aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/DocBook/dvb/dvbapi.xml2
-rw-r--r--Documentation/DocBook/media.tmpl4
-rw-r--r--Documentation/DocBook/v4l/dev-rds.xml6
-rw-r--r--Documentation/DocBook/v4l/v4l2.xml3
-rw-r--r--Documentation/arm/Booting33
-rw-r--r--Documentation/devicetree/bindings/ata/fsl-sata.txt (renamed from Documentation/powerpc/dts-bindings/fsl/sata.txt)0
-rw-r--r--Documentation/devicetree/bindings/eeprom.txt (renamed from Documentation/powerpc/dts-bindings/eeprom.txt)0
-rw-r--r--Documentation/devicetree/bindings/gpio/8xxx_gpio.txt (renamed from Documentation/powerpc/dts-bindings/fsl/8xxx_gpio.txt)0
-rw-r--r--Documentation/devicetree/bindings/gpio/gpio.txt (renamed from Documentation/powerpc/dts-bindings/gpio/gpio.txt)0
-rw-r--r--Documentation/devicetree/bindings/gpio/led.txt (renamed from Documentation/powerpc/dts-bindings/gpio/led.txt)0
-rw-r--r--Documentation/devicetree/bindings/i2c/fsl-i2c.txt (renamed from Documentation/powerpc/dts-bindings/fsl/i2c.txt)0
-rw-r--r--Documentation/devicetree/bindings/marvell.txt (renamed from Documentation/powerpc/dts-bindings/marvell.txt)0
-rw-r--r--Documentation/devicetree/bindings/mmc/fsl-esdhc.txt (renamed from Documentation/powerpc/dts-bindings/fsl/esdhc.txt)0
-rw-r--r--Documentation/devicetree/bindings/mmc/mmc-spi-slot.txt (renamed from Documentation/powerpc/dts-bindings/mmc-spi-slot.txt)0
-rw-r--r--Documentation/devicetree/bindings/mtd/fsl-upm-nand.txt (renamed from Documentation/powerpc/dts-bindings/fsl/upm-nand.txt)0
-rw-r--r--Documentation/devicetree/bindings/mtd/mtd-physmap.txt (renamed from Documentation/powerpc/dts-bindings/mtd-physmap.txt)0
-rw-r--r--Documentation/devicetree/bindings/net/can/mpc5xxx-mscan.txt (renamed from Documentation/powerpc/dts-bindings/fsl/can.txt)0
-rw-r--r--Documentation/devicetree/bindings/net/can/sja1000.txt (renamed from Documentation/powerpc/dts-bindings/can/sja1000.txt)0
-rw-r--r--Documentation/devicetree/bindings/net/fsl-tsec-phy.txt (renamed from Documentation/powerpc/dts-bindings/fsl/tsec.txt)0
-rw-r--r--Documentation/devicetree/bindings/net/mdio-gpio.txt (renamed from Documentation/powerpc/dts-bindings/gpio/mdio.txt)0
-rw-r--r--Documentation/devicetree/bindings/net/phy.txt (renamed from Documentation/powerpc/dts-bindings/phy.txt)0
-rw-r--r--Documentation/devicetree/bindings/pci/83xx-512x-pci.txt (renamed from Documentation/powerpc/dts-bindings/fsl/83xx-512x-pci.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/4xx/cpm.txt (renamed from Documentation/powerpc/dts-bindings/4xx/cpm.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/4xx/emac.txt (renamed from Documentation/powerpc/dts-bindings/4xx/emac.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/4xx/ndfc.txt (renamed from Documentation/powerpc/dts-bindings/4xx/ndfc.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/4xx/ppc440spe-adma.txt (renamed from Documentation/powerpc/dts-bindings/4xx/ppc440spe-adma.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/4xx/reboot.txt (renamed from Documentation/powerpc/dts-bindings/4xx/reboot.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/board.txt (renamed from Documentation/powerpc/dts-bindings/fsl/board.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/cpm.txt (renamed from Documentation/powerpc/dts-bindings/fsl/cpm_qe/cpm.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/cpm/brg.txt (renamed from Documentation/powerpc/dts-bindings/fsl/cpm_qe/cpm/brg.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/cpm/i2c.txt (renamed from Documentation/powerpc/dts-bindings/fsl/cpm_qe/cpm/i2c.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/cpm/pic.txt (renamed from Documentation/powerpc/dts-bindings/fsl/cpm_qe/cpm/pic.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/cpm/usb.txt (renamed from Documentation/powerpc/dts-bindings/fsl/cpm_qe/cpm/usb.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/gpio.txt (renamed from Documentation/powerpc/dts-bindings/fsl/cpm_qe/gpio.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/network.txt (renamed from Documentation/powerpc/dts-bindings/fsl/cpm_qe/network.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/qe.txt (renamed from Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/qe/firmware.txt (renamed from Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe/firmware.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/qe/par_io.txt (renamed from Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe/par_io.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/qe/pincfg.txt (renamed from Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe/pincfg.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/qe/ucc.txt (renamed from Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe/ucc.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/qe/usb.txt (renamed from Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe/usb.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/serial.txt (renamed from Documentation/powerpc/dts-bindings/fsl/cpm_qe/serial.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/diu.txt (renamed from Documentation/powerpc/dts-bindings/fsl/diu.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/dma.txt (renamed from Documentation/powerpc/dts-bindings/fsl/dma.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/ecm.txt (renamed from Documentation/powerpc/dts-bindings/ecm.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/gtm.txt (renamed from Documentation/powerpc/dts-bindings/fsl/gtm.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/guts.txt (renamed from Documentation/powerpc/dts-bindings/fsl/guts.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/lbc.txt (renamed from Documentation/powerpc/dts-bindings/fsl/lbc.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/mcm.txt (renamed from Documentation/powerpc/dts-bindings/fsl/mcm.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/mcu-mpc8349emitx.txt (renamed from Documentation/powerpc/dts-bindings/fsl/mcu-mpc8349emitx.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/mpc5121-psc.txt (renamed from Documentation/powerpc/dts-bindings/fsl/mpc5121-psc.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/mpc5200.txt (renamed from Documentation/powerpc/dts-bindings/fsl/mpc5200.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/mpic.txt (renamed from Documentation/powerpc/dts-bindings/fsl/mpic.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/msi-pic.txt (renamed from Documentation/powerpc/dts-bindings/fsl/msi-pic.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/pmc.txt (renamed from Documentation/powerpc/dts-bindings/fsl/pmc.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/sec.txt (renamed from Documentation/powerpc/dts-bindings/fsl/sec.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/fsl/ssi.txt (renamed from Documentation/powerpc/dts-bindings/fsl/ssi.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/nintendo/gamecube.txt (renamed from Documentation/powerpc/dts-bindings/nintendo/gamecube.txt)0
-rw-r--r--Documentation/devicetree/bindings/powerpc/nintendo/wii.txt (renamed from Documentation/powerpc/dts-bindings/nintendo/wii.txt)0
-rw-r--r--Documentation/devicetree/bindings/spi/fsl-spi.txt (renamed from Documentation/powerpc/dts-bindings/fsl/spi.txt)0
-rw-r--r--Documentation/devicetree/bindings/spi/spi-bus.txt (renamed from Documentation/powerpc/dts-bindings/spi-bus.txt)0
-rw-r--r--Documentation/devicetree/bindings/usb/fsl-usb.txt (renamed from Documentation/powerpc/dts-bindings/fsl/usb.txt)0
-rw-r--r--Documentation/devicetree/bindings/usb/usb-ehci.txt (renamed from Documentation/powerpc/dts-bindings/usb-ehci.txt)0
-rw-r--r--Documentation/devicetree/bindings/xilinx.txt (renamed from Documentation/powerpc/dts-bindings/xilinx.txt)0
-rw-r--r--Documentation/devicetree/booting-without-of.txt (renamed from Documentation/powerpc/booting-without-of.txt)193
-rw-r--r--Documentation/feature-removal-schedule.txt8
-rw-r--r--Documentation/lguest/lguest.c73
-rw-r--r--Documentation/lguest/lguest.txt5
-rw-r--r--Documentation/sound/alsa/soc/codec.txt45
-rw-r--r--Documentation/sound/alsa/soc/machine.txt38
-rw-r--r--Documentation/sound/alsa/soc/platform.txt12
-rw-r--r--Documentation/video4linux/v4l2-controls.txt12
-rw-r--r--MAINTAINERS62
-rw-r--r--Makefile2
-rw-r--r--arch/alpha/Kconfig19
-rw-r--r--arch/arm/configs/ag5evm_defconfig2
-rw-r--r--arch/arm/configs/am200epdkit_defconfig2
-rw-r--r--arch/arm/configs/at572d940hfek_defconfig2
-rw-r--r--arch/arm/configs/badge4_defconfig2
-rw-r--r--arch/arm/configs/bcmring_defconfig2
-rw-r--r--arch/arm/configs/cm_x2xx_defconfig2
-rw-r--r--arch/arm/configs/colibri_pxa270_defconfig2
-rw-r--r--arch/arm/configs/collie_defconfig2
-rw-r--r--arch/arm/configs/corgi_defconfig2
-rw-r--r--arch/arm/configs/da8xx_omapl_defconfig2
-rw-r--r--arch/arm/configs/davinci_all_defconfig2
-rw-r--r--arch/arm/configs/dove_defconfig2
-rw-r--r--arch/arm/configs/ebsa110_defconfig2
-rw-r--r--arch/arm/configs/edb7211_defconfig2
-rw-r--r--arch/arm/configs/em_x270_defconfig2
-rw-r--r--arch/arm/configs/ep93xx_defconfig2
-rw-r--r--arch/arm/configs/eseries_pxa_defconfig2
-rw-r--r--arch/arm/configs/ezx_defconfig2
-rw-r--r--arch/arm/configs/footbridge_defconfig2
-rw-r--r--arch/arm/configs/fortunet_defconfig2
-rw-r--r--arch/arm/configs/h5000_defconfig2
-rw-r--r--arch/arm/configs/imote2_defconfig2
-rw-r--r--arch/arm/configs/ixp2000_defconfig2
-rw-r--r--arch/arm/configs/ixp23xx_defconfig2
-rw-r--r--arch/arm/configs/ixp4xx_defconfig2
-rw-r--r--arch/arm/configs/loki_defconfig2
-rw-r--r--arch/arm/configs/lpd7a400_defconfig2
-rw-r--r--arch/arm/configs/lpd7a404_defconfig2
-rw-r--r--arch/arm/configs/magician_defconfig2
-rw-r--r--arch/arm/configs/mv78xx0_defconfig2
-rw-r--r--arch/arm/configs/mx1_defconfig2
-rw-r--r--arch/arm/configs/mx21_defconfig2
-rw-r--r--arch/arm/configs/mx27_defconfig2
-rw-r--r--arch/arm/configs/mx3_defconfig2
-rw-r--r--arch/arm/configs/mx51_defconfig2
-rw-r--r--arch/arm/configs/nhk8815_defconfig2
-rw-r--r--arch/arm/configs/omap1_defconfig2
-rw-r--r--arch/arm/configs/omap2plus_defconfig2
-rw-r--r--arch/arm/configs/orion5x_defconfig2
-rw-r--r--arch/arm/configs/pcm027_defconfig2
-rw-r--r--arch/arm/configs/pcontrol_g20_defconfig2
-rw-r--r--arch/arm/configs/pleb_defconfig2
-rw-r--r--arch/arm/configs/pnx4008_defconfig2
-rw-r--r--arch/arm/configs/simpad_defconfig2
-rw-r--r--arch/arm/configs/spitz_defconfig2
-rw-r--r--arch/arm/configs/stmp378x_defconfig2
-rw-r--r--arch/arm/configs/stmp37xx_defconfig2
-rw-r--r--arch/arm/configs/tct_hammer_defconfig2
-rw-r--r--arch/arm/configs/trizeps4_defconfig2
-rw-r--r--arch/arm/configs/u300_defconfig2
-rw-r--r--arch/arm/configs/viper_defconfig2
-rw-r--r--arch/arm/configs/xcep_defconfig2
-rw-r--r--arch/arm/mach-msm/board-qsd8x50.c4
-rw-r--r--arch/avr32/Kconfig4
-rw-r--r--arch/blackfin/Kconfig17
-rw-r--r--arch/blackfin/configs/BF518F-EZBRD_defconfig2
-rw-r--r--arch/blackfin/configs/BF526-EZBRD_defconfig2
-rw-r--r--arch/blackfin/configs/BF527-AD7160-EVAL_defconfig2
-rw-r--r--arch/blackfin/configs/BF527-EZKIT-V2_defconfig2
-rw-r--r--arch/blackfin/configs/BF527-EZKIT_defconfig2
-rw-r--r--arch/blackfin/configs/BF527-TLL6527M_defconfig2
-rw-r--r--arch/blackfin/configs/BF533-EZKIT_defconfig2
-rw-r--r--arch/blackfin/configs/BF533-STAMP_defconfig2
-rw-r--r--arch/blackfin/configs/BF537-STAMP_defconfig2
-rw-r--r--arch/blackfin/configs/BF538-EZKIT_defconfig2
-rw-r--r--arch/blackfin/configs/BF548-EZKIT_defconfig2
-rw-r--r--arch/blackfin/configs/BF561-ACVILON_defconfig2
-rw-r--r--arch/blackfin/configs/BF561-EZKIT-SMP_defconfig2
-rw-r--r--arch/blackfin/configs/BF561-EZKIT_defconfig2
-rw-r--r--arch/blackfin/configs/BlackStamp_defconfig2
-rw-r--r--arch/blackfin/configs/CM-BF527_defconfig2
-rw-r--r--arch/blackfin/configs/CM-BF533_defconfig2
-rw-r--r--arch/blackfin/configs/CM-BF537E_defconfig2
-rw-r--r--arch/blackfin/configs/CM-BF537U_defconfig2
-rw-r--r--arch/blackfin/configs/CM-BF548_defconfig2
-rw-r--r--arch/blackfin/configs/CM-BF561_defconfig2
-rw-r--r--arch/blackfin/configs/DNP5370_defconfig2
-rw-r--r--arch/blackfin/configs/H8606_defconfig2
-rw-r--r--arch/blackfin/configs/IP0X_defconfig2
-rw-r--r--arch/blackfin/configs/PNAV-10_defconfig2
-rw-r--r--arch/blackfin/configs/SRV1_defconfig2
-rw-r--r--arch/blackfin/configs/TCM-BF518_defconfig2
-rw-r--r--arch/blackfin/configs/TCM-BF537_defconfig2
-rw-r--r--arch/cris/Kconfig6
-rw-r--r--arch/cris/arch-v10/kernel/irq.c41
-rw-r--r--arch/cris/arch-v32/kernel/irq.c50
-rw-r--r--arch/cris/configs/artpec_3_defconfig2
-rw-r--r--arch/cris/configs/etrax-100lx_v2_defconfig2
-rw-r--r--arch/cris/configs/etraxfs_defconfig2
-rw-r--r--arch/cris/kernel/irq.c6
-rw-r--r--arch/frv/Kconfig9
-rw-r--r--arch/frv/defconfig2
-rw-r--r--arch/h8300/Kconfig6
-rw-r--r--arch/h8300/defconfig2
-rw-r--r--arch/h8300/kernel/irq.c50
-rw-r--r--arch/ia64/Kconfig26
-rw-r--r--arch/m32r/Kconfig11
-rw-r--r--arch/m32r/configs/m32700ut.smp_defconfig2
-rw-r--r--arch/m32r/configs/m32700ut.up_defconfig2
-rw-r--r--arch/m32r/configs/mappi.nommu_defconfig2
-rw-r--r--arch/m32r/configs/mappi.smp_defconfig2
-rw-r--r--arch/m32r/configs/mappi.up_defconfig2
-rw-r--r--arch/m32r/configs/mappi2.opsp_defconfig2
-rw-r--r--arch/m32r/configs/mappi2.vdec2_defconfig2
-rw-r--r--arch/m32r/configs/mappi3.smp_defconfig2
-rw-r--r--arch/m32r/configs/oaks32r_defconfig2
-rw-r--r--arch/m32r/configs/opsput_defconfig2
-rw-r--r--arch/m32r/configs/usrv_defconfig2
-rw-r--r--arch/m32r/kernel/irq.c10
-rw-r--r--arch/m32r/platforms/m32104ut/setup.c58
-rw-r--r--arch/m32r/platforms/m32700ut/setup.c214
-rw-r--r--arch/m32r/platforms/mappi/setup.c78
-rw-r--r--arch/m32r/platforms/mappi2/setup.c89
-rw-r--r--arch/m32r/platforms/mappi3/setup.c92
-rw-r--r--arch/m32r/platforms/oaks32r/setup.c65
-rw-r--r--arch/m32r/platforms/opsput/setup.c220
-rw-r--r--arch/m32r/platforms/usrv/setup.c115
-rw-r--r--arch/m68knommu/Kconfig9
-rw-r--r--arch/m68knommu/configs/m5208evb_defconfig2
-rw-r--r--arch/m68knommu/configs/m5249evb_defconfig2
-rw-r--r--arch/m68knommu/configs/m5272c3_defconfig2
-rw-r--r--arch/m68knommu/configs/m5275evb_defconfig2
-rw-r--r--arch/m68knommu/configs/m5307c3_defconfig2
-rw-r--r--arch/m68knommu/configs/m5407c3_defconfig2
-rw-r--r--arch/m68knommu/defconfig2
-rw-r--r--arch/microblaze/Kconfig11
-rw-r--r--arch/microblaze/configs/mmu_defconfig2
-rw-r--r--arch/microblaze/configs/nommu_defconfig2
-rw-r--r--arch/mips/Kconfig3
-rw-r--r--arch/mips/Kconfig.debug2
-rw-r--r--arch/mips/configs/ar7_defconfig2
-rw-r--r--arch/mips/configs/bcm47xx_defconfig2
-rw-r--r--arch/mips/configs/bcm63xx_defconfig2
-rw-r--r--arch/mips/configs/bigsur_defconfig2
-rw-r--r--arch/mips/configs/capcella_defconfig2
-rw-r--r--arch/mips/configs/cavium-octeon_defconfig2
-rw-r--r--arch/mips/configs/cobalt_defconfig2
-rw-r--r--arch/mips/configs/db1000_defconfig2
-rw-r--r--arch/mips/configs/db1100_defconfig2
-rw-r--r--arch/mips/configs/db1200_defconfig2
-rw-r--r--arch/mips/configs/db1500_defconfig2
-rw-r--r--arch/mips/configs/db1550_defconfig2
-rw-r--r--arch/mips/configs/decstation_defconfig2
-rw-r--r--arch/mips/configs/e55_defconfig2
-rw-r--r--arch/mips/configs/fuloong2e_defconfig2
-rw-r--r--arch/mips/configs/gpr_defconfig2
-rw-r--r--arch/mips/configs/ip22_defconfig2
-rw-r--r--arch/mips/configs/ip27_defconfig2
-rw-r--r--arch/mips/configs/ip28_defconfig2
-rw-r--r--arch/mips/configs/ip32_defconfig2
-rw-r--r--arch/mips/configs/jazz_defconfig2
-rw-r--r--arch/mips/configs/jmr3927_defconfig2
-rw-r--r--arch/mips/configs/lasat_defconfig2
-rw-r--r--arch/mips/configs/lemote2f_defconfig2
-rw-r--r--arch/mips/configs/malta_defconfig2
-rw-r--r--arch/mips/configs/markeins_defconfig2
-rw-r--r--arch/mips/configs/mipssim_defconfig2
-rw-r--r--arch/mips/configs/mpc30x_defconfig2
-rw-r--r--arch/mips/configs/msp71xx_defconfig2
-rw-r--r--arch/mips/configs/mtx1_defconfig2
-rw-r--r--arch/mips/configs/pb1100_defconfig2
-rw-r--r--arch/mips/configs/pb1200_defconfig2
-rw-r--r--arch/mips/configs/pb1500_defconfig2
-rw-r--r--arch/mips/configs/pb1550_defconfig2
-rw-r--r--arch/mips/configs/pnx8335-stb225_defconfig2
-rw-r--r--arch/mips/configs/pnx8550-jbs_defconfig2
-rw-r--r--arch/mips/configs/pnx8550-stb810_defconfig2
-rw-r--r--arch/mips/configs/powertv_defconfig2
-rw-r--r--arch/mips/configs/rb532_defconfig2
-rw-r--r--arch/mips/configs/rbtx49xx_defconfig2
-rw-r--r--arch/mips/configs/rm200_defconfig2
-rw-r--r--arch/mips/configs/sb1250-swarm_defconfig2
-rw-r--r--arch/mips/configs/tb0219_defconfig2
-rw-r--r--arch/mips/configs/tb0226_defconfig2
-rw-r--r--arch/mips/configs/tb0287_defconfig2
-rw-r--r--arch/mips/configs/workpad_defconfig2
-rw-r--r--arch/mips/configs/wrppmc_defconfig2
-rw-r--r--arch/mips/configs/yosemite_defconfig2
-rw-r--r--arch/mn10300/Kconfig8
-rw-r--r--arch/mn10300/configs/asb2303_defconfig2
-rw-r--r--arch/mn10300/configs/asb2364_defconfig2
-rw-r--r--arch/parisc/Kconfig18
-rw-r--r--arch/parisc/configs/a500_defconfig2
-rw-r--r--arch/parisc/configs/c3000_defconfig2
-rw-r--r--arch/powerpc/Kconfig28
-rw-r--r--arch/powerpc/boot/Makefile2
-rw-r--r--arch/powerpc/boot/dts/mpc8308rdb.dts2
-rw-r--r--arch/powerpc/boot/dts/p1022ds.dts4
-rw-r--r--arch/powerpc/configs/40x/acadia_defconfig2
-rw-r--r--arch/powerpc/configs/40x/ep405_defconfig2
-rw-r--r--arch/powerpc/configs/40x/hcu4_defconfig2
-rw-r--r--arch/powerpc/configs/40x/kilauea_defconfig2
-rw-r--r--arch/powerpc/configs/40x/makalu_defconfig2
-rw-r--r--arch/powerpc/configs/40x/walnut_defconfig2
-rw-r--r--arch/powerpc/configs/44x/arches_defconfig2
-rw-r--r--arch/powerpc/configs/44x/bamboo_defconfig2
-rw-r--r--arch/powerpc/configs/44x/bluestone_defconfig2
-rw-r--r--arch/powerpc/configs/44x/canyonlands_defconfig2
-rw-r--r--arch/powerpc/configs/44x/ebony_defconfig2
-rw-r--r--arch/powerpc/configs/44x/eiger_defconfig2
-rw-r--r--arch/powerpc/configs/44x/icon_defconfig2
-rw-r--r--arch/powerpc/configs/44x/iss476-smp_defconfig2
-rw-r--r--arch/powerpc/configs/44x/katmai_defconfig2
-rw-r--r--arch/powerpc/configs/44x/rainier_defconfig2
-rw-r--r--arch/powerpc/configs/44x/redwood_defconfig2
-rw-r--r--arch/powerpc/configs/44x/sam440ep_defconfig2
-rw-r--r--arch/powerpc/configs/44x/sequoia_defconfig2
-rw-r--r--arch/powerpc/configs/44x/taishan_defconfig2
-rw-r--r--arch/powerpc/configs/44x/warp_defconfig2
-rw-r--r--arch/powerpc/configs/52xx/cm5200_defconfig2
-rw-r--r--arch/powerpc/configs/52xx/lite5200b_defconfig2
-rw-r--r--arch/powerpc/configs/52xx/motionpro_defconfig2
-rw-r--r--arch/powerpc/configs/52xx/pcm030_defconfig2
-rw-r--r--arch/powerpc/configs/52xx/tqm5200_defconfig2
-rw-r--r--arch/powerpc/configs/83xx/asp8347_defconfig2
-rw-r--r--arch/powerpc/configs/83xx/kmeter1_defconfig2
-rw-r--r--arch/powerpc/configs/83xx/mpc8313_rdb_defconfig2
-rw-r--r--arch/powerpc/configs/83xx/mpc8315_rdb_defconfig2
-rw-r--r--arch/powerpc/configs/83xx/mpc832x_mds_defconfig2
-rw-r--r--arch/powerpc/configs/83xx/mpc832x_rdb_defconfig2
-rw-r--r--arch/powerpc/configs/83xx/mpc834x_itx_defconfig2
-rw-r--r--arch/powerpc/configs/83xx/mpc834x_itxgp_defconfig2
-rw-r--r--arch/powerpc/configs/83xx/mpc834x_mds_defconfig2
-rw-r--r--arch/powerpc/configs/83xx/mpc836x_mds_defconfig2
-rw-r--r--arch/powerpc/configs/83xx/mpc836x_rdk_defconfig2
-rw-r--r--arch/powerpc/configs/83xx/mpc837x_mds_defconfig2
-rw-r--r--arch/powerpc/configs/83xx/mpc837x_rdb_defconfig2
-rw-r--r--arch/powerpc/configs/83xx/sbc834x_defconfig2
-rw-r--r--arch/powerpc/configs/85xx/ksi8560_defconfig2
-rw-r--r--arch/powerpc/configs/85xx/mpc8540_ads_defconfig2
-rw-r--r--arch/powerpc/configs/85xx/mpc8560_ads_defconfig2
-rw-r--r--arch/powerpc/configs/85xx/mpc85xx_cds_defconfig2
-rw-r--r--arch/powerpc/configs/85xx/sbc8548_defconfig2
-rw-r--r--arch/powerpc/configs/85xx/sbc8560_defconfig2
-rw-r--r--arch/powerpc/configs/85xx/socrates_defconfig2
-rw-r--r--arch/powerpc/configs/85xx/stx_gp3_defconfig2
-rw-r--r--arch/powerpc/configs/85xx/tqm8540_defconfig2
-rw-r--r--arch/powerpc/configs/85xx/tqm8541_defconfig2
-rw-r--r--arch/powerpc/configs/85xx/tqm8548_defconfig2
-rw-r--r--arch/powerpc/configs/85xx/tqm8555_defconfig2
-rw-r--r--arch/powerpc/configs/85xx/tqm8560_defconfig2
-rw-r--r--arch/powerpc/configs/85xx/xes_mpc85xx_defconfig2
-rw-r--r--arch/powerpc/configs/86xx/gef_ppc9a_defconfig2
-rw-r--r--arch/powerpc/configs/86xx/gef_sbc310_defconfig2
-rw-r--r--arch/powerpc/configs/86xx/gef_sbc610_defconfig2
-rw-r--r--arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig2
-rw-r--r--arch/powerpc/configs/86xx/mpc8641_hpcn_defconfig2
-rw-r--r--arch/powerpc/configs/86xx/sbc8641d_defconfig2
-rw-r--r--arch/powerpc/configs/adder875_defconfig2
-rw-r--r--arch/powerpc/configs/e55xx_smp_defconfig2
-rw-r--r--arch/powerpc/configs/ep8248e_defconfig2
-rw-r--r--arch/powerpc/configs/ep88xc_defconfig2
-rw-r--r--arch/powerpc/configs/gamecube_defconfig2
-rw-r--r--arch/powerpc/configs/holly_defconfig2
-rw-r--r--arch/powerpc/configs/mgcoge_defconfig2
-rw-r--r--arch/powerpc/configs/mgsuvd_defconfig2
-rw-r--r--arch/powerpc/configs/mpc7448_hpc2_defconfig2
-rw-r--r--arch/powerpc/configs/mpc8272_ads_defconfig2
-rw-r--r--arch/powerpc/configs/mpc83xx_defconfig2
-rw-r--r--arch/powerpc/configs/mpc85xx_defconfig2
-rw-r--r--arch/powerpc/configs/mpc85xx_smp_defconfig2
-rw-r--r--arch/powerpc/configs/mpc866_ads_defconfig2
-rw-r--r--arch/powerpc/configs/mpc86xx_defconfig2
-rw-r--r--arch/powerpc/configs/mpc885_ads_defconfig2
-rw-r--r--arch/powerpc/configs/ppc40x_defconfig2
-rw-r--r--arch/powerpc/configs/ppc44x_defconfig2
-rw-r--r--arch/powerpc/configs/pq2fads_defconfig2
-rw-r--r--arch/powerpc/configs/ps3_defconfig2
-rw-r--r--arch/powerpc/configs/pseries_defconfig7
-rw-r--r--arch/powerpc/configs/storcenter_defconfig2
-rw-r--r--arch/powerpc/configs/tqm8xx_defconfig2
-rw-r--r--arch/powerpc/configs/wii_defconfig2
-rw-r--r--arch/powerpc/include/asm/feature-fixups.h27
-rw-r--r--arch/powerpc/include/asm/immap_qe.h21
-rw-r--r--arch/powerpc/include/asm/irqflags.h40
-rw-r--r--arch/powerpc/include/asm/machdep.h18
-rw-r--r--arch/powerpc/include/asm/reg.h2
-rw-r--r--arch/powerpc/include/asm/reg_booke.h14
-rw-r--r--arch/powerpc/include/asm/spu.h8
-rw-r--r--arch/powerpc/kernel/cpu_setup_fsl_booke.S6
-rw-r--r--arch/powerpc/kernel/cputable.c23
-rw-r--r--arch/powerpc/kernel/crash.c72
-rw-r--r--arch/powerpc/kernel/entry_32.S11
-rw-r--r--arch/powerpc/kernel/machine_kexec.c19
-rw-r--r--arch/powerpc/kernel/process.c2
-rw-r--r--arch/powerpc/kernel/rtas_flash.c53
-rw-r--r--arch/powerpc/kernel/rtasd.c2
-rw-r--r--arch/powerpc/kernel/time.c25
-rw-r--r--arch/powerpc/kernel/traps.c12
-rw-r--r--arch/powerpc/lib/feature-fixups-test.S19
-rw-r--r--arch/powerpc/platforms/83xx/mpc830x_rdb.c4
-rw-r--r--arch/powerpc/platforms/83xx/mpc831x_rdb.c4
-rw-r--r--arch/powerpc/platforms/83xx/mpc83xx.h2
-rw-r--r--arch/powerpc/platforms/83xx/usb.c21
-rw-r--r--arch/powerpc/platforms/cell/cpufreq_spudemand.c20
-rw-r--r--arch/powerpc/platforms/cell/qpace_setup.c5
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c70
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c27
-rw-r--r--arch/powerpc/platforms/embedded6xx/gamecube.c11
-rw-r--r--arch/powerpc/platforms/embedded6xx/wii.c11
-rw-r--r--arch/powerpc/platforms/iseries/Kconfig2
-rw-r--r--arch/powerpc/platforms/pseries/Kconfig6
-rw-r--r--arch/powerpc/platforms/pseries/kexec.c10
-rw-r--r--arch/powerpc/platforms/pseries/ras.c102
-rw-r--r--arch/powerpc/sysdev/fsl_rio.c2
-rw-r--r--arch/powerpc/sysdev/mpic.c6
-rw-r--r--arch/score/Kconfig10
-rw-r--r--arch/score/configs/spct6600_defconfig2
-rw-r--r--arch/sh/Kconfig2
-rw-r--r--arch/sparc/Kconfig9
-rw-r--r--arch/tile/Kconfig55
-rw-r--r--arch/tile/Kconfig.debug2
-rw-r--r--arch/tile/configs/tile_defconfig2
-rw-r--r--arch/um/Kconfig.common6
-rw-r--r--arch/um/Kconfig.um3
-rw-r--r--arch/um/defconfig2
-rw-r--r--arch/x86/Kconfig20
-rw-r--r--arch/x86/Kconfig.cpu2
-rw-r--r--arch/x86/Kconfig.debug4
-rw-r--r--arch/x86/include/asm/numa_32.h2
-rw-r--r--arch/x86/include/asm/numa_64.h1
-rw-r--r--arch/x86/include/asm/percpu.h8
-rw-r--r--arch/x86/kernel/vmlinux.lds.S11
-rw-r--r--arch/x86/lguest/Kconfig1
-rw-r--r--arch/x86/lguest/boot.c2
-rw-r--r--arch/x86/mm/numa.c22
-rw-r--r--arch/x86/mm/numa_64.c24
-rw-r--r--arch/x86/mm/srat_32.c1
-rw-r--r--arch/x86/xen/enlighten.c2
-rw-r--r--arch/x86/xen/irq.c2
-rw-r--r--arch/x86/xen/p2m.c20
-rw-r--r--arch/xtensa/configs/common_defconfig2
-rw-r--r--arch/xtensa/configs/iss_defconfig2
-rw-r--r--arch/xtensa/configs/s6105_defconfig2
-rw-r--r--block/Kconfig2
-rw-r--r--drivers/Makefile3
-rw-r--r--drivers/acpi/Kconfig2
-rw-r--r--drivers/acpi/acpica/accommon.h2
-rw-r--r--drivers/acpi/acpica/acconfig.h2
-rw-r--r--drivers/acpi/acpica/acdebug.h2
-rw-r--r--drivers/acpi/acpica/acdispat.h2
-rw-r--r--drivers/acpi/acpica/acevents.h2
-rw-r--r--drivers/acpi/acpica/acglobal.h2
-rw-r--r--drivers/acpi/acpica/achware.h2
-rw-r--r--drivers/acpi/acpica/acinterp.h2
-rw-r--r--drivers/acpi/acpica/aclocal.h2
-rw-r--r--drivers/acpi/acpica/acmacros.h2
-rw-r--r--drivers/acpi/acpica/acnamesp.h2
-rw-r--r--drivers/acpi/acpica/acobject.h16
-rw-r--r--drivers/acpi/acpica/acopcode.h2
-rw-r--r--drivers/acpi/acpica/acparser.h2
-rw-r--r--drivers/acpi/acpica/acpredef.h2
-rw-r--r--drivers/acpi/acpica/acresrc.h2
-rw-r--r--drivers/acpi/acpica/acstruct.h2
-rw-r--r--drivers/acpi/acpica/actables.h2
-rw-r--r--drivers/acpi/acpica/acutils.h2
-rw-r--r--drivers/acpi/acpica/amlcode.h10
-rw-r--r--drivers/acpi/acpica/amlresrc.h2
-rw-r--r--drivers/acpi/acpica/dsfield.c2
-rw-r--r--drivers/acpi/acpica/dsinit.c2
-rw-r--r--drivers/acpi/acpica/dsmethod.c64
-rw-r--r--drivers/acpi/acpica/dsmthdat.c2
-rw-r--r--drivers/acpi/acpica/dsobject.c2
-rw-r--r--drivers/acpi/acpica/dsopcode.c2
-rw-r--r--drivers/acpi/acpica/dsutils.c2
-rw-r--r--drivers/acpi/acpica/dswexec.c2
-rw-r--r--drivers/acpi/acpica/dswload.c2
-rw-r--r--drivers/acpi/acpica/dswscope.c2
-rw-r--r--drivers/acpi/acpica/dswstate.c2
-rw-r--r--drivers/acpi/acpica/evevent.c2
-rw-r--r--drivers/acpi/acpica/evgpe.c4
-rw-r--r--drivers/acpi/acpica/evgpeblk.c2
-rw-r--r--drivers/acpi/acpica/evgpeinit.c2
-rw-r--r--drivers/acpi/acpica/evgpeutil.c2
-rw-r--r--drivers/acpi/acpica/evmisc.c2
-rw-r--r--drivers/acpi/acpica/evregion.c2
-rw-r--r--drivers/acpi/acpica/evrgnini.c6
-rw-r--r--drivers/acpi/acpica/evsci.c2
-rw-r--r--drivers/acpi/acpica/evxface.c2
-rw-r--r--drivers/acpi/acpica/evxfevnt.c2
-rw-r--r--drivers/acpi/acpica/evxfgpe.c2
-rw-r--r--drivers/acpi/acpica/evxfregn.c2
-rw-r--r--drivers/acpi/acpica/exconfig.c2
-rw-r--r--drivers/acpi/acpica/exconvrt.c2
-rw-r--r--drivers/acpi/acpica/excreate.c10
-rw-r--r--drivers/acpi/acpica/exdebug.c2
-rw-r--r--drivers/acpi/acpica/exdump.c4
-rw-r--r--drivers/acpi/acpica/exfield.c2
-rw-r--r--drivers/acpi/acpica/exfldio.c2
-rw-r--r--drivers/acpi/acpica/exmisc.c2
-rw-r--r--drivers/acpi/acpica/exmutex.c2
-rw-r--r--drivers/acpi/acpica/exnames.c2
-rw-r--r--drivers/acpi/acpica/exoparg1.c2
-rw-r--r--drivers/acpi/acpica/exoparg2.c2
-rw-r--r--drivers/acpi/acpica/exoparg3.c2
-rw-r--r--drivers/acpi/acpica/exoparg6.c2
-rw-r--r--drivers/acpi/acpica/exprep.c2
-rw-r--r--drivers/acpi/acpica/exregion.c2
-rw-r--r--drivers/acpi/acpica/exresnte.c2
-rw-r--r--drivers/acpi/acpica/exresolv.c2
-rw-r--r--drivers/acpi/acpica/exresop.c2
-rw-r--r--drivers/acpi/acpica/exstore.c2
-rw-r--r--drivers/acpi/acpica/exstoren.c2
-rw-r--r--drivers/acpi/acpica/exstorob.c2
-rw-r--r--drivers/acpi/acpica/exsystem.c2
-rw-r--r--drivers/acpi/acpica/exutils.c2
-rw-r--r--drivers/acpi/acpica/hwacpi.c2
-rw-r--r--drivers/acpi/acpica/hwgpe.c2
-rw-r--r--drivers/acpi/acpica/hwpci.c2
-rw-r--r--drivers/acpi/acpica/hwregs.c2
-rw-r--r--drivers/acpi/acpica/hwsleep.c2
-rw-r--r--drivers/acpi/acpica/hwtimer.c2
-rw-r--r--drivers/acpi/acpica/hwvalid.c2
-rw-r--r--drivers/acpi/acpica/hwxface.c2
-rw-r--r--drivers/acpi/acpica/nsaccess.c8
-rw-r--r--drivers/acpi/acpica/nsalloc.c15
-rw-r--r--drivers/acpi/acpica/nsdump.c17
-rw-r--r--drivers/acpi/acpica/nsdumpdv.c2
-rw-r--r--drivers/acpi/acpica/nseval.c4
-rw-r--r--drivers/acpi/acpica/nsinit.c2
-rw-r--r--drivers/acpi/acpica/nsload.c2
-rw-r--r--drivers/acpi/acpica/nsnames.c2
-rw-r--r--drivers/acpi/acpica/nsobject.c2
-rw-r--r--drivers/acpi/acpica/nsparse.c2
-rw-r--r--drivers/acpi/acpica/nspredef.c2
-rw-r--r--drivers/acpi/acpica/nsrepair.c2
-rw-r--r--drivers/acpi/acpica/nsrepair2.c2
-rw-r--r--drivers/acpi/acpica/nssearch.c2
-rw-r--r--drivers/acpi/acpica/nsutils.c2
-rw-r--r--drivers/acpi/acpica/nswalk.c2
-rw-r--r--drivers/acpi/acpica/nsxfeval.c2
-rw-r--r--drivers/acpi/acpica/nsxfname.c7
-rw-r--r--drivers/acpi/acpica/nsxfobj.c2
-rw-r--r--drivers/acpi/acpica/psargs.c2
-rw-r--r--drivers/acpi/acpica/psloop.c4
-rw-r--r--drivers/acpi/acpica/psopcode.c2
-rw-r--r--drivers/acpi/acpica/psparse.c27
-rw-r--r--drivers/acpi/acpica/psscope.c2
-rw-r--r--drivers/acpi/acpica/pstree.c2
-rw-r--r--drivers/acpi/acpica/psutils.c2
-rw-r--r--drivers/acpi/acpica/pswalk.c2
-rw-r--r--drivers/acpi/acpica/psxface.c9
-rw-r--r--drivers/acpi/acpica/rsaddr.c2
-rw-r--r--drivers/acpi/acpica/rscalc.c2
-rw-r--r--drivers/acpi/acpica/rscreate.c2
-rw-r--r--drivers/acpi/acpica/rsdump.c2
-rw-r--r--drivers/acpi/acpica/rsinfo.c2
-rw-r--r--drivers/acpi/acpica/rsio.c2
-rw-r--r--drivers/acpi/acpica/rsirq.c2
-rw-r--r--drivers/acpi/acpica/rslist.c2
-rw-r--r--drivers/acpi/acpica/rsmemory.c2
-rw-r--r--drivers/acpi/acpica/rsmisc.c2
-rw-r--r--drivers/acpi/acpica/rsutils.c2
-rw-r--r--drivers/acpi/acpica/rsxface.c2
-rw-r--r--drivers/acpi/acpica/tbfadt.c2
-rw-r--r--drivers/acpi/acpica/tbfind.c2
-rw-r--r--drivers/acpi/acpica/tbinstal.c2
-rw-r--r--drivers/acpi/acpica/tbutils.c2
-rw-r--r--drivers/acpi/acpica/tbxface.c2
-rw-r--r--drivers/acpi/acpica/tbxfroot.c2
-rw-r--r--drivers/acpi/acpica/utalloc.c2
-rw-r--r--drivers/acpi/acpica/utcopy.c2
-rw-r--r--drivers/acpi/acpica/utdebug.c2
-rw-r--r--drivers/acpi/acpica/utdelete.c2
-rw-r--r--drivers/acpi/acpica/uteval.c2
-rw-r--r--drivers/acpi/acpica/utglobal.c2
-rw-r--r--drivers/acpi/acpica/utids.c2
-rw-r--r--drivers/acpi/acpica/utinit.c2
-rw-r--r--drivers/acpi/acpica/utlock.c2
-rw-r--r--drivers/acpi/acpica/utmath.c2
-rw-r--r--drivers/acpi/acpica/utmisc.c2
-rw-r--r--drivers/acpi/acpica/utmutex.c2
-rw-r--r--drivers/acpi/acpica/utobject.c2
-rw-r--r--drivers/acpi/acpica/utosi.c2
-rw-r--r--drivers/acpi/acpica/utresrc.c2
-rw-r--r--drivers/acpi/acpica/utstate.c2
-rw-r--r--drivers/acpi/acpica/utxface.c2
-rw-r--r--drivers/acpi/acpica/utxferror.c2
-rw-r--r--drivers/acpi/battery.c1
-rw-r--r--drivers/acpi/nvs.c7
-rw-r--r--drivers/acpi/osl.c12
-rw-r--r--drivers/acpi/sleep.c2
-rw-r--r--drivers/ata/Kconfig2
-rw-r--r--drivers/base/Kconfig2
-rw-r--r--drivers/char/Kconfig12
-rw-r--r--drivers/char/Makefile13
-rw-r--r--drivers/cpufreq/Kconfig2
-rw-r--r--drivers/firewire/Kconfig6
-rw-r--r--drivers/firewire/core-card.c11
-rw-r--r--drivers/firewire/net.c9
-rw-r--r--drivers/firmware/Kconfig2
-rw-r--r--drivers/gpu/drm/Kconfig2
-rw-r--r--drivers/gpu/drm/drm_fb_helper.c4
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.c5
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.h1
-rw-r--r--drivers/gpu/drm/nouveau/Kconfig2
-rw-r--r--drivers/gpu/vga/Kconfig2
-rw-r--r--drivers/hid/Kconfig64
-rw-r--r--drivers/hid/usbhid/Kconfig2
-rw-r--r--drivers/ide/Kconfig2
-rw-r--r--drivers/infiniband/hw/mthca/Kconfig2
-rw-r--r--drivers/infiniband/ulp/ipoib/Kconfig2
-rw-r--r--drivers/input/Kconfig6
-rw-r--r--drivers/input/keyboard/Kconfig4
-rw-r--r--drivers/input/mouse/Kconfig10
-rw-r--r--drivers/input/serio/Kconfig6
-rw-r--r--drivers/input/touchscreen/Kconfig30
-rw-r--r--drivers/leds/ledtrig-gpio.c15
-rw-r--r--drivers/lguest/page_tables.c2
-rw-r--r--drivers/lguest/x86/core.c4
-rw-r--r--drivers/macintosh/therm_pm72.c4
-rw-r--r--drivers/media/common/saa7146_core.c2
-rw-r--r--drivers/media/common/saa7146_fops.c8
-rw-r--r--drivers/media/common/saa7146_vbi.c2
-rw-r--r--drivers/media/common/saa7146_video.c20
-rw-r--r--drivers/media/common/tuners/Kconfig2
-rw-r--r--drivers/media/common/tuners/tda8290.c130
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700_core.c6
-rw-r--r--drivers/media/dvb/firewire/firedtv-rc.c9
-rw-r--r--drivers/media/dvb/frontends/Kconfig2
-rw-r--r--drivers/media/dvb/frontends/af9013.c4
-rw-r--r--drivers/media/dvb/frontends/ix2505v.c2
-rw-r--r--drivers/media/dvb/frontends/mb86a20s.c36
-rw-r--r--drivers/media/dvb/ttpci/av7110_ca.c2
-rw-r--r--drivers/media/radio/Kconfig14
-rw-r--r--drivers/media/radio/Makefile1
-rw-r--r--drivers/media/radio/radio-aimslab.c1
-rw-r--r--drivers/media/radio/radio-gemtek-pci.c478
-rw-r--r--drivers/media/radio/radio-maxiradio.c4
-rw-r--r--drivers/media/radio/radio-wl1273.c2
-rw-r--r--drivers/media/radio/si470x/radio-si470x-common.c9
-rw-r--r--drivers/media/rc/ene_ir.c23
-rw-r--r--drivers/media/rc/ene_ir.h2
-rw-r--r--drivers/media/rc/imon.c60
-rw-r--r--drivers/media/rc/ir-raw.c2
-rw-r--r--drivers/media/rc/keymaps/rc-dib0700-nec.c52
-rw-r--r--drivers/media/rc/mceusb.c3
-rw-r--r--drivers/media/video/Kconfig11
-rw-r--r--drivers/media/video/Makefile1
-rw-r--r--drivers/media/video/adv7175.c11
-rw-r--r--drivers/media/video/bt8xx/bttv-cards.c39
-rw-r--r--drivers/media/video/bt8xx/bttv.h1
-rw-r--r--drivers/media/video/cafe_ccic.c11
-rw-r--r--drivers/media/video/cpia2/cpia2.h2
-rw-r--r--drivers/media/video/cpia2/cpia2_core.c65
-rw-r--r--drivers/media/video/cpia2/cpia2_v4l.c104
-rw-r--r--drivers/media/video/cx18/cx18-driver.c24
-rw-r--r--drivers/media/video/cx18/cx18-driver.h3
-rw-r--r--drivers/media/video/cx18/cx18-streams.h3
-rw-r--r--drivers/media/video/cx231xx/cx231xx-dvb.c5
-rw-r--r--drivers/media/video/cx25840/cx25840-core.c22
-rw-r--r--drivers/media/video/davinci/vpif.c177
-rw-r--r--drivers/media/video/davinci/vpif.h18
-rw-r--r--drivers/media/video/davinci/vpif_capture.c451
-rw-r--r--drivers/media/video/davinci/vpif_capture.h2
-rw-r--r--drivers/media/video/davinci/vpif_display.c474
-rw-r--r--drivers/media/video/davinci/vpif_display.h2
-rw-r--r--drivers/media/video/em28xx/em28xx-cards.c19
-rw-r--r--drivers/media/video/et61x251/et61x251.h24
-rw-r--r--drivers/media/video/gspca/benq.c2
-rw-r--r--drivers/media/video/gspca/conex.c4
-rw-r--r--drivers/media/video/gspca/cpia1.c2
-rw-r--r--drivers/media/video/gspca/etoms.c4
-rw-r--r--drivers/media/video/gspca/finepix.c2
-rw-r--r--drivers/media/video/gspca/gl860/gl860.c2
-rw-r--r--drivers/media/video/gspca/gspca.c210
-rw-r--r--drivers/media/video/gspca/gspca.h2
-rw-r--r--drivers/media/video/gspca/jeilinj.c2
-rw-r--r--drivers/media/video/gspca/jpeg.h4
-rw-r--r--drivers/media/video/gspca/konica.c2
-rw-r--r--drivers/media/video/gspca/m5602/m5602_core.c2
-rw-r--r--drivers/media/video/gspca/mars.c2
-rw-r--r--drivers/media/video/gspca/mr97310a.c2
-rw-r--r--drivers/media/video/gspca/ov519.c8
-rw-r--r--drivers/media/video/gspca/ov534.c29
-rw-r--r--drivers/media/video/gspca/ov534_9.c2
-rw-r--r--drivers/media/video/gspca/pac207.c2
-rw-r--r--drivers/media/video/gspca/pac7302.c4
-rw-r--r--drivers/media/video/gspca/pac7311.c4
-rw-r--r--drivers/media/video/gspca/sn9c2028.c2
-rw-r--r--drivers/media/video/gspca/sn9c20x.c2
-rw-r--r--drivers/media/video/gspca/sonixb.c270
-rw-r--r--drivers/media/video/gspca/sonixj.c155
-rw-r--r--drivers/media/video/gspca/spca1528.c2
-rw-r--r--drivers/media/video/gspca/spca500.c2
-rw-r--r--drivers/media/video/gspca/spca501.c2
-rw-r--r--drivers/media/video/gspca/spca505.c2
-rw-r--r--drivers/media/video/gspca/spca508.c2
-rw-r--r--drivers/media/video/gspca/spca561.c2
-rw-r--r--drivers/media/video/gspca/sq905.c2
-rw-r--r--drivers/media/video/gspca/sq905c.c2
-rw-r--r--drivers/media/video/gspca/sq930x.c2
-rw-r--r--drivers/media/video/gspca/stk014.c2
-rw-r--r--drivers/media/video/gspca/stv0680.c2
-rw-r--r--drivers/media/video/gspca/stv06xx/stv06xx.c2
-rw-r--r--drivers/media/video/gspca/sunplus.c2
-rw-r--r--drivers/media/video/gspca/t613.c2
-rw-r--r--drivers/media/video/gspca/tv8532.c2
-rw-r--r--drivers/media/video/gspca/vc032x.c2
-rw-r--r--drivers/media/video/gspca/xirlink_cit.c2
-rw-r--r--drivers/media/video/gspca/zc3xx.c2
-rw-r--r--drivers/media/video/hdpvr/Makefile4
-rw-r--r--drivers/media/video/hdpvr/hdpvr-core.c10
-rw-r--r--drivers/media/video/hdpvr/hdpvr-i2c.c143
-rw-r--r--drivers/media/video/hdpvr/hdpvr-video.c7
-rw-r--r--drivers/media/video/hdpvr/hdpvr.h5
-rw-r--r--drivers/media/video/ir-kbd-i2c.c12
-rw-r--r--drivers/media/video/ivtv/ivtv-i2c.c9
-rw-r--r--drivers/media/video/mt9v011.c54
-rw-r--r--drivers/media/video/mt9v011.h36
-rw-r--r--drivers/media/video/ov7670.c74
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h2
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-i2c-core.c62
-rw-r--r--drivers/media/video/saa7134/saa7134-cards.c51
-rw-r--r--drivers/media/video/saa7134/saa7134-dvb.c80
-rw-r--r--drivers/media/video/sn9c102/sn9c102_devtable.h74
-rw-r--r--drivers/media/video/sr030pc30.c10
-rw-r--r--drivers/media/video/tda9875.c411
-rw-r--r--drivers/media/video/tlg2300/pd-video.c13
-rw-r--r--drivers/media/video/v4l2-common.c19
-rw-r--r--drivers/media/video/v4l2-ctrls.c34
-rw-r--r--drivers/media/video/v4l2-dev.c9
-rw-r--r--drivers/media/video/v4l2-device.c16
-rw-r--r--drivers/media/video/v4l2-ioctl.c20
-rw-r--r--drivers/media/video/w9966.c1
-rw-r--r--drivers/media/video/zoran/zoran_card.c2
-rw-r--r--drivers/net/Kconfig2
-rw-r--r--drivers/net/bnx2x/bnx2x.h4
-rw-r--r--drivers/net/bnx2x/bnx2x_hsi.h4
-rw-r--r--drivers/net/bnx2x/bnx2x_link.c173
-rw-r--r--drivers/net/bnx2x/bnx2x_reg.h4
-rw-r--r--drivers/net/gianfar.c2
-rw-r--r--drivers/net/irda/sh_irda.c14
-rw-r--r--drivers/net/ns83820.c5
-rw-r--r--drivers/net/usb/cdc_ncm.c19
-rw-r--r--drivers/net/vmxnet3/vmxnet3_drv.c93
-rw-r--r--drivers/net/vmxnet3/vmxnet3_ethtool.c274
-rw-r--r--drivers/net/vmxnet3/vmxnet3_int.h7
-rw-r--r--drivers/net/wireless/ath/ath5k/base.c4
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9002_calib.c10
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h2
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_hw.c4
-rw-r--r--drivers/net/wireless/ath/ath9k/htc.h2
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_txrx.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c2
-rw-r--r--drivers/net/wireless/iwmc3200wifi/netdev.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00firmware.c1
-rw-r--r--drivers/pci/pcie/Kconfig2
-rw-r--r--drivers/pcmcia/Kconfig12
-rw-r--r--drivers/s390/net/qeth_l2_main.c18
-rw-r--r--drivers/s390/net/qeth_l3_main.c22
-rw-r--r--drivers/ssb/Kconfig2
-rw-r--r--drivers/staging/lirc/TODO.lirc_zilog36
-rw-r--r--drivers/staging/lirc/lirc_imon.c1
-rw-r--r--drivers/staging/lirc/lirc_it87.c1
-rw-r--r--drivers/staging/lirc/lirc_parallel.c19
-rw-r--r--drivers/staging/lirc/lirc_sasem.c1
-rw-r--r--drivers/staging/lirc/lirc_serial.c3
-rw-r--r--drivers/staging/lirc/lirc_sir.c1
-rw-r--r--drivers/staging/lirc/lirc_zilog.c650
-rw-r--r--drivers/staging/tm6000/tm6000-video.c46
-rw-r--r--drivers/tty/Makefile2
-rw-r--r--drivers/tty/hvc/Makefile13
-rw-r--r--drivers/tty/hvc/hvc_beat.c (renamed from drivers/char/hvc_beat.c)0
-rw-r--r--drivers/tty/hvc/hvc_console.c (renamed from drivers/char/hvc_console.c)0
-rw-r--r--drivers/tty/hvc/hvc_console.h (renamed from drivers/char/hvc_console.h)0
-rw-r--r--drivers/tty/hvc/hvc_dcc.c (renamed from drivers/char/hvc_dcc.c)0
-rw-r--r--drivers/tty/hvc/hvc_irq.c (renamed from drivers/char/hvc_irq.c)0
-rw-r--r--drivers/tty/hvc/hvc_iseries.c (renamed from drivers/char/hvc_iseries.c)0
-rw-r--r--drivers/tty/hvc/hvc_iucv.c (renamed from drivers/char/hvc_iucv.c)0
-rw-r--r--drivers/tty/hvc/hvc_rtas.c (renamed from drivers/char/hvc_rtas.c)0
-rw-r--r--drivers/tty/hvc/hvc_tile.c (renamed from drivers/char/hvc_tile.c)0
-rw-r--r--drivers/tty/hvc/hvc_udbg.c (renamed from drivers/char/hvc_udbg.c)0
-rw-r--r--drivers/tty/hvc/hvc_vio.c (renamed from drivers/char/hvc_vio.c)0
-rw-r--r--drivers/tty/hvc/hvc_xen.c (renamed from drivers/char/hvc_xen.c)0
-rw-r--r--drivers/tty/hvc/hvcs.c (renamed from drivers/char/hvcs.c)0
-rw-r--r--drivers/tty/hvc/hvsi.c (renamed from drivers/char/hvsi.c)0
-rw-r--r--drivers/tty/hvc/virtio_console.c (renamed from drivers/char/virtio_console.c)0
-rw-r--r--drivers/tty/serial/21285.c (renamed from drivers/serial/21285.c)0
-rw-r--r--drivers/tty/serial/68328serial.c (renamed from drivers/serial/68328serial.c)0
-rw-r--r--drivers/tty/serial/68328serial.h (renamed from drivers/serial/68328serial.h)0
-rw-r--r--drivers/tty/serial/68360serial.c (renamed from drivers/serial/68360serial.c)0
-rw-r--r--drivers/tty/serial/8250.c (renamed from drivers/serial/8250.c)0
-rw-r--r--drivers/tty/serial/8250.h (renamed from drivers/serial/8250.h)0
-rw-r--r--drivers/tty/serial/8250_accent.c (renamed from drivers/serial/8250_accent.c)0
-rw-r--r--drivers/tty/serial/8250_acorn.c (renamed from drivers/serial/8250_acorn.c)0
-rw-r--r--drivers/tty/serial/8250_boca.c (renamed from drivers/serial/8250_boca.c)0
-rw-r--r--drivers/tty/serial/8250_early.c (renamed from drivers/serial/8250_early.c)0
-rw-r--r--drivers/tty/serial/8250_exar_st16c554.c (renamed from drivers/serial/8250_exar_st16c554.c)0
-rw-r--r--drivers/tty/serial/8250_fourport.c (renamed from drivers/serial/8250_fourport.c)0
-rw-r--r--drivers/tty/serial/8250_gsc.c (renamed from drivers/serial/8250_gsc.c)0
-rw-r--r--drivers/tty/serial/8250_hp300.c (renamed from drivers/serial/8250_hp300.c)0
-rw-r--r--drivers/tty/serial/8250_hub6.c (renamed from drivers/serial/8250_hub6.c)0
-rw-r--r--drivers/tty/serial/8250_mca.c (renamed from drivers/serial/8250_mca.c)0
-rw-r--r--drivers/tty/serial/8250_pci.c (renamed from drivers/serial/8250_pci.c)0
-rw-r--r--drivers/tty/serial/8250_pnp.c (renamed from drivers/serial/8250_pnp.c)0
-rw-r--r--drivers/tty/serial/Kconfig (renamed from drivers/serial/Kconfig)4
-rw-r--r--drivers/tty/serial/Makefile (renamed from drivers/serial/Makefile)0
-rw-r--r--drivers/tty/serial/altera_jtaguart.c (renamed from drivers/serial/altera_jtaguart.c)0
-rw-r--r--drivers/tty/serial/altera_uart.c (renamed from drivers/serial/altera_uart.c)0
-rw-r--r--drivers/tty/serial/amba-pl010.c (renamed from drivers/serial/amba-pl010.c)0
-rw-r--r--drivers/tty/serial/amba-pl011.c (renamed from drivers/serial/amba-pl011.c)0
-rw-r--r--drivers/tty/serial/apbuart.c (renamed from drivers/serial/apbuart.c)0
-rw-r--r--drivers/tty/serial/apbuart.h (renamed from drivers/serial/apbuart.h)0
-rw-r--r--drivers/tty/serial/atmel_serial.c (renamed from drivers/serial/atmel_serial.c)0
-rw-r--r--drivers/tty/serial/bcm63xx_uart.c (renamed from drivers/serial/bcm63xx_uart.c)0
-rw-r--r--drivers/tty/serial/bfin_5xx.c (renamed from drivers/serial/bfin_5xx.c)0
-rw-r--r--drivers/tty/serial/bfin_sport_uart.c (renamed from drivers/serial/bfin_sport_uart.c)0
-rw-r--r--drivers/tty/serial/bfin_sport_uart.h (renamed from drivers/serial/bfin_sport_uart.h)0
-rw-r--r--drivers/tty/serial/clps711x.c (renamed from drivers/serial/clps711x.c)0
-rw-r--r--drivers/tty/serial/cpm_uart/Makefile (renamed from drivers/serial/cpm_uart/Makefile)0
-rw-r--r--drivers/tty/serial/cpm_uart/cpm_uart.h (renamed from drivers/serial/cpm_uart/cpm_uart.h)0
-rw-r--r--drivers/tty/serial/cpm_uart/cpm_uart_core.c (renamed from drivers/serial/cpm_uart/cpm_uart_core.c)0
-rw-r--r--drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c (renamed from drivers/serial/cpm_uart/cpm_uart_cpm1.c)0
-rw-r--r--drivers/tty/serial/cpm_uart/cpm_uart_cpm1.h (renamed from drivers/serial/cpm_uart/cpm_uart_cpm1.h)0
-rw-r--r--drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c (renamed from drivers/serial/cpm_uart/cpm_uart_cpm2.c)0
-rw-r--r--drivers/tty/serial/cpm_uart/cpm_uart_cpm2.h (renamed from drivers/serial/cpm_uart/cpm_uart_cpm2.h)0
-rw-r--r--drivers/tty/serial/crisv10.c (renamed from drivers/serial/crisv10.c)0
-rw-r--r--drivers/tty/serial/crisv10.h (renamed from drivers/serial/crisv10.h)0
-rw-r--r--drivers/tty/serial/dz.c (renamed from drivers/serial/dz.c)0
-rw-r--r--drivers/tty/serial/dz.h (renamed from drivers/serial/dz.h)0
-rw-r--r--drivers/tty/serial/icom.c (renamed from drivers/serial/icom.c)0
-rw-r--r--drivers/tty/serial/icom.h (renamed from drivers/serial/icom.h)0
-rw-r--r--drivers/tty/serial/ifx6x60.c (renamed from drivers/serial/ifx6x60.c)0
-rw-r--r--drivers/tty/serial/ifx6x60.h (renamed from drivers/serial/ifx6x60.h)0
-rw-r--r--drivers/tty/serial/imx.c (renamed from drivers/serial/imx.c)0
-rw-r--r--drivers/tty/serial/ioc3_serial.c (renamed from drivers/serial/ioc3_serial.c)0
-rw-r--r--drivers/tty/serial/ioc4_serial.c (renamed from drivers/serial/ioc4_serial.c)0
-rw-r--r--drivers/tty/serial/ip22zilog.c (renamed from drivers/serial/ip22zilog.c)0
-rw-r--r--drivers/tty/serial/ip22zilog.h (renamed from drivers/serial/ip22zilog.h)0
-rw-r--r--drivers/tty/serial/jsm/Makefile (renamed from drivers/serial/jsm/Makefile)0
-rw-r--r--drivers/tty/serial/jsm/jsm.h (renamed from drivers/serial/jsm/jsm.h)0
-rw-r--r--drivers/tty/serial/jsm/jsm_driver.c (renamed from drivers/serial/jsm/jsm_driver.c)0
-rw-r--r--drivers/tty/serial/jsm/jsm_neo.c (renamed from drivers/serial/jsm/jsm_neo.c)0
-rw-r--r--drivers/tty/serial/jsm/jsm_tty.c (renamed from drivers/serial/jsm/jsm_tty.c)0
-rw-r--r--drivers/tty/serial/kgdboc.c (renamed from drivers/serial/kgdboc.c)0
-rw-r--r--drivers/tty/serial/m32r_sio.c (renamed from drivers/serial/m32r_sio.c)0
-rw-r--r--drivers/tty/serial/m32r_sio.h (renamed from drivers/serial/m32r_sio.h)0
-rw-r--r--drivers/tty/serial/m32r_sio_reg.h (renamed from drivers/serial/m32r_sio_reg.h)0
-rw-r--r--drivers/tty/serial/max3100.c (renamed from drivers/serial/max3100.c)0
-rw-r--r--drivers/tty/serial/max3107-aava.c (renamed from drivers/serial/max3107-aava.c)0
-rw-r--r--drivers/tty/serial/max3107.c (renamed from drivers/serial/max3107.c)0
-rw-r--r--drivers/tty/serial/max3107.h (renamed from drivers/serial/max3107.h)0
-rw-r--r--drivers/tty/serial/mcf.c (renamed from drivers/serial/mcf.c)0
-rw-r--r--drivers/tty/serial/mfd.c (renamed from drivers/serial/mfd.c)0
-rw-r--r--drivers/tty/serial/mpc52xx_uart.c (renamed from drivers/serial/mpc52xx_uart.c)0
-rw-r--r--drivers/tty/serial/mpsc.c (renamed from drivers/serial/mpsc.c)0
-rw-r--r--drivers/tty/serial/mrst_max3110.c (renamed from drivers/serial/mrst_max3110.c)0
-rw-r--r--drivers/tty/serial/mrst_max3110.h (renamed from drivers/serial/mrst_max3110.h)0
-rw-r--r--drivers/tty/serial/msm_serial.c (renamed from drivers/serial/msm_serial.c)0
-rw-r--r--drivers/tty/serial/msm_serial.h (renamed from drivers/serial/msm_serial.h)0
-rw-r--r--drivers/tty/serial/mux.c (renamed from drivers/serial/mux.c)0
-rw-r--r--drivers/tty/serial/netx-serial.c (renamed from drivers/serial/netx-serial.c)0
-rw-r--r--drivers/tty/serial/nwpserial.c (renamed from drivers/serial/nwpserial.c)0
-rw-r--r--drivers/tty/serial/of_serial.c (renamed from drivers/serial/of_serial.c)0
-rw-r--r--drivers/tty/serial/omap-serial.c (renamed from drivers/serial/omap-serial.c)0
-rw-r--r--drivers/tty/serial/pch_uart.c (renamed from drivers/serial/pch_uart.c)0
-rw-r--r--drivers/tty/serial/pmac_zilog.c (renamed from drivers/serial/pmac_zilog.c)0
-rw-r--r--drivers/tty/serial/pmac_zilog.h (renamed from drivers/serial/pmac_zilog.h)0
-rw-r--r--drivers/tty/serial/pnx8xxx_uart.c (renamed from drivers/serial/pnx8xxx_uart.c)0
-rw-r--r--drivers/tty/serial/pxa.c (renamed from drivers/serial/pxa.c)0
-rw-r--r--drivers/tty/serial/s3c2400.c (renamed from drivers/serial/s3c2400.c)0
-rw-r--r--drivers/tty/serial/s3c2410.c (renamed from drivers/serial/s3c2410.c)0
-rw-r--r--drivers/tty/serial/s3c2412.c (renamed from drivers/serial/s3c2412.c)0
-rw-r--r--drivers/tty/serial/s3c2440.c (renamed from drivers/serial/s3c2440.c)0
-rw-r--r--drivers/tty/serial/s3c24a0.c (renamed from drivers/serial/s3c24a0.c)0
-rw-r--r--drivers/tty/serial/s3c6400.c (renamed from drivers/serial/s3c6400.c)0
-rw-r--r--drivers/tty/serial/s5pv210.c (renamed from drivers/serial/s5pv210.c)0
-rw-r--r--drivers/tty/serial/sa1100.c (renamed from drivers/serial/sa1100.c)0
-rw-r--r--drivers/tty/serial/samsung.c (renamed from drivers/serial/samsung.c)0
-rw-r--r--drivers/tty/serial/samsung.h (renamed from drivers/serial/samsung.h)0
-rw-r--r--drivers/tty/serial/sb1250-duart.c (renamed from drivers/serial/sb1250-duart.c)0
-rw-r--r--drivers/tty/serial/sc26xx.c (renamed from drivers/serial/sc26xx.c)0
-rw-r--r--drivers/tty/serial/serial_core.c (renamed from drivers/serial/serial_core.c)0
-rw-r--r--drivers/tty/serial/serial_cs.c (renamed from drivers/serial/serial_cs.c)0
-rw-r--r--drivers/tty/serial/serial_ks8695.c (renamed from drivers/serial/serial_ks8695.c)0
-rw-r--r--drivers/tty/serial/serial_lh7a40x.c (renamed from drivers/serial/serial_lh7a40x.c)0
-rw-r--r--drivers/tty/serial/serial_txx9.c (renamed from drivers/serial/serial_txx9.c)0
-rw-r--r--drivers/tty/serial/sh-sci.c (renamed from drivers/serial/sh-sci.c)0
-rw-r--r--drivers/tty/serial/sh-sci.h (renamed from drivers/serial/sh-sci.h)0
-rw-r--r--drivers/tty/serial/sn_console.c (renamed from drivers/serial/sn_console.c)0
-rw-r--r--drivers/tty/serial/suncore.c (renamed from drivers/serial/suncore.c)0
-rw-r--r--drivers/tty/serial/suncore.h (renamed from drivers/serial/suncore.h)0
-rw-r--r--drivers/tty/serial/sunhv.c (renamed from drivers/serial/sunhv.c)0
-rw-r--r--drivers/tty/serial/sunsab.c (renamed from drivers/serial/sunsab.c)0
-rw-r--r--drivers/tty/serial/sunsab.h (renamed from drivers/serial/sunsab.h)0
-rw-r--r--drivers/tty/serial/sunsu.c (renamed from drivers/serial/sunsu.c)0
-rw-r--r--drivers/tty/serial/sunzilog.c (renamed from drivers/serial/sunzilog.c)0
-rw-r--r--drivers/tty/serial/sunzilog.h (renamed from drivers/serial/sunzilog.h)0
-rw-r--r--drivers/tty/serial/timbuart.c (renamed from drivers/serial/timbuart.c)0
-rw-r--r--drivers/tty/serial/timbuart.h (renamed from drivers/serial/timbuart.h)0
-rw-r--r--drivers/tty/serial/uartlite.c (renamed from drivers/serial/uartlite.c)0
-rw-r--r--drivers/tty/serial/ucc_uart.c (renamed from drivers/serial/ucc_uart.c)0
-rw-r--r--drivers/tty/serial/vr41xx_siu.c (renamed from drivers/serial/vr41xx_siu.c)0
-rw-r--r--drivers/tty/serial/vt8500_serial.c (renamed from drivers/serial/vt8500_serial.c)0
-rw-r--r--drivers/tty/serial/zs.c (renamed from drivers/serial/zs.c)0
-rw-r--r--drivers/tty/serial/zs.h (renamed from drivers/serial/zs.h)0
-rw-r--r--drivers/usb/core/Kconfig6
-rw-r--r--drivers/video/Kconfig2
-rw-r--r--drivers/video/backlight/88pm860x_bl.c4
-rw-r--r--drivers/video/console/Kconfig2
-rw-r--r--drivers/virtio/virtio_pci.c20
-rw-r--r--drivers/xen/xenfs/xenbus.c31
-rw-r--r--fs/Kconfig2
-rw-r--r--fs/cifs/cifs_debug.c10
-rw-r--r--fs/cifs/cifs_fs_sb.h1
-rw-r--r--fs/cifs/cifs_unicode.c127
-rw-r--r--fs/cifs/cifsacl.c13
-rw-r--r--fs/cifs/cifsfs.c44
-rw-r--r--fs/cifs/cifsfs.h15
-rw-r--r--fs/cifs/cifsglob.h64
-rw-r--r--fs/cifs/cifspdu.h62
-rw-r--r--fs/cifs/cifsproto.h9
-rw-r--r--fs/cifs/cifssmb.c113
-rw-r--r--fs/cifs/connect.c190
-rw-r--r--fs/cifs/file.c289
-rw-r--r--fs/cifs/inode.c8
-rw-r--r--fs/cifs/misc.c73
-rw-r--r--fs/cifs/netmisc.c4
-rw-r--r--fs/cifs/sess.c15
-rw-r--r--fs/cifs/transport.c434
-rw-r--r--fs/direct-io.c10
-rw-r--r--fs/ext3/super.c25
-rw-r--r--fs/ext4/super.c25
-rw-r--r--fs/gfs2/inode.c72
-rw-r--r--fs/gfs2/inode.h1
-rw-r--r--fs/gfs2/super.c1
-rw-r--r--fs/ocfs2/super.c5
-rw-r--r--fs/pipe.c10
-rw-r--r--fs/proc/Kconfig6
-rw-r--r--fs/quota/dquot.c18
-rw-r--r--fs/quota/quota.c41
-rw-r--r--fs/reiserfs/super.c17
-rw-r--r--fs/sysfs/Kconfig2
-rw-r--r--include/acpi/acexcep.h2
-rw-r--r--include/acpi/acnames.h2
-rw-r--r--include/acpi/acoutput.h2
-rw-r--r--include/acpi/acpi.h2
-rw-r--r--include/acpi/acpiosxf.h2
-rw-r--r--include/acpi/acpixf.h4
-rw-r--r--include/acpi/acrestyp.h2
-rw-r--r--include/acpi/actbl.h2
-rw-r--r--include/acpi/actbl1.h2
-rw-r--r--include/acpi/actbl2.h2
-rw-r--r--include/acpi/actypes.h2
-rw-r--r--include/acpi/platform/acenv.h2
-rw-r--r--include/acpi/platform/acgcc.h2
-rw-r--r--include/acpi/platform/aclinux.h2
-rw-r--r--include/linux/acpi.h3
-rw-r--r--include/linux/acpi_io.h16
-rw-r--r--include/linux/ieee80211.h2
-rw-r--r--include/linux/irqdesc.h14
-rw-r--r--include/linux/kernel.h2
-rw-r--r--include/linux/lockdep.h11
-rw-r--r--include/linux/memcontrol.h9
-rw-r--r--include/linux/mm.h2
-rw-r--r--include/linux/quota.h5
-rw-r--r--include/linux/quotaops.h4
-rw-r--r--include/media/mt9v011.h17
-rw-r--r--include/media/rc-core.h3
-rw-r--r--include/media/saa7146.h2
-rw-r--r--include/media/v4l2-common.h13
-rw-r--r--include/media/v4l2-ctrls.h7
-rw-r--r--include/media/v4l2-subdev.h23
-rw-r--r--include/net/sctp/user.h1
-rw-r--r--init/Kconfig60
-rw-r--r--init/main.c13
-rw-r--r--kernel/irq/Kconfig3
-rw-r--r--kernel/irq/handle.c111
-rw-r--r--kernel/lockdep.c18
-rw-r--r--kernel/sched.c26
-rw-r--r--kernel/sched_autogroup.c32
-rw-r--r--kernel/sched_autogroup.h4
-rw-r--r--kernel/sched_debug.c42
-rw-r--r--kernel/sched_fair.c35
-rw-r--r--kernel/smp.c62
-rw-r--r--kernel/trace/trace_irqsoff.c8
-rw-r--r--kernel/workqueue.c20
-rw-r--r--lib/Kconfig.debug6
-rw-r--r--lib/xz/Kconfig12
-rw-r--r--mm/compaction.c11
-rw-r--r--mm/huge_memory.c5
-rw-r--r--mm/memblock.c8
-rw-r--r--mm/memcontrol.c190
-rw-r--r--mm/truncate.c11
-rw-r--r--mm/vmscan.c1
-rw-r--r--net/batman-adv/main.h6
-rw-r--r--net/batman-adv/packet.h14
-rw-r--r--net/batman-adv/types.h4
-rw-r--r--net/batman-adv/unicast.c6
-rw-r--r--net/caif/cfcnfg.c9
-rw-r--r--net/can/bcm.c3
-rw-r--r--net/can/raw.c3
-rw-r--r--net/core/dev.c6
-rw-r--r--net/core/rtnetlink.c2
-rw-r--r--net/ipv4/inet_diag.c2
-rw-r--r--net/ipv6/addrconf.c3
-rw-r--r--net/mac80211/Kconfig6
-rw-r--r--net/mac80211/agg-rx.c11
-rw-r--r--net/mac80211/main.c12
-rw-r--r--net/netfilter/nf_conntrack_netlink.c4
-rw-r--r--net/netlink/genetlink.c2
-rw-r--r--net/rfkill/Kconfig4
-rw-r--r--net/sctp/socket.c4
-rw-r--r--net/wireless/Kconfig2
-rw-r--r--net/xfrm/xfrm_user.c2
-rw-r--r--security/keys/compat.c17
-rw-r--r--security/keys/encrypted_defined.c1
-rw-r--r--security/keys/gc.c14
-rw-r--r--security/keys/internal.h26
-rw-r--r--security/keys/key.c320
-rw-r--r--security/keys/keyctl.c355
-rw-r--r--security/keys/keyring.c295
-rw-r--r--security/keys/permission.c33
-rw-r--r--security/keys/proc.c17
-rw-r--r--security/keys/process_keys.c135
-rw-r--r--security/keys/request_key.c164
-rw-r--r--security/keys/request_key_auth.c62
-rw-r--r--security/keys/trusted_defined.c51
-rw-r--r--security/keys/user_defined.c32
-rw-r--r--sound/pci/hda/patch_realtek.c26
-rw-r--r--sound/pci/ice1712/delta.c7
-rw-r--r--sound/soc/blackfin/Kconfig11
-rw-r--r--sound/soc/blackfin/bf5xx-ac97.c4
-rw-r--r--sound/soc/blackfin/bf5xx-tdm.c10
-rw-r--r--sound/soc/pxa/z2.c3
-rw-r--r--usr/Kconfig18
1002 files changed, 7053 insertions, 6868 deletions
diff --git a/Documentation/DocBook/dvb/dvbapi.xml b/Documentation/DocBook/dvb/dvbapi.xml
index e3a97fdd62a6..ad8678d48916 100644
--- a/Documentation/DocBook/dvb/dvbapi.xml
+++ b/Documentation/DocBook/dvb/dvbapi.xml
@@ -28,7 +28,7 @@
28 <holder>Convergence GmbH</holder> 28 <holder>Convergence GmbH</holder>
29</copyright> 29</copyright>
30<copyright> 30<copyright>
31 <year>2009-2010</year> 31 <year>2009-2011</year>
32 <holder>Mauro Carvalho Chehab</holder> 32 <holder>Mauro Carvalho Chehab</holder>
33</copyright> 33</copyright>
34 34
diff --git a/Documentation/DocBook/media.tmpl b/Documentation/DocBook/media.tmpl
index f11048d4053f..a99088aae1aa 100644
--- a/Documentation/DocBook/media.tmpl
+++ b/Documentation/DocBook/media.tmpl
@@ -28,7 +28,7 @@
28<title>LINUX MEDIA INFRASTRUCTURE API</title> 28<title>LINUX MEDIA INFRASTRUCTURE API</title>
29 29
30<copyright> 30<copyright>
31 <year>2009-2010</year> 31 <year>2009-2011</year>
32 <holder>LinuxTV Developers</holder> 32 <holder>LinuxTV Developers</holder>
33</copyright> 33</copyright>
34 34
@@ -86,7 +86,7 @@ Foundation. A copy of the license is included in the chapter entitled
86</author> 86</author>
87</authorgroup> 87</authorgroup>
88<copyright> 88<copyright>
89 <year>2009-2010</year> 89 <year>2009-2011</year>
90 <holder>Mauro Carvalho Chehab</holder> 90 <holder>Mauro Carvalho Chehab</holder>
91</copyright> 91</copyright>
92 92
diff --git a/Documentation/DocBook/v4l/dev-rds.xml b/Documentation/DocBook/v4l/dev-rds.xml
index 360d2737e649..2427f54397e7 100644
--- a/Documentation/DocBook/v4l/dev-rds.xml
+++ b/Documentation/DocBook/v4l/dev-rds.xml
@@ -75,6 +75,7 @@ as follows:</para>
75 </section> 75 </section>
76 76
77 <section> 77 <section>
78 <title>RDS datastructures</title>
78 <table frame="none" pgwide="1" id="v4l2-rds-data"> 79 <table frame="none" pgwide="1" id="v4l2-rds-data">
79 <title>struct 80 <title>struct
80<structname>v4l2_rds_data</structname></title> 81<structname>v4l2_rds_data</structname></title>
@@ -129,10 +130,11 @@ as follows:</para>
129 130
130 <table frame="none" pgwide="1" id="v4l2-rds-block-codes"> 131 <table frame="none" pgwide="1" id="v4l2-rds-block-codes">
131 <title>Block defines</title> 132 <title>Block defines</title>
132 <tgroup cols="3"> 133 <tgroup cols="4">
133 <colspec colname="c1" colwidth="1*" /> 134 <colspec colname="c1" colwidth="1*" />
134 <colspec colname="c2" colwidth="1*" /> 135 <colspec colname="c2" colwidth="1*" />
135 <colspec colname="c3" colwidth="5*" /> 136 <colspec colname="c3" colwidth="1*" />
137 <colspec colname="c4" colwidth="5*" />
136 <tbody valign="top"> 138 <tbody valign="top">
137 <row> 139 <row>
138 <entry>V4L2_RDS_BLOCK_MSK</entry> 140 <entry>V4L2_RDS_BLOCK_MSK</entry>
diff --git a/Documentation/DocBook/v4l/v4l2.xml b/Documentation/DocBook/v4l/v4l2.xml
index 839e93e875ae..9288af96de34 100644
--- a/Documentation/DocBook/v4l/v4l2.xml
+++ b/Documentation/DocBook/v4l/v4l2.xml
@@ -100,6 +100,7 @@ Remote Controller chapter.</contrib>
100 <year>2008</year> 100 <year>2008</year>
101 <year>2009</year> 101 <year>2009</year>
102 <year>2010</year> 102 <year>2010</year>
103 <year>2011</year>
103 <holder>Bill Dirks, Michael H. Schimek, Hans Verkuil, Martin 104 <holder>Bill Dirks, Michael H. Schimek, Hans Verkuil, Martin
104Rubli, Andy Walls, Muralidharan Karicheri, Mauro Carvalho Chehab</holder> 105Rubli, Andy Walls, Muralidharan Karicheri, Mauro Carvalho Chehab</holder>
105 </copyright> 106 </copyright>
@@ -381,7 +382,7 @@ and discussions on the V4L mailing list.</revremark>
381</partinfo> 382</partinfo>
382 383
383<title>Video for Linux Two API Specification</title> 384<title>Video for Linux Two API Specification</title>
384 <subtitle>Revision 2.6.33</subtitle> 385 <subtitle>Revision 2.6.38</subtitle>
385 386
386 <chapter id="common"> 387 <chapter id="common">
387 &sub-common; 388 &sub-common;
diff --git a/Documentation/arm/Booting b/Documentation/arm/Booting
index 76850295af8f..4e686a2ed91e 100644
--- a/Documentation/arm/Booting
+++ b/Documentation/arm/Booting
@@ -65,13 +65,19 @@ looks at the connected hardware is beyond the scope of this document.
65The boot loader must ultimately be able to provide a MACH_TYPE_xxx 65The boot loader must ultimately be able to provide a MACH_TYPE_xxx
66value to the kernel. (see linux/arch/arm/tools/mach-types). 66value to the kernel. (see linux/arch/arm/tools/mach-types).
67 67
68 684. Setup boot data
694. Setup the kernel tagged list 69------------------
70-------------------------------
71 70
72Existing boot loaders: OPTIONAL, HIGHLY RECOMMENDED 71Existing boot loaders: OPTIONAL, HIGHLY RECOMMENDED
73New boot loaders: MANDATORY 72New boot loaders: MANDATORY
74 73
74The boot loader must provide either a tagged list or a dtb image for
75passing configuration data to the kernel. The physical address of the
76boot data is passed to the kernel in register r2.
77
784a. Setup the kernel tagged list
79--------------------------------
80
75The boot loader must create and initialise the kernel tagged list. 81The boot loader must create and initialise the kernel tagged list.
76A valid tagged list starts with ATAG_CORE and ends with ATAG_NONE. 82A valid tagged list starts with ATAG_CORE and ends with ATAG_NONE.
77The ATAG_CORE tag may or may not be empty. An empty ATAG_CORE tag 83The ATAG_CORE tag may or may not be empty. An empty ATAG_CORE tag
@@ -101,6 +107,24 @@ The tagged list must be placed in a region of memory where neither
101the kernel decompressor nor initrd 'bootp' program will overwrite 107the kernel decompressor nor initrd 'bootp' program will overwrite
102it. The recommended placement is in the first 16KiB of RAM. 108it. The recommended placement is in the first 16KiB of RAM.
103 109
1104b. Setup the device tree
111-------------------------
112
113The boot loader must load a device tree image (dtb) into system ram
114at a 64bit aligned address and initialize it with the boot data. The
115dtb format is documented in Documentation/devicetree/booting-without-of.txt.
116The kernel will look for the dtb magic value of 0xd00dfeed at the dtb
117physical address to determine if a dtb has been passed instead of a
118tagged list.
119
120The boot loader must pass at a minimum the size and location of the
121system memory, and the root filesystem location. The dtb must be
122placed in a region of memory where the kernel decompressor will not
123overwrite it. The recommended placement is in the first 16KiB of RAM
124with the caveat that it may not be located at physical address 0 since
125the kernel interprets a value of 0 in r2 to mean neither a tagged list
126nor a dtb were passed.
127
1045. Calling the kernel image 1285. Calling the kernel image
105--------------------------- 129---------------------------
106 130
@@ -125,7 +149,8 @@ In either case, the following conditions must be met:
125- CPU register settings 149- CPU register settings
126 r0 = 0, 150 r0 = 0,
127 r1 = machine type number discovered in (3) above. 151 r1 = machine type number discovered in (3) above.
128 r2 = physical address of tagged list in system RAM. 152 r2 = physical address of tagged list in system RAM, or
153 physical address of device tree block (dtb) in system RAM
129 154
130- CPU mode 155- CPU mode
131 All forms of interrupts must be disabled (IRQs and FIQs) 156 All forms of interrupts must be disabled (IRQs and FIQs)
diff --git a/Documentation/powerpc/dts-bindings/fsl/sata.txt b/Documentation/devicetree/bindings/ata/fsl-sata.txt
index b46bcf46c3d8..b46bcf46c3d8 100644
--- a/Documentation/powerpc/dts-bindings/fsl/sata.txt
+++ b/Documentation/devicetree/bindings/ata/fsl-sata.txt
diff --git a/Documentation/powerpc/dts-bindings/eeprom.txt b/Documentation/devicetree/bindings/eeprom.txt
index 4342c10de1bf..4342c10de1bf 100644
--- a/Documentation/powerpc/dts-bindings/eeprom.txt
+++ b/Documentation/devicetree/bindings/eeprom.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/8xxx_gpio.txt b/Documentation/devicetree/bindings/gpio/8xxx_gpio.txt
index b0019eb5330e..b0019eb5330e 100644
--- a/Documentation/powerpc/dts-bindings/fsl/8xxx_gpio.txt
+++ b/Documentation/devicetree/bindings/gpio/8xxx_gpio.txt
diff --git a/Documentation/powerpc/dts-bindings/gpio/gpio.txt b/Documentation/devicetree/bindings/gpio/gpio.txt
index edaa84d288a1..edaa84d288a1 100644
--- a/Documentation/powerpc/dts-bindings/gpio/gpio.txt
+++ b/Documentation/devicetree/bindings/gpio/gpio.txt
diff --git a/Documentation/powerpc/dts-bindings/gpio/led.txt b/Documentation/devicetree/bindings/gpio/led.txt
index 064db928c3c1..064db928c3c1 100644
--- a/Documentation/powerpc/dts-bindings/gpio/led.txt
+++ b/Documentation/devicetree/bindings/gpio/led.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/i2c.txt b/Documentation/devicetree/bindings/i2c/fsl-i2c.txt
index 1eacd6b20ed5..1eacd6b20ed5 100644
--- a/Documentation/powerpc/dts-bindings/fsl/i2c.txt
+++ b/Documentation/devicetree/bindings/i2c/fsl-i2c.txt
diff --git a/Documentation/powerpc/dts-bindings/marvell.txt b/Documentation/devicetree/bindings/marvell.txt
index f1533d91953a..f1533d91953a 100644
--- a/Documentation/powerpc/dts-bindings/marvell.txt
+++ b/Documentation/devicetree/bindings/marvell.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/esdhc.txt b/Documentation/devicetree/bindings/mmc/fsl-esdhc.txt
index 64bcb8be973c..64bcb8be973c 100644
--- a/Documentation/powerpc/dts-bindings/fsl/esdhc.txt
+++ b/Documentation/devicetree/bindings/mmc/fsl-esdhc.txt
diff --git a/Documentation/powerpc/dts-bindings/mmc-spi-slot.txt b/Documentation/devicetree/bindings/mmc/mmc-spi-slot.txt
index c39ac2891951..c39ac2891951 100644
--- a/Documentation/powerpc/dts-bindings/mmc-spi-slot.txt
+++ b/Documentation/devicetree/bindings/mmc/mmc-spi-slot.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/upm-nand.txt b/Documentation/devicetree/bindings/mtd/fsl-upm-nand.txt
index a48b2cadc7f0..a48b2cadc7f0 100644
--- a/Documentation/powerpc/dts-bindings/fsl/upm-nand.txt
+++ b/Documentation/devicetree/bindings/mtd/fsl-upm-nand.txt
diff --git a/Documentation/powerpc/dts-bindings/mtd-physmap.txt b/Documentation/devicetree/bindings/mtd/mtd-physmap.txt
index 80152cb567d9..80152cb567d9 100644
--- a/Documentation/powerpc/dts-bindings/mtd-physmap.txt
+++ b/Documentation/devicetree/bindings/mtd/mtd-physmap.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/can.txt b/Documentation/devicetree/bindings/net/can/mpc5xxx-mscan.txt
index 2fa4fcd38fd6..2fa4fcd38fd6 100644
--- a/Documentation/powerpc/dts-bindings/fsl/can.txt
+++ b/Documentation/devicetree/bindings/net/can/mpc5xxx-mscan.txt
diff --git a/Documentation/powerpc/dts-bindings/can/sja1000.txt b/Documentation/devicetree/bindings/net/can/sja1000.txt
index d6d209ded937..d6d209ded937 100644
--- a/Documentation/powerpc/dts-bindings/can/sja1000.txt
+++ b/Documentation/devicetree/bindings/net/can/sja1000.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/tsec.txt b/Documentation/devicetree/bindings/net/fsl-tsec-phy.txt
index edb7ae19e868..edb7ae19e868 100644
--- a/Documentation/powerpc/dts-bindings/fsl/tsec.txt
+++ b/Documentation/devicetree/bindings/net/fsl-tsec-phy.txt
diff --git a/Documentation/powerpc/dts-bindings/gpio/mdio.txt b/Documentation/devicetree/bindings/net/mdio-gpio.txt
index bc9549529014..bc9549529014 100644
--- a/Documentation/powerpc/dts-bindings/gpio/mdio.txt
+++ b/Documentation/devicetree/bindings/net/mdio-gpio.txt
diff --git a/Documentation/powerpc/dts-bindings/phy.txt b/Documentation/devicetree/bindings/net/phy.txt
index bb8c742eb8c5..bb8c742eb8c5 100644
--- a/Documentation/powerpc/dts-bindings/phy.txt
+++ b/Documentation/devicetree/bindings/net/phy.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/83xx-512x-pci.txt b/Documentation/devicetree/bindings/pci/83xx-512x-pci.txt
index 35a465362408..35a465362408 100644
--- a/Documentation/powerpc/dts-bindings/fsl/83xx-512x-pci.txt
+++ b/Documentation/devicetree/bindings/pci/83xx-512x-pci.txt
diff --git a/Documentation/powerpc/dts-bindings/4xx/cpm.txt b/Documentation/devicetree/bindings/powerpc/4xx/cpm.txt
index ee459806d35e..ee459806d35e 100644
--- a/Documentation/powerpc/dts-bindings/4xx/cpm.txt
+++ b/Documentation/devicetree/bindings/powerpc/4xx/cpm.txt
diff --git a/Documentation/powerpc/dts-bindings/4xx/emac.txt b/Documentation/devicetree/bindings/powerpc/4xx/emac.txt
index 2161334a7ca5..2161334a7ca5 100644
--- a/Documentation/powerpc/dts-bindings/4xx/emac.txt
+++ b/Documentation/devicetree/bindings/powerpc/4xx/emac.txt
diff --git a/Documentation/powerpc/dts-bindings/4xx/ndfc.txt b/Documentation/devicetree/bindings/powerpc/4xx/ndfc.txt
index 869f0b5f16e8..869f0b5f16e8 100644
--- a/Documentation/powerpc/dts-bindings/4xx/ndfc.txt
+++ b/Documentation/devicetree/bindings/powerpc/4xx/ndfc.txt
diff --git a/Documentation/powerpc/dts-bindings/4xx/ppc440spe-adma.txt b/Documentation/devicetree/bindings/powerpc/4xx/ppc440spe-adma.txt
index 515ebcf1b97d..515ebcf1b97d 100644
--- a/Documentation/powerpc/dts-bindings/4xx/ppc440spe-adma.txt
+++ b/Documentation/devicetree/bindings/powerpc/4xx/ppc440spe-adma.txt
diff --git a/Documentation/powerpc/dts-bindings/4xx/reboot.txt b/Documentation/devicetree/bindings/powerpc/4xx/reboot.txt
index d7217260589c..d7217260589c 100644
--- a/Documentation/powerpc/dts-bindings/4xx/reboot.txt
+++ b/Documentation/devicetree/bindings/powerpc/4xx/reboot.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/board.txt b/Documentation/devicetree/bindings/powerpc/fsl/board.txt
index 39e941515a36..39e941515a36 100644
--- a/Documentation/powerpc/dts-bindings/fsl/board.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/board.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/cpm.txt b/Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/cpm.txt
index 160c752484b4..160c752484b4 100644
--- a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/cpm.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/cpm.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/cpm/brg.txt b/Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/cpm/brg.txt
index 4c7d45eaf025..4c7d45eaf025 100644
--- a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/cpm/brg.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/cpm/brg.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/cpm/i2c.txt b/Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/cpm/i2c.txt
index 87bc6048667e..87bc6048667e 100644
--- a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/cpm/i2c.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/cpm/i2c.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/cpm/pic.txt b/Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/cpm/pic.txt
index 8e3ee1681618..8e3ee1681618 100644
--- a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/cpm/pic.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/cpm/pic.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/cpm/usb.txt b/Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/cpm/usb.txt
index 74bfda4bb824..74bfda4bb824 100644
--- a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/cpm/usb.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/cpm/usb.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/gpio.txt b/Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/gpio.txt
index 349f79fd7076..349f79fd7076 100644
--- a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/gpio.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/gpio.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/network.txt b/Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/network.txt
index 0e4269446580..0e4269446580 100644
--- a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/network.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/network.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe.txt b/Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/qe.txt
index 4f8930263dd9..4f8930263dd9 100644
--- a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/qe.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe/firmware.txt b/Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/qe/firmware.txt
index 249db3a15d15..249db3a15d15 100644
--- a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe/firmware.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/qe/firmware.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe/par_io.txt b/Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/qe/par_io.txt
index 60984260207b..60984260207b 100644
--- a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe/par_io.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/qe/par_io.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe/pincfg.txt b/Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/qe/pincfg.txt
index c5b43061db3a..c5b43061db3a 100644
--- a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe/pincfg.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/qe/pincfg.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe/ucc.txt b/Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/qe/ucc.txt
index e47734bee3f0..e47734bee3f0 100644
--- a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe/ucc.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/qe/ucc.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe/usb.txt b/Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/qe/usb.txt
index 9ccd5f30405b..9ccd5f30405b 100644
--- a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe/usb.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/qe/usb.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/serial.txt b/Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/serial.txt
index 2ea76d9d137c..2ea76d9d137c 100644
--- a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/serial.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/cpm_qe/serial.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/diu.txt b/Documentation/devicetree/bindings/powerpc/fsl/diu.txt
index b66cb6d31d69..b66cb6d31d69 100644
--- a/Documentation/powerpc/dts-bindings/fsl/diu.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/diu.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/dma.txt b/Documentation/devicetree/bindings/powerpc/fsl/dma.txt
index 2a4b4bce6110..2a4b4bce6110 100644
--- a/Documentation/powerpc/dts-bindings/fsl/dma.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/dma.txt
diff --git a/Documentation/powerpc/dts-bindings/ecm.txt b/Documentation/devicetree/bindings/powerpc/fsl/ecm.txt
index f514f29c67d6..f514f29c67d6 100644
--- a/Documentation/powerpc/dts-bindings/ecm.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/ecm.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/gtm.txt b/Documentation/devicetree/bindings/powerpc/fsl/gtm.txt
index 9a33efded4bc..9a33efded4bc 100644
--- a/Documentation/powerpc/dts-bindings/fsl/gtm.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/gtm.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/guts.txt b/Documentation/devicetree/bindings/powerpc/fsl/guts.txt
index 9e7a2417dac5..9e7a2417dac5 100644
--- a/Documentation/powerpc/dts-bindings/fsl/guts.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/guts.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/lbc.txt b/Documentation/devicetree/bindings/powerpc/fsl/lbc.txt
index 3300fec501c5..3300fec501c5 100644
--- a/Documentation/powerpc/dts-bindings/fsl/lbc.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/lbc.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/mcm.txt b/Documentation/devicetree/bindings/powerpc/fsl/mcm.txt
index 4ceda9b3b413..4ceda9b3b413 100644
--- a/Documentation/powerpc/dts-bindings/fsl/mcm.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/mcm.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/mcu-mpc8349emitx.txt b/Documentation/devicetree/bindings/powerpc/fsl/mcu-mpc8349emitx.txt
index 0f766333b6eb..0f766333b6eb 100644
--- a/Documentation/powerpc/dts-bindings/fsl/mcu-mpc8349emitx.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/mcu-mpc8349emitx.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/mpc5121-psc.txt b/Documentation/devicetree/bindings/powerpc/fsl/mpc5121-psc.txt
index 8832e8798912..8832e8798912 100644
--- a/Documentation/powerpc/dts-bindings/fsl/mpc5121-psc.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/mpc5121-psc.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/mpc5200.txt b/Documentation/devicetree/bindings/powerpc/fsl/mpc5200.txt
index 4ccb2cd5df94..4ccb2cd5df94 100644
--- a/Documentation/powerpc/dts-bindings/fsl/mpc5200.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/mpc5200.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/mpic.txt b/Documentation/devicetree/bindings/powerpc/fsl/mpic.txt
index 71e39cf3215b..71e39cf3215b 100644
--- a/Documentation/powerpc/dts-bindings/fsl/mpic.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/mpic.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/msi-pic.txt b/Documentation/devicetree/bindings/powerpc/fsl/msi-pic.txt
index bcc30bac6831..bcc30bac6831 100644
--- a/Documentation/powerpc/dts-bindings/fsl/msi-pic.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/msi-pic.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/pmc.txt b/Documentation/devicetree/bindings/powerpc/fsl/pmc.txt
index 07256b7ffcaa..07256b7ffcaa 100644
--- a/Documentation/powerpc/dts-bindings/fsl/pmc.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/pmc.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/sec.txt b/Documentation/devicetree/bindings/powerpc/fsl/sec.txt
index 2b6f2d45c45a..2b6f2d45c45a 100644
--- a/Documentation/powerpc/dts-bindings/fsl/sec.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/sec.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/ssi.txt b/Documentation/devicetree/bindings/powerpc/fsl/ssi.txt
index 5ff76c9c57d2..5ff76c9c57d2 100644
--- a/Documentation/powerpc/dts-bindings/fsl/ssi.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/ssi.txt
diff --git a/Documentation/powerpc/dts-bindings/nintendo/gamecube.txt b/Documentation/devicetree/bindings/powerpc/nintendo/gamecube.txt
index b558585b1aaf..b558585b1aaf 100644
--- a/Documentation/powerpc/dts-bindings/nintendo/gamecube.txt
+++ b/Documentation/devicetree/bindings/powerpc/nintendo/gamecube.txt
diff --git a/Documentation/powerpc/dts-bindings/nintendo/wii.txt b/Documentation/devicetree/bindings/powerpc/nintendo/wii.txt
index a7e155a023b8..a7e155a023b8 100644
--- a/Documentation/powerpc/dts-bindings/nintendo/wii.txt
+++ b/Documentation/devicetree/bindings/powerpc/nintendo/wii.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/spi.txt b/Documentation/devicetree/bindings/spi/fsl-spi.txt
index 777abd7399d5..777abd7399d5 100644
--- a/Documentation/powerpc/dts-bindings/fsl/spi.txt
+++ b/Documentation/devicetree/bindings/spi/fsl-spi.txt
diff --git a/Documentation/powerpc/dts-bindings/spi-bus.txt b/Documentation/devicetree/bindings/spi/spi-bus.txt
index e782add2e457..e782add2e457 100644
--- a/Documentation/powerpc/dts-bindings/spi-bus.txt
+++ b/Documentation/devicetree/bindings/spi/spi-bus.txt
diff --git a/Documentation/powerpc/dts-bindings/fsl/usb.txt b/Documentation/devicetree/bindings/usb/fsl-usb.txt
index bd5723f0b67e..bd5723f0b67e 100644
--- a/Documentation/powerpc/dts-bindings/fsl/usb.txt
+++ b/Documentation/devicetree/bindings/usb/fsl-usb.txt
diff --git a/Documentation/powerpc/dts-bindings/usb-ehci.txt b/Documentation/devicetree/bindings/usb/usb-ehci.txt
index fa18612f757b..fa18612f757b 100644
--- a/Documentation/powerpc/dts-bindings/usb-ehci.txt
+++ b/Documentation/devicetree/bindings/usb/usb-ehci.txt
diff --git a/Documentation/powerpc/dts-bindings/xilinx.txt b/Documentation/devicetree/bindings/xilinx.txt
index 299d0923537b..299d0923537b 100644
--- a/Documentation/powerpc/dts-bindings/xilinx.txt
+++ b/Documentation/devicetree/bindings/xilinx.txt
diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/devicetree/booting-without-of.txt
index 7400d7555dc3..9381a1481027 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/devicetree/booting-without-of.txt
@@ -13,7 +13,7 @@ Table of Contents
13 13
14 I - Introduction 14 I - Introduction
15 1) Entry point for arch/powerpc 15 1) Entry point for arch/powerpc
16 2) Board support 16 2) Entry point for arch/arm
17 17
18 II - The DT block format 18 II - The DT block format
19 1) Header 19 1) Header
@@ -41,13 +41,6 @@ Table of Contents
41 VI - System-on-a-chip devices and nodes 41 VI - System-on-a-chip devices and nodes
42 1) Defining child nodes of an SOC 42 1) Defining child nodes of an SOC
43 2) Representing devices without a current OF specification 43 2) Representing devices without a current OF specification
44 a) PHY nodes
45 b) Interrupt controllers
46 c) 4xx/Axon EMAC ethernet nodes
47 d) Xilinx IP cores
48 e) USB EHCI controllers
49 f) MDIO on GPIOs
50 g) SPI busses
51 44
52 VII - Specifying interrupt information for devices 45 VII - Specifying interrupt information for devices
53 1) interrupts property 46 1) interrupts property
@@ -123,7 +116,7 @@ Revision Information
123I - Introduction 116I - Introduction
124================ 117================
125 118
126During the recent development of the Linux/ppc64 kernel, and more 119During the development of the Linux/ppc64 kernel, and more
127specifically, the addition of new platform types outside of the old 120specifically, the addition of new platform types outside of the old
128IBM pSeries/iSeries pair, it was decided to enforce some strict rules 121IBM pSeries/iSeries pair, it was decided to enforce some strict rules
129regarding the kernel entry and bootloader <-> kernel interfaces, in 122regarding the kernel entry and bootloader <-> kernel interfaces, in
@@ -146,7 +139,7 @@ section III, but, for example, the kernel does not require you to
146create a node for every PCI device in the system. It is a requirement 139create a node for every PCI device in the system. It is a requirement
147to have a node for PCI host bridges in order to provide interrupt 140to have a node for PCI host bridges in order to provide interrupt
148routing informations and memory/IO ranges, among others. It is also 141routing informations and memory/IO ranges, among others. It is also
149recommended to define nodes for on chip devices and other busses that 142recommended to define nodes for on chip devices and other buses that
150don't specifically fit in an existing OF specification. This creates a 143don't specifically fit in an existing OF specification. This creates a
151great flexibility in the way the kernel can then probe those and match 144great flexibility in the way the kernel can then probe those and match
152drivers to device, without having to hard code all sorts of tables. It 145drivers to device, without having to hard code all sorts of tables. It
@@ -158,7 +151,7 @@ it with special cases.
1581) Entry point for arch/powerpc 1511) Entry point for arch/powerpc
159------------------------------- 152-------------------------------
160 153
161 There is one and one single entry point to the kernel, at the start 154 There is one single entry point to the kernel, at the start
162 of the kernel image. That entry point supports two calling 155 of the kernel image. That entry point supports two calling
163 conventions: 156 conventions:
164 157
@@ -210,12 +203,6 @@ it with special cases.
210 with all CPUs. The way to do that with method b) will be 203 with all CPUs. The way to do that with method b) will be
211 described in a later revision of this document. 204 described in a later revision of this document.
212 205
213
2142) Board support
215----------------
216
21764-bit kernels:
218
219 Board supports (platforms) are not exclusive config options. An 206 Board supports (platforms) are not exclusive config options. An
220 arbitrary set of board supports can be built in a single kernel 207 arbitrary set of board supports can be built in a single kernel
221 image. The kernel will "know" what set of functions to use for a 208 image. The kernel will "know" what set of functions to use for a
@@ -234,47 +221,49 @@ it with special cases.
234 containing the various callbacks that the generic code will 221 containing the various callbacks that the generic code will
235 use to get to your platform specific code 222 use to get to your platform specific code
236 223
237 c) Add a reference to your "ppc_md" structure in the 224 A kernel image may support multiple platforms, but only if the
238 "machines" table in arch/powerpc/kernel/setup_64.c if you are
239 a 64-bit platform.
240
241 d) request and get assigned a platform number (see PLATFORM_*
242 constants in arch/powerpc/include/asm/processor.h
243
24432-bit embedded kernels:
245
246 Currently, board support is essentially an exclusive config option.
247 The kernel is configured for a single platform. Part of the reason
248 for this is to keep kernels on embedded systems small and efficient;
249 part of this is due to the fact the code is already that way. In the
250 future, a kernel may support multiple platforms, but only if the
251 platforms feature the same core architecture. A single kernel build 225 platforms feature the same core architecture. A single kernel build
252 cannot support both configurations with Book E and configurations 226 cannot support both configurations with Book E and configurations
253 with classic Powerpc architectures. 227 with classic Powerpc architectures.
254 228
255 32-bit embedded platforms that are moved into arch/powerpc using a 2292) Entry point for arch/arm
256 flattened device tree should adopt the merged tree practice of 230---------------------------
257 setting ppc_md up dynamically, even though the kernel is currently 231
258 built with support for only a single platform at a time. This allows 232 There is one single entry point to the kernel, at the start
259 unification of the setup code, and will make it easier to go to a 233 of the kernel image. That entry point supports two calling
260 multiple-platform-support model in the future. 234 conventions. A summary of the interface is described here. A full
235 description of the boot requirements is documented in
236 Documentation/arm/Booting
237
238 a) ATAGS interface. Minimal information is passed from firmware
239 to the kernel with a tagged list of predefined parameters.
240
241 r0 : 0
242
243 r1 : Machine type number
261 244
262NOTE: I believe the above will be true once Ben's done with the merge 245 r2 : Physical address of tagged list in system RAM
263of the boot sequences.... someone speak up if this is wrong!
264 246
265 To add a 32-bit embedded platform support, follow the instructions 247 b) Entry with a flattened device-tree block. Firmware loads the
266 for 64-bit platforms above, with the exception that the Kconfig 248 physical address of the flattened device tree block (dtb) into r2,
267 option should be set up such that the kernel builds exclusively for 249 r1 is not used, but it is considered good practise to use a valid
268 the platform selected. The processor type for the platform should 250 machine number as described in Documentation/arm/Booting.
269 enable another config option to select the specific board
270 supported.
271 251
272NOTE: If Ben doesn't merge the setup files, may need to change this to 252 r0 : 0
273point to setup_32.c
274 253
254 r1 : Valid machine type number. When using a device tree,
255 a single machine type number will often be assigned to
256 represent a class or family of SoCs.
275 257
276 I will describe later the boot process and various callbacks that 258 r2 : physical pointer to the device-tree block
277 your platform should implement. 259 (defined in chapter II) in RAM. Device tree can be located
260 anywhere in system RAM, but it should be aligned on a 32 bit
261 boundary.
262
263 The kernel will differentiate between ATAGS and device tree booting by
264 reading the memory pointed to by r1 and looking for either the flattened
265 device tree block magic value (0xd00dfeed) or the ATAG_CORE value at
266 offset 0x4 from r2 (0x54410001).
278 267
279 268
280II - The DT block format 269II - The DT block format
@@ -300,8 +289,8 @@ the block to RAM before passing it to the kernel.
3001) Header 2891) Header
301--------- 290---------
302 291
303 The kernel is entered with r3 pointing to an area of memory that is 292 The kernel is passed the physical address pointing to an area of memory
304 roughly described in arch/powerpc/include/asm/prom.h by the structure 293 that is roughly described in include/linux/of_fdt.h by the structure
305 boot_param_header: 294 boot_param_header:
306 295
307struct boot_param_header { 296struct boot_param_header {
@@ -339,7 +328,7 @@ struct boot_param_header {
339 All values in this header are in big endian format, the various 328 All values in this header are in big endian format, the various
340 fields in this header are defined more precisely below. All 329 fields in this header are defined more precisely below. All
341 "offset" values are in bytes from the start of the header; that is 330 "offset" values are in bytes from the start of the header; that is
342 from the value of r3. 331 from the physical base address of the device tree block.
343 332
344 - magic 333 - magic
345 334
@@ -437,7 +426,7 @@ struct boot_param_header {
437 426
438 427
439 ------------------------------ 428 ------------------------------
440 r3 -> | struct boot_param_header | 429 base -> | struct boot_param_header |
441 ------------------------------ 430 ------------------------------
442 | (alignment gap) (*) | 431 | (alignment gap) (*) |
443 ------------------------------ 432 ------------------------------
@@ -457,7 +446,7 @@ struct boot_param_header {
457 -----> ------------------------------ 446 -----> ------------------------------
458 | 447 |
459 | 448 |
460 --- (r3 + totalsize) 449 --- (base + totalsize)
461 450
462 (*) The alignment gaps are not necessarily present; their presence 451 (*) The alignment gaps are not necessarily present; their presence
463 and size are dependent on the various alignment requirements of 452 and size are dependent on the various alignment requirements of
@@ -500,7 +489,7 @@ the device-tree structure. It is typically used to represent "path" in
500the device-tree. More details about the actual format of these will be 489the device-tree. More details about the actual format of these will be
501below. 490below.
502 491
503The kernel powerpc generic code does not make any formal use of the 492The kernel generic code does not make any formal use of the
504unit address (though some board support code may do) so the only real 493unit address (though some board support code may do) so the only real
505requirement here for the unit address is to ensure uniqueness of 494requirement here for the unit address is to ensure uniqueness of
506the node unit name at a given level of the tree. Nodes with no notion 495the node unit name at a given level of the tree. Nodes with no notion
@@ -518,20 +507,21 @@ path to the root node is "/".
518 507
519Every node which actually represents an actual device (that is, a node 508Every node which actually represents an actual device (that is, a node
520which isn't only a virtual "container" for more nodes, like "/cpus" 509which isn't only a virtual "container" for more nodes, like "/cpus"
521is) is also required to have a "device_type" property indicating the 510is) is also required to have a "compatible" property indicating the
522type of node . 511specific hardware and an optional list of devices it is fully
512backwards compatible with.
523 513
524Finally, every node that can be referenced from a property in another 514Finally, every node that can be referenced from a property in another
525node is required to have a "linux,phandle" property. Real open 515node is required to have either a "phandle" or a "linux,phandle"
526firmware implementations provide a unique "phandle" value for every 516property. Real Open Firmware implementations provide a unique
527node that the "prom_init()" trampoline code turns into 517"phandle" value for every node that the "prom_init()" trampoline code
528"linux,phandle" properties. However, this is made optional if the 518turns into "linux,phandle" properties. However, this is made optional
529flattened device tree is used directly. An example of a node 519if the flattened device tree is used directly. An example of a node
530referencing another node via "phandle" is when laying out the 520referencing another node via "phandle" is when laying out the
531interrupt tree which will be described in a further version of this 521interrupt tree which will be described in a further version of this
532document. 522document.
533 523
534This "linux, phandle" property is a 32-bit value that uniquely 524The "phandle" property is a 32-bit value that uniquely
535identifies a node. You are free to use whatever values or system of 525identifies a node. You are free to use whatever values or system of
536values, internal pointers, or whatever to generate these, the only 526values, internal pointers, or whatever to generate these, the only
537requirement is that every node for which you provide that property has 527requirement is that every node for which you provide that property has
@@ -694,7 +684,7 @@ made of 3 cells, the bottom two containing the actual address itself
694while the top cell contains address space indication, flags, and pci 684while the top cell contains address space indication, flags, and pci
695bus & device numbers. 685bus & device numbers.
696 686
697For busses that support dynamic allocation, it's the accepted practice 687For buses that support dynamic allocation, it's the accepted practice
698to then not provide the address in "reg" (keep it 0) though while 688to then not provide the address in "reg" (keep it 0) though while
699providing a flag indicating the address is dynamically allocated, and 689providing a flag indicating the address is dynamically allocated, and
700then, to provide a separate "assigned-addresses" property that 690then, to provide a separate "assigned-addresses" property that
@@ -711,7 +701,7 @@ prom_parse.c file of the recent kernels for your bus type.
711The "reg" property only defines addresses and sizes (if #size-cells is 701The "reg" property only defines addresses and sizes (if #size-cells is
712non-0) within a given bus. In order to translate addresses upward 702non-0) within a given bus. In order to translate addresses upward
713(that is into parent bus addresses, and possibly into CPU physical 703(that is into parent bus addresses, and possibly into CPU physical
714addresses), all busses must contain a "ranges" property. If the 704addresses), all buses must contain a "ranges" property. If the
715"ranges" property is missing at a given level, it's assumed that 705"ranges" property is missing at a given level, it's assumed that
716translation isn't possible, i.e., the registers are not visible on the 706translation isn't possible, i.e., the registers are not visible on the
717parent bus. The format of the "ranges" property for a bus is a list 707parent bus. The format of the "ranges" property for a bus is a list
@@ -727,9 +717,9 @@ example, for a PCI host controller, that would be a CPU address. For a
727PCI<->ISA bridge, that would be a PCI address. It defines the base 717PCI<->ISA bridge, that would be a PCI address. It defines the base
728address in the parent bus where the beginning of that range is mapped. 718address in the parent bus where the beginning of that range is mapped.
729 719
730For a new 64-bit powerpc board, I recommend either the 2/2 format or 720For new 64-bit board support, I recommend either the 2/2 format or
731Apple's 2/1 format which is slightly more compact since sizes usually 721Apple's 2/1 format which is slightly more compact since sizes usually
732fit in a single 32-bit word. New 32-bit powerpc boards should use a 722fit in a single 32-bit word. New 32-bit board support should use a
7331/1 format, unless the processor supports physical addresses greater 7231/1 format, unless the processor supports physical addresses greater
734than 32-bits, in which case a 2/1 format is recommended. 724than 32-bits, in which case a 2/1 format is recommended.
735 725
@@ -754,7 +744,7 @@ of their actual names.
754While earlier users of Open Firmware like OldWorld macintoshes tended 744While earlier users of Open Firmware like OldWorld macintoshes tended
755to use the actual device name for the "name" property, it's nowadays 745to use the actual device name for the "name" property, it's nowadays
756considered a good practice to use a name that is closer to the device 746considered a good practice to use a name that is closer to the device
757class (often equal to device_type). For example, nowadays, ethernet 747class (often equal to device_type). For example, nowadays, Ethernet
758controllers are named "ethernet", an additional "model" property 748controllers are named "ethernet", an additional "model" property
759defining precisely the chip type/model, and "compatible" property 749defining precisely the chip type/model, and "compatible" property
760defining the family in case a single driver can driver more than one 750defining the family in case a single driver can driver more than one
@@ -772,7 +762,7 @@ is present).
7724) Note about node and property names and character set 7624) Note about node and property names and character set
773------------------------------------------------------- 763-------------------------------------------------------
774 764
775While open firmware provides more flexible usage of 8859-1, this 765While Open Firmware provides more flexible usage of 8859-1, this
776specification enforces more strict rules. Nodes and properties should 766specification enforces more strict rules. Nodes and properties should
777be comprised only of ASCII characters 'a' to 'z', '0' to 767be comprised only of ASCII characters 'a' to 'z', '0' to
778'9', ',', '.', '_', '+', '#', '?', and '-'. Node names additionally 768'9', ',', '.', '_', '+', '#', '?', and '-'. Node names additionally
@@ -792,7 +782,7 @@ address which can extend beyond that limit.
792-------------------------------- 782--------------------------------
793 These are all that are currently required. However, it is strongly 783 These are all that are currently required. However, it is strongly
794 recommended that you expose PCI host bridges as documented in the 784 recommended that you expose PCI host bridges as documented in the
795 PCI binding to open firmware, and your interrupt tree as documented 785 PCI binding to Open Firmware, and your interrupt tree as documented
796 in OF interrupt tree specification. 786 in OF interrupt tree specification.
797 787
798 a) The root node 788 a) The root node
@@ -802,20 +792,12 @@ address which can extend beyond that limit.
802 - model : this is your board name/model 792 - model : this is your board name/model
803 - #address-cells : address representation for "root" devices 793 - #address-cells : address representation for "root" devices
804 - #size-cells: the size representation for "root" devices 794 - #size-cells: the size representation for "root" devices
805 - device_type : This property shouldn't be necessary. However, if
806 you decide to create a device_type for your root node, make sure it
807 is _not_ "chrp" unless your platform is a pSeries or PAPR compliant
808 one for 64-bit, or a CHRP-type machine for 32-bit as this will
809 matched by the kernel this way.
810
811 Additionally, some recommended properties are:
812
813 - compatible : the board "family" generally finds its way here, 795 - compatible : the board "family" generally finds its way here,
814 for example, if you have 2 board models with a similar layout, 796 for example, if you have 2 board models with a similar layout,
815 that typically get driven by the same platform code in the 797 that typically get driven by the same platform code in the
816 kernel, you would use a different "model" property but put a 798 kernel, you would specify the exact board model in the
817 value in "compatible". The kernel doesn't directly use that 799 compatible property followed by an entry that represents the SoC
818 value but it is generally useful. 800 model.
819 801
820 The root node is also generally where you add additional properties 802 The root node is also generally where you add additional properties
821 specific to your board like the serial number if any, that sort of 803 specific to your board like the serial number if any, that sort of
@@ -841,8 +823,11 @@ address which can extend beyond that limit.
841 823
842 So under /cpus, you are supposed to create a node for every CPU on 824 So under /cpus, you are supposed to create a node for every CPU on
843 the machine. There is no specific restriction on the name of the 825 the machine. There is no specific restriction on the name of the
844 CPU, though It's common practice to call it PowerPC,<name>. For 826 CPU, though it's common to call it <architecture>,<core>. For
845 example, Apple uses PowerPC,G5 while IBM uses PowerPC,970FX. 827 example, Apple uses PowerPC,G5 while IBM uses PowerPC,970FX.
828 However, the Generic Names convention suggests that it would be
829 better to simply use 'cpu' for each cpu node and use the compatible
830 property to identify the specific cpu core.
846 831
847 Required properties: 832 Required properties:
848 833
@@ -923,7 +908,7 @@ compatibility.
923 908
924 e) The /chosen node 909 e) The /chosen node
925 910
926 This node is a bit "special". Normally, that's where open firmware 911 This node is a bit "special". Normally, that's where Open Firmware
927 puts some variable environment information, like the arguments, or 912 puts some variable environment information, like the arguments, or
928 the default input/output devices. 913 the default input/output devices.
929 914
@@ -940,11 +925,7 @@ compatibility.
940 console device if any. Typically, if you have serial devices on 925 console device if any. Typically, if you have serial devices on
941 your board, you may want to put the full path to the one set as 926 your board, you may want to put the full path to the one set as
942 the default console in the firmware here, for the kernel to pick 927 the default console in the firmware here, for the kernel to pick
943 it up as its own default console. If you look at the function 928 it up as its own default console.
944 set_preferred_console() in arch/ppc64/kernel/setup.c, you'll see
945 that the kernel tries to find out the default console and has
946 knowledge of various types like 8250 serial ports. You may want
947 to extend this function to add your own.
948 929
949 Note that u-boot creates and fills in the chosen node for platforms 930 Note that u-boot creates and fills in the chosen node for platforms
950 that use it. 931 that use it.
@@ -955,23 +936,23 @@ compatibility.
955 936
956 f) the /soc<SOCname> node 937 f) the /soc<SOCname> node
957 938
958 This node is used to represent a system-on-a-chip (SOC) and must be 939 This node is used to represent a system-on-a-chip (SoC) and must be
959 present if the processor is a SOC. The top-level soc node contains 940 present if the processor is a SoC. The top-level soc node contains
960 information that is global to all devices on the SOC. The node name 941 information that is global to all devices on the SoC. The node name
961 should contain a unit address for the SOC, which is the base address 942 should contain a unit address for the SoC, which is the base address
962 of the memory-mapped register set for the SOC. The name of an soc 943 of the memory-mapped register set for the SoC. The name of an SoC
963 node should start with "soc", and the remainder of the name should 944 node should start with "soc", and the remainder of the name should
964 represent the part number for the soc. For example, the MPC8540's 945 represent the part number for the soc. For example, the MPC8540's
965 soc node would be called "soc8540". 946 soc node would be called "soc8540".
966 947
967 Required properties: 948 Required properties:
968 949
969 - device_type : Should be "soc"
970 - ranges : Should be defined as specified in 1) to describe the 950 - ranges : Should be defined as specified in 1) to describe the
971 translation of SOC addresses for memory mapped SOC registers. 951 translation of SoC addresses for memory mapped SoC registers.
972 - bus-frequency: Contains the bus frequency for the SOC node. 952 - bus-frequency: Contains the bus frequency for the SoC node.
973 Typically, the value of this field is filled in by the boot 953 Typically, the value of this field is filled in by the boot
974 loader. 954 loader.
955 - compatible : Exact model of the SoC
975 956
976 957
977 Recommended properties: 958 Recommended properties:
@@ -1155,12 +1136,13 @@ while all this has been defined and implemented.
1155 1136
1156 - An example of code for iterating nodes & retrieving properties 1137 - An example of code for iterating nodes & retrieving properties
1157 directly from the flattened tree format can be found in the kernel 1138 directly from the flattened tree format can be found in the kernel
1158 file arch/ppc64/kernel/prom.c, look at scan_flat_dt() function, 1139 file drivers/of/fdt.c. Look at the of_scan_flat_dt() function,
1159 its usage in early_init_devtree(), and the corresponding various 1140 its usage in early_init_devtree(), and the corresponding various
1160 early_init_dt_scan_*() callbacks. That code can be re-used in a 1141 early_init_dt_scan_*() callbacks. That code can be re-used in a
1161 GPL bootloader, and as the author of that code, I would be happy 1142 GPL bootloader, and as the author of that code, I would be happy
1162 to discuss possible free licensing to any vendor who wishes to 1143 to discuss possible free licensing to any vendor who wishes to
1163 integrate all or part of this code into a non-GPL bootloader. 1144 integrate all or part of this code into a non-GPL bootloader.
1145 (reference needed; who is 'I' here? ---gcl Jan 31, 2011)
1164 1146
1165 1147
1166 1148
@@ -1203,18 +1185,19 @@ MPC8540.
12032) Representing devices without a current OF specification 11852) Representing devices without a current OF specification
1204---------------------------------------------------------- 1186----------------------------------------------------------
1205 1187
1206Currently, there are many devices on SOCs that do not have a standard 1188Currently, there are many devices on SoCs that do not have a standard
1207representation pre-defined as part of the open firmware 1189representation defined as part of the Open Firmware specifications,
1208specifications, mainly because the boards that contain these SOCs are 1190mainly because the boards that contain these SoCs are not currently
1209not currently booted using open firmware. This section contains 1191booted using Open Firmware. Binding documentation for new devices
1210descriptions for the SOC devices for which new nodes have been 1192should be added to the Documentation/devicetree/bindings directory.
1211defined; this list will expand as more and more SOC-containing 1193That directory will expand as device tree support is added to more and
1212platforms are moved over to use the flattened-device-tree model. 1194more SoCs.
1195
1213 1196
1214VII - Specifying interrupt information for devices 1197VII - Specifying interrupt information for devices
1215=================================================== 1198===================================================
1216 1199
1217The device tree represents the busses and devices of a hardware 1200The device tree represents the buses and devices of a hardware
1218system in a form similar to the physical bus topology of the 1201system in a form similar to the physical bus topology of the
1219hardware. 1202hardware.
1220 1203
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 8c594c45b6a1..b959659c5df4 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -357,14 +357,6 @@ Who: Dave Jones <davej@redhat.com>, Matthew Garrett <mjg@redhat.com>
357 357
358----------------------------- 358-----------------------------
359 359
360What: __do_IRQ all in one fits nothing interrupt handler
361When: 2.6.32
362Why: __do_IRQ was kept for easy migration to the type flow handlers.
363 More than two years of migration time is enough.
364Who: Thomas Gleixner <tglx@linutronix.de>
365
366-----------------------------
367
368What: fakephp and associated sysfs files in /sys/bus/pci/slots/ 360What: fakephp and associated sysfs files in /sys/bus/pci/slots/
369When: 2011 361When: 2011
370Why: In 2.6.27, the semantics of /sys/bus/pci/slots was redefined to 362Why: In 2.6.27, the semantics of /sys/bus/pci/slots was redefined to
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index dc73bc54cc4e..d9da7e148538 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -39,6 +39,9 @@
39#include <limits.h> 39#include <limits.h>
40#include <stddef.h> 40#include <stddef.h>
41#include <signal.h> 41#include <signal.h>
42#include <pwd.h>
43#include <grp.h>
44
42#include <linux/virtio_config.h> 45#include <linux/virtio_config.h>
43#include <linux/virtio_net.h> 46#include <linux/virtio_net.h>
44#include <linux/virtio_blk.h> 47#include <linux/virtio_blk.h>
@@ -298,20 +301,27 @@ static void *map_zeroed_pages(unsigned int num)
298 301
299 /* 302 /*
300 * We use a private mapping (ie. if we write to the page, it will be 303 * We use a private mapping (ie. if we write to the page, it will be
301 * copied). 304 * copied). We allocate an extra two pages PROT_NONE to act as guard
305 * pages against read/write attempts that exceed allocated space.
302 */ 306 */
303 addr = mmap(NULL, getpagesize() * num, 307 addr = mmap(NULL, getpagesize() * (num+2),
304 PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, fd, 0); 308 PROT_NONE, MAP_PRIVATE, fd, 0);
309
305 if (addr == MAP_FAILED) 310 if (addr == MAP_FAILED)
306 err(1, "Mmapping %u pages of /dev/zero", num); 311 err(1, "Mmapping %u pages of /dev/zero", num);
307 312
313 if (mprotect(addr + getpagesize(), getpagesize() * num,
314 PROT_READ|PROT_WRITE) == -1)
315 err(1, "mprotect rw %u pages failed", num);
316
308 /* 317 /*
309 * One neat mmap feature is that you can close the fd, and it 318 * One neat mmap feature is that you can close the fd, and it
310 * stays mapped. 319 * stays mapped.
311 */ 320 */
312 close(fd); 321 close(fd);
313 322
314 return addr; 323 /* Return address after PROT_NONE page */
324 return addr + getpagesize();
315} 325}
316 326
317/* Get some more pages for a device. */ 327/* Get some more pages for a device. */
@@ -343,7 +353,7 @@ static void map_at(int fd, void *addr, unsigned long offset, unsigned long len)
343 * done to it. This allows us to share untouched memory between 353 * done to it. This allows us to share untouched memory between
344 * Guests. 354 * Guests.
345 */ 355 */
346 if (mmap(addr, len, PROT_READ|PROT_WRITE|PROT_EXEC, 356 if (mmap(addr, len, PROT_READ|PROT_WRITE,
347 MAP_FIXED|MAP_PRIVATE, fd, offset) != MAP_FAILED) 357 MAP_FIXED|MAP_PRIVATE, fd, offset) != MAP_FAILED)
348 return; 358 return;
349 359
@@ -573,10 +583,10 @@ static void *_check_pointer(unsigned long addr, unsigned int size,
573 unsigned int line) 583 unsigned int line)
574{ 584{
575 /* 585 /*
576 * We have to separately check addr and addr+size, because size could 586 * Check if the requested address and size exceeds the allocated memory,
577 * be huge and addr + size might wrap around. 587 * or addr + size wraps around.
578 */ 588 */
579 if (addr >= guest_limit || addr + size >= guest_limit) 589 if ((addr + size) > guest_limit || (addr + size) < addr)
580 errx(1, "%s:%i: Invalid address %#lx", __FILE__, line, addr); 590 errx(1, "%s:%i: Invalid address %#lx", __FILE__, line, addr);
581 /* 591 /*
582 * We return a pointer for the caller's convenience, now we know it's 592 * We return a pointer for the caller's convenience, now we know it's
@@ -1872,6 +1882,8 @@ static struct option opts[] = {
1872 { "block", 1, NULL, 'b' }, 1882 { "block", 1, NULL, 'b' },
1873 { "rng", 0, NULL, 'r' }, 1883 { "rng", 0, NULL, 'r' },
1874 { "initrd", 1, NULL, 'i' }, 1884 { "initrd", 1, NULL, 'i' },
1885 { "username", 1, NULL, 'u' },
1886 { "chroot", 1, NULL, 'c' },
1875 { NULL }, 1887 { NULL },
1876}; 1888};
1877static void usage(void) 1889static void usage(void)
@@ -1894,6 +1906,12 @@ int main(int argc, char *argv[])
1894 /* If they specify an initrd file to load. */ 1906 /* If they specify an initrd file to load. */
1895 const char *initrd_name = NULL; 1907 const char *initrd_name = NULL;
1896 1908
1909 /* Password structure for initgroups/setres[gu]id */
1910 struct passwd *user_details = NULL;
1911
1912 /* Directory to chroot to */
1913 char *chroot_path = NULL;
1914
1897 /* Save the args: we "reboot" by execing ourselves again. */ 1915 /* Save the args: we "reboot" by execing ourselves again. */
1898 main_args = argv; 1916 main_args = argv;
1899 1917
@@ -1950,6 +1968,14 @@ int main(int argc, char *argv[])
1950 case 'i': 1968 case 'i':
1951 initrd_name = optarg; 1969 initrd_name = optarg;
1952 break; 1970 break;
1971 case 'u':
1972 user_details = getpwnam(optarg);
1973 if (!user_details)
1974 err(1, "getpwnam failed, incorrect username?");
1975 break;
1976 case 'c':
1977 chroot_path = optarg;
1978 break;
1953 default: 1979 default:
1954 warnx("Unknown argument %s", argv[optind]); 1980 warnx("Unknown argument %s", argv[optind]);
1955 usage(); 1981 usage();
@@ -2021,6 +2047,37 @@ int main(int argc, char *argv[])
2021 /* If we exit via err(), this kills all the threads, restores tty. */ 2047 /* If we exit via err(), this kills all the threads, restores tty. */
2022 atexit(cleanup_devices); 2048 atexit(cleanup_devices);
2023 2049
2050 /* If requested, chroot to a directory */
2051 if (chroot_path) {
2052 if (chroot(chroot_path) != 0)
2053 err(1, "chroot(\"%s\") failed", chroot_path);
2054
2055 if (chdir("/") != 0)
2056 err(1, "chdir(\"/\") failed");
2057
2058 verbose("chroot done\n");
2059 }
2060
2061 /* If requested, drop privileges */
2062 if (user_details) {
2063 uid_t u;
2064 gid_t g;
2065
2066 u = user_details->pw_uid;
2067 g = user_details->pw_gid;
2068
2069 if (initgroups(user_details->pw_name, g) != 0)
2070 err(1, "initgroups failed");
2071
2072 if (setresgid(g, g, g) != 0)
2073 err(1, "setresgid failed");
2074
2075 if (setresuid(u, u, u) != 0)
2076 err(1, "setresuid failed");
2077
2078 verbose("Dropping privileges completed\n");
2079 }
2080
2024 /* Finally, run the Guest. This doesn't return. */ 2081 /* Finally, run the Guest. This doesn't return. */
2025 run_guest(); 2082 run_guest();
2026} 2083}
diff --git a/Documentation/lguest/lguest.txt b/Documentation/lguest/lguest.txt
index 6ccaf8e1a00e..dad99978a6a8 100644
--- a/Documentation/lguest/lguest.txt
+++ b/Documentation/lguest/lguest.txt
@@ -117,6 +117,11 @@ Running Lguest:
117 117
118 for general information on how to get bridging to work. 118 for general information on how to get bridging to work.
119 119
120- Random number generation. Using the --rng option will provide a
121 /dev/hwrng in the guest that will read from the host's /dev/random.
122 Use this option in conjunction with rng-tools (see ../hw_random.txt)
123 to provide entropy to the guest kernel's /dev/random.
124
120There is a helpful mailing list at http://ozlabs.org/mailman/listinfo/lguest 125There is a helpful mailing list at http://ozlabs.org/mailman/listinfo/lguest
121 126
122Good luck! 127Good luck!
diff --git a/Documentation/sound/alsa/soc/codec.txt b/Documentation/sound/alsa/soc/codec.txt
index 37ba3a72cb76..bce23a4a7875 100644
--- a/Documentation/sound/alsa/soc/codec.txt
+++ b/Documentation/sound/alsa/soc/codec.txt
@@ -27,42 +27,38 @@ ASoC Codec driver breakdown
27 27
281 - Codec DAI and PCM configuration 281 - Codec DAI and PCM configuration
29----------------------------------- 29-----------------------------------
30Each codec driver must have a struct snd_soc_codec_dai to define its DAI and 30Each codec driver must have a struct snd_soc_dai_driver to define its DAI and
31PCM capabilities and operations. This struct is exported so that it can be 31PCM capabilities and operations. This struct is exported so that it can be
32registered with the core by your machine driver. 32registered with the core by your machine driver.
33 33
34e.g. 34e.g.
35 35
36struct snd_soc_codec_dai wm8731_dai = { 36static struct snd_soc_dai_ops wm8731_dai_ops = {
37 .name = "WM8731", 37 .prepare = wm8731_pcm_prepare,
38 /* playback capabilities */ 38 .hw_params = wm8731_hw_params,
39 .shutdown = wm8731_shutdown,
40 .digital_mute = wm8731_mute,
41 .set_sysclk = wm8731_set_dai_sysclk,
42 .set_fmt = wm8731_set_dai_fmt,
43};
44
45struct snd_soc_dai_driver wm8731_dai = {
46 .name = "wm8731-hifi",
39 .playback = { 47 .playback = {
40 .stream_name = "Playback", 48 .stream_name = "Playback",
41 .channels_min = 1, 49 .channels_min = 1,
42 .channels_max = 2, 50 .channels_max = 2,
43 .rates = WM8731_RATES, 51 .rates = WM8731_RATES,
44 .formats = WM8731_FORMATS,}, 52 .formats = WM8731_FORMATS,},
45 /* capture capabilities */
46 .capture = { 53 .capture = {
47 .stream_name = "Capture", 54 .stream_name = "Capture",
48 .channels_min = 1, 55 .channels_min = 1,
49 .channels_max = 2, 56 .channels_max = 2,
50 .rates = WM8731_RATES, 57 .rates = WM8731_RATES,
51 .formats = WM8731_FORMATS,}, 58 .formats = WM8731_FORMATS,},
52 /* pcm operations - see section 4 below */ 59 .ops = &wm8731_dai_ops,
53 .ops = { 60 .symmetric_rates = 1,
54 .prepare = wm8731_pcm_prepare,
55 .hw_params = wm8731_hw_params,
56 .shutdown = wm8731_shutdown,
57 },
58 /* DAI operations - see DAI.txt */
59 .dai_ops = {
60 .digital_mute = wm8731_mute,
61 .set_sysclk = wm8731_set_dai_sysclk,
62 .set_fmt = wm8731_set_dai_fmt,
63 }
64}; 61};
65EXPORT_SYMBOL_GPL(wm8731_dai);
66 62
67 63
682 - Codec control IO 642 - Codec control IO
@@ -186,13 +182,14 @@ when the mute is applied or freed.
186 182
187i.e. 183i.e.
188 184
189static int wm8974_mute(struct snd_soc_codec *codec, 185static int wm8974_mute(struct snd_soc_dai *dai, int mute)
190 struct snd_soc_codec_dai *dai, int mute)
191{ 186{
192 u16 mute_reg = wm8974_read_reg_cache(codec, WM8974_DAC) & 0xffbf; 187 struct snd_soc_codec *codec = dai->codec;
193 if(mute) 188 u16 mute_reg = snd_soc_read(codec, WM8974_DAC) & 0xffbf;
194 wm8974_write(codec, WM8974_DAC, mute_reg | 0x40); 189
190 if (mute)
191 snd_soc_write(codec, WM8974_DAC, mute_reg | 0x40);
195 else 192 else
196 wm8974_write(codec, WM8974_DAC, mute_reg); 193 snd_soc_write(codec, WM8974_DAC, mute_reg);
197 return 0; 194 return 0;
198} 195}
diff --git a/Documentation/sound/alsa/soc/machine.txt b/Documentation/sound/alsa/soc/machine.txt
index 2524c75557df..3e2ec9cbf397 100644
--- a/Documentation/sound/alsa/soc/machine.txt
+++ b/Documentation/sound/alsa/soc/machine.txt
@@ -12,6 +12,8 @@ the following struct:-
12struct snd_soc_card { 12struct snd_soc_card {
13 char *name; 13 char *name;
14 14
15 ...
16
15 int (*probe)(struct platform_device *pdev); 17 int (*probe)(struct platform_device *pdev);
16 int (*remove)(struct platform_device *pdev); 18 int (*remove)(struct platform_device *pdev);
17 19
@@ -22,12 +24,13 @@ struct snd_soc_card {
22 int (*resume_pre)(struct platform_device *pdev); 24 int (*resume_pre)(struct platform_device *pdev);
23 int (*resume_post)(struct platform_device *pdev); 25 int (*resume_post)(struct platform_device *pdev);
24 26
25 /* machine stream operations */ 27 ...
26 struct snd_soc_ops *ops;
27 28
28 /* CPU <--> Codec DAI links */ 29 /* CPU <--> Codec DAI links */
29 struct snd_soc_dai_link *dai_link; 30 struct snd_soc_dai_link *dai_link;
30 int num_links; 31 int num_links;
32
33 ...
31}; 34};
32 35
33probe()/remove() 36probe()/remove()
@@ -42,11 +45,6 @@ of any machine audio tasks that have to be done before or after the codec, DAIs
42and DMA is suspended and resumed. Optional. 45and DMA is suspended and resumed. Optional.
43 46
44 47
45Machine operations
46------------------
47The machine specific audio operations can be set here. Again this is optional.
48
49
50Machine DAI Configuration 48Machine DAI Configuration
51------------------------- 49-------------------------
52The machine DAI configuration glues all the codec and CPU DAIs together. It can 50The machine DAI configuration glues all the codec and CPU DAIs together. It can
@@ -61,8 +59,10 @@ struct snd_soc_dai_link is used to set up each DAI in your machine. e.g.
61static struct snd_soc_dai_link corgi_dai = { 59static struct snd_soc_dai_link corgi_dai = {
62 .name = "WM8731", 60 .name = "WM8731",
63 .stream_name = "WM8731", 61 .stream_name = "WM8731",
64 .cpu_dai = &pxa_i2s_dai, 62 .cpu_dai_name = "pxa-is2-dai",
65 .codec_dai = &wm8731_dai, 63 .codec_dai_name = "wm8731-hifi",
64 .platform_name = "pxa-pcm-audio",
65 .codec_name = "wm8713-codec.0-001a",
66 .init = corgi_wm8731_init, 66 .init = corgi_wm8731_init,
67 .ops = &corgi_ops, 67 .ops = &corgi_ops,
68}; 68};
@@ -77,26 +77,6 @@ static struct snd_soc_card snd_soc_corgi = {
77}; 77};
78 78
79 79
80Machine Audio Subsystem
81-----------------------
82
83The machine soc device glues the platform, machine and codec driver together.
84Private data can also be set here. e.g.
85
86/* corgi audio private data */
87static struct wm8731_setup_data corgi_wm8731_setup = {
88 .i2c_address = 0x1b,
89};
90
91/* corgi audio subsystem */
92static struct snd_soc_device corgi_snd_devdata = {
93 .machine = &snd_soc_corgi,
94 .platform = &pxa2xx_soc_platform,
95 .codec_dev = &soc_codec_dev_wm8731,
96 .codec_data = &corgi_wm8731_setup,
97};
98
99
100Machine Power Map 80Machine Power Map
101----------------- 81-----------------
102 82
diff --git a/Documentation/sound/alsa/soc/platform.txt b/Documentation/sound/alsa/soc/platform.txt
index 06d835987c6a..d57efad37e0a 100644
--- a/Documentation/sound/alsa/soc/platform.txt
+++ b/Documentation/sound/alsa/soc/platform.txt
@@ -20,9 +20,10 @@ struct snd_soc_ops {
20 int (*trigger)(struct snd_pcm_substream *, int); 20 int (*trigger)(struct snd_pcm_substream *, int);
21}; 21};
22 22
23The platform driver exports its DMA functionality via struct snd_soc_platform:- 23The platform driver exports its DMA functionality via struct
24snd_soc_platform_driver:-
24 25
25struct snd_soc_platform { 26struct snd_soc_platform_driver {
26 char *name; 27 char *name;
27 28
28 int (*probe)(struct platform_device *pdev); 29 int (*probe)(struct platform_device *pdev);
@@ -34,6 +35,13 @@ struct snd_soc_platform {
34 int (*pcm_new)(struct snd_card *, struct snd_soc_codec_dai *, struct snd_pcm *); 35 int (*pcm_new)(struct snd_card *, struct snd_soc_codec_dai *, struct snd_pcm *);
35 void (*pcm_free)(struct snd_pcm *); 36 void (*pcm_free)(struct snd_pcm *);
36 37
38 /*
39 * For platform caused delay reporting.
40 * Optional.
41 */
42 snd_pcm_sframes_t (*delay)(struct snd_pcm_substream *,
43 struct snd_soc_dai *);
44
37 /* platform stream ops */ 45 /* platform stream ops */
38 struct snd_pcm_ops *pcm_ops; 46 struct snd_pcm_ops *pcm_ops;
39}; 47};
diff --git a/Documentation/video4linux/v4l2-controls.txt b/Documentation/video4linux/v4l2-controls.txt
index 8773778d23fc..881e7f44491b 100644
--- a/Documentation/video4linux/v4l2-controls.txt
+++ b/Documentation/video4linux/v4l2-controls.txt
@@ -285,6 +285,9 @@ implement g_volatile_ctrl like this:
285The 'new value' union is not used in g_volatile_ctrl. In general controls 285The 'new value' union is not used in g_volatile_ctrl. In general controls
286that need to implement g_volatile_ctrl are read-only controls. 286that need to implement g_volatile_ctrl are read-only controls.
287 287
288Note that if one or more controls in a control cluster are marked as volatile,
289then all the controls in the cluster are seen as volatile.
290
288To mark a control as volatile you have to set the is_volatile flag: 291To mark a control as volatile you have to set the is_volatile flag:
289 292
290 ctrl = v4l2_ctrl_new_std(&sd->ctrl_handler, ...); 293 ctrl = v4l2_ctrl_new_std(&sd->ctrl_handler, ...);
@@ -462,6 +465,15 @@ pointer to the v4l2_ctrl_ops struct that is used for that cluster.
462Obviously, all controls in the cluster array must be initialized to either 465Obviously, all controls in the cluster array must be initialized to either
463a valid control or to NULL. 466a valid control or to NULL.
464 467
468In rare cases you might want to know which controls of a cluster actually
469were set explicitly by the user. For this you can check the 'is_new' flag of
470each control. For example, in the case of a volume/mute cluster the 'is_new'
471flag of the mute control would be set if the user called VIDIOC_S_CTRL for
472mute only. If the user would call VIDIOC_S_EXT_CTRLS for both mute and volume
473controls, then the 'is_new' flag would be 1 for both controls.
474
475The 'is_new' flag is always 1 when called from v4l2_ctrl_handler_setup().
476
465 477
466VIDIOC_LOG_STATUS Support 478VIDIOC_LOG_STATUS Support
467========================= 479=========================
diff --git a/MAINTAINERS b/MAINTAINERS
index 2f61f678249a..6d6d6bdba3a6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -162,7 +162,7 @@ L: linux-serial@vger.kernel.org
162W: http://serial.sourceforge.net 162W: http://serial.sourceforge.net
163S: Maintained 163S: Maintained
164T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6.git 164T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6.git
165F: drivers/serial/8250* 165F: drivers/tty/serial/8250*
166F: include/linux/serial_8250.h 166F: include/linux/serial_8250.h
167 167
1688390 NETWORK DRIVERS [WD80x3/SMC-ELITE, SMC-ULTRA, NE2000, 3C503, etc.] 1688390 NETWORK DRIVERS [WD80x3/SMC-ELITE, SMC-ULTRA, NE2000, 3C503, etc.]
@@ -624,11 +624,15 @@ M: Lennert Buytenhek <kernel@wantstofly.org>
624L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 624L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
625S: Maintained 625S: Maintained
626 626
627ARM/ATMEL AT91RM9200 ARM ARCHITECTURE 627ARM/ATMEL AT91RM9200 AND AT91SAM ARM ARCHITECTURES
628M: Andrew Victor <linux@maxim.org.za> 628M: Andrew Victor <linux@maxim.org.za>
629M: Nicolas Ferre <nicolas.ferre@atmel.com>
630M: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
629L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 631L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
630W: http://maxim.org.za/at91_26.html 632W: http://maxim.org.za/at91_26.html
631S: Maintained 633W: http://www.linux4sam.org
634S: Supported
635F: arch/arm/mach-at91/
632 636
633ARM/BCMRING ARM ARCHITECTURE 637ARM/BCMRING ARM ARCHITECTURE
634M: Jiandong Zheng <jdzheng@broadcom.com> 638M: Jiandong Zheng <jdzheng@broadcom.com>
@@ -888,8 +892,8 @@ F: arch/arm/mach-msm/
888F: drivers/video/msm/ 892F: drivers/video/msm/
889F: drivers/mmc/host/msm_sdcc.c 893F: drivers/mmc/host/msm_sdcc.c
890F: drivers/mmc/host/msm_sdcc.h 894F: drivers/mmc/host/msm_sdcc.h
891F: drivers/serial/msm_serial.h 895F: drivers/tty/serial/msm_serial.h
892F: drivers/serial/msm_serial.c 896F: drivers/tty/serial/msm_serial.c
893T: git git://codeaurora.org/quic/kernel/davidb/linux-msm.git 897T: git git://codeaurora.org/quic/kernel/davidb/linux-msm.git
894S: Maintained 898S: Maintained
895 899
@@ -1256,7 +1260,7 @@ F: drivers/mmc/host/atmel-mci-regs.h
1256ATMEL AT91 / AT32 SERIAL DRIVER 1260ATMEL AT91 / AT32 SERIAL DRIVER
1257M: Nicolas Ferre <nicolas.ferre@atmel.com> 1261M: Nicolas Ferre <nicolas.ferre@atmel.com>
1258S: Supported 1262S: Supported
1259F: drivers/serial/atmel_serial.c 1263F: drivers/tty/serial/atmel_serial.c
1260 1264
1261ATMEL LCDFB DRIVER 1265ATMEL LCDFB DRIVER
1262M: Nicolas Ferre <nicolas.ferre@atmel.com> 1266M: Nicolas Ferre <nicolas.ferre@atmel.com>
@@ -1412,7 +1416,7 @@ M: Sonic Zhang <sonic.zhang@analog.com>
1412L: uclinux-dist-devel@blackfin.uclinux.org 1416L: uclinux-dist-devel@blackfin.uclinux.org
1413W: http://blackfin.uclinux.org 1417W: http://blackfin.uclinux.org
1414S: Supported 1418S: Supported
1415F: drivers/serial/bfin_5xx.c 1419F: drivers/tty/serial/bfin_5xx.c
1416 1420
1417BLACKFIN WATCHDOG DRIVER 1421BLACKFIN WATCHDOG DRIVER
1418M: Mike Frysinger <vapier.adi@gmail.com> 1422M: Mike Frysinger <vapier.adi@gmail.com>
@@ -1877,7 +1881,7 @@ L: linux-cris-kernel@axis.com
1877W: http://developer.axis.com 1881W: http://developer.axis.com
1878S: Maintained 1882S: Maintained
1879F: arch/cris/ 1883F: arch/cris/
1880F: drivers/serial/crisv10.* 1884F: drivers/tty/serial/crisv10.*
1881 1885
1882CRYPTO API 1886CRYPTO API
1883M: Herbert Xu <herbert@gondor.apana.org.au> 1887M: Herbert Xu <herbert@gondor.apana.org.au>
@@ -2216,7 +2220,7 @@ F: drivers/net/wan/dscc4.c
2216DZ DECSTATION DZ11 SERIAL DRIVER 2220DZ DECSTATION DZ11 SERIAL DRIVER
2217M: "Maciej W. Rozycki" <macro@linux-mips.org> 2221M: "Maciej W. Rozycki" <macro@linux-mips.org>
2218S: Maintained 2222S: Maintained
2219F: drivers/serial/dz.* 2223F: drivers/tty/serial/dz.*
2220 2224
2221EATA-DMA SCSI DRIVER 2225EATA-DMA SCSI DRIVER
2222M: Michael Neuffer <mike@i-Connect.Net> 2226M: Michael Neuffer <mike@i-Connect.Net>
@@ -2643,7 +2647,7 @@ FREESCALE QUICC ENGINE UCC UART DRIVER
2643M: Timur Tabi <timur@freescale.com> 2647M: Timur Tabi <timur@freescale.com>
2644L: linuxppc-dev@lists.ozlabs.org 2648L: linuxppc-dev@lists.ozlabs.org
2645S: Supported 2649S: Supported
2646F: drivers/serial/ucc_uart.c 2650F: drivers/tty/serial/ucc_uart.c
2647 2651
2648FREESCALE SOC SOUND DRIVERS 2652FREESCALE SOC SOUND DRIVERS
2649M: Timur Tabi <timur@freescale.com> 2653M: Timur Tabi <timur@freescale.com>
@@ -3155,7 +3159,7 @@ S: Orphan
3155F: drivers/video/imsttfb.c 3159F: drivers/video/imsttfb.c
3156 3160
3157INFINIBAND SUBSYSTEM 3161INFINIBAND SUBSYSTEM
3158M: Roland Dreier <rolandd@cisco.com> 3162M: Roland Dreier <roland@kernel.org>
3159M: Sean Hefty <sean.hefty@intel.com> 3163M: Sean Hefty <sean.hefty@intel.com>
3160M: Hal Rosenstock <hal.rosenstock@gmail.com> 3164M: Hal Rosenstock <hal.rosenstock@gmail.com>
3161L: linux-rdma@vger.kernel.org 3165L: linux-rdma@vger.kernel.org
@@ -3359,7 +3363,7 @@ IOC3 SERIAL DRIVER
3359M: Pat Gefre <pfg@sgi.com> 3363M: Pat Gefre <pfg@sgi.com>
3360L: linux-serial@vger.kernel.org 3364L: linux-serial@vger.kernel.org
3361S: Maintained 3365S: Maintained
3362F: drivers/serial/ioc3_serial.c 3366F: drivers/tty/serial/ioc3_serial.c
3363 3367
3364IP MASQUERADING 3368IP MASQUERADING
3365M: Juanjo Ciarlante <jjciarla@raiz.uncu.edu.ar> 3369M: Juanjo Ciarlante <jjciarla@raiz.uncu.edu.ar>
@@ -3536,7 +3540,7 @@ JSM Neo PCI based serial card
3536M: Breno Leitao <leitao@linux.vnet.ibm.com> 3540M: Breno Leitao <leitao@linux.vnet.ibm.com>
3537L: linux-serial@vger.kernel.org 3541L: linux-serial@vger.kernel.org
3538S: Maintained 3542S: Maintained
3539F: drivers/serial/jsm/ 3543F: drivers/tty/serial/jsm/
3540 3544
3541K10TEMP HARDWARE MONITORING DRIVER 3545K10TEMP HARDWARE MONITORING DRIVER
3542M: Clemens Ladisch <clemens@ladisch.de> 3546M: Clemens Ladisch <clemens@ladisch.de>
@@ -3686,7 +3690,7 @@ L: kgdb-bugreport@lists.sourceforge.net
3686S: Maintained 3690S: Maintained
3687F: Documentation/DocBook/kgdb.tmpl 3691F: Documentation/DocBook/kgdb.tmpl
3688F: drivers/misc/kgdbts.c 3692F: drivers/misc/kgdbts.c
3689F: drivers/serial/kgdboc.c 3693F: drivers/tty/serial/kgdboc.c
3690F: include/linux/kdb.h 3694F: include/linux/kdb.h
3691F: include/linux/kgdb.h 3695F: include/linux/kgdb.h
3692F: kernel/debug/ 3696F: kernel/debug/
@@ -4567,7 +4571,7 @@ F: drivers/i2c/busses/i2c-ocores.c
4567 4571
4568OPEN FIRMWARE AND FLATTENED DEVICE TREE 4572OPEN FIRMWARE AND FLATTENED DEVICE TREE
4569M: Grant Likely <grant.likely@secretlab.ca> 4573M: Grant Likely <grant.likely@secretlab.ca>
4570L: devicetree-discuss@lists.ozlabs.org 4574L: devicetree-discuss@lists.ozlabs.org (moderated for non-subscribers)
4571W: http://fdt.secretlab.ca 4575W: http://fdt.secretlab.ca
4572T: git git://git.secretlab.ca/git/linux-2.6.git 4576T: git git://git.secretlab.ca/git/linux-2.6.git
4573S: Maintained 4577S: Maintained
@@ -5554,7 +5558,7 @@ M: Pat Gefre <pfg@sgi.com>
5554L: linux-ia64@vger.kernel.org 5558L: linux-ia64@vger.kernel.org
5555S: Supported 5559S: Supported
5556F: Documentation/ia64/serial.txt 5560F: Documentation/ia64/serial.txt
5557F: drivers/serial/ioc?_serial.c 5561F: drivers/tty/serial/ioc?_serial.c
5558F: include/linux/ioc?.h 5562F: include/linux/ioc?.h
5559 5563
5560SGI VISUAL WORKSTATION 320 AND 540 5564SGI VISUAL WORKSTATION 320 AND 540
@@ -5576,7 +5580,7 @@ L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
5576S: Maintained 5580S: Maintained
5577F: Documentation/arm/Sharp-LH/ADC-LH7-Touchscreen 5581F: Documentation/arm/Sharp-LH/ADC-LH7-Touchscreen
5578F: arch/arm/mach-lh7a40x/ 5582F: arch/arm/mach-lh7a40x/
5579F: drivers/serial/serial_lh7a40x.c 5583F: drivers/tty/serial/serial_lh7a40x.c
5580F: drivers/usb/gadget/lh7a40* 5584F: drivers/usb/gadget/lh7a40*
5581F: drivers/usb/host/ohci-lh7a40* 5585F: drivers/usb/host/ohci-lh7a40*
5582 5586
@@ -5796,14 +5800,14 @@ L: sparclinux@vger.kernel.org
5796T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6.git 5800T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6.git
5797T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next-2.6.git 5801T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next-2.6.git
5798S: Maintained 5802S: Maintained
5799F: drivers/serial/suncore.c 5803F: drivers/tty/serial/suncore.c
5800F: drivers/serial/suncore.h 5804F: drivers/tty/serial/suncore.h
5801F: drivers/serial/sunhv.c 5805F: drivers/tty/serial/sunhv.c
5802F: drivers/serial/sunsab.c 5806F: drivers/tty/serial/sunsab.c
5803F: drivers/serial/sunsab.h 5807F: drivers/tty/serial/sunsab.h
5804F: drivers/serial/sunsu.c 5808F: drivers/tty/serial/sunsu.c
5805F: drivers/serial/sunzilog.c 5809F: drivers/tty/serial/sunzilog.c
5806F: drivers/serial/sunzilog.h 5810F: drivers/tty/serial/sunzilog.h
5807 5811
5808SPEAR PLATFORM SUPPORT 5812SPEAR PLATFORM SUPPORT
5809M: Viresh Kumar <viresh.kumar@st.com> 5813M: Viresh Kumar <viresh.kumar@st.com>
@@ -6133,8 +6137,8 @@ TTY LAYER
6133M: Greg Kroah-Hartman <gregkh@suse.de> 6137M: Greg Kroah-Hartman <gregkh@suse.de>
6134S: Maintained 6138S: Maintained
6135T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6.git 6139T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6.git
6136F: drivers/char/tty_* 6140F: drivers/tty/*
6137F: drivers/serial/serial_core.c 6141F: drivers/tty/serial/serial_core.c
6138F: include/linux/serial_core.h 6142F: include/linux/serial_core.h
6139F: include/linux/serial.h 6143F: include/linux/serial.h
6140F: include/linux/tty.h 6144F: include/linux/tty.h
@@ -6879,7 +6883,7 @@ XILINX UARTLITE SERIAL DRIVER
6879M: Peter Korsgaard <jacmet@sunsite.dk> 6883M: Peter Korsgaard <jacmet@sunsite.dk>
6880L: linux-serial@vger.kernel.org 6884L: linux-serial@vger.kernel.org
6881S: Maintained 6885S: Maintained
6882F: drivers/serial/uartlite.c 6886F: drivers/tty/serial/uartlite.c
6883 6887
6884YAM DRIVER FOR AX.25 6888YAM DRIVER FOR AX.25
6885M: Jean-Paul Roubelat <jpr@f6fbb.org> 6889M: Jean-Paul Roubelat <jpr@f6fbb.org>
@@ -6925,7 +6929,7 @@ F: drivers/media/video/zoran/
6925ZS DECSTATION Z85C30 SERIAL DRIVER 6929ZS DECSTATION Z85C30 SERIAL DRIVER
6926M: "Maciej W. Rozycki" <macro@linux-mips.org> 6930M: "Maciej W. Rozycki" <macro@linux-mips.org>
6927S: Maintained 6931S: Maintained
6928F: drivers/serial/zs.* 6932F: drivers/tty/serial/zs.*
6929 6933
6930GRE DEMULTIPLEXER DRIVER 6934GRE DEMULTIPLEXER DRIVER
6931M: Dmitry Kozlov <xeb@mail.ru> 6935M: Dmitry Kozlov <xeb@mail.ru>
diff --git a/Makefile b/Makefile
index abb49bf8596e..1f474953427f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 38 3SUBLEVEL = 38
4EXTRAVERSION = -rc1 4EXTRAVERSION = -rc2
5NAME = Flesh-Eating Bats with Fangs 5NAME = Flesh-Eating Bats with Fangs
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index fc95ee1bcf6f..47f63d480141 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -8,6 +8,9 @@ config ALPHA
8 select HAVE_IRQ_WORK 8 select HAVE_IRQ_WORK
9 select HAVE_PERF_EVENTS 9 select HAVE_PERF_EVENTS
10 select HAVE_DMA_ATTRS 10 select HAVE_DMA_ATTRS
11 select HAVE_GENERIC_HARDIRQS
12 select GENERIC_IRQ_PROBE
13 select AUTO_IRQ_AFFINITY if SMP
11 help 14 help
12 The Alpha is a 64-bit general-purpose processor designed and 15 The Alpha is a 64-bit general-purpose processor designed and
13 marketed by the Digital Equipment Corporation of blessed memory, 16 marketed by the Digital Equipment Corporation of blessed memory,
@@ -68,22 +71,6 @@ config GENERIC_IOMAP
68 bool 71 bool
69 default n 72 default n
70 73
71config GENERIC_HARDIRQS_NO__DO_IRQ
72 def_bool y
73
74config GENERIC_HARDIRQS
75 bool
76 default y
77
78config GENERIC_IRQ_PROBE
79 bool
80 default y
81
82config AUTO_IRQ_AFFINITY
83 bool
84 depends on SMP
85 default y
86
87source "init/Kconfig" 74source "init/Kconfig"
88source "kernel/Kconfig.freezer" 75source "kernel/Kconfig.freezer"
89 76
diff --git a/arch/arm/configs/ag5evm_defconfig b/arch/arm/configs/ag5evm_defconfig
index 2b9cf56db363..212ead354a6b 100644
--- a/arch/arm/configs/ag5evm_defconfig
+++ b/arch/arm/configs/ag5evm_defconfig
@@ -10,7 +10,7 @@ CONFIG_NAMESPACES=y
10# CONFIG_PID_NS is not set 10# CONFIG_PID_NS is not set
11CONFIG_BLK_DEV_INITRD=y 11CONFIG_BLK_DEV_INITRD=y
12CONFIG_INITRAMFS_SOURCE="" 12CONFIG_INITRAMFS_SOURCE=""
13CONFIG_EMBEDDED=y 13CONFIG_EXPERT=y
14CONFIG_SLAB=y 14CONFIG_SLAB=y
15# CONFIG_BLK_DEV_BSG is not set 15# CONFIG_BLK_DEV_BSG is not set
16# CONFIG_IOSCHED_DEADLINE is not set 16# CONFIG_IOSCHED_DEADLINE is not set
diff --git a/arch/arm/configs/am200epdkit_defconfig b/arch/arm/configs/am200epdkit_defconfig
index 5536c488dd01..f0dea52e49c4 100644
--- a/arch/arm/configs/am200epdkit_defconfig
+++ b/arch/arm/configs/am200epdkit_defconfig
@@ -3,7 +3,7 @@ CONFIG_LOCALVERSION="gum"
3# CONFIG_SWAP is not set 3# CONFIG_SWAP is not set
4CONFIG_SYSVIPC=y 4CONFIG_SYSVIPC=y
5CONFIG_SYSFS_DEPRECATED_V2=y 5CONFIG_SYSFS_DEPRECATED_V2=y
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7# CONFIG_SYSCTL_SYSCALL is not set 7# CONFIG_SYSCTL_SYSCALL is not set
8# CONFIG_EPOLL is not set 8# CONFIG_EPOLL is not set
9# CONFIG_SHMEM is not set 9# CONFIG_SHMEM is not set
diff --git a/arch/arm/configs/at572d940hfek_defconfig b/arch/arm/configs/at572d940hfek_defconfig
index 695e32d4fb58..1b1158ae8f82 100644
--- a/arch/arm/configs/at572d940hfek_defconfig
+++ b/arch/arm/configs/at572d940hfek_defconfig
@@ -17,7 +17,7 @@ CONFIG_SYSFS_DEPRECATED_V2=y
17CONFIG_RELAY=y 17CONFIG_RELAY=y
18CONFIG_BLK_DEV_INITRD=y 18CONFIG_BLK_DEV_INITRD=y
19# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 19# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
20CONFIG_EMBEDDED=y 20CONFIG_EXPERT=y
21CONFIG_SLAB=y 21CONFIG_SLAB=y
22CONFIG_PROFILING=y 22CONFIG_PROFILING=y
23CONFIG_OPROFILE=m 23CONFIG_OPROFILE=m
diff --git a/arch/arm/configs/badge4_defconfig b/arch/arm/configs/badge4_defconfig
index 3a1ad15a779f..5b54abbeb0b3 100644
--- a/arch/arm/configs/badge4_defconfig
+++ b/arch/arm/configs/badge4_defconfig
@@ -1,6 +1,6 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2CONFIG_LOG_BUF_SHIFT=14 2CONFIG_LOG_BUF_SHIFT=14
3CONFIG_EMBEDDED=y 3CONFIG_EXPERT=y
4CONFIG_MODULES=y 4CONFIG_MODULES=y
5CONFIG_MODVERSIONS=y 5CONFIG_MODVERSIONS=y
6CONFIG_ARCH_SA1100=y 6CONFIG_ARCH_SA1100=y
diff --git a/arch/arm/configs/bcmring_defconfig b/arch/arm/configs/bcmring_defconfig
index 75984cd1e233..795374d48f81 100644
--- a/arch/arm/configs/bcmring_defconfig
+++ b/arch/arm/configs/bcmring_defconfig
@@ -2,7 +2,7 @@ CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set 2# CONFIG_LOCALVERSION_AUTO is not set
3# CONFIG_SWAP is not set 3# CONFIG_SWAP is not set
4CONFIG_SYSVIPC=y 4CONFIG_SYSVIPC=y
5CONFIG_EMBEDDED=y 5CONFIG_EXPERT=y
6CONFIG_KALLSYMS_EXTRA_PASS=y 6CONFIG_KALLSYMS_EXTRA_PASS=y
7# CONFIG_HOTPLUG is not set 7# CONFIG_HOTPLUG is not set
8# CONFIG_ELF_CORE is not set 8# CONFIG_ELF_CORE is not set
diff --git a/arch/arm/configs/cm_x2xx_defconfig b/arch/arm/configs/cm_x2xx_defconfig
index dcfbcf3b6c3e..a93ff8da5bab 100644
--- a/arch/arm/configs/cm_x2xx_defconfig
+++ b/arch/arm/configs/cm_x2xx_defconfig
@@ -6,7 +6,7 @@ CONFIG_IKCONFIG_PROC=y
6CONFIG_LOG_BUF_SHIFT=14 6CONFIG_LOG_BUF_SHIFT=14
7CONFIG_SYSFS_DEPRECATED_V2=y 7CONFIG_SYSFS_DEPRECATED_V2=y
8CONFIG_BLK_DEV_INITRD=y 8CONFIG_BLK_DEV_INITRD=y
9CONFIG_EMBEDDED=y 9CONFIG_EXPERT=y
10# CONFIG_VM_EVENT_COUNTERS is not set 10# CONFIG_VM_EVENT_COUNTERS is not set
11# CONFIG_SLUB_DEBUG is not set 11# CONFIG_SLUB_DEBUG is not set
12# CONFIG_COMPAT_BRK is not set 12# CONFIG_COMPAT_BRK is not set
diff --git a/arch/arm/configs/colibri_pxa270_defconfig b/arch/arm/configs/colibri_pxa270_defconfig
index f52c64e36d8d..2ef2c5e8aaec 100644
--- a/arch/arm/configs/colibri_pxa270_defconfig
+++ b/arch/arm/configs/colibri_pxa270_defconfig
@@ -8,7 +8,7 @@ CONFIG_IKCONFIG_PROC=y
8CONFIG_LOG_BUF_SHIFT=14 8CONFIG_LOG_BUF_SHIFT=14
9CONFIG_SYSFS_DEPRECATED_V2=y 9CONFIG_SYSFS_DEPRECATED_V2=y
10CONFIG_BLK_DEV_INITRD=y 10CONFIG_BLK_DEV_INITRD=y
11CONFIG_EMBEDDED=y 11CONFIG_EXPERT=y
12CONFIG_KALLSYMS_EXTRA_PASS=y 12CONFIG_KALLSYMS_EXTRA_PASS=y
13CONFIG_SLAB=y 13CONFIG_SLAB=y
14CONFIG_MODULES=y 14CONFIG_MODULES=y
diff --git a/arch/arm/configs/collie_defconfig b/arch/arm/configs/collie_defconfig
index 310f9a6270be..6c56ad086c7c 100644
--- a/arch/arm/configs/collie_defconfig
+++ b/arch/arm/configs/collie_defconfig
@@ -4,7 +4,7 @@ CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8# CONFIG_BASE_FULL is not set 8# CONFIG_BASE_FULL is not set
9# CONFIG_EPOLL is not set 9# CONFIG_EPOLL is not set
10CONFIG_SLOB=y 10CONFIG_SLOB=y
diff --git a/arch/arm/configs/corgi_defconfig b/arch/arm/configs/corgi_defconfig
index 4a1fa81ed37d..e53c47563845 100644
--- a/arch/arm/configs/corgi_defconfig
+++ b/arch/arm/configs/corgi_defconfig
@@ -4,7 +4,7 @@ CONFIG_BSD_PROCESS_ACCT=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_SYSFS_DEPRECATED_V2=y 5CONFIG_SYSFS_DEPRECATED_V2=y
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8CONFIG_PROFILING=y 8CONFIG_PROFILING=y
9CONFIG_OPROFILE=m 9CONFIG_OPROFILE=m
10CONFIG_MODULES=y 10CONFIG_MODULES=y
diff --git a/arch/arm/configs/da8xx_omapl_defconfig b/arch/arm/configs/da8xx_omapl_defconfig
index cdc40c4b8c48..88ccde058ba4 100644
--- a/arch/arm/configs/da8xx_omapl_defconfig
+++ b/arch/arm/configs/da8xx_omapl_defconfig
@@ -6,7 +6,7 @@ CONFIG_IKCONFIG=y
6CONFIG_IKCONFIG_PROC=y 6CONFIG_IKCONFIG_PROC=y
7CONFIG_LOG_BUF_SHIFT=14 7CONFIG_LOG_BUF_SHIFT=14
8CONFIG_BLK_DEV_INITRD=y 8CONFIG_BLK_DEV_INITRD=y
9CONFIG_EMBEDDED=y 9CONFIG_EXPERT=y
10CONFIG_MODULES=y 10CONFIG_MODULES=y
11CONFIG_MODULE_UNLOAD=y 11CONFIG_MODULE_UNLOAD=y
12CONFIG_MODULE_FORCE_UNLOAD=y 12CONFIG_MODULE_FORCE_UNLOAD=y
diff --git a/arch/arm/configs/davinci_all_defconfig b/arch/arm/configs/davinci_all_defconfig
index 2519cc5a5f8f..889922ad229c 100644
--- a/arch/arm/configs/davinci_all_defconfig
+++ b/arch/arm/configs/davinci_all_defconfig
@@ -6,7 +6,7 @@ CONFIG_IKCONFIG=y
6CONFIG_IKCONFIG_PROC=y 6CONFIG_IKCONFIG_PROC=y
7CONFIG_LOG_BUF_SHIFT=14 7CONFIG_LOG_BUF_SHIFT=14
8CONFIG_BLK_DEV_INITRD=y 8CONFIG_BLK_DEV_INITRD=y
9CONFIG_EMBEDDED=y 9CONFIG_EXPERT=y
10CONFIG_MODULES=y 10CONFIG_MODULES=y
11CONFIG_MODULE_UNLOAD=y 11CONFIG_MODULE_UNLOAD=y
12CONFIG_MODULE_FORCE_UNLOAD=y 12CONFIG_MODULE_FORCE_UNLOAD=y
diff --git a/arch/arm/configs/dove_defconfig b/arch/arm/configs/dove_defconfig
index 9359e1bf32c1..54bf5eec8016 100644
--- a/arch/arm/configs/dove_defconfig
+++ b/arch/arm/configs/dove_defconfig
@@ -1,7 +1,7 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_EMBEDDED=y 4CONFIG_EXPERT=y
5CONFIG_SLAB=y 5CONFIG_SLAB=y
6CONFIG_MODULES=y 6CONFIG_MODULES=y
7CONFIG_MODULE_UNLOAD=y 7CONFIG_MODULE_UNLOAD=y
diff --git a/arch/arm/configs/ebsa110_defconfig b/arch/arm/configs/ebsa110_defconfig
index c3194186920c..14559dbb4c2c 100644
--- a/arch/arm/configs/ebsa110_defconfig
+++ b/arch/arm/configs/ebsa110_defconfig
@@ -2,7 +2,7 @@ CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_BSD_PROCESS_ACCT=y 3CONFIG_BSD_PROCESS_ACCT=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_EMBEDDED=y 5CONFIG_EXPERT=y
6CONFIG_MODULES=y 6CONFIG_MODULES=y
7CONFIG_ARCH_EBSA110=y 7CONFIG_ARCH_EBSA110=y
8CONFIG_PCCARD=m 8CONFIG_PCCARD=m
diff --git a/arch/arm/configs/edb7211_defconfig b/arch/arm/configs/edb7211_defconfig
index 7b62be1561ea..d52ded350a12 100644
--- a/arch/arm/configs/edb7211_defconfig
+++ b/arch/arm/configs/edb7211_defconfig
@@ -2,7 +2,7 @@ CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
5CONFIG_EMBEDDED=y 5CONFIG_EXPERT=y
6# CONFIG_HOTPLUG is not set 6# CONFIG_HOTPLUG is not set
7CONFIG_ARCH_CLPS711X=y 7CONFIG_ARCH_CLPS711X=y
8CONFIG_ARCH_EDB7211=y 8CONFIG_ARCH_EDB7211=y
diff --git a/arch/arm/configs/em_x270_defconfig b/arch/arm/configs/em_x270_defconfig
index d7db34f79702..60a21e01eb70 100644
--- a/arch/arm/configs/em_x270_defconfig
+++ b/arch/arm/configs/em_x270_defconfig
@@ -6,7 +6,7 @@ CONFIG_IKCONFIG_PROC=y
6CONFIG_LOG_BUF_SHIFT=14 6CONFIG_LOG_BUF_SHIFT=14
7CONFIG_SYSFS_DEPRECATED_V2=y 7CONFIG_SYSFS_DEPRECATED_V2=y
8CONFIG_BLK_DEV_INITRD=y 8CONFIG_BLK_DEV_INITRD=y
9CONFIG_EMBEDDED=y 9CONFIG_EXPERT=y
10# CONFIG_VM_EVENT_COUNTERS is not set 10# CONFIG_VM_EVENT_COUNTERS is not set
11# CONFIG_SLUB_DEBUG is not set 11# CONFIG_SLUB_DEBUG is not set
12# CONFIG_COMPAT_BRK is not set 12# CONFIG_COMPAT_BRK is not set
diff --git a/arch/arm/configs/ep93xx_defconfig b/arch/arm/configs/ep93xx_defconfig
index 6d6689cdf398..8e97b2f7ceec 100644
--- a/arch/arm/configs/ep93xx_defconfig
+++ b/arch/arm/configs/ep93xx_defconfig
@@ -4,7 +4,7 @@ CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_SYSFS_DEPRECATED_V2=y 6CONFIG_SYSFS_DEPRECATED_V2=y
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8CONFIG_SLAB=y 8CONFIG_SLAB=y
9CONFIG_MODULES=y 9CONFIG_MODULES=y
10CONFIG_MODULE_UNLOAD=y 10CONFIG_MODULE_UNLOAD=y
diff --git a/arch/arm/configs/eseries_pxa_defconfig b/arch/arm/configs/eseries_pxa_defconfig
index 1691dea582fe..d68ac67c201c 100644
--- a/arch/arm/configs/eseries_pxa_defconfig
+++ b/arch/arm/configs/eseries_pxa_defconfig
@@ -2,7 +2,7 @@ CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 4# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
5CONFIG_EMBEDDED=y 5CONFIG_EXPERT=y
6# CONFIG_KALLSYMS is not set 6# CONFIG_KALLSYMS is not set
7# CONFIG_COMPAT_BRK is not set 7# CONFIG_COMPAT_BRK is not set
8CONFIG_SLAB=y 8CONFIG_SLAB=y
diff --git a/arch/arm/configs/ezx_defconfig b/arch/arm/configs/ezx_defconfig
index c4eeb6d1cbf0..227a477346ed 100644
--- a/arch/arm/configs/ezx_defconfig
+++ b/arch/arm/configs/ezx_defconfig
@@ -7,7 +7,7 @@ CONFIG_SYSFS_DEPRECATED_V2=y
7CONFIG_BLK_DEV_INITRD=y 7CONFIG_BLK_DEV_INITRD=y
8CONFIG_RD_BZIP2=y 8CONFIG_RD_BZIP2=y
9CONFIG_RD_LZMA=y 9CONFIG_RD_LZMA=y
10CONFIG_EMBEDDED=y 10CONFIG_EXPERT=y
11# CONFIG_COMPAT_BRK is not set 11# CONFIG_COMPAT_BRK is not set
12CONFIG_SLAB=y 12CONFIG_SLAB=y
13CONFIG_MODULES=y 13CONFIG_MODULES=y
diff --git a/arch/arm/configs/footbridge_defconfig b/arch/arm/configs/footbridge_defconfig
index 4f925ead2617..038518ab39a8 100644
--- a/arch/arm/configs/footbridge_defconfig
+++ b/arch/arm/configs/footbridge_defconfig
@@ -3,7 +3,7 @@ CONFIG_SYSVIPC=y
3CONFIG_BSD_PROCESS_ACCT=y 3CONFIG_BSD_PROCESS_ACCT=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7# CONFIG_HOTPLUG is not set 7# CONFIG_HOTPLUG is not set
8CONFIG_MODULES=y 8CONFIG_MODULES=y
9CONFIG_ARCH_FOOTBRIDGE=y 9CONFIG_ARCH_FOOTBRIDGE=y
diff --git a/arch/arm/configs/fortunet_defconfig b/arch/arm/configs/fortunet_defconfig
index e11c7eab8ed0..840fced7529f 100644
--- a/arch/arm/configs/fortunet_defconfig
+++ b/arch/arm/configs/fortunet_defconfig
@@ -2,7 +2,7 @@ CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
5CONFIG_EMBEDDED=y 5CONFIG_EXPERT=y
6# CONFIG_HOTPLUG is not set 6# CONFIG_HOTPLUG is not set
7CONFIG_ARCH_CLPS711X=y 7CONFIG_ARCH_CLPS711X=y
8CONFIG_ARCH_FORTUNET=y 8CONFIG_ARCH_FORTUNET=y
diff --git a/arch/arm/configs/h5000_defconfig b/arch/arm/configs/h5000_defconfig
index ac336f10000c..37903e3f0efc 100644
--- a/arch/arm/configs/h5000_defconfig
+++ b/arch/arm/configs/h5000_defconfig
@@ -4,7 +4,7 @@ CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=16 5CONFIG_LOG_BUF_SHIFT=16
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8# CONFIG_UID16 is not set 8# CONFIG_UID16 is not set
9CONFIG_SLAB=y 9CONFIG_SLAB=y
10CONFIG_MODULES=y 10CONFIG_MODULES=y
diff --git a/arch/arm/configs/imote2_defconfig b/arch/arm/configs/imote2_defconfig
index ade55c8c408b..176ec22af034 100644
--- a/arch/arm/configs/imote2_defconfig
+++ b/arch/arm/configs/imote2_defconfig
@@ -6,7 +6,7 @@ CONFIG_SYSFS_DEPRECATED_V2=y
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7CONFIG_RD_BZIP2=y 7CONFIG_RD_BZIP2=y
8CONFIG_RD_LZMA=y 8CONFIG_RD_LZMA=y
9CONFIG_EMBEDDED=y 9CONFIG_EXPERT=y
10# CONFIG_COMPAT_BRK is not set 10# CONFIG_COMPAT_BRK is not set
11CONFIG_SLAB=y 11CONFIG_SLAB=y
12CONFIG_MODULES=y 12CONFIG_MODULES=y
diff --git a/arch/arm/configs/ixp2000_defconfig b/arch/arm/configs/ixp2000_defconfig
index 908324684549..8405aded97a3 100644
--- a/arch/arm/configs/ixp2000_defconfig
+++ b/arch/arm/configs/ixp2000_defconfig
@@ -3,7 +3,7 @@ CONFIG_SYSVIPC=y
3CONFIG_BSD_PROCESS_ACCT=y 3CONFIG_BSD_PROCESS_ACCT=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7# CONFIG_HOTPLUG is not set 7# CONFIG_HOTPLUG is not set
8CONFIG_SLAB=y 8CONFIG_SLAB=y
9CONFIG_MODULES=y 9CONFIG_MODULES=y
diff --git a/arch/arm/configs/ixp23xx_defconfig b/arch/arm/configs/ixp23xx_defconfig
index 7fc056a8569c..688717612e91 100644
--- a/arch/arm/configs/ixp23xx_defconfig
+++ b/arch/arm/configs/ixp23xx_defconfig
@@ -3,7 +3,7 @@ CONFIG_SYSVIPC=y
3CONFIG_BSD_PROCESS_ACCT=y 3CONFIG_BSD_PROCESS_ACCT=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7CONFIG_SLAB=y 7CONFIG_SLAB=y
8CONFIG_MODULES=y 8CONFIG_MODULES=y
9CONFIG_MODULE_UNLOAD=y 9CONFIG_MODULE_UNLOAD=y
diff --git a/arch/arm/configs/ixp4xx_defconfig b/arch/arm/configs/ixp4xx_defconfig
index 5c5023934001..063e2ab2c8f1 100644
--- a/arch/arm/configs/ixp4xx_defconfig
+++ b/arch/arm/configs/ixp4xx_defconfig
@@ -3,7 +3,7 @@ CONFIG_SYSVIPC=y
3CONFIG_BSD_PROCESS_ACCT=y 3CONFIG_BSD_PROCESS_ACCT=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7CONFIG_MODULES=y 7CONFIG_MODULES=y
8CONFIG_MODVERSIONS=y 8CONFIG_MODVERSIONS=y
9# CONFIG_BLK_DEV_BSG is not set 9# CONFIG_BLK_DEV_BSG is not set
diff --git a/arch/arm/configs/loki_defconfig b/arch/arm/configs/loki_defconfig
index e1eaff7f5536..1ba752b2dc6d 100644
--- a/arch/arm/configs/loki_defconfig
+++ b/arch/arm/configs/loki_defconfig
@@ -1,7 +1,7 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_EMBEDDED=y 4CONFIG_EXPERT=y
5CONFIG_SLAB=y 5CONFIG_SLAB=y
6CONFIG_MODULES=y 6CONFIG_MODULES=y
7CONFIG_MODULE_UNLOAD=y 7CONFIG_MODULE_UNLOAD=y
diff --git a/arch/arm/configs/lpd7a400_defconfig b/arch/arm/configs/lpd7a400_defconfig
index 20caaaba4a04..5a48f171204c 100644
--- a/arch/arm/configs/lpd7a400_defconfig
+++ b/arch/arm/configs/lpd7a400_defconfig
@@ -3,7 +3,7 @@ CONFIG_EXPERIMENTAL=y
3CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
4CONFIG_IKCONFIG=y 4CONFIG_IKCONFIG=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7# CONFIG_HOTPLUG is not set 7# CONFIG_HOTPLUG is not set
8# CONFIG_EPOLL is not set 8# CONFIG_EPOLL is not set
9# CONFIG_IOSCHED_DEADLINE is not set 9# CONFIG_IOSCHED_DEADLINE is not set
diff --git a/arch/arm/configs/lpd7a404_defconfig b/arch/arm/configs/lpd7a404_defconfig
index 1efcce97b4a7..22d0631de009 100644
--- a/arch/arm/configs/lpd7a404_defconfig
+++ b/arch/arm/configs/lpd7a404_defconfig
@@ -3,7 +3,7 @@ CONFIG_EXPERIMENTAL=y
3CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
4CONFIG_IKCONFIG=y 4CONFIG_IKCONFIG=y
5CONFIG_LOG_BUF_SHIFT=16 5CONFIG_LOG_BUF_SHIFT=16
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7# CONFIG_HOTPLUG is not set 7# CONFIG_HOTPLUG is not set
8# CONFIG_EPOLL is not set 8# CONFIG_EPOLL is not set
9CONFIG_SLAB=y 9CONFIG_SLAB=y
diff --git a/arch/arm/configs/magician_defconfig b/arch/arm/configs/magician_defconfig
index af805e8fd03d..a88e64d4e9a5 100644
--- a/arch/arm/configs/magician_defconfig
+++ b/arch/arm/configs/magician_defconfig
@@ -4,7 +4,7 @@ CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=16 5CONFIG_LOG_BUF_SHIFT=16
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8# CONFIG_UID16 is not set 8# CONFIG_UID16 is not set
9CONFIG_SLAB=y 9CONFIG_SLAB=y
10CONFIG_MODULES=y 10CONFIG_MODULES=y
diff --git a/arch/arm/configs/mv78xx0_defconfig b/arch/arm/configs/mv78xx0_defconfig
index b0d082422d46..7305ebddb510 100644
--- a/arch/arm/configs/mv78xx0_defconfig
+++ b/arch/arm/configs/mv78xx0_defconfig
@@ -2,7 +2,7 @@ CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_SYSFS_DEPRECATED_V2=y 4CONFIG_SYSFS_DEPRECATED_V2=y
5CONFIG_EMBEDDED=y 5CONFIG_EXPERT=y
6CONFIG_KALLSYMS_ALL=y 6CONFIG_KALLSYMS_ALL=y
7# CONFIG_SLUB_DEBUG is not set 7# CONFIG_SLUB_DEBUG is not set
8CONFIG_PROFILING=y 8CONFIG_PROFILING=y
diff --git a/arch/arm/configs/mx1_defconfig b/arch/arm/configs/mx1_defconfig
index 2f38d9715437..b39b5ced8a10 100644
--- a/arch/arm/configs/mx1_defconfig
+++ b/arch/arm/configs/mx1_defconfig
@@ -4,7 +4,7 @@ CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_SYSFS_DEPRECATED_V2=y 6CONFIG_SYSFS_DEPRECATED_V2=y
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8CONFIG_SLAB=y 8CONFIG_SLAB=y
9CONFIG_MODULES=y 9CONFIG_MODULES=y
10CONFIG_MODULE_UNLOAD=y 10CONFIG_MODULE_UNLOAD=y
diff --git a/arch/arm/configs/mx21_defconfig b/arch/arm/configs/mx21_defconfig
index 6454e18e2abe..411f88dd4402 100644
--- a/arch/arm/configs/mx21_defconfig
+++ b/arch/arm/configs/mx21_defconfig
@@ -4,7 +4,7 @@ CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_SYSFS_DEPRECATED_V2=y 5CONFIG_SYSFS_DEPRECATED_V2=y
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8CONFIG_KALLSYMS_EXTRA_PASS=y 8CONFIG_KALLSYMS_EXTRA_PASS=y
9CONFIG_SLAB=y 9CONFIG_SLAB=y
10CONFIG_MODULES=y 10CONFIG_MODULES=y
diff --git a/arch/arm/configs/mx27_defconfig b/arch/arm/configs/mx27_defconfig
index 813cfb366c18..9ad4c656c9bd 100644
--- a/arch/arm/configs/mx27_defconfig
+++ b/arch/arm/configs/mx27_defconfig
@@ -4,7 +4,7 @@ CONFIG_SYSVIPC=y
4CONFIG_POSIX_MQUEUE=y 4CONFIG_POSIX_MQUEUE=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8CONFIG_KALLSYMS_EXTRA_PASS=y 8CONFIG_KALLSYMS_EXTRA_PASS=y
9# CONFIG_COMPAT_BRK is not set 9# CONFIG_COMPAT_BRK is not set
10CONFIG_SLAB=y 10CONFIG_SLAB=y
diff --git a/arch/arm/configs/mx3_defconfig b/arch/arm/configs/mx3_defconfig
index e648ea3429be..7c4b30b34952 100644
--- a/arch/arm/configs/mx3_defconfig
+++ b/arch/arm/configs/mx3_defconfig
@@ -4,7 +4,7 @@ CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_SYSFS_DEPRECATED_V2=y 6CONFIG_SYSFS_DEPRECATED_V2=y
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8CONFIG_SLAB=y 8CONFIG_SLAB=y
9CONFIG_MODULES=y 9CONFIG_MODULES=y
10CONFIG_MODULE_UNLOAD=y 10CONFIG_MODULE_UNLOAD=y
diff --git a/arch/arm/configs/mx51_defconfig b/arch/arm/configs/mx51_defconfig
index 5c7a87260fab..9cba68cfa51a 100644
--- a/arch/arm/configs/mx51_defconfig
+++ b/arch/arm/configs/mx51_defconfig
@@ -3,7 +3,7 @@ CONFIG_EXPERIMENTAL=y
3CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=18 4CONFIG_LOG_BUF_SHIFT=18
5CONFIG_RELAY=y 5CONFIG_RELAY=y
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7# CONFIG_SLUB_DEBUG is not set 7# CONFIG_SLUB_DEBUG is not set
8# CONFIG_COMPAT_BRK is not set 8# CONFIG_COMPAT_BRK is not set
9CONFIG_MODULES=y 9CONFIG_MODULES=y
diff --git a/arch/arm/configs/nhk8815_defconfig b/arch/arm/configs/nhk8815_defconfig
index 0e2dc26ebe66..37207d1bf44b 100644
--- a/arch/arm/configs/nhk8815_defconfig
+++ b/arch/arm/configs/nhk8815_defconfig
@@ -7,7 +7,7 @@ CONFIG_IKCONFIG_PROC=y
7CONFIG_LOG_BUF_SHIFT=14 7CONFIG_LOG_BUF_SHIFT=14
8CONFIG_SYSFS_DEPRECATED_V2=y 8CONFIG_SYSFS_DEPRECATED_V2=y
9CONFIG_BLK_DEV_INITRD=y 9CONFIG_BLK_DEV_INITRD=y
10CONFIG_EMBEDDED=y 10CONFIG_EXPERT=y
11CONFIG_KALLSYMS_ALL=y 11CONFIG_KALLSYMS_ALL=y
12CONFIG_SLAB=y 12CONFIG_SLAB=y
13CONFIG_MODULES=y 13CONFIG_MODULES=y
diff --git a/arch/arm/configs/omap1_defconfig b/arch/arm/configs/omap1_defconfig
index a350cc6bfe6a..7b63462b349d 100644
--- a/arch/arm/configs/omap1_defconfig
+++ b/arch/arm/configs/omap1_defconfig
@@ -6,7 +6,7 @@ CONFIG_BSD_PROCESS_ACCT=y
6CONFIG_IKCONFIG=y 6CONFIG_IKCONFIG=y
7CONFIG_LOG_BUF_SHIFT=14 7CONFIG_LOG_BUF_SHIFT=14
8CONFIG_BLK_DEV_INITRD=y 8CONFIG_BLK_DEV_INITRD=y
9CONFIG_EMBEDDED=y 9CONFIG_EXPERT=y
10# CONFIG_KALLSYMS is not set 10# CONFIG_KALLSYMS is not set
11# CONFIG_ELF_CORE is not set 11# CONFIG_ELF_CORE is not set
12# CONFIG_BASE_FULL is not set 12# CONFIG_BASE_FULL is not set
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index ccedde1371c3..ae890caa17a7 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -6,7 +6,7 @@ CONFIG_IKCONFIG=y
6CONFIG_IKCONFIG_PROC=y 6CONFIG_IKCONFIG_PROC=y
7CONFIG_LOG_BUF_SHIFT=16 7CONFIG_LOG_BUF_SHIFT=16
8CONFIG_BLK_DEV_INITRD=y 8CONFIG_BLK_DEV_INITRD=y
9CONFIG_EMBEDDED=y 9CONFIG_EXPERT=y
10# CONFIG_SYSCTL_SYSCALL is not set 10# CONFIG_SYSCTL_SYSCALL is not set
11CONFIG_KALLSYMS_EXTRA_PASS=y 11CONFIG_KALLSYMS_EXTRA_PASS=y
12CONFIG_SLAB=y 12CONFIG_SLAB=y
diff --git a/arch/arm/configs/orion5x_defconfig b/arch/arm/configs/orion5x_defconfig
index 439323b3b0ed..a288d7033950 100644
--- a/arch/arm/configs/orion5x_defconfig
+++ b/arch/arm/configs/orion5x_defconfig
@@ -2,7 +2,7 @@ CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_SYSFS_DEPRECATED_V2=y 4CONFIG_SYSFS_DEPRECATED_V2=y
5CONFIG_EMBEDDED=y 5CONFIG_EXPERT=y
6# CONFIG_SLUB_DEBUG is not set 6# CONFIG_SLUB_DEBUG is not set
7CONFIG_PROFILING=y 7CONFIG_PROFILING=y
8CONFIG_OPROFILE=y 8CONFIG_OPROFILE=y
diff --git a/arch/arm/configs/pcm027_defconfig b/arch/arm/configs/pcm027_defconfig
index 583a0610bd00..2f136c30a989 100644
--- a/arch/arm/configs/pcm027_defconfig
+++ b/arch/arm/configs/pcm027_defconfig
@@ -7,7 +7,7 @@ CONFIG_IKCONFIG=y
7CONFIG_IKCONFIG_PROC=y 7CONFIG_IKCONFIG_PROC=y
8CONFIG_LOG_BUF_SHIFT=14 8CONFIG_LOG_BUF_SHIFT=14
9# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 9# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
10CONFIG_EMBEDDED=y 10CONFIG_EXPERT=y
11# CONFIG_KALLSYMS is not set 11# CONFIG_KALLSYMS is not set
12CONFIG_SLAB=y 12CONFIG_SLAB=y
13CONFIG_MODULES=y 13CONFIG_MODULES=y
diff --git a/arch/arm/configs/pcontrol_g20_defconfig b/arch/arm/configs/pcontrol_g20_defconfig
index b42ee62c4d77..c75c9fcede58 100644
--- a/arch/arm/configs/pcontrol_g20_defconfig
+++ b/arch/arm/configs/pcontrol_g20_defconfig
@@ -10,7 +10,7 @@ CONFIG_IKCONFIG_PROC=y
10CONFIG_LOG_BUF_SHIFT=14 10CONFIG_LOG_BUF_SHIFT=14
11CONFIG_NAMESPACES=y 11CONFIG_NAMESPACES=y
12CONFIG_BLK_DEV_INITRD=y 12CONFIG_BLK_DEV_INITRD=y
13CONFIG_EMBEDDED=y 13CONFIG_EXPERT=y
14# CONFIG_SYSCTL_SYSCALL is not set 14# CONFIG_SYSCTL_SYSCALL is not set
15# CONFIG_KALLSYMS is not set 15# CONFIG_KALLSYMS is not set
16# CONFIG_VM_EVENT_COUNTERS is not set 16# CONFIG_VM_EVENT_COUNTERS is not set
diff --git a/arch/arm/configs/pleb_defconfig b/arch/arm/configs/pleb_defconfig
index d1efbdc1e6dc..cb08cc561da5 100644
--- a/arch/arm/configs/pleb_defconfig
+++ b/arch/arm/configs/pleb_defconfig
@@ -3,7 +3,7 @@ CONFIG_EXPERIMENTAL=y
3CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7# CONFIG_HOTPLUG is not set 7# CONFIG_HOTPLUG is not set
8# CONFIG_SHMEM is not set 8# CONFIG_SHMEM is not set
9CONFIG_MODULES=y 9CONFIG_MODULES=y
diff --git a/arch/arm/configs/pnx4008_defconfig b/arch/arm/configs/pnx4008_defconfig
index bd481f04276f..35a31ccacc32 100644
--- a/arch/arm/configs/pnx4008_defconfig
+++ b/arch/arm/configs/pnx4008_defconfig
@@ -5,7 +5,7 @@ CONFIG_BSD_PROCESS_ACCT=y
5CONFIG_AUDIT=y 5CONFIG_AUDIT=y
6CONFIG_LOG_BUF_SHIFT=14 6CONFIG_LOG_BUF_SHIFT=14
7CONFIG_BLK_DEV_INITRD=y 7CONFIG_BLK_DEV_INITRD=y
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9CONFIG_SLAB=y 9CONFIG_SLAB=y
10CONFIG_MODULES=y 10CONFIG_MODULES=y
11CONFIG_MODULE_UNLOAD=y 11CONFIG_MODULE_UNLOAD=y
diff --git a/arch/arm/configs/simpad_defconfig b/arch/arm/configs/simpad_defconfig
index af3b12e3b464..d3358155bf8a 100644
--- a/arch/arm/configs/simpad_defconfig
+++ b/arch/arm/configs/simpad_defconfig
@@ -2,7 +2,7 @@ CONFIG_EXPERIMENTAL=y
2CONFIG_LOCALVERSION="oe1" 2CONFIG_LOCALVERSION="oe1"
3CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_EMBEDDED=y 5CONFIG_EXPERT=y
6CONFIG_KALLSYMS_ALL=y 6CONFIG_KALLSYMS_ALL=y
7CONFIG_KALLSYMS_EXTRA_PASS=y 7CONFIG_KALLSYMS_EXTRA_PASS=y
8CONFIG_MODULES=y 8CONFIG_MODULES=y
diff --git a/arch/arm/configs/spitz_defconfig b/arch/arm/configs/spitz_defconfig
index aebd4bb0ad01..70158273c6dd 100644
--- a/arch/arm/configs/spitz_defconfig
+++ b/arch/arm/configs/spitz_defconfig
@@ -4,7 +4,7 @@ CONFIG_BSD_PROCESS_ACCT=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_SYSFS_DEPRECATED_V2=y 5CONFIG_SYSFS_DEPRECATED_V2=y
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8CONFIG_PROFILING=y 8CONFIG_PROFILING=y
9CONFIG_OPROFILE=m 9CONFIG_OPROFILE=m
10CONFIG_MODULES=y 10CONFIG_MODULES=y
diff --git a/arch/arm/configs/stmp378x_defconfig b/arch/arm/configs/stmp378x_defconfig
index 94a2d904bf94..1079c2b6eb3a 100644
--- a/arch/arm/configs/stmp378x_defconfig
+++ b/arch/arm/configs/stmp378x_defconfig
@@ -5,7 +5,7 @@ CONFIG_POSIX_MQUEUE=y
5CONFIG_BSD_PROCESS_ACCT=y 5CONFIG_BSD_PROCESS_ACCT=y
6CONFIG_SYSFS_DEPRECATED_V2=y 6CONFIG_SYSFS_DEPRECATED_V2=y
7CONFIG_BLK_DEV_INITRD=y 7CONFIG_BLK_DEV_INITRD=y
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9CONFIG_SLAB=y 9CONFIG_SLAB=y
10CONFIG_MODULES=y 10CONFIG_MODULES=y
11CONFIG_MODULE_UNLOAD=y 11CONFIG_MODULE_UNLOAD=y
diff --git a/arch/arm/configs/stmp37xx_defconfig b/arch/arm/configs/stmp37xx_defconfig
index d8ee58cfa872..564a5cc44085 100644
--- a/arch/arm/configs/stmp37xx_defconfig
+++ b/arch/arm/configs/stmp37xx_defconfig
@@ -5,7 +5,7 @@ CONFIG_POSIX_MQUEUE=y
5CONFIG_BSD_PROCESS_ACCT=y 5CONFIG_BSD_PROCESS_ACCT=y
6CONFIG_SYSFS_DEPRECATED_V2=y 6CONFIG_SYSFS_DEPRECATED_V2=y
7CONFIG_BLK_DEV_INITRD=y 7CONFIG_BLK_DEV_INITRD=y
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9CONFIG_SLAB=y 9CONFIG_SLAB=y
10CONFIG_MODULES=y 10CONFIG_MODULES=y
11CONFIG_MODULE_UNLOAD=y 11CONFIG_MODULE_UNLOAD=y
diff --git a/arch/arm/configs/tct_hammer_defconfig b/arch/arm/configs/tct_hammer_defconfig
index e89ca19489c2..95c0f0d63db6 100644
--- a/arch/arm/configs/tct_hammer_defconfig
+++ b/arch/arm/configs/tct_hammer_defconfig
@@ -5,7 +5,7 @@ CONFIG_SYSVIPC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_SYSFS_DEPRECATED_V2=y 6CONFIG_SYSFS_DEPRECATED_V2=y
7CONFIG_BLK_DEV_INITRD=y 7CONFIG_BLK_DEV_INITRD=y
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9# CONFIG_KALLSYMS is not set 9# CONFIG_KALLSYMS is not set
10# CONFIG_BUG is not set 10# CONFIG_BUG is not set
11# CONFIG_ELF_CORE is not set 11# CONFIG_ELF_CORE is not set
diff --git a/arch/arm/configs/trizeps4_defconfig b/arch/arm/configs/trizeps4_defconfig
index 37f48342827c..3162173fa75a 100644
--- a/arch/arm/configs/trizeps4_defconfig
+++ b/arch/arm/configs/trizeps4_defconfig
@@ -7,7 +7,7 @@ CONFIG_IKCONFIG=y
7CONFIG_IKCONFIG_PROC=y 7CONFIG_IKCONFIG_PROC=y
8CONFIG_LOG_BUF_SHIFT=14 8CONFIG_LOG_BUF_SHIFT=14
9CONFIG_BLK_DEV_INITRD=y 9CONFIG_BLK_DEV_INITRD=y
10CONFIG_EMBEDDED=y 10CONFIG_EXPERT=y
11CONFIG_KALLSYMS_EXTRA_PASS=y 11CONFIG_KALLSYMS_EXTRA_PASS=y
12CONFIG_SLAB=y 12CONFIG_SLAB=y
13CONFIG_MODULES=y 13CONFIG_MODULES=y
diff --git a/arch/arm/configs/u300_defconfig b/arch/arm/configs/u300_defconfig
index c1c252cdca60..4a5a12681be2 100644
--- a/arch/arm/configs/u300_defconfig
+++ b/arch/arm/configs/u300_defconfig
@@ -3,7 +3,7 @@ CONFIG_EXPERIMENTAL=y
3# CONFIG_SWAP is not set 3# CONFIG_SWAP is not set
4CONFIG_SYSVIPC=y 4CONFIG_SYSVIPC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7# CONFIG_AIO is not set 7# CONFIG_AIO is not set
8# CONFIG_VM_EVENT_COUNTERS is not set 8# CONFIG_VM_EVENT_COUNTERS is not set
9CONFIG_MODULES=y 9CONFIG_MODULES=y
diff --git a/arch/arm/configs/viper_defconfig b/arch/arm/configs/viper_defconfig
index 9d7bf5e0d0f5..8b0c717378fa 100644
--- a/arch/arm/configs/viper_defconfig
+++ b/arch/arm/configs/viper_defconfig
@@ -3,7 +3,7 @@ CONFIG_EXPERIMENTAL=y
3CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=13 4CONFIG_LOG_BUF_SHIFT=13
5CONFIG_SYSFS_DEPRECATED_V2=y 5CONFIG_SYSFS_DEPRECATED_V2=y
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7# CONFIG_ELF_CORE is not set 7# CONFIG_ELF_CORE is not set
8# CONFIG_SHMEM is not set 8# CONFIG_SHMEM is not set
9CONFIG_SLAB=y 9CONFIG_SLAB=y
diff --git a/arch/arm/configs/xcep_defconfig b/arch/arm/configs/xcep_defconfig
index 70d47dbae6db..5b5504143647 100644
--- a/arch/arm/configs/xcep_defconfig
+++ b/arch/arm/configs/xcep_defconfig
@@ -8,7 +8,7 @@ CONFIG_IKCONFIG_PROC=y
8CONFIG_LOG_BUF_SHIFT=16 8CONFIG_LOG_BUF_SHIFT=16
9CONFIG_SYSFS_DEPRECATED_V2=y 9CONFIG_SYSFS_DEPRECATED_V2=y
10CONFIG_BLK_DEV_INITRD=y 10CONFIG_BLK_DEV_INITRD=y
11CONFIG_EMBEDDED=y 11CONFIG_EXPERT=y
12# CONFIG_UID16 is not set 12# CONFIG_UID16 is not set
13# CONFIG_SHMEM is not set 13# CONFIG_SHMEM is not set
14# CONFIG_VM_EVENT_COUNTERS is not set 14# CONFIG_VM_EVENT_COUNTERS is not set
diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c
index 2e8391307f55..6dde8185205f 100644
--- a/arch/arm/mach-msm/board-qsd8x50.c
+++ b/arch/arm/mach-msm/board-qsd8x50.c
@@ -43,7 +43,7 @@ static const unsigned qsd8x50_surf_smc91x_gpio __initdata = 156;
43 * at run-time: they vary from board to board, and the true 43 * at run-time: they vary from board to board, and the true
44 * configuration won't be known until boot. 44 * configuration won't be known until boot.
45 */ 45 */
46static struct resource smc91x_resources[] __initdata = { 46static struct resource smc91x_resources[] = {
47 [0] = { 47 [0] = {
48 .flags = IORESOURCE_MEM, 48 .flags = IORESOURCE_MEM,
49 }, 49 },
@@ -52,7 +52,7 @@ static struct resource smc91x_resources[] __initdata = {
52 }, 52 },
53}; 53};
54 54
55static struct platform_device smc91x_device __initdata = { 55static struct platform_device smc91x_device = {
56 .name = "smc91x", 56 .name = "smc91x",
57 .id = 0, 57 .id = 0,
58 .num_resources = ARRAY_SIZE(smc91x_resources), 58 .num_resources = ARRAY_SIZE(smc91x_resources),
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig
index 313b13073c54..cd2062fe0f61 100644
--- a/arch/avr32/Kconfig
+++ b/arch/avr32/Kconfig
@@ -1,8 +1,8 @@
1config AVR32 1config AVR32
2 def_bool y 2 def_bool y
3 # With EMBEDDED=n, we get lots of stuff automatically selected 3 # With EXPERT=n, we get lots of stuff automatically selected
4 # that we usually don't need on AVR32. 4 # that we usually don't need on AVR32.
5 select EMBEDDED 5 select EXPERT
6 select HAVE_CLK 6 select HAVE_CLK
7 select HAVE_OPROFILE 7 select HAVE_OPROFILE
8 select HAVE_KPROBES 8 select HAVE_KPROBES
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index 0a221d48152d..c09577ddc3c5 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -30,6 +30,9 @@ config BLACKFIN
30 select HAVE_KERNEL_LZO if RAMKERNEL 30 select HAVE_KERNEL_LZO if RAMKERNEL
31 select HAVE_OPROFILE 31 select HAVE_OPROFILE
32 select ARCH_WANT_OPTIONAL_GPIOLIB 32 select ARCH_WANT_OPTIONAL_GPIOLIB
33 select HAVE_GENERIC_HARDIRQS
34 select GENERIC_IRQ_PROBE
35 select IRQ_PER_CPU if SMP
33 36
34config GENERIC_CSUM 37config GENERIC_CSUM
35 def_bool y 38 def_bool y
@@ -44,15 +47,6 @@ config ZONE_DMA
44config GENERIC_FIND_NEXT_BIT 47config GENERIC_FIND_NEXT_BIT
45 def_bool y 48 def_bool y
46 49
47config GENERIC_HARDIRQS
48 def_bool y
49
50config GENERIC_IRQ_PROBE
51 def_bool y
52
53config GENERIC_HARDIRQS_NO__DO_IRQ
54 def_bool y
55
56config GENERIC_GPIO 50config GENERIC_GPIO
57 def_bool y 51 def_bool y
58 52
@@ -254,11 +248,6 @@ config HOTPLUG_CPU
254 depends on SMP && HOTPLUG 248 depends on SMP && HOTPLUG
255 default y 249 default y
256 250
257config IRQ_PER_CPU
258 bool
259 depends on SMP
260 default y
261
262config HAVE_LEGACY_PER_CPU_AREA 251config HAVE_LEGACY_PER_CPU_AREA
263 def_bool y 252 def_bool y
264 depends on SMP 253 depends on SMP
diff --git a/arch/blackfin/configs/BF518F-EZBRD_defconfig b/arch/blackfin/configs/BF518F-EZBRD_defconfig
index c0b988ee30df..db8d38a12a9a 100644
--- a/arch/blackfin/configs/BF518F-EZBRD_defconfig
+++ b/arch/blackfin/configs/BF518F-EZBRD_defconfig
@@ -5,7 +5,7 @@ CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9# CONFIG_SYSCTL_SYSCALL is not set 9# CONFIG_SYSCTL_SYSCALL is not set
10# CONFIG_ELF_CORE is not set 10# CONFIG_ELF_CORE is not set
11# CONFIG_FUTEX is not set 11# CONFIG_FUTEX is not set
diff --git a/arch/blackfin/configs/BF526-EZBRD_defconfig b/arch/blackfin/configs/BF526-EZBRD_defconfig
index 864af5b68874..3e50d7857c27 100644
--- a/arch/blackfin/configs/BF526-EZBRD_defconfig
+++ b/arch/blackfin/configs/BF526-EZBRD_defconfig
@@ -5,7 +5,7 @@ CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9# CONFIG_SYSCTL_SYSCALL is not set 9# CONFIG_SYSCTL_SYSCALL is not set
10# CONFIG_ELF_CORE is not set 10# CONFIG_ELF_CORE is not set
11# CONFIG_FUTEX is not set 11# CONFIG_FUTEX is not set
diff --git a/arch/blackfin/configs/BF527-AD7160-EVAL_defconfig b/arch/blackfin/configs/BF527-AD7160-EVAL_defconfig
index 7b6a3370dbe2..362f59dd5228 100644
--- a/arch/blackfin/configs/BF527-AD7160-EVAL_defconfig
+++ b/arch/blackfin/configs/BF527-AD7160-EVAL_defconfig
@@ -5,7 +5,7 @@ CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9# CONFIG_ELF_CORE is not set 9# CONFIG_ELF_CORE is not set
10# CONFIG_AIO is not set 10# CONFIG_AIO is not set
11CONFIG_SLAB=y 11CONFIG_SLAB=y
diff --git a/arch/blackfin/configs/BF527-EZKIT-V2_defconfig b/arch/blackfin/configs/BF527-EZKIT-V2_defconfig
index 4faa6b46a352..023ff0df2692 100644
--- a/arch/blackfin/configs/BF527-EZKIT-V2_defconfig
+++ b/arch/blackfin/configs/BF527-EZKIT-V2_defconfig
@@ -5,7 +5,7 @@ CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9# CONFIG_SYSCTL_SYSCALL is not set 9# CONFIG_SYSCTL_SYSCALL is not set
10# CONFIG_ELF_CORE is not set 10# CONFIG_ELF_CORE is not set
11# CONFIG_FUTEX is not set 11# CONFIG_FUTEX is not set
diff --git a/arch/blackfin/configs/BF527-EZKIT_defconfig b/arch/blackfin/configs/BF527-EZKIT_defconfig
index 9d893eb68243..4e5a121b3c56 100644
--- a/arch/blackfin/configs/BF527-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF527-EZKIT_defconfig
@@ -5,7 +5,7 @@ CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9# CONFIG_SYSCTL_SYSCALL is not set 9# CONFIG_SYSCTL_SYSCALL is not set
10# CONFIG_ELF_CORE is not set 10# CONFIG_ELF_CORE is not set
11# CONFIG_FUTEX is not set 11# CONFIG_FUTEX is not set
diff --git a/arch/blackfin/configs/BF527-TLL6527M_defconfig b/arch/blackfin/configs/BF527-TLL6527M_defconfig
index 97a2767c80f8..cd0636bb24a0 100644
--- a/arch/blackfin/configs/BF527-TLL6527M_defconfig
+++ b/arch/blackfin/configs/BF527-TLL6527M_defconfig
@@ -6,7 +6,7 @@ CONFIG_IKCONFIG_PROC=y
6CONFIG_LOG_BUF_SHIFT=14 6CONFIG_LOG_BUF_SHIFT=14
7CONFIG_BLK_DEV_INITRD=y 7CONFIG_BLK_DEV_INITRD=y
8# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 8# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
9CONFIG_EMBEDDED=y 9CONFIG_EXPERT=y
10# CONFIG_SYSCTL_SYSCALL is not set 10# CONFIG_SYSCTL_SYSCALL is not set
11# CONFIG_ELF_CORE is not set 11# CONFIG_ELF_CORE is not set
12# CONFIG_FUTEX is not set 12# CONFIG_FUTEX is not set
diff --git a/arch/blackfin/configs/BF533-EZKIT_defconfig b/arch/blackfin/configs/BF533-EZKIT_defconfig
index f84774360c5b..9f8fc84e4ac9 100644
--- a/arch/blackfin/configs/BF533-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF533-EZKIT_defconfig
@@ -5,7 +5,7 @@ CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9# CONFIG_SYSCTL_SYSCALL is not set 9# CONFIG_SYSCTL_SYSCALL is not set
10# CONFIG_ELF_CORE is not set 10# CONFIG_ELF_CORE is not set
11# CONFIG_FUTEX is not set 11# CONFIG_FUTEX is not set
diff --git a/arch/blackfin/configs/BF533-STAMP_defconfig b/arch/blackfin/configs/BF533-STAMP_defconfig
index 0e7262c04cc2..ccc432b722a0 100644
--- a/arch/blackfin/configs/BF533-STAMP_defconfig
+++ b/arch/blackfin/configs/BF533-STAMP_defconfig
@@ -5,7 +5,7 @@ CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9# CONFIG_SYSCTL_SYSCALL is not set 9# CONFIG_SYSCTL_SYSCALL is not set
10# CONFIG_ELF_CORE is not set 10# CONFIG_ELF_CORE is not set
11# CONFIG_FUTEX is not set 11# CONFIG_FUTEX is not set
diff --git a/arch/blackfin/configs/BF537-STAMP_defconfig b/arch/blackfin/configs/BF537-STAMP_defconfig
index 4d14a002e7bd..566695472a84 100644
--- a/arch/blackfin/configs/BF537-STAMP_defconfig
+++ b/arch/blackfin/configs/BF537-STAMP_defconfig
@@ -5,7 +5,7 @@ CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9# CONFIG_SYSCTL_SYSCALL is not set 9# CONFIG_SYSCTL_SYSCALL is not set
10# CONFIG_ELF_CORE is not set 10# CONFIG_ELF_CORE is not set
11# CONFIG_FUTEX is not set 11# CONFIG_FUTEX is not set
diff --git a/arch/blackfin/configs/BF538-EZKIT_defconfig b/arch/blackfin/configs/BF538-EZKIT_defconfig
index fbee9d776f56..ac22124ccb6c 100644
--- a/arch/blackfin/configs/BF538-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF538-EZKIT_defconfig
@@ -5,7 +5,7 @@ CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9# CONFIG_SYSCTL_SYSCALL is not set 9# CONFIG_SYSCTL_SYSCALL is not set
10# CONFIG_ELF_CORE is not set 10# CONFIG_ELF_CORE is not set
11# CONFIG_FUTEX is not set 11# CONFIG_FUTEX is not set
diff --git a/arch/blackfin/configs/BF548-EZKIT_defconfig b/arch/blackfin/configs/BF548-EZKIT_defconfig
index 05dd11db2f7d..944404b6ff08 100644
--- a/arch/blackfin/configs/BF548-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF548-EZKIT_defconfig
@@ -5,7 +5,7 @@ CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9# CONFIG_SYSCTL_SYSCALL is not set 9# CONFIG_SYSCTL_SYSCALL is not set
10# CONFIG_ELF_CORE is not set 10# CONFIG_ELF_CORE is not set
11# CONFIG_FUTEX is not set 11# CONFIG_FUTEX is not set
diff --git a/arch/blackfin/configs/BF561-ACVILON_defconfig b/arch/blackfin/configs/BF561-ACVILON_defconfig
index bcb14d1c5664..b7c8451f26ac 100644
--- a/arch/blackfin/configs/BF561-ACVILON_defconfig
+++ b/arch/blackfin/configs/BF561-ACVILON_defconfig
@@ -5,7 +5,7 @@ CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_SYSFS_DEPRECATED_V2=y 6CONFIG_SYSFS_DEPRECATED_V2=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9# CONFIG_SYSCTL_SYSCALL is not set 9# CONFIG_SYSCTL_SYSCALL is not set
10# CONFIG_ELF_CORE is not set 10# CONFIG_ELF_CORE is not set
11# CONFIG_FUTEX is not set 11# CONFIG_FUTEX is not set
diff --git a/arch/blackfin/configs/BF561-EZKIT-SMP_defconfig b/arch/blackfin/configs/BF561-EZKIT-SMP_defconfig
index 4cf451024fd8..7e67ba31e991 100644
--- a/arch/blackfin/configs/BF561-EZKIT-SMP_defconfig
+++ b/arch/blackfin/configs/BF561-EZKIT-SMP_defconfig
@@ -5,7 +5,7 @@ CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9# CONFIG_SYSCTL_SYSCALL is not set 9# CONFIG_SYSCTL_SYSCALL is not set
10# CONFIG_ELF_CORE is not set 10# CONFIG_ELF_CORE is not set
11# CONFIG_FUTEX is not set 11# CONFIG_FUTEX is not set
diff --git a/arch/blackfin/configs/BF561-EZKIT_defconfig b/arch/blackfin/configs/BF561-EZKIT_defconfig
index 843aaa54a9e3..141e5933e1aa 100644
--- a/arch/blackfin/configs/BF561-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF561-EZKIT_defconfig
@@ -5,7 +5,7 @@ CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9# CONFIG_SYSCTL_SYSCALL is not set 9# CONFIG_SYSCTL_SYSCALL is not set
10# CONFIG_ELF_CORE is not set 10# CONFIG_ELF_CORE is not set
11# CONFIG_FUTEX is not set 11# CONFIG_FUTEX is not set
diff --git a/arch/blackfin/configs/BlackStamp_defconfig b/arch/blackfin/configs/BlackStamp_defconfig
index dae7adf3b2a2..97ebe09a7370 100644
--- a/arch/blackfin/configs/BlackStamp_defconfig
+++ b/arch/blackfin/configs/BlackStamp_defconfig
@@ -6,7 +6,7 @@ CONFIG_LOG_BUF_SHIFT=14
6CONFIG_SYSFS_DEPRECATED_V2=y 6CONFIG_SYSFS_DEPRECATED_V2=y
7CONFIG_BLK_DEV_INITRD=y 7CONFIG_BLK_DEV_INITRD=y
8# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 8# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
9CONFIG_EMBEDDED=y 9CONFIG_EXPERT=y
10# CONFIG_SYSCTL_SYSCALL is not set 10# CONFIG_SYSCTL_SYSCALL is not set
11# CONFIG_ELF_CORE is not set 11# CONFIG_ELF_CORE is not set
12# CONFIG_FUTEX is not set 12# CONFIG_FUTEX is not set
diff --git a/arch/blackfin/configs/CM-BF527_defconfig b/arch/blackfin/configs/CM-BF527_defconfig
index f3414244bfed..c2457543e58c 100644
--- a/arch/blackfin/configs/CM-BF527_defconfig
+++ b/arch/blackfin/configs/CM-BF527_defconfig
@@ -8,7 +8,7 @@ CONFIG_BLK_DEV_INITRD=y
8# CONFIG_RD_GZIP is not set 8# CONFIG_RD_GZIP is not set
9CONFIG_RD_LZMA=y 9CONFIG_RD_LZMA=y
10# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 10# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
11CONFIG_EMBEDDED=y 11CONFIG_EXPERT=y
12# CONFIG_SYSCTL_SYSCALL is not set 12# CONFIG_SYSCTL_SYSCALL is not set
13# CONFIG_ELF_CORE is not set 13# CONFIG_ELF_CORE is not set
14# CONFIG_FUTEX is not set 14# CONFIG_FUTEX is not set
diff --git a/arch/blackfin/configs/CM-BF533_defconfig b/arch/blackfin/configs/CM-BF533_defconfig
index 8c7e08f173d4..baf1c1573e5e 100644
--- a/arch/blackfin/configs/CM-BF533_defconfig
+++ b/arch/blackfin/configs/CM-BF533_defconfig
@@ -7,7 +7,7 @@ CONFIG_LOG_BUF_SHIFT=14
7CONFIG_BLK_DEV_INITRD=y 7CONFIG_BLK_DEV_INITRD=y
8# CONFIG_RD_GZIP is not set 8# CONFIG_RD_GZIP is not set
9CONFIG_RD_LZMA=y 9CONFIG_RD_LZMA=y
10CONFIG_EMBEDDED=y 10CONFIG_EXPERT=y
11# CONFIG_UID16 is not set 11# CONFIG_UID16 is not set
12# CONFIG_SYSCTL_SYSCALL is not set 12# CONFIG_SYSCTL_SYSCALL is not set
13# CONFIG_ELF_CORE is not set 13# CONFIG_ELF_CORE is not set
diff --git a/arch/blackfin/configs/CM-BF537E_defconfig b/arch/blackfin/configs/CM-BF537E_defconfig
index bd3cb766d078..707cbf8a2590 100644
--- a/arch/blackfin/configs/CM-BF537E_defconfig
+++ b/arch/blackfin/configs/CM-BF537E_defconfig
@@ -8,7 +8,7 @@ CONFIG_BLK_DEV_INITRD=y
8# CONFIG_RD_GZIP is not set 8# CONFIG_RD_GZIP is not set
9CONFIG_RD_LZMA=y 9CONFIG_RD_LZMA=y
10# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 10# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
11CONFIG_EMBEDDED=y 11CONFIG_EXPERT=y
12# CONFIG_UID16 is not set 12# CONFIG_UID16 is not set
13# CONFIG_SYSCTL_SYSCALL is not set 13# CONFIG_SYSCTL_SYSCALL is not set
14# CONFIG_ELF_CORE is not set 14# CONFIG_ELF_CORE is not set
diff --git a/arch/blackfin/configs/CM-BF537U_defconfig b/arch/blackfin/configs/CM-BF537U_defconfig
index 82224f37c04e..4596935eadac 100644
--- a/arch/blackfin/configs/CM-BF537U_defconfig
+++ b/arch/blackfin/configs/CM-BF537U_defconfig
@@ -8,7 +8,7 @@ CONFIG_BLK_DEV_INITRD=y
8# CONFIG_RD_GZIP is not set 8# CONFIG_RD_GZIP is not set
9CONFIG_RD_LZMA=y 9CONFIG_RD_LZMA=y
10# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 10# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
11CONFIG_EMBEDDED=y 11CONFIG_EXPERT=y
12# CONFIG_UID16 is not set 12# CONFIG_UID16 is not set
13# CONFIG_SYSCTL_SYSCALL is not set 13# CONFIG_SYSCTL_SYSCALL is not set
14# CONFIG_ELF_CORE is not set 14# CONFIG_ELF_CORE is not set
diff --git a/arch/blackfin/configs/CM-BF548_defconfig b/arch/blackfin/configs/CM-BF548_defconfig
index 433598c6e773..df267588efec 100644
--- a/arch/blackfin/configs/CM-BF548_defconfig
+++ b/arch/blackfin/configs/CM-BF548_defconfig
@@ -8,7 +8,7 @@ CONFIG_BLK_DEV_INITRD=y
8# CONFIG_RD_GZIP is not set 8# CONFIG_RD_GZIP is not set
9CONFIG_RD_LZMA=y 9CONFIG_RD_LZMA=y
10# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 10# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
11CONFIG_EMBEDDED=y 11CONFIG_EXPERT=y
12# CONFIG_UID16 is not set 12# CONFIG_UID16 is not set
13# CONFIG_SYSCTL_SYSCALL is not set 13# CONFIG_SYSCTL_SYSCALL is not set
14# CONFIG_ELF_CORE is not set 14# CONFIG_ELF_CORE is not set
diff --git a/arch/blackfin/configs/CM-BF561_defconfig b/arch/blackfin/configs/CM-BF561_defconfig
index ded7d845cb39..6c7b21585a43 100644
--- a/arch/blackfin/configs/CM-BF561_defconfig
+++ b/arch/blackfin/configs/CM-BF561_defconfig
@@ -8,7 +8,7 @@ CONFIG_BLK_DEV_INITRD=y
8# CONFIG_RD_GZIP is not set 8# CONFIG_RD_GZIP is not set
9CONFIG_RD_LZMA=y 9CONFIG_RD_LZMA=y
10# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 10# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
11CONFIG_EMBEDDED=y 11CONFIG_EXPERT=y
12# CONFIG_UID16 is not set 12# CONFIG_UID16 is not set
13# CONFIG_SYSCTL_SYSCALL is not set 13# CONFIG_SYSCTL_SYSCALL is not set
14# CONFIG_ELF_CORE is not set 14# CONFIG_ELF_CORE is not set
diff --git a/arch/blackfin/configs/DNP5370_defconfig b/arch/blackfin/configs/DNP5370_defconfig
index 0ebc7d9aa426..f50313657f3e 100644
--- a/arch/blackfin/configs/DNP5370_defconfig
+++ b/arch/blackfin/configs/DNP5370_defconfig
@@ -5,7 +5,7 @@ CONFIG_IKCONFIG=y
5CONFIG_IKCONFIG_PROC=y 5CONFIG_IKCONFIG_PROC=y
6CONFIG_LOG_BUF_SHIFT=14 6CONFIG_LOG_BUF_SHIFT=14
7CONFIG_BLK_DEV_INITRD=y 7CONFIG_BLK_DEV_INITRD=y
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9CONFIG_SLOB=y 9CONFIG_SLOB=y
10# CONFIG_BLK_DEV_BSG is not set 10# CONFIG_BLK_DEV_BSG is not set
11# CONFIG_IOSCHED_CFQ is not set 11# CONFIG_IOSCHED_CFQ is not set
diff --git a/arch/blackfin/configs/H8606_defconfig b/arch/blackfin/configs/H8606_defconfig
index 700fb701c121..7450127b6455 100644
--- a/arch/blackfin/configs/H8606_defconfig
+++ b/arch/blackfin/configs/H8606_defconfig
@@ -2,7 +2,7 @@ CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 4# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
5CONFIG_EMBEDDED=y 5CONFIG_EXPERT=y
6# CONFIG_SYSCTL_SYSCALL is not set 6# CONFIG_SYSCTL_SYSCALL is not set
7# CONFIG_ELF_CORE is not set 7# CONFIG_ELF_CORE is not set
8# CONFIG_FUTEX is not set 8# CONFIG_FUTEX is not set
diff --git a/arch/blackfin/configs/IP0X_defconfig b/arch/blackfin/configs/IP0X_defconfig
index b40156d217e3..5e797cf72043 100644
--- a/arch/blackfin/configs/IP0X_defconfig
+++ b/arch/blackfin/configs/IP0X_defconfig
@@ -3,7 +3,7 @@ CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7# CONFIG_SYSCTL_SYSCALL is not set 7# CONFIG_SYSCTL_SYSCALL is not set
8# CONFIG_HOTPLUG is not set 8# CONFIG_HOTPLUG is not set
9# CONFIG_ELF_CORE is not set 9# CONFIG_ELF_CORE is not set
diff --git a/arch/blackfin/configs/PNAV-10_defconfig b/arch/blackfin/configs/PNAV-10_defconfig
index be866d95ed76..a566a2fe6b9b 100644
--- a/arch/blackfin/configs/PNAV-10_defconfig
+++ b/arch/blackfin/configs/PNAV-10_defconfig
@@ -2,7 +2,7 @@ CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 4# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
5CONFIG_EMBEDDED=y 5CONFIG_EXPERT=y
6# CONFIG_SYSCTL_SYSCALL is not set 6# CONFIG_SYSCTL_SYSCALL is not set
7# CONFIG_ELF_CORE is not set 7# CONFIG_ELF_CORE is not set
8# CONFIG_FUTEX is not set 8# CONFIG_FUTEX is not set
diff --git a/arch/blackfin/configs/SRV1_defconfig b/arch/blackfin/configs/SRV1_defconfig
index b64bdf759b82..853809510ee9 100644
--- a/arch/blackfin/configs/SRV1_defconfig
+++ b/arch/blackfin/configs/SRV1_defconfig
@@ -3,7 +3,7 @@ CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7# CONFIG_SYSCTL_SYSCALL is not set 7# CONFIG_SYSCTL_SYSCALL is not set
8CONFIG_KALLSYMS_ALL=y 8CONFIG_KALLSYMS_ALL=y
9# CONFIG_ELF_CORE is not set 9# CONFIG_ELF_CORE is not set
diff --git a/arch/blackfin/configs/TCM-BF518_defconfig b/arch/blackfin/configs/TCM-BF518_defconfig
index 1bccd9a50986..d496ae9a39b0 100644
--- a/arch/blackfin/configs/TCM-BF518_defconfig
+++ b/arch/blackfin/configs/TCM-BF518_defconfig
@@ -7,7 +7,7 @@ CONFIG_LOG_BUF_SHIFT=14
7CONFIG_BLK_DEV_INITRD=y 7CONFIG_BLK_DEV_INITRD=y
8# CONFIG_RD_GZIP is not set 8# CONFIG_RD_GZIP is not set
9CONFIG_RD_LZMA=y 9CONFIG_RD_LZMA=y
10CONFIG_EMBEDDED=y 10CONFIG_EXPERT=y
11# CONFIG_SYSCTL_SYSCALL is not set 11# CONFIG_SYSCTL_SYSCALL is not set
12# CONFIG_ELF_CORE is not set 12# CONFIG_ELF_CORE is not set
13# CONFIG_FUTEX is not set 13# CONFIG_FUTEX is not set
diff --git a/arch/blackfin/configs/TCM-BF537_defconfig b/arch/blackfin/configs/TCM-BF537_defconfig
index 00ce899e9e5d..65f642167a50 100644
--- a/arch/blackfin/configs/TCM-BF537_defconfig
+++ b/arch/blackfin/configs/TCM-BF537_defconfig
@@ -8,7 +8,7 @@ CONFIG_BLK_DEV_INITRD=y
8# CONFIG_RD_GZIP is not set 8# CONFIG_RD_GZIP is not set
9CONFIG_RD_LZMA=y 9CONFIG_RD_LZMA=y
10# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 10# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
11CONFIG_EMBEDDED=y 11CONFIG_EXPERT=y
12# CONFIG_UID16 is not set 12# CONFIG_UID16 is not set
13# CONFIG_SYSCTL_SYSCALL is not set 13# CONFIG_SYSCTL_SYSCALL is not set
14# CONFIG_ELF_CORE is not set 14# CONFIG_ELF_CORE is not set
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index 613e62831c55..0a7a4c11d8b1 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -54,6 +54,8 @@ config CRIS
54 bool 54 bool
55 default y 55 default y
56 select HAVE_IDE 56 select HAVE_IDE
57 select HAVE_GENERIC_HARDIRQS
58 select GENERIC_HARDIRQS_NO_DEPRECATED
57 59
58config HZ 60config HZ
59 int 61 int
@@ -67,10 +69,6 @@ menu "General setup"
67 69
68source "fs/Kconfig.binfmt" 70source "fs/Kconfig.binfmt"
69 71
70config GENERIC_HARDIRQS
71 bool
72 default y
73
74config ETRAX_CMDLINE 72config ETRAX_CMDLINE
75 string "Kernel command line" 73 string "Kernel command line"
76 default "root=/dev/mtdblock3" 74 default "root=/dev/mtdblock3"
diff --git a/arch/cris/arch-v10/kernel/irq.c b/arch/cris/arch-v10/kernel/irq.c
index a0c0df8be9c8..7328a7cf7449 100644
--- a/arch/cris/arch-v10/kernel/irq.c
+++ b/arch/cris/arch-v10/kernel/irq.c
@@ -104,43 +104,21 @@ static void (*interrupt[NR_IRQS])(void) = {
104 IRQ31_interrupt 104 IRQ31_interrupt
105}; 105};
106 106
107static void enable_crisv10_irq(unsigned int irq); 107static void enable_crisv10_irq(struct irq_data *data)
108
109static unsigned int startup_crisv10_irq(unsigned int irq)
110{
111 enable_crisv10_irq(irq);
112 return 0;
113}
114
115#define shutdown_crisv10_irq disable_crisv10_irq
116
117static void enable_crisv10_irq(unsigned int irq)
118{
119 crisv10_unmask_irq(irq);
120}
121
122static void disable_crisv10_irq(unsigned int irq)
123{
124 crisv10_mask_irq(irq);
125}
126
127static void ack_crisv10_irq(unsigned int irq)
128{ 108{
109 crisv10_unmask_irq(data->irq);
129} 110}
130 111
131static void end_crisv10_irq(unsigned int irq) 112static void disable_crisv10_irq(struct irq_data *data)
132{ 113{
114 crisv10_mask_irq(data->irq);
133} 115}
134 116
135static struct irq_chip crisv10_irq_type = { 117static struct irq_chip crisv10_irq_type = {
136 .name = "CRISv10", 118 .name = "CRISv10",
137 .startup = startup_crisv10_irq, 119 .irq_shutdown = disable_crisv10_irq,
138 .shutdown = shutdown_crisv10_irq, 120 .irq_enable = enable_crisv10_irq,
139 .enable = enable_crisv10_irq, 121 .irq_disable = disable_crisv10_irq,
140 .disable = disable_crisv10_irq,
141 .ack = ack_crisv10_irq,
142 .end = end_crisv10_irq,
143 .set_affinity = NULL
144}; 122};
145 123
146void weird_irq(void); 124void weird_irq(void);
@@ -221,7 +199,8 @@ init_IRQ(void)
221 199
222 /* Initialize IRQ handler descriptors. */ 200 /* Initialize IRQ handler descriptors. */
223 for(i = 2; i < NR_IRQS; i++) { 201 for(i = 2; i < NR_IRQS; i++) {
224 irq_desc[i].chip = &crisv10_irq_type; 202 set_irq_desc_and_handler(i, &crisv10_irq_type,
203 handle_simple_irq);
225 set_int_vector(i, interrupt[i]); 204 set_int_vector(i, interrupt[i]);
226 } 205 }
227 206
diff --git a/arch/cris/arch-v32/kernel/irq.c b/arch/cris/arch-v32/kernel/irq.c
index 2ed48ae3d313..0ad9db5126c7 100644
--- a/arch/cris/arch-v32/kernel/irq.c
+++ b/arch/cris/arch-v32/kernel/irq.c
@@ -291,54 +291,33 @@ void crisv32_unmask_irq(int irq)
291} 291}
292 292
293 293
294static unsigned int startup_crisv32_irq(unsigned int irq) 294static void enable_crisv32_irq(struct irq_data *data)
295{ 295{
296 crisv32_unmask_irq(irq); 296 crisv32_unmask_irq(data->irq);
297 return 0;
298}
299
300static void shutdown_crisv32_irq(unsigned int irq)
301{
302 crisv32_mask_irq(irq);
303} 297}
304 298
305static void enable_crisv32_irq(unsigned int irq) 299static void disable_crisv32_irq(struct irq_data *data)
306{ 300{
307 crisv32_unmask_irq(irq); 301 crisv32_mask_irq(data->irq);
308} 302}
309 303
310static void disable_crisv32_irq(unsigned int irq) 304static int set_affinity_crisv32_irq(struct irq_data *data,
311{ 305 const struct cpumask *dest, bool force)
312 crisv32_mask_irq(irq);
313}
314
315static void ack_crisv32_irq(unsigned int irq)
316{
317}
318
319static void end_crisv32_irq(unsigned int irq)
320{
321}
322
323int set_affinity_crisv32_irq(unsigned int irq, const struct cpumask *dest)
324{ 306{
325 unsigned long flags; 307 unsigned long flags;
308
326 spin_lock_irqsave(&irq_lock, flags); 309 spin_lock_irqsave(&irq_lock, flags);
327 irq_allocations[irq - FIRST_IRQ].mask = *dest; 310 irq_allocations[data->irq - FIRST_IRQ].mask = *dest;
328 spin_unlock_irqrestore(&irq_lock, flags); 311 spin_unlock_irqrestore(&irq_lock, flags);
329
330 return 0; 312 return 0;
331} 313}
332 314
333static struct irq_chip crisv32_irq_type = { 315static struct irq_chip crisv32_irq_type = {
334 .name = "CRISv32", 316 .name = "CRISv32",
335 .startup = startup_crisv32_irq, 317 .irq_shutdown = disable_crisv32_irq,
336 .shutdown = shutdown_crisv32_irq, 318 .irq_enable = enable_crisv32_irq,
337 .enable = enable_crisv32_irq, 319 .irq_disable = disable_crisv32_irq,
338 .disable = disable_crisv32_irq, 320 .irq_set_affinity = set_affinity_crisv32_irq,
339 .ack = ack_crisv32_irq,
340 .end = end_crisv32_irq,
341 .set_affinity = set_affinity_crisv32_irq
342}; 321};
343 322
344void 323void
@@ -472,7 +451,8 @@ init_IRQ(void)
472 451
473 /* Point all IRQ's to bad handlers. */ 452 /* Point all IRQ's to bad handlers. */
474 for (i = FIRST_IRQ, j = 0; j < NR_IRQS; i++, j++) { 453 for (i = FIRST_IRQ, j = 0; j < NR_IRQS; i++, j++) {
475 irq_desc[j].chip = &crisv32_irq_type; 454 set_irq_chip_and_handler(j, &crisv32_irq_type,
455 handle_simple_irq);
476 set_exception_vector(i, interrupt[j]); 456 set_exception_vector(i, interrupt[j]);
477 } 457 }
478 458
diff --git a/arch/cris/configs/artpec_3_defconfig b/arch/cris/configs/artpec_3_defconfig
index 590f72c9455d..71854d41c5a0 100644
--- a/arch/cris/configs/artpec_3_defconfig
+++ b/arch/cris/configs/artpec_3_defconfig
@@ -2,7 +2,7 @@ CONFIG_EXPERIMENTAL=y
2# CONFIG_SWAP is not set 2# CONFIG_SWAP is not set
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 4# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
5CONFIG_EMBEDDED=y 5CONFIG_EXPERT=y
6# CONFIG_KALLSYMS is not set 6# CONFIG_KALLSYMS is not set
7# CONFIG_HOTPLUG is not set 7# CONFIG_HOTPLUG is not set
8# CONFIG_BLK_DEV_BSG is not set 8# CONFIG_BLK_DEV_BSG is not set
diff --git a/arch/cris/configs/etrax-100lx_v2_defconfig b/arch/cris/configs/etrax-100lx_v2_defconfig
index 1b2853e39801..a85aabf92be5 100644
--- a/arch/cris/configs/etrax-100lx_v2_defconfig
+++ b/arch/cris/configs/etrax-100lx_v2_defconfig
@@ -2,7 +2,7 @@ CONFIG_EXPERIMENTAL=y
2# CONFIG_SWAP is not set 2# CONFIG_SWAP is not set
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 4# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
5CONFIG_EMBEDDED=y 5CONFIG_EXPERT=y
6# CONFIG_KALLSYMS is not set 6# CONFIG_KALLSYMS is not set
7# CONFIG_HOTPLUG is not set 7# CONFIG_HOTPLUG is not set
8# CONFIG_BLK_DEV_BSG is not set 8# CONFIG_BLK_DEV_BSG is not set
diff --git a/arch/cris/configs/etraxfs_defconfig b/arch/cris/configs/etraxfs_defconfig
index f73d38cc9c66..87c7227fecb2 100644
--- a/arch/cris/configs/etraxfs_defconfig
+++ b/arch/cris/configs/etraxfs_defconfig
@@ -2,7 +2,7 @@ CONFIG_EXPERIMENTAL=y
2# CONFIG_SWAP is not set 2# CONFIG_SWAP is not set
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 4# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
5CONFIG_EMBEDDED=y 5CONFIG_EXPERT=y
6# CONFIG_KALLSYMS is not set 6# CONFIG_KALLSYMS is not set
7# CONFIG_HOTPLUG is not set 7# CONFIG_HOTPLUG is not set
8# CONFIG_BLK_DEV_BSG is not set 8# CONFIG_BLK_DEV_BSG is not set
diff --git a/arch/cris/kernel/irq.c b/arch/cris/kernel/irq.c
index 469f7f9d62e0..c346952f06dc 100644
--- a/arch/cris/kernel/irq.c
+++ b/arch/cris/kernel/irq.c
@@ -62,7 +62,7 @@ int show_interrupts(struct seq_file *p, void *v)
62 for_each_online_cpu(j) 62 for_each_online_cpu(j)
63 seq_printf(p, "%10u ", kstat_irqs_cpu(i, j)); 63 seq_printf(p, "%10u ", kstat_irqs_cpu(i, j));
64#endif 64#endif
65 seq_printf(p, " %14s", irq_desc[i].chip->name); 65 seq_printf(p, " %14s", irq_desc[i].irq_data.chip->name);
66 seq_printf(p, " %s", action->name); 66 seq_printf(p, " %s", action->name);
67 67
68 for (action=action->next; action; action = action->next) 68 for (action=action->next; action; action = action->next)
@@ -93,8 +93,8 @@ asmlinkage void do_IRQ(int irq, struct pt_regs * regs)
93 printk("do_IRQ: stack overflow: %lX\n", sp); 93 printk("do_IRQ: stack overflow: %lX\n", sp);
94 show_stack(NULL, (unsigned long *)sp); 94 show_stack(NULL, (unsigned long *)sp);
95 } 95 }
96 __do_IRQ(irq); 96 generic_handle_irq(irq);
97 irq_exit(); 97 irq_exit();
98 set_irq_regs(old_regs); 98 set_irq_regs(old_regs);
99} 99}
100 100
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig
index f6bcb039cd6d..747499a1b31e 100644
--- a/arch/frv/Kconfig
+++ b/arch/frv/Kconfig
@@ -5,6 +5,7 @@ config FRV
5 select HAVE_ARCH_TRACEHOOK 5 select HAVE_ARCH_TRACEHOOK
6 select HAVE_IRQ_WORK 6 select HAVE_IRQ_WORK
7 select HAVE_PERF_EVENTS 7 select HAVE_PERF_EVENTS
8 select HAVE_GENERIC_HARDIRQS
8 9
9config ZONE_DMA 10config ZONE_DMA
10 bool 11 bool
@@ -29,14 +30,6 @@ config GENERIC_CALIBRATE_DELAY
29 bool 30 bool
30 default n 31 default n
31 32
32config GENERIC_HARDIRQS
33 bool
34 default y
35
36config GENERIC_HARDIRQS_NO__DO_IRQ
37 bool
38 default y
39
40config TIME_LOW_RES 33config TIME_LOW_RES
41 bool 34 bool
42 default y 35 default y
diff --git a/arch/frv/defconfig b/arch/frv/defconfig
index b8ebe9e8a493..b1b792610fdf 100644
--- a/arch/frv/defconfig
+++ b/arch/frv/defconfig
@@ -3,7 +3,7 @@ CONFIG_SYSVIPC=y
3CONFIG_POSIX_MQUEUE=y 3CONFIG_POSIX_MQUEUE=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7# CONFIG_HOTPLUG is not set 7# CONFIG_HOTPLUG is not set
8CONFIG_MMU=y 8CONFIG_MMU=y
9CONFIG_FRV_OUTOFLINE_ATOMIC_OPS=y 9CONFIG_FRV_OUTOFLINE_ATOMIC_OPS=y
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index 65f897d8c1e9..6df692d1475f 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -2,6 +2,8 @@ config H8300
2 bool 2 bool
3 default y 3 default y
4 select HAVE_IDE 4 select HAVE_IDE
5 select HAVE_GENERIC_HARDIRQS
6 select GENERIC_HARDIRQS_NO_DEPRECATED
5 7
6config SYMBOL_PREFIX 8config SYMBOL_PREFIX
7 string 9 string
@@ -47,10 +49,6 @@ config GENERIC_HWEIGHT
47 bool 49 bool
48 default y 50 default y
49 51
50config GENERIC_HARDIRQS
51 bool
52 default y
53
54config GENERIC_CALIBRATE_DELAY 52config GENERIC_CALIBRATE_DELAY
55 bool 53 bool
56 default y 54 default y
diff --git a/arch/h8300/defconfig b/arch/h8300/defconfig
index 342f77765f02..042425a02645 100644
--- a/arch/h8300/defconfig
+++ b/arch/h8300/defconfig
@@ -1,7 +1,7 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set 2# CONFIG_LOCALVERSION_AUTO is not set
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_EMBEDDED=y 4CONFIG_EXPERT=y
5# CONFIG_UID16 is not set 5# CONFIG_UID16 is not set
6# CONFIG_SYSCTL_SYSCALL is not set 6# CONFIG_SYSCTL_SYSCALL is not set
7# CONFIG_KALLSYMS is not set 7# CONFIG_KALLSYMS is not set
diff --git a/arch/h8300/kernel/irq.c b/arch/h8300/kernel/irq.c
index c25dc2c2b1da..7643d39925d6 100644
--- a/arch/h8300/kernel/irq.c
+++ b/arch/h8300/kernel/irq.c
@@ -38,34 +38,30 @@ static inline int is_ext_irq(unsigned int irq)
38 return (irq >= EXT_IRQ0 && irq <= (EXT_IRQ0 + EXT_IRQS)); 38 return (irq >= EXT_IRQ0 && irq <= (EXT_IRQ0 + EXT_IRQS));
39} 39}
40 40
41static void h8300_enable_irq(unsigned int irq) 41static void h8300_enable_irq(struct irq_data *data)
42{ 42{
43 if (is_ext_irq(irq)) 43 if (is_ext_irq(data->irq))
44 IER_REGS |= 1 << (irq - EXT_IRQ0); 44 IER_REGS |= 1 << (data->irq - EXT_IRQ0);
45} 45}
46 46
47static void h8300_disable_irq(unsigned int irq) 47static void h8300_disable_irq(struct irq_data *data)
48{ 48{
49 if (is_ext_irq(irq)) 49 if (is_ext_irq(data->irq))
50 IER_REGS &= ~(1 << (irq - EXT_IRQ0)); 50 IER_REGS &= ~(1 << (data->irq - EXT_IRQ0));
51} 51}
52 52
53static void h8300_end_irq(unsigned int irq) 53static unsigned int h8300_startup_irq(struct irq_data *data)
54{ 54{
55} 55 if (is_ext_irq(data->irq))
56 56 return h8300_enable_irq_pin(data->irq);
57static unsigned int h8300_startup_irq(unsigned int irq)
58{
59 if (is_ext_irq(irq))
60 return h8300_enable_irq_pin(irq);
61 else 57 else
62 return 0; 58 return 0;
63} 59}
64 60
65static void h8300_shutdown_irq(unsigned int irq) 61static void h8300_shutdown_irq(struct irq_data *data)
66{ 62{
67 if (is_ext_irq(irq)) 63 if (is_ext_irq(data->irq))
68 h8300_disable_irq_pin(irq); 64 h8300_disable_irq_pin(data->irq);
69} 65}
70 66
71/* 67/*
@@ -73,12 +69,10 @@ static void h8300_shutdown_irq(unsigned int irq)
73 */ 69 */
74struct irq_chip h8300irq_chip = { 70struct irq_chip h8300irq_chip = {
75 .name = "H8300-INTC", 71 .name = "H8300-INTC",
76 .startup = h8300_startup_irq, 72 .irq_startup = h8300_startup_irq,
77 .shutdown = h8300_shutdown_irq, 73 .irq_shutdown = h8300_shutdown_irq,
78 .enable = h8300_enable_irq, 74 .irq_enable = h8300_enable_irq,
79 .disable = h8300_disable_irq, 75 .irq_disable = h8300_disable_irq,
80 .ack = NULL,
81 .end = h8300_end_irq,
82}; 76};
83 77
84#if defined(CONFIG_RAMKERNEL) 78#if defined(CONFIG_RAMKERNEL)
@@ -160,18 +154,14 @@ void __init init_IRQ(void)
160 154
161 setup_vector(); 155 setup_vector();
162 156
163 for (c = 0; c < NR_IRQS; c++) { 157 for (c = 0; c < NR_IRQS; c++)
164 irq_desc[c].status = IRQ_DISABLED; 158 set_irq_chip_and_handler(c, &h8300irq_chip, handle_simple_irq);
165 irq_desc[c].action = NULL;
166 irq_desc[c].depth = 1;
167 irq_desc[c].chip = &h8300irq_chip;
168 }
169} 159}
170 160
171asmlinkage void do_IRQ(int irq) 161asmlinkage void do_IRQ(int irq)
172{ 162{
173 irq_enter(); 163 irq_enter();
174 __do_IRQ(irq); 164 generic_handle_irq(irq);
175 irq_exit(); 165 irq_exit();
176} 166}
177 167
@@ -192,7 +182,7 @@ int show_interrupts(struct seq_file *p, void *v)
192 goto unlock; 182 goto unlock;
193 seq_printf(p, "%3d: ",i); 183 seq_printf(p, "%3d: ",i);
194 seq_printf(p, "%10u ", kstat_irqs(i)); 184 seq_printf(p, "%10u ", kstat_irqs(i));
195 seq_printf(p, " %14s", irq_desc[i].chip->name); 185 seq_printf(p, " %14s", irq_desc[i].irq_data.chip->name);
196 seq_printf(p, "-%-8s", irq_desc[i].name); 186 seq_printf(p, "-%-8s", irq_desc[i].name);
197 seq_printf(p, " %s", action->name); 187 seq_printf(p, " %s", action->name);
198 188
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index e0f5b6d7f849..fcf3b437a2d9 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -22,6 +22,10 @@ config IA64
22 select HAVE_KVM 22 select HAVE_KVM
23 select HAVE_ARCH_TRACEHOOK 23 select HAVE_ARCH_TRACEHOOK
24 select HAVE_DMA_API_DEBUG 24 select HAVE_DMA_API_DEBUG
25 select HAVE_GENERIC_HARDIRQS
26 select GENERIC_IRQ_PROBE
27 select GENERIC_PENDING_IRQ if SMP
28 select IRQ_PER_CPU
25 default y 29 default y
26 help 30 help
27 The Itanium Processor Family is Intel's 64-bit successor to 31 The Itanium Processor Family is Intel's 64-bit successor to
@@ -678,28 +682,6 @@ source "arch/ia64/kvm/Kconfig"
678 682
679source "lib/Kconfig" 683source "lib/Kconfig"
680 684
681#
682# Use the generic interrupt handling code in kernel/irq/:
683#
684config GENERIC_HARDIRQS
685 def_bool y
686
687config GENERIC_HARDIRQS_NO__DO_IRQ
688 def_bool y
689
690config GENERIC_IRQ_PROBE
691 bool
692 default y
693
694config GENERIC_PENDING_IRQ
695 bool
696 depends on GENERIC_HARDIRQS && SMP
697 default y
698
699config IRQ_PER_CPU
700 bool
701 default y
702
703config IOMMU_HELPER 685config IOMMU_HELPER
704 def_bool (IA64_HP_ZX1 || IA64_HP_ZX1_SWIOTLB || IA64_GENERIC || SWIOTLB) 686 def_bool (IA64_HP_ZX1 || IA64_HP_ZX1_SWIOTLB || IA64_GENERIC || SWIOTLB)
705 687
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
index 5c291d65196b..ef4c1e442be3 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -7,6 +7,9 @@ config M32R
7 select HAVE_KERNEL_GZIP 7 select HAVE_KERNEL_GZIP
8 select HAVE_KERNEL_BZIP2 8 select HAVE_KERNEL_BZIP2
9 select HAVE_KERNEL_LZMA 9 select HAVE_KERNEL_LZMA
10 select HAVE_GENERIC_HARDIRQS
11 select GENERIC_HARDIRQS_NO_DEPRECATED
12 select GENERIC_IRQ_PROBE
10 13
11config SBUS 14config SBUS
12 bool 15 bool
@@ -19,14 +22,6 @@ config ZONE_DMA
19 bool 22 bool
20 default y 23 default y
21 24
22config GENERIC_HARDIRQS
23 bool
24 default y
25
26config GENERIC_IRQ_PROBE
27 bool
28 default y
29
30config NO_IOPORT 25config NO_IOPORT
31 def_bool y 26 def_bool y
32 27
diff --git a/arch/m32r/configs/m32700ut.smp_defconfig b/arch/m32r/configs/m32700ut.smp_defconfig
index 816c3ecaa2aa..a3d727ed6a16 100644
--- a/arch/m32r/configs/m32700ut.smp_defconfig
+++ b/arch/m32r/configs/m32700ut.smp_defconfig
@@ -5,7 +5,7 @@ CONFIG_IKCONFIG=y
5CONFIG_IKCONFIG_PROC=y 5CONFIG_IKCONFIG_PROC=y
6CONFIG_LOG_BUF_SHIFT=15 6CONFIG_LOG_BUF_SHIFT=15
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9# CONFIG_KALLSYMS is not set 9# CONFIG_KALLSYMS is not set
10# CONFIG_FUTEX is not set 10# CONFIG_FUTEX is not set
11# CONFIG_EPOLL is not set 11# CONFIG_EPOLL is not set
diff --git a/arch/m32r/configs/m32700ut.up_defconfig b/arch/m32r/configs/m32700ut.up_defconfig
index 84785686640a..b8334163099d 100644
--- a/arch/m32r/configs/m32700ut.up_defconfig
+++ b/arch/m32r/configs/m32700ut.up_defconfig
@@ -5,7 +5,7 @@ CONFIG_IKCONFIG=y
5CONFIG_IKCONFIG_PROC=y 5CONFIG_IKCONFIG_PROC=y
6CONFIG_LOG_BUF_SHIFT=14 6CONFIG_LOG_BUF_SHIFT=14
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9# CONFIG_KALLSYMS is not set 9# CONFIG_KALLSYMS is not set
10# CONFIG_FUTEX is not set 10# CONFIG_FUTEX is not set
11# CONFIG_EPOLL is not set 11# CONFIG_EPOLL is not set
diff --git a/arch/m32r/configs/mappi.nommu_defconfig b/arch/m32r/configs/mappi.nommu_defconfig
index 354a964d084d..7c90ce2fc42b 100644
--- a/arch/m32r/configs/mappi.nommu_defconfig
+++ b/arch/m32r/configs/mappi.nommu_defconfig
@@ -3,7 +3,7 @@ CONFIG_BSD_PROCESS_ACCT=y
3CONFIG_IKCONFIG=y 3CONFIG_IKCONFIG=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7# CONFIG_KALLSYMS is not set 7# CONFIG_KALLSYMS is not set
8# CONFIG_FUTEX is not set 8# CONFIG_FUTEX is not set
9# CONFIG_EPOLL is not set 9# CONFIG_EPOLL is not set
diff --git a/arch/m32r/configs/mappi.smp_defconfig b/arch/m32r/configs/mappi.smp_defconfig
index 9022307bd073..367d07cebcd3 100644
--- a/arch/m32r/configs/mappi.smp_defconfig
+++ b/arch/m32r/configs/mappi.smp_defconfig
@@ -5,7 +5,7 @@ CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=15 5CONFIG_LOG_BUF_SHIFT=15
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9# CONFIG_KALLSYMS is not set 9# CONFIG_KALLSYMS is not set
10# CONFIG_FUTEX is not set 10# CONFIG_FUTEX is not set
11# CONFIG_EPOLL is not set 11# CONFIG_EPOLL is not set
diff --git a/arch/m32r/configs/mappi.up_defconfig b/arch/m32r/configs/mappi.up_defconfig
index 3726068721a5..cb11384386ce 100644
--- a/arch/m32r/configs/mappi.up_defconfig
+++ b/arch/m32r/configs/mappi.up_defconfig
@@ -5,7 +5,7 @@ CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9# CONFIG_KALLSYMS is not set 9# CONFIG_KALLSYMS is not set
10# CONFIG_FUTEX is not set 10# CONFIG_FUTEX is not set
11# CONFIG_EPOLL is not set 11# CONFIG_EPOLL is not set
diff --git a/arch/m32r/configs/mappi2.opsp_defconfig b/arch/m32r/configs/mappi2.opsp_defconfig
index 6136fad048e4..3bff779259b4 100644
--- a/arch/m32r/configs/mappi2.opsp_defconfig
+++ b/arch/m32r/configs/mappi2.opsp_defconfig
@@ -4,7 +4,7 @@ CONFIG_BSD_PROCESS_ACCT=y
4CONFIG_IKCONFIG=y 4CONFIG_IKCONFIG=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8# CONFIG_KALLSYMS is not set 8# CONFIG_KALLSYMS is not set
9# CONFIG_FUTEX is not set 9# CONFIG_FUTEX is not set
10# CONFIG_EPOLL is not set 10# CONFIG_EPOLL is not set
diff --git a/arch/m32r/configs/mappi2.vdec2_defconfig b/arch/m32r/configs/mappi2.vdec2_defconfig
index dce1fc7d67ed..75246c9c1af8 100644
--- a/arch/m32r/configs/mappi2.vdec2_defconfig
+++ b/arch/m32r/configs/mappi2.vdec2_defconfig
@@ -4,7 +4,7 @@ CONFIG_BSD_PROCESS_ACCT=y
4CONFIG_IKCONFIG=y 4CONFIG_IKCONFIG=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8# CONFIG_KALLSYMS is not set 8# CONFIG_KALLSYMS is not set
9# CONFIG_FUTEX is not set 9# CONFIG_FUTEX is not set
10# CONFIG_EPOLL is not set 10# CONFIG_EPOLL is not set
diff --git a/arch/m32r/configs/mappi3.smp_defconfig b/arch/m32r/configs/mappi3.smp_defconfig
index b204e2ecd0f1..27cefd41ac1f 100644
--- a/arch/m32r/configs/mappi3.smp_defconfig
+++ b/arch/m32r/configs/mappi3.smp_defconfig
@@ -5,7 +5,7 @@ CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=15 5CONFIG_LOG_BUF_SHIFT=15
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9# CONFIG_KALLSYMS is not set 9# CONFIG_KALLSYMS is not set
10# CONFIG_FUTEX is not set 10# CONFIG_FUTEX is not set
11# CONFIG_EPOLL is not set 11# CONFIG_EPOLL is not set
diff --git a/arch/m32r/configs/oaks32r_defconfig b/arch/m32r/configs/oaks32r_defconfig
index 5aa4ea9ebb10..5087a510ca4f 100644
--- a/arch/m32r/configs/oaks32r_defconfig
+++ b/arch/m32r/configs/oaks32r_defconfig
@@ -2,7 +2,7 @@ CONFIG_EXPERIMENTAL=y
2CONFIG_BSD_PROCESS_ACCT=y 2CONFIG_BSD_PROCESS_ACCT=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 4# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
5CONFIG_EMBEDDED=y 5CONFIG_EXPERT=y
6# CONFIG_KALLSYMS is not set 6# CONFIG_KALLSYMS is not set
7# CONFIG_FUTEX is not set 7# CONFIG_FUTEX is not set
8# CONFIG_EPOLL is not set 8# CONFIG_EPOLL is not set
diff --git a/arch/m32r/configs/opsput_defconfig b/arch/m32r/configs/opsput_defconfig
index 8494c6a276e8..50c6f525db20 100644
--- a/arch/m32r/configs/opsput_defconfig
+++ b/arch/m32r/configs/opsput_defconfig
@@ -4,7 +4,7 @@ CONFIG_BSD_PROCESS_ACCT=y
4CONFIG_IKCONFIG=y 4CONFIG_IKCONFIG=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8# CONFIG_KALLSYMS is not set 8# CONFIG_KALLSYMS is not set
9# CONFIG_FUTEX is not set 9# CONFIG_FUTEX is not set
10# CONFIG_EPOLL is not set 10# CONFIG_EPOLL is not set
diff --git a/arch/m32r/configs/usrv_defconfig b/arch/m32r/configs/usrv_defconfig
index 1df293bc2ab9..a3cfaaedab60 100644
--- a/arch/m32r/configs/usrv_defconfig
+++ b/arch/m32r/configs/usrv_defconfig
@@ -5,7 +5,7 @@ CONFIG_BSD_PROCESS_ACCT=y
5CONFIG_LOG_BUF_SHIFT=15 5CONFIG_LOG_BUF_SHIFT=15
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9CONFIG_KALLSYMS_EXTRA_PASS=y 9CONFIG_KALLSYMS_EXTRA_PASS=y
10CONFIG_SLAB=y 10CONFIG_SLAB=y
11CONFIG_MODULES=y 11CONFIG_MODULES=y
diff --git a/arch/m32r/kernel/irq.c b/arch/m32r/kernel/irq.c
index 7db26f1f082d..f745c1287f3a 100644
--- a/arch/m32r/kernel/irq.c
+++ b/arch/m32r/kernel/irq.c
@@ -40,8 +40,10 @@ int show_interrupts(struct seq_file *p, void *v)
40 } 40 }
41 41
42 if (i < NR_IRQS) { 42 if (i < NR_IRQS) {
43 raw_spin_lock_irqsave(&irq_desc[i].lock, flags); 43 struct irq_desc *desc = irq_to_desc(i);
44 action = irq_desc[i].action; 44
45 raw_spin_lock_irqsave(&desc->lock, flags);
46 action = desc->action;
45 if (!action) 47 if (!action)
46 goto skip; 48 goto skip;
47 seq_printf(p, "%3d: ",i); 49 seq_printf(p, "%3d: ",i);
@@ -51,7 +53,7 @@ int show_interrupts(struct seq_file *p, void *v)
51 for_each_online_cpu(j) 53 for_each_online_cpu(j)
52 seq_printf(p, "%10u ", kstat_irqs_cpu(i, j)); 54 seq_printf(p, "%10u ", kstat_irqs_cpu(i, j));
53#endif 55#endif
54 seq_printf(p, " %14s", irq_desc[i].chip->name); 56 seq_printf(p, " %14s", desc->irq_data.chip->name);
55 seq_printf(p, " %s", action->name); 57 seq_printf(p, " %s", action->name);
56 58
57 for (action=action->next; action; action = action->next) 59 for (action=action->next; action; action = action->next)
@@ -59,7 +61,7 @@ int show_interrupts(struct seq_file *p, void *v)
59 61
60 seq_putc(p, '\n'); 62 seq_putc(p, '\n');
61skip: 63skip:
62 raw_spin_unlock_irqrestore(&irq_desc[i].lock, flags); 64 raw_spin_unlock_irqrestore(&desc->lock, flags);
63 } 65 }
64 return 0; 66 return 0;
65} 67}
diff --git a/arch/m32r/platforms/m32104ut/setup.c b/arch/m32r/platforms/m32104ut/setup.c
index 402a59d7219b..4a693d02c1e1 100644
--- a/arch/m32r/platforms/m32104ut/setup.c
+++ b/arch/m32r/platforms/m32104ut/setup.c
@@ -39,39 +39,30 @@ static void enable_m32104ut_irq(unsigned int irq)
39 outl(data, port); 39 outl(data, port);
40} 40}
41 41
42static void mask_and_ack_m32104ut(unsigned int irq) 42static void mask_m32104ut_irq(struct irq_data *data)
43{ 43{
44 disable_m32104ut_irq(irq); 44 disable_m32104ut_irq(data->irq);
45} 45}
46 46
47static void end_m32104ut_irq(unsigned int irq) 47static void unmask_m32104ut_irq(struct irq_data *data)
48{ 48{
49 enable_m32104ut_irq(irq); 49 enable_m32104ut_irq(data->irq);
50} 50}
51 51
52static unsigned int startup_m32104ut_irq(unsigned int irq) 52static void shutdown_m32104ut_irq(struct irq_data *data)
53{ 53{
54 enable_m32104ut_irq(irq); 54 unsigned int irq = data->irq;
55 return (0); 55 unsigned long port = irq2port(irq);
56}
57
58static void shutdown_m32104ut_irq(unsigned int irq)
59{
60 unsigned long port;
61 56
62 port = irq2port(irq);
63 outl(M32R_ICUCR_ILEVEL7, port); 57 outl(M32R_ICUCR_ILEVEL7, port);
64} 58}
65 59
66static struct irq_chip m32104ut_irq_type = 60static struct irq_chip m32104ut_irq_type =
67{ 61{
68 .name = "M32104UT-IRQ", 62 .name = "M32104UT-IRQ",
69 .startup = startup_m32104ut_irq, 63 .irq_shutdown = shutdown_m32104ut_irq,
70 .shutdown = shutdown_m32104ut_irq, 64 .irq_unmask = unmask_m32104ut_irq,
71 .enable = enable_m32104ut_irq, 65 .irq_mask = mask_m32104ut_irq,
72 .disable = disable_m32104ut_irq,
73 .ack = mask_and_ack_m32104ut,
74 .end = end_m32104ut_irq
75}; 66};
76 67
77void __init init_IRQ(void) 68void __init init_IRQ(void)
@@ -85,36 +76,29 @@ void __init init_IRQ(void)
85 76
86#if defined(CONFIG_SMC91X) 77#if defined(CONFIG_SMC91X)
87 /* INT#0: LAN controller on M32104UT-LAN (SMC91C111)*/ 78 /* INT#0: LAN controller on M32104UT-LAN (SMC91C111)*/
88 irq_desc[M32R_IRQ_INT0].status = IRQ_DISABLED; 79 set_irq_chip_and_handler(M32R_IRQ_INT0, &m32104ut_irq_type,
89 irq_desc[M32R_IRQ_INT0].chip = &m32104ut_irq_type; 80 handle_level_irq);
90 irq_desc[M32R_IRQ_INT0].action = 0; 81 /* "H" level sense */
91 irq_desc[M32R_IRQ_INT0].depth = 1; 82 cu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN | M32R_ICUCR_ISMOD11;
92 icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN | M32R_ICUCR_ISMOD11; /* "H" level sense */
93 disable_m32104ut_irq(M32R_IRQ_INT0); 83 disable_m32104ut_irq(M32R_IRQ_INT0);
94#endif /* CONFIG_SMC91X */ 84#endif /* CONFIG_SMC91X */
95 85
96 /* MFT2 : system timer */ 86 /* MFT2 : system timer */
97 irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED; 87 set_irq_chip_and_handler(M32R_IRQ_MFT2, &m32104ut_irq_type,
98 irq_desc[M32R_IRQ_MFT2].chip = &m32104ut_irq_type; 88 handle_level_irq);
99 irq_desc[M32R_IRQ_MFT2].action = 0;
100 irq_desc[M32R_IRQ_MFT2].depth = 1;
101 icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN; 89 icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN;
102 disable_m32104ut_irq(M32R_IRQ_MFT2); 90 disable_m32104ut_irq(M32R_IRQ_MFT2);
103 91
104#ifdef CONFIG_SERIAL_M32R_SIO 92#ifdef CONFIG_SERIAL_M32R_SIO
105 /* SIO0_R : uart receive data */ 93 /* SIO0_R : uart receive data */
106 irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED; 94 set_irq_chip_and_handler(M32R_IRQ_SIO0_R, &m32104ut_irq_type,
107 irq_desc[M32R_IRQ_SIO0_R].chip = &m32104ut_irq_type; 95 handle_level_irq);
108 irq_desc[M32R_IRQ_SIO0_R].action = 0;
109 irq_desc[M32R_IRQ_SIO0_R].depth = 1;
110 icu_data[M32R_IRQ_SIO0_R].icucr = M32R_ICUCR_IEN; 96 icu_data[M32R_IRQ_SIO0_R].icucr = M32R_ICUCR_IEN;
111 disable_m32104ut_irq(M32R_IRQ_SIO0_R); 97 disable_m32104ut_irq(M32R_IRQ_SIO0_R);
112 98
113 /* SIO0_S : uart send data */ 99 /* SIO0_S : uart send data */
114 irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED; 100 set_irq_chip_and_handler(M32R_IRQ_SIO0_S, &m32104ut_irq_type,
115 irq_desc[M32R_IRQ_SIO0_S].chip = &m32104ut_irq_type; 101 handle_level_irq);
116 irq_desc[M32R_IRQ_SIO0_S].action = 0;
117 irq_desc[M32R_IRQ_SIO0_S].depth = 1;
118 icu_data[M32R_IRQ_SIO0_S].icucr = M32R_ICUCR_IEN; 102 icu_data[M32R_IRQ_SIO0_S].icucr = M32R_ICUCR_IEN;
119 disable_m32104ut_irq(M32R_IRQ_SIO0_S); 103 disable_m32104ut_irq(M32R_IRQ_SIO0_S);
120#endif /* CONFIG_SERIAL_M32R_SIO */ 104#endif /* CONFIG_SERIAL_M32R_SIO */
diff --git a/arch/m32r/platforms/m32700ut/setup.c b/arch/m32r/platforms/m32700ut/setup.c
index 80b1a026795a..2074bcc841eb 100644
--- a/arch/m32r/platforms/m32700ut/setup.c
+++ b/arch/m32r/platforms/m32700ut/setup.c
@@ -45,39 +45,30 @@ static void enable_m32700ut_irq(unsigned int irq)
45 outl(data, port); 45 outl(data, port);
46} 46}
47 47
48static void mask_and_ack_m32700ut(unsigned int irq) 48static void mask_m32700ut(struct irq_data *data)
49{ 49{
50 disable_m32700ut_irq(irq); 50 disable_m32700ut_irq(data->irq);
51} 51}
52 52
53static void end_m32700ut_irq(unsigned int irq) 53static void unmask_m32700ut(struct irq_data *data)
54{ 54{
55 enable_m32700ut_irq(irq); 55 enable_m32700ut_irq(data->irq);
56} 56}
57 57
58static unsigned int startup_m32700ut_irq(unsigned int irq) 58static void shutdown_m32700ut(struct irq_data *data)
59{
60 enable_m32700ut_irq(irq);
61 return (0);
62}
63
64static void shutdown_m32700ut_irq(unsigned int irq)
65{ 59{
66 unsigned long port; 60 unsigned long port;
67 61
68 port = irq2port(irq); 62 port = irq2port(data->irq);
69 outl(M32R_ICUCR_ILEVEL7, port); 63 outl(M32R_ICUCR_ILEVEL7, port);
70} 64}
71 65
72static struct irq_chip m32700ut_irq_type = 66static struct irq_chip m32700ut_irq_type =
73{ 67{
74 .name = "M32700UT-IRQ", 68 .name = "M32700UT-IRQ",
75 .startup = startup_m32700ut_irq, 69 .irq_shutdown = shutdown_m32700ut,
76 .shutdown = shutdown_m32700ut_irq, 70 .irq_mask = mask_m32700ut,
77 .enable = enable_m32700ut_irq, 71 .irq_unmask = unmask_m32700ut
78 .disable = disable_m32700ut_irq,
79 .ack = mask_and_ack_m32700ut,
80 .end = end_m32700ut_irq
81}; 72};
82 73
83/* 74/*
@@ -99,7 +90,6 @@ static void disable_m32700ut_pld_irq(unsigned int irq)
99 unsigned int pldirq; 90 unsigned int pldirq;
100 91
101 pldirq = irq2pldirq(irq); 92 pldirq = irq2pldirq(irq);
102// disable_m32700ut_irq(M32R_IRQ_INT1);
103 port = pldirq2port(pldirq); 93 port = pldirq2port(pldirq);
104 data = pld_icu_data[pldirq].icucr|PLD_ICUCR_ILEVEL7; 94 data = pld_icu_data[pldirq].icucr|PLD_ICUCR_ILEVEL7;
105 outw(data, port); 95 outw(data, port);
@@ -111,50 +101,38 @@ static void enable_m32700ut_pld_irq(unsigned int irq)
111 unsigned int pldirq; 101 unsigned int pldirq;
112 102
113 pldirq = irq2pldirq(irq); 103 pldirq = irq2pldirq(irq);
114// enable_m32700ut_irq(M32R_IRQ_INT1);
115 port = pldirq2port(pldirq); 104 port = pldirq2port(pldirq);
116 data = pld_icu_data[pldirq].icucr|PLD_ICUCR_IEN|PLD_ICUCR_ILEVEL6; 105 data = pld_icu_data[pldirq].icucr|PLD_ICUCR_IEN|PLD_ICUCR_ILEVEL6;
117 outw(data, port); 106 outw(data, port);
118} 107}
119 108
120static void mask_and_ack_m32700ut_pld(unsigned int irq) 109static void mask_m32700ut_pld(struct irq_data *data)
121{
122 disable_m32700ut_pld_irq(irq);
123// mask_and_ack_m32700ut(M32R_IRQ_INT1);
124}
125
126static void end_m32700ut_pld_irq(unsigned int irq)
127{ 110{
128 enable_m32700ut_pld_irq(irq); 111 disable_m32700ut_pld_irq(data->irq);
129 end_m32700ut_irq(M32R_IRQ_INT1);
130} 112}
131 113
132static unsigned int startup_m32700ut_pld_irq(unsigned int irq) 114static void unmask_m32700ut_pld(struct irq_data *data)
133{ 115{
134 enable_m32700ut_pld_irq(irq); 116 enable_m32700ut_pld_irq(data->irq);
135 return (0); 117 enable_m32700ut_irq(M32R_IRQ_INT1);
136} 118}
137 119
138static void shutdown_m32700ut_pld_irq(unsigned int irq) 120static void shutdown_m32700ut_pld_irq(struct irq_data *data)
139{ 121{
140 unsigned long port; 122 unsigned long port;
141 unsigned int pldirq; 123 unsigned int pldirq;
142 124
143 pldirq = irq2pldirq(irq); 125 pldirq = irq2pldirq(data->irq);
144// shutdown_m32700ut_irq(M32R_IRQ_INT1);
145 port = pldirq2port(pldirq); 126 port = pldirq2port(pldirq);
146 outw(PLD_ICUCR_ILEVEL7, port); 127 outw(PLD_ICUCR_ILEVEL7, port);
147} 128}
148 129
149static struct irq_chip m32700ut_pld_irq_type = 130static struct irq_chip m32700ut_pld_irq_type =
150{ 131{
151 .name = "M32700UT-PLD-IRQ", 132 .name = "M32700UT-PLD-IRQ",
152 .startup = startup_m32700ut_pld_irq, 133 .irq_shutdown = shutdown_m32700ut_pld_irq,
153 .shutdown = shutdown_m32700ut_pld_irq, 134 .irq_mask = mask_m32700ut_pld,
154 .enable = enable_m32700ut_pld_irq, 135 .irq_unmask = unmask_m32700ut_pld,
155 .disable = disable_m32700ut_pld_irq,
156 .ack = mask_and_ack_m32700ut_pld,
157 .end = end_m32700ut_pld_irq
158}; 136};
159 137
160/* 138/*
@@ -188,42 +166,33 @@ static void enable_m32700ut_lanpld_irq(unsigned int irq)
188 outw(data, port); 166 outw(data, port);
189} 167}
190 168
191static void mask_and_ack_m32700ut_lanpld(unsigned int irq) 169static void mask_m32700ut_lanpld(struct irq_data *data)
192{ 170{
193 disable_m32700ut_lanpld_irq(irq); 171 disable_m32700ut_lanpld_irq(data->irq);
194} 172}
195 173
196static void end_m32700ut_lanpld_irq(unsigned int irq) 174static void unmask_m32700ut_lanpld(struct irq_data *data)
197{ 175{
198 enable_m32700ut_lanpld_irq(irq); 176 enable_m32700ut_lanpld_irq(data->irq);
199 end_m32700ut_irq(M32R_IRQ_INT0); 177 enable_m32700ut_irq(M32R_IRQ_INT0);
200}
201
202static unsigned int startup_m32700ut_lanpld_irq(unsigned int irq)
203{
204 enable_m32700ut_lanpld_irq(irq);
205 return (0);
206} 178}
207 179
208static void shutdown_m32700ut_lanpld_irq(unsigned int irq) 180static void shutdown_m32700ut_lanpld(struct irq_data *data)
209{ 181{
210 unsigned long port; 182 unsigned long port;
211 unsigned int pldirq; 183 unsigned int pldirq;
212 184
213 pldirq = irq2lanpldirq(irq); 185 pldirq = irq2lanpldirq(data->irq);
214 port = lanpldirq2port(pldirq); 186 port = lanpldirq2port(pldirq);
215 outw(PLD_ICUCR_ILEVEL7, port); 187 outw(PLD_ICUCR_ILEVEL7, port);
216} 188}
217 189
218static struct irq_chip m32700ut_lanpld_irq_type = 190static struct irq_chip m32700ut_lanpld_irq_type =
219{ 191{
220 .name = "M32700UT-PLD-LAN-IRQ", 192 .name = "M32700UT-PLD-LAN-IRQ",
221 .startup = startup_m32700ut_lanpld_irq, 193 .irq_shutdown = shutdown_m32700ut_lanpld,
222 .shutdown = shutdown_m32700ut_lanpld_irq, 194 .irq_mask = mask_m32700ut_lanpld,
223 .enable = enable_m32700ut_lanpld_irq, 195 .irq_unmask = unmask_m32700ut_lanpld,
224 .disable = disable_m32700ut_lanpld_irq,
225 .ack = mask_and_ack_m32700ut_lanpld,
226 .end = end_m32700ut_lanpld_irq
227}; 196};
228 197
229/* 198/*
@@ -257,143 +226,110 @@ static void enable_m32700ut_lcdpld_irq(unsigned int irq)
257 outw(data, port); 226 outw(data, port);
258} 227}
259 228
260static void mask_and_ack_m32700ut_lcdpld(unsigned int irq) 229static void mask_m32700ut_lcdpld(struct irq_data *data)
261{ 230{
262 disable_m32700ut_lcdpld_irq(irq); 231 disable_m32700ut_lcdpld_irq(data->irq);
263} 232}
264 233
265static void end_m32700ut_lcdpld_irq(unsigned int irq) 234static void unmask_m32700ut_lcdpld(struct irq_data *data)
266{ 235{
267 enable_m32700ut_lcdpld_irq(irq); 236 enable_m32700ut_lcdpld_irq(data->irq);
268 end_m32700ut_irq(M32R_IRQ_INT2); 237 enable_m32700ut_irq(M32R_IRQ_INT2);
269}
270
271static unsigned int startup_m32700ut_lcdpld_irq(unsigned int irq)
272{
273 enable_m32700ut_lcdpld_irq(irq);
274 return (0);
275} 238}
276 239
277static void shutdown_m32700ut_lcdpld_irq(unsigned int irq) 240static void shutdown_m32700ut_lcdpld(struct irq_data *data)
278{ 241{
279 unsigned long port; 242 unsigned long port;
280 unsigned int pldirq; 243 unsigned int pldirq;
281 244
282 pldirq = irq2lcdpldirq(irq); 245 pldirq = irq2lcdpldirq(data->irq);
283 port = lcdpldirq2port(pldirq); 246 port = lcdpldirq2port(pldirq);
284 outw(PLD_ICUCR_ILEVEL7, port); 247 outw(PLD_ICUCR_ILEVEL7, port);
285} 248}
286 249
287static struct irq_chip m32700ut_lcdpld_irq_type = 250static struct irq_chip m32700ut_lcdpld_irq_type =
288{ 251{
289 .name = "M32700UT-PLD-LCD-IRQ", 252 .name = "M32700UT-PLD-LCD-IRQ",
290 .startup = startup_m32700ut_lcdpld_irq, 253 .irq_shutdown = shutdown_m32700ut_lcdpld,
291 .shutdown = shutdown_m32700ut_lcdpld_irq, 254 .irq_mask = mask_m32700ut_lcdpld,
292 .enable = enable_m32700ut_lcdpld_irq, 255 .irq_unmask = unmask_m32700ut_lcdpld,
293 .disable = disable_m32700ut_lcdpld_irq,
294 .ack = mask_and_ack_m32700ut_lcdpld,
295 .end = end_m32700ut_lcdpld_irq
296}; 256};
297 257
298void __init init_IRQ(void) 258void __init init_IRQ(void)
299{ 259{
300#if defined(CONFIG_SMC91X) 260#if defined(CONFIG_SMC91X)
301 /* INT#0: LAN controller on M32700UT-LAN (SMC91C111)*/ 261 /* INT#0: LAN controller on M32700UT-LAN (SMC91C111)*/
302 irq_desc[M32700UT_LAN_IRQ_LAN].status = IRQ_DISABLED; 262 set_irq_chip_and_handler(M32700UT_LAN_IRQ_LAN,
303 irq_desc[M32700UT_LAN_IRQ_LAN].chip = &m32700ut_lanpld_irq_type; 263 &m32700ut_lanpld_irq_type, handle_level_irq);
304 irq_desc[M32700UT_LAN_IRQ_LAN].action = 0;
305 irq_desc[M32700UT_LAN_IRQ_LAN].depth = 1; /* disable nested irq */
306 lanpld_icu_data[irq2lanpldirq(M32700UT_LAN_IRQ_LAN)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD02; /* "H" edge sense */ 264 lanpld_icu_data[irq2lanpldirq(M32700UT_LAN_IRQ_LAN)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD02; /* "H" edge sense */
307 disable_m32700ut_lanpld_irq(M32700UT_LAN_IRQ_LAN); 265 disable_m32700ut_lanpld_irq(M32700UT_LAN_IRQ_LAN);
308#endif /* CONFIG_SMC91X */ 266#endif /* CONFIG_SMC91X */
309 267
310 /* MFT2 : system timer */ 268 /* MFT2 : system timer */
311 irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED; 269 set_irq_chip_and_handler(M32R_IRQ_MFT2, &m32700ut_irq_type,
312 irq_desc[M32R_IRQ_MFT2].chip = &m32700ut_irq_type; 270 handle_level_irq);
313 irq_desc[M32R_IRQ_MFT2].action = 0;
314 irq_desc[M32R_IRQ_MFT2].depth = 1;
315 icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN; 271 icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN;
316 disable_m32700ut_irq(M32R_IRQ_MFT2); 272 disable_m32700ut_irq(M32R_IRQ_MFT2);
317 273
318 /* SIO0 : receive */ 274 /* SIO0 : receive */
319 irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED; 275 set_irq_chip_and_handler(M32R_IRQ_SIO0_R, &m32700ut_irq_type,
320 irq_desc[M32R_IRQ_SIO0_R].chip = &m32700ut_irq_type; 276 handle_level_irq);
321 irq_desc[M32R_IRQ_SIO0_R].action = 0;
322 irq_desc[M32R_IRQ_SIO0_R].depth = 1;
323 icu_data[M32R_IRQ_SIO0_R].icucr = 0; 277 icu_data[M32R_IRQ_SIO0_R].icucr = 0;
324 disable_m32700ut_irq(M32R_IRQ_SIO0_R); 278 disable_m32700ut_irq(M32R_IRQ_SIO0_R);
325 279
326 /* SIO0 : send */ 280 /* SIO0 : send */
327 irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED; 281 set_irq_chip_and_handler(M32R_IRQ_SIO0_S, &m32700ut_irq_type,
328 irq_desc[M32R_IRQ_SIO0_S].chip = &m32700ut_irq_type; 282 handle_level_irq);
329 irq_desc[M32R_IRQ_SIO0_S].action = 0;
330 irq_desc[M32R_IRQ_SIO0_S].depth = 1;
331 icu_data[M32R_IRQ_SIO0_S].icucr = 0; 283 icu_data[M32R_IRQ_SIO0_S].icucr = 0;
332 disable_m32700ut_irq(M32R_IRQ_SIO0_S); 284 disable_m32700ut_irq(M32R_IRQ_SIO0_S);
333 285
334 /* SIO1 : receive */ 286 /* SIO1 : receive */
335 irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED; 287 set_irq_chip_and_handler(M32R_IRQ_SIO1_R, &m32700ut_irq_type,
336 irq_desc[M32R_IRQ_SIO1_R].chip = &m32700ut_irq_type; 288 handle_level_irq);
337 irq_desc[M32R_IRQ_SIO1_R].action = 0;
338 irq_desc[M32R_IRQ_SIO1_R].depth = 1;
339 icu_data[M32R_IRQ_SIO1_R].icucr = 0; 289 icu_data[M32R_IRQ_SIO1_R].icucr = 0;
340 disable_m32700ut_irq(M32R_IRQ_SIO1_R); 290 disable_m32700ut_irq(M32R_IRQ_SIO1_R);
341 291
342 /* SIO1 : send */ 292 /* SIO1 : send */
343 irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED; 293 set_irq_chip_and_handler(M32R_IRQ_SIO1_S, &m32700ut_irq_type,
344 irq_desc[M32R_IRQ_SIO1_S].chip = &m32700ut_irq_type; 294 handle_level_irq);
345 irq_desc[M32R_IRQ_SIO1_S].action = 0;
346 irq_desc[M32R_IRQ_SIO1_S].depth = 1;
347 icu_data[M32R_IRQ_SIO1_S].icucr = 0; 295 icu_data[M32R_IRQ_SIO1_S].icucr = 0;
348 disable_m32700ut_irq(M32R_IRQ_SIO1_S); 296 disable_m32700ut_irq(M32R_IRQ_SIO1_S);
349 297
350 /* DMA1 : */ 298 /* DMA1 : */
351 irq_desc[M32R_IRQ_DMA1].status = IRQ_DISABLED; 299 set_irq_chip_and_handler(M32R_IRQ_DMA1, &m32700ut_irq_type,
352 irq_desc[M32R_IRQ_DMA1].chip = &m32700ut_irq_type; 300 handle_level_irq);
353 irq_desc[M32R_IRQ_DMA1].action = 0;
354 irq_desc[M32R_IRQ_DMA1].depth = 1;
355 icu_data[M32R_IRQ_DMA1].icucr = 0; 301 icu_data[M32R_IRQ_DMA1].icucr = 0;
356 disable_m32700ut_irq(M32R_IRQ_DMA1); 302 disable_m32700ut_irq(M32R_IRQ_DMA1);
357 303
358#ifdef CONFIG_SERIAL_M32R_PLDSIO 304#ifdef CONFIG_SERIAL_M32R_PLDSIO
359 /* INT#1: SIO0 Receive on PLD */ 305 /* INT#1: SIO0 Receive on PLD */
360 irq_desc[PLD_IRQ_SIO0_RCV].status = IRQ_DISABLED; 306 set_irq_chip_and_handler(PLD_IRQ_SIO0_RCV, &m32700ut_pld_irq_type,
361 irq_desc[PLD_IRQ_SIO0_RCV].chip = &m32700ut_pld_irq_type; 307 handle_level_irq);
362 irq_desc[PLD_IRQ_SIO0_RCV].action = 0;
363 irq_desc[PLD_IRQ_SIO0_RCV].depth = 1; /* disable nested irq */
364 pld_icu_data[irq2pldirq(PLD_IRQ_SIO0_RCV)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD03; 308 pld_icu_data[irq2pldirq(PLD_IRQ_SIO0_RCV)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD03;
365 disable_m32700ut_pld_irq(PLD_IRQ_SIO0_RCV); 309 disable_m32700ut_pld_irq(PLD_IRQ_SIO0_RCV);
366 310
367 /* INT#1: SIO0 Send on PLD */ 311 /* INT#1: SIO0 Send on PLD */
368 irq_desc[PLD_IRQ_SIO0_SND].status = IRQ_DISABLED; 312 set_irq_chip_and_handler(PLD_IRQ_SIO0_SND, &m32700ut_pld_irq_type,
369 irq_desc[PLD_IRQ_SIO0_SND].chip = &m32700ut_pld_irq_type; 313 handle_level_irq);
370 irq_desc[PLD_IRQ_SIO0_SND].action = 0;
371 irq_desc[PLD_IRQ_SIO0_SND].depth = 1; /* disable nested irq */
372 pld_icu_data[irq2pldirq(PLD_IRQ_SIO0_SND)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD03; 314 pld_icu_data[irq2pldirq(PLD_IRQ_SIO0_SND)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD03;
373 disable_m32700ut_pld_irq(PLD_IRQ_SIO0_SND); 315 disable_m32700ut_pld_irq(PLD_IRQ_SIO0_SND);
374#endif /* CONFIG_SERIAL_M32R_PLDSIO */ 316#endif /* CONFIG_SERIAL_M32R_PLDSIO */
375 317
376 /* INT#1: CFC IREQ on PLD */ 318 /* INT#1: CFC IREQ on PLD */
377 irq_desc[PLD_IRQ_CFIREQ].status = IRQ_DISABLED; 319 set_irq_chip_and_handler(PLD_IRQ_CFIREQ, &m32700ut_pld_irq_type,
378 irq_desc[PLD_IRQ_CFIREQ].chip = &m32700ut_pld_irq_type; 320 handle_level_irq);
379 irq_desc[PLD_IRQ_CFIREQ].action = 0;
380 irq_desc[PLD_IRQ_CFIREQ].depth = 1; /* disable nested irq */
381 pld_icu_data[irq2pldirq(PLD_IRQ_CFIREQ)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD01; /* 'L' level sense */ 321 pld_icu_data[irq2pldirq(PLD_IRQ_CFIREQ)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD01; /* 'L' level sense */
382 disable_m32700ut_pld_irq(PLD_IRQ_CFIREQ); 322 disable_m32700ut_pld_irq(PLD_IRQ_CFIREQ);
383 323
384 /* INT#1: CFC Insert on PLD */ 324 /* INT#1: CFC Insert on PLD */
385 irq_desc[PLD_IRQ_CFC_INSERT].status = IRQ_DISABLED; 325 set_irq_chip_and_handler(PLD_IRQ_CFC_INSERT, &m32700ut_pld_irq_type,
386 irq_desc[PLD_IRQ_CFC_INSERT].chip = &m32700ut_pld_irq_type; 326 handle_level_irq);
387 irq_desc[PLD_IRQ_CFC_INSERT].action = 0;
388 irq_desc[PLD_IRQ_CFC_INSERT].depth = 1; /* disable nested irq */
389 pld_icu_data[irq2pldirq(PLD_IRQ_CFC_INSERT)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD00; /* 'L' edge sense */ 327 pld_icu_data[irq2pldirq(PLD_IRQ_CFC_INSERT)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD00; /* 'L' edge sense */
390 disable_m32700ut_pld_irq(PLD_IRQ_CFC_INSERT); 328 disable_m32700ut_pld_irq(PLD_IRQ_CFC_INSERT);
391 329
392 /* INT#1: CFC Eject on PLD */ 330 /* INT#1: CFC Eject on PLD */
393 irq_desc[PLD_IRQ_CFC_EJECT].status = IRQ_DISABLED; 331 set_irq_chip_and_handler(PLD_IRQ_CFC_EJECT, &m32700ut_pld_irq_type,
394 irq_desc[PLD_IRQ_CFC_EJECT].chip = &m32700ut_pld_irq_type; 332 handle_level_irq);
395 irq_desc[PLD_IRQ_CFC_EJECT].action = 0;
396 irq_desc[PLD_IRQ_CFC_EJECT].depth = 1; /* disable nested irq */
397 pld_icu_data[irq2pldirq(PLD_IRQ_CFC_EJECT)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD02; /* 'H' edge sense */ 333 pld_icu_data[irq2pldirq(PLD_IRQ_CFC_EJECT)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD02; /* 'H' edge sense */
398 disable_m32700ut_pld_irq(PLD_IRQ_CFC_EJECT); 334 disable_m32700ut_pld_irq(PLD_IRQ_CFC_EJECT);
399 335
@@ -413,13 +349,11 @@ void __init init_IRQ(void)
413 349
414#if defined(CONFIG_USB) 350#if defined(CONFIG_USB)
415 outw(USBCR_OTGS, USBCR); /* USBCR: non-OTG */ 351 outw(USBCR_OTGS, USBCR); /* USBCR: non-OTG */
352 set_irq_chip_and_handler(M32700UT_LCD_IRQ_USB_INT1,
353 &m32700ut_lcdpld_irq_type, handle_level_irq);
416 354
417 irq_desc[M32700UT_LCD_IRQ_USB_INT1].status = IRQ_DISABLED; 355 lcdpld_icu_data[irq2lcdpldirq(M32700UT_LCD_IRQ_USB_INT1)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD01; /* "L" level sense */
418 irq_desc[M32700UT_LCD_IRQ_USB_INT1].chip = &m32700ut_lcdpld_irq_type; 356 disable_m32700ut_lcdpld_irq(M32700UT_LCD_IRQ_USB_INT1);
419 irq_desc[M32700UT_LCD_IRQ_USB_INT1].action = 0;
420 irq_desc[M32700UT_LCD_IRQ_USB_INT1].depth = 1;
421 lcdpld_icu_data[irq2lcdpldirq(M32700UT_LCD_IRQ_USB_INT1)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD01; /* "L" level sense */
422 disable_m32700ut_lcdpld_irq(M32700UT_LCD_IRQ_USB_INT1);
423#endif 357#endif
424 /* 358 /*
425 * INT2# is used for BAT, USB, AUDIO 359 * INT2# is used for BAT, USB, AUDIO
@@ -432,10 +366,8 @@ void __init init_IRQ(void)
432 /* 366 /*
433 * INT3# is used for AR 367 * INT3# is used for AR
434 */ 368 */
435 irq_desc[M32R_IRQ_INT3].status = IRQ_DISABLED; 369 set_irq_chip_and_handler(M32R_IRQ_INT3, &m32700ut_irq_type,
436 irq_desc[M32R_IRQ_INT3].chip = &m32700ut_irq_type; 370 handle_level_irq);
437 irq_desc[M32R_IRQ_INT3].action = 0;
438 irq_desc[M32R_IRQ_INT3].depth = 1;
439 icu_data[M32R_IRQ_INT3].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10; 371 icu_data[M32R_IRQ_INT3].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
440 disable_m32700ut_irq(M32R_IRQ_INT3); 372 disable_m32700ut_irq(M32R_IRQ_INT3);
441#endif /* CONFIG_VIDEO_M32R_AR */ 373#endif /* CONFIG_VIDEO_M32R_AR */
diff --git a/arch/m32r/platforms/mappi/setup.c b/arch/m32r/platforms/mappi/setup.c
index ea00c84d6b1b..cdd8c4574027 100644
--- a/arch/m32r/platforms/mappi/setup.c
+++ b/arch/m32r/platforms/mappi/setup.c
@@ -38,40 +38,30 @@ static void enable_mappi_irq(unsigned int irq)
38 outl(data, port); 38 outl(data, port);
39} 39}
40 40
41static void mask_and_ack_mappi(unsigned int irq) 41static void mask_mappi(struct irq_data *data)
42{ 42{
43 disable_mappi_irq(irq); 43 disable_mappi_irq(data->irq);
44} 44}
45 45
46static void end_mappi_irq(unsigned int irq) 46static void unmask_mappi(struct irq_data *data)
47{ 47{
48 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) 48 enable_mappi_irq(data->irq);
49 enable_mappi_irq(irq);
50} 49}
51 50
52static unsigned int startup_mappi_irq(unsigned int irq) 51static void shutdown_mappi(struct irq_data *data)
53{
54 enable_mappi_irq(irq);
55 return (0);
56}
57
58static void shutdown_mappi_irq(unsigned int irq)
59{ 52{
60 unsigned long port; 53 unsigned long port;
61 54
62 port = irq2port(irq); 55 port = irq2port(data->irq);
63 outl(M32R_ICUCR_ILEVEL7, port); 56 outl(M32R_ICUCR_ILEVEL7, port);
64} 57}
65 58
66static struct irq_chip mappi_irq_type = 59static struct irq_chip mappi_irq_type =
67{ 60{
68 .name = "MAPPI-IRQ", 61 .name = "MAPPI-IRQ",
69 .startup = startup_mappi_irq, 62 .irq_shutdown = shutdown_mappi,
70 .shutdown = shutdown_mappi_irq, 63 .irq_mask = mask_mappi,
71 .enable = enable_mappi_irq, 64 .irq_unmask = unmask_mappi,
72 .disable = disable_mappi_irq,
73 .ack = mask_and_ack_mappi,
74 .end = end_mappi_irq
75}; 65};
76 66
77void __init init_IRQ(void) 67void __init init_IRQ(void)
@@ -85,70 +75,54 @@ void __init init_IRQ(void)
85 75
86#ifdef CONFIG_NE2000 76#ifdef CONFIG_NE2000
87 /* INT0 : LAN controller (RTL8019AS) */ 77 /* INT0 : LAN controller (RTL8019AS) */
88 irq_desc[M32R_IRQ_INT0].status = IRQ_DISABLED; 78 set_irq_chip_and_handler(M32R_IRQ_INT0, &mappi_irq_type,
89 irq_desc[M32R_IRQ_INT0].chip = &mappi_irq_type; 79 handle_level_irq);
90 irq_desc[M32R_IRQ_INT0].action = NULL;
91 irq_desc[M32R_IRQ_INT0].depth = 1;
92 icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD11; 80 icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD11;
93 disable_mappi_irq(M32R_IRQ_INT0); 81 disable_mappi_irq(M32R_IRQ_INT0);
94#endif /* CONFIG_M32R_NE2000 */ 82#endif /* CONFIG_M32R_NE2000 */
95 83
96 /* MFT2 : system timer */ 84 /* MFT2 : system timer */
97 irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED; 85 set_irq_chip_and_handler(M32R_IRQ_MFT2, &mappi_irq_type,
98 irq_desc[M32R_IRQ_MFT2].chip = &mappi_irq_type; 86 handle_level_irq);
99 irq_desc[M32R_IRQ_MFT2].action = NULL;
100 irq_desc[M32R_IRQ_MFT2].depth = 1;
101 icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN; 87 icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN;
102 disable_mappi_irq(M32R_IRQ_MFT2); 88 disable_mappi_irq(M32R_IRQ_MFT2);
103 89
104#ifdef CONFIG_SERIAL_M32R_SIO 90#ifdef CONFIG_SERIAL_M32R_SIO
105 /* SIO0_R : uart receive data */ 91 /* SIO0_R : uart receive data */
106 irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED; 92 set_irq_chip_and_handler(M32R_IRQ_SIO0_R, &mappi_irq_type,
107 irq_desc[M32R_IRQ_SIO0_R].chip = &mappi_irq_type; 93 handle_level_irq);
108 irq_desc[M32R_IRQ_SIO0_R].action = NULL;
109 irq_desc[M32R_IRQ_SIO0_R].depth = 1;
110 icu_data[M32R_IRQ_SIO0_R].icucr = 0; 94 icu_data[M32R_IRQ_SIO0_R].icucr = 0;
111 disable_mappi_irq(M32R_IRQ_SIO0_R); 95 disable_mappi_irq(M32R_IRQ_SIO0_R);
112 96
113 /* SIO0_S : uart send data */ 97 /* SIO0_S : uart send data */
114 irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED; 98 set_irq_chip_and_handler(M32R_IRQ_SIO0_S, &mappi_irq_type,
115 irq_desc[M32R_IRQ_SIO0_S].chip = &mappi_irq_type; 99 handle_level_irq);
116 irq_desc[M32R_IRQ_SIO0_S].action = NULL;
117 irq_desc[M32R_IRQ_SIO0_S].depth = 1;
118 icu_data[M32R_IRQ_SIO0_S].icucr = 0; 100 icu_data[M32R_IRQ_SIO0_S].icucr = 0;
119 disable_mappi_irq(M32R_IRQ_SIO0_S); 101 disable_mappi_irq(M32R_IRQ_SIO0_S);
120 102
121 /* SIO1_R : uart receive data */ 103 /* SIO1_R : uart receive data */
122 irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED; 104 set_irq_chip_and_handler(M32R_IRQ_SIO1_R, &mappi_irq_type,
123 irq_desc[M32R_IRQ_SIO1_R].chip = &mappi_irq_type; 105 handle_level_irq);
124 irq_desc[M32R_IRQ_SIO1_R].action = NULL;
125 irq_desc[M32R_IRQ_SIO1_R].depth = 1;
126 icu_data[M32R_IRQ_SIO1_R].icucr = 0; 106 icu_data[M32R_IRQ_SIO1_R].icucr = 0;
127 disable_mappi_irq(M32R_IRQ_SIO1_R); 107 disable_mappi_irq(M32R_IRQ_SIO1_R);
128 108
129 /* SIO1_S : uart send data */ 109 /* SIO1_S : uart send data */
130 irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED; 110 set_irq_chip_and_handler(M32R_IRQ_SIO1_S, &mappi_irq_type,
131 irq_desc[M32R_IRQ_SIO1_S].chip = &mappi_irq_type; 111 handle_level_irq);
132 irq_desc[M32R_IRQ_SIO1_S].action = NULL;
133 irq_desc[M32R_IRQ_SIO1_S].depth = 1;
134 icu_data[M32R_IRQ_SIO1_S].icucr = 0; 112 icu_data[M32R_IRQ_SIO1_S].icucr = 0;
135 disable_mappi_irq(M32R_IRQ_SIO1_S); 113 disable_mappi_irq(M32R_IRQ_SIO1_S);
136#endif /* CONFIG_SERIAL_M32R_SIO */ 114#endif /* CONFIG_SERIAL_M32R_SIO */
137 115
138#if defined(CONFIG_M32R_PCC) 116#if defined(CONFIG_M32R_PCC)
139 /* INT1 : pccard0 interrupt */ 117 /* INT1 : pccard0 interrupt */
140 irq_desc[M32R_IRQ_INT1].status = IRQ_DISABLED; 118 set_irq_chip_and_handler(M32R_IRQ_INT1, &mappi_irq_type,
141 irq_desc[M32R_IRQ_INT1].chip = &mappi_irq_type; 119 handle_level_irq);
142 irq_desc[M32R_IRQ_INT1].action = NULL;
143 irq_desc[M32R_IRQ_INT1].depth = 1;
144 icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_IEN | M32R_ICUCR_ISMOD00; 120 icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_IEN | M32R_ICUCR_ISMOD00;
145 disable_mappi_irq(M32R_IRQ_INT1); 121 disable_mappi_irq(M32R_IRQ_INT1);
146 122
147 /* INT2 : pccard1 interrupt */ 123 /* INT2 : pccard1 interrupt */
148 irq_desc[M32R_IRQ_INT2].status = IRQ_DISABLED; 124 set_irq_chip_and_handler(M32R_IRQ_INT2, &mappi_irq_type,
149 irq_desc[M32R_IRQ_INT2].chip = &mappi_irq_type; 125 handle_level_irq);
150 irq_desc[M32R_IRQ_INT2].action = NULL;
151 irq_desc[M32R_IRQ_INT2].depth = 1;
152 icu_data[M32R_IRQ_INT2].icucr = M32R_ICUCR_IEN | M32R_ICUCR_ISMOD00; 126 icu_data[M32R_IRQ_INT2].icucr = M32R_ICUCR_IEN | M32R_ICUCR_ISMOD00;
153 disable_mappi_irq(M32R_IRQ_INT2); 127 disable_mappi_irq(M32R_IRQ_INT2);
154#endif /* CONFIG_M32RPCC */ 128#endif /* CONFIG_M32RPCC */
diff --git a/arch/m32r/platforms/mappi2/setup.c b/arch/m32r/platforms/mappi2/setup.c
index c049376d0270..9117c30ea365 100644
--- a/arch/m32r/platforms/mappi2/setup.c
+++ b/arch/m32r/platforms/mappi2/setup.c
@@ -46,126 +46,97 @@ static void enable_mappi2_irq(unsigned int irq)
46 outl(data, port); 46 outl(data, port);
47} 47}
48 48
49static void mask_and_ack_mappi2(unsigned int irq) 49static void mask_mappi2(struct irq_data *data)
50{ 50{
51 disable_mappi2_irq(irq); 51 disable_mappi2_irq(data->irq);
52} 52}
53 53
54static void end_mappi2_irq(unsigned int irq) 54static void unmask_mappi2(struct irq_data *data)
55{ 55{
56 enable_mappi2_irq(irq); 56 enable_mappi2_irq(data->irq);
57} 57}
58 58
59static unsigned int startup_mappi2_irq(unsigned int irq) 59static void shutdown_mappi2(struct irq_data *data)
60{
61 enable_mappi2_irq(irq);
62 return (0);
63}
64
65static void shutdown_mappi2_irq(unsigned int irq)
66{ 60{
67 unsigned long port; 61 unsigned long port;
68 62
69 port = irq2port(irq); 63 port = irq2port(data->irq);
70 outl(M32R_ICUCR_ILEVEL7, port); 64 outl(M32R_ICUCR_ILEVEL7, port);
71} 65}
72 66
73static struct irq_chip mappi2_irq_type = 67static struct irq_chip mappi2_irq_type =
74{ 68{
75 .name = "MAPPI2-IRQ", 69 .name = "MAPPI2-IRQ",
76 .startup = startup_mappi2_irq, 70 .irq_shutdown = shutdown_mappi2,
77 .shutdown = shutdown_mappi2_irq, 71 .irq_mask = mask_mappi2,
78 .enable = enable_mappi2_irq, 72 .irq_unmask = unmask_mappi2,
79 .disable = disable_mappi2_irq,
80 .ack = mask_and_ack_mappi2,
81 .end = end_mappi2_irq
82}; 73};
83 74
84void __init init_IRQ(void) 75void __init init_IRQ(void)
85{ 76{
86#if defined(CONFIG_SMC91X) 77#if defined(CONFIG_SMC91X)
87 /* INT0 : LAN controller (SMC91111) */ 78 /* INT0 : LAN controller (SMC91111) */
88 irq_desc[M32R_IRQ_INT0].status = IRQ_DISABLED; 79 set_irq_chip_and_handler(M32R_IRQ_INT0, &mappi2_irq_type,
89 irq_desc[M32R_IRQ_INT0].chip = &mappi2_irq_type; 80 handle_level_irq);
90 irq_desc[M32R_IRQ_INT0].action = 0;
91 irq_desc[M32R_IRQ_INT0].depth = 1;
92 icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10; 81 icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
93 disable_mappi2_irq(M32R_IRQ_INT0); 82 disable_mappi2_irq(M32R_IRQ_INT0);
94#endif /* CONFIG_SMC91X */ 83#endif /* CONFIG_SMC91X */
95 84
96 /* MFT2 : system timer */ 85 /* MFT2 : system timer */
97 irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED; 86 set_irq_chip_and_handler(M32R_IRQ_MFT2, &mappi2_irq_type,
98 irq_desc[M32R_IRQ_MFT2].chip = &mappi2_irq_type; 87 handle_level_irq);
99 irq_desc[M32R_IRQ_MFT2].action = 0;
100 irq_desc[M32R_IRQ_MFT2].depth = 1;
101 icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN; 88 icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN;
102 disable_mappi2_irq(M32R_IRQ_MFT2); 89 disable_mappi2_irq(M32R_IRQ_MFT2);
103 90
104#ifdef CONFIG_SERIAL_M32R_SIO 91#ifdef CONFIG_SERIAL_M32R_SIO
105 /* SIO0_R : uart receive data */ 92 /* SIO0_R : uart receive data */
106 irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED; 93 set_irq_chip_and_handler(M32R_IRQ_SIO0_R, &mappi2_irq_type,
107 irq_desc[M32R_IRQ_SIO0_R].chip = &mappi2_irq_type; 94 handle_level_irq);
108 irq_desc[M32R_IRQ_SIO0_R].action = 0;
109 irq_desc[M32R_IRQ_SIO0_R].depth = 1;
110 icu_data[M32R_IRQ_SIO0_R].icucr = 0; 95 icu_data[M32R_IRQ_SIO0_R].icucr = 0;
111 disable_mappi2_irq(M32R_IRQ_SIO0_R); 96 disable_mappi2_irq(M32R_IRQ_SIO0_R);
112 97
113 /* SIO0_S : uart send data */ 98 /* SIO0_S : uart send data */
114 irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED; 99 set_irq_chip_and_handler(M32R_IRQ_SIO0_S, &mappi2_irq_type,
115 irq_desc[M32R_IRQ_SIO0_S].chip = &mappi2_irq_type; 100 handle_level_irq);
116 irq_desc[M32R_IRQ_SIO0_S].action = 0;
117 irq_desc[M32R_IRQ_SIO0_S].depth = 1;
118 icu_data[M32R_IRQ_SIO0_S].icucr = 0; 101 icu_data[M32R_IRQ_SIO0_S].icucr = 0;
119 disable_mappi2_irq(M32R_IRQ_SIO0_S); 102 disable_mappi2_irq(M32R_IRQ_SIO0_S);
120 /* SIO1_R : uart receive data */ 103 /* SIO1_R : uart receive data */
121 irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED; 104 set_irq_chip_and_handler(M32R_IRQ_SIO1_R, &mappi2_irq_type,
122 irq_desc[M32R_IRQ_SIO1_R].chip = &mappi2_irq_type; 105 handle_level_irq);
123 irq_desc[M32R_IRQ_SIO1_R].action = 0;
124 irq_desc[M32R_IRQ_SIO1_R].depth = 1;
125 icu_data[M32R_IRQ_SIO1_R].icucr = 0; 106 icu_data[M32R_IRQ_SIO1_R].icucr = 0;
126 disable_mappi2_irq(M32R_IRQ_SIO1_R); 107 disable_mappi2_irq(M32R_IRQ_SIO1_R);
127 108
128 /* SIO1_S : uart send data */ 109 /* SIO1_S : uart send data */
129 irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED; 110 set_irq_chip_and_handler(M32R_IRQ_SIO1_S, &mappi2_irq_type,
130 irq_desc[M32R_IRQ_SIO1_S].chip = &mappi2_irq_type; 111 handle_level_irq);
131 irq_desc[M32R_IRQ_SIO1_S].action = 0;
132 irq_desc[M32R_IRQ_SIO1_S].depth = 1;
133 icu_data[M32R_IRQ_SIO1_S].icucr = 0; 112 icu_data[M32R_IRQ_SIO1_S].icucr = 0;
134 disable_mappi2_irq(M32R_IRQ_SIO1_S); 113 disable_mappi2_irq(M32R_IRQ_SIO1_S);
135#endif /* CONFIG_M32R_USE_DBG_CONSOLE */ 114#endif /* CONFIG_M32R_USE_DBG_CONSOLE */
136 115
137#if defined(CONFIG_USB) 116#if defined(CONFIG_USB)
138 /* INT1 : USB Host controller interrupt */ 117 /* INT1 : USB Host controller interrupt */
139 irq_desc[M32R_IRQ_INT1].status = IRQ_DISABLED; 118 set_irq_chip_and_handler(M32R_IRQ_INT1, &mappi2_irq_type,
140 irq_desc[M32R_IRQ_INT1].chip = &mappi2_irq_type; 119 handle_level_irq);
141 irq_desc[M32R_IRQ_INT1].action = 0;
142 irq_desc[M32R_IRQ_INT1].depth = 1;
143 icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_ISMOD01; 120 icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_ISMOD01;
144 disable_mappi2_irq(M32R_IRQ_INT1); 121 disable_mappi2_irq(M32R_IRQ_INT1);
145#endif /* CONFIG_USB */ 122#endif /* CONFIG_USB */
146 123
147 /* ICUCR40: CFC IREQ */ 124 /* ICUCR40: CFC IREQ */
148 irq_desc[PLD_IRQ_CFIREQ].status = IRQ_DISABLED; 125 set_irq_chip_and_handler(PLD_IRQ_CFIREQ, &mappi2_irq_type,
149 irq_desc[PLD_IRQ_CFIREQ].chip = &mappi2_irq_type; 126 handle_level_irq);
150 irq_desc[PLD_IRQ_CFIREQ].action = 0;
151 irq_desc[PLD_IRQ_CFIREQ].depth = 1; /* disable nested irq */
152 icu_data[PLD_IRQ_CFIREQ].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD01; 127 icu_data[PLD_IRQ_CFIREQ].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD01;
153 disable_mappi2_irq(PLD_IRQ_CFIREQ); 128 disable_mappi2_irq(PLD_IRQ_CFIREQ);
154 129
155#if defined(CONFIG_M32R_CFC) 130#if defined(CONFIG_M32R_CFC)
156 /* ICUCR41: CFC Insert */ 131 /* ICUCR41: CFC Insert */
157 irq_desc[PLD_IRQ_CFC_INSERT].status = IRQ_DISABLED; 132 set_irq_chip_and_handler(PLD_IRQ_CFC_INSERT, &mappi2_irq_type,
158 irq_desc[PLD_IRQ_CFC_INSERT].chip = &mappi2_irq_type; 133 handle_level_irq);
159 irq_desc[PLD_IRQ_CFC_INSERT].action = 0;
160 irq_desc[PLD_IRQ_CFC_INSERT].depth = 1; /* disable nested irq */
161 icu_data[PLD_IRQ_CFC_INSERT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD00; 134 icu_data[PLD_IRQ_CFC_INSERT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD00;
162 disable_mappi2_irq(PLD_IRQ_CFC_INSERT); 135 disable_mappi2_irq(PLD_IRQ_CFC_INSERT);
163 136
164 /* ICUCR42: CFC Eject */ 137 /* ICUCR42: CFC Eject */
165 irq_desc[PLD_IRQ_CFC_EJECT].status = IRQ_DISABLED; 138 set_irq_chip_and_handler(PLD_IRQ_CFC_EJECT, &mappi2_irq_type,
166 irq_desc[PLD_IRQ_CFC_EJECT].chip = &mappi2_irq_type; 139 handle_level_irq);
167 irq_desc[PLD_IRQ_CFC_EJECT].action = 0;
168 irq_desc[PLD_IRQ_CFC_EJECT].depth = 1; /* disable nested irq */
169 icu_data[PLD_IRQ_CFC_EJECT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10; 140 icu_data[PLD_IRQ_CFC_EJECT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
170 disable_mappi2_irq(PLD_IRQ_CFC_EJECT); 141 disable_mappi2_irq(PLD_IRQ_CFC_EJECT);
171#endif /* CONFIG_MAPPI2_CFC */ 142#endif /* CONFIG_MAPPI2_CFC */
diff --git a/arch/m32r/platforms/mappi3/setup.c b/arch/m32r/platforms/mappi3/setup.c
index 882de25c6e8c..b44f5ded2bbe 100644
--- a/arch/m32r/platforms/mappi3/setup.c
+++ b/arch/m32r/platforms/mappi3/setup.c
@@ -46,128 +46,98 @@ static void enable_mappi3_irq(unsigned int irq)
46 outl(data, port); 46 outl(data, port);
47} 47}
48 48
49static void mask_and_ack_mappi3(unsigned int irq) 49static void mask_mappi3(struct irq_data *data)
50{ 50{
51 disable_mappi3_irq(irq); 51 disable_mappi3_irq(data->irq);
52} 52}
53 53
54static void end_mappi3_irq(unsigned int irq) 54static void unmask_mappi3(struct irq_data *data)
55{ 55{
56 enable_mappi3_irq(irq); 56 enable_mappi3_irq(data->irq);
57} 57}
58 58
59static unsigned int startup_mappi3_irq(unsigned int irq) 59static void shutdown_mappi3(struct irq_data *data)
60{
61 enable_mappi3_irq(irq);
62 return (0);
63}
64
65static void shutdown_mappi3_irq(unsigned int irq)
66{ 60{
67 unsigned long port; 61 unsigned long port;
68 62
69 port = irq2port(irq); 63 port = irq2port(data->irq);
70 outl(M32R_ICUCR_ILEVEL7, port); 64 outl(M32R_ICUCR_ILEVEL7, port);
71} 65}
72 66
73static struct irq_chip mappi3_irq_type = 67static struct irq_chip mappi3_irq_type = {
74{ 68 .name = "MAPPI3-IRQ",
75 .name = "MAPPI3-IRQ", 69 .irq_shutdown = shutdown_mappi3,
76 .startup = startup_mappi3_irq, 70 .irq_mask = mask_mappi3,
77 .shutdown = shutdown_mappi3_irq, 71 .irq_unmask = unmask_mappi3,
78 .enable = enable_mappi3_irq,
79 .disable = disable_mappi3_irq,
80 .ack = mask_and_ack_mappi3,
81 .end = end_mappi3_irq
82}; 72};
83 73
84void __init init_IRQ(void) 74void __init init_IRQ(void)
85{ 75{
86#if defined(CONFIG_SMC91X) 76#if defined(CONFIG_SMC91X)
87 /* INT0 : LAN controller (SMC91111) */ 77 /* INT0 : LAN controller (SMC91111) */
88 irq_desc[M32R_IRQ_INT0].status = IRQ_DISABLED; 78 set_irq_chip_and_handler(M32R_IRQ_INT0, &mappi3_irq_type,
89 irq_desc[M32R_IRQ_INT0].chip = &mappi3_irq_type; 79 handle_level_irq);
90 irq_desc[M32R_IRQ_INT0].action = 0;
91 irq_desc[M32R_IRQ_INT0].depth = 1;
92 icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10; 80 icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
93 disable_mappi3_irq(M32R_IRQ_INT0); 81 disable_mappi3_irq(M32R_IRQ_INT0);
94#endif /* CONFIG_SMC91X */ 82#endif /* CONFIG_SMC91X */
95 83
96 /* MFT2 : system timer */ 84 /* MFT2 : system timer */
97 irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED; 85 set_irq_chip_and_handler(M32R_IRQ_MFT2, &mappi3_irq_type,
98 irq_desc[M32R_IRQ_MFT2].chip = &mappi3_irq_type; 86 handle_level_irq);
99 irq_desc[M32R_IRQ_MFT2].action = 0;
100 irq_desc[M32R_IRQ_MFT2].depth = 1;
101 icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN; 87 icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN;
102 disable_mappi3_irq(M32R_IRQ_MFT2); 88 disable_mappi3_irq(M32R_IRQ_MFT2);
103 89
104#ifdef CONFIG_SERIAL_M32R_SIO 90#ifdef CONFIG_SERIAL_M32R_SIO
105 /* SIO0_R : uart receive data */ 91 /* SIO0_R : uart receive data */
106 irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED; 92 set_irq_chip_and_handler(M32R_IRQ_SIO0_R, &mappi3_irq_type,
107 irq_desc[M32R_IRQ_SIO0_R].chip = &mappi3_irq_type; 93 handle_level_irq);
108 irq_desc[M32R_IRQ_SIO0_R].action = 0;
109 irq_desc[M32R_IRQ_SIO0_R].depth = 1;
110 icu_data[M32R_IRQ_SIO0_R].icucr = 0; 94 icu_data[M32R_IRQ_SIO0_R].icucr = 0;
111 disable_mappi3_irq(M32R_IRQ_SIO0_R); 95 disable_mappi3_irq(M32R_IRQ_SIO0_R);
112 96
113 /* SIO0_S : uart send data */ 97 /* SIO0_S : uart send data */
114 irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED; 98 set_irq_chip_and_handler(M32R_IRQ_SIO0_S, &mappi3_irq_type,
115 irq_desc[M32R_IRQ_SIO0_S].chip = &mappi3_irq_type; 99 handle_level_irq);
116 irq_desc[M32R_IRQ_SIO0_S].action = 0;
117 irq_desc[M32R_IRQ_SIO0_S].depth = 1;
118 icu_data[M32R_IRQ_SIO0_S].icucr = 0; 100 icu_data[M32R_IRQ_SIO0_S].icucr = 0;
119 disable_mappi3_irq(M32R_IRQ_SIO0_S); 101 disable_mappi3_irq(M32R_IRQ_SIO0_S);
120 /* SIO1_R : uart receive data */ 102 /* SIO1_R : uart receive data */
121 irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED; 103 set_irq_chip_and_handler(M32R_IRQ_SIO1_R, &mappi3_irq_type,
122 irq_desc[M32R_IRQ_SIO1_R].chip = &mappi3_irq_type; 104 handle_level_irq);
123 irq_desc[M32R_IRQ_SIO1_R].action = 0;
124 irq_desc[M32R_IRQ_SIO1_R].depth = 1;
125 icu_data[M32R_IRQ_SIO1_R].icucr = 0; 105 icu_data[M32R_IRQ_SIO1_R].icucr = 0;
126 disable_mappi3_irq(M32R_IRQ_SIO1_R); 106 disable_mappi3_irq(M32R_IRQ_SIO1_R);
127 107
128 /* SIO1_S : uart send data */ 108 /* SIO1_S : uart send data */
129 irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED; 109 set_irq_chip_and_handler(M32R_IRQ_SIO1_S, &mappi3_irq_type,
130 irq_desc[M32R_IRQ_SIO1_S].chip = &mappi3_irq_type; 110 handle_level_irq);
131 irq_desc[M32R_IRQ_SIO1_S].action = 0;
132 irq_desc[M32R_IRQ_SIO1_S].depth = 1;
133 icu_data[M32R_IRQ_SIO1_S].icucr = 0; 111 icu_data[M32R_IRQ_SIO1_S].icucr = 0;
134 disable_mappi3_irq(M32R_IRQ_SIO1_S); 112 disable_mappi3_irq(M32R_IRQ_SIO1_S);
135#endif /* CONFIG_M32R_USE_DBG_CONSOLE */ 113#endif /* CONFIG_M32R_USE_DBG_CONSOLE */
136 114
137#if defined(CONFIG_USB) 115#if defined(CONFIG_USB)
138 /* INT1 : USB Host controller interrupt */ 116 /* INT1 : USB Host controller interrupt */
139 irq_desc[M32R_IRQ_INT1].status = IRQ_DISABLED; 117 set_irq_chip_and_handler(M32R_IRQ_INT1, &mappi3_irq_type,
140 irq_desc[M32R_IRQ_INT1].chip = &mappi3_irq_type; 118 handle_level_irq);
141 irq_desc[M32R_IRQ_INT1].action = 0;
142 irq_desc[M32R_IRQ_INT1].depth = 1;
143 icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_ISMOD01; 119 icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_ISMOD01;
144 disable_mappi3_irq(M32R_IRQ_INT1); 120 disable_mappi3_irq(M32R_IRQ_INT1);
145#endif /* CONFIG_USB */ 121#endif /* CONFIG_USB */
146 122
147 /* CFC IREQ */ 123 /* CFC IREQ */
148 irq_desc[PLD_IRQ_CFIREQ].status = IRQ_DISABLED; 124 set_irq_chip_and_handler(PLD_IRQ_CFIREQ, &mappi3_irq_type,
149 irq_desc[PLD_IRQ_CFIREQ].chip = &mappi3_irq_type; 125 handle_level_irq);
150 irq_desc[PLD_IRQ_CFIREQ].action = 0;
151 irq_desc[PLD_IRQ_CFIREQ].depth = 1; /* disable nested irq */
152 icu_data[PLD_IRQ_CFIREQ].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD01; 126 icu_data[PLD_IRQ_CFIREQ].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD01;
153 disable_mappi3_irq(PLD_IRQ_CFIREQ); 127 disable_mappi3_irq(PLD_IRQ_CFIREQ);
154 128
155#if defined(CONFIG_M32R_CFC) 129#if defined(CONFIG_M32R_CFC)
156 /* ICUCR41: CFC Insert & eject */ 130 /* ICUCR41: CFC Insert & eject */
157 irq_desc[PLD_IRQ_CFC_INSERT].status = IRQ_DISABLED; 131 set_irq_chip_and_handler(PLD_IRQ_CFC_INSERT, &mappi3_irq_type,
158 irq_desc[PLD_IRQ_CFC_INSERT].chip = &mappi3_irq_type; 132 handle_level_irq);
159 irq_desc[PLD_IRQ_CFC_INSERT].action = 0;
160 irq_desc[PLD_IRQ_CFC_INSERT].depth = 1; /* disable nested irq */
161 icu_data[PLD_IRQ_CFC_INSERT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD00; 133 icu_data[PLD_IRQ_CFC_INSERT].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD00;
162 disable_mappi3_irq(PLD_IRQ_CFC_INSERT); 134 disable_mappi3_irq(PLD_IRQ_CFC_INSERT);
163 135
164#endif /* CONFIG_M32R_CFC */ 136#endif /* CONFIG_M32R_CFC */
165 137
166 /* IDE IREQ */ 138 /* IDE IREQ */
167 irq_desc[PLD_IRQ_IDEIREQ].status = IRQ_DISABLED; 139 set_irq_chip_and_handler(PLD_IRQ_IDEIREQ, &mappi3_irq_type,
168 irq_desc[PLD_IRQ_IDEIREQ].chip = &mappi3_irq_type; 140 handle_level_irq);
169 irq_desc[PLD_IRQ_IDEIREQ].action = 0;
170 irq_desc[PLD_IRQ_IDEIREQ].depth = 1; /* disable nested irq */
171 icu_data[PLD_IRQ_IDEIREQ].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10; 141 icu_data[PLD_IRQ_IDEIREQ].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
172 disable_mappi3_irq(PLD_IRQ_IDEIREQ); 142 disable_mappi3_irq(PLD_IRQ_IDEIREQ);
173 143
diff --git a/arch/m32r/platforms/oaks32r/setup.c b/arch/m32r/platforms/oaks32r/setup.c
index d11d93bf74f5..19a02db7b818 100644
--- a/arch/m32r/platforms/oaks32r/setup.c
+++ b/arch/m32r/platforms/oaks32r/setup.c
@@ -37,39 +37,30 @@ static void enable_oaks32r_irq(unsigned int irq)
37 outl(data, port); 37 outl(data, port);
38} 38}
39 39
40static void mask_and_ack_mappi(unsigned int irq) 40static void mask_oaks32r(struct irq_data *data)
41{ 41{
42 disable_oaks32r_irq(irq); 42 disable_oaks32r_irq(data->irq);
43} 43}
44 44
45static void end_oaks32r_irq(unsigned int irq) 45static void unmask_oaks32r(struct irq_data *data)
46{ 46{
47 enable_oaks32r_irq(irq); 47 enable_oaks32r_irq(data->irq);
48} 48}
49 49
50static unsigned int startup_oaks32r_irq(unsigned int irq) 50static void shutdown_oaks32r(struct irq_data *data)
51{
52 enable_oaks32r_irq(irq);
53 return (0);
54}
55
56static void shutdown_oaks32r_irq(unsigned int irq)
57{ 51{
58 unsigned long port; 52 unsigned long port;
59 53
60 port = irq2port(irq); 54 port = irq2port(data->irq);
61 outl(M32R_ICUCR_ILEVEL7, port); 55 outl(M32R_ICUCR_ILEVEL7, port);
62} 56}
63 57
64static struct irq_chip oaks32r_irq_type = 58static struct irq_chip oaks32r_irq_type =
65{ 59{
66 .name = "OAKS32R-IRQ", 60 .name = "OAKS32R-IRQ",
67 .startup = startup_oaks32r_irq, 61 .irq_shutdown = shutdown_oaks32r,
68 .shutdown = shutdown_oaks32r_irq, 62 .irq_mask = mask_oaks32r,
69 .enable = enable_oaks32r_irq, 63 .irq_unmask = unmask_oaks32r,
70 .disable = disable_oaks32r_irq,
71 .ack = mask_and_ack_mappi,
72 .end = end_oaks32r_irq
73}; 64};
74 65
75void __init init_IRQ(void) 66void __init init_IRQ(void)
@@ -83,52 +74,40 @@ void __init init_IRQ(void)
83 74
84#ifdef CONFIG_NE2000 75#ifdef CONFIG_NE2000
85 /* INT3 : LAN controller (RTL8019AS) */ 76 /* INT3 : LAN controller (RTL8019AS) */
86 irq_desc[M32R_IRQ_INT3].status = IRQ_DISABLED; 77 set_irq_chip_and_handler(M32R_IRQ_INT3, &oaks32r_irq_type,
87 irq_desc[M32R_IRQ_INT3].chip = &oaks32r_irq_type; 78 handle_level_irq);
88 irq_desc[M32R_IRQ_INT3].action = 0;
89 irq_desc[M32R_IRQ_INT3].depth = 1;
90 icu_data[M32R_IRQ_INT3].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10; 79 icu_data[M32R_IRQ_INT3].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
91 disable_oaks32r_irq(M32R_IRQ_INT3); 80 disable_oaks32r_irq(M32R_IRQ_INT3);
92#endif /* CONFIG_M32R_NE2000 */ 81#endif /* CONFIG_M32R_NE2000 */
93 82
94 /* MFT2 : system timer */ 83 /* MFT2 : system timer */
95 irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED; 84 set_irq_chip_and_handler(M32R_IRQ_MFT2, &oaks32r_irq_type,
96 irq_desc[M32R_IRQ_MFT2].chip = &oaks32r_irq_type; 85 handle_level_irq);
97 irq_desc[M32R_IRQ_MFT2].action = 0;
98 irq_desc[M32R_IRQ_MFT2].depth = 1;
99 icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN; 86 icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN;
100 disable_oaks32r_irq(M32R_IRQ_MFT2); 87 disable_oaks32r_irq(M32R_IRQ_MFT2);
101 88
102#ifdef CONFIG_SERIAL_M32R_SIO 89#ifdef CONFIG_SERIAL_M32R_SIO
103 /* SIO0_R : uart receive data */ 90 /* SIO0_R : uart receive data */
104 irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED; 91 set_irq_chip_and_handler(M32R_IRQ_SIO0_R, &oaks32r_irq_type,
105 irq_desc[M32R_IRQ_SIO0_R].chip = &oaks32r_irq_type; 92 handle_level_irq);
106 irq_desc[M32R_IRQ_SIO0_R].action = 0;
107 irq_desc[M32R_IRQ_SIO0_R].depth = 1;
108 icu_data[M32R_IRQ_SIO0_R].icucr = 0; 93 icu_data[M32R_IRQ_SIO0_R].icucr = 0;
109 disable_oaks32r_irq(M32R_IRQ_SIO0_R); 94 disable_oaks32r_irq(M32R_IRQ_SIO0_R);
110 95
111 /* SIO0_S : uart send data */ 96 /* SIO0_S : uart send data */
112 irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED; 97 set_irq_chip_and_handler(M32R_IRQ_SIO0_S, &oaks32r_irq_type,
113 irq_desc[M32R_IRQ_SIO0_S].chip = &oaks32r_irq_type; 98 handle_level_irq);
114 irq_desc[M32R_IRQ_SIO0_S].action = 0;
115 irq_desc[M32R_IRQ_SIO0_S].depth = 1;
116 icu_data[M32R_IRQ_SIO0_S].icucr = 0; 99 icu_data[M32R_IRQ_SIO0_S].icucr = 0;
117 disable_oaks32r_irq(M32R_IRQ_SIO0_S); 100 disable_oaks32r_irq(M32R_IRQ_SIO0_S);
118 101
119 /* SIO1_R : uart receive data */ 102 /* SIO1_R : uart receive data */
120 irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED; 103 set_irq_chip_and_handler(M32R_IRQ_SIO1_R, &oaks32r_irq_type,
121 irq_desc[M32R_IRQ_SIO1_R].chip = &oaks32r_irq_type; 104 handle_level_irq);
122 irq_desc[M32R_IRQ_SIO1_R].action = 0;
123 irq_desc[M32R_IRQ_SIO1_R].depth = 1;
124 icu_data[M32R_IRQ_SIO1_R].icucr = 0; 105 icu_data[M32R_IRQ_SIO1_R].icucr = 0;
125 disable_oaks32r_irq(M32R_IRQ_SIO1_R); 106 disable_oaks32r_irq(M32R_IRQ_SIO1_R);
126 107
127 /* SIO1_S : uart send data */ 108 /* SIO1_S : uart send data */
128 irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED; 109 set_irq_chip_and_handler(M32R_IRQ_SIO1_S, &oaks32r_irq_type,
129 irq_desc[M32R_IRQ_SIO1_S].chip = &oaks32r_irq_type; 110 handle_level_irq);
130 irq_desc[M32R_IRQ_SIO1_S].action = 0;
131 irq_desc[M32R_IRQ_SIO1_S].depth = 1;
132 icu_data[M32R_IRQ_SIO1_S].icucr = 0; 111 icu_data[M32R_IRQ_SIO1_S].icucr = 0;
133 disable_oaks32r_irq(M32R_IRQ_SIO1_S); 112 disable_oaks32r_irq(M32R_IRQ_SIO1_S);
134#endif /* CONFIG_SERIAL_M32R_SIO */ 113#endif /* CONFIG_SERIAL_M32R_SIO */
diff --git a/arch/m32r/platforms/opsput/setup.c b/arch/m32r/platforms/opsput/setup.c
index 5f3402a2fbaf..12731547e8bf 100644
--- a/arch/m32r/platforms/opsput/setup.c
+++ b/arch/m32r/platforms/opsput/setup.c
@@ -46,39 +46,30 @@ static void enable_opsput_irq(unsigned int irq)
46 outl(data, port); 46 outl(data, port);
47} 47}
48 48
49static void mask_and_ack_opsput(unsigned int irq) 49static void mask_opsput(struct irq_data *data)
50{ 50{
51 disable_opsput_irq(irq); 51 disable_opsput_irq(data->irq);
52} 52}
53 53
54static void end_opsput_irq(unsigned int irq) 54static void unmask_opsput(struct irq_data *data)
55{ 55{
56 enable_opsput_irq(irq); 56 enable_opsput_irq(data->irq);
57} 57}
58 58
59static unsigned int startup_opsput_irq(unsigned int irq) 59static void shutdown_opsput(struct irq_data *data)
60{
61 enable_opsput_irq(irq);
62 return (0);
63}
64
65static void shutdown_opsput_irq(unsigned int irq)
66{ 60{
67 unsigned long port; 61 unsigned long port;
68 62
69 port = irq2port(irq); 63 port = irq2port(data->irq);
70 outl(M32R_ICUCR_ILEVEL7, port); 64 outl(M32R_ICUCR_ILEVEL7, port);
71} 65}
72 66
73static struct irq_chip opsput_irq_type = 67static struct irq_chip opsput_irq_type =
74{ 68{
75 .name = "OPSPUT-IRQ", 69 .name = "OPSPUT-IRQ",
76 .startup = startup_opsput_irq, 70 .irq_shutdown = shutdown_opsput,
77 .shutdown = shutdown_opsput_irq, 71 .irq_mask = mask_opsput,
78 .enable = enable_opsput_irq, 72 .irq_unmask = unmask_opsput,
79 .disable = disable_opsput_irq,
80 .ack = mask_and_ack_opsput,
81 .end = end_opsput_irq
82}; 73};
83 74
84/* 75/*
@@ -100,7 +91,6 @@ static void disable_opsput_pld_irq(unsigned int irq)
100 unsigned int pldirq; 91 unsigned int pldirq;
101 92
102 pldirq = irq2pldirq(irq); 93 pldirq = irq2pldirq(irq);
103// disable_opsput_irq(M32R_IRQ_INT1);
104 port = pldirq2port(pldirq); 94 port = pldirq2port(pldirq);
105 data = pld_icu_data[pldirq].icucr|PLD_ICUCR_ILEVEL7; 95 data = pld_icu_data[pldirq].icucr|PLD_ICUCR_ILEVEL7;
106 outw(data, port); 96 outw(data, port);
@@ -112,50 +102,38 @@ static void enable_opsput_pld_irq(unsigned int irq)
112 unsigned int pldirq; 102 unsigned int pldirq;
113 103
114 pldirq = irq2pldirq(irq); 104 pldirq = irq2pldirq(irq);
115// enable_opsput_irq(M32R_IRQ_INT1);
116 port = pldirq2port(pldirq); 105 port = pldirq2port(pldirq);
117 data = pld_icu_data[pldirq].icucr|PLD_ICUCR_IEN|PLD_ICUCR_ILEVEL6; 106 data = pld_icu_data[pldirq].icucr|PLD_ICUCR_IEN|PLD_ICUCR_ILEVEL6;
118 outw(data, port); 107 outw(data, port);
119} 108}
120 109
121static void mask_and_ack_opsput_pld(unsigned int irq) 110static void mask_opsput_pld(struct irq_data *data)
122{
123 disable_opsput_pld_irq(irq);
124// mask_and_ack_opsput(M32R_IRQ_INT1);
125}
126
127static void end_opsput_pld_irq(unsigned int irq)
128{ 111{
129 enable_opsput_pld_irq(irq); 112 disable_opsput_pld_irq(data->irq);
130 end_opsput_irq(M32R_IRQ_INT1);
131} 113}
132 114
133static unsigned int startup_opsput_pld_irq(unsigned int irq) 115static void unmask_opsput_pld(struct irq_data *data)
134{ 116{
135 enable_opsput_pld_irq(irq); 117 enable_opsput_pld_irq(data->irq);
136 return (0); 118 enable_opsput_irq(M32R_IRQ_INT1);
137} 119}
138 120
139static void shutdown_opsput_pld_irq(unsigned int irq) 121static void shutdown_opsput_pld(struct irq_data *data)
140{ 122{
141 unsigned long port; 123 unsigned long port;
142 unsigned int pldirq; 124 unsigned int pldirq;
143 125
144 pldirq = irq2pldirq(irq); 126 pldirq = irq2pldirq(data->irq);
145// shutdown_opsput_irq(M32R_IRQ_INT1);
146 port = pldirq2port(pldirq); 127 port = pldirq2port(pldirq);
147 outw(PLD_ICUCR_ILEVEL7, port); 128 outw(PLD_ICUCR_ILEVEL7, port);
148} 129}
149 130
150static struct irq_chip opsput_pld_irq_type = 131static struct irq_chip opsput_pld_irq_type =
151{ 132{
152 .name = "OPSPUT-PLD-IRQ", 133 .name = "OPSPUT-PLD-IRQ",
153 .startup = startup_opsput_pld_irq, 134 .irq_shutdown = shutdown_opsput_pld,
154 .shutdown = shutdown_opsput_pld_irq, 135 .irq_mask = mask_opsput_pld,
155 .enable = enable_opsput_pld_irq, 136 .irq_unmask = unmask_opsput_pld,
156 .disable = disable_opsput_pld_irq,
157 .ack = mask_and_ack_opsput_pld,
158 .end = end_opsput_pld_irq
159}; 137};
160 138
161/* 139/*
@@ -189,42 +167,33 @@ static void enable_opsput_lanpld_irq(unsigned int irq)
189 outw(data, port); 167 outw(data, port);
190} 168}
191 169
192static void mask_and_ack_opsput_lanpld(unsigned int irq) 170static void mask_opsput_lanpld(struct irq_data *data)
193{
194 disable_opsput_lanpld_irq(irq);
195}
196
197static void end_opsput_lanpld_irq(unsigned int irq)
198{ 171{
199 enable_opsput_lanpld_irq(irq); 172 disable_opsput_lanpld_irq(data->irq);
200 end_opsput_irq(M32R_IRQ_INT0);
201} 173}
202 174
203static unsigned int startup_opsput_lanpld_irq(unsigned int irq) 175static void unmask_opsput_lanpld(struct irq_data *data)
204{ 176{
205 enable_opsput_lanpld_irq(irq); 177 enable_opsput_lanpld_irq(data->irq);
206 return (0); 178 enable_opsput_irq(M32R_IRQ_INT0);
207} 179}
208 180
209static void shutdown_opsput_lanpld_irq(unsigned int irq) 181static void shutdown_opsput_lanpld(struct irq_data *data)
210{ 182{
211 unsigned long port; 183 unsigned long port;
212 unsigned int pldirq; 184 unsigned int pldirq;
213 185
214 pldirq = irq2lanpldirq(irq); 186 pldirq = irq2lanpldirq(data->irq);
215 port = lanpldirq2port(pldirq); 187 port = lanpldirq2port(pldirq);
216 outw(PLD_ICUCR_ILEVEL7, port); 188 outw(PLD_ICUCR_ILEVEL7, port);
217} 189}
218 190
219static struct irq_chip opsput_lanpld_irq_type = 191static struct irq_chip opsput_lanpld_irq_type =
220{ 192{
221 .name = "OPSPUT-PLD-LAN-IRQ", 193 .name = "OPSPUT-PLD-LAN-IRQ",
222 .startup = startup_opsput_lanpld_irq, 194 .irq_shutdown = shutdown_opsput_lanpld,
223 .shutdown = shutdown_opsput_lanpld_irq, 195 .irq_mask = mask_opsput_lanpld,
224 .enable = enable_opsput_lanpld_irq, 196 .irq_unmask = unmask_opsput_lanpld,
225 .disable = disable_opsput_lanpld_irq,
226 .ack = mask_and_ack_opsput_lanpld,
227 .end = end_opsput_lanpld_irq
228}; 197};
229 198
230/* 199/*
@@ -258,143 +227,109 @@ static void enable_opsput_lcdpld_irq(unsigned int irq)
258 outw(data, port); 227 outw(data, port);
259} 228}
260 229
261static void mask_and_ack_opsput_lcdpld(unsigned int irq) 230static void mask_opsput_lcdpld(struct irq_data *data)
262{
263 disable_opsput_lcdpld_irq(irq);
264}
265
266static void end_opsput_lcdpld_irq(unsigned int irq)
267{ 231{
268 enable_opsput_lcdpld_irq(irq); 232 disable_opsput_lcdpld_irq(data->irq);
269 end_opsput_irq(M32R_IRQ_INT2);
270} 233}
271 234
272static unsigned int startup_opsput_lcdpld_irq(unsigned int irq) 235static void unmask_opsput_lcdpld(struct irq_data *data)
273{ 236{
274 enable_opsput_lcdpld_irq(irq); 237 enable_opsput_lcdpld_irq(data->irq);
275 return (0); 238 enable_opsput_irq(M32R_IRQ_INT2);
276} 239}
277 240
278static void shutdown_opsput_lcdpld_irq(unsigned int irq) 241static void shutdown_opsput_lcdpld(struct irq_data *data)
279{ 242{
280 unsigned long port; 243 unsigned long port;
281 unsigned int pldirq; 244 unsigned int pldirq;
282 245
283 pldirq = irq2lcdpldirq(irq); 246 pldirq = irq2lcdpldirq(data->irq);
284 port = lcdpldirq2port(pldirq); 247 port = lcdpldirq2port(pldirq);
285 outw(PLD_ICUCR_ILEVEL7, port); 248 outw(PLD_ICUCR_ILEVEL7, port);
286} 249}
287 250
288static struct irq_chip opsput_lcdpld_irq_type = 251static struct irq_chip opsput_lcdpld_irq_type = {
289{ 252 .name = "OPSPUT-PLD-LCD-IRQ",
290 "OPSPUT-PLD-LCD-IRQ", 253 .irq_shutdown = shutdown_opsput_lcdpld,
291 startup_opsput_lcdpld_irq, 254 .irq_mask = mask_opsput_lcdpld,
292 shutdown_opsput_lcdpld_irq, 255 .irq_unmask = unmask_opsput_lcdpld,
293 enable_opsput_lcdpld_irq,
294 disable_opsput_lcdpld_irq,
295 mask_and_ack_opsput_lcdpld,
296 end_opsput_lcdpld_irq
297}; 256};
298 257
299void __init init_IRQ(void) 258void __init init_IRQ(void)
300{ 259{
301#if defined(CONFIG_SMC91X) 260#if defined(CONFIG_SMC91X)
302 /* INT#0: LAN controller on OPSPUT-LAN (SMC91C111)*/ 261 /* INT#0: LAN controller on OPSPUT-LAN (SMC91C111)*/
303 irq_desc[OPSPUT_LAN_IRQ_LAN].status = IRQ_DISABLED; 262 set_irq_chip_and_handler(OPSPUT_LAN_IRQ_LAN, &opsput_lanpld_irq_type,
304 irq_desc[OPSPUT_LAN_IRQ_LAN].chip = &opsput_lanpld_irq_type; 263 handle_level_irq);
305 irq_desc[OPSPUT_LAN_IRQ_LAN].action = 0;
306 irq_desc[OPSPUT_LAN_IRQ_LAN].depth = 1; /* disable nested irq */
307 lanpld_icu_data[irq2lanpldirq(OPSPUT_LAN_IRQ_LAN)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD02; /* "H" edge sense */ 264 lanpld_icu_data[irq2lanpldirq(OPSPUT_LAN_IRQ_LAN)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD02; /* "H" edge sense */
308 disable_opsput_lanpld_irq(OPSPUT_LAN_IRQ_LAN); 265 disable_opsput_lanpld_irq(OPSPUT_LAN_IRQ_LAN);
309#endif /* CONFIG_SMC91X */ 266#endif /* CONFIG_SMC91X */
310 267
311 /* MFT2 : system timer */ 268 /* MFT2 : system timer */
312 irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED; 269 set_irq_chip_and_handler(M32R_IRQ_MFT2, &opsput_irq_type,
313 irq_desc[M32R_IRQ_MFT2].chip = &opsput_irq_type; 270 handle_level_irq);
314 irq_desc[M32R_IRQ_MFT2].action = 0;
315 irq_desc[M32R_IRQ_MFT2].depth = 1;
316 icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN; 271 icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN;
317 disable_opsput_irq(M32R_IRQ_MFT2); 272 disable_opsput_irq(M32R_IRQ_MFT2);
318 273
319 /* SIO0 : receive */ 274 /* SIO0 : receive */
320 irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED; 275 set_irq_chip_and_handler(M32R_IRQ_SIO0_R, &opsput_irq_type,
321 irq_desc[M32R_IRQ_SIO0_R].chip = &opsput_irq_type; 276 handle_level_irq);
322 irq_desc[M32R_IRQ_SIO0_R].action = 0;
323 irq_desc[M32R_IRQ_SIO0_R].depth = 1;
324 icu_data[M32R_IRQ_SIO0_R].icucr = 0; 277 icu_data[M32R_IRQ_SIO0_R].icucr = 0;
325 disable_opsput_irq(M32R_IRQ_SIO0_R); 278 disable_opsput_irq(M32R_IRQ_SIO0_R);
326 279
327 /* SIO0 : send */ 280 /* SIO0 : send */
328 irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED; 281 set_irq_chip_and_handler(M32R_IRQ_SIO0_S, &opsput_irq_type,
329 irq_desc[M32R_IRQ_SIO0_S].chip = &opsput_irq_type; 282 handle_level_irq);
330 irq_desc[M32R_IRQ_SIO0_S].action = 0;
331 irq_desc[M32R_IRQ_SIO0_S].depth = 1;
332 icu_data[M32R_IRQ_SIO0_S].icucr = 0; 283 icu_data[M32R_IRQ_SIO0_S].icucr = 0;
333 disable_opsput_irq(M32R_IRQ_SIO0_S); 284 disable_opsput_irq(M32R_IRQ_SIO0_S);
334 285
335 /* SIO1 : receive */ 286 /* SIO1 : receive */
336 irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED; 287 set_irq_chip_and_handler(M32R_IRQ_SIO1_R, &opsput_irq_type,
337 irq_desc[M32R_IRQ_SIO1_R].chip = &opsput_irq_type; 288 handle_level_irq);
338 irq_desc[M32R_IRQ_SIO1_R].action = 0;
339 irq_desc[M32R_IRQ_SIO1_R].depth = 1;
340 icu_data[M32R_IRQ_SIO1_R].icucr = 0; 289 icu_data[M32R_IRQ_SIO1_R].icucr = 0;
341 disable_opsput_irq(M32R_IRQ_SIO1_R); 290 disable_opsput_irq(M32R_IRQ_SIO1_R);
342 291
343 /* SIO1 : send */ 292 /* SIO1 : send */
344 irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED; 293 set_irq_chip_and_handler(M32R_IRQ_SIO1_S, &opsput_irq_type,
345 irq_desc[M32R_IRQ_SIO1_S].chip = &opsput_irq_type; 294 handle_level_irq);
346 irq_desc[M32R_IRQ_SIO1_S].action = 0;
347 irq_desc[M32R_IRQ_SIO1_S].depth = 1;
348 icu_data[M32R_IRQ_SIO1_S].icucr = 0; 295 icu_data[M32R_IRQ_SIO1_S].icucr = 0;
349 disable_opsput_irq(M32R_IRQ_SIO1_S); 296 disable_opsput_irq(M32R_IRQ_SIO1_S);
350 297
351 /* DMA1 : */ 298 /* DMA1 : */
352 irq_desc[M32R_IRQ_DMA1].status = IRQ_DISABLED; 299 set_irq_chip_and_handler(M32R_IRQ_DMA1, &opsput_irq_type,
353 irq_desc[M32R_IRQ_DMA1].chip = &opsput_irq_type; 300 handle_level_irq);
354 irq_desc[M32R_IRQ_DMA1].action = 0;
355 irq_desc[M32R_IRQ_DMA1].depth = 1;
356 icu_data[M32R_IRQ_DMA1].icucr = 0; 301 icu_data[M32R_IRQ_DMA1].icucr = 0;
357 disable_opsput_irq(M32R_IRQ_DMA1); 302 disable_opsput_irq(M32R_IRQ_DMA1);
358 303
359#ifdef CONFIG_SERIAL_M32R_PLDSIO 304#ifdef CONFIG_SERIAL_M32R_PLDSIO
360 /* INT#1: SIO0 Receive on PLD */ 305 /* INT#1: SIO0 Receive on PLD */
361 irq_desc[PLD_IRQ_SIO0_RCV].status = IRQ_DISABLED; 306 set_irq_chip_and_handler(PLD_IRQ_SIO0_RCV, &opsput_pld_irq_type,
362 irq_desc[PLD_IRQ_SIO0_RCV].chip = &opsput_pld_irq_type; 307 handle_level_irq);
363 irq_desc[PLD_IRQ_SIO0_RCV].action = 0;
364 irq_desc[PLD_IRQ_SIO0_RCV].depth = 1; /* disable nested irq */
365 pld_icu_data[irq2pldirq(PLD_IRQ_SIO0_RCV)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD03; 308 pld_icu_data[irq2pldirq(PLD_IRQ_SIO0_RCV)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD03;
366 disable_opsput_pld_irq(PLD_IRQ_SIO0_RCV); 309 disable_opsput_pld_irq(PLD_IRQ_SIO0_RCV);
367 310
368 /* INT#1: SIO0 Send on PLD */ 311 /* INT#1: SIO0 Send on PLD */
369 irq_desc[PLD_IRQ_SIO0_SND].status = IRQ_DISABLED; 312 set_irq_chip_and_handler(PLD_IRQ_SIO0_SND, &opsput_pld_irq_type,
370 irq_desc[PLD_IRQ_SIO0_SND].chip = &opsput_pld_irq_type; 313 handle_level_irq);
371 irq_desc[PLD_IRQ_SIO0_SND].action = 0;
372 irq_desc[PLD_IRQ_SIO0_SND].depth = 1; /* disable nested irq */
373 pld_icu_data[irq2pldirq(PLD_IRQ_SIO0_SND)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD03; 314 pld_icu_data[irq2pldirq(PLD_IRQ_SIO0_SND)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD03;
374 disable_opsput_pld_irq(PLD_IRQ_SIO0_SND); 315 disable_opsput_pld_irq(PLD_IRQ_SIO0_SND);
375#endif /* CONFIG_SERIAL_M32R_PLDSIO */ 316#endif /* CONFIG_SERIAL_M32R_PLDSIO */
376 317
377 /* INT#1: CFC IREQ on PLD */ 318 /* INT#1: CFC IREQ on PLD */
378 irq_desc[PLD_IRQ_CFIREQ].status = IRQ_DISABLED; 319 set_irq_chip_and_handler(PLD_IRQ_CFIREQ, &opsput_pld_irq_type,
379 irq_desc[PLD_IRQ_CFIREQ].chip = &opsput_pld_irq_type; 320 handle_level_irq);
380 irq_desc[PLD_IRQ_CFIREQ].action = 0;
381 irq_desc[PLD_IRQ_CFIREQ].depth = 1; /* disable nested irq */
382 pld_icu_data[irq2pldirq(PLD_IRQ_CFIREQ)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD01; /* 'L' level sense */ 321 pld_icu_data[irq2pldirq(PLD_IRQ_CFIREQ)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD01; /* 'L' level sense */
383 disable_opsput_pld_irq(PLD_IRQ_CFIREQ); 322 disable_opsput_pld_irq(PLD_IRQ_CFIREQ);
384 323
385 /* INT#1: CFC Insert on PLD */ 324 /* INT#1: CFC Insert on PLD */
386 irq_desc[PLD_IRQ_CFC_INSERT].status = IRQ_DISABLED; 325 set_irq_chip_and_handler(PLD_IRQ_CFC_INSERT, &opsput_pld_irq_type,
387 irq_desc[PLD_IRQ_CFC_INSERT].chip = &opsput_pld_irq_type; 326 handle_level_irq);
388 irq_desc[PLD_IRQ_CFC_INSERT].action = 0;
389 irq_desc[PLD_IRQ_CFC_INSERT].depth = 1; /* disable nested irq */
390 pld_icu_data[irq2pldirq(PLD_IRQ_CFC_INSERT)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD00; /* 'L' edge sense */ 327 pld_icu_data[irq2pldirq(PLD_IRQ_CFC_INSERT)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD00; /* 'L' edge sense */
391 disable_opsput_pld_irq(PLD_IRQ_CFC_INSERT); 328 disable_opsput_pld_irq(PLD_IRQ_CFC_INSERT);
392 329
393 /* INT#1: CFC Eject on PLD */ 330 /* INT#1: CFC Eject on PLD */
394 irq_desc[PLD_IRQ_CFC_EJECT].status = IRQ_DISABLED; 331 set_irq_chip_and_handler(PLD_IRQ_CFC_EJECT, &opsput_pld_irq_type,
395 irq_desc[PLD_IRQ_CFC_EJECT].chip = &opsput_pld_irq_type; 332 handle_level_irq);
396 irq_desc[PLD_IRQ_CFC_EJECT].action = 0;
397 irq_desc[PLD_IRQ_CFC_EJECT].depth = 1; /* disable nested irq */
398 pld_icu_data[irq2pldirq(PLD_IRQ_CFC_EJECT)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD02; /* 'H' edge sense */ 333 pld_icu_data[irq2pldirq(PLD_IRQ_CFC_EJECT)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD02; /* 'H' edge sense */
399 disable_opsput_pld_irq(PLD_IRQ_CFC_EJECT); 334 disable_opsput_pld_irq(PLD_IRQ_CFC_EJECT);
400 335
@@ -413,14 +348,11 @@ void __init init_IRQ(void)
413 enable_opsput_irq(M32R_IRQ_INT1); 348 enable_opsput_irq(M32R_IRQ_INT1);
414 349
415#if defined(CONFIG_USB) 350#if defined(CONFIG_USB)
416 outw(USBCR_OTGS, USBCR); /* USBCR: non-OTG */ 351 outw(USBCR_OTGS, USBCR); /* USBCR: non-OTG */
417 352 set_irq_chip_and_handler(OPSPUT_LCD_IRQ_USB_INT1,
418 irq_desc[OPSPUT_LCD_IRQ_USB_INT1].status = IRQ_DISABLED; 353 &opsput_lcdpld_irq_type, handle_level_irq);
419 irq_desc[OPSPUT_LCD_IRQ_USB_INT1].chip = &opsput_lcdpld_irq_type; 354 lcdpld_icu_data[irq2lcdpldirq(OPSPUT_LCD_IRQ_USB_INT1)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD01; /* "L" level sense */
420 irq_desc[OPSPUT_LCD_IRQ_USB_INT1].action = 0; 355 disable_opsput_lcdpld_irq(OPSPUT_LCD_IRQ_USB_INT1);
421 irq_desc[OPSPUT_LCD_IRQ_USB_INT1].depth = 1;
422 lcdpld_icu_data[irq2lcdpldirq(OPSPUT_LCD_IRQ_USB_INT1)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD01; /* "L" level sense */
423 disable_opsput_lcdpld_irq(OPSPUT_LCD_IRQ_USB_INT1);
424#endif 356#endif
425 /* 357 /*
426 * INT2# is used for BAT, USB, AUDIO 358 * INT2# is used for BAT, USB, AUDIO
@@ -433,10 +365,8 @@ void __init init_IRQ(void)
433 /* 365 /*
434 * INT3# is used for AR 366 * INT3# is used for AR
435 */ 367 */
436 irq_desc[M32R_IRQ_INT3].status = IRQ_DISABLED; 368 set_irq_chip_and_handler(M32R_IRQ_INT3, &opsput_irq_type,
437 irq_desc[M32R_IRQ_INT3].chip = &opsput_irq_type; 369 handle_level_irq);
438 irq_desc[M32R_IRQ_INT3].action = 0;
439 irq_desc[M32R_IRQ_INT3].depth = 1;
440 icu_data[M32R_IRQ_INT3].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10; 370 icu_data[M32R_IRQ_INT3].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
441 disable_opsput_irq(M32R_IRQ_INT3); 371 disable_opsput_irq(M32R_IRQ_INT3);
442#endif /* CONFIG_VIDEO_M32R_AR */ 372#endif /* CONFIG_VIDEO_M32R_AR */
diff --git a/arch/m32r/platforms/usrv/setup.c b/arch/m32r/platforms/usrv/setup.c
index 1beac7a51ed4..f3cff26d6e74 100644
--- a/arch/m32r/platforms/usrv/setup.c
+++ b/arch/m32r/platforms/usrv/setup.c
@@ -37,39 +37,30 @@ static void enable_mappi_irq(unsigned int irq)
37 outl(data, port); 37 outl(data, port);
38} 38}
39 39
40static void mask_and_ack_mappi(unsigned int irq) 40static void mask_mappi(struct irq_data *data)
41{ 41{
42 disable_mappi_irq(irq); 42 disable_mappi_irq(data->irq);
43} 43}
44 44
45static void end_mappi_irq(unsigned int irq) 45static void unmask_mappi(struct irq_data *data)
46{ 46{
47 enable_mappi_irq(irq); 47 enable_mappi_irq(data->irq);
48} 48}
49 49
50static unsigned int startup_mappi_irq(unsigned int irq) 50static void shutdown_mappi(struct irq_data *data)
51{
52 enable_mappi_irq(irq);
53 return 0;
54}
55
56static void shutdown_mappi_irq(unsigned int irq)
57{ 51{
58 unsigned long port; 52 unsigned long port;
59 53
60 port = irq2port(irq); 54 port = irq2port(data->irq);
61 outl(M32R_ICUCR_ILEVEL7, port); 55 outl(M32R_ICUCR_ILEVEL7, port);
62} 56}
63 57
64static struct irq_chip mappi_irq_type = 58static struct irq_chip mappi_irq_type =
65{ 59{
66 .name = "M32700-IRQ", 60 .name = "M32700-IRQ",
67 .startup = startup_mappi_irq, 61 .irq_shutdown = shutdown_mappi,
68 .shutdown = shutdown_mappi_irq, 62 .irq_mask = mask_mappi,
69 .enable = enable_mappi_irq, 63 .irq_unmask = unmask_mappi,
70 .disable = disable_mappi_irq,
71 .ack = mask_and_ack_mappi,
72 .end = end_mappi_irq
73}; 64};
74 65
75/* 66/*
@@ -107,42 +98,33 @@ static void enable_m32700ut_pld_irq(unsigned int irq)
107 outw(data, port); 98 outw(data, port);
108} 99}
109 100
110static void mask_and_ack_m32700ut_pld(unsigned int irq) 101static void mask_m32700ut_pld(struct irq_data *data)
111{ 102{
112 disable_m32700ut_pld_irq(irq); 103 disable_m32700ut_pld_irq(data->irq);
113} 104}
114 105
115static void end_m32700ut_pld_irq(unsigned int irq) 106static void unmask_m32700ut_pld(struct irq_data *data)
116{ 107{
117 enable_m32700ut_pld_irq(irq); 108 enable_m32700ut_pld_irq(data->irq);
118 end_mappi_irq(M32R_IRQ_INT1); 109 enable_mappi_irq(M32R_IRQ_INT1);
119}
120
121static unsigned int startup_m32700ut_pld_irq(unsigned int irq)
122{
123 enable_m32700ut_pld_irq(irq);
124 return 0;
125} 110}
126 111
127static void shutdown_m32700ut_pld_irq(unsigned int irq) 112static void shutdown_m32700ut_pld(struct irq_data *data)
128{ 113{
129 unsigned long port; 114 unsigned long port;
130 unsigned int pldirq; 115 unsigned int pldirq;
131 116
132 pldirq = irq2pldirq(irq); 117 pldirq = irq2pldirq(data->irq);
133 port = pldirq2port(pldirq); 118 port = pldirq2port(pldirq);
134 outw(PLD_ICUCR_ILEVEL7, port); 119 outw(PLD_ICUCR_ILEVEL7, port);
135} 120}
136 121
137static struct irq_chip m32700ut_pld_irq_type = 122static struct irq_chip m32700ut_pld_irq_type =
138{ 123{
139 .name = "USRV-PLD-IRQ", 124 .name = "USRV-PLD-IRQ",
140 .startup = startup_m32700ut_pld_irq, 125 .irq_shutdown = shutdown_m32700ut_pld,
141 .shutdown = shutdown_m32700ut_pld_irq, 126 .irq_mask = mask_m32700ut_pld,
142 .enable = enable_m32700ut_pld_irq, 127 .irq_unmask = unmask_m32700ut_pld,
143 .disable = disable_m32700ut_pld_irq,
144 .ack = mask_and_ack_m32700ut_pld,
145 .end = end_m32700ut_pld_irq
146}; 128};
147 129
148void __init init_IRQ(void) 130void __init init_IRQ(void)
@@ -156,53 +138,42 @@ void __init init_IRQ(void)
156 once++; 138 once++;
157 139
158 /* MFT2 : system timer */ 140 /* MFT2 : system timer */
159 irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED; 141 set_irq_chip_and_handler(M32R_IRQ_MFT2, &mappi_irq_type,
160 irq_desc[M32R_IRQ_MFT2].chip = &mappi_irq_type; 142 handle_level_irq);
161 irq_desc[M32R_IRQ_MFT2].action = 0;
162 irq_desc[M32R_IRQ_MFT2].depth = 1;
163 icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN; 143 icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN;
164 disable_mappi_irq(M32R_IRQ_MFT2); 144 disable_mappi_irq(M32R_IRQ_MFT2);
165 145
166#if defined(CONFIG_SERIAL_M32R_SIO) 146#if defined(CONFIG_SERIAL_M32R_SIO)
167 /* SIO0_R : uart receive data */ 147 /* SIO0_R : uart receive data */
168 irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED; 148 set_irq_chip_and_handler(M32R_IRQ_SIO0_R, &mappi_irq_type,
169 irq_desc[M32R_IRQ_SIO0_R].chip = &mappi_irq_type; 149 handle_level_irq);
170 irq_desc[M32R_IRQ_SIO0_R].action = 0;
171 irq_desc[M32R_IRQ_SIO0_R].depth = 1;
172 icu_data[M32R_IRQ_SIO0_R].icucr = 0; 150 icu_data[M32R_IRQ_SIO0_R].icucr = 0;
173 disable_mappi_irq(M32R_IRQ_SIO0_R); 151 disable_mappi_irq(M32R_IRQ_SIO0_R);
174 152
175 /* SIO0_S : uart send data */ 153 /* SIO0_S : uart send data */
176 irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED; 154 set_irq_chip_and_handler(M32R_IRQ_SIO0_S, &mappi_irq_type,
177 irq_desc[M32R_IRQ_SIO0_S].chip = &mappi_irq_type; 155 handle_level_irq);
178 irq_desc[M32R_IRQ_SIO0_S].action = 0;
179 irq_desc[M32R_IRQ_SIO0_S].depth = 1;
180 icu_data[M32R_IRQ_SIO0_S].icucr = 0; 156 icu_data[M32R_IRQ_SIO0_S].icucr = 0;
181 disable_mappi_irq(M32R_IRQ_SIO0_S); 157 disable_mappi_irq(M32R_IRQ_SIO0_S);
182 158
183 /* SIO1_R : uart receive data */ 159 /* SIO1_R : uart receive data */
184 irq_desc[M32R_IRQ_SIO1_R].status = IRQ_DISABLED; 160 set_irq_chip_and_handler(M32R_IRQ_SIO1_R, &mappi_irq_type,
185 irq_desc[M32R_IRQ_SIO1_R].chip = &mappi_irq_type; 161 handle_level_irq);
186 irq_desc[M32R_IRQ_SIO1_R].action = 0;
187 irq_desc[M32R_IRQ_SIO1_R].depth = 1;
188 icu_data[M32R_IRQ_SIO1_R].icucr = 0; 162 icu_data[M32R_IRQ_SIO1_R].icucr = 0;
189 disable_mappi_irq(M32R_IRQ_SIO1_R); 163 disable_mappi_irq(M32R_IRQ_SIO1_R);
190 164
191 /* SIO1_S : uart send data */ 165 /* SIO1_S : uart send data */
192 irq_desc[M32R_IRQ_SIO1_S].status = IRQ_DISABLED; 166 set_irq_chip_and_handler(M32R_IRQ_SIO1_S, &mappi_irq_type,
193 irq_desc[M32R_IRQ_SIO1_S].chip = &mappi_irq_type; 167 handle_level_irq);
194 irq_desc[M32R_IRQ_SIO1_S].action = 0;
195 irq_desc[M32R_IRQ_SIO1_S].depth = 1;
196 icu_data[M32R_IRQ_SIO1_S].icucr = 0; 168 icu_data[M32R_IRQ_SIO1_S].icucr = 0;
197 disable_mappi_irq(M32R_IRQ_SIO1_S); 169 disable_mappi_irq(M32R_IRQ_SIO1_S);
198#endif /* CONFIG_SERIAL_M32R_SIO */ 170#endif /* CONFIG_SERIAL_M32R_SIO */
199 171
200 /* INT#67-#71: CFC#0 IREQ on PLD */ 172 /* INT#67-#71: CFC#0 IREQ on PLD */
201 for (i = 0 ; i < CONFIG_M32R_CFC_NUM ; i++ ) { 173 for (i = 0 ; i < CONFIG_M32R_CFC_NUM ; i++ ) {
202 irq_desc[PLD_IRQ_CF0 + i].status = IRQ_DISABLED; 174 set_irq_chip_and_handler(PLD_IRQ_CF0 + i,
203 irq_desc[PLD_IRQ_CF0 + i].chip = &m32700ut_pld_irq_type; 175 &m32700ut_pld_irq_type,
204 irq_desc[PLD_IRQ_CF0 + i].action = 0; 176 handle_level_irq);
205 irq_desc[PLD_IRQ_CF0 + i].depth = 1; /* disable nested irq */
206 pld_icu_data[irq2pldirq(PLD_IRQ_CF0 + i)].icucr 177 pld_icu_data[irq2pldirq(PLD_IRQ_CF0 + i)].icucr
207 = PLD_ICUCR_ISMOD01; /* 'L' level sense */ 178 = PLD_ICUCR_ISMOD01; /* 'L' level sense */
208 disable_m32700ut_pld_irq(PLD_IRQ_CF0 + i); 179 disable_m32700ut_pld_irq(PLD_IRQ_CF0 + i);
@@ -210,19 +181,15 @@ void __init init_IRQ(void)
210 181
211#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE) 182#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
212 /* INT#76: 16552D#0 IREQ on PLD */ 183 /* INT#76: 16552D#0 IREQ on PLD */
213 irq_desc[PLD_IRQ_UART0].status = IRQ_DISABLED; 184 set_irq_chip_and_handler(PLD_IRQ_UART0, &m32700ut_pld_irq_type,
214 irq_desc[PLD_IRQ_UART0].chip = &m32700ut_pld_irq_type; 185 handle_level_irq);
215 irq_desc[PLD_IRQ_UART0].action = 0;
216 irq_desc[PLD_IRQ_UART0].depth = 1; /* disable nested irq */
217 pld_icu_data[irq2pldirq(PLD_IRQ_UART0)].icucr 186 pld_icu_data[irq2pldirq(PLD_IRQ_UART0)].icucr
218 = PLD_ICUCR_ISMOD03; /* 'H' level sense */ 187 = PLD_ICUCR_ISMOD03; /* 'H' level sense */
219 disable_m32700ut_pld_irq(PLD_IRQ_UART0); 188 disable_m32700ut_pld_irq(PLD_IRQ_UART0);
220 189
221 /* INT#77: 16552D#1 IREQ on PLD */ 190 /* INT#77: 16552D#1 IREQ on PLD */
222 irq_desc[PLD_IRQ_UART1].status = IRQ_DISABLED; 191 set_irq_chip_and_handler(PLD_IRQ_UART1, &m32700ut_pld_irq_type,
223 irq_desc[PLD_IRQ_UART1].chip = &m32700ut_pld_irq_type; 192 handle_level_irq);
224 irq_desc[PLD_IRQ_UART1].action = 0;
225 irq_desc[PLD_IRQ_UART1].depth = 1; /* disable nested irq */
226 pld_icu_data[irq2pldirq(PLD_IRQ_UART1)].icucr 193 pld_icu_data[irq2pldirq(PLD_IRQ_UART1)].icucr
227 = PLD_ICUCR_ISMOD03; /* 'H' level sense */ 194 = PLD_ICUCR_ISMOD03; /* 'H' level sense */
228 disable_m32700ut_pld_irq(PLD_IRQ_UART1); 195 disable_m32700ut_pld_irq(PLD_IRQ_UART1);
@@ -230,10 +197,8 @@ void __init init_IRQ(void)
230 197
231#if defined(CONFIG_IDC_AK4524) || defined(CONFIG_IDC_AK4524_MODULE) 198#if defined(CONFIG_IDC_AK4524) || defined(CONFIG_IDC_AK4524_MODULE)
232 /* INT#80: AK4524 IREQ on PLD */ 199 /* INT#80: AK4524 IREQ on PLD */
233 irq_desc[PLD_IRQ_SNDINT].status = IRQ_DISABLED; 200 set_irq_chip_and_handler(PLD_IRQ_SNDINT, &m32700ut_pld_irq_type,
234 irq_desc[PLD_IRQ_SNDINT].chip = &m32700ut_pld_irq_type; 201 handle_level_irq);
235 irq_desc[PLD_IRQ_SNDINT].action = 0;
236 irq_desc[PLD_IRQ_SNDINT].depth = 1; /* disable nested irq */
237 pld_icu_data[irq2pldirq(PLD_IRQ_SNDINT)].icucr 202 pld_icu_data[irq2pldirq(PLD_IRQ_SNDINT)].icucr
238 = PLD_ICUCR_ISMOD01; /* 'L' level sense */ 203 = PLD_ICUCR_ISMOD01; /* 'L' level sense */
239 disable_m32700ut_pld_irq(PLD_IRQ_SNDINT); 204 disable_m32700ut_pld_irq(PLD_IRQ_SNDINT);
diff --git a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig
index 704e7b92334c..8b9dacaa0f6e 100644
--- a/arch/m68knommu/Kconfig
+++ b/arch/m68knommu/Kconfig
@@ -2,6 +2,7 @@ config M68K
2 bool 2 bool
3 default y 3 default y
4 select HAVE_IDE 4 select HAVE_IDE
5 select HAVE_GENERIC_HARDIRQS
5 6
6config MMU 7config MMU
7 bool 8 bool
@@ -48,14 +49,6 @@ config GENERIC_HWEIGHT
48 bool 49 bool
49 default y 50 default y
50 51
51config GENERIC_HARDIRQS
52 bool
53 default y
54
55config GENERIC_HARDIRQS_NO__DO_IRQ
56 bool
57 default y
58
59config GENERIC_CALIBRATE_DELAY 52config GENERIC_CALIBRATE_DELAY
60 bool 53 bool
61 default y 54 default y
diff --git a/arch/m68knommu/configs/m5208evb_defconfig b/arch/m68knommu/configs/m5208evb_defconfig
index 6ac2981a2cdf..2f5655c577af 100644
--- a/arch/m68knommu/configs/m5208evb_defconfig
+++ b/arch/m68knommu/configs/m5208evb_defconfig
@@ -1,7 +1,7 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2CONFIG_LOG_BUF_SHIFT=14 2CONFIG_LOG_BUF_SHIFT=14
3# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 3# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
4CONFIG_EMBEDDED=y 4CONFIG_EXPERT=y
5# CONFIG_KALLSYMS is not set 5# CONFIG_KALLSYMS is not set
6# CONFIG_HOTPLUG is not set 6# CONFIG_HOTPLUG is not set
7# CONFIG_FUTEX is not set 7# CONFIG_FUTEX is not set
diff --git a/arch/m68knommu/configs/m5249evb_defconfig b/arch/m68knommu/configs/m5249evb_defconfig
index 14934ff8d5c3..16df72bfbd45 100644
--- a/arch/m68knommu/configs/m5249evb_defconfig
+++ b/arch/m68knommu/configs/m5249evb_defconfig
@@ -1,7 +1,7 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2CONFIG_LOG_BUF_SHIFT=14 2CONFIG_LOG_BUF_SHIFT=14
3# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 3# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
4CONFIG_EMBEDDED=y 4CONFIG_EXPERT=y
5# CONFIG_KALLSYMS is not set 5# CONFIG_KALLSYMS is not set
6# CONFIG_HOTPLUG is not set 6# CONFIG_HOTPLUG is not set
7# CONFIG_FUTEX is not set 7# CONFIG_FUTEX is not set
diff --git a/arch/m68knommu/configs/m5272c3_defconfig b/arch/m68knommu/configs/m5272c3_defconfig
index 5985a3b593d8..4e6ea50c7f33 100644
--- a/arch/m68knommu/configs/m5272c3_defconfig
+++ b/arch/m68knommu/configs/m5272c3_defconfig
@@ -1,7 +1,7 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2CONFIG_LOG_BUF_SHIFT=14 2CONFIG_LOG_BUF_SHIFT=14
3# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 3# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
4CONFIG_EMBEDDED=y 4CONFIG_EXPERT=y
5# CONFIG_KALLSYMS is not set 5# CONFIG_KALLSYMS is not set
6# CONFIG_HOTPLUG is not set 6# CONFIG_HOTPLUG is not set
7# CONFIG_FUTEX is not set 7# CONFIG_FUTEX is not set
diff --git a/arch/m68knommu/configs/m5275evb_defconfig b/arch/m68knommu/configs/m5275evb_defconfig
index 5a7857efb45d..f3dd74115a34 100644
--- a/arch/m68knommu/configs/m5275evb_defconfig
+++ b/arch/m68knommu/configs/m5275evb_defconfig
@@ -1,7 +1,7 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2CONFIG_LOG_BUF_SHIFT=14 2CONFIG_LOG_BUF_SHIFT=14
3# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 3# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
4CONFIG_EMBEDDED=y 4CONFIG_EXPERT=y
5# CONFIG_KALLSYMS is not set 5# CONFIG_KALLSYMS is not set
6# CONFIG_HOTPLUG is not set 6# CONFIG_HOTPLUG is not set
7# CONFIG_FUTEX is not set 7# CONFIG_FUTEX is not set
diff --git a/arch/m68knommu/configs/m5307c3_defconfig b/arch/m68knommu/configs/m5307c3_defconfig
index e8102018c8d4..bce0a20c3737 100644
--- a/arch/m68knommu/configs/m5307c3_defconfig
+++ b/arch/m68knommu/configs/m5307c3_defconfig
@@ -1,7 +1,7 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2CONFIG_LOG_BUF_SHIFT=14 2CONFIG_LOG_BUF_SHIFT=14
3# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 3# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
4CONFIG_EMBEDDED=y 4CONFIG_EXPERT=y
5# CONFIG_KALLSYMS is not set 5# CONFIG_KALLSYMS is not set
6# CONFIG_HOTPLUG is not set 6# CONFIG_HOTPLUG is not set
7# CONFIG_FUTEX is not set 7# CONFIG_FUTEX is not set
diff --git a/arch/m68knommu/configs/m5407c3_defconfig b/arch/m68knommu/configs/m5407c3_defconfig
index 5c124a7ba2a7..618cc32691f2 100644
--- a/arch/m68knommu/configs/m5407c3_defconfig
+++ b/arch/m68knommu/configs/m5407c3_defconfig
@@ -1,7 +1,7 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2CONFIG_LOG_BUF_SHIFT=14 2CONFIG_LOG_BUF_SHIFT=14
3# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 3# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
4CONFIG_EMBEDDED=y 4CONFIG_EXPERT=y
5# CONFIG_KALLSYMS is not set 5# CONFIG_KALLSYMS is not set
6# CONFIG_HOTPLUG is not set 6# CONFIG_HOTPLUG is not set
7# CONFIG_FUTEX is not set 7# CONFIG_FUTEX is not set
diff --git a/arch/m68knommu/defconfig b/arch/m68knommu/defconfig
index 6ac2981a2cdf..2f5655c577af 100644
--- a/arch/m68knommu/defconfig
+++ b/arch/m68knommu/defconfig
@@ -1,7 +1,7 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2CONFIG_LOG_BUF_SHIFT=14 2CONFIG_LOG_BUF_SHIFT=14
3# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 3# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
4CONFIG_EMBEDDED=y 4CONFIG_EXPERT=y
5# CONFIG_KALLSYMS is not set 5# CONFIG_KALLSYMS is not set
6# CONFIG_HOTPLUG is not set 6# CONFIG_HOTPLUG is not set
7# CONFIG_FUTEX is not set 7# CONFIG_FUTEX is not set
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index 5f5018a71a3d..31680032053e 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -15,6 +15,8 @@ config MICROBLAZE
15 select TRACING_SUPPORT 15 select TRACING_SUPPORT
16 select OF 16 select OF
17 select OF_EARLY_FLATTREE 17 select OF_EARLY_FLATTREE
18 select HAVE_GENERIC_HARDIRQS
19 select GENERIC_IRQ_PROBE
18 20
19config SWAP 21config SWAP
20 def_bool n 22 def_bool n
@@ -37,12 +39,6 @@ config GENERIC_FIND_NEXT_BIT
37config GENERIC_HWEIGHT 39config GENERIC_HWEIGHT
38 def_bool y 40 def_bool y
39 41
40config GENERIC_HARDIRQS
41 def_bool y
42
43config GENERIC_IRQ_PROBE
44 def_bool y
45
46config GENERIC_CALIBRATE_DELAY 42config GENERIC_CALIBRATE_DELAY
47 def_bool y 43 def_bool y
48 44
@@ -52,9 +48,6 @@ config GENERIC_TIME_VSYSCALL
52config GENERIC_CLOCKEVENTS 48config GENERIC_CLOCKEVENTS
53 def_bool y 49 def_bool y
54 50
55config GENERIC_HARDIRQS_NO__DO_IRQ
56 def_bool y
57
58config GENERIC_GPIO 51config GENERIC_GPIO
59 def_bool y 52 def_bool y
60 53
diff --git a/arch/microblaze/configs/mmu_defconfig b/arch/microblaze/configs/mmu_defconfig
index ab8fbe7ad90b..b3f5eecff2a7 100644
--- a/arch/microblaze/configs/mmu_defconfig
+++ b/arch/microblaze/configs/mmu_defconfig
@@ -7,7 +7,7 @@ CONFIG_BLK_DEV_INITRD=y
7CONFIG_INITRAMFS_SOURCE="rootfs.cpio" 7CONFIG_INITRAMFS_SOURCE="rootfs.cpio"
8CONFIG_INITRAMFS_COMPRESSION_GZIP=y 8CONFIG_INITRAMFS_COMPRESSION_GZIP=y
9# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 9# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
10CONFIG_EMBEDDED=y 10CONFIG_EXPERT=y
11CONFIG_KALLSYMS_ALL=y 11CONFIG_KALLSYMS_ALL=y
12CONFIG_KALLSYMS_EXTRA_PASS=y 12CONFIG_KALLSYMS_EXTRA_PASS=y
13# CONFIG_HOTPLUG is not set 13# CONFIG_HOTPLUG is not set
diff --git a/arch/microblaze/configs/nommu_defconfig b/arch/microblaze/configs/nommu_defconfig
index ebc143c5368e..0249e4b7e1d3 100644
--- a/arch/microblaze/configs/nommu_defconfig
+++ b/arch/microblaze/configs/nommu_defconfig
@@ -6,7 +6,7 @@ CONFIG_BSD_PROCESS_ACCT_V3=y
6CONFIG_IKCONFIG=y 6CONFIG_IKCONFIG=y
7CONFIG_IKCONFIG_PROC=y 7CONFIG_IKCONFIG_PROC=y
8CONFIG_SYSFS_DEPRECATED_V2=y 8CONFIG_SYSFS_DEPRECATED_V2=y
9CONFIG_EMBEDDED=y 9CONFIG_EXPERT=y
10CONFIG_KALLSYMS_ALL=y 10CONFIG_KALLSYMS_ALL=y
11CONFIG_KALLSYMS_EXTRA_PASS=y 11CONFIG_KALLSYMS_EXTRA_PASS=y
12# CONFIG_HOTPLUG is not set 12# CONFIG_HOTPLUG is not set
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 548e6cc3bc28..f5ecc0566bc2 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -793,9 +793,6 @@ config SCHED_OMIT_FRAME_POINTER
793 bool 793 bool
794 default y 794 default y
795 795
796config GENERIC_HARDIRQS_NO__DO_IRQ
797 def_bool y
798
799# 796#
800# Select some configuration options automatically based on user selections. 797# Select some configuration options automatically based on user selections.
801# 798#
diff --git a/arch/mips/Kconfig.debug b/arch/mips/Kconfig.debug
index f437cd1fafb8..5358f90b4dd2 100644
--- a/arch/mips/Kconfig.debug
+++ b/arch/mips/Kconfig.debug
@@ -7,7 +7,7 @@ config TRACE_IRQFLAGS_SUPPORT
7source "lib/Kconfig.debug" 7source "lib/Kconfig.debug"
8 8
9config EARLY_PRINTK 9config EARLY_PRINTK
10 bool "Early printk" if EMBEDDED 10 bool "Early printk" if EXPERT
11 depends on SYS_HAS_EARLY_PRINTK 11 depends on SYS_HAS_EARLY_PRINTK
12 default y 12 default y
13 help 13 help
diff --git a/arch/mips/configs/ar7_defconfig b/arch/mips/configs/ar7_defconfig
index c78c7e7e41df..6cd5a519ce5c 100644
--- a/arch/mips/configs/ar7_defconfig
+++ b/arch/mips/configs/ar7_defconfig
@@ -14,7 +14,7 @@ CONFIG_SYSFS_DEPRECATED_V2=y
14CONFIG_RELAY=y 14CONFIG_RELAY=y
15CONFIG_BLK_DEV_INITRD=y 15CONFIG_BLK_DEV_INITRD=y
16CONFIG_RD_LZMA=y 16CONFIG_RD_LZMA=y
17CONFIG_EMBEDDED=y 17CONFIG_EXPERT=y
18# CONFIG_KALLSYMS is not set 18# CONFIG_KALLSYMS is not set
19# CONFIG_ELF_CORE is not set 19# CONFIG_ELF_CORE is not set
20# CONFIG_PCSPKR_PLATFORM is not set 20# CONFIG_PCSPKR_PLATFORM is not set
diff --git a/arch/mips/configs/bcm47xx_defconfig b/arch/mips/configs/bcm47xx_defconfig
index 927d58b2cd03..22fdf2f0cc23 100644
--- a/arch/mips/configs/bcm47xx_defconfig
+++ b/arch/mips/configs/bcm47xx_defconfig
@@ -21,7 +21,7 @@ CONFIG_CGROUP_CPUACCT=y
21CONFIG_RELAY=y 21CONFIG_RELAY=y
22CONFIG_BLK_DEV_INITRD=y 22CONFIG_BLK_DEV_INITRD=y
23CONFIG_RD_LZMA=y 23CONFIG_RD_LZMA=y
24CONFIG_EMBEDDED=y 24CONFIG_EXPERT=y
25CONFIG_SLAB=y 25CONFIG_SLAB=y
26CONFIG_MODULES=y 26CONFIG_MODULES=y
27CONFIG_MODULE_UNLOAD=y 27CONFIG_MODULE_UNLOAD=y
diff --git a/arch/mips/configs/bcm63xx_defconfig b/arch/mips/configs/bcm63xx_defconfig
index b806a4e32896..919005139f5a 100644
--- a/arch/mips/configs/bcm63xx_defconfig
+++ b/arch/mips/configs/bcm63xx_defconfig
@@ -10,7 +10,7 @@ CONFIG_EXPERIMENTAL=y
10# CONFIG_SWAP is not set 10# CONFIG_SWAP is not set
11CONFIG_TINY_RCU=y 11CONFIG_TINY_RCU=y
12CONFIG_SYSFS_DEPRECATED_V2=y 12CONFIG_SYSFS_DEPRECATED_V2=y
13CONFIG_EMBEDDED=y 13CONFIG_EXPERT=y
14# CONFIG_PCSPKR_PLATFORM is not set 14# CONFIG_PCSPKR_PLATFORM is not set
15# CONFIG_FUTEX is not set 15# CONFIG_FUTEX is not set
16# CONFIG_EPOLL is not set 16# CONFIG_EPOLL is not set
diff --git a/arch/mips/configs/bigsur_defconfig b/arch/mips/configs/bigsur_defconfig
index 9749bc8758db..1cdff6b6327d 100644
--- a/arch/mips/configs/bigsur_defconfig
+++ b/arch/mips/configs/bigsur_defconfig
@@ -26,7 +26,7 @@ CONFIG_PID_NS=y
26CONFIG_NET_NS=y 26CONFIG_NET_NS=y
27CONFIG_BLK_DEV_INITRD=y 27CONFIG_BLK_DEV_INITRD=y
28# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 28# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
29CONFIG_EMBEDDED=y 29CONFIG_EXPERT=y
30# CONFIG_SYSCTL_SYSCALL is not set 30# CONFIG_SYSCTL_SYSCALL is not set
31# CONFIG_PCSPKR_PLATFORM is not set 31# CONFIG_PCSPKR_PLATFORM is not set
32CONFIG_SLAB=y 32CONFIG_SLAB=y
diff --git a/arch/mips/configs/capcella_defconfig b/arch/mips/configs/capcella_defconfig
index 502a8e9c084b..5135dc0b950a 100644
--- a/arch/mips/configs/capcella_defconfig
+++ b/arch/mips/configs/capcella_defconfig
@@ -4,7 +4,7 @@ CONFIG_EXPERIMENTAL=y
4CONFIG_SYSVIPC=y 4CONFIG_SYSVIPC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8CONFIG_SLAB=y 8CONFIG_SLAB=y
9CONFIG_MODULES=y 9CONFIG_MODULES=y
10CONFIG_MODULE_UNLOAD=y 10CONFIG_MODULE_UNLOAD=y
diff --git a/arch/mips/configs/cavium-octeon_defconfig b/arch/mips/configs/cavium-octeon_defconfig
index 3567b6f07b37..75165dfa60c1 100644
--- a/arch/mips/configs/cavium-octeon_defconfig
+++ b/arch/mips/configs/cavium-octeon_defconfig
@@ -15,7 +15,7 @@ CONFIG_SYSFS_DEPRECATED_V2=y
15CONFIG_RELAY=y 15CONFIG_RELAY=y
16CONFIG_BLK_DEV_INITRD=y 16CONFIG_BLK_DEV_INITRD=y
17# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 17# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
18CONFIG_EMBEDDED=y 18CONFIG_EXPERT=y
19# CONFIG_PCSPKR_PLATFORM is not set 19# CONFIG_PCSPKR_PLATFORM is not set
20CONFIG_SLAB=y 20CONFIG_SLAB=y
21CONFIG_MODULES=y 21CONFIG_MODULES=y
diff --git a/arch/mips/configs/cobalt_defconfig b/arch/mips/configs/cobalt_defconfig
index 6c4f7e9d3383..5419adb219a8 100644
--- a/arch/mips/configs/cobalt_defconfig
+++ b/arch/mips/configs/cobalt_defconfig
@@ -4,7 +4,7 @@ CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_RELAY=y 5CONFIG_RELAY=y
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8CONFIG_MODULES=y 8CONFIG_MODULES=y
9CONFIG_MODULE_UNLOAD=y 9CONFIG_MODULE_UNLOAD=y
10# CONFIG_BLK_DEV_BSG is not set 10# CONFIG_BLK_DEV_BSG is not set
diff --git a/arch/mips/configs/db1000_defconfig b/arch/mips/configs/db1000_defconfig
index dda158b2c8dc..4044c9e0fb73 100644
--- a/arch/mips/configs/db1000_defconfig
+++ b/arch/mips/configs/db1000_defconfig
@@ -11,7 +11,7 @@ CONFIG_POSIX_MQUEUE=y
11CONFIG_TINY_RCU=y 11CONFIG_TINY_RCU=y
12CONFIG_LOG_BUF_SHIFT=14 12CONFIG_LOG_BUF_SHIFT=14
13# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 13# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
14CONFIG_EMBEDDED=y 14CONFIG_EXPERT=y
15# CONFIG_KALLSYMS is not set 15# CONFIG_KALLSYMS is not set
16# CONFIG_PCSPKR_PLATFORM is not set 16# CONFIG_PCSPKR_PLATFORM is not set
17# CONFIG_VM_EVENT_COUNTERS is not set 17# CONFIG_VM_EVENT_COUNTERS is not set
diff --git a/arch/mips/configs/db1100_defconfig b/arch/mips/configs/db1100_defconfig
index 7e4fc76df538..c6b49938ee84 100644
--- a/arch/mips/configs/db1100_defconfig
+++ b/arch/mips/configs/db1100_defconfig
@@ -11,7 +11,7 @@ CONFIG_SYSVIPC=y
11CONFIG_POSIX_MQUEUE=y 11CONFIG_POSIX_MQUEUE=y
12CONFIG_TINY_RCU=y 12CONFIG_TINY_RCU=y
13CONFIG_LOG_BUF_SHIFT=14 13CONFIG_LOG_BUF_SHIFT=14
14CONFIG_EMBEDDED=y 14CONFIG_EXPERT=y
15# CONFIG_SYSCTL_SYSCALL is not set 15# CONFIG_SYSCTL_SYSCALL is not set
16# CONFIG_KALLSYMS is not set 16# CONFIG_KALLSYMS is not set
17# CONFIG_PCSPKR_PLATFORM is not set 17# CONFIG_PCSPKR_PLATFORM is not set
diff --git a/arch/mips/configs/db1200_defconfig b/arch/mips/configs/db1200_defconfig
index 6fe205fa7b61..1f69249b839a 100644
--- a/arch/mips/configs/db1200_defconfig
+++ b/arch/mips/configs/db1200_defconfig
@@ -12,7 +12,7 @@ CONFIG_SYSVIPC=y
12CONFIG_POSIX_MQUEUE=y 12CONFIG_POSIX_MQUEUE=y
13CONFIG_TINY_RCU=y 13CONFIG_TINY_RCU=y
14CONFIG_LOG_BUF_SHIFT=14 14CONFIG_LOG_BUF_SHIFT=14
15CONFIG_EMBEDDED=y 15CONFIG_EXPERT=y
16# CONFIG_SYSCTL_SYSCALL is not set 16# CONFIG_SYSCTL_SYSCALL is not set
17# CONFIG_KALLSYMS is not set 17# CONFIG_KALLSYMS is not set
18# CONFIG_PCSPKR_PLATFORM is not set 18# CONFIG_PCSPKR_PLATFORM is not set
diff --git a/arch/mips/configs/db1500_defconfig b/arch/mips/configs/db1500_defconfig
index a741c55448d0..b6e21c7cb6bd 100644
--- a/arch/mips/configs/db1500_defconfig
+++ b/arch/mips/configs/db1500_defconfig
@@ -10,7 +10,7 @@ CONFIG_LOCALVERSION="-db1500"
10CONFIG_KERNEL_LZMA=y 10CONFIG_KERNEL_LZMA=y
11CONFIG_SYSVIPC=y 11CONFIG_SYSVIPC=y
12CONFIG_LOG_BUF_SHIFT=14 12CONFIG_LOG_BUF_SHIFT=14
13CONFIG_EMBEDDED=y 13CONFIG_EXPERT=y
14# CONFIG_KALLSYMS is not set 14# CONFIG_KALLSYMS is not set
15# CONFIG_PCSPKR_PLATFORM is not set 15# CONFIG_PCSPKR_PLATFORM is not set
16# CONFIG_VM_EVENT_COUNTERS is not set 16# CONFIG_VM_EVENT_COUNTERS is not set
diff --git a/arch/mips/configs/db1550_defconfig b/arch/mips/configs/db1550_defconfig
index cd32dd8c8008..798a553c9e80 100644
--- a/arch/mips/configs/db1550_defconfig
+++ b/arch/mips/configs/db1550_defconfig
@@ -11,7 +11,7 @@ CONFIG_SYSVIPC=y
11CONFIG_POSIX_MQUEUE=y 11CONFIG_POSIX_MQUEUE=y
12CONFIG_TINY_RCU=y 12CONFIG_TINY_RCU=y
13CONFIG_LOG_BUF_SHIFT=14 13CONFIG_LOG_BUF_SHIFT=14
14CONFIG_EMBEDDED=y 14CONFIG_EXPERT=y
15# CONFIG_SYSCTL_SYSCALL is not set 15# CONFIG_SYSCTL_SYSCALL is not set
16# CONFIG_KALLSYMS is not set 16# CONFIG_KALLSYMS is not set
17# CONFIG_PCSPKR_PLATFORM is not set 17# CONFIG_PCSPKR_PLATFORM is not set
diff --git a/arch/mips/configs/decstation_defconfig b/arch/mips/configs/decstation_defconfig
index b15bfd1e69c8..87d0340837aa 100644
--- a/arch/mips/configs/decstation_defconfig
+++ b/arch/mips/configs/decstation_defconfig
@@ -4,7 +4,7 @@ CONFIG_EXPERIMENTAL=y
4CONFIG_SYSVIPC=y 4CONFIG_SYSVIPC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8# CONFIG_SYSCTL_SYSCALL is not set 8# CONFIG_SYSCTL_SYSCALL is not set
9# CONFIG_HOTPLUG is not set 9# CONFIG_HOTPLUG is not set
10CONFIG_SLAB=y 10CONFIG_SLAB=y
diff --git a/arch/mips/configs/e55_defconfig b/arch/mips/configs/e55_defconfig
index 0b60c06a943d..0126e66d60cb 100644
--- a/arch/mips/configs/e55_defconfig
+++ b/arch/mips/configs/e55_defconfig
@@ -4,7 +4,7 @@ CONFIG_EXPERIMENTAL=y
4CONFIG_SYSVIPC=y 4CONFIG_SYSVIPC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8# CONFIG_HOTPLUG is not set 8# CONFIG_HOTPLUG is not set
9CONFIG_SLAB=y 9CONFIG_SLAB=y
10CONFIG_MODULES=y 10CONFIG_MODULES=y
diff --git a/arch/mips/configs/fuloong2e_defconfig b/arch/mips/configs/fuloong2e_defconfig
index 63944a14b816..e5b73de08fc5 100644
--- a/arch/mips/configs/fuloong2e_defconfig
+++ b/arch/mips/configs/fuloong2e_defconfig
@@ -17,7 +17,7 @@ CONFIG_NAMESPACES=y
17CONFIG_USER_NS=y 17CONFIG_USER_NS=y
18CONFIG_PID_NS=y 18CONFIG_PID_NS=y
19# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 19# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
20CONFIG_EMBEDDED=y 20CONFIG_EXPERT=y
21# CONFIG_PCSPKR_PLATFORM is not set 21# CONFIG_PCSPKR_PLATFORM is not set
22# CONFIG_COMPAT_BRK is not set 22# CONFIG_COMPAT_BRK is not set
23CONFIG_SLAB=y 23CONFIG_SLAB=y
diff --git a/arch/mips/configs/gpr_defconfig b/arch/mips/configs/gpr_defconfig
index 53edc134f274..48a40aefaf58 100644
--- a/arch/mips/configs/gpr_defconfig
+++ b/arch/mips/configs/gpr_defconfig
@@ -11,7 +11,7 @@ CONFIG_BSD_PROCESS_ACCT_V3=y
11CONFIG_RELAY=y 11CONFIG_RELAY=y
12CONFIG_BLK_DEV_INITRD=y 12CONFIG_BLK_DEV_INITRD=y
13# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 13# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
14CONFIG_EMBEDDED=y 14CONFIG_EXPERT=y
15CONFIG_SLAB=y 15CONFIG_SLAB=y
16CONFIG_PROFILING=y 16CONFIG_PROFILING=y
17CONFIG_MODULES=y 17CONFIG_MODULES=y
diff --git a/arch/mips/configs/ip22_defconfig b/arch/mips/configs/ip22_defconfig
index 36de199f4c27..d1606569b001 100644
--- a/arch/mips/configs/ip22_defconfig
+++ b/arch/mips/configs/ip22_defconfig
@@ -17,7 +17,7 @@ CONFIG_IPC_NS=y
17CONFIG_USER_NS=y 17CONFIG_USER_NS=y
18CONFIG_PID_NS=y 18CONFIG_PID_NS=y
19# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 19# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
20CONFIG_EMBEDDED=y 20CONFIG_EXPERT=y
21# CONFIG_HOTPLUG is not set 21# CONFIG_HOTPLUG is not set
22# CONFIG_PCSPKR_PLATFORM is not set 22# CONFIG_PCSPKR_PLATFORM is not set
23# CONFIG_COMPAT_BRK is not set 23# CONFIG_COMPAT_BRK is not set
diff --git a/arch/mips/configs/ip27_defconfig b/arch/mips/configs/ip27_defconfig
index 4b16c48b0c36..0e36abcd39cc 100644
--- a/arch/mips/configs/ip27_defconfig
+++ b/arch/mips/configs/ip27_defconfig
@@ -15,7 +15,7 @@ CONFIG_CGROUPS=y
15CONFIG_CPUSETS=y 15CONFIG_CPUSETS=y
16CONFIG_RELAY=y 16CONFIG_RELAY=y
17# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 17# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
18CONFIG_EMBEDDED=y 18CONFIG_EXPERT=y
19# CONFIG_PCSPKR_PLATFORM is not set 19# CONFIG_PCSPKR_PLATFORM is not set
20CONFIG_SLAB=y 20CONFIG_SLAB=y
21CONFIG_MODULES=y 21CONFIG_MODULES=y
diff --git a/arch/mips/configs/ip28_defconfig b/arch/mips/configs/ip28_defconfig
index 98f2c7736e87..4dbf6269b3f9 100644
--- a/arch/mips/configs/ip28_defconfig
+++ b/arch/mips/configs/ip28_defconfig
@@ -8,7 +8,7 @@ CONFIG_IKCONFIG_PROC=y
8CONFIG_LOG_BUF_SHIFT=14 8CONFIG_LOG_BUF_SHIFT=14
9CONFIG_RELAY=y 9CONFIG_RELAY=y
10# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 10# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
11CONFIG_EMBEDDED=y 11CONFIG_EXPERT=y
12# CONFIG_HOTPLUG is not set 12# CONFIG_HOTPLUG is not set
13CONFIG_SLAB=y 13CONFIG_SLAB=y
14CONFIG_MODULES=y 14CONFIG_MODULES=y
diff --git a/arch/mips/configs/ip32_defconfig b/arch/mips/configs/ip32_defconfig
index 5bea99b26fa8..7bbd52194fc3 100644
--- a/arch/mips/configs/ip32_defconfig
+++ b/arch/mips/configs/ip32_defconfig
@@ -10,7 +10,7 @@ CONFIG_IKCONFIG_PROC=y
10CONFIG_LOG_BUF_SHIFT=14 10CONFIG_LOG_BUF_SHIFT=14
11CONFIG_SYSFS_DEPRECATED_V2=y 11CONFIG_SYSFS_DEPRECATED_V2=y
12CONFIG_RELAY=y 12CONFIG_RELAY=y
13CONFIG_EMBEDDED=y 13CONFIG_EXPERT=y
14CONFIG_SLAB=y 14CONFIG_SLAB=y
15CONFIG_PROFILING=y 15CONFIG_PROFILING=y
16CONFIG_OPROFILE=m 16CONFIG_OPROFILE=m
diff --git a/arch/mips/configs/jazz_defconfig b/arch/mips/configs/jazz_defconfig
index 6ae46bcdb20b..92a60aecad5c 100644
--- a/arch/mips/configs/jazz_defconfig
+++ b/arch/mips/configs/jazz_defconfig
@@ -10,7 +10,7 @@ CONFIG_IKCONFIG_PROC=y
10CONFIG_LOG_BUF_SHIFT=14 10CONFIG_LOG_BUF_SHIFT=14
11CONFIG_RELAY=y 11CONFIG_RELAY=y
12# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 12# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
13CONFIG_EMBEDDED=y 13CONFIG_EXPERT=y
14# CONFIG_SYSCTL_SYSCALL is not set 14# CONFIG_SYSCTL_SYSCALL is not set
15CONFIG_SLAB=y 15CONFIG_SLAB=y
16CONFIG_MODULES=y 16CONFIG_MODULES=y
diff --git a/arch/mips/configs/jmr3927_defconfig b/arch/mips/configs/jmr3927_defconfig
index bf24e9309b9c..db5705e18b36 100644
--- a/arch/mips/configs/jmr3927_defconfig
+++ b/arch/mips/configs/jmr3927_defconfig
@@ -4,7 +4,7 @@ CONFIG_TOSHIBA_JMR3927=y
4CONFIG_SYSVIPC=y 4CONFIG_SYSVIPC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_SYSFS_DEPRECATED_V2=y 6CONFIG_SYSFS_DEPRECATED_V2=y
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8# CONFIG_HOTPLUG is not set 8# CONFIG_HOTPLUG is not set
9# CONFIG_PCSPKR_PLATFORM is not set 9# CONFIG_PCSPKR_PLATFORM is not set
10CONFIG_SLAB=y 10CONFIG_SLAB=y
diff --git a/arch/mips/configs/lasat_defconfig b/arch/mips/configs/lasat_defconfig
index 6447261c61d0..d9f3db29ab95 100644
--- a/arch/mips/configs/lasat_defconfig
+++ b/arch/mips/configs/lasat_defconfig
@@ -8,7 +8,7 @@ CONFIG_HZ_1000=y
8CONFIG_EXPERIMENTAL=y 8CONFIG_EXPERIMENTAL=y
9CONFIG_SYSVIPC=y 9CONFIG_SYSVIPC=y
10CONFIG_LOG_BUF_SHIFT=14 10CONFIG_LOG_BUF_SHIFT=14
11CONFIG_EMBEDDED=y 11CONFIG_EXPERT=y
12# CONFIG_SYSCTL_SYSCALL is not set 12# CONFIG_SYSCTL_SYSCALL is not set
13# CONFIG_KALLSYMS is not set 13# CONFIG_KALLSYMS is not set
14# CONFIG_HOTPLUG is not set 14# CONFIG_HOTPLUG is not set
diff --git a/arch/mips/configs/lemote2f_defconfig b/arch/mips/configs/lemote2f_defconfig
index f7033f3a5822..167c1d07b809 100644
--- a/arch/mips/configs/lemote2f_defconfig
+++ b/arch/mips/configs/lemote2f_defconfig
@@ -21,7 +21,7 @@ CONFIG_BLK_DEV_INITRD=y
21CONFIG_RD_BZIP2=y 21CONFIG_RD_BZIP2=y
22CONFIG_RD_LZMA=y 22CONFIG_RD_LZMA=y
23# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 23# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
24CONFIG_EMBEDDED=y 24CONFIG_EXPERT=y
25CONFIG_PROFILING=y 25CONFIG_PROFILING=y
26CONFIG_OPROFILE=m 26CONFIG_OPROFILE=m
27CONFIG_MODULES=y 27CONFIG_MODULES=y
diff --git a/arch/mips/configs/malta_defconfig b/arch/mips/configs/malta_defconfig
index 9d03b68aece8..7270f3183bda 100644
--- a/arch/mips/configs/malta_defconfig
+++ b/arch/mips/configs/malta_defconfig
@@ -15,7 +15,7 @@ CONFIG_UTS_NS=y
15CONFIG_IPC_NS=y 15CONFIG_IPC_NS=y
16CONFIG_PID_NS=y 16CONFIG_PID_NS=y
17# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 17# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
18CONFIG_EMBEDDED=y 18CONFIG_EXPERT=y
19# CONFIG_SYSCTL_SYSCALL is not set 19# CONFIG_SYSCTL_SYSCALL is not set
20# CONFIG_COMPAT_BRK is not set 20# CONFIG_COMPAT_BRK is not set
21CONFIG_SLAB=y 21CONFIG_SLAB=y
diff --git a/arch/mips/configs/markeins_defconfig b/arch/mips/configs/markeins_defconfig
index 86bf001babe9..9c9a123016c0 100644
--- a/arch/mips/configs/markeins_defconfig
+++ b/arch/mips/configs/markeins_defconfig
@@ -9,7 +9,7 @@ CONFIG_IKCONFIG=y
9CONFIG_IKCONFIG_PROC=y 9CONFIG_IKCONFIG_PROC=y
10CONFIG_LOG_BUF_SHIFT=14 10CONFIG_LOG_BUF_SHIFT=14
11# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 11# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
12CONFIG_EMBEDDED=y 12CONFIG_EXPERT=y
13CONFIG_SLAB=y 13CONFIG_SLAB=y
14CONFIG_MODULES=y 14CONFIG_MODULES=y
15CONFIG_MODULE_UNLOAD=y 15CONFIG_MODULE_UNLOAD=y
diff --git a/arch/mips/configs/mipssim_defconfig b/arch/mips/configs/mipssim_defconfig
index 4925f507dc21..b5ad7387bbb0 100644
--- a/arch/mips/configs/mipssim_defconfig
+++ b/arch/mips/configs/mipssim_defconfig
@@ -7,7 +7,7 @@ CONFIG_EXPERIMENTAL=y
7CONFIG_SYSVIPC=y 7CONFIG_SYSVIPC=y
8CONFIG_LOG_BUF_SHIFT=14 8CONFIG_LOG_BUF_SHIFT=14
9# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 9# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
10CONFIG_EMBEDDED=y 10CONFIG_EXPERT=y
11CONFIG_SLAB=y 11CONFIG_SLAB=y
12CONFIG_MODULES=y 12CONFIG_MODULES=y
13CONFIG_MODULE_UNLOAD=y 13CONFIG_MODULE_UNLOAD=y
diff --git a/arch/mips/configs/mpc30x_defconfig b/arch/mips/configs/mpc30x_defconfig
index efb779f8f6fe..c16de9812920 100644
--- a/arch/mips/configs/mpc30x_defconfig
+++ b/arch/mips/configs/mpc30x_defconfig
@@ -5,7 +5,7 @@ CONFIG_SYSVIPC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_RELAY=y 6CONFIG_RELAY=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9CONFIG_SLAB=y 9CONFIG_SLAB=y
10CONFIG_MODULES=y 10CONFIG_MODULES=y
11CONFIG_MODULE_UNLOAD=y 11CONFIG_MODULE_UNLOAD=y
diff --git a/arch/mips/configs/msp71xx_defconfig b/arch/mips/configs/msp71xx_defconfig
index ab051458452b..d1142e9cd9a1 100644
--- a/arch/mips/configs/msp71xx_defconfig
+++ b/arch/mips/configs/msp71xx_defconfig
@@ -8,7 +8,7 @@ CONFIG_LOCALVERSION="-pmc"
8CONFIG_SYSVIPC=y 8CONFIG_SYSVIPC=y
9CONFIG_LOG_BUF_SHIFT=14 9CONFIG_LOG_BUF_SHIFT=14
10# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 10# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
11CONFIG_EMBEDDED=y 11CONFIG_EXPERT=y
12# CONFIG_SHMEM is not set 12# CONFIG_SHMEM is not set
13CONFIG_SLAB=y 13CONFIG_SLAB=y
14CONFIG_MODULES=y 14CONFIG_MODULES=y
diff --git a/arch/mips/configs/mtx1_defconfig b/arch/mips/configs/mtx1_defconfig
index 814699754e0d..a97a42c6b2c8 100644
--- a/arch/mips/configs/mtx1_defconfig
+++ b/arch/mips/configs/mtx1_defconfig
@@ -11,7 +11,7 @@ CONFIG_AUDIT=y
11CONFIG_RELAY=y 11CONFIG_RELAY=y
12CONFIG_BLK_DEV_INITRD=y 12CONFIG_BLK_DEV_INITRD=y
13# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 13# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
14CONFIG_EMBEDDED=y 14CONFIG_EXPERT=y
15CONFIG_SLAB=y 15CONFIG_SLAB=y
16CONFIG_PROFILING=y 16CONFIG_PROFILING=y
17CONFIG_OPROFILE=m 17CONFIG_OPROFILE=m
diff --git a/arch/mips/configs/pb1100_defconfig b/arch/mips/configs/pb1100_defconfig
index 1597aa1842fa..75eb1b1f316c 100644
--- a/arch/mips/configs/pb1100_defconfig
+++ b/arch/mips/configs/pb1100_defconfig
@@ -11,7 +11,7 @@ CONFIG_SYSVIPC=y
11CONFIG_POSIX_MQUEUE=y 11CONFIG_POSIX_MQUEUE=y
12CONFIG_TINY_RCU=y 12CONFIG_TINY_RCU=y
13CONFIG_LOG_BUF_SHIFT=14 13CONFIG_LOG_BUF_SHIFT=14
14CONFIG_EMBEDDED=y 14CONFIG_EXPERT=y
15# CONFIG_SYSCTL_SYSCALL is not set 15# CONFIG_SYSCTL_SYSCALL is not set
16# CONFIG_KALLSYMS is not set 16# CONFIG_KALLSYMS is not set
17# CONFIG_PCSPKR_PLATFORM is not set 17# CONFIG_PCSPKR_PLATFORM is not set
diff --git a/arch/mips/configs/pb1200_defconfig b/arch/mips/configs/pb1200_defconfig
index 96f0d43cf08b..dcbe2704e5ed 100644
--- a/arch/mips/configs/pb1200_defconfig
+++ b/arch/mips/configs/pb1200_defconfig
@@ -12,7 +12,7 @@ CONFIG_SYSVIPC=y
12CONFIG_POSIX_MQUEUE=y 12CONFIG_POSIX_MQUEUE=y
13CONFIG_TINY_RCU=y 13CONFIG_TINY_RCU=y
14CONFIG_LOG_BUF_SHIFT=14 14CONFIG_LOG_BUF_SHIFT=14
15CONFIG_EMBEDDED=y 15CONFIG_EXPERT=y
16# CONFIG_SYSCTL_SYSCALL is not set 16# CONFIG_SYSCTL_SYSCALL is not set
17# CONFIG_KALLSYMS is not set 17# CONFIG_KALLSYMS is not set
18# CONFIG_PCSPKR_PLATFORM is not set 18# CONFIG_PCSPKR_PLATFORM is not set
diff --git a/arch/mips/configs/pb1500_defconfig b/arch/mips/configs/pb1500_defconfig
index b4bfd4823458..fa00487146f8 100644
--- a/arch/mips/configs/pb1500_defconfig
+++ b/arch/mips/configs/pb1500_defconfig
@@ -11,7 +11,7 @@ CONFIG_SYSVIPC=y
11CONFIG_POSIX_MQUEUE=y 11CONFIG_POSIX_MQUEUE=y
12CONFIG_TINY_RCU=y 12CONFIG_TINY_RCU=y
13CONFIG_LOG_BUF_SHIFT=14 13CONFIG_LOG_BUF_SHIFT=14
14CONFIG_EMBEDDED=y 14CONFIG_EXPERT=y
15# CONFIG_SYSCTL_SYSCALL is not set 15# CONFIG_SYSCTL_SYSCALL is not set
16# CONFIG_KALLSYMS is not set 16# CONFIG_KALLSYMS is not set
17# CONFIG_PCSPKR_PLATFORM is not set 17# CONFIG_PCSPKR_PLATFORM is not set
diff --git a/arch/mips/configs/pb1550_defconfig b/arch/mips/configs/pb1550_defconfig
index 5a660024d22a..e83d6497e8b4 100644
--- a/arch/mips/configs/pb1550_defconfig
+++ b/arch/mips/configs/pb1550_defconfig
@@ -11,7 +11,7 @@ CONFIG_SYSVIPC=y
11CONFIG_POSIX_MQUEUE=y 11CONFIG_POSIX_MQUEUE=y
12CONFIG_TINY_RCU=y 12CONFIG_TINY_RCU=y
13CONFIG_LOG_BUF_SHIFT=14 13CONFIG_LOG_BUF_SHIFT=14
14CONFIG_EMBEDDED=y 14CONFIG_EXPERT=y
15# CONFIG_SYSCTL_SYSCALL is not set 15# CONFIG_SYSCTL_SYSCALL is not set
16# CONFIG_KALLSYMS is not set 16# CONFIG_KALLSYMS is not set
17# CONFIG_PCSPKR_PLATFORM is not set 17# CONFIG_PCSPKR_PLATFORM is not set
diff --git a/arch/mips/configs/pnx8335-stb225_defconfig b/arch/mips/configs/pnx8335-stb225_defconfig
index 39926a1a96b6..f2925769dfa3 100644
--- a/arch/mips/configs/pnx8335-stb225_defconfig
+++ b/arch/mips/configs/pnx8335-stb225_defconfig
@@ -11,7 +11,7 @@ CONFIG_EXPERIMENTAL=y
11CONFIG_SYSVIPC=y 11CONFIG_SYSVIPC=y
12CONFIG_LOG_BUF_SHIFT=14 12CONFIG_LOG_BUF_SHIFT=14
13CONFIG_SYSFS_DEPRECATED_V2=y 13CONFIG_SYSFS_DEPRECATED_V2=y
14CONFIG_EMBEDDED=y 14CONFIG_EXPERT=y
15CONFIG_SLAB=y 15CONFIG_SLAB=y
16CONFIG_MODULES=y 16CONFIG_MODULES=y
17CONFIG_MODULE_UNLOAD=y 17CONFIG_MODULE_UNLOAD=y
diff --git a/arch/mips/configs/pnx8550-jbs_defconfig b/arch/mips/configs/pnx8550-jbs_defconfig
index 3376bc8616cc..1d1f2067f3e6 100644
--- a/arch/mips/configs/pnx8550-jbs_defconfig
+++ b/arch/mips/configs/pnx8550-jbs_defconfig
@@ -6,7 +6,7 @@ CONFIG_IKCONFIG_PROC=y
6CONFIG_LOG_BUF_SHIFT=14 6CONFIG_LOG_BUF_SHIFT=14
7CONFIG_BLK_DEV_INITRD=y 7CONFIG_BLK_DEV_INITRD=y
8# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 8# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
9CONFIG_EMBEDDED=y 9CONFIG_EXPERT=y
10# CONFIG_SYSCTL_SYSCALL is not set 10# CONFIG_SYSCTL_SYSCALL is not set
11CONFIG_SLAB=y 11CONFIG_SLAB=y
12CONFIG_MODULES=y 12CONFIG_MODULES=y
diff --git a/arch/mips/configs/pnx8550-stb810_defconfig b/arch/mips/configs/pnx8550-stb810_defconfig
index 6514f1bf0afb..15c66a571f99 100644
--- a/arch/mips/configs/pnx8550-stb810_defconfig
+++ b/arch/mips/configs/pnx8550-stb810_defconfig
@@ -6,7 +6,7 @@ CONFIG_IKCONFIG_PROC=y
6CONFIG_LOG_BUF_SHIFT=14 6CONFIG_LOG_BUF_SHIFT=14
7CONFIG_BLK_DEV_INITRD=y 7CONFIG_BLK_DEV_INITRD=y
8# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 8# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
9CONFIG_EMBEDDED=y 9CONFIG_EXPERT=y
10# CONFIG_SYSCTL_SYSCALL is not set 10# CONFIG_SYSCTL_SYSCALL is not set
11# CONFIG_HOTPLUG is not set 11# CONFIG_HOTPLUG is not set
12CONFIG_SLAB=y 12CONFIG_SLAB=y
diff --git a/arch/mips/configs/powertv_defconfig b/arch/mips/configs/powertv_defconfig
index f1f58e91dd80..3b0b6e8c8533 100644
--- a/arch/mips/configs/powertv_defconfig
+++ b/arch/mips/configs/powertv_defconfig
@@ -14,7 +14,7 @@ CONFIG_RELAY=y
14CONFIG_BLK_DEV_INITRD=y 14CONFIG_BLK_DEV_INITRD=y
15# CONFIG_RD_GZIP is not set 15# CONFIG_RD_GZIP is not set
16# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 16# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
17CONFIG_EMBEDDED=y 17CONFIG_EXPERT=y
18# CONFIG_SYSCTL_SYSCALL is not set 18# CONFIG_SYSCTL_SYSCALL is not set
19CONFIG_KALLSYMS_ALL=y 19CONFIG_KALLSYMS_ALL=y
20# CONFIG_PCSPKR_PLATFORM is not set 20# CONFIG_PCSPKR_PLATFORM is not set
diff --git a/arch/mips/configs/rb532_defconfig b/arch/mips/configs/rb532_defconfig
index d6457bc38c71..55902d9cd0f2 100644
--- a/arch/mips/configs/rb532_defconfig
+++ b/arch/mips/configs/rb532_defconfig
@@ -13,7 +13,7 @@ CONFIG_IKCONFIG_PROC=y
13CONFIG_LOG_BUF_SHIFT=14 13CONFIG_LOG_BUF_SHIFT=14
14CONFIG_SYSFS_DEPRECATED_V2=y 14CONFIG_SYSFS_DEPRECATED_V2=y
15CONFIG_BLK_DEV_INITRD=y 15CONFIG_BLK_DEV_INITRD=y
16CONFIG_EMBEDDED=y 16CONFIG_EXPERT=y
17# CONFIG_KALLSYMS is not set 17# CONFIG_KALLSYMS is not set
18# CONFIG_ELF_CORE is not set 18# CONFIG_ELF_CORE is not set
19# CONFIG_VM_EVENT_COUNTERS is not set 19# CONFIG_VM_EVENT_COUNTERS is not set
diff --git a/arch/mips/configs/rbtx49xx_defconfig b/arch/mips/configs/rbtx49xx_defconfig
index 29acfab31516..9cba856277ff 100644
--- a/arch/mips/configs/rbtx49xx_defconfig
+++ b/arch/mips/configs/rbtx49xx_defconfig
@@ -12,7 +12,7 @@ CONFIG_IKCONFIG_PROC=y
12CONFIG_LOG_BUF_SHIFT=14 12CONFIG_LOG_BUF_SHIFT=14
13CONFIG_SYSFS_DEPRECATED_V2=y 13CONFIG_SYSFS_DEPRECATED_V2=y
14CONFIG_BLK_DEV_INITRD=y 14CONFIG_BLK_DEV_INITRD=y
15CONFIG_EMBEDDED=y 15CONFIG_EXPERT=y
16# CONFIG_HOTPLUG is not set 16# CONFIG_HOTPLUG is not set
17# CONFIG_PCSPKR_PLATFORM is not set 17# CONFIG_PCSPKR_PLATFORM is not set
18# CONFIG_EPOLL is not set 18# CONFIG_EPOLL is not set
diff --git a/arch/mips/configs/rm200_defconfig b/arch/mips/configs/rm200_defconfig
index 2b3e47653f60..2c0230e76d20 100644
--- a/arch/mips/configs/rm200_defconfig
+++ b/arch/mips/configs/rm200_defconfig
@@ -12,7 +12,7 @@ CONFIG_IKCONFIG_PROC=y
12CONFIG_LOG_BUF_SHIFT=14 12CONFIG_LOG_BUF_SHIFT=14
13CONFIG_RELAY=y 13CONFIG_RELAY=y
14# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 14# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
15CONFIG_EMBEDDED=y 15CONFIG_EXPERT=y
16CONFIG_SLAB=y 16CONFIG_SLAB=y
17CONFIG_MODULES=y 17CONFIG_MODULES=y
18CONFIG_MODULE_UNLOAD=y 18CONFIG_MODULE_UNLOAD=y
diff --git a/arch/mips/configs/sb1250-swarm_defconfig b/arch/mips/configs/sb1250-swarm_defconfig
index 64840d717750..5b0463ef9389 100644
--- a/arch/mips/configs/sb1250-swarm_defconfig
+++ b/arch/mips/configs/sb1250-swarm_defconfig
@@ -15,7 +15,7 @@ CONFIG_RELAY=y
15CONFIG_NAMESPACES=y 15CONFIG_NAMESPACES=y
16CONFIG_BLK_DEV_INITRD=y 16CONFIG_BLK_DEV_INITRD=y
17# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 17# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
18CONFIG_EMBEDDED=y 18CONFIG_EXPERT=y
19# CONFIG_COMPAT_BRK is not set 19# CONFIG_COMPAT_BRK is not set
20CONFIG_SLAB=y 20CONFIG_SLAB=y
21CONFIG_MODULES=y 21CONFIG_MODULES=y
diff --git a/arch/mips/configs/tb0219_defconfig b/arch/mips/configs/tb0219_defconfig
index d9be37fc9cb7..30036b4cbeb1 100644
--- a/arch/mips/configs/tb0219_defconfig
+++ b/arch/mips/configs/tb0219_defconfig
@@ -5,7 +5,7 @@ CONFIG_SYSVIPC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_SYSFS_DEPRECATED_V2=y 6CONFIG_SYSFS_DEPRECATED_V2=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9# CONFIG_PCSPKR_PLATFORM is not set 9# CONFIG_PCSPKR_PLATFORM is not set
10CONFIG_SLAB=y 10CONFIG_SLAB=y
11CONFIG_MODULES=y 11CONFIG_MODULES=y
diff --git a/arch/mips/configs/tb0226_defconfig b/arch/mips/configs/tb0226_defconfig
index 3d25dd08907b..81bfa1d4d8e3 100644
--- a/arch/mips/configs/tb0226_defconfig
+++ b/arch/mips/configs/tb0226_defconfig
@@ -5,7 +5,7 @@ CONFIG_SYSVIPC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_SYSFS_DEPRECATED_V2=y 6CONFIG_SYSFS_DEPRECATED_V2=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9# CONFIG_PCSPKR_PLATFORM is not set 9# CONFIG_PCSPKR_PLATFORM is not set
10CONFIG_SLAB=y 10CONFIG_SLAB=y
11CONFIG_MODULES=y 11CONFIG_MODULES=y
diff --git a/arch/mips/configs/tb0287_defconfig b/arch/mips/configs/tb0287_defconfig
index be697c9b23c6..c415c4f0e5c2 100644
--- a/arch/mips/configs/tb0287_defconfig
+++ b/arch/mips/configs/tb0287_defconfig
@@ -4,7 +4,7 @@ CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_SYSFS_DEPRECATED_V2=y 5CONFIG_SYSFS_DEPRECATED_V2=y
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8# CONFIG_SYSCTL_SYSCALL is not set 8# CONFIG_SYSCTL_SYSCALL is not set
9# CONFIG_PCSPKR_PLATFORM is not set 9# CONFIG_PCSPKR_PLATFORM is not set
10CONFIG_SLAB=y 10CONFIG_SLAB=y
diff --git a/arch/mips/configs/workpad_defconfig b/arch/mips/configs/workpad_defconfig
index 7ec9287254d8..ee4b2be43c44 100644
--- a/arch/mips/configs/workpad_defconfig
+++ b/arch/mips/configs/workpad_defconfig
@@ -4,7 +4,7 @@ CONFIG_EXPERIMENTAL=y
4CONFIG_SYSVIPC=y 4CONFIG_SYSVIPC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8CONFIG_SLAB=y 8CONFIG_SLAB=y
9CONFIG_MODULES=y 9CONFIG_MODULES=y
10CONFIG_MODULE_UNLOAD=y 10CONFIG_MODULE_UNLOAD=y
diff --git a/arch/mips/configs/wrppmc_defconfig b/arch/mips/configs/wrppmc_defconfig
index a231b73b1a40..44a451be359e 100644
--- a/arch/mips/configs/wrppmc_defconfig
+++ b/arch/mips/configs/wrppmc_defconfig
@@ -7,7 +7,7 @@ CONFIG_BSD_PROCESS_ACCT=y
7CONFIG_LOG_BUF_SHIFT=14 7CONFIG_LOG_BUF_SHIFT=14
8CONFIG_BLK_DEV_INITRD=y 8CONFIG_BLK_DEV_INITRD=y
9# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 9# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
10CONFIG_EMBEDDED=y 10CONFIG_EXPERT=y
11CONFIG_KALLSYMS_EXTRA_PASS=y 11CONFIG_KALLSYMS_EXTRA_PASS=y
12# CONFIG_EPOLL is not set 12# CONFIG_EPOLL is not set
13CONFIG_SLAB=y 13CONFIG_SLAB=y
diff --git a/arch/mips/configs/yosemite_defconfig b/arch/mips/configs/yosemite_defconfig
index ab3a3dcec04d..f72d305a3f08 100644
--- a/arch/mips/configs/yosemite_defconfig
+++ b/arch/mips/configs/yosemite_defconfig
@@ -8,7 +8,7 @@ CONFIG_IKCONFIG=y
8CONFIG_IKCONFIG_PROC=y 8CONFIG_IKCONFIG_PROC=y
9CONFIG_LOG_BUF_SHIFT=14 9CONFIG_LOG_BUF_SHIFT=14
10CONFIG_RELAY=y 10CONFIG_RELAY=y
11CONFIG_EMBEDDED=y 11CONFIG_EXPERT=y
12CONFIG_SLAB=y 12CONFIG_SLAB=y
13CONFIG_MODULES=y 13CONFIG_MODULES=y
14CONFIG_MODULE_UNLOAD=y 14CONFIG_MODULE_UNLOAD=y
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig
index 8ed41cf2b08d..243bfa23fd58 100644
--- a/arch/mn10300/Kconfig
+++ b/arch/mn10300/Kconfig
@@ -1,6 +1,7 @@
1config MN10300 1config MN10300
2 def_bool y 2 def_bool y
3 select HAVE_OPROFILE 3 select HAVE_OPROFILE
4 select GENERIC_HARDIRQS
4 5
5config AM33_2 6config AM33_2
6 def_bool n 7 def_bool n
@@ -34,9 +35,6 @@ config RWSEM_GENERIC_SPINLOCK
34config RWSEM_XCHGADD_ALGORITHM 35config RWSEM_XCHGADD_ALGORITHM
35 bool 36 bool
36 37
37config GENERIC_HARDIRQS_NO__DO_IRQ
38 def_bool y
39
40config GENERIC_CALIBRATE_DELAY 38config GENERIC_CALIBRATE_DELAY
41 def_bool y 39 def_bool y
42 40
@@ -79,10 +77,6 @@ config QUICKLIST
79config ARCH_HAS_ILOG2_U32 77config ARCH_HAS_ILOG2_U32
80 def_bool y 78 def_bool y
81 79
82# Use the generic interrupt handling code in kernel/irq/
83config GENERIC_HARDIRQS
84 def_bool y
85
86config HOTPLUG_CPU 80config HOTPLUG_CPU
87 def_bool n 81 def_bool n
88 82
diff --git a/arch/mn10300/configs/asb2303_defconfig b/arch/mn10300/configs/asb2303_defconfig
index 3f749b69ca71..1fd41ec1dfb5 100644
--- a/arch/mn10300/configs/asb2303_defconfig
+++ b/arch/mn10300/configs/asb2303_defconfig
@@ -4,7 +4,7 @@ CONFIG_BSD_PROCESS_ACCT=y
4CONFIG_TINY_RCU=y 4CONFIG_TINY_RCU=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8# CONFIG_KALLSYMS is not set 8# CONFIG_KALLSYMS is not set
9# CONFIG_HOTPLUG is not set 9# CONFIG_HOTPLUG is not set
10# CONFIG_VM_EVENT_COUNTERS is not set 10# CONFIG_VM_EVENT_COUNTERS is not set
diff --git a/arch/mn10300/configs/asb2364_defconfig b/arch/mn10300/configs/asb2364_defconfig
index 83ce2f27b12a..31d76261a3d5 100644
--- a/arch/mn10300/configs/asb2364_defconfig
+++ b/arch/mn10300/configs/asb2364_defconfig
@@ -15,7 +15,7 @@ CONFIG_CGROUP_CPUACCT=y
15CONFIG_RESOURCE_COUNTERS=y 15CONFIG_RESOURCE_COUNTERS=y
16CONFIG_RELAY=y 16CONFIG_RELAY=y
17# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 17# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
18CONFIG_EMBEDDED=y 18CONFIG_EXPERT=y
19# CONFIG_KALLSYMS is not set 19# CONFIG_KALLSYMS is not set
20# CONFIG_VM_EVENT_COUNTERS is not set 20# CONFIG_VM_EVENT_COUNTERS is not set
21CONFIG_SLAB=y 21CONFIG_SLAB=y
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 0888675c98dd..fed2946f7335 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -12,7 +12,10 @@ config PARISC
12 select HAVE_IRQ_WORK 12 select HAVE_IRQ_WORK
13 select HAVE_PERF_EVENTS 13 select HAVE_PERF_EVENTS
14 select GENERIC_ATOMIC64 if !64BIT 14 select GENERIC_ATOMIC64 if !64BIT
15 select GENERIC_HARDIRQS_NO__DO_IRQ 15 select HAVE_GENERIC_HARDIRQS
16 select GENERIC_IRQ_PROBE
17 select IRQ_PER_CPU
18
16 help 19 help
17 The PA-RISC microprocessor is designed by Hewlett-Packard and used 20 The PA-RISC microprocessor is designed by Hewlett-Packard and used
18 in many of their workstations & servers (HP9000 700 and 800 series, 21 in many of their workstations & servers (HP9000 700 and 800 series,
@@ -66,22 +69,9 @@ config TIME_LOW_RES
66 depends on SMP 69 depends on SMP
67 default y 70 default y
68 71
69config GENERIC_HARDIRQS
70 def_bool y
71
72config GENERIC_IRQ_PROBE
73 def_bool y
74
75config HAVE_LATENCYTOP_SUPPORT 72config HAVE_LATENCYTOP_SUPPORT
76 def_bool y 73 def_bool y
77 74
78config IRQ_PER_CPU
79 bool
80 default y
81
82config GENERIC_HARDIRQS_NO__DO_IRQ
83 def_bool y
84
85# unless you want to implement ACPI on PA-RISC ... ;-) 75# unless you want to implement ACPI on PA-RISC ... ;-)
86config PM 76config PM
87 bool 77 bool
diff --git a/arch/parisc/configs/a500_defconfig b/arch/parisc/configs/a500_defconfig
index f9305f30603a..b647b182dacc 100644
--- a/arch/parisc/configs/a500_defconfig
+++ b/arch/parisc/configs/a500_defconfig
@@ -8,7 +8,7 @@ CONFIG_LOG_BUF_SHIFT=16
8CONFIG_SYSFS_DEPRECATED_V2=y 8CONFIG_SYSFS_DEPRECATED_V2=y
9CONFIG_BLK_DEV_INITRD=y 9CONFIG_BLK_DEV_INITRD=y
10# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 10# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
11CONFIG_EMBEDDED=y 11CONFIG_EXPERT=y
12CONFIG_KALLSYMS_ALL=y 12CONFIG_KALLSYMS_ALL=y
13CONFIG_SLAB=y 13CONFIG_SLAB=y
14CONFIG_PROFILING=y 14CONFIG_PROFILING=y
diff --git a/arch/parisc/configs/c3000_defconfig b/arch/parisc/configs/c3000_defconfig
index 628d3e022535..311ca367b622 100644
--- a/arch/parisc/configs/c3000_defconfig
+++ b/arch/parisc/configs/c3000_defconfig
@@ -6,7 +6,7 @@ CONFIG_IKCONFIG_PROC=y
6CONFIG_LOG_BUF_SHIFT=16 6CONFIG_LOG_BUF_SHIFT=16
7CONFIG_SYSFS_DEPRECATED_V2=y 7CONFIG_SYSFS_DEPRECATED_V2=y
8# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 8# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
9CONFIG_EMBEDDED=y 9CONFIG_EXPERT=y
10CONFIG_KALLSYMS_ALL=y 10CONFIG_KALLSYMS_ALL=y
11CONFIG_SLAB=y 11CONFIG_SLAB=y
12CONFIG_PROFILING=y 12CONFIG_PROFILING=y
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 959f38ccb9a7..7d69e9bf5e64 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -36,24 +36,12 @@ config GENERIC_TIME_VSYSCALL
36config GENERIC_CLOCKEVENTS 36config GENERIC_CLOCKEVENTS
37 def_bool y 37 def_bool y
38 38
39config GENERIC_HARDIRQS
40 bool
41 default y
42
43config GENERIC_HARDIRQS_NO__DO_IRQ
44 bool
45 default y
46
47config HAVE_SETUP_PER_CPU_AREA 39config HAVE_SETUP_PER_CPU_AREA
48 def_bool PPC64 40 def_bool PPC64
49 41
50config NEED_PER_CPU_EMBED_FIRST_CHUNK 42config NEED_PER_CPU_EMBED_FIRST_CHUNK
51 def_bool PPC64 43 def_bool PPC64
52 44
53config IRQ_PER_CPU
54 bool
55 default y
56
57config NR_IRQS 45config NR_IRQS
58 int "Number of virtual interrupt numbers" 46 int "Number of virtual interrupt numbers"
59 range 32 32768 47 range 32 32768
@@ -143,6 +131,9 @@ config PPC
143 select HAVE_PERF_EVENTS 131 select HAVE_PERF_EVENTS
144 select HAVE_REGS_AND_STACK_ACCESS_API 132 select HAVE_REGS_AND_STACK_ACCESS_API
145 select HAVE_HW_BREAKPOINT if PERF_EVENTS && PPC_BOOK3S_64 133 select HAVE_HW_BREAKPOINT if PERF_EVENTS && PPC_BOOK3S_64
134 select HAVE_GENERIC_HARDIRQS
135 select HAVE_SPARSE_IRQ
136 select IRQ_PER_CPU
146 137
147config EARLY_PRINTK 138config EARLY_PRINTK
148 bool 139 bool
@@ -392,19 +383,6 @@ config IRQ_ALL_CPUS
392 CPU. Generally saying Y is safe, although some problems have been 383 CPU. Generally saying Y is safe, although some problems have been
393 reported with SMP Power Macintoshes with this option enabled. 384 reported with SMP Power Macintoshes with this option enabled.
394 385
395config SPARSE_IRQ
396 bool "Support sparse irq numbering"
397 default n
398 help
399 This enables support for sparse irqs. This is useful for distro
400 kernels that want to define a high CONFIG_NR_CPUS value but still
401 want to have low kernel memory footprint on smaller machines.
402
403 ( Sparse IRQs can also be beneficial on NUMA boxes, as they spread
404 out the irq_desc[] array in a more NUMA-friendly way. )
405
406 If you don't know what to do here, say N.
407
408config NUMA 386config NUMA
409 bool "NUMA support" 387 bool "NUMA support"
410 depends on PPC64 388 depends on PPC64
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 96deec63bcf3..89178164af5e 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -368,7 +368,7 @@ INSTALL := install
368extra-installed := $(patsubst $(obj)/%, $(DESTDIR)$(WRAPPER_OBJDIR)/%, $(extra-y)) 368extra-installed := $(patsubst $(obj)/%, $(DESTDIR)$(WRAPPER_OBJDIR)/%, $(extra-y))
369hostprogs-installed := $(patsubst %, $(DESTDIR)$(WRAPPER_BINDIR)/%, $(hostprogs-y)) 369hostprogs-installed := $(patsubst %, $(DESTDIR)$(WRAPPER_BINDIR)/%, $(hostprogs-y))
370wrapper-installed := $(DESTDIR)$(WRAPPER_BINDIR)/wrapper 370wrapper-installed := $(DESTDIR)$(WRAPPER_BINDIR)/wrapper
371dts-installed := $(patsubst $(obj)/dts/%, $(DESTDIR)$(WRAPPER_DTSDIR)/%, $(wildcard $(obj)/dts/*.dts)) 371dts-installed := $(patsubst $(dtstree)/%, $(DESTDIR)$(WRAPPER_DTSDIR)/%, $(wildcard $(dtstree)/*.dts))
372 372
373all-installed := $(extra-installed) $(hostprogs-installed) $(wrapper-installed) $(dts-installed) 373all-installed := $(extra-installed) $(hostprogs-installed) $(wrapper-installed) $(dts-installed)
374 374
diff --git a/arch/powerpc/boot/dts/mpc8308rdb.dts b/arch/powerpc/boot/dts/mpc8308rdb.dts
index d3db02f98ddd..a0bd1881081e 100644
--- a/arch/powerpc/boot/dts/mpc8308rdb.dts
+++ b/arch/powerpc/boot/dts/mpc8308rdb.dts
@@ -109,7 +109,7 @@
109 #address-cells = <1>; 109 #address-cells = <1>;
110 #size-cells = <1>; 110 #size-cells = <1>;
111 device_type = "soc"; 111 device_type = "soc";
112 compatible = "fsl,mpc8315-immr", "simple-bus"; 112 compatible = "fsl,mpc8308-immr", "simple-bus";
113 ranges = <0 0xe0000000 0x00100000>; 113 ranges = <0 0xe0000000 0x00100000>;
114 reg = <0xe0000000 0x00000200>; 114 reg = <0xe0000000 0x00000200>;
115 bus-frequency = <0>; 115 bus-frequency = <0>;
diff --git a/arch/powerpc/boot/dts/p1022ds.dts b/arch/powerpc/boot/dts/p1022ds.dts
index 2bbecbb4cbf9..69422eb24d97 100644
--- a/arch/powerpc/boot/dts/p1022ds.dts
+++ b/arch/powerpc/boot/dts/p1022ds.dts
@@ -291,13 +291,13 @@
291 ranges = <0x0 0xc100 0x200>; 291 ranges = <0x0 0xc100 0x200>;
292 cell-index = <1>; 292 cell-index = <1>;
293 dma00: dma-channel@0 { 293 dma00: dma-channel@0 {
294 compatible = "fsl,eloplus-dma-channel"; 294 compatible = "fsl,ssi-dma-channel";
295 reg = <0x0 0x80>; 295 reg = <0x0 0x80>;
296 cell-index = <0>; 296 cell-index = <0>;
297 interrupts = <76 2>; 297 interrupts = <76 2>;
298 }; 298 };
299 dma01: dma-channel@80 { 299 dma01: dma-channel@80 {
300 compatible = "fsl,eloplus-dma-channel"; 300 compatible = "fsl,ssi-dma-channel";
301 reg = <0x80 0x80>; 301 reg = <0x80 0x80>;
302 cell-index = <1>; 302 cell-index = <1>;
303 interrupts = <77 2>; 303 interrupts = <77 2>;
diff --git a/arch/powerpc/configs/40x/acadia_defconfig b/arch/powerpc/configs/40x/acadia_defconfig
index 97fedceaa30b..4182c772340b 100644
--- a/arch/powerpc/configs/40x/acadia_defconfig
+++ b/arch/powerpc/configs/40x/acadia_defconfig
@@ -5,7 +5,7 @@ CONFIG_POSIX_MQUEUE=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9CONFIG_KALLSYMS_ALL=y 9CONFIG_KALLSYMS_ALL=y
10CONFIG_KALLSYMS_EXTRA_PASS=y 10CONFIG_KALLSYMS_EXTRA_PASS=y
11CONFIG_MODULES=y 11CONFIG_MODULES=y
diff --git a/arch/powerpc/configs/40x/ep405_defconfig b/arch/powerpc/configs/40x/ep405_defconfig
index 33b3c24f4edd..2dbb293163f5 100644
--- a/arch/powerpc/configs/40x/ep405_defconfig
+++ b/arch/powerpc/configs/40x/ep405_defconfig
@@ -5,7 +5,7 @@ CONFIG_POSIX_MQUEUE=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9CONFIG_KALLSYMS_ALL=y 9CONFIG_KALLSYMS_ALL=y
10CONFIG_KALLSYMS_EXTRA_PASS=y 10CONFIG_KALLSYMS_EXTRA_PASS=y
11CONFIG_MODULES=y 11CONFIG_MODULES=y
diff --git a/arch/powerpc/configs/40x/hcu4_defconfig b/arch/powerpc/configs/40x/hcu4_defconfig
index 4613079a0ab1..ebeb4accad65 100644
--- a/arch/powerpc/configs/40x/hcu4_defconfig
+++ b/arch/powerpc/configs/40x/hcu4_defconfig
@@ -5,7 +5,7 @@ CONFIG_POSIX_MQUEUE=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9CONFIG_KALLSYMS_ALL=y 9CONFIG_KALLSYMS_ALL=y
10CONFIG_KALLSYMS_EXTRA_PASS=y 10CONFIG_KALLSYMS_EXTRA_PASS=y
11CONFIG_MODULES=y 11CONFIG_MODULES=y
diff --git a/arch/powerpc/configs/40x/kilauea_defconfig b/arch/powerpc/configs/40x/kilauea_defconfig
index 34b8c1a1e752..532ea9d93a15 100644
--- a/arch/powerpc/configs/40x/kilauea_defconfig
+++ b/arch/powerpc/configs/40x/kilauea_defconfig
@@ -5,7 +5,7 @@ CONFIG_POSIX_MQUEUE=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9CONFIG_KALLSYMS_ALL=y 9CONFIG_KALLSYMS_ALL=y
10CONFIG_KALLSYMS_EXTRA_PASS=y 10CONFIG_KALLSYMS_EXTRA_PASS=y
11CONFIG_MODULES=y 11CONFIG_MODULES=y
diff --git a/arch/powerpc/configs/40x/makalu_defconfig b/arch/powerpc/configs/40x/makalu_defconfig
index 651be09136fa..3c142ac1b344 100644
--- a/arch/powerpc/configs/40x/makalu_defconfig
+++ b/arch/powerpc/configs/40x/makalu_defconfig
@@ -5,7 +5,7 @@ CONFIG_POSIX_MQUEUE=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9CONFIG_KALLSYMS_ALL=y 9CONFIG_KALLSYMS_ALL=y
10CONFIG_KALLSYMS_EXTRA_PASS=y 10CONFIG_KALLSYMS_EXTRA_PASS=y
11CONFIG_MODULES=y 11CONFIG_MODULES=y
diff --git a/arch/powerpc/configs/40x/walnut_defconfig b/arch/powerpc/configs/40x/walnut_defconfig
index ded455e18339..ff57d4828ffc 100644
--- a/arch/powerpc/configs/40x/walnut_defconfig
+++ b/arch/powerpc/configs/40x/walnut_defconfig
@@ -5,7 +5,7 @@ CONFIG_POSIX_MQUEUE=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9CONFIG_KALLSYMS_ALL=y 9CONFIG_KALLSYMS_ALL=y
10CONFIG_KALLSYMS_EXTRA_PASS=y 10CONFIG_KALLSYMS_EXTRA_PASS=y
11CONFIG_MODULES=y 11CONFIG_MODULES=y
diff --git a/arch/powerpc/configs/44x/arches_defconfig b/arch/powerpc/configs/44x/arches_defconfig
index 63746a041d6b..3ed16d5c909d 100644
--- a/arch/powerpc/configs/44x/arches_defconfig
+++ b/arch/powerpc/configs/44x/arches_defconfig
@@ -5,7 +5,7 @@ CONFIG_POSIX_MQUEUE=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9CONFIG_MODULES=y 9CONFIG_MODULES=y
10CONFIG_MODULE_UNLOAD=y 10CONFIG_MODULE_UNLOAD=y
11# CONFIG_BLK_DEV_BSG is not set 11# CONFIG_BLK_DEV_BSG is not set
diff --git a/arch/powerpc/configs/44x/bamboo_defconfig b/arch/powerpc/configs/44x/bamboo_defconfig
index f5f2a4e3e21b..b1b7d2c5c059 100644
--- a/arch/powerpc/configs/44x/bamboo_defconfig
+++ b/arch/powerpc/configs/44x/bamboo_defconfig
@@ -5,7 +5,7 @@ CONFIG_POSIX_MQUEUE=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9CONFIG_MODULES=y 9CONFIG_MODULES=y
10CONFIG_MODULE_UNLOAD=y 10CONFIG_MODULE_UNLOAD=y
11# CONFIG_BLK_DEV_BSG is not set 11# CONFIG_BLK_DEV_BSG is not set
diff --git a/arch/powerpc/configs/44x/bluestone_defconfig b/arch/powerpc/configs/44x/bluestone_defconfig
index ac65b48b8ccd..30a0a8e08fdd 100644
--- a/arch/powerpc/configs/44x/bluestone_defconfig
+++ b/arch/powerpc/configs/44x/bluestone_defconfig
@@ -4,7 +4,7 @@ CONFIG_SYSVIPC=y
4CONFIG_POSIX_MQUEUE=y 4CONFIG_POSIX_MQUEUE=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8# CONFIG_VM_EVENT_COUNTERS is not set 8# CONFIG_VM_EVENT_COUNTERS is not set
9# CONFIG_PCI_QUIRKS is not set 9# CONFIG_PCI_QUIRKS is not set
10# CONFIG_COMPAT_BRK is not set 10# CONFIG_COMPAT_BRK is not set
diff --git a/arch/powerpc/configs/44x/canyonlands_defconfig b/arch/powerpc/configs/44x/canyonlands_defconfig
index 17e4dd98eed7..a46942aac695 100644
--- a/arch/powerpc/configs/44x/canyonlands_defconfig
+++ b/arch/powerpc/configs/44x/canyonlands_defconfig
@@ -5,7 +5,7 @@ CONFIG_POSIX_MQUEUE=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9CONFIG_MODULES=y 9CONFIG_MODULES=y
10CONFIG_MODULE_UNLOAD=y 10CONFIG_MODULE_UNLOAD=y
11# CONFIG_BLK_DEV_BSG is not set 11# CONFIG_BLK_DEV_BSG is not set
diff --git a/arch/powerpc/configs/44x/ebony_defconfig b/arch/powerpc/configs/44x/ebony_defconfig
index fedd03fdf5d5..07d77e51f1ba 100644
--- a/arch/powerpc/configs/44x/ebony_defconfig
+++ b/arch/powerpc/configs/44x/ebony_defconfig
@@ -5,7 +5,7 @@ CONFIG_POSIX_MQUEUE=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9CONFIG_KALLSYMS_ALL=y 9CONFIG_KALLSYMS_ALL=y
10CONFIG_KALLSYMS_EXTRA_PASS=y 10CONFIG_KALLSYMS_EXTRA_PASS=y
11CONFIG_MODULES=y 11CONFIG_MODULES=y
diff --git a/arch/powerpc/configs/44x/eiger_defconfig b/arch/powerpc/configs/44x/eiger_defconfig
index ebff7011282e..2ce7e9aff09e 100644
--- a/arch/powerpc/configs/44x/eiger_defconfig
+++ b/arch/powerpc/configs/44x/eiger_defconfig
@@ -5,7 +5,7 @@ CONFIG_POSIX_MQUEUE=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9CONFIG_MODULES=y 9CONFIG_MODULES=y
10CONFIG_MODULE_UNLOAD=y 10CONFIG_MODULE_UNLOAD=y
11# CONFIG_BLK_DEV_BSG is not set 11# CONFIG_BLK_DEV_BSG is not set
diff --git a/arch/powerpc/configs/44x/icon_defconfig b/arch/powerpc/configs/44x/icon_defconfig
index 865e93fb41fd..18730ff9de7c 100644
--- a/arch/powerpc/configs/44x/icon_defconfig
+++ b/arch/powerpc/configs/44x/icon_defconfig
@@ -6,7 +6,7 @@ CONFIG_LOG_BUF_SHIFT=14
6CONFIG_SYSFS_DEPRECATED_V2=y 6CONFIG_SYSFS_DEPRECATED_V2=y
7CONFIG_BLK_DEV_INITRD=y 7CONFIG_BLK_DEV_INITRD=y
8# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 8# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
9CONFIG_EMBEDDED=y 9CONFIG_EXPERT=y
10CONFIG_MODULES=y 10CONFIG_MODULES=y
11CONFIG_MODULE_UNLOAD=y 11CONFIG_MODULE_UNLOAD=y
12# CONFIG_BLK_DEV_BSG is not set 12# CONFIG_BLK_DEV_BSG is not set
diff --git a/arch/powerpc/configs/44x/iss476-smp_defconfig b/arch/powerpc/configs/44x/iss476-smp_defconfig
index 8ece4c774415..92f863ac8443 100644
--- a/arch/powerpc/configs/44x/iss476-smp_defconfig
+++ b/arch/powerpc/configs/44x/iss476-smp_defconfig
@@ -7,7 +7,7 @@ CONFIG_LOG_BUF_SHIFT=14
7CONFIG_SYSFS_DEPRECATED_V2=y 7CONFIG_SYSFS_DEPRECATED_V2=y
8CONFIG_BLK_DEV_INITRD=y 8CONFIG_BLK_DEV_INITRD=y
9# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 9# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
10CONFIG_EMBEDDED=y 10CONFIG_EXPERT=y
11CONFIG_KALLSYMS_ALL=y 11CONFIG_KALLSYMS_ALL=y
12CONFIG_KALLSYMS_EXTRA_PASS=y 12CONFIG_KALLSYMS_EXTRA_PASS=y
13CONFIG_PROFILING=y 13CONFIG_PROFILING=y
diff --git a/arch/powerpc/configs/44x/katmai_defconfig b/arch/powerpc/configs/44x/katmai_defconfig
index 4ca9b4873c51..34c09144a699 100644
--- a/arch/powerpc/configs/44x/katmai_defconfig
+++ b/arch/powerpc/configs/44x/katmai_defconfig
@@ -5,7 +5,7 @@ CONFIG_POSIX_MQUEUE=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9CONFIG_MODULES=y 9CONFIG_MODULES=y
10CONFIG_MODULE_UNLOAD=y 10CONFIG_MODULE_UNLOAD=y
11# CONFIG_BLK_DEV_BSG is not set 11# CONFIG_BLK_DEV_BSG is not set
diff --git a/arch/powerpc/configs/44x/rainier_defconfig b/arch/powerpc/configs/44x/rainier_defconfig
index e3b65d24207e..21c33faf61a2 100644
--- a/arch/powerpc/configs/44x/rainier_defconfig
+++ b/arch/powerpc/configs/44x/rainier_defconfig
@@ -5,7 +5,7 @@ CONFIG_POSIX_MQUEUE=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9CONFIG_MODULES=y 9CONFIG_MODULES=y
10CONFIG_MODULE_UNLOAD=y 10CONFIG_MODULE_UNLOAD=y
11# CONFIG_BLK_DEV_BSG is not set 11# CONFIG_BLK_DEV_BSG is not set
diff --git a/arch/powerpc/configs/44x/redwood_defconfig b/arch/powerpc/configs/44x/redwood_defconfig
index 64cd0f3421a9..01cc2b1a7f9a 100644
--- a/arch/powerpc/configs/44x/redwood_defconfig
+++ b/arch/powerpc/configs/44x/redwood_defconfig
@@ -5,7 +5,7 @@ CONFIG_POSIX_MQUEUE=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9CONFIG_MODULES=y 9CONFIG_MODULES=y
10CONFIG_MODULE_UNLOAD=y 10CONFIG_MODULE_UNLOAD=y
11# CONFIG_BLK_DEV_BSG is not set 11# CONFIG_BLK_DEV_BSG is not set
diff --git a/arch/powerpc/configs/44x/sam440ep_defconfig b/arch/powerpc/configs/44x/sam440ep_defconfig
index 01d03367917e..dfcffede16ad 100644
--- a/arch/powerpc/configs/44x/sam440ep_defconfig
+++ b/arch/powerpc/configs/44x/sam440ep_defconfig
@@ -6,7 +6,7 @@ CONFIG_IKCONFIG=y
6CONFIG_LOG_BUF_SHIFT=14 6CONFIG_LOG_BUF_SHIFT=14
7CONFIG_BLK_DEV_INITRD=y 7CONFIG_BLK_DEV_INITRD=y
8# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 8# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
9CONFIG_EMBEDDED=y 9CONFIG_EXPERT=y
10CONFIG_MODULES=y 10CONFIG_MODULES=y
11CONFIG_MODULE_UNLOAD=y 11CONFIG_MODULE_UNLOAD=y
12# CONFIG_BLK_DEV_BSG is not set 12# CONFIG_BLK_DEV_BSG is not set
diff --git a/arch/powerpc/configs/44x/sequoia_defconfig b/arch/powerpc/configs/44x/sequoia_defconfig
index 89b2f9626137..47e399f2892f 100644
--- a/arch/powerpc/configs/44x/sequoia_defconfig
+++ b/arch/powerpc/configs/44x/sequoia_defconfig
@@ -5,7 +5,7 @@ CONFIG_POSIX_MQUEUE=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9CONFIG_MODULES=y 9CONFIG_MODULES=y
10CONFIG_MODULE_UNLOAD=y 10CONFIG_MODULE_UNLOAD=y
11# CONFIG_BLK_DEV_BSG is not set 11# CONFIG_BLK_DEV_BSG is not set
diff --git a/arch/powerpc/configs/44x/taishan_defconfig b/arch/powerpc/configs/44x/taishan_defconfig
index e3386cf6f5b7..a6a002ed5681 100644
--- a/arch/powerpc/configs/44x/taishan_defconfig
+++ b/arch/powerpc/configs/44x/taishan_defconfig
@@ -5,7 +5,7 @@ CONFIG_POSIX_MQUEUE=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9CONFIG_MODULES=y 9CONFIG_MODULES=y
10CONFIG_MODULE_UNLOAD=y 10CONFIG_MODULE_UNLOAD=y
11# CONFIG_BLK_DEV_BSG is not set 11# CONFIG_BLK_DEV_BSG is not set
diff --git a/arch/powerpc/configs/44x/warp_defconfig b/arch/powerpc/configs/44x/warp_defconfig
index 9c13b9dffafa..6cf9d6614805 100644
--- a/arch/powerpc/configs/44x/warp_defconfig
+++ b/arch/powerpc/configs/44x/warp_defconfig
@@ -8,7 +8,7 @@ CONFIG_IKCONFIG_PROC=y
8CONFIG_LOG_BUF_SHIFT=14 8CONFIG_LOG_BUF_SHIFT=14
9CONFIG_BLK_DEV_INITRD=y 9CONFIG_BLK_DEV_INITRD=y
10# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 10# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
11CONFIG_EMBEDDED=y 11CONFIG_EXPERT=y
12CONFIG_MODULES=y 12CONFIG_MODULES=y
13CONFIG_MODULE_UNLOAD=y 13CONFIG_MODULE_UNLOAD=y
14# CONFIG_BLK_DEV_BSG is not set 14# CONFIG_BLK_DEV_BSG is not set
diff --git a/arch/powerpc/configs/52xx/cm5200_defconfig b/arch/powerpc/configs/52xx/cm5200_defconfig
index f234c4d0b15c..69b57daf402e 100644
--- a/arch/powerpc/configs/52xx/cm5200_defconfig
+++ b/arch/powerpc/configs/52xx/cm5200_defconfig
@@ -3,7 +3,7 @@ CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7# CONFIG_SYSCTL_SYSCALL is not set 7# CONFIG_SYSCTL_SYSCALL is not set
8# CONFIG_KALLSYMS is not set 8# CONFIG_KALLSYMS is not set
9# CONFIG_EPOLL is not set 9# CONFIG_EPOLL is not set
diff --git a/arch/powerpc/configs/52xx/lite5200b_defconfig b/arch/powerpc/configs/52xx/lite5200b_defconfig
index a4a795c80740..f3638ae0a627 100644
--- a/arch/powerpc/configs/52xx/lite5200b_defconfig
+++ b/arch/powerpc/configs/52xx/lite5200b_defconfig
@@ -3,7 +3,7 @@ CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7# CONFIG_SYSCTL_SYSCALL is not set 7# CONFIG_SYSCTL_SYSCALL is not set
8# CONFIG_KALLSYMS is not set 8# CONFIG_KALLSYMS is not set
9# CONFIG_EPOLL is not set 9# CONFIG_EPOLL is not set
diff --git a/arch/powerpc/configs/52xx/motionpro_defconfig b/arch/powerpc/configs/52xx/motionpro_defconfig
index 20d53a1aa7e4..6828eda02bdc 100644
--- a/arch/powerpc/configs/52xx/motionpro_defconfig
+++ b/arch/powerpc/configs/52xx/motionpro_defconfig
@@ -3,7 +3,7 @@ CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7# CONFIG_SYSCTL_SYSCALL is not set 7# CONFIG_SYSCTL_SYSCALL is not set
8# CONFIG_KALLSYMS is not set 8# CONFIG_KALLSYMS is not set
9# CONFIG_EPOLL is not set 9# CONFIG_EPOLL is not set
diff --git a/arch/powerpc/configs/52xx/pcm030_defconfig b/arch/powerpc/configs/52xx/pcm030_defconfig
index 6bd58338bf1a..7f7e4a878602 100644
--- a/arch/powerpc/configs/52xx/pcm030_defconfig
+++ b/arch/powerpc/configs/52xx/pcm030_defconfig
@@ -8,7 +8,7 @@ CONFIG_IKCONFIG=y
8CONFIG_IKCONFIG_PROC=y 8CONFIG_IKCONFIG_PROC=y
9CONFIG_LOG_BUF_SHIFT=14 9CONFIG_LOG_BUF_SHIFT=14
10# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 10# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
11CONFIG_EMBEDDED=y 11CONFIG_EXPERT=y
12# CONFIG_SYSCTL_SYSCALL is not set 12# CONFIG_SYSCTL_SYSCALL is not set
13# CONFIG_VM_EVENT_COUNTERS is not set 13# CONFIG_VM_EVENT_COUNTERS is not set
14CONFIG_SLAB=y 14CONFIG_SLAB=y
diff --git a/arch/powerpc/configs/52xx/tqm5200_defconfig b/arch/powerpc/configs/52xx/tqm5200_defconfig
index 3a1f70292d9d..959cd2cfc275 100644
--- a/arch/powerpc/configs/52xx/tqm5200_defconfig
+++ b/arch/powerpc/configs/52xx/tqm5200_defconfig
@@ -3,7 +3,7 @@ CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7# CONFIG_SYSCTL_SYSCALL is not set 7# CONFIG_SYSCTL_SYSCALL is not set
8# CONFIG_KALLSYMS is not set 8# CONFIG_KALLSYMS is not set
9# CONFIG_EPOLL is not set 9# CONFIG_EPOLL is not set
diff --git a/arch/powerpc/configs/83xx/asp8347_defconfig b/arch/powerpc/configs/83xx/asp8347_defconfig
index eed42d8919e8..d2762d9dcb8e 100644
--- a/arch/powerpc/configs/83xx/asp8347_defconfig
+++ b/arch/powerpc/configs/83xx/asp8347_defconfig
@@ -4,7 +4,7 @@ CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8# CONFIG_KALLSYMS is not set 8# CONFIG_KALLSYMS is not set
9CONFIG_MODULES=y 9CONFIG_MODULES=y
10CONFIG_MODULE_UNLOAD=y 10CONFIG_MODULE_UNLOAD=y
diff --git a/arch/powerpc/configs/83xx/kmeter1_defconfig b/arch/powerpc/configs/83xx/kmeter1_defconfig
index e43ecb27dfd7..7a7b731c5735 100644
--- a/arch/powerpc/configs/83xx/kmeter1_defconfig
+++ b/arch/powerpc/configs/83xx/kmeter1_defconfig
@@ -3,7 +3,7 @@ CONFIG_EXPERIMENTAL=y
3CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
4CONFIG_POSIX_MQUEUE=y 4CONFIG_POSIX_MQUEUE=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7# CONFIG_HOTPLUG is not set 7# CONFIG_HOTPLUG is not set
8CONFIG_SLAB=y 8CONFIG_SLAB=y
9CONFIG_MODULES=y 9CONFIG_MODULES=y
diff --git a/arch/powerpc/configs/83xx/mpc8313_rdb_defconfig b/arch/powerpc/configs/83xx/mpc8313_rdb_defconfig
index c2e6ab51d335..c683bce4c26e 100644
--- a/arch/powerpc/configs/83xx/mpc8313_rdb_defconfig
+++ b/arch/powerpc/configs/83xx/mpc8313_rdb_defconfig
@@ -3,7 +3,7 @@ CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7# CONFIG_KALLSYMS is not set 7# CONFIG_KALLSYMS is not set
8CONFIG_MODULES=y 8CONFIG_MODULES=y
9CONFIG_MODULE_UNLOAD=y 9CONFIG_MODULE_UNLOAD=y
diff --git a/arch/powerpc/configs/83xx/mpc8315_rdb_defconfig b/arch/powerpc/configs/83xx/mpc8315_rdb_defconfig
index 1d3b20065913..a721cd3d793f 100644
--- a/arch/powerpc/configs/83xx/mpc8315_rdb_defconfig
+++ b/arch/powerpc/configs/83xx/mpc8315_rdb_defconfig
@@ -3,7 +3,7 @@ CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7# CONFIG_KALLSYMS is not set 7# CONFIG_KALLSYMS is not set
8CONFIG_MODULES=y 8CONFIG_MODULES=y
9CONFIG_MODULE_UNLOAD=y 9CONFIG_MODULE_UNLOAD=y
diff --git a/arch/powerpc/configs/83xx/mpc832x_mds_defconfig b/arch/powerpc/configs/83xx/mpc832x_mds_defconfig
index 91fe73bd5ad2..a5699a1f7d0a 100644
--- a/arch/powerpc/configs/83xx/mpc832x_mds_defconfig
+++ b/arch/powerpc/configs/83xx/mpc832x_mds_defconfig
@@ -3,7 +3,7 @@ CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7# CONFIG_KALLSYMS is not set 7# CONFIG_KALLSYMS is not set
8CONFIG_MODULES=y 8CONFIG_MODULES=y
9CONFIG_MODULE_UNLOAD=y 9CONFIG_MODULE_UNLOAD=y
diff --git a/arch/powerpc/configs/83xx/mpc832x_rdb_defconfig b/arch/powerpc/configs/83xx/mpc832x_rdb_defconfig
index 6d300f205604..b4da1a7e6449 100644
--- a/arch/powerpc/configs/83xx/mpc832x_rdb_defconfig
+++ b/arch/powerpc/configs/83xx/mpc832x_rdb_defconfig
@@ -3,7 +3,7 @@ CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7# CONFIG_KALLSYMS is not set 7# CONFIG_KALLSYMS is not set
8CONFIG_MODULES=y 8CONFIG_MODULES=y
9CONFIG_MODULE_UNLOAD=y 9CONFIG_MODULE_UNLOAD=y
diff --git a/arch/powerpc/configs/83xx/mpc834x_itx_defconfig b/arch/powerpc/configs/83xx/mpc834x_itx_defconfig
index b236a67e01fe..291f8221d5a6 100644
--- a/arch/powerpc/configs/83xx/mpc834x_itx_defconfig
+++ b/arch/powerpc/configs/83xx/mpc834x_itx_defconfig
@@ -3,7 +3,7 @@ CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7# CONFIG_KALLSYMS is not set 7# CONFIG_KALLSYMS is not set
8CONFIG_MODULES=y 8CONFIG_MODULES=y
9CONFIG_MODULE_UNLOAD=y 9CONFIG_MODULE_UNLOAD=y
diff --git a/arch/powerpc/configs/83xx/mpc834x_itxgp_defconfig b/arch/powerpc/configs/83xx/mpc834x_itxgp_defconfig
index 001dead3cde9..f8b228aaa03a 100644
--- a/arch/powerpc/configs/83xx/mpc834x_itxgp_defconfig
+++ b/arch/powerpc/configs/83xx/mpc834x_itxgp_defconfig
@@ -3,7 +3,7 @@ CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7# CONFIG_KALLSYMS is not set 7# CONFIG_KALLSYMS is not set
8CONFIG_MODULES=y 8CONFIG_MODULES=y
9CONFIG_MODULE_UNLOAD=y 9CONFIG_MODULE_UNLOAD=y
diff --git a/arch/powerpc/configs/83xx/mpc834x_mds_defconfig b/arch/powerpc/configs/83xx/mpc834x_mds_defconfig
index 9dccefca00c3..99660c062191 100644
--- a/arch/powerpc/configs/83xx/mpc834x_mds_defconfig
+++ b/arch/powerpc/configs/83xx/mpc834x_mds_defconfig
@@ -3,7 +3,7 @@ CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7# CONFIG_KALLSYMS is not set 7# CONFIG_KALLSYMS is not set
8CONFIG_MODULES=y 8CONFIG_MODULES=y
9CONFIG_MODULE_UNLOAD=y 9CONFIG_MODULE_UNLOAD=y
diff --git a/arch/powerpc/configs/83xx/mpc836x_mds_defconfig b/arch/powerpc/configs/83xx/mpc836x_mds_defconfig
index d4b165d7d294..10b5c4cd0e72 100644
--- a/arch/powerpc/configs/83xx/mpc836x_mds_defconfig
+++ b/arch/powerpc/configs/83xx/mpc836x_mds_defconfig
@@ -3,7 +3,7 @@ CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7# CONFIG_KALLSYMS is not set 7# CONFIG_KALLSYMS is not set
8CONFIG_MODULES=y 8CONFIG_MODULES=y
9CONFIG_MODULE_UNLOAD=y 9CONFIG_MODULE_UNLOAD=y
diff --git a/arch/powerpc/configs/83xx/mpc836x_rdk_defconfig b/arch/powerpc/configs/83xx/mpc836x_rdk_defconfig
index 89ba67274bda..45925d701d2a 100644
--- a/arch/powerpc/configs/83xx/mpc836x_rdk_defconfig
+++ b/arch/powerpc/configs/83xx/mpc836x_rdk_defconfig
@@ -3,7 +3,7 @@ CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7# CONFIG_KALLSYMS is not set 7# CONFIG_KALLSYMS is not set
8CONFIG_MODULES=y 8CONFIG_MODULES=y
9CONFIG_MODULE_UNLOAD=y 9CONFIG_MODULE_UNLOAD=y
diff --git a/arch/powerpc/configs/83xx/mpc837x_mds_defconfig b/arch/powerpc/configs/83xx/mpc837x_mds_defconfig
index 2ea6b405046a..f367985be6f7 100644
--- a/arch/powerpc/configs/83xx/mpc837x_mds_defconfig
+++ b/arch/powerpc/configs/83xx/mpc837x_mds_defconfig
@@ -3,7 +3,7 @@ CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7CONFIG_SLAB=y 7CONFIG_SLAB=y
8CONFIG_MODULES=y 8CONFIG_MODULES=y
9CONFIG_MODULE_UNLOAD=y 9CONFIG_MODULE_UNLOAD=y
diff --git a/arch/powerpc/configs/83xx/mpc837x_rdb_defconfig b/arch/powerpc/configs/83xx/mpc837x_rdb_defconfig
index bffe3c775030..414eda381591 100644
--- a/arch/powerpc/configs/83xx/mpc837x_rdb_defconfig
+++ b/arch/powerpc/configs/83xx/mpc837x_rdb_defconfig
@@ -3,7 +3,7 @@ CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7CONFIG_SLAB=y 7CONFIG_SLAB=y
8CONFIG_MODULES=y 8CONFIG_MODULES=y
9CONFIG_MODULE_UNLOAD=y 9CONFIG_MODULE_UNLOAD=y
diff --git a/arch/powerpc/configs/83xx/sbc834x_defconfig b/arch/powerpc/configs/83xx/sbc834x_defconfig
index fa5c9eefc9ad..6d6463fe06fc 100644
--- a/arch/powerpc/configs/83xx/sbc834x_defconfig
+++ b/arch/powerpc/configs/83xx/sbc834x_defconfig
@@ -3,7 +3,7 @@ CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7# CONFIG_KALLSYMS is not set 7# CONFIG_KALLSYMS is not set
8CONFIG_SLAB=y 8CONFIG_SLAB=y
9CONFIG_MODULES=y 9CONFIG_MODULES=y
diff --git a/arch/powerpc/configs/85xx/ksi8560_defconfig b/arch/powerpc/configs/85xx/ksi8560_defconfig
index 385b1af37d75..8f7c1061891a 100644
--- a/arch/powerpc/configs/85xx/ksi8560_defconfig
+++ b/arch/powerpc/configs/85xx/ksi8560_defconfig
@@ -4,7 +4,7 @@ CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8# CONFIG_BLK_DEV_BSG is not set 8# CONFIG_BLK_DEV_BSG is not set
9CONFIG_KSI8560=y 9CONFIG_KSI8560=y
10CONFIG_CPM2=y 10CONFIG_CPM2=y
diff --git a/arch/powerpc/configs/85xx/mpc8540_ads_defconfig b/arch/powerpc/configs/85xx/mpc8540_ads_defconfig
index 222b704c1f4b..55e0725500dc 100644
--- a/arch/powerpc/configs/85xx/mpc8540_ads_defconfig
+++ b/arch/powerpc/configs/85xx/mpc8540_ads_defconfig
@@ -4,7 +4,7 @@ CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8# CONFIG_BLK_DEV_BSG is not set 8# CONFIG_BLK_DEV_BSG is not set
9CONFIG_MPC8540_ADS=y 9CONFIG_MPC8540_ADS=y
10CONFIG_NO_HZ=y 10CONFIG_NO_HZ=y
diff --git a/arch/powerpc/configs/85xx/mpc8560_ads_defconfig b/arch/powerpc/configs/85xx/mpc8560_ads_defconfig
index 619702de9477..d724095530a6 100644
--- a/arch/powerpc/configs/85xx/mpc8560_ads_defconfig
+++ b/arch/powerpc/configs/85xx/mpc8560_ads_defconfig
@@ -4,7 +4,7 @@ CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8# CONFIG_BLK_DEV_BSG is not set 8# CONFIG_BLK_DEV_BSG is not set
9CONFIG_MPC8560_ADS=y 9CONFIG_MPC8560_ADS=y
10CONFIG_BINFMT_MISC=y 10CONFIG_BINFMT_MISC=y
diff --git a/arch/powerpc/configs/85xx/mpc85xx_cds_defconfig b/arch/powerpc/configs/85xx/mpc85xx_cds_defconfig
index 6bf56e83f957..4b44beaa21ae 100644
--- a/arch/powerpc/configs/85xx/mpc85xx_cds_defconfig
+++ b/arch/powerpc/configs/85xx/mpc85xx_cds_defconfig
@@ -4,7 +4,7 @@ CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8# CONFIG_BLK_DEV_BSG is not set 8# CONFIG_BLK_DEV_BSG is not set
9CONFIG_MPC85xx_CDS=y 9CONFIG_MPC85xx_CDS=y
10CONFIG_NO_HZ=y 10CONFIG_NO_HZ=y
diff --git a/arch/powerpc/configs/85xx/sbc8548_defconfig b/arch/powerpc/configs/85xx/sbc8548_defconfig
index a9a17d055766..5b2b651dfb98 100644
--- a/arch/powerpc/configs/85xx/sbc8548_defconfig
+++ b/arch/powerpc/configs/85xx/sbc8548_defconfig
@@ -4,7 +4,7 @@ CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8CONFIG_SLAB=y 8CONFIG_SLAB=y
9# CONFIG_BLK_DEV_BSG is not set 9# CONFIG_BLK_DEV_BSG is not set
10CONFIG_SBC8548=y 10CONFIG_SBC8548=y
diff --git a/arch/powerpc/configs/85xx/sbc8560_defconfig b/arch/powerpc/configs/85xx/sbc8560_defconfig
index 820e32d8c42b..f7fdb0318e4c 100644
--- a/arch/powerpc/configs/85xx/sbc8560_defconfig
+++ b/arch/powerpc/configs/85xx/sbc8560_defconfig
@@ -4,7 +4,7 @@ CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8CONFIG_SLAB=y 8CONFIG_SLAB=y
9# CONFIG_BLK_DEV_BSG is not set 9# CONFIG_BLK_DEV_BSG is not set
10CONFIG_SBC8560=y 10CONFIG_SBC8560=y
diff --git a/arch/powerpc/configs/85xx/socrates_defconfig b/arch/powerpc/configs/85xx/socrates_defconfig
index b6db3f47af99..77506b5d5a41 100644
--- a/arch/powerpc/configs/85xx/socrates_defconfig
+++ b/arch/powerpc/configs/85xx/socrates_defconfig
@@ -4,7 +4,7 @@ CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=16 4CONFIG_LOG_BUF_SHIFT=16
5CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8# CONFIG_KALLSYMS is not set 8# CONFIG_KALLSYMS is not set
9# CONFIG_HOTPLUG is not set 9# CONFIG_HOTPLUG is not set
10# CONFIG_EPOLL is not set 10# CONFIG_EPOLL is not set
diff --git a/arch/powerpc/configs/85xx/stx_gp3_defconfig b/arch/powerpc/configs/85xx/stx_gp3_defconfig
index 333a41bd2a68..5d4db154bf59 100644
--- a/arch/powerpc/configs/85xx/stx_gp3_defconfig
+++ b/arch/powerpc/configs/85xx/stx_gp3_defconfig
@@ -4,7 +4,7 @@ CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8CONFIG_MODULES=y 8CONFIG_MODULES=y
9CONFIG_MODVERSIONS=y 9CONFIG_MODVERSIONS=y
10# CONFIG_BLK_DEV_BSG is not set 10# CONFIG_BLK_DEV_BSG is not set
diff --git a/arch/powerpc/configs/85xx/tqm8540_defconfig b/arch/powerpc/configs/85xx/tqm8540_defconfig
index 33db352f847e..ddcb9f37fa1f 100644
--- a/arch/powerpc/configs/85xx/tqm8540_defconfig
+++ b/arch/powerpc/configs/85xx/tqm8540_defconfig
@@ -4,7 +4,7 @@ CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8# CONFIG_KALLSYMS is not set 8# CONFIG_KALLSYMS is not set
9# CONFIG_HOTPLUG is not set 9# CONFIG_HOTPLUG is not set
10# CONFIG_EPOLL is not set 10# CONFIG_EPOLL is not set
diff --git a/arch/powerpc/configs/85xx/tqm8541_defconfig b/arch/powerpc/configs/85xx/tqm8541_defconfig
index f0c20dfbd4d3..981abd6d4b57 100644
--- a/arch/powerpc/configs/85xx/tqm8541_defconfig
+++ b/arch/powerpc/configs/85xx/tqm8541_defconfig
@@ -4,7 +4,7 @@ CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8# CONFIG_KALLSYMS is not set 8# CONFIG_KALLSYMS is not set
9# CONFIG_HOTPLUG is not set 9# CONFIG_HOTPLUG is not set
10# CONFIG_EPOLL is not set 10# CONFIG_EPOLL is not set
diff --git a/arch/powerpc/configs/85xx/tqm8548_defconfig b/arch/powerpc/configs/85xx/tqm8548_defconfig
index a883450dcdfa..37b3d7227cdd 100644
--- a/arch/powerpc/configs/85xx/tqm8548_defconfig
+++ b/arch/powerpc/configs/85xx/tqm8548_defconfig
@@ -4,7 +4,7 @@ CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8CONFIG_MODULES=y 8CONFIG_MODULES=y
9CONFIG_MODULE_UNLOAD=y 9CONFIG_MODULE_UNLOAD=y
10# CONFIG_BLK_DEV_BSG is not set 10# CONFIG_BLK_DEV_BSG is not set
diff --git a/arch/powerpc/configs/85xx/tqm8555_defconfig b/arch/powerpc/configs/85xx/tqm8555_defconfig
index ff95f90dc171..3593b320c97c 100644
--- a/arch/powerpc/configs/85xx/tqm8555_defconfig
+++ b/arch/powerpc/configs/85xx/tqm8555_defconfig
@@ -4,7 +4,7 @@ CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8# CONFIG_KALLSYMS is not set 8# CONFIG_KALLSYMS is not set
9# CONFIG_HOTPLUG is not set 9# CONFIG_HOTPLUG is not set
10# CONFIG_EPOLL is not set 10# CONFIG_EPOLL is not set
diff --git a/arch/powerpc/configs/85xx/tqm8560_defconfig b/arch/powerpc/configs/85xx/tqm8560_defconfig
index 8d6c90ea4783..de413acc34d6 100644
--- a/arch/powerpc/configs/85xx/tqm8560_defconfig
+++ b/arch/powerpc/configs/85xx/tqm8560_defconfig
@@ -4,7 +4,7 @@ CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8# CONFIG_KALLSYMS is not set 8# CONFIG_KALLSYMS is not set
9# CONFIG_HOTPLUG is not set 9# CONFIG_HOTPLUG is not set
10# CONFIG_EPOLL is not set 10# CONFIG_EPOLL is not set
diff --git a/arch/powerpc/configs/85xx/xes_mpc85xx_defconfig b/arch/powerpc/configs/85xx/xes_mpc85xx_defconfig
index f53efe4a0e0c..5ea3124518fd 100644
--- a/arch/powerpc/configs/85xx/xes_mpc85xx_defconfig
+++ b/arch/powerpc/configs/85xx/xes_mpc85xx_defconfig
@@ -11,7 +11,7 @@ CONFIG_IKCONFIG_PROC=y
11CONFIG_LOG_BUF_SHIFT=14 11CONFIG_LOG_BUF_SHIFT=14
12CONFIG_BLK_DEV_INITRD=y 12CONFIG_BLK_DEV_INITRD=y
13# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 13# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
14CONFIG_EMBEDDED=y 14CONFIG_EXPERT=y
15CONFIG_KALLSYMS_ALL=y 15CONFIG_KALLSYMS_ALL=y
16CONFIG_KALLSYMS_EXTRA_PASS=y 16CONFIG_KALLSYMS_EXTRA_PASS=y
17CONFIG_MODULES=y 17CONFIG_MODULES=y
diff --git a/arch/powerpc/configs/86xx/gef_ppc9a_defconfig b/arch/powerpc/configs/86xx/gef_ppc9a_defconfig
index 432ebc28d25c..4b2441244eab 100644
--- a/arch/powerpc/configs/86xx/gef_ppc9a_defconfig
+++ b/arch/powerpc/configs/86xx/gef_ppc9a_defconfig
@@ -11,7 +11,7 @@ CONFIG_LOG_BUF_SHIFT=14
11CONFIG_RELAY=y 11CONFIG_RELAY=y
12CONFIG_BLK_DEV_INITRD=y 12CONFIG_BLK_DEV_INITRD=y
13# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 13# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
14CONFIG_EMBEDDED=y 14CONFIG_EXPERT=y
15CONFIG_SLAB=y 15CONFIG_SLAB=y
16CONFIG_MODULES=y 16CONFIG_MODULES=y
17CONFIG_MODULE_UNLOAD=y 17CONFIG_MODULE_UNLOAD=y
diff --git a/arch/powerpc/configs/86xx/gef_sbc310_defconfig b/arch/powerpc/configs/86xx/gef_sbc310_defconfig
index ce5e919d9b55..a360ba44b928 100644
--- a/arch/powerpc/configs/86xx/gef_sbc310_defconfig
+++ b/arch/powerpc/configs/86xx/gef_sbc310_defconfig
@@ -11,7 +11,7 @@ CONFIG_LOG_BUF_SHIFT=14
11CONFIG_RELAY=y 11CONFIG_RELAY=y
12CONFIG_BLK_DEV_INITRD=y 12CONFIG_BLK_DEV_INITRD=y
13# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 13# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
14CONFIG_EMBEDDED=y 14CONFIG_EXPERT=y
15CONFIG_SLAB=y 15CONFIG_SLAB=y
16CONFIG_MODULES=y 16CONFIG_MODULES=y
17CONFIG_MODULE_UNLOAD=y 17CONFIG_MODULE_UNLOAD=y
diff --git a/arch/powerpc/configs/86xx/gef_sbc610_defconfig b/arch/powerpc/configs/86xx/gef_sbc610_defconfig
index 589e71e6dc1c..be2829dd129f 100644
--- a/arch/powerpc/configs/86xx/gef_sbc610_defconfig
+++ b/arch/powerpc/configs/86xx/gef_sbc610_defconfig
@@ -11,7 +11,7 @@ CONFIG_LOG_BUF_SHIFT=14
11CONFIG_RELAY=y 11CONFIG_RELAY=y
12CONFIG_BLK_DEV_INITRD=y 12CONFIG_BLK_DEV_INITRD=y
13# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 13# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
14CONFIG_EMBEDDED=y 14CONFIG_EXPERT=y
15CONFIG_SLAB=y 15CONFIG_SLAB=y
16CONFIG_MODULES=y 16CONFIG_MODULES=y
17CONFIG_MODULE_UNLOAD=y 17CONFIG_MODULE_UNLOAD=y
diff --git a/arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig b/arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig
index 321fb47096d9..036bfb2d18cd 100644
--- a/arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig
+++ b/arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig
@@ -6,7 +6,7 @@ CONFIG_IKCONFIG_PROC=y
6CONFIG_LOG_BUF_SHIFT=14 6CONFIG_LOG_BUF_SHIFT=14
7CONFIG_BLK_DEV_INITRD=y 7CONFIG_BLK_DEV_INITRD=y
8# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 8# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
9CONFIG_EMBEDDED=y 9CONFIG_EXPERT=y
10CONFIG_KALLSYMS_EXTRA_PASS=y 10CONFIG_KALLSYMS_EXTRA_PASS=y
11# CONFIG_ELF_CORE is not set 11# CONFIG_ELF_CORE is not set
12CONFIG_MODULES=y 12CONFIG_MODULES=y
diff --git a/arch/powerpc/configs/86xx/mpc8641_hpcn_defconfig b/arch/powerpc/configs/86xx/mpc8641_hpcn_defconfig
index b5e46399374e..0c9c7ed7ec75 100644
--- a/arch/powerpc/configs/86xx/mpc8641_hpcn_defconfig
+++ b/arch/powerpc/configs/86xx/mpc8641_hpcn_defconfig
@@ -10,7 +10,7 @@ CONFIG_IKCONFIG_PROC=y
10CONFIG_LOG_BUF_SHIFT=14 10CONFIG_LOG_BUF_SHIFT=14
11CONFIG_BLK_DEV_INITRD=y 11CONFIG_BLK_DEV_INITRD=y
12# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 12# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
13CONFIG_EMBEDDED=y 13CONFIG_EXPERT=y
14CONFIG_KALLSYMS_ALL=y 14CONFIG_KALLSYMS_ALL=y
15CONFIG_KALLSYMS_EXTRA_PASS=y 15CONFIG_KALLSYMS_EXTRA_PASS=y
16CONFIG_MODULES=y 16CONFIG_MODULES=y
diff --git a/arch/powerpc/configs/86xx/sbc8641d_defconfig b/arch/powerpc/configs/86xx/sbc8641d_defconfig
index 71145c3a64db..0a92ca045641 100644
--- a/arch/powerpc/configs/86xx/sbc8641d_defconfig
+++ b/arch/powerpc/configs/86xx/sbc8641d_defconfig
@@ -11,7 +11,7 @@ CONFIG_LOG_BUF_SHIFT=14
11CONFIG_RELAY=y 11CONFIG_RELAY=y
12CONFIG_BLK_DEV_INITRD=y 12CONFIG_BLK_DEV_INITRD=y
13# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 13# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
14CONFIG_EMBEDDED=y 14CONFIG_EXPERT=y
15CONFIG_SLAB=y 15CONFIG_SLAB=y
16CONFIG_MODULES=y 16CONFIG_MODULES=y
17CONFIG_MODULE_UNLOAD=y 17CONFIG_MODULE_UNLOAD=y
diff --git a/arch/powerpc/configs/adder875_defconfig b/arch/powerpc/configs/adder875_defconfig
index ca84c7fc24d5..69128740c14d 100644
--- a/arch/powerpc/configs/adder875_defconfig
+++ b/arch/powerpc/configs/adder875_defconfig
@@ -4,7 +4,7 @@ CONFIG_EXPERIMENTAL=y
4CONFIG_SYSVIPC=y 4CONFIG_SYSVIPC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8# CONFIG_SYSCTL_SYSCALL is not set 8# CONFIG_SYSCTL_SYSCALL is not set
9# CONFIG_ELF_CORE is not set 9# CONFIG_ELF_CORE is not set
10# CONFIG_BASE_FULL is not set 10# CONFIG_BASE_FULL is not set
diff --git a/arch/powerpc/configs/e55xx_smp_defconfig b/arch/powerpc/configs/e55xx_smp_defconfig
index 94d120ef99cf..06f95492afc7 100644
--- a/arch/powerpc/configs/e55xx_smp_defconfig
+++ b/arch/powerpc/configs/e55xx_smp_defconfig
@@ -12,7 +12,7 @@ CONFIG_LOG_BUF_SHIFT=14
12CONFIG_SYSFS_DEPRECATED_V2=y 12CONFIG_SYSFS_DEPRECATED_V2=y
13CONFIG_BLK_DEV_INITRD=y 13CONFIG_BLK_DEV_INITRD=y
14# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 14# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
15CONFIG_EMBEDDED=y 15CONFIG_EXPERT=y
16CONFIG_KALLSYMS_ALL=y 16CONFIG_KALLSYMS_ALL=y
17CONFIG_KALLSYMS_EXTRA_PASS=y 17CONFIG_KALLSYMS_EXTRA_PASS=y
18CONFIG_MODULES=y 18CONFIG_MODULES=y
diff --git a/arch/powerpc/configs/ep8248e_defconfig b/arch/powerpc/configs/ep8248e_defconfig
index 2677b08199e7..fceffb3cffbe 100644
--- a/arch/powerpc/configs/ep8248e_defconfig
+++ b/arch/powerpc/configs/ep8248e_defconfig
@@ -2,7 +2,7 @@ CONFIG_SYSVIPC=y
2CONFIG_IKCONFIG=y 2CONFIG_IKCONFIG=y
3CONFIG_IKCONFIG_PROC=y 3CONFIG_IKCONFIG_PROC=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_EMBEDDED=y 5CONFIG_EXPERT=y
6CONFIG_KALLSYMS_ALL=y 6CONFIG_KALLSYMS_ALL=y
7CONFIG_SLAB=y 7CONFIG_SLAB=y
8# CONFIG_IOSCHED_CFQ is not set 8# CONFIG_IOSCHED_CFQ is not set
diff --git a/arch/powerpc/configs/ep88xc_defconfig b/arch/powerpc/configs/ep88xc_defconfig
index f9a3112e5442..219fd470ed22 100644
--- a/arch/powerpc/configs/ep88xc_defconfig
+++ b/arch/powerpc/configs/ep88xc_defconfig
@@ -4,7 +4,7 @@ CONFIG_EXPERIMENTAL=y
4CONFIG_SYSVIPC=y 4CONFIG_SYSVIPC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8# CONFIG_SYSCTL_SYSCALL is not set 8# CONFIG_SYSCTL_SYSCALL is not set
9# CONFIG_ELF_CORE is not set 9# CONFIG_ELF_CORE is not set
10# CONFIG_BASE_FULL is not set 10# CONFIG_BASE_FULL is not set
diff --git a/arch/powerpc/configs/gamecube_defconfig b/arch/powerpc/configs/gamecube_defconfig
index fcf0a398cd66..e74d3a483705 100644
--- a/arch/powerpc/configs/gamecube_defconfig
+++ b/arch/powerpc/configs/gamecube_defconfig
@@ -6,7 +6,7 @@ CONFIG_IKCONFIG_PROC=y
6CONFIG_LOG_BUF_SHIFT=14 6CONFIG_LOG_BUF_SHIFT=14
7CONFIG_BLK_DEV_INITRD=y 7CONFIG_BLK_DEV_INITRD=y
8# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 8# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
9CONFIG_EMBEDDED=y 9CONFIG_EXPERT=y
10# CONFIG_ELF_CORE is not set 10# CONFIG_ELF_CORE is not set
11CONFIG_PERF_COUNTERS=y 11CONFIG_PERF_COUNTERS=y
12# CONFIG_VM_EVENT_COUNTERS is not set 12# CONFIG_VM_EVENT_COUNTERS is not set
diff --git a/arch/powerpc/configs/holly_defconfig b/arch/powerpc/configs/holly_defconfig
index b9b63a609525..94ebfee188db 100644
--- a/arch/powerpc/configs/holly_defconfig
+++ b/arch/powerpc/configs/holly_defconfig
@@ -3,7 +3,7 @@ CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7CONFIG_MODULES=y 7CONFIG_MODULES=y
8# CONFIG_BLK_DEV_BSG is not set 8# CONFIG_BLK_DEV_BSG is not set
9# CONFIG_PPC_CHRP is not set 9# CONFIG_PPC_CHRP is not set
diff --git a/arch/powerpc/configs/mgcoge_defconfig b/arch/powerpc/configs/mgcoge_defconfig
index c4ed255af18b..39518e91822f 100644
--- a/arch/powerpc/configs/mgcoge_defconfig
+++ b/arch/powerpc/configs/mgcoge_defconfig
@@ -3,7 +3,7 @@ CONFIG_IKCONFIG=y
3CONFIG_IKCONFIG_PROC=y 3CONFIG_IKCONFIG_PROC=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7CONFIG_KALLSYMS_ALL=y 7CONFIG_KALLSYMS_ALL=y
8CONFIG_SLAB=y 8CONFIG_SLAB=y
9# CONFIG_IOSCHED_CFQ is not set 9# CONFIG_IOSCHED_CFQ is not set
diff --git a/arch/powerpc/configs/mgsuvd_defconfig b/arch/powerpc/configs/mgsuvd_defconfig
index f276c7cf555b..2a490626015c 100644
--- a/arch/powerpc/configs/mgsuvd_defconfig
+++ b/arch/powerpc/configs/mgsuvd_defconfig
@@ -4,7 +4,7 @@ CONFIG_EXPERIMENTAL=y
4CONFIG_SYSVIPC=y 4CONFIG_SYSVIPC=y
5CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8# CONFIG_SYSCTL_SYSCALL is not set 8# CONFIG_SYSCTL_SYSCALL is not set
9# CONFIG_HOTPLUG is not set 9# CONFIG_HOTPLUG is not set
10# CONFIG_BUG is not set 10# CONFIG_BUG is not set
diff --git a/arch/powerpc/configs/mpc7448_hpc2_defconfig b/arch/powerpc/configs/mpc7448_hpc2_defconfig
index 3b9470883de5..75f0bbf0f6e8 100644
--- a/arch/powerpc/configs/mpc7448_hpc2_defconfig
+++ b/arch/powerpc/configs/mpc7448_hpc2_defconfig
@@ -4,7 +4,7 @@ CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8# CONFIG_BLK_DEV_BSG is not set 8# CONFIG_BLK_DEV_BSG is not set
9# CONFIG_PPC_CHRP is not set 9# CONFIG_PPC_CHRP is not set
10# CONFIG_PPC_PMAC is not set 10# CONFIG_PPC_PMAC is not set
diff --git a/arch/powerpc/configs/mpc8272_ads_defconfig b/arch/powerpc/configs/mpc8272_ads_defconfig
index c7d68ff1a736..6a22400f73c1 100644
--- a/arch/powerpc/configs/mpc8272_ads_defconfig
+++ b/arch/powerpc/configs/mpc8272_ads_defconfig
@@ -2,7 +2,7 @@ CONFIG_SYSVIPC=y
2CONFIG_IKCONFIG=y 2CONFIG_IKCONFIG=y
3CONFIG_IKCONFIG_PROC=y 3CONFIG_IKCONFIG_PROC=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_EMBEDDED=y 5CONFIG_EXPERT=y
6CONFIG_KALLSYMS_ALL=y 6CONFIG_KALLSYMS_ALL=y
7# CONFIG_PPC_CHRP is not set 7# CONFIG_PPC_CHRP is not set
8# CONFIG_PPC_PMAC is not set 8# CONFIG_PPC_PMAC is not set
diff --git a/arch/powerpc/configs/mpc83xx_defconfig b/arch/powerpc/configs/mpc83xx_defconfig
index 5b1b10fd9740..5aac9a8bc53b 100644
--- a/arch/powerpc/configs/mpc83xx_defconfig
+++ b/arch/powerpc/configs/mpc83xx_defconfig
@@ -3,7 +3,7 @@ CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7CONFIG_SLAB=y 7CONFIG_SLAB=y
8CONFIG_MODULES=y 8CONFIG_MODULES=y
9CONFIG_MODULE_UNLOAD=y 9CONFIG_MODULE_UNLOAD=y
diff --git a/arch/powerpc/configs/mpc85xx_defconfig b/arch/powerpc/configs/mpc85xx_defconfig
index 3aeb5949cfef..99a19d1e9bf8 100644
--- a/arch/powerpc/configs/mpc85xx_defconfig
+++ b/arch/powerpc/configs/mpc85xx_defconfig
@@ -10,7 +10,7 @@ CONFIG_IKCONFIG_PROC=y
10CONFIG_LOG_BUF_SHIFT=14 10CONFIG_LOG_BUF_SHIFT=14
11CONFIG_BLK_DEV_INITRD=y 11CONFIG_BLK_DEV_INITRD=y
12# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 12# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
13CONFIG_EMBEDDED=y 13CONFIG_EXPERT=y
14CONFIG_KALLSYMS_ALL=y 14CONFIG_KALLSYMS_ALL=y
15CONFIG_KALLSYMS_EXTRA_PASS=y 15CONFIG_KALLSYMS_EXTRA_PASS=y
16CONFIG_MODULES=y 16CONFIG_MODULES=y
diff --git a/arch/powerpc/configs/mpc85xx_smp_defconfig b/arch/powerpc/configs/mpc85xx_smp_defconfig
index d62c8016f4bc..c636f23f8c92 100644
--- a/arch/powerpc/configs/mpc85xx_smp_defconfig
+++ b/arch/powerpc/configs/mpc85xx_smp_defconfig
@@ -12,7 +12,7 @@ CONFIG_IKCONFIG_PROC=y
12CONFIG_LOG_BUF_SHIFT=14 12CONFIG_LOG_BUF_SHIFT=14
13CONFIG_BLK_DEV_INITRD=y 13CONFIG_BLK_DEV_INITRD=y
14# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 14# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
15CONFIG_EMBEDDED=y 15CONFIG_EXPERT=y
16CONFIG_KALLSYMS_ALL=y 16CONFIG_KALLSYMS_ALL=y
17CONFIG_KALLSYMS_EXTRA_PASS=y 17CONFIG_KALLSYMS_EXTRA_PASS=y
18CONFIG_MODULES=y 18CONFIG_MODULES=y
diff --git a/arch/powerpc/configs/mpc866_ads_defconfig b/arch/powerpc/configs/mpc866_ads_defconfig
index 668215cae890..5c258823e694 100644
--- a/arch/powerpc/configs/mpc866_ads_defconfig
+++ b/arch/powerpc/configs/mpc866_ads_defconfig
@@ -4,7 +4,7 @@ CONFIG_EXPERIMENTAL=y
4CONFIG_SYSVIPC=y 4CONFIG_SYSVIPC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8# CONFIG_SYSCTL_SYSCALL is not set 8# CONFIG_SYSCTL_SYSCALL is not set
9# CONFIG_HOTPLUG is not set 9# CONFIG_HOTPLUG is not set
10# CONFIG_BUG is not set 10# CONFIG_BUG is not set
diff --git a/arch/powerpc/configs/mpc86xx_defconfig b/arch/powerpc/configs/mpc86xx_defconfig
index 63b90d477889..55b54318fef6 100644
--- a/arch/powerpc/configs/mpc86xx_defconfig
+++ b/arch/powerpc/configs/mpc86xx_defconfig
@@ -10,7 +10,7 @@ CONFIG_IKCONFIG_PROC=y
10CONFIG_LOG_BUF_SHIFT=14 10CONFIG_LOG_BUF_SHIFT=14
11CONFIG_BLK_DEV_INITRD=y 11CONFIG_BLK_DEV_INITRD=y
12# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 12# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
13CONFIG_EMBEDDED=y 13CONFIG_EXPERT=y
14CONFIG_KALLSYMS_ALL=y 14CONFIG_KALLSYMS_ALL=y
15CONFIG_KALLSYMS_EXTRA_PASS=y 15CONFIG_KALLSYMS_EXTRA_PASS=y
16CONFIG_MODULES=y 16CONFIG_MODULES=y
diff --git a/arch/powerpc/configs/mpc885_ads_defconfig b/arch/powerpc/configs/mpc885_ads_defconfig
index f9b83481b00e..9e146cdf63de 100644
--- a/arch/powerpc/configs/mpc885_ads_defconfig
+++ b/arch/powerpc/configs/mpc885_ads_defconfig
@@ -4,7 +4,7 @@ CONFIG_EXPERIMENTAL=y
4CONFIG_SYSVIPC=y 4CONFIG_SYSVIPC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EMBEDDED=y 7CONFIG_EXPERT=y
8# CONFIG_SYSCTL_SYSCALL is not set 8# CONFIG_SYSCTL_SYSCALL is not set
9# CONFIG_ELF_CORE is not set 9# CONFIG_ELF_CORE is not set
10# CONFIG_BASE_FULL is not set 10# CONFIG_BASE_FULL is not set
diff --git a/arch/powerpc/configs/ppc40x_defconfig b/arch/powerpc/configs/ppc40x_defconfig
index 93d7425ce6cd..bfd634b5ada7 100644
--- a/arch/powerpc/configs/ppc40x_defconfig
+++ b/arch/powerpc/configs/ppc40x_defconfig
@@ -5,7 +5,7 @@ CONFIG_POSIX_MQUEUE=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9CONFIG_KALLSYMS_ALL=y 9CONFIG_KALLSYMS_ALL=y
10CONFIG_KALLSYMS_EXTRA_PASS=y 10CONFIG_KALLSYMS_EXTRA_PASS=y
11CONFIG_MODULES=y 11CONFIG_MODULES=y
diff --git a/arch/powerpc/configs/ppc44x_defconfig b/arch/powerpc/configs/ppc44x_defconfig
index 2fa05f7be4cb..47133202a625 100644
--- a/arch/powerpc/configs/ppc44x_defconfig
+++ b/arch/powerpc/configs/ppc44x_defconfig
@@ -5,7 +5,7 @@ CONFIG_POSIX_MQUEUE=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9CONFIG_KALLSYMS_ALL=y 9CONFIG_KALLSYMS_ALL=y
10CONFIG_KALLSYMS_EXTRA_PASS=y 10CONFIG_KALLSYMS_EXTRA_PASS=y
11CONFIG_MODULES=y 11CONFIG_MODULES=y
diff --git a/arch/powerpc/configs/pq2fads_defconfig b/arch/powerpc/configs/pq2fads_defconfig
index a4353bef31c5..baad8db21b61 100644
--- a/arch/powerpc/configs/pq2fads_defconfig
+++ b/arch/powerpc/configs/pq2fads_defconfig
@@ -3,7 +3,7 @@ CONFIG_IKCONFIG=y
3CONFIG_IKCONFIG_PROC=y 3CONFIG_IKCONFIG_PROC=y
4CONFIG_LOG_BUF_SHIFT=14 4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7CONFIG_KALLSYMS_ALL=y 7CONFIG_KALLSYMS_ALL=y
8# CONFIG_PPC_CHRP is not set 8# CONFIG_PPC_CHRP is not set
9# CONFIG_PPC_PMAC is not set 9# CONFIG_PPC_PMAC is not set
diff --git a/arch/powerpc/configs/ps3_defconfig b/arch/powerpc/configs/ps3_defconfig
index 49cffe003657..caba919f65d8 100644
--- a/arch/powerpc/configs/ps3_defconfig
+++ b/arch/powerpc/configs/ps3_defconfig
@@ -8,7 +8,7 @@ CONFIG_SYSVIPC=y
8CONFIG_POSIX_MQUEUE=y 8CONFIG_POSIX_MQUEUE=y
9CONFIG_NAMESPACES=y 9CONFIG_NAMESPACES=y
10CONFIG_BLK_DEV_INITRD=y 10CONFIG_BLK_DEV_INITRD=y
11CONFIG_EMBEDDED=y 11CONFIG_EXPERT=y
12CONFIG_KALLSYMS_EXTRA_PASS=y 12CONFIG_KALLSYMS_EXTRA_PASS=y
13# CONFIG_PERF_EVENTS is not set 13# CONFIG_PERF_EVENTS is not set
14# CONFIG_COMPAT_BRK is not set 14# CONFIG_COMPAT_BRK is not set
diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig
index f87f0e15cfa7..9c3f22c6cde1 100644
--- a/arch/powerpc/configs/pseries_defconfig
+++ b/arch/powerpc/configs/pseries_defconfig
@@ -2,7 +2,7 @@ CONFIG_PPC64=y
2CONFIG_ALTIVEC=y 2CONFIG_ALTIVEC=y
3CONFIG_VSX=y 3CONFIG_VSX=y
4CONFIG_SMP=y 4CONFIG_SMP=y
5CONFIG_NR_CPUS=128 5CONFIG_NR_CPUS=1024
6CONFIG_EXPERIMENTAL=y 6CONFIG_EXPERIMENTAL=y
7CONFIG_SYSVIPC=y 7CONFIG_SYSVIPC=y
8CONFIG_POSIX_MQUEUE=y 8CONFIG_POSIX_MQUEUE=y
@@ -45,6 +45,8 @@ CONFIG_KEXEC=y
45CONFIG_IRQ_ALL_CPUS=y 45CONFIG_IRQ_ALL_CPUS=y
46CONFIG_MEMORY_HOTPLUG=y 46CONFIG_MEMORY_HOTPLUG=y
47CONFIG_MEMORY_HOTREMOVE=y 47CONFIG_MEMORY_HOTREMOVE=y
48CONFIG_PPC_64K_PAGES=y
49CONFIG_PPC_SUBPAGE_PROT=y
48CONFIG_SCHED_SMT=y 50CONFIG_SCHED_SMT=y
49CONFIG_HOTPLUG_PCI=m 51CONFIG_HOTPLUG_PCI=m
50CONFIG_HOTPLUG_PCI_RPA=m 52CONFIG_HOTPLUG_PCI_RPA=m
@@ -184,6 +186,7 @@ CONFIG_ACENIC_OMIT_TIGON_I=y
184CONFIG_E1000=y 186CONFIG_E1000=y
185CONFIG_E1000E=y 187CONFIG_E1000E=y
186CONFIG_TIGON3=y 188CONFIG_TIGON3=y
189CONFIG_BNX2=m
187CONFIG_CHELSIO_T1=m 190CONFIG_CHELSIO_T1=m
188CONFIG_CHELSIO_T3=m 191CONFIG_CHELSIO_T3=m
189CONFIG_EHEA=y 192CONFIG_EHEA=y
@@ -311,9 +314,7 @@ CONFIG_DEBUG_KERNEL=y
311# CONFIG_RCU_CPU_STALL_DETECTOR is not set 314# CONFIG_RCU_CPU_STALL_DETECTOR is not set
312CONFIG_LATENCYTOP=y 315CONFIG_LATENCYTOP=y
313CONFIG_SYSCTL_SYSCALL_CHECK=y 316CONFIG_SYSCTL_SYSCALL_CHECK=y
314CONFIG_IRQSOFF_TRACER=y
315CONFIG_SCHED_TRACER=y 317CONFIG_SCHED_TRACER=y
316CONFIG_STACK_TRACER=y
317CONFIG_BLK_DEV_IO_TRACE=y 318CONFIG_BLK_DEV_IO_TRACE=y
318CONFIG_DEBUG_STACKOVERFLOW=y 319CONFIG_DEBUG_STACKOVERFLOW=y
319CONFIG_DEBUG_STACK_USAGE=y 320CONFIG_DEBUG_STACK_USAGE=y
diff --git a/arch/powerpc/configs/storcenter_defconfig b/arch/powerpc/configs/storcenter_defconfig
index 4f0c10a62b9d..ebb2a66c99d3 100644
--- a/arch/powerpc/configs/storcenter_defconfig
+++ b/arch/powerpc/configs/storcenter_defconfig
@@ -1,7 +1,7 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_LOG_BUF_SHIFT=14 3CONFIG_LOG_BUF_SHIFT=14
4CONFIG_EMBEDDED=y 4CONFIG_EXPERT=y
5# CONFIG_KALLSYMS is not set 5# CONFIG_KALLSYMS is not set
6CONFIG_MODULES=y 6CONFIG_MODULES=y
7CONFIG_MODULE_UNLOAD=y 7CONFIG_MODULE_UNLOAD=y
diff --git a/arch/powerpc/configs/tqm8xx_defconfig b/arch/powerpc/configs/tqm8xx_defconfig
index d0a5b6763880..8616fde0896f 100644
--- a/arch/powerpc/configs/tqm8xx_defconfig
+++ b/arch/powerpc/configs/tqm8xx_defconfig
@@ -5,7 +5,7 @@ CONFIG_SYSVIPC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_SYSFS_DEPRECATED_V2=y 6CONFIG_SYSFS_DEPRECATED_V2=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EMBEDDED=y 8CONFIG_EXPERT=y
9# CONFIG_SYSCTL_SYSCALL is not set 9# CONFIG_SYSCTL_SYSCALL is not set
10# CONFIG_ELF_CORE is not set 10# CONFIG_ELF_CORE is not set
11# CONFIG_BASE_FULL is not set 11# CONFIG_BASE_FULL is not set
diff --git a/arch/powerpc/configs/wii_defconfig b/arch/powerpc/configs/wii_defconfig
index bb8ba75b7c68..175295fbf4f3 100644
--- a/arch/powerpc/configs/wii_defconfig
+++ b/arch/powerpc/configs/wii_defconfig
@@ -7,7 +7,7 @@ CONFIG_IKCONFIG_PROC=y
7CONFIG_LOG_BUF_SHIFT=14 7CONFIG_LOG_BUF_SHIFT=14
8CONFIG_BLK_DEV_INITRD=y 8CONFIG_BLK_DEV_INITRD=y
9# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 9# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
10CONFIG_EMBEDDED=y 10CONFIG_EXPERT=y
11# CONFIG_ELF_CORE is not set 11# CONFIG_ELF_CORE is not set
12CONFIG_PERF_COUNTERS=y 12CONFIG_PERF_COUNTERS=y
13# CONFIG_VM_EVENT_COUNTERS is not set 13# CONFIG_VM_EVENT_COUNTERS is not set
diff --git a/arch/powerpc/include/asm/feature-fixups.h b/arch/powerpc/include/asm/feature-fixups.h
index 96a7d067fbb2..921a8470e18a 100644
--- a/arch/powerpc/include/asm/feature-fixups.h
+++ b/arch/powerpc/include/asm/feature-fixups.h
@@ -37,18 +37,21 @@ label##2: \
37 .align 2; \ 37 .align 2; \
38label##3: 38label##3:
39 39
40#define MAKE_FTR_SECTION_ENTRY(msk, val, label, sect) \ 40#define MAKE_FTR_SECTION_ENTRY(msk, val, label, sect) \
41label##4: \ 41label##4: \
42 .popsection; \ 42 .popsection; \
43 .pushsection sect,"a"; \ 43 .pushsection sect,"a"; \
44 .align 3; \ 44 .align 3; \
45label##5: \ 45label##5: \
46 FTR_ENTRY_LONG msk; \ 46 FTR_ENTRY_LONG msk; \
47 FTR_ENTRY_LONG val; \ 47 FTR_ENTRY_LONG val; \
48 FTR_ENTRY_OFFSET label##1b-label##5b; \ 48 FTR_ENTRY_OFFSET label##1b-label##5b; \
49 FTR_ENTRY_OFFSET label##2b-label##5b; \ 49 FTR_ENTRY_OFFSET label##2b-label##5b; \
50 FTR_ENTRY_OFFSET label##3b-label##5b; \ 50 FTR_ENTRY_OFFSET label##3b-label##5b; \
51 FTR_ENTRY_OFFSET label##4b-label##5b; \ 51 FTR_ENTRY_OFFSET label##4b-label##5b; \
52 .ifgt (label##4b-label##3b)-(label##2b-label##1b); \
53 .error "Feature section else case larger than body"; \
54 .endif; \
52 .popsection; 55 .popsection;
53 56
54 57
diff --git a/arch/powerpc/include/asm/immap_qe.h b/arch/powerpc/include/asm/immap_qe.h
index 4e10f508570a..0edb6842b13d 100644
--- a/arch/powerpc/include/asm/immap_qe.h
+++ b/arch/powerpc/include/asm/immap_qe.h
@@ -467,13 +467,22 @@ struct qe_immap {
467extern struct qe_immap __iomem *qe_immr; 467extern struct qe_immap __iomem *qe_immr;
468extern phys_addr_t get_qe_base(void); 468extern phys_addr_t get_qe_base(void);
469 469
470static inline unsigned long immrbar_virt_to_phys(void *address) 470/*
471 * Returns the offset within the QE address space of the given pointer.
472 *
473 * Note that the QE does not support 36-bit physical addresses, so if
474 * get_qe_base() returns a number above 4GB, the caller will probably fail.
475 */
476static inline phys_addr_t immrbar_virt_to_phys(void *address)
471{ 477{
472 if ( ((u32)address >= (u32)qe_immr) && 478 void *q = (void *)qe_immr;
473 ((u32)address < ((u32)qe_immr + QE_IMMAP_SIZE)) ) 479
474 return (unsigned long)(address - (u32)qe_immr + 480 /* Is it a MURAM address? */
475 (u32)get_qe_base()); 481 if ((address >= q) && (address < (q + QE_IMMAP_SIZE)))
476 return (unsigned long)virt_to_phys(address); 482 return get_qe_base() + (address - q);
483
484 /* It's an address returned by kmalloc */
485 return virt_to_phys(address);
477} 486}
478 487
479#endif /* __KERNEL__ */ 488#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/irqflags.h b/arch/powerpc/include/asm/irqflags.h
index b85d8ddbb666..b0b06d85788d 100644
--- a/arch/powerpc/include/asm/irqflags.h
+++ b/arch/powerpc/include/asm/irqflags.h
@@ -12,24 +12,44 @@
12 12
13#else 13#else
14#ifdef CONFIG_TRACE_IRQFLAGS 14#ifdef CONFIG_TRACE_IRQFLAGS
15#ifdef CONFIG_IRQSOFF_TRACER
16/*
17 * Since the ftrace irqsoff latency trace checks CALLER_ADDR1,
18 * which is the stack frame here, we need to force a stack frame
19 * in case we came from user space.
20 */
21#define TRACE_WITH_FRAME_BUFFER(func) \
22 mflr r0; \
23 stdu r1, -32(r1); \
24 std r0, 16(r1); \
25 stdu r1, -32(r1); \
26 bl func; \
27 ld r1, 0(r1); \
28 ld r1, 0(r1);
29#else
30#define TRACE_WITH_FRAME_BUFFER(func) \
31 bl func;
32#endif
33
15/* 34/*
16 * Most of the CPU's IRQ-state tracing is done from assembly code; we 35 * Most of the CPU's IRQ-state tracing is done from assembly code; we
17 * have to call a C function so call a wrapper that saves all the 36 * have to call a C function so call a wrapper that saves all the
18 * C-clobbered registers. 37 * C-clobbered registers.
19 */ 38 */
20#define TRACE_ENABLE_INTS bl .trace_hardirqs_on 39#define TRACE_ENABLE_INTS TRACE_WITH_FRAME_BUFFER(.trace_hardirqs_on)
21#define TRACE_DISABLE_INTS bl .trace_hardirqs_off 40#define TRACE_DISABLE_INTS TRACE_WITH_FRAME_BUFFER(.trace_hardirqs_off)
22#define TRACE_AND_RESTORE_IRQ_PARTIAL(en,skip) \ 41
23 cmpdi en,0; \ 42#define TRACE_AND_RESTORE_IRQ_PARTIAL(en,skip) \
24 bne 95f; \ 43 cmpdi en,0; \
25 stb en,PACASOFTIRQEN(r13); \ 44 bne 95f; \
26 bl .trace_hardirqs_off; \ 45 stb en,PACASOFTIRQEN(r13); \
27 b skip; \ 46 TRACE_WITH_FRAME_BUFFER(.trace_hardirqs_off) \
2895: bl .trace_hardirqs_on; \ 47 b skip; \
4895: TRACE_WITH_FRAME_BUFFER(.trace_hardirqs_on) \
29 li en,1; 49 li en,1;
30#define TRACE_AND_RESTORE_IRQ(en) \ 50#define TRACE_AND_RESTORE_IRQ(en) \
31 TRACE_AND_RESTORE_IRQ_PARTIAL(en,96f); \ 51 TRACE_AND_RESTORE_IRQ_PARTIAL(en,96f); \
32 stb en,PACASOFTIRQEN(r13); \ 52 stb en,PACASOFTIRQEN(r13); \
3396: 5396:
34#else 54#else
35#define TRACE_ENABLE_INTS 55#define TRACE_ENABLE_INTS
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index 8433d36619a1..991d5998d6be 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -116,9 +116,6 @@ struct machdep_calls {
116 * If for some reason there is no irq, but the interrupt 116 * If for some reason there is no irq, but the interrupt
117 * shouldn't be counted as spurious, return NO_IRQ_IGNORE. */ 117 * shouldn't be counted as spurious, return NO_IRQ_IGNORE. */
118 unsigned int (*get_irq)(void); 118 unsigned int (*get_irq)(void);
119#ifdef CONFIG_KEXEC
120 void (*kexec_cpu_down)(int crash_shutdown, int secondary);
121#endif
122 119
123 /* PCI stuff */ 120 /* PCI stuff */
124 /* Called after scanning the bus, before allocating resources */ 121 /* Called after scanning the bus, before allocating resources */
@@ -235,11 +232,7 @@ struct machdep_calls {
235 void (*machine_shutdown)(void); 232 void (*machine_shutdown)(void);
236 233
237#ifdef CONFIG_KEXEC 234#ifdef CONFIG_KEXEC
238 /* Called to do the minimal shutdown needed to run a kexec'd kernel 235 void (*kexec_cpu_down)(int crash_shutdown, int secondary);
239 * to run successfully.
240 * XXX Should we move this one out of kexec scope?
241 */
242 void (*machine_crash_shutdown)(struct pt_regs *regs);
243 236
244 /* Called to do what every setup is needed on image and the 237 /* Called to do what every setup is needed on image and the
245 * reboot code buffer. Returns 0 on success. 238 * reboot code buffer. Returns 0 on success.
@@ -247,15 +240,6 @@ struct machdep_calls {
247 * claims to support kexec. 240 * claims to support kexec.
248 */ 241 */
249 int (*machine_kexec_prepare)(struct kimage *image); 242 int (*machine_kexec_prepare)(struct kimage *image);
250
251 /* Called to handle any machine specific cleanup on image */
252 void (*machine_kexec_cleanup)(struct kimage *image);
253
254 /* Called to perform the _real_ kexec.
255 * Do NOT allocate memory or fail here. We are past the point of
256 * no return.
257 */
258 void (*machine_kexec)(struct kimage *image);
259#endif /* CONFIG_KEXEC */ 243#endif /* CONFIG_KEXEC */
260 244
261#ifdef CONFIG_SUSPEND 245#ifdef CONFIG_SUSPEND
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index ff0005eec7dd..125fc1ad665d 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -283,6 +283,7 @@
283#define HID0_NOPTI (1<<0) /* No-op dcbt and dcbst instr. */ 283#define HID0_NOPTI (1<<0) /* No-op dcbt and dcbst instr. */
284 284
285#define SPRN_HID1 0x3F1 /* Hardware Implementation Register 1 */ 285#define SPRN_HID1 0x3F1 /* Hardware Implementation Register 1 */
286#ifdef CONFIG_6xx
286#define HID1_EMCP (1<<31) /* 7450 Machine Check Pin Enable */ 287#define HID1_EMCP (1<<31) /* 7450 Machine Check Pin Enable */
287#define HID1_DFS (1<<22) /* 7447A Dynamic Frequency Scaling */ 288#define HID1_DFS (1<<22) /* 7447A Dynamic Frequency Scaling */
288#define HID1_PC0 (1<<16) /* 7450 PLL_CFG[0] */ 289#define HID1_PC0 (1<<16) /* 7450 PLL_CFG[0] */
@@ -292,6 +293,7 @@
292#define HID1_SYNCBE (1<<11) /* 7450 ABE for sync, eieio */ 293#define HID1_SYNCBE (1<<11) /* 7450 ABE for sync, eieio */
293#define HID1_ABE (1<<10) /* 7450 Address Broadcast Enable */ 294#define HID1_ABE (1<<10) /* 7450 Address Broadcast Enable */
294#define HID1_PS (1<<16) /* 750FX PLL selection */ 295#define HID1_PS (1<<16) /* 750FX PLL selection */
296#endif
295#define SPRN_HID2 0x3F8 /* Hardware Implementation Register 2 */ 297#define SPRN_HID2 0x3F8 /* Hardware Implementation Register 2 */
296#define SPRN_HID2_GEKKO 0x398 /* Gekko HID2 Register */ 298#define SPRN_HID2_GEKKO 0x398 /* Gekko HID2 Register */
297#define SPRN_IABR 0x3F2 /* Instruction Address Breakpoint Register */ 299#define SPRN_IABR 0x3F2 /* Instruction Address Breakpoint Register */
diff --git a/arch/powerpc/include/asm/reg_booke.h b/arch/powerpc/include/asm/reg_booke.h
index 667a498eaee1..e68c69bf741a 100644
--- a/arch/powerpc/include/asm/reg_booke.h
+++ b/arch/powerpc/include/asm/reg_booke.h
@@ -246,6 +246,20 @@
246 store or cache line push */ 246 store or cache line push */
247#endif 247#endif
248 248
249/* Bit definitions for the HID1 */
250#ifdef CONFIG_E500
251/* e500v1/v2 */
252#define HID1_PLL_CFG_MASK 0xfc000000 /* PLL_CFG input pins */
253#define HID1_RFXE 0x00020000 /* Read fault exception enable */
254#define HID1_R1DPE 0x00008000 /* R1 data bus parity enable */
255#define HID1_R2DPE 0x00004000 /* R2 data bus parity enable */
256#define HID1_ASTME 0x00002000 /* Address bus streaming mode enable */
257#define HID1_ABE 0x00001000 /* Address broadcast enable */
258#define HID1_MPXTT 0x00000400 /* MPX re-map transfer type */
259#define HID1_ATS 0x00000080 /* Atomic status */
260#define HID1_MID_MASK 0x0000000f /* MID input pins */
261#endif
262
249/* Bit definitions for the DBSR. */ 263/* Bit definitions for the DBSR. */
250/* 264/*
251 * DBSR bits which have conflicting definitions on true Book E versus IBM 40x. 265 * DBSR bits which have conflicting definitions on true Book E versus IBM 40x.
diff --git a/arch/powerpc/include/asm/spu.h b/arch/powerpc/include/asm/spu.h
index 0ab8d869e3d6..0c8b35d75232 100644
--- a/arch/powerpc/include/asm/spu.h
+++ b/arch/powerpc/include/asm/spu.h
@@ -203,14 +203,6 @@ void spu_irq_setaffinity(struct spu *spu, int cpu);
203void spu_setup_kernel_slbs(struct spu *spu, struct spu_lscsa *lscsa, 203void spu_setup_kernel_slbs(struct spu *spu, struct spu_lscsa *lscsa,
204 void *code, int code_size); 204 void *code, int code_size);
205 205
206#ifdef CONFIG_KEXEC
207void crash_register_spus(struct list_head *list);
208#else
209static inline void crash_register_spus(struct list_head *list)
210{
211}
212#endif
213
214extern void spu_invalidate_slbs(struct spu *spu); 206extern void spu_invalidate_slbs(struct spu *spu);
215extern void spu_associate_mm(struct spu *spu, struct mm_struct *mm); 207extern void spu_associate_mm(struct spu *spu, struct mm_struct *mm);
216int spu_64k_pages_available(void); 208int spu_64k_pages_available(void);
diff --git a/arch/powerpc/kernel/cpu_setup_fsl_booke.S b/arch/powerpc/kernel/cpu_setup_fsl_booke.S
index 894e64fa481e..5c518ad3445c 100644
--- a/arch/powerpc/kernel/cpu_setup_fsl_booke.S
+++ b/arch/powerpc/kernel/cpu_setup_fsl_booke.S
@@ -64,6 +64,12 @@ _GLOBAL(__setup_cpu_e500v2)
64 bl __e500_icache_setup 64 bl __e500_icache_setup
65 bl __e500_dcache_setup 65 bl __e500_dcache_setup
66 bl __setup_e500_ivors 66 bl __setup_e500_ivors
67#ifdef CONFIG_RAPIDIO
68 /* Ensure that RFXE is set */
69 mfspr r3,SPRN_HID1
70 oris r3,r3,HID1_RFXE@h
71 mtspr SPRN_HID1,r3
72#endif
67 mtlr r4 73 mtlr r4
68 blr 74 blr
69_GLOBAL(__setup_cpu_e500mc) 75_GLOBAL(__setup_cpu_e500mc)
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index be5ab18b03b5..8d74a24c5502 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -116,7 +116,6 @@ static struct cpu_spec __initdata cpu_specs[] = {
116 .pmc_type = PPC_PMC_IBM, 116 .pmc_type = PPC_PMC_IBM,
117 .oprofile_cpu_type = "ppc64/power3", 117 .oprofile_cpu_type = "ppc64/power3",
118 .oprofile_type = PPC_OPROFILE_RS64, 118 .oprofile_type = PPC_OPROFILE_RS64,
119 .machine_check = machine_check_generic,
120 .platform = "power3", 119 .platform = "power3",
121 }, 120 },
122 { /* Power3+ */ 121 { /* Power3+ */
@@ -132,7 +131,6 @@ static struct cpu_spec __initdata cpu_specs[] = {
132 .pmc_type = PPC_PMC_IBM, 131 .pmc_type = PPC_PMC_IBM,
133 .oprofile_cpu_type = "ppc64/power3", 132 .oprofile_cpu_type = "ppc64/power3",
134 .oprofile_type = PPC_OPROFILE_RS64, 133 .oprofile_type = PPC_OPROFILE_RS64,
135 .machine_check = machine_check_generic,
136 .platform = "power3", 134 .platform = "power3",
137 }, 135 },
138 { /* Northstar */ 136 { /* Northstar */
@@ -148,7 +146,6 @@ static struct cpu_spec __initdata cpu_specs[] = {
148 .pmc_type = PPC_PMC_IBM, 146 .pmc_type = PPC_PMC_IBM,
149 .oprofile_cpu_type = "ppc64/rs64", 147 .oprofile_cpu_type = "ppc64/rs64",
150 .oprofile_type = PPC_OPROFILE_RS64, 148 .oprofile_type = PPC_OPROFILE_RS64,
151 .machine_check = machine_check_generic,
152 .platform = "rs64", 149 .platform = "rs64",
153 }, 150 },
154 { /* Pulsar */ 151 { /* Pulsar */
@@ -164,7 +161,6 @@ static struct cpu_spec __initdata cpu_specs[] = {
164 .pmc_type = PPC_PMC_IBM, 161 .pmc_type = PPC_PMC_IBM,
165 .oprofile_cpu_type = "ppc64/rs64", 162 .oprofile_cpu_type = "ppc64/rs64",
166 .oprofile_type = PPC_OPROFILE_RS64, 163 .oprofile_type = PPC_OPROFILE_RS64,
167 .machine_check = machine_check_generic,
168 .platform = "rs64", 164 .platform = "rs64",
169 }, 165 },
170 { /* I-star */ 166 { /* I-star */
@@ -180,7 +176,6 @@ static struct cpu_spec __initdata cpu_specs[] = {
180 .pmc_type = PPC_PMC_IBM, 176 .pmc_type = PPC_PMC_IBM,
181 .oprofile_cpu_type = "ppc64/rs64", 177 .oprofile_cpu_type = "ppc64/rs64",
182 .oprofile_type = PPC_OPROFILE_RS64, 178 .oprofile_type = PPC_OPROFILE_RS64,
183 .machine_check = machine_check_generic,
184 .platform = "rs64", 179 .platform = "rs64",
185 }, 180 },
186 { /* S-star */ 181 { /* S-star */
@@ -196,7 +191,6 @@ static struct cpu_spec __initdata cpu_specs[] = {
196 .pmc_type = PPC_PMC_IBM, 191 .pmc_type = PPC_PMC_IBM,
197 .oprofile_cpu_type = "ppc64/rs64", 192 .oprofile_cpu_type = "ppc64/rs64",
198 .oprofile_type = PPC_OPROFILE_RS64, 193 .oprofile_type = PPC_OPROFILE_RS64,
199 .machine_check = machine_check_generic,
200 .platform = "rs64", 194 .platform = "rs64",
201 }, 195 },
202 { /* Power4 */ 196 { /* Power4 */
@@ -212,7 +206,6 @@ static struct cpu_spec __initdata cpu_specs[] = {
212 .pmc_type = PPC_PMC_IBM, 206 .pmc_type = PPC_PMC_IBM,
213 .oprofile_cpu_type = "ppc64/power4", 207 .oprofile_cpu_type = "ppc64/power4",
214 .oprofile_type = PPC_OPROFILE_POWER4, 208 .oprofile_type = PPC_OPROFILE_POWER4,
215 .machine_check = machine_check_generic,
216 .platform = "power4", 209 .platform = "power4",
217 }, 210 },
218 { /* Power4+ */ 211 { /* Power4+ */
@@ -228,7 +221,6 @@ static struct cpu_spec __initdata cpu_specs[] = {
228 .pmc_type = PPC_PMC_IBM, 221 .pmc_type = PPC_PMC_IBM,
229 .oprofile_cpu_type = "ppc64/power4", 222 .oprofile_cpu_type = "ppc64/power4",
230 .oprofile_type = PPC_OPROFILE_POWER4, 223 .oprofile_type = PPC_OPROFILE_POWER4,
231 .machine_check = machine_check_generic,
232 .platform = "power4", 224 .platform = "power4",
233 }, 225 },
234 { /* PPC970 */ 226 { /* PPC970 */
@@ -247,7 +239,6 @@ static struct cpu_spec __initdata cpu_specs[] = {
247 .cpu_restore = __restore_cpu_ppc970, 239 .cpu_restore = __restore_cpu_ppc970,
248 .oprofile_cpu_type = "ppc64/970", 240 .oprofile_cpu_type = "ppc64/970",
249 .oprofile_type = PPC_OPROFILE_POWER4, 241 .oprofile_type = PPC_OPROFILE_POWER4,
250 .machine_check = machine_check_generic,
251 .platform = "ppc970", 242 .platform = "ppc970",
252 }, 243 },
253 { /* PPC970FX */ 244 { /* PPC970FX */
@@ -266,7 +257,6 @@ static struct cpu_spec __initdata cpu_specs[] = {
266 .cpu_restore = __restore_cpu_ppc970, 257 .cpu_restore = __restore_cpu_ppc970,
267 .oprofile_cpu_type = "ppc64/970", 258 .oprofile_cpu_type = "ppc64/970",
268 .oprofile_type = PPC_OPROFILE_POWER4, 259 .oprofile_type = PPC_OPROFILE_POWER4,
269 .machine_check = machine_check_generic,
270 .platform = "ppc970", 260 .platform = "ppc970",
271 }, 261 },
272 { /* PPC970MP DD1.0 - no DEEPNAP, use regular 970 init */ 262 { /* PPC970MP DD1.0 - no DEEPNAP, use regular 970 init */
@@ -285,7 +275,6 @@ static struct cpu_spec __initdata cpu_specs[] = {
285 .cpu_restore = __restore_cpu_ppc970, 275 .cpu_restore = __restore_cpu_ppc970,
286 .oprofile_cpu_type = "ppc64/970MP", 276 .oprofile_cpu_type = "ppc64/970MP",
287 .oprofile_type = PPC_OPROFILE_POWER4, 277 .oprofile_type = PPC_OPROFILE_POWER4,
288 .machine_check = machine_check_generic,
289 .platform = "ppc970", 278 .platform = "ppc970",
290 }, 279 },
291 { /* PPC970MP */ 280 { /* PPC970MP */
@@ -304,7 +293,6 @@ static struct cpu_spec __initdata cpu_specs[] = {
304 .cpu_restore = __restore_cpu_ppc970, 293 .cpu_restore = __restore_cpu_ppc970,
305 .oprofile_cpu_type = "ppc64/970MP", 294 .oprofile_cpu_type = "ppc64/970MP",
306 .oprofile_type = PPC_OPROFILE_POWER4, 295 .oprofile_type = PPC_OPROFILE_POWER4,
307 .machine_check = machine_check_generic,
308 .platform = "ppc970", 296 .platform = "ppc970",
309 }, 297 },
310 { /* PPC970GX */ 298 { /* PPC970GX */
@@ -322,7 +310,6 @@ static struct cpu_spec __initdata cpu_specs[] = {
322 .cpu_setup = __setup_cpu_ppc970, 310 .cpu_setup = __setup_cpu_ppc970,
323 .oprofile_cpu_type = "ppc64/970", 311 .oprofile_cpu_type = "ppc64/970",
324 .oprofile_type = PPC_OPROFILE_POWER4, 312 .oprofile_type = PPC_OPROFILE_POWER4,
325 .machine_check = machine_check_generic,
326 .platform = "ppc970", 313 .platform = "ppc970",
327 }, 314 },
328 { /* Power5 GR */ 315 { /* Power5 GR */
@@ -343,7 +330,6 @@ static struct cpu_spec __initdata cpu_specs[] = {
343 */ 330 */
344 .oprofile_mmcra_sihv = MMCRA_SIHV, 331 .oprofile_mmcra_sihv = MMCRA_SIHV,
345 .oprofile_mmcra_sipr = MMCRA_SIPR, 332 .oprofile_mmcra_sipr = MMCRA_SIPR,
346 .machine_check = machine_check_generic,
347 .platform = "power5", 333 .platform = "power5",
348 }, 334 },
349 { /* Power5++ */ 335 { /* Power5++ */
@@ -360,7 +346,6 @@ static struct cpu_spec __initdata cpu_specs[] = {
360 .oprofile_type = PPC_OPROFILE_POWER4, 346 .oprofile_type = PPC_OPROFILE_POWER4,
361 .oprofile_mmcra_sihv = MMCRA_SIHV, 347 .oprofile_mmcra_sihv = MMCRA_SIHV,
362 .oprofile_mmcra_sipr = MMCRA_SIPR, 348 .oprofile_mmcra_sipr = MMCRA_SIPR,
363 .machine_check = machine_check_generic,
364 .platform = "power5+", 349 .platform = "power5+",
365 }, 350 },
366 { /* Power5 GS */ 351 { /* Power5 GS */
@@ -378,7 +363,6 @@ static struct cpu_spec __initdata cpu_specs[] = {
378 .oprofile_type = PPC_OPROFILE_POWER4, 363 .oprofile_type = PPC_OPROFILE_POWER4,
379 .oprofile_mmcra_sihv = MMCRA_SIHV, 364 .oprofile_mmcra_sihv = MMCRA_SIHV,
380 .oprofile_mmcra_sipr = MMCRA_SIPR, 365 .oprofile_mmcra_sipr = MMCRA_SIPR,
381 .machine_check = machine_check_generic,
382 .platform = "power5+", 366 .platform = "power5+",
383 }, 367 },
384 { /* POWER6 in P5+ mode; 2.04-compliant processor */ 368 { /* POWER6 in P5+ mode; 2.04-compliant processor */
@@ -390,7 +374,6 @@ static struct cpu_spec __initdata cpu_specs[] = {
390 .mmu_features = MMU_FTR_HPTE_TABLE, 374 .mmu_features = MMU_FTR_HPTE_TABLE,
391 .icache_bsize = 128, 375 .icache_bsize = 128,
392 .dcache_bsize = 128, 376 .dcache_bsize = 128,
393 .machine_check = machine_check_generic,
394 .oprofile_cpu_type = "ppc64/ibm-compat-v1", 377 .oprofile_cpu_type = "ppc64/ibm-compat-v1",
395 .oprofile_type = PPC_OPROFILE_POWER4, 378 .oprofile_type = PPC_OPROFILE_POWER4,
396 .platform = "power5+", 379 .platform = "power5+",
@@ -413,7 +396,6 @@ static struct cpu_spec __initdata cpu_specs[] = {
413 .oprofile_mmcra_sipr = POWER6_MMCRA_SIPR, 396 .oprofile_mmcra_sipr = POWER6_MMCRA_SIPR,
414 .oprofile_mmcra_clear = POWER6_MMCRA_THRM | 397 .oprofile_mmcra_clear = POWER6_MMCRA_THRM |
415 POWER6_MMCRA_OTHER, 398 POWER6_MMCRA_OTHER,
416 .machine_check = machine_check_generic,
417 .platform = "power6x", 399 .platform = "power6x",
418 }, 400 },
419 { /* 2.05-compliant processor, i.e. Power6 "architected" mode */ 401 { /* 2.05-compliant processor, i.e. Power6 "architected" mode */
@@ -425,7 +407,6 @@ static struct cpu_spec __initdata cpu_specs[] = {
425 .mmu_features = MMU_FTR_HPTE_TABLE, 407 .mmu_features = MMU_FTR_HPTE_TABLE,
426 .icache_bsize = 128, 408 .icache_bsize = 128,
427 .dcache_bsize = 128, 409 .dcache_bsize = 128,
428 .machine_check = machine_check_generic,
429 .oprofile_cpu_type = "ppc64/ibm-compat-v1", 410 .oprofile_cpu_type = "ppc64/ibm-compat-v1",
430 .oprofile_type = PPC_OPROFILE_POWER4, 411 .oprofile_type = PPC_OPROFILE_POWER4,
431 .platform = "power6", 412 .platform = "power6",
@@ -440,7 +421,6 @@ static struct cpu_spec __initdata cpu_specs[] = {
440 MMU_FTR_TLBIE_206, 421 MMU_FTR_TLBIE_206,
441 .icache_bsize = 128, 422 .icache_bsize = 128,
442 .dcache_bsize = 128, 423 .dcache_bsize = 128,
443 .machine_check = machine_check_generic,
444 .oprofile_type = PPC_OPROFILE_POWER4, 424 .oprofile_type = PPC_OPROFILE_POWER4,
445 .oprofile_cpu_type = "ppc64/ibm-compat-v1", 425 .oprofile_cpu_type = "ppc64/ibm-compat-v1",
446 .platform = "power7", 426 .platform = "power7",
@@ -492,7 +472,6 @@ static struct cpu_spec __initdata cpu_specs[] = {
492 .pmc_type = PPC_PMC_IBM, 472 .pmc_type = PPC_PMC_IBM,
493 .oprofile_cpu_type = "ppc64/cell-be", 473 .oprofile_cpu_type = "ppc64/cell-be",
494 .oprofile_type = PPC_OPROFILE_CELL, 474 .oprofile_type = PPC_OPROFILE_CELL,
495 .machine_check = machine_check_generic,
496 .platform = "ppc-cell-be", 475 .platform = "ppc-cell-be",
497 }, 476 },
498 { /* PA Semi PA6T */ 477 { /* PA Semi PA6T */
@@ -510,7 +489,6 @@ static struct cpu_spec __initdata cpu_specs[] = {
510 .cpu_restore = __restore_cpu_pa6t, 489 .cpu_restore = __restore_cpu_pa6t,
511 .oprofile_cpu_type = "ppc64/pa6t", 490 .oprofile_cpu_type = "ppc64/pa6t",
512 .oprofile_type = PPC_OPROFILE_PA6T, 491 .oprofile_type = PPC_OPROFILE_PA6T,
513 .machine_check = machine_check_generic,
514 .platform = "pa6t", 492 .platform = "pa6t",
515 }, 493 },
516 { /* default match */ 494 { /* default match */
@@ -524,7 +502,6 @@ static struct cpu_spec __initdata cpu_specs[] = {
524 .dcache_bsize = 128, 502 .dcache_bsize = 128,
525 .num_pmcs = 6, 503 .num_pmcs = 6,
526 .pmc_type = PPC_PMC_IBM, 504 .pmc_type = PPC_PMC_IBM,
527 .machine_check = machine_check_generic,
528 .platform = "power4", 505 .platform = "power4",
529 } 506 }
530#endif /* CONFIG_PPC_BOOK3S_64 */ 507#endif /* CONFIG_PPC_BOOK3S_64 */
diff --git a/arch/powerpc/kernel/crash.c b/arch/powerpc/kernel/crash.c
index 832c8c4db254..3d569e2aff18 100644
--- a/arch/powerpc/kernel/crash.c
+++ b/arch/powerpc/kernel/crash.c
@@ -48,7 +48,7 @@ int crashing_cpu = -1;
48static cpumask_t cpus_in_crash = CPU_MASK_NONE; 48static cpumask_t cpus_in_crash = CPU_MASK_NONE;
49cpumask_t cpus_in_sr = CPU_MASK_NONE; 49cpumask_t cpus_in_sr = CPU_MASK_NONE;
50 50
51#define CRASH_HANDLER_MAX 2 51#define CRASH_HANDLER_MAX 3
52/* NULL terminated list of shutdown handles */ 52/* NULL terminated list of shutdown handles */
53static crash_shutdown_t crash_shutdown_handles[CRASH_HANDLER_MAX+1]; 53static crash_shutdown_t crash_shutdown_handles[CRASH_HANDLER_MAX+1];
54static DEFINE_SPINLOCK(crash_handlers_lock); 54static DEFINE_SPINLOCK(crash_handlers_lock);
@@ -125,7 +125,7 @@ static void crash_kexec_prepare_cpus(int cpu)
125 smp_wmb(); 125 smp_wmb();
126 126
127 /* 127 /*
128 * FIXME: Until we will have the way to stop other CPUSs reliabally, 128 * FIXME: Until we will have the way to stop other CPUs reliably,
129 * the crash CPU will send an IPI and wait for other CPUs to 129 * the crash CPU will send an IPI and wait for other CPUs to
130 * respond. 130 * respond.
131 * Delay of at least 10 seconds. 131 * Delay of at least 10 seconds.
@@ -254,72 +254,6 @@ void crash_kexec_secondary(struct pt_regs *regs)
254 cpus_in_sr = CPU_MASK_NONE; 254 cpus_in_sr = CPU_MASK_NONE;
255} 255}
256#endif 256#endif
257#ifdef CONFIG_SPU_BASE
258
259#include <asm/spu.h>
260#include <asm/spu_priv1.h>
261
262struct crash_spu_info {
263 struct spu *spu;
264 u32 saved_spu_runcntl_RW;
265 u32 saved_spu_status_R;
266 u32 saved_spu_npc_RW;
267 u64 saved_mfc_sr1_RW;
268 u64 saved_mfc_dar;
269 u64 saved_mfc_dsisr;
270};
271
272#define CRASH_NUM_SPUS 16 /* Enough for current hardware */
273static struct crash_spu_info crash_spu_info[CRASH_NUM_SPUS];
274
275static void crash_kexec_stop_spus(void)
276{
277 struct spu *spu;
278 int i;
279 u64 tmp;
280
281 for (i = 0; i < CRASH_NUM_SPUS; i++) {
282 if (!crash_spu_info[i].spu)
283 continue;
284
285 spu = crash_spu_info[i].spu;
286
287 crash_spu_info[i].saved_spu_runcntl_RW =
288 in_be32(&spu->problem->spu_runcntl_RW);
289 crash_spu_info[i].saved_spu_status_R =
290 in_be32(&spu->problem->spu_status_R);
291 crash_spu_info[i].saved_spu_npc_RW =
292 in_be32(&spu->problem->spu_npc_RW);
293
294 crash_spu_info[i].saved_mfc_dar = spu_mfc_dar_get(spu);
295 crash_spu_info[i].saved_mfc_dsisr = spu_mfc_dsisr_get(spu);
296 tmp = spu_mfc_sr1_get(spu);
297 crash_spu_info[i].saved_mfc_sr1_RW = tmp;
298
299 tmp &= ~MFC_STATE1_MASTER_RUN_CONTROL_MASK;
300 spu_mfc_sr1_set(spu, tmp);
301
302 __delay(200);
303 }
304}
305
306void crash_register_spus(struct list_head *list)
307{
308 struct spu *spu;
309
310 list_for_each_entry(spu, list, full_list) {
311 if (WARN_ON(spu->number >= CRASH_NUM_SPUS))
312 continue;
313
314 crash_spu_info[spu->number].spu = spu;
315 }
316}
317
318#else
319static inline void crash_kexec_stop_spus(void)
320{
321}
322#endif /* CONFIG_SPU_BASE */
323 257
324/* 258/*
325 * Register a function to be called on shutdown. Only use this if you 259 * Register a function to be called on shutdown. Only use this if you
@@ -439,8 +373,6 @@ void default_machine_crash_shutdown(struct pt_regs *regs)
439 crash_shutdown_cpu = -1; 373 crash_shutdown_cpu = -1;
440 __debugger_fault_handler = old_handler; 374 __debugger_fault_handler = old_handler;
441 375
442 crash_kexec_stop_spus();
443
444 if (ppc_md.kexec_cpu_down) 376 if (ppc_md.kexec_cpu_down)
445 ppc_md.kexec_cpu_down(1, 0); 377 ppc_md.kexec_cpu_down(1, 0);
446} 378}
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index c22dc1ec1c94..56212bc0ab08 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -880,7 +880,18 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_TYPE_47x)
880 */ 880 */
881 andi. r10,r9,MSR_EE 881 andi. r10,r9,MSR_EE
882 beq 1f 882 beq 1f
883 /*
884 * Since the ftrace irqsoff latency trace checks CALLER_ADDR1,
885 * which is the stack frame here, we need to force a stack frame
886 * in case we came from user space.
887 */
888 stwu r1,-32(r1)
889 mflr r0
890 stw r0,4(r1)
891 stwu r1,-32(r1)
883 bl trace_hardirqs_on 892 bl trace_hardirqs_on
893 lwz r1,0(r1)
894 lwz r1,0(r1)
884 lwz r9,_MSR(r1) 895 lwz r9,_MSR(r1)
8851: 8961:
886#endif /* CONFIG_TRACE_IRQFLAGS */ 897#endif /* CONFIG_TRACE_IRQFLAGS */
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index df7e20c191cd..49a170af8145 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -15,6 +15,7 @@
15#include <linux/memblock.h> 15#include <linux/memblock.h>
16#include <linux/of.h> 16#include <linux/of.h>
17#include <linux/irq.h> 17#include <linux/irq.h>
18#include <linux/ftrace.h>
18 19
19#include <asm/machdep.h> 20#include <asm/machdep.h>
20#include <asm/prom.h> 21#include <asm/prom.h>
@@ -44,10 +45,7 @@ void machine_kexec_mask_interrupts(void) {
44 45
45void machine_crash_shutdown(struct pt_regs *regs) 46void machine_crash_shutdown(struct pt_regs *regs)
46{ 47{
47 if (ppc_md.machine_crash_shutdown) 48 default_machine_crash_shutdown(regs);
48 ppc_md.machine_crash_shutdown(regs);
49 else
50 default_machine_crash_shutdown(regs);
51} 49}
52 50
53/* 51/*
@@ -65,8 +63,6 @@ int machine_kexec_prepare(struct kimage *image)
65 63
66void machine_kexec_cleanup(struct kimage *image) 64void machine_kexec_cleanup(struct kimage *image)
67{ 65{
68 if (ppc_md.machine_kexec_cleanup)
69 ppc_md.machine_kexec_cleanup(image);
70} 66}
71 67
72void arch_crash_save_vmcoreinfo(void) 68void arch_crash_save_vmcoreinfo(void)
@@ -87,10 +83,13 @@ void arch_crash_save_vmcoreinfo(void)
87 */ 83 */
88void machine_kexec(struct kimage *image) 84void machine_kexec(struct kimage *image)
89{ 85{
90 if (ppc_md.machine_kexec) 86 int save_ftrace_enabled;
91 ppc_md.machine_kexec(image); 87
92 else 88 save_ftrace_enabled = __ftrace_enabled_save();
93 default_machine_kexec(image); 89
90 default_machine_kexec(image);
91
92 __ftrace_enabled_restore(save_ftrace_enabled);
94 93
95 /* Fall back to normal restart if we're still alive. */ 94 /* Fall back to normal restart if we're still alive. */
96 machine_restart(NULL); 95 machine_restart(NULL);
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 84906d3fc860..7a1d5cb76932 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -631,7 +631,7 @@ void show_regs(struct pt_regs * regs)
631#ifdef CONFIG_PPC_ADV_DEBUG_REGS 631#ifdef CONFIG_PPC_ADV_DEBUG_REGS
632 printk("DEAR: "REG", ESR: "REG"\n", regs->dar, regs->dsisr); 632 printk("DEAR: "REG", ESR: "REG"\n", regs->dar, regs->dsisr);
633#else 633#else
634 printk("DAR: "REG", DSISR: "REG"\n", regs->dar, regs->dsisr); 634 printk("DAR: "REG", DSISR: %08lx\n", regs->dar, regs->dsisr);
635#endif 635#endif
636 printk("TASK = %p[%d] '%s' THREAD: %p", 636 printk("TASK = %p[%d] '%s' THREAD: %p",
637 current, task_pid_nr(current), current->comm, task_thread_info(current)); 637 current, task_pid_nr(current), current->comm, task_thread_info(current));
diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c
index 2b442e6c21e6..bf5f5ce3a7bd 100644
--- a/arch/powerpc/kernel/rtas_flash.c
+++ b/arch/powerpc/kernel/rtas_flash.c
@@ -256,31 +256,16 @@ static ssize_t rtas_flash_read(struct file *file, char __user *buf,
256 struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode); 256 struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode);
257 struct rtas_update_flash_t *uf; 257 struct rtas_update_flash_t *uf;
258 char msg[RTAS_MSG_MAXLEN]; 258 char msg[RTAS_MSG_MAXLEN];
259 int msglen;
260 259
261 uf = (struct rtas_update_flash_t *) dp->data; 260 uf = dp->data;
262 261
263 if (!strcmp(dp->name, FIRMWARE_FLASH_NAME)) { 262 if (!strcmp(dp->name, FIRMWARE_FLASH_NAME)) {
264 get_flash_status_msg(uf->status, msg); 263 get_flash_status_msg(uf->status, msg);
265 } else { /* FIRMWARE_UPDATE_NAME */ 264 } else { /* FIRMWARE_UPDATE_NAME */
266 sprintf(msg, "%d\n", uf->status); 265 sprintf(msg, "%d\n", uf->status);
267 } 266 }
268 msglen = strlen(msg);
269 if (msglen > count)
270 msglen = count;
271
272 if (ppos && *ppos != 0)
273 return 0; /* be cheap */
274
275 if (!access_ok(VERIFY_WRITE, buf, msglen))
276 return -EINVAL;
277 267
278 if (copy_to_user(buf, msg, msglen)) 268 return simple_read_from_buffer(buf, count, ppos, msg, strlen(msg));
279 return -EFAULT;
280
281 if (ppos)
282 *ppos = msglen;
283 return msglen;
284} 269}
285 270
286/* constructor for flash_block_cache */ 271/* constructor for flash_block_cache */
@@ -394,26 +379,13 @@ static ssize_t manage_flash_read(struct file *file, char __user *buf,
394 char msg[RTAS_MSG_MAXLEN]; 379 char msg[RTAS_MSG_MAXLEN];
395 int msglen; 380 int msglen;
396 381
397 args_buf = (struct rtas_manage_flash_t *) dp->data; 382 args_buf = dp->data;
398 if (args_buf == NULL) 383 if (args_buf == NULL)
399 return 0; 384 return 0;
400 385
401 msglen = sprintf(msg, "%d\n", args_buf->status); 386 msglen = sprintf(msg, "%d\n", args_buf->status);
402 if (msglen > count)
403 msglen = count;
404 387
405 if (ppos && *ppos != 0) 388 return simple_read_from_buffer(buf, count, ppos, msg, msglen);
406 return 0; /* be cheap */
407
408 if (!access_ok(VERIFY_WRITE, buf, msglen))
409 return -EINVAL;
410
411 if (copy_to_user(buf, msg, msglen))
412 return -EFAULT;
413
414 if (ppos)
415 *ppos = msglen;
416 return msglen;
417} 389}
418 390
419static ssize_t manage_flash_write(struct file *file, const char __user *buf, 391static ssize_t manage_flash_write(struct file *file, const char __user *buf,
@@ -495,24 +467,11 @@ static ssize_t validate_flash_read(struct file *file, char __user *buf,
495 char msg[RTAS_MSG_MAXLEN]; 467 char msg[RTAS_MSG_MAXLEN];
496 int msglen; 468 int msglen;
497 469
498 args_buf = (struct rtas_validate_flash_t *) dp->data; 470 args_buf = dp->data;
499 471
500 if (ppos && *ppos != 0)
501 return 0; /* be cheap */
502
503 msglen = get_validate_flash_msg(args_buf, msg); 472 msglen = get_validate_flash_msg(args_buf, msg);
504 if (msglen > count)
505 msglen = count;
506
507 if (!access_ok(VERIFY_WRITE, buf, msglen))
508 return -EINVAL;
509
510 if (copy_to_user(buf, msg, msglen))
511 return -EFAULT;
512 473
513 if (ppos) 474 return simple_read_from_buffer(buf, count, ppos, msg, msglen);
514 *ppos = msglen;
515 return msglen;
516} 475}
517 476
518static ssize_t validate_flash_write(struct file *file, const char __user *buf, 477static ssize_t validate_flash_write(struct file *file, const char __user *buf,
diff --git a/arch/powerpc/kernel/rtasd.c b/arch/powerpc/kernel/rtasd.c
index 0438f819fe6b..049dbecb5dbc 100644
--- a/arch/powerpc/kernel/rtasd.c
+++ b/arch/powerpc/kernel/rtasd.c
@@ -160,7 +160,7 @@ static int log_rtas_len(char * buf)
160 /* rtas fixed header */ 160 /* rtas fixed header */
161 len = 8; 161 len = 8;
162 err = (struct rtas_error_log *)buf; 162 err = (struct rtas_error_log *)buf;
163 if (err->extended_log_length) { 163 if (err->extended && err->extended_log_length) {
164 164
165 /* extended header */ 165 /* extended header */
166 len += err->extended_log_length; 166 len += err->extended_log_length;
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 09e4dea4a85a..09d31dbf43f9 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -265,11 +265,26 @@ void accumulate_stolen_time(void)
265{ 265{
266 u64 sst, ust; 266 u64 sst, ust;
267 267
268 sst = scan_dispatch_log(get_paca()->starttime_user); 268 u8 save_soft_enabled = local_paca->soft_enabled;
269 ust = scan_dispatch_log(get_paca()->starttime); 269 u8 save_hard_enabled = local_paca->hard_enabled;
270 get_paca()->system_time -= sst; 270
271 get_paca()->user_time -= ust; 271 /* We are called early in the exception entry, before
272 get_paca()->stolen_time += ust + sst; 272 * soft/hard_enabled are sync'ed to the expected state
273 * for the exception. We are hard disabled but the PACA
274 * needs to reflect that so various debug stuff doesn't
275 * complain
276 */
277 local_paca->soft_enabled = 0;
278 local_paca->hard_enabled = 0;
279
280 sst = scan_dispatch_log(local_paca->starttime_user);
281 ust = scan_dispatch_log(local_paca->starttime);
282 local_paca->system_time -= sst;
283 local_paca->user_time -= ust;
284 local_paca->stolen_time += ust + sst;
285
286 local_paca->soft_enabled = save_soft_enabled;
287 local_paca->hard_enabled = save_hard_enabled;
273} 288}
274 289
275static inline u64 calculate_stolen_time(u64 stop_tb) 290static inline u64 calculate_stolen_time(u64 stop_tb)
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 1b2cdc8eec90..bd74fac169be 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -626,12 +626,6 @@ void machine_check_exception(struct pt_regs *regs)
626 if (recover > 0) 626 if (recover > 0)
627 return; 627 return;
628 628
629 if (user_mode(regs)) {
630 regs->msr |= MSR_RI;
631 _exception(SIGBUS, regs, BUS_ADRERR, regs->nip);
632 return;
633 }
634
635#if defined(CONFIG_8xx) && defined(CONFIG_PCI) 629#if defined(CONFIG_8xx) && defined(CONFIG_PCI)
636 /* the qspan pci read routines can cause machine checks -- Cort 630 /* the qspan pci read routines can cause machine checks -- Cort
637 * 631 *
@@ -643,16 +637,12 @@ void machine_check_exception(struct pt_regs *regs)
643 return; 637 return;
644#endif 638#endif
645 639
646 if (debugger_fault_handler(regs)) { 640 if (debugger_fault_handler(regs))
647 regs->msr |= MSR_RI;
648 return; 641 return;
649 }
650 642
651 if (check_io_access(regs)) 643 if (check_io_access(regs))
652 return; 644 return;
653 645
654 if (debugger_fault_handler(regs))
655 return;
656 die("Machine check", regs, SIGBUS); 646 die("Machine check", regs, SIGBUS);
657 647
658 /* Must die if the interrupt is not recoverable */ 648 /* Must die if the interrupt is not recoverable */
diff --git a/arch/powerpc/lib/feature-fixups-test.S b/arch/powerpc/lib/feature-fixups-test.S
index cb737484c5aa..f4613118132e 100644
--- a/arch/powerpc/lib/feature-fixups-test.S
+++ b/arch/powerpc/lib/feature-fixups-test.S
@@ -172,6 +172,25 @@ globl(ftr_fixup_test6_expected)
1723: or 3,3,3 1723: or 3,3,3
173 173
174 174
175#if 0
176/* Test that if we have a larger else case the assembler spots it and
177 * reports an error. #if 0'ed so as not to break the build normally.
178 */
179ftr_fixup_test7:
180 or 1,1,1
181BEGIN_FTR_SECTION
182 or 2,2,2
183 or 2,2,2
184 or 2,2,2
185FTR_SECTION_ELSE
186 or 3,3,3
187 or 3,3,3
188 or 3,3,3
189 or 3,3,3
190ALT_FTR_SECTION_END(0, 1)
191 or 1,1,1
192#endif
193
175#define MAKE_MACRO_TEST(TYPE) \ 194#define MAKE_MACRO_TEST(TYPE) \
176globl(ftr_fixup_test_ ##TYPE##_macros) \ 195globl(ftr_fixup_test_ ##TYPE##_macros) \
177 or 1,1,1; \ 196 or 1,1,1; \
diff --git a/arch/powerpc/platforms/83xx/mpc830x_rdb.c b/arch/powerpc/platforms/83xx/mpc830x_rdb.c
index 661d354e4ff2..d0c4e15b7794 100644
--- a/arch/powerpc/platforms/83xx/mpc830x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc830x_rdb.c
@@ -57,12 +57,12 @@ static void __init mpc830x_rdb_init_IRQ(void)
57 ipic_set_default_priority(); 57 ipic_set_default_priority();
58} 58}
59 59
60struct const char *board[] __initdata = { 60static const char *board[] __initdata = {
61 "MPC8308RDB", 61 "MPC8308RDB",
62 "fsl,mpc8308rdb", 62 "fsl,mpc8308rdb",
63 "denx,mpc8308_p1m", 63 "denx,mpc8308_p1m",
64 NULL 64 NULL
65} 65};
66 66
67/* 67/*
68 * Called very early, MMU is off, device-tree isn't unflattened 68 * Called very early, MMU is off, device-tree isn't unflattened
diff --git a/arch/powerpc/platforms/83xx/mpc831x_rdb.c b/arch/powerpc/platforms/83xx/mpc831x_rdb.c
index b54cd736a895..f859ead49a8d 100644
--- a/arch/powerpc/platforms/83xx/mpc831x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc831x_rdb.c
@@ -60,11 +60,11 @@ static void __init mpc831x_rdb_init_IRQ(void)
60 ipic_set_default_priority(); 60 ipic_set_default_priority();
61} 61}
62 62
63struct const char *board[] __initdata = { 63static const char *board[] __initdata = {
64 "MPC8313ERDB", 64 "MPC8313ERDB",
65 "fsl,mpc8315erdb", 65 "fsl,mpc8315erdb",
66 NULL 66 NULL
67} 67};
68 68
69/* 69/*
70 * Called very early, MMU is off, device-tree isn't unflattened 70 * Called very early, MMU is off, device-tree isn't unflattened
diff --git a/arch/powerpc/platforms/83xx/mpc83xx.h b/arch/powerpc/platforms/83xx/mpc83xx.h
index 0fea8811d45b..82a434510d83 100644
--- a/arch/powerpc/platforms/83xx/mpc83xx.h
+++ b/arch/powerpc/platforms/83xx/mpc83xx.h
@@ -35,6 +35,8 @@
35 35
36/* system i/o configuration register high */ 36/* system i/o configuration register high */
37#define MPC83XX_SICRH_OFFS 0x118 37#define MPC83XX_SICRH_OFFS 0x118
38#define MPC8308_SICRH_USB_MASK 0x000c0000
39#define MPC8308_SICRH_USB_ULPI 0x00040000
38#define MPC834X_SICRH_USB_UTMI 0x00020000 40#define MPC834X_SICRH_USB_UTMI 0x00020000
39#define MPC831X_SICRH_USB_MASK 0x000000e0 41#define MPC831X_SICRH_USB_MASK 0x000000e0
40#define MPC831X_SICRH_USB_ULPI 0x000000a0 42#define MPC831X_SICRH_USB_ULPI 0x000000a0
diff --git a/arch/powerpc/platforms/83xx/usb.c b/arch/powerpc/platforms/83xx/usb.c
index 3ba4bb7d41bb..2c64164722d0 100644
--- a/arch/powerpc/platforms/83xx/usb.c
+++ b/arch/powerpc/platforms/83xx/usb.c
@@ -127,7 +127,8 @@ int mpc831x_usb_cfg(void)
127 127
128 /* Configure clock */ 128 /* Configure clock */
129 immr_node = of_get_parent(np); 129 immr_node = of_get_parent(np);
130 if (immr_node && of_device_is_compatible(immr_node, "fsl,mpc8315-immr")) 130 if (immr_node && (of_device_is_compatible(immr_node, "fsl,mpc8315-immr") ||
131 of_device_is_compatible(immr_node, "fsl,mpc8308-immr")))
131 clrsetbits_be32(immap + MPC83XX_SCCR_OFFS, 132 clrsetbits_be32(immap + MPC83XX_SCCR_OFFS,
132 MPC8315_SCCR_USB_MASK, 133 MPC8315_SCCR_USB_MASK,
133 MPC8315_SCCR_USB_DRCM_01); 134 MPC8315_SCCR_USB_DRCM_01);
@@ -138,7 +139,11 @@ int mpc831x_usb_cfg(void)
138 139
139 /* Configure pin mux for ULPI. There is no pin mux for UTMI */ 140 /* Configure pin mux for ULPI. There is no pin mux for UTMI */
140 if (prop && !strcmp(prop, "ulpi")) { 141 if (prop && !strcmp(prop, "ulpi")) {
141 if (of_device_is_compatible(immr_node, "fsl,mpc8315-immr")) { 142 if (of_device_is_compatible(immr_node, "fsl,mpc8308-immr")) {
143 clrsetbits_be32(immap + MPC83XX_SICRH_OFFS,
144 MPC8308_SICRH_USB_MASK,
145 MPC8308_SICRH_USB_ULPI);
146 } else if (of_device_is_compatible(immr_node, "fsl,mpc8315-immr")) {
142 clrsetbits_be32(immap + MPC83XX_SICRL_OFFS, 147 clrsetbits_be32(immap + MPC83XX_SICRL_OFFS,
143 MPC8315_SICRL_USB_MASK, 148 MPC8315_SICRL_USB_MASK,
144 MPC8315_SICRL_USB_ULPI); 149 MPC8315_SICRL_USB_ULPI);
@@ -173,6 +178,9 @@ int mpc831x_usb_cfg(void)
173 !strcmp(prop, "utmi"))) { 178 !strcmp(prop, "utmi"))) {
174 u32 refsel; 179 u32 refsel;
175 180
181 if (of_device_is_compatible(immr_node, "fsl,mpc8308-immr"))
182 goto out;
183
176 if (of_device_is_compatible(immr_node, "fsl,mpc8315-immr")) 184 if (of_device_is_compatible(immr_node, "fsl,mpc8315-immr"))
177 refsel = CONTROL_REFSEL_24MHZ; 185 refsel = CONTROL_REFSEL_24MHZ;
178 else 186 else
@@ -186,9 +194,11 @@ int mpc831x_usb_cfg(void)
186 temp = CONTROL_PHY_CLK_SEL_ULPI; 194 temp = CONTROL_PHY_CLK_SEL_ULPI;
187#ifdef CONFIG_USB_OTG 195#ifdef CONFIG_USB_OTG
188 /* Set OTG_PORT */ 196 /* Set OTG_PORT */
189 dr_mode = of_get_property(np, "dr_mode", NULL); 197 if (!of_device_is_compatible(immr_node, "fsl,mpc8308-immr")) {
190 if (dr_mode && !strcmp(dr_mode, "otg")) 198 dr_mode = of_get_property(np, "dr_mode", NULL);
191 temp |= CONTROL_OTG_PORT; 199 if (dr_mode && !strcmp(dr_mode, "otg"))
200 temp |= CONTROL_OTG_PORT;
201 }
192#endif /* CONFIG_USB_OTG */ 202#endif /* CONFIG_USB_OTG */
193 out_be32(usb_regs + FSL_USB2_CONTROL_OFFS, temp); 203 out_be32(usb_regs + FSL_USB2_CONTROL_OFFS, temp);
194 } else { 204 } else {
@@ -196,6 +206,7 @@ int mpc831x_usb_cfg(void)
196 ret = -EINVAL; 206 ret = -EINVAL;
197 } 207 }
198 208
209out:
199 iounmap(usb_regs); 210 iounmap(usb_regs);
200 of_node_put(np); 211 of_node_put(np);
201 return ret; 212 return ret;
diff --git a/arch/powerpc/platforms/cell/cpufreq_spudemand.c b/arch/powerpc/platforms/cell/cpufreq_spudemand.c
index 968c1c0b4d5b..d809836bcf5f 100644
--- a/arch/powerpc/platforms/cell/cpufreq_spudemand.c
+++ b/arch/powerpc/platforms/cell/cpufreq_spudemand.c
@@ -39,8 +39,6 @@ struct spu_gov_info_struct {
39}; 39};
40static DEFINE_PER_CPU(struct spu_gov_info_struct, spu_gov_info); 40static DEFINE_PER_CPU(struct spu_gov_info_struct, spu_gov_info);
41 41
42static struct workqueue_struct *kspugov_wq;
43
44static int calc_freq(struct spu_gov_info_struct *info) 42static int calc_freq(struct spu_gov_info_struct *info)
45{ 43{
46 int cpu; 44 int cpu;
@@ -71,14 +69,14 @@ static void spu_gov_work(struct work_struct *work)
71 __cpufreq_driver_target(info->policy, target_freq, CPUFREQ_RELATION_H); 69 __cpufreq_driver_target(info->policy, target_freq, CPUFREQ_RELATION_H);
72 70
73 delay = usecs_to_jiffies(info->poll_int); 71 delay = usecs_to_jiffies(info->poll_int);
74 queue_delayed_work_on(info->policy->cpu, kspugov_wq, &info->work, delay); 72 schedule_delayed_work_on(info->policy->cpu, &info->work, delay);
75} 73}
76 74
77static void spu_gov_init_work(struct spu_gov_info_struct *info) 75static void spu_gov_init_work(struct spu_gov_info_struct *info)
78{ 76{
79 int delay = usecs_to_jiffies(info->poll_int); 77 int delay = usecs_to_jiffies(info->poll_int);
80 INIT_DELAYED_WORK_DEFERRABLE(&info->work, spu_gov_work); 78 INIT_DELAYED_WORK_DEFERRABLE(&info->work, spu_gov_work);
81 queue_delayed_work_on(info->policy->cpu, kspugov_wq, &info->work, delay); 79 schedule_delayed_work_on(info->policy->cpu, &info->work, delay);
82} 80}
83 81
84static void spu_gov_cancel_work(struct spu_gov_info_struct *info) 82static void spu_gov_cancel_work(struct spu_gov_info_struct *info)
@@ -152,27 +150,15 @@ static int __init spu_gov_init(void)
152{ 150{
153 int ret; 151 int ret;
154 152
155 kspugov_wq = create_workqueue("kspugov");
156 if (!kspugov_wq) {
157 printk(KERN_ERR "creation of kspugov failed\n");
158 ret = -EFAULT;
159 goto out;
160 }
161
162 ret = cpufreq_register_governor(&spu_governor); 153 ret = cpufreq_register_governor(&spu_governor);
163 if (ret) { 154 if (ret)
164 printk(KERN_ERR "registration of governor failed\n"); 155 printk(KERN_ERR "registration of governor failed\n");
165 destroy_workqueue(kspugov_wq);
166 goto out;
167 }
168out:
169 return ret; 156 return ret;
170} 157}
171 158
172static void __exit spu_gov_exit(void) 159static void __exit spu_gov_exit(void)
173{ 160{
174 cpufreq_unregister_governor(&spu_governor); 161 cpufreq_unregister_governor(&spu_governor);
175 destroy_workqueue(kspugov_wq);
176} 162}
177 163
178 164
diff --git a/arch/powerpc/platforms/cell/qpace_setup.c b/arch/powerpc/platforms/cell/qpace_setup.c
index 1b5749042756..d31c594cfdf3 100644
--- a/arch/powerpc/platforms/cell/qpace_setup.c
+++ b/arch/powerpc/platforms/cell/qpace_setup.c
@@ -145,9 +145,4 @@ define_machine(qpace) {
145 .calibrate_decr = generic_calibrate_decr, 145 .calibrate_decr = generic_calibrate_decr,
146 .progress = qpace_progress, 146 .progress = qpace_progress,
147 .init_IRQ = iic_init_IRQ, 147 .init_IRQ = iic_init_IRQ,
148#ifdef CONFIG_KEXEC
149 .machine_kexec = default_machine_kexec,
150 .machine_kexec_prepare = default_machine_kexec_prepare,
151 .machine_crash_shutdown = default_machine_crash_shutdown,
152#endif
153}; 148};
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index 8547e86bfb42..acfaccea5f4f 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -37,6 +37,7 @@
37#include <asm/spu_csa.h> 37#include <asm/spu_csa.h>
38#include <asm/xmon.h> 38#include <asm/xmon.h>
39#include <asm/prom.h> 39#include <asm/prom.h>
40#include <asm/kexec.h>
40 41
41const struct spu_management_ops *spu_management_ops; 42const struct spu_management_ops *spu_management_ops;
42EXPORT_SYMBOL_GPL(spu_management_ops); 43EXPORT_SYMBOL_GPL(spu_management_ops);
@@ -727,6 +728,75 @@ static ssize_t spu_stat_show(struct sys_device *sysdev,
727 728
728static SYSDEV_ATTR(stat, 0644, spu_stat_show, NULL); 729static SYSDEV_ATTR(stat, 0644, spu_stat_show, NULL);
729 730
731#ifdef CONFIG_KEXEC
732
733struct crash_spu_info {
734 struct spu *spu;
735 u32 saved_spu_runcntl_RW;
736 u32 saved_spu_status_R;
737 u32 saved_spu_npc_RW;
738 u64 saved_mfc_sr1_RW;
739 u64 saved_mfc_dar;
740 u64 saved_mfc_dsisr;
741};
742
743#define CRASH_NUM_SPUS 16 /* Enough for current hardware */
744static struct crash_spu_info crash_spu_info[CRASH_NUM_SPUS];
745
746static void crash_kexec_stop_spus(void)
747{
748 struct spu *spu;
749 int i;
750 u64 tmp;
751
752 for (i = 0; i < CRASH_NUM_SPUS; i++) {
753 if (!crash_spu_info[i].spu)
754 continue;
755
756 spu = crash_spu_info[i].spu;
757
758 crash_spu_info[i].saved_spu_runcntl_RW =
759 in_be32(&spu->problem->spu_runcntl_RW);
760 crash_spu_info[i].saved_spu_status_R =
761 in_be32(&spu->problem->spu_status_R);
762 crash_spu_info[i].saved_spu_npc_RW =
763 in_be32(&spu->problem->spu_npc_RW);
764
765 crash_spu_info[i].saved_mfc_dar = spu_mfc_dar_get(spu);
766 crash_spu_info[i].saved_mfc_dsisr = spu_mfc_dsisr_get(spu);
767 tmp = spu_mfc_sr1_get(spu);
768 crash_spu_info[i].saved_mfc_sr1_RW = tmp;
769
770 tmp &= ~MFC_STATE1_MASTER_RUN_CONTROL_MASK;
771 spu_mfc_sr1_set(spu, tmp);
772
773 __delay(200);
774 }
775}
776
777static void crash_register_spus(struct list_head *list)
778{
779 struct spu *spu;
780 int ret;
781
782 list_for_each_entry(spu, list, full_list) {
783 if (WARN_ON(spu->number >= CRASH_NUM_SPUS))
784 continue;
785
786 crash_spu_info[spu->number].spu = spu;
787 }
788
789 ret = crash_shutdown_register(&crash_kexec_stop_spus);
790 if (ret)
791 printk(KERN_ERR "Could not register SPU crash handler");
792}
793
794#else
795static inline void crash_register_spus(struct list_head *list)
796{
797}
798#endif
799
730static int __init init_spu_base(void) 800static int __init init_spu_base(void)
731{ 801{
732 int i, ret = 0; 802 int i, ret = 0;
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 02f7b113a31b..3c7c3f82d842 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -219,24 +219,17 @@ spufs_mem_write(struct file *file, const char __user *buffer,
219 loff_t pos = *ppos; 219 loff_t pos = *ppos;
220 int ret; 220 int ret;
221 221
222 if (pos < 0)
223 return -EINVAL;
224 if (pos > LS_SIZE) 222 if (pos > LS_SIZE)
225 return -EFBIG; 223 return -EFBIG;
226 if (size > LS_SIZE - pos)
227 size = LS_SIZE - pos;
228 224
229 ret = spu_acquire(ctx); 225 ret = spu_acquire(ctx);
230 if (ret) 226 if (ret)
231 return ret; 227 return ret;
232 228
233 local_store = ctx->ops->get_ls(ctx); 229 local_store = ctx->ops->get_ls(ctx);
234 ret = copy_from_user(local_store + pos, buffer, size); 230 size = simple_write_to_buffer(local_store, LS_SIZE, ppos, buffer, size);
235 spu_release(ctx); 231 spu_release(ctx);
236 232
237 if (ret)
238 return -EFAULT;
239 *ppos = pos + size;
240 return size; 233 return size;
241} 234}
242 235
@@ -574,18 +567,15 @@ spufs_regs_write(struct file *file, const char __user *buffer,
574 if (*pos >= sizeof(lscsa->gprs)) 567 if (*pos >= sizeof(lscsa->gprs))
575 return -EFBIG; 568 return -EFBIG;
576 569
577 size = min_t(ssize_t, sizeof(lscsa->gprs) - *pos, size);
578 *pos += size;
579
580 ret = spu_acquire_saved(ctx); 570 ret = spu_acquire_saved(ctx);
581 if (ret) 571 if (ret)
582 return ret; 572 return ret;
583 573
584 ret = copy_from_user((char *)lscsa->gprs + *pos - size, 574 size = simple_write_to_buffer(lscsa->gprs, sizeof(lscsa->gprs), pos,
585 buffer, size) ? -EFAULT : size; 575 buffer, size);
586 576
587 spu_release_saved(ctx); 577 spu_release_saved(ctx);
588 return ret; 578 return size;
589} 579}
590 580
591static const struct file_operations spufs_regs_fops = { 581static const struct file_operations spufs_regs_fops = {
@@ -630,18 +620,15 @@ spufs_fpcr_write(struct file *file, const char __user * buffer,
630 if (*pos >= sizeof(lscsa->fpcr)) 620 if (*pos >= sizeof(lscsa->fpcr))
631 return -EFBIG; 621 return -EFBIG;
632 622
633 size = min_t(ssize_t, sizeof(lscsa->fpcr) - *pos, size);
634
635 ret = spu_acquire_saved(ctx); 623 ret = spu_acquire_saved(ctx);
636 if (ret) 624 if (ret)
637 return ret; 625 return ret;
638 626
639 *pos += size; 627 size = simple_write_to_buffer(&lscsa->fpcr, sizeof(lscsa->fpcr), pos,
640 ret = copy_from_user((char *)&lscsa->fpcr + *pos - size, 628 buffer, size);
641 buffer, size) ? -EFAULT : size;
642 629
643 spu_release_saved(ctx); 630 spu_release_saved(ctx);
644 return ret; 631 return size;
645} 632}
646 633
647static const struct file_operations spufs_fpcr_fops = { 634static const struct file_operations spufs_fpcr_fops = {
diff --git a/arch/powerpc/platforms/embedded6xx/gamecube.c b/arch/powerpc/platforms/embedded6xx/gamecube.c
index 1106fd99627f..a138e14bad2e 100644
--- a/arch/powerpc/platforms/embedded6xx/gamecube.c
+++ b/arch/powerpc/platforms/embedded6xx/gamecube.c
@@ -75,14 +75,6 @@ static void gamecube_shutdown(void)
75 flipper_quiesce(); 75 flipper_quiesce();
76} 76}
77 77
78#ifdef CONFIG_KEXEC
79static int gamecube_kexec_prepare(struct kimage *image)
80{
81 return 0;
82}
83#endif /* CONFIG_KEXEC */
84
85
86define_machine(gamecube) { 78define_machine(gamecube) {
87 .name = "gamecube", 79 .name = "gamecube",
88 .probe = gamecube_probe, 80 .probe = gamecube_probe,
@@ -95,9 +87,6 @@ define_machine(gamecube) {
95 .calibrate_decr = generic_calibrate_decr, 87 .calibrate_decr = generic_calibrate_decr,
96 .progress = udbg_progress, 88 .progress = udbg_progress,
97 .machine_shutdown = gamecube_shutdown, 89 .machine_shutdown = gamecube_shutdown,
98#ifdef CONFIG_KEXEC
99 .machine_kexec_prepare = gamecube_kexec_prepare,
100#endif
101}; 90};
102 91
103 92
diff --git a/arch/powerpc/platforms/embedded6xx/wii.c b/arch/powerpc/platforms/embedded6xx/wii.c
index 649473a729b8..1b5dc1a2e145 100644
--- a/arch/powerpc/platforms/embedded6xx/wii.c
+++ b/arch/powerpc/platforms/embedded6xx/wii.c
@@ -18,7 +18,6 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
20#include <linux/seq_file.h> 20#include <linux/seq_file.h>
21#include <linux/kexec.h>
22#include <linux/of_platform.h> 21#include <linux/of_platform.h>
23#include <linux/memblock.h> 22#include <linux/memblock.h>
24#include <mm/mmu_decl.h> 23#include <mm/mmu_decl.h>
@@ -226,13 +225,6 @@ static void wii_shutdown(void)
226 flipper_quiesce(); 225 flipper_quiesce();
227} 226}
228 227
229#ifdef CONFIG_KEXEC
230static int wii_machine_kexec_prepare(struct kimage *image)
231{
232 return 0;
233}
234#endif /* CONFIG_KEXEC */
235
236define_machine(wii) { 228define_machine(wii) {
237 .name = "wii", 229 .name = "wii",
238 .probe = wii_probe, 230 .probe = wii_probe,
@@ -246,9 +238,6 @@ define_machine(wii) {
246 .calibrate_decr = generic_calibrate_decr, 238 .calibrate_decr = generic_calibrate_decr,
247 .progress = udbg_progress, 239 .progress = udbg_progress,
248 .machine_shutdown = wii_shutdown, 240 .machine_shutdown = wii_shutdown,
249#ifdef CONFIG_KEXEC
250 .machine_kexec_prepare = wii_machine_kexec_prepare,
251#endif
252}; 241};
253 242
254static struct of_device_id wii_of_bus[] = { 243static struct of_device_id wii_of_bus[] = {
diff --git a/arch/powerpc/platforms/iseries/Kconfig b/arch/powerpc/platforms/iseries/Kconfig
index 47a20cfb4486..e5bc9f75d474 100644
--- a/arch/powerpc/platforms/iseries/Kconfig
+++ b/arch/powerpc/platforms/iseries/Kconfig
@@ -2,7 +2,7 @@ config PPC_ISERIES
2 bool "IBM Legacy iSeries" 2 bool "IBM Legacy iSeries"
3 depends on PPC64 && PPC_BOOK3S 3 depends on PPC64 && PPC_BOOK3S
4 select PPC_INDIRECT_IO 4 select PPC_INDIRECT_IO
5 select PPC_PCI_CHOICE if EMBEDDED 5 select PPC_PCI_CHOICE if EXPERT
6 6
7menu "iSeries device drivers" 7menu "iSeries device drivers"
8 depends on PPC_ISERIES 8 depends on PPC_ISERIES
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
index 5d1b743dbe7e..5b3da4b4ea79 100644
--- a/arch/powerpc/platforms/pseries/Kconfig
+++ b/arch/powerpc/platforms/pseries/Kconfig
@@ -10,7 +10,7 @@ config PPC_PSERIES
10 select RTAS_ERROR_LOGGING 10 select RTAS_ERROR_LOGGING
11 select PPC_UDBG_16550 11 select PPC_UDBG_16550
12 select PPC_NATIVE 12 select PPC_NATIVE
13 select PPC_PCI_CHOICE if EMBEDDED 13 select PPC_PCI_CHOICE if EXPERT
14 default y 14 default y
15 15
16config PPC_SPLPAR 16config PPC_SPLPAR
@@ -24,9 +24,9 @@ config PPC_SPLPAR
24 two or more partitions. 24 two or more partitions.
25 25
26config EEH 26config EEH
27 bool "PCI Extended Error Handling (EEH)" if EMBEDDED 27 bool "PCI Extended Error Handling (EEH)" if EXPERT
28 depends on PPC_PSERIES && PCI 28 depends on PPC_PSERIES && PCI
29 default y if !EMBEDDED 29 default y if !EXPERT
30 30
31config PSERIES_MSI 31config PSERIES_MSI
32 bool 32 bool
diff --git a/arch/powerpc/platforms/pseries/kexec.c b/arch/powerpc/platforms/pseries/kexec.c
index 53cbd53d8740..77d38a5e2ff9 100644
--- a/arch/powerpc/platforms/pseries/kexec.c
+++ b/arch/powerpc/platforms/pseries/kexec.c
@@ -61,13 +61,3 @@ void __init setup_kexec_cpu_down_xics(void)
61{ 61{
62 ppc_md.kexec_cpu_down = pseries_kexec_cpu_down_xics; 62 ppc_md.kexec_cpu_down = pseries_kexec_cpu_down_xics;
63} 63}
64
65static int __init pseries_kexec_setup(void)
66{
67 ppc_md.machine_kexec = default_machine_kexec;
68 ppc_md.machine_kexec_prepare = default_machine_kexec_prepare;
69 ppc_md.machine_crash_shutdown = default_machine_crash_shutdown;
70
71 return 0;
72}
73machine_device_initcall(pseries, pseries_kexec_setup);
diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
index a4fc6da87c2e..c55d7ad9c648 100644
--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -54,7 +54,8 @@
54static unsigned char ras_log_buf[RTAS_ERROR_LOG_MAX]; 54static unsigned char ras_log_buf[RTAS_ERROR_LOG_MAX];
55static DEFINE_SPINLOCK(ras_log_buf_lock); 55static DEFINE_SPINLOCK(ras_log_buf_lock);
56 56
57static char mce_data_buf[RTAS_ERROR_LOG_MAX]; 57static char global_mce_data_buf[RTAS_ERROR_LOG_MAX];
58static DEFINE_PER_CPU(__u64, mce_data_buf);
58 59
59static int ras_get_sensor_state_token; 60static int ras_get_sensor_state_token;
60static int ras_check_exception_token; 61static int ras_check_exception_token;
@@ -196,12 +197,24 @@ static irqreturn_t ras_error_interrupt(int irq, void *dev_id)
196 return IRQ_HANDLED; 197 return IRQ_HANDLED;
197} 198}
198 199
199/* Get the error information for errors coming through the 200/*
201 * Some versions of FWNMI place the buffer inside the 4kB page starting at
202 * 0x7000. Other versions place it inside the rtas buffer. We check both.
203 */
204#define VALID_FWNMI_BUFFER(A) \
205 ((((A) >= 0x7000) && ((A) < 0x7ff0)) || \
206 (((A) >= rtas.base) && ((A) < (rtas.base + rtas.size - 16))))
207
208/*
209 * Get the error information for errors coming through the
200 * FWNMI vectors. The pt_regs' r3 will be updated to reflect 210 * FWNMI vectors. The pt_regs' r3 will be updated to reflect
201 * the actual r3 if possible, and a ptr to the error log entry 211 * the actual r3 if possible, and a ptr to the error log entry
202 * will be returned if found. 212 * will be returned if found.
203 * 213 *
204 * The mce_data_buf does not have any locks or protection around it, 214 * If the RTAS error is not of the extended type, then we put it in a per
215 * cpu 64bit buffer. If it is the extended type we use global_mce_data_buf.
216 *
217 * The global_mce_data_buf does not have any locks or protection around it,
205 * if a second machine check comes in, or a system reset is done 218 * if a second machine check comes in, or a system reset is done
206 * before we have logged the error, then we will get corruption in the 219 * before we have logged the error, then we will get corruption in the
207 * error log. This is preferable over holding off on calling 220 * error log. This is preferable over holding off on calling
@@ -210,20 +223,31 @@ static irqreturn_t ras_error_interrupt(int irq, void *dev_id)
210 */ 223 */
211static struct rtas_error_log *fwnmi_get_errinfo(struct pt_regs *regs) 224static struct rtas_error_log *fwnmi_get_errinfo(struct pt_regs *regs)
212{ 225{
213 unsigned long errdata = regs->gpr[3];
214 struct rtas_error_log *errhdr = NULL;
215 unsigned long *savep; 226 unsigned long *savep;
227 struct rtas_error_log *h, *errhdr = NULL;
228
229 if (!VALID_FWNMI_BUFFER(regs->gpr[3])) {
230 printk(KERN_ERR "FWNMI: corrupt r3\n");
231 return NULL;
232 }
216 233
217 if ((errdata >= 0x7000 && errdata < 0x7fff0) || 234 savep = __va(regs->gpr[3]);
218 (errdata >= rtas.base && errdata < rtas.base + rtas.size - 16)) { 235 regs->gpr[3] = savep[0]; /* restore original r3 */
219 savep = __va(errdata); 236
220 regs->gpr[3] = savep[0]; /* restore original r3 */ 237 /* If it isn't an extended log we can use the per cpu 64bit buffer */
221 memset(mce_data_buf, 0, RTAS_ERROR_LOG_MAX); 238 h = (struct rtas_error_log *)&savep[1];
222 memcpy(mce_data_buf, (char *)(savep + 1), RTAS_ERROR_LOG_MAX); 239 if (!h->extended) {
223 errhdr = (struct rtas_error_log *)mce_data_buf; 240 memcpy(&__get_cpu_var(mce_data_buf), h, sizeof(__u64));
241 errhdr = (struct rtas_error_log *)&__get_cpu_var(mce_data_buf);
224 } else { 242 } else {
225 printk("FWNMI: corrupt r3\n"); 243 int len;
244
245 len = max_t(int, 8+h->extended_log_length, RTAS_ERROR_LOG_MAX);
246 memset(global_mce_data_buf, 0, RTAS_ERROR_LOG_MAX);
247 memcpy(global_mce_data_buf, h, len);
248 errhdr = (struct rtas_error_log *)global_mce_data_buf;
226 } 249 }
250
227 return errhdr; 251 return errhdr;
228} 252}
229 253
@@ -235,7 +259,7 @@ static void fwnmi_release_errinfo(void)
235{ 259{
236 int ret = rtas_call(rtas_token("ibm,nmi-interlock"), 0, 1, NULL); 260 int ret = rtas_call(rtas_token("ibm,nmi-interlock"), 0, 1, NULL);
237 if (ret != 0) 261 if (ret != 0)
238 printk("FWNMI: nmi-interlock failed: %d\n", ret); 262 printk(KERN_ERR "FWNMI: nmi-interlock failed: %d\n", ret);
239} 263}
240 264
241int pSeries_system_reset_exception(struct pt_regs *regs) 265int pSeries_system_reset_exception(struct pt_regs *regs)
@@ -259,31 +283,43 @@ int pSeries_system_reset_exception(struct pt_regs *regs)
259 * Return 1 if corrected (or delivered a signal). 283 * Return 1 if corrected (or delivered a signal).
260 * Return 0 if there is nothing we can do. 284 * Return 0 if there is nothing we can do.
261 */ 285 */
262static int recover_mce(struct pt_regs *regs, struct rtas_error_log * err) 286static int recover_mce(struct pt_regs *regs, struct rtas_error_log *err)
263{ 287{
264 int nonfatal = 0; 288 int recovered = 0;
265 289
266 if (err->disposition == RTAS_DISP_FULLY_RECOVERED) { 290 if (!(regs->msr & MSR_RI)) {
291 /* If MSR_RI isn't set, we cannot recover */
292 recovered = 0;
293
294 } else if (err->disposition == RTAS_DISP_FULLY_RECOVERED) {
267 /* Platform corrected itself */ 295 /* Platform corrected itself */
268 nonfatal = 1; 296 recovered = 1;
269 } else if ((regs->msr & MSR_RI) && 297
270 user_mode(regs) && 298 } else if (err->disposition == RTAS_DISP_LIMITED_RECOVERY) {
271 err->severity == RTAS_SEVERITY_ERROR_SYNC && 299 /* Platform corrected itself but could be degraded */
272 err->disposition == RTAS_DISP_NOT_RECOVERED && 300 printk(KERN_ERR "MCE: limited recovery, system may "
273 err->target == RTAS_TARGET_MEMORY && 301 "be degraded\n");
274 err->type == RTAS_TYPE_ECC_UNCORR && 302 recovered = 1;
275 !(current->pid == 0 || is_global_init(current))) { 303
276 /* Kill off a user process with an ECC error */ 304 } else if (user_mode(regs) && !is_global_init(current) &&
277 printk(KERN_ERR "MCE: uncorrectable ecc error for pid %d\n", 305 err->severity == RTAS_SEVERITY_ERROR_SYNC) {
278 current->pid); 306
279 /* XXX something better for ECC error? */ 307 /*
280 _exception(SIGBUS, regs, BUS_ADRERR, regs->nip); 308 * If we received a synchronous error when in userspace
281 nonfatal = 1; 309 * kill the task. Firmware may report details of the fail
310 * asynchronously, so we can't rely on the target and type
311 * fields being valid here.
312 */
313 printk(KERN_ERR "MCE: uncorrectable error, killing task "
314 "%s:%d\n", current->comm, current->pid);
315
316 _exception(SIGBUS, regs, BUS_MCEERR_AR, regs->nip);
317 recovered = 1;
282 } 318 }
283 319
284 log_error((char *)err, ERR_TYPE_RTAS_LOG, !nonfatal); 320 log_error((char *)err, ERR_TYPE_RTAS_LOG, 0);
285 321
286 return nonfatal; 322 return recovered;
287} 323}
288 324
289/* 325/*
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index 9f99bef2adec..8c6cab013278 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -1555,8 +1555,6 @@ int fsl_rio_setup(struct platform_device *dev)
1555 saved_mcheck_exception = ppc_md.machine_check_exception; 1555 saved_mcheck_exception = ppc_md.machine_check_exception;
1556 ppc_md.machine_check_exception = fsl_rio_mcheck_exception; 1556 ppc_md.machine_check_exception = fsl_rio_mcheck_exception;
1557#endif 1557#endif
1558 /* Ensure that RFXE is set */
1559 mtspr(SPRN_HID1, (mfspr(SPRN_HID1) | 0x20000));
1560 1558
1561 return 0; 1559 return 0;
1562err: 1560err:
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 7c1342618a30..b0c8469e5ddd 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -674,7 +674,8 @@ void mpic_unmask_irq(unsigned int irq)
674 /* make sure mask gets to controller before we return to user */ 674 /* make sure mask gets to controller before we return to user */
675 do { 675 do {
676 if (!loops--) { 676 if (!loops--) {
677 printk(KERN_ERR "mpic_enable_irq timeout\n"); 677 printk(KERN_ERR "%s: timeout on hwirq %u\n",
678 __func__, src);
678 break; 679 break;
679 } 680 }
680 } while(mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI)) & MPIC_VECPRI_MASK); 681 } while(mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI)) & MPIC_VECPRI_MASK);
@@ -695,7 +696,8 @@ void mpic_mask_irq(unsigned int irq)
695 /* make sure mask gets to controller before we return to user */ 696 /* make sure mask gets to controller before we return to user */
696 do { 697 do {
697 if (!loops--) { 698 if (!loops--) {
698 printk(KERN_ERR "mpic_enable_irq timeout\n"); 699 printk(KERN_ERR "%s: timeout on hwirq %u\n",
700 __func__, src);
699 break; 701 break;
700 } 702 }
701 } while(!(mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI)) & MPIC_VECPRI_MASK)); 703 } while(!(mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI)) & MPIC_VECPRI_MASK));
diff --git a/arch/score/Kconfig b/arch/score/Kconfig
index 4293fdcb5398..27b2295f41f3 100644
--- a/arch/score/Kconfig
+++ b/arch/score/Kconfig
@@ -1,5 +1,9 @@
1menu "Machine selection" 1menu "Machine selection"
2 2
3config SCORE
4 def_bool y
5 select HAVE_GENERIC_HARDIRQS
6
3choice 7choice
4 prompt "System type" 8 prompt "System type"
5 default MACH_SPCT6600 9 default MACH_SPCT6600
@@ -53,9 +57,6 @@ config GENERIC_CLOCKEVENTS
53config SCHED_NO_NO_OMIT_FRAME_POINTER 57config SCHED_NO_NO_OMIT_FRAME_POINTER
54 def_bool y 58 def_bool y
55 59
56config GENERIC_HARDIRQS_NO__DO_IRQ
57 def_bool y
58
59config GENERIC_SYSCALL_TABLE 60config GENERIC_SYSCALL_TABLE
60 def_bool y 61 def_bool y
61 62
@@ -68,9 +69,6 @@ menu "Kernel type"
68config 32BIT 69config 32BIT
69 def_bool y 70 def_bool y
70 71
71config GENERIC_HARDIRQS
72 def_bool y
73
74config ARCH_FLATMEM_ENABLE 72config ARCH_FLATMEM_ENABLE
75 def_bool y 73 def_bool y
76 74
diff --git a/arch/score/configs/spct6600_defconfig b/arch/score/configs/spct6600_defconfig
index 9883c50e4636..df1edbf507a2 100644
--- a/arch/score/configs/spct6600_defconfig
+++ b/arch/score/configs/spct6600_defconfig
@@ -9,7 +9,7 @@ CONFIG_LOG_BUF_SHIFT=12
9CONFIG_SYSFS_DEPRECATED_V2=y 9CONFIG_SYSFS_DEPRECATED_V2=y
10CONFIG_BLK_DEV_INITRD=y 10CONFIG_BLK_DEV_INITRD=y
11# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 11# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
12CONFIG_EMBEDDED=y 12CONFIG_EXPERT=y
13# CONFIG_KALLSYMS is not set 13# CONFIG_KALLSYMS is not set
14# CONFIG_HOTPLUG is not set 14# CONFIG_HOTPLUG is not set
15CONFIG_SLAB=y 15CONFIG_SLAB=y
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index fff252209f63..ae555569823b 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -1,6 +1,6 @@
1config SUPERH 1config SUPERH
2 def_bool y 2 def_bool y
3 select EMBEDDED 3 select EXPERT
4 select CLKDEV_LOOKUP 4 select CLKDEV_LOOKUP
5 select HAVE_IDE if HAS_IOPORT 5 select HAVE_IDE if HAS_IOPORT
6 select HAVE_MEMBLOCK 6 select HAVE_MEMBLOCK
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 45d9c87d083a..95695e97703e 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -50,6 +50,7 @@ config SPARC64
50 select RTC_DRV_STARFIRE 50 select RTC_DRV_STARFIRE
51 select HAVE_PERF_EVENTS 51 select HAVE_PERF_EVENTS
52 select PERF_USE_VMALLOC 52 select PERF_USE_VMALLOC
53 select HAVE_GENERIC_HARDIRQS
53 54
54config ARCH_DEFCONFIG 55config ARCH_DEFCONFIG
55 string 56 string
@@ -107,10 +108,6 @@ config NEED_PER_CPU_EMBED_FIRST_CHUNK
107config NEED_PER_CPU_PAGE_FIRST_CHUNK 108config NEED_PER_CPU_PAGE_FIRST_CHUNK
108 def_bool y if SPARC64 109 def_bool y if SPARC64
109 110
110config GENERIC_HARDIRQS_NO__DO_IRQ
111 bool
112 def_bool y if SPARC64
113
114config MMU 111config MMU
115 bool 112 bool
116 default y 113 default y
@@ -276,10 +273,6 @@ config HOTPLUG_CPU
276 can be controlled through /sys/devices/system/cpu/cpu#. 273 can be controlled through /sys/devices/system/cpu/cpu#.
277 Say N if you want to disable CPU hotplug. 274 Say N if you want to disable CPU hotplug.
278 275
279config GENERIC_HARDIRQS
280 bool
281 default y if SPARC64
282
283source "kernel/time/Kconfig" 276source "kernel/time/Kconfig"
284 277
285if SPARC64 278if SPARC64
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
index e11b5fcb70eb..08948e4e1503 100644
--- a/arch/tile/Kconfig
+++ b/arch/tile/Kconfig
@@ -1,24 +1,33 @@
1# For a description of the syntax of this configuration file, 1# For a description of the syntax of this configuration file,
2# see Documentation/kbuild/config-language.txt. 2# see Documentation/kbuild/config-language.txt.
3 3
4config MMU 4config TILE
5 def_bool y
6
7config GENERIC_CSUM
8 def_bool y
9
10config GENERIC_HARDIRQS
11 def_bool y 5 def_bool y
6 select HAVE_KVM if !TILEGX
7 select GENERIC_FIND_FIRST_BIT
8 select GENERIC_FIND_NEXT_BIT
9 select USE_GENERIC_SMP_HELPERS
10 select CC_OPTIMIZE_FOR_SIZE
11 select HAVE_GENERIC_HARDIRQS
12 select GENERIC_IRQ_PROBE
13 select GENERIC_PENDING_IRQ if SMP
12 14
13config GENERIC_HARDIRQS_NO__DO_IRQ 15# FIXME: investigate whether we need/want these options.
14 def_bool y 16# select HAVE_IOREMAP_PROT
17# select HAVE_OPTPROBES
18# select HAVE_REGS_AND_STACK_ACCESS_API
19# select HAVE_HW_BREAKPOINT
20# select PERF_EVENTS
21# select HAVE_USER_RETURN_NOTIFIER
22# config NO_BOOTMEM
23# config ARCH_SUPPORTS_DEBUG_PAGEALLOC
24# config HUGETLB_PAGE_SIZE_VARIABLE
15 25
16config GENERIC_IRQ_PROBE 26config MMU
17 def_bool y 27 def_bool y
18 28
19config GENERIC_PENDING_IRQ 29config GENERIC_CSUM
20 def_bool y 30 def_bool y
21 depends on GENERIC_HARDIRQS && SMP
22 31
23config SEMAPHORE_SLEEPERS 32config SEMAPHORE_SLEEPERS
24 def_bool y 33 def_bool y
@@ -97,26 +106,6 @@ config HVC_TILE
97 select HVC_DRIVER 106 select HVC_DRIVER
98 def_bool y 107 def_bool y
99 108
100config TILE
101 def_bool y
102 select HAVE_KVM if !TILEGX
103 select GENERIC_FIND_FIRST_BIT
104 select GENERIC_FIND_NEXT_BIT
105 select USE_GENERIC_SMP_HELPERS
106 select CC_OPTIMIZE_FOR_SIZE
107
108# FIXME: investigate whether we need/want these options.
109# select HAVE_IOREMAP_PROT
110# select HAVE_OPTPROBES
111# select HAVE_REGS_AND_STACK_ACCESS_API
112# select HAVE_HW_BREAKPOINT
113# select PERF_EVENTS
114# select HAVE_USER_RETURN_NOTIFIER
115# config NO_BOOTMEM
116# config ARCH_SUPPORTS_DEBUG_PAGEALLOC
117# config HUGETLB_PAGE_SIZE_VARIABLE
118
119
120# Please note: TILE-Gx support is not yet finalized; this is 109# Please note: TILE-Gx support is not yet finalized; this is
121# the preliminary support. TILE-Gx drivers are only provided 110# the preliminary support. TILE-Gx drivers are only provided
122# with the alpha or beta test versions for Tilera customers. 111# with the alpha or beta test versions for Tilera customers.
@@ -220,7 +209,7 @@ config FORCE_MAX_ZONEORDER
220 209
221choice 210choice
222 depends on !TILEGX 211 depends on !TILEGX
223 prompt "Memory split" if EMBEDDED 212 prompt "Memory split" if EXPERT
224 default VMSPLIT_3G 213 default VMSPLIT_3G
225 ---help--- 214 ---help---
226 Select the desired split between kernel and user memory. 215 Select the desired split between kernel and user memory.
diff --git a/arch/tile/Kconfig.debug b/arch/tile/Kconfig.debug
index a81f0fbf7e60..9bc161a02c71 100644
--- a/arch/tile/Kconfig.debug
+++ b/arch/tile/Kconfig.debug
@@ -3,7 +3,7 @@ menu "Kernel hacking"
3source "lib/Kconfig.debug" 3source "lib/Kconfig.debug"
4 4
5config EARLY_PRINTK 5config EARLY_PRINTK
6 bool "Early printk" if EMBEDDED && DEBUG_KERNEL 6 bool "Early printk" if EXPERT && DEBUG_KERNEL
7 default y 7 default y
8 help 8 help
9 Write kernel log output directly via the hypervisor console. 9 Write kernel log output directly via the hypervisor console.
diff --git a/arch/tile/configs/tile_defconfig b/arch/tile/configs/tile_defconfig
index 919c54afd981..0fe54445fda5 100644
--- a/arch/tile/configs/tile_defconfig
+++ b/arch/tile/configs/tile_defconfig
@@ -3,7 +3,7 @@ CONFIG_EXPERIMENTAL=y
3CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
4CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
5CONFIG_INITRAMFS_SOURCE="usr/contents.txt" 5CONFIG_INITRAMFS_SOURCE="usr/contents.txt"
6CONFIG_EMBEDDED=y 6CONFIG_EXPERT=y
7# CONFIG_COMPAT_BRK is not set 7# CONFIG_COMPAT_BRK is not set
8CONFIG_PROFILING=y 8CONFIG_PROFILING=y
9CONFIG_MODULES=y 9CONFIG_MODULES=y
diff --git a/arch/um/Kconfig.common b/arch/um/Kconfig.common
index 049d048b070d..e351e14b4339 100644
--- a/arch/um/Kconfig.common
+++ b/arch/um/Kconfig.common
@@ -3,14 +3,10 @@ config DEFCONFIG_LIST
3 option defconfig_list 3 option defconfig_list
4 default "arch/$ARCH/defconfig" 4 default "arch/$ARCH/defconfig"
5 5
6# UML uses the generic IRQ subsystem
7config GENERIC_HARDIRQS
8 bool
9 default y
10
11config UML 6config UML
12 bool 7 bool
13 default y 8 default y
9 select HAVE_GENERIC_HARDIRQS
14 10
15config MMU 11config MMU
16 bool 12 bool
diff --git a/arch/um/Kconfig.um b/arch/um/Kconfig.um
index f8d1d0d47fe6..90a438acbfaf 100644
--- a/arch/um/Kconfig.um
+++ b/arch/um/Kconfig.um
@@ -120,9 +120,6 @@ config SMP
120 120
121 If you don't know what to do, say N. 121 If you don't know what to do, say N.
122 122
123config GENERIC_HARDIRQS_NO__DO_IRQ
124 def_bool y
125
126config NR_CPUS 123config NR_CPUS
127 int "Maximum number of CPUs (2-32)" 124 int "Maximum number of CPUs (2-32)"
128 range 2 32 125 range 2 32
diff --git a/arch/um/defconfig b/arch/um/defconfig
index 564f3de65b4a..9f7634f08cf3 100644
--- a/arch/um/defconfig
+++ b/arch/um/defconfig
@@ -133,7 +133,7 @@ CONFIG_SYSFS_DEPRECATED=y
133# CONFIG_BLK_DEV_INITRD is not set 133# CONFIG_BLK_DEV_INITRD is not set
134CONFIG_CC_OPTIMIZE_FOR_SIZE=y 134CONFIG_CC_OPTIMIZE_FOR_SIZE=y
135CONFIG_SYSCTL=y 135CONFIG_SYSCTL=y
136# CONFIG_EMBEDDED is not set 136# CONFIG_EXPERT is not set
137CONFIG_UID16=y 137CONFIG_UID16=y
138CONFIG_SYSCTL_SYSCALL=y 138CONFIG_SYSCTL_SYSCALL=y
139CONFIG_KALLSYMS=y 139CONFIG_KALLSYMS=y
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 3ed5ad92b029..d5ed94d30aad 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -627,11 +627,11 @@ config APB_TIMER
627 as it is off-chip. APB timers are always running regardless of CPU 627 as it is off-chip. APB timers are always running regardless of CPU
628 C states, they are used as per CPU clockevent device when possible. 628 C states, they are used as per CPU clockevent device when possible.
629 629
630# Mark as embedded because too many people got it wrong. 630# Mark as expert because too many people got it wrong.
631# The code disables itself when not needed. 631# The code disables itself when not needed.
632config DMI 632config DMI
633 default y 633 default y
634 bool "Enable DMI scanning" if EMBEDDED 634 bool "Enable DMI scanning" if EXPERT
635 ---help--- 635 ---help---
636 Enabled scanning of DMI to identify machine quirks. Say Y 636 Enabled scanning of DMI to identify machine quirks. Say Y
637 here unless you have verified that your setup is not 637 here unless you have verified that your setup is not
@@ -639,7 +639,7 @@ config DMI
639 BIOS code. 639 BIOS code.
640 640
641config GART_IOMMU 641config GART_IOMMU
642 bool "GART IOMMU support" if EMBEDDED 642 bool "GART IOMMU support" if EXPERT
643 default y 643 default y
644 select SWIOTLB 644 select SWIOTLB
645 depends on X86_64 && PCI && AMD_NB 645 depends on X86_64 && PCI && AMD_NB
@@ -889,7 +889,7 @@ config X86_THERMAL_VECTOR
889 depends on X86_MCE_INTEL 889 depends on X86_MCE_INTEL
890 890
891config VM86 891config VM86
892 bool "Enable VM86 support" if EMBEDDED 892 bool "Enable VM86 support" if EXPERT
893 default y 893 default y
894 depends on X86_32 894 depends on X86_32
895 ---help--- 895 ---help---
@@ -1073,7 +1073,7 @@ endchoice
1073 1073
1074choice 1074choice
1075 depends on EXPERIMENTAL 1075 depends on EXPERIMENTAL
1076 prompt "Memory split" if EMBEDDED 1076 prompt "Memory split" if EXPERT
1077 default VMSPLIT_3G 1077 default VMSPLIT_3G
1078 depends on X86_32 1078 depends on X86_32
1079 ---help--- 1079 ---help---
@@ -1135,7 +1135,7 @@ config ARCH_DMA_ADDR_T_64BIT
1135 def_bool X86_64 || HIGHMEM64G 1135 def_bool X86_64 || HIGHMEM64G
1136 1136
1137config DIRECT_GBPAGES 1137config DIRECT_GBPAGES
1138 bool "Enable 1GB pages for kernel pagetables" if EMBEDDED 1138 bool "Enable 1GB pages for kernel pagetables" if EXPERT
1139 default y 1139 default y
1140 depends on X86_64 1140 depends on X86_64
1141 ---help--- 1141 ---help---
@@ -1369,7 +1369,7 @@ config MATH_EMULATION
1369 1369
1370config MTRR 1370config MTRR
1371 def_bool y 1371 def_bool y
1372 prompt "MTRR (Memory Type Range Register) support" if EMBEDDED 1372 prompt "MTRR (Memory Type Range Register) support" if EXPERT
1373 ---help--- 1373 ---help---
1374 On Intel P6 family processors (Pentium Pro, Pentium II and later) 1374 On Intel P6 family processors (Pentium Pro, Pentium II and later)
1375 the Memory Type Range Registers (MTRRs) may be used to control 1375 the Memory Type Range Registers (MTRRs) may be used to control
@@ -1435,7 +1435,7 @@ config MTRR_SANITIZER_SPARE_REG_NR_DEFAULT
1435 1435
1436config X86_PAT 1436config X86_PAT
1437 def_bool y 1437 def_bool y
1438 prompt "x86 PAT support" if EMBEDDED 1438 prompt "x86 PAT support" if EXPERT
1439 depends on MTRR 1439 depends on MTRR
1440 ---help--- 1440 ---help---
1441 Use PAT attributes to setup page level cache control. 1441 Use PAT attributes to setup page level cache control.
@@ -1539,7 +1539,7 @@ config KEXEC_JUMP
1539 code in physical address mode via KEXEC 1539 code in physical address mode via KEXEC
1540 1540
1541config PHYSICAL_START 1541config PHYSICAL_START
1542 hex "Physical address where the kernel is loaded" if (EMBEDDED || CRASH_DUMP) 1542 hex "Physical address where the kernel is loaded" if (EXPERT || CRASH_DUMP)
1543 default "0x1000000" 1543 default "0x1000000"
1544 ---help--- 1544 ---help---
1545 This gives the physical address where the kernel is loaded. 1545 This gives the physical address where the kernel is loaded.
@@ -1934,7 +1934,7 @@ config PCI_MMCONFIG
1934 depends on X86_64 && PCI && ACPI 1934 depends on X86_64 && PCI && ACPI
1935 1935
1936config PCI_CNB20LE_QUIRK 1936config PCI_CNB20LE_QUIRK
1937 bool "Read CNB20LE Host Bridge Windows" if EMBEDDED 1937 bool "Read CNB20LE Host Bridge Windows" if EXPERT
1938 default n 1938 default n
1939 depends on PCI && EXPERIMENTAL 1939 depends on PCI && EXPERIMENTAL
1940 help 1940 help
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
index 15588a0ef466..283c5a6a03a6 100644
--- a/arch/x86/Kconfig.cpu
+++ b/arch/x86/Kconfig.cpu
@@ -424,7 +424,7 @@ config X86_DEBUGCTLMSR
424 depends on !(MK6 || MWINCHIPC6 || MWINCHIP3D || MCYRIXIII || M586MMX || M586TSC || M586 || M486 || M386) && !UML 424 depends on !(MK6 || MWINCHIPC6 || MWINCHIP3D || MCYRIXIII || M586MMX || M586TSC || M586 || M486 || M386) && !UML
425 425
426menuconfig PROCESSOR_SELECT 426menuconfig PROCESSOR_SELECT
427 bool "Supported processor vendors" if EMBEDDED 427 bool "Supported processor vendors" if EXPERT
428 ---help--- 428 ---help---
429 This lets you choose what x86 vendor support code your kernel 429 This lets you choose what x86 vendor support code your kernel
430 will include. 430 will include.
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index 45143bbcfe5e..615e18810f48 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -31,7 +31,7 @@ config X86_VERBOSE_BOOTUP
31 see errors. Disable this if you want silent bootup. 31 see errors. Disable this if you want silent bootup.
32 32
33config EARLY_PRINTK 33config EARLY_PRINTK
34 bool "Early printk" if EMBEDDED 34 bool "Early printk" if EXPERT
35 default y 35 default y
36 ---help--- 36 ---help---
37 Write kernel log output directly into the VGA buffer or to a serial 37 Write kernel log output directly into the VGA buffer or to a serial
@@ -138,7 +138,7 @@ config DEBUG_NX_TEST
138 138
139config DOUBLEFAULT 139config DOUBLEFAULT
140 default y 140 default y
141 bool "Enable doublefault exception handler" if EMBEDDED 141 bool "Enable doublefault exception handler" if EXPERT
142 depends on X86_32 142 depends on X86_32
143 ---help--- 143 ---help---
144 This option allows trapping of rare doublefault exceptions that 144 This option allows trapping of rare doublefault exceptions that
diff --git a/arch/x86/include/asm/numa_32.h b/arch/x86/include/asm/numa_32.h
index a37229011b56..b0ef2b449a9d 100644
--- a/arch/x86/include/asm/numa_32.h
+++ b/arch/x86/include/asm/numa_32.h
@@ -1,6 +1,8 @@
1#ifndef _ASM_X86_NUMA_32_H 1#ifndef _ASM_X86_NUMA_32_H
2#define _ASM_X86_NUMA_32_H 2#define _ASM_X86_NUMA_32_H
3 3
4extern int numa_off;
5
4extern int pxm_to_nid(int pxm); 6extern int pxm_to_nid(int pxm);
5extern void numa_remove_cpu(int cpu); 7extern void numa_remove_cpu(int cpu);
6 8
diff --git a/arch/x86/include/asm/numa_64.h b/arch/x86/include/asm/numa_64.h
index 5ae87285a502..0493be39607c 100644
--- a/arch/x86/include/asm/numa_64.h
+++ b/arch/x86/include/asm/numa_64.h
@@ -40,6 +40,7 @@ extern void __cpuinit numa_remove_cpu(int cpu);
40#ifdef CONFIG_NUMA_EMU 40#ifdef CONFIG_NUMA_EMU
41#define FAKE_NODE_MIN_SIZE ((u64)32 << 20) 41#define FAKE_NODE_MIN_SIZE ((u64)32 << 20)
42#define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL)) 42#define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1UL))
43void numa_emu_cmdline(char *);
43#endif /* CONFIG_NUMA_EMU */ 44#endif /* CONFIG_NUMA_EMU */
44#else 45#else
45static inline void init_cpu_to_node(void) { } 46static inline void init_cpu_to_node(void) { }
diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h
index 8ee45167e817..3788f4649db4 100644
--- a/arch/x86/include/asm/percpu.h
+++ b/arch/x86/include/asm/percpu.h
@@ -414,8 +414,6 @@ do { \
414#define this_cpu_xchg_1(pcp, nval) percpu_xchg_op(pcp, nval) 414#define this_cpu_xchg_1(pcp, nval) percpu_xchg_op(pcp, nval)
415#define this_cpu_xchg_2(pcp, nval) percpu_xchg_op(pcp, nval) 415#define this_cpu_xchg_2(pcp, nval) percpu_xchg_op(pcp, nval)
416#define this_cpu_xchg_4(pcp, nval) percpu_xchg_op(pcp, nval) 416#define this_cpu_xchg_4(pcp, nval) percpu_xchg_op(pcp, nval)
417#define this_cpu_xchg_8(pcp, nval) percpu_xchg_op(pcp, nval)
418#define this_cpu_cmpxchg_8(pcp, oval, nval) percpu_cmpxchg_op(pcp, oval, nval)
419 417
420#define irqsafe_cpu_add_1(pcp, val) percpu_add_op((pcp), val) 418#define irqsafe_cpu_add_1(pcp, val) percpu_add_op((pcp), val)
421#define irqsafe_cpu_add_2(pcp, val) percpu_add_op((pcp), val) 419#define irqsafe_cpu_add_2(pcp, val) percpu_add_op((pcp), val)
@@ -432,8 +430,6 @@ do { \
432#define irqsafe_cpu_xchg_1(pcp, nval) percpu_xchg_op(pcp, nval) 430#define irqsafe_cpu_xchg_1(pcp, nval) percpu_xchg_op(pcp, nval)
433#define irqsafe_cpu_xchg_2(pcp, nval) percpu_xchg_op(pcp, nval) 431#define irqsafe_cpu_xchg_2(pcp, nval) percpu_xchg_op(pcp, nval)
434#define irqsafe_cpu_xchg_4(pcp, nval) percpu_xchg_op(pcp, nval) 432#define irqsafe_cpu_xchg_4(pcp, nval) percpu_xchg_op(pcp, nval)
435#define irqsafe_cpu_xchg_8(pcp, nval) percpu_xchg_op(pcp, nval)
436#define irqsafe_cpu_cmpxchg_8(pcp, oval, nval) percpu_cmpxchg_op(pcp, oval, nval)
437 433
438#ifndef CONFIG_M386 434#ifndef CONFIG_M386
439#define __this_cpu_add_return_1(pcp, val) percpu_add_return_op(pcp, val) 435#define __this_cpu_add_return_1(pcp, val) percpu_add_return_op(pcp, val)
@@ -475,11 +471,15 @@ do { \
475#define this_cpu_or_8(pcp, val) percpu_to_op("or", (pcp), val) 471#define this_cpu_or_8(pcp, val) percpu_to_op("or", (pcp), val)
476#define this_cpu_xor_8(pcp, val) percpu_to_op("xor", (pcp), val) 472#define this_cpu_xor_8(pcp, val) percpu_to_op("xor", (pcp), val)
477#define this_cpu_add_return_8(pcp, val) percpu_add_return_op(pcp, val) 473#define this_cpu_add_return_8(pcp, val) percpu_add_return_op(pcp, val)
474#define this_cpu_xchg_8(pcp, nval) percpu_xchg_op(pcp, nval)
475#define this_cpu_cmpxchg_8(pcp, oval, nval) percpu_cmpxchg_op(pcp, oval, nval)
478 476
479#define irqsafe_cpu_add_8(pcp, val) percpu_add_op((pcp), val) 477#define irqsafe_cpu_add_8(pcp, val) percpu_add_op((pcp), val)
480#define irqsafe_cpu_and_8(pcp, val) percpu_to_op("and", (pcp), val) 478#define irqsafe_cpu_and_8(pcp, val) percpu_to_op("and", (pcp), val)
481#define irqsafe_cpu_or_8(pcp, val) percpu_to_op("or", (pcp), val) 479#define irqsafe_cpu_or_8(pcp, val) percpu_to_op("or", (pcp), val)
482#define irqsafe_cpu_xor_8(pcp, val) percpu_to_op("xor", (pcp), val) 480#define irqsafe_cpu_xor_8(pcp, val) percpu_to_op("xor", (pcp), val)
481#define irqsafe_cpu_xchg_8(pcp, nval) percpu_xchg_op(pcp, nval)
482#define irqsafe_cpu_cmpxchg_8(pcp, oval, nval) percpu_cmpxchg_op(pcp, oval, nval)
483#endif 483#endif
484 484
485/* This is not atomic against other CPUs -- CPU preemption needs to be off */ 485/* This is not atomic against other CPUs -- CPU preemption needs to be off */
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index b34ab80fddd5..bf4700755184 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -34,9 +34,11 @@ OUTPUT_FORMAT(CONFIG_OUTPUT_FORMAT, CONFIG_OUTPUT_FORMAT, CONFIG_OUTPUT_FORMAT)
34#ifdef CONFIG_X86_32 34#ifdef CONFIG_X86_32
35OUTPUT_ARCH(i386) 35OUTPUT_ARCH(i386)
36ENTRY(phys_startup_32) 36ENTRY(phys_startup_32)
37jiffies = jiffies_64;
37#else 38#else
38OUTPUT_ARCH(i386:x86-64) 39OUTPUT_ARCH(i386:x86-64)
39ENTRY(phys_startup_64) 40ENTRY(phys_startup_64)
41jiffies_64 = jiffies;
40#endif 42#endif
41 43
42#if defined(CONFIG_X86_64) && defined(CONFIG_DEBUG_RODATA) 44#if defined(CONFIG_X86_64) && defined(CONFIG_DEBUG_RODATA)
@@ -140,15 +142,6 @@ SECTIONS
140 CACHELINE_ALIGNED_DATA(L1_CACHE_BYTES) 142 CACHELINE_ALIGNED_DATA(L1_CACHE_BYTES)
141 143
142 DATA_DATA 144 DATA_DATA
143 /*
144 * Workaround a binutils (2.20.51.0.12 to 2.21.51.0.3) bug.
145 * This makes jiffies relocatable in such binutils
146 */
147#ifdef CONFIG_X86_32
148 jiffies = jiffies_64;
149#else
150 jiffies_64 = jiffies;
151#endif
152 CONSTRUCTORS 145 CONSTRUCTORS
153 146
154 /* rarely changed data like cpu maps */ 147 /* rarely changed data like cpu maps */
diff --git a/arch/x86/lguest/Kconfig b/arch/x86/lguest/Kconfig
index 38718041efc3..6e121a2a49e1 100644
--- a/arch/x86/lguest/Kconfig
+++ b/arch/x86/lguest/Kconfig
@@ -2,6 +2,7 @@ config LGUEST_GUEST
2 bool "Lguest guest support" 2 bool "Lguest guest support"
3 select PARAVIRT 3 select PARAVIRT
4 depends on X86_32 4 depends on X86_32
5 select VIRTUALIZATION
5 select VIRTIO 6 select VIRTIO
6 select VIRTIO_RING 7 select VIRTIO_RING
7 select VIRTIO_CONSOLE 8 select VIRTIO_CONSOLE
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index 4996cf5f73a0..eba687f0cc0c 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -824,7 +824,7 @@ static void __init lguest_init_IRQ(void)
824 824
825 for (i = FIRST_EXTERNAL_VECTOR; i < NR_VECTORS; i++) { 825 for (i = FIRST_EXTERNAL_VECTOR; i < NR_VECTORS; i++) {
826 /* Some systems map "vectors" to interrupts weirdly. Not us! */ 826 /* Some systems map "vectors" to interrupts weirdly. Not us! */
827 __get_cpu_var(vector_irq)[i] = i - FIRST_EXTERNAL_VECTOR; 827 __this_cpu_write(vector_irq[i], i - FIRST_EXTERNAL_VECTOR);
828 if (i != SYSCALL_VECTOR) 828 if (i != SYSCALL_VECTOR)
829 set_intr_gate(i, interrupt[i - FIRST_EXTERNAL_VECTOR]); 829 set_intr_gate(i, interrupt[i - FIRST_EXTERNAL_VECTOR]);
830 } 830 }
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index 787c52ca49c3..ebf6d7887a38 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -2,6 +2,28 @@
2#include <linux/topology.h> 2#include <linux/topology.h>
3#include <linux/module.h> 3#include <linux/module.h>
4#include <linux/bootmem.h> 4#include <linux/bootmem.h>
5#include <asm/numa.h>
6#include <asm/acpi.h>
7
8int __initdata numa_off;
9
10static __init int numa_setup(char *opt)
11{
12 if (!opt)
13 return -EINVAL;
14 if (!strncmp(opt, "off", 3))
15 numa_off = 1;
16#ifdef CONFIG_NUMA_EMU
17 if (!strncmp(opt, "fake=", 5))
18 numa_emu_cmdline(opt + 5);
19#endif
20#ifdef CONFIG_ACPI_NUMA
21 if (!strncmp(opt, "noacpi", 6))
22 acpi_numa = -1;
23#endif
24 return 0;
25}
26early_param("numa", numa_setup);
5 27
6/* 28/*
7 * Which logical CPUs are on which nodes 29 * Which logical CPUs are on which nodes
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
index 1e72102e80c9..95ea1551eebc 100644
--- a/arch/x86/mm/numa_64.c
+++ b/arch/x86/mm/numa_64.c
@@ -30,7 +30,6 @@ s16 apicid_to_node[MAX_LOCAL_APIC] __cpuinitdata = {
30 [0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE 30 [0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE
31}; 31};
32 32
33int numa_off __initdata;
34static unsigned long __initdata nodemap_addr; 33static unsigned long __initdata nodemap_addr;
35static unsigned long __initdata nodemap_size; 34static unsigned long __initdata nodemap_size;
36 35
@@ -263,6 +262,11 @@ static struct bootnode nodes[MAX_NUMNODES] __initdata;
263static struct bootnode physnodes[MAX_NUMNODES] __cpuinitdata; 262static struct bootnode physnodes[MAX_NUMNODES] __cpuinitdata;
264static char *cmdline __initdata; 263static char *cmdline __initdata;
265 264
265void __init numa_emu_cmdline(char *str)
266{
267 cmdline = str;
268}
269
266static int __init setup_physnodes(unsigned long start, unsigned long end, 270static int __init setup_physnodes(unsigned long start, unsigned long end,
267 int acpi, int amd) 271 int acpi, int amd)
268{ 272{
@@ -670,24 +674,6 @@ unsigned long __init numa_free_all_bootmem(void)
670 return pages; 674 return pages;
671} 675}
672 676
673static __init int numa_setup(char *opt)
674{
675 if (!opt)
676 return -EINVAL;
677 if (!strncmp(opt, "off", 3))
678 numa_off = 1;
679#ifdef CONFIG_NUMA_EMU
680 if (!strncmp(opt, "fake=", 5))
681 cmdline = opt + 5;
682#endif
683#ifdef CONFIG_ACPI_NUMA
684 if (!strncmp(opt, "noacpi", 6))
685 acpi_numa = -1;
686#endif
687 return 0;
688}
689early_param("numa", numa_setup);
690
691#ifdef CONFIG_NUMA 677#ifdef CONFIG_NUMA
692 678
693static __init int find_near_online_node(int node) 679static __init int find_near_online_node(int node)
diff --git a/arch/x86/mm/srat_32.c b/arch/x86/mm/srat_32.c
index f16434568a51..ae96e7b8051d 100644
--- a/arch/x86/mm/srat_32.c
+++ b/arch/x86/mm/srat_32.c
@@ -59,7 +59,6 @@ static struct node_memory_chunk_s __initdata node_memory_chunk[MAXCHUNKS];
59static int __initdata num_memory_chunks; /* total number of memory chunks */ 59static int __initdata num_memory_chunks; /* total number of memory chunks */
60static u8 __initdata apicid_to_pxm[MAX_APICID]; 60static u8 __initdata apicid_to_pxm[MAX_APICID];
61 61
62int numa_off __initdata;
63int acpi_numa __initdata; 62int acpi_numa __initdata;
64 63
65static __init void bad_srat(void) 64static __init void bad_srat(void)
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 7e8d3bc80af6..50542efe45fb 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1194,7 +1194,7 @@ asmlinkage void __init xen_start_kernel(void)
1194 per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0]; 1194 per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0];
1195 1195
1196 local_irq_disable(); 1196 local_irq_disable();
1197 early_boot_irqs_off(); 1197 early_boot_irqs_disabled = true;
1198 1198
1199 memblock_init(); 1199 memblock_init();
1200 1200
diff --git a/arch/x86/xen/irq.c b/arch/x86/xen/irq.c
index 9d30105a0c4a..6a6fe8939645 100644
--- a/arch/x86/xen/irq.c
+++ b/arch/x86/xen/irq.c
@@ -126,7 +126,7 @@ static const struct pv_irq_ops xen_irq_ops __initdata = {
126#endif 126#endif
127}; 127};
128 128
129void __init xen_init_irq_ops() 129void __init xen_init_irq_ops(void)
130{ 130{
131 pv_irq_ops = xen_irq_ops; 131 pv_irq_ops = xen_irq_ops;
132 x86_init.irqs.intr_init = xen_init_IRQ; 132 x86_init.irqs.intr_init = xen_init_IRQ;
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index 8f2251d2a3f8..ddc81a06edb9 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -237,7 +237,25 @@ void __init xen_build_dynamic_phys_to_machine(void)
237 p2m_top[topidx] = mid; 237 p2m_top[topidx] = mid;
238 } 238 }
239 239
240 p2m_top[topidx][mididx] = &mfn_list[pfn]; 240 /*
241 * As long as the mfn_list has enough entries to completely
242 * fill a p2m page, pointing into the array is ok. But if
243 * not the entries beyond the last pfn will be undefined.
244 * And guessing that the 'what-ever-there-is' does not take it
245 * too kindly when changing it to invalid markers, a new page
246 * is allocated, initialized and filled with the valid part.
247 */
248 if (unlikely(pfn + P2M_PER_PAGE > max_pfn)) {
249 unsigned long p2midx;
250 unsigned long *p2m = extend_brk(PAGE_SIZE, PAGE_SIZE);
251 p2m_init(p2m);
252
253 for (p2midx = 0; pfn + p2midx < max_pfn; p2midx++) {
254 p2m[p2midx] = mfn_list[pfn + p2midx];
255 }
256 p2m_top[topidx][mididx] = p2m;
257 } else
258 p2m_top[topidx][mididx] = &mfn_list[pfn];
241 } 259 }
242 260
243 m2p_override_init(); 261 m2p_override_init();
diff --git a/arch/xtensa/configs/common_defconfig b/arch/xtensa/configs/common_defconfig
index 1d230ee081b4..b90038e40dd3 100644
--- a/arch/xtensa/configs/common_defconfig
+++ b/arch/xtensa/configs/common_defconfig
@@ -32,7 +32,7 @@ CONFIG_LOG_BUF_SHIFT=14
32# CONFIG_HOTPLUG is not set 32# CONFIG_HOTPLUG is not set
33CONFIG_KOBJECT_UEVENT=y 33CONFIG_KOBJECT_UEVENT=y
34# CONFIG_IKCONFIG is not set 34# CONFIG_IKCONFIG is not set
35# CONFIG_EMBEDDED is not set 35# CONFIG_EXPERT is not set
36CONFIG_KALLSYMS=y 36CONFIG_KALLSYMS=y
37# CONFIG_KALLSYMS_ALL is not set 37# CONFIG_KALLSYMS_ALL is not set
38# CONFIG_KALLSYMS_EXTRA_PASS is not set 38# CONFIG_KALLSYMS_EXTRA_PASS is not set
diff --git a/arch/xtensa/configs/iss_defconfig b/arch/xtensa/configs/iss_defconfig
index 7368164843b9..0234cd198c54 100644
--- a/arch/xtensa/configs/iss_defconfig
+++ b/arch/xtensa/configs/iss_defconfig
@@ -55,7 +55,7 @@ CONFIG_LOG_BUF_SHIFT=14
55# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 55# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
56CONFIG_SYSCTL=y 56CONFIG_SYSCTL=y
57CONFIG_ANON_INODES=y 57CONFIG_ANON_INODES=y
58CONFIG_EMBEDDED=y 58CONFIG_EXPERT=y
59CONFIG_SYSCTL_SYSCALL=y 59CONFIG_SYSCTL_SYSCALL=y
60CONFIG_KALLSYMS=y 60CONFIG_KALLSYMS=y
61# CONFIG_KALLSYMS_ALL is not set 61# CONFIG_KALLSYMS_ALL is not set
diff --git a/arch/xtensa/configs/s6105_defconfig b/arch/xtensa/configs/s6105_defconfig
index bb84fbc9921f..095cd8084164 100644
--- a/arch/xtensa/configs/s6105_defconfig
+++ b/arch/xtensa/configs/s6105_defconfig
@@ -55,7 +55,7 @@ CONFIG_BLK_DEV_INITRD=y
55CONFIG_INITRAMFS_SOURCE="" 55CONFIG_INITRAMFS_SOURCE=""
56CONFIG_CC_OPTIMIZE_FOR_SIZE=y 56CONFIG_CC_OPTIMIZE_FOR_SIZE=y
57CONFIG_SYSCTL=y 57CONFIG_SYSCTL=y
58CONFIG_EMBEDDED=y 58CONFIG_EXPERT=y
59CONFIG_SYSCTL_SYSCALL=y 59CONFIG_SYSCTL_SYSCALL=y
60CONFIG_KALLSYMS=y 60CONFIG_KALLSYMS=y
61# CONFIG_KALLSYMS_ALL is not set 61# CONFIG_KALLSYMS_ALL is not set
diff --git a/block/Kconfig b/block/Kconfig
index 6c9213ef15a1..60be1e0455da 100644
--- a/block/Kconfig
+++ b/block/Kconfig
@@ -2,7 +2,7 @@
2# Block layer core configuration 2# Block layer core configuration
3# 3#
4menuconfig BLOCK 4menuconfig BLOCK
5 bool "Enable the block layer" if EMBEDDED 5 bool "Enable the block layer" if EXPERT
6 default y 6 default y
7 help 7 help
8 Provide block layer support for the kernel. 8 Provide block layer support for the kernel.
diff --git a/drivers/Makefile b/drivers/Makefile
index 7eb35f479461..b423bb16c3a8 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -24,7 +24,7 @@ obj-$(CONFIG_XEN) += xen/
24# regulators early, since some subsystems rely on them to initialize 24# regulators early, since some subsystems rely on them to initialize
25obj-$(CONFIG_REGULATOR) += regulator/ 25obj-$(CONFIG_REGULATOR) += regulator/
26 26
27# char/ comes before serial/ etc so that the VT console is the boot-time 27# tty/ comes before char/ so that the VT console is the boot-time
28# default. 28# default.
29obj-y += tty/ 29obj-y += tty/
30obj-y += char/ 30obj-y += char/
@@ -38,7 +38,6 @@ obj-$(CONFIG_CONNECTOR) += connector/
38obj-$(CONFIG_FB_I810) += video/i810/ 38obj-$(CONFIG_FB_I810) += video/i810/
39obj-$(CONFIG_FB_INTEL) += video/intelfb/ 39obj-$(CONFIG_FB_INTEL) += video/intelfb/
40 40
41obj-y += serial/
42obj-$(CONFIG_PARPORT) += parport/ 41obj-$(CONFIG_PARPORT) += parport/
43obj-y += base/ block/ misc/ mfd/ nfc/ 42obj-y += base/ block/ misc/ mfd/ nfc/
44obj-$(CONFIG_NUBUS) += nubus/ 43obj-$(CONFIG_NUBUS) += nubus/
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 10c7ad59c0e1..2aa042a5da6d 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -318,7 +318,7 @@ config ACPI_PCI_SLOT
318 the module will be called pci_slot. 318 the module will be called pci_slot.
319 319
320config X86_PM_TIMER 320config X86_PM_TIMER
321 bool "Power Management Timer Support" if EMBEDDED 321 bool "Power Management Timer Support" if EXPERT
322 depends on X86 322 depends on X86
323 default y 323 default y
324 help 324 help
diff --git a/drivers/acpi/acpica/accommon.h b/drivers/acpi/acpica/accommon.h
index 3e50c74ed4a1..e0ba17f0a7c8 100644
--- a/drivers/acpi/acpica/accommon.h
+++ b/drivers/acpi/acpica/accommon.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acconfig.h b/drivers/acpi/acpica/acconfig.h
index b17d8de9f6ff..ab87396c2c07 100644
--- a/drivers/acpi/acpica/acconfig.h
+++ b/drivers/acpi/acpica/acconfig.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acdebug.h b/drivers/acpi/acpica/acdebug.h
index 72e9d5eb083c..eb0b1f8dee6d 100644
--- a/drivers/acpi/acpica/acdebug.h
+++ b/drivers/acpi/acpica/acdebug.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acdispat.h b/drivers/acpi/acpica/acdispat.h
index 894a0ff2a946..666271b65418 100644
--- a/drivers/acpi/acpica/acdispat.h
+++ b/drivers/acpi/acpica/acdispat.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h
index 70e0b28801aa..41d247daf461 100644
--- a/drivers/acpi/acpica/acevents.h
+++ b/drivers/acpi/acpica/acevents.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
index 0e4dba0d0325..82a1bd283db8 100644
--- a/drivers/acpi/acpica/acglobal.h
+++ b/drivers/acpi/acpica/acglobal.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/achware.h b/drivers/acpi/acpica/achware.h
index 258d628793ea..e7213beaafc7 100644
--- a/drivers/acpi/acpica/achware.h
+++ b/drivers/acpi/acpica/achware.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acinterp.h b/drivers/acpi/acpica/acinterp.h
index 049e203bd621..3731e1c34b83 100644
--- a/drivers/acpi/acpica/acinterp.h
+++ b/drivers/acpi/acpica/acinterp.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h
index 74000f5b7dab..54784bb42cec 100644
--- a/drivers/acpi/acpica/aclocal.h
+++ b/drivers/acpi/acpica/aclocal.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h
index 8d5c9e0a495f..b7491ee1fba6 100644
--- a/drivers/acpi/acpica/acmacros.h
+++ b/drivers/acpi/acpica/acmacros.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h
index d44d3bc5b847..79a598c67fe3 100644
--- a/drivers/acpi/acpica/acnamesp.h
+++ b/drivers/acpi/acpica/acnamesp.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h
index 962a3ccff6fd..1055769f2f01 100644
--- a/drivers/acpi/acpica/acobject.h
+++ b/drivers/acpi/acpica/acobject.h
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -97,8 +97,6 @@
97#define AOPOBJ_OBJECT_INITIALIZED 0x08 /* Region is initialized, _REG was run */ 97#define AOPOBJ_OBJECT_INITIALIZED 0x08 /* Region is initialized, _REG was run */
98#define AOPOBJ_SETUP_COMPLETE 0x10 /* Region setup is complete */ 98#define AOPOBJ_SETUP_COMPLETE 0x10 /* Region setup is complete */
99#define AOPOBJ_INVALID 0x20 /* Host OS won't allow a Region address */ 99#define AOPOBJ_INVALID 0x20 /* Host OS won't allow a Region address */
100#define AOPOBJ_MODULE_LEVEL 0x40 /* Method is actually module-level code */
101#define AOPOBJ_MODIFIED_NAMESPACE 0x80 /* Method modified the namespace */
102 100
103/****************************************************************************** 101/******************************************************************************
104 * 102 *
@@ -175,7 +173,7 @@ struct acpi_object_region {
175}; 173};
176 174
177struct acpi_object_method { 175struct acpi_object_method {
178 ACPI_OBJECT_COMMON_HEADER u8 method_flags; 176 ACPI_OBJECT_COMMON_HEADER u8 info_flags;
179 u8 param_count; 177 u8 param_count;
180 u8 sync_level; 178 u8 sync_level;
181 union acpi_operand_object *mutex; 179 union acpi_operand_object *mutex;
@@ -183,13 +181,21 @@ struct acpi_object_method {
183 union { 181 union {
184 ACPI_INTERNAL_METHOD implementation; 182 ACPI_INTERNAL_METHOD implementation;
185 union acpi_operand_object *handler; 183 union acpi_operand_object *handler;
186 } extra; 184 } dispatch;
187 185
188 u32 aml_length; 186 u32 aml_length;
189 u8 thread_count; 187 u8 thread_count;
190 acpi_owner_id owner_id; 188 acpi_owner_id owner_id;
191}; 189};
192 190
191/* Flags for info_flags field above */
192
193#define ACPI_METHOD_MODULE_LEVEL 0x01 /* Method is actually module-level code */
194#define ACPI_METHOD_INTERNAL_ONLY 0x02 /* Method is implemented internally (_OSI) */
195#define ACPI_METHOD_SERIALIZED 0x04 /* Method is serialized */
196#define ACPI_METHOD_SERIALIZED_PENDING 0x08 /* Method is to be marked serialized */
197#define ACPI_METHOD_MODIFIED_NAMESPACE 0x10 /* Method modified the namespace */
198
193/****************************************************************************** 199/******************************************************************************
194 * 200 *
195 * Objects that can be notified. All share a common notify_info area. 201 * Objects that can be notified. All share a common notify_info area.
diff --git a/drivers/acpi/acpica/acopcode.h b/drivers/acpi/acpica/acopcode.h
index 8c15ff43f42b..bb2ccfad7376 100644
--- a/drivers/acpi/acpica/acopcode.h
+++ b/drivers/acpi/acpica/acopcode.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acparser.h b/drivers/acpi/acpica/acparser.h
index d0bb0fd3e57a..5ea1e06afa20 100644
--- a/drivers/acpi/acpica/acparser.h
+++ b/drivers/acpi/acpica/acparser.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acpredef.h b/drivers/acpi/acpica/acpredef.h
index 10998d369ad0..94e73c97cf85 100644
--- a/drivers/acpi/acpica/acpredef.h
+++ b/drivers/acpi/acpica/acpredef.h
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acresrc.h b/drivers/acpi/acpica/acresrc.h
index 528bcbaf4ce7..f08b55b7f3a0 100644
--- a/drivers/acpi/acpica/acresrc.h
+++ b/drivers/acpi/acpica/acresrc.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acstruct.h b/drivers/acpi/acpica/acstruct.h
index 6e5dd97949fe..1623b245dde2 100644
--- a/drivers/acpi/acpica/acstruct.h
+++ b/drivers/acpi/acpica/acstruct.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/actables.h b/drivers/acpi/acpica/actables.h
index 62a576e34361..967f08124eba 100644
--- a/drivers/acpi/acpica/actables.h
+++ b/drivers/acpi/acpica/actables.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h
index 72e4183c1937..99c140d8e348 100644
--- a/drivers/acpi/acpica/acutils.h
+++ b/drivers/acpi/acpica/acutils.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/amlcode.h b/drivers/acpi/acpica/amlcode.h
index 1f484ba228fc..f4f0998d3967 100644
--- a/drivers/acpi/acpica/amlcode.h
+++ b/drivers/acpi/acpica/amlcode.h
@@ -7,7 +7,7 @@
7 *****************************************************************************/ 7 *****************************************************************************/
8 8
9/* 9/*
10 * Copyright (C) 2000 - 2010, Intel Corp. 10 * Copyright (C) 2000 - 2011, Intel Corp.
11 * All rights reserved. 11 * All rights reserved.
12 * 12 *
13 * Redistribution and use in source and binary forms, with or without 13 * Redistribution and use in source and binary forms, with or without
@@ -480,16 +480,10 @@ typedef enum {
480 AML_FIELD_ATTRIB_SMB_BLOCK_CALL = 0x0D 480 AML_FIELD_ATTRIB_SMB_BLOCK_CALL = 0x0D
481} AML_ACCESS_ATTRIBUTE; 481} AML_ACCESS_ATTRIBUTE;
482 482
483/* Bit fields in method_flags byte */ 483/* Bit fields in the AML method_flags byte */
484 484
485#define AML_METHOD_ARG_COUNT 0x07 485#define AML_METHOD_ARG_COUNT 0x07
486#define AML_METHOD_SERIALIZED 0x08 486#define AML_METHOD_SERIALIZED 0x08
487#define AML_METHOD_SYNC_LEVEL 0xF0 487#define AML_METHOD_SYNC_LEVEL 0xF0
488 488
489/* METHOD_FLAGS_ARG_COUNT is not used internally, define additional flags */
490
491#define AML_METHOD_INTERNAL_ONLY 0x01
492#define AML_METHOD_RESERVED1 0x02
493#define AML_METHOD_RESERVED2 0x04
494
495#endif /* __AMLCODE_H__ */ 489#endif /* __AMLCODE_H__ */
diff --git a/drivers/acpi/acpica/amlresrc.h b/drivers/acpi/acpica/amlresrc.h
index 0e5798fcbb19..59122cde247c 100644
--- a/drivers/acpi/acpica/amlresrc.h
+++ b/drivers/acpi/acpica/amlresrc.h
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c
index 347bee1726f1..34be60c0e448 100644
--- a/drivers/acpi/acpica/dsfield.c
+++ b/drivers/acpi/acpica/dsfield.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dsinit.c b/drivers/acpi/acpica/dsinit.c
index cc4a38c57558..a7718bf2b9a1 100644
--- a/drivers/acpi/acpica/dsinit.c
+++ b/drivers/acpi/acpica/dsinit.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c
index d94dd8974b55..5d797751e205 100644
--- a/drivers/acpi/acpica/dsmethod.c
+++ b/drivers/acpi/acpica/dsmethod.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -43,7 +43,6 @@
43 43
44#include <acpi/acpi.h> 44#include <acpi/acpi.h>
45#include "accommon.h" 45#include "accommon.h"
46#include "amlcode.h"
47#include "acdispat.h" 46#include "acdispat.h"
48#include "acinterp.h" 47#include "acinterp.h"
49#include "acnamesp.h" 48#include "acnamesp.h"
@@ -201,7 +200,7 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
201 /* 200 /*
202 * If this method is serialized, we need to acquire the method mutex. 201 * If this method is serialized, we need to acquire the method mutex.
203 */ 202 */
204 if (obj_desc->method.method_flags & AML_METHOD_SERIALIZED) { 203 if (obj_desc->method.info_flags & ACPI_METHOD_SERIALIZED) {
205 /* 204 /*
206 * Create a mutex for the method if it is defined to be Serialized 205 * Create a mutex for the method if it is defined to be Serialized
207 * and a mutex has not already been created. We defer the mutex creation 206 * and a mutex has not already been created. We defer the mutex creation
@@ -413,8 +412,9 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
413 412
414 /* Invoke an internal method if necessary */ 413 /* Invoke an internal method if necessary */
415 414
416 if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { 415 if (obj_desc->method.info_flags & ACPI_METHOD_INTERNAL_ONLY) {
417 status = obj_desc->method.extra.implementation(next_walk_state); 416 status =
417 obj_desc->method.dispatch.implementation(next_walk_state);
418 if (status == AE_OK) { 418 if (status == AE_OK) {
419 status = AE_CTRL_TERMINATE; 419 status = AE_CTRL_TERMINATE;
420 } 420 }
@@ -579,11 +579,14 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
579 579
580 /* 580 /*
581 * Delete any namespace objects created anywhere within the 581 * Delete any namespace objects created anywhere within the
582 * namespace by the execution of this method. Unless this method 582 * namespace by the execution of this method. Unless:
583 * is a module-level executable code method, in which case we 583 * 1) This method is a module-level executable code method, in which
584 * want make the objects permanent. 584 * case we want make the objects permanent.
585 * 2) There are other threads executing the method, in which case we
586 * will wait until the last thread has completed.
585 */ 587 */
586 if (!(method_desc->method.flags & AOPOBJ_MODULE_LEVEL)) { 588 if (!(method_desc->method.info_flags & ACPI_METHOD_MODULE_LEVEL)
589 && (method_desc->method.thread_count == 1)) {
587 590
588 /* Delete any direct children of (created by) this method */ 591 /* Delete any direct children of (created by) this method */
589 592
@@ -593,12 +596,17 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
593 /* 596 /*
594 * Delete any objects that were created by this method 597 * Delete any objects that were created by this method
595 * elsewhere in the namespace (if any were created). 598 * elsewhere in the namespace (if any were created).
599 * Use of the ACPI_METHOD_MODIFIED_NAMESPACE optimizes the
600 * deletion such that we don't have to perform an entire
601 * namespace walk for every control method execution.
596 */ 602 */
597 if (method_desc->method. 603 if (method_desc->method.
598 flags & AOPOBJ_MODIFIED_NAMESPACE) { 604 info_flags & ACPI_METHOD_MODIFIED_NAMESPACE) {
599 acpi_ns_delete_namespace_by_owner(method_desc-> 605 acpi_ns_delete_namespace_by_owner(method_desc->
600 method. 606 method.
601 owner_id); 607 owner_id);
608 method_desc->method.info_flags &=
609 ~ACPI_METHOD_MODIFIED_NAMESPACE;
602 } 610 }
603 } 611 }
604 } 612 }
@@ -629,19 +637,43 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
629 * Serialized if it appears that the method is incorrectly written and 637 * Serialized if it appears that the method is incorrectly written and
630 * does not support multiple thread execution. The best example of this 638 * does not support multiple thread execution. The best example of this
631 * is if such a method creates namespace objects and blocks. A second 639 * is if such a method creates namespace objects and blocks. A second
632 * thread will fail with an AE_ALREADY_EXISTS exception 640 * thread will fail with an AE_ALREADY_EXISTS exception.
633 * 641 *
634 * This code is here because we must wait until the last thread exits 642 * This code is here because we must wait until the last thread exits
635 * before creating the synchronization semaphore. 643 * before marking the method as serialized.
636 */ 644 */
637 if ((method_desc->method.method_flags & AML_METHOD_SERIALIZED) 645 if (method_desc->method.
638 && (!method_desc->method.mutex)) { 646 info_flags & ACPI_METHOD_SERIALIZED_PENDING) {
639 (void)acpi_ds_create_method_mutex(method_desc); 647 if (walk_state) {
648 ACPI_INFO((AE_INFO,
649 "Marking method %4.4s as Serialized because of AE_ALREADY_EXISTS error",
650 walk_state->method_node->name.
651 ascii));
652 }
653
654 /*
655 * Method tried to create an object twice and was marked as
656 * "pending serialized". The probable cause is that the method
657 * cannot handle reentrancy.
658 *
659 * The method was created as not_serialized, but it tried to create
660 * a named object and then blocked, causing the second thread
661 * entrance to begin and then fail. Workaround this problem by
662 * marking the method permanently as Serialized when the last
663 * thread exits here.
664 */
665 method_desc->method.info_flags &=
666 ~ACPI_METHOD_SERIALIZED_PENDING;
667 method_desc->method.info_flags |=
668 ACPI_METHOD_SERIALIZED;
669 method_desc->method.sync_level = 0;
640 } 670 }
641 671
642 /* No more threads, we can free the owner_id */ 672 /* No more threads, we can free the owner_id */
643 673
644 if (!(method_desc->method.flags & AOPOBJ_MODULE_LEVEL)) { 674 if (!
675 (method_desc->method.
676 info_flags & ACPI_METHOD_MODULE_LEVEL)) {
645 acpi_ut_release_owner_id(&method_desc->method.owner_id); 677 acpi_ut_release_owner_id(&method_desc->method.owner_id);
646 } 678 }
647 } 679 }
diff --git a/drivers/acpi/acpica/dsmthdat.c b/drivers/acpi/acpica/dsmthdat.c
index 8095306fcd8c..905ce29a92e1 100644
--- a/drivers/acpi/acpica/dsmthdat.c
+++ b/drivers/acpi/acpica/dsmthdat.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dsobject.c b/drivers/acpi/acpica/dsobject.c
index 8e85f54a8e0e..f42e17e5c252 100644
--- a/drivers/acpi/acpica/dsobject.c
+++ b/drivers/acpi/acpica/dsobject.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c
index 7c0e74227171..bbecf293aeeb 100644
--- a/drivers/acpi/acpica/dsopcode.c
+++ b/drivers/acpi/acpica/dsopcode.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dsutils.c b/drivers/acpi/acpica/dsutils.c
index 15135c25aa9b..2c477ce172fa 100644
--- a/drivers/acpi/acpica/dsutils.c
+++ b/drivers/acpi/acpica/dsutils.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dswexec.c b/drivers/acpi/acpica/dswexec.c
index 6b0b5d08d97a..fe40e4c6554f 100644
--- a/drivers/acpi/acpica/dswexec.c
+++ b/drivers/acpi/acpica/dswexec.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dswload.c b/drivers/acpi/acpica/dswload.c
index 140a9d002959..52566ff5e903 100644
--- a/drivers/acpi/acpica/dswload.c
+++ b/drivers/acpi/acpica/dswload.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dswscope.c b/drivers/acpi/acpica/dswscope.c
index d1e701709dac..76a661fc1e09 100644
--- a/drivers/acpi/acpica/dswscope.c
+++ b/drivers/acpi/acpica/dswscope.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/dswstate.c b/drivers/acpi/acpica/dswstate.c
index 83155dd8671e..a6c374ef9914 100644
--- a/drivers/acpi/acpica/dswstate.c
+++ b/drivers/acpi/acpica/dswstate.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/evevent.c b/drivers/acpi/acpica/evevent.c
index e5e313c663a5..d458b041e651 100644
--- a/drivers/acpi/acpica/evevent.c
+++ b/drivers/acpi/acpica/evevent.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c
index 7c339d34ab42..14988a86066f 100644
--- a/drivers/acpi/acpica/evgpe.c
+++ b/drivers/acpi/acpica/evgpe.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -471,6 +471,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
471 471
472 status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); 472 status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
473 if (ACPI_FAILURE(status)) { 473 if (ACPI_FAILURE(status)) {
474 ACPI_FREE(local_gpe_event_info);
474 return_VOID; 475 return_VOID;
475 } 476 }
476 477
@@ -478,6 +479,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
478 479
479 if (!acpi_ev_valid_gpe_event(gpe_event_info)) { 480 if (!acpi_ev_valid_gpe_event(gpe_event_info)) {
480 status = acpi_ut_release_mutex(ACPI_MTX_EVENTS); 481 status = acpi_ut_release_mutex(ACPI_MTX_EVENTS);
482 ACPI_FREE(local_gpe_event_info);
481 return_VOID; 483 return_VOID;
482 } 484 }
483 485
diff --git a/drivers/acpi/acpica/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c
index 9acb86958c09..ca2c41a53311 100644
--- a/drivers/acpi/acpica/evgpeblk.c
+++ b/drivers/acpi/acpica/evgpeblk.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/evgpeinit.c b/drivers/acpi/acpica/evgpeinit.c
index c59dc2340593..ce9aa9f9a972 100644
--- a/drivers/acpi/acpica/evgpeinit.c
+++ b/drivers/acpi/acpica/evgpeinit.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/evgpeutil.c b/drivers/acpi/acpica/evgpeutil.c
index 10e477494dcf..80a81d0c4a80 100644
--- a/drivers/acpi/acpica/evgpeutil.c
+++ b/drivers/acpi/acpica/evgpeutil.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/evmisc.c b/drivers/acpi/acpica/evmisc.c
index 38bba66fcce5..7dc80946f7bd 100644
--- a/drivers/acpi/acpica/evmisc.c
+++ b/drivers/acpi/acpica/evmisc.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c
index 98fd210e87b2..785a5ee64585 100644
--- a/drivers/acpi/acpica/evregion.c
+++ b/drivers/acpi/acpica/evregion.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c
index 0b47a6dc9290..9659cee6093e 100644
--- a/drivers/acpi/acpica/evrgnini.c
+++ b/drivers/acpi/acpica/evrgnini.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -590,9 +590,9 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
590 * See acpi_ns_exec_module_code 590 * See acpi_ns_exec_module_code
591 */ 591 */
592 if (obj_desc->method. 592 if (obj_desc->method.
593 flags & AOPOBJ_MODULE_LEVEL) { 593 info_flags & ACPI_METHOD_MODULE_LEVEL) {
594 handler_obj = 594 handler_obj =
595 obj_desc->method.extra.handler; 595 obj_desc->method.dispatch.handler;
596 } 596 }
597 break; 597 break;
598 598
diff --git a/drivers/acpi/acpica/evsci.c b/drivers/acpi/acpica/evsci.c
index 8dfbaa96e422..2ebd40e1a3ef 100644
--- a/drivers/acpi/acpica/evsci.c
+++ b/drivers/acpi/acpica/evsci.c
@@ -6,7 +6,7 @@
6 ******************************************************************************/ 6 ******************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/evxface.c b/drivers/acpi/acpica/evxface.c
index 1226689bdb1b..e1141402dbed 100644
--- a/drivers/acpi/acpica/evxface.c
+++ b/drivers/acpi/acpica/evxface.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/evxfevnt.c b/drivers/acpi/acpica/evxfevnt.c
index 90488c1e0f3d..c57b5c707a77 100644
--- a/drivers/acpi/acpica/evxfevnt.c
+++ b/drivers/acpi/acpica/evxfevnt.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/evxfgpe.c b/drivers/acpi/acpica/evxfgpe.c
index 416845bc9c1f..e9562a7cb2f9 100644
--- a/drivers/acpi/acpica/evxfgpe.c
+++ b/drivers/acpi/acpica/evxfgpe.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/evxfregn.c b/drivers/acpi/acpica/evxfregn.c
index ce9314f79451..eb7386763712 100644
--- a/drivers/acpi/acpica/evxfregn.c
+++ b/drivers/acpi/acpica/evxfregn.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exconfig.c b/drivers/acpi/acpica/exconfig.c
index 18832205b631..745a42b401f5 100644
--- a/drivers/acpi/acpica/exconfig.c
+++ b/drivers/acpi/acpica/exconfig.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exconvrt.c b/drivers/acpi/acpica/exconvrt.c
index b73bc50c5b76..74162a11817d 100644
--- a/drivers/acpi/acpica/exconvrt.c
+++ b/drivers/acpi/acpica/exconvrt.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/excreate.c b/drivers/acpi/acpica/excreate.c
index 3c61b48c73f5..e7b372d17667 100644
--- a/drivers/acpi/acpica/excreate.c
+++ b/drivers/acpi/acpica/excreate.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -482,13 +482,11 @@ acpi_ex_create_method(u8 * aml_start,
482 obj_desc->method.aml_length = aml_length; 482 obj_desc->method.aml_length = aml_length;
483 483
484 /* 484 /*
485 * Disassemble the method flags. Split off the Arg Count 485 * Disassemble the method flags. Split off the arg_count, Serialized
486 * for efficiency 486 * flag, and sync_level for efficiency.
487 */ 487 */
488 method_flags = (u8) operand[1]->integer.value; 488 method_flags = (u8) operand[1]->integer.value;
489 489
490 obj_desc->method.method_flags =
491 (u8) (method_flags & ~AML_METHOD_ARG_COUNT);
492 obj_desc->method.param_count = 490 obj_desc->method.param_count =
493 (u8) (method_flags & AML_METHOD_ARG_COUNT); 491 (u8) (method_flags & AML_METHOD_ARG_COUNT);
494 492
@@ -497,6 +495,8 @@ acpi_ex_create_method(u8 * aml_start,
497 * created for this method when it is parsed. 495 * created for this method when it is parsed.
498 */ 496 */
499 if (method_flags & AML_METHOD_SERIALIZED) { 497 if (method_flags & AML_METHOD_SERIALIZED) {
498 obj_desc->method.info_flags = ACPI_METHOD_SERIALIZED;
499
500 /* 500 /*
501 * ACPI 1.0: sync_level = 0 501 * ACPI 1.0: sync_level = 0
502 * ACPI 2.0: sync_level = sync_level in method declaration 502 * ACPI 2.0: sync_level = sync_level in method declaration
diff --git a/drivers/acpi/acpica/exdebug.c b/drivers/acpi/acpica/exdebug.c
index be8c98b480d7..c7a2f1edd282 100644
--- a/drivers/acpi/acpica/exdebug.c
+++ b/drivers/acpi/acpica/exdebug.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exdump.c b/drivers/acpi/acpica/exdump.c
index f067bbb0d961..61b8c0e8b74d 100644
--- a/drivers/acpi/acpica/exdump.c
+++ b/drivers/acpi/acpica/exdump.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -122,7 +122,7 @@ static struct acpi_exdump_info acpi_ex_dump_event[2] = {
122 122
123static struct acpi_exdump_info acpi_ex_dump_method[9] = { 123static struct acpi_exdump_info acpi_ex_dump_method[9] = {
124 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_method), NULL}, 124 {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_method), NULL},
125 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.method_flags), "Method Flags"}, 125 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.info_flags), "Info Flags"},
126 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.param_count), 126 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.param_count),
127 "Parameter Count"}, 127 "Parameter Count"},
128 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.sync_level), "Sync Level"}, 128 {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.sync_level), "Sync Level"},
diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c
index f17d2ff0031b..0bde2230c028 100644
--- a/drivers/acpi/acpica/exfield.c
+++ b/drivers/acpi/acpica/exfield.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c
index 38293fd3e088..6c79c29f082d 100644
--- a/drivers/acpi/acpica/exfldio.c
+++ b/drivers/acpi/acpica/exfldio.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exmisc.c b/drivers/acpi/acpica/exmisc.c
index 95db4be0877b..703d88ed0b3d 100644
--- a/drivers/acpi/acpica/exmisc.c
+++ b/drivers/acpi/acpica/exmisc.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exmutex.c b/drivers/acpi/acpica/exmutex.c
index 6af14e43f839..be1c56ead653 100644
--- a/drivers/acpi/acpica/exmutex.c
+++ b/drivers/acpi/acpica/exmutex.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exnames.c b/drivers/acpi/acpica/exnames.c
index d11e539ef763..49ec049c157e 100644
--- a/drivers/acpi/acpica/exnames.c
+++ b/drivers/acpi/acpica/exnames.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exoparg1.c b/drivers/acpi/acpica/exoparg1.c
index 84e4d185aa25..236ead14b7f7 100644
--- a/drivers/acpi/acpica/exoparg1.c
+++ b/drivers/acpi/acpica/exoparg1.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exoparg2.c b/drivers/acpi/acpica/exoparg2.c
index 10e104cf0fb9..2571b4a310f4 100644
--- a/drivers/acpi/acpica/exoparg2.c
+++ b/drivers/acpi/acpica/exoparg2.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exoparg3.c b/drivers/acpi/acpica/exoparg3.c
index 7a08d23befcd..1b48d9d28c9a 100644
--- a/drivers/acpi/acpica/exoparg3.c
+++ b/drivers/acpi/acpica/exoparg3.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exoparg6.c b/drivers/acpi/acpica/exoparg6.c
index 4b50730cf9a0..f4a2787e8e92 100644
--- a/drivers/acpi/acpica/exoparg6.c
+++ b/drivers/acpi/acpica/exoparg6.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c
index 7aae29f73d3f..cc95e2000406 100644
--- a/drivers/acpi/acpica/exprep.c
+++ b/drivers/acpi/acpica/exprep.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exregion.c b/drivers/acpi/acpica/exregion.c
index de17e10da0ed..f0d5e14f1f2c 100644
--- a/drivers/acpi/acpica/exregion.c
+++ b/drivers/acpi/acpica/exregion.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exresnte.c b/drivers/acpi/acpica/exresnte.c
index 1fa4289a687e..55997e46948b 100644
--- a/drivers/acpi/acpica/exresnte.c
+++ b/drivers/acpi/acpica/exresnte.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exresolv.c b/drivers/acpi/acpica/exresolv.c
index 7ca35ea8acea..db502cd7d934 100644
--- a/drivers/acpi/acpica/exresolv.c
+++ b/drivers/acpi/acpica/exresolv.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exresop.c b/drivers/acpi/acpica/exresop.c
index 8c97cfd6a0fd..e3bb00ccdff5 100644
--- a/drivers/acpi/acpica/exresop.c
+++ b/drivers/acpi/acpica/exresop.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exstore.c b/drivers/acpi/acpica/exstore.c
index 1624436ba4c5..c0c8842dd344 100644
--- a/drivers/acpi/acpica/exstore.c
+++ b/drivers/acpi/acpica/exstore.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exstoren.c b/drivers/acpi/acpica/exstoren.c
index d4af684620ca..a979017d56b8 100644
--- a/drivers/acpi/acpica/exstoren.c
+++ b/drivers/acpi/acpica/exstoren.c
@@ -7,7 +7,7 @@
7 *****************************************************************************/ 7 *****************************************************************************/
8 8
9/* 9/*
10 * Copyright (C) 2000 - 2010, Intel Corp. 10 * Copyright (C) 2000 - 2011, Intel Corp.
11 * All rights reserved. 11 * All rights reserved.
12 * 12 *
13 * Redistribution and use in source and binary forms, with or without 13 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exstorob.c b/drivers/acpi/acpica/exstorob.c
index e972b667b09b..dc665cc554de 100644
--- a/drivers/acpi/acpica/exstorob.c
+++ b/drivers/acpi/acpica/exstorob.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exsystem.c b/drivers/acpi/acpica/exsystem.c
index 675aaa91a770..df66e7b686be 100644
--- a/drivers/acpi/acpica/exsystem.c
+++ b/drivers/acpi/acpica/exsystem.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/exutils.c b/drivers/acpi/acpica/exutils.c
index 4093522eed45..8ad93146dd32 100644
--- a/drivers/acpi/acpica/exutils.c
+++ b/drivers/acpi/acpica/exutils.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/hwacpi.c b/drivers/acpi/acpica/hwacpi.c
index b44274a0b62c..fc380d3d45ab 100644
--- a/drivers/acpi/acpica/hwacpi.c
+++ b/drivers/acpi/acpica/hwacpi.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/hwgpe.c b/drivers/acpi/acpica/hwgpe.c
index 85c3cbd4304d..f610d88a66be 100644
--- a/drivers/acpi/acpica/hwgpe.c
+++ b/drivers/acpi/acpica/hwgpe.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/hwpci.c b/drivers/acpi/acpica/hwpci.c
index ad21c7d8bf4f..050fd227951b 100644
--- a/drivers/acpi/acpica/hwpci.c
+++ b/drivers/acpi/acpica/hwpci.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c
index 5d1273b660ae..55accb7018bb 100644
--- a/drivers/acpi/acpica/hwregs.c
+++ b/drivers/acpi/acpica/hwregs.c
@@ -7,7 +7,7 @@
7 ******************************************************************************/ 7 ******************************************************************************/
8 8
9/* 9/*
10 * Copyright (C) 2000 - 2010, Intel Corp. 10 * Copyright (C) 2000 - 2011, Intel Corp.
11 * All rights reserved. 11 * All rights reserved.
12 * 12 *
13 * Redistribution and use in source and binary forms, with or without 13 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index 3796811276ac..2ac28bbe8827 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/hwtimer.c b/drivers/acpi/acpica/hwtimer.c
index 1ef8e0bb250b..9c8eb71a12fb 100644
--- a/drivers/acpi/acpica/hwtimer.c
+++ b/drivers/acpi/acpica/hwtimer.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/hwvalid.c b/drivers/acpi/acpica/hwvalid.c
index e1d9c777b213..5f1605874655 100644
--- a/drivers/acpi/acpica/hwvalid.c
+++ b/drivers/acpi/acpica/hwvalid.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c
index 50cc3be77724..6f98d210e71c 100644
--- a/drivers/acpi/acpica/hwxface.c
+++ b/drivers/acpi/acpica/hwxface.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsaccess.c b/drivers/acpi/acpica/nsaccess.c
index 0cd925be5fc1..d93172fd15a8 100644
--- a/drivers/acpi/acpica/nsaccess.c
+++ b/drivers/acpi/acpica/nsaccess.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -163,9 +163,9 @@ acpi_status acpi_ns_root_initialize(void)
163#else 163#else
164 /* Mark this as a very SPECIAL method */ 164 /* Mark this as a very SPECIAL method */
165 165
166 obj_desc->method.method_flags = 166 obj_desc->method.info_flags =
167 AML_METHOD_INTERNAL_ONLY; 167 ACPI_METHOD_INTERNAL_ONLY;
168 obj_desc->method.extra.implementation = 168 obj_desc->method.dispatch.implementation =
169 acpi_ut_osi_implementation; 169 acpi_ut_osi_implementation;
170#endif 170#endif
171 break; 171 break;
diff --git a/drivers/acpi/acpica/nsalloc.c b/drivers/acpi/acpica/nsalloc.c
index 1e5ff803d9ad..1d0ef15d158f 100644
--- a/drivers/acpi/acpica/nsalloc.c
+++ b/drivers/acpi/acpica/nsalloc.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -234,8 +234,8 @@ void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namesp
234 * modified the namespace. This is used for cleanup when the 234 * modified the namespace. This is used for cleanup when the
235 * method exits. 235 * method exits.
236 */ 236 */
237 walk_state->method_desc->method.flags |= 237 walk_state->method_desc->method.info_flags |=
238 AOPOBJ_MODIFIED_NAMESPACE; 238 ACPI_METHOD_MODIFIED_NAMESPACE;
239 } 239 }
240 } 240 }
241 241
@@ -341,6 +341,7 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node)
341{ 341{
342 struct acpi_namespace_node *child_node = NULL; 342 struct acpi_namespace_node *child_node = NULL;
343 u32 level = 1; 343 u32 level = 1;
344 acpi_status status;
344 345
345 ACPI_FUNCTION_TRACE(ns_delete_namespace_subtree); 346 ACPI_FUNCTION_TRACE(ns_delete_namespace_subtree);
346 347
@@ -348,6 +349,13 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node)
348 return_VOID; 349 return_VOID;
349 } 350 }
350 351
352 /* Lock namespace for possible update */
353
354 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
355 if (ACPI_FAILURE(status)) {
356 return_VOID;
357 }
358
351 /* 359 /*
352 * Traverse the tree of objects until we bubble back up 360 * Traverse the tree of objects until we bubble back up
353 * to where we started. 361 * to where we started.
@@ -397,6 +405,7 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node)
397 } 405 }
398 } 406 }
399 407
408 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
400 return_VOID; 409 return_VOID;
401} 410}
402 411
diff --git a/drivers/acpi/acpica/nsdump.c b/drivers/acpi/acpica/nsdump.c
index a54dc39e304b..b683cc2ff9d3 100644
--- a/drivers/acpi/acpica/nsdump.c
+++ b/drivers/acpi/acpica/nsdump.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -624,9 +624,22 @@ acpi_ns_dump_objects(acpi_object_type type,
624 acpi_owner_id owner_id, acpi_handle start_handle) 624 acpi_owner_id owner_id, acpi_handle start_handle)
625{ 625{
626 struct acpi_walk_info info; 626 struct acpi_walk_info info;
627 acpi_status status;
627 628
628 ACPI_FUNCTION_ENTRY(); 629 ACPI_FUNCTION_ENTRY();
629 630
631 /*
632 * Just lock the entire namespace for the duration of the dump.
633 * We don't want any changes to the namespace during this time,
634 * especially the temporary nodes since we are going to display
635 * them also.
636 */
637 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
638 if (ACPI_FAILURE(status)) {
639 acpi_os_printf("Could not acquire namespace mutex\n");
640 return;
641 }
642
630 info.debug_level = ACPI_LV_TABLES; 643 info.debug_level = ACPI_LV_TABLES;
631 info.owner_id = owner_id; 644 info.owner_id = owner_id;
632 info.display_type = display_type; 645 info.display_type = display_type;
@@ -636,6 +649,8 @@ acpi_ns_dump_objects(acpi_object_type type,
636 ACPI_NS_WALK_TEMP_NODES, 649 ACPI_NS_WALK_TEMP_NODES,
637 acpi_ns_dump_one_object, NULL, 650 acpi_ns_dump_one_object, NULL,
638 (void *)&info, NULL); 651 (void *)&info, NULL);
652
653 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
639} 654}
640#endif /* ACPI_FUTURE_USAGE */ 655#endif /* ACPI_FUTURE_USAGE */
641 656
diff --git a/drivers/acpi/acpica/nsdumpdv.c b/drivers/acpi/acpica/nsdumpdv.c
index d2a97921e249..2ed294b7a4db 100644
--- a/drivers/acpi/acpica/nsdumpdv.c
+++ b/drivers/acpi/acpica/nsdumpdv.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nseval.c b/drivers/acpi/acpica/nseval.c
index f52829cc294b..c1bd02b1a058 100644
--- a/drivers/acpi/acpica/nseval.c
+++ b/drivers/acpi/acpica/nseval.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -389,7 +389,7 @@ acpi_ns_exec_module_code(union acpi_operand_object *method_obj,
389 * acpi_gbl_root_node->Object is NULL at PASS1. 389 * acpi_gbl_root_node->Object is NULL at PASS1.
390 */ 390 */
391 if ((type == ACPI_TYPE_DEVICE) && parent_node->object) { 391 if ((type == ACPI_TYPE_DEVICE) && parent_node->object) {
392 method_obj->method.extra.handler = 392 method_obj->method.dispatch.handler =
393 parent_node->object->device.handler; 393 parent_node->object->device.handler;
394 } 394 }
395 395
diff --git a/drivers/acpi/acpica/nsinit.c b/drivers/acpi/acpica/nsinit.c
index 0cac7ec0d2ec..fd7c6380e294 100644
--- a/drivers/acpi/acpica/nsinit.c
+++ b/drivers/acpi/acpica/nsinit.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsload.c b/drivers/acpi/acpica/nsload.c
index df18be94fefe..5f7dc691c183 100644
--- a/drivers/acpi/acpica/nsload.c
+++ b/drivers/acpi/acpica/nsload.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsnames.c b/drivers/acpi/acpica/nsnames.c
index d3104af57e13..d5fa520c3de5 100644
--- a/drivers/acpi/acpica/nsnames.c
+++ b/drivers/acpi/acpica/nsnames.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsobject.c b/drivers/acpi/acpica/nsobject.c
index 41a9213dd5af..3bb8bf105ea2 100644
--- a/drivers/acpi/acpica/nsobject.c
+++ b/drivers/acpi/acpica/nsobject.c
@@ -6,7 +6,7 @@
6 ******************************************************************************/ 6 ******************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsparse.c b/drivers/acpi/acpica/nsparse.c
index 5808c89e9fac..b3234fa795b8 100644
--- a/drivers/acpi/acpica/nsparse.c
+++ b/drivers/acpi/acpica/nsparse.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nspredef.c b/drivers/acpi/acpica/nspredef.c
index 7096bcda0c72..9fb03fa8ffde 100644
--- a/drivers/acpi/acpica/nspredef.c
+++ b/drivers/acpi/acpica/nspredef.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsrepair.c b/drivers/acpi/acpica/nsrepair.c
index d1c136692667..1d76ac85b5e7 100644
--- a/drivers/acpi/acpica/nsrepair.c
+++ b/drivers/acpi/acpica/nsrepair.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c
index 4ef9f43ea926..973883babee1 100644
--- a/drivers/acpi/acpica/nsrepair2.c
+++ b/drivers/acpi/acpica/nsrepair2.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nssearch.c b/drivers/acpi/acpica/nssearch.c
index 41102a84272f..28b0d7a62b99 100644
--- a/drivers/acpi/acpica/nssearch.c
+++ b/drivers/acpi/acpica/nssearch.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c
index a7d6ad9c111b..cb1b104a69a2 100644
--- a/drivers/acpi/acpica/nsutils.c
+++ b/drivers/acpi/acpica/nsutils.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nswalk.c b/drivers/acpi/acpica/nswalk.c
index 2cd5be8fe10f..345f0c3c6ad2 100644
--- a/drivers/acpi/acpica/nswalk.c
+++ b/drivers/acpi/acpica/nswalk.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c
index ebef8a7fd707..c53f0040e490 100644
--- a/drivers/acpi/acpica/nsxfeval.c
+++ b/drivers/acpi/acpica/nsxfeval.c
@@ -6,7 +6,7 @@
6 ******************************************************************************/ 6 ******************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/nsxfname.c b/drivers/acpi/acpica/nsxfname.c
index b01e45a415e3..3fd4526f3dba 100644
--- a/drivers/acpi/acpica/nsxfname.c
+++ b/drivers/acpi/acpica/nsxfname.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -603,10 +603,9 @@ acpi_status acpi_install_method(u8 *buffer)
603 method_obj->method.param_count = (u8) 603 method_obj->method.param_count = (u8)
604 (method_flags & AML_METHOD_ARG_COUNT); 604 (method_flags & AML_METHOD_ARG_COUNT);
605 605
606 method_obj->method.method_flags = (u8)
607 (method_flags & ~AML_METHOD_ARG_COUNT);
608
609 if (method_flags & AML_METHOD_SERIALIZED) { 606 if (method_flags & AML_METHOD_SERIALIZED) {
607 method_obj->method.info_flags = ACPI_METHOD_SERIALIZED;
608
610 method_obj->method.sync_level = (u8) 609 method_obj->method.sync_level = (u8)
611 ((method_flags & AML_METHOD_SYNC_LEVEL) >> 4); 610 ((method_flags & AML_METHOD_SYNC_LEVEL) >> 4);
612 } 611 }
diff --git a/drivers/acpi/acpica/nsxfobj.c b/drivers/acpi/acpica/nsxfobj.c
index a1f04e9b8030..db7660f8b869 100644
--- a/drivers/acpi/acpica/nsxfobj.c
+++ b/drivers/acpi/acpica/nsxfobj.c
@@ -6,7 +6,7 @@
6 ******************************************************************************/ 6 ******************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/psargs.c b/drivers/acpi/acpica/psargs.c
index 7df1a4c95274..e1fad0ee0136 100644
--- a/drivers/acpi/acpica/psargs.c
+++ b/drivers/acpi/acpica/psargs.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/psloop.c b/drivers/acpi/acpica/psloop.c
index 2f2e7760938c..01dd70d1de51 100644
--- a/drivers/acpi/acpica/psloop.c
+++ b/drivers/acpi/acpica/psloop.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -655,7 +655,7 @@ acpi_ps_link_module_code(union acpi_parse_object *parent_op,
655 method_obj->method.aml_start = aml_start; 655 method_obj->method.aml_start = aml_start;
656 method_obj->method.aml_length = aml_length; 656 method_obj->method.aml_length = aml_length;
657 method_obj->method.owner_id = owner_id; 657 method_obj->method.owner_id = owner_id;
658 method_obj->method.flags |= AOPOBJ_MODULE_LEVEL; 658 method_obj->method.info_flags |= ACPI_METHOD_MODULE_LEVEL;
659 659
660 /* 660 /*
661 * Save the parent node in next_object. This is cheating, but we 661 * Save the parent node in next_object. This is cheating, but we
diff --git a/drivers/acpi/acpica/psopcode.c b/drivers/acpi/acpica/psopcode.c
index 2b0c3be2b1b8..bed08de7528c 100644
--- a/drivers/acpi/acpica/psopcode.c
+++ b/drivers/acpi/acpica/psopcode.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/psparse.c b/drivers/acpi/acpica/psparse.c
index 8d81542194d4..9bb0cbd37b5e 100644
--- a/drivers/acpi/acpica/psparse.c
+++ b/drivers/acpi/acpica/psparse.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -55,7 +55,6 @@
55#include "acparser.h" 55#include "acparser.h"
56#include "acdispat.h" 56#include "acdispat.h"
57#include "amlcode.h" 57#include "amlcode.h"
58#include "acnamesp.h"
59#include "acinterp.h" 58#include "acinterp.h"
60 59
61#define _COMPONENT ACPI_PARSER 60#define _COMPONENT ACPI_PARSER
@@ -539,24 +538,16 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
539 /* Check for possible multi-thread reentrancy problem */ 538 /* Check for possible multi-thread reentrancy problem */
540 539
541 if ((status == AE_ALREADY_EXISTS) && 540 if ((status == AE_ALREADY_EXISTS) &&
542 (!walk_state->method_desc->method.mutex)) { 541 (!(walk_state->method_desc->method.
543 ACPI_INFO((AE_INFO, 542 info_flags & ACPI_METHOD_SERIALIZED))) {
544 "Marking method %4.4s as Serialized because of AE_ALREADY_EXISTS error",
545 walk_state->method_node->name.
546 ascii));
547
548 /* 543 /*
549 * Method tried to create an object twice. The probable cause is 544 * Method is not serialized and tried to create an object
550 * that the method cannot handle reentrancy. 545 * twice. The probable cause is that the method cannot
551 * 546 * handle reentrancy. Mark as "pending serialized" now, and
552 * The method is marked not_serialized, but it tried to create 547 * then mark "serialized" when the last thread exits.
553 * a named object, causing the second thread entrance to fail.
554 * Workaround this problem by marking the method permanently
555 * as Serialized.
556 */ 548 */
557 walk_state->method_desc->method.method_flags |= 549 walk_state->method_desc->method.info_flags |=
558 AML_METHOD_SERIALIZED; 550 ACPI_METHOD_SERIALIZED_PENDING;
559 walk_state->method_desc->method.sync_level = 0;
560 } 551 }
561 } 552 }
562 553
diff --git a/drivers/acpi/acpica/psscope.c b/drivers/acpi/acpica/psscope.c
index 40e2b279ea12..a5faa1323a02 100644
--- a/drivers/acpi/acpica/psscope.c
+++ b/drivers/acpi/acpica/psscope.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/pstree.c b/drivers/acpi/acpica/pstree.c
index d4b970c3630b..f1464c03aa42 100644
--- a/drivers/acpi/acpica/pstree.c
+++ b/drivers/acpi/acpica/pstree.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/psutils.c b/drivers/acpi/acpica/psutils.c
index fe29eee5adb1..7eda78503422 100644
--- a/drivers/acpi/acpica/psutils.c
+++ b/drivers/acpi/acpica/psutils.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/pswalk.c b/drivers/acpi/acpica/pswalk.c
index 8abb9629443d..3312d6368bf1 100644
--- a/drivers/acpi/acpica/pswalk.c
+++ b/drivers/acpi/acpica/pswalk.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/psxface.c b/drivers/acpi/acpica/psxface.c
index c42f067cff9d..8086805d4494 100644
--- a/drivers/acpi/acpica/psxface.c
+++ b/drivers/acpi/acpica/psxface.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -47,7 +47,6 @@
47#include "acdispat.h" 47#include "acdispat.h"
48#include "acinterp.h" 48#include "acinterp.h"
49#include "actables.h" 49#include "actables.h"
50#include "amlcode.h"
51 50
52#define _COMPONENT ACPI_PARSER 51#define _COMPONENT ACPI_PARSER
53ACPI_MODULE_NAME("psxface") 52ACPI_MODULE_NAME("psxface")
@@ -285,15 +284,15 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)
285 goto cleanup; 284 goto cleanup;
286 } 285 }
287 286
288 if (info->obj_desc->method.flags & AOPOBJ_MODULE_LEVEL) { 287 if (info->obj_desc->method.info_flags & ACPI_METHOD_MODULE_LEVEL) {
289 walk_state->parse_flags |= ACPI_PARSE_MODULE_LEVEL; 288 walk_state->parse_flags |= ACPI_PARSE_MODULE_LEVEL;
290 } 289 }
291 290
292 /* Invoke an internal method if necessary */ 291 /* Invoke an internal method if necessary */
293 292
294 if (info->obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { 293 if (info->obj_desc->method.info_flags & ACPI_METHOD_INTERNAL_ONLY) {
295 status = 294 status =
296 info->obj_desc->method.extra.implementation(walk_state); 295 info->obj_desc->method.dispatch.implementation(walk_state);
297 info->return_object = walk_state->return_desc; 296 info->return_object = walk_state->return_desc;
298 297
299 /* Cleanup states */ 298 /* Cleanup states */
diff --git a/drivers/acpi/acpica/rsaddr.c b/drivers/acpi/acpica/rsaddr.c
index 226c806ae986..9e66f9078426 100644
--- a/drivers/acpi/acpica/rsaddr.c
+++ b/drivers/acpi/acpica/rsaddr.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rscalc.c b/drivers/acpi/acpica/rscalc.c
index d6ebf7ec622d..3a8a89ec2ca4 100644
--- a/drivers/acpi/acpica/rscalc.c
+++ b/drivers/acpi/acpica/rscalc.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rscreate.c b/drivers/acpi/acpica/rscreate.c
index c80a2eea3a01..4ce6e1147e80 100644
--- a/drivers/acpi/acpica/rscreate.c
+++ b/drivers/acpi/acpica/rscreate.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rsdump.c b/drivers/acpi/acpica/rsdump.c
index f859b0386fe4..33db7520c74b 100644
--- a/drivers/acpi/acpica/rsdump.c
+++ b/drivers/acpi/acpica/rsdump.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rsinfo.c b/drivers/acpi/acpica/rsinfo.c
index 1fd868b964fd..f9ea60872aa4 100644
--- a/drivers/acpi/acpica/rsinfo.c
+++ b/drivers/acpi/acpica/rsinfo.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rsio.c b/drivers/acpi/acpica/rsio.c
index 33bff17c0bbc..0c7efef008be 100644
--- a/drivers/acpi/acpica/rsio.c
+++ b/drivers/acpi/acpica/rsio.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rsirq.c b/drivers/acpi/acpica/rsirq.c
index 545da40d7fa7..50b8ad211167 100644
--- a/drivers/acpi/acpica/rsirq.c
+++ b/drivers/acpi/acpica/rsirq.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rslist.c b/drivers/acpi/acpica/rslist.c
index 7335f22aac20..1bfcef736c50 100644
--- a/drivers/acpi/acpica/rslist.c
+++ b/drivers/acpi/acpica/rslist.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rsmemory.c b/drivers/acpi/acpica/rsmemory.c
index 887b8ba8c432..7cc6d8625f1e 100644
--- a/drivers/acpi/acpica/rsmemory.c
+++ b/drivers/acpi/acpica/rsmemory.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rsmisc.c b/drivers/acpi/acpica/rsmisc.c
index f8cd9e87d987..410264b22a29 100644
--- a/drivers/acpi/acpica/rsmisc.c
+++ b/drivers/acpi/acpica/rsmisc.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rsutils.c b/drivers/acpi/acpica/rsutils.c
index 491191e6cf69..231811e56939 100644
--- a/drivers/acpi/acpica/rsutils.c
+++ b/drivers/acpi/acpica/rsutils.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/rsxface.c b/drivers/acpi/acpica/rsxface.c
index 9f6a6e7e1c8e..2ff657a28f26 100644
--- a/drivers/acpi/acpica/rsxface.c
+++ b/drivers/acpi/acpica/rsxface.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c
index d2ff4325c427..428d44e2d162 100644
--- a/drivers/acpi/acpica/tbfadt.c
+++ b/drivers/acpi/acpica/tbfadt.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/tbfind.c b/drivers/acpi/acpica/tbfind.c
index 989d5c867864..a55cb2bb5abb 100644
--- a/drivers/acpi/acpica/tbfind.c
+++ b/drivers/acpi/acpica/tbfind.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c
index 83d7af8d0905..48db0944ce4a 100644
--- a/drivers/acpi/acpica/tbinstal.c
+++ b/drivers/acpi/acpica/tbinstal.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c
index 34f9c2bc5e1f..0f2d395feaba 100644
--- a/drivers/acpi/acpica/tbutils.c
+++ b/drivers/acpi/acpica/tbutils.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c
index 4a8b9e6ea57a..4b7085dfc683 100644
--- a/drivers/acpi/acpica/tbxface.c
+++ b/drivers/acpi/acpica/tbxface.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/tbxfroot.c b/drivers/acpi/acpica/tbxfroot.c
index fd2c07d1d3ac..7eb6c6cc1edf 100644
--- a/drivers/acpi/acpica/tbxfroot.c
+++ b/drivers/acpi/acpica/tbxfroot.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utalloc.c b/drivers/acpi/acpica/utalloc.c
index 8f0896281567..0a697351cf69 100644
--- a/drivers/acpi/acpica/utalloc.c
+++ b/drivers/acpi/acpica/utalloc.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utcopy.c b/drivers/acpi/acpica/utcopy.c
index 6fef83f04bcd..aded299a2fa8 100644
--- a/drivers/acpi/acpica/utcopy.c
+++ b/drivers/acpi/acpica/utcopy.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utdebug.c b/drivers/acpi/acpica/utdebug.c
index f21c486929a5..a9bcd816dc29 100644
--- a/drivers/acpi/acpica/utdebug.c
+++ b/drivers/acpi/acpica/utdebug.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c
index ed794cd033ea..31f5a7832ef1 100644
--- a/drivers/acpi/acpica/utdelete.c
+++ b/drivers/acpi/acpica/utdelete.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/uteval.c b/drivers/acpi/acpica/uteval.c
index 22f59ef604e0..18f73c9d10bc 100644
--- a/drivers/acpi/acpica/uteval.c
+++ b/drivers/acpi/acpica/uteval.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c
index 508537f884ac..97dd9bbf055a 100644
--- a/drivers/acpi/acpica/utglobal.c
+++ b/drivers/acpi/acpica/utglobal.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utids.c b/drivers/acpi/acpica/utids.c
index d2906328535d..b679ea693545 100644
--- a/drivers/acpi/acpica/utids.c
+++ b/drivers/acpi/acpica/utids.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utinit.c b/drivers/acpi/acpica/utinit.c
index c1b1c803ea9b..191b6828cce9 100644
--- a/drivers/acpi/acpica/utinit.c
+++ b/drivers/acpi/acpica/utinit.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utlock.c b/drivers/acpi/acpica/utlock.c
index b081cd46a15f..f6bb75c6faf5 100644
--- a/drivers/acpi/acpica/utlock.c
+++ b/drivers/acpi/acpica/utlock.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utmath.c b/drivers/acpi/acpica/utmath.c
index 49cf7b7fd816..ce481da9bb45 100644
--- a/drivers/acpi/acpica/utmath.c
+++ b/drivers/acpi/acpica/utmath.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utmisc.c b/drivers/acpi/acpica/utmisc.c
index c7d0e05ef5a4..c33a852d4f42 100644
--- a/drivers/acpi/acpica/utmisc.c
+++ b/drivers/acpi/acpica/utmisc.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utmutex.c b/drivers/acpi/acpica/utmutex.c
index 199528ff7f1d..a946c689f03b 100644
--- a/drivers/acpi/acpica/utmutex.c
+++ b/drivers/acpi/acpica/utmutex.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utobject.c b/drivers/acpi/acpica/utobject.c
index fd1fa2749ea5..188340a017b4 100644
--- a/drivers/acpi/acpica/utobject.c
+++ b/drivers/acpi/acpica/utobject.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utosi.c b/drivers/acpi/acpica/utosi.c
index 18c59a85fdca..1fb10cb8f11d 100644
--- a/drivers/acpi/acpica/utosi.c
+++ b/drivers/acpi/acpica/utosi.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utresrc.c b/drivers/acpi/acpica/utresrc.c
index 7965919000b1..84e051844247 100644
--- a/drivers/acpi/acpica/utresrc.c
+++ b/drivers/acpi/acpica/utresrc.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utstate.c b/drivers/acpi/acpica/utstate.c
index d35d109b8da2..30c21e1a9360 100644
--- a/drivers/acpi/acpica/utstate.c
+++ b/drivers/acpi/acpica/utstate.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c
index 1f484c9a6888..98ad125e14ff 100644
--- a/drivers/acpi/acpica/utxface.c
+++ b/drivers/acpi/acpica/utxface.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/acpica/utxferror.c b/drivers/acpi/acpica/utxferror.c
index 6f12e314fbae..916ae097c43c 100644
--- a/drivers/acpi/acpica/utxferror.c
+++ b/drivers/acpi/acpica/utxferror.c
@@ -5,7 +5,7 @@
5 ******************************************************************************/ 5 ******************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 68bc227e7c4c..ac1a599f5147 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -998,7 +998,6 @@ static int acpi_battery_resume(struct acpi_device *device)
998 if (!device) 998 if (!device)
999 return -EINVAL; 999 return -EINVAL;
1000 battery = acpi_driver_data(device); 1000 battery = acpi_driver_data(device);
1001 acpi_battery_refresh(battery);
1002 battery->update_time = 0; 1001 battery->update_time = 0;
1003 acpi_battery_update(battery); 1002 acpi_battery_update(battery);
1004 return 0; 1003 return 0;
diff --git a/drivers/acpi/nvs.c b/drivers/acpi/nvs.c
index 54b6ab8040a6..fa5a1df42b79 100644
--- a/drivers/acpi/nvs.c
+++ b/drivers/acpi/nvs.c
@@ -12,6 +12,7 @@
12#include <linux/mm.h> 12#include <linux/mm.h>
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/acpi.h> 14#include <linux/acpi.h>
15#include <linux/acpi_io.h>
15#include <acpi/acpiosxf.h> 16#include <acpi/acpiosxf.h>
16 17
17/* 18/*
@@ -80,7 +81,7 @@ void suspend_nvs_free(void)
80 free_page((unsigned long)entry->data); 81 free_page((unsigned long)entry->data);
81 entry->data = NULL; 82 entry->data = NULL;
82 if (entry->kaddr) { 83 if (entry->kaddr) {
83 acpi_os_unmap_memory(entry->kaddr, entry->size); 84 iounmap(entry->kaddr);
84 entry->kaddr = NULL; 85 entry->kaddr = NULL;
85 } 86 }
86 } 87 }
@@ -114,8 +115,8 @@ int suspend_nvs_save(void)
114 115
115 list_for_each_entry(entry, &nvs_list, node) 116 list_for_each_entry(entry, &nvs_list, node)
116 if (entry->data) { 117 if (entry->data) {
117 entry->kaddr = acpi_os_map_memory(entry->phys_start, 118 entry->kaddr = acpi_os_ioremap(entry->phys_start,
118 entry->size); 119 entry->size);
119 if (!entry->kaddr) { 120 if (!entry->kaddr) {
120 suspend_nvs_free(); 121 suspend_nvs_free();
121 return -ENOMEM; 122 return -ENOMEM;
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index e2dd6de5d50c..b0931818cf98 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -38,6 +38,7 @@
38#include <linux/workqueue.h> 38#include <linux/workqueue.h>
39#include <linux/nmi.h> 39#include <linux/nmi.h>
40#include <linux/acpi.h> 40#include <linux/acpi.h>
41#include <linux/acpi_io.h>
41#include <linux/efi.h> 42#include <linux/efi.h>
42#include <linux/ioport.h> 43#include <linux/ioport.h>
43#include <linux/list.h> 44#include <linux/list.h>
@@ -302,9 +303,10 @@ void __iomem *__init_refok
302acpi_os_map_memory(acpi_physical_address phys, acpi_size size) 303acpi_os_map_memory(acpi_physical_address phys, acpi_size size)
303{ 304{
304 struct acpi_ioremap *map, *tmp_map; 305 struct acpi_ioremap *map, *tmp_map;
305 unsigned long flags, pg_sz; 306 unsigned long flags;
306 void __iomem *virt; 307 void __iomem *virt;
307 phys_addr_t pg_off; 308 acpi_physical_address pg_off;
309 acpi_size pg_sz;
308 310
309 if (phys > ULONG_MAX) { 311 if (phys > ULONG_MAX) {
310 printk(KERN_ERR PREFIX "Cannot map memory that high\n"); 312 printk(KERN_ERR PREFIX "Cannot map memory that high\n");
@@ -320,7 +322,7 @@ acpi_os_map_memory(acpi_physical_address phys, acpi_size size)
320 322
321 pg_off = round_down(phys, PAGE_SIZE); 323 pg_off = round_down(phys, PAGE_SIZE);
322 pg_sz = round_up(phys + size, PAGE_SIZE) - pg_off; 324 pg_sz = round_up(phys + size, PAGE_SIZE) - pg_off;
323 virt = ioremap_cache(pg_off, pg_sz); 325 virt = acpi_os_ioremap(pg_off, pg_sz);
324 if (!virt) { 326 if (!virt) {
325 kfree(map); 327 kfree(map);
326 return NULL; 328 return NULL;
@@ -642,7 +644,7 @@ acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width)
642 virt_addr = acpi_map_vaddr_lookup(phys_addr, size); 644 virt_addr = acpi_map_vaddr_lookup(phys_addr, size);
643 rcu_read_unlock(); 645 rcu_read_unlock();
644 if (!virt_addr) { 646 if (!virt_addr) {
645 virt_addr = ioremap_cache(phys_addr, size); 647 virt_addr = acpi_os_ioremap(phys_addr, size);
646 unmap = 1; 648 unmap = 1;
647 } 649 }
648 if (!value) 650 if (!value)
@@ -678,7 +680,7 @@ acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width)
678 virt_addr = acpi_map_vaddr_lookup(phys_addr, size); 680 virt_addr = acpi_map_vaddr_lookup(phys_addr, size);
679 rcu_read_unlock(); 681 rcu_read_unlock();
680 if (!virt_addr) { 682 if (!virt_addr) {
681 virt_addr = ioremap_cache(phys_addr, size); 683 virt_addr = acpi_os_ioremap(phys_addr, size);
682 unmap = 1; 684 unmap = 1;
683 } 685 }
684 686
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index fdd3aeeb6def..d6a8cd14de2e 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -166,6 +166,7 @@ static void acpi_pm_finish(void)
166 u32 acpi_state = acpi_target_sleep_state; 166 u32 acpi_state = acpi_target_sleep_state;
167 167
168 acpi_ec_unblock_transactions(); 168 acpi_ec_unblock_transactions();
169 suspend_nvs_free();
169 170
170 if (acpi_state == ACPI_STATE_S0) 171 if (acpi_state == ACPI_STATE_S0)
171 return; 172 return;
@@ -186,7 +187,6 @@ static void acpi_pm_finish(void)
186 */ 187 */
187static void acpi_pm_end(void) 188static void acpi_pm_end(void)
188{ 189{
189 suspend_nvs_free();
190 /* 190 /*
191 * This is necessary in case acpi_pm_finish() is not called during a 191 * This is necessary in case acpi_pm_finish() is not called during a
192 * failing transition to a sleep state. 192 * failing transition to a sleep state.
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index c6b298d4c136..c2328aed0836 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -783,7 +783,7 @@ config PATA_PCMCIA
783 783
784config PATA_PLATFORM 784config PATA_PLATFORM
785 tristate "Generic platform device PATA support" 785 tristate "Generic platform device PATA support"
786 depends on EMBEDDED || PPC || HAVE_PATA_PLATFORM 786 depends on EXPERT || PPC || HAVE_PATA_PLATFORM
787 help 787 help
788 This option enables support for generic directly connected ATA 788 This option enables support for generic directly connected ATA
789 devices commonly found on embedded systems. 789 devices commonly found on embedded systems.
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
index fd96345bc35c..d57e8d0fb823 100644
--- a/drivers/base/Kconfig
+++ b/drivers/base/Kconfig
@@ -70,7 +70,7 @@ config PREVENT_FIRMWARE_BUILD
70 If unsure say Y here. 70 If unsure say Y here.
71 71
72config FW_LOADER 72config FW_LOADER
73 tristate "Userspace firmware loading support" if EMBEDDED 73 tristate "Userspace firmware loading support" if EXPERT
74 default y 74 default y
75 ---help--- 75 ---help---
76 This option is provided for the case where no in-kernel-tree modules 76 This option is provided for the case where no in-kernel-tree modules
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 0f175a866ef0..b7980a83ce2d 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -5,7 +5,7 @@
5menu "Character devices" 5menu "Character devices"
6 6
7config VT 7config VT
8 bool "Virtual terminal" if EMBEDDED 8 bool "Virtual terminal" if EXPERT
9 depends on !S390 9 depends on !S390
10 select INPUT 10 select INPUT
11 default y 11 default y
@@ -39,13 +39,13 @@ config VT
39config CONSOLE_TRANSLATIONS 39config CONSOLE_TRANSLATIONS
40 depends on VT 40 depends on VT
41 default y 41 default y
42 bool "Enable character translations in console" if EMBEDDED 42 bool "Enable character translations in console" if EXPERT
43 ---help--- 43 ---help---
44 This enables support for font mapping and Unicode translation 44 This enables support for font mapping and Unicode translation
45 on virtual consoles. 45 on virtual consoles.
46 46
47config VT_CONSOLE 47config VT_CONSOLE
48 bool "Support for console on virtual terminal" if EMBEDDED 48 bool "Support for console on virtual terminal" if EXPERT
49 depends on VT 49 depends on VT
50 default y 50 default y
51 ---help--- 51 ---help---
@@ -426,10 +426,10 @@ config SGI_MBCS
426 If you have an SGI Altix with an attached SABrick 426 If you have an SGI Altix with an attached SABrick
427 say Y or M here, otherwise say N. 427 say Y or M here, otherwise say N.
428 428
429source "drivers/serial/Kconfig" 429source "drivers/tty/serial/Kconfig"
430 430
431config UNIX98_PTYS 431config UNIX98_PTYS
432 bool "Unix98 PTY support" if EMBEDDED 432 bool "Unix98 PTY support" if EXPERT
433 default y 433 default y
434 ---help--- 434 ---help---
435 A pseudo terminal (PTY) is a software device consisting of two 435 A pseudo terminal (PTY) is a software device consisting of two
@@ -495,7 +495,7 @@ config LEGACY_PTY_COUNT
495 495
496config TTY_PRINTK 496config TTY_PRINTK
497 bool "TTY driver to output user messages via printk" 497 bool "TTY driver to output user messages via printk"
498 depends on EMBEDDED 498 depends on EXPERT
499 default n 499 default n
500 ---help--- 500 ---help---
501 If you say Y here, the support for writing user messages (i.e. 501 If you say Y here, the support for writing user messages (i.e.
diff --git a/drivers/char/Makefile b/drivers/char/Makefile
index 1e9dffb33778..5bc765d4c3ca 100644
--- a/drivers/char/Makefile
+++ b/drivers/char/Makefile
@@ -30,25 +30,12 @@ obj-$(CONFIG_SYNCLINK_GT) += synclink_gt.o
30obj-$(CONFIG_AMIGA_BUILTIN_SERIAL) += amiserial.o 30obj-$(CONFIG_AMIGA_BUILTIN_SERIAL) += amiserial.o
31obj-$(CONFIG_SX) += sx.o generic_serial.o 31obj-$(CONFIG_SX) += sx.o generic_serial.o
32obj-$(CONFIG_RIO) += rio/ generic_serial.o 32obj-$(CONFIG_RIO) += rio/ generic_serial.o
33obj-$(CONFIG_HVC_CONSOLE) += hvc_vio.o hvsi.o
34obj-$(CONFIG_HVC_ISERIES) += hvc_iseries.o
35obj-$(CONFIG_HVC_RTAS) += hvc_rtas.o
36obj-$(CONFIG_HVC_TILE) += hvc_tile.o
37obj-$(CONFIG_HVC_DCC) += hvc_dcc.o
38obj-$(CONFIG_HVC_BEAT) += hvc_beat.o
39obj-$(CONFIG_HVC_DRIVER) += hvc_console.o
40obj-$(CONFIG_HVC_IRQ) += hvc_irq.o
41obj-$(CONFIG_HVC_XEN) += hvc_xen.o
42obj-$(CONFIG_HVC_IUCV) += hvc_iucv.o
43obj-$(CONFIG_HVC_UDBG) += hvc_udbg.o
44obj-$(CONFIG_VIRTIO_CONSOLE) += virtio_console.o
45obj-$(CONFIG_RAW_DRIVER) += raw.o 33obj-$(CONFIG_RAW_DRIVER) += raw.o
46obj-$(CONFIG_SGI_SNSC) += snsc.o snsc_event.o 34obj-$(CONFIG_SGI_SNSC) += snsc.o snsc_event.o
47obj-$(CONFIG_MSPEC) += mspec.o 35obj-$(CONFIG_MSPEC) += mspec.o
48obj-$(CONFIG_MMTIMER) += mmtimer.o 36obj-$(CONFIG_MMTIMER) += mmtimer.o
49obj-$(CONFIG_UV_MMTIMER) += uv_mmtimer.o 37obj-$(CONFIG_UV_MMTIMER) += uv_mmtimer.o
50obj-$(CONFIG_VIOTAPE) += viotape.o 38obj-$(CONFIG_VIOTAPE) += viotape.o
51obj-$(CONFIG_HVCS) += hvcs.o
52obj-$(CONFIG_IBM_BSR) += bsr.o 39obj-$(CONFIG_IBM_BSR) += bsr.o
53obj-$(CONFIG_SGI_MBCS) += mbcs.o 40obj-$(CONFIG_SGI_MBCS) += mbcs.o
54obj-$(CONFIG_BRIQ_PANEL) += briq_panel.o 41obj-$(CONFIG_BRIQ_PANEL) += briq_panel.o
diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
index a8c8d9c19d74..ca8ee8093d6c 100644
--- a/drivers/cpufreq/Kconfig
+++ b/drivers/cpufreq/Kconfig
@@ -71,7 +71,7 @@ config CPU_FREQ_DEFAULT_GOV_PERFORMANCE
71 71
72config CPU_FREQ_DEFAULT_GOV_POWERSAVE 72config CPU_FREQ_DEFAULT_GOV_POWERSAVE
73 bool "powersave" 73 bool "powersave"
74 depends on EMBEDDED 74 depends on EXPERT
75 select CPU_FREQ_GOV_POWERSAVE 75 select CPU_FREQ_GOV_POWERSAVE
76 help 76 help
77 Use the CPUFreq governor 'powersave' as default. This sets 77 Use the CPUFreq governor 'powersave' as default. This sets
diff --git a/drivers/firewire/Kconfig b/drivers/firewire/Kconfig
index 68f942cb30f2..0c56989cd907 100644
--- a/drivers/firewire/Kconfig
+++ b/drivers/firewire/Kconfig
@@ -49,15 +49,13 @@ config FIREWIRE_SBP2
49 configuration section. 49 configuration section.
50 50
51config FIREWIRE_NET 51config FIREWIRE_NET
52 tristate "IP networking over 1394 (EXPERIMENTAL)" 52 tristate "IP networking over 1394"
53 depends on FIREWIRE && INET && EXPERIMENTAL 53 depends on FIREWIRE && INET
54 help 54 help
55 This enables IPv4 over IEEE 1394, providing IP connectivity with 55 This enables IPv4 over IEEE 1394, providing IP connectivity with
56 other implementations of RFC 2734 as found on several operating 56 other implementations of RFC 2734 as found on several operating
57 systems. Multicast support is currently limited. 57 systems. Multicast support is currently limited.
58 58
59 NOTE, this driver is not stable yet!
60
61 To compile this driver as a module, say M here: The module will be 59 To compile this driver as a module, say M here: The module will be
62 called firewire-net. 60 called firewire-net.
63 61
diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c
index be0492398ef9..24ff35511e2b 100644
--- a/drivers/firewire/core-card.c
+++ b/drivers/firewire/core-card.c
@@ -75,6 +75,8 @@ static size_t config_rom_length = 1 + 4 + 1 + 1;
75#define BIB_IRMC ((1) << 31) 75#define BIB_IRMC ((1) << 31)
76#define NODE_CAPABILITIES 0x0c0083c0 /* per IEEE 1394 clause 8.3.2.6.5.2 */ 76#define NODE_CAPABILITIES 0x0c0083c0 /* per IEEE 1394 clause 8.3.2.6.5.2 */
77 77
78#define CANON_OUI 0x000085
79
78static void generate_config_rom(struct fw_card *card, __be32 *config_rom) 80static void generate_config_rom(struct fw_card *card, __be32 *config_rom)
79{ 81{
80 struct fw_descriptor *desc; 82 struct fw_descriptor *desc;
@@ -284,6 +286,7 @@ static void bm_work(struct work_struct *work)
284 bool root_device_is_running; 286 bool root_device_is_running;
285 bool root_device_is_cmc; 287 bool root_device_is_cmc;
286 bool irm_is_1394_1995_only; 288 bool irm_is_1394_1995_only;
289 bool keep_this_irm;
287 290
288 spin_lock_irq(&card->lock); 291 spin_lock_irq(&card->lock);
289 292
@@ -305,6 +308,10 @@ static void bm_work(struct work_struct *work)
305 irm_is_1394_1995_only = irm_device && irm_device->config_rom && 308 irm_is_1394_1995_only = irm_device && irm_device->config_rom &&
306 (irm_device->config_rom[2] & 0x000000f0) == 0; 309 (irm_device->config_rom[2] & 0x000000f0) == 0;
307 310
311 /* Canon MV5i works unreliably if it is not root node. */
312 keep_this_irm = irm_device && irm_device->config_rom &&
313 irm_device->config_rom[3] >> 8 == CANON_OUI;
314
308 root_id = root_node->node_id; 315 root_id = root_node->node_id;
309 irm_id = card->irm_node->node_id; 316 irm_id = card->irm_node->node_id;
310 local_id = card->local_node->node_id; 317 local_id = card->local_node->node_id;
@@ -333,7 +340,7 @@ static void bm_work(struct work_struct *work)
333 goto pick_me; 340 goto pick_me;
334 } 341 }
335 342
336 if (irm_is_1394_1995_only) { 343 if (irm_is_1394_1995_only && !keep_this_irm) {
337 new_root_id = local_id; 344 new_root_id = local_id;
338 fw_notify("%s, making local node (%02x) root.\n", 345 fw_notify("%s, making local node (%02x) root.\n",
339 "IRM is not 1394a compliant", new_root_id); 346 "IRM is not 1394a compliant", new_root_id);
@@ -382,7 +389,7 @@ static void bm_work(struct work_struct *work)
382 389
383 spin_lock_irq(&card->lock); 390 spin_lock_irq(&card->lock);
384 391
385 if (rcode != RCODE_COMPLETE) { 392 if (rcode != RCODE_COMPLETE && !keep_this_irm) {
386 /* 393 /*
387 * The lock request failed, maybe the IRM 394 * The lock request failed, maybe the IRM
388 * isn't really IRM capable after all. Let's 395 * isn't really IRM capable after all. Let's
diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c
index c2e194c58667..7ed08fd1214e 100644
--- a/drivers/firewire/net.c
+++ b/drivers/firewire/net.c
@@ -191,6 +191,7 @@ struct fwnet_peer {
191 struct fwnet_device *dev; 191 struct fwnet_device *dev;
192 u64 guid; 192 u64 guid;
193 u64 fifo; 193 u64 fifo;
194 __be32 ip;
194 195
195 /* guarded by dev->lock */ 196 /* guarded by dev->lock */
196 struct list_head pd_list; /* received partial datagrams */ 197 struct list_head pd_list; /* received partial datagrams */
@@ -570,6 +571,8 @@ static int fwnet_finish_incoming_packet(struct net_device *net,
570 peer->speed = sspd; 571 peer->speed = sspd;
571 if (peer->max_payload > max_payload) 572 if (peer->max_payload > max_payload)
572 peer->max_payload = max_payload; 573 peer->max_payload = max_payload;
574
575 peer->ip = arp1394->sip;
573 } 576 }
574 spin_unlock_irqrestore(&dev->lock, flags); 577 spin_unlock_irqrestore(&dev->lock, flags);
575 578
@@ -1470,6 +1473,7 @@ static int fwnet_add_peer(struct fwnet_device *dev,
1470 peer->dev = dev; 1473 peer->dev = dev;
1471 peer->guid = (u64)device->config_rom[3] << 32 | device->config_rom[4]; 1474 peer->guid = (u64)device->config_rom[3] << 32 | device->config_rom[4];
1472 peer->fifo = FWNET_NO_FIFO_ADDR; 1475 peer->fifo = FWNET_NO_FIFO_ADDR;
1476 peer->ip = 0;
1473 INIT_LIST_HEAD(&peer->pd_list); 1477 INIT_LIST_HEAD(&peer->pd_list);
1474 peer->pdg_size = 0; 1478 peer->pdg_size = 0;
1475 peer->datagram_label = 0; 1479 peer->datagram_label = 0;
@@ -1589,10 +1593,13 @@ static int fwnet_remove(struct device *_dev)
1589 1593
1590 mutex_lock(&fwnet_device_mutex); 1594 mutex_lock(&fwnet_device_mutex);
1591 1595
1596 net = dev->netdev;
1597 if (net && peer->ip)
1598 arp_invalidate(net, peer->ip);
1599
1592 fwnet_remove_peer(peer, dev); 1600 fwnet_remove_peer(peer, dev);
1593 1601
1594 if (list_empty(&dev->peer_list)) { 1602 if (list_empty(&dev->peer_list)) {
1595 net = dev->netdev;
1596 unregister_netdev(net); 1603 unregister_netdev(net);
1597 1604
1598 if (dev->local_fifo != FWNET_NO_FIFO_ADDR) 1605 if (dev->local_fifo != FWNET_NO_FIFO_ADDR)
diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index e8b6a13515bd..e710424b59ea 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -27,7 +27,7 @@ config EDD_OFF
27 using the kernel parameter 'edd={on|skipmbr|off}'. 27 using the kernel parameter 'edd={on|skipmbr|off}'.
28 28
29config FIRMWARE_MEMMAP 29config FIRMWARE_MEMMAP
30 bool "Add firmware-provided memory map to sysfs" if EMBEDDED 30 bool "Add firmware-provided memory map to sysfs" if EXPERT
31 default X86 31 default X86
32 help 32 help
33 Add the firmware-provided (unmodified) memory map to /sys/firmware/memmap. 33 Add the firmware-provided (unmodified) memory map to /sys/firmware/memmap.
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 64828a7db77b..bea966f8ac84 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -23,7 +23,7 @@ config DRM_KMS_HELPER
23 tristate 23 tristate
24 depends on DRM 24 depends on DRM
25 select FB 25 select FB
26 select FRAMEBUFFER_CONSOLE if !EMBEDDED 26 select FRAMEBUFFER_CONSOLE if !EXPERT
27 help 27 help
28 FB and CRTC helpers for KMS drivers. 28 FB and CRTC helpers for KMS drivers.
29 29
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 5c4f9b9ecdc0..6977a1ce9d98 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1533,11 +1533,11 @@ bool drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper)
1533} 1533}
1534EXPORT_SYMBOL(drm_fb_helper_hotplug_event); 1534EXPORT_SYMBOL(drm_fb_helper_hotplug_event);
1535 1535
1536/* The Kconfig DRM_KMS_HELPER selects FRAMEBUFFER_CONSOLE (if !EMBEDDED) 1536/* The Kconfig DRM_KMS_HELPER selects FRAMEBUFFER_CONSOLE (if !EXPERT)
1537 * but the module doesn't depend on any fb console symbols. At least 1537 * but the module doesn't depend on any fb console symbols. At least
1538 * attempt to load fbcon to avoid leaving the system without a usable console. 1538 * attempt to load fbcon to avoid leaving the system without a usable console.
1539 */ 1539 */
1540#if defined(CONFIG_FRAMEBUFFER_CONSOLE_MODULE) && !defined(CONFIG_EMBEDDED) 1540#if defined(CONFIG_FRAMEBUFFER_CONSOLE_MODULE) && !defined(CONFIG_EXPERT)
1541static int __init drm_fb_helper_modinit(void) 1541static int __init drm_fb_helper_modinit(void)
1542{ 1542{
1543 const char *name = "fbcon"; 1543 const char *name = "fbcon";
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 03e337072517..f6b9baa6a63d 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -928,6 +928,7 @@ static int intel_wrap_ring_buffer(struct intel_ring_buffer *ring)
928 928
929int intel_wait_ring_buffer(struct intel_ring_buffer *ring, int n) 929int intel_wait_ring_buffer(struct intel_ring_buffer *ring, int n)
930{ 930{
931 int reread = 0;
931 struct drm_device *dev = ring->dev; 932 struct drm_device *dev = ring->dev;
932 struct drm_i915_private *dev_priv = dev->dev_private; 933 struct drm_i915_private *dev_priv = dev->dev_private;
933 unsigned long end; 934 unsigned long end;
@@ -940,9 +941,8 @@ int intel_wait_ring_buffer(struct intel_ring_buffer *ring, int n)
940 * fallback to the slow and accurate path. 941 * fallback to the slow and accurate path.
941 */ 942 */
942 head = intel_read_status_page(ring, 4); 943 head = intel_read_status_page(ring, 4);
943 if (head < ring->actual_head) 944 if (reread)
944 head = I915_READ_HEAD(ring); 945 head = I915_READ_HEAD(ring);
945 ring->actual_head = head;
946 ring->head = head & HEAD_ADDR; 946 ring->head = head & HEAD_ADDR;
947 ring->space = ring->head - (ring->tail + 8); 947 ring->space = ring->head - (ring->tail + 8);
948 if (ring->space < 0) 948 if (ring->space < 0)
@@ -961,6 +961,7 @@ int intel_wait_ring_buffer(struct intel_ring_buffer *ring, int n)
961 msleep(1); 961 msleep(1);
962 if (atomic_read(&dev_priv->mm.wedged)) 962 if (atomic_read(&dev_priv->mm.wedged))
963 return -EAGAIN; 963 return -EAGAIN;
964 reread = 1;
964 } while (!time_after(jiffies, end)); 965 } while (!time_after(jiffies, end));
965 trace_i915_ring_wait_end (dev); 966 trace_i915_ring_wait_end (dev);
966 return -EBUSY; 967 return -EBUSY;
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
index be9087e4c9be..5b0abfa881fc 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.h
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
@@ -47,7 +47,6 @@ struct intel_ring_buffer {
47 struct drm_device *dev; 47 struct drm_device *dev;
48 struct drm_i915_gem_object *obj; 48 struct drm_i915_gem_object *obj;
49 49
50 u32 actual_head;
51 u32 head; 50 u32 head;
52 u32 tail; 51 u32 tail;
53 int space; 52 int space;
diff --git a/drivers/gpu/drm/nouveau/Kconfig b/drivers/gpu/drm/nouveau/Kconfig
index 21d6c29c2d21..de70959b9ed5 100644
--- a/drivers/gpu/drm/nouveau/Kconfig
+++ b/drivers/gpu/drm/nouveau/Kconfig
@@ -8,7 +8,7 @@ config DRM_NOUVEAU
8 select FB_CFB_COPYAREA 8 select FB_CFB_COPYAREA
9 select FB_CFB_IMAGEBLIT 9 select FB_CFB_IMAGEBLIT
10 select FB 10 select FB
11 select FRAMEBUFFER_CONSOLE if !EMBEDDED 11 select FRAMEBUFFER_CONSOLE if !EXPERT
12 select FB_BACKLIGHT if DRM_NOUVEAU_BACKLIGHT 12 select FB_BACKLIGHT if DRM_NOUVEAU_BACKLIGHT
13 select ACPI_VIDEO if ACPI && X86 && BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL && INPUT 13 select ACPI_VIDEO if ACPI && X86 && BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL && INPUT
14 help 14 help
diff --git a/drivers/gpu/vga/Kconfig b/drivers/gpu/vga/Kconfig
index 8d0e31a22027..96c83a9a76bb 100644
--- a/drivers/gpu/vga/Kconfig
+++ b/drivers/gpu/vga/Kconfig
@@ -1,5 +1,5 @@
1config VGA_ARB 1config VGA_ARB
2 bool "VGA Arbitration" if EMBEDDED 2 bool "VGA Arbitration" if EXPERT
3 default y 3 default y
4 depends on PCI 4 depends on PCI
5 help 5 help
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 24cca2f69dfc..2560f01c1a63 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -62,9 +62,9 @@ config HID_3M_PCT
62 Support for 3M PCT touch screens. 62 Support for 3M PCT touch screens.
63 63
64config HID_A4TECH 64config HID_A4TECH
65 tristate "A4 tech mice" if EMBEDDED 65 tristate "A4 tech mice" if EXPERT
66 depends on USB_HID 66 depends on USB_HID
67 default !EMBEDDED 67 default !EXPERT
68 ---help--- 68 ---help---
69 Support for A4 tech X5 and WOP-35 / Trust 450L mice. 69 Support for A4 tech X5 and WOP-35 / Trust 450L mice.
70 70
@@ -77,9 +77,9 @@ config HID_ACRUX_FF
77 game controllers. 77 game controllers.
78 78
79config HID_APPLE 79config HID_APPLE
80 tristate "Apple {i,Power,Mac}Books" if EMBEDDED 80 tristate "Apple {i,Power,Mac}Books" if EXPERT
81 depends on (USB_HID || BT_HIDP) 81 depends on (USB_HID || BT_HIDP)
82 default !EMBEDDED 82 default !EXPERT
83 ---help--- 83 ---help---
84 Support for some Apple devices which less or more break 84 Support for some Apple devices which less or more break
85 HID specification. 85 HID specification.
@@ -88,9 +88,9 @@ config HID_APPLE
88 MacBooks, MacBook Pros and Apple Aluminum. 88 MacBooks, MacBook Pros and Apple Aluminum.
89 89
90config HID_BELKIN 90config HID_BELKIN
91 tristate "Belkin Flip KVM and Wireless keyboard" if EMBEDDED 91 tristate "Belkin Flip KVM and Wireless keyboard" if EXPERT
92 depends on USB_HID 92 depends on USB_HID
93 default !EMBEDDED 93 default !EXPERT
94 ---help--- 94 ---help---
95 Support for Belkin Flip KVM and Wireless keyboard. 95 Support for Belkin Flip KVM and Wireless keyboard.
96 96
@@ -101,16 +101,16 @@ config HID_CANDO
101 Support for Cando dual touch panel. 101 Support for Cando dual touch panel.
102 102
103config HID_CHERRY 103config HID_CHERRY
104 tristate "Cherry Cymotion keyboard" if EMBEDDED 104 tristate "Cherry Cymotion keyboard" if EXPERT
105 depends on USB_HID 105 depends on USB_HID
106 default !EMBEDDED 106 default !EXPERT
107 ---help--- 107 ---help---
108 Support for Cherry Cymotion keyboard. 108 Support for Cherry Cymotion keyboard.
109 109
110config HID_CHICONY 110config HID_CHICONY
111 tristate "Chicony Tactical pad" if EMBEDDED 111 tristate "Chicony Tactical pad" if EXPERT
112 depends on USB_HID 112 depends on USB_HID
113 default !EMBEDDED 113 default !EXPERT
114 ---help--- 114 ---help---
115 Support for Chicony Tactical pad. 115 Support for Chicony Tactical pad.
116 116
@@ -130,9 +130,9 @@ config HID_PRODIKEYS
130 and some additional multimedia keys. 130 and some additional multimedia keys.
131 131
132config HID_CYPRESS 132config HID_CYPRESS
133 tristate "Cypress mouse and barcode readers" if EMBEDDED 133 tristate "Cypress mouse and barcode readers" if EXPERT
134 depends on USB_HID 134 depends on USB_HID
135 default !EMBEDDED 135 default !EXPERT
136 ---help--- 136 ---help---
137 Support for cypress mouse and barcode readers. 137 Support for cypress mouse and barcode readers.
138 138
@@ -174,16 +174,16 @@ config HID_ELECOM
174 Support for the ELECOM BM084 (bluetooth mouse). 174 Support for the ELECOM BM084 (bluetooth mouse).
175 175
176config HID_EZKEY 176config HID_EZKEY
177 tristate "Ezkey BTC 8193 keyboard" if EMBEDDED 177 tristate "Ezkey BTC 8193 keyboard" if EXPERT
178 depends on USB_HID 178 depends on USB_HID
179 default !EMBEDDED 179 default !EXPERT
180 ---help--- 180 ---help---
181 Support for Ezkey BTC 8193 keyboard. 181 Support for Ezkey BTC 8193 keyboard.
182 182
183config HID_KYE 183config HID_KYE
184 tristate "Kye/Genius Ergo Mouse" if EMBEDDED 184 tristate "Kye/Genius Ergo Mouse" if EXPERT
185 depends on USB_HID 185 depends on USB_HID
186 default !EMBEDDED 186 default !EXPERT
187 ---help--- 187 ---help---
188 Support for Kye/Genius Ergo Mouse. 188 Support for Kye/Genius Ergo Mouse.
189 189
@@ -212,16 +212,16 @@ config HID_TWINHAN
212 Support for Twinhan IR remote control. 212 Support for Twinhan IR remote control.
213 213
214config HID_KENSINGTON 214config HID_KENSINGTON
215 tristate "Kensington Slimblade Trackball" if EMBEDDED 215 tristate "Kensington Slimblade Trackball" if EXPERT
216 depends on USB_HID 216 depends on USB_HID
217 default !EMBEDDED 217 default !EXPERT
218 ---help--- 218 ---help---
219 Support for Kensington Slimblade Trackball. 219 Support for Kensington Slimblade Trackball.
220 220
221config HID_LOGITECH 221config HID_LOGITECH
222 tristate "Logitech devices" if EMBEDDED 222 tristate "Logitech devices" if EXPERT
223 depends on USB_HID 223 depends on USB_HID
224 default !EMBEDDED 224 default !EXPERT
225 ---help--- 225 ---help---
226 Support for Logitech devices that are not fully compliant with HID standard. 226 Support for Logitech devices that are not fully compliant with HID standard.
227 227
@@ -276,9 +276,9 @@ config HID_MAGICMOUSE
276 Apple Wireless "Magic" Mouse. 276 Apple Wireless "Magic" Mouse.
277 277
278config HID_MICROSOFT 278config HID_MICROSOFT
279 tristate "Microsoft non-fully HID-compliant devices" if EMBEDDED 279 tristate "Microsoft non-fully HID-compliant devices" if EXPERT
280 depends on USB_HID 280 depends on USB_HID
281 default !EMBEDDED 281 default !EXPERT
282 ---help--- 282 ---help---
283 Support for Microsoft devices that are not fully compliant with HID standard. 283 Support for Microsoft devices that are not fully compliant with HID standard.
284 284
@@ -289,9 +289,9 @@ config HID_MOSART
289 Support for MosArt dual-touch panels. 289 Support for MosArt dual-touch panels.
290 290
291config HID_MONTEREY 291config HID_MONTEREY
292 tristate "Monterey Genius KB29E keyboard" if EMBEDDED 292 tristate "Monterey Genius KB29E keyboard" if EXPERT
293 depends on USB_HID 293 depends on USB_HID
294 default !EMBEDDED 294 default !EXPERT
295 ---help--- 295 ---help---
296 Support for Monterey Genius KB29E. 296 Support for Monterey Genius KB29E.
297 297
@@ -365,8 +365,8 @@ config HID_PICOLCD
365 - IR 365 - IR
366 366
367config HID_PICOLCD_FB 367config HID_PICOLCD_FB
368 bool "Framebuffer support" if EMBEDDED 368 bool "Framebuffer support" if EXPERT
369 default !EMBEDDED 369 default !EXPERT
370 depends on HID_PICOLCD 370 depends on HID_PICOLCD
371 depends on HID_PICOLCD=FB || FB=y 371 depends on HID_PICOLCD=FB || FB=y
372 select FB_DEFERRED_IO 372 select FB_DEFERRED_IO
@@ -379,8 +379,8 @@ config HID_PICOLCD_FB
379 frambuffer device. 379 frambuffer device.
380 380
381config HID_PICOLCD_BACKLIGHT 381config HID_PICOLCD_BACKLIGHT
382 bool "Backlight control" if EMBEDDED 382 bool "Backlight control" if EXPERT
383 default !EMBEDDED 383 default !EXPERT
384 depends on HID_PICOLCD 384 depends on HID_PICOLCD
385 depends on HID_PICOLCD=BACKLIGHT_CLASS_DEVICE || BACKLIGHT_CLASS_DEVICE=y 385 depends on HID_PICOLCD=BACKLIGHT_CLASS_DEVICE || BACKLIGHT_CLASS_DEVICE=y
386 ---help--- 386 ---help---
@@ -388,16 +388,16 @@ config HID_PICOLCD_BACKLIGHT
388 class. 388 class.
389 389
390config HID_PICOLCD_LCD 390config HID_PICOLCD_LCD
391 bool "Contrast control" if EMBEDDED 391 bool "Contrast control" if EXPERT
392 default !EMBEDDED 392 default !EXPERT
393 depends on HID_PICOLCD 393 depends on HID_PICOLCD
394 depends on HID_PICOLCD=LCD_CLASS_DEVICE || LCD_CLASS_DEVICE=y 394 depends on HID_PICOLCD=LCD_CLASS_DEVICE || LCD_CLASS_DEVICE=y
395 ---help--- 395 ---help---
396 Provide access to PicoLCD's LCD contrast via lcd class. 396 Provide access to PicoLCD's LCD contrast via lcd class.
397 397
398config HID_PICOLCD_LEDS 398config HID_PICOLCD_LEDS
399 bool "GPO via leds class" if EMBEDDED 399 bool "GPO via leds class" if EXPERT
400 default !EMBEDDED 400 default !EXPERT
401 depends on HID_PICOLCD 401 depends on HID_PICOLCD
402 depends on HID_PICOLCD=LEDS_CLASS || LEDS_CLASS=y 402 depends on HID_PICOLCD=LEDS_CLASS || LEDS_CLASS=y
403 ---help--- 403 ---help---
diff --git a/drivers/hid/usbhid/Kconfig b/drivers/hid/usbhid/Kconfig
index 4edb3bef94a6..0f20fd17cf06 100644
--- a/drivers/hid/usbhid/Kconfig
+++ b/drivers/hid/usbhid/Kconfig
@@ -45,7 +45,7 @@ config USB_HIDDEV
45 If unsure, say Y. 45 If unsure, say Y.
46 46
47menu "USB HID Boot Protocol drivers" 47menu "USB HID Boot Protocol drivers"
48 depends on USB!=n && USB_HID!=y && EMBEDDED 48 depends on USB!=n && USB_HID!=y && EXPERT
49 49
50config USB_KBD 50config USB_KBD
51 tristate "USB HIDBP Keyboard (simple Boot) support" 51 tristate "USB HIDBP Keyboard (simple Boot) support"
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index 98ccfeb3f5aa..9827c5e686cb 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -134,7 +134,7 @@ config BLK_DEV_IDECD
134 module will be called ide-cd. 134 module will be called ide-cd.
135 135
136config BLK_DEV_IDECD_VERBOSE_ERRORS 136config BLK_DEV_IDECD_VERBOSE_ERRORS
137 bool "Verbose error logging for IDE/ATAPI CDROM driver" if EMBEDDED 137 bool "Verbose error logging for IDE/ATAPI CDROM driver" if EXPERT
138 depends on BLK_DEV_IDECD 138 depends on BLK_DEV_IDECD
139 default y 139 default y
140 help 140 help
diff --git a/drivers/infiniband/hw/mthca/Kconfig b/drivers/infiniband/hw/mthca/Kconfig
index 03efc074967e..da314c3fec23 100644
--- a/drivers/infiniband/hw/mthca/Kconfig
+++ b/drivers/infiniband/hw/mthca/Kconfig
@@ -7,7 +7,7 @@ config INFINIBAND_MTHCA
7 ("Tavor") and the MT25208 PCI Express HCA ("Arbel"). 7 ("Tavor") and the MT25208 PCI Express HCA ("Arbel").
8 8
9config INFINIBAND_MTHCA_DEBUG 9config INFINIBAND_MTHCA_DEBUG
10 bool "Verbose debugging output" if EMBEDDED 10 bool "Verbose debugging output" if EXPERT
11 depends on INFINIBAND_MTHCA 11 depends on INFINIBAND_MTHCA
12 default y 12 default y
13 ---help--- 13 ---help---
diff --git a/drivers/infiniband/ulp/ipoib/Kconfig b/drivers/infiniband/ulp/ipoib/Kconfig
index 55855eeabae7..cda8eac55fff 100644
--- a/drivers/infiniband/ulp/ipoib/Kconfig
+++ b/drivers/infiniband/ulp/ipoib/Kconfig
@@ -24,7 +24,7 @@ config INFINIBAND_IPOIB_CM
24 unless you limit mtu for these destinations to 2044. 24 unless you limit mtu for these destinations to 2044.
25 25
26config INFINIBAND_IPOIB_DEBUG 26config INFINIBAND_IPOIB_DEBUG
27 bool "IP-over-InfiniBand debugging" if EMBEDDED 27 bool "IP-over-InfiniBand debugging" if EXPERT
28 depends on INFINIBAND_IPOIB 28 depends on INFINIBAND_IPOIB
29 default y 29 default y
30 ---help--- 30 ---help---
diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig
index 07c2cd43109c..1903c0f5b925 100644
--- a/drivers/input/Kconfig
+++ b/drivers/input/Kconfig
@@ -6,7 +6,7 @@ menu "Input device support"
6 depends on !S390 6 depends on !S390
7 7
8config INPUT 8config INPUT
9 tristate "Generic input layer (needed for keyboard, mouse, ...)" if EMBEDDED 9 tristate "Generic input layer (needed for keyboard, mouse, ...)" if EXPERT
10 default y 10 default y
11 help 11 help
12 Say Y here if you have any input device (mouse, keyboard, tablet, 12 Say Y here if you have any input device (mouse, keyboard, tablet,
@@ -67,7 +67,7 @@ config INPUT_SPARSEKMAP
67comment "Userland interfaces" 67comment "Userland interfaces"
68 68
69config INPUT_MOUSEDEV 69config INPUT_MOUSEDEV
70 tristate "Mouse interface" if EMBEDDED 70 tristate "Mouse interface" if EXPERT
71 default y 71 default y
72 help 72 help
73 Say Y here if you want your mouse to be accessible as char devices 73 Say Y here if you want your mouse to be accessible as char devices
@@ -150,7 +150,7 @@ config INPUT_EVBUG
150 module will be called evbug. 150 module will be called evbug.
151 151
152config INPUT_APMPOWER 152config INPUT_APMPOWER
153 tristate "Input Power Event -> APM Bridge" if EMBEDDED 153 tristate "Input Power Event -> APM Bridge" if EXPERT
154 depends on INPUT && APM_EMULATION 154 depends on INPUT && APM_EMULATION
155 help 155 help
156 Say Y here if you want suspend key events to trigger a user 156 Say Y here if you want suspend key events to trigger a user
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 7b3c0b8fa432..417507348bab 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -2,7 +2,7 @@
2# Input core configuration 2# Input core configuration
3# 3#
4menuconfig INPUT_KEYBOARD 4menuconfig INPUT_KEYBOARD
5 bool "Keyboards" if EMBEDDED || !X86 5 bool "Keyboards" if EXPERT || !X86
6 default y 6 default y
7 help 7 help
8 Say Y here, and a list of supported keyboards will be displayed. 8 Say Y here, and a list of supported keyboards will be displayed.
@@ -57,7 +57,7 @@ config KEYBOARD_ATARI
57 module will be called atakbd. 57 module will be called atakbd.
58 58
59config KEYBOARD_ATKBD 59config KEYBOARD_ATKBD
60 tristate "AT keyboard" if EMBEDDED || !X86 60 tristate "AT keyboard" if EXPERT || !X86
61 default y 61 default y
62 select SERIO 62 select SERIO
63 select SERIO_LIBPS2 63 select SERIO_LIBPS2
diff --git a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig
index bf5fd7f6a313..9c1e6ee83531 100644
--- a/drivers/input/mouse/Kconfig
+++ b/drivers/input/mouse/Kconfig
@@ -39,7 +39,7 @@ config MOUSE_PS2
39 module will be called psmouse. 39 module will be called psmouse.
40 40
41config MOUSE_PS2_ALPS 41config MOUSE_PS2_ALPS
42 bool "ALPS PS/2 mouse protocol extension" if EMBEDDED 42 bool "ALPS PS/2 mouse protocol extension" if EXPERT
43 default y 43 default y
44 depends on MOUSE_PS2 44 depends on MOUSE_PS2
45 help 45 help
@@ -49,7 +49,7 @@ config MOUSE_PS2_ALPS
49 If unsure, say Y. 49 If unsure, say Y.
50 50
51config MOUSE_PS2_LOGIPS2PP 51config MOUSE_PS2_LOGIPS2PP
52 bool "Logitech PS/2++ mouse protocol extension" if EMBEDDED 52 bool "Logitech PS/2++ mouse protocol extension" if EXPERT
53 default y 53 default y
54 depends on MOUSE_PS2 54 depends on MOUSE_PS2
55 help 55 help
@@ -59,7 +59,7 @@ config MOUSE_PS2_LOGIPS2PP
59 If unsure, say Y. 59 If unsure, say Y.
60 60
61config MOUSE_PS2_SYNAPTICS 61config MOUSE_PS2_SYNAPTICS
62 bool "Synaptics PS/2 mouse protocol extension" if EMBEDDED 62 bool "Synaptics PS/2 mouse protocol extension" if EXPERT
63 default y 63 default y
64 depends on MOUSE_PS2 64 depends on MOUSE_PS2
65 help 65 help
@@ -69,7 +69,7 @@ config MOUSE_PS2_SYNAPTICS
69 If unsure, say Y. 69 If unsure, say Y.
70 70
71config MOUSE_PS2_LIFEBOOK 71config MOUSE_PS2_LIFEBOOK
72 bool "Fujitsu Lifebook PS/2 mouse protocol extension" if EMBEDDED 72 bool "Fujitsu Lifebook PS/2 mouse protocol extension" if EXPERT
73 default y 73 default y
74 depends on MOUSE_PS2 && X86 && DMI 74 depends on MOUSE_PS2 && X86 && DMI
75 help 75 help
@@ -79,7 +79,7 @@ config MOUSE_PS2_LIFEBOOK
79 If unsure, say Y. 79 If unsure, say Y.
80 80
81config MOUSE_PS2_TRACKPOINT 81config MOUSE_PS2_TRACKPOINT
82 bool "IBM Trackpoint PS/2 mouse protocol extension" if EMBEDDED 82 bool "IBM Trackpoint PS/2 mouse protocol extension" if EXPERT
83 default y 83 default y
84 depends on MOUSE_PS2 84 depends on MOUSE_PS2
85 help 85 help
diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig
index 307eef77a172..55f2c2293ec6 100644
--- a/drivers/input/serio/Kconfig
+++ b/drivers/input/serio/Kconfig
@@ -2,7 +2,7 @@
2# Input core configuration 2# Input core configuration
3# 3#
4config SERIO 4config SERIO
5 tristate "Serial I/O support" if EMBEDDED || !X86 5 tristate "Serial I/O support" if EXPERT || !X86
6 default y 6 default y
7 help 7 help
8 Say Yes here if you have any input device that uses serial I/O to 8 Say Yes here if you have any input device that uses serial I/O to
@@ -19,7 +19,7 @@ config SERIO
19if SERIO 19if SERIO
20 20
21config SERIO_I8042 21config SERIO_I8042
22 tristate "i8042 PC Keyboard controller" if EMBEDDED || !X86 22 tristate "i8042 PC Keyboard controller" if EXPERT || !X86
23 default y 23 default y
24 depends on !PARISC && (!ARM || ARCH_SHARK || FOOTBRIDGE_HOST) && \ 24 depends on !PARISC && (!ARM || ARCH_SHARK || FOOTBRIDGE_HOST) && \
25 (!SUPERH || SH_CAYMAN) && !M68K && !BLACKFIN 25 (!SUPERH || SH_CAYMAN) && !M68K && !BLACKFIN
@@ -168,7 +168,7 @@ config SERIO_MACEPS2
168 module will be called maceps2. 168 module will be called maceps2.
169 169
170config SERIO_LIBPS2 170config SERIO_LIBPS2
171 tristate "PS/2 driver library" if EMBEDDED 171 tristate "PS/2 driver library" if EXPERT
172 depends on SERIO_I8042 || SERIO_I8042=n 172 depends on SERIO_I8042 || SERIO_I8042=n
173 help 173 help
174 Say Y here if you are using a driver for device connected 174 Say Y here if you are using a driver for device connected
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 0c9f4b158ff0..61834ae282e1 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -540,62 +540,62 @@ config TOUCHSCREEN_MC13783
540 540
541config TOUCHSCREEN_USB_EGALAX 541config TOUCHSCREEN_USB_EGALAX
542 default y 542 default y
543 bool "eGalax, eTurboTouch CT-410/510/700 device support" if EMBEDDED 543 bool "eGalax, eTurboTouch CT-410/510/700 device support" if EXPERT
544 depends on TOUCHSCREEN_USB_COMPOSITE 544 depends on TOUCHSCREEN_USB_COMPOSITE
545 545
546config TOUCHSCREEN_USB_PANJIT 546config TOUCHSCREEN_USB_PANJIT
547 default y 547 default y
548 bool "PanJit device support" if EMBEDDED 548 bool "PanJit device support" if EXPERT
549 depends on TOUCHSCREEN_USB_COMPOSITE 549 depends on TOUCHSCREEN_USB_COMPOSITE
550 550
551config TOUCHSCREEN_USB_3M 551config TOUCHSCREEN_USB_3M
552 default y 552 default y
553 bool "3M/Microtouch EX II series device support" if EMBEDDED 553 bool "3M/Microtouch EX II series device support" if EXPERT
554 depends on TOUCHSCREEN_USB_COMPOSITE 554 depends on TOUCHSCREEN_USB_COMPOSITE
555 555
556config TOUCHSCREEN_USB_ITM 556config TOUCHSCREEN_USB_ITM
557 default y 557 default y
558 bool "ITM device support" if EMBEDDED 558 bool "ITM device support" if EXPERT
559 depends on TOUCHSCREEN_USB_COMPOSITE 559 depends on TOUCHSCREEN_USB_COMPOSITE
560 560
561config TOUCHSCREEN_USB_ETURBO 561config TOUCHSCREEN_USB_ETURBO
562 default y 562 default y
563 bool "eTurboTouch (non-eGalax compatible) device support" if EMBEDDED 563 bool "eTurboTouch (non-eGalax compatible) device support" if EXPERT
564 depends on TOUCHSCREEN_USB_COMPOSITE 564 depends on TOUCHSCREEN_USB_COMPOSITE
565 565
566config TOUCHSCREEN_USB_GUNZE 566config TOUCHSCREEN_USB_GUNZE
567 default y 567 default y
568 bool "Gunze AHL61 device support" if EMBEDDED 568 bool "Gunze AHL61 device support" if EXPERT
569 depends on TOUCHSCREEN_USB_COMPOSITE 569 depends on TOUCHSCREEN_USB_COMPOSITE
570 570
571config TOUCHSCREEN_USB_DMC_TSC10 571config TOUCHSCREEN_USB_DMC_TSC10
572 default y 572 default y
573 bool "DMC TSC-10/25 device support" if EMBEDDED 573 bool "DMC TSC-10/25 device support" if EXPERT
574 depends on TOUCHSCREEN_USB_COMPOSITE 574 depends on TOUCHSCREEN_USB_COMPOSITE
575 575
576config TOUCHSCREEN_USB_IRTOUCH 576config TOUCHSCREEN_USB_IRTOUCH
577 default y 577 default y
578 bool "IRTOUCHSYSTEMS/UNITOP device support" if EMBEDDED 578 bool "IRTOUCHSYSTEMS/UNITOP device support" if EXPERT
579 depends on TOUCHSCREEN_USB_COMPOSITE 579 depends on TOUCHSCREEN_USB_COMPOSITE
580 580
581config TOUCHSCREEN_USB_IDEALTEK 581config TOUCHSCREEN_USB_IDEALTEK
582 default y 582 default y
583 bool "IdealTEK URTC1000 device support" if EMBEDDED 583 bool "IdealTEK URTC1000 device support" if EXPERT
584 depends on TOUCHSCREEN_USB_COMPOSITE 584 depends on TOUCHSCREEN_USB_COMPOSITE
585 585
586config TOUCHSCREEN_USB_GENERAL_TOUCH 586config TOUCHSCREEN_USB_GENERAL_TOUCH
587 default y 587 default y
588 bool "GeneralTouch Touchscreen device support" if EMBEDDED 588 bool "GeneralTouch Touchscreen device support" if EXPERT
589 depends on TOUCHSCREEN_USB_COMPOSITE 589 depends on TOUCHSCREEN_USB_COMPOSITE
590 590
591config TOUCHSCREEN_USB_GOTOP 591config TOUCHSCREEN_USB_GOTOP
592 default y 592 default y
593 bool "GoTop Super_Q2/GogoPen/PenPower tablet device support" if EMBEDDED 593 bool "GoTop Super_Q2/GogoPen/PenPower tablet device support" if EXPERT
594 depends on TOUCHSCREEN_USB_COMPOSITE 594 depends on TOUCHSCREEN_USB_COMPOSITE
595 595
596config TOUCHSCREEN_USB_JASTEC 596config TOUCHSCREEN_USB_JASTEC
597 default y 597 default y
598 bool "JASTEC/DigiTech DTR-02U USB touch controller device support" if EMBEDDED 598 bool "JASTEC/DigiTech DTR-02U USB touch controller device support" if EXPERT
599 depends on TOUCHSCREEN_USB_COMPOSITE 599 depends on TOUCHSCREEN_USB_COMPOSITE
600 600
601config TOUCHSCREEN_USB_E2I 601config TOUCHSCREEN_USB_E2I
@@ -605,17 +605,17 @@ config TOUCHSCREEN_USB_E2I
605 605
606config TOUCHSCREEN_USB_ZYTRONIC 606config TOUCHSCREEN_USB_ZYTRONIC
607 default y 607 default y
608 bool "Zytronic controller" if EMBEDDED 608 bool "Zytronic controller" if EXPERT
609 depends on TOUCHSCREEN_USB_COMPOSITE 609 depends on TOUCHSCREEN_USB_COMPOSITE
610 610
611config TOUCHSCREEN_USB_ETT_TC45USB 611config TOUCHSCREEN_USB_ETT_TC45USB
612 default y 612 default y
613 bool "ET&T USB series TC4UM/TC5UH touchscreen controller support" if EMBEDDED 613 bool "ET&T USB series TC4UM/TC5UH touchscreen controller support" if EXPERT
614 depends on TOUCHSCREEN_USB_COMPOSITE 614 depends on TOUCHSCREEN_USB_COMPOSITE
615 615
616config TOUCHSCREEN_USB_NEXIO 616config TOUCHSCREEN_USB_NEXIO
617 default y 617 default y
618 bool "NEXIO/iNexio device support" if EMBEDDED 618 bool "NEXIO/iNexio device support" if EXPERT
619 depends on TOUCHSCREEN_USB_COMPOSITE 619 depends on TOUCHSCREEN_USB_COMPOSITE
620 620
621config TOUCHSCREEN_TOUCHIT213 621config TOUCHSCREEN_TOUCHIT213
diff --git a/drivers/leds/ledtrig-gpio.c b/drivers/leds/ledtrig-gpio.c
index 991d93be0f44..ecc4bf3f37a9 100644
--- a/drivers/leds/ledtrig-gpio.c
+++ b/drivers/leds/ledtrig-gpio.c
@@ -99,7 +99,7 @@ static ssize_t gpio_trig_inverted_show(struct device *dev,
99 struct led_classdev *led = dev_get_drvdata(dev); 99 struct led_classdev *led = dev_get_drvdata(dev);
100 struct gpio_trig_data *gpio_data = led->trigger_data; 100 struct gpio_trig_data *gpio_data = led->trigger_data;
101 101
102 return sprintf(buf, "%s\n", gpio_data->inverted ? "yes" : "no"); 102 return sprintf(buf, "%u\n", gpio_data->inverted);
103} 103}
104 104
105static ssize_t gpio_trig_inverted_store(struct device *dev, 105static ssize_t gpio_trig_inverted_store(struct device *dev,
@@ -107,16 +107,17 @@ static ssize_t gpio_trig_inverted_store(struct device *dev,
107{ 107{
108 struct led_classdev *led = dev_get_drvdata(dev); 108 struct led_classdev *led = dev_get_drvdata(dev);
109 struct gpio_trig_data *gpio_data = led->trigger_data; 109 struct gpio_trig_data *gpio_data = led->trigger_data;
110 unsigned inverted; 110 unsigned long inverted;
111 int ret; 111 int ret;
112 112
113 ret = sscanf(buf, "%u", &inverted); 113 ret = strict_strtoul(buf, 10, &inverted);
114 if (ret < 1) { 114 if (ret < 0)
115 dev_err(dev, "invalid value\n"); 115 return ret;
116
117 if (inverted > 1)
116 return -EINVAL; 118 return -EINVAL;
117 }
118 119
119 gpio_data->inverted = !!inverted; 120 gpio_data->inverted = inverted;
120 121
121 /* After inverting, we need to update the LED. */ 122 /* After inverting, we need to update the LED. */
122 schedule_work(&gpio_data->work); 123 schedule_work(&gpio_data->work);
diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c
index 04b22128a474..d21578ee95de 100644
--- a/drivers/lguest/page_tables.c
+++ b/drivers/lguest/page_tables.c
@@ -1137,7 +1137,7 @@ void free_guest_pagetable(struct lguest *lg)
1137 */ 1137 */
1138void map_switcher_in_guest(struct lg_cpu *cpu, struct lguest_pages *pages) 1138void map_switcher_in_guest(struct lg_cpu *cpu, struct lguest_pages *pages)
1139{ 1139{
1140 pte_t *switcher_pte_page = __get_cpu_var(switcher_pte_pages); 1140 pte_t *switcher_pte_page = __this_cpu_read(switcher_pte_pages);
1141 pte_t regs_pte; 1141 pte_t regs_pte;
1142 1142
1143#ifdef CONFIG_X86_PAE 1143#ifdef CONFIG_X86_PAE
diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c
index b4eb675a807e..9f1659c3d1f3 100644
--- a/drivers/lguest/x86/core.c
+++ b/drivers/lguest/x86/core.c
@@ -90,8 +90,8 @@ static void copy_in_guest_info(struct lg_cpu *cpu, struct lguest_pages *pages)
90 * meanwhile). If that's not the case, we pretend everything in the 90 * meanwhile). If that's not the case, we pretend everything in the
91 * Guest has changed. 91 * Guest has changed.
92 */ 92 */
93 if (__get_cpu_var(lg_last_cpu) != cpu || cpu->last_pages != pages) { 93 if (__this_cpu_read(lg_last_cpu) != cpu || cpu->last_pages != pages) {
94 __get_cpu_var(lg_last_cpu) = cpu; 94 __this_cpu_write(lg_last_cpu, cpu);
95 cpu->last_pages = pages; 95 cpu->last_pages = pages;
96 cpu->changed = CHANGED_ALL; 96 cpu->changed = CHANGED_ALL;
97 } 97 }
diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c
index 2e041fd0a00c..f3a29f264db9 100644
--- a/drivers/macintosh/therm_pm72.c
+++ b/drivers/macintosh/therm_pm72.c
@@ -443,7 +443,7 @@ static int fan_read_reg(int reg, unsigned char *buf, int nb)
443 tries = 0; 443 tries = 0;
444 for (;;) { 444 for (;;) {
445 nr = i2c_master_recv(fcu, buf, nb); 445 nr = i2c_master_recv(fcu, buf, nb);
446 if (nr > 0 || (nr < 0 && nr != ENODEV) || tries >= 100) 446 if (nr > 0 || (nr < 0 && nr != -ENODEV) || tries >= 100)
447 break; 447 break;
448 msleep(10); 448 msleep(10);
449 ++tries; 449 ++tries;
@@ -464,7 +464,7 @@ static int fan_write_reg(int reg, const unsigned char *ptr, int nb)
464 tries = 0; 464 tries = 0;
465 for (;;) { 465 for (;;) {
466 nw = i2c_master_send(fcu, buf, nb); 466 nw = i2c_master_send(fcu, buf, nb);
467 if (nw > 0 || (nw < 0 && nw != EIO) || tries >= 100) 467 if (nw > 0 || (nw < 0 && nw != -EIO) || tries >= 100)
468 break; 468 break;
469 msleep(10); 469 msleep(10);
470 ++tries; 470 ++tries;
diff --git a/drivers/media/common/saa7146_core.c b/drivers/media/common/saa7146_core.c
index 982f000a57ff..9f47e383c57a 100644
--- a/drivers/media/common/saa7146_core.c
+++ b/drivers/media/common/saa7146_core.c
@@ -452,7 +452,7 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent
452 INFO(("found saa7146 @ mem %p (revision %d, irq %d) (0x%04x,0x%04x).\n", dev->mem, dev->revision, pci->irq, pci->subsystem_vendor, pci->subsystem_device)); 452 INFO(("found saa7146 @ mem %p (revision %d, irq %d) (0x%04x,0x%04x).\n", dev->mem, dev->revision, pci->irq, pci->subsystem_vendor, pci->subsystem_device));
453 dev->ext = ext; 453 dev->ext = ext;
454 454
455 mutex_init(&dev->lock); 455 mutex_init(&dev->v4l2_lock);
456 spin_lock_init(&dev->int_slock); 456 spin_lock_init(&dev->int_slock);
457 spin_lock_init(&dev->slock); 457 spin_lock_init(&dev->slock);
458 458
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c
index e3fedc60fe77..1bd3dd762c6b 100644
--- a/drivers/media/common/saa7146_fops.c
+++ b/drivers/media/common/saa7146_fops.c
@@ -15,18 +15,15 @@ int saa7146_res_get(struct saa7146_fh *fh, unsigned int bit)
15 } 15 }
16 16
17 /* is it free? */ 17 /* is it free? */
18 mutex_lock(&dev->lock);
19 if (vv->resources & bit) { 18 if (vv->resources & bit) {
20 DEB_D(("locked! vv->resources:0x%02x, we want:0x%02x\n",vv->resources,bit)); 19 DEB_D(("locked! vv->resources:0x%02x, we want:0x%02x\n",vv->resources,bit));
21 /* no, someone else uses it */ 20 /* no, someone else uses it */
22 mutex_unlock(&dev->lock);
23 return 0; 21 return 0;
24 } 22 }
25 /* it's free, grab it */ 23 /* it's free, grab it */
26 fh->resources |= bit; 24 fh->resources |= bit;
27 vv->resources |= bit; 25 vv->resources |= bit;
28 DEB_D(("res: get 0x%02x, cur:0x%02x\n",bit,vv->resources)); 26 DEB_D(("res: get 0x%02x, cur:0x%02x\n",bit,vv->resources));
29 mutex_unlock(&dev->lock);
30 return 1; 27 return 1;
31} 28}
32 29
@@ -37,11 +34,9 @@ void saa7146_res_free(struct saa7146_fh *fh, unsigned int bits)
37 34
38 BUG_ON((fh->resources & bits) != bits); 35 BUG_ON((fh->resources & bits) != bits);
39 36
40 mutex_lock(&dev->lock);
41 fh->resources &= ~bits; 37 fh->resources &= ~bits;
42 vv->resources &= ~bits; 38 vv->resources &= ~bits;
43 DEB_D(("res: put 0x%02x, cur:0x%02x\n",bits,vv->resources)); 39 DEB_D(("res: put 0x%02x, cur:0x%02x\n",bits,vv->resources));
44 mutex_unlock(&dev->lock);
45} 40}
46 41
47 42
@@ -396,7 +391,7 @@ static const struct v4l2_file_operations video_fops =
396 .write = fops_write, 391 .write = fops_write,
397 .poll = fops_poll, 392 .poll = fops_poll,
398 .mmap = fops_mmap, 393 .mmap = fops_mmap,
399 .ioctl = video_ioctl2, 394 .unlocked_ioctl = video_ioctl2,
400}; 395};
401 396
402static void vv_callback(struct saa7146_dev *dev, unsigned long status) 397static void vv_callback(struct saa7146_dev *dev, unsigned long status)
@@ -505,6 +500,7 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev,
505 vfd->fops = &video_fops; 500 vfd->fops = &video_fops;
506 vfd->ioctl_ops = &dev->ext_vv_data->ops; 501 vfd->ioctl_ops = &dev->ext_vv_data->ops;
507 vfd->release = video_device_release; 502 vfd->release = video_device_release;
503 vfd->lock = &dev->v4l2_lock;
508 vfd->tvnorms = 0; 504 vfd->tvnorms = 0;
509 for (i = 0; i < dev->ext_vv_data->num_stds; i++) 505 for (i = 0; i < dev->ext_vv_data->num_stds; i++)
510 vfd->tvnorms |= dev->ext_vv_data->stds[i].id; 506 vfd->tvnorms |= dev->ext_vv_data->stds[i].id;
diff --git a/drivers/media/common/saa7146_vbi.c b/drivers/media/common/saa7146_vbi.c
index 2d4533ab22b7..afe85801d6ca 100644
--- a/drivers/media/common/saa7146_vbi.c
+++ b/drivers/media/common/saa7146_vbi.c
@@ -412,7 +412,7 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file)
412 V4L2_BUF_TYPE_VBI_CAPTURE, 412 V4L2_BUF_TYPE_VBI_CAPTURE,
413 V4L2_FIELD_SEQ_TB, // FIXME: does this really work? 413 V4L2_FIELD_SEQ_TB, // FIXME: does this really work?
414 sizeof(struct saa7146_buf), 414 sizeof(struct saa7146_buf),
415 file, NULL); 415 file, &dev->v4l2_lock);
416 416
417 init_timer(&fh->vbi_read_timeout); 417 init_timer(&fh->vbi_read_timeout);
418 fh->vbi_read_timeout.function = vbi_read_timeout; 418 fh->vbi_read_timeout.function = vbi_read_timeout;
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c
index 0ac5c619aecf..9aafa4e969a8 100644
--- a/drivers/media/common/saa7146_video.c
+++ b/drivers/media/common/saa7146_video.c
@@ -553,8 +553,6 @@ static int vidioc_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *f
553 } 553 }
554 } 554 }
555 555
556 mutex_lock(&dev->lock);
557
558 /* ok, accept it */ 556 /* ok, accept it */
559 vv->ov_fb = *fb; 557 vv->ov_fb = *fb;
560 vv->ov_fmt = fmt; 558 vv->ov_fmt = fmt;
@@ -563,8 +561,6 @@ static int vidioc_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *f
563 vv->ov_fb.fmt.bytesperline = vv->ov_fb.fmt.width * fmt->depth / 8; 561 vv->ov_fb.fmt.bytesperline = vv->ov_fb.fmt.width * fmt->depth / 8;
564 DEB_D(("setting bytesperline to %d\n", vv->ov_fb.fmt.bytesperline)); 562 DEB_D(("setting bytesperline to %d\n", vv->ov_fb.fmt.bytesperline));
565 } 563 }
566
567 mutex_unlock(&dev->lock);
568 return 0; 564 return 0;
569} 565}
570 566
@@ -649,8 +645,6 @@ static int vidioc_s_ctrl(struct file *file, void *fh, struct v4l2_control *c)
649 return -EINVAL; 645 return -EINVAL;
650 } 646 }
651 647
652 mutex_lock(&dev->lock);
653
654 switch (ctrl->type) { 648 switch (ctrl->type) {
655 case V4L2_CTRL_TYPE_BOOLEAN: 649 case V4L2_CTRL_TYPE_BOOLEAN:
656 case V4L2_CTRL_TYPE_MENU: 650 case V4L2_CTRL_TYPE_MENU:
@@ -693,7 +687,6 @@ static int vidioc_s_ctrl(struct file *file, void *fh, struct v4l2_control *c)
693 /* fixme: we can support changing VFLIP and HFLIP here... */ 687 /* fixme: we can support changing VFLIP and HFLIP here... */
694 if (IS_CAPTURE_ACTIVE(fh) != 0) { 688 if (IS_CAPTURE_ACTIVE(fh) != 0) {
695 DEB_D(("V4L2_CID_HFLIP while active capture.\n")); 689 DEB_D(("V4L2_CID_HFLIP while active capture.\n"));
696 mutex_unlock(&dev->lock);
697 return -EBUSY; 690 return -EBUSY;
698 } 691 }
699 vv->hflip = c->value; 692 vv->hflip = c->value;
@@ -701,16 +694,13 @@ static int vidioc_s_ctrl(struct file *file, void *fh, struct v4l2_control *c)
701 case V4L2_CID_VFLIP: 694 case V4L2_CID_VFLIP:
702 if (IS_CAPTURE_ACTIVE(fh) != 0) { 695 if (IS_CAPTURE_ACTIVE(fh) != 0) {
703 DEB_D(("V4L2_CID_VFLIP while active capture.\n")); 696 DEB_D(("V4L2_CID_VFLIP while active capture.\n"));
704 mutex_unlock(&dev->lock);
705 return -EBUSY; 697 return -EBUSY;
706 } 698 }
707 vv->vflip = c->value; 699 vv->vflip = c->value;
708 break; 700 break;
709 default: 701 default:
710 mutex_unlock(&dev->lock);
711 return -EINVAL; 702 return -EINVAL;
712 } 703 }
713 mutex_unlock(&dev->lock);
714 704
715 if (IS_OVERLAY_ACTIVE(fh) != 0) { 705 if (IS_OVERLAY_ACTIVE(fh) != 0) {
716 saa7146_stop_preview(fh); 706 saa7146_stop_preview(fh);
@@ -902,22 +892,18 @@ static int vidioc_s_fmt_vid_overlay(struct file *file, void *__fh, struct v4l2_f
902 err = vidioc_try_fmt_vid_overlay(file, fh, f); 892 err = vidioc_try_fmt_vid_overlay(file, fh, f);
903 if (0 != err) 893 if (0 != err)
904 return err; 894 return err;
905 mutex_lock(&dev->lock);
906 fh->ov.win = f->fmt.win; 895 fh->ov.win = f->fmt.win;
907 fh->ov.nclips = f->fmt.win.clipcount; 896 fh->ov.nclips = f->fmt.win.clipcount;
908 if (fh->ov.nclips > 16) 897 if (fh->ov.nclips > 16)
909 fh->ov.nclips = 16; 898 fh->ov.nclips = 16;
910 if (copy_from_user(fh->ov.clips, f->fmt.win.clips, 899 if (copy_from_user(fh->ov.clips, f->fmt.win.clips,
911 sizeof(struct v4l2_clip) * fh->ov.nclips)) { 900 sizeof(struct v4l2_clip) * fh->ov.nclips)) {
912 mutex_unlock(&dev->lock);
913 return -EFAULT; 901 return -EFAULT;
914 } 902 }
915 903
916 /* fh->ov.fh is used to indicate that we have valid overlay informations, too */ 904 /* fh->ov.fh is used to indicate that we have valid overlay informations, too */
917 fh->ov.fh = fh; 905 fh->ov.fh = fh;
918 906
919 mutex_unlock(&dev->lock);
920
921 /* check if our current overlay is active */ 907 /* check if our current overlay is active */
922 if (IS_OVERLAY_ACTIVE(fh) != 0) { 908 if (IS_OVERLAY_ACTIVE(fh) != 0) {
923 saa7146_stop_preview(fh); 909 saa7146_stop_preview(fh);
@@ -976,8 +962,6 @@ static int vidioc_s_std(struct file *file, void *fh, v4l2_std_id *id)
976 } 962 }
977 } 963 }
978 964
979 mutex_lock(&dev->lock);
980
981 for (i = 0; i < dev->ext_vv_data->num_stds; i++) 965 for (i = 0; i < dev->ext_vv_data->num_stds; i++)
982 if (*id & dev->ext_vv_data->stds[i].id) 966 if (*id & dev->ext_vv_data->stds[i].id)
983 break; 967 break;
@@ -988,8 +972,6 @@ static int vidioc_s_std(struct file *file, void *fh, v4l2_std_id *id)
988 found = 1; 972 found = 1;
989 } 973 }
990 974
991 mutex_unlock(&dev->lock);
992
993 if (vv->ov_suspend != NULL) { 975 if (vv->ov_suspend != NULL) {
994 saa7146_start_preview(vv->ov_suspend); 976 saa7146_start_preview(vv->ov_suspend);
995 vv->ov_suspend = NULL; 977 vv->ov_suspend = NULL;
@@ -1354,7 +1336,7 @@ static int video_open(struct saa7146_dev *dev, struct file *file)
1354 V4L2_BUF_TYPE_VIDEO_CAPTURE, 1336 V4L2_BUF_TYPE_VIDEO_CAPTURE,
1355 V4L2_FIELD_INTERLACED, 1337 V4L2_FIELD_INTERLACED,
1356 sizeof(struct saa7146_buf), 1338 sizeof(struct saa7146_buf),
1357 file, NULL); 1339 file, &dev->v4l2_lock);
1358 1340
1359 return 0; 1341 return 0;
1360} 1342}
diff --git a/drivers/media/common/tuners/Kconfig b/drivers/media/common/tuners/Kconfig
index 78b089526e02..6fc79f15dcbc 100644
--- a/drivers/media/common/tuners/Kconfig
+++ b/drivers/media/common/tuners/Kconfig
@@ -34,7 +34,7 @@ config MEDIA_TUNER
34config MEDIA_TUNER_CUSTOMISE 34config MEDIA_TUNER_CUSTOMISE
35 bool "Customize analog and hybrid tuner modules to build" 35 bool "Customize analog and hybrid tuner modules to build"
36 depends on MEDIA_TUNER 36 depends on MEDIA_TUNER
37 default y if EMBEDDED 37 default y if EXPERT
38 help 38 help
39 This allows the user to deselect tuner drivers unnecessary 39 This allows the user to deselect tuner drivers unnecessary
40 for their hardware from the build. Use this option with care 40 for their hardware from the build. Use this option with care
diff --git a/drivers/media/common/tuners/tda8290.c b/drivers/media/common/tuners/tda8290.c
index c9062ceddc71..bc6a67768af1 100644
--- a/drivers/media/common/tuners/tda8290.c
+++ b/drivers/media/common/tuners/tda8290.c
@@ -95,8 +95,7 @@ static int tda8295_i2c_bridge(struct dvb_frontend *fe, int close)
95 msleep(20); 95 msleep(20);
96 } else { 96 } else {
97 msg = disable; 97 msg = disable;
98 tuner_i2c_xfer_send(&priv->i2c_props, msg, 1); 98 tuner_i2c_xfer_send_recv(&priv->i2c_props, msg, 1, &msg[1], 1);
99 tuner_i2c_xfer_recv(&priv->i2c_props, &msg[1], 1);
100 99
101 buf[2] = msg[1]; 100 buf[2] = msg[1];
102 buf[2] &= ~0x04; 101 buf[2] &= ~0x04;
@@ -233,19 +232,22 @@ static void tda8290_set_params(struct dvb_frontend *fe,
233 tuner_i2c_xfer_send(&priv->i2c_props, pll_bw_nom, 2); 232 tuner_i2c_xfer_send(&priv->i2c_props, pll_bw_nom, 2);
234 } 233 }
235 234
235
236 tda8290_i2c_bridge(fe, 1); 236 tda8290_i2c_bridge(fe, 1);
237 237
238 if (fe->ops.tuner_ops.set_analog_params) 238 if (fe->ops.tuner_ops.set_analog_params)
239 fe->ops.tuner_ops.set_analog_params(fe, params); 239 fe->ops.tuner_ops.set_analog_params(fe, params);
240 240
241 for (i = 0; i < 3; i++) { 241 for (i = 0; i < 3; i++) {
242 tuner_i2c_xfer_send(&priv->i2c_props, &addr_pll_stat, 1); 242 tuner_i2c_xfer_send_recv(&priv->i2c_props,
243 tuner_i2c_xfer_recv(&priv->i2c_props, &pll_stat, 1); 243 &addr_pll_stat, 1, &pll_stat, 1);
244 if (pll_stat & 0x80) { 244 if (pll_stat & 0x80) {
245 tuner_i2c_xfer_send(&priv->i2c_props, &addr_adc_sat, 1); 245 tuner_i2c_xfer_send_recv(&priv->i2c_props,
246 tuner_i2c_xfer_recv(&priv->i2c_props, &adc_sat, 1); 246 &addr_adc_sat, 1,
247 tuner_i2c_xfer_send(&priv->i2c_props, &addr_agc_stat, 1); 247 &adc_sat, 1);
248 tuner_i2c_xfer_recv(&priv->i2c_props, &agc_stat, 1); 248 tuner_i2c_xfer_send_recv(&priv->i2c_props,
249 &addr_agc_stat, 1,
250 &agc_stat, 1);
249 tuner_dbg("tda8290 is locked, AGC: %d\n", agc_stat); 251 tuner_dbg("tda8290 is locked, AGC: %d\n", agc_stat);
250 break; 252 break;
251 } else { 253 } else {
@@ -259,20 +261,22 @@ static void tda8290_set_params(struct dvb_frontend *fe,
259 agc_stat, adc_sat, pll_stat & 0x80); 261 agc_stat, adc_sat, pll_stat & 0x80);
260 tuner_i2c_xfer_send(&priv->i2c_props, gainset_2, 2); 262 tuner_i2c_xfer_send(&priv->i2c_props, gainset_2, 2);
261 msleep(100); 263 msleep(100);
262 tuner_i2c_xfer_send(&priv->i2c_props, &addr_agc_stat, 1); 264 tuner_i2c_xfer_send_recv(&priv->i2c_props,
263 tuner_i2c_xfer_recv(&priv->i2c_props, &agc_stat, 1); 265 &addr_agc_stat, 1, &agc_stat, 1);
264 tuner_i2c_xfer_send(&priv->i2c_props, &addr_pll_stat, 1); 266 tuner_i2c_xfer_send_recv(&priv->i2c_props,
265 tuner_i2c_xfer_recv(&priv->i2c_props, &pll_stat, 1); 267 &addr_pll_stat, 1, &pll_stat, 1);
266 if ((agc_stat > 115) || !(pll_stat & 0x80)) { 268 if ((agc_stat > 115) || !(pll_stat & 0x80)) {
267 tuner_dbg("adjust gain, step 2. Agc: %d, lock: %d\n", 269 tuner_dbg("adjust gain, step 2. Agc: %d, lock: %d\n",
268 agc_stat, pll_stat & 0x80); 270 agc_stat, pll_stat & 0x80);
269 if (priv->cfg.agcf) 271 if (priv->cfg.agcf)
270 priv->cfg.agcf(fe); 272 priv->cfg.agcf(fe);
271 msleep(100); 273 msleep(100);
272 tuner_i2c_xfer_send(&priv->i2c_props, &addr_agc_stat, 1); 274 tuner_i2c_xfer_send_recv(&priv->i2c_props,
273 tuner_i2c_xfer_recv(&priv->i2c_props, &agc_stat, 1); 275 &addr_agc_stat, 1,
274 tuner_i2c_xfer_send(&priv->i2c_props, &addr_pll_stat, 1); 276 &agc_stat, 1);
275 tuner_i2c_xfer_recv(&priv->i2c_props, &pll_stat, 1); 277 tuner_i2c_xfer_send_recv(&priv->i2c_props,
278 &addr_pll_stat, 1,
279 &pll_stat, 1);
276 if((agc_stat > 115) || !(pll_stat & 0x80)) { 280 if((agc_stat > 115) || !(pll_stat & 0x80)) {
277 tuner_dbg("adjust gain, step 3. Agc: %d\n", agc_stat); 281 tuner_dbg("adjust gain, step 3. Agc: %d\n", agc_stat);
278 tuner_i2c_xfer_send(&priv->i2c_props, adc_head_12, 2); 282 tuner_i2c_xfer_send(&priv->i2c_props, adc_head_12, 2);
@@ -284,10 +288,12 @@ static void tda8290_set_params(struct dvb_frontend *fe,
284 288
285 /* l/ l' deadlock? */ 289 /* l/ l' deadlock? */
286 if(priv->tda8290_easy_mode & 0x60) { 290 if(priv->tda8290_easy_mode & 0x60) {
287 tuner_i2c_xfer_send(&priv->i2c_props, &addr_adc_sat, 1); 291 tuner_i2c_xfer_send_recv(&priv->i2c_props,
288 tuner_i2c_xfer_recv(&priv->i2c_props, &adc_sat, 1); 292 &addr_adc_sat, 1,
289 tuner_i2c_xfer_send(&priv->i2c_props, &addr_pll_stat, 1); 293 &adc_sat, 1);
290 tuner_i2c_xfer_recv(&priv->i2c_props, &pll_stat, 1); 294 tuner_i2c_xfer_send_recv(&priv->i2c_props,
295 &addr_pll_stat, 1,
296 &pll_stat, 1);
291 if ((adc_sat > 20) || !(pll_stat & 0x80)) { 297 if ((adc_sat > 20) || !(pll_stat & 0x80)) {
292 tuner_dbg("trying to resolve SECAM L deadlock\n"); 298 tuner_dbg("trying to resolve SECAM L deadlock\n");
293 tuner_i2c_xfer_send(&priv->i2c_props, agc_rst_on, 2); 299 tuner_i2c_xfer_send(&priv->i2c_props, agc_rst_on, 2);
@@ -307,8 +313,7 @@ static void tda8295_power(struct dvb_frontend *fe, int enable)
307 struct tda8290_priv *priv = fe->analog_demod_priv; 313 struct tda8290_priv *priv = fe->analog_demod_priv;
308 unsigned char buf[] = { 0x30, 0x00 }; /* clb_stdbt */ 314 unsigned char buf[] = { 0x30, 0x00 }; /* clb_stdbt */
309 315
310 tuner_i2c_xfer_send(&priv->i2c_props, &buf[0], 1); 316 tuner_i2c_xfer_send_recv(&priv->i2c_props, &buf[0], 1, &buf[1], 1);
311 tuner_i2c_xfer_recv(&priv->i2c_props, &buf[1], 1);
312 317
313 if (enable) 318 if (enable)
314 buf[1] = 0x01; 319 buf[1] = 0x01;
@@ -323,8 +328,7 @@ static void tda8295_set_easy_mode(struct dvb_frontend *fe, int enable)
323 struct tda8290_priv *priv = fe->analog_demod_priv; 328 struct tda8290_priv *priv = fe->analog_demod_priv;
324 unsigned char buf[] = { 0x01, 0x00 }; 329 unsigned char buf[] = { 0x01, 0x00 };
325 330
326 tuner_i2c_xfer_send(&priv->i2c_props, &buf[0], 1); 331 tuner_i2c_xfer_send_recv(&priv->i2c_props, &buf[0], 1, &buf[1], 1);
327 tuner_i2c_xfer_recv(&priv->i2c_props, &buf[1], 1);
328 332
329 if (enable) 333 if (enable)
330 buf[1] = 0x01; /* rising edge sets regs 0x02 - 0x23 */ 334 buf[1] = 0x01; /* rising edge sets regs 0x02 - 0x23 */
@@ -353,8 +357,7 @@ static void tda8295_agc1_out(struct dvb_frontend *fe, int enable)
353 struct tda8290_priv *priv = fe->analog_demod_priv; 357 struct tda8290_priv *priv = fe->analog_demod_priv;
354 unsigned char buf[] = { 0x02, 0x00 }; /* DIV_FUNC */ 358 unsigned char buf[] = { 0x02, 0x00 }; /* DIV_FUNC */
355 359
356 tuner_i2c_xfer_send(&priv->i2c_props, &buf[0], 1); 360 tuner_i2c_xfer_send_recv(&priv->i2c_props, &buf[0], 1, &buf[1], 1);
357 tuner_i2c_xfer_recv(&priv->i2c_props, &buf[1], 1);
358 361
359 if (enable) 362 if (enable)
360 buf[1] &= ~0x40; 363 buf[1] &= ~0x40;
@@ -370,10 +373,10 @@ static void tda8295_agc2_out(struct dvb_frontend *fe, int enable)
370 unsigned char set_gpio_cf[] = { 0x44, 0x00 }; 373 unsigned char set_gpio_cf[] = { 0x44, 0x00 };
371 unsigned char set_gpio_val[] = { 0x46, 0x00 }; 374 unsigned char set_gpio_val[] = { 0x46, 0x00 };
372 375
373 tuner_i2c_xfer_send(&priv->i2c_props, &set_gpio_cf[0], 1); 376 tuner_i2c_xfer_send_recv(&priv->i2c_props,
374 tuner_i2c_xfer_recv(&priv->i2c_props, &set_gpio_cf[1], 1); 377 &set_gpio_cf[0], 1, &set_gpio_cf[1], 1);
375 tuner_i2c_xfer_send(&priv->i2c_props, &set_gpio_val[0], 1); 378 tuner_i2c_xfer_send_recv(&priv->i2c_props,
376 tuner_i2c_xfer_recv(&priv->i2c_props, &set_gpio_val[1], 1); 379 &set_gpio_val[0], 1, &set_gpio_val[1], 1);
377 380
378 set_gpio_cf[1] &= 0xf0; /* clear GPIO_0 bits 3-0 */ 381 set_gpio_cf[1] &= 0xf0; /* clear GPIO_0 bits 3-0 */
379 382
@@ -392,8 +395,7 @@ static int tda8295_has_signal(struct dvb_frontend *fe)
392 unsigned char hvpll_stat = 0x26; 395 unsigned char hvpll_stat = 0x26;
393 unsigned char ret; 396 unsigned char ret;
394 397
395 tuner_i2c_xfer_send(&priv->i2c_props, &hvpll_stat, 1); 398 tuner_i2c_xfer_send_recv(&priv->i2c_props, &hvpll_stat, 1, &ret, 1);
396 tuner_i2c_xfer_recv(&priv->i2c_props, &ret, 1);
397 return (ret & 0x01) ? 65535 : 0; 399 return (ret & 0x01) ? 65535 : 0;
398} 400}
399 401
@@ -413,8 +415,8 @@ static void tda8295_set_params(struct dvb_frontend *fe,
413 tda8295_power(fe, 1); 415 tda8295_power(fe, 1);
414 tda8295_agc1_out(fe, 1); 416 tda8295_agc1_out(fe, 1);
415 417
416 tuner_i2c_xfer_send(&priv->i2c_props, &blanking_mode[0], 1); 418 tuner_i2c_xfer_send_recv(&priv->i2c_props,
417 tuner_i2c_xfer_recv(&priv->i2c_props, &blanking_mode[1], 1); 419 &blanking_mode[0], 1, &blanking_mode[1], 1);
418 420
419 tda8295_set_video_std(fe); 421 tda8295_set_video_std(fe);
420 422
@@ -447,8 +449,8 @@ static int tda8290_has_signal(struct dvb_frontend *fe)
447 unsigned char i2c_get_afc[1] = { 0x1B }; 449 unsigned char i2c_get_afc[1] = { 0x1B };
448 unsigned char afc = 0; 450 unsigned char afc = 0;
449 451
450 tuner_i2c_xfer_send(&priv->i2c_props, i2c_get_afc, ARRAY_SIZE(i2c_get_afc)); 452 tuner_i2c_xfer_send_recv(&priv->i2c_props,
451 tuner_i2c_xfer_recv(&priv->i2c_props, &afc, 1); 453 i2c_get_afc, ARRAY_SIZE(i2c_get_afc), &afc, 1);
452 return (afc & 0x80)? 65535:0; 454 return (afc & 0x80)? 65535:0;
453} 455}
454 456
@@ -654,20 +656,26 @@ static int tda829x_find_tuner(struct dvb_frontend *fe)
654static int tda8290_probe(struct tuner_i2c_props *i2c_props) 656static int tda8290_probe(struct tuner_i2c_props *i2c_props)
655{ 657{
656#define TDA8290_ID 0x89 658#define TDA8290_ID 0x89
657 unsigned char tda8290_id[] = { 0x1f, 0x00 }; 659 u8 reg = 0x1f, id;
660 struct i2c_msg msg_read[] = {
661 { .addr = 0x4b, .flags = 0, .len = 1, .buf = &reg },
662 { .addr = 0x4b, .flags = I2C_M_RD, .len = 1, .buf = &id },
663 };
658 664
659 /* detect tda8290 */ 665 /* detect tda8290 */
660 tuner_i2c_xfer_send(i2c_props, &tda8290_id[0], 1); 666 if (i2c_transfer(i2c_props->adap, msg_read, 2) != 2) {
661 tuner_i2c_xfer_recv(i2c_props, &tda8290_id[1], 1); 667 printk(KERN_WARNING "%s: tda8290 couldn't read register 0x%02x\n",
668 __func__, reg);
669 return -ENODEV;
670 }
662 671
663 if (tda8290_id[1] == TDA8290_ID) { 672 if (id == TDA8290_ID) {
664 if (debug) 673 if (debug)
665 printk(KERN_DEBUG "%s: tda8290 detected @ %d-%04x\n", 674 printk(KERN_DEBUG "%s: tda8290 detected @ %d-%04x\n",
666 __func__, i2c_adapter_id(i2c_props->adap), 675 __func__, i2c_adapter_id(i2c_props->adap),
667 i2c_props->addr); 676 i2c_props->addr);
668 return 0; 677 return 0;
669 } 678 }
670
671 return -ENODEV; 679 return -ENODEV;
672} 680}
673 681
@@ -675,16 +683,23 @@ static int tda8295_probe(struct tuner_i2c_props *i2c_props)
675{ 683{
676#define TDA8295_ID 0x8a 684#define TDA8295_ID 0x8a
677#define TDA8295C2_ID 0x8b 685#define TDA8295C2_ID 0x8b
678 unsigned char tda8295_id[] = { 0x2f, 0x00 }; 686 u8 reg = 0x2f, id;
687 struct i2c_msg msg_read[] = {
688 { .addr = 0x4b, .flags = 0, .len = 1, .buf = &reg },
689 { .addr = 0x4b, .flags = I2C_M_RD, .len = 1, .buf = &id },
690 };
679 691
680 /* detect tda8295 */ 692 /* detect tda8290 */
681 tuner_i2c_xfer_send(i2c_props, &tda8295_id[0], 1); 693 if (i2c_transfer(i2c_props->adap, msg_read, 2) != 2) {
682 tuner_i2c_xfer_recv(i2c_props, &tda8295_id[1], 1); 694 printk(KERN_WARNING "%s: tda8290 couldn't read register 0x%02x\n",
695 __func__, reg);
696 return -ENODEV;
697 }
683 698
684 if ((tda8295_id[1] & 0xfe) == TDA8295_ID) { 699 if ((id & 0xfe) == TDA8295_ID) {
685 if (debug) 700 if (debug)
686 printk(KERN_DEBUG "%s: %s detected @ %d-%04x\n", 701 printk(KERN_DEBUG "%s: %s detected @ %d-%04x\n",
687 __func__, (tda8295_id[1] == TDA8295_ID) ? 702 __func__, (id == TDA8295_ID) ?
688 "tda8295c1" : "tda8295c2", 703 "tda8295c1" : "tda8295c2",
689 i2c_adapter_id(i2c_props->adap), 704 i2c_adapter_id(i2c_props->adap),
690 i2c_props->addr); 705 i2c_props->addr);
@@ -740,9 +755,11 @@ struct dvb_frontend *tda829x_attach(struct dvb_frontend *fe,
740 sizeof(struct analog_demod_ops)); 755 sizeof(struct analog_demod_ops));
741 } 756 }
742 757
743 if ((!(cfg) || (TDA829X_PROBE_TUNER == cfg->probe_tuner)) && 758 if (!(cfg) || (TDA829X_PROBE_TUNER == cfg->probe_tuner)) {
744 (tda829x_find_tuner(fe) < 0)) 759 tda8295_power(fe, 1);
745 goto fail; 760 if (tda829x_find_tuner(fe) < 0)
761 goto fail;
762 }
746 763
747 switch (priv->ver) { 764 switch (priv->ver) {
748 case TDA8290: 765 case TDA8290:
@@ -786,6 +803,8 @@ struct dvb_frontend *tda829x_attach(struct dvb_frontend *fe,
786 return fe; 803 return fe;
787 804
788fail: 805fail:
806 memset(&fe->ops.analog_ops, 0, sizeof(struct analog_demod_ops));
807
789 tda829x_release(fe); 808 tda829x_release(fe);
790 return NULL; 809 return NULL;
791} 810}
@@ -809,8 +828,8 @@ int tda829x_probe(struct i2c_adapter *i2c_adap, u8 i2c_addr)
809 int i; 828 int i;
810 829
811 /* rule out tda9887, which would return the same byte repeatedly */ 830 /* rule out tda9887, which would return the same byte repeatedly */
812 tuner_i2c_xfer_send(&i2c_props, soft_reset, 1); 831 tuner_i2c_xfer_send_recv(&i2c_props,
813 tuner_i2c_xfer_recv(&i2c_props, buf, PROBE_BUFFER_SIZE); 832 soft_reset, 1, buf, PROBE_BUFFER_SIZE);
814 for (i = 1; i < PROBE_BUFFER_SIZE; i++) { 833 for (i = 1; i < PROBE_BUFFER_SIZE; i++) {
815 if (buf[i] != buf[0]) 834 if (buf[i] != buf[0])
816 break; 835 break;
@@ -827,13 +846,12 @@ int tda829x_probe(struct i2c_adapter *i2c_adap, u8 i2c_addr)
827 /* fall back to old probing method */ 846 /* fall back to old probing method */
828 tuner_i2c_xfer_send(&i2c_props, easy_mode_b, 2); 847 tuner_i2c_xfer_send(&i2c_props, easy_mode_b, 2);
829 tuner_i2c_xfer_send(&i2c_props, soft_reset, 2); 848 tuner_i2c_xfer_send(&i2c_props, soft_reset, 2);
830 tuner_i2c_xfer_send(&i2c_props, &addr_dto_lsb, 1); 849 tuner_i2c_xfer_send_recv(&i2c_props, &addr_dto_lsb, 1, &data, 1);
831 tuner_i2c_xfer_recv(&i2c_props, &data, 1);
832 if (data == 0) { 850 if (data == 0) {
833 tuner_i2c_xfer_send(&i2c_props, easy_mode_g, 2); 851 tuner_i2c_xfer_send(&i2c_props, easy_mode_g, 2);
834 tuner_i2c_xfer_send(&i2c_props, soft_reset, 2); 852 tuner_i2c_xfer_send(&i2c_props, soft_reset, 2);
835 tuner_i2c_xfer_send(&i2c_props, &addr_dto_lsb, 1); 853 tuner_i2c_xfer_send_recv(&i2c_props,
836 tuner_i2c_xfer_recv(&i2c_props, &data, 1); 854 &addr_dto_lsb, 1, &data, 1);
837 if (data == 0x7b) { 855 if (data == 0x7b) {
838 return 0; 856 return 0;
839 } 857 }
diff --git a/drivers/media/dvb/dvb-usb/dib0700_core.c b/drivers/media/dvb/dvb-usb/dib0700_core.c
index 8ca48f76dfa9..98ffb40728e3 100644
--- a/drivers/media/dvb/dvb-usb/dib0700_core.c
+++ b/drivers/media/dvb/dvb-usb/dib0700_core.c
@@ -514,8 +514,8 @@ struct dib0700_rc_response {
514 union { 514 union {
515 u16 system16; 515 u16 system16;
516 struct { 516 struct {
517 u8 system;
518 u8 not_system; 517 u8 not_system;
518 u8 system;
519 }; 519 };
520 }; 520 };
521 u8 data; 521 u8 data;
@@ -575,7 +575,7 @@ static void dib0700_rc_urb_completion(struct urb *purb)
575 if ((poll_reply->system ^ poll_reply->not_system) != 0xff) { 575 if ((poll_reply->system ^ poll_reply->not_system) != 0xff) {
576 deb_data("NEC extended protocol\n"); 576 deb_data("NEC extended protocol\n");
577 /* NEC extended code - 24 bits */ 577 /* NEC extended code - 24 bits */
578 keycode = poll_reply->system16 << 8 | poll_reply->data; 578 keycode = be16_to_cpu(poll_reply->system16) << 8 | poll_reply->data;
579 } else { 579 } else {
580 deb_data("NEC normal protocol\n"); 580 deb_data("NEC normal protocol\n");
581 /* normal NEC code - 16 bits */ 581 /* normal NEC code - 16 bits */
@@ -587,7 +587,7 @@ static void dib0700_rc_urb_completion(struct urb *purb)
587 deb_data("RC5 protocol\n"); 587 deb_data("RC5 protocol\n");
588 /* RC5 Protocol */ 588 /* RC5 Protocol */
589 toggle = poll_reply->report_id; 589 toggle = poll_reply->report_id;
590 keycode = poll_reply->system16 << 8 | poll_reply->data; 590 keycode = poll_reply->system << 8 | poll_reply->data;
591 591
592 break; 592 break;
593 } 593 }
diff --git a/drivers/media/dvb/firewire/firedtv-rc.c b/drivers/media/dvb/firewire/firedtv-rc.c
index fcf3828472b8..f82d4a93feb3 100644
--- a/drivers/media/dvb/firewire/firedtv-rc.c
+++ b/drivers/media/dvb/firewire/firedtv-rc.c
@@ -172,7 +172,8 @@ void fdtv_unregister_rc(struct firedtv *fdtv)
172 172
173void fdtv_handle_rc(struct firedtv *fdtv, unsigned int code) 173void fdtv_handle_rc(struct firedtv *fdtv, unsigned int code)
174{ 174{
175 u16 *keycode = fdtv->remote_ctrl_dev->keycode; 175 struct input_dev *idev = fdtv->remote_ctrl_dev;
176 u16 *keycode = idev->keycode;
176 177
177 if (code >= 0x0300 && code <= 0x031f) 178 if (code >= 0x0300 && code <= 0x031f)
178 code = keycode[code - 0x0300]; 179 code = keycode[code - 0x0300];
@@ -188,6 +189,8 @@ void fdtv_handle_rc(struct firedtv *fdtv, unsigned int code)
188 return; 189 return;
189 } 190 }
190 191
191 input_report_key(fdtv->remote_ctrl_dev, code, 1); 192 input_report_key(idev, code, 1);
192 input_report_key(fdtv->remote_ctrl_dev, code, 0); 193 input_sync(idev);
194 input_report_key(idev, code, 0);
195 input_sync(idev);
193} 196}
diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig
index ef3e43a03199..b8519ba511e5 100644
--- a/drivers/media/dvb/frontends/Kconfig
+++ b/drivers/media/dvb/frontends/Kconfig
@@ -1,7 +1,7 @@
1config DVB_FE_CUSTOMISE 1config DVB_FE_CUSTOMISE
2 bool "Customise the frontend modules to build" 2 bool "Customise the frontend modules to build"
3 depends on DVB_CORE 3 depends on DVB_CORE
4 default y if EMBEDDED 4 default y if EXPERT
5 help 5 help
6 This allows the user to select/deselect frontend drivers for their 6 This allows the user to select/deselect frontend drivers for their
7 hardware from the build. 7 hardware from the build.
diff --git a/drivers/media/dvb/frontends/af9013.c b/drivers/media/dvb/frontends/af9013.c
index ce222055526d..ba25fa0b0fc2 100644
--- a/drivers/media/dvb/frontends/af9013.c
+++ b/drivers/media/dvb/frontends/af9013.c
@@ -334,11 +334,11 @@ static int af9013_set_freq_ctrl(struct af9013_state *state, fe_bandwidth_t bw)
334 if_sample_freq = 3300000; /* 3.3 MHz */ 334 if_sample_freq = 3300000; /* 3.3 MHz */
335 break; 335 break;
336 case BANDWIDTH_7_MHZ: 336 case BANDWIDTH_7_MHZ:
337 if_sample_freq = 3800000; /* 3.8 MHz */ 337 if_sample_freq = 3500000; /* 3.5 MHz */
338 break; 338 break;
339 case BANDWIDTH_8_MHZ: 339 case BANDWIDTH_8_MHZ:
340 default: 340 default:
341 if_sample_freq = 4300000; /* 4.3 MHz */ 341 if_sample_freq = 4000000; /* 4.0 MHz */
342 break; 342 break;
343 } 343 }
344 } else if (state->config.tuner == AF9013_TUNER_TDA18218) { 344 } else if (state->config.tuner == AF9013_TUNER_TDA18218) {
diff --git a/drivers/media/dvb/frontends/ix2505v.c b/drivers/media/dvb/frontends/ix2505v.c
index 6360c681ded9..6c2e929bd79f 100644
--- a/drivers/media/dvb/frontends/ix2505v.c
+++ b/drivers/media/dvb/frontends/ix2505v.c
@@ -311,7 +311,7 @@ struct dvb_frontend *ix2505v_attach(struct dvb_frontend *fe,
311 return fe; 311 return fe;
312 312
313error: 313error:
314 ix2505v_release(fe); 314 kfree(state);
315 return NULL; 315 return NULL;
316} 316}
317EXPORT_SYMBOL(ix2505v_attach); 317EXPORT_SYMBOL(ix2505v_attach);
diff --git a/drivers/media/dvb/frontends/mb86a20s.c b/drivers/media/dvb/frontends/mb86a20s.c
index d3ad3e75a35a..cc4acd2f920d 100644
--- a/drivers/media/dvb/frontends/mb86a20s.c
+++ b/drivers/media/dvb/frontends/mb86a20s.c
@@ -43,6 +43,8 @@ struct mb86a20s_state {
43 const struct mb86a20s_config *config; 43 const struct mb86a20s_config *config;
44 44
45 struct dvb_frontend frontend; 45 struct dvb_frontend frontend;
46
47 bool need_init;
46}; 48};
47 49
48struct regdata { 50struct regdata {
@@ -318,7 +320,7 @@ static int mb86a20s_i2c_writereg(struct mb86a20s_state *state,
318 320
319 rc = i2c_transfer(state->i2c, &msg, 1); 321 rc = i2c_transfer(state->i2c, &msg, 1);
320 if (rc != 1) { 322 if (rc != 1) {
321 printk("%s: writereg rcor(rc == %i, reg == 0x%02x," 323 printk("%s: writereg error (rc == %i, reg == 0x%02x,"
322 " data == 0x%02x)\n", __func__, rc, reg, data); 324 " data == 0x%02x)\n", __func__, rc, reg, data);
323 return rc; 325 return rc;
324 } 326 }
@@ -353,7 +355,7 @@ static int mb86a20s_i2c_readreg(struct mb86a20s_state *state,
353 rc = i2c_transfer(state->i2c, msg, 2); 355 rc = i2c_transfer(state->i2c, msg, 2);
354 356
355 if (rc != 2) { 357 if (rc != 2) {
356 rc("%s: reg=0x%x (rcor=%d)\n", __func__, reg, rc); 358 rc("%s: reg=0x%x (error=%d)\n", __func__, reg, rc);
357 return rc; 359 return rc;
358 } 360 }
359 361
@@ -382,23 +384,31 @@ static int mb86a20s_initfe(struct dvb_frontend *fe)
382 /* Initialize the frontend */ 384 /* Initialize the frontend */
383 rc = mb86a20s_writeregdata(state, mb86a20s_init); 385 rc = mb86a20s_writeregdata(state, mb86a20s_init);
384 if (rc < 0) 386 if (rc < 0)
385 return rc; 387 goto err;
386 388
387 if (!state->config->is_serial) { 389 if (!state->config->is_serial) {
388 regD5 &= ~1; 390 regD5 &= ~1;
389 391
390 rc = mb86a20s_writereg(state, 0x50, 0xd5); 392 rc = mb86a20s_writereg(state, 0x50, 0xd5);
391 if (rc < 0) 393 if (rc < 0)
392 return rc; 394 goto err;
393 rc = mb86a20s_writereg(state, 0x51, regD5); 395 rc = mb86a20s_writereg(state, 0x51, regD5);
394 if (rc < 0) 396 if (rc < 0)
395 return rc; 397 goto err;
396 } 398 }
397 399
398 if (fe->ops.i2c_gate_ctrl) 400 if (fe->ops.i2c_gate_ctrl)
399 fe->ops.i2c_gate_ctrl(fe, 1); 401 fe->ops.i2c_gate_ctrl(fe, 1);
400 402
401 return 0; 403err:
404 if (rc < 0) {
405 state->need_init = true;
406 printk(KERN_INFO "mb86a20s: Init failed. Will try again later\n");
407 } else {
408 state->need_init = false;
409 dprintk("Initialization succeded.\n");
410 }
411 return rc;
402} 412}
403 413
404static int mb86a20s_read_signal_strength(struct dvb_frontend *fe, u16 *strength) 414static int mb86a20s_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
@@ -485,8 +495,22 @@ static int mb86a20s_set_frontend(struct dvb_frontend *fe,
485 495
486 if (fe->ops.i2c_gate_ctrl) 496 if (fe->ops.i2c_gate_ctrl)
487 fe->ops.i2c_gate_ctrl(fe, 1); 497 fe->ops.i2c_gate_ctrl(fe, 1);
498 dprintk("Calling tuner set parameters\n");
488 fe->ops.tuner_ops.set_params(fe, p); 499 fe->ops.tuner_ops.set_params(fe, p);
489 500
501 /*
502 * Make it more reliable: if, for some reason, the initial
503 * device initialization doesn't happen, initialize it when
504 * a SBTVD parameters are adjusted.
505 *
506 * Unfortunately, due to a hard to track bug at tda829x/tda18271,
507 * the agc callback logic is not called during DVB attach time,
508 * causing mb86a20s to not be initialized with Kworld SBTVD.
509 * So, this hack is needed, in order to make Kworld SBTVD to work.
510 */
511 if (state->need_init)
512 mb86a20s_initfe(fe);
513
490 if (fe->ops.i2c_gate_ctrl) 514 if (fe->ops.i2c_gate_ctrl)
491 fe->ops.i2c_gate_ctrl(fe, 0); 515 fe->ops.i2c_gate_ctrl(fe, 0);
492 rc = mb86a20s_writeregdata(state, mb86a20s_reset_reception); 516 rc = mb86a20s_writeregdata(state, mb86a20s_reset_reception);
diff --git a/drivers/media/dvb/ttpci/av7110_ca.c b/drivers/media/dvb/ttpci/av7110_ca.c
index 122c72806916..9fc1dd0ba4c3 100644
--- a/drivers/media/dvb/ttpci/av7110_ca.c
+++ b/drivers/media/dvb/ttpci/av7110_ca.c
@@ -277,7 +277,7 @@ static int dvb_ca_ioctl(struct file *file, unsigned int cmd, void *parg)
277 { 277 {
278 ca_slot_info_t *info=(ca_slot_info_t *)parg; 278 ca_slot_info_t *info=(ca_slot_info_t *)parg;
279 279
280 if (info->num > 1) 280 if (info->num < 0 || info->num > 1)
281 return -EINVAL; 281 return -EINVAL;
282 av7110->ci_slot[info->num].num = info->num; 282 av7110->ci_slot[info->num].num = info->num;
283 av7110->ci_slot[info->num].type = FW_CI_LL_SUPPORT(av7110->arm_app) ? 283 av7110->ci_slot[info->num].type = FW_CI_LL_SUPPORT(av7110->arm_app) ?
diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig
index 3c5a4739ed70..ecdffa6aac66 100644
--- a/drivers/media/radio/Kconfig
+++ b/drivers/media/radio/Kconfig
@@ -151,20 +151,6 @@ config RADIO_GEMTEK_PROBE
151 following ports will be probed: 0x20c, 0x30c, 0x24c, 0x34c, 0x248 and 151 following ports will be probed: 0x20c, 0x30c, 0x24c, 0x34c, 0x248 and
152 0x28c. 152 0x28c.
153 153
154config RADIO_GEMTEK_PCI
155 tristate "GemTek PCI Radio Card support"
156 depends on VIDEO_V4L2 && PCI
157 ---help---
158 Choose Y here if you have this PCI FM radio card.
159
160 In order to control your radio card, you will need to use programs
161 that are compatible with the Video for Linux API. Information on
162 this API and pointers to "v4l" programs may be found at
163 <file:Documentation/video4linux/API.html>.
164
165 To compile this driver as a module, choose M here: the
166 module will be called radio-gemtek-pci.
167
168config RADIO_MAXIRADIO 154config RADIO_MAXIRADIO
169 tristate "Guillemot MAXI Radio FM 2000 radio" 155 tristate "Guillemot MAXI Radio FM 2000 radio"
170 depends on VIDEO_V4L2 && PCI 156 depends on VIDEO_V4L2 && PCI
diff --git a/drivers/media/radio/Makefile b/drivers/media/radio/Makefile
index d2970748a69f..717656d2f749 100644
--- a/drivers/media/radio/Makefile
+++ b/drivers/media/radio/Makefile
@@ -13,7 +13,6 @@ obj-$(CONFIG_RADIO_MAXIRADIO) += radio-maxiradio.o
13obj-$(CONFIG_RADIO_RTRACK) += radio-aimslab.o 13obj-$(CONFIG_RADIO_RTRACK) += radio-aimslab.o
14obj-$(CONFIG_RADIO_ZOLTRIX) += radio-zoltrix.o 14obj-$(CONFIG_RADIO_ZOLTRIX) += radio-zoltrix.o
15obj-$(CONFIG_RADIO_GEMTEK) += radio-gemtek.o 15obj-$(CONFIG_RADIO_GEMTEK) += radio-gemtek.o
16obj-$(CONFIG_RADIO_GEMTEK_PCI) += radio-gemtek-pci.o
17obj-$(CONFIG_RADIO_TRUST) += radio-trust.o 16obj-$(CONFIG_RADIO_TRUST) += radio-trust.o
18obj-$(CONFIG_I2C_SI4713) += si4713-i2c.o 17obj-$(CONFIG_I2C_SI4713) += si4713-i2c.o
19obj-$(CONFIG_RADIO_SI4713) += radio-si4713.o 18obj-$(CONFIG_RADIO_SI4713) += radio-si4713.o
diff --git a/drivers/media/radio/radio-aimslab.c b/drivers/media/radio/radio-aimslab.c
index 6cc5d130fbc8..4ce10dbeadd8 100644
--- a/drivers/media/radio/radio-aimslab.c
+++ b/drivers/media/radio/radio-aimslab.c
@@ -31,6 +31,7 @@
31#include <linux/module.h> /* Modules */ 31#include <linux/module.h> /* Modules */
32#include <linux/init.h> /* Initdata */ 32#include <linux/init.h> /* Initdata */
33#include <linux/ioport.h> /* request_region */ 33#include <linux/ioport.h> /* request_region */
34#include <linux/delay.h> /* msleep */
34#include <linux/videodev2.h> /* kernel radio structs */ 35#include <linux/videodev2.h> /* kernel radio structs */
35#include <linux/version.h> /* for KERNEL_VERSION MACRO */ 36#include <linux/version.h> /* for KERNEL_VERSION MACRO */
36#include <linux/io.h> /* outb, outb_p */ 37#include <linux/io.h> /* outb, outb_p */
diff --git a/drivers/media/radio/radio-gemtek-pci.c b/drivers/media/radio/radio-gemtek-pci.c
deleted file mode 100644
index 28fa85ba2087..000000000000
--- a/drivers/media/radio/radio-gemtek-pci.c
+++ /dev/null
@@ -1,478 +0,0 @@
1/*
2 ***************************************************************************
3 *
4 * radio-gemtek-pci.c - Gemtek PCI Radio driver
5 * (C) 2001 Vladimir Shebordaev <vshebordaev@mail.ru>
6 *
7 ***************************************************************************
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public
20 * License along with this program; if not, write to the Free
21 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
22 * USA.
23 *
24 ***************************************************************************
25 *
26 * Gemtek Corp still silently refuses to release any specifications
27 * of their multimedia devices, so the protocol still has to be
28 * reverse engineered.
29 *
30 * The v4l code was inspired by Jonas Munsin's Gemtek serial line
31 * radio device driver.
32 *
33 * Please, let me know if this piece of code was useful :)
34 *
35 * TODO: multiple device support and portability were not tested
36 *
37 * Converted to V4L2 API by Mauro Carvalho Chehab <mchehab@infradead.org>
38 *
39 ***************************************************************************
40 */
41
42#include <linux/types.h>
43#include <linux/list.h>
44#include <linux/module.h>
45#include <linux/init.h>
46#include <linux/pci.h>
47#include <linux/videodev2.h>
48#include <linux/errno.h>
49#include <linux/version.h> /* for KERNEL_VERSION MACRO */
50#include <linux/io.h>
51#include <linux/slab.h>
52#include <media/v4l2-device.h>
53#include <media/v4l2-ioctl.h>
54
55MODULE_AUTHOR("Vladimir Shebordaev <vshebordaev@mail.ru>");
56MODULE_DESCRIPTION("The video4linux driver for the Gemtek PCI Radio Card");
57MODULE_LICENSE("GPL");
58
59static int nr_radio = -1;
60static int mx = 1;
61
62module_param(mx, bool, 0);
63MODULE_PARM_DESC(mx, "single digit: 1 - turn off the turner upon module exit (default), 0 - do not");
64module_param(nr_radio, int, 0);
65MODULE_PARM_DESC(nr_radio, "video4linux device number to use");
66
67#define RADIO_VERSION KERNEL_VERSION(0, 0, 2)
68
69#ifndef PCI_VENDOR_ID_GEMTEK
70#define PCI_VENDOR_ID_GEMTEK 0x5046
71#endif
72
73#ifndef PCI_DEVICE_ID_GEMTEK_PR103
74#define PCI_DEVICE_ID_GEMTEK_PR103 0x1001
75#endif
76
77#ifndef GEMTEK_PCI_RANGE_LOW
78#define GEMTEK_PCI_RANGE_LOW (87*16000)
79#endif
80
81#ifndef GEMTEK_PCI_RANGE_HIGH
82#define GEMTEK_PCI_RANGE_HIGH (108*16000)
83#endif
84
85struct gemtek_pci {
86 struct v4l2_device v4l2_dev;
87 struct video_device vdev;
88 struct mutex lock;
89 struct pci_dev *pdev;
90
91 u32 iobase;
92 u32 length;
93
94 u32 current_frequency;
95 u8 mute;
96};
97
98static inline struct gemtek_pci *to_gemtek_pci(struct v4l2_device *v4l2_dev)
99{
100 return container_of(v4l2_dev, struct gemtek_pci, v4l2_dev);
101}
102
103static inline u8 gemtek_pci_out(u16 value, u32 port)
104{
105 outw(value, port);
106
107 return (u8)value;
108}
109
110#define _b0(v) (*((u8 *)&v))
111
112static void __gemtek_pci_cmd(u16 value, u32 port, u8 *last_byte, int keep)
113{
114 u8 byte = *last_byte;
115
116 if (!value) {
117 if (!keep)
118 value = (u16)port;
119 byte &= 0xfd;
120 } else
121 byte |= 2;
122
123 _b0(value) = byte;
124 outw(value, port);
125 byte |= 1;
126 _b0(value) = byte;
127 outw(value, port);
128 byte &= 0xfe;
129 _b0(value) = byte;
130 outw(value, port);
131
132 *last_byte = byte;
133}
134
135static inline void gemtek_pci_nil(u32 port, u8 *last_byte)
136{
137 __gemtek_pci_cmd(0x00, port, last_byte, false);
138}
139
140static inline void gemtek_pci_cmd(u16 cmd, u32 port, u8 *last_byte)
141{
142 __gemtek_pci_cmd(cmd, port, last_byte, true);
143}
144
145static void gemtek_pci_setfrequency(struct gemtek_pci *card, unsigned long frequency)
146{
147 int i;
148 u32 value = frequency / 200 + 856;
149 u16 mask = 0x8000;
150 u8 last_byte;
151 u32 port = card->iobase;
152
153 mutex_lock(&card->lock);
154 card->current_frequency = frequency;
155 last_byte = gemtek_pci_out(0x06, port);
156
157 i = 0;
158 do {
159 gemtek_pci_nil(port, &last_byte);
160 i++;
161 } while (i < 9);
162
163 i = 0;
164 do {
165 gemtek_pci_cmd(value & mask, port, &last_byte);
166 mask >>= 1;
167 i++;
168 } while (i < 16);
169
170 outw(0x10, port);
171 mutex_unlock(&card->lock);
172}
173
174
175static void gemtek_pci_mute(struct gemtek_pci *card)
176{
177 mutex_lock(&card->lock);
178 outb(0x1f, card->iobase);
179 card->mute = true;
180 mutex_unlock(&card->lock);
181}
182
183static void gemtek_pci_unmute(struct gemtek_pci *card)
184{
185 if (card->mute) {
186 gemtek_pci_setfrequency(card, card->current_frequency);
187 card->mute = false;
188 }
189}
190
191static int gemtek_pci_getsignal(struct gemtek_pci *card)
192{
193 int sig;
194
195 mutex_lock(&card->lock);
196 sig = (inb(card->iobase) & 0x08) ? 0 : 1;
197 mutex_unlock(&card->lock);
198 return sig;
199}
200
201static int vidioc_querycap(struct file *file, void *priv,
202 struct v4l2_capability *v)
203{
204 struct gemtek_pci *card = video_drvdata(file);
205
206 strlcpy(v->driver, "radio-gemtek-pci", sizeof(v->driver));
207 strlcpy(v->card, "GemTek PCI Radio", sizeof(v->card));
208 snprintf(v->bus_info, sizeof(v->bus_info), "PCI:%s", pci_name(card->pdev));
209 v->version = RADIO_VERSION;
210 v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO;
211 return 0;
212}
213
214static int vidioc_g_tuner(struct file *file, void *priv,
215 struct v4l2_tuner *v)
216{
217 struct gemtek_pci *card = video_drvdata(file);
218
219 if (v->index > 0)
220 return -EINVAL;
221
222 strlcpy(v->name, "FM", sizeof(v->name));
223 v->type = V4L2_TUNER_RADIO;
224 v->rangelow = GEMTEK_PCI_RANGE_LOW;
225 v->rangehigh = GEMTEK_PCI_RANGE_HIGH;
226 v->rxsubchans = V4L2_TUNER_SUB_MONO;
227 v->capability = V4L2_TUNER_CAP_LOW;
228 v->audmode = V4L2_TUNER_MODE_MONO;
229 v->signal = 0xffff * gemtek_pci_getsignal(card);
230 return 0;
231}
232
233static int vidioc_s_tuner(struct file *file, void *priv,
234 struct v4l2_tuner *v)
235{
236 return v->index ? -EINVAL : 0;
237}
238
239static int vidioc_s_frequency(struct file *file, void *priv,
240 struct v4l2_frequency *f)
241{
242 struct gemtek_pci *card = video_drvdata(file);
243
244 if (f->tuner != 0 || f->type != V4L2_TUNER_RADIO)
245 return -EINVAL;
246 if (f->frequency < GEMTEK_PCI_RANGE_LOW ||
247 f->frequency > GEMTEK_PCI_RANGE_HIGH)
248 return -EINVAL;
249 gemtek_pci_setfrequency(card, f->frequency);
250 card->mute = false;
251 return 0;
252}
253
254static int vidioc_g_frequency(struct file *file, void *priv,
255 struct v4l2_frequency *f)
256{
257 struct gemtek_pci *card = video_drvdata(file);
258
259 if (f->tuner != 0)
260 return -EINVAL;
261 f->type = V4L2_TUNER_RADIO;
262 f->frequency = card->current_frequency;
263 return 0;
264}
265
266static int vidioc_queryctrl(struct file *file, void *priv,
267 struct v4l2_queryctrl *qc)
268{
269 switch (qc->id) {
270 case V4L2_CID_AUDIO_MUTE:
271 return v4l2_ctrl_query_fill(qc, 0, 1, 1, 1);
272 case V4L2_CID_AUDIO_VOLUME:
273 return v4l2_ctrl_query_fill(qc, 0, 65535, 65535, 65535);
274 }
275 return -EINVAL;
276}
277
278static int vidioc_g_ctrl(struct file *file, void *priv,
279 struct v4l2_control *ctrl)
280{
281 struct gemtek_pci *card = video_drvdata(file);
282
283 switch (ctrl->id) {
284 case V4L2_CID_AUDIO_MUTE:
285 ctrl->value = card->mute;
286 return 0;
287 case V4L2_CID_AUDIO_VOLUME:
288 if (card->mute)
289 ctrl->value = 0;
290 else
291 ctrl->value = 65535;
292 return 0;
293 }
294 return -EINVAL;
295}
296
297static int vidioc_s_ctrl(struct file *file, void *priv,
298 struct v4l2_control *ctrl)
299{
300 struct gemtek_pci *card = video_drvdata(file);
301
302 switch (ctrl->id) {
303 case V4L2_CID_AUDIO_MUTE:
304 if (ctrl->value)
305 gemtek_pci_mute(card);
306 else
307 gemtek_pci_unmute(card);
308 return 0;
309 case V4L2_CID_AUDIO_VOLUME:
310 if (ctrl->value)
311 gemtek_pci_unmute(card);
312 else
313 gemtek_pci_mute(card);
314 return 0;
315 }
316 return -EINVAL;
317}
318
319static int vidioc_g_input(struct file *filp, void *priv, unsigned int *i)
320{
321 *i = 0;
322 return 0;
323}
324
325static int vidioc_s_input(struct file *filp, void *priv, unsigned int i)
326{
327 return i ? -EINVAL : 0;
328}
329
330static int vidioc_g_audio(struct file *file, void *priv,
331 struct v4l2_audio *a)
332{
333 a->index = 0;
334 strlcpy(a->name, "Radio", sizeof(a->name));
335 a->capability = V4L2_AUDCAP_STEREO;
336 return 0;
337}
338
339static int vidioc_s_audio(struct file *file, void *priv,
340 struct v4l2_audio *a)
341{
342 return a->index ? -EINVAL : 0;
343}
344
345enum {
346 GEMTEK_PR103
347};
348
349static char *card_names[] __devinitdata = {
350 "GEMTEK_PR103"
351};
352
353static struct pci_device_id gemtek_pci_id[] =
354{
355 { PCI_VENDOR_ID_GEMTEK, PCI_DEVICE_ID_GEMTEK_PR103,
356 PCI_ANY_ID, PCI_ANY_ID, 0, 0, GEMTEK_PR103 },
357 { 0 }
358};
359
360MODULE_DEVICE_TABLE(pci, gemtek_pci_id);
361
362static const struct v4l2_file_operations gemtek_pci_fops = {
363 .owner = THIS_MODULE,
364 .unlocked_ioctl = video_ioctl2,
365};
366
367static const struct v4l2_ioctl_ops gemtek_pci_ioctl_ops = {
368 .vidioc_querycap = vidioc_querycap,
369 .vidioc_g_tuner = vidioc_g_tuner,
370 .vidioc_s_tuner = vidioc_s_tuner,
371 .vidioc_g_audio = vidioc_g_audio,
372 .vidioc_s_audio = vidioc_s_audio,
373 .vidioc_g_input = vidioc_g_input,
374 .vidioc_s_input = vidioc_s_input,
375 .vidioc_g_frequency = vidioc_g_frequency,
376 .vidioc_s_frequency = vidioc_s_frequency,
377 .vidioc_queryctrl = vidioc_queryctrl,
378 .vidioc_g_ctrl = vidioc_g_ctrl,
379 .vidioc_s_ctrl = vidioc_s_ctrl,
380};
381
382static int __devinit gemtek_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
383{
384 struct gemtek_pci *card;
385 struct v4l2_device *v4l2_dev;
386 int res;
387
388 card = kzalloc(sizeof(struct gemtek_pci), GFP_KERNEL);
389 if (card == NULL) {
390 dev_err(&pdev->dev, "out of memory\n");
391 return -ENOMEM;
392 }
393
394 v4l2_dev = &card->v4l2_dev;
395 mutex_init(&card->lock);
396 card->pdev = pdev;
397
398 strlcpy(v4l2_dev->name, "gemtek_pci", sizeof(v4l2_dev->name));
399
400 res = v4l2_device_register(&pdev->dev, v4l2_dev);
401 if (res < 0) {
402 v4l2_err(v4l2_dev, "Could not register v4l2_device\n");
403 kfree(card);
404 return res;
405 }
406
407 if (pci_enable_device(pdev))
408 goto err_pci;
409
410 card->iobase = pci_resource_start(pdev, 0);
411 card->length = pci_resource_len(pdev, 0);
412
413 if (request_region(card->iobase, card->length, card_names[pci_id->driver_data]) == NULL) {
414 v4l2_err(v4l2_dev, "i/o port already in use\n");
415 goto err_pci;
416 }
417
418 strlcpy(card->vdev.name, v4l2_dev->name, sizeof(card->vdev.name));
419 card->vdev.v4l2_dev = v4l2_dev;
420 card->vdev.fops = &gemtek_pci_fops;
421 card->vdev.ioctl_ops = &gemtek_pci_ioctl_ops;
422 card->vdev.release = video_device_release_empty;
423 video_set_drvdata(&card->vdev, card);
424
425 gemtek_pci_mute(card);
426
427 if (video_register_device(&card->vdev, VFL_TYPE_RADIO, nr_radio) < 0)
428 goto err_video;
429
430 v4l2_info(v4l2_dev, "Gemtek PCI Radio (rev. %d) found at 0x%04x-0x%04x.\n",
431 pdev->revision, card->iobase, card->iobase + card->length - 1);
432
433 return 0;
434
435err_video:
436 release_region(card->iobase, card->length);
437
438err_pci:
439 v4l2_device_unregister(v4l2_dev);
440 kfree(card);
441 return -ENODEV;
442}
443
444static void __devexit gemtek_pci_remove(struct pci_dev *pdev)
445{
446 struct v4l2_device *v4l2_dev = dev_get_drvdata(&pdev->dev);
447 struct gemtek_pci *card = to_gemtek_pci(v4l2_dev);
448
449 video_unregister_device(&card->vdev);
450 v4l2_device_unregister(v4l2_dev);
451
452 release_region(card->iobase, card->length);
453
454 if (mx)
455 gemtek_pci_mute(card);
456
457 kfree(card);
458}
459
460static struct pci_driver gemtek_pci_driver = {
461 .name = "gemtek_pci",
462 .id_table = gemtek_pci_id,
463 .probe = gemtek_pci_probe,
464 .remove = __devexit_p(gemtek_pci_remove),
465};
466
467static int __init gemtek_pci_init(void)
468{
469 return pci_register_driver(&gemtek_pci_driver);
470}
471
472static void __exit gemtek_pci_exit(void)
473{
474 pci_unregister_driver(&gemtek_pci_driver);
475}
476
477module_init(gemtek_pci_init);
478module_exit(gemtek_pci_exit);
diff --git a/drivers/media/radio/radio-maxiradio.c b/drivers/media/radio/radio-maxiradio.c
index 6459a220b0dd..5c2a9058c09f 100644
--- a/drivers/media/radio/radio-maxiradio.c
+++ b/drivers/media/radio/radio-maxiradio.c
@@ -77,8 +77,8 @@ MODULE_PARM_DESC(debug, "activates debug info");
77/* TEA5757 pin mappings */ 77/* TEA5757 pin mappings */
78static const int clk = 1, data = 2, wren = 4, mo_st = 8, power = 16; 78static const int clk = 1, data = 2, wren = 4, mo_st = 8, power = 16;
79 79
80#define FREQ_LO (50 * 16000) 80#define FREQ_LO (87 * 16000)
81#define FREQ_HI (150 * 16000) 81#define FREQ_HI (108 * 16000)
82 82
83#define FREQ_IF 171200 /* 10.7*16000 */ 83#define FREQ_IF 171200 /* 10.7*16000 */
84#define FREQ_STEP 200 /* 12.5*16 */ 84#define FREQ_STEP 200 /* 12.5*16 */
diff --git a/drivers/media/radio/radio-wl1273.c b/drivers/media/radio/radio-wl1273.c
index dd6bd364efa0..7ecc8e657663 100644
--- a/drivers/media/radio/radio-wl1273.c
+++ b/drivers/media/radio/radio-wl1273.c
@@ -1407,7 +1407,7 @@ static const struct v4l2_file_operations wl1273_fops = {
1407 .read = wl1273_fm_fops_read, 1407 .read = wl1273_fm_fops_read,
1408 .write = wl1273_fm_fops_write, 1408 .write = wl1273_fm_fops_write,
1409 .poll = wl1273_fm_fops_poll, 1409 .poll = wl1273_fm_fops_poll,
1410 .ioctl = video_ioctl2, 1410 .unlocked_ioctl = video_ioctl2,
1411 .open = wl1273_fm_fops_open, 1411 .open = wl1273_fm_fops_open,
1412 .release = wl1273_fm_fops_release, 1412 .release = wl1273_fm_fops_release,
1413}; 1413};
diff --git a/drivers/media/radio/si470x/radio-si470x-common.c b/drivers/media/radio/si470x/radio-si470x-common.c
index ac76dfe5b3fa..60c176fe328e 100644
--- a/drivers/media/radio/si470x/radio-si470x-common.c
+++ b/drivers/media/radio/si470x/radio-si470x-common.c
@@ -357,7 +357,8 @@ int si470x_start(struct si470x_device *radio)
357 goto done; 357 goto done;
358 358
359 /* sysconfig 1 */ 359 /* sysconfig 1 */
360 radio->registers[SYSCONFIG1] = SYSCONFIG1_DE; 360 radio->registers[SYSCONFIG1] =
361 (de << 11) & SYSCONFIG1_DE; /* DE*/
361 retval = si470x_set_register(radio, SYSCONFIG1); 362 retval = si470x_set_register(radio, SYSCONFIG1);
362 if (retval < 0) 363 if (retval < 0)
363 goto done; 364 goto done;
@@ -687,12 +688,8 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv,
687 /* driver constants */ 688 /* driver constants */
688 strcpy(tuner->name, "FM"); 689 strcpy(tuner->name, "FM");
689 tuner->type = V4L2_TUNER_RADIO; 690 tuner->type = V4L2_TUNER_RADIO;
690#if defined(CONFIG_USB_SI470X) || defined(CONFIG_USB_SI470X_MODULE)
691 tuner->capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO | 691 tuner->capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO |
692 V4L2_TUNER_CAP_RDS | V4L2_TUNER_CAP_RDS_BLOCK_IO; 692 V4L2_TUNER_CAP_RDS | V4L2_TUNER_CAP_RDS_BLOCK_IO;
693#else
694 tuner->capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO;
695#endif
696 693
697 /* range limits */ 694 /* range limits */
698 switch ((radio->registers[SYSCONFIG2] & SYSCONFIG2_BAND) >> 6) { 695 switch ((radio->registers[SYSCONFIG2] & SYSCONFIG2_BAND) >> 6) {
@@ -718,12 +715,10 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv,
718 tuner->rxsubchans = V4L2_TUNER_SUB_MONO; 715 tuner->rxsubchans = V4L2_TUNER_SUB_MONO;
719 else 716 else
720 tuner->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; 717 tuner->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO;
721#if defined(CONFIG_USB_SI470X) || defined(CONFIG_USB_SI470X_MODULE)
722 /* If there is a reliable method of detecting an RDS channel, 718 /* If there is a reliable method of detecting an RDS channel,
723 then this code should check for that before setting this 719 then this code should check for that before setting this
724 RDS subchannel. */ 720 RDS subchannel. */
725 tuner->rxsubchans |= V4L2_TUNER_SUB_RDS; 721 tuner->rxsubchans |= V4L2_TUNER_SUB_RDS;
726#endif
727 722
728 /* mono/stereo selector */ 723 /* mono/stereo selector */
729 if ((radio->registers[POWERCFG] & POWERCFG_MONO) == 0) 724 if ((radio->registers[POWERCFG] & POWERCFG_MONO) == 0)
diff --git a/drivers/media/rc/ene_ir.c b/drivers/media/rc/ene_ir.c
index 80b3c319f698..1ac49139158d 100644
--- a/drivers/media/rc/ene_ir.c
+++ b/drivers/media/rc/ene_ir.c
@@ -446,27 +446,27 @@ static void ene_rx_setup(struct ene_device *dev)
446 446
447select_timeout: 447select_timeout:
448 if (dev->rx_fan_input_inuse) { 448 if (dev->rx_fan_input_inuse) {
449 dev->rdev->rx_resolution = MS_TO_NS(ENE_FW_SAMPLE_PERIOD_FAN); 449 dev->rdev->rx_resolution = US_TO_NS(ENE_FW_SAMPLE_PERIOD_FAN);
450 450
451 /* Fan input doesn't support timeouts, it just ends the 451 /* Fan input doesn't support timeouts, it just ends the
452 input with a maximum sample */ 452 input with a maximum sample */
453 dev->rdev->min_timeout = dev->rdev->max_timeout = 453 dev->rdev->min_timeout = dev->rdev->max_timeout =
454 MS_TO_NS(ENE_FW_SMPL_BUF_FAN_MSK * 454 US_TO_NS(ENE_FW_SMPL_BUF_FAN_MSK *
455 ENE_FW_SAMPLE_PERIOD_FAN); 455 ENE_FW_SAMPLE_PERIOD_FAN);
456 } else { 456 } else {
457 dev->rdev->rx_resolution = MS_TO_NS(sample_period); 457 dev->rdev->rx_resolution = US_TO_NS(sample_period);
458 458
459 /* Theoreticly timeout is unlimited, but we cap it 459 /* Theoreticly timeout is unlimited, but we cap it
460 * because it was seen that on one device, it 460 * because it was seen that on one device, it
461 * would stop sending spaces after around 250 msec. 461 * would stop sending spaces after around 250 msec.
462 * Besides, this is close to 2^32 anyway and timeout is u32. 462 * Besides, this is close to 2^32 anyway and timeout is u32.
463 */ 463 */
464 dev->rdev->min_timeout = MS_TO_NS(127 * sample_period); 464 dev->rdev->min_timeout = US_TO_NS(127 * sample_period);
465 dev->rdev->max_timeout = MS_TO_NS(200000); 465 dev->rdev->max_timeout = US_TO_NS(200000);
466 } 466 }
467 467
468 if (dev->hw_learning_and_tx_capable) 468 if (dev->hw_learning_and_tx_capable)
469 dev->rdev->tx_resolution = MS_TO_NS(sample_period); 469 dev->rdev->tx_resolution = US_TO_NS(sample_period);
470 470
471 if (dev->rdev->timeout > dev->rdev->max_timeout) 471 if (dev->rdev->timeout > dev->rdev->max_timeout)
472 dev->rdev->timeout = dev->rdev->max_timeout; 472 dev->rdev->timeout = dev->rdev->max_timeout;
@@ -801,7 +801,7 @@ static irqreturn_t ene_isr(int irq, void *data)
801 801
802 dbg("RX: %d (%s)", hw_sample, pulse ? "pulse" : "space"); 802 dbg("RX: %d (%s)", hw_sample, pulse ? "pulse" : "space");
803 803
804 ev.duration = MS_TO_NS(hw_sample); 804 ev.duration = US_TO_NS(hw_sample);
805 ev.pulse = pulse; 805 ev.pulse = pulse;
806 ir_raw_event_store_with_filter(dev->rdev, &ev); 806 ir_raw_event_store_with_filter(dev->rdev, &ev);
807 } 807 }
@@ -821,7 +821,7 @@ static void ene_setup_default_settings(struct ene_device *dev)
821 dev->learning_mode_enabled = learning_mode_force; 821 dev->learning_mode_enabled = learning_mode_force;
822 822
823 /* Set reasonable default timeout */ 823 /* Set reasonable default timeout */
824 dev->rdev->timeout = MS_TO_NS(150000); 824 dev->rdev->timeout = US_TO_NS(150000);
825} 825}
826 826
827/* Upload all hardware settings at once. Used at load and resume time */ 827/* Upload all hardware settings at once. Used at load and resume time */
@@ -1004,6 +1004,10 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
1004 /* validate resources */ 1004 /* validate resources */
1005 error = -ENODEV; 1005 error = -ENODEV;
1006 1006
1007 /* init these to -1, as 0 is valid for both */
1008 dev->hw_io = -1;
1009 dev->irq = -1;
1010
1007 if (!pnp_port_valid(pnp_dev, 0) || 1011 if (!pnp_port_valid(pnp_dev, 0) ||
1008 pnp_port_len(pnp_dev, 0) < ENE_IO_SIZE) 1012 pnp_port_len(pnp_dev, 0) < ENE_IO_SIZE)
1009 goto error; 1013 goto error;
@@ -1072,6 +1076,8 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
1072 rdev->input_name = "ENE eHome Infrared Remote Transceiver"; 1076 rdev->input_name = "ENE eHome Infrared Remote Transceiver";
1073 } 1077 }
1074 1078
1079 dev->rdev = rdev;
1080
1075 ene_rx_setup_hw_buffer(dev); 1081 ene_rx_setup_hw_buffer(dev);
1076 ene_setup_default_settings(dev); 1082 ene_setup_default_settings(dev);
1077 ene_setup_hw_settings(dev); 1083 ene_setup_hw_settings(dev);
@@ -1083,7 +1089,6 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
1083 if (error < 0) 1089 if (error < 0)
1084 goto error; 1090 goto error;
1085 1091
1086 dev->rdev = rdev;
1087 ene_notice("driver has been succesfully loaded"); 1092 ene_notice("driver has been succesfully loaded");
1088 return 0; 1093 return 0;
1089error: 1094error:
diff --git a/drivers/media/rc/ene_ir.h b/drivers/media/rc/ene_ir.h
index c179baf34cb4..337a41d4450b 100644
--- a/drivers/media/rc/ene_ir.h
+++ b/drivers/media/rc/ene_ir.h
@@ -201,8 +201,6 @@
201#define dbg_verbose(format, ...) __dbg(2, format, ## __VA_ARGS__) 201#define dbg_verbose(format, ...) __dbg(2, format, ## __VA_ARGS__)
202#define dbg_regs(format, ...) __dbg(3, format, ## __VA_ARGS__) 202#define dbg_regs(format, ...) __dbg(3, format, ## __VA_ARGS__)
203 203
204#define MS_TO_NS(msec) ((msec) * 1000)
205
206struct ene_device { 204struct ene_device {
207 struct pnp_dev *pnp_dev; 205 struct pnp_dev *pnp_dev;
208 struct rc_dev *rdev; 206 struct rc_dev *rdev;
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index 6811512b4e83..e7dc6b46fdfa 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -988,7 +988,6 @@ static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type)
988 int retval; 988 int retval;
989 struct imon_context *ictx = rc->priv; 989 struct imon_context *ictx = rc->priv;
990 struct device *dev = ictx->dev; 990 struct device *dev = ictx->dev;
991 bool pad_mouse;
992 unsigned char ir_proto_packet[] = { 991 unsigned char ir_proto_packet[] = {
993 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86 }; 992 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86 };
994 993
@@ -1000,29 +999,20 @@ static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type)
1000 case RC_TYPE_RC6: 999 case RC_TYPE_RC6:
1001 dev_dbg(dev, "Configuring IR receiver for MCE protocol\n"); 1000 dev_dbg(dev, "Configuring IR receiver for MCE protocol\n");
1002 ir_proto_packet[0] = 0x01; 1001 ir_proto_packet[0] = 0x01;
1003 pad_mouse = false;
1004 break; 1002 break;
1005 case RC_TYPE_UNKNOWN: 1003 case RC_TYPE_UNKNOWN:
1006 case RC_TYPE_OTHER: 1004 case RC_TYPE_OTHER:
1007 dev_dbg(dev, "Configuring IR receiver for iMON protocol\n"); 1005 dev_dbg(dev, "Configuring IR receiver for iMON protocol\n");
1008 if (pad_stabilize && !nomouse) 1006 if (!pad_stabilize)
1009 pad_mouse = true;
1010 else {
1011 dev_dbg(dev, "PAD stabilize functionality disabled\n"); 1007 dev_dbg(dev, "PAD stabilize functionality disabled\n");
1012 pad_mouse = false;
1013 }
1014 /* ir_proto_packet[0] = 0x00; // already the default */ 1008 /* ir_proto_packet[0] = 0x00; // already the default */
1015 rc_type = RC_TYPE_OTHER; 1009 rc_type = RC_TYPE_OTHER;
1016 break; 1010 break;
1017 default: 1011 default:
1018 dev_warn(dev, "Unsupported IR protocol specified, overriding " 1012 dev_warn(dev, "Unsupported IR protocol specified, overriding "
1019 "to iMON IR protocol\n"); 1013 "to iMON IR protocol\n");
1020 if (pad_stabilize && !nomouse) 1014 if (!pad_stabilize)
1021 pad_mouse = true;
1022 else {
1023 dev_dbg(dev, "PAD stabilize functionality disabled\n"); 1015 dev_dbg(dev, "PAD stabilize functionality disabled\n");
1024 pad_mouse = false;
1025 }
1026 /* ir_proto_packet[0] = 0x00; // already the default */ 1016 /* ir_proto_packet[0] = 0x00; // already the default */
1027 rc_type = RC_TYPE_OTHER; 1017 rc_type = RC_TYPE_OTHER;
1028 break; 1018 break;
@@ -1035,7 +1025,7 @@ static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type)
1035 goto out; 1025 goto out;
1036 1026
1037 ictx->rc_type = rc_type; 1027 ictx->rc_type = rc_type;
1038 ictx->pad_mouse = pad_mouse; 1028 ictx->pad_mouse = false;
1039 1029
1040out: 1030out:
1041 return retval; 1031 return retval;
@@ -1517,7 +1507,7 @@ static void imon_incoming_packet(struct imon_context *ictx,
1517 spin_unlock_irqrestore(&ictx->kc_lock, flags); 1507 spin_unlock_irqrestore(&ictx->kc_lock, flags);
1518 return; 1508 return;
1519 } else { 1509 } else {
1520 ictx->pad_mouse = 0; 1510 ictx->pad_mouse = false;
1521 dev_dbg(dev, "mouse mode disabled, passing key value\n"); 1511 dev_dbg(dev, "mouse mode disabled, passing key value\n");
1522 } 1512 }
1523 } 1513 }
@@ -1756,7 +1746,6 @@ static void imon_get_ffdc_type(struct imon_context *ictx)
1756 printk(KERN_CONT " (id 0x%02x)\n", ffdc_cfg_byte); 1746 printk(KERN_CONT " (id 0x%02x)\n", ffdc_cfg_byte);
1757 1747
1758 ictx->display_type = detected_display_type; 1748 ictx->display_type = detected_display_type;
1759 ictx->rdev->allowed_protos = allowed_protos;
1760 ictx->rc_type = allowed_protos; 1749 ictx->rc_type = allowed_protos;
1761} 1750}
1762 1751
@@ -1839,10 +1828,6 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx)
1839 rdev->allowed_protos = RC_TYPE_OTHER | RC_TYPE_RC6; /* iMON PAD or MCE */ 1828 rdev->allowed_protos = RC_TYPE_OTHER | RC_TYPE_RC6; /* iMON PAD or MCE */
1840 rdev->change_protocol = imon_ir_change_protocol; 1829 rdev->change_protocol = imon_ir_change_protocol;
1841 rdev->driver_name = MOD_NAME; 1830 rdev->driver_name = MOD_NAME;
1842 if (ictx->rc_type == RC_TYPE_RC6)
1843 rdev->map_name = RC_MAP_IMON_MCE;
1844 else
1845 rdev->map_name = RC_MAP_IMON_PAD;
1846 1831
1847 /* Enable front-panel buttons and/or knobs */ 1832 /* Enable front-panel buttons and/or knobs */
1848 memcpy(ictx->usb_tx_buf, &fp_packet, sizeof(fp_packet)); 1833 memcpy(ictx->usb_tx_buf, &fp_packet, sizeof(fp_packet));
@@ -1851,11 +1836,18 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx)
1851 if (ret) 1836 if (ret)
1852 dev_info(ictx->dev, "panel buttons/knobs setup failed\n"); 1837 dev_info(ictx->dev, "panel buttons/knobs setup failed\n");
1853 1838
1854 if (ictx->product == 0xffdc) 1839 if (ictx->product == 0xffdc) {
1855 imon_get_ffdc_type(ictx); 1840 imon_get_ffdc_type(ictx);
1841 rdev->allowed_protos = ictx->rc_type;
1842 }
1856 1843
1857 imon_set_display_type(ictx); 1844 imon_set_display_type(ictx);
1858 1845
1846 if (ictx->rc_type == RC_TYPE_RC6)
1847 rdev->map_name = RC_MAP_IMON_MCE;
1848 else
1849 rdev->map_name = RC_MAP_IMON_PAD;
1850
1859 ret = rc_register_device(rdev); 1851 ret = rc_register_device(rdev);
1860 if (ret < 0) { 1852 if (ret < 0) {
1861 dev_err(ictx->dev, "remote input dev register failed\n"); 1853 dev_err(ictx->dev, "remote input dev register failed\n");
@@ -2108,18 +2100,6 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf)
2108 goto find_endpoint_failed; 2100 goto find_endpoint_failed;
2109 } 2101 }
2110 2102
2111 ictx->idev = imon_init_idev(ictx);
2112 if (!ictx->idev) {
2113 dev_err(dev, "%s: input device setup failed\n", __func__);
2114 goto idev_setup_failed;
2115 }
2116
2117 ictx->rdev = imon_init_rdev(ictx);
2118 if (!ictx->rdev) {
2119 dev_err(dev, "%s: rc device setup failed\n", __func__);
2120 goto rdev_setup_failed;
2121 }
2122
2123 usb_fill_int_urb(ictx->rx_urb_intf0, ictx->usbdev_intf0, 2103 usb_fill_int_urb(ictx->rx_urb_intf0, ictx->usbdev_intf0,
2124 usb_rcvintpipe(ictx->usbdev_intf0, 2104 usb_rcvintpipe(ictx->usbdev_intf0,
2125 ictx->rx_endpoint_intf0->bEndpointAddress), 2105 ictx->rx_endpoint_intf0->bEndpointAddress),
@@ -2133,13 +2113,25 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf)
2133 goto urb_submit_failed; 2113 goto urb_submit_failed;
2134 } 2114 }
2135 2115
2116 ictx->idev = imon_init_idev(ictx);
2117 if (!ictx->idev) {
2118 dev_err(dev, "%s: input device setup failed\n", __func__);
2119 goto idev_setup_failed;
2120 }
2121
2122 ictx->rdev = imon_init_rdev(ictx);
2123 if (!ictx->rdev) {
2124 dev_err(dev, "%s: rc device setup failed\n", __func__);
2125 goto rdev_setup_failed;
2126 }
2127
2136 return ictx; 2128 return ictx;
2137 2129
2138urb_submit_failed:
2139 rc_unregister_device(ictx->rdev);
2140rdev_setup_failed: 2130rdev_setup_failed:
2141 input_unregister_device(ictx->idev); 2131 input_unregister_device(ictx->idev);
2142idev_setup_failed: 2132idev_setup_failed:
2133 usb_kill_urb(ictx->rx_urb_intf0);
2134urb_submit_failed:
2143find_endpoint_failed: 2135find_endpoint_failed:
2144 mutex_unlock(&ictx->lock); 2136 mutex_unlock(&ictx->lock);
2145 usb_free_urb(tx_urb); 2137 usb_free_urb(tx_urb);
diff --git a/drivers/media/rc/ir-raw.c b/drivers/media/rc/ir-raw.c
index 185baddcbf14..73230ff93b8a 100644
--- a/drivers/media/rc/ir-raw.c
+++ b/drivers/media/rc/ir-raw.c
@@ -233,7 +233,7 @@ EXPORT_SYMBOL_GPL(ir_raw_event_handle);
233 233
234/* used internally by the sysfs interface */ 234/* used internally by the sysfs interface */
235u64 235u64
236ir_raw_get_allowed_protocols() 236ir_raw_get_allowed_protocols(void)
237{ 237{
238 u64 protocols; 238 u64 protocols;
239 mutex_lock(&ir_raw_handler_lock); 239 mutex_lock(&ir_raw_handler_lock);
diff --git a/drivers/media/rc/keymaps/rc-dib0700-nec.c b/drivers/media/rc/keymaps/rc-dib0700-nec.c
index c59851b203da..7a5f5300caf9 100644
--- a/drivers/media/rc/keymaps/rc-dib0700-nec.c
+++ b/drivers/media/rc/keymaps/rc-dib0700-nec.c
@@ -19,35 +19,35 @@
19 19
20static struct rc_map_table dib0700_nec_table[] = { 20static struct rc_map_table dib0700_nec_table[] = {
21 /* Key codes for the Pixelview SBTVD remote */ 21 /* Key codes for the Pixelview SBTVD remote */
22 { 0x8613, KEY_MUTE }, 22 { 0x866b13, KEY_MUTE },
23 { 0x8612, KEY_POWER }, 23 { 0x866b12, KEY_POWER },
24 { 0x8601, KEY_1 }, 24 { 0x866b01, KEY_1 },
25 { 0x8602, KEY_2 }, 25 { 0x866b02, KEY_2 },
26 { 0x8603, KEY_3 }, 26 { 0x866b03, KEY_3 },
27 { 0x8604, KEY_4 }, 27 { 0x866b04, KEY_4 },
28 { 0x8605, KEY_5 }, 28 { 0x866b05, KEY_5 },
29 { 0x8606, KEY_6 }, 29 { 0x866b06, KEY_6 },
30 { 0x8607, KEY_7 }, 30 { 0x866b07, KEY_7 },
31 { 0x8608, KEY_8 }, 31 { 0x866b08, KEY_8 },
32 { 0x8609, KEY_9 }, 32 { 0x866b09, KEY_9 },
33 { 0x8600, KEY_0 }, 33 { 0x866b00, KEY_0 },
34 { 0x860d, KEY_CHANNELUP }, 34 { 0x866b0d, KEY_CHANNELUP },
35 { 0x8619, KEY_CHANNELDOWN }, 35 { 0x866b19, KEY_CHANNELDOWN },
36 { 0x8610, KEY_VOLUMEUP }, 36 { 0x866b10, KEY_VOLUMEUP },
37 { 0x860c, KEY_VOLUMEDOWN }, 37 { 0x866b0c, KEY_VOLUMEDOWN },
38 38
39 { 0x860a, KEY_CAMERA }, 39 { 0x866b0a, KEY_CAMERA },
40 { 0x860b, KEY_ZOOM }, 40 { 0x866b0b, KEY_ZOOM },
41 { 0x861b, KEY_BACKSPACE }, 41 { 0x866b1b, KEY_BACKSPACE },
42 { 0x8615, KEY_ENTER }, 42 { 0x866b15, KEY_ENTER },
43 43
44 { 0x861d, KEY_UP }, 44 { 0x866b1d, KEY_UP },
45 { 0x861e, KEY_DOWN }, 45 { 0x866b1e, KEY_DOWN },
46 { 0x860e, KEY_LEFT }, 46 { 0x866b0e, KEY_LEFT },
47 { 0x860f, KEY_RIGHT }, 47 { 0x866b0f, KEY_RIGHT },
48 48
49 { 0x8618, KEY_RECORD }, 49 { 0x866b18, KEY_RECORD },
50 { 0x861a, KEY_STOP }, 50 { 0x866b1a, KEY_STOP },
51 51
52 /* Key codes for the EvolutePC TVWay+ remote */ 52 /* Key codes for the EvolutePC TVWay+ remote */
53 { 0x7a00, KEY_MENU }, 53 { 0x7a00, KEY_MENU },
diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index 0fef6efad537..079353e5d558 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -48,7 +48,6 @@
48#define USB_BUFLEN 32 /* USB reception buffer length */ 48#define USB_BUFLEN 32 /* USB reception buffer length */
49#define USB_CTRL_MSG_SZ 2 /* Size of usb ctrl msg on gen1 hw */ 49#define USB_CTRL_MSG_SZ 2 /* Size of usb ctrl msg on gen1 hw */
50#define MCE_G1_INIT_MSGS 40 /* Init messages on gen1 hw to throw out */ 50#define MCE_G1_INIT_MSGS 40 /* Init messages on gen1 hw to throw out */
51#define MS_TO_NS(msec) ((msec) * 1000)
52 51
53/* MCE constants */ 52/* MCE constants */
54#define MCE_CMDBUF_SIZE 384 /* MCE Command buffer length */ 53#define MCE_CMDBUF_SIZE 384 /* MCE Command buffer length */
@@ -858,7 +857,7 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len)
858 ir->rem--; 857 ir->rem--;
859 rawir.pulse = ((ir->buf_in[i] & MCE_PULSE_BIT) != 0); 858 rawir.pulse = ((ir->buf_in[i] & MCE_PULSE_BIT) != 0);
860 rawir.duration = (ir->buf_in[i] & MCE_PULSE_MASK) 859 rawir.duration = (ir->buf_in[i] & MCE_PULSE_MASK)
861 * MS_TO_NS(MCE_TIME_UNIT); 860 * MS_TO_US(MCE_TIME_UNIT);
862 861
863 dev_dbg(ir->dev, "Storing %s with duration %d\n", 862 dev_dbg(ir->dev, "Storing %s with duration %d\n",
864 rawir.pulse ? "pulse" : "space", 863 rawir.pulse ? "pulse" : "space",
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index eb875af05e79..aa021600e9df 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -78,7 +78,7 @@ config VIDEO_FIXED_MINOR_RANGES
78 78
79config VIDEO_HELPER_CHIPS_AUTO 79config VIDEO_HELPER_CHIPS_AUTO
80 bool "Autoselect pertinent encoders/decoders and other helper chips" 80 bool "Autoselect pertinent encoders/decoders and other helper chips"
81 default y if !EMBEDDED 81 default y if !EXPERT
82 ---help--- 82 ---help---
83 Most video cards may require additional modules to encode or 83 Most video cards may require additional modules to encode or
84 decode audio/video standards. This option will autoselect 84 decode audio/video standards. This option will autoselect
@@ -141,15 +141,6 @@ config VIDEO_TDA9840
141 To compile this driver as a module, choose M here: the 141 To compile this driver as a module, choose M here: the
142 module will be called tda9840. 142 module will be called tda9840.
143 143
144config VIDEO_TDA9875
145 tristate "Philips TDA9875 audio processor"
146 depends on VIDEO_V4L2 && I2C
147 ---help---
148 Support for tda9875 audio decoder chip found on some bt8xx boards.
149
150 To compile this driver as a module, choose M here: the
151 module will be called tda9875.
152
153config VIDEO_TEA6415C 144config VIDEO_TEA6415C
154 tristate "Philips TEA6415C audio processor" 145 tristate "Philips TEA6415C audio processor"
155 depends on I2C 146 depends on I2C
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index 81e38cb0b846..a509d317e258 100644
--- a/drivers/media/video/Makefile
+++ b/drivers/media/video/Makefile
@@ -27,7 +27,6 @@ obj-$(CONFIG_VIDEO_V4L2_COMMON) += v4l2-common.o
27obj-$(CONFIG_VIDEO_TUNER) += tuner.o 27obj-$(CONFIG_VIDEO_TUNER) += tuner.o
28obj-$(CONFIG_VIDEO_TVAUDIO) += tvaudio.o 28obj-$(CONFIG_VIDEO_TVAUDIO) += tvaudio.o
29obj-$(CONFIG_VIDEO_TDA7432) += tda7432.o 29obj-$(CONFIG_VIDEO_TDA7432) += tda7432.o
30obj-$(CONFIG_VIDEO_TDA9875) += tda9875.o
31obj-$(CONFIG_VIDEO_SAA6588) += saa6588.o 30obj-$(CONFIG_VIDEO_SAA6588) += saa6588.o
32obj-$(CONFIG_VIDEO_TDA9840) += tda9840.o 31obj-$(CONFIG_VIDEO_TDA9840) += tda9840.o
33obj-$(CONFIG_VIDEO_TEA6415C) += tea6415c.o 32obj-$(CONFIG_VIDEO_TEA6415C) += tea6415c.o
diff --git a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c
index f318b51448b3..d2327dbb473f 100644
--- a/drivers/media/video/adv7175.c
+++ b/drivers/media/video/adv7175.c
@@ -303,11 +303,22 @@ static int adv7175_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ide
303 return v4l2_chip_ident_i2c_client(client, chip, V4L2_IDENT_ADV7175, 0); 303 return v4l2_chip_ident_i2c_client(client, chip, V4L2_IDENT_ADV7175, 0);
304} 304}
305 305
306static int adv7175_s_power(struct v4l2_subdev *sd, int on)
307{
308 if (on)
309 adv7175_write(sd, 0x01, 0x00);
310 else
311 adv7175_write(sd, 0x01, 0x78);
312
313 return 0;
314}
315
306/* ----------------------------------------------------------------------- */ 316/* ----------------------------------------------------------------------- */
307 317
308static const struct v4l2_subdev_core_ops adv7175_core_ops = { 318static const struct v4l2_subdev_core_ops adv7175_core_ops = {
309 .g_chip_ident = adv7175_g_chip_ident, 319 .g_chip_ident = adv7175_g_chip_ident,
310 .init = adv7175_init, 320 .init = adv7175_init,
321 .s_power = adv7175_s_power,
311}; 322};
312 323
313static const struct v4l2_subdev_video_ops adv7175_video_ops = { 324static const struct v4l2_subdev_video_ops adv7175_video_ops = {
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c
index 49efcf660ba6..7f58756d72c8 100644
--- a/drivers/media/video/bt8xx/bttv-cards.c
+++ b/drivers/media/video/bt8xx/bttv-cards.c
@@ -1373,7 +1373,6 @@ struct tvcard bttv_tvcards[] = {
1373 .gpiomute = 0x1800, 1373 .gpiomute = 0x1800,
1374 .audio_mode_gpio= fv2000s_audio, 1374 .audio_mode_gpio= fv2000s_audio,
1375 .no_msp34xx = 1, 1375 .no_msp34xx = 1,
1376 .no_tda9875 = 1,
1377 .needs_tvaudio = 1, 1376 .needs_tvaudio = 1,
1378 .pll = PLL_28, 1377 .pll = PLL_28,
1379 .tuner_type = TUNER_PHILIPS_PAL, 1378 .tuner_type = TUNER_PHILIPS_PAL,
@@ -1511,7 +1510,6 @@ struct tvcard bttv_tvcards[] = {
1511 .gpiomute = 0x09, 1510 .gpiomute = 0x09,
1512 .needs_tvaudio = 1, 1511 .needs_tvaudio = 1,
1513 .no_msp34xx = 1, 1512 .no_msp34xx = 1,
1514 .no_tda9875 = 1,
1515 .pll = PLL_28, 1513 .pll = PLL_28,
1516 .tuner_type = TUNER_PHILIPS_PAL, 1514 .tuner_type = TUNER_PHILIPS_PAL,
1517 .tuner_addr = ADDR_UNSET, 1515 .tuner_addr = ADDR_UNSET,
@@ -1550,7 +1548,6 @@ struct tvcard bttv_tvcards[] = {
1550 .gpiomask2 = 0x07ff, 1548 .gpiomask2 = 0x07ff,
1551 .muxsel = MUXSEL(3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3), 1549 .muxsel = MUXSEL(3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3),
1552 .no_msp34xx = 1, 1550 .no_msp34xx = 1,
1553 .no_tda9875 = 1,
1554 .tuner_type = TUNER_ABSENT, 1551 .tuner_type = TUNER_ABSENT,
1555 .tuner_addr = ADDR_UNSET, 1552 .tuner_addr = ADDR_UNSET,
1556 .muxsel_hook = rv605_muxsel, 1553 .muxsel_hook = rv605_muxsel,
@@ -1686,7 +1683,6 @@ struct tvcard bttv_tvcards[] = {
1686 .tuner_type = TUNER_ABSENT, 1683 .tuner_type = TUNER_ABSENT,
1687 .tuner_addr = ADDR_UNSET, 1684 .tuner_addr = ADDR_UNSET,
1688 .no_msp34xx = 1, 1685 .no_msp34xx = 1,
1689 .no_tda9875 = 1,
1690 .no_tda7432 = 1, 1686 .no_tda7432 = 1,
1691 }, 1687 },
1692 [BTTV_BOARD_OSPREY1x0_848] = { 1688 [BTTV_BOARD_OSPREY1x0_848] = {
@@ -1699,7 +1695,6 @@ struct tvcard bttv_tvcards[] = {
1699 .tuner_type = TUNER_ABSENT, 1695 .tuner_type = TUNER_ABSENT,
1700 .tuner_addr = ADDR_UNSET, 1696 .tuner_addr = ADDR_UNSET,
1701 .no_msp34xx = 1, 1697 .no_msp34xx = 1,
1702 .no_tda9875 = 1,
1703 .no_tda7432 = 1, 1698 .no_tda7432 = 1,
1704 }, 1699 },
1705 1700
@@ -1714,7 +1709,6 @@ struct tvcard bttv_tvcards[] = {
1714 .tuner_type = TUNER_ABSENT, 1709 .tuner_type = TUNER_ABSENT,
1715 .tuner_addr = ADDR_UNSET, 1710 .tuner_addr = ADDR_UNSET,
1716 .no_msp34xx = 1, 1711 .no_msp34xx = 1,
1717 .no_tda9875 = 1,
1718 .no_tda7432 = 1, 1712 .no_tda7432 = 1,
1719 }, 1713 },
1720 [BTTV_BOARD_OSPREY1x1] = { 1714 [BTTV_BOARD_OSPREY1x1] = {
@@ -1727,7 +1721,6 @@ struct tvcard bttv_tvcards[] = {
1727 .tuner_type = TUNER_ABSENT, 1721 .tuner_type = TUNER_ABSENT,
1728 .tuner_addr = ADDR_UNSET, 1722 .tuner_addr = ADDR_UNSET,
1729 .no_msp34xx = 1, 1723 .no_msp34xx = 1,
1730 .no_tda9875 = 1,
1731 .no_tda7432 = 1, 1724 .no_tda7432 = 1,
1732 }, 1725 },
1733 [BTTV_BOARD_OSPREY1x1_SVID] = { 1726 [BTTV_BOARD_OSPREY1x1_SVID] = {
@@ -1740,7 +1733,6 @@ struct tvcard bttv_tvcards[] = {
1740 .tuner_type = TUNER_ABSENT, 1733 .tuner_type = TUNER_ABSENT,
1741 .tuner_addr = ADDR_UNSET, 1734 .tuner_addr = ADDR_UNSET,
1742 .no_msp34xx = 1, 1735 .no_msp34xx = 1,
1743 .no_tda9875 = 1,
1744 .no_tda7432 = 1, 1736 .no_tda7432 = 1,
1745 }, 1737 },
1746 [BTTV_BOARD_OSPREY2xx] = { 1738 [BTTV_BOARD_OSPREY2xx] = {
@@ -1753,7 +1745,6 @@ struct tvcard bttv_tvcards[] = {
1753 .tuner_type = TUNER_ABSENT, 1745 .tuner_type = TUNER_ABSENT,
1754 .tuner_addr = ADDR_UNSET, 1746 .tuner_addr = ADDR_UNSET,
1755 .no_msp34xx = 1, 1747 .no_msp34xx = 1,
1756 .no_tda9875 = 1,
1757 .no_tda7432 = 1, 1748 .no_tda7432 = 1,
1758 }, 1749 },
1759 1750
@@ -1768,7 +1759,6 @@ struct tvcard bttv_tvcards[] = {
1768 .tuner_type = TUNER_ABSENT, 1759 .tuner_type = TUNER_ABSENT,
1769 .tuner_addr = ADDR_UNSET, 1760 .tuner_addr = ADDR_UNSET,
1770 .no_msp34xx = 1, 1761 .no_msp34xx = 1,
1771 .no_tda9875 = 1,
1772 .no_tda7432 = 1, 1762 .no_tda7432 = 1,
1773 }, 1763 },
1774 [BTTV_BOARD_OSPREY2x0] = { 1764 [BTTV_BOARD_OSPREY2x0] = {
@@ -1781,7 +1771,6 @@ struct tvcard bttv_tvcards[] = {
1781 .tuner_type = TUNER_ABSENT, 1771 .tuner_type = TUNER_ABSENT,
1782 .tuner_addr = ADDR_UNSET, 1772 .tuner_addr = ADDR_UNSET,
1783 .no_msp34xx = 1, 1773 .no_msp34xx = 1,
1784 .no_tda9875 = 1,
1785 .no_tda7432 = 1, 1774 .no_tda7432 = 1,
1786 }, 1775 },
1787 [BTTV_BOARD_OSPREY500] = { 1776 [BTTV_BOARD_OSPREY500] = {
@@ -1794,7 +1783,6 @@ struct tvcard bttv_tvcards[] = {
1794 .tuner_type = TUNER_ABSENT, 1783 .tuner_type = TUNER_ABSENT,
1795 .tuner_addr = ADDR_UNSET, 1784 .tuner_addr = ADDR_UNSET,
1796 .no_msp34xx = 1, 1785 .no_msp34xx = 1,
1797 .no_tda9875 = 1,
1798 .no_tda7432 = 1, 1786 .no_tda7432 = 1,
1799 }, 1787 },
1800 [BTTV_BOARD_OSPREY540] = { 1788 [BTTV_BOARD_OSPREY540] = {
@@ -1805,7 +1793,6 @@ struct tvcard bttv_tvcards[] = {
1805 .tuner_type = TUNER_ABSENT, 1793 .tuner_type = TUNER_ABSENT,
1806 .tuner_addr = ADDR_UNSET, 1794 .tuner_addr = ADDR_UNSET,
1807 .no_msp34xx = 1, 1795 .no_msp34xx = 1,
1808 .no_tda9875 = 1,
1809 .no_tda7432 = 1, 1796 .no_tda7432 = 1,
1810 }, 1797 },
1811 1798
@@ -1820,7 +1807,6 @@ struct tvcard bttv_tvcards[] = {
1820 .tuner_type = TUNER_ABSENT, 1807 .tuner_type = TUNER_ABSENT,
1821 .tuner_addr = ADDR_UNSET, 1808 .tuner_addr = ADDR_UNSET,
1822 .no_msp34xx = 1, 1809 .no_msp34xx = 1,
1823 .no_tda9875 = 1,
1824 .no_tda7432 = 1, /* must avoid, conflicts with the bt860 */ 1810 .no_tda7432 = 1, /* must avoid, conflicts with the bt860 */
1825 }, 1811 },
1826 [BTTV_BOARD_IDS_EAGLE] = { 1812 [BTTV_BOARD_IDS_EAGLE] = {
@@ -1835,7 +1821,6 @@ struct tvcard bttv_tvcards[] = {
1835 .muxsel = MUXSEL(2, 2, 2, 2), 1821 .muxsel = MUXSEL(2, 2, 2, 2),
1836 .muxsel_hook = eagle_muxsel, 1822 .muxsel_hook = eagle_muxsel,
1837 .no_msp34xx = 1, 1823 .no_msp34xx = 1,
1838 .no_tda9875 = 1,
1839 .pll = PLL_28, 1824 .pll = PLL_28,
1840 }, 1825 },
1841 [BTTV_BOARD_PINNACLESAT] = { 1826 [BTTV_BOARD_PINNACLESAT] = {
@@ -1846,7 +1831,6 @@ struct tvcard bttv_tvcards[] = {
1846 .tuner_type = TUNER_ABSENT, 1831 .tuner_type = TUNER_ABSENT,
1847 .tuner_addr = ADDR_UNSET, 1832 .tuner_addr = ADDR_UNSET,
1848 .no_msp34xx = 1, 1833 .no_msp34xx = 1,
1849 .no_tda9875 = 1,
1850 .no_tda7432 = 1, 1834 .no_tda7432 = 1,
1851 .muxsel = MUXSEL(3, 1), 1835 .muxsel = MUXSEL(3, 1),
1852 .pll = PLL_28, 1836 .pll = PLL_28,
@@ -1897,7 +1881,6 @@ struct tvcard bttv_tvcards[] = {
1897 .svhs = 2, 1881 .svhs = 2,
1898 .gpiomask = 0, 1882 .gpiomask = 0,
1899 .no_msp34xx = 1, 1883 .no_msp34xx = 1,
1900 .no_tda9875 = 1,
1901 .no_tda7432 = 1, 1884 .no_tda7432 = 1,
1902 .muxsel = MUXSEL(2, 0, 1), 1885 .muxsel = MUXSEL(2, 0, 1),
1903 .pll = PLL_28, 1886 .pll = PLL_28,
@@ -1970,7 +1953,6 @@ struct tvcard bttv_tvcards[] = {
1970 /* Tuner, CVid, SVid, CVid over SVid connector */ 1953 /* Tuner, CVid, SVid, CVid over SVid connector */
1971 .muxsel = MUXSEL(2, 3, 1, 1), 1954 .muxsel = MUXSEL(2, 3, 1, 1),
1972 .gpiomask = 0, 1955 .gpiomask = 0,
1973 .no_tda9875 = 1,
1974 .no_tda7432 = 1, 1956 .no_tda7432 = 1,
1975 .tuner_type = TUNER_PHILIPS_PAL_I, 1957 .tuner_type = TUNER_PHILIPS_PAL_I,
1976 .tuner_addr = ADDR_UNSET, 1958 .tuner_addr = ADDR_UNSET,
@@ -2017,7 +1999,6 @@ struct tvcard bttv_tvcards[] = {
2017 .muxsel = MUXSEL(2,2,2,2, 3,3,3,3, 1,1,1,1, 0,0,0,0), 1999 .muxsel = MUXSEL(2,2,2,2, 3,3,3,3, 1,1,1,1, 0,0,0,0),
2018 .muxsel_hook = xguard_muxsel, 2000 .muxsel_hook = xguard_muxsel,
2019 .no_msp34xx = 1, 2001 .no_msp34xx = 1,
2020 .no_tda9875 = 1,
2021 .no_tda7432 = 1, 2002 .no_tda7432 = 1,
2022 .pll = PLL_28, 2003 .pll = PLL_28,
2023 }, 2004 },
@@ -2029,7 +2010,6 @@ struct tvcard bttv_tvcards[] = {
2029 .svhs = NO_SVHS, 2010 .svhs = NO_SVHS,
2030 .muxsel = MUXSEL(2, 3, 1, 0), 2011 .muxsel = MUXSEL(2, 3, 1, 0),
2031 .no_msp34xx = 1, 2012 .no_msp34xx = 1,
2032 .no_tda9875 = 1,
2033 .no_tda7432 = 1, 2013 .no_tda7432 = 1,
2034 .pll = PLL_28, 2014 .pll = PLL_28,
2035 .tuner_type = TUNER_ABSENT, 2015 .tuner_type = TUNER_ABSENT,
@@ -2134,7 +2114,6 @@ struct tvcard bttv_tvcards[] = {
2134 .svhs = NO_SVHS, /* card has no svhs */ 2114 .svhs = NO_SVHS, /* card has no svhs */
2135 .needs_tvaudio = 0, 2115 .needs_tvaudio = 0,
2136 .no_msp34xx = 1, 2116 .no_msp34xx = 1,
2137 .no_tda9875 = 1,
2138 .no_tda7432 = 1, 2117 .no_tda7432 = 1,
2139 .gpiomask = 0x00, 2118 .gpiomask = 0x00,
2140 .muxsel = MUXSEL(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), 2119 .muxsel = MUXSEL(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
@@ -2156,7 +2135,6 @@ struct tvcard bttv_tvcards[] = {
2156 [BTTV_BOARD_TWINHAN_DST] = { 2135 [BTTV_BOARD_TWINHAN_DST] = {
2157 .name = "Twinhan DST + clones", 2136 .name = "Twinhan DST + clones",
2158 .no_msp34xx = 1, 2137 .no_msp34xx = 1,
2159 .no_tda9875 = 1,
2160 .no_tda7432 = 1, 2138 .no_tda7432 = 1,
2161 .tuner_type = TUNER_ABSENT, 2139 .tuner_type = TUNER_ABSENT,
2162 .tuner_addr = ADDR_UNSET, 2140 .tuner_addr = ADDR_UNSET,
@@ -2171,7 +2149,6 @@ struct tvcard bttv_tvcards[] = {
2171 /* Vid In, SVid In, Vid over SVid in connector */ 2149 /* Vid In, SVid In, Vid over SVid in connector */
2172 .muxsel = MUXSEL(3, 1, 1, 3), 2150 .muxsel = MUXSEL(3, 1, 1, 3),
2173 .no_msp34xx = 1, 2151 .no_msp34xx = 1,
2174 .no_tda9875 = 1,
2175 .no_tda7432 = 1, 2152 .no_tda7432 = 1,
2176 .tuner_type = TUNER_ABSENT, 2153 .tuner_type = TUNER_ABSENT,
2177 .tuner_addr = ADDR_UNSET, 2154 .tuner_addr = ADDR_UNSET,
@@ -2226,7 +2203,6 @@ struct tvcard bttv_tvcards[] = {
2226 .svhs = NO_SVHS, 2203 .svhs = NO_SVHS,
2227 .muxsel = MUXSEL(2, 3, 1, 0), 2204 .muxsel = MUXSEL(2, 3, 1, 0),
2228 .no_msp34xx = 1, 2205 .no_msp34xx = 1,
2229 .no_tda9875 = 1,
2230 .no_tda7432 = 1, 2206 .no_tda7432 = 1,
2231 .needs_tvaudio = 0, 2207 .needs_tvaudio = 0,
2232 .tuner_type = TUNER_ABSENT, 2208 .tuner_type = TUNER_ABSENT,
@@ -2278,7 +2254,6 @@ struct tvcard bttv_tvcards[] = {
2278 .gpiomask = 0, 2254 .gpiomask = 0,
2279 .gpiomask2 = 0x3C<<16,/*Set the GPIO[18]->GPIO[21] as output pin.==> drive the video inputs through analog multiplexers*/ 2255 .gpiomask2 = 0x3C<<16,/*Set the GPIO[18]->GPIO[21] as output pin.==> drive the video inputs through analog multiplexers*/
2280 .no_msp34xx = 1, 2256 .no_msp34xx = 1,
2281 .no_tda9875 = 1,
2282 .no_tda7432 = 1, 2257 .no_tda7432 = 1,
2283 /*878A input is always MUX0, see above.*/ 2258 /*878A input is always MUX0, see above.*/
2284 .muxsel = MUXSEL(2, 2, 2, 2), 2259 .muxsel = MUXSEL(2, 2, 2, 2),
@@ -2302,7 +2277,6 @@ struct tvcard bttv_tvcards[] = {
2302 .tuner_type = TUNER_TEMIC_PAL, 2277 .tuner_type = TUNER_TEMIC_PAL,
2303 .tuner_addr = ADDR_UNSET, 2278 .tuner_addr = ADDR_UNSET,
2304 .no_msp34xx = 1, 2279 .no_msp34xx = 1,
2305 .no_tda9875 = 1,
2306 }, 2280 },
2307 [BTTV_BOARD_AVDVBT_771] = { 2281 [BTTV_BOARD_AVDVBT_771] = {
2308 /* Wolfram Joost <wojo@frokaschwei.de> */ 2282 /* Wolfram Joost <wojo@frokaschwei.de> */
@@ -2313,7 +2287,6 @@ struct tvcard bttv_tvcards[] = {
2313 .tuner_addr = ADDR_UNSET, 2287 .tuner_addr = ADDR_UNSET,
2314 .muxsel = MUXSEL(3, 3), 2288 .muxsel = MUXSEL(3, 3),
2315 .no_msp34xx = 1, 2289 .no_msp34xx = 1,
2316 .no_tda9875 = 1,
2317 .no_tda7432 = 1, 2290 .no_tda7432 = 1,
2318 .pll = PLL_28, 2291 .pll = PLL_28,
2319 .has_dvb = 1, 2292 .has_dvb = 1,
@@ -2329,7 +2302,6 @@ struct tvcard bttv_tvcards[] = {
2329 .svhs = 1, 2302 .svhs = 1,
2330 .muxsel = MUXSEL(3, 1, 2, 0), /* Comp0, S-Video, ?, ? */ 2303 .muxsel = MUXSEL(3, 1, 2, 0), /* Comp0, S-Video, ?, ? */
2331 .no_msp34xx = 1, 2304 .no_msp34xx = 1,
2332 .no_tda9875 = 1,
2333 .no_tda7432 = 1, 2305 .no_tda7432 = 1,
2334 .pll = PLL_28, 2306 .pll = PLL_28,
2335 .tuner_type = TUNER_ABSENT, 2307 .tuner_type = TUNER_ABSENT,
@@ -2393,7 +2365,6 @@ struct tvcard bttv_tvcards[] = {
2393 /* Chris Pascoe <c.pascoe@itee.uq.edu.au> */ 2365 /* Chris Pascoe <c.pascoe@itee.uq.edu.au> */
2394 .name = "DViCO FusionHDTV DVB-T Lite", 2366 .name = "DViCO FusionHDTV DVB-T Lite",
2395 .no_msp34xx = 1, 2367 .no_msp34xx = 1,
2396 .no_tda9875 = 1,
2397 .no_tda7432 = 1, 2368 .no_tda7432 = 1,
2398 .pll = PLL_28, 2369 .pll = PLL_28,
2399 .no_video = 1, 2370 .no_video = 1,
@@ -2440,7 +2411,6 @@ struct tvcard bttv_tvcards[] = {
2440 .muxsel = MUXSEL(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2), 2411 .muxsel = MUXSEL(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2),
2441 .pll = PLL_28, 2412 .pll = PLL_28,
2442 .no_msp34xx = 1, 2413 .no_msp34xx = 1,
2443 .no_tda9875 = 1,
2444 .no_tda7432 = 1, 2414 .no_tda7432 = 1,
2445 .tuner_type = TUNER_ABSENT, 2415 .tuner_type = TUNER_ABSENT,
2446 .tuner_addr = ADDR_UNSET, 2416 .tuner_addr = ADDR_UNSET,
@@ -2478,7 +2448,6 @@ struct tvcard bttv_tvcards[] = {
2478 .pll = PLL_28, 2448 .pll = PLL_28,
2479 .no_msp34xx = 1, 2449 .no_msp34xx = 1,
2480 .no_tda7432 = 1, 2450 .no_tda7432 = 1,
2481 .no_tda9875 = 1,
2482 .muxsel_hook = kodicom4400r_muxsel, 2451 .muxsel_hook = kodicom4400r_muxsel,
2483 }, 2452 },
2484 [BTTV_BOARD_KODICOM_4400R_SL] = { 2453 [BTTV_BOARD_KODICOM_4400R_SL] = {
@@ -2500,7 +2469,6 @@ struct tvcard bttv_tvcards[] = {
2500 .pll = PLL_28, 2469 .pll = PLL_28,
2501 .no_msp34xx = 1, 2470 .no_msp34xx = 1,
2502 .no_tda7432 = 1, 2471 .no_tda7432 = 1,
2503 .no_tda9875 = 1,
2504 .muxsel_hook = kodicom4400r_muxsel, 2472 .muxsel_hook = kodicom4400r_muxsel,
2505 }, 2473 },
2506 /* ---- card 0x86---------------------------------- */ 2474 /* ---- card 0x86---------------------------------- */
@@ -2530,7 +2498,6 @@ struct tvcard bttv_tvcards[] = {
2530 .gpiomux = { 0x00400005, 0, 0x00000001, 0 }, 2498 .gpiomux = { 0x00400005, 0, 0x00000001, 0 },
2531 .gpiomute = 0x00c00007, 2499 .gpiomute = 0x00c00007,
2532 .no_msp34xx = 1, 2500 .no_msp34xx = 1,
2533 .no_tda9875 = 1,
2534 .no_tda7432 = 1, 2501 .no_tda7432 = 1,
2535 .has_dvb = 1, 2502 .has_dvb = 1,
2536 }, 2503 },
@@ -2630,7 +2597,6 @@ struct tvcard bttv_tvcards[] = {
2630 .tuner_type = TUNER_ABSENT, 2597 .tuner_type = TUNER_ABSENT,
2631 .tuner_addr = ADDR_UNSET, 2598 .tuner_addr = ADDR_UNSET,
2632 .no_msp34xx = 1, 2599 .no_msp34xx = 1,
2633 .no_tda9875 = 1,
2634 .no_tda7432 = 1, 2600 .no_tda7432 = 1,
2635 }, 2601 },
2636 /* ---- card 0x8d ---------------------------------- */ 2602 /* ---- card 0x8d ---------------------------------- */
@@ -2658,7 +2624,6 @@ struct tvcard bttv_tvcards[] = {
2658 .muxsel = MUXSEL(2, 3, 1, 1), 2624 .muxsel = MUXSEL(2, 3, 1, 1),
2659 .gpiomux = { 100000, 100002, 100002, 100000 }, 2625 .gpiomux = { 100000, 100002, 100002, 100000 },
2660 .no_msp34xx = 1, 2626 .no_msp34xx = 1,
2661 .no_tda9875 = 1,
2662 .no_tda7432 = 1, 2627 .no_tda7432 = 1,
2663 .pll = PLL_28, 2628 .pll = PLL_28,
2664 .tuner_type = TUNER_TNF_5335MF, 2629 .tuner_type = TUNER_TNF_5335MF,
@@ -2674,7 +2639,6 @@ struct tvcard bttv_tvcards[] = {
2674 .gpiomask = 0x0f, /* old: 7 */ 2639 .gpiomask = 0x0f, /* old: 7 */
2675 .muxsel = MUXSEL(0, 1, 3, 2), /* Composite 0-3 */ 2640 .muxsel = MUXSEL(0, 1, 3, 2), /* Composite 0-3 */
2676 .no_msp34xx = 1, 2641 .no_msp34xx = 1,
2677 .no_tda9875 = 1,
2678 .no_tda7432 = 1, 2642 .no_tda7432 = 1,
2679 .tuner_type = TUNER_ABSENT, 2643 .tuner_type = TUNER_ABSENT,
2680 .tuner_addr = ADDR_UNSET, 2644 .tuner_addr = ADDR_UNSET,
@@ -2732,7 +2696,6 @@ struct tvcard bttv_tvcards[] = {
2732 .gpiomux = { 0x00400005, 0, 0x00000001, 0 }, 2696 .gpiomux = { 0x00400005, 0, 0x00000001, 0 },
2733 .gpiomute = 0x00c00007, 2697 .gpiomute = 0x00c00007,
2734 .no_msp34xx = 1, 2698 .no_msp34xx = 1,
2735 .no_tda9875 = 1,
2736 .no_tda7432 = 1, 2699 .no_tda7432 = 1,
2737 }, 2700 },
2738 /* ---- card 0x95---------------------------------- */ 2701 /* ---- card 0x95---------------------------------- */
@@ -2874,7 +2837,6 @@ struct tvcard bttv_tvcards[] = {
2874 .pll = PLL_28, 2837 .pll = PLL_28,
2875 .no_msp34xx = 1, 2838 .no_msp34xx = 1,
2876 .no_tda7432 = 1, 2839 .no_tda7432 = 1,
2877 .no_tda9875 = 1,
2878 .muxsel_hook = gv800s_muxsel, 2840 .muxsel_hook = gv800s_muxsel,
2879 }, 2841 },
2880 [BTTV_BOARD_GEOVISION_GV800S_SL] = { 2842 [BTTV_BOARD_GEOVISION_GV800S_SL] = {
@@ -2899,7 +2861,6 @@ struct tvcard bttv_tvcards[] = {
2899 .pll = PLL_28, 2861 .pll = PLL_28,
2900 .no_msp34xx = 1, 2862 .no_msp34xx = 1,
2901 .no_tda7432 = 1, 2863 .no_tda7432 = 1,
2902 .no_tda9875 = 1,
2903 .muxsel_hook = gv800s_muxsel, 2864 .muxsel_hook = gv800s_muxsel,
2904 }, 2865 },
2905 [BTTV_BOARD_PV183] = { 2866 [BTTV_BOARD_PV183] = {
diff --git a/drivers/media/video/bt8xx/bttv.h b/drivers/media/video/bt8xx/bttv.h
index fd62bf15d779..c6333595c6b9 100644
--- a/drivers/media/video/bt8xx/bttv.h
+++ b/drivers/media/video/bt8xx/bttv.h
@@ -234,7 +234,6 @@ struct tvcard {
234 234
235 /* i2c audio flags */ 235 /* i2c audio flags */
236 unsigned int no_msp34xx:1; 236 unsigned int no_msp34xx:1;
237 unsigned int no_tda9875:1;
238 unsigned int no_tda7432:1; 237 unsigned int no_tda7432:1;
239 unsigned int needs_tvaudio:1; 238 unsigned int needs_tvaudio:1;
240 unsigned int msp34xx_alt:1; 239 unsigned int msp34xx_alt:1;
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c
index 49f1b8f1418e..55ffd60ffa7f 100644
--- a/drivers/media/video/cafe_ccic.c
+++ b/drivers/media/video/cafe_ccic.c
@@ -2001,6 +2001,11 @@ static int cafe_pci_probe(struct pci_dev *pdev,
2001 .min_width = 320, 2001 .min_width = 320,
2002 .min_height = 240, 2002 .min_height = 240,
2003 }; 2003 };
2004 struct i2c_board_info ov7670_info = {
2005 .type = "ov7670",
2006 .addr = 0x42,
2007 .platform_data = &sensor_cfg,
2008 };
2004 2009
2005 /* 2010 /*
2006 * Start putting together one of our big camera structures. 2011 * Start putting together one of our big camera structures.
@@ -2062,9 +2067,9 @@ static int cafe_pci_probe(struct pci_dev *pdev,
2062 if (dmi_check_system(olpc_xo1_dmi)) 2067 if (dmi_check_system(olpc_xo1_dmi))
2063 sensor_cfg.clock_speed = 45; 2068 sensor_cfg.clock_speed = 45;
2064 2069
2065 cam->sensor_addr = 0x42; 2070 cam->sensor_addr = ov7670_info.addr;
2066 cam->sensor = v4l2_i2c_new_subdev_cfg(&cam->v4l2_dev, &cam->i2c_adapter, 2071 cam->sensor = v4l2_i2c_new_subdev_board(&cam->v4l2_dev, &cam->i2c_adapter,
2067 "ov7670", 0, &sensor_cfg, cam->sensor_addr, NULL); 2072 &ov7670_info, NULL);
2068 if (cam->sensor == NULL) { 2073 if (cam->sensor == NULL) {
2069 ret = -ENODEV; 2074 ret = -ENODEV;
2070 goto out_smbus; 2075 goto out_smbus;
diff --git a/drivers/media/video/cpia2/cpia2.h b/drivers/media/video/cpia2/cpia2.h
index 916c13d5cf7d..6d6d1843791c 100644
--- a/drivers/media/video/cpia2/cpia2.h
+++ b/drivers/media/video/cpia2/cpia2.h
@@ -378,7 +378,7 @@ struct cpia2_fh {
378 378
379struct camera_data { 379struct camera_data {
380 /* locks */ 380 /* locks */
381 struct mutex busy_lock; /* guard against SMP multithreading */ 381 struct mutex v4l2_lock; /* serialize file operations */
382 struct v4l2_prio_state prio; 382 struct v4l2_prio_state prio;
383 383
384 /* camera status */ 384 /* camera status */
diff --git a/drivers/media/video/cpia2/cpia2_core.c b/drivers/media/video/cpia2/cpia2_core.c
index 9606bc01b803..aaffca8e13fd 100644
--- a/drivers/media/video/cpia2/cpia2_core.c
+++ b/drivers/media/video/cpia2/cpia2_core.c
@@ -2247,7 +2247,7 @@ struct camera_data *cpia2_init_camera_struct(void)
2247 2247
2248 2248
2249 cam->present = 1; 2249 cam->present = 1;
2250 mutex_init(&cam->busy_lock); 2250 mutex_init(&cam->v4l2_lock);
2251 init_waitqueue_head(&cam->wq_stream); 2251 init_waitqueue_head(&cam->wq_stream);
2252 2252
2253 return cam; 2253 return cam;
@@ -2365,9 +2365,9 @@ long cpia2_read(struct camera_data *cam,
2365 char __user *buf, unsigned long count, int noblock) 2365 char __user *buf, unsigned long count, int noblock)
2366{ 2366{
2367 struct framebuf *frame; 2367 struct framebuf *frame;
2368 if (!count) { 2368
2369 if (!count)
2369 return 0; 2370 return 0;
2370 }
2371 2371
2372 if (!buf) { 2372 if (!buf) {
2373 ERR("%s: buffer NULL\n",__func__); 2373 ERR("%s: buffer NULL\n",__func__);
@@ -2379,17 +2379,12 @@ long cpia2_read(struct camera_data *cam,
2379 return -EINVAL; 2379 return -EINVAL;
2380 } 2380 }
2381 2381
2382 /* make this _really_ smp and multithread-safe */
2383 if (mutex_lock_interruptible(&cam->busy_lock))
2384 return -ERESTARTSYS;
2385
2386 if (!cam->present) { 2382 if (!cam->present) {
2387 LOG("%s: camera removed\n",__func__); 2383 LOG("%s: camera removed\n",__func__);
2388 mutex_unlock(&cam->busy_lock);
2389 return 0; /* EOF */ 2384 return 0; /* EOF */
2390 } 2385 }
2391 2386
2392 if(!cam->streaming) { 2387 if (!cam->streaming) {
2393 /* Start streaming */ 2388 /* Start streaming */
2394 cpia2_usb_stream_start(cam, 2389 cpia2_usb_stream_start(cam,
2395 cam->params.camera_state.stream_mode); 2390 cam->params.camera_state.stream_mode);
@@ -2398,42 +2393,31 @@ long cpia2_read(struct camera_data *cam,
2398 /* Copy cam->curbuff in case it changes while we're processing */ 2393 /* Copy cam->curbuff in case it changes while we're processing */
2399 frame = cam->curbuff; 2394 frame = cam->curbuff;
2400 if (noblock && frame->status != FRAME_READY) { 2395 if (noblock && frame->status != FRAME_READY) {
2401 mutex_unlock(&cam->busy_lock);
2402 return -EAGAIN; 2396 return -EAGAIN;
2403 } 2397 }
2404 2398
2405 if(frame->status != FRAME_READY) { 2399 if (frame->status != FRAME_READY) {
2406 mutex_unlock(&cam->busy_lock); 2400 mutex_unlock(&cam->v4l2_lock);
2407 wait_event_interruptible(cam->wq_stream, 2401 wait_event_interruptible(cam->wq_stream,
2408 !cam->present || 2402 !cam->present ||
2409 (frame = cam->curbuff)->status == FRAME_READY); 2403 (frame = cam->curbuff)->status == FRAME_READY);
2404 mutex_lock(&cam->v4l2_lock);
2410 if (signal_pending(current)) 2405 if (signal_pending(current))
2411 return -ERESTARTSYS; 2406 return -ERESTARTSYS;
2412 /* make this _really_ smp and multithread-safe */ 2407 if (!cam->present)
2413 if (mutex_lock_interruptible(&cam->busy_lock)) {
2414 return -ERESTARTSYS;
2415 }
2416 if(!cam->present) {
2417 mutex_unlock(&cam->busy_lock);
2418 return 0; 2408 return 0;
2419 }
2420 } 2409 }
2421 2410
2422 /* copy data to user space */ 2411 /* copy data to user space */
2423 if (frame->length > count) { 2412 if (frame->length > count)
2424 mutex_unlock(&cam->busy_lock);
2425 return -EFAULT; 2413 return -EFAULT;
2426 } 2414 if (copy_to_user(buf, frame->data, frame->length))
2427 if (copy_to_user(buf, frame->data, frame->length)) {
2428 mutex_unlock(&cam->busy_lock);
2429 return -EFAULT; 2415 return -EFAULT;
2430 }
2431 2416
2432 count = frame->length; 2417 count = frame->length;
2433 2418
2434 frame->status = FRAME_EMPTY; 2419 frame->status = FRAME_EMPTY;
2435 2420
2436 mutex_unlock(&cam->busy_lock);
2437 return count; 2421 return count;
2438} 2422}
2439 2423
@@ -2447,17 +2431,13 @@ unsigned int cpia2_poll(struct camera_data *cam, struct file *filp,
2447{ 2431{
2448 unsigned int status=0; 2432 unsigned int status=0;
2449 2433
2450 if(!cam) { 2434 if (!cam) {
2451 ERR("%s: Internal error, camera_data not found!\n",__func__); 2435 ERR("%s: Internal error, camera_data not found!\n",__func__);
2452 return POLLERR; 2436 return POLLERR;
2453 } 2437 }
2454 2438
2455 mutex_lock(&cam->busy_lock); 2439 if (!cam->present)
2456
2457 if(!cam->present) {
2458 mutex_unlock(&cam->busy_lock);
2459 return POLLHUP; 2440 return POLLHUP;
2460 }
2461 2441
2462 if(!cam->streaming) { 2442 if(!cam->streaming) {
2463 /* Start streaming */ 2443 /* Start streaming */
@@ -2465,16 +2445,13 @@ unsigned int cpia2_poll(struct camera_data *cam, struct file *filp,
2465 cam->params.camera_state.stream_mode); 2445 cam->params.camera_state.stream_mode);
2466 } 2446 }
2467 2447
2468 mutex_unlock(&cam->busy_lock);
2469 poll_wait(filp, &cam->wq_stream, wait); 2448 poll_wait(filp, &cam->wq_stream, wait);
2470 mutex_lock(&cam->busy_lock);
2471 2449
2472 if(!cam->present) 2450 if(!cam->present)
2473 status = POLLHUP; 2451 status = POLLHUP;
2474 else if(cam->curbuff->status == FRAME_READY) 2452 else if(cam->curbuff->status == FRAME_READY)
2475 status = POLLIN | POLLRDNORM; 2453 status = POLLIN | POLLRDNORM;
2476 2454
2477 mutex_unlock(&cam->busy_lock);
2478 return status; 2455 return status;
2479} 2456}
2480 2457
@@ -2496,29 +2473,19 @@ int cpia2_remap_buffer(struct camera_data *cam, struct vm_area_struct *vma)
2496 2473
2497 DBG("mmap offset:%ld size:%ld\n", start_offset, size); 2474 DBG("mmap offset:%ld size:%ld\n", start_offset, size);
2498 2475
2499 /* make this _really_ smp-safe */ 2476 if (!cam->present)
2500 if (mutex_lock_interruptible(&cam->busy_lock))
2501 return -ERESTARTSYS;
2502
2503 if (!cam->present) {
2504 mutex_unlock(&cam->busy_lock);
2505 return -ENODEV; 2477 return -ENODEV;
2506 }
2507 2478
2508 if (size > cam->frame_size*cam->num_frames || 2479 if (size > cam->frame_size*cam->num_frames ||
2509 (start_offset % cam->frame_size) != 0 || 2480 (start_offset % cam->frame_size) != 0 ||
2510 (start_offset+size > cam->frame_size*cam->num_frames)) { 2481 (start_offset+size > cam->frame_size*cam->num_frames))
2511 mutex_unlock(&cam->busy_lock);
2512 return -EINVAL; 2482 return -EINVAL;
2513 }
2514 2483
2515 pos = ((unsigned long) (cam->frame_buffer)) + start_offset; 2484 pos = ((unsigned long) (cam->frame_buffer)) + start_offset;
2516 while (size > 0) { 2485 while (size > 0) {
2517 page = kvirt_to_pa(pos); 2486 page = kvirt_to_pa(pos);
2518 if (remap_pfn_range(vma, start, page >> PAGE_SHIFT, PAGE_SIZE, PAGE_SHARED)) { 2487 if (remap_pfn_range(vma, start, page >> PAGE_SHIFT, PAGE_SIZE, PAGE_SHARED))
2519 mutex_unlock(&cam->busy_lock);
2520 return -EAGAIN; 2488 return -EAGAIN;
2521 }
2522 start += PAGE_SIZE; 2489 start += PAGE_SIZE;
2523 pos += PAGE_SIZE; 2490 pos += PAGE_SIZE;
2524 if (size > PAGE_SIZE) 2491 if (size > PAGE_SIZE)
@@ -2528,7 +2495,5 @@ int cpia2_remap_buffer(struct camera_data *cam, struct vm_area_struct *vma)
2528 } 2495 }
2529 2496
2530 cam->mmapped = true; 2497 cam->mmapped = true;
2531 mutex_unlock(&cam->busy_lock);
2532 return 0; 2498 return 0;
2533} 2499}
2534
diff --git a/drivers/media/video/cpia2/cpia2_v4l.c b/drivers/media/video/cpia2/cpia2_v4l.c
index 7edf80b0d01a..9bad39842936 100644
--- a/drivers/media/video/cpia2/cpia2_v4l.c
+++ b/drivers/media/video/cpia2/cpia2_v4l.c
@@ -238,59 +238,40 @@ static struct v4l2_queryctrl controls[] = {
238static int cpia2_open(struct file *file) 238static int cpia2_open(struct file *file)
239{ 239{
240 struct camera_data *cam = video_drvdata(file); 240 struct camera_data *cam = video_drvdata(file);
241 int retval = 0; 241 struct cpia2_fh *fh;
242 242
243 if (!cam) { 243 if (!cam) {
244 ERR("Internal error, camera_data not found!\n"); 244 ERR("Internal error, camera_data not found!\n");
245 return -ENODEV; 245 return -ENODEV;
246 } 246 }
247 247
248 if(mutex_lock_interruptible(&cam->busy_lock)) 248 if (!cam->present)
249 return -ERESTARTSYS; 249 return -ENODEV;
250
251 if(!cam->present) {
252 retval = -ENODEV;
253 goto err_return;
254 }
255 250
256 if (cam->open_count > 0) { 251 if (cam->open_count == 0) {
257 goto skip_init; 252 if (cpia2_allocate_buffers(cam))
258 } 253 return -ENOMEM;
259 254
260 if (cpia2_allocate_buffers(cam)) { 255 /* reset the camera */
261 retval = -ENOMEM; 256 if (cpia2_reset_camera(cam) < 0)
262 goto err_return; 257 return -EIO;
263 }
264 258
265 /* reset the camera */ 259 cam->APP_len = 0;
266 if (cpia2_reset_camera(cam) < 0) { 260 cam->COM_len = 0;
267 retval = -EIO;
268 goto err_return;
269 } 261 }
270 262
271 cam->APP_len = 0; 263 fh = kmalloc(sizeof(*fh), GFP_KERNEL);
272 cam->COM_len = 0; 264 if (!fh)
273 265 return -ENOMEM;
274skip_init: 266 file->private_data = fh;
275 { 267 fh->prio = V4L2_PRIORITY_UNSET;
276 struct cpia2_fh *fh = kmalloc(sizeof(*fh),GFP_KERNEL); 268 v4l2_prio_open(&cam->prio, &fh->prio);
277 if(!fh) { 269 fh->mmapped = 0;
278 retval = -ENOMEM;
279 goto err_return;
280 }
281 file->private_data = fh;
282 fh->prio = V4L2_PRIORITY_UNSET;
283 v4l2_prio_open(&cam->prio, &fh->prio);
284 fh->mmapped = 0;
285 }
286 270
287 ++cam->open_count; 271 ++cam->open_count;
288 272
289 cpia2_dbg_dump_registers(cam); 273 cpia2_dbg_dump_registers(cam);
290 274 return 0;
291err_return:
292 mutex_unlock(&cam->busy_lock);
293 return retval;
294} 275}
295 276
296/****************************************************************************** 277/******************************************************************************
@@ -304,15 +285,11 @@ static int cpia2_close(struct file *file)
304 struct camera_data *cam = video_get_drvdata(dev); 285 struct camera_data *cam = video_get_drvdata(dev);
305 struct cpia2_fh *fh = file->private_data; 286 struct cpia2_fh *fh = file->private_data;
306 287
307 mutex_lock(&cam->busy_lock);
308
309 if (cam->present && 288 if (cam->present &&
310 (cam->open_count == 1 289 (cam->open_count == 1 || fh->prio == V4L2_PRIORITY_RECORD)) {
311 || fh->prio == V4L2_PRIORITY_RECORD
312 )) {
313 cpia2_usb_stream_stop(cam); 290 cpia2_usb_stream_stop(cam);
314 291
315 if(cam->open_count == 1) { 292 if (cam->open_count == 1) {
316 /* save camera state for later open */ 293 /* save camera state for later open */
317 cpia2_save_camera_state(cam); 294 cpia2_save_camera_state(cam);
318 295
@@ -321,26 +298,21 @@ static int cpia2_close(struct file *file)
321 } 298 }
322 } 299 }
323 300
324 { 301 if (fh->mmapped)
325 if(fh->mmapped) 302 cam->mmapped = 0;
326 cam->mmapped = 0; 303 v4l2_prio_close(&cam->prio, fh->prio);
327 v4l2_prio_close(&cam->prio, fh->prio); 304 file->private_data = NULL;
328 file->private_data = NULL; 305 kfree(fh);
329 kfree(fh);
330 }
331 306
332 if (--cam->open_count == 0) { 307 if (--cam->open_count == 0) {
333 cpia2_free_buffers(cam); 308 cpia2_free_buffers(cam);
334 if (!cam->present) { 309 if (!cam->present) {
335 video_unregister_device(dev); 310 video_unregister_device(dev);
336 mutex_unlock(&cam->busy_lock);
337 kfree(cam); 311 kfree(cam);
338 return 0; 312 return 0;
339 } 313 }
340 } 314 }
341 315
342 mutex_unlock(&cam->busy_lock);
343
344 return 0; 316 return 0;
345} 317}
346 318
@@ -405,11 +377,11 @@ static int sync(struct camera_data *cam, int frame_nr)
405 return 0; 377 return 0;
406 } 378 }
407 379
408 mutex_unlock(&cam->busy_lock); 380 mutex_unlock(&cam->v4l2_lock);
409 wait_event_interruptible(cam->wq_stream, 381 wait_event_interruptible(cam->wq_stream,
410 !cam->streaming || 382 !cam->streaming ||
411 frame->status == FRAME_READY); 383 frame->status == FRAME_READY);
412 mutex_lock(&cam->busy_lock); 384 mutex_lock(&cam->v4l2_lock);
413 if (signal_pending(current)) 385 if (signal_pending(current))
414 return -ERESTARTSYS; 386 return -ERESTARTSYS;
415 if(!cam->present) 387 if(!cam->present)
@@ -1293,11 +1265,11 @@ static int ioctl_dqbuf(void *arg,struct camera_data *cam, struct file *file)
1293 if(frame < 0) { 1265 if(frame < 0) {
1294 /* Wait for a frame to become available */ 1266 /* Wait for a frame to become available */
1295 struct framebuf *cb=cam->curbuff; 1267 struct framebuf *cb=cam->curbuff;
1296 mutex_unlock(&cam->busy_lock); 1268 mutex_unlock(&cam->v4l2_lock);
1297 wait_event_interruptible(cam->wq_stream, 1269 wait_event_interruptible(cam->wq_stream,
1298 !cam->present || 1270 !cam->present ||
1299 (cb=cam->curbuff)->status == FRAME_READY); 1271 (cb=cam->curbuff)->status == FRAME_READY);
1300 mutex_lock(&cam->busy_lock); 1272 mutex_lock(&cam->v4l2_lock);
1301 if (signal_pending(current)) 1273 if (signal_pending(current))
1302 return -ERESTARTSYS; 1274 return -ERESTARTSYS;
1303 if(!cam->present) 1275 if(!cam->present)
@@ -1337,14 +1309,8 @@ static long cpia2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
1337 if (!cam) 1309 if (!cam)
1338 return -ENOTTY; 1310 return -ENOTTY;
1339 1311
1340 /* make this _really_ smp-safe */ 1312 if (!cam->present)
1341 if (mutex_lock_interruptible(&cam->busy_lock))
1342 return -ERESTARTSYS;
1343
1344 if (!cam->present) {
1345 mutex_unlock(&cam->busy_lock);
1346 return -ENODEV; 1313 return -ENODEV;
1347 }
1348 1314
1349 /* Priority check */ 1315 /* Priority check */
1350 switch (cmd) { 1316 switch (cmd) {
@@ -1352,10 +1318,8 @@ static long cpia2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
1352 { 1318 {
1353 struct cpia2_fh *fh = file->private_data; 1319 struct cpia2_fh *fh = file->private_data;
1354 retval = v4l2_prio_check(&cam->prio, fh->prio); 1320 retval = v4l2_prio_check(&cam->prio, fh->prio);
1355 if(retval) { 1321 if (retval)
1356 mutex_unlock(&cam->busy_lock);
1357 return retval; 1322 return retval;
1358 }
1359 break; 1323 break;
1360 } 1324 }
1361 default: 1325 default:
@@ -1529,7 +1493,6 @@ static long cpia2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
1529 break; 1493 break;
1530 } 1494 }
1531 1495
1532 mutex_unlock(&cam->busy_lock);
1533 return retval; 1496 return retval;
1534} 1497}
1535 1498
@@ -1596,7 +1559,7 @@ static const struct v4l2_file_operations cpia2_fops = {
1596 .release = cpia2_close, 1559 .release = cpia2_close,
1597 .read = cpia2_v4l_read, 1560 .read = cpia2_v4l_read,
1598 .poll = cpia2_v4l_poll, 1561 .poll = cpia2_v4l_poll,
1599 .ioctl = cpia2_ioctl, 1562 .unlocked_ioctl = cpia2_ioctl,
1600 .mmap = cpia2_mmap, 1563 .mmap = cpia2_mmap,
1601}; 1564};
1602 1565
@@ -1620,6 +1583,7 @@ int cpia2_register_camera(struct camera_data *cam)
1620 1583
1621 memcpy(cam->vdev, &cpia2_template, sizeof(cpia2_template)); 1584 memcpy(cam->vdev, &cpia2_template, sizeof(cpia2_template));
1622 video_set_drvdata(cam->vdev, cam); 1585 video_set_drvdata(cam->vdev, cam);
1586 cam->vdev->lock = &cam->v4l2_lock;
1623 1587
1624 reset_camera_struct_v4l(cam); 1588 reset_camera_struct_v4l(cam);
1625 1589
diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c
index 133ec2bac180..944af8adbe0c 100644
--- a/drivers/media/video/cx18/cx18-driver.c
+++ b/drivers/media/video/cx18/cx18-driver.c
@@ -664,7 +664,7 @@ static int __devinit cx18_create_in_workq(struct cx18 *cx)
664{ 664{
665 snprintf(cx->in_workq_name, sizeof(cx->in_workq_name), "%s-in", 665 snprintf(cx->in_workq_name, sizeof(cx->in_workq_name), "%s-in",
666 cx->v4l2_dev.name); 666 cx->v4l2_dev.name);
667 cx->in_work_queue = create_singlethread_workqueue(cx->in_workq_name); 667 cx->in_work_queue = alloc_ordered_workqueue(cx->in_workq_name, 0);
668 if (cx->in_work_queue == NULL) { 668 if (cx->in_work_queue == NULL) {
669 CX18_ERR("Unable to create incoming mailbox handler thread\n"); 669 CX18_ERR("Unable to create incoming mailbox handler thread\n");
670 return -ENOMEM; 670 return -ENOMEM;
@@ -672,18 +672,6 @@ static int __devinit cx18_create_in_workq(struct cx18 *cx)
672 return 0; 672 return 0;
673} 673}
674 674
675static int __devinit cx18_create_out_workq(struct cx18 *cx)
676{
677 snprintf(cx->out_workq_name, sizeof(cx->out_workq_name), "%s-out",
678 cx->v4l2_dev.name);
679 cx->out_work_queue = create_workqueue(cx->out_workq_name);
680 if (cx->out_work_queue == NULL) {
681 CX18_ERR("Unable to create outgoing mailbox handler threads\n");
682 return -ENOMEM;
683 }
684 return 0;
685}
686
687static void __devinit cx18_init_in_work_orders(struct cx18 *cx) 675static void __devinit cx18_init_in_work_orders(struct cx18 *cx)
688{ 676{
689 int i; 677 int i;
@@ -710,15 +698,9 @@ static int __devinit cx18_init_struct1(struct cx18 *cx)
710 mutex_init(&cx->epu2apu_mb_lock); 698 mutex_init(&cx->epu2apu_mb_lock);
711 mutex_init(&cx->epu2cpu_mb_lock); 699 mutex_init(&cx->epu2cpu_mb_lock);
712 700
713 ret = cx18_create_out_workq(cx);
714 if (ret)
715 return ret;
716
717 ret = cx18_create_in_workq(cx); 701 ret = cx18_create_in_workq(cx);
718 if (ret) { 702 if (ret)
719 destroy_workqueue(cx->out_work_queue);
720 return ret; 703 return ret;
721 }
722 704
723 cx18_init_in_work_orders(cx); 705 cx18_init_in_work_orders(cx);
724 706
@@ -1107,7 +1089,6 @@ free_mem:
1107 release_mem_region(cx->base_addr, CX18_MEM_SIZE); 1089 release_mem_region(cx->base_addr, CX18_MEM_SIZE);
1108free_workqueues: 1090free_workqueues:
1109 destroy_workqueue(cx->in_work_queue); 1091 destroy_workqueue(cx->in_work_queue);
1110 destroy_workqueue(cx->out_work_queue);
1111err: 1092err:
1112 if (retval == 0) 1093 if (retval == 0)
1113 retval = -ENODEV; 1094 retval = -ENODEV;
@@ -1259,7 +1240,6 @@ static void cx18_remove(struct pci_dev *pci_dev)
1259 cx18_halt_firmware(cx); 1240 cx18_halt_firmware(cx);
1260 1241
1261 destroy_workqueue(cx->in_work_queue); 1242 destroy_workqueue(cx->in_work_queue);
1262 destroy_workqueue(cx->out_work_queue);
1263 1243
1264 cx18_streams_cleanup(cx, 1); 1244 cx18_streams_cleanup(cx, 1);
1265 1245
diff --git a/drivers/media/video/cx18/cx18-driver.h b/drivers/media/video/cx18/cx18-driver.h
index f6f3e50d4bdf..306caac6d3fc 100644
--- a/drivers/media/video/cx18/cx18-driver.h
+++ b/drivers/media/video/cx18/cx18-driver.h
@@ -617,9 +617,6 @@ struct cx18 {
617 struct cx18_in_work_order in_work_order[CX18_MAX_IN_WORK_ORDERS]; 617 struct cx18_in_work_order in_work_order[CX18_MAX_IN_WORK_ORDERS];
618 char epu_debug_str[256]; /* CX18_EPU_DEBUG is rare: use shared space */ 618 char epu_debug_str[256]; /* CX18_EPU_DEBUG is rare: use shared space */
619 619
620 struct workqueue_struct *out_work_queue;
621 char out_workq_name[12]; /* "cx18-NN-out" */
622
623 /* i2c */ 620 /* i2c */
624 struct i2c_adapter i2c_adap[2]; 621 struct i2c_adapter i2c_adap[2];
625 struct i2c_algo_bit_data i2c_algo[2]; 622 struct i2c_algo_bit_data i2c_algo[2];
diff --git a/drivers/media/video/cx18/cx18-streams.h b/drivers/media/video/cx18/cx18-streams.h
index 51765eb12d39..713b0e61536d 100644
--- a/drivers/media/video/cx18/cx18-streams.h
+++ b/drivers/media/video/cx18/cx18-streams.h
@@ -42,8 +42,7 @@ static inline bool cx18_stream_enabled(struct cx18_stream *s)
42/* Related to submission of mdls to firmware */ 42/* Related to submission of mdls to firmware */
43static inline void cx18_stream_load_fw_queue(struct cx18_stream *s) 43static inline void cx18_stream_load_fw_queue(struct cx18_stream *s)
44{ 44{
45 struct cx18 *cx = s->cx; 45 schedule_work(&s->out_work_order);
46 queue_work(cx->out_work_queue, &s->out_work_order);
47} 46}
48 47
49static inline void cx18_stream_put_mdl_fw(struct cx18_stream *s, 48static inline void cx18_stream_put_mdl_fw(struct cx18_stream *s,
diff --git a/drivers/media/video/cx231xx/cx231xx-dvb.c b/drivers/media/video/cx231xx/cx231xx-dvb.c
index fe59a1c3f064..363aa6004221 100644
--- a/drivers/media/video/cx231xx/cx231xx-dvb.c
+++ b/drivers/media/video/cx231xx/cx231xx-dvb.c
@@ -28,7 +28,6 @@
28#include <media/videobuf-vmalloc.h> 28#include <media/videobuf-vmalloc.h>
29 29
30#include "xc5000.h" 30#include "xc5000.h"
31#include "dvb_dummy_fe.h"
32#include "s5h1432.h" 31#include "s5h1432.h"
33#include "tda18271.h" 32#include "tda18271.h"
34#include "s5h1411.h" 33#include "s5h1411.h"
@@ -619,7 +618,7 @@ static int dvb_init(struct cx231xx *dev)
619 618
620 if (dev->dvb->frontend == NULL) { 619 if (dev->dvb->frontend == NULL) {
621 printk(DRIVER_NAME 620 printk(DRIVER_NAME
622 ": Failed to attach dummy front end\n"); 621 ": Failed to attach s5h1411 front end\n");
623 result = -EINVAL; 622 result = -EINVAL;
624 goto out_free; 623 goto out_free;
625 } 624 }
@@ -665,7 +664,7 @@ static int dvb_init(struct cx231xx *dev)
665 664
666 if (dev->dvb->frontend == NULL) { 665 if (dev->dvb->frontend == NULL) {
667 printk(DRIVER_NAME 666 printk(DRIVER_NAME
668 ": Failed to attach dummy front end\n"); 667 ": Failed to attach s5h1411 front end\n");
669 result = -EINVAL; 668 result = -EINVAL;
670 goto out_free; 669 goto out_free;
671 } 670 }
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
index f16461844c5c..6fc09dd41b9d 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -1682,20 +1682,6 @@ static int cx25840_log_status(struct v4l2_subdev *sd)
1682 return 0; 1682 return 0;
1683} 1683}
1684 1684
1685static int cx25840_s_config(struct v4l2_subdev *sd, int irq, void *platform_data)
1686{
1687 struct cx25840_state *state = to_state(sd);
1688 struct i2c_client *client = v4l2_get_subdevdata(sd);
1689
1690 if (platform_data) {
1691 struct cx25840_platform_data *pdata = platform_data;
1692
1693 state->pvr150_workaround = pdata->pvr150_workaround;
1694 set_input(client, state->vid_input, state->aud_input);
1695 }
1696 return 0;
1697}
1698
1699static int cx23885_irq_handler(struct v4l2_subdev *sd, u32 status, 1685static int cx23885_irq_handler(struct v4l2_subdev *sd, u32 status,
1700 bool *handled) 1686 bool *handled)
1701{ 1687{
@@ -1787,7 +1773,6 @@ static const struct v4l2_ctrl_ops cx25840_ctrl_ops = {
1787 1773
1788static const struct v4l2_subdev_core_ops cx25840_core_ops = { 1774static const struct v4l2_subdev_core_ops cx25840_core_ops = {
1789 .log_status = cx25840_log_status, 1775 .log_status = cx25840_log_status,
1790 .s_config = cx25840_s_config,
1791 .g_chip_ident = cx25840_g_chip_ident, 1776 .g_chip_ident = cx25840_g_chip_ident,
1792 .g_ctrl = v4l2_subdev_g_ctrl, 1777 .g_ctrl = v4l2_subdev_g_ctrl,
1793 .s_ctrl = v4l2_subdev_s_ctrl, 1778 .s_ctrl = v4l2_subdev_s_ctrl,
@@ -1974,7 +1959,6 @@ static int cx25840_probe(struct i2c_client *client,
1974 state->vid_input = CX25840_COMPOSITE7; 1959 state->vid_input = CX25840_COMPOSITE7;
1975 state->aud_input = CX25840_AUDIO8; 1960 state->aud_input = CX25840_AUDIO8;
1976 state->audclk_freq = 48000; 1961 state->audclk_freq = 48000;
1977 state->pvr150_workaround = 0;
1978 state->audmode = V4L2_TUNER_MODE_LANG1; 1962 state->audmode = V4L2_TUNER_MODE_LANG1;
1979 state->vbi_line_offset = 8; 1963 state->vbi_line_offset = 8;
1980 state->id = id; 1964 state->id = id;
@@ -2034,6 +2018,12 @@ static int cx25840_probe(struct i2c_client *client,
2034 v4l2_ctrl_cluster(2, &state->volume); 2018 v4l2_ctrl_cluster(2, &state->volume);
2035 v4l2_ctrl_handler_setup(&state->hdl); 2019 v4l2_ctrl_handler_setup(&state->hdl);
2036 2020
2021 if (client->dev.platform_data) {
2022 struct cx25840_platform_data *pdata = client->dev.platform_data;
2023
2024 state->pvr150_workaround = pdata->pvr150_workaround;
2025 }
2026
2037 cx25840_ir_probe(sd); 2027 cx25840_ir_probe(sd);
2038 return 0; 2028 return 0;
2039} 2029}
diff --git a/drivers/media/video/davinci/vpif.c b/drivers/media/video/davinci/vpif.c
index 1f532e31cd49..9f3bfc1eb240 100644
--- a/drivers/media/video/davinci/vpif.c
+++ b/drivers/media/video/davinci/vpif.c
@@ -41,6 +41,183 @@ spinlock_t vpif_lock;
41 41
42void __iomem *vpif_base; 42void __iomem *vpif_base;
43 43
44/**
45 * ch_params: video standard configuration parameters for vpif
46 * The table must include all presets from supported subdevices.
47 */
48const struct vpif_channel_config_params ch_params[] = {
49 /* HDTV formats */
50 {
51 .name = "480p59_94",
52 .width = 720,
53 .height = 480,
54 .frm_fmt = 1,
55 .ycmux_mode = 0,
56 .eav2sav = 138-8,
57 .sav2eav = 720,
58 .l1 = 1,
59 .l3 = 43,
60 .l5 = 523,
61 .vsize = 525,
62 .capture_format = 0,
63 .vbi_supported = 0,
64 .hd_sd = 1,
65 .dv_preset = V4L2_DV_480P59_94,
66 },
67 {
68 .name = "576p50",
69 .width = 720,
70 .height = 576,
71 .frm_fmt = 1,
72 .ycmux_mode = 0,
73 .eav2sav = 144-8,
74 .sav2eav = 720,
75 .l1 = 1,
76 .l3 = 45,
77 .l5 = 621,
78 .vsize = 625,
79 .capture_format = 0,
80 .vbi_supported = 0,
81 .hd_sd = 1,
82 .dv_preset = V4L2_DV_576P50,
83 },
84 {
85 .name = "720p50",
86 .width = 1280,
87 .height = 720,
88 .frm_fmt = 1,
89 .ycmux_mode = 0,
90 .eav2sav = 700-8,
91 .sav2eav = 1280,
92 .l1 = 1,
93 .l3 = 26,
94 .l5 = 746,
95 .vsize = 750,
96 .capture_format = 0,
97 .vbi_supported = 0,
98 .hd_sd = 1,
99 .dv_preset = V4L2_DV_720P50,
100 },
101 {
102 .name = "720p60",
103 .width = 1280,
104 .height = 720,
105 .frm_fmt = 1,
106 .ycmux_mode = 0,
107 .eav2sav = 370 - 8,
108 .sav2eav = 1280,
109 .l1 = 1,
110 .l3 = 26,
111 .l5 = 746,
112 .vsize = 750,
113 .capture_format = 0,
114 .vbi_supported = 0,
115 .hd_sd = 1,
116 .dv_preset = V4L2_DV_720P60,
117 },
118 {
119 .name = "1080I50",
120 .width = 1920,
121 .height = 1080,
122 .frm_fmt = 0,
123 .ycmux_mode = 0,
124 .eav2sav = 720 - 8,
125 .sav2eav = 1920,
126 .l1 = 1,
127 .l3 = 21,
128 .l5 = 561,
129 .l7 = 563,
130 .l9 = 584,
131 .l11 = 1124,
132 .vsize = 1125,
133 .capture_format = 0,
134 .vbi_supported = 0,
135 .hd_sd = 1,
136 .dv_preset = V4L2_DV_1080I50,
137 },
138 {
139 .name = "1080I60",
140 .width = 1920,
141 .height = 1080,
142 .frm_fmt = 0,
143 .ycmux_mode = 0,
144 .eav2sav = 280 - 8,
145 .sav2eav = 1920,
146 .l1 = 1,
147 .l3 = 21,
148 .l5 = 561,
149 .l7 = 563,
150 .l9 = 584,
151 .l11 = 1124,
152 .vsize = 1125,
153 .capture_format = 0,
154 .vbi_supported = 0,
155 .hd_sd = 1,
156 .dv_preset = V4L2_DV_1080I60,
157 },
158 {
159 .name = "1080p60",
160 .width = 1920,
161 .height = 1080,
162 .frm_fmt = 1,
163 .ycmux_mode = 0,
164 .eav2sav = 280 - 8,
165 .sav2eav = 1920,
166 .l1 = 1,
167 .l3 = 42,
168 .l5 = 1122,
169 .vsize = 1125,
170 .capture_format = 0,
171 .vbi_supported = 0,
172 .hd_sd = 1,
173 .dv_preset = V4L2_DV_1080P60,
174 },
175
176 /* SDTV formats */
177 {
178 .name = "NTSC_M",
179 .width = 720,
180 .height = 480,
181 .frm_fmt = 0,
182 .ycmux_mode = 1,
183 .eav2sav = 268,
184 .sav2eav = 1440,
185 .l1 = 1,
186 .l3 = 23,
187 .l5 = 263,
188 .l7 = 266,
189 .l9 = 286,
190 .l11 = 525,
191 .vsize = 525,
192 .capture_format = 0,
193 .vbi_supported = 1,
194 .hd_sd = 0,
195 .stdid = V4L2_STD_525_60,
196 },
197 {
198 .name = "PAL_BDGHIK",
199 .width = 720,
200 .height = 576,
201 .frm_fmt = 0,
202 .ycmux_mode = 1,
203 .eav2sav = 280,
204 .sav2eav = 1440,
205 .l1 = 1,
206 .l3 = 23,
207 .l5 = 311,
208 .l7 = 313,
209 .l9 = 336,
210 .l11 = 624,
211 .vsize = 625,
212 .capture_format = 0,
213 .vbi_supported = 1,
214 .hd_sd = 0,
215 .stdid = V4L2_STD_625_50,
216 },
217};
218
219const unsigned int vpif_ch_params_count = ARRAY_SIZE(ch_params);
220
44static inline void vpif_wr_bit(u32 reg, u32 bit, u32 val) 221static inline void vpif_wr_bit(u32 reg, u32 bit, u32 val)
45{ 222{
46 if (val) 223 if (val)
diff --git a/drivers/media/video/davinci/vpif.h b/drivers/media/video/davinci/vpif.h
index ebd5c4338ebb..10550bd93b06 100644
--- a/drivers/media/video/davinci/vpif.h
+++ b/drivers/media/video/davinci/vpif.h
@@ -577,12 +577,10 @@ struct vpif_channel_config_params {
577 char name[VPIF_MAX_NAME]; /* Name of the mode */ 577 char name[VPIF_MAX_NAME]; /* Name of the mode */
578 u16 width; /* Indicates width of the image */ 578 u16 width; /* Indicates width of the image */
579 u16 height; /* Indicates height of the image */ 579 u16 height; /* Indicates height of the image */
580 u8 fps; 580 u8 frm_fmt; /* Interlaced (0) or progressive (1) */
581 u8 frm_fmt; /* Indicates whether this is interlaced 581 u8 ycmux_mode; /* This mode requires one (0) or two (1)
582 * or progressive format */ 582 channels */
583 u8 ycmux_mode; /* Indicates whether this mode requires 583 u16 eav2sav; /* length of eav 2 sav */
584 * single or two channels */
585 u16 eav2sav; /* length of sav 2 eav */
586 u16 sav2eav; /* length of sav 2 eav */ 584 u16 sav2eav; /* length of sav 2 eav */
587 u16 l1, l3, l5, l7, l9, l11; /* Other parameter configurations */ 585 u16 l1, l3, l5, l7, l9, l11; /* Other parameter configurations */
588 u16 vsize; /* Vertical size of the image */ 586 u16 vsize; /* Vertical size of the image */
@@ -590,10 +588,14 @@ struct vpif_channel_config_params {
590 * is in BT or in CCD/CMOS */ 588 * is in BT or in CCD/CMOS */
591 u8 vbi_supported; /* Indicates whether this mode 589 u8 vbi_supported; /* Indicates whether this mode
592 * supports capturing vbi or not */ 590 * supports capturing vbi or not */
593 u8 hd_sd; 591 u8 hd_sd; /* HDTV (1) or SDTV (0) format */
594 v4l2_std_id stdid; 592 v4l2_std_id stdid; /* SDTV format */
593 u32 dv_preset; /* HDTV format */
595}; 594};
596 595
596extern const unsigned int vpif_ch_params_count;
597extern const struct vpif_channel_config_params ch_params[];
598
597struct vpif_video_params; 599struct vpif_video_params;
598struct vpif_params; 600struct vpif_params;
599struct vpif_vbi_params; 601struct vpif_vbi_params;
diff --git a/drivers/media/video/davinci/vpif_capture.c b/drivers/media/video/davinci/vpif_capture.c
index 193abab6b355..d93ad74a34c5 100644
--- a/drivers/media/video/davinci/vpif_capture.c
+++ b/drivers/media/video/davinci/vpif_capture.c
@@ -37,6 +37,7 @@
37#include <linux/slab.h> 37#include <linux/slab.h>
38#include <media/v4l2-device.h> 38#include <media/v4l2-device.h>
39#include <media/v4l2-ioctl.h> 39#include <media/v4l2-ioctl.h>
40#include <media/v4l2-chip-ident.h>
40 41
41#include "vpif_capture.h" 42#include "vpif_capture.h"
42#include "vpif.h" 43#include "vpif.h"
@@ -81,20 +82,6 @@ static struct vpif_device vpif_obj = { {NULL} };
81static struct device *vpif_dev; 82static struct device *vpif_dev;
82 83
83/** 84/**
84 * ch_params: video standard configuration parameters for vpif
85 */
86static const struct vpif_channel_config_params ch_params[] = {
87 {
88 "NTSC_M", 720, 480, 30, 0, 1, 268, 1440, 1, 23, 263, 266,
89 286, 525, 525, 0, 1, 0, V4L2_STD_525_60,
90 },
91 {
92 "PAL_BDGHIK", 720, 576, 25, 0, 1, 280, 1440, 1, 23, 311, 313,
93 336, 624, 625, 0, 1, 0, V4L2_STD_625_50,
94 },
95};
96
97/**
98 * vpif_uservirt_to_phys : translate user/virtual address to phy address 85 * vpif_uservirt_to_phys : translate user/virtual address to phy address
99 * @virtp: user/virtual address 86 * @virtp: user/virtual address
100 * 87 *
@@ -342,7 +329,7 @@ static void vpif_schedule_next_buffer(struct common_obj *common)
342 * @dev_id: dev_id ptr 329 * @dev_id: dev_id ptr
343 * 330 *
344 * It changes status of the captured buffer, takes next buffer from the queue 331 * It changes status of the captured buffer, takes next buffer from the queue
345 * and sets its address in VPIF registers 332 * and sets its address in VPIF registers
346 */ 333 */
347static irqreturn_t vpif_channel_isr(int irq, void *dev_id) 334static irqreturn_t vpif_channel_isr(int irq, void *dev_id)
348{ 335{
@@ -435,24 +422,31 @@ static int vpif_update_std_info(struct channel_obj *ch)
435 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; 422 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
436 struct vpif_params *vpifparams = &ch->vpifparams; 423 struct vpif_params *vpifparams = &ch->vpifparams;
437 const struct vpif_channel_config_params *config; 424 const struct vpif_channel_config_params *config;
438 struct vpif_channel_config_params *std_info; 425 struct vpif_channel_config_params *std_info = &vpifparams->std_info;
439 struct video_obj *vid_ch = &ch->video; 426 struct video_obj *vid_ch = &ch->video;
440 int index; 427 int index;
441 428
442 vpif_dbg(2, debug, "vpif_update_std_info\n"); 429 vpif_dbg(2, debug, "vpif_update_std_info\n");
443 430
444 std_info = &vpifparams->std_info; 431 for (index = 0; index < vpif_ch_params_count; index++) {
445
446 for (index = 0; index < ARRAY_SIZE(ch_params); index++) {
447 config = &ch_params[index]; 432 config = &ch_params[index];
448 if (config->stdid & vid_ch->stdid) { 433 if (config->hd_sd == 0) {
449 memcpy(std_info, config, sizeof(*config)); 434 vpif_dbg(2, debug, "SD format\n");
450 break; 435 if (config->stdid & vid_ch->stdid) {
436 memcpy(std_info, config, sizeof(*config));
437 break;
438 }
439 } else {
440 vpif_dbg(2, debug, "HD format\n");
441 if (config->dv_preset == vid_ch->dv_preset) {
442 memcpy(std_info, config, sizeof(*config));
443 break;
444 }
451 } 445 }
452 } 446 }
453 447
454 /* standard not found */ 448 /* standard not found */
455 if (index == ARRAY_SIZE(ch_params)) 449 if (index == vpif_ch_params_count)
456 return -EINVAL; 450 return -EINVAL;
457 451
458 common->fmt.fmt.pix.width = std_info->width; 452 common->fmt.fmt.pix.width = std_info->width;
@@ -462,6 +456,7 @@ static int vpif_update_std_info(struct channel_obj *ch)
462 common->fmt.fmt.pix.bytesperline = std_info->width; 456 common->fmt.fmt.pix.bytesperline = std_info->width;
463 vpifparams->video_params.hpitch = std_info->width; 457 vpifparams->video_params.hpitch = std_info->width;
464 vpifparams->video_params.storage_mode = std_info->frm_fmt; 458 vpifparams->video_params.storage_mode = std_info->frm_fmt;
459
465 return 0; 460 return 0;
466} 461}
467 462
@@ -757,7 +752,7 @@ static int vpif_open(struct file *filep)
757 struct video_obj *vid_ch; 752 struct video_obj *vid_ch;
758 struct channel_obj *ch; 753 struct channel_obj *ch;
759 struct vpif_fh *fh; 754 struct vpif_fh *fh;
760 int i, ret = 0; 755 int i;
761 756
762 vpif_dbg(2, debug, "vpif_open\n"); 757 vpif_dbg(2, debug, "vpif_open\n");
763 758
@@ -766,9 +761,6 @@ static int vpif_open(struct file *filep)
766 vid_ch = &ch->video; 761 vid_ch = &ch->video;
767 common = &ch->common[VPIF_VIDEO_INDEX]; 762 common = &ch->common[VPIF_VIDEO_INDEX];
768 763
769 if (mutex_lock_interruptible(&common->lock))
770 return -ERESTARTSYS;
771
772 if (NULL == ch->curr_subdev_info) { 764 if (NULL == ch->curr_subdev_info) {
773 /** 765 /**
774 * search through the sub device to see a registered 766 * search through the sub device to see a registered
@@ -785,8 +777,7 @@ static int vpif_open(struct file *filep)
785 } 777 }
786 if (i == config->subdev_count) { 778 if (i == config->subdev_count) {
787 vpif_err("No sub device registered\n"); 779 vpif_err("No sub device registered\n");
788 ret = -ENOENT; 780 return -ENOENT;
789 goto exit;
790 } 781 }
791 } 782 }
792 783
@@ -794,8 +785,7 @@ static int vpif_open(struct file *filep)
794 fh = kzalloc(sizeof(struct vpif_fh), GFP_KERNEL); 785 fh = kzalloc(sizeof(struct vpif_fh), GFP_KERNEL);
795 if (NULL == fh) { 786 if (NULL == fh) {
796 vpif_err("unable to allocate memory for file handle object\n"); 787 vpif_err("unable to allocate memory for file handle object\n");
797 ret = -ENOMEM; 788 return -ENOMEM;
798 goto exit;
799 } 789 }
800 790
801 /* store pointer to fh in private_data member of filep */ 791 /* store pointer to fh in private_data member of filep */
@@ -815,9 +805,7 @@ static int vpif_open(struct file *filep)
815 /* Initialize priority of this instance to default priority */ 805 /* Initialize priority of this instance to default priority */
816 fh->prio = V4L2_PRIORITY_UNSET; 806 fh->prio = V4L2_PRIORITY_UNSET;
817 v4l2_prio_open(&ch->prio, &fh->prio); 807 v4l2_prio_open(&ch->prio, &fh->prio);
818exit: 808 return 0;
819 mutex_unlock(&common->lock);
820 return ret;
821} 809}
822 810
823/** 811/**
@@ -837,9 +825,6 @@ static int vpif_release(struct file *filep)
837 825
838 common = &ch->common[VPIF_VIDEO_INDEX]; 826 common = &ch->common[VPIF_VIDEO_INDEX];
839 827
840 if (mutex_lock_interruptible(&common->lock))
841 return -ERESTARTSYS;
842
843 /* if this instance is doing IO */ 828 /* if this instance is doing IO */
844 if (fh->io_allowed[VPIF_VIDEO_INDEX]) { 829 if (fh->io_allowed[VPIF_VIDEO_INDEX]) {
845 /* Reset io_usrs member of channel object */ 830 /* Reset io_usrs member of channel object */
@@ -863,9 +848,6 @@ static int vpif_release(struct file *filep)
863 /* Decrement channel usrs counter */ 848 /* Decrement channel usrs counter */
864 ch->usrs--; 849 ch->usrs--;
865 850
866 /* unlock mutex on channel object */
867 mutex_unlock(&common->lock);
868
869 /* Close the priority */ 851 /* Close the priority */
870 v4l2_prio_close(&ch->prio, fh->prio); 852 v4l2_prio_close(&ch->prio, fh->prio);
871 853
@@ -890,7 +872,6 @@ static int vpif_reqbufs(struct file *file, void *priv,
890 struct channel_obj *ch = fh->channel; 872 struct channel_obj *ch = fh->channel;
891 struct common_obj *common; 873 struct common_obj *common;
892 u8 index = 0; 874 u8 index = 0;
893 int ret = 0;
894 875
895 vpif_dbg(2, debug, "vpif_reqbufs\n"); 876 vpif_dbg(2, debug, "vpif_reqbufs\n");
896 877
@@ -913,13 +894,8 @@ static int vpif_reqbufs(struct file *file, void *priv,
913 894
914 common = &ch->common[index]; 895 common = &ch->common[index];
915 896
916 if (mutex_lock_interruptible(&common->lock)) 897 if (0 != common->io_usrs)
917 return -ERESTARTSYS; 898 return -EBUSY;
918
919 if (0 != common->io_usrs) {
920 ret = -EBUSY;
921 goto reqbuf_exit;
922 }
923 899
924 /* Initialize videobuf queue as per the buffer type */ 900 /* Initialize videobuf queue as per the buffer type */
925 videobuf_queue_dma_contig_init(&common->buffer_queue, 901 videobuf_queue_dma_contig_init(&common->buffer_queue,
@@ -928,7 +904,7 @@ static int vpif_reqbufs(struct file *file, void *priv,
928 reqbuf->type, 904 reqbuf->type,
929 common->fmt.fmt.pix.field, 905 common->fmt.fmt.pix.field,
930 sizeof(struct videobuf_buffer), fh, 906 sizeof(struct videobuf_buffer), fh,
931 NULL); 907 &common->lock);
932 908
933 /* Set io allowed member of file handle to TRUE */ 909 /* Set io allowed member of file handle to TRUE */
934 fh->io_allowed[index] = 1; 910 fh->io_allowed[index] = 1;
@@ -939,11 +915,7 @@ static int vpif_reqbufs(struct file *file, void *priv,
939 INIT_LIST_HEAD(&common->dma_queue); 915 INIT_LIST_HEAD(&common->dma_queue);
940 916
941 /* Allocate buffers */ 917 /* Allocate buffers */
942 ret = videobuf_reqbufs(&common->buffer_queue, reqbuf); 918 return videobuf_reqbufs(&common->buffer_queue, reqbuf);
943
944reqbuf_exit:
945 mutex_unlock(&common->lock);
946 return ret;
947} 919}
948 920
949/** 921/**
@@ -1157,11 +1129,6 @@ static int vpif_streamon(struct file *file, void *priv,
1157 return ret; 1129 return ret;
1158 } 1130 }
1159 1131
1160 if (mutex_lock_interruptible(&common->lock)) {
1161 ret = -ERESTARTSYS;
1162 goto streamoff_exit;
1163 }
1164
1165 /* If buffer queue is empty, return error */ 1132 /* If buffer queue is empty, return error */
1166 if (list_empty(&common->dma_queue)) { 1133 if (list_empty(&common->dma_queue)) {
1167 vpif_dbg(1, debug, "buffer queue is empty\n"); 1134 vpif_dbg(1, debug, "buffer queue is empty\n");
@@ -1240,13 +1207,10 @@ static int vpif_streamon(struct file *file, void *priv,
1240 enable_channel1(1); 1207 enable_channel1(1);
1241 } 1208 }
1242 channel_first_int[VPIF_VIDEO_INDEX][ch->channel_id] = 1; 1209 channel_first_int[VPIF_VIDEO_INDEX][ch->channel_id] = 1;
1243 mutex_unlock(&common->lock);
1244 return ret; 1210 return ret;
1245 1211
1246exit: 1212exit:
1247 mutex_unlock(&common->lock); 1213 videobuf_streamoff(&common->buffer_queue);
1248streamoff_exit:
1249 ret = videobuf_streamoff(&common->buffer_queue);
1250 return ret; 1214 return ret;
1251} 1215}
1252 1216
@@ -1284,9 +1248,6 @@ static int vpif_streamoff(struct file *file, void *priv,
1284 return -EINVAL; 1248 return -EINVAL;
1285 } 1249 }
1286 1250
1287 if (mutex_lock_interruptible(&common->lock))
1288 return -ERESTARTSYS;
1289
1290 /* disable channel */ 1251 /* disable channel */
1291 if (VPIF_CHANNEL0_VIDEO == ch->channel_id) { 1252 if (VPIF_CHANNEL0_VIDEO == ch->channel_id) {
1292 enable_channel0(0); 1253 enable_channel0(0);
@@ -1304,8 +1265,6 @@ static int vpif_streamoff(struct file *file, void *priv,
1304 if (ret && (ret != -ENOIOCTLCMD)) 1265 if (ret && (ret != -ENOIOCTLCMD))
1305 vpif_dbg(1, debug, "stream off failed in subdev\n"); 1266 vpif_dbg(1, debug, "stream off failed in subdev\n");
1306 1267
1307 mutex_unlock(&common->lock);
1308
1309 return videobuf_streamoff(&common->buffer_queue); 1268 return videobuf_streamoff(&common->buffer_queue);
1310} 1269}
1311 1270
@@ -1381,21 +1340,16 @@ static int vpif_querystd(struct file *file, void *priv, v4l2_std_id *std_id)
1381{ 1340{
1382 struct vpif_fh *fh = priv; 1341 struct vpif_fh *fh = priv;
1383 struct channel_obj *ch = fh->channel; 1342 struct channel_obj *ch = fh->channel;
1384 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
1385 int ret = 0; 1343 int ret = 0;
1386 1344
1387 vpif_dbg(2, debug, "vpif_querystd\n"); 1345 vpif_dbg(2, debug, "vpif_querystd\n");
1388 1346
1389 if (mutex_lock_interruptible(&common->lock))
1390 return -ERESTARTSYS;
1391
1392 /* Call querystd function of decoder device */ 1347 /* Call querystd function of decoder device */
1393 ret = v4l2_subdev_call(vpif_obj.sd[ch->curr_sd_index], video, 1348 ret = v4l2_subdev_call(vpif_obj.sd[ch->curr_sd_index], video,
1394 querystd, std_id); 1349 querystd, std_id);
1395 if (ret < 0) 1350 if (ret < 0)
1396 vpif_dbg(1, debug, "Failed to set standard for sub devices\n"); 1351 vpif_dbg(1, debug, "Failed to set standard for sub devices\n");
1397 1352
1398 mutex_unlock(&common->lock);
1399 return ret; 1353 return ret;
1400} 1354}
1401 1355
@@ -1451,16 +1405,14 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id *std_id)
1451 fh->initialized = 1; 1405 fh->initialized = 1;
1452 1406
1453 /* Call encoder subdevice function to set the standard */ 1407 /* Call encoder subdevice function to set the standard */
1454 if (mutex_lock_interruptible(&common->lock))
1455 return -ERESTARTSYS;
1456
1457 ch->video.stdid = *std_id; 1408 ch->video.stdid = *std_id;
1409 ch->video.dv_preset = V4L2_DV_INVALID;
1410 memset(&ch->video.bt_timings, 0, sizeof(ch->video.bt_timings));
1458 1411
1459 /* Get the information about the standard */ 1412 /* Get the information about the standard */
1460 if (vpif_update_std_info(ch)) { 1413 if (vpif_update_std_info(ch)) {
1461 ret = -EINVAL;
1462 vpif_err("Error getting the standard info\n"); 1414 vpif_err("Error getting the standard info\n");
1463 goto s_std_exit; 1415 return -EINVAL;
1464 } 1416 }
1465 1417
1466 /* Configure the default format information */ 1418 /* Configure the default format information */
@@ -1471,9 +1423,6 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id *std_id)
1471 s_std, *std_id); 1423 s_std, *std_id);
1472 if (ret < 0) 1424 if (ret < 0)
1473 vpif_dbg(1, debug, "Failed to set standard for sub devices\n"); 1425 vpif_dbg(1, debug, "Failed to set standard for sub devices\n");
1474
1475s_std_exit:
1476 mutex_unlock(&common->lock);
1477 return ret; 1426 return ret;
1478} 1427}
1479 1428
@@ -1567,9 +1516,6 @@ static int vpif_s_input(struct file *file, void *priv, unsigned int index)
1567 return -EINVAL; 1516 return -EINVAL;
1568 } 1517 }
1569 1518
1570 if (mutex_lock_interruptible(&common->lock))
1571 return -ERESTARTSYS;
1572
1573 /* first setup input path from sub device to vpif */ 1519 /* first setup input path from sub device to vpif */
1574 if (config->setup_input_path) { 1520 if (config->setup_input_path) {
1575 ret = config->setup_input_path(ch->channel_id, 1521 ret = config->setup_input_path(ch->channel_id,
@@ -1578,7 +1524,7 @@ static int vpif_s_input(struct file *file, void *priv, unsigned int index)
1578 vpif_dbg(1, debug, "couldn't setup input path for the" 1524 vpif_dbg(1, debug, "couldn't setup input path for the"
1579 " sub device %s, for input index %d\n", 1525 " sub device %s, for input index %d\n",
1580 subdev_info->name, index); 1526 subdev_info->name, index);
1581 goto exit; 1527 return ret;
1582 } 1528 }
1583 } 1529 }
1584 1530
@@ -1589,7 +1535,7 @@ static int vpif_s_input(struct file *file, void *priv, unsigned int index)
1589 input, output, 0); 1535 input, output, 0);
1590 if (ret < 0) { 1536 if (ret < 0) {
1591 vpif_dbg(1, debug, "Failed to set input\n"); 1537 vpif_dbg(1, debug, "Failed to set input\n");
1592 goto exit; 1538 return ret;
1593 } 1539 }
1594 } 1540 }
1595 vid_ch->input_idx = index; 1541 vid_ch->input_idx = index;
@@ -1600,9 +1546,6 @@ static int vpif_s_input(struct file *file, void *priv, unsigned int index)
1600 1546
1601 /* update tvnorms from the sub device input info */ 1547 /* update tvnorms from the sub device input info */
1602 ch->video_dev->tvnorms = chan_cfg->inputs[index].input.std; 1548 ch->video_dev->tvnorms = chan_cfg->inputs[index].input.std;
1603
1604exit:
1605 mutex_unlock(&common->lock);
1606 return ret; 1549 return ret;
1607} 1550}
1608 1551
@@ -1671,11 +1614,7 @@ static int vpif_g_fmt_vid_cap(struct file *file, void *priv,
1671 return -EINVAL; 1614 return -EINVAL;
1672 1615
1673 /* Fill in the information about format */ 1616 /* Fill in the information about format */
1674 if (mutex_lock_interruptible(&common->lock))
1675 return -ERESTARTSYS;
1676
1677 *fmt = common->fmt; 1617 *fmt = common->fmt;
1678 mutex_unlock(&common->lock);
1679 return 0; 1618 return 0;
1680} 1619}
1681 1620
@@ -1694,7 +1633,7 @@ static int vpif_s_fmt_vid_cap(struct file *file, void *priv,
1694 struct v4l2_pix_format *pixfmt; 1633 struct v4l2_pix_format *pixfmt;
1695 int ret = 0; 1634 int ret = 0;
1696 1635
1697 vpif_dbg(2, debug, "VIDIOC_S_FMT\n"); 1636 vpif_dbg(2, debug, "%s\n", __func__);
1698 1637
1699 /* If streaming is started, return error */ 1638 /* If streaming is started, return error */
1700 if (common->started) { 1639 if (common->started) {
@@ -1723,12 +1662,7 @@ static int vpif_s_fmt_vid_cap(struct file *file, void *priv,
1723 if (ret) 1662 if (ret)
1724 return ret; 1663 return ret;
1725 /* store the format in the channel object */ 1664 /* store the format in the channel object */
1726 if (mutex_lock_interruptible(&common->lock))
1727 return -ERESTARTSYS;
1728
1729 common->fmt = *fmt; 1665 common->fmt = *fmt;
1730 mutex_unlock(&common->lock);
1731
1732 return 0; 1666 return 0;
1733} 1667}
1734 1668
@@ -1807,6 +1741,306 @@ static int vpif_cropcap(struct file *file, void *priv,
1807 return 0; 1741 return 0;
1808} 1742}
1809 1743
1744/**
1745 * vpif_enum_dv_presets() - ENUM_DV_PRESETS handler
1746 * @file: file ptr
1747 * @priv: file handle
1748 * @preset: input preset
1749 */
1750static int vpif_enum_dv_presets(struct file *file, void *priv,
1751 struct v4l2_dv_enum_preset *preset)
1752{
1753 struct vpif_fh *fh = priv;
1754 struct channel_obj *ch = fh->channel;
1755
1756 return v4l2_subdev_call(vpif_obj.sd[ch->curr_sd_index],
1757 video, enum_dv_presets, preset);
1758}
1759
1760/**
1761 * vpif_query_dv_presets() - QUERY_DV_PRESET handler
1762 * @file: file ptr
1763 * @priv: file handle
1764 * @preset: input preset
1765 */
1766static int vpif_query_dv_preset(struct file *file, void *priv,
1767 struct v4l2_dv_preset *preset)
1768{
1769 struct vpif_fh *fh = priv;
1770 struct channel_obj *ch = fh->channel;
1771
1772 return v4l2_subdev_call(vpif_obj.sd[ch->curr_sd_index],
1773 video, query_dv_preset, preset);
1774}
1775/**
1776 * vpif_s_dv_presets() - S_DV_PRESETS handler
1777 * @file: file ptr
1778 * @priv: file handle
1779 * @preset: input preset
1780 */
1781static int vpif_s_dv_preset(struct file *file, void *priv,
1782 struct v4l2_dv_preset *preset)
1783{
1784 struct vpif_fh *fh = priv;
1785 struct channel_obj *ch = fh->channel;
1786 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
1787 int ret = 0;
1788
1789 if (common->started) {
1790 vpif_dbg(1, debug, "streaming in progress\n");
1791 return -EBUSY;
1792 }
1793
1794 if ((VPIF_CHANNEL0_VIDEO == ch->channel_id) ||
1795 (VPIF_CHANNEL1_VIDEO == ch->channel_id)) {
1796 if (!fh->initialized) {
1797 vpif_dbg(1, debug, "Channel Busy\n");
1798 return -EBUSY;
1799 }
1800 }
1801
1802 ret = v4l2_prio_check(&ch->prio, fh->prio);
1803 if (ret)
1804 return ret;
1805
1806 fh->initialized = 1;
1807
1808 /* Call encoder subdevice function to set the standard */
1809 if (mutex_lock_interruptible(&common->lock))
1810 return -ERESTARTSYS;
1811
1812 ch->video.dv_preset = preset->preset;
1813 ch->video.stdid = V4L2_STD_UNKNOWN;
1814 memset(&ch->video.bt_timings, 0, sizeof(ch->video.bt_timings));
1815
1816 /* Get the information about the standard */
1817 if (vpif_update_std_info(ch)) {
1818 vpif_dbg(1, debug, "Error getting the standard info\n");
1819 ret = -EINVAL;
1820 } else {
1821 /* Configure the default format information */
1822 vpif_config_format(ch);
1823
1824 ret = v4l2_subdev_call(vpif_obj.sd[ch->curr_sd_index],
1825 video, s_dv_preset, preset);
1826 }
1827
1828 mutex_unlock(&common->lock);
1829
1830 return ret;
1831}
1832/**
1833 * vpif_g_dv_presets() - G_DV_PRESETS handler
1834 * @file: file ptr
1835 * @priv: file handle
1836 * @preset: input preset
1837 */
1838static int vpif_g_dv_preset(struct file *file, void *priv,
1839 struct v4l2_dv_preset *preset)
1840{
1841 struct vpif_fh *fh = priv;
1842 struct channel_obj *ch = fh->channel;
1843
1844 preset->preset = ch->video.dv_preset;
1845
1846 return 0;
1847}
1848
1849/**
1850 * vpif_s_dv_timings() - S_DV_TIMINGS handler
1851 * @file: file ptr
1852 * @priv: file handle
1853 * @timings: digital video timings
1854 */
1855static int vpif_s_dv_timings(struct file *file, void *priv,
1856 struct v4l2_dv_timings *timings)
1857{
1858 struct vpif_fh *fh = priv;
1859 struct channel_obj *ch = fh->channel;
1860 struct vpif_params *vpifparams = &ch->vpifparams;
1861 struct vpif_channel_config_params *std_info = &vpifparams->std_info;
1862 struct video_obj *vid_ch = &ch->video;
1863 struct v4l2_bt_timings *bt = &vid_ch->bt_timings;
1864 int ret;
1865
1866 if (timings->type != V4L2_DV_BT_656_1120) {
1867 vpif_dbg(2, debug, "Timing type not defined\n");
1868 return -EINVAL;
1869 }
1870
1871 /* Configure subdevice timings, if any */
1872 ret = v4l2_subdev_call(vpif_obj.sd[ch->curr_sd_index],
1873 video, s_dv_timings, timings);
1874 if (ret == -ENOIOCTLCMD) {
1875 vpif_dbg(2, debug, "Custom DV timings not supported by "
1876 "subdevice\n");
1877 return -EINVAL;
1878 }
1879 if (ret < 0) {
1880 vpif_dbg(2, debug, "Error setting custom DV timings\n");
1881 return ret;
1882 }
1883
1884 if (!(timings->bt.width && timings->bt.height &&
1885 (timings->bt.hbackporch ||
1886 timings->bt.hfrontporch ||
1887 timings->bt.hsync) &&
1888 timings->bt.vfrontporch &&
1889 (timings->bt.vbackporch ||
1890 timings->bt.vsync))) {
1891 vpif_dbg(2, debug, "Timings for width, height, "
1892 "horizontal back porch, horizontal sync, "
1893 "horizontal front porch, vertical back porch, "
1894 "vertical sync and vertical back porch "
1895 "must be defined\n");
1896 return -EINVAL;
1897 }
1898
1899 *bt = timings->bt;
1900
1901 /* Configure video port timings */
1902
1903 std_info->eav2sav = bt->hbackporch + bt->hfrontporch +
1904 bt->hsync - 8;
1905 std_info->sav2eav = bt->width;
1906
1907 std_info->l1 = 1;
1908 std_info->l3 = bt->vsync + bt->vbackporch + 1;
1909
1910 if (bt->interlaced) {
1911 if (bt->il_vbackporch || bt->il_vfrontporch || bt->il_vsync) {
1912 std_info->vsize = bt->height * 2 +
1913 bt->vfrontporch + bt->vsync + bt->vbackporch +
1914 bt->il_vfrontporch + bt->il_vsync +
1915 bt->il_vbackporch;
1916 std_info->l5 = std_info->vsize/2 -
1917 (bt->vfrontporch - 1);
1918 std_info->l7 = std_info->vsize/2 + 1;
1919 std_info->l9 = std_info->l7 + bt->il_vsync +
1920 bt->il_vbackporch + 1;
1921 std_info->l11 = std_info->vsize -
1922 (bt->il_vfrontporch - 1);
1923 } else {
1924 vpif_dbg(2, debug, "Required timing values for "
1925 "interlaced BT format missing\n");
1926 return -EINVAL;
1927 }
1928 } else {
1929 std_info->vsize = bt->height + bt->vfrontporch +
1930 bt->vsync + bt->vbackporch;
1931 std_info->l5 = std_info->vsize - (bt->vfrontporch - 1);
1932 }
1933 strncpy(std_info->name, "Custom timings BT656/1120", VPIF_MAX_NAME);
1934 std_info->width = bt->width;
1935 std_info->height = bt->height;
1936 std_info->frm_fmt = bt->interlaced ? 0 : 1;
1937 std_info->ycmux_mode = 0;
1938 std_info->capture_format = 0;
1939 std_info->vbi_supported = 0;
1940 std_info->hd_sd = 1;
1941 std_info->stdid = 0;
1942 std_info->dv_preset = V4L2_DV_INVALID;
1943
1944 vid_ch->stdid = 0;
1945 vid_ch->dv_preset = V4L2_DV_INVALID;
1946 return 0;
1947}
1948
1949/**
1950 * vpif_g_dv_timings() - G_DV_TIMINGS handler
1951 * @file: file ptr
1952 * @priv: file handle
1953 * @timings: digital video timings
1954 */
1955static int vpif_g_dv_timings(struct file *file, void *priv,
1956 struct v4l2_dv_timings *timings)
1957{
1958 struct vpif_fh *fh = priv;
1959 struct channel_obj *ch = fh->channel;
1960 struct video_obj *vid_ch = &ch->video;
1961 struct v4l2_bt_timings *bt = &vid_ch->bt_timings;
1962
1963 timings->bt = *bt;
1964
1965 return 0;
1966}
1967
1968/*
1969 * vpif_g_chip_ident() - Identify the chip
1970 * @file: file ptr
1971 * @priv: file handle
1972 * @chip: chip identity
1973 *
1974 * Returns zero or -EINVAL if read operations fails.
1975 */
1976static int vpif_g_chip_ident(struct file *file, void *priv,
1977 struct v4l2_dbg_chip_ident *chip)
1978{
1979 chip->ident = V4L2_IDENT_NONE;
1980 chip->revision = 0;
1981 if (chip->match.type != V4L2_CHIP_MATCH_I2C_DRIVER &&
1982 chip->match.type != V4L2_CHIP_MATCH_I2C_ADDR) {
1983 vpif_dbg(2, debug, "match_type is invalid.\n");
1984 return -EINVAL;
1985 }
1986
1987 return v4l2_device_call_until_err(&vpif_obj.v4l2_dev, 0, core,
1988 g_chip_ident, chip);
1989}
1990
1991#ifdef CONFIG_VIDEO_ADV_DEBUG
1992/*
1993 * vpif_dbg_g_register() - Read register
1994 * @file: file ptr
1995 * @priv: file handle
1996 * @reg: register to be read
1997 *
1998 * Debugging only
1999 * Returns zero or -EINVAL if read operations fails.
2000 */
2001static int vpif_dbg_g_register(struct file *file, void *priv,
2002 struct v4l2_dbg_register *reg){
2003 struct vpif_fh *fh = priv;
2004 struct channel_obj *ch = fh->channel;
2005
2006 return v4l2_subdev_call(vpif_obj.sd[ch->curr_sd_index], core,
2007 g_register, reg);
2008}
2009
2010/*
2011 * vpif_dbg_s_register() - Write to register
2012 * @file: file ptr
2013 * @priv: file handle
2014 * @reg: register to be modified
2015 *
2016 * Debugging only
2017 * Returns zero or -EINVAL if write operations fails.
2018 */
2019static int vpif_dbg_s_register(struct file *file, void *priv,
2020 struct v4l2_dbg_register *reg){
2021 struct vpif_fh *fh = priv;
2022 struct channel_obj *ch = fh->channel;
2023
2024 return v4l2_subdev_call(vpif_obj.sd[ch->curr_sd_index], core,
2025 s_register, reg);
2026}
2027#endif
2028
2029/*
2030 * vpif_log_status() - Status information
2031 * @file: file ptr
2032 * @priv: file handle
2033 *
2034 * Returns zero.
2035 */
2036static int vpif_log_status(struct file *filep, void *priv)
2037{
2038 /* status for sub devices */
2039 v4l2_device_call_all(&vpif_obj.v4l2_dev, 0, core, log_status);
2040
2041 return 0;
2042}
2043
1810/* vpif capture ioctl operations */ 2044/* vpif capture ioctl operations */
1811static const struct v4l2_ioctl_ops vpif_ioctl_ops = { 2045static const struct v4l2_ioctl_ops vpif_ioctl_ops = {
1812 .vidioc_querycap = vpif_querycap, 2046 .vidioc_querycap = vpif_querycap,
@@ -1829,6 +2063,18 @@ static const struct v4l2_ioctl_ops vpif_ioctl_ops = {
1829 .vidioc_streamon = vpif_streamon, 2063 .vidioc_streamon = vpif_streamon,
1830 .vidioc_streamoff = vpif_streamoff, 2064 .vidioc_streamoff = vpif_streamoff,
1831 .vidioc_cropcap = vpif_cropcap, 2065 .vidioc_cropcap = vpif_cropcap,
2066 .vidioc_enum_dv_presets = vpif_enum_dv_presets,
2067 .vidioc_s_dv_preset = vpif_s_dv_preset,
2068 .vidioc_g_dv_preset = vpif_g_dv_preset,
2069 .vidioc_query_dv_preset = vpif_query_dv_preset,
2070 .vidioc_s_dv_timings = vpif_s_dv_timings,
2071 .vidioc_g_dv_timings = vpif_g_dv_timings,
2072 .vidioc_g_chip_ident = vpif_g_chip_ident,
2073#ifdef CONFIG_VIDEO_ADV_DEBUG
2074 .vidioc_g_register = vpif_dbg_g_register,
2075 .vidioc_s_register = vpif_dbg_s_register,
2076#endif
2077 .vidioc_log_status = vpif_log_status,
1832}; 2078};
1833 2079
1834/* vpif file operations */ 2080/* vpif file operations */
@@ -1836,7 +2082,7 @@ static struct v4l2_file_operations vpif_fops = {
1836 .owner = THIS_MODULE, 2082 .owner = THIS_MODULE,
1837 .open = vpif_open, 2083 .open = vpif_open,
1838 .release = vpif_release, 2084 .release = vpif_release,
1839 .ioctl = video_ioctl2, 2085 .unlocked_ioctl = video_ioctl2,
1840 .mmap = vpif_mmap, 2086 .mmap = vpif_mmap,
1841 .poll = vpif_poll 2087 .poll = vpif_poll
1842}; 2088};
@@ -1979,6 +2225,7 @@ static __init int vpif_probe(struct platform_device *pdev)
1979 common = &(ch->common[VPIF_VIDEO_INDEX]); 2225 common = &(ch->common[VPIF_VIDEO_INDEX]);
1980 spin_lock_init(&common->irqlock); 2226 spin_lock_init(&common->irqlock);
1981 mutex_init(&common->lock); 2227 mutex_init(&common->lock);
2228 ch->video_dev->lock = &common->lock;
1982 /* Initialize prio member of channel object */ 2229 /* Initialize prio member of channel object */
1983 v4l2_prio_init(&ch->prio); 2230 v4l2_prio_init(&ch->prio);
1984 err = video_register_device(ch->video_dev, 2231 err = video_register_device(ch->video_dev,
@@ -2026,9 +2273,9 @@ static __init int vpif_probe(struct platform_device *pdev)
2026 if (vpif_obj.sd[i]) 2273 if (vpif_obj.sd[i])
2027 vpif_obj.sd[i]->grp_id = 1 << i; 2274 vpif_obj.sd[i]->grp_id = 1 << i;
2028 } 2275 }
2029 v4l2_info(&vpif_obj.v4l2_dev, "DM646x VPIF Capture driver"
2030 " initialized\n");
2031 2276
2277 v4l2_info(&vpif_obj.v4l2_dev,
2278 "DM646x VPIF capture driver initialized\n");
2032 return 0; 2279 return 0;
2033 2280
2034probe_subdev_out: 2281probe_subdev_out:
diff --git a/drivers/media/video/davinci/vpif_capture.h b/drivers/media/video/davinci/vpif_capture.h
index 4e12ec8cac6f..7a4196dfdce1 100644
--- a/drivers/media/video/davinci/vpif_capture.h
+++ b/drivers/media/video/davinci/vpif_capture.h
@@ -59,6 +59,8 @@ struct video_obj {
59 enum v4l2_field buf_field; 59 enum v4l2_field buf_field;
60 /* Currently selected or default standard */ 60 /* Currently selected or default standard */
61 v4l2_std_id stdid; 61 v4l2_std_id stdid;
62 u32 dv_preset;
63 struct v4l2_bt_timings bt_timings;
62 /* This is to track the last input that is passed to application */ 64 /* This is to track the last input that is passed to application */
63 u32 input_idx; 65 u32 input_idx;
64}; 66};
diff --git a/drivers/media/video/davinci/vpif_display.c b/drivers/media/video/davinci/vpif_display.c
index 412c65d54fe1..cdf659abdc2a 100644
--- a/drivers/media/video/davinci/vpif_display.c
+++ b/drivers/media/video/davinci/vpif_display.c
@@ -38,6 +38,7 @@
38#include <media/adv7343.h> 38#include <media/adv7343.h>
39#include <media/v4l2-device.h> 39#include <media/v4l2-device.h>
40#include <media/v4l2-ioctl.h> 40#include <media/v4l2-ioctl.h>
41#include <media/v4l2-chip-ident.h>
41 42
42#include <mach/dm646x.h> 43#include <mach/dm646x.h>
43 44
@@ -84,17 +85,6 @@ static struct vpif_config_params config_params = {
84static struct vpif_device vpif_obj = { {NULL} }; 85static struct vpif_device vpif_obj = { {NULL} };
85static struct device *vpif_dev; 86static struct device *vpif_dev;
86 87
87static const struct vpif_channel_config_params ch_params[] = {
88 {
89 "NTSC", 720, 480, 30, 0, 1, 268, 1440, 1, 23, 263, 266,
90 286, 525, 525, 0, 1, 0, V4L2_STD_525_60,
91 },
92 {
93 "PAL", 720, 576, 25, 0, 1, 280, 1440, 1, 23, 311, 313,
94 336, 624, 625, 0, 1, 0, V4L2_STD_625_50,
95 },
96};
97
98/* 88/*
99 * vpif_uservirt_to_phys: This function is used to convert user 89 * vpif_uservirt_to_phys: This function is used to convert user
100 * space virtual address to physical address. 90 * space virtual address to physical address.
@@ -373,30 +363,54 @@ static irqreturn_t vpif_channel_isr(int irq, void *dev_id)
373 return IRQ_HANDLED; 363 return IRQ_HANDLED;
374} 364}
375 365
376static int vpif_get_std_info(struct channel_obj *ch) 366static int vpif_update_std_info(struct channel_obj *ch)
377{ 367{
378 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
379 struct video_obj *vid_ch = &ch->video; 368 struct video_obj *vid_ch = &ch->video;
380 struct vpif_params *vpifparams = &ch->vpifparams; 369 struct vpif_params *vpifparams = &ch->vpifparams;
381 struct vpif_channel_config_params *std_info = &vpifparams->std_info; 370 struct vpif_channel_config_params *std_info = &vpifparams->std_info;
382 const struct vpif_channel_config_params *config; 371 const struct vpif_channel_config_params *config;
383 372
384 int index; 373 int i;
385
386 std_info->stdid = vid_ch->stdid;
387 if (!std_info->stdid)
388 return -1;
389 374
390 for (index = 0; index < ARRAY_SIZE(ch_params); index++) { 375 for (i = 0; i < vpif_ch_params_count; i++) {
391 config = &ch_params[index]; 376 config = &ch_params[i];
392 if (config->stdid & std_info->stdid) { 377 if (config->hd_sd == 0) {
393 memcpy(std_info, config, sizeof(*config)); 378 vpif_dbg(2, debug, "SD format\n");
394 break; 379 if (config->stdid & vid_ch->stdid) {
380 memcpy(std_info, config, sizeof(*config));
381 break;
382 }
383 } else {
384 vpif_dbg(2, debug, "HD format\n");
385 if (config->dv_preset == vid_ch->dv_preset) {
386 memcpy(std_info, config, sizeof(*config));
387 break;
388 }
395 } 389 }
396 } 390 }
397 391
398 if (index == ARRAY_SIZE(ch_params)) 392 if (i == vpif_ch_params_count) {
399 return -1; 393 vpif_dbg(1, debug, "Format not found\n");
394 return -EINVAL;
395 }
396
397 return 0;
398}
399
400static int vpif_update_resolution(struct channel_obj *ch)
401{
402 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
403 struct video_obj *vid_ch = &ch->video;
404 struct vpif_params *vpifparams = &ch->vpifparams;
405 struct vpif_channel_config_params *std_info = &vpifparams->std_info;
406
407 if (!vid_ch->stdid && !vid_ch->dv_preset && !vid_ch->bt_timings.height)
408 return -EINVAL;
409
410 if (vid_ch->stdid || vid_ch->dv_preset) {
411 if (vpif_update_std_info(ch))
412 return -EINVAL;
413 }
400 414
401 common->fmt.fmt.pix.width = std_info->width; 415 common->fmt.fmt.pix.width = std_info->width;
402 common->fmt.fmt.pix.height = std_info->height; 416 common->fmt.fmt.pix.height = std_info->height;
@@ -404,8 +418,8 @@ static int vpif_get_std_info(struct channel_obj *ch)
404 common->fmt.fmt.pix.width, common->fmt.fmt.pix.height); 418 common->fmt.fmt.pix.width, common->fmt.fmt.pix.height);
405 419
406 /* Set height and width paramateres */ 420 /* Set height and width paramateres */
407 ch->common[VPIF_VIDEO_INDEX].height = std_info->height; 421 common->height = std_info->height;
408 ch->common[VPIF_VIDEO_INDEX].width = std_info->width; 422 common->width = std_info->width;
409 423
410 return 0; 424 return 0;
411} 425}
@@ -516,10 +530,8 @@ static int vpif_check_format(struct channel_obj *ch,
516 else 530 else
517 sizeimage = config_params.channel_bufsize[ch->channel_id]; 531 sizeimage = config_params.channel_bufsize[ch->channel_id];
518 532
519 if (vpif_get_std_info(ch)) { 533 if (vpif_update_resolution(ch))
520 vpif_err("Error getting the standard info\n");
521 return -EINVAL; 534 return -EINVAL;
522 }
523 535
524 hpitch = pixfmt->bytesperline; 536 hpitch = pixfmt->bytesperline;
525 vpitch = sizeimage / (hpitch * 2); 537 vpitch = sizeimage / (hpitch * 2);
@@ -568,7 +580,10 @@ static void vpif_config_addr(struct channel_obj *ch, int muxmode)
568static int vpif_mmap(struct file *filep, struct vm_area_struct *vma) 580static int vpif_mmap(struct file *filep, struct vm_area_struct *vma)
569{ 581{
570 struct vpif_fh *fh = filep->private_data; 582 struct vpif_fh *fh = filep->private_data;
571 struct common_obj *common = &fh->channel->common[VPIF_VIDEO_INDEX]; 583 struct channel_obj *ch = fh->channel;
584 struct common_obj *common = &(ch->common[VPIF_VIDEO_INDEX]);
585
586 vpif_dbg(2, debug, "vpif_mmap\n");
572 587
573 return videobuf_mmap_mapper(&common->buffer_queue, vma); 588 return videobuf_mmap_mapper(&common->buffer_queue, vma);
574} 589}
@@ -637,9 +652,6 @@ static int vpif_release(struct file *filep)
637 struct channel_obj *ch = fh->channel; 652 struct channel_obj *ch = fh->channel;
638 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; 653 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
639 654
640 if (mutex_lock_interruptible(&common->lock))
641 return -ERESTARTSYS;
642
643 /* if this instance is doing IO */ 655 /* if this instance is doing IO */
644 if (fh->io_allowed[VPIF_VIDEO_INDEX]) { 656 if (fh->io_allowed[VPIF_VIDEO_INDEX]) {
645 /* Reset io_usrs member of channel object */ 657 /* Reset io_usrs member of channel object */
@@ -662,8 +674,6 @@ static int vpif_release(struct file *filep)
662 config_params.numbuffers[ch->channel_id]; 674 config_params.numbuffers[ch->channel_id];
663 } 675 }
664 676
665 mutex_unlock(&common->lock);
666
667 /* Decrement channel usrs counter */ 677 /* Decrement channel usrs counter */
668 atomic_dec(&ch->usrs); 678 atomic_dec(&ch->usrs);
669 /* If this file handle has initialize encoder device, reset it */ 679 /* If this file handle has initialize encoder device, reset it */
@@ -680,7 +690,12 @@ static int vpif_release(struct file *filep)
680} 690}
681 691
682/* functions implementing ioctls */ 692/* functions implementing ioctls */
683 693/**
694 * vpif_querycap() - QUERYCAP handler
695 * @file: file ptr
696 * @priv: file handle
697 * @cap: ptr to v4l2_capability structure
698 */
684static int vpif_querycap(struct file *file, void *priv, 699static int vpif_querycap(struct file *file, void *priv,
685 struct v4l2_capability *cap) 700 struct v4l2_capability *cap)
686{ 701{
@@ -722,17 +737,9 @@ static int vpif_g_fmt_vid_out(struct file *file, void *priv,
722 if (common->fmt.type != fmt->type) 737 if (common->fmt.type != fmt->type)
723 return -EINVAL; 738 return -EINVAL;
724 739
725 /* Fill in the information about format */ 740 if (vpif_update_resolution(ch))
726 if (mutex_lock_interruptible(&common->lock))
727 return -ERESTARTSYS;
728
729 if (vpif_get_std_info(ch)) {
730 vpif_err("Error getting the standard info\n");
731 return -EINVAL; 741 return -EINVAL;
732 }
733
734 *fmt = common->fmt; 742 *fmt = common->fmt;
735 mutex_unlock(&common->lock);
736 return 0; 743 return 0;
737} 744}
738 745
@@ -773,12 +780,7 @@ static int vpif_s_fmt_vid_out(struct file *file, void *priv,
773 /* store the pix format in the channel object */ 780 /* store the pix format in the channel object */
774 common->fmt.fmt.pix = *pixfmt; 781 common->fmt.fmt.pix = *pixfmt;
775 /* store the format in the channel object */ 782 /* store the format in the channel object */
776 if (mutex_lock_interruptible(&common->lock))
777 return -ERESTARTSYS;
778
779 common->fmt = *fmt; 783 common->fmt = *fmt;
780 mutex_unlock(&common->lock);
781
782 return 0; 784 return 0;
783} 785}
784 786
@@ -808,7 +810,6 @@ static int vpif_reqbufs(struct file *file, void *priv,
808 struct common_obj *common; 810 struct common_obj *common;
809 enum v4l2_field field; 811 enum v4l2_field field;
810 u8 index = 0; 812 u8 index = 0;
811 int ret = 0;
812 813
813 /* This file handle has not initialized the channel, 814 /* This file handle has not initialized the channel,
814 It is not allowed to do settings */ 815 It is not allowed to do settings */
@@ -826,18 +827,12 @@ static int vpif_reqbufs(struct file *file, void *priv,
826 index = VPIF_VIDEO_INDEX; 827 index = VPIF_VIDEO_INDEX;
827 828
828 common = &ch->common[index]; 829 common = &ch->common[index];
829 if (mutex_lock_interruptible(&common->lock))
830 return -ERESTARTSYS;
831 830
832 if (common->fmt.type != reqbuf->type) { 831 if (common->fmt.type != reqbuf->type)
833 ret = -EINVAL; 832 return -EINVAL;
834 goto reqbuf_exit;
835 }
836 833
837 if (0 != common->io_usrs) { 834 if (0 != common->io_usrs)
838 ret = -EBUSY; 835 return -EBUSY;
839 goto reqbuf_exit;
840 }
841 836
842 if (reqbuf->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) { 837 if (reqbuf->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) {
843 if (common->fmt.fmt.pix.field == V4L2_FIELD_ANY) 838 if (common->fmt.fmt.pix.field == V4L2_FIELD_ANY)
@@ -854,7 +849,7 @@ static int vpif_reqbufs(struct file *file, void *priv,
854 &common->irqlock, 849 &common->irqlock,
855 reqbuf->type, field, 850 reqbuf->type, field,
856 sizeof(struct videobuf_buffer), fh, 851 sizeof(struct videobuf_buffer), fh,
857 NULL); 852 &common->lock);
858 853
859 /* Set io allowed member of file handle to TRUE */ 854 /* Set io allowed member of file handle to TRUE */
860 fh->io_allowed[index] = 1; 855 fh->io_allowed[index] = 1;
@@ -865,11 +860,7 @@ static int vpif_reqbufs(struct file *file, void *priv,
865 INIT_LIST_HEAD(&common->dma_queue); 860 INIT_LIST_HEAD(&common->dma_queue);
866 861
867 /* Allocate buffers */ 862 /* Allocate buffers */
868 ret = videobuf_reqbufs(&common->buffer_queue, reqbuf); 863 return videobuf_reqbufs(&common->buffer_queue, reqbuf);
869
870reqbuf_exit:
871 mutex_unlock(&common->lock);
872 return ret;
873} 864}
874 865
875static int vpif_querybuf(struct file *file, void *priv, 866static int vpif_querybuf(struct file *file, void *priv,
@@ -990,22 +981,19 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id *std_id)
990 } 981 }
991 982
992 /* Call encoder subdevice function to set the standard */ 983 /* Call encoder subdevice function to set the standard */
993 if (mutex_lock_interruptible(&common->lock))
994 return -ERESTARTSYS;
995
996 ch->video.stdid = *std_id; 984 ch->video.stdid = *std_id;
985 ch->video.dv_preset = V4L2_DV_INVALID;
986 memset(&ch->video.bt_timings, 0, sizeof(ch->video.bt_timings));
987
997 /* Get the information about the standard */ 988 /* Get the information about the standard */
998 if (vpif_get_std_info(ch)) { 989 if (vpif_update_resolution(ch))
999 vpif_err("Error getting the standard info\n");
1000 return -EINVAL; 990 return -EINVAL;
1001 }
1002 991
1003 if ((ch->vpifparams.std_info.width * 992 if ((ch->vpifparams.std_info.width *
1004 ch->vpifparams.std_info.height * 2) > 993 ch->vpifparams.std_info.height * 2) >
1005 config_params.channel_bufsize[ch->channel_id]) { 994 config_params.channel_bufsize[ch->channel_id]) {
1006 vpif_err("invalid std for this size\n"); 995 vpif_err("invalid std for this size\n");
1007 ret = -EINVAL; 996 return -EINVAL;
1008 goto s_std_exit;
1009 } 997 }
1010 998
1011 common->fmt.fmt.pix.bytesperline = common->fmt.fmt.pix.width; 999 common->fmt.fmt.pix.bytesperline = common->fmt.fmt.pix.width;
@@ -1016,16 +1004,13 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id *std_id)
1016 s_std_output, *std_id); 1004 s_std_output, *std_id);
1017 if (ret < 0) { 1005 if (ret < 0) {
1018 vpif_err("Failed to set output standard\n"); 1006 vpif_err("Failed to set output standard\n");
1019 goto s_std_exit; 1007 return ret;
1020 } 1008 }
1021 1009
1022 ret = v4l2_device_call_until_err(&vpif_obj.v4l2_dev, 1, core, 1010 ret = v4l2_device_call_until_err(&vpif_obj.v4l2_dev, 1, core,
1023 s_std, *std_id); 1011 s_std, *std_id);
1024 if (ret < 0) 1012 if (ret < 0)
1025 vpif_err("Failed to set standard for sub devices\n"); 1013 vpif_err("Failed to set standard for sub devices\n");
1026
1027s_std_exit:
1028 mutex_unlock(&common->lock);
1029 return ret; 1014 return ret;
1030} 1015}
1031 1016
@@ -1090,21 +1075,17 @@ static int vpif_streamon(struct file *file, void *priv,
1090 if (ret < 0) 1075 if (ret < 0)
1091 return ret; 1076 return ret;
1092 1077
1093 /* Call videobuf_streamon to start streaming in videobuf */ 1078 /* Call videobuf_streamon to start streaming in videobuf */
1094 ret = videobuf_streamon(&common->buffer_queue); 1079 ret = videobuf_streamon(&common->buffer_queue);
1095 if (ret < 0) { 1080 if (ret < 0) {
1096 vpif_err("videobuf_streamon\n"); 1081 vpif_err("videobuf_streamon\n");
1097 return ret; 1082 return ret;
1098 } 1083 }
1099 1084
1100 if (mutex_lock_interruptible(&common->lock))
1101 return -ERESTARTSYS;
1102
1103 /* If buffer queue is empty, return error */ 1085 /* If buffer queue is empty, return error */
1104 if (list_empty(&common->dma_queue)) { 1086 if (list_empty(&common->dma_queue)) {
1105 vpif_err("buffer queue is empty\n"); 1087 vpif_err("buffer queue is empty\n");
1106 ret = -EIO; 1088 return -EIO;
1107 goto streamon_exit;
1108 } 1089 }
1109 1090
1110 /* Get the next frame from the buffer queue */ 1091 /* Get the next frame from the buffer queue */
@@ -1130,8 +1111,7 @@ static int vpif_streamon(struct file *file, void *priv,
1130 || (!ch->vpifparams.std_info.frm_fmt 1111 || (!ch->vpifparams.std_info.frm_fmt
1131 && (common->fmt.fmt.pix.field == V4L2_FIELD_NONE))) { 1112 && (common->fmt.fmt.pix.field == V4L2_FIELD_NONE))) {
1132 vpif_err("conflict in field format and std format\n"); 1113 vpif_err("conflict in field format and std format\n");
1133 ret = -EINVAL; 1114 return -EINVAL;
1134 goto streamon_exit;
1135 } 1115 }
1136 1116
1137 /* clock settings */ 1117 /* clock settings */
@@ -1140,13 +1120,13 @@ static int vpif_streamon(struct file *file, void *priv,
1140 ch->vpifparams.std_info.hd_sd); 1120 ch->vpifparams.std_info.hd_sd);
1141 if (ret < 0) { 1121 if (ret < 0) {
1142 vpif_err("can't set clock\n"); 1122 vpif_err("can't set clock\n");
1143 goto streamon_exit; 1123 return ret;
1144 } 1124 }
1145 1125
1146 /* set the parameters and addresses */ 1126 /* set the parameters and addresses */
1147 ret = vpif_set_video_params(vpif, ch->channel_id + 2); 1127 ret = vpif_set_video_params(vpif, ch->channel_id + 2);
1148 if (ret < 0) 1128 if (ret < 0)
1149 goto streamon_exit; 1129 return ret;
1150 1130
1151 common->started = ret; 1131 common->started = ret;
1152 vpif_config_addr(ch, ret); 1132 vpif_config_addr(ch, ret);
@@ -1171,9 +1151,6 @@ static int vpif_streamon(struct file *file, void *priv,
1171 } 1151 }
1172 channel_first_int[VPIF_VIDEO_INDEX][ch->channel_id] = 1; 1152 channel_first_int[VPIF_VIDEO_INDEX][ch->channel_id] = 1;
1173 } 1153 }
1174
1175streamon_exit:
1176 mutex_unlock(&common->lock);
1177 return ret; 1154 return ret;
1178} 1155}
1179 1156
@@ -1199,9 +1176,6 @@ static int vpif_streamoff(struct file *file, void *priv,
1199 return -EINVAL; 1176 return -EINVAL;
1200 } 1177 }
1201 1178
1202 if (mutex_lock_interruptible(&common->lock))
1203 return -ERESTARTSYS;
1204
1205 if (buftype == V4L2_BUF_TYPE_VIDEO_OUTPUT) { 1179 if (buftype == V4L2_BUF_TYPE_VIDEO_OUTPUT) {
1206 /* disable channel */ 1180 /* disable channel */
1207 if (VPIF_CHANNEL2_VIDEO == ch->channel_id) { 1181 if (VPIF_CHANNEL2_VIDEO == ch->channel_id) {
@@ -1216,8 +1190,6 @@ static int vpif_streamoff(struct file *file, void *priv,
1216 } 1190 }
1217 1191
1218 common->started = 0; 1192 common->started = 0;
1219 mutex_unlock(&common->lock);
1220
1221 return videobuf_streamoff(&common->buffer_queue); 1193 return videobuf_streamoff(&common->buffer_queue);
1222} 1194}
1223 1195
@@ -1264,13 +1236,9 @@ static int vpif_s_output(struct file *file, void *priv, unsigned int i)
1264 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; 1236 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
1265 int ret = 0; 1237 int ret = 0;
1266 1238
1267 if (mutex_lock_interruptible(&common->lock))
1268 return -ERESTARTSYS;
1269
1270 if (common->started) { 1239 if (common->started) {
1271 vpif_err("Streaming in progress\n"); 1240 vpif_err("Streaming in progress\n");
1272 ret = -EBUSY; 1241 return -EBUSY;
1273 goto s_output_exit;
1274 } 1242 }
1275 1243
1276 ret = v4l2_device_call_until_err(&vpif_obj.v4l2_dev, 1, video, 1244 ret = v4l2_device_call_until_err(&vpif_obj.v4l2_dev, 1, video,
@@ -1280,9 +1248,6 @@ static int vpif_s_output(struct file *file, void *priv, unsigned int i)
1280 vpif_err("Failed to set output standard\n"); 1248 vpif_err("Failed to set output standard\n");
1281 1249
1282 vid_ch->output_id = i; 1250 vid_ch->output_id = i;
1283
1284s_output_exit:
1285 mutex_unlock(&common->lock);
1286 return ret; 1251 return ret;
1287} 1252}
1288 1253
@@ -1315,6 +1280,287 @@ static int vpif_s_priority(struct file *file, void *priv, enum v4l2_priority p)
1315 return v4l2_prio_change(&ch->prio, &fh->prio, p); 1280 return v4l2_prio_change(&ch->prio, &fh->prio, p);
1316} 1281}
1317 1282
1283/**
1284 * vpif_enum_dv_presets() - ENUM_DV_PRESETS handler
1285 * @file: file ptr
1286 * @priv: file handle
1287 * @preset: input preset
1288 */
1289static int vpif_enum_dv_presets(struct file *file, void *priv,
1290 struct v4l2_dv_enum_preset *preset)
1291{
1292 struct vpif_fh *fh = priv;
1293 struct channel_obj *ch = fh->channel;
1294 struct video_obj *vid_ch = &ch->video;
1295
1296 return v4l2_subdev_call(vpif_obj.sd[vid_ch->output_id],
1297 video, enum_dv_presets, preset);
1298}
1299
1300/**
1301 * vpif_s_dv_presets() - S_DV_PRESETS handler
1302 * @file: file ptr
1303 * @priv: file handle
1304 * @preset: input preset
1305 */
1306static int vpif_s_dv_preset(struct file *file, void *priv,
1307 struct v4l2_dv_preset *preset)
1308{
1309 struct vpif_fh *fh = priv;
1310 struct channel_obj *ch = fh->channel;
1311 struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
1312 struct video_obj *vid_ch = &ch->video;
1313 int ret = 0;
1314
1315 if (common->started) {
1316 vpif_dbg(1, debug, "streaming in progress\n");
1317 return -EBUSY;
1318 }
1319
1320 ret = v4l2_prio_check(&ch->prio, fh->prio);
1321 if (ret != 0)
1322 return ret;
1323
1324 fh->initialized = 1;
1325
1326 /* Call encoder subdevice function to set the standard */
1327 if (mutex_lock_interruptible(&common->lock))
1328 return -ERESTARTSYS;
1329
1330 ch->video.dv_preset = preset->preset;
1331 ch->video.stdid = V4L2_STD_UNKNOWN;
1332 memset(&ch->video.bt_timings, 0, sizeof(ch->video.bt_timings));
1333
1334 /* Get the information about the standard */
1335 if (vpif_update_resolution(ch)) {
1336 ret = -EINVAL;
1337 } else {
1338 /* Configure the default format information */
1339 vpif_config_format(ch);
1340
1341 ret = v4l2_subdev_call(vpif_obj.sd[vid_ch->output_id],
1342 video, s_dv_preset, preset);
1343 }
1344
1345 mutex_unlock(&common->lock);
1346
1347 return ret;
1348}
1349/**
1350 * vpif_g_dv_presets() - G_DV_PRESETS handler
1351 * @file: file ptr
1352 * @priv: file handle
1353 * @preset: input preset
1354 */
1355static int vpif_g_dv_preset(struct file *file, void *priv,
1356 struct v4l2_dv_preset *preset)
1357{
1358 struct vpif_fh *fh = priv;
1359 struct channel_obj *ch = fh->channel;
1360
1361 preset->preset = ch->video.dv_preset;
1362
1363 return 0;
1364}
1365/**
1366 * vpif_s_dv_timings() - S_DV_TIMINGS handler
1367 * @file: file ptr
1368 * @priv: file handle
1369 * @timings: digital video timings
1370 */
1371static int vpif_s_dv_timings(struct file *file, void *priv,
1372 struct v4l2_dv_timings *timings)
1373{
1374 struct vpif_fh *fh = priv;
1375 struct channel_obj *ch = fh->channel;
1376 struct vpif_params *vpifparams = &ch->vpifparams;
1377 struct vpif_channel_config_params *std_info = &vpifparams->std_info;
1378 struct video_obj *vid_ch = &ch->video;
1379 struct v4l2_bt_timings *bt = &vid_ch->bt_timings;
1380 int ret;
1381
1382 if (timings->type != V4L2_DV_BT_656_1120) {
1383 vpif_dbg(2, debug, "Timing type not defined\n");
1384 return -EINVAL;
1385 }
1386
1387 /* Configure subdevice timings, if any */
1388 ret = v4l2_subdev_call(vpif_obj.sd[vid_ch->output_id],
1389 video, s_dv_timings, timings);
1390 if (ret == -ENOIOCTLCMD) {
1391 vpif_dbg(2, debug, "Custom DV timings not supported by "
1392 "subdevice\n");
1393 return -EINVAL;
1394 }
1395 if (ret < 0) {
1396 vpif_dbg(2, debug, "Error setting custom DV timings\n");
1397 return ret;
1398 }
1399
1400 if (!(timings->bt.width && timings->bt.height &&
1401 (timings->bt.hbackporch ||
1402 timings->bt.hfrontporch ||
1403 timings->bt.hsync) &&
1404 timings->bt.vfrontporch &&
1405 (timings->bt.vbackporch ||
1406 timings->bt.vsync))) {
1407 vpif_dbg(2, debug, "Timings for width, height, "
1408 "horizontal back porch, horizontal sync, "
1409 "horizontal front porch, vertical back porch, "
1410 "vertical sync and vertical back porch "
1411 "must be defined\n");
1412 return -EINVAL;
1413 }
1414
1415 *bt = timings->bt;
1416
1417 /* Configure video port timings */
1418
1419 std_info->eav2sav = bt->hbackporch + bt->hfrontporch +
1420 bt->hsync - 8;
1421 std_info->sav2eav = bt->width;
1422
1423 std_info->l1 = 1;
1424 std_info->l3 = bt->vsync + bt->vbackporch + 1;
1425
1426 if (bt->interlaced) {
1427 if (bt->il_vbackporch || bt->il_vfrontporch || bt->il_vsync) {
1428 std_info->vsize = bt->height * 2 +
1429 bt->vfrontporch + bt->vsync + bt->vbackporch +
1430 bt->il_vfrontporch + bt->il_vsync +
1431 bt->il_vbackporch;
1432 std_info->l5 = std_info->vsize/2 -
1433 (bt->vfrontporch - 1);
1434 std_info->l7 = std_info->vsize/2 + 1;
1435 std_info->l9 = std_info->l7 + bt->il_vsync +
1436 bt->il_vbackporch + 1;
1437 std_info->l11 = std_info->vsize -
1438 (bt->il_vfrontporch - 1);
1439 } else {
1440 vpif_dbg(2, debug, "Required timing values for "
1441 "interlaced BT format missing\n");
1442 return -EINVAL;
1443 }
1444 } else {
1445 std_info->vsize = bt->height + bt->vfrontporch +
1446 bt->vsync + bt->vbackporch;
1447 std_info->l5 = std_info->vsize - (bt->vfrontporch - 1);
1448 }
1449 strncpy(std_info->name, "Custom timings BT656/1120",
1450 VPIF_MAX_NAME);
1451 std_info->width = bt->width;
1452 std_info->height = bt->height;
1453 std_info->frm_fmt = bt->interlaced ? 0 : 1;
1454 std_info->ycmux_mode = 0;
1455 std_info->capture_format = 0;
1456 std_info->vbi_supported = 0;
1457 std_info->hd_sd = 1;
1458 std_info->stdid = 0;
1459 std_info->dv_preset = V4L2_DV_INVALID;
1460
1461 vid_ch->stdid = 0;
1462 vid_ch->dv_preset = V4L2_DV_INVALID;
1463
1464 return 0;
1465}
1466
1467/**
1468 * vpif_g_dv_timings() - G_DV_TIMINGS handler
1469 * @file: file ptr
1470 * @priv: file handle
1471 * @timings: digital video timings
1472 */
1473static int vpif_g_dv_timings(struct file *file, void *priv,
1474 struct v4l2_dv_timings *timings)
1475{
1476 struct vpif_fh *fh = priv;
1477 struct channel_obj *ch = fh->channel;
1478 struct video_obj *vid_ch = &ch->video;
1479 struct v4l2_bt_timings *bt = &vid_ch->bt_timings;
1480
1481 timings->bt = *bt;
1482
1483 return 0;
1484}
1485
1486/*
1487 * vpif_g_chip_ident() - Identify the chip
1488 * @file: file ptr
1489 * @priv: file handle
1490 * @chip: chip identity
1491 *
1492 * Returns zero or -EINVAL if read operations fails.
1493 */
1494static int vpif_g_chip_ident(struct file *file, void *priv,
1495 struct v4l2_dbg_chip_ident *chip)
1496{
1497 chip->ident = V4L2_IDENT_NONE;
1498 chip->revision = 0;
1499 if (chip->match.type != V4L2_CHIP_MATCH_I2C_DRIVER &&
1500 chip->match.type != V4L2_CHIP_MATCH_I2C_ADDR) {
1501 vpif_dbg(2, debug, "match_type is invalid.\n");
1502 return -EINVAL;
1503 }
1504
1505 return v4l2_device_call_until_err(&vpif_obj.v4l2_dev, 0, core,
1506 g_chip_ident, chip);
1507}
1508
1509#ifdef CONFIG_VIDEO_ADV_DEBUG
1510/*
1511 * vpif_dbg_g_register() - Read register
1512 * @file: file ptr
1513 * @priv: file handle
1514 * @reg: register to be read
1515 *
1516 * Debugging only
1517 * Returns zero or -EINVAL if read operations fails.
1518 */
1519static int vpif_dbg_g_register(struct file *file, void *priv,
1520 struct v4l2_dbg_register *reg){
1521 struct vpif_fh *fh = priv;
1522 struct channel_obj *ch = fh->channel;
1523 struct video_obj *vid_ch = &ch->video;
1524
1525 return v4l2_subdev_call(vpif_obj.sd[vid_ch->output_id], core,
1526 g_register, reg);
1527}
1528
1529/*
1530 * vpif_dbg_s_register() - Write to register
1531 * @file: file ptr
1532 * @priv: file handle
1533 * @reg: register to be modified
1534 *
1535 * Debugging only
1536 * Returns zero or -EINVAL if write operations fails.
1537 */
1538static int vpif_dbg_s_register(struct file *file, void *priv,
1539 struct v4l2_dbg_register *reg){
1540 struct vpif_fh *fh = priv;
1541 struct channel_obj *ch = fh->channel;
1542 struct video_obj *vid_ch = &ch->video;
1543
1544 return v4l2_subdev_call(vpif_obj.sd[vid_ch->output_id], core,
1545 s_register, reg);
1546}
1547#endif
1548
1549/*
1550 * vpif_log_status() - Status information
1551 * @file: file ptr
1552 * @priv: file handle
1553 *
1554 * Returns zero.
1555 */
1556static int vpif_log_status(struct file *filep, void *priv)
1557{
1558 /* status for sub devices */
1559 v4l2_device_call_all(&vpif_obj.v4l2_dev, 0, core, log_status);
1560
1561 return 0;
1562}
1563
1318/* vpif display ioctl operations */ 1564/* vpif display ioctl operations */
1319static const struct v4l2_ioctl_ops vpif_ioctl_ops = { 1565static const struct v4l2_ioctl_ops vpif_ioctl_ops = {
1320 .vidioc_querycap = vpif_querycap, 1566 .vidioc_querycap = vpif_querycap,
@@ -1336,13 +1582,24 @@ static const struct v4l2_ioctl_ops vpif_ioctl_ops = {
1336 .vidioc_s_output = vpif_s_output, 1582 .vidioc_s_output = vpif_s_output,
1337 .vidioc_g_output = vpif_g_output, 1583 .vidioc_g_output = vpif_g_output,
1338 .vidioc_cropcap = vpif_cropcap, 1584 .vidioc_cropcap = vpif_cropcap,
1585 .vidioc_enum_dv_presets = vpif_enum_dv_presets,
1586 .vidioc_s_dv_preset = vpif_s_dv_preset,
1587 .vidioc_g_dv_preset = vpif_g_dv_preset,
1588 .vidioc_s_dv_timings = vpif_s_dv_timings,
1589 .vidioc_g_dv_timings = vpif_g_dv_timings,
1590 .vidioc_g_chip_ident = vpif_g_chip_ident,
1591#ifdef CONFIG_VIDEO_ADV_DEBUG
1592 .vidioc_g_register = vpif_dbg_g_register,
1593 .vidioc_s_register = vpif_dbg_s_register,
1594#endif
1595 .vidioc_log_status = vpif_log_status,
1339}; 1596};
1340 1597
1341static const struct v4l2_file_operations vpif_fops = { 1598static const struct v4l2_file_operations vpif_fops = {
1342 .owner = THIS_MODULE, 1599 .owner = THIS_MODULE,
1343 .open = vpif_open, 1600 .open = vpif_open,
1344 .release = vpif_release, 1601 .release = vpif_release,
1345 .ioctl = video_ioctl2, 1602 .unlocked_ioctl = video_ioctl2,
1346 .mmap = vpif_mmap, 1603 .mmap = vpif_mmap,
1347 .poll = vpif_poll 1604 .poll = vpif_poll
1348}; 1605};
@@ -1526,6 +1783,7 @@ static __init int vpif_probe(struct platform_device *pdev)
1526 v4l2_prio_init(&ch->prio); 1783 v4l2_prio_init(&ch->prio);
1527 ch->common[VPIF_VIDEO_INDEX].fmt.type = 1784 ch->common[VPIF_VIDEO_INDEX].fmt.type =
1528 V4L2_BUF_TYPE_VIDEO_OUTPUT; 1785 V4L2_BUF_TYPE_VIDEO_OUTPUT;
1786 ch->video_dev->lock = &common->lock;
1529 1787
1530 /* register video device */ 1788 /* register video device */
1531 vpif_dbg(1, debug, "channel=%x,channel->video_dev=%x\n", 1789 vpif_dbg(1, debug, "channel=%x,channel->video_dev=%x\n",
@@ -1565,6 +1823,8 @@ static __init int vpif_probe(struct platform_device *pdev)
1565 vpif_obj.sd[i]->grp_id = 1 << i; 1823 vpif_obj.sd[i]->grp_id = 1 << i;
1566 } 1824 }
1567 1825
1826 v4l2_info(&vpif_obj.v4l2_dev,
1827 "DM646x VPIF display driver initialized\n");
1568 return 0; 1828 return 0;
1569 1829
1570probe_subdev_out: 1830probe_subdev_out:
diff --git a/drivers/media/video/davinci/vpif_display.h b/drivers/media/video/davinci/vpif_display.h
index a2a7cd166bbf..b53aaa883075 100644
--- a/drivers/media/video/davinci/vpif_display.h
+++ b/drivers/media/video/davinci/vpif_display.h
@@ -67,6 +67,8 @@ struct video_obj {
67 * most recent displayed frame only */ 67 * most recent displayed frame only */
68 v4l2_std_id stdid; /* Currently selected or default 68 v4l2_std_id stdid; /* Currently selected or default
69 * standard */ 69 * standard */
70 u32 dv_preset;
71 struct v4l2_bt_timings bt_timings;
70 u32 output_id; /* Current output id */ 72 u32 output_id; /* Current output id */
71}; 73};
72 74
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index 099d5df8c572..87f77a34eeab 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -33,6 +33,7 @@
33#include <media/saa7115.h> 33#include <media/saa7115.h>
34#include <media/tvp5150.h> 34#include <media/tvp5150.h>
35#include <media/tvaudio.h> 35#include <media/tvaudio.h>
36#include <media/mt9v011.h>
36#include <media/i2c-addr.h> 37#include <media/i2c-addr.h>
37#include <media/tveeprom.h> 38#include <media/tveeprom.h>
38#include <media/v4l2-common.h> 39#include <media/v4l2-common.h>
@@ -1917,11 +1918,6 @@ static unsigned short tvp5150_addrs[] = {
1917 I2C_CLIENT_END 1918 I2C_CLIENT_END
1918}; 1919};
1919 1920
1920static unsigned short mt9v011_addrs[] = {
1921 0xba >> 1,
1922 I2C_CLIENT_END
1923};
1924
1925static unsigned short msp3400_addrs[] = { 1921static unsigned short msp3400_addrs[] = {
1926 0x80 >> 1, 1922 0x80 >> 1,
1927 0x88 >> 1, 1923 0x88 >> 1,
@@ -2437,6 +2433,7 @@ void em28xx_register_i2c_ir(struct em28xx *dev)
2437 dev->init_data.ir_codes = RC_MAP_RC5_HAUPPAUGE_NEW; 2433 dev->init_data.ir_codes = RC_MAP_RC5_HAUPPAUGE_NEW;
2438 dev->init_data.get_key = em28xx_get_key_em_haup; 2434 dev->init_data.get_key = em28xx_get_key_em_haup;
2439 dev->init_data.name = "i2c IR (EM2840 Hauppauge)"; 2435 dev->init_data.name = "i2c IR (EM2840 Hauppauge)";
2436 break;
2440 case EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE: 2437 case EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE:
2441 dev->init_data.ir_codes = RC_MAP_WINFAST_USBII_DELUXE; 2438 dev->init_data.ir_codes = RC_MAP_WINFAST_USBII_DELUXE;
2442 dev->init_data.get_key = em28xx_get_key_winfast_usbii_deluxe; 2439 dev->init_data.get_key = em28xx_get_key_winfast_usbii_deluxe;
@@ -2623,11 +2620,17 @@ void em28xx_card_setup(struct em28xx *dev)
2623 "tvp5150", 0, tvp5150_addrs); 2620 "tvp5150", 0, tvp5150_addrs);
2624 2621
2625 if (dev->em28xx_sensor == EM28XX_MT9V011) { 2622 if (dev->em28xx_sensor == EM28XX_MT9V011) {
2623 struct mt9v011_platform_data pdata;
2624 struct i2c_board_info mt9v011_info = {
2625 .type = "mt9v011",
2626 .addr = 0xba >> 1,
2627 .platform_data = &pdata,
2628 };
2626 struct v4l2_subdev *sd; 2629 struct v4l2_subdev *sd;
2627 2630
2628 sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, 2631 pdata.xtal = dev->sensor_xtal;
2629 &dev->i2c_adap, "mt9v011", 0, mt9v011_addrs); 2632 sd = v4l2_i2c_new_subdev_board(&dev->v4l2_dev, &dev->i2c_adap,
2630 v4l2_subdev_call(sd, core, s_config, 0, &dev->sensor_xtal); 2633 &mt9v011_info, NULL);
2631 } 2634 }
2632 2635
2633 2636
diff --git a/drivers/media/video/et61x251/et61x251.h b/drivers/media/video/et61x251/et61x251.h
index cc77d144df3c..bf66189cb26d 100644
--- a/drivers/media/video/et61x251/et61x251.h
+++ b/drivers/media/video/et61x251/et61x251.h
@@ -59,31 +59,7 @@
59/*****************************************************************************/ 59/*****************************************************************************/
60 60
61static const struct usb_device_id et61x251_id_table[] = { 61static const struct usb_device_id et61x251_id_table[] = {
62 { USB_DEVICE(0x102c, 0x6151), },
63 { USB_DEVICE(0x102c, 0x6251), }, 62 { USB_DEVICE(0x102c, 0x6251), },
64 { USB_DEVICE(0x102c, 0x6253), },
65 { USB_DEVICE(0x102c, 0x6254), },
66 { USB_DEVICE(0x102c, 0x6255), },
67 { USB_DEVICE(0x102c, 0x6256), },
68 { USB_DEVICE(0x102c, 0x6257), },
69 { USB_DEVICE(0x102c, 0x6258), },
70 { USB_DEVICE(0x102c, 0x6259), },
71 { USB_DEVICE(0x102c, 0x625a), },
72 { USB_DEVICE(0x102c, 0x625b), },
73 { USB_DEVICE(0x102c, 0x625c), },
74 { USB_DEVICE(0x102c, 0x625d), },
75 { USB_DEVICE(0x102c, 0x625e), },
76 { USB_DEVICE(0x102c, 0x625f), },
77 { USB_DEVICE(0x102c, 0x6260), },
78 { USB_DEVICE(0x102c, 0x6261), },
79 { USB_DEVICE(0x102c, 0x6262), },
80 { USB_DEVICE(0x102c, 0x6263), },
81 { USB_DEVICE(0x102c, 0x6264), },
82 { USB_DEVICE(0x102c, 0x6265), },
83 { USB_DEVICE(0x102c, 0x6266), },
84 { USB_DEVICE(0x102c, 0x6267), },
85 { USB_DEVICE(0x102c, 0x6268), },
86 { USB_DEVICE(0x102c, 0x6269), },
87 { } 63 { }
88}; 64};
89 65
diff --git a/drivers/media/video/gspca/benq.c b/drivers/media/video/gspca/benq.c
index 629043933501..a09c4709d613 100644
--- a/drivers/media/video/gspca/benq.c
+++ b/drivers/media/video/gspca/benq.c
@@ -276,7 +276,7 @@ static const struct sd_desc sd_desc = {
276}; 276};
277 277
278/* -- module initialisation -- */ 278/* -- module initialisation -- */
279static const __devinitdata struct usb_device_id device_table[] = { 279static const struct usb_device_id device_table[] = {
280 {USB_DEVICE(0x04a5, 0x3035)}, 280 {USB_DEVICE(0x04a5, 0x3035)},
281 {} 281 {}
282}; 282};
diff --git a/drivers/media/video/gspca/conex.c b/drivers/media/video/gspca/conex.c
index 1eacb6c7926d..8b398493f96b 100644
--- a/drivers/media/video/gspca/conex.c
+++ b/drivers/media/video/gspca/conex.c
@@ -1040,14 +1040,14 @@ static const struct sd_desc sd_desc = {
1040}; 1040};
1041 1041
1042/* -- module initialisation -- */ 1042/* -- module initialisation -- */
1043static const struct usb_device_id device_table[] __devinitconst = { 1043static const struct usb_device_id device_table[] = {
1044 {USB_DEVICE(0x0572, 0x0041)}, 1044 {USB_DEVICE(0x0572, 0x0041)},
1045 {} 1045 {}
1046}; 1046};
1047MODULE_DEVICE_TABLE(usb, device_table); 1047MODULE_DEVICE_TABLE(usb, device_table);
1048 1048
1049/* -- device connect -- */ 1049/* -- device connect -- */
1050static int __devinit sd_probe(struct usb_interface *intf, 1050static int sd_probe(struct usb_interface *intf,
1051 const struct usb_device_id *id) 1051 const struct usb_device_id *id)
1052{ 1052{
1053 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), 1053 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
diff --git a/drivers/media/video/gspca/cpia1.c b/drivers/media/video/gspca/cpia1.c
index c1ae05f4661f..4bf2cab98d64 100644
--- a/drivers/media/video/gspca/cpia1.c
+++ b/drivers/media/video/gspca/cpia1.c
@@ -2088,7 +2088,7 @@ static const struct sd_desc sd_desc = {
2088}; 2088};
2089 2089
2090/* -- module initialisation -- */ 2090/* -- module initialisation -- */
2091static const __devinitdata struct usb_device_id device_table[] = { 2091static const struct usb_device_id device_table[] = {
2092 {USB_DEVICE(0x0553, 0x0002)}, 2092 {USB_DEVICE(0x0553, 0x0002)},
2093 {USB_DEVICE(0x0813, 0x0001)}, 2093 {USB_DEVICE(0x0813, 0x0001)},
2094 {} 2094 {}
diff --git a/drivers/media/video/gspca/etoms.c b/drivers/media/video/gspca/etoms.c
index a594b36d6199..4b2c483fce6f 100644
--- a/drivers/media/video/gspca/etoms.c
+++ b/drivers/media/video/gspca/etoms.c
@@ -864,7 +864,7 @@ static const struct sd_desc sd_desc = {
864}; 864};
865 865
866/* -- module initialisation -- */ 866/* -- module initialisation -- */
867static const struct usb_device_id device_table[] __devinitconst = { 867static const struct usb_device_id device_table[] = {
868 {USB_DEVICE(0x102c, 0x6151), .driver_info = SENSOR_PAS106}, 868 {USB_DEVICE(0x102c, 0x6151), .driver_info = SENSOR_PAS106},
869#if !defined CONFIG_USB_ET61X251 && !defined CONFIG_USB_ET61X251_MODULE 869#if !defined CONFIG_USB_ET61X251 && !defined CONFIG_USB_ET61X251_MODULE
870 {USB_DEVICE(0x102c, 0x6251), .driver_info = SENSOR_TAS5130CXX}, 870 {USB_DEVICE(0x102c, 0x6251), .driver_info = SENSOR_TAS5130CXX},
@@ -875,7 +875,7 @@ static const struct usb_device_id device_table[] __devinitconst = {
875MODULE_DEVICE_TABLE(usb, device_table); 875MODULE_DEVICE_TABLE(usb, device_table);
876 876
877/* -- device connect -- */ 877/* -- device connect -- */
878static int __devinit sd_probe(struct usb_interface *intf, 878static int sd_probe(struct usb_interface *intf,
879 const struct usb_device_id *id) 879 const struct usb_device_id *id)
880{ 880{
881 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), 881 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
diff --git a/drivers/media/video/gspca/finepix.c b/drivers/media/video/gspca/finepix.c
index d78226455d1f..987b4b69d7ab 100644
--- a/drivers/media/video/gspca/finepix.c
+++ b/drivers/media/video/gspca/finepix.c
@@ -229,7 +229,7 @@ static void sd_stop0(struct gspca_dev *gspca_dev)
229} 229}
230 230
231/* Table of supported USB devices */ 231/* Table of supported USB devices */
232static const __devinitdata struct usb_device_id device_table[] = { 232static const struct usb_device_id device_table[] = {
233 {USB_DEVICE(0x04cb, 0x0104)}, 233 {USB_DEVICE(0x04cb, 0x0104)},
234 {USB_DEVICE(0x04cb, 0x0109)}, 234 {USB_DEVICE(0x04cb, 0x0109)},
235 {USB_DEVICE(0x04cb, 0x010b)}, 235 {USB_DEVICE(0x04cb, 0x010b)},
diff --git a/drivers/media/video/gspca/gl860/gl860.c b/drivers/media/video/gspca/gl860/gl860.c
index b05bec7321b5..99083038cec3 100644
--- a/drivers/media/video/gspca/gl860/gl860.c
+++ b/drivers/media/video/gspca/gl860/gl860.c
@@ -488,7 +488,7 @@ static void sd_callback(struct gspca_dev *gspca_dev)
488 488
489/*=================== USB driver structure initialisation ==================*/ 489/*=================== USB driver structure initialisation ==================*/
490 490
491static const __devinitdata struct usb_device_id device_table[] = { 491static const struct usb_device_id device_table[] = {
492 {USB_DEVICE(0x05e3, 0x0503)}, 492 {USB_DEVICE(0x05e3, 0x0503)},
493 {USB_DEVICE(0x05e3, 0xf191)}, 493 {USB_DEVICE(0x05e3, 0xf191)},
494 {} 494 {}
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index 442970073e8a..f21f2a258ae0 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -55,7 +55,7 @@ MODULE_AUTHOR("Jean-François Moine <http://moinejf.free.fr>");
55MODULE_DESCRIPTION("GSPCA USB Camera Driver"); 55MODULE_DESCRIPTION("GSPCA USB Camera Driver");
56MODULE_LICENSE("GPL"); 56MODULE_LICENSE("GPL");
57 57
58#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 11, 0) 58#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 12, 0)
59 59
60#ifdef GSPCA_DEBUG 60#ifdef GSPCA_DEBUG
61int gspca_debug = D_ERR | D_PROBE; 61int gspca_debug = D_ERR | D_PROBE;
@@ -508,8 +508,8 @@ static int gspca_is_compressed(__u32 format)
508 return 0; 508 return 0;
509} 509}
510 510
511static int frame_alloc(struct gspca_dev *gspca_dev, 511static int frame_alloc(struct gspca_dev *gspca_dev, struct file *file,
512 unsigned int count) 512 enum v4l2_memory memory, unsigned int count)
513{ 513{
514 struct gspca_frame *frame; 514 struct gspca_frame *frame;
515 unsigned int frsz; 515 unsigned int frsz;
@@ -519,7 +519,6 @@ static int frame_alloc(struct gspca_dev *gspca_dev,
519 frsz = gspca_dev->cam.cam_mode[i].sizeimage; 519 frsz = gspca_dev->cam.cam_mode[i].sizeimage;
520 PDEBUG(D_STREAM, "frame alloc frsz: %d", frsz); 520 PDEBUG(D_STREAM, "frame alloc frsz: %d", frsz);
521 frsz = PAGE_ALIGN(frsz); 521 frsz = PAGE_ALIGN(frsz);
522 gspca_dev->frsz = frsz;
523 if (count >= GSPCA_MAX_FRAMES) 522 if (count >= GSPCA_MAX_FRAMES)
524 count = GSPCA_MAX_FRAMES - 1; 523 count = GSPCA_MAX_FRAMES - 1;
525 gspca_dev->frbuf = vmalloc_32(frsz * count); 524 gspca_dev->frbuf = vmalloc_32(frsz * count);
@@ -527,6 +526,9 @@ static int frame_alloc(struct gspca_dev *gspca_dev,
527 err("frame alloc failed"); 526 err("frame alloc failed");
528 return -ENOMEM; 527 return -ENOMEM;
529 } 528 }
529 gspca_dev->capt_file = file;
530 gspca_dev->memory = memory;
531 gspca_dev->frsz = frsz;
530 gspca_dev->nframes = count; 532 gspca_dev->nframes = count;
531 for (i = 0; i < count; i++) { 533 for (i = 0; i < count; i++) {
532 frame = &gspca_dev->frame[i]; 534 frame = &gspca_dev->frame[i];
@@ -535,7 +537,7 @@ static int frame_alloc(struct gspca_dev *gspca_dev,
535 frame->v4l2_buf.flags = 0; 537 frame->v4l2_buf.flags = 0;
536 frame->v4l2_buf.field = V4L2_FIELD_NONE; 538 frame->v4l2_buf.field = V4L2_FIELD_NONE;
537 frame->v4l2_buf.length = frsz; 539 frame->v4l2_buf.length = frsz;
538 frame->v4l2_buf.memory = gspca_dev->memory; 540 frame->v4l2_buf.memory = memory;
539 frame->v4l2_buf.sequence = 0; 541 frame->v4l2_buf.sequence = 0;
540 frame->data = gspca_dev->frbuf + i * frsz; 542 frame->data = gspca_dev->frbuf + i * frsz;
541 frame->v4l2_buf.m.offset = i * frsz; 543 frame->v4l2_buf.m.offset = i * frsz;
@@ -558,6 +560,9 @@ static void frame_free(struct gspca_dev *gspca_dev)
558 gspca_dev->frame[i].data = NULL; 560 gspca_dev->frame[i].data = NULL;
559 } 561 }
560 gspca_dev->nframes = 0; 562 gspca_dev->nframes = 0;
563 gspca_dev->frsz = 0;
564 gspca_dev->capt_file = NULL;
565 gspca_dev->memory = GSPCA_MEMORY_NO;
561} 566}
562 567
563static void destroy_urbs(struct gspca_dev *gspca_dev) 568static void destroy_urbs(struct gspca_dev *gspca_dev)
@@ -1210,29 +1215,15 @@ static void gspca_release(struct video_device *vfd)
1210static int dev_open(struct file *file) 1215static int dev_open(struct file *file)
1211{ 1216{
1212 struct gspca_dev *gspca_dev; 1217 struct gspca_dev *gspca_dev;
1213 int ret;
1214 1218
1215 PDEBUG(D_STREAM, "[%s] open", current->comm); 1219 PDEBUG(D_STREAM, "[%s] open", current->comm);
1216 gspca_dev = (struct gspca_dev *) video_devdata(file); 1220 gspca_dev = (struct gspca_dev *) video_devdata(file);
1217 if (mutex_lock_interruptible(&gspca_dev->queue_lock)) 1221 if (!gspca_dev->present)
1218 return -ERESTARTSYS; 1222 return -ENODEV;
1219 if (!gspca_dev->present) {
1220 ret = -ENODEV;
1221 goto out;
1222 }
1223
1224 if (gspca_dev->users > 4) { /* (arbitrary value) */
1225 ret = -EBUSY;
1226 goto out;
1227 }
1228 1223
1229 /* protect the subdriver against rmmod */ 1224 /* protect the subdriver against rmmod */
1230 if (!try_module_get(gspca_dev->module)) { 1225 if (!try_module_get(gspca_dev->module))
1231 ret = -ENODEV; 1226 return -ENODEV;
1232 goto out;
1233 }
1234
1235 gspca_dev->users++;
1236 1227
1237 file->private_data = gspca_dev; 1228 file->private_data = gspca_dev;
1238#ifdef GSPCA_DEBUG 1229#ifdef GSPCA_DEBUG
@@ -1244,14 +1235,7 @@ static int dev_open(struct file *file)
1244 gspca_dev->vdev.debug &= ~(V4L2_DEBUG_IOCTL 1235 gspca_dev->vdev.debug &= ~(V4L2_DEBUG_IOCTL
1245 | V4L2_DEBUG_IOCTL_ARG); 1236 | V4L2_DEBUG_IOCTL_ARG);
1246#endif 1237#endif
1247 ret = 0; 1238 return 0;
1248out:
1249 mutex_unlock(&gspca_dev->queue_lock);
1250 if (ret != 0)
1251 PDEBUG(D_ERR|D_STREAM, "open failed err %d", ret);
1252 else
1253 PDEBUG(D_STREAM, "open done");
1254 return ret;
1255} 1239}
1256 1240
1257static int dev_close(struct file *file) 1241static int dev_close(struct file *file)
@@ -1261,7 +1245,6 @@ static int dev_close(struct file *file)
1261 PDEBUG(D_STREAM, "[%s] close", current->comm); 1245 PDEBUG(D_STREAM, "[%s] close", current->comm);
1262 if (mutex_lock_interruptible(&gspca_dev->queue_lock)) 1246 if (mutex_lock_interruptible(&gspca_dev->queue_lock))
1263 return -ERESTARTSYS; 1247 return -ERESTARTSYS;
1264 gspca_dev->users--;
1265 1248
1266 /* if the file did the capture, free the streaming resources */ 1249 /* if the file did the capture, free the streaming resources */
1267 if (gspca_dev->capt_file == file) { 1250 if (gspca_dev->capt_file == file) {
@@ -1272,8 +1255,6 @@ static int dev_close(struct file *file)
1272 mutex_unlock(&gspca_dev->usb_lock); 1255 mutex_unlock(&gspca_dev->usb_lock);
1273 } 1256 }
1274 frame_free(gspca_dev); 1257 frame_free(gspca_dev);
1275 gspca_dev->capt_file = NULL;
1276 gspca_dev->memory = GSPCA_MEMORY_NO;
1277 } 1258 }
1278 file->private_data = NULL; 1259 file->private_data = NULL;
1279 module_put(gspca_dev->module); 1260 module_put(gspca_dev->module);
@@ -1516,6 +1497,7 @@ static int vidioc_reqbufs(struct file *file, void *priv,
1516 return -ERESTARTSYS; 1497 return -ERESTARTSYS;
1517 1498
1518 if (gspca_dev->memory != GSPCA_MEMORY_NO 1499 if (gspca_dev->memory != GSPCA_MEMORY_NO
1500 && gspca_dev->memory != GSPCA_MEMORY_READ
1519 && gspca_dev->memory != rb->memory) { 1501 && gspca_dev->memory != rb->memory) {
1520 ret = -EBUSY; 1502 ret = -EBUSY;
1521 goto out; 1503 goto out;
@@ -1544,19 +1526,18 @@ static int vidioc_reqbufs(struct file *file, void *priv,
1544 gspca_stream_off(gspca_dev); 1526 gspca_stream_off(gspca_dev);
1545 mutex_unlock(&gspca_dev->usb_lock); 1527 mutex_unlock(&gspca_dev->usb_lock);
1546 } 1528 }
1529 /* Don't restart the stream when switching from read to mmap mode */
1530 if (gspca_dev->memory == GSPCA_MEMORY_READ)
1531 streaming = 0;
1547 1532
1548 /* free the previous allocated buffers, if any */ 1533 /* free the previous allocated buffers, if any */
1549 if (gspca_dev->nframes != 0) { 1534 if (gspca_dev->nframes != 0)
1550 frame_free(gspca_dev); 1535 frame_free(gspca_dev);
1551 gspca_dev->capt_file = NULL;
1552 }
1553 if (rb->count == 0) /* unrequest */ 1536 if (rb->count == 0) /* unrequest */
1554 goto out; 1537 goto out;
1555 gspca_dev->memory = rb->memory; 1538 ret = frame_alloc(gspca_dev, file, rb->memory, rb->count);
1556 ret = frame_alloc(gspca_dev, rb->count);
1557 if (ret == 0) { 1539 if (ret == 0) {
1558 rb->count = gspca_dev->nframes; 1540 rb->count = gspca_dev->nframes;
1559 gspca_dev->capt_file = file;
1560 if (streaming) 1541 if (streaming)
1561 ret = gspca_init_transfer(gspca_dev); 1542 ret = gspca_init_transfer(gspca_dev);
1562 } 1543 }
@@ -1630,11 +1611,15 @@ static int vidioc_streamoff(struct file *file, void *priv,
1630 1611
1631 if (buf_type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 1612 if (buf_type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
1632 return -EINVAL; 1613 return -EINVAL;
1633 if (!gspca_dev->streaming) 1614
1634 return 0;
1635 if (mutex_lock_interruptible(&gspca_dev->queue_lock)) 1615 if (mutex_lock_interruptible(&gspca_dev->queue_lock))
1636 return -ERESTARTSYS; 1616 return -ERESTARTSYS;
1637 1617
1618 if (!gspca_dev->streaming) {
1619 ret = 0;
1620 goto out;
1621 }
1622
1638 /* check the capture file */ 1623 /* check the capture file */
1639 if (gspca_dev->capt_file != file) { 1624 if (gspca_dev->capt_file != file) {
1640 ret = -EBUSY; 1625 ret = -EBUSY;
@@ -1649,6 +1634,8 @@ static int vidioc_streamoff(struct file *file, void *priv,
1649 gspca_dev->usb_err = 0; 1634 gspca_dev->usb_err = 0;
1650 gspca_stream_off(gspca_dev); 1635 gspca_stream_off(gspca_dev);
1651 mutex_unlock(&gspca_dev->usb_lock); 1636 mutex_unlock(&gspca_dev->usb_lock);
1637 /* In case another thread is waiting in dqbuf */
1638 wake_up_interruptible(&gspca_dev->wq);
1652 1639
1653 /* empty the transfer queues */ 1640 /* empty the transfer queues */
1654 atomic_set(&gspca_dev->fr_q, 0); 1641 atomic_set(&gspca_dev->fr_q, 0);
@@ -1827,33 +1814,77 @@ out:
1827 return ret; 1814 return ret;
1828} 1815}
1829 1816
1817static int frame_ready_nolock(struct gspca_dev *gspca_dev, struct file *file,
1818 enum v4l2_memory memory)
1819{
1820 if (!gspca_dev->present)
1821 return -ENODEV;
1822 if (gspca_dev->capt_file != file || gspca_dev->memory != memory ||
1823 !gspca_dev->streaming)
1824 return -EINVAL;
1825
1826 /* check if a frame is ready */
1827 return gspca_dev->fr_o != atomic_read(&gspca_dev->fr_i);
1828}
1829
1830static int frame_ready(struct gspca_dev *gspca_dev, struct file *file,
1831 enum v4l2_memory memory)
1832{
1833 int ret;
1834
1835 if (mutex_lock_interruptible(&gspca_dev->queue_lock))
1836 return -ERESTARTSYS;
1837 ret = frame_ready_nolock(gspca_dev, file, memory);
1838 mutex_unlock(&gspca_dev->queue_lock);
1839 return ret;
1840}
1841
1830/* 1842/*
1831 * wait for a video frame 1843 * dequeue a video buffer
1832 * 1844 *
1833 * If a frame is ready, its index is returned. 1845 * If nonblock_ing is false, block until a buffer is available.
1834 */ 1846 */
1835static int frame_wait(struct gspca_dev *gspca_dev, 1847static int vidioc_dqbuf(struct file *file, void *priv,
1836 int nonblock_ing) 1848 struct v4l2_buffer *v4l2_buf)
1837{ 1849{
1838 int i, ret; 1850 struct gspca_dev *gspca_dev = priv;
1851 struct gspca_frame *frame;
1852 int i, j, ret;
1839 1853
1840 /* check if a frame is ready */ 1854 PDEBUG(D_FRAM, "dqbuf");
1841 i = gspca_dev->fr_o; 1855
1842 if (i == atomic_read(&gspca_dev->fr_i)) { 1856 if (mutex_lock_interruptible(&gspca_dev->queue_lock))
1843 if (nonblock_ing) 1857 return -ERESTARTSYS;
1858
1859 for (;;) {
1860 ret = frame_ready_nolock(gspca_dev, file, v4l2_buf->memory);
1861 if (ret < 0)
1862 goto out;
1863 if (ret > 0)
1864 break;
1865
1866 mutex_unlock(&gspca_dev->queue_lock);
1867
1868 if (file->f_flags & O_NONBLOCK)
1844 return -EAGAIN; 1869 return -EAGAIN;
1845 1870
1846 /* wait till a frame is ready */ 1871 /* wait till a frame is ready */
1847 ret = wait_event_interruptible_timeout(gspca_dev->wq, 1872 ret = wait_event_interruptible_timeout(gspca_dev->wq,
1848 i != atomic_read(&gspca_dev->fr_i) || 1873 frame_ready(gspca_dev, file, v4l2_buf->memory),
1849 !gspca_dev->streaming || !gspca_dev->present,
1850 msecs_to_jiffies(3000)); 1874 msecs_to_jiffies(3000));
1851 if (ret < 0) 1875 if (ret < 0)
1852 return ret; 1876 return ret;
1853 if (ret == 0 || !gspca_dev->streaming || !gspca_dev->present) 1877 if (ret == 0)
1854 return -EIO; 1878 return -EIO;
1879
1880 if (mutex_lock_interruptible(&gspca_dev->queue_lock))
1881 return -ERESTARTSYS;
1855 } 1882 }
1856 1883
1884 i = gspca_dev->fr_o;
1885 j = gspca_dev->fr_queue[i];
1886 frame = &gspca_dev->frame[j];
1887
1857 gspca_dev->fr_o = (i + 1) % GSPCA_MAX_FRAMES; 1888 gspca_dev->fr_o = (i + 1) % GSPCA_MAX_FRAMES;
1858 1889
1859 if (gspca_dev->sd_desc->dq_callback) { 1890 if (gspca_dev->sd_desc->dq_callback) {
@@ -1863,46 +1894,12 @@ static int frame_wait(struct gspca_dev *gspca_dev,
1863 gspca_dev->sd_desc->dq_callback(gspca_dev); 1894 gspca_dev->sd_desc->dq_callback(gspca_dev);
1864 mutex_unlock(&gspca_dev->usb_lock); 1895 mutex_unlock(&gspca_dev->usb_lock);
1865 } 1896 }
1866 return gspca_dev->fr_queue[i];
1867}
1868
1869/*
1870 * dequeue a video buffer
1871 *
1872 * If nonblock_ing is false, block until a buffer is available.
1873 */
1874static int vidioc_dqbuf(struct file *file, void *priv,
1875 struct v4l2_buffer *v4l2_buf)
1876{
1877 struct gspca_dev *gspca_dev = priv;
1878 struct gspca_frame *frame;
1879 int i, ret;
1880
1881 PDEBUG(D_FRAM, "dqbuf");
1882 if (v4l2_buf->memory != gspca_dev->memory)
1883 return -EINVAL;
1884
1885 if (!gspca_dev->present)
1886 return -ENODEV;
1887
1888 /* if not streaming, be sure the application will not loop forever */
1889 if (!(file->f_flags & O_NONBLOCK)
1890 && !gspca_dev->streaming && gspca_dev->users == 1)
1891 return -EINVAL;
1892 1897
1893 /* only the capturing file may dequeue */ 1898 frame->v4l2_buf.flags &= ~V4L2_BUF_FLAG_DONE;
1894 if (gspca_dev->capt_file != file) 1899 memcpy(v4l2_buf, &frame->v4l2_buf, sizeof *v4l2_buf);
1895 return -EINVAL; 1900 PDEBUG(D_FRAM, "dqbuf %d", j);
1896 1901 ret = 0;
1897 /* only one dequeue / read at a time */
1898 if (mutex_lock_interruptible(&gspca_dev->read_lock))
1899 return -ERESTARTSYS;
1900 1902
1901 ret = frame_wait(gspca_dev, file->f_flags & O_NONBLOCK);
1902 if (ret < 0)
1903 goto out;
1904 i = ret; /* frame index */
1905 frame = &gspca_dev->frame[i];
1906 if (gspca_dev->memory == V4L2_MEMORY_USERPTR) { 1903 if (gspca_dev->memory == V4L2_MEMORY_USERPTR) {
1907 if (copy_to_user((__u8 __user *) frame->v4l2_buf.m.userptr, 1904 if (copy_to_user((__u8 __user *) frame->v4l2_buf.m.userptr,
1908 frame->data, 1905 frame->data,
@@ -1910,15 +1907,10 @@ static int vidioc_dqbuf(struct file *file, void *priv,
1910 PDEBUG(D_ERR|D_STREAM, 1907 PDEBUG(D_ERR|D_STREAM,
1911 "dqbuf cp to user failed"); 1908 "dqbuf cp to user failed");
1912 ret = -EFAULT; 1909 ret = -EFAULT;
1913 goto out;
1914 } 1910 }
1915 } 1911 }
1916 frame->v4l2_buf.flags &= ~V4L2_BUF_FLAG_DONE;
1917 memcpy(v4l2_buf, &frame->v4l2_buf, sizeof *v4l2_buf);
1918 PDEBUG(D_FRAM, "dqbuf %d", i);
1919 ret = 0;
1920out: 1912out:
1921 mutex_unlock(&gspca_dev->read_lock); 1913 mutex_unlock(&gspca_dev->queue_lock);
1922 return ret; 1914 return ret;
1923} 1915}
1924 1916
@@ -2033,9 +2025,7 @@ static unsigned int dev_poll(struct file *file, poll_table *wait)
2033 poll_wait(file, &gspca_dev->wq, wait); 2025 poll_wait(file, &gspca_dev->wq, wait);
2034 2026
2035 /* if reqbufs is not done, the user would use read() */ 2027 /* if reqbufs is not done, the user would use read() */
2036 if (gspca_dev->nframes == 0) { 2028 if (gspca_dev->memory == GSPCA_MEMORY_NO) {
2037 if (gspca_dev->memory != GSPCA_MEMORY_NO)
2038 return POLLERR; /* not the 1st time */
2039 ret = read_alloc(gspca_dev, file); 2029 ret = read_alloc(gspca_dev, file);
2040 if (ret != 0) 2030 if (ret != 0)
2041 return POLLERR; 2031 return POLLERR;
@@ -2067,18 +2057,10 @@ static ssize_t dev_read(struct file *file, char __user *data,
2067 PDEBUG(D_FRAM, "read (%zd)", count); 2057 PDEBUG(D_FRAM, "read (%zd)", count);
2068 if (!gspca_dev->present) 2058 if (!gspca_dev->present)
2069 return -ENODEV; 2059 return -ENODEV;
2070 switch (gspca_dev->memory) { 2060 if (gspca_dev->memory == GSPCA_MEMORY_NO) { /* first time ? */
2071 case GSPCA_MEMORY_NO: /* first time */
2072 ret = read_alloc(gspca_dev, file); 2061 ret = read_alloc(gspca_dev, file);
2073 if (ret != 0) 2062 if (ret != 0)
2074 return ret; 2063 return ret;
2075 break;
2076 case GSPCA_MEMORY_READ:
2077 if (gspca_dev->capt_file == file)
2078 break;
2079 /* fall thru */
2080 default:
2081 return -EINVAL;
2082 } 2064 }
2083 2065
2084 /* get a frame */ 2066 /* get a frame */
@@ -2266,7 +2248,6 @@ int gspca_dev_probe2(struct usb_interface *intf,
2266 goto out; 2248 goto out;
2267 2249
2268 mutex_init(&gspca_dev->usb_lock); 2250 mutex_init(&gspca_dev->usb_lock);
2269 mutex_init(&gspca_dev->read_lock);
2270 mutex_init(&gspca_dev->queue_lock); 2251 mutex_init(&gspca_dev->queue_lock);
2271 init_waitqueue_head(&gspca_dev->wq); 2252 init_waitqueue_head(&gspca_dev->wq);
2272 2253
@@ -2341,12 +2322,11 @@ void gspca_disconnect(struct usb_interface *intf)
2341 PDEBUG(D_PROBE, "%s disconnect", 2322 PDEBUG(D_PROBE, "%s disconnect",
2342 video_device_node_name(&gspca_dev->vdev)); 2323 video_device_node_name(&gspca_dev->vdev));
2343 mutex_lock(&gspca_dev->usb_lock); 2324 mutex_lock(&gspca_dev->usb_lock);
2325
2344 gspca_dev->present = 0; 2326 gspca_dev->present = 0;
2327 wake_up_interruptible(&gspca_dev->wq);
2345 2328
2346 if (gspca_dev->streaming) { 2329 destroy_urbs(gspca_dev);
2347 destroy_urbs(gspca_dev);
2348 wake_up_interruptible(&gspca_dev->wq);
2349 }
2350 2330
2351#if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE) 2331#if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE)
2352 gspca_input_destroy_urb(gspca_dev); 2332 gspca_input_destroy_urb(gspca_dev);
diff --git a/drivers/media/video/gspca/gspca.h b/drivers/media/video/gspca/gspca.h
index 97b77a26a2eb..41755226d389 100644
--- a/drivers/media/video/gspca/gspca.h
+++ b/drivers/media/video/gspca/gspca.h
@@ -205,14 +205,12 @@ struct gspca_dev {
205 205
206 wait_queue_head_t wq; /* wait queue */ 206 wait_queue_head_t wq; /* wait queue */
207 struct mutex usb_lock; /* usb exchange protection */ 207 struct mutex usb_lock; /* usb exchange protection */
208 struct mutex read_lock; /* read protection */
209 struct mutex queue_lock; /* ISOC queue protection */ 208 struct mutex queue_lock; /* ISOC queue protection */
210 int usb_err; /* USB error - protected by usb_lock */ 209 int usb_err; /* USB error - protected by usb_lock */
211 u16 pkt_size; /* ISOC packet size */ 210 u16 pkt_size; /* ISOC packet size */
212#ifdef CONFIG_PM 211#ifdef CONFIG_PM
213 char frozen; /* suspend - resume */ 212 char frozen; /* suspend - resume */
214#endif 213#endif
215 char users; /* number of opens */
216 char present; /* device connected */ 214 char present; /* device connected */
217 char nbufread; /* number of buffers for read() */ 215 char nbufread; /* number of buffers for read() */
218 char memory; /* memory type (V4L2_MEMORY_xxx) */ 216 char memory; /* memory type (V4L2_MEMORY_xxx) */
diff --git a/drivers/media/video/gspca/jeilinj.c b/drivers/media/video/gspca/jeilinj.c
index a35e87bb0388..06b777f5379e 100644
--- a/drivers/media/video/gspca/jeilinj.c
+++ b/drivers/media/video/gspca/jeilinj.c
@@ -314,7 +314,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
314} 314}
315 315
316/* Table of supported USB devices */ 316/* Table of supported USB devices */
317static const __devinitdata struct usb_device_id device_table[] = { 317static const struct usb_device_id device_table[] = {
318 {USB_DEVICE(0x0979, 0x0280)}, 318 {USB_DEVICE(0x0979, 0x0280)},
319 {} 319 {}
320}; 320};
diff --git a/drivers/media/video/gspca/jpeg.h b/drivers/media/video/gspca/jpeg.h
index de63c36806c0..ab54910418b4 100644
--- a/drivers/media/video/gspca/jpeg.h
+++ b/drivers/media/video/gspca/jpeg.h
@@ -141,9 +141,9 @@ static void jpeg_define(u8 *jpeg_hdr,
141 memcpy(jpeg_hdr, jpeg_head, sizeof jpeg_head); 141 memcpy(jpeg_hdr, jpeg_head, sizeof jpeg_head);
142#ifndef CONEX_CAM 142#ifndef CONEX_CAM
143 jpeg_hdr[JPEG_HEIGHT_OFFSET + 0] = height >> 8; 143 jpeg_hdr[JPEG_HEIGHT_OFFSET + 0] = height >> 8;
144 jpeg_hdr[JPEG_HEIGHT_OFFSET + 1] = height & 0xff; 144 jpeg_hdr[JPEG_HEIGHT_OFFSET + 1] = height;
145 jpeg_hdr[JPEG_HEIGHT_OFFSET + 2] = width >> 8; 145 jpeg_hdr[JPEG_HEIGHT_OFFSET + 2] = width >> 8;
146 jpeg_hdr[JPEG_HEIGHT_OFFSET + 3] = width & 0xff; 146 jpeg_hdr[JPEG_HEIGHT_OFFSET + 3] = width;
147 jpeg_hdr[JPEG_HEIGHT_OFFSET + 6] = samplesY; 147 jpeg_hdr[JPEG_HEIGHT_OFFSET + 6] = samplesY;
148#endif 148#endif
149} 149}
diff --git a/drivers/media/video/gspca/konica.c b/drivers/media/video/gspca/konica.c
index d2ce65dcbfdc..5964691c0e95 100644
--- a/drivers/media/video/gspca/konica.c
+++ b/drivers/media/video/gspca/konica.c
@@ -607,7 +607,7 @@ static const struct sd_desc sd_desc = {
607}; 607};
608 608
609/* -- module initialisation -- */ 609/* -- module initialisation -- */
610static const __devinitdata struct usb_device_id device_table[] = { 610static const struct usb_device_id device_table[] = {
611 {USB_DEVICE(0x04c8, 0x0720)}, /* Intel YC 76 */ 611 {USB_DEVICE(0x04c8, 0x0720)}, /* Intel YC 76 */
612 {} 612 {}
613}; 613};
diff --git a/drivers/media/video/gspca/m5602/m5602_core.c b/drivers/media/video/gspca/m5602/m5602_core.c
index c872b93a3351..a7722b1aef9b 100644
--- a/drivers/media/video/gspca/m5602/m5602_core.c
+++ b/drivers/media/video/gspca/m5602/m5602_core.c
@@ -28,7 +28,7 @@ int force_sensor;
28static int dump_bridge; 28static int dump_bridge;
29int dump_sensor; 29int dump_sensor;
30 30
31static const __devinitdata struct usb_device_id m5602_table[] = { 31static const struct usb_device_id m5602_table[] = {
32 {USB_DEVICE(0x0402, 0x5602)}, 32 {USB_DEVICE(0x0402, 0x5602)},
33 {} 33 {}
34}; 34};
diff --git a/drivers/media/video/gspca/mars.c b/drivers/media/video/gspca/mars.c
index a81536e78698..cb4d0bf0d784 100644
--- a/drivers/media/video/gspca/mars.c
+++ b/drivers/media/video/gspca/mars.c
@@ -490,7 +490,7 @@ static const struct sd_desc sd_desc = {
490}; 490};
491 491
492/* -- module initialisation -- */ 492/* -- module initialisation -- */
493static const __devinitdata struct usb_device_id device_table[] = { 493static const struct usb_device_id device_table[] = {
494 {USB_DEVICE(0x093a, 0x050f)}, 494 {USB_DEVICE(0x093a, 0x050f)},
495 {} 495 {}
496}; 496};
diff --git a/drivers/media/video/gspca/mr97310a.c b/drivers/media/video/gspca/mr97310a.c
index 7607a288b51c..3884c9d300c5 100644
--- a/drivers/media/video/gspca/mr97310a.c
+++ b/drivers/media/video/gspca/mr97310a.c
@@ -1229,7 +1229,7 @@ static const struct sd_desc sd_desc = {
1229}; 1229};
1230 1230
1231/* -- module initialisation -- */ 1231/* -- module initialisation -- */
1232static const __devinitdata struct usb_device_id device_table[] = { 1232static const struct usb_device_id device_table[] = {
1233 {USB_DEVICE(0x08ca, 0x0110)}, /* Trust Spyc@m 100 */ 1233 {USB_DEVICE(0x08ca, 0x0110)}, /* Trust Spyc@m 100 */
1234 {USB_DEVICE(0x08ca, 0x0111)}, /* Aiptek Pencam VGA+ */ 1234 {USB_DEVICE(0x08ca, 0x0111)}, /* Aiptek Pencam VGA+ */
1235 {USB_DEVICE(0x093a, 0x010f)}, /* All other known MR97310A VGA cams */ 1235 {USB_DEVICE(0x093a, 0x010f)}, /* All other known MR97310A VGA cams */
diff --git a/drivers/media/video/gspca/ov519.c b/drivers/media/video/gspca/ov519.c
index e1c3b9328ace..8ab2c452c25e 100644
--- a/drivers/media/video/gspca/ov519.c
+++ b/drivers/media/video/gspca/ov519.c
@@ -488,7 +488,6 @@ static const struct v4l2_pix_format ovfx2_ov3610_mode[] = {
488#define R511_SNAP_PXDIV 0x1c 488#define R511_SNAP_PXDIV 0x1c
489#define R511_SNAP_LNDIV 0x1d 489#define R511_SNAP_LNDIV 0x1d
490#define R511_SNAP_UV_EN 0x1e 490#define R511_SNAP_UV_EN 0x1e
491#define R511_SNAP_UV_EN 0x1e
492#define R511_SNAP_OPTS 0x1f 491#define R511_SNAP_OPTS 0x1f
493 492
494#define R511_DRAM_FLOW_CTL 0x20 493#define R511_DRAM_FLOW_CTL 0x20
@@ -1847,8 +1846,7 @@ static const struct ov_i2c_regvals norm_7670[] = {
1847 { 0x6c, 0x0a }, 1846 { 0x6c, 0x0a },
1848 { 0x6d, 0x55 }, 1847 { 0x6d, 0x55 },
1849 { 0x6e, 0x11 }, 1848 { 0x6e, 0x11 },
1850 { 0x6f, 0x9f }, 1849 { 0x6f, 0x9f }, /* "9e for advance AWB" */
1851 /* "9e for advance AWB" */
1852 { 0x6a, 0x40 }, 1850 { 0x6a, 0x40 },
1853 { OV7670_R01_BLUE, 0x40 }, 1851 { OV7670_R01_BLUE, 0x40 },
1854 { OV7670_R02_RED, 0x60 }, 1852 { OV7670_R02_RED, 0x60 },
@@ -3054,7 +3052,7 @@ static void ov519_configure(struct sd *sd)
3054{ 3052{
3055 static const struct ov_regvals init_519[] = { 3053 static const struct ov_regvals init_519[] = {
3056 { 0x5a, 0x6d }, /* EnableSystem */ 3054 { 0x5a, 0x6d }, /* EnableSystem */
3057 { 0x53, 0x9b }, 3055 { 0x53, 0x9b }, /* don't enable the microcontroller */
3058 { OV519_R54_EN_CLK1, 0xff }, /* set bit2 to enable jpeg */ 3056 { OV519_R54_EN_CLK1, 0xff }, /* set bit2 to enable jpeg */
3059 { 0x5d, 0x03 }, 3057 { 0x5d, 0x03 },
3060 { 0x49, 0x01 }, 3058 { 0x49, 0x01 },
@@ -4747,7 +4745,7 @@ static const struct sd_desc sd_desc = {
4747}; 4745};
4748 4746
4749/* -- module initialisation -- */ 4747/* -- module initialisation -- */
4750static const __devinitdata struct usb_device_id device_table[] = { 4748static const struct usb_device_id device_table[] = {
4751 {USB_DEVICE(0x041e, 0x4003), .driver_info = BRIDGE_W9968CF }, 4749 {USB_DEVICE(0x041e, 0x4003), .driver_info = BRIDGE_W9968CF },
4752 {USB_DEVICE(0x041e, 0x4052), .driver_info = BRIDGE_OV519 }, 4750 {USB_DEVICE(0x041e, 0x4052), .driver_info = BRIDGE_OV519 },
4753 {USB_DEVICE(0x041e, 0x405f), .driver_info = BRIDGE_OV519 }, 4751 {USB_DEVICE(0x041e, 0x405f), .driver_info = BRIDGE_OV519 },
diff --git a/drivers/media/video/gspca/ov534.c b/drivers/media/video/gspca/ov534.c
index 0edf93973b1c..04da22802736 100644
--- a/drivers/media/video/gspca/ov534.c
+++ b/drivers/media/video/gspca/ov534.c
@@ -479,15 +479,20 @@ static void ov534_reg_write(struct gspca_dev *gspca_dev, u16 reg, u8 val)
479 struct usb_device *udev = gspca_dev->dev; 479 struct usb_device *udev = gspca_dev->dev;
480 int ret; 480 int ret;
481 481
482 PDEBUG(D_USBO, "reg=0x%04x, val=0%02x", reg, val); 482 if (gspca_dev->usb_err < 0)
483 return;
484
485 PDEBUG(D_USBO, "SET 01 0000 %04x %02x", reg, val);
483 gspca_dev->usb_buf[0] = val; 486 gspca_dev->usb_buf[0] = val;
484 ret = usb_control_msg(udev, 487 ret = usb_control_msg(udev,
485 usb_sndctrlpipe(udev, 0), 488 usb_sndctrlpipe(udev, 0),
486 0x01, 489 0x01,
487 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 490 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
488 0x00, reg, gspca_dev->usb_buf, 1, CTRL_TIMEOUT); 491 0x00, reg, gspca_dev->usb_buf, 1, CTRL_TIMEOUT);
489 if (ret < 0) 492 if (ret < 0) {
490 err("write failed %d", ret); 493 err("write failed %d", ret);
494 gspca_dev->usb_err = ret;
495 }
491} 496}
492 497
493static u8 ov534_reg_read(struct gspca_dev *gspca_dev, u16 reg) 498static u8 ov534_reg_read(struct gspca_dev *gspca_dev, u16 reg)
@@ -495,14 +500,18 @@ static u8 ov534_reg_read(struct gspca_dev *gspca_dev, u16 reg)
495 struct usb_device *udev = gspca_dev->dev; 500 struct usb_device *udev = gspca_dev->dev;
496 int ret; 501 int ret;
497 502
503 if (gspca_dev->usb_err < 0)
504 return 0;
498 ret = usb_control_msg(udev, 505 ret = usb_control_msg(udev,
499 usb_rcvctrlpipe(udev, 0), 506 usb_rcvctrlpipe(udev, 0),
500 0x01, 507 0x01,
501 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 508 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
502 0x00, reg, gspca_dev->usb_buf, 1, CTRL_TIMEOUT); 509 0x00, reg, gspca_dev->usb_buf, 1, CTRL_TIMEOUT);
503 PDEBUG(D_USBI, "reg=0x%04x, data=0x%02x", reg, gspca_dev->usb_buf[0]); 510 PDEBUG(D_USBI, "GET 01 0000 %04x %02x", reg, gspca_dev->usb_buf[0]);
504 if (ret < 0) 511 if (ret < 0) {
505 err("read failed %d", ret); 512 err("read failed %d", ret);
513 gspca_dev->usb_err = ret;
514 }
506 return gspca_dev->usb_buf[0]; 515 return gspca_dev->usb_buf[0];
507} 516}
508 517
@@ -558,13 +567,15 @@ static int sccb_check_status(struct gspca_dev *gspca_dev)
558 567
559static void sccb_reg_write(struct gspca_dev *gspca_dev, u8 reg, u8 val) 568static void sccb_reg_write(struct gspca_dev *gspca_dev, u8 reg, u8 val)
560{ 569{
561 PDEBUG(D_USBO, "reg: 0x%02x, val: 0x%02x", reg, val); 570 PDEBUG(D_USBO, "sccb write: %02x %02x", reg, val);
562 ov534_reg_write(gspca_dev, OV534_REG_SUBADDR, reg); 571 ov534_reg_write(gspca_dev, OV534_REG_SUBADDR, reg);
563 ov534_reg_write(gspca_dev, OV534_REG_WRITE, val); 572 ov534_reg_write(gspca_dev, OV534_REG_WRITE, val);
564 ov534_reg_write(gspca_dev, OV534_REG_OPERATION, OV534_OP_WRITE_3); 573 ov534_reg_write(gspca_dev, OV534_REG_OPERATION, OV534_OP_WRITE_3);
565 574
566 if (!sccb_check_status(gspca_dev)) 575 if (!sccb_check_status(gspca_dev)) {
567 err("sccb_reg_write failed"); 576 err("sccb_reg_write failed");
577 gspca_dev->usb_err = -EIO;
578 }
568} 579}
569 580
570static u8 sccb_reg_read(struct gspca_dev *gspca_dev, u16 reg) 581static u8 sccb_reg_read(struct gspca_dev *gspca_dev, u16 reg)
@@ -885,7 +896,7 @@ static int sd_init(struct gspca_dev *gspca_dev)
885 ov534_set_led(gspca_dev, 0); 896 ov534_set_led(gspca_dev, 0);
886 set_frame_rate(gspca_dev); 897 set_frame_rate(gspca_dev);
887 898
888 return 0; 899 return gspca_dev->usb_err;
889} 900}
890 901
891static int sd_start(struct gspca_dev *gspca_dev) 902static int sd_start(struct gspca_dev *gspca_dev)
@@ -920,7 +931,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
920 931
921 ov534_set_led(gspca_dev, 1); 932 ov534_set_led(gspca_dev, 1);
922 ov534_reg_write(gspca_dev, 0xe0, 0x00); 933 ov534_reg_write(gspca_dev, 0xe0, 0x00);
923 return 0; 934 return gspca_dev->usb_err;
924} 935}
925 936
926static void sd_stopN(struct gspca_dev *gspca_dev) 937static void sd_stopN(struct gspca_dev *gspca_dev)
@@ -1289,7 +1300,7 @@ static const struct sd_desc sd_desc = {
1289}; 1300};
1290 1301
1291/* -- module initialisation -- */ 1302/* -- module initialisation -- */
1292static const __devinitdata struct usb_device_id device_table[] = { 1303static const struct usb_device_id device_table[] = {
1293 {USB_DEVICE(0x1415, 0x2000)}, 1304 {USB_DEVICE(0x1415, 0x2000)},
1294 {} 1305 {}
1295}; 1306};
diff --git a/drivers/media/video/gspca/ov534_9.c b/drivers/media/video/gspca/ov534_9.c
index c5244b4b4777..aaf5428c57f5 100644
--- a/drivers/media/video/gspca/ov534_9.c
+++ b/drivers/media/video/gspca/ov534_9.c
@@ -1429,7 +1429,7 @@ static const struct sd_desc sd_desc = {
1429}; 1429};
1430 1430
1431/* -- module initialisation -- */ 1431/* -- module initialisation -- */
1432static const __devinitdata struct usb_device_id device_table[] = { 1432static const struct usb_device_id device_table[] = {
1433 {USB_DEVICE(0x06f8, 0x3003)}, 1433 {USB_DEVICE(0x06f8, 0x3003)},
1434 {} 1434 {}
1435}; 1435};
diff --git a/drivers/media/video/gspca/pac207.c b/drivers/media/video/gspca/pac207.c
index 96f9986305b4..81739a2f205e 100644
--- a/drivers/media/video/gspca/pac207.c
+++ b/drivers/media/video/gspca/pac207.c
@@ -530,7 +530,7 @@ static const struct sd_desc sd_desc = {
530}; 530};
531 531
532/* -- module initialisation -- */ 532/* -- module initialisation -- */
533static const __devinitdata struct usb_device_id device_table[] = { 533static const struct usb_device_id device_table[] = {
534 {USB_DEVICE(0x041e, 0x4028)}, 534 {USB_DEVICE(0x041e, 0x4028)},
535 {USB_DEVICE(0x093a, 0x2460)}, 535 {USB_DEVICE(0x093a, 0x2460)},
536 {USB_DEVICE(0x093a, 0x2461)}, 536 {USB_DEVICE(0x093a, 0x2461)},
diff --git a/drivers/media/video/gspca/pac7302.c b/drivers/media/video/gspca/pac7302.c
index 2700975abce5..5615d7bd8304 100644
--- a/drivers/media/video/gspca/pac7302.c
+++ b/drivers/media/video/gspca/pac7302.c
@@ -1184,7 +1184,7 @@ static const struct sd_desc sd_desc = {
1184}; 1184};
1185 1185
1186/* -- module initialisation -- */ 1186/* -- module initialisation -- */
1187static const struct usb_device_id device_table[] __devinitconst = { 1187static const struct usb_device_id device_table[] = {
1188 {USB_DEVICE(0x06f8, 0x3009)}, 1188 {USB_DEVICE(0x06f8, 0x3009)},
1189 {USB_DEVICE(0x093a, 0x2620)}, 1189 {USB_DEVICE(0x093a, 0x2620)},
1190 {USB_DEVICE(0x093a, 0x2621)}, 1190 {USB_DEVICE(0x093a, 0x2621)},
@@ -1201,7 +1201,7 @@ static const struct usb_device_id device_table[] __devinitconst = {
1201MODULE_DEVICE_TABLE(usb, device_table); 1201MODULE_DEVICE_TABLE(usb, device_table);
1202 1202
1203/* -- device connect -- */ 1203/* -- device connect -- */
1204static int __devinit sd_probe(struct usb_interface *intf, 1204static int sd_probe(struct usb_interface *intf,
1205 const struct usb_device_id *id) 1205 const struct usb_device_id *id)
1206{ 1206{
1207 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), 1207 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
diff --git a/drivers/media/video/gspca/pac7311.c b/drivers/media/video/gspca/pac7311.c
index 6820f5d58b19..f8801b50e64f 100644
--- a/drivers/media/video/gspca/pac7311.c
+++ b/drivers/media/video/gspca/pac7311.c
@@ -837,7 +837,7 @@ static const struct sd_desc sd_desc = {
837}; 837};
838 838
839/* -- module initialisation -- */ 839/* -- module initialisation -- */
840static const struct usb_device_id device_table[] __devinitconst = { 840static const struct usb_device_id device_table[] = {
841 {USB_DEVICE(0x093a, 0x2600)}, 841 {USB_DEVICE(0x093a, 0x2600)},
842 {USB_DEVICE(0x093a, 0x2601)}, 842 {USB_DEVICE(0x093a, 0x2601)},
843 {USB_DEVICE(0x093a, 0x2603)}, 843 {USB_DEVICE(0x093a, 0x2603)},
@@ -849,7 +849,7 @@ static const struct usb_device_id device_table[] __devinitconst = {
849MODULE_DEVICE_TABLE(usb, device_table); 849MODULE_DEVICE_TABLE(usb, device_table);
850 850
851/* -- device connect -- */ 851/* -- device connect -- */
852static int __devinit sd_probe(struct usb_interface *intf, 852static int sd_probe(struct usb_interface *intf,
853 const struct usb_device_id *id) 853 const struct usb_device_id *id)
854{ 854{
855 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), 855 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
diff --git a/drivers/media/video/gspca/sn9c2028.c b/drivers/media/video/gspca/sn9c2028.c
index 40a06680502d..4271f86dfe01 100644
--- a/drivers/media/video/gspca/sn9c2028.c
+++ b/drivers/media/video/gspca/sn9c2028.c
@@ -703,7 +703,7 @@ static const struct sd_desc sd_desc = {
703}; 703};
704 704
705/* -- module initialisation -- */ 705/* -- module initialisation -- */
706static const __devinitdata struct usb_device_id device_table[] = { 706static const struct usb_device_id device_table[] = {
707 {USB_DEVICE(0x0458, 0x7005)}, /* Genius Smart 300, version 2 */ 707 {USB_DEVICE(0x0458, 0x7005)}, /* Genius Smart 300, version 2 */
708 /* The Genius Smart is untested. I can't find an owner ! */ 708 /* The Genius Smart is untested. I can't find an owner ! */
709 /* {USB_DEVICE(0x0c45, 0x8000)}, DC31VC, Don't know this camera */ 709 /* {USB_DEVICE(0x0c45, 0x8000)}, DC31VC, Don't know this camera */
diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c
index cb08d00d0a31..fcf29897b713 100644
--- a/drivers/media/video/gspca/sn9c20x.c
+++ b/drivers/media/video/gspca/sn9c20x.c
@@ -2470,7 +2470,7 @@ static const struct sd_desc sd_desc = {
2470 | (SENSOR_ ## sensor << 8) \ 2470 | (SENSOR_ ## sensor << 8) \
2471 | (i2c_addr) 2471 | (i2c_addr)
2472 2472
2473static const __devinitdata struct usb_device_id device_table[] = { 2473static const struct usb_device_id device_table[] = {
2474 {USB_DEVICE(0x0c45, 0x6240), SN9C20X(MT9M001, 0x5d, 0)}, 2474 {USB_DEVICE(0x0c45, 0x6240), SN9C20X(MT9M001, 0x5d, 0)},
2475 {USB_DEVICE(0x0c45, 0x6242), SN9C20X(MT9M111, 0x5d, 0)}, 2475 {USB_DEVICE(0x0c45, 0x6242), SN9C20X(MT9M111, 0x5d, 0)},
2476 {USB_DEVICE(0x0c45, 0x6248), SN9C20X(OV9655, 0x30, 0)}, 2476 {USB_DEVICE(0x0c45, 0x6248), SN9C20X(OV9655, 0x30, 0)},
diff --git a/drivers/media/video/gspca/sonixb.c b/drivers/media/video/gspca/sonixb.c
index 73504a3f87b7..c6cd68d66b53 100644
--- a/drivers/media/video/gspca/sonixb.c
+++ b/drivers/media/video/gspca/sonixb.c
@@ -23,8 +23,15 @@
23/* Some documentation on known sonixb registers: 23/* Some documentation on known sonixb registers:
24 24
25Reg Use 25Reg Use
26sn9c101 / sn9c102:
260x10 high nibble red gain low nibble blue gain 270x10 high nibble red gain low nibble blue gain
270x11 low nibble green gain 280x11 low nibble green gain
29sn9c103:
300x05 red gain 0-127
310x06 blue gain 0-127
320x07 green gain 0-127
33all:
340x08-0x0f i2c / 3wire registers
280x12 hstart 350x12 hstart
290x13 vstart 360x13 vstart
300x15 hsize (hsize = register-value * 16) 370x15 hsize (hsize = register-value * 16)
@@ -88,12 +95,9 @@ struct sd {
88typedef const __u8 sensor_init_t[8]; 95typedef const __u8 sensor_init_t[8];
89 96
90struct sensor_data { 97struct sensor_data {
91 const __u8 *bridge_init[2]; 98 const __u8 *bridge_init;
92 int bridge_init_size[2];
93 sensor_init_t *sensor_init; 99 sensor_init_t *sensor_init;
94 int sensor_init_size; 100 int sensor_init_size;
95 sensor_init_t *sensor_bridge_init[2];
96 int sensor_bridge_init_size[2];
97 int flags; 101 int flags;
98 unsigned ctrl_dis; 102 unsigned ctrl_dis;
99 __u8 sensor_addr; 103 __u8 sensor_addr;
@@ -114,7 +118,6 @@ struct sensor_data {
114#define NO_FREQ (1 << FREQ_IDX) 118#define NO_FREQ (1 << FREQ_IDX)
115#define NO_BRIGHTNESS (1 << BRIGHTNESS_IDX) 119#define NO_BRIGHTNESS (1 << BRIGHTNESS_IDX)
116 120
117#define COMP2 0x8f
118#define COMP 0xc7 /* 0x87 //0x07 */ 121#define COMP 0xc7 /* 0x87 //0x07 */
119#define COMP1 0xc9 /* 0x89 //0x09 */ 122#define COMP1 0xc9 /* 0x89 //0x09 */
120 123
@@ -123,15 +126,11 @@ struct sensor_data {
123 126
124#define SYS_CLK 0x04 127#define SYS_CLK 0x04
125 128
126#define SENS(bridge_1, bridge_3, sensor, sensor_1, \ 129#define SENS(bridge, sensor, _flags, _ctrl_dis, _sensor_addr) \
127 sensor_3, _flags, _ctrl_dis, _sensor_addr) \
128{ \ 130{ \
129 .bridge_init = { bridge_1, bridge_3 }, \ 131 .bridge_init = bridge, \
130 .bridge_init_size = { sizeof(bridge_1), sizeof(bridge_3) }, \
131 .sensor_init = sensor, \ 132 .sensor_init = sensor, \
132 .sensor_init_size = sizeof(sensor), \ 133 .sensor_init_size = sizeof(sensor), \
133 .sensor_bridge_init = { sensor_1, sensor_3,}, \
134 .sensor_bridge_init_size = { sizeof(sensor_1), sizeof(sensor_3)}, \
135 .flags = _flags, .ctrl_dis = _ctrl_dis, .sensor_addr = _sensor_addr \ 134 .flags = _flags, .ctrl_dis = _ctrl_dis, .sensor_addr = _sensor_addr \
136} 135}
137 136
@@ -311,7 +310,6 @@ static const __u8 initHv7131d[] = {
311 0x00, 0x00, 310 0x00, 0x00,
312 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 311 0x00, 0x00, 0x00, 0x02, 0x02, 0x00,
313 0x28, 0x1e, 0x60, 0x8e, 0x42, 312 0x28, 0x1e, 0x60, 0x8e, 0x42,
314 0x1d, 0x10, 0x02, 0x03, 0x0f, 0x0c
315}; 313};
316static const __u8 hv7131d_sensor_init[][8] = { 314static const __u8 hv7131d_sensor_init[][8] = {
317 {0xa0, 0x11, 0x01, 0x04, 0x00, 0x00, 0x00, 0x17}, 315 {0xa0, 0x11, 0x01, 0x04, 0x00, 0x00, 0x00, 0x17},
@@ -326,7 +324,6 @@ static const __u8 initHv7131r[] = {
326 0x00, 0x00, 324 0x00, 0x00,
327 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 325 0x00, 0x00, 0x00, 0x02, 0x01, 0x00,
328 0x28, 0x1e, 0x60, 0x8a, 0x20, 326 0x28, 0x1e, 0x60, 0x8a, 0x20,
329 0x1d, 0x10, 0x02, 0x03, 0x0f, 0x0c
330}; 327};
331static const __u8 hv7131r_sensor_init[][8] = { 328static const __u8 hv7131r_sensor_init[][8] = {
332 {0xc0, 0x11, 0x31, 0x38, 0x2a, 0x2e, 0x00, 0x10}, 329 {0xc0, 0x11, 0x31, 0x38, 0x2a, 0x2e, 0x00, 0x10},
@@ -339,7 +336,7 @@ static const __u8 initOv6650[] = {
339 0x44, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 336 0x44, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
340 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 337 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
341 0x00, 0x01, 0x01, 0x0a, 0x16, 0x12, 0x68, 0x8b, 338 0x00, 0x01, 0x01, 0x0a, 0x16, 0x12, 0x68, 0x8b,
342 0x10, 0x1d, 0x10, 0x02, 0x02, 0x09, 0x07 339 0x10,
343}; 340};
344static const __u8 ov6650_sensor_init[][8] = { 341static const __u8 ov6650_sensor_init[][8] = {
345 /* Bright, contrast, etc are set through SCBB interface. 342 /* Bright, contrast, etc are set through SCBB interface.
@@ -378,24 +375,13 @@ static const __u8 initOv7630[] = {
378 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* r09 .. r10 */ 375 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* r09 .. r10 */
379 0x00, 0x01, 0x01, 0x0a, /* r11 .. r14 */ 376 0x00, 0x01, 0x01, 0x0a, /* r11 .. r14 */
380 0x28, 0x1e, /* H & V sizes r15 .. r16 */ 377 0x28, 0x1e, /* H & V sizes r15 .. r16 */
381 0x68, COMP2, MCK_INIT1, /* r17 .. r19 */
382 0x1d, 0x10, 0x02, 0x03, 0x0f, 0x0c /* r1a .. r1f */
383};
384static const __u8 initOv7630_3[] = {
385 0x44, 0x44, 0x00, 0x1a, 0x20, 0x20, 0x20, 0x80, /* r01 .. r08 */
386 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* r09 .. r10 */
387 0x00, 0x02, 0x01, 0x0a, /* r11 .. r14 */
388 0x28, 0x1e, /* H & V sizes r15 .. r16 */
389 0x68, 0x8f, MCK_INIT1, /* r17 .. r19 */ 378 0x68, 0x8f, MCK_INIT1, /* r17 .. r19 */
390 0x1d, 0x10, 0x02, 0x03, 0x0f, 0x0c, 0x00, /* r1a .. r20 */
391 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, /* r21 .. r28 */
392 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0, 0xff /* r29 .. r30 */
393}; 379};
394static const __u8 ov7630_sensor_init[][8] = { 380static const __u8 ov7630_sensor_init[][8] = {
395 {0xa0, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, 381 {0xa0, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10},
396 {0xb0, 0x21, 0x01, 0x77, 0x3a, 0x00, 0x00, 0x10}, 382 {0xb0, 0x21, 0x01, 0x77, 0x3a, 0x00, 0x00, 0x10},
397/* {0xd0, 0x21, 0x12, 0x7c, 0x01, 0x80, 0x34, 0x10}, jfm */ 383/* {0xd0, 0x21, 0x12, 0x7c, 0x01, 0x80, 0x34, 0x10}, jfm */
398 {0xd0, 0x21, 0x12, 0x1c, 0x00, 0x80, 0x34, 0x10}, /* jfm */ 384 {0xd0, 0x21, 0x12, 0x5c, 0x00, 0x80, 0x34, 0x10}, /* jfm */
399 {0xa0, 0x21, 0x1b, 0x04, 0x00, 0x80, 0x34, 0x10}, 385 {0xa0, 0x21, 0x1b, 0x04, 0x00, 0x80, 0x34, 0x10},
400 {0xa0, 0x21, 0x20, 0x44, 0x00, 0x80, 0x34, 0x10}, 386 {0xa0, 0x21, 0x20, 0x44, 0x00, 0x80, 0x34, 0x10},
401 {0xa0, 0x21, 0x23, 0xee, 0x00, 0x80, 0x34, 0x10}, 387 {0xa0, 0x21, 0x23, 0xee, 0x00, 0x80, 0x34, 0x10},
@@ -413,16 +399,11 @@ static const __u8 ov7630_sensor_init[][8] = {
413 {0xd0, 0x21, 0x17, 0x1c, 0xbd, 0x06, 0xf6, 0x10}, 399 {0xd0, 0x21, 0x17, 0x1c, 0xbd, 0x06, 0xf6, 0x10},
414}; 400};
415 401
416static const __u8 ov7630_sensor_init_3[][8] = {
417 {0xa0, 0x21, 0x13, 0x80, 0x00, 0x00, 0x00, 0x10},
418};
419
420static const __u8 initPas106[] = { 402static const __u8 initPas106[] = {
421 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x40, 0x00, 0x00, 0x00, 403 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x40, 0x00, 0x00, 0x00,
422 0x00, 0x00, 404 0x00, 0x00,
423 0x00, 0x00, 0x00, 0x04, 0x01, 0x00, 405 0x00, 0x00, 0x00, 0x04, 0x01, 0x00,
424 0x16, 0x12, 0x24, COMP1, MCK_INIT1, 406 0x16, 0x12, 0x24, COMP1, MCK_INIT1,
425 0x18, 0x10, 0x02, 0x02, 0x09, 0x07
426}; 407};
427/* compression 0x86 mckinit1 0x2b */ 408/* compression 0x86 mckinit1 0x2b */
428 409
@@ -496,7 +477,6 @@ static const __u8 initPas202[] = {
496 0x00, 0x00, 477 0x00, 0x00,
497 0x00, 0x00, 0x00, 0x06, 0x03, 0x0a, 478 0x00, 0x00, 0x00, 0x06, 0x03, 0x0a,
498 0x28, 0x1e, 0x20, 0x89, 0x20, 479 0x28, 0x1e, 0x20, 0x89, 0x20,
499 0x00, 0x00, 0x02, 0x03, 0x0f, 0x0c
500}; 480};
501 481
502/* "Known" PAS202BCB registers: 482/* "Known" PAS202BCB registers:
@@ -537,7 +517,6 @@ static const __u8 initTas5110c[] = {
537 0x00, 0x00, 517 0x00, 0x00,
538 0x00, 0x00, 0x00, 0x45, 0x09, 0x0a, 518 0x00, 0x00, 0x00, 0x45, 0x09, 0x0a,
539 0x16, 0x12, 0x60, 0x86, 0x2b, 519 0x16, 0x12, 0x60, 0x86, 0x2b,
540 0x14, 0x0a, 0x02, 0x02, 0x09, 0x07
541}; 520};
542/* Same as above, except a different hstart */ 521/* Same as above, except a different hstart */
543static const __u8 initTas5110d[] = { 522static const __u8 initTas5110d[] = {
@@ -545,12 +524,19 @@ static const __u8 initTas5110d[] = {
545 0x00, 0x00, 524 0x00, 0x00,
546 0x00, 0x00, 0x00, 0x41, 0x09, 0x0a, 525 0x00, 0x00, 0x00, 0x41, 0x09, 0x0a,
547 0x16, 0x12, 0x60, 0x86, 0x2b, 526 0x16, 0x12, 0x60, 0x86, 0x2b,
548 0x14, 0x0a, 0x02, 0x02, 0x09, 0x07
549}; 527};
550static const __u8 tas5110_sensor_init[][8] = { 528/* tas5110c is 3 wire, tas5110d is 2 wire (regular i2c) */
529static const __u8 tas5110c_sensor_init[][8] = {
551 {0x30, 0x11, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x10}, 530 {0x30, 0x11, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x10},
552 {0x30, 0x11, 0x02, 0x20, 0xa9, 0x00, 0x00, 0x10}, 531 {0x30, 0x11, 0x02, 0x20, 0xa9, 0x00, 0x00, 0x10},
553 {0xa0, 0x61, 0x9a, 0xca, 0x00, 0x00, 0x00, 0x17}, 532};
533/* Known TAS5110D registers
534 * reg02: gain, bit order reversed!! 0 == max gain, 255 == min gain
535 * reg03: bit3: vflip, bit4: ~hflip, bit7: ~gainboost (~ == inverted)
536 * Note: writing reg03 seems to only work when written together with 02
537 */
538static const __u8 tas5110d_sensor_init[][8] = {
539 {0xa0, 0x61, 0x9a, 0xca, 0x00, 0x00, 0x00, 0x17}, /* reset */
554}; 540};
555 541
556static const __u8 initTas5130[] = { 542static const __u8 initTas5130[] = {
@@ -558,7 +544,6 @@ static const __u8 initTas5130[] = {
558 0x00, 0x00, 544 0x00, 0x00,
559 0x00, 0x00, 0x00, 0x68, 0x0c, 0x0a, 545 0x00, 0x00, 0x00, 0x68, 0x0c, 0x0a,
560 0x28, 0x1e, 0x60, COMP, MCK_INIT, 546 0x28, 0x1e, 0x60, COMP, MCK_INIT,
561 0x18, 0x10, 0x04, 0x03, 0x11, 0x0c
562}; 547};
563static const __u8 tas5130_sensor_init[][8] = { 548static const __u8 tas5130_sensor_init[][8] = {
564/* {0x30, 0x11, 0x00, 0x40, 0x47, 0x00, 0x00, 0x10}, 549/* {0x30, 0x11, 0x00, 0x40, 0x47, 0x00, 0x00, 0x10},
@@ -569,21 +554,18 @@ static const __u8 tas5130_sensor_init[][8] = {
569}; 554};
570 555
571static struct sensor_data sensor_data[] = { 556static struct sensor_data sensor_data[] = {
572SENS(initHv7131d, NULL, hv7131d_sensor_init, NULL, NULL, F_GAIN, NO_BRIGHTNESS|NO_FREQ, 0), 557SENS(initHv7131d, hv7131d_sensor_init, F_GAIN, NO_BRIGHTNESS|NO_FREQ, 0),
573SENS(initHv7131r, NULL, hv7131r_sensor_init, NULL, NULL, 0, NO_BRIGHTNESS|NO_EXPO|NO_FREQ, 0), 558SENS(initHv7131r, hv7131r_sensor_init, 0, NO_BRIGHTNESS|NO_EXPO|NO_FREQ, 0),
574SENS(initOv6650, NULL, ov6650_sensor_init, NULL, NULL, F_GAIN|F_SIF, 0, 0x60), 559SENS(initOv6650, ov6650_sensor_init, F_GAIN|F_SIF, 0, 0x60),
575SENS(initOv7630, initOv7630_3, ov7630_sensor_init, NULL, ov7630_sensor_init_3, 560SENS(initOv7630, ov7630_sensor_init, F_GAIN, 0, 0x21),
576 F_GAIN, 0, 0x21), 561SENS(initPas106, pas106_sensor_init, F_GAIN|F_SIF, NO_FREQ, 0),
577SENS(initPas106, NULL, pas106_sensor_init, NULL, NULL, F_GAIN|F_SIF, NO_FREQ, 562SENS(initPas202, pas202_sensor_init, F_GAIN, NO_FREQ, 0),
578 0), 563SENS(initTas5110c, tas5110c_sensor_init, F_GAIN|F_SIF|F_COARSE_EXPO,
579SENS(initPas202, initPas202, pas202_sensor_init, NULL, NULL, F_GAIN, 564 NO_BRIGHTNESS|NO_FREQ, 0),
580 NO_FREQ, 0), 565SENS(initTas5110d, tas5110d_sensor_init, F_GAIN|F_SIF|F_COARSE_EXPO,
581SENS(initTas5110c, NULL, tas5110_sensor_init, NULL, NULL, 566 NO_BRIGHTNESS|NO_FREQ, 0),
582 F_GAIN|F_SIF|F_COARSE_EXPO, NO_BRIGHTNESS|NO_FREQ, 0), 567SENS(initTas5130, tas5130_sensor_init, F_GAIN,
583SENS(initTas5110d, NULL, tas5110_sensor_init, NULL, NULL, 568 NO_BRIGHTNESS|NO_EXPO|NO_FREQ, 0),
584 F_GAIN|F_SIF|F_COARSE_EXPO, NO_BRIGHTNESS|NO_FREQ, 0),
585SENS(initTas5130, NULL, tas5130_sensor_init, NULL, NULL, 0, NO_EXPO|NO_FREQ,
586 0),
587}; 569};
588 570
589/* get one byte in gspca_dev->usb_buf */ 571/* get one byte in gspca_dev->usb_buf */
@@ -655,7 +637,6 @@ static void i2c_w_vector(struct gspca_dev *gspca_dev,
655static void setbrightness(struct gspca_dev *gspca_dev) 637static void setbrightness(struct gspca_dev *gspca_dev)
656{ 638{
657 struct sd *sd = (struct sd *) gspca_dev; 639 struct sd *sd = (struct sd *) gspca_dev;
658 __u8 value;
659 640
660 switch (sd->sensor) { 641 switch (sd->sensor) {
661 case SENSOR_OV6650: 642 case SENSOR_OV6650:
@@ -697,17 +678,6 @@ static void setbrightness(struct gspca_dev *gspca_dev)
697 goto err; 678 goto err;
698 break; 679 break;
699 } 680 }
700 case SENSOR_TAS5130CXX: {
701 __u8 i2c[] =
702 {0x30, 0x11, 0x02, 0x20, 0x70, 0x00, 0x00, 0x10};
703
704 value = 0xff - sd->brightness;
705 i2c[4] = value;
706 PDEBUG(D_CONF, "brightness %d : %d", value, i2c[4]);
707 if (i2c_w(gspca_dev, i2c) < 0)
708 goto err;
709 break;
710 }
711 } 681 }
712 return; 682 return;
713err: 683err:
@@ -733,7 +703,7 @@ static void setsensorgain(struct gspca_dev *gspca_dev)
733 break; 703 break;
734 } 704 }
735 case SENSOR_TAS5110C: 705 case SENSOR_TAS5110C:
736 case SENSOR_TAS5110D: { 706 case SENSOR_TAS5130CXX: {
737 __u8 i2c[] = 707 __u8 i2c[] =
738 {0x30, 0x11, 0x02, 0x20, 0x70, 0x00, 0x00, 0x10}; 708 {0x30, 0x11, 0x02, 0x20, 0x70, 0x00, 0x00, 0x10};
739 709
@@ -742,6 +712,23 @@ static void setsensorgain(struct gspca_dev *gspca_dev)
742 goto err; 712 goto err;
743 break; 713 break;
744 } 714 }
715 case SENSOR_TAS5110D: {
716 __u8 i2c[] = {
717 0xb0, 0x61, 0x02, 0x00, 0x10, 0x00, 0x00, 0x17 };
718 gain = 255 - gain;
719 /* The bits in the register are the wrong way around!! */
720 i2c[3] |= (gain & 0x80) >> 7;
721 i2c[3] |= (gain & 0x40) >> 5;
722 i2c[3] |= (gain & 0x20) >> 3;
723 i2c[3] |= (gain & 0x10) >> 1;
724 i2c[3] |= (gain & 0x08) << 1;
725 i2c[3] |= (gain & 0x04) << 3;
726 i2c[3] |= (gain & 0x02) << 5;
727 i2c[3] |= (gain & 0x01) << 7;
728 if (i2c_w(gspca_dev, i2c) < 0)
729 goto err;
730 break;
731 }
745 732
746 case SENSOR_OV6650: 733 case SENSOR_OV6650:
747 gain >>= 1; 734 gain >>= 1;
@@ -796,7 +783,7 @@ static void setgain(struct gspca_dev *gspca_dev)
796{ 783{
797 struct sd *sd = (struct sd *) gspca_dev; 784 struct sd *sd = (struct sd *) gspca_dev;
798 __u8 gain; 785 __u8 gain;
799 __u8 buf[2] = { 0, 0 }; 786 __u8 buf[3] = { 0, 0, 0 };
800 787
801 if (sensor_data[sd->sensor].flags & F_GAIN) { 788 if (sensor_data[sd->sensor].flags & F_GAIN) {
802 /* Use the sensor gain to do the actual gain */ 789 /* Use the sensor gain to do the actual gain */
@@ -804,13 +791,18 @@ static void setgain(struct gspca_dev *gspca_dev)
804 return; 791 return;
805 } 792 }
806 793
807 gain = sd->gain >> 4; 794 if (sd->bridge == BRIDGE_103) {
808 795 gain = sd->gain >> 1;
809 /* red and blue gain */ 796 buf[0] = gain; /* Red */
810 buf[0] = gain << 4 | gain; 797 buf[1] = gain; /* Green */
811 /* green gain */ 798 buf[2] = gain; /* Blue */
812 buf[1] = gain; 799 reg_w(gspca_dev, 0x05, buf, 3);
813 reg_w(gspca_dev, 0x10, buf, 2); 800 } else {
801 gain = sd->gain >> 4;
802 buf[0] = gain << 4 | gain; /* Red and blue */
803 buf[1] = gain; /* Green */
804 reg_w(gspca_dev, 0x10, buf, 2);
805 }
814} 806}
815 807
816static void setexposure(struct gspca_dev *gspca_dev) 808static void setexposure(struct gspca_dev *gspca_dev)
@@ -1049,7 +1041,7 @@ static void do_autogain(struct gspca_dev *gspca_dev)
1049 desired_avg_lum = 5000; 1041 desired_avg_lum = 5000;
1050 } else { 1042 } else {
1051 deadzone = 1500; 1043 deadzone = 1500;
1052 desired_avg_lum = 18000; 1044 desired_avg_lum = 13000;
1053 } 1045 }
1054 1046
1055 if (sensor_data[sd->sensor].flags & F_COARSE_EXPO) 1047 if (sensor_data[sd->sensor].flags & F_COARSE_EXPO)
@@ -1127,53 +1119,91 @@ static int sd_start(struct gspca_dev *gspca_dev)
1127{ 1119{
1128 struct sd *sd = (struct sd *) gspca_dev; 1120 struct sd *sd = (struct sd *) gspca_dev;
1129 struct cam *cam = &gspca_dev->cam; 1121 struct cam *cam = &gspca_dev->cam;
1130 int mode, l; 1122 int i, mode;
1131 const __u8 *sn9c10x; 1123 __u8 regs[0x31];
1132 __u8 reg12_19[8];
1133 1124
1134 mode = cam->cam_mode[gspca_dev->curr_mode].priv & 0x07; 1125 mode = cam->cam_mode[gspca_dev->curr_mode].priv & 0x07;
1135 sn9c10x = sensor_data[sd->sensor].bridge_init[sd->bridge]; 1126 /* Copy registers 0x01 - 0x19 from the template */
1136 l = sensor_data[sd->sensor].bridge_init_size[sd->bridge]; 1127 memcpy(&regs[0x01], sensor_data[sd->sensor].bridge_init, 0x19);
1137 memcpy(reg12_19, &sn9c10x[0x12 - 1], 8); 1128 /* Set the mode */
1138 reg12_19[6] = sn9c10x[0x18 - 1] | (mode << 4); 1129 regs[0x18] |= mode << 4;
1139 /* Special cases where reg 17 and or 19 value depends on mode */ 1130
1131 /* Set bridge gain to 1.0 */
1132 if (sd->bridge == BRIDGE_103) {
1133 regs[0x05] = 0x20; /* Red */
1134 regs[0x06] = 0x20; /* Green */
1135 regs[0x07] = 0x20; /* Blue */
1136 } else {
1137 regs[0x10] = 0x00; /* Red and blue */
1138 regs[0x11] = 0x00; /* Green */
1139 }
1140
1141 /* Setup pixel numbers and auto exposure window */
1142 if (sensor_data[sd->sensor].flags & F_SIF) {
1143 regs[0x1a] = 0x14; /* HO_SIZE 640, makes no sense */
1144 regs[0x1b] = 0x0a; /* VO_SIZE 320, makes no sense */
1145 regs[0x1c] = 0x02; /* AE H-start 64 */
1146 regs[0x1d] = 0x02; /* AE V-start 64 */
1147 regs[0x1e] = 0x09; /* AE H-end 288 */
1148 regs[0x1f] = 0x07; /* AE V-end 224 */
1149 } else {
1150 regs[0x1a] = 0x1d; /* HO_SIZE 960, makes no sense */
1151 regs[0x1b] = 0x10; /* VO_SIZE 512, makes no sense */
1152 regs[0x1c] = 0x05; /* AE H-start 160 */
1153 regs[0x1d] = 0x03; /* AE V-start 96 */
1154 regs[0x1e] = 0x0f; /* AE H-end 480 */
1155 regs[0x1f] = 0x0c; /* AE V-end 384 */
1156 }
1157
1158 /* Setup the gamma table (only used with the sn9c103 bridge) */
1159 for (i = 0; i < 16; i++)
1160 regs[0x20 + i] = i * 16;
1161 regs[0x20 + i] = 255;
1162
1163 /* Special cases where some regs depend on mode or bridge */
1140 switch (sd->sensor) { 1164 switch (sd->sensor) {
1141 case SENSOR_TAS5130CXX: 1165 case SENSOR_TAS5130CXX:
1142 /* probably not mode specific at all most likely the upper 1166 /* FIXME / TESTME
1167 probably not mode specific at all most likely the upper
1143 nibble of 0x19 is exposure (clock divider) just as with 1168 nibble of 0x19 is exposure (clock divider) just as with
1144 the tas5110, we need someone to test this. */ 1169 the tas5110, we need someone to test this. */
1145 reg12_19[7] = mode ? 0x23 : 0x43; 1170 regs[0x19] = mode ? 0x23 : 0x43;
1146 break; 1171 break;
1172 case SENSOR_OV7630:
1173 /* FIXME / TESTME for some reason with the 101/102 bridge the
1174 clock is set to 12 Mhz (reg1 == 0x04), rather then 24.
1175 Also the hstart needs to go from 1 to 2 when using a 103,
1176 which is likely related. This does not seem right. */
1177 if (sd->bridge == BRIDGE_103) {
1178 regs[0x01] = 0x44; /* Select 24 Mhz clock */
1179 regs[0x12] = 0x02; /* Set hstart to 2 */
1180 }
1147 } 1181 }
1148 /* Disable compression when the raw bayer format has been selected */ 1182 /* Disable compression when the raw bayer format has been selected */
1149 if (cam->cam_mode[gspca_dev->curr_mode].priv & MODE_RAW) 1183 if (cam->cam_mode[gspca_dev->curr_mode].priv & MODE_RAW)
1150 reg12_19[6] &= ~0x80; 1184 regs[0x18] &= ~0x80;
1151 1185
1152 /* Vga mode emulation on SIF sensor? */ 1186 /* Vga mode emulation on SIF sensor? */
1153 if (cam->cam_mode[gspca_dev->curr_mode].priv & MODE_REDUCED_SIF) { 1187 if (cam->cam_mode[gspca_dev->curr_mode].priv & MODE_REDUCED_SIF) {
1154 reg12_19[0] += 16; /* 0x12: hstart adjust */ 1188 regs[0x12] += 16; /* hstart adjust */
1155 reg12_19[1] += 24; /* 0x13: vstart adjust */ 1189 regs[0x13] += 24; /* vstart adjust */
1156 reg12_19[3] = 320 / 16; /* 0x15: hsize */ 1190 regs[0x15] = 320 / 16; /* hsize */
1157 reg12_19[4] = 240 / 16; /* 0x16: vsize */ 1191 regs[0x16] = 240 / 16; /* vsize */
1158 } 1192 }
1159 1193
1160 /* reg 0x01 bit 2 video transfert on */ 1194 /* reg 0x01 bit 2 video transfert on */
1161 reg_w(gspca_dev, 0x01, &sn9c10x[0x01 - 1], 1); 1195 reg_w(gspca_dev, 0x01, &regs[0x01], 1);
1162 /* reg 0x17 SensorClk enable inv Clk 0x60 */ 1196 /* reg 0x17 SensorClk enable inv Clk 0x60 */
1163 reg_w(gspca_dev, 0x17, &sn9c10x[0x17 - 1], 1); 1197 reg_w(gspca_dev, 0x17, &regs[0x17], 1);
1164 /* Set the registers from the template */ 1198 /* Set the registers from the template */
1165 reg_w(gspca_dev, 0x01, sn9c10x, l); 1199 reg_w(gspca_dev, 0x01, &regs[0x01],
1200 (sd->bridge == BRIDGE_103) ? 0x30 : 0x1f);
1166 1201
1167 /* Init the sensor */ 1202 /* Init the sensor */
1168 i2c_w_vector(gspca_dev, sensor_data[sd->sensor].sensor_init, 1203 i2c_w_vector(gspca_dev, sensor_data[sd->sensor].sensor_init,
1169 sensor_data[sd->sensor].sensor_init_size); 1204 sensor_data[sd->sensor].sensor_init_size);
1170 if (sensor_data[sd->sensor].sensor_bridge_init[sd->bridge])
1171 i2c_w_vector(gspca_dev,
1172 sensor_data[sd->sensor].sensor_bridge_init[sd->bridge],
1173 sensor_data[sd->sensor].sensor_bridge_init_size[
1174 sd->bridge]);
1175 1205
1176 /* Mode specific sensor setup */ 1206 /* Mode / bridge specific sensor setup */
1177 switch (sd->sensor) { 1207 switch (sd->sensor) {
1178 case SENSOR_PAS202: { 1208 case SENSOR_PAS202: {
1179 const __u8 i2cpclockdiv[] = 1209 const __u8 i2cpclockdiv[] =
@@ -1181,27 +1211,37 @@ static int sd_start(struct gspca_dev *gspca_dev)
1181 /* clockdiv from 4 to 3 (7.5 -> 10 fps) when in low res mode */ 1211 /* clockdiv from 4 to 3 (7.5 -> 10 fps) when in low res mode */
1182 if (mode) 1212 if (mode)
1183 i2c_w(gspca_dev, i2cpclockdiv); 1213 i2c_w(gspca_dev, i2cpclockdiv);
1214 break;
1184 } 1215 }
1216 case SENSOR_OV7630:
1217 /* FIXME / TESTME We should be able to handle this identical
1218 for the 101/102 and the 103 case */
1219 if (sd->bridge == BRIDGE_103) {
1220 const __u8 i2c[] = { 0xa0, 0x21, 0x13,
1221 0x80, 0x00, 0x00, 0x00, 0x10 };
1222 i2c_w(gspca_dev, i2c);
1223 }
1224 break;
1185 } 1225 }
1186 /* H_size V_size 0x28, 0x1e -> 640x480. 0x16, 0x12 -> 352x288 */ 1226 /* H_size V_size 0x28, 0x1e -> 640x480. 0x16, 0x12 -> 352x288 */
1187 reg_w(gspca_dev, 0x15, &reg12_19[3], 2); 1227 reg_w(gspca_dev, 0x15, &regs[0x15], 2);
1188 /* compression register */ 1228 /* compression register */
1189 reg_w(gspca_dev, 0x18, &reg12_19[6], 1); 1229 reg_w(gspca_dev, 0x18, &regs[0x18], 1);
1190 /* H_start */ 1230 /* H_start */
1191 reg_w(gspca_dev, 0x12, &reg12_19[0], 1); 1231 reg_w(gspca_dev, 0x12, &regs[0x12], 1);
1192 /* V_START */ 1232 /* V_START */
1193 reg_w(gspca_dev, 0x13, &reg12_19[1], 1); 1233 reg_w(gspca_dev, 0x13, &regs[0x13], 1);
1194 /* reset 0x17 SensorClk enable inv Clk 0x60 */ 1234 /* reset 0x17 SensorClk enable inv Clk 0x60 */
1195 /*fixme: ov7630 [17]=68 8f (+20 if 102)*/ 1235 /*fixme: ov7630 [17]=68 8f (+20 if 102)*/
1196 reg_w(gspca_dev, 0x17, &reg12_19[5], 1); 1236 reg_w(gspca_dev, 0x17, &regs[0x17], 1);
1197 /*MCKSIZE ->3 */ /*fixme: not ov7630*/ 1237 /*MCKSIZE ->3 */ /*fixme: not ov7630*/
1198 reg_w(gspca_dev, 0x19, &reg12_19[7], 1); 1238 reg_w(gspca_dev, 0x19, &regs[0x19], 1);
1199 /* AE_STRX AE_STRY AE_ENDX AE_ENDY */ 1239 /* AE_STRX AE_STRY AE_ENDX AE_ENDY */
1200 reg_w(gspca_dev, 0x1c, &sn9c10x[0x1c - 1], 4); 1240 reg_w(gspca_dev, 0x1c, &regs[0x1c], 4);
1201 /* Enable video transfert */ 1241 /* Enable video transfert */
1202 reg_w(gspca_dev, 0x01, &sn9c10x[0], 1); 1242 reg_w(gspca_dev, 0x01, &regs[0x01], 1);
1203 /* Compression */ 1243 /* Compression */
1204 reg_w(gspca_dev, 0x18, &reg12_19[6], 2); 1244 reg_w(gspca_dev, 0x18, &regs[0x18], 2);
1205 msleep(20); 1245 msleep(20);
1206 1246
1207 sd->reg11 = -1; 1247 sd->reg11 = -1;
@@ -1525,15 +1565,15 @@ static const struct sd_desc sd_desc = {
1525 .driver_info = (SENSOR_ ## sensor << 8) | BRIDGE_ ## bridge 1565 .driver_info = (SENSOR_ ## sensor << 8) | BRIDGE_ ## bridge
1526 1566
1527 1567
1528static const struct usb_device_id device_table[] __devinitconst = { 1568static const struct usb_device_id device_table[] = {
1529 {USB_DEVICE(0x0c45, 0x6001), SB(TAS5110C, 102)}, /* TAS5110C1B */ 1569 {USB_DEVICE(0x0c45, 0x6001), SB(TAS5110C, 102)}, /* TAS5110C1B */
1530 {USB_DEVICE(0x0c45, 0x6005), SB(TAS5110C, 101)}, /* TAS5110C1B */ 1570 {USB_DEVICE(0x0c45, 0x6005), SB(TAS5110C, 101)}, /* TAS5110C1B */
1531 {USB_DEVICE(0x0c45, 0x6007), SB(TAS5110D, 101)}, /* TAS5110D */ 1571 {USB_DEVICE(0x0c45, 0x6007), SB(TAS5110D, 101)}, /* TAS5110D */
1532 {USB_DEVICE(0x0c45, 0x6009), SB(PAS106, 101)}, 1572 {USB_DEVICE(0x0c45, 0x6009), SB(PAS106, 101)},
1533 {USB_DEVICE(0x0c45, 0x600d), SB(PAS106, 101)}, 1573 {USB_DEVICE(0x0c45, 0x600d), SB(PAS106, 101)},
1534 {USB_DEVICE(0x0c45, 0x6011), SB(OV6650, 101)}, 1574 {USB_DEVICE(0x0c45, 0x6011), SB(OV6650, 101)},
1535#if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE
1536 {USB_DEVICE(0x0c45, 0x6019), SB(OV7630, 101)}, 1575 {USB_DEVICE(0x0c45, 0x6019), SB(OV7630, 101)},
1576#if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE
1537 {USB_DEVICE(0x0c45, 0x6024), SB(TAS5130CXX, 102)}, 1577 {USB_DEVICE(0x0c45, 0x6024), SB(TAS5130CXX, 102)},
1538 {USB_DEVICE(0x0c45, 0x6025), SB(TAS5130CXX, 102)}, 1578 {USB_DEVICE(0x0c45, 0x6025), SB(TAS5130CXX, 102)},
1539#endif 1579#endif
@@ -1544,18 +1584,22 @@ static const struct usb_device_id device_table[] __devinitconst = {
1544 {USB_DEVICE(0x0c45, 0x602c), SB(OV7630, 102)}, 1584 {USB_DEVICE(0x0c45, 0x602c), SB(OV7630, 102)},
1545 {USB_DEVICE(0x0c45, 0x602d), SB(HV7131R, 102)}, 1585 {USB_DEVICE(0x0c45, 0x602d), SB(HV7131R, 102)},
1546 {USB_DEVICE(0x0c45, 0x602e), SB(OV7630, 102)}, 1586 {USB_DEVICE(0x0c45, 0x602e), SB(OV7630, 102)},
1547 /* {USB_DEVICE(0x0c45, 0x602b), SB(MI03XX, 102)}, */ /* MI0343 MI0360 MI0330 */ 1587 /* {USB_DEVICE(0x0c45, 0x6030), SB(MI03XX, 102)}, */ /* MI0343 MI0360 MI0330 */
1588 /* {USB_DEVICE(0x0c45, 0x6082), SB(MI03XX, 103)}, */ /* MI0343 MI0360 */
1589 {USB_DEVICE(0x0c45, 0x6083), SB(HV7131D, 103)},
1590 {USB_DEVICE(0x0c45, 0x608c), SB(HV7131R, 103)},
1591 /* {USB_DEVICE(0x0c45, 0x608e), SB(CISVF10, 103)}, */
1548 {USB_DEVICE(0x0c45, 0x608f), SB(OV7630, 103)}, 1592 {USB_DEVICE(0x0c45, 0x608f), SB(OV7630, 103)},
1549#if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE 1593 {USB_DEVICE(0x0c45, 0x60a8), SB(PAS106, 103)},
1594 {USB_DEVICE(0x0c45, 0x60aa), SB(TAS5130CXX, 103)},
1550 {USB_DEVICE(0x0c45, 0x60af), SB(PAS202, 103)}, 1595 {USB_DEVICE(0x0c45, 0x60af), SB(PAS202, 103)},
1551#endif
1552 {USB_DEVICE(0x0c45, 0x60b0), SB(OV7630, 103)}, 1596 {USB_DEVICE(0x0c45, 0x60b0), SB(OV7630, 103)},
1553 {} 1597 {}
1554}; 1598};
1555MODULE_DEVICE_TABLE(usb, device_table); 1599MODULE_DEVICE_TABLE(usb, device_table);
1556 1600
1557/* -- device connect -- */ 1601/* -- device connect -- */
1558static int __devinit sd_probe(struct usb_interface *intf, 1602static int sd_probe(struct usb_interface *intf,
1559 const struct usb_device_id *id) 1603 const struct usb_device_id *id)
1560{ 1604{
1561 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), 1605 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c
index 2d0bb17a30a2..d6f39ce1b7e1 100644
--- a/drivers/media/video/gspca/sonixj.c
+++ b/drivers/media/video/gspca/sonixj.c
@@ -25,12 +25,12 @@
25#include "gspca.h" 25#include "gspca.h"
26#include "jpeg.h" 26#include "jpeg.h"
27 27
28#define V4L2_CID_INFRARED (V4L2_CID_PRIVATE_BASE + 0)
29
30MODULE_AUTHOR("Jean-François Moine <http://moinejf.free.fr>"); 28MODULE_AUTHOR("Jean-François Moine <http://moinejf.free.fr>");
31MODULE_DESCRIPTION("GSPCA/SONIX JPEG USB Camera Driver"); 29MODULE_DESCRIPTION("GSPCA/SONIX JPEG USB Camera Driver");
32MODULE_LICENSE("GPL"); 30MODULE_LICENSE("GPL");
33 31
32static int starcam;
33
34/* controls */ 34/* controls */
35enum e_ctrl { 35enum e_ctrl {
36 BRIGHTNESS, 36 BRIGHTNESS,
@@ -43,7 +43,7 @@ enum e_ctrl {
43 HFLIP, 43 HFLIP,
44 VFLIP, 44 VFLIP,
45 SHARPNESS, 45 SHARPNESS,
46 INFRARED, 46 ILLUM,
47 FREQ, 47 FREQ,
48 NCTRLS /* number of controls */ 48 NCTRLS /* number of controls */
49}; 49};
@@ -100,7 +100,8 @@ enum sensors {
100}; 100};
101 101
102/* device flags */ 102/* device flags */
103#define PDN_INV 1 /* inverse pin S_PWR_DN / sn_xxx tables */ 103#define F_PDN_INV 0x01 /* inverse pin S_PWR_DN / sn_xxx tables */
104#define F_ILLUM 0x02 /* presence of illuminator */
104 105
105/* sn9c1xx definitions */ 106/* sn9c1xx definitions */
106/* register 0x01 */ 107/* register 0x01 */
@@ -124,7 +125,7 @@ static void setgamma(struct gspca_dev *gspca_dev);
124static void setautogain(struct gspca_dev *gspca_dev); 125static void setautogain(struct gspca_dev *gspca_dev);
125static void sethvflip(struct gspca_dev *gspca_dev); 126static void sethvflip(struct gspca_dev *gspca_dev);
126static void setsharpness(struct gspca_dev *gspca_dev); 127static void setsharpness(struct gspca_dev *gspca_dev);
127static void setinfrared(struct gspca_dev *gspca_dev); 128static void setillum(struct gspca_dev *gspca_dev);
128static void setfreq(struct gspca_dev *gspca_dev); 129static void setfreq(struct gspca_dev *gspca_dev);
129 130
130static const struct ctrl sd_ctrls[NCTRLS] = { 131static const struct ctrl sd_ctrls[NCTRLS] = {
@@ -251,18 +252,17 @@ static const struct ctrl sd_ctrls[NCTRLS] = {
251 }, 252 },
252 .set_control = setsharpness 253 .set_control = setsharpness
253 }, 254 },
254/* mt9v111 only */ 255[ILLUM] = {
255[INFRARED] = {
256 { 256 {
257 .id = V4L2_CID_INFRARED, 257 .id = V4L2_CID_ILLUMINATORS_1,
258 .type = V4L2_CTRL_TYPE_BOOLEAN, 258 .type = V4L2_CTRL_TYPE_BOOLEAN,
259 .name = "Infrared", 259 .name = "Illuminator / infrared",
260 .minimum = 0, 260 .minimum = 0,
261 .maximum = 1, 261 .maximum = 1,
262 .step = 1, 262 .step = 1,
263 .default_value = 0, 263 .default_value = 0,
264 }, 264 },
265 .set_control = setinfrared 265 .set_control = setillum
266 }, 266 },
267/* ov7630/ov7648/ov7660 only */ 267/* ov7630/ov7648/ov7660 only */
268[FREQ] = { 268[FREQ] = {
@@ -282,32 +282,26 @@ static const struct ctrl sd_ctrls[NCTRLS] = {
282/* table of the disabled controls */ 282/* table of the disabled controls */
283static const __u32 ctrl_dis[] = { 283static const __u32 ctrl_dis[] = {
284[SENSOR_ADCM1700] = (1 << AUTOGAIN) | 284[SENSOR_ADCM1700] = (1 << AUTOGAIN) |
285 (1 << INFRARED) |
286 (1 << HFLIP) | 285 (1 << HFLIP) |
287 (1 << VFLIP) | 286 (1 << VFLIP) |
288 (1 << FREQ), 287 (1 << FREQ),
289 288
290[SENSOR_GC0307] = (1 << INFRARED) | 289[SENSOR_GC0307] = (1 << HFLIP) |
291 (1 << HFLIP) |
292 (1 << VFLIP) | 290 (1 << VFLIP) |
293 (1 << FREQ), 291 (1 << FREQ),
294 292
295[SENSOR_HV7131R] = (1 << INFRARED) | 293[SENSOR_HV7131R] = (1 << HFLIP) |
296 (1 << HFLIP) |
297 (1 << FREQ), 294 (1 << FREQ),
298 295
299[SENSOR_MI0360] = (1 << INFRARED) | 296[SENSOR_MI0360] = (1 << HFLIP) |
300 (1 << HFLIP) |
301 (1 << VFLIP) | 297 (1 << VFLIP) |
302 (1 << FREQ), 298 (1 << FREQ),
303 299
304[SENSOR_MI0360B] = (1 << INFRARED) | 300[SENSOR_MI0360B] = (1 << HFLIP) |
305 (1 << HFLIP) |
306 (1 << VFLIP) | 301 (1 << VFLIP) |
307 (1 << FREQ), 302 (1 << FREQ),
308 303
309[SENSOR_MO4000] = (1 << INFRARED) | 304[SENSOR_MO4000] = (1 << HFLIP) |
310 (1 << HFLIP) |
311 (1 << VFLIP) | 305 (1 << VFLIP) |
312 (1 << FREQ), 306 (1 << FREQ),
313 307
@@ -315,40 +309,32 @@ static const __u32 ctrl_dis[] = {
315 (1 << VFLIP) | 309 (1 << VFLIP) |
316 (1 << FREQ), 310 (1 << FREQ),
317 311
318[SENSOR_OM6802] = (1 << INFRARED) | 312[SENSOR_OM6802] = (1 << HFLIP) |
319 (1 << HFLIP) |
320 (1 << VFLIP) | 313 (1 << VFLIP) |
321 (1 << FREQ), 314 (1 << FREQ),
322 315
323[SENSOR_OV7630] = (1 << INFRARED) | 316[SENSOR_OV7630] = (1 << HFLIP),
324 (1 << HFLIP),
325 317
326[SENSOR_OV7648] = (1 << INFRARED) | 318[SENSOR_OV7648] = (1 << HFLIP),
327 (1 << HFLIP),
328 319
329[SENSOR_OV7660] = (1 << AUTOGAIN) | 320[SENSOR_OV7660] = (1 << AUTOGAIN) |
330 (1 << INFRARED) |
331 (1 << HFLIP) | 321 (1 << HFLIP) |
332 (1 << VFLIP), 322 (1 << VFLIP),
333 323
334[SENSOR_PO1030] = (1 << AUTOGAIN) | 324[SENSOR_PO1030] = (1 << AUTOGAIN) |
335 (1 << INFRARED) |
336 (1 << HFLIP) | 325 (1 << HFLIP) |
337 (1 << VFLIP) | 326 (1 << VFLIP) |
338 (1 << FREQ), 327 (1 << FREQ),
339 328
340[SENSOR_PO2030N] = (1 << AUTOGAIN) | 329[SENSOR_PO2030N] = (1 << AUTOGAIN) |
341 (1 << INFRARED) |
342 (1 << FREQ), 330 (1 << FREQ),
343 331
344[SENSOR_SOI768] = (1 << AUTOGAIN) | 332[SENSOR_SOI768] = (1 << AUTOGAIN) |
345 (1 << INFRARED) |
346 (1 << HFLIP) | 333 (1 << HFLIP) |
347 (1 << VFLIP) | 334 (1 << VFLIP) |
348 (1 << FREQ), 335 (1 << FREQ),
349 336
350[SENSOR_SP80708] = (1 << AUTOGAIN) | 337[SENSOR_SP80708] = (1 << AUTOGAIN) |
351 (1 << INFRARED) |
352 (1 << HFLIP) | 338 (1 << HFLIP) |
353 (1 << VFLIP) | 339 (1 << VFLIP) |
354 (1 << FREQ), 340 (1 << FREQ),
@@ -1822,44 +1808,46 @@ static int sd_init(struct gspca_dev *gspca_dev)
1822 PDEBUG(D_PROBE, "Sonix chip id: %02x", regF1); 1808 PDEBUG(D_PROBE, "Sonix chip id: %02x", regF1);
1823 switch (sd->bridge) { 1809 switch (sd->bridge) {
1824 case BRIDGE_SN9C102P: 1810 case BRIDGE_SN9C102P:
1811 case BRIDGE_SN9C105:
1825 if (regF1 != 0x11) 1812 if (regF1 != 0x11)
1826 return -ENODEV; 1813 return -ENODEV;
1814 break;
1815 default:
1816/* case BRIDGE_SN9C110: */
1817/* case BRIDGE_SN9C120: */
1818 if (regF1 != 0x12)
1819 return -ENODEV;
1820 }
1821
1822 switch (sd->sensor) {
1823 case SENSOR_MI0360:
1824 mi0360_probe(gspca_dev);
1825 break;
1826 case SENSOR_OV7630:
1827 ov7630_probe(gspca_dev);
1828 break;
1829 case SENSOR_OV7648:
1830 ov7648_probe(gspca_dev);
1831 break;
1832 case SENSOR_PO2030N:
1833 po2030n_probe(gspca_dev);
1834 break;
1835 }
1836
1837 switch (sd->bridge) {
1838 case BRIDGE_SN9C102P:
1827 reg_w1(gspca_dev, 0x02, regGpio[1]); 1839 reg_w1(gspca_dev, 0x02, regGpio[1]);
1828 break; 1840 break;
1829 case BRIDGE_SN9C105: 1841 case BRIDGE_SN9C105:
1830 if (regF1 != 0x11)
1831 return -ENODEV;
1832 if (sd->sensor == SENSOR_MI0360)
1833 mi0360_probe(gspca_dev);
1834 reg_w(gspca_dev, 0x01, regGpio, 2); 1842 reg_w(gspca_dev, 0x01, regGpio, 2);
1835 break; 1843 break;
1844 case BRIDGE_SN9C110:
1845 reg_w1(gspca_dev, 0x02, 0x62);
1846 break;
1836 case BRIDGE_SN9C120: 1847 case BRIDGE_SN9C120:
1837 if (regF1 != 0x12)
1838 return -ENODEV;
1839 switch (sd->sensor) {
1840 case SENSOR_MI0360:
1841 mi0360_probe(gspca_dev);
1842 break;
1843 case SENSOR_OV7630:
1844 ov7630_probe(gspca_dev);
1845 break;
1846 case SENSOR_OV7648:
1847 ov7648_probe(gspca_dev);
1848 break;
1849 case SENSOR_PO2030N:
1850 po2030n_probe(gspca_dev);
1851 break;
1852 }
1853 regGpio[1] = 0x70; /* no audio */ 1848 regGpio[1] = 0x70; /* no audio */
1854 reg_w(gspca_dev, 0x01, regGpio, 2); 1849 reg_w(gspca_dev, 0x01, regGpio, 2);
1855 break; 1850 break;
1856 default:
1857/* case BRIDGE_SN9C110: */
1858/* case BRIDGE_SN9C325: */
1859 if (regF1 != 0x12)
1860 return -ENODEV;
1861 reg_w1(gspca_dev, 0x02, 0x62);
1862 break;
1863 } 1851 }
1864 1852
1865 if (sd->sensor == SENSOR_OM6802) 1853 if (sd->sensor == SENSOR_OM6802)
@@ -1874,6 +1862,8 @@ static int sd_init(struct gspca_dev *gspca_dev)
1874 sd->i2c_addr = sn9c1xx[9]; 1862 sd->i2c_addr = sn9c1xx[9];
1875 1863
1876 gspca_dev->ctrl_dis = ctrl_dis[sd->sensor]; 1864 gspca_dev->ctrl_dis = ctrl_dis[sd->sensor];
1865 if (!(sd->flags & F_ILLUM))
1866 gspca_dev->ctrl_dis |= (1 << ILLUM);
1877 1867
1878 return gspca_dev->usb_err; 1868 return gspca_dev->usb_err;
1879} 1869}
@@ -2197,16 +2187,28 @@ static void setsharpness(struct gspca_dev *gspca_dev)
2197 reg_w1(gspca_dev, 0x99, sd->ctrls[SHARPNESS].val); 2187 reg_w1(gspca_dev, 0x99, sd->ctrls[SHARPNESS].val);
2198} 2188}
2199 2189
2200static void setinfrared(struct gspca_dev *gspca_dev) 2190static void setillum(struct gspca_dev *gspca_dev)
2201{ 2191{
2202 struct sd *sd = (struct sd *) gspca_dev; 2192 struct sd *sd = (struct sd *) gspca_dev;
2203 2193
2204 if (gspca_dev->ctrl_dis & (1 << INFRARED)) 2194 if (gspca_dev->ctrl_dis & (1 << ILLUM))
2205 return; 2195 return;
2206/*fixme: different sequence for StarCam Clip and StarCam 370i */ 2196 switch (sd->sensor) {
2207/* Clip */ 2197 case SENSOR_ADCM1700:
2208 i2c_w1(gspca_dev, 0x02, /* gpio */ 2198 reg_w1(gspca_dev, 0x02, /* gpio */
2209 sd->ctrls[INFRARED].val ? 0x66 : 0x64); 2199 sd->ctrls[ILLUM].val ? 0x64 : 0x60);
2200 break;
2201 case SENSOR_MT9V111:
2202 if (starcam)
2203 reg_w1(gspca_dev, 0x02,
2204 sd->ctrls[ILLUM].val ?
2205 0x55 : 0x54); /* 370i */
2206 else
2207 reg_w1(gspca_dev, 0x02,
2208 sd->ctrls[ILLUM].val ?
2209 0x66 : 0x64); /* Clip */
2210 break;
2211 }
2210} 2212}
2211 2213
2212static void setfreq(struct gspca_dev *gspca_dev) 2214static void setfreq(struct gspca_dev *gspca_dev)
@@ -2344,7 +2346,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
2344 /* sensor clock already enabled in sd_init */ 2346 /* sensor clock already enabled in sd_init */
2345 /* reg_w1(gspca_dev, 0xf1, 0x00); */ 2347 /* reg_w1(gspca_dev, 0xf1, 0x00); */
2346 reg01 = sn9c1xx[1]; 2348 reg01 = sn9c1xx[1];
2347 if (sd->flags & PDN_INV) 2349 if (sd->flags & F_PDN_INV)
2348 reg01 ^= S_PDN_INV; /* power down inverted */ 2350 reg01 ^= S_PDN_INV; /* power down inverted */
2349 reg_w1(gspca_dev, 0x01, reg01); 2351 reg_w1(gspca_dev, 0x01, reg01);
2350 2352
@@ -2907,13 +2909,11 @@ static const struct sd_desc sd_desc = {
2907 .driver_info = (BRIDGE_ ## bridge << 16) \ 2909 .driver_info = (BRIDGE_ ## bridge << 16) \
2908 | (SENSOR_ ## sensor << 8) \ 2910 | (SENSOR_ ## sensor << 8) \
2909 | (flags) 2911 | (flags)
2910static const __devinitdata struct usb_device_id device_table[] = { 2912static const struct usb_device_id device_table[] = {
2911#if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE
2912 {USB_DEVICE(0x0458, 0x7025), BS(SN9C120, MI0360)}, 2913 {USB_DEVICE(0x0458, 0x7025), BS(SN9C120, MI0360)},
2913 {USB_DEVICE(0x0458, 0x702e), BS(SN9C120, OV7660)}, 2914 {USB_DEVICE(0x0458, 0x702e), BS(SN9C120, OV7660)},
2914#endif 2915 {USB_DEVICE(0x045e, 0x00f5), BSF(SN9C105, OV7660, F_PDN_INV)},
2915 {USB_DEVICE(0x045e, 0x00f5), BSF(SN9C105, OV7660, PDN_INV)}, 2916 {USB_DEVICE(0x045e, 0x00f7), BSF(SN9C105, OV7660, F_PDN_INV)},
2916 {USB_DEVICE(0x045e, 0x00f7), BSF(SN9C105, OV7660, PDN_INV)},
2917 {USB_DEVICE(0x0471, 0x0327), BS(SN9C105, MI0360)}, 2917 {USB_DEVICE(0x0471, 0x0327), BS(SN9C105, MI0360)},
2918 {USB_DEVICE(0x0471, 0x0328), BS(SN9C105, MI0360)}, 2918 {USB_DEVICE(0x0471, 0x0328), BS(SN9C105, MI0360)},
2919 {USB_DEVICE(0x0471, 0x0330), BS(SN9C105, MI0360)}, 2919 {USB_DEVICE(0x0471, 0x0330), BS(SN9C105, MI0360)},
@@ -2925,7 +2925,7 @@ static const __devinitdata struct usb_device_id device_table[] = {
2925/* {USB_DEVICE(0x0c45, 0x607b), BS(SN9C102P, OV7660)}, */ 2925/* {USB_DEVICE(0x0c45, 0x607b), BS(SN9C102P, OV7660)}, */
2926 {USB_DEVICE(0x0c45, 0x607c), BS(SN9C102P, HV7131R)}, 2926 {USB_DEVICE(0x0c45, 0x607c), BS(SN9C102P, HV7131R)},
2927/* {USB_DEVICE(0x0c45, 0x607e), BS(SN9C102P, OV7630)}, */ 2927/* {USB_DEVICE(0x0c45, 0x607e), BS(SN9C102P, OV7630)}, */
2928 {USB_DEVICE(0x0c45, 0x60c0), BS(SN9C105, MI0360)}, 2928 {USB_DEVICE(0x0c45, 0x60c0), BSF(SN9C105, MI0360, F_ILLUM)},
2929 /* or MT9V111 */ 2929 /* or MT9V111 */
2930/* {USB_DEVICE(0x0c45, 0x60c2), BS(SN9C105, P1030xC)}, */ 2930/* {USB_DEVICE(0x0c45, 0x60c2), BS(SN9C105, P1030xC)}, */
2931/* {USB_DEVICE(0x0c45, 0x60c8), BS(SN9C105, OM6802)}, */ 2931/* {USB_DEVICE(0x0c45, 0x60c8), BS(SN9C105, OM6802)}, */
@@ -2936,10 +2936,8 @@ static const __devinitdata struct usb_device_id device_table[] = {
2936/* {USB_DEVICE(0x0c45, 0x60fa), BS(SN9C105, OV7648)}, */ 2936/* {USB_DEVICE(0x0c45, 0x60fa), BS(SN9C105, OV7648)}, */
2937/* {USB_DEVICE(0x0c45, 0x60f2), BS(SN9C105, OV7660)}, */ 2937/* {USB_DEVICE(0x0c45, 0x60f2), BS(SN9C105, OV7660)}, */
2938 {USB_DEVICE(0x0c45, 0x60fb), BS(SN9C105, OV7660)}, 2938 {USB_DEVICE(0x0c45, 0x60fb), BS(SN9C105, OV7660)},
2939#if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE
2940 {USB_DEVICE(0x0c45, 0x60fc), BS(SN9C105, HV7131R)}, 2939 {USB_DEVICE(0x0c45, 0x60fc), BS(SN9C105, HV7131R)},
2941 {USB_DEVICE(0x0c45, 0x60fe), BS(SN9C105, OV7630)}, 2940 {USB_DEVICE(0x0c45, 0x60fe), BS(SN9C105, OV7630)},
2942#endif
2943 {USB_DEVICE(0x0c45, 0x6100), BS(SN9C120, MI0360)}, /*sn9c128*/ 2941 {USB_DEVICE(0x0c45, 0x6100), BS(SN9C120, MI0360)}, /*sn9c128*/
2944 {USB_DEVICE(0x0c45, 0x6102), BS(SN9C120, PO2030N)}, /* /GC0305*/ 2942 {USB_DEVICE(0x0c45, 0x6102), BS(SN9C120, PO2030N)}, /* /GC0305*/
2945/* {USB_DEVICE(0x0c45, 0x6108), BS(SN9C120, OM6802)}, */ 2943/* {USB_DEVICE(0x0c45, 0x6108), BS(SN9C120, OM6802)}, */
@@ -2962,16 +2960,15 @@ static const __devinitdata struct usb_device_id device_table[] = {
2962/* {USB_DEVICE(0x0c45, 0x6132), BS(SN9C120, OV7670)}, */ 2960/* {USB_DEVICE(0x0c45, 0x6132), BS(SN9C120, OV7670)}, */
2963 {USB_DEVICE(0x0c45, 0x6138), BS(SN9C120, MO4000)}, 2961 {USB_DEVICE(0x0c45, 0x6138), BS(SN9C120, MO4000)},
2964 {USB_DEVICE(0x0c45, 0x613a), BS(SN9C120, OV7648)}, 2962 {USB_DEVICE(0x0c45, 0x613a), BS(SN9C120, OV7648)},
2965#if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE
2966 {USB_DEVICE(0x0c45, 0x613b), BS(SN9C120, OV7660)}, 2963 {USB_DEVICE(0x0c45, 0x613b), BS(SN9C120, OV7660)},
2967#endif
2968 {USB_DEVICE(0x0c45, 0x613c), BS(SN9C120, HV7131R)}, 2964 {USB_DEVICE(0x0c45, 0x613c), BS(SN9C120, HV7131R)},
2969 {USB_DEVICE(0x0c45, 0x613e), BS(SN9C120, OV7630)}, 2965 {USB_DEVICE(0x0c45, 0x613e), BS(SN9C120, OV7630)},
2970 {USB_DEVICE(0x0c45, 0x6142), BS(SN9C120, PO2030N)}, /*sn9c120b*/ 2966 {USB_DEVICE(0x0c45, 0x6142), BS(SN9C120, PO2030N)}, /*sn9c120b*/
2971 /* or GC0305 / GC0307 */ 2967 /* or GC0305 / GC0307 */
2972 {USB_DEVICE(0x0c45, 0x6143), BS(SN9C120, SP80708)}, /*sn9c120b*/ 2968 {USB_DEVICE(0x0c45, 0x6143), BS(SN9C120, SP80708)}, /*sn9c120b*/
2973 {USB_DEVICE(0x0c45, 0x6148), BS(SN9C120, OM6802)}, /*sn9c120b*/ 2969 {USB_DEVICE(0x0c45, 0x6148), BS(SN9C120, OM6802)}, /*sn9c120b*/
2974 {USB_DEVICE(0x0c45, 0x614a), BS(SN9C120, ADCM1700)}, /*sn9c120b*/ 2970 {USB_DEVICE(0x0c45, 0x614a), BSF(SN9C120, ADCM1700, F_ILLUM)},
2971/* {USB_DEVICE(0x0c45, 0x614c), BS(SN9C120, GC0306)}, */ /*sn9c120b*/
2975 {} 2972 {}
2976}; 2973};
2977MODULE_DEVICE_TABLE(usb, device_table); 2974MODULE_DEVICE_TABLE(usb, device_table);
@@ -3007,3 +3004,7 @@ static void __exit sd_mod_exit(void)
3007 3004
3008module_init(sd_mod_init); 3005module_init(sd_mod_init);
3009module_exit(sd_mod_exit); 3006module_exit(sd_mod_exit);
3007
3008module_param(starcam, int, 0644);
3009MODULE_PARM_DESC(starcam,
3010 "StarCam model. 0: Clip, 1: 370i");
diff --git a/drivers/media/video/gspca/spca1528.c b/drivers/media/video/gspca/spca1528.c
index e64338664410..76c006b2bc83 100644
--- a/drivers/media/video/gspca/spca1528.c
+++ b/drivers/media/video/gspca/spca1528.c
@@ -555,7 +555,7 @@ static const struct sd_desc sd_desc = {
555}; 555};
556 556
557/* -- module initialisation -- */ 557/* -- module initialisation -- */
558static const __devinitdata struct usb_device_id device_table[] = { 558static const struct usb_device_id device_table[] = {
559 {USB_DEVICE(0x04fc, 0x1528)}, 559 {USB_DEVICE(0x04fc, 0x1528)},
560 {} 560 {}
561}; 561};
diff --git a/drivers/media/video/gspca/spca500.c b/drivers/media/video/gspca/spca500.c
index 8e202b9039f1..45552c3ff8d9 100644
--- a/drivers/media/video/gspca/spca500.c
+++ b/drivers/media/video/gspca/spca500.c
@@ -1051,7 +1051,7 @@ static const struct sd_desc sd_desc = {
1051}; 1051};
1052 1052
1053/* -- module initialisation -- */ 1053/* -- module initialisation -- */
1054static const __devinitdata struct usb_device_id device_table[] = { 1054static const struct usb_device_id device_table[] = {
1055 {USB_DEVICE(0x040a, 0x0300), .driver_info = KodakEZ200}, 1055 {USB_DEVICE(0x040a, 0x0300), .driver_info = KodakEZ200},
1056 {USB_DEVICE(0x041e, 0x400a), .driver_info = CreativePCCam300}, 1056 {USB_DEVICE(0x041e, 0x400a), .driver_info = CreativePCCam300},
1057 {USB_DEVICE(0x046d, 0x0890), .driver_info = LogitechTraveler}, 1057 {USB_DEVICE(0x046d, 0x0890), .driver_info = LogitechTraveler},
diff --git a/drivers/media/video/gspca/spca501.c b/drivers/media/video/gspca/spca501.c
index 642839a11e8d..f7ef282cc600 100644
--- a/drivers/media/video/gspca/spca501.c
+++ b/drivers/media/video/gspca/spca501.c
@@ -2155,7 +2155,7 @@ static const struct sd_desc sd_desc = {
2155}; 2155};
2156 2156
2157/* -- module initialisation -- */ 2157/* -- module initialisation -- */
2158static const __devinitdata struct usb_device_id device_table[] = { 2158static const struct usb_device_id device_table[] = {
2159 {USB_DEVICE(0x040a, 0x0002), .driver_info = KodakDVC325}, 2159 {USB_DEVICE(0x040a, 0x0002), .driver_info = KodakDVC325},
2160 {USB_DEVICE(0x0497, 0xc001), .driver_info = SmileIntlCamera}, 2160 {USB_DEVICE(0x0497, 0xc001), .driver_info = SmileIntlCamera},
2161 {USB_DEVICE(0x0506, 0x00df), .driver_info = ThreeComHomeConnectLite}, 2161 {USB_DEVICE(0x0506, 0x00df), .driver_info = ThreeComHomeConnectLite},
diff --git a/drivers/media/video/gspca/spca505.c b/drivers/media/video/gspca/spca505.c
index bc9dd9034ab4..e5bf865147d7 100644
--- a/drivers/media/video/gspca/spca505.c
+++ b/drivers/media/video/gspca/spca505.c
@@ -786,7 +786,7 @@ static const struct sd_desc sd_desc = {
786}; 786};
787 787
788/* -- module initialisation -- */ 788/* -- module initialisation -- */
789static const __devinitdata struct usb_device_id device_table[] = { 789static const struct usb_device_id device_table[] = {
790 {USB_DEVICE(0x041e, 0x401d), .driver_info = Nxultra}, 790 {USB_DEVICE(0x041e, 0x401d), .driver_info = Nxultra},
791 {USB_DEVICE(0x0733, 0x0430), .driver_info = IntelPCCameraPro}, 791 {USB_DEVICE(0x0733, 0x0430), .driver_info = IntelPCCameraPro},
792/*fixme: may be UsbGrabberPV321 BRIDGE_SPCA506 SENSOR_SAA7113 */ 792/*fixme: may be UsbGrabberPV321 BRIDGE_SPCA506 SENSOR_SAA7113 */
diff --git a/drivers/media/video/gspca/spca508.c b/drivers/media/video/gspca/spca508.c
index 7307638ac91d..348319371523 100644
--- a/drivers/media/video/gspca/spca508.c
+++ b/drivers/media/video/gspca/spca508.c
@@ -1509,7 +1509,7 @@ static const struct sd_desc sd_desc = {
1509}; 1509};
1510 1510
1511/* -- module initialisation -- */ 1511/* -- module initialisation -- */
1512static const __devinitdata struct usb_device_id device_table[] = { 1512static const struct usb_device_id device_table[] = {
1513 {USB_DEVICE(0x0130, 0x0130), .driver_info = HamaUSBSightcam}, 1513 {USB_DEVICE(0x0130, 0x0130), .driver_info = HamaUSBSightcam},
1514 {USB_DEVICE(0x041e, 0x4018), .driver_info = CreativeVista}, 1514 {USB_DEVICE(0x041e, 0x4018), .driver_info = CreativeVista},
1515 {USB_DEVICE(0x0733, 0x0110), .driver_info = ViewQuestVQ110}, 1515 {USB_DEVICE(0x0733, 0x0110), .driver_info = ViewQuestVQ110},
diff --git a/drivers/media/video/gspca/spca561.c b/drivers/media/video/gspca/spca561.c
index 3a162c6d5466..e836e778dfb6 100644
--- a/drivers/media/video/gspca/spca561.c
+++ b/drivers/media/video/gspca/spca561.c
@@ -1061,7 +1061,7 @@ static const struct sd_desc *sd_desc[2] = {
1061}; 1061};
1062 1062
1063/* -- module initialisation -- */ 1063/* -- module initialisation -- */
1064static const __devinitdata struct usb_device_id device_table[] = { 1064static const struct usb_device_id device_table[] = {
1065 {USB_DEVICE(0x041e, 0x401a), .driver_info = Rev072A}, 1065 {USB_DEVICE(0x041e, 0x401a), .driver_info = Rev072A},
1066 {USB_DEVICE(0x041e, 0x403b), .driver_info = Rev012A}, 1066 {USB_DEVICE(0x041e, 0x403b), .driver_info = Rev012A},
1067 {USB_DEVICE(0x0458, 0x7004), .driver_info = Rev072A}, 1067 {USB_DEVICE(0x0458, 0x7004), .driver_info = Rev072A},
diff --git a/drivers/media/video/gspca/sq905.c b/drivers/media/video/gspca/sq905.c
index 404067745775..2e9c06175192 100644
--- a/drivers/media/video/gspca/sq905.c
+++ b/drivers/media/video/gspca/sq905.c
@@ -396,7 +396,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
396} 396}
397 397
398/* Table of supported USB devices */ 398/* Table of supported USB devices */
399static const __devinitdata struct usb_device_id device_table[] = { 399static const struct usb_device_id device_table[] = {
400 {USB_DEVICE(0x2770, 0x9120)}, 400 {USB_DEVICE(0x2770, 0x9120)},
401 {} 401 {}
402}; 402};
diff --git a/drivers/media/video/gspca/sq905c.c b/drivers/media/video/gspca/sq905c.c
index 8ba199543856..457563b7a71b 100644
--- a/drivers/media/video/gspca/sq905c.c
+++ b/drivers/media/video/gspca/sq905c.c
@@ -298,7 +298,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
298} 298}
299 299
300/* Table of supported USB devices */ 300/* Table of supported USB devices */
301static const __devinitdata struct usb_device_id device_table[] = { 301static const struct usb_device_id device_table[] = {
302 {USB_DEVICE(0x2770, 0x905c)}, 302 {USB_DEVICE(0x2770, 0x905c)},
303 {USB_DEVICE(0x2770, 0x9050)}, 303 {USB_DEVICE(0x2770, 0x9050)},
304 {USB_DEVICE(0x2770, 0x9051)}, 304 {USB_DEVICE(0x2770, 0x9051)},
diff --git a/drivers/media/video/gspca/sq930x.c b/drivers/media/video/gspca/sq930x.c
index a4a98811b9e3..8215d5dcd456 100644
--- a/drivers/media/video/gspca/sq930x.c
+++ b/drivers/media/video/gspca/sq930x.c
@@ -1163,7 +1163,7 @@ static const struct sd_desc sd_desc = {
1163#define ST(sensor, type) \ 1163#define ST(sensor, type) \
1164 .driver_info = (SENSOR_ ## sensor << 8) \ 1164 .driver_info = (SENSOR_ ## sensor << 8) \
1165 | (type) 1165 | (type)
1166static const __devinitdata struct usb_device_id device_table[] = { 1166static const struct usb_device_id device_table[] = {
1167 {USB_DEVICE(0x041e, 0x4038), ST(MI0360, 0)}, 1167 {USB_DEVICE(0x041e, 0x4038), ST(MI0360, 0)},
1168 {USB_DEVICE(0x041e, 0x403c), ST(LZ24BP, 0)}, 1168 {USB_DEVICE(0x041e, 0x403c), ST(LZ24BP, 0)},
1169 {USB_DEVICE(0x041e, 0x403d), ST(LZ24BP, 0)}, 1169 {USB_DEVICE(0x041e, 0x403d), ST(LZ24BP, 0)},
diff --git a/drivers/media/video/gspca/stk014.c b/drivers/media/video/gspca/stk014.c
index 11a192b95ed4..87be52b5e1e3 100644
--- a/drivers/media/video/gspca/stk014.c
+++ b/drivers/media/video/gspca/stk014.c
@@ -495,7 +495,7 @@ static const struct sd_desc sd_desc = {
495}; 495};
496 496
497/* -- module initialisation -- */ 497/* -- module initialisation -- */
498static const __devinitdata struct usb_device_id device_table[] = { 498static const struct usb_device_id device_table[] = {
499 {USB_DEVICE(0x05e1, 0x0893)}, 499 {USB_DEVICE(0x05e1, 0x0893)},
500 {} 500 {}
501}; 501};
diff --git a/drivers/media/video/gspca/stv0680.c b/drivers/media/video/gspca/stv0680.c
index b199ad4666bd..e2ef41cf72d7 100644
--- a/drivers/media/video/gspca/stv0680.c
+++ b/drivers/media/video/gspca/stv0680.c
@@ -327,7 +327,7 @@ static const struct sd_desc sd_desc = {
327}; 327};
328 328
329/* -- module initialisation -- */ 329/* -- module initialisation -- */
330static const __devinitdata struct usb_device_id device_table[] = { 330static const struct usb_device_id device_table[] = {
331 {USB_DEVICE(0x0553, 0x0202)}, 331 {USB_DEVICE(0x0553, 0x0202)},
332 {USB_DEVICE(0x041e, 0x4007)}, 332 {USB_DEVICE(0x041e, 0x4007)},
333 {} 333 {}
diff --git a/drivers/media/video/gspca/stv06xx/stv06xx.c b/drivers/media/video/gspca/stv06xx/stv06xx.c
index 28ea4175b80e..7e0661429293 100644
--- a/drivers/media/video/gspca/stv06xx/stv06xx.c
+++ b/drivers/media/video/gspca/stv06xx/stv06xx.c
@@ -564,7 +564,7 @@ static int stv06xx_config(struct gspca_dev *gspca_dev,
564 564
565 565
566/* -- module initialisation -- */ 566/* -- module initialisation -- */
567static const __devinitdata struct usb_device_id device_table[] = { 567static const struct usb_device_id device_table[] = {
568 /* QuickCam Express */ 568 /* QuickCam Express */
569 {USB_DEVICE(0x046d, 0x0840), .driver_info = BRIDGE_STV600 }, 569 {USB_DEVICE(0x046d, 0x0840), .driver_info = BRIDGE_STV600 },
570 /* LEGO cam / QuickCam Web */ 570 /* LEGO cam / QuickCam Web */
diff --git a/drivers/media/video/gspca/sunplus.c b/drivers/media/video/gspca/sunplus.c
index a9cbcd6011d9..543542af2720 100644
--- a/drivers/media/video/gspca/sunplus.c
+++ b/drivers/media/video/gspca/sunplus.c
@@ -1162,7 +1162,7 @@ static const struct sd_desc sd_desc = {
1162#define BS(bridge, subtype) \ 1162#define BS(bridge, subtype) \
1163 .driver_info = (BRIDGE_ ## bridge << 8) \ 1163 .driver_info = (BRIDGE_ ## bridge << 8) \
1164 | (subtype) 1164 | (subtype)
1165static const __devinitdata struct usb_device_id device_table[] = { 1165static const struct usb_device_id device_table[] = {
1166 {USB_DEVICE(0x041e, 0x400b), BS(SPCA504C, 0)}, 1166 {USB_DEVICE(0x041e, 0x400b), BS(SPCA504C, 0)},
1167 {USB_DEVICE(0x041e, 0x4012), BS(SPCA504C, 0)}, 1167 {USB_DEVICE(0x041e, 0x4012), BS(SPCA504C, 0)},
1168 {USB_DEVICE(0x041e, 0x4013), BS(SPCA504C, 0)}, 1168 {USB_DEVICE(0x041e, 0x4013), BS(SPCA504C, 0)},
diff --git a/drivers/media/video/gspca/t613.c b/drivers/media/video/gspca/t613.c
index 8f0c33116e0d..a3eccd815766 100644
--- a/drivers/media/video/gspca/t613.c
+++ b/drivers/media/video/gspca/t613.c
@@ -1416,7 +1416,7 @@ static const struct sd_desc sd_desc = {
1416}; 1416};
1417 1417
1418/* -- module initialisation -- */ 1418/* -- module initialisation -- */
1419static const __devinitdata struct usb_device_id device_table[] = { 1419static const struct usb_device_id device_table[] = {
1420 {USB_DEVICE(0x17a1, 0x0128)}, 1420 {USB_DEVICE(0x17a1, 0x0128)},
1421 {} 1421 {}
1422}; 1422};
diff --git a/drivers/media/video/gspca/tv8532.c b/drivers/media/video/gspca/tv8532.c
index 38c22f0a4263..933ef2ca658c 100644
--- a/drivers/media/video/gspca/tv8532.c
+++ b/drivers/media/video/gspca/tv8532.c
@@ -388,7 +388,7 @@ static const struct sd_desc sd_desc = {
388}; 388};
389 389
390/* -- module initialisation -- */ 390/* -- module initialisation -- */
391static const __devinitdata struct usb_device_id device_table[] = { 391static const struct usb_device_id device_table[] = {
392 {USB_DEVICE(0x046d, 0x0920)}, 392 {USB_DEVICE(0x046d, 0x0920)},
393 {USB_DEVICE(0x046d, 0x0921)}, 393 {USB_DEVICE(0x046d, 0x0921)},
394 {USB_DEVICE(0x0545, 0x808b)}, 394 {USB_DEVICE(0x0545, 0x808b)},
diff --git a/drivers/media/video/gspca/vc032x.c b/drivers/media/video/gspca/vc032x.c
index 9b2ae1b6cc75..6caed734a06a 100644
--- a/drivers/media/video/gspca/vc032x.c
+++ b/drivers/media/video/gspca/vc032x.c
@@ -4192,7 +4192,7 @@ static const struct sd_desc sd_desc = {
4192#define BF(bridge, flags) \ 4192#define BF(bridge, flags) \
4193 .driver_info = (BRIDGE_ ## bridge << 8) \ 4193 .driver_info = (BRIDGE_ ## bridge << 8) \
4194 | (flags) 4194 | (flags)
4195static const __devinitdata struct usb_device_id device_table[] = { 4195static const struct usb_device_id device_table[] = {
4196 {USB_DEVICE(0x041e, 0x405b), BF(VC0323, FL_VFLIP)}, 4196 {USB_DEVICE(0x041e, 0x405b), BF(VC0323, FL_VFLIP)},
4197 {USB_DEVICE(0x046d, 0x0892), BF(VC0321, 0)}, 4197 {USB_DEVICE(0x046d, 0x0892), BF(VC0321, 0)},
4198 {USB_DEVICE(0x046d, 0x0896), BF(VC0321, 0)}, 4198 {USB_DEVICE(0x046d, 0x0896), BF(VC0321, 0)},
diff --git a/drivers/media/video/gspca/xirlink_cit.c b/drivers/media/video/gspca/xirlink_cit.c
index 5b5039a02031..c089a0f6f1d0 100644
--- a/drivers/media/video/gspca/xirlink_cit.c
+++ b/drivers/media/video/gspca/xirlink_cit.c
@@ -3270,7 +3270,7 @@ static const struct sd_desc sd_desc_isoc_nego = {
3270}; 3270};
3271 3271
3272/* -- module initialisation -- */ 3272/* -- module initialisation -- */
3273static const __devinitdata struct usb_device_id device_table[] = { 3273static const struct usb_device_id device_table[] = {
3274 { USB_DEVICE_VER(0x0545, 0x8080, 0x0001, 0x0001), .driver_info = CIT_MODEL0 }, 3274 { USB_DEVICE_VER(0x0545, 0x8080, 0x0001, 0x0001), .driver_info = CIT_MODEL0 },
3275 { USB_DEVICE_VER(0x0545, 0x8080, 0x0002, 0x0002), .driver_info = CIT_MODEL1 }, 3275 { USB_DEVICE_VER(0x0545, 0x8080, 0x0002, 0x0002), .driver_info = CIT_MODEL1 },
3276 { USB_DEVICE_VER(0x0545, 0x8080, 0x030a, 0x030a), .driver_info = CIT_MODEL2 }, 3276 { USB_DEVICE_VER(0x0545, 0x8080, 0x030a, 0x030a), .driver_info = CIT_MODEL2 },
diff --git a/drivers/media/video/gspca/zc3xx.c b/drivers/media/video/gspca/zc3xx.c
index 14b85d483163..865216e9362c 100644
--- a/drivers/media/video/gspca/zc3xx.c
+++ b/drivers/media/video/gspca/zc3xx.c
@@ -6909,7 +6909,7 @@ static const struct sd_desc sd_desc = {
6909#endif 6909#endif
6910}; 6910};
6911 6911
6912static const __devinitdata struct usb_device_id device_table[] = { 6912static const struct usb_device_id device_table[] = {
6913 {USB_DEVICE(0x041e, 0x041e)}, 6913 {USB_DEVICE(0x041e, 0x041e)},
6914 {USB_DEVICE(0x041e, 0x4017)}, 6914 {USB_DEVICE(0x041e, 0x4017)},
6915 {USB_DEVICE(0x041e, 0x401c), .driver_info = SENSOR_PAS106}, 6915 {USB_DEVICE(0x041e, 0x401c), .driver_info = SENSOR_PAS106},
diff --git a/drivers/media/video/hdpvr/Makefile b/drivers/media/video/hdpvr/Makefile
index e0230fcb2e36..3baa9f613ca3 100644
--- a/drivers/media/video/hdpvr/Makefile
+++ b/drivers/media/video/hdpvr/Makefile
@@ -1,6 +1,4 @@
1hdpvr-objs := hdpvr-control.o hdpvr-core.o hdpvr-video.o 1hdpvr-objs := hdpvr-control.o hdpvr-core.o hdpvr-video.o hdpvr-i2c.o
2
3hdpvr-$(CONFIG_I2C) += hdpvr-i2c.o
4 2
5obj-$(CONFIG_VIDEO_HDPVR) += hdpvr.o 3obj-$(CONFIG_VIDEO_HDPVR) += hdpvr.o
6 4
diff --git a/drivers/media/video/hdpvr/hdpvr-core.c b/drivers/media/video/hdpvr/hdpvr-core.c
index f7d1ee55185a..a6572e5ae369 100644
--- a/drivers/media/video/hdpvr/hdpvr-core.c
+++ b/drivers/media/video/hdpvr/hdpvr-core.c
@@ -378,19 +378,17 @@ static int hdpvr_probe(struct usb_interface *interface,
378 goto error; 378 goto error;
379 } 379 }
380 380
381#ifdef CONFIG_I2C 381#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
382 /* until i2c is working properly */ 382 retval = hdpvr_register_i2c_adapter(dev);
383 retval = 0; /* hdpvr_register_i2c_adapter(dev); */
384 if (retval < 0) { 383 if (retval < 0) {
385 v4l2_err(&dev->v4l2_dev, "registering i2c adapter failed\n"); 384 v4l2_err(&dev->v4l2_dev, "registering i2c adapter failed\n");
386 goto error; 385 goto error;
387 } 386 }
388 387
389 /* until i2c is working properly */ 388 retval = hdpvr_register_i2c_ir(dev);
390 retval = 0; /* hdpvr_register_i2c_ir(dev); */
391 if (retval < 0) 389 if (retval < 0)
392 v4l2_err(&dev->v4l2_dev, "registering i2c IR devices failed\n"); 390 v4l2_err(&dev->v4l2_dev, "registering i2c IR devices failed\n");
393#endif /* CONFIG_I2C */ 391#endif
394 392
395 /* let the user know what node this device is now attached to */ 393 /* let the user know what node this device is now attached to */
396 v4l2_info(&dev->v4l2_dev, "device now attached to %s\n", 394 v4l2_info(&dev->v4l2_dev, "device now attached to %s\n",
diff --git a/drivers/media/video/hdpvr/hdpvr-i2c.c b/drivers/media/video/hdpvr/hdpvr-i2c.c
index 24966aa02a70..89b71faeaac2 100644
--- a/drivers/media/video/hdpvr/hdpvr-i2c.c
+++ b/drivers/media/video/hdpvr/hdpvr-i2c.c
@@ -13,6 +13,8 @@
13 * 13 *
14 */ 14 */
15 15
16#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
17
16#include <linux/i2c.h> 18#include <linux/i2c.h>
17#include <linux/slab.h> 19#include <linux/slab.h>
18 20
@@ -28,106 +30,78 @@
28#define Z8F0811_IR_TX_I2C_ADDR 0x70 30#define Z8F0811_IR_TX_I2C_ADDR 0x70
29#define Z8F0811_IR_RX_I2C_ADDR 0x71 31#define Z8F0811_IR_RX_I2C_ADDR 0x71
30 32
31static const u8 ir_i2c_addrs[] = {
32 Z8F0811_IR_TX_I2C_ADDR,
33 Z8F0811_IR_RX_I2C_ADDR,
34};
35 33
36static const char * const ir_devicenames[] = { 34static struct i2c_board_info hdpvr_i2c_board_info = {
37 "ir_tx_z8f0811_hdpvr", 35 I2C_BOARD_INFO("ir_tx_z8f0811_hdpvr", Z8F0811_IR_TX_I2C_ADDR),
38 "ir_rx_z8f0811_hdpvr", 36 I2C_BOARD_INFO("ir_rx_z8f0811_hdpvr", Z8F0811_IR_RX_I2C_ADDR),
39}; 37};
40 38
41static int hdpvr_new_i2c_ir(struct hdpvr_device *dev, struct i2c_adapter *adap, 39int hdpvr_register_i2c_ir(struct hdpvr_device *dev)
42 const char *type, u8 addr)
43{ 40{
44 struct i2c_board_info info; 41 struct i2c_client *c;
45 struct IR_i2c_init_data *init_data = &dev->ir_i2c_init_data; 42 struct IR_i2c_init_data *init_data = &dev->ir_i2c_init_data;
46 unsigned short addr_list[2] = { addr, I2C_CLIENT_END };
47
48 memset(&info, 0, sizeof(struct i2c_board_info));
49 strlcpy(info.type, type, I2C_NAME_SIZE);
50 43
51 /* Our default information for ir-kbd-i2c.c to use */ 44 /* Our default information for ir-kbd-i2c.c to use */
52 switch (addr) { 45 init_data->ir_codes = RC_MAP_HAUPPAUGE_NEW;
53 case Z8F0811_IR_RX_I2C_ADDR: 46 init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR;
54 init_data->ir_codes = RC_MAP_HAUPPAUGE_NEW; 47 init_data->type = RC_TYPE_RC5;
55 init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; 48 init_data->name = "HD PVR";
56 init_data->type = RC_TYPE_RC5; 49 hdpvr_i2c_board_info.platform_data = init_data;
57 init_data->name = "HD PVR";
58 info.platform_data = init_data;
59 break;
60 }
61 50
62 return i2c_new_probed_device(adap, &info, addr_list, NULL) == NULL ? 51 c = i2c_new_device(&dev->i2c_adapter, &hdpvr_i2c_board_info);
63 -1 : 0;
64}
65 52
66int hdpvr_register_i2c_ir(struct hdpvr_device *dev) 53 return (c == NULL) ? -ENODEV : 0;
67{
68 int i;
69 int ret = 0;
70
71 for (i = 0; i < ARRAY_SIZE(ir_i2c_addrs); i++)
72 ret += hdpvr_new_i2c_ir(dev, dev->i2c_adapter,
73 ir_devicenames[i], ir_i2c_addrs[i]);
74
75 return ret;
76} 54}
77 55
78static int hdpvr_i2c_read(struct hdpvr_device *dev, unsigned char addr, 56static int hdpvr_i2c_read(struct hdpvr_device *dev, int bus,
79 char *data, int len) 57 unsigned char addr, char *data, int len)
80{ 58{
81 int ret; 59 int ret;
82 char *buf = kmalloc(len, GFP_KERNEL); 60
83 if (!buf) 61 if (len > sizeof(dev->i2c_buf))
84 return -ENOMEM; 62 return -EINVAL;
85 63
86 ret = usb_control_msg(dev->udev, 64 ret = usb_control_msg(dev->udev,
87 usb_rcvctrlpipe(dev->udev, 0), 65 usb_rcvctrlpipe(dev->udev, 0),
88 REQTYPE_I2C_READ, CTRL_READ_REQUEST, 66 REQTYPE_I2C_READ, CTRL_READ_REQUEST,
89 0x100|addr, 0, buf, len, 1000); 67 (bus << 8) | addr, 0, &dev->i2c_buf, len, 1000);
90 68
91 if (ret == len) { 69 if (ret == len) {
92 memcpy(data, buf, len); 70 memcpy(data, &dev->i2c_buf, len);
93 ret = 0; 71 ret = 0;
94 } else if (ret >= 0) 72 } else if (ret >= 0)
95 ret = -EIO; 73 ret = -EIO;
96 74
97 kfree(buf);
98
99 return ret; 75 return ret;
100} 76}
101 77
102static int hdpvr_i2c_write(struct hdpvr_device *dev, unsigned char addr, 78static int hdpvr_i2c_write(struct hdpvr_device *dev, int bus,
103 char *data, int len) 79 unsigned char addr, char *data, int len)
104{ 80{
105 int ret; 81 int ret;
106 char *buf = kmalloc(len, GFP_KERNEL);
107 if (!buf)
108 return -ENOMEM;
109 82
110 memcpy(buf, data, len); 83 if (len > sizeof(dev->i2c_buf))
84 return -EINVAL;
85
86 memcpy(&dev->i2c_buf, data, len);
111 ret = usb_control_msg(dev->udev, 87 ret = usb_control_msg(dev->udev,
112 usb_sndctrlpipe(dev->udev, 0), 88 usb_sndctrlpipe(dev->udev, 0),
113 REQTYPE_I2C_WRITE, CTRL_WRITE_REQUEST, 89 REQTYPE_I2C_WRITE, CTRL_WRITE_REQUEST,
114 0x100|addr, 0, buf, len, 1000); 90 (bus << 8) | addr, 0, &dev->i2c_buf, len, 1000);
115 91
116 if (ret < 0) 92 if (ret < 0)
117 goto error; 93 return ret;
118 94
119 ret = usb_control_msg(dev->udev, 95 ret = usb_control_msg(dev->udev,
120 usb_rcvctrlpipe(dev->udev, 0), 96 usb_rcvctrlpipe(dev->udev, 0),
121 REQTYPE_I2C_WRITE_STATT, CTRL_READ_REQUEST, 97 REQTYPE_I2C_WRITE_STATT, CTRL_READ_REQUEST,
122 0, 0, buf, 2, 1000); 98 0, 0, &dev->i2c_buf, 2, 1000);
123 99
124 if (ret == 2) 100 if ((ret == 2) && (dev->i2c_buf[1] == (len - 1)))
125 ret = 0; 101 ret = 0;
126 else if (ret >= 0) 102 else if (ret >= 0)
127 ret = -EIO; 103 ret = -EIO;
128 104
129error:
130 kfree(buf);
131 return ret; 105 return ret;
132} 106}
133 107
@@ -146,10 +120,10 @@ static int hdpvr_transfer(struct i2c_adapter *i2c_adapter, struct i2c_msg *msgs,
146 addr = msgs[i].addr << 1; 120 addr = msgs[i].addr << 1;
147 121
148 if (msgs[i].flags & I2C_M_RD) 122 if (msgs[i].flags & I2C_M_RD)
149 retval = hdpvr_i2c_read(dev, addr, msgs[i].buf, 123 retval = hdpvr_i2c_read(dev, 1, addr, msgs[i].buf,
150 msgs[i].len); 124 msgs[i].len);
151 else 125 else
152 retval = hdpvr_i2c_write(dev, addr, msgs[i].buf, 126 retval = hdpvr_i2c_write(dev, 1, addr, msgs[i].buf,
153 msgs[i].len); 127 msgs[i].len);
154 } 128 }
155 129
@@ -168,30 +142,47 @@ static struct i2c_algorithm hdpvr_algo = {
168 .functionality = hdpvr_functionality, 142 .functionality = hdpvr_functionality,
169}; 143};
170 144
145static struct i2c_adapter hdpvr_i2c_adapter_template = {
146 .name = "Hauppage HD PVR I2C",
147 .owner = THIS_MODULE,
148 .algo = &hdpvr_algo,
149};
150
151static int hdpvr_activate_ir(struct hdpvr_device *dev)
152{
153 char buffer[8];
154
155 mutex_lock(&dev->i2c_mutex);
156
157 hdpvr_i2c_read(dev, 0, 0x54, buffer, 1);
158
159 buffer[0] = 0;
160 buffer[1] = 0x8;
161 hdpvr_i2c_write(dev, 1, 0x54, buffer, 2);
162
163 buffer[1] = 0x18;
164 hdpvr_i2c_write(dev, 1, 0x54, buffer, 2);
165
166 mutex_unlock(&dev->i2c_mutex);
167
168 return 0;
169}
170
171int hdpvr_register_i2c_adapter(struct hdpvr_device *dev) 171int hdpvr_register_i2c_adapter(struct hdpvr_device *dev)
172{ 172{
173 struct i2c_adapter *i2c_adap;
174 int retval = -ENOMEM; 173 int retval = -ENOMEM;
175 174
176 i2c_adap = kzalloc(sizeof(struct i2c_adapter), GFP_KERNEL); 175 hdpvr_activate_ir(dev);
177 if (i2c_adap == NULL)
178 goto error;
179
180 strlcpy(i2c_adap->name, "Hauppauge HD PVR I2C",
181 sizeof(i2c_adap->name));
182 i2c_adap->algo = &hdpvr_algo;
183 i2c_adap->owner = THIS_MODULE;
184 i2c_adap->dev.parent = &dev->udev->dev;
185 176
186 i2c_set_adapdata(i2c_adap, dev); 177 memcpy(&dev->i2c_adapter, &hdpvr_i2c_adapter_template,
178 sizeof(struct i2c_adapter));
179 dev->i2c_adapter.dev.parent = &dev->udev->dev;
187 180
188 retval = i2c_add_adapter(i2c_adap); 181 i2c_set_adapdata(&dev->i2c_adapter, dev);
189 182
190 if (!retval) 183 retval = i2c_add_adapter(&dev->i2c_adapter);
191 dev->i2c_adapter = i2c_adap;
192 else
193 kfree(i2c_adap);
194 184
195error:
196 return retval; 185 return retval;
197} 186}
187
188#endif
diff --git a/drivers/media/video/hdpvr/hdpvr-video.c b/drivers/media/video/hdpvr/hdpvr-video.c
index d38fe1043e47..514aea76eaa5 100644
--- a/drivers/media/video/hdpvr/hdpvr-video.c
+++ b/drivers/media/video/hdpvr/hdpvr-video.c
@@ -1220,12 +1220,9 @@ static void hdpvr_device_release(struct video_device *vdev)
1220 v4l2_device_unregister(&dev->v4l2_dev); 1220 v4l2_device_unregister(&dev->v4l2_dev);
1221 1221
1222 /* deregister I2C adapter */ 1222 /* deregister I2C adapter */
1223#ifdef CONFIG_I2C 1223#if defined(CONFIG_I2C) || (CONFIG_I2C_MODULE)
1224 mutex_lock(&dev->i2c_mutex); 1224 mutex_lock(&dev->i2c_mutex);
1225 if (dev->i2c_adapter) 1225 i2c_del_adapter(&dev->i2c_adapter);
1226 i2c_del_adapter(dev->i2c_adapter);
1227 kfree(dev->i2c_adapter);
1228 dev->i2c_adapter = NULL;
1229 mutex_unlock(&dev->i2c_mutex); 1226 mutex_unlock(&dev->i2c_mutex);
1230#endif /* CONFIG_I2C */ 1227#endif /* CONFIG_I2C */
1231 1228
diff --git a/drivers/media/video/hdpvr/hdpvr.h b/drivers/media/video/hdpvr/hdpvr.h
index 37f1e4c7675d..ee74e3be9a6a 100644
--- a/drivers/media/video/hdpvr/hdpvr.h
+++ b/drivers/media/video/hdpvr/hdpvr.h
@@ -25,6 +25,7 @@
25 KERNEL_VERSION(HDPVR_MAJOR_VERSION, HDPVR_MINOR_VERSION, HDPVR_RELEASE) 25 KERNEL_VERSION(HDPVR_MAJOR_VERSION, HDPVR_MINOR_VERSION, HDPVR_RELEASE)
26 26
27#define HDPVR_MAX 8 27#define HDPVR_MAX 8
28#define HDPVR_I2C_MAX_SIZE 128
28 29
29/* Define these values to match your devices */ 30/* Define these values to match your devices */
30#define HD_PVR_VENDOR_ID 0x2040 31#define HD_PVR_VENDOR_ID 0x2040
@@ -106,9 +107,11 @@ struct hdpvr_device {
106 struct work_struct worker; 107 struct work_struct worker;
107 108
108 /* I2C adapter */ 109 /* I2C adapter */
109 struct i2c_adapter *i2c_adapter; 110 struct i2c_adapter i2c_adapter;
110 /* I2C lock */ 111 /* I2C lock */
111 struct mutex i2c_mutex; 112 struct mutex i2c_mutex;
113 /* I2C message buffer space */
114 char i2c_buf[HDPVR_I2C_MAX_SIZE];
112 115
113 /* For passing data to ir-kbd-i2c */ 116 /* For passing data to ir-kbd-i2c */
114 struct IR_i2c_init_data ir_i2c_init_data; 117 struct IR_i2c_init_data ir_i2c_init_data;
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c
index c87b6bc45555..d2b20ad383a3 100644
--- a/drivers/media/video/ir-kbd-i2c.c
+++ b/drivers/media/video/ir-kbd-i2c.c
@@ -244,15 +244,17 @@ static void ir_key_poll(struct IR_i2c *ir)
244 static u32 ir_key, ir_raw; 244 static u32 ir_key, ir_raw;
245 int rc; 245 int rc;
246 246
247 dprintk(2,"ir_poll_key\n"); 247 dprintk(3, "%s\n", __func__);
248 rc = ir->get_key(ir, &ir_key, &ir_raw); 248 rc = ir->get_key(ir, &ir_key, &ir_raw);
249 if (rc < 0) { 249 if (rc < 0) {
250 dprintk(2,"error\n"); 250 dprintk(2,"error\n");
251 return; 251 return;
252 } 252 }
253 253
254 if (rc) 254 if (rc) {
255 dprintk(1, "%s: keycode = 0x%04x\n", __func__, ir_key);
255 rc_keydown(ir->rc, ir_key, 0); 256 rc_keydown(ir->rc, ir_key, 0);
257 }
256} 258}
257 259
258static void ir_work(struct work_struct *work) 260static void ir_work(struct work_struct *work)
@@ -321,6 +323,12 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
321 rc_type = RC_TYPE_OTHER; 323 rc_type = RC_TYPE_OTHER;
322 ir_codes = RC_MAP_AVERMEDIA_CARDBUS; 324 ir_codes = RC_MAP_AVERMEDIA_CARDBUS;
323 break; 325 break;
326 case 0x71:
327 name = "Hauppauge/Zilog Z8";
328 ir->get_key = get_key_haup_xvr;
329 rc_type = RC_TYPE_RC5;
330 ir_codes = hauppauge ? RC_MAP_HAUPPAUGE_NEW : RC_MAP_RC5_TV;
331 break;
324 } 332 }
325 333
326 /* Let the caller override settings */ 334 /* Let the caller override settings */
diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c
index e103b8fc7452..9fb86a081c0f 100644
--- a/drivers/media/video/ivtv/ivtv-i2c.c
+++ b/drivers/media/video/ivtv/ivtv-i2c.c
@@ -300,10 +300,15 @@ int ivtv_i2c_register(struct ivtv *itv, unsigned idx)
300 adap, type, 0, I2C_ADDRS(hw_addrs[idx])); 300 adap, type, 0, I2C_ADDRS(hw_addrs[idx]));
301 } else if (hw == IVTV_HW_CX25840) { 301 } else if (hw == IVTV_HW_CX25840) {
302 struct cx25840_platform_data pdata; 302 struct cx25840_platform_data pdata;
303 struct i2c_board_info cx25840_info = {
304 .type = "cx25840",
305 .addr = hw_addrs[idx],
306 .platform_data = &pdata,
307 };
303 308
304 pdata.pvr150_workaround = itv->pvr150_workaround; 309 pdata.pvr150_workaround = itv->pvr150_workaround;
305 sd = v4l2_i2c_new_subdev_cfg(&itv->v4l2_dev, 310 sd = v4l2_i2c_new_subdev_board(&itv->v4l2_dev, adap,
306 adap, type, 0, &pdata, hw_addrs[idx], NULL); 311 &cx25840_info, NULL);
307 } else { 312 } else {
308 sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, 313 sd = v4l2_i2c_new_subdev(&itv->v4l2_dev,
309 adap, type, hw_addrs[idx], NULL); 314 adap, type, hw_addrs[idx], NULL);
diff --git a/drivers/media/video/mt9v011.c b/drivers/media/video/mt9v011.c
index 209ff97261a9..4904d25f689f 100644
--- a/drivers/media/video/mt9v011.c
+++ b/drivers/media/video/mt9v011.c
@@ -12,17 +12,41 @@
12#include <asm/div64.h> 12#include <asm/div64.h>
13#include <media/v4l2-device.h> 13#include <media/v4l2-device.h>
14#include <media/v4l2-chip-ident.h> 14#include <media/v4l2-chip-ident.h>
15#include "mt9v011.h" 15#include <media/mt9v011.h>
16 16
17MODULE_DESCRIPTION("Micron mt9v011 sensor driver"); 17MODULE_DESCRIPTION("Micron mt9v011 sensor driver");
18MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); 18MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
19MODULE_LICENSE("GPL"); 19MODULE_LICENSE("GPL");
20 20
21
22static int debug; 21static int debug;
23module_param(debug, int, 0); 22module_param(debug, int, 0);
24MODULE_PARM_DESC(debug, "Debug level (0-2)"); 23MODULE_PARM_DESC(debug, "Debug level (0-2)");
25 24
25#define R00_MT9V011_CHIP_VERSION 0x00
26#define R01_MT9V011_ROWSTART 0x01
27#define R02_MT9V011_COLSTART 0x02
28#define R03_MT9V011_HEIGHT 0x03
29#define R04_MT9V011_WIDTH 0x04
30#define R05_MT9V011_HBLANK 0x05
31#define R06_MT9V011_VBLANK 0x06
32#define R07_MT9V011_OUT_CTRL 0x07
33#define R09_MT9V011_SHUTTER_WIDTH 0x09
34#define R0A_MT9V011_CLK_SPEED 0x0a
35#define R0B_MT9V011_RESTART 0x0b
36#define R0C_MT9V011_SHUTTER_DELAY 0x0c
37#define R0D_MT9V011_RESET 0x0d
38#define R1E_MT9V011_DIGITAL_ZOOM 0x1e
39#define R20_MT9V011_READ_MODE 0x20
40#define R2B_MT9V011_GREEN_1_GAIN 0x2b
41#define R2C_MT9V011_BLUE_GAIN 0x2c
42#define R2D_MT9V011_RED_GAIN 0x2d
43#define R2E_MT9V011_GREEN_2_GAIN 0x2e
44#define R35_MT9V011_GLOBAL_GAIN 0x35
45#define RF1_MT9V011_CHIP_ENABLE 0xf1
46
47#define MT9V011_VERSION 0x8232
48#define MT9V011_REV_B_VERSION 0x8243
49
26/* supported controls */ 50/* supported controls */
27static struct v4l2_queryctrl mt9v011_qctrl[] = { 51static struct v4l2_queryctrl mt9v011_qctrl[] = {
28 { 52 {
@@ -469,23 +493,6 @@ static int mt9v011_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt
469 return 0; 493 return 0;
470} 494}
471 495
472static int mt9v011_s_config(struct v4l2_subdev *sd, int dumb, void *data)
473{
474 struct mt9v011 *core = to_mt9v011(sd);
475 unsigned *xtal = data;
476
477 v4l2_dbg(1, debug, sd, "s_config called\n");
478
479 if (xtal) {
480 core->xtal = *xtal;
481 v4l2_dbg(1, debug, sd, "xtal set to %d.%03d MHz\n",
482 *xtal / 1000000, (*xtal / 1000) % 1000);
483 }
484
485 return 0;
486}
487
488
489#ifdef CONFIG_VIDEO_ADV_DEBUG 496#ifdef CONFIG_VIDEO_ADV_DEBUG
490static int mt9v011_g_register(struct v4l2_subdev *sd, 497static int mt9v011_g_register(struct v4l2_subdev *sd,
491 struct v4l2_dbg_register *reg) 498 struct v4l2_dbg_register *reg)
@@ -536,7 +543,6 @@ static const struct v4l2_subdev_core_ops mt9v011_core_ops = {
536 .g_ctrl = mt9v011_g_ctrl, 543 .g_ctrl = mt9v011_g_ctrl,
537 .s_ctrl = mt9v011_s_ctrl, 544 .s_ctrl = mt9v011_s_ctrl,
538 .reset = mt9v011_reset, 545 .reset = mt9v011_reset,
539 .s_config = mt9v011_s_config,
540 .g_chip_ident = mt9v011_g_chip_ident, 546 .g_chip_ident = mt9v011_g_chip_ident,
541#ifdef CONFIG_VIDEO_ADV_DEBUG 547#ifdef CONFIG_VIDEO_ADV_DEBUG
542 .g_register = mt9v011_g_register, 548 .g_register = mt9v011_g_register,
@@ -596,6 +602,14 @@ static int mt9v011_probe(struct i2c_client *c,
596 core->height = 480; 602 core->height = 480;
597 core->xtal = 27000000; /* Hz */ 603 core->xtal = 27000000; /* Hz */
598 604
605 if (c->dev.platform_data) {
606 struct mt9v011_platform_data *pdata = c->dev.platform_data;
607
608 core->xtal = pdata->xtal;
609 v4l2_dbg(1, debug, sd, "xtal set to %d.%03d MHz\n",
610 core->xtal / 1000000, (core->xtal / 1000) % 1000);
611 }
612
599 v4l_info(c, "chip found @ 0x%02x (%s - chip version 0x%04x)\n", 613 v4l_info(c, "chip found @ 0x%02x (%s - chip version 0x%04x)\n",
600 c->addr << 1, c->adapter->name, version); 614 c->addr << 1, c->adapter->name, version);
601 615
diff --git a/drivers/media/video/mt9v011.h b/drivers/media/video/mt9v011.h
deleted file mode 100644
index 3350fd6083c3..000000000000
--- a/drivers/media/video/mt9v011.h
+++ /dev/null
@@ -1,36 +0,0 @@
1/*
2 * mt9v011 -Micron 1/4-Inch VGA Digital Image Sensor
3 *
4 * Copyright (c) 2009 Mauro Carvalho Chehab (mchehab@redhat.com)
5 * This code is placed under the terms of the GNU General Public License v2
6 */
7
8#ifndef MT9V011_H_
9#define MT9V011_H_
10
11#define R00_MT9V011_CHIP_VERSION 0x00
12#define R01_MT9V011_ROWSTART 0x01
13#define R02_MT9V011_COLSTART 0x02
14#define R03_MT9V011_HEIGHT 0x03
15#define R04_MT9V011_WIDTH 0x04
16#define R05_MT9V011_HBLANK 0x05
17#define R06_MT9V011_VBLANK 0x06
18#define R07_MT9V011_OUT_CTRL 0x07
19#define R09_MT9V011_SHUTTER_WIDTH 0x09
20#define R0A_MT9V011_CLK_SPEED 0x0a
21#define R0B_MT9V011_RESTART 0x0b
22#define R0C_MT9V011_SHUTTER_DELAY 0x0c
23#define R0D_MT9V011_RESET 0x0d
24#define R1E_MT9V011_DIGITAL_ZOOM 0x1e
25#define R20_MT9V011_READ_MODE 0x20
26#define R2B_MT9V011_GREEN_1_GAIN 0x2b
27#define R2C_MT9V011_BLUE_GAIN 0x2c
28#define R2D_MT9V011_RED_GAIN 0x2d
29#define R2E_MT9V011_GREEN_2_GAIN 0x2e
30#define R35_MT9V011_GLOBAL_GAIN 0x35
31#define RF1_MT9V011_CHIP_ENABLE 0xf1
32
33#define MT9V011_VERSION 0x8232
34#define MT9V011_REV_B_VERSION 0x8243
35
36#endif
diff --git a/drivers/media/video/ov7670.c b/drivers/media/video/ov7670.c
index c881a64b41fd..d4e7c11553c3 100644
--- a/drivers/media/video/ov7670.c
+++ b/drivers/media/video/ov7670.c
@@ -1449,47 +1449,6 @@ static int ov7670_g_chip_ident(struct v4l2_subdev *sd,
1449 return v4l2_chip_ident_i2c_client(client, chip, V4L2_IDENT_OV7670, 0); 1449 return v4l2_chip_ident_i2c_client(client, chip, V4L2_IDENT_OV7670, 0);
1450} 1450}
1451 1451
1452static int ov7670_s_config(struct v4l2_subdev *sd, int dumb, void *data)
1453{
1454 struct i2c_client *client = v4l2_get_subdevdata(sd);
1455 struct ov7670_config *config = data;
1456 struct ov7670_info *info = to_state(sd);
1457 int ret;
1458
1459 info->clock_speed = 30; /* default: a guess */
1460
1461 /*
1462 * Must apply configuration before initializing device, because it
1463 * selects I/O method.
1464 */
1465 if (config) {
1466 info->min_width = config->min_width;
1467 info->min_height = config->min_height;
1468 info->use_smbus = config->use_smbus;
1469
1470 if (config->clock_speed)
1471 info->clock_speed = config->clock_speed;
1472 }
1473
1474 /* Make sure it's an ov7670 */
1475 ret = ov7670_detect(sd);
1476 if (ret) {
1477 v4l_dbg(1, debug, client,
1478 "chip found @ 0x%x (%s) is not an ov7670 chip.\n",
1479 client->addr << 1, client->adapter->name);
1480 kfree(info);
1481 return ret;
1482 }
1483 v4l_info(client, "chip found @ 0x%02x (%s)\n",
1484 client->addr << 1, client->adapter->name);
1485
1486 info->fmt = &ov7670_formats[0];
1487 info->sat = 128; /* Review this */
1488 info->clkrc = info->clock_speed / 30;
1489
1490 return 0;
1491}
1492
1493#ifdef CONFIG_VIDEO_ADV_DEBUG 1452#ifdef CONFIG_VIDEO_ADV_DEBUG
1494static int ov7670_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) 1453static int ov7670_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg)
1495{ 1454{
@@ -1528,7 +1487,6 @@ static const struct v4l2_subdev_core_ops ov7670_core_ops = {
1528 .s_ctrl = ov7670_s_ctrl, 1487 .s_ctrl = ov7670_s_ctrl,
1529 .queryctrl = ov7670_queryctrl, 1488 .queryctrl = ov7670_queryctrl,
1530 .reset = ov7670_reset, 1489 .reset = ov7670_reset,
1531 .s_config = ov7670_s_config,
1532 .init = ov7670_init, 1490 .init = ov7670_init,
1533#ifdef CONFIG_VIDEO_ADV_DEBUG 1491#ifdef CONFIG_VIDEO_ADV_DEBUG
1534 .g_register = ov7670_g_register, 1492 .g_register = ov7670_g_register,
@@ -1558,6 +1516,7 @@ static int ov7670_probe(struct i2c_client *client,
1558{ 1516{
1559 struct v4l2_subdev *sd; 1517 struct v4l2_subdev *sd;
1560 struct ov7670_info *info; 1518 struct ov7670_info *info;
1519 int ret;
1561 1520
1562 info = kzalloc(sizeof(struct ov7670_info), GFP_KERNEL); 1521 info = kzalloc(sizeof(struct ov7670_info), GFP_KERNEL);
1563 if (info == NULL) 1522 if (info == NULL)
@@ -1565,6 +1524,37 @@ static int ov7670_probe(struct i2c_client *client,
1565 sd = &info->sd; 1524 sd = &info->sd;
1566 v4l2_i2c_subdev_init(sd, client, &ov7670_ops); 1525 v4l2_i2c_subdev_init(sd, client, &ov7670_ops);
1567 1526
1527 info->clock_speed = 30; /* default: a guess */
1528 if (client->dev.platform_data) {
1529 struct ov7670_config *config = client->dev.platform_data;
1530
1531 /*
1532 * Must apply configuration before initializing device, because it
1533 * selects I/O method.
1534 */
1535 info->min_width = config->min_width;
1536 info->min_height = config->min_height;
1537 info->use_smbus = config->use_smbus;
1538
1539 if (config->clock_speed)
1540 info->clock_speed = config->clock_speed;
1541 }
1542
1543 /* Make sure it's an ov7670 */
1544 ret = ov7670_detect(sd);
1545 if (ret) {
1546 v4l_dbg(1, debug, client,
1547 "chip found @ 0x%x (%s) is not an ov7670 chip.\n",
1548 client->addr << 1, client->adapter->name);
1549 kfree(info);
1550 return ret;
1551 }
1552 v4l_info(client, "chip found @ 0x%02x (%s)\n",
1553 client->addr << 1, client->adapter->name);
1554
1555 info->fmt = &ov7670_formats[0];
1556 info->sat = 128; /* Review this */
1557 info->clkrc = info->clock_speed / 30;
1568 return 0; 1558 return 0;
1569} 1559}
1570 1560
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
index ac94a8bf883e..305e6aaa844a 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
@@ -40,6 +40,7 @@
40#include "pvrusb2-io.h" 40#include "pvrusb2-io.h"
41#include <media/v4l2-device.h> 41#include <media/v4l2-device.h>
42#include <media/cx2341x.h> 42#include <media/cx2341x.h>
43#include <media/ir-kbd-i2c.h>
43#include "pvrusb2-devattr.h" 44#include "pvrusb2-devattr.h"
44 45
45/* Legal values for PVR2_CID_HSM */ 46/* Legal values for PVR2_CID_HSM */
@@ -202,6 +203,7 @@ struct pvr2_hdw {
202 203
203 /* IR related */ 204 /* IR related */
204 unsigned int ir_scheme_active; /* IR scheme as seen from the outside */ 205 unsigned int ir_scheme_active; /* IR scheme as seen from the outside */
206 struct IR_i2c_init_data ir_init_data; /* params passed to IR modules */
205 207
206 /* Frequency table */ 208 /* Frequency table */
207 unsigned int freqTable[FREQTABLE_SIZE]; 209 unsigned int freqTable[FREQTABLE_SIZE];
diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
index 7cbe18c4ca95..ccc884948f34 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
@@ -19,6 +19,7 @@
19 */ 19 */
20 20
21#include <linux/i2c.h> 21#include <linux/i2c.h>
22#include <media/ir-kbd-i2c.h>
22#include "pvrusb2-i2c-core.h" 23#include "pvrusb2-i2c-core.h"
23#include "pvrusb2-hdw-internal.h" 24#include "pvrusb2-hdw-internal.h"
24#include "pvrusb2-debug.h" 25#include "pvrusb2-debug.h"
@@ -48,13 +49,6 @@ module_param_named(disable_autoload_ir_video, pvr2_disable_ir_video,
48MODULE_PARM_DESC(disable_autoload_ir_video, 49MODULE_PARM_DESC(disable_autoload_ir_video,
49 "1=do not try to autoload ir_video IR receiver"); 50 "1=do not try to autoload ir_video IR receiver");
50 51
51/* Mapping of IR schemes to known I2C addresses - if any */
52static const unsigned char ir_video_addresses[] = {
53 [PVR2_IR_SCHEME_ZILOG] = 0x71,
54 [PVR2_IR_SCHEME_29XXX] = 0x18,
55 [PVR2_IR_SCHEME_24XXX] = 0x18,
56};
57
58static int pvr2_i2c_write(struct pvr2_hdw *hdw, /* Context */ 52static int pvr2_i2c_write(struct pvr2_hdw *hdw, /* Context */
59 u8 i2c_addr, /* I2C address we're talking to */ 53 u8 i2c_addr, /* I2C address we're talking to */
60 u8 *data, /* Data to write */ 54 u8 *data, /* Data to write */
@@ -574,26 +568,56 @@ static void do_i2c_scan(struct pvr2_hdw *hdw)
574static void pvr2_i2c_register_ir(struct pvr2_hdw *hdw) 568static void pvr2_i2c_register_ir(struct pvr2_hdw *hdw)
575{ 569{
576 struct i2c_board_info info; 570 struct i2c_board_info info;
577 unsigned char addr = 0; 571 struct IR_i2c_init_data *init_data = &hdw->ir_init_data;
578 if (pvr2_disable_ir_video) { 572 if (pvr2_disable_ir_video) {
579 pvr2_trace(PVR2_TRACE_INFO, 573 pvr2_trace(PVR2_TRACE_INFO,
580 "Automatic binding of ir_video has been disabled."); 574 "Automatic binding of ir_video has been disabled.");
581 return; 575 return;
582 } 576 }
583 if (hdw->ir_scheme_active < ARRAY_SIZE(ir_video_addresses)) { 577 memset(&info, 0, sizeof(struct i2c_board_info));
584 addr = ir_video_addresses[hdw->ir_scheme_active]; 578 switch (hdw->ir_scheme_active) {
585 } 579 case PVR2_IR_SCHEME_24XXX: /* FX2-controlled IR */
586 if (!addr) { 580 case PVR2_IR_SCHEME_29XXX: /* Original 29xxx device */
581 init_data->ir_codes = RC_MAP_HAUPPAUGE_NEW;
582 init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP;
583 init_data->type = RC_TYPE_RC5;
584 init_data->name = hdw->hdw_desc->description;
585 init_data->polling_interval = 100; /* ms From ir-kbd-i2c */
586 /* IR Receiver */
587 info.addr = 0x18;
588 info.platform_data = init_data;
589 strlcpy(info.type, "ir_video", I2C_NAME_SIZE);
590 pvr2_trace(PVR2_TRACE_INFO, "Binding %s to i2c address 0x%02x.",
591 info.type, info.addr);
592 i2c_new_device(&hdw->i2c_adap, &info);
593 break;
594 case PVR2_IR_SCHEME_ZILOG: /* HVR-1950 style */
595 case PVR2_IR_SCHEME_24XXX_MCE: /* 24xxx MCE device */
596 init_data->ir_codes = RC_MAP_HAUPPAUGE_NEW;
597 init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR;
598 init_data->type = RC_TYPE_RC5;
599 init_data->name = hdw->hdw_desc->description;
600 init_data->polling_interval = 260; /* ms From lirc_zilog */
601 /* IR Receiver */
602 info.addr = 0x71;
603 info.platform_data = init_data;
604 strlcpy(info.type, "ir_rx_z8f0811_haup", I2C_NAME_SIZE);
605 pvr2_trace(PVR2_TRACE_INFO, "Binding %s to i2c address 0x%02x.",
606 info.type, info.addr);
607 i2c_new_device(&hdw->i2c_adap, &info);
608 /* IR Trasmitter */
609 info.addr = 0x70;
610 info.platform_data = init_data;
611 strlcpy(info.type, "ir_tx_z8f0811_haup", I2C_NAME_SIZE);
612 pvr2_trace(PVR2_TRACE_INFO, "Binding %s to i2c address 0x%02x.",
613 info.type, info.addr);
614 i2c_new_device(&hdw->i2c_adap, &info);
615 break;
616 default:
587 /* The device either doesn't support I2C-based IR or we 617 /* The device either doesn't support I2C-based IR or we
588 don't know (yet) how to operate IR on the device. */ 618 don't know (yet) how to operate IR on the device. */
589 return; 619 break;
590 } 620 }
591 pvr2_trace(PVR2_TRACE_INFO,
592 "Binding ir_video to i2c address 0x%02x.", addr);
593 memset(&info, 0, sizeof(struct i2c_board_info));
594 strlcpy(info.type, "ir_video", I2C_NAME_SIZE);
595 info.addr = addr;
596 i2c_new_device(&hdw->i2c_adap, &info);
597} 621}
598 622
599void pvr2_i2c_core_init(struct pvr2_hdw *hdw) 623void pvr2_i2c_core_init(struct pvr2_hdw *hdw)
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index e7aa588c6c5a..deb8fcf4aa49 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -5179,18 +5179,8 @@ struct saa7134_board saa7134_boards[] = {
5179 [SAA7134_BOARD_KWORLD_PCI_SBTVD_FULLSEG] = { 5179 [SAA7134_BOARD_KWORLD_PCI_SBTVD_FULLSEG] = {
5180 .name = "Kworld PCI SBTVD/ISDB-T Full-Seg Hybrid", 5180 .name = "Kworld PCI SBTVD/ISDB-T Full-Seg Hybrid",
5181 .audio_clock = 0x00187de7, 5181 .audio_clock = 0x00187de7,
5182#if 0 5182 .tuner_type = TUNER_PHILIPS_TDA8290,
5183 /*
5184 * FIXME: Analog mode doesn't work, if digital is enabled. The proper
5185 * fix is to use tda8290 driver, but Kworld seems to use an
5186 * unsupported version of tda8295.
5187 */
5188 .tuner_type = TUNER_NXP_TDA18271, /* TUNER_PHILIPS_TDA8290 */
5189 .tuner_addr = 0x60,
5190#else
5191 .tuner_type = UNSET,
5192 .tuner_addr = ADDR_UNSET, 5183 .tuner_addr = ADDR_UNSET,
5193#endif
5194 .radio_type = UNSET, 5184 .radio_type = UNSET,
5195 .radio_addr = ADDR_UNSET, 5185 .radio_addr = ADDR_UNSET,
5196 .gpiomask = 0x8e054000, 5186 .gpiomask = 0x8e054000,
@@ -6932,10 +6922,17 @@ static inline int saa7134_kworld_sbtvd_toggle_agc(struct saa7134_dev *dev,
6932 /* toggle AGC switch through GPIO 27 */ 6922 /* toggle AGC switch through GPIO 27 */
6933 switch (mode) { 6923 switch (mode) {
6934 case TDA18271_ANALOG: 6924 case TDA18271_ANALOG:
6935 saa7134_set_gpio(dev, 27, 0); 6925 saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0x4000);
6926 saa_writel(SAA7134_GPIO_GPSTATUS0 >> 2, 0x4000);
6927 msleep(20);
6936 break; 6928 break;
6937 case TDA18271_DIGITAL: 6929 case TDA18271_DIGITAL:
6938 saa7134_set_gpio(dev, 27, 1); 6930 saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0x14000);
6931 saa_writel(SAA7134_GPIO_GPSTATUS0 >> 2, 0x14000);
6932 msleep(20);
6933 saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0x54000);
6934 saa_writel(SAA7134_GPIO_GPSTATUS0 >> 2, 0x54000);
6935 msleep(30);
6939 break; 6936 break;
6940 default: 6937 default:
6941 return -EINVAL; 6938 return -EINVAL;
@@ -6993,6 +6990,7 @@ static int saa7134_tda8290_callback(struct saa7134_dev *dev,
6993int saa7134_tuner_callback(void *priv, int component, int command, int arg) 6990int saa7134_tuner_callback(void *priv, int component, int command, int arg)
6994{ 6991{
6995 struct saa7134_dev *dev = priv; 6992 struct saa7134_dev *dev = priv;
6993
6996 if (dev != NULL) { 6994 if (dev != NULL) {
6997 switch (dev->tuner_type) { 6995 switch (dev->tuner_type) {
6998 case TUNER_PHILIPS_TDA8290: 6996 case TUNER_PHILIPS_TDA8290:
@@ -7659,36 +7657,11 @@ int saa7134_board_init2(struct saa7134_dev *dev)
7659 break; 7657 break;
7660 } 7658 }
7661 case SAA7134_BOARD_KWORLD_PCI_SBTVD_FULLSEG: 7659 case SAA7134_BOARD_KWORLD_PCI_SBTVD_FULLSEG:
7662 {
7663 struct i2c_msg msg = { .addr = 0x4b, .flags = 0 };
7664 int i;
7665 static u8 buffer[][2] = {
7666 {0x30, 0x31},
7667 {0xff, 0x00},
7668 {0x41, 0x03},
7669 {0x41, 0x1a},
7670 {0xff, 0x02},
7671 {0x34, 0x00},
7672 {0x45, 0x97},
7673 {0x45, 0xc1},
7674 };
7675 saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0x4000); 7660 saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0x4000);
7676 saa_writel(SAA7134_GPIO_GPSTATUS0 >> 2, 0x4000); 7661 saa_writel(SAA7134_GPIO_GPSTATUS0 >> 2, 0x4000);
7677 7662
7678 /* 7663 saa7134_set_gpio(dev, 27, 0);
7679 * FIXME: identify what device is at addr 0x4b and what means
7680 * this initialization
7681 */
7682 for (i = 0; i < ARRAY_SIZE(buffer); i++) {
7683 msg.buf = &buffer[i][0];
7684 msg.len = ARRAY_SIZE(buffer[0]);
7685 if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1)
7686 printk(KERN_WARNING
7687 "%s: Unable to enable tuner(%i).\n",
7688 dev->name, i);
7689 }
7690 break; 7664 break;
7691 }
7692 } /* switch() */ 7665 } /* switch() */
7693 7666
7694 /* initialize tuner */ 7667 /* initialize tuner */
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index 3315a48a848b..f65cad287b83 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -237,12 +237,39 @@ static struct tda18271_std_map mb86a20s_tda18271_std_map = {
237static struct tda18271_config kworld_tda18271_config = { 237static struct tda18271_config kworld_tda18271_config = {
238 .std_map = &mb86a20s_tda18271_std_map, 238 .std_map = &mb86a20s_tda18271_std_map,
239 .gate = TDA18271_GATE_DIGITAL, 239 .gate = TDA18271_GATE_DIGITAL,
240 .config = 3, /* Use tuner callback for AGC */
241
240}; 242};
241 243
242static const struct mb86a20s_config kworld_mb86a20s_config = { 244static const struct mb86a20s_config kworld_mb86a20s_config = {
243 .demod_address = 0x10, 245 .demod_address = 0x10,
244}; 246};
245 247
248static int kworld_sbtvd_gate_ctrl(struct dvb_frontend* fe, int enable)
249{
250 struct saa7134_dev *dev = fe->dvb->priv;
251
252 unsigned char initmsg[] = {0x45, 0x97};
253 unsigned char msg_enable[] = {0x45, 0xc1};
254 unsigned char msg_disable[] = {0x45, 0x81};
255 struct i2c_msg msg = {.addr = 0x4b, .flags = 0, .buf = initmsg, .len = 2};
256
257 if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) {
258 wprintk("could not access the I2C gate\n");
259 return -EIO;
260 }
261 if (enable)
262 msg.buf = msg_enable;
263 else
264 msg.buf = msg_disable;
265 if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) {
266 wprintk("could not access the I2C gate\n");
267 return -EIO;
268 }
269 msleep(20);
270 return 0;
271}
272
246/* ================================================================== 273/* ==================================================================
247 * tda1004x based DVB-T cards, helper functions 274 * tda1004x based DVB-T cards, helper functions
248 */ 275 */
@@ -623,37 +650,6 @@ static struct tda827x_config tda827x_cfg_2_sw42 = {
623 650
624/* ------------------------------------------------------------------ */ 651/* ------------------------------------------------------------------ */
625 652
626static int __kworld_sbtvd_i2c_gate_ctrl(struct saa7134_dev *dev, int enable)
627{
628 unsigned char initmsg[] = {0x45, 0x97};
629 unsigned char msg_enable[] = {0x45, 0xc1};
630 unsigned char msg_disable[] = {0x45, 0x81};
631 struct i2c_msg msg = {.addr = 0x4b, .flags = 0, .buf = initmsg, .len = 2};
632
633 if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) {
634 wprintk("could not access the I2C gate\n");
635 return -EIO;
636 }
637 if (enable)
638 msg.buf = msg_enable;
639 else
640 msg.buf = msg_disable;
641 if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) {
642 wprintk("could not access the I2C gate\n");
643 return -EIO;
644 }
645 msleep(20);
646 return 0;
647}
648static int kworld_sbtvd_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
649{
650 struct saa7134_dev *dev = fe->dvb->priv;
651
652 return __kworld_sbtvd_i2c_gate_ctrl(dev, enable);
653}
654
655/* ------------------------------------------------------------------ */
656
657static struct tda1004x_config tda827x_lifeview_config = { 653static struct tda1004x_config tda827x_lifeview_config = {
658 .demod_address = 0x08, 654 .demod_address = 0x08,
659 .invert = 1, 655 .invert = 1,
@@ -1660,27 +1656,23 @@ static int dvb_init(struct saa7134_dev *dev)
1660 } 1656 }
1661 break; 1657 break;
1662 case SAA7134_BOARD_KWORLD_PCI_SBTVD_FULLSEG: 1658 case SAA7134_BOARD_KWORLD_PCI_SBTVD_FULLSEG:
1663 __kworld_sbtvd_i2c_gate_ctrl(dev, 0); 1659 /* Switch to digital mode */
1664 saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0x14000); 1660 saa7134_tuner_callback(dev, 0,
1665 saa_writel(SAA7134_GPIO_GPSTATUS0 >> 2, 0x14000); 1661 TDA18271_CALLBACK_CMD_AGC_ENABLE, 1);
1666 msleep(20);
1667 saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0x54000);
1668 saa_writel(SAA7134_GPIO_GPSTATUS0 >> 2, 0x54000);
1669 msleep(20);
1670 fe0->dvb.frontend = dvb_attach(mb86a20s_attach, 1662 fe0->dvb.frontend = dvb_attach(mb86a20s_attach,
1671 &kworld_mb86a20s_config, 1663 &kworld_mb86a20s_config,
1672 &dev->i2c_adap); 1664 &dev->i2c_adap);
1673 __kworld_sbtvd_i2c_gate_ctrl(dev, 1);
1674 if (fe0->dvb.frontend != NULL) { 1665 if (fe0->dvb.frontend != NULL) {
1666 dvb_attach(tda829x_attach, fe0->dvb.frontend,
1667 &dev->i2c_adap, 0x4b,
1668 &tda829x_no_probe);
1675 dvb_attach(tda18271_attach, fe0->dvb.frontend, 1669 dvb_attach(tda18271_attach, fe0->dvb.frontend,
1676 0x60, &dev->i2c_adap, 1670 0x60, &dev->i2c_adap,
1677 &kworld_tda18271_config); 1671 &kworld_tda18271_config);
1678 /* 1672 fe0->dvb.frontend->ops.i2c_gate_ctrl = kworld_sbtvd_gate_ctrl;
1679 * Only after success, it can initialize the gate, otherwise
1680 * an OOPS will hit, due to kfree(fe0->dvb.frontend)
1681 */
1682 fe0->dvb.frontend->ops.i2c_gate_ctrl = kworld_sbtvd_i2c_gate_ctrl;
1683 } 1673 }
1674
1675 /* mb86a20s need to use the I2C gateway */
1684 break; 1676 break;
1685 default: 1677 default:
1686 wprintk("Huh? unknown DVB card?\n"); 1678 wprintk("Huh? unknown DVB card?\n");
diff --git a/drivers/media/video/sn9c102/sn9c102_devtable.h b/drivers/media/video/sn9c102/sn9c102_devtable.h
index 41064c7b5ef8..b3d2cc729657 100644
--- a/drivers/media/video/sn9c102/sn9c102_devtable.h
+++ b/drivers/media/video/sn9c102/sn9c102_devtable.h
@@ -47,8 +47,8 @@ static const struct usb_device_id sn9c102_id_table[] = {
47 { SN9C102_USB_DEVICE(0x0c45, 0x6009, BRIDGE_SN9C102), }, 47 { SN9C102_USB_DEVICE(0x0c45, 0x6009, BRIDGE_SN9C102), },
48 { SN9C102_USB_DEVICE(0x0c45, 0x600d, BRIDGE_SN9C102), }, 48 { SN9C102_USB_DEVICE(0x0c45, 0x600d, BRIDGE_SN9C102), },
49/* { SN9C102_USB_DEVICE(0x0c45, 0x6011, BRIDGE_SN9C102), }, OV6650 */ 49/* { SN9C102_USB_DEVICE(0x0c45, 0x6011, BRIDGE_SN9C102), }, OV6650 */
50#endif
51 { SN9C102_USB_DEVICE(0x0c45, 0x6019, BRIDGE_SN9C102), }, 50 { SN9C102_USB_DEVICE(0x0c45, 0x6019, BRIDGE_SN9C102), },
51#endif
52 { SN9C102_USB_DEVICE(0x0c45, 0x6024, BRIDGE_SN9C102), }, 52 { SN9C102_USB_DEVICE(0x0c45, 0x6024, BRIDGE_SN9C102), },
53 { SN9C102_USB_DEVICE(0x0c45, 0x6025, BRIDGE_SN9C102), }, 53 { SN9C102_USB_DEVICE(0x0c45, 0x6025, BRIDGE_SN9C102), },
54#if !defined CONFIG_USB_GSPCA_SONIXB && !defined CONFIG_USB_GSPCA_SONIXB_MODULE 54#if !defined CONFIG_USB_GSPCA_SONIXB && !defined CONFIG_USB_GSPCA_SONIXB_MODULE
@@ -56,78 +56,68 @@ static const struct usb_device_id sn9c102_id_table[] = {
56 { SN9C102_USB_DEVICE(0x0c45, 0x6029, BRIDGE_SN9C102), }, 56 { SN9C102_USB_DEVICE(0x0c45, 0x6029, BRIDGE_SN9C102), },
57 { SN9C102_USB_DEVICE(0x0c45, 0x602a, BRIDGE_SN9C102), }, 57 { SN9C102_USB_DEVICE(0x0c45, 0x602a, BRIDGE_SN9C102), },
58#endif 58#endif
59 { SN9C102_USB_DEVICE(0x0c45, 0x602b, BRIDGE_SN9C102), }, 59 { SN9C102_USB_DEVICE(0x0c45, 0x602b, BRIDGE_SN9C102), }, /* not in sonixb */
60#if !defined CONFIG_USB_GSPCA_SONIXB && !defined CONFIG_USB_GSPCA_SONIXB_MODULE 60#if !defined CONFIG_USB_GSPCA_SONIXB && !defined CONFIG_USB_GSPCA_SONIXB_MODULE
61 { SN9C102_USB_DEVICE(0x0c45, 0x602c, BRIDGE_SN9C102), }, 61 { SN9C102_USB_DEVICE(0x0c45, 0x602c, BRIDGE_SN9C102), },
62/* { SN9C102_USB_DEVICE(0x0c45, 0x602d, BRIDGE_SN9C102), }, HV7131R */ 62/* { SN9C102_USB_DEVICE(0x0c45, 0x602d, BRIDGE_SN9C102), }, HV7131R */
63 { SN9C102_USB_DEVICE(0x0c45, 0x602e, BRIDGE_SN9C102), }, 63 { SN9C102_USB_DEVICE(0x0c45, 0x602e, BRIDGE_SN9C102), },
64#endif 64#endif
65 { SN9C102_USB_DEVICE(0x0c45, 0x6030, BRIDGE_SN9C102), }, 65 { SN9C102_USB_DEVICE(0x0c45, 0x6030, BRIDGE_SN9C102), }, /* not in sonixb */
66 /* SN9C103 */ 66 /* SN9C103 */
67 { SN9C102_USB_DEVICE(0x0c45, 0x6080, BRIDGE_SN9C103), }, 67/* { SN9C102_USB_DEVICE(0x0c45, 0x6080, BRIDGE_SN9C103), }, non existent ? */
68 { SN9C102_USB_DEVICE(0x0c45, 0x6082, BRIDGE_SN9C103), }, 68 { SN9C102_USB_DEVICE(0x0c45, 0x6082, BRIDGE_SN9C103), }, /* not in sonixb */
69#if !defined CONFIG_USB_GSPCA_SONIXB && !defined CONFIG_USB_GSPCA_SONIXB_MODULE
69/* { SN9C102_USB_DEVICE(0x0c45, 0x6083, BRIDGE_SN9C103), }, HY7131D/E */ 70/* { SN9C102_USB_DEVICE(0x0c45, 0x6083, BRIDGE_SN9C103), }, HY7131D/E */
70 { SN9C102_USB_DEVICE(0x0c45, 0x6088, BRIDGE_SN9C103), }, 71/* { SN9C102_USB_DEVICE(0x0c45, 0x6088, BRIDGE_SN9C103), }, non existent ? */
71 { SN9C102_USB_DEVICE(0x0c45, 0x608a, BRIDGE_SN9C103), }, 72/* { SN9C102_USB_DEVICE(0x0c45, 0x608a, BRIDGE_SN9C103), }, non existent ? */
72 { SN9C102_USB_DEVICE(0x0c45, 0x608b, BRIDGE_SN9C103), }, 73/* { SN9C102_USB_DEVICE(0x0c45, 0x608b, BRIDGE_SN9C103), }, non existent ? */
73 { SN9C102_USB_DEVICE(0x0c45, 0x608c, BRIDGE_SN9C103), }, 74 { SN9C102_USB_DEVICE(0x0c45, 0x608c, BRIDGE_SN9C103), },
74/* { SN9C102_USB_DEVICE(0x0c45, 0x608e, BRIDGE_SN9C103), }, CISVF10 */ 75/* { SN9C102_USB_DEVICE(0x0c45, 0x608e, BRIDGE_SN9C103), }, CISVF10 */
75#if !defined CONFIG_USB_GSPCA_SONIXB && !defined CONFIG_USB_GSPCA_SONIXB_MODULE
76 { SN9C102_USB_DEVICE(0x0c45, 0x608f, BRIDGE_SN9C103), }, 76 { SN9C102_USB_DEVICE(0x0c45, 0x608f, BRIDGE_SN9C103), },
77#endif 77/* { SN9C102_USB_DEVICE(0x0c45, 0x60a0, BRIDGE_SN9C103), }, non existent ? */
78 { SN9C102_USB_DEVICE(0x0c45, 0x60a0, BRIDGE_SN9C103), }, 78/* { SN9C102_USB_DEVICE(0x0c45, 0x60a2, BRIDGE_SN9C103), }, non existent ? */
79 { SN9C102_USB_DEVICE(0x0c45, 0x60a2, BRIDGE_SN9C103), }, 79/* { SN9C102_USB_DEVICE(0x0c45, 0x60a3, BRIDGE_SN9C103), }, non existent ? */
80 { SN9C102_USB_DEVICE(0x0c45, 0x60a3, BRIDGE_SN9C103), },
81/* { SN9C102_USB_DEVICE(0x0c45, 0x60a8, BRIDGE_SN9C103), }, PAS106 */ 80/* { SN9C102_USB_DEVICE(0x0c45, 0x60a8, BRIDGE_SN9C103), }, PAS106 */
82/* { SN9C102_USB_DEVICE(0x0c45, 0x60aa, BRIDGE_SN9C103), }, TAS5130 */ 81/* { SN9C102_USB_DEVICE(0x0c45, 0x60aa, BRIDGE_SN9C103), }, TAS5130 */
83/* { SN9C102_USB_DEVICE(0x0c45, 0x60ab, BRIDGE_SN9C103), }, TAS5130 */ 82/* { SN9C102_USB_DEVICE(0x0c45, 0x60ab, BRIDGE_SN9C103), }, TAS5110, non existent */
84 { SN9C102_USB_DEVICE(0x0c45, 0x60ac, BRIDGE_SN9C103), }, 83/* { SN9C102_USB_DEVICE(0x0c45, 0x60ac, BRIDGE_SN9C103), }, non existent ? */
85 { SN9C102_USB_DEVICE(0x0c45, 0x60ae, BRIDGE_SN9C103), }, 84/* { SN9C102_USB_DEVICE(0x0c45, 0x60ae, BRIDGE_SN9C103), }, non existent ? */
86 { SN9C102_USB_DEVICE(0x0c45, 0x60af, BRIDGE_SN9C103), }, 85 { SN9C102_USB_DEVICE(0x0c45, 0x60af, BRIDGE_SN9C103), },
87#if !defined CONFIG_USB_GSPCA_SONIXB && !defined CONFIG_USB_GSPCA_SONIXB_MODULE
88 { SN9C102_USB_DEVICE(0x0c45, 0x60b0, BRIDGE_SN9C103), }, 86 { SN9C102_USB_DEVICE(0x0c45, 0x60b0, BRIDGE_SN9C103), },
87/* { SN9C102_USB_DEVICE(0x0c45, 0x60b2, BRIDGE_SN9C103), }, non existent ? */
88/* { SN9C102_USB_DEVICE(0x0c45, 0x60b3, BRIDGE_SN9C103), }, non existent ? */
89/* { SN9C102_USB_DEVICE(0x0c45, 0x60b8, BRIDGE_SN9C103), }, non existent ? */
90/* { SN9C102_USB_DEVICE(0x0c45, 0x60ba, BRIDGE_SN9C103), }, non existent ? */
91/* { SN9C102_USB_DEVICE(0x0c45, 0x60bb, BRIDGE_SN9C103), }, non existent ? */
92/* { SN9C102_USB_DEVICE(0x0c45, 0x60bc, BRIDGE_SN9C103), }, non existent ? */
93/* { SN9C102_USB_DEVICE(0x0c45, 0x60be, BRIDGE_SN9C103), }, non existent ? */
89#endif 94#endif
90 { SN9C102_USB_DEVICE(0x0c45, 0x60b2, BRIDGE_SN9C103), },
91 { SN9C102_USB_DEVICE(0x0c45, 0x60b3, BRIDGE_SN9C103), },
92 { SN9C102_USB_DEVICE(0x0c45, 0x60b8, BRIDGE_SN9C103), },
93 { SN9C102_USB_DEVICE(0x0c45, 0x60ba, BRIDGE_SN9C103), },
94 { SN9C102_USB_DEVICE(0x0c45, 0x60bb, BRIDGE_SN9C103), },
95 { SN9C102_USB_DEVICE(0x0c45, 0x60bc, BRIDGE_SN9C103), },
96 { SN9C102_USB_DEVICE(0x0c45, 0x60be, BRIDGE_SN9C103), },
97 /* SN9C105 */ 95 /* SN9C105 */
98#if !defined CONFIG_USB_GSPCA_SONIXJ && !defined CONFIG_USB_GSPCA_SONIXJ_MODULE 96#if !defined CONFIG_USB_GSPCA_SONIXJ && !defined CONFIG_USB_GSPCA_SONIXJ_MODULE
99 { SN9C102_USB_DEVICE(0x045e, 0x00f5, BRIDGE_SN9C105), }, 97 { SN9C102_USB_DEVICE(0x045e, 0x00f5, BRIDGE_SN9C105), },
100 { SN9C102_USB_DEVICE(0x045e, 0x00f7, BRIDGE_SN9C105), }, 98 { SN9C102_USB_DEVICE(0x045e, 0x00f7, BRIDGE_SN9C105), },
101 { SN9C102_USB_DEVICE(0x0471, 0x0327, BRIDGE_SN9C105), }, 99 { SN9C102_USB_DEVICE(0x0471, 0x0327, BRIDGE_SN9C105), },
102 { SN9C102_USB_DEVICE(0x0471, 0x0328, BRIDGE_SN9C105), }, 100 { SN9C102_USB_DEVICE(0x0471, 0x0328, BRIDGE_SN9C105), },
103#endif
104 { SN9C102_USB_DEVICE(0x0c45, 0x60c0, BRIDGE_SN9C105), }, 101 { SN9C102_USB_DEVICE(0x0c45, 0x60c0, BRIDGE_SN9C105), },
105 { SN9C102_USB_DEVICE(0x0c45, 0x60c2, BRIDGE_SN9C105), }, 102/* { SN9C102_USB_DEVICE(0x0c45, 0x60c2, BRIDGE_SN9C105), }, PO1030 */
106 { SN9C102_USB_DEVICE(0x0c45, 0x60c8, BRIDGE_SN9C105), }, 103/* { SN9C102_USB_DEVICE(0x0c45, 0x60c8, BRIDGE_SN9C105), }, OM6801 */
107 { SN9C102_USB_DEVICE(0x0c45, 0x60cc, BRIDGE_SN9C105), }, 104/* { SN9C102_USB_DEVICE(0x0c45, 0x60cc, BRIDGE_SN9C105), }, HV7131GP */
108 { SN9C102_USB_DEVICE(0x0c45, 0x60ea, BRIDGE_SN9C105), }, 105/* { SN9C102_USB_DEVICE(0x0c45, 0x60ea, BRIDGE_SN9C105), }, non existent ? */
109 { SN9C102_USB_DEVICE(0x0c45, 0x60ec, BRIDGE_SN9C105), }, 106/* { SN9C102_USB_DEVICE(0x0c45, 0x60ec, BRIDGE_SN9C105), }, MO4000 */
110 { SN9C102_USB_DEVICE(0x0c45, 0x60ef, BRIDGE_SN9C105), }, 107/* { SN9C102_USB_DEVICE(0x0c45, 0x60ef, BRIDGE_SN9C105), }, ICM105C */
111 { SN9C102_USB_DEVICE(0x0c45, 0x60fa, BRIDGE_SN9C105), }, 108/* { SN9C102_USB_DEVICE(0x0c45, 0x60fa, BRIDGE_SN9C105), }, OV7648 */
112 { SN9C102_USB_DEVICE(0x0c45, 0x60fb, BRIDGE_SN9C105), }, 109 { SN9C102_USB_DEVICE(0x0c45, 0x60fb, BRIDGE_SN9C105), },
113 { SN9C102_USB_DEVICE(0x0c45, 0x60fc, BRIDGE_SN9C105), }, 110 { SN9C102_USB_DEVICE(0x0c45, 0x60fc, BRIDGE_SN9C105), },
114 { SN9C102_USB_DEVICE(0x0c45, 0x60fe, BRIDGE_SN9C105), }, 111 { SN9C102_USB_DEVICE(0x0c45, 0x60fe, BRIDGE_SN9C105), },
115 /* SN9C120 */ 112 /* SN9C120 */
116 { SN9C102_USB_DEVICE(0x0458, 0x7025, BRIDGE_SN9C120), }, 113 { SN9C102_USB_DEVICE(0x0458, 0x7025, BRIDGE_SN9C120), },
117#if !defined CONFIG_USB_GSPCA_SONIXJ && !defined CONFIG_USB_GSPCA_SONIXJ_MODULE 114/* { SN9C102_USB_DEVICE(0x0c45, 0x6102, BRIDGE_SN9C120), }, po2030 */
118 { SN9C102_USB_DEVICE(0x0c45, 0x6102, BRIDGE_SN9C120), }, 115/* { SN9C102_USB_DEVICE(0x0c45, 0x6108, BRIDGE_SN9C120), }, om6801 */
119#endif 116/* { SN9C102_USB_DEVICE(0x0c45, 0x610f, BRIDGE_SN9C120), }, S5K53BEB */
120 { SN9C102_USB_DEVICE(0x0c45, 0x6108, BRIDGE_SN9C120), },
121 { SN9C102_USB_DEVICE(0x0c45, 0x610f, BRIDGE_SN9C120), },
122#if !defined CONFIG_USB_GSPCA_SONIXJ && !defined CONFIG_USB_GSPCA_SONIXJ_MODULE
123 { SN9C102_USB_DEVICE(0x0c45, 0x6130, BRIDGE_SN9C120), }, 117 { SN9C102_USB_DEVICE(0x0c45, 0x6130, BRIDGE_SN9C120), },
124#endif
125/* { SN9C102_USB_DEVICE(0x0c45, 0x6138, BRIDGE_SN9C120), }, MO8000 */ 118/* { SN9C102_USB_DEVICE(0x0c45, 0x6138, BRIDGE_SN9C120), }, MO8000 */
126#if !defined CONFIG_USB_GSPCA_SONIXJ && !defined CONFIG_USB_GSPCA_SONIXJ_MODULE
127 { SN9C102_USB_DEVICE(0x0c45, 0x613a, BRIDGE_SN9C120), }, 119 { SN9C102_USB_DEVICE(0x0c45, 0x613a, BRIDGE_SN9C120), },
128#endif
129 { SN9C102_USB_DEVICE(0x0c45, 0x613b, BRIDGE_SN9C120), }, 120 { SN9C102_USB_DEVICE(0x0c45, 0x613b, BRIDGE_SN9C120), },
130#if !defined CONFIG_USB_GSPCA_SONIXJ && !defined CONFIG_USB_GSPCA_SONIXJ_MODULE
131 { SN9C102_USB_DEVICE(0x0c45, 0x613c, BRIDGE_SN9C120), }, 121 { SN9C102_USB_DEVICE(0x0c45, 0x613c, BRIDGE_SN9C120), },
132 { SN9C102_USB_DEVICE(0x0c45, 0x613e, BRIDGE_SN9C120), }, 122 { SN9C102_USB_DEVICE(0x0c45, 0x613e, BRIDGE_SN9C120), },
133#endif 123#endif
diff --git a/drivers/media/video/sr030pc30.c b/drivers/media/video/sr030pc30.c
index 864696b7a006..c901721a1db3 100644
--- a/drivers/media/video/sr030pc30.c
+++ b/drivers/media/video/sr030pc30.c
@@ -714,15 +714,6 @@ static int sr030pc30_base_config(struct v4l2_subdev *sd)
714 return ret; 714 return ret;
715} 715}
716 716
717static int sr030pc30_s_config(struct v4l2_subdev *sd,
718 int irq, void *platform_data)
719{
720 struct sr030pc30_info *info = to_sr030pc30(sd);
721
722 info->pdata = platform_data;
723 return 0;
724}
725
726static int sr030pc30_s_stream(struct v4l2_subdev *sd, int enable) 717static int sr030pc30_s_stream(struct v4l2_subdev *sd, int enable)
727{ 718{
728 return 0; 719 return 0;
@@ -763,7 +754,6 @@ static int sr030pc30_s_power(struct v4l2_subdev *sd, int on)
763} 754}
764 755
765static const struct v4l2_subdev_core_ops sr030pc30_core_ops = { 756static const struct v4l2_subdev_core_ops sr030pc30_core_ops = {
766 .s_config = sr030pc30_s_config,
767 .s_power = sr030pc30_s_power, 757 .s_power = sr030pc30_s_power,
768 .queryctrl = sr030pc30_queryctrl, 758 .queryctrl = sr030pc30_queryctrl,
769 .s_ctrl = sr030pc30_s_ctrl, 759 .s_ctrl = sr030pc30_s_ctrl,
diff --git a/drivers/media/video/tda9875.c b/drivers/media/video/tda9875.c
deleted file mode 100644
index 35b6ff5db319..000000000000
--- a/drivers/media/video/tda9875.c
+++ /dev/null
@@ -1,411 +0,0 @@
1/*
2 * For the TDA9875 chip
3 * (The TDA9875 is used on the Diamond DTV2000 french version
4 * Other cards probably use these chips as well.)
5 * This driver will not complain if used with any
6 * other i2c device with the same address.
7 *
8 * Copyright (c) 2000 Guillaume Delvit based on Gerd Knorr source and
9 * Eric Sandeen
10 * Copyright (c) 2006 Mauro Carvalho Chehab <mchehab@infradead.org>
11 * This code is placed under the terms of the GNU General Public License
12 * Based on tda9855.c by Steve VanDeBogart (vandebo@uclink.berkeley.edu)
13 * Which was based on tda8425.c by Greg Alexander (c) 1998
14 *
15 * OPTIONS:
16 * debug - set to 1 if you'd like to see debug messages
17 *
18 * Revision: 0.1 - original version
19 */
20
21#include <linux/module.h>
22#include <linux/kernel.h>
23#include <linux/string.h>
24#include <linux/timer.h>
25#include <linux/delay.h>
26#include <linux/errno.h>
27#include <linux/slab.h>
28#include <linux/i2c.h>
29#include <linux/videodev2.h>
30#include <media/v4l2-device.h>
31#include <media/i2c-addr.h>
32
33static int debug; /* insmod parameter */
34module_param(debug, int, S_IRUGO | S_IWUSR);
35MODULE_LICENSE("GPL");
36
37
38/* This is a superset of the TDA9875 */
39struct tda9875 {
40 struct v4l2_subdev sd;
41 int rvol, lvol;
42 int bass, treble;
43};
44
45static inline struct tda9875 *to_state(struct v4l2_subdev *sd)
46{
47 return container_of(sd, struct tda9875, sd);
48}
49
50#define dprintk if (debug) printk
51
52/* The TDA9875 is made by Philips Semiconductor
53 * http://www.semiconductors.philips.com
54 * TDA9875: I2C-bus controlled DSP audio processor, FM demodulator
55 *
56 */
57
58 /* subaddresses for TDA9875 */
59#define TDA9875_MUT 0x12 /*General mute (value --> 0b11001100*/
60#define TDA9875_CFG 0x01 /* Config register (value --> 0b00000000 */
61#define TDA9875_DACOS 0x13 /*DAC i/o select (ADC) 0b0000100*/
62#define TDA9875_LOSR 0x16 /*Line output select regirter 0b0100 0001*/
63
64#define TDA9875_CH1V 0x0c /*Channel 1 volume (mute)*/
65#define TDA9875_CH2V 0x0d /*Channel 2 volume (mute)*/
66#define TDA9875_SC1 0x14 /*SCART 1 in (mono)*/
67#define TDA9875_SC2 0x15 /*SCART 2 in (mono)*/
68
69#define TDA9875_ADCIS 0x17 /*ADC input select (mono) 0b0110 000*/
70#define TDA9875_AER 0x19 /*Audio effect (AVL+Pseudo) 0b0000 0110*/
71#define TDA9875_MCS 0x18 /*Main channel select (DAC) 0b0000100*/
72#define TDA9875_MVL 0x1a /* Main volume gauche */
73#define TDA9875_MVR 0x1b /* Main volume droite */
74#define TDA9875_MBA 0x1d /* Main Basse */
75#define TDA9875_MTR 0x1e /* Main treble */
76#define TDA9875_ACS 0x1f /* Auxilary channel select (FM) 0b0000000*/
77#define TDA9875_AVL 0x20 /* Auxilary volume gauche */
78#define TDA9875_AVR 0x21 /* Auxilary volume droite */
79#define TDA9875_ABA 0x22 /* Auxilary Basse */
80#define TDA9875_ATR 0x23 /* Auxilary treble */
81
82#define TDA9875_MSR 0x02 /* Monitor select register */
83#define TDA9875_C1MSB 0x03 /* Carrier 1 (FM) frequency register MSB */
84#define TDA9875_C1MIB 0x04 /* Carrier 1 (FM) frequency register (16-8]b */
85#define TDA9875_C1LSB 0x05 /* Carrier 1 (FM) frequency register LSB */
86#define TDA9875_C2MSB 0x06 /* Carrier 2 (nicam) frequency register MSB */
87#define TDA9875_C2MIB 0x07 /* Carrier 2 (nicam) frequency register (16-8]b */
88#define TDA9875_C2LSB 0x08 /* Carrier 2 (nicam) frequency register LSB */
89#define TDA9875_DCR 0x09 /* Demodulateur configuration regirter*/
90#define TDA9875_DEEM 0x0a /* FM de-emphasis regirter*/
91#define TDA9875_FMAT 0x0b /* FM Matrix regirter*/
92
93/* values */
94#define TDA9875_MUTE_ON 0xff /* general mute */
95#define TDA9875_MUTE_OFF 0xcc /* general no mute */
96
97
98
99/* Begin code */
100
101static int tda9875_write(struct v4l2_subdev *sd, int subaddr, unsigned char val)
102{
103 struct i2c_client *client = v4l2_get_subdevdata(sd);
104 unsigned char buffer[2];
105
106 v4l2_dbg(1, debug, sd, "Writing %d 0x%x\n", subaddr, val);
107 buffer[0] = subaddr;
108 buffer[1] = val;
109 if (2 != i2c_master_send(client, buffer, 2)) {
110 v4l2_warn(sd, "I/O error, trying (write %d 0x%x)\n",
111 subaddr, val);
112 return -1;
113 }
114 return 0;
115}
116
117
118static int i2c_read_register(struct i2c_client *client, int addr, int reg)
119{
120 unsigned char write[1];
121 unsigned char read[1];
122 struct i2c_msg msgs[2] = {
123 { addr, 0, 1, write },
124 { addr, I2C_M_RD, 1, read }
125 };
126
127 write[0] = reg;
128
129 if (2 != i2c_transfer(client->adapter, msgs, 2)) {
130 v4l_warn(client, "I/O error (read2)\n");
131 return -1;
132 }
133 v4l_dbg(1, debug, client, "chip_read2: reg%d=0x%x\n", reg, read[0]);
134 return read[0];
135}
136
137static void tda9875_set(struct v4l2_subdev *sd)
138{
139 struct tda9875 *tda = to_state(sd);
140 unsigned char a;
141
142 v4l2_dbg(1, debug, sd, "tda9875_set(%04x,%04x,%04x,%04x)\n",
143 tda->lvol, tda->rvol, tda->bass, tda->treble);
144
145 a = tda->lvol & 0xff;
146 tda9875_write(sd, TDA9875_MVL, a);
147 a =tda->rvol & 0xff;
148 tda9875_write(sd, TDA9875_MVR, a);
149 a =tda->bass & 0xff;
150 tda9875_write(sd, TDA9875_MBA, a);
151 a =tda->treble & 0xff;
152 tda9875_write(sd, TDA9875_MTR, a);
153}
154
155static void do_tda9875_init(struct v4l2_subdev *sd)
156{
157 struct tda9875 *t = to_state(sd);
158
159 v4l2_dbg(1, debug, sd, "In tda9875_init\n");
160 tda9875_write(sd, TDA9875_CFG, 0xd0); /*reg de config 0 (reset)*/
161 tda9875_write(sd, TDA9875_MSR, 0x03); /* Monitor 0b00000XXX*/
162 tda9875_write(sd, TDA9875_C1MSB, 0x00); /*Car1(FM) MSB XMHz*/
163 tda9875_write(sd, TDA9875_C1MIB, 0x00); /*Car1(FM) MIB XMHz*/
164 tda9875_write(sd, TDA9875_C1LSB, 0x00); /*Car1(FM) LSB XMHz*/
165 tda9875_write(sd, TDA9875_C2MSB, 0x00); /*Car2(NICAM) MSB XMHz*/
166 tda9875_write(sd, TDA9875_C2MIB, 0x00); /*Car2(NICAM) MIB XMHz*/
167 tda9875_write(sd, TDA9875_C2LSB, 0x00); /*Car2(NICAM) LSB XMHz*/
168 tda9875_write(sd, TDA9875_DCR, 0x00); /*Demod config 0x00*/
169 tda9875_write(sd, TDA9875_DEEM, 0x44); /*DE-Emph 0b0100 0100*/
170 tda9875_write(sd, TDA9875_FMAT, 0x00); /*FM Matrix reg 0x00*/
171 tda9875_write(sd, TDA9875_SC1, 0x00); /* SCART 1 (SC1)*/
172 tda9875_write(sd, TDA9875_SC2, 0x01); /* SCART 2 (sc2)*/
173
174 tda9875_write(sd, TDA9875_CH1V, 0x10); /* Channel volume 1 mute*/
175 tda9875_write(sd, TDA9875_CH2V, 0x10); /* Channel volume 2 mute */
176 tda9875_write(sd, TDA9875_DACOS, 0x02); /* sig DAC i/o(in:nicam)*/
177 tda9875_write(sd, TDA9875_ADCIS, 0x6f); /* sig ADC input(in:mono)*/
178 tda9875_write(sd, TDA9875_LOSR, 0x00); /* line out (in:mono)*/
179 tda9875_write(sd, TDA9875_AER, 0x00); /*06 Effect (AVL+PSEUDO) */
180 tda9875_write(sd, TDA9875_MCS, 0x44); /* Main ch select (DAC) */
181 tda9875_write(sd, TDA9875_MVL, 0x03); /* Vol Main left 10dB */
182 tda9875_write(sd, TDA9875_MVR, 0x03); /* Vol Main right 10dB*/
183 tda9875_write(sd, TDA9875_MBA, 0x00); /* Main Bass Main 0dB*/
184 tda9875_write(sd, TDA9875_MTR, 0x00); /* Main Treble Main 0dB*/
185 tda9875_write(sd, TDA9875_ACS, 0x44); /* Aux chan select (dac)*/
186 tda9875_write(sd, TDA9875_AVL, 0x00); /* Vol Aux left 0dB*/
187 tda9875_write(sd, TDA9875_AVR, 0x00); /* Vol Aux right 0dB*/
188 tda9875_write(sd, TDA9875_ABA, 0x00); /* Aux Bass Main 0dB*/
189 tda9875_write(sd, TDA9875_ATR, 0x00); /* Aux Aigus Main 0dB*/
190
191 tda9875_write(sd, TDA9875_MUT, 0xcc); /* General mute */
192
193 t->lvol = t->rvol = 0; /* 0dB */
194 t->bass = 0; /* 0dB */
195 t->treble = 0; /* 0dB */
196 tda9875_set(sd);
197}
198
199
200static int tda9875_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
201{
202 struct tda9875 *t = to_state(sd);
203
204 switch (ctrl->id) {
205 case V4L2_CID_AUDIO_VOLUME:
206 {
207 int left = (t->lvol+84)*606;
208 int right = (t->rvol+84)*606;
209
210 ctrl->value=max(left,right);
211 return 0;
212 }
213 case V4L2_CID_AUDIO_BALANCE:
214 {
215 int left = (t->lvol+84)*606;
216 int right = (t->rvol+84)*606;
217 int volume = max(left,right);
218 int balance = (32768*min(left,right))/
219 (volume ? volume : 1);
220 ctrl->value=(left<right)?
221 (65535-balance) : balance;
222 return 0;
223 }
224 case V4L2_CID_AUDIO_BASS:
225 ctrl->value = (t->bass+12)*2427; /* min -12 max +15 */
226 return 0;
227 case V4L2_CID_AUDIO_TREBLE:
228 ctrl->value = (t->treble+12)*2730;/* min -12 max +12 */
229 return 0;
230 }
231 return -EINVAL;
232}
233
234static int tda9875_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
235{
236 struct tda9875 *t = to_state(sd);
237 int chvol = 0, volume = 0, balance = 0, left, right;
238
239 switch (ctrl->id) {
240 case V4L2_CID_AUDIO_VOLUME:
241 left = (t->lvol+84)*606;
242 right = (t->rvol+84)*606;
243
244 volume = max(left,right);
245 balance = (32768*min(left,right))/
246 (volume ? volume : 1);
247 balance =(left<right)?
248 (65535-balance) : balance;
249
250 volume = ctrl->value;
251
252 chvol=1;
253 break;
254 case V4L2_CID_AUDIO_BALANCE:
255 left = (t->lvol+84)*606;
256 right = (t->rvol+84)*606;
257
258 volume=max(left,right);
259
260 balance = ctrl->value;
261
262 chvol=1;
263 break;
264 case V4L2_CID_AUDIO_BASS:
265 t->bass = ((ctrl->value/2400)-12) & 0xff;
266 if (t->bass > 15)
267 t->bass = 15;
268 if (t->bass < -12)
269 t->bass = -12 & 0xff;
270 break;
271 case V4L2_CID_AUDIO_TREBLE:
272 t->treble = ((ctrl->value/2700)-12) & 0xff;
273 if (t->treble > 12)
274 t->treble = 12;
275 if (t->treble < -12)
276 t->treble = -12 & 0xff;
277 break;
278 default:
279 return -EINVAL;
280 }
281
282 if (chvol) {
283 left = (min(65536 - balance,32768) *
284 volume) / 32768;
285 right = (min(balance,32768) *
286 volume) / 32768;
287 t->lvol = ((left/606)-84) & 0xff;
288 if (t->lvol > 24)
289 t->lvol = 24;
290 if (t->lvol < -84)
291 t->lvol = -84 & 0xff;
292
293 t->rvol = ((right/606)-84) & 0xff;
294 if (t->rvol > 24)
295 t->rvol = 24;
296 if (t->rvol < -84)
297 t->rvol = -84 & 0xff;
298 }
299
300 tda9875_set(sd);
301 return 0;
302}
303
304static int tda9875_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc)
305{
306 switch (qc->id) {
307 case V4L2_CID_AUDIO_VOLUME:
308 return v4l2_ctrl_query_fill(qc, 0, 65535, 65535 / 100, 58880);
309 case V4L2_CID_AUDIO_BASS:
310 case V4L2_CID_AUDIO_TREBLE:
311 return v4l2_ctrl_query_fill(qc, 0, 65535, 65535 / 100, 32768);
312 }
313 return -EINVAL;
314}
315
316/* ----------------------------------------------------------------------- */
317
318static const struct v4l2_subdev_core_ops tda9875_core_ops = {
319 .queryctrl = tda9875_queryctrl,
320 .g_ctrl = tda9875_g_ctrl,
321 .s_ctrl = tda9875_s_ctrl,
322};
323
324static const struct v4l2_subdev_ops tda9875_ops = {
325 .core = &tda9875_core_ops,
326};
327
328/* ----------------------------------------------------------------------- */
329
330
331/* *********************** *
332 * i2c interface functions *
333 * *********************** */
334
335static int tda9875_checkit(struct i2c_client *client, int addr)
336{
337 int dic, rev;
338
339 dic = i2c_read_register(client, addr, 254);
340 rev = i2c_read_register(client, addr, 255);
341
342 if (dic == 0 || dic == 2) { /* tda9875 and tda9875A */
343 v4l_info(client, "tda9875%s rev. %d detected at 0x%02x\n",
344 dic == 0 ? "" : "A", rev, addr << 1);
345 return 1;
346 }
347 v4l_info(client, "no such chip at 0x%02x (dic=0x%x rev=0x%x)\n",
348 addr << 1, dic, rev);
349 return 0;
350}
351
352static int tda9875_probe(struct i2c_client *client,
353 const struct i2c_device_id *id)
354{
355 struct tda9875 *t;
356 struct v4l2_subdev *sd;
357
358 v4l_info(client, "chip found @ 0x%02x (%s)\n",
359 client->addr << 1, client->adapter->name);
360
361 if (!tda9875_checkit(client, client->addr))
362 return -ENODEV;
363
364 t = kzalloc(sizeof(*t), GFP_KERNEL);
365 if (!t)
366 return -ENOMEM;
367 sd = &t->sd;
368 v4l2_i2c_subdev_init(sd, client, &tda9875_ops);
369
370 do_tda9875_init(sd);
371 return 0;
372}
373
374static int tda9875_remove(struct i2c_client *client)
375{
376 struct v4l2_subdev *sd = i2c_get_clientdata(client);
377
378 do_tda9875_init(sd);
379 v4l2_device_unregister_subdev(sd);
380 kfree(to_state(sd));
381 return 0;
382}
383
384static const struct i2c_device_id tda9875_id[] = {
385 { "tda9875", 0 },
386 { }
387};
388MODULE_DEVICE_TABLE(i2c, tda9875_id);
389
390static struct i2c_driver tda9875_driver = {
391 .driver = {
392 .owner = THIS_MODULE,
393 .name = "tda9875",
394 },
395 .probe = tda9875_probe,
396 .remove = tda9875_remove,
397 .id_table = tda9875_id,
398};
399
400static __init int init_tda9875(void)
401{
402 return i2c_add_driver(&tda9875_driver);
403}
404
405static __exit void exit_tda9875(void)
406{
407 i2c_del_driver(&tda9875_driver);
408}
409
410module_init(init_tda9875);
411module_exit(exit_tda9875);
diff --git a/drivers/media/video/tlg2300/pd-video.c b/drivers/media/video/tlg2300/pd-video.c
index a1ffe18640fe..df33a1d188bb 100644
--- a/drivers/media/video/tlg2300/pd-video.c
+++ b/drivers/media/video/tlg2300/pd-video.c
@@ -512,19 +512,20 @@ int alloc_bulk_urbs_generic(struct urb **urb_array, int num,
512 int buf_size, gfp_t gfp_flags, 512 int buf_size, gfp_t gfp_flags,
513 usb_complete_t complete_fn, void *context) 513 usb_complete_t complete_fn, void *context)
514{ 514{
515 struct urb *urb; 515 int i = 0;
516 void *mem;
517 int i;
518 516
519 for (i = 0; i < num; i++) { 517 for (; i < num; i++) {
520 urb = usb_alloc_urb(0, gfp_flags); 518 void *mem;
519 struct urb *urb = usb_alloc_urb(0, gfp_flags);
521 if (urb == NULL) 520 if (urb == NULL)
522 return i; 521 return i;
523 522
524 mem = usb_alloc_coherent(udev, buf_size, gfp_flags, 523 mem = usb_alloc_coherent(udev, buf_size, gfp_flags,
525 &urb->transfer_dma); 524 &urb->transfer_dma);
526 if (mem == NULL) 525 if (mem == NULL) {
526 usb_free_urb(urb);
527 return i; 527 return i;
528 }
528 529
529 usb_fill_bulk_urb(urb, udev, usb_rcvbulkpipe(udev, ep_addr), 530 usb_fill_bulk_urb(urb, udev, usb_rcvbulkpipe(udev, ep_addr),
530 mem, buf_size, complete_fn, context); 531 mem, buf_size, complete_fn, context);
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index 3f0871b550ad..810eef43c216 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -407,18 +407,6 @@ struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev,
407 /* Decrease the module use count to match the first try_module_get. */ 407 /* Decrease the module use count to match the first try_module_get. */
408 module_put(client->driver->driver.owner); 408 module_put(client->driver->driver.owner);
409 409
410 if (sd) {
411 /* We return errors from v4l2_subdev_call only if we have the
412 callback as the .s_config is not mandatory */
413 int err = v4l2_subdev_call(sd, core, s_config,
414 info->irq, info->platform_data);
415
416 if (err && err != -ENOIOCTLCMD) {
417 v4l2_device_unregister_subdev(sd);
418 sd = NULL;
419 }
420 }
421
422error: 410error:
423 /* If we have a client but no subdev, then something went wrong and 411 /* If we have a client but no subdev, then something went wrong and
424 we must unregister the client. */ 412 we must unregister the client. */
@@ -428,9 +416,8 @@ error:
428} 416}
429EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev_board); 417EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev_board);
430 418
431struct v4l2_subdev *v4l2_i2c_new_subdev_cfg(struct v4l2_device *v4l2_dev, 419struct v4l2_subdev *v4l2_i2c_new_subdev(struct v4l2_device *v4l2_dev,
432 struct i2c_adapter *adapter, const char *client_type, 420 struct i2c_adapter *adapter, const char *client_type,
433 int irq, void *platform_data,
434 u8 addr, const unsigned short *probe_addrs) 421 u8 addr, const unsigned short *probe_addrs)
435{ 422{
436 struct i2c_board_info info; 423 struct i2c_board_info info;
@@ -440,12 +427,10 @@ struct v4l2_subdev *v4l2_i2c_new_subdev_cfg(struct v4l2_device *v4l2_dev,
440 memset(&info, 0, sizeof(info)); 427 memset(&info, 0, sizeof(info));
441 strlcpy(info.type, client_type, sizeof(info.type)); 428 strlcpy(info.type, client_type, sizeof(info.type));
442 info.addr = addr; 429 info.addr = addr;
443 info.irq = irq;
444 info.platform_data = platform_data;
445 430
446 return v4l2_i2c_new_subdev_board(v4l2_dev, adapter, &info, probe_addrs); 431 return v4l2_i2c_new_subdev_board(v4l2_dev, adapter, &info, probe_addrs);
447} 432}
448EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev_cfg); 433EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev);
449 434
450/* Return i2c client address of v4l2_subdev. */ 435/* Return i2c client address of v4l2_subdev. */
451unsigned short v4l2_i2c_subdev_addr(struct v4l2_subdev *sd) 436unsigned short v4l2_i2c_subdev_addr(struct v4l2_subdev *sd)
diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c
index 8f81efcfcf56..ef66d2af0c57 100644
--- a/drivers/media/video/v4l2-ctrls.c
+++ b/drivers/media/video/v4l2-ctrls.c
@@ -569,7 +569,7 @@ static int user_to_new(struct v4l2_ext_control *c,
569 int ret; 569 int ret;
570 u32 size; 570 u32 size;
571 571
572 ctrl->has_new = 1; 572 ctrl->is_new = 1;
573 switch (ctrl->type) { 573 switch (ctrl->type) {
574 case V4L2_CTRL_TYPE_INTEGER64: 574 case V4L2_CTRL_TYPE_INTEGER64:
575 ctrl->val64 = c->value64; 575 ctrl->val64 = c->value64;
@@ -1280,8 +1280,12 @@ int v4l2_ctrl_handler_setup(struct v4l2_ctrl_handler *hdl)
1280 if (ctrl->done) 1280 if (ctrl->done)
1281 continue; 1281 continue;
1282 1282
1283 for (i = 0; i < master->ncontrols; i++) 1283 for (i = 0; i < master->ncontrols; i++) {
1284 cur_to_new(master->cluster[i]); 1284 if (master->cluster[i]) {
1285 cur_to_new(master->cluster[i]);
1286 master->cluster[i]->is_new = 1;
1287 }
1288 }
1285 1289
1286 /* Skip button controls and read-only controls. */ 1290 /* Skip button controls and read-only controls. */
1287 if (ctrl->type == V4L2_CTRL_TYPE_BUTTON || 1291 if (ctrl->type == V4L2_CTRL_TYPE_BUTTON ||
@@ -1340,12 +1344,15 @@ int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc)
1340 1344
1341 ctrl = ref->ctrl; 1345 ctrl = ref->ctrl;
1342 memset(qc, 0, sizeof(*qc)); 1346 memset(qc, 0, sizeof(*qc));
1343 qc->id = ctrl->id; 1347 if (id >= V4L2_CID_PRIVATE_BASE)
1348 qc->id = id;
1349 else
1350 qc->id = ctrl->id;
1344 strlcpy(qc->name, ctrl->name, sizeof(qc->name)); 1351 strlcpy(qc->name, ctrl->name, sizeof(qc->name));
1345 qc->minimum = ctrl->minimum; 1352 qc->minimum = ctrl->minimum;
1346 qc->maximum = ctrl->maximum; 1353 qc->maximum = ctrl->maximum;
1347 qc->default_value = ctrl->default_value; 1354 qc->default_value = ctrl->default_value;
1348 if (qc->type == V4L2_CTRL_TYPE_MENU) 1355 if (ctrl->type == V4L2_CTRL_TYPE_MENU)
1349 qc->step = 1; 1356 qc->step = 1;
1350 else 1357 else
1351 qc->step = ctrl->step; 1358 qc->step = ctrl->step;
@@ -1645,7 +1652,7 @@ static int try_or_set_control_cluster(struct v4l2_ctrl *master, bool set)
1645 if (ctrl == NULL) 1652 if (ctrl == NULL)
1646 continue; 1653 continue;
1647 1654
1648 if (ctrl->has_new) { 1655 if (ctrl->is_new) {
1649 /* Double check this: it may have changed since the 1656 /* Double check this: it may have changed since the
1650 last check in try_or_set_ext_ctrls(). */ 1657 last check in try_or_set_ext_ctrls(). */
1651 if (set && (ctrl->flags & V4L2_CTRL_FLAG_GRABBED)) 1658 if (set && (ctrl->flags & V4L2_CTRL_FLAG_GRABBED))
@@ -1719,13 +1726,13 @@ static int try_or_set_ext_ctrls(struct v4l2_ctrl_handler *hdl,
1719 1726
1720 v4l2_ctrl_lock(ctrl); 1727 v4l2_ctrl_lock(ctrl);
1721 1728
1722 /* Reset the 'has_new' flags of the cluster */ 1729 /* Reset the 'is_new' flags of the cluster */
1723 for (j = 0; j < master->ncontrols; j++) 1730 for (j = 0; j < master->ncontrols; j++)
1724 if (master->cluster[j]) 1731 if (master->cluster[j])
1725 master->cluster[j]->has_new = 0; 1732 master->cluster[j]->is_new = 0;
1726 1733
1727 /* Copy the new caller-supplied control values. 1734 /* Copy the new caller-supplied control values.
1728 user_to_new() sets 'has_new' to 1. */ 1735 user_to_new() sets 'is_new' to 1. */
1729 ret = cluster_walk(i, cs, helpers, user_to_new); 1736 ret = cluster_walk(i, cs, helpers, user_to_new);
1730 1737
1731 if (!ret) 1738 if (!ret)
@@ -1820,15 +1827,18 @@ static int set_ctrl(struct v4l2_ctrl *ctrl, s32 *val)
1820 int ret; 1827 int ret;
1821 int i; 1828 int i;
1822 1829
1830 if (ctrl->flags & V4L2_CTRL_FLAG_READ_ONLY)
1831 return -EACCES;
1832
1823 v4l2_ctrl_lock(ctrl); 1833 v4l2_ctrl_lock(ctrl);
1824 1834
1825 /* Reset the 'has_new' flags of the cluster */ 1835 /* Reset the 'is_new' flags of the cluster */
1826 for (i = 0; i < master->ncontrols; i++) 1836 for (i = 0; i < master->ncontrols; i++)
1827 if (master->cluster[i]) 1837 if (master->cluster[i])
1828 master->cluster[i]->has_new = 0; 1838 master->cluster[i]->is_new = 0;
1829 1839
1830 ctrl->val = *val; 1840 ctrl->val = *val;
1831 ctrl->has_new = 1; 1841 ctrl->is_new = 1;
1832 ret = try_or_set_control_cluster(master, false); 1842 ret = try_or_set_control_cluster(master, false);
1833 if (!ret) 1843 if (!ret)
1834 ret = try_or_set_control_cluster(master, true); 1844 ret = try_or_set_control_cluster(master, true);
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c
index 359e23290a7e..341764a3a990 100644
--- a/drivers/media/video/v4l2-dev.c
+++ b/drivers/media/video/v4l2-dev.c
@@ -419,6 +419,10 @@ static int get_index(struct video_device *vdev)
419 * The registration code assigns minor numbers and device node numbers 419 * The registration code assigns minor numbers and device node numbers
420 * based on the requested type and registers the new device node with 420 * based on the requested type and registers the new device node with
421 * the kernel. 421 * the kernel.
422 *
423 * This function assumes that struct video_device was zeroed when it
424 * was allocated and does not contain any stale date.
425 *
422 * An error is returned if no free minor or device node number could be 426 * An error is returned if no free minor or device node number could be
423 * found, or if the registration of the device node failed. 427 * found, or if the registration of the device node failed.
424 * 428 *
@@ -440,7 +444,6 @@ static int __video_register_device(struct video_device *vdev, int type, int nr,
440 int minor_offset = 0; 444 int minor_offset = 0;
441 int minor_cnt = VIDEO_NUM_DEVICES; 445 int minor_cnt = VIDEO_NUM_DEVICES;
442 const char *name_base; 446 const char *name_base;
443 void *priv = vdev->dev.p;
444 447
445 /* A minor value of -1 marks this video device as never 448 /* A minor value of -1 marks this video device as never
446 having been registered */ 449 having been registered */
@@ -559,10 +562,6 @@ static int __video_register_device(struct video_device *vdev, int type, int nr,
559 } 562 }
560 563
561 /* Part 4: register the device with sysfs */ 564 /* Part 4: register the device with sysfs */
562 memset(&vdev->dev, 0, sizeof(vdev->dev));
563 /* The memset above cleared the device's device_private, so
564 put back the copy we made earlier. */
565 vdev->dev.p = priv;
566 vdev->dev.class = &video_class; 565 vdev->dev.class = &video_class;
567 vdev->dev.devt = MKDEV(VIDEO_MAJOR, vdev->minor); 566 vdev->dev.devt = MKDEV(VIDEO_MAJOR, vdev->minor);
568 if (vdev->parent) 567 if (vdev->parent)
diff --git a/drivers/media/video/v4l2-device.c b/drivers/media/video/v4l2-device.c
index 7fe6f92af480..ce64fe16bc60 100644
--- a/drivers/media/video/v4l2-device.c
+++ b/drivers/media/video/v4l2-device.c
@@ -100,6 +100,7 @@ void v4l2_device_unregister(struct v4l2_device *v4l2_dev)
100 is a platform bus, then it is never deleted. */ 100 is a platform bus, then it is never deleted. */
101 if (client) 101 if (client)
102 i2c_unregister_device(client); 102 i2c_unregister_device(client);
103 continue;
103 } 104 }
104#endif 105#endif
105#if defined(CONFIG_SPI) 106#if defined(CONFIG_SPI)
@@ -108,6 +109,7 @@ void v4l2_device_unregister(struct v4l2_device *v4l2_dev)
108 109
109 if (spi) 110 if (spi)
110 spi_unregister_device(spi); 111 spi_unregister_device(spi);
112 continue;
111 } 113 }
112#endif 114#endif
113 } 115 }
@@ -126,11 +128,19 @@ int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev,
126 WARN_ON(sd->v4l2_dev != NULL); 128 WARN_ON(sd->v4l2_dev != NULL);
127 if (!try_module_get(sd->owner)) 129 if (!try_module_get(sd->owner))
128 return -ENODEV; 130 return -ENODEV;
131 sd->v4l2_dev = v4l2_dev;
132 if (sd->internal_ops && sd->internal_ops->registered) {
133 err = sd->internal_ops->registered(sd);
134 if (err)
135 return err;
136 }
129 /* This just returns 0 if either of the two args is NULL */ 137 /* This just returns 0 if either of the two args is NULL */
130 err = v4l2_ctrl_add_handler(v4l2_dev->ctrl_handler, sd->ctrl_handler); 138 err = v4l2_ctrl_add_handler(v4l2_dev->ctrl_handler, sd->ctrl_handler);
131 if (err) 139 if (err) {
140 if (sd->internal_ops && sd->internal_ops->unregistered)
141 sd->internal_ops->unregistered(sd);
132 return err; 142 return err;
133 sd->v4l2_dev = v4l2_dev; 143 }
134 spin_lock(&v4l2_dev->lock); 144 spin_lock(&v4l2_dev->lock);
135 list_add_tail(&sd->list, &v4l2_dev->subdevs); 145 list_add_tail(&sd->list, &v4l2_dev->subdevs);
136 spin_unlock(&v4l2_dev->lock); 146 spin_unlock(&v4l2_dev->lock);
@@ -146,6 +156,8 @@ void v4l2_device_unregister_subdev(struct v4l2_subdev *sd)
146 spin_lock(&sd->v4l2_dev->lock); 156 spin_lock(&sd->v4l2_dev->lock);
147 list_del(&sd->list); 157 list_del(&sd->list);
148 spin_unlock(&sd->v4l2_dev->lock); 158 spin_unlock(&sd->v4l2_dev->lock);
159 if (sd->internal_ops && sd->internal_ops->unregistered)
160 sd->internal_ops->unregistered(sd);
149 sd->v4l2_dev = NULL; 161 sd->v4l2_dev = NULL;
150 module_put(sd->owner); 162 module_put(sd->owner);
151} 163}
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c
index 7e47f15f350d..f51327ef6757 100644
--- a/drivers/media/video/v4l2-ioctl.c
+++ b/drivers/media/video/v4l2-ioctl.c
@@ -1659,20 +1659,24 @@ static long __video_do_ioctl(struct file *file,
1659 { 1659 {
1660 struct v4l2_dbg_register *p = arg; 1660 struct v4l2_dbg_register *p = arg;
1661 1661
1662 if (!capable(CAP_SYS_ADMIN)) 1662 if (ops->vidioc_g_register) {
1663 ret = -EPERM; 1663 if (!capable(CAP_SYS_ADMIN))
1664 else if (ops->vidioc_g_register) 1664 ret = -EPERM;
1665 ret = ops->vidioc_g_register(file, fh, p); 1665 else
1666 ret = ops->vidioc_g_register(file, fh, p);
1667 }
1666 break; 1668 break;
1667 } 1669 }
1668 case VIDIOC_DBG_S_REGISTER: 1670 case VIDIOC_DBG_S_REGISTER:
1669 { 1671 {
1670 struct v4l2_dbg_register *p = arg; 1672 struct v4l2_dbg_register *p = arg;
1671 1673
1672 if (!capable(CAP_SYS_ADMIN)) 1674 if (ops->vidioc_s_register) {
1673 ret = -EPERM; 1675 if (!capable(CAP_SYS_ADMIN))
1674 else if (ops->vidioc_s_register) 1676 ret = -EPERM;
1675 ret = ops->vidioc_s_register(file, fh, p); 1677 else
1678 ret = ops->vidioc_s_register(file, fh, p);
1679 }
1676 break; 1680 break;
1677 } 1681 }
1678#endif 1682#endif
diff --git a/drivers/media/video/w9966.c b/drivers/media/video/w9966.c
index 019ee206cbee..fa35639d0c15 100644
--- a/drivers/media/video/w9966.c
+++ b/drivers/media/video/w9966.c
@@ -937,6 +937,7 @@ static void w9966_term(struct w9966 *cam)
937 parport_unregister_device(cam->pdev); 937 parport_unregister_device(cam->pdev);
938 w9966_set_state(cam, W9966_STATE_PDEV, 0); 938 w9966_set_state(cam, W9966_STATE_PDEV, 0);
939 } 939 }
940 memset(cam, 0, sizeof(*cam));
940} 941}
941 942
942 943
diff --git a/drivers/media/video/zoran/zoran_card.c b/drivers/media/video/zoran/zoran_card.c
index 9cdc3bb15b15..9f2bac519647 100644
--- a/drivers/media/video/zoran/zoran_card.c
+++ b/drivers/media/video/zoran/zoran_card.c
@@ -1041,7 +1041,7 @@ zr36057_init (struct zoran *zr)
1041 /* allocate memory *before* doing anything to the hardware 1041 /* allocate memory *before* doing anything to the hardware
1042 * in case allocation fails */ 1042 * in case allocation fails */
1043 zr->stat_com = kzalloc(BUZ_NUM_STAT_COM * 4, GFP_KERNEL); 1043 zr->stat_com = kzalloc(BUZ_NUM_STAT_COM * 4, GFP_KERNEL);
1044 zr->video_dev = kmalloc(sizeof(struct video_device), GFP_KERNEL); 1044 zr->video_dev = video_device_alloc();
1045 if (!zr->stat_com || !zr->video_dev) { 1045 if (!zr->stat_com || !zr->video_dev) {
1046 dprintk(1, 1046 dprintk(1,
1047 KERN_ERR 1047 KERN_ERR
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 16fe4f9b719b..03823327db25 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2864,7 +2864,7 @@ config MLX4_CORE
2864 default n 2864 default n
2865 2865
2866config MLX4_DEBUG 2866config MLX4_DEBUG
2867 bool "Verbose debugging output" if (MLX4_CORE && EMBEDDED) 2867 bool "Verbose debugging output" if (MLX4_CORE && EXPERT)
2868 depends on MLX4_CORE 2868 depends on MLX4_CORE
2869 default y 2869 default y
2870 ---help--- 2870 ---help---
diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h
index a6cd335c9436..8e4183717d91 100644
--- a/drivers/net/bnx2x/bnx2x.h
+++ b/drivers/net/bnx2x/bnx2x.h
@@ -22,8 +22,8 @@
22 * (you will need to reboot afterwards) */ 22 * (you will need to reboot afterwards) */
23/* #define BNX2X_STOP_ON_ERROR */ 23/* #define BNX2X_STOP_ON_ERROR */
24 24
25#define DRV_MODULE_VERSION "1.62.00-3" 25#define DRV_MODULE_VERSION "1.62.00-4"
26#define DRV_MODULE_RELDATE "2010/12/21" 26#define DRV_MODULE_RELDATE "2011/01/18"
27#define BNX2X_BC_VER 0x040200 27#define BNX2X_BC_VER 0x040200
28 28
29#define BNX2X_MULTI_QUEUE 29#define BNX2X_MULTI_QUEUE
diff --git a/drivers/net/bnx2x/bnx2x_hsi.h b/drivers/net/bnx2x/bnx2x_hsi.h
index 6238d4f63989..548f5631c0dc 100644
--- a/drivers/net/bnx2x/bnx2x_hsi.h
+++ b/drivers/net/bnx2x/bnx2x_hsi.h
@@ -352,6 +352,10 @@ struct port_hw_cfg { /* port 0: 0x12c port 1: 0x2bc */
352#define PORT_HW_CFG_LANE_SWAP_CFG_31203120 0x0000d8d8 352#define PORT_HW_CFG_LANE_SWAP_CFG_31203120 0x0000d8d8
353 /* forced only */ 353 /* forced only */
354#define PORT_HW_CFG_LANE_SWAP_CFG_32103210 0x0000e4e4 354#define PORT_HW_CFG_LANE_SWAP_CFG_32103210 0x0000e4e4
355 /* Indicate whether to swap the external phy polarity */
356#define PORT_HW_CFG_SWAP_PHY_POLARITY_MASK 0x00010000
357#define PORT_HW_CFG_SWAP_PHY_POLARITY_DISABLED 0x00000000
358#define PORT_HW_CFG_SWAP_PHY_POLARITY_ENABLED 0x00010000
355 359
356 u32 external_phy_config; 360 u32 external_phy_config;
357#define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_MASK 0xff000000 361#define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_MASK 0xff000000
diff --git a/drivers/net/bnx2x/bnx2x_link.c b/drivers/net/bnx2x/bnx2x_link.c
index 43b0de24f391..7160ec51093e 100644
--- a/drivers/net/bnx2x/bnx2x_link.c
+++ b/drivers/net/bnx2x/bnx2x_link.c
@@ -1573,7 +1573,7 @@ static void bnx2x_set_aer_mmd_xgxs(struct link_params *params,
1573 1573
1574 offset = phy->addr + ser_lane; 1574 offset = phy->addr + ser_lane;
1575 if (CHIP_IS_E2(bp)) 1575 if (CHIP_IS_E2(bp))
1576 aer_val = 0x2800 + offset - 1; 1576 aer_val = 0x3800 + offset - 1;
1577 else 1577 else
1578 aer_val = 0x3800 + offset; 1578 aer_val = 0x3800 + offset;
1579 CL45_WR_OVER_CL22(bp, phy, 1579 CL45_WR_OVER_CL22(bp, phy,
@@ -3166,7 +3166,23 @@ u8 bnx2x_set_led(struct link_params *params,
3166 if (!vars->link_up) 3166 if (!vars->link_up)
3167 break; 3167 break;
3168 case LED_MODE_ON: 3168 case LED_MODE_ON:
3169 if (SINGLE_MEDIA_DIRECT(params)) { 3169 if (params->phy[EXT_PHY1].type ==
3170 PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727 &&
3171 CHIP_IS_E2(bp) && params->num_phys == 2) {
3172 /**
3173 * This is a work-around for E2+8727 Configurations
3174 */
3175 if (mode == LED_MODE_ON ||
3176 speed == SPEED_10000){
3177 REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, 0);
3178 REG_WR(bp, NIG_REG_LED_10G_P0 + port*4, 1);
3179
3180 tmp = EMAC_RD(bp, EMAC_REG_EMAC_LED);
3181 EMAC_WR(bp, EMAC_REG_EMAC_LED,
3182 (tmp | EMAC_LED_OVERRIDE));
3183 return rc;
3184 }
3185 } else if (SINGLE_MEDIA_DIRECT(params)) {
3170 /** 3186 /**
3171 * This is a work-around for HW issue found when link 3187 * This is a work-around for HW issue found when link
3172 * is up in CL73 3188 * is up in CL73
@@ -3854,11 +3870,14 @@ static void bnx2x_8073_resolve_fc(struct bnx2x_phy *phy,
3854 pause_result); 3870 pause_result);
3855 } 3871 }
3856} 3872}
3857 3873static u8 bnx2x_8073_8727_external_rom_boot(struct bnx2x *bp,
3858static void bnx2x_8073_8727_external_rom_boot(struct bnx2x *bp,
3859 struct bnx2x_phy *phy, 3874 struct bnx2x_phy *phy,
3860 u8 port) 3875 u8 port)
3861{ 3876{
3877 u32 count = 0;
3878 u16 fw_ver1, fw_msgout;
3879 u8 rc = 0;
3880
3862 /* Boot port from external ROM */ 3881 /* Boot port from external ROM */
3863 /* EDC grst */ 3882 /* EDC grst */
3864 bnx2x_cl45_write(bp, phy, 3883 bnx2x_cl45_write(bp, phy,
@@ -3888,14 +3907,45 @@ static void bnx2x_8073_8727_external_rom_boot(struct bnx2x *bp,
3888 MDIO_PMA_REG_GEN_CTRL, 3907 MDIO_PMA_REG_GEN_CTRL,
3889 MDIO_PMA_REG_GEN_CTRL_ROM_RESET_INTERNAL_MP); 3908 MDIO_PMA_REG_GEN_CTRL_ROM_RESET_INTERNAL_MP);
3890 3909
3891 /* wait for 120ms for code download via SPI port */ 3910 /* Delay 100ms per the PHY specifications */
3892 msleep(120); 3911 msleep(100);
3912
3913 /* 8073 sometimes taking longer to download */
3914 do {
3915 count++;
3916 if (count > 300) {
3917 DP(NETIF_MSG_LINK,
3918 "bnx2x_8073_8727_external_rom_boot port %x:"
3919 "Download failed. fw version = 0x%x\n",
3920 port, fw_ver1);
3921 rc = -EINVAL;
3922 break;
3923 }
3924
3925 bnx2x_cl45_read(bp, phy,
3926 MDIO_PMA_DEVAD,
3927 MDIO_PMA_REG_ROM_VER1, &fw_ver1);
3928 bnx2x_cl45_read(bp, phy,
3929 MDIO_PMA_DEVAD,
3930 MDIO_PMA_REG_M8051_MSGOUT_REG, &fw_msgout);
3931
3932 msleep(1);
3933 } while (fw_ver1 == 0 || fw_ver1 == 0x4321 ||
3934 ((fw_msgout & 0xff) != 0x03 && (phy->type ==
3935 PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073)));
3893 3936
3894 /* Clear ser_boot_ctl bit */ 3937 /* Clear ser_boot_ctl bit */
3895 bnx2x_cl45_write(bp, phy, 3938 bnx2x_cl45_write(bp, phy,
3896 MDIO_PMA_DEVAD, 3939 MDIO_PMA_DEVAD,
3897 MDIO_PMA_REG_MISC_CTRL1, 0x0000); 3940 MDIO_PMA_REG_MISC_CTRL1, 0x0000);
3898 bnx2x_save_bcm_spirom_ver(bp, phy, port); 3941 bnx2x_save_bcm_spirom_ver(bp, phy, port);
3942
3943 DP(NETIF_MSG_LINK,
3944 "bnx2x_8073_8727_external_rom_boot port %x:"
3945 "Download complete. fw version = 0x%x\n",
3946 port, fw_ver1);
3947
3948 return rc;
3899} 3949}
3900 3950
3901static void bnx2x_8073_set_xaui_low_power_mode(struct bnx2x *bp, 3951static void bnx2x_8073_set_xaui_low_power_mode(struct bnx2x *bp,
@@ -4108,6 +4158,25 @@ static u8 bnx2x_8073_config_init(struct bnx2x_phy *phy,
4108 4158
4109 DP(NETIF_MSG_LINK, "Before rom RX_ALARM(port1): 0x%x\n", tmp1); 4159 DP(NETIF_MSG_LINK, "Before rom RX_ALARM(port1): 0x%x\n", tmp1);
4110 4160
4161 /**
4162 * If this is forced speed, set to KR or KX (all other are not
4163 * supported)
4164 */
4165 /* Swap polarity if required - Must be done only in non-1G mode */
4166 if (params->lane_config & PORT_HW_CFG_SWAP_PHY_POLARITY_ENABLED) {
4167 /* Configure the 8073 to swap _P and _N of the KR lines */
4168 DP(NETIF_MSG_LINK, "Swapping polarity for the 8073\n");
4169 /* 10G Rx/Tx and 1G Tx signal polarity swap */
4170 bnx2x_cl45_read(bp, phy,
4171 MDIO_PMA_DEVAD,
4172 MDIO_PMA_REG_8073_OPT_DIGITAL_CTRL, &val);
4173 bnx2x_cl45_write(bp, phy,
4174 MDIO_PMA_DEVAD,
4175 MDIO_PMA_REG_8073_OPT_DIGITAL_CTRL,
4176 (val | (3<<9)));
4177 }
4178
4179
4111 /* Enable CL37 BAM */ 4180 /* Enable CL37 BAM */
4112 if (REG_RD(bp, params->shmem_base + 4181 if (REG_RD(bp, params->shmem_base +
4113 offsetof(struct shmem_region, dev_info. 4182 offsetof(struct shmem_region, dev_info.
@@ -4314,8 +4383,32 @@ static u8 bnx2x_8073_read_status(struct bnx2x_phy *phy,
4314 } 4383 }
4315 4384
4316 if (link_up) { 4385 if (link_up) {
4386 /* Swap polarity if required */
4387 if (params->lane_config &
4388 PORT_HW_CFG_SWAP_PHY_POLARITY_ENABLED) {
4389 /* Configure the 8073 to swap P and N of the KR lines */
4390 bnx2x_cl45_read(bp, phy,
4391 MDIO_XS_DEVAD,
4392 MDIO_XS_REG_8073_RX_CTRL_PCIE, &val1);
4393 /**
4394 * Set bit 3 to invert Rx in 1G mode and clear this bit
4395 * when it`s in 10G mode.
4396 */
4397 if (vars->line_speed == SPEED_1000) {
4398 DP(NETIF_MSG_LINK, "Swapping 1G polarity for"
4399 "the 8073\n");
4400 val1 |= (1<<3);
4401 } else
4402 val1 &= ~(1<<3);
4403
4404 bnx2x_cl45_write(bp, phy,
4405 MDIO_XS_DEVAD,
4406 MDIO_XS_REG_8073_RX_CTRL_PCIE,
4407 val1);
4408 }
4317 bnx2x_ext_phy_10G_an_resolve(bp, phy, vars); 4409 bnx2x_ext_phy_10G_an_resolve(bp, phy, vars);
4318 bnx2x_8073_resolve_fc(phy, params, vars); 4410 bnx2x_8073_resolve_fc(phy, params, vars);
4411 vars->duplex = DUPLEX_FULL;
4319 } 4412 }
4320 return link_up; 4413 return link_up;
4321} 4414}
@@ -5062,6 +5155,7 @@ static u8 bnx2x_8706_8726_read_status(struct bnx2x_phy *phy,
5062 else 5155 else
5063 vars->line_speed = SPEED_10000; 5156 vars->line_speed = SPEED_10000;
5064 bnx2x_ext_phy_resolve_fc(phy, params, vars); 5157 bnx2x_ext_phy_resolve_fc(phy, params, vars);
5158 vars->duplex = DUPLEX_FULL;
5065 } 5159 }
5066 return link_up; 5160 return link_up;
5067} 5161}
@@ -5758,8 +5852,11 @@ static u8 bnx2x_8727_read_status(struct bnx2x_phy *phy,
5758 DP(NETIF_MSG_LINK, "port %x: External link is down\n", 5852 DP(NETIF_MSG_LINK, "port %x: External link is down\n",
5759 params->port); 5853 params->port);
5760 } 5854 }
5761 if (link_up) 5855 if (link_up) {
5762 bnx2x_ext_phy_resolve_fc(phy, params, vars); 5856 bnx2x_ext_phy_resolve_fc(phy, params, vars);
5857 vars->duplex = DUPLEX_FULL;
5858 DP(NETIF_MSG_LINK, "duplex = 0x%x\n", vars->duplex);
5859 }
5763 5860
5764 if ((DUAL_MEDIA(params)) && 5861 if ((DUAL_MEDIA(params)) &&
5765 (phy->req_line_speed == SPEED_1000)) { 5862 (phy->req_line_speed == SPEED_1000)) {
@@ -5875,10 +5972,26 @@ static void bnx2x_848xx_set_led(struct bnx2x *bp,
5875 MDIO_PMA_REG_8481_LED2_MASK, 5972 MDIO_PMA_REG_8481_LED2_MASK,
5876 0x18); 5973 0x18);
5877 5974
5975 /* Select activity source by Tx and Rx, as suggested by PHY AE */
5878 bnx2x_cl45_write(bp, phy, 5976 bnx2x_cl45_write(bp, phy,
5879 MDIO_PMA_DEVAD, 5977 MDIO_PMA_DEVAD,
5880 MDIO_PMA_REG_8481_LED3_MASK, 5978 MDIO_PMA_REG_8481_LED3_MASK,
5881 0x0040); 5979 0x0006);
5980
5981 /* Select the closest activity blink rate to that in 10/100/1000 */
5982 bnx2x_cl45_write(bp, phy,
5983 MDIO_PMA_DEVAD,
5984 MDIO_PMA_REG_8481_LED3_BLINK,
5985 0);
5986
5987 bnx2x_cl45_read(bp, phy,
5988 MDIO_PMA_DEVAD,
5989 MDIO_PMA_REG_84823_CTL_LED_CTL_1, &val);
5990 val |= MDIO_PMA_REG_84823_LED3_STRETCH_EN; /* stretch_en for LED3*/
5991
5992 bnx2x_cl45_write(bp, phy,
5993 MDIO_PMA_DEVAD,
5994 MDIO_PMA_REG_84823_CTL_LED_CTL_1, val);
5882 5995
5883 /* 'Interrupt Mask' */ 5996 /* 'Interrupt Mask' */
5884 bnx2x_cl45_write(bp, phy, 5997 bnx2x_cl45_write(bp, phy,
@@ -6126,6 +6239,7 @@ static u8 bnx2x_848xx_read_status(struct bnx2x_phy *phy,
6126 /* Check link 10G */ 6239 /* Check link 10G */
6127 if (val2 & (1<<11)) { 6240 if (val2 & (1<<11)) {
6128 vars->line_speed = SPEED_10000; 6241 vars->line_speed = SPEED_10000;
6242 vars->duplex = DUPLEX_FULL;
6129 link_up = 1; 6243 link_up = 1;
6130 bnx2x_ext_phy_10G_an_resolve(bp, phy, vars); 6244 bnx2x_ext_phy_10G_an_resolve(bp, phy, vars);
6131 } else { /* Check Legacy speed link */ 6245 } else { /* Check Legacy speed link */
@@ -6489,6 +6603,7 @@ static u8 bnx2x_7101_read_status(struct bnx2x_phy *phy,
6489 MDIO_AN_DEVAD, MDIO_AN_REG_MASTER_STATUS, 6603 MDIO_AN_DEVAD, MDIO_AN_REG_MASTER_STATUS,
6490 &val2); 6604 &val2);
6491 vars->line_speed = SPEED_10000; 6605 vars->line_speed = SPEED_10000;
6606 vars->duplex = DUPLEX_FULL;
6492 DP(NETIF_MSG_LINK, "SFX7101 AN status 0x%x->Master=%x\n", 6607 DP(NETIF_MSG_LINK, "SFX7101 AN status 0x%x->Master=%x\n",
6493 val2, (val2 & (1<<14))); 6608 val2, (val2 & (1<<14)));
6494 bnx2x_ext_phy_10G_an_resolve(bp, phy, vars); 6609 bnx2x_ext_phy_10G_an_resolve(bp, phy, vars);
@@ -7663,7 +7778,6 @@ static u8 bnx2x_8073_common_init_phy(struct bnx2x *bp,
7663 7778
7664 /* PART2 - Download firmware to both phys */ 7779 /* PART2 - Download firmware to both phys */
7665 for (port = PORT_MAX - 1; port >= PORT_0; port--) { 7780 for (port = PORT_MAX - 1; port >= PORT_0; port--) {
7666 u16 fw_ver1;
7667 if (CHIP_IS_E2(bp)) 7781 if (CHIP_IS_E2(bp))
7668 port_of_path = 0; 7782 port_of_path = 0;
7669 else 7783 else
@@ -7671,19 +7785,9 @@ static u8 bnx2x_8073_common_init_phy(struct bnx2x *bp,
7671 7785
7672 DP(NETIF_MSG_LINK, "Loading spirom for phy address 0x%x\n", 7786 DP(NETIF_MSG_LINK, "Loading spirom for phy address 0x%x\n",
7673 phy_blk[port]->addr); 7787 phy_blk[port]->addr);
7674 bnx2x_8073_8727_external_rom_boot(bp, phy_blk[port], 7788 if (bnx2x_8073_8727_external_rom_boot(bp, phy_blk[port],
7675 port_of_path); 7789 port_of_path))
7676
7677 bnx2x_cl45_read(bp, phy_blk[port],
7678 MDIO_PMA_DEVAD,
7679 MDIO_PMA_REG_ROM_VER1, &fw_ver1);
7680 if (fw_ver1 == 0 || fw_ver1 == 0x4321) {
7681 DP(NETIF_MSG_LINK,
7682 "bnx2x_8073_common_init_phy port %x:"
7683 "Download failed. fw version = 0x%x\n",
7684 port, fw_ver1);
7685 return -EINVAL; 7790 return -EINVAL;
7686 }
7687 7791
7688 /* Only set bit 10 = 1 (Tx power down) */ 7792 /* Only set bit 10 = 1 (Tx power down) */
7689 bnx2x_cl45_read(bp, phy_blk[port], 7793 bnx2x_cl45_read(bp, phy_blk[port],
@@ -7848,27 +7952,17 @@ static u8 bnx2x_8727_common_init_phy(struct bnx2x *bp,
7848 } 7952 }
7849 /* PART2 - Download firmware to both phys */ 7953 /* PART2 - Download firmware to both phys */
7850 for (port = PORT_MAX - 1; port >= PORT_0; port--) { 7954 for (port = PORT_MAX - 1; port >= PORT_0; port--) {
7851 u16 fw_ver1;
7852 if (CHIP_IS_E2(bp)) 7955 if (CHIP_IS_E2(bp))
7853 port_of_path = 0; 7956 port_of_path = 0;
7854 else 7957 else
7855 port_of_path = port; 7958 port_of_path = port;
7856 DP(NETIF_MSG_LINK, "Loading spirom for phy address 0x%x\n", 7959 DP(NETIF_MSG_LINK, "Loading spirom for phy address 0x%x\n",
7857 phy_blk[port]->addr); 7960 phy_blk[port]->addr);
7858 bnx2x_8073_8727_external_rom_boot(bp, phy_blk[port], 7961 if (bnx2x_8073_8727_external_rom_boot(bp, phy_blk[port],
7859 port_of_path); 7962 port_of_path))
7860 bnx2x_cl45_read(bp, phy_blk[port],
7861 MDIO_PMA_DEVAD,
7862 MDIO_PMA_REG_ROM_VER1, &fw_ver1);
7863 if (fw_ver1 == 0 || fw_ver1 == 0x4321) {
7864 DP(NETIF_MSG_LINK,
7865 "bnx2x_8727_common_init_phy port %x:"
7866 "Download failed. fw version = 0x%x\n",
7867 port, fw_ver1);
7868 return -EINVAL; 7963 return -EINVAL;
7869 }
7870 }
7871 7964
7965 }
7872 return 0; 7966 return 0;
7873} 7967}
7874 7968
@@ -7916,6 +8010,7 @@ u8 bnx2x_common_init_phy(struct bnx2x *bp, u32 shmem_base_path[],
7916 u32 shmem2_base_path[], u32 chip_id) 8010 u32 shmem2_base_path[], u32 chip_id)
7917{ 8011{
7918 u8 rc = 0; 8012 u8 rc = 0;
8013 u32 phy_ver;
7919 u8 phy_index; 8014 u8 phy_index;
7920 u32 ext_phy_type, ext_phy_config; 8015 u32 ext_phy_type, ext_phy_config;
7921 DP(NETIF_MSG_LINK, "Begin common phy init\n"); 8016 DP(NETIF_MSG_LINK, "Begin common phy init\n");
@@ -7923,6 +8018,16 @@ u8 bnx2x_common_init_phy(struct bnx2x *bp, u32 shmem_base_path[],
7923 if (CHIP_REV_IS_EMUL(bp)) 8018 if (CHIP_REV_IS_EMUL(bp))
7924 return 0; 8019 return 0;
7925 8020
8021 /* Check if common init was already done */
8022 phy_ver = REG_RD(bp, shmem_base_path[0] +
8023 offsetof(struct shmem_region,
8024 port_mb[PORT_0].ext_phy_fw_version));
8025 if (phy_ver) {
8026 DP(NETIF_MSG_LINK, "Not doing common init; phy ver is 0x%x\n",
8027 phy_ver);
8028 return 0;
8029 }
8030
7926 /* Read the ext_phy_type for arbitrary port(0) */ 8031 /* Read the ext_phy_type for arbitrary port(0) */
7927 for (phy_index = EXT_PHY1; phy_index < MAX_PHYS; 8032 for (phy_index = EXT_PHY1; phy_index < MAX_PHYS;
7928 phy_index++) { 8033 phy_index++) {
diff --git a/drivers/net/bnx2x/bnx2x_reg.h b/drivers/net/bnx2x/bnx2x_reg.h
index c939683e3d61..e01330bb36c7 100644
--- a/drivers/net/bnx2x/bnx2x_reg.h
+++ b/drivers/net/bnx2x/bnx2x_reg.h
@@ -6194,7 +6194,11 @@ Theotherbitsarereservedandshouldbezero*/
6194#define MDIO_CTL_REG_84823_MEDIA_PRIORITY_COPPER 0x0000 6194#define MDIO_CTL_REG_84823_MEDIA_PRIORITY_COPPER 0x0000
6195#define MDIO_CTL_REG_84823_MEDIA_PRIORITY_FIBER 0x0100 6195#define MDIO_CTL_REG_84823_MEDIA_PRIORITY_FIBER 0x0100
6196#define MDIO_CTL_REG_84823_MEDIA_FIBER_1G 0x1000 6196#define MDIO_CTL_REG_84823_MEDIA_FIBER_1G 0x1000
6197#define MDIO_CTL_REG_84823_USER_CTRL_REG 0x4005
6198#define MDIO_CTL_REG_84823_USER_CTRL_CMS 0x0080
6197 6199
6200#define MDIO_PMA_REG_84823_CTL_LED_CTL_1 0xa8e3
6201#define MDIO_PMA_REG_84823_LED3_STRETCH_EN 0x0080
6198 6202
6199#define IGU_FUNC_BASE 0x0400 6203#define IGU_FUNC_BASE 0x0400
6200 6204
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 119aa2000c24..5ed8f9f9419f 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -1920,7 +1920,7 @@ int startup_gfar(struct net_device *ndev)
1920 if (err) { 1920 if (err) {
1921 for (j = 0; j < i; j++) 1921 for (j = 0; j < i; j++)
1922 free_grp_irqs(&priv->gfargrp[j]); 1922 free_grp_irqs(&priv->gfargrp[j]);
1923 goto irq_fail; 1923 goto irq_fail;
1924 } 1924 }
1925 } 1925 }
1926 1926
diff --git a/drivers/net/irda/sh_irda.c b/drivers/net/irda/sh_irda.c
index 9e3f4f54281d..4488bd581eca 100644
--- a/drivers/net/irda/sh_irda.c
+++ b/drivers/net/irda/sh_irda.c
@@ -635,7 +635,7 @@ static int sh_irda_hard_xmit(struct sk_buff *skb, struct net_device *ndev)
635 635
636 ret = sh_irda_set_baudrate(self, speed); 636 ret = sh_irda_set_baudrate(self, speed);
637 if (ret < 0) 637 if (ret < 0)
638 return ret; 638 goto sh_irda_hard_xmit_end;
639 639
640 self->tx_buff.len = 0; 640 self->tx_buff.len = 0;
641 if (skb->len) { 641 if (skb->len) {
@@ -652,11 +652,21 @@ static int sh_irda_hard_xmit(struct sk_buff *skb, struct net_device *ndev)
652 652
653 sh_irda_write(self, IRTFLR, self->tx_buff.len); 653 sh_irda_write(self, IRTFLR, self->tx_buff.len);
654 sh_irda_write(self, IRTCTR, ARMOD | TE); 654 sh_irda_write(self, IRTCTR, ARMOD | TE);
655 } 655 } else
656 goto sh_irda_hard_xmit_end;
656 657
657 dev_kfree_skb(skb); 658 dev_kfree_skb(skb);
658 659
659 return 0; 660 return 0;
661
662sh_irda_hard_xmit_end:
663 sh_irda_set_baudrate(self, 9600);
664 netif_wake_queue(self->ndev);
665 sh_irda_rcv_ctrl(self, 1);
666 dev_kfree_skb(skb);
667
668 return ret;
669
660} 670}
661 671
662static int sh_irda_ioctl(struct net_device *ndev, struct ifreq *ifreq, int cmd) 672static int sh_irda_ioctl(struct net_device *ndev, struct ifreq *ifreq, int cmd)
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c
index 84134c766f3a..a41b2cf4d917 100644
--- a/drivers/net/ns83820.c
+++ b/drivers/net/ns83820.c
@@ -1988,12 +1988,11 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev,
1988 } 1988 }
1989 1989
1990 ndev = alloc_etherdev(sizeof(struct ns83820)); 1990 ndev = alloc_etherdev(sizeof(struct ns83820));
1991 dev = PRIV(ndev);
1992
1993 err = -ENOMEM; 1991 err = -ENOMEM;
1994 if (!dev) 1992 if (!ndev)
1995 goto out; 1993 goto out;
1996 1994
1995 dev = PRIV(ndev);
1997 dev->ndev = ndev; 1996 dev->ndev = ndev;
1998 1997
1999 spin_lock_init(&dev->rx_info.lock); 1998 spin_lock_init(&dev->rx_info.lock);
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index d776c4a8d3c1..04e8ce14a1d0 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -54,7 +54,7 @@
54#include <linux/usb/usbnet.h> 54#include <linux/usb/usbnet.h>
55#include <linux/usb/cdc.h> 55#include <linux/usb/cdc.h>
56 56
57#define DRIVER_VERSION "30-Nov-2010" 57#define DRIVER_VERSION "17-Jan-2011"
58 58
59/* CDC NCM subclass 3.2.1 */ 59/* CDC NCM subclass 3.2.1 */
60#define USB_CDC_NCM_NDP16_LENGTH_MIN 0x10 60#define USB_CDC_NCM_NDP16_LENGTH_MIN 0x10
@@ -868,15 +868,19 @@ static void cdc_ncm_tx_timeout(unsigned long arg)
868 if (ctx->tx_timer_pending != 0) { 868 if (ctx->tx_timer_pending != 0) {
869 ctx->tx_timer_pending--; 869 ctx->tx_timer_pending--;
870 restart = 1; 870 restart = 1;
871 } else 871 } else {
872 restart = 0; 872 restart = 0;
873 }
873 874
874 spin_unlock(&ctx->mtx); 875 spin_unlock(&ctx->mtx);
875 876
876 if (restart) 877 if (restart) {
878 spin_lock(&ctx->mtx);
877 cdc_ncm_tx_timeout_start(ctx); 879 cdc_ncm_tx_timeout_start(ctx);
878 else if (ctx->netdev != NULL) 880 spin_unlock(&ctx->mtx);
881 } else if (ctx->netdev != NULL) {
879 usbnet_start_xmit(NULL, ctx->netdev); 882 usbnet_start_xmit(NULL, ctx->netdev);
883 }
880} 884}
881 885
882static struct sk_buff * 886static struct sk_buff *
@@ -900,7 +904,6 @@ cdc_ncm_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags)
900 skb_out = cdc_ncm_fill_tx_frame(ctx, skb); 904 skb_out = cdc_ncm_fill_tx_frame(ctx, skb);
901 if (ctx->tx_curr_skb != NULL) 905 if (ctx->tx_curr_skb != NULL)
902 need_timer = 1; 906 need_timer = 1;
903 spin_unlock(&ctx->mtx);
904 907
905 /* Start timer, if there is a remaining skb */ 908 /* Start timer, if there is a remaining skb */
906 if (need_timer) 909 if (need_timer)
@@ -908,6 +911,8 @@ cdc_ncm_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags)
908 911
909 if (skb_out) 912 if (skb_out)
910 dev->net->stats.tx_packets += ctx->tx_curr_frame_num; 913 dev->net->stats.tx_packets += ctx->tx_curr_frame_num;
914
915 spin_unlock(&ctx->mtx);
911 return skb_out; 916 return skb_out;
912 917
913error: 918error:
@@ -1020,8 +1025,8 @@ static int cdc_ncm_rx_fixup(struct usbnet *dev, struct sk_buff *skb_in)
1020 if (((offset + temp) > actlen) || 1025 if (((offset + temp) > actlen) ||
1021 (temp > CDC_NCM_MAX_DATAGRAM_SIZE) || (temp < ETH_HLEN)) { 1026 (temp > CDC_NCM_MAX_DATAGRAM_SIZE) || (temp < ETH_HLEN)) {
1022 pr_debug("invalid frame detected (ignored)" 1027 pr_debug("invalid frame detected (ignored)"
1023 "offset[%u]=%u, length=%u, skb=%p\n", 1028 "offset[%u]=%u, length=%u, skb=%p\n",
1024 x, offset, temp, skb_in); 1029 x, offset, temp, skb_in);
1025 if (!x) 1030 if (!x)
1026 goto error; 1031 goto error;
1027 break; 1032 break;
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index d143e8b72b5b..cc14b4a75048 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -48,6 +48,9 @@ static atomic_t devices_found;
48static int enable_mq = 1; 48static int enable_mq = 1;
49static int irq_share_mode; 49static int irq_share_mode;
50 50
51static void
52vmxnet3_write_mac_addr(struct vmxnet3_adapter *adapter, u8 *mac);
53
51/* 54/*
52 * Enable/Disable the given intr 55 * Enable/Disable the given intr
53 */ 56 */
@@ -139,9 +142,13 @@ vmxnet3_check_link(struct vmxnet3_adapter *adapter, bool affectTxQueue)
139{ 142{
140 u32 ret; 143 u32 ret;
141 int i; 144 int i;
145 unsigned long flags;
142 146
147 spin_lock_irqsave(&adapter->cmd_lock, flags);
143 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_LINK); 148 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_LINK);
144 ret = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD); 149 ret = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD);
150 spin_unlock_irqrestore(&adapter->cmd_lock, flags);
151
145 adapter->link_speed = ret >> 16; 152 adapter->link_speed = ret >> 16;
146 if (ret & 1) { /* Link is up. */ 153 if (ret & 1) { /* Link is up. */
147 printk(KERN_INFO "%s: NIC Link is Up %d Mbps\n", 154 printk(KERN_INFO "%s: NIC Link is Up %d Mbps\n",
@@ -183,8 +190,10 @@ vmxnet3_process_events(struct vmxnet3_adapter *adapter)
183 190
184 /* Check if there is an error on xmit/recv queues */ 191 /* Check if there is an error on xmit/recv queues */
185 if (events & (VMXNET3_ECR_TQERR | VMXNET3_ECR_RQERR)) { 192 if (events & (VMXNET3_ECR_TQERR | VMXNET3_ECR_RQERR)) {
193 spin_lock(&adapter->cmd_lock);
186 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, 194 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
187 VMXNET3_CMD_GET_QUEUE_STATUS); 195 VMXNET3_CMD_GET_QUEUE_STATUS);
196 spin_unlock(&adapter->cmd_lock);
188 197
189 for (i = 0; i < adapter->num_tx_queues; i++) 198 for (i = 0; i < adapter->num_tx_queues; i++)
190 if (adapter->tqd_start[i].status.stopped) 199 if (adapter->tqd_start[i].status.stopped)
@@ -804,30 +813,25 @@ vmxnet3_parse_and_copy_hdr(struct sk_buff *skb, struct vmxnet3_tx_queue *tq,
804 skb_transport_header(skb))->doff * 4; 813 skb_transport_header(skb))->doff * 4;
805 ctx->copy_size = ctx->eth_ip_hdr_size + ctx->l4_hdr_size; 814 ctx->copy_size = ctx->eth_ip_hdr_size + ctx->l4_hdr_size;
806 } else { 815 } else {
807 unsigned int pull_size;
808
809 if (skb->ip_summed == CHECKSUM_PARTIAL) { 816 if (skb->ip_summed == CHECKSUM_PARTIAL) {
810 ctx->eth_ip_hdr_size = skb_checksum_start_offset(skb); 817 ctx->eth_ip_hdr_size = skb_checksum_start_offset(skb);
811 818
812 if (ctx->ipv4) { 819 if (ctx->ipv4) {
813 struct iphdr *iph = (struct iphdr *) 820 struct iphdr *iph = (struct iphdr *)
814 skb_network_header(skb); 821 skb_network_header(skb);
815 if (iph->protocol == IPPROTO_TCP) { 822 if (iph->protocol == IPPROTO_TCP)
816 pull_size = ctx->eth_ip_hdr_size +
817 sizeof(struct tcphdr);
818
819 if (unlikely(!pskb_may_pull(skb,
820 pull_size))) {
821 goto err;
822 }
823 ctx->l4_hdr_size = ((struct tcphdr *) 823 ctx->l4_hdr_size = ((struct tcphdr *)
824 skb_transport_header(skb))->doff * 4; 824 skb_transport_header(skb))->doff * 4;
825 } else if (iph->protocol == IPPROTO_UDP) { 825 else if (iph->protocol == IPPROTO_UDP)
826 /*
827 * Use tcp header size so that bytes to
828 * be copied are more than required by
829 * the device.
830 */
826 ctx->l4_hdr_size = 831 ctx->l4_hdr_size =
827 sizeof(struct udphdr); 832 sizeof(struct tcphdr);
828 } else { 833 else
829 ctx->l4_hdr_size = 0; 834 ctx->l4_hdr_size = 0;
830 }
831 } else { 835 } else {
832 /* for simplicity, don't copy L4 headers */ 836 /* for simplicity, don't copy L4 headers */
833 ctx->l4_hdr_size = 0; 837 ctx->l4_hdr_size = 0;
@@ -1859,18 +1863,14 @@ vmxnet3_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
1859 struct vmxnet3_adapter *adapter = netdev_priv(netdev); 1863 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
1860 struct Vmxnet3_DriverShared *shared = adapter->shared; 1864 struct Vmxnet3_DriverShared *shared = adapter->shared;
1861 u32 *vfTable = adapter->shared->devRead.rxFilterConf.vfTable; 1865 u32 *vfTable = adapter->shared->devRead.rxFilterConf.vfTable;
1866 unsigned long flags;
1862 1867
1863 if (grp) { 1868 if (grp) {
1864 /* add vlan rx stripping. */ 1869 /* add vlan rx stripping. */
1865 if (adapter->netdev->features & NETIF_F_HW_VLAN_RX) { 1870 if (adapter->netdev->features & NETIF_F_HW_VLAN_RX) {
1866 int i; 1871 int i;
1867 struct Vmxnet3_DSDevRead *devRead = &shared->devRead;
1868 adapter->vlan_grp = grp; 1872 adapter->vlan_grp = grp;
1869 1873
1870 /* update FEATURES to device */
1871 devRead->misc.uptFeatures |= UPT1_F_RXVLAN;
1872 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
1873 VMXNET3_CMD_UPDATE_FEATURE);
1874 /* 1874 /*
1875 * Clear entire vfTable; then enable untagged pkts. 1875 * Clear entire vfTable; then enable untagged pkts.
1876 * Note: setting one entry in vfTable to non-zero turns 1876 * Note: setting one entry in vfTable to non-zero turns
@@ -1880,8 +1880,10 @@ vmxnet3_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
1880 vfTable[i] = 0; 1880 vfTable[i] = 0;
1881 1881
1882 VMXNET3_SET_VFTABLE_ENTRY(vfTable, 0); 1882 VMXNET3_SET_VFTABLE_ENTRY(vfTable, 0);
1883 spin_lock_irqsave(&adapter->cmd_lock, flags);
1883 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, 1884 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
1884 VMXNET3_CMD_UPDATE_VLAN_FILTERS); 1885 VMXNET3_CMD_UPDATE_VLAN_FILTERS);
1886 spin_unlock_irqrestore(&adapter->cmd_lock, flags);
1885 } else { 1887 } else {
1886 printk(KERN_ERR "%s: vlan_rx_register when device has " 1888 printk(KERN_ERR "%s: vlan_rx_register when device has "
1887 "no NETIF_F_HW_VLAN_RX\n", netdev->name); 1889 "no NETIF_F_HW_VLAN_RX\n", netdev->name);
@@ -1900,13 +1902,10 @@ vmxnet3_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
1900 */ 1902 */
1901 vfTable[i] = 0; 1903 vfTable[i] = 0;
1902 } 1904 }
1905 spin_lock_irqsave(&adapter->cmd_lock, flags);
1903 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, 1906 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
1904 VMXNET3_CMD_UPDATE_VLAN_FILTERS); 1907 VMXNET3_CMD_UPDATE_VLAN_FILTERS);
1905 1908 spin_unlock_irqrestore(&adapter->cmd_lock, flags);
1906 /* update FEATURES to device */
1907 devRead->misc.uptFeatures &= ~UPT1_F_RXVLAN;
1908 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
1909 VMXNET3_CMD_UPDATE_FEATURE);
1910 } 1909 }
1911 } 1910 }
1912} 1911}
@@ -1939,10 +1938,13 @@ vmxnet3_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
1939{ 1938{
1940 struct vmxnet3_adapter *adapter = netdev_priv(netdev); 1939 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
1941 u32 *vfTable = adapter->shared->devRead.rxFilterConf.vfTable; 1940 u32 *vfTable = adapter->shared->devRead.rxFilterConf.vfTable;
1941 unsigned long flags;
1942 1942
1943 VMXNET3_SET_VFTABLE_ENTRY(vfTable, vid); 1943 VMXNET3_SET_VFTABLE_ENTRY(vfTable, vid);
1944 spin_lock_irqsave(&adapter->cmd_lock, flags);
1944 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, 1945 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
1945 VMXNET3_CMD_UPDATE_VLAN_FILTERS); 1946 VMXNET3_CMD_UPDATE_VLAN_FILTERS);
1947 spin_unlock_irqrestore(&adapter->cmd_lock, flags);
1946} 1948}
1947 1949
1948 1950
@@ -1951,10 +1953,13 @@ vmxnet3_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
1951{ 1953{
1952 struct vmxnet3_adapter *adapter = netdev_priv(netdev); 1954 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
1953 u32 *vfTable = adapter->shared->devRead.rxFilterConf.vfTable; 1955 u32 *vfTable = adapter->shared->devRead.rxFilterConf.vfTable;
1956 unsigned long flags;
1954 1957
1955 VMXNET3_CLEAR_VFTABLE_ENTRY(vfTable, vid); 1958 VMXNET3_CLEAR_VFTABLE_ENTRY(vfTable, vid);
1959 spin_lock_irqsave(&adapter->cmd_lock, flags);
1956 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, 1960 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
1957 VMXNET3_CMD_UPDATE_VLAN_FILTERS); 1961 VMXNET3_CMD_UPDATE_VLAN_FILTERS);
1962 spin_unlock_irqrestore(&adapter->cmd_lock, flags);
1958} 1963}
1959 1964
1960 1965
@@ -1985,6 +1990,7 @@ static void
1985vmxnet3_set_mc(struct net_device *netdev) 1990vmxnet3_set_mc(struct net_device *netdev)
1986{ 1991{
1987 struct vmxnet3_adapter *adapter = netdev_priv(netdev); 1992 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
1993 unsigned long flags;
1988 struct Vmxnet3_RxFilterConf *rxConf = 1994 struct Vmxnet3_RxFilterConf *rxConf =
1989 &adapter->shared->devRead.rxFilterConf; 1995 &adapter->shared->devRead.rxFilterConf;
1990 u8 *new_table = NULL; 1996 u8 *new_table = NULL;
@@ -2020,6 +2026,7 @@ vmxnet3_set_mc(struct net_device *netdev)
2020 rxConf->mfTablePA = 0; 2026 rxConf->mfTablePA = 0;
2021 } 2027 }
2022 2028
2029 spin_lock_irqsave(&adapter->cmd_lock, flags);
2023 if (new_mode != rxConf->rxMode) { 2030 if (new_mode != rxConf->rxMode) {
2024 rxConf->rxMode = cpu_to_le32(new_mode); 2031 rxConf->rxMode = cpu_to_le32(new_mode);
2025 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, 2032 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
@@ -2028,6 +2035,7 @@ vmxnet3_set_mc(struct net_device *netdev)
2028 2035
2029 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, 2036 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
2030 VMXNET3_CMD_UPDATE_MAC_FILTERS); 2037 VMXNET3_CMD_UPDATE_MAC_FILTERS);
2038 spin_unlock_irqrestore(&adapter->cmd_lock, flags);
2031 2039
2032 kfree(new_table); 2040 kfree(new_table);
2033} 2041}
@@ -2080,10 +2088,8 @@ vmxnet3_setup_driver_shared(struct vmxnet3_adapter *adapter)
2080 devRead->misc.uptFeatures |= UPT1_F_LRO; 2088 devRead->misc.uptFeatures |= UPT1_F_LRO;
2081 devRead->misc.maxNumRxSG = cpu_to_le16(1 + MAX_SKB_FRAGS); 2089 devRead->misc.maxNumRxSG = cpu_to_le16(1 + MAX_SKB_FRAGS);
2082 } 2090 }
2083 if ((adapter->netdev->features & NETIF_F_HW_VLAN_RX) && 2091 if (adapter->netdev->features & NETIF_F_HW_VLAN_RX)
2084 adapter->vlan_grp) {
2085 devRead->misc.uptFeatures |= UPT1_F_RXVLAN; 2092 devRead->misc.uptFeatures |= UPT1_F_RXVLAN;
2086 }
2087 2093
2088 devRead->misc.mtu = cpu_to_le32(adapter->netdev->mtu); 2094 devRead->misc.mtu = cpu_to_le32(adapter->netdev->mtu);
2089 devRead->misc.queueDescPA = cpu_to_le64(adapter->queue_desc_pa); 2095 devRead->misc.queueDescPA = cpu_to_le64(adapter->queue_desc_pa);
@@ -2168,6 +2174,8 @@ vmxnet3_setup_driver_shared(struct vmxnet3_adapter *adapter)
2168 /* rx filter settings */ 2174 /* rx filter settings */
2169 devRead->rxFilterConf.rxMode = 0; 2175 devRead->rxFilterConf.rxMode = 0;
2170 vmxnet3_restore_vlan(adapter); 2176 vmxnet3_restore_vlan(adapter);
2177 vmxnet3_write_mac_addr(adapter, adapter->netdev->dev_addr);
2178
2171 /* the rest are already zeroed */ 2179 /* the rest are already zeroed */
2172} 2180}
2173 2181
@@ -2177,6 +2185,7 @@ vmxnet3_activate_dev(struct vmxnet3_adapter *adapter)
2177{ 2185{
2178 int err, i; 2186 int err, i;
2179 u32 ret; 2187 u32 ret;
2188 unsigned long flags;
2180 2189
2181 dev_dbg(&adapter->netdev->dev, "%s: skb_buf_size %d, rx_buf_per_pkt %d," 2190 dev_dbg(&adapter->netdev->dev, "%s: skb_buf_size %d, rx_buf_per_pkt %d,"
2182 " ring sizes %u %u %u\n", adapter->netdev->name, 2191 " ring sizes %u %u %u\n", adapter->netdev->name,
@@ -2206,9 +2215,11 @@ vmxnet3_activate_dev(struct vmxnet3_adapter *adapter)
2206 adapter->shared_pa)); 2215 adapter->shared_pa));
2207 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_DSAH, VMXNET3_GET_ADDR_HI( 2216 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_DSAH, VMXNET3_GET_ADDR_HI(
2208 adapter->shared_pa)); 2217 adapter->shared_pa));
2218 spin_lock_irqsave(&adapter->cmd_lock, flags);
2209 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, 2219 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
2210 VMXNET3_CMD_ACTIVATE_DEV); 2220 VMXNET3_CMD_ACTIVATE_DEV);
2211 ret = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD); 2221 ret = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD);
2222 spin_unlock_irqrestore(&adapter->cmd_lock, flags);
2212 2223
2213 if (ret != 0) { 2224 if (ret != 0) {
2214 printk(KERN_ERR "Failed to activate dev %s: error %u\n", 2225 printk(KERN_ERR "Failed to activate dev %s: error %u\n",
@@ -2255,7 +2266,10 @@ rq_err:
2255void 2266void
2256vmxnet3_reset_dev(struct vmxnet3_adapter *adapter) 2267vmxnet3_reset_dev(struct vmxnet3_adapter *adapter)
2257{ 2268{
2269 unsigned long flags;
2270 spin_lock_irqsave(&adapter->cmd_lock, flags);
2258 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_RESET_DEV); 2271 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_RESET_DEV);
2272 spin_unlock_irqrestore(&adapter->cmd_lock, flags);
2259} 2273}
2260 2274
2261 2275
@@ -2263,12 +2277,15 @@ int
2263vmxnet3_quiesce_dev(struct vmxnet3_adapter *adapter) 2277vmxnet3_quiesce_dev(struct vmxnet3_adapter *adapter)
2264{ 2278{
2265 int i; 2279 int i;
2280 unsigned long flags;
2266 if (test_and_set_bit(VMXNET3_STATE_BIT_QUIESCED, &adapter->state)) 2281 if (test_and_set_bit(VMXNET3_STATE_BIT_QUIESCED, &adapter->state))
2267 return 0; 2282 return 0;
2268 2283
2269 2284
2285 spin_lock_irqsave(&adapter->cmd_lock, flags);
2270 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, 2286 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
2271 VMXNET3_CMD_QUIESCE_DEV); 2287 VMXNET3_CMD_QUIESCE_DEV);
2288 spin_unlock_irqrestore(&adapter->cmd_lock, flags);
2272 vmxnet3_disable_all_intrs(adapter); 2289 vmxnet3_disable_all_intrs(adapter);
2273 2290
2274 for (i = 0; i < adapter->num_rx_queues; i++) 2291 for (i = 0; i < adapter->num_rx_queues; i++)
@@ -2426,7 +2443,7 @@ vmxnet3_adjust_rx_ring_size(struct vmxnet3_adapter *adapter)
2426 sz = adapter->rx_buf_per_pkt * VMXNET3_RING_SIZE_ALIGN; 2443 sz = adapter->rx_buf_per_pkt * VMXNET3_RING_SIZE_ALIGN;
2427 ring0_size = adapter->rx_queue[0].rx_ring[0].size; 2444 ring0_size = adapter->rx_queue[0].rx_ring[0].size;
2428 ring0_size = (ring0_size + sz - 1) / sz * sz; 2445 ring0_size = (ring0_size + sz - 1) / sz * sz;
2429 ring0_size = min_t(u32, rq->rx_ring[0].size, VMXNET3_RX_RING_MAX_SIZE / 2446 ring0_size = min_t(u32, ring0_size, VMXNET3_RX_RING_MAX_SIZE /
2430 sz * sz); 2447 sz * sz);
2431 ring1_size = adapter->rx_queue[0].rx_ring[1].size; 2448 ring1_size = adapter->rx_queue[0].rx_ring[1].size;
2432 comp_size = ring0_size + ring1_size; 2449 comp_size = ring0_size + ring1_size;
@@ -2695,7 +2712,7 @@ vmxnet3_acquire_msix_vectors(struct vmxnet3_adapter *adapter,
2695 break; 2712 break;
2696 } else { 2713 } else {
2697 /* If fails to enable required number of MSI-x vectors 2714 /* If fails to enable required number of MSI-x vectors
2698 * try enabling 3 of them. One each for rx, tx and event 2715 * try enabling minimum number of vectors required.
2699 */ 2716 */
2700 vectors = vector_threshold; 2717 vectors = vector_threshold;
2701 printk(KERN_ERR "Failed to enable %d MSI-X for %s, try" 2718 printk(KERN_ERR "Failed to enable %d MSI-X for %s, try"
@@ -2718,9 +2735,11 @@ vmxnet3_alloc_intr_resources(struct vmxnet3_adapter *adapter)
2718 u32 cfg; 2735 u32 cfg;
2719 2736
2720 /* intr settings */ 2737 /* intr settings */
2738 spin_lock(&adapter->cmd_lock);
2721 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, 2739 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
2722 VMXNET3_CMD_GET_CONF_INTR); 2740 VMXNET3_CMD_GET_CONF_INTR);
2723 cfg = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD); 2741 cfg = VMXNET3_READ_BAR1_REG(adapter, VMXNET3_REG_CMD);
2742 spin_unlock(&adapter->cmd_lock);
2724 adapter->intr.type = cfg & 0x3; 2743 adapter->intr.type = cfg & 0x3;
2725 adapter->intr.mask_mode = (cfg >> 2) & 0x3; 2744 adapter->intr.mask_mode = (cfg >> 2) & 0x3;
2726 2745
@@ -2755,7 +2774,7 @@ vmxnet3_alloc_intr_resources(struct vmxnet3_adapter *adapter)
2755 */ 2774 */
2756 if (err == VMXNET3_LINUX_MIN_MSIX_VECT) { 2775 if (err == VMXNET3_LINUX_MIN_MSIX_VECT) {
2757 if (adapter->share_intr != VMXNET3_INTR_BUDDYSHARE 2776 if (adapter->share_intr != VMXNET3_INTR_BUDDYSHARE
2758 || adapter->num_rx_queues != 2) { 2777 || adapter->num_rx_queues != 1) {
2759 adapter->share_intr = VMXNET3_INTR_TXSHARE; 2778 adapter->share_intr = VMXNET3_INTR_TXSHARE;
2760 printk(KERN_ERR "Number of rx queues : 1\n"); 2779 printk(KERN_ERR "Number of rx queues : 1\n");
2761 adapter->num_rx_queues = 1; 2780 adapter->num_rx_queues = 1;
@@ -2905,6 +2924,7 @@ vmxnet3_probe_device(struct pci_dev *pdev,
2905 adapter->netdev = netdev; 2924 adapter->netdev = netdev;
2906 adapter->pdev = pdev; 2925 adapter->pdev = pdev;
2907 2926
2927 spin_lock_init(&adapter->cmd_lock);
2908 adapter->shared = pci_alloc_consistent(adapter->pdev, 2928 adapter->shared = pci_alloc_consistent(adapter->pdev,
2909 sizeof(struct Vmxnet3_DriverShared), 2929 sizeof(struct Vmxnet3_DriverShared),
2910 &adapter->shared_pa); 2930 &adapter->shared_pa);
@@ -3108,11 +3128,15 @@ vmxnet3_suspend(struct device *device)
3108 u8 *arpreq; 3128 u8 *arpreq;
3109 struct in_device *in_dev; 3129 struct in_device *in_dev;
3110 struct in_ifaddr *ifa; 3130 struct in_ifaddr *ifa;
3131 unsigned long flags;
3111 int i = 0; 3132 int i = 0;
3112 3133
3113 if (!netif_running(netdev)) 3134 if (!netif_running(netdev))
3114 return 0; 3135 return 0;
3115 3136
3137 for (i = 0; i < adapter->num_rx_queues; i++)
3138 napi_disable(&adapter->rx_queue[i].napi);
3139
3116 vmxnet3_disable_all_intrs(adapter); 3140 vmxnet3_disable_all_intrs(adapter);
3117 vmxnet3_free_irqs(adapter); 3141 vmxnet3_free_irqs(adapter);
3118 vmxnet3_free_intr_resources(adapter); 3142 vmxnet3_free_intr_resources(adapter);
@@ -3188,8 +3212,10 @@ skip_arp:
3188 adapter->shared->devRead.pmConfDesc.confPA = cpu_to_le64(virt_to_phys( 3212 adapter->shared->devRead.pmConfDesc.confPA = cpu_to_le64(virt_to_phys(
3189 pmConf)); 3213 pmConf));
3190 3214
3215 spin_lock_irqsave(&adapter->cmd_lock, flags);
3191 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, 3216 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
3192 VMXNET3_CMD_UPDATE_PMCFG); 3217 VMXNET3_CMD_UPDATE_PMCFG);
3218 spin_unlock_irqrestore(&adapter->cmd_lock, flags);
3193 3219
3194 pci_save_state(pdev); 3220 pci_save_state(pdev);
3195 pci_enable_wake(pdev, pci_choose_state(pdev, PMSG_SUSPEND), 3221 pci_enable_wake(pdev, pci_choose_state(pdev, PMSG_SUSPEND),
@@ -3204,7 +3230,8 @@ skip_arp:
3204static int 3230static int
3205vmxnet3_resume(struct device *device) 3231vmxnet3_resume(struct device *device)
3206{ 3232{
3207 int err; 3233 int err, i = 0;
3234 unsigned long flags;
3208 struct pci_dev *pdev = to_pci_dev(device); 3235 struct pci_dev *pdev = to_pci_dev(device);
3209 struct net_device *netdev = pci_get_drvdata(pdev); 3236 struct net_device *netdev = pci_get_drvdata(pdev);
3210 struct vmxnet3_adapter *adapter = netdev_priv(netdev); 3237 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
@@ -3232,10 +3259,14 @@ vmxnet3_resume(struct device *device)
3232 3259
3233 pci_enable_wake(pdev, PCI_D0, 0); 3260 pci_enable_wake(pdev, PCI_D0, 0);
3234 3261
3262 spin_lock_irqsave(&adapter->cmd_lock, flags);
3235 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, 3263 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
3236 VMXNET3_CMD_UPDATE_PMCFG); 3264 VMXNET3_CMD_UPDATE_PMCFG);
3265 spin_unlock_irqrestore(&adapter->cmd_lock, flags);
3237 vmxnet3_alloc_intr_resources(adapter); 3266 vmxnet3_alloc_intr_resources(adapter);
3238 vmxnet3_request_irqs(adapter); 3267 vmxnet3_request_irqs(adapter);
3268 for (i = 0; i < adapter->num_rx_queues; i++)
3269 napi_enable(&adapter->rx_queue[i].napi);
3239 vmxnet3_enable_all_intrs(adapter); 3270 vmxnet3_enable_all_intrs(adapter);
3240 3271
3241 return 0; 3272 return 0;
diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c
index 8e17fc8a7fe7..81254be85b92 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethtool.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c
@@ -45,6 +45,7 @@ static int
45vmxnet3_set_rx_csum(struct net_device *netdev, u32 val) 45vmxnet3_set_rx_csum(struct net_device *netdev, u32 val)
46{ 46{
47 struct vmxnet3_adapter *adapter = netdev_priv(netdev); 47 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
48 unsigned long flags;
48 49
49 if (adapter->rxcsum != val) { 50 if (adapter->rxcsum != val) {
50 adapter->rxcsum = val; 51 adapter->rxcsum = val;
@@ -56,8 +57,10 @@ vmxnet3_set_rx_csum(struct net_device *netdev, u32 val)
56 adapter->shared->devRead.misc.uptFeatures &= 57 adapter->shared->devRead.misc.uptFeatures &=
57 ~UPT1_F_RXCSUM; 58 ~UPT1_F_RXCSUM;
58 59
60 spin_lock_irqsave(&adapter->cmd_lock, flags);
59 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, 61 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
60 VMXNET3_CMD_UPDATE_FEATURE); 62 VMXNET3_CMD_UPDATE_FEATURE);
63 spin_unlock_irqrestore(&adapter->cmd_lock, flags);
61 } 64 }
62 } 65 }
63 return 0; 66 return 0;
@@ -68,76 +71,78 @@ vmxnet3_set_rx_csum(struct net_device *netdev, u32 val)
68static const struct vmxnet3_stat_desc 71static const struct vmxnet3_stat_desc
69vmxnet3_tq_dev_stats[] = { 72vmxnet3_tq_dev_stats[] = {
70 /* description, offset */ 73 /* description, offset */
71 { "TSO pkts tx", offsetof(struct UPT1_TxStats, TSOPktsTxOK) }, 74 { "Tx Queue#", 0 },
72 { "TSO bytes tx", offsetof(struct UPT1_TxStats, TSOBytesTxOK) }, 75 { " TSO pkts tx", offsetof(struct UPT1_TxStats, TSOPktsTxOK) },
73 { "ucast pkts tx", offsetof(struct UPT1_TxStats, ucastPktsTxOK) }, 76 { " TSO bytes tx", offsetof(struct UPT1_TxStats, TSOBytesTxOK) },
74 { "ucast bytes tx", offsetof(struct UPT1_TxStats, ucastBytesTxOK) }, 77 { " ucast pkts tx", offsetof(struct UPT1_TxStats, ucastPktsTxOK) },
75 { "mcast pkts tx", offsetof(struct UPT1_TxStats, mcastPktsTxOK) }, 78 { " ucast bytes tx", offsetof(struct UPT1_TxStats, ucastBytesTxOK) },
76 { "mcast bytes tx", offsetof(struct UPT1_TxStats, mcastBytesTxOK) }, 79 { " mcast pkts tx", offsetof(struct UPT1_TxStats, mcastPktsTxOK) },
77 { "bcast pkts tx", offsetof(struct UPT1_TxStats, bcastPktsTxOK) }, 80 { " mcast bytes tx", offsetof(struct UPT1_TxStats, mcastBytesTxOK) },
78 { "bcast bytes tx", offsetof(struct UPT1_TxStats, bcastBytesTxOK) }, 81 { " bcast pkts tx", offsetof(struct UPT1_TxStats, bcastPktsTxOK) },
79 { "pkts tx err", offsetof(struct UPT1_TxStats, pktsTxError) }, 82 { " bcast bytes tx", offsetof(struct UPT1_TxStats, bcastBytesTxOK) },
80 { "pkts tx discard", offsetof(struct UPT1_TxStats, pktsTxDiscard) }, 83 { " pkts tx err", offsetof(struct UPT1_TxStats, pktsTxError) },
84 { " pkts tx discard", offsetof(struct UPT1_TxStats, pktsTxDiscard) },
81}; 85};
82 86
83/* per tq stats maintained by the driver */ 87/* per tq stats maintained by the driver */
84static const struct vmxnet3_stat_desc 88static const struct vmxnet3_stat_desc
85vmxnet3_tq_driver_stats[] = { 89vmxnet3_tq_driver_stats[] = {
86 /* description, offset */ 90 /* description, offset */
87 {"drv dropped tx total", offsetof(struct vmxnet3_tq_driver_stats, 91 {" drv dropped tx total", offsetof(struct vmxnet3_tq_driver_stats,
88 drop_total) }, 92 drop_total) },
89 { " too many frags", offsetof(struct vmxnet3_tq_driver_stats, 93 { " too many frags", offsetof(struct vmxnet3_tq_driver_stats,
90 drop_too_many_frags) }, 94 drop_too_many_frags) },
91 { " giant hdr", offsetof(struct vmxnet3_tq_driver_stats, 95 { " giant hdr", offsetof(struct vmxnet3_tq_driver_stats,
92 drop_oversized_hdr) }, 96 drop_oversized_hdr) },
93 { " hdr err", offsetof(struct vmxnet3_tq_driver_stats, 97 { " hdr err", offsetof(struct vmxnet3_tq_driver_stats,
94 drop_hdr_inspect_err) }, 98 drop_hdr_inspect_err) },
95 { " tso", offsetof(struct vmxnet3_tq_driver_stats, 99 { " tso", offsetof(struct vmxnet3_tq_driver_stats,
96 drop_tso) }, 100 drop_tso) },
97 { "ring full", offsetof(struct vmxnet3_tq_driver_stats, 101 { " ring full", offsetof(struct vmxnet3_tq_driver_stats,
98 tx_ring_full) }, 102 tx_ring_full) },
99 { "pkts linearized", offsetof(struct vmxnet3_tq_driver_stats, 103 { " pkts linearized", offsetof(struct vmxnet3_tq_driver_stats,
100 linearized) }, 104 linearized) },
101 { "hdr cloned", offsetof(struct vmxnet3_tq_driver_stats, 105 { " hdr cloned", offsetof(struct vmxnet3_tq_driver_stats,
102 copy_skb_header) }, 106 copy_skb_header) },
103 { "giant hdr", offsetof(struct vmxnet3_tq_driver_stats, 107 { " giant hdr", offsetof(struct vmxnet3_tq_driver_stats,
104 oversized_hdr) }, 108 oversized_hdr) },
105}; 109};
106 110
107/* per rq stats maintained by the device */ 111/* per rq stats maintained by the device */
108static const struct vmxnet3_stat_desc 112static const struct vmxnet3_stat_desc
109vmxnet3_rq_dev_stats[] = { 113vmxnet3_rq_dev_stats[] = {
110 { "LRO pkts rx", offsetof(struct UPT1_RxStats, LROPktsRxOK) }, 114 { "Rx Queue#", 0 },
111 { "LRO byte rx", offsetof(struct UPT1_RxStats, LROBytesRxOK) }, 115 { " LRO pkts rx", offsetof(struct UPT1_RxStats, LROPktsRxOK) },
112 { "ucast pkts rx", offsetof(struct UPT1_RxStats, ucastPktsRxOK) }, 116 { " LRO byte rx", offsetof(struct UPT1_RxStats, LROBytesRxOK) },
113 { "ucast bytes rx", offsetof(struct UPT1_RxStats, ucastBytesRxOK) }, 117 { " ucast pkts rx", offsetof(struct UPT1_RxStats, ucastPktsRxOK) },
114 { "mcast pkts rx", offsetof(struct UPT1_RxStats, mcastPktsRxOK) }, 118 { " ucast bytes rx", offsetof(struct UPT1_RxStats, ucastBytesRxOK) },
115 { "mcast bytes rx", offsetof(struct UPT1_RxStats, mcastBytesRxOK) }, 119 { " mcast pkts rx", offsetof(struct UPT1_RxStats, mcastPktsRxOK) },
116 { "bcast pkts rx", offsetof(struct UPT1_RxStats, bcastPktsRxOK) }, 120 { " mcast bytes rx", offsetof(struct UPT1_RxStats, mcastBytesRxOK) },
117 { "bcast bytes rx", offsetof(struct UPT1_RxStats, bcastBytesRxOK) }, 121 { " bcast pkts rx", offsetof(struct UPT1_RxStats, bcastPktsRxOK) },
118 { "pkts rx out of buf", offsetof(struct UPT1_RxStats, pktsRxOutOfBuf) }, 122 { " bcast bytes rx", offsetof(struct UPT1_RxStats, bcastBytesRxOK) },
119 { "pkts rx err", offsetof(struct UPT1_RxStats, pktsRxError) }, 123 { " pkts rx OOB", offsetof(struct UPT1_RxStats, pktsRxOutOfBuf) },
124 { " pkts rx err", offsetof(struct UPT1_RxStats, pktsRxError) },
120}; 125};
121 126
122/* per rq stats maintained by the driver */ 127/* per rq stats maintained by the driver */
123static const struct vmxnet3_stat_desc 128static const struct vmxnet3_stat_desc
124vmxnet3_rq_driver_stats[] = { 129vmxnet3_rq_driver_stats[] = {
125 /* description, offset */ 130 /* description, offset */
126 { "drv dropped rx total", offsetof(struct vmxnet3_rq_driver_stats, 131 { " drv dropped rx total", offsetof(struct vmxnet3_rq_driver_stats,
127 drop_total) }, 132 drop_total) },
128 { " err", offsetof(struct vmxnet3_rq_driver_stats, 133 { " err", offsetof(struct vmxnet3_rq_driver_stats,
129 drop_err) }, 134 drop_err) },
130 { " fcs", offsetof(struct vmxnet3_rq_driver_stats, 135 { " fcs", offsetof(struct vmxnet3_rq_driver_stats,
131 drop_fcs) }, 136 drop_fcs) },
132 { "rx buf alloc fail", offsetof(struct vmxnet3_rq_driver_stats, 137 { " rx buf alloc fail", offsetof(struct vmxnet3_rq_driver_stats,
133 rx_buf_alloc_failure) }, 138 rx_buf_alloc_failure) },
134}; 139};
135 140
136/* gloabl stats maintained by the driver */ 141/* gloabl stats maintained by the driver */
137static const struct vmxnet3_stat_desc 142static const struct vmxnet3_stat_desc
138vmxnet3_global_stats[] = { 143vmxnet3_global_stats[] = {
139 /* description, offset */ 144 /* description, offset */
140 { "tx timeout count", offsetof(struct vmxnet3_adapter, 145 { "tx timeout count", offsetof(struct vmxnet3_adapter,
141 tx_timeout_count) } 146 tx_timeout_count) }
142}; 147};
143 148
@@ -151,12 +156,15 @@ vmxnet3_get_stats(struct net_device *netdev)
151 struct UPT1_TxStats *devTxStats; 156 struct UPT1_TxStats *devTxStats;
152 struct UPT1_RxStats *devRxStats; 157 struct UPT1_RxStats *devRxStats;
153 struct net_device_stats *net_stats = &netdev->stats; 158 struct net_device_stats *net_stats = &netdev->stats;
159 unsigned long flags;
154 int i; 160 int i;
155 161
156 adapter = netdev_priv(netdev); 162 adapter = netdev_priv(netdev);
157 163
158 /* Collect the dev stats into the shared area */ 164 /* Collect the dev stats into the shared area */
165 spin_lock_irqsave(&adapter->cmd_lock, flags);
159 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS); 166 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS);
167 spin_unlock_irqrestore(&adapter->cmd_lock, flags);
160 168
161 memset(net_stats, 0, sizeof(*net_stats)); 169 memset(net_stats, 0, sizeof(*net_stats));
162 for (i = 0; i < adapter->num_tx_queues; i++) { 170 for (i = 0; i < adapter->num_tx_queues; i++) {
@@ -193,12 +201,15 @@ vmxnet3_get_stats(struct net_device *netdev)
193static int 201static int
194vmxnet3_get_sset_count(struct net_device *netdev, int sset) 202vmxnet3_get_sset_count(struct net_device *netdev, int sset)
195{ 203{
204 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
196 switch (sset) { 205 switch (sset) {
197 case ETH_SS_STATS: 206 case ETH_SS_STATS:
198 return ARRAY_SIZE(vmxnet3_tq_dev_stats) + 207 return (ARRAY_SIZE(vmxnet3_tq_dev_stats) +
199 ARRAY_SIZE(vmxnet3_tq_driver_stats) + 208 ARRAY_SIZE(vmxnet3_tq_driver_stats)) *
200 ARRAY_SIZE(vmxnet3_rq_dev_stats) + 209 adapter->num_tx_queues +
201 ARRAY_SIZE(vmxnet3_rq_driver_stats) + 210 (ARRAY_SIZE(vmxnet3_rq_dev_stats) +
211 ARRAY_SIZE(vmxnet3_rq_driver_stats)) *
212 adapter->num_rx_queues +
202 ARRAY_SIZE(vmxnet3_global_stats); 213 ARRAY_SIZE(vmxnet3_global_stats);
203 default: 214 default:
204 return -EOPNOTSUPP; 215 return -EOPNOTSUPP;
@@ -206,10 +217,16 @@ vmxnet3_get_sset_count(struct net_device *netdev, int sset)
206} 217}
207 218
208 219
220/* Should be multiple of 4 */
221#define NUM_TX_REGS 8
222#define NUM_RX_REGS 12
223
209static int 224static int
210vmxnet3_get_regs_len(struct net_device *netdev) 225vmxnet3_get_regs_len(struct net_device *netdev)
211{ 226{
212 return 20 * sizeof(u32); 227 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
228 return (adapter->num_tx_queues * NUM_TX_REGS * sizeof(u32) +
229 adapter->num_rx_queues * NUM_RX_REGS * sizeof(u32));
213} 230}
214 231
215 232
@@ -240,29 +257,37 @@ vmxnet3_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)
240static void 257static void
241vmxnet3_get_strings(struct net_device *netdev, u32 stringset, u8 *buf) 258vmxnet3_get_strings(struct net_device *netdev, u32 stringset, u8 *buf)
242{ 259{
260 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
243 if (stringset == ETH_SS_STATS) { 261 if (stringset == ETH_SS_STATS) {
244 int i; 262 int i, j;
245 263 for (j = 0; j < adapter->num_tx_queues; j++) {
246 for (i = 0; i < ARRAY_SIZE(vmxnet3_tq_dev_stats); i++) { 264 for (i = 0; i < ARRAY_SIZE(vmxnet3_tq_dev_stats); i++) {
247 memcpy(buf, vmxnet3_tq_dev_stats[i].desc, 265 memcpy(buf, vmxnet3_tq_dev_stats[i].desc,
248 ETH_GSTRING_LEN); 266 ETH_GSTRING_LEN);
249 buf += ETH_GSTRING_LEN; 267 buf += ETH_GSTRING_LEN;
250 } 268 }
251 for (i = 0; i < ARRAY_SIZE(vmxnet3_tq_driver_stats); i++) { 269 for (i = 0; i < ARRAY_SIZE(vmxnet3_tq_driver_stats);
252 memcpy(buf, vmxnet3_tq_driver_stats[i].desc, 270 i++) {
253 ETH_GSTRING_LEN); 271 memcpy(buf, vmxnet3_tq_driver_stats[i].desc,
254 buf += ETH_GSTRING_LEN; 272 ETH_GSTRING_LEN);
255 } 273 buf += ETH_GSTRING_LEN;
256 for (i = 0; i < ARRAY_SIZE(vmxnet3_rq_dev_stats); i++) { 274 }
257 memcpy(buf, vmxnet3_rq_dev_stats[i].desc,
258 ETH_GSTRING_LEN);
259 buf += ETH_GSTRING_LEN;
260 } 275 }
261 for (i = 0; i < ARRAY_SIZE(vmxnet3_rq_driver_stats); i++) { 276
262 memcpy(buf, vmxnet3_rq_driver_stats[i].desc, 277 for (j = 0; j < adapter->num_rx_queues; j++) {
263 ETH_GSTRING_LEN); 278 for (i = 0; i < ARRAY_SIZE(vmxnet3_rq_dev_stats); i++) {
264 buf += ETH_GSTRING_LEN; 279 memcpy(buf, vmxnet3_rq_dev_stats[i].desc,
280 ETH_GSTRING_LEN);
281 buf += ETH_GSTRING_LEN;
282 }
283 for (i = 0; i < ARRAY_SIZE(vmxnet3_rq_driver_stats);
284 i++) {
285 memcpy(buf, vmxnet3_rq_driver_stats[i].desc,
286 ETH_GSTRING_LEN);
287 buf += ETH_GSTRING_LEN;
288 }
265 } 289 }
290
266 for (i = 0; i < ARRAY_SIZE(vmxnet3_global_stats); i++) { 291 for (i = 0; i < ARRAY_SIZE(vmxnet3_global_stats); i++) {
267 memcpy(buf, vmxnet3_global_stats[i].desc, 292 memcpy(buf, vmxnet3_global_stats[i].desc,
268 ETH_GSTRING_LEN); 293 ETH_GSTRING_LEN);
@@ -277,6 +302,7 @@ vmxnet3_set_flags(struct net_device *netdev, u32 data)
277 struct vmxnet3_adapter *adapter = netdev_priv(netdev); 302 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
278 u8 lro_requested = (data & ETH_FLAG_LRO) == 0 ? 0 : 1; 303 u8 lro_requested = (data & ETH_FLAG_LRO) == 0 ? 0 : 1;
279 u8 lro_present = (netdev->features & NETIF_F_LRO) == 0 ? 0 : 1; 304 u8 lro_present = (netdev->features & NETIF_F_LRO) == 0 ? 0 : 1;
305 unsigned long flags;
280 306
281 if (data & ~ETH_FLAG_LRO) 307 if (data & ~ETH_FLAG_LRO)
282 return -EOPNOTSUPP; 308 return -EOPNOTSUPP;
@@ -292,8 +318,10 @@ vmxnet3_set_flags(struct net_device *netdev, u32 data)
292 else 318 else
293 adapter->shared->devRead.misc.uptFeatures &= 319 adapter->shared->devRead.misc.uptFeatures &=
294 ~UPT1_F_LRO; 320 ~UPT1_F_LRO;
321 spin_lock_irqsave(&adapter->cmd_lock, flags);
295 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, 322 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
296 VMXNET3_CMD_UPDATE_FEATURE); 323 VMXNET3_CMD_UPDATE_FEATURE);
324 spin_unlock_irqrestore(&adapter->cmd_lock, flags);
297 } 325 }
298 return 0; 326 return 0;
299} 327}
@@ -303,30 +331,41 @@ vmxnet3_get_ethtool_stats(struct net_device *netdev,
303 struct ethtool_stats *stats, u64 *buf) 331 struct ethtool_stats *stats, u64 *buf)
304{ 332{
305 struct vmxnet3_adapter *adapter = netdev_priv(netdev); 333 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
334 unsigned long flags;
306 u8 *base; 335 u8 *base;
307 int i; 336 int i;
308 int j = 0; 337 int j = 0;
309 338
339 spin_lock_irqsave(&adapter->cmd_lock, flags);
310 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS); 340 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS);
341 spin_unlock_irqrestore(&adapter->cmd_lock, flags);
311 342
312 /* this does assume each counter is 64-bit wide */ 343 /* this does assume each counter is 64-bit wide */
313/* TODO change this for multiple queues */ 344 for (j = 0; j < adapter->num_tx_queues; j++) {
314 345 base = (u8 *)&adapter->tqd_start[j].stats;
315 base = (u8 *)&adapter->tqd_start[j].stats; 346 *buf++ = (u64)j;
316 for (i = 0; i < ARRAY_SIZE(vmxnet3_tq_dev_stats); i++) 347 for (i = 1; i < ARRAY_SIZE(vmxnet3_tq_dev_stats); i++)
317 *buf++ = *(u64 *)(base + vmxnet3_tq_dev_stats[i].offset); 348 *buf++ = *(u64 *)(base +
318 349 vmxnet3_tq_dev_stats[i].offset);
319 base = (u8 *)&adapter->tx_queue[j].stats; 350
320 for (i = 0; i < ARRAY_SIZE(vmxnet3_tq_driver_stats); i++) 351 base = (u8 *)&adapter->tx_queue[j].stats;
321 *buf++ = *(u64 *)(base + vmxnet3_tq_driver_stats[i].offset); 352 for (i = 0; i < ARRAY_SIZE(vmxnet3_tq_driver_stats); i++)
322 353 *buf++ = *(u64 *)(base +
323 base = (u8 *)&adapter->rqd_start[j].stats; 354 vmxnet3_tq_driver_stats[i].offset);
324 for (i = 0; i < ARRAY_SIZE(vmxnet3_rq_dev_stats); i++) 355 }
325 *buf++ = *(u64 *)(base + vmxnet3_rq_dev_stats[i].offset);
326 356
327 base = (u8 *)&adapter->rx_queue[j].stats; 357 for (j = 0; j < adapter->num_tx_queues; j++) {
328 for (i = 0; i < ARRAY_SIZE(vmxnet3_rq_driver_stats); i++) 358 base = (u8 *)&adapter->rqd_start[j].stats;
329 *buf++ = *(u64 *)(base + vmxnet3_rq_driver_stats[i].offset); 359 *buf++ = (u64) j;
360 for (i = 1; i < ARRAY_SIZE(vmxnet3_rq_dev_stats); i++)
361 *buf++ = *(u64 *)(base +
362 vmxnet3_rq_dev_stats[i].offset);
363
364 base = (u8 *)&adapter->rx_queue[j].stats;
365 for (i = 0; i < ARRAY_SIZE(vmxnet3_rq_driver_stats); i++)
366 *buf++ = *(u64 *)(base +
367 vmxnet3_rq_driver_stats[i].offset);
368 }
330 369
331 base = (u8 *)adapter; 370 base = (u8 *)adapter;
332 for (i = 0; i < ARRAY_SIZE(vmxnet3_global_stats); i++) 371 for (i = 0; i < ARRAY_SIZE(vmxnet3_global_stats); i++)
@@ -339,7 +378,7 @@ vmxnet3_get_regs(struct net_device *netdev, struct ethtool_regs *regs, void *p)
339{ 378{
340 struct vmxnet3_adapter *adapter = netdev_priv(netdev); 379 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
341 u32 *buf = p; 380 u32 *buf = p;
342 int i = 0; 381 int i = 0, j = 0;
343 382
344 memset(p, 0, vmxnet3_get_regs_len(netdev)); 383 memset(p, 0, vmxnet3_get_regs_len(netdev));
345 384
@@ -348,31 +387,35 @@ vmxnet3_get_regs(struct net_device *netdev, struct ethtool_regs *regs, void *p)
348 /* Update vmxnet3_get_regs_len if we want to dump more registers */ 387 /* Update vmxnet3_get_regs_len if we want to dump more registers */
349 388
350 /* make each ring use multiple of 16 bytes */ 389 /* make each ring use multiple of 16 bytes */
351/* TODO change this for multiple queues */ 390 for (i = 0; i < adapter->num_tx_queues; i++) {
352 buf[0] = adapter->tx_queue[i].tx_ring.next2fill; 391 buf[j++] = adapter->tx_queue[i].tx_ring.next2fill;
353 buf[1] = adapter->tx_queue[i].tx_ring.next2comp; 392 buf[j++] = adapter->tx_queue[i].tx_ring.next2comp;
354 buf[2] = adapter->tx_queue[i].tx_ring.gen; 393 buf[j++] = adapter->tx_queue[i].tx_ring.gen;
355 buf[3] = 0; 394 buf[j++] = 0;
356 395
357 buf[4] = adapter->tx_queue[i].comp_ring.next2proc; 396 buf[j++] = adapter->tx_queue[i].comp_ring.next2proc;
358 buf[5] = adapter->tx_queue[i].comp_ring.gen; 397 buf[j++] = adapter->tx_queue[i].comp_ring.gen;
359 buf[6] = adapter->tx_queue[i].stopped; 398 buf[j++] = adapter->tx_queue[i].stopped;
360 buf[7] = 0; 399 buf[j++] = 0;
361 400 }
362 buf[8] = adapter->rx_queue[i].rx_ring[0].next2fill; 401
363 buf[9] = adapter->rx_queue[i].rx_ring[0].next2comp; 402 for (i = 0; i < adapter->num_rx_queues; i++) {
364 buf[10] = adapter->rx_queue[i].rx_ring[0].gen; 403 buf[j++] = adapter->rx_queue[i].rx_ring[0].next2fill;
365 buf[11] = 0; 404 buf[j++] = adapter->rx_queue[i].rx_ring[0].next2comp;
366 405 buf[j++] = adapter->rx_queue[i].rx_ring[0].gen;
367 buf[12] = adapter->rx_queue[i].rx_ring[1].next2fill; 406 buf[j++] = 0;
368 buf[13] = adapter->rx_queue[i].rx_ring[1].next2comp; 407
369 buf[14] = adapter->rx_queue[i].rx_ring[1].gen; 408 buf[j++] = adapter->rx_queue[i].rx_ring[1].next2fill;
370 buf[15] = 0; 409 buf[j++] = adapter->rx_queue[i].rx_ring[1].next2comp;
371 410 buf[j++] = adapter->rx_queue[i].rx_ring[1].gen;
372 buf[16] = adapter->rx_queue[i].comp_ring.next2proc; 411 buf[j++] = 0;
373 buf[17] = adapter->rx_queue[i].comp_ring.gen; 412
374 buf[18] = 0; 413 buf[j++] = adapter->rx_queue[i].comp_ring.next2proc;
375 buf[19] = 0; 414 buf[j++] = adapter->rx_queue[i].comp_ring.gen;
415 buf[j++] = 0;
416 buf[j++] = 0;
417 }
418
376} 419}
377 420
378 421
@@ -574,6 +617,7 @@ vmxnet3_set_rss_indir(struct net_device *netdev,
574 const struct ethtool_rxfh_indir *p) 617 const struct ethtool_rxfh_indir *p)
575{ 618{
576 unsigned int i; 619 unsigned int i;
620 unsigned long flags;
577 struct vmxnet3_adapter *adapter = netdev_priv(netdev); 621 struct vmxnet3_adapter *adapter = netdev_priv(netdev);
578 struct UPT1_RSSConf *rssConf = adapter->rss_conf; 622 struct UPT1_RSSConf *rssConf = adapter->rss_conf;
579 623
@@ -592,8 +636,10 @@ vmxnet3_set_rss_indir(struct net_device *netdev,
592 for (i = 0; i < rssConf->indTableSize; i++) 636 for (i = 0; i < rssConf->indTableSize; i++)
593 rssConf->indTable[i] = p->ring_index[i]; 637 rssConf->indTable[i] = p->ring_index[i];
594 638
639 spin_lock_irqsave(&adapter->cmd_lock, flags);
595 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, 640 VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
596 VMXNET3_CMD_UPDATE_RSSIDT); 641 VMXNET3_CMD_UPDATE_RSSIDT);
642 spin_unlock_irqrestore(&adapter->cmd_lock, flags);
597 643
598 return 0; 644 return 0;
599 645
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h
index 7fadeed37f03..fb5d245ac878 100644
--- a/drivers/net/vmxnet3/vmxnet3_int.h
+++ b/drivers/net/vmxnet3/vmxnet3_int.h
@@ -68,10 +68,10 @@
68/* 68/*
69 * Version numbers 69 * Version numbers
70 */ 70 */
71#define VMXNET3_DRIVER_VERSION_STRING "1.0.16.0-k" 71#define VMXNET3_DRIVER_VERSION_STRING "1.0.25.0-k"
72 72
73/* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */ 73/* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */
74#define VMXNET3_DRIVER_VERSION_NUM 0x01001000 74#define VMXNET3_DRIVER_VERSION_NUM 0x01001900
75 75
76#if defined(CONFIG_PCI_MSI) 76#if defined(CONFIG_PCI_MSI)
77 /* RSS only makes sense if MSI-X is supported. */ 77 /* RSS only makes sense if MSI-X is supported. */
@@ -289,7 +289,7 @@ struct vmxnet3_rx_queue {
289 289
290#define VMXNET3_LINUX_MAX_MSIX_VECT (VMXNET3_DEVICE_MAX_TX_QUEUES + \ 290#define VMXNET3_LINUX_MAX_MSIX_VECT (VMXNET3_DEVICE_MAX_TX_QUEUES + \
291 VMXNET3_DEVICE_MAX_RX_QUEUES + 1) 291 VMXNET3_DEVICE_MAX_RX_QUEUES + 1)
292#define VMXNET3_LINUX_MIN_MSIX_VECT 3 /* 1 for each : tx, rx and event */ 292#define VMXNET3_LINUX_MIN_MSIX_VECT 2 /* 1 for tx-rx pair and 1 for event */
293 293
294 294
295struct vmxnet3_intr { 295struct vmxnet3_intr {
@@ -317,6 +317,7 @@ struct vmxnet3_adapter {
317 struct vmxnet3_rx_queue rx_queue[VMXNET3_DEVICE_MAX_RX_QUEUES]; 317 struct vmxnet3_rx_queue rx_queue[VMXNET3_DEVICE_MAX_RX_QUEUES];
318 struct vlan_group *vlan_grp; 318 struct vlan_group *vlan_grp;
319 struct vmxnet3_intr intr; 319 struct vmxnet3_intr intr;
320 spinlock_t cmd_lock;
320 struct Vmxnet3_DriverShared *shared; 321 struct Vmxnet3_DriverShared *shared;
321 struct Vmxnet3_PMConf *pm_conf; 322 struct Vmxnet3_PMConf *pm_conf;
322 struct Vmxnet3_TxQueueDesc *tqd_start; /* all tx queue desc */ 323 struct Vmxnet3_TxQueueDesc *tqd_start; /* all tx queue desc */
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 019a74d533a6..09ae4ef0fd51 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -2294,6 +2294,8 @@ ath5k_tx_complete_poll_work(struct work_struct *work)
2294 int i; 2294 int i;
2295 bool needreset = false; 2295 bool needreset = false;
2296 2296
2297 mutex_lock(&sc->lock);
2298
2297 for (i = 0; i < ARRAY_SIZE(sc->txqs); i++) { 2299 for (i = 0; i < ARRAY_SIZE(sc->txqs); i++) {
2298 if (sc->txqs[i].setup) { 2300 if (sc->txqs[i].setup) {
2299 txq = &sc->txqs[i]; 2301 txq = &sc->txqs[i];
@@ -2321,6 +2323,8 @@ ath5k_tx_complete_poll_work(struct work_struct *work)
2321 ath5k_reset(sc, NULL, true); 2323 ath5k_reset(sc, NULL, true);
2322 } 2324 }
2323 2325
2326 mutex_unlock(&sc->lock);
2327
2324 ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 2328 ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work,
2325 msecs_to_jiffies(ATH5K_TX_COMPLETE_POLL_INT)); 2329 msecs_to_jiffies(ATH5K_TX_COMPLETE_POLL_INT));
2326} 2330}
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_calib.c b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
index ea2e7d714bda..5e300bd3d264 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_calib.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_calib.c
@@ -679,10 +679,6 @@ static bool ar9002_hw_calibrate(struct ath_hw *ah,
679 679
680 /* Do NF cal only at longer intervals */ 680 /* Do NF cal only at longer intervals */
681 if (longcal || nfcal_pending) { 681 if (longcal || nfcal_pending) {
682 /* Do periodic PAOffset Cal */
683 ar9002_hw_pa_cal(ah, false);
684 ar9002_hw_olc_temp_compensation(ah);
685
686 /* 682 /*
687 * Get the value from the previous NF cal and update 683 * Get the value from the previous NF cal and update
688 * history buffer. 684 * history buffer.
@@ -697,8 +693,12 @@ static bool ar9002_hw_calibrate(struct ath_hw *ah,
697 ath9k_hw_loadnf(ah, ah->curchan); 693 ath9k_hw_loadnf(ah, ah->curchan);
698 } 694 }
699 695
700 if (longcal) 696 if (longcal) {
701 ath9k_hw_start_nfcal(ah, false); 697 ath9k_hw_start_nfcal(ah, false);
698 /* Do periodic PAOffset Cal */
699 ar9002_hw_pa_cal(ah, false);
700 ar9002_hw_olc_temp_compensation(ah);
701 }
702 } 702 }
703 703
704 return iscaldone; 704 return iscaldone;
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
index 81f9cf294dec..9ecca93392e8 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
+++ b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
@@ -1842,7 +1842,7 @@ static const u32 ar9300_2p2_soc_preamble[][2] = {
1842 1842
1843static const u32 ar9300PciePhy_pll_on_clkreq_disable_L1_2p2[][2] = { 1843static const u32 ar9300PciePhy_pll_on_clkreq_disable_L1_2p2[][2] = {
1844 /* Addr allmodes */ 1844 /* Addr allmodes */
1845 {0x00004040, 0x08212e5e}, 1845 {0x00004040, 0x0821265e},
1846 {0x00004040, 0x0008003b}, 1846 {0x00004040, 0x0008003b},
1847 {0x00004044, 0x00000000}, 1847 {0x00004044, 0x00000000},
1848}; 1848};
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_hw.c b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
index 6137634e46ca..06fb2c850535 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
@@ -146,8 +146,8 @@ static void ar9003_hw_init_mode_regs(struct ath_hw *ah)
146 /* Sleep Setting */ 146 /* Sleep Setting */
147 147
148 INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower, 148 INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
149 ar9300PciePhy_clkreq_enable_L1_2p2, 149 ar9300PciePhy_pll_on_clkreq_disable_L1_2p2,
150 ARRAY_SIZE(ar9300PciePhy_clkreq_enable_L1_2p2), 150 ARRAY_SIZE(ar9300PciePhy_pll_on_clkreq_disable_L1_2p2),
151 2); 151 2);
152 152
153 /* Fast clock modal settings */ 153 /* Fast clock modal settings */
diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h
index 1ce506f23110..780ac5eac501 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -78,7 +78,7 @@ struct tx_frame_hdr {
78 u8 node_idx; 78 u8 node_idx;
79 u8 vif_idx; 79 u8 vif_idx;
80 u8 tidno; 80 u8 tidno;
81 u32 flags; /* ATH9K_HTC_TX_* */ 81 __be32 flags; /* ATH9K_HTC_TX_* */
82 u8 key_type; 82 u8 key_type;
83 u8 keyix; 83 u8 keyix;
84 u8 reserved[26]; 84 u8 reserved[26];
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
index 33f36029fa4f..7a5ffca21958 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
@@ -113,6 +113,7 @@ int ath9k_htc_tx_start(struct ath9k_htc_priv *priv, struct sk_buff *skb)
113 113
114 if (ieee80211_is_data(fc)) { 114 if (ieee80211_is_data(fc)) {
115 struct tx_frame_hdr tx_hdr; 115 struct tx_frame_hdr tx_hdr;
116 u32 flags = 0;
116 u8 *qc; 117 u8 *qc;
117 118
118 memset(&tx_hdr, 0, sizeof(struct tx_frame_hdr)); 119 memset(&tx_hdr, 0, sizeof(struct tx_frame_hdr));
@@ -136,13 +137,14 @@ int ath9k_htc_tx_start(struct ath9k_htc_priv *priv, struct sk_buff *skb)
136 /* Check for RTS protection */ 137 /* Check for RTS protection */
137 if (priv->hw->wiphy->rts_threshold != (u32) -1) 138 if (priv->hw->wiphy->rts_threshold != (u32) -1)
138 if (skb->len > priv->hw->wiphy->rts_threshold) 139 if (skb->len > priv->hw->wiphy->rts_threshold)
139 tx_hdr.flags |= ATH9K_HTC_TX_RTSCTS; 140 flags |= ATH9K_HTC_TX_RTSCTS;
140 141
141 /* CTS-to-self */ 142 /* CTS-to-self */
142 if (!(tx_hdr.flags & ATH9K_HTC_TX_RTSCTS) && 143 if (!(flags & ATH9K_HTC_TX_RTSCTS) &&
143 (priv->op_flags & OP_PROTECT_ENABLE)) 144 (priv->op_flags & OP_PROTECT_ENABLE))
144 tx_hdr.flags |= ATH9K_HTC_TX_CTSONLY; 145 flags |= ATH9K_HTC_TX_CTSONLY;
145 146
147 tx_hdr.flags = cpu_to_be32(flags);
146 tx_hdr.key_type = ath9k_cmn_get_hw_crypto_keytype(skb); 148 tx_hdr.key_type = ath9k_cmn_get_hw_crypto_keytype(skb);
147 if (tx_hdr.key_type == ATH9K_KEY_TYPE_CLEAR) 149 if (tx_hdr.key_type == ATH9K_KEY_TYPE_CLEAR)
148 tx_hdr.keyix = (u8) ATH9K_TXKEYIX_INVALID; 150 tx_hdr.keyix = (u8) ATH9K_TXKEYIX_INVALID;
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c
index 97906dd442e6..14ceb4df72f6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c
@@ -168,7 +168,7 @@ int iwl_eeprom_check_sku(struct iwl_priv *priv)
168 /* not using .cfg overwrite */ 168 /* not using .cfg overwrite */
169 radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG); 169 radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG);
170 priv->cfg->valid_tx_ant = EEPROM_RF_CFG_TX_ANT_MSK(radio_cfg); 170 priv->cfg->valid_tx_ant = EEPROM_RF_CFG_TX_ANT_MSK(radio_cfg);
171 priv->cfg->valid_rx_ant = EEPROM_RF_CFG_TX_ANT_MSK(radio_cfg); 171 priv->cfg->valid_rx_ant = EEPROM_RF_CFG_RX_ANT_MSK(radio_cfg);
172 if (!priv->cfg->valid_tx_ant || !priv->cfg->valid_rx_ant) { 172 if (!priv->cfg->valid_tx_ant || !priv->cfg->valid_rx_ant) {
173 IWL_ERR(priv, "Invalid chain (0X%x, 0X%x)\n", 173 IWL_ERR(priv, "Invalid chain (0X%x, 0X%x)\n",
174 priv->cfg->valid_tx_ant, 174 priv->cfg->valid_tx_ant,
diff --git a/drivers/net/wireless/iwmc3200wifi/netdev.c b/drivers/net/wireless/iwmc3200wifi/netdev.c
index 13a69ebf2a94..5091d77e02ce 100644
--- a/drivers/net/wireless/iwmc3200wifi/netdev.c
+++ b/drivers/net/wireless/iwmc3200wifi/netdev.c
@@ -126,6 +126,7 @@ void *iwm_if_alloc(int sizeof_bus, struct device *dev,
126 ndev = alloc_netdev_mq(0, "wlan%d", ether_setup, IWM_TX_QUEUES); 126 ndev = alloc_netdev_mq(0, "wlan%d", ether_setup, IWM_TX_QUEUES);
127 if (!ndev) { 127 if (!ndev) {
128 dev_err(dev, "no memory for network device instance\n"); 128 dev_err(dev, "no memory for network device instance\n");
129 ret = -ENOMEM;
129 goto out_priv; 130 goto out_priv;
130 } 131 }
131 132
@@ -138,6 +139,7 @@ void *iwm_if_alloc(int sizeof_bus, struct device *dev,
138 GFP_KERNEL); 139 GFP_KERNEL);
139 if (!iwm->umac_profile) { 140 if (!iwm->umac_profile) {
140 dev_err(dev, "Couldn't alloc memory for profile\n"); 141 dev_err(dev, "Couldn't alloc memory for profile\n");
142 ret = -ENOMEM;
141 goto out_profile; 143 goto out_profile;
142 } 144 }
143 145
diff --git a/drivers/net/wireless/rt2x00/rt2x00firmware.c b/drivers/net/wireless/rt2x00/rt2x00firmware.c
index f0e1eb72befc..be0ff78c1b16 100644
--- a/drivers/net/wireless/rt2x00/rt2x00firmware.c
+++ b/drivers/net/wireless/rt2x00/rt2x00firmware.c
@@ -58,6 +58,7 @@ static int rt2x00lib_request_firmware(struct rt2x00_dev *rt2x00dev)
58 58
59 if (!fw || !fw->size || !fw->data) { 59 if (!fw || !fw->size || !fw->data) {
60 ERROR(rt2x00dev, "Failed to read Firmware.\n"); 60 ERROR(rt2x00dev, "Failed to read Firmware.\n");
61 release_firmware(fw);
61 return -ENOENT; 62 return -ENOENT;
62 } 63 }
63 64
diff --git a/drivers/pci/pcie/Kconfig b/drivers/pci/pcie/Kconfig
index dda70981b7a6..dc29348264c6 100644
--- a/drivers/pci/pcie/Kconfig
+++ b/drivers/pci/pcie/Kconfig
@@ -31,7 +31,7 @@ source "drivers/pci/pcie/aer/Kconfig"
31# PCI Express ASPM 31# PCI Express ASPM
32# 32#
33config PCIEASPM 33config PCIEASPM
34 bool "PCI Express ASPM control" if EMBEDDED 34 bool "PCI Express ASPM control" if EXPERT
35 depends on PCI && PCIEPORTBUS 35 depends on PCI && PCIEPORTBUS
36 default y 36 default y
37 help 37 help
diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig
index de886f3dfd39..6e318ce41136 100644
--- a/drivers/pcmcia/Kconfig
+++ b/drivers/pcmcia/Kconfig
@@ -69,7 +69,7 @@ comment "PC-card bridges"
69config YENTA 69config YENTA
70 tristate "CardBus yenta-compatible bridge support" 70 tristate "CardBus yenta-compatible bridge support"
71 depends on PCI 71 depends on PCI
72 select CARDBUS if !EMBEDDED 72 select CARDBUS if !EXPERT
73 select PCCARD_NONSTATIC if PCMCIA != n 73 select PCCARD_NONSTATIC if PCMCIA != n
74 ---help--- 74 ---help---
75 This option enables support for CardBus host bridges. Virtually 75 This option enables support for CardBus host bridges. Virtually
@@ -84,27 +84,27 @@ config YENTA
84 84
85config YENTA_O2 85config YENTA_O2
86 default y 86 default y
87 bool "Special initialization for O2Micro bridges" if EMBEDDED 87 bool "Special initialization for O2Micro bridges" if EXPERT
88 depends on YENTA 88 depends on YENTA
89 89
90config YENTA_RICOH 90config YENTA_RICOH
91 default y 91 default y
92 bool "Special initialization for Ricoh bridges" if EMBEDDED 92 bool "Special initialization for Ricoh bridges" if EXPERT
93 depends on YENTA 93 depends on YENTA
94 94
95config YENTA_TI 95config YENTA_TI
96 default y 96 default y
97 bool "Special initialization for TI and EnE bridges" if EMBEDDED 97 bool "Special initialization for TI and EnE bridges" if EXPERT
98 depends on YENTA 98 depends on YENTA
99 99
100config YENTA_ENE_TUNE 100config YENTA_ENE_TUNE
101 default y 101 default y
102 bool "Auto-tune EnE bridges for CB cards" if EMBEDDED 102 bool "Auto-tune EnE bridges for CB cards" if EXPERT
103 depends on YENTA_TI && CARDBUS 103 depends on YENTA_TI && CARDBUS
104 104
105config YENTA_TOSHIBA 105config YENTA_TOSHIBA
106 default y 106 default y
107 bool "Special initialization for Toshiba ToPIC bridges" if EMBEDDED 107 bool "Special initialization for Toshiba ToPIC bridges" if EXPERT
108 depends on YENTA 108 depends on YENTA
109 109
110config PD6729 110config PD6729
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index 7a7a1b664781..2ac8f6aff5a4 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -831,12 +831,14 @@ tx_drop:
831 return NETDEV_TX_OK; 831 return NETDEV_TX_OK;
832} 832}
833 833
834static int qeth_l2_open(struct net_device *dev) 834static int __qeth_l2_open(struct net_device *dev)
835{ 835{
836 struct qeth_card *card = dev->ml_priv; 836 struct qeth_card *card = dev->ml_priv;
837 int rc = 0; 837 int rc = 0;
838 838
839 QETH_CARD_TEXT(card, 4, "qethopen"); 839 QETH_CARD_TEXT(card, 4, "qethopen");
840 if (card->state == CARD_STATE_UP)
841 return rc;
840 if (card->state != CARD_STATE_SOFTSETUP) 842 if (card->state != CARD_STATE_SOFTSETUP)
841 return -ENODEV; 843 return -ENODEV;
842 844
@@ -857,6 +859,18 @@ static int qeth_l2_open(struct net_device *dev)
857 return rc; 859 return rc;
858} 860}
859 861
862static int qeth_l2_open(struct net_device *dev)
863{
864 struct qeth_card *card = dev->ml_priv;
865
866 QETH_CARD_TEXT(card, 5, "qethope_");
867 if (qeth_wait_for_threads(card, QETH_RECOVER_THREAD)) {
868 QETH_CARD_TEXT(card, 3, "openREC");
869 return -ERESTARTSYS;
870 }
871 return __qeth_l2_open(dev);
872}
873
860static int qeth_l2_stop(struct net_device *dev) 874static int qeth_l2_stop(struct net_device *dev)
861{ 875{
862 struct qeth_card *card = dev->ml_priv; 876 struct qeth_card *card = dev->ml_priv;
@@ -1046,7 +1060,7 @@ contin:
1046 if (recover_flag == CARD_STATE_RECOVER) { 1060 if (recover_flag == CARD_STATE_RECOVER) {
1047 if (recovery_mode && 1061 if (recovery_mode &&
1048 card->info.type != QETH_CARD_TYPE_OSN) { 1062 card->info.type != QETH_CARD_TYPE_OSN) {
1049 qeth_l2_open(card->dev); 1063 __qeth_l2_open(card->dev);
1050 } else { 1064 } else {
1051 rtnl_lock(); 1065 rtnl_lock();
1052 dev_open(card->dev); 1066 dev_open(card->dev);
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index e227e465bfc4..d09b0c44fc3d 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -2998,7 +2998,9 @@ static inline void qeth_l3_hdr_csum(struct qeth_card *card,
2998 */ 2998 */
2999 if (iph->protocol == IPPROTO_UDP) 2999 if (iph->protocol == IPPROTO_UDP)
3000 hdr->hdr.l3.ext_flags |= QETH_HDR_EXT_UDP; 3000 hdr->hdr.l3.ext_flags |= QETH_HDR_EXT_UDP;
3001 hdr->hdr.l3.ext_flags |= QETH_HDR_EXT_CSUM_TRANSP_REQ; 3001 hdr->hdr.l3.ext_flags |= QETH_HDR_EXT_CSUM_TRANSP_REQ |
3002 QETH_HDR_EXT_CSUM_HDR_REQ;
3003 iph->check = 0;
3002 if (card->options.performance_stats) 3004 if (card->options.performance_stats)
3003 card->perf_stats.tx_csum++; 3005 card->perf_stats.tx_csum++;
3004} 3006}
@@ -3240,12 +3242,14 @@ tx_drop:
3240 return NETDEV_TX_OK; 3242 return NETDEV_TX_OK;
3241} 3243}
3242 3244
3243static int qeth_l3_open(struct net_device *dev) 3245static int __qeth_l3_open(struct net_device *dev)
3244{ 3246{
3245 struct qeth_card *card = dev->ml_priv; 3247 struct qeth_card *card = dev->ml_priv;
3246 int rc = 0; 3248 int rc = 0;
3247 3249
3248 QETH_CARD_TEXT(card, 4, "qethopen"); 3250 QETH_CARD_TEXT(card, 4, "qethopen");
3251 if (card->state == CARD_STATE_UP)
3252 return rc;
3249 if (card->state != CARD_STATE_SOFTSETUP) 3253 if (card->state != CARD_STATE_SOFTSETUP)
3250 return -ENODEV; 3254 return -ENODEV;
3251 card->data.state = CH_STATE_UP; 3255 card->data.state = CH_STATE_UP;
@@ -3260,6 +3264,18 @@ static int qeth_l3_open(struct net_device *dev)
3260 return rc; 3264 return rc;
3261} 3265}
3262 3266
3267static int qeth_l3_open(struct net_device *dev)
3268{
3269 struct qeth_card *card = dev->ml_priv;
3270
3271 QETH_CARD_TEXT(card, 5, "qethope_");
3272 if (qeth_wait_for_threads(card, QETH_RECOVER_THREAD)) {
3273 QETH_CARD_TEXT(card, 3, "openREC");
3274 return -ERESTARTSYS;
3275 }
3276 return __qeth_l3_open(dev);
3277}
3278
3263static int qeth_l3_stop(struct net_device *dev) 3279static int qeth_l3_stop(struct net_device *dev)
3264{ 3280{
3265 struct qeth_card *card = dev->ml_priv; 3281 struct qeth_card *card = dev->ml_priv;
@@ -3564,7 +3580,7 @@ contin:
3564 netif_carrier_off(card->dev); 3580 netif_carrier_off(card->dev);
3565 if (recover_flag == CARD_STATE_RECOVER) { 3581 if (recover_flag == CARD_STATE_RECOVER) {
3566 if (recovery_mode) 3582 if (recovery_mode)
3567 qeth_l3_open(card->dev); 3583 __qeth_l3_open(card->dev);
3568 else { 3584 else {
3569 rtnl_lock(); 3585 rtnl_lock();
3570 dev_open(card->dev); 3586 dev_open(card->dev);
diff --git a/drivers/ssb/Kconfig b/drivers/ssb/Kconfig
index 2d8cc455dbc7..42cdaa9a4d8a 100644
--- a/drivers/ssb/Kconfig
+++ b/drivers/ssb/Kconfig
@@ -82,7 +82,7 @@ config SSB_SDIOHOST
82 82
83config SSB_SILENT 83config SSB_SILENT
84 bool "No SSB kernel messages" 84 bool "No SSB kernel messages"
85 depends on SSB && EMBEDDED 85 depends on SSB && EXPERT
86 help 86 help
87 This option turns off all Sonics Silicon Backplane printks. 87 This option turns off all Sonics Silicon Backplane printks.
88 Note that you won't be able to identify problems, once 88 Note that you won't be able to identify problems, once
diff --git a/drivers/staging/lirc/TODO.lirc_zilog b/drivers/staging/lirc/TODO.lirc_zilog
index 6aa312df4018..2d0263f07937 100644
--- a/drivers/staging/lirc/TODO.lirc_zilog
+++ b/drivers/staging/lirc/TODO.lirc_zilog
@@ -1,13 +1,37 @@
1The binding between hdpvr and lirc_zilog is currently disabled, 11. Both ir-kbd-i2c and lirc_zilog provide support for RX events.
2The 'tx_only' lirc_zilog module parameter will allow ir-kbd-i2c
3and lirc_zilog to coexist in the kernel, if the user requires such a set-up.
4However the IR unit will not work well without coordination between the
5two modules. A shared mutex, for transceiver access locking, needs to be
6supplied by bridge drivers, in struct IR_i2_init_data, to both ir-kbd-i2c
7and lirc_zilog, before they will coexist usefully. This should be fixed
8before moving out of staging.
9
102. References and locking need careful examination. For cx18 and ivtv PCI
11cards, which are not easily "hot unplugged", the imperfect state of reference
12counting and locking is acceptable if not correct. For USB connected units
13like HD PVR, PVR USB2, HVR-1900, and HVR1950, the likelyhood of an Ooops on
14unplug is probably great. Proper reference counting and locking needs to be
15implemented before this module is moved out of staging.
16
173. The binding between hdpvr and lirc_zilog is currently disabled,
2due to an OOPS reported a few years ago when both the hdpvr and cx18 18due to an OOPS reported a few years ago when both the hdpvr and cx18
3drivers were loaded in his system. More details can be seen at: 19drivers were loaded in his system. More details can be seen at:
4 http://www.mail-archive.com/linux-media@vger.kernel.org/msg09163.html 20 http://www.mail-archive.com/linux-media@vger.kernel.org/msg09163.html
5More tests need to be done, in order to fix the reported issue. 21More tests need to be done, in order to fix the reported issue.
6 22
7There's a conflict between ir-kbd-i2c: Both provide support for RX events. 234. In addition to providing a shared mutex for transceiver access
8Such conflict needs to be fixed, before moving it out of staging. 24locking, bridge drivers, if able, should provide a chip reset() callback
25to lirc_zilog via struct IR_i2c_init_data. cx18 and ivtv already have routines
26to perform Z8 chip resets via GPIO manipulations. This will allow lirc_zilog
27to bring the chip back to normal when it hangs, in the same places the
28original lirc_pvr150 driver code does. This is not strictly needed, so it
29is not required to move lirc_zilog out of staging.
30
315. Both lirc_zilog and ir-kbd-i2c support the Zilog Z8 for IR, as programmed
32and installed on Hauppauge products. When working on either module, developers
33must consider at least the following bridge drivers which mention an IR Rx unit
34at address 0x71 (indicative of a Z8):
9 35
10The way I2C probe works, it will try to register the driver twice, one 36 ivtv cx18 hdpvr pvrusb2 bt8xx cx88 saa7134
11for RX and another for TX. The logic needs to be fixed to avoid such
12issue.
13 37
diff --git a/drivers/staging/lirc/lirc_imon.c b/drivers/staging/lirc/lirc_imon.c
index 0da6b9518af9..235cab0eb087 100644
--- a/drivers/staging/lirc/lirc_imon.c
+++ b/drivers/staging/lirc/lirc_imon.c
@@ -447,6 +447,7 @@ static ssize_t vfd_write(struct file *file, const char *buf,
447 447
448exit: 448exit:
449 mutex_unlock(&context->ctx_lock); 449 mutex_unlock(&context->ctx_lock);
450 kfree(data_buf);
450 451
451 return (!retval) ? n_bytes : retval; 452 return (!retval) ? n_bytes : retval;
452} 453}
diff --git a/drivers/staging/lirc/lirc_it87.c b/drivers/staging/lirc/lirc_it87.c
index 929ae5795467..5938616f3e8f 100644
--- a/drivers/staging/lirc/lirc_it87.c
+++ b/drivers/staging/lirc/lirc_it87.c
@@ -232,6 +232,7 @@ static ssize_t lirc_write(struct file *file, const char *buf,
232 i++; 232 i++;
233 } 233 }
234 terminate_send(tx_buf[i - 1]); 234 terminate_send(tx_buf[i - 1]);
235 kfree(tx_buf);
235 return n; 236 return n;
236} 237}
237 238
diff --git a/drivers/staging/lirc/lirc_parallel.c b/drivers/staging/lirc/lirc_parallel.c
index dfd2c447e67d..3a9c09881b2b 100644
--- a/drivers/staging/lirc/lirc_parallel.c
+++ b/drivers/staging/lirc/lirc_parallel.c
@@ -376,6 +376,7 @@ static ssize_t lirc_write(struct file *filep, const char *buf, size_t n,
376 unsigned long flags; 376 unsigned long flags;
377 int counttimer; 377 int counttimer;
378 int *wbuf; 378 int *wbuf;
379 ssize_t ret;
379 380
380 if (!is_claimed) 381 if (!is_claimed)
381 return -EBUSY; 382 return -EBUSY;
@@ -393,8 +394,10 @@ static ssize_t lirc_write(struct file *filep, const char *buf, size_t n,
393 if (timer == 0) { 394 if (timer == 0) {
394 /* try again if device is ready */ 395 /* try again if device is ready */
395 timer = init_lirc_timer(); 396 timer = init_lirc_timer();
396 if (timer == 0) 397 if (timer == 0) {
397 return -EIO; 398 ret = -EIO;
399 goto out;
400 }
398 } 401 }
399 402
400 /* adjust values from usecs */ 403 /* adjust values from usecs */
@@ -420,7 +423,8 @@ static ssize_t lirc_write(struct file *filep, const char *buf, size_t n,
420 if (check_pselecd && (in(1) & LP_PSELECD)) { 423 if (check_pselecd && (in(1) & LP_PSELECD)) {
421 lirc_off(); 424 lirc_off();
422 local_irq_restore(flags); 425 local_irq_restore(flags);
423 return -EIO; 426 ret = -EIO;
427 goto out;
424 } 428 }
425 } while (counttimer < wbuf[i]); 429 } while (counttimer < wbuf[i]);
426 i++; 430 i++;
@@ -436,7 +440,8 @@ static ssize_t lirc_write(struct file *filep, const char *buf, size_t n,
436 level = newlevel; 440 level = newlevel;
437 if (check_pselecd && (in(1) & LP_PSELECD)) { 441 if (check_pselecd && (in(1) & LP_PSELECD)) {
438 local_irq_restore(flags); 442 local_irq_restore(flags);
439 return -EIO; 443 ret = -EIO;
444 goto out;
440 } 445 }
441 } while (counttimer < wbuf[i]); 446 } while (counttimer < wbuf[i]);
442 i++; 447 i++;
@@ -445,7 +450,11 @@ static ssize_t lirc_write(struct file *filep, const char *buf, size_t n,
445#else 450#else
446 /* place code that handles write without external timer here */ 451 /* place code that handles write without external timer here */
447#endif 452#endif
448 return n; 453 ret = n;
454out:
455 kfree(wbuf);
456
457 return ret;
449} 458}
450 459
451static unsigned int lirc_poll(struct file *file, poll_table *wait) 460static unsigned int lirc_poll(struct file *file, poll_table *wait)
diff --git a/drivers/staging/lirc/lirc_sasem.c b/drivers/staging/lirc/lirc_sasem.c
index 998485ebdbce..925eabe14854 100644
--- a/drivers/staging/lirc/lirc_sasem.c
+++ b/drivers/staging/lirc/lirc_sasem.c
@@ -448,6 +448,7 @@ static ssize_t vfd_write(struct file *file, const char *buf,
448exit: 448exit:
449 449
450 mutex_unlock(&context->ctx_lock); 450 mutex_unlock(&context->ctx_lock);
451 kfree(data_buf);
451 452
452 return (!retval) ? n_bytes : retval; 453 return (!retval) ? n_bytes : retval;
453} 454}
diff --git a/drivers/staging/lirc/lirc_serial.c b/drivers/staging/lirc/lirc_serial.c
index 9bcf149c4260..1c3099b388e0 100644
--- a/drivers/staging/lirc/lirc_serial.c
+++ b/drivers/staging/lirc/lirc_serial.c
@@ -966,7 +966,7 @@ static ssize_t lirc_write(struct file *file, const char *buf,
966 if (n % sizeof(int) || count % 2 == 0) 966 if (n % sizeof(int) || count % 2 == 0)
967 return -EINVAL; 967 return -EINVAL;
968 wbuf = memdup_user(buf, n); 968 wbuf = memdup_user(buf, n);
969 if (PTR_ERR(wbuf)) 969 if (IS_ERR(wbuf))
970 return PTR_ERR(wbuf); 970 return PTR_ERR(wbuf);
971 spin_lock_irqsave(&hardware[type].lock, flags); 971 spin_lock_irqsave(&hardware[type].lock, flags);
972 if (type == LIRC_IRDEO) { 972 if (type == LIRC_IRDEO) {
@@ -981,6 +981,7 @@ static ssize_t lirc_write(struct file *file, const char *buf,
981 } 981 }
982 off(); 982 off();
983 spin_unlock_irqrestore(&hardware[type].lock, flags); 983 spin_unlock_irqrestore(&hardware[type].lock, flags);
984 kfree(wbuf);
984 return n; 985 return n;
985} 986}
986 987
diff --git a/drivers/staging/lirc/lirc_sir.c b/drivers/staging/lirc/lirc_sir.c
index c553ab626238..76be7b8c6209 100644
--- a/drivers/staging/lirc/lirc_sir.c
+++ b/drivers/staging/lirc/lirc_sir.c
@@ -330,6 +330,7 @@ static ssize_t lirc_write(struct file *file, const char *buf, size_t n,
330 /* enable receiver */ 330 /* enable receiver */
331 Ser2UTCR3 = UTCR3_RXE|UTCR3_RIE; 331 Ser2UTCR3 = UTCR3_RXE|UTCR3_RIE;
332#endif 332#endif
333 kfree(tx_buf);
333 return count; 334 return count;
334} 335}
335 336
diff --git a/drivers/staging/lirc/lirc_zilog.c b/drivers/staging/lirc/lirc_zilog.c
index ad29bb1275ab..3fe5f4160194 100644
--- a/drivers/staging/lirc/lirc_zilog.c
+++ b/drivers/staging/lirc/lirc_zilog.c
@@ -20,6 +20,9 @@
20 * 20 *
21 * parts are cut&pasted from the lirc_i2c.c driver 21 * parts are cut&pasted from the lirc_i2c.c driver
22 * 22 *
23 * Numerous changes updating lirc_zilog.c in kernel 2.6.38 and later are
24 * Copyright (C) 2011 Andy Walls <awalls@md.metrocast.net>
25 *
23 * This program is free software; you can redistribute it and/or modify 26 * This program is free software; you can redistribute it and/or modify
24 * it under the terms of the GNU General Public License as published by 27 * it under the terms of the GNU General Public License as published by
25 * the Free Software Foundation; either version 2 of the License, or 28 * the Free Software Foundation; either version 2 of the License, or
@@ -60,38 +63,44 @@
60#include <media/lirc_dev.h> 63#include <media/lirc_dev.h>
61#include <media/lirc.h> 64#include <media/lirc.h>
62 65
63struct IR { 66struct IR_rx {
64 struct lirc_driver l;
65
66 /* Device info */
67 struct mutex ir_lock;
68 int open;
69 bool is_hdpvr;
70
71 /* RX device */ 67 /* RX device */
72 struct i2c_client c_rx; 68 struct i2c_client *c;
73 int have_rx;
74 69
75 /* RX device buffer & lock */ 70 /* RX device buffer & lock */
76 struct lirc_buffer buf; 71 struct lirc_buffer buf;
77 struct mutex buf_lock; 72 struct mutex buf_lock;
78 73
79 /* RX polling thread data */ 74 /* RX polling thread data */
80 struct completion *t_notify;
81 struct completion *t_notify2;
82 int shutdown;
83 struct task_struct *task; 75 struct task_struct *task;
84 76
85 /* RX read data */ 77 /* RX read data */
86 unsigned char b[3]; 78 unsigned char b[3];
79 bool hdpvr_data_fmt;
80};
87 81
82struct IR_tx {
88 /* TX device */ 83 /* TX device */
89 struct i2c_client c_tx; 84 struct i2c_client *c;
85
86 /* TX additional actions needed */
90 int need_boot; 87 int need_boot;
91 int have_tx; 88 bool post_tx_ready_poll;
89};
90
91struct IR {
92 struct lirc_driver l;
93
94 struct mutex ir_lock;
95 int open;
96
97 struct i2c_adapter *adapter;
98 struct IR_rx *rx;
99 struct IR_tx *tx;
92}; 100};
93 101
94/* Minor -> data mapping */ 102/* Minor -> data mapping */
103static struct mutex ir_devices_lock;
95static struct IR *ir_devices[MAX_IRCTL_DEVICES]; 104static struct IR *ir_devices[MAX_IRCTL_DEVICES];
96 105
97/* Block size for IR transmitter */ 106/* Block size for IR transmitter */
@@ -124,14 +133,11 @@ static struct mutex tx_data_lock;
124#define zilog_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, \ 133#define zilog_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, \
125 ## args) 134 ## args)
126#define zilog_error(s, args...) printk(KERN_ERR KBUILD_MODNAME ": " s, ## args) 135#define zilog_error(s, args...) printk(KERN_ERR KBUILD_MODNAME ": " s, ## args)
127 136#define zilog_info(s, args...) printk(KERN_INFO KBUILD_MODNAME ": " s, ## args)
128#define ZILOG_HAUPPAUGE_IR_RX_NAME "Zilog/Hauppauge IR RX"
129#define ZILOG_HAUPPAUGE_IR_TX_NAME "Zilog/Hauppauge IR TX"
130 137
131/* module parameters */ 138/* module parameters */
132static int debug; /* debug output */ 139static int debug; /* debug output */
133static int disable_rx; /* disable RX device */ 140static int tx_only; /* only handle the IR Tx function */
134static int disable_tx; /* disable TX device */
135static int minor = -1; /* minor number */ 141static int minor = -1; /* minor number */
136 142
137#define dprintk(fmt, args...) \ 143#define dprintk(fmt, args...) \
@@ -150,8 +156,12 @@ static int add_to_buf(struct IR *ir)
150 int ret; 156 int ret;
151 int failures = 0; 157 int failures = 0;
152 unsigned char sendbuf[1] = { 0 }; 158 unsigned char sendbuf[1] = { 0 };
159 struct IR_rx *rx = ir->rx;
153 160
154 if (lirc_buffer_full(&ir->buf)) { 161 if (rx == NULL)
162 return -ENXIO;
163
164 if (lirc_buffer_full(&rx->buf)) {
155 dprintk("buffer overflow\n"); 165 dprintk("buffer overflow\n");
156 return -EOVERFLOW; 166 return -EOVERFLOW;
157 } 167 }
@@ -161,17 +171,25 @@ static int add_to_buf(struct IR *ir)
161 * data and we have space 171 * data and we have space
162 */ 172 */
163 do { 173 do {
174 if (kthread_should_stop())
175 return -ENODATA;
176
164 /* 177 /*
165 * Lock i2c bus for the duration. RX/TX chips interfere so 178 * Lock i2c bus for the duration. RX/TX chips interfere so
166 * this is worth it 179 * this is worth it
167 */ 180 */
168 mutex_lock(&ir->ir_lock); 181 mutex_lock(&ir->ir_lock);
169 182
183 if (kthread_should_stop()) {
184 mutex_unlock(&ir->ir_lock);
185 return -ENODATA;
186 }
187
170 /* 188 /*
171 * Send random "poll command" (?) Windows driver does this 189 * Send random "poll command" (?) Windows driver does this
172 * and it is a good point to detect chip failure. 190 * and it is a good point to detect chip failure.
173 */ 191 */
174 ret = i2c_master_send(&ir->c_rx, sendbuf, 1); 192 ret = i2c_master_send(rx->c, sendbuf, 1);
175 if (ret != 1) { 193 if (ret != 1) {
176 zilog_error("i2c_master_send failed with %d\n", ret); 194 zilog_error("i2c_master_send failed with %d\n", ret);
177 if (failures >= 3) { 195 if (failures >= 3) {
@@ -186,45 +204,53 @@ static int add_to_buf(struct IR *ir)
186 "trying reset\n"); 204 "trying reset\n");
187 205
188 set_current_state(TASK_UNINTERRUPTIBLE); 206 set_current_state(TASK_UNINTERRUPTIBLE);
207 if (kthread_should_stop()) {
208 mutex_unlock(&ir->ir_lock);
209 return -ENODATA;
210 }
189 schedule_timeout((100 * HZ + 999) / 1000); 211 schedule_timeout((100 * HZ + 999) / 1000);
190 ir->need_boot = 1; 212 ir->tx->need_boot = 1;
191 213
192 ++failures; 214 ++failures;
193 mutex_unlock(&ir->ir_lock); 215 mutex_unlock(&ir->ir_lock);
194 continue; 216 continue;
195 } 217 }
196 218
197 ret = i2c_master_recv(&ir->c_rx, keybuf, sizeof(keybuf)); 219 if (kthread_should_stop()) {
220 mutex_unlock(&ir->ir_lock);
221 return -ENODATA;
222 }
223 ret = i2c_master_recv(rx->c, keybuf, sizeof(keybuf));
198 mutex_unlock(&ir->ir_lock); 224 mutex_unlock(&ir->ir_lock);
199 if (ret != sizeof(keybuf)) { 225 if (ret != sizeof(keybuf)) {
200 zilog_error("i2c_master_recv failed with %d -- " 226 zilog_error("i2c_master_recv failed with %d -- "
201 "keeping last read buffer\n", ret); 227 "keeping last read buffer\n", ret);
202 } else { 228 } else {
203 ir->b[0] = keybuf[3]; 229 rx->b[0] = keybuf[3];
204 ir->b[1] = keybuf[4]; 230 rx->b[1] = keybuf[4];
205 ir->b[2] = keybuf[5]; 231 rx->b[2] = keybuf[5];
206 dprintk("key (0x%02x/0x%02x)\n", ir->b[0], ir->b[1]); 232 dprintk("key (0x%02x/0x%02x)\n", rx->b[0], rx->b[1]);
207 } 233 }
208 234
209 /* key pressed ? */ 235 /* key pressed ? */
210 if (ir->is_hdpvr) { 236 if (rx->hdpvr_data_fmt) {
211 if (got_data && (keybuf[0] == 0x80)) 237 if (got_data && (keybuf[0] == 0x80))
212 return 0; 238 return 0;
213 else if (got_data && (keybuf[0] == 0x00)) 239 else if (got_data && (keybuf[0] == 0x00))
214 return -ENODATA; 240 return -ENODATA;
215 } else if ((ir->b[0] & 0x80) == 0) 241 } else if ((rx->b[0] & 0x80) == 0)
216 return got_data ? 0 : -ENODATA; 242 return got_data ? 0 : -ENODATA;
217 243
218 /* look what we have */ 244 /* look what we have */
219 code = (((__u16)ir->b[0] & 0x7f) << 6) | (ir->b[1] >> 2); 245 code = (((__u16)rx->b[0] & 0x7f) << 6) | (rx->b[1] >> 2);
220 246
221 codes[0] = (code >> 8) & 0xff; 247 codes[0] = (code >> 8) & 0xff;
222 codes[1] = code & 0xff; 248 codes[1] = code & 0xff;
223 249
224 /* return it */ 250 /* return it */
225 lirc_buffer_write(&ir->buf, codes); 251 lirc_buffer_write(&rx->buf, codes);
226 ++got_data; 252 ++got_data;
227 } while (!lirc_buffer_full(&ir->buf)); 253 } while (!lirc_buffer_full(&rx->buf));
228 254
229 return 0; 255 return 0;
230} 256}
@@ -242,46 +268,35 @@ static int add_to_buf(struct IR *ir)
242static int lirc_thread(void *arg) 268static int lirc_thread(void *arg)
243{ 269{
244 struct IR *ir = arg; 270 struct IR *ir = arg;
245 271 struct IR_rx *rx = ir->rx;
246 if (ir->t_notify != NULL)
247 complete(ir->t_notify);
248 272
249 dprintk("poll thread started\n"); 273 dprintk("poll thread started\n");
250 274
251 do { 275 while (!kthread_should_stop()) {
252 if (ir->open) { 276 set_current_state(TASK_INTERRUPTIBLE);
253 set_current_state(TASK_INTERRUPTIBLE);
254 277
255 /* 278 /* if device not opened, we can sleep half a second */
256 * This is ~113*2 + 24 + jitter (2*repeat gap + 279 if (!ir->open) {
257 * code length). We use this interval as the chip
258 * resets every time you poll it (bad!). This is
259 * therefore just sufficient to catch all of the
260 * button presses. It makes the remote much more
261 * responsive. You can see the difference by
262 * running irw and holding down a button. With
263 * 100ms, the old polling interval, you'll notice
264 * breaks in the repeat sequence corresponding to
265 * lost keypresses.
266 */
267 schedule_timeout((260 * HZ) / 1000);
268 if (ir->shutdown)
269 break;
270 if (!add_to_buf(ir))
271 wake_up_interruptible(&ir->buf.wait_poll);
272 } else {
273 /* if device not opened so we can sleep half a second */
274 set_current_state(TASK_INTERRUPTIBLE);
275 schedule_timeout(HZ/2); 280 schedule_timeout(HZ/2);
281 continue;
276 } 282 }
277 } while (!ir->shutdown);
278
279 if (ir->t_notify2 != NULL)
280 wait_for_completion(ir->t_notify2);
281 283
282 ir->task = NULL; 284 /*
283 if (ir->t_notify != NULL) 285 * This is ~113*2 + 24 + jitter (2*repeat gap + code length).
284 complete(ir->t_notify); 286 * We use this interval as the chip resets every time you poll
287 * it (bad!). This is therefore just sufficient to catch all
288 * of the button presses. It makes the remote much more
289 * responsive. You can see the difference by running irw and
290 * holding down a button. With 100ms, the old polling
291 * interval, you'll notice breaks in the repeat sequence
292 * corresponding to lost keypresses.
293 */
294 schedule_timeout((260 * HZ) / 1000);
295 if (kthread_should_stop())
296 break;
297 if (!add_to_buf(ir))
298 wake_up_interruptible(&rx->buf.wait_poll);
299 }
285 300
286 dprintk("poll thread ended\n"); 301 dprintk("poll thread ended\n");
287 return 0; 302 return 0;
@@ -299,10 +314,10 @@ static int set_use_inc(void *data)
299 * this is completely broken code. lirc_unregister_driver() 314 * this is completely broken code. lirc_unregister_driver()
300 * must be possible even when the device is open 315 * must be possible even when the device is open
301 */ 316 */
302 if (ir->c_rx.addr) 317 if (ir->rx != NULL)
303 i2c_use_client(&ir->c_rx); 318 i2c_use_client(ir->rx->c);
304 if (ir->c_tx.addr) 319 if (ir->tx != NULL)
305 i2c_use_client(&ir->c_tx); 320 i2c_use_client(ir->tx->c);
306 321
307 return 0; 322 return 0;
308} 323}
@@ -311,10 +326,10 @@ static void set_use_dec(void *data)
311{ 326{
312 struct IR *ir = data; 327 struct IR *ir = data;
313 328
314 if (ir->c_rx.addr) 329 if (ir->rx)
315 i2c_release_client(&ir->c_rx); 330 i2c_release_client(ir->rx->c);
316 if (ir->c_tx.addr) 331 if (ir->tx)
317 i2c_release_client(&ir->c_tx); 332 i2c_release_client(ir->tx->c);
318 if (ir->l.owner != NULL) 333 if (ir->l.owner != NULL)
319 module_put(ir->l.owner); 334 module_put(ir->l.owner);
320} 335}
@@ -453,7 +468,7 @@ corrupt:
453} 468}
454 469
455/* send a block of data to the IR TX device */ 470/* send a block of data to the IR TX device */
456static int send_data_block(struct IR *ir, unsigned char *data_block) 471static int send_data_block(struct IR_tx *tx, unsigned char *data_block)
457{ 472{
458 int i, j, ret; 473 int i, j, ret;
459 unsigned char buf[5]; 474 unsigned char buf[5];
@@ -467,7 +482,7 @@ static int send_data_block(struct IR *ir, unsigned char *data_block)
467 buf[1 + j] = data_block[i + j]; 482 buf[1 + j] = data_block[i + j];
468 dprintk("%02x %02x %02x %02x %02x", 483 dprintk("%02x %02x %02x %02x %02x",
469 buf[0], buf[1], buf[2], buf[3], buf[4]); 484 buf[0], buf[1], buf[2], buf[3], buf[4]);
470 ret = i2c_master_send(&ir->c_tx, buf, tosend + 1); 485 ret = i2c_master_send(tx->c, buf, tosend + 1);
471 if (ret != tosend + 1) { 486 if (ret != tosend + 1) {
472 zilog_error("i2c_master_send failed with %d\n", ret); 487 zilog_error("i2c_master_send failed with %d\n", ret);
473 return ret < 0 ? ret : -EFAULT; 488 return ret < 0 ? ret : -EFAULT;
@@ -478,32 +493,32 @@ static int send_data_block(struct IR *ir, unsigned char *data_block)
478} 493}
479 494
480/* send boot data to the IR TX device */ 495/* send boot data to the IR TX device */
481static int send_boot_data(struct IR *ir) 496static int send_boot_data(struct IR_tx *tx)
482{ 497{
483 int ret; 498 int ret;
484 unsigned char buf[4]; 499 unsigned char buf[4];
485 500
486 /* send the boot block */ 501 /* send the boot block */
487 ret = send_data_block(ir, tx_data->boot_data); 502 ret = send_data_block(tx, tx_data->boot_data);
488 if (ret != 0) 503 if (ret != 0)
489 return ret; 504 return ret;
490 505
491 /* kick it off? */ 506 /* kick it off? */
492 buf[0] = 0x00; 507 buf[0] = 0x00;
493 buf[1] = 0x20; 508 buf[1] = 0x20;
494 ret = i2c_master_send(&ir->c_tx, buf, 2); 509 ret = i2c_master_send(tx->c, buf, 2);
495 if (ret != 2) { 510 if (ret != 2) {
496 zilog_error("i2c_master_send failed with %d\n", ret); 511 zilog_error("i2c_master_send failed with %d\n", ret);
497 return ret < 0 ? ret : -EFAULT; 512 return ret < 0 ? ret : -EFAULT;
498 } 513 }
499 ret = i2c_master_send(&ir->c_tx, buf, 1); 514 ret = i2c_master_send(tx->c, buf, 1);
500 if (ret != 1) { 515 if (ret != 1) {
501 zilog_error("i2c_master_send failed with %d\n", ret); 516 zilog_error("i2c_master_send failed with %d\n", ret);
502 return ret < 0 ? ret : -EFAULT; 517 return ret < 0 ? ret : -EFAULT;
503 } 518 }
504 519
505 /* Here comes the firmware version... (hopefully) */ 520 /* Here comes the firmware version... (hopefully) */
506 ret = i2c_master_recv(&ir->c_tx, buf, 4); 521 ret = i2c_master_recv(tx->c, buf, 4);
507 if (ret != 4) { 522 if (ret != 4) {
508 zilog_error("i2c_master_recv failed with %d\n", ret); 523 zilog_error("i2c_master_recv failed with %d\n", ret);
509 return 0; 524 return 0;
@@ -543,7 +558,7 @@ static void fw_unload(void)
543} 558}
544 559
545/* load "firmware" for the IR TX device */ 560/* load "firmware" for the IR TX device */
546static int fw_load(struct IR *ir) 561static int fw_load(struct IR_tx *tx)
547{ 562{
548 int ret; 563 int ret;
549 unsigned int i; 564 unsigned int i;
@@ -558,7 +573,7 @@ static int fw_load(struct IR *ir)
558 } 573 }
559 574
560 /* Request codeset data file */ 575 /* Request codeset data file */
561 ret = request_firmware(&fw_entry, "haup-ir-blaster.bin", &ir->c_tx.dev); 576 ret = request_firmware(&fw_entry, "haup-ir-blaster.bin", &tx->c->dev);
562 if (ret != 0) { 577 if (ret != 0) {
563 zilog_error("firmware haup-ir-blaster.bin not available " 578 zilog_error("firmware haup-ir-blaster.bin not available "
564 "(%d)\n", ret); 579 "(%d)\n", ret);
@@ -685,20 +700,20 @@ out:
685} 700}
686 701
687/* initialise the IR TX device */ 702/* initialise the IR TX device */
688static int tx_init(struct IR *ir) 703static int tx_init(struct IR_tx *tx)
689{ 704{
690 int ret; 705 int ret;
691 706
692 /* Load 'firmware' */ 707 /* Load 'firmware' */
693 ret = fw_load(ir); 708 ret = fw_load(tx);
694 if (ret != 0) 709 if (ret != 0)
695 return ret; 710 return ret;
696 711
697 /* Send boot block */ 712 /* Send boot block */
698 ret = send_boot_data(ir); 713 ret = send_boot_data(tx);
699 if (ret != 0) 714 if (ret != 0)
700 return ret; 715 return ret;
701 ir->need_boot = 0; 716 tx->need_boot = 0;
702 717
703 /* Looks good */ 718 /* Looks good */
704 return 0; 719 return 0;
@@ -714,20 +729,20 @@ static loff_t lseek(struct file *filep, loff_t offset, int orig)
714static ssize_t read(struct file *filep, char *outbuf, size_t n, loff_t *ppos) 729static ssize_t read(struct file *filep, char *outbuf, size_t n, loff_t *ppos)
715{ 730{
716 struct IR *ir = filep->private_data; 731 struct IR *ir = filep->private_data;
717 unsigned char buf[ir->buf.chunk_size]; 732 struct IR_rx *rx = ir->rx;
718 int ret = 0, written = 0; 733 int ret = 0, written = 0;
719 DECLARE_WAITQUEUE(wait, current); 734 DECLARE_WAITQUEUE(wait, current);
720 735
721 dprintk("read called\n"); 736 dprintk("read called\n");
722 if (ir->c_rx.addr == 0) 737 if (rx == NULL)
723 return -ENODEV; 738 return -ENODEV;
724 739
725 if (mutex_lock_interruptible(&ir->buf_lock)) 740 if (mutex_lock_interruptible(&rx->buf_lock))
726 return -ERESTARTSYS; 741 return -ERESTARTSYS;
727 742
728 if (n % ir->buf.chunk_size) { 743 if (n % rx->buf.chunk_size) {
729 dprintk("read result = -EINVAL\n"); 744 dprintk("read result = -EINVAL\n");
730 mutex_unlock(&ir->buf_lock); 745 mutex_unlock(&rx->buf_lock);
731 return -EINVAL; 746 return -EINVAL;
732 } 747 }
733 748
@@ -736,7 +751,7 @@ static ssize_t read(struct file *filep, char *outbuf, size_t n, loff_t *ppos)
736 * to avoid losing scan code (in case when queue is awaken somewhere 751 * to avoid losing scan code (in case when queue is awaken somewhere
737 * between while condition checking and scheduling) 752 * between while condition checking and scheduling)
738 */ 753 */
739 add_wait_queue(&ir->buf.wait_poll, &wait); 754 add_wait_queue(&rx->buf.wait_poll, &wait);
740 set_current_state(TASK_INTERRUPTIBLE); 755 set_current_state(TASK_INTERRUPTIBLE);
741 756
742 /* 757 /*
@@ -744,7 +759,7 @@ static ssize_t read(struct file *filep, char *outbuf, size_t n, loff_t *ppos)
744 * mode and 'copy_to_user' is happy, wait for data. 759 * mode and 'copy_to_user' is happy, wait for data.
745 */ 760 */
746 while (written < n && ret == 0) { 761 while (written < n && ret == 0) {
747 if (lirc_buffer_empty(&ir->buf)) { 762 if (lirc_buffer_empty(&rx->buf)) {
748 /* 763 /*
749 * According to the read(2) man page, 'written' can be 764 * According to the read(2) man page, 'written' can be
750 * returned as less than 'n', instead of blocking 765 * returned as less than 'n', instead of blocking
@@ -764,16 +779,17 @@ static ssize_t read(struct file *filep, char *outbuf, size_t n, loff_t *ppos)
764 schedule(); 779 schedule();
765 set_current_state(TASK_INTERRUPTIBLE); 780 set_current_state(TASK_INTERRUPTIBLE);
766 } else { 781 } else {
767 lirc_buffer_read(&ir->buf, buf); 782 unsigned char buf[rx->buf.chunk_size];
783 lirc_buffer_read(&rx->buf, buf);
768 ret = copy_to_user((void *)outbuf+written, buf, 784 ret = copy_to_user((void *)outbuf+written, buf,
769 ir->buf.chunk_size); 785 rx->buf.chunk_size);
770 written += ir->buf.chunk_size; 786 written += rx->buf.chunk_size;
771 } 787 }
772 } 788 }
773 789
774 remove_wait_queue(&ir->buf.wait_poll, &wait); 790 remove_wait_queue(&rx->buf.wait_poll, &wait);
775 set_current_state(TASK_RUNNING); 791 set_current_state(TASK_RUNNING);
776 mutex_unlock(&ir->buf_lock); 792 mutex_unlock(&rx->buf_lock);
777 793
778 dprintk("read result = %s (%d)\n", 794 dprintk("read result = %s (%d)\n",
779 ret ? "-EFAULT" : "OK", ret); 795 ret ? "-EFAULT" : "OK", ret);
@@ -782,7 +798,7 @@ static ssize_t read(struct file *filep, char *outbuf, size_t n, loff_t *ppos)
782} 798}
783 799
784/* send a keypress to the IR TX device */ 800/* send a keypress to the IR TX device */
785static int send_code(struct IR *ir, unsigned int code, unsigned int key) 801static int send_code(struct IR_tx *tx, unsigned int code, unsigned int key)
786{ 802{
787 unsigned char data_block[TX_BLOCK_SIZE]; 803 unsigned char data_block[TX_BLOCK_SIZE];
788 unsigned char buf[2]; 804 unsigned char buf[2];
@@ -799,26 +815,26 @@ static int send_code(struct IR *ir, unsigned int code, unsigned int key)
799 return ret; 815 return ret;
800 816
801 /* Send the data block */ 817 /* Send the data block */
802 ret = send_data_block(ir, data_block); 818 ret = send_data_block(tx, data_block);
803 if (ret != 0) 819 if (ret != 0)
804 return ret; 820 return ret;
805 821
806 /* Send data block length? */ 822 /* Send data block length? */
807 buf[0] = 0x00; 823 buf[0] = 0x00;
808 buf[1] = 0x40; 824 buf[1] = 0x40;
809 ret = i2c_master_send(&ir->c_tx, buf, 2); 825 ret = i2c_master_send(tx->c, buf, 2);
810 if (ret != 2) { 826 if (ret != 2) {
811 zilog_error("i2c_master_send failed with %d\n", ret); 827 zilog_error("i2c_master_send failed with %d\n", ret);
812 return ret < 0 ? ret : -EFAULT; 828 return ret < 0 ? ret : -EFAULT;
813 } 829 }
814 ret = i2c_master_send(&ir->c_tx, buf, 1); 830 ret = i2c_master_send(tx->c, buf, 1);
815 if (ret != 1) { 831 if (ret != 1) {
816 zilog_error("i2c_master_send failed with %d\n", ret); 832 zilog_error("i2c_master_send failed with %d\n", ret);
817 return ret < 0 ? ret : -EFAULT; 833 return ret < 0 ? ret : -EFAULT;
818 } 834 }
819 835
820 /* Send finished download? */ 836 /* Send finished download? */
821 ret = i2c_master_recv(&ir->c_tx, buf, 1); 837 ret = i2c_master_recv(tx->c, buf, 1);
822 if (ret != 1) { 838 if (ret != 1) {
823 zilog_error("i2c_master_recv failed with %d\n", ret); 839 zilog_error("i2c_master_recv failed with %d\n", ret);
824 return ret < 0 ? ret : -EFAULT; 840 return ret < 0 ? ret : -EFAULT;
@@ -832,7 +848,7 @@ static int send_code(struct IR *ir, unsigned int code, unsigned int key)
832 /* Send prepare command? */ 848 /* Send prepare command? */
833 buf[0] = 0x00; 849 buf[0] = 0x00;
834 buf[1] = 0x80; 850 buf[1] = 0x80;
835 ret = i2c_master_send(&ir->c_tx, buf, 2); 851 ret = i2c_master_send(tx->c, buf, 2);
836 if (ret != 2) { 852 if (ret != 2) {
837 zilog_error("i2c_master_send failed with %d\n", ret); 853 zilog_error("i2c_master_send failed with %d\n", ret);
838 return ret < 0 ? ret : -EFAULT; 854 return ret < 0 ? ret : -EFAULT;
@@ -843,7 +859,7 @@ static int send_code(struct IR *ir, unsigned int code, unsigned int key)
843 * last i2c_master_recv always fails with a -5, so for now, we're 859 * last i2c_master_recv always fails with a -5, so for now, we're
844 * going to skip this whole mess and say we're done on the HD PVR 860 * going to skip this whole mess and say we're done on the HD PVR
845 */ 861 */
846 if (ir->is_hdpvr) { 862 if (!tx->post_tx_ready_poll) {
847 dprintk("sent code %u, key %u\n", code, key); 863 dprintk("sent code %u, key %u\n", code, key);
848 return 0; 864 return 0;
849 } 865 }
@@ -857,7 +873,7 @@ static int send_code(struct IR *ir, unsigned int code, unsigned int key)
857 for (i = 0; i < 20; ++i) { 873 for (i = 0; i < 20; ++i) {
858 set_current_state(TASK_UNINTERRUPTIBLE); 874 set_current_state(TASK_UNINTERRUPTIBLE);
859 schedule_timeout((50 * HZ + 999) / 1000); 875 schedule_timeout((50 * HZ + 999) / 1000);
860 ret = i2c_master_send(&ir->c_tx, buf, 1); 876 ret = i2c_master_send(tx->c, buf, 1);
861 if (ret == 1) 877 if (ret == 1)
862 break; 878 break;
863 dprintk("NAK expected: i2c_master_send " 879 dprintk("NAK expected: i2c_master_send "
@@ -870,7 +886,7 @@ static int send_code(struct IR *ir, unsigned int code, unsigned int key)
870 } 886 }
871 887
872 /* Seems to be an 'ok' response */ 888 /* Seems to be an 'ok' response */
873 i = i2c_master_recv(&ir->c_tx, buf, 1); 889 i = i2c_master_recv(tx->c, buf, 1);
874 if (i != 1) { 890 if (i != 1) {
875 zilog_error("i2c_master_recv failed with %d\n", ret); 891 zilog_error("i2c_master_recv failed with %d\n", ret);
876 return -EFAULT; 892 return -EFAULT;
@@ -895,10 +911,11 @@ static ssize_t write(struct file *filep, const char *buf, size_t n,
895 loff_t *ppos) 911 loff_t *ppos)
896{ 912{
897 struct IR *ir = filep->private_data; 913 struct IR *ir = filep->private_data;
914 struct IR_tx *tx = ir->tx;
898 size_t i; 915 size_t i;
899 int failures = 0; 916 int failures = 0;
900 917
901 if (ir->c_tx.addr == 0) 918 if (tx == NULL)
902 return -ENODEV; 919 return -ENODEV;
903 920
904 /* Validate user parameters */ 921 /* Validate user parameters */
@@ -919,15 +936,15 @@ static ssize_t write(struct file *filep, const char *buf, size_t n,
919 } 936 }
920 937
921 /* Send boot data first if required */ 938 /* Send boot data first if required */
922 if (ir->need_boot == 1) { 939 if (tx->need_boot == 1) {
923 ret = send_boot_data(ir); 940 ret = send_boot_data(tx);
924 if (ret == 0) 941 if (ret == 0)
925 ir->need_boot = 0; 942 tx->need_boot = 0;
926 } 943 }
927 944
928 /* Send the code */ 945 /* Send the code */
929 if (ret == 0) { 946 if (ret == 0) {
930 ret = send_code(ir, (unsigned)command >> 16, 947 ret = send_code(tx, (unsigned)command >> 16,
931 (unsigned)command & 0xFFFF); 948 (unsigned)command & 0xFFFF);
932 if (ret == -EPROTO) { 949 if (ret == -EPROTO) {
933 mutex_unlock(&ir->ir_lock); 950 mutex_unlock(&ir->ir_lock);
@@ -952,7 +969,7 @@ static ssize_t write(struct file *filep, const char *buf, size_t n,
952 } 969 }
953 set_current_state(TASK_UNINTERRUPTIBLE); 970 set_current_state(TASK_UNINTERRUPTIBLE);
954 schedule_timeout((100 * HZ + 999) / 1000); 971 schedule_timeout((100 * HZ + 999) / 1000);
955 ir->need_boot = 1; 972 tx->need_boot = 1;
956 ++failures; 973 ++failures;
957 } else 974 } else
958 i += sizeof(int); 975 i += sizeof(int);
@@ -969,22 +986,23 @@ static ssize_t write(struct file *filep, const char *buf, size_t n,
969static unsigned int poll(struct file *filep, poll_table *wait) 986static unsigned int poll(struct file *filep, poll_table *wait)
970{ 987{
971 struct IR *ir = filep->private_data; 988 struct IR *ir = filep->private_data;
989 struct IR_rx *rx = ir->rx;
972 unsigned int ret; 990 unsigned int ret;
973 991
974 dprintk("poll called\n"); 992 dprintk("poll called\n");
975 if (ir->c_rx.addr == 0) 993 if (rx == NULL)
976 return -ENODEV; 994 return -ENODEV;
977 995
978 mutex_lock(&ir->buf_lock); 996 mutex_lock(&rx->buf_lock);
979 997
980 poll_wait(filep, &ir->buf.wait_poll, wait); 998 poll_wait(filep, &rx->buf.wait_poll, wait);
981 999
982 dprintk("poll result = %s\n", 1000 dprintk("poll result = %s\n",
983 lirc_buffer_empty(&ir->buf) ? "0" : "POLLIN|POLLRDNORM"); 1001 lirc_buffer_empty(&rx->buf) ? "0" : "POLLIN|POLLRDNORM");
984 1002
985 ret = lirc_buffer_empty(&ir->buf) ? 0 : (POLLIN|POLLRDNORM); 1003 ret = lirc_buffer_empty(&rx->buf) ? 0 : (POLLIN|POLLRDNORM);
986 1004
987 mutex_unlock(&ir->buf_lock); 1005 mutex_unlock(&rx->buf_lock);
988 return ret; 1006 return ret;
989} 1007}
990 1008
@@ -994,10 +1012,9 @@ static long ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
994 int result; 1012 int result;
995 unsigned long mode, features = 0; 1013 unsigned long mode, features = 0;
996 1014
997 if (ir->c_rx.addr != 0) 1015 features |= LIRC_CAN_SEND_PULSE;
1016 if (ir->rx != NULL)
998 features |= LIRC_CAN_REC_LIRCCODE; 1017 features |= LIRC_CAN_REC_LIRCCODE;
999 if (ir->c_tx.addr != 0)
1000 features |= LIRC_CAN_SEND_PULSE;
1001 1018
1002 switch (cmd) { 1019 switch (cmd) {
1003 case LIRC_GET_LENGTH: 1020 case LIRC_GET_LENGTH:
@@ -1024,15 +1041,9 @@ static long ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
1024 result = -EINVAL; 1041 result = -EINVAL;
1025 break; 1042 break;
1026 case LIRC_GET_SEND_MODE: 1043 case LIRC_GET_SEND_MODE:
1027 if (!(features&LIRC_CAN_SEND_MASK))
1028 return -ENOSYS;
1029
1030 result = put_user(LIRC_MODE_PULSE, (unsigned long *) arg); 1044 result = put_user(LIRC_MODE_PULSE, (unsigned long *) arg);
1031 break; 1045 break;
1032 case LIRC_SET_SEND_MODE: 1046 case LIRC_SET_SEND_MODE:
1033 if (!(features&LIRC_CAN_SEND_MASK))
1034 return -ENOSYS;
1035
1036 result = get_user(mode, (unsigned long *) arg); 1047 result = get_user(mode, (unsigned long *) arg);
1037 if (!result && mode != LIRC_MODE_PULSE) 1048 if (!result && mode != LIRC_MODE_PULSE)
1038 return -EINVAL; 1049 return -EINVAL;
@@ -1043,6 +1054,15 @@ static long ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
1043 return result; 1054 return result;
1044} 1055}
1045 1056
1057/* ir_devices_lock must be held */
1058static struct IR *find_ir_device_by_minor(unsigned int minor)
1059{
1060 if (minor >= MAX_IRCTL_DEVICES)
1061 return NULL;
1062
1063 return ir_devices[minor];
1064}
1065
1046/* 1066/*
1047 * Open the IR device. Get hold of our IR structure and 1067 * Open the IR device. Get hold of our IR structure and
1048 * stash it in private_data for the file 1068 * stash it in private_data for the file
@@ -1051,15 +1071,15 @@ static int open(struct inode *node, struct file *filep)
1051{ 1071{
1052 struct IR *ir; 1072 struct IR *ir;
1053 int ret; 1073 int ret;
1074 unsigned int minor = MINOR(node->i_rdev);
1054 1075
1055 /* find our IR struct */ 1076 /* find our IR struct */
1056 unsigned minor = MINOR(node->i_rdev); 1077 mutex_lock(&ir_devices_lock);
1057 if (minor >= MAX_IRCTL_DEVICES) { 1078 ir = find_ir_device_by_minor(minor);
1058 dprintk("minor %d: open result = -ENODEV\n", 1079 mutex_unlock(&ir_devices_lock);
1059 minor); 1080
1081 if (ir == NULL)
1060 return -ENODEV; 1082 return -ENODEV;
1061 }
1062 ir = ir_devices[minor];
1063 1083
1064 /* increment in use count */ 1084 /* increment in use count */
1065 mutex_lock(&ir->ir_lock); 1085 mutex_lock(&ir->ir_lock);
@@ -1106,7 +1126,6 @@ static struct lirc_driver lirc_template = {
1106 1126
1107static int ir_remove(struct i2c_client *client); 1127static int ir_remove(struct i2c_client *client);
1108static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id); 1128static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id);
1109static int ir_command(struct i2c_client *client, unsigned int cmd, void *arg);
1110 1129
1111#define ID_FLAG_TX 0x01 1130#define ID_FLAG_TX 0x01
1112#define ID_FLAG_HDPVR 0x02 1131#define ID_FLAG_HDPVR 0x02
@@ -1126,7 +1145,6 @@ static struct i2c_driver driver = {
1126 }, 1145 },
1127 .probe = ir_probe, 1146 .probe = ir_probe,
1128 .remove = ir_remove, 1147 .remove = ir_remove,
1129 .command = ir_command,
1130 .id_table = ir_transceiver_id, 1148 .id_table = ir_transceiver_id,
1131}; 1149};
1132 1150
@@ -1144,214 +1162,253 @@ static const struct file_operations lirc_fops = {
1144 .release = close 1162 .release = close
1145}; 1163};
1146 1164
1147static int ir_remove(struct i2c_client *client) 1165static void destroy_rx_kthread(struct IR_rx *rx)
1148{ 1166{
1149 struct IR *ir = i2c_get_clientdata(client); 1167 /* end up polling thread */
1168 if (rx != NULL && !IS_ERR_OR_NULL(rx->task)) {
1169 kthread_stop(rx->task);
1170 rx->task = NULL;
1171 }
1172}
1150 1173
1151 mutex_lock(&ir->ir_lock); 1174/* ir_devices_lock must be held */
1175static int add_ir_device(struct IR *ir)
1176{
1177 int i;
1152 1178
1153 if (ir->have_rx || ir->have_tx) { 1179 for (i = 0; i < MAX_IRCTL_DEVICES; i++)
1154 DECLARE_COMPLETION(tn); 1180 if (ir_devices[i] == NULL) {
1155 DECLARE_COMPLETION(tn2); 1181 ir_devices[i] = ir;
1156 1182 break;
1157 /* end up polling thread */
1158 if (ir->task && !IS_ERR(ir->task)) {
1159 ir->t_notify = &tn;
1160 ir->t_notify2 = &tn2;
1161 ir->shutdown = 1;
1162 wake_up_process(ir->task);
1163 complete(&tn2);
1164 wait_for_completion(&tn);
1165 ir->t_notify = NULL;
1166 ir->t_notify2 = NULL;
1167 } 1183 }
1168 1184
1169 } else { 1185 return i == MAX_IRCTL_DEVICES ? -ENOMEM : i;
1170 mutex_unlock(&ir->ir_lock); 1186}
1171 zilog_error("%s: detached from something we didn't " 1187
1172 "attach to\n", __func__); 1188/* ir_devices_lock must be held */
1173 return -ENODEV; 1189static void del_ir_device(struct IR *ir)
1190{
1191 int i;
1192
1193 for (i = 0; i < MAX_IRCTL_DEVICES; i++)
1194 if (ir_devices[i] == ir) {
1195 ir_devices[i] = NULL;
1196 break;
1197 }
1198}
1199
1200static int ir_remove(struct i2c_client *client)
1201{
1202 struct IR *ir = i2c_get_clientdata(client);
1203
1204 mutex_lock(&ir_devices_lock);
1205
1206 if (ir == NULL) {
1207 /* We destroyed everything when the first client came through */
1208 mutex_unlock(&ir_devices_lock);
1209 return 0;
1174 } 1210 }
1175 1211
1176 /* unregister lirc driver */ 1212 /* Good-bye LIRC */
1177 if (ir->l.minor >= 0 && ir->l.minor < MAX_IRCTL_DEVICES) { 1213 lirc_unregister_driver(ir->l.minor);
1178 lirc_unregister_driver(ir->l.minor); 1214
1179 ir_devices[ir->l.minor] = NULL; 1215 /* Good-bye Rx */
1216 destroy_rx_kthread(ir->rx);
1217 if (ir->rx != NULL) {
1218 if (ir->rx->buf.fifo_initialized)
1219 lirc_buffer_free(&ir->rx->buf);
1220 i2c_set_clientdata(ir->rx->c, NULL);
1221 kfree(ir->rx);
1180 } 1222 }
1181 1223
1182 /* free memory */ 1224 /* Good-bye Tx */
1183 lirc_buffer_free(&ir->buf); 1225 i2c_set_clientdata(ir->tx->c, NULL);
1184 mutex_unlock(&ir->ir_lock); 1226 kfree(ir->tx);
1227
1228 /* Good-bye IR */
1229 del_ir_device(ir);
1185 kfree(ir); 1230 kfree(ir);
1186 1231
1232 mutex_unlock(&ir_devices_lock);
1187 return 0; 1233 return 0;
1188} 1234}
1189 1235
1190static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) 1236
1237/* ir_devices_lock must be held */
1238static struct IR *find_ir_device_by_adapter(struct i2c_adapter *adapter)
1191{ 1239{
1240 int i;
1192 struct IR *ir = NULL; 1241 struct IR *ir = NULL;
1242
1243 for (i = 0; i < MAX_IRCTL_DEVICES; i++)
1244 if (ir_devices[i] != NULL &&
1245 ir_devices[i]->adapter == adapter) {
1246 ir = ir_devices[i];
1247 break;
1248 }
1249
1250 return ir;
1251}
1252
1253static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
1254{
1255 struct IR *ir;
1193 struct i2c_adapter *adap = client->adapter; 1256 struct i2c_adapter *adap = client->adapter;
1194 char buf;
1195 int ret; 1257 int ret;
1196 int have_rx = 0, have_tx = 0; 1258 bool tx_probe = false;
1197 1259
1198 dprintk("%s: adapter name (%s) nr %d, i2c_device_id name (%s), " 1260 dprintk("%s: %s on i2c-%d (%s), client addr=0x%02x\n",
1199 "client addr=0x%02x\n", 1261 __func__, id->name, adap->nr, adap->name, client->addr);
1200 __func__, adap->name, adap->nr, id->name, client->addr);
1201 1262
1202 /* 1263 /*
1203 * FIXME - This probe function probes both the Tx and Rx 1264 * The IR receiver is at i2c address 0x71.
1204 * addresses of the IR microcontroller. 1265 * The IR transmitter is at i2c address 0x70.
1205 *
1206 * However, the I2C subsystem is passing along one I2C client at a
1207 * time, based on matches to the ir_transceiver_id[] table above.
1208 * The expectation is that each i2c_client address will be probed
1209 * individually by drivers so the I2C subsystem can mark all client
1210 * addresses as claimed or not.
1211 *
1212 * This probe routine causes only one of the client addresses, TX or RX,
1213 * to be claimed. This will cause a problem if the I2C subsystem is
1214 * subsequently triggered to probe unclaimed clients again.
1215 */ 1266 */
1216 /*
1217 * The external IR receiver is at i2c address 0x71.
1218 * The IR transmitter is at 0x70.
1219 */
1220 client->addr = 0x70;
1221 1267
1222 if (!disable_tx) { 1268 if (id->driver_data & ID_FLAG_TX)
1223 if (i2c_master_recv(client, &buf, 1) == 1) 1269 tx_probe = true;
1224 have_tx = 1; 1270 else if (tx_only) /* module option */
1225 dprintk("probe 0x70 @ %s: %s\n", 1271 return -ENXIO;
1226 adap->name, have_tx ? "success" : "failed");
1227 }
1228 1272
1229 if (!disable_rx) { 1273 zilog_info("probing IR %s on %s (i2c-%d)\n",
1230 client->addr = 0x71; 1274 tx_probe ? "Tx" : "Rx", adap->name, adap->nr);
1231 if (i2c_master_recv(client, &buf, 1) == 1)
1232 have_rx = 1;
1233 dprintk("probe 0x71 @ %s: %s\n",
1234 adap->name, have_rx ? "success" : "failed");
1235 }
1236 1275
1237 if (!(have_rx || have_tx)) { 1276 mutex_lock(&ir_devices_lock);
1238 zilog_error("%s: no devices found\n", adap->name);
1239 goto out_nodev;
1240 }
1241 1277
1242 printk(KERN_INFO "lirc_zilog: chip found with %s\n", 1278 /* Use a single struct IR instance for both the Rx and Tx functions */
1243 have_rx && have_tx ? "RX and TX" : 1279 ir = find_ir_device_by_adapter(adap);
1244 have_rx ? "RX only" : "TX only"); 1280 if (ir == NULL) {
1281 ir = kzalloc(sizeof(struct IR), GFP_KERNEL);
1282 if (ir == NULL) {
1283 ret = -ENOMEM;
1284 goto out_no_ir;
1285 }
1286 /* store for use in ir_probe() again, and open() later on */
1287 ret = add_ir_device(ir);
1288 if (ret)
1289 goto out_free_ir;
1290
1291 ir->adapter = adap;
1292 mutex_init(&ir->ir_lock);
1293
1294 /* set lirc_dev stuff */
1295 memcpy(&ir->l, &lirc_template, sizeof(struct lirc_driver));
1296 ir->l.minor = minor; /* module option */
1297 ir->l.code_length = 13;
1298 ir->l.rbuf = NULL;
1299 ir->l.fops = &lirc_fops;
1300 ir->l.data = ir;
1301 ir->l.dev = &adap->dev;
1302 ir->l.sample_rate = 0;
1303 }
1245 1304
1246 ir = kzalloc(sizeof(struct IR), GFP_KERNEL); 1305 if (tx_probe) {
1306 /* Set up a struct IR_tx instance */
1307 ir->tx = kzalloc(sizeof(struct IR_tx), GFP_KERNEL);
1308 if (ir->tx == NULL) {
1309 ret = -ENOMEM;
1310 goto out_free_xx;
1311 }
1247 1312
1248 if (!ir) 1313 ir->tx->c = client;
1249 goto out_nomem; 1314 ir->tx->need_boot = 1;
1315 ir->tx->post_tx_ready_poll =
1316 (id->driver_data & ID_FLAG_HDPVR) ? false : true;
1317 } else {
1318 /* Set up a struct IR_rx instance */
1319 ir->rx = kzalloc(sizeof(struct IR_rx), GFP_KERNEL);
1320 if (ir->rx == NULL) {
1321 ret = -ENOMEM;
1322 goto out_free_xx;
1323 }
1250 1324
1251 ret = lirc_buffer_init(&ir->buf, 2, BUFLEN / 2); 1325 ret = lirc_buffer_init(&ir->rx->buf, 2, BUFLEN / 2);
1252 if (ret) 1326 if (ret)
1253 goto out_nomem; 1327 goto out_free_xx;
1254 1328
1255 mutex_init(&ir->ir_lock); 1329 mutex_init(&ir->rx->buf_lock);
1256 mutex_init(&ir->buf_lock); 1330 ir->rx->c = client;
1257 ir->need_boot = 1; 1331 ir->rx->hdpvr_data_fmt =
1258 ir->is_hdpvr = (id->driver_data & ID_FLAG_HDPVR) ? true : false; 1332 (id->driver_data & ID_FLAG_HDPVR) ? true : false;
1259 1333
1260 memcpy(&ir->l, &lirc_template, sizeof(struct lirc_driver)); 1334 /* set lirc_dev stuff */
1261 ir->l.minor = -1; 1335 ir->l.rbuf = &ir->rx->buf;
1336 }
1262 1337
1263 /* I2C attach to device */
1264 i2c_set_clientdata(client, ir); 1338 i2c_set_clientdata(client, ir);
1265 1339
1266 /* initialise RX device */ 1340 /* Proceed only if we have the required Tx and Rx clients ready to go */
1267 if (have_rx) { 1341 if (ir->tx == NULL ||
1268 DECLARE_COMPLETION(tn); 1342 (ir->rx == NULL && !tx_only)) {
1269 memcpy(&ir->c_rx, client, sizeof(struct i2c_client)); 1343 zilog_info("probe of IR %s on %s (i2c-%d) done. Waiting on "
1270 1344 "IR %s.\n", tx_probe ? "Tx" : "Rx", adap->name,
1271 ir->c_rx.addr = 0x71; 1345 adap->nr, tx_probe ? "Rx" : "Tx");
1272 strlcpy(ir->c_rx.name, ZILOG_HAUPPAUGE_IR_RX_NAME, 1346 goto out_ok;
1273 I2C_NAME_SIZE); 1347 }
1274 1348
1349 /* initialise RX device */
1350 if (ir->rx != NULL) {
1275 /* try to fire up polling thread */ 1351 /* try to fire up polling thread */
1276 ir->t_notify = &tn; 1352 ir->rx->task = kthread_run(lirc_thread, ir,
1277 ir->task = kthread_run(lirc_thread, ir, "lirc_zilog"); 1353 "zilog-rx-i2c-%d", adap->nr);
1278 if (IS_ERR(ir->task)) { 1354 if (IS_ERR(ir->rx->task)) {
1279 ret = PTR_ERR(ir->task); 1355 ret = PTR_ERR(ir->rx->task);
1280 zilog_error("lirc_register_driver: cannot run " 1356 zilog_error("%s: could not start IR Rx polling thread"
1281 "poll thread %d\n", ret); 1357 "\n", __func__);
1282 goto err; 1358 goto out_free_xx;
1283 } 1359 }
1284 wait_for_completion(&tn);
1285 ir->t_notify = NULL;
1286 ir->have_rx = 1;
1287 }
1288
1289 /* initialise TX device */
1290 if (have_tx) {
1291 memcpy(&ir->c_tx, client, sizeof(struct i2c_client));
1292 ir->c_tx.addr = 0x70;
1293 strlcpy(ir->c_tx.name, ZILOG_HAUPPAUGE_IR_TX_NAME,
1294 I2C_NAME_SIZE);
1295 ir->have_tx = 1;
1296 } 1360 }
1297 1361
1298 /* set lirc_dev stuff */
1299 ir->l.code_length = 13;
1300 ir->l.rbuf = &ir->buf;
1301 ir->l.fops = &lirc_fops;
1302 ir->l.data = ir;
1303 ir->l.minor = minor;
1304 ir->l.dev = &adap->dev;
1305 ir->l.sample_rate = 0;
1306
1307 /* register with lirc */ 1362 /* register with lirc */
1308 ir->l.minor = lirc_register_driver(&ir->l); 1363 ir->l.minor = lirc_register_driver(&ir->l);
1309 if (ir->l.minor < 0 || ir->l.minor >= MAX_IRCTL_DEVICES) { 1364 if (ir->l.minor < 0 || ir->l.minor >= MAX_IRCTL_DEVICES) {
1310 zilog_error("ir_attach: \"minor\" must be between 0 and %d " 1365 zilog_error("%s: \"minor\" must be between 0 and %d (%d)!\n",
1311 "(%d)!\n", MAX_IRCTL_DEVICES-1, ir->l.minor); 1366 __func__, MAX_IRCTL_DEVICES-1, ir->l.minor);
1312 ret = -EBADRQC; 1367 ret = -EBADRQC;
1313 goto err; 1368 goto out_free_thread;
1314 } 1369 }
1315 1370
1316 /* store this for getting back in open() later on */
1317 ir_devices[ir->l.minor] = ir;
1318
1319 /* 1371 /*
1320 * if we have the tx device, load the 'firmware'. We do this 1372 * if we have the tx device, load the 'firmware'. We do this
1321 * after registering with lirc as otherwise hotplug seems to take 1373 * after registering with lirc as otherwise hotplug seems to take
1322 * 10s to create the lirc device. 1374 * 10s to create the lirc device.
1323 */ 1375 */
1324 if (have_tx) { 1376 ret = tx_init(ir->tx);
1325 /* Special TX init */ 1377 if (ret != 0)
1326 ret = tx_init(ir); 1378 goto out_unregister;
1327 if (ret != 0)
1328 goto err;
1329 }
1330 1379
1380 zilog_info("probe of IR %s on %s (i2c-%d) done. IR unit ready.\n",
1381 tx_probe ? "Tx" : "Rx", adap->name, adap->nr);
1382out_ok:
1383 mutex_unlock(&ir_devices_lock);
1331 return 0; 1384 return 0;
1332 1385
1333err: 1386out_unregister:
1334 /* undo everything, hopefully... */ 1387 lirc_unregister_driver(ir->l.minor);
1335 if (ir->c_rx.addr) 1388out_free_thread:
1336 ir_remove(&ir->c_rx); 1389 destroy_rx_kthread(ir->rx);
1337 if (ir->c_tx.addr) 1390out_free_xx:
1338 ir_remove(&ir->c_tx); 1391 if (ir->rx != NULL) {
1339 return ret; 1392 if (ir->rx->buf.fifo_initialized)
1340 1393 lirc_buffer_free(&ir->rx->buf);
1341out_nodev: 1394 if (ir->rx->c != NULL)
1342 zilog_error("no device found\n"); 1395 i2c_set_clientdata(ir->rx->c, NULL);
1343 return -ENODEV; 1396 kfree(ir->rx);
1344 1397 }
1345out_nomem: 1398 if (ir->tx != NULL) {
1346 zilog_error("memory allocation failure\n"); 1399 if (ir->tx->c != NULL)
1400 i2c_set_clientdata(ir->tx->c, NULL);
1401 kfree(ir->tx);
1402 }
1403out_free_ir:
1404 del_ir_device(ir);
1347 kfree(ir); 1405 kfree(ir);
1348 return -ENOMEM; 1406out_no_ir:
1349} 1407 zilog_error("%s: probing IR %s on %s (i2c-%d) failed with %d\n",
1350 1408 __func__, tx_probe ? "Tx" : "Rx", adap->name, adap->nr,
1351static int ir_command(struct i2c_client *client, unsigned int cmd, void *arg) 1409 ret);
1352{ 1410 mutex_unlock(&ir_devices_lock);
1353 /* nothing */ 1411 return ret;
1354 return 0;
1355} 1412}
1356 1413
1357static int __init zilog_init(void) 1414static int __init zilog_init(void)
@@ -1361,6 +1418,7 @@ static int __init zilog_init(void)
1361 zilog_notify("Zilog/Hauppauge IR driver initializing\n"); 1418 zilog_notify("Zilog/Hauppauge IR driver initializing\n");
1362 1419
1363 mutex_init(&tx_data_lock); 1420 mutex_init(&tx_data_lock);
1421 mutex_init(&ir_devices_lock);
1364 1422
1365 request_module("firmware_class"); 1423 request_module("firmware_class");
1366 1424
@@ -1386,7 +1444,8 @@ module_exit(zilog_exit);
1386 1444
1387MODULE_DESCRIPTION("Zilog/Hauppauge infrared transmitter driver (i2c stack)"); 1445MODULE_DESCRIPTION("Zilog/Hauppauge infrared transmitter driver (i2c stack)");
1388MODULE_AUTHOR("Gerd Knorr, Michal Kochanowicz, Christoph Bartelmus, " 1446MODULE_AUTHOR("Gerd Knorr, Michal Kochanowicz, Christoph Bartelmus, "
1389 "Ulrich Mueller, Stefan Jahn, Jerome Brock, Mark Weaver"); 1447 "Ulrich Mueller, Stefan Jahn, Jerome Brock, Mark Weaver, "
1448 "Andy Walls");
1390MODULE_LICENSE("GPL"); 1449MODULE_LICENSE("GPL");
1391/* for compat with old name, which isn't all that accurate anymore */ 1450/* for compat with old name, which isn't all that accurate anymore */
1392MODULE_ALIAS("lirc_pvr150"); 1451MODULE_ALIAS("lirc_pvr150");
@@ -1397,8 +1456,5 @@ MODULE_PARM_DESC(minor, "Preferred minor device number");
1397module_param(debug, bool, 0644); 1456module_param(debug, bool, 0644);
1398MODULE_PARM_DESC(debug, "Enable debugging messages"); 1457MODULE_PARM_DESC(debug, "Enable debugging messages");
1399 1458
1400module_param(disable_rx, bool, 0644); 1459module_param(tx_only, bool, 0644);
1401MODULE_PARM_DESC(disable_rx, "Disable the IR receiver device"); 1460MODULE_PARM_DESC(tx_only, "Only handle the IR transmit function");
1402
1403module_param(disable_tx, bool, 0644);
1404MODULE_PARM_DESC(disable_tx, "Disable the IR transmitter device");
diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c
index 8fe017c3721f..eb9b9f1bc138 100644
--- a/drivers/staging/tm6000/tm6000-video.c
+++ b/drivers/staging/tm6000/tm6000-video.c
@@ -1450,29 +1450,55 @@ static struct video_device tm6000_template = {
1450 * ------------------------------------------------------------------ 1450 * ------------------------------------------------------------------
1451 */ 1451 */
1452 1452
1453int tm6000_v4l2_register(struct tm6000_core *dev) 1453static struct video_device *vdev_init(struct tm6000_core *dev,
1454 const struct video_device
1455 *template, const char *type_name)
1454{ 1456{
1455 int ret = -1;
1456 struct video_device *vfd; 1457 struct video_device *vfd;
1457 1458
1458 vfd = video_device_alloc(); 1459 vfd = video_device_alloc();
1459 if(!vfd) { 1460 if (NULL == vfd)
1461 return NULL;
1462
1463 *vfd = *template;
1464 vfd->v4l2_dev = &dev->v4l2_dev;
1465 vfd->release = video_device_release;
1466 vfd->debug = tm6000_debug;
1467 vfd->lock = &dev->lock;
1468
1469 snprintf(vfd->name, sizeof(vfd->name), "%s %s", dev->name, type_name);
1470
1471 video_set_drvdata(vfd, dev);
1472 return vfd;
1473}
1474
1475int tm6000_v4l2_register(struct tm6000_core *dev)
1476{
1477 int ret = -1;
1478
1479 dev->vfd = vdev_init(dev, &tm6000_template, "video");
1480
1481 if (!dev->vfd) {
1482 printk(KERN_INFO "%s: can't register video device\n",
1483 dev->name);
1460 return -ENOMEM; 1484 return -ENOMEM;
1461 } 1485 }
1462 dev->vfd = vfd;
1463 1486
1464 /* init video dma queues */ 1487 /* init video dma queues */
1465 INIT_LIST_HEAD(&dev->vidq.active); 1488 INIT_LIST_HEAD(&dev->vidq.active);
1466 INIT_LIST_HEAD(&dev->vidq.queued); 1489 INIT_LIST_HEAD(&dev->vidq.queued);
1467 1490
1468 memcpy(dev->vfd, &tm6000_template, sizeof(*(dev->vfd))); 1491 ret = video_register_device(dev->vfd, VFL_TYPE_GRABBER, video_nr);
1469 dev->vfd->debug = tm6000_debug;
1470 dev->vfd->lock = &dev->lock;
1471 1492
1472 vfd->v4l2_dev = &dev->v4l2_dev; 1493 if (ret < 0) {
1473 video_set_drvdata(vfd, dev); 1494 printk(KERN_INFO "%s: can't register video device\n",
1495 dev->name);
1496 return ret;
1497 }
1498
1499 printk(KERN_INFO "%s: registered device %s\n",
1500 dev->name, video_device_node_name(dev->vfd));
1474 1501
1475 ret = video_register_device(dev->vfd, VFL_TYPE_GRABBER, video_nr);
1476 printk(KERN_INFO "Trident TVMaster TM5600/TM6000/TM6010 USB2 board (Load status: %d)\n", ret); 1502 printk(KERN_INFO "Trident TVMaster TM5600/TM6000/TM6010 USB2 board (Load status: %d)\n", ret);
1477 return ret; 1503 return ret;
1478} 1504}
diff --git a/drivers/tty/Makefile b/drivers/tty/Makefile
index c43ef48b1a0f..396277216e4f 100644
--- a/drivers/tty/Makefile
+++ b/drivers/tty/Makefile
@@ -9,3 +9,5 @@ obj-$(CONFIG_N_GSM) += n_gsm.o
9obj-$(CONFIG_R3964) += n_r3964.o 9obj-$(CONFIG_R3964) += n_r3964.o
10 10
11obj-y += vt/ 11obj-y += vt/
12obj-$(CONFIG_HVC_DRIVER) += hvc/
13obj-y += serial/
diff --git a/drivers/tty/hvc/Makefile b/drivers/tty/hvc/Makefile
new file mode 100644
index 000000000000..e6bed5f177ff
--- /dev/null
+++ b/drivers/tty/hvc/Makefile
@@ -0,0 +1,13 @@
1obj-$(CONFIG_HVC_CONSOLE) += hvc_vio.o hvsi.o
2obj-$(CONFIG_HVC_ISERIES) += hvc_iseries.o
3obj-$(CONFIG_HVC_RTAS) += hvc_rtas.o
4obj-$(CONFIG_HVC_TILE) += hvc_tile.o
5obj-$(CONFIG_HVC_DCC) += hvc_dcc.o
6obj-$(CONFIG_HVC_BEAT) += hvc_beat.o
7obj-$(CONFIG_HVC_DRIVER) += hvc_console.o
8obj-$(CONFIG_HVC_IRQ) += hvc_irq.o
9obj-$(CONFIG_HVC_XEN) += hvc_xen.o
10obj-$(CONFIG_HVC_IUCV) += hvc_iucv.o
11obj-$(CONFIG_HVC_UDBG) += hvc_udbg.o
12obj-$(CONFIG_HVCS) += hvcs.o
13obj-$(CONFIG_VIRTIO_CONSOLE) += virtio_console.o
diff --git a/drivers/char/hvc_beat.c b/drivers/tty/hvc/hvc_beat.c
index 5fe4631e2a61..5fe4631e2a61 100644
--- a/drivers/char/hvc_beat.c
+++ b/drivers/tty/hvc/hvc_beat.c
diff --git a/drivers/char/hvc_console.c b/drivers/tty/hvc/hvc_console.c
index e9cba13ee800..e9cba13ee800 100644
--- a/drivers/char/hvc_console.c
+++ b/drivers/tty/hvc/hvc_console.c
diff --git a/drivers/char/hvc_console.h b/drivers/tty/hvc/hvc_console.h
index 54381eba4e4a..54381eba4e4a 100644
--- a/drivers/char/hvc_console.h
+++ b/drivers/tty/hvc/hvc_console.h
diff --git a/drivers/char/hvc_dcc.c b/drivers/tty/hvc/hvc_dcc.c
index 6470f63deb4b..6470f63deb4b 100644
--- a/drivers/char/hvc_dcc.c
+++ b/drivers/tty/hvc/hvc_dcc.c
diff --git a/drivers/char/hvc_irq.c b/drivers/tty/hvc/hvc_irq.c
index 2623e177e8d6..2623e177e8d6 100644
--- a/drivers/char/hvc_irq.c
+++ b/drivers/tty/hvc/hvc_irq.c
diff --git a/drivers/char/hvc_iseries.c b/drivers/tty/hvc/hvc_iseries.c
index 21c54955084e..21c54955084e 100644
--- a/drivers/char/hvc_iseries.c
+++ b/drivers/tty/hvc/hvc_iseries.c
diff --git a/drivers/char/hvc_iucv.c b/drivers/tty/hvc/hvc_iucv.c
index c3425bb3a1f6..c3425bb3a1f6 100644
--- a/drivers/char/hvc_iucv.c
+++ b/drivers/tty/hvc/hvc_iucv.c
diff --git a/drivers/char/hvc_rtas.c b/drivers/tty/hvc/hvc_rtas.c
index 61c4a61558d9..61c4a61558d9 100644
--- a/drivers/char/hvc_rtas.c
+++ b/drivers/tty/hvc/hvc_rtas.c
diff --git a/drivers/char/hvc_tile.c b/drivers/tty/hvc/hvc_tile.c
index 7a84a0595477..7a84a0595477 100644
--- a/drivers/char/hvc_tile.c
+++ b/drivers/tty/hvc/hvc_tile.c
diff --git a/drivers/char/hvc_udbg.c b/drivers/tty/hvc/hvc_udbg.c
index b0957e61a7be..b0957e61a7be 100644
--- a/drivers/char/hvc_udbg.c
+++ b/drivers/tty/hvc/hvc_udbg.c
diff --git a/drivers/char/hvc_vio.c b/drivers/tty/hvc/hvc_vio.c
index 5e2f52b33327..5e2f52b33327 100644
--- a/drivers/char/hvc_vio.c
+++ b/drivers/tty/hvc/hvc_vio.c
diff --git a/drivers/char/hvc_xen.c b/drivers/tty/hvc/hvc_xen.c
index 3740e327f180..3740e327f180 100644
--- a/drivers/char/hvc_xen.c
+++ b/drivers/tty/hvc/hvc_xen.c
diff --git a/drivers/char/hvcs.c b/drivers/tty/hvc/hvcs.c
index bedc6c1b6fa5..bedc6c1b6fa5 100644
--- a/drivers/char/hvcs.c
+++ b/drivers/tty/hvc/hvcs.c
diff --git a/drivers/char/hvsi.c b/drivers/tty/hvc/hvsi.c
index 67a75a502c01..67a75a502c01 100644
--- a/drivers/char/hvsi.c
+++ b/drivers/tty/hvc/hvsi.c
diff --git a/drivers/char/virtio_console.c b/drivers/tty/hvc/virtio_console.c
index 896a2ced1d27..896a2ced1d27 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/tty/hvc/virtio_console.c
diff --git a/drivers/serial/21285.c b/drivers/tty/serial/21285.c
index d89aa38c5cf0..d89aa38c5cf0 100644
--- a/drivers/serial/21285.c
+++ b/drivers/tty/serial/21285.c
diff --git a/drivers/serial/68328serial.c b/drivers/tty/serial/68328serial.c
index be0ebce36e54..be0ebce36e54 100644
--- a/drivers/serial/68328serial.c
+++ b/drivers/tty/serial/68328serial.c
diff --git a/drivers/serial/68328serial.h b/drivers/tty/serial/68328serial.h
index 664ceb0a158c..664ceb0a158c 100644
--- a/drivers/serial/68328serial.h
+++ b/drivers/tty/serial/68328serial.h
diff --git a/drivers/serial/68360serial.c b/drivers/tty/serial/68360serial.c
index 88b13356ec10..88b13356ec10 100644
--- a/drivers/serial/68360serial.c
+++ b/drivers/tty/serial/68360serial.c
diff --git a/drivers/serial/8250.c b/drivers/tty/serial/8250.c
index b25e6e490530..b25e6e490530 100644
--- a/drivers/serial/8250.c
+++ b/drivers/tty/serial/8250.c
diff --git a/drivers/serial/8250.h b/drivers/tty/serial/8250.h
index 6e19ea3e48d5..6e19ea3e48d5 100644
--- a/drivers/serial/8250.h
+++ b/drivers/tty/serial/8250.h
diff --git a/drivers/serial/8250_accent.c b/drivers/tty/serial/8250_accent.c
index 9c10262f2469..9c10262f2469 100644
--- a/drivers/serial/8250_accent.c
+++ b/drivers/tty/serial/8250_accent.c
diff --git a/drivers/serial/8250_acorn.c b/drivers/tty/serial/8250_acorn.c
index b0ce8c56f1a4..b0ce8c56f1a4 100644
--- a/drivers/serial/8250_acorn.c
+++ b/drivers/tty/serial/8250_acorn.c
diff --git a/drivers/serial/8250_boca.c b/drivers/tty/serial/8250_boca.c
index 3bfe0f7b26fb..3bfe0f7b26fb 100644
--- a/drivers/serial/8250_boca.c
+++ b/drivers/tty/serial/8250_boca.c
diff --git a/drivers/serial/8250_early.c b/drivers/tty/serial/8250_early.c
index eaafb98debed..eaafb98debed 100644
--- a/drivers/serial/8250_early.c
+++ b/drivers/tty/serial/8250_early.c
diff --git a/drivers/serial/8250_exar_st16c554.c b/drivers/tty/serial/8250_exar_st16c554.c
index 567143ace159..567143ace159 100644
--- a/drivers/serial/8250_exar_st16c554.c
+++ b/drivers/tty/serial/8250_exar_st16c554.c
diff --git a/drivers/serial/8250_fourport.c b/drivers/tty/serial/8250_fourport.c
index 6375d68b7913..6375d68b7913 100644
--- a/drivers/serial/8250_fourport.c
+++ b/drivers/tty/serial/8250_fourport.c
diff --git a/drivers/serial/8250_gsc.c b/drivers/tty/serial/8250_gsc.c
index d8c0ffbfa6e3..d8c0ffbfa6e3 100644
--- a/drivers/serial/8250_gsc.c
+++ b/drivers/tty/serial/8250_gsc.c
diff --git a/drivers/serial/8250_hp300.c b/drivers/tty/serial/8250_hp300.c
index c13438c93012..c13438c93012 100644
--- a/drivers/serial/8250_hp300.c
+++ b/drivers/tty/serial/8250_hp300.c
diff --git a/drivers/serial/8250_hub6.c b/drivers/tty/serial/8250_hub6.c
index 7609150e7d5e..7609150e7d5e 100644
--- a/drivers/serial/8250_hub6.c
+++ b/drivers/tty/serial/8250_hub6.c
diff --git a/drivers/serial/8250_mca.c b/drivers/tty/serial/8250_mca.c
index d10be944ad44..d10be944ad44 100644
--- a/drivers/serial/8250_mca.c
+++ b/drivers/tty/serial/8250_mca.c
diff --git a/drivers/serial/8250_pci.c b/drivers/tty/serial/8250_pci.c
index 8b8930f700b5..8b8930f700b5 100644
--- a/drivers/serial/8250_pci.c
+++ b/drivers/tty/serial/8250_pci.c
diff --git a/drivers/serial/8250_pnp.c b/drivers/tty/serial/8250_pnp.c
index 4822cb50cd0f..4822cb50cd0f 100644
--- a/drivers/serial/8250_pnp.c
+++ b/drivers/tty/serial/8250_pnp.c
diff --git a/drivers/serial/Kconfig b/drivers/tty/serial/Kconfig
index c1df7676a73d..b1682d7f1d8a 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -81,7 +81,7 @@ config SERIAL_8250_GSC
81 default SERIAL_8250 81 default SERIAL_8250
82 82
83config SERIAL_8250_PCI 83config SERIAL_8250_PCI
84 tristate "8250/16550 PCI device support" if EMBEDDED 84 tristate "8250/16550 PCI device support" if EXPERT
85 depends on SERIAL_8250 && PCI 85 depends on SERIAL_8250 && PCI
86 default SERIAL_8250 86 default SERIAL_8250
87 help 87 help
@@ -90,7 +90,7 @@ config SERIAL_8250_PCI
90 Saves about 9K. 90 Saves about 9K.
91 91
92config SERIAL_8250_PNP 92config SERIAL_8250_PNP
93 tristate "8250/16550 PNP device support" if EMBEDDED 93 tristate "8250/16550 PNP device support" if EXPERT
94 depends on SERIAL_8250 && PNP 94 depends on SERIAL_8250 && PNP
95 default SERIAL_8250 95 default SERIAL_8250
96 help 96 help
diff --git a/drivers/serial/Makefile b/drivers/tty/serial/Makefile
index 8ea92e9c73b0..8ea92e9c73b0 100644
--- a/drivers/serial/Makefile
+++ b/drivers/tty/serial/Makefile
diff --git a/drivers/serial/altera_jtaguart.c b/drivers/tty/serial/altera_jtaguart.c
index f9b49b5ff5e1..f9b49b5ff5e1 100644
--- a/drivers/serial/altera_jtaguart.c
+++ b/drivers/tty/serial/altera_jtaguart.c
diff --git a/drivers/serial/altera_uart.c b/drivers/tty/serial/altera_uart.c
index 721216292a50..721216292a50 100644
--- a/drivers/serial/altera_uart.c
+++ b/drivers/tty/serial/altera_uart.c
diff --git a/drivers/serial/amba-pl010.c b/drivers/tty/serial/amba-pl010.c
index 2904aa044126..2904aa044126 100644
--- a/drivers/serial/amba-pl010.c
+++ b/drivers/tty/serial/amba-pl010.c
diff --git a/drivers/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index e76d7d000128..e76d7d000128 100644
--- a/drivers/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
diff --git a/drivers/serial/apbuart.c b/drivers/tty/serial/apbuart.c
index 095a5d562618..095a5d562618 100644
--- a/drivers/serial/apbuart.c
+++ b/drivers/tty/serial/apbuart.c
diff --git a/drivers/serial/apbuart.h b/drivers/tty/serial/apbuart.h
index 5faf87c8d2bc..5faf87c8d2bc 100644
--- a/drivers/serial/apbuart.h
+++ b/drivers/tty/serial/apbuart.h
diff --git a/drivers/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 2a1d52fb4936..2a1d52fb4936 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
diff --git a/drivers/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx_uart.c
index a1a0e55d0807..a1a0e55d0807 100644
--- a/drivers/serial/bcm63xx_uart.c
+++ b/drivers/tty/serial/bcm63xx_uart.c
diff --git a/drivers/serial/bfin_5xx.c b/drivers/tty/serial/bfin_5xx.c
index e381b895b04d..e381b895b04d 100644
--- a/drivers/serial/bfin_5xx.c
+++ b/drivers/tty/serial/bfin_5xx.c
diff --git a/drivers/serial/bfin_sport_uart.c b/drivers/tty/serial/bfin_sport_uart.c
index e95c524d9d18..e95c524d9d18 100644
--- a/drivers/serial/bfin_sport_uart.c
+++ b/drivers/tty/serial/bfin_sport_uart.c
diff --git a/drivers/serial/bfin_sport_uart.h b/drivers/tty/serial/bfin_sport_uart.h
index 6d06ce1d5675..6d06ce1d5675 100644
--- a/drivers/serial/bfin_sport_uart.h
+++ b/drivers/tty/serial/bfin_sport_uart.h
diff --git a/drivers/serial/clps711x.c b/drivers/tty/serial/clps711x.c
index b6acd19b458e..b6acd19b458e 100644
--- a/drivers/serial/clps711x.c
+++ b/drivers/tty/serial/clps711x.c
diff --git a/drivers/serial/cpm_uart/Makefile b/drivers/tty/serial/cpm_uart/Makefile
index e072724ea754..e072724ea754 100644
--- a/drivers/serial/cpm_uart/Makefile
+++ b/drivers/tty/serial/cpm_uart/Makefile
diff --git a/drivers/serial/cpm_uart/cpm_uart.h b/drivers/tty/serial/cpm_uart/cpm_uart.h
index b754dcf0fda5..b754dcf0fda5 100644
--- a/drivers/serial/cpm_uart/cpm_uart.h
+++ b/drivers/tty/serial/cpm_uart/cpm_uart.h
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c
index 8692ff98fc07..8692ff98fc07 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm1.c b/drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c
index 3fc1d66e32c6..3fc1d66e32c6 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm1.c
+++ b/drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm1.h b/drivers/tty/serial/cpm_uart/cpm_uart_cpm1.h
index 10eecd6af6d4..10eecd6af6d4 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm1.h
+++ b/drivers/tty/serial/cpm_uart/cpm_uart_cpm1.h
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.c b/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c
index 814ac006393f..814ac006393f 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm2.c
+++ b/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.h b/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.h
index 7194c63dcf5f..7194c63dcf5f 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm2.h
+++ b/drivers/tty/serial/cpm_uart/cpm_uart_cpm2.h
diff --git a/drivers/serial/crisv10.c b/drivers/tty/serial/crisv10.c
index bcc31f2140ac..bcc31f2140ac 100644
--- a/drivers/serial/crisv10.c
+++ b/drivers/tty/serial/crisv10.c
diff --git a/drivers/serial/crisv10.h b/drivers/tty/serial/crisv10.h
index ea0beb46a10d..ea0beb46a10d 100644
--- a/drivers/serial/crisv10.h
+++ b/drivers/tty/serial/crisv10.h
diff --git a/drivers/serial/dz.c b/drivers/tty/serial/dz.c
index 57421d776329..57421d776329 100644
--- a/drivers/serial/dz.c
+++ b/drivers/tty/serial/dz.c
diff --git a/drivers/serial/dz.h b/drivers/tty/serial/dz.h
index faf169ed27b3..faf169ed27b3 100644
--- a/drivers/serial/dz.h
+++ b/drivers/tty/serial/dz.h
diff --git a/drivers/serial/icom.c b/drivers/tty/serial/icom.c
index 53a468227056..53a468227056 100644
--- a/drivers/serial/icom.c
+++ b/drivers/tty/serial/icom.c
diff --git a/drivers/serial/icom.h b/drivers/tty/serial/icom.h
index c8029e0025c9..c8029e0025c9 100644
--- a/drivers/serial/icom.h
+++ b/drivers/tty/serial/icom.h
diff --git a/drivers/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index ab93763862d5..ab93763862d5 100644
--- a/drivers/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
diff --git a/drivers/serial/ifx6x60.h b/drivers/tty/serial/ifx6x60.h
index deb7b8d977dc..deb7b8d977dc 100644
--- a/drivers/serial/ifx6x60.h
+++ b/drivers/tty/serial/ifx6x60.h
diff --git a/drivers/serial/imx.c b/drivers/tty/serial/imx.c
index dfcf4b1878aa..dfcf4b1878aa 100644
--- a/drivers/serial/imx.c
+++ b/drivers/tty/serial/imx.c
diff --git a/drivers/serial/ioc3_serial.c b/drivers/tty/serial/ioc3_serial.c
index ee43efc7bdcc..ee43efc7bdcc 100644
--- a/drivers/serial/ioc3_serial.c
+++ b/drivers/tty/serial/ioc3_serial.c
diff --git a/drivers/serial/ioc4_serial.c b/drivers/tty/serial/ioc4_serial.c
index fcfe82653ac8..fcfe82653ac8 100644
--- a/drivers/serial/ioc4_serial.c
+++ b/drivers/tty/serial/ioc4_serial.c
diff --git a/drivers/serial/ip22zilog.c b/drivers/tty/serial/ip22zilog.c
index ebff4a1d4bcc..ebff4a1d4bcc 100644
--- a/drivers/serial/ip22zilog.c
+++ b/drivers/tty/serial/ip22zilog.c
diff --git a/drivers/serial/ip22zilog.h b/drivers/tty/serial/ip22zilog.h
index a59a9a8341d2..a59a9a8341d2 100644
--- a/drivers/serial/ip22zilog.h
+++ b/drivers/tty/serial/ip22zilog.h
diff --git a/drivers/serial/jsm/Makefile b/drivers/tty/serial/jsm/Makefile
index e46b6e0f8b18..e46b6e0f8b18 100644
--- a/drivers/serial/jsm/Makefile
+++ b/drivers/tty/serial/jsm/Makefile
diff --git a/drivers/serial/jsm/jsm.h b/drivers/tty/serial/jsm/jsm.h
index 38a509c684cd..38a509c684cd 100644
--- a/drivers/serial/jsm/jsm.h
+++ b/drivers/tty/serial/jsm/jsm.h
diff --git a/drivers/serial/jsm/jsm_driver.c b/drivers/tty/serial/jsm/jsm_driver.c
index 18f548449c63..18f548449c63 100644
--- a/drivers/serial/jsm/jsm_driver.c
+++ b/drivers/tty/serial/jsm/jsm_driver.c
diff --git a/drivers/serial/jsm/jsm_neo.c b/drivers/tty/serial/jsm/jsm_neo.c
index 7960d9633c15..7960d9633c15 100644
--- a/drivers/serial/jsm/jsm_neo.c
+++ b/drivers/tty/serial/jsm/jsm_neo.c
diff --git a/drivers/serial/jsm/jsm_tty.c b/drivers/tty/serial/jsm/jsm_tty.c
index 7a4a914ecff0..7a4a914ecff0 100644
--- a/drivers/serial/jsm/jsm_tty.c
+++ b/drivers/tty/serial/jsm/jsm_tty.c
diff --git a/drivers/serial/kgdboc.c b/drivers/tty/serial/kgdboc.c
index 25a8bc565f40..25a8bc565f40 100644
--- a/drivers/serial/kgdboc.c
+++ b/drivers/tty/serial/kgdboc.c
diff --git a/drivers/serial/m32r_sio.c b/drivers/tty/serial/m32r_sio.c
index bea5c215460c..bea5c215460c 100644
--- a/drivers/serial/m32r_sio.c
+++ b/drivers/tty/serial/m32r_sio.c
diff --git a/drivers/serial/m32r_sio.h b/drivers/tty/serial/m32r_sio.h
index e9b7e11793b1..e9b7e11793b1 100644
--- a/drivers/serial/m32r_sio.h
+++ b/drivers/tty/serial/m32r_sio.h
diff --git a/drivers/serial/m32r_sio_reg.h b/drivers/tty/serial/m32r_sio_reg.h
index 4671473793e3..4671473793e3 100644
--- a/drivers/serial/m32r_sio_reg.h
+++ b/drivers/tty/serial/m32r_sio_reg.h
diff --git a/drivers/serial/max3100.c b/drivers/tty/serial/max3100.c
index beb1afa27d8d..beb1afa27d8d 100644
--- a/drivers/serial/max3100.c
+++ b/drivers/tty/serial/max3100.c
diff --git a/drivers/serial/max3107-aava.c b/drivers/tty/serial/max3107-aava.c
index a1fe304f2f52..a1fe304f2f52 100644
--- a/drivers/serial/max3107-aava.c
+++ b/drivers/tty/serial/max3107-aava.c
diff --git a/drivers/serial/max3107.c b/drivers/tty/serial/max3107.c
index 910870edf708..910870edf708 100644
--- a/drivers/serial/max3107.c
+++ b/drivers/tty/serial/max3107.c
diff --git a/drivers/serial/max3107.h b/drivers/tty/serial/max3107.h
index 7ab632392502..7ab632392502 100644
--- a/drivers/serial/max3107.h
+++ b/drivers/tty/serial/max3107.h
diff --git a/drivers/serial/mcf.c b/drivers/tty/serial/mcf.c
index 3394b7cc1722..3394b7cc1722 100644
--- a/drivers/serial/mcf.c
+++ b/drivers/tty/serial/mcf.c
diff --git a/drivers/serial/mfd.c b/drivers/tty/serial/mfd.c
index d40010a22ecd..d40010a22ecd 100644
--- a/drivers/serial/mfd.c
+++ b/drivers/tty/serial/mfd.c
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/tty/serial/mpc52xx_uart.c
index 126ec7f568ec..126ec7f568ec 100644
--- a/drivers/serial/mpc52xx_uart.c
+++ b/drivers/tty/serial/mpc52xx_uart.c
diff --git a/drivers/serial/mpsc.c b/drivers/tty/serial/mpsc.c
index 6a9c6605666a..6a9c6605666a 100644
--- a/drivers/serial/mpsc.c
+++ b/drivers/tty/serial/mpsc.c
diff --git a/drivers/serial/mrst_max3110.c b/drivers/tty/serial/mrst_max3110.c
index b62857bf2fdb..b62857bf2fdb 100644
--- a/drivers/serial/mrst_max3110.c
+++ b/drivers/tty/serial/mrst_max3110.c
diff --git a/drivers/serial/mrst_max3110.h b/drivers/tty/serial/mrst_max3110.h
index d1ef43af397c..d1ef43af397c 100644
--- a/drivers/serial/mrst_max3110.h
+++ b/drivers/tty/serial/mrst_max3110.h
diff --git a/drivers/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
index 8e43a7b69e64..8e43a7b69e64 100644
--- a/drivers/serial/msm_serial.c
+++ b/drivers/tty/serial/msm_serial.c
diff --git a/drivers/serial/msm_serial.h b/drivers/tty/serial/msm_serial.h
index f6ca9ca79e98..f6ca9ca79e98 100644
--- a/drivers/serial/msm_serial.h
+++ b/drivers/tty/serial/msm_serial.h
diff --git a/drivers/serial/mux.c b/drivers/tty/serial/mux.c
index 9711e06a8374..9711e06a8374 100644
--- a/drivers/serial/mux.c
+++ b/drivers/tty/serial/mux.c
diff --git a/drivers/serial/netx-serial.c b/drivers/tty/serial/netx-serial.c
index 7735c9f35fa0..7735c9f35fa0 100644
--- a/drivers/serial/netx-serial.c
+++ b/drivers/tty/serial/netx-serial.c
diff --git a/drivers/serial/nwpserial.c b/drivers/tty/serial/nwpserial.c
index de173671e3d0..de173671e3d0 100644
--- a/drivers/serial/nwpserial.c
+++ b/drivers/tty/serial/nwpserial.c
diff --git a/drivers/serial/of_serial.c b/drivers/tty/serial/of_serial.c
index 5c7abe4c94dd..5c7abe4c94dd 100644
--- a/drivers/serial/of_serial.c
+++ b/drivers/tty/serial/of_serial.c
diff --git a/drivers/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 7f2f01058789..7f2f01058789 100644
--- a/drivers/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
diff --git a/drivers/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index 70a61458ec42..70a61458ec42 100644
--- a/drivers/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
diff --git a/drivers/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c
index 5b9cde79e4ea..5b9cde79e4ea 100644
--- a/drivers/serial/pmac_zilog.c
+++ b/drivers/tty/serial/pmac_zilog.c
diff --git a/drivers/serial/pmac_zilog.h b/drivers/tty/serial/pmac_zilog.h
index cbc34fbb1b20..cbc34fbb1b20 100644
--- a/drivers/serial/pmac_zilog.h
+++ b/drivers/tty/serial/pmac_zilog.h
diff --git a/drivers/serial/pnx8xxx_uart.c b/drivers/tty/serial/pnx8xxx_uart.c
index 0aa75a97531c..0aa75a97531c 100644
--- a/drivers/serial/pnx8xxx_uart.c
+++ b/drivers/tty/serial/pnx8xxx_uart.c
diff --git a/drivers/serial/pxa.c b/drivers/tty/serial/pxa.c
index 1102a39b44f5..1102a39b44f5 100644
--- a/drivers/serial/pxa.c
+++ b/drivers/tty/serial/pxa.c
diff --git a/drivers/serial/s3c2400.c b/drivers/tty/serial/s3c2400.c
index fed1a9a1ffb4..fed1a9a1ffb4 100644
--- a/drivers/serial/s3c2400.c
+++ b/drivers/tty/serial/s3c2400.c
diff --git a/drivers/serial/s3c2410.c b/drivers/tty/serial/s3c2410.c
index 73f089d3efd6..73f089d3efd6 100644
--- a/drivers/serial/s3c2410.c
+++ b/drivers/tty/serial/s3c2410.c
diff --git a/drivers/serial/s3c2412.c b/drivers/tty/serial/s3c2412.c
index 1700b1a2fb7e..1700b1a2fb7e 100644
--- a/drivers/serial/s3c2412.c
+++ b/drivers/tty/serial/s3c2412.c
diff --git a/drivers/serial/s3c2440.c b/drivers/tty/serial/s3c2440.c
index 094cc3904b13..094cc3904b13 100644
--- a/drivers/serial/s3c2440.c
+++ b/drivers/tty/serial/s3c2440.c
diff --git a/drivers/serial/s3c24a0.c b/drivers/tty/serial/s3c24a0.c
index fad6083ca427..fad6083ca427 100644
--- a/drivers/serial/s3c24a0.c
+++ b/drivers/tty/serial/s3c24a0.c
diff --git a/drivers/serial/s3c6400.c b/drivers/tty/serial/s3c6400.c
index 4be92ab50058..4be92ab50058 100644
--- a/drivers/serial/s3c6400.c
+++ b/drivers/tty/serial/s3c6400.c
diff --git a/drivers/serial/s5pv210.c b/drivers/tty/serial/s5pv210.c
index 6ebccd70a707..6ebccd70a707 100644
--- a/drivers/serial/s5pv210.c
+++ b/drivers/tty/serial/s5pv210.c
diff --git a/drivers/serial/sa1100.c b/drivers/tty/serial/sa1100.c
index 2199d819a987..2199d819a987 100644
--- a/drivers/serial/sa1100.c
+++ b/drivers/tty/serial/sa1100.c
diff --git a/drivers/serial/samsung.c b/drivers/tty/serial/samsung.c
index 2335edafe903..2335edafe903 100644
--- a/drivers/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
diff --git a/drivers/serial/samsung.h b/drivers/tty/serial/samsung.h
index 0ac06a07d25f..0ac06a07d25f 100644
--- a/drivers/serial/samsung.h
+++ b/drivers/tty/serial/samsung.h
diff --git a/drivers/serial/sb1250-duart.c b/drivers/tty/serial/sb1250-duart.c
index a2f2b3254499..a2f2b3254499 100644
--- a/drivers/serial/sb1250-duart.c
+++ b/drivers/tty/serial/sb1250-duart.c
diff --git a/drivers/serial/sc26xx.c b/drivers/tty/serial/sc26xx.c
index 75038ad2b242..75038ad2b242 100644
--- a/drivers/serial/sc26xx.c
+++ b/drivers/tty/serial/sc26xx.c
diff --git a/drivers/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 460a72d91bb7..460a72d91bb7 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
diff --git a/drivers/serial/serial_cs.c b/drivers/tty/serial/serial_cs.c
index 93760b2ea172..93760b2ea172 100644
--- a/drivers/serial/serial_cs.c
+++ b/drivers/tty/serial/serial_cs.c
diff --git a/drivers/serial/serial_ks8695.c b/drivers/tty/serial/serial_ks8695.c
index b1962025b1aa..b1962025b1aa 100644
--- a/drivers/serial/serial_ks8695.c
+++ b/drivers/tty/serial/serial_ks8695.c
diff --git a/drivers/serial/serial_lh7a40x.c b/drivers/tty/serial/serial_lh7a40x.c
index ea744707c4d6..ea744707c4d6 100644
--- a/drivers/serial/serial_lh7a40x.c
+++ b/drivers/tty/serial/serial_lh7a40x.c
diff --git a/drivers/serial/serial_txx9.c b/drivers/tty/serial/serial_txx9.c
index c50e9fbbf743..c50e9fbbf743 100644
--- a/drivers/serial/serial_txx9.c
+++ b/drivers/tty/serial/serial_txx9.c
diff --git a/drivers/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 92c91c83edde..92c91c83edde 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
diff --git a/drivers/serial/sh-sci.h b/drivers/tty/serial/sh-sci.h
index b223d6cbf33a..b223d6cbf33a 100644
--- a/drivers/serial/sh-sci.h
+++ b/drivers/tty/serial/sh-sci.h
diff --git a/drivers/serial/sn_console.c b/drivers/tty/serial/sn_console.c
index cff9a306660f..cff9a306660f 100644
--- a/drivers/serial/sn_console.c
+++ b/drivers/tty/serial/sn_console.c
diff --git a/drivers/serial/suncore.c b/drivers/tty/serial/suncore.c
index 6381a0282ee7..6381a0282ee7 100644
--- a/drivers/serial/suncore.c
+++ b/drivers/tty/serial/suncore.c
diff --git a/drivers/serial/suncore.h b/drivers/tty/serial/suncore.h
index db2057936c31..db2057936c31 100644
--- a/drivers/serial/suncore.h
+++ b/drivers/tty/serial/suncore.h
diff --git a/drivers/serial/sunhv.c b/drivers/tty/serial/sunhv.c
index c9014868297d..c9014868297d 100644
--- a/drivers/serial/sunhv.c
+++ b/drivers/tty/serial/sunhv.c
diff --git a/drivers/serial/sunsab.c b/drivers/tty/serial/sunsab.c
index 5b246b18f42f..5b246b18f42f 100644
--- a/drivers/serial/sunsab.c
+++ b/drivers/tty/serial/sunsab.c
diff --git a/drivers/serial/sunsab.h b/drivers/tty/serial/sunsab.h
index b78e1f7b8050..b78e1f7b8050 100644
--- a/drivers/serial/sunsab.h
+++ b/drivers/tty/serial/sunsab.h
diff --git a/drivers/serial/sunsu.c b/drivers/tty/serial/sunsu.c
index 551ebfe3ccbb..551ebfe3ccbb 100644
--- a/drivers/serial/sunsu.c
+++ b/drivers/tty/serial/sunsu.c
diff --git a/drivers/serial/sunzilog.c b/drivers/tty/serial/sunzilog.c
index c1967ac1c07f..c1967ac1c07f 100644
--- a/drivers/serial/sunzilog.c
+++ b/drivers/tty/serial/sunzilog.c
diff --git a/drivers/serial/sunzilog.h b/drivers/tty/serial/sunzilog.h
index 5dec7b47cc38..5dec7b47cc38 100644
--- a/drivers/serial/sunzilog.h
+++ b/drivers/tty/serial/sunzilog.h
diff --git a/drivers/serial/timbuart.c b/drivers/tty/serial/timbuart.c
index 1f36b7eb7351..1f36b7eb7351 100644
--- a/drivers/serial/timbuart.c
+++ b/drivers/tty/serial/timbuart.c
diff --git a/drivers/serial/timbuart.h b/drivers/tty/serial/timbuart.h
index 7e566766bc43..7e566766bc43 100644
--- a/drivers/serial/timbuart.h
+++ b/drivers/tty/serial/timbuart.h
diff --git a/drivers/serial/uartlite.c b/drivers/tty/serial/uartlite.c
index d2fce865b731..d2fce865b731 100644
--- a/drivers/serial/uartlite.c
+++ b/drivers/tty/serial/uartlite.c
diff --git a/drivers/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c
index 3f4848e2174a..3f4848e2174a 100644
--- a/drivers/serial/ucc_uart.c
+++ b/drivers/tty/serial/ucc_uart.c
diff --git a/drivers/serial/vr41xx_siu.c b/drivers/tty/serial/vr41xx_siu.c
index 3beb6ab4fa68..3beb6ab4fa68 100644
--- a/drivers/serial/vr41xx_siu.c
+++ b/drivers/tty/serial/vr41xx_siu.c
diff --git a/drivers/serial/vt8500_serial.c b/drivers/tty/serial/vt8500_serial.c
index 322bf56c0d89..322bf56c0d89 100644
--- a/drivers/serial/vt8500_serial.c
+++ b/drivers/tty/serial/vt8500_serial.c
diff --git a/drivers/serial/zs.c b/drivers/tty/serial/zs.c
index 1a7fd3e70315..1a7fd3e70315 100644
--- a/drivers/serial/zs.c
+++ b/drivers/tty/serial/zs.c
diff --git a/drivers/serial/zs.h b/drivers/tty/serial/zs.h
index aa921b57d827..aa921b57d827 100644
--- a/drivers/serial/zs.h
+++ b/drivers/tty/serial/zs.h
diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig
index bcc24779ba0e..18d02e32a3d5 100644
--- a/drivers/usb/core/Kconfig
+++ b/drivers/usb/core/Kconfig
@@ -123,9 +123,9 @@ config USB_OTG
123 123
124config USB_OTG_WHITELIST 124config USB_OTG_WHITELIST
125 bool "Rely on OTG Targeted Peripherals List" 125 bool "Rely on OTG Targeted Peripherals List"
126 depends on USB_OTG || EMBEDDED 126 depends on USB_OTG || EXPERT
127 default y if USB_OTG 127 default y if USB_OTG
128 default n if EMBEDDED 128 default n if EXPERT
129 help 129 help
130 If you say Y here, the "otg_whitelist.h" file will be used as a 130 If you say Y here, the "otg_whitelist.h" file will be used as a
131 product whitelist, so USB peripherals not listed there will be 131 product whitelist, so USB peripherals not listed there will be
@@ -141,7 +141,7 @@ config USB_OTG_WHITELIST
141 141
142config USB_OTG_BLACKLIST_HUB 142config USB_OTG_BLACKLIST_HUB
143 bool "Disable external hubs" 143 bool "Disable external hubs"
144 depends on USB_OTG || EMBEDDED 144 depends on USB_OTG || EXPERT
145 help 145 help
146 If you say Y here, then Linux will refuse to enumerate 146 If you say Y here, then Linux will refuse to enumerate
147 external hubs. OTG hosts are allowed to reduce hardware 147 external hubs. OTG hosts are allowed to reduce hardware
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index d916ac04abab..6bafb51bb437 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -1227,7 +1227,7 @@ config FB_CARILLO_RANCH
1227 1227
1228config FB_INTEL 1228config FB_INTEL
1229 tristate "Intel 830M/845G/852GM/855GM/865G/915G/945G/945GM/965G/965GM support (EXPERIMENTAL)" 1229 tristate "Intel 830M/845G/852GM/855GM/865G/915G/945G/945GM/965G/965GM support (EXPERIMENTAL)"
1230 depends on EXPERIMENTAL && FB && PCI && X86 && AGP_INTEL && EMBEDDED 1230 depends on EXPERIMENTAL && FB && PCI && X86 && AGP_INTEL && EXPERT
1231 select FB_MODE_HELPERS 1231 select FB_MODE_HELPERS
1232 select FB_CFB_FILLRECT 1232 select FB_CFB_FILLRECT
1233 select FB_CFB_COPYAREA 1233 select FB_CFB_COPYAREA
diff --git a/drivers/video/backlight/88pm860x_bl.c b/drivers/video/backlight/88pm860x_bl.c
index c789c46e38af..b224396b86d5 100644
--- a/drivers/video/backlight/88pm860x_bl.c
+++ b/drivers/video/backlight/88pm860x_bl.c
@@ -21,7 +21,7 @@
21#define MAX_BRIGHTNESS (0xFF) 21#define MAX_BRIGHTNESS (0xFF)
22#define MIN_BRIGHTNESS (0) 22#define MIN_BRIGHTNESS (0)
23 23
24#define CURRENT_MASK (0x1F << 1) 24#define CURRENT_BITMASK (0x1F << 1)
25 25
26struct pm860x_backlight_data { 26struct pm860x_backlight_data {
27 struct pm860x_chip *chip; 27 struct pm860x_chip *chip;
@@ -85,7 +85,7 @@ static int pm860x_backlight_set(struct backlight_device *bl, int brightness)
85 if ((data->current_brightness == 0) && brightness) { 85 if ((data->current_brightness == 0) && brightness) {
86 if (data->iset) { 86 if (data->iset) {
87 ret = pm860x_set_bits(data->i2c, wled_idc(data->port), 87 ret = pm860x_set_bits(data->i2c, wled_idc(data->port),
88 CURRENT_MASK, data->iset); 88 CURRENT_BITMASK, data->iset);
89 if (ret < 0) 89 if (ret < 0)
90 goto out; 90 goto out;
91 } 91 }
diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
index 5a35f22372b9..2209e354f531 100644
--- a/drivers/video/console/Kconfig
+++ b/drivers/video/console/Kconfig
@@ -5,7 +5,7 @@
5menu "Console display driver support" 5menu "Console display driver support"
6 6
7config VGA_CONSOLE 7config VGA_CONSOLE
8 bool "VGA text console" if EMBEDDED || !X86 8 bool "VGA text console" if EXPERT || !X86
9 depends on !4xx && !8xx && !SPARC && !M68K && !PARISC && !FRV && !SUPERH && !BLACKFIN && !AVR32 && !MN10300 && (!ARM || ARCH_FOOTBRIDGE || ARCH_INTEGRATOR || ARCH_NETWINDER) 9 depends on !4xx && !8xx && !SPARC && !M68K && !PARISC && !FRV && !SUPERH && !BLACKFIN && !AVR32 && !MN10300 && (!ARM || ARCH_FOOTBRIDGE || ARCH_INTEGRATOR || ARCH_NETWINDER)
10 default y 10 default y
11 help 11 help
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
index ef8d9d558fc7..4fb5b2bf2348 100644
--- a/drivers/virtio/virtio_pci.c
+++ b/drivers/virtio/virtio_pci.c
@@ -96,11 +96,6 @@ static struct pci_device_id virtio_pci_id_table[] = {
96 96
97MODULE_DEVICE_TABLE(pci, virtio_pci_id_table); 97MODULE_DEVICE_TABLE(pci, virtio_pci_id_table);
98 98
99/* A PCI device has it's own struct device and so does a virtio device so
100 * we create a place for the virtio devices to show up in sysfs. I think it
101 * would make more sense for virtio to not insist on having it's own device. */
102static struct device *virtio_pci_root;
103
104/* Convert a generic virtio device to our structure */ 99/* Convert a generic virtio device to our structure */
105static struct virtio_pci_device *to_vp_device(struct virtio_device *vdev) 100static struct virtio_pci_device *to_vp_device(struct virtio_device *vdev)
106{ 101{
@@ -629,7 +624,7 @@ static int __devinit virtio_pci_probe(struct pci_dev *pci_dev,
629 if (vp_dev == NULL) 624 if (vp_dev == NULL)
630 return -ENOMEM; 625 return -ENOMEM;
631 626
632 vp_dev->vdev.dev.parent = virtio_pci_root; 627 vp_dev->vdev.dev.parent = &pci_dev->dev;
633 vp_dev->vdev.dev.release = virtio_pci_release_dev; 628 vp_dev->vdev.dev.release = virtio_pci_release_dev;
634 vp_dev->vdev.config = &virtio_pci_config_ops; 629 vp_dev->vdev.config = &virtio_pci_config_ops;
635 vp_dev->pci_dev = pci_dev; 630 vp_dev->pci_dev = pci_dev;
@@ -717,17 +712,7 @@ static struct pci_driver virtio_pci_driver = {
717 712
718static int __init virtio_pci_init(void) 713static int __init virtio_pci_init(void)
719{ 714{
720 int err; 715 return pci_register_driver(&virtio_pci_driver);
721
722 virtio_pci_root = root_device_register("virtio-pci");
723 if (IS_ERR(virtio_pci_root))
724 return PTR_ERR(virtio_pci_root);
725
726 err = pci_register_driver(&virtio_pci_driver);
727 if (err)
728 root_device_unregister(virtio_pci_root);
729
730 return err;
731} 716}
732 717
733module_init(virtio_pci_init); 718module_init(virtio_pci_init);
@@ -735,7 +720,6 @@ module_init(virtio_pci_init);
735static void __exit virtio_pci_exit(void) 720static void __exit virtio_pci_exit(void)
736{ 721{
737 pci_unregister_driver(&virtio_pci_driver); 722 pci_unregister_driver(&virtio_pci_driver);
738 root_device_unregister(virtio_pci_root);
739} 723}
740 724
741module_exit(virtio_pci_exit); 725module_exit(virtio_pci_exit);
diff --git a/drivers/xen/xenfs/xenbus.c b/drivers/xen/xenfs/xenbus.c
index 1c1236087f78..bbd000f88af7 100644
--- a/drivers/xen/xenfs/xenbus.c
+++ b/drivers/xen/xenfs/xenbus.c
@@ -122,6 +122,7 @@ static ssize_t xenbus_file_read(struct file *filp,
122 int ret; 122 int ret;
123 123
124 mutex_lock(&u->reply_mutex); 124 mutex_lock(&u->reply_mutex);
125again:
125 while (list_empty(&u->read_buffers)) { 126 while (list_empty(&u->read_buffers)) {
126 mutex_unlock(&u->reply_mutex); 127 mutex_unlock(&u->reply_mutex);
127 if (filp->f_flags & O_NONBLOCK) 128 if (filp->f_flags & O_NONBLOCK)
@@ -144,7 +145,7 @@ static ssize_t xenbus_file_read(struct file *filp,
144 i += sz - ret; 145 i += sz - ret;
145 rb->cons += sz - ret; 146 rb->cons += sz - ret;
146 147
147 if (ret != sz) { 148 if (ret != 0) {
148 if (i == 0) 149 if (i == 0)
149 i = -EFAULT; 150 i = -EFAULT;
150 goto out; 151 goto out;
@@ -160,6 +161,8 @@ static ssize_t xenbus_file_read(struct file *filp,
160 struct read_buffer, list); 161 struct read_buffer, list);
161 } 162 }
162 } 163 }
164 if (i == 0)
165 goto again;
163 166
164out: 167out:
165 mutex_unlock(&u->reply_mutex); 168 mutex_unlock(&u->reply_mutex);
@@ -407,6 +410,7 @@ static int xenbus_write_watch(unsigned msg_type, struct xenbus_file_priv *u)
407 410
408 mutex_lock(&u->reply_mutex); 411 mutex_lock(&u->reply_mutex);
409 rc = queue_reply(&u->read_buffers, &reply, sizeof(reply)); 412 rc = queue_reply(&u->read_buffers, &reply, sizeof(reply));
413 wake_up(&u->read_waitq);
410 mutex_unlock(&u->reply_mutex); 414 mutex_unlock(&u->reply_mutex);
411 } 415 }
412 416
@@ -455,7 +459,7 @@ static ssize_t xenbus_file_write(struct file *filp,
455 459
456 ret = copy_from_user(u->u.buffer + u->len, ubuf, len); 460 ret = copy_from_user(u->u.buffer + u->len, ubuf, len);
457 461
458 if (ret == len) { 462 if (ret != 0) {
459 rc = -EFAULT; 463 rc = -EFAULT;
460 goto out; 464 goto out;
461 } 465 }
@@ -488,21 +492,6 @@ static ssize_t xenbus_file_write(struct file *filp,
488 msg_type = u->u.msg.type; 492 msg_type = u->u.msg.type;
489 493
490 switch (msg_type) { 494 switch (msg_type) {
491 case XS_TRANSACTION_START:
492 case XS_TRANSACTION_END:
493 case XS_DIRECTORY:
494 case XS_READ:
495 case XS_GET_PERMS:
496 case XS_RELEASE:
497 case XS_GET_DOMAIN_PATH:
498 case XS_WRITE:
499 case XS_MKDIR:
500 case XS_RM:
501 case XS_SET_PERMS:
502 /* Send out a transaction */
503 ret = xenbus_write_transaction(msg_type, u);
504 break;
505
506 case XS_WATCH: 495 case XS_WATCH:
507 case XS_UNWATCH: 496 case XS_UNWATCH:
508 /* (Un)Ask for some path to be watched for changes */ 497 /* (Un)Ask for some path to be watched for changes */
@@ -510,7 +499,8 @@ static ssize_t xenbus_file_write(struct file *filp,
510 break; 499 break;
511 500
512 default: 501 default:
513 ret = -EINVAL; 502 /* Send out a transaction */
503 ret = xenbus_write_transaction(msg_type, u);
514 break; 504 break;
515 } 505 }
516 if (ret != 0) 506 if (ret != 0)
@@ -555,6 +545,7 @@ static int xenbus_file_release(struct inode *inode, struct file *filp)
555 struct xenbus_file_priv *u = filp->private_data; 545 struct xenbus_file_priv *u = filp->private_data;
556 struct xenbus_transaction_holder *trans, *tmp; 546 struct xenbus_transaction_holder *trans, *tmp;
557 struct watch_adapter *watch, *tmp_watch; 547 struct watch_adapter *watch, *tmp_watch;
548 struct read_buffer *rb, *tmp_rb;
558 549
559 /* 550 /*
560 * No need for locking here because there are no other users, 551 * No need for locking here because there are no other users,
@@ -573,6 +564,10 @@ static int xenbus_file_release(struct inode *inode, struct file *filp)
573 free_watch_adapter(watch); 564 free_watch_adapter(watch);
574 } 565 }
575 566
567 list_for_each_entry_safe(rb, tmp_rb, &u->read_buffers, list) {
568 list_del(&rb->list);
569 kfree(rb);
570 }
576 kfree(u); 571 kfree(u);
577 572
578 return 0; 573 return 0;
diff --git a/fs/Kconfig b/fs/Kconfig
index 9a7921ae4763..3db9caa57edc 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -50,7 +50,7 @@ config EXPORTFS
50 tristate 50 tristate
51 51
52config FILE_LOCKING 52config FILE_LOCKING
53 bool "Enable POSIX file locking API" if EMBEDDED 53 bool "Enable POSIX file locking API" if EXPERT
54 default y 54 default y
55 help 55 help
56 This option enables standard file locking support, required 56 This option enables standard file locking support, required
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index ede98300a8cd..65829d32128c 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -79,11 +79,11 @@ void cifs_dump_mids(struct TCP_Server_Info *server)
79 spin_lock(&GlobalMid_Lock); 79 spin_lock(&GlobalMid_Lock);
80 list_for_each(tmp, &server->pending_mid_q) { 80 list_for_each(tmp, &server->pending_mid_q) {
81 mid_entry = list_entry(tmp, struct mid_q_entry, qhead); 81 mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
82 cERROR(1, "State: %d Cmd: %d Pid: %d Tsk: %p Mid %d", 82 cERROR(1, "State: %d Cmd: %d Pid: %d Cbdata: %p Mid %d",
83 mid_entry->midState, 83 mid_entry->midState,
84 (int)mid_entry->command, 84 (int)mid_entry->command,
85 mid_entry->pid, 85 mid_entry->pid,
86 mid_entry->tsk, 86 mid_entry->callback_data,
87 mid_entry->mid); 87 mid_entry->mid);
88#ifdef CONFIG_CIFS_STATS2 88#ifdef CONFIG_CIFS_STATS2
89 cERROR(1, "IsLarge: %d buf: %p time rcv: %ld now: %ld", 89 cERROR(1, "IsLarge: %d buf: %p time rcv: %ld now: %ld",
@@ -218,11 +218,11 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
218 mid_entry = list_entry(tmp3, struct mid_q_entry, 218 mid_entry = list_entry(tmp3, struct mid_q_entry,
219 qhead); 219 qhead);
220 seq_printf(m, "\tState: %d com: %d pid:" 220 seq_printf(m, "\tState: %d com: %d pid:"
221 " %d tsk: %p mid %d\n", 221 " %d cbdata: %p mid %d\n",
222 mid_entry->midState, 222 mid_entry->midState,
223 (int)mid_entry->command, 223 (int)mid_entry->command,
224 mid_entry->pid, 224 mid_entry->pid,
225 mid_entry->tsk, 225 mid_entry->callback_data,
226 mid_entry->mid); 226 mid_entry->mid);
227 } 227 }
228 spin_unlock(&GlobalMid_Lock); 228 spin_unlock(&GlobalMid_Lock);
@@ -331,7 +331,7 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
331 atomic_read(&totSmBufAllocCount)); 331 atomic_read(&totSmBufAllocCount));
332#endif /* CONFIG_CIFS_STATS2 */ 332#endif /* CONFIG_CIFS_STATS2 */
333 333
334 seq_printf(m, "Operations (MIDs): %d\n", midCount.counter); 334 seq_printf(m, "Operations (MIDs): %d\n", atomic_read(&midCount));
335 seq_printf(m, 335 seq_printf(m,
336 "\n%d session %d share reconnects\n", 336 "\n%d session %d share reconnects\n",
337 tcpSesReconnectCount.counter, tconInfoReconnectCount.counter); 337 tcpSesReconnectCount.counter, tconInfoReconnectCount.counter);
diff --git a/fs/cifs/cifs_fs_sb.h b/fs/cifs/cifs_fs_sb.h
index 7852cd677051..ac51cd2d33ae 100644
--- a/fs/cifs/cifs_fs_sb.h
+++ b/fs/cifs/cifs_fs_sb.h
@@ -40,6 +40,7 @@
40#define CIFS_MOUNT_FSCACHE 0x8000 /* local caching enabled */ 40#define CIFS_MOUNT_FSCACHE 0x8000 /* local caching enabled */
41#define CIFS_MOUNT_MF_SYMLINKS 0x10000 /* Minshall+French Symlinks enabled */ 41#define CIFS_MOUNT_MF_SYMLINKS 0x10000 /* Minshall+French Symlinks enabled */
42#define CIFS_MOUNT_MULTIUSER 0x20000 /* multiuser mount */ 42#define CIFS_MOUNT_MULTIUSER 0x20000 /* multiuser mount */
43#define CIFS_MOUNT_STRICT_IO 0x40000 /* strict cache mode */
43 44
44struct cifs_sb_info { 45struct cifs_sb_info {
45 struct rb_root tlink_tree; 46 struct rb_root tlink_tree;
diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c
index 430f510a1720..fc0fd4fde306 100644
--- a/fs/cifs/cifs_unicode.c
+++ b/fs/cifs/cifs_unicode.c
@@ -44,10 +44,14 @@ cifs_ucs2_bytes(const __le16 *from, int maxbytes,
44 int charlen, outlen = 0; 44 int charlen, outlen = 0;
45 int maxwords = maxbytes / 2; 45 int maxwords = maxbytes / 2;
46 char tmp[NLS_MAX_CHARSET_SIZE]; 46 char tmp[NLS_MAX_CHARSET_SIZE];
47 __u16 ftmp;
47 48
48 for (i = 0; i < maxwords && from[i]; i++) { 49 for (i = 0; i < maxwords; i++) {
49 charlen = codepage->uni2char(le16_to_cpu(from[i]), tmp, 50 ftmp = get_unaligned_le16(&from[i]);
50 NLS_MAX_CHARSET_SIZE); 51 if (ftmp == 0)
52 break;
53
54 charlen = codepage->uni2char(ftmp, tmp, NLS_MAX_CHARSET_SIZE);
51 if (charlen > 0) 55 if (charlen > 0)
52 outlen += charlen; 56 outlen += charlen;
53 else 57 else
@@ -58,9 +62,9 @@ cifs_ucs2_bytes(const __le16 *from, int maxbytes,
58} 62}
59 63
60/* 64/*
61 * cifs_mapchar - convert a little-endian char to proper char in codepage 65 * cifs_mapchar - convert a host-endian char to proper char in codepage
62 * @target - where converted character should be copied 66 * @target - where converted character should be copied
63 * @src_char - 2 byte little-endian source character 67 * @src_char - 2 byte host-endian source character
64 * @cp - codepage to which character should be converted 68 * @cp - codepage to which character should be converted
65 * @mapchar - should character be mapped according to mapchars mount option? 69 * @mapchar - should character be mapped according to mapchars mount option?
66 * 70 *
@@ -69,7 +73,7 @@ cifs_ucs2_bytes(const __le16 *from, int maxbytes,
69 * enough to hold the result of the conversion (at least NLS_MAX_CHARSET_SIZE). 73 * enough to hold the result of the conversion (at least NLS_MAX_CHARSET_SIZE).
70 */ 74 */
71static int 75static int
72cifs_mapchar(char *target, const __le16 src_char, const struct nls_table *cp, 76cifs_mapchar(char *target, const __u16 src_char, const struct nls_table *cp,
73 bool mapchar) 77 bool mapchar)
74{ 78{
75 int len = 1; 79 int len = 1;
@@ -82,7 +86,7 @@ cifs_mapchar(char *target, const __le16 src_char, const struct nls_table *cp,
82 * build_path_from_dentry are modified, as they use slash as 86 * build_path_from_dentry are modified, as they use slash as
83 * separator. 87 * separator.
84 */ 88 */
85 switch (le16_to_cpu(src_char)) { 89 switch (src_char) {
86 case UNI_COLON: 90 case UNI_COLON:
87 *target = ':'; 91 *target = ':';
88 break; 92 break;
@@ -109,8 +113,7 @@ out:
109 return len; 113 return len;
110 114
111cp_convert: 115cp_convert:
112 len = cp->uni2char(le16_to_cpu(src_char), target, 116 len = cp->uni2char(src_char, target, NLS_MAX_CHARSET_SIZE);
113 NLS_MAX_CHARSET_SIZE);
114 if (len <= 0) { 117 if (len <= 0) {
115 *target = '?'; 118 *target = '?';
116 len = 1; 119 len = 1;
@@ -149,6 +152,7 @@ cifs_from_ucs2(char *to, const __le16 *from, int tolen, int fromlen,
149 int nullsize = nls_nullsize(codepage); 152 int nullsize = nls_nullsize(codepage);
150 int fromwords = fromlen / 2; 153 int fromwords = fromlen / 2;
151 char tmp[NLS_MAX_CHARSET_SIZE]; 154 char tmp[NLS_MAX_CHARSET_SIZE];
155 __u16 ftmp;
152 156
153 /* 157 /*
154 * because the chars can be of varying widths, we need to take care 158 * because the chars can be of varying widths, we need to take care
@@ -158,19 +162,23 @@ cifs_from_ucs2(char *to, const __le16 *from, int tolen, int fromlen,
158 */ 162 */
159 safelen = tolen - (NLS_MAX_CHARSET_SIZE + nullsize); 163 safelen = tolen - (NLS_MAX_CHARSET_SIZE + nullsize);
160 164
161 for (i = 0; i < fromwords && from[i]; i++) { 165 for (i = 0; i < fromwords; i++) {
166 ftmp = get_unaligned_le16(&from[i]);
167 if (ftmp == 0)
168 break;
169
162 /* 170 /*
163 * check to see if converting this character might make the 171 * check to see if converting this character might make the
164 * conversion bleed into the null terminator 172 * conversion bleed into the null terminator
165 */ 173 */
166 if (outlen >= safelen) { 174 if (outlen >= safelen) {
167 charlen = cifs_mapchar(tmp, from[i], codepage, mapchar); 175 charlen = cifs_mapchar(tmp, ftmp, codepage, mapchar);
168 if ((outlen + charlen) > (tolen - nullsize)) 176 if ((outlen + charlen) > (tolen - nullsize))
169 break; 177 break;
170 } 178 }
171 179
172 /* put converted char into 'to' buffer */ 180 /* put converted char into 'to' buffer */
173 charlen = cifs_mapchar(&to[outlen], from[i], codepage, mapchar); 181 charlen = cifs_mapchar(&to[outlen], ftmp, codepage, mapchar);
174 outlen += charlen; 182 outlen += charlen;
175 } 183 }
176 184
@@ -193,24 +201,21 @@ cifs_strtoUCS(__le16 *to, const char *from, int len,
193{ 201{
194 int charlen; 202 int charlen;
195 int i; 203 int i;
196 wchar_t *wchar_to = (wchar_t *)to; /* needed to quiet sparse */ 204 wchar_t wchar_to; /* needed to quiet sparse */
197 205
198 for (i = 0; len && *from; i++, from += charlen, len -= charlen) { 206 for (i = 0; len && *from; i++, from += charlen, len -= charlen) {
199 207 charlen = codepage->char2uni(from, len, &wchar_to);
200 /* works for 2.4.0 kernel or later */
201 charlen = codepage->char2uni(from, len, &wchar_to[i]);
202 if (charlen < 1) { 208 if (charlen < 1) {
203 cERROR(1, "strtoUCS: char2uni of %d returned %d", 209 cERROR(1, "strtoUCS: char2uni of 0x%x returned %d",
204 (int)*from, charlen); 210 *from, charlen);
205 /* A question mark */ 211 /* A question mark */
206 to[i] = cpu_to_le16(0x003f); 212 wchar_to = 0x003f;
207 charlen = 1; 213 charlen = 1;
208 } else 214 }
209 to[i] = cpu_to_le16(wchar_to[i]); 215 put_unaligned_le16(wchar_to, &to[i]);
210
211 } 216 }
212 217
213 to[i] = 0; 218 put_unaligned_le16(0, &to[i]);
214 return i; 219 return i;
215} 220}
216 221
@@ -252,3 +257,79 @@ cifs_strndup_from_ucs(const char *src, const int maxlen, const bool is_unicode,
252 return dst; 257 return dst;
253} 258}
254 259
260/*
261 * Convert 16 bit Unicode pathname to wire format from string in current code
262 * page. Conversion may involve remapping up the six characters that are
263 * only legal in POSIX-like OS (if they are present in the string). Path
264 * names are little endian 16 bit Unicode on the wire
265 */
266int
267cifsConvertToUCS(__le16 *target, const char *source, int maxlen,
268 const struct nls_table *cp, int mapChars)
269{
270 int i, j, charlen;
271 int len_remaining = maxlen;
272 char src_char;
273 __u16 temp;
274
275 if (!mapChars)
276 return cifs_strtoUCS(target, source, PATH_MAX, cp);
277
278 for (i = 0, j = 0; i < maxlen; j++) {
279 src_char = source[i];
280 switch (src_char) {
281 case 0:
282 put_unaligned_le16(0, &target[j]);
283 goto ctoUCS_out;
284 case ':':
285 temp = UNI_COLON;
286 break;
287 case '*':
288 temp = UNI_ASTERIK;
289 break;
290 case '?':
291 temp = UNI_QUESTION;
292 break;
293 case '<':
294 temp = UNI_LESSTHAN;
295 break;
296 case '>':
297 temp = UNI_GRTRTHAN;
298 break;
299 case '|':
300 temp = UNI_PIPE;
301 break;
302 /*
303 * FIXME: We can not handle remapping backslash (UNI_SLASH)
304 * until all the calls to build_path_from_dentry are modified,
305 * as they use backslash as separator.
306 */
307 default:
308 charlen = cp->char2uni(source+i, len_remaining,
309 &temp);
310 /*
311 * if no match, use question mark, which at least in
312 * some cases serves as wild card
313 */
314 if (charlen < 1) {
315 temp = 0x003f;
316 charlen = 1;
317 }
318 len_remaining -= charlen;
319 /*
320 * character may take more than one byte in the source
321 * string, but will take exactly two bytes in the
322 * target string
323 */
324 i += charlen;
325 continue;
326 }
327 put_unaligned_le16(temp, &target[j]);
328 i++; /* move to next char in source string */
329 len_remaining--;
330 }
331
332ctoUCS_out:
333 return i;
334}
335
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
index a437ec391a01..1e7636b145a8 100644
--- a/fs/cifs/cifsacl.c
+++ b/fs/cifs/cifsacl.c
@@ -41,9 +41,12 @@ static struct cifs_wksid wksidarr[NUM_WK_SIDS] = {
41; 41;
42 42
43 43
44/* security id for everyone */ 44/* security id for everyone/world system group */
45static const struct cifs_sid sid_everyone = { 45static const struct cifs_sid sid_everyone = {
46 1, 1, {0, 0, 0, 0, 0, 1}, {0} }; 46 1, 1, {0, 0, 0, 0, 0, 1}, {0} };
47/* security id for Authenticated Users system group */
48static const struct cifs_sid sid_authusers = {
49 1, 1, {0, 0, 0, 0, 0, 5}, {11} };
47/* group users */ 50/* group users */
48static const struct cifs_sid sid_user = {1, 2 , {0, 0, 0, 0, 0, 5}, {} }; 51static const struct cifs_sid sid_user = {1, 2 , {0, 0, 0, 0, 0, 5}, {} };
49 52
@@ -365,7 +368,7 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl,
365 if (num_aces > 0) { 368 if (num_aces > 0) {
366 umode_t user_mask = S_IRWXU; 369 umode_t user_mask = S_IRWXU;
367 umode_t group_mask = S_IRWXG; 370 umode_t group_mask = S_IRWXG;
368 umode_t other_mask = S_IRWXO; 371 umode_t other_mask = S_IRWXU | S_IRWXG | S_IRWXO;
369 372
370 ppace = kmalloc(num_aces * sizeof(struct cifs_ace *), 373 ppace = kmalloc(num_aces * sizeof(struct cifs_ace *),
371 GFP_KERNEL); 374 GFP_KERNEL);
@@ -390,6 +393,12 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl,
390 ppace[i]->type, 393 ppace[i]->type,
391 &fattr->cf_mode, 394 &fattr->cf_mode,
392 &other_mask); 395 &other_mask);
396 if (compare_sids(&(ppace[i]->sid), &sid_authusers))
397 access_flags_to_mode(ppace[i]->access_req,
398 ppace[i]->type,
399 &fattr->cf_mode,
400 &other_mask);
401
393 402
394/* memcpy((void *)(&(cifscred->aces[i])), 403/* memcpy((void *)(&(cifscred->aces[i])),
395 (void *)ppace[i], 404 (void *)ppace[i],
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index d9f652a522a6..a8323f1dc1c4 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -77,7 +77,11 @@ unsigned int cifs_max_pending = CIFS_MAX_REQ;
77module_param(cifs_max_pending, int, 0); 77module_param(cifs_max_pending, int, 0);
78MODULE_PARM_DESC(cifs_max_pending, "Simultaneous requests to server. " 78MODULE_PARM_DESC(cifs_max_pending, "Simultaneous requests to server. "
79 "Default: 50 Range: 2 to 256"); 79 "Default: 50 Range: 2 to 256");
80 80unsigned short echo_retries = 5;
81module_param(echo_retries, ushort, 0644);
82MODULE_PARM_DESC(echo_retries, "Number of echo attempts before giving up and "
83 "reconnecting server. Default: 5. 0 means "
84 "never reconnect.");
81extern mempool_t *cifs_sm_req_poolp; 85extern mempool_t *cifs_sm_req_poolp;
82extern mempool_t *cifs_req_poolp; 86extern mempool_t *cifs_req_poolp;
83extern mempool_t *cifs_mid_poolp; 87extern mempool_t *cifs_mid_poolp;
@@ -729,6 +733,25 @@ const struct file_operations cifs_file_ops = {
729 .setlease = cifs_setlease, 733 .setlease = cifs_setlease,
730}; 734};
731 735
736const struct file_operations cifs_file_strict_ops = {
737 .read = do_sync_read,
738 .write = do_sync_write,
739 .aio_read = cifs_strict_readv,
740 .aio_write = cifs_file_aio_write,
741 .open = cifs_open,
742 .release = cifs_close,
743 .lock = cifs_lock,
744 .fsync = cifs_strict_fsync,
745 .flush = cifs_flush,
746 .mmap = cifs_file_strict_mmap,
747 .splice_read = generic_file_splice_read,
748 .llseek = cifs_llseek,
749#ifdef CONFIG_CIFS_POSIX
750 .unlocked_ioctl = cifs_ioctl,
751#endif /* CONFIG_CIFS_POSIX */
752 .setlease = cifs_setlease,
753};
754
732const struct file_operations cifs_file_direct_ops = { 755const struct file_operations cifs_file_direct_ops = {
733 /* no aio, no readv - 756 /* no aio, no readv -
734 BB reevaluate whether they can be done with directio, no cache */ 757 BB reevaluate whether they can be done with directio, no cache */
@@ -747,6 +770,7 @@ const struct file_operations cifs_file_direct_ops = {
747 .llseek = cifs_llseek, 770 .llseek = cifs_llseek,
748 .setlease = cifs_setlease, 771 .setlease = cifs_setlease,
749}; 772};
773
750const struct file_operations cifs_file_nobrl_ops = { 774const struct file_operations cifs_file_nobrl_ops = {
751 .read = do_sync_read, 775 .read = do_sync_read,
752 .write = do_sync_write, 776 .write = do_sync_write,
@@ -765,6 +789,24 @@ const struct file_operations cifs_file_nobrl_ops = {
765 .setlease = cifs_setlease, 789 .setlease = cifs_setlease,
766}; 790};
767 791
792const struct file_operations cifs_file_strict_nobrl_ops = {
793 .read = do_sync_read,
794 .write = do_sync_write,
795 .aio_read = cifs_strict_readv,
796 .aio_write = cifs_file_aio_write,
797 .open = cifs_open,
798 .release = cifs_close,
799 .fsync = cifs_strict_fsync,
800 .flush = cifs_flush,
801 .mmap = cifs_file_strict_mmap,
802 .splice_read = generic_file_splice_read,
803 .llseek = cifs_llseek,
804#ifdef CONFIG_CIFS_POSIX
805 .unlocked_ioctl = cifs_ioctl,
806#endif /* CONFIG_CIFS_POSIX */
807 .setlease = cifs_setlease,
808};
809
768const struct file_operations cifs_file_direct_nobrl_ops = { 810const struct file_operations cifs_file_direct_nobrl_ops = {
769 /* no mmap, no aio, no readv - 811 /* no mmap, no aio, no readv -
770 BB reevaluate whether they can be done with directio, no cache */ 812 BB reevaluate whether they can be done with directio, no cache */
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h
index 851030f74939..f23206d46531 100644
--- a/fs/cifs/cifsfs.h
+++ b/fs/cifs/cifsfs.h
@@ -61,6 +61,7 @@ extern int cifs_rename(struct inode *, struct dentry *, struct inode *,
61 struct dentry *); 61 struct dentry *);
62extern int cifs_revalidate_file(struct file *filp); 62extern int cifs_revalidate_file(struct file *filp);
63extern int cifs_revalidate_dentry(struct dentry *); 63extern int cifs_revalidate_dentry(struct dentry *);
64extern void cifs_invalidate_mapping(struct inode *inode);
64extern int cifs_getattr(struct vfsmount *, struct dentry *, struct kstat *); 65extern int cifs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
65extern int cifs_setattr(struct dentry *, struct iattr *); 66extern int cifs_setattr(struct dentry *, struct iattr *);
66 67
@@ -72,19 +73,25 @@ extern const struct inode_operations cifs_dfs_referral_inode_operations;
72/* Functions related to files and directories */ 73/* Functions related to files and directories */
73extern const struct file_operations cifs_file_ops; 74extern const struct file_operations cifs_file_ops;
74extern const struct file_operations cifs_file_direct_ops; /* if directio mnt */ 75extern const struct file_operations cifs_file_direct_ops; /* if directio mnt */
75extern const struct file_operations cifs_file_nobrl_ops; 76extern const struct file_operations cifs_file_strict_ops; /* if strictio mnt */
76extern const struct file_operations cifs_file_direct_nobrl_ops; /* no brlocks */ 77extern const struct file_operations cifs_file_nobrl_ops; /* no brlocks */
78extern const struct file_operations cifs_file_direct_nobrl_ops;
79extern const struct file_operations cifs_file_strict_nobrl_ops;
77extern int cifs_open(struct inode *inode, struct file *file); 80extern int cifs_open(struct inode *inode, struct file *file);
78extern int cifs_close(struct inode *inode, struct file *file); 81extern int cifs_close(struct inode *inode, struct file *file);
79extern int cifs_closedir(struct inode *inode, struct file *file); 82extern int cifs_closedir(struct inode *inode, struct file *file);
80extern ssize_t cifs_user_read(struct file *file, char __user *read_data, 83extern ssize_t cifs_user_read(struct file *file, char __user *read_data,
81 size_t read_size, loff_t *poffset); 84 size_t read_size, loff_t *poffset);
85extern ssize_t cifs_strict_readv(struct kiocb *iocb, const struct iovec *iov,
86 unsigned long nr_segs, loff_t pos);
82extern ssize_t cifs_user_write(struct file *file, const char __user *write_data, 87extern ssize_t cifs_user_write(struct file *file, const char __user *write_data,
83 size_t write_size, loff_t *poffset); 88 size_t write_size, loff_t *poffset);
84extern int cifs_lock(struct file *, int, struct file_lock *); 89extern int cifs_lock(struct file *, int, struct file_lock *);
85extern int cifs_fsync(struct file *, int); 90extern int cifs_fsync(struct file *, int);
91extern int cifs_strict_fsync(struct file *, int);
86extern int cifs_flush(struct file *, fl_owner_t id); 92extern int cifs_flush(struct file *, fl_owner_t id);
87extern int cifs_file_mmap(struct file * , struct vm_area_struct *); 93extern int cifs_file_mmap(struct file * , struct vm_area_struct *);
94extern int cifs_file_strict_mmap(struct file * , struct vm_area_struct *);
88extern const struct file_operations cifs_dir_ops; 95extern const struct file_operations cifs_dir_ops;
89extern int cifs_dir_open(struct inode *inode, struct file *file); 96extern int cifs_dir_open(struct inode *inode, struct file *file);
90extern int cifs_readdir(struct file *file, void *direntry, filldir_t filldir); 97extern int cifs_readdir(struct file *file, void *direntry, filldir_t filldir);
@@ -118,5 +125,5 @@ extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);
118extern const struct export_operations cifs_export_ops; 125extern const struct export_operations cifs_export_ops;
119#endif /* EXPERIMENTAL */ 126#endif /* EXPERIMENTAL */
120 127
121#define CIFS_VERSION "1.68" 128#define CIFS_VERSION "1.69"
122#endif /* _CIFSFS_H */ 129#endif /* _CIFSFS_H */
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 606ca8bb7102..5bfb75346cb0 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -161,6 +161,7 @@ struct TCP_Server_Info {
161 int srv_count; /* reference counter */ 161 int srv_count; /* reference counter */
162 /* 15 character server name + 0x20 16th byte indicating type = srv */ 162 /* 15 character server name + 0x20 16th byte indicating type = srv */
163 char server_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL]; 163 char server_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL];
164 enum statusEnum tcpStatus; /* what we think the status is */
164 char *hostname; /* hostname portion of UNC string */ 165 char *hostname; /* hostname portion of UNC string */
165 struct socket *ssocket; 166 struct socket *ssocket;
166 struct sockaddr_storage dstaddr; 167 struct sockaddr_storage dstaddr;
@@ -168,25 +169,16 @@ struct TCP_Server_Info {
168 wait_queue_head_t response_q; 169 wait_queue_head_t response_q;
169 wait_queue_head_t request_q; /* if more than maxmpx to srvr must block*/ 170 wait_queue_head_t request_q; /* if more than maxmpx to srvr must block*/
170 struct list_head pending_mid_q; 171 struct list_head pending_mid_q;
171 void *Server_NlsInfo; /* BB - placeholder for future NLS info */
172 unsigned short server_codepage; /* codepage for the server */
173 enum protocolEnum protocolType;
174 char versionMajor;
175 char versionMinor;
176 bool svlocal:1; /* local server or remote */
177 bool noblocksnd; /* use blocking sendmsg */ 172 bool noblocksnd; /* use blocking sendmsg */
178 bool noautotune; /* do not autotune send buf sizes */ 173 bool noautotune; /* do not autotune send buf sizes */
179 bool tcp_nodelay; 174 bool tcp_nodelay;
180 atomic_t inFlight; /* number of requests on the wire to server */ 175 atomic_t inFlight; /* number of requests on the wire to server */
181#ifdef CONFIG_CIFS_STATS2
182 atomic_t inSend; /* requests trying to send */
183 atomic_t num_waiters; /* blocked waiting to get in sendrecv */
184#endif
185 enum statusEnum tcpStatus; /* what we think the status is */
186 struct mutex srv_mutex; 176 struct mutex srv_mutex;
187 struct task_struct *tsk; 177 struct task_struct *tsk;
188 char server_GUID[16]; 178 char server_GUID[16];
189 char secMode; 179 char secMode;
180 bool session_estab; /* mark when very first sess is established */
181 u16 dialect; /* dialect index that server chose */
190 enum securityEnum secType; 182 enum securityEnum secType;
191 unsigned int maxReq; /* Clients should submit no more */ 183 unsigned int maxReq; /* Clients should submit no more */
192 /* than maxReq distinct unanswered SMBs to the server when using */ 184 /* than maxReq distinct unanswered SMBs to the server when using */
@@ -199,8 +191,6 @@ struct TCP_Server_Info {
199 unsigned int max_vcs; /* maximum number of smb sessions, at least 191 unsigned int max_vcs; /* maximum number of smb sessions, at least
200 those that can be specified uniquely with 192 those that can be specified uniquely with
201 vcnumbers */ 193 vcnumbers */
202 char sessid[4]; /* unique token id for this session */
203 /* (returned on Negotiate */
204 int capabilities; /* allow selective disabling of caps by smb sess */ 194 int capabilities; /* allow selective disabling of caps by smb sess */
205 int timeAdj; /* Adjust for difference in server time zone in sec */ 195 int timeAdj; /* Adjust for difference in server time zone in sec */
206 __u16 CurrentMid; /* multiplex id - rotating counter */ 196 __u16 CurrentMid; /* multiplex id - rotating counter */
@@ -210,17 +200,20 @@ struct TCP_Server_Info {
210 __u32 sequence_number; /* for signing, protected by srv_mutex */ 200 __u32 sequence_number; /* for signing, protected by srv_mutex */
211 struct session_key session_key; 201 struct session_key session_key;
212 unsigned long lstrp; /* when we got last response from this server */ 202 unsigned long lstrp; /* when we got last response from this server */
213 u16 dialect; /* dialect index that server chose */
214 struct cifs_secmech secmech; /* crypto sec mech functs, descriptors */ 203 struct cifs_secmech secmech; /* crypto sec mech functs, descriptors */
215 /* extended security flavors that server supports */ 204 /* extended security flavors that server supports */
205 bool sec_ntlmssp; /* supports NTLMSSP */
206 bool sec_kerberosu2u; /* supports U2U Kerberos */
216 bool sec_kerberos; /* supports plain Kerberos */ 207 bool sec_kerberos; /* supports plain Kerberos */
217 bool sec_mskerberos; /* supports legacy MS Kerberos */ 208 bool sec_mskerberos; /* supports legacy MS Kerberos */
218 bool sec_kerberosu2u; /* supports U2U Kerberos */ 209 struct delayed_work echo; /* echo ping workqueue job */
219 bool sec_ntlmssp; /* supports NTLMSSP */
220 bool session_estab; /* mark when very first sess is established */
221#ifdef CONFIG_CIFS_FSCACHE 210#ifdef CONFIG_CIFS_FSCACHE
222 struct fscache_cookie *fscache; /* client index cache cookie */ 211 struct fscache_cookie *fscache; /* client index cache cookie */
223#endif 212#endif
213#ifdef CONFIG_CIFS_STATS2
214 atomic_t inSend; /* requests trying to send */
215 atomic_t num_waiters; /* blocked waiting to get in sendrecv */
216#endif
224}; 217};
225 218
226/* 219/*
@@ -446,11 +439,11 @@ struct cifsInodeInfo {
446 /* BB add in lists for dirty pages i.e. write caching info for oplock */ 439 /* BB add in lists for dirty pages i.e. write caching info for oplock */
447 struct list_head openFileList; 440 struct list_head openFileList;
448 __u32 cifsAttrs; /* e.g. DOS archive bit, sparse, compressed, system */ 441 __u32 cifsAttrs; /* e.g. DOS archive bit, sparse, compressed, system */
449 unsigned long time; /* jiffies of last update/check of inode */ 442 bool clientCanCacheRead; /* read oplock */
450 bool clientCanCacheRead:1; /* read oplock */ 443 bool clientCanCacheAll; /* read and writebehind oplock */
451 bool clientCanCacheAll:1; /* read and writebehind oplock */ 444 bool delete_pending; /* DELETE_ON_CLOSE is set */
452 bool delete_pending:1; /* DELETE_ON_CLOSE is set */ 445 bool invalid_mapping; /* pagecache is invalid */
453 bool invalid_mapping:1; /* pagecache is invalid */ 446 unsigned long time; /* jiffies of last update of inode */
454 u64 server_eof; /* current file size on server */ 447 u64 server_eof; /* current file size on server */
455 u64 uniqueid; /* server inode number */ 448 u64 uniqueid; /* server inode number */
456 u64 createtime; /* creation time on server */ 449 u64 createtime; /* creation time on server */
@@ -508,6 +501,18 @@ static inline void cifs_stats_bytes_read(struct cifsTconInfo *tcon,
508 501
509#endif 502#endif
510 503
504struct mid_q_entry;
505
506/*
507 * This is the prototype for the mid callback function. When creating one,
508 * take special care to avoid deadlocks. Things to bear in mind:
509 *
510 * - it will be called by cifsd
511 * - the GlobalMid_Lock will be held
512 * - the mid will be removed from the pending_mid_q list
513 */
514typedef void (mid_callback_t)(struct mid_q_entry *mid);
515
511/* one of these for every pending CIFS request to the server */ 516/* one of these for every pending CIFS request to the server */
512struct mid_q_entry { 517struct mid_q_entry {
513 struct list_head qhead; /* mids waiting on reply from this server */ 518 struct list_head qhead; /* mids waiting on reply from this server */
@@ -519,7 +524,8 @@ struct mid_q_entry {
519 unsigned long when_sent; /* time when smb send finished */ 524 unsigned long when_sent; /* time when smb send finished */
520 unsigned long when_received; /* when demux complete (taken off wire) */ 525 unsigned long when_received; /* when demux complete (taken off wire) */
521#endif 526#endif
522 struct task_struct *tsk; /* task waiting for response */ 527 mid_callback_t *callback; /* call completion callback */
528 void *callback_data; /* general purpose pointer for callback */
523 struct smb_hdr *resp_buf; /* response buffer */ 529 struct smb_hdr *resp_buf; /* response buffer */
524 int midState; /* wish this were enum but can not pass to wait_event */ 530 int midState; /* wish this were enum but can not pass to wait_event */
525 __u8 command; /* smb command code */ 531 __u8 command; /* smb command code */
@@ -622,12 +628,9 @@ static inline void free_dfs_info_array(struct dfs_info3_param *param,
622#define CIFS_IOVEC 4 /* array of response buffers */ 628#define CIFS_IOVEC 4 /* array of response buffers */
623 629
624/* Type of Request to SendReceive2 */ 630/* Type of Request to SendReceive2 */
625#define CIFS_STD_OP 0 /* normal request timeout */ 631#define CIFS_BLOCKING_OP 1 /* operation can block */
626#define CIFS_LONG_OP 1 /* long op (up to 45 sec, oplock time) */ 632#define CIFS_ASYNC_OP 2 /* do not wait for response */
627#define CIFS_VLONG_OP 2 /* sloow op - can take up to 180 seconds */ 633#define CIFS_TIMEOUT_MASK 0x003 /* only one of above set in req */
628#define CIFS_BLOCKING_OP 4 /* operation can block */
629#define CIFS_ASYNC_OP 8 /* do not wait for response */
630#define CIFS_TIMEOUT_MASK 0x00F /* only one of 5 above set in req */
631#define CIFS_LOG_ERROR 0x010 /* log NT STATUS if non-zero */ 634#define CIFS_LOG_ERROR 0x010 /* log NT STATUS if non-zero */
632#define CIFS_LARGE_BUF_OP 0x020 /* large request buffer */ 635#define CIFS_LARGE_BUF_OP 0x020 /* large request buffer */
633#define CIFS_NO_RESP 0x040 /* no response buffer required */ 636#define CIFS_NO_RESP 0x040 /* no response buffer required */
@@ -790,6 +793,9 @@ GLOBAL_EXTERN unsigned int cifs_min_rcv; /* min size of big ntwrk buf pool */
790GLOBAL_EXTERN unsigned int cifs_min_small; /* min size of small buf pool */ 793GLOBAL_EXTERN unsigned int cifs_min_small; /* min size of small buf pool */
791GLOBAL_EXTERN unsigned int cifs_max_pending; /* MAX requests at once to server*/ 794GLOBAL_EXTERN unsigned int cifs_max_pending; /* MAX requests at once to server*/
792 795
796/* reconnect after this many failed echo attempts */
797GLOBAL_EXTERN unsigned short echo_retries;
798
793void cifs_oplock_break(struct work_struct *work); 799void cifs_oplock_break(struct work_struct *work);
794void cifs_oplock_break_get(struct cifsFileInfo *cfile); 800void cifs_oplock_break_get(struct cifsFileInfo *cfile);
795void cifs_oplock_break_put(struct cifsFileInfo *cfile); 801void cifs_oplock_break_put(struct cifsFileInfo *cfile);
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h
index de36b09763a8..b5c8cc5d7a7f 100644
--- a/fs/cifs/cifspdu.h
+++ b/fs/cifs/cifspdu.h
@@ -23,6 +23,7 @@
23#define _CIFSPDU_H 23#define _CIFSPDU_H
24 24
25#include <net/sock.h> 25#include <net/sock.h>
26#include <asm/unaligned.h>
26#include "smbfsctl.h" 27#include "smbfsctl.h"
27 28
28#ifdef CONFIG_CIFS_WEAK_PW_HASH 29#ifdef CONFIG_CIFS_WEAK_PW_HASH
@@ -50,6 +51,7 @@
50#define SMB_COM_SETATTR 0x09 /* trivial response */ 51#define SMB_COM_SETATTR 0x09 /* trivial response */
51#define SMB_COM_LOCKING_ANDX 0x24 /* trivial response */ 52#define SMB_COM_LOCKING_ANDX 0x24 /* trivial response */
52#define SMB_COM_COPY 0x29 /* trivial rsp, fail filename ignrd*/ 53#define SMB_COM_COPY 0x29 /* trivial rsp, fail filename ignrd*/
54#define SMB_COM_ECHO 0x2B /* echo request */
53#define SMB_COM_OPEN_ANDX 0x2D /* Legacy open for old servers */ 55#define SMB_COM_OPEN_ANDX 0x2D /* Legacy open for old servers */
54#define SMB_COM_READ_ANDX 0x2E 56#define SMB_COM_READ_ANDX 0x2E
55#define SMB_COM_WRITE_ANDX 0x2F 57#define SMB_COM_WRITE_ANDX 0x2F
@@ -425,11 +427,49 @@ struct smb_hdr {
425 __u16 Mid; 427 __u16 Mid;
426 __u8 WordCount; 428 __u8 WordCount;
427} __attribute__((packed)); 429} __attribute__((packed));
428/* given a pointer to an smb_hdr retrieve the value of byte count */ 430
429#define BCC(smb_var) (*(__u16 *)((char *)(smb_var) + sizeof(struct smb_hdr) + (2 * (smb_var)->WordCount))) 431/* given a pointer to an smb_hdr retrieve a char pointer to the byte count */
430#define BCC_LE(smb_var) (*(__le16 *)((char *)(smb_var) + sizeof(struct smb_hdr) + (2 * (smb_var)->WordCount))) 432#define BCC(smb_var) ((unsigned char *)(smb_var) + sizeof(struct smb_hdr) + \
433 (2 * (smb_var)->WordCount))
434
431/* given a pointer to an smb_hdr retrieve the pointer to the byte area */ 435/* given a pointer to an smb_hdr retrieve the pointer to the byte area */
432#define pByteArea(smb_var) ((unsigned char *)(smb_var) + sizeof(struct smb_hdr) + (2 * (smb_var)->WordCount) + 2) 436#define pByteArea(smb_var) (BCC(smb_var) + 2)
437
438/* get the converted ByteCount for a SMB packet and return it */
439static inline __u16
440get_bcc(struct smb_hdr *hdr)
441{
442 __u16 *bc_ptr = (__u16 *)BCC(hdr);
443
444 return get_unaligned(bc_ptr);
445}
446
447/* get the unconverted ByteCount for a SMB packet and return it */
448static inline __u16
449get_bcc_le(struct smb_hdr *hdr)
450{
451 __le16 *bc_ptr = (__le16 *)BCC(hdr);
452
453 return get_unaligned_le16(bc_ptr);
454}
455
456/* set the ByteCount for a SMB packet in host-byte order */
457static inline void
458put_bcc(__u16 count, struct smb_hdr *hdr)
459{
460 __u16 *bc_ptr = (__u16 *)BCC(hdr);
461
462 put_unaligned(count, bc_ptr);
463}
464
465/* set the ByteCount for a SMB packet in little-endian */
466static inline void
467put_bcc_le(__u16 count, struct smb_hdr *hdr)
468{
469 __le16 *bc_ptr = (__le16 *)BCC(hdr);
470
471 put_unaligned_le16(count, bc_ptr);
472}
433 473
434/* 474/*
435 * Computer Name Length (since Netbios name was length 16 with last byte 0x20) 475 * Computer Name Length (since Netbios name was length 16 with last byte 0x20)
@@ -760,6 +800,20 @@ typedef struct smb_com_tconx_rsp_ext {
760 * 800 *
761 */ 801 */
762 802
803typedef struct smb_com_echo_req {
804 struct smb_hdr hdr;
805 __le16 EchoCount;
806 __le16 ByteCount;
807 char Data[1];
808} __attribute__((packed)) ECHO_REQ;
809
810typedef struct smb_com_echo_rsp {
811 struct smb_hdr hdr;
812 __le16 SequenceNumber;
813 __le16 ByteCount;
814 char Data[1];
815} __attribute__((packed)) ECHO_RSP;
816
763typedef struct smb_com_logoff_andx_req { 817typedef struct smb_com_logoff_andx_req {
764 struct smb_hdr hdr; /* wct = 2 */ 818 struct smb_hdr hdr; /* wct = 2 */
765 __u8 AndXCommand; 819 __u8 AndXCommand;
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index e6d1481b16c1..982895fa7615 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -61,6 +61,12 @@ extern char *cifs_compose_mount_options(const char *sb_mountdata,
61 const char *fullpath, const struct dfs_info3_param *ref, 61 const char *fullpath, const struct dfs_info3_param *ref,
62 char **devname); 62 char **devname);
63/* extern void renew_parental_timestamps(struct dentry *direntry);*/ 63/* extern void renew_parental_timestamps(struct dentry *direntry);*/
64extern struct mid_q_entry *AllocMidQEntry(const struct smb_hdr *smb_buffer,
65 struct TCP_Server_Info *server);
66extern void DeleteMidQEntry(struct mid_q_entry *midEntry);
67extern int cifs_call_async(struct TCP_Server_Info *server,
68 struct smb_hdr *in_buf, mid_callback_t *callback,
69 void *cbdata);
64extern int SendReceive(const unsigned int /* xid */ , struct cifsSesInfo *, 70extern int SendReceive(const unsigned int /* xid */ , struct cifsSesInfo *,
65 struct smb_hdr * /* input */ , 71 struct smb_hdr * /* input */ ,
66 struct smb_hdr * /* out */ , 72 struct smb_hdr * /* out */ ,
@@ -347,12 +353,13 @@ extern int CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
347 const __u16 netfid, const __u64 len, 353 const __u16 netfid, const __u64 len,
348 const __u64 offset, const __u32 numUnlock, 354 const __u64 offset, const __u32 numUnlock,
349 const __u32 numLock, const __u8 lockType, 355 const __u32 numLock, const __u8 lockType,
350 const bool waitFlag); 356 const bool waitFlag, const __u8 oplock_level);
351extern int CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, 357extern int CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon,
352 const __u16 smb_file_id, const int get_flag, 358 const __u16 smb_file_id, const int get_flag,
353 const __u64 len, struct file_lock *, 359 const __u64 len, struct file_lock *,
354 const __u16 lock_type, const bool waitFlag); 360 const __u16 lock_type, const bool waitFlag);
355extern int CIFSSMBTDis(const int xid, struct cifsTconInfo *tcon); 361extern int CIFSSMBTDis(const int xid, struct cifsTconInfo *tcon);
362extern int CIFSSMBEcho(struct TCP_Server_Info *server);
356extern int CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses); 363extern int CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses);
357 364
358extern struct cifsSesInfo *sesInfoAlloc(void); 365extern struct cifsSesInfo *sesInfoAlloc(void);
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 2f6795e524d3..3106f5e5c633 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -331,37 +331,35 @@ smb_init_no_reconnect(int smb_command, int wct, struct cifsTconInfo *tcon,
331 331
332static int validate_t2(struct smb_t2_rsp *pSMB) 332static int validate_t2(struct smb_t2_rsp *pSMB)
333{ 333{
334 int rc = -EINVAL; 334 unsigned int total_size;
335 int total_size; 335
336 char *pBCC; 336 /* check for plausible wct */
337 if (pSMB->hdr.WordCount < 10)
338 goto vt2_err;
337 339
338 /* check for plausible wct, bcc and t2 data and parm sizes */
339 /* check for parm and data offset going beyond end of smb */ 340 /* check for parm and data offset going beyond end of smb */
340 if (pSMB->hdr.WordCount >= 10) { 341 if (get_unaligned_le16(&pSMB->t2_rsp.ParameterOffset) > 1024 ||
341 if ((le16_to_cpu(pSMB->t2_rsp.ParameterOffset) <= 1024) && 342 get_unaligned_le16(&pSMB->t2_rsp.DataOffset) > 1024)
342 (le16_to_cpu(pSMB->t2_rsp.DataOffset) <= 1024)) { 343 goto vt2_err;
343 /* check that bcc is at least as big as parms + data */ 344
344 /* check that bcc is less than negotiated smb buffer */ 345 /* check that bcc is at least as big as parms + data */
345 total_size = le16_to_cpu(pSMB->t2_rsp.ParameterCount); 346 /* check that bcc is less than negotiated smb buffer */
346 if (total_size < 512) { 347 total_size = get_unaligned_le16(&pSMB->t2_rsp.ParameterCount);
347 total_size += 348 if (total_size >= 512)
348 le16_to_cpu(pSMB->t2_rsp.DataCount); 349 goto vt2_err;
349 /* BCC le converted in SendReceive */ 350
350 pBCC = (pSMB->hdr.WordCount * 2) + 351 total_size += get_unaligned_le16(&pSMB->t2_rsp.DataCount);
351 sizeof(struct smb_hdr) + 352 if (total_size > get_bcc(&pSMB->hdr) ||
352 (char *)pSMB; 353 total_size >= CIFSMaxBufSize + MAX_CIFS_HDR_SIZE)
353 if ((total_size <= (*(u16 *)pBCC)) && 354 goto vt2_err;
354 (total_size < 355
355 CIFSMaxBufSize+MAX_CIFS_HDR_SIZE)) { 356 return 0;
356 return 0; 357vt2_err:
357 }
358 }
359 }
360 }
361 cifs_dump_mem("Invalid transact2 SMB: ", (char *)pSMB, 358 cifs_dump_mem("Invalid transact2 SMB: ", (char *)pSMB,
362 sizeof(struct smb_t2_rsp) + 16); 359 sizeof(struct smb_t2_rsp) + 16);
363 return rc; 360 return -EINVAL;
364} 361}
362
365int 363int
366CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) 364CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
367{ 365{
@@ -452,7 +450,6 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
452 server->maxBuf = min((__u32)le16_to_cpu(rsp->MaxBufSize), 450 server->maxBuf = min((__u32)le16_to_cpu(rsp->MaxBufSize),
453 (__u32)CIFSMaxBufSize + MAX_CIFS_HDR_SIZE); 451 (__u32)CIFSMaxBufSize + MAX_CIFS_HDR_SIZE);
454 server->max_vcs = le16_to_cpu(rsp->MaxNumberVcs); 452 server->max_vcs = le16_to_cpu(rsp->MaxNumberVcs);
455 GETU32(server->sessid) = le32_to_cpu(rsp->SessionKey);
456 /* even though we do not use raw we might as well set this 453 /* even though we do not use raw we might as well set this
457 accurately, in case we ever find a need for it */ 454 accurately, in case we ever find a need for it */
458 if ((le16_to_cpu(rsp->RawMode) & RAW_ENABLE) == RAW_ENABLE) { 455 if ((le16_to_cpu(rsp->RawMode) & RAW_ENABLE) == RAW_ENABLE) {
@@ -566,7 +563,6 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
566 (__u32) CIFSMaxBufSize + MAX_CIFS_HDR_SIZE); 563 (__u32) CIFSMaxBufSize + MAX_CIFS_HDR_SIZE);
567 server->max_rw = le32_to_cpu(pSMBr->MaxRawSize); 564 server->max_rw = le32_to_cpu(pSMBr->MaxRawSize);
568 cFYI(DBG2, "Max buf = %d", ses->server->maxBuf); 565 cFYI(DBG2, "Max buf = %d", ses->server->maxBuf);
569 GETU32(ses->server->sessid) = le32_to_cpu(pSMBr->SessionKey);
570 server->capabilities = le32_to_cpu(pSMBr->Capabilities); 566 server->capabilities = le32_to_cpu(pSMBr->Capabilities);
571 server->timeAdj = (int)(__s16)le16_to_cpu(pSMBr->ServerTimeZone); 567 server->timeAdj = (int)(__s16)le16_to_cpu(pSMBr->ServerTimeZone);
572 server->timeAdj *= 60; 568 server->timeAdj *= 60;
@@ -706,6 +702,53 @@ CIFSSMBTDis(const int xid, struct cifsTconInfo *tcon)
706 return rc; 702 return rc;
707} 703}
708 704
705/*
706 * This is a no-op for now. We're not really interested in the reply, but
707 * rather in the fact that the server sent one and that server->lstrp
708 * gets updated.
709 *
710 * FIXME: maybe we should consider checking that the reply matches request?
711 */
712static void
713cifs_echo_callback(struct mid_q_entry *mid)
714{
715 struct TCP_Server_Info *server = mid->callback_data;
716
717 DeleteMidQEntry(mid);
718 atomic_dec(&server->inFlight);
719 wake_up(&server->request_q);
720}
721
722int
723CIFSSMBEcho(struct TCP_Server_Info *server)
724{
725 ECHO_REQ *smb;
726 int rc = 0;
727
728 cFYI(1, "In echo request");
729
730 rc = small_smb_init(SMB_COM_ECHO, 0, NULL, (void **)&smb);
731 if (rc)
732 return rc;
733
734 /* set up echo request */
735 smb->hdr.Tid = cpu_to_le16(0xffff);
736 smb->hdr.WordCount = 1;
737 put_unaligned_le16(1, &smb->EchoCount);
738 put_bcc_le(1, &smb->hdr);
739 smb->Data[0] = 'a';
740 smb->hdr.smb_buf_length += 3;
741
742 rc = cifs_call_async(server, (struct smb_hdr *)smb,
743 cifs_echo_callback, server);
744 if (rc)
745 cFYI(1, "Echo request failed: %d", rc);
746
747 cifs_small_buf_release(smb);
748
749 return rc;
750}
751
709int 752int
710CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses) 753CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses)
711{ 754{
@@ -1193,7 +1236,7 @@ OldOpenRetry:
1193 pSMB->ByteCount = cpu_to_le16(count); 1236 pSMB->ByteCount = cpu_to_le16(count);
1194 /* long_op set to 1 to allow for oplock break timeouts */ 1237 /* long_op set to 1 to allow for oplock break timeouts */
1195 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 1238 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
1196 (struct smb_hdr *)pSMBr, &bytes_returned, CIFS_LONG_OP); 1239 (struct smb_hdr *)pSMBr, &bytes_returned, 0);
1197 cifs_stats_inc(&tcon->num_opens); 1240 cifs_stats_inc(&tcon->num_opens);
1198 if (rc) { 1241 if (rc) {
1199 cFYI(1, "Error in Open = %d", rc); 1242 cFYI(1, "Error in Open = %d", rc);
@@ -1306,7 +1349,7 @@ openRetry:
1306 pSMB->ByteCount = cpu_to_le16(count); 1349 pSMB->ByteCount = cpu_to_le16(count);
1307 /* long_op set to 1 to allow for oplock break timeouts */ 1350 /* long_op set to 1 to allow for oplock break timeouts */
1308 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 1351 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
1309 (struct smb_hdr *)pSMBr, &bytes_returned, CIFS_LONG_OP); 1352 (struct smb_hdr *)pSMBr, &bytes_returned, 0);
1310 cifs_stats_inc(&tcon->num_opens); 1353 cifs_stats_inc(&tcon->num_opens);
1311 if (rc) { 1354 if (rc) {
1312 cFYI(1, "Error in Open = %d", rc); 1355 cFYI(1, "Error in Open = %d", rc);
@@ -1388,7 +1431,7 @@ CIFSSMBRead(const int xid, struct cifsTconInfo *tcon, const int netfid,
1388 iov[0].iov_base = (char *)pSMB; 1431 iov[0].iov_base = (char *)pSMB;
1389 iov[0].iov_len = pSMB->hdr.smb_buf_length + 4; 1432 iov[0].iov_len = pSMB->hdr.smb_buf_length + 4;
1390 rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovecs */, 1433 rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovecs */,
1391 &resp_buf_type, CIFS_STD_OP | CIFS_LOG_ERROR); 1434 &resp_buf_type, CIFS_LOG_ERROR);
1392 cifs_stats_inc(&tcon->num_reads); 1435 cifs_stats_inc(&tcon->num_reads);
1393 pSMBr = (READ_RSP *)iov[0].iov_base; 1436 pSMBr = (READ_RSP *)iov[0].iov_base;
1394 if (rc) { 1437 if (rc) {
@@ -1663,7 +1706,8 @@ int
1663CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, 1706CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
1664 const __u16 smb_file_id, const __u64 len, 1707 const __u16 smb_file_id, const __u64 len,
1665 const __u64 offset, const __u32 numUnlock, 1708 const __u64 offset, const __u32 numUnlock,
1666 const __u32 numLock, const __u8 lockType, const bool waitFlag) 1709 const __u32 numLock, const __u8 lockType,
1710 const bool waitFlag, const __u8 oplock_level)
1667{ 1711{
1668 int rc = 0; 1712 int rc = 0;
1669 LOCK_REQ *pSMB = NULL; 1713 LOCK_REQ *pSMB = NULL;
@@ -1691,6 +1735,7 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
1691 pSMB->NumberOfLocks = cpu_to_le16(numLock); 1735 pSMB->NumberOfLocks = cpu_to_le16(numLock);
1692 pSMB->NumberOfUnlocks = cpu_to_le16(numUnlock); 1736 pSMB->NumberOfUnlocks = cpu_to_le16(numUnlock);
1693 pSMB->LockType = lockType; 1737 pSMB->LockType = lockType;
1738 pSMB->OplockLevel = oplock_level;
1694 pSMB->AndXCommand = 0xFF; /* none */ 1739 pSMB->AndXCommand = 0xFF; /* none */
1695 pSMB->Fid = smb_file_id; /* netfid stays le */ 1740 pSMB->Fid = smb_file_id; /* netfid stays le */
1696 1741
@@ -3087,7 +3132,7 @@ CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, __u16 fid,
3087 iov[0].iov_len = pSMB->hdr.smb_buf_length + 4; 3132 iov[0].iov_len = pSMB->hdr.smb_buf_length + 4;
3088 3133
3089 rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovec */, &buf_type, 3134 rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovec */, &buf_type,
3090 CIFS_STD_OP); 3135 0);
3091 cifs_stats_inc(&tcon->num_acl_get); 3136 cifs_stats_inc(&tcon->num_acl_get);
3092 if (rc) { 3137 if (rc) {
3093 cFYI(1, "Send error in QuerySecDesc = %d", rc); 3138 cFYI(1, "Send error in QuerySecDesc = %d", rc);
@@ -5562,7 +5607,7 @@ QAllEAsRetry:
5562 } 5607 }
5563 5608
5564 /* make sure list_len doesn't go past end of SMB */ 5609 /* make sure list_len doesn't go past end of SMB */
5565 end_of_smb = (char *)pByteArea(&pSMBr->hdr) + BCC(&pSMBr->hdr); 5610 end_of_smb = (char *)pByteArea(&pSMBr->hdr) + get_bcc(&pSMBr->hdr);
5566 if ((char *)ea_response_data + list_len > end_of_smb) { 5611 if ((char *)ea_response_data + list_len > end_of_smb) {
5567 cFYI(1, "EA list appears to go beyond SMB"); 5612 cFYI(1, "EA list appears to go beyond SMB");
5568 rc = -EIO; 5613 rc = -EIO;
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 9f59887badd2..18d3c7724d6e 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -52,6 +52,9 @@
52#define CIFS_PORT 445 52#define CIFS_PORT 445
53#define RFC1001_PORT 139 53#define RFC1001_PORT 139
54 54
55/* SMB echo "timeout" -- FIXME: tunable? */
56#define SMB_ECHO_INTERVAL (60 * HZ)
57
55extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, 58extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8,
56 unsigned char *p24); 59 unsigned char *p24);
57 60
@@ -152,6 +155,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
152 155
153 /* before reconnecting the tcp session, mark the smb session (uid) 156 /* before reconnecting the tcp session, mark the smb session (uid)
154 and the tid bad so they are not used until reconnected */ 157 and the tid bad so they are not used until reconnected */
158 cFYI(1, "%s: marking sessions and tcons for reconnect", __func__);
155 spin_lock(&cifs_tcp_ses_lock); 159 spin_lock(&cifs_tcp_ses_lock);
156 list_for_each(tmp, &server->smb_ses_list) { 160 list_for_each(tmp, &server->smb_ses_list) {
157 ses = list_entry(tmp, struct cifsSesInfo, smb_ses_list); 161 ses = list_entry(tmp, struct cifsSesInfo, smb_ses_list);
@@ -163,7 +167,9 @@ cifs_reconnect(struct TCP_Server_Info *server)
163 } 167 }
164 } 168 }
165 spin_unlock(&cifs_tcp_ses_lock); 169 spin_unlock(&cifs_tcp_ses_lock);
170
166 /* do not want to be sending data on a socket we are freeing */ 171 /* do not want to be sending data on a socket we are freeing */
172 cFYI(1, "%s: tearing down socket", __func__);
167 mutex_lock(&server->srv_mutex); 173 mutex_lock(&server->srv_mutex);
168 if (server->ssocket) { 174 if (server->ssocket) {
169 cFYI(1, "State: 0x%x Flags: 0x%lx", server->ssocket->state, 175 cFYI(1, "State: 0x%x Flags: 0x%lx", server->ssocket->state,
@@ -180,22 +186,20 @@ cifs_reconnect(struct TCP_Server_Info *server)
180 kfree(server->session_key.response); 186 kfree(server->session_key.response);
181 server->session_key.response = NULL; 187 server->session_key.response = NULL;
182 server->session_key.len = 0; 188 server->session_key.len = 0;
189 server->lstrp = jiffies;
190 mutex_unlock(&server->srv_mutex);
183 191
192 /* mark submitted MIDs for retry and issue callback */
193 cFYI(1, "%s: issuing mid callbacks", __func__);
184 spin_lock(&GlobalMid_Lock); 194 spin_lock(&GlobalMid_Lock);
185 list_for_each(tmp, &server->pending_mid_q) { 195 list_for_each_safe(tmp, tmp2, &server->pending_mid_q) {
186 mid_entry = list_entry(tmp, struct 196 mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
187 mid_q_entry, 197 if (mid_entry->midState == MID_REQUEST_SUBMITTED)
188 qhead);
189 if (mid_entry->midState == MID_REQUEST_SUBMITTED) {
190 /* Mark other intransit requests as needing
191 retry so we do not immediately mark the
192 session bad again (ie after we reconnect
193 below) as they timeout too */
194 mid_entry->midState = MID_RETRY_NEEDED; 198 mid_entry->midState = MID_RETRY_NEEDED;
195 } 199 list_del_init(&mid_entry->qhead);
200 mid_entry->callback(mid_entry);
196 } 201 }
197 spin_unlock(&GlobalMid_Lock); 202 spin_unlock(&GlobalMid_Lock);
198 mutex_unlock(&server->srv_mutex);
199 203
200 while ((server->tcpStatus != CifsExiting) && 204 while ((server->tcpStatus != CifsExiting) &&
201 (server->tcpStatus != CifsGood)) { 205 (server->tcpStatus != CifsGood)) {
@@ -212,10 +216,9 @@ cifs_reconnect(struct TCP_Server_Info *server)
212 if (server->tcpStatus != CifsExiting) 216 if (server->tcpStatus != CifsExiting)
213 server->tcpStatus = CifsGood; 217 server->tcpStatus = CifsGood;
214 spin_unlock(&GlobalMid_Lock); 218 spin_unlock(&GlobalMid_Lock);
215 /* atomic_set(&server->inFlight,0);*/
216 wake_up(&server->response_q);
217 } 219 }
218 } 220 }
221
219 return rc; 222 return rc;
220} 223}
221 224
@@ -229,9 +232,8 @@ cifs_reconnect(struct TCP_Server_Info *server)
229static int check2ndT2(struct smb_hdr *pSMB, unsigned int maxBufSize) 232static int check2ndT2(struct smb_hdr *pSMB, unsigned int maxBufSize)
230{ 233{
231 struct smb_t2_rsp *pSMBt; 234 struct smb_t2_rsp *pSMBt;
232 int total_data_size;
233 int data_in_this_rsp;
234 int remaining; 235 int remaining;
236 __u16 total_data_size, data_in_this_rsp;
235 237
236 if (pSMB->Command != SMB_COM_TRANSACTION2) 238 if (pSMB->Command != SMB_COM_TRANSACTION2)
237 return 0; 239 return 0;
@@ -245,8 +247,8 @@ static int check2ndT2(struct smb_hdr *pSMB, unsigned int maxBufSize)
245 247
246 pSMBt = (struct smb_t2_rsp *)pSMB; 248 pSMBt = (struct smb_t2_rsp *)pSMB;
247 249
248 total_data_size = le16_to_cpu(pSMBt->t2_rsp.TotalDataCount); 250 total_data_size = get_unaligned_le16(&pSMBt->t2_rsp.TotalDataCount);
249 data_in_this_rsp = le16_to_cpu(pSMBt->t2_rsp.DataCount); 251 data_in_this_rsp = get_unaligned_le16(&pSMBt->t2_rsp.DataCount);
250 252
251 remaining = total_data_size - data_in_this_rsp; 253 remaining = total_data_size - data_in_this_rsp;
252 254
@@ -272,21 +274,18 @@ static int coalesce_t2(struct smb_hdr *psecond, struct smb_hdr *pTargetSMB)
272{ 274{
273 struct smb_t2_rsp *pSMB2 = (struct smb_t2_rsp *)psecond; 275 struct smb_t2_rsp *pSMB2 = (struct smb_t2_rsp *)psecond;
274 struct smb_t2_rsp *pSMBt = (struct smb_t2_rsp *)pTargetSMB; 276 struct smb_t2_rsp *pSMBt = (struct smb_t2_rsp *)pTargetSMB;
275 int total_data_size;
276 int total_in_buf;
277 int remaining;
278 int total_in_buf2;
279 char *data_area_of_target; 277 char *data_area_of_target;
280 char *data_area_of_buf2; 278 char *data_area_of_buf2;
281 __u16 byte_count; 279 int remaining;
280 __u16 byte_count, total_data_size, total_in_buf, total_in_buf2;
282 281
283 total_data_size = le16_to_cpu(pSMBt->t2_rsp.TotalDataCount); 282 total_data_size = get_unaligned_le16(&pSMBt->t2_rsp.TotalDataCount);
284 283
285 if (total_data_size != le16_to_cpu(pSMB2->t2_rsp.TotalDataCount)) { 284 if (total_data_size !=
285 get_unaligned_le16(&pSMB2->t2_rsp.TotalDataCount))
286 cFYI(1, "total data size of primary and secondary t2 differ"); 286 cFYI(1, "total data size of primary and secondary t2 differ");
287 }
288 287
289 total_in_buf = le16_to_cpu(pSMBt->t2_rsp.DataCount); 288 total_in_buf = get_unaligned_le16(&pSMBt->t2_rsp.DataCount);
290 289
291 remaining = total_data_size - total_in_buf; 290 remaining = total_data_size - total_in_buf;
292 291
@@ -296,28 +295,28 @@ static int coalesce_t2(struct smb_hdr *psecond, struct smb_hdr *pTargetSMB)
296 if (remaining == 0) /* nothing to do, ignore */ 295 if (remaining == 0) /* nothing to do, ignore */
297 return 0; 296 return 0;
298 297
299 total_in_buf2 = le16_to_cpu(pSMB2->t2_rsp.DataCount); 298 total_in_buf2 = get_unaligned_le16(&pSMB2->t2_rsp.DataCount);
300 if (remaining < total_in_buf2) { 299 if (remaining < total_in_buf2) {
301 cFYI(1, "transact2 2nd response contains too much data"); 300 cFYI(1, "transact2 2nd response contains too much data");
302 } 301 }
303 302
304 /* find end of first SMB data area */ 303 /* find end of first SMB data area */
305 data_area_of_target = (char *)&pSMBt->hdr.Protocol + 304 data_area_of_target = (char *)&pSMBt->hdr.Protocol +
306 le16_to_cpu(pSMBt->t2_rsp.DataOffset); 305 get_unaligned_le16(&pSMBt->t2_rsp.DataOffset);
307 /* validate target area */ 306 /* validate target area */
308 307
309 data_area_of_buf2 = (char *) &pSMB2->hdr.Protocol + 308 data_area_of_buf2 = (char *)&pSMB2->hdr.Protocol +
310 le16_to_cpu(pSMB2->t2_rsp.DataOffset); 309 get_unaligned_le16(&pSMB2->t2_rsp.DataOffset);
311 310
312 data_area_of_target += total_in_buf; 311 data_area_of_target += total_in_buf;
313 312
314 /* copy second buffer into end of first buffer */ 313 /* copy second buffer into end of first buffer */
315 memcpy(data_area_of_target, data_area_of_buf2, total_in_buf2); 314 memcpy(data_area_of_target, data_area_of_buf2, total_in_buf2);
316 total_in_buf += total_in_buf2; 315 total_in_buf += total_in_buf2;
317 pSMBt->t2_rsp.DataCount = cpu_to_le16(total_in_buf); 316 put_unaligned_le16(total_in_buf, &pSMBt->t2_rsp.DataCount);
318 byte_count = le16_to_cpu(BCC_LE(pTargetSMB)); 317 byte_count = get_bcc_le(pTargetSMB);
319 byte_count += total_in_buf2; 318 byte_count += total_in_buf2;
320 BCC_LE(pTargetSMB) = cpu_to_le16(byte_count); 319 put_bcc_le(byte_count, pTargetSMB);
321 320
322 byte_count = pTargetSMB->smb_buf_length; 321 byte_count = pTargetSMB->smb_buf_length;
323 byte_count += total_in_buf2; 322 byte_count += total_in_buf2;
@@ -331,7 +330,26 @@ static int coalesce_t2(struct smb_hdr *psecond, struct smb_hdr *pTargetSMB)
331 return 0; /* we are done */ 330 return 0; /* we are done */
332 } else /* more responses to go */ 331 } else /* more responses to go */
333 return 1; 332 return 1;
333}
334
335static void
336cifs_echo_request(struct work_struct *work)
337{
338 int rc;
339 struct TCP_Server_Info *server = container_of(work,
340 struct TCP_Server_Info, echo.work);
341
342 /* no need to ping if we got a response recently */
343 if (time_before(jiffies, server->lstrp + SMB_ECHO_INTERVAL - HZ))
344 goto requeue_echo;
334 345
346 rc = CIFSSMBEcho(server);
347 if (rc)
348 cFYI(1, "Unable to send echo request to server: %s",
349 server->hostname);
350
351requeue_echo:
352 queue_delayed_work(system_nrt_wq, &server->echo, SMB_ECHO_INTERVAL);
335} 353}
336 354
337static int 355static int
@@ -345,8 +363,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
345 struct msghdr smb_msg; 363 struct msghdr smb_msg;
346 struct kvec iov; 364 struct kvec iov;
347 struct socket *csocket = server->ssocket; 365 struct socket *csocket = server->ssocket;
348 struct list_head *tmp; 366 struct list_head *tmp, *tmp2;
349 struct cifsSesInfo *ses;
350 struct task_struct *task_to_wake = NULL; 367 struct task_struct *task_to_wake = NULL;
351 struct mid_q_entry *mid_entry; 368 struct mid_q_entry *mid_entry;
352 char temp; 369 char temp;
@@ -399,7 +416,20 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
399 smb_msg.msg_control = NULL; 416 smb_msg.msg_control = NULL;
400 smb_msg.msg_controllen = 0; 417 smb_msg.msg_controllen = 0;
401 pdu_length = 4; /* enough to get RFC1001 header */ 418 pdu_length = 4; /* enough to get RFC1001 header */
419
402incomplete_rcv: 420incomplete_rcv:
421 if (echo_retries > 0 &&
422 time_after(jiffies, server->lstrp +
423 (echo_retries * SMB_ECHO_INTERVAL))) {
424 cERROR(1, "Server %s has not responded in %d seconds. "
425 "Reconnecting...", server->hostname,
426 (echo_retries * SMB_ECHO_INTERVAL / HZ));
427 cifs_reconnect(server);
428 csocket = server->ssocket;
429 wake_up(&server->response_q);
430 continue;
431 }
432
403 length = 433 length =
404 kernel_recvmsg(csocket, &smb_msg, 434 kernel_recvmsg(csocket, &smb_msg,
405 &iov, 1, pdu_length, 0 /* BB other flags? */); 435 &iov, 1, pdu_length, 0 /* BB other flags? */);
@@ -559,10 +589,11 @@ incomplete_rcv:
559 continue; 589 continue;
560 } 590 }
561 591
592 mid_entry = NULL;
593 server->lstrp = jiffies;
562 594
563 task_to_wake = NULL;
564 spin_lock(&GlobalMid_Lock); 595 spin_lock(&GlobalMid_Lock);
565 list_for_each(tmp, &server->pending_mid_q) { 596 list_for_each_safe(tmp, tmp2, &server->pending_mid_q) {
566 mid_entry = list_entry(tmp, struct mid_q_entry, qhead); 597 mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
567 598
568 if ((mid_entry->mid == smb_buffer->Mid) && 599 if ((mid_entry->mid == smb_buffer->Mid) &&
@@ -603,20 +634,19 @@ incomplete_rcv:
603 mid_entry->resp_buf = smb_buffer; 634 mid_entry->resp_buf = smb_buffer;
604 mid_entry->largeBuf = isLargeBuf; 635 mid_entry->largeBuf = isLargeBuf;
605multi_t2_fnd: 636multi_t2_fnd:
606 task_to_wake = mid_entry->tsk;
607 mid_entry->midState = MID_RESPONSE_RECEIVED; 637 mid_entry->midState = MID_RESPONSE_RECEIVED;
638 list_del_init(&mid_entry->qhead);
639 mid_entry->callback(mid_entry);
608#ifdef CONFIG_CIFS_STATS2 640#ifdef CONFIG_CIFS_STATS2
609 mid_entry->when_received = jiffies; 641 mid_entry->when_received = jiffies;
610#endif 642#endif
611 /* so we do not time out requests to server
612 which is still responding (since server could
613 be busy but not dead) */
614 server->lstrp = jiffies;
615 break; 643 break;
616 } 644 }
645 mid_entry = NULL;
617 } 646 }
618 spin_unlock(&GlobalMid_Lock); 647 spin_unlock(&GlobalMid_Lock);
619 if (task_to_wake) { 648
649 if (mid_entry != NULL) {
620 /* Was previous buf put in mpx struct for multi-rsp? */ 650 /* Was previous buf put in mpx struct for multi-rsp? */
621 if (!isMultiRsp) { 651 if (!isMultiRsp) {
622 /* smb buffer will be freed by user thread */ 652 /* smb buffer will be freed by user thread */
@@ -625,11 +655,10 @@ multi_t2_fnd:
625 else 655 else
626 smallbuf = NULL; 656 smallbuf = NULL;
627 } 657 }
628 wake_up_process(task_to_wake);
629 } else if (!is_valid_oplock_break(smb_buffer, server) && 658 } else if (!is_valid_oplock_break(smb_buffer, server) &&
630 !isMultiRsp) { 659 !isMultiRsp) {
631 cERROR(1, "No task to wake, unknown frame received! " 660 cERROR(1, "No task to wake, unknown frame received! "
632 "NumMids %d", midCount.counter); 661 "NumMids %d", atomic_read(&midCount));
633 cifs_dump_mem("Received Data is: ", (char *)smb_buffer, 662 cifs_dump_mem("Received Data is: ", (char *)smb_buffer,
634 sizeof(struct smb_hdr)); 663 sizeof(struct smb_hdr));
635#ifdef CONFIG_CIFS_DEBUG2 664#ifdef CONFIG_CIFS_DEBUG2
@@ -677,44 +706,16 @@ multi_t2_fnd:
677 if (smallbuf) /* no sense logging a debug message if NULL */ 706 if (smallbuf) /* no sense logging a debug message if NULL */
678 cifs_small_buf_release(smallbuf); 707 cifs_small_buf_release(smallbuf);
679 708
680 /* 709 if (!list_empty(&server->pending_mid_q)) {
681 * BB: we shouldn't have to do any of this. It shouldn't be
682 * possible to exit from the thread with active SMB sessions
683 */
684 spin_lock(&cifs_tcp_ses_lock);
685 if (list_empty(&server->pending_mid_q)) {
686 /* loop through server session structures attached to this and
687 mark them dead */
688 list_for_each(tmp, &server->smb_ses_list) {
689 ses = list_entry(tmp, struct cifsSesInfo,
690 smb_ses_list);
691 ses->status = CifsExiting;
692 ses->server = NULL;
693 }
694 spin_unlock(&cifs_tcp_ses_lock);
695 } else {
696 /* although we can not zero the server struct pointer yet,
697 since there are active requests which may depnd on them,
698 mark the corresponding SMB sessions as exiting too */
699 list_for_each(tmp, &server->smb_ses_list) {
700 ses = list_entry(tmp, struct cifsSesInfo,
701 smb_ses_list);
702 ses->status = CifsExiting;
703 }
704
705 spin_lock(&GlobalMid_Lock); 710 spin_lock(&GlobalMid_Lock);
706 list_for_each(tmp, &server->pending_mid_q) { 711 list_for_each_safe(tmp, tmp2, &server->pending_mid_q) {
707 mid_entry = list_entry(tmp, struct mid_q_entry, qhead); 712 mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
708 if (mid_entry->midState == MID_REQUEST_SUBMITTED) { 713 cFYI(1, "Clearing Mid 0x%x - issuing callback",
709 cFYI(1, "Clearing Mid 0x%x - waking up ",
710 mid_entry->mid); 714 mid_entry->mid);
711 task_to_wake = mid_entry->tsk; 715 list_del_init(&mid_entry->qhead);
712 if (task_to_wake) 716 mid_entry->callback(mid_entry);
713 wake_up_process(task_to_wake);
714 }
715 } 717 }
716 spin_unlock(&GlobalMid_Lock); 718 spin_unlock(&GlobalMid_Lock);
717 spin_unlock(&cifs_tcp_ses_lock);
718 /* 1/8th of sec is more than enough time for them to exit */ 719 /* 1/8th of sec is more than enough time for them to exit */
719 msleep(125); 720 msleep(125);
720 } 721 }
@@ -732,18 +733,6 @@ multi_t2_fnd:
732 coming home not much else we can do but free the memory */ 733 coming home not much else we can do but free the memory */
733 } 734 }
734 735
735 /* last chance to mark ses pointers invalid
736 if there are any pointing to this (e.g
737 if a crazy root user tried to kill cifsd
738 kernel thread explicitly this might happen) */
739 /* BB: This shouldn't be necessary, see above */
740 spin_lock(&cifs_tcp_ses_lock);
741 list_for_each(tmp, &server->smb_ses_list) {
742 ses = list_entry(tmp, struct cifsSesInfo, smb_ses_list);
743 ses->server = NULL;
744 }
745 spin_unlock(&cifs_tcp_ses_lock);
746
747 kfree(server->hostname); 736 kfree(server->hostname);
748 task_to_wake = xchg(&server->tsk, NULL); 737 task_to_wake = xchg(&server->tsk, NULL);
749 kfree(server); 738 kfree(server);
@@ -1612,6 +1601,8 @@ cifs_put_tcp_session(struct TCP_Server_Info *server)
1612 list_del_init(&server->tcp_ses_list); 1601 list_del_init(&server->tcp_ses_list);
1613 spin_unlock(&cifs_tcp_ses_lock); 1602 spin_unlock(&cifs_tcp_ses_lock);
1614 1603
1604 cancel_delayed_work_sync(&server->echo);
1605
1615 spin_lock(&GlobalMid_Lock); 1606 spin_lock(&GlobalMid_Lock);
1616 server->tcpStatus = CifsExiting; 1607 server->tcpStatus = CifsExiting;
1617 spin_unlock(&GlobalMid_Lock); 1608 spin_unlock(&GlobalMid_Lock);
@@ -1701,8 +1692,10 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
1701 volume_info->target_rfc1001_name, RFC1001_NAME_LEN_WITH_NULL); 1692 volume_info->target_rfc1001_name, RFC1001_NAME_LEN_WITH_NULL);
1702 tcp_ses->session_estab = false; 1693 tcp_ses->session_estab = false;
1703 tcp_ses->sequence_number = 0; 1694 tcp_ses->sequence_number = 0;
1695 tcp_ses->lstrp = jiffies;
1704 INIT_LIST_HEAD(&tcp_ses->tcp_ses_list); 1696 INIT_LIST_HEAD(&tcp_ses->tcp_ses_list);
1705 INIT_LIST_HEAD(&tcp_ses->smb_ses_list); 1697 INIT_LIST_HEAD(&tcp_ses->smb_ses_list);
1698 INIT_DELAYED_WORK(&tcp_ses->echo, cifs_echo_request);
1706 1699
1707 /* 1700 /*
1708 * at this point we are the only ones with the pointer 1701 * at this point we are the only ones with the pointer
@@ -1751,6 +1744,9 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
1751 1744
1752 cifs_fscache_get_client_cookie(tcp_ses); 1745 cifs_fscache_get_client_cookie(tcp_ses);
1753 1746
1747 /* queue echo request delayed work */
1748 queue_delayed_work(system_nrt_wq, &tcp_ses->echo, SMB_ECHO_INTERVAL);
1749
1754 return tcp_ses; 1750 return tcp_ses;
1755 1751
1756out_err_crypto_release: 1752out_err_crypto_release:
@@ -2936,8 +2932,8 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
2936 TCONX_RSP *pSMBr; 2932 TCONX_RSP *pSMBr;
2937 unsigned char *bcc_ptr; 2933 unsigned char *bcc_ptr;
2938 int rc = 0; 2934 int rc = 0;
2939 int length, bytes_left; 2935 int length;
2940 __u16 count; 2936 __u16 bytes_left, count;
2941 2937
2942 if (ses == NULL) 2938 if (ses == NULL)
2943 return -EIO; 2939 return -EIO;
@@ -2965,7 +2961,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
2965 bcc_ptr++; /* skip password */ 2961 bcc_ptr++; /* skip password */
2966 /* already aligned so no need to do it below */ 2962 /* already aligned so no need to do it below */
2967 } else { 2963 } else {
2968 pSMB->PasswordLength = cpu_to_le16(CIFS_SESS_KEY_SIZE); 2964 pSMB->PasswordLength = cpu_to_le16(CIFS_AUTH_RESP_SIZE);
2969 /* BB FIXME add code to fail this if NTLMv2 or Kerberos 2965 /* BB FIXME add code to fail this if NTLMv2 or Kerberos
2970 specified as required (when that support is added to 2966 specified as required (when that support is added to
2971 the vfs in the future) as only NTLM or the much 2967 the vfs in the future) as only NTLM or the much
@@ -2983,7 +2979,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
2983#endif /* CIFS_WEAK_PW_HASH */ 2979#endif /* CIFS_WEAK_PW_HASH */
2984 SMBNTencrypt(tcon->password, ses->server->cryptkey, bcc_ptr); 2980 SMBNTencrypt(tcon->password, ses->server->cryptkey, bcc_ptr);
2985 2981
2986 bcc_ptr += CIFS_SESS_KEY_SIZE; 2982 bcc_ptr += CIFS_AUTH_RESP_SIZE;
2987 if (ses->capabilities & CAP_UNICODE) { 2983 if (ses->capabilities & CAP_UNICODE) {
2988 /* must align unicode strings */ 2984 /* must align unicode strings */
2989 *bcc_ptr = 0; /* null byte password */ 2985 *bcc_ptr = 0; /* null byte password */
@@ -3021,7 +3017,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
3021 pSMB->ByteCount = cpu_to_le16(count); 3017 pSMB->ByteCount = cpu_to_le16(count);
3022 3018
3023 rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, &length, 3019 rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, &length,
3024 CIFS_STD_OP); 3020 0);
3025 3021
3026 /* above now done in SendReceive */ 3022 /* above now done in SendReceive */
3027 if ((rc == 0) && (tcon != NULL)) { 3023 if ((rc == 0) && (tcon != NULL)) {
@@ -3031,7 +3027,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
3031 tcon->need_reconnect = false; 3027 tcon->need_reconnect = false;
3032 tcon->tid = smb_buffer_response->Tid; 3028 tcon->tid = smb_buffer_response->Tid;
3033 bcc_ptr = pByteArea(smb_buffer_response); 3029 bcc_ptr = pByteArea(smb_buffer_response);
3034 bytes_left = BCC(smb_buffer_response); 3030 bytes_left = get_bcc(smb_buffer_response);
3035 length = strnlen(bcc_ptr, bytes_left - 2); 3031 length = strnlen(bcc_ptr, bytes_left - 2);
3036 if (smb_buffer->Flags2 & SMBFLG2_UNICODE) 3032 if (smb_buffer->Flags2 & SMBFLG2_UNICODE)
3037 is_unicode = true; 3033 is_unicode = true;
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index d843631c028d..d7d65a70678e 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -287,6 +287,7 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file)
287 struct inode *inode = cifs_file->dentry->d_inode; 287 struct inode *inode = cifs_file->dentry->d_inode;
288 struct cifsTconInfo *tcon = tlink_tcon(cifs_file->tlink); 288 struct cifsTconInfo *tcon = tlink_tcon(cifs_file->tlink);
289 struct cifsInodeInfo *cifsi = CIFS_I(inode); 289 struct cifsInodeInfo *cifsi = CIFS_I(inode);
290 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
290 struct cifsLockInfo *li, *tmp; 291 struct cifsLockInfo *li, *tmp;
291 292
292 spin_lock(&cifs_file_list_lock); 293 spin_lock(&cifs_file_list_lock);
@@ -302,6 +303,13 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file)
302 if (list_empty(&cifsi->openFileList)) { 303 if (list_empty(&cifsi->openFileList)) {
303 cFYI(1, "closing last open instance for inode %p", 304 cFYI(1, "closing last open instance for inode %p",
304 cifs_file->dentry->d_inode); 305 cifs_file->dentry->d_inode);
306
307 /* in strict cache mode we need invalidate mapping on the last
308 close because it may cause a error when we open this file
309 again and get at least level II oplock */
310 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_STRICT_IO)
311 CIFS_I(inode)->invalid_mapping = true;
312
305 cifs_set_oplock_level(cifsi, 0); 313 cifs_set_oplock_level(cifsi, 0);
306 } 314 }
307 spin_unlock(&cifs_file_list_lock); 315 spin_unlock(&cifs_file_list_lock);
@@ -726,12 +734,12 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
726 734
727 /* BB we could chain these into one lock request BB */ 735 /* BB we could chain these into one lock request BB */
728 rc = CIFSSMBLock(xid, tcon, netfid, length, pfLock->fl_start, 736 rc = CIFSSMBLock(xid, tcon, netfid, length, pfLock->fl_start,
729 0, 1, lockType, 0 /* wait flag */ ); 737 0, 1, lockType, 0 /* wait flag */, 0);
730 if (rc == 0) { 738 if (rc == 0) {
731 rc = CIFSSMBLock(xid, tcon, netfid, length, 739 rc = CIFSSMBLock(xid, tcon, netfid, length,
732 pfLock->fl_start, 1 /* numUnlock */ , 740 pfLock->fl_start, 1 /* numUnlock */ ,
733 0 /* numLock */ , lockType, 741 0 /* numLock */ , lockType,
734 0 /* wait flag */ ); 742 0 /* wait flag */, 0);
735 pfLock->fl_type = F_UNLCK; 743 pfLock->fl_type = F_UNLCK;
736 if (rc != 0) 744 if (rc != 0)
737 cERROR(1, "Error unlocking previously locked " 745 cERROR(1, "Error unlocking previously locked "
@@ -748,13 +756,13 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
748 rc = CIFSSMBLock(xid, tcon, netfid, length, 756 rc = CIFSSMBLock(xid, tcon, netfid, length,
749 pfLock->fl_start, 0, 1, 757 pfLock->fl_start, 0, 1,
750 lockType | LOCKING_ANDX_SHARED_LOCK, 758 lockType | LOCKING_ANDX_SHARED_LOCK,
751 0 /* wait flag */); 759 0 /* wait flag */, 0);
752 if (rc == 0) { 760 if (rc == 0) {
753 rc = CIFSSMBLock(xid, tcon, netfid, 761 rc = CIFSSMBLock(xid, tcon, netfid,
754 length, pfLock->fl_start, 1, 0, 762 length, pfLock->fl_start, 1, 0,
755 lockType | 763 lockType |
756 LOCKING_ANDX_SHARED_LOCK, 764 LOCKING_ANDX_SHARED_LOCK,
757 0 /* wait flag */); 765 0 /* wait flag */, 0);
758 pfLock->fl_type = F_RDLCK; 766 pfLock->fl_type = F_RDLCK;
759 if (rc != 0) 767 if (rc != 0)
760 cERROR(1, "Error unlocking " 768 cERROR(1, "Error unlocking "
@@ -797,8 +805,8 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
797 805
798 if (numLock) { 806 if (numLock) {
799 rc = CIFSSMBLock(xid, tcon, netfid, length, 807 rc = CIFSSMBLock(xid, tcon, netfid, length,
800 pfLock->fl_start, 808 pfLock->fl_start, 0, numLock, lockType,
801 0, numLock, lockType, wait_flag); 809 wait_flag, 0);
802 810
803 if (rc == 0) { 811 if (rc == 0) {
804 /* For Windows locks we must store them. */ 812 /* For Windows locks we must store them. */
@@ -818,9 +826,9 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
818 (pfLock->fl_start + length) >= 826 (pfLock->fl_start + length) >=
819 (li->offset + li->length)) { 827 (li->offset + li->length)) {
820 stored_rc = CIFSSMBLock(xid, tcon, 828 stored_rc = CIFSSMBLock(xid, tcon,
821 netfid, 829 netfid, li->length,
822 li->length, li->offset, 830 li->offset, 1, 0,
823 1, 0, li->type, false); 831 li->type, false, 0);
824 if (stored_rc) 832 if (stored_rc)
825 rc = stored_rc; 833 rc = stored_rc;
826 else { 834 else {
@@ -839,29 +847,6 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
839 return rc; 847 return rc;
840} 848}
841 849
842/*
843 * Set the timeout on write requests past EOF. For some servers (Windows)
844 * these calls can be very long.
845 *
846 * If we're writing >10M past the EOF we give a 180s timeout. Anything less
847 * than that gets a 45s timeout. Writes not past EOF get 15s timeouts.
848 * The 10M cutoff is totally arbitrary. A better scheme for this would be
849 * welcome if someone wants to suggest one.
850 *
851 * We may be able to do a better job with this if there were some way to
852 * declare that a file should be sparse.
853 */
854static int
855cifs_write_timeout(struct cifsInodeInfo *cifsi, loff_t offset)
856{
857 if (offset <= cifsi->server_eof)
858 return CIFS_STD_OP;
859 else if (offset > (cifsi->server_eof + (10 * 1024 * 1024)))
860 return CIFS_VLONG_OP;
861 else
862 return CIFS_LONG_OP;
863}
864
865/* update the file size (if needed) after a write */ 850/* update the file size (if needed) after a write */
866static void 851static void
867cifs_update_eof(struct cifsInodeInfo *cifsi, loff_t offset, 852cifs_update_eof(struct cifsInodeInfo *cifsi, loff_t offset,
@@ -882,7 +867,7 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
882 unsigned int total_written; 867 unsigned int total_written;
883 struct cifs_sb_info *cifs_sb; 868 struct cifs_sb_info *cifs_sb;
884 struct cifsTconInfo *pTcon; 869 struct cifsTconInfo *pTcon;
885 int xid, long_op; 870 int xid;
886 struct cifsFileInfo *open_file; 871 struct cifsFileInfo *open_file;
887 struct cifsInodeInfo *cifsi = CIFS_I(inode); 872 struct cifsInodeInfo *cifsi = CIFS_I(inode);
888 873
@@ -903,7 +888,6 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
903 888
904 xid = GetXid(); 889 xid = GetXid();
905 890
906 long_op = cifs_write_timeout(cifsi, *poffset);
907 for (total_written = 0; write_size > total_written; 891 for (total_written = 0; write_size > total_written;
908 total_written += bytes_written) { 892 total_written += bytes_written) {
909 rc = -EAGAIN; 893 rc = -EAGAIN;
@@ -931,7 +915,7 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
931 min_t(const int, cifs_sb->wsize, 915 min_t(const int, cifs_sb->wsize,
932 write_size - total_written), 916 write_size - total_written),
933 *poffset, &bytes_written, 917 *poffset, &bytes_written,
934 NULL, write_data + total_written, long_op); 918 NULL, write_data + total_written, 0);
935 } 919 }
936 if (rc || (bytes_written == 0)) { 920 if (rc || (bytes_written == 0)) {
937 if (total_written) 921 if (total_written)
@@ -944,8 +928,6 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
944 cifs_update_eof(cifsi, *poffset, bytes_written); 928 cifs_update_eof(cifsi, *poffset, bytes_written);
945 *poffset += bytes_written; 929 *poffset += bytes_written;
946 } 930 }
947 long_op = CIFS_STD_OP; /* subsequent writes fast -
948 15 seconds is plenty */
949 } 931 }
950 932
951 cifs_stats_bytes_written(pTcon, total_written); 933 cifs_stats_bytes_written(pTcon, total_written);
@@ -974,7 +956,7 @@ static ssize_t cifs_write(struct cifsFileInfo *open_file,
974 unsigned int total_written; 956 unsigned int total_written;
975 struct cifs_sb_info *cifs_sb; 957 struct cifs_sb_info *cifs_sb;
976 struct cifsTconInfo *pTcon; 958 struct cifsTconInfo *pTcon;
977 int xid, long_op; 959 int xid;
978 struct dentry *dentry = open_file->dentry; 960 struct dentry *dentry = open_file->dentry;
979 struct cifsInodeInfo *cifsi = CIFS_I(dentry->d_inode); 961 struct cifsInodeInfo *cifsi = CIFS_I(dentry->d_inode);
980 962
@@ -987,7 +969,6 @@ static ssize_t cifs_write(struct cifsFileInfo *open_file,
987 969
988 xid = GetXid(); 970 xid = GetXid();
989 971
990 long_op = cifs_write_timeout(cifsi, *poffset);
991 for (total_written = 0; write_size > total_written; 972 for (total_written = 0; write_size > total_written;
992 total_written += bytes_written) { 973 total_written += bytes_written) {
993 rc = -EAGAIN; 974 rc = -EAGAIN;
@@ -1017,7 +998,7 @@ static ssize_t cifs_write(struct cifsFileInfo *open_file,
1017 rc = CIFSSMBWrite2(xid, pTcon, 998 rc = CIFSSMBWrite2(xid, pTcon,
1018 open_file->netfid, len, 999 open_file->netfid, len,
1019 *poffset, &bytes_written, 1000 *poffset, &bytes_written,
1020 iov, 1, long_op); 1001 iov, 1, 0);
1021 } else 1002 } else
1022 rc = CIFSSMBWrite(xid, pTcon, 1003 rc = CIFSSMBWrite(xid, pTcon,
1023 open_file->netfid, 1004 open_file->netfid,
@@ -1025,7 +1006,7 @@ static ssize_t cifs_write(struct cifsFileInfo *open_file,
1025 write_size - total_written), 1006 write_size - total_written),
1026 *poffset, &bytes_written, 1007 *poffset, &bytes_written,
1027 write_data + total_written, 1008 write_data + total_written,
1028 NULL, long_op); 1009 NULL, 0);
1029 } 1010 }
1030 if (rc || (bytes_written == 0)) { 1011 if (rc || (bytes_written == 0)) {
1031 if (total_written) 1012 if (total_written)
@@ -1038,8 +1019,6 @@ static ssize_t cifs_write(struct cifsFileInfo *open_file,
1038 cifs_update_eof(cifsi, *poffset, bytes_written); 1019 cifs_update_eof(cifsi, *poffset, bytes_written);
1039 *poffset += bytes_written; 1020 *poffset += bytes_written;
1040 } 1021 }
1041 long_op = CIFS_STD_OP; /* subsequent writes fast -
1042 15 seconds is plenty */
1043 } 1022 }
1044 1023
1045 cifs_stats_bytes_written(pTcon, total_written); 1024 cifs_stats_bytes_written(pTcon, total_written);
@@ -1239,7 +1218,7 @@ static int cifs_writepages(struct address_space *mapping,
1239 struct pagevec pvec; 1218 struct pagevec pvec;
1240 int rc = 0; 1219 int rc = 0;
1241 int scanned = 0; 1220 int scanned = 0;
1242 int xid, long_op; 1221 int xid;
1243 1222
1244 cifs_sb = CIFS_SB(mapping->host->i_sb); 1223 cifs_sb = CIFS_SB(mapping->host->i_sb);
1245 1224
@@ -1377,43 +1356,67 @@ retry:
1377 break; 1356 break;
1378 } 1357 }
1379 if (n_iov) { 1358 if (n_iov) {
1359retry_write:
1380 open_file = find_writable_file(CIFS_I(mapping->host), 1360 open_file = find_writable_file(CIFS_I(mapping->host),
1381 false); 1361 false);
1382 if (!open_file) { 1362 if (!open_file) {
1383 cERROR(1, "No writable handles for inode"); 1363 cERROR(1, "No writable handles for inode");
1384 rc = -EBADF; 1364 rc = -EBADF;
1385 } else { 1365 } else {
1386 long_op = cifs_write_timeout(cifsi, offset);
1387 rc = CIFSSMBWrite2(xid, tcon, open_file->netfid, 1366 rc = CIFSSMBWrite2(xid, tcon, open_file->netfid,
1388 bytes_to_write, offset, 1367 bytes_to_write, offset,
1389 &bytes_written, iov, n_iov, 1368 &bytes_written, iov, n_iov,
1390 long_op); 1369 0);
1391 cifsFileInfo_put(open_file); 1370 cifsFileInfo_put(open_file);
1392 cifs_update_eof(cifsi, offset, bytes_written);
1393 } 1371 }
1394 1372
1395 if (rc || bytes_written < bytes_to_write) { 1373 cFYI(1, "Write2 rc=%d, wrote=%u", rc, bytes_written);
1396 cERROR(1, "Write2 ret %d, wrote %d", 1374
1397 rc, bytes_written); 1375 /*
1398 mapping_set_error(mapping, rc); 1376 * For now, treat a short write as if nothing got
1399 } else { 1377 * written. A zero length write however indicates
1378 * ENOSPC or EFBIG. We have no way to know which
1379 * though, so call it ENOSPC for now. EFBIG would
1380 * get translated to AS_EIO anyway.
1381 *
1382 * FIXME: make it take into account the data that did
1383 * get written
1384 */
1385 if (rc == 0) {
1386 if (bytes_written == 0)
1387 rc = -ENOSPC;
1388 else if (bytes_written < bytes_to_write)
1389 rc = -EAGAIN;
1390 }
1391
1392 /* retry on data-integrity flush */
1393 if (wbc->sync_mode == WB_SYNC_ALL && rc == -EAGAIN)
1394 goto retry_write;
1395
1396 /* fix the stats and EOF */
1397 if (bytes_written > 0) {
1400 cifs_stats_bytes_written(tcon, bytes_written); 1398 cifs_stats_bytes_written(tcon, bytes_written);
1399 cifs_update_eof(cifsi, offset, bytes_written);
1401 } 1400 }
1402 1401
1403 for (i = 0; i < n_iov; i++) { 1402 for (i = 0; i < n_iov; i++) {
1404 page = pvec.pages[first + i]; 1403 page = pvec.pages[first + i];
1405 /* Should we also set page error on 1404 /* on retryable write error, redirty page */
1406 success rc but too little data written? */ 1405 if (rc == -EAGAIN)
1407 /* BB investigate retry logic on temporary 1406 redirty_page_for_writepage(wbc, page);
1408 server crash cases and how recovery works 1407 else if (rc != 0)
1409 when page marked as error */
1410 if (rc)
1411 SetPageError(page); 1408 SetPageError(page);
1412 kunmap(page); 1409 kunmap(page);
1413 unlock_page(page); 1410 unlock_page(page);
1414 end_page_writeback(page); 1411 end_page_writeback(page);
1415 page_cache_release(page); 1412 page_cache_release(page);
1416 } 1413 }
1414
1415 if (rc != -EAGAIN)
1416 mapping_set_error(mapping, rc);
1417 else
1418 rc = 0;
1419
1417 if ((wbc->nr_to_write -= n_iov) <= 0) 1420 if ((wbc->nr_to_write -= n_iov) <= 0)
1418 done = 1; 1421 done = 1;
1419 index = next; 1422 index = next;
@@ -1525,27 +1528,47 @@ static int cifs_write_end(struct file *file, struct address_space *mapping,
1525 return rc; 1528 return rc;
1526} 1529}
1527 1530
1528int cifs_fsync(struct file *file, int datasync) 1531int cifs_strict_fsync(struct file *file, int datasync)
1529{ 1532{
1530 int xid; 1533 int xid;
1531 int rc = 0; 1534 int rc = 0;
1532 struct cifsTconInfo *tcon; 1535 struct cifsTconInfo *tcon;
1533 struct cifsFileInfo *smbfile = file->private_data; 1536 struct cifsFileInfo *smbfile = file->private_data;
1534 struct inode *inode = file->f_path.dentry->d_inode; 1537 struct inode *inode = file->f_path.dentry->d_inode;
1538 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
1535 1539
1536 xid = GetXid(); 1540 xid = GetXid();
1537 1541
1538 cFYI(1, "Sync file - name: %s datasync: 0x%x", 1542 cFYI(1, "Sync file - name: %s datasync: 0x%x",
1539 file->f_path.dentry->d_name.name, datasync); 1543 file->f_path.dentry->d_name.name, datasync);
1540 1544
1541 rc = filemap_write_and_wait(inode->i_mapping); 1545 if (!CIFS_I(inode)->clientCanCacheRead)
1542 if (rc == 0) { 1546 cifs_invalidate_mapping(inode);
1543 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
1544 1547
1545 tcon = tlink_tcon(smbfile->tlink); 1548 tcon = tlink_tcon(smbfile->tlink);
1546 if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC)) 1549 if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC))
1547 rc = CIFSSMBFlush(xid, tcon, smbfile->netfid); 1550 rc = CIFSSMBFlush(xid, tcon, smbfile->netfid);
1548 } 1551
1552 FreeXid(xid);
1553 return rc;
1554}
1555
1556int cifs_fsync(struct file *file, int datasync)
1557{
1558 int xid;
1559 int rc = 0;
1560 struct cifsTconInfo *tcon;
1561 struct cifsFileInfo *smbfile = file->private_data;
1562 struct cifs_sb_info *cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
1563
1564 xid = GetXid();
1565
1566 cFYI(1, "Sync file - name: %s datasync: 0x%x",
1567 file->f_path.dentry->d_name.name, datasync);
1568
1569 tcon = tlink_tcon(smbfile->tlink);
1570 if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC))
1571 rc = CIFSSMBFlush(xid, tcon, smbfile->netfid);
1549 1572
1550 FreeXid(xid); 1573 FreeXid(xid);
1551 return rc; 1574 return rc;
@@ -1596,42 +1619,42 @@ int cifs_flush(struct file *file, fl_owner_t id)
1596 return rc; 1619 return rc;
1597} 1620}
1598 1621
1599ssize_t cifs_user_read(struct file *file, char __user *read_data, 1622static ssize_t
1600 size_t read_size, loff_t *poffset) 1623cifs_iovec_read(struct file *file, const struct iovec *iov,
1624 unsigned long nr_segs, loff_t *poffset)
1601{ 1625{
1602 int rc = -EACCES; 1626 int rc;
1603 unsigned int bytes_read = 0; 1627 int xid;
1604 unsigned int total_read = 0; 1628 unsigned int total_read, bytes_read = 0;
1605 unsigned int current_read_size; 1629 size_t len, cur_len;
1630 int iov_offset = 0;
1606 struct cifs_sb_info *cifs_sb; 1631 struct cifs_sb_info *cifs_sb;
1607 struct cifsTconInfo *pTcon; 1632 struct cifsTconInfo *pTcon;
1608 int xid;
1609 struct cifsFileInfo *open_file; 1633 struct cifsFileInfo *open_file;
1610 char *smb_read_data;
1611 char __user *current_offset;
1612 struct smb_com_read_rsp *pSMBr; 1634 struct smb_com_read_rsp *pSMBr;
1635 char *read_data;
1636
1637 if (!nr_segs)
1638 return 0;
1639
1640 len = iov_length(iov, nr_segs);
1641 if (!len)
1642 return 0;
1613 1643
1614 xid = GetXid(); 1644 xid = GetXid();
1615 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); 1645 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
1616 1646
1617 if (file->private_data == NULL) {
1618 rc = -EBADF;
1619 FreeXid(xid);
1620 return rc;
1621 }
1622 open_file = file->private_data; 1647 open_file = file->private_data;
1623 pTcon = tlink_tcon(open_file->tlink); 1648 pTcon = tlink_tcon(open_file->tlink);
1624 1649
1625 if ((file->f_flags & O_ACCMODE) == O_WRONLY) 1650 if ((file->f_flags & O_ACCMODE) == O_WRONLY)
1626 cFYI(1, "attempting read on write only file instance"); 1651 cFYI(1, "attempting read on write only file instance");
1627 1652
1628 for (total_read = 0, current_offset = read_data; 1653 for (total_read = 0; total_read < len; total_read += bytes_read) {
1629 read_size > total_read; 1654 cur_len = min_t(const size_t, len - total_read, cifs_sb->rsize);
1630 total_read += bytes_read, current_offset += bytes_read) {
1631 current_read_size = min_t(const int, read_size - total_read,
1632 cifs_sb->rsize);
1633 rc = -EAGAIN; 1655 rc = -EAGAIN;
1634 smb_read_data = NULL; 1656 read_data = NULL;
1657
1635 while (rc == -EAGAIN) { 1658 while (rc == -EAGAIN) {
1636 int buf_type = CIFS_NO_BUFFER; 1659 int buf_type = CIFS_NO_BUFFER;
1637 if (open_file->invalidHandle) { 1660 if (open_file->invalidHandle) {
@@ -1639,27 +1662,25 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data,
1639 if (rc != 0) 1662 if (rc != 0)
1640 break; 1663 break;
1641 } 1664 }
1642 rc = CIFSSMBRead(xid, pTcon, 1665 rc = CIFSSMBRead(xid, pTcon, open_file->netfid,
1643 open_file->netfid, 1666 cur_len, *poffset, &bytes_read,
1644 current_read_size, *poffset, 1667 &read_data, &buf_type);
1645 &bytes_read, &smb_read_data, 1668 pSMBr = (struct smb_com_read_rsp *)read_data;
1646 &buf_type); 1669 if (read_data) {
1647 pSMBr = (struct smb_com_read_rsp *)smb_read_data; 1670 char *data_offset = read_data + 4 +
1648 if (smb_read_data) { 1671 le16_to_cpu(pSMBr->DataOffset);
1649 if (copy_to_user(current_offset, 1672 if (memcpy_toiovecend(iov, data_offset,
1650 smb_read_data + 1673 iov_offset, bytes_read))
1651 4 /* RFC1001 length field */ +
1652 le16_to_cpu(pSMBr->DataOffset),
1653 bytes_read))
1654 rc = -EFAULT; 1674 rc = -EFAULT;
1655
1656 if (buf_type == CIFS_SMALL_BUFFER) 1675 if (buf_type == CIFS_SMALL_BUFFER)
1657 cifs_small_buf_release(smb_read_data); 1676 cifs_small_buf_release(read_data);
1658 else if (buf_type == CIFS_LARGE_BUFFER) 1677 else if (buf_type == CIFS_LARGE_BUFFER)
1659 cifs_buf_release(smb_read_data); 1678 cifs_buf_release(read_data);
1660 smb_read_data = NULL; 1679 read_data = NULL;
1680 iov_offset += bytes_read;
1661 } 1681 }
1662 } 1682 }
1683
1663 if (rc || (bytes_read == 0)) { 1684 if (rc || (bytes_read == 0)) {
1664 if (total_read) { 1685 if (total_read) {
1665 break; 1686 break;
@@ -1672,13 +1693,57 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data,
1672 *poffset += bytes_read; 1693 *poffset += bytes_read;
1673 } 1694 }
1674 } 1695 }
1696
1675 FreeXid(xid); 1697 FreeXid(xid);
1676 return total_read; 1698 return total_read;
1677} 1699}
1678 1700
1701ssize_t cifs_user_read(struct file *file, char __user *read_data,
1702 size_t read_size, loff_t *poffset)
1703{
1704 struct iovec iov;
1705 iov.iov_base = read_data;
1706 iov.iov_len = read_size;
1707
1708 return cifs_iovec_read(file, &iov, 1, poffset);
1709}
1710
1711static ssize_t cifs_user_readv(struct kiocb *iocb, const struct iovec *iov,
1712 unsigned long nr_segs, loff_t pos)
1713{
1714 ssize_t read;
1715
1716 read = cifs_iovec_read(iocb->ki_filp, iov, nr_segs, &pos);
1717 if (read > 0)
1718 iocb->ki_pos = pos;
1719
1720 return read;
1721}
1722
1723ssize_t cifs_strict_readv(struct kiocb *iocb, const struct iovec *iov,
1724 unsigned long nr_segs, loff_t pos)
1725{
1726 struct inode *inode;
1727
1728 inode = iocb->ki_filp->f_path.dentry->d_inode;
1729
1730 if (CIFS_I(inode)->clientCanCacheRead)
1731 return generic_file_aio_read(iocb, iov, nr_segs, pos);
1732
1733 /*
1734 * In strict cache mode we need to read from the server all the time
1735 * if we don't have level II oplock because the server can delay mtime
1736 * change - so we can't make a decision about inode invalidating.
1737 * And we can also fail with pagereading if there are mandatory locks
1738 * on pages affected by this read but not on the region from pos to
1739 * pos+len-1.
1740 */
1741
1742 return cifs_user_readv(iocb, iov, nr_segs, pos);
1743}
1679 1744
1680static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size, 1745static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
1681 loff_t *poffset) 1746 loff_t *poffset)
1682{ 1747{
1683 int rc = -EACCES; 1748 int rc = -EACCES;
1684 unsigned int bytes_read = 0; 1749 unsigned int bytes_read = 0;
@@ -1746,6 +1811,21 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
1746 return total_read; 1811 return total_read;
1747} 1812}
1748 1813
1814int cifs_file_strict_mmap(struct file *file, struct vm_area_struct *vma)
1815{
1816 int rc, xid;
1817 struct inode *inode = file->f_path.dentry->d_inode;
1818
1819 xid = GetXid();
1820
1821 if (!CIFS_I(inode)->clientCanCacheRead)
1822 cifs_invalidate_mapping(inode);
1823
1824 rc = generic_file_mmap(file, vma);
1825 FreeXid(xid);
1826 return rc;
1827}
1828
1749int cifs_file_mmap(struct file *file, struct vm_area_struct *vma) 1829int cifs_file_mmap(struct file *file, struct vm_area_struct *vma)
1750{ 1830{
1751 int rc, xid; 1831 int rc, xid;
@@ -2192,7 +2272,8 @@ void cifs_oplock_break(struct work_struct *work)
2192 */ 2272 */
2193 if (!cfile->oplock_break_cancelled) { 2273 if (!cfile->oplock_break_cancelled) {
2194 rc = CIFSSMBLock(0, tlink_tcon(cfile->tlink), cfile->netfid, 0, 2274 rc = CIFSSMBLock(0, tlink_tcon(cfile->tlink), cfile->netfid, 0,
2195 0, 0, 0, LOCKING_ANDX_OPLOCK_RELEASE, false); 2275 0, 0, 0, LOCKING_ANDX_OPLOCK_RELEASE, false,
2276 cinode->clientCanCacheRead ? 1 : 0);
2196 cFYI(1, "Oplock release rc = %d", rc); 2277 cFYI(1, "Oplock release rc = %d", rc);
2197 } 2278 }
2198 2279
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 6c9ee8014ff0..8852470b4fbb 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -44,13 +44,17 @@ static void cifs_set_ops(struct inode *inode)
44 inode->i_fop = &cifs_file_direct_nobrl_ops; 44 inode->i_fop = &cifs_file_direct_nobrl_ops;
45 else 45 else
46 inode->i_fop = &cifs_file_direct_ops; 46 inode->i_fop = &cifs_file_direct_ops;
47 } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_STRICT_IO) {
48 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
49 inode->i_fop = &cifs_file_strict_nobrl_ops;
50 else
51 inode->i_fop = &cifs_file_strict_ops;
47 } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) 52 } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
48 inode->i_fop = &cifs_file_nobrl_ops; 53 inode->i_fop = &cifs_file_nobrl_ops;
49 else { /* not direct, send byte range locks */ 54 else { /* not direct, send byte range locks */
50 inode->i_fop = &cifs_file_ops; 55 inode->i_fop = &cifs_file_ops;
51 } 56 }
52 57
53
54 /* check if server can support readpages */ 58 /* check if server can support readpages */
55 if (cifs_sb_master_tcon(cifs_sb)->ses->server->maxBuf < 59 if (cifs_sb_master_tcon(cifs_sb)->ses->server->maxBuf <
56 PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE) 60 PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE)
@@ -1679,7 +1683,7 @@ cifs_inode_needs_reval(struct inode *inode)
1679/* 1683/*
1680 * Zap the cache. Called when invalid_mapping flag is set. 1684 * Zap the cache. Called when invalid_mapping flag is set.
1681 */ 1685 */
1682static void 1686void
1683cifs_invalidate_mapping(struct inode *inode) 1687cifs_invalidate_mapping(struct inode *inode)
1684{ 1688{
1685 int rc; 1689 int rc;
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index 43f10281bc19..a09e077ba925 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -571,7 +571,7 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
571 pCifsInode = CIFS_I(netfile->dentry->d_inode); 571 pCifsInode = CIFS_I(netfile->dentry->d_inode);
572 572
573 cifs_set_oplock_level(pCifsInode, 573 cifs_set_oplock_level(pCifsInode,
574 pSMB->OplockLevel); 574 pSMB->OplockLevel ? OPLOCK_READ : 0);
575 /* 575 /*
576 * cifs_oplock_break_put() can't be called 576 * cifs_oplock_break_put() can't be called
577 * from here. Get reference after queueing 577 * from here. Get reference after queueing
@@ -637,77 +637,6 @@ dump_smb(struct smb_hdr *smb_buf, int smb_buf_length)
637 return; 637 return;
638} 638}
639 639
640/* Convert 16 bit Unicode pathname to wire format from string in current code
641 page. Conversion may involve remapping up the seven characters that are
642 only legal in POSIX-like OS (if they are present in the string). Path
643 names are little endian 16 bit Unicode on the wire */
644int
645cifsConvertToUCS(__le16 *target, const char *source, int maxlen,
646 const struct nls_table *cp, int mapChars)
647{
648 int i, j, charlen;
649 int len_remaining = maxlen;
650 char src_char;
651 __u16 temp;
652
653 if (!mapChars)
654 return cifs_strtoUCS(target, source, PATH_MAX, cp);
655
656 for (i = 0, j = 0; i < maxlen; j++) {
657 src_char = source[i];
658 switch (src_char) {
659 case 0:
660 target[j] = 0;
661 goto ctoUCS_out;
662 case ':':
663 target[j] = cpu_to_le16(UNI_COLON);
664 break;
665 case '*':
666 target[j] = cpu_to_le16(UNI_ASTERIK);
667 break;
668 case '?':
669 target[j] = cpu_to_le16(UNI_QUESTION);
670 break;
671 case '<':
672 target[j] = cpu_to_le16(UNI_LESSTHAN);
673 break;
674 case '>':
675 target[j] = cpu_to_le16(UNI_GRTRTHAN);
676 break;
677 case '|':
678 target[j] = cpu_to_le16(UNI_PIPE);
679 break;
680 /* BB We can not handle remapping slash until
681 all the calls to build_path_from_dentry
682 are modified, as they use slash as separator BB */
683 /* case '\\':
684 target[j] = cpu_to_le16(UNI_SLASH);
685 break;*/
686 default:
687 charlen = cp->char2uni(source+i,
688 len_remaining, &temp);
689 /* if no match, use question mark, which
690 at least in some cases servers as wild card */
691 if (charlen < 1) {
692 target[j] = cpu_to_le16(0x003f);
693 charlen = 1;
694 } else
695 target[j] = cpu_to_le16(temp);
696 len_remaining -= charlen;
697 /* character may take more than one byte in the
698 the source string, but will take exactly two
699 bytes in the target string */
700 i += charlen;
701 continue;
702 }
703 i++; /* move to next char in source string */
704 len_remaining--;
705 }
706
707ctoUCS_out:
708 return i;
709}
710
711void 640void
712cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb) 641cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb)
713{ 642{
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c
index 6783ce6cdc89..8d9189f64477 100644
--- a/fs/cifs/netmisc.c
+++ b/fs/cifs/netmisc.c
@@ -916,14 +916,14 @@ unsigned int
916smbCalcSize(struct smb_hdr *ptr) 916smbCalcSize(struct smb_hdr *ptr)
917{ 917{
918 return (sizeof(struct smb_hdr) + (2 * ptr->WordCount) + 918 return (sizeof(struct smb_hdr) + (2 * ptr->WordCount) +
919 2 /* size of the bcc field */ + BCC(ptr)); 919 2 /* size of the bcc field */ + get_bcc(ptr));
920} 920}
921 921
922unsigned int 922unsigned int
923smbCalcSize_LE(struct smb_hdr *ptr) 923smbCalcSize_LE(struct smb_hdr *ptr)
924{ 924{
925 return (sizeof(struct smb_hdr) + (2 * ptr->WordCount) + 925 return (sizeof(struct smb_hdr) + (2 * ptr->WordCount) +
926 2 /* size of the bcc field */ + le16_to_cpu(BCC_LE(ptr))); 926 2 /* size of the bcc field */ + get_bcc_le(ptr));
927} 927}
928 928
929/* The following are taken from fs/ntfs/util.c */ 929/* The following are taken from fs/ntfs/util.c */
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index eb746486e49e..1adc9625a344 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -277,7 +277,7 @@ static void ascii_ssetup_strings(char **pbcc_area, struct cifsSesInfo *ses,
277} 277}
278 278
279static void 279static void
280decode_unicode_ssetup(char **pbcc_area, int bleft, struct cifsSesInfo *ses, 280decode_unicode_ssetup(char **pbcc_area, __u16 bleft, struct cifsSesInfo *ses,
281 const struct nls_table *nls_cp) 281 const struct nls_table *nls_cp)
282{ 282{
283 int len; 283 int len;
@@ -323,7 +323,7 @@ decode_unicode_ssetup(char **pbcc_area, int bleft, struct cifsSesInfo *ses,
323 return; 323 return;
324} 324}
325 325
326static int decode_ascii_ssetup(char **pbcc_area, int bleft, 326static int decode_ascii_ssetup(char **pbcc_area, __u16 bleft,
327 struct cifsSesInfo *ses, 327 struct cifsSesInfo *ses,
328 const struct nls_table *nls_cp) 328 const struct nls_table *nls_cp)
329{ 329{
@@ -575,12 +575,11 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses,
575 char *str_area; 575 char *str_area;
576 SESSION_SETUP_ANDX *pSMB; 576 SESSION_SETUP_ANDX *pSMB;
577 __u32 capabilities; 577 __u32 capabilities;
578 int count; 578 __u16 count;
579 int resp_buf_type; 579 int resp_buf_type;
580 struct kvec iov[3]; 580 struct kvec iov[3];
581 enum securityEnum type; 581 enum securityEnum type;
582 __u16 action; 582 __u16 action, bytes_remaining;
583 int bytes_remaining;
584 struct key *spnego_key = NULL; 583 struct key *spnego_key = NULL;
585 __le32 phase = NtLmNegotiate; /* NTLMSSP, if needed, is multistage */ 584 __le32 phase = NtLmNegotiate; /* NTLMSSP, if needed, is multistage */
586 u16 blob_len; 585 u16 blob_len;
@@ -876,10 +875,10 @@ ssetup_ntlmssp_authenticate:
876 count = iov[1].iov_len + iov[2].iov_len; 875 count = iov[1].iov_len + iov[2].iov_len;
877 smb_buf->smb_buf_length += count; 876 smb_buf->smb_buf_length += count;
878 877
879 BCC_LE(smb_buf) = cpu_to_le16(count); 878 put_bcc_le(count, smb_buf);
880 879
881 rc = SendReceive2(xid, ses, iov, 3 /* num_iovecs */, &resp_buf_type, 880 rc = SendReceive2(xid, ses, iov, 3 /* num_iovecs */, &resp_buf_type,
882 CIFS_STD_OP /* not long */ | CIFS_LOG_ERROR); 881 CIFS_LOG_ERROR);
883 /* SMB request buf freed in SendReceive2 */ 882 /* SMB request buf freed in SendReceive2 */
884 883
885 pSMB = (SESSION_SETUP_ANDX *)iov[0].iov_base; 884 pSMB = (SESSION_SETUP_ANDX *)iov[0].iov_base;
@@ -910,7 +909,7 @@ ssetup_ntlmssp_authenticate:
910 cFYI(1, "UID = %d ", ses->Suid); 909 cFYI(1, "UID = %d ", ses->Suid);
911 /* response can have either 3 or 4 word count - Samba sends 3 */ 910 /* response can have either 3 or 4 word count - Samba sends 3 */
912 /* and lanman response is 3 */ 911 /* and lanman response is 3 */
913 bytes_remaining = BCC(smb_buf); 912 bytes_remaining = get_bcc(smb_buf);
914 bcc_ptr = pByteArea(smb_buf); 913 bcc_ptr = pByteArea(smb_buf);
915 914
916 if (smb_buf->WordCount == 4) { 915 if (smb_buf->WordCount == 4) {
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 59ca81b16919..c1ccca1a933f 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -36,7 +36,13 @@
36 36
37extern mempool_t *cifs_mid_poolp; 37extern mempool_t *cifs_mid_poolp;
38 38
39static struct mid_q_entry * 39static void
40wake_up_task(struct mid_q_entry *mid)
41{
42 wake_up_process(mid->callback_data);
43}
44
45struct mid_q_entry *
40AllocMidQEntry(const struct smb_hdr *smb_buffer, struct TCP_Server_Info *server) 46AllocMidQEntry(const struct smb_hdr *smb_buffer, struct TCP_Server_Info *server)
41{ 47{
42 struct mid_q_entry *temp; 48 struct mid_q_entry *temp;
@@ -58,28 +64,28 @@ AllocMidQEntry(const struct smb_hdr *smb_buffer, struct TCP_Server_Info *server)
58 /* do_gettimeofday(&temp->when_sent);*/ /* easier to use jiffies */ 64 /* do_gettimeofday(&temp->when_sent);*/ /* easier to use jiffies */
59 /* when mid allocated can be before when sent */ 65 /* when mid allocated can be before when sent */
60 temp->when_alloc = jiffies; 66 temp->when_alloc = jiffies;
61 temp->tsk = current; 67
68 /*
69 * The default is for the mid to be synchronous, so the
70 * default callback just wakes up the current task.
71 */
72 temp->callback = wake_up_task;
73 temp->callback_data = current;
62 } 74 }
63 75
64 spin_lock(&GlobalMid_Lock);
65 list_add_tail(&temp->qhead, &server->pending_mid_q);
66 atomic_inc(&midCount); 76 atomic_inc(&midCount);
67 temp->midState = MID_REQUEST_ALLOCATED; 77 temp->midState = MID_REQUEST_ALLOCATED;
68 spin_unlock(&GlobalMid_Lock);
69 return temp; 78 return temp;
70} 79}
71 80
72static void 81void
73DeleteMidQEntry(struct mid_q_entry *midEntry) 82DeleteMidQEntry(struct mid_q_entry *midEntry)
74{ 83{
75#ifdef CONFIG_CIFS_STATS2 84#ifdef CONFIG_CIFS_STATS2
76 unsigned long now; 85 unsigned long now;
77#endif 86#endif
78 spin_lock(&GlobalMid_Lock);
79 midEntry->midState = MID_FREE; 87 midEntry->midState = MID_FREE;
80 list_del(&midEntry->qhead);
81 atomic_dec(&midCount); 88 atomic_dec(&midCount);
82 spin_unlock(&GlobalMid_Lock);
83 if (midEntry->largeBuf) 89 if (midEntry->largeBuf)
84 cifs_buf_release(midEntry->resp_buf); 90 cifs_buf_release(midEntry->resp_buf);
85 else 91 else
@@ -103,6 +109,16 @@ DeleteMidQEntry(struct mid_q_entry *midEntry)
103 mempool_free(midEntry, cifs_mid_poolp); 109 mempool_free(midEntry, cifs_mid_poolp);
104} 110}
105 111
112static void
113delete_mid(struct mid_q_entry *mid)
114{
115 spin_lock(&GlobalMid_Lock);
116 list_del(&mid->qhead);
117 spin_unlock(&GlobalMid_Lock);
118
119 DeleteMidQEntry(mid);
120}
121
106static int 122static int
107smb_sendv(struct TCP_Server_Info *server, struct kvec *iov, int n_vec) 123smb_sendv(struct TCP_Server_Info *server, struct kvec *iov, int n_vec)
108{ 124{
@@ -244,31 +260,31 @@ smb_send(struct TCP_Server_Info *server, struct smb_hdr *smb_buffer,
244 return smb_sendv(server, &iov, 1); 260 return smb_sendv(server, &iov, 1);
245} 261}
246 262
247static int wait_for_free_request(struct cifsSesInfo *ses, const int long_op) 263static int wait_for_free_request(struct TCP_Server_Info *server,
264 const int long_op)
248{ 265{
249 if (long_op == CIFS_ASYNC_OP) { 266 if (long_op == CIFS_ASYNC_OP) {
250 /* oplock breaks must not be held up */ 267 /* oplock breaks must not be held up */
251 atomic_inc(&ses->server->inFlight); 268 atomic_inc(&server->inFlight);
252 return 0; 269 return 0;
253 } 270 }
254 271
255 spin_lock(&GlobalMid_Lock); 272 spin_lock(&GlobalMid_Lock);
256 while (1) { 273 while (1) {
257 if (atomic_read(&ses->server->inFlight) >= 274 if (atomic_read(&server->inFlight) >= cifs_max_pending) {
258 cifs_max_pending){
259 spin_unlock(&GlobalMid_Lock); 275 spin_unlock(&GlobalMid_Lock);
260#ifdef CONFIG_CIFS_STATS2 276#ifdef CONFIG_CIFS_STATS2
261 atomic_inc(&ses->server->num_waiters); 277 atomic_inc(&server->num_waiters);
262#endif 278#endif
263 wait_event(ses->server->request_q, 279 wait_event(server->request_q,
264 atomic_read(&ses->server->inFlight) 280 atomic_read(&server->inFlight)
265 < cifs_max_pending); 281 < cifs_max_pending);
266#ifdef CONFIG_CIFS_STATS2 282#ifdef CONFIG_CIFS_STATS2
267 atomic_dec(&ses->server->num_waiters); 283 atomic_dec(&server->num_waiters);
268#endif 284#endif
269 spin_lock(&GlobalMid_Lock); 285 spin_lock(&GlobalMid_Lock);
270 } else { 286 } else {
271 if (ses->server->tcpStatus == CifsExiting) { 287 if (server->tcpStatus == CifsExiting) {
272 spin_unlock(&GlobalMid_Lock); 288 spin_unlock(&GlobalMid_Lock);
273 return -ENOENT; 289 return -ENOENT;
274 } 290 }
@@ -278,7 +294,7 @@ static int wait_for_free_request(struct cifsSesInfo *ses, const int long_op)
278 294
279 /* update # of requests on the wire to server */ 295 /* update # of requests on the wire to server */
280 if (long_op != CIFS_BLOCKING_OP) 296 if (long_op != CIFS_BLOCKING_OP)
281 atomic_inc(&ses->server->inFlight); 297 atomic_inc(&server->inFlight);
282 spin_unlock(&GlobalMid_Lock); 298 spin_unlock(&GlobalMid_Lock);
283 break; 299 break;
284 } 300 }
@@ -308,53 +324,81 @@ static int allocate_mid(struct cifsSesInfo *ses, struct smb_hdr *in_buf,
308 *ppmidQ = AllocMidQEntry(in_buf, ses->server); 324 *ppmidQ = AllocMidQEntry(in_buf, ses->server);
309 if (*ppmidQ == NULL) 325 if (*ppmidQ == NULL)
310 return -ENOMEM; 326 return -ENOMEM;
327 spin_lock(&GlobalMid_Lock);
328 list_add_tail(&(*ppmidQ)->qhead, &ses->server->pending_mid_q);
329 spin_unlock(&GlobalMid_Lock);
311 return 0; 330 return 0;
312} 331}
313 332
314static int wait_for_response(struct cifsSesInfo *ses, 333static int
315 struct mid_q_entry *midQ, 334wait_for_response(struct TCP_Server_Info *server, struct mid_q_entry *midQ)
316 unsigned long timeout,
317 unsigned long time_to_wait)
318{ 335{
319 unsigned long curr_timeout; 336 int error;
320 337
321 for (;;) { 338 error = wait_event_killable(server->response_q,
322 curr_timeout = timeout + jiffies; 339 midQ->midState != MID_REQUEST_SUBMITTED);
323 wait_event_timeout(ses->server->response_q, 340 if (error < 0)
324 midQ->midState != MID_REQUEST_SUBMITTED, timeout); 341 return -ERESTARTSYS;
325 342
326 if (time_after(jiffies, curr_timeout) && 343 return 0;
327 (midQ->midState == MID_REQUEST_SUBMITTED) && 344}
328 ((ses->server->tcpStatus == CifsGood) ||
329 (ses->server->tcpStatus == CifsNew))) {
330 345
331 unsigned long lrt;
332 346
333 /* We timed out. Is the server still 347/*
334 sending replies ? */ 348 * Send a SMB request and set the callback function in the mid to handle
335 spin_lock(&GlobalMid_Lock); 349 * the result. Caller is responsible for dealing with timeouts.
336 lrt = ses->server->lstrp; 350 */
337 spin_unlock(&GlobalMid_Lock); 351int
352cifs_call_async(struct TCP_Server_Info *server, struct smb_hdr *in_buf,
353 mid_callback_t *callback, void *cbdata)
354{
355 int rc;
356 struct mid_q_entry *mid;
338 357
339 /* Calculate time_to_wait past last receive time. 358 rc = wait_for_free_request(server, CIFS_ASYNC_OP);
340 Although we prefer not to time out if the 359 if (rc)
341 server is still responding - we will time 360 return rc;
342 out if the server takes more than 15 (or 45 361
343 or 180) seconds to respond to this request 362 mutex_lock(&server->srv_mutex);
344 and has not responded to any request from 363 mid = AllocMidQEntry(in_buf, server);
345 other threads on the client within 10 seconds */ 364 if (mid == NULL) {
346 lrt += time_to_wait; 365 mutex_unlock(&server->srv_mutex);
347 if (time_after(jiffies, lrt)) { 366 return -ENOMEM;
348 /* No replies for time_to_wait. */
349 cERROR(1, "server not responding");
350 return -1;
351 }
352 } else {
353 return 0;
354 }
355 } 367 }
356}
357 368
369 /* put it on the pending_mid_q */
370 spin_lock(&GlobalMid_Lock);
371 list_add_tail(&mid->qhead, &server->pending_mid_q);
372 spin_unlock(&GlobalMid_Lock);
373
374 rc = cifs_sign_smb(in_buf, server, &mid->sequence_number);
375 if (rc) {
376 mutex_unlock(&server->srv_mutex);
377 goto out_err;
378 }
379
380 mid->callback = callback;
381 mid->callback_data = cbdata;
382 mid->midState = MID_REQUEST_SUBMITTED;
383#ifdef CONFIG_CIFS_STATS2
384 atomic_inc(&server->inSend);
385#endif
386 rc = smb_send(server, in_buf, in_buf->smb_buf_length);
387#ifdef CONFIG_CIFS_STATS2
388 atomic_dec(&server->inSend);
389 mid->when_sent = jiffies;
390#endif
391 mutex_unlock(&server->srv_mutex);
392 if (rc)
393 goto out_err;
394
395 return rc;
396out_err:
397 delete_mid(mid);
398 atomic_dec(&server->inFlight);
399 wake_up(&server->request_q);
400 return rc;
401}
358 402
359/* 403/*
360 * 404 *
@@ -382,6 +426,81 @@ SendReceiveNoRsp(const unsigned int xid, struct cifsSesInfo *ses,
382 return rc; 426 return rc;
383} 427}
384 428
429static int
430sync_mid_result(struct mid_q_entry *mid, struct TCP_Server_Info *server)
431{
432 int rc = 0;
433
434 cFYI(1, "%s: cmd=%d mid=%d state=%d", __func__, mid->command,
435 mid->mid, mid->midState);
436
437 spin_lock(&GlobalMid_Lock);
438 /* ensure that it's no longer on the pending_mid_q */
439 list_del_init(&mid->qhead);
440
441 switch (mid->midState) {
442 case MID_RESPONSE_RECEIVED:
443 spin_unlock(&GlobalMid_Lock);
444 return rc;
445 case MID_REQUEST_SUBMITTED:
446 /* socket is going down, reject all calls */
447 if (server->tcpStatus == CifsExiting) {
448 cERROR(1, "%s: canceling mid=%d cmd=0x%x state=%d",
449 __func__, mid->mid, mid->command, mid->midState);
450 rc = -EHOSTDOWN;
451 break;
452 }
453 case MID_RETRY_NEEDED:
454 rc = -EAGAIN;
455 break;
456 default:
457 cERROR(1, "%s: invalid mid state mid=%d state=%d", __func__,
458 mid->mid, mid->midState);
459 rc = -EIO;
460 }
461 spin_unlock(&GlobalMid_Lock);
462
463 DeleteMidQEntry(mid);
464 return rc;
465}
466
467/*
468 * An NT cancel request header looks just like the original request except:
469 *
470 * The Command is SMB_COM_NT_CANCEL
471 * The WordCount is zeroed out
472 * The ByteCount is zeroed out
473 *
474 * This function mangles an existing request buffer into a
475 * SMB_COM_NT_CANCEL request and then sends it.
476 */
477static int
478send_nt_cancel(struct TCP_Server_Info *server, struct smb_hdr *in_buf,
479 struct mid_q_entry *mid)
480{
481 int rc = 0;
482
483 /* -4 for RFC1001 length and +2 for BCC field */
484 in_buf->smb_buf_length = sizeof(struct smb_hdr) - 4 + 2;
485 in_buf->Command = SMB_COM_NT_CANCEL;
486 in_buf->WordCount = 0;
487 put_bcc_le(0, in_buf);
488
489 mutex_lock(&server->srv_mutex);
490 rc = cifs_sign_smb(in_buf, server, &mid->sequence_number);
491 if (rc) {
492 mutex_unlock(&server->srv_mutex);
493 return rc;
494 }
495 rc = smb_send(server, in_buf, in_buf->smb_buf_length);
496 mutex_unlock(&server->srv_mutex);
497
498 cFYI(1, "issued NT_CANCEL for mid %u, rc = %d",
499 in_buf->Mid, rc);
500
501 return rc;
502}
503
385int 504int
386SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, 505SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
387 struct kvec *iov, int n_vec, int *pRespBufType /* ret */, 506 struct kvec *iov, int n_vec, int *pRespBufType /* ret */,
@@ -390,7 +509,6 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
390 int rc = 0; 509 int rc = 0;
391 int long_op; 510 int long_op;
392 unsigned int receive_len; 511 unsigned int receive_len;
393 unsigned long timeout;
394 struct mid_q_entry *midQ; 512 struct mid_q_entry *midQ;
395 struct smb_hdr *in_buf = iov[0].iov_base; 513 struct smb_hdr *in_buf = iov[0].iov_base;
396 514
@@ -413,7 +531,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
413 to the same server. We may make this configurable later or 531 to the same server. We may make this configurable later or
414 use ses->maxReq */ 532 use ses->maxReq */
415 533
416 rc = wait_for_free_request(ses, long_op); 534 rc = wait_for_free_request(ses->server, long_op);
417 if (rc) { 535 if (rc) {
418 cifs_small_buf_release(in_buf); 536 cifs_small_buf_release(in_buf);
419 return rc; 537 return rc;
@@ -457,65 +575,20 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
457 if (rc < 0) 575 if (rc < 0)
458 goto out; 576 goto out;
459 577
460 if (long_op == CIFS_STD_OP) 578 if (long_op == CIFS_ASYNC_OP)
461 timeout = 15 * HZ;
462 else if (long_op == CIFS_VLONG_OP) /* e.g. slow writes past EOF */
463 timeout = 180 * HZ;
464 else if (long_op == CIFS_LONG_OP)
465 timeout = 45 * HZ; /* should be greater than
466 servers oplock break timeout (about 43 seconds) */
467 else if (long_op == CIFS_ASYNC_OP)
468 goto out; 579 goto out;
469 else if (long_op == CIFS_BLOCKING_OP)
470 timeout = 0x7FFFFFFF; /* large, but not so large as to wrap */
471 else {
472 cERROR(1, "unknown timeout flag %d", long_op);
473 rc = -EIO;
474 goto out;
475 }
476
477 /* wait for 15 seconds or until woken up due to response arriving or
478 due to last connection to this server being unmounted */
479 if (signal_pending(current)) {
480 /* if signal pending do not hold up user for full smb timeout
481 but we still give response a chance to complete */
482 timeout = 2 * HZ;
483 }
484
485 /* No user interrupts in wait - wreaks havoc with performance */
486 wait_for_response(ses, midQ, timeout, 10 * HZ);
487
488 spin_lock(&GlobalMid_Lock);
489 580
490 if (midQ->resp_buf == NULL) { 581 rc = wait_for_response(ses->server, midQ);
491 cERROR(1, "No response to cmd %d mid %d", 582 if (rc != 0)
492 midQ->command, midQ->mid); 583 goto out;
493 if (midQ->midState == MID_REQUEST_SUBMITTED) {
494 if (ses->server->tcpStatus == CifsExiting)
495 rc = -EHOSTDOWN;
496 else {
497 ses->server->tcpStatus = CifsNeedReconnect;
498 midQ->midState = MID_RETRY_NEEDED;
499 }
500 }
501 584
502 if (rc != -EHOSTDOWN) { 585 rc = sync_mid_result(midQ, ses->server);
503 if (midQ->midState == MID_RETRY_NEEDED) { 586 if (rc != 0) {
504 rc = -EAGAIN;
505 cFYI(1, "marking request for retry");
506 } else {
507 rc = -EIO;
508 }
509 }
510 spin_unlock(&GlobalMid_Lock);
511 DeleteMidQEntry(midQ);
512 /* Update # of requests on wire to server */
513 atomic_dec(&ses->server->inFlight); 587 atomic_dec(&ses->server->inFlight);
514 wake_up(&ses->server->request_q); 588 wake_up(&ses->server->request_q);
515 return rc; 589 return rc;
516 } 590 }
517 591
518 spin_unlock(&GlobalMid_Lock);
519 receive_len = midQ->resp_buf->smb_buf_length; 592 receive_len = midQ->resp_buf->smb_buf_length;
520 593
521 if (receive_len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE) { 594 if (receive_len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE) {
@@ -559,19 +632,18 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
559 if (receive_len >= sizeof(struct smb_hdr) - 4 632 if (receive_len >= sizeof(struct smb_hdr) - 4
560 /* do not count RFC1001 header */ + 633 /* do not count RFC1001 header */ +
561 (2 * midQ->resp_buf->WordCount) + 2 /* bcc */ ) 634 (2 * midQ->resp_buf->WordCount) + 2 /* bcc */ )
562 BCC(midQ->resp_buf) = 635 put_bcc(get_bcc_le(midQ->resp_buf), midQ->resp_buf);
563 le16_to_cpu(BCC_LE(midQ->resp_buf));
564 if ((flags & CIFS_NO_RESP) == 0) 636 if ((flags & CIFS_NO_RESP) == 0)
565 midQ->resp_buf = NULL; /* mark it so buf will 637 midQ->resp_buf = NULL; /* mark it so buf will
566 not be freed by 638 not be freed by
567 DeleteMidQEntry */ 639 delete_mid */
568 } else { 640 } else {
569 rc = -EIO; 641 rc = -EIO;
570 cFYI(1, "Bad MID state?"); 642 cFYI(1, "Bad MID state?");
571 } 643 }
572 644
573out: 645out:
574 DeleteMidQEntry(midQ); 646 delete_mid(midQ);
575 atomic_dec(&ses->server->inFlight); 647 atomic_dec(&ses->server->inFlight);
576 wake_up(&ses->server->request_q); 648 wake_up(&ses->server->request_q);
577 649
@@ -585,7 +657,6 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
585{ 657{
586 int rc = 0; 658 int rc = 0;
587 unsigned int receive_len; 659 unsigned int receive_len;
588 unsigned long timeout;
589 struct mid_q_entry *midQ; 660 struct mid_q_entry *midQ;
590 661
591 if (ses == NULL) { 662 if (ses == NULL) {
@@ -610,7 +681,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
610 return -EIO; 681 return -EIO;
611 } 682 }
612 683
613 rc = wait_for_free_request(ses, long_op); 684 rc = wait_for_free_request(ses->server, long_op);
614 if (rc) 685 if (rc)
615 return rc; 686 return rc;
616 687
@@ -649,64 +720,20 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
649 if (rc < 0) 720 if (rc < 0)
650 goto out; 721 goto out;
651 722
652 if (long_op == CIFS_STD_OP) 723 if (long_op == CIFS_ASYNC_OP)
653 timeout = 15 * HZ;
654 /* wait for 15 seconds or until woken up due to response arriving or
655 due to last connection to this server being unmounted */
656 else if (long_op == CIFS_ASYNC_OP)
657 goto out; 724 goto out;
658 else if (long_op == CIFS_VLONG_OP) /* writes past EOF can be slow */
659 timeout = 180 * HZ;
660 else if (long_op == CIFS_LONG_OP)
661 timeout = 45 * HZ; /* should be greater than
662 servers oplock break timeout (about 43 seconds) */
663 else if (long_op == CIFS_BLOCKING_OP)
664 timeout = 0x7FFFFFFF; /* large but no so large as to wrap */
665 else {
666 cERROR(1, "unknown timeout flag %d", long_op);
667 rc = -EIO;
668 goto out;
669 }
670 725
671 if (signal_pending(current)) { 726 rc = wait_for_response(ses->server, midQ);
672 /* if signal pending do not hold up user for full smb timeout 727 if (rc != 0)
673 but we still give response a chance to complete */ 728 goto out;
674 timeout = 2 * HZ;
675 }
676
677 /* No user interrupts in wait - wreaks havoc with performance */
678 wait_for_response(ses, midQ, timeout, 10 * HZ);
679
680 spin_lock(&GlobalMid_Lock);
681 if (midQ->resp_buf == NULL) {
682 cERROR(1, "No response for cmd %d mid %d",
683 midQ->command, midQ->mid);
684 if (midQ->midState == MID_REQUEST_SUBMITTED) {
685 if (ses->server->tcpStatus == CifsExiting)
686 rc = -EHOSTDOWN;
687 else {
688 ses->server->tcpStatus = CifsNeedReconnect;
689 midQ->midState = MID_RETRY_NEEDED;
690 }
691 }
692 729
693 if (rc != -EHOSTDOWN) { 730 rc = sync_mid_result(midQ, ses->server);
694 if (midQ->midState == MID_RETRY_NEEDED) { 731 if (rc != 0) {
695 rc = -EAGAIN;
696 cFYI(1, "marking request for retry");
697 } else {
698 rc = -EIO;
699 }
700 }
701 spin_unlock(&GlobalMid_Lock);
702 DeleteMidQEntry(midQ);
703 /* Update # of requests on wire to server */
704 atomic_dec(&ses->server->inFlight); 732 atomic_dec(&ses->server->inFlight);
705 wake_up(&ses->server->request_q); 733 wake_up(&ses->server->request_q);
706 return rc; 734 return rc;
707 } 735 }
708 736
709 spin_unlock(&GlobalMid_Lock);
710 receive_len = midQ->resp_buf->smb_buf_length; 737 receive_len = midQ->resp_buf->smb_buf_length;
711 738
712 if (receive_len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE) { 739 if (receive_len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE) {
@@ -748,43 +775,20 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
748 if (receive_len >= sizeof(struct smb_hdr) - 4 775 if (receive_len >= sizeof(struct smb_hdr) - 4
749 /* do not count RFC1001 header */ + 776 /* do not count RFC1001 header */ +
750 (2 * out_buf->WordCount) + 2 /* bcc */ ) 777 (2 * out_buf->WordCount) + 2 /* bcc */ )
751 BCC(out_buf) = le16_to_cpu(BCC_LE(out_buf)); 778 put_bcc(get_bcc_le(midQ->resp_buf), midQ->resp_buf);
752 } else { 779 } else {
753 rc = -EIO; 780 rc = -EIO;
754 cERROR(1, "Bad MID state?"); 781 cERROR(1, "Bad MID state?");
755 } 782 }
756 783
757out: 784out:
758 DeleteMidQEntry(midQ); 785 delete_mid(midQ);
759 atomic_dec(&ses->server->inFlight); 786 atomic_dec(&ses->server->inFlight);
760 wake_up(&ses->server->request_q); 787 wake_up(&ses->server->request_q);
761 788
762 return rc; 789 return rc;
763} 790}
764 791
765/* Send an NT_CANCEL SMB to cause the POSIX blocking lock to return. */
766
767static int
768send_nt_cancel(struct cifsTconInfo *tcon, struct smb_hdr *in_buf,
769 struct mid_q_entry *midQ)
770{
771 int rc = 0;
772 struct cifsSesInfo *ses = tcon->ses;
773 __u16 mid = in_buf->Mid;
774
775 header_assemble(in_buf, SMB_COM_NT_CANCEL, tcon, 0);
776 in_buf->Mid = mid;
777 mutex_lock(&ses->server->srv_mutex);
778 rc = cifs_sign_smb(in_buf, ses->server, &midQ->sequence_number);
779 if (rc) {
780 mutex_unlock(&ses->server->srv_mutex);
781 return rc;
782 }
783 rc = smb_send(ses->server, in_buf, in_buf->smb_buf_length);
784 mutex_unlock(&ses->server->srv_mutex);
785 return rc;
786}
787
788/* We send a LOCKINGX_CANCEL_LOCK to cause the Windows 792/* We send a LOCKINGX_CANCEL_LOCK to cause the Windows
789 blocking lock to return. */ 793 blocking lock to return. */
790 794
@@ -807,7 +811,7 @@ send_lock_cancel(const unsigned int xid, struct cifsTconInfo *tcon,
807 pSMB->hdr.Mid = GetNextMid(ses->server); 811 pSMB->hdr.Mid = GetNextMid(ses->server);
808 812
809 return SendReceive(xid, ses, in_buf, out_buf, 813 return SendReceive(xid, ses, in_buf, out_buf,
810 &bytes_returned, CIFS_STD_OP); 814 &bytes_returned, 0);
811} 815}
812 816
813int 817int
@@ -845,7 +849,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
845 return -EIO; 849 return -EIO;
846 } 850 }
847 851
848 rc = wait_for_free_request(ses, CIFS_BLOCKING_OP); 852 rc = wait_for_free_request(ses->server, CIFS_BLOCKING_OP);
849 if (rc) 853 if (rc)
850 return rc; 854 return rc;
851 855
@@ -863,7 +867,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
863 867
864 rc = cifs_sign_smb(in_buf, ses->server, &midQ->sequence_number); 868 rc = cifs_sign_smb(in_buf, ses->server, &midQ->sequence_number);
865 if (rc) { 869 if (rc) {
866 DeleteMidQEntry(midQ); 870 delete_mid(midQ);
867 mutex_unlock(&ses->server->srv_mutex); 871 mutex_unlock(&ses->server->srv_mutex);
868 return rc; 872 return rc;
869 } 873 }
@@ -880,7 +884,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
880 mutex_unlock(&ses->server->srv_mutex); 884 mutex_unlock(&ses->server->srv_mutex);
881 885
882 if (rc < 0) { 886 if (rc < 0) {
883 DeleteMidQEntry(midQ); 887 delete_mid(midQ);
884 return rc; 888 return rc;
885 } 889 }
886 890
@@ -899,10 +903,9 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
899 if (in_buf->Command == SMB_COM_TRANSACTION2) { 903 if (in_buf->Command == SMB_COM_TRANSACTION2) {
900 /* POSIX lock. We send a NT_CANCEL SMB to cause the 904 /* POSIX lock. We send a NT_CANCEL SMB to cause the
901 blocking lock to return. */ 905 blocking lock to return. */
902 906 rc = send_nt_cancel(ses->server, in_buf, midQ);
903 rc = send_nt_cancel(tcon, in_buf, midQ);
904 if (rc) { 907 if (rc) {
905 DeleteMidQEntry(midQ); 908 delete_mid(midQ);
906 return rc; 909 return rc;
907 } 910 }
908 } else { 911 } else {
@@ -914,47 +917,22 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
914 /* If we get -ENOLCK back the lock may have 917 /* If we get -ENOLCK back the lock may have
915 already been removed. Don't exit in this case. */ 918 already been removed. Don't exit in this case. */
916 if (rc && rc != -ENOLCK) { 919 if (rc && rc != -ENOLCK) {
917 DeleteMidQEntry(midQ); 920 delete_mid(midQ);
918 return rc; 921 return rc;
919 } 922 }
920 } 923 }
921 924
922 /* Wait 5 seconds for the response. */ 925 if (wait_for_response(ses->server, midQ) == 0) {
923 if (wait_for_response(ses, midQ, 5 * HZ, 5 * HZ) == 0) {
924 /* We got the response - restart system call. */ 926 /* We got the response - restart system call. */
925 rstart = 1; 927 rstart = 1;
926 } 928 }
927 } 929 }
928 930
929 spin_lock(&GlobalMid_Lock); 931 rc = sync_mid_result(midQ, ses->server);
930 if (midQ->resp_buf) { 932 if (rc != 0)
931 spin_unlock(&GlobalMid_Lock);
932 receive_len = midQ->resp_buf->smb_buf_length;
933 } else {
934 cERROR(1, "No response for cmd %d mid %d",
935 midQ->command, midQ->mid);
936 if (midQ->midState == MID_REQUEST_SUBMITTED) {
937 if (ses->server->tcpStatus == CifsExiting)
938 rc = -EHOSTDOWN;
939 else {
940 ses->server->tcpStatus = CifsNeedReconnect;
941 midQ->midState = MID_RETRY_NEEDED;
942 }
943 }
944
945 if (rc != -EHOSTDOWN) {
946 if (midQ->midState == MID_RETRY_NEEDED) {
947 rc = -EAGAIN;
948 cFYI(1, "marking request for retry");
949 } else {
950 rc = -EIO;
951 }
952 }
953 spin_unlock(&GlobalMid_Lock);
954 DeleteMidQEntry(midQ);
955 return rc; 933 return rc;
956 }
957 934
935 receive_len = midQ->resp_buf->smb_buf_length;
958 if (receive_len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE) { 936 if (receive_len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE) {
959 cERROR(1, "Frame too large received. Length: %d Xid: %d", 937 cERROR(1, "Frame too large received. Length: %d Xid: %d",
960 receive_len, xid); 938 receive_len, xid);
@@ -998,10 +976,10 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
998 if (receive_len >= sizeof(struct smb_hdr) - 4 976 if (receive_len >= sizeof(struct smb_hdr) - 4
999 /* do not count RFC1001 header */ + 977 /* do not count RFC1001 header */ +
1000 (2 * out_buf->WordCount) + 2 /* bcc */ ) 978 (2 * out_buf->WordCount) + 2 /* bcc */ )
1001 BCC(out_buf) = le16_to_cpu(BCC_LE(out_buf)); 979 put_bcc(get_bcc_le(out_buf), out_buf);
1002 980
1003out: 981out:
1004 DeleteMidQEntry(midQ); 982 delete_mid(midQ);
1005 if (rstart && rc == -EACCES) 983 if (rstart && rc == -EACCES)
1006 return -ERESTARTSYS; 984 return -ERESTARTSYS;
1007 return rc; 985 return rc;
diff --git a/fs/direct-io.c b/fs/direct-io.c
index 85882f6ba5f7..b044705eedd4 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -325,12 +325,16 @@ void dio_end_io(struct bio *bio, int error)
325} 325}
326EXPORT_SYMBOL_GPL(dio_end_io); 326EXPORT_SYMBOL_GPL(dio_end_io);
327 327
328static int 328static void
329dio_bio_alloc(struct dio *dio, struct block_device *bdev, 329dio_bio_alloc(struct dio *dio, struct block_device *bdev,
330 sector_t first_sector, int nr_vecs) 330 sector_t first_sector, int nr_vecs)
331{ 331{
332 struct bio *bio; 332 struct bio *bio;
333 333
334 /*
335 * bio_alloc() is guaranteed to return a bio when called with
336 * __GFP_WAIT and we request a valid number of vectors.
337 */
334 bio = bio_alloc(GFP_KERNEL, nr_vecs); 338 bio = bio_alloc(GFP_KERNEL, nr_vecs);
335 339
336 bio->bi_bdev = bdev; 340 bio->bi_bdev = bdev;
@@ -342,7 +346,6 @@ dio_bio_alloc(struct dio *dio, struct block_device *bdev,
342 346
343 dio->bio = bio; 347 dio->bio = bio;
344 dio->logical_offset_in_bio = dio->cur_page_fs_offset; 348 dio->logical_offset_in_bio = dio->cur_page_fs_offset;
345 return 0;
346} 349}
347 350
348/* 351/*
@@ -583,8 +586,9 @@ static int dio_new_bio(struct dio *dio, sector_t start_sector)
583 goto out; 586 goto out;
584 sector = start_sector << (dio->blkbits - 9); 587 sector = start_sector << (dio->blkbits - 9);
585 nr_pages = min(dio->pages_in_io, bio_get_nr_vecs(dio->map_bh.b_bdev)); 588 nr_pages = min(dio->pages_in_io, bio_get_nr_vecs(dio->map_bh.b_bdev));
589 nr_pages = min(nr_pages, BIO_MAX_PAGES);
586 BUG_ON(nr_pages <= 0); 590 BUG_ON(nr_pages <= 0);
587 ret = dio_bio_alloc(dio, dio->map_bh.b_bdev, sector, nr_pages); 591 dio_bio_alloc(dio, dio->map_bh.b_bdev, sector, nr_pages);
588 dio->boundary = 0; 592 dio->boundary = 0;
589out: 593out:
590 return ret; 594 return ret;
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 7aa767d4f06f..85c8cc8f2473 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -754,7 +754,7 @@ static int ext3_release_dquot(struct dquot *dquot);
754static int ext3_mark_dquot_dirty(struct dquot *dquot); 754static int ext3_mark_dquot_dirty(struct dquot *dquot);
755static int ext3_write_info(struct super_block *sb, int type); 755static int ext3_write_info(struct super_block *sb, int type);
756static int ext3_quota_on(struct super_block *sb, int type, int format_id, 756static int ext3_quota_on(struct super_block *sb, int type, int format_id,
757 char *path); 757 struct path *path);
758static int ext3_quota_on_mount(struct super_block *sb, int type); 758static int ext3_quota_on_mount(struct super_block *sb, int type);
759static ssize_t ext3_quota_read(struct super_block *sb, int type, char *data, 759static ssize_t ext3_quota_read(struct super_block *sb, int type, char *data,
760 size_t len, loff_t off); 760 size_t len, loff_t off);
@@ -2877,27 +2877,20 @@ static int ext3_quota_on_mount(struct super_block *sb, int type)
2877 * Standard function to be called on quota_on 2877 * Standard function to be called on quota_on
2878 */ 2878 */
2879static int ext3_quota_on(struct super_block *sb, int type, int format_id, 2879static int ext3_quota_on(struct super_block *sb, int type, int format_id,
2880 char *name) 2880 struct path *path)
2881{ 2881{
2882 int err; 2882 int err;
2883 struct path path;
2884 2883
2885 if (!test_opt(sb, QUOTA)) 2884 if (!test_opt(sb, QUOTA))
2886 return -EINVAL; 2885 return -EINVAL;
2887 2886
2888 err = kern_path(name, LOOKUP_FOLLOW, &path);
2889 if (err)
2890 return err;
2891
2892 /* Quotafile not on the same filesystem? */ 2887 /* Quotafile not on the same filesystem? */
2893 if (path.mnt->mnt_sb != sb) { 2888 if (path->mnt->mnt_sb != sb)
2894 path_put(&path);
2895 return -EXDEV; 2889 return -EXDEV;
2896 }
2897 /* Journaling quota? */ 2890 /* Journaling quota? */
2898 if (EXT3_SB(sb)->s_qf_names[type]) { 2891 if (EXT3_SB(sb)->s_qf_names[type]) {
2899 /* Quotafile not of fs root? */ 2892 /* Quotafile not of fs root? */
2900 if (path.dentry->d_parent != sb->s_root) 2893 if (path->dentry->d_parent != sb->s_root)
2901 ext3_msg(sb, KERN_WARNING, 2894 ext3_msg(sb, KERN_WARNING,
2902 "warning: Quota file not on filesystem root. " 2895 "warning: Quota file not on filesystem root. "
2903 "Journaled quota will not work."); 2896 "Journaled quota will not work.");
@@ -2907,7 +2900,7 @@ static int ext3_quota_on(struct super_block *sb, int type, int format_id,
2907 * When we journal data on quota file, we have to flush journal to see 2900 * When we journal data on quota file, we have to flush journal to see
2908 * all updates to the file when we bypass pagecache... 2901 * all updates to the file when we bypass pagecache...
2909 */ 2902 */
2910 if (ext3_should_journal_data(path.dentry->d_inode)) { 2903 if (ext3_should_journal_data(path->dentry->d_inode)) {
2911 /* 2904 /*
2912 * We don't need to lock updates but journal_flush() could 2905 * We don't need to lock updates but journal_flush() could
2913 * otherwise be livelocked... 2906 * otherwise be livelocked...
@@ -2915,15 +2908,11 @@ static int ext3_quota_on(struct super_block *sb, int type, int format_id,
2915 journal_lock_updates(EXT3_SB(sb)->s_journal); 2908 journal_lock_updates(EXT3_SB(sb)->s_journal);
2916 err = journal_flush(EXT3_SB(sb)->s_journal); 2909 err = journal_flush(EXT3_SB(sb)->s_journal);
2917 journal_unlock_updates(EXT3_SB(sb)->s_journal); 2910 journal_unlock_updates(EXT3_SB(sb)->s_journal);
2918 if (err) { 2911 if (err)
2919 path_put(&path);
2920 return err; 2912 return err;
2921 }
2922 } 2913 }
2923 2914
2924 err = dquot_quota_on_path(sb, type, format_id, &path); 2915 return dquot_quota_on(sb, type, format_id, path);
2925 path_put(&path);
2926 return err;
2927} 2916}
2928 2917
2929/* Read data from quotafile - avoid pagecache and such because we cannot afford 2918/* Read data from quotafile - avoid pagecache and such because we cannot afford
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index cb10a06775e4..48ce561fafac 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1161,7 +1161,7 @@ static int ext4_release_dquot(struct dquot *dquot);
1161static int ext4_mark_dquot_dirty(struct dquot *dquot); 1161static int ext4_mark_dquot_dirty(struct dquot *dquot);
1162static int ext4_write_info(struct super_block *sb, int type); 1162static int ext4_write_info(struct super_block *sb, int type);
1163static int ext4_quota_on(struct super_block *sb, int type, int format_id, 1163static int ext4_quota_on(struct super_block *sb, int type, int format_id,
1164 char *path); 1164 struct path *path);
1165static int ext4_quota_off(struct super_block *sb, int type); 1165static int ext4_quota_off(struct super_block *sb, int type);
1166static int ext4_quota_on_mount(struct super_block *sb, int type); 1166static int ext4_quota_on_mount(struct super_block *sb, int type);
1167static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data, 1167static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data,
@@ -4558,27 +4558,20 @@ static int ext4_quota_on_mount(struct super_block *sb, int type)
4558 * Standard function to be called on quota_on 4558 * Standard function to be called on quota_on
4559 */ 4559 */
4560static int ext4_quota_on(struct super_block *sb, int type, int format_id, 4560static int ext4_quota_on(struct super_block *sb, int type, int format_id,
4561 char *name) 4561 struct path *path)
4562{ 4562{
4563 int err; 4563 int err;
4564 struct path path;
4565 4564
4566 if (!test_opt(sb, QUOTA)) 4565 if (!test_opt(sb, QUOTA))
4567 return -EINVAL; 4566 return -EINVAL;
4568 4567
4569 err = kern_path(name, LOOKUP_FOLLOW, &path);
4570 if (err)
4571 return err;
4572
4573 /* Quotafile not on the same filesystem? */ 4568 /* Quotafile not on the same filesystem? */
4574 if (path.mnt->mnt_sb != sb) { 4569 if (path->mnt->mnt_sb != sb)
4575 path_put(&path);
4576 return -EXDEV; 4570 return -EXDEV;
4577 }
4578 /* Journaling quota? */ 4571 /* Journaling quota? */
4579 if (EXT4_SB(sb)->s_qf_names[type]) { 4572 if (EXT4_SB(sb)->s_qf_names[type]) {
4580 /* Quotafile not in fs root? */ 4573 /* Quotafile not in fs root? */
4581 if (path.dentry->d_parent != sb->s_root) 4574 if (path->dentry->d_parent != sb->s_root)
4582 ext4_msg(sb, KERN_WARNING, 4575 ext4_msg(sb, KERN_WARNING,
4583 "Quota file not on filesystem root. " 4576 "Quota file not on filesystem root. "
4584 "Journaled quota will not work"); 4577 "Journaled quota will not work");
@@ -4589,7 +4582,7 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
4589 * all updates to the file when we bypass pagecache... 4582 * all updates to the file when we bypass pagecache...
4590 */ 4583 */
4591 if (EXT4_SB(sb)->s_journal && 4584 if (EXT4_SB(sb)->s_journal &&
4592 ext4_should_journal_data(path.dentry->d_inode)) { 4585 ext4_should_journal_data(path->dentry->d_inode)) {
4593 /* 4586 /*
4594 * We don't need to lock updates but journal_flush() could 4587 * We don't need to lock updates but journal_flush() could
4595 * otherwise be livelocked... 4588 * otherwise be livelocked...
@@ -4597,15 +4590,11 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
4597 jbd2_journal_lock_updates(EXT4_SB(sb)->s_journal); 4590 jbd2_journal_lock_updates(EXT4_SB(sb)->s_journal);
4598 err = jbd2_journal_flush(EXT4_SB(sb)->s_journal); 4591 err = jbd2_journal_flush(EXT4_SB(sb)->s_journal);
4599 jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal); 4592 jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal);
4600 if (err) { 4593 if (err)
4601 path_put(&path);
4602 return err; 4594 return err;
4603 }
4604 } 4595 }
4605 4596
4606 err = dquot_quota_on_path(sb, type, format_id, &path); 4597 return dquot_quota_on(sb, type, format_id, path);
4607 path_put(&path);
4608 return err;
4609} 4598}
4610 4599
4611static int ext4_quota_off(struct super_block *sb, int type) 4600static int ext4_quota_off(struct super_block *sb, int type)
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 2232b3c780bd..7aa7d4f8984a 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -74,16 +74,14 @@ static struct inode *gfs2_iget(struct super_block *sb, u64 no_addr)
74} 74}
75 75
76/** 76/**
77 * GFS2 lookup code fills in vfs inode contents based on info obtained 77 * gfs2_set_iop - Sets inode operations
78 * from directory entry inside gfs2_inode_lookup(). This has caused issues 78 * @inode: The inode with correct i_mode filled in
79 * with NFS code path since its get_dentry routine doesn't have the relevant
80 * directory entry when gfs2_inode_lookup() is invoked. Part of the code
81 * segment inside gfs2_inode_lookup code needs to get moved around.
82 * 79 *
83 * Clears I_NEW as well. 80 * GFS2 lookup code fills in vfs inode contents based on info obtained
84 **/ 81 * from directory entry inside gfs2_inode_lookup().
82 */
85 83
86void gfs2_set_iop(struct inode *inode) 84static void gfs2_set_iop(struct inode *inode)
87{ 85{
88 struct gfs2_sbd *sdp = GFS2_SB(inode); 86 struct gfs2_sbd *sdp = GFS2_SB(inode);
89 umode_t mode = inode->i_mode; 87 umode_t mode = inode->i_mode;
@@ -106,8 +104,6 @@ void gfs2_set_iop(struct inode *inode)
106 inode->i_op = &gfs2_file_iops; 104 inode->i_op = &gfs2_file_iops;
107 init_special_inode(inode, inode->i_mode, inode->i_rdev); 105 init_special_inode(inode, inode->i_mode, inode->i_rdev);
108 } 106 }
109
110 unlock_new_inode(inode);
111} 107}
112 108
113/** 109/**
@@ -119,10 +115,8 @@ void gfs2_set_iop(struct inode *inode)
119 * Returns: A VFS inode, or an error 115 * Returns: A VFS inode, or an error
120 */ 116 */
121 117
122struct inode *gfs2_inode_lookup(struct super_block *sb, 118struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned int type,
123 unsigned int type, 119 u64 no_addr, u64 no_formal_ino)
124 u64 no_addr,
125 u64 no_formal_ino)
126{ 120{
127 struct inode *inode; 121 struct inode *inode;
128 struct gfs2_inode *ip; 122 struct gfs2_inode *ip;
@@ -152,51 +146,37 @@ struct inode *gfs2_inode_lookup(struct super_block *sb,
152 error = gfs2_glock_nq_init(io_gl, LM_ST_SHARED, GL_EXACT, &ip->i_iopen_gh); 146 error = gfs2_glock_nq_init(io_gl, LM_ST_SHARED, GL_EXACT, &ip->i_iopen_gh);
153 if (unlikely(error)) 147 if (unlikely(error))
154 goto fail_iopen; 148 goto fail_iopen;
155 ip->i_iopen_gh.gh_gl->gl_object = ip;
156 149
150 ip->i_iopen_gh.gh_gl->gl_object = ip;
157 gfs2_glock_put(io_gl); 151 gfs2_glock_put(io_gl);
158 io_gl = NULL; 152 io_gl = NULL;
159 153
160 if ((type == DT_UNKNOWN) && (no_formal_ino == 0))
161 goto gfs2_nfsbypass;
162
163 inode->i_mode = DT2IF(type);
164
165 /*
166 * We must read the inode in order to work out its type in
167 * this case. Note that this doesn't happen often as we normally
168 * know the type beforehand. This code path only occurs during
169 * unlinked inode recovery (where it is safe to do this glock,
170 * which is not true in the general case).
171 */
172 if (type == DT_UNKNOWN) { 154 if (type == DT_UNKNOWN) {
173 struct gfs2_holder gh; 155 /* Inode glock must be locked already */
174 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); 156 error = gfs2_inode_refresh(GFS2_I(inode));
175 if (unlikely(error)) 157 if (error)
176 goto fail_glock; 158 goto fail_refresh;
177 /* Inode is now uptodate */ 159 } else {
178 gfs2_glock_dq_uninit(&gh); 160 inode->i_mode = DT2IF(type);
179 } 161 }
180 162
181 gfs2_set_iop(inode); 163 gfs2_set_iop(inode);
164 unlock_new_inode(inode);
182 } 165 }
183 166
184gfs2_nfsbypass:
185 return inode; 167 return inode;
186fail_glock: 168
187 gfs2_glock_dq(&ip->i_iopen_gh); 169fail_refresh:
170 ip->i_iopen_gh.gh_gl->gl_object = NULL;
171 gfs2_glock_dq_uninit(&ip->i_iopen_gh);
188fail_iopen: 172fail_iopen:
189 if (io_gl) 173 if (io_gl)
190 gfs2_glock_put(io_gl); 174 gfs2_glock_put(io_gl);
191fail_put: 175fail_put:
192 if (inode->i_state & I_NEW) 176 ip->i_gl->gl_object = NULL;
193 ip->i_gl->gl_object = NULL;
194 gfs2_glock_put(ip->i_gl); 177 gfs2_glock_put(ip->i_gl);
195fail: 178fail:
196 if (inode->i_state & I_NEW) 179 iget_failed(inode);
197 iget_failed(inode);
198 else
199 iput(inode);
200 return ERR_PTR(error); 180 return ERR_PTR(error);
201} 181}
202 182
@@ -221,14 +201,6 @@ struct inode *gfs2_lookup_by_inum(struct gfs2_sbd *sdp, u64 no_addr,
221 if (IS_ERR(inode)) 201 if (IS_ERR(inode))
222 goto fail; 202 goto fail;
223 203
224 error = gfs2_inode_refresh(GFS2_I(inode));
225 if (error)
226 goto fail_iput;
227
228 /* Pick up the works we bypass in gfs2_inode_lookup */
229 if (inode->i_state & I_NEW)
230 gfs2_set_iop(inode);
231
232 /* Two extra checks for NFS only */ 204 /* Two extra checks for NFS only */
233 if (no_formal_ino) { 205 if (no_formal_ino) {
234 error = -ESTALE; 206 error = -ESTALE;
diff --git a/fs/gfs2/inode.h b/fs/gfs2/inode.h
index 732a183efdb3..3e00a66e7cbd 100644
--- a/fs/gfs2/inode.h
+++ b/fs/gfs2/inode.h
@@ -96,7 +96,6 @@ err:
96 return -EIO; 96 return -EIO;
97} 97}
98 98
99extern void gfs2_set_iop(struct inode *inode);
100extern struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned type, 99extern struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned type,
101 u64 no_addr, u64 no_formal_ino); 100 u64 no_addr, u64 no_formal_ino);
102extern struct inode *gfs2_lookup_by_inum(struct gfs2_sbd *sdp, u64 no_addr, 101extern struct inode *gfs2_lookup_by_inum(struct gfs2_sbd *sdp, u64 no_addr,
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index 16c2ecac7eb7..ec73ed70bae1 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -1336,6 +1336,7 @@ static void gfs2_evict_inode(struct inode *inode)
1336 if (error) 1336 if (error)
1337 goto out_truncate; 1337 goto out_truncate;
1338 1338
1339 ip->i_iopen_gh.gh_flags |= GL_NOCACHE;
1339 gfs2_glock_dq_wait(&ip->i_iopen_gh); 1340 gfs2_glock_dq_wait(&ip->i_iopen_gh);
1340 gfs2_holder_reinit(LM_ST_EXCLUSIVE, LM_FLAG_TRY_1CB | GL_NOCACHE, &ip->i_iopen_gh); 1341 gfs2_holder_reinit(LM_ST_EXCLUSIVE, LM_FLAG_TRY_1CB | GL_NOCACHE, &ip->i_iopen_gh);
1341 error = gfs2_glock_nq(&ip->i_iopen_gh); 1342 error = gfs2_glock_nq(&ip->i_iopen_gh);
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 06d1f749ca89..38f986d2447e 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -993,8 +993,7 @@ static void ocfs2_disable_quotas(struct ocfs2_super *osb)
993} 993}
994 994
995/* Handle quota on quotactl */ 995/* Handle quota on quotactl */
996static int ocfs2_quota_on(struct super_block *sb, int type, int format_id, 996static int ocfs2_quota_on(struct super_block *sb, int type, int format_id)
997 char *path)
998{ 997{
999 unsigned int feature[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA, 998 unsigned int feature[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA,
1000 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA}; 999 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA};
@@ -1013,7 +1012,7 @@ static int ocfs2_quota_off(struct super_block *sb, int type)
1013} 1012}
1014 1013
1015static const struct quotactl_ops ocfs2_quotactl_ops = { 1014static const struct quotactl_ops ocfs2_quotactl_ops = {
1016 .quota_on = ocfs2_quota_on, 1015 .quota_on_meta = ocfs2_quota_on,
1017 .quota_off = ocfs2_quota_off, 1016 .quota_off = ocfs2_quota_off,
1018 .quota_sync = dquot_quota_sync, 1017 .quota_sync = dquot_quota_sync,
1019 .get_info = dquot_get_dqinfo, 1018 .get_info = dquot_get_dqinfo,
diff --git a/fs/pipe.c b/fs/pipe.c
index 89e9e19b1b2e..da42f7db50de 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -441,7 +441,7 @@ redo:
441 break; 441 break;
442 } 442 }
443 if (do_wakeup) { 443 if (do_wakeup) {
444 wake_up_interruptible_sync_poll(&pipe->wait, POLLOUT); 444 wake_up_interruptible_sync_poll(&pipe->wait, POLLOUT | POLLWRNORM);
445 kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT); 445 kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT);
446 } 446 }
447 pipe_wait(pipe); 447 pipe_wait(pipe);
@@ -450,7 +450,7 @@ redo:
450 450
451 /* Signal writers asynchronously that there is more room. */ 451 /* Signal writers asynchronously that there is more room. */
452 if (do_wakeup) { 452 if (do_wakeup) {
453 wake_up_interruptible_sync_poll(&pipe->wait, POLLOUT); 453 wake_up_interruptible_sync_poll(&pipe->wait, POLLOUT | POLLWRNORM);
454 kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT); 454 kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT);
455 } 455 }
456 if (ret > 0) 456 if (ret > 0)
@@ -612,7 +612,7 @@ redo2:
612 break; 612 break;
613 } 613 }
614 if (do_wakeup) { 614 if (do_wakeup) {
615 wake_up_interruptible_sync_poll(&pipe->wait, POLLIN); 615 wake_up_interruptible_sync_poll(&pipe->wait, POLLIN | POLLRDNORM);
616 kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); 616 kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
617 do_wakeup = 0; 617 do_wakeup = 0;
618 } 618 }
@@ -623,7 +623,7 @@ redo2:
623out: 623out:
624 mutex_unlock(&inode->i_mutex); 624 mutex_unlock(&inode->i_mutex);
625 if (do_wakeup) { 625 if (do_wakeup) {
626 wake_up_interruptible_sync_poll(&pipe->wait, POLLIN); 626 wake_up_interruptible_sync_poll(&pipe->wait, POLLIN | POLLRDNORM);
627 kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); 627 kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
628 } 628 }
629 if (ret > 0) 629 if (ret > 0)
@@ -715,7 +715,7 @@ pipe_release(struct inode *inode, int decr, int decw)
715 if (!pipe->readers && !pipe->writers) { 715 if (!pipe->readers && !pipe->writers) {
716 free_pipe_info(inode); 716 free_pipe_info(inode);
717 } else { 717 } else {
718 wake_up_interruptible_sync_poll(&pipe->wait, POLLIN | POLLOUT); 718 wake_up_interruptible_sync_poll(&pipe->wait, POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM | POLLERR | POLLHUP);
719 kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); 719 kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
720 kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT); 720 kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT);
721 } 721 }
diff --git a/fs/proc/Kconfig b/fs/proc/Kconfig
index 6a0068841d96..15af6222f8a4 100644
--- a/fs/proc/Kconfig
+++ b/fs/proc/Kconfig
@@ -1,5 +1,5 @@
1config PROC_FS 1config PROC_FS
2 bool "/proc file system support" if EMBEDDED 2 bool "/proc file system support" if EXPERT
3 default y 3 default y
4 help 4 help
5 This is a virtual file system providing information about the status 5 This is a virtual file system providing information about the status
@@ -40,7 +40,7 @@ config PROC_VMCORE
40 Exports the dump image of crashed kernel in ELF format. 40 Exports the dump image of crashed kernel in ELF format.
41 41
42config PROC_SYSCTL 42config PROC_SYSCTL
43 bool "Sysctl support (/proc/sys)" if EMBEDDED 43 bool "Sysctl support (/proc/sys)" if EXPERT
44 depends on PROC_FS 44 depends on PROC_FS
45 select SYSCTL 45 select SYSCTL
46 default y 46 default y
@@ -61,7 +61,7 @@ config PROC_SYSCTL
61config PROC_PAGE_MONITOR 61config PROC_PAGE_MONITOR
62 default y 62 default y
63 depends on PROC_FS && MMU 63 depends on PROC_FS && MMU
64 bool "Enable /proc page monitoring" if EMBEDDED 64 bool "Enable /proc page monitoring" if EXPERT
65 help 65 help
66 Various /proc files exist to monitor process memory utilization: 66 Various /proc files exist to monitor process memory utilization:
67 /proc/pid/smaps, /proc/pid/clear_refs, /proc/pid/pagemap, 67 /proc/pid/smaps, /proc/pid/clear_refs, /proc/pid/pagemap,
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 84becd3e4772..a2a622e079f0 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -2189,8 +2189,8 @@ int dquot_resume(struct super_block *sb, int type)
2189} 2189}
2190EXPORT_SYMBOL(dquot_resume); 2190EXPORT_SYMBOL(dquot_resume);
2191 2191
2192int dquot_quota_on_path(struct super_block *sb, int type, int format_id, 2192int dquot_quota_on(struct super_block *sb, int type, int format_id,
2193 struct path *path) 2193 struct path *path)
2194{ 2194{
2195 int error = security_quota_on(path->dentry); 2195 int error = security_quota_on(path->dentry);
2196 if (error) 2196 if (error)
@@ -2204,20 +2204,6 @@ int dquot_quota_on_path(struct super_block *sb, int type, int format_id,
2204 DQUOT_LIMITS_ENABLED); 2204 DQUOT_LIMITS_ENABLED);
2205 return error; 2205 return error;
2206} 2206}
2207EXPORT_SYMBOL(dquot_quota_on_path);
2208
2209int dquot_quota_on(struct super_block *sb, int type, int format_id, char *name)
2210{
2211 struct path path;
2212 int error;
2213
2214 error = kern_path(name, LOOKUP_FOLLOW, &path);
2215 if (!error) {
2216 error = dquot_quota_on_path(sb, type, format_id, &path);
2217 path_put(&path);
2218 }
2219 return error;
2220}
2221EXPORT_SYMBOL(dquot_quota_on); 2207EXPORT_SYMBOL(dquot_quota_on);
2222 2208
2223/* 2209/*
diff --git a/fs/quota/quota.c b/fs/quota/quota.c
index b299961e1edb..b34bdb25490c 100644
--- a/fs/quota/quota.c
+++ b/fs/quota/quota.c
@@ -64,18 +64,15 @@ static int quota_sync_all(int type)
64} 64}
65 65
66static int quota_quotaon(struct super_block *sb, int type, int cmd, qid_t id, 66static int quota_quotaon(struct super_block *sb, int type, int cmd, qid_t id,
67 void __user *addr) 67 struct path *path)
68{ 68{
69 char *pathname; 69 if (!sb->s_qcop->quota_on && !sb->s_qcop->quota_on_meta)
70 int ret = -ENOSYS; 70 return -ENOSYS;
71 71 if (sb->s_qcop->quota_on_meta)
72 pathname = getname(addr); 72 return sb->s_qcop->quota_on_meta(sb, type, id);
73 if (IS_ERR(pathname)) 73 if (IS_ERR(path))
74 return PTR_ERR(pathname); 74 return PTR_ERR(path);
75 if (sb->s_qcop->quota_on) 75 return sb->s_qcop->quota_on(sb, type, id, path);
76 ret = sb->s_qcop->quota_on(sb, type, id, pathname);
77 putname(pathname);
78 return ret;
79} 76}
80 77
81static int quota_getfmt(struct super_block *sb, int type, void __user *addr) 78static int quota_getfmt(struct super_block *sb, int type, void __user *addr)
@@ -241,7 +238,7 @@ static int quota_getxquota(struct super_block *sb, int type, qid_t id,
241 238
242/* Copy parameters and call proper function */ 239/* Copy parameters and call proper function */
243static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id, 240static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id,
244 void __user *addr) 241 void __user *addr, struct path *path)
245{ 242{
246 int ret; 243 int ret;
247 244
@@ -256,7 +253,7 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id,
256 253
257 switch (cmd) { 254 switch (cmd) {
258 case Q_QUOTAON: 255 case Q_QUOTAON:
259 return quota_quotaon(sb, type, cmd, id, addr); 256 return quota_quotaon(sb, type, cmd, id, path);
260 case Q_QUOTAOFF: 257 case Q_QUOTAOFF:
261 if (!sb->s_qcop->quota_off) 258 if (!sb->s_qcop->quota_off)
262 return -ENOSYS; 259 return -ENOSYS;
@@ -335,6 +332,7 @@ SYSCALL_DEFINE4(quotactl, unsigned int, cmd, const char __user *, special,
335{ 332{
336 uint cmds, type; 333 uint cmds, type;
337 struct super_block *sb = NULL; 334 struct super_block *sb = NULL;
335 struct path path, *pathp = NULL;
338 int ret; 336 int ret;
339 337
340 cmds = cmd >> SUBCMDSHIFT; 338 cmds = cmd >> SUBCMDSHIFT;
@@ -351,12 +349,27 @@ SYSCALL_DEFINE4(quotactl, unsigned int, cmd, const char __user *, special,
351 return -ENODEV; 349 return -ENODEV;
352 } 350 }
353 351
352 /*
353 * Path for quotaon has to be resolved before grabbing superblock
354 * because that gets s_umount sem which is also possibly needed by path
355 * resolution (think about autofs) and thus deadlocks could arise.
356 */
357 if (cmds == Q_QUOTAON) {
358 ret = user_path_at(AT_FDCWD, addr, LOOKUP_FOLLOW, &path);
359 if (ret)
360 pathp = ERR_PTR(ret);
361 else
362 pathp = &path;
363 }
364
354 sb = quotactl_block(special); 365 sb = quotactl_block(special);
355 if (IS_ERR(sb)) 366 if (IS_ERR(sb))
356 return PTR_ERR(sb); 367 return PTR_ERR(sb);
357 368
358 ret = do_quotactl(sb, type, cmds, id, addr); 369 ret = do_quotactl(sb, type, cmds, id, addr, pathp);
359 370
360 drop_super(sb); 371 drop_super(sb);
372 if (pathp && !IS_ERR(pathp))
373 path_put(pathp);
361 return ret; 374 return ret;
362} 375}
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 2575682a9ead..0aab04f46827 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -632,7 +632,7 @@ static int reiserfs_acquire_dquot(struct dquot *);
632static int reiserfs_release_dquot(struct dquot *); 632static int reiserfs_release_dquot(struct dquot *);
633static int reiserfs_mark_dquot_dirty(struct dquot *); 633static int reiserfs_mark_dquot_dirty(struct dquot *);
634static int reiserfs_write_info(struct super_block *, int); 634static int reiserfs_write_info(struct super_block *, int);
635static int reiserfs_quota_on(struct super_block *, int, int, char *); 635static int reiserfs_quota_on(struct super_block *, int, int, struct path *);
636 636
637static const struct dquot_operations reiserfs_quota_operations = { 637static const struct dquot_operations reiserfs_quota_operations = {
638 .write_dquot = reiserfs_write_dquot, 638 .write_dquot = reiserfs_write_dquot,
@@ -2048,25 +2048,21 @@ static int reiserfs_quota_on_mount(struct super_block *sb, int type)
2048 * Standard function to be called on quota_on 2048 * Standard function to be called on quota_on
2049 */ 2049 */
2050static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, 2050static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
2051 char *name) 2051 struct path *path)
2052{ 2052{
2053 int err; 2053 int err;
2054 struct path path;
2055 struct inode *inode; 2054 struct inode *inode;
2056 struct reiserfs_transaction_handle th; 2055 struct reiserfs_transaction_handle th;
2057 2056
2058 if (!(REISERFS_SB(sb)->s_mount_opt & (1 << REISERFS_QUOTA))) 2057 if (!(REISERFS_SB(sb)->s_mount_opt & (1 << REISERFS_QUOTA)))
2059 return -EINVAL; 2058 return -EINVAL;
2060 2059
2061 err = kern_path(name, LOOKUP_FOLLOW, &path);
2062 if (err)
2063 return err;
2064 /* Quotafile not on the same filesystem? */ 2060 /* Quotafile not on the same filesystem? */
2065 if (path.mnt->mnt_sb != sb) { 2061 if (path->mnt->mnt_sb != sb) {
2066 err = -EXDEV; 2062 err = -EXDEV;
2067 goto out; 2063 goto out;
2068 } 2064 }
2069 inode = path.dentry->d_inode; 2065 inode = path->dentry->d_inode;
2070 /* We must not pack tails for quota files on reiserfs for quota IO to work */ 2066 /* We must not pack tails for quota files on reiserfs for quota IO to work */
2071 if (!(REISERFS_I(inode)->i_flags & i_nopack_mask)) { 2067 if (!(REISERFS_I(inode)->i_flags & i_nopack_mask)) {
2072 err = reiserfs_unpack(inode, NULL); 2068 err = reiserfs_unpack(inode, NULL);
@@ -2082,7 +2078,7 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
2082 /* Journaling quota? */ 2078 /* Journaling quota? */
2083 if (REISERFS_SB(sb)->s_qf_names[type]) { 2079 if (REISERFS_SB(sb)->s_qf_names[type]) {
2084 /* Quotafile not of fs root? */ 2080 /* Quotafile not of fs root? */
2085 if (path.dentry->d_parent != sb->s_root) 2081 if (path->dentry->d_parent != sb->s_root)
2086 reiserfs_warning(sb, "super-6521", 2082 reiserfs_warning(sb, "super-6521",
2087 "Quota file not on filesystem root. " 2083 "Quota file not on filesystem root. "
2088 "Journalled quota will not work."); 2084 "Journalled quota will not work.");
@@ -2101,9 +2097,8 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
2101 if (err) 2097 if (err)
2102 goto out; 2098 goto out;
2103 } 2099 }
2104 err = dquot_quota_on_path(sb, type, format_id, &path); 2100 err = dquot_quota_on(sb, type, format_id, path);
2105out: 2101out:
2106 path_put(&path);
2107 return err; 2102 return err;
2108} 2103}
2109 2104
diff --git a/fs/sysfs/Kconfig b/fs/sysfs/Kconfig
index f4b67588b9d6..8c41feacbac5 100644
--- a/fs/sysfs/Kconfig
+++ b/fs/sysfs/Kconfig
@@ -1,5 +1,5 @@
1config SYSFS 1config SYSFS
2 bool "sysfs file system support" if EMBEDDED 2 bool "sysfs file system support" if EXPERT
3 default y 3 default y
4 help 4 help
5 The sysfs filesystem is a virtual filesystem that the kernel uses to 5 The sysfs filesystem is a virtual filesystem that the kernel uses to
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h
index 17714beb868e..5b6c391efc8e 100644
--- a/include/acpi/acexcep.h
+++ b/include/acpi/acexcep.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h
index 9cf736ea4691..fc1575fd4596 100644
--- a/include/acpi/acnames.h
+++ b/include/acpi/acnames.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h
index bc4a6deb73b0..ef1cef77d32b 100644
--- a/include/acpi/acoutput.h
+++ b/include/acpi/acoutput.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h
index a091cabca4b1..de39915f6b7f 100644
--- a/include/acpi/acpi.h
+++ b/include/acpi/acpi.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 65b3f5888f42..a3252a5ead66 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -8,7 +8,7 @@
8 *****************************************************************************/ 8 *****************************************************************************/
9 9
10/* 10/*
11 * Copyright (C) 2000 - 2010, Intel Corp. 11 * Copyright (C) 2000 - 2011, Intel Corp.
12 * All rights reserved. 12 * All rights reserved.
13 * 13 *
14 * Redistribution and use in source and binary forms, with or without 14 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 241b8a04c83c..e46ec95a8ada 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2010, Intel Corp. 9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -47,7 +47,7 @@
47 47
48/* Current ACPICA subsystem version in YYYYMMDD format */ 48/* Current ACPICA subsystem version in YYYYMMDD format */
49 49
50#define ACPI_CA_VERSION 0x20101209 50#define ACPI_CA_VERSION 0x20110112
51 51
52#include "actypes.h" 52#include "actypes.h"
53#include "actbl.h" 53#include "actbl.h"
diff --git a/include/acpi/acrestyp.h b/include/acpi/acrestyp.h
index e5526354ba5e..0a66cc45dd6b 100644
--- a/include/acpi/acrestyp.h
+++ b/include/acpi/acrestyp.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index ad2001683ba7..7e42bfee0e29 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index cd77aa75c962..7504bc99b29b 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index d4136b28011f..0fc15dfb2e22 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 939a431a6ab6..64f838beaabf 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index a3e334ab1119..5af3ed52ef98 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h
index 5dcb9537343c..e228893591a9 100644
--- a/include/acpi/platform/acgcc.h
+++ b/include/acpi/platform/acgcc.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 572189e37133..5d2a5e9544d9 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2010, Intel Corp. 8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index eb176bb1b15b..a2e910e01293 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -306,9 +306,6 @@ extern acpi_status acpi_pci_osc_control_set(acpi_handle handle,
306 u32 *mask, u32 req); 306 u32 *mask, u32 req);
307extern void acpi_early_init(void); 307extern void acpi_early_init(void);
308 308
309int acpi_os_map_generic_address(struct acpi_generic_address *addr);
310void acpi_os_unmap_generic_address(struct acpi_generic_address *addr);
311
312#else /* !CONFIG_ACPI */ 309#else /* !CONFIG_ACPI */
313 310
314#define acpi_disabled 1 311#define acpi_disabled 1
diff --git a/include/linux/acpi_io.h b/include/linux/acpi_io.h
new file mode 100644
index 000000000000..7180013a4a3a
--- /dev/null
+++ b/include/linux/acpi_io.h
@@ -0,0 +1,16 @@
1#ifndef _ACPI_IO_H_
2#define _ACPI_IO_H_
3
4#include <linux/io.h>
5#include <acpi/acpi.h>
6
7static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
8 acpi_size size)
9{
10 return ioremap_cache(phys, size);
11}
12
13int acpi_os_map_generic_address(struct acpi_generic_address *addr);
14void acpi_os_unmap_generic_address(struct acpi_generic_address *addr);
15
16#endif
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 6042228954a7..294169e31364 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -959,7 +959,7 @@ struct ieee80211_ht_info {
959/* block-ack parameters */ 959/* block-ack parameters */
960#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002 960#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
961#define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C 961#define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C
962#define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0 962#define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFC0
963#define IEEE80211_DELBA_PARAM_TID_MASK 0xF000 963#define IEEE80211_DELBA_PARAM_TID_MASK 0xF000
964#define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800 964#define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800
965 965
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index 6a64c6fa81af..c1a95b7b58de 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -101,13 +101,6 @@ static inline struct irq_desc *move_irq_desc(struct irq_desc *desc, int node)
101#define get_irq_desc_msi(desc) ((desc)->irq_data.msi_desc) 101#define get_irq_desc_msi(desc) ((desc)->irq_data.msi_desc)
102 102
103/* 103/*
104 * Monolithic do_IRQ implementation.
105 */
106#ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
107extern unsigned int __do_IRQ(unsigned int irq);
108#endif
109
110/*
111 * Architectures call this to let the generic IRQ layer 104 * Architectures call this to let the generic IRQ layer
112 * handle an interrupt. If the descriptor is attached to an 105 * handle an interrupt. If the descriptor is attached to an
113 * irqchip-style controller then we call the ->handle_irq() handler, 106 * irqchip-style controller then we call the ->handle_irq() handler,
@@ -115,14 +108,7 @@ extern unsigned int __do_IRQ(unsigned int irq);
115 */ 108 */
116static inline void generic_handle_irq_desc(unsigned int irq, struct irq_desc *desc) 109static inline void generic_handle_irq_desc(unsigned int irq, struct irq_desc *desc)
117{ 110{
118#ifdef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
119 desc->handle_irq(irq, desc); 111 desc->handle_irq(irq, desc);
120#else
121 if (likely(desc->handle_irq))
122 desc->handle_irq(irq, desc);
123 else
124 __do_IRQ(irq);
125#endif
126} 112}
127 113
128static inline void generic_handle_irq(unsigned int irq) 114static inline void generic_handle_irq(unsigned int irq)
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 5a9d9059520b..d07d8057e440 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -243,6 +243,8 @@ extern int test_taint(unsigned flag);
243extern unsigned long get_taint(void); 243extern unsigned long get_taint(void);
244extern int root_mountflags; 244extern int root_mountflags;
245 245
246extern bool early_boot_irqs_disabled;
247
246/* Values used for system_state */ 248/* Values used for system_state */
247extern enum system_states { 249extern enum system_states {
248 SYSTEM_BOOTING, 250 SYSTEM_BOOTING,
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 71c09b26c759..4aef1dda6406 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -436,16 +436,8 @@ do { \
436#endif /* CONFIG_LOCKDEP */ 436#endif /* CONFIG_LOCKDEP */
437 437
438#ifdef CONFIG_TRACE_IRQFLAGS 438#ifdef CONFIG_TRACE_IRQFLAGS
439extern void early_boot_irqs_off(void);
440extern void early_boot_irqs_on(void);
441extern void print_irqtrace_events(struct task_struct *curr); 439extern void print_irqtrace_events(struct task_struct *curr);
442#else 440#else
443static inline void early_boot_irqs_off(void)
444{
445}
446static inline void early_boot_irqs_on(void)
447{
448}
449static inline void print_irqtrace_events(struct task_struct *curr) 441static inline void print_irqtrace_events(struct task_struct *curr)
450{ 442{
451} 443}
@@ -522,12 +514,15 @@ static inline void print_irqtrace_events(struct task_struct *curr)
522#ifdef CONFIG_DEBUG_LOCK_ALLOC 514#ifdef CONFIG_DEBUG_LOCK_ALLOC
523# ifdef CONFIG_PROVE_LOCKING 515# ifdef CONFIG_PROVE_LOCKING
524# define lock_map_acquire(l) lock_acquire(l, 0, 0, 0, 2, NULL, _THIS_IP_) 516# define lock_map_acquire(l) lock_acquire(l, 0, 0, 0, 2, NULL, _THIS_IP_)
517# define lock_map_acquire_read(l) lock_acquire(l, 0, 0, 2, 2, NULL, _THIS_IP_)
525# else 518# else
526# define lock_map_acquire(l) lock_acquire(l, 0, 0, 0, 1, NULL, _THIS_IP_) 519# define lock_map_acquire(l) lock_acquire(l, 0, 0, 0, 1, NULL, _THIS_IP_)
520# define lock_map_acquire_read(l) lock_acquire(l, 0, 0, 2, 1, NULL, _THIS_IP_)
527# endif 521# endif
528# define lock_map_release(l) lock_release(l, 1, _THIS_IP_) 522# define lock_map_release(l) lock_release(l, 1, _THIS_IP_)
529#else 523#else
530# define lock_map_acquire(l) do { } while (0) 524# define lock_map_acquire(l) do { } while (0)
525# define lock_map_acquire_read(l) do { } while (0)
531# define lock_map_release(l) do { } while (0) 526# define lock_map_release(l) do { } while (0)
532#endif 527#endif
533 528
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 6a576f989437..f512e189be5a 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -146,6 +146,10 @@ unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
146 gfp_t gfp_mask); 146 gfp_t gfp_mask);
147u64 mem_cgroup_get_limit(struct mem_cgroup *mem); 147u64 mem_cgroup_get_limit(struct mem_cgroup *mem);
148 148
149#ifdef CONFIG_TRANSPARENT_HUGEPAGE
150void mem_cgroup_split_huge_fixup(struct page *head, struct page *tail);
151#endif
152
149#else /* CONFIG_CGROUP_MEM_RES_CTLR */ 153#else /* CONFIG_CGROUP_MEM_RES_CTLR */
150struct mem_cgroup; 154struct mem_cgroup;
151 155
@@ -335,6 +339,11 @@ u64 mem_cgroup_get_limit(struct mem_cgroup *mem)
335 return 0; 339 return 0;
336} 340}
337 341
342static inline void mem_cgroup_split_huge_fixup(struct page *head,
343 struct page *tail)
344{
345}
346
338#endif /* CONFIG_CGROUP_MEM_CONT */ 347#endif /* CONFIG_CGROUP_MEM_CONT */
339 348
340#endif /* _LINUX_MEMCONTROL_H */ 349#endif /* _LINUX_MEMCONTROL_H */
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 956a35532f47..f6385fc17ad4 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -470,6 +470,7 @@ static inline void set_compound_order(struct page *page, unsigned long order)
470 page[1].lru.prev = (void *)order; 470 page[1].lru.prev = (void *)order;
471} 471}
472 472
473#ifdef CONFIG_MMU
473/* 474/*
474 * Do pte_mkwrite, but only if the vma says VM_WRITE. We do this when 475 * Do pte_mkwrite, but only if the vma says VM_WRITE. We do this when
475 * servicing faults for write access. In the normal case, do always want 476 * servicing faults for write access. In the normal case, do always want
@@ -482,6 +483,7 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
482 pte = pte_mkwrite(pte); 483 pte = pte_mkwrite(pte);
483 return pte; 484 return pte;
484} 485}
486#endif
485 487
486/* 488/*
487 * Multiple processes may "see" the same page. E.g. for untouched 489 * Multiple processes may "see" the same page. E.g. for untouched
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 94c1f03b50eb..9a85412e0db6 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -322,9 +322,12 @@ struct dquot_operations {
322 qsize_t *(*get_reserved_space) (struct inode *); 322 qsize_t *(*get_reserved_space) (struct inode *);
323}; 323};
324 324
325struct path;
326
325/* Operations handling requests from userspace */ 327/* Operations handling requests from userspace */
326struct quotactl_ops { 328struct quotactl_ops {
327 int (*quota_on)(struct super_block *, int, int, char *); 329 int (*quota_on)(struct super_block *, int, int, struct path *);
330 int (*quota_on_meta)(struct super_block *, int, int);
328 int (*quota_off)(struct super_block *, int); 331 int (*quota_off)(struct super_block *, int);
329 int (*quota_sync)(struct super_block *, int, int); 332 int (*quota_sync)(struct super_block *, int, int);
330 int (*get_info)(struct super_block *, int, struct if_dqinfo *); 333 int (*get_info)(struct super_block *, int, struct if_dqinfo *);
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 223b14cd129c..eb354f6f26b3 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -76,11 +76,9 @@ int dquot_mark_dquot_dirty(struct dquot *dquot);
76 76
77int dquot_file_open(struct inode *inode, struct file *file); 77int dquot_file_open(struct inode *inode, struct file *file);
78 78
79int dquot_quota_on(struct super_block *sb, int type, int format_id,
80 char *path);
81int dquot_enable(struct inode *inode, int type, int format_id, 79int dquot_enable(struct inode *inode, int type, int format_id,
82 unsigned int flags); 80 unsigned int flags);
83int dquot_quota_on_path(struct super_block *sb, int type, int format_id, 81int dquot_quota_on(struct super_block *sb, int type, int format_id,
84 struct path *path); 82 struct path *path);
85int dquot_quota_on_mount(struct super_block *sb, char *qf_name, 83int dquot_quota_on_mount(struct super_block *sb, char *qf_name,
86 int format_id, int type); 84 int format_id, int type);
diff --git a/include/media/mt9v011.h b/include/media/mt9v011.h
new file mode 100644
index 000000000000..ea29fc74cd06
--- /dev/null
+++ b/include/media/mt9v011.h
@@ -0,0 +1,17 @@
1/* mt9v011 sensor
2 *
3 * Copyright (C) 2011 Hans Verkuil <hverkuil@xs4all.nl>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#ifndef __MT9V011_H__
11#define __MT9V011_H__
12
13struct mt9v011_platform_data {
14 unsigned xtal; /* Hz */
15};
16
17#endif
diff --git a/include/media/rc-core.h b/include/media/rc-core.h
index a23c1fc685a1..2963263f31e2 100644
--- a/include/media/rc-core.h
+++ b/include/media/rc-core.h
@@ -183,6 +183,9 @@ static inline void init_ir_raw_event(struct ir_raw_event *ev)
183} 183}
184 184
185#define IR_MAX_DURATION 0xFFFFFFFF /* a bit more than 4 seconds */ 185#define IR_MAX_DURATION 0xFFFFFFFF /* a bit more than 4 seconds */
186#define US_TO_NS(usec) ((usec) * 1000)
187#define MS_TO_US(msec) ((msec) * 1000)
188#define MS_TO_NS(msec) ((msec) * 1000 * 1000)
186 189
187void ir_raw_event_handle(struct rc_dev *dev); 190void ir_raw_event_handle(struct rc_dev *dev);
188int ir_raw_event_store(struct rc_dev *dev, struct ir_raw_event *ev); 191int ir_raw_event_store(struct rc_dev *dev, struct ir_raw_event *ev);
diff --git a/include/media/saa7146.h b/include/media/saa7146.h
index ac7ce00f39cf..79827143d5ac 100644
--- a/include/media/saa7146.h
+++ b/include/media/saa7146.h
@@ -115,7 +115,7 @@ struct saa7146_dev
115 115
116 /* different device locks */ 116 /* different device locks */
117 spinlock_t slock; 117 spinlock_t slock;
118 struct mutex lock; 118 struct mutex v4l2_lock;
119 119
120 unsigned char __iomem *mem; /* pointer to mapped IO memory */ 120 unsigned char __iomem *mem; /* pointer to mapped IO memory */
121 u32 revision; /* chip revision; needed for bug-workarounds*/ 121 u32 revision; /* chip revision; needed for bug-workarounds*/
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 2d65b35cdab2..a659319e8582 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -138,21 +138,10 @@ struct v4l2_subdev_ops;
138 138
139/* Load an i2c module and return an initialized v4l2_subdev struct. 139/* Load an i2c module and return an initialized v4l2_subdev struct.
140 The client_type argument is the name of the chip that's on the adapter. */ 140 The client_type argument is the name of the chip that's on the adapter. */
141struct v4l2_subdev *v4l2_i2c_new_subdev_cfg(struct v4l2_device *v4l2_dev, 141struct v4l2_subdev *v4l2_i2c_new_subdev(struct v4l2_device *v4l2_dev,
142 struct i2c_adapter *adapter, const char *client_type, 142 struct i2c_adapter *adapter, const char *client_type,
143 int irq, void *platform_data,
144 u8 addr, const unsigned short *probe_addrs); 143 u8 addr, const unsigned short *probe_addrs);
145 144
146/* Load an i2c module and return an initialized v4l2_subdev struct.
147 The client_type argument is the name of the chip that's on the adapter. */
148static inline struct v4l2_subdev *v4l2_i2c_new_subdev(struct v4l2_device *v4l2_dev,
149 struct i2c_adapter *adapter, const char *client_type,
150 u8 addr, const unsigned short *probe_addrs)
151{
152 return v4l2_i2c_new_subdev_cfg(v4l2_dev, adapter, client_type, 0, NULL,
153 addr, probe_addrs);
154}
155
156struct i2c_board_info; 145struct i2c_board_info;
157 146
158struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev, 147struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev,
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index d69ab4aae032..97d063837b61 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -23,6 +23,7 @@
23 23
24#include <linux/list.h> 24#include <linux/list.h>
25#include <linux/device.h> 25#include <linux/device.h>
26#include <linux/videodev2.h>
26 27
27/* forward references */ 28/* forward references */
28struct v4l2_ctrl_handler; 29struct v4l2_ctrl_handler;
@@ -53,8 +54,10 @@ struct v4l2_ctrl_ops {
53 * @handler: The handler that owns the control. 54 * @handler: The handler that owns the control.
54 * @cluster: Point to start of cluster array. 55 * @cluster: Point to start of cluster array.
55 * @ncontrols: Number of controls in cluster array. 56 * @ncontrols: Number of controls in cluster array.
56 * @has_new: Internal flag: set when there is a valid new value.
57 * @done: Internal flag: set for each processed control. 57 * @done: Internal flag: set for each processed control.
58 * @is_new: Set when the user specified a new value for this control. It
59 * is also set when called from v4l2_ctrl_handler_setup. Drivers
60 * should never set this flag.
58 * @is_private: If set, then this control is private to its handler and it 61 * @is_private: If set, then this control is private to its handler and it
59 * will not be added to any other handlers. Drivers can set 62 * will not be added to any other handlers. Drivers can set
60 * this flag. 63 * this flag.
@@ -97,9 +100,9 @@ struct v4l2_ctrl {
97 struct v4l2_ctrl_handler *handler; 100 struct v4l2_ctrl_handler *handler;
98 struct v4l2_ctrl **cluster; 101 struct v4l2_ctrl **cluster;
99 unsigned ncontrols; 102 unsigned ncontrols;
100 unsigned int has_new:1;
101 unsigned int done:1; 103 unsigned int done:1;
102 104
105 unsigned int is_new:1;
103 unsigned int is_private:1; 106 unsigned int is_private:1;
104 unsigned int is_volatile:1; 107 unsigned int is_volatile:1;
105 108
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index b0316a7cf08d..daf1e57d9b26 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -106,10 +106,7 @@ struct v4l2_subdev_io_pin_config {
106 u8 strength; /* Pin drive strength */ 106 u8 strength; /* Pin drive strength */
107}; 107};
108 108
109/* s_config: if set, then it is always called by the v4l2_i2c_new_subdev* 109/*
110 functions after the v4l2_subdev was registered. It is used to pass
111 platform data to the subdev which can be used during initialization.
112
113 s_io_pin_config: configure one or more chip I/O pins for chips that 110 s_io_pin_config: configure one or more chip I/O pins for chips that
114 multiplex different internal signal pads out to IO pins. This function 111 multiplex different internal signal pads out to IO pins. This function
115 takes a pointer to an array of 'n' pin configuration entries, one for 112 takes a pointer to an array of 'n' pin configuration entries, one for
@@ -141,7 +138,6 @@ struct v4l2_subdev_io_pin_config {
141struct v4l2_subdev_core_ops { 138struct v4l2_subdev_core_ops {
142 int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip); 139 int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip);
143 int (*log_status)(struct v4l2_subdev *sd); 140 int (*log_status)(struct v4l2_subdev *sd);
144 int (*s_config)(struct v4l2_subdev *sd, int irq, void *platform_data);
145 int (*s_io_pin_config)(struct v4l2_subdev *sd, size_t n, 141 int (*s_io_pin_config)(struct v4l2_subdev *sd, size_t n,
146 struct v4l2_subdev_io_pin_config *pincfg); 142 struct v4l2_subdev_io_pin_config *pincfg);
147 int (*init)(struct v4l2_subdev *sd, u32 val); 143 int (*init)(struct v4l2_subdev *sd, u32 val);
@@ -415,6 +411,21 @@ struct v4l2_subdev_ops {
415 const struct v4l2_subdev_sensor_ops *sensor; 411 const struct v4l2_subdev_sensor_ops *sensor;
416}; 412};
417 413
414/*
415 * Internal ops. Never call this from drivers, only the v4l2 framework can call
416 * these ops.
417 *
418 * registered: called when this subdev is registered. When called the v4l2_dev
419 * field is set to the correct v4l2_device.
420 *
421 * unregistered: called when this subdev is unregistered. When called the
422 * v4l2_dev field is still set to the correct v4l2_device.
423 */
424struct v4l2_subdev_internal_ops {
425 int (*registered)(struct v4l2_subdev *sd);
426 void (*unregistered)(struct v4l2_subdev *sd);
427};
428
418#define V4L2_SUBDEV_NAME_SIZE 32 429#define V4L2_SUBDEV_NAME_SIZE 32
419 430
420/* Set this flag if this subdev is a i2c device. */ 431/* Set this flag if this subdev is a i2c device. */
@@ -431,6 +442,8 @@ struct v4l2_subdev {
431 u32 flags; 442 u32 flags;
432 struct v4l2_device *v4l2_dev; 443 struct v4l2_device *v4l2_dev;
433 const struct v4l2_subdev_ops *ops; 444 const struct v4l2_subdev_ops *ops;
445 /* Never call these internal ops from within a driver! */
446 const struct v4l2_subdev_internal_ops *internal_ops;
434 /* The control handler of this subdev. May be NULL. */ 447 /* The control handler of this subdev. May be NULL. */
435 struct v4l2_ctrl_handler *ctrl_handler; 448 struct v4l2_ctrl_handler *ctrl_handler;
436 /* name must be unique */ 449 /* name must be unique */
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index 2a128c8c2718..e73ebdae323d 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -78,6 +78,7 @@ typedef __s32 sctp_assoc_t;
78#define SCTP_GET_PEER_ADDR_INFO 15 78#define SCTP_GET_PEER_ADDR_INFO 15
79#define SCTP_DELAYED_ACK_TIME 16 79#define SCTP_DELAYED_ACK_TIME 16
80#define SCTP_DELAYED_ACK SCTP_DELAYED_ACK_TIME 80#define SCTP_DELAYED_ACK SCTP_DELAYED_ACK_TIME
81#define SCTP_DELAYED_SACK SCTP_DELAYED_ACK_TIME
81#define SCTP_CONTEXT 17 82#define SCTP_CONTEXT 17
82#define SCTP_FRAGMENT_INTERLEAVE 18 83#define SCTP_FRAGMENT_INTERLEAVE 18
83#define SCTP_PARTIAL_DELIVERY_POINT 19 /* Set/Get partial delivery point */ 84#define SCTP_PARTIAL_DELIVERY_POINT 19 /* Set/Get partial delivery point */
diff --git a/init/Kconfig b/init/Kconfig
index 4e337906016e..be788c0957d4 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -745,8 +745,8 @@ config DEBUG_BLK_CGROUP
745endif # CGROUPS 745endif # CGROUPS
746 746
747menuconfig NAMESPACES 747menuconfig NAMESPACES
748 bool "Namespaces support" if EMBEDDED 748 bool "Namespaces support" if EXPERT
749 default !EMBEDDED 749 default !EXPERT
750 help 750 help
751 Provides the way to make tasks work with different objects using 751 Provides the way to make tasks work with different objects using
752 the same id. For example same IPC id may refer to different objects 752 the same id. For example same IPC id may refer to different objects
@@ -899,23 +899,31 @@ config SYSCTL
899config ANON_INODES 899config ANON_INODES
900 bool 900 bool
901 901
902menuconfig EMBEDDED 902menuconfig EXPERT
903 bool "Configure standard kernel features (for small systems)" 903 bool "Configure standard kernel features (expert users)"
904 help 904 help
905 This option allows certain base kernel options and settings 905 This option allows certain base kernel options and settings
906 to be disabled or tweaked. This is for specialized 906 to be disabled or tweaked. This is for specialized
907 environments which can tolerate a "non-standard" kernel. 907 environments which can tolerate a "non-standard" kernel.
908 Only use this if you really know what you are doing. 908 Only use this if you really know what you are doing.
909 909
910config EMBEDDED
911 bool "Embedded system"
912 select EXPERT
913 help
914 This option should be enabled if compiling the kernel for
915 an embedded system so certain expert options are available
916 for configuration.
917
910config UID16 918config UID16
911 bool "Enable 16-bit UID system calls" if EMBEDDED 919 bool "Enable 16-bit UID system calls" if EXPERT
912 depends on ARM || BLACKFIN || CRIS || FRV || H8300 || X86_32 || M68K || (S390 && !64BIT) || SUPERH || SPARC32 || (SPARC64 && COMPAT) || UML || (X86_64 && IA32_EMULATION) 920 depends on ARM || BLACKFIN || CRIS || FRV || H8300 || X86_32 || M68K || (S390 && !64BIT) || SUPERH || SPARC32 || (SPARC64 && COMPAT) || UML || (X86_64 && IA32_EMULATION)
913 default y 921 default y
914 help 922 help
915 This enables the legacy 16-bit UID syscall wrappers. 923 This enables the legacy 16-bit UID syscall wrappers.
916 924
917config SYSCTL_SYSCALL 925config SYSCTL_SYSCALL
918 bool "Sysctl syscall support" if EMBEDDED 926 bool "Sysctl syscall support" if EXPERT
919 depends on PROC_SYSCTL 927 depends on PROC_SYSCTL
920 default y 928 default y
921 select SYSCTL 929 select SYSCTL
@@ -932,7 +940,7 @@ config SYSCTL_SYSCALL
932 If unsure say Y here. 940 If unsure say Y here.
933 941
934config KALLSYMS 942config KALLSYMS
935 bool "Load all symbols for debugging/ksymoops" if EMBEDDED 943 bool "Load all symbols for debugging/ksymoops" if EXPERT
936 default y 944 default y
937 help 945 help
938 Say Y here to let the kernel print out symbolic crash information and 946 Say Y here to let the kernel print out symbolic crash information and
@@ -963,7 +971,7 @@ config KALLSYMS_EXTRA_PASS
963 971
964 972
965config HOTPLUG 973config HOTPLUG
966 bool "Support for hot-pluggable devices" if EMBEDDED 974 bool "Support for hot-pluggable devices" if EXPERT
967 default y 975 default y
968 help 976 help
969 This option is provided for the case where no hotplug or uevent 977 This option is provided for the case where no hotplug or uevent
@@ -973,7 +981,7 @@ config HOTPLUG
973 981
974config PRINTK 982config PRINTK
975 default y 983 default y
976 bool "Enable support for printk" if EMBEDDED 984 bool "Enable support for printk" if EXPERT
977 help 985 help
978 This option enables normal printk support. Removing it 986 This option enables normal printk support. Removing it
979 eliminates most of the message strings from the kernel image 987 eliminates most of the message strings from the kernel image
@@ -982,7 +990,7 @@ config PRINTK
982 strongly discouraged. 990 strongly discouraged.
983 991
984config BUG 992config BUG
985 bool "BUG() support" if EMBEDDED 993 bool "BUG() support" if EXPERT
986 default y 994 default y
987 help 995 help
988 Disabling this option eliminates support for BUG and WARN, reducing 996 Disabling this option eliminates support for BUG and WARN, reducing
@@ -993,12 +1001,12 @@ config BUG
993 1001
994config ELF_CORE 1002config ELF_CORE
995 default y 1003 default y
996 bool "Enable ELF core dumps" if EMBEDDED 1004 bool "Enable ELF core dumps" if EXPERT
997 help 1005 help
998 Enable support for generating core dumps. Disabling saves about 4k. 1006 Enable support for generating core dumps. Disabling saves about 4k.
999 1007
1000config PCSPKR_PLATFORM 1008config PCSPKR_PLATFORM
1001 bool "Enable PC-Speaker support" if EMBEDDED 1009 bool "Enable PC-Speaker support" if EXPERT
1002 depends on ALPHA || X86 || MIPS || PPC_PREP || PPC_CHRP || PPC_PSERIES 1010 depends on ALPHA || X86 || MIPS || PPC_PREP || PPC_CHRP || PPC_PSERIES
1003 default y 1011 default y
1004 help 1012 help
@@ -1007,14 +1015,14 @@ config PCSPKR_PLATFORM
1007 1015
1008config BASE_FULL 1016config BASE_FULL
1009 default y 1017 default y
1010 bool "Enable full-sized data structures for core" if EMBEDDED 1018 bool "Enable full-sized data structures for core" if EXPERT
1011 help 1019 help
1012 Disabling this option reduces the size of miscellaneous core 1020 Disabling this option reduces the size of miscellaneous core
1013 kernel data structures. This saves memory on small machines, 1021 kernel data structures. This saves memory on small machines,
1014 but may reduce performance. 1022 but may reduce performance.
1015 1023
1016config FUTEX 1024config FUTEX
1017 bool "Enable futex support" if EMBEDDED 1025 bool "Enable futex support" if EXPERT
1018 default y 1026 default y
1019 select RT_MUTEXES 1027 select RT_MUTEXES
1020 help 1028 help
@@ -1023,7 +1031,7 @@ config FUTEX
1023 run glibc-based applications correctly. 1031 run glibc-based applications correctly.
1024 1032
1025config EPOLL 1033config EPOLL
1026 bool "Enable eventpoll support" if EMBEDDED 1034 bool "Enable eventpoll support" if EXPERT
1027 default y 1035 default y
1028 select ANON_INODES 1036 select ANON_INODES
1029 help 1037 help
@@ -1031,7 +1039,7 @@ config EPOLL
1031 support for epoll family of system calls. 1039 support for epoll family of system calls.
1032 1040
1033config SIGNALFD 1041config SIGNALFD
1034 bool "Enable signalfd() system call" if EMBEDDED 1042 bool "Enable signalfd() system call" if EXPERT
1035 select ANON_INODES 1043 select ANON_INODES
1036 default y 1044 default y
1037 help 1045 help
@@ -1041,7 +1049,7 @@ config SIGNALFD
1041 If unsure, say Y. 1049 If unsure, say Y.
1042 1050
1043config TIMERFD 1051config TIMERFD
1044 bool "Enable timerfd() system call" if EMBEDDED 1052 bool "Enable timerfd() system call" if EXPERT
1045 select ANON_INODES 1053 select ANON_INODES
1046 default y 1054 default y
1047 help 1055 help
@@ -1051,7 +1059,7 @@ config TIMERFD
1051 If unsure, say Y. 1059 If unsure, say Y.
1052 1060
1053config EVENTFD 1061config EVENTFD
1054 bool "Enable eventfd() system call" if EMBEDDED 1062 bool "Enable eventfd() system call" if EXPERT
1055 select ANON_INODES 1063 select ANON_INODES
1056 default y 1064 default y
1057 help 1065 help
@@ -1061,7 +1069,7 @@ config EVENTFD
1061 If unsure, say Y. 1069 If unsure, say Y.
1062 1070
1063config SHMEM 1071config SHMEM
1064 bool "Use full shmem filesystem" if EMBEDDED 1072 bool "Use full shmem filesystem" if EXPERT
1065 default y 1073 default y
1066 depends on MMU 1074 depends on MMU
1067 help 1075 help
@@ -1072,7 +1080,7 @@ config SHMEM
1072 which may be appropriate on small systems without swap. 1080 which may be appropriate on small systems without swap.
1073 1081
1074config AIO 1082config AIO
1075 bool "Enable AIO support" if EMBEDDED 1083 bool "Enable AIO support" if EXPERT
1076 default y 1084 default y
1077 help 1085 help
1078 This option enables POSIX asynchronous I/O which may by used 1086 This option enables POSIX asynchronous I/O which may by used
@@ -1149,16 +1157,16 @@ endmenu
1149 1157
1150config VM_EVENT_COUNTERS 1158config VM_EVENT_COUNTERS
1151 default y 1159 default y
1152 bool "Enable VM event counters for /proc/vmstat" if EMBEDDED 1160 bool "Enable VM event counters for /proc/vmstat" if EXPERT
1153 help 1161 help
1154 VM event counters are needed for event counts to be shown. 1162 VM event counters are needed for event counts to be shown.
1155 This option allows the disabling of the VM event counters 1163 This option allows the disabling of the VM event counters
1156 on EMBEDDED systems. /proc/vmstat will only show page counts 1164 on EXPERT systems. /proc/vmstat will only show page counts
1157 if VM event counters are disabled. 1165 if VM event counters are disabled.
1158 1166
1159config PCI_QUIRKS 1167config PCI_QUIRKS
1160 default y 1168 default y
1161 bool "Enable PCI quirk workarounds" if EMBEDDED 1169 bool "Enable PCI quirk workarounds" if EXPERT
1162 depends on PCI 1170 depends on PCI
1163 help 1171 help
1164 This enables workarounds for various PCI chipset 1172 This enables workarounds for various PCI chipset
@@ -1167,7 +1175,7 @@ config PCI_QUIRKS
1167 1175
1168config SLUB_DEBUG 1176config SLUB_DEBUG
1169 default y 1177 default y
1170 bool "Enable SLUB debugging support" if EMBEDDED 1178 bool "Enable SLUB debugging support" if EXPERT
1171 depends on SLUB && SYSFS 1179 depends on SLUB && SYSFS
1172 help 1180 help
1173 SLUB has extensive debug support features. Disabling these can 1181 SLUB has extensive debug support features. Disabling these can
@@ -1211,7 +1219,7 @@ config SLUB
1211 a slab allocator. 1219 a slab allocator.
1212 1220
1213config SLOB 1221config SLOB
1214 depends on EMBEDDED 1222 depends on EXPERT
1215 bool "SLOB (Simple Allocator)" 1223 bool "SLOB (Simple Allocator)"
1216 help 1224 help
1217 SLOB replaces the stock allocator with a drastically simpler 1225 SLOB replaces the stock allocator with a drastically simpler
@@ -1222,7 +1230,7 @@ endchoice
1222 1230
1223config MMAP_ALLOW_UNINITIALIZED 1231config MMAP_ALLOW_UNINITIALIZED
1224 bool "Allow mmapped anonymous memory to be uninitialized" 1232 bool "Allow mmapped anonymous memory to be uninitialized"
1225 depends on EMBEDDED && !MMU 1233 depends on EXPERT && !MMU
1226 default n 1234 default n
1227 help 1235 help
1228 Normally, and according to the Linux spec, anonymous memory obtained 1236 Normally, and according to the Linux spec, anonymous memory obtained
diff --git a/init/main.c b/init/main.c
index 00799c1d4628..33c37c379e96 100644
--- a/init/main.c
+++ b/init/main.c
@@ -96,6 +96,15 @@ static inline void mark_rodata_ro(void) { }
96extern void tc_init(void); 96extern void tc_init(void);
97#endif 97#endif
98 98
99/*
100 * Debug helper: via this flag we know that we are in 'early bootup code'
101 * where only the boot processor is running with IRQ disabled. This means
102 * two things - IRQ must not be enabled before the flag is cleared and some
103 * operations which are not allowed with IRQ disabled are allowed while the
104 * flag is set.
105 */
106bool early_boot_irqs_disabled __read_mostly;
107
99enum system_states system_state __read_mostly; 108enum system_states system_state __read_mostly;
100EXPORT_SYMBOL(system_state); 109EXPORT_SYMBOL(system_state);
101 110
@@ -554,7 +563,7 @@ asmlinkage void __init start_kernel(void)
554 cgroup_init_early(); 563 cgroup_init_early();
555 564
556 local_irq_disable(); 565 local_irq_disable();
557 early_boot_irqs_off(); 566 early_boot_irqs_disabled = true;
558 567
559/* 568/*
560 * Interrupts are still disabled. Do necessary setups, then 569 * Interrupts are still disabled. Do necessary setups, then
@@ -621,7 +630,7 @@ asmlinkage void __init start_kernel(void)
621 if (!irqs_disabled()) 630 if (!irqs_disabled())
622 printk(KERN_CRIT "start_kernel(): bug: interrupts were " 631 printk(KERN_CRIT "start_kernel(): bug: interrupts were "
623 "enabled early\n"); 632 "enabled early\n");
624 early_boot_irqs_on(); 633 early_boot_irqs_disabled = false;
625 local_irq_enable(); 634 local_irq_enable();
626 635
627 /* Interrupts are enabled now so all GFP allocations are safe. */ 636 /* Interrupts are enabled now so all GFP allocations are safe. */
diff --git a/kernel/irq/Kconfig b/kernel/irq/Kconfig
index 31d766bf5d2e..8e42fec7686d 100644
--- a/kernel/irq/Kconfig
+++ b/kernel/irq/Kconfig
@@ -9,9 +9,6 @@ menu "IRQ subsystem"
9config GENERIC_HARDIRQS 9config GENERIC_HARDIRQS
10 def_bool y 10 def_bool y
11 11
12config GENERIC_HARDIRQS_NO__DO_IRQ
13 def_bool y
14
15# Select this to disable the deprecated stuff 12# Select this to disable the deprecated stuff
16config GENERIC_HARDIRQS_NO_DEPRECATED 13config GENERIC_HARDIRQS_NO_DEPRECATED
17 def_bool n 14 def_bool n
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index e2347eb63306..3540a7190122 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -118,114 +118,3 @@ irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action)
118 118
119 return retval; 119 return retval;
120} 120}
121
122#ifndef CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ
123
124#ifdef CONFIG_ENABLE_WARN_DEPRECATED
125# warning __do_IRQ is deprecated. Please convert to proper flow handlers
126#endif
127
128/**
129 * __do_IRQ - original all in one highlevel IRQ handler
130 * @irq: the interrupt number
131 *
132 * __do_IRQ handles all normal device IRQ's (the special
133 * SMP cross-CPU interrupts have their own specific
134 * handlers).
135 *
136 * This is the original x86 implementation which is used for every
137 * interrupt type.
138 */
139unsigned int __do_IRQ(unsigned int irq)
140{
141 struct irq_desc *desc = irq_to_desc(irq);
142 struct irqaction *action;
143 unsigned int status;
144
145 kstat_incr_irqs_this_cpu(irq, desc);
146
147 if (CHECK_IRQ_PER_CPU(desc->status)) {
148 irqreturn_t action_ret;
149
150 /*
151 * No locking required for CPU-local interrupts:
152 */
153 if (desc->irq_data.chip->ack)
154 desc->irq_data.chip->ack(irq);
155 if (likely(!(desc->status & IRQ_DISABLED))) {
156 action_ret = handle_IRQ_event(irq, desc->action);
157 if (!noirqdebug)
158 note_interrupt(irq, desc, action_ret);
159 }
160 desc->irq_data.chip->end(irq);
161 return 1;
162 }
163
164 raw_spin_lock(&desc->lock);
165 if (desc->irq_data.chip->ack)
166 desc->irq_data.chip->ack(irq);
167 /*
168 * REPLAY is when Linux resends an IRQ that was dropped earlier
169 * WAITING is used by probe to mark irqs that are being tested
170 */
171 status = desc->status & ~(IRQ_REPLAY | IRQ_WAITING);
172 status |= IRQ_PENDING; /* we _want_ to handle it */
173
174 /*
175 * If the IRQ is disabled for whatever reason, we cannot
176 * use the action we have.
177 */
178 action = NULL;
179 if (likely(!(status & (IRQ_DISABLED | IRQ_INPROGRESS)))) {
180 action = desc->action;
181 status &= ~IRQ_PENDING; /* we commit to handling */
182 status |= IRQ_INPROGRESS; /* we are handling it */
183 }
184 desc->status = status;
185
186 /*
187 * If there is no IRQ handler or it was disabled, exit early.
188 * Since we set PENDING, if another processor is handling
189 * a different instance of this same irq, the other processor
190 * will take care of it.
191 */
192 if (unlikely(!action))
193 goto out;
194
195 /*
196 * Edge triggered interrupts need to remember
197 * pending events.
198 * This applies to any hw interrupts that allow a second
199 * instance of the same irq to arrive while we are in do_IRQ
200 * or in the handler. But the code here only handles the _second_
201 * instance of the irq, not the third or fourth. So it is mostly
202 * useful for irq hardware that does not mask cleanly in an
203 * SMP environment.
204 */
205 for (;;) {
206 irqreturn_t action_ret;
207
208 raw_spin_unlock(&desc->lock);
209
210 action_ret = handle_IRQ_event(irq, action);
211 if (!noirqdebug)
212 note_interrupt(irq, desc, action_ret);
213
214 raw_spin_lock(&desc->lock);
215 if (likely(!(desc->status & IRQ_PENDING)))
216 break;
217 desc->status &= ~IRQ_PENDING;
218 }
219 desc->status &= ~IRQ_INPROGRESS;
220
221out:
222 /*
223 * The ->end() handler has to deal with interrupts which got
224 * disabled while the handler was running.
225 */
226 desc->irq_data.chip->end(irq);
227 raw_spin_unlock(&desc->lock);
228
229 return 1;
230}
231#endif
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 42ba65dff7d9..0d2058da80f5 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -2292,22 +2292,6 @@ mark_held_locks(struct task_struct *curr, enum mark_type mark)
2292} 2292}
2293 2293
2294/* 2294/*
2295 * Debugging helper: via this flag we know that we are in
2296 * 'early bootup code', and will warn about any invalid irqs-on event:
2297 */
2298static int early_boot_irqs_enabled;
2299
2300void early_boot_irqs_off(void)
2301{
2302 early_boot_irqs_enabled = 0;
2303}
2304
2305void early_boot_irqs_on(void)
2306{
2307 early_boot_irqs_enabled = 1;
2308}
2309
2310/*
2311 * Hardirqs will be enabled: 2295 * Hardirqs will be enabled:
2312 */ 2296 */
2313void trace_hardirqs_on_caller(unsigned long ip) 2297void trace_hardirqs_on_caller(unsigned long ip)
@@ -2319,7 +2303,7 @@ void trace_hardirqs_on_caller(unsigned long ip)
2319 if (unlikely(!debug_locks || current->lockdep_recursion)) 2303 if (unlikely(!debug_locks || current->lockdep_recursion))
2320 return; 2304 return;
2321 2305
2322 if (DEBUG_LOCKS_WARN_ON(unlikely(!early_boot_irqs_enabled))) 2306 if (DEBUG_LOCKS_WARN_ON(unlikely(early_boot_irqs_disabled)))
2323 return; 2307 return;
2324 2308
2325 if (unlikely(curr->hardirqs_enabled)) { 2309 if (unlikely(curr->hardirqs_enabled)) {
diff --git a/kernel/sched.c b/kernel/sched.c
index ea3e5eff3878..18d38e4ec7ba 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -553,9 +553,6 @@ struct rq {
553 /* try_to_wake_up() stats */ 553 /* try_to_wake_up() stats */
554 unsigned int ttwu_count; 554 unsigned int ttwu_count;
555 unsigned int ttwu_local; 555 unsigned int ttwu_local;
556
557 /* BKL stats */
558 unsigned int bkl_count;
559#endif 556#endif
560}; 557};
561 558
@@ -609,6 +606,9 @@ static inline struct task_group *task_group(struct task_struct *p)
609 struct task_group *tg; 606 struct task_group *tg;
610 struct cgroup_subsys_state *css; 607 struct cgroup_subsys_state *css;
611 608
609 if (p->flags & PF_EXITING)
610 return &root_task_group;
611
612 css = task_subsys_state_check(p, cpu_cgroup_subsys_id, 612 css = task_subsys_state_check(p, cpu_cgroup_subsys_id,
613 lockdep_is_held(&task_rq(p)->lock)); 613 lockdep_is_held(&task_rq(p)->lock));
614 tg = container_of(css, struct task_group, css); 614 tg = container_of(css, struct task_group, css);
@@ -3887,7 +3887,7 @@ static inline void schedule_debug(struct task_struct *prev)
3887 schedstat_inc(this_rq(), sched_count); 3887 schedstat_inc(this_rq(), sched_count);
3888#ifdef CONFIG_SCHEDSTATS 3888#ifdef CONFIG_SCHEDSTATS
3889 if (unlikely(prev->lock_depth >= 0)) { 3889 if (unlikely(prev->lock_depth >= 0)) {
3890 schedstat_inc(this_rq(), bkl_count); 3890 schedstat_inc(this_rq(), rq_sched_info.bkl_count);
3891 schedstat_inc(prev, sched_info.bkl_count); 3891 schedstat_inc(prev, sched_info.bkl_count);
3892 } 3892 }
3893#endif 3893#endif
@@ -4871,7 +4871,8 @@ recheck:
4871 * assigned. 4871 * assigned.
4872 */ 4872 */
4873 if (rt_bandwidth_enabled() && rt_policy(policy) && 4873 if (rt_bandwidth_enabled() && rt_policy(policy) &&
4874 task_group(p)->rt_bandwidth.rt_runtime == 0) { 4874 task_group(p)->rt_bandwidth.rt_runtime == 0 &&
4875 !task_group_is_autogroup(task_group(p))) {
4875 __task_rq_unlock(rq); 4876 __task_rq_unlock(rq);
4876 raw_spin_unlock_irqrestore(&p->pi_lock, flags); 4877 raw_spin_unlock_irqrestore(&p->pi_lock, flags);
4877 return -EPERM; 4878 return -EPERM;
@@ -8882,6 +8883,20 @@ cpu_cgroup_attach(struct cgroup_subsys *ss, struct cgroup *cgrp,
8882 } 8883 }
8883} 8884}
8884 8885
8886static void
8887cpu_cgroup_exit(struct cgroup_subsys *ss, struct task_struct *task)
8888{
8889 /*
8890 * cgroup_exit() is called in the copy_process() failure path.
8891 * Ignore this case since the task hasn't ran yet, this avoids
8892 * trying to poke a half freed task state from generic code.
8893 */
8894 if (!(task->flags & PF_EXITING))
8895 return;
8896
8897 sched_move_task(task);
8898}
8899
8885#ifdef CONFIG_FAIR_GROUP_SCHED 8900#ifdef CONFIG_FAIR_GROUP_SCHED
8886static int cpu_shares_write_u64(struct cgroup *cgrp, struct cftype *cftype, 8901static int cpu_shares_write_u64(struct cgroup *cgrp, struct cftype *cftype,
8887 u64 shareval) 8902 u64 shareval)
@@ -8954,6 +8969,7 @@ struct cgroup_subsys cpu_cgroup_subsys = {
8954 .destroy = cpu_cgroup_destroy, 8969 .destroy = cpu_cgroup_destroy,
8955 .can_attach = cpu_cgroup_can_attach, 8970 .can_attach = cpu_cgroup_can_attach,
8956 .attach = cpu_cgroup_attach, 8971 .attach = cpu_cgroup_attach,
8972 .exit = cpu_cgroup_exit,
8957 .populate = cpu_cgroup_populate, 8973 .populate = cpu_cgroup_populate,
8958 .subsys_id = cpu_cgroup_subsys_id, 8974 .subsys_id = cpu_cgroup_subsys_id,
8959 .early_init = 1, 8975 .early_init = 1,
diff --git a/kernel/sched_autogroup.c b/kernel/sched_autogroup.c
index 32a723b8f84c..9fb656283157 100644
--- a/kernel/sched_autogroup.c
+++ b/kernel/sched_autogroup.c
@@ -27,6 +27,11 @@ static inline void autogroup_destroy(struct kref *kref)
27{ 27{
28 struct autogroup *ag = container_of(kref, struct autogroup, kref); 28 struct autogroup *ag = container_of(kref, struct autogroup, kref);
29 29
30#ifdef CONFIG_RT_GROUP_SCHED
31 /* We've redirected RT tasks to the root task group... */
32 ag->tg->rt_se = NULL;
33 ag->tg->rt_rq = NULL;
34#endif
30 sched_destroy_group(ag->tg); 35 sched_destroy_group(ag->tg);
31} 36}
32 37
@@ -55,6 +60,10 @@ static inline struct autogroup *autogroup_task_get(struct task_struct *p)
55 return ag; 60 return ag;
56} 61}
57 62
63#ifdef CONFIG_RT_GROUP_SCHED
64static void free_rt_sched_group(struct task_group *tg);
65#endif
66
58static inline struct autogroup *autogroup_create(void) 67static inline struct autogroup *autogroup_create(void)
59{ 68{
60 struct autogroup *ag = kzalloc(sizeof(*ag), GFP_KERNEL); 69 struct autogroup *ag = kzalloc(sizeof(*ag), GFP_KERNEL);
@@ -72,6 +81,19 @@ static inline struct autogroup *autogroup_create(void)
72 init_rwsem(&ag->lock); 81 init_rwsem(&ag->lock);
73 ag->id = atomic_inc_return(&autogroup_seq_nr); 82 ag->id = atomic_inc_return(&autogroup_seq_nr);
74 ag->tg = tg; 83 ag->tg = tg;
84#ifdef CONFIG_RT_GROUP_SCHED
85 /*
86 * Autogroup RT tasks are redirected to the root task group
87 * so we don't have to move tasks around upon policy change,
88 * or flail around trying to allocate bandwidth on the fly.
89 * A bandwidth exception in __sched_setscheduler() allows
90 * the policy change to proceed. Thereafter, task_group()
91 * returns &root_task_group, so zero bandwidth is required.
92 */
93 free_rt_sched_group(tg);
94 tg->rt_se = root_task_group.rt_se;
95 tg->rt_rq = root_task_group.rt_rq;
96#endif
75 tg->autogroup = ag; 97 tg->autogroup = ag;
76 98
77 return ag; 99 return ag;
@@ -106,6 +128,11 @@ task_wants_autogroup(struct task_struct *p, struct task_group *tg)
106 return true; 128 return true;
107} 129}
108 130
131static inline bool task_group_is_autogroup(struct task_group *tg)
132{
133 return tg != &root_task_group && tg->autogroup;
134}
135
109static inline struct task_group * 136static inline struct task_group *
110autogroup_task_group(struct task_struct *p, struct task_group *tg) 137autogroup_task_group(struct task_struct *p, struct task_group *tg)
111{ 138{
@@ -231,6 +258,11 @@ void proc_sched_autogroup_show_task(struct task_struct *p, struct seq_file *m)
231#ifdef CONFIG_SCHED_DEBUG 258#ifdef CONFIG_SCHED_DEBUG
232static inline int autogroup_path(struct task_group *tg, char *buf, int buflen) 259static inline int autogroup_path(struct task_group *tg, char *buf, int buflen)
233{ 260{
261 int enabled = ACCESS_ONCE(sysctl_sched_autogroup_enabled);
262
263 if (!enabled || !tg->autogroup)
264 return 0;
265
234 return snprintf(buf, buflen, "%s-%ld", "/autogroup", tg->autogroup->id); 266 return snprintf(buf, buflen, "%s-%ld", "/autogroup", tg->autogroup->id);
235} 267}
236#endif /* CONFIG_SCHED_DEBUG */ 268#endif /* CONFIG_SCHED_DEBUG */
diff --git a/kernel/sched_autogroup.h b/kernel/sched_autogroup.h
index 5358e241cb20..7b859ffe5dad 100644
--- a/kernel/sched_autogroup.h
+++ b/kernel/sched_autogroup.h
@@ -15,6 +15,10 @@ autogroup_task_group(struct task_struct *p, struct task_group *tg);
15 15
16static inline void autogroup_init(struct task_struct *init_task) { } 16static inline void autogroup_init(struct task_struct *init_task) { }
17static inline void autogroup_free(struct task_group *tg) { } 17static inline void autogroup_free(struct task_group *tg) { }
18static inline bool task_group_is_autogroup(struct task_group *tg)
19{
20 return 0;
21}
18 22
19static inline struct task_group * 23static inline struct task_group *
20autogroup_task_group(struct task_struct *p, struct task_group *tg) 24autogroup_task_group(struct task_struct *p, struct task_group *tg)
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index 1dfae3d014b5..eb6cb8edd075 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -16,6 +16,8 @@
16#include <linux/kallsyms.h> 16#include <linux/kallsyms.h>
17#include <linux/utsname.h> 17#include <linux/utsname.h>
18 18
19static DEFINE_SPINLOCK(sched_debug_lock);
20
19/* 21/*
20 * This allows printing both to /proc/sched_debug and 22 * This allows printing both to /proc/sched_debug and
21 * to the console 23 * to the console
@@ -86,6 +88,26 @@ static void print_cfs_group_stats(struct seq_file *m, int cpu, struct task_group
86} 88}
87#endif 89#endif
88 90
91#ifdef CONFIG_CGROUP_SCHED
92static char group_path[PATH_MAX];
93
94static char *task_group_path(struct task_group *tg)
95{
96 if (autogroup_path(tg, group_path, PATH_MAX))
97 return group_path;
98
99 /*
100 * May be NULL if the underlying cgroup isn't fully-created yet
101 */
102 if (!tg->css.cgroup) {
103 group_path[0] = '\0';
104 return group_path;
105 }
106 cgroup_path(tg->css.cgroup, group_path, PATH_MAX);
107 return group_path;
108}
109#endif
110
89static void 111static void
90print_task(struct seq_file *m, struct rq *rq, struct task_struct *p) 112print_task(struct seq_file *m, struct rq *rq, struct task_struct *p)
91{ 113{
@@ -108,6 +130,9 @@ print_task(struct seq_file *m, struct rq *rq, struct task_struct *p)
108 SEQ_printf(m, "%15Ld %15Ld %15Ld.%06ld %15Ld.%06ld %15Ld.%06ld", 130 SEQ_printf(m, "%15Ld %15Ld %15Ld.%06ld %15Ld.%06ld %15Ld.%06ld",
109 0LL, 0LL, 0LL, 0L, 0LL, 0L, 0LL, 0L); 131 0LL, 0LL, 0LL, 0L, 0LL, 0L, 0LL, 0L);
110#endif 132#endif
133#ifdef CONFIG_CGROUP_SCHED
134 SEQ_printf(m, " %s", task_group_path(task_group(p)));
135#endif
111 136
112 SEQ_printf(m, "\n"); 137 SEQ_printf(m, "\n");
113} 138}
@@ -144,7 +169,11 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
144 struct sched_entity *last; 169 struct sched_entity *last;
145 unsigned long flags; 170 unsigned long flags;
146 171
172#ifdef CONFIG_FAIR_GROUP_SCHED
173 SEQ_printf(m, "\ncfs_rq[%d]:%s\n", cpu, task_group_path(cfs_rq->tg));
174#else
147 SEQ_printf(m, "\ncfs_rq[%d]:\n", cpu); 175 SEQ_printf(m, "\ncfs_rq[%d]:\n", cpu);
176#endif
148 SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "exec_clock", 177 SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "exec_clock",
149 SPLIT_NS(cfs_rq->exec_clock)); 178 SPLIT_NS(cfs_rq->exec_clock));
150 179
@@ -191,7 +220,11 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
191 220
192void print_rt_rq(struct seq_file *m, int cpu, struct rt_rq *rt_rq) 221void print_rt_rq(struct seq_file *m, int cpu, struct rt_rq *rt_rq)
193{ 222{
223#ifdef CONFIG_RT_GROUP_SCHED
224 SEQ_printf(m, "\nrt_rq[%d]:%s\n", cpu, task_group_path(rt_rq->tg));
225#else
194 SEQ_printf(m, "\nrt_rq[%d]:\n", cpu); 226 SEQ_printf(m, "\nrt_rq[%d]:\n", cpu);
227#endif
195 228
196#define P(x) \ 229#define P(x) \
197 SEQ_printf(m, " .%-30s: %Ld\n", #x, (long long)(rt_rq->x)) 230 SEQ_printf(m, " .%-30s: %Ld\n", #x, (long long)(rt_rq->x))
@@ -212,6 +245,7 @@ extern __read_mostly int sched_clock_running;
212static void print_cpu(struct seq_file *m, int cpu) 245static void print_cpu(struct seq_file *m, int cpu)
213{ 246{
214 struct rq *rq = cpu_rq(cpu); 247 struct rq *rq = cpu_rq(cpu);
248 unsigned long flags;
215 249
216#ifdef CONFIG_X86 250#ifdef CONFIG_X86
217 { 251 {
@@ -262,14 +296,20 @@ static void print_cpu(struct seq_file *m, int cpu)
262 P(ttwu_count); 296 P(ttwu_count);
263 P(ttwu_local); 297 P(ttwu_local);
264 298
265 P(bkl_count); 299 SEQ_printf(m, " .%-30s: %d\n", "bkl_count",
300 rq->rq_sched_info.bkl_count);
266 301
267#undef P 302#undef P
303#undef P64
268#endif 304#endif
305 spin_lock_irqsave(&sched_debug_lock, flags);
269 print_cfs_stats(m, cpu); 306 print_cfs_stats(m, cpu);
270 print_rt_stats(m, cpu); 307 print_rt_stats(m, cpu);
271 308
309 rcu_read_lock();
272 print_rq(m, rq, cpu); 310 print_rq(m, rq, cpu);
311 rcu_read_unlock();
312 spin_unlock_irqrestore(&sched_debug_lock, flags);
273} 313}
274 314
275static const char *sched_tunable_scaling_names[] = { 315static const char *sched_tunable_scaling_names[] = {
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index c62ebae65cf0..77e9166d7bbf 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1062,6 +1062,9 @@ check_preempt_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr)
1062 struct sched_entity *se = __pick_next_entity(cfs_rq); 1062 struct sched_entity *se = __pick_next_entity(cfs_rq);
1063 s64 delta = curr->vruntime - se->vruntime; 1063 s64 delta = curr->vruntime - se->vruntime;
1064 1064
1065 if (delta < 0)
1066 return;
1067
1065 if (delta > ideal_runtime) 1068 if (delta > ideal_runtime)
1066 resched_task(rq_of(cfs_rq)->curr); 1069 resched_task(rq_of(cfs_rq)->curr);
1067 } 1070 }
@@ -1362,27 +1365,27 @@ static long effective_load(struct task_group *tg, int cpu, long wl, long wg)
1362 return wl; 1365 return wl;
1363 1366
1364 for_each_sched_entity(se) { 1367 for_each_sched_entity(se) {
1365 long S, rw, s, a, b; 1368 long lw, w;
1366 1369
1367 S = se->my_q->tg->shares; 1370 tg = se->my_q->tg;
1368 s = se->load.weight; 1371 w = se->my_q->load.weight;
1369 rw = se->my_q->load.weight;
1370 1372
1371 a = S*(rw + wl); 1373 /* use this cpu's instantaneous contribution */
1372 b = S*rw + s*wg; 1374 lw = atomic_read(&tg->load_weight);
1375 lw -= se->my_q->load_contribution;
1376 lw += w + wg;
1373 1377
1374 wl = s*(a-b); 1378 wl += w;
1375 1379
1376 if (likely(b)) 1380 if (lw > 0 && wl < lw)
1377 wl /= b; 1381 wl = (wl * tg->shares) / lw;
1382 else
1383 wl = tg->shares;
1378 1384
1379 /* 1385 /* zero point is MIN_SHARES */
1380 * Assume the group is already running and will 1386 if (wl < MIN_SHARES)
1381 * thus already be accounted for in the weight. 1387 wl = MIN_SHARES;
1382 * 1388 wl -= se->load.weight;
1383 * That is, moving shares between CPUs, does not
1384 * alter the group weight.
1385 */
1386 wg = 0; 1389 wg = 0;
1387 } 1390 }
1388 1391
diff --git a/kernel/smp.c b/kernel/smp.c
index 4ec30e069987..9910744f0856 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -194,23 +194,52 @@ void generic_smp_call_function_interrupt(void)
194 */ 194 */
195 list_for_each_entry_rcu(data, &call_function.queue, csd.list) { 195 list_for_each_entry_rcu(data, &call_function.queue, csd.list) {
196 int refs; 196 int refs;
197 void (*func) (void *info);
197 198
198 if (!cpumask_test_and_clear_cpu(cpu, data->cpumask)) 199 /*
200 * Since we walk the list without any locks, we might
201 * see an entry that was completed, removed from the
202 * list and is in the process of being reused.
203 *
204 * We must check that the cpu is in the cpumask before
205 * checking the refs, and both must be set before
206 * executing the callback on this cpu.
207 */
208
209 if (!cpumask_test_cpu(cpu, data->cpumask))
210 continue;
211
212 smp_rmb();
213
214 if (atomic_read(&data->refs) == 0)
199 continue; 215 continue;
200 216
217 func = data->csd.func; /* for later warn */
201 data->csd.func(data->csd.info); 218 data->csd.func(data->csd.info);
202 219
220 /*
221 * If the cpu mask is not still set then it enabled interrupts,
222 * we took another smp interrupt, and executed the function
223 * twice on this cpu. In theory that copy decremented refs.
224 */
225 if (!cpumask_test_and_clear_cpu(cpu, data->cpumask)) {
226 WARN(1, "%pS enabled interrupts and double executed\n",
227 func);
228 continue;
229 }
230
203 refs = atomic_dec_return(&data->refs); 231 refs = atomic_dec_return(&data->refs);
204 WARN_ON(refs < 0); 232 WARN_ON(refs < 0);
205 if (!refs) {
206 raw_spin_lock(&call_function.lock);
207 list_del_rcu(&data->csd.list);
208 raw_spin_unlock(&call_function.lock);
209 }
210 233
211 if (refs) 234 if (refs)
212 continue; 235 continue;
213 236
237 WARN_ON(!cpumask_empty(data->cpumask));
238
239 raw_spin_lock(&call_function.lock);
240 list_del_rcu(&data->csd.list);
241 raw_spin_unlock(&call_function.lock);
242
214 csd_unlock(&data->csd); 243 csd_unlock(&data->csd);
215 } 244 }
216 245
@@ -430,7 +459,7 @@ void smp_call_function_many(const struct cpumask *mask,
430 * can't happen. 459 * can't happen.
431 */ 460 */
432 WARN_ON_ONCE(cpu_online(this_cpu) && irqs_disabled() 461 WARN_ON_ONCE(cpu_online(this_cpu) && irqs_disabled()
433 && !oops_in_progress); 462 && !oops_in_progress && !early_boot_irqs_disabled);
434 463
435 /* So, what's a CPU they want? Ignoring this one. */ 464 /* So, what's a CPU they want? Ignoring this one. */
436 cpu = cpumask_first_and(mask, cpu_online_mask); 465 cpu = cpumask_first_and(mask, cpu_online_mask);
@@ -454,11 +483,21 @@ void smp_call_function_many(const struct cpumask *mask,
454 483
455 data = &__get_cpu_var(cfd_data); 484 data = &__get_cpu_var(cfd_data);
456 csd_lock(&data->csd); 485 csd_lock(&data->csd);
486 BUG_ON(atomic_read(&data->refs) || !cpumask_empty(data->cpumask));
457 487
458 data->csd.func = func; 488 data->csd.func = func;
459 data->csd.info = info; 489 data->csd.info = info;
460 cpumask_and(data->cpumask, mask, cpu_online_mask); 490 cpumask_and(data->cpumask, mask, cpu_online_mask);
461 cpumask_clear_cpu(this_cpu, data->cpumask); 491 cpumask_clear_cpu(this_cpu, data->cpumask);
492
493 /*
494 * To ensure the interrupt handler gets an complete view
495 * we order the cpumask and refs writes and order the read
496 * of them in the interrupt handler. In addition we may
497 * only clear our own cpu bit from the mask.
498 */
499 smp_wmb();
500
462 atomic_set(&data->refs, cpumask_weight(data->cpumask)); 501 atomic_set(&data->refs, cpumask_weight(data->cpumask));
463 502
464 raw_spin_lock_irqsave(&call_function.lock, flags); 503 raw_spin_lock_irqsave(&call_function.lock, flags);
@@ -533,17 +572,20 @@ void ipi_call_unlock_irq(void)
533#endif /* USE_GENERIC_SMP_HELPERS */ 572#endif /* USE_GENERIC_SMP_HELPERS */
534 573
535/* 574/*
536 * Call a function on all processors 575 * Call a function on all processors. May be used during early boot while
576 * early_boot_irqs_disabled is set. Use local_irq_save/restore() instead
577 * of local_irq_disable/enable().
537 */ 578 */
538int on_each_cpu(void (*func) (void *info), void *info, int wait) 579int on_each_cpu(void (*func) (void *info), void *info, int wait)
539{ 580{
581 unsigned long flags;
540 int ret = 0; 582 int ret = 0;
541 583
542 preempt_disable(); 584 preempt_disable();
543 ret = smp_call_function(func, info, wait); 585 ret = smp_call_function(func, info, wait);
544 local_irq_disable(); 586 local_irq_save(flags);
545 func(info); 587 func(info);
546 local_irq_enable(); 588 local_irq_restore(flags);
547 preempt_enable(); 589 preempt_enable();
548 return ret; 590 return ret;
549} 591}
diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c
index 5cf8c602b880..92b6e1e12d98 100644
--- a/kernel/trace/trace_irqsoff.c
+++ b/kernel/trace/trace_irqsoff.c
@@ -453,14 +453,6 @@ void time_hardirqs_off(unsigned long a0, unsigned long a1)
453 * Stubs: 453 * Stubs:
454 */ 454 */
455 455
456void early_boot_irqs_off(void)
457{
458}
459
460void early_boot_irqs_on(void)
461{
462}
463
464void trace_softirqs_on(unsigned long ip) 456void trace_softirqs_on(unsigned long ip)
465{ 457{
466} 458}
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 8ee6ec82f88a..11869faa6819 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -768,7 +768,11 @@ static inline void worker_clr_flags(struct worker *worker, unsigned int flags)
768 768
769 worker->flags &= ~flags; 769 worker->flags &= ~flags;
770 770
771 /* if transitioning out of NOT_RUNNING, increment nr_running */ 771 /*
772 * If transitioning out of NOT_RUNNING, increment nr_running. Note
773 * that the nested NOT_RUNNING is not a noop. NOT_RUNNING is mask
774 * of multiple flags, not a single flag.
775 */
772 if ((flags & WORKER_NOT_RUNNING) && (oflags & WORKER_NOT_RUNNING)) 776 if ((flags & WORKER_NOT_RUNNING) && (oflags & WORKER_NOT_RUNNING))
773 if (!(worker->flags & WORKER_NOT_RUNNING)) 777 if (!(worker->flags & WORKER_NOT_RUNNING))
774 atomic_inc(get_gcwq_nr_running(gcwq->cpu)); 778 atomic_inc(get_gcwq_nr_running(gcwq->cpu));
@@ -1840,7 +1844,7 @@ __acquires(&gcwq->lock)
1840 spin_unlock_irq(&gcwq->lock); 1844 spin_unlock_irq(&gcwq->lock);
1841 1845
1842 work_clear_pending(work); 1846 work_clear_pending(work);
1843 lock_map_acquire(&cwq->wq->lockdep_map); 1847 lock_map_acquire_read(&cwq->wq->lockdep_map);
1844 lock_map_acquire(&lockdep_map); 1848 lock_map_acquire(&lockdep_map);
1845 trace_workqueue_execute_start(work); 1849 trace_workqueue_execute_start(work);
1846 f(work); 1850 f(work);
@@ -2384,8 +2388,18 @@ static bool start_flush_work(struct work_struct *work, struct wq_barrier *barr,
2384 insert_wq_barrier(cwq, barr, work, worker); 2388 insert_wq_barrier(cwq, barr, work, worker);
2385 spin_unlock_irq(&gcwq->lock); 2389 spin_unlock_irq(&gcwq->lock);
2386 2390
2387 lock_map_acquire(&cwq->wq->lockdep_map); 2391 /*
2392 * If @max_active is 1 or rescuer is in use, flushing another work
2393 * item on the same workqueue may lead to deadlock. Make sure the
2394 * flusher is not running on the same workqueue by verifying write
2395 * access.
2396 */
2397 if (cwq->wq->saved_max_active == 1 || cwq->wq->flags & WQ_RESCUER)
2398 lock_map_acquire(&cwq->wq->lockdep_map);
2399 else
2400 lock_map_acquire_read(&cwq->wq->lockdep_map);
2388 lock_map_release(&cwq->wq->lockdep_map); 2401 lock_map_release(&cwq->wq->lockdep_map);
2402
2389 return true; 2403 return true;
2390already_gone: 2404already_gone:
2391 spin_unlock_irq(&gcwq->lock); 2405 spin_unlock_irq(&gcwq->lock);
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 2d05adb98401..3967c2356e37 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -657,7 +657,7 @@ config DEBUG_HIGHMEM
657 Disable for production systems. 657 Disable for production systems.
658 658
659config DEBUG_BUGVERBOSE 659config DEBUG_BUGVERBOSE
660 bool "Verbose BUG() reporting (adds 70K)" if DEBUG_KERNEL && EMBEDDED 660 bool "Verbose BUG() reporting (adds 70K)" if DEBUG_KERNEL && EXPERT
661 depends on BUG 661 depends on BUG
662 depends on ARM || AVR32 || M32R || M68K || SPARC32 || SPARC64 || \ 662 depends on ARM || AVR32 || M32R || M68K || SPARC32 || SPARC64 || \
663 FRV || SUPERH || GENERIC_BUG || BLACKFIN || MN10300 663 FRV || SUPERH || GENERIC_BUG || BLACKFIN || MN10300
@@ -729,8 +729,8 @@ config DEBUG_WRITECOUNT
729 If unsure, say N. 729 If unsure, say N.
730 730
731config DEBUG_MEMORY_INIT 731config DEBUG_MEMORY_INIT
732 bool "Debug memory initialisation" if EMBEDDED 732 bool "Debug memory initialisation" if EXPERT
733 default !EMBEDDED 733 default !EXPERT
734 help 734 help
735 Enable this for additional checks during memory initialisation. 735 Enable this for additional checks during memory initialisation.
736 The sanity checks verify aspects of the VM such as the memory model 736 The sanity checks verify aspects of the VM such as the memory model
diff --git a/lib/xz/Kconfig b/lib/xz/Kconfig
index e3b6e18fdac5..60a6088d0e5e 100644
--- a/lib/xz/Kconfig
+++ b/lib/xz/Kconfig
@@ -7,37 +7,37 @@ config XZ_DEC
7 CRC32 is supported. See Documentation/xz.txt for more information. 7 CRC32 is supported. See Documentation/xz.txt for more information.
8 8
9config XZ_DEC_X86 9config XZ_DEC_X86
10 bool "x86 BCJ filter decoder" if EMBEDDED 10 bool "x86 BCJ filter decoder" if EXPERT
11 default y 11 default y
12 depends on XZ_DEC 12 depends on XZ_DEC
13 select XZ_DEC_BCJ 13 select XZ_DEC_BCJ
14 14
15config XZ_DEC_POWERPC 15config XZ_DEC_POWERPC
16 bool "PowerPC BCJ filter decoder" if EMBEDDED 16 bool "PowerPC BCJ filter decoder" if EXPERT
17 default y 17 default y
18 depends on XZ_DEC 18 depends on XZ_DEC
19 select XZ_DEC_BCJ 19 select XZ_DEC_BCJ
20 20
21config XZ_DEC_IA64 21config XZ_DEC_IA64
22 bool "IA-64 BCJ filter decoder" if EMBEDDED 22 bool "IA-64 BCJ filter decoder" if EXPERT
23 default y 23 default y
24 depends on XZ_DEC 24 depends on XZ_DEC
25 select XZ_DEC_BCJ 25 select XZ_DEC_BCJ
26 26
27config XZ_DEC_ARM 27config XZ_DEC_ARM
28 bool "ARM BCJ filter decoder" if EMBEDDED 28 bool "ARM BCJ filter decoder" if EXPERT
29 default y 29 default y
30 depends on XZ_DEC 30 depends on XZ_DEC
31 select XZ_DEC_BCJ 31 select XZ_DEC_BCJ
32 32
33config XZ_DEC_ARMTHUMB 33config XZ_DEC_ARMTHUMB
34 bool "ARM-Thumb BCJ filter decoder" if EMBEDDED 34 bool "ARM-Thumb BCJ filter decoder" if EXPERT
35 default y 35 default y
36 depends on XZ_DEC 36 depends on XZ_DEC
37 select XZ_DEC_BCJ 37 select XZ_DEC_BCJ
38 38
39config XZ_DEC_SPARC 39config XZ_DEC_SPARC
40 bool "SPARC BCJ filter decoder" if EMBEDDED 40 bool "SPARC BCJ filter decoder" if EXPERT
41 default y 41 default y
42 depends on XZ_DEC 42 depends on XZ_DEC
43 select XZ_DEC_BCJ 43 select XZ_DEC_BCJ
diff --git a/mm/compaction.c b/mm/compaction.c
index 6d592a021072..8be430b812de 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -406,6 +406,10 @@ static int compact_finished(struct zone *zone,
406 if (!zone_watermark_ok(zone, cc->order, watermark, 0, 0)) 406 if (!zone_watermark_ok(zone, cc->order, watermark, 0, 0))
407 return COMPACT_CONTINUE; 407 return COMPACT_CONTINUE;
408 408
409 /*
410 * order == -1 is expected when compacting via
411 * /proc/sys/vm/compact_memory
412 */
409 if (cc->order == -1) 413 if (cc->order == -1)
410 return COMPACT_CONTINUE; 414 return COMPACT_CONTINUE;
411 415
@@ -454,6 +458,13 @@ unsigned long compaction_suitable(struct zone *zone, int order)
454 return COMPACT_SKIPPED; 458 return COMPACT_SKIPPED;
455 459
456 /* 460 /*
461 * order == -1 is expected when compacting via
462 * /proc/sys/vm/compact_memory
463 */
464 if (order == -1)
465 return COMPACT_CONTINUE;
466
467 /*
457 * fragmentation index determines if allocation failures are due to 468 * fragmentation index determines if allocation failures are due to
458 * low memory or external fragmentation 469 * low memory or external fragmentation
459 * 470 *
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 004c9c2aac78..e187454d82f6 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -1203,6 +1203,8 @@ static void __split_huge_page_refcount(struct page *page)
1203 BUG_ON(!PageDirty(page_tail)); 1203 BUG_ON(!PageDirty(page_tail));
1204 BUG_ON(!PageSwapBacked(page_tail)); 1204 BUG_ON(!PageSwapBacked(page_tail));
1205 1205
1206 mem_cgroup_split_huge_fixup(page, page_tail);
1207
1206 lru_add_page_tail(zone, page, page_tail); 1208 lru_add_page_tail(zone, page, page_tail);
1207 } 1209 }
1208 1210
@@ -1837,9 +1839,9 @@ static void collapse_huge_page(struct mm_struct *mm,
1837 spin_lock(ptl); 1839 spin_lock(ptl);
1838 isolated = __collapse_huge_page_isolate(vma, address, pte); 1840 isolated = __collapse_huge_page_isolate(vma, address, pte);
1839 spin_unlock(ptl); 1841 spin_unlock(ptl);
1840 pte_unmap(pte);
1841 1842
1842 if (unlikely(!isolated)) { 1843 if (unlikely(!isolated)) {
1844 pte_unmap(pte);
1843 spin_lock(&mm->page_table_lock); 1845 spin_lock(&mm->page_table_lock);
1844 BUG_ON(!pmd_none(*pmd)); 1846 BUG_ON(!pmd_none(*pmd));
1845 set_pmd_at(mm, address, pmd, _pmd); 1847 set_pmd_at(mm, address, pmd, _pmd);
@@ -1856,6 +1858,7 @@ static void collapse_huge_page(struct mm_struct *mm,
1856 anon_vma_unlock(vma->anon_vma); 1858 anon_vma_unlock(vma->anon_vma);
1857 1859
1858 __collapse_huge_page_copy(pte, new_page, vma, address, ptl); 1860 __collapse_huge_page_copy(pte, new_page, vma, address, ptl);
1861 pte_unmap(pte);
1859 __SetPageUptodate(new_page); 1862 __SetPageUptodate(new_page);
1860 pgtable = pmd_pgtable(_pmd); 1863 pgtable = pmd_pgtable(_pmd);
1861 VM_BUG_ON(page_count(pgtable) != 1); 1864 VM_BUG_ON(page_count(pgtable) != 1);
diff --git a/mm/memblock.c b/mm/memblock.c
index 400dc62697d7..bdba245d8afd 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -683,13 +683,13 @@ int __init_memblock memblock_is_memory(phys_addr_t addr)
683 683
684int __init_memblock memblock_is_region_memory(phys_addr_t base, phys_addr_t size) 684int __init_memblock memblock_is_region_memory(phys_addr_t base, phys_addr_t size)
685{ 685{
686 int idx = memblock_search(&memblock.reserved, base); 686 int idx = memblock_search(&memblock.memory, base);
687 687
688 if (idx == -1) 688 if (idx == -1)
689 return 0; 689 return 0;
690 return memblock.reserved.regions[idx].base <= base && 690 return memblock.memory.regions[idx].base <= base &&
691 (memblock.reserved.regions[idx].base + 691 (memblock.memory.regions[idx].base +
692 memblock.reserved.regions[idx].size) >= (base + size); 692 memblock.memory.regions[idx].size) >= (base + size);
693} 693}
694 694
695int __init_memblock memblock_is_region_reserved(phys_addr_t base, phys_addr_t size) 695int __init_memblock memblock_is_region_reserved(phys_addr_t base, phys_addr_t size)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 8ab841031436..db76ef726293 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -600,23 +600,22 @@ static void mem_cgroup_swap_statistics(struct mem_cgroup *mem,
600} 600}
601 601
602static void mem_cgroup_charge_statistics(struct mem_cgroup *mem, 602static void mem_cgroup_charge_statistics(struct mem_cgroup *mem,
603 struct page_cgroup *pc, 603 bool file, int nr_pages)
604 bool charge)
605{ 604{
606 int val = (charge) ? 1 : -1;
607
608 preempt_disable(); 605 preempt_disable();
609 606
610 if (PageCgroupCache(pc)) 607 if (file)
611 __this_cpu_add(mem->stat->count[MEM_CGROUP_STAT_CACHE], val); 608 __this_cpu_add(mem->stat->count[MEM_CGROUP_STAT_CACHE], nr_pages);
612 else 609 else
613 __this_cpu_add(mem->stat->count[MEM_CGROUP_STAT_RSS], val); 610 __this_cpu_add(mem->stat->count[MEM_CGROUP_STAT_RSS], nr_pages);
614 611
615 if (charge) 612 /* pagein of a big page is an event. So, ignore page size */
613 if (nr_pages > 0)
616 __this_cpu_inc(mem->stat->count[MEM_CGROUP_STAT_PGPGIN_COUNT]); 614 __this_cpu_inc(mem->stat->count[MEM_CGROUP_STAT_PGPGIN_COUNT]);
617 else 615 else
618 __this_cpu_inc(mem->stat->count[MEM_CGROUP_STAT_PGPGOUT_COUNT]); 616 __this_cpu_inc(mem->stat->count[MEM_CGROUP_STAT_PGPGOUT_COUNT]);
619 __this_cpu_inc(mem->stat->count[MEM_CGROUP_EVENTS]); 617
618 __this_cpu_add(mem->stat->count[MEM_CGROUP_EVENTS], nr_pages);
620 619
621 preempt_enable(); 620 preempt_enable();
622} 621}
@@ -815,7 +814,8 @@ void mem_cgroup_del_lru_list(struct page *page, enum lru_list lru)
815 * removed from global LRU. 814 * removed from global LRU.
816 */ 815 */
817 mz = page_cgroup_zoneinfo(pc); 816 mz = page_cgroup_zoneinfo(pc);
818 MEM_CGROUP_ZSTAT(mz, lru) -= 1; 817 /* huge page split is done under lru_lock. so, we have no races. */
818 MEM_CGROUP_ZSTAT(mz, lru) -= 1 << compound_order(page);
819 if (mem_cgroup_is_root(pc->mem_cgroup)) 819 if (mem_cgroup_is_root(pc->mem_cgroup))
820 return; 820 return;
821 VM_BUG_ON(list_empty(&pc->lru)); 821 VM_BUG_ON(list_empty(&pc->lru));
@@ -836,13 +836,12 @@ void mem_cgroup_rotate_lru_list(struct page *page, enum lru_list lru)
836 return; 836 return;
837 837
838 pc = lookup_page_cgroup(page); 838 pc = lookup_page_cgroup(page);
839 /*
840 * Used bit is set without atomic ops but after smp_wmb().
841 * For making pc->mem_cgroup visible, insert smp_rmb() here.
842 */
843 smp_rmb();
844 /* unused or root page is not rotated. */ 839 /* unused or root page is not rotated. */
845 if (!PageCgroupUsed(pc) || mem_cgroup_is_root(pc->mem_cgroup)) 840 if (!PageCgroupUsed(pc))
841 return;
842 /* Ensure pc->mem_cgroup is visible after reading PCG_USED. */
843 smp_rmb();
844 if (mem_cgroup_is_root(pc->mem_cgroup))
846 return; 845 return;
847 mz = page_cgroup_zoneinfo(pc); 846 mz = page_cgroup_zoneinfo(pc);
848 list_move(&pc->lru, &mz->lists[lru]); 847 list_move(&pc->lru, &mz->lists[lru]);
@@ -857,16 +856,13 @@ void mem_cgroup_add_lru_list(struct page *page, enum lru_list lru)
857 return; 856 return;
858 pc = lookup_page_cgroup(page); 857 pc = lookup_page_cgroup(page);
859 VM_BUG_ON(PageCgroupAcctLRU(pc)); 858 VM_BUG_ON(PageCgroupAcctLRU(pc));
860 /*
861 * Used bit is set without atomic ops but after smp_wmb().
862 * For making pc->mem_cgroup visible, insert smp_rmb() here.
863 */
864 smp_rmb();
865 if (!PageCgroupUsed(pc)) 859 if (!PageCgroupUsed(pc))
866 return; 860 return;
867 861 /* Ensure pc->mem_cgroup is visible after reading PCG_USED. */
862 smp_rmb();
868 mz = page_cgroup_zoneinfo(pc); 863 mz = page_cgroup_zoneinfo(pc);
869 MEM_CGROUP_ZSTAT(mz, lru) += 1; 864 /* huge page split is done under lru_lock. so, we have no races. */
865 MEM_CGROUP_ZSTAT(mz, lru) += 1 << compound_order(page);
870 SetPageCgroupAcctLRU(pc); 866 SetPageCgroupAcctLRU(pc);
871 if (mem_cgroup_is_root(pc->mem_cgroup)) 867 if (mem_cgroup_is_root(pc->mem_cgroup))
872 return; 868 return;
@@ -1030,14 +1026,10 @@ mem_cgroup_get_reclaim_stat_from_page(struct page *page)
1030 return NULL; 1026 return NULL;
1031 1027
1032 pc = lookup_page_cgroup(page); 1028 pc = lookup_page_cgroup(page);
1033 /*
1034 * Used bit is set without atomic ops but after smp_wmb().
1035 * For making pc->mem_cgroup visible, insert smp_rmb() here.
1036 */
1037 smp_rmb();
1038 if (!PageCgroupUsed(pc)) 1029 if (!PageCgroupUsed(pc))
1039 return NULL; 1030 return NULL;
1040 1031 /* Ensure pc->mem_cgroup is visible after reading PCG_USED. */
1032 smp_rmb();
1041 mz = page_cgroup_zoneinfo(pc); 1033 mz = page_cgroup_zoneinfo(pc);
1042 if (!mz) 1034 if (!mz)
1043 return NULL; 1035 return NULL;
@@ -1615,7 +1607,7 @@ void mem_cgroup_update_page_stat(struct page *page,
1615 if (unlikely(!mem || !PageCgroupUsed(pc))) 1607 if (unlikely(!mem || !PageCgroupUsed(pc)))
1616 goto out; 1608 goto out;
1617 /* pc->mem_cgroup is unstable ? */ 1609 /* pc->mem_cgroup is unstable ? */
1618 if (unlikely(mem_cgroup_stealed(mem))) { 1610 if (unlikely(mem_cgroup_stealed(mem)) || PageTransHuge(page)) {
1619 /* take a lock against to access pc->mem_cgroup */ 1611 /* take a lock against to access pc->mem_cgroup */
1620 move_lock_page_cgroup(pc, &flags); 1612 move_lock_page_cgroup(pc, &flags);
1621 need_unlock = true; 1613 need_unlock = true;
@@ -2084,14 +2076,27 @@ struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page)
2084 return mem; 2076 return mem;
2085} 2077}
2086 2078
2087/* 2079static void __mem_cgroup_commit_charge(struct mem_cgroup *mem,
2088 * commit a charge got by __mem_cgroup_try_charge() and makes page_cgroup to be 2080 struct page_cgroup *pc,
2089 * USED state. If already USED, uncharge and return. 2081 enum charge_type ctype,
2090 */ 2082 int page_size)
2091static void ____mem_cgroup_commit_charge(struct mem_cgroup *mem,
2092 struct page_cgroup *pc,
2093 enum charge_type ctype)
2094{ 2083{
2084 int nr_pages = page_size >> PAGE_SHIFT;
2085
2086 /* try_charge() can return NULL to *memcg, taking care of it. */
2087 if (!mem)
2088 return;
2089
2090 lock_page_cgroup(pc);
2091 if (unlikely(PageCgroupUsed(pc))) {
2092 unlock_page_cgroup(pc);
2093 mem_cgroup_cancel_charge(mem, page_size);
2094 return;
2095 }
2096 /*
2097 * we don't need page_cgroup_lock about tail pages, becase they are not
2098 * accessed by any other context at this point.
2099 */
2095 pc->mem_cgroup = mem; 2100 pc->mem_cgroup = mem;
2096 /* 2101 /*
2097 * We access a page_cgroup asynchronously without lock_page_cgroup(). 2102 * We access a page_cgroup asynchronously without lock_page_cgroup().
@@ -2115,35 +2120,7 @@ static void ____mem_cgroup_commit_charge(struct mem_cgroup *mem,
2115 break; 2120 break;
2116 } 2121 }
2117 2122
2118 mem_cgroup_charge_statistics(mem, pc, true); 2123 mem_cgroup_charge_statistics(mem, PageCgroupCache(pc), nr_pages);
2119}
2120
2121static void __mem_cgroup_commit_charge(struct mem_cgroup *mem,
2122 struct page_cgroup *pc,
2123 enum charge_type ctype,
2124 int page_size)
2125{
2126 int i;
2127 int count = page_size >> PAGE_SHIFT;
2128
2129 /* try_charge() can return NULL to *memcg, taking care of it. */
2130 if (!mem)
2131 return;
2132
2133 lock_page_cgroup(pc);
2134 if (unlikely(PageCgroupUsed(pc))) {
2135 unlock_page_cgroup(pc);
2136 mem_cgroup_cancel_charge(mem, page_size);
2137 return;
2138 }
2139
2140 /*
2141 * we don't need page_cgroup_lock about tail pages, becase they are not
2142 * accessed by any other context at this point.
2143 */
2144 for (i = 0; i < count; i++)
2145 ____mem_cgroup_commit_charge(mem, pc + i, ctype);
2146
2147 unlock_page_cgroup(pc); 2124 unlock_page_cgroup(pc);
2148 /* 2125 /*
2149 * "charge_statistics" updated event counter. Then, check it. 2126 * "charge_statistics" updated event counter. Then, check it.
@@ -2153,6 +2130,46 @@ static void __mem_cgroup_commit_charge(struct mem_cgroup *mem,
2153 memcg_check_events(mem, pc->page); 2130 memcg_check_events(mem, pc->page);
2154} 2131}
2155 2132
2133#ifdef CONFIG_TRANSPARENT_HUGEPAGE
2134
2135#define PCGF_NOCOPY_AT_SPLIT ((1 << PCG_LOCK) | (1 << PCG_MOVE_LOCK) |\
2136 (1 << PCG_ACCT_LRU) | (1 << PCG_MIGRATION))
2137/*
2138 * Because tail pages are not marked as "used", set it. We're under
2139 * zone->lru_lock, 'splitting on pmd' and compund_lock.
2140 */
2141void mem_cgroup_split_huge_fixup(struct page *head, struct page *tail)
2142{
2143 struct page_cgroup *head_pc = lookup_page_cgroup(head);
2144 struct page_cgroup *tail_pc = lookup_page_cgroup(tail);
2145 unsigned long flags;
2146
2147 /*
2148 * We have no races with charge/uncharge but will have races with
2149 * page state accounting.
2150 */
2151 move_lock_page_cgroup(head_pc, &flags);
2152
2153 tail_pc->mem_cgroup = head_pc->mem_cgroup;
2154 smp_wmb(); /* see __commit_charge() */
2155 if (PageCgroupAcctLRU(head_pc)) {
2156 enum lru_list lru;
2157 struct mem_cgroup_per_zone *mz;
2158
2159 /*
2160 * LRU flags cannot be copied because we need to add tail
2161 *.page to LRU by generic call and our hook will be called.
2162 * We hold lru_lock, then, reduce counter directly.
2163 */
2164 lru = page_lru(head);
2165 mz = page_cgroup_zoneinfo(head_pc);
2166 MEM_CGROUP_ZSTAT(mz, lru) -= 1;
2167 }
2168 tail_pc->flags = head_pc->flags & ~PCGF_NOCOPY_AT_SPLIT;
2169 move_unlock_page_cgroup(head_pc, &flags);
2170}
2171#endif
2172
2156/** 2173/**
2157 * __mem_cgroup_move_account - move account of the page 2174 * __mem_cgroup_move_account - move account of the page
2158 * @pc: page_cgroup of the page. 2175 * @pc: page_cgroup of the page.
@@ -2171,8 +2188,11 @@ static void __mem_cgroup_commit_charge(struct mem_cgroup *mem,
2171 */ 2188 */
2172 2189
2173static void __mem_cgroup_move_account(struct page_cgroup *pc, 2190static void __mem_cgroup_move_account(struct page_cgroup *pc,
2174 struct mem_cgroup *from, struct mem_cgroup *to, bool uncharge) 2191 struct mem_cgroup *from, struct mem_cgroup *to, bool uncharge,
2192 int charge_size)
2175{ 2193{
2194 int nr_pages = charge_size >> PAGE_SHIFT;
2195
2176 VM_BUG_ON(from == to); 2196 VM_BUG_ON(from == to);
2177 VM_BUG_ON(PageLRU(pc->page)); 2197 VM_BUG_ON(PageLRU(pc->page));
2178 VM_BUG_ON(!page_is_cgroup_locked(pc)); 2198 VM_BUG_ON(!page_is_cgroup_locked(pc));
@@ -2186,14 +2206,14 @@ static void __mem_cgroup_move_account(struct page_cgroup *pc,
2186 __this_cpu_inc(to->stat->count[MEM_CGROUP_STAT_FILE_MAPPED]); 2206 __this_cpu_inc(to->stat->count[MEM_CGROUP_STAT_FILE_MAPPED]);
2187 preempt_enable(); 2207 preempt_enable();
2188 } 2208 }
2189 mem_cgroup_charge_statistics(from, pc, false); 2209 mem_cgroup_charge_statistics(from, PageCgroupCache(pc), -nr_pages);
2190 if (uncharge) 2210 if (uncharge)
2191 /* This is not "cancel", but cancel_charge does all we need. */ 2211 /* This is not "cancel", but cancel_charge does all we need. */
2192 mem_cgroup_cancel_charge(from, PAGE_SIZE); 2212 mem_cgroup_cancel_charge(from, charge_size);
2193 2213
2194 /* caller should have done css_get */ 2214 /* caller should have done css_get */
2195 pc->mem_cgroup = to; 2215 pc->mem_cgroup = to;
2196 mem_cgroup_charge_statistics(to, pc, true); 2216 mem_cgroup_charge_statistics(to, PageCgroupCache(pc), nr_pages);
2197 /* 2217 /*
2198 * We charges against "to" which may not have any tasks. Then, "to" 2218 * We charges against "to" which may not have any tasks. Then, "to"
2199 * can be under rmdir(). But in current implementation, caller of 2219 * can be under rmdir(). But in current implementation, caller of
@@ -2208,15 +2228,19 @@ static void __mem_cgroup_move_account(struct page_cgroup *pc,
2208 * __mem_cgroup_move_account() 2228 * __mem_cgroup_move_account()
2209 */ 2229 */
2210static int mem_cgroup_move_account(struct page_cgroup *pc, 2230static int mem_cgroup_move_account(struct page_cgroup *pc,
2211 struct mem_cgroup *from, struct mem_cgroup *to, bool uncharge) 2231 struct mem_cgroup *from, struct mem_cgroup *to,
2232 bool uncharge, int charge_size)
2212{ 2233{
2213 int ret = -EINVAL; 2234 int ret = -EINVAL;
2214 unsigned long flags; 2235 unsigned long flags;
2215 2236
2237 if ((charge_size > PAGE_SIZE) && !PageTransHuge(pc->page))
2238 return -EBUSY;
2239
2216 lock_page_cgroup(pc); 2240 lock_page_cgroup(pc);
2217 if (PageCgroupUsed(pc) && pc->mem_cgroup == from) { 2241 if (PageCgroupUsed(pc) && pc->mem_cgroup == from) {
2218 move_lock_page_cgroup(pc, &flags); 2242 move_lock_page_cgroup(pc, &flags);
2219 __mem_cgroup_move_account(pc, from, to, uncharge); 2243 __mem_cgroup_move_account(pc, from, to, uncharge, charge_size);
2220 move_unlock_page_cgroup(pc, &flags); 2244 move_unlock_page_cgroup(pc, &flags);
2221 ret = 0; 2245 ret = 0;
2222 } 2246 }
@@ -2241,6 +2265,8 @@ static int mem_cgroup_move_parent(struct page_cgroup *pc,
2241 struct cgroup *cg = child->css.cgroup; 2265 struct cgroup *cg = child->css.cgroup;
2242 struct cgroup *pcg = cg->parent; 2266 struct cgroup *pcg = cg->parent;
2243 struct mem_cgroup *parent; 2267 struct mem_cgroup *parent;
2268 int charge = PAGE_SIZE;
2269 unsigned long flags;
2244 int ret; 2270 int ret;
2245 2271
2246 /* Is ROOT ? */ 2272 /* Is ROOT ? */
@@ -2252,17 +2278,23 @@ static int mem_cgroup_move_parent(struct page_cgroup *pc,
2252 goto out; 2278 goto out;
2253 if (isolate_lru_page(page)) 2279 if (isolate_lru_page(page))
2254 goto put; 2280 goto put;
2281 /* The page is isolated from LRU and we have no race with splitting */
2282 charge = PAGE_SIZE << compound_order(page);
2255 2283
2256 parent = mem_cgroup_from_cont(pcg); 2284 parent = mem_cgroup_from_cont(pcg);
2257 ret = __mem_cgroup_try_charge(NULL, gfp_mask, &parent, false, 2285 ret = __mem_cgroup_try_charge(NULL, gfp_mask, &parent, false, charge);
2258 PAGE_SIZE);
2259 if (ret || !parent) 2286 if (ret || !parent)
2260 goto put_back; 2287 goto put_back;
2261 2288
2262 ret = mem_cgroup_move_account(pc, child, parent, true); 2289 if (charge > PAGE_SIZE)
2290 flags = compound_lock_irqsave(page);
2291
2292 ret = mem_cgroup_move_account(pc, child, parent, true, charge);
2263 if (ret) 2293 if (ret)
2264 mem_cgroup_cancel_charge(parent, PAGE_SIZE); 2294 mem_cgroup_cancel_charge(parent, charge);
2265put_back: 2295put_back:
2296 if (charge > PAGE_SIZE)
2297 compound_unlock_irqrestore(page, flags);
2266 putback_lru_page(page); 2298 putback_lru_page(page);
2267put: 2299put:
2268 put_page(page); 2300 put_page(page);
@@ -2546,7 +2578,6 @@ direct_uncharge:
2546static struct mem_cgroup * 2578static struct mem_cgroup *
2547__mem_cgroup_uncharge_common(struct page *page, enum charge_type ctype) 2579__mem_cgroup_uncharge_common(struct page *page, enum charge_type ctype)
2548{ 2580{
2549 int i;
2550 int count; 2581 int count;
2551 struct page_cgroup *pc; 2582 struct page_cgroup *pc;
2552 struct mem_cgroup *mem = NULL; 2583 struct mem_cgroup *mem = NULL;
@@ -2596,8 +2627,7 @@ __mem_cgroup_uncharge_common(struct page *page, enum charge_type ctype)
2596 break; 2627 break;
2597 } 2628 }
2598 2629
2599 for (i = 0; i < count; i++) 2630 mem_cgroup_charge_statistics(mem, PageCgroupCache(pc), -count);
2600 mem_cgroup_charge_statistics(mem, pc + i, false);
2601 2631
2602 ClearPageCgroupUsed(pc); 2632 ClearPageCgroupUsed(pc);
2603 /* 2633 /*
@@ -4844,7 +4874,7 @@ retry:
4844 goto put; 4874 goto put;
4845 pc = lookup_page_cgroup(page); 4875 pc = lookup_page_cgroup(page);
4846 if (!mem_cgroup_move_account(pc, 4876 if (!mem_cgroup_move_account(pc,
4847 mc.from, mc.to, false)) { 4877 mc.from, mc.to, false, PAGE_SIZE)) {
4848 mc.precharge--; 4878 mc.precharge--;
4849 /* we uncharge from mc.from later. */ 4879 /* we uncharge from mc.from later. */
4850 mc.moved_charge++; 4880 mc.moved_charge++;
diff --git a/mm/truncate.c b/mm/truncate.c
index 3c2d5ddfa0d4..49feb46e77b8 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -549,13 +549,12 @@ EXPORT_SYMBOL(truncate_pagecache);
549 * @inode: inode 549 * @inode: inode
550 * @newsize: new file size 550 * @newsize: new file size
551 * 551 *
552 * truncate_setsize updastes i_size update and performs pagecache 552 * truncate_setsize updates i_size and performs pagecache truncation (if
553 * truncation (if necessary) for a file size updates. It will be 553 * necessary) to @newsize. It will be typically be called from the filesystem's
554 * typically be called from the filesystem's setattr function when 554 * setattr function when ATTR_SIZE is passed in.
555 * ATTR_SIZE is passed in.
556 * 555 *
557 * Must be called with inode_mutex held and after all filesystem 556 * Must be called with inode_mutex held and before all filesystem specific
558 * specific block truncation has been performed. 557 * block truncation has been performed.
559 */ 558 */
560void truncate_setsize(struct inode *inode, loff_t newsize) 559void truncate_setsize(struct inode *inode, loff_t newsize)
561{ 560{
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 47a50962ce81..f5d90dedebba 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -41,7 +41,6 @@
41#include <linux/memcontrol.h> 41#include <linux/memcontrol.h>
42#include <linux/delayacct.h> 42#include <linux/delayacct.h>
43#include <linux/sysctl.h> 43#include <linux/sysctl.h>
44#include <linux/compaction.h>
45 44
46#include <asm/tlbflush.h> 45#include <asm/tlbflush.h>
47#include <asm/div64.h> 46#include <asm/div64.h>
diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index d4d9926c2201..65106fb61b8f 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -151,9 +151,9 @@ int debug_log(struct bat_priv *bat_priv, char *fmt, ...);
151 } \ 151 } \
152 while (0) 152 while (0)
153#else /* !CONFIG_BATMAN_ADV_DEBUG */ 153#else /* !CONFIG_BATMAN_ADV_DEBUG */
154static inline void bat_dbg(char type __attribute__((unused)), 154static inline void bat_dbg(char type __always_unused,
155 struct bat_priv *bat_priv __attribute__((unused)), 155 struct bat_priv *bat_priv __always_unused,
156 char *fmt __attribute__((unused)), ...) 156 char *fmt __always_unused, ...)
157{ 157{
158} 158}
159#endif 159#endif
diff --git a/net/batman-adv/packet.h b/net/batman-adv/packet.h
index b49fdf70a6d5..2284e8129cb2 100644
--- a/net/batman-adv/packet.h
+++ b/net/batman-adv/packet.h
@@ -63,7 +63,7 @@ struct batman_packet {
63 uint8_t num_hna; 63 uint8_t num_hna;
64 uint8_t gw_flags; /* flags related to gateway class */ 64 uint8_t gw_flags; /* flags related to gateway class */
65 uint8_t align; 65 uint8_t align;
66} __attribute__((packed)); 66} __packed;
67 67
68#define BAT_PACKET_LEN sizeof(struct batman_packet) 68#define BAT_PACKET_LEN sizeof(struct batman_packet)
69 69
@@ -76,7 +76,7 @@ struct icmp_packet {
76 uint8_t orig[6]; 76 uint8_t orig[6];
77 uint16_t seqno; 77 uint16_t seqno;
78 uint8_t uid; 78 uint8_t uid;
79} __attribute__((packed)); 79} __packed;
80 80
81#define BAT_RR_LEN 16 81#define BAT_RR_LEN 16
82 82
@@ -93,14 +93,14 @@ struct icmp_packet_rr {
93 uint8_t uid; 93 uint8_t uid;
94 uint8_t rr_cur; 94 uint8_t rr_cur;
95 uint8_t rr[BAT_RR_LEN][ETH_ALEN]; 95 uint8_t rr[BAT_RR_LEN][ETH_ALEN];
96} __attribute__((packed)); 96} __packed;
97 97
98struct unicast_packet { 98struct unicast_packet {
99 uint8_t packet_type; 99 uint8_t packet_type;
100 uint8_t version; /* batman version field */ 100 uint8_t version; /* batman version field */
101 uint8_t dest[6]; 101 uint8_t dest[6];
102 uint8_t ttl; 102 uint8_t ttl;
103} __attribute__((packed)); 103} __packed;
104 104
105struct unicast_frag_packet { 105struct unicast_frag_packet {
106 uint8_t packet_type; 106 uint8_t packet_type;
@@ -110,7 +110,7 @@ struct unicast_frag_packet {
110 uint8_t flags; 110 uint8_t flags;
111 uint8_t orig[6]; 111 uint8_t orig[6];
112 uint16_t seqno; 112 uint16_t seqno;
113} __attribute__((packed)); 113} __packed;
114 114
115struct bcast_packet { 115struct bcast_packet {
116 uint8_t packet_type; 116 uint8_t packet_type;
@@ -118,7 +118,7 @@ struct bcast_packet {
118 uint8_t orig[6]; 118 uint8_t orig[6];
119 uint8_t ttl; 119 uint8_t ttl;
120 uint32_t seqno; 120 uint32_t seqno;
121} __attribute__((packed)); 121} __packed;
122 122
123struct vis_packet { 123struct vis_packet {
124 uint8_t packet_type; 124 uint8_t packet_type;
@@ -131,6 +131,6 @@ struct vis_packet {
131 * neighbors */ 131 * neighbors */
132 uint8_t target_orig[6]; /* who should receive this packet */ 132 uint8_t target_orig[6]; /* who should receive this packet */
133 uint8_t sender_orig[6]; /* who sent or rebroadcasted this packet */ 133 uint8_t sender_orig[6]; /* who sent or rebroadcasted this packet */
134} __attribute__((packed)); 134} __packed;
135 135
136#endif /* _NET_BATMAN_ADV_PACKET_H_ */ 136#endif /* _NET_BATMAN_ADV_PACKET_H_ */
diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h
index 97cb23dd3e69..bf3f6f5a12c4 100644
--- a/net/batman-adv/types.h
+++ b/net/batman-adv/types.h
@@ -246,13 +246,13 @@ struct vis_info {
246 /* this packet might be part of the vis send queue. */ 246 /* this packet might be part of the vis send queue. */
247 struct sk_buff *skb_packet; 247 struct sk_buff *skb_packet;
248 /* vis_info may follow here*/ 248 /* vis_info may follow here*/
249} __attribute__((packed)); 249} __packed;
250 250
251struct vis_info_entry { 251struct vis_info_entry {
252 uint8_t src[ETH_ALEN]; 252 uint8_t src[ETH_ALEN];
253 uint8_t dest[ETH_ALEN]; 253 uint8_t dest[ETH_ALEN];
254 uint8_t quality; /* quality = 0 means HNA */ 254 uint8_t quality; /* quality = 0 means HNA */
255} __attribute__((packed)); 255} __packed;
256 256
257struct recvlist_node { 257struct recvlist_node {
258 struct list_head list; 258 struct list_head list;
diff --git a/net/batman-adv/unicast.c b/net/batman-adv/unicast.c
index dc2e28bed844..ee41fef04b21 100644
--- a/net/batman-adv/unicast.c
+++ b/net/batman-adv/unicast.c
@@ -229,10 +229,12 @@ int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
229 if (!bat_priv->primary_if) 229 if (!bat_priv->primary_if)
230 goto dropped; 230 goto dropped;
231 231
232 unicast_packet = (struct unicast_packet *) skb->data; 232 frag_skb = dev_alloc_skb(data_len - (data_len / 2) + ucf_hdr_len);
233 if (!frag_skb)
234 goto dropped;
233 235
236 unicast_packet = (struct unicast_packet *) skb->data;
234 memcpy(&tmp_uc, unicast_packet, uc_hdr_len); 237 memcpy(&tmp_uc, unicast_packet, uc_hdr_len);
235 frag_skb = dev_alloc_skb(data_len - (data_len / 2) + ucf_hdr_len);
236 skb_split(skb, frag_skb, data_len / 2); 238 skb_split(skb, frag_skb, data_len / 2);
237 239
238 if (my_skb_head_push(skb, ucf_hdr_len - uc_hdr_len) < 0 || 240 if (my_skb_head_push(skb, ucf_hdr_len - uc_hdr_len) < 0 ||
diff --git a/net/caif/cfcnfg.c b/net/caif/cfcnfg.c
index 21ede141018a..c665de778b60 100644
--- a/net/caif/cfcnfg.c
+++ b/net/caif/cfcnfg.c
@@ -191,6 +191,7 @@ int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg, struct cflayer *adap_layer)
191 struct cflayer *servl = NULL; 191 struct cflayer *servl = NULL;
192 struct cfcnfg_phyinfo *phyinfo = NULL; 192 struct cfcnfg_phyinfo *phyinfo = NULL;
193 u8 phyid = 0; 193 u8 phyid = 0;
194
194 caif_assert(adap_layer != NULL); 195 caif_assert(adap_layer != NULL);
195 channel_id = adap_layer->id; 196 channel_id = adap_layer->id;
196 if (adap_layer->dn == NULL || channel_id == 0) { 197 if (adap_layer->dn == NULL || channel_id == 0) {
@@ -199,16 +200,16 @@ int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg, struct cflayer *adap_layer)
199 goto end; 200 goto end;
200 } 201 }
201 servl = cfmuxl_remove_uplayer(cnfg->mux, channel_id); 202 servl = cfmuxl_remove_uplayer(cnfg->mux, channel_id);
202 if (servl == NULL)
203 goto end;
204 layer_set_up(servl, NULL);
205 ret = cfctrl_linkdown_req(cnfg->ctrl, channel_id, adap_layer);
206 if (servl == NULL) { 203 if (servl == NULL) {
207 pr_err("PROTOCOL ERROR - Error removing service_layer Channel_Id(%d)", 204 pr_err("PROTOCOL ERROR - Error removing service_layer Channel_Id(%d)",
208 channel_id); 205 channel_id);
209 ret = -EINVAL; 206 ret = -EINVAL;
210 goto end; 207 goto end;
211 } 208 }
209 layer_set_up(servl, NULL);
210 ret = cfctrl_linkdown_req(cnfg->ctrl, channel_id, adap_layer);
211 if (ret)
212 goto end;
212 caif_assert(channel_id == servl->id); 213 caif_assert(channel_id == servl->id);
213 if (adap_layer->dn != NULL) { 214 if (adap_layer->dn != NULL) {
214 phyid = cfsrvl_getphyid(adap_layer->dn); 215 phyid = cfsrvl_getphyid(adap_layer->dn);
diff --git a/net/can/bcm.c b/net/can/bcm.c
index 9d5e8accfab1..092dc88a7c64 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -1256,6 +1256,9 @@ static int bcm_sendmsg(struct kiocb *iocb, struct socket *sock,
1256 struct sockaddr_can *addr = 1256 struct sockaddr_can *addr =
1257 (struct sockaddr_can *)msg->msg_name; 1257 (struct sockaddr_can *)msg->msg_name;
1258 1258
1259 if (msg->msg_namelen < sizeof(*addr))
1260 return -EINVAL;
1261
1259 if (addr->can_family != AF_CAN) 1262 if (addr->can_family != AF_CAN)
1260 return -EINVAL; 1263 return -EINVAL;
1261 1264
diff --git a/net/can/raw.c b/net/can/raw.c
index e88f610fdb7b..883e9d74fddf 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -649,6 +649,9 @@ static int raw_sendmsg(struct kiocb *iocb, struct socket *sock,
649 struct sockaddr_can *addr = 649 struct sockaddr_can *addr =
650 (struct sockaddr_can *)msg->msg_name; 650 (struct sockaddr_can *)msg->msg_name;
651 651
652 if (msg->msg_namelen < sizeof(*addr))
653 return -EINVAL;
654
652 if (addr->can_family != AF_CAN) 655 if (addr->can_family != AF_CAN)
653 return -EINVAL; 656 return -EINVAL;
654 657
diff --git a/net/core/dev.c b/net/core/dev.c
index 54277df0f735..7c6a46f80372 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2001,7 +2001,7 @@ static bool can_checksum_protocol(unsigned long features, __be16 protocol)
2001 2001
2002static int harmonize_features(struct sk_buff *skb, __be16 protocol, int features) 2002static int harmonize_features(struct sk_buff *skb, __be16 protocol, int features)
2003{ 2003{
2004 if (!can_checksum_protocol(protocol, features)) { 2004 if (!can_checksum_protocol(features, protocol)) {
2005 features &= ~NETIF_F_ALL_CSUM; 2005 features &= ~NETIF_F_ALL_CSUM;
2006 features &= ~NETIF_F_SG; 2006 features &= ~NETIF_F_SG;
2007 } else if (illegal_highdma(skb->dev, skb)) { 2007 } else if (illegal_highdma(skb->dev, skb)) {
@@ -2023,13 +2023,13 @@ int netif_skb_features(struct sk_buff *skb)
2023 return harmonize_features(skb, protocol, features); 2023 return harmonize_features(skb, protocol, features);
2024 } 2024 }
2025 2025
2026 features &= skb->dev->vlan_features; 2026 features &= (skb->dev->vlan_features | NETIF_F_HW_VLAN_TX);
2027 2027
2028 if (protocol != htons(ETH_P_8021Q)) { 2028 if (protocol != htons(ETH_P_8021Q)) {
2029 return harmonize_features(skb, protocol, features); 2029 return harmonize_features(skb, protocol, features);
2030 } else { 2030 } else {
2031 features &= NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | 2031 features &= NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST |
2032 NETIF_F_GEN_CSUM; 2032 NETIF_F_GEN_CSUM | NETIF_F_HW_VLAN_TX;
2033 return harmonize_features(skb, protocol, features); 2033 return harmonize_features(skb, protocol, features);
2034 } 2034 }
2035} 2035}
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index a5f7535aab5b..750db57f3bb3 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1820,7 +1820,7 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
1820 if (kind != 2 && security_netlink_recv(skb, CAP_NET_ADMIN)) 1820 if (kind != 2 && security_netlink_recv(skb, CAP_NET_ADMIN))
1821 return -EPERM; 1821 return -EPERM;
1822 1822
1823 if (kind == 2 && (nlh->nlmsg_flags & NLM_F_DUMP) == NLM_F_DUMP) { 1823 if (kind == 2 && nlh->nlmsg_flags&NLM_F_DUMP) {
1824 struct sock *rtnl; 1824 struct sock *rtnl;
1825 rtnl_dumpit_func dumpit; 1825 rtnl_dumpit_func dumpit;
1826 1826
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 2746c1fa6417..2ada17129fce 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -858,7 +858,7 @@ static int inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
858 nlmsg_len(nlh) < hdrlen) 858 nlmsg_len(nlh) < hdrlen)
859 return -EINVAL; 859 return -EINVAL;
860 860
861 if ((nlh->nlmsg_flags & NLM_F_DUMP) == NLM_F_DUMP) { 861 if (nlh->nlmsg_flags & NLM_F_DUMP) {
862 if (nlmsg_attrlen(nlh, hdrlen)) { 862 if (nlmsg_attrlen(nlh, hdrlen)) {
863 struct nlattr *attr; 863 struct nlattr *attr;
864 864
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 5b189c97c2fc..24a1cf110d80 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -420,9 +420,6 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
420 dev->type == ARPHRD_TUNNEL6 || 420 dev->type == ARPHRD_TUNNEL6 ||
421 dev->type == ARPHRD_SIT || 421 dev->type == ARPHRD_SIT ||
422 dev->type == ARPHRD_NONE) { 422 dev->type == ARPHRD_NONE) {
423 printk(KERN_INFO
424 "%s: Disabled Privacy Extensions\n",
425 dev->name);
426 ndev->cnf.use_tempaddr = -1; 423 ndev->cnf.use_tempaddr = -1;
427 } else { 424 } else {
428 in6_dev_hold(ndev); 425 in6_dev_hold(ndev);
diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig
index 9109262abd24..c766056d0488 100644
--- a/net/mac80211/Kconfig
+++ b/net/mac80211/Kconfig
@@ -20,7 +20,7 @@ config MAC80211_HAS_RC
20 def_bool n 20 def_bool n
21 21
22config MAC80211_RC_PID 22config MAC80211_RC_PID
23 bool "PID controller based rate control algorithm" if EMBEDDED 23 bool "PID controller based rate control algorithm" if EXPERT
24 select MAC80211_HAS_RC 24 select MAC80211_HAS_RC
25 ---help--- 25 ---help---
26 This option enables a TX rate control algorithm for 26 This option enables a TX rate control algorithm for
@@ -28,14 +28,14 @@ config MAC80211_RC_PID
28 rate. 28 rate.
29 29
30config MAC80211_RC_MINSTREL 30config MAC80211_RC_MINSTREL
31 bool "Minstrel" if EMBEDDED 31 bool "Minstrel" if EXPERT
32 select MAC80211_HAS_RC 32 select MAC80211_HAS_RC
33 default y 33 default y
34 ---help--- 34 ---help---
35 This option enables the 'minstrel' TX rate control algorithm 35 This option enables the 'minstrel' TX rate control algorithm
36 36
37config MAC80211_RC_MINSTREL_HT 37config MAC80211_RC_MINSTREL_HT
38 bool "Minstrel 802.11n support" if EMBEDDED 38 bool "Minstrel 802.11n support" if EXPERT
39 depends on MAC80211_RC_MINSTREL 39 depends on MAC80211_RC_MINSTREL
40 default y 40 default y
41 ---help--- 41 ---help---
diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c
index f138b195d657..227ca82eef72 100644
--- a/net/mac80211/agg-rx.c
+++ b/net/mac80211/agg-rx.c
@@ -185,8 +185,6 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
185 struct ieee80211_mgmt *mgmt, 185 struct ieee80211_mgmt *mgmt,
186 size_t len) 186 size_t len)
187{ 187{
188 struct ieee80211_hw *hw = &local->hw;
189 struct ieee80211_conf *conf = &hw->conf;
190 struct tid_ampdu_rx *tid_agg_rx; 188 struct tid_ampdu_rx *tid_agg_rx;
191 u16 capab, tid, timeout, ba_policy, buf_size, start_seq_num, status; 189 u16 capab, tid, timeout, ba_policy, buf_size, start_seq_num, status;
192 u8 dialog_token; 190 u8 dialog_token;
@@ -231,13 +229,8 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
231 goto end_no_lock; 229 goto end_no_lock;
232 } 230 }
233 /* determine default buffer size */ 231 /* determine default buffer size */
234 if (buf_size == 0) { 232 if (buf_size == 0)
235 struct ieee80211_supported_band *sband; 233 buf_size = IEEE80211_MAX_AMPDU_BUF;
236
237 sband = local->hw.wiphy->bands[conf->channel->band];
238 buf_size = IEEE80211_MIN_AMPDU_BUF;
239 buf_size = buf_size << sband->ht_cap.ampdu_factor;
240 }
241 234
242 235
243 /* examine state machine */ 236 /* examine state machine */
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 485d36bc9a46..a46ff06d7cb8 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -39,6 +39,8 @@ module_param(ieee80211_disable_40mhz_24ghz, bool, 0644);
39MODULE_PARM_DESC(ieee80211_disable_40mhz_24ghz, 39MODULE_PARM_DESC(ieee80211_disable_40mhz_24ghz,
40 "Disable 40MHz support in the 2.4GHz band"); 40 "Disable 40MHz support in the 2.4GHz band");
41 41
42static struct lock_class_key ieee80211_rx_skb_queue_class;
43
42void ieee80211_configure_filter(struct ieee80211_local *local) 44void ieee80211_configure_filter(struct ieee80211_local *local)
43{ 45{
44 u64 mc; 46 u64 mc;
@@ -569,7 +571,15 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
569 spin_lock_init(&local->filter_lock); 571 spin_lock_init(&local->filter_lock);
570 spin_lock_init(&local->queue_stop_reason_lock); 572 spin_lock_init(&local->queue_stop_reason_lock);
571 573
572 skb_queue_head_init(&local->rx_skb_queue); 574 /*
575 * The rx_skb_queue is only accessed from tasklets,
576 * but other SKB queues are used from within IRQ
577 * context. Therefore, this one needs a different
578 * locking class so our direct, non-irq-safe use of
579 * the queue's lock doesn't throw lockdep warnings.
580 */
581 skb_queue_head_init_class(&local->rx_skb_queue,
582 &ieee80211_rx_skb_queue_class);
573 583
574 INIT_DELAYED_WORK(&local->scan_work, ieee80211_scan_work); 584 INIT_DELAYED_WORK(&local->scan_work, ieee80211_scan_work);
575 585
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 2b7eef37875c..93297aaceb2b 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -924,7 +924,7 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb,
924 u16 zone; 924 u16 zone;
925 int err; 925 int err;
926 926
927 if ((nlh->nlmsg_flags & NLM_F_DUMP) == NLM_F_DUMP) 927 if (nlh->nlmsg_flags & NLM_F_DUMP)
928 return netlink_dump_start(ctnl, skb, nlh, ctnetlink_dump_table, 928 return netlink_dump_start(ctnl, skb, nlh, ctnetlink_dump_table,
929 ctnetlink_done); 929 ctnetlink_done);
930 930
@@ -1787,7 +1787,7 @@ ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb,
1787 u16 zone; 1787 u16 zone;
1788 int err; 1788 int err;
1789 1789
1790 if ((nlh->nlmsg_flags & NLM_F_DUMP) == NLM_F_DUMP) { 1790 if (nlh->nlmsg_flags & NLM_F_DUMP) {
1791 return netlink_dump_start(ctnl, skb, nlh, 1791 return netlink_dump_start(ctnl, skb, nlh,
1792 ctnetlink_exp_dump_table, 1792 ctnetlink_exp_dump_table,
1793 ctnetlink_exp_done); 1793 ctnetlink_exp_done);
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index f83cb370292b..1781d99145e2 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -519,7 +519,7 @@ static int genl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
519 security_netlink_recv(skb, CAP_NET_ADMIN)) 519 security_netlink_recv(skb, CAP_NET_ADMIN))
520 return -EPERM; 520 return -EPERM;
521 521
522 if ((nlh->nlmsg_flags & NLM_F_DUMP) == NLM_F_DUMP) { 522 if (nlh->nlmsg_flags & NLM_F_DUMP) {
523 if (ops->dumpit == NULL) 523 if (ops->dumpit == NULL)
524 return -EOPNOTSUPP; 524 return -EOPNOTSUPP;
525 525
diff --git a/net/rfkill/Kconfig b/net/rfkill/Kconfig
index eaf765876458..7fce6dfd2180 100644
--- a/net/rfkill/Kconfig
+++ b/net/rfkill/Kconfig
@@ -18,7 +18,7 @@ config RFKILL_LEDS
18 default y 18 default y
19 19
20config RFKILL_INPUT 20config RFKILL_INPUT
21 bool "RF switch input support" if EMBEDDED 21 bool "RF switch input support" if EXPERT
22 depends on RFKILL 22 depends on RFKILL
23 depends on INPUT = y || RFKILL = INPUT 23 depends on INPUT = y || RFKILL = INPUT
24 default y if !EMBEDDED 24 default y if !EXPERT
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index a09b0dd25f50..8e02550ff3e8 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -3428,7 +3428,7 @@ SCTP_STATIC int sctp_setsockopt(struct sock *sk, int level, int optname,
3428 retval = sctp_setsockopt_peer_addr_params(sk, optval, optlen); 3428 retval = sctp_setsockopt_peer_addr_params(sk, optval, optlen);
3429 break; 3429 break;
3430 3430
3431 case SCTP_DELAYED_ACK: 3431 case SCTP_DELAYED_SACK:
3432 retval = sctp_setsockopt_delayed_ack(sk, optval, optlen); 3432 retval = sctp_setsockopt_delayed_ack(sk, optval, optlen);
3433 break; 3433 break;
3434 case SCTP_PARTIAL_DELIVERY_POINT: 3434 case SCTP_PARTIAL_DELIVERY_POINT:
@@ -5333,7 +5333,7 @@ SCTP_STATIC int sctp_getsockopt(struct sock *sk, int level, int optname,
5333 retval = sctp_getsockopt_peer_addr_params(sk, len, optval, 5333 retval = sctp_getsockopt_peer_addr_params(sk, len, optval,
5334 optlen); 5334 optlen);
5335 break; 5335 break;
5336 case SCTP_DELAYED_ACK: 5336 case SCTP_DELAYED_SACK:
5337 retval = sctp_getsockopt_delayed_ack(sk, len, optval, 5337 retval = sctp_getsockopt_delayed_ack(sk, len, optval,
5338 optlen); 5338 optlen);
5339 break; 5339 break;
diff --git a/net/wireless/Kconfig b/net/wireless/Kconfig
index d0ee29063e5d..1f1ef70f34f2 100644
--- a/net/wireless/Kconfig
+++ b/net/wireless/Kconfig
@@ -95,7 +95,7 @@ config CFG80211_DEBUGFS
95 If unsure, say N. 95 If unsure, say N.
96 96
97config CFG80211_INTERNAL_REGDB 97config CFG80211_INTERNAL_REGDB
98 bool "use statically compiled regulatory rules database" if EMBEDDED 98 bool "use statically compiled regulatory rules database" if EXPERT
99 default n 99 default n
100 depends on CFG80211 100 depends on CFG80211
101 ---help--- 101 ---help---
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index d5e1e0b08890..61291965c5f6 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -2189,7 +2189,7 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
2189 2189
2190 if ((type == (XFRM_MSG_GETSA - XFRM_MSG_BASE) || 2190 if ((type == (XFRM_MSG_GETSA - XFRM_MSG_BASE) ||
2191 type == (XFRM_MSG_GETPOLICY - XFRM_MSG_BASE)) && 2191 type == (XFRM_MSG_GETPOLICY - XFRM_MSG_BASE)) &&
2192 (nlh->nlmsg_flags & NLM_F_DUMP) == NLM_F_DUMP) { 2192 (nlh->nlmsg_flags & NLM_F_DUMP)) {
2193 if (link->dump == NULL) 2193 if (link->dump == NULL)
2194 return -EINVAL; 2194 return -EINVAL;
2195 2195
diff --git a/security/keys/compat.c b/security/keys/compat.c
index 792c0a611a6d..07a5f35e3970 100644
--- a/security/keys/compat.c
+++ b/security/keys/compat.c
@@ -1,4 +1,4 @@
1/* compat.c: 32-bit compatibility syscall for 64-bit systems 1/* 32-bit compatibility syscall for 64-bit systems
2 * 2 *
3 * Copyright (C) 2004-5 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2004-5 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -14,13 +14,13 @@
14#include <linux/compat.h> 14#include <linux/compat.h>
15#include "internal.h" 15#include "internal.h"
16 16
17/*****************************************************************************/
18/* 17/*
19 * the key control system call, 32-bit compatibility version for 64-bit archs 18 * The key control system call, 32-bit compatibility version for 64-bit archs
20 * - this should only be called if the 64-bit arch uses weird pointers in 19 *
21 * 32-bit mode or doesn't guarantee that the top 32-bits of the argument 20 * This should only be called if the 64-bit arch uses weird pointers in 32-bit
22 * registers on taking a 32-bit syscall are zero 21 * mode or doesn't guarantee that the top 32-bits of the argument registers on
23 * - if you can, you should call sys_keyctl directly 22 * taking a 32-bit syscall are zero. If you can, you should call sys_keyctl()
23 * directly.
24 */ 24 */
25asmlinkage long compat_sys_keyctl(u32 option, 25asmlinkage long compat_sys_keyctl(u32 option,
26 u32 arg2, u32 arg3, u32 arg4, u32 arg5) 26 u32 arg2, u32 arg3, u32 arg4, u32 arg5)
@@ -88,5 +88,4 @@ asmlinkage long compat_sys_keyctl(u32 option,
88 default: 88 default:
89 return -EOPNOTSUPP; 89 return -EOPNOTSUPP;
90 } 90 }
91 91}
92} /* end compat_sys_keyctl() */
diff --git a/security/keys/encrypted_defined.c b/security/keys/encrypted_defined.c
index 32d27c858388..28791a65740e 100644
--- a/security/keys/encrypted_defined.c
+++ b/security/keys/encrypted_defined.c
@@ -888,7 +888,6 @@ static int __init init_encrypted(void)
888out: 888out:
889 encrypted_shash_release(); 889 encrypted_shash_release();
890 return ret; 890 return ret;
891
892} 891}
893 892
894static void __exit cleanup_encrypted(void) 893static void __exit cleanup_encrypted(void)
diff --git a/security/keys/gc.c b/security/keys/gc.c
index a46e825cbf02..89df6b5f203c 100644
--- a/security/keys/gc.c
+++ b/security/keys/gc.c
@@ -32,8 +32,8 @@ static time_t key_gc_next_run = LONG_MAX;
32static time_t key_gc_new_timer; 32static time_t key_gc_new_timer;
33 33
34/* 34/*
35 * Schedule a garbage collection run 35 * Schedule a garbage collection run.
36 * - precision isn't particularly important 36 * - time precision isn't particularly important
37 */ 37 */
38void key_schedule_gc(time_t gc_at) 38void key_schedule_gc(time_t gc_at)
39{ 39{
@@ -61,8 +61,9 @@ static void key_gc_timer_func(unsigned long data)
61} 61}
62 62
63/* 63/*
64 * Garbage collect pointers from a keyring 64 * Garbage collect pointers from a keyring.
65 * - return true if we altered the keyring 65 *
66 * Return true if we altered the keyring.
66 */ 67 */
67static bool key_gc_keyring(struct key *keyring, time_t limit) 68static bool key_gc_keyring(struct key *keyring, time_t limit)
68 __releases(key_serial_lock) 69 __releases(key_serial_lock)
@@ -107,9 +108,8 @@ do_gc:
107} 108}
108 109
109/* 110/*
110 * Garbage collector for keys 111 * Garbage collector for keys. This involves scanning the keyrings for dead,
111 * - this involves scanning the keyrings for dead, expired and revoked keys 112 * expired and revoked keys that have overstayed their welcome
112 * that have overstayed their welcome
113 */ 113 */
114static void key_garbage_collector(struct work_struct *work) 114static void key_garbage_collector(struct work_struct *work)
115{ 115{
diff --git a/security/keys/internal.h b/security/keys/internal.h
index 56a133d8f37d..edfa50dbd6f5 100644
--- a/security/keys/internal.h
+++ b/security/keys/internal.h
@@ -1,4 +1,4 @@
1/* internal.h: authentication token and access key management internal defs 1/* Authentication token and access key management internal defs
2 * 2 *
3 * Copyright (C) 2003-5, 2007 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2003-5, 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -35,10 +35,12 @@ extern struct key_type key_type_user;
35 35
36/*****************************************************************************/ 36/*****************************************************************************/
37/* 37/*
38 * keep track of keys for a user 38 * Keep track of keys for a user.
39 * - this needs to be separate to user_struct to avoid a refcount-loop 39 *
40 * (user_struct pins some keyrings which pin this struct) 40 * This needs to be separate to user_struct to avoid a refcount-loop
41 * - this also keeps track of keys under request from userspace for this UID 41 * (user_struct pins some keyrings which pin this struct).
42 *
43 * We also keep track of keys under request from userspace for this UID here.
42 */ 44 */
43struct key_user { 45struct key_user {
44 struct rb_node node; 46 struct rb_node node;
@@ -62,7 +64,7 @@ extern struct key_user *key_user_lookup(uid_t uid,
62extern void key_user_put(struct key_user *user); 64extern void key_user_put(struct key_user *user);
63 65
64/* 66/*
65 * key quota limits 67 * Key quota limits.
66 * - root has its own separate limits to everyone else 68 * - root has its own separate limits to everyone else
67 */ 69 */
68extern unsigned key_quota_root_maxkeys; 70extern unsigned key_quota_root_maxkeys;
@@ -146,13 +148,13 @@ extern unsigned key_gc_delay;
146extern void keyring_gc(struct key *keyring, time_t limit); 148extern void keyring_gc(struct key *keyring, time_t limit);
147extern void key_schedule_gc(time_t expiry_at); 149extern void key_schedule_gc(time_t expiry_at);
148 150
149/*
150 * check to see whether permission is granted to use a key in the desired way
151 */
152extern int key_task_permission(const key_ref_t key_ref, 151extern int key_task_permission(const key_ref_t key_ref,
153 const struct cred *cred, 152 const struct cred *cred,
154 key_perm_t perm); 153 key_perm_t perm);
155 154
155/*
156 * Check to see whether permission is granted to use a key in the desired way.
157 */
156static inline int key_permission(const key_ref_t key_ref, key_perm_t perm) 158static inline int key_permission(const key_ref_t key_ref, key_perm_t perm)
157{ 159{
158 return key_task_permission(key_ref, current_cred(), perm); 160 return key_task_permission(key_ref, current_cred(), perm);
@@ -168,7 +170,7 @@ static inline int key_permission(const key_ref_t key_ref, key_perm_t perm)
168#define KEY_ALL 0x3f /* all the above permissions */ 170#define KEY_ALL 0x3f /* all the above permissions */
169 171
170/* 172/*
171 * request_key authorisation 173 * Authorisation record for request_key().
172 */ 174 */
173struct request_key_auth { 175struct request_key_auth {
174 struct key *target_key; 176 struct key *target_key;
@@ -188,7 +190,7 @@ extern struct key *request_key_auth_new(struct key *target,
188extern struct key *key_get_instantiation_authkey(key_serial_t target_id); 190extern struct key *key_get_instantiation_authkey(key_serial_t target_id);
189 191
190/* 192/*
191 * keyctl functions 193 * keyctl() functions
192 */ 194 */
193extern long keyctl_get_keyring_ID(key_serial_t, int); 195extern long keyctl_get_keyring_ID(key_serial_t, int);
194extern long keyctl_join_session_keyring(const char __user *); 196extern long keyctl_join_session_keyring(const char __user *);
@@ -214,7 +216,7 @@ extern long keyctl_get_security(key_serial_t keyid, char __user *buffer,
214extern long keyctl_session_to_parent(void); 216extern long keyctl_session_to_parent(void);
215 217
216/* 218/*
217 * debugging key validation 219 * Debugging key validation
218 */ 220 */
219#ifdef KEY_DEBUGGING 221#ifdef KEY_DEBUGGING
220extern void __key_check(const struct key *); 222extern void __key_check(const struct key *);
diff --git a/security/keys/key.c b/security/keys/key.c
index c1eac8084ade..84d4eb568b08 100644
--- a/security/keys/key.c
+++ b/security/keys/key.c
@@ -39,10 +39,10 @@ static DECLARE_RWSEM(key_types_sem);
39static void key_cleanup(struct work_struct *work); 39static void key_cleanup(struct work_struct *work);
40static DECLARE_WORK(key_cleanup_task, key_cleanup); 40static DECLARE_WORK(key_cleanup_task, key_cleanup);
41 41
42/* we serialise key instantiation and link */ 42/* We serialise key instantiation and link */
43DEFINE_MUTEX(key_construction_mutex); 43DEFINE_MUTEX(key_construction_mutex);
44 44
45/* any key who's type gets unegistered will be re-typed to this */ 45/* Any key who's type gets unegistered will be re-typed to this */
46static struct key_type key_type_dead = { 46static struct key_type key_type_dead = {
47 .name = "dead", 47 .name = "dead",
48}; 48};
@@ -56,10 +56,9 @@ void __key_check(const struct key *key)
56} 56}
57#endif 57#endif
58 58
59/*****************************************************************************/
60/* 59/*
61 * get the key quota record for a user, allocating a new record if one doesn't 60 * Get the key quota record for a user, allocating a new record if one doesn't
62 * already exist 61 * already exist.
63 */ 62 */
64struct key_user *key_user_lookup(uid_t uid, struct user_namespace *user_ns) 63struct key_user *key_user_lookup(uid_t uid, struct user_namespace *user_ns)
65{ 64{
@@ -67,7 +66,7 @@ struct key_user *key_user_lookup(uid_t uid, struct user_namespace *user_ns)
67 struct rb_node *parent = NULL; 66 struct rb_node *parent = NULL;
68 struct rb_node **p; 67 struct rb_node **p;
69 68
70 try_again: 69try_again:
71 p = &key_user_tree.rb_node; 70 p = &key_user_tree.rb_node;
72 spin_lock(&key_user_lock); 71 spin_lock(&key_user_lock);
73 72
@@ -124,18 +123,16 @@ struct key_user *key_user_lookup(uid_t uid, struct user_namespace *user_ns)
124 goto out; 123 goto out;
125 124
126 /* okay - we found a user record for this UID */ 125 /* okay - we found a user record for this UID */
127 found: 126found:
128 atomic_inc(&user->usage); 127 atomic_inc(&user->usage);
129 spin_unlock(&key_user_lock); 128 spin_unlock(&key_user_lock);
130 kfree(candidate); 129 kfree(candidate);
131 out: 130out:
132 return user; 131 return user;
132}
133 133
134} /* end key_user_lookup() */
135
136/*****************************************************************************/
137/* 134/*
138 * dispose of a user structure 135 * Dispose of a user structure
139 */ 136 */
140void key_user_put(struct key_user *user) 137void key_user_put(struct key_user *user)
141{ 138{
@@ -146,14 +143,11 @@ void key_user_put(struct key_user *user)
146 143
147 kfree(user); 144 kfree(user);
148 } 145 }
146}
149 147
150} /* end key_user_put() */
151
152/*****************************************************************************/
153/* 148/*
154 * assign a key the next unique serial number 149 * Allocate a serial number for a key. These are assigned randomly to avoid
155 * - these are assigned randomly to avoid security issues through covert 150 * security issues through covert channel problems.
156 * channel problems
157 */ 151 */
158static inline void key_alloc_serial(struct key *key) 152static inline void key_alloc_serial(struct key *key)
159{ 153{
@@ -211,18 +205,36 @@ serial_exists:
211 if (key->serial < xkey->serial) 205 if (key->serial < xkey->serial)
212 goto attempt_insertion; 206 goto attempt_insertion;
213 } 207 }
208}
214 209
215} /* end key_alloc_serial() */ 210/**
216 211 * key_alloc - Allocate a key of the specified type.
217/*****************************************************************************/ 212 * @type: The type of key to allocate.
218/* 213 * @desc: The key description to allow the key to be searched out.
219 * allocate a key of the specified type 214 * @uid: The owner of the new key.
220 * - update the user's quota to reflect the existence of the key 215 * @gid: The group ID for the new key's group permissions.
221 * - called from a key-type operation with key_types_sem read-locked by 216 * @cred: The credentials specifying UID namespace.
222 * key_create_or_update() 217 * @perm: The permissions mask of the new key.
223 * - this prevents unregistration of the key type 218 * @flags: Flags specifying quota properties.
224 * - upon return the key is as yet uninstantiated; the caller needs to either 219 *
225 * instantiate the key or discard it before returning 220 * Allocate a key of the specified type with the attributes given. The key is
221 * returned in an uninstantiated state and the caller needs to instantiate the
222 * key before returning.
223 *
224 * The user's key count quota is updated to reflect the creation of the key and
225 * the user's key data quota has the default for the key type reserved. The
226 * instantiation function should amend this as necessary. If insufficient
227 * quota is available, -EDQUOT will be returned.
228 *
229 * The LSM security modules can prevent a key being created, in which case
230 * -EACCES will be returned.
231 *
232 * Returns a pointer to the new key if successful and an error code otherwise.
233 *
234 * Note that the caller needs to ensure the key type isn't uninstantiated.
235 * Internally this can be done by locking key_types_sem. Externally, this can
236 * be done by either never unregistering the key type, or making sure
237 * key_alloc() calls don't race with module unloading.
226 */ 238 */
227struct key *key_alloc(struct key_type *type, const char *desc, 239struct key *key_alloc(struct key_type *type, const char *desc,
228 uid_t uid, gid_t gid, const struct cred *cred, 240 uid_t uid, gid_t gid, const struct cred *cred,
@@ -344,14 +356,19 @@ no_quota:
344 key_user_put(user); 356 key_user_put(user);
345 key = ERR_PTR(-EDQUOT); 357 key = ERR_PTR(-EDQUOT);
346 goto error; 358 goto error;
347 359}
348} /* end key_alloc() */
349
350EXPORT_SYMBOL(key_alloc); 360EXPORT_SYMBOL(key_alloc);
351 361
352/*****************************************************************************/ 362/**
353/* 363 * key_payload_reserve - Adjust data quota reservation for the key's payload
354 * reserve an amount of quota for the key's payload 364 * @key: The key to make the reservation for.
365 * @datalen: The amount of data payload the caller now wants.
366 *
367 * Adjust the amount of the owning user's key data quota that a key reserves.
368 * If the amount is increased, then -EDQUOT may be returned if there isn't
369 * enough free quota available.
370 *
371 * If successful, 0 is returned.
355 */ 372 */
356int key_payload_reserve(struct key *key, size_t datalen) 373int key_payload_reserve(struct key *key, size_t datalen)
357{ 374{
@@ -384,15 +401,14 @@ int key_payload_reserve(struct key *key, size_t datalen)
384 key->datalen = datalen; 401 key->datalen = datalen;
385 402
386 return ret; 403 return ret;
387 404}
388} /* end key_payload_reserve() */
389
390EXPORT_SYMBOL(key_payload_reserve); 405EXPORT_SYMBOL(key_payload_reserve);
391 406
392/*****************************************************************************/
393/* 407/*
394 * instantiate a key and link it into the target keyring atomically 408 * Instantiate a key and link it into the target keyring atomically. Must be
395 * - called with the target keyring's semaphore writelocked 409 * called with the target keyring's semaphore writelocked. The target key's
410 * semaphore need not be locked as instantiation is serialised by
411 * key_construction_mutex.
396 */ 412 */
397static int __key_instantiate_and_link(struct key *key, 413static int __key_instantiate_and_link(struct key *key,
398 const void *data, 414 const void *data,
@@ -441,12 +457,23 @@ static int __key_instantiate_and_link(struct key *key,
441 wake_up_bit(&key->flags, KEY_FLAG_USER_CONSTRUCT); 457 wake_up_bit(&key->flags, KEY_FLAG_USER_CONSTRUCT);
442 458
443 return ret; 459 return ret;
460}
444 461
445} /* end __key_instantiate_and_link() */ 462/**
446 463 * key_instantiate_and_link - Instantiate a key and link it into the keyring.
447/*****************************************************************************/ 464 * @key: The key to instantiate.
448/* 465 * @data: The data to use to instantiate the keyring.
449 * instantiate a key and link it into the target keyring atomically 466 * @datalen: The length of @data.
467 * @keyring: Keyring to create a link in on success (or NULL).
468 * @authkey: The authorisation token permitting instantiation.
469 *
470 * Instantiate a key that's in the uninstantiated state using the provided data
471 * and, if successful, link it in to the destination keyring if one is
472 * supplied.
473 *
474 * If successful, 0 is returned, the authorisation token is revoked and anyone
475 * waiting for the key is woken up. If the key was already instantiated,
476 * -EBUSY will be returned.
450 */ 477 */
451int key_instantiate_and_link(struct key *key, 478int key_instantiate_and_link(struct key *key,
452 const void *data, 479 const void *data,
@@ -471,14 +498,28 @@ int key_instantiate_and_link(struct key *key,
471 __key_link_end(keyring, key->type, prealloc); 498 __key_link_end(keyring, key->type, prealloc);
472 499
473 return ret; 500 return ret;
474 501}
475} /* end key_instantiate_and_link() */
476 502
477EXPORT_SYMBOL(key_instantiate_and_link); 503EXPORT_SYMBOL(key_instantiate_and_link);
478 504
479/*****************************************************************************/ 505/**
480/* 506 * key_negate_and_link - Negatively instantiate a key and link it into the keyring.
481 * negatively instantiate a key and link it into the target keyring atomically 507 * @key: The key to instantiate.
508 * @timeout: The timeout on the negative key.
509 * @keyring: Keyring to create a link in on success (or NULL).
510 * @authkey: The authorisation token permitting instantiation.
511 *
512 * Negatively instantiate a key that's in the uninstantiated state and, if
513 * successful, set its timeout and link it in to the destination keyring if one
514 * is supplied. The key and any links to the key will be automatically garbage
515 * collected after the timeout expires.
516 *
517 * Negative keys are used to rate limit repeated request_key() calls by causing
518 * them to return -ENOKEY until the negative key expires.
519 *
520 * If successful, 0 is returned, the authorisation token is revoked and anyone
521 * waiting for the key is woken up. If the key was already instantiated,
522 * -EBUSY will be returned.
482 */ 523 */
483int key_negate_and_link(struct key *key, 524int key_negate_and_link(struct key *key,
484 unsigned timeout, 525 unsigned timeout,
@@ -535,22 +576,23 @@ int key_negate_and_link(struct key *key,
535 wake_up_bit(&key->flags, KEY_FLAG_USER_CONSTRUCT); 576 wake_up_bit(&key->flags, KEY_FLAG_USER_CONSTRUCT);
536 577
537 return ret == 0 ? link_ret : ret; 578 return ret == 0 ? link_ret : ret;
538 579}
539} /* end key_negate_and_link() */
540 580
541EXPORT_SYMBOL(key_negate_and_link); 581EXPORT_SYMBOL(key_negate_and_link);
542 582
543/*****************************************************************************/
544/* 583/*
545 * do cleaning up in process context so that we don't have to disable 584 * Garbage collect keys in process context so that we don't have to disable
546 * interrupts all over the place 585 * interrupts all over the place.
586 *
587 * key_put() schedules this rather than trying to do the cleanup itself, which
588 * means key_put() doesn't have to sleep.
547 */ 589 */
548static void key_cleanup(struct work_struct *work) 590static void key_cleanup(struct work_struct *work)
549{ 591{
550 struct rb_node *_n; 592 struct rb_node *_n;
551 struct key *key; 593 struct key *key;
552 594
553 go_again: 595go_again:
554 /* look for a dead key in the tree */ 596 /* look for a dead key in the tree */
555 spin_lock(&key_serial_lock); 597 spin_lock(&key_serial_lock);
556 598
@@ -564,7 +606,7 @@ static void key_cleanup(struct work_struct *work)
564 spin_unlock(&key_serial_lock); 606 spin_unlock(&key_serial_lock);
565 return; 607 return;
566 608
567 found_dead_key: 609found_dead_key:
568 /* we found a dead key - once we've removed it from the tree, we can 610 /* we found a dead key - once we've removed it from the tree, we can
569 * drop the lock */ 611 * drop the lock */
570 rb_erase(&key->serial_node, &key_serial_tree); 612 rb_erase(&key->serial_node, &key_serial_tree);
@@ -601,14 +643,15 @@ static void key_cleanup(struct work_struct *work)
601 643
602 /* there may, of course, be more than one key to destroy */ 644 /* there may, of course, be more than one key to destroy */
603 goto go_again; 645 goto go_again;
646}
604 647
605} /* end key_cleanup() */ 648/**
606 649 * key_put - Discard a reference to a key.
607/*****************************************************************************/ 650 * @key: The key to discard a reference from.
608/* 651 *
609 * dispose of a reference to a key 652 * Discard a reference to a key, and when all the references are gone, we
610 * - when all the references are gone, we schedule the cleanup task to come and 653 * schedule the cleanup task to come and pull it out of the tree in process
611 * pull it out of the tree in definite process context 654 * context at some later time.
612 */ 655 */
613void key_put(struct key *key) 656void key_put(struct key *key)
614{ 657{
@@ -618,14 +661,11 @@ void key_put(struct key *key)
618 if (atomic_dec_and_test(&key->usage)) 661 if (atomic_dec_and_test(&key->usage))
619 schedule_work(&key_cleanup_task); 662 schedule_work(&key_cleanup_task);
620 } 663 }
621 664}
622} /* end key_put() */
623
624EXPORT_SYMBOL(key_put); 665EXPORT_SYMBOL(key_put);
625 666
626/*****************************************************************************/
627/* 667/*
628 * find a key by its serial number 668 * Find a key by its serial number.
629 */ 669 */
630struct key *key_lookup(key_serial_t id) 670struct key *key_lookup(key_serial_t id)
631{ 671{
@@ -647,11 +687,11 @@ struct key *key_lookup(key_serial_t id)
647 goto found; 687 goto found;
648 } 688 }
649 689
650 not_found: 690not_found:
651 key = ERR_PTR(-ENOKEY); 691 key = ERR_PTR(-ENOKEY);
652 goto error; 692 goto error;
653 693
654 found: 694found:
655 /* pretend it doesn't exist if it is awaiting deletion */ 695 /* pretend it doesn't exist if it is awaiting deletion */
656 if (atomic_read(&key->usage) == 0) 696 if (atomic_read(&key->usage) == 0)
657 goto not_found; 697 goto not_found;
@@ -661,16 +701,16 @@ struct key *key_lookup(key_serial_t id)
661 */ 701 */
662 atomic_inc(&key->usage); 702 atomic_inc(&key->usage);
663 703
664 error: 704error:
665 spin_unlock(&key_serial_lock); 705 spin_unlock(&key_serial_lock);
666 return key; 706 return key;
707}
667 708
668} /* end key_lookup() */
669
670/*****************************************************************************/
671/* 709/*
672 * find and lock the specified key type against removal 710 * Find and lock the specified key type against removal.
673 * - we return with the sem readlocked 711 *
712 * We return with the sem read-locked if successful. If the type wasn't
713 * available -ENOKEY is returned instead.
674 */ 714 */
675struct key_type *key_type_lookup(const char *type) 715struct key_type *key_type_lookup(const char *type)
676{ 716{
@@ -688,26 +728,23 @@ struct key_type *key_type_lookup(const char *type)
688 up_read(&key_types_sem); 728 up_read(&key_types_sem);
689 ktype = ERR_PTR(-ENOKEY); 729 ktype = ERR_PTR(-ENOKEY);
690 730
691 found_kernel_type: 731found_kernel_type:
692 return ktype; 732 return ktype;
733}
693 734
694} /* end key_type_lookup() */
695
696/*****************************************************************************/
697/* 735/*
698 * unlock a key type 736 * Unlock a key type locked by key_type_lookup().
699 */ 737 */
700void key_type_put(struct key_type *ktype) 738void key_type_put(struct key_type *ktype)
701{ 739{
702 up_read(&key_types_sem); 740 up_read(&key_types_sem);
741}
703 742
704} /* end key_type_put() */
705
706/*****************************************************************************/
707/* 743/*
708 * attempt to update an existing key 744 * Attempt to update an existing key.
709 * - the key has an incremented refcount 745 *
710 * - we need to put the key if we get an error 746 * The key is given to us with an incremented refcount that we need to discard
747 * if we get an error.
711 */ 748 */
712static inline key_ref_t __key_update(key_ref_t key_ref, 749static inline key_ref_t __key_update(key_ref_t key_ref,
713 const void *payload, size_t plen) 750 const void *payload, size_t plen)
@@ -742,13 +779,32 @@ error:
742 key_put(key); 779 key_put(key);
743 key_ref = ERR_PTR(ret); 780 key_ref = ERR_PTR(ret);
744 goto out; 781 goto out;
782}
745 783
746} /* end __key_update() */ 784/**
747 785 * key_create_or_update - Update or create and instantiate a key.
748/*****************************************************************************/ 786 * @keyring_ref: A pointer to the destination keyring with possession flag.
749/* 787 * @type: The type of key.
750 * search the specified keyring for a key of the same description; if one is 788 * @description: The searchable description for the key.
751 * found, update it, otherwise add a new one 789 * @payload: The data to use to instantiate or update the key.
790 * @plen: The length of @payload.
791 * @perm: The permissions mask for a new key.
792 * @flags: The quota flags for a new key.
793 *
794 * Search the destination keyring for a key of the same description and if one
795 * is found, update it, otherwise create and instantiate a new one and create a
796 * link to it from that keyring.
797 *
798 * If perm is KEY_PERM_UNDEF then an appropriate key permissions mask will be
799 * concocted.
800 *
801 * Returns a pointer to the new key if successful, -ENODEV if the key type
802 * wasn't available, -ENOTDIR if the keyring wasn't a keyring, -EACCES if the
803 * caller isn't permitted to modify the keyring or the LSM did not permit
804 * creation of the key.
805 *
806 * On success, the possession flag from the keyring ref will be tacked on to
807 * the key ref before it is returned.
752 */ 808 */
753key_ref_t key_create_or_update(key_ref_t keyring_ref, 809key_ref_t key_create_or_update(key_ref_t keyring_ref,
754 const char *type, 810 const char *type,
@@ -855,14 +911,21 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref,
855 911
856 key_ref = __key_update(key_ref, payload, plen); 912 key_ref = __key_update(key_ref, payload, plen);
857 goto error; 913 goto error;
858 914}
859} /* end key_create_or_update() */
860
861EXPORT_SYMBOL(key_create_or_update); 915EXPORT_SYMBOL(key_create_or_update);
862 916
863/*****************************************************************************/ 917/**
864/* 918 * key_update - Update a key's contents.
865 * update a key 919 * @key_ref: The pointer (plus possession flag) to the key.
920 * @payload: The data to be used to update the key.
921 * @plen: The length of @payload.
922 *
923 * Attempt to update the contents of a key with the given payload data. The
924 * caller must be granted Write permission on the key. Negative keys can be
925 * instantiated by this method.
926 *
927 * Returns 0 on success, -EACCES if not permitted and -EOPNOTSUPP if the key
928 * type does not support updating. The key type may return other errors.
866 */ 929 */
867int key_update(key_ref_t key_ref, const void *payload, size_t plen) 930int key_update(key_ref_t key_ref, const void *payload, size_t plen)
868{ 931{
@@ -891,14 +954,17 @@ int key_update(key_ref_t key_ref, const void *payload, size_t plen)
891 954
892 error: 955 error:
893 return ret; 956 return ret;
894 957}
895} /* end key_update() */
896
897EXPORT_SYMBOL(key_update); 958EXPORT_SYMBOL(key_update);
898 959
899/*****************************************************************************/ 960/**
900/* 961 * key_revoke - Revoke a key.
901 * revoke a key 962 * @key: The key to be revoked.
963 *
964 * Mark a key as being revoked and ask the type to free up its resources. The
965 * revocation timeout is set and the key and all its links will be
966 * automatically garbage collected after key_gc_delay amount of time if they
967 * are not manually dealt with first.
902 */ 968 */
903void key_revoke(struct key *key) 969void key_revoke(struct key *key)
904{ 970{
@@ -926,14 +992,16 @@ void key_revoke(struct key *key)
926 } 992 }
927 993
928 up_write(&key->sem); 994 up_write(&key->sem);
929 995}
930} /* end key_revoke() */
931
932EXPORT_SYMBOL(key_revoke); 996EXPORT_SYMBOL(key_revoke);
933 997
934/*****************************************************************************/ 998/**
935/* 999 * register_key_type - Register a type of key.
936 * register a type of key 1000 * @ktype: The new key type.
1001 *
1002 * Register a new key type.
1003 *
1004 * Returns 0 on success or -EEXIST if a type of this name already exists.
937 */ 1005 */
938int register_key_type(struct key_type *ktype) 1006int register_key_type(struct key_type *ktype)
939{ 1007{
@@ -953,17 +1021,19 @@ int register_key_type(struct key_type *ktype)
953 list_add(&ktype->link, &key_types_list); 1021 list_add(&ktype->link, &key_types_list);
954 ret = 0; 1022 ret = 0;
955 1023
956 out: 1024out:
957 up_write(&key_types_sem); 1025 up_write(&key_types_sem);
958 return ret; 1026 return ret;
959 1027}
960} /* end register_key_type() */
961
962EXPORT_SYMBOL(register_key_type); 1028EXPORT_SYMBOL(register_key_type);
963 1029
964/*****************************************************************************/ 1030/**
965/* 1031 * unregister_key_type - Unregister a type of key.
966 * unregister a type of key 1032 * @ktype: The key type.
1033 *
1034 * Unregister a key type and mark all the extant keys of this type as dead.
1035 * Those keys of this type are then destroyed to get rid of their payloads and
1036 * they and their links will be garbage collected as soon as possible.
967 */ 1037 */
968void unregister_key_type(struct key_type *ktype) 1038void unregister_key_type(struct key_type *ktype)
969{ 1039{
@@ -1010,14 +1080,11 @@ void unregister_key_type(struct key_type *ktype)
1010 up_write(&key_types_sem); 1080 up_write(&key_types_sem);
1011 1081
1012 key_schedule_gc(0); 1082 key_schedule_gc(0);
1013 1083}
1014} /* end unregister_key_type() */
1015
1016EXPORT_SYMBOL(unregister_key_type); 1084EXPORT_SYMBOL(unregister_key_type);
1017 1085
1018/*****************************************************************************/
1019/* 1086/*
1020 * initialise the key management stuff 1087 * Initialise the key management state.
1021 */ 1088 */
1022void __init key_init(void) 1089void __init key_init(void)
1023{ 1090{
@@ -1037,5 +1104,4 @@ void __init key_init(void)
1037 1104
1038 rb_insert_color(&root_key_user.node, 1105 rb_insert_color(&root_key_user.node,
1039 &key_user_tree); 1106 &key_user_tree);
1040 1107}
1041} /* end key_init() */
diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
index 60924f6a52db..31a0fd8189f1 100644
--- a/security/keys/keyctl.c
+++ b/security/keys/keyctl.c
@@ -1,4 +1,4 @@
1/* keyctl.c: userspace keyctl operations 1/* Userspace key control operations
2 * 2 *
3 * Copyright (C) 2004-5 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2004-5 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -31,28 +31,24 @@ static int key_get_type_from_user(char *type,
31 int ret; 31 int ret;
32 32
33 ret = strncpy_from_user(type, _type, len); 33 ret = strncpy_from_user(type, _type, len);
34
35 if (ret < 0) 34 if (ret < 0)
36 return ret; 35 return ret;
37
38 if (ret == 0 || ret >= len) 36 if (ret == 0 || ret >= len)
39 return -EINVAL; 37 return -EINVAL;
40
41 if (type[0] == '.') 38 if (type[0] == '.')
42 return -EPERM; 39 return -EPERM;
43
44 type[len - 1] = '\0'; 40 type[len - 1] = '\0';
45
46 return 0; 41 return 0;
47} 42}
48 43
49/*****************************************************************************/
50/* 44/*
51 * extract the description of a new key from userspace and either add it as a 45 * Extract the description of a new key from userspace and either add it as a
52 * new key to the specified keyring or update a matching key in that keyring 46 * new key to the specified keyring or update a matching key in that keyring.
53 * - the keyring must be writable 47 *
54 * - returns the new key's serial number 48 * The keyring must be writable so that we can attach the key to it.
55 * - implements add_key() 49 *
50 * If successful, the new key's serial number is returned, otherwise an error
51 * code is returned.
56 */ 52 */
57SYSCALL_DEFINE5(add_key, const char __user *, _type, 53SYSCALL_DEFINE5(add_key, const char __user *, _type,
58 const char __user *, _description, 54 const char __user *, _description,
@@ -132,19 +128,20 @@ SYSCALL_DEFINE5(add_key, const char __user *, _type,
132 kfree(description); 128 kfree(description);
133 error: 129 error:
134 return ret; 130 return ret;
131}
135 132
136} /* end sys_add_key() */
137
138/*****************************************************************************/
139/* 133/*
140 * search the process keyrings for a matching key 134 * Search the process keyrings and keyring trees linked from those for a
141 * - nested keyrings may also be searched if they have Search permission 135 * matching key. Keyrings must have appropriate Search permission to be
142 * - if a key is found, it will be attached to the destination keyring if 136 * searched.
143 * there's one specified 137 *
144 * - /sbin/request-key will be invoked if _callout_info is non-NULL 138 * If a key is found, it will be attached to the destination keyring if there's
145 * - the _callout_info string will be passed to /sbin/request-key 139 * one specified and the serial number of the key will be returned.
146 * - if the _callout_info string is empty, it will be rendered as "-" 140 *
147 * - implements request_key() 141 * If no key is found, /sbin/request-key will be invoked if _callout_info is
142 * non-NULL in an attempt to create a key. The _callout_info string will be
143 * passed to /sbin/request-key to aid with completing the request. If the
144 * _callout_info string is "" then it will be changed to "-".
148 */ 145 */
149SYSCALL_DEFINE4(request_key, const char __user *, _type, 146SYSCALL_DEFINE4(request_key, const char __user *, _type,
150 const char __user *, _description, 147 const char __user *, _description,
@@ -222,14 +219,14 @@ error2:
222 kfree(description); 219 kfree(description);
223error: 220error:
224 return ret; 221 return ret;
222}
225 223
226} /* end sys_request_key() */
227
228/*****************************************************************************/
229/* 224/*
230 * get the ID of the specified process keyring 225 * Get the ID of the specified process keyring.
231 * - the keyring must have search permission to be found 226 *
232 * - implements keyctl(KEYCTL_GET_KEYRING_ID) 227 * The requested keyring must have search permission to be found.
228 *
229 * If successful, the ID of the requested keyring will be returned.
233 */ 230 */
234long keyctl_get_keyring_ID(key_serial_t id, int create) 231long keyctl_get_keyring_ID(key_serial_t id, int create)
235{ 232{
@@ -248,13 +245,17 @@ long keyctl_get_keyring_ID(key_serial_t id, int create)
248 key_ref_put(key_ref); 245 key_ref_put(key_ref);
249error: 246error:
250 return ret; 247 return ret;
248}
251 249
252} /* end keyctl_get_keyring_ID() */
253
254/*****************************************************************************/
255/* 250/*
256 * join the session keyring 251 * Join a (named) session keyring.
257 * - implements keyctl(KEYCTL_JOIN_SESSION_KEYRING) 252 *
253 * Create and join an anonymous session keyring or join a named session
254 * keyring, creating it if necessary. A named session keyring must have Search
255 * permission for it to be joined. Session keyrings without this permit will
256 * be skipped over.
257 *
258 * If successful, the ID of the joined session keyring will be returned.
258 */ 259 */
259long keyctl_join_session_keyring(const char __user *_name) 260long keyctl_join_session_keyring(const char __user *_name)
260{ 261{
@@ -277,14 +278,17 @@ long keyctl_join_session_keyring(const char __user *_name)
277 278
278error: 279error:
279 return ret; 280 return ret;
281}
280 282
281} /* end keyctl_join_session_keyring() */
282
283/*****************************************************************************/
284/* 283/*
285 * update a key's data payload 284 * Update a key's data payload from the given data.
286 * - the key must be writable 285 *
287 * - implements keyctl(KEYCTL_UPDATE) 286 * The key must grant the caller Write permission and the key type must support
287 * updating for this to work. A negative key can be positively instantiated
288 * with this call.
289 *
290 * If successful, 0 will be returned. If the key type does not support
291 * updating, then -EOPNOTSUPP will be returned.
288 */ 292 */
289long keyctl_update_key(key_serial_t id, 293long keyctl_update_key(key_serial_t id,
290 const void __user *_payload, 294 const void __user *_payload,
@@ -326,14 +330,17 @@ error2:
326 kfree(payload); 330 kfree(payload);
327error: 331error:
328 return ret; 332 return ret;
333}
329 334
330} /* end keyctl_update_key() */
331
332/*****************************************************************************/
333/* 335/*
334 * revoke a key 336 * Revoke a key.
335 * - the key must be writable 337 *
336 * - implements keyctl(KEYCTL_REVOKE) 338 * The key must be grant the caller Write or Setattr permission for this to
339 * work. The key type should give up its quota claim when revoked. The key
340 * and any links to the key will be automatically garbage collected after a
341 * certain amount of time (/proc/sys/kernel/keys/gc_delay).
342 *
343 * If successful, 0 is returned.
337 */ 344 */
338long keyctl_revoke_key(key_serial_t id) 345long keyctl_revoke_key(key_serial_t id)
339{ 346{
@@ -358,14 +365,14 @@ long keyctl_revoke_key(key_serial_t id)
358 key_ref_put(key_ref); 365 key_ref_put(key_ref);
359error: 366error:
360 return ret; 367 return ret;
368}
361 369
362} /* end keyctl_revoke_key() */
363
364/*****************************************************************************/
365/* 370/*
366 * clear the specified process keyring 371 * Clear the specified keyring, creating an empty process keyring if one of the
367 * - the keyring must be writable 372 * special keyring IDs is used.
368 * - implements keyctl(KEYCTL_CLEAR) 373 *
374 * The keyring must grant the caller Write permission for this to work. If
375 * successful, 0 will be returned.
369 */ 376 */
370long keyctl_keyring_clear(key_serial_t ringid) 377long keyctl_keyring_clear(key_serial_t ringid)
371{ 378{
@@ -383,15 +390,18 @@ long keyctl_keyring_clear(key_serial_t ringid)
383 key_ref_put(keyring_ref); 390 key_ref_put(keyring_ref);
384error: 391error:
385 return ret; 392 return ret;
393}
386 394
387} /* end keyctl_keyring_clear() */
388
389/*****************************************************************************/
390/* 395/*
391 * link a key into a keyring 396 * Create a link from a keyring to a key if there's no matching key in the
392 * - the keyring must be writable 397 * keyring, otherwise replace the link to the matching key with a link to the
393 * - the key must be linkable 398 * new key.
394 * - implements keyctl(KEYCTL_LINK) 399 *
400 * The key must grant the caller Link permission and the the keyring must grant
401 * the caller Write permission. Furthermore, if an additional link is created,
402 * the keyring's quota will be extended.
403 *
404 * If successful, 0 will be returned.
395 */ 405 */
396long keyctl_keyring_link(key_serial_t id, key_serial_t ringid) 406long keyctl_keyring_link(key_serial_t id, key_serial_t ringid)
397{ 407{
@@ -417,15 +427,16 @@ error2:
417 key_ref_put(keyring_ref); 427 key_ref_put(keyring_ref);
418error: 428error:
419 return ret; 429 return ret;
430}
420 431
421} /* end keyctl_keyring_link() */
422
423/*****************************************************************************/
424/* 432/*
425 * unlink the first attachment of a key from a keyring 433 * Unlink a key from a keyring.
426 * - the keyring must be writable 434 *
427 * - we don't need any permissions on the key 435 * The keyring must grant the caller Write permission for this to work; the key
428 * - implements keyctl(KEYCTL_UNLINK) 436 * itself need not grant the caller anything. If the last link to a key is
437 * removed then that key will be scheduled for destruction.
438 *
439 * If successful, 0 will be returned.
429 */ 440 */
430long keyctl_keyring_unlink(key_serial_t id, key_serial_t ringid) 441long keyctl_keyring_unlink(key_serial_t id, key_serial_t ringid)
431{ 442{
@@ -451,19 +462,20 @@ error2:
451 key_ref_put(keyring_ref); 462 key_ref_put(keyring_ref);
452error: 463error:
453 return ret; 464 return ret;
465}
454 466
455} /* end keyctl_keyring_unlink() */
456
457/*****************************************************************************/
458/* 467/*
459 * describe a user key 468 * Return a description of a key to userspace.
460 * - the key must have view permission 469 *
461 * - if there's a buffer, we place up to buflen bytes of data into it 470 * The key must grant the caller View permission for this to work.
462 * - unless there's an error, we return the amount of description available, 471 *
463 * irrespective of how much we may have copied 472 * If there's a buffer, we place up to buflen bytes of data into it formatted
464 * - the description is formatted thus: 473 * in the following way:
474 *
465 * type;uid;gid;perm;description<NUL> 475 * type;uid;gid;perm;description<NUL>
466 * - implements keyctl(KEYCTL_DESCRIBE) 476 *
477 * If successful, we return the amount of description available, irrespective
478 * of how much we may have copied into the buffer.
467 */ 479 */
468long keyctl_describe_key(key_serial_t keyid, 480long keyctl_describe_key(key_serial_t keyid,
469 char __user *buffer, 481 char __user *buffer,
@@ -531,18 +543,17 @@ error2:
531 key_ref_put(key_ref); 543 key_ref_put(key_ref);
532error: 544error:
533 return ret; 545 return ret;
546}
534 547
535} /* end keyctl_describe_key() */
536
537/*****************************************************************************/
538/* 548/*
539 * search the specified keyring for a matching key 549 * Search the specified keyring and any keyrings it links to for a matching
540 * - the start keyring must be searchable 550 * key. Only keyrings that grant the caller Search permission will be searched
541 * - nested keyrings may also be searched if they are searchable 551 * (this includes the starting keyring). Only keys with Search permission can
542 * - only keys with search permission may be found 552 * be found.
543 * - if a key is found, it will be attached to the destination keyring if 553 *
544 * there's one specified 554 * If successful, the found key will be linked to the destination keyring if
545 * - implements keyctl(KEYCTL_SEARCH) 555 * supplied and the key has Link permission, and the found key ID will be
556 * returned.
546 */ 557 */
547long keyctl_keyring_search(key_serial_t ringid, 558long keyctl_keyring_search(key_serial_t ringid,
548 const char __user *_type, 559 const char __user *_type,
@@ -626,18 +637,17 @@ error2:
626 kfree(description); 637 kfree(description);
627error: 638error:
628 return ret; 639 return ret;
640}
629 641
630} /* end keyctl_keyring_search() */
631
632/*****************************************************************************/
633/* 642/*
634 * read a user key's payload 643 * Read a key's payload.
635 * - the keyring must be readable or the key must be searchable from the 644 *
636 * process's keyrings 645 * The key must either grant the caller Read permission, or it must grant the
637 * - if there's a buffer, we place up to buflen bytes of data into it 646 * caller Search permission when searched for from the process keyrings.
638 * - unless there's an error, we return the amount of data in the key, 647 *
639 * irrespective of how much we may have copied 648 * If successful, we place up to buflen bytes of data into the buffer, if one
640 * - implements keyctl(KEYCTL_READ) 649 * is provided, and return the amount of data that is available in the key,
650 * irrespective of how much we copied into the buffer.
641 */ 651 */
642long keyctl_read_key(key_serial_t keyid, char __user *buffer, size_t buflen) 652long keyctl_read_key(key_serial_t keyid, char __user *buffer, size_t buflen)
643{ 653{
@@ -688,15 +698,22 @@ error2:
688 key_put(key); 698 key_put(key);
689error: 699error:
690 return ret; 700 return ret;
701}
691 702
692} /* end keyctl_read_key() */
693
694/*****************************************************************************/
695/* 703/*
696 * change the ownership of a key 704 * Change the ownership of a key
697 * - the keyring owned by the changer 705 *
698 * - if the uid or gid is -1, then that parameter is not changed 706 * The key must grant the caller Setattr permission for this to work, though
699 * - implements keyctl(KEYCTL_CHOWN) 707 * the key need not be fully instantiated yet. For the UID to be changed, or
708 * for the GID to be changed to a group the caller is not a member of, the
709 * caller must have sysadmin capability. If either uid or gid is -1 then that
710 * attribute is not changed.
711 *
712 * If the UID is to be changed, the new user must have sufficient quota to
713 * accept the key. The quota deduction will be removed from the old user to
714 * the new user should the attribute be changed.
715 *
716 * If successful, 0 will be returned.
700 */ 717 */
701long keyctl_chown_key(key_serial_t id, uid_t uid, gid_t gid) 718long keyctl_chown_key(key_serial_t id, uid_t uid, gid_t gid)
702{ 719{
@@ -796,14 +813,14 @@ quota_overrun:
796 zapowner = newowner; 813 zapowner = newowner;
797 ret = -EDQUOT; 814 ret = -EDQUOT;
798 goto error_put; 815 goto error_put;
816}
799 817
800} /* end keyctl_chown_key() */
801
802/*****************************************************************************/
803/* 818/*
804 * change the permission mask on a key 819 * Change the permission mask on a key.
805 * - the keyring owned by the changer 820 *
806 * - implements keyctl(KEYCTL_SETPERM) 821 * The key must grant the caller Setattr permission for this to work, though
822 * the key need not be fully instantiated yet. If the caller does not have
823 * sysadmin capability, it may only change the permission on keys that it owns.
807 */ 824 */
808long keyctl_setperm_key(key_serial_t id, key_perm_t perm) 825long keyctl_setperm_key(key_serial_t id, key_perm_t perm)
809{ 826{
@@ -838,11 +855,11 @@ long keyctl_setperm_key(key_serial_t id, key_perm_t perm)
838 key_put(key); 855 key_put(key);
839error: 856error:
840 return ret; 857 return ret;
841 858}
842} /* end keyctl_setperm_key() */
843 859
844/* 860/*
845 * get the destination keyring for instantiation 861 * Get the destination keyring for instantiation and check that the caller has
862 * Write permission on it.
846 */ 863 */
847static long get_instantiation_keyring(key_serial_t ringid, 864static long get_instantiation_keyring(key_serial_t ringid,
848 struct request_key_auth *rka, 865 struct request_key_auth *rka,
@@ -879,7 +896,7 @@ static long get_instantiation_keyring(key_serial_t ringid,
879} 896}
880 897
881/* 898/*
882 * change the request_key authorisation key on the current process 899 * Change the request_key authorisation key on the current process.
883 */ 900 */
884static int keyctl_change_reqkey_auth(struct key *key) 901static int keyctl_change_reqkey_auth(struct key *key)
885{ 902{
@@ -895,10 +912,14 @@ static int keyctl_change_reqkey_auth(struct key *key)
895 return commit_creds(new); 912 return commit_creds(new);
896} 913}
897 914
898/*****************************************************************************/
899/* 915/*
900 * instantiate the key with the specified payload, and, if one is given, link 916 * Instantiate a key with the specified payload and link the key into the
901 * the key into the keyring 917 * destination keyring if one is given.
918 *
919 * The caller must have the appropriate instantiation permit set for this to
920 * work (see keyctl_assume_authority). No other permissions are required.
921 *
922 * If successful, 0 will be returned.
902 */ 923 */
903long keyctl_instantiate_key(key_serial_t id, 924long keyctl_instantiate_key(key_serial_t id,
904 const void __user *_payload, 925 const void __user *_payload,
@@ -973,13 +994,22 @@ error2:
973 vfree(payload); 994 vfree(payload);
974error: 995error:
975 return ret; 996 return ret;
997}
976 998
977} /* end keyctl_instantiate_key() */
978
979/*****************************************************************************/
980/* 999/*
981 * negatively instantiate the key with the given timeout (in seconds), and, if 1000 * Negatively instantiate the key with the given timeout (in seconds) and link
982 * one is given, link the key into the keyring 1001 * the key into the destination keyring if one is given.
1002 *
1003 * The caller must have the appropriate instantiation permit set for this to
1004 * work (see keyctl_assume_authority). No other permissions are required.
1005 *
1006 * The key and any links to the key will be automatically garbage collected
1007 * after the timeout expires.
1008 *
1009 * Negative keys are used to rate limit repeated request_key() calls by causing
1010 * them to return -ENOKEY until the negative key expires.
1011 *
1012 * If successful, 0 will be returned.
983 */ 1013 */
984long keyctl_negate_key(key_serial_t id, unsigned timeout, key_serial_t ringid) 1014long keyctl_negate_key(key_serial_t id, unsigned timeout, key_serial_t ringid)
985{ 1015{
@@ -1020,13 +1050,14 @@ long keyctl_negate_key(key_serial_t id, unsigned timeout, key_serial_t ringid)
1020 1050
1021error: 1051error:
1022 return ret; 1052 return ret;
1053}
1023 1054
1024} /* end keyctl_negate_key() */
1025
1026/*****************************************************************************/
1027/* 1055/*
1028 * set the default keyring in which request_key() will cache keys 1056 * Read or set the default keyring in which request_key() will cache keys and
1029 * - return the old setting 1057 * return the old setting.
1058 *
1059 * If a process keyring is specified then this will be created if it doesn't
1060 * yet exist. The old setting will be returned if successful.
1030 */ 1061 */
1031long keyctl_set_reqkey_keyring(int reqkey_defl) 1062long keyctl_set_reqkey_keyring(int reqkey_defl)
1032{ 1063{
@@ -1079,12 +1110,19 @@ set:
1079error: 1110error:
1080 abort_creds(new); 1111 abort_creds(new);
1081 return ret; 1112 return ret;
1113}
1082 1114
1083} /* end keyctl_set_reqkey_keyring() */
1084
1085/*****************************************************************************/
1086/* 1115/*
1087 * set or clear the timeout for a key 1116 * Set or clear the timeout on a key.
1117 *
1118 * Either the key must grant the caller Setattr permission or else the caller
1119 * must hold an instantiation authorisation token for the key.
1120 *
1121 * The timeout is either 0 to clear the timeout, or a number of seconds from
1122 * the current time. The key and any links to the key will be automatically
1123 * garbage collected after the timeout expires.
1124 *
1125 * If successful, 0 is returned.
1088 */ 1126 */
1089long keyctl_set_timeout(key_serial_t id, unsigned timeout) 1127long keyctl_set_timeout(key_serial_t id, unsigned timeout)
1090{ 1128{
@@ -1136,12 +1174,24 @@ okay:
1136 ret = 0; 1174 ret = 0;
1137error: 1175error:
1138 return ret; 1176 return ret;
1177}
1139 1178
1140} /* end keyctl_set_timeout() */
1141
1142/*****************************************************************************/
1143/* 1179/*
1144 * assume the authority to instantiate the specified key 1180 * Assume (or clear) the authority to instantiate the specified key.
1181 *
1182 * This sets the authoritative token currently in force for key instantiation.
1183 * This must be done for a key to be instantiated. It has the effect of making
1184 * available all the keys from the caller of the request_key() that created a
1185 * key to request_key() calls made by the caller of this function.
1186 *
1187 * The caller must have the instantiation key in their process keyrings with a
1188 * Search permission grant available to the caller.
1189 *
1190 * If the ID given is 0, then the setting will be cleared and 0 returned.
1191 *
1192 * If the ID given has a matching an authorisation key, then that key will be
1193 * set and its ID will be returned. The authorisation key can be read to get
1194 * the callout information passed to request_key().
1145 */ 1195 */
1146long keyctl_assume_authority(key_serial_t id) 1196long keyctl_assume_authority(key_serial_t id)
1147{ 1197{
@@ -1178,16 +1228,17 @@ long keyctl_assume_authority(key_serial_t id)
1178 ret = authkey->serial; 1228 ret = authkey->serial;
1179error: 1229error:
1180 return ret; 1230 return ret;
1181 1231}
1182} /* end keyctl_assume_authority() */
1183 1232
1184/* 1233/*
1185 * get the security label of a key 1234 * Get a key's the LSM security label.
1186 * - the key must grant us view permission 1235 *
1187 * - if there's a buffer, we place up to buflen bytes of data into it 1236 * The key must grant the caller View permission for this to work.
1188 * - unless there's an error, we return the amount of information available, 1237 *
1189 * irrespective of how much we may have copied (including the terminal NUL) 1238 * If there's a buffer, then up to buflen bytes of data will be placed into it.
1190 * - implements keyctl(KEYCTL_GET_SECURITY) 1239 *
1240 * If successful, the amount of information available will be returned,
1241 * irrespective of how much was copied (including the terminal NUL).
1191 */ 1242 */
1192long keyctl_get_security(key_serial_t keyid, 1243long keyctl_get_security(key_serial_t keyid,
1193 char __user *buffer, 1244 char __user *buffer,
@@ -1242,10 +1293,16 @@ long keyctl_get_security(key_serial_t keyid,
1242} 1293}
1243 1294
1244/* 1295/*
1245 * attempt to install the calling process's session keyring on the process's 1296 * Attempt to install the calling process's session keyring on the process's
1246 * parent process 1297 * parent process.
1247 * - the keyring must exist and must grant us LINK permission 1298 *
1248 * - implements keyctl(KEYCTL_SESSION_TO_PARENT) 1299 * The keyring must exist and must grant the caller LINK permission, and the
1300 * parent process must be single-threaded and must have the same effective
1301 * ownership as this process and mustn't be SUID/SGID.
1302 *
1303 * The keyring will be emplaced on the parent when it next resumes userspace.
1304 *
1305 * If successful, 0 will be returned.
1249 */ 1306 */
1250long keyctl_session_to_parent(void) 1307long keyctl_session_to_parent(void)
1251{ 1308{
@@ -1348,9 +1405,8 @@ error_keyring:
1348#endif /* !TIF_NOTIFY_RESUME */ 1405#endif /* !TIF_NOTIFY_RESUME */
1349} 1406}
1350 1407
1351/*****************************************************************************/
1352/* 1408/*
1353 * the key control system call 1409 * The key control system call
1354 */ 1410 */
1355SYSCALL_DEFINE5(keyctl, int, option, unsigned long, arg2, unsigned long, arg3, 1411SYSCALL_DEFINE5(keyctl, int, option, unsigned long, arg2, unsigned long, arg3,
1356 unsigned long, arg4, unsigned long, arg5) 1412 unsigned long, arg4, unsigned long, arg5)
@@ -1439,5 +1495,4 @@ SYSCALL_DEFINE5(keyctl, int, option, unsigned long, arg2, unsigned long, arg3,
1439 default: 1495 default:
1440 return -EOPNOTSUPP; 1496 return -EOPNOTSUPP;
1441 } 1497 }
1442 1498}
1443} /* end sys_keyctl() */
diff --git a/security/keys/keyring.c b/security/keys/keyring.c
index d37f713e73ce..92024ed12e0a 100644
--- a/security/keys/keyring.c
+++ b/security/keys/keyring.c
@@ -26,13 +26,13 @@
26 rwsem_is_locked((struct rw_semaphore *)&(keyring)->sem))) 26 rwsem_is_locked((struct rw_semaphore *)&(keyring)->sem)))
27 27
28/* 28/*
29 * when plumbing the depths of the key tree, this sets a hard limit set on how 29 * When plumbing the depths of the key tree, this sets a hard limit
30 * deep we're willing to go 30 * set on how deep we're willing to go.
31 */ 31 */
32#define KEYRING_SEARCH_MAX_DEPTH 6 32#define KEYRING_SEARCH_MAX_DEPTH 6
33 33
34/* 34/*
35 * we keep all named keyrings in a hash to speed looking them up 35 * We keep all named keyrings in a hash to speed looking them up.
36 */ 36 */
37#define KEYRING_NAME_HASH_SIZE (1 << 5) 37#define KEYRING_NAME_HASH_SIZE (1 << 5)
38 38
@@ -50,7 +50,9 @@ static inline unsigned keyring_hash(const char *desc)
50} 50}
51 51
52/* 52/*
53 * the keyring type definition 53 * The keyring key type definition. Keyrings are simply keys of this type and
54 * can be treated as ordinary keys in addition to having their own special
55 * operations.
54 */ 56 */
55static int keyring_instantiate(struct key *keyring, 57static int keyring_instantiate(struct key *keyring,
56 const void *data, size_t datalen); 58 const void *data, size_t datalen);
@@ -71,19 +73,17 @@ struct key_type key_type_keyring = {
71 .describe = keyring_describe, 73 .describe = keyring_describe,
72 .read = keyring_read, 74 .read = keyring_read,
73}; 75};
74
75EXPORT_SYMBOL(key_type_keyring); 76EXPORT_SYMBOL(key_type_keyring);
76 77
77/* 78/*
78 * semaphore to serialise link/link calls to prevent two link calls in parallel 79 * Semaphore to serialise link/link calls to prevent two link calls in parallel
79 * introducing a cycle 80 * introducing a cycle.
80 */ 81 */
81static DECLARE_RWSEM(keyring_serialise_link_sem); 82static DECLARE_RWSEM(keyring_serialise_link_sem);
82 83
83/*****************************************************************************/
84/* 84/*
85 * publish the name of a keyring so that it can be found by name (if it has 85 * Publish the name of a keyring so that it can be found by name (if it has
86 * one) 86 * one).
87 */ 87 */
88static void keyring_publish_name(struct key *keyring) 88static void keyring_publish_name(struct key *keyring)
89{ 89{
@@ -102,13 +102,12 @@ static void keyring_publish_name(struct key *keyring)
102 102
103 write_unlock(&keyring_name_lock); 103 write_unlock(&keyring_name_lock);
104 } 104 }
105}
105 106
106} /* end keyring_publish_name() */
107
108/*****************************************************************************/
109/* 107/*
110 * initialise a keyring 108 * Initialise a keyring.
111 * - we object if we were given any data 109 *
110 * Returns 0 on success, -EINVAL if given any data.
112 */ 111 */
113static int keyring_instantiate(struct key *keyring, 112static int keyring_instantiate(struct key *keyring,
114 const void *data, size_t datalen) 113 const void *data, size_t datalen)
@@ -123,23 +122,20 @@ static int keyring_instantiate(struct key *keyring,
123 } 122 }
124 123
125 return ret; 124 return ret;
125}
126 126
127} /* end keyring_instantiate() */
128
129/*****************************************************************************/
130/* 127/*
131 * match keyrings on their name 128 * Match keyrings on their name
132 */ 129 */
133static int keyring_match(const struct key *keyring, const void *description) 130static int keyring_match(const struct key *keyring, const void *description)
134{ 131{
135 return keyring->description && 132 return keyring->description &&
136 strcmp(keyring->description, description) == 0; 133 strcmp(keyring->description, description) == 0;
134}
137 135
138} /* end keyring_match() */
139
140/*****************************************************************************/
141/* 136/*
142 * dispose of the data dangling from the corpse of a keyring 137 * Clean up a keyring when it is destroyed. Unpublish its name if it had one
138 * and dispose of its data.
143 */ 139 */
144static void keyring_destroy(struct key *keyring) 140static void keyring_destroy(struct key *keyring)
145{ 141{
@@ -164,12 +160,10 @@ static void keyring_destroy(struct key *keyring)
164 key_put(klist->keys[loop]); 160 key_put(klist->keys[loop]);
165 kfree(klist); 161 kfree(klist);
166 } 162 }
163}
167 164
168} /* end keyring_destroy() */
169
170/*****************************************************************************/
171/* 165/*
172 * describe the keyring 166 * Describe a keyring for /proc.
173 */ 167 */
174static void keyring_describe(const struct key *keyring, struct seq_file *m) 168static void keyring_describe(const struct key *keyring, struct seq_file *m)
175{ 169{
@@ -187,13 +181,12 @@ static void keyring_describe(const struct key *keyring, struct seq_file *m)
187 else 181 else
188 seq_puts(m, ": empty"); 182 seq_puts(m, ": empty");
189 rcu_read_unlock(); 183 rcu_read_unlock();
184}
190 185
191} /* end keyring_describe() */
192
193/*****************************************************************************/
194/* 186/*
195 * read a list of key IDs from the keyring's contents 187 * Read a list of key IDs from the keyring's contents in binary form
196 * - the keyring's semaphore is read-locked 188 *
189 * The keyring's semaphore is read-locked by the caller.
197 */ 190 */
198static long keyring_read(const struct key *keyring, 191static long keyring_read(const struct key *keyring,
199 char __user *buffer, size_t buflen) 192 char __user *buffer, size_t buflen)
@@ -241,12 +234,10 @@ static long keyring_read(const struct key *keyring,
241 234
242error: 235error:
243 return ret; 236 return ret;
237}
244 238
245} /* end keyring_read() */
246
247/*****************************************************************************/
248/* 239/*
249 * allocate a keyring and link into the destination keyring 240 * Allocate a keyring and link into the destination keyring.
250 */ 241 */
251struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid, 242struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid,
252 const struct cred *cred, unsigned long flags, 243 const struct cred *cred, unsigned long flags,
@@ -269,20 +260,42 @@ struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid,
269 } 260 }
270 261
271 return keyring; 262 return keyring;
263}
272 264
273} /* end keyring_alloc() */ 265/**
274 266 * keyring_search_aux - Search a keyring tree for a key matching some criteria
275/*****************************************************************************/ 267 * @keyring_ref: A pointer to the keyring with possession indicator.
276/* 268 * @cred: The credentials to use for permissions checks.
277 * search the supplied keyring tree for a key that matches the criterion 269 * @type: The type of key to search for.
278 * - perform a breadth-then-depth search up to the prescribed limit 270 * @description: Parameter for @match.
279 * - we only find keys on which we have search permission 271 * @match: Function to rule on whether or not a key is the one required.
280 * - we use the supplied match function to see if the description (or other 272 *
281 * feature of interest) matches 273 * Search the supplied keyring tree for a key that matches the criteria given.
282 * - we rely on RCU to prevent the keyring lists from disappearing on us 274 * The root keyring and any linked keyrings must grant Search permission to the
283 * - we return -EAGAIN if we didn't find any matching key 275 * caller to be searchable and keys can only be found if they too grant Search
284 * - we return -ENOKEY if we only found negative matching keys 276 * to the caller. The possession flag on the root keyring pointer controls use
285 * - we propagate the possession attribute from the keyring ref to the key ref 277 * of the possessor bits in permissions checking of the entire tree. In
278 * addition, the LSM gets to forbid keyring searches and key matches.
279 *
280 * The search is performed as a breadth-then-depth search up to the prescribed
281 * limit (KEYRING_SEARCH_MAX_DEPTH).
282 *
283 * Keys are matched to the type provided and are then filtered by the match
284 * function, which is given the description to use in any way it sees fit. The
285 * match function may use any attributes of a key that it wishes to to
286 * determine the match. Normally the match function from the key type would be
287 * used.
288 *
289 * RCU is used to prevent the keyring key lists from disappearing without the
290 * need to take lots of locks.
291 *
292 * Returns a pointer to the found key and increments the key usage count if
293 * successful; -EAGAIN if no matching keys were found, or if expired or revoked
294 * keys were found; -ENOKEY if only negative keys were found; -ENOTDIR if the
295 * specified keyring wasn't a keyring.
296 *
297 * In the case of a successful return, the possession attribute from
298 * @keyring_ref is propagated to the returned key reference.
286 */ 299 */
287key_ref_t keyring_search_aux(key_ref_t keyring_ref, 300key_ref_t keyring_search_aux(key_ref_t keyring_ref,
288 const struct cred *cred, 301 const struct cred *cred,
@@ -444,17 +457,16 @@ error_2:
444 rcu_read_unlock(); 457 rcu_read_unlock();
445error: 458error:
446 return key_ref; 459 return key_ref;
460}
447 461
448} /* end keyring_search_aux() */ 462/**
449 463 * keyring_search - Search the supplied keyring tree for a matching key
450/*****************************************************************************/ 464 * @keyring: The root of the keyring tree to be searched.
451/* 465 * @type: The type of keyring we want to find.
452 * search the supplied keyring tree for a key that matches the criterion 466 * @description: The name of the keyring we want to find.
453 * - perform a breadth-then-depth search up to the prescribed limit 467 *
454 * - we only find keys on which we have search permission 468 * As keyring_search_aux() above, but using the current task's credentials and
455 * - we readlock the keyrings as we search down the tree 469 * type's default matching function.
456 * - we return -EAGAIN if we didn't find any matching key
457 * - we return -ENOKEY if we only found negative matching keys
458 */ 470 */
459key_ref_t keyring_search(key_ref_t keyring, 471key_ref_t keyring_search(key_ref_t keyring,
460 struct key_type *type, 472 struct key_type *type,
@@ -465,16 +477,23 @@ key_ref_t keyring_search(key_ref_t keyring,
465 477
466 return keyring_search_aux(keyring, current->cred, 478 return keyring_search_aux(keyring, current->cred,
467 type, description, type->match); 479 type, description, type->match);
468 480}
469} /* end keyring_search() */
470
471EXPORT_SYMBOL(keyring_search); 481EXPORT_SYMBOL(keyring_search);
472 482
473/*****************************************************************************/
474/* 483/*
475 * search the given keyring only (no recursion) 484 * Search the given keyring only (no recursion).
476 * - keyring must be locked by caller 485 *
477 * - caller must guarantee that the keyring is a keyring 486 * The caller must guarantee that the keyring is a keyring and that the
487 * permission is granted to search the keyring as no check is made here.
488 *
489 * RCU is used to make it unnecessary to lock the keyring key list here.
490 *
491 * Returns a pointer to the found key with usage count incremented if
492 * successful and returns -ENOKEY if not found. Revoked keys and keys not
493 * providing the requested permission are skipped over.
494 *
495 * If successful, the possession indicator is propagated from the keyring ref
496 * to the returned key reference.
478 */ 497 */
479key_ref_t __keyring_search_one(key_ref_t keyring_ref, 498key_ref_t __keyring_search_one(key_ref_t keyring_ref,
480 const struct key_type *ktype, 499 const struct key_type *ktype,
@@ -514,14 +533,18 @@ found:
514 atomic_inc(&key->usage); 533 atomic_inc(&key->usage);
515 rcu_read_unlock(); 534 rcu_read_unlock();
516 return make_key_ref(key, possessed); 535 return make_key_ref(key, possessed);
536}
517 537
518} /* end __keyring_search_one() */
519
520/*****************************************************************************/
521/* 538/*
522 * find a keyring with the specified name 539 * Find a keyring with the specified name.
523 * - all named keyrings are searched 540 *
524 * - normally only finds keyrings with search permission for the current process 541 * All named keyrings in the current user namespace are searched, provided they
542 * grant Search permission directly to the caller (unless this check is
543 * skipped). Keyrings whose usage points have reached zero or who have been
544 * revoked are skipped.
545 *
546 * Returns a pointer to the keyring with the keyring's refcount having being
547 * incremented on success. -ENOKEY is returned if a key could not be found.
525 */ 548 */
526struct key *find_keyring_by_name(const char *name, bool skip_perm_check) 549struct key *find_keyring_by_name(const char *name, bool skip_perm_check)
527{ 550{
@@ -569,15 +592,14 @@ struct key *find_keyring_by_name(const char *name, bool skip_perm_check)
569out: 592out:
570 read_unlock(&keyring_name_lock); 593 read_unlock(&keyring_name_lock);
571 return keyring; 594 return keyring;
595}
572 596
573} /* end find_keyring_by_name() */
574
575/*****************************************************************************/
576/* 597/*
577 * see if a cycle will will be created by inserting acyclic tree B in acyclic 598 * See if a cycle will will be created by inserting acyclic tree B in acyclic
578 * tree A at the topmost level (ie: as a direct child of A) 599 * tree A at the topmost level (ie: as a direct child of A).
579 * - since we are adding B to A at the top level, checking for cycles should 600 *
580 * just be a matter of seeing if node A is somewhere in tree B 601 * Since we are adding B to A at the top level, checking for cycles should just
602 * be a matter of seeing if node A is somewhere in tree B.
581 */ 603 */
582static int keyring_detect_cycle(struct key *A, struct key *B) 604static int keyring_detect_cycle(struct key *A, struct key *B)
583{ 605{
@@ -657,11 +679,10 @@ too_deep:
657cycle_detected: 679cycle_detected:
658 ret = -EDEADLK; 680 ret = -EDEADLK;
659 goto error; 681 goto error;
660 682}
661} /* end keyring_detect_cycle() */
662 683
663/* 684/*
664 * dispose of a keyring list after the RCU grace period, freeing the unlinked 685 * Dispose of a keyring list after the RCU grace period, freeing the unlinked
665 * key 686 * key
666 */ 687 */
667static void keyring_unlink_rcu_disposal(struct rcu_head *rcu) 688static void keyring_unlink_rcu_disposal(struct rcu_head *rcu)
@@ -675,7 +696,7 @@ static void keyring_unlink_rcu_disposal(struct rcu_head *rcu)
675} 696}
676 697
677/* 698/*
678 * preallocate memory so that a key can be linked into to a keyring 699 * Preallocate memory so that a key can be linked into to a keyring.
679 */ 700 */
680int __key_link_begin(struct key *keyring, const struct key_type *type, 701int __key_link_begin(struct key *keyring, const struct key_type *type,
681 const char *description, 702 const char *description,
@@ -792,10 +813,10 @@ error_krsem:
792} 813}
793 814
794/* 815/*
795 * check already instantiated keys aren't going to be a problem 816 * Check already instantiated keys aren't going to be a problem.
796 * - the caller must have called __key_link_begin() 817 *
797 * - don't need to call this for keys that were created since __key_link_begin() 818 * The caller must have called __key_link_begin(). Don't need to call this for
798 * was called 819 * keys that were created since __key_link_begin() was called.
799 */ 820 */
800int __key_link_check_live_key(struct key *keyring, struct key *key) 821int __key_link_check_live_key(struct key *keyring, struct key *key)
801{ 822{
@@ -807,9 +828,12 @@ int __key_link_check_live_key(struct key *keyring, struct key *key)
807} 828}
808 829
809/* 830/*
810 * link a key into to a keyring 831 * Link a key into to a keyring.
811 * - must be called with __key_link_begin() having being called 832 *
812 * - discard already extant link to matching key if there is one 833 * Must be called with __key_link_begin() having being called. Discards any
834 * already extant link to matching key if there is one, so that each keyring
835 * holds at most one link to any given key of a particular type+description
836 * combination.
813 */ 837 */
814void __key_link(struct key *keyring, struct key *key, 838void __key_link(struct key *keyring, struct key *key,
815 struct keyring_list **_prealloc) 839 struct keyring_list **_prealloc)
@@ -852,8 +876,9 @@ void __key_link(struct key *keyring, struct key *key,
852} 876}
853 877
854/* 878/*
855 * finish linking a key into to a keyring 879 * Finish linking a key into to a keyring.
856 * - must be called with __key_link_begin() having being called 880 *
881 * Must be called with __key_link_begin() having being called.
857 */ 882 */
858void __key_link_end(struct key *keyring, struct key_type *type, 883void __key_link_end(struct key *keyring, struct key_type *type,
859 struct keyring_list *prealloc) 884 struct keyring_list *prealloc)
@@ -874,8 +899,25 @@ void __key_link_end(struct key *keyring, struct key_type *type,
874 up_write(&keyring->sem); 899 up_write(&keyring->sem);
875} 900}
876 901
877/* 902/**
878 * link a key to a keyring 903 * key_link - Link a key to a keyring
904 * @keyring: The keyring to make the link in.
905 * @key: The key to link to.
906 *
907 * Make a link in a keyring to a key, such that the keyring holds a reference
908 * on that key and the key can potentially be found by searching that keyring.
909 *
910 * This function will write-lock the keyring's semaphore and will consume some
911 * of the user's key data quota to hold the link.
912 *
913 * Returns 0 if successful, -ENOTDIR if the keyring isn't a keyring,
914 * -EKEYREVOKED if the keyring has been revoked, -ENFILE if the keyring is
915 * full, -EDQUOT if there is insufficient key data quota remaining to add
916 * another link or -ENOMEM if there's insufficient memory.
917 *
918 * It is assumed that the caller has checked that it is permitted for a link to
919 * be made (the keyring should have Write permission and the key Link
920 * permission).
879 */ 921 */
880int key_link(struct key *keyring, struct key *key) 922int key_link(struct key *keyring, struct key *key)
881{ 923{
@@ -895,12 +937,24 @@ int key_link(struct key *keyring, struct key *key)
895 937
896 return ret; 938 return ret;
897} 939}
898
899EXPORT_SYMBOL(key_link); 940EXPORT_SYMBOL(key_link);
900 941
901/*****************************************************************************/ 942/**
902/* 943 * key_unlink - Unlink the first link to a key from a keyring.
903 * unlink the first link to a key from a keyring 944 * @keyring: The keyring to remove the link from.
945 * @key: The key the link is to.
946 *
947 * Remove a link from a keyring to a key.
948 *
949 * This function will write-lock the keyring's semaphore.
950 *
951 * Returns 0 if successful, -ENOTDIR if the keyring isn't a keyring, -ENOENT if
952 * the key isn't linked to by the keyring or -ENOMEM if there's insufficient
953 * memory.
954 *
955 * It is assumed that the caller has checked that it is permitted for a link to
956 * be removed (the keyring should have Write permission; no permissions are
957 * required on the key).
904 */ 958 */
905int key_unlink(struct key *keyring, struct key *key) 959int key_unlink(struct key *keyring, struct key *key)
906{ 960{
@@ -968,15 +1022,12 @@ nomem:
968 ret = -ENOMEM; 1022 ret = -ENOMEM;
969 up_write(&keyring->sem); 1023 up_write(&keyring->sem);
970 goto error; 1024 goto error;
971 1025}
972} /* end key_unlink() */
973
974EXPORT_SYMBOL(key_unlink); 1026EXPORT_SYMBOL(key_unlink);
975 1027
976/*****************************************************************************/
977/* 1028/*
978 * dispose of a keyring list after the RCU grace period, releasing the keys it 1029 * Dispose of a keyring list after the RCU grace period, releasing the keys it
979 * links to 1030 * links to.
980 */ 1031 */
981static void keyring_clear_rcu_disposal(struct rcu_head *rcu) 1032static void keyring_clear_rcu_disposal(struct rcu_head *rcu)
982{ 1033{
@@ -989,13 +1040,15 @@ static void keyring_clear_rcu_disposal(struct rcu_head *rcu)
989 key_put(klist->keys[loop]); 1040 key_put(klist->keys[loop]);
990 1041
991 kfree(klist); 1042 kfree(klist);
1043}
992 1044
993} /* end keyring_clear_rcu_disposal() */ 1045/**
994 1046 * keyring_clear - Clear a keyring
995/*****************************************************************************/ 1047 * @keyring: The keyring to clear.
996/* 1048 *
997 * clear the specified process keyring 1049 * Clear the contents of the specified keyring.
998 * - implements keyctl(KEYCTL_CLEAR) 1050 *
1051 * Returns 0 if successful or -ENOTDIR if the keyring isn't a keyring.
999 */ 1052 */
1000int keyring_clear(struct key *keyring) 1053int keyring_clear(struct key *keyring)
1001{ 1054{
@@ -1027,15 +1080,13 @@ int keyring_clear(struct key *keyring)
1027 } 1080 }
1028 1081
1029 return ret; 1082 return ret;
1030 1083}
1031} /* end keyring_clear() */
1032
1033EXPORT_SYMBOL(keyring_clear); 1084EXPORT_SYMBOL(keyring_clear);
1034 1085
1035/*****************************************************************************/
1036/* 1086/*
1037 * dispose of the links from a revoked keyring 1087 * Dispose of the links from a revoked keyring.
1038 * - called with the key sem write-locked 1088 *
1089 * This is called with the key sem write-locked.
1039 */ 1090 */
1040static void keyring_revoke(struct key *keyring) 1091static void keyring_revoke(struct key *keyring)
1041{ 1092{
@@ -1050,11 +1101,10 @@ static void keyring_revoke(struct key *keyring)
1050 rcu_assign_pointer(keyring->payload.subscriptions, NULL); 1101 rcu_assign_pointer(keyring->payload.subscriptions, NULL);
1051 call_rcu(&klist->rcu, keyring_clear_rcu_disposal); 1102 call_rcu(&klist->rcu, keyring_clear_rcu_disposal);
1052 } 1103 }
1053 1104}
1054} /* end keyring_revoke() */
1055 1105
1056/* 1106/*
1057 * Determine whether a key is dead 1107 * Determine whether a key is dead.
1058 */ 1108 */
1059static bool key_is_dead(struct key *key, time_t limit) 1109static bool key_is_dead(struct key *key, time_t limit)
1060{ 1110{
@@ -1063,7 +1113,12 @@ static bool key_is_dead(struct key *key, time_t limit)
1063} 1113}
1064 1114
1065/* 1115/*
1066 * Collect garbage from the contents of a keyring 1116 * Collect garbage from the contents of a keyring, replacing the old list with
1117 * a new one with the pointers all shuffled down.
1118 *
1119 * Dead keys are classed as oned that are flagged as being dead or are revoked,
1120 * expired or negative keys that were revoked or expired before the specified
1121 * limit.
1067 */ 1122 */
1068void keyring_gc(struct key *keyring, time_t limit) 1123void keyring_gc(struct key *keyring, time_t limit)
1069{ 1124{
diff --git a/security/keys/permission.c b/security/keys/permission.c
index 28645502cd0d..c35b5229e3cd 100644
--- a/security/keys/permission.c
+++ b/security/keys/permission.c
@@ -1,4 +1,4 @@
1/* permission.c: key permission determination 1/* Key permission checking
2 * 2 *
3 * Copyright (C) 2005 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2005 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -13,18 +13,19 @@
13#include <linux/security.h> 13#include <linux/security.h>
14#include "internal.h" 14#include "internal.h"
15 15
16/*****************************************************************************/
17/** 16/**
18 * key_task_permission - Check a key can be used 17 * key_task_permission - Check a key can be used
19 * @key_ref: The key to check 18 * @key_ref: The key to check.
20 * @cred: The credentials to use 19 * @cred: The credentials to use.
21 * @perm: The permissions to check for 20 * @perm: The permissions to check for.
22 * 21 *
23 * Check to see whether permission is granted to use a key in the desired way, 22 * Check to see whether permission is granted to use a key in the desired way,
24 * but permit the security modules to override. 23 * but permit the security modules to override.
25 * 24 *
26 * The caller must hold either a ref on cred or must hold the RCU readlock or a 25 * The caller must hold either a ref on cred or must hold the RCU readlock.
27 * spinlock. 26 *
27 * Returns 0 if successful, -EACCES if access is denied based on the
28 * permissions bits or the LSM check.
28 */ 29 */
29int key_task_permission(const key_ref_t key_ref, const struct cred *cred, 30int key_task_permission(const key_ref_t key_ref, const struct cred *cred,
30 key_perm_t perm) 31 key_perm_t perm)
@@ -79,14 +80,16 @@ use_these_perms:
79 80
80 /* let LSM be the final arbiter */ 81 /* let LSM be the final arbiter */
81 return security_key_permission(key_ref, cred, perm); 82 return security_key_permission(key_ref, cred, perm);
82 83}
83} /* end key_task_permission() */
84
85EXPORT_SYMBOL(key_task_permission); 84EXPORT_SYMBOL(key_task_permission);
86 85
87/*****************************************************************************/ 86/**
88/* 87 * key_validate - Validate a key.
89 * validate a key 88 * @key: The key to be validated.
89 *
90 * Check that a key is valid, returning 0 if the key is okay, -EKEYREVOKED if
91 * the key's type has been removed or if the key has been revoked or
92 * -EKEYEXPIRED if the key has expired.
90 */ 93 */
91int key_validate(struct key *key) 94int key_validate(struct key *key)
92{ 95{
@@ -111,7 +114,5 @@ int key_validate(struct key *key)
111 114
112error: 115error:
113 return ret; 116 return ret;
114 117}
115} /* end key_validate() */
116
117EXPORT_SYMBOL(key_validate); 118EXPORT_SYMBOL(key_validate);
diff --git a/security/keys/proc.c b/security/keys/proc.c
index 70373966816e..525cf8a29cdd 100644
--- a/security/keys/proc.c
+++ b/security/keys/proc.c
@@ -1,4 +1,4 @@
1/* proc.c: proc files for key database enumeration 1/* procfs files for key database enumeration
2 * 2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -60,9 +60,8 @@ static const struct file_operations proc_key_users_fops = {
60 .release = seq_release, 60 .release = seq_release,
61}; 61};
62 62
63/*****************************************************************************/
64/* 63/*
65 * declare the /proc files 64 * Declare the /proc files.
66 */ 65 */
67static int __init key_proc_init(void) 66static int __init key_proc_init(void)
68{ 67{
@@ -79,14 +78,13 @@ static int __init key_proc_init(void)
79 panic("Cannot create /proc/key-users\n"); 78 panic("Cannot create /proc/key-users\n");
80 79
81 return 0; 80 return 0;
82 81}
83} /* end key_proc_init() */
84 82
85__initcall(key_proc_init); 83__initcall(key_proc_init);
86 84
87/*****************************************************************************/
88/* 85/*
89 * implement "/proc/keys" to provides a list of the keys on the system 86 * Implement "/proc/keys" to provide a list of the keys on the system that
87 * grant View permission to the caller.
90 */ 88 */
91#ifdef CONFIG_KEYS_DEBUG_PROC_KEYS 89#ifdef CONFIG_KEYS_DEBUG_PROC_KEYS
92 90
@@ -293,9 +291,9 @@ static struct rb_node *key_user_first(struct rb_root *r)
293 return __key_user_next(n); 291 return __key_user_next(n);
294} 292}
295 293
296/*****************************************************************************/
297/* 294/*
298 * implement "/proc/key-users" to provides a list of the key users 295 * Implement "/proc/key-users" to provides a list of the key users and their
296 * quotas.
299 */ 297 */
300static int proc_key_users_open(struct inode *inode, struct file *file) 298static int proc_key_users_open(struct inode *inode, struct file *file)
301{ 299{
@@ -351,5 +349,4 @@ static int proc_key_users_show(struct seq_file *m, void *v)
351 maxbytes); 349 maxbytes);
352 350
353 return 0; 351 return 0;
354
355} 352}
diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
index 504bdd2452bd..930634e45149 100644
--- a/security/keys/process_keys.c
+++ b/security/keys/process_keys.c
@@ -1,4 +1,4 @@
1/* Management of a process's keyrings 1/* Manage a process's keyrings
2 * 2 *
3 * Copyright (C) 2004-2005, 2008 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2004-2005, 2008 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -21,13 +21,13 @@
21#include <asm/uaccess.h> 21#include <asm/uaccess.h>
22#include "internal.h" 22#include "internal.h"
23 23
24/* session keyring create vs join semaphore */ 24/* Session keyring create vs join semaphore */
25static DEFINE_MUTEX(key_session_mutex); 25static DEFINE_MUTEX(key_session_mutex);
26 26
27/* user keyring creation semaphore */ 27/* User keyring creation semaphore */
28static DEFINE_MUTEX(key_user_keyring_mutex); 28static DEFINE_MUTEX(key_user_keyring_mutex);
29 29
30/* the root user's tracking struct */ 30/* The root user's tracking struct */
31struct key_user root_key_user = { 31struct key_user root_key_user = {
32 .usage = ATOMIC_INIT(3), 32 .usage = ATOMIC_INIT(3),
33 .cons_lock = __MUTEX_INITIALIZER(root_key_user.cons_lock), 33 .cons_lock = __MUTEX_INITIALIZER(root_key_user.cons_lock),
@@ -38,9 +38,8 @@ struct key_user root_key_user = {
38 .user_ns = &init_user_ns, 38 .user_ns = &init_user_ns,
39}; 39};
40 40
41/*****************************************************************************/
42/* 41/*
43 * install user and user session keyrings for a particular UID 42 * Install the user and user session keyrings for the current process's UID.
44 */ 43 */
45int install_user_keyrings(void) 44int install_user_keyrings(void)
46{ 45{
@@ -122,7 +121,8 @@ error:
122} 121}
123 122
124/* 123/*
125 * install a fresh thread keyring directly to new credentials 124 * Install a fresh thread keyring directly to new credentials. This keyring is
125 * allowed to overrun the quota.
126 */ 126 */
127int install_thread_keyring_to_cred(struct cred *new) 127int install_thread_keyring_to_cred(struct cred *new)
128{ 128{
@@ -138,7 +138,7 @@ int install_thread_keyring_to_cred(struct cred *new)
138} 138}
139 139
140/* 140/*
141 * install a fresh thread keyring, discarding the old one 141 * Install a fresh thread keyring, discarding the old one.
142 */ 142 */
143static int install_thread_keyring(void) 143static int install_thread_keyring(void)
144{ 144{
@@ -161,9 +161,10 @@ static int install_thread_keyring(void)
161} 161}
162 162
163/* 163/*
164 * install a process keyring directly to a credentials struct 164 * Install a process keyring directly to a credentials struct.
165 * - returns -EEXIST if there was already a process keyring, 0 if one installed, 165 *
166 * and other -ve on any other error 166 * Returns -EEXIST if there was already a process keyring, 0 if one installed,
167 * and other value on any other error
167 */ 168 */
168int install_process_keyring_to_cred(struct cred *new) 169int install_process_keyring_to_cred(struct cred *new)
169{ 170{
@@ -192,8 +193,11 @@ int install_process_keyring_to_cred(struct cred *new)
192} 193}
193 194
194/* 195/*
195 * make sure a process keyring is installed 196 * Make sure a process keyring is installed for the current process. The
196 * - we 197 * existing process keyring is not replaced.
198 *
199 * Returns 0 if there is a process keyring by the end of this function, some
200 * error otherwise.
197 */ 201 */
198static int install_process_keyring(void) 202static int install_process_keyring(void)
199{ 203{
@@ -214,7 +218,7 @@ static int install_process_keyring(void)
214} 218}
215 219
216/* 220/*
217 * install a session keyring directly to a credentials struct 221 * Install a session keyring directly to a credentials struct.
218 */ 222 */
219int install_session_keyring_to_cred(struct cred *cred, struct key *keyring) 223int install_session_keyring_to_cred(struct cred *cred, struct key *keyring)
220{ 224{
@@ -254,8 +258,8 @@ int install_session_keyring_to_cred(struct cred *cred, struct key *keyring)
254} 258}
255 259
256/* 260/*
257 * install a session keyring, discarding the old one 261 * Install a session keyring, discarding the old one. If a keyring is not
258 * - if a keyring is not supplied, an empty one is invented 262 * supplied, an empty one is invented.
259 */ 263 */
260static int install_session_keyring(struct key *keyring) 264static int install_session_keyring(struct key *keyring)
261{ 265{
@@ -275,9 +279,8 @@ static int install_session_keyring(struct key *keyring)
275 return commit_creds(new); 279 return commit_creds(new);
276} 280}
277 281
278/*****************************************************************************/
279/* 282/*
280 * the filesystem user ID changed 283 * Handle the fsuid changing.
281 */ 284 */
282void key_fsuid_changed(struct task_struct *tsk) 285void key_fsuid_changed(struct task_struct *tsk)
283{ 286{
@@ -288,12 +291,10 @@ void key_fsuid_changed(struct task_struct *tsk)
288 tsk->cred->thread_keyring->uid = tsk->cred->fsuid; 291 tsk->cred->thread_keyring->uid = tsk->cred->fsuid;
289 up_write(&tsk->cred->thread_keyring->sem); 292 up_write(&tsk->cred->thread_keyring->sem);
290 } 293 }
294}
291 295
292} /* end key_fsuid_changed() */
293
294/*****************************************************************************/
295/* 296/*
296 * the filesystem group ID changed 297 * Handle the fsgid changing.
297 */ 298 */
298void key_fsgid_changed(struct task_struct *tsk) 299void key_fsgid_changed(struct task_struct *tsk)
299{ 300{
@@ -304,16 +305,28 @@ void key_fsgid_changed(struct task_struct *tsk)
304 tsk->cred->thread_keyring->gid = tsk->cred->fsgid; 305 tsk->cred->thread_keyring->gid = tsk->cred->fsgid;
305 up_write(&tsk->cred->thread_keyring->sem); 306 up_write(&tsk->cred->thread_keyring->sem);
306 } 307 }
308}
307 309
308} /* end key_fsgid_changed() */
309
310/*****************************************************************************/
311/* 310/*
312 * search only my process keyrings for the first matching key 311 * Search the process keyrings attached to the supplied cred for the first
313 * - we use the supplied match function to see if the description (or other 312 * matching key.
314 * feature of interest) matches 313 *
315 * - we return -EAGAIN if we didn't find any matching key 314 * The search criteria are the type and the match function. The description is
316 * - we return -ENOKEY if we found only negative matching keys 315 * given to the match function as a parameter, but doesn't otherwise influence
316 * the search. Typically the match function will compare the description
317 * parameter to the key's description.
318 *
319 * This can only search keyrings that grant Search permission to the supplied
320 * credentials. Keyrings linked to searched keyrings will also be searched if
321 * they grant Search permission too. Keys can only be found if they grant
322 * Search permission to the credentials.
323 *
324 * Returns a pointer to the key with the key usage count incremented if
325 * successful, -EAGAIN if we didn't find any matching key or -ENOKEY if we only
326 * matched negative keys.
327 *
328 * In the case of a successful return, the possession attribute is set on the
329 * returned key reference.
317 */ 330 */
318key_ref_t search_my_process_keyrings(struct key_type *type, 331key_ref_t search_my_process_keyrings(struct key_type *type,
319 const void *description, 332 const void *description,
@@ -428,13 +441,13 @@ found:
428 return key_ref; 441 return key_ref;
429} 442}
430 443
431/*****************************************************************************/
432/* 444/*
433 * search the process keyrings for the first matching key 445 * Search the process keyrings attached to the supplied cred for the first
434 * - we use the supplied match function to see if the description (or other 446 * matching key in the manner of search_my_process_keyrings(), but also search
435 * feature of interest) matches 447 * the keys attached to the assumed authorisation key using its credentials if
436 * - we return -EAGAIN if we didn't find any matching key 448 * one is available.
437 * - we return -ENOKEY if we found only negative matching keys 449 *
450 * Return same as search_my_process_keyrings().
438 */ 451 */
439key_ref_t search_process_keyrings(struct key_type *type, 452key_ref_t search_process_keyrings(struct key_type *type,
440 const void *description, 453 const void *description,
@@ -489,24 +502,33 @@ key_ref_t search_process_keyrings(struct key_type *type,
489 502
490found: 503found:
491 return key_ref; 504 return key_ref;
505}
492 506
493} /* end search_process_keyrings() */
494
495/*****************************************************************************/
496/* 507/*
497 * see if the key we're looking at is the target key 508 * See if the key we're looking at is the target key.
498 */ 509 */
499int lookup_user_key_possessed(const struct key *key, const void *target) 510int lookup_user_key_possessed(const struct key *key, const void *target)
500{ 511{
501 return key == target; 512 return key == target;
513}
502 514
503} /* end lookup_user_key_possessed() */
504
505/*****************************************************************************/
506/* 515/*
507 * lookup a key given a key ID from userspace with a given permissions mask 516 * Look up a key ID given us by userspace with a given permissions mask to get
508 * - don't create special keyrings unless so requested 517 * the key it refers to.
509 * - partially constructed keys aren't found unless requested 518 *
519 * Flags can be passed to request that special keyrings be created if referred
520 * to directly, to permit partially constructed keys to be found and to skip
521 * validity and permission checks on the found key.
522 *
523 * Returns a pointer to the key with an incremented usage count if successful;
524 * -EINVAL if the key ID is invalid; -ENOKEY if the key ID does not correspond
525 * to a key or the best found key was a negative key; -EKEYREVOKED or
526 * -EKEYEXPIRED if the best found key was revoked or expired; -EACCES if the
527 * found key doesn't grant the requested permit or the LSM denied access to it;
528 * or -ENOMEM if a special keyring couldn't be created.
529 *
530 * In the case of a successful return, the possession attribute is set on the
531 * returned key reference.
510 */ 532 */
511key_ref_t lookup_user_key(key_serial_t id, unsigned long lflags, 533key_ref_t lookup_user_key(key_serial_t id, unsigned long lflags,
512 key_perm_t perm) 534 key_perm_t perm)
@@ -711,15 +733,18 @@ invalid_key:
711reget_creds: 733reget_creds:
712 put_cred(cred); 734 put_cred(cred);
713 goto try_again; 735 goto try_again;
736}
714 737
715} /* end lookup_user_key() */
716
717/*****************************************************************************/
718/* 738/*
719 * join the named keyring as the session keyring if possible, or attempt to 739 * Join the named keyring as the session keyring if possible else attempt to
720 * create a new one of that name if not 740 * create a new one of that name and join that.
721 * - if the name is NULL, an empty anonymous keyring is installed instead 741 *
722 * - named session keyring joining is done with a semaphore held 742 * If the name is NULL, an empty anonymous keyring will be installed as the
743 * session keyring.
744 *
745 * Named session keyrings are joined with a semaphore held to prevent the
746 * keyrings from going away whilst the attempt is made to going them and also
747 * to prevent a race in creating compatible session keyrings.
723 */ 748 */
724long join_session_keyring(const char *name) 749long join_session_keyring(const char *name)
725{ 750{
@@ -791,8 +816,8 @@ error:
791} 816}
792 817
793/* 818/*
794 * Replace a process's session keyring when that process resumes userspace on 819 * Replace a process's session keyring on behalf of one of its children when
795 * behalf of one of its children 820 * the target process is about to resume userspace execution.
796 */ 821 */
797void key_replace_session_keyring(void) 822void key_replace_session_keyring(void)
798{ 823{
diff --git a/security/keys/request_key.c b/security/keys/request_key.c
index 0ea52d25a6bd..9a7fb3914b27 100644
--- a/security/keys/request_key.c
+++ b/security/keys/request_key.c
@@ -39,8 +39,14 @@ static int key_wait_bit_intr(void *flags)
39 return signal_pending(current) ? -ERESTARTSYS : 0; 39 return signal_pending(current) ? -ERESTARTSYS : 0;
40} 40}
41 41
42/* 42/**
43 * call to complete the construction of a key 43 * complete_request_key - Complete the construction of a key.
44 * @cons: The key construction record.
45 * @error: The success or failute of the construction.
46 *
47 * Complete the attempt to construct a key. The key will be negated
48 * if an error is indicated. The authorisation key will be revoked
49 * unconditionally.
44 */ 50 */
45void complete_request_key(struct key_construction *cons, int error) 51void complete_request_key(struct key_construction *cons, int error)
46{ 52{
@@ -58,23 +64,33 @@ void complete_request_key(struct key_construction *cons, int error)
58} 64}
59EXPORT_SYMBOL(complete_request_key); 65EXPORT_SYMBOL(complete_request_key);
60 66
67/*
68 * Initialise a usermode helper that is going to have a specific session
69 * keyring.
70 *
71 * This is called in context of freshly forked kthread before kernel_execve(),
72 * so we can simply install the desired session_keyring at this point.
73 */
61static int umh_keys_init(struct subprocess_info *info) 74static int umh_keys_init(struct subprocess_info *info)
62{ 75{
63 struct cred *cred = (struct cred*)current_cred(); 76 struct cred *cred = (struct cred*)current_cred();
64 struct key *keyring = info->data; 77 struct key *keyring = info->data;
65 /* 78
66 * This is called in context of freshly forked kthread before
67 * kernel_execve(), we can just change our ->session_keyring.
68 */
69 return install_session_keyring_to_cred(cred, keyring); 79 return install_session_keyring_to_cred(cred, keyring);
70} 80}
71 81
82/*
83 * Clean up a usermode helper with session keyring.
84 */
72static void umh_keys_cleanup(struct subprocess_info *info) 85static void umh_keys_cleanup(struct subprocess_info *info)
73{ 86{
74 struct key *keyring = info->data; 87 struct key *keyring = info->data;
75 key_put(keyring); 88 key_put(keyring);
76} 89}
77 90
91/*
92 * Call a usermode helper with a specific session keyring.
93 */
78static int call_usermodehelper_keys(char *path, char **argv, char **envp, 94static int call_usermodehelper_keys(char *path, char **argv, char **envp,
79 struct key *session_keyring, enum umh_wait wait) 95 struct key *session_keyring, enum umh_wait wait)
80{ 96{
@@ -91,7 +107,7 @@ static int call_usermodehelper_keys(char *path, char **argv, char **envp,
91} 107}
92 108
93/* 109/*
94 * request userspace finish the construction of a key 110 * Request userspace finish the construction of a key
95 * - execute "/sbin/request-key <op> <key> <uid> <gid> <keyring> <keyring> <keyring>" 111 * - execute "/sbin/request-key <op> <key> <uid> <gid> <keyring> <keyring> <keyring>"
96 */ 112 */
97static int call_sbin_request_key(struct key_construction *cons, 113static int call_sbin_request_key(struct key_construction *cons,
@@ -198,8 +214,9 @@ error_alloc:
198} 214}
199 215
200/* 216/*
201 * call out to userspace for key construction 217 * Call out to userspace for key construction.
202 * - we ignore program failure and go on key status instead 218 *
219 * Program failure is ignored in favour of key status.
203 */ 220 */
204static int construct_key(struct key *key, const void *callout_info, 221static int construct_key(struct key *key, const void *callout_info,
205 size_t callout_len, void *aux, 222 size_t callout_len, void *aux,
@@ -246,9 +263,10 @@ static int construct_key(struct key *key, const void *callout_info,
246} 263}
247 264
248/* 265/*
249 * get the appropriate destination keyring for the request 266 * Get the appropriate destination keyring for the request.
250 * - we return whatever keyring we select with an extra reference upon it which 267 *
251 * the caller must release 268 * The keyring selected is returned with an extra reference upon it which the
269 * caller must release.
252 */ 270 */
253static void construct_get_dest_keyring(struct key **_dest_keyring) 271static void construct_get_dest_keyring(struct key **_dest_keyring)
254{ 272{
@@ -321,9 +339,11 @@ static void construct_get_dest_keyring(struct key **_dest_keyring)
321} 339}
322 340
323/* 341/*
324 * allocate a new key in under-construction state and attempt to link it in to 342 * Allocate a new key in under-construction state and attempt to link it in to
325 * the requested place 343 * the requested keyring.
326 * - may return a key that's already under construction instead 344 *
345 * May return a key that's already under construction instead if there was a
346 * race between two thread calling request_key().
327 */ 347 */
328static int construct_alloc_key(struct key_type *type, 348static int construct_alloc_key(struct key_type *type,
329 const char *description, 349 const char *description,
@@ -414,7 +434,7 @@ alloc_failed:
414} 434}
415 435
416/* 436/*
417 * commence key construction 437 * Commence key construction.
418 */ 438 */
419static struct key *construct_key_and_link(struct key_type *type, 439static struct key *construct_key_and_link(struct key_type *type,
420 const char *description, 440 const char *description,
@@ -465,12 +485,32 @@ construction_failed:
465 return ERR_PTR(ret); 485 return ERR_PTR(ret);
466} 486}
467 487
468/* 488/**
469 * request a key 489 * request_key_and_link - Request a key and cache it in a keyring.
470 * - search the process's keyrings 490 * @type: The type of key we want.
471 * - check the list of keys being created or updated 491 * @description: The searchable description of the key.
472 * - call out to userspace for a key if supplementary info was provided 492 * @callout_info: The data to pass to the instantiation upcall (or NULL).
473 * - cache the key in an appropriate keyring 493 * @callout_len: The length of callout_info.
494 * @aux: Auxiliary data for the upcall.
495 * @dest_keyring: Where to cache the key.
496 * @flags: Flags to key_alloc().
497 *
498 * A key matching the specified criteria is searched for in the process's
499 * keyrings and returned with its usage count incremented if found. Otherwise,
500 * if callout_info is not NULL, a key will be allocated and some service
501 * (probably in userspace) will be asked to instantiate it.
502 *
503 * If successfully found or created, the key will be linked to the destination
504 * keyring if one is provided.
505 *
506 * Returns a pointer to the key if successful; -EACCES, -ENOKEY, -EKEYREVOKED
507 * or -EKEYEXPIRED if an inaccessible, negative, revoked or expired key was
508 * found; -ENOKEY if no key was found and no @callout_info was given; -EDQUOT
509 * if insufficient key quota was available to create a new key; or -ENOMEM if
510 * insufficient memory was available.
511 *
512 * If the returned key was created, then it may still be under construction,
513 * and wait_for_key_construction() should be used to wait for that to complete.
474 */ 514 */
475struct key *request_key_and_link(struct key_type *type, 515struct key *request_key_and_link(struct key_type *type,
476 const char *description, 516 const char *description,
@@ -524,8 +564,16 @@ error:
524 return key; 564 return key;
525} 565}
526 566
527/* 567/**
528 * wait for construction of a key to complete 568 * wait_for_key_construction - Wait for construction of a key to complete
569 * @key: The key being waited for.
570 * @intr: Whether to wait interruptibly.
571 *
572 * Wait for a key to finish being constructed.
573 *
574 * Returns 0 if successful; -ERESTARTSYS if the wait was interrupted; -ENOKEY
575 * if the key was negated; or -EKEYREVOKED or -EKEYEXPIRED if the key was
576 * revoked or expired.
529 */ 577 */
530int wait_for_key_construction(struct key *key, bool intr) 578int wait_for_key_construction(struct key *key, bool intr)
531{ 579{
@@ -542,12 +590,19 @@ int wait_for_key_construction(struct key *key, bool intr)
542} 590}
543EXPORT_SYMBOL(wait_for_key_construction); 591EXPORT_SYMBOL(wait_for_key_construction);
544 592
545/* 593/**
546 * request a key 594 * request_key - Request a key and wait for construction
547 * - search the process's keyrings 595 * @type: Type of key.
548 * - check the list of keys being created or updated 596 * @description: The searchable description of the key.
549 * - call out to userspace for a key if supplementary info was provided 597 * @callout_info: The data to pass to the instantiation upcall (or NULL).
550 * - waits uninterruptible for creation to complete 598 *
599 * As for request_key_and_link() except that it does not add the returned key
600 * to a keyring if found, new keys are always allocated in the user's quota,
601 * the callout_info must be a NUL-terminated string and no auxiliary data can
602 * be passed.
603 *
604 * Furthermore, it then works as wait_for_key_construction() to wait for the
605 * completion of keys undergoing construction with a non-interruptible wait.
551 */ 606 */
552struct key *request_key(struct key_type *type, 607struct key *request_key(struct key_type *type,
553 const char *description, 608 const char *description,
@@ -572,12 +627,19 @@ struct key *request_key(struct key_type *type,
572} 627}
573EXPORT_SYMBOL(request_key); 628EXPORT_SYMBOL(request_key);
574 629
575/* 630/**
576 * request a key with auxiliary data for the upcaller 631 * request_key_with_auxdata - Request a key with auxiliary data for the upcaller
577 * - search the process's keyrings 632 * @type: The type of key we want.
578 * - check the list of keys being created or updated 633 * @description: The searchable description of the key.
579 * - call out to userspace for a key if supplementary info was provided 634 * @callout_info: The data to pass to the instantiation upcall (or NULL).
580 * - waits uninterruptible for creation to complete 635 * @callout_len: The length of callout_info.
636 * @aux: Auxiliary data for the upcall.
637 *
638 * As for request_key_and_link() except that it does not add the returned key
639 * to a keyring if found and new keys are always allocated in the user's quota.
640 *
641 * Furthermore, it then works as wait_for_key_construction() to wait for the
642 * completion of keys undergoing construction with a non-interruptible wait.
581 */ 643 */
582struct key *request_key_with_auxdata(struct key_type *type, 644struct key *request_key_with_auxdata(struct key_type *type,
583 const char *description, 645 const char *description,
@@ -602,10 +664,18 @@ struct key *request_key_with_auxdata(struct key_type *type,
602EXPORT_SYMBOL(request_key_with_auxdata); 664EXPORT_SYMBOL(request_key_with_auxdata);
603 665
604/* 666/*
605 * request a key (allow async construction) 667 * request_key_async - Request a key (allow async construction)
606 * - search the process's keyrings 668 * @type: Type of key.
607 * - check the list of keys being created or updated 669 * @description: The searchable description of the key.
608 * - call out to userspace for a key if supplementary info was provided 670 * @callout_info: The data to pass to the instantiation upcall (or NULL).
671 * @callout_len: The length of callout_info.
672 *
673 * As for request_key_and_link() except that it does not add the returned key
674 * to a keyring if found, new keys are always allocated in the user's quota and
675 * no auxiliary data can be passed.
676 *
677 * The caller should call wait_for_key_construction() to wait for the
678 * completion of the returned key if it is still undergoing construction.
609 */ 679 */
610struct key *request_key_async(struct key_type *type, 680struct key *request_key_async(struct key_type *type,
611 const char *description, 681 const char *description,
@@ -620,9 +690,17 @@ EXPORT_SYMBOL(request_key_async);
620 690
621/* 691/*
622 * request a key with auxiliary data for the upcaller (allow async construction) 692 * request a key with auxiliary data for the upcaller (allow async construction)
623 * - search the process's keyrings 693 * @type: Type of key.
624 * - check the list of keys being created or updated 694 * @description: The searchable description of the key.
625 * - call out to userspace for a key if supplementary info was provided 695 * @callout_info: The data to pass to the instantiation upcall (or NULL).
696 * @callout_len: The length of callout_info.
697 * @aux: Auxiliary data for the upcall.
698 *
699 * As for request_key_and_link() except that it does not add the returned key
700 * to a keyring if found and new keys are always allocated in the user's quota.
701 *
702 * The caller should call wait_for_key_construction() to wait for the
703 * completion of the returned key if it is still undergoing construction.
626 */ 704 */
627struct key *request_key_async_with_auxdata(struct key_type *type, 705struct key *request_key_async_with_auxdata(struct key_type *type,
628 const char *description, 706 const char *description,
diff --git a/security/keys/request_key_auth.c b/security/keys/request_key_auth.c
index 86747151ee5b..68164031a74e 100644
--- a/security/keys/request_key_auth.c
+++ b/security/keys/request_key_auth.c
@@ -1,4 +1,4 @@
1/* request_key_auth.c: request key authorisation controlling key def 1/* Request key authorisation token key definition.
2 * 2 *
3 * Copyright (C) 2005 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2005 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -26,7 +26,7 @@ static void request_key_auth_destroy(struct key *);
26static long request_key_auth_read(const struct key *, char __user *, size_t); 26static long request_key_auth_read(const struct key *, char __user *, size_t);
27 27
28/* 28/*
29 * the request-key authorisation key type definition 29 * The request-key authorisation key type definition.
30 */ 30 */
31struct key_type key_type_request_key_auth = { 31struct key_type key_type_request_key_auth = {
32 .name = ".request_key_auth", 32 .name = ".request_key_auth",
@@ -38,9 +38,8 @@ struct key_type key_type_request_key_auth = {
38 .read = request_key_auth_read, 38 .read = request_key_auth_read,
39}; 39};
40 40
41/*****************************************************************************/
42/* 41/*
43 * instantiate a request-key authorisation key 42 * Instantiate a request-key authorisation key.
44 */ 43 */
45static int request_key_auth_instantiate(struct key *key, 44static int request_key_auth_instantiate(struct key *key,
46 const void *data, 45 const void *data,
@@ -48,12 +47,10 @@ static int request_key_auth_instantiate(struct key *key,
48{ 47{
49 key->payload.data = (struct request_key_auth *) data; 48 key->payload.data = (struct request_key_auth *) data;
50 return 0; 49 return 0;
50}
51 51
52} /* end request_key_auth_instantiate() */
53
54/*****************************************************************************/
55/* 52/*
56 * reading a request-key authorisation key retrieves the callout information 53 * Describe an authorisation token.
57 */ 54 */
58static void request_key_auth_describe(const struct key *key, 55static void request_key_auth_describe(const struct key *key,
59 struct seq_file *m) 56 struct seq_file *m)
@@ -63,12 +60,10 @@ static void request_key_auth_describe(const struct key *key,
63 seq_puts(m, "key:"); 60 seq_puts(m, "key:");
64 seq_puts(m, key->description); 61 seq_puts(m, key->description);
65 seq_printf(m, " pid:%d ci:%zu", rka->pid, rka->callout_len); 62 seq_printf(m, " pid:%d ci:%zu", rka->pid, rka->callout_len);
63}
66 64
67} /* end request_key_auth_describe() */
68
69/*****************************************************************************/
70/* 65/*
71 * read the callout_info data 66 * Read the callout_info data (retrieves the callout information).
72 * - the key's semaphore is read-locked 67 * - the key's semaphore is read-locked
73 */ 68 */
74static long request_key_auth_read(const struct key *key, 69static long request_key_auth_read(const struct key *key,
@@ -91,13 +86,12 @@ static long request_key_auth_read(const struct key *key,
91 } 86 }
92 87
93 return ret; 88 return ret;
89}
94 90
95} /* end request_key_auth_read() */
96
97/*****************************************************************************/
98/* 91/*
99 * handle revocation of an authorisation token key 92 * Handle revocation of an authorisation token key.
100 * - called with the key sem write-locked 93 *
94 * Called with the key sem write-locked.
101 */ 95 */
102static void request_key_auth_revoke(struct key *key) 96static void request_key_auth_revoke(struct key *key)
103{ 97{
@@ -109,12 +103,10 @@ static void request_key_auth_revoke(struct key *key)
109 put_cred(rka->cred); 103 put_cred(rka->cred);
110 rka->cred = NULL; 104 rka->cred = NULL;
111 } 105 }
106}
112 107
113} /* end request_key_auth_revoke() */
114
115/*****************************************************************************/
116/* 108/*
117 * destroy an instantiation authorisation token key 109 * Destroy an instantiation authorisation token key.
118 */ 110 */
119static void request_key_auth_destroy(struct key *key) 111static void request_key_auth_destroy(struct key *key)
120{ 112{
@@ -131,13 +123,11 @@ static void request_key_auth_destroy(struct key *key)
131 key_put(rka->dest_keyring); 123 key_put(rka->dest_keyring);
132 kfree(rka->callout_info); 124 kfree(rka->callout_info);
133 kfree(rka); 125 kfree(rka);
126}
134 127
135} /* end request_key_auth_destroy() */
136
137/*****************************************************************************/
138/* 128/*
139 * create an authorisation token for /sbin/request-key or whoever to gain 129 * Create an authorisation token for /sbin/request-key or whoever to gain
140 * access to the caller's security data 130 * access to the caller's security data.
141 */ 131 */
142struct key *request_key_auth_new(struct key *target, const void *callout_info, 132struct key *request_key_auth_new(struct key *target, const void *callout_info,
143 size_t callout_len, struct key *dest_keyring) 133 size_t callout_len, struct key *dest_keyring)
@@ -228,12 +218,10 @@ error_alloc:
228 kfree(rka); 218 kfree(rka);
229 kleave("= %d", ret); 219 kleave("= %d", ret);
230 return ERR_PTR(ret); 220 return ERR_PTR(ret);
221}
231 222
232} /* end request_key_auth_new() */
233
234/*****************************************************************************/
235/* 223/*
236 * see if an authorisation key is associated with a particular key 224 * See if an authorisation key is associated with a particular key.
237 */ 225 */
238static int key_get_instantiation_authkey_match(const struct key *key, 226static int key_get_instantiation_authkey_match(const struct key *key,
239 const void *_id) 227 const void *_id)
@@ -242,16 +230,11 @@ static int key_get_instantiation_authkey_match(const struct key *key,
242 key_serial_t id = (key_serial_t)(unsigned long) _id; 230 key_serial_t id = (key_serial_t)(unsigned long) _id;
243 231
244 return rka->target_key->serial == id; 232 return rka->target_key->serial == id;
233}
245 234
246} /* end key_get_instantiation_authkey_match() */
247
248/*****************************************************************************/
249/* 235/*
250 * get the authorisation key for instantiation of a specific key if attached to 236 * Search the current process's keyrings for the authorisation key for
251 * the current process's keyrings 237 * instantiation of a key.
252 * - this key is inserted into a keyring and that is set as /sbin/request-key's
253 * session keyring
254 * - a target_id of zero specifies any valid token
255 */ 238 */
256struct key *key_get_instantiation_authkey(key_serial_t target_id) 239struct key *key_get_instantiation_authkey(key_serial_t target_id)
257{ 240{
@@ -278,5 +261,4 @@ struct key *key_get_instantiation_authkey(key_serial_t target_id)
278 261
279error: 262error:
280 return authkey; 263 return authkey;
281 264}
282} /* end key_get_instantiation_authkey() */
diff --git a/security/keys/trusted_defined.c b/security/keys/trusted_defined.c
index 975e9f29a52c..2836c6dc18a3 100644
--- a/security/keys/trusted_defined.c
+++ b/security/keys/trusted_defined.c
@@ -101,11 +101,13 @@ static int TSS_rawhmac(unsigned char *digest, const unsigned char *key,
101 if (dlen == 0) 101 if (dlen == 0)
102 break; 102 break;
103 data = va_arg(argp, unsigned char *); 103 data = va_arg(argp, unsigned char *);
104 if (data == NULL) 104 if (data == NULL) {
105 return -EINVAL; 105 ret = -EINVAL;
106 break;
107 }
106 ret = crypto_shash_update(&sdesc->shash, data, dlen); 108 ret = crypto_shash_update(&sdesc->shash, data, dlen);
107 if (ret < 0) 109 if (ret < 0)
108 goto out; 110 break;
109 } 111 }
110 va_end(argp); 112 va_end(argp);
111 if (!ret) 113 if (!ret)
@@ -146,14 +148,17 @@ static int TSS_authhmac(unsigned char *digest, const unsigned char *key,
146 if (dlen == 0) 148 if (dlen == 0)
147 break; 149 break;
148 data = va_arg(argp, unsigned char *); 150 data = va_arg(argp, unsigned char *);
149 ret = crypto_shash_update(&sdesc->shash, data, dlen); 151 if (!data) {
150 if (ret < 0) { 152 ret = -EINVAL;
151 va_end(argp); 153 break;
152 goto out;
153 } 154 }
155 ret = crypto_shash_update(&sdesc->shash, data, dlen);
156 if (ret < 0)
157 break;
154 } 158 }
155 va_end(argp); 159 va_end(argp);
156 ret = crypto_shash_final(&sdesc->shash, paramdigest); 160 if (!ret)
161 ret = crypto_shash_final(&sdesc->shash, paramdigest);
157 if (!ret) 162 if (!ret)
158 ret = TSS_rawhmac(digest, key, keylen, SHA1_DIGEST_SIZE, 163 ret = TSS_rawhmac(digest, key, keylen, SHA1_DIGEST_SIZE,
159 paramdigest, TPM_NONCE_SIZE, h1, 164 paramdigest, TPM_NONCE_SIZE, h1,
@@ -222,13 +227,12 @@ static int TSS_checkhmac1(unsigned char *buffer,
222 break; 227 break;
223 dpos = va_arg(argp, unsigned int); 228 dpos = va_arg(argp, unsigned int);
224 ret = crypto_shash_update(&sdesc->shash, buffer + dpos, dlen); 229 ret = crypto_shash_update(&sdesc->shash, buffer + dpos, dlen);
225 if (ret < 0) { 230 if (ret < 0)
226 va_end(argp); 231 break;
227 goto out;
228 }
229 } 232 }
230 va_end(argp); 233 va_end(argp);
231 ret = crypto_shash_final(&sdesc->shash, paramdigest); 234 if (!ret)
235 ret = crypto_shash_final(&sdesc->shash, paramdigest);
232 if (ret < 0) 236 if (ret < 0)
233 goto out; 237 goto out;
234 238
@@ -316,13 +320,12 @@ static int TSS_checkhmac2(unsigned char *buffer,
316 break; 320 break;
317 dpos = va_arg(argp, unsigned int); 321 dpos = va_arg(argp, unsigned int);
318 ret = crypto_shash_update(&sdesc->shash, buffer + dpos, dlen); 322 ret = crypto_shash_update(&sdesc->shash, buffer + dpos, dlen);
319 if (ret < 0) { 323 if (ret < 0)
320 va_end(argp); 324 break;
321 goto out;
322 }
323 } 325 }
324 va_end(argp); 326 va_end(argp);
325 ret = crypto_shash_final(&sdesc->shash, paramdigest); 327 if (!ret)
328 ret = crypto_shash_final(&sdesc->shash, paramdigest);
326 if (ret < 0) 329 if (ret < 0)
327 goto out; 330 goto out;
328 331
@@ -511,7 +514,7 @@ static int tpm_seal(struct tpm_buf *tb, uint16_t keytype,
511 /* get session for sealing key */ 514 /* get session for sealing key */
512 ret = osap(tb, &sess, keyauth, keytype, keyhandle); 515 ret = osap(tb, &sess, keyauth, keytype, keyhandle);
513 if (ret < 0) 516 if (ret < 0)
514 return ret; 517 goto out;
515 dump_sess(&sess); 518 dump_sess(&sess);
516 519
517 /* calculate encrypted authorization value */ 520 /* calculate encrypted authorization value */
@@ -519,11 +522,11 @@ static int tpm_seal(struct tpm_buf *tb, uint16_t keytype,
519 memcpy(td->xorwork + SHA1_DIGEST_SIZE, sess.enonce, SHA1_DIGEST_SIZE); 522 memcpy(td->xorwork + SHA1_DIGEST_SIZE, sess.enonce, SHA1_DIGEST_SIZE);
520 ret = TSS_sha1(td->xorwork, SHA1_DIGEST_SIZE * 2, td->xorhash); 523 ret = TSS_sha1(td->xorwork, SHA1_DIGEST_SIZE * 2, td->xorhash);
521 if (ret < 0) 524 if (ret < 0)
522 return ret; 525 goto out;
523 526
524 ret = tpm_get_random(tb, td->nonceodd, TPM_NONCE_SIZE); 527 ret = tpm_get_random(tb, td->nonceodd, TPM_NONCE_SIZE);
525 if (ret < 0) 528 if (ret < 0)
526 return ret; 529 goto out;
527 ordinal = htonl(TPM_ORD_SEAL); 530 ordinal = htonl(TPM_ORD_SEAL);
528 datsize = htonl(datalen); 531 datsize = htonl(datalen);
529 pcrsize = htonl(pcrinfosize); 532 pcrsize = htonl(pcrinfosize);
@@ -552,7 +555,7 @@ static int tpm_seal(struct tpm_buf *tb, uint16_t keytype,
552 &datsize, datalen, data, 0, 0); 555 &datsize, datalen, data, 0, 0);
553 } 556 }
554 if (ret < 0) 557 if (ret < 0)
555 return ret; 558 goto out;
556 559
557 /* build and send the TPM request packet */ 560 /* build and send the TPM request packet */
558 INIT_BUF(tb); 561 INIT_BUF(tb);
@@ -572,7 +575,7 @@ static int tpm_seal(struct tpm_buf *tb, uint16_t keytype,
572 575
573 ret = trusted_tpm_send(TPM_ANY_NUM, tb->data, MAX_BUF_SIZE); 576 ret = trusted_tpm_send(TPM_ANY_NUM, tb->data, MAX_BUF_SIZE);
574 if (ret < 0) 577 if (ret < 0)
575 return ret; 578 goto out;
576 579
577 /* calculate the size of the returned Blob */ 580 /* calculate the size of the returned Blob */
578 sealinfosize = LOAD32(tb->data, TPM_DATA_OFFSET + sizeof(uint32_t)); 581 sealinfosize = LOAD32(tb->data, TPM_DATA_OFFSET + sizeof(uint32_t));
@@ -591,6 +594,8 @@ static int tpm_seal(struct tpm_buf *tb, uint16_t keytype,
591 memcpy(blob, tb->data + TPM_DATA_OFFSET, storedsize); 594 memcpy(blob, tb->data + TPM_DATA_OFFSET, storedsize);
592 *bloblen = storedsize; 595 *bloblen = storedsize;
593 } 596 }
597out:
598 kfree(td);
594 return ret; 599 return ret;
595} 600}
596 601
diff --git a/security/keys/user_defined.c b/security/keys/user_defined.c
index e9aa07929656..02807fb16340 100644
--- a/security/keys/user_defined.c
+++ b/security/keys/user_defined.c
@@ -35,7 +35,6 @@ struct key_type key_type_user = {
35 35
36EXPORT_SYMBOL_GPL(key_type_user); 36EXPORT_SYMBOL_GPL(key_type_user);
37 37
38/*****************************************************************************/
39/* 38/*
40 * instantiate a user defined key 39 * instantiate a user defined key
41 */ 40 */
@@ -65,12 +64,10 @@ int user_instantiate(struct key *key, const void *data, size_t datalen)
65 64
66error: 65error:
67 return ret; 66 return ret;
68 67}
69} /* end user_instantiate() */
70 68
71EXPORT_SYMBOL_GPL(user_instantiate); 69EXPORT_SYMBOL_GPL(user_instantiate);
72 70
73/*****************************************************************************/
74/* 71/*
75 * dispose of the old data from an updated user defined key 72 * dispose of the old data from an updated user defined key
76 */ 73 */
@@ -81,10 +78,8 @@ static void user_update_rcu_disposal(struct rcu_head *rcu)
81 upayload = container_of(rcu, struct user_key_payload, rcu); 78 upayload = container_of(rcu, struct user_key_payload, rcu);
82 79
83 kfree(upayload); 80 kfree(upayload);
81}
84 82
85} /* end user_update_rcu_disposal() */
86
87/*****************************************************************************/
88/* 83/*
89 * update a user defined key 84 * update a user defined key
90 * - the key's semaphore is write-locked 85 * - the key's semaphore is write-locked
@@ -123,24 +118,20 @@ int user_update(struct key *key, const void *data, size_t datalen)
123 118
124error: 119error:
125 return ret; 120 return ret;
126 121}
127} /* end user_update() */
128 122
129EXPORT_SYMBOL_GPL(user_update); 123EXPORT_SYMBOL_GPL(user_update);
130 124
131/*****************************************************************************/
132/* 125/*
133 * match users on their name 126 * match users on their name
134 */ 127 */
135int user_match(const struct key *key, const void *description) 128int user_match(const struct key *key, const void *description)
136{ 129{
137 return strcmp(key->description, description) == 0; 130 return strcmp(key->description, description) == 0;
138 131}
139} /* end user_match() */
140 132
141EXPORT_SYMBOL_GPL(user_match); 133EXPORT_SYMBOL_GPL(user_match);
142 134
143/*****************************************************************************/
144/* 135/*
145 * dispose of the links from a revoked keyring 136 * dispose of the links from a revoked keyring
146 * - called with the key sem write-locked 137 * - called with the key sem write-locked
@@ -156,12 +147,10 @@ void user_revoke(struct key *key)
156 rcu_assign_pointer(key->payload.data, NULL); 147 rcu_assign_pointer(key->payload.data, NULL);
157 call_rcu(&upayload->rcu, user_update_rcu_disposal); 148 call_rcu(&upayload->rcu, user_update_rcu_disposal);
158 } 149 }
159 150}
160} /* end user_revoke() */
161 151
162EXPORT_SYMBOL(user_revoke); 152EXPORT_SYMBOL(user_revoke);
163 153
164/*****************************************************************************/
165/* 154/*
166 * dispose of the data dangling from the corpse of a user key 155 * dispose of the data dangling from the corpse of a user key
167 */ 156 */
@@ -170,12 +159,10 @@ void user_destroy(struct key *key)
170 struct user_key_payload *upayload = key->payload.data; 159 struct user_key_payload *upayload = key->payload.data;
171 160
172 kfree(upayload); 161 kfree(upayload);
173 162}
174} /* end user_destroy() */
175 163
176EXPORT_SYMBOL_GPL(user_destroy); 164EXPORT_SYMBOL_GPL(user_destroy);
177 165
178/*****************************************************************************/
179/* 166/*
180 * describe the user key 167 * describe the user key
181 */ 168 */
@@ -184,12 +171,10 @@ void user_describe(const struct key *key, struct seq_file *m)
184 seq_puts(m, key->description); 171 seq_puts(m, key->description);
185 172
186 seq_printf(m, ": %u", key->datalen); 173 seq_printf(m, ": %u", key->datalen);
187 174}
188} /* end user_describe() */
189 175
190EXPORT_SYMBOL_GPL(user_describe); 176EXPORT_SYMBOL_GPL(user_describe);
191 177
192/*****************************************************************************/
193/* 178/*
194 * read the key data 179 * read the key data
195 * - the key's semaphore is read-locked 180 * - the key's semaphore is read-locked
@@ -213,7 +198,6 @@ long user_read(const struct key *key, char __user *buffer, size_t buflen)
213 } 198 }
214 199
215 return ret; 200 return ret;
216 201}
217} /* end user_read() */
218 202
219EXPORT_SYMBOL_GPL(user_read); 203EXPORT_SYMBOL_GPL(user_read);
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 269dbff70b92..be4df4c6fd56 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1721,7 +1721,9 @@ static void alc_apply_fixup(struct hda_codec *codec, int action)
1721{ 1721{
1722 struct alc_spec *spec = codec->spec; 1722 struct alc_spec *spec = codec->spec;
1723 int id = spec->fixup_id; 1723 int id = spec->fixup_id;
1724#ifdef CONFIG_SND_DEBUG_VERBOSE
1724 const char *modelname = spec->fixup_name; 1725 const char *modelname = spec->fixup_name;
1726#endif
1725 int depth = 0; 1727 int depth = 0;
1726 1728
1727 if (!spec->fixup_list) 1729 if (!spec->fixup_list)
@@ -10930,9 +10932,6 @@ static int alc_auto_add_mic_boost(struct hda_codec *codec)
10930 return 0; 10932 return 0;
10931} 10933}
10932 10934
10933static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
10934 const struct auto_pin_cfg *cfg);
10935
10936/* almost identical with ALC880 parser... */ 10935/* almost identical with ALC880 parser... */
10937static int alc882_parse_auto_config(struct hda_codec *codec) 10936static int alc882_parse_auto_config(struct hda_codec *codec)
10938{ 10937{
@@ -10950,10 +10949,7 @@ static int alc882_parse_auto_config(struct hda_codec *codec)
10950 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); 10949 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10951 if (err < 0) 10950 if (err < 0)
10952 return err; 10951 return err;
10953 if (codec->vendor_id == 0x10ec0887) 10952 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10954 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
10955 else
10956 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10957 if (err < 0) 10953 if (err < 0)
10958 return err; 10954 return err;
10959 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], 10955 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
@@ -12635,6 +12631,8 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = {
12635 ALC262_HP_BPC), 12631 ALC262_HP_BPC),
12636 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", 12632 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12637 ALC262_HP_BPC), 12633 ALC262_HP_BPC),
12634 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1500, "HP z series",
12635 ALC262_HP_BPC),
12638 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", 12636 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12639 ALC262_HP_BPC), 12637 ALC262_HP_BPC),
12640 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), 12638 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
@@ -14957,6 +14955,7 @@ static struct snd_pci_quirk alc269_fixup_tbl[] = {
14957 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), 14955 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14958 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), 14956 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
14959 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), 14957 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
14958 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
14960 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), 14959 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
14961 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), 14960 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
14962 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), 14961 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
@@ -17134,7 +17133,7 @@ static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
17134#define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) 17133#define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
17135 17134
17136/* add playback controls from the parsed DAC table */ 17135/* add playback controls from the parsed DAC table */
17137/* Based on ALC880 version. But ALC861VD and ALC887 have separate, 17136/* Based on ALC880 version. But ALC861VD has separate,
17138 * different NIDs for mute/unmute switch and volume control */ 17137 * different NIDs for mute/unmute switch and volume control */
17139static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, 17138static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
17140 const struct auto_pin_cfg *cfg) 17139 const struct auto_pin_cfg *cfg)
@@ -19461,6 +19460,7 @@ enum {
19461 ALC662_FIXUP_ASPIRE, 19460 ALC662_FIXUP_ASPIRE,
19462 ALC662_FIXUP_IDEAPAD, 19461 ALC662_FIXUP_IDEAPAD,
19463 ALC272_FIXUP_MARIO, 19462 ALC272_FIXUP_MARIO,
19463 ALC662_FIXUP_CZC_P10T,
19464}; 19464};
19465 19465
19466static const struct alc_fixup alc662_fixups[] = { 19466static const struct alc_fixup alc662_fixups[] = {
@@ -19481,7 +19481,14 @@ static const struct alc_fixup alc662_fixups[] = {
19481 [ALC272_FIXUP_MARIO] = { 19481 [ALC272_FIXUP_MARIO] = {
19482 .type = ALC_FIXUP_FUNC, 19482 .type = ALC_FIXUP_FUNC,
19483 .v.func = alc272_fixup_mario, 19483 .v.func = alc272_fixup_mario,
19484 } 19484 },
19485 [ALC662_FIXUP_CZC_P10T] = {
19486 .type = ALC_FIXUP_VERBS,
19487 .v.verbs = (const struct hda_verb[]) {
19488 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
19489 {}
19490 }
19491 },
19485}; 19492};
19486 19493
19487static struct snd_pci_quirk alc662_fixup_tbl[] = { 19494static struct snd_pci_quirk alc662_fixup_tbl[] = {
@@ -19489,6 +19496,7 @@ static struct snd_pci_quirk alc662_fixup_tbl[] = {
19489 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), 19496 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
19490 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), 19497 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
19491 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), 19498 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
19499 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
19492 {} 19500 {}
19493}; 19501};
19494 19502
diff --git a/sound/pci/ice1712/delta.c b/sound/pci/ice1712/delta.c
index 7b62de089fee..20c6b079d0df 100644
--- a/sound/pci/ice1712/delta.c
+++ b/sound/pci/ice1712/delta.c
@@ -580,6 +580,7 @@ static int __devinit snd_ice1712_delta_init(struct snd_ice1712 *ice)
580{ 580{
581 int err; 581 int err;
582 struct snd_akm4xxx *ak; 582 struct snd_akm4xxx *ak;
583 unsigned char tmp;
583 584
584 if (ice->eeprom.subvendor == ICE1712_SUBDEVICE_DELTA1010 && 585 if (ice->eeprom.subvendor == ICE1712_SUBDEVICE_DELTA1010 &&
585 ice->eeprom.gpiodir == 0x7b) 586 ice->eeprom.gpiodir == 0x7b)
@@ -622,6 +623,12 @@ static int __devinit snd_ice1712_delta_init(struct snd_ice1712 *ice)
622 break; 623 break;
623 } 624 }
624 625
626 /* initialize the SPI clock to high */
627 tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA);
628 tmp |= ICE1712_DELTA_AP_CCLK;
629 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
630 udelay(5);
631
625 /* initialize spdif */ 632 /* initialize spdif */
626 switch (ice->eeprom.subvendor) { 633 switch (ice->eeprom.subvendor) {
627 case ICE1712_SUBDEVICE_AUDIOPHILE: 634 case ICE1712_SUBDEVICE_AUDIOPHILE:
diff --git a/sound/soc/blackfin/Kconfig b/sound/soc/blackfin/Kconfig
index 3abeeddc67d3..ae403597fd31 100644
--- a/sound/soc/blackfin/Kconfig
+++ b/sound/soc/blackfin/Kconfig
@@ -1,6 +1,7 @@
1config SND_BF5XX_I2S 1config SND_BF5XX_I2S
2 tristate "SoC I2S Audio for the ADI BF5xx chip" 2 tristate "SoC I2S Audio for the ADI BF5xx chip"
3 depends on BLACKFIN 3 depends on BLACKFIN
4 select SND_BF5XX_SOC_SPORT
4 help 5 help
5 Say Y or M if you want to add support for codecs attached to 6 Say Y or M if you want to add support for codecs attached to
6 the Blackfin SPORT (synchronous serial ports) interface in I2S 7 the Blackfin SPORT (synchronous serial ports) interface in I2S
@@ -35,6 +36,7 @@ config SND_BFIN_AD73311_SE
35config SND_BF5XX_TDM 36config SND_BF5XX_TDM
36 tristate "SoC I2S(TDM mode) Audio for the ADI BF5xx chip" 37 tristate "SoC I2S(TDM mode) Audio for the ADI BF5xx chip"
37 depends on (BLACKFIN && SND_SOC) 38 depends on (BLACKFIN && SND_SOC)
39 select SND_BF5XX_SOC_SPORT
38 help 40 help
39 Say Y or M if you want to add support for codecs attached to 41 Say Y or M if you want to add support for codecs attached to
40 the Blackfin SPORT (synchronous serial ports) interface in TDM 42 the Blackfin SPORT (synchronous serial ports) interface in TDM
@@ -61,6 +63,10 @@ config SND_BF5XX_SOC_AD193X
61config SND_BF5XX_AC97 63config SND_BF5XX_AC97
62 tristate "SoC AC97 Audio for the ADI BF5xx chip" 64 tristate "SoC AC97 Audio for the ADI BF5xx chip"
63 depends on BLACKFIN 65 depends on BLACKFIN
66 select AC97_BUS
67 select SND_SOC_AC97_BUS
68 select SND_BF5XX_SOC_SPORT
69 select SND_BF5XX_SOC_AC97
64 help 70 help
65 Say Y or M if you want to add support for codecs attached to 71 Say Y or M if you want to add support for codecs attached to
66 the Blackfin SPORT (synchronous serial ports) interface in slot 16 72 the Blackfin SPORT (synchronous serial ports) interface in slot 16
@@ -122,17 +128,12 @@ config SND_BF5XX_SOC_SPORT
122 128
123config SND_BF5XX_SOC_I2S 129config SND_BF5XX_SOC_I2S
124 tristate 130 tristate
125 select SND_BF5XX_SOC_SPORT
126 131
127config SND_BF5XX_SOC_TDM 132config SND_BF5XX_SOC_TDM
128 tristate 133 tristate
129 select SND_BF5XX_SOC_SPORT
130 134
131config SND_BF5XX_SOC_AC97 135config SND_BF5XX_SOC_AC97
132 tristate 136 tristate
133 select AC97_BUS
134 select SND_SOC_AC97_BUS
135 select SND_BF5XX_SOC_SPORT
136 137
137config SND_BF5XX_SPORT_NUM 138config SND_BF5XX_SPORT_NUM
138 int "Set a SPORT for Sound chip" 139 int "Set a SPORT for Sound chip"
diff --git a/sound/soc/blackfin/bf5xx-ac97.c b/sound/soc/blackfin/bf5xx-ac97.c
index c5f856ec27ca..ffbac26b9bce 100644
--- a/sound/soc/blackfin/bf5xx-ac97.c
+++ b/sound/soc/blackfin/bf5xx-ac97.c
@@ -260,9 +260,9 @@ static int bf5xx_ac97_suspend(struct snd_soc_dai *dai)
260 pr_debug("%s : sport %d\n", __func__, dai->id); 260 pr_debug("%s : sport %d\n", __func__, dai->id);
261 if (!dai->active) 261 if (!dai->active)
262 return 0; 262 return 0;
263 if (dai->capture.active) 263 if (dai->capture_active)
264 sport_rx_stop(sport); 264 sport_rx_stop(sport);
265 if (dai->playback.active) 265 if (dai->playback_active)
266 sport_tx_stop(sport); 266 sport_tx_stop(sport);
267 return 0; 267 return 0;
268} 268}
diff --git a/sound/soc/blackfin/bf5xx-tdm.c b/sound/soc/blackfin/bf5xx-tdm.c
index 125123929f16..5515ac9e05c7 100644
--- a/sound/soc/blackfin/bf5xx-tdm.c
+++ b/sound/soc/blackfin/bf5xx-tdm.c
@@ -210,7 +210,7 @@ static int bf5xx_tdm_set_channel_map(struct snd_soc_dai *dai,
210#ifdef CONFIG_PM 210#ifdef CONFIG_PM
211static int bf5xx_tdm_suspend(struct snd_soc_dai *dai) 211static int bf5xx_tdm_suspend(struct snd_soc_dai *dai)
212{ 212{
213 struct sport_device *sport = dai->private_data; 213 struct sport_device *sport = snd_soc_dai_get_drvdata(dai);
214 214
215 if (!dai->active) 215 if (!dai->active)
216 return 0; 216 return 0;
@@ -235,13 +235,13 @@ static int bf5xx_tdm_resume(struct snd_soc_dai *dai)
235 ret = -EBUSY; 235 ret = -EBUSY;
236 } 236 }
237 237
238 ret = sport_config_rx(sport, IRFS, 0x1F, 0, 0); 238 ret = sport_config_rx(sport, 0, 0x1F, 0, 0);
239 if (ret) { 239 if (ret) {
240 pr_err("SPORT is busy!\n"); 240 pr_err("SPORT is busy!\n");
241 ret = -EBUSY; 241 ret = -EBUSY;
242 } 242 }
243 243
244 ret = sport_config_tx(sport, ITFS, 0x1F, 0, 0); 244 ret = sport_config_tx(sport, 0, 0x1F, 0, 0);
245 if (ret) { 245 if (ret) {
246 pr_err("SPORT is busy!\n"); 246 pr_err("SPORT is busy!\n");
247 ret = -EBUSY; 247 ret = -EBUSY;
@@ -303,14 +303,14 @@ static int __devinit bfin_tdm_probe(struct platform_device *pdev)
303 goto sport_config_err; 303 goto sport_config_err;
304 } 304 }
305 305
306 ret = sport_config_rx(sport_handle, IRFS, 0x1F, 0, 0); 306 ret = sport_config_rx(sport_handle, 0, 0x1F, 0, 0);
307 if (ret) { 307 if (ret) {
308 pr_err("SPORT is busy!\n"); 308 pr_err("SPORT is busy!\n");
309 ret = -EBUSY; 309 ret = -EBUSY;
310 goto sport_config_err; 310 goto sport_config_err;
311 } 311 }
312 312
313 ret = sport_config_tx(sport_handle, ITFS, 0x1F, 0, 0); 313 ret = sport_config_tx(sport_handle, 0, 0x1F, 0, 0);
314 if (ret) { 314 if (ret) {
315 pr_err("SPORT is busy!\n"); 315 pr_err("SPORT is busy!\n");
316 ret = -EBUSY; 316 ret = -EBUSY;
diff --git a/sound/soc/pxa/z2.c b/sound/soc/pxa/z2.c
index 2d4f896d7fec..3ceaef68e01d 100644
--- a/sound/soc/pxa/z2.c
+++ b/sound/soc/pxa/z2.c
@@ -104,6 +104,7 @@ static struct snd_soc_jack_gpio hs_jack_gpios[] = {
104 .name = "hsdet-gpio", 104 .name = "hsdet-gpio",
105 .report = SND_JACK_HEADSET, 105 .report = SND_JACK_HEADSET,
106 .debounce_time = 200, 106 .debounce_time = 200,
107 .invert = 1,
107 }, 108 },
108}; 109};
109 110
@@ -192,7 +193,7 @@ static struct snd_soc_dai_link z2_dai = {
192 .cpu_dai_name = "pxa2xx-i2s", 193 .cpu_dai_name = "pxa2xx-i2s",
193 .codec_dai_name = "wm8750-hifi", 194 .codec_dai_name = "wm8750-hifi",
194 .platform_name = "pxa-pcm-audio", 195 .platform_name = "pxa-pcm-audio",
195 .codec_name = "wm8750-codec.0-001a", 196 .codec_name = "wm8750-codec.0-001b",
196 .init = z2_wm8750_init, 197 .init = z2_wm8750_init,
197 .ops = &z2_ops, 198 .ops = &z2_ops,
198}; 199};
diff --git a/usr/Kconfig b/usr/Kconfig
index 4780deac5974..65b845bd4e3e 100644
--- a/usr/Kconfig
+++ b/usr/Kconfig
@@ -46,7 +46,7 @@ config INITRAMFS_ROOT_GID
46 If you are not sure, leave it set to "0". 46 If you are not sure, leave it set to "0".
47 47
48config RD_GZIP 48config RD_GZIP
49 bool "Support initial ramdisks compressed using gzip" if EMBEDDED 49 bool "Support initial ramdisks compressed using gzip" if EXPERT
50 default y 50 default y
51 depends on BLK_DEV_INITRD 51 depends on BLK_DEV_INITRD
52 select DECOMPRESS_GZIP 52 select DECOMPRESS_GZIP
@@ -55,8 +55,8 @@ config RD_GZIP
55 If unsure, say Y. 55 If unsure, say Y.
56 56
57config RD_BZIP2 57config RD_BZIP2
58 bool "Support initial ramdisks compressed using bzip2" if EMBEDDED 58 bool "Support initial ramdisks compressed using bzip2" if EXPERT
59 default !EMBEDDED 59 default !EXPERT
60 depends on BLK_DEV_INITRD 60 depends on BLK_DEV_INITRD
61 select DECOMPRESS_BZIP2 61 select DECOMPRESS_BZIP2
62 help 62 help
@@ -64,8 +64,8 @@ config RD_BZIP2
64 If unsure, say N. 64 If unsure, say N.
65 65
66config RD_LZMA 66config RD_LZMA
67 bool "Support initial ramdisks compressed using LZMA" if EMBEDDED 67 bool "Support initial ramdisks compressed using LZMA" if EXPERT
68 default !EMBEDDED 68 default !EXPERT
69 depends on BLK_DEV_INITRD 69 depends on BLK_DEV_INITRD
70 select DECOMPRESS_LZMA 70 select DECOMPRESS_LZMA
71 help 71 help
@@ -73,8 +73,8 @@ config RD_LZMA
73 If unsure, say N. 73 If unsure, say N.
74 74
75config RD_XZ 75config RD_XZ
76 bool "Support initial ramdisks compressed using XZ" if EMBEDDED 76 bool "Support initial ramdisks compressed using XZ" if EXPERT
77 default !EMBEDDED 77 default !EXPERT
78 depends on BLK_DEV_INITRD 78 depends on BLK_DEV_INITRD
79 select DECOMPRESS_XZ 79 select DECOMPRESS_XZ
80 help 80 help
@@ -82,8 +82,8 @@ config RD_XZ
82 If unsure, say N. 82 If unsure, say N.
83 83
84config RD_LZO 84config RD_LZO
85 bool "Support initial ramdisks compressed using LZO" if EMBEDDED 85 bool "Support initial ramdisks compressed using LZO" if EXPERT
86 default !EMBEDDED 86 default !EXPERT
87 depends on BLK_DEV_INITRD 87 depends on BLK_DEV_INITRD
88 select DECOMPRESS_LZO 88 select DECOMPRESS_LZO
89 help 89 help