aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/DocBook/media/v4l/driver.xml6
-rw-r--r--Documentation/PCI/pci-iov-howto.txt6
-rw-r--r--Documentation/PCI/pci.txt20
-rw-r--r--Documentation/acpi/enumeration.txt2
-rw-r--r--Documentation/device-mapper/dm-raid.txt1
-rw-r--r--Documentation/devicetree/bindings/clock/imx23-clock.txt5
-rw-r--r--Documentation/devicetree/bindings/clock/imx25-clock.txt4
-rw-r--r--Documentation/devicetree/bindings/clock/imx28-clock.txt5
-rw-r--r--Documentation/devicetree/bindings/clock/imx6q-clock.txt4
-rw-r--r--Documentation/devicetree/bindings/gpio/gpio-poweroff.txt20
-rw-r--r--Documentation/devicetree/bindings/pinctrl/atmel,at91-pinctrl.txt5
-rw-r--r--Documentation/devicetree/bindings/pinctrl/pinctrl-sirf.txt47
-rw-r--r--Documentation/devicetree/bindings/watchdog/twl4030-wdt.txt10
-rw-r--r--Documentation/filesystems/f2fs.txt18
-rw-r--r--[-rwxr-xr-x]Documentation/hid/hid-sensor.txt0
-rw-r--r--Documentation/i2c/instantiating-devices2
-rw-r--r--Documentation/networking/ip-sysctl.txt16
-rw-r--r--Documentation/power/runtime_pm.txt9
-rw-r--r--Documentation/rpmsg.txt4
-rw-r--r--Documentation/spi/spi-summary4
-rw-r--r--Documentation/sysctl/kernel.txt32
-rw-r--r--Documentation/video4linux/v4l2-framework.txt3
-rw-r--r--Documentation/x86/boot.txt27
-rw-r--r--Documentation/x86/zero-page.txt4
-rw-r--r--Documentation/zh_CN/video4linux/v4l2-framework.txt3
-rw-r--r--MAINTAINERS268
-rw-r--r--Makefile6
-rw-r--r--arch/alpha/include/asm/parport.h4
-rw-r--r--arch/alpha/kernel/pci.c12
-rw-r--r--arch/alpha/kernel/smp.c6
-rw-r--r--arch/alpha/kernel/sys_titan.c2
-rw-r--r--arch/arm/Kconfig7
-rw-r--r--arch/arm/boot/dts/Makefile1
-rw-r--r--arch/arm/boot/dts/armada-370-db.dts2
-rw-r--r--arch/arm/boot/dts/armada-370-xp.dtsi6
-rw-r--r--arch/arm/boot/dts/armada-xp-mv78230.dtsi23
-rw-r--r--arch/arm/boot/dts/armada-xp-mv78260.dtsi29
-rw-r--r--arch/arm/boot/dts/armada-xp-mv78460.dtsi29
-rw-r--r--arch/arm/boot/dts/armada-xp.dtsi14
-rw-r--r--arch/arm/boot/dts/at91rm9200.dtsi4
-rw-r--r--arch/arm/boot/dts/at91sam9260.dtsi18
-rw-r--r--arch/arm/boot/dts/at91sam9263.dtsi36
-rw-r--r--arch/arm/boot/dts/at91sam9g45.dtsi36
-rw-r--r--arch/arm/boot/dts/at91sam9n12.dtsi26
-rw-r--r--arch/arm/boot/dts/at91sam9x5.dtsi92
-rw-r--r--arch/arm/boot/dts/cros5250-common.dtsi12
-rw-r--r--arch/arm/boot/dts/dbx5x0.dtsi4
-rw-r--r--arch/arm/boot/dts/dove-cubox.dts14
-rw-r--r--arch/arm/boot/dts/dove.dtsi1
-rw-r--r--arch/arm/boot/dts/ecx-2000.dts4
-rw-r--r--arch/arm/boot/dts/exynos4210-smdkv310.dts2
-rw-r--r--arch/arm/boot/dts/exynos5250-smdk5250.dts8
-rw-r--r--arch/arm/boot/dts/exynos5250.dtsi2
-rw-r--r--arch/arm/boot/dts/exynos5440-ssdk5440.dts2
-rw-r--r--arch/arm/boot/dts/highbank.dts20
-rw-r--r--arch/arm/boot/dts/imx23-olinuxino.dts8
-rw-r--r--arch/arm/boot/dts/imx31-bug.dts2
-rw-r--r--arch/arm/boot/dts/imx53.dtsi2
-rw-r--r--arch/arm/boot/dts/kirkwood-6282.dtsi1
-rw-r--r--arch/arm/boot/dts/kirkwood-ns2-common.dtsi16
-rw-r--r--arch/arm/boot/dts/kirkwood-topkick.dts17
-rw-r--r--arch/arm/boot/dts/kirkwood.dtsi3
-rw-r--r--arch/arm/boot/dts/kizbox.dts2
-rw-r--r--arch/arm/boot/dts/sunxi.dtsi6
-rw-r--r--arch/arm/boot/dts/twl4030.dtsi4
-rw-r--r--arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts2
-rw-r--r--arch/arm/common/sa1111.c5
-rw-r--r--arch/arm/common/scoop.c6
-rw-r--r--arch/arm/common/vic.c9
-rw-r--r--arch/arm/configs/at91_dt_defconfig3
-rw-r--r--arch/arm/configs/multi_v7_defconfig1
-rw-r--r--arch/arm/configs/mvebu_defconfig4
-rw-r--r--arch/arm/configs/omap2plus_defconfig5
-rw-r--r--arch/arm/kernel/bios32.c18
-rw-r--r--arch/arm/kernel/debug.S2
-rw-r--r--arch/arm/kernel/etm.c4
-rw-r--r--arch/arm/kernel/head.S5
-rw-r--r--arch/arm/kernel/hyp-stub.S18
-rw-r--r--arch/arm/kernel/perf_event_cpu.c10
-rw-r--r--arch/arm/kernel/perf_event_v6.c4
-rw-r--r--arch/arm/kernel/perf_event_v7.c12
-rw-r--r--arch/arm/kernel/perf_event_xscale.c4
-rw-r--r--arch/arm/mach-at91/setup.c2
-rw-r--r--arch/arm/mach-davinci/board-dm646x-evm.c2
-rw-r--r--arch/arm/mach-davinci/cdce949.c4
-rw-r--r--arch/arm/mach-dove/pcie.c2
-rw-r--r--arch/arm/mach-exynos/Kconfig2
-rw-r--r--arch/arm/mach-exynos/common.c7
-rw-r--r--arch/arm/mach-highbank/highbank.c2
-rw-r--r--arch/arm/mach-highbank/hotplug.c2
-rw-r--r--arch/arm/mach-highbank/platsmp.c12
-rw-r--r--arch/arm/mach-highbank/pm.c19
-rw-r--r--arch/arm/mach-highbank/sysregs.h23
-rw-r--r--arch/arm/mach-highbank/system.c4
-rw-r--r--arch/arm/mach-imx/Kconfig3
-rw-r--r--arch/arm/mach-imx/clk-imx25.c6
-rw-r--r--arch/arm/mach-imx/clk-imx27.c6
-rw-r--r--arch/arm/mach-imx/clk-imx31.c6
-rw-r--r--arch/arm/mach-imx/clk-imx35.c6
-rw-r--r--arch/arm/mach-imx/clk-imx51-imx53.c6
-rw-r--r--arch/arm/mach-imx/clk-imx6q.c3
-rw-r--r--arch/arm/mach-imx/common.h1
-rw-r--r--arch/arm/mach-imx/cpufreq.c2
-rw-r--r--arch/arm/mach-imx/devices/devices-common.h1
-rw-r--r--arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c15
-rw-r--r--arch/arm/mach-imx/devices/platform-imx-fb.c2
-rw-r--r--arch/arm/mach-imx/hotplug.c10
-rw-r--r--arch/arm/mach-imx/iram_alloc.c3
-rw-r--r--arch/arm/mach-imx/mmdc.c2
-rw-r--r--arch/arm/mach-imx/platsmp.c1
-rw-r--r--arch/arm/mach-imx/pm-imx6q.c1
-rw-r--r--arch/arm/mach-integrator/pci_v3.c14
-rw-r--r--arch/arm/mach-iop13xx/pci.c2
-rw-r--r--arch/arm/mach-kirkwood/board-dt.c4
-rw-r--r--arch/arm/mach-kirkwood/board-ns2.c38
-rw-r--r--arch/arm/mach-kirkwood/board-usi_topkick.c4
-rw-r--r--arch/arm/mach-kirkwood/pcie.c2
-rw-r--r--arch/arm/mach-ks8695/board-acs5k.c2
-rw-r--r--arch/arm/mach-mmp/sram.c4
-rw-r--r--arch/arm/mach-msm/proc_comm.c2
-rw-r--r--arch/arm/mach-msm/smd.c2
-rw-r--r--arch/arm/mach-mv78xx0/pcie.c2
-rw-r--r--arch/arm/mach-mvebu/Makefile2
-rw-r--r--arch/arm/mach-nomadik/board-nhk8815.c1
-rw-r--r--arch/arm/mach-nomadik/include/mach/irqs.h78
-rw-r--r--arch/arm/mach-omap1/Makefile2
-rw-r--r--arch/arm/mach-omap1/board-ams-delta.c2
-rw-r--r--arch/arm/mach-omap1/fb.c80
-rw-r--r--arch/arm/mach-omap1/mailbox.c6
-rw-r--r--arch/arm/mach-omap1/usb.c8
-rw-r--r--arch/arm/mach-omap2/Makefile2
-rw-r--r--arch/arm/mach-omap2/board-omap4panda.c6
-rw-r--r--arch/arm/mach-omap2/cclock2420_data.c2
-rw-r--r--arch/arm/mach-omap2/cclock2430_data.c2
-rw-r--r--arch/arm/mach-omap2/cclock3xxx_data.c2
-rw-r--r--arch/arm/mach-omap2/cclock44xx_data.c13
-rw-r--r--arch/arm/mach-omap2/control.h2
-rw-r--r--arch/arm/mach-omap2/devices.c2
-rw-r--r--arch/arm/mach-omap2/dpll3xxx.c3
-rw-r--r--arch/arm/mach-omap2/drm.c4
-rw-r--r--arch/arm/mach-omap2/dss-common.c3
-rw-r--r--arch/arm/mach-omap2/fb.c (renamed from arch/arm/plat-omap/fb.c)50
-rw-r--r--arch/arm/mach-omap2/gpmc.c12
-rw-r--r--arch/arm/mach-omap2/mailbox.c6
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_33xx_data.c6
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c7
-rw-r--r--arch/arm/mach-omap2/omap_twl.c8
-rw-r--r--arch/arm/mach-omap2/pmu.c2
-rw-r--r--arch/arm/mach-omap2/prm2xxx.c91
-rw-r--r--arch/arm/mach-omap2/prm2xxx_3xxx.c22
-rw-r--r--arch/arm/mach-omap2/prm3xxx.c31
-rw-r--r--arch/arm/mach-omap2/prm44xx.c6
-rw-r--r--arch/arm/mach-omap2/prm44xx.h4
-rw-r--r--arch/arm/mach-omap2/timer.c8
-rw-r--r--arch/arm/mach-orion5x/pci.c2
-rw-r--r--arch/arm/mach-prima2/pm.c2
-rw-r--r--arch/arm/mach-prima2/rtciobrg.c2
-rw-r--r--arch/arm/mach-pxa/corgi_pm.c2
-rw-r--r--arch/arm/mach-pxa/include/mach/mfp-pxa27x.h3
-rw-r--r--arch/arm/mach-pxa/pxa27x.c4
-rw-r--r--arch/arm/mach-pxa/sharpsl_pm.c4
-rw-r--r--arch/arm/mach-pxa/spitz_pm.c2
-rw-r--r--arch/arm/mach-pxa/tosa-bt.c4
-rw-r--r--arch/arm/mach-s3c24xx/h1940-bluetooth.c2
-rw-r--r--arch/arm/mach-s3c24xx/mach-osiris-dvs.c6
-rw-r--r--arch/arm/mach-s3c64xx/mach-crag6410-module.c8
-rw-r--r--arch/arm/mach-s3c64xx/mach-crag6410.c68
-rw-r--r--arch/arm/mach-s3c64xx/pm.c2
-rw-r--r--arch/arm/mach-sa1100/jornada720_ssp.c2
-rw-r--r--arch/arm/mach-sa1100/neponset.c8
-rw-r--r--arch/arm/mach-sunxi/sunxi.c4
-rw-r--r--arch/arm/mach-tegra/pcie.c6
-rw-r--r--arch/arm/mach-tegra/tegra2_emc.c6
-rw-r--r--arch/arm/mach-u300/dummyspichip.c6
-rw-r--r--arch/arm/mach-ux500/cpu-db8500.c3
-rw-r--r--arch/arm/mach-versatile/include/mach/irqs.h6
-rw-r--r--arch/arm/mach-vexpress/Kconfig1
-rw-r--r--arch/arm/mm/cache-l2x0.c34
-rw-r--r--arch/arm/mm/dma-mapping.c18
-rw-r--r--arch/arm/mm/mmu.c2
-rw-r--r--arch/arm/mm/proc-v7.S4
-rw-r--r--arch/arm/plat-omap/Makefile2
-rw-r--r--arch/arm/plat-omap/counter_32k.c2
-rw-r--r--arch/arm/plat-omap/dma.c6
-rw-r--r--arch/arm/plat-omap/dmtimer.c19
-rw-r--r--arch/arm/plat-omap/include/plat/cpu.h4
-rw-r--r--arch/arm/plat-omap/sram.c2
-rw-r--r--arch/arm/plat-pxa/ssp.c6
-rw-r--r--arch/arm/plat-samsung/adc.c4
-rw-r--r--arch/arm/plat-samsung/include/plat/cpu.h2
-rw-r--r--arch/arm/plat-versatile/headsmp.S2
-rw-r--r--arch/arm/vfp/entry.S6
-rw-r--r--arch/arm/vfp/vfphw.S4
-rw-r--r--arch/arm64/Kconfig6
-rw-r--r--arch/arm64/boot/dts/Makefile1
-rw-r--r--arch/arm64/include/asm/compat.h1
-rw-r--r--arch/arm64/include/asm/elf.h5
-rw-r--r--arch/arm64/include/asm/pgtable.h36
-rw-r--r--arch/arm64/include/asm/unistd32.h7
-rw-r--r--arch/arm64/kernel/perf_event.c2
-rw-r--r--arch/arm64/kernel/vdso.c4
-rw-r--r--arch/arm64/kernel/vdso/gettimeofday.S2
-rw-r--r--arch/avr32/lib/delay.c2
-rw-r--r--arch/blackfin/mach-common/dpmc.c6
-rw-r--r--arch/cris/arch-v32/drivers/pci/bios.c2
-rw-r--r--arch/cris/arch-v32/kernel/smp.c2
-rw-r--r--arch/frv/kernel/setup.c2
-rw-r--r--arch/frv/mb93090-mb00/pci-vdk.c6
-rw-r--r--arch/ia64/include/asm/acpi.h2
-rw-r--r--arch/ia64/include/asm/iosapic.h11
-rw-r--r--arch/ia64/include/asm/parport.h5
-rw-r--r--arch/ia64/include/asm/smp.h2
-rw-r--r--arch/ia64/include/asm/unistd.h2
-rw-r--r--arch/ia64/include/uapi/asm/unistd.h1
-rw-r--r--arch/ia64/kernel/acpi.c6
-rw-r--r--arch/ia64/kernel/entry.S1
-rw-r--r--arch/ia64/kernel/iosapic.c19
-rw-r--r--arch/ia64/kernel/ptrace.c27
-rw-r--r--arch/ia64/kernel/smpboot.c11
-rw-r--r--arch/ia64/kernel/time.c3
-rw-r--r--arch/ia64/mm/init.c5
-rw-r--r--arch/ia64/mm/tlb.c3
-rw-r--r--arch/ia64/pci/fixup.c2
-rw-r--r--arch/ia64/pci/pci.c31
-rw-r--r--arch/ia64/sn/kernel/io_common.c3
-rw-r--r--arch/ia64/sn/kernel/sn2/sn_hwperf.c2
-rw-r--r--arch/ia64/xen/irq_xen.c5
-rw-r--r--arch/m32r/kernel/smpboot.c2
-rw-r--r--arch/m68k/emu/nfeth.c2
-rw-r--r--arch/m68k/include/asm/dma-mapping.h16
-rw-r--r--arch/m68k/include/asm/parport.h4
-rw-r--r--arch/m68k/include/asm/pgtable_no.h2
-rw-r--r--arch/m68k/include/asm/unistd.h2
-rw-r--r--arch/m68k/include/uapi/asm/unistd.h1
-rw-r--r--arch/m68k/kernel/pcibios.c4
-rw-r--r--arch/m68k/kernel/syscalltable.S1
-rw-r--r--arch/m68k/mm/init.c8
-rw-r--r--arch/microblaze/configs/mmu_defconfig52
-rw-r--r--arch/microblaze/configs/nommu_defconfig73
-rw-r--r--arch/microblaze/include/asm/highmem.h2
-rw-r--r--arch/microblaze/include/asm/uaccess.h2
-rw-r--r--arch/microblaze/include/asm/unistd.h2
-rw-r--r--arch/microblaze/include/uapi/asm/unistd.h3
-rw-r--r--arch/microblaze/kernel/syscall_table.S1
-rw-r--r--arch/microblaze/pci/pci-common.c39
-rw-r--r--arch/mips/Kconfig4
-rw-r--r--arch/mips/alchemy/common/time.c25
-rw-r--r--arch/mips/bcm47xx/Kconfig3
-rw-r--r--arch/mips/cavium-octeon/executive/cvmx-l2c.c9
-rw-r--r--arch/mips/cavium-octeon/serial.c2
-rw-r--r--arch/mips/include/asm/dsp.h2
-rw-r--r--arch/mips/include/asm/inst.h1
-rw-r--r--arch/mips/include/asm/mach-pnx833x/war.h2
-rw-r--r--arch/mips/include/asm/page.h9
-rw-r--r--arch/mips/include/asm/pci.h4
-rw-r--r--arch/mips/include/asm/pgtable-64.h1
-rw-r--r--arch/mips/include/asm/thread_info.h9
-rw-r--r--arch/mips/include/uapi/asm/Kbuild1
-rw-r--r--arch/mips/include/uapi/asm/break.h (renamed from arch/mips/include/asm/break.h)0
-rw-r--r--arch/mips/include/uapi/asm/unistd.h15
-rw-r--r--arch/mips/kernel/asm-offsets.c3
-rw-r--r--arch/mips/kernel/ftrace.c36
-rw-r--r--arch/mips/kernel/genex.S5
-rw-r--r--arch/mips/kernel/head.S1
-rw-r--r--arch/mips/kernel/mcount.S7
-rw-r--r--arch/mips/kernel/octeon_switch.S1
-rw-r--r--arch/mips/kernel/perf_event_mipsxx.c38
-rw-r--r--arch/mips/kernel/r2300_switch.S1
-rw-r--r--arch/mips/kernel/r4k_switch.S1
-rw-r--r--arch/mips/kernel/relocate_kernel.S3
-rw-r--r--arch/mips/kernel/scall32-o32.S1
-rw-r--r--arch/mips/kernel/scall64-64.S1
-rw-r--r--arch/mips/kernel/scall64-n32.S1
-rw-r--r--arch/mips/kernel/scall64-o32.S1
-rw-r--r--arch/mips/kernel/smp.c2
-rw-r--r--arch/mips/kernel/vmlinux.lds.S3
-rw-r--r--arch/mips/kernel/vpe.c2
-rw-r--r--arch/mips/lantiq/irq.c2
-rw-r--r--arch/mips/lantiq/xway/dma.c2
-rw-r--r--arch/mips/lantiq/xway/gptu.c2
-rw-r--r--arch/mips/lantiq/xway/xrx200_phy_fw.c2
-rw-r--r--arch/mips/lib/delay.c2
-rw-r--r--arch/mips/mm/mmap.c6
-rw-r--r--arch/mips/mm/tlbex-fault.S1
-rw-r--r--arch/mips/mm/tlbex.c16
-rw-r--r--arch/mips/mti-sead3/sead3-i2c-drv.c6
-rw-r--r--arch/mips/mti-sead3/sead3-pic32-i2c-drv.c8
-rw-r--r--arch/mips/netlogic/xlr/setup.c5
-rw-r--r--arch/mips/pci/fixup-cobalt.c8
-rw-r--r--arch/mips/pci/fixup-emma2rh.c4
-rw-r--r--arch/mips/pci/fixup-fuloong2e.c12
-rw-r--r--arch/mips/pci/fixup-lemote2f.c12
-rw-r--r--arch/mips/pci/fixup-malta.c10
-rw-r--r--arch/mips/pci/fixup-rc32434.c6
-rw-r--r--arch/mips/pci/fixup-sb1250.c6
-rw-r--r--arch/mips/pci/ops-bcm63xx.c2
-rw-r--r--arch/mips/pci/ops-tx4927.c6
-rw-r--r--arch/mips/pci/pci-alchemy.c2
-rw-r--r--arch/mips/pci/pci-ar71xx.c2
-rw-r--r--arch/mips/pci/pci-ar724x.c2
-rw-r--r--arch/mips/pci/pci-ip27.c4
-rw-r--r--arch/mips/pci/pci-lantiq.c4
-rw-r--r--arch/mips/pci/pci.c9
-rw-r--r--arch/mips/power/hibernate.S3
-rw-r--r--arch/mips/sni/setup.c2
-rw-r--r--arch/mips/txx9/generic/pci.c11
-rw-r--r--arch/mn10300/Kconfig1
-rw-r--r--arch/mn10300/kernel/smp.c4
-rw-r--r--arch/mn10300/unit-asb2305/pci.c6
-rw-r--r--arch/openrisc/lib/delay.c2
-rw-r--r--arch/parisc/include/asm/parport.h2
-rw-r--r--arch/parisc/kernel/entry.S18
-rw-r--r--arch/parisc/kernel/hardware.c7
-rw-r--r--arch/parisc/kernel/irq.c6
-rw-r--r--arch/parisc/kernel/ptrace.c2
-rw-r--r--arch/parisc/kernel/signal.c4
-rw-r--r--arch/parisc/math-emu/cnv_float.h11
-rw-r--r--arch/powerpc/include/asm/eeh.h6
-rw-r--r--arch/powerpc/include/asm/io-workarounds.h4
-rw-r--r--arch/powerpc/include/asm/parport.h2
-rw-r--r--arch/powerpc/include/asm/smp.h4
-rw-r--r--arch/powerpc/include/asm/vio.h2
-rw-r--r--arch/powerpc/include/uapi/asm/kvm_para.h2
-rw-r--r--arch/powerpc/kernel/entry_32.S2
-rw-r--r--arch/powerpc/kernel/entry_64.S13
-rw-r--r--arch/powerpc/kernel/io-workarounds.c9
-rw-r--r--arch/powerpc/kernel/isa-bridge.c12
-rw-r--r--arch/powerpc/kernel/kgdb.c5
-rw-r--r--arch/powerpc/kernel/of_platform.c2
-rw-r--r--arch/powerpc/kernel/pci-common.c28
-rw-r--r--arch/powerpc/kernel/pci_32.c2
-rw-r--r--arch/powerpc/kernel/pci_64.c6
-rw-r--r--arch/powerpc/kernel/pci_dn.c4
-rw-r--r--arch/powerpc/kernel/pci_of_scan.c12
-rw-r--r--arch/powerpc/kernel/rtas_pci.c4
-rw-r--r--arch/powerpc/kernel/smp-tbsync.c8
-rw-r--r--arch/powerpc/kernel/smp.c8
-rw-r--r--arch/powerpc/kernel/time.c14
-rw-r--r--arch/powerpc/kernel/vio.c4
-rw-r--r--arch/powerpc/kvm/book3s_hv_ras.c4
-rw-r--r--arch/powerpc/kvm/emulate.c2
-rw-r--r--arch/powerpc/mm/tlb_hash64.c4
-rw-r--r--arch/powerpc/oprofile/op_model_power4.c2
-rw-r--r--arch/powerpc/platforms/40x/ppc40x_simple.c3
-rw-r--r--arch/powerpc/platforms/44x/currituck.c2
-rw-r--r--arch/powerpc/platforms/44x/virtex_ml510.c2
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_gpt.c6
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c8
-rw-r--r--arch/powerpc/platforms/82xx/ep8248e.c2
-rw-r--r--arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c9
-rw-r--r--arch/powerpc/platforms/85xx/corenet_ds.c2
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_cds.c2
-rw-r--r--arch/powerpc/platforms/85xx/tqm85xx.c2
-rw-r--r--arch/powerpc/platforms/86xx/gef_ppc9a.c2
-rw-r--r--arch/powerpc/platforms/86xx/gef_sbc310.c2
-rw-r--r--arch/powerpc/platforms/86xx/gef_sbc610.c2
-rw-r--r--arch/powerpc/platforms/cell/setup.c2
-rw-r--r--arch/powerpc/platforms/cell/smp.c6
-rw-r--r--arch/powerpc/platforms/chrp/pci.c2
-rw-r--r--arch/powerpc/platforms/chrp/smp.c4
-rw-r--r--arch/powerpc/platforms/fsl_uli1575.c20
-rw-r--r--arch/powerpc/platforms/maple/pci.c4
-rw-r--r--arch/powerpc/platforms/pasemi/cpufreq.c7
-rw-r--r--arch/powerpc/platforms/pasemi/gpio_mdio.c2
-rw-r--r--arch/powerpc/platforms/pasemi/pasemi.h4
-rw-r--r--arch/powerpc/platforms/pasemi/setup.c4
-rw-r--r--arch/powerpc/platforms/powermac/pci.c6
-rw-r--r--arch/powerpc/platforms/powermac/smp.c8
-rw-r--r--arch/powerpc/platforms/powernv/pci-ioda.c48
-rw-r--r--arch/powerpc/platforms/powernv/pci-p5ioc2.c4
-rw-r--r--arch/powerpc/platforms/powernv/pci.c11
-rw-r--r--arch/powerpc/platforms/powernv/smp.c2
-rw-r--r--arch/powerpc/platforms/ps3/repository.c2
-rw-r--r--arch/powerpc/platforms/pseries/eeh_dev.c4
-rw-r--r--arch/powerpc/platforms/pseries/eeh_pe.c2
-rw-r--r--arch/powerpc/platforms/pseries/pci_dlpar.c2
-rw-r--r--arch/powerpc/platforms/pseries/smp.c6
-rw-r--r--arch/powerpc/platforms/wsp/scom_smp.c3
-rw-r--r--arch/powerpc/platforms/wsp/smp.c4
-rw-r--r--arch/powerpc/platforms/wsp/wsp.h2
-rw-r--r--arch/powerpc/platforms/wsp/wsp_pci.c2
-rw-r--r--arch/powerpc/sysdev/bestcomm/bestcomm.c7
-rw-r--r--arch/powerpc/sysdev/fsl_85xx_l2ctlr.c6
-rw-r--r--arch/powerpc/sysdev/fsl_ifc.c4
-rw-r--r--arch/powerpc/sysdev/fsl_lbc.c6
-rw-r--r--arch/powerpc/sysdev/fsl_msi.c7
-rw-r--r--arch/powerpc/sysdev/fsl_pci.c4
-rw-r--r--arch/powerpc/sysdev/fsl_rio.c2
-rw-r--r--arch/powerpc/sysdev/mpic.c2
-rw-r--r--arch/powerpc/sysdev/mpic_msgr.c2
-rw-r--r--arch/powerpc/sysdev/mv64x60_pci.c2
-rw-r--r--arch/powerpc/sysdev/ppc4xx_msi.c2
-rw-r--r--arch/s390/Makefile4
-rw-r--r--arch/s390/include/asm/dma.h6
-rw-r--r--arch/s390/include/asm/io.h5
-rw-r--r--arch/s390/include/asm/irq.h78
-rw-r--r--arch/s390/include/asm/pgtable.h17
-rw-r--r--arch/s390/include/asm/timex.h28
-rw-r--r--arch/s390/include/uapi/asm/unistd.h3
-rw-r--r--arch/s390/kernel/compat_wrapper.S6
-rw-r--r--arch/s390/kernel/debug.c11
-rw-r--r--arch/s390/kernel/irq.c124
-rw-r--r--arch/s390/kernel/nmi.c2
-rw-r--r--arch/s390/kernel/perf_cpum_cf.c2
-rw-r--r--arch/s390/kernel/runtime_instr.c2
-rw-r--r--arch/s390/kernel/setup.c3
-rw-r--r--arch/s390/kernel/smp.c11
-rw-r--r--arch/s390/kernel/syscalls.S1
-rw-r--r--arch/s390/kernel/time.c6
-rw-r--r--arch/s390/kernel/topology.c2
-rw-r--r--arch/s390/kvm/interrupt.c2
-rw-r--r--arch/s390/kvm/kvm-s390.c2
-rw-r--r--arch/s390/mm/fault.c2
-rw-r--r--arch/s390/oprofile/hwsampler.c2
-rw-r--r--arch/s390/pci/pci.c35
-rw-r--r--arch/s390/pci/pci_dma.c2
-rw-r--r--arch/score/mm/cache.c2
-rw-r--r--arch/sh/boards/mach-ecovec24/setup.c10
-rw-r--r--arch/sh/drivers/pci/fixups-dreamcast.c2
-rw-r--r--arch/sh/drivers/pci/pci.c6
-rw-r--r--arch/sh/drivers/pci/pcie-sh7786.c2
-rw-r--r--arch/sh/include/asm/elf.h4
-rw-r--r--arch/sh/include/asm/processor_32.h2
-rw-r--r--arch/sh/include/asm/processor_64.h2
-rw-r--r--arch/sh/include/uapi/asm/unistd_32.h3
-rw-r--r--arch/sh/include/uapi/asm/unistd_64.h3
-rw-r--r--arch/sh/kernel/syscalls_32.S1
-rw-r--r--arch/sh/kernel/syscalls_64.S1
-rw-r--r--arch/sh/lib/mcount.S2
-rw-r--r--arch/sparc/include/asm/parport.h6
-rw-r--r--arch/sparc/include/asm/timer_64.h2
-rw-r--r--arch/sparc/include/uapi/asm/unistd.h3
-rw-r--r--arch/sparc/kernel/apc.c4
-rw-r--r--arch/sparc/kernel/auxio_64.c2
-rw-r--r--arch/sparc/kernel/central.c6
-rw-r--r--arch/sparc/kernel/chmc.c34
-rw-r--r--arch/sparc/kernel/ds.c5
-rw-r--r--arch/sparc/kernel/ldc.c2
-rw-r--r--arch/sparc/kernel/leon_pci.c2
-rw-r--r--arch/sparc/kernel/leon_pci_grpci2.c2
-rw-r--r--arch/sparc/kernel/pci.c37
-rw-r--r--arch/sparc/kernel/pci_fire.c6
-rw-r--r--arch/sparc/kernel/pci_psycho.c12
-rw-r--r--arch/sparc/kernel/pci_sabre.c9
-rw-r--r--arch/sparc/kernel/pci_schizo.c16
-rw-r--r--arch/sparc/kernel/pci_sun4v.c15
-rw-r--r--arch/sparc/kernel/pcic.c5
-rw-r--r--arch/sparc/kernel/pmc.c2
-rw-r--r--arch/sparc/kernel/power.c4
-rw-r--r--arch/sparc/kernel/smp_64.c4
-rw-r--r--arch/sparc/kernel/systbls_32.S2
-rw-r--r--arch/sparc/kernel/systbls_64.S4
-rw-r--r--arch/sparc/kernel/time_32.c2
-rw-r--r--arch/sparc/kernel/time_64.c10
-rw-r--r--arch/sparc/mm/init_64.c6
-rw-r--r--arch/tile/include/asm/pci.h2
-rw-r--r--arch/tile/kernel/pci.c23
-rw-r--r--arch/tile/kernel/pci_gx.c33
-rw-r--r--arch/unicore32/kernel/pci.c2
-rw-r--r--arch/x86/Kconfig1
-rw-r--r--arch/x86/boot/Makefile4
-rw-r--r--arch/x86/boot/compressed/eboot.c21
-rw-r--r--arch/x86/boot/compressed/head_32.S8
-rw-r--r--arch/x86/boot/compressed/head_64.S8
-rw-r--r--arch/x86/boot/header.S39
-rw-r--r--arch/x86/boot/setup.ld2
-rw-r--r--arch/x86/boot/tools/build.c81
-rw-r--r--arch/x86/include/asm/efi.h1
-rw-r--r--arch/x86/include/asm/parport.h4
-rw-r--r--arch/x86/include/asm/pci_x86.h7
-rw-r--r--arch/x86/include/asm/uv/uv.h2
-rw-r--r--arch/x86/include/uapi/asm/bootparam.h63
-rw-r--r--arch/x86/kernel/cpu/perf_event.c6
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_uncore.c6
-rw-r--r--arch/x86/kernel/entry_32.S1
-rw-r--r--arch/x86/kernel/entry_64.S7
-rw-r--r--arch/x86/kernel/head_32.S9
-rw-r--r--arch/x86/kernel/kvm.c12
-rw-r--r--arch/x86/kernel/msr.c3
-rw-r--r--arch/x86/kernel/pci-dma.c4
-rw-r--r--arch/x86/kernel/quirks.c4
-rw-r--r--arch/x86/kernel/reboot.c2
-rw-r--r--arch/x86/kernel/setup.c108
-rw-r--r--arch/x86/kernel/step.c9
-rw-r--r--arch/x86/kvm/x86.c24
-rw-r--r--arch/x86/lib/delay.c2
-rw-r--r--arch/x86/pci/acpi.c11
-rw-r--r--arch/x86/pci/bus_numa.c4
-rw-r--r--arch/x86/pci/common.c29
-rw-r--r--arch/x86/pci/fixup.c30
-rw-r--r--arch/x86/pci/legacy.c4
-rw-r--r--arch/x86/pci/mmconfig-shared.c21
-rw-r--r--arch/x86/pci/mmconfig_32.c2
-rw-r--r--arch/x86/pci/mmconfig_64.c4
-rw-r--r--arch/x86/pci/mrst.c6
-rw-r--r--arch/x86/pci/numaq_32.c2
-rw-r--r--arch/x86/pci/pcbios.c4
-rw-r--r--arch/x86/platform/efi/efi.c59
-rw-r--r--arch/x86/platform/efi/efi_64.c22
-rw-r--r--arch/x86/platform/mrst/mrst.c2
-rw-r--r--arch/x86/platform/olpc/olpc-xo1-pm.c8
-rw-r--r--arch/x86/platform/olpc/olpc-xo1-sci.c18
-rw-r--r--arch/x86/platform/scx200/scx200_32.c6
-rw-r--r--arch/x86/platform/uv/tlb_uv.c10
-rw-r--r--arch/x86/tools/relocs.c6
-rw-r--r--arch/x86/xen/smp.c7
-rw-r--r--drivers/acpi/acpi_memhotplug.c18
-rw-r--r--drivers/acpi/acpica/Makefile2
-rw-r--r--drivers/acpi/acpica/utclib.c749
-rw-r--r--drivers/acpi/apei/apei-base.c3
-rw-r--r--drivers/acpi/apei/erst-dbg.c11
-rw-r--r--drivers/acpi/device_pm.c3
-rw-r--r--drivers/acpi/glue.c11
-rw-r--r--drivers/acpi/osl.c2
-rw-r--r--drivers/acpi/power.c11
-rw-r--r--drivers/acpi/processor_idle.c4
-rw-r--r--drivers/acpi/processor_perflib.c7
-rw-r--r--drivers/acpi/scan.c2
-rw-r--r--drivers/amba/bus.c4
-rw-r--r--drivers/amba/tegra-ahb.c4
-rw-r--r--drivers/ata/ahci.c8
-rw-r--r--drivers/ata/ahci_platform.c2
-rw-r--r--drivers/ata/ata_piix.c17
-rw-r--r--drivers/ata/libahci.c6
-rw-r--r--drivers/ata/libata-core.c22
-rw-r--r--drivers/ata/libata-eh.c2
-rw-r--r--drivers/ata/pata_arasan_cf.c6
-rw-r--r--drivers/ata/pata_at91.c6
-rw-r--r--drivers/ata/pata_bf54x.c6
-rw-r--r--drivers/ata/pata_cs5520.c2
-rw-r--r--drivers/ata/pata_ep93xx.c6
-rw-r--r--drivers/ata/pata_icside.c21
-rw-r--r--drivers/ata/pata_imx.c6
-rw-r--r--drivers/ata/pata_ixp4xx_cf.c2
-rw-r--r--drivers/ata/pata_macio.c33
-rw-r--r--drivers/ata/pata_mpc52xx.c10
-rw-r--r--drivers/ata/pata_octeon_cf.c2
-rw-r--r--drivers/ata/pata_of_platform.c2
-rw-r--r--drivers/ata/pata_palmld.c6
-rw-r--r--drivers/ata/pata_pdc2027x.c3
-rw-r--r--drivers/ata/pata_platform.c11
-rw-r--r--drivers/ata/pata_pxa.c6
-rw-r--r--drivers/ata/pata_rb532_cf.c6
-rw-r--r--drivers/ata/pata_rdc.c3
-rw-r--r--drivers/ata/pata_sch.c3
-rw-r--r--drivers/ata/pata_sil680.c3
-rw-r--r--drivers/ata/sata_highbank.c2
-rw-r--r--drivers/ata/sata_mv.c8
-rw-r--r--drivers/ata/sata_vsc.c7
-rw-r--r--drivers/atm/ambassador.c53
-rw-r--r--drivers/atm/eni.c18
-rw-r--r--drivers/atm/firestream.c32
-rw-r--r--drivers/atm/fore200e.c70
-rw-r--r--drivers/atm/he.c36
-rw-r--r--drivers/atm/horizon.c12
-rw-r--r--drivers/atm/idt77252.c16
-rw-r--r--drivers/atm/iphase.c11
-rw-r--r--drivers/atm/lanai.c28
-rw-r--r--drivers/atm/nicstar.c18
-rw-r--r--drivers/atm/solos-pci.c4
-rw-r--r--drivers/atm/zatm.c31
-rw-r--r--drivers/auxdisplay/cfag12864bfb.c10
-rw-r--r--drivers/base/cpu.c2
-rw-r--r--drivers/base/firmware_class.c2
-rw-r--r--drivers/base/power/main.c9
-rw-r--r--drivers/base/power/qos.c10
-rw-r--r--drivers/base/regmap/regmap-debugfs.c51
-rw-r--r--drivers/base/regmap/regmap.c2
-rw-r--r--drivers/bcma/Kconfig3
-rw-r--r--drivers/bcma/bcma_private.h6
-rw-r--r--drivers/bcma/driver_chipcommon_sflash.c2
-rw-r--r--drivers/bcma/driver_gmac_cmn.c2
-rw-r--r--drivers/bcma/driver_pci.c4
-rw-r--r--drivers/bcma/driver_pci_host.c13
-rw-r--r--drivers/bcma/host_pci.c8
-rw-r--r--drivers/bcma/main.c2
-rw-r--r--drivers/block/cciss.c90
-rw-r--r--drivers/block/cpqarray.c16
-rw-r--r--drivers/block/nvme.c17
-rw-r--r--drivers/block/ps3disk.c2
-rw-r--r--drivers/block/ps3vram.c4
-rw-r--r--drivers/block/sunvdc.c9
-rw-r--r--drivers/block/swim.c11
-rw-r--r--drivers/block/swim3.c3
-rw-r--r--drivers/block/umem.c3
-rw-r--r--drivers/block/virtio_blk.c20
-rw-r--r--drivers/block/xsysace.c19
-rw-r--r--drivers/bluetooth/ath3k.c10
-rw-r--r--drivers/bluetooth/btusb.c5
-rw-r--r--drivers/bus/omap-ocp2scp.c6
-rw-r--r--drivers/bus/omap_l3_noc.c6
-rw-r--r--drivers/cdrom/gdrom.c18
-rw-r--r--drivers/char/agp/ali-agp.c3
-rw-r--r--drivers/char/agp/amd-k7-agp.c4
-rw-r--r--drivers/char/agp/amd64-agp.c15
-rw-r--r--drivers/char/agp/ati-agp.c3
-rw-r--r--drivers/char/agp/efficeon-agp.c4
-rw-r--r--drivers/char/agp/i460-agp.c6
-rw-r--r--drivers/char/agp/intel-agp.c6
-rw-r--r--drivers/char/agp/nvidia-agp.c4
-rw-r--r--drivers/char/agp/sgi-agp.c2
-rw-r--r--drivers/char/agp/sis-agp.c5
-rw-r--r--drivers/char/agp/sworks-agp.c4
-rw-r--r--drivers/char/agp/uninorth-agp.c4
-rw-r--r--drivers/char/agp/via-agp.c3
-rw-r--r--drivers/char/hw_random/atmel-rng.c2
-rw-r--r--drivers/char/hw_random/bcm63xx-rng.c4
-rw-r--r--drivers/char/hw_random/exynos-rng.c4
-rw-r--r--drivers/char/hw_random/n2-drv.c6
-rw-r--r--drivers/char/hw_random/octeon-rng.c2
-rw-r--r--drivers/char/hw_random/omap-rng.c2
-rw-r--r--drivers/char/hw_random/pasemi-rng.c2
-rw-r--r--drivers/char/hw_random/picoxcell-rng.c2
-rw-r--r--drivers/char/hw_random/ppc4xx-rng.c2
-rw-r--r--drivers/char/hw_random/timeriomem-rng.c4
-rw-r--r--drivers/char/hw_random/virtio-rng.c2
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c6
-rw-r--r--drivers/char/virtio_console.c6
-rw-r--r--drivers/clk/clk-twl6040.c6
-rw-r--r--drivers/clk/mvebu/clk-cpu.c9
-rw-r--r--drivers/clk/mvebu/clk-gating-ctrl.c2
-rw-r--r--drivers/clk/ux500/abx500-clk.c2
-rw-r--r--drivers/clocksource/acpi_pm.c6
-rw-r--r--drivers/clocksource/em_sti.c8
-rw-r--r--drivers/clocksource/sh_cmt.c6
-rw-r--r--drivers/clocksource/sh_mtu2.c6
-rw-r--r--drivers/clocksource/sh_tmu.c6
-rw-r--r--drivers/connector/connector.c4
-rw-r--r--drivers/cpufreq/Kconfig5
-rw-r--r--drivers/cpufreq/Kconfig.x862
-rw-r--r--drivers/cpufreq/Makefile5
-rw-r--r--drivers/cpufreq/acpi-cpufreq.c7
-rw-r--r--drivers/cpufreq/cpufreq-cpu0.c5
-rw-r--r--drivers/cpufreq/cpufreq_stats.c11
-rw-r--r--drivers/cpufreq/longhaul.c10
-rw-r--r--drivers/cpufreq/omap-cpufreq.c3
-rw-r--r--drivers/cpuidle/coupled.c2
-rw-r--r--drivers/cpuidle/cpuidle.c17
-rw-r--r--drivers/cpuidle/driver.c33
-rw-r--r--drivers/cpuidle/governors/menu.c8
-rw-r--r--drivers/cpuidle/sysfs.c2
-rw-r--r--drivers/crypto/atmel-aes.c6
-rw-r--r--drivers/crypto/atmel-sha.c6
-rw-r--r--drivers/crypto/atmel-tdes.c6
-rw-r--r--drivers/crypto/bfin_crc.c6
-rw-r--r--drivers/crypto/caam/ctrl.c2
-rw-r--r--drivers/crypto/geode-aes.c8
-rw-r--r--drivers/crypto/hifn_795x.c6
-rw-r--r--drivers/crypto/mv_cesa.c2
-rw-r--r--drivers/crypto/n2_core.c46
-rw-r--r--drivers/crypto/nx/nx.c7
-rw-r--r--drivers/crypto/omap-sham.c4
-rw-r--r--drivers/crypto/picoxcell_crypto.c6
-rw-r--r--drivers/crypto/tegra-aes.c6
-rw-r--r--drivers/devfreq/devfreq.c5
-rw-r--r--drivers/devfreq/exynos4_bus.c100
-rw-r--r--drivers/dma/dw_dmac.c2
-rw-r--r--drivers/dma/edma.c2
-rw-r--r--drivers/dma/imx-dma.c5
-rw-r--r--drivers/dma/intel_mid_dma.c2
-rw-r--r--drivers/dma/ioat/dca.c9
-rw-r--r--drivers/dma/ioat/dma.c12
-rw-r--r--drivers/dma/ioat/dma.h13
-rw-r--r--drivers/dma/ioat/dma_v2.c2
-rw-r--r--drivers/dma/ioat/dma_v2.h8
-rw-r--r--drivers/dma/ioat/dma_v3.c10
-rw-r--r--drivers/dma/ioat/pci.c9
-rw-r--r--drivers/dma/iop-adma.c2
-rw-r--r--drivers/dma/mmp_pdma.c2
-rw-r--r--drivers/dma/mmp_tdma.c2
-rw-r--r--drivers/dma/mpc512x_dma.c2
-rw-r--r--drivers/dma/mv_xor.c9
-rw-r--r--drivers/dma/pch_dma.c2
-rw-r--r--drivers/dma/pl330.c2
-rw-r--r--drivers/dma/ppc4xx/adma.c4
-rw-r--r--drivers/dma/sa11x0-dma.c2
-rw-r--r--drivers/dma/sh/shdma.c2
-rw-r--r--drivers/dma/sirf-dma.c2
-rw-r--r--drivers/dma/tegra20-apb-dma.c14
-rw-r--r--drivers/dma/timb_dma.c2
-rw-r--r--drivers/edac/Kconfig8
-rw-r--r--drivers/edac/amd64_edac.c8
-rw-r--r--drivers/edac/amd76x_edac.c8
-rw-r--r--drivers/edac/cell_edac.c8
-rw-r--r--drivers/edac/cpc925_edac.c2
-rw-r--r--drivers/edac/e752x_edac.c7
-rw-r--r--drivers/edac/e7xxx_edac.c7
-rw-r--r--drivers/edac/edac_mc.c6
-rw-r--r--drivers/edac/edac_mc_sysfs.c19
-rw-r--r--drivers/edac/edac_pci_sysfs.c2
-rw-r--r--drivers/edac/highbank_l2_edac.c2
-rw-r--r--drivers/edac/highbank_mc_edac.c6
-rw-r--r--drivers/edac/i3000_edac.c7
-rw-r--r--drivers/edac/i3200_edac.c7
-rw-r--r--drivers/edac/i5000_edac.c7
-rw-r--r--drivers/edac/i5100_edac.c24
-rw-r--r--drivers/edac/i5400_edac.c7
-rw-r--r--drivers/edac/i7300_edac.c9
-rw-r--r--drivers/edac/i7core_edac.c7
-rw-r--r--drivers/edac/i82443bxgx_edac.c8
-rw-r--r--drivers/edac/i82860_edac.c8
-rw-r--r--drivers/edac/i82875p_edac.c8
-rw-r--r--drivers/edac/i82975x_edac.c8
-rw-r--r--drivers/edac/mpc85xx_edac.c8
-rw-r--r--drivers/edac/mv64x60_edac.c10
-rw-r--r--drivers/edac/octeon_edac-l2c.c2
-rw-r--r--drivers/edac/octeon_edac-lmc.c2
-rw-r--r--drivers/edac/octeon_edac-pc.c2
-rw-r--r--drivers/edac/octeon_edac-pci.c2
-rw-r--r--drivers/edac/pasemi_edac.c8
-rw-r--r--drivers/edac/ppc4xx_edac.c27
-rw-r--r--drivers/edac/r82600_edac.c8
-rw-r--r--drivers/edac/sb_edac.c7
-rw-r--r--drivers/edac/tile_edac.c8
-rw-r--r--drivers/edac/x38_edac.c7
-rw-r--r--drivers/firmware/dcdbas.c6
-rw-r--r--drivers/firmware/dmi_scan.c2
-rw-r--r--drivers/firmware/efivars.c9
-rw-r--r--drivers/firmware/iscsi_ibft_find.c2
-rw-r--r--drivers/gpio/Kconfig8
-rw-r--r--drivers/gpio/Makefile1
-rw-r--r--drivers/gpio/gpio-da9055.c8
-rw-r--r--drivers/gpio/gpio-langwell.c53
-rw-r--r--drivers/gpio/gpio-lynxpoint.c469
-rw-r--r--drivers/gpio/gpio-mvebu.c6
-rw-r--r--drivers/gpio/gpio-samsung.c14
-rw-r--r--drivers/gpio/gpio-ts5500.c6
-rw-r--r--drivers/gpio/gpio-viperboard.c6
-rw-r--r--drivers/gpu/drm/ast/ast_drv.c3
-rw-r--r--drivers/gpu/drm/cirrus/cirrus_drv.c4
-rw-r--r--drivers/gpu/drm/drm_mm.c86
-rw-r--r--drivers/gpu/drm/exynos/Kconfig4
-rw-r--r--drivers/gpu/drm/exynos/exynos_ddc.c2
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_buf.c79
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_buf.h22
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_connector.c55
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_connector.h22
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_core.c22
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_crtc.c52
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_crtc.h23
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_dmabuf.c53
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_dmabuf.h22
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_drv.c24
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_drv.h26
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_encoder.c22
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_encoder.h22
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_fb.c22
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_fb.h22
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_fbdev.c44
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_fbdev.h22
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_fimc.c130
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_fimc.h22
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_fimd.c38
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_g2d.c8
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_gem.c22
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_gem.h22
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_gsc.c62
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_gsc.h22
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_hdmi.c15
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_hdmi.h26
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_iommu.c22
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_iommu.h22
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_ipp.c30
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_ipp.h26
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_rotator.c38
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_rotator.h22
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_vidi.c62
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_vidi.h22
-rw-r--r--drivers/gpu/drm/exynos/exynos_hdmi.c129
-rw-r--r--drivers/gpu/drm/exynos/exynos_hdmi.h22
-rw-r--r--drivers/gpu/drm/exynos/exynos_hdmiphy.c2
-rw-r--r--drivers/gpu/drm/exynos/exynos_mixer.c54
-rw-r--r--drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c4
-rw-r--r--drivers/gpu/drm/i915/i915_debugfs.c5
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c3
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c3
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h11
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c102
-rw-r--r--drivers/gpu/drm/i915/i915_gem_dmabuf.c7
-rw-r--r--drivers/gpu/drm/i915/i915_gem_execbuffer.c23
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c23
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h7
-rw-r--r--drivers/gpu/drm/i915/intel_display.c56
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c47
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c8
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c188
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.c100
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.h1
-rw-r--r--drivers/gpu/drm/i915/intel_sprite.c10
-rw-r--r--drivers/gpu/drm/mgag200/mgag200_drv.c3
-rw-r--r--drivers/gpu/drm/nouveau/core/core/client.c4
-rw-r--r--drivers/gpu/drm/nouveau/core/core/handle.c5
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/disp/nv50.c46
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc5
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc.h17
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc10
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h147
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc13
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h157
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c11
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h1
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nve0.c3
-rw-r--r--drivers/gpu/drm/nouveau/core/include/core/client.h3
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/bios.h1
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/bios/gpio.h8
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/bios/init.h1
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/bios/pll.h2
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/gpio.h2
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bios/base.c5
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c128
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bios/init.c66
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/device/nve0.c28
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c6
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/gpio/base.c9
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c9
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c9
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/instmem/base.c35
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/mxm/base.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/vm/base.c4
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bo.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_connector.c30
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_display.c9
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drm.c11
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_fence.h1
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_pm.c4
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_prime.c1
-rw-r--r--drivers/gpu/drm/nouveau/nv04_dfp.c2
-rw-r--r--drivers/gpu/drm/nouveau/nv10_fence.c8
-rw-r--r--drivers/gpu/drm/nouveau/nv50_fence.c1
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c92
-rw-r--r--drivers/gpu/drm/radeon/evergreen_cs.c30
-rw-r--r--drivers/gpu/drm/radeon/evergreend.h14
-rw-r--r--drivers/gpu/drm/radeon/ni.c120
-rw-r--r--drivers/gpu/drm/radeon/nid.h3
-rw-r--r--drivers/gpu/drm/radeon/r600.c113
-rw-r--r--drivers/gpu/drm/radeon/r600_cs.c72
-rw-r--r--drivers/gpu/drm/radeon/radeon.h11
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.h4
-rw-r--r--drivers/gpu/drm/radeon/radeon_combios.c51
-rw-r--r--drivers/gpu/drm/radeon/radeon_connectors.c10
-rw-r--r--drivers/gpu/drm/radeon/radeon_cs.c11
-rw-r--r--drivers/gpu/drm/radeon/radeon_cursor.c3
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c48
-rw-r--r--drivers/gpu/drm/radeon/radeon_display.c15
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.c8
-rw-r--r--drivers/gpu/drm/radeon/radeon_fence.c49
-rw-r--r--drivers/gpu/drm/radeon/radeon_i2c.c10
-rw-r--r--drivers/gpu/drm/radeon/radeon_legacy_encoders.c8
-rw-r--r--drivers/gpu/drm/radeon/radeon_mode.h5
-rw-r--r--drivers/gpu/drm/radeon/radeon_object.c18
-rw-r--r--drivers/gpu/drm/radeon/radeon_pm.c15
-rw-r--r--drivers/gpu/drm/radeon/radeon_prime.c1
-rw-r--r--drivers/gpu/drm/radeon/radeon_ring.c26
-rw-r--r--drivers/gpu/drm/radeon/radeon_semaphore.c4
-rw-r--r--drivers/gpu/drm/radeon/reg_srcs/rv5152
-rw-r--r--drivers/gpu/drm/radeon/rv770.c74
-rw-r--r--drivers/gpu/drm/radeon/si.c84
-rw-r--r--drivers/gpu/drm/radeon/sid.h18
-rw-r--r--drivers/gpu/drm/shmobile/shmob_drm_drv.c10
-rw-r--r--drivers/gpu/drm/tegra/dc.c11
-rw-r--r--drivers/gpu/drm/tegra/drm.h18
-rw-r--r--drivers/gpu/drm/tegra/hdmi.c25
-rw-r--r--drivers/gpu/drm/tegra/host1x.c2
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c1
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo_util.c15
-rw-r--r--drivers/gpu/drm/udl/udl_connector.c17
-rw-r--r--drivers/hid/hid-ids.h3
-rw-r--r--drivers/hid/i2c-hid/i2c-hid.c25
-rw-r--r--drivers/hid/usbhid/hid-quirks.c1
-rw-r--r--drivers/hsi/clients/hsi_char.c8
-rw-r--r--drivers/hv/hv_balloon.c35
-rw-r--r--drivers/hwmon/emc6w201.c2
-rw-r--r--drivers/hwmon/lm73.c16
-rw-r--r--drivers/hwmon/vexpress.c5
-rw-r--r--drivers/i2c/busses/i2c-ali1535.c8
-rw-r--r--drivers/i2c/busses/i2c-ali1563.c10
-rw-r--r--drivers/i2c/busses/i2c-ali15x3.c8
-rw-r--r--drivers/i2c/busses/i2c-amd756.c7
-rw-r--r--drivers/i2c/busses/i2c-amd8111.c7
-rw-r--r--drivers/i2c/busses/i2c-at91.c14
-rw-r--r--drivers/i2c/busses/i2c-au1550.c6
-rw-r--r--drivers/i2c/busses/i2c-cpm.c8
-rw-r--r--drivers/i2c/busses/i2c-designware-core.c4
-rw-r--r--drivers/i2c/busses/i2c-designware-pcidrv.c6
-rw-r--r--drivers/i2c/busses/i2c-designware-platdrv.c6
-rw-r--r--drivers/i2c/busses/i2c-eg20t.c6
-rw-r--r--drivers/i2c/busses/i2c-elektor.c8
-rw-r--r--drivers/i2c/busses/i2c-gpio.c8
-rw-r--r--drivers/i2c/busses/i2c-highlander.c6
-rw-r--r--drivers/i2c/busses/i2c-hydra.c6
-rw-r--r--drivers/i2c/busses/i2c-i801.c28
-rw-r--r--drivers/i2c/busses/i2c-ibm_iic.c8
-rw-r--r--drivers/i2c/busses/i2c-intel-mid.c6
-rw-r--r--drivers/i2c/busses/i2c-isch.c6
-rw-r--r--drivers/i2c/busses/i2c-mpc.c38
-rw-r--r--drivers/i2c/busses/i2c-mv64xxx.c18
-rw-r--r--drivers/i2c/busses/i2c-mxs.c12
-rw-r--r--drivers/i2c/busses/i2c-nforce2.c12
-rw-r--r--drivers/i2c/busses/i2c-nuc900.c6
-rw-r--r--drivers/i2c/busses/i2c-ocores.c6
-rw-r--r--drivers/i2c/busses/i2c-octeon.c10
-rw-r--r--drivers/i2c/busses/i2c-omap.c12
-rw-r--r--drivers/i2c/busses/i2c-parport-light.c6
-rw-r--r--drivers/i2c/busses/i2c-pasemi.c6
-rw-r--r--drivers/i2c/busses/i2c-pca-isa.c8
-rw-r--r--drivers/i2c/busses/i2c-pca-platform.c6
-rw-r--r--drivers/i2c/busses/i2c-piix4.c32
-rw-r--r--drivers/i2c/busses/i2c-pmcmsp.c6
-rw-r--r--drivers/i2c/busses/i2c-pnx.c6
-rw-r--r--drivers/i2c/busses/i2c-powermac.c16
-rw-r--r--drivers/i2c/busses/i2c-puv3.c6
-rw-r--r--drivers/i2c/busses/i2c-pxa-pci.c6
-rw-r--r--drivers/i2c/busses/i2c-rcar.c6
-rw-r--r--drivers/i2c/busses/i2c-s6000.c8
-rw-r--r--drivers/i2c/busses/i2c-sh7760.c8
-rw-r--r--drivers/i2c/busses/i2c-sh_mobile.c2
-rw-r--r--drivers/i2c/busses/i2c-sirf.c12
-rw-r--r--drivers/i2c/busses/i2c-sis5595.c4
-rw-r--r--drivers/i2c/busses/i2c-sis630.c8
-rw-r--r--drivers/i2c/busses/i2c-sis96x.c6
-rw-r--r--drivers/i2c/busses/i2c-tegra.c8
-rw-r--r--drivers/i2c/busses/i2c-via.c6
-rw-r--r--drivers/i2c/busses/i2c-viapro.c4
-rw-r--r--drivers/i2c/busses/i2c-viperboard.c6
-rw-r--r--drivers/i2c/busses/i2c-xiic.c8
-rw-r--r--drivers/i2c/busses/i2c-xlr.c6
-rw-r--r--drivers/i2c/busses/scx200_acb.c16
-rw-r--r--drivers/i2c/muxes/i2c-mux-gpio.c14
-rw-r--r--drivers/i2c/muxes/i2c-mux-pinctrl.c10
-rw-r--r--drivers/ide/aec62xx.c8
-rw-r--r--drivers/ide/alim15x3.c10
-rw-r--r--drivers/ide/amd74xx.c4
-rw-r--r--drivers/ide/atiixp.c4
-rw-r--r--drivers/ide/cmd64x.c4
-rw-r--r--drivers/ide/cs5520.c4
-rw-r--r--drivers/ide/cs5530.c6
-rw-r--r--drivers/ide/cs5535.c5
-rw-r--r--drivers/ide/cy82c693.c11
-rw-r--r--drivers/ide/delkin_cb.c5
-rw-r--r--drivers/ide/hpt366.c42
-rw-r--r--drivers/ide/icside.c15
-rw-r--r--drivers/ide/ide-pci-generic.c4
-rw-r--r--drivers/ide/ide_platform.c14
-rw-r--r--drivers/ide/it8172.c5
-rw-r--r--drivers/ide/it8213.c4
-rw-r--r--drivers/ide/it821x.c10
-rw-r--r--drivers/ide/jmicron.c4
-rw-r--r--drivers/ide/ns87415.c8
-rw-r--r--drivers/ide/opti621.c4
-rw-r--r--drivers/ide/palm_bk3710.c7
-rw-r--r--drivers/ide/pdc202xx_new.c10
-rw-r--r--drivers/ide/pdc202xx_old.c8
-rw-r--r--drivers/ide/piix.c8
-rw-r--r--drivers/ide/pmac.c16
-rw-r--r--drivers/ide/rapide.c7
-rw-r--r--drivers/ide/rz1000.c6
-rw-r--r--drivers/ide/sc1200.c4
-rw-r--r--drivers/ide/scc_pata.c20
-rw-r--r--drivers/ide/serverworks.c4
-rw-r--r--drivers/ide/sgiioc4.c13
-rw-r--r--drivers/ide/siimage.c13
-rw-r--r--drivers/ide/sis5513.c10
-rw-r--r--drivers/ide/sl82c105.c4
-rw-r--r--drivers/ide/slc90e66.c5
-rw-r--r--drivers/ide/tc86c001.c12
-rw-r--r--drivers/ide/triflex.c5
-rw-r--r--drivers/ide/trm290.c6
-rw-r--r--drivers/ide/via82cxxx.c8
-rw-r--r--drivers/idle/intel_idle.c5
-rw-r--r--drivers/iio/accel/Kconfig1
-rw-r--r--drivers/iio/accel/hid-sensor-accel-3d.c4
-rw-r--r--drivers/iio/adc/ad7266.c14
-rw-r--r--drivers/iio/adc/ad7298.c6
-rw-r--r--drivers/iio/adc/ad7476.c6
-rw-r--r--drivers/iio/adc/ad7791.c10
-rw-r--r--drivers/iio/adc/ad7887.c6
-rw-r--r--drivers/iio/adc/at91_adc.c8
-rw-r--r--drivers/iio/adc/lp8788_adc.c6
-rw-r--r--drivers/iio/adc/max1363.c23
-rw-r--r--drivers/iio/adc/ti_am335x_adc.c6
-rw-r--r--drivers/iio/adc/viperboard_adc.c6
-rw-r--r--drivers/iio/amplifiers/ad8366.c6
-rw-r--r--drivers/iio/common/hid-sensors/Kconfig13
-rw-r--r--drivers/iio/common/hid-sensors/Makefile3
-rw-r--r--drivers/iio/dac/ad5064.c18
-rw-r--r--drivers/iio/dac/ad5360.c8
-rw-r--r--drivers/iio/dac/ad5380.c28
-rw-r--r--drivers/iio/dac/ad5421.c6
-rw-r--r--drivers/iio/dac/ad5446.c24
-rw-r--r--drivers/iio/dac/ad5449.c6
-rw-r--r--drivers/iio/dac/ad5504.c12
-rw-r--r--drivers/iio/dac/ad5624r_spi.c12
-rw-r--r--drivers/iio/dac/ad5686.c12
-rw-r--r--drivers/iio/dac/ad5755.c16
-rw-r--r--drivers/iio/dac/ad5764.c6
-rw-r--r--drivers/iio/dac/ad5791.c19
-rw-r--r--drivers/iio/dac/max517.c6
-rw-r--r--drivers/iio/dac/mcp4725.c8
-rw-r--r--drivers/iio/frequency/ad9523.c6
-rw-r--r--drivers/iio/frequency/adf4350.c8
-rw-r--r--drivers/iio/gyro/Kconfig1
-rw-r--r--drivers/iio/gyro/hid-sensor-gyro-3d.c4
-rw-r--r--drivers/iio/light/Kconfig1
-rw-r--r--drivers/iio/light/adjd_s311.c8
-rw-r--r--drivers/iio/light/hid-sensor-als.c4
-rw-r--r--drivers/iio/light/lm3533-als.c19
-rw-r--r--drivers/iio/light/vcnl4000.c8
-rw-r--r--drivers/iio/magnetometer/Kconfig1
-rw-r--r--drivers/iio/magnetometer/hid-sensor-magn-3d.c4
-rw-r--r--drivers/infiniband/hw/amso1100/c2.c7
-rw-r--r--drivers/infiniband/hw/amso1100/c2.h8
-rw-r--r--drivers/infiniband/hw/amso1100/c2_pd.c4
-rw-r--r--drivers/infiniband/hw/amso1100/c2_qp.c4
-rw-r--r--drivers/infiniband/hw/amso1100/c2_rnic.c4
-rw-r--r--drivers/infiniband/hw/ehca/ehca_main.c6
-rw-r--r--drivers/infiniband/hw/ipath/ipath_driver.c12
-rw-r--r--drivers/infiniband/hw/mthca/mthca_main.c9
-rw-r--r--drivers/infiniband/hw/nes/nes.c6
-rw-r--r--drivers/infiniband/hw/qib/qib_init.c12
-rw-r--r--drivers/input/keyboard/gpio_keys.c13
-rw-r--r--drivers/input/keyboard/gpio_keys_polled.c13
-rw-r--r--drivers/input/keyboard/tca8418_keypad.c2
-rw-r--r--drivers/input/mouse/sentelic.c2
-rw-r--r--drivers/iommu/amd_iommu_init.c34
-rw-r--r--drivers/iommu/intel-iommu.c25
-rw-r--r--drivers/iommu/omap-iommu.c6
-rw-r--r--drivers/iommu/tegra-gart.c4
-rw-r--r--drivers/iommu/tegra-smmu.c4
-rw-r--r--drivers/isdn/gigaset/capi.c2
-rw-r--r--drivers/isdn/hardware/avm/b1pci.c8
-rw-r--r--drivers/isdn/hardware/avm/c4.c3
-rw-r--r--drivers/isdn/hardware/avm/t1pci.c3
-rw-r--r--drivers/isdn/hardware/eicon/divasmain.c9
-rw-r--r--drivers/isdn/hardware/mISDN/avmfritz.c10
-rw-r--r--drivers/isdn/hardware/mISDN/hfcmulti.c6
-rw-r--r--drivers/isdn/hardware/mISDN/hfcpci.c6
-rw-r--r--drivers/isdn/hardware/mISDN/mISDNinfineon.c16
-rw-r--r--drivers/isdn/hardware/mISDN/netjet.c10
-rw-r--r--drivers/isdn/hardware/mISDN/speedfax.c14
-rw-r--r--drivers/isdn/hardware/mISDN/w6692.c6
-rw-r--r--drivers/isdn/hisax/amd7930_fn.c3
-rw-r--r--drivers/isdn/hisax/asuscom.c9
-rw-r--r--drivers/isdn/hisax/avm_a1.c3
-rw-r--r--drivers/isdn/hisax/avm_a1p.c2
-rw-r--r--drivers/isdn/hisax/avm_pci.c17
-rw-r--r--drivers/isdn/hisax/avma1_cs.c12
-rw-r--r--drivers/isdn/hisax/bkm_a4t.c16
-rw-r--r--drivers/isdn/hisax/bkm_a8.c18
-rw-r--r--drivers/isdn/hisax/config.c26
-rw-r--r--drivers/isdn/hisax/diva.c31
-rw-r--r--drivers/isdn/hisax/elsa.c31
-rw-r--r--drivers/isdn/hisax/elsa_cs.c12
-rw-r--r--drivers/isdn/hisax/enternow_pci.c14
-rw-r--r--drivers/isdn/hisax/gazel.c11
-rw-r--r--drivers/isdn/hisax/hfc4s8s_l1.c16
-rw-r--r--drivers/isdn/hisax/hfc_pci.c4
-rw-r--r--drivers/isdn/hisax/hfc_sx.c9
-rw-r--r--drivers/isdn/hisax/hfcscard.c9
-rw-r--r--drivers/isdn/hisax/hisax_fcpcipnp.c22
-rw-r--r--drivers/isdn/hisax/icc.c3
-rw-r--r--drivers/isdn/hisax/isac.c7
-rw-r--r--drivers/isdn/hisax/isurf.c5
-rw-r--r--drivers/isdn/hisax/ix1_micro.c9
-rw-r--r--drivers/isdn/hisax/mic.c3
-rw-r--r--drivers/isdn/hisax/niccy.c6
-rw-r--r--drivers/isdn/hisax/nj_s.c14
-rw-r--r--drivers/isdn/hisax/nj_u.c14
-rw-r--r--drivers/isdn/hisax/s0box.c3
-rw-r--r--drivers/isdn/hisax/saphir.c3
-rw-r--r--drivers/isdn/hisax/sedlbauer.c23
-rw-r--r--drivers/isdn/hisax/sedlbauer_cs.c12
-rw-r--r--drivers/isdn/hisax/sportster.c6
-rw-r--r--drivers/isdn/hisax/teleint.c3
-rw-r--r--drivers/isdn/hisax/teles0.c3
-rw-r--r--drivers/isdn/hisax/teles3.c9
-rw-r--r--drivers/isdn/hisax/teles_cs.c12
-rw-r--r--drivers/isdn/hisax/telespci.c5
-rw-r--r--drivers/isdn/hisax/w6692.c5
-rw-r--r--drivers/isdn/hysdn/hysdn_init.c8
-rw-r--r--drivers/isdn/mISDN/core.c4
-rw-r--r--drivers/leds/leds-gpio.c5
-rw-r--r--drivers/macintosh/macio_asic.c6
-rw-r--r--drivers/macintosh/mediabay.c3
-rw-r--r--drivers/macintosh/rack-meter.c12
-rw-r--r--drivers/macintosh/windfarm_ad7417_sensor.c18
-rw-r--r--drivers/macintosh/windfarm_fcu_controls.c21
-rw-r--r--drivers/macintosh/windfarm_pm112.c4
-rw-r--r--drivers/macintosh/windfarm_pm121.c4
-rw-r--r--drivers/macintosh/windfarm_pm72.c2
-rw-r--r--drivers/macintosh/windfarm_pm81.c4
-rw-r--r--drivers/macintosh/windfarm_pm91.c4
-rw-r--r--drivers/macintosh/windfarm_rm31.c2
-rw-r--r--drivers/md/dm-raid.c101
-rw-r--r--drivers/md/dm-thin.c13
-rw-r--r--drivers/md/dm.c6
-rw-r--r--drivers/media/i2c/adv7180.c8
-rw-r--r--drivers/media/i2c/adv7183.c2
-rw-r--r--drivers/media/i2c/as3645a.c10
-rw-r--r--drivers/media/i2c/m5mols/m5mols_core.c10
-rw-r--r--drivers/media/i2c/vs6624.c6
-rw-r--r--drivers/media/mmc/siano/smssdio.c4
-rw-r--r--drivers/media/pci/bt8xx/bt878.c11
-rw-r--r--drivers/media/pci/bt8xx/bttv-cards.c34
-rw-r--r--drivers/media/pci/bt8xx/bttv-driver.c9
-rw-r--r--drivers/media/pci/bt8xx/bttv-i2c.c6
-rw-r--r--drivers/media/pci/bt8xx/bttv-input.c4
-rw-r--r--drivers/media/pci/bt8xx/dvb-bt8xx.c7
-rw-r--r--drivers/media/pci/cx18/cx18-driver.c14
-rw-r--r--drivers/media/pci/cx23885/cx23885-core.c8
-rw-r--r--drivers/media/pci/cx25821/cx25821-core.c8
-rw-r--r--drivers/media/pci/cx88/cx88-alsa.c19
-rw-r--r--drivers/media/pci/cx88/cx88-mpeg.c8
-rw-r--r--drivers/media/pci/cx88/cx88-video.c8
-rw-r--r--drivers/media/pci/ddbridge/ddbridge-core.c9
-rw-r--r--drivers/media/pci/dm1105/dm1105.c20
-rw-r--r--drivers/media/pci/ivtv/ivtv-driver.c9
-rw-r--r--drivers/media/pci/mantis/hopper_cards.c9
-rw-r--r--drivers/media/pci/mantis/mantis_cards.c9
-rw-r--r--drivers/media/pci/mantis/mantis_dvb.c4
-rw-r--r--drivers/media/pci/mantis/mantis_i2c.c2
-rw-r--r--drivers/media/pci/mantis/mantis_pci.c2
-rw-r--r--drivers/media/pci/meye/meye.c7
-rw-r--r--drivers/media/pci/ngene/ngene-cards.c4
-rw-r--r--drivers/media/pci/ngene/ngene-core.c5
-rw-r--r--drivers/media/pci/ngene/ngene.h5
-rw-r--r--drivers/media/pci/pluto2/pluto2.c25
-rw-r--r--drivers/media/pci/pt1/pt1.c7
-rw-r--r--drivers/media/pci/saa7134/saa7134-core.c10
-rw-r--r--drivers/media/pci/saa7134/saa7134.h2
-rw-r--r--drivers/media/pci/saa7164/saa7164-core.c8
-rw-r--r--drivers/media/pci/sta2x11/sta2x11_vip.c8
-rw-r--r--drivers/media/pci/ttpci/av7110.c8
-rw-r--r--drivers/media/pci/ttpci/av7110_ir.c4
-rw-r--r--drivers/media/pci/zoran/zoran_card.c20
-rw-r--r--drivers/media/pci/zoran/zoran_driver.c2
-rw-r--r--drivers/media/platform/blackfin/bfin_capture.c6
-rw-r--r--drivers/media/platform/coda.c6
-rw-r--r--drivers/media/platform/davinci/dm355_ccdc.c4
-rw-r--r--drivers/media/platform/davinci/dm644x_ccdc.c4
-rw-r--r--drivers/media/platform/davinci/isif.c4
-rw-r--r--drivers/media/platform/davinci/vpbe.c2
-rw-r--r--drivers/media/platform/davinci/vpbe_display.c15
-rw-r--r--drivers/media/platform/davinci/vpfe_capture.c6
-rw-r--r--drivers/media/platform/davinci/vpif.c6
-rw-r--r--drivers/media/platform/davinci/vpss.c6
-rw-r--r--drivers/media/platform/exynos-gsc/gsc-core.c4
-rw-r--r--drivers/media/platform/fsl-viu.c6
-rw-r--r--drivers/media/platform/omap24xxcam.c2
-rw-r--r--drivers/media/platform/omap3isp/isp.c8
-rw-r--r--drivers/media/platform/omap3isp/ispvideo.c3
-rw-r--r--drivers/media/platform/s3c-camif/camif-core.c4
-rw-r--r--drivers/media/platform/s5p-fimc/fimc-core.c4
-rw-r--r--drivers/media/platform/s5p-fimc/fimc-lite.c6
-rw-r--r--drivers/media/platform/s5p-fimc/fimc-mdevice.c6
-rw-r--r--drivers/media/platform/s5p-fimc/mipi-csis.c6
-rw-r--r--drivers/media/platform/s5p-mfc/s5p_mfc.c92
-rw-r--r--drivers/media/platform/s5p-tv/hdmi_drv.c6
-rw-r--r--drivers/media/platform/s5p-tv/hdmiphy_drv.c8
-rw-r--r--drivers/media/platform/s5p-tv/mixer.h2
-rw-r--r--drivers/media/platform/s5p-tv/mixer_drv.c18
-rw-r--r--drivers/media/platform/s5p-tv/mixer_video.c4
-rw-r--r--drivers/media/platform/s5p-tv/sdo_drv.c6
-rw-r--r--drivers/media/platform/s5p-tv/sii9234_drv.c8
-rw-r--r--drivers/media/platform/sh_vou.c6
-rw-r--r--drivers/media/platform/soc_camera/atmel-isi.c6
-rw-r--r--drivers/media/platform/soc_camera/mx2_camera.c8
-rw-r--r--drivers/media/platform/soc_camera/mx3_camera.c6
-rw-r--r--drivers/media/platform/soc_camera/pxa_camera.c6
-rw-r--r--drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c6
-rw-r--r--drivers/media/platform/soc_camera/sh_mobile_csi2.c6
-rw-r--r--drivers/media/platform/soc_camera/soc_camera.c6
-rw-r--r--drivers/media/platform/timblogiw.c12
-rw-r--r--drivers/media/platform/via-camera.c6
-rw-r--r--drivers/media/radio/radio-maxiradio.c7
-rw-r--r--drivers/media/radio/radio-sf16fmi.c2
-rw-r--r--drivers/media/radio/radio-sf16fmr2.c19
-rw-r--r--drivers/media/radio/radio-tea5764.c8
-rw-r--r--drivers/media/radio/radio-timb.c6
-rw-r--r--drivers/media/radio/radio-wl1273.c4
-rw-r--r--drivers/media/radio/saa7706h.c8
-rw-r--r--drivers/media/radio/si470x/radio-si470x-i2c.c8
-rw-r--r--drivers/media/radio/tef6862.c8
-rw-r--r--drivers/media/rc/ene_ir.c2
-rw-r--r--drivers/media/rc/fintek-cir.c4
-rw-r--r--drivers/media/rc/gpio-ir-recv.c6
-rw-r--r--drivers/media/rc/iguanair.c8
-rw-r--r--drivers/media/rc/imon.c8
-rw-r--r--drivers/media/rc/ir-rx51.c2
-rw-r--r--drivers/media/rc/ite-cir.c4
-rw-r--r--drivers/media/rc/mceusb.c8
-rw-r--r--drivers/media/rc/nuvoton-cir.c4
-rw-r--r--drivers/media/rc/redrat3.c8
-rw-r--r--drivers/media/rc/streamzap.c4
-rw-r--r--drivers/media/rc/ttusbir.c8
-rw-r--r--drivers/media/rc/winbond-cir.c6
-rw-r--r--drivers/media/usb/gspca/kinect.c1
-rw-r--r--drivers/media/usb/gspca/sonixb.c13
-rw-r--r--drivers/media/usb/gspca/sonixj.c1
-rw-r--r--drivers/media/usb/gspca/spca506.c3
-rw-r--r--drivers/media/usb/siano/smsusb.c2
-rw-r--r--drivers/media/usb/usbvision/usbvision-video.c10
-rw-r--r--drivers/media/usb/uvc/uvc_ctrl.c15
-rw-r--r--drivers/media/usb/uvc/uvc_v4l2.c18
-rw-r--r--drivers/media/v4l2-core/videobuf2-core.c4
-rw-r--r--drivers/memory/tegra20-mc.c4
-rw-r--r--drivers/memory/tegra30-mc.c4
-rw-r--r--drivers/message/fusion/mptfc.c7
-rw-r--r--drivers/message/fusion/mptsas.c4
-rw-r--r--drivers/message/fusion/mptspi.c2
-rw-r--r--drivers/message/i2o/pci.c11
-rw-r--r--drivers/mfd/Kconfig2
-rw-r--r--drivers/mfd/ab8500-core.c1
-rw-r--r--drivers/mfd/arizona-core.c7
-rw-r--r--drivers/mfd/arizona-irq.c18
-rw-r--r--drivers/mfd/da9052-i2c.c61
-rw-r--r--drivers/mfd/db8500-prcmu.c13
-rw-r--r--drivers/mfd/max77686.c18
-rw-r--r--drivers/mfd/max77693.c34
-rw-r--r--drivers/mfd/max8997.c2
-rw-r--r--drivers/mfd/pcf50633-core.c5
-rw-r--r--drivers/mfd/retu-mfd.c5
-rw-r--r--drivers/mfd/rtl8411.c29
-rw-r--r--drivers/mfd/rts5209.c21
-rw-r--r--drivers/mfd/rts5229.c21
-rw-r--r--drivers/mfd/rtsx_pcr.c35
-rw-r--r--drivers/mfd/sta2x11-mfd.c8
-rw-r--r--drivers/mfd/stmpe.c15
-rw-r--r--drivers/mfd/tc3589x.c17
-rw-r--r--drivers/mfd/ti_am335x_tscadc.c6
-rw-r--r--drivers/mfd/tps80031.c11
-rw-r--r--drivers/mfd/twl4030-power.c2
-rw-r--r--drivers/mfd/twl6040.c8
-rw-r--r--drivers/mfd/vexpress-config.c8
-rw-r--r--drivers/mfd/vexpress-sysreg.c34
-rw-r--r--drivers/mfd/wm5102-tables.c2
-rw-r--r--drivers/misc/atmel-ssc.c8
-rw-r--r--drivers/misc/mei/amthif.c6
-rw-r--r--drivers/misc/ti-st/st_kim.c37
-rw-r--r--drivers/mmc/host/dw_mmc-pci.c2
-rw-r--r--drivers/mmc/host/dw_mmc-pltfm.c2
-rw-r--r--drivers/mmc/host/mvsdio.c92
-rw-r--r--drivers/mmc/host/rtsx_pci_sdmmc.c30
-rw-r--r--drivers/mmc/host/sdhci-acpi.c6
-rw-r--r--drivers/mmc/host/wmt-sdmmc.c4
-rw-r--r--drivers/mtd/devices/mtd_dataflash.c10
-rw-r--r--drivers/mtd/devices/spear_smi.c4
-rw-r--r--drivers/mtd/maps/esb2rom.c2
-rw-r--r--drivers/mtd/maps/intel_vr_nor.c3
-rw-r--r--drivers/mtd/maps/pci.c6
-rw-r--r--drivers/mtd/maps/physmap_of.c2
-rw-r--r--drivers/mtd/maps/pismo.c15
-rw-r--r--drivers/mtd/maps/scb2_flash.c10
-rw-r--r--drivers/mtd/nand/atmel_nand.c6
-rw-r--r--drivers/mtd/nand/bcm47xxnflash/main.c4
-rw-r--r--drivers/mtd/nand/fsl_upm.c4
-rw-r--r--drivers/mtd/nand/fsmc_nand.c4
-rw-r--r--drivers/mtd/nand/gpmi-nand/gpmi-nand.c7
-rw-r--r--drivers/mtd/nand/jz4740_nand.c3
-rw-r--r--drivers/net/can/c_can/c_can.c4
-rw-r--r--drivers/net/can/pch_can.c2
-rw-r--r--drivers/net/can/ti_hecc.c4
-rw-r--r--drivers/net/ethernet/3com/3c574_cs.c2
-rw-r--r--drivers/net/ethernet/adi/Kconfig1
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c30
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c2
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c60
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c62
-rw-r--r--drivers/net/ethernet/calxeda/xgmac.c4
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c17
-rw-r--r--drivers/net/ethernet/emulex/benet/be.h1
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c29
-rw-r--r--drivers/net/ethernet/intel/ixgbe/Makefile3
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_debugfs.c5
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c4
-rw-r--r--drivers/net/ethernet/marvell/mvmdio.c6
-rw-r--r--drivers/net/ethernet/marvell/mvneta.c19
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_tx.c13
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c11
-rw-r--r--drivers/net/ethernet/nvidia/forcedeth.c35
-rw-r--r--drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c2
-rw-r--r--drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c2
-rw-r--r--drivers/net/ethernet/qlogic/qlge/qlge_main.c2
-rw-r--r--drivers/net/ethernet/realtek/r8169.c21
-rw-r--r--drivers/net/ethernet/ti/cpts.c3
-rw-r--r--drivers/net/ethernet/ti/cpts.h1
-rw-r--r--drivers/net/ethernet/xilinx/Kconfig2
-rw-r--r--drivers/net/ethernet/xilinx/xilinx_axienet_main.c2
-rw-r--r--drivers/net/hyperv/hyperv_net.h2
-rw-r--r--drivers/net/hyperv/netvsc_drv.c2
-rw-r--r--drivers/net/loopback.c5
-rw-r--r--drivers/net/macvlan.c5
-rw-r--r--drivers/net/phy/icplus.c29
-rw-r--r--drivers/net/phy/marvell.c9
-rw-r--r--drivers/net/tun.c113
-rw-r--r--drivers/net/usb/cdc_mbim.c19
-rw-r--r--drivers/net/usb/cdc_ncm.c31
-rw-r--r--drivers/net/usb/dm9601.c52
-rw-r--r--drivers/net/usb/qmi_wwan.c3
-rw-r--r--drivers/net/usb/usbnet.c4
-rw-r--r--drivers/net/virtio_net.c118
-rw-r--r--drivers/net/vxlan.c7
-rw-r--r--drivers/net/wireless/ath/Kconfig1
-rw-r--r--drivers/net/wireless/ath/Makefile1
-rw-r--r--drivers/net/wireless/ath/ath9k/Kconfig5
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_calib.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_hw.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_phy.c27
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h3
-rw-r--r--drivers/net/wireless/ath/ath9k/beacon.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.c1
-rw-r--r--drivers/net/wireless/ath/ath9k/debug.h2
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_hst.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c22
-rw-r--r--drivers/net/wireless/ath/ath9k/recv.c54
-rw-r--r--drivers/net/wireless/ath/carl9170/fw.c6
-rw-r--r--drivers/net/wireless/ath/wil6210/Kconfig29
-rw-r--r--drivers/net/wireless/ath/wil6210/Makefile13
-rw-r--r--drivers/net/wireless/ath/wil6210/cfg80211.c573
-rw-r--r--drivers/net/wireless/ath/wil6210/dbg_hexdump.h30
-rw-r--r--drivers/net/wireless/ath/wil6210/debugfs.c603
-rw-r--r--drivers/net/wireless/ath/wil6210/interrupt.c471
-rw-r--r--drivers/net/wireless/ath/wil6210/main.c407
-rw-r--r--drivers/net/wireless/ath/wil6210/netdev.c157
-rw-r--r--drivers/net/wireless/ath/wil6210/pcie_bus.c223
-rw-r--r--drivers/net/wireless/ath/wil6210/txrx.c871
-rw-r--r--drivers/net/wireless/ath/wil6210/txrx.h362
-rw-r--r--drivers/net/wireless/ath/wil6210/wil6210.h363
-rw-r--r--drivers/net/wireless/ath/wil6210/wmi.c975
-rw-r--r--drivers/net/wireless/ath/wil6210/wmi.h1116
-rw-r--r--drivers/net/wireless/b43/b43.h5
-rw-r--r--drivers/net/wireless/b43/main.c54
-rw-r--r--drivers/net/wireless/b43/main.h5
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c5
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/debug.h1
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c7
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c4
-rw-r--r--drivers/net/wireless/iwlegacy/3945-mac.c2
-rw-r--r--drivers/net/wireless/iwlegacy/common.c35
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/tx.c26
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/rx.c1
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c19
-rw-r--r--drivers/net/wireless/mwifiex/pcie.c2
-rw-r--r--drivers/net/wireless/mwifiex/sta_ioctl.c35
-rw-r--r--drivers/net/wireless/mwl8k.c4
-rw-r--r--drivers/net/wireless/p54/p54usb.c4
-rw-r--r--drivers/net/wireless/rtlwifi/Kconfig4
-rw-r--r--drivers/net/wireless/rtlwifi/pci.c6
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/trx.c11
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/trx.c10
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/trx.c13
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8723ae/phy.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8723ae/sw.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8723ae/trx.c10
-rw-r--r--drivers/net/wireless/rtlwifi/usb.c8
-rw-r--r--drivers/net/xen-netfront.c27
-rw-r--r--drivers/nfc/pn544/i2c.c8
-rw-r--r--drivers/parisc/dino.c2
-rw-r--r--drivers/parisc/lba_pci.c2
-rw-r--r--drivers/parport/parport_gsc.c23
-rw-r--r--drivers/parport/parport_pc.c55
-rw-r--r--drivers/parport/parport_serial.c21
-rw-r--r--drivers/parport/parport_sunbpp.c6
-rw-r--r--drivers/pci/hotplug/pciehp.h2
-rw-r--r--drivers/pci/hotplug/pciehp_core.c11
-rw-r--r--drivers/pci/hotplug/pciehp_ctrl.c8
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c11
-rw-r--r--drivers/pci/hotplug/shpchp.h3
-rw-r--r--drivers/pci/hotplug/shpchp_core.c36
-rw-r--r--drivers/pci/hotplug/shpchp_ctrl.c6
-rw-r--r--drivers/pci/iov.c2
-rw-r--r--drivers/pci/pci-sysfs.c85
-rw-r--r--drivers/pci/pcie/Kconfig2
-rw-r--r--drivers/pci/pcie/aer/aerdrv_core.c1
-rw-r--r--drivers/pci/pcie/aspm.c3
-rw-r--r--drivers/pci/pcie/portdrv_pci.c20
-rw-r--r--drivers/pci/quirks.c7
-rw-r--r--drivers/pinctrl/Kconfig1
-rw-r--r--drivers/pinctrl/core.c2
-rw-r--r--drivers/pinctrl/mvebu/pinctrl-armada-370.c8
-rw-r--r--drivers/pinctrl/mvebu/pinctrl-armada-xp.c8
-rw-r--r--drivers/pinctrl/mvebu/pinctrl-dove.c17
-rw-r--r--drivers/pinctrl/mvebu/pinctrl-kirkwood.c16
-rw-r--r--drivers/pinctrl/mvebu/pinctrl-mvebu.c11
-rw-r--r--drivers/pinctrl/pinctrl-at91.c39
-rw-r--r--drivers/pinctrl/pinctrl-bcm2835.c2
-rw-r--r--drivers/pinctrl/pinctrl-exynos5440.c12
-rw-r--r--drivers/pinctrl/pinctrl-imx.c19
-rw-r--r--drivers/pinctrl/pinctrl-imx23.c2
-rw-r--r--drivers/pinctrl/pinctrl-imx28.c2
-rw-r--r--drivers/pinctrl/pinctrl-imx35.c2
-rw-r--r--drivers/pinctrl/pinctrl-imx51.c2
-rw-r--r--drivers/pinctrl/pinctrl-imx53.c4
-rw-r--r--drivers/pinctrl/pinctrl-imx6q.c2
-rw-r--r--drivers/pinctrl/pinctrl-mmp2.c2
-rw-r--r--drivers/pinctrl/pinctrl-mxs.c23
-rw-r--r--drivers/pinctrl/pinctrl-nomadik-db8500.c3
-rw-r--r--drivers/pinctrl/pinctrl-nomadik-db8540.c3
-rw-r--r--drivers/pinctrl/pinctrl-nomadik-stn8815.c3
-rw-r--r--drivers/pinctrl/pinctrl-nomadik.c17
-rw-r--r--drivers/pinctrl/pinctrl-pxa168.c2
-rw-r--r--drivers/pinctrl/pinctrl-pxa910.c2
-rw-r--r--drivers/pinctrl/pinctrl-samsung.c26
-rw-r--r--drivers/pinctrl/pinctrl-single.c86
-rw-r--r--drivers/pinctrl/pinctrl-sirf.c52
-rw-r--r--drivers/pinctrl/pinctrl-tegra.c2
-rw-r--r--drivers/pinctrl/pinctrl-tegra20.c2
-rw-r--r--drivers/pinctrl/pinctrl-tegra30.c2
-rw-r--r--drivers/pinctrl/pinctrl-u300.c2
-rw-r--r--drivers/pinctrl/pinctrl-xway.c2
-rw-r--r--drivers/pinctrl/spear/pinctrl-plgpio.c5
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear.c11
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear.h11
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear1310.c2
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear1340.c2
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear300.c2
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear310.c2
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear320.c2
-rw-r--r--drivers/platform/x86/acer-wmi.c68
-rw-r--r--drivers/platform/x86/acerhdf.c2
-rw-r--r--drivers/platform/x86/amilo-rfkill.c4
-rw-r--r--drivers/platform/x86/apple-gmux.c7
-rw-r--r--drivers/platform/x86/asus-laptop.c25
-rw-r--r--drivers/platform/x86/compal-laptop.c10
-rw-r--r--drivers/platform/x86/dell-laptop.c4
-rw-r--r--drivers/platform/x86/eeepc-laptop.c6
-rw-r--r--drivers/platform/x86/fujitsu-tablet.c17
-rw-r--r--drivers/platform/x86/hp-wmi.c8
-rw-r--r--drivers/platform/x86/ibm_rtl.c2
-rw-r--r--drivers/platform/x86/ideapad-laptop.c13
-rw-r--r--drivers/platform/x86/intel_mid_powerbtn.c6
-rw-r--r--drivers/platform/x86/intel_mid_thermal.c2
-rw-r--r--drivers/platform/x86/intel_oaktrail.c6
-rw-r--r--drivers/platform/x86/intel_pmic_gpio.c2
-rw-r--r--drivers/platform/x86/samsung-laptop.c14
-rw-r--r--drivers/platform/x86/samsung-q10.c6
-rw-r--r--drivers/platform/x86/sony-laptop.c15
-rw-r--r--drivers/platform/x86/tc1100-wmi.c4
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c4
-rw-r--r--drivers/platform/x86/toshiba_acpi.c13
-rw-r--r--drivers/platform/x86/xo1-rfkill.c6
-rw-r--r--drivers/pnp/interface.c105
-rw-r--r--drivers/pnp/manager.c25
-rw-r--r--drivers/power/ab8500_bmdata.c6
-rw-r--r--drivers/power/avs/smartreflex.c2
-rw-r--r--drivers/power/olpc_battery.c2
-rw-r--r--drivers/power/reset/gpio-poweroff.c39
-rw-r--r--drivers/power/rx51_battery.c6
-rw-r--r--drivers/pps/clients/pps-gpio.c2
-rw-r--r--drivers/ps3/ps3-lpm.c2
-rw-r--r--drivers/ps3/ps3-sys-manager.c2
-rw-r--r--drivers/ps3/ps3av.c2
-rw-r--r--drivers/regulator/anatop-regulator.c2
-rw-r--r--drivers/regulator/core.c15
-rw-r--r--drivers/regulator/da9055-regulator.c12
-rw-r--r--drivers/regulator/dbx500-prcmu.c1
-rw-r--r--drivers/regulator/fixed.c2
-rw-r--r--drivers/regulator/gpio-regulator.c2
-rw-r--r--drivers/regulator/max8973-regulator.c12
-rw-r--r--drivers/regulator/max8997.c36
-rw-r--r--drivers/regulator/max8998.c44
-rw-r--r--drivers/regulator/palmas-regulator.c2
-rw-r--r--drivers/regulator/s5m8767.c4
-rw-r--r--drivers/regulator/tps80031-regulator.c2
-rw-r--r--drivers/regulator/twl-regulator.c2
-rw-r--r--drivers/remoteproc/omap_remoteproc.c6
-rw-r--r--drivers/rpmsg/virtio_rpmsg_bus.c4
-rw-r--r--drivers/rtc/Kconfig8
-rw-r--r--drivers/rtc/Makefile1
-rw-r--r--drivers/rtc/rtc-88pm80x.c6
-rw-r--r--drivers/rtc/rtc-88pm860x.c10
-rw-r--r--drivers/rtc/rtc-ab8500.c6
-rw-r--r--drivers/rtc/rtc-at91sam9.c6
-rw-r--r--drivers/rtc/rtc-au1xxx.c6
-rw-r--r--drivers/rtc/rtc-bfin.c6
-rw-r--r--drivers/rtc/rtc-bq32k.c4
-rw-r--r--drivers/rtc/rtc-bq4802.c6
-rw-r--r--drivers/rtc/rtc-cmos.c9
-rw-r--r--drivers/rtc/rtc-da9052.c6
-rw-r--r--drivers/rtc/rtc-da9055.c2
-rw-r--r--drivers/rtc/rtc-davinci.c4
-rw-r--r--drivers/rtc/rtc-dm355evm.c6
-rw-r--r--drivers/rtc/rtc-ds1286.c6
-rw-r--r--drivers/rtc/rtc-ds1302.c4
-rw-r--r--drivers/rtc/rtc-ds1305.c6
-rw-r--r--drivers/rtc/rtc-ds1307.c8
-rw-r--r--drivers/rtc/rtc-ds1374.c4
-rw-r--r--drivers/rtc/rtc-ds1390.c6
-rw-r--r--drivers/rtc/rtc-ds1511.c8
-rw-r--r--drivers/rtc/rtc-ds1553.c6
-rw-r--r--drivers/rtc/rtc-ds1742.c6
-rw-r--r--drivers/rtc/rtc-ds3232.c8
-rw-r--r--drivers/rtc/rtc-ds3234.c6
-rw-r--r--drivers/rtc/rtc-ep93xx.c6
-rw-r--r--drivers/rtc/rtc-fm3130.c8
-rw-r--r--drivers/rtc/rtc-imxdi.c4
-rw-r--r--drivers/rtc/rtc-jz4740.c6
-rw-r--r--drivers/rtc/rtc-lpc32xx.c6
-rw-r--r--drivers/rtc/rtc-ls1x.c6
-rw-r--r--drivers/rtc/rtc-m41t93.c6
-rw-r--r--drivers/rtc/rtc-m41t94.c6
-rw-r--r--drivers/rtc/rtc-m48t35.c6
-rw-r--r--drivers/rtc/rtc-m48t59.c6
-rw-r--r--drivers/rtc/rtc-m48t86.c6
-rw-r--r--drivers/rtc/rtc-max6902.c6
-rw-r--r--drivers/rtc/rtc-max8907.c6
-rw-r--r--drivers/rtc/rtc-max8925.c6
-rw-r--r--drivers/rtc/rtc-max8998.c6
-rw-r--r--drivers/rtc/rtc-mpc5121.c8
-rw-r--r--drivers/rtc/rtc-mrst.c12
-rw-r--r--drivers/rtc/rtc-mv.c2
-rw-r--r--drivers/rtc/rtc-mxc.c6
-rw-r--r--drivers/rtc/rtc-nuc900.c6
-rw-r--r--drivers/rtc/rtc-pcap.c6
-rw-r--r--drivers/rtc/rtc-pcf2123.c6
-rw-r--r--drivers/rtc/rtc-pcf50633.c6
-rw-r--r--drivers/rtc/rtc-pcf8563.c2
-rw-r--r--drivers/rtc/rtc-pcf8583.c4
-rw-r--r--drivers/rtc/rtc-pm8xxx.c6
-rw-r--r--drivers/rtc/rtc-puv3.c6
-rw-r--r--drivers/rtc/rtc-r9701.c6
-rw-r--r--drivers/rtc/rtc-rc5t583.c6
-rw-r--r--drivers/rtc/rtc-rs5c313.c4
-rw-r--r--drivers/rtc/rtc-rs5c348.c6
-rw-r--r--drivers/rtc/rtc-rv3029c2.c8
-rw-r--r--drivers/rtc/rtc-rx8025.c8
-rw-r--r--drivers/rtc/rtc-rx8581.c8
-rw-r--r--drivers/rtc/rtc-s3c.c6
-rw-r--r--drivers/rtc/rtc-snvs.c8
-rw-r--r--drivers/rtc/rtc-spear.c6
-rw-r--r--drivers/rtc/rtc-stk17ta8.c6
-rw-r--r--drivers/rtc/rtc-tegra.c13
-rw-r--r--drivers/rtc/rtc-test.c4
-rw-r--r--drivers/rtc/rtc-tile.c6
-rw-r--r--drivers/rtc/rtc-tps6586x.c356
-rw-r--r--drivers/rtc/rtc-tps65910.c6
-rw-r--r--drivers/rtc/rtc-twl.c6
-rw-r--r--drivers/rtc/rtc-vr41xx.c6
-rw-r--r--drivers/rtc/rtc-vt8500.c17
-rw-r--r--drivers/rtc/rtc-wm831x.c4
-rw-r--r--drivers/rtc/rtc-wm8350.c4
-rw-r--r--drivers/s390/block/dasd_diag.c2
-rw-r--r--drivers/s390/block/dasd_eckd.c2
-rw-r--r--drivers/s390/block/dasd_fba.c2
-rw-r--r--drivers/s390/char/con3215.c8
-rw-r--r--drivers/s390/char/raw3270.c2
-rw-r--r--drivers/s390/char/sclp.c4
-rw-r--r--drivers/s390/char/tape_34xx.c2
-rw-r--r--drivers/s390/char/tape_3590.c2
-rw-r--r--drivers/s390/char/vmur.c2
-rw-r--r--drivers/s390/cio/chsc.c31
-rw-r--r--drivers/s390/cio/chsc_sch.c2
-rw-r--r--drivers/s390/cio/cio.c10
-rw-r--r--drivers/s390/cio/device.c12
-rw-r--r--drivers/s390/cio/device.h5
-rw-r--r--drivers/s390/cio/eadm_sch.c2
-rw-r--r--drivers/s390/cio/qdio_thinint.c2
-rw-r--r--drivers/s390/crypto/ap_bus.c2
-rw-r--r--drivers/s390/kvm/kvm_virtio.c2
-rw-r--r--drivers/s390/net/claw.c2
-rw-r--r--drivers/s390/net/ctcm_main.c2
-rw-r--r--drivers/s390/net/lcs.c2
-rw-r--r--drivers/sbus/char/bbc_i2c.c6
-rw-r--r--drivers/sbus/char/display7seg.c6
-rw-r--r--drivers/sbus/char/envctrl.c6
-rw-r--r--drivers/sbus/char/flash.c6
-rw-r--r--drivers/sbus/char/uctrl.c6
-rw-r--r--drivers/scsi/3w-9xxx.c4
-rw-r--r--drivers/scsi/3w-sas.c4
-rw-r--r--drivers/scsi/3w-xxxx.c4
-rw-r--r--drivers/scsi/BusLogic.c2
-rw-r--r--drivers/scsi/NCR5380.c2
-rw-r--r--drivers/scsi/NCR_D700.c12
-rw-r--r--drivers/scsi/NCR_Q720.c2
-rw-r--r--drivers/scsi/a100u2w.c8
-rw-r--r--drivers/scsi/a2091.c9
-rw-r--r--drivers/scsi/aacraid/linit.c15
-rw-r--r--drivers/scsi/advansys.c152
-rw-r--r--drivers/scsi/aha152x.c2
-rw-r--r--drivers/scsi/aha1740.c4
-rw-r--r--drivers/scsi/aic94xx/aic94xx_init.c23
-rw-r--r--drivers/scsi/arm/acornscsi.c7
-rw-r--r--drivers/scsi/arm/arxescsi.c7
-rw-r--r--drivers/scsi/arm/cumana_1.c8
-rw-r--r--drivers/scsi/arm/cumana_2.c8
-rw-r--r--drivers/scsi/arm/eesox.c7
-rw-r--r--drivers/scsi/arm/oak.c7
-rw-r--r--drivers/scsi/arm/powertec.c8
-rw-r--r--drivers/scsi/atp870u.c2
-rw-r--r--drivers/scsi/be2iscsi/be_main.c4
-rw-r--r--drivers/scsi/bfa/bfad.c2
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc_fcoe.c2
-rw-r--r--drivers/scsi/bnx2i/bnx2i_init.c2
-rw-r--r--drivers/scsi/bvme6000_scsi.c6
-rw-r--r--drivers/scsi/csiostor/csio_init.c17
-rw-r--r--drivers/scsi/dc395x.c51
-rw-r--r--drivers/scsi/dmx3191d.c8
-rw-r--r--drivers/scsi/fdomain.c2
-rw-r--r--drivers/scsi/fnic/fnic_main.c7
-rw-r--r--drivers/scsi/g_NCR5380.c2
-rw-r--r--drivers/scsi/gdth.c17
-rw-r--r--drivers/scsi/gvp11.c11
-rw-r--r--drivers/scsi/hpsa.c92
-rw-r--r--drivers/scsi/hptiop.c3
-rw-r--r--drivers/scsi/ibmvscsi/ibmvfc.c2
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c2
-rw-r--r--drivers/scsi/ibmvscsi/ibmvstgt.c2
-rw-r--r--drivers/scsi/initio.c2
-rw-r--r--drivers/scsi/ipr.c32
-rw-r--r--drivers/scsi/ips.c10
-rw-r--r--drivers/scsi/isci/init.c10
-rw-r--r--drivers/scsi/jazz_esp.c6
-rw-r--r--drivers/scsi/lasi700.c2
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c14
-rw-r--r--drivers/scsi/mac_esp.c6
-rw-r--r--drivers/scsi/megaraid.c6
-rw-r--r--drivers/scsi/megaraid/megaraid_mbox.c6
-rw-r--r--drivers/scsi/megaraid/megaraid_sas_base.c8
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_scsih.c4
-rw-r--r--drivers/scsi/mpt3sas/mpt3sas_scsih.c5
-rw-r--r--drivers/scsi/mvme16x_scsi.c8
-rw-r--r--drivers/scsi/mvsas/mv_64xx.c8
-rw-r--r--drivers/scsi/mvsas/mv_94xx.c7
-rw-r--r--drivers/scsi/mvsas/mv_chips.h2
-rw-r--r--drivers/scsi/mvsas/mv_init.c19
-rw-r--r--drivers/scsi/mvsas/mv_sas.c4
-rw-r--r--drivers/scsi/mvsas/mv_sas.h4
-rw-r--r--drivers/scsi/mvumi.c5
-rw-r--r--drivers/scsi/nsp32.c16
-rw-r--r--drivers/scsi/pm8001/pm8001_hwi.c36
-rw-r--r--drivers/scsi/pm8001/pm8001_init.c28
-rw-r--r--drivers/scsi/pmcraid.c31
-rw-r--r--drivers/scsi/ps3rom.c2
-rw-r--r--drivers/scsi/qla1280.c8
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c2
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c6
-rw-r--r--drivers/scsi/qlogicfas.c2
-rw-r--r--drivers/scsi/qlogicpti.c20
-rw-r--r--drivers/scsi/sgiwd93.c4
-rw-r--r--drivers/scsi/sim710.c11
-rw-r--r--drivers/scsi/sni_53c710.c4
-rw-r--r--drivers/scsi/stex.c5
-rw-r--r--drivers/scsi/sun3x_esp.c6
-rw-r--r--drivers/scsi/sun_esp.c30
-rw-r--r--drivers/scsi/sym53c416.c2
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_glue.c23
-rw-r--r--drivers/scsi/tmscsim.c23
-rw-r--r--drivers/scsi/ufs/ufshcd.c5
-rw-r--r--drivers/scsi/virtio_scsi.c6
-rw-r--r--drivers/scsi/vmw_pvscsi.c9
-rw-r--r--drivers/scsi/zalon.c2
-rw-r--r--drivers/scsi/zorro7xx.c12
-rw-r--r--drivers/sh/clk/cpg.c6
-rw-r--r--drivers/sh/pfc/gpio.c6
-rw-r--r--drivers/sh/pfc/pinctrl.c20
-rw-r--r--drivers/sn/ioc3.c14
-rw-r--r--drivers/ssb/Kconfig3
-rw-r--r--drivers/ssb/driver_gige.c14
-rw-r--r--drivers/ssb/driver_pcicore.c10
-rw-r--r--drivers/ssb/main.c27
-rw-r--r--drivers/ssb/pcihost_wrapper.c6
-rw-r--r--drivers/staging/comedi/Kconfig1
-rw-r--r--drivers/staging/comedi/comedi_fops.c3
-rw-r--r--drivers/staging/comedi/drivers/comedi_test.c2
-rw-r--r--drivers/staging/comedi/drivers/ni_pcimio.c16
-rw-r--r--drivers/staging/fwserial/Kconfig4
-rw-r--r--drivers/staging/fwserial/TODO14
-rw-r--r--drivers/staging/fwserial/fwserial.c2
-rw-r--r--drivers/staging/fwserial/fwserial.h6
-rw-r--r--drivers/staging/iio/adc/mxs-lradc.c2
-rw-r--r--drivers/staging/iio/gyro/Kconfig4
-rw-r--r--drivers/staging/iio/gyro/adis16080_core.c2
-rw-r--r--drivers/staging/imx-drm/imx-drm-core.c1
-rw-r--r--drivers/staging/imx-drm/ipu-v3/ipu-common.c5
-rw-r--r--drivers/staging/imx-drm/ipuv3-crtc.c6
-rw-r--r--drivers/staging/omapdrm/Makefile1
-rw-r--r--drivers/staging/omapdrm/TODO3
-rw-r--r--drivers/staging/omapdrm/omap_connector.c111
-rw-r--r--drivers/staging/omapdrm/omap_crtc.c507
-rw-r--r--drivers/staging/omapdrm/omap_drv.c439
-rw-r--r--drivers/staging/omapdrm/omap_drv.h140
-rw-r--r--drivers/staging/omapdrm/omap_encoder.c132
-rw-r--r--drivers/staging/omapdrm/omap_gem_dmabuf.c7
-rw-r--r--drivers/staging/omapdrm/omap_irq.c322
-rw-r--r--drivers/staging/omapdrm/omap_plane.c452
-rw-r--r--drivers/staging/rtl8187se/r8180_core.c3
-rw-r--r--drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c4
-rw-r--r--drivers/staging/rtl8192e/rtl8192e/rtl_core.c11
-rw-r--r--drivers/staging/rtl8712/usb_intf.c2
-rw-r--r--drivers/staging/sb105x/Kconfig1
-rw-r--r--drivers/staging/sb105x/sb_pci_mp.c2
-rw-r--r--drivers/staging/speakup/synth.c4
-rw-r--r--drivers/staging/tidspbridge/core/_tiomap.h2
-rw-r--r--drivers/staging/tidspbridge/core/dsp-clock.c13
-rw-r--r--drivers/staging/tidspbridge/core/wdt.c12
-rw-r--r--drivers/staging/vme/devices/vme_pio2_core.c14
-rw-r--r--drivers/staging/vt6656/bssdb.h1
-rw-r--r--drivers/staging/vt6656/int.h1
-rw-r--r--drivers/staging/vt6656/iocmd.h33
-rw-r--r--drivers/staging/vt6656/iowpa.h8
-rw-r--r--drivers/staging/wlan-ng/cfg80211.c7
-rw-r--r--drivers/staging/wlan-ng/prism2mgmt.c2
-rw-r--r--drivers/staging/zram/zram_drv.c39
-rw-r--r--drivers/target/iscsi/iscsi_target_erl2.c2
-rw-r--r--drivers/target/target_core_alua.c2
-rw-r--r--drivers/target/target_core_pr.c2
-rw-r--r--drivers/target/target_core_transport.c20
-rw-r--r--drivers/target/tcm_fc/tfc_sess.c12
-rw-r--r--drivers/thermal/exynos_thermal.c6
-rw-r--r--drivers/tty/pty.c2
-rw-r--r--drivers/tty/serial/8250/8250.c11
-rw-r--r--drivers/tty/serial/8250/8250.h1
-rw-r--r--drivers/tty/serial/8250/8250_dw.c2
-rw-r--r--drivers/tty/serial/8250/8250_pci.c42
-rw-r--r--drivers/tty/serial/ifx6x60.c4
-rw-r--r--drivers/tty/serial/mxs-auart.c6
-rw-r--r--drivers/tty/serial/samsung.c1
-rw-r--r--drivers/tty/serial/vt8500_serial.c2
-rw-r--r--drivers/usb/Kconfig1
-rw-r--r--drivers/usb/chipidea/host.c3
-rw-r--r--drivers/usb/class/cdc-acm.c3
-rw-r--r--drivers/usb/core/hub.c120
-rw-r--r--drivers/usb/core/quirks.c3
-rw-r--r--drivers/usb/dwc3/debugfs.c2
-rw-r--r--drivers/usb/dwc3/gadget.c1
-rw-r--r--drivers/usb/gadget/amd5536udc.c4
-rw-r--r--drivers/usb/gadget/dummy_hcd.c9
-rw-r--r--drivers/usb/gadget/f_fs.c6
-rw-r--r--drivers/usb/gadget/fsl_mxc_udc.c40
-rw-r--r--drivers/usb/gadget/fsl_udc_core.c42
-rw-r--r--drivers/usb/gadget/fsl_usb2_udc.h5
-rw-r--r--drivers/usb/gadget/mv_udc_core.c4
-rw-r--r--drivers/usb/gadget/s3c-hsotg.c5
-rw-r--r--drivers/usb/gadget/tcm_usb_gadget.c3
-rw-r--r--drivers/usb/gadget/u_serial.c2
-rw-r--r--drivers/usb/host/Kconfig2
-rw-r--r--drivers/usb/host/Makefile1
-rw-r--r--drivers/usb/host/ehci-fsl.c9
-rw-r--r--drivers/usb/host/ehci-hcd.c12
-rw-r--r--drivers/usb/host/ehci-mv.c4
-rw-r--r--drivers/usb/host/ehci-mxc.c120
-rw-r--r--drivers/usb/host/ehci-orion.c2
-rw-r--r--drivers/usb/host/ehci-pci.c39
-rw-r--r--drivers/usb/host/ehci.h7
-rw-r--r--drivers/usb/host/fsl-mph-dr-of.c3
-rw-r--r--drivers/usb/host/imx21-hcd.c1
-rw-r--r--drivers/usb/host/ohci-tmio.c3
-rw-r--r--drivers/usb/host/uhci-hcd.c15
-rw-r--r--drivers/usb/host/xhci-hub.c38
-rw-r--r--drivers/usb/host/xhci-mem.c2
-rw-r--r--drivers/usb/host/xhci-ring.c9
-rw-r--r--drivers/usb/host/xhci.c10
-rw-r--r--drivers/usb/misc/usbtest.c2
-rw-r--r--drivers/usb/musb/cppi_dma.c4
-rw-r--r--drivers/usb/musb/musb_core.c5
-rw-r--r--drivers/usb/musb/musb_dsps.c5
-rw-r--r--drivers/usb/otg/Kconfig2
-rw-r--r--drivers/usb/otg/mv_otg.c4
-rw-r--r--drivers/usb/renesas_usbhs/mod_gadget.c22
-rw-r--r--drivers/usb/renesas_usbhs/mod_host.c3
-rw-r--r--drivers/usb/serial/ftdi_sio.c2
-rw-r--r--drivers/usb/serial/ftdi_sio_ids.h6
-rw-r--r--drivers/usb/serial/io_ti.c3
-rw-r--r--drivers/usb/serial/option.c27
-rw-r--r--drivers/vfio/pci/vfio_pci_rdwr.c4
-rw-r--r--drivers/video/acornfb.c22
-rw-r--r--drivers/video/arcfb.c10
-rw-r--r--drivers/video/arkfb.c10
-rw-r--r--drivers/video/asiliantfb.c18
-rw-r--r--drivers/video/aty/aty128fb.c57
-rw-r--r--drivers/video/aty/atyfb_base.c84
-rw-r--r--drivers/video/aty/mach64_ct.c6
-rw-r--r--drivers/video/aty/mach64_cursor.c2
-rw-r--r--drivers/video/aty/radeon_base.c20
-rw-r--r--drivers/video/aty/radeon_monitor.c24
-rw-r--r--drivers/video/au1100fb.c6
-rw-r--r--drivers/video/au1200fb.c6
-rw-r--r--drivers/video/auo_k1900fb.c6
-rw-r--r--drivers/video/auo_k1901fb.c6
-rw-r--r--drivers/video/auo_k190x.c6
-rw-r--r--drivers/video/bf537-lq035.c18
-rw-r--r--drivers/video/bf54x-lq043fb.c6
-rw-r--r--drivers/video/bfin-lq035q1-fb.c14
-rw-r--r--drivers/video/bfin-t350mcqb-fb.c6
-rw-r--r--drivers/video/bfin_adv7393fb.c10
-rw-r--r--drivers/video/broadsheetfb.c16
-rw-r--r--drivers/video/bw2.c23
-rw-r--r--drivers/video/carminefb.c16
-rw-r--r--drivers/video/cg14.c12
-rw-r--r--drivers/video/cg3.c26
-rw-r--r--drivers/video/cg6.c12
-rw-r--r--drivers/video/chipsfb.c13
-rw-r--r--drivers/video/cirrusfb.c44
-rw-r--r--drivers/video/clps711xfb.c8
-rw-r--r--drivers/video/cobalt_lcdfb.c8
-rw-r--r--drivers/video/console/sticore.c83
-rw-r--r--drivers/video/cyber2000fb.c23
-rw-r--r--drivers/video/da8xx-fb.c10
-rw-r--r--drivers/video/dnfb.c6
-rw-r--r--drivers/video/efifb.c4
-rw-r--r--drivers/video/ep93xx-fb.c8
-rw-r--r--drivers/video/exynos/exynos_dp_core.c6
-rw-r--r--drivers/video/exynos/exynos_mipi_dsi.c4
-rw-r--r--drivers/video/ffb.c6
-rw-r--r--drivers/video/fm2fb.c14
-rw-r--r--drivers/video/fsl-diu-fb.c6
-rw-r--r--drivers/video/gbefb.c24
-rw-r--r--drivers/video/geode/gx1fb_core.c14
-rw-r--r--drivers/video/geode/gxfb_core.c20
-rw-r--r--drivers/video/geode/lxfb_core.c20
-rw-r--r--drivers/video/grvga.c12
-rw-r--r--drivers/video/gxt4500.c13
-rw-r--r--drivers/video/hecubafb.c10
-rw-r--r--drivers/video/hgafb.c12
-rw-r--r--drivers/video/hitfb.c10
-rw-r--r--drivers/video/hpfb.c9
-rw-r--r--drivers/video/i740fb.c15
-rw-r--r--drivers/video/i810/i810_main.c72
-rw-r--r--drivers/video/i810/i810_main.h2
-rw-r--r--drivers/video/igafb.c2
-rw-r--r--drivers/video/imsttfb.c17
-rw-r--r--drivers/video/imxfb.c17
-rw-r--r--drivers/video/intelfb/intelfbdrv.c29
-rw-r--r--drivers/video/jz4740_fb.c8
-rw-r--r--drivers/video/kyro/fbdev.c21
-rw-r--r--drivers/video/leo.c6
-rw-r--r--drivers/video/mb862xx/mb862xxfbdrv.c20
-rw-r--r--drivers/video/mbx/mbxdebugfs.c4
-rw-r--r--drivers/video/mbx/mbxfb.c18
-rw-r--r--drivers/video/metronomefb.c22
-rw-r--r--drivers/video/msm/mddi.c9
-rw-r--r--drivers/video/mxsfb.c15
-rw-r--r--drivers/video/neofb.c26
-rw-r--r--drivers/video/nuc900fb.c4
-rw-r--r--drivers/video/nvidia/nvidia.c49
-rw-r--r--drivers/video/omap/lcd_mipid.c2
-rw-r--r--drivers/video/omap2/displays/panel-acx565akm.c2
-rw-r--r--drivers/video/omap2/displays/panel-lgphilips-lb035q02.c6
-rw-r--r--drivers/video/omap2/displays/panel-n8x0.c2
-rw-r--r--drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c2
-rw-r--r--drivers/video/omap2/displays/panel-tpo-td043mtea1.c4
-rw-r--r--drivers/video/p9100.c6
-rw-r--r--drivers/video/platinumfb.c11
-rw-r--r--drivers/video/pm2fb.c17
-rw-r--r--drivers/video/pm3fb.c17
-rw-r--r--drivers/video/pmag-ba-fb.c6
-rw-r--r--drivers/video/pmagb-b-fb.c12
-rw-r--r--drivers/video/ps3fb.c4
-rw-r--r--drivers/video/pvr2fb.c28
-rw-r--r--drivers/video/pxa168fb.c8
-rw-r--r--drivers/video/pxa3xx-gcu.c8
-rw-r--r--drivers/video/pxafb.c33
-rw-r--r--drivers/video/q40fb.c6
-rw-r--r--drivers/video/riva/fbdev.c45
-rw-r--r--drivers/video/riva/rivafb-i2c.c9
-rw-r--r--drivers/video/s1d13xxxfb.c10
-rw-r--r--drivers/video/s3c-fb.c15
-rw-r--r--drivers/video/s3c2410fb.c16
-rw-r--r--drivers/video/s3fb.c16
-rw-r--r--drivers/video/sa1100fb.c8
-rw-r--r--drivers/video/savage/savagefb_driver.c23
-rw-r--r--drivers/video/sgivwfb.c12
-rw-r--r--drivers/video/sh7760fb.c6
-rw-r--r--drivers/video/sh_mipi_dsi.c4
-rw-r--r--drivers/video/sh_mobile_lcdcfb.c18
-rw-r--r--drivers/video/sh_mobile_meram.c2
-rw-r--r--drivers/video/sis/sis_main.c140
-rw-r--r--drivers/video/sis/sis_main.h20
-rw-r--r--drivers/video/skeletonfb.c17
-rw-r--r--drivers/video/sm501fb.c16
-rw-r--r--drivers/video/ssd1307fb.c15
-rw-r--r--drivers/video/sstfb.c33
-rw-r--r--drivers/video/sunxvr1000.c10
-rw-r--r--drivers/video/sunxvr2500.c12
-rw-r--r--drivers/video/sunxvr500.c12
-rw-r--r--drivers/video/tcx.c6
-rw-r--r--drivers/video/tdfxfb.c30
-rw-r--r--drivers/video/tgafb.c45
-rw-r--r--drivers/video/tmiofb.c8
-rw-r--r--drivers/video/tridentfb.c28
-rw-r--r--drivers/video/uvesafb.c74
-rw-r--r--drivers/video/vermilion/vermilion.c7
-rw-r--r--drivers/video/vfb.c6
-rw-r--r--drivers/video/vga16fb.c10
-rw-r--r--drivers/video/via/dvi.c10
-rw-r--r--drivers/video/via/dvi.h4
-rw-r--r--drivers/video/via/hw.c16
-rw-r--r--drivers/video/via/hw.h4
-rw-r--r--drivers/video/via/lcd.c10
-rw-r--r--drivers/video/via/lcd.h6
-rw-r--r--drivers/video/via/via-core.c19
-rw-r--r--drivers/video/via/via-gpio.c2
-rw-r--r--drivers/video/via/viafbdev.c12
-rw-r--r--drivers/video/vt8500lcdfb.c6
-rw-r--r--drivers/video/vt8623fb.c8
-rw-r--r--drivers/video/w100fb.c10
-rw-r--r--drivers/video/wm8505fb.c6
-rw-r--r--drivers/video/wmt_ge_rops.c6
-rw-r--r--drivers/video/xen-fbfront.c7
-rw-r--r--drivers/video/xilinxfb.c8
-rw-r--r--drivers/virtio/virtio_balloon.c4
-rw-r--r--drivers/virtio/virtio_mmio.c6
-rw-r--r--drivers/virtio/virtio_pci.c8
-rw-r--r--drivers/vlynq/vlynq.c6
-rw-r--r--drivers/w1/masters/mxc_w1.c2
-rw-r--r--drivers/watchdog/da9055_wdt.c17
-rw-r--r--drivers/watchdog/omap_wdt.c1
-rw-r--r--drivers/watchdog/twl4030_wdt.c11
-rw-r--r--drivers/xen/cpu_hotplug.c4
-rw-r--r--drivers/xen/gntdev.c130
-rw-r--r--drivers/xen/grant-table.c50
-rw-r--r--drivers/xen/platform-pci.c6
-rw-r--r--drivers/xen/privcmd.c89
-rw-r--r--drivers/xen/xen-pciback/pci_stub.c13
-rw-r--r--drivers/xen/xen-pciback/pciback.h2
-rw-r--r--drivers/zorro/zorro-driver.c4
-rw-r--r--fs/Kconfig10
-rw-r--r--fs/btrfs/extent-tree.c6
-rw-r--r--fs/btrfs/extent_map.c13
-rw-r--r--fs/btrfs/extent_map.h1
-rw-r--r--fs/btrfs/file-item.c4
-rw-r--r--fs/btrfs/file.c10
-rw-r--r--fs/btrfs/free-space-cache.c20
-rw-r--r--fs/btrfs/inode.c137
-rw-r--r--fs/btrfs/ioctl.c129
-rw-r--r--fs/btrfs/qgroup.c20
-rw-r--r--fs/btrfs/send.c4
-rw-r--r--fs/btrfs/super.c2
-rw-r--r--fs/btrfs/transaction.c19
-rw-r--r--fs/btrfs/tree-log.c10
-rw-r--r--fs/btrfs/volumes.c23
-rw-r--r--fs/buffer.c1
-rw-r--r--fs/cifs/cifs_dfs_ref.c2
-rw-r--r--fs/cifs/cifsfs.c1
-rw-r--r--fs/cifs/cifsglob.h2
-rw-r--r--fs/cifs/connect.c2
-rw-r--r--fs/cifs/file.c141
-rw-r--r--fs/cifs/smb1ops.c8
-rw-r--r--fs/cifs/smb2ops.c2
-rw-r--r--fs/cifs/transport.c6
-rw-r--r--fs/debugfs/inode.c2
-rw-r--r--fs/ecryptfs/crypto.c2
-rw-r--r--fs/ecryptfs/kthread.c6
-rw-r--r--fs/ecryptfs/mmap.c12
-rw-r--r--fs/eventpoll.c22
-rw-r--r--fs/exec.c3
-rw-r--r--fs/ext4/Kconfig2
-rw-r--r--fs/ext4/extents.c22
-rw-r--r--fs/ext4/file.c8
-rw-r--r--fs/ext4/fsync.c2
-rw-r--r--fs/ext4/inode.c99
-rw-r--r--fs/ext4/namei.c6
-rw-r--r--fs/ext4/super.c30
-rw-r--r--fs/f2fs/acl.c14
-rw-r--r--fs/f2fs/checkpoint.c3
-rw-r--r--fs/f2fs/data.c18
-rw-r--r--fs/f2fs/debug.c50
-rw-r--r--fs/f2fs/dir.c18
-rw-r--r--fs/f2fs/f2fs.h20
-rw-r--r--fs/f2fs/file.c26
-rw-r--r--fs/f2fs/gc.c102
-rw-r--r--fs/f2fs/hash.c18
-rw-r--r--fs/f2fs/inode.c4
-rw-r--r--fs/f2fs/namei.c34
-rw-r--r--fs/f2fs/node.c56
-rw-r--r--fs/f2fs/recovery.c18
-rw-r--r--fs/f2fs/segment.c48
-rw-r--r--fs/f2fs/segment.h15
-rw-r--r--fs/f2fs/super.c112
-rw-r--r--fs/f2fs/xattr.c7
-rw-r--r--fs/file.c2
-rw-r--r--fs/fuse/Kconfig16
-rw-r--r--fs/fuse/cuse.c36
-rw-r--r--fs/fuse/dev.c5
-rw-r--r--fs/fuse/file.c5
-rw-r--r--fs/gfs2/lock_dlm.c8
-rw-r--r--fs/gfs2/rgrp.c35
-rw-r--r--fs/jbd/journal.c3
-rw-r--r--fs/jbd2/transaction.c30
-rw-r--r--fs/nfs/callback_proc.c2
-rw-r--r--fs/nfs/dir.c16
-rw-r--r--fs/nfs/namespace.c20
-rw-r--r--fs/nfs/nfs4client.c62
-rw-r--r--fs/nfs/nfs4proc.c18
-rw-r--r--fs/nfs/nfs4state.c22
-rw-r--r--fs/nfs/pnfs.c2
-rw-r--r--fs/nfs/read.c10
-rw-r--r--fs/nfs/super.c24
-rw-r--r--fs/nfs/write.c10
-rw-r--r--fs/proc/generic.c13
-rw-r--r--fs/proc/task_mmu.c2
-rw-r--r--fs/pstore/ram.c14
-rw-r--r--fs/pstore/ram_core.c9
-rw-r--r--fs/seq_file.c2
-rw-r--r--fs/splice.c4
-rw-r--r--fs/udf/super.c3
-rw-r--r--fs/xfs/xfs_aops.c2
-rw-r--r--fs/xfs/xfs_bmap.c6
-rw-r--r--fs/xfs/xfs_buf.c32
-rw-r--r--fs/xfs/xfs_buf.h6
-rw-r--r--fs/xfs/xfs_buf_item.c61
-rw-r--r--fs/xfs/xfs_buf_item.h2
-rw-r--r--fs/xfs/xfs_dfrag.c4
-rw-r--r--fs/xfs/xfs_dir2_block.c6
-rw-r--r--fs/xfs/xfs_iomap.c9
-rw-r--r--fs/xfs/xfs_mount.c2
-rw-r--r--fs/xfs/xfs_qm_syscalls.c4
-rw-r--r--fs/xfs/xfs_trace.h1
-rw-r--r--fs/xfs/xfs_trans_buf.c27
-rw-r--r--include/Kbuild3
-rw-r--r--include/asm-generic/dma-mapping-broken.h16
-rw-r--r--include/asm-generic/parport.h4
-rw-r--r--include/asm-generic/pgtable.h6
-rw-r--r--include/asm-generic/syscalls.h2
-rw-r--r--include/asm-generic/tlb.h9
-rw-r--r--include/drm/drm_mm.h27
-rw-r--r--include/drm/exynos_drm.h22
-rw-r--r--include/linux/Kbuild5
-rw-r--r--include/linux/ata.h8
-rw-r--r--include/linux/ata_platform.h12
-rw-r--r--include/linux/audit.h4
-rw-r--r--include/linux/bcma/bcma_driver_gmac_cmn.h2
-rw-r--r--include/linux/bcma/bcma_driver_pci.h2
-rw-r--r--include/linux/compaction.h4
-rw-r--r--include/linux/cpu_rmap.h13
-rw-r--r--include/linux/cpuidle.h2
-rw-r--r--include/linux/cred.h1
-rw-r--r--include/linux/efi.h24
-rw-r--r--include/linux/hdlc/Kbuild0
-rw-r--r--include/linux/hsi/Kbuild0
-rw-r--r--include/linux/init.h20
-rw-r--r--include/linux/interrupt.h5
-rw-r--r--include/linux/ipc_namespace.h1
-rw-r--r--include/linux/jbd2.h2
-rw-r--r--include/linux/libata.h4
-rw-r--r--include/linux/lockdep.h3
-rw-r--r--include/linux/mempolicy.h13
-rw-r--r--include/linux/mfd/abx500.h2
-rw-r--r--include/linux/mfd/abx500/ab8500-bm.h29
-rw-r--r--include/linux/mfd/da9052/da9052.h66
-rw-r--r--include/linux/mfd/da9052/reg.h3
-rw-r--r--include/linux/mfd/rtsx_common.h3
-rw-r--r--include/linux/mfd/rtsx_pci.h25
-rw-r--r--include/linux/mm.h1
-rw-r--r--include/linux/mmzone.h8
-rw-r--r--include/linux/module.h10
-rw-r--r--include/linux/msg.h6
-rw-r--r--include/linux/namei.h1
-rw-r--r--include/linux/netdevice.h5
-rw-r--r--include/linux/page-flags.h8
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--include/linux/pid.h1
-rw-r--r--include/linux/pid_namespace.h4
-rw-r--r--include/linux/platform_data/imx-iram.h (renamed from arch/arm/mach-imx/iram.h)0
-rw-r--r--include/linux/pstore_ram.h5
-rw-r--r--include/linux/ptrace.h1
-rw-r--r--include/linux/raid/Kbuild0
-rw-r--r--include/linux/rbtree_augmented.h14
-rw-r--r--include/linux/rwsem.h9
-rw-r--r--include/linux/sched.h12
-rw-r--r--include/linux/security.h59
-rw-r--r--include/linux/usb/Kbuild0
-rw-r--r--include/linux/usb/usbnet.h1
-rw-r--r--include/net/ip.h2
-rw-r--r--include/net/netfilter/nf_conntrack_core.h2
-rw-r--r--include/net/netns/conntrack.h1
-rw-r--r--include/net/netns/x_tables.h1
-rw-r--r--include/net/sock.h2
-rw-r--r--include/rdma/Kbuild0
-rw-r--r--include/sound/Kbuild0
-rw-r--r--include/sound/cs4271.h2
-rw-r--r--include/sound/soc.h10
-rw-r--r--include/target/target_core_base.h1
-rw-r--r--include/trace/events/ext4.h14
-rw-r--r--include/uapi/drm/exynos_drm.h24
-rw-r--r--include/uapi/drm/i915_drm.h10
-rw-r--r--include/uapi/linux/audit.h2
-rw-r--r--include/uapi/linux/msg.h1
-rw-r--r--include/uapi/linux/pci_regs.h2
-rw-r--r--include/uapi/linux/serial_core.h3
-rw-r--r--init/Kconfig2
-rw-r--r--init/do_mounts_initrd.c4
-rw-r--r--init/main.c8
-rw-r--r--ipc/compat.c46
-rw-r--r--ipc/ipc_sysctl.c32
-rw-r--r--ipc/msg.c123
-rw-r--r--ipc/msgutil.c43
-rw-r--r--ipc/util.c16
-rw-r--r--ipc/util.h2
-rw-r--r--kernel/async.c30
-rw-r--r--kernel/audit.c40
-rw-r--r--kernel/audit_tree.c26
-rw-r--r--kernel/audit_watch.c2
-rw-r--r--kernel/auditfilter.c1
-rw-r--r--kernel/auditsc.c20
-rw-r--r--kernel/compat.c23
-rw-r--r--kernel/debug/kdb/kdb_main.c2
-rw-r--r--kernel/fork.c14
-rw-r--r--kernel/module.c181
-rw-r--r--kernel/pid.c15
-rw-r--r--kernel/pid_namespace.c4
-rw-r--r--kernel/printk.c14
-rw-r--r--kernel/ptrace.c74
-rw-r--r--kernel/rwsem.c10
-rw-r--r--kernel/sched/core.c3
-rw-r--r--kernel/signal.c33
-rw-r--r--kernel/smp.c13
-rw-r--r--kernel/trace/ftrace.c2
-rw-r--r--kernel/trace/trace.c17
-rw-r--r--lib/Kconfig.debug2
-rw-r--r--lib/bug.c1
-rw-r--r--lib/cpu_rmap.c54
-rw-r--r--lib/rbtree.c20
-rw-r--r--mm/bootmem.c24
-rw-r--r--mm/compaction.c98
-rw-r--r--mm/huge_memory.c15
-rw-r--r--mm/internal.h1
-rw-r--r--mm/memblock.c3
-rw-r--r--mm/memory.c13
-rw-r--r--mm/mempolicy.c130
-rw-r--r--mm/migrate.c14
-rw-r--r--mm/mmap.c2
-rw-r--r--mm/page_alloc.c64
-rw-r--r--mm/page_isolation.c26
-rw-r--r--mm/shmem.c4
-rw-r--r--mm/vmscan.c111
-rw-r--r--net/batman-adv/bat_iv_ogm.c2
-rw-r--r--net/batman-adv/distributed-arp-table.c19
-rw-r--r--net/bluetooth/hci_core.c8
-rw-r--r--net/bluetooth/hci_event.c2
-rw-r--r--net/bluetooth/hidp/core.c2
-rw-r--r--net/bluetooth/l2cap_core.c11
-rw-r--r--net/bluetooth/sco.c2
-rw-r--r--net/bridge/br_if.c8
-rw-r--r--net/bridge/br_multicast.c2
-rw-r--r--net/bridge/br_netlink.c13
-rw-r--r--net/bridge/br_private.h6
-rw-r--r--net/ceph/messenger.c23
-rw-r--r--net/ceph/osd_client.c34
-rw-r--r--net/core/dev.c26
-rw-r--r--net/core/net-sysfs.c4
-rw-r--r--net/core/request_sock.c2
-rw-r--r--net/core/scm.c5
-rw-r--r--net/core/skbuff.c44
-rw-r--r--net/core/sock.c4
-rw-r--r--net/ipv4/ah4.c18
-rw-r--r--net/ipv4/arp.c10
-rw-r--r--net/ipv4/datagram.c25
-rw-r--r--net/ipv4/devinet.c2
-rw-r--r--net/ipv4/esp4.c12
-rw-r--r--net/ipv4/ip_gre.c19
-rw-r--r--net/ipv4/ip_sockglue.c2
-rw-r--r--net/ipv4/ipcomp.c7
-rw-r--r--net/ipv4/ipconfig.c8
-rw-r--r--net/ipv4/netfilter/ipt_REJECT.c1
-rw-r--r--net/ipv4/netfilter/iptable_nat.c15
-rw-r--r--net/ipv4/ping.c1
-rw-r--r--net/ipv4/raw.c1
-rw-r--r--net/ipv4/route.c54
-rw-r--r--net/ipv4/tcp.c15
-rw-r--r--net/ipv4/tcp_input.c14
-rw-r--r--net/ipv4/tcp_ipv4.c9
-rw-r--r--net/ipv4/udp.c1
-rw-r--r--net/ipv6/addrconf.c27
-rw-r--r--net/ipv6/ah6.c11
-rw-r--r--net/ipv6/esp6.c5
-rw-r--r--net/ipv6/icmp.c12
-rw-r--r--net/ipv6/ip6_gre.c3
-rw-r--r--net/ipv6/ip6_output.c4
-rw-r--r--net/ipv6/ip6mr.c3
-rw-r--r--net/ipv6/netfilter/ip6t_NPT.c33
-rw-r--r--net/ipv6/netfilter/ip6t_REJECT.c1
-rw-r--r--net/ipv6/netfilter/ip6table_nat.c15
-rw-r--r--net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c4
-rw-r--r--net/ipv6/netfilter/nf_conntrack_reasm.c5
-rw-r--r--net/iucv/iucv.c2
-rw-r--r--net/mac80211/cfg.c14
-rw-r--r--net/mac80211/chan.c38
-rw-r--r--net/mac80211/ibss.c9
-rw-r--r--net/mac80211/ieee80211_i.h22
-rw-r--r--net/mac80211/iface.c48
-rw-r--r--net/mac80211/mesh.c8
-rw-r--r--net/mac80211/mesh.h2
-rw-r--r--net/mac80211/mesh_hwmp.c5
-rw-r--r--net/mac80211/mlme.c75
-rw-r--r--net/mac80211/offchannel.c19
-rw-r--r--net/mac80211/scan.c61
-rw-r--r--net/mac80211/sta_info.c46
-rw-r--r--net/mac80211/sta_info.h3
-rw-r--r--net/mac80211/tx.c9
-rw-r--r--net/mac802154/wpan.c2
-rw-r--r--net/netfilter/Kconfig7
-rw-r--r--net/netfilter/nf_conntrack_core.c11
-rw-r--r--net/netfilter/nf_conntrack_netlink.c2
-rw-r--r--net/netfilter/nf_conntrack_standalone.c1
-rw-r--r--net/netfilter/nfnetlink_log.c16
-rw-r--r--net/netfilter/x_tables.c28
-rw-r--r--net/netfilter/xt_CT.c62
-rw-r--r--net/netfilter/xt_hashlimit.c54
-rw-r--r--net/netfilter/xt_recent.c43
-rw-r--r--net/rds/ib_cm.c11
-rw-r--r--net/rds/ib_recv.c9
-rw-r--r--net/sched/sch_htb.c2
-rw-r--r--net/sctp/Kconfig2
-rw-r--r--net/sctp/outqueue.c12
-rw-r--r--net/sctp/sm_statefuns.c4
-rw-r--r--net/sctp/sysctl.c4
-rw-r--r--net/sunrpc/clnt.c7
-rw-r--r--net/sunrpc/sched.c48
-rw-r--r--net/sunrpc/xprt.c12
-rw-r--r--net/wireless/core.c3
-rw-r--r--net/wireless/reg.c7
-rw-r--r--net/wireless/sysfs.c4
-rw-r--r--net/xfrm/xfrm_policy.c2
-rw-r--r--net/xfrm/xfrm_replay.c4
-rw-r--r--samples/rpmsg/rpmsg_client_sample.c4
-rw-r--r--scripts/headers_install.pl6
-rwxr-xr-xscripts/kernel-doc1
-rw-r--r--security/capability.c24
-rw-r--r--security/device_cgroup.c2
-rw-r--r--security/integrity/evm/evm_crypto.c4
-rw-r--r--security/integrity/ima/ima.h1
-rw-r--r--security/integrity/ima/ima_main.c12
-rw-r--r--security/integrity/ima/ima_policy.c3
-rw-r--r--security/security.c28
-rw-r--r--security/selinux/hooks.c50
-rw-r--r--security/selinux/include/classmap.h2
-rw-r--r--security/selinux/include/objsec.h4
-rw-r--r--sound/arm/pxa2xx-ac97-lib.c26
-rw-r--r--sound/oss/pas2_card.c5
-rw-r--r--sound/pci/au88x0/au88x0_synth.c2
-rw-r--r--sound/pci/hda/hda_codec.c7
-rw-r--r--sound/pci/hda/hda_intel.c62
-rw-r--r--sound/pci/hda/patch_conexant.c25
-rw-r--r--sound/pci/hda/patch_hdmi.c2
-rw-r--r--sound/pci/hda/patch_realtek.c58
-rw-r--r--sound/pci/rme9652/hdspm.c17
-rw-r--r--sound/soc/codecs/arizona.c14
-rw-r--r--sound/soc/codecs/arizona.h18
-rw-r--r--sound/soc/codecs/cs4271.c6
-rw-r--r--sound/soc/codecs/cs42l52.c4
-rw-r--r--sound/soc/codecs/lm49453.c106
-rw-r--r--sound/soc/codecs/sgtl5000.c4
-rw-r--r--sound/soc/codecs/sta529.c9
-rw-r--r--sound/soc/codecs/wm2000.c4
-rw-r--r--sound/soc/codecs/wm2200.c11
-rw-r--r--sound/soc/codecs/wm5100.c6
-rw-r--r--sound/soc/codecs/wm5102.c51
-rw-r--r--sound/soc/codecs/wm5110.c3
-rw-r--r--sound/soc/codecs/wm_adsp.c25
-rw-r--r--sound/soc/fsl/Kconfig9
-rw-r--r--sound/soc/fsl/Makefile5
-rw-r--r--sound/soc/fsl/imx-pcm.c3
-rw-r--r--sound/soc/soc-core.c35
-rw-r--r--sound/soc/soc-dapm.c12
-rw-r--r--sound/soc/soc-pcm.c1
-rw-r--r--sound/usb/midi.c4
-rw-r--r--sound/usb/mixer.c17
-rw-r--r--sound/usb/mixer_maps.c13
-rw-r--r--sound/usb/mixer_quirks.c2
-rw-r--r--sound/usb/pcm.c10
-rw-r--r--sound/usb/quirks-table.h28
-rw-r--r--sound/usb/quirks.c35
-rw-r--r--sound/usb/usbaudio.h1
-rw-r--r--tools/perf/MANIFEST10
-rw-r--r--tools/perf/Makefile2
-rw-r--r--tools/testing/selftests/ipc/Makefile25
-rw-r--r--tools/testing/selftests/ipc/msgque.c246
2271 files changed, 24416 insertions, 13672 deletions
diff --git a/Documentation/DocBook/media/v4l/driver.xml b/Documentation/DocBook/media/v4l/driver.xml
index eacafe312cd2..7c6638bacedb 100644
--- a/Documentation/DocBook/media/v4l/driver.xml
+++ b/Documentation/DocBook/media/v4l/driver.xml
@@ -116,7 +116,7 @@ my_suspend (struct pci_dev * pci_dev,
116 return 0; /* a negative value on error, 0 on success. */ 116 return 0; /* a negative value on error, 0 on success. */
117} 117}
118 118
119static void __devexit 119static void
120my_remove (struct pci_dev * pci_dev) 120my_remove (struct pci_dev * pci_dev)
121{ 121{
122 my_device *my = pci_get_drvdata (pci_dev); 122 my_device *my = pci_get_drvdata (pci_dev);
@@ -124,7 +124,7 @@ my_remove (struct pci_dev * pci_dev)
124 /* Describe me. */ 124 /* Describe me. */
125} 125}
126 126
127static int __devinit 127static int
128my_probe (struct pci_dev * pci_dev, 128my_probe (struct pci_dev * pci_dev,
129 const struct pci_device_id * pci_id) 129 const struct pci_device_id * pci_id)
130{ 130{
@@ -157,7 +157,7 @@ my_pci_driver = {
157 .id_table = my_pci_device_ids, 157 .id_table = my_pci_device_ids,
158 158
159 .probe = my_probe, 159 .probe = my_probe,
160 .remove = __devexit_p (my_remove), 160 .remove = my_remove,
161 161
162 /* Power management functions. */ 162 /* Power management functions. */
163 .suspend = my_suspend, 163 .suspend = my_suspend,
diff --git a/Documentation/PCI/pci-iov-howto.txt b/Documentation/PCI/pci-iov-howto.txt
index cfaca7e69893..86551cc72e03 100644
--- a/Documentation/PCI/pci-iov-howto.txt
+++ b/Documentation/PCI/pci-iov-howto.txt
@@ -76,7 +76,7 @@ To notify SR-IOV core of Virtual Function Migration:
76 76
77Following piece of code illustrates the usage of the SR-IOV API. 77Following piece of code illustrates the usage of the SR-IOV API.
78 78
79static int __devinit dev_probe(struct pci_dev *dev, const struct pci_device_id *id) 79static int dev_probe(struct pci_dev *dev, const struct pci_device_id *id)
80{ 80{
81 pci_enable_sriov(dev, NR_VIRTFN); 81 pci_enable_sriov(dev, NR_VIRTFN);
82 82
@@ -85,7 +85,7 @@ static int __devinit dev_probe(struct pci_dev *dev, const struct pci_device_id *
85 return 0; 85 return 0;
86} 86}
87 87
88static void __devexit dev_remove(struct pci_dev *dev) 88static void dev_remove(struct pci_dev *dev)
89{ 89{
90 pci_disable_sriov(dev); 90 pci_disable_sriov(dev);
91 91
@@ -131,7 +131,7 @@ static struct pci_driver dev_driver = {
131 .name = "SR-IOV Physical Function driver", 131 .name = "SR-IOV Physical Function driver",
132 .id_table = dev_id_table, 132 .id_table = dev_id_table,
133 .probe = dev_probe, 133 .probe = dev_probe,
134 .remove = __devexit_p(dev_remove), 134 .remove = dev_remove,
135 .suspend = dev_suspend, 135 .suspend = dev_suspend,
136 .resume = dev_resume, 136 .resume = dev_resume,
137 .shutdown = dev_shutdown, 137 .shutdown = dev_shutdown,
diff --git a/Documentation/PCI/pci.txt b/Documentation/PCI/pci.txt
index aa09e5476bba..bccf602a87f5 100644
--- a/Documentation/PCI/pci.txt
+++ b/Documentation/PCI/pci.txt
@@ -183,12 +183,6 @@ Please mark the initialization and cleanup functions where appropriate
183 initializes. 183 initializes.
184 __exit Exit code. Ignored for non-modular drivers. 184 __exit Exit code. Ignored for non-modular drivers.
185 185
186
187 __devinit Device initialization code.
188 Identical to __init if the kernel is not compiled
189 with CONFIG_HOTPLUG, normal function otherwise.
190 __devexit The same for __exit.
191
192Tips on when/where to use the above attributes: 186Tips on when/where to use the above attributes:
193 o The module_init()/module_exit() functions (and all 187 o The module_init()/module_exit() functions (and all
194 initialization functions called _only_ from these) 188 initialization functions called _only_ from these)
@@ -196,20 +190,6 @@ Tips on when/where to use the above attributes:
196 190
197 o Do not mark the struct pci_driver. 191 o Do not mark the struct pci_driver.
198 192
199 o The ID table array should be marked __devinitconst; this is done
200 automatically if the table is declared with DEFINE_PCI_DEVICE_TABLE().
201
202 o The probe() and remove() functions should be marked __devinit
203 and __devexit respectively. All initialization functions
204 exclusively called by the probe() routine, can be marked __devinit.
205 Ditto for remove() and __devexit.
206
207 o If mydriver_remove() is marked with __devexit(), then all address
208 references to mydriver_remove must use __devexit_p(mydriver_remove)
209 (in the struct pci_driver declaration for example).
210 __devexit_p() will generate the function name _or_ NULL if the
211 function will be discarded. For an example, see drivers/net/tg3.c.
212
213 o Do NOT mark a function if you are not sure which mark to use. 193 o Do NOT mark a function if you are not sure which mark to use.
214 Better to not mark the function than mark the function wrong. 194 Better to not mark the function than mark the function wrong.
215 195
diff --git a/Documentation/acpi/enumeration.txt b/Documentation/acpi/enumeration.txt
index 4f27785ca0c8..54469bc81b1c 100644
--- a/Documentation/acpi/enumeration.txt
+++ b/Documentation/acpi/enumeration.txt
@@ -185,7 +185,7 @@ input driver:
185 .acpi_match_table ACPI_PTR(mpu3050_acpi_match), 185 .acpi_match_table ACPI_PTR(mpu3050_acpi_match),
186 }, 186 },
187 .probe = mpu3050_probe, 187 .probe = mpu3050_probe,
188 .remove = __devexit_p(mpu3050_remove), 188 .remove = mpu3050_remove,
189 .id_table = mpu3050_ids, 189 .id_table = mpu3050_ids,
190 }; 190 };
191 191
diff --git a/Documentation/device-mapper/dm-raid.txt b/Documentation/device-mapper/dm-raid.txt
index 728c38c242d6..56fb62b09fc5 100644
--- a/Documentation/device-mapper/dm-raid.txt
+++ b/Documentation/device-mapper/dm-raid.txt
@@ -141,3 +141,4 @@ Version History
1411.2.0 Handle creation of arrays that contain failed devices. 1411.2.0 Handle creation of arrays that contain failed devices.
1421.3.0 Added support for RAID 10 1421.3.0 Added support for RAID 10
1431.3.1 Allow device replacement/rebuild for RAID 10 1431.3.1 Allow device replacement/rebuild for RAID 10
1441.3.2 Fix/improve redundancy checking for RAID10
diff --git a/Documentation/devicetree/bindings/clock/imx23-clock.txt b/Documentation/devicetree/bindings/clock/imx23-clock.txt
index baadbb11fe98..5083c0b834b2 100644
--- a/Documentation/devicetree/bindings/clock/imx23-clock.txt
+++ b/Documentation/devicetree/bindings/clock/imx23-clock.txt
@@ -60,11 +60,6 @@ clks: clkctrl@80040000 {
60 compatible = "fsl,imx23-clkctrl"; 60 compatible = "fsl,imx23-clkctrl";
61 reg = <0x80040000 0x2000>; 61 reg = <0x80040000 0x2000>;
62 #clock-cells = <1>; 62 #clock-cells = <1>;
63 clock-output-names =
64 ...
65 "uart", /* 32 */
66 ...
67 "end_of_list";
68}; 63};
69 64
70auart0: serial@8006c000 { 65auart0: serial@8006c000 {
diff --git a/Documentation/devicetree/bindings/clock/imx25-clock.txt b/Documentation/devicetree/bindings/clock/imx25-clock.txt
index c2a3525ecb4e..db4f2f05c4d0 100644
--- a/Documentation/devicetree/bindings/clock/imx25-clock.txt
+++ b/Documentation/devicetree/bindings/clock/imx25-clock.txt
@@ -146,10 +146,6 @@ clks: ccm@53f80000 {
146 compatible = "fsl,imx25-ccm"; 146 compatible = "fsl,imx25-ccm";
147 reg = <0x53f80000 0x4000>; 147 reg = <0x53f80000 0x4000>;
148 interrupts = <31>; 148 interrupts = <31>;
149 clock-output-names = ...
150 "uart_ipg",
151 "uart_serial",
152 ...;
153}; 149};
154 150
155uart1: serial@43f90000 { 151uart1: serial@43f90000 {
diff --git a/Documentation/devicetree/bindings/clock/imx28-clock.txt b/Documentation/devicetree/bindings/clock/imx28-clock.txt
index 52a49a4a50b3..e6587af62ff0 100644
--- a/Documentation/devicetree/bindings/clock/imx28-clock.txt
+++ b/Documentation/devicetree/bindings/clock/imx28-clock.txt
@@ -83,11 +83,6 @@ clks: clkctrl@80040000 {
83 compatible = "fsl,imx28-clkctrl"; 83 compatible = "fsl,imx28-clkctrl";
84 reg = <0x80040000 0x2000>; 84 reg = <0x80040000 0x2000>;
85 #clock-cells = <1>; 85 #clock-cells = <1>;
86 clock-output-names =
87 ...
88 "uart", /* 45 */
89 ...
90 "end_of_list";
91}; 86};
92 87
93auart0: serial@8006a000 { 88auart0: serial@8006a000 {
diff --git a/Documentation/devicetree/bindings/clock/imx6q-clock.txt b/Documentation/devicetree/bindings/clock/imx6q-clock.txt
index d77b4e68dc42..f73fdf595568 100644
--- a/Documentation/devicetree/bindings/clock/imx6q-clock.txt
+++ b/Documentation/devicetree/bindings/clock/imx6q-clock.txt
@@ -211,10 +211,6 @@ clks: ccm@020c4000 {
211 reg = <0x020c4000 0x4000>; 211 reg = <0x020c4000 0x4000>;
212 interrupts = <0 87 0x04 0 88 0x04>; 212 interrupts = <0 87 0x04 0 88 0x04>;
213 #clock-cells = <1>; 213 #clock-cells = <1>;
214 clock-output-names = ...
215 "uart_ipg",
216 "uart_serial",
217 ...;
218}; 214};
219 215
220uart1: serial@02020000 { 216uart1: serial@02020000 {
diff --git a/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt b/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt
index 558cdf3c9abc..d4eab9227ea4 100644
--- a/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt
+++ b/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt
@@ -1,4 +1,19 @@
1GPIO line that should be set high/low to power off a device 1Driver a GPIO line that can be used to turn the power off.
2
3The driver supports both level triggered and edge triggered power off.
4At driver load time, the driver will request the given gpio line and
5install a pm_power_off handler. If the optional properties 'input' is
6not found, the GPIO line will be driven in the inactive
7state. Otherwise its configured as an input.
8
9When the pm_power_off is called, the gpio is configured as an output,
10and drive active, so triggering a level triggered power off
11condition. This will also cause an inactive->active edge condition, so
12triggering positive edge triggered power off. After a delay of 100ms,
13the GPIO is set to inactive, thus causing an active->inactive edge,
14triggering negative edge triggered power off. After another 100ms
15delay the GPIO is driver active again. If the power is still on and
16the CPU still running after a 3000ms delay, a WARN_ON(1) is emitted.
2 17
3Required properties: 18Required properties:
4- compatible : should be "gpio-poweroff". 19- compatible : should be "gpio-poweroff".
@@ -13,10 +28,9 @@ Optional properties:
13 property is not specified, the GPIO is initialized as an output in its 28 property is not specified, the GPIO is initialized as an output in its
14 inactive state. 29 inactive state.
15 30
16
17Examples: 31Examples:
18 32
19gpio-poweroff { 33gpio-poweroff {
20 compatible = "gpio-poweroff"; 34 compatible = "gpio-poweroff";
21 gpios = <&gpio 4 0>; /* GPIO 4 Active Low */ 35 gpios = <&gpio 4 0>;
22}; 36};
diff --git a/Documentation/devicetree/bindings/pinctrl/atmel,at91-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/atmel,at91-pinctrl.txt
index 3a268127b054..bc50899e0c81 100644
--- a/Documentation/devicetree/bindings/pinctrl/atmel,at91-pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/atmel,at91-pinctrl.txt
@@ -81,7 +81,8 @@ PA31 TXD4
81Required properties for pin configuration node: 81Required properties for pin configuration node:
82- atmel,pins: 4 integers array, represents a group of pins mux and config 82- atmel,pins: 4 integers array, represents a group of pins mux and config
83 setting. The format is atmel,pins = <PIN_BANK PIN_BANK_NUM PERIPH CONFIG>. 83 setting. The format is atmel,pins = <PIN_BANK PIN_BANK_NUM PERIPH CONFIG>.
84 The PERIPH 0 means gpio. 84 The PERIPH 0 means gpio, PERIPH 1 is periph A, PERIPH 2 is periph B...
85 PIN_BANK 0 is pioA, PIN_BANK 1 is pioB...
85 86
86Bits used for CONFIG: 87Bits used for CONFIG:
87PULL_UP (1 << 0): indicate this pin need a pull up. 88PULL_UP (1 << 0): indicate this pin need a pull up.
@@ -126,7 +127,7 @@ pinctrl@fffff400 {
126 pinctrl_dbgu: dbgu-0 { 127 pinctrl_dbgu: dbgu-0 {
127 atmel,pins = 128 atmel,pins =
128 <1 14 0x1 0x0 /* PB14 periph A */ 129 <1 14 0x1 0x0 /* PB14 periph A */
129 1 15 0x1 0x1>; /* PB15 periph with pullup */ 130 1 15 0x1 0x1>; /* PB15 periph A with pullup */
130 }; 131 };
131 }; 132 };
132}; 133};
diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-sirf.txt b/Documentation/devicetree/bindings/pinctrl/pinctrl-sirf.txt
new file mode 100644
index 000000000000..c596a6ad3285
--- /dev/null
+++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-sirf.txt
@@ -0,0 +1,47 @@
1CSR SiRFprimaII pinmux controller
2
3Required properties:
4- compatible : "sirf,prima2-pinctrl"
5- reg : Address range of the pinctrl registers
6- interrupts : Interrupts used by every GPIO group
7- gpio-controller : Indicates this device is a GPIO controller
8- interrupt-controller : Marks the device node as an interrupt controller
9Optional properties:
10- sirf,pullups : if n-th bit of m-th bank is set, set a pullup on GPIO-n of bank m
11- sirf,pulldowns : if n-th bit of m-th bank is set, set a pulldown on GPIO-n of bank m
12
13Please refer to pinctrl-bindings.txt in this directory for details of the common
14pinctrl bindings used by client devices.
15
16SiRFprimaII's pinmux nodes act as a container for an abitrary number of subnodes.
17Each of these subnodes represents some desired configuration for a group of pins.
18
19Required subnode-properties:
20- sirf,pins : An array of strings. Each string contains the name of a group.
21- sirf,function: A string containing the name of the function to mux to the
22 group.
23
24 Valid values for group and function names can be found from looking at the
25 group and function arrays in driver files:
26 drivers/pinctrl/pinctrl-sirf.c
27
28For example, pinctrl might have subnodes like the following:
29 uart2_pins_a: uart2@0 {
30 uart {
31 sirf,pins = "uart2grp";
32 sirf,function = "uart2";
33 };
34 };
35 uart2_noflow_pins_a: uart2@1 {
36 uart {
37 sirf,pins = "uart2_nostreamctrlgrp";
38 sirf,function = "uart2_nostreamctrl";
39 };
40 };
41
42For a specific board, if it wants to use uart2 without hardware flow control,
43it can add the following to its board-specific .dts file.
44uart2: uart@0xb0070000 {
45 pinctrl-names = "default";
46 pinctrl-0 = <&uart2_noflow_pins_a>;
47}
diff --git a/Documentation/devicetree/bindings/watchdog/twl4030-wdt.txt b/Documentation/devicetree/bindings/watchdog/twl4030-wdt.txt
new file mode 100644
index 000000000000..80a37193c0b8
--- /dev/null
+++ b/Documentation/devicetree/bindings/watchdog/twl4030-wdt.txt
@@ -0,0 +1,10 @@
1Device tree bindings for twl4030-wdt driver (TWL4030 watchdog)
2
3Required properties:
4 compatible = "ti,twl4030-wdt";
5
6Example:
7
8watchdog {
9 compatible = "ti,twl4030-wdt";
10};
diff --git a/Documentation/filesystems/f2fs.txt b/Documentation/filesystems/f2fs.txt
index 8fbd8b46ee34..dcf338e62b71 100644
--- a/Documentation/filesystems/f2fs.txt
+++ b/Documentation/filesystems/f2fs.txt
@@ -175,9 +175,9 @@ consists of multiple segments as described below.
175 align with the zone size <-| 175 align with the zone size <-|
176 |-> align with the segment size 176 |-> align with the segment size
177 _________________________________________________________________________ 177 _________________________________________________________________________
178 | | | Node | Segment | Segment | | 178 | | | Segment | Node | Segment | |
179 | Superblock | Checkpoint | Address | Info. | Summary | Main | 179 | Superblock | Checkpoint | Info. | Address | Summary | Main |
180 | (SB) | (CP) | Table (NAT) | Table (SIT) | Area (SSA) | | 180 | (SB) | (CP) | Table (SIT) | Table (NAT) | Area (SSA) | |
181 |____________|_____2______|______N______|______N______|______N_____|__N___| 181 |____________|_____2______|______N______|______N______|______N_____|__N___|
182 . . 182 . .
183 . . 183 . .
@@ -200,14 +200,14 @@ consists of multiple segments as described below.
200 : It contains file system information, bitmaps for valid NAT/SIT sets, orphan 200 : It contains file system information, bitmaps for valid NAT/SIT sets, orphan
201 inode lists, and summary entries of current active segments. 201 inode lists, and summary entries of current active segments.
202 202
203- Node Address Table (NAT)
204 : It is composed of a block address table for all the node blocks stored in
205 Main area.
206
207- Segment Information Table (SIT) 203- Segment Information Table (SIT)
208 : It contains segment information such as valid block count and bitmap for the 204 : It contains segment information such as valid block count and bitmap for the
209 validity of all the blocks. 205 validity of all the blocks.
210 206
207- Node Address Table (NAT)
208 : It is composed of a block address table for all the node blocks stored in
209 Main area.
210
211- Segment Summary Area (SSA) 211- Segment Summary Area (SSA)
212 : It contains summary entries which contains the owner information of all the 212 : It contains summary entries which contains the owner information of all the
213 data and node blocks stored in Main area. 213 data and node blocks stored in Main area.
@@ -236,13 +236,13 @@ For file system consistency, each CP points to which NAT and SIT copies are
236valid, as shown as below. 236valid, as shown as below.
237 237
238 +--------+----------+---------+ 238 +--------+----------+---------+
239 | CP | NAT | SIT | 239 | CP | SIT | NAT |
240 +--------+----------+---------+ 240 +--------+----------+---------+
241 . . . . 241 . . . .
242 . . . . 242 . . . .
243 . . . . 243 . . . .
244 +-------+-------+--------+--------+--------+--------+ 244 +-------+-------+--------+--------+--------+--------+
245 | CP #0 | CP #1 | NAT #0 | NAT #1 | SIT #0 | SIT #1 | 245 | CP #0 | CP #1 | SIT #0 | SIT #1 | NAT #0 | NAT #1 |
246 +-------+-------+--------+--------+--------+--------+ 246 +-------+-------+--------+--------+--------+--------+
247 | ^ ^ 247 | ^ ^
248 | | | 248 | | |
diff --git a/Documentation/hid/hid-sensor.txt b/Documentation/hid/hid-sensor.txt
index 948b0989c433..948b0989c433 100755..100644
--- a/Documentation/hid/hid-sensor.txt
+++ b/Documentation/hid/hid-sensor.txt
diff --git a/Documentation/i2c/instantiating-devices b/Documentation/i2c/instantiating-devices
index abf63615ee05..22182660dda7 100644
--- a/Documentation/i2c/instantiating-devices
+++ b/Documentation/i2c/instantiating-devices
@@ -91,7 +91,7 @@ Example (from the nxp OHCI driver):
91 91
92static const unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END }; 92static const unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END };
93 93
94static int __devinit usb_hcd_nxp_probe(struct platform_device *pdev) 94static int usb_hcd_nxp_probe(struct platform_device *pdev)
95{ 95{
96 (...) 96 (...)
97 struct i2c_adapter *i2c_adap; 97 struct i2c_adapter *i2c_adap;
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
index dd52d516cb89..dbca66182089 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -36,7 +36,7 @@ neigh/default/unres_qlen_bytes - INTEGER
36 The maximum number of bytes which may be used by packets 36 The maximum number of bytes which may be used by packets
37 queued for each unresolved address by other network layers. 37 queued for each unresolved address by other network layers.
38 (added in linux 3.3) 38 (added in linux 3.3)
39 Seting negative value is meaningless and will retrun error. 39 Setting negative value is meaningless and will return error.
40 Default: 65536 Bytes(64KB) 40 Default: 65536 Bytes(64KB)
41 41
42neigh/default/unres_qlen - INTEGER 42neigh/default/unres_qlen - INTEGER
@@ -215,7 +215,7 @@ tcp_ecn - INTEGER
215 Possible values are: 215 Possible values are:
216 0 Disable ECN. Neither initiate nor accept ECN. 216 0 Disable ECN. Neither initiate nor accept ECN.
217 1 Always request ECN on outgoing connection attempts. 217 1 Always request ECN on outgoing connection attempts.
218 2 Enable ECN when requested by incomming connections 218 2 Enable ECN when requested by incoming connections
219 but do not request ECN on outgoing connections. 219 but do not request ECN on outgoing connections.
220 Default: 2 220 Default: 2
221 221
@@ -503,7 +503,7 @@ tcp_fastopen - INTEGER
503tcp_syn_retries - INTEGER 503tcp_syn_retries - INTEGER
504 Number of times initial SYNs for an active TCP connection attempt 504 Number of times initial SYNs for an active TCP connection attempt
505 will be retransmitted. Should not be higher than 255. Default value 505 will be retransmitted. Should not be higher than 255. Default value
506 is 6, which corresponds to 63seconds till the last restransmission 506 is 6, which corresponds to 63seconds till the last retransmission
507 with the current initial RTO of 1second. With this the final timeout 507 with the current initial RTO of 1second. With this the final timeout
508 for an active TCP connection attempt will happen after 127seconds. 508 for an active TCP connection attempt will happen after 127seconds.
509 509
@@ -1331,6 +1331,12 @@ force_tllao - BOOLEAN
1331 race condition where the sender deletes the cached link-layer address 1331 race condition where the sender deletes the cached link-layer address
1332 prior to receiving a response to a previous solicitation." 1332 prior to receiving a response to a previous solicitation."
1333 1333
1334ndisc_notify - BOOLEAN
1335 Define mode for notification of address and device changes.
1336 0 - (default): do nothing
1337 1 - Generate unsolicited neighbour advertisements when device is brought
1338 up or hardware address changes.
1339
1334icmp/*: 1340icmp/*:
1335ratelimit - INTEGER 1341ratelimit - INTEGER
1336 Limit the maximal rates for sending ICMPv6 packets. 1342 Limit the maximal rates for sending ICMPv6 packets.
@@ -1530,7 +1536,7 @@ cookie_hmac_alg - STRING
1530 * sha1 1536 * sha1
1531 * none 1537 * none
1532 Ability to assign md5 or sha1 as the selected alg is predicated on the 1538 Ability to assign md5 or sha1 as the selected alg is predicated on the
1533 configuarion of those algorithms at build time (CONFIG_CRYPTO_MD5 and 1539 configuration of those algorithms at build time (CONFIG_CRYPTO_MD5 and
1534 CONFIG_CRYPTO_SHA1). 1540 CONFIG_CRYPTO_SHA1).
1535 1541
1536 Default: Dependent on configuration. MD5 if available, else SHA1 if 1542 Default: Dependent on configuration. MD5 if available, else SHA1 if
@@ -1548,7 +1554,7 @@ rcvbuf_policy - INTEGER
1548 blocking. 1554 blocking.
1549 1555
1550 1: rcvbuf space is per association 1556 1: rcvbuf space is per association
1551 0: recbuf space is per socket 1557 0: rcvbuf space is per socket
1552 1558
1553 Default: 0 1559 Default: 0
1554 1560
diff --git a/Documentation/power/runtime_pm.txt b/Documentation/power/runtime_pm.txt
index 4abe83e1045a..03591a750f99 100644
--- a/Documentation/power/runtime_pm.txt
+++ b/Documentation/power/runtime_pm.txt
@@ -642,12 +642,13 @@ out the following operations:
642 * During system suspend it calls pm_runtime_get_noresume() and 642 * During system suspend it calls pm_runtime_get_noresume() and
643 pm_runtime_barrier() for every device right before executing the 643 pm_runtime_barrier() for every device right before executing the
644 subsystem-level .suspend() callback for it. In addition to that it calls 644 subsystem-level .suspend() callback for it. In addition to that it calls
645 pm_runtime_disable() for every device right after executing the 645 __pm_runtime_disable() with 'false' as the second argument for every device
646 subsystem-level .suspend() callback for it. 646 right before executing the subsystem-level .suspend_late() callback for it.
647 647
648 * During system resume it calls pm_runtime_enable() and pm_runtime_put_sync() 648 * During system resume it calls pm_runtime_enable() and pm_runtime_put_sync()
649 for every device right before and right after executing the subsystem-level 649 for every device right after executing the subsystem-level .resume_early()
650 .resume() callback for it, respectively. 650 callback and right after executing the subsystem-level .resume() callback
651 for it, respectively.
651 652
6527. Generic subsystem callbacks 6537. Generic subsystem callbacks
653 654
diff --git a/Documentation/rpmsg.txt b/Documentation/rpmsg.txt
index 409d9f964c5b..f7edc3aa1e92 100644
--- a/Documentation/rpmsg.txt
+++ b/Documentation/rpmsg.txt
@@ -236,7 +236,7 @@ static int rpmsg_sample_probe(struct rpmsg_channel *rpdev)
236 return 0; 236 return 0;
237} 237}
238 238
239static void __devexit rpmsg_sample_remove(struct rpmsg_channel *rpdev) 239static void rpmsg_sample_remove(struct rpmsg_channel *rpdev)
240{ 240{
241 dev_info(&rpdev->dev, "rpmsg sample client driver is removed\n"); 241 dev_info(&rpdev->dev, "rpmsg sample client driver is removed\n");
242} 242}
@@ -253,7 +253,7 @@ static struct rpmsg_driver rpmsg_sample_client = {
253 .id_table = rpmsg_driver_sample_id_table, 253 .id_table = rpmsg_driver_sample_id_table,
254 .probe = rpmsg_sample_probe, 254 .probe = rpmsg_sample_probe,
255 .callback = rpmsg_sample_cb, 255 .callback = rpmsg_sample_cb,
256 .remove = __devexit_p(rpmsg_sample_remove), 256 .remove = rpmsg_sample_remove,
257}; 257};
258 258
259static int __init init(void) 259static int __init init(void)
diff --git a/Documentation/spi/spi-summary b/Documentation/spi/spi-summary
index 7312ec14dd89..2331eb214146 100644
--- a/Documentation/spi/spi-summary
+++ b/Documentation/spi/spi-summary
@@ -345,7 +345,7 @@ SPI protocol drivers somewhat resemble platform device drivers:
345 }, 345 },
346 346
347 .probe = CHIP_probe, 347 .probe = CHIP_probe,
348 .remove = __devexit_p(CHIP_remove), 348 .remove = CHIP_remove,
349 .suspend = CHIP_suspend, 349 .suspend = CHIP_suspend,
350 .resume = CHIP_resume, 350 .resume = CHIP_resume,
351 }; 351 };
@@ -355,7 +355,7 @@ device whose board_info gave a modalias of "CHIP". Your probe() code
355might look like this unless you're creating a device which is managing 355might look like this unless you're creating a device which is managing
356a bus (appearing under /sys/class/spi_master). 356a bus (appearing under /sys/class/spi_master).
357 357
358 static int __devinit CHIP_probe(struct spi_device *spi) 358 static int CHIP_probe(struct spi_device *spi)
359 { 359 {
360 struct CHIP *chip; 360 struct CHIP *chip;
361 struct CHIP_platform_data *pdata; 361 struct CHIP_platform_data *pdata;
diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt
index 2907ba6c3607..ccd42589e124 100644
--- a/Documentation/sysctl/kernel.txt
+++ b/Documentation/sysctl/kernel.txt
@@ -38,6 +38,7 @@ show up in /proc/sys/kernel:
38- l2cr [ PPC only ] 38- l2cr [ PPC only ]
39- modprobe ==> Documentation/debugging-modules.txt 39- modprobe ==> Documentation/debugging-modules.txt
40- modules_disabled 40- modules_disabled
41- msg_next_id [ sysv ipc ]
41- msgmax 42- msgmax
42- msgmnb 43- msgmnb
43- msgmni 44- msgmni
@@ -62,7 +63,9 @@ show up in /proc/sys/kernel:
62- rtsig-max 63- rtsig-max
63- rtsig-nr 64- rtsig-nr
64- sem 65- sem
66- sem_next_id [ sysv ipc ]
65- sg-big-buff [ generic SCSI device (sg) ] 67- sg-big-buff [ generic SCSI device (sg) ]
68- shm_next_id [ sysv ipc ]
66- shm_rmid_forced 69- shm_rmid_forced
67- shmall 70- shmall
68- shmmax [ sysv ipc ] 71- shmmax [ sysv ipc ]
@@ -320,6 +323,22 @@ to false.
320 323
321============================================================== 324==============================================================
322 325
326msg_next_id, sem_next_id, and shm_next_id:
327
328These three toggles allows to specify desired id for next allocated IPC
329object: message, semaphore or shared memory respectively.
330
331By default they are equal to -1, which means generic allocation logic.
332Possible values to set are in range {0..INT_MAX}.
333
334Notes:
3351) kernel doesn't guarantee, that new object will have desired id. So,
336it's up to userspace, how to handle an object with "wrong" id.
3372) Toggle with non-default value will be set back to -1 by kernel after
338successful IPC object allocation.
339
340==============================================================
341
323nmi_watchdog: 342nmi_watchdog:
324 343
325Enables/Disables the NMI watchdog on x86 systems. When the value is 344Enables/Disables the NMI watchdog on x86 systems. When the value is
@@ -542,6 +561,19 @@ are doing anyway :)
542 561
543============================================================== 562==============================================================
544 563
564shmall:
565
566This parameter sets the total amount of shared memory pages that
567can be used system wide. Hence, SHMALL should always be at least
568ceil(shmmax/PAGE_SIZE).
569
570If you are not sure what the default PAGE_SIZE is on your Linux
571system, you can run the following command:
572
573# getconf PAGE_SIZE
574
575==============================================================
576
545shmmax: 577shmmax:
546 578
547This value can be used to query and set the run time limit 579This value can be used to query and set the run time limit
diff --git a/Documentation/video4linux/v4l2-framework.txt b/Documentation/video4linux/v4l2-framework.txt
index 32bfe926e8d7..b89567ad04b7 100644
--- a/Documentation/video4linux/v4l2-framework.txt
+++ b/Documentation/video4linux/v4l2-framework.txt
@@ -174,8 +174,7 @@ The recommended approach is as follows:
174 174
175static atomic_t drv_instance = ATOMIC_INIT(0); 175static atomic_t drv_instance = ATOMIC_INIT(0);
176 176
177static int __devinit drv_probe(struct pci_dev *pdev, 177static int drv_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
178 const struct pci_device_id *pci_id)
179{ 178{
180 ... 179 ...
181 state->instance = atomic_inc_return(&drv_instance) - 1; 180 state->instance = atomic_inc_return(&drv_instance) - 1;
diff --git a/Documentation/x86/boot.txt b/Documentation/x86/boot.txt
index 406d82d5d2bb..3edb4c2887a1 100644
--- a/Documentation/x86/boot.txt
+++ b/Documentation/x86/boot.txt
@@ -57,6 +57,10 @@ Protocol 2.10: (Kernel 2.6.31) Added a protocol for relaxed alignment
57Protocol 2.11: (Kernel 3.6) Added a field for offset of EFI handover 57Protocol 2.11: (Kernel 3.6) Added a field for offset of EFI handover
58 protocol entry point. 58 protocol entry point.
59 59
60Protocol 2.12: (Kernel 3.9) Added the xloadflags field and extension fields
61 to struct boot_params for for loading bzImage and ramdisk
62 above 4G in 64bit.
63
60**** MEMORY LAYOUT 64**** MEMORY LAYOUT
61 65
62The traditional memory map for the kernel loader, used for Image or 66The traditional memory map for the kernel loader, used for Image or
@@ -182,7 +186,7 @@ Offset Proto Name Meaning
1820230/4 2.05+ kernel_alignment Physical addr alignment required for kernel 1860230/4 2.05+ kernel_alignment Physical addr alignment required for kernel
1830234/1 2.05+ relocatable_kernel Whether kernel is relocatable or not 1870234/1 2.05+ relocatable_kernel Whether kernel is relocatable or not
1840235/1 2.10+ min_alignment Minimum alignment, as a power of two 1880235/1 2.10+ min_alignment Minimum alignment, as a power of two
1850236/2 N/A pad3 Unused 1890236/2 2.12+ xloadflags Boot protocol option flags
1860238/4 2.06+ cmdline_size Maximum size of the kernel command line 1900238/4 2.06+ cmdline_size Maximum size of the kernel command line
187023C/4 2.07+ hardware_subarch Hardware subarchitecture 191023C/4 2.07+ hardware_subarch Hardware subarchitecture
1880240/8 2.07+ hardware_subarch_data Subarchitecture-specific data 1920240/8 2.07+ hardware_subarch_data Subarchitecture-specific data
@@ -582,6 +586,27 @@ Protocol: 2.10+
582 misaligned kernel. Therefore, a loader should typically try each 586 misaligned kernel. Therefore, a loader should typically try each
583 power-of-two alignment from kernel_alignment down to this alignment. 587 power-of-two alignment from kernel_alignment down to this alignment.
584 588
589Field name: xloadflags
590Type: read
591Offset/size: 0x236/2
592Protocol: 2.12+
593
594 This field is a bitmask.
595
596 Bit 0 (read): XLF_KERNEL_64
597 - If 1, this kernel has the legacy 64-bit entry point at 0x200.
598
599 Bit 1 (read): XLF_CAN_BE_LOADED_ABOVE_4G
600 - If 1, kernel/boot_params/cmdline/ramdisk can be above 4G.
601
602 Bit 2 (read): XLF_EFI_HANDOVER_32
603 - If 1, the kernel supports the 32-bit EFI handoff entry point
604 given at handover_offset.
605
606 Bit 3 (read): XLF_EFI_HANDOVER_64
607 - If 1, the kernel supports the 64-bit EFI handoff entry point
608 given at handover_offset + 0x200.
609
585Field name: cmdline_size 610Field name: cmdline_size
586Type: read 611Type: read
587Offset/size: 0x238/4 612Offset/size: 0x238/4
diff --git a/Documentation/x86/zero-page.txt b/Documentation/x86/zero-page.txt
index cf5437deda81..199f453cb4de 100644
--- a/Documentation/x86/zero-page.txt
+++ b/Documentation/x86/zero-page.txt
@@ -19,6 +19,9 @@ Offset Proto Name Meaning
19090/010 ALL hd1_info hd1 disk parameter, OBSOLETE!! 19090/010 ALL hd1_info hd1 disk parameter, OBSOLETE!!
200A0/010 ALL sys_desc_table System description table (struct sys_desc_table) 200A0/010 ALL sys_desc_table System description table (struct sys_desc_table)
210B0/010 ALL olpc_ofw_header OLPC's OpenFirmware CIF and friends 210B0/010 ALL olpc_ofw_header OLPC's OpenFirmware CIF and friends
220C0/004 ALL ext_ramdisk_image ramdisk_image high 32bits
230C4/004 ALL ext_ramdisk_size ramdisk_size high 32bits
240C8/004 ALL ext_cmd_line_ptr cmd_line_ptr high 32bits
22140/080 ALL edid_info Video mode setup (struct edid_info) 25140/080 ALL edid_info Video mode setup (struct edid_info)
231C0/020 ALL efi_info EFI 32 information (struct efi_info) 261C0/020 ALL efi_info EFI 32 information (struct efi_info)
241E0/004 ALL alk_mem_k Alternative mem check, in KB 271E0/004 ALL alk_mem_k Alternative mem check, in KB
@@ -27,6 +30,7 @@ Offset Proto Name Meaning
271E9/001 ALL eddbuf_entries Number of entries in eddbuf (below) 301E9/001 ALL eddbuf_entries Number of entries in eddbuf (below)
281EA/001 ALL edd_mbr_sig_buf_entries Number of entries in edd_mbr_sig_buffer 311EA/001 ALL edd_mbr_sig_buf_entries Number of entries in edd_mbr_sig_buffer
29 (below) 32 (below)
331EF/001 ALL sentinel Used to detect broken bootloaders
30290/040 ALL edd_mbr_sig_buffer EDD MBR signatures 34290/040 ALL edd_mbr_sig_buffer EDD MBR signatures
312D0/A00 ALL e820_map E820 memory map table 352D0/A00 ALL e820_map E820 memory map table
32 (array of struct e820entry) 36 (array of struct e820entry)
diff --git a/Documentation/zh_CN/video4linux/v4l2-framework.txt b/Documentation/zh_CN/video4linux/v4l2-framework.txt
index 3e74f13af426..44c1d934c4e3 100644
--- a/Documentation/zh_CN/video4linux/v4l2-framework.txt
+++ b/Documentation/zh_CN/video4linux/v4l2-framework.txt
@@ -182,8 +182,7 @@ int iterate(void *p)
182 182
183static atomic_t drv_instance = ATOMIC_INIT(0); 183static atomic_t drv_instance = ATOMIC_INIT(0);
184 184
185static int __devinit drv_probe(struct pci_dev *pdev, 185static int drv_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
186 const struct pci_device_id *pci_id)
187{ 186{
188 ... 187 ...
189 state->instance = atomic_inc_return(&drv_instance) - 1; 188 state->instance = atomic_inc_return(&drv_instance) - 1;
diff --git a/MAINTAINERS b/MAINTAINERS
index 4e2a1f67a1fc..212c255b9347 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -228,7 +228,7 @@ S: Maintained
228F: drivers/platform/x86/acerhdf.c 228F: drivers/platform/x86/acerhdf.c
229 229
230ACER WMI LAPTOP EXTRAS 230ACER WMI LAPTOP EXTRAS
231M: Joey Lee <jlee@novell.com> 231M: "Lee, Chun-Yi" <jlee@suse.com>
232L: platform-driver-x86@vger.kernel.org 232L: platform-driver-x86@vger.kernel.org
233S: Maintained 233S: Maintained
234F: drivers/platform/x86/acer-wmi.c 234F: drivers/platform/x86/acer-wmi.c
@@ -449,6 +449,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6.git
449S: Maintained 449S: Maintained
450F: drivers/char/agp/ 450F: drivers/char/agp/
451F: include/linux/agp* 451F: include/linux/agp*
452F: include/uapi/linux/agp*
452 453
453AHA152X SCSI DRIVER 454AHA152X SCSI DRIVER
454M: "Juergen E. Fischer" <fischer@norbit.de> 455M: "Juergen E. Fischer" <fischer@norbit.de>
@@ -589,6 +590,7 @@ M: Jiri Kosina <jkosina@suse.cz>
589S: Odd fixes 590S: Odd fixes
590F: arch/x86/kernel/apm_32.c 591F: arch/x86/kernel/apm_32.c
591F: include/linux/apm_bios.h 592F: include/linux/apm_bios.h
593F: include/uapi/linux/apm_bios.h
592F: drivers/char/apm-emulation.c 594F: drivers/char/apm-emulation.c
593 595
594APPLE BCM5974 MULTITOUCH DRIVER 596APPLE BCM5974 MULTITOUCH DRIVER
@@ -646,7 +648,7 @@ F: arch/arm/
646 648
647ARM SUB-ARCHITECTURES 649ARM SUB-ARCHITECTURES
648L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 650L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
649S: MAINTAINED 651S: Maintained
650F: arch/arm/mach-*/ 652F: arch/arm/mach-*/
651F: arch/arm/plat-*/ 653F: arch/arm/plat-*/
652T: git git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git 654T: git git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git
@@ -1005,7 +1007,6 @@ F: drivers/mmc/host/msm_sdcc.c
1005F: drivers/mmc/host/msm_sdcc.h 1007F: drivers/mmc/host/msm_sdcc.h
1006F: drivers/tty/serial/msm_serial.h 1008F: drivers/tty/serial/msm_serial.h
1007F: drivers/tty/serial/msm_serial.c 1009F: drivers/tty/serial/msm_serial.c
1008F: drivers/platform/msm/
1009F: drivers/*/pm8???-* 1010F: drivers/*/pm8???-*
1010F: include/linux/mfd/pm8xxx/ 1011F: include/linux/mfd/pm8xxx/
1011T: git git://git.kernel.org/pub/scm/linux/kernel/git/davidb/linux-msm.git 1012T: git git://git.kernel.org/pub/scm/linux/kernel/git/davidb/linux-msm.git
@@ -1069,7 +1070,6 @@ M: Russell King <linux@arm.linux.org.uk>
1069L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1070L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1070W: http://www.arm.linux.org.uk/ 1071W: http://www.arm.linux.org.uk/
1071S: Maintained 1072S: Maintained
1072F: arch/arm/common/time-acorn.c
1073F: arch/arm/include/asm/hardware/entry-macro-iomd.S 1073F: arch/arm/include/asm/hardware/entry-macro-iomd.S
1074F: arch/arm/include/asm/hardware/ioc.h 1074F: arch/arm/include/asm/hardware/ioc.h
1075F: arch/arm/include/asm/hardware/iomd.h 1075F: arch/arm/include/asm/hardware/iomd.h
@@ -1094,7 +1094,6 @@ W: http://www.fluff.org/ben/linux/
1094S: Maintained 1094S: Maintained
1095F: arch/arm/plat-samsung/ 1095F: arch/arm/plat-samsung/
1096F: arch/arm/plat-s3c24xx/ 1096F: arch/arm/plat-s3c24xx/
1097F: arch/arm/plat-s5p/
1098F: arch/arm/mach-s3c24*/ 1097F: arch/arm/mach-s3c24*/
1099F: arch/arm/mach-s3c64xx/ 1098F: arch/arm/mach-s3c64xx/
1100F: drivers/*/*s3c2410* 1099F: drivers/*/*s3c2410*
@@ -1125,7 +1124,6 @@ M: Sylwester Nawrocki <s.nawrocki@samsung.com>
1125L: linux-arm-kernel@lists.infradead.org 1124L: linux-arm-kernel@lists.infradead.org
1126L: linux-media@vger.kernel.org 1125L: linux-media@vger.kernel.org
1127S: Maintained 1126S: Maintained
1128F: arch/arm/plat-s5p/dev-fimc*
1129F: arch/arm/plat-samsung/include/plat/*fimc* 1127F: arch/arm/plat-samsung/include/plat/*fimc*
1130F: drivers/media/platform/s5p-fimc/ 1128F: drivers/media/platform/s5p-fimc/
1131 1129
@@ -1136,7 +1134,7 @@ M: Jeongtae Park <jtp.park@samsung.com>
1136L: linux-arm-kernel@lists.infradead.org 1134L: linux-arm-kernel@lists.infradead.org
1137L: linux-media@vger.kernel.org 1135L: linux-media@vger.kernel.org
1138S: Maintained 1136S: Maintained
1139F: arch/arm/plat-s5p/dev-mfc.c 1137F: arch/arm/plat-samsung/s5p-dev-mfc.c
1140F: drivers/media/platform/s5p-mfc/ 1138F: drivers/media/platform/s5p-mfc/
1141 1139
1142ARM/SAMSUNG S5P SERIES TV SUBSYSTEM SUPPORT 1140ARM/SAMSUNG S5P SERIES TV SUBSYSTEM SUPPORT
@@ -1254,7 +1252,7 @@ F: drivers/video/vt8500lcdfb.*
1254F: drivers/video/wm8505fb* 1252F: drivers/video/wm8505fb*
1255F: drivers/video/wmt_ge_rops.* 1253F: drivers/video/wmt_ge_rops.*
1256F: drivers/tty/serial/vt8500_serial.c 1254F: drivers/tty/serial/vt8500_serial.c
1257F: drivers/rtc/rtc-vt8500-c 1255F: drivers/rtc/rtc-vt8500.c
1258F: drivers/mmc/host/wmt-sdmmc.c 1256F: drivers/mmc/host/wmt-sdmmc.c
1259 1257
1260ARM/ZIPIT Z2 SUPPORT 1258ARM/ZIPIT Z2 SUPPORT
@@ -1353,6 +1351,14 @@ W: http://wireless.kernel.org/en/users/Drivers/ath9k
1353S: Supported 1351S: Supported
1354F: drivers/net/wireless/ath/ath9k/ 1352F: drivers/net/wireless/ath/ath9k/
1355 1353
1354WILOCITY WIL6210 WIRELESS DRIVER
1355M: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
1356L: linux-wireless@vger.kernel.org
1357L: wil6210@qca.qualcomm.com
1358S: Supported
1359W: http://wireless.kernel.org/en/users/Drivers/wil6210
1360F: drivers/net/wireless/ath/wil6210/
1361
1356CARL9170 LINUX COMMUNITY WIRELESS DRIVER 1362CARL9170 LINUX COMMUNITY WIRELESS DRIVER
1357M: Christian Lamparter <chunkeey@googlemail.com> 1363M: Christian Lamparter <chunkeey@googlemail.com>
1358L: linux-wireless@vger.kernel.org 1364L: linux-wireless@vger.kernel.org
@@ -1388,6 +1394,7 @@ W: http://linux-atm.sourceforge.net
1388S: Maintained 1394S: Maintained
1389F: drivers/atm/ 1395F: drivers/atm/
1390F: include/linux/atm* 1396F: include/linux/atm*
1397F: include/uapi/linux/atm*
1391 1398
1392ATMEL AT91 / AT32 MCI DRIVER 1399ATMEL AT91 / AT32 MCI DRIVER
1393M: Ludovic Desroches <ludovic.desroches@atmel.com> 1400M: Ludovic Desroches <ludovic.desroches@atmel.com>
@@ -1406,13 +1413,13 @@ L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1406S: Supported 1413S: Supported
1407F: drivers/dma/at_hdmac.c 1414F: drivers/dma/at_hdmac.c
1408F: drivers/dma/at_hdmac_regs.h 1415F: drivers/dma/at_hdmac_regs.h
1409F: arch/arm/mach-at91/include/mach/at_hdmac.h 1416F: include/linux/platform_data/dma-atmel.h
1410 1417
1411ATMEL ISI DRIVER 1418ATMEL ISI DRIVER
1412M: Josh Wu <josh.wu@atmel.com> 1419M: Josh Wu <josh.wu@atmel.com>
1413L: linux-media@vger.kernel.org 1420L: linux-media@vger.kernel.org
1414S: Supported 1421S: Supported
1415F: drivers/media/platform/atmel-isi.c 1422F: drivers/media/platform/soc_camera/atmel-isi.c
1416F: include/media/atmel-isi.h 1423F: include/media/atmel-isi.h
1417 1424
1418ATMEL LCDFB DRIVER 1425ATMEL LCDFB DRIVER
@@ -1467,6 +1474,7 @@ W: http://people.redhat.com/sgrubb/audit/
1467T: git git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current.git 1474T: git git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current.git
1468S: Maintained 1475S: Maintained
1469F: include/linux/audit.h 1476F: include/linux/audit.h
1477F: include/uapi/linux/audit.h
1470F: kernel/audit* 1478F: kernel/audit*
1471 1479
1472AUXILIARY DISPLAY DRIVERS 1480AUXILIARY DISPLAY DRIVERS
@@ -1497,7 +1505,7 @@ M: Ralf Baechle <ralf@linux-mips.org>
1497L: linux-hams@vger.kernel.org 1505L: linux-hams@vger.kernel.org
1498W: http://www.linux-ax25.org/ 1506W: http://www.linux-ax25.org/
1499S: Maintained 1507S: Maintained
1500F: include/linux/ax25.h 1508F: include/uapi/linux/ax25.h
1501F: include/net/ax25.h 1509F: include/net/ax25.h
1502F: net/ax25/ 1510F: net/ax25/
1503 1511
@@ -1558,7 +1566,7 @@ M: "Tigran A. Aivazian" <tigran@aivazian.fsnet.co.uk>
1558S: Maintained 1566S: Maintained
1559F: Documentation/filesystems/bfs.txt 1567F: Documentation/filesystems/bfs.txt
1560F: fs/bfs/ 1568F: fs/bfs/
1561F: include/linux/bfs_fs.h 1569F: include/uapi/linux/bfs_fs.h
1562 1570
1563BLACKFIN ARCHITECTURE 1571BLACKFIN ARCHITECTURE
1564M: Mike Frysinger <vapier@gentoo.org> 1572M: Mike Frysinger <vapier@gentoo.org>
@@ -1655,7 +1663,7 @@ L: netdev@vger.kernel.org
1655W: http://sourceforge.net/projects/bonding/ 1663W: http://sourceforge.net/projects/bonding/
1656S: Supported 1664S: Supported
1657F: drivers/net/bonding/ 1665F: drivers/net/bonding/
1658F: include/linux/if_bonding.h 1666F: include/uapi/linux/if_bonding.h
1659 1667
1660BROADCOM B44 10/100 ETHERNET DRIVER 1668BROADCOM B44 10/100 ETHERNET DRIVER
1661M: Gary Zambrano <zambrano@broadcom.com> 1669M: Gary Zambrano <zambrano@broadcom.com>
@@ -1734,6 +1742,7 @@ L: linux-scsi@vger.kernel.org
1734S: Supported 1742S: Supported
1735F: block/bsg.c 1743F: block/bsg.c
1736F: include/linux/bsg.h 1744F: include/linux/bsg.h
1745F: include/uapi/linux/bsg.h
1737 1746
1738BT87X AUDIO DRIVER 1747BT87X AUDIO DRIVER
1739M: Clemens Ladisch <clemens@ladisch.de> 1748M: Clemens Ladisch <clemens@ladisch.de>
@@ -1804,7 +1813,7 @@ L: netdev@vger.kernel.org
1804S: Supported 1813S: Supported
1805F: Documentation/networking/caif/ 1814F: Documentation/networking/caif/
1806F: drivers/net/caif/ 1815F: drivers/net/caif/
1807F: include/linux/caif/ 1816F: include/uapi/linux/caif/
1808F: include/net/caif/ 1817F: include/net/caif/
1809F: net/caif/ 1818F: net/caif/
1810 1819
@@ -1825,11 +1834,11 @@ W: http://gitorious.org/linux-can
1825T: git git://gitorious.org/linux-can/linux-can-next.git 1834T: git git://gitorious.org/linux-can/linux-can-next.git
1826S: Maintained 1835S: Maintained
1827F: net/can/ 1836F: net/can/
1828F: include/linux/can.h
1829F: include/linux/can/core.h 1837F: include/linux/can/core.h
1830F: include/linux/can/bcm.h 1838F: include/uapi/linux/can.h
1831F: include/linux/can/raw.h 1839F: include/uapi/linux/can/bcm.h
1832F: include/linux/can/gw.h 1840F: include/uapi/linux/can/raw.h
1841F: include/uapi/linux/can/gw.h
1833 1842
1834CAN NETWORK DRIVERS 1843CAN NETWORK DRIVERS
1835M: Wolfgang Grandegger <wg@grandegger.com> 1844M: Wolfgang Grandegger <wg@grandegger.com>
@@ -1840,15 +1849,16 @@ T: git git://gitorious.org/linux-can/linux-can-next.git
1840S: Maintained 1849S: Maintained
1841F: drivers/net/can/ 1850F: drivers/net/can/
1842F: include/linux/can/dev.h 1851F: include/linux/can/dev.h
1843F: include/linux/can/error.h
1844F: include/linux/can/netlink.h
1845F: include/linux/can/platform/ 1852F: include/linux/can/platform/
1853F: include/uapi/linux/can/error.h
1854F: include/uapi/linux/can/netlink.h
1846 1855
1847CAPABILITIES 1856CAPABILITIES
1848M: Serge Hallyn <serge.hallyn@canonical.com> 1857M: Serge Hallyn <serge.hallyn@canonical.com>
1849L: linux-security-module@vger.kernel.org 1858L: linux-security-module@vger.kernel.org
1850S: Supported 1859S: Supported
1851F: include/linux/capability.h 1860F: include/linux/capability.h
1861F: include/uapi/linux/capability.h
1852F: security/capability.c 1862F: security/capability.c
1853F: security/commoncap.c 1863F: security/commoncap.c
1854F: kernel/capability.c 1864F: kernel/capability.c
@@ -1861,6 +1871,7 @@ W: http://www.ibm.com/developerworks/power/cell/
1861S: Supported 1871S: Supported
1862F: arch/powerpc/include/asm/cell*.h 1872F: arch/powerpc/include/asm/cell*.h
1863F: arch/powerpc/include/asm/spu*.h 1873F: arch/powerpc/include/asm/spu*.h
1874F: arch/powerpc/include/uapi/asm/spu*.h
1864F: arch/powerpc/oprofile/*cell* 1875F: arch/powerpc/oprofile/*cell*
1865F: arch/powerpc/platforms/cell/ 1876F: arch/powerpc/platforms/cell/
1866 1877
@@ -1909,7 +1920,7 @@ W: http://wireless.kernel.org/
1909T: git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git 1920T: git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git
1910T: git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git 1921T: git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git
1911S: Maintained 1922S: Maintained
1912F: include/linux/nl80211.h 1923F: include/uapi/linux/nl80211.h
1913F: include/net/cfg80211.h 1924F: include/net/cfg80211.h
1914F: net/wireless/* 1925F: net/wireless/*
1915X: net/wireless/wext* 1926X: net/wireless/wext*
@@ -1961,9 +1972,9 @@ S: Maintained
1961F: drivers/usb/host/ohci-ep93xx.c 1972F: drivers/usb/host/ohci-ep93xx.c
1962 1973
1963CIRRUS LOGIC CS4270 SOUND DRIVER 1974CIRRUS LOGIC CS4270 SOUND DRIVER
1964M: Timur Tabi <timur@freescale.com> 1975M: Timur Tabi <timur@tabi.org>
1965L: alsa-devel@alsa-project.org (moderated for non-subscribers) 1976L: alsa-devel@alsa-project.org (moderated for non-subscribers)
1966S: Supported 1977S: Odd Fixes
1967F: sound/soc/codecs/cs4270* 1978F: sound/soc/codecs/cs4270*
1968 1979
1969CLEANCACHE API 1980CLEANCACHE API
@@ -2012,6 +2023,7 @@ S: Maintained
2012F: Documentation/filesystems/coda.txt 2023F: Documentation/filesystems/coda.txt
2013F: fs/coda/ 2024F: fs/coda/
2014F: include/linux/coda*.h 2025F: include/linux/coda*.h
2026F: include/uapi/linux/coda*.h
2015 2027
2016COMMON CLK FRAMEWORK 2028COMMON CLK FRAMEWORK
2017M: Mike Turquette <mturquette@linaro.org> 2029M: Mike Turquette <mturquette@linaro.org>
@@ -2266,6 +2278,7 @@ W: http://www.cyclades.com/
2266S: Orphan 2278S: Orphan
2267F: drivers/tty/cyclades.c 2279F: drivers/tty/cyclades.c
2268F: include/linux/cyclades.h 2280F: include/linux/cyclades.h
2281F: include/uapi/linux/cyclades.h
2269 2282
2270CYCLADES PC300 DRIVER 2283CYCLADES PC300 DRIVER
2271W: http://www.cyclades.com/ 2284W: http://www.cyclades.com/
@@ -2323,6 +2336,7 @@ L: dccp@vger.kernel.org
2323W: http://www.linuxfoundation.org/collaborate/workgroups/networking/dccp 2336W: http://www.linuxfoundation.org/collaborate/workgroups/networking/dccp
2324S: Maintained 2337S: Maintained
2325F: include/linux/dccp.h 2338F: include/linux/dccp.h
2339F: include/uapi/linux/dccp.h
2326F: include/linux/tfrc.h 2340F: include/linux/tfrc.h
2327F: net/dccp/ 2341F: net/dccp/
2328 2342
@@ -2349,7 +2363,7 @@ M: Massimo Dal Zotto <dz@debian.org>
2349W: http://www.debian.org/~dz/i8k/ 2363W: http://www.debian.org/~dz/i8k/
2350S: Maintained 2364S: Maintained
2351F: drivers/char/i8k.c 2365F: drivers/char/i8k.c
2352F: include/linux/i8k.h 2366F: include/uapi/linux/i8k.h
2353 2367
2354DELL SYSTEMS MANAGEMENT BASE DRIVER (dcdbas) 2368DELL SYSTEMS MANAGEMENT BASE DRIVER (dcdbas)
2355M: Doug Warzecha <Douglas_Warzecha@dell.com> 2369M: Doug Warzecha <Douglas_Warzecha@dell.com>
@@ -2422,6 +2436,7 @@ S: Maintained
2422F: Documentation/filesystems/quota.txt 2436F: Documentation/filesystems/quota.txt
2423F: fs/quota/ 2437F: fs/quota/
2424F: include/linux/quota*.h 2438F: include/linux/quota*.h
2439F: include/uapi/linux/quota*.h
2425 2440
2426DISPLAYLINK USB 2.0 FRAMEBUFFER DRIVER (UDLFB) 2441DISPLAYLINK USB 2.0 FRAMEBUFFER DRIVER (UDLFB)
2427M: Bernie Thompson <bernie@plugable.com> 2442M: Bernie Thompson <bernie@plugable.com>
@@ -2528,6 +2543,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6.git
2528S: Maintained 2543S: Maintained
2529F: drivers/gpu/drm/ 2544F: drivers/gpu/drm/
2530F: include/drm/ 2545F: include/drm/
2546F: include/uapi/drm/
2531 2547
2532INTEL DRM DRIVERS (excluding Poulsbo, Moorestown and derivative chipsets) 2548INTEL DRM DRIVERS (excluding Poulsbo, Moorestown and derivative chipsets)
2533M: Daniel Vetter <daniel.vetter@ffwll.ch> 2549M: Daniel Vetter <daniel.vetter@ffwll.ch>
@@ -2537,6 +2553,7 @@ T: git git://people.freedesktop.org/~danvet/drm-intel
2537S: Supported 2553S: Supported
2538F: drivers/gpu/drm/i915 2554F: drivers/gpu/drm/i915
2539F: include/drm/i915* 2555F: include/drm/i915*
2556F: include/uapi/drm/i915*
2540 2557
2541DRM DRIVERS FOR EXYNOS 2558DRM DRIVERS FOR EXYNOS
2542M: Inki Dae <inki.dae@samsung.com> 2559M: Inki Dae <inki.dae@samsung.com>
@@ -2548,6 +2565,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git
2548S: Supported 2565S: Supported
2549F: drivers/gpu/drm/exynos 2566F: drivers/gpu/drm/exynos
2550F: include/drm/exynos* 2567F: include/drm/exynos*
2568F: include/uapi/drm/exynos*
2551 2569
2552DRM DRIVERS FOR NVIDIA TEGRA 2570DRM DRIVERS FOR NVIDIA TEGRA
2553M: Thierry Reding <thierry.reding@avionic-design.de> 2571M: Thierry Reding <thierry.reding@avionic-design.de>
@@ -2622,7 +2640,7 @@ W: http://github.com/mkrufky
2622Q: http://patchwork.linuxtv.org/project/linux-media/list/ 2640Q: http://patchwork.linuxtv.org/project/linux-media/list/
2623T: git git://linuxtv.org/media_tree.git 2641T: git git://linuxtv.org/media_tree.git
2624S: Maintained 2642S: Maintained
2625F: drivers/media/usb/dvb-usb-v2/cxusb* 2643F: drivers/media/usb/dvb-usb/cxusb*
2626 2644
2627DVB_USB_CYPRESS_FIRMWARE MEDIA DRIVER 2645DVB_USB_CYPRESS_FIRMWARE MEDIA DRIVER
2628M: Antti Palosaari <crope@iki.fi> 2646M: Antti Palosaari <crope@iki.fi>
@@ -2722,6 +2740,7 @@ L: netfilter-devel@vger.kernel.org
2722W: http://ebtables.sourceforge.net/ 2740W: http://ebtables.sourceforge.net/
2723S: Maintained 2741S: Maintained
2724F: include/linux/netfilter_bridge/ebt_*.h 2742F: include/linux/netfilter_bridge/ebt_*.h
2743F: include/uapi/linux/netfilter_bridge/ebt_*.h
2725F: net/bridge/netfilter/ebt*.c 2744F: net/bridge/netfilter/ebt*.c
2726 2745
2727EC100 MEDIA DRIVER 2746EC100 MEDIA DRIVER
@@ -2933,12 +2952,6 @@ M: Maxim Levitsky <maximlevitsky@gmail.com>
2933S: Maintained 2952S: Maintained
2934F: drivers/media/rc/ene_ir.* 2953F: drivers/media/rc/ene_ir.*
2935 2954
2936EPSON 1355 FRAMEBUFFER DRIVER
2937M: Christopher Hoover <ch@murgatroid.com>
2938M: Christopher Hoover <ch@hpl.hp.com>
2939S: Maintained
2940F: drivers/video/epson1355fb.c
2941
2942EPSON S1D13XXX FRAMEBUFFER DRIVER 2955EPSON S1D13XXX FRAMEBUFFER DRIVER
2943M: Kristoffer Ericson <kristoffer.ericson@gmail.com> 2956M: Kristoffer Ericson <kristoffer.ericson@gmail.com>
2944S: Maintained 2957S: Maintained
@@ -2953,7 +2966,7 @@ S: Maintained
2953F: drivers/net/ethernet/i825xx/eexpress.* 2966F: drivers/net/ethernet/i825xx/eexpress.*
2954 2967
2955ETHERNET BRIDGE 2968ETHERNET BRIDGE
2956M: Stephen Hemminger <shemminger@vyatta.com> 2969M: Stephen Hemminger <stephen@networkplumber.org>
2957L: bridge@lists.linux-foundation.org 2970L: bridge@lists.linux-foundation.org
2958L: netdev@vger.kernel.org 2971L: netdev@vger.kernel.org
2959W: http://www.linuxfoundation.org/en/Net:Bridge 2972W: http://www.linuxfoundation.org/en/Net:Bridge
@@ -3051,6 +3064,7 @@ M: Eric Paris <eparis@redhat.com>
3051S: Maintained 3064S: Maintained
3052F: fs/notify/fanotify/ 3065F: fs/notify/fanotify/
3053F: include/linux/fanotify.h 3066F: include/linux/fanotify.h
3067F: include/uapi/linux/fanotify.h
3054 3068
3055FARSYNC SYNCHRONOUS DRIVER 3069FARSYNC SYNCHRONOUS DRIVER
3056M: Kevin Curtis <kevin.curtis@farsite.co.uk> 3070M: Kevin Curtis <kevin.curtis@farsite.co.uk>
@@ -3074,6 +3088,7 @@ F: drivers/scsi/fcoe/
3074F: include/scsi/fc/ 3088F: include/scsi/fc/
3075F: include/scsi/libfc.h 3089F: include/scsi/libfc.h
3076F: include/scsi/libfcoe.h 3090F: include/scsi/libfcoe.h
3091F: include/uapi/scsi/fc/
3077 3092
3078FILE LOCKING (flock() and fcntl()/lockf()) 3093FILE LOCKING (flock() and fcntl()/lockf())
3079M: Matthew Wilcox <matthew@wil.cx> 3094M: Matthew Wilcox <matthew@wil.cx>
@@ -3081,6 +3096,8 @@ L: linux-fsdevel@vger.kernel.org
3081S: Maintained 3096S: Maintained
3082F: include/linux/fcntl.h 3097F: include/linux/fcntl.h
3083F: include/linux/fs.h 3098F: include/linux/fs.h
3099F: include/uapi/linux/fcntl.h
3100F: include/uapi/linux/fs.h
3084F: fs/fcntl.c 3101F: fs/fcntl.c
3085F: fs/locks.c 3102F: fs/locks.c
3086 3103
@@ -3170,11 +3187,13 @@ F: Documentation/devicetree/bindings/fb/
3170F: drivers/video/ 3187F: drivers/video/
3171F: include/video/ 3188F: include/video/
3172F: include/linux/fb.h 3189F: include/linux/fb.h
3190F: include/uapi/video/
3191F: include/uapi/linux/fb.h
3173 3192
3174FREESCALE DIU FRAMEBUFFER DRIVER 3193FREESCALE DIU FRAMEBUFFER DRIVER
3175M: Timur Tabi <timur@freescale.com> 3194M: Timur Tabi <timur@tabi.org>
3176L: linux-fbdev@vger.kernel.org 3195L: linux-fbdev@vger.kernel.org
3177S: Supported 3196S: Maintained
3178F: drivers/video/fsl-diu-fb.* 3197F: drivers/video/fsl-diu-fb.*
3179 3198
3180FREESCALE DMA DRIVER 3199FREESCALE DMA DRIVER
@@ -3196,7 +3215,7 @@ M: Sascha Hauer <kernel@pengutronix.de>
3196L: linux-fbdev@vger.kernel.org 3215L: linux-fbdev@vger.kernel.org
3197L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 3216L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
3198S: Maintained 3217S: Maintained
3199F: arch/arm/plat-mxc/include/mach/imxfb.h 3218F: include/linux/platform_data/video-imxfb.h
3200F: drivers/video/imxfb.c 3219F: drivers/video/imxfb.c
3201 3220
3202FREESCALE SOC FS_ENET DRIVER 3221FREESCALE SOC FS_ENET DRIVER
@@ -3209,9 +3228,8 @@ F: drivers/net/ethernet/freescale/fs_enet/
3209F: include/linux/fs_enet_pd.h 3228F: include/linux/fs_enet_pd.h
3210 3229
3211FREESCALE QUICC ENGINE LIBRARY 3230FREESCALE QUICC ENGINE LIBRARY
3212M: Timur Tabi <timur@freescale.com>
3213L: linuxppc-dev@lists.ozlabs.org 3231L: linuxppc-dev@lists.ozlabs.org
3214S: Supported 3232S: Orphan
3215F: arch/powerpc/sysdev/qe_lib/ 3233F: arch/powerpc/sysdev/qe_lib/
3216F: arch/powerpc/include/asm/*qe.h 3234F: arch/powerpc/include/asm/*qe.h
3217 3235
@@ -3230,16 +3248,16 @@ S: Maintained
3230F: drivers/net/ethernet/freescale/ucc_geth* 3248F: drivers/net/ethernet/freescale/ucc_geth*
3231 3249
3232FREESCALE QUICC ENGINE UCC UART DRIVER 3250FREESCALE QUICC ENGINE UCC UART DRIVER
3233M: Timur Tabi <timur@freescale.com> 3251M: Timur Tabi <timur@tabi.org>
3234L: linuxppc-dev@lists.ozlabs.org 3252L: linuxppc-dev@lists.ozlabs.org
3235S: Supported 3253S: Maintained
3236F: drivers/tty/serial/ucc_uart.c 3254F: drivers/tty/serial/ucc_uart.c
3237 3255
3238FREESCALE SOC SOUND DRIVERS 3256FREESCALE SOC SOUND DRIVERS
3239M: Timur Tabi <timur@freescale.com> 3257M: Timur Tabi <timur@tabi.org>
3240L: alsa-devel@alsa-project.org (moderated for non-subscribers) 3258L: alsa-devel@alsa-project.org (moderated for non-subscribers)
3241L: linuxppc-dev@lists.ozlabs.org 3259L: linuxppc-dev@lists.ozlabs.org
3242S: Supported 3260S: Maintained
3243F: sound/soc/fsl/fsl* 3261F: sound/soc/fsl/fsl*
3244F: sound/soc/fsl/mpc8610_hpcd.c 3262F: sound/soc/fsl/mpc8610_hpcd.c
3245 3263
@@ -3273,6 +3291,16 @@ F: Documentation/filesystems/caching/
3273F: fs/fscache/ 3291F: fs/fscache/
3274F: include/linux/fscache*.h 3292F: include/linux/fscache*.h
3275 3293
3294F2FS FILE SYSTEM
3295M: Jaegeuk Kim <jaegeuk.kim@samsung.com>
3296L: linux-f2fs-devel@lists.sourceforge.net
3297W: http://en.wikipedia.org/wiki/F2FS
3298T: git git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git
3299S: Maintained
3300F: Documentation/filesystems/f2fs.txt
3301F: fs/f2fs/
3302F: include/linux/f2fs_fs.h
3303
3276FUJITSU FR-V (FRV) PORT 3304FUJITSU FR-V (FRV) PORT
3277M: David Howells <dhowells@redhat.com> 3305M: David Howells <dhowells@redhat.com>
3278S: Maintained 3306S: Maintained
@@ -3304,7 +3332,7 @@ L: fuse-devel@lists.sourceforge.net
3304W: http://fuse.sourceforge.net/ 3332W: http://fuse.sourceforge.net/
3305S: Maintained 3333S: Maintained
3306F: fs/fuse/ 3334F: fs/fuse/
3307F: include/linux/fuse.h 3335F: include/uapi/linux/fuse.h
3308 3336
3309FUTURE DOMAIN TMC-16x0 SCSI DRIVER (16-bit) 3337FUTURE DOMAIN TMC-16x0 SCSI DRIVER (16-bit)
3310M: Rik Faith <faith@cs.unc.edu> 3338M: Rik Faith <faith@cs.unc.edu>
@@ -3351,6 +3379,7 @@ L: linux-arch@vger.kernel.org
3351T: git git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic.git 3379T: git git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic.git
3352S: Maintained 3380S: Maintained
3353F: include/asm-generic 3381F: include/asm-generic
3382F: include/uapi/asm-generic
3354 3383
3355GENERIC UIO DRIVER FOR PCI DEVICES 3384GENERIC UIO DRIVER FOR PCI DEVICES
3356M: "Michael S. Tsirkin" <mst@redhat.com> 3385M: "Michael S. Tsirkin" <mst@redhat.com>
@@ -3367,7 +3396,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-nmw.git
3367S: Supported 3396S: Supported
3368F: Documentation/filesystems/gfs2*.txt 3397F: Documentation/filesystems/gfs2*.txt
3369F: fs/gfs2/ 3398F: fs/gfs2/
3370F: include/linux/gfs2_ondisk.h 3399F: include/uapi/linux/gfs2_ondisk.h
3371 3400
3372GIGASET ISDN DRIVERS 3401GIGASET ISDN DRIVERS
3373M: Hansjoerg Lipp <hjlipp@web.de> 3402M: Hansjoerg Lipp <hjlipp@web.de>
@@ -3377,7 +3406,7 @@ W: http://gigaset307x.sourceforge.net/
3377S: Maintained 3406S: Maintained
3378F: Documentation/isdn/README.gigaset 3407F: Documentation/isdn/README.gigaset
3379F: drivers/isdn/gigaset/ 3408F: drivers/isdn/gigaset/
3380F: include/linux/gigaset_dev.h 3409F: include/uapi/linux/gigaset_dev.h
3381 3410
3382GPIO SUBSYSTEM 3411GPIO SUBSYSTEM
3383M: Grant Likely <grant.likely@secretlab.ca> 3412M: Grant Likely <grant.likely@secretlab.ca>
@@ -3534,6 +3563,7 @@ S: Supported
3534F: Documentation/scsi/hpsa.txt 3563F: Documentation/scsi/hpsa.txt
3535F: drivers/scsi/hpsa*.[ch] 3564F: drivers/scsi/hpsa*.[ch]
3536F: include/linux/cciss*.h 3565F: include/linux/cciss*.h
3566F: include/uapi/linux/cciss*.h
3537 3567
3538HEWLETT-PACKARD SMART CISS RAID DRIVER (cciss) 3568HEWLETT-PACKARD SMART CISS RAID DRIVER (cciss)
3539M: Mike Miller <mike.miller@hp.com> 3569M: Mike Miller <mike.miller@hp.com>
@@ -3542,6 +3572,7 @@ S: Supported
3542F: Documentation/blockdev/cciss.txt 3572F: Documentation/blockdev/cciss.txt
3543F: drivers/block/cciss* 3573F: drivers/block/cciss*
3544F: include/linux/cciss_ioctl.h 3574F: include/linux/cciss_ioctl.h
3575F: include/uapi/linux/cciss_ioctl.h
3545 3576
3546HFS FILESYSTEM 3577HFS FILESYSTEM
3547L: linux-fsdevel@vger.kernel.org 3578L: linux-fsdevel@vger.kernel.org
@@ -3576,6 +3607,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid.git
3576S: Maintained 3607S: Maintained
3577F: drivers/hid/ 3608F: drivers/hid/
3578F: include/linux/hid* 3609F: include/linux/hid*
3610F: include/uapi/linux/hid*
3579 3611
3580HIGH-RESOLUTION TIMERS, CLOCKEVENTS, DYNTICKS 3612HIGH-RESOLUTION TIMERS, CLOCKEVENTS, DYNTICKS
3581M: Thomas Gleixner <tglx@linutronix.de> 3613M: Thomas Gleixner <tglx@linutronix.de>
@@ -3607,7 +3639,7 @@ M: Jes Sorensen <jes@trained-monkey.org>
3607L: linux-hippi@sunsite.dk 3639L: linux-hippi@sunsite.dk
3608S: Maintained 3640S: Maintained
3609F: include/linux/hippidevice.h 3641F: include/linux/hippidevice.h
3610F: include/linux/if_hippi.h 3642F: include/uapi/linux/if_hippi.h
3611F: net/802/hippi.c 3643F: net/802/hippi.c
3612F: drivers/net/hippi/ 3644F: drivers/net/hippi/
3613 3645
@@ -3635,6 +3667,7 @@ S: Maintained
3635F: Documentation/timers/hpet.txt 3667F: Documentation/timers/hpet.txt
3636F: drivers/char/hpet.c 3668F: drivers/char/hpet.c
3637F: include/linux/hpet.h 3669F: include/linux/hpet.h
3670F: include/uapi/linux/hpet.h
3638 3671
3639HPET: x86 3672HPET: x86
3640M: "Venkatesh Pallipadi (Venki)" <venki@google.com> 3673M: "Venkatesh Pallipadi (Venki)" <venki@google.com>
@@ -3735,6 +3768,8 @@ F: Documentation/i2c/
3735F: drivers/i2c/ 3768F: drivers/i2c/
3736F: include/linux/i2c.h 3769F: include/linux/i2c.h
3737F: include/linux/i2c-*.h 3770F: include/linux/i2c-*.h
3771F: include/uapi/linux/i2c.h
3772F: include/uapi/linux/i2c-*.h
3738 3773
3739I2C-TAOS-EVM DRIVER 3774I2C-TAOS-EVM DRIVER
3740M: Jean Delvare <khali@linux-fr.org> 3775M: Jean Delvare <khali@linux-fr.org>
@@ -3850,7 +3885,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/lowpan/lowpan.git
3850S: Maintained 3885S: Maintained
3851F: net/ieee802154/ 3886F: net/ieee802154/
3852F: net/mac802154/ 3887F: net/mac802154/
3853F: drivers/ieee802154/ 3888F: drivers/net/ieee802154/
3854 3889
3855IGUANAWORKS USB IR TRANSCEIVER 3890IGUANAWORKS USB IR TRANSCEIVER
3856M: Sean Young <sean@mess.org> 3891M: Sean Young <sean@mess.org>
@@ -3901,7 +3936,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband.git
3901S: Supported 3936S: Supported
3902F: Documentation/infiniband/ 3937F: Documentation/infiniband/
3903F: drivers/infiniband/ 3938F: drivers/infiniband/
3904F: include/linux/if_infiniband.h 3939F: include/uapi/linux/if_infiniband.h
3905 3940
3906INOTIFY 3941INOTIFY
3907M: John McCutchan <john@johnmccutchan.com> 3942M: John McCutchan <john@johnmccutchan.com>
@@ -3911,6 +3946,7 @@ S: Maintained
3911F: Documentation/filesystems/inotify.txt 3946F: Documentation/filesystems/inotify.txt
3912F: fs/notify/inotify/ 3947F: fs/notify/inotify/
3913F: include/linux/inotify.h 3948F: include/linux/inotify.h
3949F: include/uapi/linux/inotify.h
3914 3950
3915INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN) DRIVERS 3951INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN) DRIVERS
3916M: Dmitry Torokhov <dmitry.torokhov@gmail.com> 3952M: Dmitry Torokhov <dmitry.torokhov@gmail.com>
@@ -3921,6 +3957,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git
3921S: Maintained 3957S: Maintained
3922F: drivers/input/ 3958F: drivers/input/
3923F: include/linux/input.h 3959F: include/linux/input.h
3960F: include/uapi/linux/input.h
3924F: include/linux/input/ 3961F: include/linux/input/
3925 3962
3926INPUT MULTITOUCH (MT) PROTOCOL 3963INPUT MULTITOUCH (MT) PROTOCOL
@@ -3941,7 +3978,6 @@ L: linux-scsi@vger.kernel.org
3941T: git git://git.code.sf.net/p/intel-sas/isci 3978T: git git://git.code.sf.net/p/intel-sas/isci
3942S: Supported 3979S: Supported
3943F: drivers/scsi/isci/ 3980F: drivers/scsi/isci/
3944F: firmware/isci/
3945 3981
3946INTEL IDLE DRIVER 3982INTEL IDLE DRIVER
3947M: Len Brown <lenb@kernel.org> 3983M: Len Brown <lenb@kernel.org>
@@ -4036,12 +4072,6 @@ F: Documentation/networking/ixgbe.txt
4036F: Documentation/networking/ixgbevf.txt 4072F: Documentation/networking/ixgbevf.txt
4037F: drivers/net/ethernet/intel/ 4073F: drivers/net/ethernet/intel/
4038 4074
4039INTEL MRST PMU DRIVER
4040M: Len Brown <len.brown@intel.com>
4041L: linux-pm@vger.kernel.org
4042S: Supported
4043F: arch/x86/platform/mrst/pmu.*
4044
4045INTEL PRO/WIRELESS 2100, 2200BG, 2915ABG NETWORK CONNECTION SUPPORT 4075INTEL PRO/WIRELESS 2100, 2200BG, 2915ABG NETWORK CONNECTION SUPPORT
4046M: Stanislav Yakovlev <stas.yakovlev@gmail.com> 4076M: Stanislav Yakovlev <stas.yakovlev@gmail.com>
4047L: linux-wireless@vger.kernel.org 4077L: linux-wireless@vger.kernel.org
@@ -4070,7 +4100,7 @@ S: Supported
4070W: http://linuxwimax.org 4100W: http://linuxwimax.org
4071F: Documentation/wimax/README.i2400m 4101F: Documentation/wimax/README.i2400m
4072F: drivers/net/wimax/i2400m/ 4102F: drivers/net/wimax/i2400m/
4073F: include/linux/wimax/i2400m.h 4103F: include/uapi/linux/wimax/i2400m.h
4074 4104
4075INTEL WIRELESS 3945ABG/BG, 4965AGN (iwlegacy) 4105INTEL WIRELESS 3945ABG/BG, 4965AGN (iwlegacy)
4076M: Stanislaw Gruszka <sgruszka@redhat.com> 4106M: Stanislaw Gruszka <sgruszka@redhat.com>
@@ -4092,9 +4122,9 @@ INTEL MANAGEMENT ENGINE (mei)
4092M: Tomas Winkler <tomas.winkler@intel.com> 4122M: Tomas Winkler <tomas.winkler@intel.com>
4093L: linux-kernel@vger.kernel.org 4123L: linux-kernel@vger.kernel.org
4094S: Supported 4124S: Supported
4095F: include/linux/mei.h 4125F: include/uapi/linux/mei.h
4096F: drivers/misc/mei/* 4126F: drivers/misc/mei/*
4097F: Documentation/mei/* 4127F: Documentation/misc-devices/mei/*
4098 4128
4099IOC3 ETHERNET DRIVER 4129IOC3 ETHERNET DRIVER
4100M: Ralf Baechle <ralf@linux-mips.org> 4130M: Ralf Baechle <ralf@linux-mips.org>
@@ -4134,6 +4164,7 @@ S: Supported
4134F: Documentation/IPMI.txt 4164F: Documentation/IPMI.txt
4135F: drivers/char/ipmi/ 4165F: drivers/char/ipmi/
4136F: include/linux/ipmi* 4166F: include/linux/ipmi*
4167F: include/uapi/linux/ipmi*
4137 4168
4138IPS SCSI RAID DRIVER 4169IPS SCSI RAID DRIVER
4139M: Adaptec OEM Raid Solutions <aacraid@adaptec.com> 4170M: Adaptec OEM Raid Solutions <aacraid@adaptec.com>
@@ -4151,7 +4182,7 @@ L: lvs-devel@vger.kernel.org
4151S: Maintained 4182S: Maintained
4152F: Documentation/networking/ipvs-sysctl.txt 4183F: Documentation/networking/ipvs-sysctl.txt
4153F: include/net/ip_vs.h 4184F: include/net/ip_vs.h
4154F: include/linux/ip_vs.h 4185F: include/uapi/linux/ip_vs.h
4155F: net/netfilter/ipvs/ 4186F: net/netfilter/ipvs/
4156 4187
4157IPWIRELESS DRIVER 4188IPWIRELESS DRIVER
@@ -4164,8 +4195,8 @@ IPX NETWORK LAYER
4164M: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> 4195M: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
4165L: netdev@vger.kernel.org 4196L: netdev@vger.kernel.org
4166S: Maintained 4197S: Maintained
4167F: include/linux/ipx.h
4168F: include/net/ipx.h 4198F: include/net/ipx.h
4199F: include/uapi/linux/ipx.h
4169F: net/ipx/ 4200F: net/ipx/
4170 4201
4171IRDA SUBSYSTEM 4202IRDA SUBSYSTEM
@@ -4228,6 +4259,8 @@ F: Documentation/isdn/
4228F: drivers/isdn/ 4259F: drivers/isdn/
4229F: include/linux/isdn.h 4260F: include/linux/isdn.h
4230F: include/linux/isdn/ 4261F: include/linux/isdn/
4262F: include/uapi/linux/isdn.h
4263F: include/uapi/linux/isdn/
4231 4264
4232ISDN SUBSYSTEM (Eicon active card driver) 4265ISDN SUBSYSTEM (Eicon active card driver)
4233M: Armin Schindler <mac@melware.de> 4266M: Armin Schindler <mac@melware.de>
@@ -4268,7 +4301,7 @@ W: http://www.ivtvdriver.org
4268S: Maintained 4301S: Maintained
4269F: Documentation/video4linux/*.ivtv 4302F: Documentation/video4linux/*.ivtv
4270F: drivers/media/pci/ivtv/ 4303F: drivers/media/pci/ivtv/
4271F: include/linux/ivtv* 4304F: include/uapi/linux/ivtv*
4272 4305
4273IX2505V MEDIA DRIVER 4306IX2505V MEDIA DRIVER
4274M: Malcolm Priestley <tvboxspy@gmail.com> 4307M: Malcolm Priestley <tvboxspy@gmail.com>
@@ -4306,7 +4339,7 @@ L: linux-mtd@lists.infradead.org
4306W: http://www.linux-mtd.infradead.org/doc/jffs2.html 4339W: http://www.linux-mtd.infradead.org/doc/jffs2.html
4307S: Maintained 4340S: Maintained
4308F: fs/jffs2/ 4341F: fs/jffs2/
4309F: include/linux/jffs2.h 4342F: include/uapi/linux/jffs2.h
4310 4343
4311JOURNALLING LAYER FOR BLOCK DEVICES (JBD) 4344JOURNALLING LAYER FOR BLOCK DEVICES (JBD)
4312M: Andrew Morton <akpm@linux-foundation.org> 4345M: Andrew Morton <akpm@linux-foundation.org>
@@ -4389,11 +4422,13 @@ W: http://nfs.sourceforge.net/
4389S: Supported 4422S: Supported
4390F: fs/nfsd/ 4423F: fs/nfsd/
4391F: include/linux/nfsd/ 4424F: include/linux/nfsd/
4425F: include/uapi/linux/nfsd/
4392F: fs/lockd/ 4426F: fs/lockd/
4393F: fs/nfs_common/ 4427F: fs/nfs_common/
4394F: net/sunrpc/ 4428F: net/sunrpc/
4395F: include/linux/lockd/ 4429F: include/linux/lockd/
4396F: include/linux/sunrpc/ 4430F: include/linux/sunrpc/
4431F: include/uapi/linux/sunrpc/
4397 4432
4398KERNEL VIRTUAL MACHINE (KVM) 4433KERNEL VIRTUAL MACHINE (KVM)
4399M: Marcelo Tosatti <mtosatti@redhat.com> 4434M: Marcelo Tosatti <mtosatti@redhat.com>
@@ -4405,6 +4440,7 @@ F: Documentation/*/kvm.txt
4405F: arch/*/kvm/ 4440F: arch/*/kvm/
4406F: arch/*/include/asm/kvm* 4441F: arch/*/include/asm/kvm*
4407F: include/linux/kvm* 4442F: include/linux/kvm*
4443F: include/uapi/linux/kvm*
4408F: virt/kvm/ 4444F: virt/kvm/
4409 4445
4410KERNEL VIRTUAL MACHINE (KVM) FOR AMD-V 4446KERNEL VIRTUAL MACHINE (KVM) FOR AMD-V
@@ -4451,6 +4487,7 @@ W: http://kernel.org/pub/linux/utils/kernel/kexec/
4451L: kexec@lists.infradead.org 4487L: kexec@lists.infradead.org
4452S: Maintained 4488S: Maintained
4453F: include/linux/kexec.h 4489F: include/linux/kexec.h
4490F: include/uapi/linux/kexec.h
4454F: kernel/kexec.c 4491F: kernel/kexec.c
4455 4492
4456KEYS/KEYRINGS: 4493KEYS/KEYRINGS:
@@ -4692,6 +4729,7 @@ LLC (802.2)
4692M: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> 4729M: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
4693S: Maintained 4730S: Maintained
4694F: include/linux/llc.h 4731F: include/linux/llc.h
4732F: include/uapi/linux/llc.h
4695F: include/net/llc* 4733F: include/net/llc*
4696F: net/llc/ 4734F: net/llc/
4697 4735
@@ -4867,7 +4905,7 @@ S: Maintained
4867 4905
4868MARVELL GIGABIT ETHERNET DRIVERS (skge/sky2) 4906MARVELL GIGABIT ETHERNET DRIVERS (skge/sky2)
4869M: Mirko Lindner <mlindner@marvell.com> 4907M: Mirko Lindner <mlindner@marvell.com>
4870M: Stephen Hemminger <shemminger@vyatta.com> 4908M: Stephen Hemminger <stephen@networkplumber.org>
4871L: netdev@vger.kernel.org 4909L: netdev@vger.kernel.org
4872S: Maintained 4910S: Maintained
4873F: drivers/net/ethernet/marvell/sk* 4911F: drivers/net/ethernet/marvell/sk*
@@ -4912,7 +4950,7 @@ MATROX FRAMEBUFFER DRIVER
4912L: linux-fbdev@vger.kernel.org 4950L: linux-fbdev@vger.kernel.org
4913S: Orphan 4951S: Orphan
4914F: drivers/video/matrox/matroxfb_* 4952F: drivers/video/matrox/matroxfb_*
4915F: include/linux/matroxfb.h 4953F: include/uapi/linux/matroxfb.h
4916 4954
4917MAX16065 HARDWARE MONITOR DRIVER 4955MAX16065 HARDWARE MONITOR DRIVER
4918M: Guenter Roeck <linux@roeck-us.net> 4956M: Guenter Roeck <linux@roeck-us.net>
@@ -4994,7 +5032,7 @@ T: git git://git.infradead.org/mtd-2.6.git
4994S: Maintained 5032S: Maintained
4995F: drivers/mtd/ 5033F: drivers/mtd/
4996F: include/linux/mtd/ 5034F: include/linux/mtd/
4997F: include/mtd/ 5035F: include/uapi/mtd/
4998 5036
4999MICROBLAZE ARCHITECTURE 5037MICROBLAZE ARCHITECTURE
5000M: Michal Simek <monstr@monstr.eu> 5038M: Michal Simek <monstr@monstr.eu>
@@ -5032,12 +5070,6 @@ F: Documentation/video4linux/meye.txt
5032F: drivers/media/pci/meye/ 5070F: drivers/media/pci/meye/
5033F: include/uapi/linux/meye.h 5071F: include/uapi/linux/meye.h
5034 5072
5035MOTOROLA IMX MMC/SD HOST CONTROLLER INTERFACE DRIVER
5036M: Pavel Pisa <ppisa@pikron.com>
5037L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
5038S: Maintained
5039F: drivers/mmc/host/imxmmc.*
5040
5041MOXA SMARTIO/INDUSTIO/INTELLIO SERIAL CARD 5073MOXA SMARTIO/INDUSTIO/INTELLIO SERIAL CARD
5042M: Jiri Slaby <jirislaby@gmail.com> 5074M: Jiri Slaby <jirislaby@gmail.com>
5043S: Maintained 5075S: Maintained
@@ -5052,7 +5084,7 @@ S: Maintained
5052F: drivers/media/radio/radio-mr800.c 5084F: drivers/media/radio/radio-mr800.c
5053 5085
5054MSI LAPTOP SUPPORT 5086MSI LAPTOP SUPPORT
5055M: "Lee, Chun-Yi" <jlee@novell.com> 5087M: "Lee, Chun-Yi" <jlee@suse.com>
5056L: platform-driver-x86@vger.kernel.org 5088L: platform-driver-x86@vger.kernel.org
5057S: Maintained 5089S: Maintained
5058F: drivers/platform/x86/msi-laptop.c 5090F: drivers/platform/x86/msi-laptop.c
@@ -5076,6 +5108,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc.git
5076S: Maintained 5108S: Maintained
5077F: drivers/mmc/ 5109F: drivers/mmc/
5078F: include/linux/mmc/ 5110F: include/linux/mmc/
5111F: include/uapi/linux/mmc/
5079 5112
5080MULTIMEDIA CARD (MMC) ETC. OVER SPI 5113MULTIMEDIA CARD (MMC) ETC. OVER SPI
5081S: Orphan 5114S: Orphan
@@ -5147,7 +5180,7 @@ S: Supported
5147F: drivers/infiniband/hw/nes/ 5180F: drivers/infiniband/hw/nes/
5148 5181
5149NETEM NETWORK EMULATOR 5182NETEM NETWORK EMULATOR
5150M: Stephen Hemminger <shemminger@vyatta.com> 5183M: Stephen Hemminger <stephen@networkplumber.org>
5151L: netem@lists.linux-foundation.org 5184L: netem@lists.linux-foundation.org
5152S: Maintained 5185S: Maintained
5153F: net/sched/sch_netem.c 5186F: net/sched/sch_netem.c
@@ -5176,6 +5209,8 @@ S: Supported
5176F: include/linux/netfilter* 5209F: include/linux/netfilter*
5177F: include/linux/netfilter/ 5210F: include/linux/netfilter/
5178F: include/net/netfilter/ 5211F: include/net/netfilter/
5212F: include/uapi/linux/netfilter*
5213F: include/uapi/linux/netfilter/
5179F: net/*/netfilter.c 5214F: net/*/netfilter.c
5180F: net/*/netfilter/ 5215F: net/*/netfilter/
5181F: net/netfilter/ 5216F: net/netfilter/
@@ -5194,8 +5229,8 @@ M: Ralf Baechle <ralf@linux-mips.org>
5194L: linux-hams@vger.kernel.org 5229L: linux-hams@vger.kernel.org
5195W: http://www.linux-ax25.org/ 5230W: http://www.linux-ax25.org/
5196S: Maintained 5231S: Maintained
5197F: include/linux/netrom.h
5198F: include/net/netrom.h 5232F: include/net/netrom.h
5233F: include/uapi/linux/netrom.h
5199F: net/netrom/ 5234F: net/netrom/
5200 5235
5201NETWORK BLOCK DEVICE (NBD) 5236NETWORK BLOCK DEVICE (NBD)
@@ -5204,6 +5239,7 @@ S: Maintained
5204F: Documentation/blockdev/nbd.txt 5239F: Documentation/blockdev/nbd.txt
5205F: drivers/block/nbd.c 5240F: drivers/block/nbd.c
5206F: include/linux/nbd.h 5241F: include/linux/nbd.h
5242F: include/uapi/linux/nbd.h
5207 5243
5208NETWORK DROP MONITOR 5244NETWORK DROP MONITOR
5209M: Neil Horman <nhorman@tuxdriver.com> 5245M: Neil Horman <nhorman@tuxdriver.com>
@@ -5225,6 +5261,9 @@ F: include/net/
5225F: include/linux/in.h 5261F: include/linux/in.h
5226F: include/linux/net.h 5262F: include/linux/net.h
5227F: include/linux/netdevice.h 5263F: include/linux/netdevice.h
5264F: include/uapi/linux/in.h
5265F: include/uapi/linux/net.h
5266F: include/uapi/linux/netdevice.h
5228 5267
5229NETWORKING [IPv4/IPv6] 5268NETWORKING [IPv4/IPv6]
5230M: "David S. Miller" <davem@davemloft.net> 5269M: "David S. Miller" <davem@davemloft.net>
@@ -5270,6 +5309,7 @@ F: net/rfkill/
5270F: net/wireless/ 5309F: net/wireless/
5271F: include/net/ieee80211* 5310F: include/net/ieee80211*
5272F: include/linux/wireless.h 5311F: include/linux/wireless.h
5312F: include/uapi/linux/wireless.h
5273F: include/net/iw_handler.h 5313F: include/net/iw_handler.h
5274F: drivers/net/wireless/ 5314F: drivers/net/wireless/
5275 5315
@@ -5289,6 +5329,8 @@ F: include/linux/fcdevice.h
5289F: include/linux/fddidevice.h 5329F: include/linux/fddidevice.h
5290F: include/linux/hippidevice.h 5330F: include/linux/hippidevice.h
5291F: include/linux/inetdevice.h 5331F: include/linux/inetdevice.h
5332F: include/uapi/linux/if_*
5333F: include/uapi/linux/netdevice.h
5292 5334
5293NETXEN (1/10) GbE SUPPORT 5335NETXEN (1/10) GbE SUPPORT
5294M: Sony Chacko <sony.chacko@qlogic.com> 5336M: Sony Chacko <sony.chacko@qlogic.com>
@@ -5306,8 +5348,8 @@ L: linux-wireless@vger.kernel.org
5306L: linux-nfc@lists.01.org (moderated for non-subscribers) 5348L: linux-nfc@lists.01.org (moderated for non-subscribers)
5307S: Maintained 5349S: Maintained
5308F: net/nfc/ 5350F: net/nfc/
5309F: include/linux/nfc.h
5310F: include/net/nfc/ 5351F: include/net/nfc/
5352F: include/uapi/linux/nfc.h
5311F: drivers/nfc/ 5353F: drivers/nfc/
5312F: include/linux/platform_data/pn544.h 5354F: include/linux/platform_data/pn544.h
5313 5355
@@ -5324,6 +5366,8 @@ F: net/sunrpc/
5324F: include/linux/lockd/ 5366F: include/linux/lockd/
5325F: include/linux/nfs* 5367F: include/linux/nfs*
5326F: include/linux/sunrpc/ 5368F: include/linux/sunrpc/
5369F: include/uapi/linux/nfs*
5370F: include/uapi/linux/sunrpc/
5327 5371
5328NI5010 NETWORK DRIVER 5372NI5010 NETWORK DRIVER
5329M: Jan-Pascal van Best <janpascal@vanbest.org> 5373M: Jan-Pascal van Best <janpascal@vanbest.org>
@@ -5385,6 +5429,15 @@ F: arch/arm/*omap*/
5385F: drivers/i2c/busses/i2c-omap.c 5429F: drivers/i2c/busses/i2c-omap.c
5386F: include/linux/i2c-omap.h 5430F: include/linux/i2c-omap.h
5387 5431
5432OMAP DEVICE TREE SUPPORT
5433M: Benoît Cousson <b-cousson@ti.com>
5434M: Tony Lindgren <tony@atomide.com>
5435L: linux-omap@vger.kernel.org
5436L: devicetree-discuss@lists.ozlabs.org (moderated for non-subscribers)
5437S: Maintained
5438F: arch/arm/boot/dts/*omap*
5439F: arch/arm/boot/dts/*am3*
5440
5388OMAP CLOCK FRAMEWORK SUPPORT 5441OMAP CLOCK FRAMEWORK SUPPORT
5389M: Paul Walmsley <paul@pwsan.com> 5442M: Paul Walmsley <paul@pwsan.com>
5390L: linux-omap@vger.kernel.org 5443L: linux-omap@vger.kernel.org
@@ -5461,8 +5514,7 @@ M: Benoît Cousson <b-cousson@ti.com>
5461M: Paul Walmsley <paul@pwsan.com> 5514M: Paul Walmsley <paul@pwsan.com>
5462L: linux-omap@vger.kernel.org 5515L: linux-omap@vger.kernel.org
5463S: Maintained 5516S: Maintained
5464F: arch/arm/mach-omap2/omap_hwmod.c 5517F: arch/arm/mach-omap2/omap_hwmod.*
5465F: arch/arm/plat-omap/include/plat/omap_hwmod.h
5466 5518
5467OMAP HWMOD DATA FOR OMAP4-BASED DEVICES 5519OMAP HWMOD DATA FOR OMAP4-BASED DEVICES
5468M: Benoît Cousson <b-cousson@ti.com> 5520M: Benoît Cousson <b-cousson@ti.com>
@@ -5504,6 +5556,7 @@ M: Harald Welte <laforge@gnumonks.org>
5504S: Maintained 5556S: Maintained
5505F: drivers/char/pcmcia/cm4000_cs.c 5557F: drivers/char/pcmcia/cm4000_cs.c
5506F: include/linux/cm4000_cs.h 5558F: include/linux/cm4000_cs.h
5559F: include/uapi/linux/cm4000_cs.h
5507 5560
5508OMNIKEY CARDMAN 4040 DRIVER 5561OMNIKEY CARDMAN 4040 DRIVER
5509M: Harald Welte <laforge@gnumonks.org> 5562M: Harald Welte <laforge@gnumonks.org>
@@ -5662,7 +5715,7 @@ S: Orphan
5662F: drivers/parport/ 5715F: drivers/parport/
5663F: include/linux/parport*.h 5716F: include/linux/parport*.h
5664F: drivers/char/ppdev.c 5717F: drivers/char/ppdev.c
5665F: include/linux/ppdev.h 5718F: include/uapi/linux/ppdev.h
5666 5719
5667PARAVIRT_OPS INTERFACE 5720PARAVIRT_OPS INTERFACE
5668M: Jeremy Fitzhardinge <jeremy@goop.org> 5721M: Jeremy Fitzhardinge <jeremy@goop.org>
@@ -5803,11 +5856,11 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core
5803S: Supported 5856S: Supported
5804F: kernel/events/* 5857F: kernel/events/*
5805F: include/linux/perf_event.h 5858F: include/linux/perf_event.h
5859F: include/uapi/linux/perf_event.h
5806F: arch/*/kernel/perf_event*.c 5860F: arch/*/kernel/perf_event*.c
5807F: arch/*/kernel/*/perf_event*.c 5861F: arch/*/kernel/*/perf_event*.c
5808F: arch/*/kernel/*/*/perf_event*.c 5862F: arch/*/kernel/*/*/perf_event*.c
5809F: arch/*/include/asm/perf_event.h 5863F: arch/*/include/asm/perf_event.h
5810F: arch/*/lib/perf_event*.c
5811F: arch/*/kernel/perf_callchain.c 5864F: arch/*/kernel/perf_callchain.c
5812F: tools/perf/ 5865F: tools/perf/
5813 5866
@@ -5816,6 +5869,7 @@ M: Christoph Hellwig <hch@infradead.org>
5816L: linux-abi-devel@lists.sourceforge.net 5869L: linux-abi-devel@lists.sourceforge.net
5817S: Maintained 5870S: Maintained
5818F: include/linux/personality.h 5871F: include/linux/personality.h
5872F: include/uapi/linux/personality.h
5819 5873
5820PHONET PROTOCOL 5874PHONET PROTOCOL
5821M: Remi Denis-Courmont <courmisch@gmail.com> 5875M: Remi Denis-Courmont <courmisch@gmail.com>
@@ -5823,6 +5877,7 @@ S: Supported
5823F: Documentation/networking/phonet.txt 5877F: Documentation/networking/phonet.txt
5824F: include/linux/phonet.h 5878F: include/linux/phonet.h
5825F: include/net/phonet/ 5879F: include/net/phonet/
5880F: include/uapi/linux/phonet.h
5826F: net/phonet/ 5881F: net/phonet/
5827 5882
5828PHRAM MTD DRIVER 5883PHRAM MTD DRIVER
@@ -5871,6 +5926,7 @@ M: Jiri Kosina <jkosina@suse.cz>
5871S: Maintained 5926S: Maintained
5872F: drivers/block/pktcdvd.c 5927F: drivers/block/pktcdvd.c
5873F: include/linux/pktcdvd.h 5928F: include/linux/pktcdvd.h
5929F: include/uapi/linux/pktcdvd.h
5874 5930
5875PKUNITY SOC DRIVERS 5931PKUNITY SOC DRIVERS
5876M: Guan Xuetao <gxt@mprc.pku.edu.cn> 5932M: Guan Xuetao <gxt@mprc.pku.edu.cn>
@@ -5945,7 +6001,7 @@ PPP OVER ATM (RFC 2364)
5945M: Mitchell Blank Jr <mitch@sfgoth.com> 6001M: Mitchell Blank Jr <mitch@sfgoth.com>
5946S: Maintained 6002S: Maintained
5947F: net/atm/pppoatm.c 6003F: net/atm/pppoatm.c
5948F: include/linux/atmppp.h 6004F: include/uapi/linux/atmppp.h
5949 6005
5950PPP OVER ETHERNET 6006PPP OVER ETHERNET
5951M: Michal Ostrowski <mostrows@earthlink.net> 6007M: Michal Ostrowski <mostrows@earthlink.net>
@@ -5958,6 +6014,7 @@ M: James Chapman <jchapman@katalix.com>
5958S: Maintained 6014S: Maintained
5959F: net/l2tp/l2tp_ppp.c 6015F: net/l2tp/l2tp_ppp.c
5960F: include/linux/if_pppol2tp.h 6016F: include/linux/if_pppol2tp.h
6017F: include/uapi/linux/if_pppol2tp.h
5961 6018
5962PPS SUPPORT 6019PPS SUPPORT
5963M: Rodolfo Giometti <giometti@enneenne.com> 6020M: Rodolfo Giometti <giometti@enneenne.com>
@@ -6055,6 +6112,7 @@ F: include/asm-generic/syscall.h
6055F: include/linux/ptrace.h 6112F: include/linux/ptrace.h
6056F: include/linux/regset.h 6113F: include/linux/regset.h
6057F: include/linux/tracehook.h 6114F: include/linux/tracehook.h
6115F: include/uapi/linux/ptrace.h
6058F: kernel/ptrace.c 6116F: kernel/ptrace.c
6059 6117
6060PVRUSB2 VIDEO4LINUX DRIVER 6118PVRUSB2 VIDEO4LINUX DRIVER
@@ -6083,7 +6141,6 @@ T: git git://gitorious.org/linux-pwm/linux-pwm.git
6083F: Documentation/pwm.txt 6141F: Documentation/pwm.txt
6084F: Documentation/devicetree/bindings/pwm/ 6142F: Documentation/devicetree/bindings/pwm/
6085F: include/linux/pwm.h 6143F: include/linux/pwm.h
6086F: include/linux/of_pwm.h
6087F: drivers/pwm/ 6144F: drivers/pwm/
6088F: drivers/video/backlight/pwm_bl.c 6145F: drivers/video/backlight/pwm_bl.c
6089F: include/linux/pwm_backlight.h 6146F: include/linux/pwm_backlight.h
@@ -6179,8 +6236,8 @@ M: Anders Larsen <al@alarsen.net>
6179W: http://www.alarsen.net/linux/qnx4fs/ 6236W: http://www.alarsen.net/linux/qnx4fs/
6180S: Maintained 6237S: Maintained
6181F: fs/qnx4/ 6238F: fs/qnx4/
6182F: include/linux/qnx4_fs.h 6239F: include/uapi/linux/qnx4_fs.h
6183F: include/linux/qnxtypes.h 6240F: include/uapi/linux/qnxtypes.h
6184 6241
6185QT1010 MEDIA DRIVER 6242QT1010 MEDIA DRIVER
6186M: Antti Palosaari <crope@iki.fi> 6243M: Antti Palosaari <crope@iki.fi>
@@ -6214,7 +6271,7 @@ M: Benjamin Herrenschmidt <benh@kernel.crashing.org>
6214L: linux-fbdev@vger.kernel.org 6271L: linux-fbdev@vger.kernel.org
6215S: Maintained 6272S: Maintained
6216F: drivers/video/aty/radeon* 6273F: drivers/video/aty/radeon*
6217F: include/linux/radeonfb.h 6274F: include/uapi/linux/radeonfb.h
6218 6275
6219RADIOSHARK RADIO DRIVER 6276RADIOSHARK RADIO DRIVER
6220M: Hans de Goede <hdegoede@redhat.com> 6277M: Hans de Goede <hdegoede@redhat.com>
@@ -6315,6 +6372,7 @@ S: Maintained
6315F: Documentation/rtc.txt 6372F: Documentation/rtc.txt
6316F: drivers/rtc/ 6373F: drivers/rtc/
6317F: include/linux/rtc.h 6374F: include/linux/rtc.h
6375F: include/uapi/linux/rtc.h
6318 6376
6319REISERFS FILE SYSTEM 6377REISERFS FILE SYSTEM
6320L: reiserfs-devel@vger.kernel.org 6378L: reiserfs-devel@vger.kernel.org
@@ -6369,8 +6427,8 @@ M: Ralf Baechle <ralf@linux-mips.org>
6369L: linux-hams@vger.kernel.org 6427L: linux-hams@vger.kernel.org
6370W: http://www.linux-ax25.org/ 6428W: http://www.linux-ax25.org/
6371S: Maintained 6429S: Maintained
6372F: include/linux/rose.h
6373F: include/net/rose.h 6430F: include/net/rose.h
6431F: include/uapi/linux/rose.h
6374F: net/rose/ 6432F: net/rose/
6375 6433
6376RTL2830 MEDIA DRIVER 6434RTL2830 MEDIA DRIVER
@@ -6527,7 +6585,7 @@ F: drivers/media/platform/s3c-camif/
6527F: include/media/s3c_camif.h 6585F: include/media/s3c_camif.h
6528 6586
6529SERIAL DRIVERS 6587SERIAL DRIVERS
6530M: Alan Cox <alan@linux.intel.com> 6588M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6531L: linux-serial@vger.kernel.org 6589L: linux-serial@vger.kernel.org
6532S: Maintained 6590S: Maintained
6533F: drivers/tty/serial 6591F: drivers/tty/serial
@@ -6547,6 +6605,8 @@ S: Supported
6547F: include/linux/clocksource.h 6605F: include/linux/clocksource.h
6548F: include/linux/time.h 6606F: include/linux/time.h
6549F: include/linux/timex.h 6607F: include/linux/timex.h
6608F: include/uapi/linux/time.h
6609F: include/uapi/linux/timex.h
6550F: kernel/time/clocksource.c 6610F: kernel/time/clocksource.c
6551F: kernel/time/time*.c 6611F: kernel/time/time*.c
6552F: kernel/time/ntp.c 6612F: kernel/time/ntp.c
@@ -6571,6 +6631,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core
6571S: Maintained 6631S: Maintained
6572F: kernel/sched/ 6632F: kernel/sched/
6573F: include/linux/sched.h 6633F: include/linux/sched.h
6634F: include/uapi/linux/sched.h
6574 6635
6575SCORE ARCHITECTURE 6636SCORE ARCHITECTURE
6576M: Chen Liqin <liqin.chen@sunplusct.com> 6637M: Chen Liqin <liqin.chen@sunplusct.com>
@@ -6724,7 +6785,7 @@ SENSABLE PHANTOM
6724M: Jiri Slaby <jirislaby@gmail.com> 6785M: Jiri Slaby <jirislaby@gmail.com>
6725S: Maintained 6786S: Maintained
6726F: drivers/misc/phantom.c 6787F: drivers/misc/phantom.c
6727F: include/linux/phantom.h 6788F: include/uapi/linux/phantom.h
6728 6789
6729SERIAL ATA (SATA) SUBSYSTEM 6790SERIAL ATA (SATA) SUBSYSTEM
6730M: Jeff Garzik <jgarzik@pobox.com> 6791M: Jeff Garzik <jgarzik@pobox.com>
@@ -6982,6 +7043,7 @@ L: linux-raid@vger.kernel.org
6982S: Supported 7043S: Supported
6983F: drivers/md/ 7044F: drivers/md/
6984F: include/linux/raid/ 7045F: include/linux/raid/
7046F: include/uapi/linux/raid/
6985 7047
6986SONIC NETWORK DRIVER 7048SONIC NETWORK DRIVER
6987M: Thomas Bogendoerfer <tsbogend@alpha.franken.de> 7049M: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
@@ -7022,10 +7084,11 @@ T: git git://git.alsa-project.org/alsa-kernel.git
7022S: Maintained 7084S: Maintained
7023F: Documentation/sound/ 7085F: Documentation/sound/
7024F: include/sound/ 7086F: include/sound/
7087F: include/uapi/sound/
7025F: sound/ 7088F: sound/
7026 7089
7027SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEMENT (ASoC) 7090SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEMENT (ASoC)
7028M: Liam Girdwood <lrg@ti.com> 7091M: Liam Girdwood <lgirdwood@gmail.com>
7029M: Mark Brown <broonie@opensource.wolfsonmicro.com> 7092M: Mark Brown <broonie@opensource.wolfsonmicro.com>
7030T: git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 7093T: git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
7031L: alsa-devel@alsa-project.org (moderated for non-subscribers) 7094L: alsa-devel@alsa-project.org (moderated for non-subscribers)
@@ -7122,6 +7185,7 @@ S: Maintained
7122F: Documentation/spi/ 7185F: Documentation/spi/
7123F: drivers/spi/ 7186F: drivers/spi/
7124F: include/linux/spi/ 7187F: include/linux/spi/
7188F: include/uapi/linux/spi/
7125 7189
7126SPIDERNET NETWORK DRIVER for CELL 7190SPIDERNET NETWORK DRIVER for CELL
7127M: Ishizaki Kou <kou.ishizaki@toshiba.co.jp> 7191M: Ishizaki Kou <kou.ishizaki@toshiba.co.jp>
@@ -7258,7 +7322,7 @@ F: drivers/staging/rtl8712/
7258STAGING - SILICON MOTION SM7XX FRAME BUFFER DRIVER 7322STAGING - SILICON MOTION SM7XX FRAME BUFFER DRIVER
7259M: Teddy Wang <teddy.wang@siliconmotion.com.cn> 7323M: Teddy Wang <teddy.wang@siliconmotion.com.cn>
7260S: Odd Fixes 7324S: Odd Fixes
7261F: drivers/staging/sm7xx/ 7325F: drivers/staging/sm7xxfb/
7262 7326
7263STAGING - SOFTLOGIC 6x10 MPEG CODEC 7327STAGING - SOFTLOGIC 6x10 MPEG CODEC
7264M: Ben Collins <bcollins@bluecherry.net> 7328M: Ben Collins <bcollins@bluecherry.net>
@@ -7276,7 +7340,7 @@ S: Odd Fixes
7276F: drivers/staging/speakup/ 7340F: drivers/staging/speakup/
7277 7341
7278STAGING - TI DSP BRIDGE DRIVERS 7342STAGING - TI DSP BRIDGE DRIVERS
7279M: Omar Ramirez Luna <omar.ramirez@ti.com> 7343M: Omar Ramirez Luna <omar.ramirez@copitl.com>
7280S: Odd Fixes 7344S: Odd Fixes
7281F: drivers/staging/tidspbridge/ 7345F: drivers/staging/tidspbridge/
7282 7346
@@ -7384,8 +7448,8 @@ TC CLASSIFIER
7384M: Jamal Hadi Salim <jhs@mojatatu.com> 7448M: Jamal Hadi Salim <jhs@mojatatu.com>
7385L: netdev@vger.kernel.org 7449L: netdev@vger.kernel.org
7386S: Maintained 7450S: Maintained
7387F: include/linux/pkt_cls.h
7388F: include/net/pkt_cls.h 7451F: include/net/pkt_cls.h
7452F: include/uapi/linux/pkt_cls.h
7389F: net/sched/ 7453F: net/sched/
7390 7454
7391TCP LOW PRIORITY MODULE 7455TCP LOW PRIORITY MODULE
@@ -7477,6 +7541,7 @@ L: netdev@vger.kernel.org
7477S: Supported 7541S: Supported
7478F: drivers/net/team/ 7542F: drivers/net/team/
7479F: include/linux/if_team.h 7543F: include/linux/if_team.h
7544F: include/uapi/linux/if_team.h
7480 7545
7481TECHNOTREND USB IR RECEIVER 7546TECHNOTREND USB IR RECEIVER
7482M: Sean Young <sean@mess.org> 7547M: Sean Young <sean@mess.org>
@@ -7575,7 +7640,7 @@ L: netdev@vger.kernel.org (core kernel code)
7575L: tipc-discussion@lists.sourceforge.net (user apps, general discussion) 7640L: tipc-discussion@lists.sourceforge.net (user apps, general discussion)
7576W: http://tipc.sourceforge.net/ 7641W: http://tipc.sourceforge.net/
7577S: Maintained 7642S: Maintained
7578F: include/linux/tipc*.h 7643F: include/uapi/linux/tipc*.h
7579F: net/tipc/ 7644F: net/tipc/
7580 7645
7581TILE ARCHITECTURE 7646TILE ARCHITECTURE
@@ -7625,6 +7690,7 @@ W: http://www.buzzard.org.uk/toshiba/
7625S: Maintained 7690S: Maintained
7626F: drivers/char/toshiba.c 7691F: drivers/char/toshiba.c
7627F: include/linux/toshiba.h 7692F: include/linux/toshiba.h
7693F: include/uapi/linux/toshiba.h
7628 7694
7629TMIO MMC DRIVER 7695TMIO MMC DRIVER
7630M: Guennadi Liakhovetski <g.liakhovetski@gmx.de> 7696M: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
@@ -7692,6 +7758,9 @@ F: drivers/tty/serial/serial_core.c
7692F: include/linux/serial_core.h 7758F: include/linux/serial_core.h
7693F: include/linux/serial.h 7759F: include/linux/serial.h
7694F: include/linux/tty.h 7760F: include/linux/tty.h
7761F: include/uapi/linux/serial_core.h
7762F: include/uapi/linux/serial.h
7763F: include/uapi/linux/tty.h
7695 7764
7696TUA9001 MEDIA DRIVER 7765TUA9001 MEDIA DRIVER
7697M: Antti Palosaari <crope@iki.fi> 7766M: Antti Palosaari <crope@iki.fi>
@@ -7771,7 +7840,7 @@ M: David Herrmann <dh.herrmann@googlemail.com>
7771L: linux-input@vger.kernel.org 7840L: linux-input@vger.kernel.org
7772S: Maintained 7841S: Maintained
7773F: drivers/hid/uhid.c 7842F: drivers/hid/uhid.c
7774F: include/linux/uhid.h 7843F: include/uapi/linux/uhid.h
7775 7844
7776ULTRA-WIDEBAND (UWB) SUBSYSTEM: 7845ULTRA-WIDEBAND (UWB) SUBSYSTEM:
7777L: linux-usb@vger.kernel.org 7846L: linux-usb@vger.kernel.org
@@ -7800,6 +7869,7 @@ S: Maintained
7800F: Documentation/cdrom/ 7869F: Documentation/cdrom/
7801F: drivers/cdrom/cdrom.c 7870F: drivers/cdrom/cdrom.c
7802F: include/linux/cdrom.h 7871F: include/linux/cdrom.h
7872F: include/uapi/linux/cdrom.h
7803 7873
7804UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER 7874UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER
7805M: Vinayak Holikatti <vinholikatti@gmail.com> 7875M: Vinayak Holikatti <vinholikatti@gmail.com>
@@ -7817,7 +7887,7 @@ T: git git://git.infradead.org/ubi-2.6.git
7817S: Maintained 7887S: Maintained
7818F: drivers/mtd/ubi/ 7888F: drivers/mtd/ubi/
7819F: include/linux/mtd/ubi.h 7889F: include/linux/mtd/ubi.h
7820F: include/mtd/ubi-user.h 7890F: include/uapi/mtd/ubi-user.h
7821 7891
7822UNSORTED BLOCK IMAGES (UBI) Fastmap 7892UNSORTED BLOCK IMAGES (UBI) Fastmap
7823M: Richard Weinberger <richard@nod.at> 7893M: Richard Weinberger <richard@nod.at>
@@ -7851,7 +7921,7 @@ M: Oliver Neukum <oliver@neukum.org>
7851L: linux-usb@vger.kernel.org 7921L: linux-usb@vger.kernel.org
7852S: Maintained 7922S: Maintained
7853F: drivers/net/usb/cdc_*.c 7923F: drivers/net/usb/cdc_*.c
7854F: include/linux/usb/cdc.h 7924F: include/uapi/linux/usb/cdc.h
7855 7925
7856USB CYPRESS C67X00 DRIVER 7926USB CYPRESS C67X00 DRIVER
7857M: Peter Korsgaard <jacmet@sunsite.dk> 7927M: Peter Korsgaard <jacmet@sunsite.dk>
@@ -8172,6 +8242,7 @@ S: Maintained
8172F: Documentation/vfio.txt 8242F: Documentation/vfio.txt
8173F: drivers/vfio/ 8243F: drivers/vfio/
8174F: include/linux/vfio.h 8244F: include/linux/vfio.h
8245F: include/uapi/linux/vfio.h
8175 8246
8176VIDEOBUF2 FRAMEWORK 8247VIDEOBUF2 FRAMEWORK
8177M: Pawel Osciak <pawel@osciak.com> 8248M: Pawel Osciak <pawel@osciak.com>
@@ -8188,6 +8259,7 @@ L: virtualization@lists.linux-foundation.org
8188S: Maintained 8259S: Maintained
8189F: drivers/char/virtio_console.c 8260F: drivers/char/virtio_console.c
8190F: include/linux/virtio_console.h 8261F: include/linux/virtio_console.h
8262F: include/uapi/linux/virtio_console.h
8191 8263
8192VIRTIO CORE, NET AND BLOCK DRIVERS 8264VIRTIO CORE, NET AND BLOCK DRIVERS
8193M: Rusty Russell <rusty@rustcorp.com.au> 8265M: Rusty Russell <rusty@rustcorp.com.au>
@@ -8206,7 +8278,7 @@ L: virtualization@lists.linux-foundation.org
8206L: netdev@vger.kernel.org 8278L: netdev@vger.kernel.org
8207S: Maintained 8279S: Maintained
8208F: drivers/vhost/ 8280F: drivers/vhost/
8209F: include/linux/vhost.h 8281F: include/uapi/linux/vhost.h
8210 8282
8211VIA RHINE NETWORK DRIVER 8283VIA RHINE NETWORK DRIVER
8212M: Roger Luethi <rl@hellgate.ch> 8284M: Roger Luethi <rl@hellgate.ch>
@@ -8346,6 +8418,7 @@ S: Maintained
8346F: Documentation/watchdog/ 8418F: Documentation/watchdog/
8347F: drivers/watchdog/ 8419F: drivers/watchdog/
8348F: include/linux/watchdog.h 8420F: include/linux/watchdog.h
8421F: include/uapi/linux/watchdog.h
8349 8422
8350WD7000 SCSI DRIVER 8423WD7000 SCSI DRIVER
8351M: Miroslav Zagorac <zaga@fly.cc.fer.hr> 8424M: Miroslav Zagorac <zaga@fly.cc.fer.hr>
@@ -8371,9 +8444,9 @@ L: wimax@linuxwimax.org
8371S: Supported 8444S: Supported
8372W: http://linuxwimax.org 8445W: http://linuxwimax.org
8373F: Documentation/wimax/README.wimax 8446F: Documentation/wimax/README.wimax
8374F: include/linux/wimax.h
8375F: include/linux/wimax/debug.h 8447F: include/linux/wimax/debug.h
8376F: include/net/wimax.h 8448F: include/net/wimax.h
8449F: include/uapi/linux/wimax.h
8377F: net/wimax/ 8450F: net/wimax/
8378 8451
8379WISTRON LAPTOP BUTTON DRIVER 8452WISTRON LAPTOP BUTTON DRIVER
@@ -8459,7 +8532,7 @@ F: Documentation/x86/
8459F: arch/x86/ 8532F: arch/x86/
8460 8533
8461X86 PLATFORM DRIVERS 8534X86 PLATFORM DRIVERS
8462M: Matthew Garrett <mjg@redhat.com> 8535M: Matthew Garrett <matthew.garrett@nebula.com>
8463L: platform-driver-x86@vger.kernel.org 8536L: platform-driver-x86@vger.kernel.org
8464T: git git://git.kernel.org/pub/scm/linux/kernel/git/mjg59/platform-drivers-x86.git 8537T: git git://git.kernel.org/pub/scm/linux/kernel/git/mjg59/platform-drivers-x86.git
8465S: Maintained 8538S: Maintained
@@ -8491,6 +8564,7 @@ F: drivers/*/xen-*front.c
8491F: drivers/xen/ 8564F: drivers/xen/
8492F: arch/x86/include/asm/xen/ 8565F: arch/x86/include/asm/xen/
8493F: include/xen/ 8566F: include/xen/
8567F: include/uapi/xen/
8494 8568
8495XEN HYPERVISOR ARM 8569XEN HYPERVISOR ARM
8496M: Stefano Stabellini <stefano.stabellini@eu.citrix.com> 8570M: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
diff --git a/Makefile b/Makefile
index 275b9567382c..54dfde5e9f9e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
1VERSION = 3 1VERSION = 3
2PATCHLEVEL = 8 2PATCHLEVEL = 8
3SUBLEVEL = 0 3SUBLEVEL = 0
4EXTRAVERSION = -rc1 4EXTRAVERSION = -rc6
5NAME = Terrified Chipmunk 5NAME = Unicycling Gorilla
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
8# To see a list of typical targets execute "make help" 8# To see a list of typical targets execute "make help"
@@ -169,7 +169,7 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
169 -e s/arm.*/arm/ -e s/sa110/arm/ \ 169 -e s/arm.*/arm/ -e s/sa110/arm/ \
170 -e s/s390x/s390/ -e s/parisc64/parisc/ \ 170 -e s/s390x/s390/ -e s/parisc64/parisc/ \
171 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ 171 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
172 -e s/sh[234].*/sh/ ) 172 -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ )
173 173
174# Cross compiling and selecting different set of gcc/bin-utils 174# Cross compiling and selecting different set of gcc/bin-utils
175# --------------------------------------------------------------------------- 175# ---------------------------------------------------------------------------
diff --git a/arch/alpha/include/asm/parport.h b/arch/alpha/include/asm/parport.h
index c5ee7cbb2fcd..6abd0af11f13 100644
--- a/arch/alpha/include/asm/parport.h
+++ b/arch/alpha/include/asm/parport.h
@@ -9,8 +9,8 @@
9#ifndef _ASM_AXP_PARPORT_H 9#ifndef _ASM_AXP_PARPORT_H
10#define _ASM_AXP_PARPORT_H 1 10#define _ASM_AXP_PARPORT_H 1
11 11
12static int __devinit parport_pc_find_isa_ports (int autoirq, int autodma); 12static int parport_pc_find_isa_ports (int autoirq, int autodma);
13static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma) 13static int parport_pc_find_nonpci_ports (int autoirq, int autodma)
14{ 14{
15 return parport_pc_find_isa_ports (autoirq, autodma); 15 return parport_pc_find_isa_ports (autoirq, autodma);
16} 16}
diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index ef757147cbf9..edb4e0097b75 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -59,13 +59,13 @@ struct pci_controller *pci_isa_hose;
59 * Quirks. 59 * Quirks.
60 */ 60 */
61 61
62static void __devinit quirk_isa_bridge(struct pci_dev *dev) 62static void quirk_isa_bridge(struct pci_dev *dev)
63{ 63{
64 dev->class = PCI_CLASS_BRIDGE_ISA << 8; 64 dev->class = PCI_CLASS_BRIDGE_ISA << 8;
65} 65}
66DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82378, quirk_isa_bridge); 66DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82378, quirk_isa_bridge);
67 67
68static void __devinit quirk_cypress(struct pci_dev *dev) 68static void quirk_cypress(struct pci_dev *dev)
69{ 69{
70 /* The Notorious Cy82C693 chip. */ 70 /* The Notorious Cy82C693 chip. */
71 71
@@ -104,7 +104,7 @@ static void __devinit quirk_cypress(struct pci_dev *dev)
104DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_CONTAQ, PCI_DEVICE_ID_CONTAQ_82C693, quirk_cypress); 104DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_CONTAQ, PCI_DEVICE_ID_CONTAQ_82C693, quirk_cypress);
105 105
106/* Called for each device after PCI setup is done. */ 106/* Called for each device after PCI setup is done. */
107static void __devinit pcibios_fixup_final(struct pci_dev *dev) 107static void pcibios_fixup_final(struct pci_dev *dev)
108{ 108{
109 unsigned int class = dev->class >> 8; 109 unsigned int class = dev->class >> 8;
110 110
@@ -198,8 +198,7 @@ subsys_initcall(pcibios_init);
198#ifdef ALPHA_RESTORE_SRM_SETUP 198#ifdef ALPHA_RESTORE_SRM_SETUP
199static struct pdev_srm_saved_conf *srm_saved_configs; 199static struct pdev_srm_saved_conf *srm_saved_configs;
200 200
201void __devinit 201void pdev_save_srm_config(struct pci_dev *dev)
202pdev_save_srm_config(struct pci_dev *dev)
203{ 202{
204 struct pdev_srm_saved_conf *tmp; 203 struct pdev_srm_saved_conf *tmp;
205 static int printed = 0; 204 static int printed = 0;
@@ -241,8 +240,7 @@ pci_restore_srm_config(void)
241} 240}
242#endif 241#endif
243 242
244void __devinit 243void pcibios_fixup_bus(struct pci_bus *bus)
245pcibios_fixup_bus(struct pci_bus *bus)
246{ 244{
247 struct pci_dev *dev = bus->self; 245 struct pci_dev *dev = bus->self;
248 246
diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c
index a41ad90a97a6..9603bc234b47 100644
--- a/arch/alpha/kernel/smp.c
+++ b/arch/alpha/kernel/smp.c
@@ -68,7 +68,7 @@ enum ipi_message_type {
68}; 68};
69 69
70/* Set to a secondary's cpuid when it comes online. */ 70/* Set to a secondary's cpuid when it comes online. */
71static int smp_secondary_alive __devinitdata = 0; 71static int smp_secondary_alive = 0;
72 72
73int smp_num_probed; /* Internal processor count */ 73int smp_num_probed; /* Internal processor count */
74int smp_num_cpus = 1; /* Number that came online. */ 74int smp_num_cpus = 1; /* Number that came online. */
@@ -172,7 +172,7 @@ smp_callin(void)
172} 172}
173 173
174/* Wait until hwrpb->txrdy is clear for cpu. Return -1 on timeout. */ 174/* Wait until hwrpb->txrdy is clear for cpu. Return -1 on timeout. */
175static int __devinit 175static int
176wait_for_txrdy (unsigned long cpumask) 176wait_for_txrdy (unsigned long cpumask)
177{ 177{
178 unsigned long timeout; 178 unsigned long timeout;
@@ -468,7 +468,7 @@ smp_prepare_cpus(unsigned int max_cpus)
468 smp_num_cpus = smp_num_probed; 468 smp_num_cpus = smp_num_probed;
469} 469}
470 470
471void __devinit 471void
472smp_prepare_boot_cpu(void) 472smp_prepare_boot_cpu(void)
473{ 473{
474} 474}
diff --git a/arch/alpha/kernel/sys_titan.c b/arch/alpha/kernel/sys_titan.c
index 2533db280d9b..5cf4a481b8c5 100644
--- a/arch/alpha/kernel/sys_titan.c
+++ b/arch/alpha/kernel/sys_titan.c
@@ -303,7 +303,7 @@ titan_late_init(void)
303 303
304} 304}
305 305
306static int __devinit 306static int
307titan_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 307titan_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
308{ 308{
309 u8 intline; 309 u8 intline;
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index f95ba14ae3d0..67874b82a4ed 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -371,7 +371,6 @@ config ARCH_CNS3XXX
371config ARCH_CLPS711X 371config ARCH_CLPS711X
372 bool "Cirrus Logic CLPS711x/EP721x/EP731x-based" 372 bool "Cirrus Logic CLPS711x/EP721x/EP731x-based"
373 select ARCH_REQUIRE_GPIOLIB 373 select ARCH_REQUIRE_GPIOLIB
374 select ARCH_USES_GETTIMEOFFSET
375 select AUTO_ZRELADDR 374 select AUTO_ZRELADDR
376 select CLKDEV_LOOKUP 375 select CLKDEV_LOOKUP
377 select COMMON_CLK 376 select COMMON_CLK
@@ -1230,6 +1229,7 @@ config ARM_ERRATA_430973
1230config ARM_ERRATA_458693 1229config ARM_ERRATA_458693
1231 bool "ARM errata: Processor deadlock when a false hazard is created" 1230 bool "ARM errata: Processor deadlock when a false hazard is created"
1232 depends on CPU_V7 1231 depends on CPU_V7
1232 depends on !ARCH_MULTIPLATFORM
1233 help 1233 help
1234 This option enables the workaround for the 458693 Cortex-A8 (r2p0) 1234 This option enables the workaround for the 458693 Cortex-A8 (r2p0)
1235 erratum. For very specific sequences of memory operations, it is 1235 erratum. For very specific sequences of memory operations, it is
@@ -1243,6 +1243,7 @@ config ARM_ERRATA_458693
1243config ARM_ERRATA_460075 1243config ARM_ERRATA_460075
1244 bool "ARM errata: Data written to the L2 cache can be overwritten with stale data" 1244 bool "ARM errata: Data written to the L2 cache can be overwritten with stale data"
1245 depends on CPU_V7 1245 depends on CPU_V7
1246 depends on !ARCH_MULTIPLATFORM
1246 help 1247 help
1247 This option enables the workaround for the 460075 Cortex-A8 (r2p0) 1248 This option enables the workaround for the 460075 Cortex-A8 (r2p0)
1248 erratum. Any asynchronous access to the L2 cache may encounter a 1249 erratum. Any asynchronous access to the L2 cache may encounter a
@@ -1255,6 +1256,7 @@ config ARM_ERRATA_460075
1255config ARM_ERRATA_742230 1256config ARM_ERRATA_742230
1256 bool "ARM errata: DMB operation may be faulty" 1257 bool "ARM errata: DMB operation may be faulty"
1257 depends on CPU_V7 && SMP 1258 depends on CPU_V7 && SMP
1259 depends on !ARCH_MULTIPLATFORM
1258 help 1260 help
1259 This option enables the workaround for the 742230 Cortex-A9 1261 This option enables the workaround for the 742230 Cortex-A9
1260 (r1p0..r2p2) erratum. Under rare circumstances, a DMB instruction 1262 (r1p0..r2p2) erratum. Under rare circumstances, a DMB instruction
@@ -1267,6 +1269,7 @@ config ARM_ERRATA_742230
1267config ARM_ERRATA_742231 1269config ARM_ERRATA_742231
1268 bool "ARM errata: Incorrect hazard handling in the SCU may lead to data corruption" 1270 bool "ARM errata: Incorrect hazard handling in the SCU may lead to data corruption"
1269 depends on CPU_V7 && SMP 1271 depends on CPU_V7 && SMP
1272 depends on !ARCH_MULTIPLATFORM
1270 help 1273 help
1271 This option enables the workaround for the 742231 Cortex-A9 1274 This option enables the workaround for the 742231 Cortex-A9
1272 (r2p0..r2p2) erratum. Under certain conditions, specific to the 1275 (r2p0..r2p2) erratum. Under certain conditions, specific to the
@@ -1317,6 +1320,7 @@ config PL310_ERRATA_727915
1317config ARM_ERRATA_743622 1320config ARM_ERRATA_743622
1318 bool "ARM errata: Faulty hazard checking in the Store Buffer may lead to data corruption" 1321 bool "ARM errata: Faulty hazard checking in the Store Buffer may lead to data corruption"
1319 depends on CPU_V7 1322 depends on CPU_V7
1323 depends on !ARCH_MULTIPLATFORM
1320 help 1324 help
1321 This option enables the workaround for the 743622 Cortex-A9 1325 This option enables the workaround for the 743622 Cortex-A9
1322 (r2p*) erratum. Under very rare conditions, a faulty 1326 (r2p*) erratum. Under very rare conditions, a faulty
@@ -1330,6 +1334,7 @@ config ARM_ERRATA_743622
1330config ARM_ERRATA_751472 1334config ARM_ERRATA_751472
1331 bool "ARM errata: Interrupted ICIALLUIS may prevent completion of broadcasted operation" 1335 bool "ARM errata: Interrupted ICIALLUIS may prevent completion of broadcasted operation"
1332 depends on CPU_V7 1336 depends on CPU_V7
1337 depends on !ARCH_MULTIPLATFORM
1333 help 1338 help
1334 This option enables the workaround for the 751472 Cortex-A9 (prior 1339 This option enables the workaround for the 751472 Cortex-A9 (prior
1335 to r3p0) erratum. An interrupted ICIALLUIS operation may prevent the 1340 to r3p0) erratum. An interrupted ICIALLUIS operation may prevent the
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index e44da40d984f..5ebb44fe826a 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -155,6 +155,7 @@ dtb-$(CONFIG_ARCH_VT8500) += vt8500-bv07.dtb \
155dtb-$(CONFIG_ARCH_ZYNQ) += zynq-zc702.dtb 155dtb-$(CONFIG_ARCH_ZYNQ) += zynq-zc702.dtb
156 156
157targets += dtbs 157targets += dtbs
158targets += $(dtb-y)
158endif 159endif
159 160
160# *.dtb used to be generated in the directory above. Clean out the 161# *.dtb used to be generated in the directory above. Clean out the
diff --git a/arch/arm/boot/dts/armada-370-db.dts b/arch/arm/boot/dts/armada-370-db.dts
index 00044026ef1f..9b82facb2561 100644
--- a/arch/arm/boot/dts/armada-370-db.dts
+++ b/arch/arm/boot/dts/armada-370-db.dts
@@ -26,7 +26,7 @@
26 26
27 memory { 27 memory {
28 device_type = "memory"; 28 device_type = "memory";
29 reg = <0x00000000 0x20000000>; /* 512 MB */ 29 reg = <0x00000000 0x40000000>; /* 1 GB */
30 }; 30 };
31 31
32 soc { 32 soc {
diff --git a/arch/arm/boot/dts/armada-370-xp.dtsi b/arch/arm/boot/dts/armada-370-xp.dtsi
index cf6c48a09eac..4c0abe85405f 100644
--- a/arch/arm/boot/dts/armada-370-xp.dtsi
+++ b/arch/arm/boot/dts/armada-370-xp.dtsi
@@ -50,17 +50,19 @@
50 ranges; 50 ranges;
51 51
52 serial@d0012000 { 52 serial@d0012000 {
53 compatible = "ns16550"; 53 compatible = "snps,dw-apb-uart";
54 reg = <0xd0012000 0x100>; 54 reg = <0xd0012000 0x100>;
55 reg-shift = <2>; 55 reg-shift = <2>;
56 interrupts = <41>; 56 interrupts = <41>;
57 reg-io-width = <4>;
57 status = "disabled"; 58 status = "disabled";
58 }; 59 };
59 serial@d0012100 { 60 serial@d0012100 {
60 compatible = "ns16550"; 61 compatible = "snps,dw-apb-uart";
61 reg = <0xd0012100 0x100>; 62 reg = <0xd0012100 0x100>;
62 reg-shift = <2>; 63 reg-shift = <2>;
63 interrupts = <42>; 64 interrupts = <42>;
65 reg-io-width = <4>;
64 status = "disabled"; 66 status = "disabled";
65 }; 67 };
66 68
diff --git a/arch/arm/boot/dts/armada-xp-mv78230.dtsi b/arch/arm/boot/dts/armada-xp-mv78230.dtsi
index c45c7b4dc352..e041f42ed711 100644
--- a/arch/arm/boot/dts/armada-xp-mv78230.dtsi
+++ b/arch/arm/boot/dts/armada-xp-mv78230.dtsi
@@ -34,7 +34,14 @@
34 reg = <0>; 34 reg = <0>;
35 clocks = <&cpuclk 0>; 35 clocks = <&cpuclk 0>;
36 }; 36 };
37 } 37
38 cpu@1 {
39 device_type = "cpu";
40 compatible = "marvell,sheeva-v7";
41 reg = <1>;
42 clocks = <&cpuclk 1>;
43 };
44 };
38 45
39 soc { 46 soc {
40 pinctrl { 47 pinctrl {
@@ -43,27 +50,25 @@
43 }; 50 };
44 51
45 gpio0: gpio@d0018100 { 52 gpio0: gpio@d0018100 {
46 compatible = "marvell,armadaxp-gpio"; 53 compatible = "marvell,orion-gpio";
47 reg = <0xd0018100 0x40>, 54 reg = <0xd0018100 0x40>;
48 <0xd0018800 0x30>;
49 ngpios = <32>; 55 ngpios = <32>;
50 gpio-controller; 56 gpio-controller;
51 #gpio-cells = <2>; 57 #gpio-cells = <2>;
52 interrupt-controller; 58 interrupt-controller;
53 #interrupts-cells = <2>; 59 #interrupts-cells = <2>;
54 interrupts = <16>, <17>, <18>, <19>; 60 interrupts = <82>, <83>, <84>, <85>;
55 }; 61 };
56 62
57 gpio1: gpio@d0018140 { 63 gpio1: gpio@d0018140 {
58 compatible = "marvell,armadaxp-gpio"; 64 compatible = "marvell,orion-gpio";
59 reg = <0xd0018140 0x40>, 65 reg = <0xd0018140 0x40>;
60 <0xd0018840 0x30>;
61 ngpios = <17>; 66 ngpios = <17>;
62 gpio-controller; 67 gpio-controller;
63 #gpio-cells = <2>; 68 #gpio-cells = <2>;
64 interrupt-controller; 69 interrupt-controller;
65 #interrupts-cells = <2>; 70 #interrupts-cells = <2>;
66 interrupts = <20>, <21>, <22>; 71 interrupts = <87>, <88>, <89>;
67 }; 72 };
68 }; 73 };
69}; 74};
diff --git a/arch/arm/boot/dts/armada-xp-mv78260.dtsi b/arch/arm/boot/dts/armada-xp-mv78260.dtsi
index a2aee5707377..9e23bd8c9536 100644
--- a/arch/arm/boot/dts/armada-xp-mv78260.dtsi
+++ b/arch/arm/boot/dts/armada-xp-mv78260.dtsi
@@ -51,39 +51,44 @@
51 }; 51 };
52 52
53 gpio0: gpio@d0018100 { 53 gpio0: gpio@d0018100 {
54 compatible = "marvell,armadaxp-gpio"; 54 compatible = "marvell,orion-gpio";
55 reg = <0xd0018100 0x40>, 55 reg = <0xd0018100 0x40>;
56 <0xd0018800 0x30>;
57 ngpios = <32>; 56 ngpios = <32>;
58 gpio-controller; 57 gpio-controller;
59 #gpio-cells = <2>; 58 #gpio-cells = <2>;
60 interrupt-controller; 59 interrupt-controller;
61 #interrupts-cells = <2>; 60 #interrupts-cells = <2>;
62 interrupts = <16>, <17>, <18>, <19>; 61 interrupts = <82>, <83>, <84>, <85>;
63 }; 62 };
64 63
65 gpio1: gpio@d0018140 { 64 gpio1: gpio@d0018140 {
66 compatible = "marvell,armadaxp-gpio"; 65 compatible = "marvell,orion-gpio";
67 reg = <0xd0018140 0x40>, 66 reg = <0xd0018140 0x40>;
68 <0xd0018840 0x30>;
69 ngpios = <32>; 67 ngpios = <32>;
70 gpio-controller; 68 gpio-controller;
71 #gpio-cells = <2>; 69 #gpio-cells = <2>;
72 interrupt-controller; 70 interrupt-controller;
73 #interrupts-cells = <2>; 71 #interrupts-cells = <2>;
74 interrupts = <20>, <21>, <22>, <23>; 72 interrupts = <87>, <88>, <89>, <90>;
75 }; 73 };
76 74
77 gpio2: gpio@d0018180 { 75 gpio2: gpio@d0018180 {
78 compatible = "marvell,armadaxp-gpio"; 76 compatible = "marvell,orion-gpio";
79 reg = <0xd0018180 0x40>, 77 reg = <0xd0018180 0x40>;
80 <0xd0018870 0x30>;
81 ngpios = <3>; 78 ngpios = <3>;
82 gpio-controller; 79 gpio-controller;
83 #gpio-cells = <2>; 80 #gpio-cells = <2>;
84 interrupt-controller; 81 interrupt-controller;
85 #interrupts-cells = <2>; 82 #interrupts-cells = <2>;
86 interrupts = <24>; 83 interrupts = <91>;
84 };
85
86 ethernet@d0034000 {
87 compatible = "marvell,armada-370-neta";
88 reg = <0xd0034000 0x2500>;
89 interrupts = <14>;
90 clocks = <&gateclk 1>;
91 status = "disabled";
87 }; 92 };
88 }; 93 };
89}; 94};
diff --git a/arch/arm/boot/dts/armada-xp-mv78460.dtsi b/arch/arm/boot/dts/armada-xp-mv78460.dtsi
index da03a129243a..965966110e38 100644
--- a/arch/arm/boot/dts/armada-xp-mv78460.dtsi
+++ b/arch/arm/boot/dts/armada-xp-mv78460.dtsi
@@ -66,39 +66,44 @@
66 }; 66 };
67 67
68 gpio0: gpio@d0018100 { 68 gpio0: gpio@d0018100 {
69 compatible = "marvell,armadaxp-gpio"; 69 compatible = "marvell,orion-gpio";
70 reg = <0xd0018100 0x40>, 70 reg = <0xd0018100 0x40>;
71 <0xd0018800 0x30>;
72 ngpios = <32>; 71 ngpios = <32>;
73 gpio-controller; 72 gpio-controller;
74 #gpio-cells = <2>; 73 #gpio-cells = <2>;
75 interrupt-controller; 74 interrupt-controller;
76 #interrupts-cells = <2>; 75 #interrupts-cells = <2>;
77 interrupts = <16>, <17>, <18>, <19>; 76 interrupts = <82>, <83>, <84>, <85>;
78 }; 77 };
79 78
80 gpio1: gpio@d0018140 { 79 gpio1: gpio@d0018140 {
81 compatible = "marvell,armadaxp-gpio"; 80 compatible = "marvell,orion-gpio";
82 reg = <0xd0018140 0x40>, 81 reg = <0xd0018140 0x40>;
83 <0xd0018840 0x30>;
84 ngpios = <32>; 82 ngpios = <32>;
85 gpio-controller; 83 gpio-controller;
86 #gpio-cells = <2>; 84 #gpio-cells = <2>;
87 interrupt-controller; 85 interrupt-controller;
88 #interrupts-cells = <2>; 86 #interrupts-cells = <2>;
89 interrupts = <20>, <21>, <22>, <23>; 87 interrupts = <87>, <88>, <89>, <90>;
90 }; 88 };
91 89
92 gpio2: gpio@d0018180 { 90 gpio2: gpio@d0018180 {
93 compatible = "marvell,armadaxp-gpio"; 91 compatible = "marvell,orion-gpio";
94 reg = <0xd0018180 0x40>, 92 reg = <0xd0018180 0x40>;
95 <0xd0018870 0x30>;
96 ngpios = <3>; 93 ngpios = <3>;
97 gpio-controller; 94 gpio-controller;
98 #gpio-cells = <2>; 95 #gpio-cells = <2>;
99 interrupt-controller; 96 interrupt-controller;
100 #interrupts-cells = <2>; 97 #interrupts-cells = <2>;
101 interrupts = <24>; 98 interrupts = <91>;
99 };
100
101 ethernet@d0034000 {
102 compatible = "marvell,armada-370-neta";
103 reg = <0xd0034000 0x2500>;
104 interrupts = <14>;
105 clocks = <&gateclk 1>;
106 status = "disabled";
102 }; 107 };
103 }; 108 };
104 }; 109 };
diff --git a/arch/arm/boot/dts/armada-xp.dtsi b/arch/arm/boot/dts/armada-xp.dtsi
index 367aa3f94912..2e37ef101c90 100644
--- a/arch/arm/boot/dts/armada-xp.dtsi
+++ b/arch/arm/boot/dts/armada-xp.dtsi
@@ -42,17 +42,19 @@
42 42
43 soc { 43 soc {
44 serial@d0012200 { 44 serial@d0012200 {
45 compatible = "ns16550"; 45 compatible = "snps,dw-apb-uart";
46 reg = <0xd0012200 0x100>; 46 reg = <0xd0012200 0x100>;
47 reg-shift = <2>; 47 reg-shift = <2>;
48 interrupts = <43>; 48 interrupts = <43>;
49 reg-io-width = <4>;
49 status = "disabled"; 50 status = "disabled";
50 }; 51 };
51 serial@d0012300 { 52 serial@d0012300 {
52 compatible = "ns16550"; 53 compatible = "snps,dw-apb-uart";
53 reg = <0xd0012300 0x100>; 54 reg = <0xd0012300 0x100>;
54 reg-shift = <2>; 55 reg-shift = <2>;
55 interrupts = <44>; 56 interrupts = <44>;
57 reg-io-width = <4>;
56 status = "disabled"; 58 status = "disabled";
57 }; 59 };
58 60
@@ -93,14 +95,6 @@
93 status = "disabled"; 95 status = "disabled";
94 }; 96 };
95 97
96 ethernet@d0034000 {
97 compatible = "marvell,armada-370-neta";
98 reg = <0xd0034000 0x2500>;
99 interrupts = <14>;
100 clocks = <&gateclk 1>;
101 status = "disabled";
102 };
103
104 xor@d0060900 { 98 xor@d0060900 {
105 compatible = "marvell,orion-xor"; 99 compatible = "marvell,orion-xor";
106 reg = <0xd0060900 0x100 100 reg = <0xd0060900 0x100
diff --git a/arch/arm/boot/dts/at91rm9200.dtsi b/arch/arm/boot/dts/at91rm9200.dtsi
index e154f242c680..222047f1ece9 100644
--- a/arch/arm/boot/dts/at91rm9200.dtsi
+++ b/arch/arm/boot/dts/at91rm9200.dtsi
@@ -336,8 +336,8 @@
336 336
337 i2c@0 { 337 i2c@0 {
338 compatible = "i2c-gpio"; 338 compatible = "i2c-gpio";
339 gpios = <&pioA 23 0 /* sda */ 339 gpios = <&pioA 25 0 /* sda */
340 &pioA 24 0 /* scl */ 340 &pioA 26 0 /* scl */
341 >; 341 >;
342 i2c-gpio,sda-open-drain; 342 i2c-gpio,sda-open-drain;
343 i2c-gpio,scl-open-drain; 343 i2c-gpio,scl-open-drain;
diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi
index 68bccf41a2c6..cb7bcc51608d 100644
--- a/arch/arm/boot/dts/at91sam9260.dtsi
+++ b/arch/arm/boot/dts/at91sam9260.dtsi
@@ -306,6 +306,22 @@
306 }; 306 };
307 }; 307 };
308 308
309 ssc0 {
310 pinctrl_ssc0_tx: ssc0_tx-0 {
311 atmel,pins =
312 <1 16 0x1 0x0 /* PB16 periph A */
313 1 17 0x1 0x0 /* PB17 periph A */
314 1 18 0x1 0x0>; /* PB18 periph A */
315 };
316
317 pinctrl_ssc0_rx: ssc0_rx-0 {
318 atmel,pins =
319 <1 19 0x1 0x0 /* PB19 periph A */
320 1 20 0x1 0x0 /* PB20 periph A */
321 1 21 0x1 0x0>; /* PB21 periph A */
322 };
323 };
324
309 pioA: gpio@fffff400 { 325 pioA: gpio@fffff400 {
310 compatible = "atmel,at91rm9200-gpio"; 326 compatible = "atmel,at91rm9200-gpio";
311 reg = <0xfffff400 0x200>; 327 reg = <0xfffff400 0x200>;
@@ -450,6 +466,8 @@
450 compatible = "atmel,at91rm9200-ssc"; 466 compatible = "atmel,at91rm9200-ssc";
451 reg = <0xfffbc000 0x4000>; 467 reg = <0xfffbc000 0x4000>;
452 interrupts = <14 4 5>; 468 interrupts = <14 4 5>;
469 pinctrl-names = "default";
470 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
453 status = "disabled"; 471 status = "disabled";
454 }; 472 };
455 473
diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi
index 32ec62cf5385..271d4de026e9 100644
--- a/arch/arm/boot/dts/at91sam9263.dtsi
+++ b/arch/arm/boot/dts/at91sam9263.dtsi
@@ -271,6 +271,38 @@
271 }; 271 };
272 }; 272 };
273 273
274 ssc0 {
275 pinctrl_ssc0_tx: ssc0_tx-0 {
276 atmel,pins =
277 <1 0 0x2 0x0 /* PB0 periph B */
278 1 1 0x2 0x0 /* PB1 periph B */
279 1 2 0x2 0x0>; /* PB2 periph B */
280 };
281
282 pinctrl_ssc0_rx: ssc0_rx-0 {
283 atmel,pins =
284 <1 3 0x2 0x0 /* PB3 periph B */
285 1 4 0x2 0x0 /* PB4 periph B */
286 1 5 0x2 0x0>; /* PB5 periph B */
287 };
288 };
289
290 ssc1 {
291 pinctrl_ssc1_tx: ssc1_tx-0 {
292 atmel,pins =
293 <1 6 0x1 0x0 /* PB6 periph A */
294 1 7 0x1 0x0 /* PB7 periph A */
295 1 8 0x1 0x0>; /* PB8 periph A */
296 };
297
298 pinctrl_ssc1_rx: ssc1_rx-0 {
299 atmel,pins =
300 <1 9 0x1 0x0 /* PB9 periph A */
301 1 10 0x1 0x0 /* PB10 periph A */
302 1 11 0x1 0x0>; /* PB11 periph A */
303 };
304 };
305
274 pioA: gpio@fffff200 { 306 pioA: gpio@fffff200 {
275 compatible = "atmel,at91rm9200-gpio"; 307 compatible = "atmel,at91rm9200-gpio";
276 reg = <0xfffff200 0x200>; 308 reg = <0xfffff200 0x200>;
@@ -368,6 +400,8 @@
368 compatible = "atmel,at91rm9200-ssc"; 400 compatible = "atmel,at91rm9200-ssc";
369 reg = <0xfff98000 0x4000>; 401 reg = <0xfff98000 0x4000>;
370 interrupts = <16 4 5>; 402 interrupts = <16 4 5>;
403 pinctrl-names = "default";
404 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
371 status = "disabled"; 405 status = "disabled";
372 }; 406 };
373 407
@@ -375,6 +409,8 @@
375 compatible = "atmel,at91rm9200-ssc"; 409 compatible = "atmel,at91rm9200-ssc";
376 reg = <0xfff9c000 0x4000>; 410 reg = <0xfff9c000 0x4000>;
377 interrupts = <17 4 5>; 411 interrupts = <17 4 5>;
412 pinctrl-names = "default";
413 pinctrl-0 = <&pinctrl_ssc1_tx &pinctrl_ssc1_rx>;
378 status = "disabled"; 414 status = "disabled";
379 }; 415 };
380 416
diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi
index 231858ffd850..6b1d4cab24c2 100644
--- a/arch/arm/boot/dts/at91sam9g45.dtsi
+++ b/arch/arm/boot/dts/at91sam9g45.dtsi
@@ -290,6 +290,38 @@
290 }; 290 };
291 }; 291 };
292 292
293 ssc0 {
294 pinctrl_ssc0_tx: ssc0_tx-0 {
295 atmel,pins =
296 <3 0 0x1 0x0 /* PD0 periph A */
297 3 1 0x1 0x0 /* PD1 periph A */
298 3 2 0x1 0x0>; /* PD2 periph A */
299 };
300
301 pinctrl_ssc0_rx: ssc0_rx-0 {
302 atmel,pins =
303 <3 3 0x1 0x0 /* PD3 periph A */
304 3 4 0x1 0x0 /* PD4 periph A */
305 3 5 0x1 0x0>; /* PD5 periph A */
306 };
307 };
308
309 ssc1 {
310 pinctrl_ssc1_tx: ssc1_tx-0 {
311 atmel,pins =
312 <3 10 0x1 0x0 /* PD10 periph A */
313 3 11 0x1 0x0 /* PD11 periph A */
314 3 12 0x1 0x0>; /* PD12 periph A */
315 };
316
317 pinctrl_ssc1_rx: ssc1_rx-0 {
318 atmel,pins =
319 <3 13 0x1 0x0 /* PD13 periph A */
320 3 14 0x1 0x0 /* PD14 periph A */
321 3 15 0x1 0x0>; /* PD15 periph A */
322 };
323 };
324
293 pioA: gpio@fffff200 { 325 pioA: gpio@fffff200 {
294 compatible = "atmel,at91rm9200-gpio"; 326 compatible = "atmel,at91rm9200-gpio";
295 reg = <0xfffff200 0x200>; 327 reg = <0xfffff200 0x200>;
@@ -425,6 +457,8 @@
425 compatible = "atmel,at91sam9g45-ssc"; 457 compatible = "atmel,at91sam9g45-ssc";
426 reg = <0xfff9c000 0x4000>; 458 reg = <0xfff9c000 0x4000>;
427 interrupts = <16 4 5>; 459 interrupts = <16 4 5>;
460 pinctrl-names = "default";
461 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
428 status = "disabled"; 462 status = "disabled";
429 }; 463 };
430 464
@@ -432,6 +466,8 @@
432 compatible = "atmel,at91sam9g45-ssc"; 466 compatible = "atmel,at91sam9g45-ssc";
433 reg = <0xfffa0000 0x4000>; 467 reg = <0xfffa0000 0x4000>;
434 interrupts = <17 4 5>; 468 interrupts = <17 4 5>;
469 pinctrl-names = "default";
470 pinctrl-0 = <&pinctrl_ssc1_tx &pinctrl_ssc1_rx>;
435 status = "disabled"; 471 status = "disabled";
436 }; 472 };
437 473
diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi
index e9efb34f4379..80e29c605d4e 100644
--- a/arch/arm/boot/dts/at91sam9n12.dtsi
+++ b/arch/arm/boot/dts/at91sam9n12.dtsi
@@ -28,6 +28,7 @@
28 tcb1 = &tcb1; 28 tcb1 = &tcb1;
29 i2c0 = &i2c0; 29 i2c0 = &i2c0;
30 i2c1 = &i2c1; 30 i2c1 = &i2c1;
31 ssc0 = &ssc0;
31 }; 32 };
32 cpus { 33 cpus {
33 cpu@0 { 34 cpu@0 {
@@ -244,6 +245,22 @@
244 }; 245 };
245 }; 246 };
246 247
248 ssc0 {
249 pinctrl_ssc0_tx: ssc0_tx-0 {
250 atmel,pins =
251 <0 24 0x2 0x0 /* PA24 periph B */
252 0 25 0x2 0x0 /* PA25 periph B */
253 0 26 0x2 0x0>; /* PA26 periph B */
254 };
255
256 pinctrl_ssc0_rx: ssc0_rx-0 {
257 atmel,pins =
258 <0 27 0x2 0x0 /* PA27 periph B */
259 0 28 0x2 0x0 /* PA28 periph B */
260 0 29 0x2 0x0>; /* PA29 periph B */
261 };
262 };
263
247 pioA: gpio@fffff400 { 264 pioA: gpio@fffff400 {
248 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; 265 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
249 reg = <0xfffff400 0x200>; 266 reg = <0xfffff400 0x200>;
@@ -294,6 +311,15 @@
294 status = "disabled"; 311 status = "disabled";
295 }; 312 };
296 313
314 ssc0: ssc@f0010000 {
315 compatible = "atmel,at91sam9g45-ssc";
316 reg = <0xf0010000 0x4000>;
317 interrupts = <28 4 5>;
318 pinctrl-names = "default";
319 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
320 status = "disabled";
321 };
322
297 usart0: serial@f801c000 { 323 usart0: serial@f801c000 {
298 compatible = "atmel,at91sam9260-usart"; 324 compatible = "atmel,at91sam9260-usart";
299 reg = <0xf801c000 0x4000>; 325 reg = <0xf801c000 0x4000>;
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
index 40ac3a4eb1ab..8ecca6948d81 100644
--- a/arch/arm/boot/dts/at91sam9x5.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5.dtsi
@@ -88,13 +88,6 @@
88 interrupts = <1 4 7>; 88 interrupts = <1 4 7>;
89 }; 89 };
90 90
91 ssc0: ssc@f0010000 {
92 compatible = "atmel,at91sam9g45-ssc";
93 reg = <0xf0010000 0x4000>;
94 interrupts = <28 4 5>;
95 status = "disabled";
96 };
97
98 tcb0: timer@f8008000 { 91 tcb0: timer@f8008000 {
99 compatible = "atmel,at91sam9x5-tcb"; 92 compatible = "atmel,at91sam9x5-tcb";
100 reg = <0xf8008000 0x100>; 93 reg = <0xf8008000 0x100>;
@@ -150,6 +143,11 @@
150 atmel,pins = 143 atmel,pins =
151 <0 3 0x1 0x0>; /* PA3 periph A */ 144 <0 3 0x1 0x0>; /* PA3 periph A */
152 }; 145 };
146
147 pinctrl_usart0_sck: usart0_sck-0 {
148 atmel,pins =
149 <0 4 0x1 0x0>; /* PA4 periph A */
150 };
153 }; 151 };
154 152
155 usart1 { 153 usart1 {
@@ -161,12 +159,17 @@
161 159
162 pinctrl_usart1_rts: usart1_rts-0 { 160 pinctrl_usart1_rts: usart1_rts-0 {
163 atmel,pins = 161 atmel,pins =
164 <3 27 0x3 0x0>; /* PC27 periph C */ 162 <2 27 0x3 0x0>; /* PC27 periph C */
165 }; 163 };
166 164
167 pinctrl_usart1_cts: usart1_cts-0 { 165 pinctrl_usart1_cts: usart1_cts-0 {
168 atmel,pins = 166 atmel,pins =
169 <3 28 0x3 0x0>; /* PC28 periph C */ 167 <2 28 0x3 0x0>; /* PC28 periph C */
168 };
169
170 pinctrl_usart1_sck: usart1_sck-0 {
171 atmel,pins =
172 <2 28 0x3 0x0>; /* PC29 periph C */
170 }; 173 };
171 }; 174 };
172 175
@@ -179,46 +182,56 @@
179 182
180 pinctrl_uart2_rts: uart2_rts-0 { 183 pinctrl_uart2_rts: uart2_rts-0 {
181 atmel,pins = 184 atmel,pins =
182 <0 0 0x2 0x0>; /* PB0 periph B */ 185 <1 0 0x2 0x0>; /* PB0 periph B */
183 }; 186 };
184 187
185 pinctrl_uart2_cts: uart2_cts-0 { 188 pinctrl_uart2_cts: uart2_cts-0 {
186 atmel,pins = 189 atmel,pins =
187 <0 1 0x2 0x0>; /* PB1 periph B */ 190 <1 1 0x2 0x0>; /* PB1 periph B */
191 };
192
193 pinctrl_usart2_sck: usart2_sck-0 {
194 atmel,pins =
195 <1 2 0x2 0x0>; /* PB2 periph B */
188 }; 196 };
189 }; 197 };
190 198
191 usart3 { 199 usart3 {
192 pinctrl_uart3: usart3-0 { 200 pinctrl_uart3: usart3-0 {
193 atmel,pins = 201 atmel,pins =
194 <3 23 0x2 0x1 /* PC22 periph B with pullup */ 202 <2 23 0x2 0x1 /* PC22 periph B with pullup */
195 3 23 0x2 0x0>; /* PC23 periph B */ 203 2 23 0x2 0x0>; /* PC23 periph B */
196 }; 204 };
197 205
198 pinctrl_usart3_rts: usart3_rts-0 { 206 pinctrl_usart3_rts: usart3_rts-0 {
199 atmel,pins = 207 atmel,pins =
200 <3 24 0x2 0x0>; /* PC24 periph B */ 208 <2 24 0x2 0x0>; /* PC24 periph B */
201 }; 209 };
202 210
203 pinctrl_usart3_cts: usart3_cts-0 { 211 pinctrl_usart3_cts: usart3_cts-0 {
204 atmel,pins = 212 atmel,pins =
205 <3 25 0x2 0x0>; /* PC25 periph B */ 213 <2 25 0x2 0x0>; /* PC25 periph B */
214 };
215
216 pinctrl_usart3_sck: usart3_sck-0 {
217 atmel,pins =
218 <2 26 0x2 0x0>; /* PC26 periph B */
206 }; 219 };
207 }; 220 };
208 221
209 uart0 { 222 uart0 {
210 pinctrl_uart0: uart0-0 { 223 pinctrl_uart0: uart0-0 {
211 atmel,pins = 224 atmel,pins =
212 <3 8 0x3 0x0 /* PC8 periph C */ 225 <2 8 0x3 0x0 /* PC8 periph C */
213 3 9 0x3 0x1>; /* PC9 periph C with pullup */ 226 2 9 0x3 0x1>; /* PC9 periph C with pullup */
214 }; 227 };
215 }; 228 };
216 229
217 uart1 { 230 uart1 {
218 pinctrl_uart1: uart1-0 { 231 pinctrl_uart1: uart1-0 {
219 atmel,pins = 232 atmel,pins =
220 <3 16 0x3 0x0 /* PC16 periph C */ 233 <2 16 0x3 0x0 /* PC16 periph C */
221 3 17 0x3 0x1>; /* PC17 periph C with pullup */ 234 2 17 0x3 0x1>; /* PC17 periph C with pullup */
222 }; 235 };
223 }; 236 };
224 237
@@ -247,14 +260,14 @@
247 260
248 pinctrl_macb0_rmii_mii: macb0_rmii_mii-0 { 261 pinctrl_macb0_rmii_mii: macb0_rmii_mii-0 {
249 atmel,pins = 262 atmel,pins =
250 <1 8 0x1 0x0 /* PA8 periph A */ 263 <1 8 0x1 0x0 /* PB8 periph A */
251 1 11 0x1 0x0 /* PA11 periph A */ 264 1 11 0x1 0x0 /* PB11 periph A */
252 1 12 0x1 0x0 /* PA12 periph A */ 265 1 12 0x1 0x0 /* PB12 periph A */
253 1 13 0x1 0x0 /* PA13 periph A */ 266 1 13 0x1 0x0 /* PB13 periph A */
254 1 14 0x1 0x0 /* PA14 periph A */ 267 1 14 0x1 0x0 /* PB14 periph A */
255 1 15 0x1 0x0 /* PA15 periph A */ 268 1 15 0x1 0x0 /* PB15 periph A */
256 1 16 0x1 0x0 /* PA16 periph A */ 269 1 16 0x1 0x0 /* PB16 periph A */
257 1 17 0x1 0x0>; /* PA17 periph A */ 270 1 17 0x1 0x0>; /* PB17 periph A */
258 }; 271 };
259 }; 272 };
260 273
@@ -290,6 +303,22 @@
290 }; 303 };
291 }; 304 };
292 305
306 ssc0 {
307 pinctrl_ssc0_tx: ssc0_tx-0 {
308 atmel,pins =
309 <0 24 0x2 0x0 /* PA24 periph B */
310 0 25 0x2 0x0 /* PA25 periph B */
311 0 26 0x2 0x0>; /* PA26 periph B */
312 };
313
314 pinctrl_ssc0_rx: ssc0_rx-0 {
315 atmel,pins =
316 <0 27 0x2 0x0 /* PA27 periph B */
317 0 28 0x2 0x0 /* PA28 periph B */
318 0 29 0x2 0x0>; /* PA29 periph B */
319 };
320 };
321
293 pioA: gpio@fffff400 { 322 pioA: gpio@fffff400 {
294 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; 323 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
295 reg = <0xfffff400 0x200>; 324 reg = <0xfffff400 0x200>;
@@ -333,6 +362,15 @@
333 }; 362 };
334 }; 363 };
335 364
365 ssc0: ssc@f0010000 {
366 compatible = "atmel,at91sam9g45-ssc";
367 reg = <0xf0010000 0x4000>;
368 interrupts = <28 4 5>;
369 pinctrl-names = "default";
370 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
371 status = "disabled";
372 };
373
336 mmc0: mmc@f0008000 { 374 mmc0: mmc@f0008000 {
337 compatible = "atmel,hsmci"; 375 compatible = "atmel,hsmci";
338 reg = <0xf0008000 0x600>; 376 reg = <0xf0008000 0x600>;
diff --git a/arch/arm/boot/dts/cros5250-common.dtsi b/arch/arm/boot/dts/cros5250-common.dtsi
index fddd17417433..46c098017036 100644
--- a/arch/arm/boot/dts/cros5250-common.dtsi
+++ b/arch/arm/boot/dts/cros5250-common.dtsi
@@ -96,8 +96,8 @@
96 fifo-depth = <0x80>; 96 fifo-depth = <0x80>;
97 card-detect-delay = <200>; 97 card-detect-delay = <200>;
98 samsung,dw-mshc-ciu-div = <3>; 98 samsung,dw-mshc-ciu-div = <3>;
99 samsung,dw-mshc-sdr-timing = <2 3 3>; 99 samsung,dw-mshc-sdr-timing = <2 3>;
100 samsung,dw-mshc-ddr-timing = <1 2 3>; 100 samsung,dw-mshc-ddr-timing = <1 2>;
101 101
102 slot@0 { 102 slot@0 {
103 reg = <0>; 103 reg = <0>;
@@ -120,8 +120,8 @@
120 fifo-depth = <0x80>; 120 fifo-depth = <0x80>;
121 card-detect-delay = <200>; 121 card-detect-delay = <200>;
122 samsung,dw-mshc-ciu-div = <3>; 122 samsung,dw-mshc-ciu-div = <3>;
123 samsung,dw-mshc-sdr-timing = <2 3 3>; 123 samsung,dw-mshc-sdr-timing = <2 3>;
124 samsung,dw-mshc-ddr-timing = <1 2 3>; 124 samsung,dw-mshc-ddr-timing = <1 2>;
125 125
126 slot@0 { 126 slot@0 {
127 reg = <0>; 127 reg = <0>;
@@ -141,8 +141,8 @@
141 fifo-depth = <0x80>; 141 fifo-depth = <0x80>;
142 card-detect-delay = <200>; 142 card-detect-delay = <200>;
143 samsung,dw-mshc-ciu-div = <3>; 143 samsung,dw-mshc-ciu-div = <3>;
144 samsung,dw-mshc-sdr-timing = <2 3 3>; 144 samsung,dw-mshc-sdr-timing = <2 3>;
145 samsung,dw-mshc-ddr-timing = <1 2 3>; 145 samsung,dw-mshc-ddr-timing = <1 2>;
146 146
147 slot@0 { 147 slot@0 {
148 reg = <0>; 148 reg = <0>;
diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi
index 2efd9c891bc9..63f2fbcfe819 100644
--- a/arch/arm/boot/dts/dbx5x0.dtsi
+++ b/arch/arm/boot/dts/dbx5x0.dtsi
@@ -170,7 +170,9 @@
170 gpio-bank = <8>; 170 gpio-bank = <8>;
171 }; 171 };
172 172
173 pinctrl { 173 pinctrl@80157000 {
174 // This is actually the PRCMU base address
175 reg = <0x80157000 0x2000>;
174 compatible = "stericsson,nmk_pinctrl"; 176 compatible = "stericsson,nmk_pinctrl";
175 }; 177 };
176 178
diff --git a/arch/arm/boot/dts/dove-cubox.dts b/arch/arm/boot/dts/dove-cubox.dts
index fed7d3f9f431..cdee96fca6e2 100644
--- a/arch/arm/boot/dts/dove-cubox.dts
+++ b/arch/arm/boot/dts/dove-cubox.dts
@@ -26,10 +26,15 @@
26}; 26};
27 27
28&uart0 { status = "okay"; }; 28&uart0 { status = "okay"; };
29&sdio0 { status = "okay"; };
30&sata0 { status = "okay"; }; 29&sata0 { status = "okay"; };
31&i2c0 { status = "okay"; }; 30&i2c0 { status = "okay"; };
32 31
32&sdio0 {
33 status = "okay";
34 /* sdio0 card detect is connected to wrong pin on CuBox */
35 cd-gpios = <&gpio0 12 1>;
36};
37
33&spi0 { 38&spi0 {
34 status = "okay"; 39 status = "okay";
35 40
@@ -42,9 +47,14 @@
42}; 47};
43 48
44&pinctrl { 49&pinctrl {
45 pinctrl-0 = <&pmx_gpio_18>; 50 pinctrl-0 = <&pmx_gpio_12 &pmx_gpio_18>;
46 pinctrl-names = "default"; 51 pinctrl-names = "default";
47 52
53 pmx_gpio_12: pmx-gpio-12 {
54 marvell,pins = "mpp12";
55 marvell,function = "gpio";
56 };
57
48 pmx_gpio_18: pmx-gpio-18 { 58 pmx_gpio_18: pmx-gpio-18 {
49 marvell,pins = "mpp18"; 59 marvell,pins = "mpp18";
50 marvell,function = "gpio"; 60 marvell,function = "gpio";
diff --git a/arch/arm/boot/dts/dove.dtsi b/arch/arm/boot/dts/dove.dtsi
index f3f7e9d8adca..42eac1ff3cc8 100644
--- a/arch/arm/boot/dts/dove.dtsi
+++ b/arch/arm/boot/dts/dove.dtsi
@@ -117,6 +117,7 @@
117 pinctrl: pinctrl@d0200 { 117 pinctrl: pinctrl@d0200 {
118 compatible = "marvell,dove-pinctrl"; 118 compatible = "marvell,dove-pinctrl";
119 reg = <0xd0200 0x10>; 119 reg = <0xd0200 0x10>;
120 clocks = <&gate_clk 22>;
120 }; 121 };
121 122
122 spi0: spi@10600 { 123 spi0: spi@10600 {
diff --git a/arch/arm/boot/dts/ecx-2000.dts b/arch/arm/boot/dts/ecx-2000.dts
index 46477ac1de99..139b40cc3a23 100644
--- a/arch/arm/boot/dts/ecx-2000.dts
+++ b/arch/arm/boot/dts/ecx-2000.dts
@@ -32,6 +32,7 @@
32 32
33 cpu@0 { 33 cpu@0 {
34 compatible = "arm,cortex-a15"; 34 compatible = "arm,cortex-a15";
35 device_type = "cpu";
35 reg = <0>; 36 reg = <0>;
36 clocks = <&a9pll>; 37 clocks = <&a9pll>;
37 clock-names = "cpu"; 38 clock-names = "cpu";
@@ -39,6 +40,7 @@
39 40
40 cpu@1 { 41 cpu@1 {
41 compatible = "arm,cortex-a15"; 42 compatible = "arm,cortex-a15";
43 device_type = "cpu";
42 reg = <1>; 44 reg = <1>;
43 clocks = <&a9pll>; 45 clocks = <&a9pll>;
44 clock-names = "cpu"; 46 clock-names = "cpu";
@@ -46,6 +48,7 @@
46 48
47 cpu@2 { 49 cpu@2 {
48 compatible = "arm,cortex-a15"; 50 compatible = "arm,cortex-a15";
51 device_type = "cpu";
49 reg = <2>; 52 reg = <2>;
50 clocks = <&a9pll>; 53 clocks = <&a9pll>;
51 clock-names = "cpu"; 54 clock-names = "cpu";
@@ -53,6 +56,7 @@
53 56
54 cpu@3 { 57 cpu@3 {
55 compatible = "arm,cortex-a15"; 58 compatible = "arm,cortex-a15";
59 device_type = "cpu";
56 reg = <3>; 60 reg = <3>;
57 clocks = <&a9pll>; 61 clocks = <&a9pll>;
58 clock-names = "cpu"; 62 clock-names = "cpu";
diff --git a/arch/arm/boot/dts/exynos4210-smdkv310.dts b/arch/arm/boot/dts/exynos4210-smdkv310.dts
index 9b23a8255e39..f63490707f3a 100644
--- a/arch/arm/boot/dts/exynos4210-smdkv310.dts
+++ b/arch/arm/boot/dts/exynos4210-smdkv310.dts
@@ -26,7 +26,7 @@
26 }; 26 };
27 27
28 chosen { 28 chosen {
29 bootargs = "root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC2,115200 init=/linuxrc"; 29 bootargs = "root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC1,115200 init=/linuxrc";
30 }; 30 };
31 31
32 sdhci@12530000 { 32 sdhci@12530000 {
diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts
index 942d5761ca97..e05b18f3c33d 100644
--- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
@@ -115,8 +115,8 @@
115 fifo-depth = <0x80>; 115 fifo-depth = <0x80>;
116 card-detect-delay = <200>; 116 card-detect-delay = <200>;
117 samsung,dw-mshc-ciu-div = <3>; 117 samsung,dw-mshc-ciu-div = <3>;
118 samsung,dw-mshc-sdr-timing = <2 3 3>; 118 samsung,dw-mshc-sdr-timing = <2 3>;
119 samsung,dw-mshc-ddr-timing = <1 2 3>; 119 samsung,dw-mshc-ddr-timing = <1 2>;
120 120
121 slot@0 { 121 slot@0 {
122 reg = <0>; 122 reg = <0>;
@@ -139,8 +139,8 @@
139 fifo-depth = <0x80>; 139 fifo-depth = <0x80>;
140 card-detect-delay = <200>; 140 card-detect-delay = <200>;
141 samsung,dw-mshc-ciu-div = <3>; 141 samsung,dw-mshc-ciu-div = <3>;
142 samsung,dw-mshc-sdr-timing = <2 3 3>; 142 samsung,dw-mshc-sdr-timing = <2 3>;
143 samsung,dw-mshc-ddr-timing = <1 2 3>; 143 samsung,dw-mshc-ddr-timing = <1 2>;
144 144
145 slot@0 { 145 slot@0 {
146 reg = <0>; 146 reg = <0>;
diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi
index 2e3b6efaf1a2..3acf594ea60b 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -574,7 +574,7 @@
574 574
575 hdmi { 575 hdmi {
576 compatible = "samsung,exynos5-hdmi"; 576 compatible = "samsung,exynos5-hdmi";
577 reg = <0x14530000 0x100000>; 577 reg = <0x14530000 0x70000>;
578 interrupts = <0 95 0>; 578 interrupts = <0 95 0>;
579 }; 579 };
580 580
diff --git a/arch/arm/boot/dts/exynos5440-ssdk5440.dts b/arch/arm/boot/dts/exynos5440-ssdk5440.dts
index 921c83cf694f..81e2c964a900 100644
--- a/arch/arm/boot/dts/exynos5440-ssdk5440.dts
+++ b/arch/arm/boot/dts/exynos5440-ssdk5440.dts
@@ -21,7 +21,7 @@
21 }; 21 };
22 22
23 chosen { 23 chosen {
24 bootargs = "root=/dev/ram0 rw ramdisk=8192 initrd=0x81000000,8M console=ttySAC2,115200 init=/linuxrc"; 24 bootargs = "root=/dev/ram0 rw ramdisk=8192 initrd=0x81000000,8M console=ttySAC0,115200 init=/linuxrc";
25 }; 25 };
26 26
27 spi { 27 spi {
diff --git a/arch/arm/boot/dts/highbank.dts b/arch/arm/boot/dts/highbank.dts
index a9ae5d32e80d..5927a8df5625 100644
--- a/arch/arm/boot/dts/highbank.dts
+++ b/arch/arm/boot/dts/highbank.dts
@@ -30,33 +30,37 @@
30 #address-cells = <1>; 30 #address-cells = <1>;
31 #size-cells = <0>; 31 #size-cells = <0>;
32 32
33 cpu@0 { 33 cpu@900 {
34 compatible = "arm,cortex-a9"; 34 compatible = "arm,cortex-a9";
35 reg = <0>; 35 device_type = "cpu";
36 reg = <0x900>;
36 next-level-cache = <&L2>; 37 next-level-cache = <&L2>;
37 clocks = <&a9pll>; 38 clocks = <&a9pll>;
38 clock-names = "cpu"; 39 clock-names = "cpu";
39 }; 40 };
40 41
41 cpu@1 { 42 cpu@901 {
42 compatible = "arm,cortex-a9"; 43 compatible = "arm,cortex-a9";
43 reg = <1>; 44 device_type = "cpu";
45 reg = <0x901>;
44 next-level-cache = <&L2>; 46 next-level-cache = <&L2>;
45 clocks = <&a9pll>; 47 clocks = <&a9pll>;
46 clock-names = "cpu"; 48 clock-names = "cpu";
47 }; 49 };
48 50
49 cpu@2 { 51 cpu@902 {
50 compatible = "arm,cortex-a9"; 52 compatible = "arm,cortex-a9";
51 reg = <2>; 53 device_type = "cpu";
54 reg = <0x902>;
52 next-level-cache = <&L2>; 55 next-level-cache = <&L2>;
53 clocks = <&a9pll>; 56 clocks = <&a9pll>;
54 clock-names = "cpu"; 57 clock-names = "cpu";
55 }; 58 };
56 59
57 cpu@3 { 60 cpu@903 {
58 compatible = "arm,cortex-a9"; 61 compatible = "arm,cortex-a9";
59 reg = <3>; 62 device_type = "cpu";
63 reg = <0x903>;
60 next-level-cache = <&L2>; 64 next-level-cache = <&L2>;
61 clocks = <&a9pll>; 65 clocks = <&a9pll>;
62 clock-names = "cpu"; 66 clock-names = "cpu";
diff --git a/arch/arm/boot/dts/imx23-olinuxino.dts b/arch/arm/boot/dts/imx23-olinuxino.dts
index 7c43b8e70b9f..e7484e4ea659 100644
--- a/arch/arm/boot/dts/imx23-olinuxino.dts
+++ b/arch/arm/boot/dts/imx23-olinuxino.dts
@@ -39,17 +39,17 @@
39 hog_pins_a: hog@0 { 39 hog_pins_a: hog@0 {
40 reg = <0>; 40 reg = <0>;
41 fsl,pinmux-ids = < 41 fsl,pinmux-ids = <
42 0x2013 /* MX23_PAD_SSP1_DETECT__GPIO_2_1 */ 42 0x0113 /* MX23_PAD_GPMI_ALE__GPIO_0_17 */
43 >; 43 >;
44 fsl,drive-strength = <0>; 44 fsl,drive-strength = <0>;
45 fsl,voltage = <1>; 45 fsl,voltage = <1>;
46 fsl,pull-up = <0>; 46 fsl,pull-up = <0>;
47 }; 47 };
48 48
49 led_pin_gpio0_17: led_gpio0_17@0 { 49 led_pin_gpio2_1: led_gpio2_1@0 {
50 reg = <0>; 50 reg = <0>;
51 fsl,pinmux-ids = < 51 fsl,pinmux-ids = <
52 0x0113 /* MX23_PAD_GPMI_ALE__GPIO_0_17 */ 52 0x2013 /* MX23_PAD_SSP1_DETECT__GPIO_2_1 */
53 >; 53 >;
54 fsl,drive-strength = <0>; 54 fsl,drive-strength = <0>;
55 fsl,voltage = <1>; 55 fsl,voltage = <1>;
@@ -110,7 +110,7 @@
110 leds { 110 leds {
111 compatible = "gpio-leds"; 111 compatible = "gpio-leds";
112 pinctrl-names = "default"; 112 pinctrl-names = "default";
113 pinctrl-0 = <&led_pin_gpio0_17>; 113 pinctrl-0 = <&led_pin_gpio2_1>;
114 114
115 user { 115 user {
116 label = "green"; 116 label = "green";
diff --git a/arch/arm/boot/dts/imx31-bug.dts b/arch/arm/boot/dts/imx31-bug.dts
index 24731cb78e8e..7f67402328d3 100644
--- a/arch/arm/boot/dts/imx31-bug.dts
+++ b/arch/arm/boot/dts/imx31-bug.dts
@@ -14,7 +14,7 @@
14 14
15/ { 15/ {
16 model = "Buglabs i.MX31 Bug 1.x"; 16 model = "Buglabs i.MX31 Bug 1.x";
17 compatible = "fsl,imx31-bug", "fsl,imx31"; 17 compatible = "buglabs,imx31-bug", "fsl,imx31";
18 18
19 memory { 19 memory {
20 reg = <0x80000000 0x8000000>; /* 128M */ 20 reg = <0x80000000 0x8000000>; /* 128M */
diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi
index 552aed4ff982..edc3f1eb6699 100644
--- a/arch/arm/boot/dts/imx53.dtsi
+++ b/arch/arm/boot/dts/imx53.dtsi
@@ -492,7 +492,7 @@
492 compatible = "fsl,imx53-flexcan", "fsl,p1010-flexcan"; 492 compatible = "fsl,imx53-flexcan", "fsl,p1010-flexcan";
493 reg = <0x53fcc000 0x4000>; 493 reg = <0x53fcc000 0x4000>;
494 interrupts = <83>; 494 interrupts = <83>;
495 clocks = <&clks 158>, <&clks 157>; 495 clocks = <&clks 87>, <&clks 86>;
496 clock-names = "ipg", "per"; 496 clock-names = "ipg", "per";
497 status = "disabled"; 497 status = "disabled";
498 }; 498 };
diff --git a/arch/arm/boot/dts/kirkwood-6282.dtsi b/arch/arm/boot/dts/kirkwood-6282.dtsi
index 9ae2004d5675..4ccea2130a6c 100644
--- a/arch/arm/boot/dts/kirkwood-6282.dtsi
+++ b/arch/arm/boot/dts/kirkwood-6282.dtsi
@@ -39,6 +39,7 @@
39 #size-cells = <0>; 39 #size-cells = <0>;
40 interrupts = <32>; 40 interrupts = <32>;
41 clock-frequency = <100000>; 41 clock-frequency = <100000>;
42 clocks = <&gate_clk 7>;
42 status = "disabled"; 43 status = "disabled";
43 }; 44 };
44 }; 45 };
diff --git a/arch/arm/boot/dts/kirkwood-ns2-common.dtsi b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
index 9bc6785ad228..77d21abfcdf7 100644
--- a/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
+++ b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
@@ -1,4 +1,5 @@
1/include/ "kirkwood.dtsi" 1/include/ "kirkwood.dtsi"
2/include/ "kirkwood-6281.dtsi"
2 3
3/ { 4/ {
4 chosen { 5 chosen {
@@ -6,6 +7,21 @@
6 }; 7 };
7 8
8 ocp@f1000000 { 9 ocp@f1000000 {
10 pinctrl: pinctrl@10000 {
11 pinctrl-0 = < &pmx_spi &pmx_twsi0 &pmx_uart0
12 &pmx_ns2_sata0 &pmx_ns2_sata1>;
13 pinctrl-names = "default";
14
15 pmx_ns2_sata0: pmx-ns2-sata0 {
16 marvell,pins = "mpp21";
17 marvell,function = "sata0";
18 };
19 pmx_ns2_sata1: pmx-ns2-sata1 {
20 marvell,pins = "mpp20";
21 marvell,function = "sata1";
22 };
23 };
24
9 serial@12000 { 25 serial@12000 {
10 clock-frequency = <166666667>; 26 clock-frequency = <166666667>;
11 status = "okay"; 27 status = "okay";
diff --git a/arch/arm/boot/dts/kirkwood-topkick.dts b/arch/arm/boot/dts/kirkwood-topkick.dts
index c0de5a7f660d..cd15452a52a6 100644
--- a/arch/arm/boot/dts/kirkwood-topkick.dts
+++ b/arch/arm/boot/dts/kirkwood-topkick.dts
@@ -82,4 +82,21 @@
82 gpios = <&gpio1 16 1>; 82 gpios = <&gpio1 16 1>;
83 }; 83 };
84 }; 84 };
85 regulators {
86 compatible = "simple-bus";
87 #address-cells = <1>;
88 #size-cells = <0>;
89
90 sata0_power: regulator@1 {
91 compatible = "regulator-fixed";
92 reg = <1>;
93 regulator-name = "SATA0 Power";
94 regulator-min-microvolt = <5000000>;
95 regulator-max-microvolt = <5000000>;
96 enable-active-high;
97 regulator-always-on;
98 regulator-boot-on;
99 gpio = <&gpio1 4 0>;
100 };
101 };
85}; 102};
diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi
index 7735cee4a9c6..d6ab442b7011 100644
--- a/arch/arm/boot/dts/kirkwood.dtsi
+++ b/arch/arm/boot/dts/kirkwood.dtsi
@@ -36,6 +36,7 @@
36 reg = <0x10100 0x40>; 36 reg = <0x10100 0x40>;
37 ngpios = <32>; 37 ngpios = <32>;
38 interrupt-controller; 38 interrupt-controller;
39 #interrupt-cells = <2>;
39 interrupts = <35>, <36>, <37>, <38>; 40 interrupts = <35>, <36>, <37>, <38>;
40 }; 41 };
41 42
@@ -46,6 +47,7 @@
46 reg = <0x10140 0x40>; 47 reg = <0x10140 0x40>;
47 ngpios = <18>; 48 ngpios = <18>;
48 interrupt-controller; 49 interrupt-controller;
50 #interrupt-cells = <2>;
49 interrupts = <39>, <40>, <41>; 51 interrupts = <39>, <40>, <41>;
50 }; 52 };
51 53
@@ -144,6 +146,7 @@
144 compatible = "marvell,orion-ehci"; 146 compatible = "marvell,orion-ehci";
145 reg = <0x50000 0x1000>; 147 reg = <0x50000 0x1000>;
146 interrupts = <19>; 148 interrupts = <19>;
149 clocks = <&gate_clk 3>;
147 status = "okay"; 150 status = "okay";
148 }; 151 };
149 152
diff --git a/arch/arm/boot/dts/kizbox.dts b/arch/arm/boot/dts/kizbox.dts
index e8814fe0e277..b4dc3ed9a3ec 100644
--- a/arch/arm/boot/dts/kizbox.dts
+++ b/arch/arm/boot/dts/kizbox.dts
@@ -48,6 +48,8 @@
48 48
49 macb0: ethernet@fffc4000 { 49 macb0: ethernet@fffc4000 {
50 phy-mode = "mii"; 50 phy-mode = "mii";
51 pinctrl-0 = <&pinctrl_macb_rmii
52 &pinctrl_macb_rmii_mii_alt>;
51 status = "okay"; 53 status = "okay";
52 }; 54 };
53 55
diff --git a/arch/arm/boot/dts/sunxi.dtsi b/arch/arm/boot/dts/sunxi.dtsi
index 8bbc2bfef221..8b36abea9f2e 100644
--- a/arch/arm/boot/dts/sunxi.dtsi
+++ b/arch/arm/boot/dts/sunxi.dtsi
@@ -60,19 +60,21 @@
60 }; 60 };
61 61
62 uart0: uart@01c28000 { 62 uart0: uart@01c28000 {
63 compatible = "ns8250"; 63 compatible = "snps,dw-apb-uart";
64 reg = <0x01c28000 0x400>; 64 reg = <0x01c28000 0x400>;
65 interrupts = <1>; 65 interrupts = <1>;
66 reg-shift = <2>; 66 reg-shift = <2>;
67 reg-io-width = <4>;
67 clock-frequency = <24000000>; 68 clock-frequency = <24000000>;
68 status = "disabled"; 69 status = "disabled";
69 }; 70 };
70 71
71 uart1: uart@01c28400 { 72 uart1: uart@01c28400 {
72 compatible = "ns8250"; 73 compatible = "snps,dw-apb-uart";
73 reg = <0x01c28400 0x400>; 74 reg = <0x01c28400 0x400>;
74 interrupts = <2>; 75 interrupts = <2>;
75 reg-shift = <2>; 76 reg-shift = <2>;
77 reg-io-width = <4>;
76 clock-frequency = <24000000>; 78 clock-frequency = <24000000>;
77 status = "disabled"; 79 status = "disabled";
78 }; 80 };
diff --git a/arch/arm/boot/dts/twl4030.dtsi b/arch/arm/boot/dts/twl4030.dtsi
index 63411b036932..ed0bc9546837 100644
--- a/arch/arm/boot/dts/twl4030.dtsi
+++ b/arch/arm/boot/dts/twl4030.dtsi
@@ -19,6 +19,10 @@
19 interrupts = <11>; 19 interrupts = <11>;
20 }; 20 };
21 21
22 watchdog {
23 compatible = "ti,twl4030-wdt";
24 };
25
22 vdac: regulator-vdac { 26 vdac: regulator-vdac {
23 compatible = "ti,twl4030-vdac"; 27 compatible = "ti,twl4030-vdac";
24 regulator-min-microvolt = <1800000>; 28 regulator-min-microvolt = <1800000>;
diff --git a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts
index 1fc405a9ecfb..cf8071ad22d5 100644
--- a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts
+++ b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts
@@ -45,7 +45,6 @@
45 reg = <1>; 45 reg = <1>;
46 }; 46 };
47 47
48/* A7s disabled till big.LITTLE patches are available...
49 cpu2: cpu@2 { 48 cpu2: cpu@2 {
50 device_type = "cpu"; 49 device_type = "cpu";
51 compatible = "arm,cortex-a7"; 50 compatible = "arm,cortex-a7";
@@ -63,7 +62,6 @@
63 compatible = "arm,cortex-a7"; 62 compatible = "arm,cortex-a7";
64 reg = <0x102>; 63 reg = <0x102>;
65 }; 64 };
66*/
67 }; 65 };
68 66
69 memory@80000000 { 67 memory@80000000 {
diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c
index 9173d112ea01..e57d7e5bf96a 100644
--- a/arch/arm/common/sa1111.c
+++ b/arch/arm/common/sa1111.c
@@ -686,8 +686,7 @@ sa1111_init_one_child(struct sa1111 *sachip, struct resource *parent,
686 * %-EINVAL no platform data passed 686 * %-EINVAL no platform data passed
687 * %0 successful. 687 * %0 successful.
688 */ 688 */
689static int __devinit 689static int __sa1111_probe(struct device *me, struct resource *mem, int irq)
690__sa1111_probe(struct device *me, struct resource *mem, int irq)
691{ 690{
692 struct sa1111_platform_data *pd = me->platform_data; 691 struct sa1111_platform_data *pd = me->platform_data;
693 struct sa1111 *sachip; 692 struct sa1111 *sachip;
@@ -1011,7 +1010,7 @@ static int sa1111_resume(struct platform_device *dev)
1011#define sa1111_resume NULL 1010#define sa1111_resume NULL
1012#endif 1011#endif
1013 1012
1014static int __devinit sa1111_probe(struct platform_device *pdev) 1013static int sa1111_probe(struct platform_device *pdev)
1015{ 1014{
1016 struct resource *mem; 1015 struct resource *mem;
1017 int irq; 1016 int irq;
diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c
index 0c616d5fcb0f..a5c3dc38aa18 100644
--- a/arch/arm/common/scoop.c
+++ b/arch/arm/common/scoop.c
@@ -176,7 +176,7 @@ static int scoop_resume(struct platform_device *dev)
176#define scoop_resume NULL 176#define scoop_resume NULL
177#endif 177#endif
178 178
179static int __devinit scoop_probe(struct platform_device *pdev) 179static int scoop_probe(struct platform_device *pdev)
180{ 180{
181 struct scoop_dev *devptr; 181 struct scoop_dev *devptr;
182 struct scoop_config *inf; 182 struct scoop_config *inf;
@@ -243,7 +243,7 @@ err_ioremap:
243 return ret; 243 return ret;
244} 244}
245 245
246static int __devexit scoop_remove(struct platform_device *pdev) 246static int scoop_remove(struct platform_device *pdev)
247{ 247{
248 struct scoop_dev *sdev = platform_get_drvdata(pdev); 248 struct scoop_dev *sdev = platform_get_drvdata(pdev);
249 int ret; 249 int ret;
@@ -268,7 +268,7 @@ static int __devexit scoop_remove(struct platform_device *pdev)
268 268
269static struct platform_driver scoop_driver = { 269static struct platform_driver scoop_driver = {
270 .probe = scoop_probe, 270 .probe = scoop_probe,
271 .remove = __devexit_p(scoop_remove), 271 .remove = scoop_remove,
272 .suspend = scoop_suspend, 272 .suspend = scoop_suspend,
273 .resume = scoop_resume, 273 .resume = scoop_resume,
274 .driver = { 274 .driver = {
diff --git a/arch/arm/common/vic.c b/arch/arm/common/vic.c
index e4df17ca90c7..8f324b99416e 100644
--- a/arch/arm/common/vic.c
+++ b/arch/arm/common/vic.c
@@ -206,6 +206,7 @@ static void __init vic_register(void __iomem *base, unsigned int irq,
206 struct device_node *node) 206 struct device_node *node)
207{ 207{
208 struct vic_device *v; 208 struct vic_device *v;
209 int i;
209 210
210 if (vic_id >= ARRAY_SIZE(vic_devices)) { 211 if (vic_id >= ARRAY_SIZE(vic_devices)) {
211 printk(KERN_ERR "%s: too few VICs, increase CONFIG_ARM_VIC_NR\n", __func__); 212 printk(KERN_ERR "%s: too few VICs, increase CONFIG_ARM_VIC_NR\n", __func__);
@@ -220,6 +221,10 @@ static void __init vic_register(void __iomem *base, unsigned int irq,
220 vic_id++; 221 vic_id++;
221 v->domain = irq_domain_add_simple(node, fls(valid_sources), irq, 222 v->domain = irq_domain_add_simple(node, fls(valid_sources), irq,
222 &vic_irqdomain_ops, v); 223 &vic_irqdomain_ops, v);
224 /* create an IRQ mapping for each valid IRQ */
225 for (i = 0; i < fls(valid_sources); i++)
226 if (valid_sources & (1 << i))
227 irq_create_mapping(v->domain, i);
223} 228}
224 229
225static void vic_ack_irq(struct irq_data *d) 230static void vic_ack_irq(struct irq_data *d)
@@ -416,9 +421,9 @@ int __init vic_of_init(struct device_node *node, struct device_node *parent)
416 return -EIO; 421 return -EIO;
417 422
418 /* 423 /*
419 * Passing -1 as first IRQ makes the simple domain allocate descriptors 424 * Passing 0 as first IRQ makes the simple domain allocate descriptors
420 */ 425 */
421 __vic_init(regs, -1, ~0, ~0, node); 426 __vic_init(regs, 0, ~0, ~0, node);
422 427
423 return 0; 428 return 0;
424} 429}
diff --git a/arch/arm/configs/at91_dt_defconfig b/arch/arm/configs/at91_dt_defconfig
index b175577d7abb..1ea959019fcd 100644
--- a/arch/arm/configs/at91_dt_defconfig
+++ b/arch/arm/configs/at91_dt_defconfig
@@ -19,6 +19,7 @@ CONFIG_SOC_AT91SAM9260=y
19CONFIG_SOC_AT91SAM9263=y 19CONFIG_SOC_AT91SAM9263=y
20CONFIG_SOC_AT91SAM9G45=y 20CONFIG_SOC_AT91SAM9G45=y
21CONFIG_SOC_AT91SAM9X5=y 21CONFIG_SOC_AT91SAM9X5=y
22CONFIG_SOC_AT91SAM9N12=y
22CONFIG_MACH_AT91SAM_DT=y 23CONFIG_MACH_AT91SAM_DT=y
23CONFIG_AT91_PROGRAMMABLE_CLOCKS=y 24CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
24CONFIG_AT91_TIMER_HZ=128 25CONFIG_AT91_TIMER_HZ=128
@@ -31,7 +32,7 @@ CONFIG_ZBOOT_ROM_TEXT=0x0
31CONFIG_ZBOOT_ROM_BSS=0x0 32CONFIG_ZBOOT_ROM_BSS=0x0
32CONFIG_ARM_APPENDED_DTB=y 33CONFIG_ARM_APPENDED_DTB=y
33CONFIG_ARM_ATAG_DTB_COMPAT=y 34CONFIG_ARM_ATAG_DTB_COMPAT=y
34CONFIG_CMDLINE="mem=128M console=ttyS0,115200 initrd=0x21100000,25165824 root=/dev/ram0 rw" 35CONFIG_CMDLINE="console=ttyS0,115200 initrd=0x21100000,25165824 root=/dev/ram0 rw"
35CONFIG_KEXEC=y 36CONFIG_KEXEC=y
36CONFIG_AUTO_ZRELADDR=y 37CONFIG_AUTO_ZRELADDR=y
37# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 38# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index dbea6f4efe9f..2eeff1e64b6e 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -6,6 +6,7 @@ CONFIG_MACH_ARMADA_370=y
6CONFIG_MACH_ARMADA_XP=y 6CONFIG_MACH_ARMADA_XP=y
7CONFIG_ARCH_HIGHBANK=y 7CONFIG_ARCH_HIGHBANK=y
8CONFIG_ARCH_SOCFPGA=y 8CONFIG_ARCH_SOCFPGA=y
9CONFIG_ARCH_SUNXI=y
9# CONFIG_ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA is not set 10# CONFIG_ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA is not set
10CONFIG_ARM_ERRATA_754322=y 11CONFIG_ARM_ERRATA_754322=y
11CONFIG_SMP=y 12CONFIG_SMP=y
diff --git a/arch/arm/configs/mvebu_defconfig b/arch/arm/configs/mvebu_defconfig
index a702fb345c01..b5bc96cb65a7 100644
--- a/arch/arm/configs/mvebu_defconfig
+++ b/arch/arm/configs/mvebu_defconfig
@@ -33,9 +33,7 @@ CONFIG_MVNETA=y
33CONFIG_MARVELL_PHY=y 33CONFIG_MARVELL_PHY=y
34CONFIG_SERIAL_8250=y 34CONFIG_SERIAL_8250=y
35CONFIG_SERIAL_8250_CONSOLE=y 35CONFIG_SERIAL_8250_CONSOLE=y
36CONFIG_SERIAL_OF_PLATFORM=y 36CONFIG_SERIAL_8250_DW=y
37CONFIG_I2C=y
38CONFIG_I2C_MV64XXX=y
39CONFIG_GPIOLIB=y 37CONFIG_GPIOLIB=y
40CONFIG_GPIO_SYSFS=y 38CONFIG_GPIO_SYSFS=y
41# CONFIG_USB_SUPPORT is not set 39# CONFIG_USB_SUPPORT is not set
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index a1dc5c071e71..82ce8d738fa1 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -65,6 +65,8 @@ CONFIG_MAC80211_RC_PID=y
65CONFIG_MAC80211_RC_DEFAULT_PID=y 65CONFIG_MAC80211_RC_DEFAULT_PID=y
66CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 66CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
67CONFIG_CONNECTOR=y 67CONFIG_CONNECTOR=y
68CONFIG_DEVTMPFS=y
69CONFIG_DEVTMPFS_MOUNT=y
68CONFIG_MTD=y 70CONFIG_MTD=y
69CONFIG_MTD_CMDLINE_PARTS=y 71CONFIG_MTD_CMDLINE_PARTS=y
70CONFIG_MTD_CHAR=y 72CONFIG_MTD_CHAR=y
@@ -132,9 +134,11 @@ CONFIG_POWER_SUPPLY=y
132CONFIG_WATCHDOG=y 134CONFIG_WATCHDOG=y
133CONFIG_OMAP_WATCHDOG=y 135CONFIG_OMAP_WATCHDOG=y
134CONFIG_TWL4030_WATCHDOG=y 136CONFIG_TWL4030_WATCHDOG=y
137CONFIG_MFD_TPS65217=y
135CONFIG_REGULATOR_TWL4030=y 138CONFIG_REGULATOR_TWL4030=y
136CONFIG_REGULATOR_TPS65023=y 139CONFIG_REGULATOR_TPS65023=y
137CONFIG_REGULATOR_TPS6507X=y 140CONFIG_REGULATOR_TPS6507X=y
141CONFIG_REGULATOR_TPS65217=y
138CONFIG_FB=y 142CONFIG_FB=y
139CONFIG_FIRMWARE_EDID=y 143CONFIG_FIRMWARE_EDID=y
140CONFIG_FB_MODE_HELPERS=y 144CONFIG_FB_MODE_HELPERS=y
@@ -170,6 +174,7 @@ CONFIG_SND_DEBUG=y
170CONFIG_SND_USB_AUDIO=m 174CONFIG_SND_USB_AUDIO=m
171CONFIG_SND_SOC=m 175CONFIG_SND_SOC=m
172CONFIG_SND_OMAP_SOC=m 176CONFIG_SND_OMAP_SOC=m
177CONFIG_SND_OMAP_SOC_OMAP_TWL4030=m
173CONFIG_SND_OMAP_SOC_OMAP3_PANDORA=m 178CONFIG_SND_OMAP_SOC_OMAP3_PANDORA=m
174CONFIG_USB=y 179CONFIG_USB=y
175CONFIG_USB_DEBUG=y 180CONFIG_USB_DEBUG=y
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index 9b722612553d..379cf3292390 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -78,7 +78,7 @@ void pcibios_report_status(u_int status_mask, int warn)
78 * Bug 3 is responsible for the sound DMA grinding to a halt. We now 78 * Bug 3 is responsible for the sound DMA grinding to a halt. We now
79 * live with bug 2. 79 * live with bug 2.
80 */ 80 */
81static void __devinit pci_fixup_83c553(struct pci_dev *dev) 81static void pci_fixup_83c553(struct pci_dev *dev)
82{ 82{
83 /* 83 /*
84 * Set memory region to start at address 0, and enable IO 84 * Set memory region to start at address 0, and enable IO
@@ -130,7 +130,7 @@ static void __devinit pci_fixup_83c553(struct pci_dev *dev)
130} 130}
131DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_83C553, pci_fixup_83c553); 131DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_83C553, pci_fixup_83c553);
132 132
133static void __devinit pci_fixup_unassign(struct pci_dev *dev) 133static void pci_fixup_unassign(struct pci_dev *dev)
134{ 134{
135 dev->resource[0].end -= dev->resource[0].start; 135 dev->resource[0].end -= dev->resource[0].start;
136 dev->resource[0].start = 0; 136 dev->resource[0].start = 0;
@@ -142,7 +142,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND2, PCI_DEVICE_ID_WINBOND2_89C940F,
142 * if it is the host bridge by marking it as such. These resources are of 142 * if it is the host bridge by marking it as such. These resources are of
143 * no consequence to the PCI layer (they are handled elsewhere). 143 * no consequence to the PCI layer (they are handled elsewhere).
144 */ 144 */
145static void __devinit pci_fixup_dec21285(struct pci_dev *dev) 145static void pci_fixup_dec21285(struct pci_dev *dev)
146{ 146{
147 int i; 147 int i;
148 148
@@ -161,7 +161,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21285, pci_fixup_d
161/* 161/*
162 * PCI IDE controllers use non-standard I/O port decoding, respect it. 162 * PCI IDE controllers use non-standard I/O port decoding, respect it.
163 */ 163 */
164static void __devinit pci_fixup_ide_bases(struct pci_dev *dev) 164static void pci_fixup_ide_bases(struct pci_dev *dev)
165{ 165{
166 struct resource *r; 166 struct resource *r;
167 int i; 167 int i;
@@ -182,7 +182,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pci_fixup_ide_bases);
182/* 182/*
183 * Put the DEC21142 to sleep 183 * Put the DEC21142 to sleep
184 */ 184 */
185static void __devinit pci_fixup_dec21142(struct pci_dev *dev) 185static void pci_fixup_dec21142(struct pci_dev *dev)
186{ 186{
187 pci_write_config_dword(dev, 0x40, 0x80000000); 187 pci_write_config_dword(dev, 0x40, 0x80000000);
188} 188}
@@ -204,7 +204,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21142, pci_fixup_d
204 * functional. However, The CY82C693U _does not work_ in bus 204 * functional. However, The CY82C693U _does not work_ in bus
205 * master mode without locking the PCI bus solid. 205 * master mode without locking the PCI bus solid.
206 */ 206 */
207static void __devinit pci_fixup_cy82c693(struct pci_dev *dev) 207static void pci_fixup_cy82c693(struct pci_dev *dev)
208{ 208{
209 if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE) { 209 if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE) {
210 u32 base0, base1; 210 u32 base0, base1;
@@ -254,7 +254,7 @@ static void __devinit pci_fixup_cy82c693(struct pci_dev *dev)
254} 254}
255DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_CONTAQ, PCI_DEVICE_ID_CONTAQ_82C693, pci_fixup_cy82c693); 255DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_CONTAQ, PCI_DEVICE_ID_CONTAQ_82C693, pci_fixup_cy82c693);
256 256
257static void __devinit pci_fixup_it8152(struct pci_dev *dev) 257static void pci_fixup_it8152(struct pci_dev *dev)
258{ 258{
259 int i; 259 int i;
260 /* fixup for ITE 8152 devices */ 260 /* fixup for ITE 8152 devices */
@@ -361,9 +361,7 @@ void pcibios_fixup_bus(struct pci_bus *bus)
361 printk(KERN_INFO "PCI: bus%d: Fast back to back transfers %sabled\n", 361 printk(KERN_INFO "PCI: bus%d: Fast back to back transfers %sabled\n",
362 bus->number, (features & PCI_COMMAND_FAST_BACK) ? "en" : "dis"); 362 bus->number, (features & PCI_COMMAND_FAST_BACK) ? "en" : "dis");
363} 363}
364#ifdef CONFIG_HOTPLUG
365EXPORT_SYMBOL(pcibios_fixup_bus); 364EXPORT_SYMBOL(pcibios_fixup_bus);
366#endif
367 365
368/* 366/*
369 * Swizzle the device pin each time we cross a bridge. If a platform does 367 * Swizzle the device pin each time we cross a bridge. If a platform does
@@ -380,7 +378,7 @@ EXPORT_SYMBOL(pcibios_fixup_bus);
380 * PCI standard swizzle is implemented on plug-in cards and Cardbus based 378 * PCI standard swizzle is implemented on plug-in cards and Cardbus based
381 * PCI extenders, so it can not be ignored. 379 * PCI extenders, so it can not be ignored.
382 */ 380 */
383static u8 __devinit pcibios_swizzle(struct pci_dev *dev, u8 *pin) 381static u8 pcibios_swizzle(struct pci_dev *dev, u8 *pin)
384{ 382{
385 struct pci_sys_data *sys = dev->sysdata; 383 struct pci_sys_data *sys = dev->sysdata;
386 int slot, oldpin = *pin; 384 int slot, oldpin = *pin;
diff --git a/arch/arm/kernel/debug.S b/arch/arm/kernel/debug.S
index 6809200c31fb..14f7c3b14632 100644
--- a/arch/arm/kernel/debug.S
+++ b/arch/arm/kernel/debug.S
@@ -100,12 +100,14 @@ ENTRY(printch)
100 b 1b 100 b 1b
101ENDPROC(printch) 101ENDPROC(printch)
102 102
103#ifdef CONFIG_MMU
103ENTRY(debug_ll_addr) 104ENTRY(debug_ll_addr)
104 addruart r2, r3, ip 105 addruart r2, r3, ip
105 str r2, [r0] 106 str r2, [r0]
106 str r3, [r1] 107 str r3, [r1]
107 mov pc, lr 108 mov pc, lr
108ENDPROC(debug_ll_addr) 109ENDPROC(debug_ll_addr)
110#endif
109 111
110#else 112#else
111 113
diff --git a/arch/arm/kernel/etm.c b/arch/arm/kernel/etm.c
index 36d20bd50120..9b6de8c988f3 100644
--- a/arch/arm/kernel/etm.c
+++ b/arch/arm/kernel/etm.c
@@ -339,7 +339,7 @@ static struct miscdevice etb_miscdev = {
339 .fops = &etb_fops, 339 .fops = &etb_fops,
340}; 340};
341 341
342static int __devinit etb_probe(struct amba_device *dev, const struct amba_id *id) 342static int etb_probe(struct amba_device *dev, const struct amba_id *id)
343{ 343{
344 struct tracectx *t = &tracer; 344 struct tracectx *t = &tracer;
345 int ret = 0; 345 int ret = 0;
@@ -531,7 +531,7 @@ static ssize_t trace_mode_store(struct kobject *kobj,
531static struct kobj_attribute trace_mode_attr = 531static struct kobj_attribute trace_mode_attr =
532 __ATTR(trace_mode, 0644, trace_mode_show, trace_mode_store); 532 __ATTR(trace_mode, 0644, trace_mode_show, trace_mode_store);
533 533
534static int __devinit etm_probe(struct amba_device *dev, const struct amba_id *id) 534static int etm_probe(struct amba_device *dev, const struct amba_id *id)
535{ 535{
536 struct tracectx *t = &tracer; 536 struct tracectx *t = &tracer;
537 int ret = 0; 537 int ret = 0;
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 4eee351f4668..486a15ae9011 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -246,6 +246,7 @@ __create_page_tables:
246 246
247 /* 247 /*
248 * Then map boot params address in r2 if specified. 248 * Then map boot params address in r2 if specified.
249 * We map 2 sections in case the ATAGs/DTB crosses a section boundary.
249 */ 250 */
250 mov r0, r2, lsr #SECTION_SHIFT 251 mov r0, r2, lsr #SECTION_SHIFT
251 movs r0, r0, lsl #SECTION_SHIFT 252 movs r0, r0, lsl #SECTION_SHIFT
@@ -253,6 +254,8 @@ __create_page_tables:
253 addne r3, r3, #PAGE_OFFSET 254 addne r3, r3, #PAGE_OFFSET
254 addne r3, r4, r3, lsr #(SECTION_SHIFT - PMD_ORDER) 255 addne r3, r4, r3, lsr #(SECTION_SHIFT - PMD_ORDER)
255 orrne r6, r7, r0 256 orrne r6, r7, r0
257 strne r6, [r3], #1 << PMD_ORDER
258 addne r6, r6, #1 << SECTION_SHIFT
256 strne r6, [r3] 259 strne r6, [r3]
257 260
258#ifdef CONFIG_DEBUG_LL 261#ifdef CONFIG_DEBUG_LL
@@ -331,7 +334,7 @@ ENTRY(secondary_startup)
331 * as it has already been validated by the primary processor. 334 * as it has already been validated by the primary processor.
332 */ 335 */
333#ifdef CONFIG_ARM_VIRT_EXT 336#ifdef CONFIG_ARM_VIRT_EXT
334 bl __hyp_stub_install 337 bl __hyp_stub_install_secondary
335#endif 338#endif
336 safe_svcmode_maskall r9 339 safe_svcmode_maskall r9
337 340
diff --git a/arch/arm/kernel/hyp-stub.S b/arch/arm/kernel/hyp-stub.S
index 65b2417aebce..1315c4ccfa56 100644
--- a/arch/arm/kernel/hyp-stub.S
+++ b/arch/arm/kernel/hyp-stub.S
@@ -99,7 +99,7 @@ ENTRY(__hyp_stub_install_secondary)
99 * immediately. 99 * immediately.
100 */ 100 */
101 compare_cpu_mode_with_primary r4, r5, r6, r7 101 compare_cpu_mode_with_primary r4, r5, r6, r7
102 bxne lr 102 movne pc, lr
103 103
104 /* 104 /*
105 * Once we have given up on one CPU, we do not try to install the 105 * Once we have given up on one CPU, we do not try to install the
@@ -111,7 +111,7 @@ ENTRY(__hyp_stub_install_secondary)
111 */ 111 */
112 112
113 cmp r4, #HYP_MODE 113 cmp r4, #HYP_MODE
114 bxne lr @ give up if the CPU is not in HYP mode 114 movne pc, lr @ give up if the CPU is not in HYP mode
115 115
116/* 116/*
117 * Configure HSCTLR to set correct exception endianness/instruction set 117 * Configure HSCTLR to set correct exception endianness/instruction set
@@ -120,7 +120,8 @@ ENTRY(__hyp_stub_install_secondary)
120 * Eventually, CPU-specific code might be needed -- assume not for now 120 * Eventually, CPU-specific code might be needed -- assume not for now
121 * 121 *
122 * This code relies on the "eret" instruction to synchronize the 122 * This code relies on the "eret" instruction to synchronize the
123 * various coprocessor accesses. 123 * various coprocessor accesses. This is done when we switch to SVC
124 * (see safe_svcmode_maskall).
124 */ 125 */
125 @ Now install the hypervisor stub: 126 @ Now install the hypervisor stub:
126 adr r7, __hyp_stub_vectors 127 adr r7, __hyp_stub_vectors
@@ -155,14 +156,7 @@ THUMB( orr r7, #(1 << 30) ) @ HSCTLR.TE
1551: 1561:
156#endif 157#endif
157 158
158 bic r7, r4, #MODE_MASK 159 bx lr @ The boot CPU mode is left in r4.
159 orr r7, r7, #SVC_MODE
160THUMB( orr r7, r7, #PSR_T_BIT )
161 msr spsr_cxsf, r7 @ This is SPSR_hyp.
162
163 __MSR_ELR_HYP(14) @ msr elr_hyp, lr
164 __ERET @ return, switching to SVC mode
165 @ The boot CPU mode is left in r4.
166ENDPROC(__hyp_stub_install_secondary) 160ENDPROC(__hyp_stub_install_secondary)
167 161
168__hyp_stub_do_trap: 162__hyp_stub_do_trap:
@@ -200,7 +194,7 @@ ENDPROC(__hyp_get_vectors)
200 @ fall through 194 @ fall through
201ENTRY(__hyp_set_vectors) 195ENTRY(__hyp_set_vectors)
202 __HVC(0) 196 __HVC(0)
203 bx lr 197 mov pc, lr
204ENDPROC(__hyp_set_vectors) 198ENDPROC(__hyp_set_vectors)
205 199
206#ifndef ZIMAGE 200#ifndef ZIMAGE
diff --git a/arch/arm/kernel/perf_event_cpu.c b/arch/arm/kernel/perf_event_cpu.c
index 9a4f6307a016..5f6620684e25 100644
--- a/arch/arm/kernel/perf_event_cpu.c
+++ b/arch/arm/kernel/perf_event_cpu.c
@@ -132,7 +132,7 @@ static int cpu_pmu_request_irq(struct arm_pmu *cpu_pmu, irq_handler_t handler)
132 return 0; 132 return 0;
133} 133}
134 134
135static void __devinit cpu_pmu_init(struct arm_pmu *cpu_pmu) 135static void cpu_pmu_init(struct arm_pmu *cpu_pmu)
136{ 136{
137 int cpu; 137 int cpu;
138 for_each_possible_cpu(cpu) { 138 for_each_possible_cpu(cpu) {
@@ -178,7 +178,7 @@ static struct notifier_block __cpuinitdata cpu_pmu_hotplug_notifier = {
178/* 178/*
179 * PMU platform driver and devicetree bindings. 179 * PMU platform driver and devicetree bindings.
180 */ 180 */
181static struct of_device_id __devinitdata cpu_pmu_of_device_ids[] = { 181static struct of_device_id cpu_pmu_of_device_ids[] = {
182 {.compatible = "arm,cortex-a15-pmu", .data = armv7_a15_pmu_init}, 182 {.compatible = "arm,cortex-a15-pmu", .data = armv7_a15_pmu_init},
183 {.compatible = "arm,cortex-a9-pmu", .data = armv7_a9_pmu_init}, 183 {.compatible = "arm,cortex-a9-pmu", .data = armv7_a9_pmu_init},
184 {.compatible = "arm,cortex-a8-pmu", .data = armv7_a8_pmu_init}, 184 {.compatible = "arm,cortex-a8-pmu", .data = armv7_a8_pmu_init},
@@ -190,7 +190,7 @@ static struct of_device_id __devinitdata cpu_pmu_of_device_ids[] = {
190 {}, 190 {},
191}; 191};
192 192
193static struct platform_device_id __devinitdata cpu_pmu_plat_device_ids[] = { 193static struct platform_device_id cpu_pmu_plat_device_ids[] = {
194 {.name = "arm-pmu"}, 194 {.name = "arm-pmu"},
195 {}, 195 {},
196}; 196};
@@ -198,7 +198,7 @@ static struct platform_device_id __devinitdata cpu_pmu_plat_device_ids[] = {
198/* 198/*
199 * CPU PMU identification and probing. 199 * CPU PMU identification and probing.
200 */ 200 */
201static int __devinit probe_current_pmu(struct arm_pmu *pmu) 201static int probe_current_pmu(struct arm_pmu *pmu)
202{ 202{
203 int cpu = get_cpu(); 203 int cpu = get_cpu();
204 unsigned long cpuid = read_cpuid_id(); 204 unsigned long cpuid = read_cpuid_id();
@@ -252,7 +252,7 @@ static int __devinit probe_current_pmu(struct arm_pmu *pmu)
252 return ret; 252 return ret;
253} 253}
254 254
255static int __devinit cpu_pmu_device_probe(struct platform_device *pdev) 255static int cpu_pmu_device_probe(struct platform_device *pdev)
256{ 256{
257 const struct of_device_id *of_id; 257 const struct of_device_id *of_id;
258 int (*init_fn)(struct arm_pmu *); 258 int (*init_fn)(struct arm_pmu *);
diff --git a/arch/arm/kernel/perf_event_v6.c b/arch/arm/kernel/perf_event_v6.c
index f3e22ff8b6a2..041d0526a288 100644
--- a/arch/arm/kernel/perf_event_v6.c
+++ b/arch/arm/kernel/perf_event_v6.c
@@ -653,7 +653,7 @@ static int armv6_map_event(struct perf_event *event)
653 &armv6_perf_cache_map, 0xFF); 653 &armv6_perf_cache_map, 0xFF);
654} 654}
655 655
656static int __devinit armv6pmu_init(struct arm_pmu *cpu_pmu) 656static int armv6pmu_init(struct arm_pmu *cpu_pmu)
657{ 657{
658 cpu_pmu->name = "v6"; 658 cpu_pmu->name = "v6";
659 cpu_pmu->handle_irq = armv6pmu_handle_irq; 659 cpu_pmu->handle_irq = armv6pmu_handle_irq;
@@ -685,7 +685,7 @@ static int armv6mpcore_map_event(struct perf_event *event)
685 &armv6mpcore_perf_cache_map, 0xFF); 685 &armv6mpcore_perf_cache_map, 0xFF);
686} 686}
687 687
688static int __devinit armv6mpcore_pmu_init(struct arm_pmu *cpu_pmu) 688static int armv6mpcore_pmu_init(struct arm_pmu *cpu_pmu)
689{ 689{
690 cpu_pmu->name = "v6mpcore"; 690 cpu_pmu->name = "v6mpcore";
691 cpu_pmu->handle_irq = armv6pmu_handle_irq; 691 cpu_pmu->handle_irq = armv6pmu_handle_irq;
diff --git a/arch/arm/kernel/perf_event_v7.c b/arch/arm/kernel/perf_event_v7.c
index 7d0cce85d17e..4fbc757d9cff 100644
--- a/arch/arm/kernel/perf_event_v7.c
+++ b/arch/arm/kernel/perf_event_v7.c
@@ -1226,7 +1226,7 @@ static void armv7pmu_init(struct arm_pmu *cpu_pmu)
1226 cpu_pmu->max_period = (1LLU << 32) - 1; 1226 cpu_pmu->max_period = (1LLU << 32) - 1;
1227}; 1227};
1228 1228
1229static u32 __devinit armv7_read_num_pmnc_events(void) 1229static u32 armv7_read_num_pmnc_events(void)
1230{ 1230{
1231 u32 nb_cnt; 1231 u32 nb_cnt;
1232 1232
@@ -1237,7 +1237,7 @@ static u32 __devinit armv7_read_num_pmnc_events(void)
1237 return nb_cnt + 1; 1237 return nb_cnt + 1;
1238} 1238}
1239 1239
1240static int __devinit armv7_a8_pmu_init(struct arm_pmu *cpu_pmu) 1240static int armv7_a8_pmu_init(struct arm_pmu *cpu_pmu)
1241{ 1241{
1242 armv7pmu_init(cpu_pmu); 1242 armv7pmu_init(cpu_pmu);
1243 cpu_pmu->name = "ARMv7 Cortex-A8"; 1243 cpu_pmu->name = "ARMv7 Cortex-A8";
@@ -1246,7 +1246,7 @@ static int __devinit armv7_a8_pmu_init(struct arm_pmu *cpu_pmu)
1246 return 0; 1246 return 0;
1247} 1247}
1248 1248
1249static int __devinit armv7_a9_pmu_init(struct arm_pmu *cpu_pmu) 1249static int armv7_a9_pmu_init(struct arm_pmu *cpu_pmu)
1250{ 1250{
1251 armv7pmu_init(cpu_pmu); 1251 armv7pmu_init(cpu_pmu);
1252 cpu_pmu->name = "ARMv7 Cortex-A9"; 1252 cpu_pmu->name = "ARMv7 Cortex-A9";
@@ -1255,7 +1255,7 @@ static int __devinit armv7_a9_pmu_init(struct arm_pmu *cpu_pmu)
1255 return 0; 1255 return 0;
1256} 1256}
1257 1257
1258static int __devinit armv7_a5_pmu_init(struct arm_pmu *cpu_pmu) 1258static int armv7_a5_pmu_init(struct arm_pmu *cpu_pmu)
1259{ 1259{
1260 armv7pmu_init(cpu_pmu); 1260 armv7pmu_init(cpu_pmu);
1261 cpu_pmu->name = "ARMv7 Cortex-A5"; 1261 cpu_pmu->name = "ARMv7 Cortex-A5";
@@ -1264,7 +1264,7 @@ static int __devinit armv7_a5_pmu_init(struct arm_pmu *cpu_pmu)
1264 return 0; 1264 return 0;
1265} 1265}
1266 1266
1267static int __devinit armv7_a15_pmu_init(struct arm_pmu *cpu_pmu) 1267static int armv7_a15_pmu_init(struct arm_pmu *cpu_pmu)
1268{ 1268{
1269 armv7pmu_init(cpu_pmu); 1269 armv7pmu_init(cpu_pmu);
1270 cpu_pmu->name = "ARMv7 Cortex-A15"; 1270 cpu_pmu->name = "ARMv7 Cortex-A15";
@@ -1274,7 +1274,7 @@ static int __devinit armv7_a15_pmu_init(struct arm_pmu *cpu_pmu)
1274 return 0; 1274 return 0;
1275} 1275}
1276 1276
1277static int __devinit armv7_a7_pmu_init(struct arm_pmu *cpu_pmu) 1277static int armv7_a7_pmu_init(struct arm_pmu *cpu_pmu)
1278{ 1278{
1279 armv7pmu_init(cpu_pmu); 1279 armv7pmu_init(cpu_pmu);
1280 cpu_pmu->name = "ARMv7 Cortex-A7"; 1280 cpu_pmu->name = "ARMv7 Cortex-A7";
diff --git a/arch/arm/kernel/perf_event_xscale.c b/arch/arm/kernel/perf_event_xscale.c
index 0c8265e53d5f..2b0fe30ec12e 100644
--- a/arch/arm/kernel/perf_event_xscale.c
+++ b/arch/arm/kernel/perf_event_xscale.c
@@ -440,7 +440,7 @@ static int xscale_map_event(struct perf_event *event)
440 &xscale_perf_cache_map, 0xFF); 440 &xscale_perf_cache_map, 0xFF);
441} 441}
442 442
443static int __devinit xscale1pmu_init(struct arm_pmu *cpu_pmu) 443static int xscale1pmu_init(struct arm_pmu *cpu_pmu)
444{ 444{
445 cpu_pmu->name = "xscale1"; 445 cpu_pmu->name = "xscale1";
446 cpu_pmu->handle_irq = xscale1pmu_handle_irq; 446 cpu_pmu->handle_irq = xscale1pmu_handle_irq;
@@ -810,7 +810,7 @@ static inline void xscale2pmu_write_counter(struct perf_event *event, u32 val)
810 } 810 }
811} 811}
812 812
813static int __devinit xscale2pmu_init(struct arm_pmu *cpu_pmu) 813static int xscale2pmu_init(struct arm_pmu *cpu_pmu)
814{ 814{
815 cpu_pmu->name = "xscale2"; 815 cpu_pmu->name = "xscale2";
816 cpu_pmu->handle_irq = xscale2pmu_handle_irq; 816 cpu_pmu->handle_irq = xscale2pmu_handle_irq;
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index 9ee866ce0478..4b678478cf95 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -105,6 +105,8 @@ static void __init soc_detect(u32 dbgu_base)
105 switch (socid) { 105 switch (socid) {
106 case ARCH_ID_AT91RM9200: 106 case ARCH_ID_AT91RM9200:
107 at91_soc_initdata.type = AT91_SOC_RM9200; 107 at91_soc_initdata.type = AT91_SOC_RM9200;
108 if (at91_soc_initdata.subtype == AT91_SOC_SUBTYPE_NONE)
109 at91_soc_initdata.subtype = AT91_SOC_RM9200_BGA;
108 at91_boot_soc = at91rm9200_soc; 110 at91_boot_soc = at91rm9200_soc;
109 break; 111 break;
110 112
diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c
index 9211e8800c79..6e2f1631df5b 100644
--- a/arch/arm/mach-davinci/board-dm646x-evm.c
+++ b/arch/arm/mach-davinci/board-dm646x-evm.c
@@ -358,7 +358,7 @@ static int cpld_video_probe(struct i2c_client *client,
358 return 0; 358 return 0;
359} 359}
360 360
361static int __devexit cpld_video_remove(struct i2c_client *client) 361static int cpld_video_remove(struct i2c_client *client)
362{ 362{
363 cpld_client = NULL; 363 cpld_client = NULL;
364 return 0; 364 return 0;
diff --git a/arch/arm/mach-davinci/cdce949.c b/arch/arm/mach-davinci/cdce949.c
index f2232ca6d070..abafb92031c0 100644
--- a/arch/arm/mach-davinci/cdce949.c
+++ b/arch/arm/mach-davinci/cdce949.c
@@ -256,7 +256,7 @@ static int cdce_probe(struct i2c_client *client,
256 return 0; 256 return 0;
257} 257}
258 258
259static int __devexit cdce_remove(struct i2c_client *client) 259static int cdce_remove(struct i2c_client *client)
260{ 260{
261 cdce_i2c_client = NULL; 261 cdce_i2c_client = NULL;
262 return 0; 262 return 0;
@@ -274,7 +274,7 @@ static struct i2c_driver cdce_driver = {
274 .name = "cdce949", 274 .name = "cdce949",
275 }, 275 },
276 .probe = cdce_probe, 276 .probe = cdce_probe,
277 .remove = __devexit_p(cdce_remove), 277 .remove = cdce_remove,
278 .id_table = cdce_id, 278 .id_table = cdce_id,
279}; 279};
280 280
diff --git a/arch/arm/mach-dove/pcie.c b/arch/arm/mach-dove/pcie.c
index 0ef4435b1657..8a275f297522 100644
--- a/arch/arm/mach-dove/pcie.c
+++ b/arch/arm/mach-dove/pcie.c
@@ -135,7 +135,7 @@ static struct pci_ops pcie_ops = {
135 .write = pcie_wr_conf, 135 .write = pcie_wr_conf,
136}; 136};
137 137
138static void __devinit rc_pci_fixup(struct pci_dev *dev) 138static void rc_pci_fixup(struct pci_dev *dev)
139{ 139{
140 /* 140 /*
141 * Prevent enumeration of root complex. 141 * Prevent enumeration of root complex.
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 91d5b6f1d5af..e103c290bc9e 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -74,6 +74,8 @@ config SOC_EXYNOS5440
74 depends on ARCH_EXYNOS5 74 depends on ARCH_EXYNOS5
75 select ARM_ARCH_TIMER 75 select ARM_ARCH_TIMER
76 select AUTO_ZRELADDR 76 select AUTO_ZRELADDR
77 select PINCTRL
78 select PINCTRL_EXYNOS5440
77 help 79 help
78 Enable EXYNOS5440 SoC support 80 Enable EXYNOS5440 SoC support
79 81
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index d6d0dc651089..1a89824a5f78 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -424,11 +424,18 @@ static void __init exynos5_init_clocks(int xtal)
424{ 424{
425 printk(KERN_DEBUG "%s: initializing clocks\n", __func__); 425 printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
426 426
427 /* EXYNOS5440 can support only common clock framework */
428
429 if (soc_is_exynos5440())
430 return;
431
432#ifdef CONFIG_SOC_EXYNOS5250
427 s3c24xx_register_baseclocks(xtal); 433 s3c24xx_register_baseclocks(xtal);
428 s5p_register_clocks(xtal); 434 s5p_register_clocks(xtal);
429 435
430 exynos5_register_clocks(); 436 exynos5_register_clocks();
431 exynos5_setup_clocks(); 437 exynos5_setup_clocks();
438#endif
432} 439}
433 440
434#define COMBINER_ENABLE_SET 0x0 441#define COMBINER_ENABLE_SET 0x0
diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
index dc248167d206..981dc1e1da51 100644
--- a/arch/arm/mach-highbank/highbank.c
+++ b/arch/arm/mach-highbank/highbank.c
@@ -135,7 +135,7 @@ static struct sys_timer highbank_timer = {
135 135
136static void highbank_power_off(void) 136static void highbank_power_off(void)
137{ 137{
138 hignbank_set_pwr_shutdown(); 138 highbank_set_pwr_shutdown();
139 139
140 while (1) 140 while (1)
141 cpu_do_idle(); 141 cpu_do_idle();
diff --git a/arch/arm/mach-highbank/hotplug.c b/arch/arm/mach-highbank/hotplug.c
index 7b60faccd551..f30c52843396 100644
--- a/arch/arm/mach-highbank/hotplug.c
+++ b/arch/arm/mach-highbank/hotplug.c
@@ -30,7 +30,7 @@ void __ref highbank_cpu_die(unsigned int cpu)
30{ 30{
31 flush_cache_all(); 31 flush_cache_all();
32 32
33 highbank_set_cpu_jump(cpu, secondary_startup); 33 highbank_set_cpu_jump(cpu, phys_to_virt(0));
34 highbank_set_core_pwr(); 34 highbank_set_core_pwr();
35 35
36 cpu_do_idle(); 36 cpu_do_idle();
diff --git a/arch/arm/mach-highbank/platsmp.c b/arch/arm/mach-highbank/platsmp.c
index 1129957f6c1d..4ecc864ac8b9 100644
--- a/arch/arm/mach-highbank/platsmp.c
+++ b/arch/arm/mach-highbank/platsmp.c
@@ -32,6 +32,7 @@ static void __cpuinit highbank_secondary_init(unsigned int cpu)
32 32
33static int __cpuinit highbank_boot_secondary(unsigned int cpu, struct task_struct *idle) 33static int __cpuinit highbank_boot_secondary(unsigned int cpu, struct task_struct *idle)
34{ 34{
35 highbank_set_cpu_jump(cpu, secondary_startup);
35 gic_raise_softirq(cpumask_of(cpu), 0); 36 gic_raise_softirq(cpumask_of(cpu), 0);
36 return 0; 37 return 0;
37} 38}
@@ -61,19 +62,8 @@ static void __init highbank_smp_init_cpus(void)
61 62
62static void __init highbank_smp_prepare_cpus(unsigned int max_cpus) 63static void __init highbank_smp_prepare_cpus(unsigned int max_cpus)
63{ 64{
64 int i;
65
66 if (scu_base_addr) 65 if (scu_base_addr)
67 scu_enable(scu_base_addr); 66 scu_enable(scu_base_addr);
68
69 /*
70 * Write the address of secondary startup into the jump table
71 * The cores are in wfi and wait until they receive a soft interrupt
72 * and a non-zero value to jump to. Then the secondary CPU branches
73 * to this address.
74 */
75 for (i = 1; i < max_cpus; i++)
76 highbank_set_cpu_jump(i, secondary_startup);
77} 67}
78 68
79struct smp_operations highbank_smp_ops __initdata = { 69struct smp_operations highbank_smp_ops __initdata = {
diff --git a/arch/arm/mach-highbank/pm.c b/arch/arm/mach-highbank/pm.c
index 74aa135966f0..04eddb4f4380 100644
--- a/arch/arm/mach-highbank/pm.c
+++ b/arch/arm/mach-highbank/pm.c
@@ -14,10 +14,12 @@
14 * this program. If not, see <http://www.gnu.org/licenses/>. 14 * this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16 16
17#include <linux/cpu_pm.h>
17#include <linux/init.h> 18#include <linux/init.h>
18#include <linux/io.h> 19#include <linux/io.h>
19#include <linux/suspend.h> 20#include <linux/suspend.h>
20 21
22#include <asm/cacheflush.h>
21#include <asm/proc-fns.h> 23#include <asm/proc-fns.h>
22#include <asm/suspend.h> 24#include <asm/suspend.h>
23 25
@@ -26,16 +28,31 @@
26 28
27static int highbank_suspend_finish(unsigned long val) 29static int highbank_suspend_finish(unsigned long val)
28{ 30{
31 outer_flush_all();
32 outer_disable();
33
34 highbank_set_pwr_suspend();
35
29 cpu_do_idle(); 36 cpu_do_idle();
37
38 highbank_clear_pwr_request();
30 return 0; 39 return 0;
31} 40}
32 41
33static int highbank_pm_enter(suspend_state_t state) 42static int highbank_pm_enter(suspend_state_t state)
34{ 43{
35 hignbank_set_pwr_suspend(); 44 cpu_pm_enter();
45 cpu_cluster_pm_enter();
46
36 highbank_set_cpu_jump(0, cpu_resume); 47 highbank_set_cpu_jump(0, cpu_resume);
37 cpu_suspend(0, highbank_suspend_finish); 48 cpu_suspend(0, highbank_suspend_finish);
38 49
50 cpu_cluster_pm_exit();
51 cpu_pm_exit();
52
53 highbank_smc1(0x102, 0x1);
54 if (scu_base_addr)
55 scu_enable(scu_base_addr);
39 return 0; 56 return 0;
40} 57}
41 58
diff --git a/arch/arm/mach-highbank/sysregs.h b/arch/arm/mach-highbank/sysregs.h
index e13e8ea7c6cb..70af9d13fcef 100644
--- a/arch/arm/mach-highbank/sysregs.h
+++ b/arch/arm/mach-highbank/sysregs.h
@@ -44,28 +44,43 @@ static inline void highbank_set_core_pwr(void)
44 writel_relaxed(1, sregs_base + SREG_CPU_PWR_CTRL(cpu)); 44 writel_relaxed(1, sregs_base + SREG_CPU_PWR_CTRL(cpu));
45} 45}
46 46
47static inline void hignbank_set_pwr_suspend(void) 47static inline void highbank_clear_core_pwr(void)
48{
49 int cpu = cpu_logical_map(smp_processor_id());
50 if (scu_base_addr)
51 scu_power_mode(scu_base_addr, SCU_PM_NORMAL);
52 else
53 writel_relaxed(0, sregs_base + SREG_CPU_PWR_CTRL(cpu));
54}
55
56static inline void highbank_set_pwr_suspend(void)
48{ 57{
49 writel(HB_PWR_SUSPEND, sregs_base + HB_SREG_A9_PWR_REQ); 58 writel(HB_PWR_SUSPEND, sregs_base + HB_SREG_A9_PWR_REQ);
50 highbank_set_core_pwr(); 59 highbank_set_core_pwr();
51} 60}
52 61
53static inline void hignbank_set_pwr_shutdown(void) 62static inline void highbank_set_pwr_shutdown(void)
54{ 63{
55 writel(HB_PWR_SHUTDOWN, sregs_base + HB_SREG_A9_PWR_REQ); 64 writel(HB_PWR_SHUTDOWN, sregs_base + HB_SREG_A9_PWR_REQ);
56 highbank_set_core_pwr(); 65 highbank_set_core_pwr();
57} 66}
58 67
59static inline void hignbank_set_pwr_soft_reset(void) 68static inline void highbank_set_pwr_soft_reset(void)
60{ 69{
61 writel(HB_PWR_SOFT_RESET, sregs_base + HB_SREG_A9_PWR_REQ); 70 writel(HB_PWR_SOFT_RESET, sregs_base + HB_SREG_A9_PWR_REQ);
62 highbank_set_core_pwr(); 71 highbank_set_core_pwr();
63} 72}
64 73
65static inline void hignbank_set_pwr_hard_reset(void) 74static inline void highbank_set_pwr_hard_reset(void)
66{ 75{
67 writel(HB_PWR_HARD_RESET, sregs_base + HB_SREG_A9_PWR_REQ); 76 writel(HB_PWR_HARD_RESET, sregs_base + HB_SREG_A9_PWR_REQ);
68 highbank_set_core_pwr(); 77 highbank_set_core_pwr();
69} 78}
70 79
80static inline void highbank_clear_pwr_request(void)
81{
82 writel(~0UL, sregs_base + HB_SREG_A9_PWR_REQ);
83 highbank_clear_core_pwr();
84}
85
71#endif 86#endif
diff --git a/arch/arm/mach-highbank/system.c b/arch/arm/mach-highbank/system.c
index aed96ad9bd4a..37d8384dcf19 100644
--- a/arch/arm/mach-highbank/system.c
+++ b/arch/arm/mach-highbank/system.c
@@ -22,9 +22,9 @@
22void highbank_restart(char mode, const char *cmd) 22void highbank_restart(char mode, const char *cmd)
23{ 23{
24 if (mode == 'h') 24 if (mode == 'h')
25 hignbank_set_pwr_hard_reset(); 25 highbank_set_pwr_hard_reset();
26 else 26 else
27 hignbank_set_pwr_soft_reset(); 27 highbank_set_pwr_soft_reset();
28 28
29 while (1) 29 while (1)
30 cpu_do_idle(); 30 cpu_do_idle();
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 1ad0d76de8c7..0a2349dc7018 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -841,8 +841,6 @@ config SOC_IMX6Q
841 select ARCH_HAS_CPUFREQ 841 select ARCH_HAS_CPUFREQ
842 select ARCH_HAS_OPP 842 select ARCH_HAS_OPP
843 select ARM_CPU_SUSPEND if PM 843 select ARM_CPU_SUSPEND if PM
844 select ARM_ERRATA_743622
845 select ARM_ERRATA_751472
846 select ARM_ERRATA_754322 844 select ARM_ERRATA_754322
847 select ARM_ERRATA_764369 if SMP 845 select ARM_ERRATA_764369 if SMP
848 select ARM_ERRATA_775420 846 select ARM_ERRATA_775420
@@ -853,6 +851,7 @@ config SOC_IMX6Q
853 select HAVE_CAN_FLEXCAN if CAN 851 select HAVE_CAN_FLEXCAN if CAN
854 select HAVE_IMX_GPC 852 select HAVE_IMX_GPC
855 select HAVE_IMX_MMDC 853 select HAVE_IMX_MMDC
854 select HAVE_IMX_SRC
856 select HAVE_SMP 855 select HAVE_SMP
857 select MFD_SYSCON 856 select MFD_SYSCON
858 select PINCTRL 857 select PINCTRL
diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c
index b197aa73dc4b..2c570cdaae7b 100644
--- a/arch/arm/mach-imx/clk-imx25.c
+++ b/arch/arm/mach-imx/clk-imx25.c
@@ -254,9 +254,9 @@ int __init mx25_clocks_init(void)
254 clk_register_clkdev(clk[ipg], "ipg", "mxc-ehci.2"); 254 clk_register_clkdev(clk[ipg], "ipg", "mxc-ehci.2");
255 clk_register_clkdev(clk[usbotg_ahb], "ahb", "mxc-ehci.2"); 255 clk_register_clkdev(clk[usbotg_ahb], "ahb", "mxc-ehci.2");
256 clk_register_clkdev(clk[usb_div], "per", "mxc-ehci.2"); 256 clk_register_clkdev(clk[usb_div], "per", "mxc-ehci.2");
257 clk_register_clkdev(clk[ipg], "ipg", "fsl-usb2-udc"); 257 clk_register_clkdev(clk[ipg], "ipg", "imx-udc-mx27");
258 clk_register_clkdev(clk[usbotg_ahb], "ahb", "fsl-usb2-udc"); 258 clk_register_clkdev(clk[usbotg_ahb], "ahb", "imx-udc-mx27");
259 clk_register_clkdev(clk[usb_div], "per", "fsl-usb2-udc"); 259 clk_register_clkdev(clk[usb_div], "per", "imx-udc-mx27");
260 clk_register_clkdev(clk[nfc_ipg_per], NULL, "imx25-nand.0"); 260 clk_register_clkdev(clk[nfc_ipg_per], NULL, "imx25-nand.0");
261 /* i.mx25 has the i.mx35 type cspi */ 261 /* i.mx25 has the i.mx35 type cspi */
262 clk_register_clkdev(clk[cspi1_ipg], NULL, "imx35-cspi.0"); 262 clk_register_clkdev(clk[cspi1_ipg], NULL, "imx35-cspi.0");
diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c
index 4c1d1e4efc74..1ffe3b534e51 100644
--- a/arch/arm/mach-imx/clk-imx27.c
+++ b/arch/arm/mach-imx/clk-imx27.c
@@ -236,9 +236,9 @@ int __init mx27_clocks_init(unsigned long fref)
236 clk_register_clkdev(clk[lcdc_ahb_gate], "ahb", "imx21-fb.0"); 236 clk_register_clkdev(clk[lcdc_ahb_gate], "ahb", "imx21-fb.0");
237 clk_register_clkdev(clk[csi_ahb_gate], "ahb", "imx27-camera.0"); 237 clk_register_clkdev(clk[csi_ahb_gate], "ahb", "imx27-camera.0");
238 clk_register_clkdev(clk[per4_gate], "per", "imx27-camera.0"); 238 clk_register_clkdev(clk[per4_gate], "per", "imx27-camera.0");
239 clk_register_clkdev(clk[usb_div], "per", "fsl-usb2-udc"); 239 clk_register_clkdev(clk[usb_div], "per", "imx-udc-mx27");
240 clk_register_clkdev(clk[usb_ipg_gate], "ipg", "fsl-usb2-udc"); 240 clk_register_clkdev(clk[usb_ipg_gate], "ipg", "imx-udc-mx27");
241 clk_register_clkdev(clk[usb_ahb_gate], "ahb", "fsl-usb2-udc"); 241 clk_register_clkdev(clk[usb_ahb_gate], "ahb", "imx-udc-mx27");
242 clk_register_clkdev(clk[usb_div], "per", "mxc-ehci.0"); 242 clk_register_clkdev(clk[usb_div], "per", "mxc-ehci.0");
243 clk_register_clkdev(clk[usb_ipg_gate], "ipg", "mxc-ehci.0"); 243 clk_register_clkdev(clk[usb_ipg_gate], "ipg", "mxc-ehci.0");
244 clk_register_clkdev(clk[usb_ahb_gate], "ahb", "mxc-ehci.0"); 244 clk_register_clkdev(clk[usb_ahb_gate], "ahb", "mxc-ehci.0");
diff --git a/arch/arm/mach-imx/clk-imx31.c b/arch/arm/mach-imx/clk-imx31.c
index 8be64e0a4ace..16ccbd41dea9 100644
--- a/arch/arm/mach-imx/clk-imx31.c
+++ b/arch/arm/mach-imx/clk-imx31.c
@@ -139,9 +139,9 @@ int __init mx31_clocks_init(unsigned long fref)
139 clk_register_clkdev(clk[usb_div_post], "per", "mxc-ehci.2"); 139 clk_register_clkdev(clk[usb_div_post], "per", "mxc-ehci.2");
140 clk_register_clkdev(clk[usb_gate], "ahb", "mxc-ehci.2"); 140 clk_register_clkdev(clk[usb_gate], "ahb", "mxc-ehci.2");
141 clk_register_clkdev(clk[ipg], "ipg", "mxc-ehci.2"); 141 clk_register_clkdev(clk[ipg], "ipg", "mxc-ehci.2");
142 clk_register_clkdev(clk[usb_div_post], "per", "fsl-usb2-udc"); 142 clk_register_clkdev(clk[usb_div_post], "per", "imx-udc-mx27");
143 clk_register_clkdev(clk[usb_gate], "ahb", "fsl-usb2-udc"); 143 clk_register_clkdev(clk[usb_gate], "ahb", "imx-udc-mx27");
144 clk_register_clkdev(clk[ipg], "ipg", "fsl-usb2-udc"); 144 clk_register_clkdev(clk[ipg], "ipg", "imx-udc-mx27");
145 clk_register_clkdev(clk[csi_gate], NULL, "mx3-camera.0"); 145 clk_register_clkdev(clk[csi_gate], NULL, "mx3-camera.0");
146 /* i.mx31 has the i.mx21 type uart */ 146 /* i.mx31 has the i.mx21 type uart */
147 clk_register_clkdev(clk[uart1_gate], "per", "imx21-uart.0"); 147 clk_register_clkdev(clk[uart1_gate], "per", "imx21-uart.0");
diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c
index 66f3d65ea275..f0727e80815d 100644
--- a/arch/arm/mach-imx/clk-imx35.c
+++ b/arch/arm/mach-imx/clk-imx35.c
@@ -251,9 +251,9 @@ int __init mx35_clocks_init()
251 clk_register_clkdev(clk[usb_div], "per", "mxc-ehci.2"); 251 clk_register_clkdev(clk[usb_div], "per", "mxc-ehci.2");
252 clk_register_clkdev(clk[ipg], "ipg", "mxc-ehci.2"); 252 clk_register_clkdev(clk[ipg], "ipg", "mxc-ehci.2");
253 clk_register_clkdev(clk[usbotg_gate], "ahb", "mxc-ehci.2"); 253 clk_register_clkdev(clk[usbotg_gate], "ahb", "mxc-ehci.2");
254 clk_register_clkdev(clk[usb_div], "per", "fsl-usb2-udc"); 254 clk_register_clkdev(clk[usb_div], "per", "imx-udc-mx27");
255 clk_register_clkdev(clk[ipg], "ipg", "fsl-usb2-udc"); 255 clk_register_clkdev(clk[ipg], "ipg", "imx-udc-mx27");
256 clk_register_clkdev(clk[usbotg_gate], "ahb", "fsl-usb2-udc"); 256 clk_register_clkdev(clk[usbotg_gate], "ahb", "imx-udc-mx27");
257 clk_register_clkdev(clk[wdog_gate], NULL, "imx2-wdt.0"); 257 clk_register_clkdev(clk[wdog_gate], NULL, "imx2-wdt.0");
258 clk_register_clkdev(clk[nfc_div], NULL, "imx25-nand.0"); 258 clk_register_clkdev(clk[nfc_div], NULL, "imx25-nand.0");
259 clk_register_clkdev(clk[csi_gate], NULL, "mx3-camera.0"); 259 clk_register_clkdev(clk[csi_gate], NULL, "mx3-camera.0");
diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c b/arch/arm/mach-imx/clk-imx51-imx53.c
index 579023f59dc1..fb7cb841b64c 100644
--- a/arch/arm/mach-imx/clk-imx51-imx53.c
+++ b/arch/arm/mach-imx/clk-imx51-imx53.c
@@ -269,9 +269,9 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil,
269 clk_register_clkdev(clk[usboh3_per_gate], "per", "mxc-ehci.2"); 269 clk_register_clkdev(clk[usboh3_per_gate], "per", "mxc-ehci.2");
270 clk_register_clkdev(clk[usboh3_gate], "ipg", "mxc-ehci.2"); 270 clk_register_clkdev(clk[usboh3_gate], "ipg", "mxc-ehci.2");
271 clk_register_clkdev(clk[usboh3_gate], "ahb", "mxc-ehci.2"); 271 clk_register_clkdev(clk[usboh3_gate], "ahb", "mxc-ehci.2");
272 clk_register_clkdev(clk[usboh3_per_gate], "per", "fsl-usb2-udc"); 272 clk_register_clkdev(clk[usboh3_per_gate], "per", "imx-udc-mx51");
273 clk_register_clkdev(clk[usboh3_gate], "ipg", "fsl-usb2-udc"); 273 clk_register_clkdev(clk[usboh3_gate], "ipg", "imx-udc-mx51");
274 clk_register_clkdev(clk[usboh3_gate], "ahb", "fsl-usb2-udc"); 274 clk_register_clkdev(clk[usboh3_gate], "ahb", "imx-udc-mx51");
275 clk_register_clkdev(clk[nfc_gate], NULL, "imx51-nand"); 275 clk_register_clkdev(clk[nfc_gate], NULL, "imx51-nand");
276 clk_register_clkdev(clk[ssi1_ipg_gate], NULL, "imx-ssi.0"); 276 clk_register_clkdev(clk[ssi1_ipg_gate], NULL, "imx-ssi.0");
277 clk_register_clkdev(clk[ssi2_ipg_gate], NULL, "imx-ssi.1"); 277 clk_register_clkdev(clk[ssi2_ipg_gate], NULL, "imx-ssi.1");
diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c
index 7f2c10c7413a..c0c4e723b7f5 100644
--- a/arch/arm/mach-imx/clk-imx6q.c
+++ b/arch/arm/mach-imx/clk-imx6q.c
@@ -436,6 +436,9 @@ int __init mx6q_clocks_init(void)
436 for (i = 0; i < ARRAY_SIZE(clks_init_on); i++) 436 for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
437 clk_prepare_enable(clk[clks_init_on[i]]); 437 clk_prepare_enable(clk[clks_init_on[i]]);
438 438
439 /* Set initial power mode */
440 imx6q_set_lpm(WAIT_CLOCKED);
441
439 np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-gpt"); 442 np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-gpt");
440 base = of_iomap(np, 0); 443 base = of_iomap(np, 0);
441 WARN_ON(!base); 444 WARN_ON(!base);
diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
index 7191ab4434e5..fa36fb84ab19 100644
--- a/arch/arm/mach-imx/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -142,6 +142,7 @@ extern int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode);
142extern void imx6q_clock_map_io(void); 142extern void imx6q_clock_map_io(void);
143 143
144extern void imx_cpu_die(unsigned int cpu); 144extern void imx_cpu_die(unsigned int cpu);
145extern int imx_cpu_kill(unsigned int cpu);
145 146
146#ifdef CONFIG_PM 147#ifdef CONFIG_PM
147extern void imx6q_pm_init(void); 148extern void imx6q_pm_init(void);
diff --git a/arch/arm/mach-imx/cpufreq.c b/arch/arm/mach-imx/cpufreq.c
index 36e8b3994470..d8c75c3c925d 100644
--- a/arch/arm/mach-imx/cpufreq.c
+++ b/arch/arm/mach-imx/cpufreq.c
@@ -188,7 +188,7 @@ static struct cpufreq_driver mxc_driver = {
188 .name = "imx", 188 .name = "imx",
189}; 189};
190 190
191static int __devinit mxc_cpufreq_driver_init(void) 191static int mxc_cpufreq_driver_init(void)
192{ 192{
193 return cpufreq_register_driver(&mxc_driver); 193 return cpufreq_register_driver(&mxc_driver);
194} 194}
diff --git a/arch/arm/mach-imx/devices/devices-common.h b/arch/arm/mach-imx/devices/devices-common.h
index 6277baf1b7be..9bd5777ff0e7 100644
--- a/arch/arm/mach-imx/devices/devices-common.h
+++ b/arch/arm/mach-imx/devices/devices-common.h
@@ -63,6 +63,7 @@ struct platform_device *__init imx_add_flexcan(
63 63
64#include <linux/fsl_devices.h> 64#include <linux/fsl_devices.h>
65struct imx_fsl_usb2_udc_data { 65struct imx_fsl_usb2_udc_data {
66 const char *devid;
66 resource_size_t iobase; 67 resource_size_t iobase;
67 resource_size_t irq; 68 resource_size_t irq;
68}; 69};
diff --git a/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c b/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c
index 37e44398197b..3c06bd96e9cc 100644
--- a/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c
+++ b/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c
@@ -11,35 +11,36 @@
11#include "../hardware.h" 11#include "../hardware.h"
12#include "devices-common.h" 12#include "devices-common.h"
13 13
14#define imx_fsl_usb2_udc_data_entry_single(soc) \ 14#define imx_fsl_usb2_udc_data_entry_single(soc, _devid) \
15 { \ 15 { \
16 .devid = _devid, \
16 .iobase = soc ## _USB_OTG_BASE_ADDR, \ 17 .iobase = soc ## _USB_OTG_BASE_ADDR, \
17 .irq = soc ## _INT_USB_OTG, \ 18 .irq = soc ## _INT_USB_OTG, \
18 } 19 }
19 20
20#ifdef CONFIG_SOC_IMX25 21#ifdef CONFIG_SOC_IMX25
21const struct imx_fsl_usb2_udc_data imx25_fsl_usb2_udc_data __initconst = 22const struct imx_fsl_usb2_udc_data imx25_fsl_usb2_udc_data __initconst =
22 imx_fsl_usb2_udc_data_entry_single(MX25); 23 imx_fsl_usb2_udc_data_entry_single(MX25, "imx-udc-mx27");
23#endif /* ifdef CONFIG_SOC_IMX25 */ 24#endif /* ifdef CONFIG_SOC_IMX25 */
24 25
25#ifdef CONFIG_SOC_IMX27 26#ifdef CONFIG_SOC_IMX27
26const struct imx_fsl_usb2_udc_data imx27_fsl_usb2_udc_data __initconst = 27const struct imx_fsl_usb2_udc_data imx27_fsl_usb2_udc_data __initconst =
27 imx_fsl_usb2_udc_data_entry_single(MX27); 28 imx_fsl_usb2_udc_data_entry_single(MX27, "imx-udc-mx27");
28#endif /* ifdef CONFIG_SOC_IMX27 */ 29#endif /* ifdef CONFIG_SOC_IMX27 */
29 30
30#ifdef CONFIG_SOC_IMX31 31#ifdef CONFIG_SOC_IMX31
31const struct imx_fsl_usb2_udc_data imx31_fsl_usb2_udc_data __initconst = 32const struct imx_fsl_usb2_udc_data imx31_fsl_usb2_udc_data __initconst =
32 imx_fsl_usb2_udc_data_entry_single(MX31); 33 imx_fsl_usb2_udc_data_entry_single(MX31, "imx-udc-mx27");
33#endif /* ifdef CONFIG_SOC_IMX31 */ 34#endif /* ifdef CONFIG_SOC_IMX31 */
34 35
35#ifdef CONFIG_SOC_IMX35 36#ifdef CONFIG_SOC_IMX35
36const struct imx_fsl_usb2_udc_data imx35_fsl_usb2_udc_data __initconst = 37const struct imx_fsl_usb2_udc_data imx35_fsl_usb2_udc_data __initconst =
37 imx_fsl_usb2_udc_data_entry_single(MX35); 38 imx_fsl_usb2_udc_data_entry_single(MX35, "imx-udc-mx27");
38#endif /* ifdef CONFIG_SOC_IMX35 */ 39#endif /* ifdef CONFIG_SOC_IMX35 */
39 40
40#ifdef CONFIG_SOC_IMX51 41#ifdef CONFIG_SOC_IMX51
41const struct imx_fsl_usb2_udc_data imx51_fsl_usb2_udc_data __initconst = 42const struct imx_fsl_usb2_udc_data imx51_fsl_usb2_udc_data __initconst =
42 imx_fsl_usb2_udc_data_entry_single(MX51); 43 imx_fsl_usb2_udc_data_entry_single(MX51, "imx-udc-mx51");
43#endif 44#endif
44 45
45struct platform_device *__init imx_add_fsl_usb2_udc( 46struct platform_device *__init imx_add_fsl_usb2_udc(
@@ -57,7 +58,7 @@ struct platform_device *__init imx_add_fsl_usb2_udc(
57 .flags = IORESOURCE_IRQ, 58 .flags = IORESOURCE_IRQ,
58 }, 59 },
59 }; 60 };
60 return imx_add_platform_device_dmamask("fsl-usb2-udc", -1, 61 return imx_add_platform_device_dmamask(data->devid, -1,
61 res, ARRAY_SIZE(res), 62 res, ARRAY_SIZE(res),
62 pdata, sizeof(*pdata), DMA_BIT_MASK(32)); 63 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
63} 64}
diff --git a/arch/arm/mach-imx/devices/platform-imx-fb.c b/arch/arm/mach-imx/devices/platform-imx-fb.c
index 10b0ed39f07f..25a47c616b2d 100644
--- a/arch/arm/mach-imx/devices/platform-imx-fb.c
+++ b/arch/arm/mach-imx/devices/platform-imx-fb.c
@@ -54,7 +54,7 @@ struct platform_device *__init imx_add_imx_fb(
54 .flags = IORESOURCE_IRQ, 54 .flags = IORESOURCE_IRQ,
55 }, 55 },
56 }; 56 };
57 return imx_add_platform_device_dmamask("imx-fb", 0, 57 return imx_add_platform_device_dmamask(data->devid, 0,
58 res, ARRAY_SIZE(res), 58 res, ARRAY_SIZE(res),
59 pdata, sizeof(*pdata), DMA_BIT_MASK(32)); 59 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
60} 60}
diff --git a/arch/arm/mach-imx/hotplug.c b/arch/arm/mach-imx/hotplug.c
index 3dec962b0770..7bc5fe15dda2 100644
--- a/arch/arm/mach-imx/hotplug.c
+++ b/arch/arm/mach-imx/hotplug.c
@@ -46,9 +46,11 @@ static inline void cpu_enter_lowpower(void)
46void imx_cpu_die(unsigned int cpu) 46void imx_cpu_die(unsigned int cpu)
47{ 47{
48 cpu_enter_lowpower(); 48 cpu_enter_lowpower();
49 imx_enable_cpu(cpu, false); 49 cpu_do_idle();
50}
50 51
51 /* spin here until hardware takes it down */ 52int imx_cpu_kill(unsigned int cpu)
52 while (1) 53{
53 ; 54 imx_enable_cpu(cpu, false);
55 return 1;
54} 56}
diff --git a/arch/arm/mach-imx/iram_alloc.c b/arch/arm/mach-imx/iram_alloc.c
index 6c80424f678e..e05cf407db65 100644
--- a/arch/arm/mach-imx/iram_alloc.c
+++ b/arch/arm/mach-imx/iram_alloc.c
@@ -22,8 +22,7 @@
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/genalloc.h> 24#include <linux/genalloc.h>
25 25#include "linux/platform_data/imx-iram.h"
26#include "iram.h"
27 26
28static unsigned long iram_phys_base; 27static unsigned long iram_phys_base;
29static void __iomem *iram_virt_base; 28static void __iomem *iram_virt_base;
diff --git a/arch/arm/mach-imx/mmdc.c b/arch/arm/mach-imx/mmdc.c
index c461e98496c3..7a9686ad994c 100644
--- a/arch/arm/mach-imx/mmdc.c
+++ b/arch/arm/mach-imx/mmdc.c
@@ -21,7 +21,7 @@
21#define BP_MMDC_MAPSR_PSD 0 21#define BP_MMDC_MAPSR_PSD 0
22#define BP_MMDC_MAPSR_PSS 4 22#define BP_MMDC_MAPSR_PSS 4
23 23
24static int __devinit imx_mmdc_probe(struct platform_device *pdev) 24static int imx_mmdc_probe(struct platform_device *pdev)
25{ 25{
26 struct device_node *np = pdev->dev.of_node; 26 struct device_node *np = pdev->dev.of_node;
27 void __iomem *mmdc_base, *reg; 27 void __iomem *mmdc_base, *reg;
diff --git a/arch/arm/mach-imx/platsmp.c b/arch/arm/mach-imx/platsmp.c
index 3777b805b76b..66fae885c842 100644
--- a/arch/arm/mach-imx/platsmp.c
+++ b/arch/arm/mach-imx/platsmp.c
@@ -92,5 +92,6 @@ struct smp_operations imx_smp_ops __initdata = {
92 .smp_boot_secondary = imx_boot_secondary, 92 .smp_boot_secondary = imx_boot_secondary,
93#ifdef CONFIG_HOTPLUG_CPU 93#ifdef CONFIG_HOTPLUG_CPU
94 .cpu_die = imx_cpu_die, 94 .cpu_die = imx_cpu_die,
95 .cpu_kill = imx_cpu_kill,
95#endif 96#endif
96}; 97};
diff --git a/arch/arm/mach-imx/pm-imx6q.c b/arch/arm/mach-imx/pm-imx6q.c
index a17543da602d..ee42d20cba19 100644
--- a/arch/arm/mach-imx/pm-imx6q.c
+++ b/arch/arm/mach-imx/pm-imx6q.c
@@ -41,6 +41,7 @@ static int imx6q_pm_enter(suspend_state_t state)
41 cpu_suspend(0, imx6q_suspend_finish); 41 cpu_suspend(0, imx6q_suspend_finish);
42 imx_smp_prepare(); 42 imx_smp_prepare();
43 imx_gpc_post_resume(); 43 imx_gpc_post_resume();
44 imx6q_set_lpm(WAIT_CLOCKED);
44 break; 45 break;
45 default: 46 default:
46 return -EINVAL; 47 return -EINVAL;
diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c
index be50e795536d..e7fcea7f3300 100644
--- a/arch/arm/mach-integrator/pci_v3.c
+++ b/arch/arm/mach-integrator/pci_v3.c
@@ -475,13 +475,12 @@ int __init pci_v3_setup(int nr, struct pci_sys_data *sys)
475{ 475{
476 int ret = 0; 476 int ret = 0;
477 477
478 if (!ap_syscon_base)
479 return -EINVAL;
480
478 if (nr == 0) { 481 if (nr == 0) {
479 sys->mem_offset = PHYS_PCI_MEM_BASE; 482 sys->mem_offset = PHYS_PCI_MEM_BASE;
480 ret = pci_v3_setup_resources(sys); 483 ret = pci_v3_setup_resources(sys);
481 /* Remap the Integrator system controller */
482 ap_syscon_base = ioremap(INTEGRATOR_SC_BASE, 0x100);
483 if (!ap_syscon_base)
484 return -EINVAL;
485 } 484 }
486 485
487 return ret; 486 return ret;
@@ -497,6 +496,13 @@ void __init pci_v3_preinit(void)
497 unsigned int temp; 496 unsigned int temp;
498 int ret; 497 int ret;
499 498
499 /* Remap the Integrator system controller */
500 ap_syscon_base = ioremap(INTEGRATOR_SC_BASE, 0x100);
501 if (!ap_syscon_base) {
502 pr_err("unable to remap the AP syscon for PCIv3\n");
503 return;
504 }
505
500 pcibios_min_mem = 0x00100000; 506 pcibios_min_mem = 0x00100000;
501 507
502 /* 508 /*
diff --git a/arch/arm/mach-iop13xx/pci.c b/arch/arm/mach-iop13xx/pci.c
index 2f28018c4447..9082b84aeebb 100644
--- a/arch/arm/mach-iop13xx/pci.c
+++ b/arch/arm/mach-iop13xx/pci.c
@@ -504,7 +504,7 @@ iop13xx_pci_abort(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
504 504
505/* Scan an IOP13XX PCI bus. nr selects which ATU we use. 505/* Scan an IOP13XX PCI bus. nr selects which ATU we use.
506 */ 506 */
507struct pci_bus * __devinit iop13xx_scan_bus(int nr, struct pci_sys_data *sys) 507struct pci_bus *iop13xx_scan_bus(int nr, struct pci_sys_data *sys)
508{ 508{
509 int which_atu; 509 int which_atu;
510 struct pci_bus *bus = NULL; 510 struct pci_bus *bus = NULL;
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
index ff4150a2ad05..de4fd2bb1e27 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -67,6 +67,10 @@ static void __init kirkwood_legacy_clk_init(void)
67 orion_clkdev_add(NULL, "mv643xx_eth_port.1", 67 orion_clkdev_add(NULL, "mv643xx_eth_port.1",
68 of_clk_get_from_provider(&clkspec)); 68 of_clk_get_from_provider(&clkspec));
69 69
70 clkspec.args[0] = CGC_BIT_SDIO;
71 orion_clkdev_add(NULL, "mvsdio",
72 of_clk_get_from_provider(&clkspec));
73
70} 74}
71 75
72static void __init kirkwood_of_clk_init(void) 76static void __init kirkwood_of_clk_init(void)
diff --git a/arch/arm/mach-kirkwood/board-ns2.c b/arch/arm/mach-kirkwood/board-ns2.c
index 8821720ab5a4..f4632a809f68 100644
--- a/arch/arm/mach-kirkwood/board-ns2.c
+++ b/arch/arm/mach-kirkwood/board-ns2.c
@@ -18,47 +18,11 @@
18#include <linux/gpio.h> 18#include <linux/gpio.h>
19#include <linux/of.h> 19#include <linux/of.h>
20#include "common.h" 20#include "common.h"
21#include "mpp.h"
22 21
23static struct mv643xx_eth_platform_data ns2_ge00_data = { 22static struct mv643xx_eth_platform_data ns2_ge00_data = {
24 .phy_addr = MV643XX_ETH_PHY_ADDR(8), 23 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
25}; 24};
26 25
27static unsigned int ns2_mpp_config[] __initdata = {
28 MPP0_SPI_SCn,
29 MPP1_SPI_MOSI,
30 MPP2_SPI_SCK,
31 MPP3_SPI_MISO,
32 MPP4_NF_IO6,
33 MPP5_NF_IO7,
34 MPP6_SYSRST_OUTn,
35 MPP7_GPO, /* Fan speed (bit 1) */
36 MPP8_TW0_SDA,
37 MPP9_TW0_SCK,
38 MPP10_UART0_TXD,
39 MPP11_UART0_RXD,
40 MPP12_GPO, /* Red led */
41 MPP14_GPIO, /* USB fuse */
42 MPP16_GPIO, /* SATA 0 power */
43 MPP17_GPIO, /* SATA 1 power */
44 MPP18_NF_IO0,
45 MPP19_NF_IO1,
46 MPP20_SATA1_ACTn,
47 MPP21_SATA0_ACTn,
48 MPP22_GPIO, /* Fan speed (bit 0) */
49 MPP23_GPIO, /* Fan power */
50 MPP24_GPIO, /* USB mode select */
51 MPP25_GPIO, /* Fan rotation fail */
52 MPP26_GPIO, /* USB device vbus */
53 MPP28_GPIO, /* USB enable host vbus */
54 MPP29_GPIO, /* Blue led (slow register) */
55 MPP30_GPIO, /* Blue led (command register) */
56 MPP31_GPIO, /* Board power off */
57 MPP32_GPIO, /* Power button (0 = Released, 1 = Pushed) */
58 MPP33_GPO, /* Fan speed (bit 2) */
59 0
60};
61
62#define NS2_GPIO_POWER_OFF 31 26#define NS2_GPIO_POWER_OFF 31
63 27
64static void ns2_power_off(void) 28static void ns2_power_off(void)
@@ -71,8 +35,6 @@ void __init ns2_init(void)
71 /* 35 /*
72 * Basic setup. Needs to be called early. 36 * Basic setup. Needs to be called early.
73 */ 37 */
74 kirkwood_mpp_conf(ns2_mpp_config);
75
76 if (of_machine_is_compatible("lacie,netspace_lite_v2") || 38 if (of_machine_is_compatible("lacie,netspace_lite_v2") ||
77 of_machine_is_compatible("lacie,netspace_mini_v2")) 39 of_machine_is_compatible("lacie,netspace_mini_v2"))
78 ns2_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0); 40 ns2_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
diff --git a/arch/arm/mach-kirkwood/board-usi_topkick.c b/arch/arm/mach-kirkwood/board-usi_topkick.c
index 15e69fcde9f4..23d2dd1b1b1e 100644
--- a/arch/arm/mach-kirkwood/board-usi_topkick.c
+++ b/arch/arm/mach-kirkwood/board-usi_topkick.c
@@ -64,8 +64,6 @@ static unsigned int topkick_mpp_config[] __initdata = {
64 0 64 0
65}; 65};
66 66
67#define TOPKICK_SATA0_PWR_ENABLE 36
68
69void __init usi_topkick_init(void) 67void __init usi_topkick_init(void)
70{ 68{
71 /* 69 /*
@@ -73,8 +71,6 @@ void __init usi_topkick_init(void)
73 */ 71 */
74 kirkwood_mpp_conf(topkick_mpp_config); 72 kirkwood_mpp_conf(topkick_mpp_config);
75 73
76 /* SATA0 power enable */
77 gpio_set_value(TOPKICK_SATA0_PWR_ENABLE, 1);
78 74
79 kirkwood_ge00_init(&topkick_ge00_data); 75 kirkwood_ge00_init(&topkick_ge00_data);
80 kirkwood_sdio_init(&topkick_mvsdio_data); 76 kirkwood_sdio_init(&topkick_mvsdio_data);
diff --git a/arch/arm/mach-kirkwood/pcie.c b/arch/arm/mach-kirkwood/pcie.c
index ef102646ba9a..a1c3ab6fc809 100644
--- a/arch/arm/mach-kirkwood/pcie.c
+++ b/arch/arm/mach-kirkwood/pcie.c
@@ -214,7 +214,7 @@ static int __init kirkwood_pcie_setup(int nr, struct pci_sys_data *sys)
214 * PCI_CLASS_BRIDGE_HOST or Linux will errantly try to process the BAR's on 214 * PCI_CLASS_BRIDGE_HOST or Linux will errantly try to process the BAR's on
215 * the device. Decoding setup is handled by the orion code. 215 * the device. Decoding setup is handled by the orion code.
216 */ 216 */
217static void __devinit rc_pci_fixup(struct pci_dev *dev) 217static void rc_pci_fixup(struct pci_dev *dev)
218{ 218{
219 if (dev->bus->parent == NULL && dev->devfn == 0) { 219 if (dev->bus->parent == NULL && dev->devfn == 0) {
220 int i; 220 int i;
diff --git a/arch/arm/mach-ks8695/board-acs5k.c b/arch/arm/mach-ks8695/board-acs5k.c
index 255502ddd879..b0c306ccbc6e 100644
--- a/arch/arm/mach-ks8695/board-acs5k.c
+++ b/arch/arm/mach-ks8695/board-acs5k.c
@@ -92,7 +92,7 @@ static struct i2c_board_info acs5k_i2c_devs[] __initdata = {
92 }, 92 },
93}; 93};
94 94
95static void __devinit acs5k_i2c_init(void) 95static void acs5k_i2c_init(void)
96{ 96{
97 /* The gpio interface */ 97 /* The gpio interface */
98 platform_device_register(&acs5k_i2c_device); 98 platform_device_register(&acs5k_i2c_device);
diff --git a/arch/arm/mach-mmp/sram.c b/arch/arm/mach-mmp/sram.c
index a6c08ede4491..bf5e64906e65 100644
--- a/arch/arm/mach-mmp/sram.c
+++ b/arch/arm/mach-mmp/sram.c
@@ -61,7 +61,7 @@ struct gen_pool *sram_get_gpool(char *pool_name)
61} 61}
62EXPORT_SYMBOL(sram_get_gpool); 62EXPORT_SYMBOL(sram_get_gpool);
63 63
64static int __devinit sram_probe(struct platform_device *pdev) 64static int sram_probe(struct platform_device *pdev)
65{ 65{
66 struct sram_platdata *pdata = pdev->dev.platform_data; 66 struct sram_platdata *pdata = pdev->dev.platform_data;
67 struct sram_bank_info *info; 67 struct sram_bank_info *info;
@@ -125,7 +125,7 @@ out:
125 return ret; 125 return ret;
126} 126}
127 127
128static int __devexit sram_remove(struct platform_device *pdev) 128static int sram_remove(struct platform_device *pdev)
129{ 129{
130 struct sram_bank_info *info; 130 struct sram_bank_info *info;
131 131
diff --git a/arch/arm/mach-msm/proc_comm.c b/arch/arm/mach-msm/proc_comm.c
index 8f1eecd88186..507f5ca80697 100644
--- a/arch/arm/mach-msm/proc_comm.c
+++ b/arch/arm/mach-msm/proc_comm.c
@@ -120,7 +120,7 @@ int msm_proc_comm(unsigned cmd, unsigned *data1, unsigned *data2)
120 * and unknown state. This function should be called early to 120 * and unknown state. This function should be called early to
121 * wait on the ARM9. 121 * wait on the ARM9.
122 */ 122 */
123void __devinit proc_comm_boot_wait(void) 123void proc_comm_boot_wait(void)
124{ 124{
125 void __iomem *base = MSM_SHARED_RAM_BASE; 125 void __iomem *base = MSM_SHARED_RAM_BASE;
126 126
diff --git a/arch/arm/mach-msm/smd.c b/arch/arm/mach-msm/smd.c
index c5a2eddc6cdc..b1588a1ea2f8 100644
--- a/arch/arm/mach-msm/smd.c
+++ b/arch/arm/mach-msm/smd.c
@@ -988,7 +988,7 @@ int smd_core_init(void)
988 return 0; 988 return 0;
989} 989}
990 990
991static int __devinit msm_smd_probe(struct platform_device *pdev) 991static int msm_smd_probe(struct platform_device *pdev)
992{ 992{
993 /* 993 /*
994 * If we haven't waited for the ARM9 to boot up till now, 994 * If we haven't waited for the ARM9 to boot up till now,
diff --git a/arch/arm/mach-mv78xx0/pcie.c b/arch/arm/mach-mv78xx0/pcie.c
index a9a154a646dd..ee8c0b51df2c 100644
--- a/arch/arm/mach-mv78xx0/pcie.c
+++ b/arch/arm/mach-mv78xx0/pcie.c
@@ -173,7 +173,7 @@ static struct pci_ops pcie_ops = {
173 .write = pcie_wr_conf, 173 .write = pcie_wr_conf,
174}; 174};
175 175
176static void __devinit rc_pci_fixup(struct pci_dev *dev) 176static void rc_pci_fixup(struct pci_dev *dev)
177{ 177{
178 /* 178 /*
179 * Prevent enumeration of root complex. 179 * Prevent enumeration of root complex.
diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile
index 5dcb369b58aa..99df4df680fd 100644
--- a/arch/arm/mach-mvebu/Makefile
+++ b/arch/arm/mach-mvebu/Makefile
@@ -1,6 +1,8 @@
1ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include \ 1ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include \
2 -I$(srctree)/arch/arm/plat-orion/include 2 -I$(srctree)/arch/arm/plat-orion/include
3 3
4AFLAGS_coherency_ll.o := -Wa,-march=armv7-a
5
4obj-y += system-controller.o 6obj-y += system-controller.o
5obj-$(CONFIG_MACH_ARMADA_370_XP) += armada-370-xp.o irq-armada-370-xp.o addr-map.o coherency.o coherency_ll.o pmsu.o 7obj-$(CONFIG_MACH_ARMADA_370_XP) += armada-370-xp.o irq-armada-370-xp.o addr-map.o coherency.o coherency_ll.o pmsu.o
6obj-$(CONFIG_SMP) += platsmp.o headsmp.o 8obj-$(CONFIG_SMP) += platsmp.o headsmp.o
diff --git a/arch/arm/mach-nomadik/board-nhk8815.c b/arch/arm/mach-nomadik/board-nhk8815.c
index 98167a4319f7..9f19069248da 100644
--- a/arch/arm/mach-nomadik/board-nhk8815.c
+++ b/arch/arm/mach-nomadik/board-nhk8815.c
@@ -27,7 +27,6 @@
27#include <linux/pinctrl/machine.h> 27#include <linux/pinctrl/machine.h>
28#include <linux/platform_data/pinctrl-nomadik.h> 28#include <linux/platform_data/pinctrl-nomadik.h>
29#include <linux/platform_data/clocksource-nomadik-mtu.h> 29#include <linux/platform_data/clocksource-nomadik-mtu.h>
30#include <linux/platform_data/mtd-nomadik-nand.h>
31#include <asm/hardware/vic.h> 30#include <asm/hardware/vic.h>
32#include <asm/sizes.h> 31#include <asm/sizes.h>
33#include <asm/mach-types.h> 32#include <asm/mach-types.h>
diff --git a/arch/arm/mach-nomadik/include/mach/irqs.h b/arch/arm/mach-nomadik/include/mach/irqs.h
index b549d0571548..215f8cdb4004 100644
--- a/arch/arm/mach-nomadik/include/mach/irqs.h
+++ b/arch/arm/mach-nomadik/include/mach/irqs.h
@@ -22,49 +22,49 @@
22 22
23#include <mach/hardware.h> 23#include <mach/hardware.h>
24 24
25#define IRQ_VIC_START 1 /* first VIC interrupt is 1 */ 25#define IRQ_VIC_START 32 /* first VIC interrupt is 1 */
26 26
27/* 27/*
28 * Interrupt numbers generic for all Nomadik Chip cuts 28 * Interrupt numbers generic for all Nomadik Chip cuts
29 */ 29 */
30#define IRQ_WATCHDOG 1 30#define IRQ_WATCHDOG (IRQ_VIC_START+0)
31#define IRQ_SOFTINT 2 31#define IRQ_SOFTINT (IRQ_VIC_START+1)
32#define IRQ_CRYPTO 3 32#define IRQ_CRYPTO (IRQ_VIC_START+2)
33#define IRQ_OWM 4 33#define IRQ_OWM (IRQ_VIC_START+3)
34#define IRQ_MTU0 5 34#define IRQ_MTU0 (IRQ_VIC_START+4)
35#define IRQ_MTU1 6 35#define IRQ_MTU1 (IRQ_VIC_START+5)
36#define IRQ_GPIO0 7 36#define IRQ_GPIO0 (IRQ_VIC_START+6)
37#define IRQ_GPIO1 8 37#define IRQ_GPIO1 (IRQ_VIC_START+7)
38#define IRQ_GPIO2 9 38#define IRQ_GPIO2 (IRQ_VIC_START+8)
39#define IRQ_GPIO3 10 39#define IRQ_GPIO3 (IRQ_VIC_START+9)
40#define IRQ_RTC_RTT 11 40#define IRQ_RTC_RTT (IRQ_VIC_START+10)
41#define IRQ_SSP 12 41#define IRQ_SSP (IRQ_VIC_START+11)
42#define IRQ_UART0 13 42#define IRQ_UART0 (IRQ_VIC_START+12)
43#define IRQ_DMA1 14 43#define IRQ_DMA1 (IRQ_VIC_START+13)
44#define IRQ_CLCD_MDIF 15 44#define IRQ_CLCD_MDIF (IRQ_VIC_START+14)
45#define IRQ_DMA0 16 45#define IRQ_DMA0 (IRQ_VIC_START+15)
46#define IRQ_PWRFAIL 17 46#define IRQ_PWRFAIL (IRQ_VIC_START+16)
47#define IRQ_UART1 18 47#define IRQ_UART1 (IRQ_VIC_START+17)
48#define IRQ_FIRDA 19 48#define IRQ_FIRDA (IRQ_VIC_START+18)
49#define IRQ_MSP0 20 49#define IRQ_MSP0 (IRQ_VIC_START+19)
50#define IRQ_I2C0 21 50#define IRQ_I2C0 (IRQ_VIC_START+20)
51#define IRQ_I2C1 22 51#define IRQ_I2C1 (IRQ_VIC_START+21)
52#define IRQ_SDMMC 23 52#define IRQ_SDMMC (IRQ_VIC_START+22)
53#define IRQ_USBOTG 24 53#define IRQ_USBOTG (IRQ_VIC_START+23)
54#define IRQ_SVA_IT0 25 54#define IRQ_SVA_IT0 (IRQ_VIC_START+24)
55#define IRQ_SVA_IT1 26 55#define IRQ_SVA_IT1 (IRQ_VIC_START+25)
56#define IRQ_SAA_IT0 27 56#define IRQ_SAA_IT0 (IRQ_VIC_START+26)
57#define IRQ_SAA_IT1 28 57#define IRQ_SAA_IT1 (IRQ_VIC_START+27)
58#define IRQ_UART2 29 58#define IRQ_UART2 (IRQ_VIC_START+28)
59#define IRQ_MSP2 30 59#define IRQ_MSP2 (IRQ_VIC_START+29)
60#define IRQ_L2CC 49 60#define IRQ_L2CC (IRQ_VIC_START+30)
61#define IRQ_HPI 50 61#define IRQ_HPI (IRQ_VIC_START+31)
62#define IRQ_SKE 51 62#define IRQ_SKE (IRQ_VIC_START+32)
63#define IRQ_KP 52 63#define IRQ_KP (IRQ_VIC_START+33)
64#define IRQ_MEMST 55 64#define IRQ_MEMST (IRQ_VIC_START+34)
65#define IRQ_SGA_IT 59 65#define IRQ_SGA_IT (IRQ_VIC_START+35)
66#define IRQ_USBM 61 66#define IRQ_USBM (IRQ_VIC_START+36)
67#define IRQ_MSP1 63 67#define IRQ_MSP1 (IRQ_VIC_START+37)
68 68
69#define NOMADIK_GPIO_OFFSET (IRQ_VIC_START+64) 69#define NOMADIK_GPIO_OFFSET (IRQ_VIC_START+64)
70 70
diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index f0e69cbc5baa..222d58c0ae76 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -4,7 +4,7 @@
4 4
5# Common support 5# Common support
6obj-y := io.o id.o sram-init.o sram.o time.o irq.o mux.o flash.o \ 6obj-y := io.o id.o sram-init.o sram.o time.o irq.o mux.o flash.o \
7 serial.o devices.o dma.o 7 serial.o devices.o dma.o fb.o
8obj-y += clock.o clock_data.o opp_data.o reset.o pm_bus.o timer.o 8obj-y += clock.o clock_data.o opp_data.o reset.o pm_bus.o timer.o
9 9
10ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),) 10ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),)
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index a8fce3ccc707..2e98a3ac7c5e 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -160,7 +160,7 @@ static struct omap_lcd_config ams_delta_lcd_config __initdata = {
160 .ctrl_name = "internal", 160 .ctrl_name = "internal",
161}; 161};
162 162
163static struct omap_usb_config ams_delta_usb_config = { 163static struct omap_usb_config ams_delta_usb_config __initdata = {
164 .register_host = 1, 164 .register_host = 1,
165 .hmc_mode = 16, 165 .hmc_mode = 16,
166 .pins[0] = 2, 166 .pins[0] = 2,
diff --git a/arch/arm/mach-omap1/fb.c b/arch/arm/mach-omap1/fb.c
new file mode 100644
index 000000000000..c770d45c7226
--- /dev/null
+++ b/arch/arm/mach-omap1/fb.c
@@ -0,0 +1,80 @@
1/*
2 * File: arch/arm/plat-omap/fb.c
3 *
4 * Framebuffer device registration for TI OMAP platforms
5 *
6 * Copyright (C) 2006 Nokia Corporation
7 * Author: Imre Deak <imre.deak@nokia.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */
23
24#include <linux/module.h>
25#include <linux/kernel.h>
26#include <linux/mm.h>
27#include <linux/init.h>
28#include <linux/platform_device.h>
29#include <linux/memblock.h>
30#include <linux/io.h>
31#include <linux/omapfb.h>
32#include <linux/dma-mapping.h>
33
34#include <asm/mach/map.h>
35
36#if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE)
37
38static bool omapfb_lcd_configured;
39static struct omapfb_platform_data omapfb_config;
40
41static u64 omap_fb_dma_mask = ~(u32)0;
42
43static struct platform_device omap_fb_device = {
44 .name = "omapfb",
45 .id = -1,
46 .dev = {
47 .dma_mask = &omap_fb_dma_mask,
48 .coherent_dma_mask = DMA_BIT_MASK(32),
49 .platform_data = &omapfb_config,
50 },
51 .num_resources = 0,
52};
53
54void __init omapfb_set_lcd_config(const struct omap_lcd_config *config)
55{
56 omapfb_config.lcd = *config;
57 omapfb_lcd_configured = true;
58}
59
60static int __init omap_init_fb(void)
61{
62 /*
63 * If the board file has not set the lcd config with
64 * omapfb_set_lcd_config(), don't bother registering the omapfb device
65 */
66 if (!omapfb_lcd_configured)
67 return 0;
68
69 return platform_device_register(&omap_fb_device);
70}
71
72arch_initcall(omap_init_fb);
73
74#else
75
76void __init omapfb_set_lcd_config(const struct omap_lcd_config *config)
77{
78}
79
80#endif
diff --git a/arch/arm/mach-omap1/mailbox.c b/arch/arm/mach-omap1/mailbox.c
index e962926b67bc..efc8f207f6fc 100644
--- a/arch/arm/mach-omap1/mailbox.c
+++ b/arch/arm/mach-omap1/mailbox.c
@@ -142,7 +142,7 @@ static struct omap_mbox mbox_dsp_info = {
142 142
143static struct omap_mbox *omap1_mboxes[] = { &mbox_dsp_info, NULL }; 143static struct omap_mbox *omap1_mboxes[] = { &mbox_dsp_info, NULL };
144 144
145static int __devinit omap1_mbox_probe(struct platform_device *pdev) 145static int omap1_mbox_probe(struct platform_device *pdev)
146{ 146{
147 struct resource *mem; 147 struct resource *mem;
148 int ret; 148 int ret;
@@ -165,7 +165,7 @@ static int __devinit omap1_mbox_probe(struct platform_device *pdev)
165 return 0; 165 return 0;
166} 166}
167 167
168static int __devexit omap1_mbox_remove(struct platform_device *pdev) 168static int omap1_mbox_remove(struct platform_device *pdev)
169{ 169{
170 omap_mbox_unregister(); 170 omap_mbox_unregister();
171 iounmap(mbox_base); 171 iounmap(mbox_base);
@@ -174,7 +174,7 @@ static int __devexit omap1_mbox_remove(struct platform_device *pdev)
174 174
175static struct platform_driver omap1_mbox_driver = { 175static struct platform_driver omap1_mbox_driver = {
176 .probe = omap1_mbox_probe, 176 .probe = omap1_mbox_probe,
177 .remove = __devexit_p(omap1_mbox_remove), 177 .remove = omap1_mbox_remove,
178 .driver = { 178 .driver = {
179 .name = "omap-mailbox", 179 .name = "omap-mailbox",
180 }, 180 },
diff --git a/arch/arm/mach-omap1/usb.c b/arch/arm/mach-omap1/usb.c
index 104fed366b8f..1a1db5971cd9 100644
--- a/arch/arm/mach-omap1/usb.c
+++ b/arch/arm/mach-omap1/usb.c
@@ -629,8 +629,14 @@ static void __init omap_1510_usb_init(struct omap_usb_config *config)
629static inline void omap_1510_usb_init(struct omap_usb_config *config) {} 629static inline void omap_1510_usb_init(struct omap_usb_config *config) {}
630#endif 630#endif
631 631
632void __init omap1_usb_init(struct omap_usb_config *pdata) 632void __init omap1_usb_init(struct omap_usb_config *_pdata)
633{ 633{
634 struct omap_usb_config *pdata;
635
636 pdata = kmemdup(_pdata, sizeof(*pdata), GFP_KERNEL);
637 if (!pdata)
638 return;
639
634 pdata->usb0_init = omap1_usb0_init; 640 pdata->usb0_init = omap1_usb0_init;
635 pdata->usb1_init = omap1_usb1_init; 641 pdata->usb1_init = omap1_usb1_init;
636 pdata->usb2_init = omap1_usb2_init; 642 pdata->usb2_init = omap1_usb2_init;
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index a8004f33b7e2..947cafe65aef 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5# Common support 5# Common support
6obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer.o pm.o \ 6obj-y := id.o io.o control.o mux.o devices.o fb.o serial.o gpmc.o timer.o pm.o \
7 common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o \ 7 common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o \
8 omap_device.o sram.o 8 omap_device.o sram.o
9 9
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index 5c8e9cee2c2e..769c1feee1c4 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -397,6 +397,12 @@ static struct omap_board_mux board_mux[] __initdata = {
397 OMAP_PULL_ENA), 397 OMAP_PULL_ENA),
398 OMAP4_MUX(ABE_MCBSP1_FSX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), 398 OMAP4_MUX(ABE_MCBSP1_FSX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
399 399
400 /* UART2 - BT/FM/GPS shared transport */
401 OMAP4_MUX(UART2_CTS, OMAP_PIN_INPUT | OMAP_MUX_MODE0),
402 OMAP4_MUX(UART2_RTS, OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
403 OMAP4_MUX(UART2_RX, OMAP_PIN_INPUT | OMAP_MUX_MODE0),
404 OMAP4_MUX(UART2_TX, OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
405
400 { .reg_offset = OMAP_MUX_TERMINATOR }, 406 { .reg_offset = OMAP_MUX_TERMINATOR },
401}; 407};
402 408
diff --git a/arch/arm/mach-omap2/cclock2420_data.c b/arch/arm/mach-omap2/cclock2420_data.c
index 7e5febe456d9..ab7e952d2070 100644
--- a/arch/arm/mach-omap2/cclock2420_data.c
+++ b/arch/arm/mach-omap2/cclock2420_data.c
@@ -1935,6 +1935,8 @@ int __init omap2420_clk_init(void)
1935 omap2_init_clk_hw_omap_clocks(c->lk.clk); 1935 omap2_init_clk_hw_omap_clocks(c->lk.clk);
1936 } 1936 }
1937 1937
1938 omap2xxx_clkt_vps_late_init();
1939
1938 omap2_clk_disable_autoidle_all(); 1940 omap2_clk_disable_autoidle_all();
1939 1941
1940 omap2_clk_enable_init_clocks(enable_init_clks, 1942 omap2_clk_enable_init_clocks(enable_init_clks,
diff --git a/arch/arm/mach-omap2/cclock2430_data.c b/arch/arm/mach-omap2/cclock2430_data.c
index eda079b96c6a..eb3dab68d536 100644
--- a/arch/arm/mach-omap2/cclock2430_data.c
+++ b/arch/arm/mach-omap2/cclock2430_data.c
@@ -2050,6 +2050,8 @@ int __init omap2430_clk_init(void)
2050 omap2_init_clk_hw_omap_clocks(c->lk.clk); 2050 omap2_init_clk_hw_omap_clocks(c->lk.clk);
2051 } 2051 }
2052 2052
2053 omap2xxx_clkt_vps_late_init();
2054
2053 omap2_clk_disable_autoidle_all(); 2055 omap2_clk_disable_autoidle_all();
2054 2056
2055 omap2_clk_enable_init_clocks(enable_init_clks, 2057 omap2_clk_enable_init_clocks(enable_init_clks,
diff --git a/arch/arm/mach-omap2/cclock3xxx_data.c b/arch/arm/mach-omap2/cclock3xxx_data.c
index bdf39481fbd6..6ef87580c33f 100644
--- a/arch/arm/mach-omap2/cclock3xxx_data.c
+++ b/arch/arm/mach-omap2/cclock3xxx_data.c
@@ -1167,6 +1167,8 @@ static const struct clk_ops emu_src_ck_ops = {
1167 .recalc_rate = &omap2_clksel_recalc, 1167 .recalc_rate = &omap2_clksel_recalc,
1168 .get_parent = &omap2_clksel_find_parent_index, 1168 .get_parent = &omap2_clksel_find_parent_index,
1169 .set_parent = &omap2_clksel_set_parent, 1169 .set_parent = &omap2_clksel_set_parent,
1170 .enable = &omap2_clkops_enable_clkdm,
1171 .disable = &omap2_clkops_disable_clkdm,
1170}; 1172};
1171 1173
1172static struct clk emu_src_ck; 1174static struct clk emu_src_ck;
diff --git a/arch/arm/mach-omap2/cclock44xx_data.c b/arch/arm/mach-omap2/cclock44xx_data.c
index 5789a5e25563..a2cc046b47f4 100644
--- a/arch/arm/mach-omap2/cclock44xx_data.c
+++ b/arch/arm/mach-omap2/cclock44xx_data.c
@@ -2026,14 +2026,13 @@ int __init omap4xxx_clk_init(void)
2026 * On OMAP4460 the ABE DPLL fails to turn on if in idle low-power 2026 * On OMAP4460 the ABE DPLL fails to turn on if in idle low-power
2027 * state when turning the ABE clock domain. Workaround this by 2027 * state when turning the ABE clock domain. Workaround this by
2028 * locking the ABE DPLL on boot. 2028 * locking the ABE DPLL on boot.
2029 * Lock the ABE DPLL in any case to avoid issues with audio.
2029 */ 2030 */
2030 if (cpu_is_omap446x()) { 2031 rc = clk_set_parent(&abe_dpll_refclk_mux_ck, &sys_32k_ck);
2031 rc = clk_set_parent(&abe_dpll_refclk_mux_ck, &sys_32k_ck); 2032 if (!rc)
2032 if (!rc) 2033 rc = clk_set_rate(&dpll_abe_ck, OMAP4_DPLL_ABE_DEFFREQ);
2033 rc = clk_set_rate(&dpll_abe_ck, OMAP4_DPLL_ABE_DEFFREQ); 2034 if (rc)
2034 if (rc) 2035 pr_err("%s: failed to configure ABE DPLL!\n", __func__);
2035 pr_err("%s: failed to configure ABE DPLL!\n", __func__);
2036 }
2037 2036
2038 return 0; 2037 return 0;
2039} 2038}
diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index 3d944d3263d2..e6c328128a0a 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -234,7 +234,7 @@
234#define OMAP343X_PADCONF_ETK_D14 OMAP343X_PADCONF_ETK(16) 234#define OMAP343X_PADCONF_ETK_D14 OMAP343X_PADCONF_ETK(16)
235#define OMAP343X_PADCONF_ETK_D15 OMAP343X_PADCONF_ETK(17) 235#define OMAP343X_PADCONF_ETK_D15 OMAP343X_PADCONF_ETK(17)
236 236
237/* 34xx GENERAL_WKUP regist offsets */ 237/* 34xx GENERAL_WKUP register offsets */
238#define OMAP343X_CONTROL_WKUP_DEBOBSMUX(i) (OMAP343X_CONTROL_GENERAL_WKUP + \ 238#define OMAP343X_CONTROL_WKUP_DEBOBSMUX(i) (OMAP343X_CONTROL_GENERAL_WKUP + \
239 0x008 + (i)) 239 0x008 + (i))
240#define OMAP343X_CONTROL_WKUP_DEBOBS0 (OMAP343X_CONTROL_GENERAL_WKUP + 0x008) 240#define OMAP343X_CONTROL_WKUP_DEBOBS0 (OMAP343X_CONTROL_GENERAL_WKUP + 0x008)
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 5e304d0719a2..626f3ea3142f 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -639,7 +639,7 @@ static int count_ocp2scp_devices(struct omap_ocp2scp_dev *ocp2scp_dev)
639 return cnt; 639 return cnt;
640} 640}
641 641
642static void omap_init_ocp2scp(void) 642static void __init omap_init_ocp2scp(void)
643{ 643{
644 struct omap_hwmod *oh; 644 struct omap_hwmod *oh;
645 struct platform_device *pdev; 645 struct platform_device *pdev;
diff --git a/arch/arm/mach-omap2/dpll3xxx.c b/arch/arm/mach-omap2/dpll3xxx.c
index 2bb18838cba9..0a02aab5df67 100644
--- a/arch/arm/mach-omap2/dpll3xxx.c
+++ b/arch/arm/mach-omap2/dpll3xxx.c
@@ -504,8 +504,7 @@ int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate,
504 if (!cpu_is_omap44xx() && !cpu_is_omap3630()) { 504 if (!cpu_is_omap44xx() && !cpu_is_omap3630()) {
505 freqsel = _omap3_dpll_compute_freqsel(clk, 505 freqsel = _omap3_dpll_compute_freqsel(clk,
506 dd->last_rounded_n); 506 dd->last_rounded_n);
507 if (!freqsel) 507 WARN_ON(!freqsel);
508 WARN_ON(1);
509 } 508 }
510 509
511 pr_debug("%s: %s: set rate: locking rate to %lu.\n", 510 pr_debug("%s: %s: set rate: locking rate to %lu.\n",
diff --git a/arch/arm/mach-omap2/drm.c b/arch/arm/mach-omap2/drm.c
index fce5aa3fff49..2a2cfa88ddbf 100644
--- a/arch/arm/mach-omap2/drm.c
+++ b/arch/arm/mach-omap2/drm.c
@@ -25,9 +25,9 @@
25#include <linux/dma-mapping.h> 25#include <linux/dma-mapping.h>
26#include <linux/platform_data/omap_drm.h> 26#include <linux/platform_data/omap_drm.h>
27 27
28#include "soc.h"
28#include "omap_device.h" 29#include "omap_device.h"
29#include "omap_hwmod.h" 30#include "omap_hwmod.h"
30#include <plat/cpu.h>
31 31
32#if defined(CONFIG_DRM_OMAP) || (CONFIG_DRM_OMAP_MODULE) 32#if defined(CONFIG_DRM_OMAP) || (CONFIG_DRM_OMAP_MODULE)
33 33
@@ -57,7 +57,7 @@ static int __init omap_init_drm(void)
57 oh->name); 57 oh->name);
58 } 58 }
59 59
60 platform_data.omaprev = GET_OMAP_REVISION(); 60 platform_data.omaprev = GET_OMAP_TYPE;
61 61
62 return platform_device_register(&omap_drm_device); 62 return platform_device_register(&omap_drm_device);
63 63
diff --git a/arch/arm/mach-omap2/dss-common.c b/arch/arm/mach-omap2/dss-common.c
index 679a0478644f..4be5cfc81ab8 100644
--- a/arch/arm/mach-omap2/dss-common.c
+++ b/arch/arm/mach-omap2/dss-common.c
@@ -31,8 +31,7 @@
31#include <video/omap-panel-nokia-dsi.h> 31#include <video/omap-panel-nokia-dsi.h>
32#include <video/omap-panel-picodlp.h> 32#include <video/omap-panel-picodlp.h>
33 33
34#include <plat/cpu.h> 34#include "soc.h"
35
36#include "dss-common.h" 35#include "dss-common.h"
37#include "mux.h" 36#include "mux.h"
38 37
diff --git a/arch/arm/plat-omap/fb.c b/arch/arm/mach-omap2/fb.c
index a3367b783fc7..d9bd965f6d07 100644
--- a/arch/arm/plat-omap/fb.c
+++ b/arch/arm/mach-omap2/fb.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * File: arch/arm/plat-omap/fb.c
3 *
4 * Framebuffer device registration for TI OMAP platforms 2 * Framebuffer device registration for TI OMAP platforms
5 * 3 *
6 * Copyright (C) 2006 Nokia Corporation 4 * Copyright (C) 2006 Nokia Corporation
@@ -33,7 +31,7 @@
33 31
34#include <asm/mach/map.h> 32#include <asm/mach/map.h>
35 33
36#include <plat/cpu.h> 34#include "soc.h"
37 35
38#ifdef CONFIG_OMAP2_VRFB 36#ifdef CONFIG_OMAP2_VRFB
39 37
@@ -94,45 +92,7 @@ static int __init omap_init_vrfb(void)
94arch_initcall(omap_init_vrfb); 92arch_initcall(omap_init_vrfb);
95#endif 93#endif
96 94
97#if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE) 95#if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
98
99static bool omapfb_lcd_configured;
100static struct omapfb_platform_data omapfb_config;
101
102static u64 omap_fb_dma_mask = ~(u32)0;
103
104static struct platform_device omap_fb_device = {
105 .name = "omapfb",
106 .id = -1,
107 .dev = {
108 .dma_mask = &omap_fb_dma_mask,
109 .coherent_dma_mask = DMA_BIT_MASK(32),
110 .platform_data = &omapfb_config,
111 },
112 .num_resources = 0,
113};
114
115void __init omapfb_set_lcd_config(const struct omap_lcd_config *config)
116{
117 omapfb_config.lcd = *config;
118 omapfb_lcd_configured = true;
119}
120
121static int __init omap_init_fb(void)
122{
123 /*
124 * If the board file has not set the lcd config with
125 * omapfb_set_lcd_config(), don't bother registering the omapfb device
126 */
127 if (!omapfb_lcd_configured)
128 return 0;
129
130 return platform_device_register(&omap_fb_device);
131}
132
133arch_initcall(omap_init_fb);
134
135#elif defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
136 96
137static u64 omap_fb_dma_mask = ~(u32)0; 97static u64 omap_fb_dma_mask = ~(u32)0;
138static struct omapfb_platform_data omapfb_config; 98static struct omapfb_platform_data omapfb_config;
@@ -155,10 +115,4 @@ static int __init omap_init_fb(void)
155 115
156arch_initcall(omap_init_fb); 116arch_initcall(omap_init_fb);
157 117
158#else
159
160void __init omapfb_set_lcd_config(const struct omap_lcd_config *config)
161{
162}
163
164#endif 118#endif
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 65468f6d7f0e..8033cb747c86 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -744,7 +744,7 @@ static int gpmc_setup_irq(void)
744 return request_irq(gpmc_irq, gpmc_handle_irq, 0, "gpmc", NULL); 744 return request_irq(gpmc_irq, gpmc_handle_irq, 0, "gpmc", NULL);
745} 745}
746 746
747static __devexit int gpmc_free_irq(void) 747static int gpmc_free_irq(void)
748{ 748{
749 int i; 749 int i;
750 750
@@ -762,7 +762,7 @@ static __devexit int gpmc_free_irq(void)
762 return 0; 762 return 0;
763} 763}
764 764
765static void __devexit gpmc_mem_exit(void) 765static void gpmc_mem_exit(void)
766{ 766{
767 int cs; 767 int cs;
768 768
@@ -774,7 +774,7 @@ static void __devexit gpmc_mem_exit(void)
774 774
775} 775}
776 776
777static int __devinit gpmc_mem_init(void) 777static int gpmc_mem_init(void)
778{ 778{
779 int cs, rc; 779 int cs, rc;
780 unsigned long boot_rom_space = 0; 780 unsigned long boot_rom_space = 0;
@@ -1121,7 +1121,7 @@ int gpmc_calc_timings(struct gpmc_timings *gpmc_t,
1121 return 0; 1121 return 0;
1122} 1122}
1123 1123
1124static __devinit int gpmc_probe(struct platform_device *pdev) 1124static int gpmc_probe(struct platform_device *pdev)
1125{ 1125{
1126 int rc; 1126 int rc;
1127 u32 l; 1127 u32 l;
@@ -1177,7 +1177,7 @@ static __devinit int gpmc_probe(struct platform_device *pdev)
1177 return 0; 1177 return 0;
1178} 1178}
1179 1179
1180static __devexit int gpmc_remove(struct platform_device *pdev) 1180static int gpmc_remove(struct platform_device *pdev)
1181{ 1181{
1182 gpmc_free_irq(); 1182 gpmc_free_irq();
1183 gpmc_mem_exit(); 1183 gpmc_mem_exit();
@@ -1187,7 +1187,7 @@ static __devexit int gpmc_remove(struct platform_device *pdev)
1187 1187
1188static struct platform_driver gpmc_driver = { 1188static struct platform_driver gpmc_driver = {
1189 .probe = gpmc_probe, 1189 .probe = gpmc_probe,
1190 .remove = __devexit_p(gpmc_remove), 1190 .remove = gpmc_remove,
1191 .driver = { 1191 .driver = {
1192 .name = DEVICE_NAME, 1192 .name = DEVICE_NAME,
1193 .owner = THIS_MODULE, 1193 .owner = THIS_MODULE,
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 0d974565f8ca..0b080267b7f6 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -342,7 +342,7 @@ struct omap_mbox mbox_2_info = {
342struct omap_mbox *omap4_mboxes[] = { &mbox_1_info, &mbox_2_info, NULL }; 342struct omap_mbox *omap4_mboxes[] = { &mbox_1_info, &mbox_2_info, NULL };
343#endif 343#endif
344 344
345static int __devinit omap2_mbox_probe(struct platform_device *pdev) 345static int omap2_mbox_probe(struct platform_device *pdev)
346{ 346{
347 struct resource *mem; 347 struct resource *mem;
348 int ret; 348 int ret;
@@ -395,7 +395,7 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
395 return 0; 395 return 0;
396} 396}
397 397
398static int __devexit omap2_mbox_remove(struct platform_device *pdev) 398static int omap2_mbox_remove(struct platform_device *pdev)
399{ 399{
400 omap_mbox_unregister(); 400 omap_mbox_unregister();
401 iounmap(mbox_base); 401 iounmap(mbox_base);
@@ -404,7 +404,7 @@ static int __devexit omap2_mbox_remove(struct platform_device *pdev)
404 404
405static struct platform_driver omap2_mbox_driver = { 405static struct platform_driver omap2_mbox_driver = {
406 .probe = omap2_mbox_probe, 406 .probe = omap2_mbox_probe,
407 .remove = __devexit_p(omap2_mbox_remove), 407 .remove = omap2_mbox_remove,
408 .driver = { 408 .driver = {
409 .name = "omap-mailbox", 409 .name = "omap-mailbox",
410 }, 410 },
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
index 081c71edddf4..646c14d9fdb9 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
@@ -2070,7 +2070,7 @@ static struct omap_hwmod_irq_info am33xx_usbss_mpu_irqs[] = {
2070 { .name = "usbss-irq", .irq = 17 + OMAP_INTC_START, }, 2070 { .name = "usbss-irq", .irq = 17 + OMAP_INTC_START, },
2071 { .name = "musb0-irq", .irq = 18 + OMAP_INTC_START, }, 2071 { .name = "musb0-irq", .irq = 18 + OMAP_INTC_START, },
2072 { .name = "musb1-irq", .irq = 19 + OMAP_INTC_START, }, 2072 { .name = "musb1-irq", .irq = 19 + OMAP_INTC_START, },
2073 { .irq = -1 + OMAP_INTC_START, }, 2073 { .irq = -1, },
2074}; 2074};
2075 2075
2076static struct omap_hwmod am33xx_usbss_hwmod = { 2076static struct omap_hwmod am33xx_usbss_hwmod = {
@@ -2515,7 +2515,7 @@ static struct omap_hwmod_ocp_if am33xx_l4_hs__cpgmac0 = {
2515 .user = OCP_USER_MPU, 2515 .user = OCP_USER_MPU,
2516}; 2516};
2517 2517
2518struct omap_hwmod_addr_space am33xx_mdio_addr_space[] = { 2518static struct omap_hwmod_addr_space am33xx_mdio_addr_space[] = {
2519 { 2519 {
2520 .pa_start = 0x4A101000, 2520 .pa_start = 0x4A101000,
2521 .pa_end = 0x4A101000 + SZ_256 - 1, 2521 .pa_end = 0x4A101000 + SZ_256 - 1,
@@ -2523,7 +2523,7 @@ struct omap_hwmod_addr_space am33xx_mdio_addr_space[] = {
2523 { } 2523 { }
2524}; 2524};
2525 2525
2526struct omap_hwmod_ocp_if am33xx_cpgmac0__mdio = { 2526static struct omap_hwmod_ocp_if am33xx_cpgmac0__mdio = {
2527 .master = &am33xx_cpgmac0_hwmod, 2527 .master = &am33xx_cpgmac0_hwmod,
2528 .slave = &am33xx_mdio_hwmod, 2528 .slave = &am33xx_mdio_hwmod,
2529 .addr = am33xx_mdio_addr_space, 2529 .addr = am33xx_mdio_addr_space,
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index f9fab942d5ba..793f54ac7d14 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -26,7 +26,6 @@
26 26
27#include <linux/omap-dma.h> 27#include <linux/omap-dma.h>
28 28
29#include <linux/platform_data/omap_ocp2scp.h>
30#include <linux/platform_data/spi-omap2-mcspi.h> 29#include <linux/platform_data/spi-omap2-mcspi.h>
31#include <linux/platform_data/asoc-ti-mcbsp.h> 30#include <linux/platform_data/asoc-ti-mcbsp.h>
32#include <linux/platform_data/iommu-omap.h> 31#include <linux/platform_data/iommu-omap.h>
@@ -2133,8 +2132,12 @@ static struct omap_hwmod omap44xx_mcpdm_hwmod = {
2133 * currently reset very early during boot, before I2C is 2132 * currently reset very early during boot, before I2C is
2134 * available, so it doesn't seem that we have any choice in 2133 * available, so it doesn't seem that we have any choice in
2135 * the kernel other than to avoid resetting it. 2134 * the kernel other than to avoid resetting it.
2135 *
2136 * Also, McPDM needs to be configured to NO_IDLE mode when it
2137 * is in used otherwise vital clocks will be gated which
2138 * results 'slow motion' audio playback.
2136 */ 2139 */
2137 .flags = HWMOD_EXT_OPT_MAIN_CLK, 2140 .flags = HWMOD_EXT_OPT_MAIN_CLK | HWMOD_SWSUP_SIDLE,
2138 .mpu_irqs = omap44xx_mcpdm_irqs, 2141 .mpu_irqs = omap44xx_mcpdm_irqs,
2139 .sdma_reqs = omap44xx_mcpdm_sdma_reqs, 2142 .sdma_reqs = omap44xx_mcpdm_sdma_reqs,
2140 .main_clk = "mcpdm_fck", 2143 .main_clk = "mcpdm_fck",
diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c
index fefd40166624..615e5b1fb025 100644
--- a/arch/arm/mach-omap2/omap_twl.c
+++ b/arch/arm/mach-omap2/omap_twl.c
@@ -292,8 +292,8 @@ int __init omap3_twl_set_sr_bit(bool enable)
292 if (twl_sr_enable_autoinit) 292 if (twl_sr_enable_autoinit)
293 pr_warning("%s: unexpected multiple calls\n", __func__); 293 pr_warning("%s: unexpected multiple calls\n", __func__);
294 294
295 ret = twl_i2c_read_u8(TWL4030_MODULE_PM_RECEIVER, &temp, 295 ret = twl_i2c_read_u8(TWL_MODULE_PM_RECEIVER, &temp,
296 TWL4030_DCDC_GLOBAL_CFG); 296 TWL4030_DCDC_GLOBAL_CFG);
297 if (ret) 297 if (ret)
298 goto err; 298 goto err;
299 299
@@ -302,8 +302,8 @@ int __init omap3_twl_set_sr_bit(bool enable)
302 else 302 else
303 temp &= ~SMARTREFLEX_ENABLE; 303 temp &= ~SMARTREFLEX_ENABLE;
304 304
305 ret = twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, temp, 305 ret = twl_i2c_write_u8(TWL_MODULE_PM_RECEIVER, temp,
306 TWL4030_DCDC_GLOBAL_CFG); 306 TWL4030_DCDC_GLOBAL_CFG);
307 if (!ret) { 307 if (!ret) {
308 twl_sr_enable_autoinit = true; 308 twl_sr_enable_autoinit = true;
309 return 0; 309 return 0;
diff --git a/arch/arm/mach-omap2/pmu.c b/arch/arm/mach-omap2/pmu.c
index 250d909e38bd..eb78ae7a3464 100644
--- a/arch/arm/mach-omap2/pmu.c
+++ b/arch/arm/mach-omap2/pmu.c
@@ -11,8 +11,6 @@
11 * the Free Software Foundation; either version 2 of the License, or 11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version. 12 * (at your option) any later version.
13 */ 13 */
14#include <linux/pm_runtime.h>
15
16#include <asm/pmu.h> 14#include <asm/pmu.h>
17 15
18#include "soc.h" 16#include "soc.h"
diff --git a/arch/arm/mach-omap2/prm2xxx.c b/arch/arm/mach-omap2/prm2xxx.c
index faeab18696df..418de9c3b319 100644
--- a/arch/arm/mach-omap2/prm2xxx.c
+++ b/arch/arm/mach-omap2/prm2xxx.c
@@ -18,9 +18,8 @@
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
20 20
21#include "soc.h"
21#include "common.h" 22#include "common.h"
22#include <plat/cpu.h>
23
24#include "vp.h" 23#include "vp.h"
25#include "powerdomain.h" 24#include "powerdomain.h"
26#include "clockdomain.h" 25#include "clockdomain.h"
@@ -29,6 +28,14 @@
29#include "prm-regbits-24xx.h" 28#include "prm-regbits-24xx.h"
30 29
31/* 30/*
31 * OMAP24xx PM_PWSTCTRL_*.POWERSTATE and PM_PWSTST_*.LASTSTATEENTERED bits -
32 * these are reversed from the bits used on OMAP3+
33 */
34#define OMAP24XX_PWRDM_POWER_ON 0x0
35#define OMAP24XX_PWRDM_POWER_RET 0x1
36#define OMAP24XX_PWRDM_POWER_OFF 0x3
37
38/*
32 * omap2xxx_prm_reset_src_map - map from bits in the PRM_RSTST_WKUP 39 * omap2xxx_prm_reset_src_map - map from bits in the PRM_RSTST_WKUP
33 * hardware register (which are specific to the OMAP2xxx SoCs) to 40 * hardware register (which are specific to the OMAP2xxx SoCs) to
34 * reset source ID bit shifts (which is an OMAP SoC-independent 41 * reset source ID bit shifts (which is an OMAP SoC-independent
@@ -69,6 +76,34 @@ static u32 omap2xxx_prm_read_reset_sources(void)
69} 76}
70 77
71/** 78/**
79 * omap2xxx_pwrst_to_common_pwrst - convert OMAP2xxx pwrst to common pwrst
80 * @omap2xxx_pwrst: OMAP2xxx hardware power state to convert
81 *
82 * Return the common power state bits corresponding to the OMAP2xxx
83 * hardware power state bits @omap2xxx_pwrst, or -EINVAL upon error.
84 */
85static int omap2xxx_pwrst_to_common_pwrst(u8 omap2xxx_pwrst)
86{
87 u8 pwrst;
88
89 switch (omap2xxx_pwrst) {
90 case OMAP24XX_PWRDM_POWER_OFF:
91 pwrst = PWRDM_POWER_OFF;
92 break;
93 case OMAP24XX_PWRDM_POWER_RET:
94 pwrst = PWRDM_POWER_RET;
95 break;
96 case OMAP24XX_PWRDM_POWER_ON:
97 pwrst = PWRDM_POWER_ON;
98 break;
99 default:
100 return -EINVAL;
101 }
102
103 return pwrst;
104}
105
106/**
72 * omap2xxx_prm_dpll_reset - use DPLL reset to reboot the OMAP SoC 107 * omap2xxx_prm_dpll_reset - use DPLL reset to reboot the OMAP SoC
73 * 108 *
74 * Set the DPLL reset bit, which should reboot the SoC. This is the 109 * Set the DPLL reset bit, which should reboot the SoC. This is the
@@ -98,10 +133,56 @@ int omap2xxx_clkdm_wakeup(struct clockdomain *clkdm)
98 return 0; 133 return 0;
99} 134}
100 135
136static int omap2xxx_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
137{
138 u8 omap24xx_pwrst;
139
140 switch (pwrst) {
141 case PWRDM_POWER_OFF:
142 omap24xx_pwrst = OMAP24XX_PWRDM_POWER_OFF;
143 break;
144 case PWRDM_POWER_RET:
145 omap24xx_pwrst = OMAP24XX_PWRDM_POWER_RET;
146 break;
147 case PWRDM_POWER_ON:
148 omap24xx_pwrst = OMAP24XX_PWRDM_POWER_ON;
149 break;
150 default:
151 return -EINVAL;
152 }
153
154 omap2_prm_rmw_mod_reg_bits(OMAP_POWERSTATE_MASK,
155 (omap24xx_pwrst << OMAP_POWERSTATE_SHIFT),
156 pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL);
157 return 0;
158}
159
160static int omap2xxx_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
161{
162 u8 omap2xxx_pwrst;
163
164 omap2xxx_pwrst = omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
165 OMAP2_PM_PWSTCTRL,
166 OMAP_POWERSTATE_MASK);
167
168 return omap2xxx_pwrst_to_common_pwrst(omap2xxx_pwrst);
169}
170
171static int omap2xxx_pwrdm_read_pwrst(struct powerdomain *pwrdm)
172{
173 u8 omap2xxx_pwrst;
174
175 omap2xxx_pwrst = omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
176 OMAP2_PM_PWSTST,
177 OMAP_POWERSTATEST_MASK);
178
179 return omap2xxx_pwrst_to_common_pwrst(omap2xxx_pwrst);
180}
181
101struct pwrdm_ops omap2_pwrdm_operations = { 182struct pwrdm_ops omap2_pwrdm_operations = {
102 .pwrdm_set_next_pwrst = omap2_pwrdm_set_next_pwrst, 183 .pwrdm_set_next_pwrst = omap2xxx_pwrdm_set_next_pwrst,
103 .pwrdm_read_next_pwrst = omap2_pwrdm_read_next_pwrst, 184 .pwrdm_read_next_pwrst = omap2xxx_pwrdm_read_next_pwrst,
104 .pwrdm_read_pwrst = omap2_pwrdm_read_pwrst, 185 .pwrdm_read_pwrst = omap2xxx_pwrdm_read_pwrst,
105 .pwrdm_set_logic_retst = omap2_pwrdm_set_logic_retst, 186 .pwrdm_set_logic_retst = omap2_pwrdm_set_logic_retst,
106 .pwrdm_set_mem_onst = omap2_pwrdm_set_mem_onst, 187 .pwrdm_set_mem_onst = omap2_pwrdm_set_mem_onst,
107 .pwrdm_set_mem_retst = omap2_pwrdm_set_mem_retst, 188 .pwrdm_set_mem_retst = omap2_pwrdm_set_mem_retst,
diff --git a/arch/arm/mach-omap2/prm2xxx_3xxx.c b/arch/arm/mach-omap2/prm2xxx_3xxx.c
index 30517f5af707..a3e121f94a86 100644
--- a/arch/arm/mach-omap2/prm2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/prm2xxx_3xxx.c
@@ -103,28 +103,6 @@ int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift)
103/* Powerdomain low-level functions */ 103/* Powerdomain low-level functions */
104 104
105/* Common functions across OMAP2 and OMAP3 */ 105/* Common functions across OMAP2 and OMAP3 */
106int omap2_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
107{
108 omap2_prm_rmw_mod_reg_bits(OMAP_POWERSTATE_MASK,
109 (pwrst << OMAP_POWERSTATE_SHIFT),
110 pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL);
111 return 0;
112}
113
114int omap2_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
115{
116 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
117 OMAP2_PM_PWSTCTRL,
118 OMAP_POWERSTATE_MASK);
119}
120
121int omap2_pwrdm_read_pwrst(struct powerdomain *pwrdm)
122{
123 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
124 OMAP2_PM_PWSTST,
125 OMAP_POWERSTATEST_MASK);
126}
127
128int omap2_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank, 106int omap2_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
129 u8 pwrst) 107 u8 pwrst)
130{ 108{
diff --git a/arch/arm/mach-omap2/prm3xxx.c b/arch/arm/mach-omap2/prm3xxx.c
index db198d058584..e648bd55b072 100644
--- a/arch/arm/mach-omap2/prm3xxx.c
+++ b/arch/arm/mach-omap2/prm3xxx.c
@@ -18,9 +18,8 @@
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
20 20
21#include "soc.h"
21#include "common.h" 22#include "common.h"
22#include <plat/cpu.h>
23
24#include "vp.h" 23#include "vp.h"
25#include "powerdomain.h" 24#include "powerdomain.h"
26#include "prm3xxx.h" 25#include "prm3xxx.h"
@@ -278,6 +277,28 @@ static u32 omap3xxx_prm_read_reset_sources(void)
278 277
279/* Powerdomain low-level functions */ 278/* Powerdomain low-level functions */
280 279
280static int omap3_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
281{
282 omap2_prm_rmw_mod_reg_bits(OMAP_POWERSTATE_MASK,
283 (pwrst << OMAP_POWERSTATE_SHIFT),
284 pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL);
285 return 0;
286}
287
288static int omap3_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
289{
290 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
291 OMAP2_PM_PWSTCTRL,
292 OMAP_POWERSTATE_MASK);
293}
294
295static int omap3_pwrdm_read_pwrst(struct powerdomain *pwrdm)
296{
297 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
298 OMAP2_PM_PWSTST,
299 OMAP_POWERSTATEST_MASK);
300}
301
281/* Applicable only for OMAP3. Not supported on OMAP2 */ 302/* Applicable only for OMAP3. Not supported on OMAP2 */
282static int omap3_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm) 303static int omap3_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
283{ 304{
@@ -356,9 +377,9 @@ static int omap3_pwrdm_disable_hdwr_sar(struct powerdomain *pwrdm)
356} 377}
357 378
358struct pwrdm_ops omap3_pwrdm_operations = { 379struct pwrdm_ops omap3_pwrdm_operations = {
359 .pwrdm_set_next_pwrst = omap2_pwrdm_set_next_pwrst, 380 .pwrdm_set_next_pwrst = omap3_pwrdm_set_next_pwrst,
360 .pwrdm_read_next_pwrst = omap2_pwrdm_read_next_pwrst, 381 .pwrdm_read_next_pwrst = omap3_pwrdm_read_next_pwrst,
361 .pwrdm_read_pwrst = omap2_pwrdm_read_pwrst, 382 .pwrdm_read_pwrst = omap3_pwrdm_read_pwrst,
362 .pwrdm_read_prev_pwrst = omap3_pwrdm_read_prev_pwrst, 383 .pwrdm_read_prev_pwrst = omap3_pwrdm_read_prev_pwrst,
363 .pwrdm_set_logic_retst = omap2_pwrdm_set_logic_retst, 384 .pwrdm_set_logic_retst = omap2_pwrdm_set_logic_retst,
364 .pwrdm_read_logic_pwrst = omap3_pwrdm_read_logic_pwrst, 385 .pwrdm_read_logic_pwrst = omap3_pwrdm_read_logic_pwrst,
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
index 7498bc77fe8b..c05a343d465d 100644
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -56,9 +56,9 @@ static struct omap_prcm_irq_setup omap4_prcm_irq_setup = {
56 * enumeration) 56 * enumeration)
57 */ 57 */
58static struct prm_reset_src_map omap44xx_prm_reset_src_map[] = { 58static struct prm_reset_src_map omap44xx_prm_reset_src_map[] = {
59 { OMAP4430_RST_GLOBAL_WARM_SW_SHIFT, 59 { OMAP4430_GLOBAL_WARM_SW_RST_SHIFT,
60 OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT }, 60 OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT },
61 { OMAP4430_RST_GLOBAL_COLD_SW_SHIFT, 61 { OMAP4430_GLOBAL_COLD_RST_SHIFT,
62 OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT }, 62 OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT },
63 { OMAP4430_MPU_SECURITY_VIOL_RST_SHIFT, 63 { OMAP4430_MPU_SECURITY_VIOL_RST_SHIFT,
64 OMAP_SECU_VIOL_RST_SRC_ID_SHIFT }, 64 OMAP_SECU_VIOL_RST_SRC_ID_SHIFT },
@@ -333,7 +333,7 @@ static u32 omap44xx_prm_read_reset_sources(void)
333 u32 r = 0; 333 u32 r = 0;
334 u32 v; 334 u32 v;
335 335
336 v = omap4_prm_read_inst_reg(OMAP4430_PRM_OCP_SOCKET_INST, 336 v = omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST,
337 OMAP4_RM_RSTST); 337 OMAP4_RM_RSTST);
338 338
339 p = omap44xx_prm_reset_src_map; 339 p = omap44xx_prm_reset_src_map;
diff --git a/arch/arm/mach-omap2/prm44xx.h b/arch/arm/mach-omap2/prm44xx.h
index 22b0979206ca..8ee1fbdec561 100644
--- a/arch/arm/mach-omap2/prm44xx.h
+++ b/arch/arm/mach-omap2/prm44xx.h
@@ -62,8 +62,8 @@
62 62
63/* OMAP4 specific register offsets */ 63/* OMAP4 specific register offsets */
64#define OMAP4_RM_RSTCTRL 0x0000 64#define OMAP4_RM_RSTCTRL 0x0000
65#define OMAP4_RM_RSTTIME 0x0004 65#define OMAP4_RM_RSTST 0x0004
66#define OMAP4_RM_RSTST 0x0008 66#define OMAP4_RM_RSTTIME 0x0008
67#define OMAP4_PM_PWSTCTRL 0x0000 67#define OMAP4_PM_PWSTCTRL 0x0000
68#define OMAP4_PM_PWSTST 0x0004 68#define OMAP4_PM_PWSTST 0x0004
69 69
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 691aa674665a..b8ad6e632bb8 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -165,15 +165,11 @@ static struct device_node * __init omap_get_timer_dt(struct of_device_id *match,
165 struct device_node *np; 165 struct device_node *np;
166 166
167 for_each_matching_node(np, match) { 167 for_each_matching_node(np, match) {
168 if (!of_device_is_available(np)) { 168 if (!of_device_is_available(np))
169 of_node_put(np);
170 continue; 169 continue;
171 }
172 170
173 if (property && !of_get_property(np, property, NULL)) { 171 if (property && !of_get_property(np, property, NULL))
174 of_node_put(np);
175 continue; 172 continue;
176 }
177 173
178 of_add_property(np, &device_disabled); 174 of_add_property(np, &device_disabled);
179 return np; 175 return np;
diff --git a/arch/arm/mach-orion5x/pci.c b/arch/arm/mach-orion5x/pci.c
index cd50e328db2a..d9c7c3bf0d9c 100644
--- a/arch/arm/mach-orion5x/pci.c
+++ b/arch/arm/mach-orion5x/pci.c
@@ -506,7 +506,7 @@ static int __init pci_setup(struct pci_sys_data *sys)
506/***************************************************************************** 506/*****************************************************************************
507 * General PCIe + PCI 507 * General PCIe + PCI
508 ****************************************************************************/ 508 ****************************************************************************/
509static void __devinit rc_pci_fixup(struct pci_dev *dev) 509static void rc_pci_fixup(struct pci_dev *dev)
510{ 510{
511 /* 511 /*
512 * Prevent enumeration of root complex. 512 * Prevent enumeration of root complex.
diff --git a/arch/arm/mach-prima2/pm.c b/arch/arm/mach-prima2/pm.c
index fb5a7910af35..9936c180bf01 100644
--- a/arch/arm/mach-prima2/pm.c
+++ b/arch/arm/mach-prima2/pm.c
@@ -123,7 +123,7 @@ static const struct of_device_id memc_ids[] = {
123 {} 123 {}
124}; 124};
125 125
126static int __devinit sirfsoc_memc_probe(struct platform_device *op) 126static int sirfsoc_memc_probe(struct platform_device *op)
127{ 127{
128 struct device_node *np = op->dev.of_node; 128 struct device_node *np = op->dev.of_node;
129 129
diff --git a/arch/arm/mach-prima2/rtciobrg.c b/arch/arm/mach-prima2/rtciobrg.c
index 9d80f1e20a98..557353602130 100644
--- a/arch/arm/mach-prima2/rtciobrg.c
+++ b/arch/arm/mach-prima2/rtciobrg.c
@@ -107,7 +107,7 @@ static const struct of_device_id rtciobrg_ids[] = {
107 {} 107 {}
108}; 108};
109 109
110static int __devinit sirfsoc_rtciobrg_probe(struct platform_device *op) 110static int sirfsoc_rtciobrg_probe(struct platform_device *op)
111{ 111{
112 struct device_node *np = op->dev.of_node; 112 struct device_node *np = op->dev.of_node;
113 113
diff --git a/arch/arm/mach-pxa/corgi_pm.c b/arch/arm/mach-pxa/corgi_pm.c
index 048c4299473c..7a39efc50865 100644
--- a/arch/arm/mach-pxa/corgi_pm.c
+++ b/arch/arm/mach-pxa/corgi_pm.c
@@ -198,7 +198,7 @@ static struct sharpsl_charger_machinfo corgi_pm_machinfo = {
198 198
199static struct platform_device *corgipm_device; 199static struct platform_device *corgipm_device;
200 200
201static int __devinit corgipm_init(void) 201static int corgipm_init(void)
202{ 202{
203 int ret; 203 int ret;
204 204
diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h b/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h
index a611ad3153c7..b6132aa95dc0 100644
--- a/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h
+++ b/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h
@@ -463,6 +463,9 @@
463 GPIO76_LCD_PCLK, \ 463 GPIO76_LCD_PCLK, \
464 GPIO77_LCD_BIAS 464 GPIO77_LCD_BIAS
465 465
466/* these enable a work-around for a hw bug in pxa27x during ac97 warm reset */
467#define GPIO113_AC97_nRESET_GPIO_HIGH MFP_CFG_OUT(GPIO113, AF0, DEFAULT)
468#define GPIO95_AC97_nRESET_GPIO_HIGH MFP_CFG_OUT(GPIO95, AF0, DEFAULT)
466 469
467extern int keypad_set_wake(unsigned int on); 470extern int keypad_set_wake(unsigned int on);
468#endif /* __ASM_ARCH_MFP_PXA27X_H */ 471#endif /* __ASM_ARCH_MFP_PXA27X_H */
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 8047ee0effc5..616cb87b6179 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -47,9 +47,9 @@ void pxa27x_clear_otgph(void)
47EXPORT_SYMBOL(pxa27x_clear_otgph); 47EXPORT_SYMBOL(pxa27x_clear_otgph);
48 48
49static unsigned long ac97_reset_config[] = { 49static unsigned long ac97_reset_config[] = {
50 GPIO113_GPIO, 50 GPIO113_AC97_nRESET_GPIO_HIGH,
51 GPIO113_AC97_nRESET, 51 GPIO113_AC97_nRESET,
52 GPIO95_GPIO, 52 GPIO95_AC97_nRESET_GPIO_HIGH,
53 GPIO95_AC97_nRESET, 53 GPIO95_AC97_nRESET,
54}; 54};
55 55
diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c
index ec55c575ed19..0a36d3585f26 100644
--- a/arch/arm/mach-pxa/sharpsl_pm.c
+++ b/arch/arm/mach-pxa/sharpsl_pm.c
@@ -829,7 +829,7 @@ static const struct platform_suspend_ops sharpsl_pm_ops = {
829}; 829};
830#endif 830#endif
831 831
832static int __devinit sharpsl_pm_probe(struct platform_device *pdev) 832static int sharpsl_pm_probe(struct platform_device *pdev)
833{ 833{
834 int ret, irq; 834 int ret, irq;
835 835
@@ -941,7 +941,7 @@ static struct platform_driver sharpsl_pm_driver = {
941 }, 941 },
942}; 942};
943 943
944static int __devinit sharpsl_pm_init(void) 944static int sharpsl_pm_init(void)
945{ 945{
946 return platform_driver_register(&sharpsl_pm_driver); 946 return platform_driver_register(&sharpsl_pm_driver);
947} 947}
diff --git a/arch/arm/mach-pxa/spitz_pm.c b/arch/arm/mach-pxa/spitz_pm.c
index 842596d4d31e..e191f9996b26 100644
--- a/arch/arm/mach-pxa/spitz_pm.c
+++ b/arch/arm/mach-pxa/spitz_pm.c
@@ -232,7 +232,7 @@ struct sharpsl_charger_machinfo spitz_pm_machinfo = {
232 232
233static struct platform_device *spitzpm_device; 233static struct platform_device *spitzpm_device;
234 234
235static int __devinit spitzpm_init(void) 235static int spitzpm_init(void)
236{ 236{
237 int ret; 237 int ret;
238 238
diff --git a/arch/arm/mach-pxa/tosa-bt.c b/arch/arm/mach-pxa/tosa-bt.c
index b9b1e5c2b290..fc3646c2c694 100644
--- a/arch/arm/mach-pxa/tosa-bt.c
+++ b/arch/arm/mach-pxa/tosa-bt.c
@@ -102,7 +102,7 @@ err_reset:
102 return rc; 102 return rc;
103} 103}
104 104
105static int __devexit tosa_bt_remove(struct platform_device *dev) 105static int tosa_bt_remove(struct platform_device *dev)
106{ 106{
107 struct tosa_bt_data *data = dev->dev.platform_data; 107 struct tosa_bt_data *data = dev->dev.platform_data;
108 struct rfkill *rfk = platform_get_drvdata(dev); 108 struct rfkill *rfk = platform_get_drvdata(dev);
@@ -125,7 +125,7 @@ static int __devexit tosa_bt_remove(struct platform_device *dev)
125 125
126static struct platform_driver tosa_bt_driver = { 126static struct platform_driver tosa_bt_driver = {
127 .probe = tosa_bt_probe, 127 .probe = tosa_bt_probe,
128 .remove = __devexit_p(tosa_bt_remove), 128 .remove = tosa_bt_remove,
129 129
130 .driver = { 130 .driver = {
131 .name = "tosa-bt", 131 .name = "tosa-bt",
diff --git a/arch/arm/mach-s3c24xx/h1940-bluetooth.c b/arch/arm/mach-s3c24xx/h1940-bluetooth.c
index 57aee916bdb1..3f40c61b6e02 100644
--- a/arch/arm/mach-s3c24xx/h1940-bluetooth.c
+++ b/arch/arm/mach-s3c24xx/h1940-bluetooth.c
@@ -62,7 +62,7 @@ static const struct rfkill_ops h1940bt_rfkill_ops = {
62 .set_block = h1940bt_set_block, 62 .set_block = h1940bt_set_block,
63}; 63};
64 64
65static int __devinit h1940bt_probe(struct platform_device *pdev) 65static int h1940bt_probe(struct platform_device *pdev)
66{ 66{
67 struct rfkill *rfk; 67 struct rfkill *rfk;
68 int ret = 0; 68 int ret = 0;
diff --git a/arch/arm/mach-s3c24xx/mach-osiris-dvs.c b/arch/arm/mach-s3c24xx/mach-osiris-dvs.c
index 5876c6ba7500..45e74363aaa9 100644
--- a/arch/arm/mach-s3c24xx/mach-osiris-dvs.c
+++ b/arch/arm/mach-s3c24xx/mach-osiris-dvs.c
@@ -93,7 +93,7 @@ static struct notifier_block osiris_dvs_nb = {
93 .notifier_call = osiris_dvs_notify, 93 .notifier_call = osiris_dvs_notify,
94}; 94};
95 95
96static int __devinit osiris_dvs_probe(struct platform_device *pdev) 96static int osiris_dvs_probe(struct platform_device *pdev)
97{ 97{
98 int ret; 98 int ret;
99 99
@@ -126,7 +126,7 @@ err_nogpio:
126 return ret; 126 return ret;
127} 127}
128 128
129static int __devexit osiris_dvs_remove(struct platform_device *pdev) 129static int osiris_dvs_remove(struct platform_device *pdev)
130{ 130{
131 dev_info(&pdev->dev, "exiting\n"); 131 dev_info(&pdev->dev, "exiting\n");
132 132
@@ -167,7 +167,7 @@ static const struct dev_pm_ops osiris_dvs_pm = {
167 167
168static struct platform_driver osiris_dvs_driver = { 168static struct platform_driver osiris_dvs_driver = {
169 .probe = osiris_dvs_probe, 169 .probe = osiris_dvs_probe,
170 .remove = __devexit_p(osiris_dvs_remove), 170 .remove = osiris_dvs_remove,
171 .driver = { 171 .driver = {
172 .name = "osiris-dvs", 172 .name = "osiris-dvs",
173 .owner = THIS_MODULE, 173 .owner = THIS_MODULE,
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410-module.c b/arch/arm/mach-s3c64xx/mach-crag6410-module.c
index c6d8dba90623..755c0bb119f4 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410-module.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410-module.c
@@ -47,7 +47,7 @@ static struct spi_board_info wm1253_devs[] = {
47 .bus_num = 0, 47 .bus_num = 0,
48 .chip_select = 0, 48 .chip_select = 0,
49 .mode = SPI_MODE_0, 49 .mode = SPI_MODE_0,
50 .irq = S3C_EINT(5), 50 .irq = S3C_EINT(4),
51 .controller_data = &wm0010_spi_csinfo, 51 .controller_data = &wm0010_spi_csinfo,
52 .platform_data = &wm0010_pdata, 52 .platform_data = &wm0010_pdata,
53 }, 53 },
@@ -290,7 +290,7 @@ static const struct i2c_board_info wm2200_i2c[] = {
290 .platform_data = &wm2200_pdata, }, 290 .platform_data = &wm2200_pdata, },
291}; 291};
292 292
293static __devinitdata const struct { 293static const struct {
294 u8 id; 294 u8 id;
295 u8 rev; 295 u8 rev;
296 const char *name; 296 const char *name;
@@ -343,8 +343,8 @@ static __devinitdata const struct {
343 .i2c_devs = wm2200_i2c, .num_i2c_devs = ARRAY_SIZE(wm2200_i2c) }, 343 .i2c_devs = wm2200_i2c, .num_i2c_devs = ARRAY_SIZE(wm2200_i2c) },
344}; 344};
345 345
346static __devinit int wlf_gf_module_probe(struct i2c_client *i2c, 346static int wlf_gf_module_probe(struct i2c_client *i2c,
347 const struct i2c_device_id *i2c_id) 347 const struct i2c_device_id *i2c_id)
348{ 348{
349 int ret, i, j, id, rev; 349 int ret, i, j, id, rev;
350 350
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
index cdde249166b5..bf6311a28f3d 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -171,7 +171,7 @@ static struct fb_videomode crag6410_lcd_timing = {
171}; 171};
172 172
173/* 405566 clocks per frame => 60Hz refresh requires 24333960Hz clock */ 173/* 405566 clocks per frame => 60Hz refresh requires 24333960Hz clock */
174static struct s3c_fb_platdata crag6410_lcd_pdata __devinitdata = { 174static struct s3c_fb_platdata crag6410_lcd_pdata = {
175 .setup_gpio = s3c64xx_fb_gpio_setup_24bpp, 175 .setup_gpio = s3c64xx_fb_gpio_setup_24bpp,
176 .vtiming = &crag6410_lcd_timing, 176 .vtiming = &crag6410_lcd_timing,
177 .win[0] = &crag6410_fb_win0, 177 .win[0] = &crag6410_fb_win0,
@@ -181,7 +181,7 @@ static struct s3c_fb_platdata crag6410_lcd_pdata __devinitdata = {
181 181
182/* 2x6 keypad */ 182/* 2x6 keypad */
183 183
184static uint32_t crag6410_keymap[] __devinitdata = { 184static uint32_t crag6410_keymap[] = {
185 /* KEY(row, col, keycode) */ 185 /* KEY(row, col, keycode) */
186 KEY(0, 0, KEY_VOLUMEUP), 186 KEY(0, 0, KEY_VOLUMEUP),
187 KEY(0, 1, KEY_HOME), 187 KEY(0, 1, KEY_HOME),
@@ -197,12 +197,12 @@ static uint32_t crag6410_keymap[] __devinitdata = {
197 KEY(1, 5, KEY_CAMERA), 197 KEY(1, 5, KEY_CAMERA),
198}; 198};
199 199
200static struct matrix_keymap_data crag6410_keymap_data __devinitdata = { 200static struct matrix_keymap_data crag6410_keymap_data = {
201 .keymap = crag6410_keymap, 201 .keymap = crag6410_keymap,
202 .keymap_size = ARRAY_SIZE(crag6410_keymap), 202 .keymap_size = ARRAY_SIZE(crag6410_keymap),
203}; 203};
204 204
205static struct samsung_keypad_platdata crag6410_keypad_data __devinitdata = { 205static struct samsung_keypad_platdata crag6410_keypad_data = {
206 .keymap_data = &crag6410_keymap_data, 206 .keymap_data = &crag6410_keymap_data,
207 .rows = 2, 207 .rows = 2,
208 .cols = 6, 208 .cols = 6,
@@ -407,11 +407,11 @@ static struct wm831x_buckv_pdata vddarm_pdata = {
407 .dvs_gpio = S3C64XX_GPK(0), 407 .dvs_gpio = S3C64XX_GPK(0),
408}; 408};
409 409
410static struct regulator_consumer_supply vddarm_consumers[] __devinitdata = { 410static struct regulator_consumer_supply vddarm_consumers[] = {
411 REGULATOR_SUPPLY("vddarm", NULL), 411 REGULATOR_SUPPLY("vddarm", NULL),
412}; 412};
413 413
414static struct regulator_init_data vddarm __devinitdata = { 414static struct regulator_init_data vddarm = {
415 .constraints = { 415 .constraints = {
416 .name = "VDDARM", 416 .name = "VDDARM",
417 .min_uV = 1000000, 417 .min_uV = 1000000,
@@ -425,11 +425,11 @@ static struct regulator_init_data vddarm __devinitdata = {
425 .driver_data = &vddarm_pdata, 425 .driver_data = &vddarm_pdata,
426}; 426};
427 427
428static struct regulator_consumer_supply vddint_consumers[] __devinitdata = { 428static struct regulator_consumer_supply vddint_consumers[] = {
429 REGULATOR_SUPPLY("vddint", NULL), 429 REGULATOR_SUPPLY("vddint", NULL),
430}; 430};
431 431
432static struct regulator_init_data vddint __devinitdata = { 432static struct regulator_init_data vddint = {
433 .constraints = { 433 .constraints = {
434 .name = "VDDINT", 434 .name = "VDDINT",
435 .min_uV = 1000000, 435 .min_uV = 1000000,
@@ -442,27 +442,27 @@ static struct regulator_init_data vddint __devinitdata = {
442 .supply_regulator = "WALLVDD", 442 .supply_regulator = "WALLVDD",
443}; 443};
444 444
445static struct regulator_init_data vddmem __devinitdata = { 445static struct regulator_init_data vddmem = {
446 .constraints = { 446 .constraints = {
447 .name = "VDDMEM", 447 .name = "VDDMEM",
448 .always_on = 1, 448 .always_on = 1,
449 }, 449 },
450}; 450};
451 451
452static struct regulator_init_data vddsys __devinitdata = { 452static struct regulator_init_data vddsys = {
453 .constraints = { 453 .constraints = {
454 .name = "VDDSYS,VDDEXT,VDDPCM,VDDSS", 454 .name = "VDDSYS,VDDEXT,VDDPCM,VDDSS",
455 .always_on = 1, 455 .always_on = 1,
456 }, 456 },
457}; 457};
458 458
459static struct regulator_consumer_supply vddmmc_consumers[] __devinitdata = { 459static struct regulator_consumer_supply vddmmc_consumers[] = {
460 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"), 460 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
461 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.1"), 461 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.1"),
462 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.2"), 462 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.2"),
463}; 463};
464 464
465static struct regulator_init_data vddmmc __devinitdata = { 465static struct regulator_init_data vddmmc = {
466 .constraints = { 466 .constraints = {
467 .name = "VDDMMC,UH", 467 .name = "VDDMMC,UH",
468 .always_on = 1, 468 .always_on = 1,
@@ -472,7 +472,7 @@ static struct regulator_init_data vddmmc __devinitdata = {
472 .supply_regulator = "WALLVDD", 472 .supply_regulator = "WALLVDD",
473}; 473};
474 474
475static struct regulator_init_data vddotgi __devinitdata = { 475static struct regulator_init_data vddotgi = {
476 .constraints = { 476 .constraints = {
477 .name = "VDDOTGi", 477 .name = "VDDOTGi",
478 .always_on = 1, 478 .always_on = 1,
@@ -480,7 +480,7 @@ static struct regulator_init_data vddotgi __devinitdata = {
480 .supply_regulator = "WALLVDD", 480 .supply_regulator = "WALLVDD",
481}; 481};
482 482
483static struct regulator_init_data vddotg __devinitdata = { 483static struct regulator_init_data vddotg = {
484 .constraints = { 484 .constraints = {
485 .name = "VDDOTG", 485 .name = "VDDOTG",
486 .always_on = 1, 486 .always_on = 1,
@@ -488,7 +488,7 @@ static struct regulator_init_data vddotg __devinitdata = {
488 .supply_regulator = "WALLVDD", 488 .supply_regulator = "WALLVDD",
489}; 489};
490 490
491static struct regulator_init_data vddhi __devinitdata = { 491static struct regulator_init_data vddhi = {
492 .constraints = { 492 .constraints = {
493 .name = "VDDHI", 493 .name = "VDDHI",
494 .always_on = 1, 494 .always_on = 1,
@@ -496,7 +496,7 @@ static struct regulator_init_data vddhi __devinitdata = {
496 .supply_regulator = "WALLVDD", 496 .supply_regulator = "WALLVDD",
497}; 497};
498 498
499static struct regulator_init_data vddadc __devinitdata = { 499static struct regulator_init_data vddadc = {
500 .constraints = { 500 .constraints = {
501 .name = "VDDADC,VDDDAC", 501 .name = "VDDADC,VDDDAC",
502 .always_on = 1, 502 .always_on = 1,
@@ -504,7 +504,7 @@ static struct regulator_init_data vddadc __devinitdata = {
504 .supply_regulator = "WALLVDD", 504 .supply_regulator = "WALLVDD",
505}; 505};
506 506
507static struct regulator_init_data vddmem0 __devinitdata = { 507static struct regulator_init_data vddmem0 = {
508 .constraints = { 508 .constraints = {
509 .name = "VDDMEM0", 509 .name = "VDDMEM0",
510 .always_on = 1, 510 .always_on = 1,
@@ -512,7 +512,7 @@ static struct regulator_init_data vddmem0 __devinitdata = {
512 .supply_regulator = "WALLVDD", 512 .supply_regulator = "WALLVDD",
513}; 513};
514 514
515static struct regulator_init_data vddpll __devinitdata = { 515static struct regulator_init_data vddpll = {
516 .constraints = { 516 .constraints = {
517 .name = "VDDPLL", 517 .name = "VDDPLL",
518 .always_on = 1, 518 .always_on = 1,
@@ -520,7 +520,7 @@ static struct regulator_init_data vddpll __devinitdata = {
520 .supply_regulator = "WALLVDD", 520 .supply_regulator = "WALLVDD",
521}; 521};
522 522
523static struct regulator_init_data vddlcd __devinitdata = { 523static struct regulator_init_data vddlcd = {
524 .constraints = { 524 .constraints = {
525 .name = "VDDLCD", 525 .name = "VDDLCD",
526 .always_on = 1, 526 .always_on = 1,
@@ -528,7 +528,7 @@ static struct regulator_init_data vddlcd __devinitdata = {
528 .supply_regulator = "WALLVDD", 528 .supply_regulator = "WALLVDD",
529}; 529};
530 530
531static struct regulator_init_data vddalive __devinitdata = { 531static struct regulator_init_data vddalive = {
532 .constraints = { 532 .constraints = {
533 .name = "VDDALIVE", 533 .name = "VDDALIVE",
534 .always_on = 1, 534 .always_on = 1,
@@ -536,28 +536,28 @@ static struct regulator_init_data vddalive __devinitdata = {
536 .supply_regulator = "WALLVDD", 536 .supply_regulator = "WALLVDD",
537}; 537};
538 538
539static struct wm831x_backup_pdata banff_backup_pdata __devinitdata = { 539static struct wm831x_backup_pdata banff_backup_pdata = {
540 .charger_enable = 1, 540 .charger_enable = 1,
541 .vlim = 2500, /* mV */ 541 .vlim = 2500, /* mV */
542 .ilim = 200, /* uA */ 542 .ilim = 200, /* uA */
543}; 543};
544 544
545static struct wm831x_status_pdata banff_red_led __devinitdata = { 545static struct wm831x_status_pdata banff_red_led = {
546 .name = "banff:red:", 546 .name = "banff:red:",
547 .default_src = WM831X_STATUS_MANUAL, 547 .default_src = WM831X_STATUS_MANUAL,
548}; 548};
549 549
550static struct wm831x_status_pdata banff_green_led __devinitdata = { 550static struct wm831x_status_pdata banff_green_led = {
551 .name = "banff:green:", 551 .name = "banff:green:",
552 .default_src = WM831X_STATUS_MANUAL, 552 .default_src = WM831X_STATUS_MANUAL,
553}; 553};
554 554
555static struct wm831x_touch_pdata touch_pdata __devinitdata = { 555static struct wm831x_touch_pdata touch_pdata = {
556 .data_irq = S3C_EINT(26), 556 .data_irq = S3C_EINT(26),
557 .pd_irq = S3C_EINT(27), 557 .pd_irq = S3C_EINT(27),
558}; 558};
559 559
560static struct wm831x_pdata crag_pmic_pdata __devinitdata = { 560static struct wm831x_pdata crag_pmic_pdata = {
561 .wm831x_num = 1, 561 .wm831x_num = 1,
562 .gpio_base = BANFF_PMIC_GPIO_BASE, 562 .gpio_base = BANFF_PMIC_GPIO_BASE,
563 .soft_shutdown = true, 563 .soft_shutdown = true,
@@ -601,7 +601,7 @@ static struct wm831x_pdata crag_pmic_pdata __devinitdata = {
601 .touch = &touch_pdata, 601 .touch = &touch_pdata,
602}; 602};
603 603
604static struct i2c_board_info i2c_devs0[] __devinitdata = { 604static struct i2c_board_info i2c_devs0[] = {
605 { I2C_BOARD_INFO("24c08", 0x50), }, 605 { I2C_BOARD_INFO("24c08", 0x50), },
606 { I2C_BOARD_INFO("tca6408", 0x20), 606 { I2C_BOARD_INFO("tca6408", 0x20),
607 .platform_data = &crag6410_pca_data, 607 .platform_data = &crag6410_pca_data,
@@ -616,13 +616,13 @@ static struct s3c2410_platform_i2c i2c0_pdata = {
616 .frequency = 400000, 616 .frequency = 400000,
617}; 617};
618 618
619static struct regulator_consumer_supply pvdd_1v2_consumers[] __devinitdata = { 619static struct regulator_consumer_supply pvdd_1v2_consumers[] = {
620 REGULATOR_SUPPLY("DCVDD", "spi0.0"), 620 REGULATOR_SUPPLY("DCVDD", "spi0.0"),
621 REGULATOR_SUPPLY("AVDD", "spi0.0"), 621 REGULATOR_SUPPLY("AVDD", "spi0.0"),
622 REGULATOR_SUPPLY("AVDD", "spi0.1"), 622 REGULATOR_SUPPLY("AVDD", "spi0.1"),
623}; 623};
624 624
625static struct regulator_init_data pvdd_1v2 __devinitdata = { 625static struct regulator_init_data pvdd_1v2 = {
626 .constraints = { 626 .constraints = {
627 .name = "PVDD_1V2", 627 .name = "PVDD_1V2",
628 .valid_ops_mask = REGULATOR_CHANGE_STATUS, 628 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
@@ -632,7 +632,7 @@ static struct regulator_init_data pvdd_1v2 __devinitdata = {
632 .num_consumer_supplies = ARRAY_SIZE(pvdd_1v2_consumers), 632 .num_consumer_supplies = ARRAY_SIZE(pvdd_1v2_consumers),
633}; 633};
634 634
635static struct regulator_consumer_supply pvdd_1v8_consumers[] __devinitdata = { 635static struct regulator_consumer_supply pvdd_1v8_consumers[] = {
636 REGULATOR_SUPPLY("LDOVDD", "1-001a"), 636 REGULATOR_SUPPLY("LDOVDD", "1-001a"),
637 REGULATOR_SUPPLY("PLLVDD", "1-001a"), 637 REGULATOR_SUPPLY("PLLVDD", "1-001a"),
638 REGULATOR_SUPPLY("DBVDD", "1-001a"), 638 REGULATOR_SUPPLY("DBVDD", "1-001a"),
@@ -664,7 +664,7 @@ static struct regulator_consumer_supply pvdd_1v8_consumers[] __devinitdata = {
664 REGULATOR_SUPPLY("CPVDD", "wm5110-codec"), 664 REGULATOR_SUPPLY("CPVDD", "wm5110-codec"),
665}; 665};
666 666
667static struct regulator_init_data pvdd_1v8 __devinitdata = { 667static struct regulator_init_data pvdd_1v8 = {
668 .constraints = { 668 .constraints = {
669 .name = "PVDD_1V8", 669 .name = "PVDD_1V8",
670 .always_on = 1, 670 .always_on = 1,
@@ -674,12 +674,12 @@ static struct regulator_init_data pvdd_1v8 __devinitdata = {
674 .num_consumer_supplies = ARRAY_SIZE(pvdd_1v8_consumers), 674 .num_consumer_supplies = ARRAY_SIZE(pvdd_1v8_consumers),
675}; 675};
676 676
677static struct regulator_consumer_supply pvdd_3v3_consumers[] __devinitdata = { 677static struct regulator_consumer_supply pvdd_3v3_consumers[] = {
678 REGULATOR_SUPPLY("MICVDD", "1-001a"), 678 REGULATOR_SUPPLY("MICVDD", "1-001a"),
679 REGULATOR_SUPPLY("AVDD1", "1-001a"), 679 REGULATOR_SUPPLY("AVDD1", "1-001a"),
680}; 680};
681 681
682static struct regulator_init_data pvdd_3v3 __devinitdata = { 682static struct regulator_init_data pvdd_3v3 = {
683 .constraints = { 683 .constraints = {
684 .name = "PVDD_3V3", 684 .name = "PVDD_3V3",
685 .always_on = 1, 685 .always_on = 1,
@@ -689,7 +689,7 @@ static struct regulator_init_data pvdd_3v3 __devinitdata = {
689 .num_consumer_supplies = ARRAY_SIZE(pvdd_3v3_consumers), 689 .num_consumer_supplies = ARRAY_SIZE(pvdd_3v3_consumers),
690}; 690};
691 691
692static struct wm831x_pdata glenfarclas_pmic_pdata __devinitdata = { 692static struct wm831x_pdata glenfarclas_pmic_pdata = {
693 .wm831x_num = 2, 693 .wm831x_num = 2,
694 .irq_base = GLENFARCLAS_PMIC_IRQ_BASE, 694 .irq_base = GLENFARCLAS_PMIC_IRQ_BASE,
695 .gpio_base = GLENFARCLAS_PMIC_GPIO_BASE, 695 .gpio_base = GLENFARCLAS_PMIC_GPIO_BASE,
@@ -721,7 +721,7 @@ static struct wm1250_ev1_pdata wm1250_ev1_pdata = {
721 }, 721 },
722}; 722};
723 723
724static struct i2c_board_info i2c_devs1[] __devinitdata = { 724static struct i2c_board_info i2c_devs1[] = {
725 { I2C_BOARD_INFO("wm8311", 0x34), 725 { I2C_BOARD_INFO("wm8311", 0x34),
726 .irq = S3C_EINT(0), 726 .irq = S3C_EINT(0),
727 .platform_data = &glenfarclas_pmic_pdata }, 727 .platform_data = &glenfarclas_pmic_pdata },
diff --git a/arch/arm/mach-s3c64xx/pm.c b/arch/arm/mach-s3c64xx/pm.c
index 7feb426fc202..d2e1a16690bd 100644
--- a/arch/arm/mach-s3c64xx/pm.c
+++ b/arch/arm/mach-s3c64xx/pm.c
@@ -338,8 +338,10 @@ int __init s3c64xx_pm_init(void)
338 for (i = 0; i < ARRAY_SIZE(s3c64xx_pm_domains); i++) 338 for (i = 0; i < ARRAY_SIZE(s3c64xx_pm_domains); i++)
339 pm_genpd_init(&s3c64xx_pm_domains[i]->pd, NULL, false); 339 pm_genpd_init(&s3c64xx_pm_domains[i]->pd, NULL, false);
340 340
341#ifdef CONFIG_S3C_DEV_FB
341 if (dev_get_platdata(&s3c_device_fb.dev)) 342 if (dev_get_platdata(&s3c_device_fb.dev))
342 pm_genpd_add_device(&s3c64xx_pm_f.pd, &s3c_device_fb.dev); 343 pm_genpd_add_device(&s3c64xx_pm_f.pd, &s3c_device_fb.dev);
344#endif
343 345
344 return 0; 346 return 0;
345} 347}
diff --git a/arch/arm/mach-sa1100/jornada720_ssp.c b/arch/arm/mach-sa1100/jornada720_ssp.c
index 7f07f08d8968..b143c4659346 100644
--- a/arch/arm/mach-sa1100/jornada720_ssp.c
+++ b/arch/arm/mach-sa1100/jornada720_ssp.c
@@ -130,7 +130,7 @@ void jornada_ssp_end(void)
130}; 130};
131EXPORT_SYMBOL(jornada_ssp_end); 131EXPORT_SYMBOL(jornada_ssp_end);
132 132
133static int __devinit jornada_ssp_probe(struct platform_device *dev) 133static int jornada_ssp_probe(struct platform_device *dev)
134{ 134{
135 int ret; 135 int ret;
136 136
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index 88be0474f3d7..400f80332046 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -154,7 +154,7 @@ static u_int neponset_get_mctrl(struct uart_port *port)
154 return ret; 154 return ret;
155} 155}
156 156
157static struct sa1100_port_fns neponset_port_fns __devinitdata = { 157static struct sa1100_port_fns neponset_port_fns = {
158 .set_mctrl = neponset_set_mctrl, 158 .set_mctrl = neponset_set_mctrl,
159 .get_mctrl = neponset_get_mctrl, 159 .get_mctrl = neponset_get_mctrl,
160}; 160};
@@ -233,7 +233,7 @@ static struct sa1111_platform_data sa1111_info = {
233 .disable_devs = SA1111_DEVID_PS2_MSE, 233 .disable_devs = SA1111_DEVID_PS2_MSE,
234}; 234};
235 235
236static int __devinit neponset_probe(struct platform_device *dev) 236static int neponset_probe(struct platform_device *dev)
237{ 237{
238 struct neponset_drvdata *d; 238 struct neponset_drvdata *d;
239 struct resource *nep_res, *sa1111_res, *smc91x_res; 239 struct resource *nep_res, *sa1111_res, *smc91x_res;
@@ -368,7 +368,7 @@ static int __devinit neponset_probe(struct platform_device *dev)
368 return ret; 368 return ret;
369} 369}
370 370
371static int __devexit neponset_remove(struct platform_device *dev) 371static int neponset_remove(struct platform_device *dev)
372{ 372{
373 struct neponset_drvdata *d = platform_get_drvdata(dev); 373 struct neponset_drvdata *d = platform_get_drvdata(dev);
374 int irq = platform_get_irq(dev, 0); 374 int irq = platform_get_irq(dev, 0);
@@ -420,7 +420,7 @@ static const struct dev_pm_ops neponset_pm_ops = {
420 420
421static struct platform_driver neponset_device_driver = { 421static struct platform_driver neponset_device_driver = {
422 .probe = neponset_probe, 422 .probe = neponset_probe,
423 .remove = __devexit_p(neponset_remove), 423 .remove = neponset_remove,
424 .driver = { 424 .driver = {
425 .name = "neponset", 425 .name = "neponset",
426 .owner = THIS_MODULE, 426 .owner = THIS_MODULE,
diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
index 9be910f7920b..1dc8a92e5a5f 100644
--- a/arch/arm/mach-sunxi/sunxi.c
+++ b/arch/arm/mach-sunxi/sunxi.c
@@ -80,8 +80,8 @@ static void __init sunxi_dt_init(void)
80} 80}
81 81
82static const char * const sunxi_board_dt_compat[] = { 82static const char * const sunxi_board_dt_compat[] = {
83 "allwinner,sun4i", 83 "allwinner,sun4i-a10",
84 "allwinner,sun5i", 84 "allwinner,sun5i-a13",
85 NULL, 85 NULL,
86}; 86};
87 87
diff --git a/arch/arm/mach-tegra/pcie.c b/arch/arm/mach-tegra/pcie.c
index 53d085871798..bffcd643d7a3 100644
--- a/arch/arm/mach-tegra/pcie.c
+++ b/arch/arm/mach-tegra/pcie.c
@@ -331,7 +331,7 @@ static struct pci_ops tegra_pcie_ops = {
331 .write = tegra_pcie_write_conf, 331 .write = tegra_pcie_write_conf,
332}; 332};
333 333
334static void __devinit tegra_pcie_fixup_bridge(struct pci_dev *dev) 334static void tegra_pcie_fixup_bridge(struct pci_dev *dev)
335{ 335{
336 u16 reg; 336 u16 reg;
337 337
@@ -345,7 +345,7 @@ static void __devinit tegra_pcie_fixup_bridge(struct pci_dev *dev)
345DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, tegra_pcie_fixup_bridge); 345DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, tegra_pcie_fixup_bridge);
346 346
347/* Tegra PCIE root complex wrongly reports device class */ 347/* Tegra PCIE root complex wrongly reports device class */
348static void __devinit tegra_pcie_fixup_class(struct pci_dev *dev) 348static void tegra_pcie_fixup_class(struct pci_dev *dev)
349{ 349{
350 dev->class = PCI_CLASS_BRIDGE_PCI << 8; 350 dev->class = PCI_CLASS_BRIDGE_PCI << 8;
351} 351}
@@ -353,7 +353,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NVIDIA, 0x0bf0, tegra_pcie_fixup_class);
353DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NVIDIA, 0x0bf1, tegra_pcie_fixup_class); 353DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NVIDIA, 0x0bf1, tegra_pcie_fixup_class);
354 354
355/* Tegra PCIE requires relaxed ordering */ 355/* Tegra PCIE requires relaxed ordering */
356static void __devinit tegra_pcie_relax_enable(struct pci_dev *dev) 356static void tegra_pcie_relax_enable(struct pci_dev *dev)
357{ 357{
358 pcie_capability_set_word(dev, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_RELAX_EN); 358 pcie_capability_set_word(dev, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_RELAX_EN);
359} 359}
diff --git a/arch/arm/mach-tegra/tegra2_emc.c b/arch/arm/mach-tegra/tegra2_emc.c
index 837c7b9ea63b..e18aa2f83ebf 100644
--- a/arch/arm/mach-tegra/tegra2_emc.c
+++ b/arch/arm/mach-tegra/tegra2_emc.c
@@ -268,7 +268,7 @@ static struct tegra_emc_pdata *tegra_emc_dt_parse_pdata(
268} 268}
269#endif 269#endif
270 270
271static struct tegra_emc_pdata __devinit *tegra_emc_fill_pdata(struct platform_device *pdev) 271static struct tegra_emc_pdata *tegra_emc_fill_pdata(struct platform_device *pdev)
272{ 272{
273 struct clk *c = clk_get_sys(NULL, "emc"); 273 struct clk *c = clk_get_sys(NULL, "emc");
274 struct tegra_emc_pdata *pdata; 274 struct tegra_emc_pdata *pdata;
@@ -296,7 +296,7 @@ static struct tegra_emc_pdata __devinit *tegra_emc_fill_pdata(struct platform_de
296 return pdata; 296 return pdata;
297} 297}
298 298
299static int __devinit tegra_emc_probe(struct platform_device *pdev) 299static int tegra_emc_probe(struct platform_device *pdev)
300{ 300{
301 struct tegra_emc_pdata *pdata; 301 struct tegra_emc_pdata *pdata;
302 struct resource *res; 302 struct resource *res;
@@ -333,7 +333,7 @@ static int __devinit tegra_emc_probe(struct platform_device *pdev)
333 return 0; 333 return 0;
334} 334}
335 335
336static struct of_device_id tegra_emc_of_match[] __devinitdata = { 336static struct of_device_id tegra_emc_of_match[] = {
337 { .compatible = "nvidia,tegra20-emc", }, 337 { .compatible = "nvidia,tegra20-emc", },
338 { }, 338 { },
339}; 339};
diff --git a/arch/arm/mach-u300/dummyspichip.c b/arch/arm/mach-u300/dummyspichip.c
index 03f793612594..2785cb67b5e8 100644
--- a/arch/arm/mach-u300/dummyspichip.c
+++ b/arch/arm/mach-u300/dummyspichip.c
@@ -222,7 +222,7 @@ static ssize_t dummy_looptest(struct device *dev,
222 222
223static DEVICE_ATTR(looptest, S_IRUGO, dummy_looptest, NULL); 223static DEVICE_ATTR(looptest, S_IRUGO, dummy_looptest, NULL);
224 224
225static int __devinit pl022_dummy_probe(struct spi_device *spi) 225static int pl022_dummy_probe(struct spi_device *spi)
226{ 226{
227 struct dummy *p_dummy; 227 struct dummy *p_dummy;
228 int status; 228 int status;
@@ -251,7 +251,7 @@ out_dev_create_looptest_failed:
251 return status; 251 return status;
252} 252}
253 253
254static int __devexit pl022_dummy_remove(struct spi_device *spi) 254static int pl022_dummy_remove(struct spi_device *spi)
255{ 255{
256 struct dummy *p_dummy = dev_get_drvdata(&spi->dev); 256 struct dummy *p_dummy = dev_get_drvdata(&spi->dev);
257 257
@@ -269,7 +269,7 @@ static struct spi_driver pl022_dummy_driver = {
269 .owner = THIS_MODULE, 269 .owner = THIS_MODULE,
270 }, 270 },
271 .probe = pl022_dummy_probe, 271 .probe = pl022_dummy_probe,
272 .remove = __devexit_p(pl022_dummy_remove), 272 .remove = pl022_dummy_remove,
273}; 273};
274 274
275static int __init pl022_init_dummy(void) 275static int __init pl022_init_dummy(void)
diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c
index db0bb75e2c76..5b286e06474c 100644
--- a/arch/arm/mach-ux500/cpu-db8500.c
+++ b/arch/arm/mach-ux500/cpu-db8500.c
@@ -285,7 +285,8 @@ static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
285 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80110000, "nmk-i2c.3", NULL), 285 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80110000, "nmk-i2c.3", NULL),
286 OF_DEV_AUXDATA("st,nomadik-i2c", 0x8012a000, "nmk-i2c.4", NULL), 286 OF_DEV_AUXDATA("st,nomadik-i2c", 0x8012a000, "nmk-i2c.4", NULL),
287 /* Requires device name bindings. */ 287 /* Requires device name bindings. */
288 OF_DEV_AUXDATA("stericsson,nmk_pinctrl", 0, "pinctrl-db8500", NULL), 288 OF_DEV_AUXDATA("stericsson,nmk_pinctrl", U8500_PRCMU_BASE,
289 "pinctrl-db8500", NULL),
289 /* Requires clock name and DMA bindings. */ 290 /* Requires clock name and DMA bindings. */
290 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80123000, 291 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80123000,
291 "ux500-msp-i2s.0", &msp0_platform_data), 292 "ux500-msp-i2s.0", &msp0_platform_data),
diff --git a/arch/arm/mach-versatile/include/mach/irqs.h b/arch/arm/mach-versatile/include/mach/irqs.h
index bf44c61bd1f6..0fd771ca617b 100644
--- a/arch/arm/mach-versatile/include/mach/irqs.h
+++ b/arch/arm/mach-versatile/include/mach/irqs.h
@@ -25,7 +25,7 @@
25 * IRQ interrupts definitions are the same as the INT definitions 25 * IRQ interrupts definitions are the same as the INT definitions
26 * held within platform.h 26 * held within platform.h
27 */ 27 */
28#define IRQ_VIC_START 0 28#define IRQ_VIC_START 32
29#define IRQ_WDOGINT (IRQ_VIC_START + INT_WDOGINT) 29#define IRQ_WDOGINT (IRQ_VIC_START + INT_WDOGINT)
30#define IRQ_SOFTINT (IRQ_VIC_START + INT_SOFTINT) 30#define IRQ_SOFTINT (IRQ_VIC_START + INT_SOFTINT)
31#define IRQ_COMMRx (IRQ_VIC_START + INT_COMMRx) 31#define IRQ_COMMRx (IRQ_VIC_START + INT_COMMRx)
@@ -100,7 +100,7 @@
100/* 100/*
101 * Secondary interrupt controller 101 * Secondary interrupt controller
102 */ 102 */
103#define IRQ_SIC_START 32 103#define IRQ_SIC_START 64
104#define IRQ_SIC_MMCI0B (IRQ_SIC_START + SIC_INT_MMCI0B) 104#define IRQ_SIC_MMCI0B (IRQ_SIC_START + SIC_INT_MMCI0B)
105#define IRQ_SIC_MMCI1B (IRQ_SIC_START + SIC_INT_MMCI1B) 105#define IRQ_SIC_MMCI1B (IRQ_SIC_START + SIC_INT_MMCI1B)
106#define IRQ_SIC_KMI0 (IRQ_SIC_START + SIC_INT_KMI0) 106#define IRQ_SIC_KMI0 (IRQ_SIC_START + SIC_INT_KMI0)
@@ -120,7 +120,7 @@
120#define IRQ_SIC_PCI1 (IRQ_SIC_START + SIC_INT_PCI1) 120#define IRQ_SIC_PCI1 (IRQ_SIC_START + SIC_INT_PCI1)
121#define IRQ_SIC_PCI2 (IRQ_SIC_START + SIC_INT_PCI2) 121#define IRQ_SIC_PCI2 (IRQ_SIC_START + SIC_INT_PCI2)
122#define IRQ_SIC_PCI3 (IRQ_SIC_START + SIC_INT_PCI3) 122#define IRQ_SIC_PCI3 (IRQ_SIC_START + SIC_INT_PCI3)
123#define IRQ_SIC_END 63 123#define IRQ_SIC_END 95
124 124
125#define IRQ_GPIO0_START (IRQ_SIC_END + 1) 125#define IRQ_GPIO0_START (IRQ_SIC_END + 1)
126#define IRQ_GPIO0_END (IRQ_GPIO0_START + 31) 126#define IRQ_GPIO0_END (IRQ_GPIO0_START + 31)
diff --git a/arch/arm/mach-vexpress/Kconfig b/arch/arm/mach-vexpress/Kconfig
index 99e63f5f99d1..52d315b792c8 100644
--- a/arch/arm/mach-vexpress/Kconfig
+++ b/arch/arm/mach-vexpress/Kconfig
@@ -42,7 +42,6 @@ config ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA
42 bool "Enable A5 and A9 only errata work-arounds" 42 bool "Enable A5 and A9 only errata work-arounds"
43 default y 43 default y
44 select ARM_ERRATA_720789 44 select ARM_ERRATA_720789
45 select ARM_ERRATA_751472
46 select PL310_ERRATA_753970 if CACHE_PL310 45 select PL310_ERRATA_753970 if CACHE_PL310
47 help 46 help
48 Provides common dependencies for Versatile Express platforms 47 Provides common dependencies for Versatile Express platforms
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index 6911b8b2745c..c2f37390308a 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -352,7 +352,8 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
352 /* Unmapped register. */ 352 /* Unmapped register. */
353 sync_reg_offset = L2X0_DUMMY_REG; 353 sync_reg_offset = L2X0_DUMMY_REG;
354#endif 354#endif
355 outer_cache.set_debug = pl310_set_debug; 355 if ((cache_id & L2X0_CACHE_ID_RTL_MASK) <= L2X0_CACHE_ID_RTL_R3P0)
356 outer_cache.set_debug = pl310_set_debug;
356 break; 357 break;
357 case L2X0_CACHE_ID_PART_L210: 358 case L2X0_CACHE_ID_PART_L210:
358 ways = (aux >> 13) & 0xf; 359 ways = (aux >> 13) & 0xf;
@@ -459,8 +460,8 @@ static void aurora_pa_range(unsigned long start, unsigned long end,
459 unsigned long flags; 460 unsigned long flags;
460 461
461 raw_spin_lock_irqsave(&l2x0_lock, flags); 462 raw_spin_lock_irqsave(&l2x0_lock, flags);
462 writel(start, l2x0_base + AURORA_RANGE_BASE_ADDR_REG); 463 writel_relaxed(start, l2x0_base + AURORA_RANGE_BASE_ADDR_REG);
463 writel(end, l2x0_base + offset); 464 writel_relaxed(end, l2x0_base + offset);
464 raw_spin_unlock_irqrestore(&l2x0_lock, flags); 465 raw_spin_unlock_irqrestore(&l2x0_lock, flags);
465 466
466 cache_sync(); 467 cache_sync();
@@ -505,15 +506,21 @@ static void aurora_clean_range(unsigned long start, unsigned long end)
505 506
506static void aurora_flush_range(unsigned long start, unsigned long end) 507static void aurora_flush_range(unsigned long start, unsigned long end)
507{ 508{
508 if (!l2_wt_override) { 509 start &= ~(CACHE_LINE_SIZE - 1);
509 start &= ~(CACHE_LINE_SIZE - 1); 510 end = ALIGN(end, CACHE_LINE_SIZE);
510 end = ALIGN(end, CACHE_LINE_SIZE); 511 while (start != end) {
511 while (start != end) { 512 unsigned long range_end = calc_range_end(start, end);
512 unsigned long range_end = calc_range_end(start, end); 513 /*
514 * If L2 is forced to WT, the L2 will always be clean and we
515 * just need to invalidate.
516 */
517 if (l2_wt_override)
513 aurora_pa_range(start, range_end - CACHE_LINE_SIZE, 518 aurora_pa_range(start, range_end - CACHE_LINE_SIZE,
514 AURORA_FLUSH_RANGE_REG); 519 AURORA_INVAL_RANGE_REG);
515 start = range_end; 520 else
516 } 521 aurora_pa_range(start, range_end - CACHE_LINE_SIZE,
522 AURORA_FLUSH_RANGE_REG);
523 start = range_end;
517 } 524 }
518} 525}
519 526
@@ -668,8 +675,9 @@ static void pl310_resume(void)
668static void aurora_resume(void) 675static void aurora_resume(void)
669{ 676{
670 if (!(readl(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN)) { 677 if (!(readl(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN)) {
671 writel(l2x0_saved_regs.aux_ctrl, l2x0_base + L2X0_AUX_CTRL); 678 writel_relaxed(l2x0_saved_regs.aux_ctrl,
672 writel(l2x0_saved_regs.ctrl, l2x0_base + L2X0_CTRL); 679 l2x0_base + L2X0_AUX_CTRL);
680 writel_relaxed(l2x0_saved_regs.ctrl, l2x0_base + L2X0_CTRL);
673 } 681 }
674} 682}
675 683
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 6b2fb87c8698..076c26d43864 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -774,25 +774,27 @@ static void dma_cache_maint_page(struct page *page, unsigned long offset,
774 size_t size, enum dma_data_direction dir, 774 size_t size, enum dma_data_direction dir,
775 void (*op)(const void *, size_t, int)) 775 void (*op)(const void *, size_t, int))
776{ 776{
777 unsigned long pfn;
778 size_t left = size;
779
780 pfn = page_to_pfn(page) + offset / PAGE_SIZE;
781 offset %= PAGE_SIZE;
782
777 /* 783 /*
778 * A single sg entry may refer to multiple physically contiguous 784 * A single sg entry may refer to multiple physically contiguous
779 * pages. But we still need to process highmem pages individually. 785 * pages. But we still need to process highmem pages individually.
780 * If highmem is not configured then the bulk of this loop gets 786 * If highmem is not configured then the bulk of this loop gets
781 * optimized out. 787 * optimized out.
782 */ 788 */
783 size_t left = size;
784 do { 789 do {
785 size_t len = left; 790 size_t len = left;
786 void *vaddr; 791 void *vaddr;
787 792
793 page = pfn_to_page(pfn);
794
788 if (PageHighMem(page)) { 795 if (PageHighMem(page)) {
789 if (len + offset > PAGE_SIZE) { 796 if (len + offset > PAGE_SIZE)
790 if (offset >= PAGE_SIZE) {
791 page += offset / PAGE_SIZE;
792 offset %= PAGE_SIZE;
793 }
794 len = PAGE_SIZE - offset; 797 len = PAGE_SIZE - offset;
795 }
796 vaddr = kmap_high_get(page); 798 vaddr = kmap_high_get(page);
797 if (vaddr) { 799 if (vaddr) {
798 vaddr += offset; 800 vaddr += offset;
@@ -809,7 +811,7 @@ static void dma_cache_maint_page(struct page *page, unsigned long offset,
809 op(vaddr, len, dir); 811 op(vaddr, len, dir);
810 } 812 }
811 offset = 0; 813 offset = 0;
812 page++; 814 pfn++;
813 left -= len; 815 left -= len;
814 } while (left); 816 } while (left);
815} 817}
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 9f0610243bd6..ce328c7f5c94 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -283,7 +283,7 @@ static struct mem_type mem_types[] = {
283 }, 283 },
284 [MT_MEMORY_SO] = { 284 [MT_MEMORY_SO] = {
285 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY | 285 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY |
286 L_PTE_MT_UNCACHED, 286 L_PTE_MT_UNCACHED | L_PTE_XN,
287 .prot_l1 = PMD_TYPE_TABLE, 287 .prot_l1 = PMD_TYPE_TABLE,
288 .prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_SECT_S | 288 .prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_SECT_S |
289 PMD_SECT_UNCACHED | PMD_SECT_XN, 289 PMD_SECT_UNCACHED | PMD_SECT_XN,
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index 350f6a74992b..3a3c015f8d5c 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -169,6 +169,7 @@ __v7_ca15mp_setup:
169 orreq r0, r0, r10 @ Enable CPU-specific SMP bits 169 orreq r0, r0, r10 @ Enable CPU-specific SMP bits
170 mcreq p15, 0, r0, c1, c0, 1 170 mcreq p15, 0, r0, c1, c0, 1
171#endif 171#endif
172 b __v7_setup
172 173
173__v7_pj4b_setup: 174__v7_pj4b_setup:
174#ifdef CONFIG_CPU_PJ4B 175#ifdef CONFIG_CPU_PJ4B
@@ -245,7 +246,8 @@ __v7_setup:
245 ldr r10, =0x00000c08 @ Cortex-A8 primary part number 246 ldr r10, =0x00000c08 @ Cortex-A8 primary part number
246 teq r0, r10 247 teq r0, r10
247 bne 2f 248 bne 2f
248#ifdef CONFIG_ARM_ERRATA_430973 249#if defined(CONFIG_ARM_ERRATA_430973) && !defined(CONFIG_ARCH_MULTIPLATFORM)
250
249 teq r5, #0x00100000 @ only present in r1p* 251 teq r5, #0x00100000 @ only present in r1p*
250 mrceq p15, 0, r10, c1, c0, 1 @ read aux control register 252 mrceq p15, 0, r10, c1, c0, 1 @ read aux control register
251 orreq r10, r10, #(1 << 6) @ set IBE to 1 253 orreq r10, r10, #(1 << 6) @ set IBE to 1
diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
index 9d9aa2f55129..a14a78a2f149 100644
--- a/arch/arm/plat-omap/Makefile
+++ b/arch/arm/plat-omap/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5# Common support 5# Common support
6obj-y := sram.o dma.o fb.o counter_32k.o 6obj-y := sram.o dma.o counter_32k.o
7obj-m := 7obj-m :=
8obj-n := 8obj-n :=
9obj- := 9obj- :=
diff --git a/arch/arm/plat-omap/counter_32k.c b/arch/arm/plat-omap/counter_32k.c
index f3771cdb9838..5b0b86bb34bb 100644
--- a/arch/arm/plat-omap/counter_32k.c
+++ b/arch/arm/plat-omap/counter_32k.c
@@ -22,6 +22,8 @@
22#include <asm/mach/time.h> 22#include <asm/mach/time.h>
23#include <asm/sched_clock.h> 23#include <asm/sched_clock.h>
24 24
25#include <plat/counter-32k.h>
26
25/* OMAP2_32KSYNCNT_CR_OFF: offset of 32ksync counter register */ 27/* OMAP2_32KSYNCNT_CR_OFF: offset of 32ksync counter register */
26#define OMAP2_32KSYNCNT_REV_OFF 0x0 28#define OMAP2_32KSYNCNT_REV_OFF 0x0
27#define OMAP2_32KSYNCNT_REV_SCHEME (0x3 << 30) 29#define OMAP2_32KSYNCNT_REV_SCHEME (0x3 << 30)
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index 37a488aaa2ba..4136b20cba3c 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -2000,7 +2000,7 @@ void omap_dma_global_context_restore(void)
2000 omap_clear_dma(ch); 2000 omap_clear_dma(ch);
2001} 2001}
2002 2002
2003static int __devinit omap_system_dma_probe(struct platform_device *pdev) 2003static int omap_system_dma_probe(struct platform_device *pdev)
2004{ 2004{
2005 int ch, ret = 0; 2005 int ch, ret = 0;
2006 int dma_irq; 2006 int dma_irq;
@@ -2116,7 +2116,7 @@ exit_dma_lch_fail:
2116 return ret; 2116 return ret;
2117} 2117}
2118 2118
2119static int __devexit omap_system_dma_remove(struct platform_device *pdev) 2119static int omap_system_dma_remove(struct platform_device *pdev)
2120{ 2120{
2121 int dma_irq; 2121 int dma_irq;
2122 2122
@@ -2140,7 +2140,7 @@ static int __devexit omap_system_dma_remove(struct platform_device *pdev)
2140 2140
2141static struct platform_driver omap_system_dma_driver = { 2141static struct platform_driver omap_system_dma_driver = {
2142 .probe = omap_system_dma_probe, 2142 .probe = omap_system_dma_probe,
2143 .remove = __devexit_p(omap_system_dma_remove), 2143 .remove = omap_system_dma_remove,
2144 .driver = { 2144 .driver = {
2145 .name = "omap_dma_system" 2145 .name = "omap_dma_system"
2146 }, 2146 },
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 89585c293554..7b433f3bddca 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -777,7 +777,7 @@ EXPORT_SYMBOL_GPL(omap_dm_timers_active);
777 * Called by driver framework at the end of device registration for all 777 * Called by driver framework at the end of device registration for all
778 * timer devices. 778 * timer devices.
779 */ 779 */
780static int __devinit omap_dm_timer_probe(struct platform_device *pdev) 780static int omap_dm_timer_probe(struct platform_device *pdev)
781{ 781{
782 unsigned long flags; 782 unsigned long flags;
783 struct omap_dm_timer *timer; 783 struct omap_dm_timer *timer;
@@ -864,7 +864,7 @@ static int __devinit omap_dm_timer_probe(struct platform_device *pdev)
864 * In addition to freeing platform resources it also deletes the timer 864 * In addition to freeing platform resources it also deletes the timer
865 * entry from the local list. 865 * entry from the local list.
866 */ 866 */
867static int __devexit omap_dm_timer_remove(struct platform_device *pdev) 867static int omap_dm_timer_remove(struct platform_device *pdev)
868{ 868{
869 struct omap_dm_timer *timer; 869 struct omap_dm_timer *timer;
870 unsigned long flags; 870 unsigned long flags;
@@ -891,26 +891,15 @@ MODULE_DEVICE_TABLE(of, omap_timer_match);
891 891
892static struct platform_driver omap_dm_timer_driver = { 892static struct platform_driver omap_dm_timer_driver = {
893 .probe = omap_dm_timer_probe, 893 .probe = omap_dm_timer_probe,
894 .remove = __devexit_p(omap_dm_timer_remove), 894 .remove = omap_dm_timer_remove,
895 .driver = { 895 .driver = {
896 .name = "omap_timer", 896 .name = "omap_timer",
897 .of_match_table = of_match_ptr(omap_timer_match), 897 .of_match_table = of_match_ptr(omap_timer_match),
898 }, 898 },
899}; 899};
900 900
901static int __init omap_dm_timer_driver_init(void)
902{
903 return platform_driver_register(&omap_dm_timer_driver);
904}
905
906static void __exit omap_dm_timer_driver_exit(void)
907{
908 platform_driver_unregister(&omap_dm_timer_driver);
909}
910
911early_platform_init("earlytimer", &omap_dm_timer_driver); 901early_platform_init("earlytimer", &omap_dm_timer_driver);
912module_init(omap_dm_timer_driver_init); 902module_platform_driver(omap_dm_timer_driver);
913module_exit(omap_dm_timer_driver_exit);
914 903
915MODULE_DESCRIPTION("OMAP Dual-Mode Timer Driver"); 904MODULE_DESCRIPTION("OMAP Dual-Mode Timer Driver");
916MODULE_LICENSE("GPL"); 905MODULE_LICENSE("GPL");
diff --git a/arch/arm/plat-omap/include/plat/cpu.h b/arch/arm/plat-omap/include/plat/cpu.h
index b4516aba67ed..c9a66bf36c9a 100644
--- a/arch/arm/plat-omap/include/plat/cpu.h
+++ b/arch/arm/plat-omap/include/plat/cpu.h
@@ -32,8 +32,4 @@
32#include <mach/soc.h> 32#include <mach/soc.h>
33#endif 33#endif
34 34
35#ifdef CONFIG_ARCH_OMAP2PLUS
36#include "../../mach-omap2/soc.h"
37#endif
38
39#endif 35#endif
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 743fc2836f7a..a5bc92d7e476 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -26,6 +26,8 @@
26 26
27#include <asm/mach/map.h> 27#include <asm/mach/map.h>
28 28
29#include <plat/sram.h>
30
29#define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1))) 31#define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1)))
30 32
31static void __iomem *omap_sram_base; 33static void __iomem *omap_sram_base;
diff --git a/arch/arm/plat-pxa/ssp.c b/arch/arm/plat-pxa/ssp.c
index 584c9bf8ed2d..8e11e96eab5e 100644
--- a/arch/arm/plat-pxa/ssp.c
+++ b/arch/arm/plat-pxa/ssp.c
@@ -72,7 +72,7 @@ void pxa_ssp_free(struct ssp_device *ssp)
72} 72}
73EXPORT_SYMBOL(pxa_ssp_free); 73EXPORT_SYMBOL(pxa_ssp_free);
74 74
75static int __devinit pxa_ssp_probe(struct platform_device *pdev) 75static int pxa_ssp_probe(struct platform_device *pdev)
76{ 76{
77 const struct platform_device_id *id = platform_get_device_id(pdev); 77 const struct platform_device_id *id = platform_get_device_id(pdev);
78 struct resource *res; 78 struct resource *res;
@@ -164,7 +164,7 @@ err_free:
164 return ret; 164 return ret;
165} 165}
166 166
167static int __devexit pxa_ssp_remove(struct platform_device *pdev) 167static int pxa_ssp_remove(struct platform_device *pdev)
168{ 168{
169 struct resource *res; 169 struct resource *res;
170 struct ssp_device *ssp; 170 struct ssp_device *ssp;
@@ -199,7 +199,7 @@ static const struct platform_device_id ssp_id_table[] = {
199 199
200static struct platform_driver pxa_ssp_driver = { 200static struct platform_driver pxa_ssp_driver = {
201 .probe = pxa_ssp_probe, 201 .probe = pxa_ssp_probe,
202 .remove = __devexit_p(pxa_ssp_remove), 202 .remove = pxa_ssp_remove,
203 .driver = { 203 .driver = {
204 .owner = THIS_MODULE, 204 .owner = THIS_MODULE,
205 .name = "pxa2xx-ssp", 205 .name = "pxa2xx-ssp",
diff --git a/arch/arm/plat-samsung/adc.c b/arch/arm/plat-samsung/adc.c
index 37542c2689a2..2d676ab50f73 100644
--- a/arch/arm/plat-samsung/adc.c
+++ b/arch/arm/plat-samsung/adc.c
@@ -416,7 +416,7 @@ static int s3c_adc_probe(struct platform_device *pdev)
416 return 0; 416 return 0;
417} 417}
418 418
419static int __devexit s3c_adc_remove(struct platform_device *pdev) 419static int s3c_adc_remove(struct platform_device *pdev)
420{ 420{
421 struct adc_device *adc = platform_get_drvdata(pdev); 421 struct adc_device *adc = platform_get_drvdata(pdev);
422 422
@@ -516,7 +516,7 @@ static struct platform_driver s3c_adc_driver = {
516 .pm = &adc_pm_ops, 516 .pm = &adc_pm_ops,
517 }, 517 },
518 .probe = s3c_adc_probe, 518 .probe = s3c_adc_probe,
519 .remove = __devexit_p(s3c_adc_remove), 519 .remove = s3c_adc_remove,
520}; 520};
521 521
522static int __init adc_init(void) 522static int __init adc_init(void)
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
index e0072ce8d6e9..b69e11dc679d 100644
--- a/arch/arm/plat-samsung/include/plat/cpu.h
+++ b/arch/arm/plat-samsung/include/plat/cpu.h
@@ -43,7 +43,7 @@ extern unsigned long samsung_cpu_id;
43#define EXYNOS4_CPU_MASK 0xFFFE0000 43#define EXYNOS4_CPU_MASK 0xFFFE0000
44 44
45#define EXYNOS5250_SOC_ID 0x43520000 45#define EXYNOS5250_SOC_ID 0x43520000
46#define EXYNOS5440_SOC_ID 0x54400000 46#define EXYNOS5440_SOC_ID 0xE5440000
47#define EXYNOS5_SOC_MASK 0xFFFFF000 47#define EXYNOS5_SOC_MASK 0xFFFFF000
48 48
49#define IS_SAMSUNG_CPU(name, id, mask) \ 49#define IS_SAMSUNG_CPU(name, id, mask) \
diff --git a/arch/arm/plat-versatile/headsmp.S b/arch/arm/plat-versatile/headsmp.S
index dd703ef09b8d..b178d44e9eaa 100644
--- a/arch/arm/plat-versatile/headsmp.S
+++ b/arch/arm/plat-versatile/headsmp.S
@@ -20,7 +20,7 @@
20 */ 20 */
21ENTRY(versatile_secondary_startup) 21ENTRY(versatile_secondary_startup)
22 mrc p15, 0, r0, c0, c0, 5 22 mrc p15, 0, r0, c0, c0, 5
23 and r0, r0, #15 23 bic r0, #0xff000000
24 adr r4, 1f 24 adr r4, 1f
25 ldmia r4, {r5, r6} 25 ldmia r4, {r5, r6}
26 sub r4, r4, r5 26 sub r4, r4, r5
diff --git a/arch/arm/vfp/entry.S b/arch/arm/vfp/entry.S
index cc926c985981..323ce1a62bbf 100644
--- a/arch/arm/vfp/entry.S
+++ b/arch/arm/vfp/entry.S
@@ -22,7 +22,7 @@
22@ IRQs disabled. 22@ IRQs disabled.
23@ 23@
24ENTRY(do_vfp) 24ENTRY(do_vfp)
25#ifdef CONFIG_PREEMPT 25#ifdef CONFIG_PREEMPT_COUNT
26 ldr r4, [r10, #TI_PREEMPT] @ get preempt count 26 ldr r4, [r10, #TI_PREEMPT] @ get preempt count
27 add r11, r4, #1 @ increment it 27 add r11, r4, #1 @ increment it
28 str r11, [r10, #TI_PREEMPT] 28 str r11, [r10, #TI_PREEMPT]
@@ -35,7 +35,7 @@ ENTRY(do_vfp)
35ENDPROC(do_vfp) 35ENDPROC(do_vfp)
36 36
37ENTRY(vfp_null_entry) 37ENTRY(vfp_null_entry)
38#ifdef CONFIG_PREEMPT 38#ifdef CONFIG_PREEMPT_COUNT
39 get_thread_info r10 39 get_thread_info r10
40 ldr r4, [r10, #TI_PREEMPT] @ get preempt count 40 ldr r4, [r10, #TI_PREEMPT] @ get preempt count
41 sub r11, r4, #1 @ decrement it 41 sub r11, r4, #1 @ decrement it
@@ -53,7 +53,7 @@ ENDPROC(vfp_null_entry)
53 53
54 __INIT 54 __INIT
55ENTRY(vfp_testing_entry) 55ENTRY(vfp_testing_entry)
56#ifdef CONFIG_PREEMPT 56#ifdef CONFIG_PREEMPT_COUNT
57 get_thread_info r10 57 get_thread_info r10
58 ldr r4, [r10, #TI_PREEMPT] @ get preempt count 58 ldr r4, [r10, #TI_PREEMPT] @ get preempt count
59 sub r11, r4, #1 @ decrement it 59 sub r11, r4, #1 @ decrement it
diff --git a/arch/arm/vfp/vfphw.S b/arch/arm/vfp/vfphw.S
index ea0349f63586..dd5e56f95f3f 100644
--- a/arch/arm/vfp/vfphw.S
+++ b/arch/arm/vfp/vfphw.S
@@ -168,7 +168,7 @@ vfp_hw_state_valid:
168 @ else it's one 32-bit instruction, so 168 @ else it's one 32-bit instruction, so
169 @ always subtract 4 from the following 169 @ always subtract 4 from the following
170 @ instruction address. 170 @ instruction address.
171#ifdef CONFIG_PREEMPT 171#ifdef CONFIG_PREEMPT_COUNT
172 get_thread_info r10 172 get_thread_info r10
173 ldr r4, [r10, #TI_PREEMPT] @ get preempt count 173 ldr r4, [r10, #TI_PREEMPT] @ get preempt count
174 sub r11, r4, #1 @ decrement it 174 sub r11, r4, #1 @ decrement it
@@ -192,7 +192,7 @@ look_for_VFP_exceptions:
192 @ not recognised by VFP 192 @ not recognised by VFP
193 193
194 DBGSTR "not VFP" 194 DBGSTR "not VFP"
195#ifdef CONFIG_PREEMPT 195#ifdef CONFIG_PREEMPT_COUNT
196 get_thread_info r10 196 get_thread_info r10
197 ldr r4, [r10, #TI_PREEMPT] @ get preempt count 197 ldr r4, [r10, #TI_PREEMPT] @ get preempt count
198 sub r11, r4, #1 @ decrement it 198 sub r11, r4, #1 @ decrement it
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 9c829b008261..f8f362aafee9 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -2,6 +2,8 @@ config ARM64
2 def_bool y 2 def_bool y
3 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE 3 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
4 select ARCH_WANT_COMPAT_IPC_PARSE_VERSION 4 select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
5 select ARM_AMBA
6 select CLONE_BACKWARDS
5 select COMMON_CLK 7 select COMMON_CLK
6 select GENERIC_CLOCKEVENTS 8 select GENERIC_CLOCKEVENTS
7 select GENERIC_HARDIRQS_NO_DEPRECATED 9 select GENERIC_HARDIRQS_NO_DEPRECATED
@@ -31,7 +33,6 @@ config ARM64
31 select RTC_LIB 33 select RTC_LIB
32 select SPARSE_IRQ 34 select SPARSE_IRQ
33 select SYSCTL_EXCEPTION_TRACE 35 select SYSCTL_EXCEPTION_TRACE
34 select CLONE_BACKWARDS
35 help 36 help
36 ARM 64-bit (AArch64) Linux support. 37 ARM 64-bit (AArch64) Linux support.
37 38
@@ -90,6 +91,9 @@ config SWIOTLB
90config IOMMU_HELPER 91config IOMMU_HELPER
91 def_bool SWIOTLB 92 def_bool SWIOTLB
92 93
94config GENERIC_GPIO
95 def_bool y
96
93source "init/Kconfig" 97source "init/Kconfig"
94 98
95source "kernel/Kconfig.freezer" 99source "kernel/Kconfig.freezer"
diff --git a/arch/arm64/boot/dts/Makefile b/arch/arm64/boot/dts/Makefile
index 801e2d7fcbc6..32ac0aef0068 100644
--- a/arch/arm64/boot/dts/Makefile
+++ b/arch/arm64/boot/dts/Makefile
@@ -1,4 +1,5 @@
1targets += dtbs 1targets += dtbs
2targets += $(dtb-y)
2 3
3dtbs: $(addprefix $(obj)/, $(dtb-y)) 4dtbs: $(addprefix $(obj)/, $(dtb-y))
4 5
diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h
index d9ec40217a27..618b450e5a1d 100644
--- a/arch/arm64/include/asm/compat.h
+++ b/arch/arm64/include/asm/compat.h
@@ -23,6 +23,7 @@
23 */ 23 */
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/sched.h> 25#include <linux/sched.h>
26#include <linux/ptrace.h>
26 27
27#define COMPAT_USER_HZ 100 28#define COMPAT_USER_HZ 100
28#define COMPAT_UTS_MACHINE "armv8l\0\0" 29#define COMPAT_UTS_MACHINE "armv8l\0\0"
diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h
index 07fea290d7c1..fe32c0e4ac01 100644
--- a/arch/arm64/include/asm/elf.h
+++ b/arch/arm64/include/asm/elf.h
@@ -26,7 +26,10 @@
26 26
27typedef unsigned long elf_greg_t; 27typedef unsigned long elf_greg_t;
28 28
29#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) 29#define ELF_NGREG (sizeof(struct user_pt_regs) / sizeof(elf_greg_t))
30#define ELF_CORE_COPY_REGS(dest, regs) \
31 *(struct user_pt_regs *)&(dest) = (regs)->user_regs;
32
30typedef elf_greg_t elf_gregset_t[ELF_NGREG]; 33typedef elf_greg_t elf_gregset_t[ELF_NGREG];
31typedef struct user_fpsimd_state elf_fpregset_t; 34typedef struct user_fpsimd_state elf_fpregset_t;
32 35
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 64b133949502..e333a243bfcc 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -24,7 +24,8 @@
24/* 24/*
25 * Software defined PTE bits definition. 25 * Software defined PTE bits definition.
26 */ 26 */
27#define PTE_VALID (_AT(pteval_t, 1) << 0) /* pte_present() check */ 27#define PTE_VALID (_AT(pteval_t, 1) << 0)
28#define PTE_PROT_NONE (_AT(pteval_t, 1) << 1) /* only when !PTE_VALID */
28#define PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !pte_present() */ 29#define PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !pte_present() */
29#define PTE_DIRTY (_AT(pteval_t, 1) << 55) 30#define PTE_DIRTY (_AT(pteval_t, 1) << 55)
30#define PTE_SPECIAL (_AT(pteval_t, 1) << 56) 31#define PTE_SPECIAL (_AT(pteval_t, 1) << 56)
@@ -60,9 +61,12 @@ extern void __pgd_error(const char *file, int line, unsigned long val);
60 61
61extern pgprot_t pgprot_default; 62extern pgprot_t pgprot_default;
62 63
63#define _MOD_PROT(p, b) __pgprot(pgprot_val(p) | (b)) 64#define __pgprot_modify(prot,mask,bits) \
65 __pgprot((pgprot_val(prot) & ~(mask)) | (bits))
66
67#define _MOD_PROT(p, b) __pgprot_modify(p, 0, b)
64 68
65#define PAGE_NONE _MOD_PROT(pgprot_default, PTE_NG | PTE_PXN | PTE_UXN | PTE_RDONLY) 69#define PAGE_NONE __pgprot_modify(pgprot_default, PTE_TYPE_MASK, PTE_PROT_NONE)
66#define PAGE_SHARED _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN | PTE_UXN) 70#define PAGE_SHARED _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN | PTE_UXN)
67#define PAGE_SHARED_EXEC _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN) 71#define PAGE_SHARED_EXEC _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN)
68#define PAGE_COPY _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_RDONLY) 72#define PAGE_COPY _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_RDONLY)
@@ -72,7 +76,7 @@ extern pgprot_t pgprot_default;
72#define PAGE_KERNEL _MOD_PROT(pgprot_default, PTE_PXN | PTE_UXN | PTE_DIRTY) 76#define PAGE_KERNEL _MOD_PROT(pgprot_default, PTE_PXN | PTE_UXN | PTE_DIRTY)
73#define PAGE_KERNEL_EXEC _MOD_PROT(pgprot_default, PTE_UXN | PTE_DIRTY) 77#define PAGE_KERNEL_EXEC _MOD_PROT(pgprot_default, PTE_UXN | PTE_DIRTY)
74 78
75#define __PAGE_NONE __pgprot(_PAGE_DEFAULT | PTE_NG | PTE_PXN | PTE_UXN | PTE_RDONLY) 79#define __PAGE_NONE __pgprot(((_PAGE_DEFAULT) & ~PTE_TYPE_MASK) | PTE_PROT_NONE)
76#define __PAGE_SHARED __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN) 80#define __PAGE_SHARED __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN)
77#define __PAGE_SHARED_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN) 81#define __PAGE_SHARED_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN)
78#define __PAGE_COPY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_RDONLY) 82#define __PAGE_COPY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_RDONLY)
@@ -125,16 +129,15 @@ extern struct page *empty_zero_page;
125/* 129/*
126 * The following only work if pte_present(). Undefined behaviour otherwise. 130 * The following only work if pte_present(). Undefined behaviour otherwise.
127 */ 131 */
128#define pte_present(pte) (pte_val(pte) & PTE_VALID) 132#define pte_present(pte) (pte_val(pte) & (PTE_VALID | PTE_PROT_NONE))
129#define pte_dirty(pte) (pte_val(pte) & PTE_DIRTY) 133#define pte_dirty(pte) (pte_val(pte) & PTE_DIRTY)
130#define pte_young(pte) (pte_val(pte) & PTE_AF) 134#define pte_young(pte) (pte_val(pte) & PTE_AF)
131#define pte_special(pte) (pte_val(pte) & PTE_SPECIAL) 135#define pte_special(pte) (pte_val(pte) & PTE_SPECIAL)
132#define pte_write(pte) (!(pte_val(pte) & PTE_RDONLY)) 136#define pte_write(pte) (!(pte_val(pte) & PTE_RDONLY))
133#define pte_exec(pte) (!(pte_val(pte) & PTE_UXN)) 137#define pte_exec(pte) (!(pte_val(pte) & PTE_UXN))
134 138
135#define pte_present_exec_user(pte) \ 139#define pte_valid_user(pte) \
136 ((pte_val(pte) & (PTE_VALID | PTE_USER | PTE_UXN)) == \ 140 ((pte_val(pte) & (PTE_VALID | PTE_USER)) == (PTE_VALID | PTE_USER))
137 (PTE_VALID | PTE_USER))
138 141
139#define PTE_BIT_FUNC(fn,op) \ 142#define PTE_BIT_FUNC(fn,op) \
140static inline pte_t pte_##fn(pte_t pte) { pte_val(pte) op; return pte; } 143static inline pte_t pte_##fn(pte_t pte) { pte_val(pte) op; return pte; }
@@ -157,10 +160,13 @@ extern void __sync_icache_dcache(pte_t pteval, unsigned long addr);
157static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, 160static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
158 pte_t *ptep, pte_t pte) 161 pte_t *ptep, pte_t pte)
159{ 162{
160 if (pte_present_exec_user(pte)) 163 if (pte_valid_user(pte)) {
161 __sync_icache_dcache(pte, addr); 164 if (pte_exec(pte))
162 if (!pte_dirty(pte)) 165 __sync_icache_dcache(pte, addr);
163 pte = pte_wrprotect(pte); 166 if (!pte_dirty(pte))
167 pte = pte_wrprotect(pte);
168 }
169
164 set_pte(ptep, pte); 170 set_pte(ptep, pte);
165} 171}
166 172
@@ -170,9 +176,6 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
170#define pte_huge(pte) ((pte_val(pte) & PTE_TYPE_MASK) == PTE_TYPE_HUGEPAGE) 176#define pte_huge(pte) ((pte_val(pte) & PTE_TYPE_MASK) == PTE_TYPE_HUGEPAGE)
171#define pte_mkhuge(pte) (__pte((pte_val(pte) & ~PTE_TYPE_MASK) | PTE_TYPE_HUGEPAGE)) 177#define pte_mkhuge(pte) (__pte((pte_val(pte) & ~PTE_TYPE_MASK) | PTE_TYPE_HUGEPAGE))
172 178
173#define __pgprot_modify(prot,mask,bits) \
174 __pgprot((pgprot_val(prot) & ~(mask)) | (bits))
175
176#define __HAVE_ARCH_PTE_SPECIAL 179#define __HAVE_ARCH_PTE_SPECIAL
177 180
178/* 181/*
@@ -264,7 +267,8 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr)
264 267
265static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 268static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
266{ 269{
267 const pteval_t mask = PTE_USER | PTE_PXN | PTE_UXN | PTE_RDONLY; 270 const pteval_t mask = PTE_USER | PTE_PXN | PTE_UXN | PTE_RDONLY |
271 PTE_PROT_NONE | PTE_VALID;
268 pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask); 272 pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask);
269 return pte; 273 return pte;
270} 274}
diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h
index 58432625fdb3..5ef47ba3ed45 100644
--- a/arch/arm64/include/asm/unistd32.h
+++ b/arch/arm64/include/asm/unistd32.h
@@ -395,8 +395,13 @@ __SYSCALL(370, sys_name_to_handle_at)
395__SYSCALL(371, compat_sys_open_by_handle_at) 395__SYSCALL(371, compat_sys_open_by_handle_at)
396__SYSCALL(372, compat_sys_clock_adjtime) 396__SYSCALL(372, compat_sys_clock_adjtime)
397__SYSCALL(373, sys_syncfs) 397__SYSCALL(373, sys_syncfs)
398__SYSCALL(374, compat_sys_sendmmsg)
399__SYSCALL(375, sys_setns)
400__SYSCALL(376, compat_sys_process_vm_readv)
401__SYSCALL(377, compat_sys_process_vm_writev)
402__SYSCALL(378, sys_ni_syscall) /* 378 for kcmp */
398 403
399#define __NR_compat_syscalls 374 404#define __NR_compat_syscalls 379
400 405
401/* 406/*
402 * Compat syscall numbers used by the AArch64 kernel. 407 * Compat syscall numbers used by the AArch64 kernel.
diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
index c76c7241125b..f7073c7b1ca9 100644
--- a/arch/arm64/kernel/perf_event.c
+++ b/arch/arm64/kernel/perf_event.c
@@ -1221,7 +1221,7 @@ static struct of_device_id armpmu_of_device_ids[] = {
1221 {}, 1221 {},
1222}; 1222};
1223 1223
1224static int __devinit armpmu_device_probe(struct platform_device *pdev) 1224static int armpmu_device_probe(struct platform_device *pdev)
1225{ 1225{
1226 if (!cpu_pmu) 1226 if (!cpu_pmu)
1227 return -ENODEV; 1227 return -ENODEV;
diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c
index c958cb84d75f..6a389dc1bd49 100644
--- a/arch/arm64/kernel/vdso.c
+++ b/arch/arm64/kernel/vdso.c
@@ -252,10 +252,6 @@ void update_vsyscall(struct timekeeper *tk)
252 252
253void update_vsyscall_tz(void) 253void update_vsyscall_tz(void)
254{ 254{
255 ++vdso_data->tb_seq_count;
256 smp_wmb();
257 vdso_data->tz_minuteswest = sys_tz.tz_minuteswest; 255 vdso_data->tz_minuteswest = sys_tz.tz_minuteswest;
258 vdso_data->tz_dsttime = sys_tz.tz_dsttime; 256 vdso_data->tz_dsttime = sys_tz.tz_dsttime;
259 smp_wmb();
260 ++vdso_data->tb_seq_count;
261} 257}
diff --git a/arch/arm64/kernel/vdso/gettimeofday.S b/arch/arm64/kernel/vdso/gettimeofday.S
index 8bf658d974f9..f0a6d10b5211 100644
--- a/arch/arm64/kernel/vdso/gettimeofday.S
+++ b/arch/arm64/kernel/vdso/gettimeofday.S
@@ -73,8 +73,6 @@ ENTRY(__kernel_gettimeofday)
73 /* If tz is NULL, return 0. */ 73 /* If tz is NULL, return 0. */
74 cbz x1, 3f 74 cbz x1, 3f
75 ldp w4, w5, [vdso_data, #VDSO_TZ_MINWEST] 75 ldp w4, w5, [vdso_data, #VDSO_TZ_MINWEST]
76 seqcnt_read w9
77 seqcnt_check w9, 1b
78 stp w4, w5, [x1, #TZ_MINWEST] 76 stp w4, w5, [x1, #TZ_MINWEST]
793: 773:
80 mov x0, xzr 78 mov x0, xzr
diff --git a/arch/avr32/lib/delay.c b/arch/avr32/lib/delay.c
index 9aa8800830f3..c2f4a07dcda1 100644
--- a/arch/avr32/lib/delay.c
+++ b/arch/avr32/lib/delay.c
@@ -20,7 +20,7 @@
20#include <asm/processor.h> 20#include <asm/processor.h>
21#include <asm/sysreg.h> 21#include <asm/sysreg.h>
22 22
23int __devinit read_current_timer(unsigned long *timer_value) 23int read_current_timer(unsigned long *timer_value)
24{ 24{
25 *timer_value = sysreg_read(COUNT); 25 *timer_value = sysreg_read(COUNT);
26 return 0; 26 return 0;
diff --git a/arch/blackfin/mach-common/dpmc.c b/arch/blackfin/mach-common/dpmc.c
index 978bb400be06..724a8c5f5578 100644
--- a/arch/blackfin/mach-common/dpmc.c
+++ b/arch/blackfin/mach-common/dpmc.c
@@ -129,7 +129,7 @@ static struct notifier_block vreg_cpufreq_notifier_block = {
129 * bfin_dpmc_probe - 129 * bfin_dpmc_probe -
130 * 130 *
131 */ 131 */
132static int __devinit bfin_dpmc_probe(struct platform_device *pdev) 132static int bfin_dpmc_probe(struct platform_device *pdev)
133{ 133{
134 if (pdev->dev.platform_data) 134 if (pdev->dev.platform_data)
135 pdata = pdev->dev.platform_data; 135 pdata = pdev->dev.platform_data;
@@ -143,7 +143,7 @@ static int __devinit bfin_dpmc_probe(struct platform_device *pdev)
143/** 143/**
144 * bfin_dpmc_remove - 144 * bfin_dpmc_remove -
145 */ 145 */
146static int __devexit bfin_dpmc_remove(struct platform_device *pdev) 146static int bfin_dpmc_remove(struct platform_device *pdev)
147{ 147{
148 pdata = NULL; 148 pdata = NULL;
149 return cpufreq_unregister_notifier(&vreg_cpufreq_notifier_block, 149 return cpufreq_unregister_notifier(&vreg_cpufreq_notifier_block,
@@ -152,7 +152,7 @@ static int __devexit bfin_dpmc_remove(struct platform_device *pdev)
152 152
153struct platform_driver bfin_dpmc_device_driver = { 153struct platform_driver bfin_dpmc_device_driver = {
154 .probe = bfin_dpmc_probe, 154 .probe = bfin_dpmc_probe,
155 .remove = __devexit_p(bfin_dpmc_remove), 155 .remove = bfin_dpmc_remove,
156 .driver = { 156 .driver = {
157 .name = DRIVER_NAME, 157 .name = DRIVER_NAME,
158 } 158 }
diff --git a/arch/cris/arch-v32/drivers/pci/bios.c b/arch/cris/arch-v32/drivers/pci/bios.c
index e3dfc72d0cfd..64a5fb93767d 100644
--- a/arch/cris/arch-v32/drivers/pci/bios.c
+++ b/arch/cris/arch-v32/drivers/pci/bios.c
@@ -2,7 +2,7 @@
2#include <linux/kernel.h> 2#include <linux/kernel.h>
3#include <arch/hwregs/intr_vect.h> 3#include <arch/hwregs/intr_vect.h>
4 4
5void __devinit pcibios_fixup_bus(struct pci_bus *b) 5void pcibios_fixup_bus(struct pci_bus *b)
6{ 6{
7} 7}
8 8
diff --git a/arch/cris/arch-v32/kernel/smp.c b/arch/cris/arch-v32/kernel/smp.c
index ebe2cb30bd11..04a16edd5401 100644
--- a/arch/cris/arch-v32/kernel/smp.c
+++ b/arch/cris/arch-v32/kernel/smp.c
@@ -84,7 +84,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
84 cpumask_set_cpu(i, &phys_cpu_present_map); 84 cpumask_set_cpu(i, &phys_cpu_present_map);
85} 85}
86 86
87void __devinit smp_prepare_boot_cpu(void) 87void smp_prepare_boot_cpu(void)
88{ 88{
89 /* PGD pointer has moved after per_cpu initialization so 89 /* PGD pointer has moved after per_cpu initialization so
90 * update the MMU. 90 * update the MMU.
diff --git a/arch/frv/kernel/setup.c b/arch/frv/kernel/setup.c
index 3cb3392f799e..a5136474c6fd 100644
--- a/arch/frv/kernel/setup.c
+++ b/arch/frv/kernel/setup.c
@@ -852,7 +852,7 @@ void __init setup_arch(char **cmdline_p)
852/* 852/*
853 * 853 *
854 */ 854 */
855static int __devinit setup_arch_serial(void) 855static int setup_arch_serial(void)
856{ 856{
857 /* register those serial ports that are available */ 857 /* register those serial ports that are available */
858#ifndef CONFIG_GDBSTUB_UART0 858#ifndef CONFIG_GDBSTUB_UART0
diff --git a/arch/frv/mb93090-mb00/pci-vdk.c b/arch/frv/mb93090-mb00/pci-vdk.c
index 71e9bcf58105..d186b254ce99 100644
--- a/arch/frv/mb93090-mb00/pci-vdk.c
+++ b/arch/frv/mb93090-mb00/pci-vdk.c
@@ -268,7 +268,7 @@ static void __init pci_fixup_umc_ide(struct pci_dev *d)
268 d->resource[i].flags |= PCI_BASE_ADDRESS_SPACE_IO; 268 d->resource[i].flags |= PCI_BASE_ADDRESS_SPACE_IO;
269} 269}
270 270
271static void __devinit pci_fixup_ide_bases(struct pci_dev *d) 271static void pci_fixup_ide_bases(struct pci_dev *d)
272{ 272{
273 int i; 273 int i;
274 274
@@ -287,7 +287,7 @@ static void __devinit pci_fixup_ide_bases(struct pci_dev *d)
287 } 287 }
288} 288}
289 289
290static void __devinit pci_fixup_ide_trash(struct pci_dev *d) 290static void pci_fixup_ide_trash(struct pci_dev *d)
291{ 291{
292 int i; 292 int i;
293 293
@@ -300,7 +300,7 @@ static void __devinit pci_fixup_ide_trash(struct pci_dev *d)
300 d->resource[i].start = d->resource[i].end = d->resource[i].flags = 0; 300 d->resource[i].start = d->resource[i].end = d->resource[i].flags = 0;
301} 301}
302 302
303static void __devinit pci_fixup_latency(struct pci_dev *d) 303static void pci_fixup_latency(struct pci_dev *d)
304{ 304{
305 /* 305 /*
306 * SiS 5597 and 5598 chipsets require latency timer set to 306 * SiS 5597 and 5598 chipsets require latency timer set to
diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h
index 301609c3fcec..359e68a03ca3 100644
--- a/arch/ia64/include/asm/acpi.h
+++ b/arch/ia64/include/asm/acpi.h
@@ -153,7 +153,7 @@ extern int additional_cpus;
153#else 153#else
154#define MAX_PXM_DOMAINS (256) 154#define MAX_PXM_DOMAINS (256)
155#endif 155#endif
156extern int __devinitdata pxm_to_nid_map[MAX_PXM_DOMAINS]; 156extern int pxm_to_nid_map[MAX_PXM_DOMAINS];
157extern int __initdata nid_to_pxm_map[MAX_NUMNODES]; 157extern int __initdata nid_to_pxm_map[MAX_NUMNODES];
158#endif 158#endif
159 159
diff --git a/arch/ia64/include/asm/iosapic.h b/arch/ia64/include/asm/iosapic.h
index b9c102e15f22..94c89a2d97fe 100644
--- a/arch/ia64/include/asm/iosapic.h
+++ b/arch/ia64/include/asm/iosapic.h
@@ -87,18 +87,13 @@ static inline void iosapic_eoi(char __iomem *iosapic, u32 vector)
87} 87}
88 88
89extern void __init iosapic_system_init (int pcat_compat); 89extern void __init iosapic_system_init (int pcat_compat);
90extern int __devinit iosapic_init (unsigned long address, 90extern int iosapic_init (unsigned long address, unsigned int gsi_base);
91 unsigned int gsi_base);
92#ifdef CONFIG_HOTPLUG
93extern int iosapic_remove (unsigned int gsi_base); 91extern int iosapic_remove (unsigned int gsi_base);
94#else
95#define iosapic_remove(gsi_base) (-EINVAL)
96#endif /* CONFIG_HOTPLUG */
97extern int gsi_to_irq (unsigned int gsi); 92extern int gsi_to_irq (unsigned int gsi);
98extern int iosapic_register_intr (unsigned int gsi, unsigned long polarity, 93extern int iosapic_register_intr (unsigned int gsi, unsigned long polarity,
99 unsigned long trigger); 94 unsigned long trigger);
100extern void iosapic_unregister_intr (unsigned int irq); 95extern void iosapic_unregister_intr (unsigned int irq);
101extern void __devinit iosapic_override_isa_irq (unsigned int isa_irq, unsigned int gsi, 96extern void iosapic_override_isa_irq (unsigned int isa_irq, unsigned int gsi,
102 unsigned long polarity, 97 unsigned long polarity,
103 unsigned long trigger); 98 unsigned long trigger);
104extern int __init iosapic_register_platform_intr (u32 int_type, 99extern int __init iosapic_register_platform_intr (u32 int_type,
@@ -109,7 +104,7 @@ extern int __init iosapic_register_platform_intr (u32 int_type,
109 unsigned long trigger); 104 unsigned long trigger);
110 105
111#ifdef CONFIG_NUMA 106#ifdef CONFIG_NUMA
112extern void __devinit map_iosapic_to_node (unsigned int, int); 107extern void map_iosapic_to_node (unsigned int, int);
113#endif 108#endif
114#else 109#else
115#define iosapic_system_init(pcat_compat) do { } while (0) 110#define iosapic_system_init(pcat_compat) do { } while (0)
diff --git a/arch/ia64/include/asm/parport.h b/arch/ia64/include/asm/parport.h
index 67e16adfcd25..638b4d271b99 100644
--- a/arch/ia64/include/asm/parport.h
+++ b/arch/ia64/include/asm/parport.h
@@ -9,10 +9,9 @@
9#ifndef _ASM_IA64_PARPORT_H 9#ifndef _ASM_IA64_PARPORT_H
10#define _ASM_IA64_PARPORT_H 1 10#define _ASM_IA64_PARPORT_H 1
11 11
12static int __devinit parport_pc_find_isa_ports (int autoirq, int autodma); 12static int parport_pc_find_isa_ports(int autoirq, int autodma);
13 13
14static int __devinit 14static int parport_pc_find_nonpci_ports(int autoirq, int autodma)
15parport_pc_find_nonpci_ports (int autoirq, int autodma)
16{ 15{
17 return parport_pc_find_isa_ports(autoirq, autodma); 16 return parport_pc_find_isa_ports(autoirq, autodma);
18} 17}
diff --git a/arch/ia64/include/asm/smp.h b/arch/ia64/include/asm/smp.h
index 0b3b3997decd..fea21e986022 100644
--- a/arch/ia64/include/asm/smp.h
+++ b/arch/ia64/include/asm/smp.h
@@ -55,7 +55,7 @@ extern struct smp_boot_data {
55 int cpu_phys_id[NR_CPUS]; 55 int cpu_phys_id[NR_CPUS];
56} smp_boot_data __initdata; 56} smp_boot_data __initdata;
57 57
58extern char no_int_routing __devinitdata; 58extern char no_int_routing;
59 59
60extern cpumask_t cpu_core_map[NR_CPUS]; 60extern cpumask_t cpu_core_map[NR_CPUS];
61DECLARE_PER_CPU_SHARED_ALIGNED(cpumask_t, cpu_sibling_map); 61DECLARE_PER_CPU_SHARED_ALIGNED(cpumask_t, cpu_sibling_map);
diff --git a/arch/ia64/include/asm/unistd.h b/arch/ia64/include/asm/unistd.h
index 8b3ff2f5b861..c3cc42a15af1 100644
--- a/arch/ia64/include/asm/unistd.h
+++ b/arch/ia64/include/asm/unistd.h
@@ -11,7 +11,7 @@
11 11
12 12
13 13
14#define NR_syscalls 311 /* length of syscall table */ 14#define NR_syscalls 312 /* length of syscall table */
15 15
16/* 16/*
17 * The following defines stop scripts/checksyscalls.sh from complaining about 17 * The following defines stop scripts/checksyscalls.sh from complaining about
diff --git a/arch/ia64/include/uapi/asm/unistd.h b/arch/ia64/include/uapi/asm/unistd.h
index b706aa54df20..34fd6fe46da1 100644
--- a/arch/ia64/include/uapi/asm/unistd.h
+++ b/arch/ia64/include/uapi/asm/unistd.h
@@ -324,5 +324,6 @@
324#define __NR_process_vm_readv 1332 324#define __NR_process_vm_readv 1332
325#define __NR_process_vm_writev 1333 325#define __NR_process_vm_writev 1333
326#define __NR_accept4 1334 326#define __NR_accept4 1334
327#define __NR_finit_module 1335
327 328
328#endif /* _UAPI_ASM_IA64_UNISTD_H */ 329#endif /* _UAPI_ASM_IA64_UNISTD_H */
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index e9682f5be343..335eb07480fe 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -422,7 +422,7 @@ static int __init acpi_parse_madt(struct acpi_table_header *table)
422#define PXM_FLAG_LEN ((MAX_PXM_DOMAINS + 1)/32) 422#define PXM_FLAG_LEN ((MAX_PXM_DOMAINS + 1)/32)
423 423
424static int __initdata srat_num_cpus; /* number of cpus */ 424static int __initdata srat_num_cpus; /* number of cpus */
425static u32 __devinitdata pxm_flag[PXM_FLAG_LEN]; 425static u32 pxm_flag[PXM_FLAG_LEN];
426#define pxm_bit_set(bit) (set_bit(bit,(void *)pxm_flag)) 426#define pxm_bit_set(bit) (set_bit(bit,(void *)pxm_flag))
427#define pxm_bit_test(bit) (test_bit(bit,(void *)pxm_flag)) 427#define pxm_bit_test(bit) (test_bit(bit,(void *)pxm_flag))
428static struct acpi_table_slit __initdata *slit_table; 428static struct acpi_table_slit __initdata *slit_table;
@@ -956,8 +956,8 @@ EXPORT_SYMBOL(acpi_unmap_lsapic);
956#endif /* CONFIG_ACPI_HOTPLUG_CPU */ 956#endif /* CONFIG_ACPI_HOTPLUG_CPU */
957 957
958#ifdef CONFIG_ACPI_NUMA 958#ifdef CONFIG_ACPI_NUMA
959static acpi_status __devinit 959static acpi_status acpi_map_iosapic(acpi_handle handle, u32 depth,
960acpi_map_iosapic(acpi_handle handle, u32 depth, void *context, void **ret) 960 void *context, void **ret)
961{ 961{
962 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 962 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
963 union acpi_object *obj; 963 union acpi_object *obj;
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index e25b784a2b72..6bfd8429ee0f 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -1785,6 +1785,7 @@ sys_call_table:
1785 data8 sys_process_vm_readv 1785 data8 sys_process_vm_readv
1786 data8 sys_process_vm_writev 1786 data8 sys_process_vm_writev
1787 data8 sys_accept4 1787 data8 sys_accept4
1788 data8 sys_finit_module // 1335
1788 1789
1789 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls 1790 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
1790#endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */ 1791#endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */
diff --git a/arch/ia64/kernel/iosapic.c b/arch/ia64/kernel/iosapic.c
index ef4b5d877cf2..ee33c3aaa2fc 100644
--- a/arch/ia64/kernel/iosapic.c
+++ b/arch/ia64/kernel/iosapic.c
@@ -147,7 +147,7 @@ static struct iosapic_intr_info {
147 unsigned char trigger : 1; /* trigger mode (see iosapic.h) */ 147 unsigned char trigger : 1; /* trigger mode (see iosapic.h) */
148} iosapic_intr_info[NR_IRQS]; 148} iosapic_intr_info[NR_IRQS];
149 149
150static unsigned char pcat_compat __devinitdata; /* 8259 compatibility flag */ 150static unsigned char pcat_compat; /* 8259 compatibility flag */
151 151
152static inline void 152static inline void
153iosapic_write(struct iosapic *iosapic, unsigned int reg, u32 val) 153iosapic_write(struct iosapic *iosapic, unsigned int reg, u32 val)
@@ -914,10 +914,8 @@ iosapic_register_platform_intr (u32 int_type, unsigned int gsi,
914/* 914/*
915 * ACPI calls this when it finds an entry for a legacy ISA IRQ override. 915 * ACPI calls this when it finds an entry for a legacy ISA IRQ override.
916 */ 916 */
917void __devinit 917void iosapic_override_isa_irq(unsigned int isa_irq, unsigned int gsi,
918iosapic_override_isa_irq (unsigned int isa_irq, unsigned int gsi, 918 unsigned long polarity, unsigned long trigger)
919 unsigned long polarity,
920 unsigned long trigger)
921{ 919{
922 int vector, irq; 920 int vector, irq;
923 unsigned int dest = cpu_physical_id(smp_processor_id()); 921 unsigned int dest = cpu_physical_id(smp_processor_id());
@@ -1012,8 +1010,7 @@ iosapic_check_gsi_range (unsigned int gsi_base, unsigned int ver)
1012 return 0; 1010 return 0;
1013} 1011}
1014 1012
1015int __devinit 1013int iosapic_init(unsigned long phys_addr, unsigned int gsi_base)
1016iosapic_init (unsigned long phys_addr, unsigned int gsi_base)
1017{ 1014{
1018 int num_rte, err, index; 1015 int num_rte, err, index;
1019 unsigned int isa_irq, ver; 1016 unsigned int isa_irq, ver;
@@ -1070,9 +1067,7 @@ iosapic_init (unsigned long phys_addr, unsigned int gsi_base)
1070 return 0; 1067 return 0;
1071} 1068}
1072 1069
1073#ifdef CONFIG_HOTPLUG 1070int iosapic_remove(unsigned int gsi_base)
1074int
1075iosapic_remove (unsigned int gsi_base)
1076{ 1071{
1077 int index, err = 0; 1072 int index, err = 0;
1078 unsigned long flags; 1073 unsigned long flags;
@@ -1098,11 +1093,9 @@ iosapic_remove (unsigned int gsi_base)
1098 spin_unlock_irqrestore(&iosapic_lock, flags); 1093 spin_unlock_irqrestore(&iosapic_lock, flags);
1099 return err; 1094 return err;
1100} 1095}
1101#endif /* CONFIG_HOTPLUG */
1102 1096
1103#ifdef CONFIG_NUMA 1097#ifdef CONFIG_NUMA
1104void __devinit 1098void map_iosapic_to_node(unsigned int gsi_base, int node)
1105map_iosapic_to_node(unsigned int gsi_base, int node)
1106{ 1099{
1107 int index; 1100 int index;
1108 1101
diff --git a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c
index 4265ff64219b..b7a5fffe0924 100644
--- a/arch/ia64/kernel/ptrace.c
+++ b/arch/ia64/kernel/ptrace.c
@@ -672,33 +672,6 @@ ptrace_attach_sync_user_rbs (struct task_struct *child)
672 read_unlock(&tasklist_lock); 672 read_unlock(&tasklist_lock);
673} 673}
674 674
675static inline int
676thread_matches (struct task_struct *thread, unsigned long addr)
677{
678 unsigned long thread_rbs_end;
679 struct pt_regs *thread_regs;
680
681 if (ptrace_check_attach(thread, 0) < 0)
682 /*
683 * If the thread is not in an attachable state, we'll
684 * ignore it. The net effect is that if ADDR happens
685 * to overlap with the portion of the thread's
686 * register backing store that is currently residing
687 * on the thread's kernel stack, then ptrace() may end
688 * up accessing a stale value. But if the thread
689 * isn't stopped, that's a problem anyhow, so we're
690 * doing as well as we can...
691 */
692 return 0;
693
694 thread_regs = task_pt_regs(thread);
695 thread_rbs_end = ia64_get_user_rbs_end(thread, thread_regs, NULL);
696 if (!on_kernel_rbs(addr, thread_regs->ar_bspstore, thread_rbs_end))
697 return 0;
698
699 return 1; /* looks like we've got a winner */
700}
701
702/* 675/*
703 * Write f32-f127 back to task->thread.fph if it has been modified. 676 * Write f32-f127 back to task->thread.fph if it has been modified.
704 */ 677 */
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
index 6a368cb2043e..500f1e4d9f9d 100644
--- a/arch/ia64/kernel/smpboot.c
+++ b/arch/ia64/kernel/smpboot.c
@@ -347,8 +347,7 @@ ia64_sync_itc (unsigned int master)
347/* 347/*
348 * Ideally sets up per-cpu profiling hooks. Doesn't do much now... 348 * Ideally sets up per-cpu profiling hooks. Doesn't do much now...
349 */ 349 */
350static inline void __devinit 350static inline void smp_setup_percpu_timer(void)
351smp_setup_percpu_timer (void)
352{ 351{
353} 352}
354 353
@@ -563,7 +562,7 @@ smp_prepare_cpus (unsigned int max_cpus)
563 } 562 }
564} 563}
565 564
566void __devinit smp_prepare_boot_cpu(void) 565void smp_prepare_boot_cpu(void)
567{ 566{
568 set_cpu_online(smp_processor_id(), true); 567 set_cpu_online(smp_processor_id(), true);
569 cpu_set(smp_processor_id(), cpu_callin_map); 568 cpu_set(smp_processor_id(), cpu_callin_map);
@@ -713,8 +712,7 @@ smp_cpus_done (unsigned int dummy)
713 (int)num_online_cpus(), bogosum/(500000/HZ), (bogosum/(5000/HZ))%100); 712 (int)num_online_cpus(), bogosum/(500000/HZ), (bogosum/(5000/HZ))%100);
714} 713}
715 714
716static inline void __devinit 715static inline void set_cpu_sibling_map(int cpu)
717set_cpu_sibling_map(int cpu)
718{ 716{
719 int i; 717 int i;
720 718
@@ -793,8 +791,7 @@ init_smp_config(void)
793 * identify_siblings(cpu) gets called from identify_cpu. This populates the 791 * identify_siblings(cpu) gets called from identify_cpu. This populates the
794 * information related to logical execution units in per_cpu_data structure. 792 * information related to logical execution units in per_cpu_data structure.
795 */ 793 */
796void __devinit 794void identify_siblings(struct cpuinfo_ia64 *c)
797identify_siblings(struct cpuinfo_ia64 *c)
798{ 795{
799 long status; 796 long status;
800 u16 pltid; 797 u16 pltid;
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index b1995efbfd21..88a794536bc0 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -243,8 +243,7 @@ static int __init nojitter_setup(char *str)
243__setup("nojitter", nojitter_setup); 243__setup("nojitter", nojitter_setup);
244 244
245 245
246void __devinit 246void ia64_init_itm(void)
247ia64_init_itm (void)
248{ 247{
249 unsigned long platform_base_freq, itc_freq; 248 unsigned long platform_base_freq, itc_freq;
250 struct pal_freq_ratio itc_ratio, proc_ratio; 249 struct pal_freq_ratio itc_ratio, proc_ratio;
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index 082e383c1b6f..b755ea92aea7 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -294,11 +294,10 @@ setup_gate (void)
294 ia64_patch_gate(); 294 ia64_patch_gate();
295} 295}
296 296
297void __devinit 297void ia64_mmu_init(void *my_cpu_data)
298ia64_mmu_init (void *my_cpu_data)
299{ 298{
300 unsigned long pta, impl_va_bits; 299 unsigned long pta, impl_va_bits;
301 extern void __devinit tlb_init (void); 300 extern void tlb_init(void);
302 301
303#ifdef CONFIG_DISABLE_VHPT 302#ifdef CONFIG_DISABLE_VHPT
304# define VHPT_ENABLE_BIT 0 303# define VHPT_ENABLE_BIT 0
diff --git a/arch/ia64/mm/tlb.c b/arch/ia64/mm/tlb.c
index 7b3cdc6c6d91..ed6129768681 100644
--- a/arch/ia64/mm/tlb.c
+++ b/arch/ia64/mm/tlb.c
@@ -337,8 +337,7 @@ flush_tlb_range (struct vm_area_struct *vma, unsigned long start,
337} 337}
338EXPORT_SYMBOL(flush_tlb_range); 338EXPORT_SYMBOL(flush_tlb_range);
339 339
340void __devinit 340void ia64_tlb_init(void)
341ia64_tlb_init (void)
342{ 341{
343 ia64_ptce_info_t uninitialized_var(ptce_info); /* GCC be quiet */ 342 ia64_ptce_info_t uninitialized_var(ptce_info); /* GCC be quiet */
344 u64 tr_pgbits; 343 u64 tr_pgbits;
diff --git a/arch/ia64/pci/fixup.c b/arch/ia64/pci/fixup.c
index eab28e314022..5dc969dd4ac0 100644
--- a/arch/ia64/pci/fixup.c
+++ b/arch/ia64/pci/fixup.c
@@ -24,7 +24,7 @@
24 * video device at this point. 24 * video device at this point.
25 */ 25 */
26 26
27static void __devinit pci_fixup_video(struct pci_dev *pdev) 27static void pci_fixup_video(struct pci_dev *pdev)
28{ 28{
29 struct pci_dev *bridge; 29 struct pci_dev *bridge;
30 struct pci_bus *bus; 30 struct pci_bus *bus;
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 5faa66c5c2a8..55b72ad57329 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -116,8 +116,7 @@ struct pci_ops pci_root_ops = {
116 116
117/* Called by ACPI when it finds a new root bus. */ 117/* Called by ACPI when it finds a new root bus. */
118 118
119static struct pci_controller * __devinit 119static struct pci_controller *alloc_pci_controller(int seg)
120alloc_pci_controller (int seg)
121{ 120{
122 struct pci_controller *controller; 121 struct pci_controller *controller;
123 122
@@ -165,8 +164,8 @@ new_space (u64 phys_base, int sparse)
165 return i; 164 return i;
166} 165}
167 166
168static u64 __devinit 167static u64 add_io_space(struct pci_root_info *info,
169add_io_space (struct pci_root_info *info, struct acpi_resource_address64 *addr) 168 struct acpi_resource_address64 *addr)
170{ 169{
171 struct resource *resource; 170 struct resource *resource;
172 char *name; 171 char *name;
@@ -226,8 +225,8 @@ out:
226 return ~0; 225 return ~0;
227} 226}
228 227
229static acpi_status __devinit resource_to_window(struct acpi_resource *resource, 228static acpi_status resource_to_window(struct acpi_resource *resource,
230 struct acpi_resource_address64 *addr) 229 struct acpi_resource_address64 *addr)
231{ 230{
232 acpi_status status; 231 acpi_status status;
233 232
@@ -249,8 +248,7 @@ static acpi_status __devinit resource_to_window(struct acpi_resource *resource,
249 return AE_ERROR; 248 return AE_ERROR;
250} 249}
251 250
252static acpi_status __devinit 251static acpi_status count_window(struct acpi_resource *resource, void *data)
253count_window (struct acpi_resource *resource, void *data)
254{ 252{
255 unsigned int *windows = (unsigned int *) data; 253 unsigned int *windows = (unsigned int *) data;
256 struct acpi_resource_address64 addr; 254 struct acpi_resource_address64 addr;
@@ -263,7 +261,7 @@ count_window (struct acpi_resource *resource, void *data)
263 return AE_OK; 261 return AE_OK;
264} 262}
265 263
266static __devinit acpi_status add_window(struct acpi_resource *res, void *data) 264static acpi_status add_window(struct acpi_resource *res, void *data)
267{ 265{
268 struct pci_root_info *info = data; 266 struct pci_root_info *info = data;
269 struct pci_window *window; 267 struct pci_window *window;
@@ -324,8 +322,7 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data)
324 return AE_OK; 322 return AE_OK;
325} 323}
326 324
327struct pci_bus * __devinit 325struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
328pci_acpi_scan_root(struct acpi_pci_root *root)
329{ 326{
330 struct acpi_device *device = root->device; 327 struct acpi_device *device = root->device;
331 int domain = root->segment; 328 int domain = root->segment;
@@ -396,7 +393,7 @@ out1:
396 return NULL; 393 return NULL;
397} 394}
398 395
399static int __devinit is_valid_resource(struct pci_dev *dev, int idx) 396static int is_valid_resource(struct pci_dev *dev, int idx)
400{ 397{
401 unsigned int i, type_mask = IORESOURCE_IO | IORESOURCE_MEM; 398 unsigned int i, type_mask = IORESOURCE_IO | IORESOURCE_MEM;
402 struct resource *devr = &dev->resource[idx], *busr; 399 struct resource *devr = &dev->resource[idx], *busr;
@@ -414,8 +411,7 @@ static int __devinit is_valid_resource(struct pci_dev *dev, int idx)
414 return 0; 411 return 0;
415} 412}
416 413
417static void __devinit 414static void pcibios_fixup_resources(struct pci_dev *dev, int start, int limit)
418pcibios_fixup_resources(struct pci_dev *dev, int start, int limit)
419{ 415{
420 int i; 416 int i;
421 417
@@ -427,13 +423,13 @@ pcibios_fixup_resources(struct pci_dev *dev, int start, int limit)
427 } 423 }
428} 424}
429 425
430void __devinit pcibios_fixup_device_resources(struct pci_dev *dev) 426void pcibios_fixup_device_resources(struct pci_dev *dev)
431{ 427{
432 pcibios_fixup_resources(dev, 0, PCI_BRIDGE_RESOURCES); 428 pcibios_fixup_resources(dev, 0, PCI_BRIDGE_RESOURCES);
433} 429}
434EXPORT_SYMBOL_GPL(pcibios_fixup_device_resources); 430EXPORT_SYMBOL_GPL(pcibios_fixup_device_resources);
435 431
436static void __devinit pcibios_fixup_bridge_resources(struct pci_dev *dev) 432static void pcibios_fixup_bridge_resources(struct pci_dev *dev)
437{ 433{
438 pcibios_fixup_resources(dev, PCI_BRIDGE_RESOURCES, PCI_NUM_RESOURCES); 434 pcibios_fixup_resources(dev, PCI_BRIDGE_RESOURCES, PCI_NUM_RESOURCES);
439} 435}
@@ -441,8 +437,7 @@ static void __devinit pcibios_fixup_bridge_resources(struct pci_dev *dev)
441/* 437/*
442 * Called after each bus is probed, but before its children are examined. 438 * Called after each bus is probed, but before its children are examined.
443 */ 439 */
444void __devinit 440void pcibios_fixup_bus(struct pci_bus *b)
445pcibios_fixup_bus (struct pci_bus *b)
446{ 441{
447 struct pci_dev *dev; 442 struct pci_dev *dev;
448 443
diff --git a/arch/ia64/sn/kernel/io_common.c b/arch/ia64/sn/kernel/io_common.c
index 8630875e74b5..11f2275570fb 100644
--- a/arch/ia64/sn/kernel/io_common.c
+++ b/arch/ia64/sn/kernel/io_common.c
@@ -435,8 +435,7 @@ void sn_generate_path(struct pci_bus *pci_bus, char *address)
435 geo_slot(geoid)); 435 geo_slot(geoid));
436} 436}
437 437
438void __devinit 438void sn_pci_fixup_bus(struct pci_bus *bus)
439sn_pci_fixup_bus(struct pci_bus *bus)
440{ 439{
441 440
442 if (SN_ACPI_BASE_SUPPORT()) 441 if (SN_ACPI_BASE_SUPPORT())
diff --git a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
index 4554f68b7865..b9992571c036 100644
--- a/arch/ia64/sn/kernel/sn2/sn_hwperf.c
+++ b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
@@ -977,7 +977,7 @@ int sn_hwperf_get_nearest_node(cnodeid_t node,
977 return e; 977 return e;
978} 978}
979 979
980static int __devinit sn_hwperf_misc_register_init(void) 980static int sn_hwperf_misc_register_init(void)
981{ 981{
982 int e; 982 int e;
983 983
diff --git a/arch/ia64/xen/irq_xen.c b/arch/ia64/xen/irq_xen.c
index 01f479ee1c43..efb74dafec4d 100644
--- a/arch/ia64/xen/irq_xen.c
+++ b/arch/ia64/xen/irq_xen.c
@@ -273,9 +273,8 @@ xen_bind_early_percpu_irq(void)
273 */ 273 */
274 274
275#ifdef CONFIG_HOTPLUG_CPU 275#ifdef CONFIG_HOTPLUG_CPU
276static int __devinit 276static int unbind_evtchn_callback(struct notifier_block *nfb,
277unbind_evtchn_callback(struct notifier_block *nfb, 277 unsigned long action, void *hcpu)
278 unsigned long action, void *hcpu)
279{ 278{
280 unsigned int cpu = (unsigned long)hcpu; 279 unsigned int cpu = (unsigned long)hcpu;
281 280
diff --git a/arch/m32r/kernel/smpboot.c b/arch/m32r/kernel/smpboot.c
index a2cfc0abb05c..13168a769f8f 100644
--- a/arch/m32r/kernel/smpboot.c
+++ b/arch/m32r/kernel/smpboot.c
@@ -127,7 +127,7 @@ static void unmap_cpu_to_physid(int, int);
127/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ 127/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
128/* Boot up APs Routines : BSP */ 128/* Boot up APs Routines : BSP */
129/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ 129/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
130void __devinit smp_prepare_boot_cpu(void) 130void smp_prepare_boot_cpu(void)
131{ 131{
132 bsp_phys_id = hard_smp_processor_id(); 132 bsp_phys_id = hard_smp_processor_id();
133 physid_set(bsp_phys_id, phys_cpu_present_map); 133 physid_set(bsp_phys_id, phys_cpu_present_map);
diff --git a/arch/m68k/emu/nfeth.c b/arch/m68k/emu/nfeth.c
index a985a7e87d45..695cd737a42e 100644
--- a/arch/m68k/emu/nfeth.c
+++ b/arch/m68k/emu/nfeth.c
@@ -39,7 +39,7 @@ enum {
39#define MAX_UNIT 8 39#define MAX_UNIT 8
40 40
41/* These identify the driver base version and may not be removed. */ 41/* These identify the driver base version and may not be removed. */
42static const char version[] __devinitconst = 42static const char version[] =
43 KERN_INFO KBUILD_MODNAME ".c:v" DRV_VERSION " " DRV_RELDATE 43 KERN_INFO KBUILD_MODNAME ".c:v" DRV_VERSION " " DRV_RELDATE
44 " S.Opichal, M.Jurik, P.Stehlik\n" 44 " S.Opichal, M.Jurik, P.Stehlik\n"
45 KERN_INFO " http://aranym.org/\n"; 45 KERN_INFO " http://aranym.org/\n";
diff --git a/arch/m68k/include/asm/dma-mapping.h b/arch/m68k/include/asm/dma-mapping.h
index 17f7a45948ea..3e6b8445af6a 100644
--- a/arch/m68k/include/asm/dma-mapping.h
+++ b/arch/m68k/include/asm/dma-mapping.h
@@ -21,6 +21,22 @@ extern void *dma_alloc_coherent(struct device *, size_t,
21extern void dma_free_coherent(struct device *, size_t, 21extern void dma_free_coherent(struct device *, size_t,
22 void *, dma_addr_t); 22 void *, dma_addr_t);
23 23
24static inline void *dma_alloc_attrs(struct device *dev, size_t size,
25 dma_addr_t *dma_handle, gfp_t flag,
26 struct dma_attrs *attrs)
27{
28 /* attrs is not supported and ignored */
29 return dma_alloc_coherent(dev, size, dma_handle, flag);
30}
31
32static inline void dma_free_attrs(struct device *dev, size_t size,
33 void *cpu_addr, dma_addr_t dma_handle,
34 struct dma_attrs *attrs)
35{
36 /* attrs is not supported and ignored */
37 dma_free_coherent(dev, size, cpu_addr, dma_handle);
38}
39
24static inline void *dma_alloc_noncoherent(struct device *dev, size_t size, 40static inline void *dma_alloc_noncoherent(struct device *dev, size_t size,
25 dma_addr_t *handle, gfp_t flag) 41 dma_addr_t *handle, gfp_t flag)
26{ 42{
diff --git a/arch/m68k/include/asm/parport.h b/arch/m68k/include/asm/parport.h
index 646b1872f73b..5ea75e6a7399 100644
--- a/arch/m68k/include/asm/parport.h
+++ b/arch/m68k/include/asm/parport.h
@@ -15,8 +15,8 @@
15#define outsl(port,buf,len) isa_outsb(port,buf,(len)<<2) 15#define outsl(port,buf,len) isa_outsb(port,buf,(len)<<2)
16 16
17/* no dma, or IRQ autoprobing */ 17/* no dma, or IRQ autoprobing */
18static int __devinit parport_pc_find_isa_ports (int autoirq, int autodma); 18static int parport_pc_find_isa_ports (int autoirq, int autodma);
19static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma) 19static int parport_pc_find_nonpci_ports (int autoirq, int autodma)
20{ 20{
21 if (! (MACH_IS_Q40)) 21 if (! (MACH_IS_Q40))
22 return 0; /* count=0 */ 22 return 0; /* count=0 */
diff --git a/arch/m68k/include/asm/pgtable_no.h b/arch/m68k/include/asm/pgtable_no.h
index bf86b29fe64a..037028f4ab70 100644
--- a/arch/m68k/include/asm/pgtable_no.h
+++ b/arch/m68k/include/asm/pgtable_no.h
@@ -64,6 +64,8 @@ extern unsigned int kobjsize(const void *objp);
64 */ 64 */
65#define VMALLOC_START 0 65#define VMALLOC_START 0
66#define VMALLOC_END 0xffffffff 66#define VMALLOC_END 0xffffffff
67#define KMAP_START 0
68#define KMAP_END 0xffffffff
67 69
68#include <asm-generic/pgtable.h> 70#include <asm-generic/pgtable.h>
69 71
diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h
index 847994ce6804..f9337f614660 100644
--- a/arch/m68k/include/asm/unistd.h
+++ b/arch/m68k/include/asm/unistd.h
@@ -4,7 +4,7 @@
4#include <uapi/asm/unistd.h> 4#include <uapi/asm/unistd.h>
5 5
6 6
7#define NR_syscalls 348 7#define NR_syscalls 349
8 8
9#define __ARCH_WANT_OLD_READDIR 9#define __ARCH_WANT_OLD_READDIR
10#define __ARCH_WANT_OLD_STAT 10#define __ARCH_WANT_OLD_STAT
diff --git a/arch/m68k/include/uapi/asm/unistd.h b/arch/m68k/include/uapi/asm/unistd.h
index b94bfbf90705..625f321001dc 100644
--- a/arch/m68k/include/uapi/asm/unistd.h
+++ b/arch/m68k/include/uapi/asm/unistd.h
@@ -353,5 +353,6 @@
353#define __NR_process_vm_readv 345 353#define __NR_process_vm_readv 345
354#define __NR_process_vm_writev 346 354#define __NR_process_vm_writev 346
355#define __NR_kcmp 347 355#define __NR_kcmp 347
356#define __NR_finit_module 348
356 357
357#endif /* _UAPI_ASM_M68K_UNISTD_H_ */ 358#endif /* _UAPI_ASM_M68K_UNISTD_H_ */
diff --git a/arch/m68k/kernel/pcibios.c b/arch/m68k/kernel/pcibios.c
index 73fa0b56a06c..931a31ff59dd 100644
--- a/arch/m68k/kernel/pcibios.c
+++ b/arch/m68k/kernel/pcibios.c
@@ -87,7 +87,7 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
87 return 0; 87 return 0;
88} 88}
89 89
90void __devinit pcibios_fixup_bus(struct pci_bus *bus) 90void pcibios_fixup_bus(struct pci_bus *bus)
91{ 91{
92 struct pci_dev *dev; 92 struct pci_dev *dev;
93 93
@@ -97,7 +97,7 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus)
97 } 97 }
98} 98}
99 99
100char __devinit *pcibios_setup(char *str) 100char *pcibios_setup(char *str)
101{ 101{
102 return str; 102 return str;
103} 103}
diff --git a/arch/m68k/kernel/syscalltable.S b/arch/m68k/kernel/syscalltable.S
index c30da5b3f2db..3f04ea0ab802 100644
--- a/arch/m68k/kernel/syscalltable.S
+++ b/arch/m68k/kernel/syscalltable.S
@@ -368,4 +368,5 @@ ENTRY(sys_call_table)
368 .long sys_process_vm_readv /* 345 */ 368 .long sys_process_vm_readv /* 345 */
369 .long sys_process_vm_writev 369 .long sys_process_vm_writev
370 .long sys_kcmp 370 .long sys_kcmp
371 .long sys_finit_module
371 372
diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
index f0e05bce92f2..afd8106fd83b 100644
--- a/arch/m68k/mm/init.c
+++ b/arch/m68k/mm/init.c
@@ -39,6 +39,11 @@
39void *empty_zero_page; 39void *empty_zero_page;
40EXPORT_SYMBOL(empty_zero_page); 40EXPORT_SYMBOL(empty_zero_page);
41 41
42#if !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
43extern void init_pointer_table(unsigned long ptable);
44extern pmd_t *zero_pgtable;
45#endif
46
42#ifdef CONFIG_MMU 47#ifdef CONFIG_MMU
43 48
44pg_data_t pg_data_map[MAX_NUMNODES]; 49pg_data_t pg_data_map[MAX_NUMNODES];
@@ -69,9 +74,6 @@ void __init m68k_setup_node(int node)
69 node_set_online(node); 74 node_set_online(node);
70} 75}
71 76
72extern void init_pointer_table(unsigned long ptable);
73extern pmd_t *zero_pgtable;
74
75#else /* CONFIG_MMU */ 77#else /* CONFIG_MMU */
76 78
77/* 79/*
diff --git a/arch/microblaze/configs/mmu_defconfig b/arch/microblaze/configs/mmu_defconfig
index b3f5eecff2a7..d2b097a652d9 100644
--- a/arch/microblaze/configs/mmu_defconfig
+++ b/arch/microblaze/configs/mmu_defconfig
@@ -1,25 +1,22 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_POSIX_MQUEUE=y
4CONFIG_FHANDLE=y
5CONFIG_AUDIT=y
6CONFIG_AUDIT_LOGINUID_IMMUTABLE=y
3CONFIG_IKCONFIG=y 7CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 8CONFIG_IKCONFIG_PROC=y
9CONFIG_SYSFS_DEPRECATED=y
5CONFIG_SYSFS_DEPRECATED_V2=y 10CONFIG_SYSFS_DEPRECATED_V2=y
6CONFIG_BLK_DEV_INITRD=y
7CONFIG_INITRAMFS_SOURCE="rootfs.cpio"
8CONFIG_INITRAMFS_COMPRESSION_GZIP=y
9# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
10CONFIG_EXPERT=y
11CONFIG_KALLSYMS_ALL=y 11CONFIG_KALLSYMS_ALL=y
12CONFIG_KALLSYMS_EXTRA_PASS=y
13# CONFIG_HOTPLUG is not set
14# CONFIG_BASE_FULL is not set 12# CONFIG_BASE_FULL is not set
15# CONFIG_FUTEX is not set 13CONFIG_EMBEDDED=y
16# CONFIG_EPOLL is not set
17# CONFIG_SIGNALFD is not set
18# CONFIG_SHMEM is not set
19CONFIG_SLAB=y 14CONFIG_SLAB=y
20CONFIG_MODULES=y 15CONFIG_MODULES=y
21CONFIG_MODULE_UNLOAD=y 16CONFIG_MODULE_UNLOAD=y
22# CONFIG_BLK_DEV_BSG is not set 17# CONFIG_BLK_DEV_BSG is not set
18CONFIG_PARTITION_ADVANCED=y
19# CONFIG_EFI_PARTITION is not set
23CONFIG_OPT_LIB_ASM=y 20CONFIG_OPT_LIB_ASM=y
24CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR=1 21CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR=1
25CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR=1 22CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR=1
@@ -31,39 +28,62 @@ CONFIG_HZ_100=y
31CONFIG_MMU=y 28CONFIG_MMU=y
32CONFIG_CMDLINE_BOOL=y 29CONFIG_CMDLINE_BOOL=y
33CONFIG_CMDLINE_FORCE=y 30CONFIG_CMDLINE_FORCE=y
31CONFIG_HIGHMEM=y
32CONFIG_PCI=y
33CONFIG_PCI_XILINX=y
34CONFIG_NET=y 34CONFIG_NET=y
35CONFIG_PACKET=y 35CONFIG_PACKET=y
36CONFIG_UNIX=y 36CONFIG_UNIX=y
37CONFIG_INET=y 37CONFIG_INET=y
38# CONFIG_INET_LRO is not set 38# CONFIG_INET_LRO is not set
39# CONFIG_IPV6 is not set 39# CONFIG_IPV6 is not set
40CONFIG_MTD=y
40CONFIG_PROC_DEVICETREE=y 41CONFIG_PROC_DEVICETREE=y
41CONFIG_BLK_DEV_RAM=y 42CONFIG_BLK_DEV_RAM=y
42CONFIG_BLK_DEV_RAM_SIZE=8192 43CONFIG_BLK_DEV_RAM_SIZE=8192
43CONFIG_NETDEVICES=y 44CONFIG_NETDEVICES=y
44CONFIG_NET_ETHERNET=y
45CONFIG_XILINX_EMACLITE=y 45CONFIG_XILINX_EMACLITE=y
46CONFIG_XILINX_LL_TEMAC=y
46# CONFIG_INPUT is not set 47# CONFIG_INPUT is not set
47# CONFIG_SERIO is not set 48# CONFIG_SERIO is not set
48# CONFIG_VT is not set 49# CONFIG_VT is not set
50CONFIG_SERIAL_8250=y
51CONFIG_SERIAL_8250_CONSOLE=y
49CONFIG_SERIAL_UARTLITE=y 52CONFIG_SERIAL_UARTLITE=y
50CONFIG_SERIAL_UARTLITE_CONSOLE=y 53CONFIG_SERIAL_UARTLITE_CONSOLE=y
51# CONFIG_HW_RANDOM is not set 54# CONFIG_HW_RANDOM is not set
55CONFIG_XILINX_HWICAP=y
56CONFIG_I2C=y
57CONFIG_I2C_XILINX=y
58CONFIG_SPI=y
59CONFIG_SPI_XILINX=y
60CONFIG_GPIOLIB=y
61CONFIG_GPIO_SYSFS=y
62CONFIG_GPIO_XILINX=y
52# CONFIG_HWMON is not set 63# CONFIG_HWMON is not set
64CONFIG_WATCHDOG=y
65CONFIG_XILINX_WATCHDOG=y
66CONFIG_FB=y
67CONFIG_FB_XILINX=y
53# CONFIG_USB_SUPPORT is not set 68# CONFIG_USB_SUPPORT is not set
69CONFIG_UIO=y
70CONFIG_UIO_PDRV=y
71CONFIG_UIO_PDRV_GENIRQ=y
72CONFIG_UIO_DMEM_GENIRQ=y
54CONFIG_EXT2_FS=y 73CONFIG_EXT2_FS=y
55# CONFIG_DNOTIFY is not set 74# CONFIG_DNOTIFY is not set
75CONFIG_CRAMFS=y
76CONFIG_ROMFS_FS=y
56CONFIG_NFS_FS=y 77CONFIG_NFS_FS=y
57CONFIG_NFS_V3=y
58CONFIG_CIFS=y 78CONFIG_CIFS=y
59CONFIG_CIFS_STATS=y 79CONFIG_CIFS_STATS=y
60CONFIG_CIFS_STATS2=y 80CONFIG_CIFS_STATS2=y
61CONFIG_PARTITION_ADVANCED=y
62CONFIG_DEBUG_KERNEL=y
63CONFIG_DETECT_HUNG_TASK=y 81CONFIG_DETECT_HUNG_TASK=y
64CONFIG_DEBUG_SLAB=y 82CONFIG_DEBUG_SLAB=y
65CONFIG_DEBUG_SPINLOCK=y 83CONFIG_DEBUG_SPINLOCK=y
66CONFIG_DEBUG_INFO=y 84CONFIG_DEBUG_INFO=y
67# CONFIG_RCU_CPU_STALL_DETECTOR is not set
68CONFIG_EARLY_PRINTK=y 85CONFIG_EARLY_PRINTK=y
86CONFIG_KEYS=y
87CONFIG_ENCRYPTED_KEYS=y
88CONFIG_KEYS_DEBUG_PROC_KEYS=y
69# CONFIG_CRYPTO_ANSI_CPRNG is not set 89# CONFIG_CRYPTO_ANSI_CPRNG is not set
diff --git a/arch/microblaze/configs/nommu_defconfig b/arch/microblaze/configs/nommu_defconfig
index 0249e4b7e1d3..10b5172283d7 100644
--- a/arch/microblaze/configs/nommu_defconfig
+++ b/arch/microblaze/configs/nommu_defconfig
@@ -1,41 +1,42 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_POSIX_MQUEUE=y 3CONFIG_POSIX_MQUEUE=y
4CONFIG_FHANDLE=y
5CONFIG_AUDIT=y
6CONFIG_AUDIT_LOGINUID_IMMUTABLE=y
4CONFIG_BSD_PROCESS_ACCT=y 7CONFIG_BSD_PROCESS_ACCT=y
5CONFIG_BSD_PROCESS_ACCT_V3=y 8CONFIG_BSD_PROCESS_ACCT_V3=y
6CONFIG_IKCONFIG=y 9CONFIG_IKCONFIG=y
7CONFIG_IKCONFIG_PROC=y 10CONFIG_IKCONFIG_PROC=y
11CONFIG_SYSFS_DEPRECATED=y
8CONFIG_SYSFS_DEPRECATED_V2=y 12CONFIG_SYSFS_DEPRECATED_V2=y
9CONFIG_EXPERT=y
10CONFIG_KALLSYMS_ALL=y 13CONFIG_KALLSYMS_ALL=y
11CONFIG_KALLSYMS_EXTRA_PASS=y
12# CONFIG_HOTPLUG is not set
13# CONFIG_BASE_FULL is not set 14# CONFIG_BASE_FULL is not set
15CONFIG_EMBEDDED=y
14CONFIG_SLAB=y 16CONFIG_SLAB=y
15CONFIG_MODULES=y 17CONFIG_MODULES=y
16CONFIG_MODULE_UNLOAD=y 18CONFIG_MODULE_UNLOAD=y
17# CONFIG_BLK_DEV_BSG is not set 19# CONFIG_BLK_DEV_BSG is not set
18# CONFIG_OPT_LIB_FUNCTION is not set 20CONFIG_PARTITION_ADVANCED=y
21# CONFIG_EFI_PARTITION is not set
19CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR=1 22CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR=1
20CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR=1 23CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR=1
21CONFIG_XILINX_MICROBLAZE0_USE_BARREL=1 24CONFIG_XILINX_MICROBLAZE0_USE_BARREL=1
22CONFIG_XILINX_MICROBLAZE0_USE_DIV=1 25CONFIG_XILINX_MICROBLAZE0_USE_DIV=1
23CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL=2 26CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL=2
24CONFIG_XILINX_MICROBLAZE0_USE_FPU=2 27CONFIG_XILINX_MICROBLAZE0_USE_FPU=2
25CONFIG_HIGH_RES_TIMERS=y
26CONFIG_HZ_100=y 28CONFIG_HZ_100=y
27CONFIG_CMDLINE_BOOL=y 29CONFIG_CMDLINE_BOOL=y
28CONFIG_BINFMT_FLAT=y 30CONFIG_CMDLINE_FORCE=y
31CONFIG_PCI=y
32CONFIG_PCI_XILINX=y
29CONFIG_NET=y 33CONFIG_NET=y
30CONFIG_PACKET=y 34CONFIG_PACKET=y
31CONFIG_UNIX=y 35CONFIG_UNIX=y
32CONFIG_INET=y 36CONFIG_INET=y
33# CONFIG_INET_LRO is not set 37# CONFIG_INET_LRO is not set
34# CONFIG_IPV6 is not set 38# CONFIG_IPV6 is not set
35# CONFIG_PREVENT_FIRMWARE_BUILD is not set
36CONFIG_MTD=y 39CONFIG_MTD=y
37CONFIG_MTD_CONCAT=y
38CONFIG_MTD_PARTITIONS=y
39CONFIG_MTD_CMDLINE_PARTS=y 40CONFIG_MTD_CMDLINE_PARTS=y
40CONFIG_MTD_CHAR=y 41CONFIG_MTD_CHAR=y
41CONFIG_MTD_BLOCK=y 42CONFIG_MTD_BLOCK=y
@@ -45,41 +46,55 @@ CONFIG_MTD_CFI_AMDSTD=y
45CONFIG_MTD_RAM=y 46CONFIG_MTD_RAM=y
46CONFIG_MTD_UCLINUX=y 47CONFIG_MTD_UCLINUX=y
47CONFIG_PROC_DEVICETREE=y 48CONFIG_PROC_DEVICETREE=y
48CONFIG_BLK_DEV_NBD=y
49CONFIG_BLK_DEV_RAM=y 49CONFIG_BLK_DEV_RAM=y
50CONFIG_BLK_DEV_RAM_SIZE=8192
50CONFIG_NETDEVICES=y 51CONFIG_NETDEVICES=y
51CONFIG_NET_ETHERNET=y 52CONFIG_XILINX_EMACLITE=y
53CONFIG_XILINX_LL_TEMAC=y
52# CONFIG_INPUT is not set 54# CONFIG_INPUT is not set
53# CONFIG_SERIO is not set 55# CONFIG_SERIO is not set
54# CONFIG_VT is not set 56# CONFIG_VT is not set
57CONFIG_SERIAL_8250=y
58CONFIG_SERIAL_8250_CONSOLE=y
55CONFIG_SERIAL_UARTLITE=y 59CONFIG_SERIAL_UARTLITE=y
56CONFIG_SERIAL_UARTLITE_CONSOLE=y 60CONFIG_SERIAL_UARTLITE_CONSOLE=y
57CONFIG_HW_RANDOM=y 61# CONFIG_HW_RANDOM is not set
62CONFIG_XILINX_HWICAP=y
63CONFIG_I2C=y
64CONFIG_I2C_XILINX=y
65CONFIG_SPI=y
66CONFIG_SPI_XILINX=y
67CONFIG_GPIOLIB=y
68CONFIG_GPIO_SYSFS=y
69CONFIG_GPIO_XILINX=y
58# CONFIG_HWMON is not set 70# CONFIG_HWMON is not set
59CONFIG_VIDEO_OUTPUT_CONTROL=y 71CONFIG_WATCHDOG=y
72CONFIG_XILINX_WATCHDOG=y
73CONFIG_FB=y
74CONFIG_FB_XILINX=y
75# CONFIG_USB_SUPPORT is not set
76CONFIG_UIO=y
77CONFIG_UIO_PDRV=y
78CONFIG_UIO_PDRV_GENIRQ=y
79CONFIG_UIO_DMEM_GENIRQ=y
60CONFIG_EXT2_FS=y 80CONFIG_EXT2_FS=y
61# CONFIG_DNOTIFY is not set 81# CONFIG_DNOTIFY is not set
62CONFIG_CRAMFS=y 82CONFIG_CRAMFS=y
63CONFIG_ROMFS_FS=y 83CONFIG_ROMFS_FS=y
64CONFIG_NFS_FS=y 84CONFIG_NFS_FS=y
65CONFIG_NFS_V3=y
66CONFIG_NFS_V3_ACL=y 85CONFIG_NFS_V3_ACL=y
67CONFIG_UNUSED_SYMBOLS=y 86CONFIG_NLS=y
68CONFIG_DEBUG_FS=y
69CONFIG_DEBUG_KERNEL=y
70CONFIG_DEBUG_SHIRQ=y
71CONFIG_DETECT_HUNG_TASK=y 87CONFIG_DETECT_HUNG_TASK=y
72CONFIG_SCHEDSTATS=y 88CONFIG_DEBUG_SLAB=y
73CONFIG_TIMER_STATS=y 89CONFIG_DEBUG_SPINLOCK=y
74CONFIG_DEBUG_OBJECTS=y
75CONFIG_DEBUG_OBJECTS_SELFTEST=y
76CONFIG_DEBUG_OBJECTS_FREE=y
77CONFIG_DEBUG_OBJECTS_TIMERS=y
78CONFIG_DEBUG_INFO=y 90CONFIG_DEBUG_INFO=y
79CONFIG_DEBUG_LIST=y
80CONFIG_DEBUG_SG=y
81# CONFIG_RCU_CPU_STALL_DETECTOR is not set
82CONFIG_SYSCTL_SYSCALL_CHECK=y
83CONFIG_EARLY_PRINTK=y 91CONFIG_EARLY_PRINTK=y
92CONFIG_KEYS=y
93CONFIG_ENCRYPTED_KEYS=y
94CONFIG_KEYS_DEBUG_PROC_KEYS=y
95CONFIG_CRYPTO_ECB=y
96CONFIG_CRYPTO_MD4=y
97CONFIG_CRYPTO_MD5=y
98CONFIG_CRYPTO_ARC4=y
99CONFIG_CRYPTO_DES=y
84# CONFIG_CRYPTO_ANSI_CPRNG is not set 100# CONFIG_CRYPTO_ANSI_CPRNG is not set
85# CONFIG_CRC32 is not set
diff --git a/arch/microblaze/include/asm/highmem.h b/arch/microblaze/include/asm/highmem.h
index 2446a73140ac..d04638932438 100644
--- a/arch/microblaze/include/asm/highmem.h
+++ b/arch/microblaze/include/asm/highmem.h
@@ -71,7 +71,7 @@ static inline void kunmap(struct page *page)
71 kunmap_high(page); 71 kunmap_high(page);
72} 72}
73 73
74static inline void *__kmap_atomic(struct page *page) 74static inline void *kmap_atomic(struct page *page)
75{ 75{
76 return kmap_atomic_prot(page, kmap_prot); 76 return kmap_atomic_prot(page, kmap_prot);
77} 77}
diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h
index 927540d3cb7d..a1ab5f0009ef 100644
--- a/arch/microblaze/include/asm/uaccess.h
+++ b/arch/microblaze/include/asm/uaccess.h
@@ -108,7 +108,7 @@ static inline int ___range_ok(unsigned long addr, unsigned long size)
108# define __EX_TABLE_SECTION ".section __ex_table,\"a\"\n" 108# define __EX_TABLE_SECTION ".section __ex_table,\"a\"\n"
109#else 109#else
110# define __FIXUP_SECTION ".section .discard,\"ax\"\n" 110# define __FIXUP_SECTION ".section .discard,\"ax\"\n"
111# define __EX_TABLE_SECTION ".section .discard,\"a\"\n" 111# define __EX_TABLE_SECTION ".section .discard,\"ax\"\n"
112#endif 112#endif
113 113
114extern unsigned long __copy_tofrom_user(void __user *to, 114extern unsigned long __copy_tofrom_user(void __user *to,
diff --git a/arch/microblaze/include/asm/unistd.h b/arch/microblaze/include/asm/unistd.h
index a5f06ac97113..10f8ac186855 100644
--- a/arch/microblaze/include/asm/unistd.h
+++ b/arch/microblaze/include/asm/unistd.h
@@ -37,9 +37,7 @@
37#define __ARCH_WANT_SYS_RT_SIGSUSPEND 37#define __ARCH_WANT_SYS_RT_SIGSUSPEND
38#define __ARCH_WANT_SYS_CLONE 38#define __ARCH_WANT_SYS_CLONE
39#define __ARCH_WANT_SYS_VFORK 39#define __ARCH_WANT_SYS_VFORK
40#ifdef CONFIG_MMU
41#define __ARCH_WANT_SYS_FORK 40#define __ARCH_WANT_SYS_FORK
42#endif
43 41
44/* 42/*
45 * "Conditional" syscalls 43 * "Conditional" syscalls
diff --git a/arch/microblaze/include/uapi/asm/unistd.h b/arch/microblaze/include/uapi/asm/unistd.h
index ccb6920f3b33..5f7fe7582f3a 100644
--- a/arch/microblaze/include/uapi/asm/unistd.h
+++ b/arch/microblaze/include/uapi/asm/unistd.h
@@ -395,7 +395,8 @@
395#define __NR_process_vm_readv 377 395#define __NR_process_vm_readv 377
396#define __NR_process_vm_writev 378 396#define __NR_process_vm_writev 378
397#define __NR_kcmp 379 397#define __NR_kcmp 379
398#define __NR_finit_module 380
398 399
399#define __NR_syscalls 380 400#define __NR_syscalls 381
400 401
401#endif /* _UAPI_ASM_MICROBLAZE_UNISTD_H */ 402#endif /* _UAPI_ASM_MICROBLAZE_UNISTD_H */
diff --git a/arch/microblaze/kernel/syscall_table.S b/arch/microblaze/kernel/syscall_table.S
index 1cbace29b5e2..4fca56cf02f6 100644
--- a/arch/microblaze/kernel/syscall_table.S
+++ b/arch/microblaze/kernel/syscall_table.S
@@ -380,3 +380,4 @@ ENTRY(sys_call_table)
380 .long sys_process_vm_readv 380 .long sys_process_vm_readv
381 .long sys_process_vm_writev 381 .long sys_process_vm_writev
382 .long sys_kcmp 382 .long sys_kcmp
383 .long sys_finit_module
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index a1c5b996d66d..96416553cb36 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -287,7 +287,7 @@ static struct resource *__pci_mmap_make_offset(struct pci_dev *dev,
287 unsigned long io_offset = 0; 287 unsigned long io_offset = 0;
288 int i, res_bit; 288 int i, res_bit;
289 289
290 if (hose == 0) 290 if (!hose)
291 return NULL; /* should never happen */ 291 return NULL; /* should never happen */
292 292
293 /* If memory, add on the PCI bridge address offset */ 293 /* If memory, add on the PCI bridge address offset */
@@ -655,9 +655,8 @@ void pci_resource_to_user(const struct pci_dev *dev, int bar,
655 * - Some 32 bits platforms such as 4xx can have physical space larger than 655 * - Some 32 bits platforms such as 4xx can have physical space larger than
656 * 32 bits so we need to use 64 bits values for the parsing 656 * 32 bits so we need to use 64 bits values for the parsing
657 */ 657 */
658void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose, 658void pci_process_bridge_OF_ranges(struct pci_controller *hose,
659 struct device_node *dev, 659 struct device_node *dev, int primary)
660 int primary)
661{ 660{
662 const u32 *ranges; 661 const u32 *ranges;
663 int rlen; 662 int rlen;
@@ -822,15 +821,13 @@ void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose,
822/* Decide whether to display the domain number in /proc */ 821/* Decide whether to display the domain number in /proc */
823int pci_proc_domain(struct pci_bus *bus) 822int pci_proc_domain(struct pci_bus *bus)
824{ 823{
825 struct pci_controller *hose = pci_bus_to_host(bus);
826
827 return 0; 824 return 0;
828} 825}
829 826
830/* This header fixup will do the resource fixup for all devices as they are 827/* This header fixup will do the resource fixup for all devices as they are
831 * probed, but not for bridge ranges 828 * probed, but not for bridge ranges
832 */ 829 */
833static void __devinit pcibios_fixup_resources(struct pci_dev *dev) 830static void pcibios_fixup_resources(struct pci_dev *dev)
834{ 831{
835 struct pci_controller *hose = pci_bus_to_host(dev->bus); 832 struct pci_controller *hose = pci_bus_to_host(dev->bus);
836 int i; 833 int i;
@@ -871,8 +868,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_resources);
871 * things go more smoothly when it gets it right. It should covers cases such 868 * things go more smoothly when it gets it right. It should covers cases such
872 * as Apple "closed" bridge resources and bare-metal pSeries unassigned bridges 869 * as Apple "closed" bridge resources and bare-metal pSeries unassigned bridges
873 */ 870 */
874static int __devinit pcibios_uninitialized_bridge_resource(struct pci_bus *bus, 871static int pcibios_uninitialized_bridge_resource(struct pci_bus *bus,
875 struct resource *res) 872 struct resource *res)
876{ 873{
877 struct pci_controller *hose = pci_bus_to_host(bus); 874 struct pci_controller *hose = pci_bus_to_host(bus);
878 struct pci_dev *dev = bus->self; 875 struct pci_dev *dev = bus->self;
@@ -933,7 +930,7 @@ static int __devinit pcibios_uninitialized_bridge_resource(struct pci_bus *bus,
933} 930}
934 931
935/* Fixup resources of a PCI<->PCI bridge */ 932/* Fixup resources of a PCI<->PCI bridge */
936static void __devinit pcibios_fixup_bridge(struct pci_bus *bus) 933static void pcibios_fixup_bridge(struct pci_bus *bus)
937{ 934{
938 struct resource *res; 935 struct resource *res;
939 int i; 936 int i;
@@ -970,14 +967,14 @@ static void __devinit pcibios_fixup_bridge(struct pci_bus *bus)
970 } 967 }
971} 968}
972 969
973void __devinit pcibios_setup_bus_self(struct pci_bus *bus) 970void pcibios_setup_bus_self(struct pci_bus *bus)
974{ 971{
975 /* Fix up the bus resources for P2P bridges */ 972 /* Fix up the bus resources for P2P bridges */
976 if (bus->self != NULL) 973 if (bus->self != NULL)
977 pcibios_fixup_bridge(bus); 974 pcibios_fixup_bridge(bus);
978} 975}
979 976
980void __devinit pcibios_setup_bus_devices(struct pci_bus *bus) 977void pcibios_setup_bus_devices(struct pci_bus *bus)
981{ 978{
982 struct pci_dev *dev; 979 struct pci_dev *dev;
983 980
@@ -1002,7 +999,7 @@ void __devinit pcibios_setup_bus_devices(struct pci_bus *bus)
1002 } 999 }
1003} 1000}
1004 1001
1005void __devinit pcibios_fixup_bus(struct pci_bus *bus) 1002void pcibios_fixup_bus(struct pci_bus *bus)
1006{ 1003{
1007 /* When called from the generic PCI probe, read PCI<->PCI bridge 1004 /* When called from the generic PCI probe, read PCI<->PCI bridge
1008 * bases. This is -not- called when generating the PCI tree from 1005 * bases. This is -not- called when generating the PCI tree from
@@ -1124,7 +1121,7 @@ static int __init reparent_resources(struct resource *parent,
1124 * as well. 1121 * as well.
1125 */ 1122 */
1126 1123
1127void pcibios_allocate_bus_resources(struct pci_bus *bus) 1124static void pcibios_allocate_bus_resources(struct pci_bus *bus)
1128{ 1125{
1129 struct pci_bus *b; 1126 struct pci_bus *b;
1130 int i; 1127 int i;
@@ -1179,7 +1176,7 @@ void pcibios_allocate_bus_resources(struct pci_bus *bus)
1179 } 1176 }
1180 printk(KERN_WARNING "PCI: Cannot allocate resource region " 1177 printk(KERN_WARNING "PCI: Cannot allocate resource region "
1181 "%d of PCI bridge %d, will remap\n", i, bus->number); 1178 "%d of PCI bridge %d, will remap\n", i, bus->number);
1182clear_resource: 1179
1183 res->start = res->end = 0; 1180 res->start = res->end = 0;
1184 res->flags = 0; 1181 res->flags = 0;
1185 } 1182 }
@@ -1188,7 +1185,7 @@ clear_resource:
1188 pcibios_allocate_bus_resources(b); 1185 pcibios_allocate_bus_resources(b);
1189} 1186}
1190 1187
1191static inline void __devinit alloc_resource(struct pci_dev *dev, int idx) 1188static inline void alloc_resource(struct pci_dev *dev, int idx)
1192{ 1189{
1193 struct resource *pr, *r = &dev->resource[idx]; 1190 struct resource *pr, *r = &dev->resource[idx];
1194 1191
@@ -1351,7 +1348,7 @@ void __init pcibios_resource_survey(void)
1351 * rest of the code later, for now, keep it as-is as our main 1348 * rest of the code later, for now, keep it as-is as our main
1352 * resource allocation function doesn't deal with sub-trees yet. 1349 * resource allocation function doesn't deal with sub-trees yet.
1353 */ 1350 */
1354void __devinit pcibios_claim_one_bus(struct pci_bus *bus) 1351void pcibios_claim_one_bus(struct pci_bus *bus)
1355{ 1352{
1356 struct pci_dev *dev; 1353 struct pci_dev *dev;
1357 struct pci_bus *child_bus; 1354 struct pci_bus *child_bus;
@@ -1410,7 +1407,8 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
1410 return pci_enable_resources(dev, mask); 1407 return pci_enable_resources(dev, mask);
1411} 1408}
1412 1409
1413static void __devinit pcibios_setup_phb_resources(struct pci_controller *hose, struct list_head *resources) 1410static void pcibios_setup_phb_resources(struct pci_controller *hose,
1411 struct list_head *resources)
1414{ 1412{
1415 unsigned long io_offset; 1413 unsigned long io_offset;
1416 struct resource *res; 1414 struct resource *res;
@@ -1433,7 +1431,8 @@ static void __devinit pcibios_setup_phb_resources(struct pci_controller *hose, s
1433 res->end = res->start + IO_SPACE_LIMIT; 1431 res->end = res->start + IO_SPACE_LIMIT;
1434 res->flags = IORESOURCE_IO; 1432 res->flags = IORESOURCE_IO;
1435 } 1433 }
1436 pci_add_resource_offset(resources, res, hose->io_base_virt - _IO_BASE); 1434 pci_add_resource_offset(resources, res,
1435 (__force resource_size_t)(hose->io_base_virt - _IO_BASE));
1437 1436
1438 pr_debug("PCI: PHB IO resource = %016llx-%016llx [%lx]\n", 1437 pr_debug("PCI: PHB IO resource = %016llx-%016llx [%lx]\n",
1439 (unsigned long long)res->start, 1438 (unsigned long long)res->start,
@@ -1477,7 +1476,7 @@ struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
1477 return of_node_get(hose->dn); 1476 return of_node_get(hose->dn);
1478} 1477}
1479 1478
1480static void __devinit pcibios_scan_phb(struct pci_controller *hose) 1479static void pcibios_scan_phb(struct pci_controller *hose)
1481{ 1480{
1482 LIST_HEAD(resources); 1481 LIST_HEAD(resources);
1483 struct pci_bus *bus; 1482 struct pci_bus *bus;
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index b7dc39c6c849..2ac626ab9d43 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -39,8 +39,8 @@ config MIPS
39 select GENERIC_CLOCKEVENTS 39 select GENERIC_CLOCKEVENTS
40 select GENERIC_CMOS_UPDATE 40 select GENERIC_CMOS_UPDATE
41 select HAVE_MOD_ARCH_SPECIFIC 41 select HAVE_MOD_ARCH_SPECIFIC
42 select MODULES_USE_ELF_REL 42 select MODULES_USE_ELF_REL if MODULES
43 select MODULES_USE_ELF_RELA if 64BIT 43 select MODULES_USE_ELF_RELA if MODULES && 64BIT
44 44
45menu "Machine selection" 45menu "Machine selection"
46 46
diff --git a/arch/mips/alchemy/common/time.c b/arch/mips/alchemy/common/time.c
index a7193ae13a5d..b67930d19325 100644
--- a/arch/mips/alchemy/common/time.c
+++ b/arch/mips/alchemy/common/time.c
@@ -53,7 +53,7 @@ static struct clocksource au1x_counter1_clocksource = {
53 .read = au1x_counter1_read, 53 .read = au1x_counter1_read,
54 .mask = CLOCKSOURCE_MASK(32), 54 .mask = CLOCKSOURCE_MASK(32),
55 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 55 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
56 .rating = 100, 56 .rating = 1500,
57}; 57};
58 58
59static int au1x_rtcmatch2_set_next_event(unsigned long delta, 59static int au1x_rtcmatch2_set_next_event(unsigned long delta,
@@ -84,7 +84,7 @@ static irqreturn_t au1x_rtcmatch2_irq(int irq, void *dev_id)
84static struct clock_event_device au1x_rtcmatch2_clockdev = { 84static struct clock_event_device au1x_rtcmatch2_clockdev = {
85 .name = "rtcmatch2", 85 .name = "rtcmatch2",
86 .features = CLOCK_EVT_FEAT_ONESHOT, 86 .features = CLOCK_EVT_FEAT_ONESHOT,
87 .rating = 100, 87 .rating = 1500,
88 .set_next_event = au1x_rtcmatch2_set_next_event, 88 .set_next_event = au1x_rtcmatch2_set_next_event,
89 .set_mode = au1x_rtcmatch2_set_mode, 89 .set_mode = au1x_rtcmatch2_set_mode,
90 .cpumask = cpu_all_mask, 90 .cpumask = cpu_all_mask,
@@ -158,20 +158,6 @@ cntr_err:
158 return -1; 158 return -1;
159} 159}
160 160
161static void __init alchemy_setup_c0timer(void)
162{
163 /*
164 * MIPS kernel assigns 'au1k_wait' to 'cpu_wait' before this
165 * function is called. Because the Alchemy counters are unusable
166 * the C0 timekeeping code is installed and use of the 'wait'
167 * instruction must be prohibited, which is done most easily by
168 * assigning NULL to cpu_wait.
169 */
170 cpu_wait = NULL;
171 r4k_clockevent_init();
172 init_r4k_clocksource();
173}
174
175static int alchemy_m2inttab[] __initdata = { 161static int alchemy_m2inttab[] __initdata = {
176 AU1000_RTC_MATCH2_INT, 162 AU1000_RTC_MATCH2_INT,
177 AU1500_RTC_MATCH2_INT, 163 AU1500_RTC_MATCH2_INT,
@@ -186,8 +172,7 @@ void __init plat_time_init(void)
186 int t; 172 int t;
187 173
188 t = alchemy_get_cputype(); 174 t = alchemy_get_cputype();
189 if (t == ALCHEMY_CPU_UNKNOWN) 175 if (t == ALCHEMY_CPU_UNKNOWN ||
190 alchemy_setup_c0timer(); 176 alchemy_time_init(alchemy_m2inttab[t]))
191 else if (alchemy_time_init(alchemy_m2inttab[t])) 177 cpu_wait = NULL; /* wait doesn't work with r4k timer */
192 alchemy_setup_c0timer();
193} 178}
diff --git a/arch/mips/bcm47xx/Kconfig b/arch/mips/bcm47xx/Kconfig
index d7af29f1fcf0..ba611927749b 100644
--- a/arch/mips/bcm47xx/Kconfig
+++ b/arch/mips/bcm47xx/Kconfig
@@ -8,8 +8,10 @@ config BCM47XX_SSB
8 select SSB_DRIVER_EXTIF 8 select SSB_DRIVER_EXTIF
9 select SSB_EMBEDDED 9 select SSB_EMBEDDED
10 select SSB_B43_PCI_BRIDGE if PCI 10 select SSB_B43_PCI_BRIDGE if PCI
11 select SSB_DRIVER_PCICORE if PCI
11 select SSB_PCICORE_HOSTMODE if PCI 12 select SSB_PCICORE_HOSTMODE if PCI
12 select SSB_DRIVER_GPIO 13 select SSB_DRIVER_GPIO
14 select GPIOLIB
13 default y 15 default y
14 help 16 help
15 Add support for old Broadcom BCM47xx boards with Sonics Silicon Backplane support. 17 Add support for old Broadcom BCM47xx boards with Sonics Silicon Backplane support.
@@ -25,6 +27,7 @@ config BCM47XX_BCMA
25 select BCMA_HOST_PCI if PCI 27 select BCMA_HOST_PCI if PCI
26 select BCMA_DRIVER_PCI_HOSTMODE if PCI 28 select BCMA_DRIVER_PCI_HOSTMODE if PCI
27 select BCMA_DRIVER_GPIO 29 select BCMA_DRIVER_GPIO
30 select GPIOLIB
28 default y 31 default y
29 help 32 help
30 Add support for new Broadcom BCM47xx boards with Broadcom specific Advanced Microcontroller Bus. 33 Add support for new Broadcom BCM47xx boards with Broadcom specific Advanced Microcontroller Bus.
diff --git a/arch/mips/cavium-octeon/executive/cvmx-l2c.c b/arch/mips/cavium-octeon/executive/cvmx-l2c.c
index 9f883bf76953..33b72144db31 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-l2c.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-l2c.c
@@ -30,6 +30,7 @@
30 * measurement, and debugging facilities. 30 * measurement, and debugging facilities.
31 */ 31 */
32 32
33#include <linux/compiler.h>
33#include <linux/irqflags.h> 34#include <linux/irqflags.h>
34#include <asm/octeon/cvmx.h> 35#include <asm/octeon/cvmx.h>
35#include <asm/octeon/cvmx-l2c.h> 36#include <asm/octeon/cvmx-l2c.h>
@@ -285,22 +286,22 @@ uint64_t cvmx_l2c_read_perf(uint32_t counter)
285 */ 286 */
286static void fault_in(uint64_t addr, int len) 287static void fault_in(uint64_t addr, int len)
287{ 288{
288 volatile char *ptr; 289 char *ptr;
289 volatile char dummy; 290
290 /* 291 /*
291 * Adjust addr and length so we get all cache lines even for 292 * Adjust addr and length so we get all cache lines even for
292 * small ranges spanning two cache lines. 293 * small ranges spanning two cache lines.
293 */ 294 */
294 len += addr & CVMX_CACHE_LINE_MASK; 295 len += addr & CVMX_CACHE_LINE_MASK;
295 addr &= ~CVMX_CACHE_LINE_MASK; 296 addr &= ~CVMX_CACHE_LINE_MASK;
296 ptr = (volatile char *)cvmx_phys_to_ptr(addr); 297 ptr = cvmx_phys_to_ptr(addr);
297 /* 298 /*
298 * Invalidate L1 cache to make sure all loads result in data 299 * Invalidate L1 cache to make sure all loads result in data
299 * being in L2. 300 * being in L2.
300 */ 301 */
301 CVMX_DCACHE_INVALIDATE; 302 CVMX_DCACHE_INVALIDATE;
302 while (len > 0) { 303 while (len > 0) {
303 dummy += *ptr; 304 ACCESS_ONCE(*ptr);
304 len -= CVMX_CACHE_LINE_SIZE; 305 len -= CVMX_CACHE_LINE_SIZE;
305 ptr += CVMX_CACHE_LINE_SIZE; 306 ptr += CVMX_CACHE_LINE_SIZE;
306 } 307 }
diff --git a/arch/mips/cavium-octeon/serial.c b/arch/mips/cavium-octeon/serial.c
index 569f41bdcc46..f393f65f3923 100644
--- a/arch/mips/cavium-octeon/serial.c
+++ b/arch/mips/cavium-octeon/serial.c
@@ -43,7 +43,7 @@ void octeon_serial_out(struct uart_port *up, int offset, int value)
43 cvmx_write_csr((uint64_t)(up->membase + (offset << 3)), (u8)value); 43 cvmx_write_csr((uint64_t)(up->membase + (offset << 3)), (u8)value);
44} 44}
45 45
46static int __devinit octeon_serial_probe(struct platform_device *pdev) 46static int octeon_serial_probe(struct platform_device *pdev)
47{ 47{
48 int irq, res; 48 int irq, res;
49 struct resource *res_mem; 49 struct resource *res_mem;
diff --git a/arch/mips/include/asm/dsp.h b/arch/mips/include/asm/dsp.h
index e9bfc0813c72..7bfad0520e25 100644
--- a/arch/mips/include/asm/dsp.h
+++ b/arch/mips/include/asm/dsp.h
@@ -16,7 +16,7 @@
16#include <asm/mipsregs.h> 16#include <asm/mipsregs.h>
17 17
18#define DSP_DEFAULT 0x00000000 18#define DSP_DEFAULT 0x00000000
19#define DSP_MASK 0x3ff 19#define DSP_MASK 0x3f
20 20
21#define __enable_dsp_hazard() \ 21#define __enable_dsp_hazard() \
22do { \ 22do { \
diff --git a/arch/mips/include/asm/inst.h b/arch/mips/include/asm/inst.h
index ab84064283db..33c34adbecfa 100644
--- a/arch/mips/include/asm/inst.h
+++ b/arch/mips/include/asm/inst.h
@@ -353,6 +353,7 @@ union mips_instruction {
353 struct u_format u_format; 353 struct u_format u_format;
354 struct c_format c_format; 354 struct c_format c_format;
355 struct r_format r_format; 355 struct r_format r_format;
356 struct p_format p_format;
356 struct f_format f_format; 357 struct f_format f_format;
357 struct ma_format ma_format; 358 struct ma_format ma_format;
358 struct b_format b_format; 359 struct b_format b_format;
diff --git a/arch/mips/include/asm/mach-pnx833x/war.h b/arch/mips/include/asm/mach-pnx833x/war.h
index edaa06d9d492..e410df4e1b3a 100644
--- a/arch/mips/include/asm/mach-pnx833x/war.h
+++ b/arch/mips/include/asm/mach-pnx833x/war.h
@@ -21,4 +21,4 @@
21#define R10000_LLSC_WAR 0 21#define R10000_LLSC_WAR 0
22#define MIPS34K_MISSED_ITLB_WAR 0 22#define MIPS34K_MISSED_ITLB_WAR 0
23 23
24#endif /* __ASM_MIPS_MACH_PNX8550_WAR_H */ 24#endif /* __ASM_MIPS_MACH_PNX833X_WAR_H */
diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h
index 31ab10f02bad..dbaec94046da 100644
--- a/arch/mips/include/asm/page.h
+++ b/arch/mips/include/asm/page.h
@@ -45,8 +45,6 @@
45#define HUGETLB_PAGE_ORDER ({BUILD_BUG(); 0; }) 45#define HUGETLB_PAGE_ORDER ({BUILD_BUG(); 0; })
46#endif /* CONFIG_MIPS_HUGE_TLB_SUPPORT */ 46#endif /* CONFIG_MIPS_HUGE_TLB_SUPPORT */
47 47
48#ifndef __ASSEMBLY__
49
50#include <linux/pfn.h> 48#include <linux/pfn.h>
51#include <asm/io.h> 49#include <asm/io.h>
52 50
@@ -139,8 +137,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
139 */ 137 */
140#define ptep_buddy(x) ((pte_t *)((unsigned long)(x) ^ sizeof(pte_t))) 138#define ptep_buddy(x) ((pte_t *)((unsigned long)(x) ^ sizeof(pte_t)))
141 139
142#endif /* !__ASSEMBLY__ */
143
144/* 140/*
145 * __pa()/__va() should be used only during mem init. 141 * __pa()/__va() should be used only during mem init.
146 */ 142 */
@@ -202,7 +198,10 @@ typedef struct { unsigned long pgprot; } pgprot_t;
202#endif 198#endif
203 199
204#define virt_to_page(kaddr) pfn_to_page(PFN_DOWN(virt_to_phys(kaddr))) 200#define virt_to_page(kaddr) pfn_to_page(PFN_DOWN(virt_to_phys(kaddr)))
205#define virt_addr_valid(kaddr) pfn_valid(PFN_DOWN(virt_to_phys(kaddr))) 201
202extern int __virt_addr_valid(const volatile void *kaddr);
203#define virt_addr_valid(kaddr) \
204 __virt_addr_valid((const volatile void *) (kaddr))
206 205
207#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 206#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
208 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 207 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
index 90bf3b3fce19..d69ea743272b 100644
--- a/arch/mips/include/asm/pci.h
+++ b/arch/mips/include/asm/pci.h
@@ -145,7 +145,7 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
145extern char * (*pcibios_plat_setup)(char *str); 145extern char * (*pcibios_plat_setup)(char *str);
146 146
147/* this function parses memory ranges from a device node */ 147/* this function parses memory ranges from a device node */
148extern void __devinit pci_load_of_ranges(struct pci_controller *hose, 148extern void pci_load_of_ranges(struct pci_controller *hose,
149 struct device_node *node); 149 struct device_node *node);
150 150
151#endif /* _ASM_PCI_H */ 151#endif /* _ASM_PCI_H */
diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h
index c63191055e69..013d5f781263 100644
--- a/arch/mips/include/asm/pgtable-64.h
+++ b/arch/mips/include/asm/pgtable-64.h
@@ -230,6 +230,7 @@ static inline void pud_clear(pud_t *pudp)
230#else 230#else
231#define pte_pfn(x) ((unsigned long)((x).pte >> _PFN_SHIFT)) 231#define pte_pfn(x) ((unsigned long)((x).pte >> _PFN_SHIFT))
232#define pfn_pte(pfn, prot) __pte(((pfn) << _PFN_SHIFT) | pgprot_val(prot)) 232#define pfn_pte(pfn, prot) __pte(((pfn) << _PFN_SHIFT) | pgprot_val(prot))
233#define pfn_pmd(pfn, prot) __pmd(((pfn) << _PFN_SHIFT) | pgprot_val(prot))
233#endif 234#endif
234 235
235#define __pgd_offset(address) pgd_index(address) 236#define __pgd_offset(address) pgd_index(address)
diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h
index 18806a52061c..b2050b9e64b1 100644
--- a/arch/mips/include/asm/thread_info.h
+++ b/arch/mips/include/asm/thread_info.h
@@ -29,10 +29,11 @@ struct thread_info {
29 __u32 cpu; /* current CPU */ 29 __u32 cpu; /* current CPU */
30 int preempt_count; /* 0 => preemptable, <0 => BUG */ 30 int preempt_count; /* 0 => preemptable, <0 => BUG */
31 31
32 mm_segment_t addr_limit; /* thread address space: 32 mm_segment_t addr_limit; /*
33 0-0xBFFFFFFF for user-thead 33 * thread address space limit:
34 0-0xFFFFFFFF for kernel-thread 34 * 0x7fffffff for user-thead
35 */ 35 * 0xffffffff for kernel-thread
36 */
36 struct restart_block restart_block; 37 struct restart_block restart_block;
37 struct pt_regs *regs; 38 struct pt_regs *regs;
38}; 39};
diff --git a/arch/mips/include/uapi/asm/Kbuild b/arch/mips/include/uapi/asm/Kbuild
index a1a0452ac185..77d4fb33f75a 100644
--- a/arch/mips/include/uapi/asm/Kbuild
+++ b/arch/mips/include/uapi/asm/Kbuild
@@ -3,6 +3,7 @@ include include/uapi/asm-generic/Kbuild.asm
3 3
4header-y += auxvec.h 4header-y += auxvec.h
5header-y += bitsperlong.h 5header-y += bitsperlong.h
6header-y += break.h
6header-y += byteorder.h 7header-y += byteorder.h
7header-y += cachectl.h 8header-y += cachectl.h
8header-y += errno.h 9header-y += errno.h
diff --git a/arch/mips/include/asm/break.h b/arch/mips/include/uapi/asm/break.h
index 9161e684cb4c..9161e684cb4c 100644
--- a/arch/mips/include/asm/break.h
+++ b/arch/mips/include/uapi/asm/break.h
diff --git a/arch/mips/include/uapi/asm/unistd.h b/arch/mips/include/uapi/asm/unistd.h
index cc98a9dcb01b..0eebf3c3e03c 100644
--- a/arch/mips/include/uapi/asm/unistd.h
+++ b/arch/mips/include/uapi/asm/unistd.h
@@ -368,16 +368,17 @@
368#define __NR_process_vm_readv (__NR_Linux + 345) 368#define __NR_process_vm_readv (__NR_Linux + 345)
369#define __NR_process_vm_writev (__NR_Linux + 346) 369#define __NR_process_vm_writev (__NR_Linux + 346)
370#define __NR_kcmp (__NR_Linux + 347) 370#define __NR_kcmp (__NR_Linux + 347)
371#define __NR_finit_module (__NR_Linux + 348)
371 372
372/* 373/*
373 * Offset of the last Linux o32 flavoured syscall 374 * Offset of the last Linux o32 flavoured syscall
374 */ 375 */
375#define __NR_Linux_syscalls 347 376#define __NR_Linux_syscalls 348
376 377
377#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 378#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
378 379
379#define __NR_O32_Linux 4000 380#define __NR_O32_Linux 4000
380#define __NR_O32_Linux_syscalls 347 381#define __NR_O32_Linux_syscalls 348
381 382
382#if _MIPS_SIM == _MIPS_SIM_ABI64 383#if _MIPS_SIM == _MIPS_SIM_ABI64
383 384
@@ -692,16 +693,17 @@
692#define __NR_process_vm_readv (__NR_Linux + 304) 693#define __NR_process_vm_readv (__NR_Linux + 304)
693#define __NR_process_vm_writev (__NR_Linux + 305) 694#define __NR_process_vm_writev (__NR_Linux + 305)
694#define __NR_kcmp (__NR_Linux + 306) 695#define __NR_kcmp (__NR_Linux + 306)
696#define __NR_finit_module (__NR_Linux + 307)
695 697
696/* 698/*
697 * Offset of the last Linux 64-bit flavoured syscall 699 * Offset of the last Linux 64-bit flavoured syscall
698 */ 700 */
699#define __NR_Linux_syscalls 306 701#define __NR_Linux_syscalls 307
700 702
701#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ 703#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
702 704
703#define __NR_64_Linux 5000 705#define __NR_64_Linux 5000
704#define __NR_64_Linux_syscalls 306 706#define __NR_64_Linux_syscalls 307
705 707
706#if _MIPS_SIM == _MIPS_SIM_NABI32 708#if _MIPS_SIM == _MIPS_SIM_NABI32
707 709
@@ -1021,15 +1023,16 @@
1021#define __NR_process_vm_readv (__NR_Linux + 309) 1023#define __NR_process_vm_readv (__NR_Linux + 309)
1022#define __NR_process_vm_writev (__NR_Linux + 310) 1024#define __NR_process_vm_writev (__NR_Linux + 310)
1023#define __NR_kcmp (__NR_Linux + 311) 1025#define __NR_kcmp (__NR_Linux + 311)
1026#define __NR_finit_module (__NR_Linux + 312)
1024 1027
1025/* 1028/*
1026 * Offset of the last N32 flavoured syscall 1029 * Offset of the last N32 flavoured syscall
1027 */ 1030 */
1028#define __NR_Linux_syscalls 311 1031#define __NR_Linux_syscalls 312
1029 1032
1030#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ 1033#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
1031 1034
1032#define __NR_N32_Linux 6000 1035#define __NR_N32_Linux 6000
1033#define __NR_N32_Linux_syscalls 311 1036#define __NR_N32_Linux_syscalls 312
1034 1037
1035#endif /* _UAPI_ASM_UNISTD_H */ 1038#endif /* _UAPI_ASM_UNISTD_H */
diff --git a/arch/mips/kernel/asm-offsets.c b/arch/mips/kernel/asm-offsets.c
index 9690998d4ef3..50285b2c7ffe 100644
--- a/arch/mips/kernel/asm-offsets.c
+++ b/arch/mips/kernel/asm-offsets.c
@@ -200,6 +200,9 @@ void output_mm_defines(void)
200 DEFINE(_PTRS_PER_PMD, PTRS_PER_PMD); 200 DEFINE(_PTRS_PER_PMD, PTRS_PER_PMD);
201 DEFINE(_PTRS_PER_PTE, PTRS_PER_PTE); 201 DEFINE(_PTRS_PER_PTE, PTRS_PER_PTE);
202 BLANK(); 202 BLANK();
203 DEFINE(_PAGE_SHIFT, PAGE_SHIFT);
204 DEFINE(_PAGE_SIZE, PAGE_SIZE);
205 BLANK();
203} 206}
204 207
205#ifdef CONFIG_32BIT 208#ifdef CONFIG_32BIT
diff --git a/arch/mips/kernel/ftrace.c b/arch/mips/kernel/ftrace.c
index 6a2d758dd8e9..83fa1460e294 100644
--- a/arch/mips/kernel/ftrace.c
+++ b/arch/mips/kernel/ftrace.c
@@ -25,6 +25,12 @@
25#define MCOUNT_OFFSET_INSNS 4 25#define MCOUNT_OFFSET_INSNS 4
26#endif 26#endif
27 27
28/* Arch override because MIPS doesn't need to run this from stop_machine() */
29void arch_ftrace_update_code(int command)
30{
31 ftrace_modify_all_code(command);
32}
33
28/* 34/*
29 * Check if the address is in kernel space 35 * Check if the address is in kernel space
30 * 36 *
@@ -89,6 +95,24 @@ static int ftrace_modify_code(unsigned long ip, unsigned int new_code)
89 return 0; 95 return 0;
90} 96}
91 97
98#ifndef CONFIG_64BIT
99static int ftrace_modify_code_2(unsigned long ip, unsigned int new_code1,
100 unsigned int new_code2)
101{
102 int faulted;
103
104 safe_store_code(new_code1, ip, faulted);
105 if (unlikely(faulted))
106 return -EFAULT;
107 ip += 4;
108 safe_store_code(new_code2, ip, faulted);
109 if (unlikely(faulted))
110 return -EFAULT;
111 flush_icache_range(ip, ip + 8); /* original ip + 12 */
112 return 0;
113}
114#endif
115
92/* 116/*
93 * The details about the calling site of mcount on MIPS 117 * The details about the calling site of mcount on MIPS
94 * 118 *
@@ -131,8 +155,18 @@ int ftrace_make_nop(struct module *mod,
131 * needed. 155 * needed.
132 */ 156 */
133 new = in_kernel_space(ip) ? INSN_NOP : INSN_B_1F; 157 new = in_kernel_space(ip) ? INSN_NOP : INSN_B_1F;
134 158#ifdef CONFIG_64BIT
135 return ftrace_modify_code(ip, new); 159 return ftrace_modify_code(ip, new);
160#else
161 /*
162 * On 32 bit MIPS platforms, gcc adds a stack adjust
163 * instruction in the delay slot after the branch to
164 * mcount and expects mcount to restore the sp on return.
165 * This is based on a legacy API and does nothing but
166 * waste instructions so it's being removed at runtime.
167 */
168 return ftrace_modify_code_2(ip, new, INSN_NOP);
169#endif
136} 170}
137 171
138int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) 172int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
index 8882e5766f27..8a0096d62812 100644
--- a/arch/mips/kernel/genex.S
+++ b/arch/mips/kernel/genex.S
@@ -19,7 +19,6 @@
19#include <asm/mipsregs.h> 19#include <asm/mipsregs.h>
20#include <asm/stackframe.h> 20#include <asm/stackframe.h>
21#include <asm/war.h> 21#include <asm/war.h>
22#include <asm/page.h>
23#include <asm/thread_info.h> 22#include <asm/thread_info.h>
24 23
25#define PANIC_PIC(msg) \ 24#define PANIC_PIC(msg) \
@@ -483,8 +482,8 @@ NESTED(nmi_handler, PT_SIZE, sp)
483 MFC0 k1, CP0_ENTRYHI 482 MFC0 k1, CP0_ENTRYHI
484 andi k1, 0xff /* ASID_MASK */ 483 andi k1, 0xff /* ASID_MASK */
485 MFC0 k0, CP0_EPC 484 MFC0 k0, CP0_EPC
486 PTR_SRL k0, PAGE_SHIFT + 1 485 PTR_SRL k0, _PAGE_SHIFT + 1
487 PTR_SLL k0, PAGE_SHIFT + 1 486 PTR_SLL k0, _PAGE_SHIFT + 1
488 or k1, k0 487 or k1, k0
489 MTC0 k1, CP0_ENTRYHI 488 MTC0 k1, CP0_ENTRYHI
490 mtc0_tlbw_hazard 489 mtc0_tlbw_hazard
diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S
index ea695d9605e9..fcf97312f328 100644
--- a/arch/mips/kernel/head.S
+++ b/arch/mips/kernel/head.S
@@ -21,7 +21,6 @@
21#include <asm/asmmacro.h> 21#include <asm/asmmacro.h>
22#include <asm/irqflags.h> 22#include <asm/irqflags.h>
23#include <asm/regdef.h> 23#include <asm/regdef.h>
24#include <asm/page.h>
25#include <asm/pgtable-bits.h> 24#include <asm/pgtable-bits.h>
26#include <asm/mipsregs.h> 25#include <asm/mipsregs.h>
27#include <asm/stackframe.h> 26#include <asm/stackframe.h>
diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S
index 4c968e7efb74..165867673357 100644
--- a/arch/mips/kernel/mcount.S
+++ b/arch/mips/kernel/mcount.S
@@ -46,9 +46,8 @@
46 PTR_L a5, PT_R9(sp) 46 PTR_L a5, PT_R9(sp)
47 PTR_L a6, PT_R10(sp) 47 PTR_L a6, PT_R10(sp)
48 PTR_L a7, PT_R11(sp) 48 PTR_L a7, PT_R11(sp)
49 PTR_ADDIU sp, PT_SIZE
50#else 49#else
51 PTR_ADDIU sp, (PT_SIZE + 8) 50 PTR_ADDIU sp, PT_SIZE
52#endif 51#endif
53.endm 52.endm
54 53
@@ -69,7 +68,9 @@ NESTED(ftrace_caller, PT_SIZE, ra)
69 .globl _mcount 68 .globl _mcount
70_mcount: 69_mcount:
71 b ftrace_stub 70 b ftrace_stub
72 nop 71 addiu sp,sp,8
72
73 /* When tracing is activated, it calls ftrace_caller+8 (aka here) */
73 lw t1, function_trace_stop 74 lw t1, function_trace_stop
74 bnez t1, ftrace_stub 75 bnez t1, ftrace_stub
75 nop 76 nop
diff --git a/arch/mips/kernel/octeon_switch.S b/arch/mips/kernel/octeon_switch.S
index 0441f54b2a6a..207f1341578b 100644
--- a/arch/mips/kernel/octeon_switch.S
+++ b/arch/mips/kernel/octeon_switch.S
@@ -15,7 +15,6 @@
15#include <asm/fpregdef.h> 15#include <asm/fpregdef.h>
16#include <asm/mipsregs.h> 16#include <asm/mipsregs.h>
17#include <asm/asm-offsets.h> 17#include <asm/asm-offsets.h>
18#include <asm/page.h>
19#include <asm/pgtable-bits.h> 18#include <asm/pgtable-bits.h>
20#include <asm/regdef.h> 19#include <asm/regdef.h>
21#include <asm/stackframe.h> 20#include <asm/stackframe.h>
diff --git a/arch/mips/kernel/perf_event_mipsxx.c b/arch/mips/kernel/perf_event_mipsxx.c
index b14c14d90fc2..d9c81c5a6c90 100644
--- a/arch/mips/kernel/perf_event_mipsxx.c
+++ b/arch/mips/kernel/perf_event_mipsxx.c
@@ -847,7 +847,6 @@ static const struct mips_perf_event xlp_event_map[PERF_COUNT_HW_MAX] = {
847 [PERF_COUNT_HW_CACHE_MISSES] = { 0x07, CNTR_ALL }, /* PAPI_L1_ICM */ 847 [PERF_COUNT_HW_CACHE_MISSES] = { 0x07, CNTR_ALL }, /* PAPI_L1_ICM */
848 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = { 0x1b, CNTR_ALL }, /* PAPI_BR_CN */ 848 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = { 0x1b, CNTR_ALL }, /* PAPI_BR_CN */
849 [PERF_COUNT_HW_BRANCH_MISSES] = { 0x1c, CNTR_ALL }, /* PAPI_BR_MSP */ 849 [PERF_COUNT_HW_BRANCH_MISSES] = { 0x1c, CNTR_ALL }, /* PAPI_BR_MSP */
850 [PERF_COUNT_HW_BUS_CYCLES] = { UNSUPPORTED_PERF_EVENT_ID },
851}; 850};
852 851
853/* 24K/34K/1004K cores can share the same cache event map. */ 852/* 24K/34K/1004K cores can share the same cache event map. */
@@ -1115,24 +1114,12 @@ static const struct mips_perf_event xlp_cache_map
1115 [C(RESULT_ACCESS)] = { 0x2f, CNTR_ALL }, /* PAPI_L1_DCW */ 1114 [C(RESULT_ACCESS)] = { 0x2f, CNTR_ALL }, /* PAPI_L1_DCW */
1116 [C(RESULT_MISS)] = { 0x2e, CNTR_ALL }, /* PAPI_L1_STM */ 1115 [C(RESULT_MISS)] = { 0x2e, CNTR_ALL }, /* PAPI_L1_STM */
1117 }, 1116 },
1118 [C(OP_PREFETCH)] = {
1119 [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID },
1120 [C(RESULT_MISS)] = { UNSUPPORTED_PERF_EVENT_ID },
1121 },
1122}, 1117},
1123[C(L1I)] = { 1118[C(L1I)] = {
1124 [C(OP_READ)] = { 1119 [C(OP_READ)] = {
1125 [C(RESULT_ACCESS)] = { 0x04, CNTR_ALL }, /* PAPI_L1_ICA */ 1120 [C(RESULT_ACCESS)] = { 0x04, CNTR_ALL }, /* PAPI_L1_ICA */
1126 [C(RESULT_MISS)] = { 0x07, CNTR_ALL }, /* PAPI_L1_ICM */ 1121 [C(RESULT_MISS)] = { 0x07, CNTR_ALL }, /* PAPI_L1_ICM */
1127 }, 1122 },
1128 [C(OP_WRITE)] = {
1129 [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID },
1130 [C(RESULT_MISS)] = { UNSUPPORTED_PERF_EVENT_ID },
1131 },
1132 [C(OP_PREFETCH)] = {
1133 [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID },
1134 [C(RESULT_MISS)] = { UNSUPPORTED_PERF_EVENT_ID },
1135 },
1136}, 1123},
1137[C(LL)] = { 1124[C(LL)] = {
1138 [C(OP_READ)] = { 1125 [C(OP_READ)] = {
@@ -1143,10 +1130,6 @@ static const struct mips_perf_event xlp_cache_map
1143 [C(RESULT_ACCESS)] = { 0x34, CNTR_ALL }, /* PAPI_L2_DCA */ 1130 [C(RESULT_ACCESS)] = { 0x34, CNTR_ALL }, /* PAPI_L2_DCA */
1144 [C(RESULT_MISS)] = { 0x36, CNTR_ALL }, /* PAPI_L2_DCM */ 1131 [C(RESULT_MISS)] = { 0x36, CNTR_ALL }, /* PAPI_L2_DCM */
1145 }, 1132 },
1146 [C(OP_PREFETCH)] = {
1147 [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID },
1148 [C(RESULT_MISS)] = { UNSUPPORTED_PERF_EVENT_ID },
1149 },
1150}, 1133},
1151[C(DTLB)] = { 1134[C(DTLB)] = {
1152 /* 1135 /*
@@ -1154,45 +1137,24 @@ static const struct mips_perf_event xlp_cache_map
1154 * read and write. 1137 * read and write.
1155 */ 1138 */
1156 [C(OP_READ)] = { 1139 [C(OP_READ)] = {
1157 [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID },
1158 [C(RESULT_MISS)] = { 0x2d, CNTR_ALL }, /* PAPI_TLB_DM */ 1140 [C(RESULT_MISS)] = { 0x2d, CNTR_ALL }, /* PAPI_TLB_DM */
1159 }, 1141 },
1160 [C(OP_WRITE)] = { 1142 [C(OP_WRITE)] = {
1161 [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID },
1162 [C(RESULT_MISS)] = { 0x2d, CNTR_ALL }, /* PAPI_TLB_DM */ 1143 [C(RESULT_MISS)] = { 0x2d, CNTR_ALL }, /* PAPI_TLB_DM */
1163 }, 1144 },
1164 [C(OP_PREFETCH)] = {
1165 [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID },
1166 [C(RESULT_MISS)] = { UNSUPPORTED_PERF_EVENT_ID },
1167 },
1168}, 1145},
1169[C(ITLB)] = { 1146[C(ITLB)] = {
1170 [C(OP_READ)] = { 1147 [C(OP_READ)] = {
1171 [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID },
1172 [C(RESULT_MISS)] = { 0x08, CNTR_ALL }, /* PAPI_TLB_IM */ 1148 [C(RESULT_MISS)] = { 0x08, CNTR_ALL }, /* PAPI_TLB_IM */
1173 }, 1149 },
1174 [C(OP_WRITE)] = { 1150 [C(OP_WRITE)] = {
1175 [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID },
1176 [C(RESULT_MISS)] = { 0x08, CNTR_ALL }, /* PAPI_TLB_IM */ 1151 [C(RESULT_MISS)] = { 0x08, CNTR_ALL }, /* PAPI_TLB_IM */
1177 }, 1152 },
1178 [C(OP_PREFETCH)] = {
1179 [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID },
1180 [C(RESULT_MISS)] = { UNSUPPORTED_PERF_EVENT_ID },
1181 },
1182}, 1153},
1183[C(BPU)] = { 1154[C(BPU)] = {
1184 [C(OP_READ)] = { 1155 [C(OP_READ)] = {
1185 [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID },
1186 [C(RESULT_MISS)] = { 0x25, CNTR_ALL }, 1156 [C(RESULT_MISS)] = { 0x25, CNTR_ALL },
1187 }, 1157 },
1188 [C(OP_WRITE)] = {
1189 [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID },
1190 [C(RESULT_MISS)] = { UNSUPPORTED_PERF_EVENT_ID },
1191 },
1192 [C(OP_PREFETCH)] = {
1193 [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID },
1194 [C(RESULT_MISS)] = { UNSUPPORTED_PERF_EVENT_ID },
1195 },
1196}, 1158},
1197}; 1159};
1198 1160
diff --git a/arch/mips/kernel/r2300_switch.S b/arch/mips/kernel/r2300_switch.S
index 9c51be5a163a..8d32d5a6b460 100644
--- a/arch/mips/kernel/r2300_switch.S
+++ b/arch/mips/kernel/r2300_switch.S
@@ -15,7 +15,6 @@
15#include <asm/fpregdef.h> 15#include <asm/fpregdef.h>
16#include <asm/mipsregs.h> 16#include <asm/mipsregs.h>
17#include <asm/asm-offsets.h> 17#include <asm/asm-offsets.h>
18#include <asm/page.h>
19#include <asm/regdef.h> 18#include <asm/regdef.h>
20#include <asm/stackframe.h> 19#include <asm/stackframe.h>
21#include <asm/thread_info.h> 20#include <asm/thread_info.h>
diff --git a/arch/mips/kernel/r4k_switch.S b/arch/mips/kernel/r4k_switch.S
index 42d2a3938420..8decdfacb448 100644
--- a/arch/mips/kernel/r4k_switch.S
+++ b/arch/mips/kernel/r4k_switch.S
@@ -15,7 +15,6 @@
15#include <asm/fpregdef.h> 15#include <asm/fpregdef.h>
16#include <asm/mipsregs.h> 16#include <asm/mipsregs.h>
17#include <asm/asm-offsets.h> 17#include <asm/asm-offsets.h>
18#include <asm/page.h>
19#include <asm/pgtable-bits.h> 18#include <asm/pgtable-bits.h>
20#include <asm/regdef.h> 19#include <asm/regdef.h>
21#include <asm/stackframe.h> 20#include <asm/stackframe.h>
diff --git a/arch/mips/kernel/relocate_kernel.S b/arch/mips/kernel/relocate_kernel.S
index e4142c5f7c2b..804ebb2c34a6 100644
--- a/arch/mips/kernel/relocate_kernel.S
+++ b/arch/mips/kernel/relocate_kernel.S
@@ -9,7 +9,6 @@
9#include <asm/asm.h> 9#include <asm/asm.h>
10#include <asm/asmmacro.h> 10#include <asm/asmmacro.h>
11#include <asm/regdef.h> 11#include <asm/regdef.h>
12#include <asm/page.h>
13#include <asm/mipsregs.h> 12#include <asm/mipsregs.h>
14#include <asm/stackframe.h> 13#include <asm/stackframe.h>
15#include <asm/addrspace.h> 14#include <asm/addrspace.h>
@@ -50,7 +49,7 @@ process_entry:
50 and s3, s2, 0x8 49 and s3, s2, 0x8
51 beq s3, zero, process_entry 50 beq s3, zero, process_entry
52 and s2, s2, ~0x8 51 and s2, s2, ~0x8
53 li s6, (1 << PAGE_SHIFT) / SZREG 52 li s6, (1 << _PAGE_SHIFT) / SZREG
54 53
55copy_word: 54copy_word:
56 /* copy page word by word */ 55 /* copy page word by word */
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index 374f66e05f3d..d20a4bc9ed05 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -583,6 +583,7 @@ einval: li v0, -ENOSYS
583 sys sys_process_vm_readv 6 /* 4345 */ 583 sys sys_process_vm_readv 6 /* 4345 */
584 sys sys_process_vm_writev 6 584 sys sys_process_vm_writev 6
585 sys sys_kcmp 5 585 sys sys_kcmp 5
586 sys sys_finit_module 3
586 .endm 587 .endm
587 588
588 /* We pre-compute the number of _instruction_ bytes needed to 589 /* We pre-compute the number of _instruction_ bytes needed to
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index 169de6a6d916..b64f642da073 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -422,4 +422,5 @@ sys_call_table:
422 PTR sys_process_vm_readv 422 PTR sys_process_vm_readv
423 PTR sys_process_vm_writev /* 5305 */ 423 PTR sys_process_vm_writev /* 5305 */
424 PTR sys_kcmp 424 PTR sys_kcmp
425 PTR sys_finit_module
425 .size sys_call_table,.-sys_call_table 426 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index ad3de9668da9..c29ac197f446 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -416,4 +416,5 @@ EXPORT(sysn32_call_table)
416 PTR compat_sys_process_vm_readv 416 PTR compat_sys_process_vm_readv
417 PTR compat_sys_process_vm_writev /* 6310 */ 417 PTR compat_sys_process_vm_writev /* 6310 */
418 PTR sys_kcmp 418 PTR sys_kcmp
419 PTR sys_finit_module
419 .size sysn32_call_table,.-sysn32_call_table 420 .size sysn32_call_table,.-sysn32_call_table
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 9601be6afa3d..cf3e75e46650 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -540,4 +540,5 @@ sys_call_table:
540 PTR compat_sys_process_vm_readv /* 4345 */ 540 PTR compat_sys_process_vm_readv /* 4345 */
541 PTR compat_sys_process_vm_writev 541 PTR compat_sys_process_vm_writev
542 PTR sys_kcmp 542 PTR sys_kcmp
543 PTR sys_finit_module
543 .size sys_call_table,.-sys_call_table 544 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 2e6374a589ec..66bf4e22d9b9 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -188,7 +188,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
188} 188}
189 189
190/* preload SMP state for boot cpu */ 190/* preload SMP state for boot cpu */
191void __devinit smp_prepare_boot_cpu(void) 191void smp_prepare_boot_cpu(void)
192{ 192{
193 set_cpu_possible(0, true); 193 set_cpu_possible(0, true);
194 set_cpu_online(0, true); 194 set_cpu_online(0, true);
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index 007ccbe1e264..0a4336b803e9 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -1,7 +1,8 @@
1#include <asm/asm-offsets.h> 1#include <asm/asm-offsets.h>
2#include <asm/page.h>
3#include <asm/thread_info.h> 2#include <asm/thread_info.h>
4 3
4#define PAGE_SIZE _PAGE_SIZE
5
5/* 6/*
6 * Put .bss..swapper_pg_dir as the first thing in .bss. This will 7 * Put .bss..swapper_pg_dir as the first thing in .bss. This will
7 * ensure that it has .bss alignment (64K). 8 * ensure that it has .bss alignment (64K).
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index eec690af6581..147cec19621d 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -705,7 +705,7 @@ static int vpe_run(struct vpe * v)
705 705
706 printk(KERN_WARNING 706 printk(KERN_WARNING
707 "VPE loader: TC %d is already in use.\n", 707 "VPE loader: TC %d is already in use.\n",
708 t->index); 708 v->tc->index);
709 return -ENOEXEC; 709 return -ENOEXEC;
710 } 710 }
711 } else { 711 } else {
diff --git a/arch/mips/lantiq/irq.c b/arch/mips/lantiq/irq.c
index f36acd1b3808..a7935bf0fecb 100644
--- a/arch/mips/lantiq/irq.c
+++ b/arch/mips/lantiq/irq.c
@@ -408,7 +408,7 @@ int __init icu_of_init(struct device_node *node, struct device_node *parent)
408#endif 408#endif
409 409
410 /* tell oprofile which irq to use */ 410 /* tell oprofile which irq to use */
411 cp0_perfcount_irq = LTQ_PERF_IRQ; 411 cp0_perfcount_irq = irq_create_mapping(ltq_domain, LTQ_PERF_IRQ);
412 412
413 /* 413 /*
414 * if the timer irq is not one of the mips irqs we need to 414 * if the timer irq is not one of the mips irqs we need to
diff --git a/arch/mips/lantiq/xway/dma.c b/arch/mips/lantiq/xway/dma.c
index 6453962ac898..e44a1866653f 100644
--- a/arch/mips/lantiq/xway/dma.c
+++ b/arch/mips/lantiq/xway/dma.c
@@ -210,7 +210,7 @@ ltq_dma_init_port(int p)
210} 210}
211EXPORT_SYMBOL_GPL(ltq_dma_init_port); 211EXPORT_SYMBOL_GPL(ltq_dma_init_port);
212 212
213static int __devinit 213static int
214ltq_dma_init(struct platform_device *pdev) 214ltq_dma_init(struct platform_device *pdev)
215{ 215{
216 struct clk *clk; 216 struct clk *clk;
diff --git a/arch/mips/lantiq/xway/gptu.c b/arch/mips/lantiq/xway/gptu.c
index cbb56fc022bc..e30b1ed1b936 100644
--- a/arch/mips/lantiq/xway/gptu.c
+++ b/arch/mips/lantiq/xway/gptu.c
@@ -133,7 +133,7 @@ static inline void clkdev_add_gptu(struct device *dev, const char *con,
133 clkdev_add(&clk->cl); 133 clkdev_add(&clk->cl);
134} 134}
135 135
136static int __devinit gptu_probe(struct platform_device *pdev) 136static int gptu_probe(struct platform_device *pdev)
137{ 137{
138 struct clk *clk; 138 struct clk *clk;
139 struct resource *res; 139 struct resource *res;
diff --git a/arch/mips/lantiq/xway/xrx200_phy_fw.c b/arch/mips/lantiq/xway/xrx200_phy_fw.c
index fe808bf5366d..d4d9d31f152e 100644
--- a/arch/mips/lantiq/xway/xrx200_phy_fw.c
+++ b/arch/mips/lantiq/xway/xrx200_phy_fw.c
@@ -54,7 +54,7 @@ static dma_addr_t xway_gphy_load(struct platform_device *pdev)
54 return dev_addr; 54 return dev_addr;
55} 55}
56 56
57static int __devinit xway_phy_fw_probe(struct platform_device *pdev) 57static int xway_phy_fw_probe(struct platform_device *pdev)
58{ 58{
59 dma_addr_t fw_addr; 59 dma_addr_t fw_addr;
60 struct property *pp; 60 struct property *pp;
diff --git a/arch/mips/lib/delay.c b/arch/mips/lib/delay.c
index dc81ca8dc0dd..288f7954988d 100644
--- a/arch/mips/lib/delay.c
+++ b/arch/mips/lib/delay.c
@@ -21,7 +21,7 @@ void __delay(unsigned long loops)
21 " .set noreorder \n" 21 " .set noreorder \n"
22 " .align 3 \n" 22 " .align 3 \n"
23 "1: bnez %0, 1b \n" 23 "1: bnez %0, 1b \n"
24#if __SIZEOF_LONG__ == 4 24#if BITS_PER_LONG == 32
25 " subu %0, 1 \n" 25 " subu %0, 1 \n"
26#else 26#else
27 " dsubu %0, 1 \n" 27 " dsubu %0, 1 \n"
diff --git a/arch/mips/mm/mmap.c b/arch/mips/mm/mmap.c
index d9be7540a6be..7e5fe2790d8a 100644
--- a/arch/mips/mm/mmap.c
+++ b/arch/mips/mm/mmap.c
@@ -192,3 +192,9 @@ unsigned long arch_randomize_brk(struct mm_struct *mm)
192 192
193 return ret; 193 return ret;
194} 194}
195
196int __virt_addr_valid(const volatile void *kaddr)
197{
198 return pfn_valid(PFN_DOWN(virt_to_phys(kaddr)));
199}
200EXPORT_SYMBOL_GPL(__virt_addr_valid);
diff --git a/arch/mips/mm/tlbex-fault.S b/arch/mips/mm/tlbex-fault.S
index e99eaa1fbedc..318855eb5f80 100644
--- a/arch/mips/mm/tlbex-fault.S
+++ b/arch/mips/mm/tlbex-fault.S
@@ -7,7 +7,6 @@
7 * Copyright (C) 1999 Silicon Graphics, Inc. 7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 */ 8 */
9#include <asm/mipsregs.h> 9#include <asm/mipsregs.h>
10#include <asm/page.h>
11#include <asm/regdef.h> 10#include <asm/regdef.h>
12#include <asm/stackframe.h> 11#include <asm/stackframe.h>
13 12
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index 05613355627b..1c8ac49ec72c 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -976,13 +976,6 @@ build_get_pgde32(u32 **p, unsigned int tmp, unsigned int ptr)
976#endif 976#endif
977 uasm_i_mfc0(p, tmp, C0_BADVADDR); /* get faulting address */ 977 uasm_i_mfc0(p, tmp, C0_BADVADDR); /* get faulting address */
978 uasm_i_lw(p, ptr, uasm_rel_lo(pgdc), ptr); 978 uasm_i_lw(p, ptr, uasm_rel_lo(pgdc), ptr);
979
980 if (cpu_has_mips_r2) {
981 uasm_i_ext(p, tmp, tmp, PGDIR_SHIFT, (32 - PGDIR_SHIFT));
982 uasm_i_ins(p, ptr, tmp, PGD_T_LOG2, (32 - PGDIR_SHIFT));
983 return;
984 }
985
986 uasm_i_srl(p, tmp, tmp, PGDIR_SHIFT); /* get pgd only bits */ 979 uasm_i_srl(p, tmp, tmp, PGDIR_SHIFT); /* get pgd only bits */
987 uasm_i_sll(p, tmp, tmp, PGD_T_LOG2); 980 uasm_i_sll(p, tmp, tmp, PGD_T_LOG2);
988 uasm_i_addu(p, ptr, ptr, tmp); /* add in pgd offset */ 981 uasm_i_addu(p, ptr, ptr, tmp); /* add in pgd offset */
@@ -1018,15 +1011,6 @@ static void __cpuinit build_adjust_context(u32 **p, unsigned int ctx)
1018 1011
1019static void __cpuinit build_get_ptep(u32 **p, unsigned int tmp, unsigned int ptr) 1012static void __cpuinit build_get_ptep(u32 **p, unsigned int tmp, unsigned int ptr)
1020{ 1013{
1021 if (cpu_has_mips_r2) {
1022 /* PTE ptr offset is obtained from BadVAddr */
1023 UASM_i_MFC0(p, tmp, C0_BADVADDR);
1024 UASM_i_LW(p, ptr, 0, ptr);
1025 uasm_i_ext(p, tmp, tmp, PAGE_SHIFT+1, PGDIR_SHIFT-PAGE_SHIFT-1);
1026 uasm_i_ins(p, ptr, tmp, PTE_T_LOG2+1, PGDIR_SHIFT-PAGE_SHIFT-1);
1027 return;
1028 }
1029
1030 /* 1014 /*
1031 * Bug workaround for the Nevada. It seems as if under certain 1015 * Bug workaround for the Nevada. It seems as if under certain
1032 * circumstances the move from cp0_context might produce a 1016 * circumstances the move from cp0_context might produce a
diff --git a/arch/mips/mti-sead3/sead3-i2c-drv.c b/arch/mips/mti-sead3/sead3-i2c-drv.c
index 0375ee66bca3..7aa2225e75b9 100644
--- a/arch/mips/mti-sead3/sead3-i2c-drv.c
+++ b/arch/mips/mti-sead3/sead3-i2c-drv.c
@@ -297,7 +297,7 @@ static void sead3_i2c_platform_setup(struct pic32_i2c_platform_data *priv)
297 priv->base + PIC32_I2CxSTATCLR); 297 priv->base + PIC32_I2CxSTATCLR);
298} 298}
299 299
300static int __devinit sead3_i2c_platform_probe(struct platform_device *pdev) 300static int sead3_i2c_platform_probe(struct platform_device *pdev)
301{ 301{
302 struct pic32_i2c_platform_data *priv; 302 struct pic32_i2c_platform_data *priv;
303 struct resource *r; 303 struct resource *r;
@@ -345,7 +345,7 @@ out:
345 return ret; 345 return ret;
346} 346}
347 347
348static int __devexit sead3_i2c_platform_remove(struct platform_device *pdev) 348static int sead3_i2c_platform_remove(struct platform_device *pdev)
349{ 349{
350 struct pic32_i2c_platform_data *priv = platform_get_drvdata(pdev); 350 struct pic32_i2c_platform_data *priv = platform_get_drvdata(pdev);
351 351
@@ -383,7 +383,7 @@ static struct platform_driver sead3_i2c_platform_driver = {
383 .owner = THIS_MODULE, 383 .owner = THIS_MODULE,
384 }, 384 },
385 .probe = sead3_i2c_platform_probe, 385 .probe = sead3_i2c_platform_probe,
386 .remove = __devexit_p(sead3_i2c_platform_remove), 386 .remove = sead3_i2c_platform_remove,
387 .suspend = sead3_i2c_platform_suspend, 387 .suspend = sead3_i2c_platform_suspend,
388 .resume = sead3_i2c_platform_resume, 388 .resume = sead3_i2c_platform_resume,
389}; 389};
diff --git a/arch/mips/mti-sead3/sead3-pic32-i2c-drv.c b/arch/mips/mti-sead3/sead3-pic32-i2c-drv.c
index 46509b0a620d..514675ed0cde 100644
--- a/arch/mips/mti-sead3/sead3-pic32-i2c-drv.c
+++ b/arch/mips/mti-sead3/sead3-pic32-i2c-drv.c
@@ -304,8 +304,7 @@ static void i2c_platform_disable(struct i2c_platform_data *priv)
304 pr_debug("i2c_platform_disable\n"); 304 pr_debug("i2c_platform_disable\n");
305} 305}
306 306
307static int __devinit 307static int i2c_platform_probe(struct platform_device *pdev)
308i2c_platform_probe(struct platform_device *pdev)
309{ 308{
310 struct i2c_platform_data *priv; 309 struct i2c_platform_data *priv;
311 struct resource *r; 310 struct resource *r;
@@ -362,8 +361,7 @@ out:
362 return ret; 361 return ret;
363} 362}
364 363
365static int __devexit 364static int i2c_platform_remove(struct platform_device *pdev)
366i2c_platform_remove(struct platform_device *pdev)
367{ 365{
368 struct i2c_platform_data *priv = platform_get_drvdata(pdev); 366 struct i2c_platform_data *priv = platform_get_drvdata(pdev);
369 367
@@ -408,7 +406,7 @@ static struct platform_driver i2c_platform_driver = {
408 .owner = THIS_MODULE, 406 .owner = THIS_MODULE,
409 }, 407 },
410 .probe = i2c_platform_probe, 408 .probe = i2c_platform_probe,
411 .remove = __devexit_p(i2c_platform_remove), 409 .remove = i2c_platform_remove,
412 .suspend = i2c_platform_suspend, 410 .suspend = i2c_platform_suspend,
413 .resume = i2c_platform_resume, 411 .resume = i2c_platform_resume,
414}; 412};
diff --git a/arch/mips/netlogic/xlr/setup.c b/arch/mips/netlogic/xlr/setup.c
index 4e7f49d3d5a8..c5ce6992ac4c 100644
--- a/arch/mips/netlogic/xlr/setup.c
+++ b/arch/mips/netlogic/xlr/setup.c
@@ -193,8 +193,11 @@ static void nlm_init_node(void)
193 193
194void __init prom_init(void) 194void __init prom_init(void)
195{ 195{
196 int i, *argv, *envp; /* passed as 32 bit ptrs */ 196 int *argv, *envp; /* passed as 32 bit ptrs */
197 struct psb_info *prom_infop; 197 struct psb_info *prom_infop;
198#ifdef CONFIG_SMP
199 int i;
200#endif
198 201
199 /* truncate to 32 bit and sign extend all args */ 202 /* truncate to 32 bit and sign extend all args */
200 argv = (int *)(long)(int)fw_arg1; 203 argv = (int *)(long)(int)fw_arg1;
diff --git a/arch/mips/pci/fixup-cobalt.c b/arch/mips/pci/fixup-cobalt.c
index 3e7ce65d776c..9553b14002dd 100644
--- a/arch/mips/pci/fixup-cobalt.c
+++ b/arch/mips/pci/fixup-cobalt.c
@@ -37,7 +37,7 @@
37#define VIA_COBALT_BRD_ID_REG 0x94 37#define VIA_COBALT_BRD_ID_REG 0x94
38#define VIA_COBALT_BRD_REG_to_ID(reg) ((unsigned char)(reg) >> 4) 38#define VIA_COBALT_BRD_REG_to_ID(reg) ((unsigned char)(reg) >> 4)
39 39
40static void __devinit qube_raq_galileo_early_fixup(struct pci_dev *dev) 40static void qube_raq_galileo_early_fixup(struct pci_dev *dev)
41{ 41{
42 if (dev->devfn == PCI_DEVFN(0, 0) && 42 if (dev->devfn == PCI_DEVFN(0, 0) &&
43 (dev->class >> 8) == PCI_CLASS_MEMORY_OTHER) { 43 (dev->class >> 8) == PCI_CLASS_MEMORY_OTHER) {
@@ -51,7 +51,7 @@ static void __devinit qube_raq_galileo_early_fixup(struct pci_dev *dev)
51DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_MARVELL, PCI_DEVICE_ID_MARVELL_GT64111, 51DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_MARVELL, PCI_DEVICE_ID_MARVELL_GT64111,
52 qube_raq_galileo_early_fixup); 52 qube_raq_galileo_early_fixup);
53 53
54static void __devinit qube_raq_via_bmIDE_fixup(struct pci_dev *dev) 54static void qube_raq_via_bmIDE_fixup(struct pci_dev *dev)
55{ 55{
56 unsigned short cfgword; 56 unsigned short cfgword;
57 unsigned char lt; 57 unsigned char lt;
@@ -74,7 +74,7 @@ static void __devinit qube_raq_via_bmIDE_fixup(struct pci_dev *dev)
74DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, 74DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1,
75 qube_raq_via_bmIDE_fixup); 75 qube_raq_via_bmIDE_fixup);
76 76
77static void __devinit qube_raq_galileo_fixup(struct pci_dev *dev) 77static void qube_raq_galileo_fixup(struct pci_dev *dev)
78{ 78{
79 if (dev->devfn != PCI_DEVFN(0, 0)) 79 if (dev->devfn != PCI_DEVFN(0, 0))
80 return; 80 return;
@@ -129,7 +129,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL, PCI_DEVICE_ID_MARVELL_GT64111,
129 129
130int cobalt_board_id; 130int cobalt_board_id;
131 131
132static void __devinit qube_raq_via_board_id_fixup(struct pci_dev *dev) 132static void qube_raq_via_board_id_fixup(struct pci_dev *dev)
133{ 133{
134 u8 id; 134 u8 id;
135 int retval; 135 int retval;
diff --git a/arch/mips/pci/fixup-emma2rh.c b/arch/mips/pci/fixup-emma2rh.c
index 0d9ccf4dfc5a..beaec32b02e5 100644
--- a/arch/mips/pci/fixup-emma2rh.c
+++ b/arch/mips/pci/fixup-emma2rh.c
@@ -52,7 +52,7 @@ static unsigned char irq_map[][5] __initdata = {
52 MARKEINS_PCI_IRQ_INTA, MARKEINS_PCI_IRQ_INTB,}, 52 MARKEINS_PCI_IRQ_INTA, MARKEINS_PCI_IRQ_INTB,},
53}; 53};
54 54
55static void __devinit nec_usb_controller_fixup(struct pci_dev *dev) 55static void nec_usb_controller_fixup(struct pci_dev *dev)
56{ 56{
57 if (PCI_SLOT(dev->devfn) == EMMA2RH_USB_SLOT) 57 if (PCI_SLOT(dev->devfn) == EMMA2RH_USB_SLOT)
58 /* on board USB controller configuration */ 58 /* on board USB controller configuration */
@@ -67,7 +67,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_USB,
67 * if it is the host bridge by marking it as such. These resources are of 67 * if it is the host bridge by marking it as such. These resources are of
68 * no consequence to the PCI layer (they are handled elsewhere). 68 * no consequence to the PCI layer (they are handled elsewhere).
69 */ 69 */
70static void __devinit emma2rh_pci_host_fixup(struct pci_dev *dev) 70static void emma2rh_pci_host_fixup(struct pci_dev *dev)
71{ 71{
72 int i; 72 int i;
73 73
diff --git a/arch/mips/pci/fixup-fuloong2e.c b/arch/mips/pci/fixup-fuloong2e.c
index 0857ab8c3919..63ab4a042cd6 100644
--- a/arch/mips/pci/fixup-fuloong2e.c
+++ b/arch/mips/pci/fixup-fuloong2e.c
@@ -48,7 +48,7 @@ int pcibios_plat_dev_init(struct pci_dev *dev)
48 return 0; 48 return 0;
49} 49}
50 50
51static void __devinit loongson2e_nec_fixup(struct pci_dev *pdev) 51static void loongson2e_nec_fixup(struct pci_dev *pdev)
52{ 52{
53 unsigned int val; 53 unsigned int val;
54 54
@@ -60,7 +60,7 @@ static void __devinit loongson2e_nec_fixup(struct pci_dev *pdev)
60 pci_write_config_dword(pdev, 0xe4, 1 << 5); 60 pci_write_config_dword(pdev, 0xe4, 1 << 5);
61} 61}
62 62
63static void __devinit loongson2e_686b_func0_fixup(struct pci_dev *pdev) 63static void loongson2e_686b_func0_fixup(struct pci_dev *pdev)
64{ 64{
65 unsigned char c; 65 unsigned char c;
66 66
@@ -135,7 +135,7 @@ static void __devinit loongson2e_686b_func0_fixup(struct pci_dev *pdev)
135 printk(KERN_INFO"via686b fix: ISA bridge done\n"); 135 printk(KERN_INFO"via686b fix: ISA bridge done\n");
136} 136}
137 137
138static void __devinit loongson2e_686b_func1_fixup(struct pci_dev *pdev) 138static void loongson2e_686b_func1_fixup(struct pci_dev *pdev)
139{ 139{
140 printk(KERN_INFO"via686b fix: IDE\n"); 140 printk(KERN_INFO"via686b fix: IDE\n");
141 141
@@ -168,19 +168,19 @@ static void __devinit loongson2e_686b_func1_fixup(struct pci_dev *pdev)
168 printk(KERN_INFO"via686b fix: IDE done\n"); 168 printk(KERN_INFO"via686b fix: IDE done\n");
169} 169}
170 170
171static void __devinit loongson2e_686b_func2_fixup(struct pci_dev *pdev) 171static void loongson2e_686b_func2_fixup(struct pci_dev *pdev)
172{ 172{
173 /* irq routing */ 173 /* irq routing */
174 pci_write_config_byte(pdev, PCI_INTERRUPT_LINE, 10); 174 pci_write_config_byte(pdev, PCI_INTERRUPT_LINE, 10);
175} 175}
176 176
177static void __devinit loongson2e_686b_func3_fixup(struct pci_dev *pdev) 177static void loongson2e_686b_func3_fixup(struct pci_dev *pdev)
178{ 178{
179 /* irq routing */ 179 /* irq routing */
180 pci_write_config_byte(pdev, PCI_INTERRUPT_LINE, 11); 180 pci_write_config_byte(pdev, PCI_INTERRUPT_LINE, 11);
181} 181}
182 182
183static void __devinit loongson2e_686b_func5_fixup(struct pci_dev *pdev) 183static void loongson2e_686b_func5_fixup(struct pci_dev *pdev)
184{ 184{
185 unsigned int val; 185 unsigned int val;
186 unsigned char c; 186 unsigned char c;
diff --git a/arch/mips/pci/fixup-lemote2f.c b/arch/mips/pci/fixup-lemote2f.c
index a7b917dcf604..519daaebb5da 100644
--- a/arch/mips/pci/fixup-lemote2f.c
+++ b/arch/mips/pci/fixup-lemote2f.c
@@ -96,21 +96,21 @@ int pcibios_plat_dev_init(struct pci_dev *dev)
96} 96}
97 97
98/* CS5536 SPEC. fixup */ 98/* CS5536 SPEC. fixup */
99static void __devinit loongson_cs5536_isa_fixup(struct pci_dev *pdev) 99static void loongson_cs5536_isa_fixup(struct pci_dev *pdev)
100{ 100{
101 /* the uart1 and uart2 interrupt in PIC is enabled as default */ 101 /* the uart1 and uart2 interrupt in PIC is enabled as default */
102 pci_write_config_dword(pdev, PCI_UART1_INT_REG, 1); 102 pci_write_config_dword(pdev, PCI_UART1_INT_REG, 1);
103 pci_write_config_dword(pdev, PCI_UART2_INT_REG, 1); 103 pci_write_config_dword(pdev, PCI_UART2_INT_REG, 1);
104} 104}
105 105
106static void __devinit loongson_cs5536_ide_fixup(struct pci_dev *pdev) 106static void loongson_cs5536_ide_fixup(struct pci_dev *pdev)
107{ 107{
108 /* setting the mutex pin as IDE function */ 108 /* setting the mutex pin as IDE function */
109 pci_write_config_dword(pdev, PCI_IDE_CFG_REG, 109 pci_write_config_dword(pdev, PCI_IDE_CFG_REG,
110 CS5536_IDE_FLASH_SIGNATURE); 110 CS5536_IDE_FLASH_SIGNATURE);
111} 111}
112 112
113static void __devinit loongson_cs5536_acc_fixup(struct pci_dev *pdev) 113static void loongson_cs5536_acc_fixup(struct pci_dev *pdev)
114{ 114{
115 /* enable the AUDIO interrupt in PIC */ 115 /* enable the AUDIO interrupt in PIC */
116 pci_write_config_dword(pdev, PCI_ACC_INT_REG, 1); 116 pci_write_config_dword(pdev, PCI_ACC_INT_REG, 1);
@@ -118,14 +118,14 @@ static void __devinit loongson_cs5536_acc_fixup(struct pci_dev *pdev)
118 pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0xc0); 118 pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0xc0);
119} 119}
120 120
121static void __devinit loongson_cs5536_ohci_fixup(struct pci_dev *pdev) 121static void loongson_cs5536_ohci_fixup(struct pci_dev *pdev)
122{ 122{
123 /* enable the OHCI interrupt in PIC */ 123 /* enable the OHCI interrupt in PIC */
124 /* THE OHCI, EHCI, UDC, OTG are shared with interrupt in PIC */ 124 /* THE OHCI, EHCI, UDC, OTG are shared with interrupt in PIC */
125 pci_write_config_dword(pdev, PCI_OHCI_INT_REG, 1); 125 pci_write_config_dword(pdev, PCI_OHCI_INT_REG, 1);
126} 126}
127 127
128static void __devinit loongson_cs5536_ehci_fixup(struct pci_dev *pdev) 128static void loongson_cs5536_ehci_fixup(struct pci_dev *pdev)
129{ 129{
130 u32 hi, lo; 130 u32 hi, lo;
131 131
@@ -137,7 +137,7 @@ static void __devinit loongson_cs5536_ehci_fixup(struct pci_dev *pdev)
137 pci_write_config_dword(pdev, PCI_EHCI_FLADJ_REG, 0x2000); 137 pci_write_config_dword(pdev, PCI_EHCI_FLADJ_REG, 0x2000);
138} 138}
139 139
140static void __devinit loongson_nec_fixup(struct pci_dev *pdev) 140static void loongson_nec_fixup(struct pci_dev *pdev)
141{ 141{
142 unsigned int val; 142 unsigned int val;
143 143
diff --git a/arch/mips/pci/fixup-malta.c b/arch/mips/pci/fixup-malta.c
index 9a1a2244522a..75d03f6be3bd 100644
--- a/arch/mips/pci/fixup-malta.c
+++ b/arch/mips/pci/fixup-malta.c
@@ -8,7 +8,7 @@
8#define PCID 4 8#define PCID 4
9 9
10/* This table is filled in by interrogating the PIIX4 chip */ 10/* This table is filled in by interrogating the PIIX4 chip */
11static char pci_irq[5] __devinitdata = { 11static char pci_irq[5] = {
12}; 12};
13 13
14static char irq_tab[][5] __initdata = { 14static char irq_tab[][5] __initdata = {
@@ -50,10 +50,10 @@ int pcibios_plat_dev_init(struct pci_dev *dev)
50 return 0; 50 return 0;
51} 51}
52 52
53static void __devinit malta_piix_func0_fixup(struct pci_dev *pdev) 53static void malta_piix_func0_fixup(struct pci_dev *pdev)
54{ 54{
55 unsigned char reg_val; 55 unsigned char reg_val;
56 static int piixirqmap[16] __devinitdata = { /* PIIX PIRQC[A:D] irq mappings */ 56 static int piixirqmap[16] = { /* PIIX PIRQC[A:D] irq mappings */
57 0, 0, 0, 3, 57 0, 0, 0, 3,
58 4, 5, 6, 7, 58 4, 5, 6, 7,
59 0, 9, 10, 11, 59 0, 9, 10, 11,
@@ -84,7 +84,7 @@ static void __devinit malta_piix_func0_fixup(struct pci_dev *pdev)
84DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_0, 84DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_0,
85 malta_piix_func0_fixup); 85 malta_piix_func0_fixup);
86 86
87static void __devinit malta_piix_func1_fixup(struct pci_dev *pdev) 87static void malta_piix_func1_fixup(struct pci_dev *pdev)
88{ 88{
89 unsigned char reg_val; 89 unsigned char reg_val;
90 90
@@ -104,7 +104,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB,
104 malta_piix_func1_fixup); 104 malta_piix_func1_fixup);
105 105
106/* Enable PCI 2.1 compatibility in PIIX4 */ 106/* Enable PCI 2.1 compatibility in PIIX4 */
107static void __devinit quirk_dlcsetup(struct pci_dev *dev) 107static void quirk_dlcsetup(struct pci_dev *dev)
108{ 108{
109 u8 odlc, ndlc; 109 u8 odlc, ndlc;
110 110
diff --git a/arch/mips/pci/fixup-rc32434.c b/arch/mips/pci/fixup-rc32434.c
index 76bb1be99d43..d0f6ecbf35f7 100644
--- a/arch/mips/pci/fixup-rc32434.c
+++ b/arch/mips/pci/fixup-rc32434.c
@@ -32,12 +32,12 @@
32#include <asm/mach-rc32434/rc32434.h> 32#include <asm/mach-rc32434/rc32434.h>
33#include <asm/mach-rc32434/irq.h> 33#include <asm/mach-rc32434/irq.h>
34 34
35static int __devinitdata irq_map[2][12] = { 35static int irq_map[2][12] = {
36 {0, 0, 2, 3, 2, 3, 0, 0, 0, 0, 0, 1}, 36 {0, 0, 2, 3, 2, 3, 0, 0, 0, 0, 0, 1},
37 {0, 0, 1, 3, 0, 2, 1, 3, 0, 2, 1, 3} 37 {0, 0, 1, 3, 0, 2, 1, 3, 0, 2, 1, 3}
38}; 38};
39 39
40int __devinit pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 40int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
41{ 41{
42 int irq = 0; 42 int irq = 0;
43 43
@@ -47,7 +47,7 @@ int __devinit pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
47 return irq + GROUP4_IRQ_BASE + 4; 47 return irq + GROUP4_IRQ_BASE + 4;
48} 48}
49 49
50static void __devinit rc32434_pci_early_fixup(struct pci_dev *dev) 50static void rc32434_pci_early_fixup(struct pci_dev *dev)
51{ 51{
52 if (PCI_SLOT(dev->devfn) == 6 && dev->bus->number == 0) { 52 if (PCI_SLOT(dev->devfn) == 6 && dev->bus->number == 0) {
53 /* disable prefetched memory range */ 53 /* disable prefetched memory range */
diff --git a/arch/mips/pci/fixup-sb1250.c b/arch/mips/pci/fixup-sb1250.c
index d02900a72916..1441becdcb6c 100644
--- a/arch/mips/pci/fixup-sb1250.c
+++ b/arch/mips/pci/fixup-sb1250.c
@@ -15,7 +15,7 @@
15 * Set the BCM1250, etc. PCI host bridge's TRDY timeout 15 * Set the BCM1250, etc. PCI host bridge's TRDY timeout
16 * to the finite max. 16 * to the finite max.
17 */ 17 */
18static void __devinit quirk_sb1250_pci(struct pci_dev *dev) 18static void quirk_sb1250_pci(struct pci_dev *dev)
19{ 19{
20 pci_write_config_byte(dev, 0x40, 0xff); 20 pci_write_config_byte(dev, 0x40, 0xff);
21} 21}
@@ -25,7 +25,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SIBYTE, PCI_DEVICE_ID_BCM1250_PCI,
25/* 25/*
26 * The BCM1250, etc. PCI/HT bridge reports as a host bridge. 26 * The BCM1250, etc. PCI/HT bridge reports as a host bridge.
27 */ 27 */
28static void __devinit quirk_sb1250_ht(struct pci_dev *dev) 28static void quirk_sb1250_ht(struct pci_dev *dev)
29{ 29{
30 dev->class = PCI_CLASS_BRIDGE_PCI << 8; 30 dev->class = PCI_CLASS_BRIDGE_PCI << 8;
31} 31}
@@ -35,7 +35,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SIBYTE, PCI_DEVICE_ID_BCM1250_HT,
35/* 35/*
36 * Set the SP1011 HT/PCI bridge's TRDY timeout to the finite max. 36 * Set the SP1011 HT/PCI bridge's TRDY timeout to the finite max.
37 */ 37 */
38static void __devinit quirk_sp1011(struct pci_dev *dev) 38static void quirk_sp1011(struct pci_dev *dev)
39{ 39{
40 pci_write_config_byte(dev, 0x64, 0xff); 40 pci_write_config_byte(dev, 0x64, 0xff);
41} 41}
diff --git a/arch/mips/pci/ops-bcm63xx.c b/arch/mips/pci/ops-bcm63xx.c
index 65c7bd100486..4a156629e958 100644
--- a/arch/mips/pci/ops-bcm63xx.c
+++ b/arch/mips/pci/ops-bcm63xx.c
@@ -411,7 +411,7 @@ struct pci_ops bcm63xx_cb_ops = {
411 * only one IO window, so it cannot be shared by PCI and cardbus, use 411 * only one IO window, so it cannot be shared by PCI and cardbus, use
412 * fixup to choose and detect unhandled configuration 412 * fixup to choose and detect unhandled configuration
413 */ 413 */
414static void __devinit bcm63xx_fixup(struct pci_dev *dev) 414static void bcm63xx_fixup(struct pci_dev *dev)
415{ 415{
416 static int io_window = -1; 416 static int io_window = -1;
417 int i, found, new_io_window; 417 int i, found, new_io_window;
diff --git a/arch/mips/pci/ops-tx4927.c b/arch/mips/pci/ops-tx4927.c
index bc13e29d2bb3..0d69d6f4ea44 100644
--- a/arch/mips/pci/ops-tx4927.c
+++ b/arch/mips/pci/ops-tx4927.c
@@ -191,13 +191,13 @@ static struct {
191 u8 trdyto; 191 u8 trdyto;
192 u8 retryto; 192 u8 retryto;
193 u16 gbwc; 193 u16 gbwc;
194} tx4927_pci_opts __devinitdata = { 194} tx4927_pci_opts = {
195 .trdyto = 0, 195 .trdyto = 0,
196 .retryto = 0, 196 .retryto = 0,
197 .gbwc = 0xfe0, /* 4064 GBUSCLK for CCFG.GTOT=0b11 */ 197 .gbwc = 0xfe0, /* 4064 GBUSCLK for CCFG.GTOT=0b11 */
198}; 198};
199 199
200char *__devinit tx4927_pcibios_setup(char *str) 200char *tx4927_pcibios_setup(char *str)
201{ 201{
202 unsigned long val; 202 unsigned long val;
203 203
@@ -495,7 +495,7 @@ irqreturn_t tx4927_pcierr_interrupt(int irq, void *dev_id)
495} 495}
496 496
497#ifdef CONFIG_TOSHIBA_FPCIB0 497#ifdef CONFIG_TOSHIBA_FPCIB0
498static void __devinit tx4927_quirk_slc90e66_bridge(struct pci_dev *dev) 498static void tx4927_quirk_slc90e66_bridge(struct pci_dev *dev)
499{ 499{
500 struct tx4927_pcic_reg __iomem *pcicptr = pci_bus_to_pcicptr(dev->bus); 500 struct tx4927_pcic_reg __iomem *pcicptr = pci_bus_to_pcicptr(dev->bus);
501 501
diff --git a/arch/mips/pci/pci-alchemy.c b/arch/mips/pci/pci-alchemy.c
index ec125bed721c..c4ea6cc55f94 100644
--- a/arch/mips/pci/pci-alchemy.c
+++ b/arch/mips/pci/pci-alchemy.c
@@ -356,7 +356,7 @@ static struct syscore_ops alchemy_pci_pmops = {
356 .resume = alchemy_pci_resume, 356 .resume = alchemy_pci_resume,
357}; 357};
358 358
359static int __devinit alchemy_pci_probe(struct platform_device *pdev) 359static int alchemy_pci_probe(struct platform_device *pdev)
360{ 360{
361 struct alchemy_pci_platdata *pd = pdev->dev.platform_data; 361 struct alchemy_pci_platdata *pd = pdev->dev.platform_data;
362 struct alchemy_pci_context *ctx; 362 struct alchemy_pci_context *ctx;
diff --git a/arch/mips/pci/pci-ar71xx.c b/arch/mips/pci/pci-ar71xx.c
index 1552522b8718..6eaa4f2d0e38 100644
--- a/arch/mips/pci/pci-ar71xx.c
+++ b/arch/mips/pci/pci-ar71xx.c
@@ -24,7 +24,7 @@
24#include <asm/mach-ath79/pci.h> 24#include <asm/mach-ath79/pci.h>
25 25
26#define AR71XX_PCI_MEM_BASE 0x10000000 26#define AR71XX_PCI_MEM_BASE 0x10000000
27#define AR71XX_PCI_MEM_SIZE 0x08000000 27#define AR71XX_PCI_MEM_SIZE 0x07000000
28 28
29#define AR71XX_PCI_WIN0_OFFS 0x10000000 29#define AR71XX_PCI_WIN0_OFFS 0x10000000
30#define AR71XX_PCI_WIN1_OFFS 0x11000000 30#define AR71XX_PCI_WIN1_OFFS 0x11000000
diff --git a/arch/mips/pci/pci-ar724x.c b/arch/mips/pci/pci-ar724x.c
index 86d77a666458..c11c75be2d7e 100644
--- a/arch/mips/pci/pci-ar724x.c
+++ b/arch/mips/pci/pci-ar724x.c
@@ -21,7 +21,7 @@
21#define AR724X_PCI_CTRL_SIZE 0x100 21#define AR724X_PCI_CTRL_SIZE 0x100
22 22
23#define AR724X_PCI_MEM_BASE 0x10000000 23#define AR724X_PCI_MEM_BASE 0x10000000
24#define AR724X_PCI_MEM_SIZE 0x08000000 24#define AR724X_PCI_MEM_SIZE 0x04000000
25 25
26#define AR724X_PCI_REG_RESET 0x18 26#define AR724X_PCI_REG_RESET 0x18
27#define AR724X_PCI_REG_INT_STATUS 0x4c 27#define AR724X_PCI_REG_INT_STATUS 0x4c
diff --git a/arch/mips/pci/pci-ip27.c b/arch/mips/pci/pci-ip27.c
index fdc24440294c..7f4f49b09b5b 100644
--- a/arch/mips/pci/pci-ip27.c
+++ b/arch/mips/pci/pci-ip27.c
@@ -143,7 +143,7 @@ int __cpuinit bridge_probe(nasid_t nasid, int widget_id, int masterwid)
143 * A given PCI device, in general, should be able to intr any of the cpus 143 * A given PCI device, in general, should be able to intr any of the cpus
144 * on any one of the hubs connected to its xbow. 144 * on any one of the hubs connected to its xbow.
145 */ 145 */
146int __devinit pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 146int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
147{ 147{
148 return 0; 148 return 0;
149} 149}
@@ -212,7 +212,7 @@ static inline void pci_enable_swapping(struct pci_dev *dev)
212 bridge->b_widget.w_tflush; /* Flush */ 212 bridge->b_widget.w_tflush; /* Flush */
213} 213}
214 214
215static void __devinit pci_fixup_ioc3(struct pci_dev *d) 215static void pci_fixup_ioc3(struct pci_dev *d)
216{ 216{
217 pci_disable_swapping(d); 217 pci_disable_swapping(d);
218} 218}
diff --git a/arch/mips/pci/pci-lantiq.c b/arch/mips/pci/pci-lantiq.c
index 075d87acd12a..95681789b51e 100644
--- a/arch/mips/pci/pci-lantiq.c
+++ b/arch/mips/pci/pci-lantiq.c
@@ -95,7 +95,7 @@ static inline u32 ltq_calc_bar11mask(void)
95 return bar11mask; 95 return bar11mask;
96} 96}
97 97
98static int __devinit ltq_pci_startup(struct platform_device *pdev) 98static int ltq_pci_startup(struct platform_device *pdev)
99{ 99{
100 struct device_node *node = pdev->dev.of_node; 100 struct device_node *node = pdev->dev.of_node;
101 const __be32 *req_mask, *bus_clk; 101 const __be32 *req_mask, *bus_clk;
@@ -201,7 +201,7 @@ static int __devinit ltq_pci_startup(struct platform_device *pdev)
201 return 0; 201 return 0;
202} 202}
203 203
204static int __devinit ltq_pci_probe(struct platform_device *pdev) 204static int ltq_pci_probe(struct platform_device *pdev)
205{ 205{
206 struct resource *res_cfg, *res_bridge; 206 struct resource *res_cfg, *res_bridge;
207 207
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 4040416e0603..a1843448fad3 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -76,7 +76,7 @@ pcibios_align_resource(void *data, const struct resource *res,
76 return start; 76 return start;
77} 77}
78 78
79static void __devinit pcibios_scanbus(struct pci_controller *hose) 79static void pcibios_scanbus(struct pci_controller *hose)
80{ 80{
81 static int next_busno; 81 static int next_busno;
82 static int need_domain_info; 82 static int need_domain_info;
@@ -120,8 +120,7 @@ static void __devinit pcibios_scanbus(struct pci_controller *hose)
120} 120}
121 121
122#ifdef CONFIG_OF 122#ifdef CONFIG_OF
123void __devinit pci_load_of_ranges(struct pci_controller *hose, 123void pci_load_of_ranges(struct pci_controller *hose, struct device_node *node)
124 struct device_node *node)
125{ 124{
126 const __be32 *ranges; 125 const __be32 *ranges;
127 int rlen; 126 int rlen;
@@ -174,7 +173,7 @@ void __devinit pci_load_of_ranges(struct pci_controller *hose,
174 173
175static DEFINE_MUTEX(pci_scan_mutex); 174static DEFINE_MUTEX(pci_scan_mutex);
176 175
177void __devinit register_pci_controller(struct pci_controller *hose) 176void register_pci_controller(struct pci_controller *hose)
178{ 177{
179 if (request_resource(&iomem_resource, hose->mem_resource) < 0) 178 if (request_resource(&iomem_resource, hose->mem_resource) < 0)
180 goto out; 179 goto out;
@@ -303,7 +302,7 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
303 return pcibios_plat_dev_init(dev); 302 return pcibios_plat_dev_init(dev);
304} 303}
305 304
306void __devinit pcibios_fixup_bus(struct pci_bus *bus) 305void pcibios_fixup_bus(struct pci_bus *bus)
307{ 306{
308 struct pci_dev *dev = bus->self; 307 struct pci_dev *dev = bus->self;
309 308
diff --git a/arch/mips/power/hibernate.S b/arch/mips/power/hibernate.S
index f8a751c03282..61e2558a2dcb 100644
--- a/arch/mips/power/hibernate.S
+++ b/arch/mips/power/hibernate.S
@@ -8,7 +8,6 @@
8 * Wu Zhangjin <wuzhangjin@gmail.com> 8 * Wu Zhangjin <wuzhangjin@gmail.com>
9 */ 9 */
10#include <asm/asm-offsets.h> 10#include <asm/asm-offsets.h>
11#include <asm/page.h>
12#include <asm/regdef.h> 11#include <asm/regdef.h>
13#include <asm/asm.h> 12#include <asm/asm.h>
14 13
@@ -35,7 +34,7 @@ LEAF(swsusp_arch_resume)
350: 340:
36 PTR_L t1, PBE_ADDRESS(t0) /* source */ 35 PTR_L t1, PBE_ADDRESS(t0) /* source */
37 PTR_L t2, PBE_ORIG_ADDRESS(t0) /* destination */ 36 PTR_L t2, PBE_ORIG_ADDRESS(t0) /* destination */
38 PTR_ADDU t3, t1, PAGE_SIZE 37 PTR_ADDU t3, t1, _PAGE_SIZE
391: 381:
40 REG_L t8, (t1) 39 REG_L t8, (t1)
41 REG_S t8, (t2) 40 REG_S t8, (t2)
diff --git a/arch/mips/sni/setup.c b/arch/mips/sni/setup.c
index d6c7bd4b5ab0..2e9c283b8e68 100644
--- a/arch/mips/sni/setup.c
+++ b/arch/mips/sni/setup.c
@@ -236,7 +236,7 @@ void __init plat_mem_setup(void)
236#include <video/vga.h> 236#include <video/vga.h>
237#include <video/cirrus.h> 237#include <video/cirrus.h>
238 238
239static void __devinit quirk_cirrus_ram_size(struct pci_dev *dev) 239static void quirk_cirrus_ram_size(struct pci_dev *dev)
240{ 240{
241 u16 cmd; 241 u16 cmd;
242 242
diff --git a/arch/mips/txx9/generic/pci.c b/arch/mips/txx9/generic/pci.c
index b14ee53581a9..ce8f8b9b930c 100644
--- a/arch/mips/txx9/generic/pci.c
+++ b/arch/mips/txx9/generic/pci.c
@@ -256,8 +256,7 @@ static irqreturn_t i8259_interrupt(int irq, void *dev_id)
256 return IRQ_HANDLED; 256 return IRQ_HANDLED;
257} 257}
258 258
259static int __devinit 259static int txx9_i8259_irq_setup(int irq)
260txx9_i8259_irq_setup(int irq)
261{ 260{
262 int err; 261 int err;
263 262
@@ -269,7 +268,7 @@ txx9_i8259_irq_setup(int irq)
269 return err; 268 return err;
270} 269}
271 270
272static void __devinit quirk_slc90e66_bridge(struct pci_dev *dev) 271static void quirk_slc90e66_bridge(struct pci_dev *dev)
273{ 272{
274 int irq; /* PCI/ISA Bridge interrupt */ 273 int irq; /* PCI/ISA Bridge interrupt */
275 u8 reg_64; 274 u8 reg_64;
@@ -304,7 +303,7 @@ static void __devinit quirk_slc90e66_bridge(struct pci_dev *dev)
304 smsc_fdc37m81x_config_end(); 303 smsc_fdc37m81x_config_end();
305} 304}
306 305
307static void __devinit quirk_slc90e66_ide(struct pci_dev *dev) 306static void quirk_slc90e66_ide(struct pci_dev *dev)
308{ 307{
309 unsigned char dat; 308 unsigned char dat;
310 int regs[2] = {0x41, 0x43}; 309 int regs[2] = {0x41, 0x43};
@@ -339,7 +338,7 @@ static void __devinit quirk_slc90e66_ide(struct pci_dev *dev)
339} 338}
340#endif /* CONFIG_TOSHIBA_FPCIB0 */ 339#endif /* CONFIG_TOSHIBA_FPCIB0 */
341 340
342static void __devinit tc35815_fixup(struct pci_dev *dev) 341static void tc35815_fixup(struct pci_dev *dev)
343{ 342{
344 /* This device may have PM registers but not they are not supported. */ 343 /* This device may have PM registers but not they are not supported. */
345 if (dev->pm_cap) { 344 if (dev->pm_cap) {
@@ -348,7 +347,7 @@ static void __devinit tc35815_fixup(struct pci_dev *dev)
348 } 347 }
349} 348}
350 349
351static void __devinit final_fixup(struct pci_dev *dev) 350static void final_fixup(struct pci_dev *dev)
352{ 351{
353 unsigned char bist; 352 unsigned char bist;
354 353
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig
index aa03f2e13385..e70001cfa05b 100644
--- a/arch/mn10300/Kconfig
+++ b/arch/mn10300/Kconfig
@@ -6,6 +6,7 @@ config MN10300
6 select ARCH_WANT_IPC_PARSE_VERSION 6 select ARCH_WANT_IPC_PARSE_VERSION
7 select HAVE_ARCH_TRACEHOOK 7 select HAVE_ARCH_TRACEHOOK
8 select HAVE_ARCH_KGDB 8 select HAVE_ARCH_KGDB
9 select GENERIC_ATOMIC64
9 select HAVE_NMI_WATCHDOG if MN10300_WD_TIMER 10 select HAVE_NMI_WATCHDOG if MN10300_WD_TIMER
10 select GENERIC_CLOCKEVENTS 11 select GENERIC_CLOCKEVENTS
11 select MODULES_USE_ELF_RELA 12 select MODULES_USE_ELF_RELA
diff --git a/arch/mn10300/kernel/smp.c b/arch/mn10300/kernel/smp.c
index 95983cd21e77..5d7e152a23b7 100644
--- a/arch/mn10300/kernel/smp.c
+++ b/arch/mn10300/kernel/smp.c
@@ -905,7 +905,7 @@ void __init smp_cpus_done(unsigned int max_cpus)
905 * Set up the cpu_online_mask, cpu_callout_map and cpu_callin_map of the boot 905 * Set up the cpu_online_mask, cpu_callout_map and cpu_callin_map of the boot
906 * processor (CPU 0). 906 * processor (CPU 0).
907 */ 907 */
908void __devinit smp_prepare_boot_cpu(void) 908void smp_prepare_boot_cpu(void)
909{ 909{
910 cpumask_set_cpu(0, &cpu_callout_map); 910 cpumask_set_cpu(0, &cpu_callout_map);
911 cpumask_set_cpu(0, &cpu_callin_map); 911 cpumask_set_cpu(0, &cpu_callin_map);
@@ -930,7 +930,7 @@ void initialize_secondary(void)
930 * __cpu_up - Set smp_commenced_mask for the nominated CPU 930 * __cpu_up - Set smp_commenced_mask for the nominated CPU
931 * @cpu: The target CPU. 931 * @cpu: The target CPU.
932 */ 932 */
933int __devinit __cpu_up(unsigned int cpu, struct task_struct *tidle) 933int __cpu_up(unsigned int cpu, struct task_struct *tidle)
934{ 934{
935 int timeout; 935 int timeout;
936 936
diff --git a/arch/mn10300/unit-asb2305/pci.c b/arch/mn10300/unit-asb2305/pci.c
index e2059486d3f8..6911e845b8cd 100644
--- a/arch/mn10300/unit-asb2305/pci.c
+++ b/arch/mn10300/unit-asb2305/pci.c
@@ -282,7 +282,7 @@ static int __init pci_check_direct(void)
282 return -ENODEV; 282 return -ENODEV;
283} 283}
284 284
285static int __devinit is_valid_resource(struct pci_dev *dev, int idx) 285static int is_valid_resource(struct pci_dev *dev, int idx)
286{ 286{
287 unsigned int i, type_mask = IORESOURCE_IO | IORESOURCE_MEM; 287 unsigned int i, type_mask = IORESOURCE_IO | IORESOURCE_MEM;
288 struct resource *devr = &dev->resource[idx], *busr; 288 struct resource *devr = &dev->resource[idx], *busr;
@@ -302,7 +302,7 @@ static int __devinit is_valid_resource(struct pci_dev *dev, int idx)
302 return 0; 302 return 0;
303} 303}
304 304
305static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev) 305static void pcibios_fixup_device_resources(struct pci_dev *dev)
306{ 306{
307 int limit, i; 307 int limit, i;
308 308
@@ -325,7 +325,7 @@ static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev)
325 * Called after each bus is probed, but before its children 325 * Called after each bus is probed, but before its children
326 * are examined. 326 * are examined.
327 */ 327 */
328void __devinit pcibios_fixup_bus(struct pci_bus *bus) 328void pcibios_fixup_bus(struct pci_bus *bus)
329{ 329{
330 struct pci_dev *dev; 330 struct pci_dev *dev;
331 331
diff --git a/arch/openrisc/lib/delay.c b/arch/openrisc/lib/delay.c
index c330767c9217..c82b09f4a106 100644
--- a/arch/openrisc/lib/delay.c
+++ b/arch/openrisc/lib/delay.c
@@ -22,7 +22,7 @@
22#include <asm/timex.h> 22#include <asm/timex.h>
23#include <asm/processor.h> 23#include <asm/processor.h>
24 24
25int __devinit read_current_timer(unsigned long *timer_value) 25int read_current_timer(unsigned long *timer_value)
26{ 26{
27 *timer_value = mfspr(SPR_TTCR); 27 *timer_value = mfspr(SPR_TTCR);
28 return 0; 28 return 0;
diff --git a/arch/parisc/include/asm/parport.h b/arch/parisc/include/asm/parport.h
index 00d9cc3e7b97..c391d7cbc223 100644
--- a/arch/parisc/include/asm/parport.h
+++ b/arch/parisc/include/asm/parport.h
@@ -8,7 +8,7 @@
8#define _ASM_PARPORT_H 1 8#define _ASM_PARPORT_H 1
9 9
10 10
11static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma) 11static int parport_pc_find_nonpci_ports (int autoirq, int autodma)
12{ 12{
13 /* nothing ! */ 13 /* nothing ! */
14 return 0; 14 return 0;
diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S
index bfb44247d7a7..eb7850b46c25 100644
--- a/arch/parisc/kernel/entry.S
+++ b/arch/parisc/kernel/entry.S
@@ -1865,7 +1865,7 @@ syscall_restore:
1865 1865
1866 /* Are we being ptraced? */ 1866 /* Are we being ptraced? */
1867 ldw TASK_FLAGS(%r1),%r19 1867 ldw TASK_FLAGS(%r1),%r19
1868 ldi (_TIF_SINGLESTEP|_TIF_BLOCKSTEP),%r2 1868 ldi _TIF_SYSCALL_TRACE_MASK,%r2
1869 and,COND(=) %r19,%r2,%r0 1869 and,COND(=) %r19,%r2,%r0
1870 b,n syscall_restore_rfi 1870 b,n syscall_restore_rfi
1871 1871
@@ -1978,15 +1978,23 @@ syscall_restore_rfi:
1978 /* sr2 should be set to zero for userspace syscalls */ 1978 /* sr2 should be set to zero for userspace syscalls */
1979 STREG %r0,TASK_PT_SR2(%r1) 1979 STREG %r0,TASK_PT_SR2(%r1)
1980 1980
1981pt_regs_ok:
1982 LDREG TASK_PT_GR31(%r1),%r2 1981 LDREG TASK_PT_GR31(%r1),%r2
1983 depi 3,31,2,%r2 /* ensure return to user mode. */ 1982 depi 3,31,2,%r2 /* ensure return to user mode. */
1984 STREG %r2,TASK_PT_IAOQ0(%r1) 1983 STREG %r2,TASK_PT_IAOQ0(%r1)
1985 ldo 4(%r2),%r2 1984 ldo 4(%r2),%r2
1986 STREG %r2,TASK_PT_IAOQ1(%r1) 1985 STREG %r2,TASK_PT_IAOQ1(%r1)
1986 b intr_restore
1987 copy %r25,%r16 1987 copy %r25,%r16
1988
1989pt_regs_ok:
1990 LDREG TASK_PT_IAOQ0(%r1),%r2
1991 depi 3,31,2,%r2 /* ensure return to user mode. */
1992 STREG %r2,TASK_PT_IAOQ0(%r1)
1993 LDREG TASK_PT_IAOQ1(%r1),%r2
1994 depi 3,31,2,%r2
1995 STREG %r2,TASK_PT_IAOQ1(%r1)
1988 b intr_restore 1996 b intr_restore
1989 nop 1997 copy %r25,%r16
1990 1998
1991 .import schedule,code 1999 .import schedule,code
1992syscall_do_resched: 2000syscall_do_resched:
diff --git a/arch/parisc/kernel/hardware.c b/arch/parisc/kernel/hardware.c
index f48a640b55fb..f7752f6af29e 100644
--- a/arch/parisc/kernel/hardware.c
+++ b/arch/parisc/kernel/hardware.c
@@ -38,7 +38,7 @@
38 * so don't reference this table after starting the init process 38 * so don't reference this table after starting the init process
39 */ 39 */
40 40
41static struct hp_hardware hp_hardware_list[] __devinitdata = { 41static struct hp_hardware hp_hardware_list[] = {
42 {HPHW_NPROC,0x01,0x4,0x0,"Indigo (840, 930)"}, 42 {HPHW_NPROC,0x01,0x4,0x0,"Indigo (840, 930)"},
43 {HPHW_NPROC,0x8,0x4,0x01,"Firefox(825,925)"}, 43 {HPHW_NPROC,0x8,0x4,0x01,"Firefox(825,925)"},
44 {HPHW_NPROC,0xA,0x4,0x01,"Top Gun (835,834,935,635)"}, 44 {HPHW_NPROC,0xA,0x4,0x01,"Top Gun (835,834,935,635)"},
@@ -1230,7 +1230,7 @@ static struct hp_cpu_type_mask {
1230 unsigned short model; 1230 unsigned short model;
1231 unsigned short mask; 1231 unsigned short mask;
1232 enum cpu_type cpu; 1232 enum cpu_type cpu;
1233} hp_cpu_type_mask_list[] __devinitdata = { 1233} hp_cpu_type_mask_list[] = {
1234 1234
1235 { 0x0000, 0x0ff0, pcx }, /* 0x0000 - 0x000f */ 1235 { 0x0000, 0x0ff0, pcx }, /* 0x0000 - 0x000f */
1236 { 0x0048, 0x0ff0, pcxl }, /* 0x0040 - 0x004f */ 1236 { 0x0048, 0x0ff0, pcxl }, /* 0x0040 - 0x004f */
@@ -1327,8 +1327,7 @@ const char * const cpu_name_version[][2] = {
1327 [mako2] = { "PA8900 (Shortfin)", "2.0" } 1327 [mako2] = { "PA8900 (Shortfin)", "2.0" }
1328}; 1328};
1329 1329
1330const char * __devinit 1330const char *parisc_hardware_description(struct parisc_device_id *id)
1331parisc_hardware_description(struct parisc_device_id *id)
1332{ 1331{
1333 struct hp_hardware *listptr; 1332 struct hp_hardware *listptr;
1334 1333
diff --git a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c
index c0b1affc06a8..0299d63cd112 100644
--- a/arch/parisc/kernel/irq.c
+++ b/arch/parisc/kernel/irq.c
@@ -410,11 +410,13 @@ void __init init_IRQ(void)
410{ 410{
411 local_irq_disable(); /* PARANOID - should already be disabled */ 411 local_irq_disable(); /* PARANOID - should already be disabled */
412 mtctl(~0UL, 23); /* EIRR : clear all pending external intr */ 412 mtctl(~0UL, 23); /* EIRR : clear all pending external intr */
413 claim_cpu_irqs();
414#ifdef CONFIG_SMP 413#ifdef CONFIG_SMP
415 if (!cpu_eiem) 414 if (!cpu_eiem) {
415 claim_cpu_irqs();
416 cpu_eiem = EIEM_MASK(IPI_IRQ) | EIEM_MASK(TIMER_IRQ); 416 cpu_eiem = EIEM_MASK(IPI_IRQ) | EIEM_MASK(TIMER_IRQ);
417 }
417#else 418#else
419 claim_cpu_irqs();
418 cpu_eiem = EIEM_MASK(TIMER_IRQ); 420 cpu_eiem = EIEM_MASK(TIMER_IRQ);
419#endif 421#endif
420 set_eiem(cpu_eiem); /* EIEM : enable all external intr */ 422 set_eiem(cpu_eiem); /* EIEM : enable all external intr */
diff --git a/arch/parisc/kernel/ptrace.c b/arch/parisc/kernel/ptrace.c
index 857c2f545470..534abd4936e1 100644
--- a/arch/parisc/kernel/ptrace.c
+++ b/arch/parisc/kernel/ptrace.c
@@ -26,7 +26,7 @@
26#include <asm/asm-offsets.h> 26#include <asm/asm-offsets.h>
27 27
28/* PSW bits we allow the debugger to modify */ 28/* PSW bits we allow the debugger to modify */
29#define USER_PSW_BITS (PSW_N | PSW_V | PSW_CB) 29#define USER_PSW_BITS (PSW_N | PSW_B | PSW_V | PSW_CB)
30 30
31/* 31/*
32 * Called by kernel/ptrace.c when detaching.. 32 * Called by kernel/ptrace.c when detaching..
diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c
index 537996955998..fd051705a407 100644
--- a/arch/parisc/kernel/signal.c
+++ b/arch/parisc/kernel/signal.c
@@ -190,8 +190,10 @@ get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size)
190 DBG(1,"get_sigframe: ka = %#lx, sp = %#lx, frame_size = %#lx\n", 190 DBG(1,"get_sigframe: ka = %#lx, sp = %#lx, frame_size = %#lx\n",
191 (unsigned long)ka, sp, frame_size); 191 (unsigned long)ka, sp, frame_size);
192 192
193 /* Align alternate stack and reserve 64 bytes for the signal
194 handler's frame marker. */
193 if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! sas_ss_flags(sp)) 195 if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! sas_ss_flags(sp))
194 sp = current->sas_ss_sp; /* Stacks grow up! */ 196 sp = (current->sas_ss_sp + 0x7f) & ~0x3f; /* Stacks grow up! */
195 197
196 DBG(1,"get_sigframe: Returning sp = %#lx\n", (unsigned long)sp); 198 DBG(1,"get_sigframe: Returning sp = %#lx\n", (unsigned long)sp);
197 return (void __user *) sp; /* Stacks grow up. Fun. */ 199 return (void __user *) sp; /* Stacks grow up. Fun. */
diff --git a/arch/parisc/math-emu/cnv_float.h b/arch/parisc/math-emu/cnv_float.h
index 9071e093164a..933423fa5144 100644
--- a/arch/parisc/math-emu/cnv_float.h
+++ b/arch/parisc/math-emu/cnv_float.h
@@ -347,16 +347,15 @@
347 Sgl_isinexact_to_fix(sgl_value,exponent) 347 Sgl_isinexact_to_fix(sgl_value,exponent)
348 348
349#define Duint_from_sgl_mantissa(sgl_value,exponent,dresultA,dresultB) \ 349#define Duint_from_sgl_mantissa(sgl_value,exponent,dresultA,dresultB) \
350 {Sall(sgl_value) <<= SGL_EXP_LENGTH; /* left-justify */ \ 350 {unsigned int val = Sall(sgl_value) << SGL_EXP_LENGTH; \
351 if (exponent <= 31) { \ 351 if (exponent <= 31) { \
352 Dintp1(dresultA) = 0; \ 352 Dintp1(dresultA) = 0; \
353 Dintp2(dresultB) = (unsigned)Sall(sgl_value) >> (31 - exponent); \ 353 Dintp2(dresultB) = val >> (31 - exponent); \
354 } \ 354 } \
355 else { \ 355 else { \
356 Dintp1(dresultA) = Sall(sgl_value) >> (63 - exponent); \ 356 Dintp1(dresultA) = val >> (63 - exponent); \
357 Dintp2(dresultB) = Sall(sgl_value) << (exponent - 31); \ 357 Dintp2(dresultB) = exponent <= 62 ? val << (exponent - 31) : 0; \
358 } \ 358 } \
359 Sall(sgl_value) >>= SGL_EXP_LENGTH; /* return to original */ \
360 } 359 }
361 360
362#define Duint_setzero(dresultA,dresultB) \ 361#define Duint_setzero(dresultA,dresultB) \
diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
index b0ef73882b38..a8fb03e22770 100644
--- a/arch/powerpc/include/asm/eeh.h
+++ b/arch/powerpc/include/asm/eeh.h
@@ -183,7 +183,7 @@ static inline void eeh_unlock(void)
183#define EEH_MAX_ALLOWED_FREEZES 5 183#define EEH_MAX_ALLOWED_FREEZES 5
184 184
185typedef void *(*eeh_traverse_func)(void *data, void *flag); 185typedef void *(*eeh_traverse_func)(void *data, void *flag);
186int __devinit eeh_phb_pe_create(struct pci_controller *phb); 186int eeh_phb_pe_create(struct pci_controller *phb);
187int eeh_add_to_parent_pe(struct eeh_dev *edev); 187int eeh_add_to_parent_pe(struct eeh_dev *edev);
188int eeh_rmv_from_parent_pe(struct eeh_dev *edev, int purge_pe); 188int eeh_rmv_from_parent_pe(struct eeh_dev *edev, int purge_pe);
189void *eeh_pe_dev_traverse(struct eeh_pe *root, 189void *eeh_pe_dev_traverse(struct eeh_pe *root,
@@ -191,8 +191,8 @@ void *eeh_pe_dev_traverse(struct eeh_pe *root,
191void eeh_pe_restore_bars(struct eeh_pe *pe); 191void eeh_pe_restore_bars(struct eeh_pe *pe);
192struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe); 192struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe);
193 193
194void * __devinit eeh_dev_init(struct device_node *dn, void *data); 194void *eeh_dev_init(struct device_node *dn, void *data);
195void __devinit eeh_dev_phb_init_dynamic(struct pci_controller *phb); 195void eeh_dev_phb_init_dynamic(struct pci_controller *phb);
196int __init eeh_ops_register(struct eeh_ops *ops); 196int __init eeh_ops_register(struct eeh_ops *ops);
197int __exit eeh_ops_unregister(const char *name); 197int __exit eeh_ops_unregister(const char *name);
198unsigned long eeh_check_failure(const volatile void __iomem *token, 198unsigned long eeh_check_failure(const volatile void __iomem *token,
diff --git a/arch/powerpc/include/asm/io-workarounds.h b/arch/powerpc/include/asm/io-workarounds.h
index fbae49286926..f96dd096ff4e 100644
--- a/arch/powerpc/include/asm/io-workarounds.h
+++ b/arch/powerpc/include/asm/io-workarounds.h
@@ -31,8 +31,8 @@ struct iowa_bus {
31 void *private; 31 void *private;
32}; 32};
33 33
34void __devinit iowa_register_bus(struct pci_controller *, struct ppc_pci_io *, 34void iowa_register_bus(struct pci_controller *, struct ppc_pci_io *,
35 int (*)(struct iowa_bus *, void *), void *); 35 int (*)(struct iowa_bus *, void *), void *);
36struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR); 36struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR);
37struct iowa_bus *iowa_pio_find_bus(unsigned long); 37struct iowa_bus *iowa_pio_find_bus(unsigned long);
38 38
diff --git a/arch/powerpc/include/asm/parport.h b/arch/powerpc/include/asm/parport.h
index 1ca1102b4a2f..6dc2577932b1 100644
--- a/arch/powerpc/include/asm/parport.h
+++ b/arch/powerpc/include/asm/parport.h
@@ -12,7 +12,7 @@
12 12
13#include <asm/prom.h> 13#include <asm/prom.h>
14 14
15static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma) 15static int parport_pc_find_nonpci_ports (int autoirq, int autodma)
16{ 16{
17 struct device_node *np; 17 struct device_node *np;
18 const u32 *prop; 18 const u32 *prop;
diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h
index 5a4e437c238d..195ce2ac5691 100644
--- a/arch/powerpc/include/asm/smp.h
+++ b/arch/powerpc/include/asm/smp.h
@@ -54,8 +54,8 @@ struct smp_ops_t {
54 54
55extern void smp_send_debugger_break(void); 55extern void smp_send_debugger_break(void);
56extern void start_secondary_resume(void); 56extern void start_secondary_resume(void);
57extern void __devinit smp_generic_give_timebase(void); 57extern void smp_generic_give_timebase(void);
58extern void __devinit smp_generic_take_timebase(void); 58extern void smp_generic_take_timebase(void);
59 59
60DECLARE_PER_CPU(unsigned int, cpu_pvr); 60DECLARE_PER_CPU(unsigned int, cpu_pvr);
61 61
diff --git a/arch/powerpc/include/asm/vio.h b/arch/powerpc/include/asm/vio.h
index df81cb72d1e0..68d0cc998b1b 100644
--- a/arch/powerpc/include/asm/vio.h
+++ b/arch/powerpc/include/asm/vio.h
@@ -139,7 +139,7 @@ extern void vio_unregister_driver(struct vio_driver *drv);
139extern int vio_cmo_entitlement_update(size_t); 139extern int vio_cmo_entitlement_update(size_t);
140extern void vio_cmo_set_dev_desired(struct vio_dev *viodev, size_t desired); 140extern void vio_cmo_set_dev_desired(struct vio_dev *viodev, size_t desired);
141 141
142extern void __devinit vio_unregister_device(struct vio_dev *dev); 142extern void vio_unregister_device(struct vio_dev *dev);
143 143
144extern int vio_h_cop_sync(struct vio_dev *vdev, struct vio_pfo_op *op); 144extern int vio_h_cop_sync(struct vio_dev *vdev, struct vio_pfo_op *op);
145 145
diff --git a/arch/powerpc/include/uapi/asm/kvm_para.h b/arch/powerpc/include/uapi/asm/kvm_para.h
index ed0e0254b47f..e3af3286a068 100644
--- a/arch/powerpc/include/uapi/asm/kvm_para.h
+++ b/arch/powerpc/include/uapi/asm/kvm_para.h
@@ -78,7 +78,7 @@ struct kvm_vcpu_arch_shared {
78 78
79#define KVM_HCALL_TOKEN(num) _EV_HCALL_TOKEN(EV_KVM_VENDOR_ID, num) 79#define KVM_HCALL_TOKEN(num) _EV_HCALL_TOKEN(EV_KVM_VENDOR_ID, num)
80 80
81#include <uapi/asm/epapr_hcalls.h> 81#include <asm/epapr_hcalls.h>
82 82
83#define KVM_FEATURE_MAGIC_PAGE 1 83#define KVM_FEATURE_MAGIC_PAGE 1
84 84
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index d22e73e4618b..e514de57a125 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -439,6 +439,8 @@ ret_from_fork:
439ret_from_kernel_thread: 439ret_from_kernel_thread:
440 REST_NVGPRS(r1) 440 REST_NVGPRS(r1)
441 bl schedule_tail 441 bl schedule_tail
442 li r3,0
443 stw r3,0(r1)
442 mtlr r14 444 mtlr r14
443 mr r3,r15 445 mr r3,r15
444 PPC440EP_ERR42 446 PPC440EP_ERR42
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index b310a0573625..3d990d3bd8ba 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -664,6 +664,19 @@ resume_kernel:
664 ld r4,TI_FLAGS(r9) 664 ld r4,TI_FLAGS(r9)
665 andi. r0,r4,_TIF_NEED_RESCHED 665 andi. r0,r4,_TIF_NEED_RESCHED
666 bne 1b 666 bne 1b
667
668 /*
669 * arch_local_irq_restore() from preempt_schedule_irq above may
670 * enable hard interrupt but we really should disable interrupts
671 * when we return from the interrupt, and so that we don't get
672 * interrupted after loading SRR0/1.
673 */
674#ifdef CONFIG_PPC_BOOK3E
675 wrteei 0
676#else
677 ld r10,PACAKMSR(r13) /* Get kernel MSR without EE */
678 mtmsrd r10,1 /* Update machine state */
679#endif /* CONFIG_PPC_BOOK3E */
667#endif /* CONFIG_PREEMPT */ 680#endif /* CONFIG_PREEMPT */
668 681
669 .globl fast_exc_return_irq 682 .globl fast_exc_return_irq
diff --git a/arch/powerpc/kernel/io-workarounds.c b/arch/powerpc/kernel/io-workarounds.c
index 12d329bcbb98..50e90b7e7139 100644
--- a/arch/powerpc/kernel/io-workarounds.c
+++ b/arch/powerpc/kernel/io-workarounds.c
@@ -118,7 +118,7 @@ static void iowa_##name at \
118#undef DEF_PCI_AC_RET 118#undef DEF_PCI_AC_RET
119#undef DEF_PCI_AC_NORET 119#undef DEF_PCI_AC_NORET
120 120
121static const struct ppc_pci_io __devinitconst iowa_pci_io = { 121static const struct ppc_pci_io iowa_pci_io = {
122 122
123#define DEF_PCI_AC_RET(name, ret, at, al, space, aa) .name = iowa_##name, 123#define DEF_PCI_AC_RET(name, ret, at, al, space, aa) .name = iowa_##name,
124#define DEF_PCI_AC_NORET(name, at, al, space, aa) .name = iowa_##name, 124#define DEF_PCI_AC_NORET(name, at, al, space, aa) .name = iowa_##name,
@@ -146,7 +146,7 @@ static void __iomem *iowa_ioremap(phys_addr_t addr, unsigned long size,
146} 146}
147 147
148/* Enable IO workaround */ 148/* Enable IO workaround */
149static void __devinit io_workaround_init(void) 149static void io_workaround_init(void)
150{ 150{
151 static int io_workaround_inited; 151 static int io_workaround_inited;
152 152
@@ -158,9 +158,8 @@ static void __devinit io_workaround_init(void)
158} 158}
159 159
160/* Register new bus to support workaround */ 160/* Register new bus to support workaround */
161void __devinit iowa_register_bus(struct pci_controller *phb, 161void iowa_register_bus(struct pci_controller *phb, struct ppc_pci_io *ops,
162 struct ppc_pci_io *ops, 162 int (*initfunc)(struct iowa_bus *, void *), void *data)
163 int (*initfunc)(struct iowa_bus *, void *), void *data)
164{ 163{
165 struct iowa_bus *bus; 164 struct iowa_bus *bus;
166 struct device_node *np = phb->dn; 165 struct device_node *np = phb->dn;
diff --git a/arch/powerpc/kernel/isa-bridge.c b/arch/powerpc/kernel/isa-bridge.c
index d45ec58703ce..0f1997097960 100644
--- a/arch/powerpc/kernel/isa-bridge.c
+++ b/arch/powerpc/kernel/isa-bridge.c
@@ -41,8 +41,8 @@ EXPORT_SYMBOL_GPL(isa_bridge_pcidev);
41#define ISA_SPACE_MASK 0x1 41#define ISA_SPACE_MASK 0x1
42#define ISA_SPACE_IO 0x1 42#define ISA_SPACE_IO 0x1
43 43
44static void __devinit pci_process_ISA_OF_ranges(struct device_node *isa_node, 44static void pci_process_ISA_OF_ranges(struct device_node *isa_node,
45 unsigned long phb_io_base_phys) 45 unsigned long phb_io_base_phys)
46{ 46{
47 /* We should get some saner parsing here and remove these structs */ 47 /* We should get some saner parsing here and remove these structs */
48 struct pci_address { 48 struct pci_address {
@@ -170,8 +170,8 @@ void __init isa_bridge_find_early(struct pci_controller *hose)
170 * isa_bridge_find_late - Find and map the ISA IO space upon discovery of 170 * isa_bridge_find_late - Find and map the ISA IO space upon discovery of
171 * a new ISA bridge 171 * a new ISA bridge
172 */ 172 */
173static void __devinit isa_bridge_find_late(struct pci_dev *pdev, 173static void isa_bridge_find_late(struct pci_dev *pdev,
174 struct device_node *devnode) 174 struct device_node *devnode)
175{ 175{
176 struct pci_controller *hose = pci_bus_to_host(pdev->bus); 176 struct pci_controller *hose = pci_bus_to_host(pdev->bus);
177 177
@@ -215,8 +215,8 @@ static void isa_bridge_remove(void)
215/** 215/**
216 * isa_bridge_notify - Get notified of PCI devices addition/removal 216 * isa_bridge_notify - Get notified of PCI devices addition/removal
217 */ 217 */
218static int __devinit isa_bridge_notify(struct notifier_block *nb, 218static int isa_bridge_notify(struct notifier_block *nb, unsigned long action,
219 unsigned long action, void *data) 219 void *data)
220{ 220{
221 struct device *dev = data; 221 struct device *dev = data;
222 struct pci_dev *pdev = to_pci_dev(dev); 222 struct pci_dev *pdev = to_pci_dev(dev);
diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
index c470a40b29f5..a7bc7521c064 100644
--- a/arch/powerpc/kernel/kgdb.c
+++ b/arch/powerpc/kernel/kgdb.c
@@ -154,12 +154,12 @@ static int kgdb_handle_breakpoint(struct pt_regs *regs)
154static int kgdb_singlestep(struct pt_regs *regs) 154static int kgdb_singlestep(struct pt_regs *regs)
155{ 155{
156 struct thread_info *thread_info, *exception_thread_info; 156 struct thread_info *thread_info, *exception_thread_info;
157 struct thread_info *backup_current_thread_info = \ 157 struct thread_info *backup_current_thread_info;
158 (struct thread_info *)kmalloc(sizeof(struct thread_info), GFP_KERNEL);
159 158
160 if (user_mode(regs)) 159 if (user_mode(regs))
161 return 0; 160 return 0;
162 161
162 backup_current_thread_info = (struct thread_info *)kmalloc(sizeof(struct thread_info), GFP_KERNEL);
163 /* 163 /*
164 * On Book E and perhaps other processors, singlestep is handled on 164 * On Book E and perhaps other processors, singlestep is handled on
165 * the critical exception stack. This causes current_thread_info() 165 * the critical exception stack. This causes current_thread_info()
@@ -185,6 +185,7 @@ static int kgdb_singlestep(struct pt_regs *regs)
185 /* Restore current_thread_info lastly. */ 185 /* Restore current_thread_info lastly. */
186 memcpy(exception_thread_info, backup_current_thread_info, sizeof *thread_info); 186 memcpy(exception_thread_info, backup_current_thread_info, sizeof *thread_info);
187 187
188 kfree(backup_current_thread_info);
188 return 1; 189 return 1;
189} 190}
190 191
diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c
index 9db8ec07ec94..07c12697d708 100644
--- a/arch/powerpc/kernel/of_platform.c
+++ b/arch/powerpc/kernel/of_platform.c
@@ -37,7 +37,7 @@
37 * lacking some bits needed here. 37 * lacking some bits needed here.
38 */ 38 */
39 39
40static int __devinit of_pci_phb_probe(struct platform_device *dev) 40static int of_pci_phb_probe(struct platform_device *dev)
41{ 41{
42 struct pci_controller *phb; 42 struct pci_controller *phb;
43 43
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index abc0d0856994..7c37379ea9b1 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -673,9 +673,8 @@ void pci_resource_to_user(const struct pci_dev *dev, int bar,
673 * - Some 32 bits platforms such as 4xx can have physical space larger than 673 * - Some 32 bits platforms such as 4xx can have physical space larger than
674 * 32 bits so we need to use 64 bits values for the parsing 674 * 32 bits so we need to use 64 bits values for the parsing
675 */ 675 */
676void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose, 676void pci_process_bridge_OF_ranges(struct pci_controller *hose,
677 struct device_node *dev, 677 struct device_node *dev, int primary)
678 int primary)
679{ 678{
680 const u32 *ranges; 679 const u32 *ranges;
681 int rlen; 680 int rlen;
@@ -848,7 +847,7 @@ int pci_proc_domain(struct pci_bus *bus)
848/* This header fixup will do the resource fixup for all devices as they are 847/* This header fixup will do the resource fixup for all devices as they are
849 * probed, but not for bridge ranges 848 * probed, but not for bridge ranges
850 */ 849 */
851static void __devinit pcibios_fixup_resources(struct pci_dev *dev) 850static void pcibios_fixup_resources(struct pci_dev *dev)
852{ 851{
853 struct pci_controller *hose = pci_bus_to_host(dev->bus); 852 struct pci_controller *hose = pci_bus_to_host(dev->bus);
854 int i; 853 int i;
@@ -902,8 +901,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_resources);
902 * things go more smoothly when it gets it right. It should covers cases such 901 * things go more smoothly when it gets it right. It should covers cases such
903 * as Apple "closed" bridge resources and bare-metal pSeries unassigned bridges 902 * as Apple "closed" bridge resources and bare-metal pSeries unassigned bridges
904 */ 903 */
905static int __devinit pcibios_uninitialized_bridge_resource(struct pci_bus *bus, 904static int pcibios_uninitialized_bridge_resource(struct pci_bus *bus,
906 struct resource *res) 905 struct resource *res)
907{ 906{
908 struct pci_controller *hose = pci_bus_to_host(bus); 907 struct pci_controller *hose = pci_bus_to_host(bus);
909 struct pci_dev *dev = bus->self; 908 struct pci_dev *dev = bus->self;
@@ -967,7 +966,7 @@ static int __devinit pcibios_uninitialized_bridge_resource(struct pci_bus *bus,
967} 966}
968 967
969/* Fixup resources of a PCI<->PCI bridge */ 968/* Fixup resources of a PCI<->PCI bridge */
970static void __devinit pcibios_fixup_bridge(struct pci_bus *bus) 969static void pcibios_fixup_bridge(struct pci_bus *bus)
971{ 970{
972 struct resource *res; 971 struct resource *res;
973 int i; 972 int i;
@@ -1007,7 +1006,7 @@ static void __devinit pcibios_fixup_bridge(struct pci_bus *bus)
1007 } 1006 }
1008} 1007}
1009 1008
1010void __devinit pcibios_setup_bus_self(struct pci_bus *bus) 1009void pcibios_setup_bus_self(struct pci_bus *bus)
1011{ 1010{
1012 /* Fix up the bus resources for P2P bridges */ 1011 /* Fix up the bus resources for P2P bridges */
1013 if (bus->self != NULL) 1012 if (bus->self != NULL)
@@ -1024,7 +1023,7 @@ void __devinit pcibios_setup_bus_self(struct pci_bus *bus)
1024 ppc_md.pci_dma_bus_setup(bus); 1023 ppc_md.pci_dma_bus_setup(bus);
1025} 1024}
1026 1025
1027void __devinit pcibios_setup_bus_devices(struct pci_bus *bus) 1026void pcibios_setup_bus_devices(struct pci_bus *bus)
1028{ 1027{
1029 struct pci_dev *dev; 1028 struct pci_dev *dev;
1030 1029
@@ -1063,7 +1062,7 @@ void pcibios_set_master(struct pci_dev *dev)
1063 /* No special bus mastering setup handling */ 1062 /* No special bus mastering setup handling */
1064} 1063}
1065 1064
1066void __devinit pcibios_fixup_bus(struct pci_bus *bus) 1065void pcibios_fixup_bus(struct pci_bus *bus)
1067{ 1066{
1068 /* When called from the generic PCI probe, read PCI<->PCI bridge 1067 /* When called from the generic PCI probe, read PCI<->PCI bridge
1069 * bases. This is -not- called when generating the PCI tree from 1068 * bases. This is -not- called when generating the PCI tree from
@@ -1080,7 +1079,7 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus)
1080} 1079}
1081EXPORT_SYMBOL(pcibios_fixup_bus); 1080EXPORT_SYMBOL(pcibios_fixup_bus);
1082 1081
1083void __devinit pci_fixup_cardbus(struct pci_bus *bus) 1082void pci_fixup_cardbus(struct pci_bus *bus)
1084{ 1083{
1085 /* Now fixup devices on that bus */ 1084 /* Now fixup devices on that bus */
1086 pcibios_setup_bus_devices(bus); 1085 pcibios_setup_bus_devices(bus);
@@ -1264,7 +1263,7 @@ void pcibios_allocate_bus_resources(struct pci_bus *bus)
1264 pcibios_allocate_bus_resources(b); 1263 pcibios_allocate_bus_resources(b);
1265} 1264}
1266 1265
1267static inline void __devinit alloc_resource(struct pci_dev *dev, int idx) 1266static inline void alloc_resource(struct pci_dev *dev, int idx)
1268{ 1267{
1269 struct resource *pr, *r = &dev->resource[idx]; 1268 struct resource *pr, *r = &dev->resource[idx];
1270 1269
@@ -1500,7 +1499,8 @@ resource_size_t pcibios_io_space_offset(struct pci_controller *hose)
1500 return (unsigned long) hose->io_base_virt - _IO_BASE; 1499 return (unsigned long) hose->io_base_virt - _IO_BASE;
1501} 1500}
1502 1501
1503static void __devinit pcibios_setup_phb_resources(struct pci_controller *hose, struct list_head *resources) 1502static void pcibios_setup_phb_resources(struct pci_controller *hose,
1503 struct list_head *resources)
1504{ 1504{
1505 struct resource *res; 1505 struct resource *res;
1506 int i; 1506 int i;
@@ -1639,7 +1639,7 @@ struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
1639 * pci_scan_phb - Given a pci_controller, setup and scan the PCI bus 1639 * pci_scan_phb - Given a pci_controller, setup and scan the PCI bus
1640 * @hose: Pointer to the PCI host controller instance structure 1640 * @hose: Pointer to the PCI host controller instance structure
1641 */ 1641 */
1642void __devinit pcibios_scan_phb(struct pci_controller *hose) 1642void pcibios_scan_phb(struct pci_controller *hose)
1643{ 1643{
1644 LIST_HEAD(resources); 1644 LIST_HEAD(resources);
1645 struct pci_bus *bus; 1645 struct pci_bus *bus;
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index 64f526a321f5..e37c2152acf4 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -213,7 +213,7 @@ pci_create_OF_bus_map(void)
213 } 213 }
214} 214}
215 215
216void __devinit pcibios_setup_phb_io_space(struct pci_controller *hose) 216void pcibios_setup_phb_io_space(struct pci_controller *hose)
217{ 217{
218 unsigned long io_offset; 218 unsigned long io_offset;
219 struct resource *res = &hose->io_resource; 219 struct resource *res = &hose->io_resource;
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 2cbe6768fddd..51a133a78a09 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -122,7 +122,7 @@ int pcibios_unmap_io_space(struct pci_bus *bus)
122} 122}
123EXPORT_SYMBOL_GPL(pcibios_unmap_io_space); 123EXPORT_SYMBOL_GPL(pcibios_unmap_io_space);
124 124
125static int __devinit pcibios_map_phb_io_space(struct pci_controller *hose) 125static int pcibios_map_phb_io_space(struct pci_controller *hose)
126{ 126{
127 struct vm_struct *area; 127 struct vm_struct *area;
128 unsigned long phys_page; 128 unsigned long phys_page;
@@ -173,7 +173,7 @@ static int __devinit pcibios_map_phb_io_space(struct pci_controller *hose)
173 return 0; 173 return 0;
174} 174}
175 175
176int __devinit pcibios_map_io_space(struct pci_bus *bus) 176int pcibios_map_io_space(struct pci_bus *bus)
177{ 177{
178 WARN_ON(bus == NULL); 178 WARN_ON(bus == NULL);
179 179
@@ -193,7 +193,7 @@ int __devinit pcibios_map_io_space(struct pci_bus *bus)
193} 193}
194EXPORT_SYMBOL_GPL(pcibios_map_io_space); 194EXPORT_SYMBOL_GPL(pcibios_map_io_space);
195 195
196void __devinit pcibios_setup_phb_io_space(struct pci_controller *hose) 196void pcibios_setup_phb_io_space(struct pci_controller *hose)
197{ 197{
198 pcibios_map_phb_io_space(hose); 198 pcibios_map_phb_io_space(hose);
199} 199}
diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c
index dd9e4a04bf79..e7af165f8b9d 100644
--- a/arch/powerpc/kernel/pci_dn.c
+++ b/arch/powerpc/kernel/pci_dn.c
@@ -36,7 +36,7 @@
36 * Traverse_func that inits the PCI fields of the device node. 36 * Traverse_func that inits the PCI fields of the device node.
37 * NOTE: this *must* be done before read/write config to the device. 37 * NOTE: this *must* be done before read/write config to the device.
38 */ 38 */
39void * __devinit update_dn_pci_info(struct device_node *dn, void *data) 39void *update_dn_pci_info(struct device_node *dn, void *data)
40{ 40{
41 struct pci_controller *phb = data; 41 struct pci_controller *phb = data;
42 const int *type = 42 const int *type =
@@ -129,7 +129,7 @@ void *traverse_pci_devices(struct device_node *start, traverse_func pre,
129 * subsystem is set up, before kmalloc is valid) and during the 129 * subsystem is set up, before kmalloc is valid) and during the
130 * dynamic lpar operation of adding a PHB to a running system. 130 * dynamic lpar operation of adding a PHB to a running system.
131 */ 131 */
132void __devinit pci_devs_phb_init_dynamic(struct pci_controller *phb) 132void pci_devs_phb_init_dynamic(struct pci_controller *phb)
133{ 133{
134 struct device_node *dn = phb->dn; 134 struct device_node *dn = phb->dn;
135 struct pci_dn *pdn; 135 struct pci_dn *pdn;
diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
index 30378a19f65d..2a67e9baa59f 100644
--- a/arch/powerpc/kernel/pci_of_scan.c
+++ b/arch/powerpc/kernel/pci_of_scan.c
@@ -204,7 +204,7 @@ EXPORT_SYMBOL(of_create_pci_dev);
204 * this routine in turn call of_scan_bus() recusively to scan for more child 204 * this routine in turn call of_scan_bus() recusively to scan for more child
205 * devices. 205 * devices.
206 */ 206 */
207void __devinit of_scan_pci_bridge(struct pci_dev *dev) 207void of_scan_pci_bridge(struct pci_dev *dev)
208{ 208{
209 struct device_node *node = dev->dev.of_node; 209 struct device_node *node = dev->dev.of_node;
210 struct pci_bus *bus; 210 struct pci_bus *bus;
@@ -299,8 +299,8 @@ EXPORT_SYMBOL(of_scan_pci_bridge);
299 * @bus: pci_bus structure for the PCI bus 299 * @bus: pci_bus structure for the PCI bus
300 * @rescan_existing: Flag indicating bus has already been set up 300 * @rescan_existing: Flag indicating bus has already been set up
301 */ 301 */
302static void __devinit __of_scan_bus(struct device_node *node, 302static void __of_scan_bus(struct device_node *node, struct pci_bus *bus,
303 struct pci_bus *bus, int rescan_existing) 303 int rescan_existing)
304{ 304{
305 struct device_node *child; 305 struct device_node *child;
306 const u32 *reg; 306 const u32 *reg;
@@ -348,8 +348,7 @@ static void __devinit __of_scan_bus(struct device_node *node,
348 * @node: device tree node for the PCI bus 348 * @node: device tree node for the PCI bus
349 * @bus: pci_bus structure for the PCI bus 349 * @bus: pci_bus structure for the PCI bus
350 */ 350 */
351void __devinit of_scan_bus(struct device_node *node, 351void of_scan_bus(struct device_node *node, struct pci_bus *bus)
352 struct pci_bus *bus)
353{ 352{
354 __of_scan_bus(node, bus, 0); 353 __of_scan_bus(node, bus, 0);
355} 354}
@@ -363,8 +362,7 @@ EXPORT_SYMBOL_GPL(of_scan_bus);
363 * Same as of_scan_bus, but for a pci_bus structure that has already been 362 * Same as of_scan_bus, but for a pci_bus structure that has already been
364 * setup. 363 * setup.
365 */ 364 */
366void __devinit of_rescan_bus(struct device_node *node, 365void of_rescan_bus(struct device_node *node, struct pci_bus *bus)
367 struct pci_bus *bus)
368{ 366{
369 __of_scan_bus(node, bus, 1); 367 __of_scan_bus(node, bus, 1);
370} 368}
diff --git a/arch/powerpc/kernel/rtas_pci.c b/arch/powerpc/kernel/rtas_pci.c
index 6de63e3250bb..71cb20d6ec61 100644
--- a/arch/powerpc/kernel/rtas_pci.c
+++ b/arch/powerpc/kernel/rtas_pci.c
@@ -209,7 +209,7 @@ void __init init_pci_config_tokens (void)
209 ibm_write_pci_config = rtas_token("ibm,write-pci-config"); 209 ibm_write_pci_config = rtas_token("ibm,write-pci-config");
210} 210}
211 211
212unsigned long __devinit get_phb_buid (struct device_node *phb) 212unsigned long get_phb_buid (struct device_node *phb)
213{ 213{
214 struct resource r; 214 struct resource r;
215 215
@@ -237,7 +237,7 @@ static int phb_set_bus_ranges(struct device_node *dev,
237 return 0; 237 return 0;
238} 238}
239 239
240int __devinit rtas_setup_phb(struct pci_controller *phb) 240int rtas_setup_phb(struct pci_controller *phb)
241{ 241{
242 struct device_node *dev = phb->dn; 242 struct device_node *dev = phb->dn;
243 243
diff --git a/arch/powerpc/kernel/smp-tbsync.c b/arch/powerpc/kernel/smp-tbsync.c
index 640de836e466..e68fd1ae727a 100644
--- a/arch/powerpc/kernel/smp-tbsync.c
+++ b/arch/powerpc/kernel/smp-tbsync.c
@@ -36,13 +36,13 @@ static struct {
36 36
37static volatile int running; 37static volatile int running;
38 38
39static void __devinit enter_contest(u64 mark, long add) 39static void enter_contest(u64 mark, long add)
40{ 40{
41 while (get_tb() < mark) 41 while (get_tb() < mark)
42 tbsync->race_result = add; 42 tbsync->race_result = add;
43} 43}
44 44
45void __devinit smp_generic_take_timebase(void) 45void smp_generic_take_timebase(void)
46{ 46{
47 int cmd; 47 int cmd;
48 u64 tb; 48 u64 tb;
@@ -75,7 +75,7 @@ void __devinit smp_generic_take_timebase(void)
75 local_irq_restore(flags); 75 local_irq_restore(flags);
76} 76}
77 77
78static int __devinit start_contest(int cmd, long offset, int num) 78static int start_contest(int cmd, long offset, int num)
79{ 79{
80 int i, score=0; 80 int i, score=0;
81 u64 tb; 81 u64 tb;
@@ -110,7 +110,7 @@ static int __devinit start_contest(int cmd, long offset, int num)
110 return score; 110 return score;
111} 111}
112 112
113void __devinit smp_generic_give_timebase(void) 113void smp_generic_give_timebase(void)
114{ 114{
115 int i, score, score2, old, min=0, max=5000, offset=1000; 115 int i, score, score2, old, min=0, max=5000, offset=1000;
116 116
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index e5b133ebd8a5..793401e65088 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -82,7 +82,7 @@ int smt_enabled_at_boot = 1;
82static void (*crash_ipi_function_ptr)(struct pt_regs *) = NULL; 82static void (*crash_ipi_function_ptr)(struct pt_regs *) = NULL;
83 83
84#ifdef CONFIG_PPC64 84#ifdef CONFIG_PPC64
85int __devinit smp_generic_kick_cpu(int nr) 85int smp_generic_kick_cpu(int nr)
86{ 86{
87 BUG_ON(nr < 0 || nr >= NR_CPUS); 87 BUG_ON(nr < 0 || nr >= NR_CPUS);
88 88
@@ -311,7 +311,7 @@ void smp_send_stop(void)
311 311
312struct thread_info *current_set[NR_CPUS]; 312struct thread_info *current_set[NR_CPUS];
313 313
314static void __devinit smp_store_cpu_info(int id) 314static void smp_store_cpu_info(int id)
315{ 315{
316 per_cpu(cpu_pvr, id) = mfspr(SPRN_PVR); 316 per_cpu(cpu_pvr, id) = mfspr(SPRN_PVR);
317#ifdef CONFIG_PPC_FSL_BOOK3E 317#ifdef CONFIG_PPC_FSL_BOOK3E
@@ -355,7 +355,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
355 max_cpus = 1; 355 max_cpus = 1;
356} 356}
357 357
358void __devinit smp_prepare_boot_cpu(void) 358void smp_prepare_boot_cpu(void)
359{ 359{
360 BUG_ON(smp_processor_id() != boot_cpuid); 360 BUG_ON(smp_processor_id() != boot_cpuid);
361#ifdef CONFIG_PPC64 361#ifdef CONFIG_PPC64
@@ -610,7 +610,7 @@ static struct device_node *cpu_to_l2cache(int cpu)
610} 610}
611 611
612/* Activate a secondary processor. */ 612/* Activate a secondary processor. */
613void __devinit start_secondary(void *unused) 613void start_secondary(void *unused)
614{ 614{
615 unsigned int cpu = smp_processor_id(); 615 unsigned int cpu = smp_processor_id();
616 struct device_node *l2_cache; 616 struct device_node *l2_cache;
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index b3b14352b05e..127361e093f4 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -494,10 +494,15 @@ void timer_interrupt(struct pt_regs * regs)
494 set_dec(DECREMENTER_MAX); 494 set_dec(DECREMENTER_MAX);
495 495
496 /* Some implementations of hotplug will get timer interrupts while 496 /* Some implementations of hotplug will get timer interrupts while
497 * offline, just ignore these 497 * offline, just ignore these and we also need to set
498 * decrementers_next_tb as MAX to make sure __check_irq_replay
499 * don't replay timer interrupt when return, otherwise we'll trap
500 * here infinitely :(
498 */ 501 */
499 if (!cpu_online(smp_processor_id())) 502 if (!cpu_online(smp_processor_id())) {
503 *next_tb = ~(u64)0;
500 return; 504 return;
505 }
501 506
502 /* Conditionally hard-enable interrupts now that the DEC has been 507 /* Conditionally hard-enable interrupts now that the DEC has been
503 * bumped to its maximum value 508 * bumped to its maximum value
@@ -770,13 +775,8 @@ void update_vsyscall_old(struct timespec *wall_time, struct timespec *wtm,
770 775
771void update_vsyscall_tz(void) 776void update_vsyscall_tz(void)
772{ 777{
773 /* Make userspace gettimeofday spin until we're done. */
774 ++vdso_data->tb_update_count;
775 smp_mb();
776 vdso_data->tz_minuteswest = sys_tz.tz_minuteswest; 778 vdso_data->tz_minuteswest = sys_tz.tz_minuteswest;
777 vdso_data->tz_dsttime = sys_tz.tz_dsttime; 779 vdso_data->tz_dsttime = sys_tz.tz_dsttime;
778 smp_mb();
779 ++vdso_data->tb_update_count;
780} 780}
781 781
782static void __init clocksource_init(void) 782static void __init clocksource_init(void)
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index 201ba59738be..536016d792ba 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -1289,7 +1289,7 @@ void vio_unregister_driver(struct vio_driver *viodrv)
1289EXPORT_SYMBOL(vio_unregister_driver); 1289EXPORT_SYMBOL(vio_unregister_driver);
1290 1290
1291/* vio_dev refcount hit 0 */ 1291/* vio_dev refcount hit 0 */
1292static void __devinit vio_dev_release(struct device *dev) 1292static void vio_dev_release(struct device *dev)
1293{ 1293{
1294 struct iommu_table *tbl = get_iommu_table_base(dev); 1294 struct iommu_table *tbl = get_iommu_table_base(dev);
1295 1295
@@ -1545,7 +1545,7 @@ static struct device_attribute vio_dev_attrs[] = {
1545 __ATTR_NULL 1545 __ATTR_NULL
1546}; 1546};
1547 1547
1548void __devinit vio_unregister_device(struct vio_dev *viodev) 1548void vio_unregister_device(struct vio_dev *viodev)
1549{ 1549{
1550 device_unregister(&viodev->dev); 1550 device_unregister(&viodev->dev);
1551} 1551}
diff --git a/arch/powerpc/kvm/book3s_hv_ras.c b/arch/powerpc/kvm/book3s_hv_ras.c
index 35f3cf0269b3..a353c485808c 100644
--- a/arch/powerpc/kvm/book3s_hv_ras.c
+++ b/arch/powerpc/kvm/book3s_hv_ras.c
@@ -79,7 +79,9 @@ static void flush_tlb_power7(struct kvm_vcpu *vcpu)
79static long kvmppc_realmode_mc_power7(struct kvm_vcpu *vcpu) 79static long kvmppc_realmode_mc_power7(struct kvm_vcpu *vcpu)
80{ 80{
81 unsigned long srr1 = vcpu->arch.shregs.msr; 81 unsigned long srr1 = vcpu->arch.shregs.msr;
82#ifdef CONFIG_PPC_POWERNV
82 struct opal_machine_check_event *opal_evt; 83 struct opal_machine_check_event *opal_evt;
84#endif
83 long handled = 1; 85 long handled = 1;
84 86
85 if (srr1 & SRR1_MC_LDSTERR) { 87 if (srr1 & SRR1_MC_LDSTERR) {
@@ -117,6 +119,7 @@ static long kvmppc_realmode_mc_power7(struct kvm_vcpu *vcpu)
117 handled = 0; 119 handled = 0;
118 } 120 }
119 121
122#ifdef CONFIG_PPC_POWERNV
120 /* 123 /*
121 * See if OPAL has already handled the condition. 124 * See if OPAL has already handled the condition.
122 * We assume that if the condition is recovered then OPAL 125 * We assume that if the condition is recovered then OPAL
@@ -131,6 +134,7 @@ static long kvmppc_realmode_mc_power7(struct kvm_vcpu *vcpu)
131 134
132 if (handled) 135 if (handled)
133 opal_evt->in_use = 0; 136 opal_evt->in_use = 0;
137#endif
134 138
135 return handled; 139 return handled;
136} 140}
diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c
index b0855e5d8905..9d9cddc5b346 100644
--- a/arch/powerpc/kvm/emulate.c
+++ b/arch/powerpc/kvm/emulate.c
@@ -39,6 +39,7 @@
39#define OP_31_XOP_TRAP 4 39#define OP_31_XOP_TRAP 4
40#define OP_31_XOP_LWZX 23 40#define OP_31_XOP_LWZX 23
41#define OP_31_XOP_TRAP_64 68 41#define OP_31_XOP_TRAP_64 68
42#define OP_31_XOP_DCBF 86
42#define OP_31_XOP_LBZX 87 43#define OP_31_XOP_LBZX 87
43#define OP_31_XOP_STWX 151 44#define OP_31_XOP_STWX 151
44#define OP_31_XOP_STBX 215 45#define OP_31_XOP_STBX 215
@@ -374,6 +375,7 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
374 emulated = kvmppc_emulate_mtspr(vcpu, sprn, rs); 375 emulated = kvmppc_emulate_mtspr(vcpu, sprn, rs);
375 break; 376 break;
376 377
378 case OP_31_XOP_DCBF:
377 case OP_31_XOP_DCBI: 379 case OP_31_XOP_DCBI:
378 /* Do nothing. The guest is performing dcbi because 380 /* Do nothing. The guest is performing dcbi because
379 * hardware DMA is not snooped by the dcache, but 381 * hardware DMA is not snooped by the dcache, but
diff --git a/arch/powerpc/mm/tlb_hash64.c b/arch/powerpc/mm/tlb_hash64.c
index ae758b3ff72c..0d82ef50dc3f 100644
--- a/arch/powerpc/mm/tlb_hash64.c
+++ b/arch/powerpc/mm/tlb_hash64.c
@@ -186,8 +186,6 @@ void tlb_flush(struct mmu_gather *tlb)
186 * Because of that usage pattern, it's only available with CONFIG_HOTPLUG 186 * Because of that usage pattern, it's only available with CONFIG_HOTPLUG
187 * and is implemented for small size rather than speed. 187 * and is implemented for small size rather than speed.
188 */ 188 */
189#ifdef CONFIG_HOTPLUG
190
191void __flush_hash_table_range(struct mm_struct *mm, unsigned long start, 189void __flush_hash_table_range(struct mm_struct *mm, unsigned long start,
192 unsigned long end) 190 unsigned long end)
193{ 191{
@@ -221,5 +219,3 @@ void __flush_hash_table_range(struct mm_struct *mm, unsigned long start,
221 arch_leave_lazy_mmu_mode(); 219 arch_leave_lazy_mmu_mode();
222 local_irq_restore(flags); 220 local_irq_restore(flags);
223} 221}
224
225#endif /* CONFIG_HOTPLUG */
diff --git a/arch/powerpc/oprofile/op_model_power4.c b/arch/powerpc/oprofile/op_model_power4.c
index 315f9495e9b2..f444b94935f5 100644
--- a/arch/powerpc/oprofile/op_model_power4.c
+++ b/arch/powerpc/oprofile/op_model_power4.c
@@ -52,7 +52,7 @@ static int power7_marked_instr_event(u64 mmcr1)
52 for (pmc = 0; pmc < 4; pmc++) { 52 for (pmc = 0; pmc < 4; pmc++) {
53 psel = mmcr1 & (OPROFILE_PM_PMCSEL_MSK 53 psel = mmcr1 & (OPROFILE_PM_PMCSEL_MSK
54 << (OPROFILE_MAX_PMC_NUM - pmc) 54 << (OPROFILE_MAX_PMC_NUM - pmc)
55 * OPROFILE_MAX_PMC_NUM); 55 * OPROFILE_PMSEL_FIELD_WIDTH);
56 psel = (psel >> ((OPROFILE_MAX_PMC_NUM - pmc) 56 psel = (psel >> ((OPROFILE_MAX_PMC_NUM - pmc)
57 * OPROFILE_PMSEL_FIELD_WIDTH)) & ~1ULL; 57 * OPROFILE_PMSEL_FIELD_WIDTH)) & ~1ULL;
58 unit = mmcr1 & (OPROFILE_PM_UNIT_MSK 58 unit = mmcr1 & (OPROFILE_PM_UNIT_MSK
diff --git a/arch/powerpc/platforms/40x/ppc40x_simple.c b/arch/powerpc/platforms/40x/ppc40x_simple.c
index 969dddcf3320..8f3920e5a046 100644
--- a/arch/powerpc/platforms/40x/ppc40x_simple.c
+++ b/arch/powerpc/platforms/40x/ppc40x_simple.c
@@ -57,7 +57,8 @@ static const char * const board[] __initconst = {
57 "amcc,makalu", 57 "amcc,makalu",
58 "apm,klondike", 58 "apm,klondike",
59 "est,hotfoot", 59 "est,hotfoot",
60 "plathome,obs600" 60 "plathome,obs600",
61 NULL
61}; 62};
62 63
63static int __init ppc40x_probe(void) 64static int __init ppc40x_probe(void)
diff --git a/arch/powerpc/platforms/44x/currituck.c b/arch/powerpc/platforms/44x/currituck.c
index 6bd89a0e0dea..ecd3890c40d7 100644
--- a/arch/powerpc/platforms/44x/currituck.c
+++ b/arch/powerpc/platforms/44x/currituck.c
@@ -46,7 +46,7 @@ static __initdata struct of_device_id ppc47x_of_bus[] = {
46 46
47/* The EEPROM is missing and the default values are bogus. This forces USB in 47/* The EEPROM is missing and the default values are bogus. This forces USB in
48 * to EHCI mode */ 48 * to EHCI mode */
49static void __devinit quirk_ppc_currituck_usb_fixup(struct pci_dev *dev) 49static void quirk_ppc_currituck_usb_fixup(struct pci_dev *dev)
50{ 50{
51 if (of_machine_is_compatible("ibm,currituck")) { 51 if (of_machine_is_compatible("ibm,currituck")) {
52 pci_write_config_dword(dev, 0xe0, 0x0114231f); 52 pci_write_config_dword(dev, 0xe0, 0x0114231f);
diff --git a/arch/powerpc/platforms/44x/virtex_ml510.c b/arch/powerpc/platforms/44x/virtex_ml510.c
index ba4a6e388a46..1fdb8748638d 100644
--- a/arch/powerpc/platforms/44x/virtex_ml510.c
+++ b/arch/powerpc/platforms/44x/virtex_ml510.c
@@ -5,7 +5,7 @@
5/** 5/**
6 * ml510_ail_quirk 6 * ml510_ail_quirk
7 */ 7 */
8static void __devinit ml510_ali_quirk(struct pci_dev *dev) 8static void ml510_ali_quirk(struct pci_dev *dev)
9{ 9{
10 /* Enable the IDE controller */ 10 /* Enable the IDE controller */
11 pci_write_config_byte(dev, 0x58, 0x4c); 11 pci_write_config_byte(dev, 0x58, 0x4c);
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
index a51cb07bd663..692998244d2c 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
@@ -669,7 +669,7 @@ static struct miscdevice mpc52xx_wdt_miscdev = {
669 .fops = &mpc52xx_wdt_fops, 669 .fops = &mpc52xx_wdt_fops,
670}; 670};
671 671
672static int __devinit mpc52xx_gpt_wdt_init(void) 672static int mpc52xx_gpt_wdt_init(void)
673{ 673{
674 int err; 674 int err;
675 675
@@ -704,7 +704,7 @@ static int mpc52xx_gpt_wdt_setup(struct mpc52xx_gpt_priv *gpt,
704 704
705#else 705#else
706 706
707static int __devinit mpc52xx_gpt_wdt_init(void) 707static int mpc52xx_gpt_wdt_init(void)
708{ 708{
709 return 0; 709 return 0;
710} 710}
@@ -720,7 +720,7 @@ static inline int mpc52xx_gpt_wdt_setup(struct mpc52xx_gpt_priv *gpt,
720/* --------------------------------------------------------------------- 720/* ---------------------------------------------------------------------
721 * of_platform bus binding code 721 * of_platform bus binding code
722 */ 722 */
723static int __devinit mpc52xx_gpt_probe(struct platform_device *ofdev) 723static int mpc52xx_gpt_probe(struct platform_device *ofdev)
724{ 724{
725 struct mpc52xx_gpt_priv *gpt; 725 struct mpc52xx_gpt_priv *gpt;
726 726
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
index 16150fa430f9..f9f4537f546d 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
@@ -470,7 +470,7 @@ void mpc52xx_lpbfifo_abort(struct mpc52xx_lpbfifo_request *req)
470} 470}
471EXPORT_SYMBOL(mpc52xx_lpbfifo_abort); 471EXPORT_SYMBOL(mpc52xx_lpbfifo_abort);
472 472
473static int __devinit mpc52xx_lpbfifo_probe(struct platform_device *op) 473static int mpc52xx_lpbfifo_probe(struct platform_device *op)
474{ 474{
475 struct resource res; 475 struct resource res;
476 int rc = -ENOMEM; 476 int rc = -ENOMEM;
@@ -540,7 +540,7 @@ static int __devinit mpc52xx_lpbfifo_probe(struct platform_device *op)
540} 540}
541 541
542 542
543static int __devexit mpc52xx_lpbfifo_remove(struct platform_device *op) 543static int mpc52xx_lpbfifo_remove(struct platform_device *op)
544{ 544{
545 if (lpbfifo.dev != &op->dev) 545 if (lpbfifo.dev != &op->dev)
546 return 0; 546 return 0;
@@ -564,7 +564,7 @@ static int __devexit mpc52xx_lpbfifo_remove(struct platform_device *op)
564 return 0; 564 return 0;
565} 565}
566 566
567static struct of_device_id mpc52xx_lpbfifo_match[] __devinitconst = { 567static struct of_device_id mpc52xx_lpbfifo_match[] = {
568 { .compatible = "fsl,mpc5200-lpbfifo", }, 568 { .compatible = "fsl,mpc5200-lpbfifo", },
569 {}, 569 {},
570}; 570};
@@ -576,6 +576,6 @@ static struct platform_driver mpc52xx_lpbfifo_driver = {
576 .of_match_table = mpc52xx_lpbfifo_match, 576 .of_match_table = mpc52xx_lpbfifo_match,
577 }, 577 },
578 .probe = mpc52xx_lpbfifo_probe, 578 .probe = mpc52xx_lpbfifo_probe,
579 .remove = __devexit_p(mpc52xx_lpbfifo_remove), 579 .remove = mpc52xx_lpbfifo_remove,
580}; 580};
581module_platform_driver(mpc52xx_lpbfifo_driver); 581module_platform_driver(mpc52xx_lpbfifo_driver);
diff --git a/arch/powerpc/platforms/82xx/ep8248e.c b/arch/powerpc/platforms/82xx/ep8248e.c
index 10ff526cd046..79799b29ffe2 100644
--- a/arch/powerpc/platforms/82xx/ep8248e.c
+++ b/arch/powerpc/platforms/82xx/ep8248e.c
@@ -111,7 +111,7 @@ static struct mdiobb_ctrl ep8248e_mdio_ctrl = {
111 .ops = &ep8248e_mdio_ops, 111 .ops = &ep8248e_mdio_ops,
112}; 112};
113 113
114static int __devinit ep8248e_mdio_probe(struct platform_device *ofdev) 114static int ep8248e_mdio_probe(struct platform_device *ofdev)
115{ 115{
116 struct mii_bus *bus; 116 struct mii_bus *bus;
117 struct resource res; 117 struct resource res;
diff --git a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
index ef6537b8ed33..624cb51d19c9 100644
--- a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
+++ b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
@@ -145,8 +145,7 @@ static int mcu_gpiochip_remove(struct mcu *mcu)
145 return gpiochip_remove(&mcu->gc); 145 return gpiochip_remove(&mcu->gc);
146} 146}
147 147
148static int __devinit mcu_probe(struct i2c_client *client, 148static int mcu_probe(struct i2c_client *client, const struct i2c_device_id *id)
149 const struct i2c_device_id *id)
150{ 149{
151 struct mcu *mcu; 150 struct mcu *mcu;
152 int ret; 151 int ret;
@@ -188,7 +187,7 @@ err:
188 return ret; 187 return ret;
189} 188}
190 189
191static int __devexit mcu_remove(struct i2c_client *client) 190static int mcu_remove(struct i2c_client *client)
192{ 191{
193 struct mcu *mcu = i2c_get_clientdata(client); 192 struct mcu *mcu = i2c_get_clientdata(client);
194 int ret; 193 int ret;
@@ -216,7 +215,7 @@ static const struct i2c_device_id mcu_ids[] = {
216}; 215};
217MODULE_DEVICE_TABLE(i2c, mcu_ids); 216MODULE_DEVICE_TABLE(i2c, mcu_ids);
218 217
219static struct of_device_id mcu_of_match_table[] __devinitdata = { 218static struct of_device_id mcu_of_match_table[] = {
220 { .compatible = "fsl,mcu-mpc8349emitx", }, 219 { .compatible = "fsl,mcu-mpc8349emitx", },
221 { }, 220 { },
222}; 221};
@@ -228,7 +227,7 @@ static struct i2c_driver mcu_driver = {
228 .of_match_table = mcu_of_match_table, 227 .of_match_table = mcu_of_match_table,
229 }, 228 },
230 .probe = mcu_probe, 229 .probe = mcu_probe,
231 .remove = __devexit_p(mcu_remove), 230 .remove = mcu_remove,
232 .id_table = mcu_ids, 231 .id_table = mcu_ids,
233}; 232};
234 233
diff --git a/arch/powerpc/platforms/85xx/corenet_ds.c b/arch/powerpc/platforms/85xx/corenet_ds.c
index ed69c9250717..6f355d8c92f6 100644
--- a/arch/powerpc/platforms/85xx/corenet_ds.c
+++ b/arch/powerpc/platforms/85xx/corenet_ds.c
@@ -64,7 +64,7 @@ void __init corenet_ds_setup_arch(void)
64 pr_info("%s board from Freescale Semiconductor\n", ppc_md.name); 64 pr_info("%s board from Freescale Semiconductor\n", ppc_md.name);
65} 65}
66 66
67static const struct of_device_id of_device_ids[] __devinitconst = { 67static const struct of_device_id of_device_ids[] = {
68 { 68 {
69 .compatible = "simple-bus" 69 .compatible = "simple-bus"
70 }, 70 },
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.c b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
index c474505ad0d0..7a31a0e1df29 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_cds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c
@@ -154,7 +154,7 @@ static void __init mpc85xx_cds_pci_irq_fixup(struct pci_dev *dev)
154 } 154 }
155} 155}
156 156
157static void __devinit skip_fake_bridge(struct pci_dev *dev) 157static void skip_fake_bridge(struct pci_dev *dev)
158{ 158{
159 /* Make it an error to skip the fake bridge 159 /* Make it an error to skip the fake bridge
160 * in pci_setup_device() in probe.c */ 160 * in pci_setup_device() in probe.c */
diff --git a/arch/powerpc/platforms/85xx/tqm85xx.c b/arch/powerpc/platforms/85xx/tqm85xx.c
index b4e58cdc09a5..ec0b7272fae2 100644
--- a/arch/powerpc/platforms/85xx/tqm85xx.c
+++ b/arch/powerpc/platforms/85xx/tqm85xx.c
@@ -85,7 +85,7 @@ static void tqm85xx_show_cpuinfo(struct seq_file *m)
85 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); 85 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
86} 86}
87 87
88static void __devinit tqm85xx_ti1520_fixup(struct pci_dev *pdev) 88static void tqm85xx_ti1520_fixup(struct pci_dev *pdev)
89{ 89{
90 unsigned int val; 90 unsigned int val;
91 91
diff --git a/arch/powerpc/platforms/86xx/gef_ppc9a.c b/arch/powerpc/platforms/86xx/gef_ppc9a.c
index bf5338754c5a..c23f3443880a 100644
--- a/arch/powerpc/platforms/86xx/gef_ppc9a.c
+++ b/arch/powerpc/platforms/86xx/gef_ppc9a.c
@@ -159,7 +159,7 @@ static void gef_ppc9a_show_cpuinfo(struct seq_file *m)
159 gef_ppc9a_get_vme_is_syscon() ? "yes" : "no"); 159 gef_ppc9a_get_vme_is_syscon() ? "yes" : "no");
160} 160}
161 161
162static void __devinit gef_ppc9a_nec_fixup(struct pci_dev *pdev) 162static void gef_ppc9a_nec_fixup(struct pci_dev *pdev)
163{ 163{
164 unsigned int val; 164 unsigned int val;
165 165
diff --git a/arch/powerpc/platforms/86xx/gef_sbc310.c b/arch/powerpc/platforms/86xx/gef_sbc310.c
index 0b7851330a07..8a6ac20686ea 100644
--- a/arch/powerpc/platforms/86xx/gef_sbc310.c
+++ b/arch/powerpc/platforms/86xx/gef_sbc310.c
@@ -146,7 +146,7 @@ static void gef_sbc310_show_cpuinfo(struct seq_file *m)
146 146
147} 147}
148 148
149static void __devinit gef_sbc310_nec_fixup(struct pci_dev *pdev) 149static void gef_sbc310_nec_fixup(struct pci_dev *pdev)
150{ 150{
151 unsigned int val; 151 unsigned int val;
152 152
diff --git a/arch/powerpc/platforms/86xx/gef_sbc610.c b/arch/powerpc/platforms/86xx/gef_sbc610.c
index b9eb174897b1..06c72636f299 100644
--- a/arch/powerpc/platforms/86xx/gef_sbc610.c
+++ b/arch/powerpc/platforms/86xx/gef_sbc610.c
@@ -136,7 +136,7 @@ static void gef_sbc610_show_cpuinfo(struct seq_file *m)
136 seq_printf(m, "SVR\t\t: 0x%x\n", svid); 136 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
137} 137}
138 138
139static void __devinit gef_sbc610_nec_fixup(struct pci_dev *pdev) 139static void gef_sbc610_nec_fixup(struct pci_dev *pdev)
140{ 140{
141 unsigned int val; 141 unsigned int val;
142 142
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c
index 4ab087671185..6ae25fb62015 100644
--- a/arch/powerpc/platforms/cell/setup.c
+++ b/arch/powerpc/platforms/cell/setup.c
@@ -117,7 +117,7 @@ static void cell_fixup_pcie_rootcomplex(struct pci_dev *dev)
117} 117}
118DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, cell_fixup_pcie_rootcomplex); 118DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, cell_fixup_pcie_rootcomplex);
119 119
120static int __devinit cell_setup_phb(struct pci_controller *phb) 120static int cell_setup_phb(struct pci_controller *phb)
121{ 121{
122 const char *model; 122 const char *model;
123 struct device_node *np; 123 struct device_node *np;
diff --git a/arch/powerpc/platforms/cell/smp.c b/arch/powerpc/platforms/cell/smp.c
index 49a65e2dfc71..d35dbbc8ec79 100644
--- a/arch/powerpc/platforms/cell/smp.c
+++ b/arch/powerpc/platforms/cell/smp.c
@@ -67,7 +67,7 @@ static cpumask_t of_spin_map;
67 * 0 - failure 67 * 0 - failure
68 * 1 - success 68 * 1 - success
69 */ 69 */
70static inline int __devinit smp_startup_cpu(unsigned int lcpu) 70static inline int smp_startup_cpu(unsigned int lcpu)
71{ 71{
72 int status; 72 int status;
73 unsigned long start_here = __pa((u32)*((unsigned long *) 73 unsigned long start_here = __pa((u32)*((unsigned long *)
@@ -108,7 +108,7 @@ static int __init smp_iic_probe(void)
108 return cpumask_weight(cpu_possible_mask); 108 return cpumask_weight(cpu_possible_mask);
109} 109}
110 110
111static void __devinit smp_cell_setup_cpu(int cpu) 111static void smp_cell_setup_cpu(int cpu)
112{ 112{
113 if (cpu != boot_cpuid) 113 if (cpu != boot_cpuid)
114 iic_setup_cpu(); 114 iic_setup_cpu();
@@ -119,7 +119,7 @@ static void __devinit smp_cell_setup_cpu(int cpu)
119 mtspr(SPRN_DABRX, DABRX_KERNEL | DABRX_USER); 119 mtspr(SPRN_DABRX, DABRX_KERNEL | DABRX_USER);
120} 120}
121 121
122static int __devinit smp_cell_kick_cpu(int nr) 122static int smp_cell_kick_cpu(int nr)
123{ 123{
124 BUG_ON(nr < 0 || nr >= NR_CPUS); 124 BUG_ON(nr < 0 || nr >= NR_CPUS);
125 125
diff --git a/arch/powerpc/platforms/chrp/pci.c b/arch/powerpc/platforms/chrp/pci.c
index 83285c5a2049..1b87e198faa7 100644
--- a/arch/powerpc/platforms/chrp/pci.c
+++ b/arch/powerpc/platforms/chrp/pci.c
@@ -323,7 +323,7 @@ chrp_find_bridges(void)
323 * ATA controller to be set to fully native mode or bad things 323 * ATA controller to be set to fully native mode or bad things
324 * will happen. 324 * will happen.
325 */ 325 */
326static void __devinit chrp_pci_fixup_winbond_ata(struct pci_dev *sl82c105) 326static void chrp_pci_fixup_winbond_ata(struct pci_dev *sl82c105)
327{ 327{
328 u8 progif; 328 u8 progif;
329 329
diff --git a/arch/powerpc/platforms/chrp/smp.c b/arch/powerpc/platforms/chrp/smp.c
index feab30bbae23..dead91b177b9 100644
--- a/arch/powerpc/platforms/chrp/smp.c
+++ b/arch/powerpc/platforms/chrp/smp.c
@@ -30,7 +30,7 @@
30#include <asm/mpic.h> 30#include <asm/mpic.h>
31#include <asm/rtas.h> 31#include <asm/rtas.h>
32 32
33static int __devinit smp_chrp_kick_cpu(int nr) 33static int smp_chrp_kick_cpu(int nr)
34{ 34{
35 *(unsigned long *)KERNELBASE = nr; 35 *(unsigned long *)KERNELBASE = nr;
36 asm volatile("dcbf 0,%0"::"r"(KERNELBASE):"memory"); 36 asm volatile("dcbf 0,%0"::"r"(KERNELBASE):"memory");
@@ -38,7 +38,7 @@ static int __devinit smp_chrp_kick_cpu(int nr)
38 return 0; 38 return 0;
39} 39}
40 40
41static void __devinit smp_chrp_setup_cpu(int cpu_nr) 41static void smp_chrp_setup_cpu(int cpu_nr)
42{ 42{
43 mpic_setup_this_cpu(); 43 mpic_setup_this_cpu();
44} 44}
diff --git a/arch/powerpc/platforms/fsl_uli1575.c b/arch/powerpc/platforms/fsl_uli1575.c
index 64fde058e545..92ac9b52b32d 100644
--- a/arch/powerpc/platforms/fsl_uli1575.c
+++ b/arch/powerpc/platforms/fsl_uli1575.c
@@ -59,7 +59,7 @@ static inline bool is_quirk_valid(void)
59} 59}
60 60
61/* Bridge */ 61/* Bridge */
62static void __devinit early_uli5249(struct pci_dev *dev) 62static void early_uli5249(struct pci_dev *dev)
63{ 63{
64 unsigned char temp; 64 unsigned char temp;
65 65
@@ -82,7 +82,7 @@ static void __devinit early_uli5249(struct pci_dev *dev)
82} 82}
83 83
84 84
85static void __devinit quirk_uli1575(struct pci_dev *dev) 85static void quirk_uli1575(struct pci_dev *dev)
86{ 86{
87 int i; 87 int i;
88 88
@@ -139,7 +139,7 @@ static void __devinit quirk_uli1575(struct pci_dev *dev)
139 pci_write_config_byte(dev, 0x75, ULI_8259_IRQ15); 139 pci_write_config_byte(dev, 0x75, ULI_8259_IRQ15);
140} 140}
141 141
142static void __devinit quirk_final_uli1575(struct pci_dev *dev) 142static void quirk_final_uli1575(struct pci_dev *dev)
143{ 143{
144 /* Set i8259 interrupt trigger 144 /* Set i8259 interrupt trigger
145 * IRQ 3: Level 145 * IRQ 3: Level
@@ -175,7 +175,7 @@ static void __devinit quirk_final_uli1575(struct pci_dev *dev)
175} 175}
176 176
177/* SATA */ 177/* SATA */
178static void __devinit quirk_uli5288(struct pci_dev *dev) 178static void quirk_uli5288(struct pci_dev *dev)
179{ 179{
180 unsigned char c; 180 unsigned char c;
181 unsigned int d; 181 unsigned int d;
@@ -200,7 +200,7 @@ static void __devinit quirk_uli5288(struct pci_dev *dev)
200} 200}
201 201
202/* PATA */ 202/* PATA */
203static void __devinit quirk_uli5229(struct pci_dev *dev) 203static void quirk_uli5229(struct pci_dev *dev)
204{ 204{
205 unsigned short temp; 205 unsigned short temp;
206 206
@@ -216,7 +216,7 @@ static void __devinit quirk_uli5229(struct pci_dev *dev)
216} 216}
217 217
218/* We have to do a dummy read on the P2P for the RTC to work, WTF */ 218/* We have to do a dummy read on the P2P for the RTC to work, WTF */
219static void __devinit quirk_final_uli5249(struct pci_dev *dev) 219static void quirk_final_uli5249(struct pci_dev *dev)
220{ 220{
221 int i; 221 int i;
222 u8 *dummy; 222 u8 *dummy;
@@ -253,7 +253,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, 0x5249, quirk_final_uli5249);
253DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, 0x1575, quirk_final_uli1575); 253DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, 0x1575, quirk_final_uli1575);
254DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229); 254DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229);
255 255
256static void __devinit hpcd_quirk_uli1575(struct pci_dev *dev) 256static void hpcd_quirk_uli1575(struct pci_dev *dev)
257{ 257{
258 u32 temp32; 258 u32 temp32;
259 259
@@ -269,7 +269,7 @@ static void __devinit hpcd_quirk_uli1575(struct pci_dev *dev)
269 pci_write_config_dword(dev, 0x90, (temp32 | 1<<22)); 269 pci_write_config_dword(dev, 0x90, (temp32 | 1<<22));
270} 270}
271 271
272static void __devinit hpcd_quirk_uli5288(struct pci_dev *dev) 272static void hpcd_quirk_uli5288(struct pci_dev *dev)
273{ 273{
274 unsigned char c; 274 unsigned char c;
275 275
@@ -295,7 +295,7 @@ static void __devinit hpcd_quirk_uli5288(struct pci_dev *dev)
295 * IRQ14 is a sideband interrupt from IDE device to CPU and we use this 295 * IRQ14 is a sideband interrupt from IDE device to CPU and we use this
296 * as the interrupt for IDE device. 296 * as the interrupt for IDE device.
297 */ 297 */
298static void __devinit hpcd_quirk_uli5229(struct pci_dev *dev) 298static void hpcd_quirk_uli5229(struct pci_dev *dev)
299{ 299{
300 unsigned char c; 300 unsigned char c;
301 301
@@ -317,7 +317,7 @@ static void __devinit hpcd_quirk_uli5229(struct pci_dev *dev)
317 * bug by re-assigning a correct irq to 5288. 317 * bug by re-assigning a correct irq to 5288.
318 * 318 *
319 */ 319 */
320static void __devinit hpcd_final_uli5288(struct pci_dev *dev) 320static void hpcd_final_uli5288(struct pci_dev *dev)
321{ 321{
322 struct pci_controller *hose = pci_bus_to_host(dev->bus); 322 struct pci_controller *hose = pci_bus_to_host(dev->bus);
323 struct device_node *hosenode = hose ? hose->dn : NULL; 323 struct device_node *hosenode = hose ? hose->dn : NULL;
diff --git a/arch/powerpc/platforms/maple/pci.c b/arch/powerpc/platforms/maple/pci.c
index 465ee8f5c086..f7136aae8bbf 100644
--- a/arch/powerpc/platforms/maple/pci.c
+++ b/arch/powerpc/platforms/maple/pci.c
@@ -543,7 +543,7 @@ static int __init maple_add_bridge(struct device_node *dev)
543} 543}
544 544
545 545
546void __devinit maple_pci_irq_fixup(struct pci_dev *dev) 546void maple_pci_irq_fixup(struct pci_dev *dev)
547{ 547{
548 DBG(" -> maple_pci_irq_fixup\n"); 548 DBG(" -> maple_pci_irq_fixup\n");
549 549
@@ -648,7 +648,7 @@ int maple_pci_get_legacy_ide_irq(struct pci_dev *pdev, int channel)
648 return irq; 648 return irq;
649} 649}
650 650
651static void __devinit quirk_ipr_msi(struct pci_dev *dev) 651static void quirk_ipr_msi(struct pci_dev *dev)
652{ 652{
653 /* Something prevents MSIs from the IPR from working on Bimini, 653 /* Something prevents MSIs from the IPR from working on Bimini,
654 * and the driver has no smarts to recover. So disable MSI 654 * and the driver has no smarts to recover. So disable MSI
diff --git a/arch/powerpc/platforms/pasemi/cpufreq.c b/arch/powerpc/platforms/pasemi/cpufreq.c
index 95d00173029f..890f30e70f98 100644
--- a/arch/powerpc/platforms/pasemi/cpufreq.c
+++ b/arch/powerpc/platforms/pasemi/cpufreq.c
@@ -236,6 +236,13 @@ out:
236 236
237static int pas_cpufreq_cpu_exit(struct cpufreq_policy *policy) 237static int pas_cpufreq_cpu_exit(struct cpufreq_policy *policy)
238{ 238{
239 /*
240 * We don't support CPU hotplug. Don't unmap after the system
241 * has already made it to a running state.
242 */
243 if (system_state != SYSTEM_BOOTING)
244 return 0;
245
239 if (sdcasr_mapbase) 246 if (sdcasr_mapbase)
240 iounmap(sdcasr_mapbase); 247 iounmap(sdcasr_mapbase);
241 if (sdcpwr_mapbase) 248 if (sdcpwr_mapbase)
diff --git a/arch/powerpc/platforms/pasemi/gpio_mdio.c b/arch/powerpc/platforms/pasemi/gpio_mdio.c
index 9886296e08da..0237ab782fb8 100644
--- a/arch/powerpc/platforms/pasemi/gpio_mdio.c
+++ b/arch/powerpc/platforms/pasemi/gpio_mdio.c
@@ -216,7 +216,7 @@ static int gpio_mdio_reset(struct mii_bus *bus)
216} 216}
217 217
218 218
219static int __devinit gpio_mdio_probe(struct platform_device *ofdev) 219static int gpio_mdio_probe(struct platform_device *ofdev)
220{ 220{
221 struct device *dev = &ofdev->dev; 221 struct device *dev = &ofdev->dev;
222 struct device_node *np = ofdev->dev.of_node; 222 struct device_node *np = ofdev->dev.of_node;
diff --git a/arch/powerpc/platforms/pasemi/pasemi.h b/arch/powerpc/platforms/pasemi/pasemi.h
index b1e524f7489d..ea65bf0eb897 100644
--- a/arch/powerpc/platforms/pasemi/pasemi.h
+++ b/arch/powerpc/platforms/pasemi/pasemi.h
@@ -3,8 +3,8 @@
3 3
4extern unsigned long pas_get_boot_time(void); 4extern unsigned long pas_get_boot_time(void);
5extern void pas_pci_init(void); 5extern void pas_pci_init(void);
6extern void __devinit pas_pci_irq_fixup(struct pci_dev *dev); 6extern void pas_pci_irq_fixup(struct pci_dev *dev);
7extern void __devinit pas_pci_dma_dev_setup(struct pci_dev *dev); 7extern void pas_pci_dma_dev_setup(struct pci_dev *dev);
8 8
9extern void __iomem *pasemi_pci_getcfgaddr(struct pci_dev *dev, int offset); 9extern void __iomem *pasemi_pci_getcfgaddr(struct pci_dev *dev, int offset);
10 10
diff --git a/arch/powerpc/platforms/pasemi/setup.c b/arch/powerpc/platforms/pasemi/setup.c
index 2ed9212d7d59..8c54de6d8ec4 100644
--- a/arch/powerpc/platforms/pasemi/setup.c
+++ b/arch/powerpc/platforms/pasemi/setup.c
@@ -76,7 +76,7 @@ static void pas_restart(char *cmd)
76static arch_spinlock_t timebase_lock; 76static arch_spinlock_t timebase_lock;
77static unsigned long timebase; 77static unsigned long timebase;
78 78
79static void __devinit pas_give_timebase(void) 79static void pas_give_timebase(void)
80{ 80{
81 unsigned long flags; 81 unsigned long flags;
82 82
@@ -94,7 +94,7 @@ static void __devinit pas_give_timebase(void)
94 local_irq_restore(flags); 94 local_irq_restore(flags);
95} 95}
96 96
97static void __devinit pas_take_timebase(void) 97static void pas_take_timebase(void)
98{ 98{
99 while (!timebase) 99 while (!timebase)
100 smp_rmb(); 100 smp_rmb();
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index 43bbe1bda939..2b8af75abc23 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -561,7 +561,7 @@ static struct pci_ops u4_pcie_pci_ops =
561 .write = u4_pcie_write_config, 561 .write = u4_pcie_write_config,
562}; 562};
563 563
564static void __devinit pmac_pci_fixup_u4_of_node(struct pci_dev *dev) 564static void pmac_pci_fixup_u4_of_node(struct pci_dev *dev)
565{ 565{
566 /* Apple's device-tree "hides" the root complex virtual P2P bridge 566 /* Apple's device-tree "hides" the root complex virtual P2P bridge
567 * on U4. However, Linux sees it, causing the PCI <-> OF matching 567 * on U4. However, Linux sees it, causing the PCI <-> OF matching
@@ -988,7 +988,7 @@ static int __init pmac_add_bridge(struct device_node *dev)
988 return 0; 988 return 0;
989} 989}
990 990
991void __devinit pmac_pci_irq_fixup(struct pci_dev *dev) 991void pmac_pci_irq_fixup(struct pci_dev *dev)
992{ 992{
993#ifdef CONFIG_PPC32 993#ifdef CONFIG_PPC32
994 /* Fixup interrupt for the modem/ethernet combo controller. 994 /* Fixup interrupt for the modem/ethernet combo controller.
@@ -1138,7 +1138,7 @@ int pmac_pci_enable_device_hook(struct pci_dev *dev)
1138 return 0; 1138 return 0;
1139} 1139}
1140 1140
1141void __devinit pmac_pci_fixup_ohci(struct pci_dev *dev) 1141void pmac_pci_fixup_ohci(struct pci_dev *dev)
1142{ 1142{
1143 struct device_node *node = pci_device_to_OF_node(dev); 1143 struct device_node *node = pci_device_to_OF_node(dev);
1144 1144
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
index b4ddaa3fbb29..bdb738a69e41 100644
--- a/arch/powerpc/platforms/powermac/smp.c
+++ b/arch/powerpc/platforms/powermac/smp.c
@@ -484,7 +484,7 @@ static void smp_core99_give_timebase(void)
484} 484}
485 485
486 486
487static void __devinit smp_core99_take_timebase(void) 487static void smp_core99_take_timebase(void)
488{ 488{
489 unsigned long flags; 489 unsigned long flags;
490 490
@@ -669,7 +669,7 @@ static void smp_core99_gpio_tb_freeze(int freeze)
669volatile static long int core99_l2_cache; 669volatile static long int core99_l2_cache;
670volatile static long int core99_l3_cache; 670volatile static long int core99_l3_cache;
671 671
672static void __devinit core99_init_caches(int cpu) 672static void core99_init_caches(int cpu)
673{ 673{
674#ifndef CONFIG_PPC64 674#ifndef CONFIG_PPC64
675 if (!cpu_has_feature(CPU_FTR_L2CR)) 675 if (!cpu_has_feature(CPU_FTR_L2CR))
@@ -801,7 +801,7 @@ static int __init smp_core99_probe(void)
801 return ncpus; 801 return ncpus;
802} 802}
803 803
804static int __devinit smp_core99_kick_cpu(int nr) 804static int smp_core99_kick_cpu(int nr)
805{ 805{
806 unsigned int save_vector; 806 unsigned int save_vector;
807 unsigned long target, flags; 807 unsigned long target, flags;
@@ -844,7 +844,7 @@ static int __devinit smp_core99_kick_cpu(int nr)
844 return 0; 844 return 0;
845} 845}
846 846
847static void __devinit smp_core99_setup_cpu(int cpu_nr) 847static void smp_core99_setup_cpu(int cpu_nr)
848{ 848{
849 /* Setup L2/L3 */ 849 /* Setup L2/L3 */
850 if (cpu_nr != 0) 850 if (cpu_nr != 0)
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 53d052e95cfc..8e90e8906df3 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -76,7 +76,7 @@ static struct pci_dn *pnv_ioda_get_pdn(struct pci_dev *dev)
76 return PCI_DN(np); 76 return PCI_DN(np);
77} 77}
78 78
79static int __devinit pnv_ioda_alloc_pe(struct pnv_phb *phb) 79static int pnv_ioda_alloc_pe(struct pnv_phb *phb)
80{ 80{
81 unsigned long pe; 81 unsigned long pe;
82 82
@@ -91,7 +91,7 @@ static int __devinit pnv_ioda_alloc_pe(struct pnv_phb *phb)
91 return pe; 91 return pe;
92} 92}
93 93
94static void __devinit pnv_ioda_free_pe(struct pnv_phb *phb, int pe) 94static void pnv_ioda_free_pe(struct pnv_phb *phb, int pe)
95{ 95{
96 WARN_ON(phb->ioda.pe_array[pe].pdev); 96 WARN_ON(phb->ioda.pe_array[pe].pdev);
97 97
@@ -103,7 +103,7 @@ static void __devinit pnv_ioda_free_pe(struct pnv_phb *phb, int pe)
103 * but in the meantime, we need to protect them to avoid warnings 103 * but in the meantime, we need to protect them to avoid warnings
104 */ 104 */
105#ifdef CONFIG_PCI_MSI 105#ifdef CONFIG_PCI_MSI
106static struct pnv_ioda_pe * __devinit pnv_ioda_get_pe(struct pci_dev *dev) 106static struct pnv_ioda_pe *pnv_ioda_get_pe(struct pci_dev *dev)
107{ 107{
108 struct pci_controller *hose = pci_bus_to_host(dev->bus); 108 struct pci_controller *hose = pci_bus_to_host(dev->bus);
109 struct pnv_phb *phb = hose->private_data; 109 struct pnv_phb *phb = hose->private_data;
@@ -117,8 +117,7 @@ static struct pnv_ioda_pe * __devinit pnv_ioda_get_pe(struct pci_dev *dev)
117} 117}
118#endif /* CONFIG_PCI_MSI */ 118#endif /* CONFIG_PCI_MSI */
119 119
120static int __devinit pnv_ioda_configure_pe(struct pnv_phb *phb, 120static int pnv_ioda_configure_pe(struct pnv_phb *phb, struct pnv_ioda_pe *pe)
121 struct pnv_ioda_pe *pe)
122{ 121{
123 struct pci_dev *parent; 122 struct pci_dev *parent;
124 uint8_t bcomp, dcomp, fcomp; 123 uint8_t bcomp, dcomp, fcomp;
@@ -207,8 +206,8 @@ static int __devinit pnv_ioda_configure_pe(struct pnv_phb *phb,
207 return 0; 206 return 0;
208} 207}
209 208
210static void __devinit pnv_ioda_link_pe_by_weight(struct pnv_phb *phb, 209static void pnv_ioda_link_pe_by_weight(struct pnv_phb *phb,
211 struct pnv_ioda_pe *pe) 210 struct pnv_ioda_pe *pe)
212{ 211{
213 struct pnv_ioda_pe *lpe; 212 struct pnv_ioda_pe *lpe;
214 213
@@ -246,7 +245,7 @@ static unsigned int pnv_ioda_dma_weight(struct pci_dev *dev)
246} 245}
247 246
248#if 0 247#if 0
249static struct pnv_ioda_pe * __devinit pnv_ioda_setup_dev_PE(struct pci_dev *dev) 248static struct pnv_ioda_pe *pnv_ioda_setup_dev_PE(struct pci_dev *dev)
250{ 249{
251 struct pci_controller *hose = pci_bus_to_host(dev->bus); 250 struct pci_controller *hose = pci_bus_to_host(dev->bus);
252 struct pnv_phb *phb = hose->private_data; 251 struct pnv_phb *phb = hose->private_data;
@@ -343,7 +342,7 @@ static void pnv_ioda_setup_same_PE(struct pci_bus *bus, struct pnv_ioda_pe *pe)
343 * subordinate PCI devices and buses. The second type of PE is normally 342 * subordinate PCI devices and buses. The second type of PE is normally
344 * orgiriated by PCIe-to-PCI bridge or PLX switch downstream ports. 343 * orgiriated by PCIe-to-PCI bridge or PLX switch downstream ports.
345 */ 344 */
346static void __devinit pnv_ioda_setup_bus_PE(struct pci_bus *bus, int all) 345static void pnv_ioda_setup_bus_PE(struct pci_bus *bus, int all)
347{ 346{
348 struct pci_controller *hose = pci_bus_to_host(bus); 347 struct pci_controller *hose = pci_bus_to_host(bus);
349 struct pnv_phb *phb = hose->private_data; 348 struct pnv_phb *phb = hose->private_data;
@@ -399,7 +398,7 @@ static void __devinit pnv_ioda_setup_bus_PE(struct pci_bus *bus, int all)
399 pnv_ioda_link_pe_by_weight(phb, pe); 398 pnv_ioda_link_pe_by_weight(phb, pe);
400} 399}
401 400
402static void __devinit pnv_ioda_setup_PEs(struct pci_bus *bus) 401static void pnv_ioda_setup_PEs(struct pci_bus *bus)
403{ 402{
404 struct pci_dev *dev; 403 struct pci_dev *dev;
405 404
@@ -423,7 +422,7 @@ static void __devinit pnv_ioda_setup_PEs(struct pci_bus *bus)
423 * port to PE# here. The game rule here is expected to be changed 422 * port to PE# here. The game rule here is expected to be changed
424 * as soon as we can detected PLX bridge correctly. 423 * as soon as we can detected PLX bridge correctly.
425 */ 424 */
426static void __devinit pnv_pci_ioda_setup_PEs(void) 425static void pnv_pci_ioda_setup_PEs(void)
427{ 426{
428 struct pci_controller *hose, *tmp; 427 struct pci_controller *hose, *tmp;
429 428
@@ -432,14 +431,12 @@ static void __devinit pnv_pci_ioda_setup_PEs(void)
432 } 431 }
433} 432}
434 433
435static void __devinit pnv_pci_ioda_dma_dev_setup(struct pnv_phb *phb, 434static void pnv_pci_ioda_dma_dev_setup(struct pnv_phb *phb, struct pci_dev *dev)
436 struct pci_dev *dev)
437{ 435{
438 /* We delay DMA setup after we have assigned all PE# */ 436 /* We delay DMA setup after we have assigned all PE# */
439} 437}
440 438
441static void __devinit pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe, 439static void pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe, struct pci_bus *bus)
442 struct pci_bus *bus)
443{ 440{
444 struct pci_dev *dev; 441 struct pci_dev *dev;
445 442
@@ -450,10 +447,9 @@ static void __devinit pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe,
450 } 447 }
451} 448}
452 449
453static void __devinit pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb, 450static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb,
454 struct pnv_ioda_pe *pe, 451 struct pnv_ioda_pe *pe, unsigned int base,
455 unsigned int base, 452 unsigned int segs)
456 unsigned int segs)
457{ 453{
458 454
459 struct page *tce_mem = NULL; 455 struct page *tce_mem = NULL;
@@ -541,7 +537,7 @@ static void __devinit pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb,
541 __free_pages(tce_mem, get_order(TCE32_TABLE_SIZE * segs)); 537 __free_pages(tce_mem, get_order(TCE32_TABLE_SIZE * segs));
542} 538}
543 539
544static void __devinit pnv_ioda_setup_dma(struct pnv_phb *phb) 540static void pnv_ioda_setup_dma(struct pnv_phb *phb)
545{ 541{
546 struct pci_controller *hose = phb->hose; 542 struct pci_controller *hose = phb->hose;
547 unsigned int residual, remaining, segs, tw, base; 543 unsigned int residual, remaining, segs, tw, base;
@@ -684,8 +680,8 @@ static void pnv_pci_init_ioda_msis(struct pnv_phb *phb) { }
684 * to bottom style. So the the I/O or MMIO segment assigned to 680 * to bottom style. So the the I/O or MMIO segment assigned to
685 * parent PE could be overrided by its child PEs if necessary. 681 * parent PE could be overrided by its child PEs if necessary.
686 */ 682 */
687static void __devinit pnv_ioda_setup_pe_seg(struct pci_controller *hose, 683static void pnv_ioda_setup_pe_seg(struct pci_controller *hose,
688 struct pnv_ioda_pe *pe) 684 struct pnv_ioda_pe *pe)
689{ 685{
690 struct pnv_phb *phb = hose->private_data; 686 struct pnv_phb *phb = hose->private_data;
691 struct pci_bus_region region; 687 struct pci_bus_region region;
@@ -753,7 +749,7 @@ static void __devinit pnv_ioda_setup_pe_seg(struct pci_controller *hose,
753 } 749 }
754} 750}
755 751
756static void __devinit pnv_pci_ioda_setup_seg(void) 752static void pnv_pci_ioda_setup_seg(void)
757{ 753{
758 struct pci_controller *tmp, *hose; 754 struct pci_controller *tmp, *hose;
759 struct pnv_phb *phb; 755 struct pnv_phb *phb;
@@ -767,7 +763,7 @@ static void __devinit pnv_pci_ioda_setup_seg(void)
767 } 763 }
768} 764}
769 765
770static void __devinit pnv_pci_ioda_setup_DMA(void) 766static void pnv_pci_ioda_setup_DMA(void)
771{ 767{
772 struct pci_controller *hose, *tmp; 768 struct pci_controller *hose, *tmp;
773 struct pnv_phb *phb; 769 struct pnv_phb *phb;
@@ -781,7 +777,7 @@ static void __devinit pnv_pci_ioda_setup_DMA(void)
781 } 777 }
782} 778}
783 779
784static void __devinit pnv_pci_ioda_fixup(void) 780static void pnv_pci_ioda_fixup(void)
785{ 781{
786 pnv_pci_ioda_setup_PEs(); 782 pnv_pci_ioda_setup_PEs();
787 pnv_pci_ioda_setup_seg(); 783 pnv_pci_ioda_setup_seg();
@@ -829,7 +825,7 @@ static resource_size_t pnv_pci_window_alignment(struct pci_bus *bus,
829/* Prevent enabling devices for which we couldn't properly 825/* Prevent enabling devices for which we couldn't properly
830 * assign a PE 826 * assign a PE
831 */ 827 */
832static int __devinit pnv_pci_enable_device_hook(struct pci_dev *dev) 828static int pnv_pci_enable_device_hook(struct pci_dev *dev)
833{ 829{
834 struct pci_controller *hose = pci_bus_to_host(dev->bus); 830 struct pci_controller *hose = pci_bus_to_host(dev->bus);
835 struct pnv_phb *phb = hose->private_data; 831 struct pnv_phb *phb = hose->private_data;
diff --git a/arch/powerpc/platforms/powernv/pci-p5ioc2.c b/arch/powerpc/platforms/powernv/pci-p5ioc2.c
index 6b4bef4e9d82..7db8771a40f5 100644
--- a/arch/powerpc/platforms/powernv/pci-p5ioc2.c
+++ b/arch/powerpc/platforms/powernv/pci-p5ioc2.c
@@ -84,8 +84,8 @@ static void pnv_pci_init_p5ioc2_msis(struct pnv_phb *phb)
84static void pnv_pci_init_p5ioc2_msis(struct pnv_phb *phb) { } 84static void pnv_pci_init_p5ioc2_msis(struct pnv_phb *phb) { }
85#endif /* CONFIG_PCI_MSI */ 85#endif /* CONFIG_PCI_MSI */
86 86
87static void __devinit pnv_pci_p5ioc2_dma_dev_setup(struct pnv_phb *phb, 87static void pnv_pci_p5ioc2_dma_dev_setup(struct pnv_phb *phb,
88 struct pci_dev *pdev) 88 struct pci_dev *pdev)
89{ 89{
90 if (phb->p5ioc2.iommu_table.it_map == NULL) 90 if (phb->p5ioc2.iommu_table.it_map == NULL)
91 iommu_init_table(&phb->p5ioc2.iommu_table, phb->hose->node); 91 iommu_init_table(&phb->p5ioc2.iommu_table, phb->hose->node);
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index c01688a1a741..b8b8e0bd9897 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -464,8 +464,7 @@ void pnv_pci_setup_iommu_table(struct iommu_table *tbl,
464 tbl->it_type = TCE_PCI; 464 tbl->it_type = TCE_PCI;
465} 465}
466 466
467static struct iommu_table * __devinit 467static struct iommu_table *pnv_pci_setup_bml_iommu(struct pci_controller *hose)
468pnv_pci_setup_bml_iommu(struct pci_controller *hose)
469{ 468{
470 struct iommu_table *tbl; 469 struct iommu_table *tbl;
471 const __be64 *basep, *swinvp; 470 const __be64 *basep, *swinvp;
@@ -496,8 +495,8 @@ pnv_pci_setup_bml_iommu(struct pci_controller *hose)
496 return tbl; 495 return tbl;
497} 496}
498 497
499static void __devinit pnv_pci_dma_fallback_setup(struct pci_controller *hose, 498static void pnv_pci_dma_fallback_setup(struct pci_controller *hose,
500 struct pci_dev *pdev) 499 struct pci_dev *pdev)
501{ 500{
502 struct device_node *np = pci_bus_to_OF_node(hose->bus); 501 struct device_node *np = pci_bus_to_OF_node(hose->bus);
503 struct pci_dn *pdn; 502 struct pci_dn *pdn;
@@ -512,7 +511,7 @@ static void __devinit pnv_pci_dma_fallback_setup(struct pci_controller *hose,
512 set_iommu_table_base(&pdev->dev, pdn->iommu_table); 511 set_iommu_table_base(&pdev->dev, pdn->iommu_table);
513} 512}
514 513
515static void __devinit pnv_pci_dma_dev_setup(struct pci_dev *pdev) 514static void pnv_pci_dma_dev_setup(struct pci_dev *pdev)
516{ 515{
517 struct pci_controller *hose = pci_bus_to_host(pdev->bus); 516 struct pci_controller *hose = pci_bus_to_host(pdev->bus);
518 struct pnv_phb *phb = hose->private_data; 517 struct pnv_phb *phb = hose->private_data;
@@ -527,7 +526,7 @@ static void __devinit pnv_pci_dma_dev_setup(struct pci_dev *pdev)
527} 526}
528 527
529/* Fixup wrong class code in p7ioc root complex */ 528/* Fixup wrong class code in p7ioc root complex */
530static void __devinit pnv_p7ioc_rc_quirk(struct pci_dev *dev) 529static void pnv_p7ioc_rc_quirk(struct pci_dev *dev)
531{ 530{
532 dev->class = PCI_CLASS_BRIDGE_PCI << 8; 531 dev->class = PCI_CLASS_BRIDGE_PCI << 8;
533} 532}
diff --git a/arch/powerpc/platforms/powernv/smp.c b/arch/powerpc/platforms/powernv/smp.c
index 7698b6e13c57..0bdc735db16f 100644
--- a/arch/powerpc/platforms/powernv/smp.c
+++ b/arch/powerpc/platforms/powernv/smp.c
@@ -62,7 +62,7 @@ static int pnv_smp_cpu_bootable(unsigned int nr)
62 return 1; 62 return 1;
63} 63}
64 64
65int __devinit pnv_smp_kick_cpu(int nr) 65int pnv_smp_kick_cpu(int nr)
66{ 66{
67 unsigned int pcpu = get_hard_smp_processor_id(nr); 67 unsigned int pcpu = get_hard_smp_processor_id(nr);
68 unsigned long start_here = __pa(*((unsigned long *) 68 unsigned long start_here = __pa(*((unsigned long *)
diff --git a/arch/powerpc/platforms/ps3/repository.c b/arch/powerpc/platforms/ps3/repository.c
index 9b47ba7a5de7..bfccdc7cb85f 100644
--- a/arch/powerpc/platforms/ps3/repository.c
+++ b/arch/powerpc/platforms/ps3/repository.c
@@ -437,7 +437,7 @@ found_dev:
437 return 0; 437 return 0;
438} 438}
439 439
440int __devinit ps3_repository_find_devices(enum ps3_bus_type bus_type, 440int ps3_repository_find_devices(enum ps3_bus_type bus_type,
441 int (*callback)(const struct ps3_repository_device *repo)) 441 int (*callback)(const struct ps3_repository_device *repo))
442{ 442{
443 int result = 0; 443 int result = 0;
diff --git a/arch/powerpc/platforms/pseries/eeh_dev.c b/arch/powerpc/platforms/pseries/eeh_dev.c
index 66442341d3a6..1efa28f5fc54 100644
--- a/arch/powerpc/platforms/pseries/eeh_dev.c
+++ b/arch/powerpc/platforms/pseries/eeh_dev.c
@@ -49,7 +49,7 @@
49 * It will create EEH device according to the given OF node. The function 49 * It will create EEH device according to the given OF node. The function
50 * might be called by PCI emunation, DR, PHB hotplug. 50 * might be called by PCI emunation, DR, PHB hotplug.
51 */ 51 */
52void * __devinit eeh_dev_init(struct device_node *dn, void *data) 52void *eeh_dev_init(struct device_node *dn, void *data)
53{ 53{
54 struct pci_controller *phb = data; 54 struct pci_controller *phb = data;
55 struct eeh_dev *edev; 55 struct eeh_dev *edev;
@@ -77,7 +77,7 @@ void * __devinit eeh_dev_init(struct device_node *dn, void *data)
77 * Scan the PHB OF node and its child association, then create the 77 * Scan the PHB OF node and its child association, then create the
78 * EEH devices accordingly 78 * EEH devices accordingly
79 */ 79 */
80void __devinit eeh_dev_phb_init_dynamic(struct pci_controller *phb) 80void eeh_dev_phb_init_dynamic(struct pci_controller *phb)
81{ 81{
82 struct device_node *dn = phb->dn; 82 struct device_node *dn = phb->dn;
83 83
diff --git a/arch/powerpc/platforms/pseries/eeh_pe.c b/arch/powerpc/platforms/pseries/eeh_pe.c
index d16c8ded1084..fe43d1aa2cf1 100644
--- a/arch/powerpc/platforms/pseries/eeh_pe.c
+++ b/arch/powerpc/platforms/pseries/eeh_pe.c
@@ -66,7 +66,7 @@ static struct eeh_pe *eeh_pe_alloc(struct pci_controller *phb, int type)
66 * The function should be called while the PHB is detected during 66 * The function should be called while the PHB is detected during
67 * system boot or PCI hotplug in order to create PHB PE. 67 * system boot or PCI hotplug in order to create PHB PE.
68 */ 68 */
69int __devinit eeh_phb_pe_create(struct pci_controller *phb) 69int eeh_phb_pe_create(struct pci_controller *phb)
70{ 70{
71 struct eeh_pe *pe; 71 struct eeh_pe *pe;
72 72
diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c
index 261a577a3dd2..c91b22be9288 100644
--- a/arch/powerpc/platforms/pseries/pci_dlpar.c
+++ b/arch/powerpc/platforms/pseries/pci_dlpar.c
@@ -149,7 +149,7 @@ void pcibios_add_pci_devices(struct pci_bus * bus)
149} 149}
150EXPORT_SYMBOL_GPL(pcibios_add_pci_devices); 150EXPORT_SYMBOL_GPL(pcibios_add_pci_devices);
151 151
152struct pci_controller * __devinit init_phb_dynamic(struct device_node *dn) 152struct pci_controller *init_phb_dynamic(struct device_node *dn)
153{ 153{
154 struct pci_controller *phb; 154 struct pci_controller *phb;
155 155
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index 9fc0a4941908..80cd0be71e06 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -87,7 +87,7 @@ int smp_query_cpu_stopped(unsigned int pcpu)
87 * 0 - failure 87 * 0 - failure
88 * 1 - success 88 * 1 - success
89 */ 89 */
90static inline int __devinit smp_startup_cpu(unsigned int lcpu) 90static inline int smp_startup_cpu(unsigned int lcpu)
91{ 91{
92 int status; 92 int status;
93 unsigned long start_here = __pa((u32)*((unsigned long *) 93 unsigned long start_here = __pa((u32)*((unsigned long *)
@@ -133,7 +133,7 @@ out:
133 return 1; 133 return 1;
134} 134}
135 135
136static void __devinit smp_xics_setup_cpu(int cpu) 136static void smp_xics_setup_cpu(int cpu)
137{ 137{
138 if (cpu != boot_cpuid) 138 if (cpu != boot_cpuid)
139 xics_setup_cpu(); 139 xics_setup_cpu();
@@ -148,7 +148,7 @@ static void __devinit smp_xics_setup_cpu(int cpu)
148#endif 148#endif
149} 149}
150 150
151static int __devinit smp_pSeries_kick_cpu(int nr) 151static int smp_pSeries_kick_cpu(int nr)
152{ 152{
153 BUG_ON(nr < 0 || nr >= NR_CPUS); 153 BUG_ON(nr < 0 || nr >= NR_CPUS);
154 154
diff --git a/arch/powerpc/platforms/wsp/scom_smp.c b/arch/powerpc/platforms/wsp/scom_smp.c
index 141e78032097..b56b70aeb497 100644
--- a/arch/powerpc/platforms/wsp/scom_smp.c
+++ b/arch/powerpc/platforms/wsp/scom_smp.c
@@ -337,8 +337,7 @@ scom_fail:
337 return rc; 337 return rc;
338} 338}
339 339
340int __devinit a2_scom_startup_cpu(unsigned int lcpu, int thr_idx, 340int a2_scom_startup_cpu(unsigned int lcpu, int thr_idx, struct device_node *np)
341 struct device_node *np)
342{ 341{
343 u64 init_iar, init_msr, init_ccr2; 342 u64 init_iar, init_msr, init_ccr2;
344 unsigned long start_here; 343 unsigned long start_here;
diff --git a/arch/powerpc/platforms/wsp/smp.c b/arch/powerpc/platforms/wsp/smp.c
index 0ba103ae83a5..332a18b81403 100644
--- a/arch/powerpc/platforms/wsp/smp.c
+++ b/arch/powerpc/platforms/wsp/smp.c
@@ -23,7 +23,7 @@
23#include "ics.h" 23#include "ics.h"
24#include "wsp.h" 24#include "wsp.h"
25 25
26static void __devinit smp_a2_setup_cpu(int cpu) 26static void smp_a2_setup_cpu(int cpu)
27{ 27{
28 doorbell_setup_this_cpu(); 28 doorbell_setup_this_cpu();
29 29
@@ -31,7 +31,7 @@ static void __devinit smp_a2_setup_cpu(int cpu)
31 xics_setup_cpu(); 31 xics_setup_cpu();
32} 32}
33 33
34int __devinit smp_a2_kick_cpu(int nr) 34int smp_a2_kick_cpu(int nr)
35{ 35{
36 const char *enable_method; 36 const char *enable_method;
37 struct device_node *np; 37 struct device_node *np;
diff --git a/arch/powerpc/platforms/wsp/wsp.h b/arch/powerpc/platforms/wsp/wsp.h
index 10c1d1fff362..62ef21afb89a 100644
--- a/arch/powerpc/platforms/wsp/wsp.h
+++ b/arch/powerpc/platforms/wsp/wsp.h
@@ -18,7 +18,7 @@ extern void a2_setup_smp(void);
18extern int a2_scom_startup_cpu(unsigned int lcpu, int thr_idx, 18extern int a2_scom_startup_cpu(unsigned int lcpu, int thr_idx,
19 struct device_node *np); 19 struct device_node *np);
20extern int smp_a2_cpu_bootable(unsigned int nr); 20extern int smp_a2_cpu_bootable(unsigned int nr);
21extern int __devinit smp_a2_kick_cpu(int nr); 21extern int smp_a2_kick_cpu(int nr);
22 22
23extern void opb_pic_init(void); 23extern void opb_pic_init(void);
24 24
diff --git a/arch/powerpc/platforms/wsp/wsp_pci.c b/arch/powerpc/platforms/wsp/wsp_pci.c
index 1526551f9fe6..8e22f561d171 100644
--- a/arch/powerpc/platforms/wsp/wsp_pci.c
+++ b/arch/powerpc/platforms/wsp/wsp_pci.c
@@ -402,7 +402,7 @@ static struct wsp_dma_table *wsp_pci_create_dma32_table(struct wsp_phb *phb,
402 return ERR_PTR(-ENOMEM); 402 return ERR_PTR(-ENOMEM);
403} 403}
404 404
405static void __devinit wsp_pci_dma_dev_setup(struct pci_dev *pdev) 405static void wsp_pci_dma_dev_setup(struct pci_dev *pdev)
406{ 406{
407 struct dev_archdata *archdata = &pdev->dev.archdata; 407 struct dev_archdata *archdata = &pdev->dev.archdata;
408 struct pci_controller *hose = pci_bus_to_host(pdev->bus); 408 struct pci_controller *hose = pci_bus_to_host(pdev->bus);
diff --git a/arch/powerpc/sysdev/bestcomm/bestcomm.c b/arch/powerpc/sysdev/bestcomm/bestcomm.c
index b3fbb271be87..d9130630f7ef 100644
--- a/arch/powerpc/sysdev/bestcomm/bestcomm.c
+++ b/arch/powerpc/sysdev/bestcomm/bestcomm.c
@@ -30,7 +30,7 @@
30#define DRIVER_NAME "bestcomm-core" 30#define DRIVER_NAME "bestcomm-core"
31 31
32/* MPC5200 device tree match tables */ 32/* MPC5200 device tree match tables */
33static struct of_device_id mpc52xx_sram_ids[] __devinitdata = { 33static struct of_device_id mpc52xx_sram_ids[] = {
34 { .compatible = "fsl,mpc5200-sram", }, 34 { .compatible = "fsl,mpc5200-sram", },
35 { .compatible = "mpc5200-sram", }, 35 { .compatible = "mpc5200-sram", },
36 {} 36 {}
@@ -273,8 +273,7 @@ static u32 fdt_ops[] = {
273}; 273};
274 274
275 275
276static int __devinit 276static int bcom_engine_init(void)
277bcom_engine_init(void)
278{ 277{
279 int task; 278 int task;
280 phys_addr_t tdt_pa, ctx_pa, var_pa, fdt_pa; 279 phys_addr_t tdt_pa, ctx_pa, var_pa, fdt_pa;
@@ -365,7 +364,7 @@ bcom_engine_cleanup(void)
365/* OF platform driver */ 364/* OF platform driver */
366/* ======================================================================== */ 365/* ======================================================================== */
367 366
368static int __devinit mpc52xx_bcom_probe(struct platform_device *op) 367static int mpc52xx_bcom_probe(struct platform_device *op)
369{ 368{
370 struct device_node *ofn_sram; 369 struct device_node *ofn_sram;
371 struct resource res_bcom; 370 struct resource res_bcom;
diff --git a/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c b/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c
index d131c8a1cb15..8cf93f029e17 100644
--- a/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c
+++ b/arch/powerpc/sysdev/fsl_85xx_l2ctlr.c
@@ -69,7 +69,7 @@ static int __init get_offset_from_cmdline(char *str)
69__setup("cache-sram-size=", get_size_from_cmdline); 69__setup("cache-sram-size=", get_size_from_cmdline);
70__setup("cache-sram-offset=", get_offset_from_cmdline); 70__setup("cache-sram-offset=", get_offset_from_cmdline);
71 71
72static int __devinit mpc85xx_l2ctlr_of_probe(struct platform_device *dev) 72static int mpc85xx_l2ctlr_of_probe(struct platform_device *dev)
73{ 73{
74 long rval; 74 long rval;
75 unsigned int rem; 75 unsigned int rem;
@@ -160,7 +160,7 @@ static int __devinit mpc85xx_l2ctlr_of_probe(struct platform_device *dev)
160 return 0; 160 return 0;
161} 161}
162 162
163static int __devexit mpc85xx_l2ctlr_of_remove(struct platform_device *dev) 163static int mpc85xx_l2ctlr_of_remove(struct platform_device *dev)
164{ 164{
165 BUG_ON(!l2ctlr); 165 BUG_ON(!l2ctlr);
166 166
@@ -213,7 +213,7 @@ static struct platform_driver mpc85xx_l2ctlr_of_platform_driver = {
213 .of_match_table = mpc85xx_l2ctlr_of_match, 213 .of_match_table = mpc85xx_l2ctlr_of_match,
214 }, 214 },
215 .probe = mpc85xx_l2ctlr_of_probe, 215 .probe = mpc85xx_l2ctlr_of_probe,
216 .remove = __devexit_p(mpc85xx_l2ctlr_of_remove), 216 .remove = mpc85xx_l2ctlr_of_remove,
217}; 217};
218 218
219static __init int mpc85xx_l2ctlr_of_init(void) 219static __init int mpc85xx_l2ctlr_of_init(void)
diff --git a/arch/powerpc/sysdev/fsl_ifc.c b/arch/powerpc/sysdev/fsl_ifc.c
index 097cc9d2585b..2a36fd6a9583 100644
--- a/arch/powerpc/sysdev/fsl_ifc.c
+++ b/arch/powerpc/sysdev/fsl_ifc.c
@@ -73,7 +73,7 @@ int fsl_ifc_find(phys_addr_t addr_base)
73} 73}
74EXPORT_SYMBOL(fsl_ifc_find); 74EXPORT_SYMBOL(fsl_ifc_find);
75 75
76static int __devinit fsl_ifc_ctrl_init(struct fsl_ifc_ctrl *ctrl) 76static int fsl_ifc_ctrl_init(struct fsl_ifc_ctrl *ctrl)
77{ 77{
78 struct fsl_ifc_regs __iomem *ifc = ctrl->regs; 78 struct fsl_ifc_regs __iomem *ifc = ctrl->regs;
79 79
@@ -211,7 +211,7 @@ static irqreturn_t fsl_ifc_ctrl_irq(int irqno, void *data)
211 * resources for the NAND banks themselves are allocated 211 * resources for the NAND banks themselves are allocated
212 * in the chip probe function. 212 * in the chip probe function.
213*/ 213*/
214static int __devinit fsl_ifc_ctrl_probe(struct platform_device *dev) 214static int fsl_ifc_ctrl_probe(struct platform_device *dev)
215{ 215{
216 int ret = 0; 216 int ret = 0;
217 217
diff --git a/arch/powerpc/sysdev/fsl_lbc.c b/arch/powerpc/sysdev/fsl_lbc.c
index 483126d7b3c0..300be2d06a26 100644
--- a/arch/powerpc/sysdev/fsl_lbc.c
+++ b/arch/powerpc/sysdev/fsl_lbc.c
@@ -185,8 +185,8 @@ int fsl_upm_run_pattern(struct fsl_upm *upm, void __iomem *io_base, u32 mar)
185} 185}
186EXPORT_SYMBOL(fsl_upm_run_pattern); 186EXPORT_SYMBOL(fsl_upm_run_pattern);
187 187
188static int __devinit fsl_lbc_ctrl_init(struct fsl_lbc_ctrl *ctrl, 188static int fsl_lbc_ctrl_init(struct fsl_lbc_ctrl *ctrl,
189 struct device_node *node) 189 struct device_node *node)
190{ 190{
191 struct fsl_lbc_regs __iomem *lbc = ctrl->regs; 191 struct fsl_lbc_regs __iomem *lbc = ctrl->regs;
192 192
@@ -273,7 +273,7 @@ static irqreturn_t fsl_lbc_ctrl_irq(int irqno, void *data)
273 * in the chip probe function. 273 * in the chip probe function.
274*/ 274*/
275 275
276static int __devinit fsl_lbc_ctrl_probe(struct platform_device *dev) 276static int fsl_lbc_ctrl_probe(struct platform_device *dev)
277{ 277{
278 int ret; 278 int ret;
279 279
diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index 63c5f04ea580..6e53d97abd3f 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -333,9 +333,8 @@ static int fsl_of_msi_remove(struct platform_device *ofdev)
333 return 0; 333 return 0;
334} 334}
335 335
336static int __devinit fsl_msi_setup_hwirq(struct fsl_msi *msi, 336static int fsl_msi_setup_hwirq(struct fsl_msi *msi, struct platform_device *dev,
337 struct platform_device *dev, 337 int offset, int irq_index)
338 int offset, int irq_index)
339{ 338{
340 struct fsl_msi_cascade_data *cascade_data = NULL; 339 struct fsl_msi_cascade_data *cascade_data = NULL;
341 int virt_msir; 340 int virt_msir;
@@ -363,7 +362,7 @@ static int __devinit fsl_msi_setup_hwirq(struct fsl_msi *msi,
363} 362}
364 363
365static const struct of_device_id fsl_of_msi_ids[]; 364static const struct of_device_id fsl_of_msi_ids[];
366static int __devinit fsl_of_msi_probe(struct platform_device *dev) 365static int fsl_of_msi_probe(struct platform_device *dev)
367{ 366{
368 const struct of_device_id *match; 367 const struct of_device_id *match;
369 struct fsl_msi *msi; 368 struct fsl_msi *msi;
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 5ba325bff3a2..92a5915b1827 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -36,7 +36,7 @@
36 36
37static int fsl_pcie_bus_fixup, is_mpc83xx_pci; 37static int fsl_pcie_bus_fixup, is_mpc83xx_pci;
38 38
39static void __devinit quirk_fsl_pcie_header(struct pci_dev *dev) 39static void quirk_fsl_pcie_header(struct pci_dev *dev)
40{ 40{
41 u8 hdr_type; 41 u8 hdr_type;
42 42
@@ -871,7 +871,7 @@ void fsl_pci_assign_primary(void)
871 } 871 }
872} 872}
873 873
874static int __devinit fsl_pci_probe(struct platform_device *pdev) 874static int fsl_pci_probe(struct platform_device *pdev)
875{ 875{
876 int ret; 876 int ret;
877 struct device_node *node; 877 struct device_node *node;
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index 5b6f556094dd..e2fb3171f41b 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -644,7 +644,7 @@ err_rio_regs:
644 644
645/* The probe function for RapidIO peer-to-peer network. 645/* The probe function for RapidIO peer-to-peer network.
646 */ 646 */
647static int __devinit fsl_of_rio_rpn_probe(struct platform_device *dev) 647static int fsl_of_rio_rpn_probe(struct platform_device *dev)
648{ 648{
649 printk(KERN_INFO "Setting up RapidIO peer-to-peer network %s\n", 649 printk(KERN_INFO "Setting up RapidIO peer-to-peer network %s\n",
650 dev->dev.of_node->full_name); 650 dev->dev.of_node->full_name);
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 9c6e535daad2..3b2efd41abf2 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -1864,7 +1864,7 @@ int __init smp_mpic_probe(void)
1864 return nr_cpus; 1864 return nr_cpus;
1865} 1865}
1866 1866
1867void __devinit smp_mpic_setup_cpu(int cpu) 1867void smp_mpic_setup_cpu(int cpu)
1868{ 1868{
1869 mpic_setup_this_cpu(); 1869 mpic_setup_this_cpu();
1870} 1870}
diff --git a/arch/powerpc/sysdev/mpic_msgr.c b/arch/powerpc/sysdev/mpic_msgr.c
index e961f8c4a8f0..c75325865a85 100644
--- a/arch/powerpc/sysdev/mpic_msgr.c
+++ b/arch/powerpc/sysdev/mpic_msgr.c
@@ -160,7 +160,7 @@ static int mpic_msgr_block_number(struct device_node *node)
160 160
161/* The probe function for a single message register block. 161/* The probe function for a single message register block.
162 */ 162 */
163static __devinit int mpic_msgr_probe(struct platform_device *dev) 163static int mpic_msgr_probe(struct platform_device *dev)
164{ 164{
165 void __iomem *msgr_block_addr; 165 void __iomem *msgr_block_addr;
166 int block_number; 166 int block_number;
diff --git a/arch/powerpc/sysdev/mv64x60_pci.c b/arch/powerpc/sysdev/mv64x60_pci.c
index 364b14d4754b..330d56613c5a 100644
--- a/arch/powerpc/sysdev/mv64x60_pci.c
+++ b/arch/powerpc/sysdev/mv64x60_pci.c
@@ -104,7 +104,7 @@ subsys_initcall(mv64x60_sysfs_init);
104 104
105#endif /* CONFIG_SYSFS */ 105#endif /* CONFIG_SYSFS */
106 106
107static void __devinit mv64x60_pci_fixup_early(struct pci_dev *dev) 107static void mv64x60_pci_fixup_early(struct pci_dev *dev)
108{ 108{
109 /* 109 /*
110 * Set the host bridge hdr_type to an invalid value so that 110 * Set the host bridge hdr_type to an invalid value so that
diff --git a/arch/powerpc/sysdev/ppc4xx_msi.c b/arch/powerpc/sysdev/ppc4xx_msi.c
index 82c6702dcbab..43948da837a7 100644
--- a/arch/powerpc/sysdev/ppc4xx_msi.c
+++ b/arch/powerpc/sysdev/ppc4xx_msi.c
@@ -220,7 +220,7 @@ static int ppc4xx_of_msi_remove(struct platform_device *dev)
220 return 0; 220 return 0;
221} 221}
222 222
223static int __devinit ppc4xx_msi_probe(struct platform_device *dev) 223static int ppc4xx_msi_probe(struct platform_device *dev)
224{ 224{
225 struct ppc4xx_msi *msi; 225 struct ppc4xx_msi *msi;
226 struct resource res; 226 struct resource res;
diff --git a/arch/s390/Makefile b/arch/s390/Makefile
index 4b8e08b56f49..7e3ce78d4290 100644
--- a/arch/s390/Makefile
+++ b/arch/s390/Makefile
@@ -24,8 +24,8 @@ CHECKFLAGS += -D__s390__ -msize-long
24else 24else
25LD_BFD := elf64-s390 25LD_BFD := elf64-s390
26LDFLAGS := -m elf64_s390 26LDFLAGS := -m elf64_s390
27KBUILD_AFLAGS_MODULE += -fpic -D__PIC__ 27KBUILD_AFLAGS_MODULE += -fPIC
28KBUILD_CFLAGS_MODULE += -fpic -D__PIC__ 28KBUILD_CFLAGS_MODULE += -fPIC
29KBUILD_CFLAGS += -m64 29KBUILD_CFLAGS += -m64
30KBUILD_AFLAGS += -m64 30KBUILD_AFLAGS += -m64
31UTS_MACHINE := s390x 31UTS_MACHINE := s390x
diff --git a/arch/s390/include/asm/dma.h b/arch/s390/include/asm/dma.h
index de015d85e3e5..bb9bdcd20864 100644
--- a/arch/s390/include/asm/dma.h
+++ b/arch/s390/include/asm/dma.h
@@ -10,4 +10,10 @@
10 */ 10 */
11#define MAX_DMA_ADDRESS 0x80000000 11#define MAX_DMA_ADDRESS 0x80000000
12 12
13#ifdef CONFIG_PCI
14extern int isa_dma_bridge_buggy;
15#else
16#define isa_dma_bridge_buggy (0)
17#endif
18
13#endif /* _ASM_S390_DMA_H */ 19#endif /* _ASM_S390_DMA_H */
diff --git a/arch/s390/include/asm/io.h b/arch/s390/include/asm/io.h
index 16c3eb164f4f..27cb32185ce1 100644
--- a/arch/s390/include/asm/io.h
+++ b/arch/s390/include/asm/io.h
@@ -85,6 +85,11 @@ static inline void iounmap(volatile void __iomem *addr)
85#define __raw_writel zpci_write_u32 85#define __raw_writel zpci_write_u32
86#define __raw_writeq zpci_write_u64 86#define __raw_writeq zpci_write_u64
87 87
88#define readb_relaxed readb
89#define readw_relaxed readw
90#define readl_relaxed readl
91#define readq_relaxed readq
92
88#endif /* CONFIG_PCI */ 93#endif /* CONFIG_PCI */
89 94
90#include <asm-generic/io.h> 95#include <asm-generic/io.h>
diff --git a/arch/s390/include/asm/irq.h b/arch/s390/include/asm/irq.h
index e6972f85d2b0..7def77302d63 100644
--- a/arch/s390/include/asm/irq.h
+++ b/arch/s390/include/asm/irq.h
@@ -2,43 +2,61 @@
2#define _ASM_IRQ_H 2#define _ASM_IRQ_H
3 3
4#include <linux/hardirq.h> 4#include <linux/hardirq.h>
5#include <linux/percpu.h>
6#include <linux/cache.h>
5#include <linux/types.h> 7#include <linux/types.h>
6 8
7enum interruption_class { 9enum interruption_main_class {
8 EXTERNAL_INTERRUPT, 10 EXTERNAL_INTERRUPT,
9 IO_INTERRUPT, 11 IO_INTERRUPT,
10 EXTINT_CLK, 12 NR_IRQS
11 EXTINT_EXC, 13};
12 EXTINT_EMS, 14
13 EXTINT_TMR, 15enum interruption_class {
14 EXTINT_TLA, 16 IRQEXT_CLK,
15 EXTINT_PFL, 17 IRQEXT_EXC,
16 EXTINT_DSD, 18 IRQEXT_EMS,
17 EXTINT_VRT, 19 IRQEXT_TMR,
18 EXTINT_SCP, 20 IRQEXT_TLA,
19 EXTINT_IUC, 21 IRQEXT_PFL,
20 EXTINT_CMS, 22 IRQEXT_DSD,
21 EXTINT_CMC, 23 IRQEXT_VRT,
22 EXTINT_CMR, 24 IRQEXT_SCP,
23 IOINT_CIO, 25 IRQEXT_IUC,
24 IOINT_QAI, 26 IRQEXT_CMS,
25 IOINT_DAS, 27 IRQEXT_CMC,
26 IOINT_C15, 28 IRQEXT_CMR,
27 IOINT_C70, 29 IRQIO_CIO,
28 IOINT_TAP, 30 IRQIO_QAI,
29 IOINT_VMR, 31 IRQIO_DAS,
30 IOINT_LCS, 32 IRQIO_C15,
31 IOINT_CLW, 33 IRQIO_C70,
32 IOINT_CTC, 34 IRQIO_TAP,
33 IOINT_APB, 35 IRQIO_VMR,
34 IOINT_ADM, 36 IRQIO_LCS,
35 IOINT_CSC, 37 IRQIO_CLW,
36 IOINT_PCI, 38 IRQIO_CTC,
37 IOINT_MSI, 39 IRQIO_APB,
40 IRQIO_ADM,
41 IRQIO_CSC,
42 IRQIO_PCI,
43 IRQIO_MSI,
38 NMI_NMI, 44 NMI_NMI,
39 NR_IRQS, 45 CPU_RST,
46 NR_ARCH_IRQS
40}; 47};
41 48
49struct irq_stat {
50 unsigned int irqs[NR_ARCH_IRQS];
51};
52
53DECLARE_PER_CPU_SHARED_ALIGNED(struct irq_stat, irq_stat);
54
55static __always_inline void inc_irq_stat(enum interruption_class irq)
56{
57 __get_cpu_var(irq_stat).irqs[irq]++;
58}
59
42struct ext_code { 60struct ext_code {
43 unsigned short subcode; 61 unsigned short subcode;
44 unsigned short code; 62 unsigned short code;
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index c928dc1938f2..098adbb62660 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -1365,6 +1365,18 @@ static inline void pmdp_invalidate(struct vm_area_struct *vma,
1365 __pmd_idte(address, pmdp); 1365 __pmd_idte(address, pmdp);
1366} 1366}
1367 1367
1368#define __HAVE_ARCH_PMDP_SET_WRPROTECT
1369static inline void pmdp_set_wrprotect(struct mm_struct *mm,
1370 unsigned long address, pmd_t *pmdp)
1371{
1372 pmd_t pmd = *pmdp;
1373
1374 if (pmd_write(pmd)) {
1375 __pmd_idte(address, pmdp);
1376 set_pmd_at(mm, address, pmdp, pmd_wrprotect(pmd));
1377 }
1378}
1379
1368static inline pmd_t mk_pmd_phys(unsigned long physpage, pgprot_t pgprot) 1380static inline pmd_t mk_pmd_phys(unsigned long physpage, pgprot_t pgprot)
1369{ 1381{
1370 pmd_t __pmd; 1382 pmd_t __pmd;
@@ -1387,10 +1399,7 @@ static inline int has_transparent_hugepage(void)
1387 1399
1388static inline unsigned long pmd_pfn(pmd_t pmd) 1400static inline unsigned long pmd_pfn(pmd_t pmd)
1389{ 1401{
1390 if (pmd_trans_huge(pmd)) 1402 return pmd_val(pmd) >> PAGE_SHIFT;
1391 return pmd_val(pmd) >> HPAGE_SHIFT;
1392 else
1393 return pmd_val(pmd) >> PAGE_SHIFT;
1394} 1403}
1395#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ 1404#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
1396 1405
diff --git a/arch/s390/include/asm/timex.h b/arch/s390/include/asm/timex.h
index fba4d66788a2..4c060bb5b8ea 100644
--- a/arch/s390/include/asm/timex.h
+++ b/arch/s390/include/asm/timex.h
@@ -128,4 +128,32 @@ static inline unsigned long long get_clock_monotonic(void)
128 return get_clock_xt() - sched_clock_base_cc; 128 return get_clock_xt() - sched_clock_base_cc;
129} 129}
130 130
131/**
132 * tod_to_ns - convert a TOD format value to nanoseconds
133 * @todval: to be converted TOD format value
134 * Returns: number of nanoseconds that correspond to the TOD format value
135 *
136 * Converting a 64 Bit TOD format value to nanoseconds means that the value
137 * must be divided by 4.096. In order to achieve that we multiply with 125
138 * and divide by 512:
139 *
140 * ns = (todval * 125) >> 9;
141 *
142 * In order to avoid an overflow with the multiplication we can rewrite this.
143 * With a split todval == 2^32 * th + tl (th upper 32 bits, tl lower 32 bits)
144 * we end up with
145 *
146 * ns = ((2^32 * th + tl) * 125 ) >> 9;
147 * -> ns = (2^23 * th * 125) + ((tl * 125) >> 9);
148 *
149 */
150static inline unsigned long long tod_to_ns(unsigned long long todval)
151{
152 unsigned long long ns;
153
154 ns = ((todval >> 32) << 23) * 125;
155 ns += ((todval & 0xffffffff) * 125) >> 9;
156 return ns;
157}
158
131#endif 159#endif
diff --git a/arch/s390/include/uapi/asm/unistd.h b/arch/s390/include/uapi/asm/unistd.h
index 63e6078699f1..864f693c237f 100644
--- a/arch/s390/include/uapi/asm/unistd.h
+++ b/arch/s390/include/uapi/asm/unistd.h
@@ -279,7 +279,8 @@
279#define __NR_process_vm_writev 341 279#define __NR_process_vm_writev 341
280#define __NR_s390_runtime_instr 342 280#define __NR_s390_runtime_instr 342
281#define __NR_kcmp 343 281#define __NR_kcmp 343
282#define NR_syscalls 344 282#define __NR_finit_module 344
283#define NR_syscalls 345
283 284
284/* 285/*
285 * There are some system calls that are not present on 64 bit, some 286 * There are some system calls that are not present on 64 bit, some
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index 827e094a2f49..9b9a805656b5 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -1659,3 +1659,9 @@ ENTRY(sys_kcmp_wrapper)
1659 llgfr %r5,%r5 # unsigned long 1659 llgfr %r5,%r5 # unsigned long
1660 llgfr %r6,%r6 # unsigned long 1660 llgfr %r6,%r6 # unsigned long
1661 jg sys_kcmp 1661 jg sys_kcmp
1662
1663ENTRY(sys_finit_module_wrapper)
1664 lgfr %r2,%r2 # int
1665 llgtr %r3,%r3 # const char __user *
1666 lgfr %r4,%r4 # int
1667 jg sys_finit_module
diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
index ba500d8dc392..4e8215e0d4b6 100644
--- a/arch/s390/kernel/debug.c
+++ b/arch/s390/kernel/debug.c
@@ -1127,13 +1127,14 @@ debug_register_view(debug_info_t * id, struct debug_view *view)
1127 if (i == DEBUG_MAX_VIEWS) { 1127 if (i == DEBUG_MAX_VIEWS) {
1128 pr_err("Registering view %s/%s would exceed the maximum " 1128 pr_err("Registering view %s/%s would exceed the maximum "
1129 "number of views %i\n", id->name, view->name, i); 1129 "number of views %i\n", id->name, view->name, i);
1130 debugfs_remove(pde);
1131 rc = -1; 1130 rc = -1;
1132 } else { 1131 } else {
1133 id->views[i] = view; 1132 id->views[i] = view;
1134 id->debugfs_entries[i] = pde; 1133 id->debugfs_entries[i] = pde;
1135 } 1134 }
1136 spin_unlock_irqrestore(&id->lock, flags); 1135 spin_unlock_irqrestore(&id->lock, flags);
1136 if (rc)
1137 debugfs_remove(pde);
1137out: 1138out:
1138 return rc; 1139 return rc;
1139} 1140}
@@ -1146,9 +1147,9 @@ EXPORT_SYMBOL(debug_register_view);
1146int 1147int
1147debug_unregister_view(debug_info_t * id, struct debug_view *view) 1148debug_unregister_view(debug_info_t * id, struct debug_view *view)
1148{ 1149{
1149 int rc = 0; 1150 struct dentry *dentry = NULL;
1150 int i;
1151 unsigned long flags; 1151 unsigned long flags;
1152 int i, rc = 0;
1152 1153
1153 if (!id) 1154 if (!id)
1154 goto out; 1155 goto out;
@@ -1160,10 +1161,12 @@ debug_unregister_view(debug_info_t * id, struct debug_view *view)
1160 if (i == DEBUG_MAX_VIEWS) 1161 if (i == DEBUG_MAX_VIEWS)
1161 rc = -1; 1162 rc = -1;
1162 else { 1163 else {
1163 debugfs_remove(id->debugfs_entries[i]); 1164 dentry = id->debugfs_entries[i];
1164 id->views[i] = NULL; 1165 id->views[i] = NULL;
1166 id->debugfs_entries[i] = NULL;
1165 } 1167 }
1166 spin_unlock_irqrestore(&id->lock, flags); 1168 spin_unlock_irqrestore(&id->lock, flags);
1169 debugfs_remove(dentry);
1167out: 1170out:
1168 return rc; 1171 return rc;
1169} 1172}
diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c
index bf24293970ce..9df824ea1667 100644
--- a/arch/s390/kernel/irq.c
+++ b/arch/s390/kernel/irq.c
@@ -24,43 +24,65 @@
24#include <asm/irq.h> 24#include <asm/irq.h>
25#include "entry.h" 25#include "entry.h"
26 26
27DEFINE_PER_CPU_SHARED_ALIGNED(struct irq_stat, irq_stat);
28EXPORT_PER_CPU_SYMBOL_GPL(irq_stat);
29
27struct irq_class { 30struct irq_class {
28 char *name; 31 char *name;
29 char *desc; 32 char *desc;
30}; 33};
31 34
32static const struct irq_class intrclass_names[] = { 35/*
36 * The list of "main" irq classes on s390. This is the list of interrrupts
37 * that appear both in /proc/stat ("intr" line) and /proc/interrupts.
38 * Historically only external and I/O interrupts have been part of /proc/stat.
39 * We can't add the split external and I/O sub classes since the first field
40 * in the "intr" line in /proc/stat is supposed to be the sum of all other
41 * fields.
42 * Since the external and I/O interrupt fields are already sums we would end
43 * up with having a sum which accounts each interrupt twice.
44 */
45static const struct irq_class irqclass_main_desc[NR_IRQS] = {
33 [EXTERNAL_INTERRUPT] = {.name = "EXT"}, 46 [EXTERNAL_INTERRUPT] = {.name = "EXT"},
34 [IO_INTERRUPT] = {.name = "I/O"}, 47 [IO_INTERRUPT] = {.name = "I/O"}
35 [EXTINT_CLK] = {.name = "CLK", .desc = "[EXT] Clock Comparator"}, 48};
36 [EXTINT_EXC] = {.name = "EXC", .desc = "[EXT] External Call"}, 49
37 [EXTINT_EMS] = {.name = "EMS", .desc = "[EXT] Emergency Signal"}, 50/*
38 [EXTINT_TMR] = {.name = "TMR", .desc = "[EXT] CPU Timer"}, 51 * The list of split external and I/O interrupts that appear only in
39 [EXTINT_TLA] = {.name = "TAL", .desc = "[EXT] Timing Alert"}, 52 * /proc/interrupts.
40 [EXTINT_PFL] = {.name = "PFL", .desc = "[EXT] Pseudo Page Fault"}, 53 * In addition this list contains non external / I/O events like NMIs.
41 [EXTINT_DSD] = {.name = "DSD", .desc = "[EXT] DASD Diag"}, 54 */
42 [EXTINT_VRT] = {.name = "VRT", .desc = "[EXT] Virtio"}, 55static const struct irq_class irqclass_sub_desc[NR_ARCH_IRQS] = {
43 [EXTINT_SCP] = {.name = "SCP", .desc = "[EXT] Service Call"}, 56 [IRQEXT_CLK] = {.name = "CLK", .desc = "[EXT] Clock Comparator"},
44 [EXTINT_IUC] = {.name = "IUC", .desc = "[EXT] IUCV"}, 57 [IRQEXT_EXC] = {.name = "EXC", .desc = "[EXT] External Call"},
45 [EXTINT_CMS] = {.name = "CMS", .desc = "[EXT] CPU-Measurement: Sampling"}, 58 [IRQEXT_EMS] = {.name = "EMS", .desc = "[EXT] Emergency Signal"},
46 [EXTINT_CMC] = {.name = "CMC", .desc = "[EXT] CPU-Measurement: Counter"}, 59 [IRQEXT_TMR] = {.name = "TMR", .desc = "[EXT] CPU Timer"},
47 [EXTINT_CMR] = {.name = "CMR", .desc = "[EXT] CPU-Measurement: RI"}, 60 [IRQEXT_TLA] = {.name = "TAL", .desc = "[EXT] Timing Alert"},
48 [IOINT_CIO] = {.name = "CIO", .desc = "[I/O] Common I/O Layer Interrupt"}, 61 [IRQEXT_PFL] = {.name = "PFL", .desc = "[EXT] Pseudo Page Fault"},
49 [IOINT_QAI] = {.name = "QAI", .desc = "[I/O] QDIO Adapter Interrupt"}, 62 [IRQEXT_DSD] = {.name = "DSD", .desc = "[EXT] DASD Diag"},
50 [IOINT_DAS] = {.name = "DAS", .desc = "[I/O] DASD"}, 63 [IRQEXT_VRT] = {.name = "VRT", .desc = "[EXT] Virtio"},
51 [IOINT_C15] = {.name = "C15", .desc = "[I/O] 3215"}, 64 [IRQEXT_SCP] = {.name = "SCP", .desc = "[EXT] Service Call"},
52 [IOINT_C70] = {.name = "C70", .desc = "[I/O] 3270"}, 65 [IRQEXT_IUC] = {.name = "IUC", .desc = "[EXT] IUCV"},
53 [IOINT_TAP] = {.name = "TAP", .desc = "[I/O] Tape"}, 66 [IRQEXT_CMS] = {.name = "CMS", .desc = "[EXT] CPU-Measurement: Sampling"},
54 [IOINT_VMR] = {.name = "VMR", .desc = "[I/O] Unit Record Devices"}, 67 [IRQEXT_CMC] = {.name = "CMC", .desc = "[EXT] CPU-Measurement: Counter"},
55 [IOINT_LCS] = {.name = "LCS", .desc = "[I/O] LCS"}, 68 [IRQEXT_CMR] = {.name = "CMR", .desc = "[EXT] CPU-Measurement: RI"},
56 [IOINT_CLW] = {.name = "CLW", .desc = "[I/O] CLAW"}, 69 [IRQIO_CIO] = {.name = "CIO", .desc = "[I/O] Common I/O Layer Interrupt"},
57 [IOINT_CTC] = {.name = "CTC", .desc = "[I/O] CTC"}, 70 [IRQIO_QAI] = {.name = "QAI", .desc = "[I/O] QDIO Adapter Interrupt"},
58 [IOINT_APB] = {.name = "APB", .desc = "[I/O] AP Bus"}, 71 [IRQIO_DAS] = {.name = "DAS", .desc = "[I/O] DASD"},
59 [IOINT_ADM] = {.name = "ADM", .desc = "[I/O] EADM Subchannel"}, 72 [IRQIO_C15] = {.name = "C15", .desc = "[I/O] 3215"},
60 [IOINT_CSC] = {.name = "CSC", .desc = "[I/O] CHSC Subchannel"}, 73 [IRQIO_C70] = {.name = "C70", .desc = "[I/O] 3270"},
61 [IOINT_PCI] = {.name = "PCI", .desc = "[I/O] PCI Interrupt" }, 74 [IRQIO_TAP] = {.name = "TAP", .desc = "[I/O] Tape"},
62 [IOINT_MSI] = {.name = "MSI", .desc = "[I/O] MSI Interrupt" }, 75 [IRQIO_VMR] = {.name = "VMR", .desc = "[I/O] Unit Record Devices"},
76 [IRQIO_LCS] = {.name = "LCS", .desc = "[I/O] LCS"},
77 [IRQIO_CLW] = {.name = "CLW", .desc = "[I/O] CLAW"},
78 [IRQIO_CTC] = {.name = "CTC", .desc = "[I/O] CTC"},
79 [IRQIO_APB] = {.name = "APB", .desc = "[I/O] AP Bus"},
80 [IRQIO_ADM] = {.name = "ADM", .desc = "[I/O] EADM Subchannel"},
81 [IRQIO_CSC] = {.name = "CSC", .desc = "[I/O] CHSC Subchannel"},
82 [IRQIO_PCI] = {.name = "PCI", .desc = "[I/O] PCI Interrupt" },
83 [IRQIO_MSI] = {.name = "MSI", .desc = "[I/O] MSI Interrupt" },
63 [NMI_NMI] = {.name = "NMI", .desc = "[NMI] Machine Check"}, 84 [NMI_NMI] = {.name = "NMI", .desc = "[NMI] Machine Check"},
85 [CPU_RST] = {.name = "RST", .desc = "[CPU] CPU Restart"},
64}; 86};
65 87
66/* 88/*
@@ -68,30 +90,34 @@ static const struct irq_class intrclass_names[] = {
68 */ 90 */
69int show_interrupts(struct seq_file *p, void *v) 91int show_interrupts(struct seq_file *p, void *v)
70{ 92{
71 int i = *(loff_t *) v, j; 93 int irq = *(loff_t *) v;
94 int cpu;
72 95
73 get_online_cpus(); 96 get_online_cpus();
74 if (i == 0) { 97 if (irq == 0) {
75 seq_puts(p, " "); 98 seq_puts(p, " ");
76 for_each_online_cpu(j) 99 for_each_online_cpu(cpu)
77 seq_printf(p, "CPU%d ",j); 100 seq_printf(p, "CPU%d ", cpu);
78 seq_putc(p, '\n'); 101 seq_putc(p, '\n');
79 } 102 }
80 103 if (irq < NR_IRQS) {
81 if (i < NR_IRQS) { 104 seq_printf(p, "%s: ", irqclass_main_desc[irq].name);
82 seq_printf(p, "%s: ", intrclass_names[i].name); 105 for_each_online_cpu(cpu)
83#ifndef CONFIG_SMP 106 seq_printf(p, "%10u ", kstat_cpu(cpu).irqs[irq]);
84 seq_printf(p, "%10u ", kstat_irqs(i)); 107 seq_putc(p, '\n');
85#else 108 goto skip_arch_irqs;
86 for_each_online_cpu(j) 109 }
87 seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]); 110 for (irq = 0; irq < NR_ARCH_IRQS; irq++) {
88#endif 111 seq_printf(p, "%s: ", irqclass_sub_desc[irq].name);
89 if (intrclass_names[i].desc) 112 for_each_online_cpu(cpu)
90 seq_printf(p, " %s", intrclass_names[i].desc); 113 seq_printf(p, "%10u ", per_cpu(irq_stat, cpu).irqs[irq]);
91 seq_putc(p, '\n'); 114 if (irqclass_sub_desc[irq].desc)
92 } 115 seq_printf(p, " %s", irqclass_sub_desc[irq].desc);
116 seq_putc(p, '\n');
117 }
118skip_arch_irqs:
93 put_online_cpus(); 119 put_online_cpus();
94 return 0; 120 return 0;
95} 121}
96 122
97/* 123/*
@@ -222,7 +248,7 @@ void __irq_entry do_extint(struct pt_regs *regs, struct ext_code ext_code,
222 /* Serve timer interrupts first. */ 248 /* Serve timer interrupts first. */
223 clock_comparator_work(); 249 clock_comparator_work();
224 } 250 }
225 kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++; 251 kstat_incr_irqs_this_cpu(EXTERNAL_INTERRUPT, NULL);
226 if (ext_code.code != 0x1004) 252 if (ext_code.code != 0x1004)
227 __get_cpu_var(s390_idle).nohz_delay = 1; 253 __get_cpu_var(s390_idle).nohz_delay = 1;
228 254
diff --git a/arch/s390/kernel/nmi.c b/arch/s390/kernel/nmi.c
index a6daa5c5cdb0..7918fbea36bb 100644
--- a/arch/s390/kernel/nmi.c
+++ b/arch/s390/kernel/nmi.c
@@ -254,7 +254,7 @@ void notrace s390_do_machine_check(struct pt_regs *regs)
254 int umode; 254 int umode;
255 255
256 nmi_enter(); 256 nmi_enter();
257 kstat_cpu(smp_processor_id()).irqs[NMI_NMI]++; 257 inc_irq_stat(NMI_NMI);
258 mci = (struct mci *) &S390_lowcore.mcck_interruption_code; 258 mci = (struct mci *) &S390_lowcore.mcck_interruption_code;
259 mcck = &__get_cpu_var(cpu_mcck); 259 mcck = &__get_cpu_var(cpu_mcck);
260 umode = user_mode(regs); 260 umode = user_mode(regs);
diff --git a/arch/s390/kernel/perf_cpum_cf.c b/arch/s390/kernel/perf_cpum_cf.c
index c4e7269d4a09..86ec7447e1f5 100644
--- a/arch/s390/kernel/perf_cpum_cf.c
+++ b/arch/s390/kernel/perf_cpum_cf.c
@@ -229,7 +229,7 @@ static void cpumf_measurement_alert(struct ext_code ext_code,
229 if (!(alert & CPU_MF_INT_CF_MASK)) 229 if (!(alert & CPU_MF_INT_CF_MASK))
230 return; 230 return;
231 231
232 kstat_cpu(smp_processor_id()).irqs[EXTINT_CMC]++; 232 inc_irq_stat(IRQEXT_CMC);
233 cpuhw = &__get_cpu_var(cpu_hw_events); 233 cpuhw = &__get_cpu_var(cpu_hw_events);
234 234
235 /* Measurement alerts are shared and might happen when the PMU 235 /* Measurement alerts are shared and might happen when the PMU
diff --git a/arch/s390/kernel/runtime_instr.c b/arch/s390/kernel/runtime_instr.c
index 61066f6f71a5..077a99389b07 100644
--- a/arch/s390/kernel/runtime_instr.c
+++ b/arch/s390/kernel/runtime_instr.c
@@ -71,7 +71,7 @@ static void runtime_instr_int_handler(struct ext_code ext_code,
71 if (!(param32 & CPU_MF_INT_RI_MASK)) 71 if (!(param32 & CPU_MF_INT_RI_MASK))
72 return; 72 return;
73 73
74 kstat_cpu(smp_processor_id()).irqs[EXTINT_CMR]++; 74 inc_irq_stat(IRQEXT_CMR);
75 75
76 if (!current->thread.ri_cb) 76 if (!current->thread.ri_cb)
77 return; 77 return;
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 2568590973ad..a5360de85ec7 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -16,7 +16,7 @@
16#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt 16#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
17 17
18#include <linux/errno.h> 18#include <linux/errno.h>
19#include <linux/module.h> 19#include <linux/export.h>
20#include <linux/sched.h> 20#include <linux/sched.h>
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/memblock.h> 22#include <linux/memblock.h>
@@ -289,6 +289,7 @@ void machine_power_off(void)
289 * Dummy power off function. 289 * Dummy power off function.
290 */ 290 */
291void (*pm_power_off)(void) = machine_power_off; 291void (*pm_power_off)(void) = machine_power_off;
292EXPORT_SYMBOL_GPL(pm_power_off);
292 293
293static int __init early_parse_mem(char *p) 294static int __init early_parse_mem(char *p)
294{ 295{
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index ea431e551c6b..7433a2f9e5cc 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -433,9 +433,9 @@ static void do_ext_call_interrupt(struct ext_code ext_code,
433 433
434 cpu = smp_processor_id(); 434 cpu = smp_processor_id();
435 if (ext_code.code == 0x1202) 435 if (ext_code.code == 0x1202)
436 kstat_cpu(cpu).irqs[EXTINT_EXC]++; 436 inc_irq_stat(IRQEXT_EXC);
437 else 437 else
438 kstat_cpu(cpu).irqs[EXTINT_EMS]++; 438 inc_irq_stat(IRQEXT_EMS);
439 /* 439 /*
440 * handle bit signal external calls 440 * handle bit signal external calls
441 */ 441 */
@@ -623,9 +623,9 @@ static struct sclp_cpu_info *smp_get_cpu_info(void)
623 return info; 623 return info;
624} 624}
625 625
626static int __devinit smp_add_present_cpu(int cpu); 626static int __cpuinit smp_add_present_cpu(int cpu);
627 627
628static int __devinit __smp_rescan_cpus(struct sclp_cpu_info *info, 628static int __cpuinit __smp_rescan_cpus(struct sclp_cpu_info *info,
629 int sysfs_add) 629 int sysfs_add)
630{ 630{
631 struct pcpu *pcpu; 631 struct pcpu *pcpu;
@@ -709,6 +709,7 @@ static void __cpuinit smp_start_secondary(void *cpuvoid)
709 pfault_init(); 709 pfault_init();
710 notify_cpu_starting(smp_processor_id()); 710 notify_cpu_starting(smp_processor_id());
711 set_cpu_online(smp_processor_id(), true); 711 set_cpu_online(smp_processor_id(), true);
712 inc_irq_stat(CPU_RST);
712 local_irq_enable(); 713 local_irq_enable();
713 /* cpu_idle will call schedule for us */ 714 /* cpu_idle will call schedule for us */
714 cpu_idle(); 715 cpu_idle();
@@ -986,7 +987,7 @@ static int __cpuinit smp_cpu_notify(struct notifier_block *self,
986 return notifier_from_errno(err); 987 return notifier_from_errno(err);
987} 988}
988 989
989static int __devinit smp_add_present_cpu(int cpu) 990static int __cpuinit smp_add_present_cpu(int cpu)
990{ 991{
991 struct cpu *c = &pcpu_devices[cpu].cpu; 992 struct cpu *c = &pcpu_devices[cpu].cpu;
992 struct device *s = &c->dev; 993 struct device *s = &c->dev;
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index 48174850f3b0..6a6c61f94dd3 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -352,3 +352,4 @@ SYSCALL(sys_process_vm_readv,sys_process_vm_readv,compat_sys_process_vm_readv_wr
352SYSCALL(sys_process_vm_writev,sys_process_vm_writev,compat_sys_process_vm_writev_wrapper) 352SYSCALL(sys_process_vm_writev,sys_process_vm_writev,compat_sys_process_vm_writev_wrapper)
353SYSCALL(sys_ni_syscall,sys_s390_runtime_instr,sys_s390_runtime_instr_wrapper) 353SYSCALL(sys_ni_syscall,sys_s390_runtime_instr,sys_s390_runtime_instr_wrapper)
354SYSCALL(sys_kcmp,sys_kcmp,sys_kcmp_wrapper) 354SYSCALL(sys_kcmp,sys_kcmp,sys_kcmp_wrapper)
355SYSCALL(sys_finit_module,sys_finit_module,sys_finit_module_wrapper)
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index 7fcd690d42c7..a5f4f5a1d24b 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -63,7 +63,7 @@ static DEFINE_PER_CPU(struct clock_event_device, comparators);
63 */ 63 */
64unsigned long long notrace __kprobes sched_clock(void) 64unsigned long long notrace __kprobes sched_clock(void)
65{ 65{
66 return (get_clock_monotonic() * 125) >> 9; 66 return tod_to_ns(get_clock_monotonic());
67} 67}
68 68
69/* 69/*
@@ -168,7 +168,7 @@ static void clock_comparator_interrupt(struct ext_code ext_code,
168 unsigned int param32, 168 unsigned int param32,
169 unsigned long param64) 169 unsigned long param64)
170{ 170{
171 kstat_cpu(smp_processor_id()).irqs[EXTINT_CLK]++; 171 inc_irq_stat(IRQEXT_CLK);
172 if (S390_lowcore.clock_comparator == -1ULL) 172 if (S390_lowcore.clock_comparator == -1ULL)
173 set_clock_comparator(S390_lowcore.clock_comparator); 173 set_clock_comparator(S390_lowcore.clock_comparator);
174} 174}
@@ -179,7 +179,7 @@ static void stp_timing_alert(struct stp_irq_parm *);
179static void timing_alert_interrupt(struct ext_code ext_code, 179static void timing_alert_interrupt(struct ext_code ext_code,
180 unsigned int param32, unsigned long param64) 180 unsigned int param32, unsigned long param64)
181{ 181{
182 kstat_cpu(smp_processor_id()).irqs[EXTINT_TLA]++; 182 inc_irq_stat(IRQEXT_TLA);
183 if (param32 & 0x00c40000) 183 if (param32 & 0x00c40000)
184 etr_timing_alert((struct etr_irq_parm *) &param32); 184 etr_timing_alert((struct etr_irq_parm *) &param32);
185 if (param32 & 0x00038000) 185 if (param32 & 0x00038000)
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index f1aba87cceb8..4b2e3e317004 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -10,6 +10,7 @@
10#include <linux/bootmem.h> 10#include <linux/bootmem.h>
11#include <linux/cpuset.h> 11#include <linux/cpuset.h>
12#include <linux/device.h> 12#include <linux/device.h>
13#include <linux/export.h>
13#include <linux/kernel.h> 14#include <linux/kernel.h>
14#include <linux/sched.h> 15#include <linux/sched.h>
15#include <linux/init.h> 16#include <linux/init.h>
@@ -42,6 +43,7 @@ static struct mask_info socket_info;
42static struct mask_info book_info; 43static struct mask_info book_info;
43 44
44struct cpu_topology_s390 cpu_topology[NR_CPUS]; 45struct cpu_topology_s390 cpu_topology[NR_CPUS];
46EXPORT_SYMBOL_GPL(cpu_topology);
45 47
46static cpumask_t cpu_group_map(struct mask_info *info, unsigned int cpu) 48static cpumask_t cpu_group_map(struct mask_info *info, unsigned int cpu)
47{ 49{
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index c30615e605ac..82c481ddef76 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -408,7 +408,7 @@ int kvm_s390_handle_wait(struct kvm_vcpu *vcpu)
408 return 0; 408 return 0;
409 } 409 }
410 410
411 sltime = ((vcpu->arch.sie_block->ckc - now)*125)>>9; 411 sltime = tod_to_ns(vcpu->arch.sie_block->ckc - now);
412 412
413 hrtimer_start(&vcpu->arch.ckc_timer, ktime_set (0, sltime) , HRTIMER_MODE_REL); 413 hrtimer_start(&vcpu->arch.ckc_timer, ktime_set (0, sltime) , HRTIMER_MODE_REL);
414 VCPU_EVENT(vcpu, 5, "enabled wait via clock comparator: %llx ns", sltime); 414 VCPU_EVENT(vcpu, 5, "enabled wait via clock comparator: %llx ns", sltime);
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index c9011bfaabbe..f090e819bf71 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -613,7 +613,9 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
613 kvm_s390_deliver_pending_interrupts(vcpu); 613 kvm_s390_deliver_pending_interrupts(vcpu);
614 614
615 vcpu->arch.sie_block->icptcode = 0; 615 vcpu->arch.sie_block->icptcode = 0;
616 preempt_disable();
616 kvm_guest_enter(); 617 kvm_guest_enter();
618 preempt_enable();
617 VCPU_EVENT(vcpu, 6, "entering sie flags %x", 619 VCPU_EVENT(vcpu, 6, "entering sie flags %x",
618 atomic_read(&vcpu->arch.sie_block->cpuflags)); 620 atomic_read(&vcpu->arch.sie_block->cpuflags));
619 trace_kvm_s390_sie_enter(vcpu, 621 trace_kvm_s390_sie_enter(vcpu,
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index 42601d6e166f..2fb9e63b8fc4 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -569,7 +569,7 @@ static void pfault_interrupt(struct ext_code ext_code,
569 subcode = ext_code.subcode; 569 subcode = ext_code.subcode;
570 if ((subcode & 0xff00) != __SUBCODE_MASK) 570 if ((subcode & 0xff00) != __SUBCODE_MASK)
571 return; 571 return;
572 kstat_cpu(smp_processor_id()).irqs[EXTINT_PFL]++; 572 inc_irq_stat(IRQEXT_PFL);
573 /* Get the token (= pid of the affected task). */ 573 /* Get the token (= pid of the affected task). */
574 pid = sizeof(void *) == 4 ? param32 : param64; 574 pid = sizeof(void *) == 4 ? param32 : param64;
575 rcu_read_lock(); 575 rcu_read_lock();
diff --git a/arch/s390/oprofile/hwsampler.c b/arch/s390/oprofile/hwsampler.c
index 0cb385da202c..b5b2916895e0 100644
--- a/arch/s390/oprofile/hwsampler.c
+++ b/arch/s390/oprofile/hwsampler.c
@@ -233,7 +233,7 @@ static void hws_ext_handler(struct ext_code ext_code,
233 if (!(param32 & CPU_MF_INT_SF_MASK)) 233 if (!(param32 & CPU_MF_INT_SF_MASK))
234 return; 234 return;
235 235
236 kstat_cpu(smp_processor_id()).irqs[EXTINT_CMS]++; 236 inc_irq_stat(IRQEXT_CMS);
237 atomic_xchg(&cb->ext_params, atomic_read(&cb->ext_params) | param32); 237 atomic_xchg(&cb->ext_params, atomic_read(&cb->ext_params) | param32);
238 238
239 if (hws_wq) 239 if (hws_wq)
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 8fa416b8775f..60e0372545d2 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -160,35 +160,6 @@ int pci_proc_domain(struct pci_bus *bus)
160} 160}
161EXPORT_SYMBOL_GPL(pci_proc_domain); 161EXPORT_SYMBOL_GPL(pci_proc_domain);
162 162
163/* Store PCI function information block */
164static int zpci_store_fib(struct zpci_dev *zdev, u8 *fc)
165{
166 struct zpci_fib *fib;
167 u8 status, cc;
168
169 fib = (void *) get_zeroed_page(GFP_KERNEL);
170 if (!fib)
171 return -ENOMEM;
172
173 do {
174 cc = __stpcifc(zdev->fh, 0, fib, &status);
175 if (cc == 2) {
176 msleep(ZPCI_INSN_BUSY_DELAY);
177 memset(fib, 0, PAGE_SIZE);
178 }
179 } while (cc == 2);
180
181 if (cc)
182 pr_err_once("%s: cc: %u status: %u\n",
183 __func__, cc, status);
184
185 /* Return PCI function controls */
186 *fc = fib->fc;
187
188 free_page((unsigned long) fib);
189 return (cc) ? -EIO : 0;
190}
191
192/* Modify PCI: Register adapter interruptions */ 163/* Modify PCI: Register adapter interruptions */
193static int zpci_register_airq(struct zpci_dev *zdev, unsigned int aisb, 164static int zpci_register_airq(struct zpci_dev *zdev, unsigned int aisb,
194 u64 aibv) 165 u64 aibv)
@@ -385,7 +356,7 @@ unsigned int probe_irq_mask(unsigned long val)
385} 356}
386EXPORT_SYMBOL_GPL(probe_irq_mask); 357EXPORT_SYMBOL_GPL(probe_irq_mask);
387 358
388void __devinit pcibios_fixup_bus(struct pci_bus *bus) 359void pcibios_fixup_bus(struct pci_bus *bus)
389{ 360{
390} 361}
391 362
@@ -469,7 +440,7 @@ static void zpci_irq_handler(void *dont, void *need)
469 int rescan = 0, max = aisb_max; 440 int rescan = 0, max = aisb_max;
470 struct zdev_irq_map *imap; 441 struct zdev_irq_map *imap;
471 442
472 kstat_cpu(smp_processor_id()).irqs[IOINT_PCI]++; 443 inc_irq_stat(IRQIO_PCI);
473 sbit = start; 444 sbit = start;
474 445
475scan: 446scan:
@@ -481,7 +452,7 @@ scan:
481 /* find vector bit */ 452 /* find vector bit */
482 imap = bucket->imap[sbit]; 453 imap = bucket->imap[sbit];
483 for_each_set_bit_left(mbit, &imap->aibv, imap->msi_vecs) { 454 for_each_set_bit_left(mbit, &imap->aibv, imap->msi_vecs) {
484 kstat_cpu(smp_processor_id()).irqs[IOINT_MSI]++; 455 inc_irq_stat(IRQIO_MSI);
485 clear_bit(63 - mbit, &imap->aibv); 456 clear_bit(63 - mbit, &imap->aibv);
486 457
487 spin_lock(&imap->lock); 458 spin_lock(&imap->lock);
diff --git a/arch/s390/pci/pci_dma.c b/arch/s390/pci/pci_dma.c
index 6138468b420f..a547419907c3 100644
--- a/arch/s390/pci/pci_dma.c
+++ b/arch/s390/pci/pci_dma.c
@@ -13,8 +13,6 @@
13#include <linux/pci.h> 13#include <linux/pci.h>
14#include <asm/pci_dma.h> 14#include <asm/pci_dma.h>
15 15
16static enum zpci_ioat_dtype zpci_ioat_dt = ZPCI_IOTA_RTTO;
17
18static struct kmem_cache *dma_region_table_cache; 16static struct kmem_cache *dma_region_table_cache;
19static struct kmem_cache *dma_page_table_cache; 17static struct kmem_cache *dma_page_table_cache;
20 18
diff --git a/arch/score/mm/cache.c b/arch/score/mm/cache.c
index b25e95743600..f85ec1a7c88e 100644
--- a/arch/score/mm/cache.c
+++ b/arch/score/mm/cache.c
@@ -113,7 +113,7 @@ static inline void setup_protection_map(void)
113 protection_map[15] = PAGE_SHARED; 113 protection_map[15] = PAGE_SHARED;
114} 114}
115 115
116void __devinit cpu_cache_init(void) 116void cpu_cache_init(void)
117{ 117{
118 setup_protection_map(); 118 setup_protection_map();
119} 119}
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index 3fede4556c91..a0fa5791cd44 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -70,6 +70,16 @@
70 * OFF-ON : MMC 70 * OFF-ON : MMC
71 */ 71 */
72 72
73/*
74 * FSI - DA7210
75 *
76 * it needs amixer settings for playing
77 *
78 * amixer set 'HeadPhone' 80
79 * amixer set 'Out Mixer Left DAC Left' on
80 * amixer set 'Out Mixer Right DAC Right' on
81 */
82
73/* Heartbeat */ 83/* Heartbeat */
74static unsigned char led_pos[] = { 0, 1, 2, 3 }; 84static unsigned char led_pos[] = { 0, 1, 2, 3 };
75 85
diff --git a/arch/sh/drivers/pci/fixups-dreamcast.c b/arch/sh/drivers/pci/fixups-dreamcast.c
index a5fe1b54c952..d6cde700e316 100644
--- a/arch/sh/drivers/pci/fixups-dreamcast.c
+++ b/arch/sh/drivers/pci/fixups-dreamcast.c
@@ -28,7 +28,7 @@
28#include <asm/irq.h> 28#include <asm/irq.h>
29#include <mach/pci.h> 29#include <mach/pci.h>
30 30
31static void __devinit gapspci_fixup_resources(struct pci_dev *dev) 31static void gapspci_fixup_resources(struct pci_dev *dev)
32{ 32{
33 struct pci_channel *p = dev->sysdata; 33 struct pci_channel *p = dev->sysdata;
34 34
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index 81e5dafed3e4..102f5d58b037 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -32,7 +32,7 @@ static struct pci_channel *hose_head, **hose_tail = &hose_head;
32 32
33static int pci_initialized; 33static int pci_initialized;
34 34
35static void __devinit pcibios_scanbus(struct pci_channel *hose) 35static void pcibios_scanbus(struct pci_channel *hose)
36{ 36{
37 static int next_busno; 37 static int next_busno;
38 static int need_domain_info; 38 static int need_domain_info;
@@ -82,7 +82,7 @@ static void __devinit pcibios_scanbus(struct pci_channel *hose)
82DEFINE_RAW_SPINLOCK(pci_config_lock); 82DEFINE_RAW_SPINLOCK(pci_config_lock);
83static DEFINE_MUTEX(pci_scan_mutex); 83static DEFINE_MUTEX(pci_scan_mutex);
84 84
85int __devinit register_pci_controller(struct pci_channel *hose) 85int register_pci_controller(struct pci_channel *hose)
86{ 86{
87 int i; 87 int i;
88 88
@@ -156,7 +156,7 @@ subsys_initcall(pcibios_init);
156 * Called after each bus is probed, but before its children 156 * Called after each bus is probed, but before its children
157 * are examined. 157 * are examined.
158 */ 158 */
159void __devinit pcibios_fixup_bus(struct pci_bus *bus) 159void pcibios_fixup_bus(struct pci_bus *bus)
160{ 160{
161} 161}
162 162
diff --git a/arch/sh/drivers/pci/pcie-sh7786.c b/arch/sh/drivers/pci/pcie-sh7786.c
index 9e702f2f8045..c2c85f6cd738 100644
--- a/arch/sh/drivers/pci/pcie-sh7786.c
+++ b/arch/sh/drivers/pci/pcie-sh7786.c
@@ -132,7 +132,7 @@ static struct clk fixed_pciexclkp = {
132 .rate = 100000000, /* 100 MHz reference clock */ 132 .rate = 100000000, /* 100 MHz reference clock */
133}; 133};
134 134
135static void __devinit sh7786_pci_fixup(struct pci_dev *dev) 135static void sh7786_pci_fixup(struct pci_dev *dev)
136{ 136{
137 /* 137 /*
138 * Prevent enumeration of root complex resources. 138 * Prevent enumeration of root complex resources.
diff --git a/arch/sh/include/asm/elf.h b/arch/sh/include/asm/elf.h
index 37924afa8d8a..bf9f44f17c29 100644
--- a/arch/sh/include/asm/elf.h
+++ b/arch/sh/include/asm/elf.h
@@ -203,9 +203,9 @@ extern void __kernel_vsyscall;
203 if (vdso_enabled) \ 203 if (vdso_enabled) \
204 NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_BASE); \ 204 NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_BASE); \
205 else \ 205 else \
206 NEW_AUX_ENT(AT_IGNORE, 0); 206 NEW_AUX_ENT(AT_IGNORE, 0)
207#else 207#else
208#define VSYSCALL_AUX_ENT 208#define VSYSCALL_AUX_ENT NEW_AUX_ENT(AT_IGNORE, 0)
209#endif /* CONFIG_VSYSCALL */ 209#endif /* CONFIG_VSYSCALL */
210 210
211#ifdef CONFIG_SH_FPU 211#ifdef CONFIG_SH_FPU
diff --git a/arch/sh/include/asm/processor_32.h b/arch/sh/include/asm/processor_32.h
index b1320d55ca30..e699a12cdcca 100644
--- a/arch/sh/include/asm/processor_32.h
+++ b/arch/sh/include/asm/processor_32.h
@@ -39,7 +39,7 @@
39/* This decides where the kernel will search for a free chunk of vm 39/* This decides where the kernel will search for a free chunk of vm
40 * space during mmap's. 40 * space during mmap's.
41 */ 41 */
42#define TASK_UNMAPPED_BASE (TASK_SIZE / 3) 42#define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE / 3)
43 43
44/* 44/*
45 * Bit of SR register 45 * Bit of SR register
diff --git a/arch/sh/include/asm/processor_64.h b/arch/sh/include/asm/processor_64.h
index 1ee8946f0952..1cc7d3197143 100644
--- a/arch/sh/include/asm/processor_64.h
+++ b/arch/sh/include/asm/processor_64.h
@@ -47,7 +47,7 @@ pc; })
47/* This decides where the kernel will search for a free chunk of vm 47/* This decides where the kernel will search for a free chunk of vm
48 * space during mmap's. 48 * space during mmap's.
49 */ 49 */
50#define TASK_UNMAPPED_BASE (TASK_SIZE / 3) 50#define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE / 3)
51 51
52/* 52/*
53 * Bit of SR register 53 * Bit of SR register
diff --git a/arch/sh/include/uapi/asm/unistd_32.h b/arch/sh/include/uapi/asm/unistd_32.h
index 9e465f246dc1..d13a1d623736 100644
--- a/arch/sh/include/uapi/asm/unistd_32.h
+++ b/arch/sh/include/uapi/asm/unistd_32.h
@@ -379,7 +379,8 @@
379#define __NR_process_vm_readv 365 379#define __NR_process_vm_readv 365
380#define __NR_process_vm_writev 366 380#define __NR_process_vm_writev 366
381#define __NR_kcmp 367 381#define __NR_kcmp 367
382#define __NR_finit_module 368
382 383
383#define NR_syscalls 368 384#define NR_syscalls 369
384 385
385#endif /* __ASM_SH_UNISTD_32_H */ 386#endif /* __ASM_SH_UNISTD_32_H */
diff --git a/arch/sh/include/uapi/asm/unistd_64.h b/arch/sh/include/uapi/asm/unistd_64.h
index 8e3a2edd284e..e6820c86e8c7 100644
--- a/arch/sh/include/uapi/asm/unistd_64.h
+++ b/arch/sh/include/uapi/asm/unistd_64.h
@@ -399,7 +399,8 @@
399#define __NR_process_vm_readv 376 399#define __NR_process_vm_readv 376
400#define __NR_process_vm_writev 377 400#define __NR_process_vm_writev 377
401#define __NR_kcmp 378 401#define __NR_kcmp 378
402#define __NR_finit_module 379
402 403
403#define NR_syscalls 379 404#define NR_syscalls 380
404 405
405#endif /* __ASM_SH_UNISTD_64_H */ 406#endif /* __ASM_SH_UNISTD_64_H */
diff --git a/arch/sh/kernel/syscalls_32.S b/arch/sh/kernel/syscalls_32.S
index fe97ae5e56f1..734234be2f01 100644
--- a/arch/sh/kernel/syscalls_32.S
+++ b/arch/sh/kernel/syscalls_32.S
@@ -385,3 +385,4 @@ ENTRY(sys_call_table)
385 .long sys_process_vm_readv /* 365 */ 385 .long sys_process_vm_readv /* 365 */
386 .long sys_process_vm_writev 386 .long sys_process_vm_writev
387 .long sys_kcmp 387 .long sys_kcmp
388 .long sys_finit_module
diff --git a/arch/sh/kernel/syscalls_64.S b/arch/sh/kernel/syscalls_64.S
index 5c7b1c67bdc1..579fcb9a896b 100644
--- a/arch/sh/kernel/syscalls_64.S
+++ b/arch/sh/kernel/syscalls_64.S
@@ -405,3 +405,4 @@ sys_call_table:
405 .long sys_process_vm_readv 405 .long sys_process_vm_readv
406 .long sys_process_vm_writev 406 .long sys_process_vm_writev
407 .long sys_kcmp 407 .long sys_kcmp
408 .long sys_finit_module
diff --git a/arch/sh/lib/mcount.S b/arch/sh/lib/mcount.S
index 60164e65d665..52aa2011d753 100644
--- a/arch/sh/lib/mcount.S
+++ b/arch/sh/lib/mcount.S
@@ -294,6 +294,8 @@ stack_panic:
294 .align 2 294 .align 2
295.L_init_thread_union: 295.L_init_thread_union:
296 .long init_thread_union 296 .long init_thread_union
297.L_ebss:
298 .long __bss_stop
297.Lpanic: 299.Lpanic:
298 .long panic 300 .long panic
299.Lpanic_s: 301.Lpanic_s:
diff --git a/arch/sparc/include/asm/parport.h b/arch/sparc/include/asm/parport.h
index cb33608cc68f..c55291e5b83e 100644
--- a/arch/sparc/include/asm/parport.h
+++ b/arch/sparc/include/asm/parport.h
@@ -103,7 +103,7 @@ static inline unsigned int get_dma_residue(unsigned int dmanr)
103 return ebus_dma_residue(&sparc_ebus_dmas[dmanr].info); 103 return ebus_dma_residue(&sparc_ebus_dmas[dmanr].info);
104} 104}
105 105
106static int __devinit ecpp_probe(struct platform_device *op) 106static int ecpp_probe(struct platform_device *op)
107{ 107{
108 unsigned long base = op->resource[0].start; 108 unsigned long base = op->resource[0].start;
109 unsigned long config = op->resource[1].start; 109 unsigned long config = op->resource[1].start;
@@ -192,7 +192,7 @@ out_err:
192 return err; 192 return err;
193} 193}
194 194
195static int __devexit ecpp_remove(struct platform_device *op) 195static int ecpp_remove(struct platform_device *op)
196{ 196{
197 struct parport *p = dev_get_drvdata(&op->dev); 197 struct parport *p = dev_get_drvdata(&op->dev);
198 int slot = p->dma; 198 int slot = p->dma;
@@ -242,7 +242,7 @@ static struct platform_driver ecpp_driver = {
242 .of_match_table = ecpp_match, 242 .of_match_table = ecpp_match,
243 }, 243 },
244 .probe = ecpp_probe, 244 .probe = ecpp_probe,
245 .remove = __devexit_p(ecpp_remove), 245 .remove = ecpp_remove,
246}; 246};
247 247
248static int parport_pc_find_nonpci_ports(int autoirq, int autodma) 248static int parport_pc_find_nonpci_ports(int autoirq, int autodma)
diff --git a/arch/sparc/include/asm/timer_64.h b/arch/sparc/include/asm/timer_64.h
index ef3c3682debf..01197d8215c4 100644
--- a/arch/sparc/include/asm/timer_64.h
+++ b/arch/sparc/include/asm/timer_64.h
@@ -24,7 +24,7 @@ struct sparc64_tick_ops {
24extern struct sparc64_tick_ops *tick_ops; 24extern struct sparc64_tick_ops *tick_ops;
25 25
26extern unsigned long sparc64_get_clock_tick(unsigned int cpu); 26extern unsigned long sparc64_get_clock_tick(unsigned int cpu);
27extern void __devinit setup_sparc64_timer(void); 27extern void setup_sparc64_timer(void);
28extern void __init time_init(void); 28extern void __init time_init(void);
29 29
30#endif /* _SPARC64_TIMER_H */ 30#endif /* _SPARC64_TIMER_H */
diff --git a/arch/sparc/include/uapi/asm/unistd.h b/arch/sparc/include/uapi/asm/unistd.h
index cac719d1bc5c..62ced589bcf7 100644
--- a/arch/sparc/include/uapi/asm/unistd.h
+++ b/arch/sparc/include/uapi/asm/unistd.h
@@ -407,8 +407,9 @@
407#define __NR_process_vm_writev 339 407#define __NR_process_vm_writev 339
408#define __NR_kern_features 340 408#define __NR_kern_features 340
409#define __NR_kcmp 341 409#define __NR_kcmp 341
410#define __NR_finit_module 342
410 411
411#define NR_syscalls 342 412#define NR_syscalls 343
412 413
413/* Bitmask values returned from kern_features system call. */ 414/* Bitmask values returned from kern_features system call. */
414#define KERN_FEATURE_MIXED_MODE_STACK 0x00000001 415#define KERN_FEATURE_MIXED_MODE_STACK 0x00000001
diff --git a/arch/sparc/kernel/apc.c b/arch/sparc/kernel/apc.c
index 812e10bbb0b3..348fa1aeabce 100644
--- a/arch/sparc/kernel/apc.c
+++ b/arch/sparc/kernel/apc.c
@@ -31,7 +31,7 @@
31#define APC_DEVNAME "apc" 31#define APC_DEVNAME "apc"
32 32
33static u8 __iomem *regs; 33static u8 __iomem *regs;
34static int apc_no_idle __devinitdata = 0; 34static int apc_no_idle = 0;
35 35
36#define apc_readb(offs) (sbus_readb(regs+offs)) 36#define apc_readb(offs) (sbus_readb(regs+offs))
37#define apc_writeb(val, offs) (sbus_writeb(val, regs+offs)) 37#define apc_writeb(val, offs) (sbus_writeb(val, regs+offs))
@@ -138,7 +138,7 @@ static const struct file_operations apc_fops = {
138 138
139static struct miscdevice apc_miscdev = { APC_MINOR, APC_DEVNAME, &apc_fops }; 139static struct miscdevice apc_miscdev = { APC_MINOR, APC_DEVNAME, &apc_fops };
140 140
141static int __devinit apc_probe(struct platform_device *op) 141static int apc_probe(struct platform_device *op)
142{ 142{
143 int err; 143 int err;
144 144
diff --git a/arch/sparc/kernel/auxio_64.c b/arch/sparc/kernel/auxio_64.c
index 773091ac71a3..86e55778e4af 100644
--- a/arch/sparc/kernel/auxio_64.c
+++ b/arch/sparc/kernel/auxio_64.c
@@ -102,7 +102,7 @@ static const struct of_device_id auxio_match[] = {
102 102
103MODULE_DEVICE_TABLE(of, auxio_match); 103MODULE_DEVICE_TABLE(of, auxio_match);
104 104
105static int __devinit auxio_probe(struct platform_device *dev) 105static int auxio_probe(struct platform_device *dev)
106{ 106{
107 struct device_node *dp = dev->dev.of_node; 107 struct device_node *dp = dev->dev.of_node;
108 unsigned long size; 108 unsigned long size;
diff --git a/arch/sparc/kernel/central.c b/arch/sparc/kernel/central.c
index 9708851a8b9f..052b5a44318f 100644
--- a/arch/sparc/kernel/central.c
+++ b/arch/sparc/kernel/central.c
@@ -33,7 +33,7 @@ struct fhc {
33 struct platform_device leds_pdev; 33 struct platform_device leds_pdev;
34}; 34};
35 35
36static int __devinit clock_board_calc_nslots(struct clock_board *p) 36static int clock_board_calc_nslots(struct clock_board *p)
37{ 37{
38 u8 reg = upa_readb(p->clock_regs + CLOCK_STAT1) & 0xc0; 38 u8 reg = upa_readb(p->clock_regs + CLOCK_STAT1) & 0xc0;
39 39
@@ -60,7 +60,7 @@ static int __devinit clock_board_calc_nslots(struct clock_board *p)
60 } 60 }
61} 61}
62 62
63static int __devinit clock_board_probe(struct platform_device *op) 63static int clock_board_probe(struct platform_device *op)
64{ 64{
65 struct clock_board *p = kzalloc(sizeof(*p), GFP_KERNEL); 65 struct clock_board *p = kzalloc(sizeof(*p), GFP_KERNEL);
66 int err = -ENOMEM; 66 int err = -ENOMEM;
@@ -157,7 +157,7 @@ static struct platform_driver clock_board_driver = {
157 }, 157 },
158}; 158};
159 159
160static int __devinit fhc_probe(struct platform_device *op) 160static int fhc_probe(struct platform_device *op)
161{ 161{
162 struct fhc *p = kzalloc(sizeof(*p), GFP_KERNEL); 162 struct fhc *p = kzalloc(sizeof(*p), GFP_KERNEL);
163 int err = -ENOMEM; 163 int err = -ENOMEM;
diff --git a/arch/sparc/kernel/chmc.c b/arch/sparc/kernel/chmc.c
index 5f450260981d..dbb210d74e21 100644
--- a/arch/sparc/kernel/chmc.c
+++ b/arch/sparc/kernel/chmc.c
@@ -336,9 +336,9 @@ static int jbusmc_print_dimm(int syndrome_code,
336 return 0; 336 return 0;
337} 337}
338 338
339static u64 __devinit jbusmc_dimm_group_size(u64 base, 339static u64 jbusmc_dimm_group_size(u64 base,
340 const struct linux_prom64_registers *mem_regs, 340 const struct linux_prom64_registers *mem_regs,
341 int num_mem_regs) 341 int num_mem_regs)
342{ 342{
343 u64 max = base + (8UL * 1024 * 1024 * 1024); 343 u64 max = base + (8UL * 1024 * 1024 * 1024);
344 u64 max_seen = base; 344 u64 max_seen = base;
@@ -363,10 +363,10 @@ static u64 __devinit jbusmc_dimm_group_size(u64 base,
363 return max_seen - base; 363 return max_seen - base;
364} 364}
365 365
366static void __devinit jbusmc_construct_one_dimm_group(struct jbusmc *p, 366static void jbusmc_construct_one_dimm_group(struct jbusmc *p,
367 unsigned long index, 367 unsigned long index,
368 const struct linux_prom64_registers *mem_regs, 368 const struct linux_prom64_registers *mem_regs,
369 int num_mem_regs) 369 int num_mem_regs)
370{ 370{
371 struct jbusmc_dimm_group *dp = &p->dimm_groups[index]; 371 struct jbusmc_dimm_group *dp = &p->dimm_groups[index];
372 372
@@ -378,9 +378,9 @@ static void __devinit jbusmc_construct_one_dimm_group(struct jbusmc *p,
378 dp->size = jbusmc_dimm_group_size(dp->base_addr, mem_regs, num_mem_regs); 378 dp->size = jbusmc_dimm_group_size(dp->base_addr, mem_regs, num_mem_regs);
379} 379}
380 380
381static void __devinit jbusmc_construct_dimm_groups(struct jbusmc *p, 381static void jbusmc_construct_dimm_groups(struct jbusmc *p,
382 const struct linux_prom64_registers *mem_regs, 382 const struct linux_prom64_registers *mem_regs,
383 int num_mem_regs) 383 int num_mem_regs)
384{ 384{
385 if (p->mc_reg_1 & JB_MC_REG1_DIMM1_BANK0) { 385 if (p->mc_reg_1 & JB_MC_REG1_DIMM1_BANK0) {
386 jbusmc_construct_one_dimm_group(p, 0, mem_regs, num_mem_regs); 386 jbusmc_construct_one_dimm_group(p, 0, mem_regs, num_mem_regs);
@@ -392,7 +392,7 @@ static void __devinit jbusmc_construct_dimm_groups(struct jbusmc *p,
392 } 392 }
393} 393}
394 394
395static int __devinit jbusmc_probe(struct platform_device *op) 395static int jbusmc_probe(struct platform_device *op)
396{ 396{
397 const struct linux_prom64_registers *mem_regs; 397 const struct linux_prom64_registers *mem_regs;
398 struct device_node *mem_node; 398 struct device_node *mem_node;
@@ -689,7 +689,7 @@ static void chmc_fetch_decode_regs(struct chmc *p)
689 chmc_read_mcreg(p, CHMCTRL_DECODE4)); 689 chmc_read_mcreg(p, CHMCTRL_DECODE4));
690} 690}
691 691
692static int __devinit chmc_probe(struct platform_device *op) 692static int chmc_probe(struct platform_device *op)
693{ 693{
694 struct device_node *dp = op->dev.of_node; 694 struct device_node *dp = op->dev.of_node;
695 unsigned long ver; 695 unsigned long ver;
@@ -763,7 +763,7 @@ out_free:
763 goto out; 763 goto out;
764} 764}
765 765
766static int __devinit us3mc_probe(struct platform_device *op) 766static int us3mc_probe(struct platform_device *op)
767{ 767{
768 if (mc_type == MC_TYPE_SAFARI) 768 if (mc_type == MC_TYPE_SAFARI)
769 return chmc_probe(op); 769 return chmc_probe(op);
@@ -772,21 +772,21 @@ static int __devinit us3mc_probe(struct platform_device *op)
772 return -ENODEV; 772 return -ENODEV;
773} 773}
774 774
775static void __devexit chmc_destroy(struct platform_device *op, struct chmc *p) 775static void chmc_destroy(struct platform_device *op, struct chmc *p)
776{ 776{
777 list_del(&p->list); 777 list_del(&p->list);
778 of_iounmap(&op->resource[0], p->regs, 0x48); 778 of_iounmap(&op->resource[0], p->regs, 0x48);
779 kfree(p); 779 kfree(p);
780} 780}
781 781
782static void __devexit jbusmc_destroy(struct platform_device *op, struct jbusmc *p) 782static void jbusmc_destroy(struct platform_device *op, struct jbusmc *p)
783{ 783{
784 mc_list_del(&p->list); 784 mc_list_del(&p->list);
785 of_iounmap(&op->resource[0], p->regs, JBUSMC_REGS_SIZE); 785 of_iounmap(&op->resource[0], p->regs, JBUSMC_REGS_SIZE);
786 kfree(p); 786 kfree(p);
787} 787}
788 788
789static int __devexit us3mc_remove(struct platform_device *op) 789static int us3mc_remove(struct platform_device *op)
790{ 790{
791 void *p = dev_get_drvdata(&op->dev); 791 void *p = dev_get_drvdata(&op->dev);
792 792
@@ -814,7 +814,7 @@ static struct platform_driver us3mc_driver = {
814 .of_match_table = us3mc_match, 814 .of_match_table = us3mc_match,
815 }, 815 },
816 .probe = us3mc_probe, 816 .probe = us3mc_probe,
817 .remove = __devexit_p(us3mc_remove), 817 .remove = us3mc_remove,
818}; 818};
819 819
820static inline bool us3mc_platform(void) 820static inline bool us3mc_platform(void)
diff --git a/arch/sparc/kernel/ds.c b/arch/sparc/kernel/ds.c
index f09257c86107..75bb608c423e 100644
--- a/arch/sparc/kernel/ds.c
+++ b/arch/sparc/kernel/ds.c
@@ -29,7 +29,7 @@
29#define DRV_MODULE_VERSION "1.0" 29#define DRV_MODULE_VERSION "1.0"
30#define DRV_MODULE_RELDATE "Jul 11, 2007" 30#define DRV_MODULE_RELDATE "Jul 11, 2007"
31 31
32static char version[] __devinitdata = 32static char version[] =
33 DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; 33 DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
34MODULE_AUTHOR("David S. Miller (davem@davemloft.net)"); 34MODULE_AUTHOR("David S. Miller (davem@davemloft.net)");
35MODULE_DESCRIPTION("Sun LDOM domain services driver"); 35MODULE_DESCRIPTION("Sun LDOM domain services driver");
@@ -1146,8 +1146,7 @@ static void ds_event(void *arg, int event)
1146 spin_unlock_irqrestore(&ds_lock, flags); 1146 spin_unlock_irqrestore(&ds_lock, flags);
1147} 1147}
1148 1148
1149static int __devinit ds_probe(struct vio_dev *vdev, 1149static int ds_probe(struct vio_dev *vdev, const struct vio_device_id *id)
1150 const struct vio_device_id *id)
1151{ 1150{
1152 static int ds_version_printed; 1151 static int ds_version_printed;
1153 struct ldc_channel_config ds_cfg = { 1152 struct ldc_channel_config ds_cfg = {
diff --git a/arch/sparc/kernel/ldc.c b/arch/sparc/kernel/ldc.c
index 81d92fc9983b..9fcc6b4e93b3 100644
--- a/arch/sparc/kernel/ldc.c
+++ b/arch/sparc/kernel/ldc.c
@@ -27,7 +27,7 @@
27#define DRV_MODULE_VERSION "1.1" 27#define DRV_MODULE_VERSION "1.1"
28#define DRV_MODULE_RELDATE "July 22, 2008" 28#define DRV_MODULE_RELDATE "July 22, 2008"
29 29
30static char version[] __devinitdata = 30static char version[] =
31 DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; 31 DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
32#define LDC_PACKET_SIZE 64 32#define LDC_PACKET_SIZE 64
33 33
diff --git a/arch/sparc/kernel/leon_pci.c b/arch/sparc/kernel/leon_pci.c
index fc0521161568..852dc8430528 100644
--- a/arch/sparc/kernel/leon_pci.c
+++ b/arch/sparc/kernel/leon_pci.c
@@ -43,7 +43,7 @@ void leon_pci_init(struct platform_device *ofdev, struct leon_pci_info *info)
43 } 43 }
44} 44}
45 45
46void __devinit pcibios_fixup_bus(struct pci_bus *pbus) 46void pcibios_fixup_bus(struct pci_bus *pbus)
47{ 47{
48 struct pci_dev *dev; 48 struct pci_dev *dev;
49 int i, has_io, has_mem; 49 int i, has_io, has_mem;
diff --git a/arch/sparc/kernel/leon_pci_grpci2.c b/arch/sparc/kernel/leon_pci_grpci2.c
index b1bc38853a3d..fc4320886a3a 100644
--- a/arch/sparc/kernel/leon_pci_grpci2.c
+++ b/arch/sparc/kernel/leon_pci_grpci2.c
@@ -668,7 +668,7 @@ static irqreturn_t grpci2_err_interrupt(int irq, void *arg)
668 return IRQ_HANDLED; 668 return IRQ_HANDLED;
669} 669}
670 670
671static int __devinit grpci2_of_probe(struct platform_device *ofdev) 671static int grpci2_of_probe(struct platform_device *ofdev)
672{ 672{
673 struct grpci2_regs *regs; 673 struct grpci2_regs *regs;
674 struct grpci2_priv *priv; 674 struct grpci2_priv *priv;
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index 75b31bcdeadf..baf4366e2d6a 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -356,7 +356,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
356 return dev; 356 return dev;
357} 357}
358 358
359static void __devinit apb_calc_first_last(u8 map, u32 *first_p, u32 *last_p) 359static void apb_calc_first_last(u8 map, u32 *first_p, u32 *last_p)
360{ 360{
361 u32 idx, first, last; 361 u32 idx, first, last;
362 362
@@ -378,9 +378,9 @@ static void __devinit apb_calc_first_last(u8 map, u32 *first_p, u32 *last_p)
378/* Cook up fake bus resources for SUNW,simba PCI bridges which lack 378/* Cook up fake bus resources for SUNW,simba PCI bridges which lack
379 * a proper 'ranges' property. 379 * a proper 'ranges' property.
380 */ 380 */
381static void __devinit apb_fake_ranges(struct pci_dev *dev, 381static void apb_fake_ranges(struct pci_dev *dev,
382 struct pci_bus *bus, 382 struct pci_bus *bus,
383 struct pci_pbm_info *pbm) 383 struct pci_pbm_info *pbm)
384{ 384{
385 struct pci_bus_region region; 385 struct pci_bus_region region;
386 struct resource *res; 386 struct resource *res;
@@ -404,15 +404,15 @@ static void __devinit apb_fake_ranges(struct pci_dev *dev,
404 pcibios_bus_to_resource(dev, res, &region); 404 pcibios_bus_to_resource(dev, res, &region);
405} 405}
406 406
407static void __devinit pci_of_scan_bus(struct pci_pbm_info *pbm, 407static void pci_of_scan_bus(struct pci_pbm_info *pbm,
408 struct device_node *node, 408 struct device_node *node,
409 struct pci_bus *bus); 409 struct pci_bus *bus);
410 410
411#define GET_64BIT(prop, i) ((((u64) (prop)[(i)]) << 32) | (prop)[(i)+1]) 411#define GET_64BIT(prop, i) ((((u64) (prop)[(i)]) << 32) | (prop)[(i)+1])
412 412
413static void __devinit of_scan_pci_bridge(struct pci_pbm_info *pbm, 413static void of_scan_pci_bridge(struct pci_pbm_info *pbm,
414 struct device_node *node, 414 struct device_node *node,
415 struct pci_dev *dev) 415 struct pci_dev *dev)
416{ 416{
417 struct pci_bus *bus; 417 struct pci_bus *bus;
418 const u32 *busrange, *ranges; 418 const u32 *busrange, *ranges;
@@ -503,9 +503,9 @@ after_ranges:
503 pci_of_scan_bus(pbm, node, bus); 503 pci_of_scan_bus(pbm, node, bus);
504} 504}
505 505
506static void __devinit pci_of_scan_bus(struct pci_pbm_info *pbm, 506static void pci_of_scan_bus(struct pci_pbm_info *pbm,
507 struct device_node *node, 507 struct device_node *node,
508 struct pci_bus *bus) 508 struct pci_bus *bus)
509{ 509{
510 struct device_node *child; 510 struct device_node *child;
511 const u32 *reg; 511 const u32 *reg;
@@ -564,7 +564,7 @@ show_pciobppath_attr(struct device * dev, struct device_attribute * attr, char *
564 564
565static DEVICE_ATTR(obppath, S_IRUSR | S_IRGRP | S_IROTH, show_pciobppath_attr, NULL); 565static DEVICE_ATTR(obppath, S_IRUSR | S_IRGRP | S_IROTH, show_pciobppath_attr, NULL);
566 566
567static void __devinit pci_bus_register_of_sysfs(struct pci_bus *bus) 567static void pci_bus_register_of_sysfs(struct pci_bus *bus)
568{ 568{
569 struct pci_dev *dev; 569 struct pci_dev *dev;
570 struct pci_bus *child_bus; 570 struct pci_bus *child_bus;
@@ -585,8 +585,8 @@ static void __devinit pci_bus_register_of_sysfs(struct pci_bus *bus)
585 pci_bus_register_of_sysfs(child_bus); 585 pci_bus_register_of_sysfs(child_bus);
586} 586}
587 587
588struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm, 588struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
589 struct device *parent) 589 struct device *parent)
590{ 590{
591 LIST_HEAD(resources); 591 LIST_HEAD(resources);
592 struct device_node *node = pbm->op->dev.of_node; 592 struct device_node *node = pbm->op->dev.of_node;
@@ -618,7 +618,7 @@ struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm,
618 return bus; 618 return bus;
619} 619}
620 620
621void __devinit pcibios_fixup_bus(struct pci_bus *pbus) 621void pcibios_fixup_bus(struct pci_bus *pbus)
622{ 622{
623} 623}
624 624
@@ -949,8 +949,7 @@ static int __init pcibios_init(void)
949subsys_initcall(pcibios_init); 949subsys_initcall(pcibios_init);
950 950
951#ifdef CONFIG_SYSFS 951#ifdef CONFIG_SYSFS
952static void __devinit pci_bus_slot_names(struct device_node *node, 952static void pci_bus_slot_names(struct device_node *node, struct pci_bus *bus)
953 struct pci_bus *bus)
954{ 953{
955 const struct pci_slot_names { 954 const struct pci_slot_names {
956 u32 slot_mask; 955 u32 slot_mask;
diff --git a/arch/sparc/kernel/pci_fire.c b/arch/sparc/kernel/pci_fire.c
index 188f935276fd..e60fc6a67e9b 100644
--- a/arch/sparc/kernel/pci_fire.c
+++ b/arch/sparc/kernel/pci_fire.c
@@ -408,8 +408,8 @@ static void pci_fire_hw_init(struct pci_pbm_info *pbm)
408 upa_writeq(~(u64)0, pbm->pbm_regs + FIRE_PEC_IENAB); 408 upa_writeq(~(u64)0, pbm->pbm_regs + FIRE_PEC_IENAB);
409} 409}
410 410
411static int __devinit pci_fire_pbm_init(struct pci_pbm_info *pbm, 411static int pci_fire_pbm_init(struct pci_pbm_info *pbm,
412 struct platform_device *op, u32 portid) 412 struct platform_device *op, u32 portid)
413{ 413{
414 const struct linux_prom64_registers *regs; 414 const struct linux_prom64_registers *regs;
415 struct device_node *dp = op->dev.of_node; 415 struct device_node *dp = op->dev.of_node;
@@ -454,7 +454,7 @@ static int __devinit pci_fire_pbm_init(struct pci_pbm_info *pbm,
454 return 0; 454 return 0;
455} 455}
456 456
457static int __devinit fire_probe(struct platform_device *op) 457static int fire_probe(struct platform_device *op)
458{ 458{
459 struct device_node *dp = op->dev.of_node; 459 struct device_node *dp = op->dev.of_node;
460 struct pci_pbm_info *pbm; 460 struct pci_pbm_info *pbm;
diff --git a/arch/sparc/kernel/pci_psycho.c b/arch/sparc/kernel/pci_psycho.c
index f4d29e15ce71..c647634ead2b 100644
--- a/arch/sparc/kernel/pci_psycho.c
+++ b/arch/sparc/kernel/pci_psycho.c
@@ -366,8 +366,8 @@ static void pbm_config_busmastering(struct pci_pbm_info *pbm)
366 pci_config_write8(addr, 64); 366 pci_config_write8(addr, 64);
367} 367}
368 368
369static void __devinit psycho_scan_bus(struct pci_pbm_info *pbm, 369static void psycho_scan_bus(struct pci_pbm_info *pbm,
370 struct device *parent) 370 struct device *parent)
371{ 371{
372 pbm_config_busmastering(pbm); 372 pbm_config_busmastering(pbm);
373 pbm->is_66mhz_capable = 0; 373 pbm->is_66mhz_capable = 0;
@@ -483,15 +483,15 @@ static void psycho_pbm_strbuf_init(struct pci_pbm_info *pbm,
483#define PSYCHO_MEMSPACE_B 0x180000000UL 483#define PSYCHO_MEMSPACE_B 0x180000000UL
484#define PSYCHO_MEMSPACE_SIZE 0x07fffffffUL 484#define PSYCHO_MEMSPACE_SIZE 0x07fffffffUL
485 485
486static void __devinit psycho_pbm_init(struct pci_pbm_info *pbm, 486static void psycho_pbm_init(struct pci_pbm_info *pbm,
487 struct platform_device *op, int is_pbm_a) 487 struct platform_device *op, int is_pbm_a)
488{ 488{
489 psycho_pbm_init_common(pbm, op, "PSYCHO", PBM_CHIP_TYPE_PSYCHO); 489 psycho_pbm_init_common(pbm, op, "PSYCHO", PBM_CHIP_TYPE_PSYCHO);
490 psycho_pbm_strbuf_init(pbm, is_pbm_a); 490 psycho_pbm_strbuf_init(pbm, is_pbm_a);
491 psycho_scan_bus(pbm, &op->dev); 491 psycho_scan_bus(pbm, &op->dev);
492} 492}
493 493
494static struct pci_pbm_info * __devinit psycho_find_sibling(u32 upa_portid) 494static struct pci_pbm_info *psycho_find_sibling(u32 upa_portid)
495{ 495{
496 struct pci_pbm_info *pbm; 496 struct pci_pbm_info *pbm;
497 497
@@ -504,7 +504,7 @@ static struct pci_pbm_info * __devinit psycho_find_sibling(u32 upa_portid)
504 504
505#define PSYCHO_CONFIGSPACE 0x001000000UL 505#define PSYCHO_CONFIGSPACE 0x001000000UL
506 506
507static int __devinit psycho_probe(struct platform_device *op) 507static int psycho_probe(struct platform_device *op)
508{ 508{
509 const struct linux_prom64_registers *pr_regs; 509 const struct linux_prom64_registers *pr_regs;
510 struct device_node *dp = op->dev.of_node; 510 struct device_node *dp = op->dev.of_node;
diff --git a/arch/sparc/kernel/pci_sabre.c b/arch/sparc/kernel/pci_sabre.c
index 3efaa4644d60..6f00d27e8dac 100644
--- a/arch/sparc/kernel/pci_sabre.c
+++ b/arch/sparc/kernel/pci_sabre.c
@@ -403,8 +403,7 @@ static void apb_init(struct pci_bus *sabre_bus)
403 } 403 }
404} 404}
405 405
406static void __devinit sabre_scan_bus(struct pci_pbm_info *pbm, 406static void sabre_scan_bus(struct pci_pbm_info *pbm, struct device *parent)
407 struct device *parent)
408{ 407{
409 static int once; 408 static int once;
410 409
@@ -443,8 +442,8 @@ static void __devinit sabre_scan_bus(struct pci_pbm_info *pbm,
443 sabre_register_error_handlers(pbm); 442 sabre_register_error_handlers(pbm);
444} 443}
445 444
446static void __devinit sabre_pbm_init(struct pci_pbm_info *pbm, 445static void sabre_pbm_init(struct pci_pbm_info *pbm,
447 struct platform_device *op) 446 struct platform_device *op)
448{ 447{
449 psycho_pbm_init_common(pbm, op, "SABRE", PBM_CHIP_TYPE_SABRE); 448 psycho_pbm_init_common(pbm, op, "SABRE", PBM_CHIP_TYPE_SABRE);
450 pbm->pci_afsr = pbm->controller_regs + SABRE_PIOAFSR; 449 pbm->pci_afsr = pbm->controller_regs + SABRE_PIOAFSR;
@@ -454,7 +453,7 @@ static void __devinit sabre_pbm_init(struct pci_pbm_info *pbm,
454} 453}
455 454
456static const struct of_device_id sabre_match[]; 455static const struct of_device_id sabre_match[];
457static int __devinit sabre_probe(struct platform_device *op) 456static int sabre_probe(struct platform_device *op)
458{ 457{
459 const struct of_device_id *match; 458 const struct of_device_id *match;
460 const struct linux_prom64_registers *pr_regs; 459 const struct linux_prom64_registers *pr_regs;
diff --git a/arch/sparc/kernel/pci_schizo.c b/arch/sparc/kernel/pci_schizo.c
index 13d4aa20b5a5..8f76f23dac38 100644
--- a/arch/sparc/kernel/pci_schizo.c
+++ b/arch/sparc/kernel/pci_schizo.c
@@ -1064,8 +1064,7 @@ static void pbm_config_busmastering(struct pci_pbm_info *pbm)
1064 pci_config_write8(addr, 64); 1064 pci_config_write8(addr, 64);
1065} 1065}
1066 1066
1067static void __devinit schizo_scan_bus(struct pci_pbm_info *pbm, 1067static void schizo_scan_bus(struct pci_pbm_info *pbm, struct device *parent)
1068 struct device *parent)
1069{ 1068{
1070 pbm_config_busmastering(pbm); 1069 pbm_config_busmastering(pbm);
1071 pbm->is_66mhz_capable = 1070 pbm->is_66mhz_capable =
@@ -1307,9 +1306,9 @@ static void schizo_pbm_hw_init(struct pci_pbm_info *pbm)
1307 } 1306 }
1308} 1307}
1309 1308
1310static int __devinit schizo_pbm_init(struct pci_pbm_info *pbm, 1309static int schizo_pbm_init(struct pci_pbm_info *pbm,
1311 struct platform_device *op, u32 portid, 1310 struct platform_device *op, u32 portid,
1312 int chip_type) 1311 int chip_type)
1313{ 1312{
1314 const struct linux_prom64_registers *regs; 1313 const struct linux_prom64_registers *regs;
1315 struct device_node *dp = op->dev.of_node; 1314 struct device_node *dp = op->dev.of_node;
@@ -1400,8 +1399,7 @@ static inline int portid_compare(u32 x, u32 y, int chip_type)
1400 return (x == y); 1399 return (x == y);
1401} 1400}
1402 1401
1403static struct pci_pbm_info * __devinit schizo_find_sibling(u32 portid, 1402static struct pci_pbm_info *schizo_find_sibling(u32 portid, int chip_type)
1404 int chip_type)
1405{ 1403{
1406 struct pci_pbm_info *pbm; 1404 struct pci_pbm_info *pbm;
1407 1405
@@ -1412,7 +1410,7 @@ static struct pci_pbm_info * __devinit schizo_find_sibling(u32 portid,
1412 return NULL; 1410 return NULL;
1413} 1411}
1414 1412
1415static int __devinit __schizo_init(struct platform_device *op, unsigned long chip_type) 1413static int __schizo_init(struct platform_device *op, unsigned long chip_type)
1416{ 1414{
1417 struct device_node *dp = op->dev.of_node; 1415 struct device_node *dp = op->dev.of_node;
1418 struct pci_pbm_info *pbm; 1416 struct pci_pbm_info *pbm;
@@ -1460,7 +1458,7 @@ out_err:
1460} 1458}
1461 1459
1462static const struct of_device_id schizo_match[]; 1460static const struct of_device_id schizo_match[];
1463static int __devinit schizo_probe(struct platform_device *op) 1461static int schizo_probe(struct platform_device *op)
1464{ 1462{
1465 const struct of_device_id *match; 1463 const struct of_device_id *match;
1466 1464
diff --git a/arch/sparc/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c
index 051b69caeffd..d07f6b29aed8 100644
--- a/arch/sparc/kernel/pci_sun4v.c
+++ b/arch/sparc/kernel/pci_sun4v.c
@@ -536,8 +536,7 @@ static struct dma_map_ops sun4v_dma_ops = {
536 .unmap_sg = dma_4v_unmap_sg, 536 .unmap_sg = dma_4v_unmap_sg,
537}; 537};
538 538
539static void __devinit pci_sun4v_scan_bus(struct pci_pbm_info *pbm, 539static void pci_sun4v_scan_bus(struct pci_pbm_info *pbm, struct device *parent)
540 struct device *parent)
541{ 540{
542 struct property *prop; 541 struct property *prop;
543 struct device_node *dp; 542 struct device_node *dp;
@@ -550,8 +549,8 @@ static void __devinit pci_sun4v_scan_bus(struct pci_pbm_info *pbm,
550 /* XXX register error interrupt handlers XXX */ 549 /* XXX register error interrupt handlers XXX */
551} 550}
552 551
553static unsigned long __devinit probe_existing_entries(struct pci_pbm_info *pbm, 552static unsigned long probe_existing_entries(struct pci_pbm_info *pbm,
554 struct iommu *iommu) 553 struct iommu *iommu)
555{ 554{
556 struct iommu_arena *arena = &iommu->arena; 555 struct iommu_arena *arena = &iommu->arena;
557 unsigned long i, cnt = 0; 556 unsigned long i, cnt = 0;
@@ -578,7 +577,7 @@ static unsigned long __devinit probe_existing_entries(struct pci_pbm_info *pbm,
578 return cnt; 577 return cnt;
579} 578}
580 579
581static int __devinit pci_sun4v_iommu_init(struct pci_pbm_info *pbm) 580static int pci_sun4v_iommu_init(struct pci_pbm_info *pbm)
582{ 581{
583 static const u32 vdma_default[] = { 0x80000000, 0x80000000 }; 582 static const u32 vdma_default[] = { 0x80000000, 0x80000000 };
584 struct iommu *iommu = pbm->iommu; 583 struct iommu *iommu = pbm->iommu;
@@ -879,8 +878,8 @@ static void pci_sun4v_msi_init(struct pci_pbm_info *pbm)
879} 878}
880#endif /* !(CONFIG_PCI_MSI) */ 879#endif /* !(CONFIG_PCI_MSI) */
881 880
882static int __devinit pci_sun4v_pbm_init(struct pci_pbm_info *pbm, 881static int pci_sun4v_pbm_init(struct pci_pbm_info *pbm,
883 struct platform_device *op, u32 devhandle) 882 struct platform_device *op, u32 devhandle)
884{ 883{
885 struct device_node *dp = op->dev.of_node; 884 struct device_node *dp = op->dev.of_node;
886 int err; 885 int err;
@@ -919,7 +918,7 @@ static int __devinit pci_sun4v_pbm_init(struct pci_pbm_info *pbm,
919 return 0; 918 return 0;
920} 919}
921 920
922static int __devinit pci_sun4v_probe(struct platform_device *op) 921static int pci_sun4v_probe(struct platform_device *op)
923{ 922{
924 const struct linux_prom64_registers *regs; 923 const struct linux_prom64_registers *regs;
925 static int hvapi_negotiated = 0; 924 static int hvapi_negotiated = 0;
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index 521fdf1b20e5..09f4fdd8d808 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -439,8 +439,7 @@ int pcic_present(void)
439 return pcic0_up; 439 return pcic0_up;
440} 440}
441 441
442static int __devinit pdev_to_pnode(struct linux_pbm_info *pbm, 442static int pdev_to_pnode(struct linux_pbm_info *pbm, struct pci_dev *pdev)
443 struct pci_dev *pdev)
444{ 443{
445 struct linux_prom_pci_registers regs[PROMREG_MAX]; 444 struct linux_prom_pci_registers regs[PROMREG_MAX];
446 int err; 445 int err;
@@ -595,7 +594,7 @@ pcic_fill_irq(struct linux_pcic *pcic, struct pci_dev *dev, int node)
595/* 594/*
596 * Normally called from {do_}pci_scan_bus... 595 * Normally called from {do_}pci_scan_bus...
597 */ 596 */
598void __devinit pcibios_fixup_bus(struct pci_bus *bus) 597void pcibios_fixup_bus(struct pci_bus *bus)
599{ 598{
600 struct pci_dev *dev; 599 struct pci_dev *dev;
601 int i, has_io, has_mem; 600 int i, has_io, has_mem;
diff --git a/arch/sparc/kernel/pmc.c b/arch/sparc/kernel/pmc.c
index 0e3202239ff5..dcbb62f63068 100644
--- a/arch/sparc/kernel/pmc.c
+++ b/arch/sparc/kernel/pmc.c
@@ -52,7 +52,7 @@ static void pmc_swift_idle(void)
52#endif 52#endif
53} 53}
54 54
55static int __devinit pmc_probe(struct platform_device *op) 55static int pmc_probe(struct platform_device *op)
56{ 56{
57 regs = of_ioremap(&op->resource[0], 0, 57 regs = of_ioremap(&op->resource[0], 0,
58 resource_size(&op->resource[0]), PMC_OBPNAME); 58 resource_size(&op->resource[0]), PMC_OBPNAME);
diff --git a/arch/sparc/kernel/power.c b/arch/sparc/kernel/power.c
index 0d39075063b2..4cb23c41553f 100644
--- a/arch/sparc/kernel/power.c
+++ b/arch/sparc/kernel/power.c
@@ -23,7 +23,7 @@ static irqreturn_t power_handler(int irq, void *dev_id)
23 return IRQ_HANDLED; 23 return IRQ_HANDLED;
24} 24}
25 25
26static int __devinit has_button_interrupt(unsigned int irq, struct device_node *dp) 26static int has_button_interrupt(unsigned int irq, struct device_node *dp)
27{ 27{
28 if (irq == 0xffffffff) 28 if (irq == 0xffffffff)
29 return 0; 29 return 0;
@@ -33,7 +33,7 @@ static int __devinit has_button_interrupt(unsigned int irq, struct device_node *
33 return 1; 33 return 1;
34} 34}
35 35
36static int __devinit power_probe(struct platform_device *op) 36static int power_probe(struct platform_device *op)
37{ 37{
38 struct resource *res = &op->resource[0]; 38 struct resource *res = &op->resource[0];
39 unsigned int irq = op->archdata.irqs[0]; 39 unsigned int irq = op->archdata.irqs[0];
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index d94b878577b7..537eb66abd06 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -1180,7 +1180,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
1180{ 1180{
1181} 1181}
1182 1182
1183void __devinit smp_prepare_boot_cpu(void) 1183void smp_prepare_boot_cpu(void)
1184{ 1184{
1185} 1185}
1186 1186
@@ -1194,7 +1194,7 @@ void __init smp_setup_processor_id(void)
1194 xcall_deliver_impl = hypervisor_xcall_deliver; 1194 xcall_deliver_impl = hypervisor_xcall_deliver;
1195} 1195}
1196 1196
1197void __devinit smp_fill_in_sib_core_maps(void) 1197void smp_fill_in_sib_core_maps(void)
1198{ 1198{
1199 unsigned int i; 1199 unsigned int i;
1200 1200
diff --git a/arch/sparc/kernel/systbls_32.S b/arch/sparc/kernel/systbls_32.S
index 5147f574f125..6ac43c36bbbf 100644
--- a/arch/sparc/kernel/systbls_32.S
+++ b/arch/sparc/kernel/systbls_32.S
@@ -85,4 +85,4 @@ sys_call_table:
85/*325*/ .long sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init 85/*325*/ .long sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init
86/*330*/ .long sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime 86/*330*/ .long sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime
87/*335*/ .long sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev 87/*335*/ .long sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev
88/*340*/ .long sys_ni_syscall, sys_kcmp 88/*340*/ .long sys_ni_syscall, sys_kcmp, sys_finit_module
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S
index cdbd9b817751..1009ecb92678 100644
--- a/arch/sparc/kernel/systbls_64.S
+++ b/arch/sparc/kernel/systbls_64.S
@@ -86,7 +86,7 @@ sys_call_table32:
86 .word compat_sys_pwritev, compat_sys_rt_tgsigqueueinfo, sys_perf_event_open, compat_sys_recvmmsg, sys_fanotify_init 86 .word compat_sys_pwritev, compat_sys_rt_tgsigqueueinfo, sys_perf_event_open, compat_sys_recvmmsg, sys_fanotify_init
87/*330*/ .word sys32_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, compat_sys_open_by_handle_at, compat_sys_clock_adjtime 87/*330*/ .word sys32_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, compat_sys_open_by_handle_at, compat_sys_clock_adjtime
88 .word sys_syncfs, compat_sys_sendmmsg, sys_setns, compat_sys_process_vm_readv, compat_sys_process_vm_writev 88 .word sys_syncfs, compat_sys_sendmmsg, sys_setns, compat_sys_process_vm_readv, compat_sys_process_vm_writev
89/*340*/ .word sys_kern_features, sys_kcmp 89/*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module
90 90
91#endif /* CONFIG_COMPAT */ 91#endif /* CONFIG_COMPAT */
92 92
@@ -164,4 +164,4 @@ sys_call_table:
164 .word sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init 164 .word sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init
165/*330*/ .word sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime 165/*330*/ .word sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime
166 .word sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev 166 .word sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev
167/*340*/ .word sys_kern_features, sys_kcmp 167/*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module
diff --git a/arch/sparc/kernel/time_32.c b/arch/sparc/kernel/time_32.c
index 953641549e82..c4c27b0f9063 100644
--- a/arch/sparc/kernel/time_32.c
+++ b/arch/sparc/kernel/time_32.c
@@ -278,7 +278,7 @@ static struct platform_device m48t59_rtc = {
278 }, 278 },
279}; 279};
280 280
281static int __devinit clock_probe(struct platform_device *op) 281static int clock_probe(struct platform_device *op)
282{ 282{
283 struct device_node *dp = op->dev.of_node; 283 struct device_node *dp = op->dev.of_node;
284 const char *model = of_get_property(dp, "model", NULL); 284 const char *model = of_get_property(dp, "model", NULL);
diff --git a/arch/sparc/kernel/time_64.c b/arch/sparc/kernel/time_64.c
index e861072b9c52..c3d82b5f54ca 100644
--- a/arch/sparc/kernel/time_64.c
+++ b/arch/sparc/kernel/time_64.c
@@ -419,7 +419,7 @@ static struct platform_device rtc_cmos_device = {
419 .num_resources = 1, 419 .num_resources = 1,
420}; 420};
421 421
422static int __devinit rtc_probe(struct platform_device *op) 422static int rtc_probe(struct platform_device *op)
423{ 423{
424 struct resource *r; 424 struct resource *r;
425 425
@@ -477,7 +477,7 @@ static struct platform_device rtc_bq4802_device = {
477 .num_resources = 1, 477 .num_resources = 1,
478}; 478};
479 479
480static int __devinit bq4802_probe(struct platform_device *op) 480static int bq4802_probe(struct platform_device *op)
481{ 481{
482 482
483 printk(KERN_INFO "%s: BQ4802 regs at 0x%llx\n", 483 printk(KERN_INFO "%s: BQ4802 regs at 0x%llx\n",
@@ -534,7 +534,7 @@ static struct platform_device m48t59_rtc = {
534 }, 534 },
535}; 535};
536 536
537static int __devinit mostek_probe(struct platform_device *op) 537static int mostek_probe(struct platform_device *op)
538{ 538{
539 struct device_node *dp = op->dev.of_node; 539 struct device_node *dp = op->dev.of_node;
540 540
@@ -746,7 +746,7 @@ void __irq_entry timer_interrupt(int irq, struct pt_regs *regs)
746 set_irq_regs(old_regs); 746 set_irq_regs(old_regs);
747} 747}
748 748
749void __devinit setup_sparc64_timer(void) 749void setup_sparc64_timer(void)
750{ 750{
751 struct clock_event_device *sevt; 751 struct clock_event_device *sevt;
752 unsigned long pstate; 752 unsigned long pstate;
@@ -844,7 +844,7 @@ unsigned long long sched_clock(void)
844 >> SPARC64_NSEC_PER_CYC_SHIFT; 844 >> SPARC64_NSEC_PER_CYC_SHIFT;
845} 845}
846 846
847int __devinit read_current_timer(unsigned long *timer_val) 847int read_current_timer(unsigned long *timer_val)
848{ 848{
849 *timer_val = tick_ops->get_tick(); 849 *timer_val = tick_ops->get_tick();
850 return 0; 850 return 0;
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index 85be1ca539b2..c3b72423c846 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -87,8 +87,8 @@ static unsigned long cpu_pgsz_mask;
87 87
88#define MAX_BANKS 32 88#define MAX_BANKS 32
89 89
90static struct linux_prom64_registers pavail[MAX_BANKS] __devinitdata; 90static struct linux_prom64_registers pavail[MAX_BANKS];
91static int pavail_ents __devinitdata; 91static int pavail_ents;
92 92
93static int cmp_p64(const void *a, const void *b) 93static int cmp_p64(const void *a, const void *b)
94{ 94{
@@ -1931,7 +1931,7 @@ void __init paging_init(void)
1931 printk("Booting Linux...\n"); 1931 printk("Booting Linux...\n");
1932} 1932}
1933 1933
1934int __devinit page_in_phys_avail(unsigned long paddr) 1934int page_in_phys_avail(unsigned long paddr)
1935{ 1935{
1936 int i; 1936 int i;
1937 1937
diff --git a/arch/tile/include/asm/pci.h b/arch/tile/include/asm/pci.h
index 302cdf71ceed..54a924208d3c 100644
--- a/arch/tile/include/asm/pci.h
+++ b/arch/tile/include/asm/pci.h
@@ -188,7 +188,7 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
188int __init tile_pci_init(void); 188int __init tile_pci_init(void);
189int __init pcibios_init(void); 189int __init pcibios_init(void);
190 190
191void __devinit pcibios_fixup_bus(struct pci_bus *bus); 191void pcibios_fixup_bus(struct pci_bus *bus);
192 192
193#define pci_domain_nr(bus) (((struct pci_controller *)(bus)->sysdata)->index) 193#define pci_domain_nr(bus) (((struct pci_controller *)(bus)->sysdata)->index)
194 194
diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c
index aac1cd586966..67237d34c2e2 100644
--- a/arch/tile/kernel/pci.c
+++ b/arch/tile/kernel/pci.c
@@ -81,7 +81,7 @@ EXPORT_SYMBOL(pcibios_align_resource);
81 * controller_id is the controller number, config type is 0 or 1 for 81 * controller_id is the controller number, config type is 0 or 1 for
82 * config0 or config1 operations. 82 * config0 or config1 operations.
83 */ 83 */
84static int __devinit tile_pcie_open(int controller_id, int config_type) 84static int tile_pcie_open(int controller_id, int config_type)
85{ 85{
86 char filename[32]; 86 char filename[32];
87 int fd; 87 int fd;
@@ -97,8 +97,7 @@ static int __devinit tile_pcie_open(int controller_id, int config_type)
97/* 97/*
98 * Get the IRQ numbers from the HV and set up the handlers for them. 98 * Get the IRQ numbers from the HV and set up the handlers for them.
99 */ 99 */
100static int __devinit tile_init_irqs(int controller_id, 100static int tile_init_irqs(int controller_id, struct pci_controller *controller)
101 struct pci_controller *controller)
102{ 101{
103 char filename[32]; 102 char filename[32];
104 int fd; 103 int fd;
@@ -237,7 +236,7 @@ static int tile_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
237} 236}
238 237
239 238
240static void __devinit fixup_read_and_payload_sizes(void) 239static void fixup_read_and_payload_sizes(void)
241{ 240{
242 struct pci_dev *dev = NULL; 241 struct pci_dev *dev = NULL;
243 int smallest_max_payload = 0x1; /* Tile maxes out at 256 bytes. */ 242 int smallest_max_payload = 0x1; /* Tile maxes out at 256 bytes. */
@@ -379,7 +378,7 @@ subsys_initcall(pcibios_init);
379/* 378/*
380 * No bus fixups needed. 379 * No bus fixups needed.
381 */ 380 */
382void __devinit pcibios_fixup_bus(struct pci_bus *bus) 381void pcibios_fixup_bus(struct pci_bus *bus)
383{ 382{
384 /* Nothing needs to be done. */ 383 /* Nothing needs to be done. */
385} 384}
@@ -458,11 +457,8 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
458 * specified bus & slot. 457 * specified bus & slot.
459 */ 458 */
460 459
461static int __devinit tile_cfg_read(struct pci_bus *bus, 460static int tile_cfg_read(struct pci_bus *bus, unsigned int devfn, int offset,
462 unsigned int devfn, 461 int size, u32 *val)
463 int offset,
464 int size,
465 u32 *val)
466{ 462{
467 struct pci_controller *controller = bus->sysdata; 463 struct pci_controller *controller = bus->sysdata;
468 int busnum = bus->number & 0xff; 464 int busnum = bus->number & 0xff;
@@ -504,11 +500,8 @@ static int __devinit tile_cfg_read(struct pci_bus *bus,
504 * See tile_cfg_read() for relevant comments. 500 * See tile_cfg_read() for relevant comments.
505 * Note that "val" is the value to write, not a pointer to that value. 501 * Note that "val" is the value to write, not a pointer to that value.
506 */ 502 */
507static int __devinit tile_cfg_write(struct pci_bus *bus, 503static int tile_cfg_write(struct pci_bus *bus, unsigned int devfn, int offset,
508 unsigned int devfn, 504 int size, u32 val)
509 int offset,
510 int size,
511 u32 val)
512{ 505{
513 struct pci_controller *controller = bus->sysdata; 506 struct pci_controller *controller = bus->sysdata;
514 int busnum = bus->number & 0xff; 507 int busnum = bus->number & 0xff;
diff --git a/arch/tile/kernel/pci_gx.c b/arch/tile/kernel/pci_gx.c
index 94810d4a6332..11425633b2d7 100644
--- a/arch/tile/kernel/pci_gx.c
+++ b/arch/tile/kernel/pci_gx.c
@@ -58,10 +58,10 @@
58#define TRACE_CFG_RD(...) 58#define TRACE_CFG_RD(...)
59#endif 59#endif
60 60
61static int __devinitdata pci_probe = 1; 61static int pci_probe = 1;
62 62
63/* Information on the PCIe RC ports configuration. */ 63/* Information on the PCIe RC ports configuration. */
64static int __devinitdata pcie_rc[TILEGX_NUM_TRIO][TILEGX_TRIO_PCIES]; 64static int pcie_rc[TILEGX_NUM_TRIO][TILEGX_TRIO_PCIES];
65 65
66/* 66/*
67 * On some platforms with one or more Gx endpoint ports, we need to 67 * On some platforms with one or more Gx endpoint ports, we need to
@@ -72,7 +72,7 @@ static int __devinitdata pcie_rc[TILEGX_NUM_TRIO][TILEGX_TRIO_PCIES];
72 * the delay in seconds. If the delay is not provided, the value 72 * the delay in seconds. If the delay is not provided, the value
73 * will be DEFAULT_RC_DELAY. 73 * will be DEFAULT_RC_DELAY.
74 */ 74 */
75static int __devinitdata rc_delay[TILEGX_NUM_TRIO][TILEGX_TRIO_PCIES]; 75static int rc_delay[TILEGX_NUM_TRIO][TILEGX_TRIO_PCIES];
76 76
77/* Default number of seconds that the PCIe RC port probe can be delayed. */ 77/* Default number of seconds that the PCIe RC port probe can be delayed. */
78#define DEFAULT_RC_DELAY 10 78#define DEFAULT_RC_DELAY 10
@@ -137,7 +137,7 @@ static int tile_irq_cpu(int irq)
137/* 137/*
138 * Open a file descriptor to the TRIO shim. 138 * Open a file descriptor to the TRIO shim.
139 */ 139 */
140static int __devinit tile_pcie_open(int trio_index) 140static int tile_pcie_open(int trio_index)
141{ 141{
142 gxio_trio_context_t *context = &trio_contexts[trio_index]; 142 gxio_trio_context_t *context = &trio_contexts[trio_index];
143 int ret; 143 int ret;
@@ -265,7 +265,7 @@ trio_handle_level_irq(unsigned int irq, struct irq_desc *desc)
265 * Create kernel irqs and set up the handlers for the legacy interrupts. 265 * Create kernel irqs and set up the handlers for the legacy interrupts.
266 * Also some minimum initialization for the MSI support. 266 * Also some minimum initialization for the MSI support.
267 */ 267 */
268static int __devinit tile_init_irqs(struct pci_controller *controller) 268static int tile_init_irqs(struct pci_controller *controller)
269{ 269{
270 int i; 270 int i;
271 int j; 271 int j;
@@ -459,8 +459,7 @@ static int tile_map_irq(const struct pci_dev *dev, u8 device, u8 pin)
459} 459}
460 460
461 461
462static void __devinit fixup_read_and_payload_sizes(struct pci_controller * 462static void fixup_read_and_payload_sizes(struct pci_controller *controller)
463 controller)
464{ 463{
465 gxio_trio_context_t *trio_context = controller->trio; 464 gxio_trio_context_t *trio_context = controller->trio;
466 struct pci_bus *root_bus = controller->root_bus; 465 struct pci_bus *root_bus = controller->root_bus;
@@ -541,7 +540,7 @@ static void __devinit fixup_read_and_payload_sizes(struct pci_controller *
541 } 540 }
542} 541}
543 542
544static int __devinit setup_pcie_rc_delay(char *str) 543static int setup_pcie_rc_delay(char *str)
545{ 544{
546 unsigned long delay = 0; 545 unsigned long delay = 0;
547 unsigned long trio_index; 546 unsigned long trio_index;
@@ -1016,7 +1015,7 @@ alloc_mem_map_failed:
1016subsys_initcall(pcibios_init); 1015subsys_initcall(pcibios_init);
1017 1016
1018/* Note: to be deleted after Linux 3.6 merge. */ 1017/* Note: to be deleted after Linux 3.6 merge. */
1019void __devinit pcibios_fixup_bus(struct pci_bus *bus) 1018void pcibios_fixup_bus(struct pci_bus *bus)
1020{ 1019{
1021} 1020}
1022 1021
@@ -1024,7 +1023,7 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus)
1024 * This can be called from the generic PCI layer, but doesn't need to 1023 * This can be called from the generic PCI layer, but doesn't need to
1025 * do anything. 1024 * do anything.
1026 */ 1025 */
1027char __devinit *pcibios_setup(char *str) 1026char *pcibios_setup(char *str)
1028{ 1027{
1029 if (!strcmp(str, "off")) { 1028 if (!strcmp(str, "off")) {
1030 pci_probe = 0; 1029 pci_probe = 0;
@@ -1143,11 +1142,8 @@ EXPORT_SYMBOL(pci_iounmap);
1143 * specified bus & device. 1142 * specified bus & device.
1144 */ 1143 */
1145 1144
1146static int __devinit tile_cfg_read(struct pci_bus *bus, 1145static int tile_cfg_read(struct pci_bus *bus, unsigned int devfn, int offset,
1147 unsigned int devfn, 1146 int size, u32 *val)
1148 int offset,
1149 int size,
1150 u32 *val)
1151{ 1147{
1152 struct pci_controller *controller = bus->sysdata; 1148 struct pci_controller *controller = bus->sysdata;
1153 gxio_trio_context_t *trio_context = controller->trio; 1149 gxio_trio_context_t *trio_context = controller->trio;
@@ -1271,11 +1267,8 @@ invalid_device:
1271 * See tile_cfg_read() for relevent comments. 1267 * See tile_cfg_read() for relevent comments.
1272 * Note that "val" is the value to write, not a pointer to that value. 1268 * Note that "val" is the value to write, not a pointer to that value.
1273 */ 1269 */
1274static int __devinit tile_cfg_write(struct pci_bus *bus, 1270static int tile_cfg_write(struct pci_bus *bus, unsigned int devfn, int offset,
1275 unsigned int devfn, 1271 int size, u32 val)
1276 int offset,
1277 int size,
1278 u32 val)
1279{ 1272{
1280 struct pci_controller *controller = bus->sysdata; 1273 struct pci_controller *controller = bus->sysdata;
1281 gxio_trio_context_t *trio_context = controller->trio; 1274 gxio_trio_context_t *trio_context = controller->trio;
diff --git a/arch/unicore32/kernel/pci.c b/arch/unicore32/kernel/pci.c
index 7c4359240b81..ef69c0c82825 100644
--- a/arch/unicore32/kernel/pci.c
+++ b/arch/unicore32/kernel/pci.c
@@ -167,7 +167,7 @@ static inline int pdev_bad_for_parity(struct pci_dev *dev)
167 * pcibios_fixup_bus - Called after each bus is probed, 167 * pcibios_fixup_bus - Called after each bus is probed,
168 * but before its children are examined. 168 * but before its children are examined.
169 */ 169 */
170void __devinit pcibios_fixup_bus(struct pci_bus *bus) 170void pcibios_fixup_bus(struct pci_bus *bus)
171{ 171{
172 struct pci_dev *dev; 172 struct pci_dev *dev;
173 u16 features = PCI_COMMAND_SERR 173 u16 features = PCI_COMMAND_SERR
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 79795af59810..225543bf45a5 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2138,6 +2138,7 @@ config OLPC_XO1_RTC
2138config OLPC_XO1_SCI 2138config OLPC_XO1_SCI
2139 bool "OLPC XO-1 SCI extras" 2139 bool "OLPC XO-1 SCI extras"
2140 depends on OLPC && OLPC_XO1_PM 2140 depends on OLPC && OLPC_XO1_PM
2141 depends on INPUT=y
2141 select POWER_SUPPLY 2142 select POWER_SUPPLY
2142 select GPIO_CS5535 2143 select GPIO_CS5535
2143 select MFD_CORE 2144 select MFD_CORE
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
index ccce0ed67dde..379814bc41e3 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -71,7 +71,7 @@ GCOV_PROFILE := n
71$(obj)/bzImage: asflags-y := $(SVGA_MODE) 71$(obj)/bzImage: asflags-y := $(SVGA_MODE)
72 72
73quiet_cmd_image = BUILD $@ 73quiet_cmd_image = BUILD $@
74cmd_image = $(obj)/tools/build $(obj)/setup.bin $(obj)/vmlinux.bin > $@ 74cmd_image = $(obj)/tools/build $(obj)/setup.bin $(obj)/vmlinux.bin $(obj)/zoffset.h > $@
75 75
76$(obj)/bzImage: $(obj)/setup.bin $(obj)/vmlinux.bin $(obj)/tools/build FORCE 76$(obj)/bzImage: $(obj)/setup.bin $(obj)/vmlinux.bin $(obj)/tools/build FORCE
77 $(call if_changed,image) 77 $(call if_changed,image)
@@ -92,7 +92,7 @@ targets += voffset.h
92$(obj)/voffset.h: vmlinux FORCE 92$(obj)/voffset.h: vmlinux FORCE
93 $(call if_changed,voffset) 93 $(call if_changed,voffset)
94 94
95sed-zoffset := -e 's/^\([0-9a-fA-F]*\) . \(startup_32\|input_data\|_end\|z_.*\)$$/\#define ZO_\2 0x\1/p' 95sed-zoffset := -e 's/^\([0-9a-fA-F]*\) . \(startup_32\|startup_64\|efi_pe_entry\|efi_stub_entry\|input_data\|_end\|z_.*\)$$/\#define ZO_\2 0x\1/p'
96 96
97quiet_cmd_zoffset = ZOFFSET $@ 97quiet_cmd_zoffset = ZOFFSET $@
98 cmd_zoffset = $(NM) $< | sed -n $(sed-zoffset) > $@ 98 cmd_zoffset = $(NM) $< | sed -n $(sed-zoffset) > $@
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index b1942e222768..f8fa41190c35 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -256,10 +256,10 @@ static efi_status_t setup_efi_pci(struct boot_params *params)
256 int i; 256 int i;
257 struct setup_data *data; 257 struct setup_data *data;
258 258
259 data = (struct setup_data *)params->hdr.setup_data; 259 data = (struct setup_data *)(unsigned long)params->hdr.setup_data;
260 260
261 while (data && data->next) 261 while (data && data->next)
262 data = (struct setup_data *)data->next; 262 data = (struct setup_data *)(unsigned long)data->next;
263 263
264 status = efi_call_phys5(sys_table->boottime->locate_handle, 264 status = efi_call_phys5(sys_table->boottime->locate_handle,
265 EFI_LOCATE_BY_PROTOCOL, &pci_proto, 265 EFI_LOCATE_BY_PROTOCOL, &pci_proto,
@@ -295,16 +295,18 @@ static efi_status_t setup_efi_pci(struct boot_params *params)
295 if (!pci) 295 if (!pci)
296 continue; 296 continue;
297 297
298#ifdef CONFIG_X86_64
298 status = efi_call_phys4(pci->attributes, pci, 299 status = efi_call_phys4(pci->attributes, pci,
299 EfiPciIoAttributeOperationGet, 0, 300 EfiPciIoAttributeOperationGet, 0,
300 &attributes); 301 &attributes);
301 302#else
303 status = efi_call_phys5(pci->attributes, pci,
304 EfiPciIoAttributeOperationGet, 0, 0,
305 &attributes);
306#endif
302 if (status != EFI_SUCCESS) 307 if (status != EFI_SUCCESS)
303 continue; 308 continue;
304 309
305 if (!attributes & EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM)
306 continue;
307
308 if (!pci->romimage || !pci->romsize) 310 if (!pci->romimage || !pci->romsize)
309 continue; 311 continue;
310 312
@@ -345,9 +347,9 @@ static efi_status_t setup_efi_pci(struct boot_params *params)
345 memcpy(rom->romdata, pci->romimage, pci->romsize); 347 memcpy(rom->romdata, pci->romimage, pci->romsize);
346 348
347 if (data) 349 if (data)
348 data->next = (uint64_t)rom; 350 data->next = (unsigned long)rom;
349 else 351 else
350 params->hdr.setup_data = (uint64_t)rom; 352 params->hdr.setup_data = (unsigned long)rom;
351 353
352 data = (struct setup_data *)rom; 354 data = (struct setup_data *)rom;
353 355
@@ -432,10 +434,9 @@ static efi_status_t setup_gop(struct screen_info *si, efi_guid_t *proto,
432 * Once we've found a GOP supporting ConOut, 434 * Once we've found a GOP supporting ConOut,
433 * don't bother looking any further. 435 * don't bother looking any further.
434 */ 436 */
437 first_gop = gop;
435 if (conout_found) 438 if (conout_found)
436 break; 439 break;
437
438 first_gop = gop;
439 } 440 }
440 } 441 }
441 442
diff --git a/arch/x86/boot/compressed/head_32.S b/arch/x86/boot/compressed/head_32.S
index aa4aaf1b2380..1e3184f6072f 100644
--- a/arch/x86/boot/compressed/head_32.S
+++ b/arch/x86/boot/compressed/head_32.S
@@ -35,11 +35,11 @@ ENTRY(startup_32)
35#ifdef CONFIG_EFI_STUB 35#ifdef CONFIG_EFI_STUB
36 jmp preferred_addr 36 jmp preferred_addr
37 37
38 .balign 0x10
39 /* 38 /*
40 * We don't need the return address, so set up the stack so 39 * We don't need the return address, so set up the stack so
41 * efi_main() can find its arugments. 40 * efi_main() can find its arguments.
42 */ 41 */
42ENTRY(efi_pe_entry)
43 add $0x4, %esp 43 add $0x4, %esp
44 44
45 call make_boot_params 45 call make_boot_params
@@ -50,8 +50,10 @@ ENTRY(startup_32)
50 pushl %eax 50 pushl %eax
51 pushl %esi 51 pushl %esi
52 pushl %ecx 52 pushl %ecx
53 sub $0x4, %esp
53 54
54 .org 0x30,0x90 55ENTRY(efi_stub_entry)
56 add $0x4, %esp
55 call efi_main 57 call efi_main
56 cmpl $0, %eax 58 cmpl $0, %eax
57 movl %eax, %esi 59 movl %eax, %esi
diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
index 2c4b171eec33..f5d1aaa0dec8 100644
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
@@ -201,12 +201,12 @@ ENTRY(startup_64)
201 */ 201 */
202#ifdef CONFIG_EFI_STUB 202#ifdef CONFIG_EFI_STUB
203 /* 203 /*
204 * The entry point for the PE/COFF executable is 0x210, so only 204 * The entry point for the PE/COFF executable is efi_pe_entry, so
205 * legacy boot loaders will execute this jmp. 205 * only legacy boot loaders will execute this jmp.
206 */ 206 */
207 jmp preferred_addr 207 jmp preferred_addr
208 208
209 .org 0x210 209ENTRY(efi_pe_entry)
210 mov %rcx, %rdi 210 mov %rcx, %rdi
211 mov %rdx, %rsi 211 mov %rdx, %rsi
212 pushq %rdi 212 pushq %rdi
@@ -218,7 +218,7 @@ ENTRY(startup_64)
218 popq %rsi 218 popq %rsi
219 popq %rdi 219 popq %rdi
220 220
221 .org 0x230,0x90 221ENTRY(efi_stub_entry)
222 call efi_main 222 call efi_main
223 movq %rax,%rsi 223 movq %rax,%rsi
224 cmpq $0,%rax 224 cmpq $0,%rax
diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
index 8c132a625b94..944ce595f767 100644
--- a/arch/x86/boot/header.S
+++ b/arch/x86/boot/header.S
@@ -21,6 +21,7 @@
21#include <asm/e820.h> 21#include <asm/e820.h>
22#include <asm/page_types.h> 22#include <asm/page_types.h>
23#include <asm/setup.h> 23#include <asm/setup.h>
24#include <asm/bootparam.h>
24#include "boot.h" 25#include "boot.h"
25#include "voffset.h" 26#include "voffset.h"
26#include "zoffset.h" 27#include "zoffset.h"
@@ -255,6 +256,9 @@ section_table:
255 # header, from the old boot sector. 256 # header, from the old boot sector.
256 257
257 .section ".header", "a" 258 .section ".header", "a"
259 .globl sentinel
260sentinel: .byte 0xff, 0xff /* Used to detect broken loaders */
261
258 .globl hdr 262 .globl hdr
259hdr: 263hdr:
260setup_sects: .byte 0 /* Filled in by build.c */ 264setup_sects: .byte 0 /* Filled in by build.c */
@@ -279,7 +283,7 @@ _start:
279 # Part 2 of the header, from the old setup.S 283 # Part 2 of the header, from the old setup.S
280 284
281 .ascii "HdrS" # header signature 285 .ascii "HdrS" # header signature
282 .word 0x020b # header version number (>= 0x0105) 286 .word 0x020c # header version number (>= 0x0105)
283 # or else old loadlin-1.5 will fail) 287 # or else old loadlin-1.5 will fail)
284 .globl realmode_swtch 288 .globl realmode_swtch
285realmode_swtch: .word 0, 0 # default_switch, SETUPSEG 289realmode_swtch: .word 0, 0 # default_switch, SETUPSEG
@@ -297,13 +301,7 @@ type_of_loader: .byte 0 # 0 means ancient bootloader, newer
297 301
298# flags, unused bits must be zero (RFU) bit within loadflags 302# flags, unused bits must be zero (RFU) bit within loadflags
299loadflags: 303loadflags:
300LOADED_HIGH = 1 # If set, the kernel is loaded high 304 .byte LOADED_HIGH # The kernel is to be loaded high
301CAN_USE_HEAP = 0x80 # If set, the loader also has set
302 # heap_end_ptr to tell how much
303 # space behind setup.S can be used for
304 # heap purposes.
305 # Only the loader knows what is free
306 .byte LOADED_HIGH
307 305
308setup_move_size: .word 0x8000 # size to move, when setup is not 306setup_move_size: .word 0x8000 # size to move, when setup is not
309 # loaded at 0x90000. We will move setup 307 # loaded at 0x90000. We will move setup
@@ -369,7 +367,23 @@ relocatable_kernel: .byte 1
369relocatable_kernel: .byte 0 367relocatable_kernel: .byte 0
370#endif 368#endif
371min_alignment: .byte MIN_KERNEL_ALIGN_LG2 # minimum alignment 369min_alignment: .byte MIN_KERNEL_ALIGN_LG2 # minimum alignment
372pad3: .word 0 370
371xloadflags:
372#ifdef CONFIG_X86_64
373# define XLF0 XLF_KERNEL_64 /* 64-bit kernel */
374#else
375# define XLF0 0
376#endif
377#ifdef CONFIG_EFI_STUB
378# ifdef CONFIG_X86_64
379# define XLF23 XLF_EFI_HANDOVER_64 /* 64-bit EFI handover ok */
380# else
381# define XLF23 XLF_EFI_HANDOVER_32 /* 32-bit EFI handover ok */
382# endif
383#else
384# define XLF23 0
385#endif
386 .word XLF0 | XLF23
373 387
374cmdline_size: .long COMMAND_LINE_SIZE-1 #length of the command line, 388cmdline_size: .long COMMAND_LINE_SIZE-1 #length of the command line,
375 #added with boot protocol 389 #added with boot protocol
@@ -397,8 +411,13 @@ pref_address: .quad LOAD_PHYSICAL_ADDR # preferred load addr
397#define INIT_SIZE VO_INIT_SIZE 411#define INIT_SIZE VO_INIT_SIZE
398#endif 412#endif
399init_size: .long INIT_SIZE # kernel initialization size 413init_size: .long INIT_SIZE # kernel initialization size
400handover_offset: .long 0x30 # offset to the handover 414handover_offset:
415#ifdef CONFIG_EFI_STUB
416 .long 0x30 # offset to the handover
401 # protocol entry point 417 # protocol entry point
418#else
419 .long 0
420#endif
402 421
403# End of setup header ##################################################### 422# End of setup header #####################################################
404 423
diff --git a/arch/x86/boot/setup.ld b/arch/x86/boot/setup.ld
index 03c0683636b6..96a6c7563538 100644
--- a/arch/x86/boot/setup.ld
+++ b/arch/x86/boot/setup.ld
@@ -13,7 +13,7 @@ SECTIONS
13 .bstext : { *(.bstext) } 13 .bstext : { *(.bstext) }
14 .bsdata : { *(.bsdata) } 14 .bsdata : { *(.bsdata) }
15 15
16 . = 497; 16 . = 495;
17 .header : { *(.header) } 17 .header : { *(.header) }
18 .entrytext : { *(.entrytext) } 18 .entrytext : { *(.entrytext) }
19 .inittext : { *(.inittext) } 19 .inittext : { *(.inittext) }
diff --git a/arch/x86/boot/tools/build.c b/arch/x86/boot/tools/build.c
index 4b8e165ee572..94c544650020 100644
--- a/arch/x86/boot/tools/build.c
+++ b/arch/x86/boot/tools/build.c
@@ -52,6 +52,10 @@ int is_big_kernel;
52 52
53#define PECOFF_RELOC_RESERVE 0x20 53#define PECOFF_RELOC_RESERVE 0x20
54 54
55unsigned long efi_stub_entry;
56unsigned long efi_pe_entry;
57unsigned long startup_64;
58
55/*----------------------------------------------------------------------*/ 59/*----------------------------------------------------------------------*/
56 60
57static const u32 crctab32[] = { 61static const u32 crctab32[] = {
@@ -132,7 +136,7 @@ static void die(const char * str, ...)
132 136
133static void usage(void) 137static void usage(void)
134{ 138{
135 die("Usage: build setup system [> image]"); 139 die("Usage: build setup system [zoffset.h] [> image]");
136} 140}
137 141
138#ifdef CONFIG_EFI_STUB 142#ifdef CONFIG_EFI_STUB
@@ -206,30 +210,54 @@ static void update_pecoff_text(unsigned int text_start, unsigned int file_sz)
206 */ 210 */
207 put_unaligned_le32(file_sz - 512, &buf[pe_header + 0x1c]); 211 put_unaligned_le32(file_sz - 512, &buf[pe_header + 0x1c]);
208 212
209#ifdef CONFIG_X86_32
210 /* 213 /*
211 * Address of entry point. 214 * Address of entry point for PE/COFF executable
212 *
213 * The EFI stub entry point is +16 bytes from the start of
214 * the .text section.
215 */ 215 */
216 put_unaligned_le32(text_start + 16, &buf[pe_header + 0x28]); 216 put_unaligned_le32(text_start + efi_pe_entry, &buf[pe_header + 0x28]);
217#else
218 /*
219 * Address of entry point. startup_32 is at the beginning and
220 * the 64-bit entry point (startup_64) is always 512 bytes
221 * after. The EFI stub entry point is 16 bytes after that, as
222 * the first instruction allows legacy loaders to jump over
223 * the EFI stub initialisation
224 */
225 put_unaligned_le32(text_start + 528, &buf[pe_header + 0x28]);
226#endif /* CONFIG_X86_32 */
227 217
228 update_pecoff_section_header(".text", text_start, text_sz); 218 update_pecoff_section_header(".text", text_start, text_sz);
229} 219}
230 220
231#endif /* CONFIG_EFI_STUB */ 221#endif /* CONFIG_EFI_STUB */
232 222
223
224/*
225 * Parse zoffset.h and find the entry points. We could just #include zoffset.h
226 * but that would mean tools/build would have to be rebuilt every time. It's
227 * not as if parsing it is hard...
228 */
229#define PARSE_ZOFS(p, sym) do { \
230 if (!strncmp(p, "#define ZO_" #sym " ", 11+sizeof(#sym))) \
231 sym = strtoul(p + 11 + sizeof(#sym), NULL, 16); \
232} while (0)
233
234static void parse_zoffset(char *fname)
235{
236 FILE *file;
237 char *p;
238 int c;
239
240 file = fopen(fname, "r");
241 if (!file)
242 die("Unable to open `%s': %m", fname);
243 c = fread(buf, 1, sizeof(buf) - 1, file);
244 if (ferror(file))
245 die("read-error on `zoffset.h'");
246 buf[c] = 0;
247
248 p = (char *)buf;
249
250 while (p && *p) {
251 PARSE_ZOFS(p, efi_stub_entry);
252 PARSE_ZOFS(p, efi_pe_entry);
253 PARSE_ZOFS(p, startup_64);
254
255 p = strchr(p, '\n');
256 while (p && (*p == '\r' || *p == '\n'))
257 p++;
258 }
259}
260
233int main(int argc, char ** argv) 261int main(int argc, char ** argv)
234{ 262{
235 unsigned int i, sz, setup_sectors; 263 unsigned int i, sz, setup_sectors;
@@ -241,7 +269,19 @@ int main(int argc, char ** argv)
241 void *kernel; 269 void *kernel;
242 u32 crc = 0xffffffffUL; 270 u32 crc = 0xffffffffUL;
243 271
244 if (argc != 3) 272 /* Defaults for old kernel */
273#ifdef CONFIG_X86_32
274 efi_pe_entry = 0x10;
275 efi_stub_entry = 0x30;
276#else
277 efi_pe_entry = 0x210;
278 efi_stub_entry = 0x230;
279 startup_64 = 0x200;
280#endif
281
282 if (argc == 4)
283 parse_zoffset(argv[3]);
284 else if (argc != 3)
245 usage(); 285 usage();
246 286
247 /* Copy the setup code */ 287 /* Copy the setup code */
@@ -299,6 +339,11 @@ int main(int argc, char ** argv)
299 339
300#ifdef CONFIG_EFI_STUB 340#ifdef CONFIG_EFI_STUB
301 update_pecoff_text(setup_sectors * 512, sz + i + ((sys_size * 16) - sz)); 341 update_pecoff_text(setup_sectors * 512, sz + i + ((sys_size * 16) - sz));
342
343#ifdef CONFIG_X86_64 /* Yes, this is really how we defined it :( */
344 efi_stub_entry -= 0x200;
345#endif
346 put_unaligned_le32(efi_stub_entry, &buf[0x264]);
302#endif 347#endif
303 348
304 crc = partial_crc32(buf, i, crc); 349 crc = partial_crc32(buf, i, crc);
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index 6e8fdf5ad113..28677c55113f 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -94,6 +94,7 @@ extern void __iomem *efi_ioremap(unsigned long addr, unsigned long size,
94#endif /* CONFIG_X86_32 */ 94#endif /* CONFIG_X86_32 */
95 95
96extern int add_efi_memmap; 96extern int add_efi_memmap;
97extern unsigned long x86_efi_facility;
97extern void efi_set_executable(efi_memory_desc_t *md, bool executable); 98extern void efi_set_executable(efi_memory_desc_t *md, bool executable);
98extern int efi_memblock_x86_reserve_range(void); 99extern int efi_memblock_x86_reserve_range(void);
99extern void efi_call_phys_prelog(void); 100extern void efi_call_phys_prelog(void);
diff --git a/arch/x86/include/asm/parport.h b/arch/x86/include/asm/parport.h
index 3c4ffeb467e9..0d2d3b29118f 100644
--- a/arch/x86/include/asm/parport.h
+++ b/arch/x86/include/asm/parport.h
@@ -1,8 +1,8 @@
1#ifndef _ASM_X86_PARPORT_H 1#ifndef _ASM_X86_PARPORT_H
2#define _ASM_X86_PARPORT_H 2#define _ASM_X86_PARPORT_H
3 3
4static int __devinit parport_pc_find_isa_ports(int autoirq, int autodma); 4static int parport_pc_find_isa_ports(int autoirq, int autodma);
5static int __devinit parport_pc_find_nonpci_ports(int autoirq, int autodma) 5static int parport_pc_find_nonpci_ports(int autoirq, int autodma)
6{ 6{
7 return parport_pc_find_isa_ports(autoirq, autodma); 7 return parport_pc_find_isa_ports(autoirq, autodma);
8} 8}
diff --git a/arch/x86/include/asm/pci_x86.h b/arch/x86/include/asm/pci_x86.h
index 73e8eeff22ee..747e5a38b590 100644
--- a/arch/x86/include/asm/pci_x86.h
+++ b/arch/x86/include/asm/pci_x86.h
@@ -140,11 +140,10 @@ struct pci_mmcfg_region {
140 140
141extern int __init pci_mmcfg_arch_init(void); 141extern int __init pci_mmcfg_arch_init(void);
142extern void __init pci_mmcfg_arch_free(void); 142extern void __init pci_mmcfg_arch_free(void);
143extern int __devinit pci_mmcfg_arch_map(struct pci_mmcfg_region *cfg); 143extern int pci_mmcfg_arch_map(struct pci_mmcfg_region *cfg);
144extern void pci_mmcfg_arch_unmap(struct pci_mmcfg_region *cfg); 144extern void pci_mmcfg_arch_unmap(struct pci_mmcfg_region *cfg);
145extern int __devinit pci_mmconfig_insert(struct device *dev, 145extern int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end,
146 u16 seg, u8 start, 146 phys_addr_t addr);
147 u8 end, phys_addr_t addr);
148extern int pci_mmconfig_delete(u16 seg, u8 start, u8 end); 147extern int pci_mmconfig_delete(u16 seg, u8 start, u8 end);
149extern struct pci_mmcfg_region *pci_mmconfig_lookup(int segment, int bus); 148extern struct pci_mmcfg_region *pci_mmconfig_lookup(int segment, int bus);
150 149
diff --git a/arch/x86/include/asm/uv/uv.h b/arch/x86/include/asm/uv/uv.h
index b47c2a82ff15..062921ef34e9 100644
--- a/arch/x86/include/asm/uv/uv.h
+++ b/arch/x86/include/asm/uv/uv.h
@@ -16,7 +16,7 @@ extern void uv_system_init(void);
16extern const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask, 16extern const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask,
17 struct mm_struct *mm, 17 struct mm_struct *mm,
18 unsigned long start, 18 unsigned long start,
19 unsigned end, 19 unsigned long end,
20 unsigned int cpu); 20 unsigned int cpu);
21 21
22#else /* X86_UV */ 22#else /* X86_UV */
diff --git a/arch/x86/include/uapi/asm/bootparam.h b/arch/x86/include/uapi/asm/bootparam.h
index 92862cd90201..c15ddaf90710 100644
--- a/arch/x86/include/uapi/asm/bootparam.h
+++ b/arch/x86/include/uapi/asm/bootparam.h
@@ -1,6 +1,31 @@
1#ifndef _ASM_X86_BOOTPARAM_H 1#ifndef _ASM_X86_BOOTPARAM_H
2#define _ASM_X86_BOOTPARAM_H 2#define _ASM_X86_BOOTPARAM_H
3 3
4/* setup_data types */
5#define SETUP_NONE 0
6#define SETUP_E820_EXT 1
7#define SETUP_DTB 2
8#define SETUP_PCI 3
9
10/* ram_size flags */
11#define RAMDISK_IMAGE_START_MASK 0x07FF
12#define RAMDISK_PROMPT_FLAG 0x8000
13#define RAMDISK_LOAD_FLAG 0x4000
14
15/* loadflags */
16#define LOADED_HIGH (1<<0)
17#define QUIET_FLAG (1<<5)
18#define KEEP_SEGMENTS (1<<6)
19#define CAN_USE_HEAP (1<<7)
20
21/* xloadflags */
22#define XLF_KERNEL_64 (1<<0)
23#define XLF_CAN_BE_LOADED_ABOVE_4G (1<<1)
24#define XLF_EFI_HANDOVER_32 (1<<2)
25#define XLF_EFI_HANDOVER_64 (1<<3)
26
27#ifndef __ASSEMBLY__
28
4#include <linux/types.h> 29#include <linux/types.h>
5#include <linux/screen_info.h> 30#include <linux/screen_info.h>
6#include <linux/apm_bios.h> 31#include <linux/apm_bios.h>
@@ -9,12 +34,6 @@
9#include <asm/ist.h> 34#include <asm/ist.h>
10#include <video/edid.h> 35#include <video/edid.h>
11 36
12/* setup data types */
13#define SETUP_NONE 0
14#define SETUP_E820_EXT 1
15#define SETUP_DTB 2
16#define SETUP_PCI 3
17
18/* extensible setup data list node */ 37/* extensible setup data list node */
19struct setup_data { 38struct setup_data {
20 __u64 next; 39 __u64 next;
@@ -28,9 +47,6 @@ struct setup_header {
28 __u16 root_flags; 47 __u16 root_flags;
29 __u32 syssize; 48 __u32 syssize;
30 __u16 ram_size; 49 __u16 ram_size;
31#define RAMDISK_IMAGE_START_MASK 0x07FF
32#define RAMDISK_PROMPT_FLAG 0x8000
33#define RAMDISK_LOAD_FLAG 0x4000
34 __u16 vid_mode; 50 __u16 vid_mode;
35 __u16 root_dev; 51 __u16 root_dev;
36 __u16 boot_flag; 52 __u16 boot_flag;
@@ -42,10 +58,6 @@ struct setup_header {
42 __u16 kernel_version; 58 __u16 kernel_version;
43 __u8 type_of_loader; 59 __u8 type_of_loader;
44 __u8 loadflags; 60 __u8 loadflags;
45#define LOADED_HIGH (1<<0)
46#define QUIET_FLAG (1<<5)
47#define KEEP_SEGMENTS (1<<6)
48#define CAN_USE_HEAP (1<<7)
49 __u16 setup_move_size; 61 __u16 setup_move_size;
50 __u32 code32_start; 62 __u32 code32_start;
51 __u32 ramdisk_image; 63 __u32 ramdisk_image;
@@ -58,7 +70,8 @@ struct setup_header {
58 __u32 initrd_addr_max; 70 __u32 initrd_addr_max;
59 __u32 kernel_alignment; 71 __u32 kernel_alignment;
60 __u8 relocatable_kernel; 72 __u8 relocatable_kernel;
61 __u8 _pad2[3]; 73 __u8 min_alignment;
74 __u16 xloadflags;
62 __u32 cmdline_size; 75 __u32 cmdline_size;
63 __u32 hardware_subarch; 76 __u32 hardware_subarch;
64 __u64 hardware_subarch_data; 77 __u64 hardware_subarch_data;
@@ -106,7 +119,10 @@ struct boot_params {
106 __u8 hd1_info[16]; /* obsolete! */ /* 0x090 */ 119 __u8 hd1_info[16]; /* obsolete! */ /* 0x090 */
107 struct sys_desc_table sys_desc_table; /* 0x0a0 */ 120 struct sys_desc_table sys_desc_table; /* 0x0a0 */
108 struct olpc_ofw_header olpc_ofw_header; /* 0x0b0 */ 121 struct olpc_ofw_header olpc_ofw_header; /* 0x0b0 */
109 __u8 _pad4[128]; /* 0x0c0 */ 122 __u32 ext_ramdisk_image; /* 0x0c0 */
123 __u32 ext_ramdisk_size; /* 0x0c4 */
124 __u32 ext_cmd_line_ptr; /* 0x0c8 */
125 __u8 _pad4[116]; /* 0x0cc */
110 struct edid_info edid_info; /* 0x140 */ 126 struct edid_info edid_info; /* 0x140 */
111 struct efi_info efi_info; /* 0x1c0 */ 127 struct efi_info efi_info; /* 0x1c0 */
112 __u32 alt_mem_k; /* 0x1e0 */ 128 __u32 alt_mem_k; /* 0x1e0 */
@@ -115,7 +131,20 @@ struct boot_params {
115 __u8 eddbuf_entries; /* 0x1e9 */ 131 __u8 eddbuf_entries; /* 0x1e9 */
116 __u8 edd_mbr_sig_buf_entries; /* 0x1ea */ 132 __u8 edd_mbr_sig_buf_entries; /* 0x1ea */
117 __u8 kbd_status; /* 0x1eb */ 133 __u8 kbd_status; /* 0x1eb */
118 __u8 _pad6[5]; /* 0x1ec */ 134 __u8 _pad5[3]; /* 0x1ec */
135 /*
136 * The sentinel is set to a nonzero value (0xff) in header.S.
137 *
138 * A bootloader is supposed to only take setup_header and put
139 * it into a clean boot_params buffer. If it turns out that
140 * it is clumsy or too generous with the buffer, it most
141 * probably will pick up the sentinel variable too. The fact
142 * that this variable then is still 0xff will let kernel
143 * know that some variables in boot_params are invalid and
144 * kernel should zero out certain portions of boot_params.
145 */
146 __u8 sentinel; /* 0x1ef */
147 __u8 _pad6[1]; /* 0x1f0 */
119 struct setup_header hdr; /* setup header */ /* 0x1f1 */ 148 struct setup_header hdr; /* setup header */ /* 0x1f1 */
120 __u8 _pad7[0x290-0x1f1-sizeof(struct setup_header)]; 149 __u8 _pad7[0x290-0x1f1-sizeof(struct setup_header)];
121 __u32 edd_mbr_sig_buffer[EDD_MBR_SIG_MAX]; /* 0x290 */ 150 __u32 edd_mbr_sig_buffer[EDD_MBR_SIG_MAX]; /* 0x290 */
@@ -134,6 +163,6 @@ enum {
134 X86_NR_SUBARCHS, 163 X86_NR_SUBARCHS,
135}; 164};
136 165
137 166#endif /* __ASSEMBLY__ */
138 167
139#endif /* _ASM_X86_BOOTPARAM_H */ 168#endif /* _ASM_X86_BOOTPARAM_H */
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 4428fd178bce..6774c17a5576 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -340,9 +340,6 @@ int x86_setup_perfctr(struct perf_event *event)
340 /* BTS is currently only allowed for user-mode. */ 340 /* BTS is currently only allowed for user-mode. */
341 if (!attr->exclude_kernel) 341 if (!attr->exclude_kernel)
342 return -EOPNOTSUPP; 342 return -EOPNOTSUPP;
343
344 if (!attr->exclude_guest)
345 return -EOPNOTSUPP;
346 } 343 }
347 344
348 hwc->config |= config; 345 hwc->config |= config;
@@ -385,9 +382,6 @@ int x86_pmu_hw_config(struct perf_event *event)
385 if (event->attr.precise_ip) { 382 if (event->attr.precise_ip) {
386 int precise = 0; 383 int precise = 0;
387 384
388 if (!event->attr.exclude_guest)
389 return -EOPNOTSUPP;
390
391 /* Support for constant skid */ 385 /* Support for constant skid */
392 if (x86_pmu.pebs_active && !x86_pmu.pebs_broken) { 386 if (x86_pmu.pebs_active && !x86_pmu.pebs_broken) {
393 precise++; 387 precise++;
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
index 3cf3d97cce3a..b43200dbfe7e 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
@@ -2500,7 +2500,7 @@ static bool pcidrv_registered;
2500/* 2500/*
2501 * add a pci uncore device 2501 * add a pci uncore device
2502 */ 2502 */
2503static int __devinit uncore_pci_add(struct intel_uncore_type *type, struct pci_dev *pdev) 2503static int uncore_pci_add(struct intel_uncore_type *type, struct pci_dev *pdev)
2504{ 2504{
2505 struct intel_uncore_pmu *pmu; 2505 struct intel_uncore_pmu *pmu;
2506 struct intel_uncore_box *box; 2506 struct intel_uncore_box *box;
@@ -2571,8 +2571,8 @@ static void uncore_pci_remove(struct pci_dev *pdev)
2571 kfree(box); 2571 kfree(box);
2572} 2572}
2573 2573
2574static int __devinit uncore_pci_probe(struct pci_dev *pdev, 2574static int uncore_pci_probe(struct pci_dev *pdev,
2575 const struct pci_device_id *id) 2575 const struct pci_device_id *id)
2576{ 2576{
2577 struct intel_uncore_type *type; 2577 struct intel_uncore_type *type;
2578 2578
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index ff84d5469d77..6ed91d9980e2 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -1065,7 +1065,6 @@ ENTRY(xen_failsafe_callback)
1065 lea 16(%esp),%esp 1065 lea 16(%esp),%esp
1066 CFI_ADJUST_CFA_OFFSET -16 1066 CFI_ADJUST_CFA_OFFSET -16
1067 jz 5f 1067 jz 5f
1068 addl $16,%esp
1069 jmp iret_exc 1068 jmp iret_exc
10705: pushl_cfi $-1 /* orig_ax = -1 => not a system call */ 10695: pushl_cfi $-1 /* orig_ax = -1 => not a system call */
1071 SAVE_ALL 1070 SAVE_ALL
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 07a7a04529bc..cb3c591339aa 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -1781,6 +1781,7 @@ first_nmi:
1781 * Leave room for the "copied" frame 1781 * Leave room for the "copied" frame
1782 */ 1782 */
1783 subq $(5*8), %rsp 1783 subq $(5*8), %rsp
1784 CFI_ADJUST_CFA_OFFSET 5*8
1784 1785
1785 /* Copy the stack frame to the Saved frame */ 1786 /* Copy the stack frame to the Saved frame */
1786 .rept 5 1787 .rept 5
@@ -1863,10 +1864,8 @@ end_repeat_nmi:
1863nmi_swapgs: 1864nmi_swapgs:
1864 SWAPGS_UNSAFE_STACK 1865 SWAPGS_UNSAFE_STACK
1865nmi_restore: 1866nmi_restore:
1866 RESTORE_ALL 8 1867 /* Pop the extra iret frame at once */
1867 1868 RESTORE_ALL 6*8
1868 /* Pop the extra iret frame */
1869 addq $(5*8), %rsp
1870 1869
1871 /* Clear the NMI executing stack variable */ 1870 /* Clear the NMI executing stack variable */
1872 movq $0, 5*8(%rsp) 1871 movq $0, 5*8(%rsp)
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index 8e7f6556028f..c8932c79e78b 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -300,6 +300,12 @@ ENTRY(startup_32_smp)
300 leal -__PAGE_OFFSET(%ecx),%esp 300 leal -__PAGE_OFFSET(%ecx),%esp
301 301
302default_entry: 302default_entry:
303#define CR0_STATE (X86_CR0_PE | X86_CR0_MP | X86_CR0_ET | \
304 X86_CR0_NE | X86_CR0_WP | X86_CR0_AM | \
305 X86_CR0_PG)
306 movl $(CR0_STATE & ~X86_CR0_PG),%eax
307 movl %eax,%cr0
308
303/* 309/*
304 * New page tables may be in 4Mbyte page mode and may 310 * New page tables may be in 4Mbyte page mode and may
305 * be using the global pages. 311 * be using the global pages.
@@ -364,8 +370,7 @@ default_entry:
364 */ 370 */
365 movl $pa(initial_page_table), %eax 371 movl $pa(initial_page_table), %eax
366 movl %eax,%cr3 /* set the page table pointer.. */ 372 movl %eax,%cr3 /* set the page table pointer.. */
367 movl %cr0,%eax 373 movl $CR0_STATE,%eax
368 orl $X86_CR0_PG,%eax
369 movl %eax,%cr0 /* ..and set paging (PG) bit */ 374 movl %eax,%cr0 /* ..and set paging (PG) bit */
370 ljmp $__BOOT_CS,$1f /* Clear prefetch and normalize %eip */ 375 ljmp $__BOOT_CS,$1f /* Clear prefetch and normalize %eip */
3711: 3761:
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index 08b973f64032..9c2bd8bd4b4c 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -43,6 +43,7 @@
43#include <asm/apicdef.h> 43#include <asm/apicdef.h>
44#include <asm/hypervisor.h> 44#include <asm/hypervisor.h>
45#include <asm/kvm_guest.h> 45#include <asm/kvm_guest.h>
46#include <asm/context_tracking.h>
46 47
47static int kvmapf = 1; 48static int kvmapf = 1;
48 49
@@ -121,6 +122,8 @@ void kvm_async_pf_task_wait(u32 token)
121 struct kvm_task_sleep_node n, *e; 122 struct kvm_task_sleep_node n, *e;
122 DEFINE_WAIT(wait); 123 DEFINE_WAIT(wait);
123 124
125 rcu_irq_enter();
126
124 spin_lock(&b->lock); 127 spin_lock(&b->lock);
125 e = _find_apf_task(b, token); 128 e = _find_apf_task(b, token);
126 if (e) { 129 if (e) {
@@ -128,6 +131,8 @@ void kvm_async_pf_task_wait(u32 token)
128 hlist_del(&e->link); 131 hlist_del(&e->link);
129 kfree(e); 132 kfree(e);
130 spin_unlock(&b->lock); 133 spin_unlock(&b->lock);
134
135 rcu_irq_exit();
131 return; 136 return;
132 } 137 }
133 138
@@ -152,13 +157,16 @@ void kvm_async_pf_task_wait(u32 token)
152 /* 157 /*
153 * We cannot reschedule. So halt. 158 * We cannot reschedule. So halt.
154 */ 159 */
160 rcu_irq_exit();
155 native_safe_halt(); 161 native_safe_halt();
162 rcu_irq_enter();
156 local_irq_disable(); 163 local_irq_disable();
157 } 164 }
158 } 165 }
159 if (!n.halted) 166 if (!n.halted)
160 finish_wait(&n.wq, &wait); 167 finish_wait(&n.wq, &wait);
161 168
169 rcu_irq_exit();
162 return; 170 return;
163} 171}
164EXPORT_SYMBOL_GPL(kvm_async_pf_task_wait); 172EXPORT_SYMBOL_GPL(kvm_async_pf_task_wait);
@@ -252,10 +260,10 @@ do_async_page_fault(struct pt_regs *regs, unsigned long error_code)
252 break; 260 break;
253 case KVM_PV_REASON_PAGE_NOT_PRESENT: 261 case KVM_PV_REASON_PAGE_NOT_PRESENT:
254 /* page is swapped out by the host. */ 262 /* page is swapped out by the host. */
255 rcu_irq_enter(); 263 exception_enter(regs);
256 exit_idle(); 264 exit_idle();
257 kvm_async_pf_task_wait((u32)read_cr2()); 265 kvm_async_pf_task_wait((u32)read_cr2());
258 rcu_irq_exit(); 266 exception_exit(regs);
259 break; 267 break;
260 case KVM_PV_REASON_PAGE_READY: 268 case KVM_PV_REASON_PAGE_READY:
261 rcu_irq_enter(); 269 rcu_irq_enter();
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c
index a7c5661f8496..4929502c1372 100644
--- a/arch/x86/kernel/msr.c
+++ b/arch/x86/kernel/msr.c
@@ -174,6 +174,9 @@ static int msr_open(struct inode *inode, struct file *file)
174 unsigned int cpu; 174 unsigned int cpu;
175 struct cpuinfo_x86 *c; 175 struct cpuinfo_x86 *c;
176 176
177 if (!capable(CAP_SYS_RAWIO))
178 return -EPERM;
179
177 cpu = iminor(file->f_path.dentry->d_inode); 180 cpu = iminor(file->f_path.dentry->d_inode);
178 if (cpu >= nr_cpu_ids || !cpu_online(cpu)) 181 if (cpu >= nr_cpu_ids || !cpu_online(cpu))
179 return -ENXIO; /* No such CPU */ 182 return -ENXIO; /* No such CPU */
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index de2b7ad70273..872079a67e4d 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -56,7 +56,7 @@ struct device x86_dma_fallback_dev = {
56EXPORT_SYMBOL(x86_dma_fallback_dev); 56EXPORT_SYMBOL(x86_dma_fallback_dev);
57 57
58/* Number of entries preallocated for DMA-API debugging */ 58/* Number of entries preallocated for DMA-API debugging */
59#define PREALLOC_DMA_DEBUG_ENTRIES 32768 59#define PREALLOC_DMA_DEBUG_ENTRIES 65536
60 60
61int dma_set_mask(struct device *dev, u64 mask) 61int dma_set_mask(struct device *dev, u64 mask)
62{ 62{
@@ -265,7 +265,7 @@ rootfs_initcall(pci_iommu_init);
265#ifdef CONFIG_PCI 265#ifdef CONFIG_PCI
266/* Many VIA bridges seem to corrupt data for DAC. Disable it here */ 266/* Many VIA bridges seem to corrupt data for DAC. Disable it here */
267 267
268static __devinit void via_no_dac(struct pci_dev *dev) 268static void via_no_dac(struct pci_dev *dev)
269{ 269{
270 if (forbid_dac == 0) { 270 if (forbid_dac == 0) {
271 dev_info(&dev->dev, "disabling DAC on VIA PCI bridge\n"); 271 dev_info(&dev->dev, "disabling DAC on VIA PCI bridge\n");
diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c
index 1b27de563561..26ee48a33dc4 100644
--- a/arch/x86/kernel/quirks.c
+++ b/arch/x86/kernel/quirks.c
@@ -8,7 +8,7 @@
8 8
9#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_SMP) && defined(CONFIG_PCI) 9#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_SMP) && defined(CONFIG_PCI)
10 10
11static void __devinit quirk_intel_irqbalance(struct pci_dev *dev) 11static void quirk_intel_irqbalance(struct pci_dev *dev)
12{ 12{
13 u8 config; 13 u8 config;
14 u16 word; 14 u16 word;
@@ -512,7 +512,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS,
512 512
513#if defined(CONFIG_PCI) && defined(CONFIG_NUMA) 513#if defined(CONFIG_PCI) && defined(CONFIG_NUMA)
514/* Set correct numa_node information for AMD NB functions */ 514/* Set correct numa_node information for AMD NB functions */
515static void __devinit quirk_amd_nb_node(struct pci_dev *dev) 515static void quirk_amd_nb_node(struct pci_dev *dev)
516{ 516{
517 struct pci_dev *nb_ht; 517 struct pci_dev *nb_ht;
518 unsigned int devfn; 518 unsigned int devfn;
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 4e8ba39eaf0f..76fa1e9a2b39 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -584,7 +584,7 @@ static void native_machine_emergency_restart(void)
584 break; 584 break;
585 585
586 case BOOT_EFI: 586 case BOOT_EFI:
587 if (efi_enabled) 587 if (efi_enabled(EFI_RUNTIME_SERVICES))
588 efi.reset_system(reboot_mode ? 588 efi.reset_system(reboot_mode ?
589 EFI_RESET_WARM : 589 EFI_RESET_WARM :
590 EFI_RESET_COLD, 590 EFI_RESET_COLD,
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 23ddd558fbd5..8b24289cc10c 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -610,6 +610,83 @@ static __init void reserve_ibft_region(void)
610 610
611static unsigned reserve_low = CONFIG_X86_RESERVE_LOW << 10; 611static unsigned reserve_low = CONFIG_X86_RESERVE_LOW << 10;
612 612
613static bool __init snb_gfx_workaround_needed(void)
614{
615#ifdef CONFIG_PCI
616 int i;
617 u16 vendor, devid;
618 static const __initconst u16 snb_ids[] = {
619 0x0102,
620 0x0112,
621 0x0122,
622 0x0106,
623 0x0116,
624 0x0126,
625 0x010a,
626 };
627
628 /* Assume no if something weird is going on with PCI */
629 if (!early_pci_allowed())
630 return false;
631
632 vendor = read_pci_config_16(0, 2, 0, PCI_VENDOR_ID);
633 if (vendor != 0x8086)
634 return false;
635
636 devid = read_pci_config_16(0, 2, 0, PCI_DEVICE_ID);
637 for (i = 0; i < ARRAY_SIZE(snb_ids); i++)
638 if (devid == snb_ids[i])
639 return true;
640#endif
641
642 return false;
643}
644
645/*
646 * Sandy Bridge graphics has trouble with certain ranges, exclude
647 * them from allocation.
648 */
649static void __init trim_snb_memory(void)
650{
651 static const __initconst unsigned long bad_pages[] = {
652 0x20050000,
653 0x20110000,
654 0x20130000,
655 0x20138000,
656 0x40004000,
657 };
658 int i;
659
660 if (!snb_gfx_workaround_needed())
661 return;
662
663 printk(KERN_DEBUG "reserving inaccessible SNB gfx pages\n");
664
665 /*
666 * Reserve all memory below the 1 MB mark that has not
667 * already been reserved.
668 */
669 memblock_reserve(0, 1<<20);
670
671 for (i = 0; i < ARRAY_SIZE(bad_pages); i++) {
672 if (memblock_reserve(bad_pages[i], PAGE_SIZE))
673 printk(KERN_WARNING "failed to reserve 0x%08lx\n",
674 bad_pages[i]);
675 }
676}
677
678/*
679 * Here we put platform-specific memory range workarounds, i.e.
680 * memory known to be corrupt or otherwise in need to be reserved on
681 * specific platforms.
682 *
683 * If this gets used more widely it could use a real dispatch mechanism.
684 */
685static void __init trim_platform_memory_ranges(void)
686{
687 trim_snb_memory();
688}
689
613static void __init trim_bios_range(void) 690static void __init trim_bios_range(void)
614{ 691{
615 /* 692 /*
@@ -630,6 +707,7 @@ static void __init trim_bios_range(void)
630 * take them out. 707 * take them out.
631 */ 708 */
632 e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1); 709 e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1);
710
633 sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); 711 sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
634} 712}
635 713
@@ -729,15 +807,15 @@ void __init setup_arch(char **cmdline_p)
729#ifdef CONFIG_EFI 807#ifdef CONFIG_EFI
730 if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature, 808 if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
731 "EL32", 4)) { 809 "EL32", 4)) {
732 efi_enabled = 1; 810 set_bit(EFI_BOOT, &x86_efi_facility);
733 efi_64bit = false;
734 } else if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature, 811 } else if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
735 "EL64", 4)) { 812 "EL64", 4)) {
736 efi_enabled = 1; 813 set_bit(EFI_BOOT, &x86_efi_facility);
737 efi_64bit = true; 814 set_bit(EFI_64BIT, &x86_efi_facility);
738 } 815 }
739 if (efi_enabled && efi_memblock_x86_reserve_range()) 816
740 efi_enabled = 0; 817 if (efi_enabled(EFI_BOOT))
818 efi_memblock_x86_reserve_range();
741#endif 819#endif
742 820
743 x86_init.oem.arch_setup(); 821 x86_init.oem.arch_setup();
@@ -810,7 +888,7 @@ void __init setup_arch(char **cmdline_p)
810 888
811 finish_e820_parsing(); 889 finish_e820_parsing();
812 890
813 if (efi_enabled) 891 if (efi_enabled(EFI_BOOT))
814 efi_init(); 892 efi_init();
815 893
816 dmi_scan_machine(); 894 dmi_scan_machine();
@@ -893,7 +971,7 @@ void __init setup_arch(char **cmdline_p)
893 * The EFI specification says that boot service code won't be called 971 * The EFI specification says that boot service code won't be called
894 * after ExitBootServices(). This is, in fact, a lie. 972 * after ExitBootServices(). This is, in fact, a lie.
895 */ 973 */
896 if (efi_enabled) 974 if (efi_enabled(EFI_MEMMAP))
897 efi_reserve_boot_services(); 975 efi_reserve_boot_services();
898 976
899 /* preallocate 4k for mptable mpc */ 977 /* preallocate 4k for mptable mpc */
@@ -908,6 +986,8 @@ void __init setup_arch(char **cmdline_p)
908 986
909 setup_real_mode(); 987 setup_real_mode();
910 988
989 trim_platform_memory_ranges();
990
911 init_gbpages(); 991 init_gbpages();
912 992
913 /* max_pfn_mapped is updated here */ 993 /* max_pfn_mapped is updated here */
@@ -1034,7 +1114,7 @@ void __init setup_arch(char **cmdline_p)
1034 1114
1035#ifdef CONFIG_VT 1115#ifdef CONFIG_VT
1036#if defined(CONFIG_VGA_CONSOLE) 1116#if defined(CONFIG_VGA_CONSOLE)
1037 if (!efi_enabled || (efi_mem_type(0xa0000) != EFI_CONVENTIONAL_MEMORY)) 1117 if (!efi_enabled(EFI_BOOT) || (efi_mem_type(0xa0000) != EFI_CONVENTIONAL_MEMORY))
1038 conswitchp = &vga_con; 1118 conswitchp = &vga_con;
1039#elif defined(CONFIG_DUMMY_CONSOLE) 1119#elif defined(CONFIG_DUMMY_CONSOLE)
1040 conswitchp = &dummy_con; 1120 conswitchp = &dummy_con;
@@ -1051,14 +1131,14 @@ void __init setup_arch(char **cmdline_p)
1051 register_refined_jiffies(CLOCK_TICK_RATE); 1131 register_refined_jiffies(CLOCK_TICK_RATE);
1052 1132
1053#ifdef CONFIG_EFI 1133#ifdef CONFIG_EFI
1054 /* Once setup is done above, disable efi_enabled on mismatched 1134 /* Once setup is done above, unmap the EFI memory map on
1055 * firmware/kernel archtectures since there is no support for 1135 * mismatched firmware/kernel archtectures since there is no
1056 * runtime services. 1136 * support for runtime services.
1057 */ 1137 */
1058 if (efi_enabled && IS_ENABLED(CONFIG_X86_64) != efi_64bit) { 1138 if (efi_enabled(EFI_BOOT) &&
1139 IS_ENABLED(CONFIG_X86_64) != efi_enabled(EFI_64BIT)) {
1059 pr_info("efi: Setup done, disabling due to 32/64-bit mismatch\n"); 1140 pr_info("efi: Setup done, disabling due to 32/64-bit mismatch\n");
1060 efi_unmap_memmap(); 1141 efi_unmap_memmap();
1061 efi_enabled = 0;
1062 } 1142 }
1063#endif 1143#endif
1064} 1144}
diff --git a/arch/x86/kernel/step.c b/arch/x86/kernel/step.c
index cd3b2438a980..9b4d51d0c0d0 100644
--- a/arch/x86/kernel/step.c
+++ b/arch/x86/kernel/step.c
@@ -165,10 +165,11 @@ void set_task_blockstep(struct task_struct *task, bool on)
165 * Ensure irq/preemption can't change debugctl in between. 165 * Ensure irq/preemption can't change debugctl in between.
166 * Note also that both TIF_BLOCKSTEP and debugctl should 166 * Note also that both TIF_BLOCKSTEP and debugctl should
167 * be changed atomically wrt preemption. 167 * be changed atomically wrt preemption.
168 * FIXME: this means that set/clear TIF_BLOCKSTEP is simply 168 *
169 * wrong if task != current, SIGKILL can wakeup the stopped 169 * NOTE: this means that set/clear TIF_BLOCKSTEP is only safe if
170 * tracee and set/clear can play with the running task, this 170 * task is current or it can't be running, otherwise we can race
171 * can confuse the next __switch_to_xtra(). 171 * with __switch_to_xtra(). We rely on ptrace_freeze_traced() but
172 * PTRACE_KILL is not safe.
172 */ 173 */
173 local_irq_disable(); 174 local_irq_disable();
174 debugctl = get_debugctlmsr(); 175 debugctl = get_debugctlmsr();
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 76f54461f7cb..c243b81e3c74 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -120,7 +120,7 @@ struct kvm_shared_msrs {
120}; 120};
121 121
122static struct kvm_shared_msrs_global __read_mostly shared_msrs_global; 122static struct kvm_shared_msrs_global __read_mostly shared_msrs_global;
123static DEFINE_PER_CPU(struct kvm_shared_msrs, shared_msrs); 123static struct kvm_shared_msrs __percpu *shared_msrs;
124 124
125struct kvm_stats_debugfs_item debugfs_entries[] = { 125struct kvm_stats_debugfs_item debugfs_entries[] = {
126 { "pf_fixed", VCPU_STAT(pf_fixed) }, 126 { "pf_fixed", VCPU_STAT(pf_fixed) },
@@ -191,10 +191,10 @@ static void kvm_on_user_return(struct user_return_notifier *urn)
191 191
192static void shared_msr_update(unsigned slot, u32 msr) 192static void shared_msr_update(unsigned slot, u32 msr)
193{ 193{
194 struct kvm_shared_msrs *smsr;
195 u64 value; 194 u64 value;
195 unsigned int cpu = smp_processor_id();
196 struct kvm_shared_msrs *smsr = per_cpu_ptr(shared_msrs, cpu);
196 197
197 smsr = &__get_cpu_var(shared_msrs);
198 /* only read, and nobody should modify it at this time, 198 /* only read, and nobody should modify it at this time,
199 * so don't need lock */ 199 * so don't need lock */
200 if (slot >= shared_msrs_global.nr) { 200 if (slot >= shared_msrs_global.nr) {
@@ -226,7 +226,8 @@ static void kvm_shared_msr_cpu_online(void)
226 226
227void kvm_set_shared_msr(unsigned slot, u64 value, u64 mask) 227void kvm_set_shared_msr(unsigned slot, u64 value, u64 mask)
228{ 228{
229 struct kvm_shared_msrs *smsr = &__get_cpu_var(shared_msrs); 229 unsigned int cpu = smp_processor_id();
230 struct kvm_shared_msrs *smsr = per_cpu_ptr(shared_msrs, cpu);
230 231
231 if (((value ^ smsr->values[slot].curr) & mask) == 0) 232 if (((value ^ smsr->values[slot].curr) & mask) == 0)
232 return; 233 return;
@@ -242,7 +243,8 @@ EXPORT_SYMBOL_GPL(kvm_set_shared_msr);
242 243
243static void drop_user_return_notifiers(void *ignore) 244static void drop_user_return_notifiers(void *ignore)
244{ 245{
245 struct kvm_shared_msrs *smsr = &__get_cpu_var(shared_msrs); 246 unsigned int cpu = smp_processor_id();
247 struct kvm_shared_msrs *smsr = per_cpu_ptr(shared_msrs, cpu);
246 248
247 if (smsr->registered) 249 if (smsr->registered)
248 kvm_on_user_return(&smsr->urn); 250 kvm_on_user_return(&smsr->urn);
@@ -5233,9 +5235,16 @@ int kvm_arch_init(void *opaque)
5233 goto out; 5235 goto out;
5234 } 5236 }
5235 5237
5238 r = -ENOMEM;
5239 shared_msrs = alloc_percpu(struct kvm_shared_msrs);
5240 if (!shared_msrs) {
5241 printk(KERN_ERR "kvm: failed to allocate percpu kvm_shared_msrs\n");
5242 goto out;
5243 }
5244
5236 r = kvm_mmu_module_init(); 5245 r = kvm_mmu_module_init();
5237 if (r) 5246 if (r)
5238 goto out; 5247 goto out_free_percpu;
5239 5248
5240 kvm_set_mmio_spte_mask(); 5249 kvm_set_mmio_spte_mask();
5241 kvm_init_msr_list(); 5250 kvm_init_msr_list();
@@ -5258,6 +5267,8 @@ int kvm_arch_init(void *opaque)
5258 5267
5259 return 0; 5268 return 0;
5260 5269
5270out_free_percpu:
5271 free_percpu(shared_msrs);
5261out: 5272out:
5262 return r; 5273 return r;
5263} 5274}
@@ -5275,6 +5286,7 @@ void kvm_arch_exit(void)
5275#endif 5286#endif
5276 kvm_x86_ops = NULL; 5287 kvm_x86_ops = NULL;
5277 kvm_mmu_module_exit(); 5288 kvm_mmu_module_exit();
5289 free_percpu(shared_msrs);
5278} 5290}
5279 5291
5280int kvm_emulate_halt(struct kvm_vcpu *vcpu) 5292int kvm_emulate_halt(struct kvm_vcpu *vcpu)
diff --git a/arch/x86/lib/delay.c b/arch/x86/lib/delay.c
index e395693abdb1..7c3bee636e2f 100644
--- a/arch/x86/lib/delay.c
+++ b/arch/x86/lib/delay.c
@@ -98,7 +98,7 @@ void use_tsc_delay(void)
98 delay_fn = delay_tsc; 98 delay_fn = delay_tsc;
99} 99}
100 100
101int __devinit read_current_timer(unsigned long *timer_val) 101int read_current_timer(unsigned long *timer_val)
102{ 102{
103 if (delay_fn == delay_tsc) { 103 if (delay_fn == delay_tsc) {
104 rdtscll(*timer_val); 104 rdtscll(*timer_val);
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 0c01261fe5a8..53ea60458e01 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -145,7 +145,7 @@ void __init pci_acpi_crs_quirks(void)
145} 145}
146 146
147#ifdef CONFIG_PCI_MMCONFIG 147#ifdef CONFIG_PCI_MMCONFIG
148static int __devinit check_segment(u16 seg, struct device *dev, char *estr) 148static int check_segment(u16 seg, struct device *dev, char *estr)
149{ 149{
150 if (seg) { 150 if (seg) {
151 dev_err(dev, 151 dev_err(dev,
@@ -168,9 +168,8 @@ static int __devinit check_segment(u16 seg, struct device *dev, char *estr)
168 return 0; 168 return 0;
169} 169}
170 170
171static int __devinit setup_mcfg_map(struct pci_root_info *info, 171static int setup_mcfg_map(struct pci_root_info *info, u16 seg, u8 start,
172 u16 seg, u8 start, u8 end, 172 u8 end, phys_addr_t addr)
173 phys_addr_t addr)
174{ 173{
175 int result; 174 int result;
176 struct device *dev = &info->bridge->dev; 175 struct device *dev = &info->bridge->dev;
@@ -208,7 +207,7 @@ static void teardown_mcfg_map(struct pci_root_info *info)
208 } 207 }
209} 208}
210#else 209#else
211static int __devinit setup_mcfg_map(struct pci_root_info *info, 210static int setup_mcfg_map(struct pci_root_info *info,
212 u16 seg, u8 start, u8 end, 211 u16 seg, u8 start, u8 end,
213 phys_addr_t addr) 212 phys_addr_t addr)
214{ 213{
@@ -474,7 +473,7 @@ probe_pci_root_info(struct pci_root_info *info, struct acpi_device *device,
474 info); 473 info);
475} 474}
476 475
477struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root) 476struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
478{ 477{
479 struct acpi_device *device = root->device; 478 struct acpi_device *device = root->device;
480 struct pci_root_info *info = NULL; 479 struct pci_root_info *info = NULL;
diff --git a/arch/x86/pci/bus_numa.c b/arch/x86/pci/bus_numa.c
index d37e2fec97e5..c2735feb2508 100644
--- a/arch/x86/pci/bus_numa.c
+++ b/arch/x86/pci/bus_numa.c
@@ -93,8 +93,8 @@ struct pci_root_info __init *alloc_pci_root_info(int bus_min, int bus_max,
93 return info; 93 return info;
94} 94}
95 95
96void __devinit update_res(struct pci_root_info *info, resource_size_t start, 96void update_res(struct pci_root_info *info, resource_size_t start,
97 resource_size_t end, unsigned long flags, int merge) 97 resource_size_t end, unsigned long flags, int merge)
98{ 98{
99 struct resource *res; 99 struct resource *res;
100 struct pci_root_res *root_res; 100 struct pci_root_res *root_res;
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 1b1dda90a945..ccd0ab3ab899 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -81,14 +81,14 @@ struct pci_ops pci_root_ops = {
81 */ 81 */
82DEFINE_RAW_SPINLOCK(pci_config_lock); 82DEFINE_RAW_SPINLOCK(pci_config_lock);
83 83
84static int __devinit can_skip_ioresource_align(const struct dmi_system_id *d) 84static int can_skip_ioresource_align(const struct dmi_system_id *d)
85{ 85{
86 pci_probe |= PCI_CAN_SKIP_ISA_ALIGN; 86 pci_probe |= PCI_CAN_SKIP_ISA_ALIGN;
87 printk(KERN_INFO "PCI: %s detected, can skip ISA alignment\n", d->ident); 87 printk(KERN_INFO "PCI: %s detected, can skip ISA alignment\n", d->ident);
88 return 0; 88 return 0;
89} 89}
90 90
91static const struct dmi_system_id can_skip_pciprobe_dmi_table[] __devinitconst = { 91static const struct dmi_system_id can_skip_pciprobe_dmi_table[] = {
92/* 92/*
93 * Systems where PCI IO resource ISA alignment can be skipped 93 * Systems where PCI IO resource ISA alignment can be skipped
94 * when the ISA enable bit in the bridge control is not set 94 * when the ISA enable bit in the bridge control is not set
@@ -125,7 +125,7 @@ void __init dmi_check_skip_isa_align(void)
125 dmi_check_system(can_skip_pciprobe_dmi_table); 125 dmi_check_system(can_skip_pciprobe_dmi_table);
126} 126}
127 127
128static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev) 128static void pcibios_fixup_device_resources(struct pci_dev *dev)
129{ 129{
130 struct resource *rom_r = &dev->resource[PCI_ROM_RESOURCE]; 130 struct resource *rom_r = &dev->resource[PCI_ROM_RESOURCE];
131 struct resource *bar_r; 131 struct resource *bar_r;
@@ -162,7 +162,7 @@ static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev)
162 * are examined. 162 * are examined.
163 */ 163 */
164 164
165void __devinit pcibios_fixup_bus(struct pci_bus *b) 165void pcibios_fixup_bus(struct pci_bus *b)
166{ 166{
167 struct pci_dev *dev; 167 struct pci_dev *dev;
168 168
@@ -176,7 +176,7 @@ void __devinit pcibios_fixup_bus(struct pci_bus *b)
176 * on the kernel command line (which was parsed earlier). 176 * on the kernel command line (which was parsed earlier).
177 */ 177 */
178 178
179static int __devinit set_bf_sort(const struct dmi_system_id *d) 179static int set_bf_sort(const struct dmi_system_id *d)
180{ 180{
181 if (pci_bf_sort == pci_bf_sort_default) { 181 if (pci_bf_sort == pci_bf_sort_default) {
182 pci_bf_sort = pci_dmi_bf; 182 pci_bf_sort = pci_dmi_bf;
@@ -185,7 +185,7 @@ static int __devinit set_bf_sort(const struct dmi_system_id *d)
185 return 0; 185 return 0;
186} 186}
187 187
188static void __devinit read_dmi_type_b1(const struct dmi_header *dm, 188static void read_dmi_type_b1(const struct dmi_header *dm,
189 void *private_data) 189 void *private_data)
190{ 190{
191 u8 *d = (u8 *)dm + 4; 191 u8 *d = (u8 *)dm + 4;
@@ -207,7 +207,7 @@ static void __devinit read_dmi_type_b1(const struct dmi_header *dm,
207 } 207 }
208} 208}
209 209
210static int __devinit find_sort_method(const struct dmi_system_id *d) 210static int find_sort_method(const struct dmi_system_id *d)
211{ 211{
212 dmi_walk(read_dmi_type_b1, NULL); 212 dmi_walk(read_dmi_type_b1, NULL);
213 213
@@ -222,7 +222,7 @@ static int __devinit find_sort_method(const struct dmi_system_id *d)
222 * Enable renumbering of PCI bus# ranges to reach all PCI busses (Cardbus) 222 * Enable renumbering of PCI bus# ranges to reach all PCI busses (Cardbus)
223 */ 223 */
224#ifdef __i386__ 224#ifdef __i386__
225static int __devinit assign_all_busses(const struct dmi_system_id *d) 225static int assign_all_busses(const struct dmi_system_id *d)
226{ 226{
227 pci_probe |= PCI_ASSIGN_ALL_BUSSES; 227 pci_probe |= PCI_ASSIGN_ALL_BUSSES;
228 printk(KERN_INFO "%s detected: enabling PCI bus# renumbering" 228 printk(KERN_INFO "%s detected: enabling PCI bus# renumbering"
@@ -231,7 +231,7 @@ static int __devinit assign_all_busses(const struct dmi_system_id *d)
231} 231}
232#endif 232#endif
233 233
234static int __devinit set_scan_all(const struct dmi_system_id *d) 234static int set_scan_all(const struct dmi_system_id *d)
235{ 235{
236 printk(KERN_INFO "PCI: %s detected, enabling pci=pcie_scan_all\n", 236 printk(KERN_INFO "PCI: %s detected, enabling pci=pcie_scan_all\n",
237 d->ident); 237 d->ident);
@@ -239,7 +239,7 @@ static int __devinit set_scan_all(const struct dmi_system_id *d)
239 return 0; 239 return 0;
240} 240}
241 241
242static const struct dmi_system_id __devinitconst pciprobe_dmi_table[] = { 242static const struct dmi_system_id pciprobe_dmi_table[] = {
243#ifdef __i386__ 243#ifdef __i386__
244/* 244/*
245 * Laptops which need pci=assign-busses to see Cardbus cards 245 * Laptops which need pci=assign-busses to see Cardbus cards
@@ -434,7 +434,8 @@ static const struct dmi_system_id __devinitconst pciprobe_dmi_table[] = {
434 .callback = set_scan_all, 434 .callback = set_scan_all,
435 .ident = "Stratus/NEC ftServer", 435 .ident = "Stratus/NEC ftServer",
436 .matches = { 436 .matches = {
437 DMI_MATCH(DMI_SYS_VENDOR, "ftServer"), 437 DMI_MATCH(DMI_SYS_VENDOR, "Stratus"),
438 DMI_MATCH(DMI_PRODUCT_NAME, "ftServer"),
438 }, 439 },
439 }, 440 },
440 {} 441 {}
@@ -445,7 +446,7 @@ void __init dmi_check_pciprobe(void)
445 dmi_check_system(pciprobe_dmi_table); 446 dmi_check_system(pciprobe_dmi_table);
446} 447}
447 448
448struct pci_bus * __devinit pcibios_scan_root(int busnum) 449struct pci_bus *pcibios_scan_root(int busnum)
449{ 450{
450 struct pci_bus *bus = NULL; 451 struct pci_bus *bus = NULL;
451 452
@@ -664,7 +665,7 @@ int pci_ext_cfg_avail(void)
664 return 0; 665 return 0;
665} 666}
666 667
667struct pci_bus * __devinit pci_scan_bus_on_node(int busno, struct pci_ops *ops, int node) 668struct pci_bus *pci_scan_bus_on_node(int busno, struct pci_ops *ops, int node)
668{ 669{
669 LIST_HEAD(resources); 670 LIST_HEAD(resources);
670 struct pci_bus *bus = NULL; 671 struct pci_bus *bus = NULL;
@@ -692,7 +693,7 @@ struct pci_bus * __devinit pci_scan_bus_on_node(int busno, struct pci_ops *ops,
692 return bus; 693 return bus;
693} 694}
694 695
695struct pci_bus * __devinit pci_scan_bus_with_sysdata(int busno) 696struct pci_bus *pci_scan_bus_with_sysdata(int busno)
696{ 697{
697 return pci_scan_bus_on_node(busno, &pci_root_ops, -1); 698 return pci_scan_bus_on_node(busno, &pci_root_ops, -1);
698} 699}
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index af8a224db216..f5809fa2753e 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -9,7 +9,7 @@
9#include <linux/vgaarb.h> 9#include <linux/vgaarb.h>
10#include <asm/pci_x86.h> 10#include <asm/pci_x86.h>
11 11
12static void __devinit pci_fixup_i450nx(struct pci_dev *d) 12static void pci_fixup_i450nx(struct pci_dev *d)
13{ 13{
14 /* 14 /*
15 * i450NX -- Find and scan all secondary buses on all PXB's. 15 * i450NX -- Find and scan all secondary buses on all PXB's.
@@ -34,7 +34,7 @@ static void __devinit pci_fixup_i450nx(struct pci_dev *d)
34} 34}
35DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82451NX, pci_fixup_i450nx); 35DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82451NX, pci_fixup_i450nx);
36 36
37static void __devinit pci_fixup_i450gx(struct pci_dev *d) 37static void pci_fixup_i450gx(struct pci_dev *d)
38{ 38{
39 /* 39 /*
40 * i450GX and i450KX -- Find and scan all secondary buses. 40 * i450GX and i450KX -- Find and scan all secondary buses.
@@ -48,7 +48,7 @@ static void __devinit pci_fixup_i450gx(struct pci_dev *d)
48} 48}
49DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454GX, pci_fixup_i450gx); 49DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454GX, pci_fixup_i450gx);
50 50
51static void __devinit pci_fixup_umc_ide(struct pci_dev *d) 51static void pci_fixup_umc_ide(struct pci_dev *d)
52{ 52{
53 /* 53 /*
54 * UM8886BF IDE controller sets region type bits incorrectly, 54 * UM8886BF IDE controller sets region type bits incorrectly,
@@ -62,7 +62,7 @@ static void __devinit pci_fixup_umc_ide(struct pci_dev *d)
62} 62}
63DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8886BF, pci_fixup_umc_ide); 63DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8886BF, pci_fixup_umc_ide);
64 64
65static void __devinit pci_fixup_ncr53c810(struct pci_dev *d) 65static void pci_fixup_ncr53c810(struct pci_dev *d)
66{ 66{
67 /* 67 /*
68 * NCR 53C810 returns class code 0 (at least on some systems). 68 * NCR 53C810 returns class code 0 (at least on some systems).
@@ -75,7 +75,7 @@ static void __devinit pci_fixup_ncr53c810(struct pci_dev *d)
75} 75}
76DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, pci_fixup_ncr53c810); 76DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, pci_fixup_ncr53c810);
77 77
78static void __devinit pci_fixup_latency(struct pci_dev *d) 78static void pci_fixup_latency(struct pci_dev *d)
79{ 79{
80 /* 80 /*
81 * SiS 5597 and 5598 chipsets require latency timer set to 81 * SiS 5597 and 5598 chipsets require latency timer set to
@@ -87,7 +87,7 @@ static void __devinit pci_fixup_latency(struct pci_dev *d)
87DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_5597, pci_fixup_latency); 87DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_5597, pci_fixup_latency);
88DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_5598, pci_fixup_latency); 88DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_5598, pci_fixup_latency);
89 89
90static void __devinit pci_fixup_piix4_acpi(struct pci_dev *d) 90static void pci_fixup_piix4_acpi(struct pci_dev *d)
91{ 91{
92 /* 92 /*
93 * PIIX4 ACPI device: hardwired IRQ9 93 * PIIX4 ACPI device: hardwired IRQ9
@@ -163,7 +163,7 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8367_0, pci_fixup_
163 * system to PCI bus no matter what are their window settings, so they are 163 * system to PCI bus no matter what are their window settings, so they are
164 * "transparent" (or subtractive decoding) from programmers point of view. 164 * "transparent" (or subtractive decoding) from programmers point of view.
165 */ 165 */
166static void __devinit pci_fixup_transparent_bridge(struct pci_dev *dev) 166static void pci_fixup_transparent_bridge(struct pci_dev *dev)
167{ 167{
168 if ((dev->device & 0xff00) == 0x2400) 168 if ((dev->device & 0xff00) == 0x2400)
169 dev->transparent = 1; 169 dev->transparent = 1;
@@ -317,7 +317,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MCH_PC1, pcie_r
317 * video device at this point. 317 * video device at this point.
318 */ 318 */
319 319
320static void __devinit pci_fixup_video(struct pci_dev *pdev) 320static void pci_fixup_video(struct pci_dev *pdev)
321{ 321{
322 struct pci_dev *bridge; 322 struct pci_dev *bridge;
323 struct pci_bus *bus; 323 struct pci_bus *bus;
@@ -357,7 +357,7 @@ DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID,
357 PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video); 357 PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video);
358 358
359 359
360static const struct dmi_system_id __devinitconst msi_k8t_dmi_table[] = { 360static const struct dmi_system_id msi_k8t_dmi_table[] = {
361 { 361 {
362 .ident = "MSI-K8T-Neo2Fir", 362 .ident = "MSI-K8T-Neo2Fir",
363 .matches = { 363 .matches = {
@@ -378,7 +378,7 @@ static const struct dmi_system_id __devinitconst msi_k8t_dmi_table[] = {
378 * The soundcard is only enabled, if the mainborad is identified 378 * The soundcard is only enabled, if the mainborad is identified
379 * via DMI-tables and the soundcard is detected to be off. 379 * via DMI-tables and the soundcard is detected to be off.
380 */ 380 */
381static void __devinit pci_fixup_msi_k8t_onboard_sound(struct pci_dev *dev) 381static void pci_fixup_msi_k8t_onboard_sound(struct pci_dev *dev)
382{ 382{
383 unsigned char val; 383 unsigned char val;
384 if (!dmi_check_system(msi_k8t_dmi_table)) 384 if (!dmi_check_system(msi_k8t_dmi_table))
@@ -414,7 +414,7 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237,
414 */ 414 */
415static u16 toshiba_line_size; 415static u16 toshiba_line_size;
416 416
417static const struct dmi_system_id __devinitconst toshiba_ohci1394_dmi_table[] = { 417static const struct dmi_system_id toshiba_ohci1394_dmi_table[] = {
418 { 418 {
419 .ident = "Toshiba PS5 based laptop", 419 .ident = "Toshiba PS5 based laptop",
420 .matches = { 420 .matches = {
@@ -439,7 +439,7 @@ static const struct dmi_system_id __devinitconst toshiba_ohci1394_dmi_table[] =
439 { } 439 { }
440}; 440};
441 441
442static void __devinit pci_pre_fixup_toshiba_ohci1394(struct pci_dev *dev) 442static void pci_pre_fixup_toshiba_ohci1394(struct pci_dev *dev)
443{ 443{
444 if (!dmi_check_system(toshiba_ohci1394_dmi_table)) 444 if (!dmi_check_system(toshiba_ohci1394_dmi_table))
445 return; /* only applies to certain Toshibas (so far) */ 445 return; /* only applies to certain Toshibas (so far) */
@@ -450,7 +450,7 @@ static void __devinit pci_pre_fixup_toshiba_ohci1394(struct pci_dev *dev)
450DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TI, 0x8032, 450DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TI, 0x8032,
451 pci_pre_fixup_toshiba_ohci1394); 451 pci_pre_fixup_toshiba_ohci1394);
452 452
453static void __devinit pci_post_fixup_toshiba_ohci1394(struct pci_dev *dev) 453static void pci_post_fixup_toshiba_ohci1394(struct pci_dev *dev)
454{ 454{
455 if (!dmi_check_system(toshiba_ohci1394_dmi_table)) 455 if (!dmi_check_system(toshiba_ohci1394_dmi_table))
456 return; /* only applies to certain Toshibas (so far) */ 456 return; /* only applies to certain Toshibas (so far) */
@@ -488,7 +488,7 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY,
488 * Siemens Nixdorf AG FSC Multiprocessor Interrupt Controller: 488 * Siemens Nixdorf AG FSC Multiprocessor Interrupt Controller:
489 * prevent update of the BAR0, which doesn't look like a normal BAR. 489 * prevent update of the BAR0, which doesn't look like a normal BAR.
490 */ 490 */
491static void __devinit pci_siemens_interrupt_controller(struct pci_dev *dev) 491static void pci_siemens_interrupt_controller(struct pci_dev *dev)
492{ 492{
493 dev->resource[0].flags |= IORESOURCE_PCI_FIXED; 493 dev->resource[0].flags |= IORESOURCE_PCI_FIXED;
494} 494}
@@ -531,7 +531,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_ATI, 0x4385, sb600_disable_hpet_bar);
531 * 531 *
532 * Match off the LPC and svid/sdid (older kernels lose the bridge subvendor) 532 * Match off the LPC and svid/sdid (older kernels lose the bridge subvendor)
533 */ 533 */
534static void __devinit twinhead_reserve_killing_zone(struct pci_dev *dev) 534static void twinhead_reserve_killing_zone(struct pci_dev *dev)
535{ 535{
536 if (dev->subsystem_vendor == 0x14FF && dev->subsystem_device == 0xA003) { 536 if (dev->subsystem_vendor == 0x14FF && dev->subsystem_device == 0xA003) {
537 pr_info("Reserving memory on Twinhead H12Y\n"); 537 pr_info("Reserving memory on Twinhead H12Y\n");
diff --git a/arch/x86/pci/legacy.c b/arch/x86/pci/legacy.c
index a1df191129d3..4a2ab9cb3659 100644
--- a/arch/x86/pci/legacy.c
+++ b/arch/x86/pci/legacy.c
@@ -10,7 +10,7 @@
10 * Discover remaining PCI buses in case there are peer host bridges. 10 * Discover remaining PCI buses in case there are peer host bridges.
11 * We use the number of last PCI bus provided by the PCI BIOS. 11 * We use the number of last PCI bus provided by the PCI BIOS.
12 */ 12 */
13static void __devinit pcibios_fixup_peer_bridges(void) 13static void pcibios_fixup_peer_bridges(void)
14{ 14{
15 int n; 15 int n;
16 16
@@ -34,7 +34,7 @@ int __init pci_legacy_init(void)
34 return 0; 34 return 0;
35} 35}
36 36
37void __devinit pcibios_scan_specific_bus(int busn) 37void pcibios_scan_specific_bus(int busn)
38{ 38{
39 int devfn; 39 int devfn;
40 long node; 40 long node;
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
index 704b9ec043d7..fb29968a7cd5 100644
--- a/arch/x86/pci/mmconfig-shared.c
+++ b/arch/x86/pci/mmconfig-shared.c
@@ -49,7 +49,7 @@ static __init void free_all_mmcfg(void)
49 pci_mmconfig_remove(cfg); 49 pci_mmconfig_remove(cfg);
50} 50}
51 51
52static __devinit void list_add_sorted(struct pci_mmcfg_region *new) 52static void list_add_sorted(struct pci_mmcfg_region *new)
53{ 53{
54 struct pci_mmcfg_region *cfg; 54 struct pci_mmcfg_region *cfg;
55 55
@@ -65,9 +65,8 @@ static __devinit void list_add_sorted(struct pci_mmcfg_region *new)
65 list_add_tail_rcu(&new->list, &pci_mmcfg_list); 65 list_add_tail_rcu(&new->list, &pci_mmcfg_list);
66} 66}
67 67
68static __devinit struct pci_mmcfg_region *pci_mmconfig_alloc(int segment, 68static struct pci_mmcfg_region *pci_mmconfig_alloc(int segment, int start,
69 int start, 69 int end, u64 addr)
70 int end, u64 addr)
71{ 70{
72 struct pci_mmcfg_region *new; 71 struct pci_mmcfg_region *new;
73 struct resource *res; 72 struct resource *res;
@@ -371,8 +370,7 @@ static int __init pci_mmcfg_check_hostbridge(void)
371 return !list_empty(&pci_mmcfg_list); 370 return !list_empty(&pci_mmcfg_list);
372} 371}
373 372
374static acpi_status __devinit check_mcfg_resource(struct acpi_resource *res, 373static acpi_status check_mcfg_resource(struct acpi_resource *res, void *data)
375 void *data)
376{ 374{
377 struct resource *mcfg_res = data; 375 struct resource *mcfg_res = data;
378 struct acpi_resource_address64 address; 376 struct acpi_resource_address64 address;
@@ -408,8 +406,8 @@ static acpi_status __devinit check_mcfg_resource(struct acpi_resource *res,
408 return AE_OK; 406 return AE_OK;
409} 407}
410 408
411static acpi_status __devinit find_mboard_resource(acpi_handle handle, u32 lvl, 409static acpi_status find_mboard_resource(acpi_handle handle, u32 lvl,
412 void *context, void **rv) 410 void *context, void **rv)
413{ 411{
414 struct resource *mcfg_res = context; 412 struct resource *mcfg_res = context;
415 413
@@ -422,7 +420,7 @@ static acpi_status __devinit find_mboard_resource(acpi_handle handle, u32 lvl,
422 return AE_OK; 420 return AE_OK;
423} 421}
424 422
425static int __devinit is_acpi_reserved(u64 start, u64 end, unsigned not_used) 423static int is_acpi_reserved(u64 start, u64 end, unsigned not_used)
426{ 424{
427 struct resource mcfg_res; 425 struct resource mcfg_res;
428 426
@@ -693,9 +691,8 @@ static int __init pci_mmcfg_late_insert_resources(void)
693late_initcall(pci_mmcfg_late_insert_resources); 691late_initcall(pci_mmcfg_late_insert_resources);
694 692
695/* Add MMCFG information for host bridges */ 693/* Add MMCFG information for host bridges */
696int __devinit pci_mmconfig_insert(struct device *dev, 694int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end,
697 u16 seg, u8 start, u8 end, 695 phys_addr_t addr)
698 phys_addr_t addr)
699{ 696{
700 int rc; 697 int rc;
701 struct resource *tmp = NULL; 698 struct resource *tmp = NULL;
diff --git a/arch/x86/pci/mmconfig_32.c b/arch/x86/pci/mmconfig_32.c
index db63ac23e3d9..5c90975cdf0f 100644
--- a/arch/x86/pci/mmconfig_32.c
+++ b/arch/x86/pci/mmconfig_32.c
@@ -142,7 +142,7 @@ void __init pci_mmcfg_arch_free(void)
142{ 142{
143} 143}
144 144
145int __devinit pci_mmcfg_arch_map(struct pci_mmcfg_region *cfg) 145int pci_mmcfg_arch_map(struct pci_mmcfg_region *cfg)
146{ 146{
147 return 0; 147 return 0;
148} 148}
diff --git a/arch/x86/pci/mmconfig_64.c b/arch/x86/pci/mmconfig_64.c
index d4ebd07c306d..bea52496aea6 100644
--- a/arch/x86/pci/mmconfig_64.c
+++ b/arch/x86/pci/mmconfig_64.c
@@ -95,7 +95,7 @@ const struct pci_raw_ops pci_mmcfg = {
95 .write = pci_mmcfg_write, 95 .write = pci_mmcfg_write,
96}; 96};
97 97
98static void __iomem * __devinit mcfg_ioremap(struct pci_mmcfg_region *cfg) 98static void __iomem *mcfg_ioremap(struct pci_mmcfg_region *cfg)
99{ 99{
100 void __iomem *addr; 100 void __iomem *addr;
101 u64 start, size; 101 u64 start, size;
@@ -133,7 +133,7 @@ void __init pci_mmcfg_arch_free(void)
133 pci_mmcfg_arch_unmap(cfg); 133 pci_mmcfg_arch_unmap(cfg);
134} 134}
135 135
136int __devinit pci_mmcfg_arch_map(struct pci_mmcfg_region *cfg) 136int pci_mmcfg_arch_map(struct pci_mmcfg_region *cfg)
137{ 137{
138 cfg->virt = mcfg_ioremap(cfg); 138 cfg->virt = mcfg_ioremap(cfg);
139 if (!cfg->virt) { 139 if (!cfg->virt) {
diff --git a/arch/x86/pci/mrst.c b/arch/x86/pci/mrst.c
index e14a2ff708b5..6eb18c42a28a 100644
--- a/arch/x86/pci/mrst.c
+++ b/arch/x86/pci/mrst.c
@@ -247,7 +247,7 @@ int __init pci_mrst_init(void)
247/* Langwell devices are not true pci devices, they are not subject to 10 ms 247/* Langwell devices are not true pci devices, they are not subject to 10 ms
248 * d3 to d0 delay required by pci spec. 248 * d3 to d0 delay required by pci spec.
249 */ 249 */
250static void __devinit pci_d3delay_fixup(struct pci_dev *dev) 250static void pci_d3delay_fixup(struct pci_dev *dev)
251{ 251{
252 /* PCI fixups are effectively decided compile time. If we have a dual 252 /* PCI fixups are effectively decided compile time. If we have a dual
253 SoC/non-SoC kernel we don't want to mangle d3 on non SoC devices */ 253 SoC/non-SoC kernel we don't want to mangle d3 on non SoC devices */
@@ -262,7 +262,7 @@ static void __devinit pci_d3delay_fixup(struct pci_dev *dev)
262} 262}
263DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, pci_d3delay_fixup); 263DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, pci_d3delay_fixup);
264 264
265static void __devinit mrst_power_off_unused_dev(struct pci_dev *dev) 265static void mrst_power_off_unused_dev(struct pci_dev *dev)
266{ 266{
267 pci_set_power_state(dev, PCI_D3hot); 267 pci_set_power_state(dev, PCI_D3hot);
268} 268}
@@ -275,7 +275,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0815, mrst_power_off_unused_dev);
275/* 275/*
276 * Langwell devices reside at fixed offsets, don't try to move them. 276 * Langwell devices reside at fixed offsets, don't try to move them.
277 */ 277 */
278static void __devinit pci_fixed_bar_fixup(struct pci_dev *dev) 278static void pci_fixed_bar_fixup(struct pci_dev *dev)
279{ 279{
280 unsigned long offset; 280 unsigned long offset;
281 u32 size; 281 u32 size;
diff --git a/arch/x86/pci/numaq_32.c b/arch/x86/pci/numaq_32.c
index 83e125b95ca6..b96b14c250b6 100644
--- a/arch/x86/pci/numaq_32.c
+++ b/arch/x86/pci/numaq_32.c
@@ -116,7 +116,7 @@ static const struct pci_raw_ops pci_direct_conf1_mq = {
116}; 116};
117 117
118 118
119static void __devinit pci_fixup_i450nx(struct pci_dev *d) 119static void pci_fixup_i450nx(struct pci_dev *d)
120{ 120{
121 /* 121 /*
122 * i450NX -- Find and scan all secondary buses on all PXB's. 122 * i450NX -- Find and scan all secondary buses on all PXB's.
diff --git a/arch/x86/pci/pcbios.c b/arch/x86/pci/pcbios.c
index da8fe0535ff4..c77b24a8b2da 100644
--- a/arch/x86/pci/pcbios.c
+++ b/arch/x86/pci/pcbios.c
@@ -124,7 +124,7 @@ static struct {
124 124
125static int pci_bios_present; 125static int pci_bios_present;
126 126
127static int __devinit check_pcibios(void) 127static int check_pcibios(void)
128{ 128{
129 u32 signature, eax, ebx, ecx; 129 u32 signature, eax, ebx, ecx;
130 u8 status, major_ver, minor_ver, hw_mech; 130 u8 status, major_ver, minor_ver, hw_mech;
@@ -312,7 +312,7 @@ static const struct pci_raw_ops pci_bios_access = {
312 * Try to find PCI BIOS. 312 * Try to find PCI BIOS.
313 */ 313 */
314 314
315static const struct pci_raw_ops * __devinit pci_find_bios(void) 315static const struct pci_raw_ops *pci_find_bios(void)
316{ 316{
317 union bios32 *check; 317 union bios32 *check;
318 unsigned char sum; 318 unsigned char sum;
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index ad4439145f85..77cf0090c0a3 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -51,9 +51,6 @@
51 51
52#define EFI_DEBUG 1 52#define EFI_DEBUG 1
53 53
54int efi_enabled;
55EXPORT_SYMBOL(efi_enabled);
56
57struct efi __read_mostly efi = { 54struct efi __read_mostly efi = {
58 .mps = EFI_INVALID_TABLE_ADDR, 55 .mps = EFI_INVALID_TABLE_ADDR,
59 .acpi = EFI_INVALID_TABLE_ADDR, 56 .acpi = EFI_INVALID_TABLE_ADDR,
@@ -69,19 +66,28 @@ EXPORT_SYMBOL(efi);
69 66
70struct efi_memory_map memmap; 67struct efi_memory_map memmap;
71 68
72bool efi_64bit;
73
74static struct efi efi_phys __initdata; 69static struct efi efi_phys __initdata;
75static efi_system_table_t efi_systab __initdata; 70static efi_system_table_t efi_systab __initdata;
76 71
77static inline bool efi_is_native(void) 72static inline bool efi_is_native(void)
78{ 73{
79 return IS_ENABLED(CONFIG_X86_64) == efi_64bit; 74 return IS_ENABLED(CONFIG_X86_64) == efi_enabled(EFI_64BIT);
75}
76
77unsigned long x86_efi_facility;
78
79/*
80 * Returns 1 if 'facility' is enabled, 0 otherwise.
81 */
82int efi_enabled(int facility)
83{
84 return test_bit(facility, &x86_efi_facility) != 0;
80} 85}
86EXPORT_SYMBOL(efi_enabled);
81 87
82static int __init setup_noefi(char *arg) 88static int __init setup_noefi(char *arg)
83{ 89{
84 efi_enabled = 0; 90 clear_bit(EFI_BOOT, &x86_efi_facility);
85 return 0; 91 return 0;
86} 92}
87early_param("noefi", setup_noefi); 93early_param("noefi", setup_noefi);
@@ -426,6 +432,7 @@ void __init efi_reserve_boot_services(void)
426 432
427void __init efi_unmap_memmap(void) 433void __init efi_unmap_memmap(void)
428{ 434{
435 clear_bit(EFI_MEMMAP, &x86_efi_facility);
429 if (memmap.map) { 436 if (memmap.map) {
430 early_iounmap(memmap.map, memmap.nr_map * memmap.desc_size); 437 early_iounmap(memmap.map, memmap.nr_map * memmap.desc_size);
431 memmap.map = NULL; 438 memmap.map = NULL;
@@ -460,7 +467,7 @@ void __init efi_free_boot_services(void)
460 467
461static int __init efi_systab_init(void *phys) 468static int __init efi_systab_init(void *phys)
462{ 469{
463 if (efi_64bit) { 470 if (efi_enabled(EFI_64BIT)) {
464 efi_system_table_64_t *systab64; 471 efi_system_table_64_t *systab64;
465 u64 tmp = 0; 472 u64 tmp = 0;
466 473
@@ -552,7 +559,7 @@ static int __init efi_config_init(u64 tables, int nr_tables)
552 void *config_tables, *tablep; 559 void *config_tables, *tablep;
553 int i, sz; 560 int i, sz;
554 561
555 if (efi_64bit) 562 if (efi_enabled(EFI_64BIT))
556 sz = sizeof(efi_config_table_64_t); 563 sz = sizeof(efi_config_table_64_t);
557 else 564 else
558 sz = sizeof(efi_config_table_32_t); 565 sz = sizeof(efi_config_table_32_t);
@@ -572,7 +579,7 @@ static int __init efi_config_init(u64 tables, int nr_tables)
572 efi_guid_t guid; 579 efi_guid_t guid;
573 unsigned long table; 580 unsigned long table;
574 581
575 if (efi_64bit) { 582 if (efi_enabled(EFI_64BIT)) {
576 u64 table64; 583 u64 table64;
577 guid = ((efi_config_table_64_t *)tablep)->guid; 584 guid = ((efi_config_table_64_t *)tablep)->guid;
578 table64 = ((efi_config_table_64_t *)tablep)->table; 585 table64 = ((efi_config_table_64_t *)tablep)->table;
@@ -684,7 +691,6 @@ void __init efi_init(void)
684 if (boot_params.efi_info.efi_systab_hi || 691 if (boot_params.efi_info.efi_systab_hi ||
685 boot_params.efi_info.efi_memmap_hi) { 692 boot_params.efi_info.efi_memmap_hi) {
686 pr_info("Table located above 4GB, disabling EFI.\n"); 693 pr_info("Table located above 4GB, disabling EFI.\n");
687 efi_enabled = 0;
688 return; 694 return;
689 } 695 }
690 efi_phys.systab = (efi_system_table_t *)boot_params.efi_info.efi_systab; 696 efi_phys.systab = (efi_system_table_t *)boot_params.efi_info.efi_systab;
@@ -694,10 +700,10 @@ void __init efi_init(void)
694 ((__u64)boot_params.efi_info.efi_systab_hi<<32)); 700 ((__u64)boot_params.efi_info.efi_systab_hi<<32));
695#endif 701#endif
696 702
697 if (efi_systab_init(efi_phys.systab)) { 703 if (efi_systab_init(efi_phys.systab))
698 efi_enabled = 0;
699 return; 704 return;
700 } 705
706 set_bit(EFI_SYSTEM_TABLES, &x86_efi_facility);
701 707
702 /* 708 /*
703 * Show what we know for posterity 709 * Show what we know for posterity
@@ -715,10 +721,10 @@ void __init efi_init(void)
715 efi.systab->hdr.revision >> 16, 721 efi.systab->hdr.revision >> 16,
716 efi.systab->hdr.revision & 0xffff, vendor); 722 efi.systab->hdr.revision & 0xffff, vendor);
717 723
718 if (efi_config_init(efi.systab->tables, efi.systab->nr_tables)) { 724 if (efi_config_init(efi.systab->tables, efi.systab->nr_tables))
719 efi_enabled = 0;
720 return; 725 return;
721 } 726
727 set_bit(EFI_CONFIG_TABLES, &x86_efi_facility);
722 728
723 /* 729 /*
724 * Note: We currently don't support runtime services on an EFI 730 * Note: We currently don't support runtime services on an EFI
@@ -727,15 +733,17 @@ void __init efi_init(void)
727 733
728 if (!efi_is_native()) 734 if (!efi_is_native())
729 pr_info("No EFI runtime due to 32/64-bit mismatch with kernel\n"); 735 pr_info("No EFI runtime due to 32/64-bit mismatch with kernel\n");
730 else if (efi_runtime_init()) { 736 else {
731 efi_enabled = 0; 737 if (efi_runtime_init())
732 return; 738 return;
739 set_bit(EFI_RUNTIME_SERVICES, &x86_efi_facility);
733 } 740 }
734 741
735 if (efi_memmap_init()) { 742 if (efi_memmap_init())
736 efi_enabled = 0;
737 return; 743 return;
738 } 744
745 set_bit(EFI_MEMMAP, &x86_efi_facility);
746
739#ifdef CONFIG_X86_32 747#ifdef CONFIG_X86_32
740 if (efi_is_native()) { 748 if (efi_is_native()) {
741 x86_platform.get_wallclock = efi_get_time; 749 x86_platform.get_wallclock = efi_get_time;
@@ -941,7 +949,7 @@ void __init efi_enter_virtual_mode(void)
941 * 949 *
942 * Call EFI services through wrapper functions. 950 * Call EFI services through wrapper functions.
943 */ 951 */
944 efi.runtime_version = efi_systab.fw_revision; 952 efi.runtime_version = efi_systab.hdr.revision;
945 efi.get_time = virt_efi_get_time; 953 efi.get_time = virt_efi_get_time;
946 efi.set_time = virt_efi_set_time; 954 efi.set_time = virt_efi_set_time;
947 efi.get_wakeup_time = virt_efi_get_wakeup_time; 955 efi.get_wakeup_time = virt_efi_get_wakeup_time;
@@ -969,6 +977,9 @@ u32 efi_mem_type(unsigned long phys_addr)
969 efi_memory_desc_t *md; 977 efi_memory_desc_t *md;
970 void *p; 978 void *p;
971 979
980 if (!efi_enabled(EFI_MEMMAP))
981 return 0;
982
972 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { 983 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
973 md = p; 984 md = p;
974 if ((md->phys_addr <= phys_addr) && 985 if ((md->phys_addr <= phys_addr) &&
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index 95fd505dfeb6..2b2003860615 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -38,7 +38,7 @@
38#include <asm/cacheflush.h> 38#include <asm/cacheflush.h>
39#include <asm/fixmap.h> 39#include <asm/fixmap.h>
40 40
41static pgd_t save_pgd __initdata; 41static pgd_t *save_pgd __initdata;
42static unsigned long efi_flags __initdata; 42static unsigned long efi_flags __initdata;
43 43
44static void __init early_code_mapping_set_exec(int executable) 44static void __init early_code_mapping_set_exec(int executable)
@@ -61,12 +61,20 @@ static void __init early_code_mapping_set_exec(int executable)
61void __init efi_call_phys_prelog(void) 61void __init efi_call_phys_prelog(void)
62{ 62{
63 unsigned long vaddress; 63 unsigned long vaddress;
64 int pgd;
65 int n_pgds;
64 66
65 early_code_mapping_set_exec(1); 67 early_code_mapping_set_exec(1);
66 local_irq_save(efi_flags); 68 local_irq_save(efi_flags);
67 vaddress = (unsigned long)__va(0x0UL); 69
68 save_pgd = *pgd_offset_k(0x0UL); 70 n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT), PGDIR_SIZE);
69 set_pgd(pgd_offset_k(0x0UL), *pgd_offset_k(vaddress)); 71 save_pgd = kmalloc(n_pgds * sizeof(pgd_t), GFP_KERNEL);
72
73 for (pgd = 0; pgd < n_pgds; pgd++) {
74 save_pgd[pgd] = *pgd_offset_k(pgd * PGDIR_SIZE);
75 vaddress = (unsigned long)__va(pgd * PGDIR_SIZE);
76 set_pgd(pgd_offset_k(pgd * PGDIR_SIZE), *pgd_offset_k(vaddress));
77 }
70 __flush_tlb_all(); 78 __flush_tlb_all();
71} 79}
72 80
@@ -75,7 +83,11 @@ void __init efi_call_phys_epilog(void)
75 /* 83 /*
76 * After the lock is released, the original page table is restored. 84 * After the lock is released, the original page table is restored.
77 */ 85 */
78 set_pgd(pgd_offset_k(0x0UL), save_pgd); 86 int pgd;
87 int n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT) , PGDIR_SIZE);
88 for (pgd = 0; pgd < n_pgds; pgd++)
89 set_pgd(pgd_offset_k(pgd * PGDIR_SIZE), save_pgd[pgd]);
90 kfree(save_pgd);
79 __flush_tlb_all(); 91 __flush_tlb_all();
80 local_irq_restore(efi_flags); 92 local_irq_restore(efi_flags);
81 early_code_mapping_set_exec(0); 93 early_code_mapping_set_exec(0);
diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c
index fd41a9262d65..e31bcd8f2eee 100644
--- a/arch/x86/platform/mrst/mrst.c
+++ b/arch/x86/platform/mrst/mrst.c
@@ -782,7 +782,7 @@ BLOCKING_NOTIFIER_HEAD(intel_scu_notifier);
782EXPORT_SYMBOL_GPL(intel_scu_notifier); 782EXPORT_SYMBOL_GPL(intel_scu_notifier);
783 783
784/* Called by IPC driver */ 784/* Called by IPC driver */
785void __devinit intel_scu_devices_create(void) 785void intel_scu_devices_create(void)
786{ 786{
787 int i; 787 int i;
788 788
diff --git a/arch/x86/platform/olpc/olpc-xo1-pm.c b/arch/x86/platform/olpc/olpc-xo1-pm.c
index d75582d1aa55..ff0174dda810 100644
--- a/arch/x86/platform/olpc/olpc-xo1-pm.c
+++ b/arch/x86/platform/olpc/olpc-xo1-pm.c
@@ -121,7 +121,7 @@ static const struct platform_suspend_ops xo1_suspend_ops = {
121 .enter = xo1_power_state_enter, 121 .enter = xo1_power_state_enter,
122}; 122};
123 123
124static int __devinit xo1_pm_probe(struct platform_device *pdev) 124static int xo1_pm_probe(struct platform_device *pdev)
125{ 125{
126 struct resource *res; 126 struct resource *res;
127 int err; 127 int err;
@@ -154,7 +154,7 @@ static int __devinit xo1_pm_probe(struct platform_device *pdev)
154 return 0; 154 return 0;
155} 155}
156 156
157static int __devexit xo1_pm_remove(struct platform_device *pdev) 157static int xo1_pm_remove(struct platform_device *pdev)
158{ 158{
159 mfd_cell_disable(pdev); 159 mfd_cell_disable(pdev);
160 160
@@ -173,7 +173,7 @@ static struct platform_driver cs5535_pms_driver = {
173 .owner = THIS_MODULE, 173 .owner = THIS_MODULE,
174 }, 174 },
175 .probe = xo1_pm_probe, 175 .probe = xo1_pm_probe,
176 .remove = __devexit_p(xo1_pm_remove), 176 .remove = xo1_pm_remove,
177}; 177};
178 178
179static struct platform_driver cs5535_acpi_driver = { 179static struct platform_driver cs5535_acpi_driver = {
@@ -182,7 +182,7 @@ static struct platform_driver cs5535_acpi_driver = {
182 .owner = THIS_MODULE, 182 .owner = THIS_MODULE,
183 }, 183 },
184 .probe = xo1_pm_probe, 184 .probe = xo1_pm_probe,
185 .remove = __devexit_p(xo1_pm_remove), 185 .remove = xo1_pm_remove,
186}; 186};
187 187
188static int __init xo1_pm_init(void) 188static int __init xo1_pm_init(void)
diff --git a/arch/x86/platform/olpc/olpc-xo1-sci.c b/arch/x86/platform/olpc/olpc-xo1-sci.c
index 63d4aa40956e..74704be7b1fe 100644
--- a/arch/x86/platform/olpc/olpc-xo1-sci.c
+++ b/arch/x86/platform/olpc/olpc-xo1-sci.c
@@ -309,7 +309,7 @@ static int xo1_sci_resume(struct platform_device *pdev)
309 return 0; 309 return 0;
310} 310}
311 311
312static int __devinit setup_sci_interrupt(struct platform_device *pdev) 312static int setup_sci_interrupt(struct platform_device *pdev)
313{ 313{
314 u32 lo, hi; 314 u32 lo, hi;
315 u32 sts; 315 u32 sts;
@@ -351,7 +351,7 @@ static int __devinit setup_sci_interrupt(struct platform_device *pdev)
351 return r; 351 return r;
352} 352}
353 353
354static int __devinit setup_ec_sci(void) 354static int setup_ec_sci(void)
355{ 355{
356 int r; 356 int r;
357 357
@@ -395,7 +395,7 @@ static void free_ec_sci(void)
395 gpio_free(OLPC_GPIO_ECSCI); 395 gpio_free(OLPC_GPIO_ECSCI);
396} 396}
397 397
398static int __devinit setup_lid_events(void) 398static int setup_lid_events(void)
399{ 399{
400 int r; 400 int r;
401 401
@@ -432,7 +432,7 @@ static void free_lid_events(void)
432 gpio_free(OLPC_GPIO_LID); 432 gpio_free(OLPC_GPIO_LID);
433} 433}
434 434
435static int __devinit setup_power_button(struct platform_device *pdev) 435static int setup_power_button(struct platform_device *pdev)
436{ 436{
437 int r; 437 int r;
438 438
@@ -463,7 +463,7 @@ static void free_power_button(void)
463 input_free_device(power_button_idev); 463 input_free_device(power_button_idev);
464} 464}
465 465
466static int __devinit setup_ebook_switch(struct platform_device *pdev) 466static int setup_ebook_switch(struct platform_device *pdev)
467{ 467{
468 int r; 468 int r;
469 469
@@ -494,7 +494,7 @@ static void free_ebook_switch(void)
494 input_free_device(ebook_switch_idev); 494 input_free_device(ebook_switch_idev);
495} 495}
496 496
497static int __devinit setup_lid_switch(struct platform_device *pdev) 497static int setup_lid_switch(struct platform_device *pdev)
498{ 498{
499 int r; 499 int r;
500 500
@@ -538,7 +538,7 @@ static void free_lid_switch(void)
538 input_free_device(lid_switch_idev); 538 input_free_device(lid_switch_idev);
539} 539}
540 540
541static int __devinit xo1_sci_probe(struct platform_device *pdev) 541static int xo1_sci_probe(struct platform_device *pdev)
542{ 542{
543 struct resource *res; 543 struct resource *res;
544 int r; 544 int r;
@@ -613,7 +613,7 @@ err_ebook:
613 return r; 613 return r;
614} 614}
615 615
616static int __devexit xo1_sci_remove(struct platform_device *pdev) 616static int xo1_sci_remove(struct platform_device *pdev)
617{ 617{
618 mfd_cell_disable(pdev); 618 mfd_cell_disable(pdev);
619 free_irq(sci_irq, pdev); 619 free_irq(sci_irq, pdev);
@@ -632,7 +632,7 @@ static struct platform_driver xo1_sci_driver = {
632 .name = "olpc-xo1-sci-acpi", 632 .name = "olpc-xo1-sci-acpi",
633 }, 633 },
634 .probe = xo1_sci_probe, 634 .probe = xo1_sci_probe,
635 .remove = __devexit_p(xo1_sci_remove), 635 .remove = xo1_sci_remove,
636 .suspend = xo1_sci_suspend, 636 .suspend = xo1_sci_suspend,
637 .resume = xo1_sci_resume, 637 .resume = xo1_sci_resume,
638}; 638};
diff --git a/arch/x86/platform/scx200/scx200_32.c b/arch/x86/platform/scx200/scx200_32.c
index 7a9ad30d6c9f..3dc9aee41d91 100644
--- a/arch/x86/platform/scx200/scx200_32.c
+++ b/arch/x86/platform/scx200/scx200_32.c
@@ -35,7 +35,7 @@ static struct pci_device_id scx200_tbl[] = {
35}; 35};
36MODULE_DEVICE_TABLE(pci,scx200_tbl); 36MODULE_DEVICE_TABLE(pci,scx200_tbl);
37 37
38static int __devinit scx200_probe(struct pci_dev *, const struct pci_device_id *); 38static int scx200_probe(struct pci_dev *, const struct pci_device_id *);
39 39
40static struct pci_driver scx200_pci_driver = { 40static struct pci_driver scx200_pci_driver = {
41 .name = "scx200", 41 .name = "scx200",
@@ -45,7 +45,7 @@ static struct pci_driver scx200_pci_driver = {
45 45
46static DEFINE_MUTEX(scx200_gpio_config_lock); 46static DEFINE_MUTEX(scx200_gpio_config_lock);
47 47
48static void __devinit scx200_init_shadow(void) 48static void scx200_init_shadow(void)
49{ 49{
50 int bank; 50 int bank;
51 51
@@ -54,7 +54,7 @@ static void __devinit scx200_init_shadow(void)
54 scx200_gpio_shadow[bank] = inl(scx200_gpio_base + 0x10 * bank); 54 scx200_gpio_shadow[bank] = inl(scx200_gpio_base + 0x10 * bank);
55} 55}
56 56
57static int __devinit scx200_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 57static int scx200_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
58{ 58{
59 unsigned base; 59 unsigned base;
60 60
diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c
index b8b3a37c80cd..dbbdca5f508c 100644
--- a/arch/x86/platform/uv/tlb_uv.c
+++ b/arch/x86/platform/uv/tlb_uv.c
@@ -1034,7 +1034,8 @@ static int set_distrib_bits(struct cpumask *flush_mask, struct bau_control *bcp,
1034 * globally purge translation cache of a virtual address or all TLB's 1034 * globally purge translation cache of a virtual address or all TLB's
1035 * @cpumask: mask of all cpu's in which the address is to be removed 1035 * @cpumask: mask of all cpu's in which the address is to be removed
1036 * @mm: mm_struct containing virtual address range 1036 * @mm: mm_struct containing virtual address range
1037 * @va: virtual address to be removed (or TLB_FLUSH_ALL for all TLB's on cpu) 1037 * @start: start virtual address to be removed from TLB
1038 * @end: end virtual address to be remove from TLB
1038 * @cpu: the current cpu 1039 * @cpu: the current cpu
1039 * 1040 *
1040 * This is the entry point for initiating any UV global TLB shootdown. 1041 * This is the entry point for initiating any UV global TLB shootdown.
@@ -1056,7 +1057,7 @@ static int set_distrib_bits(struct cpumask *flush_mask, struct bau_control *bcp,
1056 */ 1057 */
1057const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask, 1058const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask,
1058 struct mm_struct *mm, unsigned long start, 1059 struct mm_struct *mm, unsigned long start,
1059 unsigned end, unsigned int cpu) 1060 unsigned long end, unsigned int cpu)
1060{ 1061{
1061 int locals = 0; 1062 int locals = 0;
1062 int remotes = 0; 1063 int remotes = 0;
@@ -1113,7 +1114,10 @@ const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask,
1113 1114
1114 record_send_statistics(stat, locals, hubs, remotes, bau_desc); 1115 record_send_statistics(stat, locals, hubs, remotes, bau_desc);
1115 1116
1116 bau_desc->payload.address = start; 1117 if (!end || (end - start) <= PAGE_SIZE)
1118 bau_desc->payload.address = start;
1119 else
1120 bau_desc->payload.address = TLB_FLUSH_ALL;
1117 bau_desc->payload.sending_cpu = cpu; 1121 bau_desc->payload.sending_cpu = cpu;
1118 /* 1122 /*
1119 * uv_flush_send_and_wait returns 0 if all cpu's were messaged, 1123 * uv_flush_send_and_wait returns 0 if all cpu's were messaged,
diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
index 5a1847d61930..79d67bd507fa 100644
--- a/arch/x86/tools/relocs.c
+++ b/arch/x86/tools/relocs.c
@@ -814,12 +814,14 @@ int main(int argc, char **argv)
814 read_relocs(fp); 814 read_relocs(fp);
815 if (show_absolute_syms) { 815 if (show_absolute_syms) {
816 print_absolute_symbols(); 816 print_absolute_symbols();
817 return 0; 817 goto out;
818 } 818 }
819 if (show_absolute_relocs) { 819 if (show_absolute_relocs) {
820 print_absolute_relocs(); 820 print_absolute_relocs();
821 return 0; 821 goto out;
822 } 822 }
823 emit_relocs(as_text, use_real_mode); 823 emit_relocs(as_text, use_real_mode);
824out:
825 fclose(fp);
824 return 0; 826 return 0;
825} 827}
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index 4f7d2599b484..34bc4cee8887 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -432,13 +432,6 @@ static void __cpuinit xen_play_dead(void) /* used only with HOTPLUG_CPU */
432 play_dead_common(); 432 play_dead_common();
433 HYPERVISOR_vcpu_op(VCPUOP_down, smp_processor_id(), NULL); 433 HYPERVISOR_vcpu_op(VCPUOP_down, smp_processor_id(), NULL);
434 cpu_bringup(); 434 cpu_bringup();
435 /*
436 * Balance out the preempt calls - as we are running in cpu_idle
437 * loop which has been called at bootup from cpu_bringup_and_idle.
438 * The cpucpu_bringup_and_idle called cpu_bringup which made a
439 * preempt_disable() So this preempt_enable will balance it out.
440 */
441 preempt_enable();
442} 435}
443 436
444#else /* !CONFIG_HOTPLUG_CPU */ 437#else /* !CONFIG_HOTPLUG_CPU */
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index eb30e5ab4cab..b679bf8478f7 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -226,16 +226,6 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
226 struct acpi_memory_info *info; 226 struct acpi_memory_info *info;
227 int node; 227 int node;
228 228
229
230 /* Get the range from the _CRS */
231 result = acpi_memory_get_device_resources(mem_device);
232 if (result) {
233 dev_err(&mem_device->device->dev,
234 "get_device_resources failed\n");
235 mem_device->state = MEMORY_INVALID_STATE;
236 return result;
237 }
238
239 node = acpi_get_node(mem_device->device->handle); 229 node = acpi_get_node(mem_device->device->handle);
240 /* 230 /*
241 * Tell the VM there is more memory here... 231 * Tell the VM there is more memory here...
@@ -342,14 +332,6 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
342 break; 332 break;
343 } 333 }
344 334
345 if (acpi_memory_check_device(mem_device))
346 break;
347
348 if (acpi_memory_enable_device(mem_device)) {
349 acpi_handle_err(handle,"Cannot enable memory device\n");
350 break;
351 }
352
353 ost_code = ACPI_OST_SC_SUCCESS; 335 ost_code = ACPI_OST_SC_SUCCESS;
354 break; 336 break;
355 337
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile
index c8bc24bd1f72..bc7a03ded064 100644
--- a/drivers/acpi/acpica/Makefile
+++ b/drivers/acpi/acpica/Makefile
@@ -162,5 +162,5 @@ acpi-y += \
162 utxferror.o \ 162 utxferror.o \
163 utxfmutex.o 163 utxfmutex.o
164 164
165acpi-$(ACPI_FUTURE_USAGE) += uttrack.o utcache.o utclib.o 165acpi-$(ACPI_FUTURE_USAGE) += uttrack.o utcache.o
166 166
diff --git a/drivers/acpi/acpica/utclib.c b/drivers/acpi/acpica/utclib.c
deleted file mode 100644
index 19ea4755aa73..000000000000
--- a/drivers/acpi/acpica/utclib.c
+++ /dev/null
@@ -1,749 +0,0 @@
1/******************************************************************************
2 *
3 * Module Name: cmclib - Local implementation of C library functions
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2012, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#include <acpi/acpi.h>
45#include "accommon.h"
46
47/*
48 * These implementations of standard C Library routines can optionally be
49 * used if a C library is not available. In general, they are less efficient
50 * than an inline or assembly implementation
51 */
52
53#define _COMPONENT ACPI_UTILITIES
54ACPI_MODULE_NAME("cmclib")
55
56#ifndef ACPI_USE_SYSTEM_CLIBRARY
57#define NEGATIVE 1
58#define POSITIVE 0
59/*******************************************************************************
60 *
61 * FUNCTION: acpi_ut_memcmp (memcmp)
62 *
63 * PARAMETERS: buffer1 - First Buffer
64 * buffer2 - Second Buffer
65 * count - Maximum # of bytes to compare
66 *
67 * RETURN: Index where Buffers mismatched, or 0 if Buffers matched
68 *
69 * DESCRIPTION: Compare two Buffers, with a maximum length
70 *
71 ******************************************************************************/
72int acpi_ut_memcmp(const char *buffer1, const char *buffer2, acpi_size count)
73{
74
75 return ((count == ACPI_SIZE_MAX) ? 0 : ((unsigned char)*buffer1 -
76 (unsigned char)*buffer2));
77}
78
79/*******************************************************************************
80 *
81 * FUNCTION: acpi_ut_memcpy (memcpy)
82 *
83 * PARAMETERS: dest - Target of the copy
84 * src - Source buffer to copy
85 * count - Number of bytes to copy
86 *
87 * RETURN: Dest
88 *
89 * DESCRIPTION: Copy arbitrary bytes of memory
90 *
91 ******************************************************************************/
92
93void *acpi_ut_memcpy(void *dest, const void *src, acpi_size count)
94{
95 char *new = (char *)dest;
96 char *old = (char *)src;
97
98 while (count) {
99 *new = *old;
100 new++;
101 old++;
102 count--;
103 }
104
105 return (dest);
106}
107
108/*******************************************************************************
109 *
110 * FUNCTION: acpi_ut_memset (memset)
111 *
112 * PARAMETERS: dest - Buffer to set
113 * value - Value to set each byte of memory
114 * count - Number of bytes to set
115 *
116 * RETURN: Dest
117 *
118 * DESCRIPTION: Initialize a buffer to a known value.
119 *
120 ******************************************************************************/
121
122void *acpi_ut_memset(void *dest, u8 value, acpi_size count)
123{
124 char *new = (char *)dest;
125
126 while (count) {
127 *new = (char)value;
128 new++;
129 count--;
130 }
131
132 return (dest);
133}
134
135/*******************************************************************************
136 *
137 * FUNCTION: acpi_ut_strlen (strlen)
138 *
139 * PARAMETERS: string - Null terminated string
140 *
141 * RETURN: Length
142 *
143 * DESCRIPTION: Returns the length of the input string
144 *
145 ******************************************************************************/
146
147acpi_size acpi_ut_strlen(const char *string)
148{
149 u32 length = 0;
150
151 /* Count the string until a null is encountered */
152
153 while (*string) {
154 length++;
155 string++;
156 }
157
158 return (length);
159}
160
161/*******************************************************************************
162 *
163 * FUNCTION: acpi_ut_strcpy (strcpy)
164 *
165 * PARAMETERS: dst_string - Target of the copy
166 * src_string - The source string to copy
167 *
168 * RETURN: dst_string
169 *
170 * DESCRIPTION: Copy a null terminated string
171 *
172 ******************************************************************************/
173
174char *acpi_ut_strcpy(char *dst_string, const char *src_string)
175{
176 char *string = dst_string;
177
178 /* Move bytes brute force */
179
180 while (*src_string) {
181 *string = *src_string;
182
183 string++;
184 src_string++;
185 }
186
187 /* Null terminate */
188
189 *string = 0;
190 return (dst_string);
191}
192
193/*******************************************************************************
194 *
195 * FUNCTION: acpi_ut_strncpy (strncpy)
196 *
197 * PARAMETERS: dst_string - Target of the copy
198 * src_string - The source string to copy
199 * count - Maximum # of bytes to copy
200 *
201 * RETURN: dst_string
202 *
203 * DESCRIPTION: Copy a null terminated string, with a maximum length
204 *
205 ******************************************************************************/
206
207char *acpi_ut_strncpy(char *dst_string, const char *src_string, acpi_size count)
208{
209 char *string = dst_string;
210
211 /* Copy the string */
212
213 for (string = dst_string;
214 count && (count--, (*string++ = *src_string++));) {;
215 }
216
217 /* Pad with nulls if necessary */
218
219 while (count--) {
220 *string = 0;
221 string++;
222 }
223
224 /* Return original pointer */
225
226 return (dst_string);
227}
228
229/*******************************************************************************
230 *
231 * FUNCTION: acpi_ut_strcmp (strcmp)
232 *
233 * PARAMETERS: string1 - First string
234 * string2 - Second string
235 *
236 * RETURN: Index where strings mismatched, or 0 if strings matched
237 *
238 * DESCRIPTION: Compare two null terminated strings
239 *
240 ******************************************************************************/
241
242int acpi_ut_strcmp(const char *string1, const char *string2)
243{
244
245 for (; (*string1 == *string2); string2++) {
246 if (!*string1++) {
247 return (0);
248 }
249 }
250
251 return ((unsigned char)*string1 - (unsigned char)*string2);
252}
253
254#ifdef ACPI_FUTURE_IMPLEMENTATION
255/* Not used at this time */
256/*******************************************************************************
257 *
258 * FUNCTION: acpi_ut_strchr (strchr)
259 *
260 * PARAMETERS: string - Search string
261 * ch - character to search for
262 *
263 * RETURN: Ptr to char or NULL if not found
264 *
265 * DESCRIPTION: Search a string for a character
266 *
267 ******************************************************************************/
268
269char *acpi_ut_strchr(const char *string, int ch)
270{
271
272 for (; (*string); string++) {
273 if ((*string) == (char)ch) {
274 return ((char *)string);
275 }
276 }
277
278 return (NULL);
279}
280#endif
281
282/*******************************************************************************
283 *
284 * FUNCTION: acpi_ut_strncmp (strncmp)
285 *
286 * PARAMETERS: string1 - First string
287 * string2 - Second string
288 * count - Maximum # of bytes to compare
289 *
290 * RETURN: Index where strings mismatched, or 0 if strings matched
291 *
292 * DESCRIPTION: Compare two null terminated strings, with a maximum length
293 *
294 ******************************************************************************/
295
296int acpi_ut_strncmp(const char *string1, const char *string2, acpi_size count)
297{
298
299 for (; count-- && (*string1 == *string2); string2++) {
300 if (!*string1++) {
301 return (0);
302 }
303 }
304
305 return ((count == ACPI_SIZE_MAX) ? 0 : ((unsigned char)*string1 -
306 (unsigned char)*string2));
307}
308
309/*******************************************************************************
310 *
311 * FUNCTION: acpi_ut_strcat (Strcat)
312 *
313 * PARAMETERS: dst_string - Target of the copy
314 * src_string - The source string to copy
315 *
316 * RETURN: dst_string
317 *
318 * DESCRIPTION: Append a null terminated string to a null terminated string
319 *
320 ******************************************************************************/
321
322char *acpi_ut_strcat(char *dst_string, const char *src_string)
323{
324 char *string;
325
326 /* Find end of the destination string */
327
328 for (string = dst_string; *string++;) {;
329 }
330
331 /* Concatenate the string */
332
333 for (--string; (*string++ = *src_string++);) {;
334 }
335
336 return (dst_string);
337}
338
339/*******************************************************************************
340 *
341 * FUNCTION: acpi_ut_strncat (strncat)
342 *
343 * PARAMETERS: dst_string - Target of the copy
344 * src_string - The source string to copy
345 * count - Maximum # of bytes to copy
346 *
347 * RETURN: dst_string
348 *
349 * DESCRIPTION: Append a null terminated string to a null terminated string,
350 * with a maximum count.
351 *
352 ******************************************************************************/
353
354char *acpi_ut_strncat(char *dst_string, const char *src_string, acpi_size count)
355{
356 char *string;
357
358 if (count) {
359
360 /* Find end of the destination string */
361
362 for (string = dst_string; *string++;) {;
363 }
364
365 /* Concatenate the string */
366
367 for (--string; (*string++ = *src_string++) && --count;) {;
368 }
369
370 /* Null terminate if necessary */
371
372 if (!count) {
373 *string = 0;
374 }
375 }
376
377 return (dst_string);
378}
379
380/*******************************************************************************
381 *
382 * FUNCTION: acpi_ut_strstr (strstr)
383 *
384 * PARAMETERS: string1 - Target string
385 * string2 - Substring to search for
386 *
387 * RETURN: Where substring match starts, Null if no match found
388 *
389 * DESCRIPTION: Checks if String2 occurs in String1. This is not really a
390 * full implementation of strstr, only sufficient for command
391 * matching
392 *
393 ******************************************************************************/
394
395char *acpi_ut_strstr(char *string1, char *string2)
396{
397 char *string;
398
399 if (acpi_ut_strlen(string2) > acpi_ut_strlen(string1)) {
400 return (NULL);
401 }
402
403 /* Walk entire string, comparing the letters */
404
405 for (string = string1; *string2;) {
406 if (*string2 != *string) {
407 return (NULL);
408 }
409
410 string2++;
411 string++;
412 }
413
414 return (string1);
415}
416
417/*******************************************************************************
418 *
419 * FUNCTION: acpi_ut_strtoul (strtoul)
420 *
421 * PARAMETERS: string - Null terminated string
422 * terminater - Where a pointer to the terminating byte is
423 * returned
424 * base - Radix of the string
425 *
426 * RETURN: Converted value
427 *
428 * DESCRIPTION: Convert a string into a 32-bit unsigned value.
429 * Note: use acpi_ut_strtoul64 for 64-bit integers.
430 *
431 ******************************************************************************/
432
433u32 acpi_ut_strtoul(const char *string, char **terminator, u32 base)
434{
435 u32 converted = 0;
436 u32 index;
437 u32 sign;
438 const char *string_start;
439 u32 return_value = 0;
440 acpi_status status = AE_OK;
441
442 /*
443 * Save the value of the pointer to the buffer's first
444 * character, save the current errno value, and then
445 * skip over any white space in the buffer:
446 */
447 string_start = string;
448 while (ACPI_IS_SPACE(*string) || *string == '\t') {
449 ++string;
450 }
451
452 /*
453 * The buffer may contain an optional plus or minus sign.
454 * If it does, then skip over it but remember what is was:
455 */
456 if (*string == '-') {
457 sign = NEGATIVE;
458 ++string;
459 } else if (*string == '+') {
460 ++string;
461 sign = POSITIVE;
462 } else {
463 sign = POSITIVE;
464 }
465
466 /*
467 * If the input parameter Base is zero, then we need to
468 * determine if it is octal, decimal, or hexadecimal:
469 */
470 if (base == 0) {
471 if (*string == '0') {
472 if (acpi_ut_to_lower(*(++string)) == 'x') {
473 base = 16;
474 ++string;
475 } else {
476 base = 8;
477 }
478 } else {
479 base = 10;
480 }
481 } else if (base < 2 || base > 36) {
482 /*
483 * The specified Base parameter is not in the domain of
484 * this function:
485 */
486 goto done;
487 }
488
489 /*
490 * For octal and hexadecimal bases, skip over the leading
491 * 0 or 0x, if they are present.
492 */
493 if (base == 8 && *string == '0') {
494 string++;
495 }
496
497 if (base == 16 &&
498 *string == '0' && acpi_ut_to_lower(*(++string)) == 'x') {
499 string++;
500 }
501
502 /*
503 * Main loop: convert the string to an unsigned long:
504 */
505 while (*string) {
506 if (ACPI_IS_DIGIT(*string)) {
507 index = (u32)((u8)*string - '0');
508 } else {
509 index = (u32)acpi_ut_to_upper(*string);
510 if (ACPI_IS_UPPER(index)) {
511 index = index - 'A' + 10;
512 } else {
513 goto done;
514 }
515 }
516
517 if (index >= base) {
518 goto done;
519 }
520
521 /*
522 * Check to see if value is out of range:
523 */
524
525 if (return_value > ((ACPI_UINT32_MAX - (u32)index) / (u32)base)) {
526 status = AE_ERROR;
527 return_value = 0; /* reset */
528 } else {
529 return_value *= base;
530 return_value += index;
531 converted = 1;
532 }
533
534 ++string;
535 }
536
537 done:
538 /*
539 * If appropriate, update the caller's pointer to the next
540 * unconverted character in the buffer.
541 */
542 if (terminator) {
543 if (converted == 0 && return_value == 0 && string != NULL) {
544 *terminator = (char *)string_start;
545 } else {
546 *terminator = (char *)string;
547 }
548 }
549
550 if (status == AE_ERROR) {
551 return_value = ACPI_UINT32_MAX;
552 }
553
554 /*
555 * If a minus sign was present, then "the conversion is negated":
556 */
557 if (sign == NEGATIVE) {
558 return_value = (ACPI_UINT32_MAX - return_value) + 1;
559 }
560
561 return (return_value);
562}
563
564/*******************************************************************************
565 *
566 * FUNCTION: acpi_ut_to_upper (TOUPPER)
567 *
568 * PARAMETERS: c - Character to convert
569 *
570 * RETURN: Converted character as an int
571 *
572 * DESCRIPTION: Convert character to uppercase
573 *
574 ******************************************************************************/
575
576int acpi_ut_to_upper(int c)
577{
578
579 return (ACPI_IS_LOWER(c) ? ((c) - 0x20) : (c));
580}
581
582/*******************************************************************************
583 *
584 * FUNCTION: acpi_ut_to_lower (TOLOWER)
585 *
586 * PARAMETERS: c - Character to convert
587 *
588 * RETURN: Converted character as an int
589 *
590 * DESCRIPTION: Convert character to lowercase
591 *
592 ******************************************************************************/
593
594int acpi_ut_to_lower(int c)
595{
596
597 return (ACPI_IS_UPPER(c) ? ((c) + 0x20) : (c));
598}
599
600/*******************************************************************************
601 *
602 * FUNCTION: is* functions
603 *
604 * DESCRIPTION: is* functions use the ctype table below
605 *
606 ******************************************************************************/
607
608const u8 _acpi_ctype[257] = {
609 _ACPI_CN, /* 0x00 0 NUL */
610 _ACPI_CN, /* 0x01 1 SOH */
611 _ACPI_CN, /* 0x02 2 STX */
612 _ACPI_CN, /* 0x03 3 ETX */
613 _ACPI_CN, /* 0x04 4 EOT */
614 _ACPI_CN, /* 0x05 5 ENQ */
615 _ACPI_CN, /* 0x06 6 ACK */
616 _ACPI_CN, /* 0x07 7 BEL */
617 _ACPI_CN, /* 0x08 8 BS */
618 _ACPI_CN | _ACPI_SP, /* 0x09 9 TAB */
619 _ACPI_CN | _ACPI_SP, /* 0x0A 10 LF */
620 _ACPI_CN | _ACPI_SP, /* 0x0B 11 VT */
621 _ACPI_CN | _ACPI_SP, /* 0x0C 12 FF */
622 _ACPI_CN | _ACPI_SP, /* 0x0D 13 CR */
623 _ACPI_CN, /* 0x0E 14 SO */
624 _ACPI_CN, /* 0x0F 15 SI */
625 _ACPI_CN, /* 0x10 16 DLE */
626 _ACPI_CN, /* 0x11 17 DC1 */
627 _ACPI_CN, /* 0x12 18 DC2 */
628 _ACPI_CN, /* 0x13 19 DC3 */
629 _ACPI_CN, /* 0x14 20 DC4 */
630 _ACPI_CN, /* 0x15 21 NAK */
631 _ACPI_CN, /* 0x16 22 SYN */
632 _ACPI_CN, /* 0x17 23 ETB */
633 _ACPI_CN, /* 0x18 24 CAN */
634 _ACPI_CN, /* 0x19 25 EM */
635 _ACPI_CN, /* 0x1A 26 SUB */
636 _ACPI_CN, /* 0x1B 27 ESC */
637 _ACPI_CN, /* 0x1C 28 FS */
638 _ACPI_CN, /* 0x1D 29 GS */
639 _ACPI_CN, /* 0x1E 30 RS */
640 _ACPI_CN, /* 0x1F 31 US */
641 _ACPI_XS | _ACPI_SP, /* 0x20 32 ' ' */
642 _ACPI_PU, /* 0x21 33 '!' */
643 _ACPI_PU, /* 0x22 34 '"' */
644 _ACPI_PU, /* 0x23 35 '#' */
645 _ACPI_PU, /* 0x24 36 '$' */
646 _ACPI_PU, /* 0x25 37 '%' */
647 _ACPI_PU, /* 0x26 38 '&' */
648 _ACPI_PU, /* 0x27 39 ''' */
649 _ACPI_PU, /* 0x28 40 '(' */
650 _ACPI_PU, /* 0x29 41 ')' */
651 _ACPI_PU, /* 0x2A 42 '*' */
652 _ACPI_PU, /* 0x2B 43 '+' */
653 _ACPI_PU, /* 0x2C 44 ',' */
654 _ACPI_PU, /* 0x2D 45 '-' */
655 _ACPI_PU, /* 0x2E 46 '.' */
656 _ACPI_PU, /* 0x2F 47 '/' */
657 _ACPI_XD | _ACPI_DI, /* 0x30 48 '0' */
658 _ACPI_XD | _ACPI_DI, /* 0x31 49 '1' */
659 _ACPI_XD | _ACPI_DI, /* 0x32 50 '2' */
660 _ACPI_XD | _ACPI_DI, /* 0x33 51 '3' */
661 _ACPI_XD | _ACPI_DI, /* 0x34 52 '4' */
662 _ACPI_XD | _ACPI_DI, /* 0x35 53 '5' */
663 _ACPI_XD | _ACPI_DI, /* 0x36 54 '6' */
664 _ACPI_XD | _ACPI_DI, /* 0x37 55 '7' */
665 _ACPI_XD | _ACPI_DI, /* 0x38 56 '8' */
666 _ACPI_XD | _ACPI_DI, /* 0x39 57 '9' */
667 _ACPI_PU, /* 0x3A 58 ':' */
668 _ACPI_PU, /* 0x3B 59 ';' */
669 _ACPI_PU, /* 0x3C 60 '<' */
670 _ACPI_PU, /* 0x3D 61 '=' */
671 _ACPI_PU, /* 0x3E 62 '>' */
672 _ACPI_PU, /* 0x3F 63 '?' */
673 _ACPI_PU, /* 0x40 64 '@' */
674 _ACPI_XD | _ACPI_UP, /* 0x41 65 'A' */
675 _ACPI_XD | _ACPI_UP, /* 0x42 66 'B' */
676 _ACPI_XD | _ACPI_UP, /* 0x43 67 'C' */
677 _ACPI_XD | _ACPI_UP, /* 0x44 68 'D' */
678 _ACPI_XD | _ACPI_UP, /* 0x45 69 'E' */
679 _ACPI_XD | _ACPI_UP, /* 0x46 70 'F' */
680 _ACPI_UP, /* 0x47 71 'G' */
681 _ACPI_UP, /* 0x48 72 'H' */
682 _ACPI_UP, /* 0x49 73 'I' */
683 _ACPI_UP, /* 0x4A 74 'J' */
684 _ACPI_UP, /* 0x4B 75 'K' */
685 _ACPI_UP, /* 0x4C 76 'L' */
686 _ACPI_UP, /* 0x4D 77 'M' */
687 _ACPI_UP, /* 0x4E 78 'N' */
688 _ACPI_UP, /* 0x4F 79 'O' */
689 _ACPI_UP, /* 0x50 80 'P' */
690 _ACPI_UP, /* 0x51 81 'Q' */
691 _ACPI_UP, /* 0x52 82 'R' */
692 _ACPI_UP, /* 0x53 83 'S' */
693 _ACPI_UP, /* 0x54 84 'T' */
694 _ACPI_UP, /* 0x55 85 'U' */
695 _ACPI_UP, /* 0x56 86 'V' */
696 _ACPI_UP, /* 0x57 87 'W' */
697 _ACPI_UP, /* 0x58 88 'X' */
698 _ACPI_UP, /* 0x59 89 'Y' */
699 _ACPI_UP, /* 0x5A 90 'Z' */
700 _ACPI_PU, /* 0x5B 91 '[' */
701 _ACPI_PU, /* 0x5C 92 '\' */
702 _ACPI_PU, /* 0x5D 93 ']' */
703 _ACPI_PU, /* 0x5E 94 '^' */
704 _ACPI_PU, /* 0x5F 95 '_' */
705 _ACPI_PU, /* 0x60 96 '`' */
706 _ACPI_XD | _ACPI_LO, /* 0x61 97 'a' */
707 _ACPI_XD | _ACPI_LO, /* 0x62 98 'b' */
708 _ACPI_XD | _ACPI_LO, /* 0x63 99 'c' */
709 _ACPI_XD | _ACPI_LO, /* 0x64 100 'd' */
710 _ACPI_XD | _ACPI_LO, /* 0x65 101 'e' */
711 _ACPI_XD | _ACPI_LO, /* 0x66 102 'f' */
712 _ACPI_LO, /* 0x67 103 'g' */
713 _ACPI_LO, /* 0x68 104 'h' */
714 _ACPI_LO, /* 0x69 105 'i' */
715 _ACPI_LO, /* 0x6A 106 'j' */
716 _ACPI_LO, /* 0x6B 107 'k' */
717 _ACPI_LO, /* 0x6C 108 'l' */
718 _ACPI_LO, /* 0x6D 109 'm' */
719 _ACPI_LO, /* 0x6E 110 'n' */
720 _ACPI_LO, /* 0x6F 111 'o' */
721 _ACPI_LO, /* 0x70 112 'p' */
722 _ACPI_LO, /* 0x71 113 'q' */
723 _ACPI_LO, /* 0x72 114 'r' */
724 _ACPI_LO, /* 0x73 115 's' */
725 _ACPI_LO, /* 0x74 116 't' */
726 _ACPI_LO, /* 0x75 117 'u' */
727 _ACPI_LO, /* 0x76 118 'v' */
728 _ACPI_LO, /* 0x77 119 'w' */
729 _ACPI_LO, /* 0x78 120 'x' */
730 _ACPI_LO, /* 0x79 121 'y' */
731 _ACPI_LO, /* 0x7A 122 'z' */
732 _ACPI_PU, /* 0x7B 123 '{' */
733 _ACPI_PU, /* 0x7C 124 '|' */
734 _ACPI_PU, /* 0x7D 125 '}' */
735 _ACPI_PU, /* 0x7E 126 '~' */
736 _ACPI_CN, /* 0x7F 127 DEL */
737
738 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 to 0x8F */
739 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 to 0x9F */
740 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xA0 to 0xAF */
741 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xB0 to 0xBF */
742 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xC0 to 0xCF */
743 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xD0 to 0xDF */
744 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xE0 to 0xEF */
745 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xF0 to 0xFF */
746 0 /* 0x100 */
747};
748
749#endif /* ACPI_USE_SYSTEM_CLIBRARY */
diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c
index 00a783661d0b..46f80e2c92f7 100644
--- a/drivers/acpi/apei/apei-base.c
+++ b/drivers/acpi/apei/apei-base.c
@@ -590,6 +590,9 @@ static int apei_check_gar(struct acpi_generic_address *reg, u64 *paddr,
590 if (bit_width == 32 && bit_offset == 0 && (*paddr & 0x03) == 0 && 590 if (bit_width == 32 && bit_offset == 0 && (*paddr & 0x03) == 0 &&
591 *access_bit_width < 32) 591 *access_bit_width < 32)
592 *access_bit_width = 32; 592 *access_bit_width = 32;
593 else if (bit_width == 64 && bit_offset == 0 && (*paddr & 0x07) == 0 &&
594 *access_bit_width < 64)
595 *access_bit_width = 64;
593 596
594 if ((bit_width + bit_offset) > *access_bit_width) { 597 if ((bit_width + bit_offset) > *access_bit_width) {
595 pr_warning(FW_BUG APEI_PFX 598 pr_warning(FW_BUG APEI_PFX
diff --git a/drivers/acpi/apei/erst-dbg.c b/drivers/acpi/apei/erst-dbg.c
index 903549df809b..04ab5c9d3ced 100644
--- a/drivers/acpi/apei/erst-dbg.c
+++ b/drivers/acpi/apei/erst-dbg.c
@@ -111,8 +111,17 @@ retry_next:
111 if (rc) 111 if (rc)
112 goto out; 112 goto out;
113 /* no more record */ 113 /* no more record */
114 if (id == APEI_ERST_INVALID_RECORD_ID) 114 if (id == APEI_ERST_INVALID_RECORD_ID) {
115 /*
116 * If the persistent store is empty initially, the function
117 * 'erst_read' below will return "-ENOENT" value. This causes
118 * 'retry_next' label is entered again. The returned value
119 * should be zero indicating the read operation is EOF.
120 */
121 len = 0;
122
115 goto out; 123 goto out;
124 }
116retry: 125retry:
117 rc = len = erst_read(id, erst_dbg_buf, erst_dbg_buf_len); 126 rc = len = erst_read(id, erst_dbg_buf, erst_dbg_buf_len);
118 /* The record may be cleared by others, try read next record */ 127 /* The record may be cleared by others, try read next record */
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
index f09dc987cf17..c6ff606c6d5b 100644
--- a/drivers/acpi/device_pm.c
+++ b/drivers/acpi/device_pm.c
@@ -358,8 +358,7 @@ static struct acpi_device *acpi_dev_pm_get_node(struct device *dev)
358 acpi_handle handle = DEVICE_ACPI_HANDLE(dev); 358 acpi_handle handle = DEVICE_ACPI_HANDLE(dev);
359 struct acpi_device *adev; 359 struct acpi_device *adev;
360 360
361 return handle && ACPI_SUCCESS(acpi_bus_get_device(handle, &adev)) ? 361 return handle && !acpi_bus_get_device(handle, &adev) ? adev : NULL;
362 adev : NULL;
363} 362}
364 363
365/** 364/**
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index 01551840d236..35da18113216 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -18,9 +18,14 @@
18 18
19#define ACPI_GLUE_DEBUG 0 19#define ACPI_GLUE_DEBUG 0
20#if ACPI_GLUE_DEBUG 20#if ACPI_GLUE_DEBUG
21#define DBG(x...) printk(PREFIX x) 21#define DBG(fmt, ...) \
22 printk(KERN_DEBUG PREFIX fmt, ##__VA_ARGS__)
22#else 23#else
23#define DBG(x...) do { } while(0) 24#define DBG(fmt, ...) \
25do { \
26 if (0) \
27 printk(KERN_DEBUG PREFIX fmt, ##__VA_ARGS__); \
28} while (0)
24#endif 29#endif
25static LIST_HEAD(bus_type_list); 30static LIST_HEAD(bus_type_list);
26static DECLARE_RWSEM(bus_type_sem); 31static DECLARE_RWSEM(bus_type_sem);
@@ -292,7 +297,7 @@ static int acpi_platform_notify(struct device *dev)
292 if (!ret) { 297 if (!ret) {
293 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 298 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
294 299
295 acpi_get_name(dev->acpi_handle, ACPI_FULL_PATHNAME, &buffer); 300 acpi_get_name(ACPI_HANDLE(dev), ACPI_FULL_PATHNAME, &buffer);
296 DBG("Device %s -> %s\n", dev_name(dev), (char *)buffer.pointer); 301 DBG("Device %s -> %s\n", dev_name(dev), (char *)buffer.pointer);
297 kfree(buffer.pointer); 302 kfree(buffer.pointer);
298 } else 303 } else
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 3ff267861541..bd22f8667eed 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -250,7 +250,7 @@ acpi_physical_address __init acpi_os_get_root_pointer(void)
250 return acpi_rsdp; 250 return acpi_rsdp;
251#endif 251#endif
252 252
253 if (efi_enabled) { 253 if (efi_enabled(EFI_CONFIG_TABLES)) {
254 if (efi.acpi20 != EFI_INVALID_TABLE_ADDR) 254 if (efi.acpi20 != EFI_INVALID_TABLE_ADDR)
255 return efi.acpi20; 255 return efi.acpi20;
256 else if (efi.acpi != EFI_INVALID_TABLE_ADDR) 256 else if (efi.acpi != EFI_INVALID_TABLE_ADDR)
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index 7db61b8fa11f..6e7b9d523812 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -445,11 +445,8 @@ int acpi_power_resource_register_device(struct device *dev, acpi_handle handle)
445 return -ENODEV; 445 return -ENODEV;
446 446
447 ret = acpi_bus_get_device(handle, &acpi_dev); 447 ret = acpi_bus_get_device(handle, &acpi_dev);
448 if (ret) 448 if (ret || !acpi_dev->power.flags.power_resources)
449 goto no_power_resource; 449 return -ENODEV;
450
451 if (!acpi_dev->power.flags.power_resources)
452 goto no_power_resource;
453 450
454 powered_device = kzalloc(sizeof(*powered_device), GFP_KERNEL); 451 powered_device = kzalloc(sizeof(*powered_device), GFP_KERNEL);
455 if (!powered_device) 452 if (!powered_device)
@@ -471,10 +468,6 @@ int acpi_power_resource_register_device(struct device *dev, acpi_handle handle)
471 } 468 }
472 469
473 return ret; 470 return ret;
474
475no_power_resource:
476 printk(KERN_DEBUG PREFIX "Invalid Power Resource to register!\n");
477 return -ENODEV;
478} 471}
479EXPORT_SYMBOL_GPL(acpi_power_resource_register_device); 472EXPORT_SYMBOL_GPL(acpi_power_resource_register_device);
480 473
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index f1a5da44591d..ed9a1cc690be 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -958,6 +958,9 @@ static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr)
958 return -EINVAL; 958 return -EINVAL;
959 } 959 }
960 960
961 if (!dev)
962 return -EINVAL;
963
961 dev->cpu = pr->id; 964 dev->cpu = pr->id;
962 965
963 if (max_cstate == 0) 966 if (max_cstate == 0)
@@ -1149,6 +1152,7 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr)
1149 } 1152 }
1150 1153
1151 /* Populate Updated C-state information */ 1154 /* Populate Updated C-state information */
1155 acpi_processor_get_power_info(pr);
1152 acpi_processor_setup_cpuidle_states(pr); 1156 acpi_processor_setup_cpuidle_states(pr);
1153 1157
1154 /* Enable all cpuidle devices */ 1158 /* Enable all cpuidle devices */
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c
index 836bfe069042..53e7ac9403a7 100644
--- a/drivers/acpi/processor_perflib.c
+++ b/drivers/acpi/processor_perflib.c
@@ -340,6 +340,13 @@ static void amd_fixup_frequency(struct acpi_processor_px *px, int i)
340 if ((boot_cpu_data.x86 == 0x10 && boot_cpu_data.x86_model < 10) 340 if ((boot_cpu_data.x86 == 0x10 && boot_cpu_data.x86_model < 10)
341 || boot_cpu_data.x86 == 0x11) { 341 || boot_cpu_data.x86 == 0x11) {
342 rdmsr(MSR_AMD_PSTATE_DEF_BASE + index, lo, hi); 342 rdmsr(MSR_AMD_PSTATE_DEF_BASE + index, lo, hi);
343 /*
344 * MSR C001_0064+:
345 * Bit 63: PstateEn. Read-write. If set, the P-state is valid.
346 */
347 if (!(hi & BIT(31)))
348 return;
349
343 fid = lo & 0x3f; 350 fid = lo & 0x3f;
344 did = (lo >> 6) & 7; 351 did = (lo >> 6) & 7;
345 if (boot_cpu_data.x86 == 0x10) 352 if (boot_cpu_data.x86 == 0x10)
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 53502d1bbf26..c88be6c37c30 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1346,7 +1346,7 @@ static void acpi_device_set_id(struct acpi_device *device)
1346 acpi_add_id(device, ACPI_DOCK_HID); 1346 acpi_add_id(device, ACPI_DOCK_HID);
1347 else if (!acpi_ibm_smbus_match(device)) 1347 else if (!acpi_ibm_smbus_match(device))
1348 acpi_add_id(device, ACPI_SMBUS_IBM_HID); 1348 acpi_add_id(device, ACPI_SMBUS_IBM_HID);
1349 else if (!acpi_device_hid(device) && 1349 else if (list_empty(&device->pnp.ids) &&
1350 ACPI_IS_ROOT_DEVICE(device->parent)) { 1350 ACPI_IS_ROOT_DEVICE(device->parent)) {
1351 acpi_add_id(device, ACPI_BUS_HID); /* \_SB, LNXSYBUS */ 1351 acpi_add_id(device, ACPI_BUS_HID); /* \_SB, LNXSYBUS */
1352 strcpy(device->pnp.device_name, ACPI_BUS_DEVICE_NAME); 1352 strcpy(device->pnp.device_name, ACPI_BUS_DEVICE_NAME);
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index a2fc56d2e681..cdbad3a454a0 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -45,7 +45,6 @@ static int amba_match(struct device *dev, struct device_driver *drv)
45 return amba_lookup(pcdrv->id_table, pcdev) != NULL; 45 return amba_lookup(pcdrv->id_table, pcdev) != NULL;
46} 46}
47 47
48#ifdef CONFIG_HOTPLUG
49static int amba_uevent(struct device *dev, struct kobj_uevent_env *env) 48static int amba_uevent(struct device *dev, struct kobj_uevent_env *env)
50{ 49{
51 struct amba_device *pcdev = to_amba_device(dev); 50 struct amba_device *pcdev = to_amba_device(dev);
@@ -58,9 +57,6 @@ static int amba_uevent(struct device *dev, struct kobj_uevent_env *env)
58 retval = add_uevent_var(env, "MODALIAS=amba:d%08X", pcdev->periphid); 57 retval = add_uevent_var(env, "MODALIAS=amba:d%08X", pcdev->periphid);
59 return retval; 58 return retval;
60} 59}
61#else
62#define amba_uevent NULL
63#endif
64 60
65#define amba_attr_func(name,fmt,arg...) \ 61#define amba_attr_func(name,fmt,arg...) \
66static ssize_t name##_show(struct device *_dev, \ 62static ssize_t name##_show(struct device *_dev, \
diff --git a/drivers/amba/tegra-ahb.c b/drivers/amba/tegra-ahb.c
index 0576a7dd32a5..536c166f4253 100644
--- a/drivers/amba/tegra-ahb.c
+++ b/drivers/amba/tegra-ahb.c
@@ -243,7 +243,7 @@ static void tegra_ahb_gizmo_init(struct tegra_ahb *ahb)
243 gizmo_writel(ahb, val, AHB_MEM_PREFETCH_CFG4); 243 gizmo_writel(ahb, val, AHB_MEM_PREFETCH_CFG4);
244} 244}
245 245
246static int __devinit tegra_ahb_probe(struct platform_device *pdev) 246static int tegra_ahb_probe(struct platform_device *pdev)
247{ 247{
248 struct resource *res; 248 struct resource *res;
249 struct tegra_ahb *ahb; 249 struct tegra_ahb *ahb;
@@ -267,7 +267,7 @@ static int __devinit tegra_ahb_probe(struct platform_device *pdev)
267 return 0; 267 return 0;
268} 268}
269 269
270static const struct of_device_id tegra_ahb_of_match[] __devinitconst = { 270static const struct of_device_id tegra_ahb_of_match[] = {
271 { .compatible = "nvidia,tegra30-ahb", }, 271 { .compatible = "nvidia,tegra30-ahb", },
272 { .compatible = "nvidia,tegra20-ahb", }, 272 { .compatible = "nvidia,tegra20-ahb", },
273 {}, 273 {},
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 7862d17976b7..497912732566 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -53,6 +53,7 @@
53 53
54enum { 54enum {
55 AHCI_PCI_BAR_STA2X11 = 0, 55 AHCI_PCI_BAR_STA2X11 = 0,
56 AHCI_PCI_BAR_ENMOTUS = 2,
56 AHCI_PCI_BAR_STANDARD = 5, 57 AHCI_PCI_BAR_STANDARD = 5,
57}; 58};
58 59
@@ -410,6 +411,9 @@ static const struct pci_device_id ahci_pci_tbl[] = {
410 { PCI_VDEVICE(ASMEDIA, 0x0611), board_ahci }, /* ASM1061 */ 411 { PCI_VDEVICE(ASMEDIA, 0x0611), board_ahci }, /* ASM1061 */
411 { PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci }, /* ASM1062 */ 412 { PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci }, /* ASM1062 */
412 413
414 /* Enmotus */
415 { PCI_DEVICE(0x1c44, 0x8000), board_ahci },
416
413 /* Generic, PCI class code for AHCI */ 417 /* Generic, PCI class code for AHCI */
414 { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 418 { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
415 PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci }, 419 PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci },
@@ -1098,9 +1102,11 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1098 dev_info(&pdev->dev, 1102 dev_info(&pdev->dev,
1099 "PDC42819 can only drive SATA devices with this driver\n"); 1103 "PDC42819 can only drive SATA devices with this driver\n");
1100 1104
1101 /* The Connext uses non-standard BAR */ 1105 /* Both Connext and Enmotus devices use non-standard BARs */
1102 if (pdev->vendor == PCI_VENDOR_ID_STMICRO && pdev->device == 0xCC06) 1106 if (pdev->vendor == PCI_VENDOR_ID_STMICRO && pdev->device == 0xCC06)
1103 ahci_pci_bar = AHCI_PCI_BAR_STA2X11; 1107 ahci_pci_bar = AHCI_PCI_BAR_STA2X11;
1108 else if (pdev->vendor == 0x1c44 && pdev->device == 0x8000)
1109 ahci_pci_bar = AHCI_PCI_BAR_ENMOTUS;
1104 1110
1105 /* acquire resources */ 1111 /* acquire resources */
1106 rc = pcim_enable_device(pdev); 1112 rc = pcim_enable_device(pdev);
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
index 1cc467bdb63d..7a8a2841fe64 100644
--- a/drivers/ata/ahci_platform.c
+++ b/drivers/ata/ahci_platform.c
@@ -86,7 +86,7 @@ static struct scsi_host_template ahci_platform_sht = {
86 AHCI_SHT("ahci_platform"), 86 AHCI_SHT("ahci_platform"),
87}; 87};
88 88
89static int __devinit ahci_probe(struct platform_device *pdev) 89static int ahci_probe(struct platform_device *pdev)
90{ 90{
91 struct device *dev = &pdev->dev; 91 struct device *dev = &pdev->dev;
92 struct ahci_platform_data *pdata = dev_get_platdata(dev); 92 struct ahci_platform_data *pdata = dev_get_platdata(dev);
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index acffcf0b3ad3..174eca609b42 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -1270,7 +1270,7 @@ static int piix_disable_ahci(struct pci_dev *pdev)
1270 * they are found return an error code so we can turn off DMA 1270 * they are found return an error code so we can turn off DMA
1271 */ 1271 */
1272 1272
1273static int __devinit piix_check_450nx_errata(struct pci_dev *ata_dev) 1273static int piix_check_450nx_errata(struct pci_dev *ata_dev)
1274{ 1274{
1275 struct pci_dev *pdev = NULL; 1275 struct pci_dev *pdev = NULL;
1276 u16 cfg; 1276 u16 cfg;
@@ -1296,8 +1296,8 @@ static int __devinit piix_check_450nx_errata(struct pci_dev *ata_dev)
1296 return no_piix_dma; 1296 return no_piix_dma;
1297} 1297}
1298 1298
1299static void __devinit piix_init_pcs(struct ata_host *host, 1299static void piix_init_pcs(struct ata_host *host,
1300 const struct piix_map_db *map_db) 1300 const struct piix_map_db *map_db)
1301{ 1301{
1302 struct pci_dev *pdev = to_pci_dev(host->dev); 1302 struct pci_dev *pdev = to_pci_dev(host->dev);
1303 u16 pcs, new_pcs; 1303 u16 pcs, new_pcs;
@@ -1313,9 +1313,9 @@ static void __devinit piix_init_pcs(struct ata_host *host,
1313 } 1313 }
1314} 1314}
1315 1315
1316static const int *__devinit piix_init_sata_map(struct pci_dev *pdev, 1316static const int *piix_init_sata_map(struct pci_dev *pdev,
1317 struct ata_port_info *pinfo, 1317 struct ata_port_info *pinfo,
1318 const struct piix_map_db *map_db) 1318 const struct piix_map_db *map_db)
1319{ 1319{
1320 const int *map; 1320 const int *map;
1321 int i, invalid_map = 0; 1321 int i, invalid_map = 0;
@@ -1392,7 +1392,7 @@ static bool piix_no_sidpr(struct ata_host *host)
1392 return false; 1392 return false;
1393} 1393}
1394 1394
1395static int __devinit piix_init_sidpr(struct ata_host *host) 1395static int piix_init_sidpr(struct ata_host *host)
1396{ 1396{
1397 struct pci_dev *pdev = to_pci_dev(host->dev); 1397 struct pci_dev *pdev = to_pci_dev(host->dev);
1398 struct piix_host_priv *hpriv = host->private_data; 1398 struct piix_host_priv *hpriv = host->private_data;
@@ -1595,8 +1595,7 @@ static void piix_ignore_devices_quirk(struct ata_host *host)
1595 * Zero on success, or -ERRNO value. 1595 * Zero on success, or -ERRNO value.
1596 */ 1596 */
1597 1597
1598static int __devinit piix_init_one(struct pci_dev *pdev, 1598static int piix_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1599 const struct pci_device_id *ent)
1600{ 1599{
1601 struct device *dev = &pdev->dev; 1600 struct device *dev = &pdev->dev;
1602 struct ata_port_info port_info[2]; 1601 struct ata_port_info port_info[2];
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 320712a7b9ea..6cd7805e47ca 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -1951,13 +1951,13 @@ static void ahci_set_aggressive_devslp(struct ata_port *ap, bool sleep)
1951 /* Use the nominal value 10 ms if the read MDAT is zero, 1951 /* Use the nominal value 10 ms if the read MDAT is zero,
1952 * the nominal value of DETO is 20 ms. 1952 * the nominal value of DETO is 20 ms.
1953 */ 1953 */
1954 if (dev->sata_settings[ATA_LOG_DEVSLP_VALID] & 1954 if (dev->devslp_timing[ATA_LOG_DEVSLP_VALID] &
1955 ATA_LOG_DEVSLP_VALID_MASK) { 1955 ATA_LOG_DEVSLP_VALID_MASK) {
1956 mdat = dev->sata_settings[ATA_LOG_DEVSLP_MDAT] & 1956 mdat = dev->devslp_timing[ATA_LOG_DEVSLP_MDAT] &
1957 ATA_LOG_DEVSLP_MDAT_MASK; 1957 ATA_LOG_DEVSLP_MDAT_MASK;
1958 if (!mdat) 1958 if (!mdat)
1959 mdat = 10; 1959 mdat = 10;
1960 deto = dev->sata_settings[ATA_LOG_DEVSLP_DETO]; 1960 deto = dev->devslp_timing[ATA_LOG_DEVSLP_DETO];
1961 if (!deto) 1961 if (!deto)
1962 deto = 20; 1962 deto = 20;
1963 } else { 1963 } else {
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 9e8b99af400d..46cd3f4c6aaa 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2325,24 +2325,28 @@ int ata_dev_configure(struct ata_device *dev)
2325 } 2325 }
2326 } 2326 }
2327 2327
2328 /* check and mark DevSlp capability */ 2328 /* Check and mark DevSlp capability. Get DevSlp timing variables
2329 if (ata_id_has_devslp(dev->id)) 2329 * from SATA Settings page of Identify Device Data Log.
2330 dev->flags |= ATA_DFLAG_DEVSLP;
2331
2332 /* Obtain SATA Settings page from Identify Device Data Log,
2333 * which contains DevSlp timing variables etc.
2334 * Exclude old devices with ata_id_has_ncq()
2335 */ 2330 */
2336 if (ata_id_has_ncq(dev->id)) { 2331 if (ata_id_has_devslp(dev->id)) {
2332 u8 sata_setting[ATA_SECT_SIZE];
2333 int i, j;
2334
2335 dev->flags |= ATA_DFLAG_DEVSLP;
2337 err_mask = ata_read_log_page(dev, 2336 err_mask = ata_read_log_page(dev,
2338 ATA_LOG_SATA_ID_DEV_DATA, 2337 ATA_LOG_SATA_ID_DEV_DATA,
2339 ATA_LOG_SATA_SETTINGS, 2338 ATA_LOG_SATA_SETTINGS,
2340 dev->sata_settings, 2339 sata_setting,
2341 1); 2340 1);
2342 if (err_mask) 2341 if (err_mask)
2343 ata_dev_dbg(dev, 2342 ata_dev_dbg(dev,
2344 "failed to get Identify Device Data, Emask 0x%x\n", 2343 "failed to get Identify Device Data, Emask 0x%x\n",
2345 err_mask); 2344 err_mask);
2345 else
2346 for (i = 0; i < ATA_LOG_DEVSLP_SIZE; i++) {
2347 j = ATA_LOG_DEVSLP_OFFSET + i;
2348 dev->devslp_timing[i] = sata_setting[j];
2349 }
2346 } 2350 }
2347 2351
2348 dev->cdb_len = 16; 2352 dev->cdb_len = 16;
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index bf039b0e97b7..bcf4437214f5 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -2094,7 +2094,7 @@ static unsigned int ata_eh_speed_down(struct ata_device *dev,
2094 */ 2094 */
2095static inline int ata_eh_worth_retry(struct ata_queued_cmd *qc) 2095static inline int ata_eh_worth_retry(struct ata_queued_cmd *qc)
2096{ 2096{
2097 if (qc->flags & AC_ERR_MEDIA) 2097 if (qc->err_mask & AC_ERR_MEDIA)
2098 return 0; /* don't retry media errors */ 2098 return 0; /* don't retry media errors */
2099 if (qc->flags & ATA_QCFLAG_IO) 2099 if (qc->flags & ATA_QCFLAG_IO)
2100 return 1; /* otherwise retry anything from fs stack */ 2100 return 1; /* otherwise retry anything from fs stack */
diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c
index 9764e80f9320..405022d302c3 100644
--- a/drivers/ata/pata_arasan_cf.c
+++ b/drivers/ata/pata_arasan_cf.c
@@ -791,7 +791,7 @@ static struct ata_port_operations arasan_cf_ops = {
791 .set_dmamode = arasan_cf_set_dmamode, 791 .set_dmamode = arasan_cf_set_dmamode,
792}; 792};
793 793
794static int __devinit arasan_cf_probe(struct platform_device *pdev) 794static int arasan_cf_probe(struct platform_device *pdev)
795{ 795{
796 struct arasan_cf_dev *acdev; 796 struct arasan_cf_dev *acdev;
797 struct arasan_cf_pdata *pdata = dev_get_platdata(&pdev->dev); 797 struct arasan_cf_pdata *pdata = dev_get_platdata(&pdev->dev);
@@ -905,7 +905,7 @@ free_clk:
905 return ret; 905 return ret;
906} 906}
907 907
908static int __devexit arasan_cf_remove(struct platform_device *pdev) 908static int arasan_cf_remove(struct platform_device *pdev)
909{ 909{
910 struct ata_host *host = dev_get_drvdata(&pdev->dev); 910 struct ata_host *host = dev_get_drvdata(&pdev->dev);
911 struct arasan_cf_dev *acdev = host->ports[0]->private_data; 911 struct arasan_cf_dev *acdev = host->ports[0]->private_data;
@@ -955,7 +955,7 @@ MODULE_DEVICE_TABLE(of, arasan_cf_id_table);
955 955
956static struct platform_driver arasan_cf_driver = { 956static struct platform_driver arasan_cf_driver = {
957 .probe = arasan_cf_probe, 957 .probe = arasan_cf_probe,
958 .remove = __devexit_p(arasan_cf_remove), 958 .remove = arasan_cf_remove,
959 .driver = { 959 .driver = {
960 .name = DRIVER_NAME, 960 .name = DRIVER_NAME,
961 .owner = THIS_MODULE, 961 .owner = THIS_MODULE,
diff --git a/drivers/ata/pata_at91.c b/drivers/ata/pata_at91.c
index 2a96bb2c53ee..033f3f4c20ad 100644
--- a/drivers/ata/pata_at91.c
+++ b/drivers/ata/pata_at91.c
@@ -313,7 +313,7 @@ static struct ata_port_operations pata_at91_port_ops = {
313 .cable_detect = ata_cable_40wire, 313 .cable_detect = ata_cable_40wire,
314}; 314};
315 315
316static int __devinit pata_at91_probe(struct platform_device *pdev) 316static int pata_at91_probe(struct platform_device *pdev)
317{ 317{
318 struct at91_cf_data *board = pdev->dev.platform_data; 318 struct at91_cf_data *board = pdev->dev.platform_data;
319 struct device *dev = &pdev->dev; 319 struct device *dev = &pdev->dev;
@@ -420,7 +420,7 @@ err_put:
420 return ret; 420 return ret;
421} 421}
422 422
423static int __devexit pata_at91_remove(struct platform_device *pdev) 423static int pata_at91_remove(struct platform_device *pdev)
424{ 424{
425 struct ata_host *host = dev_get_drvdata(&pdev->dev); 425 struct ata_host *host = dev_get_drvdata(&pdev->dev);
426 struct at91_ide_info *info; 426 struct at91_ide_info *info;
@@ -441,7 +441,7 @@ static int __devexit pata_at91_remove(struct platform_device *pdev)
441 441
442static struct platform_driver pata_at91_driver = { 442static struct platform_driver pata_at91_driver = {
443 .probe = pata_at91_probe, 443 .probe = pata_at91_probe,
444 .remove = __devexit_p(pata_at91_remove), 444 .remove = pata_at91_remove,
445 .driver = { 445 .driver = {
446 .name = DRV_NAME, 446 .name = DRV_NAME,
447 .owner = THIS_MODULE, 447 .owner = THIS_MODULE,
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c
index 1e65842e2ca7..8d43510c6bec 100644
--- a/drivers/ata/pata_bf54x.c
+++ b/drivers/ata/pata_bf54x.c
@@ -1538,7 +1538,7 @@ static unsigned short atapi_io_port[] = {
1538 * - IRQ (IORESOURCE_IRQ) 1538 * - IRQ (IORESOURCE_IRQ)
1539 * 1539 *
1540 */ 1540 */
1541static int __devinit bfin_atapi_probe(struct platform_device *pdev) 1541static int bfin_atapi_probe(struct platform_device *pdev)
1542{ 1542{
1543 int board_idx = 0; 1543 int board_idx = 0;
1544 struct resource *res; 1544 struct resource *res;
@@ -1608,7 +1608,7 @@ static int __devinit bfin_atapi_probe(struct platform_device *pdev)
1608 * A bfin atapi device has been unplugged. Perform the needed 1608 * A bfin atapi device has been unplugged. Perform the needed
1609 * cleanup. Also called on module unload for any active devices. 1609 * cleanup. Also called on module unload for any active devices.
1610 */ 1610 */
1611static int __devexit bfin_atapi_remove(struct platform_device *pdev) 1611static int bfin_atapi_remove(struct platform_device *pdev)
1612{ 1612{
1613 struct device *dev = &pdev->dev; 1613 struct device *dev = &pdev->dev;
1614 struct ata_host *host = dev_get_drvdata(dev); 1614 struct ata_host *host = dev_get_drvdata(dev);
@@ -1654,7 +1654,7 @@ static int bfin_atapi_resume(struct platform_device *pdev)
1654 1654
1655static struct platform_driver bfin_atapi_driver = { 1655static struct platform_driver bfin_atapi_driver = {
1656 .probe = bfin_atapi_probe, 1656 .probe = bfin_atapi_probe,
1657 .remove = __devexit_p(bfin_atapi_remove), 1657 .remove = bfin_atapi_remove,
1658 .suspend = bfin_atapi_suspend, 1658 .suspend = bfin_atapi_suspend,
1659 .resume = bfin_atapi_resume, 1659 .resume = bfin_atapi_resume,
1660 .driver = { 1660 .driver = {
diff --git a/drivers/ata/pata_cs5520.c b/drivers/ata/pata_cs5520.c
index de74d804f031..bfcf377e8f77 100644
--- a/drivers/ata/pata_cs5520.c
+++ b/drivers/ata/pata_cs5520.c
@@ -115,7 +115,7 @@ static struct ata_port_operations cs5520_port_ops = {
115 .set_piomode = cs5520_set_piomode, 115 .set_piomode = cs5520_set_piomode,
116}; 116};
117 117
118static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_device_id *id) 118static int cs5520_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
119{ 119{
120 static const unsigned int cmd_port[] = { 0x1F0, 0x170 }; 120 static const unsigned int cmd_port[] = { 0x1F0, 0x170 };
121 static const unsigned int ctl_port[] = { 0x3F6, 0x376 }; 121 static const unsigned int ctl_port[] = { 0x3F6, 0x376 };
diff --git a/drivers/ata/pata_ep93xx.c b/drivers/ata/pata_ep93xx.c
index 3982cef91f3c..556222f04731 100644
--- a/drivers/ata/pata_ep93xx.c
+++ b/drivers/ata/pata_ep93xx.c
@@ -910,7 +910,7 @@ static struct ata_port_operations ep93xx_pata_port_ops = {
910 .port_start = ep93xx_pata_port_start, 910 .port_start = ep93xx_pata_port_start,
911}; 911};
912 912
913static int __devinit ep93xx_pata_probe(struct platform_device *pdev) 913static int ep93xx_pata_probe(struct platform_device *pdev)
914{ 914{
915 struct ep93xx_pata_data *drv_data; 915 struct ep93xx_pata_data *drv_data;
916 struct ata_host *host; 916 struct ata_host *host;
@@ -1011,7 +1011,7 @@ err_rel_gpio:
1011 return err; 1011 return err;
1012} 1012}
1013 1013
1014static int __devexit ep93xx_pata_remove(struct platform_device *pdev) 1014static int ep93xx_pata_remove(struct platform_device *pdev)
1015{ 1015{
1016 struct ata_host *host = platform_get_drvdata(pdev); 1016 struct ata_host *host = platform_get_drvdata(pdev);
1017 struct ep93xx_pata_data *drv_data = host->private_data; 1017 struct ep93xx_pata_data *drv_data = host->private_data;
@@ -1029,7 +1029,7 @@ static struct platform_driver ep93xx_pata_platform_driver = {
1029 .owner = THIS_MODULE, 1029 .owner = THIS_MODULE,
1030 }, 1030 },
1031 .probe = ep93xx_pata_probe, 1031 .probe = ep93xx_pata_probe,
1032 .remove = __devexit_p(ep93xx_pata_remove), 1032 .remove = ep93xx_pata_remove,
1033}; 1033};
1034 1034
1035module_platform_driver(ep93xx_pata_platform_driver); 1035module_platform_driver(ep93xx_pata_platform_driver);
diff --git a/drivers/ata/pata_icside.c b/drivers/ata/pata_icside.c
index 52e7e7b8c74f..d7c732042a4f 100644
--- a/drivers/ata/pata_icside.c
+++ b/drivers/ata/pata_icside.c
@@ -337,10 +337,9 @@ static struct ata_port_operations pata_icside_port_ops = {
337 .port_start = ATA_OP_NULL, /* don't need PRD table */ 337 .port_start = ATA_OP_NULL, /* don't need PRD table */
338}; 338};
339 339
340static void __devinit 340static void pata_icside_setup_ioaddr(struct ata_port *ap, void __iomem *base,
341pata_icside_setup_ioaddr(struct ata_port *ap, void __iomem *base, 341 struct pata_icside_info *info,
342 struct pata_icside_info *info, 342 const struct portinfo *port)
343 const struct portinfo *port)
344{ 343{
345 struct ata_ioports *ioaddr = &ap->ioaddr; 344 struct ata_ioports *ioaddr = &ap->ioaddr;
346 void __iomem *cmd = base + port->dataoffset; 345 void __iomem *cmd = base + port->dataoffset;
@@ -368,7 +367,7 @@ pata_icside_setup_ioaddr(struct ata_port *ap, void __iomem *base,
368 ata_port_desc(ap, "iocbase 0x%lx", info->raw_ioc_base); 367 ata_port_desc(ap, "iocbase 0x%lx", info->raw_ioc_base);
369} 368}
370 369
371static int __devinit pata_icside_register_v5(struct pata_icside_info *info) 370static int pata_icside_register_v5(struct pata_icside_info *info)
372{ 371{
373 struct pata_icside_state *state = info->state; 372 struct pata_icside_state *state = info->state;
374 void __iomem *base; 373 void __iomem *base;
@@ -391,7 +390,7 @@ static int __devinit pata_icside_register_v5(struct pata_icside_info *info)
391 return 0; 390 return 0;
392} 391}
393 392
394static int __devinit pata_icside_register_v6(struct pata_icside_info *info) 393static int pata_icside_register_v6(struct pata_icside_info *info)
395{ 394{
396 struct pata_icside_state *state = info->state; 395 struct pata_icside_state *state = info->state;
397 struct expansion_card *ec = info->ec; 396 struct expansion_card *ec = info->ec;
@@ -434,7 +433,7 @@ static int __devinit pata_icside_register_v6(struct pata_icside_info *info)
434 return icside_dma_init(info); 433 return icside_dma_init(info);
435} 434}
436 435
437static int __devinit pata_icside_add_ports(struct pata_icside_info *info) 436static int pata_icside_add_ports(struct pata_icside_info *info)
438{ 437{
439 struct expansion_card *ec = info->ec; 438 struct expansion_card *ec = info->ec;
440 struct ata_host *host; 439 struct ata_host *host;
@@ -474,8 +473,8 @@ static int __devinit pata_icside_add_ports(struct pata_icside_info *info)
474 &pata_icside_sht); 473 &pata_icside_sht);
475} 474}
476 475
477static int __devinit 476static int pata_icside_probe(struct expansion_card *ec,
478pata_icside_probe(struct expansion_card *ec, const struct ecard_id *id) 477 const struct ecard_id *id)
479{ 478{
480 struct pata_icside_state *state; 479 struct pata_icside_state *state;
481 struct pata_icside_info info; 480 struct pata_icside_info info;
@@ -575,7 +574,7 @@ static void pata_icside_shutdown(struct expansion_card *ec)
575 } 574 }
576} 575}
577 576
578static void __devexit pata_icside_remove(struct expansion_card *ec) 577static void pata_icside_remove(struct expansion_card *ec)
579{ 578{
580 struct ata_host *host = ecard_get_drvdata(ec); 579 struct ata_host *host = ecard_get_drvdata(ec);
581 struct pata_icside_state *state = host->private_data; 580 struct pata_icside_state *state = host->private_data;
@@ -602,7 +601,7 @@ static const struct ecard_id pata_icside_ids[] = {
602 601
603static struct ecard_driver pata_icside_driver = { 602static struct ecard_driver pata_icside_driver = {
604 .probe = pata_icside_probe, 603 .probe = pata_icside_probe,
605 .remove = __devexit_p(pata_icside_remove), 604 .remove = pata_icside_remove,
606 .shutdown = pata_icside_shutdown, 605 .shutdown = pata_icside_shutdown,
607 .id_table = pata_icside_ids, 606 .id_table = pata_icside_ids,
608 .drv = { 607 .drv = {
diff --git a/drivers/ata/pata_imx.c b/drivers/ata/pata_imx.c
index 7d40b526ef11..40849445a9dc 100644
--- a/drivers/ata/pata_imx.c
+++ b/drivers/ata/pata_imx.c
@@ -91,7 +91,7 @@ static void pata_imx_setup_port(struct ata_ioports *ioaddr)
91 ioaddr->command_addr = ioaddr->cmd_addr + (ATA_REG_CMD << 2); 91 ioaddr->command_addr = ioaddr->cmd_addr + (ATA_REG_CMD << 2);
92} 92}
93 93
94static int __devinit pata_imx_probe(struct platform_device *pdev) 94static int pata_imx_probe(struct platform_device *pdev)
95{ 95{
96 struct ata_host *host; 96 struct ata_host *host;
97 struct ata_port *ap; 97 struct ata_port *ap;
@@ -167,7 +167,7 @@ free_priv:
167 return -ENOMEM; 167 return -ENOMEM;
168} 168}
169 169
170static int __devexit pata_imx_remove(struct platform_device *pdev) 170static int pata_imx_remove(struct platform_device *pdev)
171{ 171{
172 struct ata_host *host = dev_get_drvdata(&pdev->dev); 172 struct ata_host *host = dev_get_drvdata(&pdev->dev);
173 struct pata_imx_priv *priv = host->private_data; 173 struct pata_imx_priv *priv = host->private_data;
@@ -225,7 +225,7 @@ static const struct dev_pm_ops pata_imx_pm_ops = {
225 225
226static struct platform_driver pata_imx_driver = { 226static struct platform_driver pata_imx_driver = {
227 .probe = pata_imx_probe, 227 .probe = pata_imx_probe,
228 .remove = __devexit_p(pata_imx_remove), 228 .remove = pata_imx_remove,
229 .driver = { 229 .driver = {
230 .name = DRV_NAME, 230 .name = DRV_NAME,
231 .owner = THIS_MODULE, 231 .owner = THIS_MODULE,
diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c
index 0566e67b5e12..dcc6b243e525 100644
--- a/drivers/ata/pata_ixp4xx_cf.c
+++ b/drivers/ata/pata_ixp4xx_cf.c
@@ -137,7 +137,7 @@ static void ixp4xx_setup_port(struct ata_port *ap,
137 ata_port_desc(ap, "cmd 0x%lx ctl 0x%lx", raw_cmd, raw_ctl); 137 ata_port_desc(ap, "cmd 0x%lx ctl 0x%lx", raw_cmd, raw_ctl);
138} 138}
139 139
140static __devinit int ixp4xx_pata_probe(struct platform_device *pdev) 140static int ixp4xx_pata_probe(struct platform_device *pdev)
141{ 141{
142 unsigned int irq; 142 unsigned int irq;
143 struct resource *cs0, *cs1; 143 struct resource *cs0, *cs1;
diff --git a/drivers/ata/pata_macio.c b/drivers/ata/pata_macio.c
index b057e3fa44bc..e5725edcf515 100644
--- a/drivers/ata/pata_macio.c
+++ b/drivers/ata/pata_macio.c
@@ -935,7 +935,7 @@ static struct ata_port_operations pata_macio_ops = {
935 .sff_irq_clear = pata_macio_irq_clear, 935 .sff_irq_clear = pata_macio_irq_clear,
936}; 936};
937 937
938static void __devinit pata_macio_invariants(struct pata_macio_priv *priv) 938static void pata_macio_invariants(struct pata_macio_priv *priv)
939{ 939{
940 const int *bidp; 940 const int *bidp;
941 941
@@ -976,9 +976,8 @@ static void __devinit pata_macio_invariants(struct pata_macio_priv *priv)
976 priv->aapl_bus_id = 1; 976 priv->aapl_bus_id = 1;
977} 977}
978 978
979static void __devinit pata_macio_setup_ios(struct ata_ioports *ioaddr, 979static void pata_macio_setup_ios(struct ata_ioports *ioaddr,
980 void __iomem * base, 980 void __iomem * base, void __iomem * dma)
981 void __iomem * dma)
982{ 981{
983 /* cmd_addr is the base of regs for that port */ 982 /* cmd_addr is the base of regs for that port */
984 ioaddr->cmd_addr = base; 983 ioaddr->cmd_addr = base;
@@ -999,8 +998,8 @@ static void __devinit pata_macio_setup_ios(struct ata_ioports *ioaddr,
999 ioaddr->bmdma_addr = dma; 998 ioaddr->bmdma_addr = dma;
1000} 999}
1001 1000
1002static void __devinit pmac_macio_calc_timing_masks(struct pata_macio_priv *priv, 1001static void pmac_macio_calc_timing_masks(struct pata_macio_priv *priv,
1003 struct ata_port_info *pinfo) 1002 struct ata_port_info *pinfo)
1004{ 1003{
1005 int i = 0; 1004 int i = 0;
1006 1005
@@ -1027,11 +1026,11 @@ static void __devinit pmac_macio_calc_timing_masks(struct pata_macio_priv *priv,
1027 pinfo->pio_mask, pinfo->mwdma_mask, pinfo->udma_mask); 1026 pinfo->pio_mask, pinfo->mwdma_mask, pinfo->udma_mask);
1028} 1027}
1029 1028
1030static int __devinit pata_macio_common_init(struct pata_macio_priv *priv, 1029static int pata_macio_common_init(struct pata_macio_priv *priv,
1031 resource_size_t tfregs, 1030 resource_size_t tfregs,
1032 resource_size_t dmaregs, 1031 resource_size_t dmaregs,
1033 resource_size_t fcregs, 1032 resource_size_t fcregs,
1034 unsigned long irq) 1033 unsigned long irq)
1035{ 1034{
1036 struct ata_port_info pinfo; 1035 struct ata_port_info pinfo;
1037 const struct ata_port_info *ppi[] = { &pinfo, NULL }; 1036 const struct ata_port_info *ppi[] = { &pinfo, NULL };
@@ -1113,8 +1112,8 @@ static int __devinit pata_macio_common_init(struct pata_macio_priv *priv,
1113 &pata_macio_sht); 1112 &pata_macio_sht);
1114} 1113}
1115 1114
1116static int __devinit pata_macio_attach(struct macio_dev *mdev, 1115static int pata_macio_attach(struct macio_dev *mdev,
1117 const struct of_device_id *match) 1116 const struct of_device_id *match)
1118{ 1117{
1119 struct pata_macio_priv *priv; 1118 struct pata_macio_priv *priv;
1120 resource_size_t tfregs, dmaregs = 0; 1119 resource_size_t tfregs, dmaregs = 0;
@@ -1190,7 +1189,7 @@ static int __devinit pata_macio_attach(struct macio_dev *mdev,
1190 return rc; 1189 return rc;
1191} 1190}
1192 1191
1193static int __devexit pata_macio_detach(struct macio_dev *mdev) 1192static int pata_macio_detach(struct macio_dev *mdev)
1194{ 1193{
1195 struct ata_host *host = macio_get_drvdata(mdev); 1194 struct ata_host *host = macio_get_drvdata(mdev);
1196 struct pata_macio_priv *priv = host->private_data; 1195 struct pata_macio_priv *priv = host->private_data;
@@ -1257,8 +1256,8 @@ static void pata_macio_mb_event(struct macio_dev* mdev, int mb_state)
1257#endif /* CONFIG_PMAC_MEDIABAY */ 1256#endif /* CONFIG_PMAC_MEDIABAY */
1258 1257
1259 1258
1260static int __devinit pata_macio_pci_attach(struct pci_dev *pdev, 1259static int pata_macio_pci_attach(struct pci_dev *pdev,
1261 const struct pci_device_id *id) 1260 const struct pci_device_id *id)
1262{ 1261{
1263 struct pata_macio_priv *priv; 1262 struct pata_macio_priv *priv;
1264 struct device_node *np; 1263 struct device_node *np;
@@ -1310,7 +1309,7 @@ static int __devinit pata_macio_pci_attach(struct pci_dev *pdev,
1310 return 0; 1309 return 0;
1311} 1310}
1312 1311
1313static void __devexit pata_macio_pci_detach(struct pci_dev *pdev) 1312static void pata_macio_pci_detach(struct pci_dev *pdev)
1314{ 1313{
1315 struct ata_host *host = dev_get_drvdata(&pdev->dev); 1314 struct ata_host *host = dev_get_drvdata(&pdev->dev);
1316 1315
diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c
index ec67f54dc56f..652f57e83484 100644
--- a/drivers/ata/pata_mpc52xx.c
+++ b/drivers/ata/pata_mpc52xx.c
@@ -621,9 +621,10 @@ static struct ata_port_operations mpc52xx_ata_port_ops = {
621 .qc_prep = ata_noop_qc_prep, 621 .qc_prep = ata_noop_qc_prep,
622}; 622};
623 623
624static int __devinit 624static int mpc52xx_ata_init_one(struct device *dev,
625mpc52xx_ata_init_one(struct device *dev, struct mpc52xx_ata_priv *priv, 625 struct mpc52xx_ata_priv *priv,
626 unsigned long raw_ata_regs, int mwdma_mask, int udma_mask) 626 unsigned long raw_ata_regs,
627 int mwdma_mask, int udma_mask)
627{ 628{
628 struct ata_host *host; 629 struct ata_host *host;
629 struct ata_port *ap; 630 struct ata_port *ap;
@@ -667,8 +668,7 @@ mpc52xx_ata_init_one(struct device *dev, struct mpc52xx_ata_priv *priv,
667/* OF Platform driver */ 668/* OF Platform driver */
668/* ======================================================================== */ 669/* ======================================================================== */
669 670
670static int __devinit 671static int mpc52xx_ata_probe(struct platform_device *op)
671mpc52xx_ata_probe(struct platform_device *op)
672{ 672{
673 unsigned int ipb_freq; 673 unsigned int ipb_freq;
674 struct resource res_mem; 674 struct resource res_mem;
diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
index 4e1194b4c271..ff2e57f3b597 100644
--- a/drivers/ata/pata_octeon_cf.c
+++ b/drivers/ata/pata_octeon_cf.c
@@ -840,7 +840,7 @@ static struct ata_port_operations octeon_cf_ops = {
840 .dev_config = octeon_cf_dev_config, 840 .dev_config = octeon_cf_dev_config,
841}; 841};
842 842
843static int __devinit octeon_cf_probe(struct platform_device *pdev) 843static int octeon_cf_probe(struct platform_device *pdev)
844{ 844{
845 struct resource *res_cs0, *res_cs1; 845 struct resource *res_cs0, *res_cs1;
846 846
diff --git a/drivers/ata/pata_of_platform.c b/drivers/ata/pata_of_platform.c
index e5b234c370fa..a7e95a54c782 100644
--- a/drivers/ata/pata_of_platform.c
+++ b/drivers/ata/pata_of_platform.c
@@ -16,7 +16,7 @@
16#include <linux/ata_platform.h> 16#include <linux/ata_platform.h>
17#include <linux/libata.h> 17#include <linux/libata.h>
18 18
19static int __devinit pata_of_platform_probe(struct platform_device *ofdev) 19static int pata_of_platform_probe(struct platform_device *ofdev)
20{ 20{
21 int ret; 21 int ret;
22 struct device_node *dn = ofdev->dev.of_node; 22 struct device_node *dn = ofdev->dev.of_node;
diff --git a/drivers/ata/pata_palmld.c b/drivers/ata/pata_palmld.c
index f9f79fc04a8f..df2bb7504fc8 100644
--- a/drivers/ata/pata_palmld.c
+++ b/drivers/ata/pata_palmld.c
@@ -48,7 +48,7 @@ static struct ata_port_operations palmld_port_ops = {
48 .cable_detect = ata_cable_40wire, 48 .cable_detect = ata_cable_40wire,
49}; 49};
50 50
51static __devinit int palmld_pata_probe(struct platform_device *pdev) 51static int palmld_pata_probe(struct platform_device *pdev)
52{ 52{
53 struct ata_host *host; 53 struct ata_host *host;
54 struct ata_port *ap; 54 struct ata_port *ap;
@@ -109,7 +109,7 @@ err1:
109 return ret; 109 return ret;
110} 110}
111 111
112static __devexit int palmld_pata_remove(struct platform_device *dev) 112static int palmld_pata_remove(struct platform_device *dev)
113{ 113{
114 ata_platform_remove_one(dev); 114 ata_platform_remove_one(dev);
115 115
@@ -127,7 +127,7 @@ static struct platform_driver palmld_pata_platform_driver = {
127 .owner = THIS_MODULE, 127 .owner = THIS_MODULE,
128 }, 128 },
129 .probe = palmld_pata_probe, 129 .probe = palmld_pata_probe,
130 .remove = __devexit_p(palmld_pata_remove), 130 .remove = palmld_pata_remove,
131}; 131};
132 132
133module_platform_driver(palmld_pata_platform_driver); 133module_platform_driver(palmld_pata_platform_driver);
diff --git a/drivers/ata/pata_pdc2027x.c b/drivers/ata/pata_pdc2027x.c
index c9399c8688c5..3f94a886bb35 100644
--- a/drivers/ata/pata_pdc2027x.c
+++ b/drivers/ata/pata_pdc2027x.c
@@ -700,7 +700,8 @@ static void pdc_ata_setup_port(struct ata_ioports *port, void __iomem *base)
700 * @pdev: instance of pci_dev found 700 * @pdev: instance of pci_dev found
701 * @ent: matching entry in the id_tbl[] 701 * @ent: matching entry in the id_tbl[]
702 */ 702 */
703static int __devinit pdc2027x_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 703static int pdc2027x_init_one(struct pci_dev *pdev,
704 const struct pci_device_id *ent)
704{ 705{
705 static const unsigned long cmd_offset[] = { 0x17c0, 0x15c0 }; 706 static const unsigned long cmd_offset[] = { 0x17c0, 0x15c0 };
706 static const unsigned long bmdma_offset[] = { 0x1000, 0x1008 }; 707 static const unsigned long bmdma_offset[] = { 0x1000, 0x1008 };
diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c
index f4372d0c7ce6..71e093767f4e 100644
--- a/drivers/ata/pata_platform.c
+++ b/drivers/ata/pata_platform.c
@@ -98,12 +98,9 @@ static void pata_platform_setup_port(struct ata_ioports *ioaddr,
98 * 98 *
99 * If no IRQ resource is present, PIO polling mode is used instead. 99 * If no IRQ resource is present, PIO polling mode is used instead.
100 */ 100 */
101int __devinit __pata_platform_probe(struct device *dev, 101int __pata_platform_probe(struct device *dev, struct resource *io_res,
102 struct resource *io_res, 102 struct resource *ctl_res, struct resource *irq_res,
103 struct resource *ctl_res, 103 unsigned int ioport_shift, int __pio_mask)
104 struct resource *irq_res,
105 unsigned int ioport_shift,
106 int __pio_mask)
107{ 104{
108 struct ata_host *host; 105 struct ata_host *host;
109 struct ata_port *ap; 106 struct ata_port *ap;
@@ -178,7 +175,7 @@ int __devinit __pata_platform_probe(struct device *dev,
178} 175}
179EXPORT_SYMBOL_GPL(__pata_platform_probe); 176EXPORT_SYMBOL_GPL(__pata_platform_probe);
180 177
181static int __devinit pata_platform_probe(struct platform_device *pdev) 178static int pata_platform_probe(struct platform_device *pdev)
182{ 179{
183 struct resource *io_res; 180 struct resource *io_res;
184 struct resource *ctl_res; 181 struct resource *ctl_res;
diff --git a/drivers/ata/pata_pxa.c b/drivers/ata/pata_pxa.c
index 4b8ba559fe24..b0ac9e0c5e01 100644
--- a/drivers/ata/pata_pxa.c
+++ b/drivers/ata/pata_pxa.c
@@ -229,7 +229,7 @@ static void pxa_ata_dma_irq(int dma, void *port)
229 complete(&pd->dma_done); 229 complete(&pd->dma_done);
230} 230}
231 231
232static int __devinit pxa_ata_probe(struct platform_device *pdev) 232static int pxa_ata_probe(struct platform_device *pdev)
233{ 233{
234 struct ata_host *host; 234 struct ata_host *host;
235 struct ata_port *ap; 235 struct ata_port *ap;
@@ -369,7 +369,7 @@ static int __devinit pxa_ata_probe(struct platform_device *pdev)
369 return ret; 369 return ret;
370} 370}
371 371
372static int __devexit pxa_ata_remove(struct platform_device *pdev) 372static int pxa_ata_remove(struct platform_device *pdev)
373{ 373{
374 struct ata_host *host = dev_get_drvdata(&pdev->dev); 374 struct ata_host *host = dev_get_drvdata(&pdev->dev);
375 struct pata_pxa_data *data = host->ports[0]->private_data; 375 struct pata_pxa_data *data = host->ports[0]->private_data;
@@ -383,7 +383,7 @@ static int __devexit pxa_ata_remove(struct platform_device *pdev)
383 383
384static struct platform_driver pxa_ata_driver = { 384static struct platform_driver pxa_ata_driver = {
385 .probe = pxa_ata_probe, 385 .probe = pxa_ata_probe,
386 .remove = __devexit_p(pxa_ata_remove), 386 .remove = pxa_ata_remove,
387 .driver = { 387 .driver = {
388 .name = DRV_NAME, 388 .name = DRV_NAME,
389 .owner = THIS_MODULE, 389 .owner = THIS_MODULE,
diff --git a/drivers/ata/pata_rb532_cf.c b/drivers/ata/pata_rb532_cf.c
index 9417101bd5ca..3c5eb8fa6bd1 100644
--- a/drivers/ata/pata_rb532_cf.c
+++ b/drivers/ata/pata_rb532_cf.c
@@ -102,7 +102,7 @@ static void rb532_pata_setup_ports(struct ata_host *ah)
102 ap->ioaddr.error_addr = info->iobase + RB500_CF_REG_ERR; 102 ap->ioaddr.error_addr = info->iobase + RB500_CF_REG_ERR;
103} 103}
104 104
105static __devinit int rb532_pata_driver_probe(struct platform_device *pdev) 105static int rb532_pata_driver_probe(struct platform_device *pdev)
106{ 106{
107 int irq; 107 int irq;
108 int gpio; 108 int gpio;
@@ -177,7 +177,7 @@ err_free_gpio:
177 return ret; 177 return ret;
178} 178}
179 179
180static __devexit int rb532_pata_driver_remove(struct platform_device *pdev) 180static int rb532_pata_driver_remove(struct platform_device *pdev)
181{ 181{
182 struct ata_host *ah = platform_get_drvdata(pdev); 182 struct ata_host *ah = platform_get_drvdata(pdev);
183 struct rb532_cf_info *info = ah->private_data; 183 struct rb532_cf_info *info = ah->private_data;
@@ -190,7 +190,7 @@ static __devexit int rb532_pata_driver_remove(struct platform_device *pdev)
190 190
191static struct platform_driver rb532_pata_platform_driver = { 191static struct platform_driver rb532_pata_platform_driver = {
192 .probe = rb532_pata_driver_probe, 192 .probe = rb532_pata_driver_probe,
193 .remove = __devexit_p(rb532_pata_driver_remove), 193 .remove = rb532_pata_driver_remove,
194 .driver = { 194 .driver = {
195 .name = DRV_NAME, 195 .name = DRV_NAME,
196 .owner = THIS_MODULE, 196 .owner = THIS_MODULE,
diff --git a/drivers/ata/pata_rdc.c b/drivers/ata/pata_rdc.c
index e71f998dd90d..6a8665574fee 100644
--- a/drivers/ata/pata_rdc.c
+++ b/drivers/ata/pata_rdc.c
@@ -321,8 +321,7 @@ static struct scsi_host_template rdc_sht = {
321 * Zero on success, or -ERRNO value. 321 * Zero on success, or -ERRNO value.
322 */ 322 */
323 323
324static int __devinit rdc_init_one(struct pci_dev *pdev, 324static int rdc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
325 const struct pci_device_id *ent)
326{ 325{
327 struct device *dev = &pdev->dev; 326 struct device *dev = &pdev->dev;
328 struct ata_port_info port_info[2]; 327 struct ata_port_info port_info[2];
diff --git a/drivers/ata/pata_sch.c b/drivers/ata/pata_sch.c
index db0d18cf1c2a..d3830c45a369 100644
--- a/drivers/ata/pata_sch.c
+++ b/drivers/ata/pata_sch.c
@@ -169,8 +169,7 @@ static void sch_set_dmamode(struct ata_port *ap, struct ata_device *adev)
169 * Zero on success, or -ERRNO value. 169 * Zero on success, or -ERRNO value.
170 */ 170 */
171 171
172static int __devinit sch_init_one(struct pci_dev *pdev, 172static int sch_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
173 const struct pci_device_id *ent)
174{ 173{
175 const struct ata_port_info *ppi[] = { &sch_port_info, NULL }; 174 const struct ata_port_info *ppi[] = { &sch_port_info, NULL };
176 175
diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c
index 5cfdf94823d0..64c5f0d0f812 100644
--- a/drivers/ata/pata_sil680.c
+++ b/drivers/ata/pata_sil680.c
@@ -323,8 +323,7 @@ static u8 sil680_init_chip(struct pci_dev *pdev, int *try_mmio)
323 return tmpbyte & 0x30; 323 return tmpbyte & 0x30;
324} 324}
325 325
326static int __devinit sil680_init_one(struct pci_dev *pdev, 326static int sil680_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
327 const struct pci_device_id *id)
328{ 327{
329 static const struct ata_port_info info = { 328 static const struct ata_port_info info = {
330 .flags = ATA_FLAG_SLAVE_POSS, 329 .flags = ATA_FLAG_SLAVE_POSS,
diff --git a/drivers/ata/sata_highbank.c b/drivers/ata/sata_highbank.c
index dc7d78eecb19..5dba77ccaa0b 100644
--- a/drivers/ata/sata_highbank.c
+++ b/drivers/ata/sata_highbank.c
@@ -260,7 +260,7 @@ static const struct of_device_id ahci_of_match[] = {
260}; 260};
261MODULE_DEVICE_TABLE(of, ahci_of_match); 261MODULE_DEVICE_TABLE(of, ahci_of_match);
262 262
263static int __devinit ahci_highbank_probe(struct platform_device *pdev) 263static int ahci_highbank_probe(struct platform_device *pdev)
264{ 264{
265 struct device *dev = &pdev->dev; 265 struct device *dev = &pdev->dev;
266 struct ahci_host_priv *hpriv; 266 struct ahci_host_priv *hpriv;
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 68f4fb54d627..35c6b6d09c27 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -4148,7 +4148,7 @@ err:
4148 * A platform bus SATA device has been unplugged. Perform the needed 4148 * A platform bus SATA device has been unplugged. Perform the needed
4149 * cleanup. Also called on module unload for any active devices. 4149 * cleanup. Also called on module unload for any active devices.
4150 */ 4150 */
4151static int __devexit mv_platform_remove(struct platform_device *pdev) 4151static int mv_platform_remove(struct platform_device *pdev)
4152{ 4152{
4153 struct ata_host *host = platform_get_drvdata(pdev); 4153 struct ata_host *host = platform_get_drvdata(pdev);
4154#if defined(CONFIG_HAVE_CLK) 4154#if defined(CONFIG_HAVE_CLK)
@@ -4215,7 +4215,7 @@ static int mv_platform_resume(struct platform_device *pdev)
4215#endif 4215#endif
4216 4216
4217#ifdef CONFIG_OF 4217#ifdef CONFIG_OF
4218static struct of_device_id mv_sata_dt_ids[] __devinitdata = { 4218static struct of_device_id mv_sata_dt_ids[] = {
4219 { .compatible = "marvell,orion-sata", }, 4219 { .compatible = "marvell,orion-sata", },
4220 {}, 4220 {},
4221}; 4221};
@@ -4224,7 +4224,7 @@ MODULE_DEVICE_TABLE(of, mv_sata_dt_ids);
4224 4224
4225static struct platform_driver mv_platform_driver = { 4225static struct platform_driver mv_platform_driver = {
4226 .probe = mv_platform_probe, 4226 .probe = mv_platform_probe,
4227 .remove = __devexit_p(mv_platform_remove), 4227 .remove = mv_platform_remove,
4228 .suspend = mv_platform_suspend, 4228 .suspend = mv_platform_suspend,
4229 .resume = mv_platform_resume, 4229 .resume = mv_platform_resume,
4230 .driver = { 4230 .driver = {
@@ -4429,7 +4429,7 @@ static int mv_pci_device_resume(struct pci_dev *pdev)
4429#endif 4429#endif
4430 4430
4431static int mv_platform_probe(struct platform_device *pdev); 4431static int mv_platform_probe(struct platform_device *pdev);
4432static int __devexit mv_platform_remove(struct platform_device *pdev); 4432static int mv_platform_remove(struct platform_device *pdev);
4433 4433
4434static int __init mv_init(void) 4434static int __init mv_init(void)
4435{ 4435{
diff --git a/drivers/ata/sata_vsc.c b/drivers/ata/sata_vsc.c
index e8cf88ba145d..44f304b3de63 100644
--- a/drivers/ata/sata_vsc.c
+++ b/drivers/ata/sata_vsc.c
@@ -312,8 +312,7 @@ static struct ata_port_operations vsc_sata_ops = {
312 .scr_write = vsc_sata_scr_write, 312 .scr_write = vsc_sata_scr_write,
313}; 313};
314 314
315static void __devinit vsc_sata_setup_port(struct ata_ioports *port, 315static void vsc_sata_setup_port(struct ata_ioports *port, void __iomem *base)
316 void __iomem *base)
317{ 316{
318 port->cmd_addr = base + VSC_SATA_TF_CMD_OFFSET; 317 port->cmd_addr = base + VSC_SATA_TF_CMD_OFFSET;
319 port->data_addr = base + VSC_SATA_TF_DATA_OFFSET; 318 port->data_addr = base + VSC_SATA_TF_DATA_OFFSET;
@@ -335,8 +334,8 @@ static void __devinit vsc_sata_setup_port(struct ata_ioports *port,
335} 334}
336 335
337 336
338static int __devinit vsc_sata_init_one(struct pci_dev *pdev, 337static int vsc_sata_init_one(struct pci_dev *pdev,
339 const struct pci_device_id *ent) 338 const struct pci_device_id *ent)
340{ 339{
341 static const struct ata_port_info pi = { 340 static const struct ata_port_info pi = {
342 .flags = ATA_FLAG_SATA, 341 .flags = ATA_FLAG_SATA,
diff --git a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c
index ff7bb8a42ed6..77a7480dc4d1 100644
--- a/drivers/atm/ambassador.c
+++ b/drivers/atm/ambassador.c
@@ -1507,9 +1507,9 @@ static void do_housekeeping (unsigned long arg) {
1507 1507
1508/********** creation of communication queues **********/ 1508/********** creation of communication queues **********/
1509 1509
1510static int __devinit create_queues (amb_dev * dev, unsigned int cmds, 1510static int create_queues(amb_dev *dev, unsigned int cmds, unsigned int txs,
1511 unsigned int txs, unsigned int * rxs, 1511 unsigned int *rxs, unsigned int *rx_buffer_sizes)
1512 unsigned int * rx_buffer_sizes) { 1512{
1513 unsigned char pool; 1513 unsigned char pool;
1514 size_t total = 0; 1514 size_t total = 0;
1515 void * memory; 1515 void * memory;
@@ -1737,8 +1737,9 @@ static int decode_loader_result (loader_command cmd, u32 result)
1737 return res; 1737 return res;
1738} 1738}
1739 1739
1740static int __devinit do_loader_command (volatile loader_block * lb, 1740static int do_loader_command(volatile loader_block *lb, const amb_dev *dev,
1741 const amb_dev * dev, loader_command cmd) { 1741 loader_command cmd)
1742{
1742 1743
1743 unsigned long timeout; 1744 unsigned long timeout;
1744 1745
@@ -1793,8 +1794,9 @@ static int __devinit do_loader_command (volatile loader_block * lb,
1793 1794
1794/* loader: determine loader version */ 1795/* loader: determine loader version */
1795 1796
1796static int __devinit get_loader_version (loader_block * lb, 1797static int get_loader_version(loader_block *lb, const amb_dev *dev,
1797 const amb_dev * dev, u32 * version) { 1798 u32 *version)
1799{
1798 int res; 1800 int res;
1799 1801
1800 PRINTD (DBG_FLOW|DBG_LOAD, "get_loader_version"); 1802 PRINTD (DBG_FLOW|DBG_LOAD, "get_loader_version");
@@ -1809,9 +1811,9 @@ static int __devinit get_loader_version (loader_block * lb,
1809 1811
1810/* loader: write memory data blocks */ 1812/* loader: write memory data blocks */
1811 1813
1812static int __devinit loader_write (loader_block* lb, 1814static int loader_write(loader_block *lb, const amb_dev *dev,
1813 const amb_dev *dev, 1815 const struct ihex_binrec *rec)
1814 const struct ihex_binrec *rec) { 1816{
1815 transfer_block * tb = &lb->payload.transfer; 1817 transfer_block * tb = &lb->payload.transfer;
1816 1818
1817 PRINTD (DBG_FLOW|DBG_LOAD, "loader_write"); 1819 PRINTD (DBG_FLOW|DBG_LOAD, "loader_write");
@@ -1824,9 +1826,9 @@ static int __devinit loader_write (loader_block* lb,
1824 1826
1825/* loader: verify memory data blocks */ 1827/* loader: verify memory data blocks */
1826 1828
1827static int __devinit loader_verify (loader_block * lb, 1829static int loader_verify(loader_block *lb, const amb_dev *dev,
1828 const amb_dev *dev, 1830 const struct ihex_binrec *rec)
1829 const struct ihex_binrec *rec) { 1831{
1830 transfer_block * tb = &lb->payload.transfer; 1832 transfer_block * tb = &lb->payload.transfer;
1831 int res; 1833 int res;
1832 1834
@@ -1842,8 +1844,8 @@ static int __devinit loader_verify (loader_block * lb,
1842 1844
1843/* loader: start microcode */ 1845/* loader: start microcode */
1844 1846
1845static int __devinit loader_start (loader_block * lb, 1847static int loader_start(loader_block *lb, const amb_dev *dev, u32 address)
1846 const amb_dev * dev, u32 address) { 1848{
1847 PRINTD (DBG_FLOW|DBG_LOAD, "loader_start"); 1849 PRINTD (DBG_FLOW|DBG_LOAD, "loader_start");
1848 1850
1849 lb->payload.start = cpu_to_be32 (address); 1851 lb->payload.start = cpu_to_be32 (address);
@@ -1918,7 +1920,8 @@ static int amb_reset (amb_dev * dev, int diags) {
1918 1920
1919/********** transfer and start the microcode **********/ 1921/********** transfer and start the microcode **********/
1920 1922
1921static int __devinit ucode_init (loader_block * lb, amb_dev * dev) { 1923static int ucode_init(loader_block *lb, amb_dev *dev)
1924{
1922 const struct firmware *fw; 1925 const struct firmware *fw;
1923 unsigned long start_address; 1926 unsigned long start_address;
1924 const struct ihex_binrec *rec; 1927 const struct ihex_binrec *rec;
@@ -1980,7 +1983,8 @@ static inline __be32 bus_addr(void * addr) {
1980 return cpu_to_be32 (virt_to_bus (addr)); 1983 return cpu_to_be32 (virt_to_bus (addr));
1981} 1984}
1982 1985
1983static int __devinit amb_talk (amb_dev * dev) { 1986static int amb_talk(amb_dev *dev)
1987{
1984 adap_talk_block a; 1988 adap_talk_block a;
1985 unsigned char pool; 1989 unsigned char pool;
1986 unsigned long timeout; 1990 unsigned long timeout;
@@ -2027,7 +2031,8 @@ static int __devinit amb_talk (amb_dev * dev) {
2027} 2031}
2028 2032
2029// get microcode version 2033// get microcode version
2030static void __devinit amb_ucode_version (amb_dev * dev) { 2034static void amb_ucode_version(amb_dev *dev)
2035{
2031 u32 major; 2036 u32 major;
2032 u32 minor; 2037 u32 minor;
2033 command cmd; 2038 command cmd;
@@ -2042,7 +2047,8 @@ static void __devinit amb_ucode_version (amb_dev * dev) {
2042} 2047}
2043 2048
2044// get end station address 2049// get end station address
2045static void __devinit amb_esi (amb_dev * dev, u8 * esi) { 2050static void amb_esi(amb_dev *dev, u8 *esi)
2051{
2046 u32 lower4; 2052 u32 lower4;
2047 u16 upper2; 2053 u16 upper2;
2048 command cmd; 2054 command cmd;
@@ -2088,7 +2094,7 @@ static void fixup_plx_window (amb_dev *dev, loader_block *lb)
2088 return; 2094 return;
2089} 2095}
2090 2096
2091static int __devinit amb_init (amb_dev * dev) 2097static int amb_init(amb_dev *dev)
2092{ 2098{
2093 loader_block lb; 2099 loader_block lb;
2094 2100
@@ -2184,7 +2190,8 @@ static void setup_pci_dev(struct pci_dev *pci_dev)
2184 } 2190 }
2185} 2191}
2186 2192
2187static int __devinit amb_probe(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent) 2193static int amb_probe(struct pci_dev *pci_dev,
2194 const struct pci_device_id *pci_ent)
2188{ 2195{
2189 amb_dev * dev; 2196 amb_dev * dev;
2190 int err; 2197 int err;
@@ -2285,7 +2292,7 @@ out_disable:
2285} 2292}
2286 2293
2287 2294
2288static void __devexit amb_remove_one(struct pci_dev *pci_dev) 2295static void amb_remove_one(struct pci_dev *pci_dev)
2289{ 2296{
2290 struct amb_dev *dev; 2297 struct amb_dev *dev;
2291 2298
@@ -2379,7 +2386,7 @@ MODULE_DEVICE_TABLE(pci, amb_pci_tbl);
2379static struct pci_driver amb_driver = { 2386static struct pci_driver amb_driver = {
2380 .name = "amb", 2387 .name = "amb",
2381 .probe = amb_probe, 2388 .probe = amb_probe,
2382 .remove = __devexit_p(amb_remove_one), 2389 .remove = amb_remove_one,
2383 .id_table = amb_pci_tbl, 2390 .id_table = amb_pci_tbl,
2384}; 2391};
2385 2392
diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c
index 81e44f7b0ab6..c1eb6fa8ac35 100644
--- a/drivers/atm/eni.c
+++ b/drivers/atm/eni.c
@@ -1567,7 +1567,7 @@ tx_complete++;
1567/*--------------------------------- entries ---------------------------------*/ 1567/*--------------------------------- entries ---------------------------------*/
1568 1568
1569 1569
1570static char * const media_name[] __devinitconst = { 1570static char * const media_name[] = {
1571 "MMF", "SMF", "MMF", "03?", /* 0- 3 */ 1571 "MMF", "SMF", "MMF", "03?", /* 0- 3 */
1572 "UTP", "05?", "06?", "07?", /* 4- 7 */ 1572 "UTP", "05?", "06?", "07?", /* 4- 7 */
1573 "TAXI","09?", "10?", "11?", /* 8-11 */ 1573 "TAXI","09?", "10?", "11?", /* 8-11 */
@@ -1591,7 +1591,7 @@ static char * const media_name[] __devinitconst = {
1591 } }) 1591 } })
1592 1592
1593 1593
1594static int __devinit get_esi_asic(struct atm_dev *dev) 1594static int get_esi_asic(struct atm_dev *dev)
1595{ 1595{
1596 struct eni_dev *eni_dev; 1596 struct eni_dev *eni_dev;
1597 unsigned char tonga; 1597 unsigned char tonga;
@@ -1683,7 +1683,7 @@ static int __devinit get_esi_asic(struct atm_dev *dev)
1683#undef GET_SEPROM 1683#undef GET_SEPROM
1684 1684
1685 1685
1686static int __devinit get_esi_fpga(struct atm_dev *dev, void __iomem *base) 1686static int get_esi_fpga(struct atm_dev *dev, void __iomem *base)
1687{ 1687{
1688 void __iomem *mac_base; 1688 void __iomem *mac_base;
1689 int i; 1689 int i;
@@ -1694,7 +1694,7 @@ static int __devinit get_esi_fpga(struct atm_dev *dev, void __iomem *base)
1694} 1694}
1695 1695
1696 1696
1697static int __devinit eni_do_init(struct atm_dev *dev) 1697static int eni_do_init(struct atm_dev *dev)
1698{ 1698{
1699 struct midway_eprom __iomem *eprom; 1699 struct midway_eprom __iomem *eprom;
1700 struct eni_dev *eni_dev; 1700 struct eni_dev *eni_dev;
@@ -1797,7 +1797,7 @@ static void eni_do_release(struct atm_dev *dev)
1797 iounmap(ed->ioaddr); 1797 iounmap(ed->ioaddr);
1798} 1798}
1799 1799
1800static int __devinit eni_start(struct atm_dev *dev) 1800static int eni_start(struct atm_dev *dev)
1801{ 1801{
1802 struct eni_dev *eni_dev; 1802 struct eni_dev *eni_dev;
1803 1803
@@ -2226,8 +2226,8 @@ static const struct atmdev_ops ops = {
2226}; 2226};
2227 2227
2228 2228
2229static int __devinit eni_init_one(struct pci_dev *pci_dev, 2229static int eni_init_one(struct pci_dev *pci_dev,
2230 const struct pci_device_id *ent) 2230 const struct pci_device_id *ent)
2231{ 2231{
2232 struct atm_dev *dev; 2232 struct atm_dev *dev;
2233 struct eni_dev *eni_dev; 2233 struct eni_dev *eni_dev;
@@ -2292,7 +2292,7 @@ static struct pci_device_id eni_pci_tbl[] = {
2292MODULE_DEVICE_TABLE(pci,eni_pci_tbl); 2292MODULE_DEVICE_TABLE(pci,eni_pci_tbl);
2293 2293
2294 2294
2295static void __devexit eni_remove_one(struct pci_dev *pdev) 2295static void eni_remove_one(struct pci_dev *pdev)
2296{ 2296{
2297 struct atm_dev *dev = pci_get_drvdata(pdev); 2297 struct atm_dev *dev = pci_get_drvdata(pdev);
2298 struct eni_dev *ed = ENI_DEV(dev); 2298 struct eni_dev *ed = ENI_DEV(dev);
@@ -2310,7 +2310,7 @@ static struct pci_driver eni_driver = {
2310 .name = DEV_LABEL, 2310 .name = DEV_LABEL,
2311 .id_table = eni_pci_tbl, 2311 .id_table = eni_pci_tbl,
2312 .probe = eni_init_one, 2312 .probe = eni_init_one,
2313 .remove = __devexit_p(eni_remove_one), 2313 .remove = eni_remove_one,
2314}; 2314};
2315 2315
2316 2316
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
index 86fed1b91695..b41c9481b67b 100644
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -252,7 +252,7 @@ struct reginit_item {
252}; 252};
253 253
254 254
255static struct reginit_item PHY_NTC_INIT[] __devinitdata = { 255static struct reginit_item PHY_NTC_INIT[] = {
256 { PHY_CLEARALL, 0x40 }, 256 { PHY_CLEARALL, 0x40 },
257 { 0x12, 0x0001 }, 257 { 0x12, 0x0001 },
258 { 0x13, 0x7605 }, 258 { 0x13, 0x7605 },
@@ -1295,7 +1295,7 @@ static const struct atmdev_ops ops = {
1295}; 1295};
1296 1296
1297 1297
1298static void __devinit undocumented_pci_fix (struct pci_dev *pdev) 1298static void undocumented_pci_fix(struct pci_dev *pdev)
1299{ 1299{
1300 u32 tint; 1300 u32 tint;
1301 1301
@@ -1319,13 +1319,13 @@ static void __devinit undocumented_pci_fix (struct pci_dev *pdev)
1319 * PHY routines * 1319 * PHY routines *
1320 **************************************************************************/ 1320 **************************************************************************/
1321 1321
1322static void __devinit write_phy (struct fs_dev *dev, int regnum, int val) 1322static void write_phy(struct fs_dev *dev, int regnum, int val)
1323{ 1323{
1324 submit_command (dev, &dev->hp_txq, QE_CMD_PRP_WR | QE_CMD_IMM_INQ, 1324 submit_command (dev, &dev->hp_txq, QE_CMD_PRP_WR | QE_CMD_IMM_INQ,
1325 regnum, val, 0); 1325 regnum, val, 0);
1326} 1326}
1327 1327
1328static int __devinit init_phy (struct fs_dev *dev, struct reginit_item *reginit) 1328static int init_phy(struct fs_dev *dev, struct reginit_item *reginit)
1329{ 1329{
1330 int i; 1330 int i;
1331 1331
@@ -1381,7 +1381,7 @@ static void reset_chip (struct fs_dev *dev)
1381 } 1381 }
1382} 1382}
1383 1383
1384static void __devinit *aligned_kmalloc (int size, gfp_t flags, int alignment) 1384static void *aligned_kmalloc(int size, gfp_t flags, int alignment)
1385{ 1385{
1386 void *t; 1386 void *t;
1387 1387
@@ -1398,8 +1398,8 @@ static void __devinit *aligned_kmalloc (int size, gfp_t flags, int alignment)
1398 return NULL; 1398 return NULL;
1399} 1399}
1400 1400
1401static int __devinit init_q (struct fs_dev *dev, 1401static int init_q(struct fs_dev *dev, struct queue *txq, int queue,
1402 struct queue *txq, int queue, int nentries, int is_rq) 1402 int nentries, int is_rq)
1403{ 1403{
1404 int sz = nentries * sizeof (struct FS_QENTRY); 1404 int sz = nentries * sizeof (struct FS_QENTRY);
1405 struct FS_QENTRY *p; 1405 struct FS_QENTRY *p;
@@ -1434,8 +1434,8 @@ static int __devinit init_q (struct fs_dev *dev,
1434} 1434}
1435 1435
1436 1436
1437static int __devinit init_fp (struct fs_dev *dev, 1437static int init_fp(struct fs_dev *dev, struct freepool *fp, int queue,
1438 struct freepool *fp, int queue, int bufsize, int nr_buffers) 1438 int bufsize, int nr_buffers)
1439{ 1439{
1440 func_enter (); 1440 func_enter ();
1441 1441
@@ -1528,7 +1528,7 @@ static void top_off_fp (struct fs_dev *dev, struct freepool *fp,
1528 fs_dprintk (FS_DEBUG_QUEUE, "Added %d entries. \n", n); 1528 fs_dprintk (FS_DEBUG_QUEUE, "Added %d entries. \n", n);
1529} 1529}
1530 1530
1531static void __devexit free_queue (struct fs_dev *dev, struct queue *txq) 1531static void free_queue(struct fs_dev *dev, struct queue *txq)
1532{ 1532{
1533 func_enter (); 1533 func_enter ();
1534 1534
@@ -1544,7 +1544,7 @@ static void __devexit free_queue (struct fs_dev *dev, struct queue *txq)
1544 func_exit (); 1544 func_exit ();
1545} 1545}
1546 1546
1547static void __devexit free_freepool (struct fs_dev *dev, struct freepool *fp) 1547static void free_freepool(struct fs_dev *dev, struct freepool *fp)
1548{ 1548{
1549 func_enter (); 1549 func_enter ();
1550 1550
@@ -1662,7 +1662,7 @@ static void fs_poll (unsigned long data)
1662} 1662}
1663#endif 1663#endif
1664 1664
1665static int __devinit fs_init (struct fs_dev *dev) 1665static int fs_init(struct fs_dev *dev)
1666{ 1666{
1667 struct pci_dev *pci_dev; 1667 struct pci_dev *pci_dev;
1668 int isr, to; 1668 int isr, to;
@@ -1897,8 +1897,8 @@ unmap:
1897 return 1; 1897 return 1;
1898} 1898}
1899 1899
1900static int __devinit firestream_init_one (struct pci_dev *pci_dev, 1900static int firestream_init_one(struct pci_dev *pci_dev,
1901 const struct pci_device_id *ent) 1901 const struct pci_device_id *ent)
1902{ 1902{
1903 struct atm_dev *atm_dev; 1903 struct atm_dev *atm_dev;
1904 struct fs_dev *fs_dev; 1904 struct fs_dev *fs_dev;
@@ -1934,7 +1934,7 @@ static int __devinit firestream_init_one (struct pci_dev *pci_dev,
1934 return -ENODEV; 1934 return -ENODEV;
1935} 1935}
1936 1936
1937static void __devexit firestream_remove_one (struct pci_dev *pdev) 1937static void firestream_remove_one(struct pci_dev *pdev)
1938{ 1938{
1939 int i; 1939 int i;
1940 struct fs_dev *dev, *nxtdev; 1940 struct fs_dev *dev, *nxtdev;
@@ -2038,7 +2038,7 @@ static struct pci_driver firestream_driver = {
2038 .name = "firestream", 2038 .name = "firestream",
2039 .id_table = firestream_pci_tbl, 2039 .id_table = firestream_pci_tbl,
2040 .probe = firestream_init_one, 2040 .probe = firestream_init_one,
2041 .remove = __devexit_p(firestream_remove_one), 2041 .remove = firestream_remove_one,
2042}; 2042};
2043 2043
2044static int __init firestream_init_module (void) 2044static int __init firestream_init_module (void)
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
index 361f5aee3be1..204814e88e46 100644
--- a/drivers/atm/fore200e.c
+++ b/drivers/atm/fore200e.c
@@ -527,8 +527,7 @@ fore200e_pca_reset(struct fore200e* fore200e)
527} 527}
528 528
529 529
530static int __devinit 530static int fore200e_pca_map(struct fore200e* fore200e)
531fore200e_pca_map(struct fore200e* fore200e)
532{ 531{
533 DPRINTK(2, "device %s being mapped in memory\n", fore200e->name); 532 DPRINTK(2, "device %s being mapped in memory\n", fore200e->name);
534 533
@@ -561,8 +560,7 @@ fore200e_pca_unmap(struct fore200e* fore200e)
561} 560}
562 561
563 562
564static int __devinit 563static int fore200e_pca_configure(struct fore200e *fore200e)
565fore200e_pca_configure(struct fore200e* fore200e)
566{ 564{
567 struct pci_dev* pci_dev = (struct pci_dev*)fore200e->bus_dev; 565 struct pci_dev* pci_dev = (struct pci_dev*)fore200e->bus_dev;
568 u8 master_ctrl, latency; 566 u8 master_ctrl, latency;
@@ -2028,8 +2026,7 @@ fore200e_change_qos(struct atm_vcc* vcc,struct atm_qos* qos, int flags)
2028} 2026}
2029 2027
2030 2028
2031static int __devinit 2029static int fore200e_irq_request(struct fore200e *fore200e)
2032fore200e_irq_request(struct fore200e* fore200e)
2033{ 2030{
2034 if (request_irq(fore200e->irq, fore200e_interrupt, IRQF_SHARED, fore200e->name, fore200e->atm_dev) < 0) { 2031 if (request_irq(fore200e->irq, fore200e_interrupt, IRQF_SHARED, fore200e->name, fore200e->atm_dev) < 0) {
2035 2032
@@ -2051,8 +2048,7 @@ fore200e_irq_request(struct fore200e* fore200e)
2051} 2048}
2052 2049
2053 2050
2054static int __devinit 2051static int fore200e_get_esi(struct fore200e *fore200e)
2055fore200e_get_esi(struct fore200e* fore200e)
2056{ 2052{
2057 struct prom_data* prom = kzalloc(sizeof(struct prom_data), GFP_KERNEL | GFP_DMA); 2053 struct prom_data* prom = kzalloc(sizeof(struct prom_data), GFP_KERNEL | GFP_DMA);
2058 int ok, i; 2054 int ok, i;
@@ -2081,8 +2077,7 @@ fore200e_get_esi(struct fore200e* fore200e)
2081} 2077}
2082 2078
2083 2079
2084static int __devinit 2080static int fore200e_alloc_rx_buf(struct fore200e *fore200e)
2085fore200e_alloc_rx_buf(struct fore200e* fore200e)
2086{ 2081{
2087 int scheme, magn, nbr, size, i; 2082 int scheme, magn, nbr, size, i;
2088 2083
@@ -2146,8 +2141,7 @@ fore200e_alloc_rx_buf(struct fore200e* fore200e)
2146} 2141}
2147 2142
2148 2143
2149static int __devinit 2144static int fore200e_init_bs_queue(struct fore200e *fore200e)
2150fore200e_init_bs_queue(struct fore200e* fore200e)
2151{ 2145{
2152 int scheme, magn, i; 2146 int scheme, magn, i;
2153 2147
@@ -2209,8 +2203,7 @@ fore200e_init_bs_queue(struct fore200e* fore200e)
2209} 2203}
2210 2204
2211 2205
2212static int __devinit 2206static int fore200e_init_rx_queue(struct fore200e *fore200e)
2213fore200e_init_rx_queue(struct fore200e* fore200e)
2214{ 2207{
2215 struct host_rxq* rxq = &fore200e->host_rxq; 2208 struct host_rxq* rxq = &fore200e->host_rxq;
2216 struct cp_rxq_entry __iomem * cp_entry; 2209 struct cp_rxq_entry __iomem * cp_entry;
@@ -2269,8 +2262,7 @@ fore200e_init_rx_queue(struct fore200e* fore200e)
2269} 2262}
2270 2263
2271 2264
2272static int __devinit 2265static int fore200e_init_tx_queue(struct fore200e *fore200e)
2273fore200e_init_tx_queue(struct fore200e* fore200e)
2274{ 2266{
2275 struct host_txq* txq = &fore200e->host_txq; 2267 struct host_txq* txq = &fore200e->host_txq;
2276 struct cp_txq_entry __iomem * cp_entry; 2268 struct cp_txq_entry __iomem * cp_entry;
@@ -2332,8 +2324,7 @@ fore200e_init_tx_queue(struct fore200e* fore200e)
2332} 2324}
2333 2325
2334 2326
2335static int __devinit 2327static int fore200e_init_cmd_queue(struct fore200e *fore200e)
2336fore200e_init_cmd_queue(struct fore200e* fore200e)
2337{ 2328{
2338 struct host_cmdq* cmdq = &fore200e->host_cmdq; 2329 struct host_cmdq* cmdq = &fore200e->host_cmdq;
2339 struct cp_cmdq_entry __iomem * cp_entry; 2330 struct cp_cmdq_entry __iomem * cp_entry;
@@ -2374,10 +2365,10 @@ fore200e_init_cmd_queue(struct fore200e* fore200e)
2374} 2365}
2375 2366
2376 2367
2377static void __devinit 2368static void fore200e_param_bs_queue(struct fore200e *fore200e,
2378fore200e_param_bs_queue(struct fore200e* fore200e, 2369 enum buffer_scheme scheme,
2379 enum buffer_scheme scheme, enum buffer_magn magn, 2370 enum buffer_magn magn, int queue_length,
2380 int queue_length, int pool_size, int supply_blksize) 2371 int pool_size, int supply_blksize)
2381{ 2372{
2382 struct bs_spec __iomem * bs_spec = &fore200e->cp_queues->init.bs_spec[ scheme ][ magn ]; 2373 struct bs_spec __iomem * bs_spec = &fore200e->cp_queues->init.bs_spec[ scheme ][ magn ];
2383 2374
@@ -2388,8 +2379,7 @@ fore200e_param_bs_queue(struct fore200e* fore200e,
2388} 2379}
2389 2380
2390 2381
2391static int __devinit 2382static int fore200e_initialize(struct fore200e *fore200e)
2392fore200e_initialize(struct fore200e* fore200e)
2393{ 2383{
2394 struct cp_queues __iomem * cpq; 2384 struct cp_queues __iomem * cpq;
2395 int ok, scheme, magn; 2385 int ok, scheme, magn;
@@ -2440,8 +2430,7 @@ fore200e_initialize(struct fore200e* fore200e)
2440} 2430}
2441 2431
2442 2432
2443static void __devinit 2433static void fore200e_monitor_putc(struct fore200e *fore200e, char c)
2444fore200e_monitor_putc(struct fore200e* fore200e, char c)
2445{ 2434{
2446 struct cp_monitor __iomem * monitor = fore200e->cp_monitor; 2435 struct cp_monitor __iomem * monitor = fore200e->cp_monitor;
2447 2436
@@ -2452,8 +2441,7 @@ fore200e_monitor_putc(struct fore200e* fore200e, char c)
2452} 2441}
2453 2442
2454 2443
2455static int __devinit 2444static int fore200e_monitor_getc(struct fore200e *fore200e)
2456fore200e_monitor_getc(struct fore200e* fore200e)
2457{ 2445{
2458 struct cp_monitor __iomem * monitor = fore200e->cp_monitor; 2446 struct cp_monitor __iomem * monitor = fore200e->cp_monitor;
2459 unsigned long timeout = jiffies + msecs_to_jiffies(50); 2447 unsigned long timeout = jiffies + msecs_to_jiffies(50);
@@ -2477,8 +2465,7 @@ fore200e_monitor_getc(struct fore200e* fore200e)
2477} 2465}
2478 2466
2479 2467
2480static void __devinit 2468static void fore200e_monitor_puts(struct fore200e *fore200e, char *str)
2481fore200e_monitor_puts(struct fore200e* fore200e, char* str)
2482{ 2469{
2483 while (*str) { 2470 while (*str) {
2484 2471
@@ -2497,8 +2484,7 @@ fore200e_monitor_puts(struct fore200e* fore200e, char* str)
2497#define FW_EXT "_ecd.bin2" 2484#define FW_EXT "_ecd.bin2"
2498#endif 2485#endif
2499 2486
2500static int __devinit 2487static int fore200e_load_and_start_fw(struct fore200e *fore200e)
2501fore200e_load_and_start_fw(struct fore200e* fore200e)
2502{ 2488{
2503 const struct firmware *firmware; 2489 const struct firmware *firmware;
2504 struct device *device; 2490 struct device *device;
@@ -2566,8 +2552,7 @@ release:
2566} 2552}
2567 2553
2568 2554
2569static int __devinit 2555static int fore200e_register(struct fore200e *fore200e, struct device *parent)
2570fore200e_register(struct fore200e* fore200e, struct device *parent)
2571{ 2556{
2572 struct atm_dev* atm_dev; 2557 struct atm_dev* atm_dev;
2573 2558
@@ -2593,8 +2578,7 @@ fore200e_register(struct fore200e* fore200e, struct device *parent)
2593} 2578}
2594 2579
2595 2580
2596static int __devinit 2581static int fore200e_init(struct fore200e *fore200e, struct device *parent)
2597fore200e_init(struct fore200e* fore200e, struct device *parent)
2598{ 2582{
2599 if (fore200e_register(fore200e, parent) < 0) 2583 if (fore200e_register(fore200e, parent) < 0)
2600 return -ENODEV; 2584 return -ENODEV;
@@ -2644,7 +2628,7 @@ fore200e_init(struct fore200e* fore200e, struct device *parent)
2644 2628
2645#ifdef CONFIG_SBUS 2629#ifdef CONFIG_SBUS
2646static const struct of_device_id fore200e_sba_match[]; 2630static const struct of_device_id fore200e_sba_match[];
2647static int __devinit fore200e_sba_probe(struct platform_device *op) 2631static int fore200e_sba_probe(struct platform_device *op)
2648{ 2632{
2649 const struct of_device_id *match; 2633 const struct of_device_id *match;
2650 const struct fore200e_bus *bus; 2634 const struct fore200e_bus *bus;
@@ -2681,7 +2665,7 @@ static int __devinit fore200e_sba_probe(struct platform_device *op)
2681 return 0; 2665 return 0;
2682} 2666}
2683 2667
2684static int __devexit fore200e_sba_remove(struct platform_device *op) 2668static int fore200e_sba_remove(struct platform_device *op)
2685{ 2669{
2686 struct fore200e *fore200e = dev_get_drvdata(&op->dev); 2670 struct fore200e *fore200e = dev_get_drvdata(&op->dev);
2687 2671
@@ -2707,13 +2691,13 @@ static struct platform_driver fore200e_sba_driver = {
2707 .of_match_table = fore200e_sba_match, 2691 .of_match_table = fore200e_sba_match,
2708 }, 2692 },
2709 .probe = fore200e_sba_probe, 2693 .probe = fore200e_sba_probe,
2710 .remove = __devexit_p(fore200e_sba_remove), 2694 .remove = fore200e_sba_remove,
2711}; 2695};
2712#endif 2696#endif
2713 2697
2714#ifdef CONFIG_PCI 2698#ifdef CONFIG_PCI
2715static int __devinit 2699static int fore200e_pca_detect(struct pci_dev *pci_dev,
2716fore200e_pca_detect(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent) 2700 const struct pci_device_id *pci_ent)
2717{ 2701{
2718 const struct fore200e_bus* bus = (struct fore200e_bus*) pci_ent->driver_data; 2702 const struct fore200e_bus* bus = (struct fore200e_bus*) pci_ent->driver_data;
2719 struct fore200e* fore200e; 2703 struct fore200e* fore200e;
@@ -2766,7 +2750,7 @@ out_disable:
2766} 2750}
2767 2751
2768 2752
2769static void __devexit fore200e_pca_remove_one(struct pci_dev *pci_dev) 2753static void fore200e_pca_remove_one(struct pci_dev *pci_dev)
2770{ 2754{
2771 struct fore200e *fore200e; 2755 struct fore200e *fore200e;
2772 2756
@@ -2789,7 +2773,7 @@ MODULE_DEVICE_TABLE(pci, fore200e_pca_tbl);
2789static struct pci_driver fore200e_pca_driver = { 2773static struct pci_driver fore200e_pca_driver = {
2790 .name = "fore_200e", 2774 .name = "fore_200e",
2791 .probe = fore200e_pca_detect, 2775 .probe = fore200e_pca_detect,
2792 .remove = __devexit_p(fore200e_pca_remove_one), 2776 .remove = fore200e_pca_remove_one,
2793 .id_table = fore200e_pca_tbl, 2777 .id_table = fore200e_pca_tbl,
2794}; 2778};
2795#endif 2779#endif
diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index b182c2f7d777..72b6960fa95f 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -349,8 +349,8 @@ __find_vcc(struct he_dev *he_dev, unsigned cid)
349 return NULL; 349 return NULL;
350} 350}
351 351
352static int __devinit 352static int he_init_one(struct pci_dev *pci_dev,
353he_init_one(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent) 353 const struct pci_device_id *pci_ent)
354{ 354{
355 struct atm_dev *atm_dev = NULL; 355 struct atm_dev *atm_dev = NULL;
356 struct he_dev *he_dev = NULL; 356 struct he_dev *he_dev = NULL;
@@ -406,8 +406,7 @@ init_one_failure:
406 return err; 406 return err;
407} 407}
408 408
409static void __devexit 409static void he_remove_one(struct pci_dev *pci_dev)
410he_remove_one (struct pci_dev *pci_dev)
411{ 410{
412 struct atm_dev *atm_dev; 411 struct atm_dev *atm_dev;
413 struct he_dev *he_dev; 412 struct he_dev *he_dev;
@@ -445,8 +444,7 @@ rate_to_atmf(unsigned rate) /* cps to atm forum format */
445 return (NONZERO | (exp << 9) | (rate & 0x1ff)); 444 return (NONZERO | (exp << 9) | (rate & 0x1ff));
446} 445}
447 446
448static void __devinit 447static void he_init_rx_lbfp0(struct he_dev *he_dev)
449he_init_rx_lbfp0(struct he_dev *he_dev)
450{ 448{
451 unsigned i, lbm_offset, lbufd_index, lbuf_addr, lbuf_count; 449 unsigned i, lbm_offset, lbufd_index, lbuf_addr, lbuf_count;
452 unsigned lbufs_per_row = he_dev->cells_per_row / he_dev->cells_per_lbuf; 450 unsigned lbufs_per_row = he_dev->cells_per_row / he_dev->cells_per_lbuf;
@@ -476,8 +474,7 @@ he_init_rx_lbfp0(struct he_dev *he_dev)
476 he_writel(he_dev, he_dev->r0_numbuffs, RLBF0_C); 474 he_writel(he_dev, he_dev->r0_numbuffs, RLBF0_C);
477} 475}
478 476
479static void __devinit 477static void he_init_rx_lbfp1(struct he_dev *he_dev)
480he_init_rx_lbfp1(struct he_dev *he_dev)
481{ 478{
482 unsigned i, lbm_offset, lbufd_index, lbuf_addr, lbuf_count; 479 unsigned i, lbm_offset, lbufd_index, lbuf_addr, lbuf_count;
483 unsigned lbufs_per_row = he_dev->cells_per_row / he_dev->cells_per_lbuf; 480 unsigned lbufs_per_row = he_dev->cells_per_row / he_dev->cells_per_lbuf;
@@ -507,8 +504,7 @@ he_init_rx_lbfp1(struct he_dev *he_dev)
507 he_writel(he_dev, he_dev->r1_numbuffs, RLBF1_C); 504 he_writel(he_dev, he_dev->r1_numbuffs, RLBF1_C);
508} 505}
509 506
510static void __devinit 507static void he_init_tx_lbfp(struct he_dev *he_dev)
511he_init_tx_lbfp(struct he_dev *he_dev)
512{ 508{
513 unsigned i, lbm_offset, lbufd_index, lbuf_addr, lbuf_count; 509 unsigned i, lbm_offset, lbufd_index, lbuf_addr, lbuf_count;
514 unsigned lbufs_per_row = he_dev->cells_per_row / he_dev->cells_per_lbuf; 510 unsigned lbufs_per_row = he_dev->cells_per_row / he_dev->cells_per_lbuf;
@@ -537,8 +533,7 @@ he_init_tx_lbfp(struct he_dev *he_dev)
537 he_writel(he_dev, lbufd_index - 1, TLBF_T); 533 he_writel(he_dev, lbufd_index - 1, TLBF_T);
538} 534}
539 535
540static int __devinit 536static int he_init_tpdrq(struct he_dev *he_dev)
541he_init_tpdrq(struct he_dev *he_dev)
542{ 537{
543 he_dev->tpdrq_base = pci_alloc_consistent(he_dev->pci_dev, 538 he_dev->tpdrq_base = pci_alloc_consistent(he_dev->pci_dev,
544 CONFIG_TPDRQ_SIZE * sizeof(struct he_tpdrq), &he_dev->tpdrq_phys); 539 CONFIG_TPDRQ_SIZE * sizeof(struct he_tpdrq), &he_dev->tpdrq_phys);
@@ -559,8 +554,7 @@ he_init_tpdrq(struct he_dev *he_dev)
559 return 0; 554 return 0;
560} 555}
561 556
562static void __devinit 557static void he_init_cs_block(struct he_dev *he_dev)
563he_init_cs_block(struct he_dev *he_dev)
564{ 558{
565 unsigned clock, rate, delta; 559 unsigned clock, rate, delta;
566 int reg; 560 int reg;
@@ -655,8 +649,7 @@ he_init_cs_block(struct he_dev *he_dev)
655 649
656} 650}
657 651
658static int __devinit 652static int he_init_cs_block_rcm(struct he_dev *he_dev)
659he_init_cs_block_rcm(struct he_dev *he_dev)
660{ 653{
661 unsigned (*rategrid)[16][16]; 654 unsigned (*rategrid)[16][16];
662 unsigned rate, delta; 655 unsigned rate, delta;
@@ -776,8 +769,7 @@ he_init_cs_block_rcm(struct he_dev *he_dev)
776 return 0; 769 return 0;
777} 770}
778 771
779static int __devinit 772static int he_init_group(struct he_dev *he_dev, int group)
780he_init_group(struct he_dev *he_dev, int group)
781{ 773{
782 struct he_buff *heb, *next; 774 struct he_buff *heb, *next;
783 dma_addr_t mapping; 775 dma_addr_t mapping;
@@ -915,8 +907,7 @@ out_free_rbpl_table:
915 return -ENOMEM; 907 return -ENOMEM;
916} 908}
917 909
918static int __devinit 910static int he_init_irq(struct he_dev *he_dev)
919he_init_irq(struct he_dev *he_dev)
920{ 911{
921 int i; 912 int i;
922 913
@@ -978,8 +969,7 @@ he_init_irq(struct he_dev *he_dev)
978 return 0; 969 return 0;
979} 970}
980 971
981static int __devinit 972static int he_start(struct atm_dev *dev)
982he_start(struct atm_dev *dev)
983{ 973{
984 struct he_dev *he_dev; 974 struct he_dev *he_dev;
985 struct pci_dev *pci_dev; 975 struct pci_dev *pci_dev;
@@ -2879,7 +2869,7 @@ MODULE_DEVICE_TABLE(pci, he_pci_tbl);
2879static struct pci_driver he_driver = { 2869static struct pci_driver he_driver = {
2880 .name = "he", 2870 .name = "he",
2881 .probe = he_init_one, 2871 .probe = he_init_one,
2882 .remove = __devexit_p(he_remove_one), 2872 .remove = he_remove_one,
2883 .id_table = he_pci_tbl, 2873 .id_table = he_pci_tbl,
2884}; 2874};
2885 2875
diff --git a/drivers/atm/horizon.c b/drivers/atm/horizon.c
index 7d01c2a75256..1dc0519333f2 100644
--- a/drivers/atm/horizon.c
+++ b/drivers/atm/horizon.c
@@ -1789,7 +1789,7 @@ static void CLOCK_IT (const hrz_dev *dev, u32 ctrl)
1789 WRITE_IT_WAIT(dev, ctrl | SEEPROM_SK); 1789 WRITE_IT_WAIT(dev, ctrl | SEEPROM_SK);
1790} 1790}
1791 1791
1792static u16 __devinit read_bia (const hrz_dev * dev, u16 addr) 1792static u16 read_bia(const hrz_dev *dev, u16 addr)
1793{ 1793{
1794 u32 ctrl = rd_regl (dev, CONTROL_0_REG); 1794 u32 ctrl = rd_regl (dev, CONTROL_0_REG);
1795 1795
@@ -1845,7 +1845,8 @@ static u16 __devinit read_bia (const hrz_dev * dev, u16 addr)
1845 1845
1846/********** initialise a card **********/ 1846/********** initialise a card **********/
1847 1847
1848static int __devinit hrz_init (hrz_dev * dev) { 1848static int hrz_init(hrz_dev *dev)
1849{
1849 int onefivefive; 1850 int onefivefive;
1850 1851
1851 u16 chan; 1852 u16 chan;
@@ -2681,7 +2682,8 @@ static const struct atmdev_ops hrz_ops = {
2681 .owner = THIS_MODULE, 2682 .owner = THIS_MODULE,
2682}; 2683};
2683 2684
2684static int __devinit hrz_probe(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent) 2685static int hrz_probe(struct pci_dev *pci_dev,
2686 const struct pci_device_id *pci_ent)
2685{ 2687{
2686 hrz_dev * dev; 2688 hrz_dev * dev;
2687 int err = 0; 2689 int err = 0;
@@ -2836,7 +2838,7 @@ out_disable:
2836 goto out; 2838 goto out;
2837} 2839}
2838 2840
2839static void __devexit hrz_remove_one(struct pci_dev *pci_dev) 2841static void hrz_remove_one(struct pci_dev *pci_dev)
2840{ 2842{
2841 hrz_dev *dev; 2843 hrz_dev *dev;
2842 2844
@@ -2901,7 +2903,7 @@ MODULE_DEVICE_TABLE(pci, hrz_pci_tbl);
2901static struct pci_driver hrz_driver = { 2903static struct pci_driver hrz_driver = {
2902 .name = "horizon", 2904 .name = "horizon",
2903 .probe = hrz_probe, 2905 .probe = hrz_probe,
2904 .remove = __devexit_p(hrz_remove_one), 2906 .remove = hrz_remove_one,
2905 .id_table = hrz_pci_tbl, 2907 .id_table = hrz_pci_tbl,
2906}; 2908};
2907 2909
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
index 8974bd2b961e..272f00927761 100644
--- a/drivers/atm/idt77252.c
+++ b/drivers/atm/idt77252.c
@@ -3109,8 +3109,7 @@ deinit_card(struct idt77252_dev *card)
3109} 3109}
3110 3110
3111 3111
3112static void __devinit 3112static void init_sram(struct idt77252_dev *card)
3113init_sram(struct idt77252_dev *card)
3114{ 3113{
3115 int i; 3114 int i;
3116 3115
@@ -3257,8 +3256,7 @@ init_sram(struct idt77252_dev *card)
3257 IPRINTK("%s: SRAM initialization complete.\n", card->name); 3256 IPRINTK("%s: SRAM initialization complete.\n", card->name);
3258} 3257}
3259 3258
3260static int __devinit 3259static int init_card(struct atm_dev *dev)
3261init_card(struct atm_dev *dev)
3262{ 3260{
3263 struct idt77252_dev *card = dev->dev_data; 3261 struct idt77252_dev *card = dev->dev_data;
3264 struct pci_dev *pcidev = card->pcidev; 3262 struct pci_dev *pcidev = card->pcidev;
@@ -3537,8 +3535,7 @@ init_card(struct atm_dev *dev)
3537/*****************************************************************************/ 3535/*****************************************************************************/
3538 3536
3539 3537
3540static int __devinit 3538static int idt77252_preset(struct idt77252_dev *card)
3541idt77252_preset(struct idt77252_dev *card)
3542{ 3539{
3543 u16 pci_command; 3540 u16 pci_command;
3544 3541
@@ -3579,8 +3576,7 @@ idt77252_preset(struct idt77252_dev *card)
3579} 3576}
3580 3577
3581 3578
3582static unsigned long __devinit 3579static unsigned long probe_sram(struct idt77252_dev *card)
3583probe_sram(struct idt77252_dev *card)
3584{ 3580{
3585 u32 data, addr; 3581 u32 data, addr;
3586 3582
@@ -3601,8 +3597,8 @@ probe_sram(struct idt77252_dev *card)
3601 return addr * sizeof(u32); 3597 return addr * sizeof(u32);
3602} 3598}
3603 3599
3604static int __devinit 3600static int idt77252_init_one(struct pci_dev *pcidev,
3605idt77252_init_one(struct pci_dev *pcidev, const struct pci_device_id *id) 3601 const struct pci_device_id *id)
3606{ 3602{
3607 static struct idt77252_dev **last = &idt77252_chain; 3603 static struct idt77252_dev **last = &idt77252_chain;
3608 static int index = 0; 3604 static int index = 0;
diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index 96cce6d53195..4217f29a85e0 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -2299,7 +2299,7 @@ static int reset_sar(struct atm_dev *dev)
2299} 2299}
2300 2300
2301 2301
2302static int __devinit ia_init(struct atm_dev *dev) 2302static int ia_init(struct atm_dev *dev)
2303{ 2303{
2304 IADEV *iadev; 2304 IADEV *iadev;
2305 unsigned long real_base; 2305 unsigned long real_base;
@@ -2492,7 +2492,7 @@ static void ia_free_rx(IADEV *iadev)
2492 iadev->rx_dle_dma); 2492 iadev->rx_dle_dma);
2493} 2493}
2494 2494
2495static int __devinit ia_start(struct atm_dev *dev) 2495static int ia_start(struct atm_dev *dev)
2496{ 2496{
2497 IADEV *iadev; 2497 IADEV *iadev;
2498 int error; 2498 int error;
@@ -3168,8 +3168,7 @@ static const struct atmdev_ops ops = {
3168 .owner = THIS_MODULE, 3168 .owner = THIS_MODULE,
3169}; 3169};
3170 3170
3171static int __devinit ia_init_one(struct pci_dev *pdev, 3171static int ia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
3172 const struct pci_device_id *ent)
3173{ 3172{
3174 struct atm_dev *dev; 3173 struct atm_dev *dev;
3175 IADEV *iadev; 3174 IADEV *iadev;
@@ -3229,7 +3228,7 @@ err_out:
3229 return ret; 3228 return ret;
3230} 3229}
3231 3230
3232static void __devexit ia_remove_one(struct pci_dev *pdev) 3231static void ia_remove_one(struct pci_dev *pdev)
3233{ 3232{
3234 struct atm_dev *dev = pci_get_drvdata(pdev); 3233 struct atm_dev *dev = pci_get_drvdata(pdev);
3235 IADEV *iadev = INPH_IA_DEV(dev); 3234 IADEV *iadev = INPH_IA_DEV(dev);
@@ -3270,7 +3269,7 @@ static struct pci_driver ia_driver = {
3270 .name = DEV_LABEL, 3269 .name = DEV_LABEL,
3271 .id_table = ia_pci_tbl, 3270 .id_table = ia_pci_tbl,
3272 .probe = ia_init_one, 3271 .probe = ia_init_one,
3273 .remove = __devexit_p(ia_remove_one), 3272 .remove = ia_remove_one,
3274}; 3273};
3275 3274
3276static int __init ia_module_init(void) 3275static int __init ia_module_init(void)
diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c
index 68c758871812..fa7d701933ba 100644
--- a/drivers/atm/lanai.c
+++ b/drivers/atm/lanai.c
@@ -551,8 +551,8 @@ static inline void sram_write(const struct lanai_dev *lanai,
551 writel(val, sram_addr(lanai, offset)); 551 writel(val, sram_addr(lanai, offset));
552} 552}
553 553
554static int __devinit sram_test_word(const struct lanai_dev *lanai, 554static int sram_test_word(const struct lanai_dev *lanai, int offset,
555 int offset, u32 pattern) 555 u32 pattern)
556{ 556{
557 u32 readback; 557 u32 readback;
558 sram_write(lanai, pattern, offset); 558 sram_write(lanai, pattern, offset);
@@ -566,7 +566,7 @@ static int __devinit sram_test_word(const struct lanai_dev *lanai,
566 return -EIO; 566 return -EIO;
567} 567}
568 568
569static int __devinit sram_test_pass(const struct lanai_dev *lanai, u32 pattern) 569static int sram_test_pass(const struct lanai_dev *lanai, u32 pattern)
570{ 570{
571 int offset, result = 0; 571 int offset, result = 0;
572 for (offset = 0; offset < SRAM_BYTES && result == 0; offset += 4) 572 for (offset = 0; offset < SRAM_BYTES && result == 0; offset += 4)
@@ -574,7 +574,7 @@ static int __devinit sram_test_pass(const struct lanai_dev *lanai, u32 pattern)
574 return result; 574 return result;
575} 575}
576 576
577static int __devinit sram_test_and_clear(const struct lanai_dev *lanai) 577static int sram_test_and_clear(const struct lanai_dev *lanai)
578{ 578{
579#ifdef FULL_MEMORY_TEST 579#ifdef FULL_MEMORY_TEST
580 int result; 580 int result;
@@ -860,7 +860,7 @@ static inline void aal0_buffer_free(struct lanai_dev *lanai)
860#ifndef READ_EEPROM 860#ifndef READ_EEPROM
861 861
862/* Stub functions to use if EEPROM reading is disabled */ 862/* Stub functions to use if EEPROM reading is disabled */
863static int __devinit eeprom_read(struct lanai_dev *lanai) 863static int eeprom_read(struct lanai_dev *lanai)
864{ 864{
865 printk(KERN_INFO DEV_LABEL "(itf %d): *NOT* reading EEPROM\n", 865 printk(KERN_INFO DEV_LABEL "(itf %d): *NOT* reading EEPROM\n",
866 lanai->number); 866 lanai->number);
@@ -868,7 +868,7 @@ static int __devinit eeprom_read(struct lanai_dev *lanai)
868 return 0; 868 return 0;
869} 869}
870 870
871static int __devinit eeprom_validate(struct lanai_dev *lanai) 871static int eeprom_validate(struct lanai_dev *lanai)
872{ 872{
873 lanai->serialno = 0; 873 lanai->serialno = 0;
874 lanai->magicno = EEPROM_MAGIC_VALUE; 874 lanai->magicno = EEPROM_MAGIC_VALUE;
@@ -877,7 +877,7 @@ static int __devinit eeprom_validate(struct lanai_dev *lanai)
877 877
878#else /* READ_EEPROM */ 878#else /* READ_EEPROM */
879 879
880static int __devinit eeprom_read(struct lanai_dev *lanai) 880static int eeprom_read(struct lanai_dev *lanai)
881{ 881{
882 int i, address; 882 int i, address;
883 u8 data; 883 u8 data;
@@ -953,7 +953,7 @@ static inline u32 eeprom_be4(const struct lanai_dev *lanai, int address)
953} 953}
954 954
955/* Checksum/validate EEPROM contents */ 955/* Checksum/validate EEPROM contents */
956static int __devinit eeprom_validate(struct lanai_dev *lanai) 956static int eeprom_validate(struct lanai_dev *lanai)
957{ 957{
958 int i, s; 958 int i, s;
959 u32 v; 959 u32 v;
@@ -1448,7 +1448,7 @@ static void vcc_rx_aal0(struct lanai_dev *lanai)
1448#include <linux/vmalloc.h> 1448#include <linux/vmalloc.h>
1449#endif 1449#endif
1450 1450
1451static int __devinit vcc_table_allocate(struct lanai_dev *lanai) 1451static int vcc_table_allocate(struct lanai_dev *lanai)
1452{ 1452{
1453#ifdef VCCTABLE_GETFREEPAGE 1453#ifdef VCCTABLE_GETFREEPAGE
1454 APRINTK((lanai->num_vci) * sizeof(struct lanai_vcc *) <= PAGE_SIZE, 1454 APRINTK((lanai->num_vci) * sizeof(struct lanai_vcc *) <= PAGE_SIZE,
@@ -1588,7 +1588,7 @@ static void lanai_reset(struct lanai_dev *lanai)
1588/* 1588/*
1589 * Allocate service buffer and tell card about it 1589 * Allocate service buffer and tell card about it
1590 */ 1590 */
1591static int __devinit service_buffer_allocate(struct lanai_dev *lanai) 1591static int service_buffer_allocate(struct lanai_dev *lanai)
1592{ 1592{
1593 lanai_buf_allocate(&lanai->service, SERVICE_ENTRIES * 4, 8, 1593 lanai_buf_allocate(&lanai->service, SERVICE_ENTRIES * 4, 8,
1594 lanai->pci); 1594 lanai->pci);
@@ -1942,7 +1942,7 @@ static int check_board_id_and_rev(const char *name, u32 val, int *revp)
1942 1942
1943/* -------------------- PCI INITIALIZATION/SHUTDOWN: */ 1943/* -------------------- PCI INITIALIZATION/SHUTDOWN: */
1944 1944
1945static int __devinit lanai_pci_start(struct lanai_dev *lanai) 1945static int lanai_pci_start(struct lanai_dev *lanai)
1946{ 1946{
1947 struct pci_dev *pci = lanai->pci; 1947 struct pci_dev *pci = lanai->pci;
1948 int result; 1948 int result;
@@ -2123,7 +2123,7 @@ static inline void lanai_cbr_shutdown(struct lanai_dev *lanai)
2123/* -------------------- OPERATIONS: */ 2123/* -------------------- OPERATIONS: */
2124 2124
2125/* setup a newly detected device */ 2125/* setup a newly detected device */
2126static int __devinit lanai_dev_open(struct atm_dev *atmdev) 2126static int lanai_dev_open(struct atm_dev *atmdev)
2127{ 2127{
2128 struct lanai_dev *lanai = (struct lanai_dev *) atmdev->dev_data; 2128 struct lanai_dev *lanai = (struct lanai_dev *) atmdev->dev_data;
2129 unsigned long raw_base; 2129 unsigned long raw_base;
@@ -2566,8 +2566,8 @@ static const struct atmdev_ops ops = {
2566}; 2566};
2567 2567
2568/* initialize one probed card */ 2568/* initialize one probed card */
2569static int __devinit lanai_init_one(struct pci_dev *pci, 2569static int lanai_init_one(struct pci_dev *pci,
2570 const struct pci_device_id *ident) 2570 const struct pci_device_id *ident)
2571{ 2571{
2572 struct lanai_dev *lanai; 2572 struct lanai_dev *lanai;
2573 struct atm_dev *atmdev; 2573 struct atm_dev *atmdev;
diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c
index 1c70c45fa044..ed1d2b7f923b 100644
--- a/drivers/atm/nicstar.c
+++ b/drivers/atm/nicstar.c
@@ -121,8 +121,8 @@
121static u32 ns_read_sram(ns_dev * card, u32 sram_address); 121static u32 ns_read_sram(ns_dev * card, u32 sram_address);
122static void ns_write_sram(ns_dev * card, u32 sram_address, u32 * value, 122static void ns_write_sram(ns_dev * card, u32 sram_address, u32 * value,
123 int count); 123 int count);
124static int __devinit ns_init_card(int i, struct pci_dev *pcidev); 124static int ns_init_card(int i, struct pci_dev *pcidev);
125static void __devinit ns_init_card_error(ns_dev * card, int error); 125static void ns_init_card_error(ns_dev * card, int error);
126static scq_info *get_scq(ns_dev *card, int size, u32 scd); 126static scq_info *get_scq(ns_dev *card, int size, u32 scd);
127static void free_scq(ns_dev *card, scq_info * scq, struct atm_vcc *vcc); 127static void free_scq(ns_dev *card, scq_info * scq, struct atm_vcc *vcc);
128static void push_rxbufs(ns_dev *, struct sk_buff *); 128static void push_rxbufs(ns_dev *, struct sk_buff *);
@@ -180,8 +180,8 @@ MODULE_LICENSE("GPL");
180 180
181/* Functions */ 181/* Functions */
182 182
183static int __devinit nicstar_init_one(struct pci_dev *pcidev, 183static int nicstar_init_one(struct pci_dev *pcidev,
184 const struct pci_device_id *ent) 184 const struct pci_device_id *ent)
185{ 185{
186 static int index = -1; 186 static int index = -1;
187 unsigned int error; 187 unsigned int error;
@@ -200,7 +200,7 @@ err_out:
200 return -ENODEV; 200 return -ENODEV;
201} 201}
202 202
203static void __devexit nicstar_remove_one(struct pci_dev *pcidev) 203static void nicstar_remove_one(struct pci_dev *pcidev)
204{ 204{
205 int i, j; 205 int i, j;
206 ns_dev *card = pci_get_drvdata(pcidev); 206 ns_dev *card = pci_get_drvdata(pcidev);
@@ -262,7 +262,7 @@ static void __devexit nicstar_remove_one(struct pci_dev *pcidev)
262 kfree(card); 262 kfree(card);
263} 263}
264 264
265static struct pci_device_id nicstar_pci_tbl[] __devinitdata = { 265static struct pci_device_id nicstar_pci_tbl[] = {
266 { PCI_VDEVICE(IDT, PCI_DEVICE_ID_IDT_IDT77201), 0 }, 266 { PCI_VDEVICE(IDT, PCI_DEVICE_ID_IDT_IDT77201), 0 },
267 {0,} /* terminate list */ 267 {0,} /* terminate list */
268}; 268};
@@ -273,7 +273,7 @@ static struct pci_driver nicstar_driver = {
273 .name = "nicstar", 273 .name = "nicstar",
274 .id_table = nicstar_pci_tbl, 274 .id_table = nicstar_pci_tbl,
275 .probe = nicstar_init_one, 275 .probe = nicstar_init_one,
276 .remove = __devexit_p(nicstar_remove_one), 276 .remove = nicstar_remove_one,
277}; 277};
278 278
279static int __init nicstar_init(void) 279static int __init nicstar_init(void)
@@ -351,7 +351,7 @@ static void ns_write_sram(ns_dev * card, u32 sram_address, u32 * value,
351 spin_unlock_irqrestore(&card->res_lock, flags); 351 spin_unlock_irqrestore(&card->res_lock, flags);
352} 352}
353 353
354static int __devinit ns_init_card(int i, struct pci_dev *pcidev) 354static int ns_init_card(int i, struct pci_dev *pcidev)
355{ 355{
356 int j; 356 int j;
357 struct ns_dev *card = NULL; 357 struct ns_dev *card = NULL;
@@ -821,7 +821,7 @@ static int __devinit ns_init_card(int i, struct pci_dev *pcidev)
821 return error; 821 return error;
822} 822}
823 823
824static void __devinit ns_init_card_error(ns_dev * card, int error) 824static void ns_init_card_error(ns_dev *card, int error)
825{ 825{
826 if (error >= 17) { 826 if (error >= 17) {
827 writel(0x00000000, card->membase + CFG); 827 writel(0x00000000, card->membase + CFG);
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index d70abe77f737..0474a89170b9 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -538,7 +538,7 @@ static ssize_t geos_gpio_store(struct device *dev, struct device_attribute *attr
538 } else { 538 } else {
539 count = -EINVAL; 539 count = -EINVAL;
540 } 540 }
541 spin_lock_irq(&card->param_queue_lock); 541 spin_unlock_irq(&card->param_queue_lock);
542 return count; 542 return count;
543} 543}
544 544
@@ -1462,7 +1462,7 @@ static void fpga_remove(struct pci_dev *dev)
1462 kfree(card); 1462 kfree(card);
1463} 1463}
1464 1464
1465static struct pci_device_id fpga_pci_tbl[] __devinitdata = { 1465static struct pci_device_id fpga_pci_tbl[] = {
1466 { 0x10ee, 0x0300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 1466 { 0x10ee, 0x0300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
1467 { 0, } 1467 { 0, }
1468}; 1468};
diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c
index abe4e20b0766..969c3c29000c 100644
--- a/drivers/atm/zatm.c
+++ b/drivers/atm/zatm.c
@@ -1094,8 +1094,8 @@ static irqreturn_t zatm_int(int irq,void *dev_id)
1094/*----------------------------- (E)EPROM access -----------------------------*/ 1094/*----------------------------- (E)EPROM access -----------------------------*/
1095 1095
1096 1096
1097static void __devinit eprom_set(struct zatm_dev *zatm_dev,unsigned long value, 1097static void eprom_set(struct zatm_dev *zatm_dev, unsigned long value,
1098 unsigned short cmd) 1098 unsigned short cmd)
1099{ 1099{
1100 int error; 1100 int error;
1101 1101
@@ -1105,8 +1105,7 @@ static void __devinit eprom_set(struct zatm_dev *zatm_dev,unsigned long value,
1105} 1105}
1106 1106
1107 1107
1108static unsigned long __devinit eprom_get(struct zatm_dev *zatm_dev, 1108static unsigned long eprom_get(struct zatm_dev *zatm_dev, unsigned short cmd)
1109 unsigned short cmd)
1110{ 1109{
1111 unsigned int value; 1110 unsigned int value;
1112 int error; 1111 int error;
@@ -1118,8 +1117,8 @@ static unsigned long __devinit eprom_get(struct zatm_dev *zatm_dev,
1118} 1117}
1119 1118
1120 1119
1121static void __devinit eprom_put_bits(struct zatm_dev *zatm_dev, 1120static void eprom_put_bits(struct zatm_dev *zatm_dev, unsigned long data,
1122 unsigned long data,int bits,unsigned short cmd) 1121 int bits, unsigned short cmd)
1123{ 1122{
1124 unsigned long value; 1123 unsigned long value;
1125 int i; 1124 int i;
@@ -1133,8 +1132,8 @@ static void __devinit eprom_put_bits(struct zatm_dev *zatm_dev,
1133} 1132}
1134 1133
1135 1134
1136static void __devinit eprom_get_byte(struct zatm_dev *zatm_dev, 1135static void eprom_get_byte(struct zatm_dev *zatm_dev, unsigned char *byte,
1137 unsigned char *byte,unsigned short cmd) 1136 unsigned short cmd)
1138{ 1137{
1139 int i; 1138 int i;
1140 1139
@@ -1149,8 +1148,8 @@ static void __devinit eprom_get_byte(struct zatm_dev *zatm_dev,
1149} 1148}
1150 1149
1151 1150
1152static unsigned char __devinit eprom_try_esi(struct atm_dev *dev, 1151static unsigned char eprom_try_esi(struct atm_dev *dev, unsigned short cmd,
1153 unsigned short cmd,int offset,int swap) 1152 int offset, int swap)
1154{ 1153{
1155 unsigned char buf[ZEPROM_SIZE]; 1154 unsigned char buf[ZEPROM_SIZE];
1156 struct zatm_dev *zatm_dev; 1155 struct zatm_dev *zatm_dev;
@@ -1170,7 +1169,7 @@ static unsigned char __devinit eprom_try_esi(struct atm_dev *dev,
1170} 1169}
1171 1170
1172 1171
1173static void __devinit eprom_get_esi(struct atm_dev *dev) 1172static void eprom_get_esi(struct atm_dev *dev)
1174{ 1173{
1175 if (eprom_try_esi(dev,ZEPROM_V1_REG,ZEPROM_V1_ESI_OFF,1)) return; 1174 if (eprom_try_esi(dev,ZEPROM_V1_REG,ZEPROM_V1_ESI_OFF,1)) return;
1176 (void) eprom_try_esi(dev,ZEPROM_V2_REG,ZEPROM_V2_ESI_OFF,0); 1175 (void) eprom_try_esi(dev,ZEPROM_V2_REG,ZEPROM_V2_ESI_OFF,0);
@@ -1180,7 +1179,7 @@ static void __devinit eprom_get_esi(struct atm_dev *dev)
1180/*--------------------------------- entries ---------------------------------*/ 1179/*--------------------------------- entries ---------------------------------*/
1181 1180
1182 1181
1183static int __devinit zatm_init(struct atm_dev *dev) 1182static int zatm_init(struct atm_dev *dev)
1184{ 1183{
1185 struct zatm_dev *zatm_dev; 1184 struct zatm_dev *zatm_dev;
1186 struct pci_dev *pci_dev; 1185 struct pci_dev *pci_dev;
@@ -1257,7 +1256,7 @@ static int __devinit zatm_init(struct atm_dev *dev)
1257} 1256}
1258 1257
1259 1258
1260static int __devinit zatm_start(struct atm_dev *dev) 1259static int zatm_start(struct atm_dev *dev)
1261{ 1260{
1262 struct zatm_dev *zatm_dev = ZATM_DEV(dev); 1261 struct zatm_dev *zatm_dev = ZATM_DEV(dev);
1263 struct pci_dev *pdev = zatm_dev->pci_dev; 1262 struct pci_dev *pdev = zatm_dev->pci_dev;
@@ -1584,8 +1583,8 @@ static const struct atmdev_ops ops = {
1584 .change_qos = zatm_change_qos, 1583 .change_qos = zatm_change_qos,
1585}; 1584};
1586 1585
1587static int __devinit zatm_init_one(struct pci_dev *pci_dev, 1586static int zatm_init_one(struct pci_dev *pci_dev,
1588 const struct pci_device_id *ent) 1587 const struct pci_device_id *ent)
1589{ 1588{
1590 struct atm_dev *dev; 1589 struct atm_dev *dev;
1591 struct zatm_dev *zatm_dev; 1590 struct zatm_dev *zatm_dev;
@@ -1636,7 +1635,7 @@ out_free:
1636 1635
1637MODULE_LICENSE("GPL"); 1636MODULE_LICENSE("GPL");
1638 1637
1639static struct pci_device_id zatm_pci_tbl[] __devinitdata = { 1638static struct pci_device_id zatm_pci_tbl[] = {
1640 { PCI_VDEVICE(ZEITNET, PCI_DEVICE_ID_ZEITNET_1221), ZATM_COPPER }, 1639 { PCI_VDEVICE(ZEITNET, PCI_DEVICE_ID_ZEITNET_1221), ZATM_COPPER },
1641 { PCI_VDEVICE(ZEITNET, PCI_DEVICE_ID_ZEITNET_1225), 0 }, 1640 { PCI_VDEVICE(ZEITNET, PCI_DEVICE_ID_ZEITNET_1225), 0 },
1642 { 0, } 1641 { 0, }
diff --git a/drivers/auxdisplay/cfag12864bfb.c b/drivers/auxdisplay/cfag12864bfb.c
index 5ad3bad2b0a5..d585735430dd 100644
--- a/drivers/auxdisplay/cfag12864bfb.c
+++ b/drivers/auxdisplay/cfag12864bfb.c
@@ -37,7 +37,7 @@
37 37
38#define CFAG12864BFB_NAME "cfag12864bfb" 38#define CFAG12864BFB_NAME "cfag12864bfb"
39 39
40static struct fb_fix_screeninfo cfag12864bfb_fix __devinitdata = { 40static struct fb_fix_screeninfo cfag12864bfb_fix = {
41 .id = "cfag12864b", 41 .id = "cfag12864b",
42 .type = FB_TYPE_PACKED_PIXELS, 42 .type = FB_TYPE_PACKED_PIXELS,
43 .visual = FB_VISUAL_MONO10, 43 .visual = FB_VISUAL_MONO10,
@@ -48,7 +48,7 @@ static struct fb_fix_screeninfo cfag12864bfb_fix __devinitdata = {
48 .accel = FB_ACCEL_NONE, 48 .accel = FB_ACCEL_NONE,
49}; 49};
50 50
51static struct fb_var_screeninfo cfag12864bfb_var __devinitdata = { 51static struct fb_var_screeninfo cfag12864bfb_var = {
52 .xres = CFAG12864B_WIDTH, 52 .xres = CFAG12864B_WIDTH,
53 .yres = CFAG12864B_HEIGHT, 53 .yres = CFAG12864B_HEIGHT,
54 .xres_virtual = CFAG12864B_WIDTH, 54 .xres_virtual = CFAG12864B_WIDTH,
@@ -80,7 +80,7 @@ static struct fb_ops cfag12864bfb_ops = {
80 .fb_mmap = cfag12864bfb_mmap, 80 .fb_mmap = cfag12864bfb_mmap,
81}; 81};
82 82
83static int __devinit cfag12864bfb_probe(struct platform_device *device) 83static int cfag12864bfb_probe(struct platform_device *device)
84{ 84{
85 int ret = -EINVAL; 85 int ret = -EINVAL;
86 struct fb_info *info = framebuffer_alloc(0, &device->dev); 86 struct fb_info *info = framebuffer_alloc(0, &device->dev);
@@ -114,7 +114,7 @@ none:
114 return ret; 114 return ret;
115} 115}
116 116
117static int __devexit cfag12864bfb_remove(struct platform_device *device) 117static int cfag12864bfb_remove(struct platform_device *device)
118{ 118{
119 struct fb_info *info = platform_get_drvdata(device); 119 struct fb_info *info = platform_get_drvdata(device);
120 120
@@ -128,7 +128,7 @@ static int __devexit cfag12864bfb_remove(struct platform_device *device)
128 128
129static struct platform_driver cfag12864bfb_driver = { 129static struct platform_driver cfag12864bfb_driver = {
130 .probe = cfag12864bfb_probe, 130 .probe = cfag12864bfb_probe,
131 .remove = __devexit_p(cfag12864bfb_remove), 131 .remove = cfag12864bfb_remove,
132 .driver = { 132 .driver = {
133 .name = CFAG12864BFB_NAME, 133 .name = CFAG12864BFB_NAME,
134 }, 134 },
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 63452943abd1..fb10728f6372 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -224,7 +224,7 @@ static void cpu_device_release(struct device *dev)
224 * by the cpu device. 224 * by the cpu device.
225 * 225 *
226 * Never copy this way of doing things, or you too will be made fun of 226 * Never copy this way of doing things, or you too will be made fun of
227 * on the linux-kerenl list, you have been warned. 227 * on the linux-kernel list, you have been warned.
228 */ 228 */
229} 229}
230 230
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index d81460309182..b392b353be39 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -305,7 +305,7 @@ static bool fw_read_file_contents(struct file *file, struct firmware_buf *fw_buf
305 char *buf; 305 char *buf;
306 306
307 size = fw_file_size(file); 307 size = fw_file_size(file);
308 if (size < 0) 308 if (size <= 0)
309 return false; 309 return false;
310 buf = vmalloc(size); 310 buf = vmalloc(size);
311 if (!buf) 311 if (!buf)
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index a3c1404c7933..2b7f77d3fcb0 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -513,6 +513,8 @@ static int device_resume_early(struct device *dev, pm_message_t state)
513 513
514 Out: 514 Out:
515 TRACE_RESUME(error); 515 TRACE_RESUME(error);
516
517 pm_runtime_enable(dev);
516 return error; 518 return error;
517} 519}
518 520
@@ -589,8 +591,6 @@ static int device_resume(struct device *dev, pm_message_t state, bool async)
589 if (!dev->power.is_suspended) 591 if (!dev->power.is_suspended)
590 goto Unlock; 592 goto Unlock;
591 593
592 pm_runtime_enable(dev);
593
594 if (dev->pm_domain) { 594 if (dev->pm_domain) {
595 info = "power domain "; 595 info = "power domain ";
596 callback = pm_op(&dev->pm_domain->ops, state); 596 callback = pm_op(&dev->pm_domain->ops, state);
@@ -930,6 +930,8 @@ static int device_suspend_late(struct device *dev, pm_message_t state)
930 pm_callback_t callback = NULL; 930 pm_callback_t callback = NULL;
931 char *info = NULL; 931 char *info = NULL;
932 932
933 __pm_runtime_disable(dev, false);
934
933 if (dev->power.syscore) 935 if (dev->power.syscore)
934 return 0; 936 return 0;
935 937
@@ -1133,11 +1135,8 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
1133 1135
1134 Complete: 1136 Complete:
1135 complete_all(&dev->power.completion); 1137 complete_all(&dev->power.completion);
1136
1137 if (error) 1138 if (error)
1138 async_error = error; 1139 async_error = error;
1139 else if (dev->power.is_suspended)
1140 __pm_runtime_disable(dev, false);
1141 1140
1142 return error; 1141 return error;
1143} 1142}
diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c
index ff46387f5308..d21349544ce5 100644
--- a/drivers/base/power/qos.c
+++ b/drivers/base/power/qos.c
@@ -542,19 +542,19 @@ int dev_pm_qos_add_ancestor_request(struct device *dev,
542 struct dev_pm_qos_request *req, s32 value) 542 struct dev_pm_qos_request *req, s32 value)
543{ 543{
544 struct device *ancestor = dev->parent; 544 struct device *ancestor = dev->parent;
545 int error = -ENODEV; 545 int ret = -ENODEV;
546 546
547 while (ancestor && !ancestor->power.ignore_children) 547 while (ancestor && !ancestor->power.ignore_children)
548 ancestor = ancestor->parent; 548 ancestor = ancestor->parent;
549 549
550 if (ancestor) 550 if (ancestor)
551 error = dev_pm_qos_add_request(ancestor, req, 551 ret = dev_pm_qos_add_request(ancestor, req,
552 DEV_PM_QOS_LATENCY, value); 552 DEV_PM_QOS_LATENCY, value);
553 553
554 if (error < 0) 554 if (ret < 0)
555 req->dev = NULL; 555 req->dev = NULL;
556 556
557 return error; 557 return ret;
558} 558}
559EXPORT_SYMBOL_GPL(dev_pm_qos_add_ancestor_request); 559EXPORT_SYMBOL_GPL(dev_pm_qos_add_ancestor_request);
560 560
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
index 07aad786f817..d9a6c94ce423 100644
--- a/drivers/base/regmap/regmap-debugfs.c
+++ b/drivers/base/regmap/regmap-debugfs.c
@@ -56,6 +56,19 @@ static const struct file_operations regmap_name_fops = {
56 .llseek = default_llseek, 56 .llseek = default_llseek,
57}; 57};
58 58
59static void regmap_debugfs_free_dump_cache(struct regmap *map)
60{
61 struct regmap_debugfs_off_cache *c;
62
63 while (!list_empty(&map->debugfs_off_cache)) {
64 c = list_first_entry(&map->debugfs_off_cache,
65 struct regmap_debugfs_off_cache,
66 list);
67 list_del(&c->list);
68 kfree(c);
69 }
70}
71
59/* 72/*
60 * Work out where the start offset maps into register numbers, bearing 73 * Work out where the start offset maps into register numbers, bearing
61 * in mind that we suppress hidden registers. 74 * in mind that we suppress hidden registers.
@@ -91,8 +104,10 @@ static unsigned int regmap_debugfs_get_dump_start(struct regmap *map,
91 /* No cache entry? Start a new one */ 104 /* No cache entry? Start a new one */
92 if (!c) { 105 if (!c) {
93 c = kzalloc(sizeof(*c), GFP_KERNEL); 106 c = kzalloc(sizeof(*c), GFP_KERNEL);
94 if (!c) 107 if (!c) {
95 break; 108 regmap_debugfs_free_dump_cache(map);
109 return base;
110 }
96 c->min = p; 111 c->min = p;
97 c->base_reg = i; 112 c->base_reg = i;
98 } 113 }
@@ -101,14 +116,32 @@ static unsigned int regmap_debugfs_get_dump_start(struct regmap *map,
101 } 116 }
102 } 117 }
103 118
119 /* Close the last entry off if we didn't scan beyond it */
120 if (c) {
121 c->max = p - 1;
122 list_add_tail(&c->list,
123 &map->debugfs_off_cache);
124 }
125
126 /*
127 * This should never happen; we return above if we fail to
128 * allocate and we should never be in this code if there are
129 * no registers at all.
130 */
131 if (list_empty(&map->debugfs_off_cache)) {
132 WARN_ON(list_empty(&map->debugfs_off_cache));
133 return base;
134 }
135
104 /* Find the relevant block */ 136 /* Find the relevant block */
105 list_for_each_entry(c, &map->debugfs_off_cache, list) { 137 list_for_each_entry(c, &map->debugfs_off_cache, list) {
106 if (*pos >= c->min && *pos <= c->max) { 138 if (from >= c->min && from <= c->max) {
107 *pos = c->min; 139 *pos = c->min;
108 return c->base_reg; 140 return c->base_reg;
109 } 141 }
110 142
111 ret = c->max; 143 *pos = c->min;
144 ret = c->base_reg;
112 } 145 }
113 146
114 return ret; 147 return ret;
@@ -387,16 +420,8 @@ void regmap_debugfs_init(struct regmap *map, const char *name)
387 420
388void regmap_debugfs_exit(struct regmap *map) 421void regmap_debugfs_exit(struct regmap *map)
389{ 422{
390 struct regmap_debugfs_off_cache *c;
391
392 debugfs_remove_recursive(map->debugfs); 423 debugfs_remove_recursive(map->debugfs);
393 while (!list_empty(&map->debugfs_off_cache)) { 424 regmap_debugfs_free_dump_cache(map);
394 c = list_first_entry(&map->debugfs_off_cache,
395 struct regmap_debugfs_off_cache,
396 list);
397 list_del(&c->list);
398 kfree(c);
399 }
400 kfree(map->debugfs_name); 425 kfree(map->debugfs_name);
401} 426}
402 427
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 42d5cb0f503f..f00b059c057a 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1106,7 +1106,7 @@ EXPORT_SYMBOL_GPL(regmap_raw_write);
1106 * @val_count: Number of registers to write 1106 * @val_count: Number of registers to write
1107 * 1107 *
1108 * This function is intended to be used for writing a large block of 1108 * This function is intended to be used for writing a large block of
1109 * data to be device either in single transfer or multiple transfer. 1109 * data to the device either in single transfer or multiple transfer.
1110 * 1110 *
1111 * A value of zero will be returned on success, a negative errno will 1111 * A value of zero will be returned on success, a negative errno will
1112 * be returned in error cases. 1112 * be returned in error cases.
diff --git a/drivers/bcma/Kconfig b/drivers/bcma/Kconfig
index d7b56a88c9f4..8b4221cfd118 100644
--- a/drivers/bcma/Kconfig
+++ b/drivers/bcma/Kconfig
@@ -67,8 +67,7 @@ config BCMA_DRIVER_GMAC_CMN
67 67
68config BCMA_DRIVER_GPIO 68config BCMA_DRIVER_GPIO
69 bool "BCMA GPIO driver" 69 bool "BCMA GPIO driver"
70 depends on BCMA 70 depends on BCMA && GPIOLIB
71 select GPIOLIB
72 help 71 help
73 Driver to provide access to the GPIO pins of the bcma bus. 72 Driver to provide access to the GPIO pins of the bcma bus.
74 73
diff --git a/drivers/bcma/bcma_private.h b/drivers/bcma/bcma_private.h
index 4a2d72ec6d43..19e3fbfd5757 100644
--- a/drivers/bcma/bcma_private.h
+++ b/drivers/bcma/bcma_private.h
@@ -22,7 +22,7 @@
22struct bcma_bus; 22struct bcma_bus;
23 23
24/* main.c */ 24/* main.c */
25int __devinit bcma_bus_register(struct bcma_bus *bus); 25int bcma_bus_register(struct bcma_bus *bus);
26void bcma_bus_unregister(struct bcma_bus *bus); 26void bcma_bus_unregister(struct bcma_bus *bus);
27int __init bcma_bus_early_register(struct bcma_bus *bus, 27int __init bcma_bus_early_register(struct bcma_bus *bus,
28 struct bcma_device *core_cc, 28 struct bcma_device *core_cc,
@@ -87,8 +87,8 @@ u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address);
87extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc); 87extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc);
88 88
89#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE 89#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE
90bool __devinit bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc); 90bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc);
91void __devinit bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc); 91void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc);
92#endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */ 92#endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */
93 93
94#ifdef CONFIG_BCMA_DRIVER_GPIO 94#ifdef CONFIG_BCMA_DRIVER_GPIO
diff --git a/drivers/bcma/driver_chipcommon_sflash.c b/drivers/bcma/driver_chipcommon_sflash.c
index 63e688393825..1e694db4532d 100644
--- a/drivers/bcma/driver_chipcommon_sflash.c
+++ b/drivers/bcma/driver_chipcommon_sflash.c
@@ -35,7 +35,7 @@ static struct bcma_sflash_tbl_e bcma_sflash_st_tbl[] = {
35 { "M25P40", 0x12, 0x10000, 8, }, 35 { "M25P40", 0x12, 0x10000, 8, },
36 36
37 { "M25P16", 0x14, 0x10000, 32, }, 37 { "M25P16", 0x14, 0x10000, 32, },
38 { "M25P32", 0x14, 0x10000, 64, }, 38 { "M25P32", 0x15, 0x10000, 64, },
39 { "M25P64", 0x16, 0x10000, 128, }, 39 { "M25P64", 0x16, 0x10000, 128, },
40 { "M25FL128", 0x17, 0x10000, 256, }, 40 { "M25FL128", 0x17, 0x10000, 256, },
41 { 0 }, 41 { 0 },
diff --git a/drivers/bcma/driver_gmac_cmn.c b/drivers/bcma/driver_gmac_cmn.c
index 834225f65e8f..dcb137926d31 100644
--- a/drivers/bcma/driver_gmac_cmn.c
+++ b/drivers/bcma/driver_gmac_cmn.c
@@ -8,7 +8,7 @@
8#include "bcma_private.h" 8#include "bcma_private.h"
9#include <linux/bcma/bcma.h> 9#include <linux/bcma/bcma.h>
10 10
11void __devinit bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc) 11void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc)
12{ 12{
13 mutex_init(&gc->phy_mutex); 13 mutex_init(&gc->phy_mutex);
14} 14}
diff --git a/drivers/bcma/driver_pci.c b/drivers/bcma/driver_pci.c
index c39ee6d45850..cf7a476a519f 100644
--- a/drivers/bcma/driver_pci.c
+++ b/drivers/bcma/driver_pci.c
@@ -207,14 +207,14 @@ static void bcma_core_pci_config_fixup(struct bcma_drv_pci *pc)
207 * Init. 207 * Init.
208 **************************************************/ 208 **************************************************/
209 209
210static void __devinit bcma_core_pci_clientmode_init(struct bcma_drv_pci *pc) 210static void bcma_core_pci_clientmode_init(struct bcma_drv_pci *pc)
211{ 211{
212 bcma_core_pci_fixcfg(pc); 212 bcma_core_pci_fixcfg(pc);
213 bcma_pcicore_serdes_workaround(pc); 213 bcma_pcicore_serdes_workaround(pc);
214 bcma_core_pci_config_fixup(pc); 214 bcma_core_pci_config_fixup(pc);
215} 215}
216 216
217void __devinit bcma_core_pci_init(struct bcma_drv_pci *pc) 217void bcma_core_pci_init(struct bcma_drv_pci *pc)
218{ 218{
219 if (pc->setup_done) 219 if (pc->setup_done)
220 return; 220 return;
diff --git a/drivers/bcma/driver_pci_host.c b/drivers/bcma/driver_pci_host.c
index e6b5c89469dc..af0c9fabee54 100644
--- a/drivers/bcma/driver_pci_host.c
+++ b/drivers/bcma/driver_pci_host.c
@@ -24,7 +24,7 @@
24#define BCMA_PCI_SLOT_MAX 16 24#define BCMA_PCI_SLOT_MAX 16
25#define PCI_CONFIG_SPACE_SIZE 256 25#define PCI_CONFIG_SPACE_SIZE 256
26 26
27bool __devinit bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc) 27bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc)
28{ 28{
29 struct bcma_bus *bus = pc->core->bus; 29 struct bcma_bus *bus = pc->core->bus;
30 u16 chipid_top; 30 u16 chipid_top;
@@ -264,10 +264,9 @@ static int bcma_core_pci_hostmode_write_config(struct pci_bus *bus,
264} 264}
265 265
266/* return cap_offset if requested capability exists in the PCI config space */ 266/* return cap_offset if requested capability exists in the PCI config space */
267static u8 __devinit bcma_find_pci_capability(struct bcma_drv_pci *pc, 267static u8 bcma_find_pci_capability(struct bcma_drv_pci *pc, unsigned int dev,
268 unsigned int dev, 268 unsigned int func, u8 req_cap_id,
269 unsigned int func, u8 req_cap_id, 269 unsigned char *buf, u32 *buflen)
270 unsigned char *buf, u32 *buflen)
271{ 270{
272 u8 cap_id; 271 u8 cap_id;
273 u8 cap_ptr = 0; 272 u8 cap_ptr = 0;
@@ -334,7 +333,7 @@ static u8 __devinit bcma_find_pci_capability(struct bcma_drv_pci *pc,
334 * Retry Status (CRS) Completion Status to software then 333 * Retry Status (CRS) Completion Status to software then
335 * enable the feature. 334 * enable the feature.
336 */ 335 */
337static void __devinit bcma_core_pci_enable_crs(struct bcma_drv_pci *pc) 336static void bcma_core_pci_enable_crs(struct bcma_drv_pci *pc)
338{ 337{
339 struct bcma_bus *bus = pc->core->bus; 338 struct bcma_bus *bus = pc->core->bus;
340 u8 cap_ptr, root_ctrl, root_cap, dev; 339 u8 cap_ptr, root_ctrl, root_cap, dev;
@@ -381,7 +380,7 @@ static void __devinit bcma_core_pci_enable_crs(struct bcma_drv_pci *pc)
381 } 380 }
382} 381}
383 382
384void __devinit bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc) 383void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc)
385{ 384{
386 struct bcma_bus *bus = pc->core->bus; 385 struct bcma_bus *bus = pc->core->bus;
387 struct bcma_drv_pci_host *pc_host; 386 struct bcma_drv_pci_host *pc_host;
diff --git a/drivers/bcma/host_pci.c b/drivers/bcma/host_pci.c
index 98fdc3e014e7..fbf2759e7e4e 100644
--- a/drivers/bcma/host_pci.c
+++ b/drivers/bcma/host_pci.c
@@ -155,8 +155,8 @@ static const struct bcma_host_ops bcma_host_pci_ops = {
155 .awrite32 = bcma_host_pci_awrite32, 155 .awrite32 = bcma_host_pci_awrite32,
156}; 156};
157 157
158static int __devinit bcma_host_pci_probe(struct pci_dev *dev, 158static int bcma_host_pci_probe(struct pci_dev *dev,
159 const struct pci_device_id *id) 159 const struct pci_device_id *id)
160{ 160{
161 struct bcma_bus *bus; 161 struct bcma_bus *bus;
162 int err = -ENOMEM; 162 int err = -ENOMEM;
@@ -226,7 +226,7 @@ err_kfree_bus:
226 return err; 226 return err;
227} 227}
228 228
229static void __devexit bcma_host_pci_remove(struct pci_dev *dev) 229static void bcma_host_pci_remove(struct pci_dev *dev)
230{ 230{
231 struct bcma_bus *bus = pci_get_drvdata(dev); 231 struct bcma_bus *bus = pci_get_drvdata(dev);
232 232
@@ -284,7 +284,7 @@ static struct pci_driver bcma_pci_bridge_driver = {
284 .name = "bcma-pci-bridge", 284 .name = "bcma-pci-bridge",
285 .id_table = bcma_pci_bridge_tbl, 285 .id_table = bcma_pci_bridge_tbl,
286 .probe = bcma_host_pci_probe, 286 .probe = bcma_host_pci_probe,
287 .remove = __devexit_p(bcma_host_pci_remove), 287 .remove = bcma_host_pci_remove,
288 .driver.pm = BCMA_PM_OPS, 288 .driver.pm = BCMA_PM_OPS,
289}; 289};
290 290
diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
index 53ba20ca17e0..4a92f647b58b 100644
--- a/drivers/bcma/main.c
+++ b/drivers/bcma/main.c
@@ -192,7 +192,7 @@ static void bcma_unregister_cores(struct bcma_bus *bus)
192 platform_device_unregister(bus->drv_cc.watchdog); 192 platform_device_unregister(bus->drv_cc.watchdog);
193} 193}
194 194
195int __devinit bcma_bus_register(struct bcma_bus *bus) 195int bcma_bus_register(struct bcma_bus *bus)
196{ 196{
197 int err; 197 int err;
198 struct bcma_device *core; 198 struct bcma_device *core;
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 6526157edafc..ade58bc8f3c4 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -181,8 +181,8 @@ static void cciss_geometry_inquiry(ctlr_info_t *h, int logvol,
181 sector_t total_size, 181 sector_t total_size,
182 unsigned int block_size, InquiryData_struct *inq_buff, 182 unsigned int block_size, InquiryData_struct *inq_buff,
183 drive_info_struct *drv); 183 drive_info_struct *drv);
184static void __devinit cciss_interrupt_mode(ctlr_info_t *); 184static void cciss_interrupt_mode(ctlr_info_t *);
185static int __devinit cciss_enter_simple_mode(struct ctlr_info *h); 185static int cciss_enter_simple_mode(struct ctlr_info *h);
186static void start_io(ctlr_info_t *h); 186static void start_io(ctlr_info_t *h);
187static int sendcmd_withirq(ctlr_info_t *h, __u8 cmd, void *buff, size_t size, 187static int sendcmd_withirq(ctlr_info_t *h, __u8 cmd, void *buff, size_t size,
188 __u8 page_code, unsigned char scsi3addr[], 188 __u8 page_code, unsigned char scsi3addr[],
@@ -199,14 +199,13 @@ static void cciss_device_release(struct device *dev);
199static void cciss_free_gendisk(ctlr_info_t *h, int drv_index); 199static void cciss_free_gendisk(ctlr_info_t *h, int drv_index);
200static void cciss_free_drive_info(ctlr_info_t *h, int drv_index); 200static void cciss_free_drive_info(ctlr_info_t *h, int drv_index);
201static inline u32 next_command(ctlr_info_t *h); 201static inline u32 next_command(ctlr_info_t *h);
202static int __devinit cciss_find_cfg_addrs(struct pci_dev *pdev, 202static int cciss_find_cfg_addrs(struct pci_dev *pdev, void __iomem *vaddr,
203 void __iomem *vaddr, u32 *cfg_base_addr, u64 *cfg_base_addr_index, 203 u32 *cfg_base_addr, u64 *cfg_base_addr_index,
204 u64 *cfg_offset); 204 u64 *cfg_offset);
205static int __devinit cciss_pci_find_memory_BAR(struct pci_dev *pdev, 205static int cciss_pci_find_memory_BAR(struct pci_dev *pdev,
206 unsigned long *memory_bar); 206 unsigned long *memory_bar);
207static inline u32 cciss_tag_discard_error_bits(ctlr_info_t *h, u32 tag); 207static inline u32 cciss_tag_discard_error_bits(ctlr_info_t *h, u32 tag);
208static __devinit int write_driver_ver_to_cfgtable( 208static int write_driver_ver_to_cfgtable(CfgTable_struct __iomem *cfgtable);
209 CfgTable_struct __iomem *cfgtable);
210 209
211/* performant mode helper functions */ 210/* performant mode helper functions */
212static void calc_bucket_map(int *bucket, int num_buckets, int nsgs, 211static void calc_bucket_map(int *bucket, int num_buckets, int nsgs,
@@ -550,7 +549,7 @@ static const struct file_operations cciss_proc_fops = {
550 .write = cciss_proc_write, 549 .write = cciss_proc_write,
551}; 550};
552 551
553static void __devinit cciss_procinit(ctlr_info_t *h) 552static void cciss_procinit(ctlr_info_t *h)
554{ 553{
555 struct proc_dir_entry *pde; 554 struct proc_dir_entry *pde;
556 555
@@ -2663,8 +2662,8 @@ static int fill_cmd(ctlr_info_t *h, CommandList_struct *c, __u8 cmd, void *buff,
2663 return status; 2662 return status;
2664} 2663}
2665 2664
2666static int __devinit cciss_send_reset(ctlr_info_t *h, unsigned char *scsi3addr, 2665static int cciss_send_reset(ctlr_info_t *h, unsigned char *scsi3addr,
2667 u8 reset_type) 2666 u8 reset_type)
2668{ 2667{
2669 CommandList_struct *c; 2668 CommandList_struct *c;
2670 int return_status; 2669 int return_status;
@@ -3919,7 +3918,7 @@ static void calc_bucket_map(int bucket[], int num_buckets,
3919 } 3918 }
3920} 3919}
3921 3920
3922static void __devinit cciss_wait_for_mode_change_ack(ctlr_info_t *h) 3921static void cciss_wait_for_mode_change_ack(ctlr_info_t *h)
3923{ 3922{
3924 int i; 3923 int i;
3925 3924
@@ -3933,8 +3932,7 @@ static void __devinit cciss_wait_for_mode_change_ack(ctlr_info_t *h)
3933 } 3932 }
3934} 3933}
3935 3934
3936static __devinit void cciss_enter_performant_mode(ctlr_info_t *h, 3935static void cciss_enter_performant_mode(ctlr_info_t *h, u32 use_short_tags)
3937 u32 use_short_tags)
3938{ 3936{
3939 /* This is a bit complicated. There are 8 registers on 3937 /* This is a bit complicated. There are 8 registers on
3940 * the controller which we write to to tell it 8 different 3938 * the controller which we write to to tell it 8 different
@@ -4000,7 +3998,7 @@ static __devinit void cciss_enter_performant_mode(ctlr_info_t *h,
4000 " performant mode\n"); 3998 " performant mode\n");
4001} 3999}
4002 4000
4003static void __devinit cciss_put_controller_into_performant_mode(ctlr_info_t *h) 4001static void cciss_put_controller_into_performant_mode(ctlr_info_t *h)
4004{ 4002{
4005 __u32 trans_support; 4003 __u32 trans_support;
4006 4004
@@ -4062,7 +4060,7 @@ clean_up:
4062 * controllers that are capable. If not, we use IO-APIC mode. 4060 * controllers that are capable. If not, we use IO-APIC mode.
4063 */ 4061 */
4064 4062
4065static void __devinit cciss_interrupt_mode(ctlr_info_t *h) 4063static void cciss_interrupt_mode(ctlr_info_t *h)
4066{ 4064{
4067#ifdef CONFIG_PCI_MSI 4065#ifdef CONFIG_PCI_MSI
4068 int err; 4066 int err;
@@ -4108,7 +4106,7 @@ default_int_mode:
4108 return; 4106 return;
4109} 4107}
4110 4108
4111static int __devinit cciss_lookup_board_id(struct pci_dev *pdev, u32 *board_id) 4109static int cciss_lookup_board_id(struct pci_dev *pdev, u32 *board_id)
4112{ 4110{
4113 int i; 4111 int i;
4114 u32 subsystem_vendor_id, subsystem_device_id; 4112 u32 subsystem_vendor_id, subsystem_device_id;
@@ -4134,8 +4132,8 @@ static inline bool cciss_board_disabled(ctlr_info_t *h)
4134 return ((command & PCI_COMMAND_MEMORY) == 0); 4132 return ((command & PCI_COMMAND_MEMORY) == 0);
4135} 4133}
4136 4134
4137static int __devinit cciss_pci_find_memory_BAR(struct pci_dev *pdev, 4135static int cciss_pci_find_memory_BAR(struct pci_dev *pdev,
4138 unsigned long *memory_bar) 4136 unsigned long *memory_bar)
4139{ 4137{
4140 int i; 4138 int i;
4141 4139
@@ -4151,8 +4149,8 @@ static int __devinit cciss_pci_find_memory_BAR(struct pci_dev *pdev,
4151 return -ENODEV; 4149 return -ENODEV;
4152} 4150}
4153 4151
4154static int __devinit cciss_wait_for_board_state(struct pci_dev *pdev, 4152static int cciss_wait_for_board_state(struct pci_dev *pdev,
4155 void __iomem *vaddr, int wait_for_ready) 4153 void __iomem *vaddr, int wait_for_ready)
4156#define BOARD_READY 1 4154#define BOARD_READY 1
4157#define BOARD_NOT_READY 0 4155#define BOARD_NOT_READY 0
4158{ 4156{
@@ -4179,9 +4177,9 @@ static int __devinit cciss_wait_for_board_state(struct pci_dev *pdev,
4179 return -ENODEV; 4177 return -ENODEV;
4180} 4178}
4181 4179
4182static int __devinit cciss_find_cfg_addrs(struct pci_dev *pdev, 4180static int cciss_find_cfg_addrs(struct pci_dev *pdev, void __iomem *vaddr,
4183 void __iomem *vaddr, u32 *cfg_base_addr, u64 *cfg_base_addr_index, 4181 u32 *cfg_base_addr, u64 *cfg_base_addr_index,
4184 u64 *cfg_offset) 4182 u64 *cfg_offset)
4185{ 4183{
4186 *cfg_base_addr = readl(vaddr + SA5_CTCFG_OFFSET); 4184 *cfg_base_addr = readl(vaddr + SA5_CTCFG_OFFSET);
4187 *cfg_offset = readl(vaddr + SA5_CTMEM_OFFSET); 4185 *cfg_offset = readl(vaddr + SA5_CTMEM_OFFSET);
@@ -4195,7 +4193,7 @@ static int __devinit cciss_find_cfg_addrs(struct pci_dev *pdev,
4195 return 0; 4193 return 0;
4196} 4194}
4197 4195
4198static int __devinit cciss_find_cfgtables(ctlr_info_t *h) 4196static int cciss_find_cfgtables(ctlr_info_t *h)
4199{ 4197{
4200 u64 cfg_offset; 4198 u64 cfg_offset;
4201 u32 cfg_base_addr; 4199 u32 cfg_base_addr;
@@ -4224,7 +4222,7 @@ static int __devinit cciss_find_cfgtables(ctlr_info_t *h)
4224 return 0; 4222 return 0;
4225} 4223}
4226 4224
4227static void __devinit cciss_get_max_perf_mode_cmds(struct ctlr_info *h) 4225static void cciss_get_max_perf_mode_cmds(struct ctlr_info *h)
4228{ 4226{
4229 h->max_commands = readl(&(h->cfgtable->MaxPerformantModeCommands)); 4227 h->max_commands = readl(&(h->cfgtable->MaxPerformantModeCommands));
4230 4228
@@ -4245,7 +4243,7 @@ static void __devinit cciss_get_max_perf_mode_cmds(struct ctlr_info *h)
4245 * max commands, max SG elements without chaining, and with chaining, 4243 * max commands, max SG elements without chaining, and with chaining,
4246 * SG chain block size, etc. 4244 * SG chain block size, etc.
4247 */ 4245 */
4248static void __devinit cciss_find_board_params(ctlr_info_t *h) 4246static void cciss_find_board_params(ctlr_info_t *h)
4249{ 4247{
4250 cciss_get_max_perf_mode_cmds(h); 4248 cciss_get_max_perf_mode_cmds(h);
4251 h->nr_cmds = h->max_commands - 4 - cciss_tape_cmds; 4249 h->nr_cmds = h->max_commands - 4 - cciss_tape_cmds;
@@ -4304,7 +4302,7 @@ static inline void cciss_p600_dma_prefetch_quirk(ctlr_info_t *h)
4304 pci_write_config_dword(h->pdev, PCI_COMMAND_PARITY, dma_refetch); 4302 pci_write_config_dword(h->pdev, PCI_COMMAND_PARITY, dma_refetch);
4305} 4303}
4306 4304
4307static int __devinit cciss_pci_init(ctlr_info_t *h) 4305static int cciss_pci_init(ctlr_info_t *h)
4308{ 4306{
4309 int prod_index, err; 4307 int prod_index, err;
4310 4308
@@ -4424,7 +4422,8 @@ static void free_hba(ctlr_info_t *h)
4424} 4422}
4425 4423
4426/* Send a message CDB to the firmware. */ 4424/* Send a message CDB to the firmware. */
4427static __devinit int cciss_message(struct pci_dev *pdev, unsigned char opcode, unsigned char type) 4425static int cciss_message(struct pci_dev *pdev, unsigned char opcode,
4426 unsigned char type)
4428{ 4427{
4429 typedef struct { 4428 typedef struct {
4430 CommandListHeader_struct CommandHeader; 4429 CommandListHeader_struct CommandHeader;
@@ -4571,14 +4570,13 @@ static int cciss_controller_hard_reset(struct pci_dev *pdev,
4571 return 0; 4570 return 0;
4572} 4571}
4573 4572
4574static __devinit void init_driver_version(char *driver_version, int len) 4573static void init_driver_version(char *driver_version, int len)
4575{ 4574{
4576 memset(driver_version, 0, len); 4575 memset(driver_version, 0, len);
4577 strncpy(driver_version, "cciss " DRIVER_NAME, len - 1); 4576 strncpy(driver_version, "cciss " DRIVER_NAME, len - 1);
4578} 4577}
4579 4578
4580static __devinit int write_driver_ver_to_cfgtable( 4579static int write_driver_ver_to_cfgtable(CfgTable_struct __iomem *cfgtable)
4581 CfgTable_struct __iomem *cfgtable)
4582{ 4580{
4583 char *driver_version; 4581 char *driver_version;
4584 int i, size = sizeof(cfgtable->driver_version); 4582 int i, size = sizeof(cfgtable->driver_version);
@@ -4594,8 +4592,8 @@ static __devinit int write_driver_ver_to_cfgtable(
4594 return 0; 4592 return 0;
4595} 4593}
4596 4594
4597static __devinit void read_driver_ver_from_cfgtable( 4595static void read_driver_ver_from_cfgtable(CfgTable_struct __iomem *cfgtable,
4598 CfgTable_struct __iomem *cfgtable, unsigned char *driver_ver) 4596 unsigned char *driver_ver)
4599{ 4597{
4600 int i; 4598 int i;
4601 4599
@@ -4603,8 +4601,7 @@ static __devinit void read_driver_ver_from_cfgtable(
4603 driver_ver[i] = readb(&cfgtable->driver_version[i]); 4601 driver_ver[i] = readb(&cfgtable->driver_version[i]);
4604} 4602}
4605 4603
4606static __devinit int controller_reset_failed( 4604static int controller_reset_failed(CfgTable_struct __iomem *cfgtable)
4607 CfgTable_struct __iomem *cfgtable)
4608{ 4605{
4609 4606
4610 char *driver_ver, *old_driver_ver; 4607 char *driver_ver, *old_driver_ver;
@@ -4627,7 +4624,7 @@ static __devinit int controller_reset_failed(
4627 4624
4628/* This does a hard reset of the controller using PCI power management 4625/* This does a hard reset of the controller using PCI power management
4629 * states or using the doorbell register. */ 4626 * states or using the doorbell register. */
4630static __devinit int cciss_kdump_hard_reset_controller(struct pci_dev *pdev) 4627static int cciss_kdump_hard_reset_controller(struct pci_dev *pdev)
4631{ 4628{
4632 u64 cfg_offset; 4629 u64 cfg_offset;
4633 u32 cfg_base_addr; 4630 u32 cfg_base_addr;
@@ -4772,7 +4769,7 @@ unmap_vaddr:
4772 return rc; 4769 return rc;
4773} 4770}
4774 4771
4775static __devinit int cciss_init_reset_devices(struct pci_dev *pdev) 4772static int cciss_init_reset_devices(struct pci_dev *pdev)
4776{ 4773{
4777 int rc, i; 4774 int rc, i;
4778 4775
@@ -4806,7 +4803,7 @@ static __devinit int cciss_init_reset_devices(struct pci_dev *pdev)
4806 return 0; 4803 return 0;
4807} 4804}
4808 4805
4809static __devinit int cciss_allocate_cmd_pool(ctlr_info_t *h) 4806static int cciss_allocate_cmd_pool(ctlr_info_t *h)
4810{ 4807{
4811 h->cmd_pool_bits = kmalloc(BITS_TO_LONGS(h->nr_cmds) * 4808 h->cmd_pool_bits = kmalloc(BITS_TO_LONGS(h->nr_cmds) *
4812 sizeof(unsigned long), GFP_KERNEL); 4809 sizeof(unsigned long), GFP_KERNEL);
@@ -4825,7 +4822,7 @@ static __devinit int cciss_allocate_cmd_pool(ctlr_info_t *h)
4825 return 0; 4822 return 0;
4826} 4823}
4827 4824
4828static __devinit int cciss_allocate_scatterlists(ctlr_info_t *h) 4825static int cciss_allocate_scatterlists(ctlr_info_t *h)
4829{ 4826{
4830 int i; 4827 int i;
4831 4828
@@ -4893,7 +4890,7 @@ static int cciss_request_irq(ctlr_info_t *h,
4893 return -1; 4890 return -1;
4894} 4891}
4895 4892
4896static int __devinit cciss_kdump_soft_reset(ctlr_info_t *h) 4893static int cciss_kdump_soft_reset(ctlr_info_t *h)
4897{ 4894{
4898 if (cciss_send_reset(h, CTLR_LUNID, CCISS_RESET_TYPE_CONTROLLER)) { 4895 if (cciss_send_reset(h, CTLR_LUNID, CCISS_RESET_TYPE_CONTROLLER)) {
4899 dev_warn(&h->pdev->dev, "Resetting array controller failed.\n"); 4896 dev_warn(&h->pdev->dev, "Resetting array controller failed.\n");
@@ -4952,8 +4949,7 @@ static void cciss_undo_allocations_after_kdump_soft_reset(ctlr_info_t *h)
4952 * stealing all these major device numbers. 4949 * stealing all these major device numbers.
4953 * returns the number of block devices registered. 4950 * returns the number of block devices registered.
4954 */ 4951 */
4955static int __devinit cciss_init_one(struct pci_dev *pdev, 4952static int cciss_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
4956 const struct pci_device_id *ent)
4957{ 4953{
4958 int i; 4954 int i;
4959 int j = 0; 4955 int j = 0;
@@ -5207,7 +5203,7 @@ static void cciss_shutdown(struct pci_dev *pdev)
5207 free_irq(h->intr[h->intr_mode], h); 5203 free_irq(h->intr[h->intr_mode], h);
5208} 5204}
5209 5205
5210static int __devinit cciss_enter_simple_mode(struct ctlr_info *h) 5206static int cciss_enter_simple_mode(struct ctlr_info *h)
5211{ 5207{
5212 u32 trans_support; 5208 u32 trans_support;
5213 5209
@@ -5229,7 +5225,7 @@ static int __devinit cciss_enter_simple_mode(struct ctlr_info *h)
5229} 5225}
5230 5226
5231 5227
5232static void __devexit cciss_remove_one(struct pci_dev *pdev) 5228static void cciss_remove_one(struct pci_dev *pdev)
5233{ 5229{
5234 ctlr_info_t *h; 5230 ctlr_info_t *h;
5235 int i, j; 5231 int i, j;
@@ -5308,7 +5304,7 @@ static void __devexit cciss_remove_one(struct pci_dev *pdev)
5308static struct pci_driver cciss_pci_driver = { 5304static struct pci_driver cciss_pci_driver = {
5309 .name = "cciss", 5305 .name = "cciss",
5310 .probe = cciss_init_one, 5306 .probe = cciss_init_one,
5311 .remove = __devexit_p(cciss_remove_one), 5307 .remove = cciss_remove_one,
5312 .id_table = cciss_pci_device_id, /* id_table */ 5308 .id_table = cciss_pci_device_id, /* id_table */
5313 .shutdown = cciss_shutdown, 5309 .shutdown = cciss_shutdown,
5314}; 5310};
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c
index 9125bbeacd4d..3f087133a25a 100644
--- a/drivers/block/cpqarray.c
+++ b/drivers/block/cpqarray.c
@@ -320,7 +320,7 @@ static void release_io_mem(ctlr_info_t *c)
320 c->io_mem_length = 0; 320 c->io_mem_length = 0;
321} 321}
322 322
323static void __devexit cpqarray_remove_one(int i) 323static void cpqarray_remove_one(int i)
324{ 324{
325 int j; 325 int j;
326 char buff[4]; 326 char buff[4];
@@ -352,7 +352,7 @@ static void __devexit cpqarray_remove_one(int i)
352 free_hba(i); 352 free_hba(i);
353} 353}
354 354
355static void __devexit cpqarray_remove_one_pci (struct pci_dev *pdev) 355static void cpqarray_remove_one_pci(struct pci_dev *pdev)
356{ 356{
357 int i; 357 int i;
358 ctlr_info_t *tmp_ptr; 358 ctlr_info_t *tmp_ptr;
@@ -377,7 +377,7 @@ static void __devexit cpqarray_remove_one_pci (struct pci_dev *pdev)
377/* removing an instance that was not removed automatically.. 377/* removing an instance that was not removed automatically..
378 * must be an eisa card. 378 * must be an eisa card.
379 */ 379 */
380static void __devexit cpqarray_remove_one_eisa (int i) 380static void cpqarray_remove_one_eisa(int i)
381{ 381{
382 if (hba[i] == NULL) { 382 if (hba[i] == NULL) {
383 printk(KERN_ERR "cpqarray: controller %d appears to have" 383 printk(KERN_ERR "cpqarray: controller %d appears to have"
@@ -388,7 +388,7 @@ static void __devexit cpqarray_remove_one_eisa (int i)
388} 388}
389 389
390/* pdev is NULL for eisa */ 390/* pdev is NULL for eisa */
391static int __devinit cpqarray_register_ctlr( int i, struct pci_dev *pdev) 391static int cpqarray_register_ctlr(int i, struct pci_dev *pdev)
392{ 392{
393 struct request_queue *q; 393 struct request_queue *q;
394 int j; 394 int j;
@@ -505,8 +505,8 @@ Enomem4:
505 return -1; 505 return -1;
506} 506}
507 507
508static int __devinit cpqarray_init_one( struct pci_dev *pdev, 508static int cpqarray_init_one(struct pci_dev *pdev,
509 const struct pci_device_id *ent) 509 const struct pci_device_id *ent)
510{ 510{
511 int i; 511 int i;
512 512
@@ -536,7 +536,7 @@ static int __devinit cpqarray_init_one( struct pci_dev *pdev,
536static struct pci_driver cpqarray_pci_driver = { 536static struct pci_driver cpqarray_pci_driver = {
537 .name = "cpqarray", 537 .name = "cpqarray",
538 .probe = cpqarray_init_one, 538 .probe = cpqarray_init_one,
539 .remove = __devexit_p(cpqarray_remove_one_pci), 539 .remove = cpqarray_remove_one_pci,
540 .id_table = cpqarray_pci_device_id, 540 .id_table = cpqarray_pci_device_id,
541}; 541};
542 542
@@ -742,7 +742,7 @@ __setup("smart2=", cpqarray_setup);
742/* 742/*
743 * Find an EISA controller's signature. Set up an hba if we find it. 743 * Find an EISA controller's signature. Set up an hba if we find it.
744 */ 744 */
745static int __devinit cpqarray_eisa_detect(void) 745static int cpqarray_eisa_detect(void)
746{ 746{
747 int i=0, j; 747 int i=0, j;
748 __u32 board_id; 748 __u32 board_id;
diff --git a/drivers/block/nvme.c b/drivers/block/nvme.c
index 931769e133e5..07fb2dfaae13 100644
--- a/drivers/block/nvme.c
+++ b/drivers/block/nvme.c
@@ -975,8 +975,8 @@ static int queue_request_irq(struct nvme_dev *dev, struct nvme_queue *nvmeq,
975 IRQF_DISABLED | IRQF_SHARED, name, nvmeq); 975 IRQF_DISABLED | IRQF_SHARED, name, nvmeq);
976} 976}
977 977
978static __devinit struct nvme_queue *nvme_create_queue(struct nvme_dev *dev, 978static struct nvme_queue *nvme_create_queue(struct nvme_dev *dev, int qid,
979 int qid, int cq_size, int vector) 979 int cq_size, int vector)
980{ 980{
981 int result; 981 int result;
982 struct nvme_queue *nvmeq = nvme_alloc_queue(dev, qid, cq_size, vector); 982 struct nvme_queue *nvmeq = nvme_alloc_queue(dev, qid, cq_size, vector);
@@ -1011,7 +1011,7 @@ static __devinit struct nvme_queue *nvme_create_queue(struct nvme_dev *dev,
1011 return ERR_PTR(result); 1011 return ERR_PTR(result);
1012} 1012}
1013 1013
1014static int __devinit nvme_configure_admin_queue(struct nvme_dev *dev) 1014static int nvme_configure_admin_queue(struct nvme_dev *dev)
1015{ 1015{
1016 int result = 0; 1016 int result = 0;
1017 u32 aqa; 1017 u32 aqa;
@@ -1408,7 +1408,7 @@ static int set_queue_count(struct nvme_dev *dev, int count)
1408 return min(result & 0xffff, result >> 16) + 1; 1408 return min(result & 0xffff, result >> 16) + 1;
1409} 1409}
1410 1410
1411static int __devinit nvme_setup_io_queues(struct nvme_dev *dev) 1411static int nvme_setup_io_queues(struct nvme_dev *dev)
1412{ 1412{
1413 int result, cpu, i, nr_io_queues, db_bar_size, q_depth; 1413 int result, cpu, i, nr_io_queues, db_bar_size, q_depth;
1414 1414
@@ -1481,7 +1481,7 @@ static void nvme_free_queues(struct nvme_dev *dev)
1481 nvme_free_queue(dev, i); 1481 nvme_free_queue(dev, i);
1482} 1482}
1483 1483
1484static int __devinit nvme_dev_add(struct nvme_dev *dev) 1484static int nvme_dev_add(struct nvme_dev *dev)
1485{ 1485{
1486 int res, nn, i; 1486 int res, nn, i;
1487 struct nvme_ns *ns, *next; 1487 struct nvme_ns *ns, *next;
@@ -1619,8 +1619,7 @@ static void nvme_release_instance(struct nvme_dev *dev)
1619 spin_unlock(&dev_list_lock); 1619 spin_unlock(&dev_list_lock);
1620} 1620}
1621 1621
1622static int __devinit nvme_probe(struct pci_dev *pdev, 1622static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1623 const struct pci_device_id *id)
1624{ 1623{
1625 int bars, result = -ENOMEM; 1624 int bars, result = -ENOMEM;
1626 struct nvme_dev *dev; 1625 struct nvme_dev *dev;
@@ -1702,7 +1701,7 @@ static int __devinit nvme_probe(struct pci_dev *pdev,
1702 return result; 1701 return result;
1703} 1702}
1704 1703
1705static void __devexit nvme_remove(struct pci_dev *pdev) 1704static void nvme_remove(struct pci_dev *pdev)
1706{ 1705{
1707 struct nvme_dev *dev = pci_get_drvdata(pdev); 1706 struct nvme_dev *dev = pci_get_drvdata(pdev);
1708 nvme_dev_remove(dev); 1707 nvme_dev_remove(dev);
@@ -1747,7 +1746,7 @@ static struct pci_driver nvme_driver = {
1747 .name = "nvme", 1746 .name = "nvme",
1748 .id_table = nvme_id_table, 1747 .id_table = nvme_id_table,
1749 .probe = nvme_probe, 1748 .probe = nvme_probe,
1750 .remove = __devexit_p(nvme_remove), 1749 .remove = nvme_remove,
1751 .suspend = nvme_suspend, 1750 .suspend = nvme_suspend,
1752 .resume = nvme_resume, 1751 .resume = nvme_resume,
1753 .err_handler = &nvme_err_handler, 1752 .err_handler = &nvme_err_handler,
diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c
index da0abc1838c1..d754a88d7585 100644
--- a/drivers/block/ps3disk.c
+++ b/drivers/block/ps3disk.c
@@ -401,7 +401,7 @@ static unsigned long ps3disk_mask;
401 401
402static DEFINE_MUTEX(ps3disk_mask_mutex); 402static DEFINE_MUTEX(ps3disk_mask_mutex);
403 403
404static int __devinit ps3disk_probe(struct ps3_system_bus_device *_dev) 404static int ps3disk_probe(struct ps3_system_bus_device *_dev)
405{ 405{
406 struct ps3_storage_device *dev = to_ps3_storage_device(&_dev->core); 406 struct ps3_storage_device *dev = to_ps3_storage_device(&_dev->core);
407 struct ps3disk_private *priv; 407 struct ps3disk_private *priv;
diff --git a/drivers/block/ps3vram.c b/drivers/block/ps3vram.c
index f58cdcfb305f..75e112d66006 100644
--- a/drivers/block/ps3vram.c
+++ b/drivers/block/ps3vram.c
@@ -536,7 +536,7 @@ static const struct file_operations ps3vram_proc_fops = {
536 .release = single_release, 536 .release = single_release,
537}; 537};
538 538
539static void __devinit ps3vram_proc_init(struct ps3_system_bus_device *dev) 539static void ps3vram_proc_init(struct ps3_system_bus_device *dev)
540{ 540{
541 struct ps3vram_priv *priv = ps3_system_bus_get_drvdata(dev); 541 struct ps3vram_priv *priv = ps3_system_bus_get_drvdata(dev);
542 struct proc_dir_entry *pde; 542 struct proc_dir_entry *pde;
@@ -618,7 +618,7 @@ static void ps3vram_make_request(struct request_queue *q, struct bio *bio)
618 } while (bio); 618 } while (bio);
619} 619}
620 620
621static int __devinit ps3vram_probe(struct ps3_system_bus_device *dev) 621static int ps3vram_probe(struct ps3_system_bus_device *dev)
622{ 622{
623 struct ps3vram_priv *priv; 623 struct ps3vram_priv *priv;
624 int error, status; 624 int error, status;
diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c
index 9dcf76a10bb6..564156a8e572 100644
--- a/drivers/block/sunvdc.c
+++ b/drivers/block/sunvdc.c
@@ -25,7 +25,7 @@
25#define DRV_MODULE_VERSION "1.0" 25#define DRV_MODULE_VERSION "1.0"
26#define DRV_MODULE_RELDATE "June 25, 2007" 26#define DRV_MODULE_RELDATE "June 25, 2007"
27 27
28static char version[] __devinitdata = 28static char version[] =
29 DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; 29 DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
30MODULE_AUTHOR("David S. Miller (davem@davemloft.net)"); 30MODULE_AUTHOR("David S. Miller (davem@davemloft.net)");
31MODULE_DESCRIPTION("Sun LDOM virtual disk client driver"); 31MODULE_DESCRIPTION("Sun LDOM virtual disk client driver");
@@ -592,7 +592,7 @@ static int generic_request(struct vdc_port *port, u8 op, void *buf, int len)
592 return err; 592 return err;
593} 593}
594 594
595static int __devinit vdc_alloc_tx_ring(struct vdc_port *port) 595static int vdc_alloc_tx_ring(struct vdc_port *port)
596{ 596{
597 struct vio_dring_state *dr = &port->vio.drings[VIO_DRIVER_TX_RING]; 597 struct vio_dring_state *dr = &port->vio.drings[VIO_DRIVER_TX_RING];
598 unsigned long len, entry_size; 598 unsigned long len, entry_size;
@@ -725,7 +725,7 @@ static struct vio_driver_ops vdc_vio_ops = {
725 .handshake_complete = vdc_handshake_complete, 725 .handshake_complete = vdc_handshake_complete,
726}; 726};
727 727
728static void __devinit print_version(void) 728static void print_version(void)
729{ 729{
730 static int version_printed; 730 static int version_printed;
731 731
@@ -733,8 +733,7 @@ static void __devinit print_version(void)
733 printk(KERN_INFO "%s", version); 733 printk(KERN_INFO "%s", version);
734} 734}
735 735
736static int __devinit vdc_port_probe(struct vio_dev *vdev, 736static int vdc_port_probe(struct vio_dev *vdev, const struct vio_device_id *id)
737 const struct vio_device_id *id)
738{ 737{
739 struct mdesc_handle *hp; 738 struct mdesc_handle *hp;
740 struct vdc_port *port; 739 struct vdc_port *port;
diff --git a/drivers/block/swim.c b/drivers/block/swim.c
index 6d5a914b9619..765fa2b3d337 100644
--- a/drivers/block/swim.c
+++ b/drivers/block/swim.c
@@ -788,8 +788,7 @@ static struct kobject *floppy_find(dev_t dev, int *part, void *data)
788 return get_disk(swd->unit[drive].disk); 788 return get_disk(swd->unit[drive].disk);
789} 789}
790 790
791static int __devinit swim_add_floppy(struct swim_priv *swd, 791static int swim_add_floppy(struct swim_priv *swd, enum drive_location location)
792 enum drive_location location)
793{ 792{
794 struct floppy_state *fs = &swd->unit[swd->floppy_count]; 793 struct floppy_state *fs = &swd->unit[swd->floppy_count];
795 struct swim __iomem *base = swd->base; 794 struct swim __iomem *base = swd->base;
@@ -812,7 +811,7 @@ static int __devinit swim_add_floppy(struct swim_priv *swd,
812 return 0; 811 return 0;
813} 812}
814 813
815static int __devinit swim_floppy_init(struct swim_priv *swd) 814static int swim_floppy_init(struct swim_priv *swd)
816{ 815{
817 int err; 816 int err;
818 int drive; 817 int drive;
@@ -875,7 +874,7 @@ exit_put_disks:
875 return err; 874 return err;
876} 875}
877 876
878static int __devinit swim_probe(struct platform_device *dev) 877static int swim_probe(struct platform_device *dev)
879{ 878{
880 struct resource *res; 879 struct resource *res;
881 struct swim __iomem *swim_base; 880 struct swim __iomem *swim_base;
@@ -936,7 +935,7 @@ out:
936 return ret; 935 return ret;
937} 936}
938 937
939static int __devexit swim_remove(struct platform_device *dev) 938static int swim_remove(struct platform_device *dev)
940{ 939{
941 struct swim_priv *swd = platform_get_drvdata(dev); 940 struct swim_priv *swd = platform_get_drvdata(dev);
942 int drive; 941 int drive;
@@ -972,7 +971,7 @@ static int __devexit swim_remove(struct platform_device *dev)
972 971
973static struct platform_driver swim_driver = { 972static struct platform_driver swim_driver = {
974 .probe = swim_probe, 973 .probe = swim_probe,
975 .remove = __devexit_p(swim_remove), 974 .remove = swim_remove,
976 .driver = { 975 .driver = {
977 .name = CARDNAME, 976 .name = CARDNAME,
978 .owner = THIS_MODULE, 977 .owner = THIS_MODULE,
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c
index 89ddab127e33..57763c54363a 100644
--- a/drivers/block/swim3.c
+++ b/drivers/block/swim3.c
@@ -1194,7 +1194,8 @@ static int swim3_add_device(struct macio_dev *mdev, int index)
1194 return rc; 1194 return rc;
1195} 1195}
1196 1196
1197static int __devinit swim3_attach(struct macio_dev *mdev, const struct of_device_id *match) 1197static int swim3_attach(struct macio_dev *mdev,
1198 const struct of_device_id *match)
1198{ 1199{
1199 struct gendisk *disk; 1200 struct gendisk *disk;
1200 int index, rc; 1201 int index, rc;
diff --git a/drivers/block/umem.c b/drivers/block/umem.c
index eb0d8216f557..ad70868f8a96 100644
--- a/drivers/block/umem.c
+++ b/drivers/block/umem.c
@@ -789,8 +789,7 @@ static const struct block_device_operations mm_fops = {
789 .revalidate_disk = mm_revalidate, 789 .revalidate_disk = mm_revalidate,
790}; 790};
791 791
792static int __devinit mm_pci_probe(struct pci_dev *dev, 792static int mm_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
793 const struct pci_device_id *id)
794{ 793{
795 int ret = -ENODEV; 794 int ret = -ENODEV;
796 struct cardinfo *card = &cards[num_cards]; 795 struct cardinfo *card = &cards[num_cards];
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 0bdde8fba397..8ad21a25bc0d 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -696,7 +696,7 @@ static const struct device_attribute dev_attr_cache_type_rw =
696 __ATTR(cache_type, S_IRUGO|S_IWUSR, 696 __ATTR(cache_type, S_IRUGO|S_IWUSR,
697 virtblk_cache_type_show, virtblk_cache_type_store); 697 virtblk_cache_type_show, virtblk_cache_type_store);
698 698
699static int __devinit virtblk_probe(struct virtio_device *vdev) 699static int virtblk_probe(struct virtio_device *vdev)
700{ 700{
701 struct virtio_blk *vblk; 701 struct virtio_blk *vblk;
702 struct request_queue *q; 702 struct request_queue *q;
@@ -885,10 +885,11 @@ out:
885 return err; 885 return err;
886} 886}
887 887
888static void __devexit virtblk_remove(struct virtio_device *vdev) 888static void virtblk_remove(struct virtio_device *vdev)
889{ 889{
890 struct virtio_blk *vblk = vdev->priv; 890 struct virtio_blk *vblk = vdev->priv;
891 int index = vblk->index; 891 int index = vblk->index;
892 int refc;
892 893
893 /* Prevent config work handler from accessing the device. */ 894 /* Prevent config work handler from accessing the device. */
894 mutex_lock(&vblk->config_lock); 895 mutex_lock(&vblk->config_lock);
@@ -903,11 +904,15 @@ static void __devexit virtblk_remove(struct virtio_device *vdev)
903 904
904 flush_work(&vblk->config_work); 905 flush_work(&vblk->config_work);
905 906
907 refc = atomic_read(&disk_to_dev(vblk->disk)->kobj.kref.refcount);
906 put_disk(vblk->disk); 908 put_disk(vblk->disk);
907 mempool_destroy(vblk->pool); 909 mempool_destroy(vblk->pool);
908 vdev->config->del_vqs(vdev); 910 vdev->config->del_vqs(vdev);
909 kfree(vblk); 911 kfree(vblk);
910 ida_simple_remove(&vd_index_ida, index); 912
913 /* Only free device id if we don't have any users */
914 if (refc == 1)
915 ida_simple_remove(&vd_index_ida, index);
911} 916}
912 917
913#ifdef CONFIG_PM 918#ifdef CONFIG_PM
@@ -961,19 +966,14 @@ static unsigned int features[] = {
961 VIRTIO_BLK_F_WCE, VIRTIO_BLK_F_TOPOLOGY, VIRTIO_BLK_F_CONFIG_WCE 966 VIRTIO_BLK_F_WCE, VIRTIO_BLK_F_TOPOLOGY, VIRTIO_BLK_F_CONFIG_WCE
962}; 967};
963 968
964/* 969static struct virtio_driver virtio_blk = {
965 * virtio_blk causes spurious section mismatch warning by
966 * simultaneously referring to a __devinit and a __devexit function.
967 * Use __refdata to avoid this warning.
968 */
969static struct virtio_driver __refdata virtio_blk = {
970 .feature_table = features, 970 .feature_table = features,
971 .feature_table_size = ARRAY_SIZE(features), 971 .feature_table_size = ARRAY_SIZE(features),
972 .driver.name = KBUILD_MODNAME, 972 .driver.name = KBUILD_MODNAME,
973 .driver.owner = THIS_MODULE, 973 .driver.owner = THIS_MODULE,
974 .id_table = id_table, 974 .id_table = id_table,
975 .probe = virtblk_probe, 975 .probe = virtblk_probe,
976 .remove = __devexit_p(virtblk_remove), 976 .remove = virtblk_remove,
977 .config_changed = virtblk_config_changed, 977 .config_changed = virtblk_config_changed,
978#ifdef CONFIG_PM 978#ifdef CONFIG_PM
979 .freeze = virtblk_freeze, 979 .freeze = virtblk_freeze,
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
index 1a17e338735e..1f38643173ca 100644
--- a/drivers/block/xsysace.c
+++ b/drivers/block/xsysace.c
@@ -961,7 +961,7 @@ static const struct block_device_operations ace_fops = {
961/* -------------------------------------------------------------------- 961/* --------------------------------------------------------------------
962 * SystemACE device setup/teardown code 962 * SystemACE device setup/teardown code
963 */ 963 */
964static int __devinit ace_setup(struct ace_device *ace) 964static int ace_setup(struct ace_device *ace)
965{ 965{
966 u16 version; 966 u16 version;
967 u16 val; 967 u16 val;
@@ -1074,7 +1074,7 @@ err_ioremap:
1074 return -ENOMEM; 1074 return -ENOMEM;
1075} 1075}
1076 1076
1077static void __devexit ace_teardown(struct ace_device *ace) 1077static void ace_teardown(struct ace_device *ace)
1078{ 1078{
1079 if (ace->gd) { 1079 if (ace->gd) {
1080 del_gendisk(ace->gd); 1080 del_gendisk(ace->gd);
@@ -1092,9 +1092,8 @@ static void __devexit ace_teardown(struct ace_device *ace)
1092 iounmap(ace->baseaddr); 1092 iounmap(ace->baseaddr);
1093} 1093}
1094 1094
1095static int __devinit 1095static int ace_alloc(struct device *dev, int id, resource_size_t physaddr,
1096ace_alloc(struct device *dev, int id, resource_size_t physaddr, 1096 int irq, int bus_width)
1097 int irq, int bus_width)
1098{ 1097{
1099 struct ace_device *ace; 1098 struct ace_device *ace;
1100 int rc; 1099 int rc;
@@ -1135,7 +1134,7 @@ err_noreg:
1135 return rc; 1134 return rc;
1136} 1135}
1137 1136
1138static void __devexit ace_free(struct device *dev) 1137static void ace_free(struct device *dev)
1139{ 1138{
1140 struct ace_device *ace = dev_get_drvdata(dev); 1139 struct ace_device *ace = dev_get_drvdata(dev);
1141 dev_dbg(dev, "ace_free(%p)\n", dev); 1140 dev_dbg(dev, "ace_free(%p)\n", dev);
@@ -1151,7 +1150,7 @@ static void __devexit ace_free(struct device *dev)
1151 * Platform Bus Support 1150 * Platform Bus Support
1152 */ 1151 */
1153 1152
1154static int __devinit ace_probe(struct platform_device *dev) 1153static int ace_probe(struct platform_device *dev)
1155{ 1154{
1156 resource_size_t physaddr = 0; 1155 resource_size_t physaddr = 0;
1157 int bus_width = ACE_BUS_WIDTH_16; /* FIXME: should not be hard coded */ 1156 int bus_width = ACE_BUS_WIDTH_16; /* FIXME: should not be hard coded */
@@ -1182,7 +1181,7 @@ static int __devinit ace_probe(struct platform_device *dev)
1182/* 1181/*
1183 * Platform bus remove() method 1182 * Platform bus remove() method
1184 */ 1183 */
1185static int __devexit ace_remove(struct platform_device *dev) 1184static int ace_remove(struct platform_device *dev)
1186{ 1185{
1187 ace_free(&dev->dev); 1186 ace_free(&dev->dev);
1188 return 0; 1187 return 0;
@@ -1190,7 +1189,7 @@ static int __devexit ace_remove(struct platform_device *dev)
1190 1189
1191#if defined(CONFIG_OF) 1190#if defined(CONFIG_OF)
1192/* Match table for of_platform binding */ 1191/* Match table for of_platform binding */
1193static const struct of_device_id ace_of_match[] __devinitconst = { 1192static const struct of_device_id ace_of_match[] = {
1194 { .compatible = "xlnx,opb-sysace-1.00.b", }, 1193 { .compatible = "xlnx,opb-sysace-1.00.b", },
1195 { .compatible = "xlnx,opb-sysace-1.00.c", }, 1194 { .compatible = "xlnx,opb-sysace-1.00.c", },
1196 { .compatible = "xlnx,xps-sysace-1.00.a", }, 1195 { .compatible = "xlnx,xps-sysace-1.00.a", },
@@ -1204,7 +1203,7 @@ MODULE_DEVICE_TABLE(of, ace_of_match);
1204 1203
1205static struct platform_driver ace_platform_driver = { 1204static struct platform_driver ace_platform_driver = {
1206 .probe = ace_probe, 1205 .probe = ace_probe,
1207 .remove = __devexit_p(ace_remove), 1206 .remove = ace_remove,
1208 .driver = { 1207 .driver = {
1209 .owner = THIS_MODULE, 1208 .owner = THIS_MODULE,
1210 .name = "xsysace", 1209 .name = "xsysace",
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index b00000e8aef6..33c9a44a9678 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -77,10 +77,15 @@ static struct usb_device_id ath3k_table[] = {
77 { USB_DEVICE(0x0CF3, 0x311D) }, 77 { USB_DEVICE(0x0CF3, 0x311D) },
78 { USB_DEVICE(0x13d3, 0x3375) }, 78 { USB_DEVICE(0x13d3, 0x3375) },
79 { USB_DEVICE(0x04CA, 0x3005) }, 79 { USB_DEVICE(0x04CA, 0x3005) },
80 { USB_DEVICE(0x04CA, 0x3006) },
81 { USB_DEVICE(0x04CA, 0x3008) },
80 { USB_DEVICE(0x13d3, 0x3362) }, 82 { USB_DEVICE(0x13d3, 0x3362) },
81 { USB_DEVICE(0x0CF3, 0xE004) }, 83 { USB_DEVICE(0x0CF3, 0xE004) },
82 { USB_DEVICE(0x0930, 0x0219) }, 84 { USB_DEVICE(0x0930, 0x0219) },
83 { USB_DEVICE(0x0489, 0xe057) }, 85 { USB_DEVICE(0x0489, 0xe057) },
86 { USB_DEVICE(0x13d3, 0x3393) },
87 { USB_DEVICE(0x0489, 0xe04e) },
88 { USB_DEVICE(0x0489, 0xe056) },
84 89
85 /* Atheros AR5BBU12 with sflash firmware */ 90 /* Atheros AR5BBU12 with sflash firmware */
86 { USB_DEVICE(0x0489, 0xE02C) }, 91 { USB_DEVICE(0x0489, 0xE02C) },
@@ -104,10 +109,15 @@ static struct usb_device_id ath3k_blist_tbl[] = {
104 { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 }, 109 { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 },
105 { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, 110 { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 },
106 { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, 111 { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 },
112 { USB_DEVICE(0x04ca, 0x3006), .driver_info = BTUSB_ATH3012 },
113 { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 },
107 { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, 114 { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 },
108 { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, 115 { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 },
109 { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, 116 { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 },
110 { USB_DEVICE(0x0489, 0xe057), .driver_info = BTUSB_ATH3012 }, 117 { USB_DEVICE(0x0489, 0xe057), .driver_info = BTUSB_ATH3012 },
118 { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 },
119 { USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 },
120 { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 },
111 121
112 /* Atheros AR5BBU22 with sflash firmware */ 122 /* Atheros AR5BBU22 with sflash firmware */
113 { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 }, 123 { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 },
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index a1d4ede5b892..7e351e345476 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -135,10 +135,15 @@ static struct usb_device_id blacklist_table[] = {
135 { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, 135 { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 },
136 { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, 136 { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 },
137 { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, 137 { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 },
138 { USB_DEVICE(0x04ca, 0x3006), .driver_info = BTUSB_ATH3012 },
139 { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 },
138 { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, 140 { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 },
139 { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, 141 { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 },
140 { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, 142 { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 },
141 { USB_DEVICE(0x0489, 0xe057), .driver_info = BTUSB_ATH3012 }, 143 { USB_DEVICE(0x0489, 0xe057), .driver_info = BTUSB_ATH3012 },
144 { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 },
145 { USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 },
146 { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 },
142 147
143 /* Atheros AR5BBU12 with sflash firmware */ 148 /* Atheros AR5BBU12 with sflash firmware */
144 { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, 149 { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE },
diff --git a/drivers/bus/omap-ocp2scp.c b/drivers/bus/omap-ocp2scp.c
index 0c48b0e05ed6..fe7191663bbd 100644
--- a/drivers/bus/omap-ocp2scp.c
+++ b/drivers/bus/omap-ocp2scp.c
@@ -52,7 +52,7 @@ static int ocp2scp_remove_devices(struct device *dev, void *c)
52 return 0; 52 return 0;
53} 53}
54 54
55static int __devinit omap_ocp2scp_probe(struct platform_device *pdev) 55static int omap_ocp2scp_probe(struct platform_device *pdev)
56{ 56{
57 int ret; 57 int ret;
58 unsigned res_cnt, i; 58 unsigned res_cnt, i;
@@ -116,7 +116,7 @@ err0:
116 return ret; 116 return ret;
117} 117}
118 118
119static int __devexit omap_ocp2scp_remove(struct platform_device *pdev) 119static int omap_ocp2scp_remove(struct platform_device *pdev)
120{ 120{
121 pm_runtime_disable(&pdev->dev); 121 pm_runtime_disable(&pdev->dev);
122 device_for_each_child(&pdev->dev, NULL, ocp2scp_remove_devices); 122 device_for_each_child(&pdev->dev, NULL, ocp2scp_remove_devices);
@@ -134,7 +134,7 @@ MODULE_DEVICE_TABLE(of, omap_ocp2scp_id_table);
134 134
135static struct platform_driver omap_ocp2scp_driver = { 135static struct platform_driver omap_ocp2scp_driver = {
136 .probe = omap_ocp2scp_probe, 136 .probe = omap_ocp2scp_probe,
137 .remove = __devexit_p(omap_ocp2scp_remove), 137 .remove = omap_ocp2scp_remove,
138 .driver = { 138 .driver = {
139 .name = "omap-ocp2scp", 139 .name = "omap-ocp2scp",
140 .owner = THIS_MODULE, 140 .owner = THIS_MODULE,
diff --git a/drivers/bus/omap_l3_noc.c b/drivers/bus/omap_l3_noc.c
index ab911a33f8a8..feeecae623f6 100644
--- a/drivers/bus/omap_l3_noc.c
+++ b/drivers/bus/omap_l3_noc.c
@@ -128,7 +128,7 @@ static irqreturn_t l3_interrupt_handler(int irq, void *_l3)
128 return IRQ_HANDLED; 128 return IRQ_HANDLED;
129} 129}
130 130
131static int __devinit omap4_l3_probe(struct platform_device *pdev) 131static int omap4_l3_probe(struct platform_device *pdev)
132{ 132{
133 static struct omap4_l3 *l3; 133 static struct omap4_l3 *l3;
134 struct resource *res; 134 struct resource *res;
@@ -219,7 +219,7 @@ err0:
219 return ret; 219 return ret;
220} 220}
221 221
222static int __devexit omap4_l3_remove(struct platform_device *pdev) 222static int omap4_l3_remove(struct platform_device *pdev)
223{ 223{
224 struct omap4_l3 *l3 = platform_get_drvdata(pdev); 224 struct omap4_l3 *l3 = platform_get_drvdata(pdev);
225 225
@@ -245,7 +245,7 @@ MODULE_DEVICE_TABLE(of, l3_noc_match);
245 245
246static struct platform_driver omap4_l3_driver = { 246static struct platform_driver omap4_l3_driver = {
247 .probe = omap4_l3_probe, 247 .probe = omap4_l3_probe,
248 .remove = __devexit_p(omap4_l3_remove), 248 .remove = omap4_l3_remove,
249 .driver = { 249 .driver = {
250 .name = "omap_l3_noc", 250 .name = "omap_l3_noc",
251 .owner = THIS_MODULE, 251 .owner = THIS_MODULE,
diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c
index 75d485afe56c..d59cdcb8fe39 100644
--- a/drivers/cdrom/gdrom.c
+++ b/drivers/cdrom/gdrom.c
@@ -557,7 +557,7 @@ static irqreturn_t gdrom_dma_interrupt(int irq, void *dev_id)
557 return IRQ_HANDLED; 557 return IRQ_HANDLED;
558} 558}
559 559
560static int __devinit gdrom_set_interrupt_handlers(void) 560static int gdrom_set_interrupt_handlers(void)
561{ 561{
562 int err; 562 int err;
563 563
@@ -681,7 +681,7 @@ static void gdrom_request(struct request_queue *rq)
681} 681}
682 682
683/* Print string identifying GD ROM device */ 683/* Print string identifying GD ROM device */
684static int __devinit gdrom_outputversion(void) 684static int gdrom_outputversion(void)
685{ 685{
686 struct gdrom_id *id; 686 struct gdrom_id *id;
687 char *model_name, *manuf_name, *firmw_ver; 687 char *model_name, *manuf_name, *firmw_ver;
@@ -715,7 +715,7 @@ free_id:
715} 715}
716 716
717/* set the default mode for DMA transfer */ 717/* set the default mode for DMA transfer */
718static int __devinit gdrom_init_dma_mode(void) 718static int gdrom_init_dma_mode(void)
719{ 719{
720 __raw_writeb(0x13, GDROM_ERROR_REG); 720 __raw_writeb(0x13, GDROM_ERROR_REG);
721 __raw_writeb(0x22, GDROM_INTSEC_REG); 721 __raw_writeb(0x22, GDROM_INTSEC_REG);
@@ -736,7 +736,7 @@ static int __devinit gdrom_init_dma_mode(void)
736 return 0; 736 return 0;
737} 737}
738 738
739static void __devinit probe_gdrom_setupcd(void) 739static void probe_gdrom_setupcd(void)
740{ 740{
741 gd.cd_info->ops = &gdrom_ops; 741 gd.cd_info->ops = &gdrom_ops;
742 gd.cd_info->capacity = 1; 742 gd.cd_info->capacity = 1;
@@ -745,7 +745,7 @@ static void __devinit probe_gdrom_setupcd(void)
745 CDC_SELECT_DISC; 745 CDC_SELECT_DISC;
746} 746}
747 747
748static void __devinit probe_gdrom_setupdisk(void) 748static void probe_gdrom_setupdisk(void)
749{ 749{
750 gd.disk->major = gdrom_major; 750 gd.disk->major = gdrom_major;
751 gd.disk->first_minor = 1; 751 gd.disk->first_minor = 1;
@@ -753,7 +753,7 @@ static void __devinit probe_gdrom_setupdisk(void)
753 strcpy(gd.disk->disk_name, GDROM_DEV_NAME); 753 strcpy(gd.disk->disk_name, GDROM_DEV_NAME);
754} 754}
755 755
756static int __devinit probe_gdrom_setupqueue(void) 756static int probe_gdrom_setupqueue(void)
757{ 757{
758 blk_queue_logical_block_size(gd.gdrom_rq, GDROM_HARD_SECTOR); 758 blk_queue_logical_block_size(gd.gdrom_rq, GDROM_HARD_SECTOR);
759 /* using DMA so memory will need to be contiguous */ 759 /* using DMA so memory will need to be contiguous */
@@ -768,7 +768,7 @@ static int __devinit probe_gdrom_setupqueue(void)
768 * register this as a block device and as compliant with the 768 * register this as a block device and as compliant with the
769 * universal CD Rom driver interface 769 * universal CD Rom driver interface
770 */ 770 */
771static int __devinit probe_gdrom(struct platform_device *devptr) 771static int probe_gdrom(struct platform_device *devptr)
772{ 772{
773 int err; 773 int err;
774 /* Start the device */ 774 /* Start the device */
@@ -838,7 +838,7 @@ probe_fail_no_mem:
838 return err; 838 return err;
839} 839}
840 840
841static int __devexit remove_gdrom(struct platform_device *devptr) 841static int remove_gdrom(struct platform_device *devptr)
842{ 842{
843 flush_work(&work); 843 flush_work(&work);
844 blk_cleanup_queue(gd.gdrom_rq); 844 blk_cleanup_queue(gd.gdrom_rq);
@@ -854,7 +854,7 @@ static int __devexit remove_gdrom(struct platform_device *devptr)
854 854
855static struct platform_driver gdrom_driver = { 855static struct platform_driver gdrom_driver = {
856 .probe = probe_gdrom, 856 .probe = probe_gdrom,
857 .remove = __devexit_p(remove_gdrom), 857 .remove = remove_gdrom,
858 .driver = { 858 .driver = {
859 .name = GDROM_DEV_NAME, 859 .name = GDROM_DEV_NAME,
860 }, 860 },
diff --git a/drivers/char/agp/ali-agp.c b/drivers/char/agp/ali-agp.c
index 478493543b32..443cd6751ca2 100644
--- a/drivers/char/agp/ali-agp.c
+++ b/drivers/char/agp/ali-agp.c
@@ -299,8 +299,7 @@ static struct agp_device_ids ali_agp_device_ids[] =
299 { }, /* dummy final entry, always present */ 299 { }, /* dummy final entry, always present */
300}; 300};
301 301
302static int __devinit agp_ali_probe(struct pci_dev *pdev, 302static int agp_ali_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
303 const struct pci_device_id *ent)
304{ 303{
305 struct agp_device_ids *devs = ali_agp_device_ids; 304 struct agp_device_ids *devs = ali_agp_device_ids;
306 struct agp_bridge_data *bridge; 305 struct agp_bridge_data *bridge;
diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c
index 1b2101160e98..779f0ab845a9 100644
--- a/drivers/char/agp/amd-k7-agp.c
+++ b/drivers/char/agp/amd-k7-agp.c
@@ -405,8 +405,8 @@ static struct agp_device_ids amd_agp_device_ids[] =
405 { }, /* dummy final entry, always present */ 405 { }, /* dummy final entry, always present */
406}; 406};
407 407
408static int __devinit agp_amdk7_probe(struct pci_dev *pdev, 408static int agp_amdk7_probe(struct pci_dev *pdev,
409 const struct pci_device_id *ent) 409 const struct pci_device_id *ent)
410{ 410{
411 struct agp_bridge_data *bridge; 411 struct agp_bridge_data *bridge;
412 u8 cap_ptr; 412 u8 cap_ptr;
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
index 061d46209b1a..d79d692d05b8 100644
--- a/drivers/char/agp/amd64-agp.c
+++ b/drivers/char/agp/amd64-agp.c
@@ -240,7 +240,7 @@ static const struct agp_bridge_driver amd_8151_driver = {
240}; 240};
241 241
242/* Some basic sanity checks for the aperture. */ 242/* Some basic sanity checks for the aperture. */
243static int __devinit agp_aperture_valid(u64 aper, u32 size) 243static int agp_aperture_valid(u64 aper, u32 size)
244{ 244{
245 if (!aperture_valid(aper, size, 32*1024*1024)) 245 if (!aperture_valid(aper, size, 32*1024*1024))
246 return 0; 246 return 0;
@@ -267,8 +267,7 @@ static int __devinit agp_aperture_valid(u64 aper, u32 size)
267 * to allocate that much memory. But at least error out cleanly instead of 267 * to allocate that much memory. But at least error out cleanly instead of
268 * crashing. 268 * crashing.
269 */ 269 */
270static __devinit int fix_northbridge(struct pci_dev *nb, struct pci_dev *agp, 270static int fix_northbridge(struct pci_dev *nb, struct pci_dev *agp, u16 cap)
271 u16 cap)
272{ 271{
273 u32 aper_low, aper_hi; 272 u32 aper_low, aper_hi;
274 u64 aper, nb_aper; 273 u64 aper, nb_aper;
@@ -326,7 +325,7 @@ static __devinit int fix_northbridge(struct pci_dev *nb, struct pci_dev *agp,
326 return 0; 325 return 0;
327} 326}
328 327
329static __devinit int cache_nbs(struct pci_dev *pdev, u32 cap_ptr) 328static int cache_nbs(struct pci_dev *pdev, u32 cap_ptr)
330{ 329{
331 int i; 330 int i;
332 331
@@ -352,7 +351,7 @@ static __devinit int cache_nbs(struct pci_dev *pdev, u32 cap_ptr)
352} 351}
353 352
354/* Handle AMD 8151 quirks */ 353/* Handle AMD 8151 quirks */
355static void __devinit amd8151_init(struct pci_dev *pdev, struct agp_bridge_data *bridge) 354static void amd8151_init(struct pci_dev *pdev, struct agp_bridge_data *bridge)
356{ 355{
357 char *revstring; 356 char *revstring;
358 357
@@ -390,7 +389,7 @@ static const struct aper_size_info_32 uli_sizes[7] =
390 {8, 2048, 1, 4}, 389 {8, 2048, 1, 4},
391 {4, 1024, 0, 3} 390 {4, 1024, 0, 3}
392}; 391};
393static int __devinit uli_agp_init(struct pci_dev *pdev) 392static int uli_agp_init(struct pci_dev *pdev)
394{ 393{
395 u32 httfea,baseaddr,enuscr; 394 u32 httfea,baseaddr,enuscr;
396 struct pci_dev *dev1; 395 struct pci_dev *dev1;
@@ -513,8 +512,8 @@ put:
513 return ret; 512 return ret;
514} 513}
515 514
516static int __devinit agp_amd64_probe(struct pci_dev *pdev, 515static int agp_amd64_probe(struct pci_dev *pdev,
517 const struct pci_device_id *ent) 516 const struct pci_device_id *ent)
518{ 517{
519 struct agp_bridge_data *bridge; 518 struct agp_bridge_data *bridge;
520 u8 cap_ptr; 519 u8 cap_ptr;
diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c
index ed0433576e74..0628d7b65c71 100644
--- a/drivers/char/agp/ati-agp.c
+++ b/drivers/char/agp/ati-agp.c
@@ -490,8 +490,7 @@ static struct agp_device_ids ati_agp_device_ids[] =
490 { }, /* dummy final entry, always present */ 490 { }, /* dummy final entry, always present */
491}; 491};
492 492
493static int __devinit agp_ati_probe(struct pci_dev *pdev, 493static int agp_ati_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
494 const struct pci_device_id *ent)
495{ 494{
496 struct agp_device_ids *devs = ati_agp_device_ids; 495 struct agp_device_ids *devs = ati_agp_device_ids;
497 struct agp_bridge_data *bridge; 496 struct agp_bridge_data *bridge;
diff --git a/drivers/char/agp/efficeon-agp.c b/drivers/char/agp/efficeon-agp.c
index 55f3e33a309f..6974d5032053 100644
--- a/drivers/char/agp/efficeon-agp.c
+++ b/drivers/char/agp/efficeon-agp.c
@@ -343,8 +343,8 @@ static const struct agp_bridge_driver efficeon_driver = {
343 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 343 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
344}; 344};
345 345
346static int __devinit agp_efficeon_probe(struct pci_dev *pdev, 346static int agp_efficeon_probe(struct pci_dev *pdev,
347 const struct pci_device_id *ent) 347 const struct pci_device_id *ent)
348{ 348{
349 struct agp_bridge_data *bridge; 349 struct agp_bridge_data *bridge;
350 u8 cap_ptr; 350 u8 cap_ptr;
diff --git a/drivers/char/agp/i460-agp.c b/drivers/char/agp/i460-agp.c
index d328b662e50d..15b240ea4848 100644
--- a/drivers/char/agp/i460-agp.c
+++ b/drivers/char/agp/i460-agp.c
@@ -587,8 +587,8 @@ const struct agp_bridge_driver intel_i460_driver = {
587 .cant_use_aperture = true, 587 .cant_use_aperture = true,
588}; 588};
589 589
590static int __devinit agp_intel_i460_probe(struct pci_dev *pdev, 590static int agp_intel_i460_probe(struct pci_dev *pdev,
591 const struct pci_device_id *ent) 591 const struct pci_device_id *ent)
592{ 592{
593 struct agp_bridge_data *bridge; 593 struct agp_bridge_data *bridge;
594 u8 cap_ptr; 594 u8 cap_ptr;
@@ -637,7 +637,7 @@ static struct pci_driver agp_intel_i460_pci_driver = {
637 .name = "agpgart-intel-i460", 637 .name = "agpgart-intel-i460",
638 .id_table = agp_intel_i460_pci_table, 638 .id_table = agp_intel_i460_pci_table,
639 .probe = agp_intel_i460_probe, 639 .probe = agp_intel_i460_probe,
640 .remove = __devexit_p(agp_intel_i460_remove), 640 .remove = agp_intel_i460_remove,
641}; 641};
642 642
643static int __init agp_intel_i460_init(void) 643static int __init agp_intel_i460_init(void)
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index f3a8f52b5a00..a426ee1f57a6 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -732,8 +732,8 @@ static const struct intel_agp_driver_description {
732 { 0, NULL, NULL } 732 { 0, NULL, NULL }
733}; 733};
734 734
735static int __devinit agp_intel_probe(struct pci_dev *pdev, 735static int agp_intel_probe(struct pci_dev *pdev,
736 const struct pci_device_id *ent) 736 const struct pci_device_id *ent)
737{ 737{
738 struct agp_bridge_data *bridge; 738 struct agp_bridge_data *bridge;
739 u8 cap_ptr = 0; 739 u8 cap_ptr = 0;
@@ -912,7 +912,7 @@ static struct pci_driver agp_intel_pci_driver = {
912 .name = "agpgart-intel", 912 .name = "agpgart-intel",
913 .id_table = agp_intel_pci_table, 913 .id_table = agp_intel_pci_table,
914 .probe = agp_intel_probe, 914 .probe = agp_intel_probe,
915 .remove = __devexit_p(agp_intel_remove), 915 .remove = agp_intel_remove,
916#ifdef CONFIG_PM 916#ifdef CONFIG_PM
917 .resume = agp_intel_resume, 917 .resume = agp_intel_resume,
918#endif 918#endif
diff --git a/drivers/char/agp/nvidia-agp.c b/drivers/char/agp/nvidia-agp.c
index 66e0868000f4..62be3ec0da4b 100644
--- a/drivers/char/agp/nvidia-agp.c
+++ b/drivers/char/agp/nvidia-agp.c
@@ -332,8 +332,8 @@ static const struct agp_bridge_driver nvidia_driver = {
332 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 332 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
333}; 333};
334 334
335static int __devinit agp_nvidia_probe(struct pci_dev *pdev, 335static int agp_nvidia_probe(struct pci_dev *pdev,
336 const struct pci_device_id *ent) 336 const struct pci_device_id *ent)
337{ 337{
338 struct agp_bridge_data *bridge; 338 struct agp_bridge_data *bridge;
339 u8 cap_ptr; 339 u8 cap_ptr;
diff --git a/drivers/char/agp/sgi-agp.c b/drivers/char/agp/sgi-agp.c
index a18791d7718a..05b8d0241bde 100644
--- a/drivers/char/agp/sgi-agp.c
+++ b/drivers/char/agp/sgi-agp.c
@@ -270,7 +270,7 @@ const struct agp_bridge_driver sgi_tioca_driver = {
270 .num_aperture_sizes = 1, 270 .num_aperture_sizes = 1,
271}; 271};
272 272
273static int __devinit agp_sgi_init(void) 273static int agp_sgi_init(void)
274{ 274{
275 unsigned int j; 275 unsigned int j;
276 struct tioca_kernel *info; 276 struct tioca_kernel *info;
diff --git a/drivers/char/agp/sis-agp.c b/drivers/char/agp/sis-agp.c
index 93d1d31f9d0c..79c838c434bc 100644
--- a/drivers/char/agp/sis-agp.c
+++ b/drivers/char/agp/sis-agp.c
@@ -154,7 +154,7 @@ static int sis_broken_chipsets[] = {
154 0 // terminator 154 0 // terminator
155}; 155};
156 156
157static void __devinit sis_get_driver(struct agp_bridge_data *bridge) 157static void sis_get_driver(struct agp_bridge_data *bridge)
158{ 158{
159 int i; 159 int i;
160 160
@@ -180,8 +180,7 @@ static void __devinit sis_get_driver(struct agp_bridge_data *bridge)
180} 180}
181 181
182 182
183static int __devinit agp_sis_probe(struct pci_dev *pdev, 183static int agp_sis_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
184 const struct pci_device_id *ent)
185{ 184{
186 struct agp_bridge_data *bridge; 185 struct agp_bridge_data *bridge;
187 u8 cap_ptr; 186 u8 cap_ptr;
diff --git a/drivers/char/agp/sworks-agp.c b/drivers/char/agp/sworks-agp.c
index 26020fb8d7a9..9b163b49d976 100644
--- a/drivers/char/agp/sworks-agp.c
+++ b/drivers/char/agp/sworks-agp.c
@@ -445,8 +445,8 @@ static const struct agp_bridge_driver sworks_driver = {
445 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 445 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
446}; 446};
447 447
448static int __devinit agp_serverworks_probe(struct pci_dev *pdev, 448static int agp_serverworks_probe(struct pci_dev *pdev,
449 const struct pci_device_id *ent) 449 const struct pci_device_id *ent)
450{ 450{
451 struct agp_bridge_data *bridge; 451 struct agp_bridge_data *bridge;
452 struct pci_dev *bridge_dev; 452 struct pci_dev *bridge_dev;
diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c
index 011967ad3eed..a56ee9bedd11 100644
--- a/drivers/char/agp/uninorth-agp.c
+++ b/drivers/char/agp/uninorth-agp.c
@@ -592,8 +592,8 @@ static struct agp_device_ids uninorth_agp_device_ids[] = {
592 }, 592 },
593}; 593};
594 594
595static int __devinit agp_uninorth_probe(struct pci_dev *pdev, 595static int agp_uninorth_probe(struct pci_dev *pdev,
596 const struct pci_device_id *ent) 596 const struct pci_device_id *ent)
597{ 597{
598 struct agp_device_ids *devs = uninorth_agp_device_ids; 598 struct agp_device_ids *devs = uninorth_agp_device_ids;
599 struct agp_bridge_data *bridge; 599 struct agp_bridge_data *bridge;
diff --git a/drivers/char/agp/via-agp.c b/drivers/char/agp/via-agp.c
index 6818595bb863..74d3aa3773bf 100644
--- a/drivers/char/agp/via-agp.c
+++ b/drivers/char/agp/via-agp.c
@@ -438,8 +438,7 @@ static void check_via_agp3 (struct agp_bridge_data *bridge)
438} 438}
439 439
440 440
441static int __devinit agp_via_probe(struct pci_dev *pdev, 441static int agp_via_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
442 const struct pci_device_id *ent)
443{ 442{
444 struct agp_device_ids *devs = via_agp_device_ids; 443 struct agp_device_ids *devs = via_agp_device_ids;
445 struct agp_bridge_data *bridge; 444 struct agp_bridge_data *bridge;
diff --git a/drivers/char/hw_random/atmel-rng.c b/drivers/char/hw_random/atmel-rng.c
index 5a4a6e70478b..7c73d4aca36b 100644
--- a/drivers/char/hw_random/atmel-rng.c
+++ b/drivers/char/hw_random/atmel-rng.c
@@ -138,7 +138,7 @@ static const struct dev_pm_ops atmel_trng_pm_ops = {
138 138
139static struct platform_driver atmel_trng_driver = { 139static struct platform_driver atmel_trng_driver = {
140 .probe = atmel_trng_probe, 140 .probe = atmel_trng_probe,
141 .remove = __devexit_p(atmel_trng_remove), 141 .remove = atmel_trng_remove,
142 .driver = { 142 .driver = {
143 .name = "atmel-trng", 143 .name = "atmel-trng",
144 .owner = THIS_MODULE, 144 .owner = THIS_MODULE,
diff --git a/drivers/char/hw_random/bcm63xx-rng.c b/drivers/char/hw_random/bcm63xx-rng.c
index ae95bcb18d4a..f343b7d0dfa1 100644
--- a/drivers/char/hw_random/bcm63xx-rng.c
+++ b/drivers/char/hw_random/bcm63xx-rng.c
@@ -61,7 +61,7 @@ static int bcm63xx_rng_data_read(struct hwrng *rng, u32 *data)
61 return 4; 61 return 4;
62} 62}
63 63
64static int __devinit bcm63xx_rng_probe(struct platform_device *pdev) 64static int bcm63xx_rng_probe(struct platform_device *pdev)
65{ 65{
66 struct resource *r; 66 struct resource *r;
67 struct clk *clk; 67 struct clk *clk;
@@ -161,7 +161,7 @@ static int bcm63xx_rng_remove(struct platform_device *pdev)
161 161
162static struct platform_driver bcm63xx_rng_driver = { 162static struct platform_driver bcm63xx_rng_driver = {
163 .probe = bcm63xx_rng_probe, 163 .probe = bcm63xx_rng_probe,
164 .remove = __devexit_p(bcm63xx_rng_remove), 164 .remove = bcm63xx_rng_remove,
165 .driver = { 165 .driver = {
166 .name = "bcm63xx-rng", 166 .name = "bcm63xx-rng",
167 .owner = THIS_MODULE, 167 .owner = THIS_MODULE,
diff --git a/drivers/char/hw_random/exynos-rng.c b/drivers/char/hw_random/exynos-rng.c
index bdc852ea7632..48bbfeca4b5d 100644
--- a/drivers/char/hw_random/exynos-rng.c
+++ b/drivers/char/hw_random/exynos-rng.c
@@ -101,7 +101,7 @@ static int exynos_read(struct hwrng *rng, void *buf,
101 return 4; 101 return 4;
102} 102}
103 103
104static int __devinit exynos_rng_probe(struct platform_device *pdev) 104static int exynos_rng_probe(struct platform_device *pdev)
105{ 105{
106 struct exynos_rng *exynos_rng; 106 struct exynos_rng *exynos_rng;
107 107
@@ -172,7 +172,7 @@ static struct platform_driver exynos_rng_driver = {
172 .pm = &exynos_rng_pm_ops, 172 .pm = &exynos_rng_pm_ops,
173 }, 173 },
174 .probe = exynos_rng_probe, 174 .probe = exynos_rng_probe,
175 .remove = __devexit_p(exynos_rng_remove), 175 .remove = exynos_rng_remove,
176}; 176};
177 177
178module_platform_driver(exynos_rng_driver); 178module_platform_driver(exynos_rng_driver);
diff --git a/drivers/char/hw_random/n2-drv.c b/drivers/char/hw_random/n2-drv.c
index d68a72a08b51..20b962e1d832 100644
--- a/drivers/char/hw_random/n2-drv.c
+++ b/drivers/char/hw_random/n2-drv.c
@@ -611,7 +611,7 @@ static void n2rng_work(struct work_struct *work)
611 schedule_delayed_work(&np->work, HZ * 2); 611 schedule_delayed_work(&np->work, HZ * 2);
612} 612}
613 613
614static void __devinit n2rng_driver_version(void) 614static void n2rng_driver_version(void)
615{ 615{
616 static int n2rng_version_printed; 616 static int n2rng_version_printed;
617 617
@@ -620,7 +620,7 @@ static void __devinit n2rng_driver_version(void)
620} 620}
621 621
622static const struct of_device_id n2rng_match[]; 622static const struct of_device_id n2rng_match[];
623static int __devinit n2rng_probe(struct platform_device *op) 623static int n2rng_probe(struct platform_device *op)
624{ 624{
625 const struct of_device_id *match; 625 const struct of_device_id *match;
626 int multi_capable; 626 int multi_capable;
@@ -767,7 +767,7 @@ static struct platform_driver n2rng_driver = {
767 .of_match_table = n2rng_match, 767 .of_match_table = n2rng_match,
768 }, 768 },
769 .probe = n2rng_probe, 769 .probe = n2rng_probe,
770 .remove = __devexit_p(n2rng_remove), 770 .remove = n2rng_remove,
771}; 771};
772 772
773module_platform_driver(n2rng_driver); 773module_platform_driver(n2rng_driver);
diff --git a/drivers/char/hw_random/octeon-rng.c b/drivers/char/hw_random/octeon-rng.c
index 5c34c092af71..1eada566ca70 100644
--- a/drivers/char/hw_random/octeon-rng.c
+++ b/drivers/char/hw_random/octeon-rng.c
@@ -56,7 +56,7 @@ static int octeon_rng_data_read(struct hwrng *rng, u32 *data)
56 return sizeof(u32); 56 return sizeof(u32);
57} 57}
58 58
59static int __devinit octeon_rng_probe(struct platform_device *pdev) 59static int octeon_rng_probe(struct platform_device *pdev)
60{ 60{
61 struct resource *res_ports; 61 struct resource *res_ports;
62 struct resource *res_result; 62 struct resource *res_result;
diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c
index 45e467dcc8c8..d8c54e253761 100644
--- a/drivers/char/hw_random/omap-rng.c
+++ b/drivers/char/hw_random/omap-rng.c
@@ -104,7 +104,7 @@ static struct hwrng omap_rng_ops = {
104 .data_read = omap_rng_data_read, 104 .data_read = omap_rng_data_read,
105}; 105};
106 106
107static int __devinit omap_rng_probe(struct platform_device *pdev) 107static int omap_rng_probe(struct platform_device *pdev)
108{ 108{
109 struct omap_rng_private_data *priv; 109 struct omap_rng_private_data *priv;
110 int ret; 110 int ret;
diff --git a/drivers/char/hw_random/pasemi-rng.c b/drivers/char/hw_random/pasemi-rng.c
index a1f70407cc9e..c6df5b29af08 100644
--- a/drivers/char/hw_random/pasemi-rng.c
+++ b/drivers/char/hw_random/pasemi-rng.c
@@ -94,7 +94,7 @@ static struct hwrng pasemi_rng = {
94 .data_read = pasemi_rng_data_read, 94 .data_read = pasemi_rng_data_read,
95}; 95};
96 96
97static int __devinit rng_probe(struct platform_device *ofdev) 97static int rng_probe(struct platform_device *ofdev)
98{ 98{
99 void __iomem *rng_regs; 99 void __iomem *rng_regs;
100 struct device_node *rng_np = ofdev->dev.of_node; 100 struct device_node *rng_np = ofdev->dev.of_node;
diff --git a/drivers/char/hw_random/picoxcell-rng.c b/drivers/char/hw_random/picoxcell-rng.c
index d4b24c1dd48e..973b95113edf 100644
--- a/drivers/char/hw_random/picoxcell-rng.c
+++ b/drivers/char/hw_random/picoxcell-rng.c
@@ -181,7 +181,7 @@ static const struct dev_pm_ops picoxcell_trng_pm_ops = {
181 181
182static struct platform_driver picoxcell_trng_driver = { 182static struct platform_driver picoxcell_trng_driver = {
183 .probe = picoxcell_trng_probe, 183 .probe = picoxcell_trng_probe,
184 .remove = __devexit_p(picoxcell_trng_remove), 184 .remove = picoxcell_trng_remove,
185 .driver = { 185 .driver = {
186 .name = "picoxcell-trng", 186 .name = "picoxcell-trng",
187 .owner = THIS_MODULE, 187 .owner = THIS_MODULE,
diff --git a/drivers/char/hw_random/ppc4xx-rng.c b/drivers/char/hw_random/ppc4xx-rng.c
index af6506a69cd9..732c330805fd 100644
--- a/drivers/char/hw_random/ppc4xx-rng.c
+++ b/drivers/char/hw_random/ppc4xx-rng.c
@@ -90,7 +90,7 @@ static struct hwrng ppc4xx_rng = {
90 .data_read = ppc4xx_rng_data_read, 90 .data_read = ppc4xx_rng_data_read,
91}; 91};
92 92
93static int __devinit ppc4xx_rng_probe(struct platform_device *dev) 93static int ppc4xx_rng_probe(struct platform_device *dev)
94{ 94{
95 void __iomem *rng_regs; 95 void __iomem *rng_regs;
96 int err = 0; 96 int err = 0;
diff --git a/drivers/char/hw_random/timeriomem-rng.c b/drivers/char/hw_random/timeriomem-rng.c
index 3a1abc9417e4..849db199c02c 100644
--- a/drivers/char/hw_random/timeriomem-rng.c
+++ b/drivers/char/hw_random/timeriomem-rng.c
@@ -88,7 +88,7 @@ static struct hwrng timeriomem_rng_ops = {
88 .priv = 0, 88 .priv = 0,
89}; 89};
90 90
91static int __devinit timeriomem_rng_probe(struct platform_device *pdev) 91static int timeriomem_rng_probe(struct platform_device *pdev)
92{ 92{
93 struct resource *res; 93 struct resource *res;
94 int ret; 94 int ret;
@@ -146,7 +146,7 @@ static struct platform_driver timeriomem_rng_driver = {
146 .owner = THIS_MODULE, 146 .owner = THIS_MODULE,
147 }, 147 },
148 .probe = timeriomem_rng_probe, 148 .probe = timeriomem_rng_probe,
149 .remove = __devexit_p(timeriomem_rng_remove), 149 .remove = timeriomem_rng_remove,
150}; 150};
151 151
152module_platform_driver(timeriomem_rng_driver); 152module_platform_driver(timeriomem_rng_driver);
diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c
index 621f595f1a98..b65c10395959 100644
--- a/drivers/char/hw_random/virtio-rng.c
+++ b/drivers/char/hw_random/virtio-rng.c
@@ -147,7 +147,7 @@ static struct virtio_driver virtio_rng_driver = {
147 .driver.owner = THIS_MODULE, 147 .driver.owner = THIS_MODULE,
148 .id_table = id_table, 148 .id_table = id_table,
149 .probe = virtrng_probe, 149 .probe = virtrng_probe,
150 .remove = __devexit_p(virtrng_remove), 150 .remove = virtrng_remove,
151#ifdef CONFIG_PM 151#ifdef CONFIG_PM
152 .freeze = virtrng_freeze, 152 .freeze = virtrng_freeze,
153 .restore = virtrng_restore, 153 .restore = virtrng_restore,
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index cfdfecd5bc76..1c7fdcd22a98 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2243,7 +2243,7 @@ static const struct pnp_device_id pnp_dev_table[] = {
2243static struct pnp_driver ipmi_pnp_driver = { 2243static struct pnp_driver ipmi_pnp_driver = {
2244 .name = DEVICE_NAME, 2244 .name = DEVICE_NAME,
2245 .probe = ipmi_pnp_probe, 2245 .probe = ipmi_pnp_probe,
2246 .remove = __devexit_p(ipmi_pnp_remove), 2246 .remove = ipmi_pnp_remove,
2247 .id_table = pnp_dev_table, 2247 .id_table = pnp_dev_table,
2248}; 2248};
2249#endif 2249#endif
@@ -2546,7 +2546,7 @@ static struct pci_driver ipmi_pci_driver = {
2546 .name = DEVICE_NAME, 2546 .name = DEVICE_NAME,
2547 .id_table = ipmi_pci_devices, 2547 .id_table = ipmi_pci_devices,
2548 .probe = ipmi_pci_probe, 2548 .probe = ipmi_pci_probe,
2549 .remove = __devexit_p(ipmi_pci_remove), 2549 .remove = ipmi_pci_remove,
2550}; 2550};
2551#endif /* CONFIG_PCI */ 2551#endif /* CONFIG_PCI */
2552 2552
@@ -2661,7 +2661,7 @@ static struct platform_driver ipmi_driver = {
2661 .of_match_table = ipmi_match, 2661 .of_match_table = ipmi_match,
2662 }, 2662 },
2663 .probe = ipmi_probe, 2663 .probe = ipmi_probe,
2664 .remove = __devexit_p(ipmi_remove), 2664 .remove = ipmi_remove,
2665}; 2665};
2666 2666
2667static int wait_for_msg_done(struct smi_info *smi_info) 2667static int wait_for_msg_done(struct smi_info *smi_info)
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index c594cb16c37b..684b0d53764f 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -2186,11 +2186,7 @@ static struct virtio_driver virtio_console = {
2186#endif 2186#endif
2187}; 2187};
2188 2188
2189/* 2189static struct virtio_driver virtio_rproc_serial = {
2190 * virtio_rproc_serial refers to __devinit function which causes
2191 * section mismatch warnings. So use __refdata to silence warnings.
2192 */
2193static struct virtio_driver __refdata virtio_rproc_serial = {
2194 .feature_table = rproc_serial_features, 2190 .feature_table = rproc_serial_features,
2195 .feature_table_size = ARRAY_SIZE(rproc_serial_features), 2191 .feature_table_size = ARRAY_SIZE(rproc_serial_features),
2196 .driver.name = "virtio_rproc_serial", 2192 .driver.name = "virtio_rproc_serial",
diff --git a/drivers/clk/clk-twl6040.c b/drivers/clk/clk-twl6040.c
index bc1e713e7b9c..3af729b1b89d 100644
--- a/drivers/clk/clk-twl6040.c
+++ b/drivers/clk/clk-twl6040.c
@@ -78,7 +78,7 @@ static struct clk_init_data wm831x_clkout_init = {
78 .flags = CLK_IS_ROOT, 78 .flags = CLK_IS_ROOT,
79}; 79};
80 80
81static int __devinit twl6040_clk_probe(struct platform_device *pdev) 81static int twl6040_clk_probe(struct platform_device *pdev)
82{ 82{
83 struct twl6040 *twl6040 = dev_get_drvdata(pdev->dev.parent); 83 struct twl6040 *twl6040 = dev_get_drvdata(pdev->dev.parent);
84 struct twl6040_clk *clkdata; 84 struct twl6040_clk *clkdata;
@@ -100,7 +100,7 @@ static int __devinit twl6040_clk_probe(struct platform_device *pdev)
100 return 0; 100 return 0;
101} 101}
102 102
103static int __devexit twl6040_clk_remove(struct platform_device *pdev) 103static int twl6040_clk_remove(struct platform_device *pdev)
104{ 104{
105 struct twl6040_clk *clkdata = dev_get_drvdata(&pdev->dev); 105 struct twl6040_clk *clkdata = dev_get_drvdata(&pdev->dev);
106 106
@@ -115,7 +115,7 @@ static struct platform_driver twl6040_clk_driver = {
115 .owner = THIS_MODULE, 115 .owner = THIS_MODULE,
116 }, 116 },
117 .probe = twl6040_clk_probe, 117 .probe = twl6040_clk_probe,
118 .remove = __devexit_p(twl6040_clk_remove), 118 .remove = twl6040_clk_remove,
119}; 119};
120 120
121module_platform_driver(twl6040_clk_driver); 121module_platform_driver(twl6040_clk_driver);
diff --git a/drivers/clk/mvebu/clk-cpu.c b/drivers/clk/mvebu/clk-cpu.c
index ff004578a119..9dd2551a0a41 100644
--- a/drivers/clk/mvebu/clk-cpu.c
+++ b/drivers/clk/mvebu/clk-cpu.c
@@ -124,7 +124,7 @@ void __init of_cpu_clk_setup(struct device_node *node)
124 124
125 clks = kzalloc(ncpus * sizeof(*clks), GFP_KERNEL); 125 clks = kzalloc(ncpus * sizeof(*clks), GFP_KERNEL);
126 if (WARN_ON(!clks)) 126 if (WARN_ON(!clks))
127 return; 127 goto clks_out;
128 128
129 for_each_node_by_type(dn, "cpu") { 129 for_each_node_by_type(dn, "cpu") {
130 struct clk_init_data init; 130 struct clk_init_data init;
@@ -134,11 +134,11 @@ void __init of_cpu_clk_setup(struct device_node *node)
134 int cpu, err; 134 int cpu, err;
135 135
136 if (WARN_ON(!clk_name)) 136 if (WARN_ON(!clk_name))
137 return; 137 goto bail_out;
138 138
139 err = of_property_read_u32(dn, "reg", &cpu); 139 err = of_property_read_u32(dn, "reg", &cpu);
140 if (WARN_ON(err)) 140 if (WARN_ON(err))
141 return; 141 goto bail_out;
142 142
143 sprintf(clk_name, "cpu%d", cpu); 143 sprintf(clk_name, "cpu%d", cpu);
144 parent_clk = of_clk_get(node, 0); 144 parent_clk = of_clk_get(node, 0);
@@ -167,6 +167,9 @@ void __init of_cpu_clk_setup(struct device_node *node)
167 return; 167 return;
168bail_out: 168bail_out:
169 kfree(clks); 169 kfree(clks);
170 while(ncpus--)
171 kfree(cpuclk[ncpus].clk_name);
172clks_out:
170 kfree(cpuclk); 173 kfree(cpuclk);
171} 174}
172 175
diff --git a/drivers/clk/mvebu/clk-gating-ctrl.c b/drivers/clk/mvebu/clk-gating-ctrl.c
index c6d3c263b070..8fa5408b6c7d 100644
--- a/drivers/clk/mvebu/clk-gating-ctrl.c
+++ b/drivers/clk/mvebu/clk-gating-ctrl.c
@@ -32,7 +32,7 @@ struct mvebu_soc_descr {
32 32
33#define to_clk_gate(_hw) container_of(_hw, struct clk_gate, hw) 33#define to_clk_gate(_hw) container_of(_hw, struct clk_gate, hw)
34 34
35static struct clk __init *mvebu_clk_gating_get_src( 35static struct clk *mvebu_clk_gating_get_src(
36 struct of_phandle_args *clkspec, void *data) 36 struct of_phandle_args *clkspec, void *data)
37{ 37{
38 struct mvebu_gating_ctrl *ctrl = (struct mvebu_gating_ctrl *)data; 38 struct mvebu_gating_ctrl *ctrl = (struct mvebu_gating_ctrl *)data;
diff --git a/drivers/clk/ux500/abx500-clk.c b/drivers/clk/ux500/abx500-clk.c
index e27c52317ffe..9f7400d74fa7 100644
--- a/drivers/clk/ux500/abx500-clk.c
+++ b/drivers/clk/ux500/abx500-clk.c
@@ -34,7 +34,7 @@ static int ab9540_reg_clks(struct device *dev)
34 return 0; 34 return 0;
35} 35}
36 36
37static int __devinit abx500_clk_probe(struct platform_device *pdev) 37static int abx500_clk_probe(struct platform_device *pdev)
38{ 38{
39 struct ab8500 *parent = dev_get_drvdata(pdev->dev.parent); 39 struct ab8500 *parent = dev_get_drvdata(pdev->dev.parent);
40 int ret; 40 int ret;
diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c
index 5d1b9268bcaf..6efe4d1ab3aa 100644
--- a/drivers/clocksource/acpi_pm.c
+++ b/drivers/clocksource/acpi_pm.c
@@ -73,7 +73,7 @@ static struct clocksource clocksource_acpi_pm = {
73 73
74 74
75#ifdef CONFIG_PCI 75#ifdef CONFIG_PCI
76static int __devinitdata acpi_pm_good; 76static int acpi_pm_good;
77static int __init acpi_pm_good_setup(char *__str) 77static int __init acpi_pm_good_setup(char *__str)
78{ 78{
79 acpi_pm_good = 1; 79 acpi_pm_good = 1;
@@ -102,7 +102,7 @@ static inline void acpi_pm_need_workaround(void)
102 * incorrect when read). As a result, the ACPI free running count up 102 * incorrect when read). As a result, the ACPI free running count up
103 * timer specification is violated due to erroneous reads. 103 * timer specification is violated due to erroneous reads.
104 */ 104 */
105static void __devinit acpi_pm_check_blacklist(struct pci_dev *dev) 105static void acpi_pm_check_blacklist(struct pci_dev *dev)
106{ 106{
107 if (acpi_pm_good) 107 if (acpi_pm_good)
108 return; 108 return;
@@ -120,7 +120,7 @@ static void __devinit acpi_pm_check_blacklist(struct pci_dev *dev)
120DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, 120DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3,
121 acpi_pm_check_blacklist); 121 acpi_pm_check_blacklist);
122 122
123static void __devinit acpi_pm_check_graylist(struct pci_dev *dev) 123static void acpi_pm_check_graylist(struct pci_dev *dev)
124{ 124{
125 if (acpi_pm_good) 125 if (acpi_pm_good)
126 return; 126 return;
diff --git a/drivers/clocksource/em_sti.c b/drivers/clocksource/em_sti.c
index 372051d1bba8..e6a553cb73e8 100644
--- a/drivers/clocksource/em_sti.c
+++ b/drivers/clocksource/em_sti.c
@@ -311,7 +311,7 @@ static void em_sti_register_clockevent(struct em_sti_priv *p)
311 clockevents_config_and_register(ced, 1, 2, 0xffffffff); 311 clockevents_config_and_register(ced, 1, 2, 0xffffffff);
312} 312}
313 313
314static int __devinit em_sti_probe(struct platform_device *pdev) 314static int em_sti_probe(struct platform_device *pdev)
315{ 315{
316 struct em_sti_priv *p; 316 struct em_sti_priv *p;
317 struct resource *res; 317 struct resource *res;
@@ -379,12 +379,12 @@ err0:
379 return ret; 379 return ret;
380} 380}
381 381
382static int __devexit em_sti_remove(struct platform_device *pdev) 382static int em_sti_remove(struct platform_device *pdev)
383{ 383{
384 return -EBUSY; /* cannot unregister clockevent and clocksource */ 384 return -EBUSY; /* cannot unregister clockevent and clocksource */
385} 385}
386 386
387static const struct of_device_id em_sti_dt_ids[] __devinitconst = { 387static const struct of_device_id em_sti_dt_ids[] = {
388 { .compatible = "renesas,em-sti", }, 388 { .compatible = "renesas,em-sti", },
389 {}, 389 {},
390}; 390};
@@ -392,7 +392,7 @@ MODULE_DEVICE_TABLE(of, em_sti_dt_ids);
392 392
393static struct platform_driver em_sti_device_driver = { 393static struct platform_driver em_sti_device_driver = {
394 .probe = em_sti_probe, 394 .probe = em_sti_probe,
395 .remove = __devexit_p(em_sti_remove), 395 .remove = em_sti_remove,
396 .driver = { 396 .driver = {
397 .name = "em_sti", 397 .name = "em_sti",
398 .of_match_table = em_sti_dt_ids, 398 .of_match_table = em_sti_dt_ids,
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
index a5f7829f2799..488c14cc8dbf 100644
--- a/drivers/clocksource/sh_cmt.c
+++ b/drivers/clocksource/sh_cmt.c
@@ -726,7 +726,7 @@ err0:
726 return ret; 726 return ret;
727} 727}
728 728
729static int __devinit sh_cmt_probe(struct platform_device *pdev) 729static int sh_cmt_probe(struct platform_device *pdev)
730{ 730{
731 struct sh_cmt_priv *p = platform_get_drvdata(pdev); 731 struct sh_cmt_priv *p = platform_get_drvdata(pdev);
732 struct sh_timer_config *cfg = pdev->dev.platform_data; 732 struct sh_timer_config *cfg = pdev->dev.platform_data;
@@ -767,14 +767,14 @@ static int __devinit sh_cmt_probe(struct platform_device *pdev)
767 return 0; 767 return 0;
768} 768}
769 769
770static int __devexit sh_cmt_remove(struct platform_device *pdev) 770static int sh_cmt_remove(struct platform_device *pdev)
771{ 771{
772 return -EBUSY; /* cannot unregister clockevent and clocksource */ 772 return -EBUSY; /* cannot unregister clockevent and clocksource */
773} 773}
774 774
775static struct platform_driver sh_cmt_device_driver = { 775static struct platform_driver sh_cmt_device_driver = {
776 .probe = sh_cmt_probe, 776 .probe = sh_cmt_probe,
777 .remove = __devexit_p(sh_cmt_remove), 777 .remove = sh_cmt_remove,
778 .driver = { 778 .driver = {
779 .name = "sh_cmt", 779 .name = "sh_cmt",
780 } 780 }
diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c
index c5eea858054a..83943e27cfac 100644
--- a/drivers/clocksource/sh_mtu2.c
+++ b/drivers/clocksource/sh_mtu2.c
@@ -321,7 +321,7 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev)
321 return ret; 321 return ret;
322} 322}
323 323
324static int __devinit sh_mtu2_probe(struct platform_device *pdev) 324static int sh_mtu2_probe(struct platform_device *pdev)
325{ 325{
326 struct sh_mtu2_priv *p = platform_get_drvdata(pdev); 326 struct sh_mtu2_priv *p = platform_get_drvdata(pdev);
327 struct sh_timer_config *cfg = pdev->dev.platform_data; 327 struct sh_timer_config *cfg = pdev->dev.platform_data;
@@ -362,14 +362,14 @@ static int __devinit sh_mtu2_probe(struct platform_device *pdev)
362 return 0; 362 return 0;
363} 363}
364 364
365static int __devexit sh_mtu2_remove(struct platform_device *pdev) 365static int sh_mtu2_remove(struct platform_device *pdev)
366{ 366{
367 return -EBUSY; /* cannot unregister clockevent */ 367 return -EBUSY; /* cannot unregister clockevent */
368} 368}
369 369
370static struct platform_driver sh_mtu2_device_driver = { 370static struct platform_driver sh_mtu2_device_driver = {
371 .probe = sh_mtu2_probe, 371 .probe = sh_mtu2_probe,
372 .remove = __devexit_p(sh_mtu2_remove), 372 .remove = sh_mtu2_remove,
373 .driver = { 373 .driver = {
374 .name = "sh_mtu2", 374 .name = "sh_mtu2",
375 } 375 }
diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c
index 0cc4add88279..b4502edce2a1 100644
--- a/drivers/clocksource/sh_tmu.c
+++ b/drivers/clocksource/sh_tmu.c
@@ -484,7 +484,7 @@ static int sh_tmu_setup(struct sh_tmu_priv *p, struct platform_device *pdev)
484 return ret; 484 return ret;
485} 485}
486 486
487static int __devinit sh_tmu_probe(struct platform_device *pdev) 487static int sh_tmu_probe(struct platform_device *pdev)
488{ 488{
489 struct sh_tmu_priv *p = platform_get_drvdata(pdev); 489 struct sh_tmu_priv *p = platform_get_drvdata(pdev);
490 struct sh_timer_config *cfg = pdev->dev.platform_data; 490 struct sh_timer_config *cfg = pdev->dev.platform_data;
@@ -525,14 +525,14 @@ static int __devinit sh_tmu_probe(struct platform_device *pdev)
525 return 0; 525 return 0;
526} 526}
527 527
528static int __devexit sh_tmu_remove(struct platform_device *pdev) 528static int sh_tmu_remove(struct platform_device *pdev)
529{ 529{
530 return -EBUSY; /* cannot unregister clockevent and clocksource */ 530 return -EBUSY; /* cannot unregister clockevent and clocksource */
531} 531}
532 532
533static struct platform_driver sh_tmu_device_driver = { 533static struct platform_driver sh_tmu_device_driver = {
534 .probe = sh_tmu_probe, 534 .probe = sh_tmu_probe,
535 .remove = __devexit_p(sh_tmu_remove), 535 .remove = sh_tmu_remove,
536 .driver = { 536 .driver = {
537 .name = "sh_tmu", 537 .name = "sh_tmu",
538 } 538 }
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index 965b7811e04f..7b695913cb30 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -256,7 +256,7 @@ static struct cn_dev cdev = {
256 .input = cn_rx_skb, 256 .input = cn_rx_skb,
257}; 257};
258 258
259static int __devinit cn_init(void) 259static int cn_init(void)
260{ 260{
261 struct cn_dev *dev = &cdev; 261 struct cn_dev *dev = &cdev;
262 struct netlink_kernel_cfg cfg = { 262 struct netlink_kernel_cfg cfg = {
@@ -281,7 +281,7 @@ static int __devinit cn_init(void)
281 return 0; 281 return 0;
282} 282}
283 283
284static void __devexit cn_fini(void) 284static void cn_fini(void)
285{ 285{
286 struct cn_dev *dev = &cdev; 286 struct cn_dev *dev = &cdev;
287 287
diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
index ea512f47b789..e0a899f25e37 100644
--- a/drivers/cpufreq/Kconfig
+++ b/drivers/cpufreq/Kconfig
@@ -20,6 +20,9 @@ if CPU_FREQ
20config CPU_FREQ_TABLE 20config CPU_FREQ_TABLE
21 tristate 21 tristate
22 22
23config CPU_FREQ_GOV_COMMON
24 bool
25
23config CPU_FREQ_STAT 26config CPU_FREQ_STAT
24 tristate "CPU frequency translation statistics" 27 tristate "CPU frequency translation statistics"
25 select CPU_FREQ_TABLE 28 select CPU_FREQ_TABLE
@@ -141,6 +144,7 @@ config CPU_FREQ_GOV_USERSPACE
141config CPU_FREQ_GOV_ONDEMAND 144config CPU_FREQ_GOV_ONDEMAND
142 tristate "'ondemand' cpufreq policy governor" 145 tristate "'ondemand' cpufreq policy governor"
143 select CPU_FREQ_TABLE 146 select CPU_FREQ_TABLE
147 select CPU_FREQ_GOV_COMMON
144 help 148 help
145 'ondemand' - This driver adds a dynamic cpufreq policy governor. 149 'ondemand' - This driver adds a dynamic cpufreq policy governor.
146 The governor does a periodic polling and 150 The governor does a periodic polling and
@@ -159,6 +163,7 @@ config CPU_FREQ_GOV_ONDEMAND
159config CPU_FREQ_GOV_CONSERVATIVE 163config CPU_FREQ_GOV_CONSERVATIVE
160 tristate "'conservative' cpufreq governor" 164 tristate "'conservative' cpufreq governor"
161 depends on CPU_FREQ 165 depends on CPU_FREQ
166 select CPU_FREQ_GOV_COMMON
162 help 167 help
163 'conservative' - this driver is rather similar to the 'ondemand' 168 'conservative' - this driver is rather similar to the 'ondemand'
164 governor both in its source code and its purpose, the difference is 169 governor both in its source code and its purpose, the difference is
diff --git a/drivers/cpufreq/Kconfig.x86 b/drivers/cpufreq/Kconfig.x86
index 934854ae5eb4..7227cd734042 100644
--- a/drivers/cpufreq/Kconfig.x86
+++ b/drivers/cpufreq/Kconfig.x86
@@ -106,7 +106,7 @@ config X86_POWERNOW_K7_ACPI
106config X86_POWERNOW_K8 106config X86_POWERNOW_K8
107 tristate "AMD Opteron/Athlon64 PowerNow!" 107 tristate "AMD Opteron/Athlon64 PowerNow!"
108 select CPU_FREQ_TABLE 108 select CPU_FREQ_TABLE
109 depends on ACPI && ACPI_PROCESSOR 109 depends on ACPI && ACPI_PROCESSOR && X86_ACPI_CPUFREQ
110 help 110 help
111 This adds the CPUFreq driver for K8/early Opteron/Athlon64 processors. 111 This adds the CPUFreq driver for K8/early Opteron/Athlon64 processors.
112 Support for K10 and newer processors is now in acpi-cpufreq. 112 Support for K10 and newer processors is now in acpi-cpufreq.
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index 1f254ec087c1..fadc4d496e2f 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -7,8 +7,9 @@ obj-$(CONFIG_CPU_FREQ_STAT) += cpufreq_stats.o
7obj-$(CONFIG_CPU_FREQ_GOV_PERFORMANCE) += cpufreq_performance.o 7obj-$(CONFIG_CPU_FREQ_GOV_PERFORMANCE) += cpufreq_performance.o
8obj-$(CONFIG_CPU_FREQ_GOV_POWERSAVE) += cpufreq_powersave.o 8obj-$(CONFIG_CPU_FREQ_GOV_POWERSAVE) += cpufreq_powersave.o
9obj-$(CONFIG_CPU_FREQ_GOV_USERSPACE) += cpufreq_userspace.o 9obj-$(CONFIG_CPU_FREQ_GOV_USERSPACE) += cpufreq_userspace.o
10obj-$(CONFIG_CPU_FREQ_GOV_ONDEMAND) += cpufreq_ondemand.o cpufreq_governor.o 10obj-$(CONFIG_CPU_FREQ_GOV_ONDEMAND) += cpufreq_ondemand.o
11obj-$(CONFIG_CPU_FREQ_GOV_CONSERVATIVE) += cpufreq_conservative.o cpufreq_governor.o 11obj-$(CONFIG_CPU_FREQ_GOV_CONSERVATIVE) += cpufreq_conservative.o
12obj-$(CONFIG_CPU_FREQ_GOV_COMMON) += cpufreq_governor.o
12 13
13# CPUfreq cross-arch helpers 14# CPUfreq cross-arch helpers
14obj-$(CONFIG_CPU_FREQ_TABLE) += freq_table.o 15obj-$(CONFIG_CPU_FREQ_TABLE) += freq_table.o
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
index 0d048f6a2b23..7b0d49d78c61 100644
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -1030,4 +1030,11 @@ MODULE_PARM_DESC(acpi_pstate_strict,
1030late_initcall(acpi_cpufreq_init); 1030late_initcall(acpi_cpufreq_init);
1031module_exit(acpi_cpufreq_exit); 1031module_exit(acpi_cpufreq_exit);
1032 1032
1033static const struct x86_cpu_id acpi_cpufreq_ids[] = {
1034 X86_FEATURE_MATCH(X86_FEATURE_ACPI),
1035 X86_FEATURE_MATCH(X86_FEATURE_HW_PSTATE),
1036 {}
1037};
1038MODULE_DEVICE_TABLE(x86cpu, acpi_cpufreq_ids);
1039
1033MODULE_ALIAS("acpi"); 1040MODULE_ALIAS("acpi");
diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
index 52bf36d599f5..debc5a7c8db6 100644
--- a/drivers/cpufreq/cpufreq-cpu0.c
+++ b/drivers/cpufreq/cpufreq-cpu0.c
@@ -71,12 +71,15 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
71 } 71 }
72 72
73 if (cpu_reg) { 73 if (cpu_reg) {
74 rcu_read_lock();
74 opp = opp_find_freq_ceil(cpu_dev, &freq_Hz); 75 opp = opp_find_freq_ceil(cpu_dev, &freq_Hz);
75 if (IS_ERR(opp)) { 76 if (IS_ERR(opp)) {
77 rcu_read_unlock();
76 pr_err("failed to find OPP for %ld\n", freq_Hz); 78 pr_err("failed to find OPP for %ld\n", freq_Hz);
77 return PTR_ERR(opp); 79 return PTR_ERR(opp);
78 } 80 }
79 volt = opp_get_voltage(opp); 81 volt = opp_get_voltage(opp);
82 rcu_read_unlock();
80 tol = volt * voltage_tolerance / 100; 83 tol = volt * voltage_tolerance / 100;
81 volt_old = regulator_get_voltage(cpu_reg); 84 volt_old = regulator_get_voltage(cpu_reg);
82 } 85 }
@@ -236,12 +239,14 @@ static int cpu0_cpufreq_driver_init(void)
236 */ 239 */
237 for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++) 240 for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++)
238 ; 241 ;
242 rcu_read_lock();
239 opp = opp_find_freq_exact(cpu_dev, 243 opp = opp_find_freq_exact(cpu_dev,
240 freq_table[0].frequency * 1000, true); 244 freq_table[0].frequency * 1000, true);
241 min_uV = opp_get_voltage(opp); 245 min_uV = opp_get_voltage(opp);
242 opp = opp_find_freq_exact(cpu_dev, 246 opp = opp_find_freq_exact(cpu_dev,
243 freq_table[i-1].frequency * 1000, true); 247 freq_table[i-1].frequency * 1000, true);
244 max_uV = opp_get_voltage(opp); 248 max_uV = opp_get_voltage(opp);
249 rcu_read_unlock();
245 ret = regulator_set_voltage_time(cpu_reg, min_uV, max_uV); 250 ret = regulator_set_voltage_time(cpu_reg, min_uV, max_uV);
246 if (ret > 0) 251 if (ret > 0)
247 transition_latency += ret * 1000; 252 transition_latency += ret * 1000;
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
index e40e50809644..9d7732b81044 100644
--- a/drivers/cpufreq/cpufreq_stats.c
+++ b/drivers/cpufreq/cpufreq_stats.c
@@ -364,18 +364,21 @@ static int __init cpufreq_stats_init(void)
364 if (ret) 364 if (ret)
365 return ret; 365 return ret;
366 366
367 register_hotcpu_notifier(&cpufreq_stat_cpu_notifier);
368 for_each_online_cpu(cpu)
369 cpufreq_update_policy(cpu);
370
367 ret = cpufreq_register_notifier(&notifier_trans_block, 371 ret = cpufreq_register_notifier(&notifier_trans_block,
368 CPUFREQ_TRANSITION_NOTIFIER); 372 CPUFREQ_TRANSITION_NOTIFIER);
369 if (ret) { 373 if (ret) {
370 cpufreq_unregister_notifier(&notifier_policy_block, 374 cpufreq_unregister_notifier(&notifier_policy_block,
371 CPUFREQ_POLICY_NOTIFIER); 375 CPUFREQ_POLICY_NOTIFIER);
376 unregister_hotcpu_notifier(&cpufreq_stat_cpu_notifier);
377 for_each_online_cpu(cpu)
378 cpufreq_stats_free_table(cpu);
372 return ret; 379 return ret;
373 } 380 }
374 381
375 register_hotcpu_notifier(&cpufreq_stat_cpu_notifier);
376 for_each_online_cpu(cpu) {
377 cpufreq_update_policy(cpu);
378 }
379 return 0; 382 return 0;
380} 383}
381static void __exit cpufreq_stats_exit(void) 384static void __exit cpufreq_stats_exit(void)
diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c
index f1fa500ac105..1180d536d1eb 100644
--- a/drivers/cpufreq/longhaul.c
+++ b/drivers/cpufreq/longhaul.c
@@ -77,7 +77,7 @@ static unsigned int longhaul_index;
77static int scale_voltage; 77static int scale_voltage;
78static int disable_acpi_c3; 78static int disable_acpi_c3;
79static int revid_errata; 79static int revid_errata;
80 80static int enable;
81 81
82/* Clock ratios multiplied by 10 */ 82/* Clock ratios multiplied by 10 */
83static int mults[32]; 83static int mults[32];
@@ -965,6 +965,10 @@ static int __init longhaul_init(void)
965 if (!x86_match_cpu(longhaul_id)) 965 if (!x86_match_cpu(longhaul_id))
966 return -ENODEV; 966 return -ENODEV;
967 967
968 if (!enable) {
969 printk(KERN_ERR PFX "Option \"enable\" not set. Aborting.\n");
970 return -ENODEV;
971 }
968#ifdef CONFIG_SMP 972#ifdef CONFIG_SMP
969 if (num_online_cpus() > 1) { 973 if (num_online_cpus() > 1) {
970 printk(KERN_ERR PFX "More than 1 CPU detected, " 974 printk(KERN_ERR PFX "More than 1 CPU detected, "
@@ -1021,6 +1025,10 @@ MODULE_PARM_DESC(scale_voltage, "Scale voltage of processor");
1021 * such. */ 1025 * such. */
1022module_param(revid_errata, int, 0644); 1026module_param(revid_errata, int, 0644);
1023MODULE_PARM_DESC(revid_errata, "Ignore CPU Revision ID"); 1027MODULE_PARM_DESC(revid_errata, "Ignore CPU Revision ID");
1028/* By default driver is disabled to prevent incompatible
1029 * system freeze. */
1030module_param(enable, int, 0644);
1031MODULE_PARM_DESC(enable, "Enable driver");
1024 1032
1025MODULE_AUTHOR("Dave Jones <davej@redhat.com>"); 1033MODULE_AUTHOR("Dave Jones <davej@redhat.com>");
1026MODULE_DESCRIPTION("Longhaul driver for VIA Cyrix processors."); 1034MODULE_DESCRIPTION("Longhaul driver for VIA Cyrix processors.");
diff --git a/drivers/cpufreq/omap-cpufreq.c b/drivers/cpufreq/omap-cpufreq.c
index 1f3417a8322d..97102b05843f 100644
--- a/drivers/cpufreq/omap-cpufreq.c
+++ b/drivers/cpufreq/omap-cpufreq.c
@@ -110,13 +110,16 @@ static int omap_target(struct cpufreq_policy *policy,
110 freq = ret; 110 freq = ret;
111 111
112 if (mpu_reg) { 112 if (mpu_reg) {
113 rcu_read_lock();
113 opp = opp_find_freq_ceil(mpu_dev, &freq); 114 opp = opp_find_freq_ceil(mpu_dev, &freq);
114 if (IS_ERR(opp)) { 115 if (IS_ERR(opp)) {
116 rcu_read_unlock();
115 dev_err(mpu_dev, "%s: unable to find MPU OPP for %d\n", 117 dev_err(mpu_dev, "%s: unable to find MPU OPP for %d\n",
116 __func__, freqs.new); 118 __func__, freqs.new);
117 return -EINVAL; 119 return -EINVAL;
118 } 120 }
119 volt = opp_get_voltage(opp); 121 volt = opp_get_voltage(opp);
122 rcu_read_unlock();
120 tol = volt * OPP_TOLERANCE / 100; 123 tol = volt * OPP_TOLERANCE / 100;
121 volt_old = regulator_get_voltage(mpu_reg); 124 volt_old = regulator_get_voltage(mpu_reg);
122 } 125 }
diff --git a/drivers/cpuidle/coupled.c b/drivers/cpuidle/coupled.c
index 3265844839bf..2a297f86dbad 100644
--- a/drivers/cpuidle/coupled.c
+++ b/drivers/cpuidle/coupled.c
@@ -209,7 +209,7 @@ inline int cpuidle_coupled_set_not_ready(struct cpuidle_coupled *coupled)
209 int all; 209 int all;
210 int ret; 210 int ret;
211 211
212 all = coupled->online_count || (coupled->online_count << WAITING_BITS); 212 all = coupled->online_count | (coupled->online_count << WAITING_BITS);
213 ret = atomic_add_unless(&coupled->ready_waiting_counts, 213 ret = atomic_add_unless(&coupled->ready_waiting_counts,
214 -MAX_WAITING_CPUS, all); 214 -MAX_WAITING_CPUS, all);
215 215
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 8df53dd8dbe1..e1f6860e069c 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -69,24 +69,15 @@ int cpuidle_play_dead(void)
69{ 69{
70 struct cpuidle_device *dev = __this_cpu_read(cpuidle_devices); 70 struct cpuidle_device *dev = __this_cpu_read(cpuidle_devices);
71 struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev); 71 struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);
72 int i, dead_state = -1; 72 int i;
73 int power_usage = -1;
74 73
75 if (!drv) 74 if (!drv)
76 return -ENODEV; 75 return -ENODEV;
77 76
78 /* Find lowest-power state that supports long-term idle */ 77 /* Find lowest-power state that supports long-term idle */
79 for (i = CPUIDLE_DRIVER_STATE_START; i < drv->state_count; i++) { 78 for (i = drv->state_count - 1; i >= CPUIDLE_DRIVER_STATE_START; i--)
80 struct cpuidle_state *s = &drv->states[i]; 79 if (drv->states[i].enter_dead)
81 80 return drv->states[i].enter_dead(dev, i);
82 if (s->power_usage < power_usage && s->enter_dead) {
83 power_usage = s->power_usage;
84 dead_state = i;
85 }
86 }
87
88 if (dead_state != -1)
89 return drv->states[dead_state].enter_dead(dev, dead_state);
90 81
91 return -ENODEV; 82 return -ENODEV;
92} 83}
diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
index 3af841fb397a..422c7b69ba7c 100644
--- a/drivers/cpuidle/driver.c
+++ b/drivers/cpuidle/driver.c
@@ -19,34 +19,9 @@ DEFINE_SPINLOCK(cpuidle_driver_lock);
19static void __cpuidle_set_cpu_driver(struct cpuidle_driver *drv, int cpu); 19static void __cpuidle_set_cpu_driver(struct cpuidle_driver *drv, int cpu);
20static struct cpuidle_driver * __cpuidle_get_cpu_driver(int cpu); 20static struct cpuidle_driver * __cpuidle_get_cpu_driver(int cpu);
21 21
22static void set_power_states(struct cpuidle_driver *drv)
23{
24 int i;
25
26 /*
27 * cpuidle driver should set the drv->power_specified bit
28 * before registering if the driver provides
29 * power_usage numbers.
30 *
31 * If power_specified is not set,
32 * we fill in power_usage with decreasing values as the
33 * cpuidle code has an implicit assumption that state Cn
34 * uses less power than C(n-1).
35 *
36 * With CONFIG_ARCH_HAS_CPU_RELAX, C0 is already assigned
37 * an power value of -1. So we use -2, -3, etc, for other
38 * c-states.
39 */
40 for (i = CPUIDLE_DRIVER_STATE_START; i < drv->state_count; i++)
41 drv->states[i].power_usage = -1 - i;
42}
43
44static void __cpuidle_driver_init(struct cpuidle_driver *drv) 22static void __cpuidle_driver_init(struct cpuidle_driver *drv)
45{ 23{
46 drv->refcnt = 0; 24 drv->refcnt = 0;
47
48 if (!drv->power_specified)
49 set_power_states(drv);
50} 25}
51 26
52static int __cpuidle_register_driver(struct cpuidle_driver *drv, int cpu) 27static int __cpuidle_register_driver(struct cpuidle_driver *drv, int cpu)
@@ -235,16 +210,10 @@ EXPORT_SYMBOL_GPL(cpuidle_get_driver);
235 */ 210 */
236struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev) 211struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev)
237{ 212{
238 struct cpuidle_driver *drv;
239
240 if (!dev) 213 if (!dev)
241 return NULL; 214 return NULL;
242 215
243 spin_lock(&cpuidle_driver_lock); 216 return __cpuidle_get_cpu_driver(dev->cpu);
244 drv = __cpuidle_get_cpu_driver(dev->cpu);
245 spin_unlock(&cpuidle_driver_lock);
246
247 return drv;
248} 217}
249EXPORT_SYMBOL_GPL(cpuidle_get_cpu_driver); 218EXPORT_SYMBOL_GPL(cpuidle_get_cpu_driver);
250 219
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
index bd40b943b6db..fe343a06b7da 100644
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -312,7 +312,6 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
312{ 312{
313 struct menu_device *data = &__get_cpu_var(menu_devices); 313 struct menu_device *data = &__get_cpu_var(menu_devices);
314 int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY); 314 int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY);
315 int power_usage = -1;
316 int i; 315 int i;
317 int multiplier; 316 int multiplier;
318 struct timespec t; 317 struct timespec t;
@@ -383,11 +382,8 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
383 if (s->exit_latency * multiplier > data->predicted_us) 382 if (s->exit_latency * multiplier > data->predicted_us)
384 continue; 383 continue;
385 384
386 if (s->power_usage < power_usage) { 385 data->last_state_idx = i;
387 power_usage = s->power_usage; 386 data->exit_us = s->exit_latency;
388 data->last_state_idx = i;
389 data->exit_us = s->exit_latency;
390 }
391 } 387 }
392 388
393 /* not deepest C-state chosen for low predicted residency */ 389 /* not deepest C-state chosen for low predicted residency */
diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
index 340942946106..428754af6236 100644
--- a/drivers/cpuidle/sysfs.c
+++ b/drivers/cpuidle/sysfs.c
@@ -374,7 +374,7 @@ static int cpuidle_add_state_sysfs(struct cpuidle_device *device)
374 struct cpuidle_driver *drv = cpuidle_get_cpu_driver(device); 374 struct cpuidle_driver *drv = cpuidle_get_cpu_driver(device);
375 375
376 /* state statistics */ 376 /* state statistics */
377 for (i = 0; i < drv->state_count; i++) { 377 for (i = 0; i < device->state_count; i++) {
378 kobj = kzalloc(sizeof(struct cpuidle_state_kobj), GFP_KERNEL); 378 kobj = kzalloc(sizeof(struct cpuidle_state_kobj), GFP_KERNEL);
379 if (!kobj) 379 if (!kobj)
380 goto error_state; 380 goto error_state;
diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c
index 8061336e07e7..c9d9d5c16f94 100644
--- a/drivers/crypto/atmel-aes.c
+++ b/drivers/crypto/atmel-aes.c
@@ -1036,7 +1036,7 @@ err_aes_algs:
1036 return err; 1036 return err;
1037} 1037}
1038 1038
1039static int __devinit atmel_aes_probe(struct platform_device *pdev) 1039static int atmel_aes_probe(struct platform_device *pdev)
1040{ 1040{
1041 struct atmel_aes_dev *aes_dd; 1041 struct atmel_aes_dev *aes_dd;
1042 struct aes_platform_data *pdata; 1042 struct aes_platform_data *pdata;
@@ -1152,7 +1152,7 @@ aes_dd_err:
1152 return err; 1152 return err;
1153} 1153}
1154 1154
1155static int __devexit atmel_aes_remove(struct platform_device *pdev) 1155static int atmel_aes_remove(struct platform_device *pdev)
1156{ 1156{
1157 static struct atmel_aes_dev *aes_dd; 1157 static struct atmel_aes_dev *aes_dd;
1158 1158
@@ -1185,7 +1185,7 @@ static int __devexit atmel_aes_remove(struct platform_device *pdev)
1185 1185
1186static struct platform_driver atmel_aes_driver = { 1186static struct platform_driver atmel_aes_driver = {
1187 .probe = atmel_aes_probe, 1187 .probe = atmel_aes_probe,
1188 .remove = __devexit_p(atmel_aes_remove), 1188 .remove = atmel_aes_remove,
1189 .driver = { 1189 .driver = {
1190 .name = "atmel_aes", 1190 .name = "atmel_aes",
1191 .owner = THIS_MODULE, 1191 .owner = THIS_MODULE,
diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c
index bcdf55fdc623..4918e9424d31 100644
--- a/drivers/crypto/atmel-sha.c
+++ b/drivers/crypto/atmel-sha.c
@@ -964,7 +964,7 @@ err_sha_algs:
964 return err; 964 return err;
965} 965}
966 966
967static int __devinit atmel_sha_probe(struct platform_device *pdev) 967static int atmel_sha_probe(struct platform_device *pdev)
968{ 968{
969 struct atmel_sha_dev *sha_dd; 969 struct atmel_sha_dev *sha_dd;
970 struct device *dev = &pdev->dev; 970 struct device *dev = &pdev->dev;
@@ -1063,7 +1063,7 @@ sha_dd_err:
1063 return err; 1063 return err;
1064} 1064}
1065 1065
1066static int __devexit atmel_sha_remove(struct platform_device *pdev) 1066static int atmel_sha_remove(struct platform_device *pdev)
1067{ 1067{
1068 static struct atmel_sha_dev *sha_dd; 1068 static struct atmel_sha_dev *sha_dd;
1069 1069
@@ -1093,7 +1093,7 @@ static int __devexit atmel_sha_remove(struct platform_device *pdev)
1093 1093
1094static struct platform_driver atmel_sha_driver = { 1094static struct platform_driver atmel_sha_driver = {
1095 .probe = atmel_sha_probe, 1095 .probe = atmel_sha_probe,
1096 .remove = __devexit_p(atmel_sha_remove), 1096 .remove = atmel_sha_remove,
1097 .driver = { 1097 .driver = {
1098 .name = "atmel_sha", 1098 .name = "atmel_sha",
1099 .owner = THIS_MODULE, 1099 .owner = THIS_MODULE,
diff --git a/drivers/crypto/atmel-tdes.c b/drivers/crypto/atmel-tdes.c
index 7495f98c7221..7c73fbb17538 100644
--- a/drivers/crypto/atmel-tdes.c
+++ b/drivers/crypto/atmel-tdes.c
@@ -1053,7 +1053,7 @@ err_tdes_algs:
1053 return err; 1053 return err;
1054} 1054}
1055 1055
1056static int __devinit atmel_tdes_probe(struct platform_device *pdev) 1056static int atmel_tdes_probe(struct platform_device *pdev)
1057{ 1057{
1058 struct atmel_tdes_dev *tdes_dd; 1058 struct atmel_tdes_dev *tdes_dd;
1059 struct device *dev = &pdev->dev; 1059 struct device *dev = &pdev->dev;
@@ -1162,7 +1162,7 @@ tdes_dd_err:
1162 return err; 1162 return err;
1163} 1163}
1164 1164
1165static int __devexit atmel_tdes_remove(struct platform_device *pdev) 1165static int atmel_tdes_remove(struct platform_device *pdev)
1166{ 1166{
1167 static struct atmel_tdes_dev *tdes_dd; 1167 static struct atmel_tdes_dev *tdes_dd;
1168 1168
@@ -1195,7 +1195,7 @@ static int __devexit atmel_tdes_remove(struct platform_device *pdev)
1195 1195
1196static struct platform_driver atmel_tdes_driver = { 1196static struct platform_driver atmel_tdes_driver = {
1197 .probe = atmel_tdes_probe, 1197 .probe = atmel_tdes_probe,
1198 .remove = __devexit_p(atmel_tdes_remove), 1198 .remove = atmel_tdes_remove,
1199 .driver = { 1199 .driver = {
1200 .name = "atmel_tdes", 1200 .name = "atmel_tdes",
1201 .owner = THIS_MODULE, 1201 .owner = THIS_MODULE,
diff --git a/drivers/crypto/bfin_crc.c b/drivers/crypto/bfin_crc.c
index 5398580b4313..a22f1a9f895f 100644
--- a/drivers/crypto/bfin_crc.c
+++ b/drivers/crypto/bfin_crc.c
@@ -586,7 +586,7 @@ static int bfin_crypto_crc_suspend(struct platform_device *pdev, pm_message_t st
586 * bfin_crypto_crc_probe - Initialize module 586 * bfin_crypto_crc_probe - Initialize module
587 * 587 *
588 */ 588 */
589static int __devinit bfin_crypto_crc_probe(struct platform_device *pdev) 589static int bfin_crypto_crc_probe(struct platform_device *pdev)
590{ 590{
591 struct device *dev = &pdev->dev; 591 struct device *dev = &pdev->dev;
592 struct resource *res; 592 struct resource *res;
@@ -707,7 +707,7 @@ out_error_free_mem:
707 * bfin_crypto_crc_remove - Initialize module 707 * bfin_crypto_crc_remove - Initialize module
708 * 708 *
709 */ 709 */
710static int __devexit bfin_crypto_crc_remove(struct platform_device *pdev) 710static int bfin_crypto_crc_remove(struct platform_device *pdev)
711{ 711{
712 struct bfin_crypto_crc *crc = platform_get_drvdata(pdev); 712 struct bfin_crypto_crc *crc = platform_get_drvdata(pdev);
713 713
@@ -731,7 +731,7 @@ static int __devexit bfin_crypto_crc_remove(struct platform_device *pdev)
731 731
732static struct platform_driver bfin_crypto_crc_driver = { 732static struct platform_driver bfin_crypto_crc_driver = {
733 .probe = bfin_crypto_crc_probe, 733 .probe = bfin_crypto_crc_probe,
734 .remove = __devexit_p(bfin_crypto_crc_remove), 734 .remove = bfin_crypto_crc_remove,
735 .suspend = bfin_crypto_crc_suspend, 735 .suspend = bfin_crypto_crc_suspend,
736 .resume = bfin_crypto_crc_resume, 736 .resume = bfin_crypto_crc_resume,
737 .driver = { 737 .driver = {
diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index bf20dd891705..1c56f63524f2 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -420,7 +420,7 @@ static struct platform_driver caam_driver = {
420 .of_match_table = caam_match, 420 .of_match_table = caam_match,
421 }, 421 },
422 .probe = caam_probe, 422 .probe = caam_probe,
423 .remove = __devexit_p(caam_remove), 423 .remove = caam_remove,
424}; 424};
425 425
426module_platform_driver(caam_driver); 426module_platform_driver(caam_driver);
diff --git a/drivers/crypto/geode-aes.c b/drivers/crypto/geode-aes.c
index 51f196d77f21..0c9ff4971724 100644
--- a/drivers/crypto/geode-aes.c
+++ b/drivers/crypto/geode-aes.c
@@ -498,8 +498,7 @@ static struct crypto_alg geode_ecb_alg = {
498 } 498 }
499}; 499};
500 500
501static void __devexit 501static void geode_aes_remove(struct pci_dev *dev)
502geode_aes_remove(struct pci_dev *dev)
503{ 502{
504 crypto_unregister_alg(&geode_alg); 503 crypto_unregister_alg(&geode_alg);
505 crypto_unregister_alg(&geode_ecb_alg); 504 crypto_unregister_alg(&geode_ecb_alg);
@@ -513,8 +512,7 @@ geode_aes_remove(struct pci_dev *dev)
513} 512}
514 513
515 514
516static int __devinit 515static int geode_aes_probe(struct pci_dev *dev, const struct pci_device_id *id)
517geode_aes_probe(struct pci_dev *dev, const struct pci_device_id *id)
518{ 516{
519 int ret; 517 int ret;
520 ret = pci_enable_device(dev); 518 ret = pci_enable_device(dev);
@@ -582,7 +580,7 @@ static struct pci_driver geode_aes_driver = {
582 .name = "Geode LX AES", 580 .name = "Geode LX AES",
583 .id_table = geode_aes_tbl, 581 .id_table = geode_aes_tbl,
584 .probe = geode_aes_probe, 582 .probe = geode_aes_probe,
585 .remove = __devexit_p(geode_aes_remove) 583 .remove = geode_aes_remove,
586}; 584};
587 585
588module_pci_driver(geode_aes_driver); 586module_pci_driver(geode_aes_driver);
diff --git a/drivers/crypto/hifn_795x.c b/drivers/crypto/hifn_795x.c
index fda32968a66b..ebf130e894b5 100644
--- a/drivers/crypto/hifn_795x.c
+++ b/drivers/crypto/hifn_795x.c
@@ -2561,7 +2561,7 @@ static void hifn_tasklet_callback(unsigned long data)
2561 hifn_process_queue(dev); 2561 hifn_process_queue(dev);
2562} 2562}
2563 2563
2564static int __devinit hifn_probe(struct pci_dev *pdev, const struct pci_device_id *id) 2564static int hifn_probe(struct pci_dev *pdev, const struct pci_device_id *id)
2565{ 2565{
2566 int err, i; 2566 int err, i;
2567 struct hifn_device *dev; 2567 struct hifn_device *dev;
@@ -2696,7 +2696,7 @@ err_out_disable_pci_device:
2696 return err; 2696 return err;
2697} 2697}
2698 2698
2699static void __devexit hifn_remove(struct pci_dev *pdev) 2699static void hifn_remove(struct pci_dev *pdev)
2700{ 2700{
2701 int i; 2701 int i;
2702 struct hifn_device *dev; 2702 struct hifn_device *dev;
@@ -2740,7 +2740,7 @@ static struct pci_driver hifn_pci_driver = {
2740 .name = "hifn795x", 2740 .name = "hifn795x",
2741 .id_table = hifn_pci_tbl, 2741 .id_table = hifn_pci_tbl,
2742 .probe = hifn_probe, 2742 .probe = hifn_probe,
2743 .remove = __devexit_p(hifn_remove), 2743 .remove = hifn_remove,
2744}; 2744};
2745 2745
2746static int __init hifn_init(void) 2746static int __init hifn_init(void)
diff --git a/drivers/crypto/mv_cesa.c b/drivers/crypto/mv_cesa.c
index 24ccae453e79..ce6290e5471a 100644
--- a/drivers/crypto/mv_cesa.c
+++ b/drivers/crypto/mv_cesa.c
@@ -1184,7 +1184,7 @@ MODULE_DEVICE_TABLE(of, mv_cesa_of_match_table);
1184 1184
1185static struct platform_driver marvell_crypto = { 1185static struct platform_driver marvell_crypto = {
1186 .probe = mv_probe, 1186 .probe = mv_probe,
1187 .remove = __devexit_p(mv_remove), 1187 .remove = mv_remove,
1188 .driver = { 1188 .driver = {
1189 .owner = THIS_MODULE, 1189 .owner = THIS_MODULE,
1190 .name = "mv_crypto", 1190 .name = "mv_crypto",
diff --git a/drivers/crypto/n2_core.c b/drivers/crypto/n2_core.c
index aab257403b4a..e1f0ab413c3b 100644
--- a/drivers/crypto/n2_core.c
+++ b/drivers/crypto/n2_core.c
@@ -34,7 +34,7 @@
34#define DRV_MODULE_VERSION "0.2" 34#define DRV_MODULE_VERSION "0.2"
35#define DRV_MODULE_RELDATE "July 28, 2011" 35#define DRV_MODULE_RELDATE "July 28, 2011"
36 36
37static char version[] __devinitdata = 37static char version[] =
38 DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; 38 DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
39 39
40MODULE_AUTHOR("David S. Miller (davem@davemloft.net)"); 40MODULE_AUTHOR("David S. Miller (davem@davemloft.net)");
@@ -1388,7 +1388,7 @@ static int n2_cipher_cra_init(struct crypto_tfm *tfm)
1388 return 0; 1388 return 0;
1389} 1389}
1390 1390
1391static int __devinit __n2_register_one_cipher(const struct n2_cipher_tmpl *tmpl) 1391static int __n2_register_one_cipher(const struct n2_cipher_tmpl *tmpl)
1392{ 1392{
1393 struct n2_cipher_alg *p = kzalloc(sizeof(*p), GFP_KERNEL); 1393 struct n2_cipher_alg *p = kzalloc(sizeof(*p), GFP_KERNEL);
1394 struct crypto_alg *alg; 1394 struct crypto_alg *alg;
@@ -1424,7 +1424,7 @@ static int __devinit __n2_register_one_cipher(const struct n2_cipher_tmpl *tmpl)
1424 return err; 1424 return err;
1425} 1425}
1426 1426
1427static int __devinit __n2_register_one_hmac(struct n2_ahash_alg *n2ahash) 1427static int __n2_register_one_hmac(struct n2_ahash_alg *n2ahash)
1428{ 1428{
1429 struct n2_hmac_alg *p = kzalloc(sizeof(*p), GFP_KERNEL); 1429 struct n2_hmac_alg *p = kzalloc(sizeof(*p), GFP_KERNEL);
1430 struct ahash_alg *ahash; 1430 struct ahash_alg *ahash;
@@ -1462,7 +1462,7 @@ static int __devinit __n2_register_one_hmac(struct n2_ahash_alg *n2ahash)
1462 return err; 1462 return err;
1463} 1463}
1464 1464
1465static int __devinit __n2_register_one_ahash(const struct n2_hash_tmpl *tmpl) 1465static int __n2_register_one_ahash(const struct n2_hash_tmpl *tmpl)
1466{ 1466{
1467 struct n2_ahash_alg *p = kzalloc(sizeof(*p), GFP_KERNEL); 1467 struct n2_ahash_alg *p = kzalloc(sizeof(*p), GFP_KERNEL);
1468 struct hash_alg_common *halg; 1468 struct hash_alg_common *halg;
@@ -1517,7 +1517,7 @@ static int __devinit __n2_register_one_ahash(const struct n2_hash_tmpl *tmpl)
1517 return err; 1517 return err;
1518} 1518}
1519 1519
1520static int __devinit n2_register_algs(void) 1520static int n2_register_algs(void)
1521{ 1521{
1522 int i, err = 0; 1522 int i, err = 0;
1523 1523
@@ -1545,7 +1545,7 @@ out:
1545 return err; 1545 return err;
1546} 1546}
1547 1547
1548static void __devexit n2_unregister_algs(void) 1548static void n2_unregister_algs(void)
1549{ 1549{
1550 mutex_lock(&spu_lock); 1550 mutex_lock(&spu_lock);
1551 if (!--algs_registered) 1551 if (!--algs_registered)
@@ -1822,8 +1822,8 @@ static int spu_mdesc_scan(struct mdesc_handle *mdesc, struct platform_device *de
1822 return err; 1822 return err;
1823} 1823}
1824 1824
1825static int __devinit get_irq_props(struct mdesc_handle *mdesc, u64 node, 1825static int get_irq_props(struct mdesc_handle *mdesc, u64 node,
1826 struct spu_mdesc_info *ip) 1826 struct spu_mdesc_info *ip)
1827{ 1827{
1828 const u64 *ino; 1828 const u64 *ino;
1829 int ino_len; 1829 int ino_len;
@@ -1851,10 +1851,10 @@ static int __devinit get_irq_props(struct mdesc_handle *mdesc, u64 node,
1851 return 0; 1851 return 0;
1852} 1852}
1853 1853
1854static int __devinit grab_mdesc_irq_props(struct mdesc_handle *mdesc, 1854static int grab_mdesc_irq_props(struct mdesc_handle *mdesc,
1855 struct platform_device *dev, 1855 struct platform_device *dev,
1856 struct spu_mdesc_info *ip, 1856 struct spu_mdesc_info *ip,
1857 const char *node_name) 1857 const char *node_name)
1858{ 1858{
1859 const unsigned int *reg; 1859 const unsigned int *reg;
1860 u64 node; 1860 u64 node;
@@ -1883,7 +1883,7 @@ static int __devinit grab_mdesc_irq_props(struct mdesc_handle *mdesc,
1883static unsigned long n2_spu_hvapi_major; 1883static unsigned long n2_spu_hvapi_major;
1884static unsigned long n2_spu_hvapi_minor; 1884static unsigned long n2_spu_hvapi_minor;
1885 1885
1886static int __devinit n2_spu_hvapi_register(void) 1886static int n2_spu_hvapi_register(void)
1887{ 1887{
1888 int err; 1888 int err;
1889 1889
@@ -1909,7 +1909,7 @@ static void n2_spu_hvapi_unregister(void)
1909 1909
1910static int global_ref; 1910static int global_ref;
1911 1911
1912static int __devinit grab_global_resources(void) 1912static int grab_global_resources(void)
1913{ 1913{
1914 int err = 0; 1914 int err = 0;
1915 1915
@@ -1973,7 +1973,7 @@ static void release_global_resources(void)
1973 mutex_unlock(&spu_lock); 1973 mutex_unlock(&spu_lock);
1974} 1974}
1975 1975
1976static struct n2_crypto * __devinit alloc_n2cp(void) 1976static struct n2_crypto *alloc_n2cp(void)
1977{ 1977{
1978 struct n2_crypto *np = kzalloc(sizeof(struct n2_crypto), GFP_KERNEL); 1978 struct n2_crypto *np = kzalloc(sizeof(struct n2_crypto), GFP_KERNEL);
1979 1979
@@ -1993,7 +1993,7 @@ static void free_n2cp(struct n2_crypto *np)
1993 kfree(np); 1993 kfree(np);
1994} 1994}
1995 1995
1996static void __devinit n2_spu_driver_version(void) 1996static void n2_spu_driver_version(void)
1997{ 1997{
1998 static int n2_spu_version_printed; 1998 static int n2_spu_version_printed;
1999 1999
@@ -2001,7 +2001,7 @@ static void __devinit n2_spu_driver_version(void)
2001 pr_info("%s", version); 2001 pr_info("%s", version);
2002} 2002}
2003 2003
2004static int __devinit n2_crypto_probe(struct platform_device *dev) 2004static int n2_crypto_probe(struct platform_device *dev)
2005{ 2005{
2006 struct mdesc_handle *mdesc; 2006 struct mdesc_handle *mdesc;
2007 const char *full_name; 2007 const char *full_name;
@@ -2077,7 +2077,7 @@ out_free_n2cp:
2077 return err; 2077 return err;
2078} 2078}
2079 2079
2080static int __devexit n2_crypto_remove(struct platform_device *dev) 2080static int n2_crypto_remove(struct platform_device *dev)
2081{ 2081{
2082 struct n2_crypto *np = dev_get_drvdata(&dev->dev); 2082 struct n2_crypto *np = dev_get_drvdata(&dev->dev);
2083 2083
@@ -2092,7 +2092,7 @@ static int __devexit n2_crypto_remove(struct platform_device *dev)
2092 return 0; 2092 return 0;
2093} 2093}
2094 2094
2095static struct n2_mau * __devinit alloc_ncp(void) 2095static struct n2_mau *alloc_ncp(void)
2096{ 2096{
2097 struct n2_mau *mp = kzalloc(sizeof(struct n2_mau), GFP_KERNEL); 2097 struct n2_mau *mp = kzalloc(sizeof(struct n2_mau), GFP_KERNEL);
2098 2098
@@ -2112,7 +2112,7 @@ static void free_ncp(struct n2_mau *mp)
2112 kfree(mp); 2112 kfree(mp);
2113} 2113}
2114 2114
2115static int __devinit n2_mau_probe(struct platform_device *dev) 2115static int n2_mau_probe(struct platform_device *dev)
2116{ 2116{
2117 struct mdesc_handle *mdesc; 2117 struct mdesc_handle *mdesc;
2118 const char *full_name; 2118 const char *full_name;
@@ -2179,7 +2179,7 @@ out_free_ncp:
2179 return err; 2179 return err;
2180} 2180}
2181 2181
2182static int __devexit n2_mau_remove(struct platform_device *dev) 2182static int n2_mau_remove(struct platform_device *dev)
2183{ 2183{
2184 struct n2_mau *mp = dev_get_drvdata(&dev->dev); 2184 struct n2_mau *mp = dev_get_drvdata(&dev->dev);
2185 2185
@@ -2217,7 +2217,7 @@ static struct platform_driver n2_crypto_driver = {
2217 .of_match_table = n2_crypto_match, 2217 .of_match_table = n2_crypto_match,
2218 }, 2218 },
2219 .probe = n2_crypto_probe, 2219 .probe = n2_crypto_probe,
2220 .remove = __devexit_p(n2_crypto_remove), 2220 .remove = n2_crypto_remove,
2221}; 2221};
2222 2222
2223static struct of_device_id n2_mau_match[] = { 2223static struct of_device_id n2_mau_match[] = {
@@ -2245,7 +2245,7 @@ static struct platform_driver n2_mau_driver = {
2245 .of_match_table = n2_mau_match, 2245 .of_match_table = n2_mau_match,
2246 }, 2246 },
2247 .probe = n2_mau_probe, 2247 .probe = n2_mau_probe,
2248 .remove = __devexit_p(n2_mau_remove), 2248 .remove = n2_mau_remove,
2249}; 2249};
2250 2250
2251static int __init n2_init(void) 2251static int __init n2_init(void)
diff --git a/drivers/crypto/nx/nx.c b/drivers/crypto/nx/nx.c
index f7a8a16aa7d3..c767f232e693 100644
--- a/drivers/crypto/nx/nx.c
+++ b/drivers/crypto/nx/nx.c
@@ -634,8 +634,7 @@ void nx_crypto_ctx_exit(struct crypto_tfm *tfm)
634 nx_ctx->out_sg = NULL; 634 nx_ctx->out_sg = NULL;
635} 635}
636 636
637static int __devinit nx_probe(struct vio_dev *viodev, 637static int nx_probe(struct vio_dev *viodev, const struct vio_device_id *id)
638 const struct vio_device_id *id)
639{ 638{
640 dev_dbg(&viodev->dev, "driver probed: %s resource id: 0x%x\n", 639 dev_dbg(&viodev->dev, "driver probed: %s resource id: 0x%x\n",
641 viodev->name, viodev->resource_id); 640 viodev->name, viodev->resource_id);
@@ -653,7 +652,7 @@ static int __devinit nx_probe(struct vio_dev *viodev,
653 return nx_register_algs(); 652 return nx_register_algs();
654} 653}
655 654
656static int __devexit nx_remove(struct vio_dev *viodev) 655static int nx_remove(struct vio_dev *viodev)
657{ 656{
658 dev_dbg(&viodev->dev, "entering nx_remove for UA 0x%x\n", 657 dev_dbg(&viodev->dev, "entering nx_remove for UA 0x%x\n",
659 viodev->unit_address); 658 viodev->unit_address);
@@ -689,7 +688,7 @@ static void __exit nx_fini(void)
689 vio_unregister_driver(&nx_driver.viodriver); 688 vio_unregister_driver(&nx_driver.viodriver);
690} 689}
691 690
692static struct vio_device_id nx_crypto_driver_ids[] __devinitdata = { 691static struct vio_device_id nx_crypto_driver_ids[] = {
693 { "ibm,sym-encryption-v1", "ibm,sym-encryption" }, 692 { "ibm,sym-encryption-v1", "ibm,sym-encryption" },
694 { "", "" } 693 { "", "" }
695}; 694};
diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c
index 1d75e6f95a58..90d34adc2a66 100644
--- a/drivers/crypto/omap-sham.c
+++ b/drivers/crypto/omap-sham.c
@@ -1137,7 +1137,7 @@ static void omap_sham_dma_cleanup(struct omap_sham_dev *dd)
1137 } 1137 }
1138} 1138}
1139 1139
1140static int __devinit omap_sham_probe(struct platform_device *pdev) 1140static int omap_sham_probe(struct platform_device *pdev)
1141{ 1141{
1142 struct omap_sham_dev *dd; 1142 struct omap_sham_dev *dd;
1143 struct device *dev = &pdev->dev; 1143 struct device *dev = &pdev->dev;
@@ -1250,7 +1250,7 @@ data_err:
1250 return err; 1250 return err;
1251} 1251}
1252 1252
1253static int __devexit omap_sham_remove(struct platform_device *pdev) 1253static int omap_sham_remove(struct platform_device *pdev)
1254{ 1254{
1255 static struct omap_sham_dev *dd; 1255 static struct omap_sham_dev *dd;
1256 int i; 1256 int i;
diff --git a/drivers/crypto/picoxcell_crypto.c b/drivers/crypto/picoxcell_crypto.c
index c983f869d2b7..2096d4685a9e 100644
--- a/drivers/crypto/picoxcell_crypto.c
+++ b/drivers/crypto/picoxcell_crypto.c
@@ -1708,7 +1708,7 @@ static bool spacc_is_compatible(struct platform_device *pdev,
1708 return false; 1708 return false;
1709} 1709}
1710 1710
1711static int __devinit spacc_probe(struct platform_device *pdev) 1711static int spacc_probe(struct platform_device *pdev)
1712{ 1712{
1713 int i, err, ret = -EINVAL; 1713 int i, err, ret = -EINVAL;
1714 struct resource *mem, *irq; 1714 struct resource *mem, *irq;
@@ -1841,7 +1841,7 @@ static int __devinit spacc_probe(struct platform_device *pdev)
1841 return ret; 1841 return ret;
1842} 1842}
1843 1843
1844static int __devexit spacc_remove(struct platform_device *pdev) 1844static int spacc_remove(struct platform_device *pdev)
1845{ 1845{
1846 struct spacc_alg *alg, *next; 1846 struct spacc_alg *alg, *next;
1847 struct spacc_engine *engine = platform_get_drvdata(pdev); 1847 struct spacc_engine *engine = platform_get_drvdata(pdev);
@@ -1868,7 +1868,7 @@ static const struct platform_device_id spacc_id_table[] = {
1868 1868
1869static struct platform_driver spacc_driver = { 1869static struct platform_driver spacc_driver = {
1870 .probe = spacc_probe, 1870 .probe = spacc_probe,
1871 .remove = __devexit_p(spacc_remove), 1871 .remove = spacc_remove,
1872 .driver = { 1872 .driver = {
1873 .name = "picochip,spacc", 1873 .name = "picochip,spacc",
1874#ifdef CONFIG_PM 1874#ifdef CONFIG_PM
diff --git a/drivers/crypto/tegra-aes.c b/drivers/crypto/tegra-aes.c
index eb32fd8cad14..85ea7525fa36 100644
--- a/drivers/crypto/tegra-aes.c
+++ b/drivers/crypto/tegra-aes.c
@@ -1047,7 +1047,7 @@ out:
1047 return err; 1047 return err;
1048} 1048}
1049 1049
1050static int __devexit tegra_aes_remove(struct platform_device *pdev) 1050static int tegra_aes_remove(struct platform_device *pdev)
1051{ 1051{
1052 struct device *dev = &pdev->dev; 1052 struct device *dev = &pdev->dev;
1053 struct tegra_aes_dev *dd = platform_get_drvdata(pdev); 1053 struct tegra_aes_dev *dd = platform_get_drvdata(pdev);
@@ -1074,7 +1074,7 @@ static int __devexit tegra_aes_remove(struct platform_device *pdev)
1074 return 0; 1074 return 0;
1075} 1075}
1076 1076
1077static struct of_device_id tegra_aes_of_match[] __devinitdata = { 1077static struct of_device_id tegra_aes_of_match[] = {
1078 { .compatible = "nvidia,tegra20-aes", }, 1078 { .compatible = "nvidia,tegra20-aes", },
1079 { .compatible = "nvidia,tegra30-aes", }, 1079 { .compatible = "nvidia,tegra30-aes", },
1080 { }, 1080 { },
@@ -1082,7 +1082,7 @@ static struct of_device_id tegra_aes_of_match[] __devinitdata = {
1082 1082
1083static struct platform_driver tegra_aes_driver = { 1083static struct platform_driver tegra_aes_driver = {
1084 .probe = tegra_aes_probe, 1084 .probe = tegra_aes_probe,
1085 .remove = __devexit_p(tegra_aes_remove), 1085 .remove = tegra_aes_remove,
1086 .driver = { 1086 .driver = {
1087 .name = "tegra-aes", 1087 .name = "tegra-aes",
1088 .owner = THIS_MODULE, 1088 .owner = THIS_MODULE,
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 53766f39aadd..3b367973a802 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -994,6 +994,11 @@ module_exit(devfreq_exit);
994 * @freq: The frequency given to target function 994 * @freq: The frequency given to target function
995 * @flags: Flags handed from devfreq framework. 995 * @flags: Flags handed from devfreq framework.
996 * 996 *
997 * Locking: This function must be called under rcu_read_lock(). opp is a rcu
998 * protected pointer. The reason for the same is that the opp pointer which is
999 * returned will remain valid for use with opp_get_{voltage, freq} only while
1000 * under the locked area. The pointer returned must be used prior to unlocking
1001 * with rcu_read_unlock() to maintain the integrity of the pointer.
997 */ 1002 */
998struct opp *devfreq_recommended_opp(struct device *dev, unsigned long *freq, 1003struct opp *devfreq_recommended_opp(struct device *dev, unsigned long *freq,
999 u32 flags) 1004 u32 flags)
diff --git a/drivers/devfreq/exynos4_bus.c b/drivers/devfreq/exynos4_bus.c
index 741837208716..46d94e9e95b5 100644
--- a/drivers/devfreq/exynos4_bus.c
+++ b/drivers/devfreq/exynos4_bus.c
@@ -73,6 +73,16 @@ enum busclk_level_idx {
73#define EX4210_LV_NUM (LV_2 + 1) 73#define EX4210_LV_NUM (LV_2 + 1)
74#define EX4x12_LV_NUM (LV_4 + 1) 74#define EX4x12_LV_NUM (LV_4 + 1)
75 75
76/**
77 * struct busfreq_opp_info - opp information for bus
78 * @rate: Frequency in hertz
79 * @volt: Voltage in microvolts corresponding to this OPP
80 */
81struct busfreq_opp_info {
82 unsigned long rate;
83 unsigned long volt;
84};
85
76struct busfreq_data { 86struct busfreq_data {
77 enum exynos4_busf_type type; 87 enum exynos4_busf_type type;
78 struct device *dev; 88 struct device *dev;
@@ -80,7 +90,7 @@ struct busfreq_data {
80 bool disabled; 90 bool disabled;
81 struct regulator *vdd_int; 91 struct regulator *vdd_int;
82 struct regulator *vdd_mif; /* Exynos4412/4212 only */ 92 struct regulator *vdd_mif; /* Exynos4412/4212 only */
83 struct opp *curr_opp; 93 struct busfreq_opp_info curr_oppinfo;
84 struct exynos4_ppmu dmc[2]; 94 struct exynos4_ppmu dmc[2];
85 95
86 struct notifier_block pm_notifier; 96 struct notifier_block pm_notifier;
@@ -296,13 +306,14 @@ static unsigned int exynos4x12_clkdiv_sclkip[][3] = {
296}; 306};
297 307
298 308
299static int exynos4210_set_busclk(struct busfreq_data *data, struct opp *opp) 309static int exynos4210_set_busclk(struct busfreq_data *data,
310 struct busfreq_opp_info *oppi)
300{ 311{
301 unsigned int index; 312 unsigned int index;
302 unsigned int tmp; 313 unsigned int tmp;
303 314
304 for (index = LV_0; index < EX4210_LV_NUM; index++) 315 for (index = LV_0; index < EX4210_LV_NUM; index++)
305 if (opp_get_freq(opp) == exynos4210_busclk_table[index].clk) 316 if (oppi->rate == exynos4210_busclk_table[index].clk)
306 break; 317 break;
307 318
308 if (index == EX4210_LV_NUM) 319 if (index == EX4210_LV_NUM)
@@ -361,13 +372,14 @@ static int exynos4210_set_busclk(struct busfreq_data *data, struct opp *opp)
361 return 0; 372 return 0;
362} 373}
363 374
364static int exynos4x12_set_busclk(struct busfreq_data *data, struct opp *opp) 375static int exynos4x12_set_busclk(struct busfreq_data *data,
376 struct busfreq_opp_info *oppi)
365{ 377{
366 unsigned int index; 378 unsigned int index;
367 unsigned int tmp; 379 unsigned int tmp;
368 380
369 for (index = LV_0; index < EX4x12_LV_NUM; index++) 381 for (index = LV_0; index < EX4x12_LV_NUM; index++)
370 if (opp_get_freq(opp) == exynos4x12_mifclk_table[index].clk) 382 if (oppi->rate == exynos4x12_mifclk_table[index].clk)
371 break; 383 break;
372 384
373 if (index == EX4x12_LV_NUM) 385 if (index == EX4x12_LV_NUM)
@@ -576,11 +588,12 @@ static int exynos4x12_get_intspec(unsigned long mifclk)
576 return -EINVAL; 588 return -EINVAL;
577} 589}
578 590
579static int exynos4_bus_setvolt(struct busfreq_data *data, struct opp *opp, 591static int exynos4_bus_setvolt(struct busfreq_data *data,
580 struct opp *oldopp) 592 struct busfreq_opp_info *oppi,
593 struct busfreq_opp_info *oldoppi)
581{ 594{
582 int err = 0, tmp; 595 int err = 0, tmp;
583 unsigned long volt = opp_get_voltage(opp); 596 unsigned long volt = oppi->volt;
584 597
585 switch (data->type) { 598 switch (data->type) {
586 case TYPE_BUSF_EXYNOS4210: 599 case TYPE_BUSF_EXYNOS4210:
@@ -595,11 +608,11 @@ static int exynos4_bus_setvolt(struct busfreq_data *data, struct opp *opp,
595 if (err) 608 if (err)
596 break; 609 break;
597 610
598 tmp = exynos4x12_get_intspec(opp_get_freq(opp)); 611 tmp = exynos4x12_get_intspec(oppi->rate);
599 if (tmp < 0) { 612 if (tmp < 0) {
600 err = tmp; 613 err = tmp;
601 regulator_set_voltage(data->vdd_mif, 614 regulator_set_voltage(data->vdd_mif,
602 opp_get_voltage(oldopp), 615 oldoppi->volt,
603 MAX_SAFEVOLT); 616 MAX_SAFEVOLT);
604 break; 617 break;
605 } 618 }
@@ -609,7 +622,7 @@ static int exynos4_bus_setvolt(struct busfreq_data *data, struct opp *opp,
609 /* Try to recover */ 622 /* Try to recover */
610 if (err) 623 if (err)
611 regulator_set_voltage(data->vdd_mif, 624 regulator_set_voltage(data->vdd_mif,
612 opp_get_voltage(oldopp), 625 oldoppi->volt,
613 MAX_SAFEVOLT); 626 MAX_SAFEVOLT);
614 break; 627 break;
615 default: 628 default:
@@ -626,17 +639,26 @@ static int exynos4_bus_target(struct device *dev, unsigned long *_freq,
626 struct platform_device *pdev = container_of(dev, struct platform_device, 639 struct platform_device *pdev = container_of(dev, struct platform_device,
627 dev); 640 dev);
628 struct busfreq_data *data = platform_get_drvdata(pdev); 641 struct busfreq_data *data = platform_get_drvdata(pdev);
629 struct opp *opp = devfreq_recommended_opp(dev, _freq, flags); 642 struct opp *opp;
630 unsigned long freq = opp_get_freq(opp); 643 unsigned long freq;
631 unsigned long old_freq = opp_get_freq(data->curr_opp); 644 unsigned long old_freq = data->curr_oppinfo.rate;
645 struct busfreq_opp_info new_oppinfo;
632 646
633 if (IS_ERR(opp)) 647 rcu_read_lock();
648 opp = devfreq_recommended_opp(dev, _freq, flags);
649 if (IS_ERR(opp)) {
650 rcu_read_unlock();
634 return PTR_ERR(opp); 651 return PTR_ERR(opp);
652 }
653 new_oppinfo.rate = opp_get_freq(opp);
654 new_oppinfo.volt = opp_get_voltage(opp);
655 rcu_read_unlock();
656 freq = new_oppinfo.rate;
635 657
636 if (old_freq == freq) 658 if (old_freq == freq)
637 return 0; 659 return 0;
638 660
639 dev_dbg(dev, "targetting %lukHz %luuV\n", freq, opp_get_voltage(opp)); 661 dev_dbg(dev, "targetting %lukHz %luuV\n", freq, new_oppinfo.volt);
640 662
641 mutex_lock(&data->lock); 663 mutex_lock(&data->lock);
642 664
@@ -644,17 +666,18 @@ static int exynos4_bus_target(struct device *dev, unsigned long *_freq,
644 goto out; 666 goto out;
645 667
646 if (old_freq < freq) 668 if (old_freq < freq)
647 err = exynos4_bus_setvolt(data, opp, data->curr_opp); 669 err = exynos4_bus_setvolt(data, &new_oppinfo,
670 &data->curr_oppinfo);
648 if (err) 671 if (err)
649 goto out; 672 goto out;
650 673
651 if (old_freq != freq) { 674 if (old_freq != freq) {
652 switch (data->type) { 675 switch (data->type) {
653 case TYPE_BUSF_EXYNOS4210: 676 case TYPE_BUSF_EXYNOS4210:
654 err = exynos4210_set_busclk(data, opp); 677 err = exynos4210_set_busclk(data, &new_oppinfo);
655 break; 678 break;
656 case TYPE_BUSF_EXYNOS4x12: 679 case TYPE_BUSF_EXYNOS4x12:
657 err = exynos4x12_set_busclk(data, opp); 680 err = exynos4x12_set_busclk(data, &new_oppinfo);
658 break; 681 break;
659 default: 682 default:
660 err = -EINVAL; 683 err = -EINVAL;
@@ -664,11 +687,12 @@ static int exynos4_bus_target(struct device *dev, unsigned long *_freq,
664 goto out; 687 goto out;
665 688
666 if (old_freq > freq) 689 if (old_freq > freq)
667 err = exynos4_bus_setvolt(data, opp, data->curr_opp); 690 err = exynos4_bus_setvolt(data, &new_oppinfo,
691 &data->curr_oppinfo);
668 if (err) 692 if (err)
669 goto out; 693 goto out;
670 694
671 data->curr_opp = opp; 695 data->curr_oppinfo = new_oppinfo;
672out: 696out:
673 mutex_unlock(&data->lock); 697 mutex_unlock(&data->lock);
674 return err; 698 return err;
@@ -702,7 +726,7 @@ static int exynos4_bus_get_dev_status(struct device *dev,
702 726
703 exynos4_read_ppmu(data); 727 exynos4_read_ppmu(data);
704 busier_dmc = exynos4_get_busier_dmc(data); 728 busier_dmc = exynos4_get_busier_dmc(data);
705 stat->current_frequency = opp_get_freq(data->curr_opp); 729 stat->current_frequency = data->curr_oppinfo.rate;
706 730
707 if (busier_dmc) 731 if (busier_dmc)
708 addr = S5P_VA_DMC1; 732 addr = S5P_VA_DMC1;
@@ -933,6 +957,7 @@ static int exynos4_busfreq_pm_notifier_event(struct notifier_block *this,
933 struct busfreq_data *data = container_of(this, struct busfreq_data, 957 struct busfreq_data *data = container_of(this, struct busfreq_data,
934 pm_notifier); 958 pm_notifier);
935 struct opp *opp; 959 struct opp *opp;
960 struct busfreq_opp_info new_oppinfo;
936 unsigned long maxfreq = ULONG_MAX; 961 unsigned long maxfreq = ULONG_MAX;
937 int err = 0; 962 int err = 0;
938 963
@@ -943,18 +968,29 @@ static int exynos4_busfreq_pm_notifier_event(struct notifier_block *this,
943 968
944 data->disabled = true; 969 data->disabled = true;
945 970
971 rcu_read_lock();
946 opp = opp_find_freq_floor(data->dev, &maxfreq); 972 opp = opp_find_freq_floor(data->dev, &maxfreq);
973 if (IS_ERR(opp)) {
974 rcu_read_unlock();
975 dev_err(data->dev, "%s: unable to find a min freq\n",
976 __func__);
977 return PTR_ERR(opp);
978 }
979 new_oppinfo.rate = opp_get_freq(opp);
980 new_oppinfo.volt = opp_get_voltage(opp);
981 rcu_read_unlock();
947 982
948 err = exynos4_bus_setvolt(data, opp, data->curr_opp); 983 err = exynos4_bus_setvolt(data, &new_oppinfo,
984 &data->curr_oppinfo);
949 if (err) 985 if (err)
950 goto unlock; 986 goto unlock;
951 987
952 switch (data->type) { 988 switch (data->type) {
953 case TYPE_BUSF_EXYNOS4210: 989 case TYPE_BUSF_EXYNOS4210:
954 err = exynos4210_set_busclk(data, opp); 990 err = exynos4210_set_busclk(data, &new_oppinfo);
955 break; 991 break;
956 case TYPE_BUSF_EXYNOS4x12: 992 case TYPE_BUSF_EXYNOS4x12:
957 err = exynos4x12_set_busclk(data, opp); 993 err = exynos4x12_set_busclk(data, &new_oppinfo);
958 break; 994 break;
959 default: 995 default:
960 err = -EINVAL; 996 err = -EINVAL;
@@ -962,7 +998,7 @@ static int exynos4_busfreq_pm_notifier_event(struct notifier_block *this,
962 if (err) 998 if (err)
963 goto unlock; 999 goto unlock;
964 1000
965 data->curr_opp = opp; 1001 data->curr_oppinfo = new_oppinfo;
966unlock: 1002unlock:
967 mutex_unlock(&data->lock); 1003 mutex_unlock(&data->lock);
968 if (err) 1004 if (err)
@@ -980,7 +1016,7 @@ unlock:
980 return NOTIFY_DONE; 1016 return NOTIFY_DONE;
981} 1017}
982 1018
983static __devinit int exynos4_busfreq_probe(struct platform_device *pdev) 1019static int exynos4_busfreq_probe(struct platform_device *pdev)
984{ 1020{
985 struct busfreq_data *data; 1021 struct busfreq_data *data;
986 struct opp *opp; 1022 struct opp *opp;
@@ -1027,13 +1063,17 @@ static __devinit int exynos4_busfreq_probe(struct platform_device *pdev)
1027 } 1063 }
1028 } 1064 }
1029 1065
1066 rcu_read_lock();
1030 opp = opp_find_freq_floor(dev, &exynos4_devfreq_profile.initial_freq); 1067 opp = opp_find_freq_floor(dev, &exynos4_devfreq_profile.initial_freq);
1031 if (IS_ERR(opp)) { 1068 if (IS_ERR(opp)) {
1069 rcu_read_unlock();
1032 dev_err(dev, "Invalid initial frequency %lu kHz.\n", 1070 dev_err(dev, "Invalid initial frequency %lu kHz.\n",
1033 exynos4_devfreq_profile.initial_freq); 1071 exynos4_devfreq_profile.initial_freq);
1034 return PTR_ERR(opp); 1072 return PTR_ERR(opp);
1035 } 1073 }
1036 data->curr_opp = opp; 1074 data->curr_oppinfo.rate = opp_get_freq(opp);
1075 data->curr_oppinfo.volt = opp_get_voltage(opp);
1076 rcu_read_unlock();
1037 1077
1038 platform_set_drvdata(pdev, data); 1078 platform_set_drvdata(pdev, data);
1039 1079
@@ -1056,7 +1096,7 @@ static __devinit int exynos4_busfreq_probe(struct platform_device *pdev)
1056 return 0; 1096 return 0;
1057} 1097}
1058 1098
1059static __devexit int exynos4_busfreq_remove(struct platform_device *pdev) 1099static int exynos4_busfreq_remove(struct platform_device *pdev)
1060{ 1100{
1061 struct busfreq_data *data = platform_get_drvdata(pdev); 1101 struct busfreq_data *data = platform_get_drvdata(pdev);
1062 1102
@@ -1087,7 +1127,7 @@ static const struct platform_device_id exynos4_busfreq_id[] = {
1087 1127
1088static struct platform_driver exynos4_busfreq_driver = { 1128static struct platform_driver exynos4_busfreq_driver = {
1089 .probe = exynos4_busfreq_probe, 1129 .probe = exynos4_busfreq_probe,
1090 .remove = __devexit_p(exynos4_busfreq_remove), 1130 .remove = exynos4_busfreq_remove,
1091 .id_table = exynos4_busfreq_id, 1131 .id_table = exynos4_busfreq_id,
1092 .driver = { 1132 .driver = {
1093 .name = "exynos4-busfreq", 1133 .name = "exynos4-busfreq",
diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index 8f0b111af4de..3e8ba02ba292 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -1634,7 +1634,7 @@ static int dw_probe(struct platform_device *pdev)
1634 return 0; 1634 return 0;
1635} 1635}
1636 1636
1637static int __devexit dw_remove(struct platform_device *pdev) 1637static int dw_remove(struct platform_device *pdev)
1638{ 1638{
1639 struct dw_dma *dw = platform_get_drvdata(pdev); 1639 struct dw_dma *dw = platform_get_drvdata(pdev);
1640 struct dw_dma_chan *dwc, *_dwc; 1640 struct dw_dma_chan *dwc, *_dwc;
diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
index 232b4583ae93..f424298f1ac5 100644
--- a/drivers/dma/edma.c
+++ b/drivers/dma/edma.c
@@ -585,7 +585,7 @@ err_reg1:
585 return ret; 585 return ret;
586} 586}
587 587
588static int __devexit edma_remove(struct platform_device *pdev) 588static int edma_remove(struct platform_device *pdev)
589{ 589{
590 struct device *dev = &pdev->dev; 590 struct device *dev = &pdev->dev;
591 struct edma_cc *ecc = dev_get_drvdata(dev); 591 struct edma_cc *ecc = dev_get_drvdata(dev);
diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
index dbf0e6f8de8a..a7dcf78b1ff8 100644
--- a/drivers/dma/imx-dma.c
+++ b/drivers/dma/imx-dma.c
@@ -684,9 +684,8 @@ static int imxdma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
684 break; 684 break;
685 } 685 }
686 686
687 imxdmac->hw_chaining = 1; 687 imxdmac->hw_chaining = 0;
688 if (!imxdma_hw_chain(imxdmac)) 688
689 return -EINVAL;
690 imxdmac->ccr_from_device = (mode | IMX_DMA_TYPE_FIFO) | 689 imxdmac->ccr_from_device = (mode | IMX_DMA_TYPE_FIFO) |
691 ((IMX_DMA_MEMSIZE_32 | IMX_DMA_TYPE_LINEAR) << 2) | 690 ((IMX_DMA_MEMSIZE_32 | IMX_DMA_TYPE_LINEAR) << 2) |
692 CCR_REN; 691 CCR_REN;
diff --git a/drivers/dma/intel_mid_dma.c b/drivers/dma/intel_mid_dma.c
index bc764afacd9b..a0de82e21a7c 100644
--- a/drivers/dma/intel_mid_dma.c
+++ b/drivers/dma/intel_mid_dma.c
@@ -1308,7 +1308,7 @@ err_enable_device:
1308 * Free up all resources and data 1308 * Free up all resources and data
1309 * Call shutdown_dma to complete contoller and chan cleanup 1309 * Call shutdown_dma to complete contoller and chan cleanup
1310 */ 1310 */
1311static void __devexit intel_mid_dma_remove(struct pci_dev *pdev) 1311static void intel_mid_dma_remove(struct pci_dev *pdev)
1312{ 1312{
1313 struct middma_device *device = pci_get_drvdata(pdev); 1313 struct middma_device *device = pci_get_drvdata(pdev);
1314 1314
diff --git a/drivers/dma/ioat/dca.c b/drivers/dma/ioat/dca.c
index d6668071bd0d..9b041858d10d 100644
--- a/drivers/dma/ioat/dca.c
+++ b/drivers/dma/ioat/dca.c
@@ -242,8 +242,7 @@ static struct dca_ops ioat_dca_ops = {
242}; 242};
243 243
244 244
245struct dca_provider * __devinit 245struct dca_provider *ioat_dca_init(struct pci_dev *pdev, void __iomem *iobase)
246ioat_dca_init(struct pci_dev *pdev, void __iomem *iobase)
247{ 246{
248 struct dca_provider *dca; 247 struct dca_provider *dca;
249 struct ioat_dca_priv *ioatdca; 248 struct ioat_dca_priv *ioatdca;
@@ -408,8 +407,7 @@ static int ioat2_dca_count_dca_slots(void __iomem *iobase, u16 dca_offset)
408 return slots; 407 return slots;
409} 408}
410 409
411struct dca_provider * __devinit 410struct dca_provider *ioat2_dca_init(struct pci_dev *pdev, void __iomem *iobase)
412ioat2_dca_init(struct pci_dev *pdev, void __iomem *iobase)
413{ 411{
414 struct dca_provider *dca; 412 struct dca_provider *dca;
415 struct ioat_dca_priv *ioatdca; 413 struct ioat_dca_priv *ioatdca;
@@ -621,8 +619,7 @@ static inline int dca3_tag_map_invalid(u8 *tag_map)
621 (tag_map[4] == DCA_TAG_MAP_VALID)); 619 (tag_map[4] == DCA_TAG_MAP_VALID));
622} 620}
623 621
624struct dca_provider * __devinit 622struct dca_provider *ioat3_dca_init(struct pci_dev *pdev, void __iomem *iobase)
625ioat3_dca_init(struct pci_dev *pdev, void __iomem *iobase)
626{ 623{
627 struct dca_provider *dca; 624 struct dca_provider *dca;
628 struct ioat_dca_priv *ioatdca; 625 struct ioat_dca_priv *ioatdca;
diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c
index 73b2b65cb1de..1a68a8ba87e6 100644
--- a/drivers/dma/ioat/dma.c
+++ b/drivers/dma/ioat/dma.c
@@ -782,7 +782,7 @@ static void ioat1_dma_start_null_desc(struct ioat_dma_chan *ioat)
782 */ 782 */
783#define IOAT_TEST_SIZE 2000 783#define IOAT_TEST_SIZE 2000
784 784
785static void __devinit ioat_dma_test_callback(void *dma_async_param) 785static void ioat_dma_test_callback(void *dma_async_param)
786{ 786{
787 struct completion *cmp = dma_async_param; 787 struct completion *cmp = dma_async_param;
788 788
@@ -793,7 +793,7 @@ static void __devinit ioat_dma_test_callback(void *dma_async_param)
793 * ioat_dma_self_test - Perform a IOAT transaction to verify the HW works. 793 * ioat_dma_self_test - Perform a IOAT transaction to verify the HW works.
794 * @device: device to be tested 794 * @device: device to be tested
795 */ 795 */
796int __devinit ioat_dma_self_test(struct ioatdma_device *device) 796int ioat_dma_self_test(struct ioatdma_device *device)
797{ 797{
798 int i; 798 int i;
799 u8 *src; 799 u8 *src;
@@ -994,7 +994,7 @@ static void ioat_disable_interrupts(struct ioatdma_device *device)
994 writeb(0, device->reg_base + IOAT_INTRCTRL_OFFSET); 994 writeb(0, device->reg_base + IOAT_INTRCTRL_OFFSET);
995} 995}
996 996
997int __devinit ioat_probe(struct ioatdma_device *device) 997int ioat_probe(struct ioatdma_device *device)
998{ 998{
999 int err = -ENODEV; 999 int err = -ENODEV;
1000 struct dma_device *dma = &device->common; 1000 struct dma_device *dma = &device->common;
@@ -1049,7 +1049,7 @@ err_dma_pool:
1049 return err; 1049 return err;
1050} 1050}
1051 1051
1052int __devinit ioat_register(struct ioatdma_device *device) 1052int ioat_register(struct ioatdma_device *device)
1053{ 1053{
1054 int err = dma_async_device_register(&device->common); 1054 int err = dma_async_device_register(&device->common);
1055 1055
@@ -1183,7 +1183,7 @@ void ioat_kobject_del(struct ioatdma_device *device)
1183 } 1183 }
1184} 1184}
1185 1185
1186int __devinit ioat1_dma_probe(struct ioatdma_device *device, int dca) 1186int ioat1_dma_probe(struct ioatdma_device *device, int dca)
1187{ 1187{
1188 struct pci_dev *pdev = device->pdev; 1188 struct pci_dev *pdev = device->pdev;
1189 struct dma_device *dma; 1189 struct dma_device *dma;
@@ -1216,7 +1216,7 @@ int __devinit ioat1_dma_probe(struct ioatdma_device *device, int dca)
1216 return err; 1216 return err;
1217} 1217}
1218 1218
1219void __devexit ioat_dma_remove(struct ioatdma_device *device) 1219void ioat_dma_remove(struct ioatdma_device *device)
1220{ 1220{
1221 struct dma_device *dma = &device->common; 1221 struct dma_device *dma = &device->common;
1222 1222
diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h
index 5e8fe01ba69d..087935f1565f 100644
--- a/drivers/dma/ioat/dma.h
+++ b/drivers/dma/ioat/dma.h
@@ -303,13 +303,12 @@ static inline void ioat_unmap(struct pci_dev *pdev, dma_addr_t addr, size_t len,
303 pci_unmap_page(pdev, addr, len, direction); 303 pci_unmap_page(pdev, addr, len, direction);
304} 304}
305 305
306int __devinit ioat_probe(struct ioatdma_device *device); 306int ioat_probe(struct ioatdma_device *device);
307int __devinit ioat_register(struct ioatdma_device *device); 307int ioat_register(struct ioatdma_device *device);
308int __devinit ioat1_dma_probe(struct ioatdma_device *dev, int dca); 308int ioat1_dma_probe(struct ioatdma_device *dev, int dca);
309int __devinit ioat_dma_self_test(struct ioatdma_device *device); 309int ioat_dma_self_test(struct ioatdma_device *device);
310void __devexit ioat_dma_remove(struct ioatdma_device *device); 310void ioat_dma_remove(struct ioatdma_device *device);
311struct dca_provider * __devinit ioat_dca_init(struct pci_dev *pdev, 311struct dca_provider *ioat_dca_init(struct pci_dev *pdev, void __iomem *iobase);
312 void __iomem *iobase);
313dma_addr_t ioat_get_current_completion(struct ioat_chan_common *chan); 312dma_addr_t ioat_get_current_completion(struct ioat_chan_common *chan);
314void ioat_init_channel(struct ioatdma_device *device, 313void ioat_init_channel(struct ioatdma_device *device,
315 struct ioat_chan_common *chan, int idx); 314 struct ioat_chan_common *chan, int idx);
diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c
index b9d667851445..82d4e306c32e 100644
--- a/drivers/dma/ioat/dma_v2.c
+++ b/drivers/dma/ioat/dma_v2.c
@@ -862,7 +862,7 @@ struct kobj_type ioat2_ktype = {
862 .default_attrs = ioat2_attrs, 862 .default_attrs = ioat2_attrs,
863}; 863};
864 864
865int __devinit ioat2_dma_probe(struct ioatdma_device *device, int dca) 865int ioat2_dma_probe(struct ioatdma_device *device, int dca)
866{ 866{
867 struct pci_dev *pdev = device->pdev; 867 struct pci_dev *pdev = device->pdev;
868 struct dma_device *dma; 868 struct dma_device *dma;
diff --git a/drivers/dma/ioat/dma_v2.h b/drivers/dma/ioat/dma_v2.h
index be2a55b95c23..e100f644e344 100644
--- a/drivers/dma/ioat/dma_v2.h
+++ b/drivers/dma/ioat/dma_v2.h
@@ -155,10 +155,10 @@ static inline void ioat2_set_chainaddr(struct ioat2_dma_chan *ioat, u64 addr)
155 chan->reg_base + IOAT2_CHAINADDR_OFFSET_HIGH); 155 chan->reg_base + IOAT2_CHAINADDR_OFFSET_HIGH);
156} 156}
157 157
158int __devinit ioat2_dma_probe(struct ioatdma_device *dev, int dca); 158int ioat2_dma_probe(struct ioatdma_device *dev, int dca);
159int __devinit ioat3_dma_probe(struct ioatdma_device *dev, int dca); 159int ioat3_dma_probe(struct ioatdma_device *dev, int dca);
160struct dca_provider * __devinit ioat2_dca_init(struct pci_dev *pdev, void __iomem *iobase); 160struct dca_provider *ioat2_dca_init(struct pci_dev *pdev, void __iomem *iobase);
161struct dca_provider * __devinit ioat3_dca_init(struct pci_dev *pdev, void __iomem *iobase); 161struct dca_provider *ioat3_dca_init(struct pci_dev *pdev, void __iomem *iobase);
162int ioat2_check_space_lock(struct ioat2_dma_chan *ioat, int num_descs); 162int ioat2_check_space_lock(struct ioat2_dma_chan *ioat, int num_descs);
163int ioat2_enumerate_channels(struct ioatdma_device *device); 163int ioat2_enumerate_channels(struct ioatdma_device *device);
164struct dma_async_tx_descriptor * 164struct dma_async_tx_descriptor *
diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c
index f7f1dc62c15c..3e9d66920eb3 100644
--- a/drivers/dma/ioat/dma_v3.c
+++ b/drivers/dma/ioat/dma_v3.c
@@ -836,7 +836,7 @@ ioat3_prep_interrupt_lock(struct dma_chan *c, unsigned long flags)
836 return &desc->txd; 836 return &desc->txd;
837} 837}
838 838
839static void __devinit ioat3_dma_test_callback(void *dma_async_param) 839static void ioat3_dma_test_callback(void *dma_async_param)
840{ 840{
841 struct completion *cmp = dma_async_param; 841 struct completion *cmp = dma_async_param;
842 842
@@ -844,7 +844,7 @@ static void __devinit ioat3_dma_test_callback(void *dma_async_param)
844} 844}
845 845
846#define IOAT_NUM_SRC_TEST 6 /* must be <= 8 */ 846#define IOAT_NUM_SRC_TEST 6 /* must be <= 8 */
847static int __devinit ioat_xor_val_self_test(struct ioatdma_device *device) 847static int ioat_xor_val_self_test(struct ioatdma_device *device)
848{ 848{
849 int i, src_idx; 849 int i, src_idx;
850 struct page *dest; 850 struct page *dest;
@@ -951,7 +951,7 @@ static int __devinit ioat_xor_val_self_test(struct ioatdma_device *device)
951 goto free_resources; 951 goto free_resources;
952 } 952 }
953 } 953 }
954 dma_sync_single_for_device(dev, dest_dma, PAGE_SIZE, DMA_TO_DEVICE); 954 dma_sync_single_for_device(dev, dest_dma, PAGE_SIZE, DMA_FROM_DEVICE);
955 955
956 /* skip validate if the capability is not present */ 956 /* skip validate if the capability is not present */
957 if (!dma_has_cap(DMA_XOR_VAL, dma_chan->device->cap_mask)) 957 if (!dma_has_cap(DMA_XOR_VAL, dma_chan->device->cap_mask))
@@ -1096,7 +1096,7 @@ out:
1096 return err; 1096 return err;
1097} 1097}
1098 1098
1099static int __devinit ioat3_dma_self_test(struct ioatdma_device *device) 1099static int ioat3_dma_self_test(struct ioatdma_device *device)
1100{ 1100{
1101 int rc = ioat_dma_self_test(device); 1101 int rc = ioat_dma_self_test(device);
1102 1102
@@ -1187,7 +1187,7 @@ static bool is_snb_ioat(struct pci_dev *pdev)
1187 } 1187 }
1188} 1188}
1189 1189
1190int __devinit ioat3_dma_probe(struct ioatdma_device *device, int dca) 1190int ioat3_dma_probe(struct ioatdma_device *device, int dca)
1191{ 1191{
1192 struct pci_dev *pdev = device->pdev; 1192 struct pci_dev *pdev = device->pdev;
1193 int dca_en = system_has_dca_enabled(pdev); 1193 int dca_en = system_has_dca_enabled(pdev);
diff --git a/drivers/dma/ioat/pci.c b/drivers/dma/ioat/pci.c
index bfa9a3536e09..4f686c527ab6 100644
--- a/drivers/dma/ioat/pci.c
+++ b/drivers/dma/ioat/pci.c
@@ -109,9 +109,8 @@ static struct pci_device_id ioat_pci_tbl[] = {
109}; 109};
110MODULE_DEVICE_TABLE(pci, ioat_pci_tbl); 110MODULE_DEVICE_TABLE(pci, ioat_pci_tbl);
111 111
112static int __devinit ioat_pci_probe(struct pci_dev *pdev, 112static int ioat_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id);
113 const struct pci_device_id *id); 113static void ioat_remove(struct pci_dev *pdev);
114static void __devexit ioat_remove(struct pci_dev *pdev);
115 114
116static int ioat_dca_enabled = 1; 115static int ioat_dca_enabled = 1;
117module_param(ioat_dca_enabled, int, 0644); 116module_param(ioat_dca_enabled, int, 0644);
@@ -141,7 +140,7 @@ alloc_ioatdma(struct pci_dev *pdev, void __iomem *iobase)
141 return d; 140 return d;
142} 141}
143 142
144static int __devinit ioat_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) 143static int ioat_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
145{ 144{
146 void __iomem * const *iomap; 145 void __iomem * const *iomap;
147 struct device *dev = &pdev->dev; 146 struct device *dev = &pdev->dev;
@@ -195,7 +194,7 @@ static int __devinit ioat_pci_probe(struct pci_dev *pdev, const struct pci_devic
195 return 0; 194 return 0;
196} 195}
197 196
198static void __devexit ioat_remove(struct pci_dev *pdev) 197static void ioat_remove(struct pci_dev *pdev)
199{ 198{
200 struct ioatdma_device *device = pci_get_drvdata(pdev); 199 struct ioatdma_device *device = pci_get_drvdata(pdev);
201 200
diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c
index 9072e173b860..eacb8be99812 100644
--- a/drivers/dma/iop-adma.c
+++ b/drivers/dma/iop-adma.c
@@ -1406,7 +1406,7 @@ out:
1406} 1406}
1407#endif 1407#endif
1408 1408
1409static int __devexit iop_adma_remove(struct platform_device *dev) 1409static int iop_adma_remove(struct platform_device *dev)
1410{ 1410{
1411 struct iop_adma_device *device = platform_get_drvdata(dev); 1411 struct iop_adma_device *device = platform_get_drvdata(dev);
1412 struct dma_chan *chan, *_chan; 1412 struct dma_chan *chan, *_chan;
diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c
index 13bdf4a7e1ec..c6d98c00f05c 100644
--- a/drivers/dma/mmp_pdma.c
+++ b/drivers/dma/mmp_pdma.c
@@ -712,7 +712,7 @@ static void dma_do_tasklet(unsigned long data)
712 } 712 }
713} 713}
714 714
715static int __devexit mmp_pdma_remove(struct platform_device *op) 715static int mmp_pdma_remove(struct platform_device *op)
716{ 716{
717 struct mmp_pdma_device *pdev = platform_get_drvdata(op); 717 struct mmp_pdma_device *pdev = platform_get_drvdata(op);
718 718
diff --git a/drivers/dma/mmp_tdma.c b/drivers/dma/mmp_tdma.c
index 323821c0c095..a9f1cd56689c 100644
--- a/drivers/dma/mmp_tdma.c
+++ b/drivers/dma/mmp_tdma.c
@@ -467,7 +467,7 @@ static void mmp_tdma_issue_pending(struct dma_chan *chan)
467 mmp_tdma_enable_chan(tdmac); 467 mmp_tdma_enable_chan(tdmac);
468} 468}
469 469
470static int __devexit mmp_tdma_remove(struct platform_device *pdev) 470static int mmp_tdma_remove(struct platform_device *pdev)
471{ 471{
472 struct mmp_tdma_device *tdev = platform_get_drvdata(pdev); 472 struct mmp_tdma_device *tdev = platform_get_drvdata(pdev);
473 473
diff --git a/drivers/dma/mpc512x_dma.c b/drivers/dma/mpc512x_dma.c
index 2cd024a91d40..2d956732aa3d 100644
--- a/drivers/dma/mpc512x_dma.c
+++ b/drivers/dma/mpc512x_dma.c
@@ -799,7 +799,7 @@ static int mpc_dma_probe(struct platform_device *op)
799 return retval; 799 return retval;
800} 800}
801 801
802static int __devexit mpc_dma_remove(struct platform_device *op) 802static int mpc_dma_remove(struct platform_device *op)
803{ 803{
804 struct device *dev = &op->dev; 804 struct device *dev = &op->dev;
805 struct mpc_dma *mdma = dev_get_drvdata(dev); 805 struct mpc_dma *mdma = dev_get_drvdata(dev);
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index ac71f555dd72..e17fad03cb80 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -1361,13 +1361,16 @@ static int mv_xor_probe(struct platform_device *pdev)
1361err_channel_add: 1361err_channel_add:
1362 for (i = 0; i < MV_XOR_MAX_CHANNELS; i++) 1362 for (i = 0; i < MV_XOR_MAX_CHANNELS; i++)
1363 if (xordev->channels[i]) { 1363 if (xordev->channels[i]) {
1364 mv_xor_channel_remove(xordev->channels[i]);
1364 if (pdev->dev.of_node) 1365 if (pdev->dev.of_node)
1365 irq_dispose_mapping(xordev->channels[i]->irq); 1366 irq_dispose_mapping(xordev->channels[i]->irq);
1366 mv_xor_channel_remove(xordev->channels[i]);
1367 } 1367 }
1368 1368
1369 clk_disable_unprepare(xordev->clk); 1369 if (!IS_ERR(xordev->clk)) {
1370 clk_put(xordev->clk); 1370 clk_disable_unprepare(xordev->clk);
1371 clk_put(xordev->clk);
1372 }
1373
1371 return ret; 1374 return ret;
1372} 1375}
1373 1376
diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c
index eca1c4ddf039..3f2617255ef2 100644
--- a/drivers/dma/pch_dma.c
+++ b/drivers/dma/pch_dma.c
@@ -961,7 +961,7 @@ err_free_mem:
961 return err; 961 return err;
962} 962}
963 963
964static void __devexit pch_dma_remove(struct pci_dev *pdev) 964static void pch_dma_remove(struct pci_dev *pdev)
965{ 965{
966 struct pch_dma *pd = pci_get_drvdata(pdev); 966 struct pch_dma *pd = pci_get_drvdata(pdev);
967 struct pch_dma_chan *pd_chan; 967 struct pch_dma_chan *pd_chan;
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 95555f37ea6d..80680eee0171 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -2988,7 +2988,7 @@ probe_err1:
2988 return ret; 2988 return ret;
2989} 2989}
2990 2990
2991static int __devexit pl330_remove(struct amba_device *adev) 2991static int pl330_remove(struct amba_device *adev)
2992{ 2992{
2993 struct dma_pl330_dmac *pdmac = amba_get_drvdata(adev); 2993 struct dma_pl330_dmac *pdmac = amba_get_drvdata(adev);
2994 struct dma_pl330_chan *pch, *_p; 2994 struct dma_pl330_chan *pch, *_p;
diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c
index b94afc339e7f..5d3d95569a1e 100644
--- a/drivers/dma/ppc4xx/adma.c
+++ b/drivers/dma/ppc4xx/adma.c
@@ -4592,7 +4592,7 @@ out:
4592/** 4592/**
4593 * ppc440spe_adma_remove - remove the asynch device 4593 * ppc440spe_adma_remove - remove the asynch device
4594 */ 4594 */
4595static int __devexit ppc440spe_adma_remove(struct platform_device *ofdev) 4595static int ppc440spe_adma_remove(struct platform_device *ofdev)
4596{ 4596{
4597 struct ppc440spe_adma_device *adev = dev_get_drvdata(&ofdev->dev); 4597 struct ppc440spe_adma_device *adev = dev_get_drvdata(&ofdev->dev);
4598 struct device_node *np = ofdev->dev.of_node; 4598 struct device_node *np = ofdev->dev.of_node;
@@ -4905,7 +4905,7 @@ out_free:
4905 return ret; 4905 return ret;
4906} 4906}
4907 4907
4908static const struct of_device_id ppc440spe_adma_of_match[] __devinitconst = { 4908static const struct of_device_id ppc440spe_adma_of_match[] = {
4909 { .compatible = "ibm,dma-440spe", }, 4909 { .compatible = "ibm,dma-440spe", },
4910 { .compatible = "amcc,xor-accelerator", }, 4910 { .compatible = "amcc,xor-accelerator", },
4911 {}, 4911 {},
diff --git a/drivers/dma/sa11x0-dma.c b/drivers/dma/sa11x0-dma.c
index 2ad628df8223..461a91ab70bb 100644
--- a/drivers/dma/sa11x0-dma.c
+++ b/drivers/dma/sa11x0-dma.c
@@ -967,7 +967,7 @@ static int sa11x0_dma_probe(struct platform_device *pdev)
967 return ret; 967 return ret;
968} 968}
969 969
970static int __devexit sa11x0_dma_remove(struct platform_device *pdev) 970static int sa11x0_dma_remove(struct platform_device *pdev)
971{ 971{
972 struct sa11x0_dma_dev *d = platform_get_drvdata(pdev); 972 struct sa11x0_dma_dev *d = platform_get_drvdata(pdev);
973 unsigned pch; 973 unsigned pch;
diff --git a/drivers/dma/sh/shdma.c b/drivers/dma/sh/shdma.c
index 8201bb4e0cd7..3315e4be9b85 100644
--- a/drivers/dma/sh/shdma.c
+++ b/drivers/dma/sh/shdma.c
@@ -880,7 +880,7 @@ ermrdmars:
880 return err; 880 return err;
881} 881}
882 882
883static int __devexit sh_dmae_remove(struct platform_device *pdev) 883static int sh_dmae_remove(struct platform_device *pdev)
884{ 884{
885 struct sh_dmae_device *shdev = platform_get_drvdata(pdev); 885 struct sh_dmae_device *shdev = platform_get_drvdata(pdev);
886 struct dma_device *dma_dev = &shdev->shdma_dev.dma_dev; 886 struct dma_device *dma_dev = &shdev->shdma_dev.dma_dev;
diff --git a/drivers/dma/sirf-dma.c b/drivers/dma/sirf-dma.c
index c3de6edb9651..94674a96c646 100644
--- a/drivers/dma/sirf-dma.c
+++ b/drivers/dma/sirf-dma.c
@@ -655,7 +655,7 @@ irq_dispose:
655 return ret; 655 return ret;
656} 656}
657 657
658static int __devexit sirfsoc_dma_remove(struct platform_device *op) 658static int sirfsoc_dma_remove(struct platform_device *op)
659{ 659{
660 struct device *dev = &op->dev; 660 struct device *dev = &op->dev;
661 struct sirfsoc_dma *sdma = dev_get_drvdata(dev); 661 struct sirfsoc_dma *sdma = dev_get_drvdata(dev);
diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
index efdfffa13349..3cad856fe67f 100644
--- a/drivers/dma/tegra20-apb-dma.c
+++ b/drivers/dma/tegra20-apb-dma.c
@@ -266,6 +266,7 @@ static struct tegra_dma_desc *tegra_dma_desc_get(
266 if (async_tx_test_ack(&dma_desc->txd)) { 266 if (async_tx_test_ack(&dma_desc->txd)) {
267 list_del(&dma_desc->node); 267 list_del(&dma_desc->node);
268 spin_unlock_irqrestore(&tdc->lock, flags); 268 spin_unlock_irqrestore(&tdc->lock, flags);
269 dma_desc->txd.flags = 0;
269 return dma_desc; 270 return dma_desc;
270 } 271 }
271 } 272 }
@@ -1050,7 +1051,9 @@ struct dma_async_tx_descriptor *tegra_dma_prep_dma_cyclic(
1050 TEGRA_APBDMA_AHBSEQ_WRAP_SHIFT; 1051 TEGRA_APBDMA_AHBSEQ_WRAP_SHIFT;
1051 ahb_seq |= TEGRA_APBDMA_AHBSEQ_BUS_WIDTH_32; 1052 ahb_seq |= TEGRA_APBDMA_AHBSEQ_BUS_WIDTH_32;
1052 1053
1053 csr |= TEGRA_APBDMA_CSR_FLOW | TEGRA_APBDMA_CSR_IE_EOC; 1054 csr |= TEGRA_APBDMA_CSR_FLOW;
1055 if (flags & DMA_PREP_INTERRUPT)
1056 csr |= TEGRA_APBDMA_CSR_IE_EOC;
1054 csr |= tdc->dma_sconfig.slave_id << TEGRA_APBDMA_CSR_REQ_SEL_SHIFT; 1057 csr |= tdc->dma_sconfig.slave_id << TEGRA_APBDMA_CSR_REQ_SEL_SHIFT;
1055 1058
1056 apb_seq |= TEGRA_APBDMA_APBSEQ_WRAP_WORD_1; 1059 apb_seq |= TEGRA_APBDMA_APBSEQ_WRAP_WORD_1;
@@ -1095,7 +1098,8 @@ struct dma_async_tx_descriptor *tegra_dma_prep_dma_cyclic(
1095 mem += len; 1098 mem += len;
1096 } 1099 }
1097 sg_req->last_sg = true; 1100 sg_req->last_sg = true;
1098 dma_desc->txd.flags = 0; 1101 if (flags & DMA_CTRL_ACK)
1102 dma_desc->txd.flags = DMA_CTRL_ACK;
1099 1103
1100 /* 1104 /*
1101 * Make sure that mode should not be conflicting with currently 1105 * Make sure that mode should not be conflicting with currently
@@ -1184,7 +1188,7 @@ static const struct tegra_dma_chip_data tegra30_dma_chip_data = {
1184 .max_dma_count = 1024UL * 64, 1188 .max_dma_count = 1024UL * 64,
1185}; 1189};
1186 1190
1187static const struct of_device_id tegra_dma_of_match[] __devinitconst = { 1191static const struct of_device_id tegra_dma_of_match[] = {
1188 { 1192 {
1189 .compatible = "nvidia,tegra30-apbdma", 1193 .compatible = "nvidia,tegra30-apbdma",
1190 .data = &tegra30_dma_chip_data, 1194 .data = &tegra30_dma_chip_data,
@@ -1360,7 +1364,7 @@ err_pm_disable:
1360 return ret; 1364 return ret;
1361} 1365}
1362 1366
1363static int __devexit tegra_dma_remove(struct platform_device *pdev) 1367static int tegra_dma_remove(struct platform_device *pdev)
1364{ 1368{
1365 struct tegra_dma *tdma = platform_get_drvdata(pdev); 1369 struct tegra_dma *tdma = platform_get_drvdata(pdev);
1366 int i; 1370 int i;
@@ -1403,7 +1407,7 @@ static int tegra_dma_runtime_resume(struct device *dev)
1403 return 0; 1407 return 0;
1404} 1408}
1405 1409
1406static const struct dev_pm_ops tegra_dma_dev_pm_ops __devinitconst = { 1410static const struct dev_pm_ops tegra_dma_dev_pm_ops = {
1407#ifdef CONFIG_PM_RUNTIME 1411#ifdef CONFIG_PM_RUNTIME
1408 .runtime_suspend = tegra_dma_runtime_suspend, 1412 .runtime_suspend = tegra_dma_runtime_suspend,
1409 .runtime_resume = tegra_dma_runtime_resume, 1413 .runtime_resume = tegra_dma_runtime_resume,
diff --git a/drivers/dma/timb_dma.c b/drivers/dma/timb_dma.c
index 98cf51e1544c..952f823901a6 100644
--- a/drivers/dma/timb_dma.c
+++ b/drivers/dma/timb_dma.c
@@ -798,7 +798,7 @@ err_release_region:
798 798
799} 799}
800 800
801static int __devexit td_remove(struct platform_device *pdev) 801static int td_remove(struct platform_device *pdev)
802{ 802{
803 struct timb_dma *td = platform_get_drvdata(pdev); 803 struct timb_dma *td = platform_get_drvdata(pdev);
804 struct resource *iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 804 struct resource *iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
diff --git a/drivers/edac/Kconfig b/drivers/edac/Kconfig
index 4c6c876d9dc3..66719925970f 100644
--- a/drivers/edac/Kconfig
+++ b/drivers/edac/Kconfig
@@ -4,6 +4,9 @@
4# Licensed and distributed under the GPL 4# Licensed and distributed under the GPL
5# 5#
6 6
7config EDAC_SUPPORT
8 bool
9
7menuconfig EDAC 10menuconfig EDAC
8 bool "EDAC (Error Detection And Correction) reporting" 11 bool "EDAC (Error Detection And Correction) reporting"
9 depends on HAS_IOMEM 12 depends on HAS_IOMEM
@@ -27,13 +30,8 @@ menuconfig EDAC
27 There is also a mailing list for the EDAC project, which can 30 There is also a mailing list for the EDAC project, which can
28 be found via the sourceforge page. 31 be found via the sourceforge page.
29 32
30config EDAC_SUPPORT
31 bool
32
33if EDAC 33if EDAC
34 34
35comment "Reporting subsystems"
36
37config EDAC_LEGACY_SYSFS 35config EDAC_LEGACY_SYSFS
38 bool "EDAC legacy sysfs" 36 bool "EDAC legacy sysfs"
39 default y 37 default y
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index f74a684269ff..ad8bf2aa629d 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -2563,8 +2563,8 @@ err_ret:
2563 return ret; 2563 return ret;
2564} 2564}
2565 2565
2566static int __devinit amd64_probe_one_instance(struct pci_dev *pdev, 2566static int amd64_probe_one_instance(struct pci_dev *pdev,
2567 const struct pci_device_id *mc_type) 2567 const struct pci_device_id *mc_type)
2568{ 2568{
2569 u8 nid = get_node_id(pdev); 2569 u8 nid = get_node_id(pdev);
2570 struct pci_dev *F3 = node_to_amd_nb(nid)->misc; 2570 struct pci_dev *F3 = node_to_amd_nb(nid)->misc;
@@ -2612,7 +2612,7 @@ err_out:
2612 return ret; 2612 return ret;
2613} 2613}
2614 2614
2615static void __devexit amd64_remove_one_instance(struct pci_dev *pdev) 2615static void amd64_remove_one_instance(struct pci_dev *pdev)
2616{ 2616{
2617 struct mem_ctl_info *mci; 2617 struct mem_ctl_info *mci;
2618 struct amd64_pvt *pvt; 2618 struct amd64_pvt *pvt;
@@ -2686,7 +2686,7 @@ MODULE_DEVICE_TABLE(pci, amd64_pci_table);
2686static struct pci_driver amd64_pci_driver = { 2686static struct pci_driver amd64_pci_driver = {
2687 .name = EDAC_MOD_STR, 2687 .name = EDAC_MOD_STR,
2688 .probe = amd64_probe_one_instance, 2688 .probe = amd64_probe_one_instance,
2689 .remove = __devexit_p(amd64_remove_one_instance), 2689 .remove = amd64_remove_one_instance,
2690 .id_table = amd64_pci_table, 2690 .id_table = amd64_pci_table,
2691}; 2691};
2692 2692
diff --git a/drivers/edac/amd76x_edac.c b/drivers/edac/amd76x_edac.c
index 29eeb68a200c..96e3ee3460a5 100644
--- a/drivers/edac/amd76x_edac.c
+++ b/drivers/edac/amd76x_edac.c
@@ -301,8 +301,8 @@ fail:
301} 301}
302 302
303/* returns count (>= 0), or negative on error */ 303/* returns count (>= 0), or negative on error */
304static int __devinit amd76x_init_one(struct pci_dev *pdev, 304static int amd76x_init_one(struct pci_dev *pdev,
305 const struct pci_device_id *ent) 305 const struct pci_device_id *ent)
306{ 306{
307 edac_dbg(0, "\n"); 307 edac_dbg(0, "\n");
308 308
@@ -318,7 +318,7 @@ static int __devinit amd76x_init_one(struct pci_dev *pdev,
318 * structure for the device then delete the mci and free the 318 * structure for the device then delete the mci and free the
319 * resources. 319 * resources.
320 */ 320 */
321static void __devexit amd76x_remove_one(struct pci_dev *pdev) 321static void amd76x_remove_one(struct pci_dev *pdev)
322{ 322{
323 struct mem_ctl_info *mci; 323 struct mem_ctl_info *mci;
324 324
@@ -350,7 +350,7 @@ MODULE_DEVICE_TABLE(pci, amd76x_pci_tbl);
350static struct pci_driver amd76x_driver = { 350static struct pci_driver amd76x_driver = {
351 .name = EDAC_MOD_STR, 351 .name = EDAC_MOD_STR,
352 .probe = amd76x_init_one, 352 .probe = amd76x_init_one,
353 .remove = __devexit_p(amd76x_remove_one), 353 .remove = amd76x_remove_one,
354 .id_table = amd76x_pci_tbl, 354 .id_table = amd76x_pci_tbl,
355}; 355};
356 356
diff --git a/drivers/edac/cell_edac.c b/drivers/edac/cell_edac.c
index a1bbd8edd257..c2eaf334b90b 100644
--- a/drivers/edac/cell_edac.c
+++ b/drivers/edac/cell_edac.c
@@ -124,7 +124,7 @@ static void cell_edac_check(struct mem_ctl_info *mci)
124 } 124 }
125} 125}
126 126
127static void __devinit cell_edac_init_csrows(struct mem_ctl_info *mci) 127static void cell_edac_init_csrows(struct mem_ctl_info *mci)
128{ 128{
129 struct csrow_info *csrow = mci->csrows[0]; 129 struct csrow_info *csrow = mci->csrows[0];
130 struct dimm_info *dimm; 130 struct dimm_info *dimm;
@@ -164,7 +164,7 @@ static void __devinit cell_edac_init_csrows(struct mem_ctl_info *mci)
164 } 164 }
165} 165}
166 166
167static int __devinit cell_edac_probe(struct platform_device *pdev) 167static int cell_edac_probe(struct platform_device *pdev)
168{ 168{
169 struct cbe_mic_tm_regs __iomem *regs; 169 struct cbe_mic_tm_regs __iomem *regs;
170 struct mem_ctl_info *mci; 170 struct mem_ctl_info *mci;
@@ -233,7 +233,7 @@ static int __devinit cell_edac_probe(struct platform_device *pdev)
233 return 0; 233 return 0;
234} 234}
235 235
236static int __devexit cell_edac_remove(struct platform_device *pdev) 236static int cell_edac_remove(struct platform_device *pdev)
237{ 237{
238 struct mem_ctl_info *mci = edac_mc_del_mc(&pdev->dev); 238 struct mem_ctl_info *mci = edac_mc_del_mc(&pdev->dev);
239 if (mci) 239 if (mci)
@@ -247,7 +247,7 @@ static struct platform_driver cell_edac_driver = {
247 .owner = THIS_MODULE, 247 .owner = THIS_MODULE,
248 }, 248 },
249 .probe = cell_edac_probe, 249 .probe = cell_edac_probe,
250 .remove = __devexit_p(cell_edac_remove), 250 .remove = cell_edac_remove,
251}; 251};
252 252
253static int __init cell_edac_init(void) 253static int __init cell_edac_init(void)
diff --git a/drivers/edac/cpc925_edac.c b/drivers/edac/cpc925_edac.c
index c2ef13495873..7f3c57113ba1 100644
--- a/drivers/edac/cpc925_edac.c
+++ b/drivers/edac/cpc925_edac.c
@@ -932,7 +932,7 @@ static int cpc925_mc_get_channels(void __iomem *vbase)
932 return dual; 932 return dual;
933} 933}
934 934
935static int __devinit cpc925_probe(struct platform_device *pdev) 935static int cpc925_probe(struct platform_device *pdev)
936{ 936{
937 static int edac_mc_idx; 937 static int edac_mc_idx;
938 struct mem_ctl_info *mci; 938 struct mem_ctl_info *mci;
diff --git a/drivers/edac/e752x_edac.c b/drivers/edac/e752x_edac.c
index a5ed6b795fd4..644fec54681f 100644
--- a/drivers/edac/e752x_edac.c
+++ b/drivers/edac/e752x_edac.c
@@ -1390,8 +1390,7 @@ fail:
1390} 1390}
1391 1391
1392/* returns count (>= 0), or negative on error */ 1392/* returns count (>= 0), or negative on error */
1393static int __devinit e752x_init_one(struct pci_dev *pdev, 1393static int e752x_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1394 const struct pci_device_id *ent)
1395{ 1394{
1396 edac_dbg(0, "\n"); 1395 edac_dbg(0, "\n");
1397 1396
@@ -1402,7 +1401,7 @@ static int __devinit e752x_init_one(struct pci_dev *pdev,
1402 return e752x_probe1(pdev, ent->driver_data); 1401 return e752x_probe1(pdev, ent->driver_data);
1403} 1402}
1404 1403
1405static void __devexit e752x_remove_one(struct pci_dev *pdev) 1404static void e752x_remove_one(struct pci_dev *pdev)
1406{ 1405{
1407 struct mem_ctl_info *mci; 1406 struct mem_ctl_info *mci;
1408 struct e752x_pvt *pvt; 1407 struct e752x_pvt *pvt;
@@ -1445,7 +1444,7 @@ MODULE_DEVICE_TABLE(pci, e752x_pci_tbl);
1445static struct pci_driver e752x_driver = { 1444static struct pci_driver e752x_driver = {
1446 .name = EDAC_MOD_STR, 1445 .name = EDAC_MOD_STR,
1447 .probe = e752x_init_one, 1446 .probe = e752x_init_one,
1448 .remove = __devexit_p(e752x_remove_one), 1447 .remove = e752x_remove_one,
1449 .id_table = e752x_pci_tbl, 1448 .id_table = e752x_pci_tbl,
1450}; 1449};
1451 1450
diff --git a/drivers/edac/e7xxx_edac.c b/drivers/edac/e7xxx_edac.c
index 9ff57f361a43..1c4056a50383 100644
--- a/drivers/edac/e7xxx_edac.c
+++ b/drivers/edac/e7xxx_edac.c
@@ -528,8 +528,7 @@ fail0:
528} 528}
529 529
530/* returns count (>= 0), or negative on error */ 530/* returns count (>= 0), or negative on error */
531static int __devinit e7xxx_init_one(struct pci_dev *pdev, 531static int e7xxx_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
532 const struct pci_device_id *ent)
533{ 532{
534 edac_dbg(0, "\n"); 533 edac_dbg(0, "\n");
535 534
@@ -538,7 +537,7 @@ static int __devinit e7xxx_init_one(struct pci_dev *pdev,
538 -EIO : e7xxx_probe1(pdev, ent->driver_data); 537 -EIO : e7xxx_probe1(pdev, ent->driver_data);
539} 538}
540 539
541static void __devexit e7xxx_remove_one(struct pci_dev *pdev) 540static void e7xxx_remove_one(struct pci_dev *pdev)
542{ 541{
543 struct mem_ctl_info *mci; 542 struct mem_ctl_info *mci;
544 struct e7xxx_pvt *pvt; 543 struct e7xxx_pvt *pvt;
@@ -579,7 +578,7 @@ MODULE_DEVICE_TABLE(pci, e7xxx_pci_tbl);
579static struct pci_driver e7xxx_driver = { 578static struct pci_driver e7xxx_driver = {
580 .name = EDAC_MOD_STR, 579 .name = EDAC_MOD_STR,
581 .probe = e7xxx_init_one, 580 .probe = e7xxx_init_one,
582 .remove = __devexit_p(e7xxx_remove_one), 581 .remove = e7xxx_remove_one,
583 .id_table = e7xxx_pci_tbl, 582 .id_table = e7xxx_pci_tbl,
584}; 583};
585 584
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
index 281f566a5513..d1e9eb191f2b 100644
--- a/drivers/edac/edac_mc.c
+++ b/drivers/edac/edac_mc.c
@@ -340,7 +340,7 @@ struct mem_ctl_info *edac_mc_alloc(unsigned mc_num,
340 /* 340 /*
341 * Alocate and fill the csrow/channels structs 341 * Alocate and fill the csrow/channels structs
342 */ 342 */
343 mci->csrows = kcalloc(sizeof(*mci->csrows), tot_csrows, GFP_KERNEL); 343 mci->csrows = kcalloc(tot_csrows, sizeof(*mci->csrows), GFP_KERNEL);
344 if (!mci->csrows) 344 if (!mci->csrows)
345 goto error; 345 goto error;
346 for (row = 0; row < tot_csrows; row++) { 346 for (row = 0; row < tot_csrows; row++) {
@@ -351,7 +351,7 @@ struct mem_ctl_info *edac_mc_alloc(unsigned mc_num,
351 csr->csrow_idx = row; 351 csr->csrow_idx = row;
352 csr->mci = mci; 352 csr->mci = mci;
353 csr->nr_channels = tot_channels; 353 csr->nr_channels = tot_channels;
354 csr->channels = kcalloc(sizeof(*csr->channels), tot_channels, 354 csr->channels = kcalloc(tot_channels, sizeof(*csr->channels),
355 GFP_KERNEL); 355 GFP_KERNEL);
356 if (!csr->channels) 356 if (!csr->channels)
357 goto error; 357 goto error;
@@ -369,7 +369,7 @@ struct mem_ctl_info *edac_mc_alloc(unsigned mc_num,
369 /* 369 /*
370 * Allocate and fill the dimm structs 370 * Allocate and fill the dimm structs
371 */ 371 */
372 mci->dimms = kcalloc(sizeof(*mci->dimms), tot_dimms, GFP_KERNEL); 372 mci->dimms = kcalloc(tot_dimms, sizeof(*mci->dimms), GFP_KERNEL);
373 if (!mci->dimms) 373 if (!mci->dimms)
374 goto error; 374 goto error;
375 375
diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c
index de2df92f9c77..0ca1ca71157f 100644
--- a/drivers/edac/edac_mc_sysfs.c
+++ b/drivers/edac/edac_mc_sysfs.c
@@ -472,8 +472,7 @@ static void edac_delete_csrow_objects(struct mem_ctl_info *mci)
472 device_remove_file(&csrow->dev, 472 device_remove_file(&csrow->dev,
473 dynamic_csrow_ce_count_attr[chan]); 473 dynamic_csrow_ce_count_attr[chan]);
474 } 474 }
475 put_device(&mci->csrows[i]->dev); 475 device_unregister(&mci->csrows[i]->dev);
476 device_del(&mci->csrows[i]->dev);
477 } 476 }
478} 477}
479#endif 478#endif
@@ -1055,11 +1054,9 @@ fail:
1055 struct dimm_info *dimm = mci->dimms[i]; 1054 struct dimm_info *dimm = mci->dimms[i];
1056 if (dimm->nr_pages == 0) 1055 if (dimm->nr_pages == 0)
1057 continue; 1056 continue;
1058 put_device(&dimm->dev); 1057 device_unregister(&dimm->dev);
1059 device_del(&dimm->dev);
1060 } 1058 }
1061 put_device(&mci->dev); 1059 device_unregister(&mci->dev);
1062 device_del(&mci->dev);
1063 bus_unregister(&mci->bus); 1060 bus_unregister(&mci->bus);
1064 kfree(mci->bus.name); 1061 kfree(mci->bus.name);
1065 return err; 1062 return err;
@@ -1086,16 +1083,14 @@ void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci)
1086 if (dimm->nr_pages == 0) 1083 if (dimm->nr_pages == 0)
1087 continue; 1084 continue;
1088 edac_dbg(0, "removing device %s\n", dev_name(&dimm->dev)); 1085 edac_dbg(0, "removing device %s\n", dev_name(&dimm->dev));
1089 put_device(&dimm->dev); 1086 device_unregister(&dimm->dev);
1090 device_del(&dimm->dev);
1091 } 1087 }
1092} 1088}
1093 1089
1094void edac_unregister_sysfs(struct mem_ctl_info *mci) 1090void edac_unregister_sysfs(struct mem_ctl_info *mci)
1095{ 1091{
1096 edac_dbg(1, "Unregistering device %s\n", dev_name(&mci->dev)); 1092 edac_dbg(1, "Unregistering device %s\n", dev_name(&mci->dev));
1097 put_device(&mci->dev); 1093 device_unregister(&mci->dev);
1098 device_del(&mci->dev);
1099 bus_unregister(&mci->bus); 1094 bus_unregister(&mci->bus);
1100 kfree(mci->bus.name); 1095 kfree(mci->bus.name);
1101} 1096}
@@ -1159,8 +1154,6 @@ int __init edac_mc_sysfs_init(void)
1159 1154
1160void __exit edac_mc_sysfs_exit(void) 1155void __exit edac_mc_sysfs_exit(void)
1161{ 1156{
1162 put_device(mci_pdev); 1157 device_unregister(mci_pdev);
1163 device_del(mci_pdev);
1164 edac_put_sysfs_subsys(); 1158 edac_put_sysfs_subsys();
1165 kfree(mci_pdev);
1166} 1159}
diff --git a/drivers/edac/edac_pci_sysfs.c b/drivers/edac/edac_pci_sysfs.c
index dc6e905ee1a5..0056c4dae9d5 100644
--- a/drivers/edac/edac_pci_sysfs.c
+++ b/drivers/edac/edac_pci_sysfs.c
@@ -256,7 +256,7 @@ static ssize_t edac_pci_dev_store(struct kobject *kobj,
256 struct edac_pci_dev_attribute *edac_pci_dev; 256 struct edac_pci_dev_attribute *edac_pci_dev;
257 edac_pci_dev = (struct edac_pci_dev_attribute *)attr; 257 edac_pci_dev = (struct edac_pci_dev_attribute *)attr;
258 258
259 if (edac_pci_dev->show) 259 if (edac_pci_dev->store)
260 return edac_pci_dev->store(edac_pci_dev->value, buffer, count); 260 return edac_pci_dev->store(edac_pci_dev->value, buffer, count);
261 return -EIO; 261 return -EIO;
262} 262}
diff --git a/drivers/edac/highbank_l2_edac.c b/drivers/edac/highbank_l2_edac.c
index e599b00c05a8..c2bd8c6a4349 100644
--- a/drivers/edac/highbank_l2_edac.c
+++ b/drivers/edac/highbank_l2_edac.c
@@ -50,7 +50,7 @@ static irqreturn_t highbank_l2_err_handler(int irq, void *dev_id)
50 return IRQ_HANDLED; 50 return IRQ_HANDLED;
51} 51}
52 52
53static int __devinit highbank_l2_err_probe(struct platform_device *pdev) 53static int highbank_l2_err_probe(struct platform_device *pdev)
54{ 54{
55 struct edac_device_ctl_info *dci; 55 struct edac_device_ctl_info *dci;
56 struct hb_l2_drvdata *drvdata; 56 struct hb_l2_drvdata *drvdata;
diff --git a/drivers/edac/highbank_mc_edac.c b/drivers/edac/highbank_mc_edac.c
index 7ea4cc2e8bd2..4695dd2d71fd 100644
--- a/drivers/edac/highbank_mc_edac.c
+++ b/drivers/edac/highbank_mc_edac.c
@@ -119,7 +119,7 @@ static const struct file_operations highbank_mc_debug_inject_fops = {
119 .llseek = generic_file_llseek, 119 .llseek = generic_file_llseek,
120}; 120};
121 121
122static void __devinit highbank_mc_create_debugfs_nodes(struct mem_ctl_info *mci) 122static void highbank_mc_create_debugfs_nodes(struct mem_ctl_info *mci)
123{ 123{
124 if (mci->debugfs) 124 if (mci->debugfs)
125 debugfs_create_file("inject_ctrl", S_IWUSR, mci->debugfs, mci, 125 debugfs_create_file("inject_ctrl", S_IWUSR, mci->debugfs, mci,
@@ -127,11 +127,11 @@ static void __devinit highbank_mc_create_debugfs_nodes(struct mem_ctl_info *mci)
127; 127;
128} 128}
129#else 129#else
130static void __devinit highbank_mc_create_debugfs_nodes(struct mem_ctl_info *mci) 130static void highbank_mc_create_debugfs_nodes(struct mem_ctl_info *mci)
131{} 131{}
132#endif 132#endif
133 133
134static int __devinit highbank_mc_probe(struct platform_device *pdev) 134static int highbank_mc_probe(struct platform_device *pdev)
135{ 135{
136 struct edac_mc_layer layers[2]; 136 struct edac_mc_layer layers[2];
137 struct mem_ctl_info *mci; 137 struct mem_ctl_info *mci;
diff --git a/drivers/edac/i3000_edac.c b/drivers/edac/i3000_edac.c
index d3d19cc4e9a1..694efcbf19c0 100644
--- a/drivers/edac/i3000_edac.c
+++ b/drivers/edac/i3000_edac.c
@@ -455,8 +455,7 @@ fail:
455} 455}
456 456
457/* returns count (>= 0), or negative on error */ 457/* returns count (>= 0), or negative on error */
458static int __devinit i3000_init_one(struct pci_dev *pdev, 458static int i3000_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
459 const struct pci_device_id *ent)
460{ 459{
461 int rc; 460 int rc;
462 461
@@ -472,7 +471,7 @@ static int __devinit i3000_init_one(struct pci_dev *pdev,
472 return rc; 471 return rc;
473} 472}
474 473
475static void __devexit i3000_remove_one(struct pci_dev *pdev) 474static void i3000_remove_one(struct pci_dev *pdev)
476{ 475{
477 struct mem_ctl_info *mci; 476 struct mem_ctl_info *mci;
478 477
@@ -502,7 +501,7 @@ MODULE_DEVICE_TABLE(pci, i3000_pci_tbl);
502static struct pci_driver i3000_driver = { 501static struct pci_driver i3000_driver = {
503 .name = EDAC_MOD_STR, 502 .name = EDAC_MOD_STR,
504 .probe = i3000_init_one, 503 .probe = i3000_init_one,
505 .remove = __devexit_p(i3000_remove_one), 504 .remove = i3000_remove_one,
506 .id_table = i3000_pci_tbl, 505 .id_table = i3000_pci_tbl,
507}; 506};
508 507
diff --git a/drivers/edac/i3200_edac.c b/drivers/edac/i3200_edac.c
index b6653a6fc5d5..4e8337602e78 100644
--- a/drivers/edac/i3200_edac.c
+++ b/drivers/edac/i3200_edac.c
@@ -419,8 +419,7 @@ fail:
419 return rc; 419 return rc;
420} 420}
421 421
422static int __devinit i3200_init_one(struct pci_dev *pdev, 422static int i3200_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
423 const struct pci_device_id *ent)
424{ 423{
425 int rc; 424 int rc;
426 425
@@ -436,7 +435,7 @@ static int __devinit i3200_init_one(struct pci_dev *pdev,
436 return rc; 435 return rc;
437} 436}
438 437
439static void __devexit i3200_remove_one(struct pci_dev *pdev) 438static void i3200_remove_one(struct pci_dev *pdev)
440{ 439{
441 struct mem_ctl_info *mci; 440 struct mem_ctl_info *mci;
442 struct i3200_priv *priv; 441 struct i3200_priv *priv;
@@ -467,7 +466,7 @@ MODULE_DEVICE_TABLE(pci, i3200_pci_tbl);
467static struct pci_driver i3200_driver = { 466static struct pci_driver i3200_driver = {
468 .name = EDAC_MOD_STR, 467 .name = EDAC_MOD_STR,
469 .probe = i3200_init_one, 468 .probe = i3200_init_one,
470 .remove = __devexit_p(i3200_remove_one), 469 .remove = i3200_remove_one,
471 .id_table = i3200_pci_tbl, 470 .id_table = i3200_pci_tbl,
472}; 471};
473 472
diff --git a/drivers/edac/i5000_edac.c b/drivers/edac/i5000_edac.c
index 6a49dd00b81b..63b2194e8c20 100644
--- a/drivers/edac/i5000_edac.c
+++ b/drivers/edac/i5000_edac.c
@@ -1489,8 +1489,7 @@ fail0:
1489 * negative on error 1489 * negative on error
1490 * count (>= 0) 1490 * count (>= 0)
1491 */ 1491 */
1492static int __devinit i5000_init_one(struct pci_dev *pdev, 1492static int i5000_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
1493 const struct pci_device_id *id)
1494{ 1493{
1495 int rc; 1494 int rc;
1496 1495
@@ -1509,7 +1508,7 @@ static int __devinit i5000_init_one(struct pci_dev *pdev,
1509 * i5000_remove_one destructor for one instance of device 1508 * i5000_remove_one destructor for one instance of device
1510 * 1509 *
1511 */ 1510 */
1512static void __devexit i5000_remove_one(struct pci_dev *pdev) 1511static void i5000_remove_one(struct pci_dev *pdev)
1513{ 1512{
1514 struct mem_ctl_info *mci; 1513 struct mem_ctl_info *mci;
1515 1514
@@ -1547,7 +1546,7 @@ MODULE_DEVICE_TABLE(pci, i5000_pci_tbl);
1547static struct pci_driver i5000_driver = { 1546static struct pci_driver i5000_driver = {
1548 .name = KBUILD_BASENAME, 1547 .name = KBUILD_BASENAME,
1549 .probe = i5000_init_one, 1548 .probe = i5000_init_one,
1550 .remove = __devexit_p(i5000_remove_one), 1549 .remove = i5000_remove_one,
1551 .id_table = i5000_pci_tbl, 1550 .id_table = i5000_pci_tbl,
1552}; 1551};
1553 1552
diff --git a/drivers/edac/i5100_edac.c b/drivers/edac/i5100_edac.c
index c4b5e5f868e8..d6955b2cc99f 100644
--- a/drivers/edac/i5100_edac.c
+++ b/drivers/edac/i5100_edac.c
@@ -638,8 +638,7 @@ static struct pci_dev *pci_get_device_func(unsigned vendor,
638 return ret; 638 return ret;
639} 639}
640 640
641static unsigned long __devinit i5100_npages(struct mem_ctl_info *mci, 641static unsigned long i5100_npages(struct mem_ctl_info *mci, int csrow)
642 int csrow)
643{ 642{
644 struct i5100_priv *priv = mci->pvt_info; 643 struct i5100_priv *priv = mci->pvt_info;
645 const unsigned chan_rank = i5100_csrow_to_rank(mci, csrow); 644 const unsigned chan_rank = i5100_csrow_to_rank(mci, csrow);
@@ -660,7 +659,7 @@ static unsigned long __devinit i5100_npages(struct mem_ctl_info *mci,
660 ((unsigned long long) (1ULL << addr_lines) / PAGE_SIZE); 659 ((unsigned long long) (1ULL << addr_lines) / PAGE_SIZE);
661} 660}
662 661
663static void __devinit i5100_init_mtr(struct mem_ctl_info *mci) 662static void i5100_init_mtr(struct mem_ctl_info *mci)
664{ 663{
665 struct i5100_priv *priv = mci->pvt_info; 664 struct i5100_priv *priv = mci->pvt_info;
666 struct pci_dev *mms[2] = { priv->ch0mm, priv->ch1mm }; 665 struct pci_dev *mms[2] = { priv->ch0mm, priv->ch1mm };
@@ -732,7 +731,7 @@ static int i5100_read_spd_byte(const struct mem_ctl_info *mci,
732 * o not the only way to may chip selects to dimm slots 731 * o not the only way to may chip selects to dimm slots
733 * o investigate if there is some way to obtain this map from the bios 732 * o investigate if there is some way to obtain this map from the bios
734 */ 733 */
735static void __devinit i5100_init_dimm_csmap(struct mem_ctl_info *mci) 734static void i5100_init_dimm_csmap(struct mem_ctl_info *mci)
736{ 735{
737 struct i5100_priv *priv = mci->pvt_info; 736 struct i5100_priv *priv = mci->pvt_info;
738 int i; 737 int i;
@@ -762,8 +761,8 @@ static void __devinit i5100_init_dimm_csmap(struct mem_ctl_info *mci)
762 } 761 }
763} 762}
764 763
765static void __devinit i5100_init_dimm_layout(struct pci_dev *pdev, 764static void i5100_init_dimm_layout(struct pci_dev *pdev,
766 struct mem_ctl_info *mci) 765 struct mem_ctl_info *mci)
767{ 766{
768 struct i5100_priv *priv = mci->pvt_info; 767 struct i5100_priv *priv = mci->pvt_info;
769 int i; 768 int i;
@@ -784,8 +783,8 @@ static void __devinit i5100_init_dimm_layout(struct pci_dev *pdev,
784 i5100_init_dimm_csmap(mci); 783 i5100_init_dimm_csmap(mci);
785} 784}
786 785
787static void __devinit i5100_init_interleaving(struct pci_dev *pdev, 786static void i5100_init_interleaving(struct pci_dev *pdev,
788 struct mem_ctl_info *mci) 787 struct mem_ctl_info *mci)
789{ 788{
790 u16 w; 789 u16 w;
791 u32 dw; 790 u32 dw;
@@ -830,7 +829,7 @@ static void __devinit i5100_init_interleaving(struct pci_dev *pdev,
830 i5100_init_mtr(mci); 829 i5100_init_mtr(mci);
831} 830}
832 831
833static void __devinit i5100_init_csrows(struct mem_ctl_info *mci) 832static void i5100_init_csrows(struct mem_ctl_info *mci)
834{ 833{
835 int i; 834 int i;
836 struct i5100_priv *priv = mci->pvt_info; 835 struct i5100_priv *priv = mci->pvt_info;
@@ -864,8 +863,7 @@ static void __devinit i5100_init_csrows(struct mem_ctl_info *mci)
864 } 863 }
865} 864}
866 865
867static int __devinit i5100_init_one(struct pci_dev *pdev, 866static int i5100_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
868 const struct pci_device_id *id)
869{ 867{
870 int rc; 868 int rc;
871 struct mem_ctl_info *mci; 869 struct mem_ctl_info *mci;
@@ -1020,7 +1018,7 @@ bail:
1020 return ret; 1018 return ret;
1021} 1019}
1022 1020
1023static void __devexit i5100_remove_one(struct pci_dev *pdev) 1021static void i5100_remove_one(struct pci_dev *pdev)
1024{ 1022{
1025 struct mem_ctl_info *mci; 1023 struct mem_ctl_info *mci;
1026 struct i5100_priv *priv; 1024 struct i5100_priv *priv;
@@ -1054,7 +1052,7 @@ MODULE_DEVICE_TABLE(pci, i5100_pci_tbl);
1054static struct pci_driver i5100_driver = { 1052static struct pci_driver i5100_driver = {
1055 .name = KBUILD_BASENAME, 1053 .name = KBUILD_BASENAME,
1056 .probe = i5100_init_one, 1054 .probe = i5100_init_one,
1057 .remove = __devexit_p(i5100_remove_one), 1055 .remove = i5100_remove_one,
1058 .id_table = i5100_pci_tbl, 1056 .id_table = i5100_pci_tbl,
1059}; 1057};
1060 1058
diff --git a/drivers/edac/i5400_edac.c b/drivers/edac/i5400_edac.c
index 277246998b80..0a05bbceb08f 100644
--- a/drivers/edac/i5400_edac.c
+++ b/drivers/edac/i5400_edac.c
@@ -1373,8 +1373,7 @@ fail0:
1373 * negative on error 1373 * negative on error
1374 * count (>= 0) 1374 * count (>= 0)
1375 */ 1375 */
1376static int __devinit i5400_init_one(struct pci_dev *pdev, 1376static int i5400_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
1377 const struct pci_device_id *id)
1378{ 1377{
1379 int rc; 1378 int rc;
1380 1379
@@ -1393,7 +1392,7 @@ static int __devinit i5400_init_one(struct pci_dev *pdev,
1393 * i5400_remove_one destructor for one instance of device 1392 * i5400_remove_one destructor for one instance of device
1394 * 1393 *
1395 */ 1394 */
1396static void __devexit i5400_remove_one(struct pci_dev *pdev) 1395static void i5400_remove_one(struct pci_dev *pdev)
1397{ 1396{
1398 struct mem_ctl_info *mci; 1397 struct mem_ctl_info *mci;
1399 1398
@@ -1431,7 +1430,7 @@ MODULE_DEVICE_TABLE(pci, i5400_pci_tbl);
1431static struct pci_driver i5400_driver = { 1430static struct pci_driver i5400_driver = {
1432 .name = "i5400_edac", 1431 .name = "i5400_edac",
1433 .probe = i5400_init_one, 1432 .probe = i5400_init_one,
1434 .remove = __devexit_p(i5400_remove_one), 1433 .remove = i5400_remove_one,
1435 .id_table = i5400_pci_tbl, 1434 .id_table = i5400_pci_tbl,
1436}; 1435};
1437 1436
diff --git a/drivers/edac/i7300_edac.c b/drivers/edac/i7300_edac.c
index 9d669cd43618..087c27bc5d42 100644
--- a/drivers/edac/i7300_edac.c
+++ b/drivers/edac/i7300_edac.c
@@ -923,7 +923,7 @@ static void i7300_put_devices(struct mem_ctl_info *mci)
923 * Device 21 function 0: PCI_DEVICE_ID_INTEL_I7300_MCH_FB0 923 * Device 21 function 0: PCI_DEVICE_ID_INTEL_I7300_MCH_FB0
924 * Device 22 function 0: PCI_DEVICE_ID_INTEL_I7300_MCH_FB1 924 * Device 22 function 0: PCI_DEVICE_ID_INTEL_I7300_MCH_FB1
925 */ 925 */
926static int __devinit i7300_get_devices(struct mem_ctl_info *mci) 926static int i7300_get_devices(struct mem_ctl_info *mci)
927{ 927{
928 struct i7300_pvt *pvt; 928 struct i7300_pvt *pvt;
929 struct pci_dev *pdev; 929 struct pci_dev *pdev;
@@ -1008,8 +1008,7 @@ error:
1008 * @pdev: struct pci_dev pointer 1008 * @pdev: struct pci_dev pointer
1009 * @id: struct pci_device_id pointer - currently unused 1009 * @id: struct pci_device_id pointer - currently unused
1010 */ 1010 */
1011static int __devinit i7300_init_one(struct pci_dev *pdev, 1011static int i7300_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
1012 const struct pci_device_id *id)
1013{ 1012{
1014 struct mem_ctl_info *mci; 1013 struct mem_ctl_info *mci;
1015 struct edac_mc_layer layers[3]; 1014 struct edac_mc_layer layers[3];
@@ -1122,7 +1121,7 @@ fail0:
1122 * i7300_remove_one() - Remove the driver 1121 * i7300_remove_one() - Remove the driver
1123 * @pdev: struct pci_dev pointer 1122 * @pdev: struct pci_dev pointer
1124 */ 1123 */
1125static void __devexit i7300_remove_one(struct pci_dev *pdev) 1124static void i7300_remove_one(struct pci_dev *pdev)
1126{ 1125{
1127 struct mem_ctl_info *mci; 1126 struct mem_ctl_info *mci;
1128 char *tmp; 1127 char *tmp;
@@ -1163,7 +1162,7 @@ MODULE_DEVICE_TABLE(pci, i7300_pci_tbl);
1163static struct pci_driver i7300_driver = { 1162static struct pci_driver i7300_driver = {
1164 .name = "i7300_edac", 1163 .name = "i7300_edac",
1165 .probe = i7300_init_one, 1164 .probe = i7300_init_one,
1166 .remove = __devexit_p(i7300_remove_one), 1165 .remove = i7300_remove_one,
1167 .id_table = i7300_pci_tbl, 1166 .id_table = i7300_pci_tbl,
1168}; 1167};
1169 1168
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c
index 10c8c00d6469..e213d030b0dd 100644
--- a/drivers/edac/i7core_edac.c
+++ b/drivers/edac/i7core_edac.c
@@ -2305,8 +2305,7 @@ fail0:
2305 * < 0 for error code 2305 * < 0 for error code
2306 */ 2306 */
2307 2307
2308static int __devinit i7core_probe(struct pci_dev *pdev, 2308static int i7core_probe(struct pci_dev *pdev, const struct pci_device_id *id)
2309 const struct pci_device_id *id)
2310{ 2309{
2311 int rc, count = 0; 2310 int rc, count = 0;
2312 struct i7core_dev *i7core_dev; 2311 struct i7core_dev *i7core_dev;
@@ -2368,7 +2367,7 @@ fail0:
2368 * i7core_remove destructor for one instance of device 2367 * i7core_remove destructor for one instance of device
2369 * 2368 *
2370 */ 2369 */
2371static void __devexit i7core_remove(struct pci_dev *pdev) 2370static void i7core_remove(struct pci_dev *pdev)
2372{ 2371{
2373 struct i7core_dev *i7core_dev; 2372 struct i7core_dev *i7core_dev;
2374 2373
@@ -2409,7 +2408,7 @@ MODULE_DEVICE_TABLE(pci, i7core_pci_tbl);
2409static struct pci_driver i7core_driver = { 2408static struct pci_driver i7core_driver = {
2410 .name = "i7core_edac", 2409 .name = "i7core_edac",
2411 .probe = i7core_probe, 2410 .probe = i7core_probe,
2412 .remove = __devexit_p(i7core_remove), 2411 .remove = i7core_remove,
2413 .id_table = i7core_pci_tbl, 2412 .id_table = i7core_pci_tbl,
2414}; 2413};
2415 2414
diff --git a/drivers/edac/i82443bxgx_edac.c b/drivers/edac/i82443bxgx_edac.c
index 90f303db5d1d..57fdb77903ba 100644
--- a/drivers/edac/i82443bxgx_edac.c
+++ b/drivers/edac/i82443bxgx_edac.c
@@ -353,8 +353,8 @@ fail:
353EXPORT_SYMBOL_GPL(i82443bxgx_edacmc_probe1); 353EXPORT_SYMBOL_GPL(i82443bxgx_edacmc_probe1);
354 354
355/* returns count (>= 0), or negative on error */ 355/* returns count (>= 0), or negative on error */
356static int __devinit i82443bxgx_edacmc_init_one(struct pci_dev *pdev, 356static int i82443bxgx_edacmc_init_one(struct pci_dev *pdev,
357 const struct pci_device_id *ent) 357 const struct pci_device_id *ent)
358{ 358{
359 int rc; 359 int rc;
360 360
@@ -369,7 +369,7 @@ static int __devinit i82443bxgx_edacmc_init_one(struct pci_dev *pdev,
369 return rc; 369 return rc;
370} 370}
371 371
372static void __devexit i82443bxgx_edacmc_remove_one(struct pci_dev *pdev) 372static void i82443bxgx_edacmc_remove_one(struct pci_dev *pdev)
373{ 373{
374 struct mem_ctl_info *mci; 374 struct mem_ctl_info *mci;
375 375
@@ -399,7 +399,7 @@ MODULE_DEVICE_TABLE(pci, i82443bxgx_pci_tbl);
399static struct pci_driver i82443bxgx_edacmc_driver = { 399static struct pci_driver i82443bxgx_edacmc_driver = {
400 .name = EDAC_MOD_STR, 400 .name = EDAC_MOD_STR,
401 .probe = i82443bxgx_edacmc_init_one, 401 .probe = i82443bxgx_edacmc_init_one,
402 .remove = __devexit_p(i82443bxgx_edacmc_remove_one), 402 .remove = i82443bxgx_edacmc_remove_one,
403 .id_table = i82443bxgx_pci_tbl, 403 .id_table = i82443bxgx_pci_tbl,
404}; 404};
405 405
diff --git a/drivers/edac/i82860_edac.c b/drivers/edac/i82860_edac.c
index 1faa74971513..3e3e431c8301 100644
--- a/drivers/edac/i82860_edac.c
+++ b/drivers/edac/i82860_edac.c
@@ -254,8 +254,8 @@ fail:
254} 254}
255 255
256/* returns count (>= 0), or negative on error */ 256/* returns count (>= 0), or negative on error */
257static int __devinit i82860_init_one(struct pci_dev *pdev, 257static int i82860_init_one(struct pci_dev *pdev,
258 const struct pci_device_id *ent) 258 const struct pci_device_id *ent)
259{ 259{
260 int rc; 260 int rc;
261 261
@@ -273,7 +273,7 @@ static int __devinit i82860_init_one(struct pci_dev *pdev,
273 return rc; 273 return rc;
274} 274}
275 275
276static void __devexit i82860_remove_one(struct pci_dev *pdev) 276static void i82860_remove_one(struct pci_dev *pdev)
277{ 277{
278 struct mem_ctl_info *mci; 278 struct mem_ctl_info *mci;
279 279
@@ -302,7 +302,7 @@ MODULE_DEVICE_TABLE(pci, i82860_pci_tbl);
302static struct pci_driver i82860_driver = { 302static struct pci_driver i82860_driver = {
303 .name = EDAC_MOD_STR, 303 .name = EDAC_MOD_STR,
304 .probe = i82860_init_one, 304 .probe = i82860_init_one,
305 .remove = __devexit_p(i82860_remove_one), 305 .remove = i82860_remove_one,
306 .id_table = i82860_pci_tbl, 306 .id_table = i82860_pci_tbl,
307}; 307};
308 308
diff --git a/drivers/edac/i82875p_edac.c b/drivers/edac/i82875p_edac.c
index 3e416b1a6b53..2f8535fc451e 100644
--- a/drivers/edac/i82875p_edac.c
+++ b/drivers/edac/i82875p_edac.c
@@ -479,8 +479,8 @@ fail0:
479} 479}
480 480
481/* returns count (>= 0), or negative on error */ 481/* returns count (>= 0), or negative on error */
482static int __devinit i82875p_init_one(struct pci_dev *pdev, 482static int i82875p_init_one(struct pci_dev *pdev,
483 const struct pci_device_id *ent) 483 const struct pci_device_id *ent)
484{ 484{
485 int rc; 485 int rc;
486 486
@@ -498,7 +498,7 @@ static int __devinit i82875p_init_one(struct pci_dev *pdev,
498 return rc; 498 return rc;
499} 499}
500 500
501static void __devexit i82875p_remove_one(struct pci_dev *pdev) 501static void i82875p_remove_one(struct pci_dev *pdev)
502{ 502{
503 struct mem_ctl_info *mci; 503 struct mem_ctl_info *mci;
504 struct i82875p_pvt *pvt = NULL; 504 struct i82875p_pvt *pvt = NULL;
@@ -541,7 +541,7 @@ MODULE_DEVICE_TABLE(pci, i82875p_pci_tbl);
541static struct pci_driver i82875p_driver = { 541static struct pci_driver i82875p_driver = {
542 .name = EDAC_MOD_STR, 542 .name = EDAC_MOD_STR,
543 .probe = i82875p_init_one, 543 .probe = i82875p_init_one,
544 .remove = __devexit_p(i82875p_remove_one), 544 .remove = i82875p_remove_one,
545 .id_table = i82875p_pci_tbl, 545 .id_table = i82875p_pci_tbl,
546}; 546};
547 547
diff --git a/drivers/edac/i82975x_edac.c b/drivers/edac/i82975x_edac.c
index a98020409fa9..0c8d4b0eaa32 100644
--- a/drivers/edac/i82975x_edac.c
+++ b/drivers/edac/i82975x_edac.c
@@ -592,8 +592,8 @@ fail0:
592} 592}
593 593
594/* returns count (>= 0), or negative on error */ 594/* returns count (>= 0), or negative on error */
595static int __devinit i82975x_init_one(struct pci_dev *pdev, 595static int i82975x_init_one(struct pci_dev *pdev,
596 const struct pci_device_id *ent) 596 const struct pci_device_id *ent)
597{ 597{
598 int rc; 598 int rc;
599 599
@@ -610,7 +610,7 @@ static int __devinit i82975x_init_one(struct pci_dev *pdev,
610 return rc; 610 return rc;
611} 611}
612 612
613static void __devexit i82975x_remove_one(struct pci_dev *pdev) 613static void i82975x_remove_one(struct pci_dev *pdev)
614{ 614{
615 struct mem_ctl_info *mci; 615 struct mem_ctl_info *mci;
616 struct i82975x_pvt *pvt; 616 struct i82975x_pvt *pvt;
@@ -643,7 +643,7 @@ MODULE_DEVICE_TABLE(pci, i82975x_pci_tbl);
643static struct pci_driver i82975x_driver = { 643static struct pci_driver i82975x_driver = {
644 .name = EDAC_MOD_STR, 644 .name = EDAC_MOD_STR,
645 .probe = i82975x_init_one, 645 .probe = i82975x_init_one,
646 .remove = __devexit_p(i82975x_remove_one), 646 .remove = i82975x_remove_one,
647 .id_table = i82975x_pci_tbl, 647 .id_table = i82975x_pci_tbl,
648}; 648};
649 649
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c
index 4fe66fa183ec..42a840d530a5 100644
--- a/drivers/edac/mpc85xx_edac.c
+++ b/drivers/edac/mpc85xx_edac.c
@@ -212,7 +212,7 @@ static irqreturn_t mpc85xx_pci_isr(int irq, void *dev_id)
212 return IRQ_HANDLED; 212 return IRQ_HANDLED;
213} 213}
214 214
215int __devinit mpc85xx_pci_err_probe(struct platform_device *op) 215int mpc85xx_pci_err_probe(struct platform_device *op)
216{ 216{
217 struct edac_pci_ctl_info *pci; 217 struct edac_pci_ctl_info *pci;
218 struct mpc85xx_pci_pdata *pdata; 218 struct mpc85xx_pci_pdata *pdata;
@@ -504,7 +504,7 @@ static irqreturn_t mpc85xx_l2_isr(int irq, void *dev_id)
504 return IRQ_HANDLED; 504 return IRQ_HANDLED;
505} 505}
506 506
507static int __devinit mpc85xx_l2_err_probe(struct platform_device *op) 507static int mpc85xx_l2_err_probe(struct platform_device *op)
508{ 508{
509 struct edac_device_ctl_info *edac_dev; 509 struct edac_device_ctl_info *edac_dev;
510 struct mpc85xx_l2_pdata *pdata; 510 struct mpc85xx_l2_pdata *pdata;
@@ -885,7 +885,7 @@ static irqreturn_t mpc85xx_mc_isr(int irq, void *dev_id)
885 return IRQ_HANDLED; 885 return IRQ_HANDLED;
886} 886}
887 887
888static void __devinit mpc85xx_init_csrows(struct mem_ctl_info *mci) 888static void mpc85xx_init_csrows(struct mem_ctl_info *mci)
889{ 889{
890 struct mpc85xx_mc_pdata *pdata = mci->pvt_info; 890 struct mpc85xx_mc_pdata *pdata = mci->pvt_info;
891 struct csrow_info *csrow; 891 struct csrow_info *csrow;
@@ -964,7 +964,7 @@ static void __devinit mpc85xx_init_csrows(struct mem_ctl_info *mci)
964 } 964 }
965} 965}
966 966
967static int __devinit mpc85xx_mc_err_probe(struct platform_device *op) 967static int mpc85xx_mc_err_probe(struct platform_device *op)
968{ 968{
969 struct mem_ctl_info *mci; 969 struct mem_ctl_info *mci;
970 struct edac_mc_layer layers[2]; 970 struct edac_mc_layer layers[2];
diff --git a/drivers/edac/mv64x60_edac.c b/drivers/edac/mv64x60_edac.c
index 2b315c2edc3c..542fad70e360 100644
--- a/drivers/edac/mv64x60_edac.c
+++ b/drivers/edac/mv64x60_edac.c
@@ -100,7 +100,7 @@ static int __init mv64x60_pci_fixup(struct platform_device *pdev)
100 return 0; 100 return 0;
101} 101}
102 102
103static int __devinit mv64x60_pci_err_probe(struct platform_device *pdev) 103static int mv64x60_pci_err_probe(struct platform_device *pdev)
104{ 104{
105 struct edac_pci_ctl_info *pci; 105 struct edac_pci_ctl_info *pci;
106 struct mv64x60_pci_pdata *pdata; 106 struct mv64x60_pci_pdata *pdata;
@@ -221,7 +221,7 @@ static int mv64x60_pci_err_remove(struct platform_device *pdev)
221 221
222static struct platform_driver mv64x60_pci_err_driver = { 222static struct platform_driver mv64x60_pci_err_driver = {
223 .probe = mv64x60_pci_err_probe, 223 .probe = mv64x60_pci_err_probe,
224 .remove = __devexit_p(mv64x60_pci_err_remove), 224 .remove = mv64x60_pci_err_remove,
225 .driver = { 225 .driver = {
226 .name = "mv64x60_pci_err", 226 .name = "mv64x60_pci_err",
227 } 227 }
@@ -271,7 +271,7 @@ static irqreturn_t mv64x60_sram_isr(int irq, void *dev_id)
271 return IRQ_HANDLED; 271 return IRQ_HANDLED;
272} 272}
273 273
274static int __devinit mv64x60_sram_err_probe(struct platform_device *pdev) 274static int mv64x60_sram_err_probe(struct platform_device *pdev)
275{ 275{
276 struct edac_device_ctl_info *edac_dev; 276 struct edac_device_ctl_info *edac_dev;
277 struct mv64x60_sram_pdata *pdata; 277 struct mv64x60_sram_pdata *pdata;
@@ -439,7 +439,7 @@ static irqreturn_t mv64x60_cpu_isr(int irq, void *dev_id)
439 return IRQ_HANDLED; 439 return IRQ_HANDLED;
440} 440}
441 441
442static int __devinit mv64x60_cpu_err_probe(struct platform_device *pdev) 442static int mv64x60_cpu_err_probe(struct platform_device *pdev)
443{ 443{
444 struct edac_device_ctl_info *edac_dev; 444 struct edac_device_ctl_info *edac_dev;
445 struct resource *r; 445 struct resource *r;
@@ -697,7 +697,7 @@ static void mv64x60_init_csrows(struct mem_ctl_info *mci,
697 dimm->edac_mode = EDAC_SECDED; 697 dimm->edac_mode = EDAC_SECDED;
698} 698}
699 699
700static int __devinit mv64x60_mc_err_probe(struct platform_device *pdev) 700static int mv64x60_mc_err_probe(struct platform_device *pdev)
701{ 701{
702 struct mem_ctl_info *mci; 702 struct mem_ctl_info *mci;
703 struct edac_mc_layer layers[2]; 703 struct edac_mc_layer layers[2];
diff --git a/drivers/edac/octeon_edac-l2c.c b/drivers/edac/octeon_edac-l2c.c
index 40fde6a51ed6..7e98084d3645 100644
--- a/drivers/edac/octeon_edac-l2c.c
+++ b/drivers/edac/octeon_edac-l2c.c
@@ -131,7 +131,7 @@ static void octeon_l2c_poll_oct2(struct edac_device_ctl_info *l2c)
131 _octeon_l2c_poll_oct2(l2c, i); 131 _octeon_l2c_poll_oct2(l2c, i);
132} 132}
133 133
134static int __devinit octeon_l2c_probe(struct platform_device *pdev) 134static int octeon_l2c_probe(struct platform_device *pdev)
135{ 135{
136 struct edac_device_ctl_info *l2c; 136 struct edac_device_ctl_info *l2c;
137 137
diff --git a/drivers/edac/octeon_edac-lmc.c b/drivers/edac/octeon_edac-lmc.c
index 33bca766e37d..93412d6b3af1 100644
--- a/drivers/edac/octeon_edac-lmc.c
+++ b/drivers/edac/octeon_edac-lmc.c
@@ -86,7 +86,7 @@ static void octeon_lmc_edac_poll_o2(struct mem_ctl_info *mci)
86 cvmx_write_csr(CVMX_LMCX_INT(mci->mc_idx), int_reg.u64); 86 cvmx_write_csr(CVMX_LMCX_INT(mci->mc_idx), int_reg.u64);
87} 87}
88 88
89static int __devinit octeon_lmc_edac_probe(struct platform_device *pdev) 89static int octeon_lmc_edac_probe(struct platform_device *pdev)
90{ 90{
91 struct mem_ctl_info *mci; 91 struct mem_ctl_info *mci;
92 struct edac_mc_layer layers[1]; 92 struct edac_mc_layer layers[1];
diff --git a/drivers/edac/octeon_edac-pc.c b/drivers/edac/octeon_edac-pc.c
index 14a5e57f2b32..0f83c33a7d1f 100644
--- a/drivers/edac/octeon_edac-pc.c
+++ b/drivers/edac/octeon_edac-pc.c
@@ -82,7 +82,7 @@ static int co_cache_error_event(struct notifier_block *this,
82 return NOTIFY_STOP; 82 return NOTIFY_STOP;
83} 83}
84 84
85static int __devinit co_cache_error_probe(struct platform_device *pdev) 85static int co_cache_error_probe(struct platform_device *pdev)
86{ 86{
87 struct co_cache_error *p = devm_kzalloc(&pdev->dev, sizeof(*p), 87 struct co_cache_error *p = devm_kzalloc(&pdev->dev, sizeof(*p),
88 GFP_KERNEL); 88 GFP_KERNEL);
diff --git a/drivers/edac/octeon_edac-pci.c b/drivers/edac/octeon_edac-pci.c
index 758c1ef5fc9e..9ca73cec74e7 100644
--- a/drivers/edac/octeon_edac-pci.c
+++ b/drivers/edac/octeon_edac-pci.c
@@ -58,7 +58,7 @@ static void octeon_pci_poll(struct edac_pci_ctl_info *pci)
58 } 58 }
59} 59}
60 60
61static int __devinit octeon_pci_probe(struct platform_device *pdev) 61static int octeon_pci_probe(struct platform_device *pdev)
62{ 62{
63 struct edac_pci_ctl_info *pci; 63 struct edac_pci_ctl_info *pci;
64 int res = 0; 64 int res = 0;
diff --git a/drivers/edac/pasemi_edac.c b/drivers/edac/pasemi_edac.c
index 2d35b78ada3c..9c971b575530 100644
--- a/drivers/edac/pasemi_edac.c
+++ b/drivers/edac/pasemi_edac.c
@@ -188,8 +188,8 @@ static int pasemi_edac_init_csrows(struct mem_ctl_info *mci,
188 return 0; 188 return 0;
189} 189}
190 190
191static int __devinit pasemi_edac_probe(struct pci_dev *pdev, 191static int pasemi_edac_probe(struct pci_dev *pdev,
192 const struct pci_device_id *ent) 192 const struct pci_device_id *ent)
193{ 193{
194 struct mem_ctl_info *mci = NULL; 194 struct mem_ctl_info *mci = NULL;
195 struct edac_mc_layer layers[2]; 195 struct edac_mc_layer layers[2];
@@ -266,7 +266,7 @@ fail:
266 return -ENODEV; 266 return -ENODEV;
267} 267}
268 268
269static void __devexit pasemi_edac_remove(struct pci_dev *pdev) 269static void pasemi_edac_remove(struct pci_dev *pdev)
270{ 270{
271 struct mem_ctl_info *mci = edac_mc_del_mc(&pdev->dev); 271 struct mem_ctl_info *mci = edac_mc_del_mc(&pdev->dev);
272 272
@@ -287,7 +287,7 @@ MODULE_DEVICE_TABLE(pci, pasemi_edac_pci_tbl);
287static struct pci_driver pasemi_edac_driver = { 287static struct pci_driver pasemi_edac_driver = {
288 .name = MODULE_NAME, 288 .name = MODULE_NAME,
289 .probe = pasemi_edac_probe, 289 .probe = pasemi_edac_probe,
290 .remove = __devexit_p(pasemi_edac_remove), 290 .remove = pasemi_edac_remove,
291 .id_table = pasemi_edac_pci_tbl, 291 .id_table = pasemi_edac_pci_tbl,
292}; 292};
293 293
diff --git a/drivers/edac/ppc4xx_edac.c b/drivers/edac/ppc4xx_edac.c
index bf0957635991..ef6b7e08f485 100644
--- a/drivers/edac/ppc4xx_edac.c
+++ b/drivers/edac/ppc4xx_edac.c
@@ -838,8 +838,7 @@ ppc4xx_edac_isr(int irq, void *dev_id)
838 * 838 *
839 * Returns a device type width enumeration. 839 * Returns a device type width enumeration.
840 */ 840 */
841static enum dev_type __devinit 841static enum dev_type ppc4xx_edac_get_dtype(u32 mcopt1)
842ppc4xx_edac_get_dtype(u32 mcopt1)
843{ 842{
844 switch (mcopt1 & SDRAM_MCOPT1_WDTH_MASK) { 843 switch (mcopt1 & SDRAM_MCOPT1_WDTH_MASK) {
845 case SDRAM_MCOPT1_WDTH_16: 844 case SDRAM_MCOPT1_WDTH_16:
@@ -862,8 +861,7 @@ ppc4xx_edac_get_dtype(u32 mcopt1)
862 * 861 *
863 * Returns a memory type enumeration. 862 * Returns a memory type enumeration.
864 */ 863 */
865static enum mem_type __devinit 864static enum mem_type ppc4xx_edac_get_mtype(u32 mcopt1)
866ppc4xx_edac_get_mtype(u32 mcopt1)
867{ 865{
868 bool rden = ((mcopt1 & SDRAM_MCOPT1_RDEN_MASK) == SDRAM_MCOPT1_RDEN); 866 bool rden = ((mcopt1 & SDRAM_MCOPT1_RDEN_MASK) == SDRAM_MCOPT1_RDEN);
869 867
@@ -893,8 +891,7 @@ ppc4xx_edac_get_mtype(u32 mcopt1)
893 * Returns 0 if OK; otherwise, -EINVAL if the memory bank size 891 * Returns 0 if OK; otherwise, -EINVAL if the memory bank size
894 * configuration cannot be determined. 892 * configuration cannot be determined.
895 */ 893 */
896static int __devinit 894static int ppc4xx_edac_init_csrows(struct mem_ctl_info *mci, u32 mcopt1)
897ppc4xx_edac_init_csrows(struct mem_ctl_info *mci, u32 mcopt1)
898{ 895{
899 const struct ppc4xx_edac_pdata *pdata = mci->pvt_info; 896 const struct ppc4xx_edac_pdata *pdata = mci->pvt_info;
900 int status = 0; 897 int status = 0;
@@ -1011,11 +1008,9 @@ ppc4xx_edac_init_csrows(struct mem_ctl_info *mci, u32 mcopt1)
1011 * 1008 *
1012 * Returns 0 if OK; otherwise, < 0 on error. 1009 * Returns 0 if OK; otherwise, < 0 on error.
1013 */ 1010 */
1014static int __devinit 1011static int ppc4xx_edac_mc_init(struct mem_ctl_info *mci,
1015ppc4xx_edac_mc_init(struct mem_ctl_info *mci, 1012 struct platform_device *op,
1016 struct platform_device *op, 1013 const dcr_host_t *dcr_host, u32 mcopt1)
1017 const dcr_host_t *dcr_host,
1018 u32 mcopt1)
1019{ 1014{
1020 int status = 0; 1015 int status = 0;
1021 const u32 memcheck = (mcopt1 & SDRAM_MCOPT1_MCHK_MASK); 1016 const u32 memcheck = (mcopt1 & SDRAM_MCOPT1_MCHK_MASK);
@@ -1105,8 +1100,8 @@ ppc4xx_edac_mc_init(struct mem_ctl_info *mci,
1105 * Returns 0 if OK; otherwise, -ENODEV if the interrupts could not be 1100 * Returns 0 if OK; otherwise, -ENODEV if the interrupts could not be
1106 * mapped and assigned. 1101 * mapped and assigned.
1107 */ 1102 */
1108static int __devinit 1103static int ppc4xx_edac_register_irq(struct platform_device *op,
1109ppc4xx_edac_register_irq(struct platform_device *op, struct mem_ctl_info *mci) 1104 struct mem_ctl_info *mci)
1110{ 1105{
1111 int status = 0; 1106 int status = 0;
1112 int ded_irq, sec_irq; 1107 int ded_irq, sec_irq;
@@ -1183,8 +1178,8 @@ ppc4xx_edac_register_irq(struct platform_device *op, struct mem_ctl_info *mci)
1183 * Returns 0 if the DCRs were successfully mapped; otherwise, < 0 on 1178 * Returns 0 if the DCRs were successfully mapped; otherwise, < 0 on
1184 * error. 1179 * error.
1185 */ 1180 */
1186static int __devinit 1181static int ppc4xx_edac_map_dcrs(const struct device_node *np,
1187ppc4xx_edac_map_dcrs(const struct device_node *np, dcr_host_t *dcr_host) 1182 dcr_host_t *dcr_host)
1188{ 1183{
1189 unsigned int dcr_base, dcr_len; 1184 unsigned int dcr_base, dcr_len;
1190 1185
@@ -1232,7 +1227,7 @@ ppc4xx_edac_map_dcrs(const struct device_node *np, dcr_host_t *dcr_host)
1232 * Returns 0 if the controller instance was successfully bound to the 1227 * Returns 0 if the controller instance was successfully bound to the
1233 * driver; otherwise, < 0 on error. 1228 * driver; otherwise, < 0 on error.
1234 */ 1229 */
1235static int __devinit ppc4xx_edac_probe(struct platform_device *op) 1230static int ppc4xx_edac_probe(struct platform_device *op)
1236{ 1231{
1237 int status = 0; 1232 int status = 0;
1238 u32 mcopt1, memcheck; 1233 u32 mcopt1, memcheck;
diff --git a/drivers/edac/r82600_edac.c b/drivers/edac/r82600_edac.c
index f854debd5533..2fd6a5490905 100644
--- a/drivers/edac/r82600_edac.c
+++ b/drivers/edac/r82600_edac.c
@@ -359,8 +359,8 @@ fail:
359} 359}
360 360
361/* returns count (>= 0), or negative on error */ 361/* returns count (>= 0), or negative on error */
362static int __devinit r82600_init_one(struct pci_dev *pdev, 362static int r82600_init_one(struct pci_dev *pdev,
363 const struct pci_device_id *ent) 363 const struct pci_device_id *ent)
364{ 364{
365 edac_dbg(0, "\n"); 365 edac_dbg(0, "\n");
366 366
@@ -368,7 +368,7 @@ static int __devinit r82600_init_one(struct pci_dev *pdev,
368 return r82600_probe1(pdev, ent->driver_data); 368 return r82600_probe1(pdev, ent->driver_data);
369} 369}
370 370
371static void __devexit r82600_remove_one(struct pci_dev *pdev) 371static void r82600_remove_one(struct pci_dev *pdev)
372{ 372{
373 struct mem_ctl_info *mci; 373 struct mem_ctl_info *mci;
374 374
@@ -397,7 +397,7 @@ MODULE_DEVICE_TABLE(pci, r82600_pci_tbl);
397static struct pci_driver r82600_driver = { 397static struct pci_driver r82600_driver = {
398 .name = EDAC_MOD_STR, 398 .name = EDAC_MOD_STR,
399 .probe = r82600_init_one, 399 .probe = r82600_init_one,
400 .remove = __devexit_p(r82600_remove_one), 400 .remove = r82600_remove_one,
401 .id_table = r82600_pci_tbl, 401 .id_table = r82600_pci_tbl,
402}; 402};
403 403
diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c
index 5715b7c2c517..da7e2986e3d5 100644
--- a/drivers/edac/sb_edac.c
+++ b/drivers/edac/sb_edac.c
@@ -1692,8 +1692,7 @@ fail0:
1692 * < 0 for error code 1692 * < 0 for error code
1693 */ 1693 */
1694 1694
1695static int __devinit sbridge_probe(struct pci_dev *pdev, 1695static int sbridge_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1696 const struct pci_device_id *id)
1697{ 1696{
1698 int rc; 1697 int rc;
1699 u8 mc, num_mc = 0; 1698 u8 mc, num_mc = 0;
@@ -1744,7 +1743,7 @@ fail0:
1744 * sbridge_remove destructor for one instance of device 1743 * sbridge_remove destructor for one instance of device
1745 * 1744 *
1746 */ 1745 */
1747static void __devexit sbridge_remove(struct pci_dev *pdev) 1746static void sbridge_remove(struct pci_dev *pdev)
1748{ 1747{
1749 struct sbridge_dev *sbridge_dev; 1748 struct sbridge_dev *sbridge_dev;
1750 1749
@@ -1785,7 +1784,7 @@ MODULE_DEVICE_TABLE(pci, sbridge_pci_tbl);
1785static struct pci_driver sbridge_driver = { 1784static struct pci_driver sbridge_driver = {
1786 .name = "sbridge_edac", 1785 .name = "sbridge_edac",
1787 .probe = sbridge_probe, 1786 .probe = sbridge_probe,
1788 .remove = __devexit_p(sbridge_remove), 1787 .remove = sbridge_remove,
1789 .id_table = sbridge_pci_tbl, 1788 .id_table = sbridge_pci_tbl,
1790}; 1789};
1791 1790
diff --git a/drivers/edac/tile_edac.c b/drivers/edac/tile_edac.c
index 1e904b7b79a0..a0820536b7d9 100644
--- a/drivers/edac/tile_edac.c
+++ b/drivers/edac/tile_edac.c
@@ -82,7 +82,7 @@ static void tile_edac_check(struct mem_ctl_info *mci)
82 * Initialize the 'csrows' table within the mci control structure with the 82 * Initialize the 'csrows' table within the mci control structure with the
83 * addressing of memory. 83 * addressing of memory.
84 */ 84 */
85static int __devinit tile_edac_init_csrows(struct mem_ctl_info *mci) 85static int tile_edac_init_csrows(struct mem_ctl_info *mci)
86{ 86{
87 struct csrow_info *csrow = mci->csrows[0]; 87 struct csrow_info *csrow = mci->csrows[0];
88 struct tile_edac_priv *priv = mci->pvt_info; 88 struct tile_edac_priv *priv = mci->pvt_info;
@@ -120,7 +120,7 @@ static int __devinit tile_edac_init_csrows(struct mem_ctl_info *mci)
120 return 0; 120 return 0;
121} 121}
122 122
123static int __devinit tile_edac_mc_probe(struct platform_device *pdev) 123static int tile_edac_mc_probe(struct platform_device *pdev)
124{ 124{
125 char hv_file[32]; 125 char hv_file[32];
126 int hv_devhdl; 126 int hv_devhdl;
@@ -186,7 +186,7 @@ static int __devinit tile_edac_mc_probe(struct platform_device *pdev)
186 return 0; 186 return 0;
187} 187}
188 188
189static int __devexit tile_edac_mc_remove(struct platform_device *pdev) 189static int tile_edac_mc_remove(struct platform_device *pdev)
190{ 190{
191 struct mem_ctl_info *mci = platform_get_drvdata(pdev); 191 struct mem_ctl_info *mci = platform_get_drvdata(pdev);
192 192
@@ -202,7 +202,7 @@ static struct platform_driver tile_edac_mc_driver = {
202 .owner = THIS_MODULE, 202 .owner = THIS_MODULE,
203 }, 203 },
204 .probe = tile_edac_mc_probe, 204 .probe = tile_edac_mc_probe,
205 .remove = __devexit_p(tile_edac_mc_remove), 205 .remove = tile_edac_mc_remove,
206}; 206};
207 207
208/* 208/*
diff --git a/drivers/edac/x38_edac.c b/drivers/edac/x38_edac.c
index 08a992693e62..c9db24d95caa 100644
--- a/drivers/edac/x38_edac.c
+++ b/drivers/edac/x38_edac.c
@@ -418,8 +418,7 @@ fail:
418 return rc; 418 return rc;
419} 419}
420 420
421static int __devinit x38_init_one(struct pci_dev *pdev, 421static int x38_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
422 const struct pci_device_id *ent)
423{ 422{
424 int rc; 423 int rc;
425 424
@@ -435,7 +434,7 @@ static int __devinit x38_init_one(struct pci_dev *pdev,
435 return rc; 434 return rc;
436} 435}
437 436
438static void __devexit x38_remove_one(struct pci_dev *pdev) 437static void x38_remove_one(struct pci_dev *pdev)
439{ 438{
440 struct mem_ctl_info *mci; 439 struct mem_ctl_info *mci;
441 440
@@ -464,7 +463,7 @@ MODULE_DEVICE_TABLE(pci, x38_pci_tbl);
464static struct pci_driver x38_driver = { 463static struct pci_driver x38_driver = {
465 .name = EDAC_MOD_STR, 464 .name = EDAC_MOD_STR,
466 .probe = x38_init_one, 465 .probe = x38_init_one,
467 .remove = __devexit_p(x38_remove_one), 466 .remove = x38_remove_one,
468 .id_table = x38_pci_tbl, 467 .id_table = x38_pci_tbl,
469}; 468};
470 469
diff --git a/drivers/firmware/dcdbas.c b/drivers/firmware/dcdbas.c
index ea5ac2dc1233..8e77c02edb24 100644
--- a/drivers/firmware/dcdbas.c
+++ b/drivers/firmware/dcdbas.c
@@ -537,7 +537,7 @@ static struct attribute_group dcdbas_attr_group = {
537 .attrs = dcdbas_dev_attrs, 537 .attrs = dcdbas_dev_attrs,
538}; 538};
539 539
540static int __devinit dcdbas_probe(struct platform_device *dev) 540static int dcdbas_probe(struct platform_device *dev)
541{ 541{
542 int i, error; 542 int i, error;
543 543
@@ -575,7 +575,7 @@ static int __devinit dcdbas_probe(struct platform_device *dev)
575 return 0; 575 return 0;
576} 576}
577 577
578static int __devexit dcdbas_remove(struct platform_device *dev) 578static int dcdbas_remove(struct platform_device *dev)
579{ 579{
580 int i; 580 int i;
581 581
@@ -593,7 +593,7 @@ static struct platform_driver dcdbas_driver = {
593 .owner = THIS_MODULE, 593 .owner = THIS_MODULE,
594 }, 594 },
595 .probe = dcdbas_probe, 595 .probe = dcdbas_probe,
596 .remove = __devexit_p(dcdbas_remove), 596 .remove = dcdbas_remove,
597}; 597};
598 598
599/** 599/**
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index fd3ae6290d71..982f1f5f5742 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -471,7 +471,7 @@ void __init dmi_scan_machine(void)
471 char __iomem *p, *q; 471 char __iomem *p, *q;
472 int rc; 472 int rc;
473 473
474 if (efi_enabled) { 474 if (efi_enabled(EFI_CONFIG_TABLES)) {
475 if (efi.smbios == EFI_INVALID_TABLE_ADDR) 475 if (efi.smbios == EFI_INVALID_TABLE_ADDR)
476 goto error; 476 goto error;
477 477
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
index 7b1c37497c9a..f5596db0cf58 100644
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -674,7 +674,7 @@ static int efi_status_to_err(efi_status_t status)
674 err = -EACCES; 674 err = -EACCES;
675 break; 675 break;
676 case EFI_NOT_FOUND: 676 case EFI_NOT_FOUND:
677 err = -ENOENT; 677 err = -EIO;
678 break; 678 break;
679 default: 679 default:
680 err = -EINVAL; 680 err = -EINVAL;
@@ -793,6 +793,7 @@ static ssize_t efivarfs_file_write(struct file *file,
793 spin_unlock(&efivars->lock); 793 spin_unlock(&efivars->lock);
794 efivar_unregister(var); 794 efivar_unregister(var);
795 drop_nlink(inode); 795 drop_nlink(inode);
796 d_delete(file->f_dentry);
796 dput(file->f_dentry); 797 dput(file->f_dentry);
797 798
798 } else { 799 } else {
@@ -994,7 +995,7 @@ static int efivarfs_unlink(struct inode *dir, struct dentry *dentry)
994 list_del(&var->list); 995 list_del(&var->list);
995 spin_unlock(&efivars->lock); 996 spin_unlock(&efivars->lock);
996 efivar_unregister(var); 997 efivar_unregister(var);
997 drop_nlink(dir); 998 drop_nlink(dentry->d_inode);
998 dput(dentry); 999 dput(dentry);
999 return 0; 1000 return 0;
1000 } 1001 }
@@ -1782,7 +1783,7 @@ efivars_init(void)
1782 printk(KERN_INFO "EFI Variables Facility v%s %s\n", EFIVARS_VERSION, 1783 printk(KERN_INFO "EFI Variables Facility v%s %s\n", EFIVARS_VERSION,
1783 EFIVARS_DATE); 1784 EFIVARS_DATE);
1784 1785
1785 if (!efi_enabled) 1786 if (!efi_enabled(EFI_RUNTIME_SERVICES))
1786 return 0; 1787 return 0;
1787 1788
1788 /* For now we'll register the efi directory at /sys/firmware/efi */ 1789 /* For now we'll register the efi directory at /sys/firmware/efi */
@@ -1822,7 +1823,7 @@ err_put:
1822static void __exit 1823static void __exit
1823efivars_exit(void) 1824efivars_exit(void)
1824{ 1825{
1825 if (efi_enabled) { 1826 if (efi_enabled(EFI_RUNTIME_SERVICES)) {
1826 unregister_efivars(&__efivars); 1827 unregister_efivars(&__efivars);
1827 kobject_put(efi_kobj); 1828 kobject_put(efi_kobj);
1828 } 1829 }
diff --git a/drivers/firmware/iscsi_ibft_find.c b/drivers/firmware/iscsi_ibft_find.c
index 4da4eb9ae926..2224f1dc074b 100644
--- a/drivers/firmware/iscsi_ibft_find.c
+++ b/drivers/firmware/iscsi_ibft_find.c
@@ -99,7 +99,7 @@ unsigned long __init find_ibft_region(unsigned long *sizep)
99 /* iBFT 1.03 section 1.4.3.1 mandates that UEFI machines will 99 /* iBFT 1.03 section 1.4.3.1 mandates that UEFI machines will
100 * only use ACPI for this */ 100 * only use ACPI for this */
101 101
102 if (!efi_enabled) 102 if (!efi_enabled(EFI_BOOT))
103 find_ibft_in_mem(); 103 find_ibft_in_mem();
104 104
105 if (ibft_addr) { 105 if (ibft_addr) {
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index d9729322b1c7..ab97eb805379 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -301,6 +301,14 @@ config GPIO_GE_FPGA
301 and write pin state) for GPIO implemented in a number of GE single 301 and write pin state) for GPIO implemented in a number of GE single
302 board computers. 302 board computers.
303 303
304config GPIO_LYNXPOINT
305 bool "Intel Lynxpoint GPIO support"
306 depends on ACPI
307 select IRQ_DOMAIN
308 help
309 driver for GPIO functionality on Intel Lynxpoint PCH chipset
310 Requires ACPI device enumeration code to set up a platform device.
311
304comment "I2C GPIO expanders:" 312comment "I2C GPIO expanders:"
305 313
306config GPIO_ARIZONA 314config GPIO_ARIZONA
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 36ca605ff038..4398034db4aa 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -32,6 +32,7 @@ obj-$(CONFIG_GPIO_JANZ_TTL) += gpio-janz-ttl.o
32obj-$(CONFIG_ARCH_KS8695) += gpio-ks8695.o 32obj-$(CONFIG_ARCH_KS8695) += gpio-ks8695.o
33obj-$(CONFIG_GPIO_LANGWELL) += gpio-langwell.o 33obj-$(CONFIG_GPIO_LANGWELL) += gpio-langwell.o
34obj-$(CONFIG_ARCH_LPC32XX) += gpio-lpc32xx.o 34obj-$(CONFIG_ARCH_LPC32XX) += gpio-lpc32xx.o
35obj-$(CONFIG_GPIO_LYNXPOINT) += gpio-lynxpoint.o
35obj-$(CONFIG_GPIO_MAX730X) += gpio-max730x.o 36obj-$(CONFIG_GPIO_MAX730X) += gpio-max730x.o
36obj-$(CONFIG_GPIO_MAX7300) += gpio-max7300.o 37obj-$(CONFIG_GPIO_MAX7300) += gpio-max7300.o
37obj-$(CONFIG_GPIO_MAX7301) += gpio-max7301.o 38obj-$(CONFIG_GPIO_MAX7301) += gpio-max7301.o
diff --git a/drivers/gpio/gpio-da9055.c b/drivers/gpio/gpio-da9055.c
index 55d83c7d9c7f..fd6dfe382f13 100644
--- a/drivers/gpio/gpio-da9055.c
+++ b/drivers/gpio/gpio-da9055.c
@@ -126,7 +126,7 @@ static int da9055_gpio_to_irq(struct gpio_chip *gc, u32 offset)
126 DA9055_IRQ_GPI0 + offset); 126 DA9055_IRQ_GPI0 + offset);
127} 127}
128 128
129static struct gpio_chip reference_gp __devinitdata = { 129static struct gpio_chip reference_gp = {
130 .label = "da9055-gpio", 130 .label = "da9055-gpio",
131 .owner = THIS_MODULE, 131 .owner = THIS_MODULE,
132 .get = da9055_gpio_get, 132 .get = da9055_gpio_get,
@@ -139,7 +139,7 @@ static struct gpio_chip reference_gp __devinitdata = {
139 .base = -1, 139 .base = -1,
140}; 140};
141 141
142static int __devinit da9055_gpio_probe(struct platform_device *pdev) 142static int da9055_gpio_probe(struct platform_device *pdev)
143{ 143{
144 struct da9055_gpio *gpio; 144 struct da9055_gpio *gpio;
145 struct da9055_pdata *pdata; 145 struct da9055_pdata *pdata;
@@ -170,7 +170,7 @@ err_mem:
170 return ret; 170 return ret;
171} 171}
172 172
173static int __devexit da9055_gpio_remove(struct platform_device *pdev) 173static int da9055_gpio_remove(struct platform_device *pdev)
174{ 174{
175 struct da9055_gpio *gpio = platform_get_drvdata(pdev); 175 struct da9055_gpio *gpio = platform_get_drvdata(pdev);
176 176
@@ -179,7 +179,7 @@ static int __devexit da9055_gpio_remove(struct platform_device *pdev)
179 179
180static struct platform_driver da9055_gpio_driver = { 180static struct platform_driver da9055_gpio_driver = {
181 .probe = da9055_gpio_probe, 181 .probe = da9055_gpio_probe,
182 .remove = __devexit_p(da9055_gpio_remove), 182 .remove = da9055_gpio_remove,
183 .driver = { 183 .driver = {
184 .name = "da9055-gpio", 184 .name = "da9055-gpio",
185 .owner = THIS_MODULE, 185 .owner = THIS_MODULE,
diff --git a/drivers/gpio/gpio-langwell.c b/drivers/gpio/gpio-langwell.c
index e77b2b3e94af..634c3d37f7b5 100644
--- a/drivers/gpio/gpio-langwell.c
+++ b/drivers/gpio/gpio-langwell.c
@@ -71,10 +71,12 @@ struct lnw_gpio {
71 struct irq_domain *domain; 71 struct irq_domain *domain;
72}; 72};
73 73
74#define to_lnw_priv(chip) container_of(chip, struct lnw_gpio, chip)
75
74static void __iomem *gpio_reg(struct gpio_chip *chip, unsigned offset, 76static void __iomem *gpio_reg(struct gpio_chip *chip, unsigned offset,
75 enum GPIO_REG reg_type) 77 enum GPIO_REG reg_type)
76{ 78{
77 struct lnw_gpio *lnw = container_of(chip, struct lnw_gpio, chip); 79 struct lnw_gpio *lnw = to_lnw_priv(chip);
78 unsigned nreg = chip->ngpio / 32; 80 unsigned nreg = chip->ngpio / 32;
79 u8 reg = offset / 32; 81 u8 reg = offset / 32;
80 void __iomem *ptr; 82 void __iomem *ptr;
@@ -86,7 +88,7 @@ static void __iomem *gpio_reg(struct gpio_chip *chip, unsigned offset,
86static void __iomem *gpio_reg_2bit(struct gpio_chip *chip, unsigned offset, 88static void __iomem *gpio_reg_2bit(struct gpio_chip *chip, unsigned offset,
87 enum GPIO_REG reg_type) 89 enum GPIO_REG reg_type)
88{ 90{
89 struct lnw_gpio *lnw = container_of(chip, struct lnw_gpio, chip); 91 struct lnw_gpio *lnw = to_lnw_priv(chip);
90 unsigned nreg = chip->ngpio / 32; 92 unsigned nreg = chip->ngpio / 32;
91 u8 reg = offset / 16; 93 u8 reg = offset / 16;
92 void __iomem *ptr; 94 void __iomem *ptr;
@@ -130,7 +132,7 @@ static void lnw_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
130 132
131static int lnw_gpio_direction_input(struct gpio_chip *chip, unsigned offset) 133static int lnw_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
132{ 134{
133 struct lnw_gpio *lnw = container_of(chip, struct lnw_gpio, chip); 135 struct lnw_gpio *lnw = to_lnw_priv(chip);
134 void __iomem *gpdr = gpio_reg(chip, offset, GPDR); 136 void __iomem *gpdr = gpio_reg(chip, offset, GPDR);
135 u32 value; 137 u32 value;
136 unsigned long flags; 138 unsigned long flags;
@@ -153,7 +155,7 @@ static int lnw_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
153static int lnw_gpio_direction_output(struct gpio_chip *chip, 155static int lnw_gpio_direction_output(struct gpio_chip *chip,
154 unsigned offset, int value) 156 unsigned offset, int value)
155{ 157{
156 struct lnw_gpio *lnw = container_of(chip, struct lnw_gpio, chip); 158 struct lnw_gpio *lnw = to_lnw_priv(chip);
157 void __iomem *gpdr = gpio_reg(chip, offset, GPDR); 159 void __iomem *gpdr = gpio_reg(chip, offset, GPDR);
158 unsigned long flags; 160 unsigned long flags;
159 161
@@ -176,7 +178,7 @@ static int lnw_gpio_direction_output(struct gpio_chip *chip,
176 178
177static int lnw_gpio_to_irq(struct gpio_chip *chip, unsigned offset) 179static int lnw_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
178{ 180{
179 struct lnw_gpio *lnw = container_of(chip, struct lnw_gpio, chip); 181 struct lnw_gpio *lnw = to_lnw_priv(chip);
180 return irq_create_mapping(lnw->domain, offset); 182 return irq_create_mapping(lnw->domain, offset);
181} 183}
182 184
@@ -234,6 +236,8 @@ static DEFINE_PCI_DEVICE_TABLE(lnw_gpio_ids) = { /* pin number */
234 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x080f), .driver_data = 64 }, 236 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x080f), .driver_data = 64 },
235 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x081f), .driver_data = 96 }, 237 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x081f), .driver_data = 96 },
236 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x081a), .driver_data = 96 }, 238 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x081a), .driver_data = 96 },
239 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x08eb), .driver_data = 96 },
240 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x08f7), .driver_data = 96 },
237 { 0, } 241 { 0, }
238}; 242};
239MODULE_DEVICE_TABLE(pci, lnw_gpio_ids); 243MODULE_DEVICE_TABLE(pci, lnw_gpio_ids);
@@ -299,17 +303,6 @@ static const struct irq_domain_ops lnw_gpio_irq_ops = {
299 .xlate = irq_domain_xlate_twocell, 303 .xlate = irq_domain_xlate_twocell,
300}; 304};
301 305
302#ifdef CONFIG_PM
303static int lnw_gpio_runtime_resume(struct device *dev)
304{
305 return 0;
306}
307
308static int lnw_gpio_runtime_suspend(struct device *dev)
309{
310 return 0;
311}
312
313static int lnw_gpio_runtime_idle(struct device *dev) 306static int lnw_gpio_runtime_idle(struct device *dev)
314{ 307{
315 int err = pm_schedule_suspend(dev, 500); 308 int err = pm_schedule_suspend(dev, 500);
@@ -320,16 +313,8 @@ static int lnw_gpio_runtime_idle(struct device *dev)
320 return -EBUSY; 313 return -EBUSY;
321} 314}
322 315
323#else
324#define lnw_gpio_runtime_suspend NULL
325#define lnw_gpio_runtime_resume NULL
326#define lnw_gpio_runtime_idle NULL
327#endif
328
329static const struct dev_pm_ops lnw_gpio_pm_ops = { 316static const struct dev_pm_ops lnw_gpio_pm_ops = {
330 .runtime_suspend = lnw_gpio_runtime_suspend, 317 SET_RUNTIME_PM_OPS(NULL, NULL, lnw_gpio_runtime_idle)
331 .runtime_resume = lnw_gpio_runtime_resume,
332 .runtime_idle = lnw_gpio_runtime_idle,
333}; 318};
334 319
335static int lnw_gpio_probe(struct pci_dev *pdev, 320static int lnw_gpio_probe(struct pci_dev *pdev,
@@ -349,7 +334,7 @@ static int lnw_gpio_probe(struct pci_dev *pdev,
349 retval = pci_request_regions(pdev, "langwell_gpio"); 334 retval = pci_request_regions(pdev, "langwell_gpio");
350 if (retval) { 335 if (retval) {
351 dev_err(&pdev->dev, "error requesting resources\n"); 336 dev_err(&pdev->dev, "error requesting resources\n");
352 goto err2; 337 goto err_pci_req_region;
353 } 338 }
354 /* get the gpio_base from bar1 */ 339 /* get the gpio_base from bar1 */
355 start = pci_resource_start(pdev, 1); 340 start = pci_resource_start(pdev, 1);
@@ -358,7 +343,7 @@ static int lnw_gpio_probe(struct pci_dev *pdev,
358 if (!base) { 343 if (!base) {
359 dev_err(&pdev->dev, "error mapping bar1\n"); 344 dev_err(&pdev->dev, "error mapping bar1\n");
360 retval = -EFAULT; 345 retval = -EFAULT;
361 goto err3; 346 goto err_ioremap;
362 } 347 }
363 gpio_base = *((u32 *)base + 1); 348 gpio_base = *((u32 *)base + 1);
364 /* release the IO mapping, since we already get the info from bar1 */ 349 /* release the IO mapping, since we already get the info from bar1 */
@@ -370,21 +355,21 @@ static int lnw_gpio_probe(struct pci_dev *pdev,
370 if (!base) { 355 if (!base) {
371 dev_err(&pdev->dev, "error mapping bar0\n"); 356 dev_err(&pdev->dev, "error mapping bar0\n");
372 retval = -EFAULT; 357 retval = -EFAULT;
373 goto err3; 358 goto err_ioremap;
374 } 359 }
375 360
376 lnw = devm_kzalloc(&pdev->dev, sizeof(struct lnw_gpio), GFP_KERNEL); 361 lnw = devm_kzalloc(&pdev->dev, sizeof(*lnw), GFP_KERNEL);
377 if (!lnw) { 362 if (!lnw) {
378 dev_err(&pdev->dev, "can't allocate langwell_gpio chip data\n"); 363 dev_err(&pdev->dev, "can't allocate langwell_gpio chip data\n");
379 retval = -ENOMEM; 364 retval = -ENOMEM;
380 goto err3; 365 goto err_ioremap;
381 } 366 }
382 367
383 lnw->domain = irq_domain_add_linear(pdev->dev.of_node, ngpio, 368 lnw->domain = irq_domain_add_linear(pdev->dev.of_node, ngpio,
384 &lnw_gpio_irq_ops, lnw); 369 &lnw_gpio_irq_ops, lnw);
385 if (!lnw->domain) { 370 if (!lnw->domain) {
386 retval = -ENOMEM; 371 retval = -ENOMEM;
387 goto err3; 372 goto err_ioremap;
388 } 373 }
389 374
390 lnw->reg_base = base; 375 lnw->reg_base = base;
@@ -403,7 +388,7 @@ static int lnw_gpio_probe(struct pci_dev *pdev,
403 retval = gpiochip_add(&lnw->chip); 388 retval = gpiochip_add(&lnw->chip);
404 if (retval) { 389 if (retval) {
405 dev_err(&pdev->dev, "langwell gpiochip_add error %d\n", retval); 390 dev_err(&pdev->dev, "langwell gpiochip_add error %d\n", retval);
406 goto err3; 391 goto err_ioremap;
407 } 392 }
408 393
409 lnw_irq_init_hw(lnw); 394 lnw_irq_init_hw(lnw);
@@ -418,9 +403,9 @@ static int lnw_gpio_probe(struct pci_dev *pdev,
418 403
419 return 0; 404 return 0;
420 405
421err3: 406err_ioremap:
422 pci_release_regions(pdev); 407 pci_release_regions(pdev);
423err2: 408err_pci_req_region:
424 pci_disable_device(pdev); 409 pci_disable_device(pdev);
425 return retval; 410 return retval;
426} 411}
diff --git a/drivers/gpio/gpio-lynxpoint.c b/drivers/gpio/gpio-lynxpoint.c
new file mode 100644
index 000000000000..3472b05ac512
--- /dev/null
+++ b/drivers/gpio/gpio-lynxpoint.c
@@ -0,0 +1,469 @@
1/*
2 * GPIO controller driver for Intel Lynxpoint PCH chipset>
3 * Copyright (c) 2012, Intel Corporation.
4 *
5 * Author: Mathias Nyman <mathias.nyman@linux.intel.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU General Public License,
9 * version 2, as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 */
21
22#include <linux/kernel.h>
23#include <linux/module.h>
24#include <linux/init.h>
25#include <linux/types.h>
26#include <linux/bitops.h>
27#include <linux/interrupt.h>
28#include <linux/irq.h>
29#include <linux/gpio.h>
30#include <linux/irqdomain.h>
31#include <linux/slab.h>
32#include <linux/acpi.h>
33#include <linux/platform_device.h>
34#include <linux/pm_runtime.h>
35
36/* LynxPoint chipset has support for 94 gpio pins */
37
38#define LP_NUM_GPIO 94
39
40/* Bitmapped register offsets */
41#define LP_ACPI_OWNED 0x00 /* Bitmap, set by bios, 0: pin reserved for ACPI */
42#define LP_GC 0x7C /* set APIC IRQ to IRQ14 or IRQ15 for all pins */
43#define LP_INT_STAT 0x80
44#define LP_INT_ENABLE 0x90
45
46/* Each pin has two 32 bit config registers, starting at 0x100 */
47#define LP_CONFIG1 0x100
48#define LP_CONFIG2 0x104
49
50/* LP_CONFIG1 reg bits */
51#define OUT_LVL_BIT BIT(31)
52#define IN_LVL_BIT BIT(30)
53#define TRIG_SEL_BIT BIT(4) /* 0: Edge, 1: Level */
54#define INT_INV_BIT BIT(3) /* Invert interrupt triggering */
55#define DIR_BIT BIT(2) /* 0: Output, 1: Input */
56#define USE_SEL_BIT BIT(0) /* 0: Native, 1: GPIO */
57
58/* LP_CONFIG2 reg bits */
59#define GPINDIS_BIT BIT(2) /* disable input sensing */
60#define GPIWP_BIT (BIT(0) | BIT(1)) /* weak pull options */
61
62struct lp_gpio {
63 struct gpio_chip chip;
64 struct irq_domain *domain;
65 struct platform_device *pdev;
66 spinlock_t lock;
67 unsigned long reg_base;
68};
69
70/*
71 * Lynxpoint gpios are controlled through both bitmapped registers and
72 * per gpio specific registers. The bitmapped registers are in chunks of
73 * 3 x 32bit registers to cover all 94 gpios
74 *
75 * per gpio specific registers consist of two 32bit registers per gpio
76 * (LP_CONFIG1 and LP_CONFIG2), with 94 gpios there's a total of
77 * 188 config registes.
78 *
79 * A simplified view of the register layout look like this:
80 *
81 * LP_ACPI_OWNED[31:0] gpio ownerships for gpios 0-31 (bitmapped registers)
82 * LP_ACPI_OWNED[63:32] gpio ownerships for gpios 32-63
83 * LP_ACPI_OWNED[94:64] gpio ownerships for gpios 63-94
84 * ...
85 * LP_INT_ENABLE[31:0] ...
86 * LP_INT_ENABLE[63:31] ...
87 * LP_INT_ENABLE[94:64] ...
88 * LP0_CONFIG1 (gpio 0) config1 reg for gpio 0 (per gpio registers)
89 * LP0_CONFIG2 (gpio 0) config2 reg for gpio 0
90 * LP1_CONFIG1 (gpio 1) config1 reg for gpio 1
91 * LP1_CONFIG2 (gpio 1) config2 reg for gpio 1
92 * LP2_CONFIG1 (gpio 2) ...
93 * LP2_CONFIG2 (gpio 2) ...
94 * ...
95 * LP94_CONFIG1 (gpio 94) ...
96 * LP94_CONFIG2 (gpio 94) ...
97 */
98
99static unsigned long lp_gpio_reg(struct gpio_chip *chip, unsigned offset,
100 int reg)
101{
102 struct lp_gpio *lg = container_of(chip, struct lp_gpio, chip);
103 int reg_offset;
104
105 if (reg == LP_CONFIG1 || reg == LP_CONFIG2)
106 /* per gpio specific config registers */
107 reg_offset = offset * 8;
108 else
109 /* bitmapped registers */
110 reg_offset = (offset / 32) * 4;
111
112 return lg->reg_base + reg + reg_offset;
113}
114
115static int lp_gpio_request(struct gpio_chip *chip, unsigned offset)
116{
117 struct lp_gpio *lg = container_of(chip, struct lp_gpio, chip);
118 unsigned long reg = lp_gpio_reg(chip, offset, LP_CONFIG1);
119 unsigned long conf2 = lp_gpio_reg(chip, offset, LP_CONFIG2);
120 unsigned long acpi_use = lp_gpio_reg(chip, offset, LP_ACPI_OWNED);
121
122 pm_runtime_get(&lg->pdev->dev); /* should we put if failed */
123
124 /* Fail if BIOS reserved pin for ACPI use */
125 if (!(inl(acpi_use) & BIT(offset % 32))) {
126 dev_err(&lg->pdev->dev, "gpio %d reserved for ACPI\n", offset);
127 return -EBUSY;
128 }
129 /* Fail if pin is in alternate function mode (not GPIO mode) */
130 if (!(inl(reg) & USE_SEL_BIT))
131 return -ENODEV;
132
133 /* enable input sensing */
134 outl(inl(conf2) & ~GPINDIS_BIT, conf2);
135
136
137 return 0;
138}
139
140static void lp_gpio_free(struct gpio_chip *chip, unsigned offset)
141{
142 struct lp_gpio *lg = container_of(chip, struct lp_gpio, chip);
143 unsigned long conf2 = lp_gpio_reg(chip, offset, LP_CONFIG2);
144
145 /* disable input sensing */
146 outl(inl(conf2) | GPINDIS_BIT, conf2);
147
148 pm_runtime_put(&lg->pdev->dev);
149}
150
151static int lp_irq_type(struct irq_data *d, unsigned type)
152{
153 struct lp_gpio *lg = irq_data_get_irq_chip_data(d);
154 u32 hwirq = irqd_to_hwirq(d);
155 unsigned long flags;
156 u32 value;
157 unsigned long reg = lp_gpio_reg(&lg->chip, hwirq, LP_CONFIG1);
158
159 if (hwirq >= lg->chip.ngpio)
160 return -EINVAL;
161
162 spin_lock_irqsave(&lg->lock, flags);
163 value = inl(reg);
164
165 /* set both TRIG_SEL and INV bits to 0 for rising edge */
166 if (type & IRQ_TYPE_EDGE_RISING)
167 value &= ~(TRIG_SEL_BIT | INT_INV_BIT);
168
169 /* TRIG_SEL bit 0, INV bit 1 for falling edge */
170 if (type & IRQ_TYPE_EDGE_FALLING)
171 value = (value | INT_INV_BIT) & ~TRIG_SEL_BIT;
172
173 /* TRIG_SEL bit 1, INV bit 0 for level low */
174 if (type & IRQ_TYPE_LEVEL_LOW)
175 value = (value | TRIG_SEL_BIT) & ~INT_INV_BIT;
176
177 /* TRIG_SEL bit 1, INV bit 1 for level high */
178 if (type & IRQ_TYPE_LEVEL_HIGH)
179 value |= TRIG_SEL_BIT | INT_INV_BIT;
180
181 outl(value, reg);
182 spin_unlock_irqrestore(&lg->lock, flags);
183
184 return 0;
185}
186
187static int lp_gpio_get(struct gpio_chip *chip, unsigned offset)
188{
189 unsigned long reg = lp_gpio_reg(chip, offset, LP_CONFIG1);
190 return inl(reg) & IN_LVL_BIT;
191}
192
193static void lp_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
194{
195 struct lp_gpio *lg = container_of(chip, struct lp_gpio, chip);
196 unsigned long reg = lp_gpio_reg(chip, offset, LP_CONFIG1);
197 unsigned long flags;
198
199 spin_lock_irqsave(&lg->lock, flags);
200
201 if (value)
202 outl(inl(reg) | OUT_LVL_BIT, reg);
203 else
204 outl(inl(reg) & ~OUT_LVL_BIT, reg);
205
206 spin_unlock_irqrestore(&lg->lock, flags);
207}
208
209static int lp_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
210{
211 struct lp_gpio *lg = container_of(chip, struct lp_gpio, chip);
212 unsigned long reg = lp_gpio_reg(chip, offset, LP_CONFIG1);
213 unsigned long flags;
214
215 spin_lock_irqsave(&lg->lock, flags);
216 outl(inl(reg) | DIR_BIT, reg);
217 spin_unlock_irqrestore(&lg->lock, flags);
218
219 return 0;
220}
221
222static int lp_gpio_direction_output(struct gpio_chip *chip,
223 unsigned offset, int value)
224{
225 struct lp_gpio *lg = container_of(chip, struct lp_gpio, chip);
226 unsigned long reg = lp_gpio_reg(chip, offset, LP_CONFIG1);
227 unsigned long flags;
228
229 lp_gpio_set(chip, offset, value);
230
231 spin_lock_irqsave(&lg->lock, flags);
232 outl(inl(reg) & ~DIR_BIT, reg);
233 spin_unlock_irqrestore(&lg->lock, flags);
234
235 return 0;
236}
237
238static int lp_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
239{
240 struct lp_gpio *lg = container_of(chip, struct lp_gpio, chip);
241 return irq_create_mapping(lg->domain, offset);
242}
243
244static void lp_gpio_irq_handler(unsigned irq, struct irq_desc *desc)
245{
246 struct irq_data *data = irq_desc_get_irq_data(desc);
247 struct lp_gpio *lg = irq_data_get_irq_handler_data(data);
248 struct irq_chip *chip = irq_data_get_irq_chip(data);
249 u32 base, pin, mask;
250 unsigned long reg, pending;
251 unsigned virq;
252
253 /* check from GPIO controller which pin triggered the interrupt */
254 for (base = 0; base < lg->chip.ngpio; base += 32) {
255 reg = lp_gpio_reg(&lg->chip, base, LP_INT_STAT);
256
257 while ((pending = inl(reg))) {
258 pin = __ffs(pending);
259 mask = BIT(pin);
260 /* Clear before handling so we don't lose an edge */
261 outl(mask, reg);
262 virq = irq_find_mapping(lg->domain, base + pin);
263 generic_handle_irq(virq);
264 }
265 }
266 chip->irq_eoi(data);
267}
268
269static void lp_irq_unmask(struct irq_data *d)
270{
271}
272
273static void lp_irq_mask(struct irq_data *d)
274{
275}
276
277static void lp_irq_enable(struct irq_data *d)
278{
279 struct lp_gpio *lg = irq_data_get_irq_chip_data(d);
280 u32 hwirq = irqd_to_hwirq(d);
281 unsigned long reg = lp_gpio_reg(&lg->chip, hwirq, LP_INT_ENABLE);
282 unsigned long flags;
283
284 spin_lock_irqsave(&lg->lock, flags);
285 outl(inl(reg) | BIT(hwirq % 32), reg);
286 spin_unlock_irqrestore(&lg->lock, flags);
287}
288
289static void lp_irq_disable(struct irq_data *d)
290{
291 struct lp_gpio *lg = irq_data_get_irq_chip_data(d);
292 u32 hwirq = irqd_to_hwirq(d);
293 unsigned long reg = lp_gpio_reg(&lg->chip, hwirq, LP_INT_ENABLE);
294 unsigned long flags;
295
296 spin_lock_irqsave(&lg->lock, flags);
297 outl(inl(reg) & ~BIT(hwirq % 32), reg);
298 spin_unlock_irqrestore(&lg->lock, flags);
299}
300
301static struct irq_chip lp_irqchip = {
302 .name = "LP-GPIO",
303 .irq_mask = lp_irq_mask,
304 .irq_unmask = lp_irq_unmask,
305 .irq_enable = lp_irq_enable,
306 .irq_disable = lp_irq_disable,
307 .irq_set_type = lp_irq_type,
308 .flags = IRQCHIP_SKIP_SET_WAKE,
309};
310
311static void lp_gpio_irq_init_hw(struct lp_gpio *lg)
312{
313 unsigned long reg;
314 unsigned base;
315
316 for (base = 0; base < lg->chip.ngpio; base += 32) {
317 /* disable gpio pin interrupts */
318 reg = lp_gpio_reg(&lg->chip, base, LP_INT_ENABLE);
319 outl(0, reg);
320 /* Clear interrupt status register */
321 reg = lp_gpio_reg(&lg->chip, base, LP_INT_STAT);
322 outl(0xffffffff, reg);
323 }
324}
325
326static int lp_gpio_irq_map(struct irq_domain *d, unsigned int virq,
327 irq_hw_number_t hw)
328{
329 struct lp_gpio *lg = d->host_data;
330
331 irq_set_chip_and_handler_name(virq, &lp_irqchip, handle_simple_irq,
332 "demux");
333 irq_set_chip_data(virq, lg);
334 irq_set_irq_type(virq, IRQ_TYPE_NONE);
335
336 return 0;
337}
338
339static const struct irq_domain_ops lp_gpio_irq_ops = {
340 .map = lp_gpio_irq_map,
341};
342
343static int lp_gpio_probe(struct platform_device *pdev)
344{
345 struct lp_gpio *lg;
346 struct gpio_chip *gc;
347 struct resource *io_rc, *irq_rc;
348 struct device *dev = &pdev->dev;
349 unsigned long reg_len;
350 unsigned hwirq;
351 int ret = -ENODEV;
352
353 lg = devm_kzalloc(dev, sizeof(struct lp_gpio), GFP_KERNEL);
354 if (!lg) {
355 dev_err(dev, "can't allocate lp_gpio chip data\n");
356 return -ENOMEM;
357 }
358
359 lg->pdev = pdev;
360 platform_set_drvdata(pdev, lg);
361
362 io_rc = platform_get_resource(pdev, IORESOURCE_IO, 0);
363 irq_rc = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
364
365 if (!io_rc) {
366 dev_err(dev, "missing IO resources\n");
367 return -EINVAL;
368 }
369
370 lg->reg_base = io_rc->start;
371 reg_len = resource_size(io_rc);
372
373 if (!devm_request_region(dev, lg->reg_base, reg_len, "lp-gpio")) {
374 dev_err(dev, "failed requesting IO region 0x%x\n",
375 (unsigned int)lg->reg_base);
376 return -EBUSY;
377 }
378
379 spin_lock_init(&lg->lock);
380
381 gc = &lg->chip;
382 gc->label = dev_name(dev);
383 gc->owner = THIS_MODULE;
384 gc->request = lp_gpio_request;
385 gc->free = lp_gpio_free;
386 gc->direction_input = lp_gpio_direction_input;
387 gc->direction_output = lp_gpio_direction_output;
388 gc->get = lp_gpio_get;
389 gc->set = lp_gpio_set;
390 gc->base = -1;
391 gc->ngpio = LP_NUM_GPIO;
392 gc->can_sleep = 0;
393 gc->dev = dev;
394
395 /* set up interrupts */
396 if (irq_rc && irq_rc->start) {
397 hwirq = irq_rc->start;
398 gc->to_irq = lp_gpio_to_irq;
399
400 lg->domain = irq_domain_add_linear(NULL, LP_NUM_GPIO,
401 &lp_gpio_irq_ops, lg);
402 if (!lg->domain)
403 return -ENXIO;
404
405 lp_gpio_irq_init_hw(lg);
406
407 irq_set_handler_data(hwirq, lg);
408 irq_set_chained_handler(hwirq, lp_gpio_irq_handler);
409 }
410
411 ret = gpiochip_add(gc);
412 if (ret) {
413 dev_err(dev, "failed adding lp-gpio chip\n");
414 return ret;
415 }
416 pm_runtime_enable(dev);
417
418 return 0;
419}
420
421static int lp_gpio_runtime_suspend(struct device *dev)
422{
423 return 0;
424}
425
426static int lp_gpio_runtime_resume(struct device *dev)
427{
428 return 0;
429}
430
431static const struct dev_pm_ops lp_gpio_pm_ops = {
432 .runtime_suspend = lp_gpio_runtime_suspend,
433 .runtime_resume = lp_gpio_runtime_resume,
434};
435
436static const struct acpi_device_id lynxpoint_gpio_acpi_match[] = {
437 { "INT33C7", 0 },
438 { }
439};
440MODULE_DEVICE_TABLE(acpi, lynxpoint_gpio_acpi_match);
441
442static int lp_gpio_remove(struct platform_device *pdev)
443{
444 struct lp_gpio *lg = platform_get_drvdata(pdev);
445 int err;
446 err = gpiochip_remove(&lg->chip);
447 if (err)
448 dev_warn(&pdev->dev, "failed to remove gpio_chip.\n");
449 platform_set_drvdata(pdev, NULL);
450 return 0;
451}
452
453static struct platform_driver lp_gpio_driver = {
454 .probe = lp_gpio_probe,
455 .remove = lp_gpio_remove,
456 .driver = {
457 .name = "lp_gpio",
458 .owner = THIS_MODULE,
459 .pm = &lp_gpio_pm_ops,
460 .acpi_match_table = ACPI_PTR(lynxpoint_gpio_acpi_match),
461 },
462};
463
464static int __init lp_gpio_init(void)
465{
466 return platform_driver_register(&lp_gpio_driver);
467}
468
469subsys_initcall(lp_gpio_init);
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index 7d9bd94be8d2..6819d63cb167 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -547,7 +547,6 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
547 mvchip->membase = devm_request_and_ioremap(&pdev->dev, res); 547 mvchip->membase = devm_request_and_ioremap(&pdev->dev, res);
548 if (! mvchip->membase) { 548 if (! mvchip->membase) {
549 dev_err(&pdev->dev, "Cannot ioremap\n"); 549 dev_err(&pdev->dev, "Cannot ioremap\n");
550 kfree(mvchip->chip.label);
551 return -ENOMEM; 550 return -ENOMEM;
552 } 551 }
553 552
@@ -557,14 +556,12 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
557 res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 556 res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
558 if (! res) { 557 if (! res) {
559 dev_err(&pdev->dev, "Cannot get memory resource\n"); 558 dev_err(&pdev->dev, "Cannot get memory resource\n");
560 kfree(mvchip->chip.label);
561 return -ENODEV; 559 return -ENODEV;
562 } 560 }
563 561
564 mvchip->percpu_membase = devm_request_and_ioremap(&pdev->dev, res); 562 mvchip->percpu_membase = devm_request_and_ioremap(&pdev->dev, res);
565 if (! mvchip->percpu_membase) { 563 if (! mvchip->percpu_membase) {
566 dev_err(&pdev->dev, "Cannot ioremap\n"); 564 dev_err(&pdev->dev, "Cannot ioremap\n");
567 kfree(mvchip->chip.label);
568 return -ENOMEM; 565 return -ENOMEM;
569 } 566 }
570 } 567 }
@@ -625,7 +622,6 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
625 mvchip->irqbase = irq_alloc_descs(-1, 0, ngpios, -1); 622 mvchip->irqbase = irq_alloc_descs(-1, 0, ngpios, -1);
626 if (mvchip->irqbase < 0) { 623 if (mvchip->irqbase < 0) {
627 dev_err(&pdev->dev, "no irqs\n"); 624 dev_err(&pdev->dev, "no irqs\n");
628 kfree(mvchip->chip.label);
629 return -ENOMEM; 625 return -ENOMEM;
630 } 626 }
631 627
@@ -633,7 +629,6 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
633 mvchip->membase, handle_level_irq); 629 mvchip->membase, handle_level_irq);
634 if (! gc) { 630 if (! gc) {
635 dev_err(&pdev->dev, "Cannot allocate generic irq_chip\n"); 631 dev_err(&pdev->dev, "Cannot allocate generic irq_chip\n");
636 kfree(mvchip->chip.label);
637 return -ENOMEM; 632 return -ENOMEM;
638 } 633 }
639 634
@@ -668,7 +663,6 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
668 irq_remove_generic_chip(gc, IRQ_MSK(ngpios), IRQ_NOREQUEST, 663 irq_remove_generic_chip(gc, IRQ_MSK(ngpios), IRQ_NOREQUEST,
669 IRQ_LEVEL | IRQ_NOPROBE); 664 IRQ_LEVEL | IRQ_NOPROBE);
670 kfree(gc); 665 kfree(gc);
671 kfree(mvchip->chip.label);
672 return -ENODEV; 666 return -ENODEV;
673 } 667 }
674 668
diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c
index 01f7fe955590..76be7eed79de 100644
--- a/drivers/gpio/gpio-samsung.c
+++ b/drivers/gpio/gpio-samsung.c
@@ -32,7 +32,6 @@
32 32
33#include <mach/hardware.h> 33#include <mach/hardware.h>
34#include <mach/map.h> 34#include <mach/map.h>
35#include <mach/regs-clock.h>
36#include <mach/regs-gpio.h> 35#include <mach/regs-gpio.h>
37 36
38#include <plat/cpu.h> 37#include <plat/cpu.h>
@@ -446,7 +445,7 @@ static struct samsung_gpio_cfg s3c24xx_gpiocfg_banka = {
446}; 445};
447#endif 446#endif
448 447
449#if defined(CONFIG_ARCH_EXYNOS4) || defined(CONFIG_ARCH_EXYNOS5) 448#if defined(CONFIG_ARCH_EXYNOS4) || defined(CONFIG_SOC_EXYNOS5250)
450static struct samsung_gpio_cfg exynos_gpio_cfg = { 449static struct samsung_gpio_cfg exynos_gpio_cfg = {
451 .set_pull = exynos_gpio_setpull, 450 .set_pull = exynos_gpio_setpull,
452 .get_pull = exynos_gpio_getpull, 451 .get_pull = exynos_gpio_getpull,
@@ -2446,7 +2445,7 @@ static struct samsung_gpio_chip exynos4_gpios_3[] = {
2446}; 2445};
2447#endif 2446#endif
2448 2447
2449#ifdef CONFIG_ARCH_EXYNOS5 2448#ifdef CONFIG_SOC_EXYNOS5250
2450static struct samsung_gpio_chip exynos5_gpios_1[] = { 2449static struct samsung_gpio_chip exynos5_gpios_1[] = {
2451 { 2450 {
2452 .chip = { 2451 .chip = {
@@ -2614,7 +2613,7 @@ static struct samsung_gpio_chip exynos5_gpios_1[] = {
2614}; 2613};
2615#endif 2614#endif
2616 2615
2617#ifdef CONFIG_ARCH_EXYNOS5 2616#ifdef CONFIG_SOC_EXYNOS5250
2618static struct samsung_gpio_chip exynos5_gpios_2[] = { 2617static struct samsung_gpio_chip exynos5_gpios_2[] = {
2619 { 2618 {
2620 .chip = { 2619 .chip = {
@@ -2675,7 +2674,7 @@ static struct samsung_gpio_chip exynos5_gpios_2[] = {
2675}; 2674};
2676#endif 2675#endif
2677 2676
2678#ifdef CONFIG_ARCH_EXYNOS5 2677#ifdef CONFIG_SOC_EXYNOS5250
2679static struct samsung_gpio_chip exynos5_gpios_3[] = { 2678static struct samsung_gpio_chip exynos5_gpios_3[] = {
2680 { 2679 {
2681 .chip = { 2680 .chip = {
@@ -2711,7 +2710,7 @@ static struct samsung_gpio_chip exynos5_gpios_3[] = {
2711}; 2710};
2712#endif 2711#endif
2713 2712
2714#ifdef CONFIG_ARCH_EXYNOS5 2713#ifdef CONFIG_SOC_EXYNOS5250
2715static struct samsung_gpio_chip exynos5_gpios_4[] = { 2714static struct samsung_gpio_chip exynos5_gpios_4[] = {
2716 { 2715 {
2717 .chip = { 2716 .chip = {
@@ -3010,7 +3009,7 @@ static __init int samsung_gpiolib_init(void)
3010 int i, nr_chips; 3009 int i, nr_chips;
3011 int group = 0; 3010 int group = 0;
3012 3011
3013#ifdef CONFIG_PINCTRL_SAMSUNG 3012#if defined(CONFIG_PINCTRL_EXYNOS) || defined(CONFIG_PINCTRL_EXYNOS5440)
3014 /* 3013 /*
3015 * This gpio driver includes support for device tree support and there 3014 * This gpio driver includes support for device tree support and there
3016 * are platforms using it. In order to maintain compatibility with those 3015 * are platforms using it. In order to maintain compatibility with those
@@ -3026,6 +3025,7 @@ static __init int samsung_gpiolib_init(void)
3026 static const struct of_device_id exynos_pinctrl_ids[] = { 3025 static const struct of_device_id exynos_pinctrl_ids[] = {
3027 { .compatible = "samsung,pinctrl-exynos4210", }, 3026 { .compatible = "samsung,pinctrl-exynos4210", },
3028 { .compatible = "samsung,pinctrl-exynos4x12", }, 3027 { .compatible = "samsung,pinctrl-exynos4x12", },
3028 { .compatible = "samsung,pinctrl-exynos5440", },
3029 }; 3029 };
3030 for_each_matching_node(pctrl_np, exynos_pinctrl_ids) 3030 for_each_matching_node(pctrl_np, exynos_pinctrl_ids)
3031 if (pctrl_np && of_device_is_available(pctrl_np)) 3031 if (pctrl_np && of_device_is_available(pctrl_np))
diff --git a/drivers/gpio/gpio-ts5500.c b/drivers/gpio/gpio-ts5500.c
index 0634ceea3c24..cc53cab8df2a 100644
--- a/drivers/gpio/gpio-ts5500.c
+++ b/drivers/gpio/gpio-ts5500.c
@@ -319,7 +319,7 @@ static void ts5500_disable_irq(struct ts5500_priv *priv)
319 spin_unlock_irqrestore(&priv->lock, flags); 319 spin_unlock_irqrestore(&priv->lock, flags);
320} 320}
321 321
322static int __devinit ts5500_dio_probe(struct platform_device *pdev) 322static int ts5500_dio_probe(struct platform_device *pdev)
323{ 323{
324 enum ts5500_blocks block = platform_get_device_id(pdev)->driver_data; 324 enum ts5500_blocks block = platform_get_device_id(pdev)->driver_data;
325 struct ts5500_dio_platform_data *pdata = pdev->dev.platform_data; 325 struct ts5500_dio_platform_data *pdata = pdev->dev.platform_data;
@@ -432,7 +432,7 @@ cleanup:
432 return ret; 432 return ret;
433} 433}
434 434
435static int __devexit ts5500_dio_remove(struct platform_device *pdev) 435static int ts5500_dio_remove(struct platform_device *pdev)
436{ 436{
437 struct ts5500_priv *priv = platform_get_drvdata(pdev); 437 struct ts5500_priv *priv = platform_get_drvdata(pdev);
438 438
@@ -455,7 +455,7 @@ static struct platform_driver ts5500_dio_driver = {
455 .owner = THIS_MODULE, 455 .owner = THIS_MODULE,
456 }, 456 },
457 .probe = ts5500_dio_probe, 457 .probe = ts5500_dio_probe,
458 .remove = __devexit_p(ts5500_dio_remove), 458 .remove = ts5500_dio_remove,
459 .id_table = ts5500_dio_ids, 459 .id_table = ts5500_dio_ids,
460}; 460};
461 461
diff --git a/drivers/gpio/gpio-viperboard.c b/drivers/gpio/gpio-viperboard.c
index 13772996cf24..59d72391de26 100644
--- a/drivers/gpio/gpio-viperboard.c
+++ b/drivers/gpio/gpio-viperboard.c
@@ -400,7 +400,7 @@ static int vprbrd_gpiob_direction_output(struct gpio_chip *chip,
400 400
401/* ----- end of gpio b chip ---------------------------------------------- */ 401/* ----- end of gpio b chip ---------------------------------------------- */
402 402
403static int __devinit vprbrd_gpio_probe(struct platform_device *pdev) 403static int vprbrd_gpio_probe(struct platform_device *pdev)
404{ 404{
405 struct vprbrd *vb = dev_get_drvdata(pdev->dev.parent); 405 struct vprbrd *vb = dev_get_drvdata(pdev->dev.parent);
406 struct vprbrd_gpio *vb_gpio; 406 struct vprbrd_gpio *vb_gpio;
@@ -456,7 +456,7 @@ err_gpioa:
456 return ret; 456 return ret;
457} 457}
458 458
459static int __devexit vprbrd_gpio_remove(struct platform_device *pdev) 459static int vprbrd_gpio_remove(struct platform_device *pdev)
460{ 460{
461 struct vprbrd_gpio *vb_gpio = platform_get_drvdata(pdev); 461 struct vprbrd_gpio *vb_gpio = platform_get_drvdata(pdev);
462 int ret; 462 int ret;
@@ -472,7 +472,7 @@ static struct platform_driver vprbrd_gpio_driver = {
472 .driver.name = "viperboard-gpio", 472 .driver.name = "viperboard-gpio",
473 .driver.owner = THIS_MODULE, 473 .driver.owner = THIS_MODULE,
474 .probe = vprbrd_gpio_probe, 474 .probe = vprbrd_gpio_probe,
475 .remove = __devexit_p(vprbrd_gpio_remove), 475 .remove = vprbrd_gpio_remove,
476}; 476};
477 477
478static int __init vprbrd_gpio_init(void) 478static int __init vprbrd_gpio_init(void)
diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c
index 31123b6a0be5..2d2c2f8d6dc6 100644
--- a/drivers/gpu/drm/ast/ast_drv.c
+++ b/drivers/gpu/drm/ast/ast_drv.c
@@ -60,8 +60,7 @@ static DEFINE_PCI_DEVICE_TABLE(pciidlist) = {
60 60
61MODULE_DEVICE_TABLE(pci, pciidlist); 61MODULE_DEVICE_TABLE(pci, pciidlist);
62 62
63static int __devinit 63static int ast_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
64ast_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
65{ 64{
66 return drm_get_pci_dev(pdev, ent, &driver); 65 return drm_get_pci_dev(pdev, ent, &driver);
67} 66}
diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.c b/drivers/gpu/drm/cirrus/cirrus_drv.c
index dcd1a8c029eb..8ecb601152ef 100644
--- a/drivers/gpu/drm/cirrus/cirrus_drv.c
+++ b/drivers/gpu/drm/cirrus/cirrus_drv.c
@@ -56,8 +56,8 @@ static int cirrus_kick_out_firmware_fb(struct pci_dev *pdev)
56 return 0; 56 return 0;
57} 57}
58 58
59static int __devinit 59static int cirrus_pci_probe(struct pci_dev *pdev,
60cirrus_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 60 const struct pci_device_id *ent)
61{ 61{
62 int ret; 62 int ret;
63 63
diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
index 0761a03cdbb2..2aa331499f81 100644
--- a/drivers/gpu/drm/drm_mm.c
+++ b/drivers/gpu/drm/drm_mm.c
@@ -184,19 +184,27 @@ EXPORT_SYMBOL(drm_mm_get_block_generic);
184 * -ENOSPC if no suitable free area is available. The preallocated memory node 184 * -ENOSPC if no suitable free area is available. The preallocated memory node
185 * must be cleared. 185 * must be cleared.
186 */ 186 */
187int drm_mm_insert_node(struct drm_mm *mm, struct drm_mm_node *node, 187int drm_mm_insert_node_generic(struct drm_mm *mm, struct drm_mm_node *node,
188 unsigned long size, unsigned alignment) 188 unsigned long size, unsigned alignment,
189 unsigned long color)
189{ 190{
190 struct drm_mm_node *hole_node; 191 struct drm_mm_node *hole_node;
191 192
192 hole_node = drm_mm_search_free(mm, size, alignment, false); 193 hole_node = drm_mm_search_free_generic(mm, size, alignment,
194 color, 0);
193 if (!hole_node) 195 if (!hole_node)
194 return -ENOSPC; 196 return -ENOSPC;
195 197
196 drm_mm_insert_helper(hole_node, node, size, alignment, 0); 198 drm_mm_insert_helper(hole_node, node, size, alignment, color);
197
198 return 0; 199 return 0;
199} 200}
201EXPORT_SYMBOL(drm_mm_insert_node_generic);
202
203int drm_mm_insert_node(struct drm_mm *mm, struct drm_mm_node *node,
204 unsigned long size, unsigned alignment)
205{
206 return drm_mm_insert_node_generic(mm, node, size, alignment, 0);
207}
200EXPORT_SYMBOL(drm_mm_insert_node); 208EXPORT_SYMBOL(drm_mm_insert_node);
201 209
202static void drm_mm_insert_helper_range(struct drm_mm_node *hole_node, 210static void drm_mm_insert_helper_range(struct drm_mm_node *hole_node,
@@ -213,11 +221,13 @@ static void drm_mm_insert_helper_range(struct drm_mm_node *hole_node,
213 221
214 BUG_ON(!hole_node->hole_follows || node->allocated); 222 BUG_ON(!hole_node->hole_follows || node->allocated);
215 223
216 if (mm->color_adjust)
217 mm->color_adjust(hole_node, color, &adj_start, &adj_end);
218
219 if (adj_start < start) 224 if (adj_start < start)
220 adj_start = start; 225 adj_start = start;
226 if (adj_end > end)
227 adj_end = end;
228
229 if (mm->color_adjust)
230 mm->color_adjust(hole_node, color, &adj_start, &adj_end);
221 231
222 if (alignment) { 232 if (alignment) {
223 unsigned tmp = adj_start % alignment; 233 unsigned tmp = adj_start % alignment;
@@ -275,22 +285,31 @@ EXPORT_SYMBOL(drm_mm_get_block_range_generic);
275 * -ENOSPC if no suitable free area is available. This is for range 285 * -ENOSPC if no suitable free area is available. This is for range
276 * restricted allocations. The preallocated memory node must be cleared. 286 * restricted allocations. The preallocated memory node must be cleared.
277 */ 287 */
278int drm_mm_insert_node_in_range(struct drm_mm *mm, struct drm_mm_node *node, 288int drm_mm_insert_node_in_range_generic(struct drm_mm *mm, struct drm_mm_node *node,
279 unsigned long size, unsigned alignment, 289 unsigned long size, unsigned alignment, unsigned long color,
280 unsigned long start, unsigned long end) 290 unsigned long start, unsigned long end)
281{ 291{
282 struct drm_mm_node *hole_node; 292 struct drm_mm_node *hole_node;
283 293
284 hole_node = drm_mm_search_free_in_range(mm, size, alignment, 294 hole_node = drm_mm_search_free_in_range_generic(mm,
285 start, end, false); 295 size, alignment, color,
296 start, end, 0);
286 if (!hole_node) 297 if (!hole_node)
287 return -ENOSPC; 298 return -ENOSPC;
288 299
289 drm_mm_insert_helper_range(hole_node, node, size, alignment, 0, 300 drm_mm_insert_helper_range(hole_node, node,
301 size, alignment, color,
290 start, end); 302 start, end);
291
292 return 0; 303 return 0;
293} 304}
305EXPORT_SYMBOL(drm_mm_insert_node_in_range_generic);
306
307int drm_mm_insert_node_in_range(struct drm_mm *mm, struct drm_mm_node *node,
308 unsigned long size, unsigned alignment,
309 unsigned long start, unsigned long end)
310{
311 return drm_mm_insert_node_in_range_generic(mm, node, size, alignment, 0, start, end);
312}
294EXPORT_SYMBOL(drm_mm_insert_node_in_range); 313EXPORT_SYMBOL(drm_mm_insert_node_in_range);
295 314
296/** 315/**
@@ -489,7 +508,7 @@ void drm_mm_init_scan(struct drm_mm *mm,
489 mm->scan_size = size; 508 mm->scan_size = size;
490 mm->scanned_blocks = 0; 509 mm->scanned_blocks = 0;
491 mm->scan_hit_start = 0; 510 mm->scan_hit_start = 0;
492 mm->scan_hit_size = 0; 511 mm->scan_hit_end = 0;
493 mm->scan_check_range = 0; 512 mm->scan_check_range = 0;
494 mm->prev_scanned_node = NULL; 513 mm->prev_scanned_node = NULL;
495} 514}
@@ -516,7 +535,7 @@ void drm_mm_init_scan_with_range(struct drm_mm *mm,
516 mm->scan_size = size; 535 mm->scan_size = size;
517 mm->scanned_blocks = 0; 536 mm->scanned_blocks = 0;
518 mm->scan_hit_start = 0; 537 mm->scan_hit_start = 0;
519 mm->scan_hit_size = 0; 538 mm->scan_hit_end = 0;
520 mm->scan_start = start; 539 mm->scan_start = start;
521 mm->scan_end = end; 540 mm->scan_end = end;
522 mm->scan_check_range = 1; 541 mm->scan_check_range = 1;
@@ -535,8 +554,7 @@ int drm_mm_scan_add_block(struct drm_mm_node *node)
535 struct drm_mm *mm = node->mm; 554 struct drm_mm *mm = node->mm;
536 struct drm_mm_node *prev_node; 555 struct drm_mm_node *prev_node;
537 unsigned long hole_start, hole_end; 556 unsigned long hole_start, hole_end;
538 unsigned long adj_start; 557 unsigned long adj_start, adj_end;
539 unsigned long adj_end;
540 558
541 mm->scanned_blocks++; 559 mm->scanned_blocks++;
542 560
@@ -553,14 +571,8 @@ int drm_mm_scan_add_block(struct drm_mm_node *node)
553 node->node_list.next = &mm->prev_scanned_node->node_list; 571 node->node_list.next = &mm->prev_scanned_node->node_list;
554 mm->prev_scanned_node = node; 572 mm->prev_scanned_node = node;
555 573
556 hole_start = drm_mm_hole_node_start(prev_node); 574 adj_start = hole_start = drm_mm_hole_node_start(prev_node);
557 hole_end = drm_mm_hole_node_end(prev_node); 575 adj_end = hole_end = drm_mm_hole_node_end(prev_node);
558
559 adj_start = hole_start;
560 adj_end = hole_end;
561
562 if (mm->color_adjust)
563 mm->color_adjust(prev_node, mm->scan_color, &adj_start, &adj_end);
564 576
565 if (mm->scan_check_range) { 577 if (mm->scan_check_range) {
566 if (adj_start < mm->scan_start) 578 if (adj_start < mm->scan_start)
@@ -569,11 +581,14 @@ int drm_mm_scan_add_block(struct drm_mm_node *node)
569 adj_end = mm->scan_end; 581 adj_end = mm->scan_end;
570 } 582 }
571 583
584 if (mm->color_adjust)
585 mm->color_adjust(prev_node, mm->scan_color,
586 &adj_start, &adj_end);
587
572 if (check_free_hole(adj_start, adj_end, 588 if (check_free_hole(adj_start, adj_end,
573 mm->scan_size, mm->scan_alignment)) { 589 mm->scan_size, mm->scan_alignment)) {
574 mm->scan_hit_start = hole_start; 590 mm->scan_hit_start = hole_start;
575 mm->scan_hit_size = hole_end; 591 mm->scan_hit_end = hole_end;
576
577 return 1; 592 return 1;
578 } 593 }
579 594
@@ -609,19 +624,10 @@ int drm_mm_scan_remove_block(struct drm_mm_node *node)
609 node_list); 624 node_list);
610 625
611 prev_node->hole_follows = node->scanned_preceeds_hole; 626 prev_node->hole_follows = node->scanned_preceeds_hole;
612 INIT_LIST_HEAD(&node->node_list);
613 list_add(&node->node_list, &prev_node->node_list); 627 list_add(&node->node_list, &prev_node->node_list);
614 628
615 /* Only need to check for containement because start&size for the 629 return (drm_mm_hole_node_end(node) > mm->scan_hit_start &&
616 * complete resulting free block (not just the desired part) is 630 node->start < mm->scan_hit_end);
617 * stored. */
618 if (node->start >= mm->scan_hit_start &&
619 node->start + node->size
620 <= mm->scan_hit_start + mm->scan_hit_size) {
621 return 1;
622 }
623
624 return 0;
625} 631}
626EXPORT_SYMBOL(drm_mm_scan_remove_block); 632EXPORT_SYMBOL(drm_mm_scan_remove_block);
627 633
diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig
index 1d1f1e5e33f0..046bcda36abe 100644
--- a/drivers/gpu/drm/exynos/Kconfig
+++ b/drivers/gpu/drm/exynos/Kconfig
@@ -24,7 +24,7 @@ config DRM_EXYNOS_DMABUF
24 24
25config DRM_EXYNOS_FIMD 25config DRM_EXYNOS_FIMD
26 bool "Exynos DRM FIMD" 26 bool "Exynos DRM FIMD"
27 depends on DRM_EXYNOS && !FB_S3C 27 depends on DRM_EXYNOS && !FB_S3C && !ARCH_MULTIPLATFORM
28 help 28 help
29 Choose this option if you want to use Exynos FIMD for DRM. 29 Choose this option if you want to use Exynos FIMD for DRM.
30 30
@@ -48,7 +48,7 @@ config DRM_EXYNOS_G2D
48 48
49config DRM_EXYNOS_IPP 49config DRM_EXYNOS_IPP
50 bool "Exynos DRM IPP" 50 bool "Exynos DRM IPP"
51 depends on DRM_EXYNOS 51 depends on DRM_EXYNOS && !ARCH_MULTIPLATFORM
52 help 52 help
53 Choose this option if you want to use IPP feature for DRM. 53 Choose this option if you want to use IPP feature for DRM.
54 54
diff --git a/drivers/gpu/drm/exynos/exynos_ddc.c b/drivers/gpu/drm/exynos/exynos_ddc.c
index bef43e0342a6..4e9b5ba8edff 100644
--- a/drivers/gpu/drm/exynos/exynos_ddc.c
+++ b/drivers/gpu/drm/exynos/exynos_ddc.c
@@ -66,6 +66,6 @@ struct i2c_driver ddc_driver = {
66 }, 66 },
67 .id_table = ddc_idtable, 67 .id_table = ddc_idtable,
68 .probe = s5p_ddc_probe, 68 .probe = s5p_ddc_probe,
69 .remove = __devexit_p(s5p_ddc_remove), 69 .remove = s5p_ddc_remove,
70 .command = NULL, 70 .command = NULL,
71}; 71};
diff --git a/drivers/gpu/drm/exynos/exynos_drm_buf.c b/drivers/gpu/drm/exynos/exynos_drm_buf.c
index 9601bad47a2e..57affae9568b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_buf.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_buf.c
@@ -3,24 +3,10 @@
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * Author: Inki Dae <inki.dae@samsung.com> 4 * Author: Inki Dae <inki.dae@samsung.com>
5 * 5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a 6 * This program is free software; you can redistribute it and/or modify it
7 * copy of this software and associated documentation files (the "Software"), 7 * under the terms of the GNU General Public License as published by the
8 * to deal in the Software without restriction, including without limitation 8 * Free Software Foundation; either version 2 of the License, or (at your
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * option) any later version.
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
15 * Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */ 10 */
25 11
26#include <drm/drmP.h> 12#include <drm/drmP.h>
@@ -29,6 +15,7 @@
29#include "exynos_drm_drv.h" 15#include "exynos_drm_drv.h"
30#include "exynos_drm_gem.h" 16#include "exynos_drm_gem.h"
31#include "exynos_drm_buf.h" 17#include "exynos_drm_buf.h"
18#include "exynos_drm_iommu.h"
32 19
33static int lowlevel_buffer_allocate(struct drm_device *dev, 20static int lowlevel_buffer_allocate(struct drm_device *dev,
34 unsigned int flags, struct exynos_drm_gem_buf *buf) 21 unsigned int flags, struct exynos_drm_gem_buf *buf)
@@ -51,7 +38,7 @@ static int lowlevel_buffer_allocate(struct drm_device *dev,
51 * region will be allocated else physically contiguous 38 * region will be allocated else physically contiguous
52 * as possible. 39 * as possible.
53 */ 40 */
54 if (flags & EXYNOS_BO_CONTIG) 41 if (!(flags & EXYNOS_BO_NONCONTIG))
55 dma_set_attr(DMA_ATTR_FORCE_CONTIGUOUS, &buf->dma_attrs); 42 dma_set_attr(DMA_ATTR_FORCE_CONTIGUOUS, &buf->dma_attrs);
56 43
57 /* 44 /*
@@ -66,14 +53,45 @@ static int lowlevel_buffer_allocate(struct drm_device *dev,
66 dma_set_attr(attr, &buf->dma_attrs); 53 dma_set_attr(attr, &buf->dma_attrs);
67 dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, &buf->dma_attrs); 54 dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, &buf->dma_attrs);
68 55
69 buf->pages = dma_alloc_attrs(dev->dev, buf->size, 56 nr_pages = buf->size >> PAGE_SHIFT;
70 &buf->dma_addr, GFP_KERNEL, &buf->dma_attrs); 57
71 if (!buf->pages) { 58 if (!is_drm_iommu_supported(dev)) {
72 DRM_ERROR("failed to allocate buffer.\n"); 59 dma_addr_t start_addr;
73 return -ENOMEM; 60 unsigned int i = 0;
61
62 buf->pages = kzalloc(sizeof(struct page) * nr_pages,
63 GFP_KERNEL);
64 if (!buf->pages) {
65 DRM_ERROR("failed to allocate pages.\n");
66 return -ENOMEM;
67 }
68
69 buf->kvaddr = dma_alloc_attrs(dev->dev, buf->size,
70 &buf->dma_addr, GFP_KERNEL,
71 &buf->dma_attrs);
72 if (!buf->kvaddr) {
73 DRM_ERROR("failed to allocate buffer.\n");
74 kfree(buf->pages);
75 return -ENOMEM;
76 }
77
78 start_addr = buf->dma_addr;
79 while (i < nr_pages) {
80 buf->pages[i] = phys_to_page(start_addr);
81 start_addr += PAGE_SIZE;
82 i++;
83 }
84 } else {
85
86 buf->pages = dma_alloc_attrs(dev->dev, buf->size,
87 &buf->dma_addr, GFP_KERNEL,
88 &buf->dma_attrs);
89 if (!buf->pages) {
90 DRM_ERROR("failed to allocate buffer.\n");
91 return -ENOMEM;
92 }
74 } 93 }
75 94
76 nr_pages = buf->size >> PAGE_SHIFT;
77 buf->sgt = drm_prime_pages_to_sg(buf->pages, nr_pages); 95 buf->sgt = drm_prime_pages_to_sg(buf->pages, nr_pages);
78 if (!buf->sgt) { 96 if (!buf->sgt) {
79 DRM_ERROR("failed to get sg table.\n"); 97 DRM_ERROR("failed to get sg table.\n");
@@ -92,6 +110,9 @@ err_free_attrs:
92 (dma_addr_t)buf->dma_addr, &buf->dma_attrs); 110 (dma_addr_t)buf->dma_addr, &buf->dma_attrs);
93 buf->dma_addr = (dma_addr_t)NULL; 111 buf->dma_addr = (dma_addr_t)NULL;
94 112
113 if (!is_drm_iommu_supported(dev))
114 kfree(buf->pages);
115
95 return ret; 116 return ret;
96} 117}
97 118
@@ -114,8 +135,14 @@ static void lowlevel_buffer_deallocate(struct drm_device *dev,
114 kfree(buf->sgt); 135 kfree(buf->sgt);
115 buf->sgt = NULL; 136 buf->sgt = NULL;
116 137
117 dma_free_attrs(dev->dev, buf->size, buf->pages, 138 if (!is_drm_iommu_supported(dev)) {
139 dma_free_attrs(dev->dev, buf->size, buf->kvaddr,
118 (dma_addr_t)buf->dma_addr, &buf->dma_attrs); 140 (dma_addr_t)buf->dma_addr, &buf->dma_attrs);
141 kfree(buf->pages);
142 } else
143 dma_free_attrs(dev->dev, buf->size, buf->pages,
144 (dma_addr_t)buf->dma_addr, &buf->dma_attrs);
145
119 buf->dma_addr = (dma_addr_t)NULL; 146 buf->dma_addr = (dma_addr_t)NULL;
120} 147}
121 148
diff --git a/drivers/gpu/drm/exynos/exynos_drm_buf.h b/drivers/gpu/drm/exynos/exynos_drm_buf.h
index 25cf16285033..a6412f19673c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_buf.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_buf.h
@@ -3,24 +3,10 @@
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * Author: Inki Dae <inki.dae@samsung.com> 4 * Author: Inki Dae <inki.dae@samsung.com>
5 * 5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a 6 * This program is free software; you can redistribute it and/or modify it
7 * copy of this software and associated documentation files (the "Software"), 7 * under the terms of the GNU General Public License as published by the
8 * to deal in the Software without restriction, including without limitation 8 * Free Software Foundation; either version 2 of the License, or (at your
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * option) any later version.
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
15 * Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */ 10 */
25 11
26#ifndef _EXYNOS_DRM_BUF_H_ 12#ifndef _EXYNOS_DRM_BUF_H_
diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c b/drivers/gpu/drm/exynos/exynos_drm_connector.c
index 0f68a2872673..4c5b6859c9ea 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_connector.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c
@@ -5,24 +5,10 @@
5 * Joonyoung Shim <jy0922.shim@samsung.com> 5 * Joonyoung Shim <jy0922.shim@samsung.com>
6 * Seung-Woo Kim <sw0312.kim@samsung.com> 6 * Seung-Woo Kim <sw0312.kim@samsung.com>
7 * 7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a 8 * This program is free software; you can redistribute it and/or modify it
9 * copy of this software and associated documentation files (the "Software"), 9 * under the terms of the GNU General Public License as published by the
10 * to deal in the Software without restriction, including without limitation 10 * Free Software Foundation; either version 2 of the License, or (at your
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 * option) any later version.
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice (including the next
16 * paragraph) shall be included in all copies or substantial portions of the
17 * Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 * OTHER DEALINGS IN THE SOFTWARE.
26 */ 12 */
27 13
28#include <drm/drmP.h> 14#include <drm/drmP.h>
@@ -32,7 +18,6 @@
32#include "exynos_drm_drv.h" 18#include "exynos_drm_drv.h"
33#include "exynos_drm_encoder.h" 19#include "exynos_drm_encoder.h"
34 20
35#define MAX_EDID 256
36#define to_exynos_connector(x) container_of(x, struct exynos_drm_connector,\ 21#define to_exynos_connector(x) container_of(x, struct exynos_drm_connector,\
37 drm_connector) 22 drm_connector)
38 23
@@ -110,7 +95,9 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector)
110 to_exynos_connector(connector); 95 to_exynos_connector(connector);
111 struct exynos_drm_manager *manager = exynos_connector->manager; 96 struct exynos_drm_manager *manager = exynos_connector->manager;
112 struct exynos_drm_display_ops *display_ops = manager->display_ops; 97 struct exynos_drm_display_ops *display_ops = manager->display_ops;
113 unsigned int count; 98 struct edid *edid = NULL;
99 unsigned int count = 0;
100 int ret;
114 101
115 DRM_DEBUG_KMS("%s\n", __FILE__); 102 DRM_DEBUG_KMS("%s\n", __FILE__);
116 103
@@ -128,27 +115,21 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector)
128 * because lcd panel has only one mode. 115 * because lcd panel has only one mode.
129 */ 116 */
130 if (display_ops->get_edid) { 117 if (display_ops->get_edid) {
131 int ret; 118 edid = display_ops->get_edid(manager->dev, connector);
132 void *edid; 119 if (IS_ERR_OR_NULL(edid)) {
133 120 ret = PTR_ERR(edid);
134 edid = kzalloc(MAX_EDID, GFP_KERNEL); 121 edid = NULL;
135 if (!edid) { 122 DRM_ERROR("Panel operation get_edid failed %d\n", ret);
136 DRM_ERROR("failed to allocate edid\n"); 123 goto out;
137 return 0;
138 } 124 }
139 125
140 ret = display_ops->get_edid(manager->dev, connector, 126 count = drm_add_edid_modes(connector, edid);
141 edid, MAX_EDID); 127 if (count < 0) {
142 if (ret < 0) { 128 DRM_ERROR("Add edid modes failed %d\n", count);
143 DRM_ERROR("failed to get edid data.\n"); 129 goto out;
144 kfree(edid);
145 edid = NULL;
146 return 0;
147 } 130 }
148 131
149 drm_mode_connector_update_edid_property(connector, edid); 132 drm_mode_connector_update_edid_property(connector, edid);
150 count = drm_add_edid_modes(connector, edid);
151 kfree(edid);
152 } else { 133 } else {
153 struct exynos_drm_panel_info *panel; 134 struct exynos_drm_panel_info *panel;
154 struct drm_display_mode *mode = drm_mode_create(connector->dev); 135 struct drm_display_mode *mode = drm_mode_create(connector->dev);
@@ -175,6 +156,8 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector)
175 count = 1; 156 count = 1;
176 } 157 }
177 158
159out:
160 kfree(edid);
178 return count; 161 return count;
179} 162}
180 163
diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.h b/drivers/gpu/drm/exynos/exynos_drm_connector.h
index 22f6cc442c3d..547c6b590357 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_connector.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_connector.h
@@ -5,24 +5,10 @@
5 * Joonyoung Shim <jy0922.shim@samsung.com> 5 * Joonyoung Shim <jy0922.shim@samsung.com>
6 * Seung-Woo Kim <sw0312.kim@samsung.com> 6 * Seung-Woo Kim <sw0312.kim@samsung.com>
7 * 7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a 8 * This program is free software; you can redistribute it and/or modify it
9 * copy of this software and associated documentation files (the "Software"), 9 * under the terms of the GNU General Public License as published by the
10 * to deal in the Software without restriction, including without limitation 10 * Free Software Foundation; either version 2 of the License, or (at your
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 * option) any later version.
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice (including the next
16 * paragraph) shall be included in all copies or substantial portions of the
17 * Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 * OTHER DEALINGS IN THE SOFTWARE.
26 */ 12 */
27 13
28#ifndef _EXYNOS_DRM_CONNECTOR_H_ 14#ifndef _EXYNOS_DRM_CONNECTOR_H_
diff --git a/drivers/gpu/drm/exynos/exynos_drm_core.c b/drivers/gpu/drm/exynos/exynos_drm_core.c
index 94026ad76a77..4667c9f67acd 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_core.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_core.c
@@ -6,24 +6,10 @@
6 * Joonyoung Shim <jy0922.shim@samsung.com> 6 * Joonyoung Shim <jy0922.shim@samsung.com>
7 * Seung-Woo Kim <sw0312.kim@samsung.com> 7 * Seung-Woo Kim <sw0312.kim@samsung.com>
8 * 8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a 9 * This program is free software; you can redistribute it and/or modify it
10 * copy of this software and associated documentation files (the "Software"), 10 * under the terms of the GNU General Public License as published by the
11 * to deal in the Software without restriction, including without limitation 11 * Free Software Foundation; either version 2 of the License, or (at your
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 * option) any later version.
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice (including the next
17 * paragraph) shall be included in all copies or substantial portions of the
18 * Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 * OTHER DEALINGS IN THE SOFTWARE.
27 */ 13 */
28 14
29#include <drm/drmP.h> 15#include <drm/drmP.h>
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 2efa4b031d73..e8894bc9e6d5 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -6,24 +6,10 @@
6 * Joonyoung Shim <jy0922.shim@samsung.com> 6 * Joonyoung Shim <jy0922.shim@samsung.com>
7 * Seung-Woo Kim <sw0312.kim@samsung.com> 7 * Seung-Woo Kim <sw0312.kim@samsung.com>
8 * 8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a 9 * This program is free software; you can redistribute it and/or modify it
10 * copy of this software and associated documentation files (the "Software"), 10 * under the terms of the GNU General Public License as published by the
11 * to deal in the Software without restriction, including without limitation 11 * Free Software Foundation; either version 2 of the License, or (at your
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 * option) any later version.
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice (including the next
17 * paragraph) shall be included in all copies or substantial portions of the
18 * Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 * OTHER DEALINGS IN THE SOFTWARE.
27 */ 13 */
28 14
29#include <drm/drmP.h> 15#include <drm/drmP.h>
@@ -407,3 +393,33 @@ void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int crtc)
407 exynos_drm_fn_encoder(private->crtc[crtc], &crtc, 393 exynos_drm_fn_encoder(private->crtc[crtc], &crtc,
408 exynos_drm_disable_vblank); 394 exynos_drm_disable_vblank);
409} 395}
396
397void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int crtc)
398{
399 struct exynos_drm_private *dev_priv = dev->dev_private;
400 struct drm_pending_vblank_event *e, *t;
401 struct timeval now;
402 unsigned long flags;
403
404 DRM_DEBUG_KMS("%s\n", __FILE__);
405
406 spin_lock_irqsave(&dev->event_lock, flags);
407
408 list_for_each_entry_safe(e, t, &dev_priv->pageflip_event_list,
409 base.link) {
410 /* if event's pipe isn't same as crtc then ignore it. */
411 if (crtc != e->pipe)
412 continue;
413
414 do_gettimeofday(&now);
415 e->event.sequence = 0;
416 e->event.tv_sec = now.tv_sec;
417 e->event.tv_usec = now.tv_usec;
418
419 list_move_tail(&e->base.link, &e->base.file_priv->event_list);
420 wake_up_interruptible(&e->base.file_priv->event_wait);
421 drm_vblank_put(dev, crtc);
422 }
423
424 spin_unlock_irqrestore(&dev->event_lock, flags);
425}
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.h b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
index 6bae8d8c250e..3e197e6ae7d9 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.h
@@ -6,24 +6,10 @@
6 * Joonyoung Shim <jy0922.shim@samsung.com> 6 * Joonyoung Shim <jy0922.shim@samsung.com>
7 * Seung-Woo Kim <sw0312.kim@samsung.com> 7 * Seung-Woo Kim <sw0312.kim@samsung.com>
8 * 8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a 9 * This program is free software; you can redistribute it and/or modify it
10 * copy of this software and associated documentation files (the "Software"), 10 * under the terms of the GNU General Public License as published by the
11 * to deal in the Software without restriction, including without limitation 11 * Free Software Foundation; either version 2 of the License, or (at your
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 * option) any later version.
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice (including the next
17 * paragraph) shall be included in all copies or substantial portions of the
18 * Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 * OTHER DEALINGS IN THE SOFTWARE.
27 */ 13 */
28 14
29#ifndef _EXYNOS_DRM_CRTC_H_ 15#ifndef _EXYNOS_DRM_CRTC_H_
@@ -32,5 +18,6 @@
32int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr); 18int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr);
33int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int crtc); 19int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int crtc);
34void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int crtc); 20void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int crtc);
21void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int crtc);
35 22
36#endif 23#endif
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
index 61d5a8402eb8..ba0a3aa78547 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c
@@ -3,24 +3,10 @@
3 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 * Author: Inki Dae <inki.dae@samsung.com> 4 * Author: Inki Dae <inki.dae@samsung.com>
5 * 5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a 6 * This program is free software; you can redistribute it and/or modify it
7 * copy of this software and associated documentation files (the "Software"), 7 * under the terms of the GNU General Public License as published by the
8 * to deal in the Software without restriction, including without limitation 8 * Free Software Foundation; either version 2 of the License, or (at your
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * option) any later version.
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
15 * Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */ 10 */
25 11
26#include <drm/drmP.h> 12#include <drm/drmP.h>
@@ -33,6 +19,7 @@
33struct exynos_drm_dmabuf_attachment { 19struct exynos_drm_dmabuf_attachment {
34 struct sg_table sgt; 20 struct sg_table sgt;
35 enum dma_data_direction dir; 21 enum dma_data_direction dir;
22 bool is_mapped;
36}; 23};
37 24
38static int exynos_gem_attach_dma_buf(struct dma_buf *dmabuf, 25static int exynos_gem_attach_dma_buf(struct dma_buf *dmabuf,
@@ -86,17 +73,10 @@ static struct sg_table *
86 73
87 DRM_DEBUG_PRIME("%s\n", __FILE__); 74 DRM_DEBUG_PRIME("%s\n", __FILE__);
88 75
89 if (WARN_ON(dir == DMA_NONE))
90 return ERR_PTR(-EINVAL);
91
92 /* just return current sgt if already requested. */ 76 /* just return current sgt if already requested. */
93 if (exynos_attach->dir == dir) 77 if (exynos_attach->dir == dir && exynos_attach->is_mapped)
94 return &exynos_attach->sgt; 78 return &exynos_attach->sgt;
95 79
96 /* reattaching is not allowed. */
97 if (WARN_ON(exynos_attach->dir != DMA_NONE))
98 return ERR_PTR(-EBUSY);
99
100 buf = gem_obj->buffer; 80 buf = gem_obj->buffer;
101 if (!buf) { 81 if (!buf) {
102 DRM_ERROR("buffer is null.\n"); 82 DRM_ERROR("buffer is null.\n");
@@ -121,13 +101,17 @@ static struct sg_table *
121 wr = sg_next(wr); 101 wr = sg_next(wr);
122 } 102 }
123 103
124 nents = dma_map_sg(attach->dev, sgt->sgl, sgt->orig_nents, dir); 104 if (dir != DMA_NONE) {
125 if (!nents) { 105 nents = dma_map_sg(attach->dev, sgt->sgl, sgt->orig_nents, dir);
126 DRM_ERROR("failed to map sgl with iommu.\n"); 106 if (!nents) {
127 sgt = ERR_PTR(-EIO); 107 DRM_ERROR("failed to map sgl with iommu.\n");
128 goto err_unlock; 108 sg_free_table(sgt);
109 sgt = ERR_PTR(-EIO);
110 goto err_unlock;
111 }
129 } 112 }
130 113
114 exynos_attach->is_mapped = true;
131 exynos_attach->dir = dir; 115 exynos_attach->dir = dir;
132 attach->priv = exynos_attach; 116 attach->priv = exynos_attach;
133 117
@@ -222,7 +206,7 @@ struct dma_buf *exynos_dmabuf_prime_export(struct drm_device *drm_dev,
222 struct exynos_drm_gem_obj *exynos_gem_obj = to_exynos_gem_obj(obj); 206 struct exynos_drm_gem_obj *exynos_gem_obj = to_exynos_gem_obj(obj);
223 207
224 return dma_buf_export(exynos_gem_obj, &exynos_dmabuf_ops, 208 return dma_buf_export(exynos_gem_obj, &exynos_dmabuf_ops,
225 exynos_gem_obj->base.size, 0600); 209 exynos_gem_obj->base.size, flags);
226} 210}
227 211
228struct drm_gem_object *exynos_dmabuf_prime_import(struct drm_device *drm_dev, 212struct drm_gem_object *exynos_dmabuf_prime_import(struct drm_device *drm_dev,
@@ -246,7 +230,12 @@ struct drm_gem_object *exynos_dmabuf_prime_import(struct drm_device *drm_dev,
246 230
247 /* is it from our device? */ 231 /* is it from our device? */
248 if (obj->dev == drm_dev) { 232 if (obj->dev == drm_dev) {
233 /*
234 * Importing dmabuf exported from out own gem increases
235 * refcount on gem itself instead of f_count of dmabuf.
236 */
249 drm_gem_object_reference(obj); 237 drm_gem_object_reference(obj);
238 dma_buf_put(dma_buf);
250 return obj; 239 return obj;
251 } 240 }
252 } 241 }
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.h b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.h
index 662a8f98ccdb..49acfafb4fdb 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.h
@@ -3,24 +3,10 @@
3 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 * Author: Inki Dae <inki.dae@samsung.com> 4 * Author: Inki Dae <inki.dae@samsung.com>
5 * 5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a 6 * This program is free software; you can redistribute it and/or modify it
7 * copy of this software and associated documentation files (the "Software"), 7 * under the terms of the GNU General Public License as published by the
8 * to deal in the Software without restriction, including without limitation 8 * Free Software Foundation; either version 2 of the License, or (at your
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * option) any later version.
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
15 * Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */ 10 */
25 11
26#ifndef _EXYNOS_DRM_DMABUF_H_ 12#ifndef _EXYNOS_DRM_DMABUF_H_
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index e0a8e8024b01..3da5c2d214d8 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -5,24 +5,10 @@
5 * Joonyoung Shim <jy0922.shim@samsung.com> 5 * Joonyoung Shim <jy0922.shim@samsung.com>
6 * Seung-Woo Kim <sw0312.kim@samsung.com> 6 * Seung-Woo Kim <sw0312.kim@samsung.com>
7 * 7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a 8 * This program is free software; you can redistribute it and/or modify it
9 * copy of this software and associated documentation files (the "Software"), 9 * under the terms of the GNU General Public License as published by the
10 * to deal in the Software without restriction, including without limitation 10 * Free Software Foundation; either version 2 of the License, or (at your
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 * option) any later version.
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice (including the next
16 * paragraph) shall be included in all copies or substantial portions of the
17 * Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 * OTHER DEALINGS IN THE SOFTWARE.
26 */ 12 */
27 13
28#include <drm/drmP.h> 14#include <drm/drmP.h>
@@ -325,7 +311,7 @@ static int exynos_drm_platform_remove(struct platform_device *pdev)
325 311
326static struct platform_driver exynos_drm_platform_driver = { 312static struct platform_driver exynos_drm_platform_driver = {
327 .probe = exynos_drm_platform_probe, 313 .probe = exynos_drm_platform_probe,
328 .remove = __devexit_p(exynos_drm_platform_remove), 314 .remove = exynos_drm_platform_remove,
329 .driver = { 315 .driver = {
330 .owner = THIS_MODULE, 316 .owner = THIS_MODULE,
331 .name = "exynos-drm", 317 .name = "exynos-drm",
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index f5a97745bf93..4606fac7241a 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -6,24 +6,10 @@
6 * Joonyoung Shim <jy0922.shim@samsung.com> 6 * Joonyoung Shim <jy0922.shim@samsung.com>
7 * Seung-Woo Kim <sw0312.kim@samsung.com> 7 * Seung-Woo Kim <sw0312.kim@samsung.com>
8 * 8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a 9 * This program is free software; you can redistribute it and/or modify it
10 * copy of this software and associated documentation files (the "Software"), 10 * under the terms of the GNU General Public License as published by the
11 * to deal in the Software without restriction, including without limitation 11 * Free Software Foundation; either version 2 of the License, or (at your
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 * option) any later version.
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice (including the next
17 * paragraph) shall be included in all copies or substantial portions of the
18 * Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 * OTHER DEALINGS IN THE SOFTWARE.
27 */ 13 */
28 14
29#ifndef _EXYNOS_DRM_DRV_H_ 15#ifndef _EXYNOS_DRM_DRV_H_
@@ -162,8 +148,8 @@ struct exynos_drm_overlay {
162struct exynos_drm_display_ops { 148struct exynos_drm_display_ops {
163 enum exynos_drm_output_type type; 149 enum exynos_drm_output_type type;
164 bool (*is_connected)(struct device *dev); 150 bool (*is_connected)(struct device *dev);
165 int (*get_edid)(struct device *dev, struct drm_connector *connector, 151 struct edid *(*get_edid)(struct device *dev,
166 u8 *edid, int len); 152 struct drm_connector *connector);
167 void *(*get_panel)(struct device *dev); 153 void *(*get_panel)(struct device *dev);
168 int (*check_timing)(struct device *dev, void *timing); 154 int (*check_timing)(struct device *dev, void *timing);
169 int (*power_on)(struct device *dev, int mode); 155 int (*power_on)(struct device *dev, int mode);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
index 301485215a70..c63721f64aec 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
@@ -6,24 +6,10 @@
6 * Joonyoung Shim <jy0922.shim@samsung.com> 6 * Joonyoung Shim <jy0922.shim@samsung.com>
7 * Seung-Woo Kim <sw0312.kim@samsung.com> 7 * Seung-Woo Kim <sw0312.kim@samsung.com>
8 * 8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a 9 * This program is free software; you can redistribute it and/or modify it
10 * copy of this software and associated documentation files (the "Software"), 10 * under the terms of the GNU General Public License as published by the
11 * to deal in the Software without restriction, including without limitation 11 * Free Software Foundation; either version 2 of the License, or (at your
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 * option) any later version.
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice (including the next
17 * paragraph) shall be included in all copies or substantial portions of the
18 * Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 * OTHER DEALINGS IN THE SOFTWARE.
27 */ 13 */
28 14
29#include <drm/drmP.h> 15#include <drm/drmP.h>
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.h b/drivers/gpu/drm/exynos/exynos_drm_encoder.h
index 88bb25a2a917..89e2fb0770af 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_encoder.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.h
@@ -5,24 +5,10 @@
5 * Joonyoung Shim <jy0922.shim@samsung.com> 5 * Joonyoung Shim <jy0922.shim@samsung.com>
6 * Seung-Woo Kim <sw0312.kim@samsung.com> 6 * Seung-Woo Kim <sw0312.kim@samsung.com>
7 * 7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a 8 * This program is free software; you can redistribute it and/or modify it
9 * copy of this software and associated documentation files (the "Software"), 9 * under the terms of the GNU General Public License as published by the
10 * to deal in the Software without restriction, including without limitation 10 * Free Software Foundation; either version 2 of the License, or (at your
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 * option) any later version.
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice (including the next
16 * paragraph) shall be included in all copies or substantial portions of the
17 * Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 * OTHER DEALINGS IN THE SOFTWARE.
26 */ 12 */
27 13
28#ifndef _EXYNOS_DRM_ENCODER_H_ 14#ifndef _EXYNOS_DRM_ENCODER_H_
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c
index 5426cc5a5e8d..294c0513f587 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fb.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c
@@ -6,24 +6,10 @@
6 * Joonyoung Shim <jy0922.shim@samsung.com> 6 * Joonyoung Shim <jy0922.shim@samsung.com>
7 * Seung-Woo Kim <sw0312.kim@samsung.com> 7 * Seung-Woo Kim <sw0312.kim@samsung.com>
8 * 8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a 9 * This program is free software; you can redistribute it and/or modify it
10 * copy of this software and associated documentation files (the "Software"), 10 * under the terms of the GNU General Public License as published by the
11 * to deal in the Software without restriction, including without limitation 11 * Free Software Foundation; either version 2 of the License, or (at your
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 * option) any later version.
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice (including the next
17 * paragraph) shall be included in all copies or substantial portions of the
18 * Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 * OTHER DEALINGS IN THE SOFTWARE.
27 */ 13 */
28 14
29#include <drm/drmP.h> 15#include <drm/drmP.h>
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.h b/drivers/gpu/drm/exynos/exynos_drm_fb.h
index 96262e54f76d..517471b37566 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fb.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_fb.h
@@ -5,24 +5,10 @@
5 * Joonyoung Shim <jy0922.shim@samsung.com> 5 * Joonyoung Shim <jy0922.shim@samsung.com>
6 * Seung-Woo Kim <sw0312.kim@samsung.com> 6 * Seung-Woo Kim <sw0312.kim@samsung.com>
7 * 7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a 8 * This program is free software; you can redistribute it and/or modify it
9 * copy of this software and associated documentation files (the "Software"), 9 * under the terms of the GNU General Public License as published by the
10 * to deal in the Software without restriction, including without limitation 10 * Free Software Foundation; either version 2 of the License, or (at your
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 * option) any later version.
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice (including the next
16 * paragraph) shall be included in all copies or substantial portions of the
17 * Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 * OTHER DEALINGS IN THE SOFTWARE.
26 */ 12 */
27 13
28#ifndef _EXYNOS_DRM_FB_H_ 14#ifndef _EXYNOS_DRM_FB_H_
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
index f433eb7533a9..71f867340a88 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
@@ -6,24 +6,10 @@
6 * Joonyoung Shim <jy0922.shim@samsung.com> 6 * Joonyoung Shim <jy0922.shim@samsung.com>
7 * Seung-Woo Kim <sw0312.kim@samsung.com> 7 * Seung-Woo Kim <sw0312.kim@samsung.com>
8 * 8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a 9 * This program is free software; you can redistribute it and/or modify it
10 * copy of this software and associated documentation files (the "Software"), 10 * under the terms of the GNU General Public License as published by the
11 * to deal in the Software without restriction, including without limitation 11 * Free Software Foundation; either version 2 of the License, or (at your
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 * option) any later version.
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice (including the next
17 * paragraph) shall be included in all copies or substantial portions of the
18 * Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 * OTHER DEALINGS IN THE SOFTWARE.
27 */ 13 */
28 14
29#include <drm/drmP.h> 15#include <drm/drmP.h>
@@ -34,6 +20,7 @@
34#include "exynos_drm_drv.h" 20#include "exynos_drm_drv.h"
35#include "exynos_drm_fb.h" 21#include "exynos_drm_fb.h"
36#include "exynos_drm_gem.h" 22#include "exynos_drm_gem.h"
23#include "exynos_drm_iommu.h"
37 24
38#define MAX_CONNECTOR 4 25#define MAX_CONNECTOR 4
39#define PREFERRED_BPP 32 26#define PREFERRED_BPP 32
@@ -111,9 +98,18 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper,
111 98
112 /* map pages with kernel virtual space. */ 99 /* map pages with kernel virtual space. */
113 if (!buffer->kvaddr) { 100 if (!buffer->kvaddr) {
114 unsigned int nr_pages = buffer->size >> PAGE_SHIFT; 101 if (is_drm_iommu_supported(dev)) {
115 buffer->kvaddr = vmap(buffer->pages, nr_pages, VM_MAP, 102 unsigned int nr_pages = buffer->size >> PAGE_SHIFT;
103
104 buffer->kvaddr = vmap(buffer->pages, nr_pages, VM_MAP,
116 pgprot_writecombine(PAGE_KERNEL)); 105 pgprot_writecombine(PAGE_KERNEL));
106 } else {
107 phys_addr_t dma_addr = buffer->dma_addr;
108 if (dma_addr)
109 buffer->kvaddr = phys_to_virt(dma_addr);
110 else
111 buffer->kvaddr = (void __iomem *)NULL;
112 }
117 if (!buffer->kvaddr) { 113 if (!buffer->kvaddr) {
118 DRM_ERROR("failed to map pages to kernel space.\n"); 114 DRM_ERROR("failed to map pages to kernel space.\n");
119 return -EIO; 115 return -EIO;
@@ -128,8 +124,12 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper,
128 124
129 dev->mode_config.fb_base = (resource_size_t)buffer->dma_addr; 125 dev->mode_config.fb_base = (resource_size_t)buffer->dma_addr;
130 fbi->screen_base = buffer->kvaddr + offset; 126 fbi->screen_base = buffer->kvaddr + offset;
131 fbi->fix.smem_start = (unsigned long) 127 if (is_drm_iommu_supported(dev))
128 fbi->fix.smem_start = (unsigned long)
132 (page_to_phys(sg_page(buffer->sgt->sgl)) + offset); 129 (page_to_phys(sg_page(buffer->sgt->sgl)) + offset);
130 else
131 fbi->fix.smem_start = (unsigned long)buffer->dma_addr;
132
133 fbi->screen_size = size; 133 fbi->screen_size = size;
134 fbi->fix.smem_len = size; 134 fbi->fix.smem_len = size;
135 135
@@ -320,7 +320,7 @@ static void exynos_drm_fbdev_destroy(struct drm_device *dev,
320 struct exynos_drm_gem_obj *exynos_gem_obj = exynos_fbd->exynos_gem_obj; 320 struct exynos_drm_gem_obj *exynos_gem_obj = exynos_fbd->exynos_gem_obj;
321 struct drm_framebuffer *fb; 321 struct drm_framebuffer *fb;
322 322
323 if (exynos_gem_obj->buffer->kvaddr) 323 if (is_drm_iommu_supported(dev) && exynos_gem_obj->buffer->kvaddr)
324 vunmap(exynos_gem_obj->buffer->kvaddr); 324 vunmap(exynos_gem_obj->buffer->kvaddr);
325 325
326 /* release drm framebuffer and real buffer */ 326 /* release drm framebuffer and real buffer */
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.h b/drivers/gpu/drm/exynos/exynos_drm_fbdev.h
index ccfce8a1a451..e16d7f0ae192 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.h
@@ -6,24 +6,10 @@
6 * Joonyoung Shim <jy0922.shim@samsung.com> 6 * Joonyoung Shim <jy0922.shim@samsung.com>
7 * Seung-Woo Kim <sw0312.kim@samsung.com> 7 * Seung-Woo Kim <sw0312.kim@samsung.com>
8 * 8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a 9 * This program is free software; you can redistribute it and/or modify it
10 * copy of this software and associated documentation files (the "Software"), 10 * under the terms of the GNU General Public License as published by the
11 * to deal in the Software without restriction, including without limitation 11 * Free Software Foundation; either version 2 of the License, or (at your
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 * option) any later version.
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice (including the next
17 * paragraph) shall be included in all copies or substantial portions of the
18 * Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 * OTHER DEALINGS IN THE SOFTWARE.
27 */ 13 */
28 14
29#ifndef _EXYNOS_DRM_FBDEV_H_ 15#ifndef _EXYNOS_DRM_FBDEV_H_
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
index 61ea24296b52..67a83e69544b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
@@ -25,7 +25,7 @@
25#include "exynos_drm_fimc.h" 25#include "exynos_drm_fimc.h"
26 26
27/* 27/*
28 * FIMC is stand for Fully Interactive Mobile Camera and 28 * FIMC stands for Fully Interactive Mobile Camera and
29 * supports image scaler/rotator and input/output DMA operations. 29 * supports image scaler/rotator and input/output DMA operations.
30 * input DMA reads image data from the memory. 30 * input DMA reads image data from the memory.
31 * output DMA writes image data to memory. 31 * output DMA writes image data to memory.
@@ -163,19 +163,29 @@ struct fimc_context {
163 bool suspended; 163 bool suspended;
164}; 164};
165 165
166static void fimc_sw_reset(struct fimc_context *ctx, bool pattern) 166static void fimc_sw_reset(struct fimc_context *ctx)
167{ 167{
168 u32 cfg; 168 u32 cfg;
169 169
170 DRM_DEBUG_KMS("%s:pattern[%d]\n", __func__, pattern); 170 DRM_DEBUG_KMS("%s\n", __func__);
171
172 /* stop dma operation */
173 cfg = fimc_read(EXYNOS_CISTATUS);
174 if (EXYNOS_CISTATUS_GET_ENVID_STATUS(cfg)) {
175 cfg = fimc_read(EXYNOS_MSCTRL);
176 cfg &= ~EXYNOS_MSCTRL_ENVID;
177 fimc_write(cfg, EXYNOS_MSCTRL);
178 }
171 179
172 cfg = fimc_read(EXYNOS_CISRCFMT); 180 cfg = fimc_read(EXYNOS_CISRCFMT);
173 cfg |= EXYNOS_CISRCFMT_ITU601_8BIT; 181 cfg |= EXYNOS_CISRCFMT_ITU601_8BIT;
174 if (pattern)
175 cfg |= EXYNOS_CIGCTRL_TESTPATTERN_COLOR_BAR;
176
177 fimc_write(cfg, EXYNOS_CISRCFMT); 182 fimc_write(cfg, EXYNOS_CISRCFMT);
178 183
184 /* disable image capture */
185 cfg = fimc_read(EXYNOS_CIIMGCPT);
186 cfg &= ~(EXYNOS_CIIMGCPT_IMGCPTEN_SC | EXYNOS_CIIMGCPT_IMGCPTEN);
187 fimc_write(cfg, EXYNOS_CIIMGCPT);
188
179 /* s/w reset */ 189 /* s/w reset */
180 cfg = fimc_read(EXYNOS_CIGCTRL); 190 cfg = fimc_read(EXYNOS_CIGCTRL);
181 cfg |= (EXYNOS_CIGCTRL_SWRST); 191 cfg |= (EXYNOS_CIGCTRL_SWRST);
@@ -695,7 +705,7 @@ static int fimc_src_set_addr(struct device *dev,
695{ 705{
696 struct fimc_context *ctx = get_fimc_context(dev); 706 struct fimc_context *ctx = get_fimc_context(dev);
697 struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; 707 struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv;
698 struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; 708 struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node;
699 struct drm_exynos_ipp_property *property; 709 struct drm_exynos_ipp_property *property;
700 struct drm_exynos_ipp_config *config; 710 struct drm_exynos_ipp_config *config;
701 711
@@ -705,10 +715,6 @@ static int fimc_src_set_addr(struct device *dev,
705 } 715 }
706 716
707 property = &c_node->property; 717 property = &c_node->property;
708 if (!property) {
709 DRM_ERROR("failed to get property.\n");
710 return -EINVAL;
711 }
712 718
713 DRM_DEBUG_KMS("%s:prop_id[%d]buf_id[%d]buf_type[%d]\n", __func__, 719 DRM_DEBUG_KMS("%s:prop_id[%d]buf_id[%d]buf_type[%d]\n", __func__,
714 property->prop_id, buf_id, buf_type); 720 property->prop_id, buf_id, buf_type);
@@ -1206,7 +1212,7 @@ static int fimc_dst_set_buf_seq(struct fimc_context *ctx, u32 buf_id,
1206 } 1212 }
1207 1213
1208 /* sequence id */ 1214 /* sequence id */
1209 cfg &= (~mask); 1215 cfg &= ~mask;
1210 cfg |= (enable << buf_id); 1216 cfg |= (enable << buf_id);
1211 fimc_write(cfg, EXYNOS_CIFCNTSEQ); 1217 fimc_write(cfg, EXYNOS_CIFCNTSEQ);
1212 1218
@@ -1231,7 +1237,7 @@ static int fimc_dst_set_addr(struct device *dev,
1231{ 1237{
1232 struct fimc_context *ctx = get_fimc_context(dev); 1238 struct fimc_context *ctx = get_fimc_context(dev);
1233 struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; 1239 struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv;
1234 struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; 1240 struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node;
1235 struct drm_exynos_ipp_property *property; 1241 struct drm_exynos_ipp_property *property;
1236 struct drm_exynos_ipp_config *config; 1242 struct drm_exynos_ipp_config *config;
1237 1243
@@ -1241,10 +1247,6 @@ static int fimc_dst_set_addr(struct device *dev,
1241 } 1247 }
1242 1248
1243 property = &c_node->property; 1249 property = &c_node->property;
1244 if (!property) {
1245 DRM_ERROR("failed to get property.\n");
1246 return -EINVAL;
1247 }
1248 1250
1249 DRM_DEBUG_KMS("%s:prop_id[%d]buf_id[%d]buf_type[%d]\n", __func__, 1251 DRM_DEBUG_KMS("%s:prop_id[%d]buf_id[%d]buf_type[%d]\n", __func__,
1250 property->prop_id, buf_id, buf_type); 1252 property->prop_id, buf_id, buf_type);
@@ -1317,7 +1319,7 @@ static irqreturn_t fimc_irq_handler(int irq, void *dev_id)
1317{ 1319{
1318 struct fimc_context *ctx = dev_id; 1320 struct fimc_context *ctx = dev_id;
1319 struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; 1321 struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv;
1320 struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; 1322 struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node;
1321 struct drm_exynos_ipp_event_work *event_work = 1323 struct drm_exynos_ipp_event_work *event_work =
1322 c_node->event_work; 1324 c_node->event_work;
1323 int buf_id; 1325 int buf_id;
@@ -1395,6 +1397,7 @@ static inline bool fimc_check_drm_flip(enum drm_exynos_flip flip)
1395 case EXYNOS_DRM_FLIP_NONE: 1397 case EXYNOS_DRM_FLIP_NONE:
1396 case EXYNOS_DRM_FLIP_VERTICAL: 1398 case EXYNOS_DRM_FLIP_VERTICAL:
1397 case EXYNOS_DRM_FLIP_HORIZONTAL: 1399 case EXYNOS_DRM_FLIP_HORIZONTAL:
1400 case EXYNOS_DRM_FLIP_BOTH:
1398 return true; 1401 return true;
1399 default: 1402 default:
1400 DRM_DEBUG_KMS("%s:invalid flip\n", __func__); 1403 DRM_DEBUG_KMS("%s:invalid flip\n", __func__);
@@ -1543,7 +1546,7 @@ static int fimc_ippdrv_reset(struct device *dev)
1543 DRM_DEBUG_KMS("%s\n", __func__); 1546 DRM_DEBUG_KMS("%s\n", __func__);
1544 1547
1545 /* reset h/w block */ 1548 /* reset h/w block */
1546 fimc_sw_reset(ctx, false); 1549 fimc_sw_reset(ctx);
1547 1550
1548 /* reset scaler capability */ 1551 /* reset scaler capability */
1549 memset(&ctx->sc, 0x0, sizeof(ctx->sc)); 1552 memset(&ctx->sc, 0x0, sizeof(ctx->sc));
@@ -1557,7 +1560,7 @@ static int fimc_ippdrv_start(struct device *dev, enum drm_exynos_ipp_cmd cmd)
1557{ 1560{
1558 struct fimc_context *ctx = get_fimc_context(dev); 1561 struct fimc_context *ctx = get_fimc_context(dev);
1559 struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; 1562 struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv;
1560 struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; 1563 struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node;
1561 struct drm_exynos_ipp_property *property; 1564 struct drm_exynos_ipp_property *property;
1562 struct drm_exynos_ipp_config *config; 1565 struct drm_exynos_ipp_config *config;
1563 struct drm_exynos_pos img_pos[EXYNOS_DRM_OPS_MAX]; 1566 struct drm_exynos_pos img_pos[EXYNOS_DRM_OPS_MAX];
@@ -1573,10 +1576,6 @@ static int fimc_ippdrv_start(struct device *dev, enum drm_exynos_ipp_cmd cmd)
1573 } 1576 }
1574 1577
1575 property = &c_node->property; 1578 property = &c_node->property;
1576 if (!property) {
1577 DRM_ERROR("failed to get property.\n");
1578 return -EINVAL;
1579 }
1580 1579
1581 fimc_handle_irq(ctx, true, false, true); 1580 fimc_handle_irq(ctx, true, false, true);
1582 1581
@@ -1714,7 +1713,7 @@ static void fimc_ippdrv_stop(struct device *dev, enum drm_exynos_ipp_cmd cmd)
1714 fimc_write(cfg, EXYNOS_CIGCTRL); 1713 fimc_write(cfg, EXYNOS_CIGCTRL);
1715} 1714}
1716 1715
1717static int __devinit fimc_probe(struct platform_device *pdev) 1716static int fimc_probe(struct platform_device *pdev)
1718{ 1717{
1719 struct device *dev = &pdev->dev; 1718 struct device *dev = &pdev->dev;
1720 struct fimc_context *ctx; 1719 struct fimc_context *ctx;
@@ -1739,93 +1738,64 @@ static int __devinit fimc_probe(struct platform_device *pdev)
1739 platform_get_device_id(pdev)->driver_data; 1738 platform_get_device_id(pdev)->driver_data;
1740 1739
1741 /* clock control */ 1740 /* clock control */
1742 ctx->sclk_fimc_clk = clk_get(dev, "sclk_fimc"); 1741 ctx->sclk_fimc_clk = devm_clk_get(dev, "sclk_fimc");
1743 if (IS_ERR(ctx->sclk_fimc_clk)) { 1742 if (IS_ERR(ctx->sclk_fimc_clk)) {
1744 dev_err(dev, "failed to get src fimc clock.\n"); 1743 dev_err(dev, "failed to get src fimc clock.\n");
1745 ret = PTR_ERR(ctx->sclk_fimc_clk); 1744 return PTR_ERR(ctx->sclk_fimc_clk);
1746 goto err_ctx;
1747 } 1745 }
1748 clk_enable(ctx->sclk_fimc_clk); 1746 clk_enable(ctx->sclk_fimc_clk);
1749 1747
1750 ctx->fimc_clk = clk_get(dev, "fimc"); 1748 ctx->fimc_clk = devm_clk_get(dev, "fimc");
1751 if (IS_ERR(ctx->fimc_clk)) { 1749 if (IS_ERR(ctx->fimc_clk)) {
1752 dev_err(dev, "failed to get fimc clock.\n"); 1750 dev_err(dev, "failed to get fimc clock.\n");
1753 ret = PTR_ERR(ctx->fimc_clk);
1754 clk_disable(ctx->sclk_fimc_clk); 1751 clk_disable(ctx->sclk_fimc_clk);
1755 clk_put(ctx->sclk_fimc_clk); 1752 return PTR_ERR(ctx->fimc_clk);
1756 goto err_ctx;
1757 } 1753 }
1758 1754
1759 ctx->wb_clk = clk_get(dev, "pxl_async0"); 1755 ctx->wb_clk = devm_clk_get(dev, "pxl_async0");
1760 if (IS_ERR(ctx->wb_clk)) { 1756 if (IS_ERR(ctx->wb_clk)) {
1761 dev_err(dev, "failed to get writeback a clock.\n"); 1757 dev_err(dev, "failed to get writeback a clock.\n");
1762 ret = PTR_ERR(ctx->wb_clk);
1763 clk_disable(ctx->sclk_fimc_clk); 1758 clk_disable(ctx->sclk_fimc_clk);
1764 clk_put(ctx->sclk_fimc_clk); 1759 return PTR_ERR(ctx->wb_clk);
1765 clk_put(ctx->fimc_clk);
1766 goto err_ctx;
1767 } 1760 }
1768 1761
1769 ctx->wb_b_clk = clk_get(dev, "pxl_async1"); 1762 ctx->wb_b_clk = devm_clk_get(dev, "pxl_async1");
1770 if (IS_ERR(ctx->wb_b_clk)) { 1763 if (IS_ERR(ctx->wb_b_clk)) {
1771 dev_err(dev, "failed to get writeback b clock.\n"); 1764 dev_err(dev, "failed to get writeback b clock.\n");
1772 ret = PTR_ERR(ctx->wb_b_clk);
1773 clk_disable(ctx->sclk_fimc_clk); 1765 clk_disable(ctx->sclk_fimc_clk);
1774 clk_put(ctx->sclk_fimc_clk); 1766 return PTR_ERR(ctx->wb_b_clk);
1775 clk_put(ctx->fimc_clk);
1776 clk_put(ctx->wb_clk);
1777 goto err_ctx;
1778 } 1767 }
1779 1768
1780 parent_clk = clk_get(dev, ddata->parent_clk); 1769 parent_clk = devm_clk_get(dev, ddata->parent_clk);
1781 1770
1782 if (IS_ERR(parent_clk)) { 1771 if (IS_ERR(parent_clk)) {
1783 dev_err(dev, "failed to get parent clock.\n"); 1772 dev_err(dev, "failed to get parent clock.\n");
1784 ret = PTR_ERR(parent_clk);
1785 clk_disable(ctx->sclk_fimc_clk); 1773 clk_disable(ctx->sclk_fimc_clk);
1786 clk_put(ctx->sclk_fimc_clk); 1774 return PTR_ERR(parent_clk);
1787 clk_put(ctx->fimc_clk);
1788 clk_put(ctx->wb_clk);
1789 clk_put(ctx->wb_b_clk);
1790 goto err_ctx;
1791 } 1775 }
1792 1776
1793 if (clk_set_parent(ctx->sclk_fimc_clk, parent_clk)) { 1777 if (clk_set_parent(ctx->sclk_fimc_clk, parent_clk)) {
1794 dev_err(dev, "failed to set parent.\n"); 1778 dev_err(dev, "failed to set parent.\n");
1795 ret = -EINVAL;
1796 clk_put(parent_clk);
1797 clk_disable(ctx->sclk_fimc_clk); 1779 clk_disable(ctx->sclk_fimc_clk);
1798 clk_put(ctx->sclk_fimc_clk); 1780 return -EINVAL;
1799 clk_put(ctx->fimc_clk);
1800 clk_put(ctx->wb_clk);
1801 clk_put(ctx->wb_b_clk);
1802 goto err_ctx;
1803 } 1781 }
1804 1782
1805 clk_put(parent_clk); 1783 devm_clk_put(dev, parent_clk);
1806 clk_set_rate(ctx->sclk_fimc_clk, pdata->clk_rate); 1784 clk_set_rate(ctx->sclk_fimc_clk, pdata->clk_rate);
1807 1785
1808 /* resource memory */ 1786 /* resource memory */
1809 ctx->regs_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1787 ctx->regs_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1810 if (!ctx->regs_res) {
1811 dev_err(dev, "failed to find registers.\n");
1812 ret = -ENOENT;
1813 goto err_clk;
1814 }
1815
1816 ctx->regs = devm_request_and_ioremap(dev, ctx->regs_res); 1788 ctx->regs = devm_request_and_ioremap(dev, ctx->regs_res);
1817 if (!ctx->regs) { 1789 if (!ctx->regs) {
1818 dev_err(dev, "failed to map registers.\n"); 1790 dev_err(dev, "failed to map registers.\n");
1819 ret = -ENXIO; 1791 return -ENXIO;
1820 goto err_clk;
1821 } 1792 }
1822 1793
1823 /* resource irq */ 1794 /* resource irq */
1824 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 1795 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
1825 if (!res) { 1796 if (!res) {
1826 dev_err(dev, "failed to request irq resource.\n"); 1797 dev_err(dev, "failed to request irq resource.\n");
1827 ret = -ENOENT; 1798 return -ENOENT;
1828 goto err_get_regs;
1829 } 1799 }
1830 1800
1831 ctx->irq = res->start; 1801 ctx->irq = res->start;
@@ -1833,7 +1803,7 @@ static int __devinit fimc_probe(struct platform_device *pdev)
1833 IRQF_ONESHOT, "drm_fimc", ctx); 1803 IRQF_ONESHOT, "drm_fimc", ctx);
1834 if (ret < 0) { 1804 if (ret < 0) {
1835 dev_err(dev, "failed to request irq.\n"); 1805 dev_err(dev, "failed to request irq.\n");
1836 goto err_get_regs; 1806 return ret;
1837 } 1807 }
1838 1808
1839 /* context initailization */ 1809 /* context initailization */
@@ -1879,19 +1849,11 @@ err_ippdrv_register:
1879 pm_runtime_disable(dev); 1849 pm_runtime_disable(dev);
1880err_get_irq: 1850err_get_irq:
1881 free_irq(ctx->irq, ctx); 1851 free_irq(ctx->irq, ctx);
1882err_get_regs: 1852
1883 devm_iounmap(dev, ctx->regs);
1884err_clk:
1885 clk_put(ctx->sclk_fimc_clk);
1886 clk_put(ctx->fimc_clk);
1887 clk_put(ctx->wb_clk);
1888 clk_put(ctx->wb_b_clk);
1889err_ctx:
1890 devm_kfree(dev, ctx);
1891 return ret; 1853 return ret;
1892} 1854}
1893 1855
1894static int __devexit fimc_remove(struct platform_device *pdev) 1856static int fimc_remove(struct platform_device *pdev)
1895{ 1857{
1896 struct device *dev = &pdev->dev; 1858 struct device *dev = &pdev->dev;
1897 struct fimc_context *ctx = get_fimc_context(dev); 1859 struct fimc_context *ctx = get_fimc_context(dev);
@@ -1905,14 +1867,6 @@ static int __devexit fimc_remove(struct platform_device *pdev)
1905 pm_runtime_disable(dev); 1867 pm_runtime_disable(dev);
1906 1868
1907 free_irq(ctx->irq, ctx); 1869 free_irq(ctx->irq, ctx);
1908 devm_iounmap(dev, ctx->regs);
1909
1910 clk_put(ctx->sclk_fimc_clk);
1911 clk_put(ctx->fimc_clk);
1912 clk_put(ctx->wb_clk);
1913 clk_put(ctx->wb_b_clk);
1914
1915 devm_kfree(dev, ctx);
1916 1870
1917 return 0; 1871 return 0;
1918} 1872}
@@ -1990,7 +1944,7 @@ static const struct dev_pm_ops fimc_pm_ops = {
1990 1944
1991struct platform_driver fimc_driver = { 1945struct platform_driver fimc_driver = {
1992 .probe = fimc_probe, 1946 .probe = fimc_probe,
1993 .remove = __devexit_p(fimc_remove), 1947 .remove = fimc_remove,
1994 .id_table = fimc_driver_ids, 1948 .id_table = fimc_driver_ids,
1995 .driver = { 1949 .driver = {
1996 .name = "exynos-drm-fimc", 1950 .name = "exynos-drm-fimc",
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.h b/drivers/gpu/drm/exynos/exynos_drm_fimc.h
index dc970fa0d888..127a424c5fdf 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimc.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.h
@@ -6,24 +6,10 @@
6 * Jinyoung Jeon <jy0.jeon@samsung.com> 6 * Jinyoung Jeon <jy0.jeon@samsung.com>
7 * Sangmin Lee <lsmin.lee@samsung.com> 7 * Sangmin Lee <lsmin.lee@samsung.com>
8 * 8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a 9 * This program is free software; you can redistribute it and/or modify it
10 * copy of this software and associated documentation files (the "Software"), 10 * under the terms of the GNU General Public License as published by the
11 * to deal in the Software without restriction, including without limitation 11 * Free Software Foundation; either version 2 of the License, or (at your
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 * option) any later version.
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice (including the next
17 * paragraph) shall be included in all copies or substantial portions of the
18 * Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 * OTHER DEALINGS IN THE SOFTWARE.
27 */ 13 */
28 14
29#ifndef _EXYNOS_DRM_FIMC_H_ 15#ifndef _EXYNOS_DRM_FIMC_H_
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index bf0d9baca2bc..9537761931ee 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -663,34 +663,6 @@ static struct exynos_drm_manager fimd_manager = {
663 .display_ops = &fimd_display_ops, 663 .display_ops = &fimd_display_ops,
664}; 664};
665 665
666static void fimd_finish_pageflip(struct drm_device *drm_dev, int crtc)
667{
668 struct exynos_drm_private *dev_priv = drm_dev->dev_private;
669 struct drm_pending_vblank_event *e, *t;
670 struct timeval now;
671 unsigned long flags;
672
673 spin_lock_irqsave(&drm_dev->event_lock, flags);
674
675 list_for_each_entry_safe(e, t, &dev_priv->pageflip_event_list,
676 base.link) {
677 /* if event's pipe isn't same as crtc then ignore it. */
678 if (crtc != e->pipe)
679 continue;
680
681 do_gettimeofday(&now);
682 e->event.sequence = 0;
683 e->event.tv_sec = now.tv_sec;
684 e->event.tv_usec = now.tv_usec;
685
686 list_move_tail(&e->base.link, &e->base.file_priv->event_list);
687 wake_up_interruptible(&e->base.file_priv->event_wait);
688 drm_vblank_put(drm_dev, crtc);
689 }
690
691 spin_unlock_irqrestore(&drm_dev->event_lock, flags);
692}
693
694static irqreturn_t fimd_irq_handler(int irq, void *dev_id) 666static irqreturn_t fimd_irq_handler(int irq, void *dev_id)
695{ 667{
696 struct fimd_context *ctx = (struct fimd_context *)dev_id; 668 struct fimd_context *ctx = (struct fimd_context *)dev_id;
@@ -710,7 +682,7 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id)
710 goto out; 682 goto out;
711 683
712 drm_handle_vblank(drm_dev, manager->pipe); 684 drm_handle_vblank(drm_dev, manager->pipe);
713 fimd_finish_pageflip(drm_dev, manager->pipe); 685 exynos_drm_crtc_finish_pageflip(drm_dev, manager->pipe);
714 686
715 /* set wait vsync event to zero and wake up queue. */ 687 /* set wait vsync event to zero and wake up queue. */
716 if (atomic_read(&ctx->wait_vsync_event)) { 688 if (atomic_read(&ctx->wait_vsync_event)) {
@@ -898,7 +870,7 @@ static int fimd_activate(struct fimd_context *ctx, bool enable)
898 return 0; 870 return 0;
899} 871}
900 872
901static int __devinit fimd_probe(struct platform_device *pdev) 873static int fimd_probe(struct platform_device *pdev)
902{ 874{
903 struct device *dev = &pdev->dev; 875 struct device *dev = &pdev->dev;
904 struct fimd_context *ctx; 876 struct fimd_context *ctx;
@@ -997,7 +969,7 @@ static int __devinit fimd_probe(struct platform_device *pdev)
997 return 0; 969 return 0;
998} 970}
999 971
1000static int __devexit fimd_remove(struct platform_device *pdev) 972static int fimd_remove(struct platform_device *pdev)
1001{ 973{
1002 struct device *dev = &pdev->dev; 974 struct device *dev = &pdev->dev;
1003 struct fimd_context *ctx = platform_get_drvdata(pdev); 975 struct fimd_context *ctx = platform_get_drvdata(pdev);
@@ -1046,7 +1018,7 @@ static int fimd_resume(struct device *dev)
1046 * of pm runtime would still be 1 so in this case, fimd driver 1018 * of pm runtime would still be 1 so in this case, fimd driver
1047 * should be on directly not drawing on pm runtime interface. 1019 * should be on directly not drawing on pm runtime interface.
1048 */ 1020 */
1049 if (pm_runtime_suspended(dev)) { 1021 if (!pm_runtime_suspended(dev)) {
1050 int ret; 1022 int ret;
1051 1023
1052 ret = fimd_activate(ctx, true); 1024 ret = fimd_activate(ctx, true);
@@ -1105,7 +1077,7 @@ static const struct dev_pm_ops fimd_pm_ops = {
1105 1077
1106struct platform_driver fimd_driver = { 1078struct platform_driver fimd_driver = {
1107 .probe = fimd_probe, 1079 .probe = fimd_probe,
1108 .remove = __devexit_p(fimd_remove), 1080 .remove = fimd_remove,
1109 .id_table = fimd_driver_ids, 1081 .id_table = fimd_driver_ids,
1110 .driver = { 1082 .driver = {
1111 .name = "exynos4-fb", 1083 .name = "exynos4-fb",
diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
index 6ffa0763c078..9a4c08e7453c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
@@ -324,7 +324,7 @@ out:
324 g2d_userptr = NULL; 324 g2d_userptr = NULL;
325} 325}
326 326
327dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev, 327static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev,
328 unsigned long userptr, 328 unsigned long userptr,
329 unsigned long size, 329 unsigned long size,
330 struct drm_file *filp, 330 struct drm_file *filp,
@@ -1090,7 +1090,7 @@ static void g2d_close(struct drm_device *drm_dev, struct device *dev,
1090 kfree(file_priv->g2d_priv); 1090 kfree(file_priv->g2d_priv);
1091} 1091}
1092 1092
1093static int __devinit g2d_probe(struct platform_device *pdev) 1093static int g2d_probe(struct platform_device *pdev)
1094{ 1094{
1095 struct device *dev = &pdev->dev; 1095 struct device *dev = &pdev->dev;
1096 struct resource *res; 1096 struct resource *res;
@@ -1188,7 +1188,7 @@ err_destroy_slab:
1188 return ret; 1188 return ret;
1189} 1189}
1190 1190
1191static int __devexit g2d_remove(struct platform_device *pdev) 1191static int g2d_remove(struct platform_device *pdev)
1192{ 1192{
1193 struct g2d_data *g2d = platform_get_drvdata(pdev); 1193 struct g2d_data *g2d = platform_get_drvdata(pdev);
1194 1194
@@ -1242,7 +1242,7 @@ static SIMPLE_DEV_PM_OPS(g2d_pm_ops, g2d_suspend, g2d_resume);
1242 1242
1243struct platform_driver g2d_driver = { 1243struct platform_driver g2d_driver = {
1244 .probe = g2d_probe, 1244 .probe = g2d_probe,
1245 .remove = __devexit_p(g2d_remove), 1245 .remove = g2d_remove,
1246 .driver = { 1246 .driver = {
1247 .name = "s5p-g2d", 1247 .name = "s5p-g2d",
1248 .owner = THIS_MODULE, 1248 .owner = THIS_MODULE,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c
index d48183e7e056..473180776528 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
@@ -3,24 +3,10 @@
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * Author: Inki Dae <inki.dae@samsung.com> 4 * Author: Inki Dae <inki.dae@samsung.com>
5 * 5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a 6 * This program is free software; you can redistribute it and/or modify it
7 * copy of this software and associated documentation files (the "Software"), 7 * under the terms of the GNU General Public License as published by the
8 * to deal in the Software without restriction, including without limitation 8 * Free Software Foundation; either version 2 of the License, or (at your
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * option) any later version.
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
15 * Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */ 10 */
25 11
26#include <drm/drmP.h> 12#include <drm/drmP.h>
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.h b/drivers/gpu/drm/exynos/exynos_drm_gem.h
index f11f2afd5bfc..35ebac47dc2b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gem.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_gem.h
@@ -3,24 +3,10 @@
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * Authoer: Inki Dae <inki.dae@samsung.com> 4 * Authoer: Inki Dae <inki.dae@samsung.com>
5 * 5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a 6 * This program is free software; you can redistribute it and/or modify it
7 * copy of this software and associated documentation files (the "Software"), 7 * under the terms of the GNU General Public License as published by the
8 * to deal in the Software without restriction, including without limitation 8 * Free Software Foundation; either version 2 of the License, or (at your
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * option) any later version.
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
15 * Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */ 10 */
25 11
26#ifndef _EXYNOS_DRM_GEM_H_ 12#ifndef _EXYNOS_DRM_GEM_H_
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
index 5639353d47b9..8140753ec9c8 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c
@@ -25,7 +25,7 @@
25#include "exynos_drm_gsc.h" 25#include "exynos_drm_gsc.h"
26 26
27/* 27/*
28 * GSC is stand for General SCaler and 28 * GSC stands for General SCaler and
29 * supports image scaler/rotator and input/output DMA operations. 29 * supports image scaler/rotator and input/output DMA operations.
30 * input DMA reads image data from the memory. 30 * input DMA reads image data from the memory.
31 * output DMA writes image data to memory. 31 * output DMA writes image data to memory.
@@ -711,7 +711,7 @@ static int gsc_src_set_addr(struct device *dev,
711{ 711{
712 struct gsc_context *ctx = get_gsc_context(dev); 712 struct gsc_context *ctx = get_gsc_context(dev);
713 struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; 713 struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv;
714 struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; 714 struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node;
715 struct drm_exynos_ipp_property *property; 715 struct drm_exynos_ipp_property *property;
716 716
717 if (!c_node) { 717 if (!c_node) {
@@ -720,10 +720,6 @@ static int gsc_src_set_addr(struct device *dev,
720 } 720 }
721 721
722 property = &c_node->property; 722 property = &c_node->property;
723 if (!property) {
724 DRM_ERROR("failed to get property.\n");
725 return -EFAULT;
726 }
727 723
728 DRM_DEBUG_KMS("%s:prop_id[%d]buf_id[%d]buf_type[%d]\n", __func__, 724 DRM_DEBUG_KMS("%s:prop_id[%d]buf_id[%d]buf_type[%d]\n", __func__,
729 property->prop_id, buf_id, buf_type); 725 property->prop_id, buf_id, buf_type);
@@ -1171,7 +1167,7 @@ static int gsc_dst_set_addr(struct device *dev,
1171{ 1167{
1172 struct gsc_context *ctx = get_gsc_context(dev); 1168 struct gsc_context *ctx = get_gsc_context(dev);
1173 struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; 1169 struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv;
1174 struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; 1170 struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node;
1175 struct drm_exynos_ipp_property *property; 1171 struct drm_exynos_ipp_property *property;
1176 1172
1177 if (!c_node) { 1173 if (!c_node) {
@@ -1180,10 +1176,6 @@ static int gsc_dst_set_addr(struct device *dev,
1180 } 1176 }
1181 1177
1182 property = &c_node->property; 1178 property = &c_node->property;
1183 if (!property) {
1184 DRM_ERROR("failed to get property.\n");
1185 return -EFAULT;
1186 }
1187 1179
1188 DRM_DEBUG_KMS("%s:prop_id[%d]buf_id[%d]buf_type[%d]\n", __func__, 1180 DRM_DEBUG_KMS("%s:prop_id[%d]buf_id[%d]buf_type[%d]\n", __func__,
1189 property->prop_id, buf_id, buf_type); 1181 property->prop_id, buf_id, buf_type);
@@ -1312,7 +1304,7 @@ static irqreturn_t gsc_irq_handler(int irq, void *dev_id)
1312{ 1304{
1313 struct gsc_context *ctx = dev_id; 1305 struct gsc_context *ctx = dev_id;
1314 struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; 1306 struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv;
1315 struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; 1307 struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node;
1316 struct drm_exynos_ipp_event_work *event_work = 1308 struct drm_exynos_ipp_event_work *event_work =
1317 c_node->event_work; 1309 c_node->event_work;
1318 u32 status; 1310 u32 status;
@@ -1399,7 +1391,7 @@ static inline bool gsc_check_drm_flip(enum drm_exynos_flip flip)
1399 case EXYNOS_DRM_FLIP_NONE: 1391 case EXYNOS_DRM_FLIP_NONE:
1400 case EXYNOS_DRM_FLIP_VERTICAL: 1392 case EXYNOS_DRM_FLIP_VERTICAL:
1401 case EXYNOS_DRM_FLIP_HORIZONTAL: 1393 case EXYNOS_DRM_FLIP_HORIZONTAL:
1402 case EXYNOS_DRM_FLIP_VERTICAL | EXYNOS_DRM_FLIP_HORIZONTAL: 1394 case EXYNOS_DRM_FLIP_BOTH:
1403 return true; 1395 return true;
1404 default: 1396 default:
1405 DRM_DEBUG_KMS("%s:invalid flip\n", __func__); 1397 DRM_DEBUG_KMS("%s:invalid flip\n", __func__);
@@ -1549,7 +1541,7 @@ static int gsc_ippdrv_start(struct device *dev, enum drm_exynos_ipp_cmd cmd)
1549{ 1541{
1550 struct gsc_context *ctx = get_gsc_context(dev); 1542 struct gsc_context *ctx = get_gsc_context(dev);
1551 struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; 1543 struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv;
1552 struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; 1544 struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node;
1553 struct drm_exynos_ipp_property *property; 1545 struct drm_exynos_ipp_property *property;
1554 struct drm_exynos_ipp_config *config; 1546 struct drm_exynos_ipp_config *config;
1555 struct drm_exynos_pos img_pos[EXYNOS_DRM_OPS_MAX]; 1547 struct drm_exynos_pos img_pos[EXYNOS_DRM_OPS_MAX];
@@ -1565,10 +1557,6 @@ static int gsc_ippdrv_start(struct device *dev, enum drm_exynos_ipp_cmd cmd)
1565 } 1557 }
1566 1558
1567 property = &c_node->property; 1559 property = &c_node->property;
1568 if (!property) {
1569 DRM_ERROR("failed to get property.\n");
1570 return -EINVAL;
1571 }
1572 1560
1573 gsc_handle_irq(ctx, true, false, true); 1561 gsc_handle_irq(ctx, true, false, true);
1574 1562
@@ -1604,7 +1592,7 @@ static int gsc_ippdrv_start(struct device *dev, enum drm_exynos_ipp_cmd cmd)
1604 exynos_drm_ippnb_send_event(IPP_SET_WRITEBACK, (void *)&set_wb); 1592 exynos_drm_ippnb_send_event(IPP_SET_WRITEBACK, (void *)&set_wb);
1605 1593
1606 /* src local path */ 1594 /* src local path */
1607 cfg = readl(GSC_IN_CON); 1595 cfg = gsc_read(GSC_IN_CON);
1608 cfg &= ~(GSC_IN_PATH_MASK | GSC_IN_LOCAL_SEL_MASK); 1596 cfg &= ~(GSC_IN_PATH_MASK | GSC_IN_LOCAL_SEL_MASK);
1609 cfg |= (GSC_IN_PATH_LOCAL | GSC_IN_LOCAL_FIMD_WB); 1597 cfg |= (GSC_IN_PATH_LOCAL | GSC_IN_LOCAL_FIMD_WB);
1610 gsc_write(cfg, GSC_IN_CON); 1598 gsc_write(cfg, GSC_IN_CON);
@@ -1683,7 +1671,7 @@ static void gsc_ippdrv_stop(struct device *dev, enum drm_exynos_ipp_cmd cmd)
1683 gsc_write(cfg, GSC_ENABLE); 1671 gsc_write(cfg, GSC_ENABLE);
1684} 1672}
1685 1673
1686static int __devinit gsc_probe(struct platform_device *pdev) 1674static int gsc_probe(struct platform_device *pdev)
1687{ 1675{
1688 struct device *dev = &pdev->dev; 1676 struct device *dev = &pdev->dev;
1689 struct gsc_context *ctx; 1677 struct gsc_context *ctx;
@@ -1696,34 +1684,25 @@ static int __devinit gsc_probe(struct platform_device *pdev)
1696 return -ENOMEM; 1684 return -ENOMEM;
1697 1685
1698 /* clock control */ 1686 /* clock control */
1699 ctx->gsc_clk = clk_get(dev, "gscl"); 1687 ctx->gsc_clk = devm_clk_get(dev, "gscl");
1700 if (IS_ERR(ctx->gsc_clk)) { 1688 if (IS_ERR(ctx->gsc_clk)) {
1701 dev_err(dev, "failed to get gsc clock.\n"); 1689 dev_err(dev, "failed to get gsc clock.\n");
1702 ret = PTR_ERR(ctx->gsc_clk); 1690 return PTR_ERR(ctx->gsc_clk);
1703 goto err_ctx;
1704 } 1691 }
1705 1692
1706 /* resource memory */ 1693 /* resource memory */
1707 ctx->regs_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1694 ctx->regs_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1708 if (!ctx->regs_res) {
1709 dev_err(dev, "failed to find registers.\n");
1710 ret = -ENOENT;
1711 goto err_clk;
1712 }
1713
1714 ctx->regs = devm_request_and_ioremap(dev, ctx->regs_res); 1695 ctx->regs = devm_request_and_ioremap(dev, ctx->regs_res);
1715 if (!ctx->regs) { 1696 if (!ctx->regs) {
1716 dev_err(dev, "failed to map registers.\n"); 1697 dev_err(dev, "failed to map registers.\n");
1717 ret = -ENXIO; 1698 return -ENXIO;
1718 goto err_clk;
1719 } 1699 }
1720 1700
1721 /* resource irq */ 1701 /* resource irq */
1722 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 1702 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
1723 if (!res) { 1703 if (!res) {
1724 dev_err(dev, "failed to request irq resource.\n"); 1704 dev_err(dev, "failed to request irq resource.\n");
1725 ret = -ENOENT; 1705 return -ENOENT;
1726 goto err_get_regs;
1727 } 1706 }
1728 1707
1729 ctx->irq = res->start; 1708 ctx->irq = res->start;
@@ -1731,7 +1710,7 @@ static int __devinit gsc_probe(struct platform_device *pdev)
1731 IRQF_ONESHOT, "drm_gsc", ctx); 1710 IRQF_ONESHOT, "drm_gsc", ctx);
1732 if (ret < 0) { 1711 if (ret < 0) {
1733 dev_err(dev, "failed to request irq.\n"); 1712 dev_err(dev, "failed to request irq.\n");
1734 goto err_get_regs; 1713 return ret;
1735 } 1714 }
1736 1715
1737 /* context initailization */ 1716 /* context initailization */
@@ -1775,16 +1754,10 @@ err_ippdrv_register:
1775 pm_runtime_disable(dev); 1754 pm_runtime_disable(dev);
1776err_get_irq: 1755err_get_irq:
1777 free_irq(ctx->irq, ctx); 1756 free_irq(ctx->irq, ctx);
1778err_get_regs:
1779 devm_iounmap(dev, ctx->regs);
1780err_clk:
1781 clk_put(ctx->gsc_clk);
1782err_ctx:
1783 devm_kfree(dev, ctx);
1784 return ret; 1757 return ret;
1785} 1758}
1786 1759
1787static int __devexit gsc_remove(struct platform_device *pdev) 1760static int gsc_remove(struct platform_device *pdev)
1788{ 1761{
1789 struct device *dev = &pdev->dev; 1762 struct device *dev = &pdev->dev;
1790 struct gsc_context *ctx = get_gsc_context(dev); 1763 struct gsc_context *ctx = get_gsc_context(dev);
@@ -1798,11 +1771,6 @@ static int __devexit gsc_remove(struct platform_device *pdev)
1798 pm_runtime_disable(dev); 1771 pm_runtime_disable(dev);
1799 1772
1800 free_irq(ctx->irq, ctx); 1773 free_irq(ctx->irq, ctx);
1801 devm_iounmap(dev, ctx->regs);
1802
1803 clk_put(ctx->gsc_clk);
1804
1805 devm_kfree(dev, ctx);
1806 1774
1807 return 0; 1775 return 0;
1808} 1776}
@@ -1860,7 +1828,7 @@ static const struct dev_pm_ops gsc_pm_ops = {
1860 1828
1861struct platform_driver gsc_driver = { 1829struct platform_driver gsc_driver = {
1862 .probe = gsc_probe, 1830 .probe = gsc_probe,
1863 .remove = __devexit_p(gsc_remove), 1831 .remove = gsc_remove,
1864 .driver = { 1832 .driver = {
1865 .name = "exynos-drm-gsc", 1833 .name = "exynos-drm-gsc",
1866 .owner = THIS_MODULE, 1834 .owner = THIS_MODULE,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.h b/drivers/gpu/drm/exynos/exynos_drm_gsc.h
index b3c3bc618c0f..29ec1c5efcf2 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gsc.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.h
@@ -6,24 +6,10 @@
6 * Jinyoung Jeon <jy0.jeon@samsung.com> 6 * Jinyoung Jeon <jy0.jeon@samsung.com>
7 * Sangmin Lee <lsmin.lee@samsung.com> 7 * Sangmin Lee <lsmin.lee@samsung.com>
8 * 8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a 9 * This program is free software; you can redistribute it and/or modify it
10 * copy of this software and associated documentation files (the "Software"), 10 * under the terms of the GNU General Public License as published by the
11 * to deal in the Software without restriction, including without limitation 11 * Free Software Foundation; either version 2 of the License, or (at your
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 * option) any later version.
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice (including the next
17 * paragraph) shall be included in all copies or substantial portions of the
18 * Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 * OTHER DEALINGS IN THE SOFTWARE.
27 */ 13 */
28 14
29#ifndef _EXYNOS_DRM_GSC_H_ 15#ifndef _EXYNOS_DRM_GSC_H_
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
index 55793c46e3c2..28644539b305 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c
@@ -108,18 +108,17 @@ static bool drm_hdmi_is_connected(struct device *dev)
108 return false; 108 return false;
109} 109}
110 110
111static int drm_hdmi_get_edid(struct device *dev, 111static struct edid *drm_hdmi_get_edid(struct device *dev,
112 struct drm_connector *connector, u8 *edid, int len) 112 struct drm_connector *connector)
113{ 113{
114 struct drm_hdmi_context *ctx = to_context(dev); 114 struct drm_hdmi_context *ctx = to_context(dev);
115 115
116 DRM_DEBUG_KMS("%s\n", __FILE__); 116 DRM_DEBUG_KMS("%s\n", __FILE__);
117 117
118 if (hdmi_ops && hdmi_ops->get_edid) 118 if (hdmi_ops && hdmi_ops->get_edid)
119 return hdmi_ops->get_edid(ctx->hdmi_ctx->ctx, connector, edid, 119 return hdmi_ops->get_edid(ctx->hdmi_ctx->ctx, connector);
120 len);
121 120
122 return 0; 121 return NULL;
123} 122}
124 123
125static int drm_hdmi_check_timing(struct device *dev, void *timing) 124static int drm_hdmi_check_timing(struct device *dev, void *timing)
@@ -385,7 +384,7 @@ static void hdmi_subdrv_remove(struct drm_device *drm_dev, struct device *dev)
385 mixer_ops->iommu_on(ctx->mixer_ctx->ctx, false); 384 mixer_ops->iommu_on(ctx->mixer_ctx->ctx, false);
386} 385}
387 386
388static int __devinit exynos_drm_hdmi_probe(struct platform_device *pdev) 387static int exynos_drm_hdmi_probe(struct platform_device *pdev)
389{ 388{
390 struct device *dev = &pdev->dev; 389 struct device *dev = &pdev->dev;
391 struct exynos_drm_subdrv *subdrv; 390 struct exynos_drm_subdrv *subdrv;
@@ -413,7 +412,7 @@ static int __devinit exynos_drm_hdmi_probe(struct platform_device *pdev)
413 return 0; 412 return 0;
414} 413}
415 414
416static int __devexit exynos_drm_hdmi_remove(struct platform_device *pdev) 415static int exynos_drm_hdmi_remove(struct platform_device *pdev)
417{ 416{
418 struct drm_hdmi_context *ctx = platform_get_drvdata(pdev); 417 struct drm_hdmi_context *ctx = platform_get_drvdata(pdev);
419 418
@@ -426,7 +425,7 @@ static int __devexit exynos_drm_hdmi_remove(struct platform_device *pdev)
426 425
427struct platform_driver exynos_drm_common_hdmi_driver = { 426struct platform_driver exynos_drm_common_hdmi_driver = {
428 .probe = exynos_drm_hdmi_probe, 427 .probe = exynos_drm_hdmi_probe,
429 .remove = __devexit_p(exynos_drm_hdmi_remove), 428 .remove = exynos_drm_hdmi_remove,
430 .driver = { 429 .driver = {
431 .name = "exynos-drm-hdmi", 430 .name = "exynos-drm-hdmi",
432 .owner = THIS_MODULE, 431 .owner = THIS_MODULE,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h
index fcc3093ec8fe..d80516fc9ed7 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h
@@ -3,24 +3,10 @@
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * Authoer: Inki Dae <inki.dae@samsung.com> 4 * Authoer: Inki Dae <inki.dae@samsung.com>
5 * 5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a 6 * This program is free software; you can redistribute it and/or modify it
7 * copy of this software and associated documentation files (the "Software"), 7 * under the terms of the GNU General Public License as published by the
8 * to deal in the Software without restriction, including without limitation 8 * Free Software Foundation; either version 2 of the License, or (at your
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * option) any later version.
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
15 * Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */ 10 */
25 11
26#ifndef _EXYNOS_DRM_HDMI_H_ 12#ifndef _EXYNOS_DRM_HDMI_H_
@@ -44,8 +30,8 @@ struct exynos_drm_hdmi_context {
44struct exynos_hdmi_ops { 30struct exynos_hdmi_ops {
45 /* display */ 31 /* display */
46 bool (*is_connected)(void *ctx); 32 bool (*is_connected)(void *ctx);
47 int (*get_edid)(void *ctx, struct drm_connector *connector, 33 struct edid *(*get_edid)(void *ctx,
48 u8 *edid, int len); 34 struct drm_connector *connector);
49 int (*check_timing)(void *ctx, void *timing); 35 int (*check_timing)(void *ctx, void *timing);
50 int (*power_on)(void *ctx, int mode); 36 int (*power_on)(void *ctx, int mode);
51 37
diff --git a/drivers/gpu/drm/exynos/exynos_drm_iommu.c b/drivers/gpu/drm/exynos/exynos_drm_iommu.c
index 2482b7f96341..3799d5c2b5df 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_iommu.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_iommu.c
@@ -3,24 +3,10 @@
3 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 * Author: Inki Dae <inki.dae@samsung.com> 4 * Author: Inki Dae <inki.dae@samsung.com>
5 * 5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a 6 * This program is free software; you can redistribute it and/or modify it
7 * copy of this software and associated documentation files (the "Software"), 7 * under the terms of the GNU General Public License as published by the
8 * to deal in the Software without restriction, including without limitation 8 * Free Software Foundation; either version 2 of the License, or (at your
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * option) any later version.
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
15 * Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */ 10 */
25 11
26#include <drmP.h> 12#include <drmP.h>
diff --git a/drivers/gpu/drm/exynos/exynos_drm_iommu.h b/drivers/gpu/drm/exynos/exynos_drm_iommu.h
index 18a0ca190b98..53b7deea8ab7 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_iommu.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_iommu.h
@@ -3,24 +3,10 @@
3 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 * Authoer: Inki Dae <inki.dae@samsung.com> 4 * Authoer: Inki Dae <inki.dae@samsung.com>
5 * 5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a 6 * This program is free software; you can redistribute it and/or modify it
7 * copy of this software and associated documentation files (the "Software"), 7 * under the terms of the GNU General Public License as published by the
8 * to deal in the Software without restriction, including without limitation 8 * Free Software Foundation; either version 2 of the License, or (at your
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * option) any later version.
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
15 * Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */ 10 */
25 11
26#ifndef _EXYNOS_DRM_IOMMU_H_ 12#ifndef _EXYNOS_DRM_IOMMU_H_
diff --git a/drivers/gpu/drm/exynos/exynos_drm_ipp.c b/drivers/gpu/drm/exynos/exynos_drm_ipp.c
index 49eebe948ed2..1a556354e92f 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_ipp.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_ipp.c
@@ -27,7 +27,7 @@
27#include "exynos_drm_iommu.h" 27#include "exynos_drm_iommu.h"
28 28
29/* 29/*
30 * IPP is stand for Image Post Processing and 30 * IPP stands for Image Post Processing and
31 * supports image scaler/rotator and input/output DMA operations. 31 * supports image scaler/rotator and input/output DMA operations.
32 * using FIMC, GSC, Rotator, so on. 32 * using FIMC, GSC, Rotator, so on.
33 * IPP is integration device driver of same attribute h/w 33 * IPP is integration device driver of same attribute h/w
@@ -869,7 +869,7 @@ static void ipp_put_event(struct drm_exynos_ipp_cmd_node *c_node,
869 } 869 }
870} 870}
871 871
872void ipp_handle_cmd_work(struct device *dev, 872static void ipp_handle_cmd_work(struct device *dev,
873 struct exynos_drm_ippdrv *ippdrv, 873 struct exynos_drm_ippdrv *ippdrv,
874 struct drm_exynos_ipp_cmd_work *cmd_work, 874 struct drm_exynos_ipp_cmd_work *cmd_work,
875 struct drm_exynos_ipp_cmd_node *c_node) 875 struct drm_exynos_ipp_cmd_node *c_node)
@@ -1292,7 +1292,7 @@ static int ipp_start_property(struct exynos_drm_ippdrv *ippdrv,
1292 DRM_DEBUG_KMS("%s:prop_id[%d]\n", __func__, property->prop_id); 1292 DRM_DEBUG_KMS("%s:prop_id[%d]\n", __func__, property->prop_id);
1293 1293
1294 /* store command info in ippdrv */ 1294 /* store command info in ippdrv */
1295 ippdrv->cmd = c_node; 1295 ippdrv->c_node = c_node;
1296 1296
1297 if (!ipp_check_mem_list(c_node)) { 1297 if (!ipp_check_mem_list(c_node)) {
1298 DRM_DEBUG_KMS("%s:empty memory.\n", __func__); 1298 DRM_DEBUG_KMS("%s:empty memory.\n", __func__);
@@ -1303,7 +1303,7 @@ static int ipp_start_property(struct exynos_drm_ippdrv *ippdrv,
1303 ret = ipp_set_property(ippdrv, property); 1303 ret = ipp_set_property(ippdrv, property);
1304 if (ret) { 1304 if (ret) {
1305 DRM_ERROR("failed to set property.\n"); 1305 DRM_ERROR("failed to set property.\n");
1306 ippdrv->cmd = NULL; 1306 ippdrv->c_node = NULL;
1307 return ret; 1307 return ret;
1308 } 1308 }
1309 1309
@@ -1487,11 +1487,6 @@ void ipp_sched_cmd(struct work_struct *work)
1487 mutex_lock(&c_node->cmd_lock); 1487 mutex_lock(&c_node->cmd_lock);
1488 1488
1489 property = &c_node->property; 1489 property = &c_node->property;
1490 if (!property) {
1491 DRM_ERROR("failed to get property:prop_id[%d]\n",
1492 c_node->property.prop_id);
1493 goto err_unlock;
1494 }
1495 1490
1496 switch (cmd_work->ctrl) { 1491 switch (cmd_work->ctrl) {
1497 case IPP_CTRL_PLAY: 1492 case IPP_CTRL_PLAY:
@@ -1704,7 +1699,7 @@ void ipp_sched_event(struct work_struct *work)
1704 return; 1699 return;
1705 } 1700 }
1706 1701
1707 c_node = ippdrv->cmd; 1702 c_node = ippdrv->c_node;
1708 if (!c_node) { 1703 if (!c_node) {
1709 DRM_ERROR("failed to get command node.\n"); 1704 DRM_ERROR("failed to get command node.\n");
1710 return; 1705 return;
@@ -1888,14 +1883,14 @@ err_clear:
1888 return; 1883 return;
1889} 1884}
1890 1885
1891static int __devinit ipp_probe(struct platform_device *pdev) 1886static int ipp_probe(struct platform_device *pdev)
1892{ 1887{
1893 struct device *dev = &pdev->dev; 1888 struct device *dev = &pdev->dev;
1894 struct ipp_context *ctx; 1889 struct ipp_context *ctx;
1895 struct exynos_drm_subdrv *subdrv; 1890 struct exynos_drm_subdrv *subdrv;
1896 int ret; 1891 int ret;
1897 1892
1898 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); 1893 ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
1899 if (!ctx) 1894 if (!ctx)
1900 return -ENOMEM; 1895 return -ENOMEM;
1901 1896
@@ -1916,8 +1911,7 @@ static int __devinit ipp_probe(struct platform_device *pdev)
1916 ctx->event_workq = create_singlethread_workqueue("ipp_event"); 1911 ctx->event_workq = create_singlethread_workqueue("ipp_event");
1917 if (!ctx->event_workq) { 1912 if (!ctx->event_workq) {
1918 dev_err(dev, "failed to create event workqueue\n"); 1913 dev_err(dev, "failed to create event workqueue\n");
1919 ret = -EINVAL; 1914 return -EINVAL;
1920 goto err_clear;
1921 } 1915 }
1922 1916
1923 /* 1917 /*
@@ -1958,12 +1952,10 @@ err_cmd_workq:
1958 destroy_workqueue(ctx->cmd_workq); 1952 destroy_workqueue(ctx->cmd_workq);
1959err_event_workq: 1953err_event_workq:
1960 destroy_workqueue(ctx->event_workq); 1954 destroy_workqueue(ctx->event_workq);
1961err_clear:
1962 kfree(ctx);
1963 return ret; 1955 return ret;
1964} 1956}
1965 1957
1966static int __devexit ipp_remove(struct platform_device *pdev) 1958static int ipp_remove(struct platform_device *pdev)
1967{ 1959{
1968 struct ipp_context *ctx = platform_get_drvdata(pdev); 1960 struct ipp_context *ctx = platform_get_drvdata(pdev);
1969 1961
@@ -1985,8 +1977,6 @@ static int __devexit ipp_remove(struct platform_device *pdev)
1985 destroy_workqueue(ctx->cmd_workq); 1977 destroy_workqueue(ctx->cmd_workq);
1986 destroy_workqueue(ctx->event_workq); 1978 destroy_workqueue(ctx->event_workq);
1987 1979
1988 kfree(ctx);
1989
1990 return 0; 1980 return 0;
1991} 1981}
1992 1982
@@ -2050,7 +2040,7 @@ static const struct dev_pm_ops ipp_pm_ops = {
2050 2040
2051struct platform_driver ipp_driver = { 2041struct platform_driver ipp_driver = {
2052 .probe = ipp_probe, 2042 .probe = ipp_probe,
2053 .remove = __devexit_p(ipp_remove), 2043 .remove = ipp_remove,
2054 .driver = { 2044 .driver = {
2055 .name = "exynos-drm-ipp", 2045 .name = "exynos-drm-ipp",
2056 .owner = THIS_MODULE, 2046 .owner = THIS_MODULE,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_ipp.h b/drivers/gpu/drm/exynos/exynos_drm_ipp.h
index 28ffac95386c..4cadbea7dbde 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_ipp.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_ipp.h
@@ -6,24 +6,10 @@
6 * Jinyoung Jeon <jy0.jeon@samsung.com> 6 * Jinyoung Jeon <jy0.jeon@samsung.com>
7 * Sangmin Lee <lsmin.lee@samsung.com> 7 * Sangmin Lee <lsmin.lee@samsung.com>
8 * 8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a 9 * This program is free software; you can redistribute it and/or modify it
10 * copy of this software and associated documentation files (the "Software"), 10 * under the terms of the GNU General Public License as published by the
11 * to deal in the Software without restriction, including without limitation 11 * Free Software Foundation; either version 2 of the License, or (at your
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 * option) any later version.
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice (including the next
17 * paragraph) shall be included in all copies or substantial portions of the
18 * Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 * OTHER DEALINGS IN THE SOFTWARE.
27 */ 13 */
28 14
29#ifndef _EXYNOS_DRM_IPP_H_ 15#ifndef _EXYNOS_DRM_IPP_H_
@@ -160,7 +146,7 @@ struct exynos_drm_ipp_ops {
160 * @dedicated: dedicated ipp device. 146 * @dedicated: dedicated ipp device.
161 * @ops: source, destination operations. 147 * @ops: source, destination operations.
162 * @event_workq: event work queue. 148 * @event_workq: event work queue.
163 * @cmd: current command information. 149 * @c_node: current command information.
164 * @cmd_list: list head for command information. 150 * @cmd_list: list head for command information.
165 * @prop_list: property informations of current ipp driver. 151 * @prop_list: property informations of current ipp driver.
166 * @check_property: check property about format, size, buffer. 152 * @check_property: check property about format, size, buffer.
@@ -178,7 +164,7 @@ struct exynos_drm_ippdrv {
178 bool dedicated; 164 bool dedicated;
179 struct exynos_drm_ipp_ops *ops[EXYNOS_DRM_OPS_MAX]; 165 struct exynos_drm_ipp_ops *ops[EXYNOS_DRM_OPS_MAX];
180 struct workqueue_struct *event_workq; 166 struct workqueue_struct *event_workq;
181 struct drm_exynos_ipp_cmd_node *cmd; 167 struct drm_exynos_ipp_cmd_node *c_node;
182 struct list_head cmd_list; 168 struct list_head cmd_list;
183 struct drm_exynos_ipp_prop_list *prop_list; 169 struct drm_exynos_ipp_prop_list *prop_list;
184 170
diff --git a/drivers/gpu/drm/exynos/exynos_drm_rotator.c b/drivers/gpu/drm/exynos/exynos_drm_rotator.c
index 1c2366083c70..f976e29def6e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_rotator.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_rotator.c
@@ -139,7 +139,7 @@ static irqreturn_t rotator_irq_handler(int irq, void *arg)
139{ 139{
140 struct rot_context *rot = arg; 140 struct rot_context *rot = arg;
141 struct exynos_drm_ippdrv *ippdrv = &rot->ippdrv; 141 struct exynos_drm_ippdrv *ippdrv = &rot->ippdrv;
142 struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; 142 struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node;
143 struct drm_exynos_ipp_event_work *event_work = c_node->event_work; 143 struct drm_exynos_ipp_event_work *event_work = c_node->event_work;
144 enum rot_irq_status irq_status; 144 enum rot_irq_status irq_status;
145 u32 val; 145 u32 val;
@@ -513,6 +513,7 @@ static inline bool rotator_check_drm_flip(enum drm_exynos_flip flip)
513 case EXYNOS_DRM_FLIP_NONE: 513 case EXYNOS_DRM_FLIP_NONE:
514 case EXYNOS_DRM_FLIP_VERTICAL: 514 case EXYNOS_DRM_FLIP_VERTICAL:
515 case EXYNOS_DRM_FLIP_HORIZONTAL: 515 case EXYNOS_DRM_FLIP_HORIZONTAL:
516 case EXYNOS_DRM_FLIP_BOTH:
516 return true; 517 return true;
517 default: 518 default:
518 DRM_DEBUG_KMS("%s:invalid flip\n", __func__); 519 DRM_DEBUG_KMS("%s:invalid flip\n", __func__);
@@ -638,7 +639,7 @@ static int rotator_ippdrv_start(struct device *dev, enum drm_exynos_ipp_cmd cmd)
638 return 0; 639 return 0;
639} 640}
640 641
641static int __devinit rotator_probe(struct platform_device *pdev) 642static int rotator_probe(struct platform_device *pdev)
642{ 643{
643 struct device *dev = &pdev->dev; 644 struct device *dev = &pdev->dev;
644 struct rot_context *rot; 645 struct rot_context *rot;
@@ -655,34 +656,26 @@ static int __devinit rotator_probe(struct platform_device *pdev)
655 platform_get_device_id(pdev)->driver_data; 656 platform_get_device_id(pdev)->driver_data;
656 657
657 rot->regs_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 658 rot->regs_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
658 if (!rot->regs_res) {
659 dev_err(dev, "failed to find registers\n");
660 ret = -ENOENT;
661 goto err_get_resource;
662 }
663
664 rot->regs = devm_request_and_ioremap(dev, rot->regs_res); 659 rot->regs = devm_request_and_ioremap(dev, rot->regs_res);
665 if (!rot->regs) { 660 if (!rot->regs) {
666 dev_err(dev, "failed to map register\n"); 661 dev_err(dev, "failed to map register\n");
667 ret = -ENXIO; 662 return -ENXIO;
668 goto err_get_resource;
669 } 663 }
670 664
671 rot->irq = platform_get_irq(pdev, 0); 665 rot->irq = platform_get_irq(pdev, 0);
672 if (rot->irq < 0) { 666 if (rot->irq < 0) {
673 dev_err(dev, "failed to get irq\n"); 667 dev_err(dev, "failed to get irq\n");
674 ret = rot->irq; 668 return rot->irq;
675 goto err_get_irq;
676 } 669 }
677 670
678 ret = request_threaded_irq(rot->irq, NULL, rotator_irq_handler, 671 ret = request_threaded_irq(rot->irq, NULL, rotator_irq_handler,
679 IRQF_ONESHOT, "drm_rotator", rot); 672 IRQF_ONESHOT, "drm_rotator", rot);
680 if (ret < 0) { 673 if (ret < 0) {
681 dev_err(dev, "failed to request irq\n"); 674 dev_err(dev, "failed to request irq\n");
682 goto err_get_irq; 675 return ret;
683 } 676 }
684 677
685 rot->clock = clk_get(dev, "rotator"); 678 rot->clock = devm_clk_get(dev, "rotator");
686 if (IS_ERR_OR_NULL(rot->clock)) { 679 if (IS_ERR_OR_NULL(rot->clock)) {
687 dev_err(dev, "failed to get clock\n"); 680 dev_err(dev, "failed to get clock\n");
688 ret = PTR_ERR(rot->clock); 681 ret = PTR_ERR(rot->clock);
@@ -720,17 +713,12 @@ static int __devinit rotator_probe(struct platform_device *pdev)
720err_ippdrv_register: 713err_ippdrv_register:
721 devm_kfree(dev, ippdrv->prop_list); 714 devm_kfree(dev, ippdrv->prop_list);
722 pm_runtime_disable(dev); 715 pm_runtime_disable(dev);
723 clk_put(rot->clock);
724err_clk_get: 716err_clk_get:
725 free_irq(rot->irq, rot); 717 free_irq(rot->irq, rot);
726err_get_irq:
727 devm_iounmap(dev, rot->regs);
728err_get_resource:
729 devm_kfree(dev, rot);
730 return ret; 718 return ret;
731} 719}
732 720
733static int __devexit rotator_remove(struct platform_device *pdev) 721static int rotator_remove(struct platform_device *pdev)
734{ 722{
735 struct device *dev = &pdev->dev; 723 struct device *dev = &pdev->dev;
736 struct rot_context *rot = dev_get_drvdata(dev); 724 struct rot_context *rot = dev_get_drvdata(dev);
@@ -740,17 +728,13 @@ static int __devexit rotator_remove(struct platform_device *pdev)
740 exynos_drm_ippdrv_unregister(ippdrv); 728 exynos_drm_ippdrv_unregister(ippdrv);
741 729
742 pm_runtime_disable(dev); 730 pm_runtime_disable(dev);
743 clk_put(rot->clock);
744 731
745 free_irq(rot->irq, rot); 732 free_irq(rot->irq, rot);
746 devm_iounmap(dev, rot->regs);
747
748 devm_kfree(dev, rot);
749 733
750 return 0; 734 return 0;
751} 735}
752 736
753struct rot_limit_table rot_limit_tbl = { 737static struct rot_limit_table rot_limit_tbl = {
754 .ycbcr420_2p = { 738 .ycbcr420_2p = {
755 .min_w = 32, 739 .min_w = 32,
756 .min_h = 32, 740 .min_h = 32,
@@ -767,7 +751,7 @@ struct rot_limit_table rot_limit_tbl = {
767 }, 751 },
768}; 752};
769 753
770struct platform_device_id rotator_driver_ids[] = { 754static struct platform_device_id rotator_driver_ids[] = {
771 { 755 {
772 .name = "exynos-rot", 756 .name = "exynos-rot",
773 .driver_data = (unsigned long)&rot_limit_tbl, 757 .driver_data = (unsigned long)&rot_limit_tbl,
@@ -845,7 +829,7 @@ static const struct dev_pm_ops rotator_pm_ops = {
845 829
846struct platform_driver rotator_driver = { 830struct platform_driver rotator_driver = {
847 .probe = rotator_probe, 831 .probe = rotator_probe,
848 .remove = __devexit_p(rotator_remove), 832 .remove = rotator_remove,
849 .id_table = rotator_driver_ids, 833 .id_table = rotator_driver_ids,
850 .driver = { 834 .driver = {
851 .name = "exynos-rot", 835 .name = "exynos-rot",
diff --git a/drivers/gpu/drm/exynos/exynos_drm_rotator.h b/drivers/gpu/drm/exynos/exynos_drm_rotator.h
index a2d7a14a52b6..71a0b4c0c1e8 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_rotator.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_rotator.h
@@ -5,24 +5,10 @@
5 * YoungJun Cho <yj44.cho@samsung.com> 5 * YoungJun Cho <yj44.cho@samsung.com>
6 * Eunchul Kim <chulspro.kim@samsung.com> 6 * Eunchul Kim <chulspro.kim@samsung.com>
7 * 7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a 8 * This program is free software; you can redistribute it and/or modify it
9 * copy of this software and associated documentation files (the "Software"), 9 * under the terms of the GNU General Public License as published by the
10 * to deal in the Software without restriction, including without limitation 10 * Free Software Foundation; either version 2 of the License, or (at your
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 * option) any later version.
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice (including the next
16 * paragraph) shall be included in all copies or substantial portions of the
17 * Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 * OTHER DEALINGS IN THE SOFTWARE.
26 */ 12 */
27 13
28#ifndef _EXYNOS_DRM_ROTATOR_H_ 14#ifndef _EXYNOS_DRM_ROTATOR_H_
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
index 99bfc38dfaa2..13ccbd4bcfaa 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
@@ -98,10 +98,12 @@ static bool vidi_display_is_connected(struct device *dev)
98 return ctx->connected ? true : false; 98 return ctx->connected ? true : false;
99} 99}
100 100
101static int vidi_get_edid(struct device *dev, struct drm_connector *connector, 101static struct edid *vidi_get_edid(struct device *dev,
102 u8 *edid, int len) 102 struct drm_connector *connector)
103{ 103{
104 struct vidi_context *ctx = get_vidi_context(dev); 104 struct vidi_context *ctx = get_vidi_context(dev);
105 struct edid *edid;
106 int edid_len;
105 107
106 DRM_DEBUG_KMS("%s\n", __FILE__); 108 DRM_DEBUG_KMS("%s\n", __FILE__);
107 109
@@ -111,13 +113,18 @@ static int vidi_get_edid(struct device *dev, struct drm_connector *connector,
111 */ 113 */
112 if (!ctx->raw_edid) { 114 if (!ctx->raw_edid) {
113 DRM_DEBUG_KMS("raw_edid is null.\n"); 115 DRM_DEBUG_KMS("raw_edid is null.\n");
114 return -EFAULT; 116 return ERR_PTR(-EFAULT);
115 } 117 }
116 118
117 memcpy(edid, ctx->raw_edid, min((1 + ctx->raw_edid->extensions) 119 edid_len = (1 + ctx->raw_edid->extensions) * EDID_LENGTH;
118 * EDID_LENGTH, len)); 120 edid = kzalloc(edid_len, GFP_KERNEL);
121 if (!edid) {
122 DRM_DEBUG_KMS("failed to allocate edid\n");
123 return ERR_PTR(-ENOMEM);
124 }
119 125
120 return 0; 126 memcpy(edid, ctx->raw_edid, edid_len);
127 return edid;
121} 128}
122 129
123static void *vidi_get_panel(struct device *dev) 130static void *vidi_get_panel(struct device *dev)
@@ -372,34 +379,6 @@ static struct exynos_drm_manager vidi_manager = {
372 .display_ops = &vidi_display_ops, 379 .display_ops = &vidi_display_ops,
373}; 380};
374 381
375static void vidi_finish_pageflip(struct drm_device *drm_dev, int crtc)
376{
377 struct exynos_drm_private *dev_priv = drm_dev->dev_private;
378 struct drm_pending_vblank_event *e, *t;
379 struct timeval now;
380 unsigned long flags;
381
382 spin_lock_irqsave(&drm_dev->event_lock, flags);
383
384 list_for_each_entry_safe(e, t, &dev_priv->pageflip_event_list,
385 base.link) {
386 /* if event's pipe isn't same as crtc then ignore it. */
387 if (crtc != e->pipe)
388 continue;
389
390 do_gettimeofday(&now);
391 e->event.sequence = 0;
392 e->event.tv_sec = now.tv_sec;
393 e->event.tv_usec = now.tv_usec;
394
395 list_move_tail(&e->base.link, &e->base.file_priv->event_list);
396 wake_up_interruptible(&e->base.file_priv->event_wait);
397 drm_vblank_put(drm_dev, crtc);
398 }
399
400 spin_unlock_irqrestore(&drm_dev->event_lock, flags);
401}
402
403static void vidi_fake_vblank_handler(struct work_struct *work) 382static void vidi_fake_vblank_handler(struct work_struct *work)
404{ 383{
405 struct vidi_context *ctx = container_of(work, struct vidi_context, 384 struct vidi_context *ctx = container_of(work, struct vidi_context,
@@ -424,7 +403,7 @@ static void vidi_fake_vblank_handler(struct work_struct *work)
424 403
425 mutex_unlock(&ctx->lock); 404 mutex_unlock(&ctx->lock);
426 405
427 vidi_finish_pageflip(subdrv->drm_dev, manager->pipe); 406 exynos_drm_crtc_finish_pageflip(subdrv->drm_dev, manager->pipe);
428} 407}
429 408
430static int vidi_subdrv_probe(struct drm_device *drm_dev, struct device *dev) 409static int vidi_subdrv_probe(struct drm_device *drm_dev, struct device *dev)
@@ -542,7 +521,6 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void *data,
542 struct exynos_drm_manager *manager; 521 struct exynos_drm_manager *manager;
543 struct exynos_drm_display_ops *display_ops; 522 struct exynos_drm_display_ops *display_ops;
544 struct drm_exynos_vidi_connection *vidi = data; 523 struct drm_exynos_vidi_connection *vidi = data;
545 struct edid *raw_edid;
546 int edid_len; 524 int edid_len;
547 525
548 DRM_DEBUG_KMS("%s\n", __FILE__); 526 DRM_DEBUG_KMS("%s\n", __FILE__);
@@ -579,11 +557,11 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void *data,
579 } 557 }
580 558
581 if (vidi->connection) { 559 if (vidi->connection) {
582 if (!vidi->edid) { 560 struct edid *raw_edid = (struct edid *)(uint32_t)vidi->edid;
583 DRM_DEBUG_KMS("edid data is null.\n"); 561 if (!drm_edid_is_valid(raw_edid)) {
562 DRM_DEBUG_KMS("edid data is invalid.\n");
584 return -EINVAL; 563 return -EINVAL;
585 } 564 }
586 raw_edid = (struct edid *)(uint32_t)vidi->edid;
587 edid_len = (1 + raw_edid->extensions) * EDID_LENGTH; 565 edid_len = (1 + raw_edid->extensions) * EDID_LENGTH;
588 ctx->raw_edid = kzalloc(edid_len, GFP_KERNEL); 566 ctx->raw_edid = kzalloc(edid_len, GFP_KERNEL);
589 if (!ctx->raw_edid) { 567 if (!ctx->raw_edid) {
@@ -609,7 +587,7 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void *data,
609 return 0; 587 return 0;
610} 588}
611 589
612static int __devinit vidi_probe(struct platform_device *pdev) 590static int vidi_probe(struct platform_device *pdev)
613{ 591{
614 struct device *dev = &pdev->dev; 592 struct device *dev = &pdev->dev;
615 struct vidi_context *ctx; 593 struct vidi_context *ctx;
@@ -645,7 +623,7 @@ static int __devinit vidi_probe(struct platform_device *pdev)
645 return 0; 623 return 0;
646} 624}
647 625
648static int __devexit vidi_remove(struct platform_device *pdev) 626static int vidi_remove(struct platform_device *pdev)
649{ 627{
650 struct vidi_context *ctx = platform_get_drvdata(pdev); 628 struct vidi_context *ctx = platform_get_drvdata(pdev);
651 629
@@ -683,7 +661,7 @@ static const struct dev_pm_ops vidi_pm_ops = {
683 661
684struct platform_driver vidi_driver = { 662struct platform_driver vidi_driver = {
685 .probe = vidi_probe, 663 .probe = vidi_probe,
686 .remove = __devexit_p(vidi_remove), 664 .remove = vidi_remove,
687 .driver = { 665 .driver = {
688 .name = "exynos-drm-vidi", 666 .name = "exynos-drm-vidi",
689 .owner = THIS_MODULE, 667 .owner = THIS_MODULE,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.h b/drivers/gpu/drm/exynos/exynos_drm_vidi.h
index a4babe4e65d7..1e5fdaa36ccc 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_vidi.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.h
@@ -3,24 +3,10 @@
3 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 * Author: Inki Dae <inki.dae@samsung.com> 4 * Author: Inki Dae <inki.dae@samsung.com>
5 * 5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a 6 * This program is free software; you can redistribute it and/or modify it
7 * copy of this software and associated documentation files (the "Software"), 7 * under the terms of the GNU General Public License as published by the
8 * to deal in the Software without restriction, including without limitation 8 * Free Software Foundation; either version 2 of the License, or (at your
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * option) any later version.
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
15 * Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */ 10 */
25 11
26#ifndef _EXYNOS_DRM_VIDI_H_ 12#ifndef _EXYNOS_DRM_VIDI_H_
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 2c46b6c0b82c..fbab3c468603 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -34,7 +34,6 @@
34#include <linux/regulator/consumer.h> 34#include <linux/regulator/consumer.h>
35#include <linux/io.h> 35#include <linux/io.h>
36#include <linux/of_gpio.h> 36#include <linux/of_gpio.h>
37#include <plat/gpio-cfg.h>
38 37
39#include <drm/exynos_drm.h> 38#include <drm/exynos_drm.h>
40 39
@@ -98,8 +97,7 @@ struct hdmi_context {
98 97
99 void __iomem *regs; 98 void __iomem *regs;
100 void *parent_ctx; 99 void *parent_ctx;
101 int external_irq; 100 int irq;
102 int internal_irq;
103 101
104 struct i2c_client *ddc_port; 102 struct i2c_client *ddc_port;
105 struct i2c_client *hdmiphy_port; 103 struct i2c_client *hdmiphy_port;
@@ -1391,8 +1389,7 @@ static bool hdmi_is_connected(void *ctx)
1391 return hdata->hpd; 1389 return hdata->hpd;
1392} 1390}
1393 1391
1394static int hdmi_get_edid(void *ctx, struct drm_connector *connector, 1392static struct edid *hdmi_get_edid(void *ctx, struct drm_connector *connector)
1395 u8 *edid, int len)
1396{ 1393{
1397 struct edid *raw_edid; 1394 struct edid *raw_edid;
1398 struct hdmi_context *hdata = ctx; 1395 struct hdmi_context *hdata = ctx;
@@ -1400,22 +1397,18 @@ static int hdmi_get_edid(void *ctx, struct drm_connector *connector,
1400 DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); 1397 DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
1401 1398
1402 if (!hdata->ddc_port) 1399 if (!hdata->ddc_port)
1403 return -ENODEV; 1400 return ERR_PTR(-ENODEV);
1404 1401
1405 raw_edid = drm_get_edid(connector, hdata->ddc_port->adapter); 1402 raw_edid = drm_get_edid(connector, hdata->ddc_port->adapter);
1406 if (raw_edid) { 1403 if (!raw_edid)
1407 hdata->dvi_mode = !drm_detect_hdmi_monitor(raw_edid); 1404 return ERR_PTR(-ENODEV);
1408 memcpy(edid, raw_edid, min((1 + raw_edid->extensions)
1409 * EDID_LENGTH, len));
1410 DRM_DEBUG_KMS("%s : width[%d] x height[%d]\n",
1411 (hdata->dvi_mode ? "dvi monitor" : "hdmi monitor"),
1412 raw_edid->width_cm, raw_edid->height_cm);
1413 kfree(raw_edid);
1414 } else {
1415 return -ENODEV;
1416 }
1417 1405
1418 return 0; 1406 hdata->dvi_mode = !drm_detect_hdmi_monitor(raw_edid);
1407 DRM_DEBUG_KMS("%s : width[%d] x height[%d]\n",
1408 (hdata->dvi_mode ? "dvi monitor" : "hdmi monitor"),
1409 raw_edid->width_cm, raw_edid->height_cm);
1410
1411 return raw_edid;
1419} 1412}
1420 1413
1421static int hdmi_v13_check_timing(struct fb_videomode *check_timing) 1414static int hdmi_v13_check_timing(struct fb_videomode *check_timing)
@@ -1652,16 +1645,16 @@ static void hdmi_conf_reset(struct hdmi_context *hdata)
1652 1645
1653 /* resetting HDMI core */ 1646 /* resetting HDMI core */
1654 hdmi_reg_writemask(hdata, reg, 0, HDMI_CORE_SW_RSTOUT); 1647 hdmi_reg_writemask(hdata, reg, 0, HDMI_CORE_SW_RSTOUT);
1655 mdelay(10); 1648 usleep_range(10000, 12000);
1656 hdmi_reg_writemask(hdata, reg, ~0, HDMI_CORE_SW_RSTOUT); 1649 hdmi_reg_writemask(hdata, reg, ~0, HDMI_CORE_SW_RSTOUT);
1657 mdelay(10); 1650 usleep_range(10000, 12000);
1658} 1651}
1659 1652
1660static void hdmi_conf_init(struct hdmi_context *hdata) 1653static void hdmi_conf_init(struct hdmi_context *hdata)
1661{ 1654{
1662 struct hdmi_infoframe infoframe; 1655 struct hdmi_infoframe infoframe;
1663 1656
1664 /* disable HPD interrupts */ 1657 /* disable HPD interrupts from HDMI IP block, use GPIO instead */
1665 hdmi_reg_writemask(hdata, HDMI_INTC_CON, 0, HDMI_INTC_EN_GLOBAL | 1658 hdmi_reg_writemask(hdata, HDMI_INTC_CON, 0, HDMI_INTC_EN_GLOBAL |
1666 HDMI_INTC_EN_HPD_PLUG | HDMI_INTC_EN_HPD_UNPLUG); 1659 HDMI_INTC_EN_HPD_PLUG | HDMI_INTC_EN_HPD_UNPLUG);
1667 1660
@@ -1779,7 +1772,7 @@ static void hdmi_v13_timing_apply(struct hdmi_context *hdata)
1779 u32 val = hdmi_reg_read(hdata, HDMI_V13_PHY_STATUS); 1772 u32 val = hdmi_reg_read(hdata, HDMI_V13_PHY_STATUS);
1780 if (val & HDMI_PHY_STATUS_READY) 1773 if (val & HDMI_PHY_STATUS_READY)
1781 break; 1774 break;
1782 mdelay(1); 1775 usleep_range(1000, 2000);
1783 } 1776 }
1784 /* steady state not achieved */ 1777 /* steady state not achieved */
1785 if (tries == 0) { 1778 if (tries == 0) {
@@ -1946,7 +1939,7 @@ static void hdmi_v14_timing_apply(struct hdmi_context *hdata)
1946 u32 val = hdmi_reg_read(hdata, HDMI_PHY_STATUS_0); 1939 u32 val = hdmi_reg_read(hdata, HDMI_PHY_STATUS_0);
1947 if (val & HDMI_PHY_STATUS_READY) 1940 if (val & HDMI_PHY_STATUS_READY)
1948 break; 1941 break;
1949 mdelay(1); 1942 usleep_range(1000, 2000);
1950 } 1943 }
1951 /* steady state not achieved */ 1944 /* steady state not achieved */
1952 if (tries == 0) { 1945 if (tries == 0) {
@@ -1998,9 +1991,9 @@ static void hdmiphy_conf_reset(struct hdmi_context *hdata)
1998 1991
1999 /* reset hdmiphy */ 1992 /* reset hdmiphy */
2000 hdmi_reg_writemask(hdata, reg, ~0, HDMI_PHY_SW_RSTOUT); 1993 hdmi_reg_writemask(hdata, reg, ~0, HDMI_PHY_SW_RSTOUT);
2001 mdelay(10); 1994 usleep_range(10000, 12000);
2002 hdmi_reg_writemask(hdata, reg, 0, HDMI_PHY_SW_RSTOUT); 1995 hdmi_reg_writemask(hdata, reg, 0, HDMI_PHY_SW_RSTOUT);
2003 mdelay(10); 1996 usleep_range(10000, 12000);
2004} 1997}
2005 1998
2006static void hdmiphy_poweron(struct hdmi_context *hdata) 1999static void hdmiphy_poweron(struct hdmi_context *hdata)
@@ -2048,7 +2041,7 @@ static void hdmiphy_conf_apply(struct hdmi_context *hdata)
2048 return; 2041 return;
2049 } 2042 }
2050 2043
2051 mdelay(10); 2044 usleep_range(10000, 12000);
2052 2045
2053 /* operation mode */ 2046 /* operation mode */
2054 operation[0] = 0x1f; 2047 operation[0] = 0x1f;
@@ -2170,6 +2163,13 @@ static void hdmi_commit(void *ctx)
2170 2163
2171 DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); 2164 DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
2172 2165
2166 mutex_lock(&hdata->hdmi_mutex);
2167 if (!hdata->powered) {
2168 mutex_unlock(&hdata->hdmi_mutex);
2169 return;
2170 }
2171 mutex_unlock(&hdata->hdmi_mutex);
2172
2173 hdmi_conf_apply(hdata); 2173 hdmi_conf_apply(hdata);
2174} 2174}
2175 2175
@@ -2265,7 +2265,7 @@ static struct exynos_hdmi_ops hdmi_ops = {
2265 .dpms = hdmi_dpms, 2265 .dpms = hdmi_dpms,
2266}; 2266};
2267 2267
2268static irqreturn_t hdmi_external_irq_thread(int irq, void *arg) 2268static irqreturn_t hdmi_irq_thread(int irq, void *arg)
2269{ 2269{
2270 struct exynos_drm_hdmi_context *ctx = arg; 2270 struct exynos_drm_hdmi_context *ctx = arg;
2271 struct hdmi_context *hdata = ctx->ctx; 2271 struct hdmi_context *hdata = ctx->ctx;
@@ -2280,32 +2280,7 @@ static irqreturn_t hdmi_external_irq_thread(int irq, void *arg)
2280 return IRQ_HANDLED; 2280 return IRQ_HANDLED;
2281} 2281}
2282 2282
2283static irqreturn_t hdmi_internal_irq_thread(int irq, void *arg) 2283static int hdmi_resources_init(struct hdmi_context *hdata)
2284{
2285 struct exynos_drm_hdmi_context *ctx = arg;
2286 struct hdmi_context *hdata = ctx->ctx;
2287 u32 intc_flag;
2288
2289 intc_flag = hdmi_reg_read(hdata, HDMI_INTC_FLAG);
2290 /* clearing flags for HPD plug/unplug */
2291 if (intc_flag & HDMI_INTC_FLAG_HPD_UNPLUG) {
2292 DRM_DEBUG_KMS("unplugged\n");
2293 hdmi_reg_writemask(hdata, HDMI_INTC_FLAG, ~0,
2294 HDMI_INTC_FLAG_HPD_UNPLUG);
2295 }
2296 if (intc_flag & HDMI_INTC_FLAG_HPD_PLUG) {
2297 DRM_DEBUG_KMS("plugged\n");
2298 hdmi_reg_writemask(hdata, HDMI_INTC_FLAG, ~0,
2299 HDMI_INTC_FLAG_HPD_PLUG);
2300 }
2301
2302 if (ctx->drm_dev)
2303 drm_helper_hpd_irq_event(ctx->drm_dev);
2304
2305 return IRQ_HANDLED;
2306}
2307
2308static int __devinit hdmi_resources_init(struct hdmi_context *hdata)
2309{ 2284{
2310 struct device *dev = hdata->dev; 2285 struct device *dev = hdata->dev;
2311 struct hdmi_resources *res = &hdata->res; 2286 struct hdmi_resources *res = &hdata->res;
@@ -2451,7 +2426,7 @@ static struct of_device_id hdmi_match_types[] = {
2451}; 2426};
2452#endif 2427#endif
2453 2428
2454static int __devinit hdmi_probe(struct platform_device *pdev) 2429static int hdmi_probe(struct platform_device *pdev)
2455{ 2430{
2456 struct device *dev = &pdev->dev; 2431 struct device *dev = &pdev->dev;
2457 struct exynos_drm_hdmi_context *drm_hdmi_ctx; 2432 struct exynos_drm_hdmi_context *drm_hdmi_ctx;
@@ -2555,39 +2530,24 @@ static int __devinit hdmi_probe(struct platform_device *pdev)
2555 2530
2556 hdata->hdmiphy_port = hdmi_hdmiphy; 2531 hdata->hdmiphy_port = hdmi_hdmiphy;
2557 2532
2558 hdata->external_irq = gpio_to_irq(hdata->hpd_gpio); 2533 hdata->irq = gpio_to_irq(hdata->hpd_gpio);
2559 if (hdata->external_irq < 0) { 2534 if (hdata->irq < 0) {
2560 DRM_ERROR("failed to get GPIO external irq\n"); 2535 DRM_ERROR("failed to get GPIO irq\n");
2561 ret = hdata->external_irq; 2536 ret = hdata->irq;
2562 goto err_hdmiphy;
2563 }
2564
2565 hdata->internal_irq = platform_get_irq(pdev, 0);
2566 if (hdata->internal_irq < 0) {
2567 DRM_ERROR("failed to get platform internal irq\n");
2568 ret = hdata->internal_irq;
2569 goto err_hdmiphy; 2537 goto err_hdmiphy;
2570 } 2538 }
2571 2539
2572 hdata->hpd = gpio_get_value(hdata->hpd_gpio); 2540 hdata->hpd = gpio_get_value(hdata->hpd_gpio);
2573 2541
2574 ret = request_threaded_irq(hdata->external_irq, NULL, 2542 ret = request_threaded_irq(hdata->irq, NULL,
2575 hdmi_external_irq_thread, IRQF_TRIGGER_RISING | 2543 hdmi_irq_thread, IRQF_TRIGGER_RISING |
2576 IRQF_TRIGGER_FALLING | IRQF_ONESHOT, 2544 IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
2577 "hdmi_external", drm_hdmi_ctx); 2545 "hdmi", drm_hdmi_ctx);
2578 if (ret) { 2546 if (ret) {
2579 DRM_ERROR("failed to register hdmi external interrupt\n"); 2547 DRM_ERROR("failed to register hdmi interrupt\n");
2580 goto err_hdmiphy; 2548 goto err_hdmiphy;
2581 } 2549 }
2582 2550
2583 ret = request_threaded_irq(hdata->internal_irq, NULL,
2584 hdmi_internal_irq_thread, IRQF_ONESHOT,
2585 "hdmi_internal", drm_hdmi_ctx);
2586 if (ret) {
2587 DRM_ERROR("failed to register hdmi internal interrupt\n");
2588 goto err_free_irq;
2589 }
2590
2591 /* Attach HDMI Driver to common hdmi. */ 2551 /* Attach HDMI Driver to common hdmi. */
2592 exynos_hdmi_drv_attach(drm_hdmi_ctx); 2552 exynos_hdmi_drv_attach(drm_hdmi_ctx);
2593 2553
@@ -2598,8 +2558,6 @@ static int __devinit hdmi_probe(struct platform_device *pdev)
2598 2558
2599 return 0; 2559 return 0;
2600 2560
2601err_free_irq:
2602 free_irq(hdata->external_irq, drm_hdmi_ctx);
2603err_hdmiphy: 2561err_hdmiphy:
2604 i2c_del_driver(&hdmiphy_driver); 2562 i2c_del_driver(&hdmiphy_driver);
2605err_ddc: 2563err_ddc:
@@ -2607,7 +2565,7 @@ err_ddc:
2607 return ret; 2565 return ret;
2608} 2566}
2609 2567
2610static int __devexit hdmi_remove(struct platform_device *pdev) 2568static int hdmi_remove(struct platform_device *pdev)
2611{ 2569{
2612 struct device *dev = &pdev->dev; 2570 struct device *dev = &pdev->dev;
2613 struct exynos_drm_hdmi_context *ctx = platform_get_drvdata(pdev); 2571 struct exynos_drm_hdmi_context *ctx = platform_get_drvdata(pdev);
@@ -2617,8 +2575,7 @@ static int __devexit hdmi_remove(struct platform_device *pdev)
2617 2575
2618 pm_runtime_disable(dev); 2576 pm_runtime_disable(dev);
2619 2577
2620 free_irq(hdata->internal_irq, hdata); 2578 free_irq(hdata->irq, hdata);
2621 free_irq(hdata->external_irq, hdata);
2622 2579
2623 2580
2624 /* hdmiphy i2c driver */ 2581 /* hdmiphy i2c driver */
@@ -2637,8 +2594,7 @@ static int hdmi_suspend(struct device *dev)
2637 2594
2638 DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); 2595 DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
2639 2596
2640 disable_irq(hdata->internal_irq); 2597 disable_irq(hdata->irq);
2641 disable_irq(hdata->external_irq);
2642 2598
2643 hdata->hpd = false; 2599 hdata->hpd = false;
2644 if (ctx->drm_dev) 2600 if (ctx->drm_dev)
@@ -2663,8 +2619,7 @@ static int hdmi_resume(struct device *dev)
2663 2619
2664 hdata->hpd = gpio_get_value(hdata->hpd_gpio); 2620 hdata->hpd = gpio_get_value(hdata->hpd_gpio);
2665 2621
2666 enable_irq(hdata->external_irq); 2622 enable_irq(hdata->irq);
2667 enable_irq(hdata->internal_irq);
2668 2623
2669 if (!pm_runtime_suspended(dev)) { 2624 if (!pm_runtime_suspended(dev)) {
2670 DRM_DEBUG_KMS("%s : Already resumed\n", __func__); 2625 DRM_DEBUG_KMS("%s : Already resumed\n", __func__);
@@ -2708,7 +2663,7 @@ static const struct dev_pm_ops hdmi_pm_ops = {
2708 2663
2709struct platform_driver hdmi_driver = { 2664struct platform_driver hdmi_driver = {
2710 .probe = hdmi_probe, 2665 .probe = hdmi_probe,
2711 .remove = __devexit_p(hdmi_remove), 2666 .remove = hdmi_remove,
2712 .id_table = hdmi_driver_types, 2667 .id_table = hdmi_driver_types,
2713 .driver = { 2668 .driver = {
2714 .name = "exynos-hdmi", 2669 .name = "exynos-hdmi",
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.h b/drivers/gpu/drm/exynos/exynos_hdmi.h
index 1c3b6d8f1fe7..0ddf3957de15 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.h
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.h
@@ -5,24 +5,10 @@
5 * Inki Dae <inki.dae@samsung.com> 5 * Inki Dae <inki.dae@samsung.com>
6 * Seung-Woo Kim <sw0312.kim@samsung.com> 6 * Seung-Woo Kim <sw0312.kim@samsung.com>
7 * 7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a 8 * This program is free software; you can redistribute it and/or modify it
9 * copy of this software and associated documentation files (the "Software"), 9 * under the terms of the GNU General Public License as published by the
10 * to deal in the Software without restriction, including without limitation 10 * Free Software Foundation; either version 2 of the License, or (at your
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 * option) any later version.
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice (including the next
16 * paragraph) shall be included in all copies or substantial portions of the
17 * Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 * OTHER DEALINGS IN THE SOFTWARE.
26 */ 12 */
27 13
28#ifndef _EXYNOS_HDMI_H_ 14#ifndef _EXYNOS_HDMI_H_
diff --git a/drivers/gpu/drm/exynos/exynos_hdmiphy.c b/drivers/gpu/drm/exynos/exynos_hdmiphy.c
index 6206056f4a33..ea49d132ecf6 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmiphy.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmiphy.c
@@ -64,7 +64,7 @@ struct i2c_driver hdmiphy_driver = {
64 }, 64 },
65 .id_table = hdmiphy_id, 65 .id_table = hdmiphy_id,
66 .probe = hdmiphy_probe, 66 .probe = hdmiphy_probe,
67 .remove = __devexit_p(hdmiphy_remove), 67 .remove = hdmiphy_remove,
68 .command = NULL, 68 .command = NULL,
69}; 69};
70EXPORT_SYMBOL(hdmiphy_driver); 70EXPORT_SYMBOL(hdmiphy_driver);
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index 21db89530fc7..c414584bfbae 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -35,6 +35,7 @@
35#include <drm/exynos_drm.h> 35#include <drm/exynos_drm.h>
36 36
37#include "exynos_drm_drv.h" 37#include "exynos_drm_drv.h"
38#include "exynos_drm_crtc.h"
38#include "exynos_drm_hdmi.h" 39#include "exynos_drm_hdmi.h"
39#include "exynos_drm_iommu.h" 40#include "exynos_drm_iommu.h"
40 41
@@ -599,7 +600,7 @@ static void vp_win_reset(struct mixer_context *ctx)
599 /* waiting until VP_SRESET_PROCESSING is 0 */ 600 /* waiting until VP_SRESET_PROCESSING is 0 */
600 if (~vp_reg_read(res, VP_SRESET) & VP_SRESET_PROCESSING) 601 if (~vp_reg_read(res, VP_SRESET) & VP_SRESET_PROCESSING)
601 break; 602 break;
602 mdelay(10); 603 usleep_range(10000, 12000);
603 } 604 }
604 WARN(tries == 0, "failed to reset Video Processor\n"); 605 WARN(tries == 0, "failed to reset Video Processor\n");
605} 606}
@@ -775,6 +776,13 @@ static void mixer_win_commit(void *ctx, int win)
775 776
776 DRM_DEBUG_KMS("[%d] %s, win: %d\n", __LINE__, __func__, win); 777 DRM_DEBUG_KMS("[%d] %s, win: %d\n", __LINE__, __func__, win);
777 778
779 mutex_lock(&mixer_ctx->mixer_mutex);
780 if (!mixer_ctx->powered) {
781 mutex_unlock(&mixer_ctx->mixer_mutex);
782 return;
783 }
784 mutex_unlock(&mixer_ctx->mixer_mutex);
785
778 if (win > 1 && mixer_ctx->vp_enabled) 786 if (win > 1 && mixer_ctx->vp_enabled)
779 vp_video_buffer(mixer_ctx, win); 787 vp_video_buffer(mixer_ctx, win);
780 else 788 else
@@ -949,35 +957,6 @@ static struct exynos_mixer_ops mixer_ops = {
949 .win_disable = mixer_win_disable, 957 .win_disable = mixer_win_disable,
950}; 958};
951 959
952/* for pageflip event */
953static void mixer_finish_pageflip(struct drm_device *drm_dev, int crtc)
954{
955 struct exynos_drm_private *dev_priv = drm_dev->dev_private;
956 struct drm_pending_vblank_event *e, *t;
957 struct timeval now;
958 unsigned long flags;
959
960 spin_lock_irqsave(&drm_dev->event_lock, flags);
961
962 list_for_each_entry_safe(e, t, &dev_priv->pageflip_event_list,
963 base.link) {
964 /* if event's pipe isn't same as crtc then ignore it. */
965 if (crtc != e->pipe)
966 continue;
967
968 do_gettimeofday(&now);
969 e->event.sequence = 0;
970 e->event.tv_sec = now.tv_sec;
971 e->event.tv_usec = now.tv_usec;
972
973 list_move_tail(&e->base.link, &e->base.file_priv->event_list);
974 wake_up_interruptible(&e->base.file_priv->event_wait);
975 drm_vblank_put(drm_dev, crtc);
976 }
977
978 spin_unlock_irqrestore(&drm_dev->event_lock, flags);
979}
980
981static irqreturn_t mixer_irq_handler(int irq, void *arg) 960static irqreturn_t mixer_irq_handler(int irq, void *arg)
982{ 961{
983 struct exynos_drm_hdmi_context *drm_hdmi_ctx = arg; 962 struct exynos_drm_hdmi_context *drm_hdmi_ctx = arg;
@@ -1006,7 +985,8 @@ static irqreturn_t mixer_irq_handler(int irq, void *arg)
1006 } 985 }
1007 986
1008 drm_handle_vblank(drm_hdmi_ctx->drm_dev, ctx->pipe); 987 drm_handle_vblank(drm_hdmi_ctx->drm_dev, ctx->pipe);
1009 mixer_finish_pageflip(drm_hdmi_ctx->drm_dev, ctx->pipe); 988 exynos_drm_crtc_finish_pageflip(drm_hdmi_ctx->drm_dev,
989 ctx->pipe);
1010 990
1011 /* set wait vsync event to zero and wake up queue. */ 991 /* set wait vsync event to zero and wake up queue. */
1012 if (atomic_read(&ctx->wait_vsync_event)) { 992 if (atomic_read(&ctx->wait_vsync_event)) {
@@ -1029,8 +1009,8 @@ out:
1029 return IRQ_HANDLED; 1009 return IRQ_HANDLED;
1030} 1010}
1031 1011
1032static int __devinit mixer_resources_init(struct exynos_drm_hdmi_context *ctx, 1012static int mixer_resources_init(struct exynos_drm_hdmi_context *ctx,
1033 struct platform_device *pdev) 1013 struct platform_device *pdev)
1034{ 1014{
1035 struct mixer_context *mixer_ctx = ctx->ctx; 1015 struct mixer_context *mixer_ctx = ctx->ctx;
1036 struct device *dev = &pdev->dev; 1016 struct device *dev = &pdev->dev;
@@ -1081,8 +1061,8 @@ static int __devinit mixer_resources_init(struct exynos_drm_hdmi_context *ctx,
1081 return 0; 1061 return 0;
1082} 1062}
1083 1063
1084static int __devinit vp_resources_init(struct exynos_drm_hdmi_context *ctx, 1064static int vp_resources_init(struct exynos_drm_hdmi_context *ctx,
1085 struct platform_device *pdev) 1065 struct platform_device *pdev)
1086{ 1066{
1087 struct mixer_context *mixer_ctx = ctx->ctx; 1067 struct mixer_context *mixer_ctx = ctx->ctx;
1088 struct device *dev = &pdev->dev; 1068 struct device *dev = &pdev->dev;
@@ -1155,7 +1135,7 @@ static struct of_device_id mixer_match_types[] = {
1155 } 1135 }
1156}; 1136};
1157 1137
1158static int __devinit mixer_probe(struct platform_device *pdev) 1138static int mixer_probe(struct platform_device *pdev)
1159{ 1139{
1160 struct device *dev = &pdev->dev; 1140 struct device *dev = &pdev->dev;
1161 struct exynos_drm_hdmi_context *drm_hdmi_ctx; 1141 struct exynos_drm_hdmi_context *drm_hdmi_ctx;
@@ -1316,6 +1296,6 @@ struct platform_driver mixer_driver = {
1316 .of_match_table = mixer_match_types, 1296 .of_match_table = mixer_match_types,
1317 }, 1297 },
1318 .probe = mixer_probe, 1298 .probe = mixer_probe,
1319 .remove = __devexit_p(mixer_remove), 1299 .remove = mixer_remove,
1320 .id_table = mixer_driver_types, 1300 .id_table = mixer_driver_types,
1321}; 1301};
diff --git a/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c b/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c
index 4a07ab596174..771ff66711af 100644
--- a/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c
+++ b/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c
@@ -700,7 +700,7 @@ static struct i2c_driver tc35876x_bridge_i2c_driver = {
700 }, 700 },
701 .id_table = tc35876x_bridge_id, 701 .id_table = tc35876x_bridge_id,
702 .probe = tc35876x_bridge_probe, 702 .probe = tc35876x_bridge_probe,
703 .remove = __devexit_p(tc35876x_bridge_remove), 703 .remove = tc35876x_bridge_remove,
704}; 704};
705 705
706/* LCD panel I2C */ 706/* LCD panel I2C */
@@ -741,7 +741,7 @@ static struct i2c_driver cmi_lcd_i2c_driver = {
741 }, 741 },
742 .id_table = cmi_lcd_i2c_id, 742 .id_table = cmi_lcd_i2c_id,
743 .probe = cmi_lcd_i2c_probe, 743 .probe = cmi_lcd_i2c_probe,
744 .remove = __devexit_p(cmi_lcd_i2c_remove), 744 .remove = cmi_lcd_i2c_remove,
745}; 745};
746 746
747/* HACK to create I2C device while it's not created by platform code */ 747/* HACK to create I2C device while it's not created by platform code */
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index e6a11ca85eaf..9d4a2c2adf0e 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -30,6 +30,7 @@
30#include <linux/debugfs.h> 30#include <linux/debugfs.h>
31#include <linux/slab.h> 31#include <linux/slab.h>
32#include <linux/export.h> 32#include <linux/export.h>
33#include <generated/utsrelease.h>
33#include <drm/drmP.h> 34#include <drm/drmP.h>
34#include "intel_drv.h" 35#include "intel_drv.h"
35#include "intel_ringbuffer.h" 36#include "intel_ringbuffer.h"
@@ -641,6 +642,7 @@ static void i915_ring_error_state(struct seq_file *m,
641 seq_printf(m, "%s command stream:\n", ring_str(ring)); 642 seq_printf(m, "%s command stream:\n", ring_str(ring));
642 seq_printf(m, " HEAD: 0x%08x\n", error->head[ring]); 643 seq_printf(m, " HEAD: 0x%08x\n", error->head[ring]);
643 seq_printf(m, " TAIL: 0x%08x\n", error->tail[ring]); 644 seq_printf(m, " TAIL: 0x%08x\n", error->tail[ring]);
645 seq_printf(m, " CTL: 0x%08x\n", error->ctl[ring]);
644 seq_printf(m, " ACTHD: 0x%08x\n", error->acthd[ring]); 646 seq_printf(m, " ACTHD: 0x%08x\n", error->acthd[ring]);
645 seq_printf(m, " IPEIR: 0x%08x\n", error->ipeir[ring]); 647 seq_printf(m, " IPEIR: 0x%08x\n", error->ipeir[ring]);
646 seq_printf(m, " IPEHR: 0x%08x\n", error->ipehr[ring]); 648 seq_printf(m, " IPEHR: 0x%08x\n", error->ipehr[ring]);
@@ -689,10 +691,13 @@ static int i915_error_state(struct seq_file *m, void *unused)
689 691
690 seq_printf(m, "Time: %ld s %ld us\n", error->time.tv_sec, 692 seq_printf(m, "Time: %ld s %ld us\n", error->time.tv_sec,
691 error->time.tv_usec); 693 error->time.tv_usec);
694 seq_printf(m, "Kernel: " UTS_RELEASE);
692 seq_printf(m, "PCI ID: 0x%04x\n", dev->pci_device); 695 seq_printf(m, "PCI ID: 0x%04x\n", dev->pci_device);
693 seq_printf(m, "EIR: 0x%08x\n", error->eir); 696 seq_printf(m, "EIR: 0x%08x\n", error->eir);
694 seq_printf(m, "IER: 0x%08x\n", error->ier); 697 seq_printf(m, "IER: 0x%08x\n", error->ier);
695 seq_printf(m, "PGTBL_ER: 0x%08x\n", error->pgtbl_er); 698 seq_printf(m, "PGTBL_ER: 0x%08x\n", error->pgtbl_er);
699 seq_printf(m, "FORCEWAKE: 0x%08x\n", error->forcewake);
700 seq_printf(m, "DERRMR: 0x%08x\n", error->derrmr);
696 seq_printf(m, "CCID: 0x%08x\n", error->ccid); 701 seq_printf(m, "CCID: 0x%08x\n", error->ccid);
697 702
698 for (i = 0; i < dev_priv->num_fence_regs; i++) 703 for (i = 0; i < dev_priv->num_fence_regs; i++)
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 8f63cd5de4b4..99daa896105d 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -989,6 +989,9 @@ static int i915_getparam(struct drm_device *dev, void *data,
989 case I915_PARAM_HAS_SECURE_BATCHES: 989 case I915_PARAM_HAS_SECURE_BATCHES:
990 value = capable(CAP_SYS_ADMIN); 990 value = capable(CAP_SYS_ADMIN);
991 break; 991 break;
992 case I915_PARAM_HAS_PINNED_BATCHES:
993 value = 1;
994 break;
992 default: 995 default:
993 DRM_DEBUG_DRIVER("Unknown parameter %d\n", 996 DRM_DEBUG_DRIVER("Unknown parameter %d\n",
994 param->param); 997 param->param);
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 530db83ef320..117265840b1f 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -877,8 +877,7 @@ int i915_reset(struct drm_device *dev)
877 return 0; 877 return 0;
878} 878}
879 879
880static int __devinit 880static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
881i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
882{ 881{
883 struct intel_device_info *intel_info = 882 struct intel_device_info *intel_info =
884 (struct intel_device_info *) ent->driver_data; 883 (struct intel_device_info *) ent->driver_data;
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 557843dd4b2e..12ab3bdea54d 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -188,10 +188,13 @@ struct drm_i915_error_state {
188 u32 pgtbl_er; 188 u32 pgtbl_er;
189 u32 ier; 189 u32 ier;
190 u32 ccid; 190 u32 ccid;
191 u32 derrmr;
192 u32 forcewake;
191 bool waiting[I915_NUM_RINGS]; 193 bool waiting[I915_NUM_RINGS];
192 u32 pipestat[I915_MAX_PIPES]; 194 u32 pipestat[I915_MAX_PIPES];
193 u32 tail[I915_NUM_RINGS]; 195 u32 tail[I915_NUM_RINGS];
194 u32 head[I915_NUM_RINGS]; 196 u32 head[I915_NUM_RINGS];
197 u32 ctl[I915_NUM_RINGS];
195 u32 ipeir[I915_NUM_RINGS]; 198 u32 ipeir[I915_NUM_RINGS];
196 u32 ipehr[I915_NUM_RINGS]; 199 u32 ipehr[I915_NUM_RINGS];
197 u32 instdone[I915_NUM_RINGS]; 200 u32 instdone[I915_NUM_RINGS];
@@ -780,6 +783,7 @@ typedef struct drm_i915_private {
780 struct i915_hw_ppgtt *aliasing_ppgtt; 783 struct i915_hw_ppgtt *aliasing_ppgtt;
781 784
782 struct shrinker inactive_shrinker; 785 struct shrinker inactive_shrinker;
786 bool shrinker_no_lock_stealing;
783 787
784 /** 788 /**
785 * List of objects currently involved in rendering. 789 * List of objects currently involved in rendering.
@@ -1100,6 +1104,7 @@ struct drm_i915_gem_object {
1100 */ 1104 */
1101 atomic_t pending_flip; 1105 atomic_t pending_flip;
1102}; 1106};
1107#define to_gem_object(obj) (&((struct drm_i915_gem_object *)(obj))->base)
1103 1108
1104#define to_intel_bo(x) container_of(x, struct drm_i915_gem_object, base) 1109#define to_intel_bo(x) container_of(x, struct drm_i915_gem_object, base)
1105 1110
@@ -1166,6 +1171,9 @@ struct drm_i915_file_private {
1166#define IS_IVB_GT1(dev) ((dev)->pci_device == 0x0156 || \ 1171#define IS_IVB_GT1(dev) ((dev)->pci_device == 0x0156 || \
1167 (dev)->pci_device == 0x0152 || \ 1172 (dev)->pci_device == 0x0152 || \
1168 (dev)->pci_device == 0x015a) 1173 (dev)->pci_device == 0x015a)
1174#define IS_SNB_GT1(dev) ((dev)->pci_device == 0x0102 || \
1175 (dev)->pci_device == 0x0106 || \
1176 (dev)->pci_device == 0x010A)
1169#define IS_VALLEYVIEW(dev) (INTEL_INFO(dev)->is_valleyview) 1177#define IS_VALLEYVIEW(dev) (INTEL_INFO(dev)->is_valleyview)
1170#define IS_HASWELL(dev) (INTEL_INFO(dev)->is_haswell) 1178#define IS_HASWELL(dev) (INTEL_INFO(dev)->is_haswell)
1171#define IS_MOBILE(dev) (INTEL_INFO(dev)->is_mobile) 1179#define IS_MOBILE(dev) (INTEL_INFO(dev)->is_mobile)
@@ -1196,6 +1204,9 @@ struct drm_i915_file_private {
1196#define HAS_OVERLAY(dev) (INTEL_INFO(dev)->has_overlay) 1204#define HAS_OVERLAY(dev) (INTEL_INFO(dev)->has_overlay)
1197#define OVERLAY_NEEDS_PHYSICAL(dev) (INTEL_INFO(dev)->overlay_needs_physical) 1205#define OVERLAY_NEEDS_PHYSICAL(dev) (INTEL_INFO(dev)->overlay_needs_physical)
1198 1206
1207/* Early gen2 have a totally busted CS tlb and require pinned batches. */
1208#define HAS_BROKEN_CS_TLB(dev) (IS_I830(dev) || IS_845G(dev))
1209
1199/* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte 1210/* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte
1200 * rows, which changed the alignment requirements and fence programming. 1211 * rows, which changed the alignment requirements and fence programming.
1201 */ 1212 */
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 742206e45103..8febea6daa08 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1517,9 +1517,11 @@ static int i915_gem_object_create_mmap_offset(struct drm_i915_gem_object *obj)
1517 if (obj->base.map_list.map) 1517 if (obj->base.map_list.map)
1518 return 0; 1518 return 0;
1519 1519
1520 dev_priv->mm.shrinker_no_lock_stealing = true;
1521
1520 ret = drm_gem_create_mmap_offset(&obj->base); 1522 ret = drm_gem_create_mmap_offset(&obj->base);
1521 if (ret != -ENOSPC) 1523 if (ret != -ENOSPC)
1522 return ret; 1524 goto out;
1523 1525
1524 /* Badly fragmented mmap space? The only way we can recover 1526 /* Badly fragmented mmap space? The only way we can recover
1525 * space is by destroying unwanted objects. We can't randomly release 1527 * space is by destroying unwanted objects. We can't randomly release
@@ -1531,10 +1533,14 @@ static int i915_gem_object_create_mmap_offset(struct drm_i915_gem_object *obj)
1531 i915_gem_purge(dev_priv, obj->base.size >> PAGE_SHIFT); 1533 i915_gem_purge(dev_priv, obj->base.size >> PAGE_SHIFT);
1532 ret = drm_gem_create_mmap_offset(&obj->base); 1534 ret = drm_gem_create_mmap_offset(&obj->base);
1533 if (ret != -ENOSPC) 1535 if (ret != -ENOSPC)
1534 return ret; 1536 goto out;
1535 1537
1536 i915_gem_shrink_all(dev_priv); 1538 i915_gem_shrink_all(dev_priv);
1537 return drm_gem_create_mmap_offset(&obj->base); 1539 ret = drm_gem_create_mmap_offset(&obj->base);
1540out:
1541 dev_priv->mm.shrinker_no_lock_stealing = false;
1542
1543 return ret;
1538} 1544}
1539 1545
1540static void i915_gem_object_free_mmap_offset(struct drm_i915_gem_object *obj) 1546static void i915_gem_object_free_mmap_offset(struct drm_i915_gem_object *obj)
@@ -1711,7 +1717,8 @@ i915_gem_object_put_pages(struct drm_i915_gem_object *obj)
1711} 1717}
1712 1718
1713static long 1719static long
1714i915_gem_purge(struct drm_i915_private *dev_priv, long target) 1720__i915_gem_shrink(struct drm_i915_private *dev_priv, long target,
1721 bool purgeable_only)
1715{ 1722{
1716 struct drm_i915_gem_object *obj, *next; 1723 struct drm_i915_gem_object *obj, *next;
1717 long count = 0; 1724 long count = 0;
@@ -1719,7 +1726,7 @@ i915_gem_purge(struct drm_i915_private *dev_priv, long target)
1719 list_for_each_entry_safe(obj, next, 1726 list_for_each_entry_safe(obj, next,
1720 &dev_priv->mm.unbound_list, 1727 &dev_priv->mm.unbound_list,
1721 gtt_list) { 1728 gtt_list) {
1722 if (i915_gem_object_is_purgeable(obj) && 1729 if ((i915_gem_object_is_purgeable(obj) || !purgeable_only) &&
1723 i915_gem_object_put_pages(obj) == 0) { 1730 i915_gem_object_put_pages(obj) == 0) {
1724 count += obj->base.size >> PAGE_SHIFT; 1731 count += obj->base.size >> PAGE_SHIFT;
1725 if (count >= target) 1732 if (count >= target)
@@ -1730,7 +1737,7 @@ i915_gem_purge(struct drm_i915_private *dev_priv, long target)
1730 list_for_each_entry_safe(obj, next, 1737 list_for_each_entry_safe(obj, next,
1731 &dev_priv->mm.inactive_list, 1738 &dev_priv->mm.inactive_list,
1732 mm_list) { 1739 mm_list) {
1733 if (i915_gem_object_is_purgeable(obj) && 1740 if ((i915_gem_object_is_purgeable(obj) || !purgeable_only) &&
1734 i915_gem_object_unbind(obj) == 0 && 1741 i915_gem_object_unbind(obj) == 0 &&
1735 i915_gem_object_put_pages(obj) == 0) { 1742 i915_gem_object_put_pages(obj) == 0) {
1736 count += obj->base.size >> PAGE_SHIFT; 1743 count += obj->base.size >> PAGE_SHIFT;
@@ -1742,6 +1749,12 @@ i915_gem_purge(struct drm_i915_private *dev_priv, long target)
1742 return count; 1749 return count;
1743} 1750}
1744 1751
1752static long
1753i915_gem_purge(struct drm_i915_private *dev_priv, long target)
1754{
1755 return __i915_gem_shrink(dev_priv, target, true);
1756}
1757
1745static void 1758static void
1746i915_gem_shrink_all(struct drm_i915_private *dev_priv) 1759i915_gem_shrink_all(struct drm_i915_private *dev_priv)
1747{ 1760{
@@ -2890,7 +2903,7 @@ i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj,
2890{ 2903{
2891 struct drm_device *dev = obj->base.dev; 2904 struct drm_device *dev = obj->base.dev;
2892 drm_i915_private_t *dev_priv = dev->dev_private; 2905 drm_i915_private_t *dev_priv = dev->dev_private;
2893 struct drm_mm_node *free_space; 2906 struct drm_mm_node *node;
2894 u32 size, fence_size, fence_alignment, unfenced_alignment; 2907 u32 size, fence_size, fence_alignment, unfenced_alignment;
2895 bool mappable, fenceable; 2908 bool mappable, fenceable;
2896 int ret; 2909 int ret;
@@ -2936,66 +2949,54 @@ i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj,
2936 2949
2937 i915_gem_object_pin_pages(obj); 2950 i915_gem_object_pin_pages(obj);
2938 2951
2952 node = kzalloc(sizeof(*node), GFP_KERNEL);
2953 if (node == NULL) {
2954 i915_gem_object_unpin_pages(obj);
2955 return -ENOMEM;
2956 }
2957
2939 search_free: 2958 search_free:
2940 if (map_and_fenceable) 2959 if (map_and_fenceable)
2941 free_space = drm_mm_search_free_in_range_color(&dev_priv->mm.gtt_space, 2960 ret = drm_mm_insert_node_in_range_generic(&dev_priv->mm.gtt_space, node,
2942 size, alignment, obj->cache_level, 2961 size, alignment, obj->cache_level,
2943 0, dev_priv->mm.gtt_mappable_end, 2962 0, dev_priv->mm.gtt_mappable_end);
2944 false);
2945 else 2963 else
2946 free_space = drm_mm_search_free_color(&dev_priv->mm.gtt_space, 2964 ret = drm_mm_insert_node_generic(&dev_priv->mm.gtt_space, node,
2947 size, alignment, obj->cache_level, 2965 size, alignment, obj->cache_level);
2948 false); 2966 if (ret) {
2949
2950 if (free_space != NULL) {
2951 if (map_and_fenceable)
2952 free_space =
2953 drm_mm_get_block_range_generic(free_space,
2954 size, alignment, obj->cache_level,
2955 0, dev_priv->mm.gtt_mappable_end,
2956 false);
2957 else
2958 free_space =
2959 drm_mm_get_block_generic(free_space,
2960 size, alignment, obj->cache_level,
2961 false);
2962 }
2963 if (free_space == NULL) {
2964 ret = i915_gem_evict_something(dev, size, alignment, 2967 ret = i915_gem_evict_something(dev, size, alignment,
2965 obj->cache_level, 2968 obj->cache_level,
2966 map_and_fenceable, 2969 map_and_fenceable,
2967 nonblocking); 2970 nonblocking);
2968 if (ret) { 2971 if (ret == 0)
2969 i915_gem_object_unpin_pages(obj); 2972 goto search_free;
2970 return ret;
2971 }
2972 2973
2973 goto search_free; 2974 i915_gem_object_unpin_pages(obj);
2975 kfree(node);
2976 return ret;
2974 } 2977 }
2975 if (WARN_ON(!i915_gem_valid_gtt_space(dev, 2978 if (WARN_ON(!i915_gem_valid_gtt_space(dev, node, obj->cache_level))) {
2976 free_space,
2977 obj->cache_level))) {
2978 i915_gem_object_unpin_pages(obj); 2979 i915_gem_object_unpin_pages(obj);
2979 drm_mm_put_block(free_space); 2980 drm_mm_put_block(node);
2980 return -EINVAL; 2981 return -EINVAL;
2981 } 2982 }
2982 2983
2983 ret = i915_gem_gtt_prepare_object(obj); 2984 ret = i915_gem_gtt_prepare_object(obj);
2984 if (ret) { 2985 if (ret) {
2985 i915_gem_object_unpin_pages(obj); 2986 i915_gem_object_unpin_pages(obj);
2986 drm_mm_put_block(free_space); 2987 drm_mm_put_block(node);
2987 return ret; 2988 return ret;
2988 } 2989 }
2989 2990
2990 list_move_tail(&obj->gtt_list, &dev_priv->mm.bound_list); 2991 list_move_tail(&obj->gtt_list, &dev_priv->mm.bound_list);
2991 list_add_tail(&obj->mm_list, &dev_priv->mm.inactive_list); 2992 list_add_tail(&obj->mm_list, &dev_priv->mm.inactive_list);
2992 2993
2993 obj->gtt_space = free_space; 2994 obj->gtt_space = node;
2994 obj->gtt_offset = free_space->start; 2995 obj->gtt_offset = node->start;
2995 2996
2996 fenceable = 2997 fenceable =
2997 free_space->size == fence_size && 2998 node->size == fence_size &&
2998 (free_space->start & (fence_alignment - 1)) == 0; 2999 (node->start & (fence_alignment - 1)) == 0;
2999 3000
3000 mappable = 3001 mappable =
3001 obj->gtt_offset + obj->base.size <= dev_priv->mm.gtt_mappable_end; 3002 obj->gtt_offset + obj->base.size <= dev_priv->mm.gtt_mappable_end;
@@ -3528,14 +3529,15 @@ i915_gem_pin_ioctl(struct drm_device *dev, void *data,
3528 goto out; 3529 goto out;
3529 } 3530 }
3530 3531
3531 obj->user_pin_count++; 3532 if (obj->user_pin_count == 0) {
3532 obj->pin_filp = file;
3533 if (obj->user_pin_count == 1) {
3534 ret = i915_gem_object_pin(obj, args->alignment, true, false); 3533 ret = i915_gem_object_pin(obj, args->alignment, true, false);
3535 if (ret) 3534 if (ret)
3536 goto out; 3535 goto out;
3537 } 3536 }
3538 3537
3538 obj->user_pin_count++;
3539 obj->pin_filp = file;
3540
3539 /* XXX - flush the CPU caches for pinned objects 3541 /* XXX - flush the CPU caches for pinned objects
3540 * as the X server doesn't manage domains yet 3542 * as the X server doesn't manage domains yet
3541 */ 3543 */
@@ -4392,12 +4394,18 @@ i915_gem_inactive_shrink(struct shrinker *shrinker, struct shrink_control *sc)
4392 if (!mutex_is_locked_by(&dev->struct_mutex, current)) 4394 if (!mutex_is_locked_by(&dev->struct_mutex, current))
4393 return 0; 4395 return 0;
4394 4396
4397 if (dev_priv->mm.shrinker_no_lock_stealing)
4398 return 0;
4399
4395 unlock = false; 4400 unlock = false;
4396 } 4401 }
4397 4402
4398 if (nr_to_scan) { 4403 if (nr_to_scan) {
4399 nr_to_scan -= i915_gem_purge(dev_priv, nr_to_scan); 4404 nr_to_scan -= i915_gem_purge(dev_priv, nr_to_scan);
4400 if (nr_to_scan > 0) 4405 if (nr_to_scan > 0)
4406 nr_to_scan -= __i915_gem_shrink(dev_priv, nr_to_scan,
4407 false);
4408 if (nr_to_scan > 0)
4401 i915_gem_shrink_all(dev_priv); 4409 i915_gem_shrink_all(dev_priv);
4402 } 4410 }
4403 4411
@@ -4405,7 +4413,7 @@ i915_gem_inactive_shrink(struct shrinker *shrinker, struct shrink_control *sc)
4405 list_for_each_entry(obj, &dev_priv->mm.unbound_list, gtt_list) 4413 list_for_each_entry(obj, &dev_priv->mm.unbound_list, gtt_list)
4406 if (obj->pages_pin_count == 0) 4414 if (obj->pages_pin_count == 0)
4407 cnt += obj->base.size >> PAGE_SHIFT; 4415 cnt += obj->base.size >> PAGE_SHIFT;
4408 list_for_each_entry(obj, &dev_priv->mm.bound_list, gtt_list) 4416 list_for_each_entry(obj, &dev_priv->mm.inactive_list, gtt_list)
4409 if (obj->pin_count == 0 && obj->pages_pin_count == 0) 4417 if (obj->pin_count == 0 && obj->pages_pin_count == 0)
4410 cnt += obj->base.size >> PAGE_SHIFT; 4418 cnt += obj->base.size >> PAGE_SHIFT;
4411 4419
diff --git a/drivers/gpu/drm/i915/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/i915_gem_dmabuf.c
index 773ef77b6c22..abeaafef6d7e 100644
--- a/drivers/gpu/drm/i915/i915_gem_dmabuf.c
+++ b/drivers/gpu/drm/i915/i915_gem_dmabuf.c
@@ -226,7 +226,7 @@ struct dma_buf *i915_gem_prime_export(struct drm_device *dev,
226{ 226{
227 struct drm_i915_gem_object *obj = to_intel_bo(gem_obj); 227 struct drm_i915_gem_object *obj = to_intel_bo(gem_obj);
228 228
229 return dma_buf_export(obj, &i915_dmabuf_ops, obj->base.size, 0600); 229 return dma_buf_export(obj, &i915_dmabuf_ops, obj->base.size, flags);
230} 230}
231 231
232static int i915_gem_object_get_pages_dmabuf(struct drm_i915_gem_object *obj) 232static int i915_gem_object_get_pages_dmabuf(struct drm_i915_gem_object *obj)
@@ -266,7 +266,12 @@ struct drm_gem_object *i915_gem_prime_import(struct drm_device *dev,
266 obj = dma_buf->priv; 266 obj = dma_buf->priv;
267 /* is it from our device? */ 267 /* is it from our device? */
268 if (obj->base.dev == dev) { 268 if (obj->base.dev == dev) {
269 /*
270 * Importing dmabuf exported from out own gem increases
271 * refcount on gem itself instead of f_count of dmabuf.
272 */
269 drm_gem_object_reference(&obj->base); 273 drm_gem_object_reference(&obj->base);
274 dma_buf_put(dma_buf);
270 return &obj->base; 275 return &obj->base;
271 } 276 }
272 } 277 }
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index ee8f97f0539e..26d08bb58218 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -539,6 +539,8 @@ i915_gem_execbuffer_relocate_slow(struct drm_device *dev,
539 total = 0; 539 total = 0;
540 for (i = 0; i < count; i++) { 540 for (i = 0; i < count; i++) {
541 struct drm_i915_gem_relocation_entry __user *user_relocs; 541 struct drm_i915_gem_relocation_entry __user *user_relocs;
542 u64 invalid_offset = (u64)-1;
543 int j;
542 544
543 user_relocs = (void __user *)(uintptr_t)exec[i].relocs_ptr; 545 user_relocs = (void __user *)(uintptr_t)exec[i].relocs_ptr;
544 546
@@ -549,6 +551,25 @@ i915_gem_execbuffer_relocate_slow(struct drm_device *dev,
549 goto err; 551 goto err;
550 } 552 }
551 553
554 /* As we do not update the known relocation offsets after
555 * relocating (due to the complexities in lock handling),
556 * we need to mark them as invalid now so that we force the
557 * relocation processing next time. Just in case the target
558 * object is evicted and then rebound into its old
559 * presumed_offset before the next execbuffer - if that
560 * happened we would make the mistake of assuming that the
561 * relocations were valid.
562 */
563 for (j = 0; j < exec[i].relocation_count; j++) {
564 if (copy_to_user(&user_relocs[j].presumed_offset,
565 &invalid_offset,
566 sizeof(invalid_offset))) {
567 ret = -EFAULT;
568 mutex_lock(&dev->struct_mutex);
569 goto err;
570 }
571 }
572
552 reloc_offset[i] = total; 573 reloc_offset[i] = total;
553 total += exec[i].relocation_count; 574 total += exec[i].relocation_count;
554 } 575 }
@@ -808,6 +829,8 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
808 829
809 flags |= I915_DISPATCH_SECURE; 830 flags |= I915_DISPATCH_SECURE;
810 } 831 }
832 if (args->flags & I915_EXEC_IS_PINNED)
833 flags |= I915_DISPATCH_PINNED;
811 834
812 switch (args->flags & I915_EXEC_RING_MASK) { 835 switch (args->flags & I915_EXEC_RING_MASK) {
813 case I915_EXEC_DEFAULT: 836 case I915_EXEC_DEFAULT:
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index a4dc97f8b9f0..fe843389c7b4 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -1087,6 +1087,18 @@ i915_error_first_batchbuffer(struct drm_i915_private *dev_priv,
1087 if (!ring->get_seqno) 1087 if (!ring->get_seqno)
1088 return NULL; 1088 return NULL;
1089 1089
1090 if (HAS_BROKEN_CS_TLB(dev_priv->dev)) {
1091 u32 acthd = I915_READ(ACTHD);
1092
1093 if (WARN_ON(ring->id != RCS))
1094 return NULL;
1095
1096 obj = ring->private;
1097 if (acthd >= obj->gtt_offset &&
1098 acthd < obj->gtt_offset + obj->base.size)
1099 return i915_error_object_create(dev_priv, obj);
1100 }
1101
1090 seqno = ring->get_seqno(ring, false); 1102 seqno = ring->get_seqno(ring, false);
1091 list_for_each_entry(obj, &dev_priv->mm.active_list, mm_list) { 1103 list_for_each_entry(obj, &dev_priv->mm.active_list, mm_list) {
1092 if (obj->ring != ring) 1104 if (obj->ring != ring)
@@ -1145,6 +1157,7 @@ static void i915_record_ring_state(struct drm_device *dev,
1145 error->acthd[ring->id] = intel_ring_get_active_head(ring); 1157 error->acthd[ring->id] = intel_ring_get_active_head(ring);
1146 error->head[ring->id] = I915_READ_HEAD(ring); 1158 error->head[ring->id] = I915_READ_HEAD(ring);
1147 error->tail[ring->id] = I915_READ_TAIL(ring); 1159 error->tail[ring->id] = I915_READ_TAIL(ring);
1160 error->ctl[ring->id] = I915_READ_CTL(ring);
1148 1161
1149 error->cpu_ring_head[ring->id] = ring->head; 1162 error->cpu_ring_head[ring->id] = ring->head;
1150 error->cpu_ring_tail[ring->id] = ring->tail; 1163 error->cpu_ring_tail[ring->id] = ring->tail;
@@ -1239,6 +1252,16 @@ static void i915_capture_error_state(struct drm_device *dev)
1239 else 1252 else
1240 error->ier = I915_READ(IER); 1253 error->ier = I915_READ(IER);
1241 1254
1255 if (INTEL_INFO(dev)->gen >= 6)
1256 error->derrmr = I915_READ(DERRMR);
1257
1258 if (IS_VALLEYVIEW(dev))
1259 error->forcewake = I915_READ(FORCEWAKE_VLV);
1260 else if (INTEL_INFO(dev)->gen >= 7)
1261 error->forcewake = I915_READ(FORCEWAKE_MT);
1262 else if (INTEL_INFO(dev)->gen == 6)
1263 error->forcewake = I915_READ(FORCEWAKE);
1264
1242 for_each_pipe(pipe) 1265 for_each_pipe(pipe)
1243 error->pipestat[pipe] = I915_READ(PIPESTAT(pipe)); 1266 error->pipestat[pipe] = I915_READ(PIPESTAT(pipe));
1244 1267
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 3f75cfaf1c3f..59afb7eb6db6 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -512,11 +512,14 @@
512#define GEN7_ERR_INT 0x44040 512#define GEN7_ERR_INT 0x44040
513#define ERR_INT_MMIO_UNCLAIMED (1<<13) 513#define ERR_INT_MMIO_UNCLAIMED (1<<13)
514 514
515#define DERRMR 0x44050
516
515/* GM45+ chicken bits -- debug workaround bits that may be required 517/* GM45+ chicken bits -- debug workaround bits that may be required
516 * for various sorts of correct behavior. The top 16 bits of each are 518 * for various sorts of correct behavior. The top 16 bits of each are
517 * the enables for writing to the corresponding low bit. 519 * the enables for writing to the corresponding low bit.
518 */ 520 */
519#define _3D_CHICKEN 0x02084 521#define _3D_CHICKEN 0x02084
522#define _3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB (1 << 10)
520#define _3D_CHICKEN2 0x0208c 523#define _3D_CHICKEN2 0x0208c
521/* Disables pipelining of read flushes past the SF-WIZ interface. 524/* Disables pipelining of read flushes past the SF-WIZ interface.
522 * Required on all Ironlake steppings according to the B-Spec, but the 525 * Required on all Ironlake steppings according to the B-Spec, but the
@@ -530,9 +533,11 @@
530#define MI_MODE 0x0209c 533#define MI_MODE 0x0209c
531# define VS_TIMER_DISPATCH (1 << 6) 534# define VS_TIMER_DISPATCH (1 << 6)
532# define MI_FLUSH_ENABLE (1 << 12) 535# define MI_FLUSH_ENABLE (1 << 12)
536# define ASYNC_FLIP_PERF_DISABLE (1 << 14)
533 537
534#define GEN6_GT_MODE 0x20d0 538#define GEN6_GT_MODE 0x20d0
535#define GEN6_GT_MODE_HI (1 << 9) 539#define GEN6_GT_MODE_HI (1 << 9)
540#define GEN6_TD_FOUR_ROW_DISPATCH_DISABLE (1 << 5)
536 541
537#define GFX_MODE 0x02520 542#define GFX_MODE 0x02520
538#define GFX_MODE_GEN7 0x0229c 543#define GFX_MODE_GEN7 0x0229c
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 5d127e068950..da1ad9c80bb5 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -8144,10 +8144,6 @@ intel_modeset_stage_output_state(struct drm_device *dev,
8144 DRM_DEBUG_KMS("encoder changed, full mode switch\n"); 8144 DRM_DEBUG_KMS("encoder changed, full mode switch\n");
8145 config->mode_changed = true; 8145 config->mode_changed = true;
8146 } 8146 }
8147
8148 /* Disable all disconnected encoders. */
8149 if (connector->base.status == connector_status_disconnected)
8150 connector->new_encoder = NULL;
8151 } 8147 }
8152 /* connector->new_encoder is now updated for all connectors. */ 8148 /* connector->new_encoder is now updated for all connectors. */
8153 8149
@@ -8602,19 +8598,30 @@ int intel_framebuffer_init(struct drm_device *dev,
8602{ 8598{
8603 int ret; 8599 int ret;
8604 8600
8605 if (obj->tiling_mode == I915_TILING_Y) 8601 if (obj->tiling_mode == I915_TILING_Y) {
8602 DRM_DEBUG("hardware does not support tiling Y\n");
8606 return -EINVAL; 8603 return -EINVAL;
8604 }
8607 8605
8608 if (mode_cmd->pitches[0] & 63) 8606 if (mode_cmd->pitches[0] & 63) {
8607 DRM_DEBUG("pitch (%d) must be at least 64 byte aligned\n",
8608 mode_cmd->pitches[0]);
8609 return -EINVAL; 8609 return -EINVAL;
8610 }
8610 8611
8611 /* FIXME <= Gen4 stride limits are bit unclear */ 8612 /* FIXME <= Gen4 stride limits are bit unclear */
8612 if (mode_cmd->pitches[0] > 32768) 8613 if (mode_cmd->pitches[0] > 32768) {
8614 DRM_DEBUG("pitch (%d) must be at less than 32768\n",
8615 mode_cmd->pitches[0]);
8613 return -EINVAL; 8616 return -EINVAL;
8617 }
8614 8618
8615 if (obj->tiling_mode != I915_TILING_NONE && 8619 if (obj->tiling_mode != I915_TILING_NONE &&
8616 mode_cmd->pitches[0] != obj->stride) 8620 mode_cmd->pitches[0] != obj->stride) {
8621 DRM_DEBUG("pitch (%d) must match tiling stride (%d)\n",
8622 mode_cmd->pitches[0], obj->stride);
8617 return -EINVAL; 8623 return -EINVAL;
8624 }
8618 8625
8619 /* Reject formats not supported by any plane early. */ 8626 /* Reject formats not supported by any plane early. */
8620 switch (mode_cmd->pixel_format) { 8627 switch (mode_cmd->pixel_format) {
@@ -8625,8 +8632,10 @@ int intel_framebuffer_init(struct drm_device *dev,
8625 break; 8632 break;
8626 case DRM_FORMAT_XRGB1555: 8633 case DRM_FORMAT_XRGB1555:
8627 case DRM_FORMAT_ARGB1555: 8634 case DRM_FORMAT_ARGB1555:
8628 if (INTEL_INFO(dev)->gen > 3) 8635 if (INTEL_INFO(dev)->gen > 3) {
8636 DRM_DEBUG("invalid format: 0x%08x\n", mode_cmd->pixel_format);
8629 return -EINVAL; 8637 return -EINVAL;
8638 }
8630 break; 8639 break;
8631 case DRM_FORMAT_XBGR8888: 8640 case DRM_FORMAT_XBGR8888:
8632 case DRM_FORMAT_ABGR8888: 8641 case DRM_FORMAT_ABGR8888:
@@ -8634,18 +8643,22 @@ int intel_framebuffer_init(struct drm_device *dev,
8634 case DRM_FORMAT_ARGB2101010: 8643 case DRM_FORMAT_ARGB2101010:
8635 case DRM_FORMAT_XBGR2101010: 8644 case DRM_FORMAT_XBGR2101010:
8636 case DRM_FORMAT_ABGR2101010: 8645 case DRM_FORMAT_ABGR2101010:
8637 if (INTEL_INFO(dev)->gen < 4) 8646 if (INTEL_INFO(dev)->gen < 4) {
8647 DRM_DEBUG("invalid format: 0x%08x\n", mode_cmd->pixel_format);
8638 return -EINVAL; 8648 return -EINVAL;
8649 }
8639 break; 8650 break;
8640 case DRM_FORMAT_YUYV: 8651 case DRM_FORMAT_YUYV:
8641 case DRM_FORMAT_UYVY: 8652 case DRM_FORMAT_UYVY:
8642 case DRM_FORMAT_YVYU: 8653 case DRM_FORMAT_YVYU:
8643 case DRM_FORMAT_VYUY: 8654 case DRM_FORMAT_VYUY:
8644 if (INTEL_INFO(dev)->gen < 6) 8655 if (INTEL_INFO(dev)->gen < 5) {
8656 DRM_DEBUG("invalid format: 0x%08x\n", mode_cmd->pixel_format);
8645 return -EINVAL; 8657 return -EINVAL;
8658 }
8646 break; 8659 break;
8647 default: 8660 default:
8648 DRM_DEBUG_KMS("unsupported pixel format 0x%08x\n", mode_cmd->pixel_format); 8661 DRM_DEBUG("unsupported pixel format 0x%08x\n", mode_cmd->pixel_format);
8649 return -EINVAL; 8662 return -EINVAL;
8650 } 8663 }
8651 8664
@@ -9167,6 +9180,23 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder)
9167 * the crtc fixup. */ 9180 * the crtc fixup. */
9168} 9181}
9169 9182
9183static void i915_redisable_vga(struct drm_device *dev)
9184{
9185 struct drm_i915_private *dev_priv = dev->dev_private;
9186 u32 vga_reg;
9187
9188 if (HAS_PCH_SPLIT(dev))
9189 vga_reg = CPU_VGACNTRL;
9190 else
9191 vga_reg = VGACNTRL;
9192
9193 if (I915_READ(vga_reg) != VGA_DISP_DISABLE) {
9194 DRM_DEBUG_KMS("Something enabled VGA plane, disabling it\n");
9195 I915_WRITE(vga_reg, VGA_DISP_DISABLE);
9196 POSTING_READ(vga_reg);
9197 }
9198}
9199
9170/* Scan out the current hw modeset state, sanitizes it and maps it into the drm 9200/* Scan out the current hw modeset state, sanitizes it and maps it into the drm
9171 * and i915 state tracking structures. */ 9201 * and i915 state tracking structures. */
9172void intel_modeset_setup_hw_state(struct drm_device *dev, 9202void intel_modeset_setup_hw_state(struct drm_device *dev,
@@ -9275,6 +9305,8 @@ void intel_modeset_setup_hw_state(struct drm_device *dev,
9275 intel_set_mode(&crtc->base, &crtc->base.mode, 9305 intel_set_mode(&crtc->base, &crtc->base.mode,
9276 crtc->base.x, crtc->base.y, crtc->base.fb); 9306 crtc->base.x, crtc->base.y, crtc->base.fb);
9277 } 9307 }
9308
9309 i915_redisable_vga(dev);
9278 } else { 9310 } else {
9279 intel_modeset_update_staged_output_state(dev); 9311 intel_modeset_update_staged_output_state(dev);
9280 } 9312 }
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 1b63d55318a0..fb3715b4b09d 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -2579,7 +2579,8 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect
2579 2579
2580static void 2580static void
2581intel_dp_init_panel_power_sequencer(struct drm_device *dev, 2581intel_dp_init_panel_power_sequencer(struct drm_device *dev,
2582 struct intel_dp *intel_dp) 2582 struct intel_dp *intel_dp,
2583 struct edp_power_seq *out)
2583{ 2584{
2584 struct drm_i915_private *dev_priv = dev->dev_private; 2585 struct drm_i915_private *dev_priv = dev->dev_private;
2585 struct edp_power_seq cur, vbt, spec, final; 2586 struct edp_power_seq cur, vbt, spec, final;
@@ -2650,16 +2651,35 @@ intel_dp_init_panel_power_sequencer(struct drm_device *dev,
2650 intel_dp->panel_power_cycle_delay = get_delay(t11_t12); 2651 intel_dp->panel_power_cycle_delay = get_delay(t11_t12);
2651#undef get_delay 2652#undef get_delay
2652 2653
2654 DRM_DEBUG_KMS("panel power up delay %d, power down delay %d, power cycle delay %d\n",
2655 intel_dp->panel_power_up_delay, intel_dp->panel_power_down_delay,
2656 intel_dp->panel_power_cycle_delay);
2657
2658 DRM_DEBUG_KMS("backlight on delay %d, off delay %d\n",
2659 intel_dp->backlight_on_delay, intel_dp->backlight_off_delay);
2660
2661 if (out)
2662 *out = final;
2663}
2664
2665static void
2666intel_dp_init_panel_power_sequencer_registers(struct drm_device *dev,
2667 struct intel_dp *intel_dp,
2668 struct edp_power_seq *seq)
2669{
2670 struct drm_i915_private *dev_priv = dev->dev_private;
2671 u32 pp_on, pp_off, pp_div;
2672
2653 /* And finally store the new values in the power sequencer. */ 2673 /* And finally store the new values in the power sequencer. */
2654 pp_on = (final.t1_t3 << PANEL_POWER_UP_DELAY_SHIFT) | 2674 pp_on = (seq->t1_t3 << PANEL_POWER_UP_DELAY_SHIFT) |
2655 (final.t8 << PANEL_LIGHT_ON_DELAY_SHIFT); 2675 (seq->t8 << PANEL_LIGHT_ON_DELAY_SHIFT);
2656 pp_off = (final.t9 << PANEL_LIGHT_OFF_DELAY_SHIFT) | 2676 pp_off = (seq->t9 << PANEL_LIGHT_OFF_DELAY_SHIFT) |
2657 (final.t10 << PANEL_POWER_DOWN_DELAY_SHIFT); 2677 (seq->t10 << PANEL_POWER_DOWN_DELAY_SHIFT);
2658 /* Compute the divisor for the pp clock, simply match the Bspec 2678 /* Compute the divisor for the pp clock, simply match the Bspec
2659 * formula. */ 2679 * formula. */
2660 pp_div = ((100 * intel_pch_rawclk(dev))/2 - 1) 2680 pp_div = ((100 * intel_pch_rawclk(dev))/2 - 1)
2661 << PP_REFERENCE_DIVIDER_SHIFT; 2681 << PP_REFERENCE_DIVIDER_SHIFT;
2662 pp_div |= (DIV_ROUND_UP(final.t11_t12, 1000) 2682 pp_div |= (DIV_ROUND_UP(seq->t11_t12, 1000)
2663 << PANEL_POWER_CYCLE_DELAY_SHIFT); 2683 << PANEL_POWER_CYCLE_DELAY_SHIFT);
2664 2684
2665 /* Haswell doesn't have any port selection bits for the panel 2685 /* Haswell doesn't have any port selection bits for the panel
@@ -2675,14 +2695,6 @@ intel_dp_init_panel_power_sequencer(struct drm_device *dev,
2675 I915_WRITE(PCH_PP_OFF_DELAYS, pp_off); 2695 I915_WRITE(PCH_PP_OFF_DELAYS, pp_off);
2676 I915_WRITE(PCH_PP_DIVISOR, pp_div); 2696 I915_WRITE(PCH_PP_DIVISOR, pp_div);
2677 2697
2678
2679 DRM_DEBUG_KMS("panel power up delay %d, power down delay %d, power cycle delay %d\n",
2680 intel_dp->panel_power_up_delay, intel_dp->panel_power_down_delay,
2681 intel_dp->panel_power_cycle_delay);
2682
2683 DRM_DEBUG_KMS("backlight on delay %d, off delay %d\n",
2684 intel_dp->backlight_on_delay, intel_dp->backlight_off_delay);
2685
2686 DRM_DEBUG_KMS("panel power sequencer register settings: PP_ON %#x, PP_OFF %#x, PP_DIV %#x\n", 2698 DRM_DEBUG_KMS("panel power sequencer register settings: PP_ON %#x, PP_OFF %#x, PP_DIV %#x\n",
2687 I915_READ(PCH_PP_ON_DELAYS), 2699 I915_READ(PCH_PP_ON_DELAYS),
2688 I915_READ(PCH_PP_OFF_DELAYS), 2700 I915_READ(PCH_PP_OFF_DELAYS),
@@ -2699,6 +2711,7 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
2699 struct drm_device *dev = intel_encoder->base.dev; 2711 struct drm_device *dev = intel_encoder->base.dev;
2700 struct drm_i915_private *dev_priv = dev->dev_private; 2712 struct drm_i915_private *dev_priv = dev->dev_private;
2701 struct drm_display_mode *fixed_mode = NULL; 2713 struct drm_display_mode *fixed_mode = NULL;
2714 struct edp_power_seq power_seq = { 0 };
2702 enum port port = intel_dig_port->port; 2715 enum port port = intel_dig_port->port;
2703 const char *name = NULL; 2716 const char *name = NULL;
2704 int type; 2717 int type;
@@ -2771,7 +2784,7 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
2771 } 2784 }
2772 2785
2773 if (is_edp(intel_dp)) 2786 if (is_edp(intel_dp))
2774 intel_dp_init_panel_power_sequencer(dev, intel_dp); 2787 intel_dp_init_panel_power_sequencer(dev, intel_dp, &power_seq);
2775 2788
2776 intel_dp_i2c_init(intel_dp, intel_connector, name); 2789 intel_dp_i2c_init(intel_dp, intel_connector, name);
2777 2790
@@ -2798,6 +2811,10 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
2798 return; 2811 return;
2799 } 2812 }
2800 2813
2814 /* We now know it's not a ghost, init power sequence regs. */
2815 intel_dp_init_panel_power_sequencer_registers(dev, intel_dp,
2816 &power_seq);
2817
2801 ironlake_edp_panel_vdd_on(intel_dp); 2818 ironlake_edp_panel_vdd_on(intel_dp);
2802 edid = drm_get_edid(connector, &intel_dp->adapter); 2819 edid = drm_get_edid(connector, &intel_dp->adapter);
2803 if (edid) { 2820 if (edid) {
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index b9a660a53677..17aee74258ad 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -776,14 +776,6 @@ static const struct dmi_system_id intel_no_lvds[] = {
776 }, 776 },
777 { 777 {
778 .callback = intel_no_lvds_dmi_callback, 778 .callback = intel_no_lvds_dmi_callback,
779 .ident = "ZOTAC ZBOXSD-ID12/ID13",
780 .matches = {
781 DMI_MATCH(DMI_BOARD_VENDOR, "ZOTAC"),
782 DMI_MATCH(DMI_BOARD_NAME, "ZBOXSD-ID12/ID13"),
783 },
784 },
785 {
786 .callback = intel_no_lvds_dmi_callback,
787 .ident = "Gigabyte GA-D525TUD", 779 .ident = "Gigabyte GA-D525TUD",
788 .matches = { 780 .matches = {
789 DMI_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co., Ltd."), 781 DMI_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co., Ltd."),
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 496caa73eb70..3280cffe50f4 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -44,6 +44,14 @@
44 * i915.i915_enable_fbc parameter 44 * i915.i915_enable_fbc parameter
45 */ 45 */
46 46
47static bool intel_crtc_active(struct drm_crtc *crtc)
48{
49 /* Be paranoid as we can arrive here with only partial
50 * state retrieved from the hardware during setup.
51 */
52 return to_intel_crtc(crtc)->active && crtc->fb && crtc->mode.clock;
53}
54
47static void i8xx_disable_fbc(struct drm_device *dev) 55static void i8xx_disable_fbc(struct drm_device *dev)
48{ 56{
49 struct drm_i915_private *dev_priv = dev->dev_private; 57 struct drm_i915_private *dev_priv = dev->dev_private;
@@ -405,9 +413,8 @@ void intel_update_fbc(struct drm_device *dev)
405 * - going to an unsupported config (interlace, pixel multiply, etc.) 413 * - going to an unsupported config (interlace, pixel multiply, etc.)
406 */ 414 */
407 list_for_each_entry(tmp_crtc, &dev->mode_config.crtc_list, head) { 415 list_for_each_entry(tmp_crtc, &dev->mode_config.crtc_list, head) {
408 if (tmp_crtc->enabled && 416 if (intel_crtc_active(tmp_crtc) &&
409 !to_intel_crtc(tmp_crtc)->primary_disabled && 417 !to_intel_crtc(tmp_crtc)->primary_disabled) {
410 tmp_crtc->fb) {
411 if (crtc) { 418 if (crtc) {
412 DRM_DEBUG_KMS("more than one pipe active, disabling compression\n"); 419 DRM_DEBUG_KMS("more than one pipe active, disabling compression\n");
413 dev_priv->no_fbc_reason = FBC_MULTIPLE_PIPES; 420 dev_priv->no_fbc_reason = FBC_MULTIPLE_PIPES;
@@ -992,7 +999,7 @@ static struct drm_crtc *single_enabled_crtc(struct drm_device *dev)
992 struct drm_crtc *crtc, *enabled = NULL; 999 struct drm_crtc *crtc, *enabled = NULL;
993 1000
994 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 1001 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
995 if (crtc->enabled && crtc->fb) { 1002 if (intel_crtc_active(crtc)) {
996 if (enabled) 1003 if (enabled)
997 return NULL; 1004 return NULL;
998 enabled = crtc; 1005 enabled = crtc;
@@ -1086,7 +1093,7 @@ static bool g4x_compute_wm0(struct drm_device *dev,
1086 int entries, tlb_miss; 1093 int entries, tlb_miss;
1087 1094
1088 crtc = intel_get_crtc_for_plane(dev, plane); 1095 crtc = intel_get_crtc_for_plane(dev, plane);
1089 if (crtc->fb == NULL || !crtc->enabled) { 1096 if (!intel_crtc_active(crtc)) {
1090 *cursor_wm = cursor->guard_size; 1097 *cursor_wm = cursor->guard_size;
1091 *plane_wm = display->guard_size; 1098 *plane_wm = display->guard_size;
1092 return false; 1099 return false;
@@ -1215,7 +1222,7 @@ static bool vlv_compute_drain_latency(struct drm_device *dev,
1215 int entries; 1222 int entries;
1216 1223
1217 crtc = intel_get_crtc_for_plane(dev, plane); 1224 crtc = intel_get_crtc_for_plane(dev, plane);
1218 if (crtc->fb == NULL || !crtc->enabled) 1225 if (!intel_crtc_active(crtc))
1219 return false; 1226 return false;
1220 1227
1221 clock = crtc->mode.clock; /* VESA DOT Clock */ 1228 clock = crtc->mode.clock; /* VESA DOT Clock */
@@ -1286,6 +1293,7 @@ static void valleyview_update_wm(struct drm_device *dev)
1286 struct drm_i915_private *dev_priv = dev->dev_private; 1293 struct drm_i915_private *dev_priv = dev->dev_private;
1287 int planea_wm, planeb_wm, cursora_wm, cursorb_wm; 1294 int planea_wm, planeb_wm, cursora_wm, cursorb_wm;
1288 int plane_sr, cursor_sr; 1295 int plane_sr, cursor_sr;
1296 int ignore_plane_sr, ignore_cursor_sr;
1289 unsigned int enabled = 0; 1297 unsigned int enabled = 0;
1290 1298
1291 vlv_update_drain_latency(dev); 1299 vlv_update_drain_latency(dev);
@@ -1302,17 +1310,23 @@ static void valleyview_update_wm(struct drm_device *dev)
1302 &planeb_wm, &cursorb_wm)) 1310 &planeb_wm, &cursorb_wm))
1303 enabled |= 2; 1311 enabled |= 2;
1304 1312
1305 plane_sr = cursor_sr = 0;
1306 if (single_plane_enabled(enabled) && 1313 if (single_plane_enabled(enabled) &&
1307 g4x_compute_srwm(dev, ffs(enabled) - 1, 1314 g4x_compute_srwm(dev, ffs(enabled) - 1,
1308 sr_latency_ns, 1315 sr_latency_ns,
1309 &valleyview_wm_info, 1316 &valleyview_wm_info,
1310 &valleyview_cursor_wm_info, 1317 &valleyview_cursor_wm_info,
1311 &plane_sr, &cursor_sr)) 1318 &plane_sr, &ignore_cursor_sr) &&
1319 g4x_compute_srwm(dev, ffs(enabled) - 1,
1320 2*sr_latency_ns,
1321 &valleyview_wm_info,
1322 &valleyview_cursor_wm_info,
1323 &ignore_plane_sr, &cursor_sr)) {
1312 I915_WRITE(FW_BLC_SELF_VLV, FW_CSPWRDWNEN); 1324 I915_WRITE(FW_BLC_SELF_VLV, FW_CSPWRDWNEN);
1313 else 1325 } else {
1314 I915_WRITE(FW_BLC_SELF_VLV, 1326 I915_WRITE(FW_BLC_SELF_VLV,
1315 I915_READ(FW_BLC_SELF_VLV) & ~FW_CSPWRDWNEN); 1327 I915_READ(FW_BLC_SELF_VLV) & ~FW_CSPWRDWNEN);
1328 plane_sr = cursor_sr = 0;
1329 }
1316 1330
1317 DRM_DEBUG_KMS("Setting FIFO watermarks - A: plane=%d, cursor=%d, B: plane=%d, cursor=%d, SR: plane=%d, cursor=%d\n", 1331 DRM_DEBUG_KMS("Setting FIFO watermarks - A: plane=%d, cursor=%d, B: plane=%d, cursor=%d, SR: plane=%d, cursor=%d\n",
1318 planea_wm, cursora_wm, 1332 planea_wm, cursora_wm,
@@ -1352,17 +1366,18 @@ static void g4x_update_wm(struct drm_device *dev)
1352 &planeb_wm, &cursorb_wm)) 1366 &planeb_wm, &cursorb_wm))
1353 enabled |= 2; 1367 enabled |= 2;
1354 1368
1355 plane_sr = cursor_sr = 0;
1356 if (single_plane_enabled(enabled) && 1369 if (single_plane_enabled(enabled) &&
1357 g4x_compute_srwm(dev, ffs(enabled) - 1, 1370 g4x_compute_srwm(dev, ffs(enabled) - 1,
1358 sr_latency_ns, 1371 sr_latency_ns,
1359 &g4x_wm_info, 1372 &g4x_wm_info,
1360 &g4x_cursor_wm_info, 1373 &g4x_cursor_wm_info,
1361 &plane_sr, &cursor_sr)) 1374 &plane_sr, &cursor_sr)) {
1362 I915_WRITE(FW_BLC_SELF, FW_BLC_SELF_EN); 1375 I915_WRITE(FW_BLC_SELF, FW_BLC_SELF_EN);
1363 else 1376 } else {
1364 I915_WRITE(FW_BLC_SELF, 1377 I915_WRITE(FW_BLC_SELF,
1365 I915_READ(FW_BLC_SELF) & ~FW_BLC_SELF_EN); 1378 I915_READ(FW_BLC_SELF) & ~FW_BLC_SELF_EN);
1379 plane_sr = cursor_sr = 0;
1380 }
1366 1381
1367 DRM_DEBUG_KMS("Setting FIFO watermarks - A: plane=%d, cursor=%d, B: plane=%d, cursor=%d, SR: plane=%d, cursor=%d\n", 1382 DRM_DEBUG_KMS("Setting FIFO watermarks - A: plane=%d, cursor=%d, B: plane=%d, cursor=%d, SR: plane=%d, cursor=%d\n",
1368 planea_wm, cursora_wm, 1383 planea_wm, cursora_wm,
@@ -1468,7 +1483,7 @@ static void i9xx_update_wm(struct drm_device *dev)
1468 1483
1469 fifo_size = dev_priv->display.get_fifo_size(dev, 0); 1484 fifo_size = dev_priv->display.get_fifo_size(dev, 0);
1470 crtc = intel_get_crtc_for_plane(dev, 0); 1485 crtc = intel_get_crtc_for_plane(dev, 0);
1471 if (crtc->enabled && crtc->fb) { 1486 if (intel_crtc_active(crtc)) {
1472 int cpp = crtc->fb->bits_per_pixel / 8; 1487 int cpp = crtc->fb->bits_per_pixel / 8;
1473 if (IS_GEN2(dev)) 1488 if (IS_GEN2(dev))
1474 cpp = 4; 1489 cpp = 4;
@@ -1482,7 +1497,7 @@ static void i9xx_update_wm(struct drm_device *dev)
1482 1497
1483 fifo_size = dev_priv->display.get_fifo_size(dev, 1); 1498 fifo_size = dev_priv->display.get_fifo_size(dev, 1);
1484 crtc = intel_get_crtc_for_plane(dev, 1); 1499 crtc = intel_get_crtc_for_plane(dev, 1);
1485 if (crtc->enabled && crtc->fb) { 1500 if (intel_crtc_active(crtc)) {
1486 int cpp = crtc->fb->bits_per_pixel / 8; 1501 int cpp = crtc->fb->bits_per_pixel / 8;
1487 if (IS_GEN2(dev)) 1502 if (IS_GEN2(dev))
1488 cpp = 4; 1503 cpp = 4;
@@ -1811,8 +1826,110 @@ static void sandybridge_update_wm(struct drm_device *dev)
1811 enabled |= 2; 1826 enabled |= 2;
1812 } 1827 }
1813 1828
1814 if ((dev_priv->num_pipe == 3) && 1829 /*
1815 g4x_compute_wm0(dev, 2, 1830 * Calculate and update the self-refresh watermark only when one
1831 * display plane is used.
1832 *
1833 * SNB support 3 levels of watermark.
1834 *
1835 * WM1/WM2/WM2 watermarks have to be enabled in the ascending order,
1836 * and disabled in the descending order
1837 *
1838 */
1839 I915_WRITE(WM3_LP_ILK, 0);
1840 I915_WRITE(WM2_LP_ILK, 0);
1841 I915_WRITE(WM1_LP_ILK, 0);
1842
1843 if (!single_plane_enabled(enabled) ||
1844 dev_priv->sprite_scaling_enabled)
1845 return;
1846 enabled = ffs(enabled) - 1;
1847
1848 /* WM1 */
1849 if (!ironlake_compute_srwm(dev, 1, enabled,
1850 SNB_READ_WM1_LATENCY() * 500,
1851 &sandybridge_display_srwm_info,
1852 &sandybridge_cursor_srwm_info,
1853 &fbc_wm, &plane_wm, &cursor_wm))
1854 return;
1855
1856 I915_WRITE(WM1_LP_ILK,
1857 WM1_LP_SR_EN |
1858 (SNB_READ_WM1_LATENCY() << WM1_LP_LATENCY_SHIFT) |
1859 (fbc_wm << WM1_LP_FBC_SHIFT) |
1860 (plane_wm << WM1_LP_SR_SHIFT) |
1861 cursor_wm);
1862
1863 /* WM2 */
1864 if (!ironlake_compute_srwm(dev, 2, enabled,
1865 SNB_READ_WM2_LATENCY() * 500,
1866 &sandybridge_display_srwm_info,
1867 &sandybridge_cursor_srwm_info,
1868 &fbc_wm, &plane_wm, &cursor_wm))
1869 return;
1870
1871 I915_WRITE(WM2_LP_ILK,
1872 WM2_LP_EN |
1873 (SNB_READ_WM2_LATENCY() << WM1_LP_LATENCY_SHIFT) |
1874 (fbc_wm << WM1_LP_FBC_SHIFT) |
1875 (plane_wm << WM1_LP_SR_SHIFT) |
1876 cursor_wm);
1877
1878 /* WM3 */
1879 if (!ironlake_compute_srwm(dev, 3, enabled,
1880 SNB_READ_WM3_LATENCY() * 500,
1881 &sandybridge_display_srwm_info,
1882 &sandybridge_cursor_srwm_info,
1883 &fbc_wm, &plane_wm, &cursor_wm))
1884 return;
1885
1886 I915_WRITE(WM3_LP_ILK,
1887 WM3_LP_EN |
1888 (SNB_READ_WM3_LATENCY() << WM1_LP_LATENCY_SHIFT) |
1889 (fbc_wm << WM1_LP_FBC_SHIFT) |
1890 (plane_wm << WM1_LP_SR_SHIFT) |
1891 cursor_wm);
1892}
1893
1894static void ivybridge_update_wm(struct drm_device *dev)
1895{
1896 struct drm_i915_private *dev_priv = dev->dev_private;
1897 int latency = SNB_READ_WM0_LATENCY() * 100; /* In unit 0.1us */
1898 u32 val;
1899 int fbc_wm, plane_wm, cursor_wm;
1900 int ignore_fbc_wm, ignore_plane_wm, ignore_cursor_wm;
1901 unsigned int enabled;
1902
1903 enabled = 0;
1904 if (g4x_compute_wm0(dev, 0,
1905 &sandybridge_display_wm_info, latency,
1906 &sandybridge_cursor_wm_info, latency,
1907 &plane_wm, &cursor_wm)) {
1908 val = I915_READ(WM0_PIPEA_ILK);
1909 val &= ~(WM0_PIPE_PLANE_MASK | WM0_PIPE_CURSOR_MASK);
1910 I915_WRITE(WM0_PIPEA_ILK, val |
1911 ((plane_wm << WM0_PIPE_PLANE_SHIFT) | cursor_wm));
1912 DRM_DEBUG_KMS("FIFO watermarks For pipe A -"
1913 " plane %d, " "cursor: %d\n",
1914 plane_wm, cursor_wm);
1915 enabled |= 1;
1916 }
1917
1918 if (g4x_compute_wm0(dev, 1,
1919 &sandybridge_display_wm_info, latency,
1920 &sandybridge_cursor_wm_info, latency,
1921 &plane_wm, &cursor_wm)) {
1922 val = I915_READ(WM0_PIPEB_ILK);
1923 val &= ~(WM0_PIPE_PLANE_MASK | WM0_PIPE_CURSOR_MASK);
1924 I915_WRITE(WM0_PIPEB_ILK, val |
1925 ((plane_wm << WM0_PIPE_PLANE_SHIFT) | cursor_wm));
1926 DRM_DEBUG_KMS("FIFO watermarks For pipe B -"
1927 " plane %d, cursor: %d\n",
1928 plane_wm, cursor_wm);
1929 enabled |= 2;
1930 }
1931
1932 if (g4x_compute_wm0(dev, 2,
1816 &sandybridge_display_wm_info, latency, 1933 &sandybridge_display_wm_info, latency,
1817 &sandybridge_cursor_wm_info, latency, 1934 &sandybridge_cursor_wm_info, latency,
1818 &plane_wm, &cursor_wm)) { 1935 &plane_wm, &cursor_wm)) {
@@ -1875,12 +1992,17 @@ static void sandybridge_update_wm(struct drm_device *dev)
1875 (plane_wm << WM1_LP_SR_SHIFT) | 1992 (plane_wm << WM1_LP_SR_SHIFT) |
1876 cursor_wm); 1993 cursor_wm);
1877 1994
1878 /* WM3 */ 1995 /* WM3, note we have to correct the cursor latency */
1879 if (!ironlake_compute_srwm(dev, 3, enabled, 1996 if (!ironlake_compute_srwm(dev, 3, enabled,
1880 SNB_READ_WM3_LATENCY() * 500, 1997 SNB_READ_WM3_LATENCY() * 500,
1881 &sandybridge_display_srwm_info, 1998 &sandybridge_display_srwm_info,
1882 &sandybridge_cursor_srwm_info, 1999 &sandybridge_cursor_srwm_info,
1883 &fbc_wm, &plane_wm, &cursor_wm)) 2000 &fbc_wm, &plane_wm, &ignore_cursor_wm) ||
2001 !ironlake_compute_srwm(dev, 3, enabled,
2002 2 * SNB_READ_WM3_LATENCY() * 500,
2003 &sandybridge_display_srwm_info,
2004 &sandybridge_cursor_srwm_info,
2005 &ignore_fbc_wm, &ignore_plane_wm, &cursor_wm))
1884 return; 2006 return;
1885 2007
1886 I915_WRITE(WM3_LP_ILK, 2008 I915_WRITE(WM3_LP_ILK,
@@ -1929,7 +2051,7 @@ sandybridge_compute_sprite_wm(struct drm_device *dev, int plane,
1929 int entries, tlb_miss; 2051 int entries, tlb_miss;
1930 2052
1931 crtc = intel_get_crtc_for_plane(dev, plane); 2053 crtc = intel_get_crtc_for_plane(dev, plane);
1932 if (crtc->fb == NULL || !crtc->enabled) { 2054 if (!intel_crtc_active(crtc)) {
1933 *sprite_wm = display->guard_size; 2055 *sprite_wm = display->guard_size;
1934 return false; 2056 return false;
1935 } 2057 }
@@ -3471,6 +3593,15 @@ static void gen6_init_clock_gating(struct drm_device *dev)
3471 I915_READ(ILK_DISPLAY_CHICKEN2) | 3593 I915_READ(ILK_DISPLAY_CHICKEN2) |
3472 ILK_ELPIN_409_SELECT); 3594 ILK_ELPIN_409_SELECT);
3473 3595
3596 /* WaDisableHiZPlanesWhenMSAAEnabled */
3597 I915_WRITE(_3D_CHICKEN,
3598 _MASKED_BIT_ENABLE(_3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB));
3599
3600 /* WaSetupGtModeTdRowDispatch */
3601 if (IS_SNB_GT1(dev))
3602 I915_WRITE(GEN6_GT_MODE,
3603 _MASKED_BIT_ENABLE(GEN6_TD_FOUR_ROW_DISPATCH_DISABLE));
3604
3474 I915_WRITE(WM3_LP_ILK, 0); 3605 I915_WRITE(WM3_LP_ILK, 0);
3475 I915_WRITE(WM2_LP_ILK, 0); 3606 I915_WRITE(WM2_LP_ILK, 0);
3476 I915_WRITE(WM1_LP_ILK, 0); 3607 I915_WRITE(WM1_LP_ILK, 0);
@@ -3999,7 +4130,7 @@ void intel_init_pm(struct drm_device *dev)
3999 } else if (IS_IVYBRIDGE(dev)) { 4130 } else if (IS_IVYBRIDGE(dev)) {
4000 /* FIXME: detect B0+ stepping and use auto training */ 4131 /* FIXME: detect B0+ stepping and use auto training */
4001 if (SNB_READ_WM0_LATENCY()) { 4132 if (SNB_READ_WM0_LATENCY()) {
4002 dev_priv->display.update_wm = sandybridge_update_wm; 4133 dev_priv->display.update_wm = ivybridge_update_wm;
4003 dev_priv->display.update_sprite_wm = sandybridge_update_sprite_wm; 4134 dev_priv->display.update_sprite_wm = sandybridge_update_sprite_wm;
4004 } else { 4135 } else {
4005 DRM_DEBUG_KMS("Failed to read display plane latency. " 4136 DRM_DEBUG_KMS("Failed to read display plane latency. "
@@ -4119,7 +4250,8 @@ static void __gen6_gt_force_wake_get(struct drm_i915_private *dev_priv)
4119static void __gen6_gt_force_wake_mt_reset(struct drm_i915_private *dev_priv) 4250static void __gen6_gt_force_wake_mt_reset(struct drm_i915_private *dev_priv)
4120{ 4251{
4121 I915_WRITE_NOTRACE(FORCEWAKE_MT, _MASKED_BIT_DISABLE(0xffff)); 4252 I915_WRITE_NOTRACE(FORCEWAKE_MT, _MASKED_BIT_DISABLE(0xffff));
4122 POSTING_READ(ECOBUS); /* something from same cacheline, but !FORCEWAKE */ 4253 /* something from same cacheline, but !FORCEWAKE_MT */
4254 POSTING_READ(ECOBUS);
4123} 4255}
4124 4256
4125static void __gen6_gt_force_wake_mt_get(struct drm_i915_private *dev_priv) 4257static void __gen6_gt_force_wake_mt_get(struct drm_i915_private *dev_priv)
@@ -4136,7 +4268,8 @@ static void __gen6_gt_force_wake_mt_get(struct drm_i915_private *dev_priv)
4136 DRM_ERROR("Timed out waiting for forcewake old ack to clear.\n"); 4268 DRM_ERROR("Timed out waiting for forcewake old ack to clear.\n");
4137 4269
4138 I915_WRITE_NOTRACE(FORCEWAKE_MT, _MASKED_BIT_ENABLE(FORCEWAKE_KERNEL)); 4270 I915_WRITE_NOTRACE(FORCEWAKE_MT, _MASKED_BIT_ENABLE(FORCEWAKE_KERNEL));
4139 POSTING_READ(ECOBUS); /* something from same cacheline, but !FORCEWAKE */ 4271 /* something from same cacheline, but !FORCEWAKE_MT */
4272 POSTING_READ(ECOBUS);
4140 4273
4141 if (wait_for_atomic((I915_READ_NOTRACE(forcewake_ack) & 1), 4274 if (wait_for_atomic((I915_READ_NOTRACE(forcewake_ack) & 1),
4142 FORCEWAKE_ACK_TIMEOUT_MS)) 4275 FORCEWAKE_ACK_TIMEOUT_MS))
@@ -4173,14 +4306,16 @@ void gen6_gt_check_fifodbg(struct drm_i915_private *dev_priv)
4173static void __gen6_gt_force_wake_put(struct drm_i915_private *dev_priv) 4306static void __gen6_gt_force_wake_put(struct drm_i915_private *dev_priv)
4174{ 4307{
4175 I915_WRITE_NOTRACE(FORCEWAKE, 0); 4308 I915_WRITE_NOTRACE(FORCEWAKE, 0);
4176 /* gen6_gt_check_fifodbg doubles as the POSTING_READ */ 4309 /* something from same cacheline, but !FORCEWAKE */
4310 POSTING_READ(ECOBUS);
4177 gen6_gt_check_fifodbg(dev_priv); 4311 gen6_gt_check_fifodbg(dev_priv);
4178} 4312}
4179 4313
4180static void __gen6_gt_force_wake_mt_put(struct drm_i915_private *dev_priv) 4314static void __gen6_gt_force_wake_mt_put(struct drm_i915_private *dev_priv)
4181{ 4315{
4182 I915_WRITE_NOTRACE(FORCEWAKE_MT, _MASKED_BIT_DISABLE(FORCEWAKE_KERNEL)); 4316 I915_WRITE_NOTRACE(FORCEWAKE_MT, _MASKED_BIT_DISABLE(FORCEWAKE_KERNEL));
4183 /* gen6_gt_check_fifodbg doubles as the POSTING_READ */ 4317 /* something from same cacheline, but !FORCEWAKE_MT */
4318 POSTING_READ(ECOBUS);
4184 gen6_gt_check_fifodbg(dev_priv); 4319 gen6_gt_check_fifodbg(dev_priv);
4185} 4320}
4186 4321
@@ -4220,6 +4355,8 @@ int __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv)
4220static void vlv_force_wake_reset(struct drm_i915_private *dev_priv) 4355static void vlv_force_wake_reset(struct drm_i915_private *dev_priv)
4221{ 4356{
4222 I915_WRITE_NOTRACE(FORCEWAKE_VLV, _MASKED_BIT_DISABLE(0xffff)); 4357 I915_WRITE_NOTRACE(FORCEWAKE_VLV, _MASKED_BIT_DISABLE(0xffff));
4358 /* something from same cacheline, but !FORCEWAKE_VLV */
4359 POSTING_READ(FORCEWAKE_ACK_VLV);
4223} 4360}
4224 4361
4225static void vlv_force_wake_get(struct drm_i915_private *dev_priv) 4362static void vlv_force_wake_get(struct drm_i915_private *dev_priv)
@@ -4240,7 +4377,8 @@ static void vlv_force_wake_get(struct drm_i915_private *dev_priv)
4240static void vlv_force_wake_put(struct drm_i915_private *dev_priv) 4377static void vlv_force_wake_put(struct drm_i915_private *dev_priv)
4241{ 4378{
4242 I915_WRITE_NOTRACE(FORCEWAKE_VLV, _MASKED_BIT_DISABLE(FORCEWAKE_KERNEL)); 4379 I915_WRITE_NOTRACE(FORCEWAKE_VLV, _MASKED_BIT_DISABLE(FORCEWAKE_KERNEL));
4243 /* The below doubles as a POSTING_READ */ 4380 /* something from same cacheline, but !FORCEWAKE_VLV */
4381 POSTING_READ(FORCEWAKE_ACK_VLV);
4244 gen6_gt_check_fifodbg(dev_priv); 4382 gen6_gt_check_fifodbg(dev_priv);
4245} 4383}
4246 4384
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 2346b920bd86..42ff97d667d2 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -505,13 +505,25 @@ static int init_render_ring(struct intel_ring_buffer *ring)
505 struct drm_i915_private *dev_priv = dev->dev_private; 505 struct drm_i915_private *dev_priv = dev->dev_private;
506 int ret = init_ring_common(ring); 506 int ret = init_ring_common(ring);
507 507
508 if (INTEL_INFO(dev)->gen > 3) { 508 if (INTEL_INFO(dev)->gen > 3)
509 I915_WRITE(MI_MODE, _MASKED_BIT_ENABLE(VS_TIMER_DISPATCH)); 509 I915_WRITE(MI_MODE, _MASKED_BIT_ENABLE(VS_TIMER_DISPATCH));
510 if (IS_GEN7(dev)) 510
511 I915_WRITE(GFX_MODE_GEN7, 511 /* We need to disable the AsyncFlip performance optimisations in order
512 _MASKED_BIT_DISABLE(GFX_TLB_INVALIDATE_ALWAYS) | 512 * to use MI_WAIT_FOR_EVENT within the CS. It should already be
513 _MASKED_BIT_ENABLE(GFX_REPLAY_MODE)); 513 * programmed to '1' on all products.
514 } 514 */
515 if (INTEL_INFO(dev)->gen >= 6)
516 I915_WRITE(MI_MODE, _MASKED_BIT_ENABLE(ASYNC_FLIP_PERF_DISABLE));
517
518 /* Required for the hardware to program scanline values for waiting */
519 if (INTEL_INFO(dev)->gen == 6)
520 I915_WRITE(GFX_MODE,
521 _MASKED_BIT_ENABLE(GFX_TLB_INVALIDATE_ALWAYS));
522
523 if (IS_GEN7(dev))
524 I915_WRITE(GFX_MODE_GEN7,
525 _MASKED_BIT_DISABLE(GFX_TLB_INVALIDATE_ALWAYS) |
526 _MASKED_BIT_ENABLE(GFX_REPLAY_MODE));
515 527
516 if (INTEL_INFO(dev)->gen >= 5) { 528 if (INTEL_INFO(dev)->gen >= 5) {
517 ret = init_pipe_control(ring); 529 ret = init_pipe_control(ring);
@@ -547,9 +559,14 @@ static int init_render_ring(struct intel_ring_buffer *ring)
547 559
548static void render_ring_cleanup(struct intel_ring_buffer *ring) 560static void render_ring_cleanup(struct intel_ring_buffer *ring)
549{ 561{
562 struct drm_device *dev = ring->dev;
563
550 if (!ring->private) 564 if (!ring->private)
551 return; 565 return;
552 566
567 if (HAS_BROKEN_CS_TLB(dev))
568 drm_gem_object_unreference(to_gem_object(ring->private));
569
553 cleanup_pipe_control(ring); 570 cleanup_pipe_control(ring);
554} 571}
555 572
@@ -969,6 +986,8 @@ i965_dispatch_execbuffer(struct intel_ring_buffer *ring,
969 return 0; 986 return 0;
970} 987}
971 988
989/* Just userspace ABI convention to limit the wa batch bo to a resonable size */
990#define I830_BATCH_LIMIT (256*1024)
972static int 991static int
973i830_dispatch_execbuffer(struct intel_ring_buffer *ring, 992i830_dispatch_execbuffer(struct intel_ring_buffer *ring,
974 u32 offset, u32 len, 993 u32 offset, u32 len,
@@ -976,15 +995,47 @@ i830_dispatch_execbuffer(struct intel_ring_buffer *ring,
976{ 995{
977 int ret; 996 int ret;
978 997
979 ret = intel_ring_begin(ring, 4); 998 if (flags & I915_DISPATCH_PINNED) {
980 if (ret) 999 ret = intel_ring_begin(ring, 4);
981 return ret; 1000 if (ret)
1001 return ret;
982 1002
983 intel_ring_emit(ring, MI_BATCH_BUFFER); 1003 intel_ring_emit(ring, MI_BATCH_BUFFER);
984 intel_ring_emit(ring, offset | (flags & I915_DISPATCH_SECURE ? 0 : MI_BATCH_NON_SECURE)); 1004 intel_ring_emit(ring, offset | (flags & I915_DISPATCH_SECURE ? 0 : MI_BATCH_NON_SECURE));
985 intel_ring_emit(ring, offset + len - 8); 1005 intel_ring_emit(ring, offset + len - 8);
986 intel_ring_emit(ring, 0); 1006 intel_ring_emit(ring, MI_NOOP);
987 intel_ring_advance(ring); 1007 intel_ring_advance(ring);
1008 } else {
1009 struct drm_i915_gem_object *obj = ring->private;
1010 u32 cs_offset = obj->gtt_offset;
1011
1012 if (len > I830_BATCH_LIMIT)
1013 return -ENOSPC;
1014
1015 ret = intel_ring_begin(ring, 9+3);
1016 if (ret)
1017 return ret;
1018 /* Blit the batch (which has now all relocs applied) to the stable batch
1019 * scratch bo area (so that the CS never stumbles over its tlb
1020 * invalidation bug) ... */
1021 intel_ring_emit(ring, XY_SRC_COPY_BLT_CMD |
1022 XY_SRC_COPY_BLT_WRITE_ALPHA |
1023 XY_SRC_COPY_BLT_WRITE_RGB);
1024 intel_ring_emit(ring, BLT_DEPTH_32 | BLT_ROP_GXCOPY | 4096);
1025 intel_ring_emit(ring, 0);
1026 intel_ring_emit(ring, (DIV_ROUND_UP(len, 4096) << 16) | 1024);
1027 intel_ring_emit(ring, cs_offset);
1028 intel_ring_emit(ring, 0);
1029 intel_ring_emit(ring, 4096);
1030 intel_ring_emit(ring, offset);
1031 intel_ring_emit(ring, MI_FLUSH);
1032
1033 /* ... and execute it. */
1034 intel_ring_emit(ring, MI_BATCH_BUFFER);
1035 intel_ring_emit(ring, cs_offset | (flags & I915_DISPATCH_SECURE ? 0 : MI_BATCH_NON_SECURE));
1036 intel_ring_emit(ring, cs_offset + len - 8);
1037 intel_ring_advance(ring);
1038 }
988 1039
989 return 0; 1040 return 0;
990} 1041}
@@ -1596,6 +1647,27 @@ int intel_init_render_ring_buffer(struct drm_device *dev)
1596 ring->init = init_render_ring; 1647 ring->init = init_render_ring;
1597 ring->cleanup = render_ring_cleanup; 1648 ring->cleanup = render_ring_cleanup;
1598 1649
1650 /* Workaround batchbuffer to combat CS tlb bug. */
1651 if (HAS_BROKEN_CS_TLB(dev)) {
1652 struct drm_i915_gem_object *obj;
1653 int ret;
1654
1655 obj = i915_gem_alloc_object(dev, I830_BATCH_LIMIT);
1656 if (obj == NULL) {
1657 DRM_ERROR("Failed to allocate batch bo\n");
1658 return -ENOMEM;
1659 }
1660
1661 ret = i915_gem_object_pin(obj, 0, true, false);
1662 if (ret != 0) {
1663 drm_gem_object_unreference(&obj->base);
1664 DRM_ERROR("Failed to ping batch bo\n");
1665 return ret;
1666 }
1667
1668 ring->private = obj;
1669 }
1670
1599 return intel_init_ring_buffer(dev, ring); 1671 return intel_init_ring_buffer(dev, ring);
1600} 1672}
1601 1673
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
index 526182ed0c6d..6af87cd05725 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.h
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
@@ -94,6 +94,7 @@ struct intel_ring_buffer {
94 u32 offset, u32 length, 94 u32 offset, u32 length,
95 unsigned flags); 95 unsigned flags);
96#define I915_DISPATCH_SECURE 0x1 96#define I915_DISPATCH_SECURE 0x1
97#define I915_DISPATCH_PINNED 0x2
97 void (*cleanup)(struct intel_ring_buffer *ring); 98 void (*cleanup)(struct intel_ring_buffer *ring);
98 int (*sync_to)(struct intel_ring_buffer *ring, 99 int (*sync_to)(struct intel_ring_buffer *ring,
99 struct intel_ring_buffer *to, 100 struct intel_ring_buffer *to,
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 827dcd4edf1c..d7b060e0a231 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -120,11 +120,10 @@ ivb_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb,
120 I915_WRITE(SPRSTRIDE(pipe), fb->pitches[0]); 120 I915_WRITE(SPRSTRIDE(pipe), fb->pitches[0]);
121 I915_WRITE(SPRPOS(pipe), (crtc_y << 16) | crtc_x); 121 I915_WRITE(SPRPOS(pipe), (crtc_y << 16) | crtc_x);
122 122
123 linear_offset = y * fb->pitches[0] + x * (fb->bits_per_pixel / 8); 123 linear_offset = y * fb->pitches[0] + x * pixel_size;
124 sprsurf_offset = 124 sprsurf_offset =
125 intel_gen4_compute_offset_xtiled(&x, &y, 125 intel_gen4_compute_offset_xtiled(&x, &y,
126 fb->bits_per_pixel / 8, 126 pixel_size, fb->pitches[0]);
127 fb->pitches[0]);
128 linear_offset -= sprsurf_offset; 127 linear_offset -= sprsurf_offset;
129 128
130 /* HSW consolidates SPRTILEOFF and SPRLINOFF into a single SPROFFSET 129 /* HSW consolidates SPRTILEOFF and SPRLINOFF into a single SPROFFSET
@@ -286,11 +285,10 @@ ilk_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb,
286 I915_WRITE(DVSSTRIDE(pipe), fb->pitches[0]); 285 I915_WRITE(DVSSTRIDE(pipe), fb->pitches[0]);
287 I915_WRITE(DVSPOS(pipe), (crtc_y << 16) | crtc_x); 286 I915_WRITE(DVSPOS(pipe), (crtc_y << 16) | crtc_x);
288 287
289 linear_offset = y * fb->pitches[0] + x * (fb->bits_per_pixel / 8); 288 linear_offset = y * fb->pitches[0] + x * pixel_size;
290 dvssurf_offset = 289 dvssurf_offset =
291 intel_gen4_compute_offset_xtiled(&x, &y, 290 intel_gen4_compute_offset_xtiled(&x, &y,
292 fb->bits_per_pixel / 8, 291 pixel_size, fb->pitches[0]);
293 fb->pitches[0]);
294 linear_offset -= dvssurf_offset; 292 linear_offset -= dvssurf_offset;
295 293
296 if (obj->tiling_mode != I915_TILING_NONE) 294 if (obj->tiling_mode != I915_TILING_NONE)
diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c
index 1e910117b0a2..122b571ccc7c 100644
--- a/drivers/gpu/drm/mgag200/mgag200_drv.c
+++ b/drivers/gpu/drm/mgag200/mgag200_drv.c
@@ -60,8 +60,7 @@ static void mgag200_kick_out_firmware_fb(struct pci_dev *pdev)
60} 60}
61 61
62 62
63static int __devinit 63static int mga_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
64mga_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
65{ 64{
66 mgag200_kick_out_firmware_fb(pdev); 65 mgag200_kick_out_firmware_fb(pdev);
67 66
diff --git a/drivers/gpu/drm/nouveau/core/core/client.c b/drivers/gpu/drm/nouveau/core/core/client.c
index c617f0480071..8bbb58f94a19 100644
--- a/drivers/gpu/drm/nouveau/core/core/client.c
+++ b/drivers/gpu/drm/nouveau/core/core/client.c
@@ -66,10 +66,8 @@ nouveau_client_create_(const char *name, u64 devname, const char *cfg,
66 66
67 ret = nouveau_handle_create(nv_object(client), ~0, ~0, 67 ret = nouveau_handle_create(nv_object(client), ~0, ~0,
68 nv_object(client), &client->root); 68 nv_object(client), &client->root);
69 if (ret) { 69 if (ret)
70 nouveau_namedb_destroy(&client->base);
71 return ret; 70 return ret;
72 }
73 71
74 /* prevent init/fini being called, os in in charge of this */ 72 /* prevent init/fini being called, os in in charge of this */
75 atomic_set(&nv_object(client)->usecount, 2); 73 atomic_set(&nv_object(client)->usecount, 2);
diff --git a/drivers/gpu/drm/nouveau/core/core/handle.c b/drivers/gpu/drm/nouveau/core/core/handle.c
index b8d2cbf8a7a7..264c2b338ac3 100644
--- a/drivers/gpu/drm/nouveau/core/core/handle.c
+++ b/drivers/gpu/drm/nouveau/core/core/handle.c
@@ -109,7 +109,7 @@ nouveau_handle_create(struct nouveau_object *parent, u32 _parent, u32 _handle,
109 while (!nv_iclass(namedb, NV_NAMEDB_CLASS)) 109 while (!nv_iclass(namedb, NV_NAMEDB_CLASS))
110 namedb = namedb->parent; 110 namedb = namedb->parent;
111 111
112 handle = *phandle = kzalloc(sizeof(*handle), GFP_KERNEL); 112 handle = kzalloc(sizeof(*handle), GFP_KERNEL);
113 if (!handle) 113 if (!handle)
114 return -ENOMEM; 114 return -ENOMEM;
115 115
@@ -146,6 +146,9 @@ nouveau_handle_create(struct nouveau_object *parent, u32 _parent, u32 _handle,
146 } 146 }
147 147
148 hprintk(handle, TRACE, "created\n"); 148 hprintk(handle, TRACE, "created\n");
149
150 *phandle = handle;
151
149 return 0; 152 return 0;
150} 153}
151 154
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c
index 0f09af135415..ca1a7d76a95b 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c
@@ -851,20 +851,23 @@ exec_script(struct nv50_disp_priv *priv, int head, int id)
851 for (i = 0; !(ctrl & (1 << head)) && i < 3; i++) 851 for (i = 0; !(ctrl & (1 << head)) && i < 3; i++)
852 ctrl = nv_rd32(priv, 0x610b5c + (i * 8)); 852 ctrl = nv_rd32(priv, 0x610b5c + (i * 8));
853 853
854 if (nv_device(priv)->chipset < 0x90 || 854 if (!(ctrl & (1 << head))) {
855 nv_device(priv)->chipset == 0x92 || 855 if (nv_device(priv)->chipset < 0x90 ||
856 nv_device(priv)->chipset == 0xa0) { 856 nv_device(priv)->chipset == 0x92 ||
857 for (i = 0; !(ctrl & (1 << head)) && i < 2; i++) 857 nv_device(priv)->chipset == 0xa0) {
858 ctrl = nv_rd32(priv, 0x610b74 + (i * 8)); 858 for (i = 0; !(ctrl & (1 << head)) && i < 2; i++)
859 i += 3; 859 ctrl = nv_rd32(priv, 0x610b74 + (i * 8));
860 } else { 860 i += 4;
861 for (i = 0; !(ctrl & (1 << head)) && i < 4; i++) 861 } else {
862 ctrl = nv_rd32(priv, 0x610798 + (i * 8)); 862 for (i = 0; !(ctrl & (1 << head)) && i < 4; i++)
863 i += 3; 863 ctrl = nv_rd32(priv, 0x610798 + (i * 8));
864 i += 4;
865 }
864 } 866 }
865 867
866 if (!(ctrl & (1 << head))) 868 if (!(ctrl & (1 << head)))
867 return false; 869 return false;
870 i--;
868 871
869 data = exec_lookup(priv, head, i, ctrl, &dcb, &ver, &hdr, &cnt, &len, &info); 872 data = exec_lookup(priv, head, i, ctrl, &dcb, &ver, &hdr, &cnt, &len, &info);
870 if (data) { 873 if (data) {
@@ -898,20 +901,23 @@ exec_clkcmp(struct nv50_disp_priv *priv, int head, int id, u32 pclk,
898 for (i = 0; !(ctrl & (1 << head)) && i < 3; i++) 901 for (i = 0; !(ctrl & (1 << head)) && i < 3; i++)
899 ctrl = nv_rd32(priv, 0x610b58 + (i * 8)); 902 ctrl = nv_rd32(priv, 0x610b58 + (i * 8));
900 903
901 if (nv_device(priv)->chipset < 0x90 || 904 if (!(ctrl & (1 << head))) {
902 nv_device(priv)->chipset == 0x92 || 905 if (nv_device(priv)->chipset < 0x90 ||
903 nv_device(priv)->chipset == 0xa0) { 906 nv_device(priv)->chipset == 0x92 ||
904 for (i = 0; !(ctrl & (1 << head)) && i < 2; i++) 907 nv_device(priv)->chipset == 0xa0) {
905 ctrl = nv_rd32(priv, 0x610b70 + (i * 8)); 908 for (i = 0; !(ctrl & (1 << head)) && i < 2; i++)
906 i += 3; 909 ctrl = nv_rd32(priv, 0x610b70 + (i * 8));
907 } else { 910 i += 4;
908 for (i = 0; !(ctrl & (1 << head)) && i < 4; i++) 911 } else {
909 ctrl = nv_rd32(priv, 0x610794 + (i * 8)); 912 for (i = 0; !(ctrl & (1 << head)) && i < 4; i++)
910 i += 3; 913 ctrl = nv_rd32(priv, 0x610794 + (i * 8));
914 i += 4;
915 }
911 } 916 }
912 917
913 if (!(ctrl & (1 << head))) 918 if (!(ctrl & (1 << head)))
914 return 0x0000; 919 return 0x0000;
920 i--;
915 921
916 data = exec_lookup(priv, head, i, ctrl, outp, &ver, &hdr, &cnt, &len, &info1); 922 data = exec_lookup(priv, head, i, ctrl, outp, &ver, &hdr, &cnt, &len, &info1);
917 if (!data) 923 if (!data)
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc
index 7b715fda2763..62ab231cd6b6 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc
@@ -57,6 +57,11 @@ chipsets:
57.b16 #nve4_gpc_mmio_tail 57.b16 #nve4_gpc_mmio_tail
58.b16 #nve4_tpc_mmio_head 58.b16 #nve4_tpc_mmio_head
59.b16 #nve4_tpc_mmio_tail 59.b16 #nve4_tpc_mmio_tail
60.b8 0xe6 0 0 0
61.b16 #nve4_gpc_mmio_head
62.b16 #nve4_gpc_mmio_tail
63.b16 #nve4_tpc_mmio_head
64.b16 #nve4_tpc_mmio_tail
60.b8 0 0 0 0 65.b8 0 0 0 0
61 66
62// GPC mmio lists 67// GPC mmio lists
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc.h
index 26c2165bad0f..09ee4702c8b2 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc.h
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc.h
@@ -34,13 +34,16 @@ uint32_t nve0_grgpc_data[] = {
34 0x00000000, 34 0x00000000,
35/* 0x0064: chipsets */ 35/* 0x0064: chipsets */
36 0x000000e4, 36 0x000000e4,
37 0x01040080, 37 0x0110008c,
38 0x014c0104, 38 0x01580110,
39 0x000000e7, 39 0x000000e7,
40 0x01040080, 40 0x0110008c,
41 0x014c0104, 41 0x01580110,
42 0x000000e6,
43 0x0110008c,
44 0x01580110,
42 0x00000000, 45 0x00000000,
43/* 0x0080: nve4_gpc_mmio_head */ 46/* 0x008c: nve4_gpc_mmio_head */
44 0x00000380, 47 0x00000380,
45 0x04000400, 48 0x04000400,
46 0x0800040c, 49 0x0800040c,
@@ -74,8 +77,8 @@ uint32_t nve0_grgpc_data[] = {
74 0x14003100, 77 0x14003100,
75 0x000031d0, 78 0x000031d0,
76 0x040031e0, 79 0x040031e0,
77/* 0x0104: nve4_gpc_mmio_tail */ 80/* 0x0110: nve4_gpc_mmio_tail */
78/* 0x0104: nve4_tpc_mmio_head */ 81/* 0x0110: nve4_tpc_mmio_head */
79 0x00000048, 82 0x00000048,
80 0x00000064, 83 0x00000064,
81 0x00000088, 84 0x00000088,
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc
index acfc457654bd..0bcfa4d447e5 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc
@@ -754,6 +754,16 @@ ctx_mmio_exec:
754// on load it means: "a save preceeded this load" 754// on load it means: "a save preceeded this load"
755// 755//
756ctx_xfer: 756ctx_xfer:
757 // according to mwk, some kind of wait for idle
758 mov $r15 0xc00
759 shl b32 $r15 6
760 mov $r14 4
761 iowr I[$r15 + 0x200] $r14
762 ctx_xfer_idle:
763 iord $r14 I[$r15 + 0x000]
764 and $r14 0x2000
765 bra ne #ctx_xfer_idle
766
757 bra not $p1 #ctx_xfer_pre 767 bra not $p1 #ctx_xfer_pre
758 bra $p2 #ctx_xfer_pre_load 768 bra $p2 #ctx_xfer_pre_load
759 ctx_xfer_pre: 769 ctx_xfer_pre:
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h
index 85a8d556f484..bb03d2a1d57b 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h
@@ -799,79 +799,80 @@ uint32_t nvc0_grhub_code[] = {
799 0x01fa0613, 799 0x01fa0613,
800 0xf803f806, 800 0xf803f806,
801/* 0x0829: ctx_xfer */ 801/* 0x0829: ctx_xfer */
802 0x0611f400, 802 0x00f7f100,
803/* 0x082f: ctx_xfer_pre */ 803 0x06f4b60c,
804 0xf01102f4, 804 0xd004e7f0,
805 0x21f510f7, 805/* 0x0836: ctx_xfer_idle */
806 0x21f50698, 806 0xfecf80fe,
807 0x11f40631, 807 0x00e4f100,
808/* 0x083d: ctx_xfer_pre_load */ 808 0xf91bf420,
809 0x02f7f01c, 809 0xf40611f4,
810 0x065721f5, 810/* 0x0846: ctx_xfer_pre */
811 0x066621f5, 811 0xf7f01102,
812 0x067821f5, 812 0x9821f510,
813 0x21f5f4bd, 813 0x3121f506,
814 0x21f50657, 814 0x1c11f406,
815/* 0x0856: ctx_xfer_exec */ 815/* 0x0854: ctx_xfer_pre_load */
816 0x019806b8, 816 0xf502f7f0,
817 0x1427f116, 817 0xf5065721,
818 0x0624b604, 818 0xf5066621,
819 0xf10020d0, 819 0xbd067821,
820 0xf0a500e7, 820 0x5721f5f4,
821 0x1fb941e3, 821 0xb821f506,
822 0x8d21f402, 822/* 0x086d: ctx_xfer_exec */
823 0xf004e0b6, 823 0x16019806,
824 0x2cf001fc, 824 0x041427f1,
825 0x0124b602, 825 0xd00624b6,
826 0xf405f2fd, 826 0xe7f10020,
827 0x17f18d21, 827 0xe3f0a500,
828 0x13f04afc, 828 0x021fb941,
829 0x0c27f002, 829 0xb68d21f4,
830 0xf50012d0, 830 0xfcf004e0,
831 0xf1020721, 831 0x022cf001,
832 0xf047fc27, 832 0xfd0124b6,
833 0x20d00223, 833 0x21f405f2,
834 0x012cf000, 834 0xfc17f18d,
835 0xd00320b6, 835 0x0213f04a,
836 0xacf00012, 836 0xd00c27f0,
837 0x06a5f001, 837 0x21f50012,
838 0x9800b7f0, 838 0x27f10207,
839 0x0d98140c, 839 0x23f047fc,
840 0x00e7f015, 840 0x0020d002,
841 0x015c21f5, 841 0xb6012cf0,
842 0xf508a7f0, 842 0x12d00320,
843 0xf5010321, 843 0x01acf000,
844 0xf4020721, 844 0xf006a5f0,
845 0xa7f02201, 845 0x0c9800b7,
846 0xc921f40c, 846 0x150d9814,
847 0x0a1017f1, 847 0xf500e7f0,
848 0xf00614b6, 848 0xf0015c21,
849 0x12d00527, 849 0x21f508a7,
850/* 0x08dd: ctx_xfer_post_save_wait */ 850 0x21f50103,
851 0x0012cf00, 851 0x01f40207,
852 0xf40522fd, 852 0x0ca7f022,
853 0x02f4fa1b, 853 0xf1c921f4,
854/* 0x08e9: ctx_xfer_post */ 854 0xb60a1017,
855 0x02f7f032, 855 0x27f00614,
856 0x065721f5, 856 0x0012d005,
857 0x21f5f4bd, 857/* 0x08f4: ctx_xfer_post_save_wait */
858 0x21f50698, 858 0xfd0012cf,
859 0x21f50226, 859 0x1bf40522,
860 0xf4bd0666, 860 0x3202f4fa,
861 0x065721f5, 861/* 0x0900: ctx_xfer_post */
862 0x981011f4, 862 0xf502f7f0,
863 0x11fd8001, 863 0xbd065721,
864 0x070bf405, 864 0x9821f5f4,
865 0x07df21f5, 865 0x2621f506,
866/* 0x0914: ctx_xfer_no_post_mmio */ 866 0x6621f502,
867 0x064921f5, 867 0xf5f4bd06,
868/* 0x0918: ctx_xfer_done */ 868 0xf4065721,
869 0x000000f8, 869 0x01981011,
870 0x00000000, 870 0x0511fd80,
871 0x00000000, 871 0xf5070bf4,
872 0x00000000, 872/* 0x092b: ctx_xfer_no_post_mmio */
873 0x00000000, 873 0xf507df21,
874 0x00000000, 874/* 0x092f: ctx_xfer_done */
875 0xf8064921,
875 0x00000000, 876 0x00000000,
876 0x00000000, 877 0x00000000,
877 0x00000000, 878 0x00000000,
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc
index 138eeaa28665..7fe9d7cf486b 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc
@@ -44,6 +44,9 @@ chipsets:
44.b8 0xe7 0 0 0 44.b8 0xe7 0 0 0
45.b16 #nve4_hub_mmio_head 45.b16 #nve4_hub_mmio_head
46.b16 #nve4_hub_mmio_tail 46.b16 #nve4_hub_mmio_tail
47.b8 0xe6 0 0 0
48.b16 #nve4_hub_mmio_head
49.b16 #nve4_hub_mmio_tail
47.b8 0 0 0 0 50.b8 0 0 0 0
48 51
49nve4_hub_mmio_head: 52nve4_hub_mmio_head:
@@ -680,6 +683,16 @@ ctx_mmio_exec:
680// on load it means: "a save preceeded this load" 683// on load it means: "a save preceeded this load"
681// 684//
682ctx_xfer: 685ctx_xfer:
686 // according to mwk, some kind of wait for idle
687 mov $r15 0xc00
688 shl b32 $r15 6
689 mov $r14 4
690 iowr I[$r15 + 0x200] $r14
691 ctx_xfer_idle:
692 iord $r14 I[$r15 + 0x000]
693 and $r14 0x2000
694 bra ne #ctx_xfer_idle
695
683 bra not $p1 #ctx_xfer_pre 696 bra not $p1 #ctx_xfer_pre
684 bra $p2 #ctx_xfer_pre_load 697 bra $p2 #ctx_xfer_pre_load
685 ctx_xfer_pre: 698 ctx_xfer_pre:
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h
index decf0c60ca3b..e3421af68ab9 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h
@@ -30,11 +30,13 @@ uint32_t nve0_grhub_data[] = {
30 0x00000000, 30 0x00000000,
31/* 0x005c: chipsets */ 31/* 0x005c: chipsets */
32 0x000000e4, 32 0x000000e4,
33 0x013c0070, 33 0x01440078,
34 0x000000e7, 34 0x000000e7,
35 0x013c0070, 35 0x01440078,
36 0x000000e6,
37 0x01440078,
36 0x00000000, 38 0x00000000,
37/* 0x0070: nve4_hub_mmio_head */ 39/* 0x0078: nve4_hub_mmio_head */
38 0x0417e91c, 40 0x0417e91c,
39 0x04400204, 41 0x04400204,
40 0x18404010, 42 0x18404010,
@@ -86,9 +88,7 @@ uint32_t nve0_grhub_data[] = {
86 0x00408840, 88 0x00408840,
87 0x08408900, 89 0x08408900,
88 0x00408980, 90 0x00408980,
89/* 0x013c: nve4_hub_mmio_tail */ 91/* 0x0144: nve4_hub_mmio_tail */
90 0x00000000,
91 0x00000000,
92 0x00000000, 92 0x00000000,
93 0x00000000, 93 0x00000000,
94 0x00000000, 94 0x00000000,
@@ -781,77 +781,78 @@ uint32_t nve0_grhub_code[] = {
781 0x0613f002, 781 0x0613f002,
782 0xf80601fa, 782 0xf80601fa,
783/* 0x07fb: ctx_xfer */ 783/* 0x07fb: ctx_xfer */
784 0xf400f803, 784 0xf100f803,
785 0x02f40611, 785 0xb60c00f7,
786/* 0x0801: ctx_xfer_pre */ 786 0xe7f006f4,
787 0x10f7f00d, 787 0x80fed004,
788 0x067221f5, 788/* 0x0808: ctx_xfer_idle */
789/* 0x080b: ctx_xfer_pre_load */ 789 0xf100fecf,
790 0xf01c11f4, 790 0xf42000e4,
791 0x21f502f7, 791 0x11f4f91b,
792 0x21f50631, 792 0x0d02f406,
793 0x21f50640, 793/* 0x0818: ctx_xfer_pre */
794 0xf4bd0652, 794 0xf510f7f0,
795 0x063121f5, 795 0xf4067221,
796 0x069221f5, 796/* 0x0822: ctx_xfer_pre_load */
797/* 0x0824: ctx_xfer_exec */ 797 0xf7f01c11,
798 0xf1160198, 798 0x3121f502,
799 0xb6041427, 799 0x4021f506,
800 0x20d00624, 800 0x5221f506,
801 0x00e7f100, 801 0xf5f4bd06,
802 0x41e3f0a5, 802 0xf5063121,
803 0xf4021fb9, 803/* 0x083b: ctx_xfer_exec */
804 0xe0b68d21, 804 0x98069221,
805 0x01fcf004, 805 0x27f11601,
806 0xb6022cf0, 806 0x24b60414,
807 0xf2fd0124, 807 0x0020d006,
808 0x8d21f405, 808 0xa500e7f1,
809 0x4afc17f1, 809 0xb941e3f0,
810 0xf00213f0, 810 0x21f4021f,
811 0x12d00c27, 811 0x04e0b68d,
812 0x0721f500, 812 0xf001fcf0,
813 0xfc27f102, 813 0x24b6022c,
814 0x0223f047, 814 0x05f2fd01,
815 0xf00020d0, 815 0xf18d21f4,
816 0x20b6012c, 816 0xf04afc17,
817 0x0012d003, 817 0x27f00213,
818 0xf001acf0, 818 0x0012d00c,
819 0xb7f006a5, 819 0x020721f5,
820 0x140c9800, 820 0x47fc27f1,
821 0xf0150d98, 821 0xd00223f0,
822 0x21f500e7, 822 0x2cf00020,
823 0xa7f0015c, 823 0x0320b601,
824 0x0321f508, 824 0xf00012d0,
825 0x0721f501, 825 0xa5f001ac,
826 0x2201f402, 826 0x00b7f006,
827 0xf40ca7f0, 827 0x98140c98,
828 0x17f1c921, 828 0xe7f0150d,
829 0x14b60a10, 829 0x5c21f500,
830 0x0527f006, 830 0x08a7f001,
831/* 0x08ab: ctx_xfer_post_save_wait */ 831 0x010321f5,
832 0xcf0012d0, 832 0x020721f5,
833 0x22fd0012, 833 0xf02201f4,
834 0xfa1bf405, 834 0x21f40ca7,
835/* 0x08b7: ctx_xfer_post */ 835 0x1017f1c9,
836 0xf02e02f4, 836 0x0614b60a,
837 0x21f502f7, 837 0xd00527f0,
838 0xf4bd0631, 838/* 0x08c2: ctx_xfer_post_save_wait */
839 0x067221f5, 839 0x12cf0012,
840 0x022621f5, 840 0x0522fd00,
841 0x064021f5, 841 0xf4fa1bf4,
842 0x21f5f4bd, 842/* 0x08ce: ctx_xfer_post */
843 0x11f40631, 843 0xf7f02e02,
844 0x80019810, 844 0x3121f502,
845 0xf40511fd, 845 0xf5f4bd06,
846 0x21f5070b, 846 0xf5067221,
847/* 0x08e2: ctx_xfer_no_post_mmio */ 847 0xf5022621,
848/* 0x08e2: ctx_xfer_done */ 848 0xbd064021,
849 0x00f807b1, 849 0x3121f5f4,
850 0x00000000, 850 0x1011f406,
851 0x00000000, 851 0xfd800198,
852 0x00000000, 852 0x0bf40511,
853 0x00000000, 853 0xb121f507,
854 0x00000000, 854/* 0x08f9: ctx_xfer_no_post_mmio */
855 0x00000000, 855/* 0x08f9: ctx_xfer_done */
856 0x0000f807,
856 0x00000000, 857 0x00000000,
857}; 858};
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
index 47a02081d708..45aff5f5085a 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
@@ -516,18 +516,9 @@ nvc0_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
516{ 516{
517 struct nouveau_device *device = nv_device(parent); 517 struct nouveau_device *device = nv_device(parent);
518 struct nvc0_graph_priv *priv; 518 struct nvc0_graph_priv *priv;
519 bool enable = true;
520 int ret, i; 519 int ret, i;
521 520
522 switch (device->chipset) { 521 ret = nouveau_graph_create(parent, engine, oclass, true, &priv);
523 case 0xd9: /* known broken without binary driver firmware */
524 enable = false;
525 break;
526 default:
527 break;
528 }
529
530 ret = nouveau_graph_create(parent, engine, oclass, enable, &priv);
531 *pobject = nv_object(priv); 522 *pobject = nv_object(priv);
532 if (ret) 523 if (ret)
533 return ret; 524 return ret;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h
index 18d2210e12eb..a1e78de46456 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h
@@ -121,6 +121,7 @@ nvc0_graph_class(void *obj)
121 return 0x9297; 121 return 0x9297;
122 case 0xe4: 122 case 0xe4:
123 case 0xe7: 123 case 0xe7:
124 case 0xe6:
124 return 0xa097; 125 return 0xa097;
125 default: 126 default:
126 return 0; 127 return 0;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nve0.c b/drivers/gpu/drm/nouveau/core/engine/graph/nve0.c
index 539d4c72f192..9f82e9702b46 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nve0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nve0.c
@@ -203,7 +203,7 @@ nve0_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
203 struct nvc0_graph_priv *priv; 203 struct nvc0_graph_priv *priv;
204 int ret, i; 204 int ret, i;
205 205
206 ret = nouveau_graph_create(parent, engine, oclass, false, &priv); 206 ret = nouveau_graph_create(parent, engine, oclass, true, &priv);
207 *pobject = nv_object(priv); 207 *pobject = nv_object(priv);
208 if (ret) 208 if (ret)
209 return ret; 209 return ret;
@@ -252,6 +252,7 @@ nve0_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
252 priv->magic_not_rop_nr = 1; 252 priv->magic_not_rop_nr = 1;
253 break; 253 break;
254 case 0xe7: 254 case 0xe7:
255 case 0xe6:
255 priv->magic_not_rop_nr = 1; 256 priv->magic_not_rop_nr = 1;
256 break; 257 break;
257 default: 258 default:
diff --git a/drivers/gpu/drm/nouveau/core/include/core/client.h b/drivers/gpu/drm/nouveau/core/include/core/client.h
index 0193532ceac9..63acc0346ff2 100644
--- a/drivers/gpu/drm/nouveau/core/include/core/client.h
+++ b/drivers/gpu/drm/nouveau/core/include/core/client.h
@@ -36,6 +36,9 @@ nouveau_client(void *obj)
36 36
37int nouveau_client_create_(const char *name, u64 device, const char *cfg, 37int nouveau_client_create_(const char *name, u64 device, const char *cfg,
38 const char *dbg, int, void **); 38 const char *dbg, int, void **);
39#define nouveau_client_destroy(p) \
40 nouveau_namedb_destroy(&(p)->base)
41
39int nouveau_client_init(struct nouveau_client *); 42int nouveau_client_init(struct nouveau_client *);
40int nouveau_client_fini(struct nouveau_client *, bool suspend); 43int nouveau_client_fini(struct nouveau_client *, bool suspend);
41 44
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/bios.h b/drivers/gpu/drm/nouveau/core/include/subdev/bios.h
index d145b25e6be4..5bd1ca8cd20d 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/bios.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/bios.h
@@ -17,6 +17,7 @@ struct nouveau_bios {
17 u8 chip; 17 u8 chip;
18 u8 minor; 18 u8 minor;
19 u8 micro; 19 u8 micro;
20 u8 patch;
20 } version; 21 } version;
21}; 22};
22 23
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/bios/gpio.h b/drivers/gpu/drm/nouveau/core/include/subdev/bios/gpio.h
index 2bf178082a36..e6563b5cb08e 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/bios/gpio.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/bios/gpio.h
@@ -25,9 +25,11 @@ struct dcb_gpio_func {
25 u8 param; 25 u8 param;
26}; 26};
27 27
28u16 dcb_gpio_table(struct nouveau_bios *); 28u16 dcb_gpio_table(struct nouveau_bios *, u8 *ver, u8 *hdr, u8 *cnt, u8 *len);
29u16 dcb_gpio_entry(struct nouveau_bios *, int idx, int ent, u8 *ver); 29u16 dcb_gpio_entry(struct nouveau_bios *, int idx, int ent, u8 *ver, u8 *len);
30int dcb_gpio_parse(struct nouveau_bios *, int idx, u8 func, u8 line, 30u16 dcb_gpio_parse(struct nouveau_bios *, int idx, int ent, u8 *ver, u8 *len,
31 struct dcb_gpio_func *); 31 struct dcb_gpio_func *);
32u16 dcb_gpio_match(struct nouveau_bios *, int idx, u8 func, u8 line,
33 u8 *ver, u8 *len, struct dcb_gpio_func *);
32 34
33#endif 35#endif
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/bios/init.h b/drivers/gpu/drm/nouveau/core/include/subdev/bios/init.h
index e69a8bdc6e97..ca2f6bf37f46 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/bios/init.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/bios/init.h
@@ -13,6 +13,7 @@ struct nvbios_init {
13 u32 nested; 13 u32 nested;
14 u16 repeat; 14 u16 repeat;
15 u16 repend; 15 u16 repend;
16 u32 ramcfg;
16}; 17};
17 18
18int nvbios_exec(struct nvbios_init *); 19int nvbios_exec(struct nvbios_init *);
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/bios/pll.h b/drivers/gpu/drm/nouveau/core/include/subdev/bios/pll.h
index c345097592f2..b2f3d4d0aa49 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/bios/pll.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/bios/pll.h
@@ -38,6 +38,8 @@ enum nvbios_pll_type {
38 PLL_UNK42 = 0x42, 38 PLL_UNK42 = 0x42,
39 PLL_VPLL0 = 0x80, 39 PLL_VPLL0 = 0x80,
40 PLL_VPLL1 = 0x81, 40 PLL_VPLL1 = 0x81,
41 PLL_VPLL2 = 0x82,
42 PLL_VPLL3 = 0x83,
41 PLL_MAX = 0xff 43 PLL_MAX = 0xff
42}; 44};
43 45
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/gpio.h b/drivers/gpu/drm/nouveau/core/include/subdev/gpio.h
index 9ea2b12cc15d..b75e8f18e52c 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/gpio.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/gpio.h
@@ -11,7 +11,7 @@ struct nouveau_gpio {
11 struct nouveau_subdev base; 11 struct nouveau_subdev base;
12 12
13 /* hardware interfaces */ 13 /* hardware interfaces */
14 void (*reset)(struct nouveau_gpio *); 14 void (*reset)(struct nouveau_gpio *, u8 func);
15 int (*drive)(struct nouveau_gpio *, int line, int dir, int out); 15 int (*drive)(struct nouveau_gpio *, int line, int dir, int out);
16 int (*sense)(struct nouveau_gpio *, int line); 16 int (*sense)(struct nouveau_gpio *, int line);
17 void (*irq_enable)(struct nouveau_gpio *, int line, bool); 17 void (*irq_enable)(struct nouveau_gpio *, int line, bool);
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
index dd111947eb86..f621f69fa1a2 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
@@ -447,6 +447,7 @@ nouveau_bios_ctor(struct nouveau_object *parent,
447 bios->version.chip = nv_ro08(bios, bit_i.offset + 2); 447 bios->version.chip = nv_ro08(bios, bit_i.offset + 2);
448 bios->version.minor = nv_ro08(bios, bit_i.offset + 1); 448 bios->version.minor = nv_ro08(bios, bit_i.offset + 1);
449 bios->version.micro = nv_ro08(bios, bit_i.offset + 0); 449 bios->version.micro = nv_ro08(bios, bit_i.offset + 0);
450 bios->version.patch = nv_ro08(bios, bit_i.offset + 4);
450 } else 451 } else
451 if (bmp_version(bios)) { 452 if (bmp_version(bios)) {
452 bios->version.major = nv_ro08(bios, bios->bmp_offset + 13); 453 bios->version.major = nv_ro08(bios, bios->bmp_offset + 13);
@@ -455,9 +456,9 @@ nouveau_bios_ctor(struct nouveau_object *parent,
455 bios->version.micro = nv_ro08(bios, bios->bmp_offset + 10); 456 bios->version.micro = nv_ro08(bios, bios->bmp_offset + 10);
456 } 457 }
457 458
458 nv_info(bios, "version %02x.%02x.%02x.%02x\n", 459 nv_info(bios, "version %02x.%02x.%02x.%02x.%02x\n",
459 bios->version.major, bios->version.chip, 460 bios->version.major, bios->version.chip,
460 bios->version.minor, bios->version.micro); 461 bios->version.minor, bios->version.micro, bios->version.patch);
461 462
462 return 0; 463 return 0;
463} 464}
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c b/drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c
index c90d4aa3ae4f..c84e93fa6d95 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c
@@ -27,84 +27,105 @@
27#include <subdev/bios/gpio.h> 27#include <subdev/bios/gpio.h>
28 28
29u16 29u16
30dcb_gpio_table(struct nouveau_bios *bios) 30dcb_gpio_table(struct nouveau_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
31{ 31{
32 u8 ver, hdr, cnt, len; 32 u16 data = 0x0000;
33 u16 dcb = dcb_table(bios, &ver, &hdr, &cnt, &len); 33 u16 dcb = dcb_table(bios, ver, hdr, cnt, len);
34 if (dcb) { 34 if (dcb) {
35 if (ver >= 0x30 && hdr >= 0x0c) 35 if (*ver >= 0x30 && *hdr >= 0x0c)
36 return nv_ro16(bios, dcb + 0x0a); 36 data = nv_ro16(bios, dcb + 0x0a);
37 if (ver >= 0x22 && nv_ro08(bios, dcb - 1) >= 0x13) 37 else
38 return nv_ro16(bios, dcb - 0x0f); 38 if (*ver >= 0x22 && nv_ro08(bios, dcb - 1) >= 0x13)
39 data = nv_ro16(bios, dcb - 0x0f);
40
41 if (data) {
42 *ver = nv_ro08(bios, data + 0x00);
43 if (*ver < 0x30) {
44 *hdr = 3;
45 *cnt = nv_ro08(bios, data + 0x02);
46 *len = nv_ro08(bios, data + 0x01);
47 } else
48 if (*ver <= 0x41) {
49 *hdr = nv_ro08(bios, data + 0x01);
50 *cnt = nv_ro08(bios, data + 0x02);
51 *len = nv_ro08(bios, data + 0x03);
52 } else {
53 data = 0x0000;
54 }
55 }
39 } 56 }
40 return 0x0000; 57 return data;
41} 58}
42 59
43u16 60u16
44dcb_gpio_entry(struct nouveau_bios *bios, int idx, int ent, u8 *ver) 61dcb_gpio_entry(struct nouveau_bios *bios, int idx, int ent, u8 *ver, u8 *len)
45{ 62{
46 u16 gpio = dcb_gpio_table(bios); 63 u8 hdr, cnt;
47 if (gpio) { 64 u16 gpio = !idx ? dcb_gpio_table(bios, ver, &hdr, &cnt, len) : 0x0000;
48 *ver = nv_ro08(bios, gpio); 65 if (gpio && ent < cnt)
49 if (*ver < 0x30 && ent < nv_ro08(bios, gpio + 2)) 66 return gpio + hdr + (ent * *len);
50 return gpio + 3 + (ent * nv_ro08(bios, gpio + 1));
51 else if (ent < nv_ro08(bios, gpio + 2))
52 return gpio + nv_ro08(bios, gpio + 1) +
53 (ent * nv_ro08(bios, gpio + 3));
54 }
55 return 0x0000; 67 return 0x0000;
56} 68}
57 69
58int 70u16
59dcb_gpio_parse(struct nouveau_bios *bios, int idx, u8 func, u8 line, 71dcb_gpio_parse(struct nouveau_bios *bios, int idx, int ent, u8 *ver, u8 *len,
60 struct dcb_gpio_func *gpio) 72 struct dcb_gpio_func *gpio)
61{ 73{
62 u8 ver, hdr, cnt, len; 74 u16 data = dcb_gpio_entry(bios, idx, ent, ver, len);
63 u16 entry; 75 if (data) {
64 int i = -1; 76 if (*ver < 0x40) {
65 77 u16 info = nv_ro16(bios, data);
66 while ((entry = dcb_gpio_entry(bios, idx, ++i, &ver))) {
67 if (ver < 0x40) {
68 u16 data = nv_ro16(bios, entry);
69 *gpio = (struct dcb_gpio_func) { 78 *gpio = (struct dcb_gpio_func) {
70 .line = (data & 0x001f) >> 0, 79 .line = (info & 0x001f) >> 0,
71 .func = (data & 0x07e0) >> 5, 80 .func = (info & 0x07e0) >> 5,
72 .log[0] = (data & 0x1800) >> 11, 81 .log[0] = (info & 0x1800) >> 11,
73 .log[1] = (data & 0x6000) >> 13, 82 .log[1] = (info & 0x6000) >> 13,
74 .param = !!(data & 0x8000), 83 .param = !!(info & 0x8000),
75 }; 84 };
76 } else 85 } else
77 if (ver < 0x41) { 86 if (*ver < 0x41) {
78 u32 data = nv_ro32(bios, entry); 87 u32 info = nv_ro32(bios, data);
79 *gpio = (struct dcb_gpio_func) { 88 *gpio = (struct dcb_gpio_func) {
80 .line = (data & 0x0000001f) >> 0, 89 .line = (info & 0x0000001f) >> 0,
81 .func = (data & 0x0000ff00) >> 8, 90 .func = (info & 0x0000ff00) >> 8,
82 .log[0] = (data & 0x18000000) >> 27, 91 .log[0] = (info & 0x18000000) >> 27,
83 .log[1] = (data & 0x60000000) >> 29, 92 .log[1] = (info & 0x60000000) >> 29,
84 .param = !!(data & 0x80000000), 93 .param = !!(info & 0x80000000),
85 }; 94 };
86 } else { 95 } else {
87 u32 data = nv_ro32(bios, entry + 0); 96 u32 info = nv_ro32(bios, data + 0);
88 u8 data1 = nv_ro32(bios, entry + 4); 97 u8 info1 = nv_ro32(bios, data + 4);
89 *gpio = (struct dcb_gpio_func) { 98 *gpio = (struct dcb_gpio_func) {
90 .line = (data & 0x0000003f) >> 0, 99 .line = (info & 0x0000003f) >> 0,
91 .func = (data & 0x0000ff00) >> 8, 100 .func = (info & 0x0000ff00) >> 8,
92 .log[0] = (data1 & 0x30) >> 4, 101 .log[0] = (info1 & 0x30) >> 4,
93 .log[1] = (data1 & 0xc0) >> 6, 102 .log[1] = (info1 & 0xc0) >> 6,
94 .param = !!(data & 0x80000000), 103 .param = !!(info & 0x80000000),
95 }; 104 };
96 } 105 }
106 }
107
108 return data;
109}
97 110
111u16
112dcb_gpio_match(struct nouveau_bios *bios, int idx, u8 func, u8 line,
113 u8 *ver, u8 *len, struct dcb_gpio_func *gpio)
114{
115 u8 hdr, cnt, i = 0;
116 u16 data;
117
118 while ((data = dcb_gpio_parse(bios, idx, i++, ver, len, gpio))) {
98 if ((line == 0xff || line == gpio->line) && 119 if ((line == 0xff || line == gpio->line) &&
99 (func == 0xff || func == gpio->func)) 120 (func == 0xff || func == gpio->func))
100 return 0; 121 return data;
101 } 122 }
102 123
103 /* DCB 2.2, fixed TVDAC GPIO data */ 124 /* DCB 2.2, fixed TVDAC GPIO data */
104 if ((entry = dcb_table(bios, &ver, &hdr, &cnt, &len))) { 125 if ((data = dcb_table(bios, ver, &hdr, &cnt, len))) {
105 if (ver >= 0x22 && ver < 0x30 && func == DCB_GPIO_TVDAC0) { 126 if (*ver >= 0x22 && *ver < 0x30 && func == DCB_GPIO_TVDAC0) {
106 u8 conf = nv_ro08(bios, entry - 5); 127 u8 conf = nv_ro08(bios, data - 5);
107 u8 addr = nv_ro08(bios, entry - 4); 128 u8 addr = nv_ro08(bios, data - 4);
108 if (conf & 0x01) { 129 if (conf & 0x01) {
109 *gpio = (struct dcb_gpio_func) { 130 *gpio = (struct dcb_gpio_func) {
110 .func = DCB_GPIO_TVDAC0, 131 .func = DCB_GPIO_TVDAC0,
@@ -112,10 +133,11 @@ dcb_gpio_parse(struct nouveau_bios *bios, int idx, u8 func, u8 line,
112 .log[0] = !!(conf & 0x02), 133 .log[0] = !!(conf & 0x02),
113 .log[1] = !(conf & 0x02), 134 .log[1] = !(conf & 0x02),
114 }; 135 };
115 return 0; 136 *ver = 0x00;
137 return data;
116 } 138 }
117 } 139 }
118 } 140 }
119 141
120 return -EINVAL; 142 return 0x0000;
121} 143}
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/init.c b/drivers/gpu/drm/nouveau/core/subdev/bios/init.c
index ae168bbb86d8..690ed438b2ad 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/init.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/init.c
@@ -2,11 +2,12 @@
2#include <core/device.h> 2#include <core/device.h>
3 3
4#include <subdev/bios.h> 4#include <subdev/bios.h>
5#include <subdev/bios/conn.h>
6#include <subdev/bios/bmp.h> 5#include <subdev/bios/bmp.h>
7#include <subdev/bios/bit.h> 6#include <subdev/bios/bit.h>
7#include <subdev/bios/conn.h>
8#include <subdev/bios/dcb.h> 8#include <subdev/bios/dcb.h>
9#include <subdev/bios/dp.h> 9#include <subdev/bios/dp.h>
10#include <subdev/bios/gpio.h>
10#include <subdev/bios/init.h> 11#include <subdev/bios/init.h>
11#include <subdev/devinit.h> 12#include <subdev/devinit.h>
12#include <subdev/clock.h> 13#include <subdev/clock.h>
@@ -410,9 +411,25 @@ init_ram_restrict_group_count(struct nvbios_init *init)
410} 411}
411 412
412static u8 413static u8
414init_ram_restrict_strap(struct nvbios_init *init)
415{
416 /* This appears to be the behaviour of the VBIOS parser, and *is*
417 * important to cache the NV_PEXTDEV_BOOT0 on later chipsets to
418 * avoid fucking up the memory controller (somehow) by reading it
419 * on every INIT_RAM_RESTRICT_ZM_GROUP opcode.
420 *
421 * Preserving the non-caching behaviour on earlier chipsets just
422 * in case *not* re-reading the strap causes similar breakage.
423 */
424 if (!init->ramcfg || init->bios->version.major < 0x70)
425 init->ramcfg = init_rd32(init, 0x101000);
426 return (init->ramcfg & 0x00000003c) >> 2;
427}
428
429static u8
413init_ram_restrict(struct nvbios_init *init) 430init_ram_restrict(struct nvbios_init *init)
414{ 431{
415 u32 strap = (init_rd32(init, 0x101000) & 0x0000003c) >> 2; 432 u8 strap = init_ram_restrict_strap(init);
416 u16 table = init_ram_restrict_table(init); 433 u16 table = init_ram_restrict_table(init);
417 if (table) 434 if (table)
418 return nv_ro08(init->bios, table + strap); 435 return nv_ro08(init->bios, table + strap);
@@ -1517,7 +1534,6 @@ init_io(struct nvbios_init *init)
1517 mdelay(10); 1534 mdelay(10);
1518 init_wr32(init, 0x614100, 0x10000018); 1535 init_wr32(init, 0x614100, 0x10000018);
1519 init_wr32(init, 0x614900, 0x10000018); 1536 init_wr32(init, 0x614900, 0x10000018);
1520 return;
1521 } 1537 }
1522 1538
1523 value = init_rdport(init, port) & mask; 1539 value = init_rdport(init, port) & mask;
@@ -1781,7 +1797,7 @@ init_gpio(struct nvbios_init *init)
1781 init->offset += 1; 1797 init->offset += 1;
1782 1798
1783 if (init_exec(init) && gpio && gpio->reset) 1799 if (init_exec(init) && gpio && gpio->reset)
1784 gpio->reset(gpio); 1800 gpio->reset(gpio, DCB_GPIO_UNUSED);
1785} 1801}
1786 1802
1787/** 1803/**
@@ -1995,6 +2011,47 @@ init_i2c_long_if(struct nvbios_init *init)
1995 init_exec_set(init, false); 2011 init_exec_set(init, false);
1996} 2012}
1997 2013
2014/**
2015 * INIT_GPIO_NE - opcode 0xa9
2016 *
2017 */
2018static void
2019init_gpio_ne(struct nvbios_init *init)
2020{
2021 struct nouveau_bios *bios = init->bios;
2022 struct nouveau_gpio *gpio = nouveau_gpio(bios);
2023 struct dcb_gpio_func func;
2024 u8 count = nv_ro08(bios, init->offset + 1);
2025 u8 idx = 0, ver, len;
2026 u16 data, i;
2027
2028 trace("GPIO_NE\t");
2029 init->offset += 2;
2030
2031 for (i = init->offset; i < init->offset + count; i++)
2032 cont("0x%02x ", nv_ro08(bios, i));
2033 cont("\n");
2034
2035 while ((data = dcb_gpio_parse(bios, 0, idx++, &ver, &len, &func))) {
2036 if (func.func != DCB_GPIO_UNUSED) {
2037 for (i = init->offset; i < init->offset + count; i++) {
2038 if (func.func == nv_ro08(bios, i))
2039 break;
2040 }
2041
2042 trace("\tFUNC[0x%02x]", func.func);
2043 if (i == (init->offset + count)) {
2044 cont(" *");
2045 if (init_exec(init) && gpio && gpio->reset)
2046 gpio->reset(gpio, func.func);
2047 }
2048 cont("\n");
2049 }
2050 }
2051
2052 init->offset += count;
2053}
2054
1998static struct nvbios_init_opcode { 2055static struct nvbios_init_opcode {
1999 void (*exec)(struct nvbios_init *); 2056 void (*exec)(struct nvbios_init *);
2000} init_opcode[] = { 2057} init_opcode[] = {
@@ -2059,6 +2116,7 @@ static struct nvbios_init_opcode {
2059 [0x98] = { init_auxch }, 2116 [0x98] = { init_auxch },
2060 [0x99] = { init_zm_auxch }, 2117 [0x99] = { init_zm_auxch },
2061 [0x9a] = { init_i2c_long_if }, 2118 [0x9a] = { init_i2c_long_if },
2119 [0xa9] = { init_gpio_ne },
2062}; 2120};
2063 2121
2064#define init_opcode_nr (sizeof(init_opcode) / sizeof(init_opcode[0])) 2122#define init_opcode_nr (sizeof(init_opcode) / sizeof(init_opcode[0]))
diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c b/drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c
index f6962c9b6c36..7c9626258a46 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c
@@ -52,6 +52,8 @@ nvc0_clock_pll_set(struct nouveau_clock *clk, u32 type, u32 freq)
52 switch (info.type) { 52 switch (info.type) {
53 case PLL_VPLL0: 53 case PLL_VPLL0:
54 case PLL_VPLL1: 54 case PLL_VPLL1:
55 case PLL_VPLL2:
56 case PLL_VPLL3:
55 nv_mask(priv, info.reg + 0x0c, 0x00000000, 0x00000100); 57 nv_mask(priv, info.reg + 0x0c, 0x00000000, 0x00000100);
56 nv_wr32(priv, info.reg + 0x04, (P << 16) | (N << 8) | M); 58 nv_wr32(priv, info.reg + 0x04, (P << 16) | (N << 8) | M);
57 nv_wr32(priv, info.reg + 0x10, fN << 16); 59 nv_wr32(priv, info.reg + 0x10, fN << 16);
diff --git a/drivers/gpu/drm/nouveau/core/subdev/device/nve0.c b/drivers/gpu/drm/nouveau/core/subdev/device/nve0.c
index 9b7881e76634..03a652876e73 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/device/nve0.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/device/nve0.c
@@ -109,6 +109,34 @@ nve0_identify(struct nouveau_device *device)
109 device->oclass[NVDEV_ENGINE_VP ] = &nve0_vp_oclass; 109 device->oclass[NVDEV_ENGINE_VP ] = &nve0_vp_oclass;
110 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass; 110 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass;
111 break; 111 break;
112 case 0xe6:
113 device->cname = "GK106";
114 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
115 device->oclass[NVDEV_SUBDEV_GPIO ] = &nvd0_gpio_oclass;
116 device->oclass[NVDEV_SUBDEV_I2C ] = &nouveau_i2c_oclass;
117 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass;
118 device->oclass[NVDEV_SUBDEV_THERM ] = &nv50_therm_oclass;
119 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
120 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nv50_devinit_oclass;
121 device->oclass[NVDEV_SUBDEV_MC ] = &nvc0_mc_oclass;
122 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
123 device->oclass[NVDEV_SUBDEV_FB ] = &nvc0_fb_oclass;
124 device->oclass[NVDEV_SUBDEV_LTCG ] = &nvc0_ltcg_oclass;
125 device->oclass[NVDEV_SUBDEV_IBUS ] = &nve0_ibus_oclass;
126 device->oclass[NVDEV_SUBDEV_INSTMEM] = &nv50_instmem_oclass;
127 device->oclass[NVDEV_SUBDEV_VM ] = &nvc0_vmmgr_oclass;
128 device->oclass[NVDEV_SUBDEV_BAR ] = &nvc0_bar_oclass;
129 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvd0_dmaeng_oclass;
130 device->oclass[NVDEV_ENGINE_FIFO ] = &nve0_fifo_oclass;
131 device->oclass[NVDEV_ENGINE_SW ] = &nvc0_software_oclass;
132 device->oclass[NVDEV_ENGINE_GR ] = &nve0_graph_oclass;
133 device->oclass[NVDEV_ENGINE_DISP ] = &nve0_disp_oclass;
134 device->oclass[NVDEV_ENGINE_COPY0 ] = &nve0_copy0_oclass;
135 device->oclass[NVDEV_ENGINE_COPY1 ] = &nve0_copy1_oclass;
136 device->oclass[NVDEV_ENGINE_BSP ] = &nve0_bsp_oclass;
137 device->oclass[NVDEV_ENGINE_VP ] = &nve0_vp_oclass;
138 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass;
139 break;
112 default: 140 default:
113 nv_fatal(device, "unknown Kepler chipset\n"); 141 nv_fatal(device, "unknown Kepler chipset\n");
114 return -EINVAL; 142 return -EINVAL;
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c
index 306bdf121452..7606ed15b6fa 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c
@@ -145,14 +145,14 @@ nvc0_fb_vram_new(struct nouveau_fb *pfb, u64 size, u32 align, u32 ncmin,
145 mem->memtype = type; 145 mem->memtype = type;
146 mem->size = size; 146 mem->size = size;
147 147
148 mutex_lock(&mm->mutex); 148 mutex_lock(&pfb->base.mutex);
149 do { 149 do {
150 if (back) 150 if (back)
151 ret = nouveau_mm_tail(mm, 1, size, ncmin, align, &r); 151 ret = nouveau_mm_tail(mm, 1, size, ncmin, align, &r);
152 else 152 else
153 ret = nouveau_mm_head(mm, 1, size, ncmin, align, &r); 153 ret = nouveau_mm_head(mm, 1, size, ncmin, align, &r);
154 if (ret) { 154 if (ret) {
155 mutex_unlock(&mm->mutex); 155 mutex_unlock(&pfb->base.mutex);
156 pfb->ram.put(pfb, &mem); 156 pfb->ram.put(pfb, &mem);
157 return ret; 157 return ret;
158 } 158 }
@@ -160,7 +160,7 @@ nvc0_fb_vram_new(struct nouveau_fb *pfb, u64 size, u32 align, u32 ncmin,
160 list_add_tail(&r->rl_entry, &mem->regions); 160 list_add_tail(&r->rl_entry, &mem->regions);
161 size -= r->length; 161 size -= r->length;
162 } while (size); 162 } while (size);
163 mutex_unlock(&mm->mutex); 163 mutex_unlock(&pfb->base.mutex);
164 164
165 r = list_first_entry(&mem->regions, struct nouveau_mm_node, rl_entry); 165 r = list_first_entry(&mem->regions, struct nouveau_mm_node, rl_entry);
166 mem->offset = (u64)r->offset << 12; 166 mem->offset = (u64)r->offset << 12;
diff --git a/drivers/gpu/drm/nouveau/core/subdev/gpio/base.c b/drivers/gpu/drm/nouveau/core/subdev/gpio/base.c
index acf818c58bf0..9fb0f9b92d49 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/gpio/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/gpio/base.c
@@ -43,10 +43,15 @@ static int
43nouveau_gpio_find(struct nouveau_gpio *gpio, int idx, u8 tag, u8 line, 43nouveau_gpio_find(struct nouveau_gpio *gpio, int idx, u8 tag, u8 line,
44 struct dcb_gpio_func *func) 44 struct dcb_gpio_func *func)
45{ 45{
46 struct nouveau_bios *bios = nouveau_bios(gpio);
47 u8 ver, len;
48 u16 data;
49
46 if (line == 0xff && tag == 0xff) 50 if (line == 0xff && tag == 0xff)
47 return -EINVAL; 51 return -EINVAL;
48 52
49 if (!dcb_gpio_parse(nouveau_bios(gpio), idx, tag, line, func)) 53 data = dcb_gpio_match(bios, idx, tag, line, &ver, &len, func);
54 if (data)
50 return 0; 55 return 0;
51 56
52 /* Apple iMac G4 NV18 */ 57 /* Apple iMac G4 NV18 */
@@ -265,7 +270,7 @@ nouveau_gpio_init(struct nouveau_gpio *gpio)
265 int ret = nouveau_subdev_init(&gpio->base); 270 int ret = nouveau_subdev_init(&gpio->base);
266 if (ret == 0 && gpio->reset) { 271 if (ret == 0 && gpio->reset) {
267 if (dmi_check_system(gpio_reset_ids)) 272 if (dmi_check_system(gpio_reset_ids))
268 gpio->reset(gpio); 273 gpio->reset(gpio, DCB_GPIO_UNUSED);
269 } 274 }
270 return ret; 275 return ret;
271} 276}
diff --git a/drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c b/drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c
index f3502c961cd9..bf13a1200f26 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c
@@ -29,15 +29,15 @@ struct nv50_gpio_priv {
29}; 29};
30 30
31static void 31static void
32nv50_gpio_reset(struct nouveau_gpio *gpio) 32nv50_gpio_reset(struct nouveau_gpio *gpio, u8 match)
33{ 33{
34 struct nouveau_bios *bios = nouveau_bios(gpio); 34 struct nouveau_bios *bios = nouveau_bios(gpio);
35 struct nv50_gpio_priv *priv = (void *)gpio; 35 struct nv50_gpio_priv *priv = (void *)gpio;
36 u8 ver, len;
36 u16 entry; 37 u16 entry;
37 u8 ver;
38 int ent = -1; 38 int ent = -1;
39 39
40 while ((entry = dcb_gpio_entry(bios, 0, ++ent, &ver))) { 40 while ((entry = dcb_gpio_entry(bios, 0, ++ent, &ver, &len))) {
41 static const u32 regs[] = { 0xe100, 0xe28c }; 41 static const u32 regs[] = { 0xe100, 0xe28c };
42 u32 data = nv_ro32(bios, entry); 42 u32 data = nv_ro32(bios, entry);
43 u8 line = (data & 0x0000001f); 43 u8 line = (data & 0x0000001f);
@@ -48,7 +48,8 @@ nv50_gpio_reset(struct nouveau_gpio *gpio)
48 u32 val = (unk1 << 16) | unk0; 48 u32 val = (unk1 << 16) | unk0;
49 u32 reg = regs[line >> 4]; line &= 0x0f; 49 u32 reg = regs[line >> 4]; line &= 0x0f;
50 50
51 if (func == 0xff) 51 if ( func == DCB_GPIO_UNUSED ||
52 (match != DCB_GPIO_UNUSED && match != func))
52 continue; 53 continue;
53 54
54 gpio->set(gpio, 0, func, line, defs); 55 gpio->set(gpio, 0, func, line, defs);
diff --git a/drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c b/drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c
index 8d18fcad26e0..83e8b8f16e6a 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c
@@ -29,15 +29,15 @@ struct nvd0_gpio_priv {
29}; 29};
30 30
31static void 31static void
32nvd0_gpio_reset(struct nouveau_gpio *gpio) 32nvd0_gpio_reset(struct nouveau_gpio *gpio, u8 match)
33{ 33{
34 struct nouveau_bios *bios = nouveau_bios(gpio); 34 struct nouveau_bios *bios = nouveau_bios(gpio);
35 struct nvd0_gpio_priv *priv = (void *)gpio; 35 struct nvd0_gpio_priv *priv = (void *)gpio;
36 u8 ver, len;
36 u16 entry; 37 u16 entry;
37 u8 ver;
38 int ent = -1; 38 int ent = -1;
39 39
40 while ((entry = dcb_gpio_entry(bios, 0, ++ent, &ver))) { 40 while ((entry = dcb_gpio_entry(bios, 0, ++ent, &ver, &len))) {
41 u32 data = nv_ro32(bios, entry); 41 u32 data = nv_ro32(bios, entry);
42 u8 line = (data & 0x0000003f); 42 u8 line = (data & 0x0000003f);
43 u8 defs = !!(data & 0x00000080); 43 u8 defs = !!(data & 0x00000080);
@@ -45,7 +45,8 @@ nvd0_gpio_reset(struct nouveau_gpio *gpio)
45 u8 unk0 = (data & 0x00ff0000) >> 16; 45 u8 unk0 = (data & 0x00ff0000) >> 16;
46 u8 unk1 = (data & 0x1f000000) >> 24; 46 u8 unk1 = (data & 0x1f000000) >> 24;
47 47
48 if (func == 0xff) 48 if ( func == DCB_GPIO_UNUSED ||
49 (match != DCB_GPIO_UNUSED && match != func))
49 continue; 50 continue;
50 51
51 gpio->set(gpio, 0, func, line, defs); 52 gpio->set(gpio, 0, func, line, defs);
diff --git a/drivers/gpu/drm/nouveau/core/subdev/instmem/base.c b/drivers/gpu/drm/nouveau/core/subdev/instmem/base.c
index 1188227ca6aa..6565f3dbbe04 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/instmem/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/instmem/base.c
@@ -40,15 +40,21 @@ nouveau_instobj_create_(struct nouveau_object *parent,
40 if (ret) 40 if (ret)
41 return ret; 41 return ret;
42 42
43 mutex_lock(&imem->base.mutex);
43 list_add(&iobj->head, &imem->list); 44 list_add(&iobj->head, &imem->list);
45 mutex_unlock(&imem->base.mutex);
44 return 0; 46 return 0;
45} 47}
46 48
47void 49void
48nouveau_instobj_destroy(struct nouveau_instobj *iobj) 50nouveau_instobj_destroy(struct nouveau_instobj *iobj)
49{ 51{
50 if (iobj->head.prev) 52 struct nouveau_subdev *subdev = nv_subdev(iobj->base.engine);
51 list_del(&iobj->head); 53
54 mutex_lock(&subdev->mutex);
55 list_del(&iobj->head);
56 mutex_unlock(&subdev->mutex);
57
52 return nouveau_object_destroy(&iobj->base); 58 return nouveau_object_destroy(&iobj->base);
53} 59}
54 60
@@ -88,6 +94,8 @@ nouveau_instmem_init(struct nouveau_instmem *imem)
88 if (ret) 94 if (ret)
89 return ret; 95 return ret;
90 96
97 mutex_lock(&imem->base.mutex);
98
91 list_for_each_entry(iobj, &imem->list, head) { 99 list_for_each_entry(iobj, &imem->list, head) {
92 if (iobj->suspend) { 100 if (iobj->suspend) {
93 for (i = 0; i < iobj->size; i += 4) 101 for (i = 0; i < iobj->size; i += 4)
@@ -97,6 +105,8 @@ nouveau_instmem_init(struct nouveau_instmem *imem)
97 } 105 }
98 } 106 }
99 107
108 mutex_unlock(&imem->base.mutex);
109
100 return 0; 110 return 0;
101} 111}
102 112
@@ -104,17 +114,26 @@ int
104nouveau_instmem_fini(struct nouveau_instmem *imem, bool suspend) 114nouveau_instmem_fini(struct nouveau_instmem *imem, bool suspend)
105{ 115{
106 struct nouveau_instobj *iobj; 116 struct nouveau_instobj *iobj;
107 int i; 117 int i, ret = 0;
108 118
109 if (suspend) { 119 if (suspend) {
120 mutex_lock(&imem->base.mutex);
121
110 list_for_each_entry(iobj, &imem->list, head) { 122 list_for_each_entry(iobj, &imem->list, head) {
111 iobj->suspend = vmalloc(iobj->size); 123 iobj->suspend = vmalloc(iobj->size);
112 if (iobj->suspend) { 124 if (!iobj->suspend) {
113 for (i = 0; i < iobj->size; i += 4) 125 ret = -ENOMEM;
114 iobj->suspend[i / 4] = nv_ro32(iobj, i); 126 break;
115 } else 127 }
116 return -ENOMEM; 128
129 for (i = 0; i < iobj->size; i += 4)
130 iobj->suspend[i / 4] = nv_ro32(iobj, i);
117 } 131 }
132
133 mutex_unlock(&imem->base.mutex);
134
135 if (ret)
136 return ret;
118 } 137 }
119 138
120 return nouveau_subdev_fini(&imem->base, suspend); 139 return nouveau_subdev_fini(&imem->base, suspend);
diff --git a/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c b/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c
index 93e3ddf7303a..e286e132c7e7 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c
@@ -260,7 +260,7 @@ nouveau_mxm_create_(struct nouveau_object *parent,
260 260
261 data = mxm_table(bios, &ver, &len); 261 data = mxm_table(bios, &ver, &len);
262 if (!data || !(ver = nv_ro08(bios, data))) { 262 if (!data || !(ver = nv_ro08(bios, data))) {
263 nv_info(mxm, "no VBIOS data, nothing to do\n"); 263 nv_debug(mxm, "no VBIOS data, nothing to do\n");
264 return 0; 264 return 0;
265 } 265 }
266 266
diff --git a/drivers/gpu/drm/nouveau/core/subdev/vm/base.c b/drivers/gpu/drm/nouveau/core/subdev/vm/base.c
index 082c11b75acb..77c67fc970e6 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/vm/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/vm/base.c
@@ -352,7 +352,7 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length,
352 u64 mm_length = (offset + length) - mm_offset; 352 u64 mm_length = (offset + length) - mm_offset;
353 int ret; 353 int ret;
354 354
355 vm = *pvm = kzalloc(sizeof(*vm), GFP_KERNEL); 355 vm = kzalloc(sizeof(*vm), GFP_KERNEL);
356 if (!vm) 356 if (!vm)
357 return -ENOMEM; 357 return -ENOMEM;
358 358
@@ -376,6 +376,8 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length,
376 return ret; 376 return ret;
377 } 377 }
378 378
379 *pvm = vm;
380
379 return 0; 381 return 0;
380} 382}
381 383
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 5614c89148cb..69d7b1d0b9d6 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -1276,7 +1276,7 @@ nouveau_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)
1276 if (drm->agp.stat == ENABLED) { 1276 if (drm->agp.stat == ENABLED) {
1277 mem->bus.offset = mem->start << PAGE_SHIFT; 1277 mem->bus.offset = mem->start << PAGE_SHIFT;
1278 mem->bus.base = drm->agp.base; 1278 mem->bus.base = drm->agp.base;
1279 mem->bus.is_iomem = true; 1279 mem->bus.is_iomem = !dev->agp->cant_use_aperture;
1280 } 1280 }
1281#endif 1281#endif
1282 break; 1282 break;
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
index ac340ba32017..e620ba8271b4 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -127,12 +127,26 @@ nouveau_connector_ddc_detect(struct drm_connector *connector,
127 struct nouveau_encoder **pnv_encoder) 127 struct nouveau_encoder **pnv_encoder)
128{ 128{
129 struct drm_device *dev = connector->dev; 129 struct drm_device *dev = connector->dev;
130 struct nouveau_connector *nv_connector = nouveau_connector(connector);
130 struct nouveau_drm *drm = nouveau_drm(dev); 131 struct nouveau_drm *drm = nouveau_drm(dev);
132 struct nouveau_gpio *gpio = nouveau_gpio(drm->device);
131 struct nouveau_i2c *i2c = nouveau_i2c(drm->device); 133 struct nouveau_i2c *i2c = nouveau_i2c(drm->device);
132 int i; 134 struct nouveau_i2c_port *port = NULL;
135 int i, panel = -ENODEV;
136
137 /* eDP panels need powering on by us (if the VBIOS doesn't default it
138 * to on) before doing any AUX channel transactions. LVDS panel power
139 * is handled by the SOR itself, and not required for LVDS DDC.
140 */
141 if (nv_connector->type == DCB_CONNECTOR_eDP) {
142 panel = gpio->get(gpio, 0, DCB_GPIO_PANEL_POWER, 0xff);
143 if (panel == 0) {
144 gpio->set(gpio, 0, DCB_GPIO_PANEL_POWER, 0xff, 1);
145 msleep(300);
146 }
147 }
133 148
134 for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) { 149 for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) {
135 struct nouveau_i2c_port *port = NULL;
136 struct nouveau_encoder *nv_encoder; 150 struct nouveau_encoder *nv_encoder;
137 struct drm_mode_object *obj; 151 struct drm_mode_object *obj;
138 int id; 152 int id;
@@ -150,11 +164,19 @@ nouveau_connector_ddc_detect(struct drm_connector *connector,
150 port = i2c->find(i2c, nv_encoder->dcb->i2c_index); 164 port = i2c->find(i2c, nv_encoder->dcb->i2c_index);
151 if (port && nv_probe_i2c(port, 0x50)) { 165 if (port && nv_probe_i2c(port, 0x50)) {
152 *pnv_encoder = nv_encoder; 166 *pnv_encoder = nv_encoder;
153 return port; 167 break;
154 } 168 }
169
170 port = NULL;
155 } 171 }
156 172
157 return NULL; 173 /* eDP panel not detected, restore panel power GPIO to previous
174 * state to avoid confusing the SOR for other output types.
175 */
176 if (!port && panel == 0)
177 gpio->set(gpio, 0, DCB_GPIO_PANEL_POWER, 0xff, panel);
178
179 return port;
158} 180}
159 181
160static struct nouveau_encoder * 182static struct nouveau_encoder *
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index e4188f24fc75..508b00a2ce0d 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -225,15 +225,6 @@ nouveau_display_init(struct drm_device *dev)
225 if (ret) 225 if (ret)
226 return ret; 226 return ret;
227 227
228 /* power on internal panel if it's not already. the init tables of
229 * some vbios default this to off for some reason, causing the
230 * panel to not work after resume
231 */
232 if (gpio && gpio->get(gpio, 0, DCB_GPIO_PANEL_POWER, 0xff) == 0) {
233 gpio->set(gpio, 0, DCB_GPIO_PANEL_POWER, 0xff, 1);
234 msleep(300);
235 }
236
237 /* enable polling for external displays */ 228 /* enable polling for external displays */
238 drm_kms_helper_poll_enable(dev); 229 drm_kms_helper_poll_enable(dev);
239 230
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 01c403ddb99b..8b090f1eb51d 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -84,11 +84,16 @@ nouveau_cli_create(struct pci_dev *pdev, const char *name,
84 struct nouveau_cli *cli; 84 struct nouveau_cli *cli;
85 int ret; 85 int ret;
86 86
87 *pcli = NULL;
87 ret = nouveau_client_create_(name, nouveau_name(pdev), nouveau_config, 88 ret = nouveau_client_create_(name, nouveau_name(pdev), nouveau_config,
88 nouveau_debug, size, pcli); 89 nouveau_debug, size, pcli);
89 cli = *pcli; 90 cli = *pcli;
90 if (ret) 91 if (ret) {
92 if (cli)
93 nouveau_client_destroy(&cli->base);
94 *pcli = NULL;
91 return ret; 95 return ret;
96 }
92 97
93 mutex_init(&cli->mutex); 98 mutex_init(&cli->mutex);
94 return 0; 99 return 0;
@@ -189,8 +194,8 @@ nouveau_accel_init(struct nouveau_drm *drm)
189 nouveau_bo_move_init(drm); 194 nouveau_bo_move_init(drm);
190} 195}
191 196
192static int __devinit 197static int nouveau_drm_probe(struct pci_dev *pdev,
193nouveau_drm_probe(struct pci_dev *pdev, const struct pci_device_id *pent) 198 const struct pci_device_id *pent)
194{ 199{
195 struct nouveau_device *device; 200 struct nouveau_device *device;
196 struct apertures_struct *aper; 201 struct apertures_struct *aper;
diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.h b/drivers/gpu/drm/nouveau/nouveau_fence.h
index bedafd1c9539..cdb83acdffe2 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fence.h
+++ b/drivers/gpu/drm/nouveau/nouveau_fence.h
@@ -60,6 +60,7 @@ u32 nv10_fence_read(struct nouveau_channel *);
60void nv10_fence_context_del(struct nouveau_channel *); 60void nv10_fence_context_del(struct nouveau_channel *);
61void nv10_fence_destroy(struct nouveau_drm *); 61void nv10_fence_destroy(struct nouveau_drm *);
62int nv10_fence_create(struct nouveau_drm *); 62int nv10_fence_create(struct nouveau_drm *);
63void nv17_fence_resume(struct nouveau_drm *drm);
63 64
64int nv50_fence_create(struct nouveau_drm *); 65int nv50_fence_create(struct nouveau_drm *);
65int nv84_fence_create(struct nouveau_drm *); 66int nv84_fence_create(struct nouveau_drm *);
diff --git a/drivers/gpu/drm/nouveau/nouveau_pm.c b/drivers/gpu/drm/nouveau/nouveau_pm.c
index 5566172774df..a701ff5ffa5b 100644
--- a/drivers/gpu/drm/nouveau/nouveau_pm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_pm.c
@@ -698,10 +698,10 @@ static int
698nouveau_hwmon_init(struct drm_device *dev) 698nouveau_hwmon_init(struct drm_device *dev)
699{ 699{
700 struct nouveau_pm *pm = nouveau_pm(dev); 700 struct nouveau_pm *pm = nouveau_pm(dev);
701 struct nouveau_drm *drm = nouveau_drm(dev);
702 struct nouveau_therm *therm = nouveau_therm(drm->device);
703 701
704#if defined(CONFIG_HWMON) || (defined(MODULE) && defined(CONFIG_HWMON_MODULE)) 702#if defined(CONFIG_HWMON) || (defined(MODULE) && defined(CONFIG_HWMON_MODULE))
703 struct nouveau_drm *drm = nouveau_drm(dev);
704 struct nouveau_therm *therm = nouveau_therm(drm->device);
705 struct device *hwmon_dev; 705 struct device *hwmon_dev;
706 int ret = 0; 706 int ret = 0;
707 707
diff --git a/drivers/gpu/drm/nouveau/nouveau_prime.c b/drivers/gpu/drm/nouveau/nouveau_prime.c
index 3543fec2355e..b8e05ae38212 100644
--- a/drivers/gpu/drm/nouveau/nouveau_prime.c
+++ b/drivers/gpu/drm/nouveau/nouveau_prime.c
@@ -193,6 +193,7 @@ struct drm_gem_object *nouveau_gem_prime_import(struct drm_device *dev,
193 if (nvbo->gem) { 193 if (nvbo->gem) {
194 if (nvbo->gem->dev == dev) { 194 if (nvbo->gem->dev == dev) {
195 drm_gem_object_reference(nvbo->gem); 195 drm_gem_object_reference(nvbo->gem);
196 dma_buf_put(dma_buf);
196 return nvbo->gem; 197 return nvbo->gem;
197 } 198 }
198 } 199 }
diff --git a/drivers/gpu/drm/nouveau/nv04_dfp.c b/drivers/gpu/drm/nouveau/nv04_dfp.c
index 184cdf806761..39ffc07f906b 100644
--- a/drivers/gpu/drm/nouveau/nv04_dfp.c
+++ b/drivers/gpu/drm/nouveau/nv04_dfp.c
@@ -505,7 +505,7 @@ static void nv04_dfp_update_backlight(struct drm_encoder *encoder, int mode)
505 505
506static inline bool is_powersaving_dpms(int mode) 506static inline bool is_powersaving_dpms(int mode)
507{ 507{
508 return (mode != DRM_MODE_DPMS_ON); 508 return mode != DRM_MODE_DPMS_ON && mode != NV_DPMS_CLEARED;
509} 509}
510 510
511static void nv04_lvds_dpms(struct drm_encoder *encoder, int mode) 511static void nv04_lvds_dpms(struct drm_encoder *encoder, int mode)
diff --git a/drivers/gpu/drm/nouveau/nv10_fence.c b/drivers/gpu/drm/nouveau/nv10_fence.c
index 7ae7f97a6d4d..03017f24d593 100644
--- a/drivers/gpu/drm/nouveau/nv10_fence.c
+++ b/drivers/gpu/drm/nouveau/nv10_fence.c
@@ -162,6 +162,13 @@ nv10_fence_destroy(struct nouveau_drm *drm)
162 kfree(priv); 162 kfree(priv);
163} 163}
164 164
165void nv17_fence_resume(struct nouveau_drm *drm)
166{
167 struct nv10_fence_priv *priv = drm->fence;
168
169 nouveau_bo_wr32(priv->bo, 0, priv->sequence);
170}
171
165int 172int
166nv10_fence_create(struct nouveau_drm *drm) 173nv10_fence_create(struct nouveau_drm *drm)
167{ 174{
@@ -197,6 +204,7 @@ nv10_fence_create(struct nouveau_drm *drm)
197 if (ret == 0) { 204 if (ret == 0) {
198 nouveau_bo_wr32(priv->bo, 0x000, 0x00000000); 205 nouveau_bo_wr32(priv->bo, 0x000, 0x00000000);
199 priv->base.sync = nv17_fence_sync; 206 priv->base.sync = nv17_fence_sync;
207 priv->base.resume = nv17_fence_resume;
200 } 208 }
201 } 209 }
202 210
diff --git a/drivers/gpu/drm/nouveau/nv50_fence.c b/drivers/gpu/drm/nouveau/nv50_fence.c
index c20f2727ea0b..d889f3ac0d41 100644
--- a/drivers/gpu/drm/nouveau/nv50_fence.c
+++ b/drivers/gpu/drm/nouveau/nv50_fence.c
@@ -122,6 +122,7 @@ nv50_fence_create(struct nouveau_drm *drm)
122 if (ret == 0) { 122 if (ret == 0) {
123 nouveau_bo_wr32(priv->bo, 0x000, 0x00000000); 123 nouveau_bo_wr32(priv->bo, 0x000, 0x00000000);
124 priv->base.sync = nv17_fence_sync; 124 priv->base.sync = nv17_fence_sync;
125 priv->base.resume = nv17_fence_resume;
125 } 126 }
126 127
127 if (ret) 128 if (ret)
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index f95d7fc1f5e0..4d0e60adbc6d 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -2306,22 +2306,20 @@ bool evergreen_gpu_is_lockup(struct radeon_device *rdev, struct radeon_ring *rin
2306 return radeon_ring_test_lockup(rdev, ring); 2306 return radeon_ring_test_lockup(rdev, ring);
2307} 2307}
2308 2308
2309static int evergreen_gpu_soft_reset(struct radeon_device *rdev) 2309static void evergreen_gpu_soft_reset_gfx(struct radeon_device *rdev)
2310{ 2310{
2311 struct evergreen_mc_save save;
2312 u32 grbm_reset = 0; 2311 u32 grbm_reset = 0;
2313 2312
2314 if (!(RREG32(GRBM_STATUS) & GUI_ACTIVE)) 2313 if (!(RREG32(GRBM_STATUS) & GUI_ACTIVE))
2315 return 0; 2314 return;
2316 2315
2317 dev_info(rdev->dev, "GPU softreset \n"); 2316 dev_info(rdev->dev, " GRBM_STATUS = 0x%08X\n",
2318 dev_info(rdev->dev, " GRBM_STATUS=0x%08X\n",
2319 RREG32(GRBM_STATUS)); 2317 RREG32(GRBM_STATUS));
2320 dev_info(rdev->dev, " GRBM_STATUS_SE0=0x%08X\n", 2318 dev_info(rdev->dev, " GRBM_STATUS_SE0 = 0x%08X\n",
2321 RREG32(GRBM_STATUS_SE0)); 2319 RREG32(GRBM_STATUS_SE0));
2322 dev_info(rdev->dev, " GRBM_STATUS_SE1=0x%08X\n", 2320 dev_info(rdev->dev, " GRBM_STATUS_SE1 = 0x%08X\n",
2323 RREG32(GRBM_STATUS_SE1)); 2321 RREG32(GRBM_STATUS_SE1));
2324 dev_info(rdev->dev, " SRBM_STATUS=0x%08X\n", 2322 dev_info(rdev->dev, " SRBM_STATUS = 0x%08X\n",
2325 RREG32(SRBM_STATUS)); 2323 RREG32(SRBM_STATUS));
2326 dev_info(rdev->dev, " R_008674_CP_STALLED_STAT1 = 0x%08X\n", 2324 dev_info(rdev->dev, " R_008674_CP_STALLED_STAT1 = 0x%08X\n",
2327 RREG32(CP_STALLED_STAT1)); 2325 RREG32(CP_STALLED_STAT1));
@@ -2331,10 +2329,7 @@ static int evergreen_gpu_soft_reset(struct radeon_device *rdev)
2331 RREG32(CP_BUSY_STAT)); 2329 RREG32(CP_BUSY_STAT));
2332 dev_info(rdev->dev, " R_008680_CP_STAT = 0x%08X\n", 2330 dev_info(rdev->dev, " R_008680_CP_STAT = 0x%08X\n",
2333 RREG32(CP_STAT)); 2331 RREG32(CP_STAT));
2334 evergreen_mc_stop(rdev, &save); 2332
2335 if (evergreen_mc_wait_for_idle(rdev)) {
2336 dev_warn(rdev->dev, "Wait for MC idle timedout !\n");
2337 }
2338 /* Disable CP parsing/prefetching */ 2333 /* Disable CP parsing/prefetching */
2339 WREG32(CP_ME_CNTL, CP_ME_HALT | CP_PFP_HALT); 2334 WREG32(CP_ME_CNTL, CP_ME_HALT | CP_PFP_HALT);
2340 2335
@@ -2358,15 +2353,14 @@ static int evergreen_gpu_soft_reset(struct radeon_device *rdev)
2358 udelay(50); 2353 udelay(50);
2359 WREG32(GRBM_SOFT_RESET, 0); 2354 WREG32(GRBM_SOFT_RESET, 0);
2360 (void)RREG32(GRBM_SOFT_RESET); 2355 (void)RREG32(GRBM_SOFT_RESET);
2361 /* Wait a little for things to settle down */ 2356
2362 udelay(50); 2357 dev_info(rdev->dev, " GRBM_STATUS = 0x%08X\n",
2363 dev_info(rdev->dev, " GRBM_STATUS=0x%08X\n",
2364 RREG32(GRBM_STATUS)); 2358 RREG32(GRBM_STATUS));
2365 dev_info(rdev->dev, " GRBM_STATUS_SE0=0x%08X\n", 2359 dev_info(rdev->dev, " GRBM_STATUS_SE0 = 0x%08X\n",
2366 RREG32(GRBM_STATUS_SE0)); 2360 RREG32(GRBM_STATUS_SE0));
2367 dev_info(rdev->dev, " GRBM_STATUS_SE1=0x%08X\n", 2361 dev_info(rdev->dev, " GRBM_STATUS_SE1 = 0x%08X\n",
2368 RREG32(GRBM_STATUS_SE1)); 2362 RREG32(GRBM_STATUS_SE1));
2369 dev_info(rdev->dev, " SRBM_STATUS=0x%08X\n", 2363 dev_info(rdev->dev, " SRBM_STATUS = 0x%08X\n",
2370 RREG32(SRBM_STATUS)); 2364 RREG32(SRBM_STATUS));
2371 dev_info(rdev->dev, " R_008674_CP_STALLED_STAT1 = 0x%08X\n", 2365 dev_info(rdev->dev, " R_008674_CP_STALLED_STAT1 = 0x%08X\n",
2372 RREG32(CP_STALLED_STAT1)); 2366 RREG32(CP_STALLED_STAT1));
@@ -2376,13 +2370,71 @@ static int evergreen_gpu_soft_reset(struct radeon_device *rdev)
2376 RREG32(CP_BUSY_STAT)); 2370 RREG32(CP_BUSY_STAT));
2377 dev_info(rdev->dev, " R_008680_CP_STAT = 0x%08X\n", 2371 dev_info(rdev->dev, " R_008680_CP_STAT = 0x%08X\n",
2378 RREG32(CP_STAT)); 2372 RREG32(CP_STAT));
2373}
2374
2375static void evergreen_gpu_soft_reset_dma(struct radeon_device *rdev)
2376{
2377 u32 tmp;
2378
2379 if (RREG32(DMA_STATUS_REG) & DMA_IDLE)
2380 return;
2381
2382 dev_info(rdev->dev, " R_00D034_DMA_STATUS_REG = 0x%08X\n",
2383 RREG32(DMA_STATUS_REG));
2384
2385 /* Disable DMA */
2386 tmp = RREG32(DMA_RB_CNTL);
2387 tmp &= ~DMA_RB_ENABLE;
2388 WREG32(DMA_RB_CNTL, tmp);
2389
2390 /* Reset dma */
2391 WREG32(SRBM_SOFT_RESET, SOFT_RESET_DMA);
2392 RREG32(SRBM_SOFT_RESET);
2393 udelay(50);
2394 WREG32(SRBM_SOFT_RESET, 0);
2395
2396 dev_info(rdev->dev, " R_00D034_DMA_STATUS_REG = 0x%08X\n",
2397 RREG32(DMA_STATUS_REG));
2398}
2399
2400static int evergreen_gpu_soft_reset(struct radeon_device *rdev, u32 reset_mask)
2401{
2402 struct evergreen_mc_save save;
2403
2404 if (!(RREG32(GRBM_STATUS) & GUI_ACTIVE))
2405 reset_mask &= ~(RADEON_RESET_GFX | RADEON_RESET_COMPUTE);
2406
2407 if (RREG32(DMA_STATUS_REG) & DMA_IDLE)
2408 reset_mask &= ~RADEON_RESET_DMA;
2409
2410 if (reset_mask == 0)
2411 return 0;
2412
2413 dev_info(rdev->dev, "GPU softreset: 0x%08X\n", reset_mask);
2414
2415 evergreen_mc_stop(rdev, &save);
2416 if (evergreen_mc_wait_for_idle(rdev)) {
2417 dev_warn(rdev->dev, "Wait for MC idle timedout !\n");
2418 }
2419
2420 if (reset_mask & (RADEON_RESET_GFX | RADEON_RESET_COMPUTE))
2421 evergreen_gpu_soft_reset_gfx(rdev);
2422
2423 if (reset_mask & RADEON_RESET_DMA)
2424 evergreen_gpu_soft_reset_dma(rdev);
2425
2426 /* Wait a little for things to settle down */
2427 udelay(50);
2428
2379 evergreen_mc_resume(rdev, &save); 2429 evergreen_mc_resume(rdev, &save);
2380 return 0; 2430 return 0;
2381} 2431}
2382 2432
2383int evergreen_asic_reset(struct radeon_device *rdev) 2433int evergreen_asic_reset(struct radeon_device *rdev)
2384{ 2434{
2385 return evergreen_gpu_soft_reset(rdev); 2435 return evergreen_gpu_soft_reset(rdev, (RADEON_RESET_GFX |
2436 RADEON_RESET_COMPUTE |
2437 RADEON_RESET_DMA));
2386} 2438}
2387 2439
2388/* Interrupts */ 2440/* Interrupts */
@@ -3215,7 +3267,7 @@ void evergreen_dma_fence_ring_emit(struct radeon_device *rdev,
3215 radeon_ring_write(ring, DMA_PACKET(DMA_PACKET_TRAP, 0, 0, 0)); 3267 radeon_ring_write(ring, DMA_PACKET(DMA_PACKET_TRAP, 0, 0, 0));
3216 /* flush HDP */ 3268 /* flush HDP */
3217 radeon_ring_write(ring, DMA_PACKET(DMA_PACKET_SRBM_WRITE, 0, 0, 0)); 3269 radeon_ring_write(ring, DMA_PACKET(DMA_PACKET_SRBM_WRITE, 0, 0, 0));
3218 radeon_ring_write(ring, (0xf << 16) | HDP_MEM_COHERENCY_FLUSH_CNTL); 3270 radeon_ring_write(ring, (0xf << 16) | (HDP_MEM_COHERENCY_FLUSH_CNTL >> 2));
3219 radeon_ring_write(ring, 1); 3271 radeon_ring_write(ring, 1);
3220} 3272}
3221 3273
diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c
index 74c6b42d2597..7a445666e71f 100644
--- a/drivers/gpu/drm/radeon/evergreen_cs.c
+++ b/drivers/gpu/drm/radeon/evergreen_cs.c
@@ -2654,6 +2654,35 @@ static int evergreen_packet3_check(struct radeon_cs_parser *p,
2654 ib[idx+4] = upper_32_bits(offset) & 0xff; 2654 ib[idx+4] = upper_32_bits(offset) & 0xff;
2655 } 2655 }
2656 break; 2656 break;
2657 case PACKET3_MEM_WRITE:
2658 {
2659 u64 offset;
2660
2661 if (pkt->count != 3) {
2662 DRM_ERROR("bad MEM_WRITE (invalid count)\n");
2663 return -EINVAL;
2664 }
2665 r = evergreen_cs_packet_next_reloc(p, &reloc);
2666 if (r) {
2667 DRM_ERROR("bad MEM_WRITE (missing reloc)\n");
2668 return -EINVAL;
2669 }
2670 offset = radeon_get_ib_value(p, idx+0);
2671 offset += ((u64)(radeon_get_ib_value(p, idx+1) & 0xff)) << 32UL;
2672 if (offset & 0x7) {
2673 DRM_ERROR("bad MEM_WRITE (address not qwords aligned)\n");
2674 return -EINVAL;
2675 }
2676 if ((offset + 8) > radeon_bo_size(reloc->robj)) {
2677 DRM_ERROR("bad MEM_WRITE bo too small: 0x%llx, 0x%lx\n",
2678 offset + 8, radeon_bo_size(reloc->robj));
2679 return -EINVAL;
2680 }
2681 offset += reloc->lobj.gpu_offset;
2682 ib[idx+0] = offset;
2683 ib[idx+1] = upper_32_bits(offset) & 0xff;
2684 break;
2685 }
2657 case PACKET3_COPY_DW: 2686 case PACKET3_COPY_DW:
2658 if (pkt->count != 4) { 2687 if (pkt->count != 4) {
2659 DRM_ERROR("bad COPY_DW (invalid count)\n"); 2688 DRM_ERROR("bad COPY_DW (invalid count)\n");
@@ -3287,6 +3316,7 @@ static bool evergreen_vm_reg_valid(u32 reg)
3287 3316
3288 /* check config regs */ 3317 /* check config regs */
3289 switch (reg) { 3318 switch (reg) {
3319 case WAIT_UNTIL:
3290 case GRBM_GFX_INDEX: 3320 case GRBM_GFX_INDEX:
3291 case CP_STRMOUT_CNTL: 3321 case CP_STRMOUT_CNTL:
3292 case CP_COHER_CNTL: 3322 case CP_COHER_CNTL:
diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h
index cb9baaac9e85..0bfd0e9e469b 100644
--- a/drivers/gpu/drm/radeon/evergreend.h
+++ b/drivers/gpu/drm/radeon/evergreend.h
@@ -742,8 +742,9 @@
742#define SOFT_RESET_ROM (1 << 14) 742#define SOFT_RESET_ROM (1 << 14)
743#define SOFT_RESET_SEM (1 << 15) 743#define SOFT_RESET_SEM (1 << 15)
744#define SOFT_RESET_VMC (1 << 17) 744#define SOFT_RESET_VMC (1 << 17)
745#define SOFT_RESET_DMA (1 << 20)
745#define SOFT_RESET_TST (1 << 21) 746#define SOFT_RESET_TST (1 << 21)
746#define SOFT_RESET_REGBB (1 << 22) 747#define SOFT_RESET_REGBB (1 << 22)
747#define SOFT_RESET_ORB (1 << 23) 748#define SOFT_RESET_ORB (1 << 23)
748 749
749/* display watermarks */ 750/* display watermarks */
@@ -2027,4 +2028,15 @@
2027/* cayman packet3 addition */ 2028/* cayman packet3 addition */
2028#define CAYMAN_PACKET3_DEALLOC_STATE 0x14 2029#define CAYMAN_PACKET3_DEALLOC_STATE 0x14
2029 2030
2031/* DMA regs common on r6xx/r7xx/evergreen/ni */
2032#define DMA_RB_CNTL 0xd000
2033# define DMA_RB_ENABLE (1 << 0)
2034# define DMA_RB_SIZE(x) ((x) << 1) /* log2 */
2035# define DMA_RB_SWAP_ENABLE (1 << 9) /* 8IN32 */
2036# define DMA_RPTR_WRITEBACK_ENABLE (1 << 12)
2037# define DMA_RPTR_WRITEBACK_SWAP_ENABLE (1 << 13) /* 8IN32 */
2038# define DMA_RPTR_WRITEBACK_TIMER(x) ((x) << 16) /* log2 */
2039#define DMA_STATUS_REG 0xd034
2040# define DMA_IDLE (1 << 0)
2041
2030#endif 2042#endif
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c
index 7bdbcb00aaf2..835992d8d067 100644
--- a/drivers/gpu/drm/radeon/ni.c
+++ b/drivers/gpu/drm/radeon/ni.c
@@ -1216,7 +1216,7 @@ void cayman_dma_stop(struct radeon_device *rdev)
1216int cayman_dma_resume(struct radeon_device *rdev) 1216int cayman_dma_resume(struct radeon_device *rdev)
1217{ 1217{
1218 struct radeon_ring *ring; 1218 struct radeon_ring *ring;
1219 u32 rb_cntl, dma_cntl; 1219 u32 rb_cntl, dma_cntl, ib_cntl;
1220 u32 rb_bufsz; 1220 u32 rb_bufsz;
1221 u32 reg_offset, wb_offset; 1221 u32 reg_offset, wb_offset;
1222 int i, r; 1222 int i, r;
@@ -1265,7 +1265,11 @@ int cayman_dma_resume(struct radeon_device *rdev)
1265 WREG32(DMA_RB_BASE + reg_offset, ring->gpu_addr >> 8); 1265 WREG32(DMA_RB_BASE + reg_offset, ring->gpu_addr >> 8);
1266 1266
1267 /* enable DMA IBs */ 1267 /* enable DMA IBs */
1268 WREG32(DMA_IB_CNTL + reg_offset, DMA_IB_ENABLE | CMD_VMID_FORCE); 1268 ib_cntl = DMA_IB_ENABLE | CMD_VMID_FORCE;
1269#ifdef __BIG_ENDIAN
1270 ib_cntl |= DMA_IB_SWAP_ENABLE;
1271#endif
1272 WREG32(DMA_IB_CNTL + reg_offset, ib_cntl);
1269 1273
1270 dma_cntl = RREG32(DMA_CNTL + reg_offset); 1274 dma_cntl = RREG32(DMA_CNTL + reg_offset);
1271 dma_cntl &= ~CTXEMPTY_INT_ENABLE; 1275 dma_cntl &= ~CTXEMPTY_INT_ENABLE;
@@ -1306,22 +1310,20 @@ void cayman_dma_fini(struct radeon_device *rdev)
1306 radeon_ring_fini(rdev, &rdev->ring[CAYMAN_RING_TYPE_DMA1_INDEX]); 1310 radeon_ring_fini(rdev, &rdev->ring[CAYMAN_RING_TYPE_DMA1_INDEX]);
1307} 1311}
1308 1312
1309static int cayman_gpu_soft_reset(struct radeon_device *rdev) 1313static void cayman_gpu_soft_reset_gfx(struct radeon_device *rdev)
1310{ 1314{
1311 struct evergreen_mc_save save;
1312 u32 grbm_reset = 0; 1315 u32 grbm_reset = 0;
1313 1316
1314 if (!(RREG32(GRBM_STATUS) & GUI_ACTIVE)) 1317 if (!(RREG32(GRBM_STATUS) & GUI_ACTIVE))
1315 return 0; 1318 return;
1316 1319
1317 dev_info(rdev->dev, "GPU softreset \n"); 1320 dev_info(rdev->dev, " GRBM_STATUS = 0x%08X\n",
1318 dev_info(rdev->dev, " GRBM_STATUS=0x%08X\n",
1319 RREG32(GRBM_STATUS)); 1321 RREG32(GRBM_STATUS));
1320 dev_info(rdev->dev, " GRBM_STATUS_SE0=0x%08X\n", 1322 dev_info(rdev->dev, " GRBM_STATUS_SE0 = 0x%08X\n",
1321 RREG32(GRBM_STATUS_SE0)); 1323 RREG32(GRBM_STATUS_SE0));
1322 dev_info(rdev->dev, " GRBM_STATUS_SE1=0x%08X\n", 1324 dev_info(rdev->dev, " GRBM_STATUS_SE1 = 0x%08X\n",
1323 RREG32(GRBM_STATUS_SE1)); 1325 RREG32(GRBM_STATUS_SE1));
1324 dev_info(rdev->dev, " SRBM_STATUS=0x%08X\n", 1326 dev_info(rdev->dev, " SRBM_STATUS = 0x%08X\n",
1325 RREG32(SRBM_STATUS)); 1327 RREG32(SRBM_STATUS));
1326 dev_info(rdev->dev, " R_008674_CP_STALLED_STAT1 = 0x%08X\n", 1328 dev_info(rdev->dev, " R_008674_CP_STALLED_STAT1 = 0x%08X\n",
1327 RREG32(CP_STALLED_STAT1)); 1329 RREG32(CP_STALLED_STAT1));
@@ -1331,19 +1333,7 @@ static int cayman_gpu_soft_reset(struct radeon_device *rdev)
1331 RREG32(CP_BUSY_STAT)); 1333 RREG32(CP_BUSY_STAT));
1332 dev_info(rdev->dev, " R_008680_CP_STAT = 0x%08X\n", 1334 dev_info(rdev->dev, " R_008680_CP_STAT = 0x%08X\n",
1333 RREG32(CP_STAT)); 1335 RREG32(CP_STAT));
1334 dev_info(rdev->dev, " VM_CONTEXT0_PROTECTION_FAULT_ADDR 0x%08X\n",
1335 RREG32(0x14F8));
1336 dev_info(rdev->dev, " VM_CONTEXT0_PROTECTION_FAULT_STATUS 0x%08X\n",
1337 RREG32(0x14D8));
1338 dev_info(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n",
1339 RREG32(0x14FC));
1340 dev_info(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n",
1341 RREG32(0x14DC));
1342 1336
1343 evergreen_mc_stop(rdev, &save);
1344 if (evergreen_mc_wait_for_idle(rdev)) {
1345 dev_warn(rdev->dev, "Wait for MC idle timedout !\n");
1346 }
1347 /* Disable CP parsing/prefetching */ 1337 /* Disable CP parsing/prefetching */
1348 WREG32(CP_ME_CNTL, CP_ME_HALT | CP_PFP_HALT); 1338 WREG32(CP_ME_CNTL, CP_ME_HALT | CP_PFP_HALT);
1349 1339
@@ -1368,16 +1358,14 @@ static int cayman_gpu_soft_reset(struct radeon_device *rdev)
1368 udelay(50); 1358 udelay(50);
1369 WREG32(GRBM_SOFT_RESET, 0); 1359 WREG32(GRBM_SOFT_RESET, 0);
1370 (void)RREG32(GRBM_SOFT_RESET); 1360 (void)RREG32(GRBM_SOFT_RESET);
1371 /* Wait a little for things to settle down */
1372 udelay(50);
1373 1361
1374 dev_info(rdev->dev, " GRBM_STATUS=0x%08X\n", 1362 dev_info(rdev->dev, " GRBM_STATUS = 0x%08X\n",
1375 RREG32(GRBM_STATUS)); 1363 RREG32(GRBM_STATUS));
1376 dev_info(rdev->dev, " GRBM_STATUS_SE0=0x%08X\n", 1364 dev_info(rdev->dev, " GRBM_STATUS_SE0 = 0x%08X\n",
1377 RREG32(GRBM_STATUS_SE0)); 1365 RREG32(GRBM_STATUS_SE0));
1378 dev_info(rdev->dev, " GRBM_STATUS_SE1=0x%08X\n", 1366 dev_info(rdev->dev, " GRBM_STATUS_SE1 = 0x%08X\n",
1379 RREG32(GRBM_STATUS_SE1)); 1367 RREG32(GRBM_STATUS_SE1));
1380 dev_info(rdev->dev, " SRBM_STATUS=0x%08X\n", 1368 dev_info(rdev->dev, " SRBM_STATUS = 0x%08X\n",
1381 RREG32(SRBM_STATUS)); 1369 RREG32(SRBM_STATUS));
1382 dev_info(rdev->dev, " R_008674_CP_STALLED_STAT1 = 0x%08X\n", 1370 dev_info(rdev->dev, " R_008674_CP_STALLED_STAT1 = 0x%08X\n",
1383 RREG32(CP_STALLED_STAT1)); 1371 RREG32(CP_STALLED_STAT1));
@@ -1387,13 +1375,87 @@ static int cayman_gpu_soft_reset(struct radeon_device *rdev)
1387 RREG32(CP_BUSY_STAT)); 1375 RREG32(CP_BUSY_STAT));
1388 dev_info(rdev->dev, " R_008680_CP_STAT = 0x%08X\n", 1376 dev_info(rdev->dev, " R_008680_CP_STAT = 0x%08X\n",
1389 RREG32(CP_STAT)); 1377 RREG32(CP_STAT));
1378
1379}
1380
1381static void cayman_gpu_soft_reset_dma(struct radeon_device *rdev)
1382{
1383 u32 tmp;
1384
1385 if (RREG32(DMA_STATUS_REG) & DMA_IDLE)
1386 return;
1387
1388 dev_info(rdev->dev, " R_00D034_DMA_STATUS_REG = 0x%08X\n",
1389 RREG32(DMA_STATUS_REG));
1390
1391 /* dma0 */
1392 tmp = RREG32(DMA_RB_CNTL + DMA0_REGISTER_OFFSET);
1393 tmp &= ~DMA_RB_ENABLE;
1394 WREG32(DMA_RB_CNTL + DMA0_REGISTER_OFFSET, tmp);
1395
1396 /* dma1 */
1397 tmp = RREG32(DMA_RB_CNTL + DMA1_REGISTER_OFFSET);
1398 tmp &= ~DMA_RB_ENABLE;
1399 WREG32(DMA_RB_CNTL + DMA1_REGISTER_OFFSET, tmp);
1400
1401 /* Reset dma */
1402 WREG32(SRBM_SOFT_RESET, SOFT_RESET_DMA | SOFT_RESET_DMA1);
1403 RREG32(SRBM_SOFT_RESET);
1404 udelay(50);
1405 WREG32(SRBM_SOFT_RESET, 0);
1406
1407 dev_info(rdev->dev, " R_00D034_DMA_STATUS_REG = 0x%08X\n",
1408 RREG32(DMA_STATUS_REG));
1409
1410}
1411
1412static int cayman_gpu_soft_reset(struct radeon_device *rdev, u32 reset_mask)
1413{
1414 struct evergreen_mc_save save;
1415
1416 if (!(RREG32(GRBM_STATUS) & GUI_ACTIVE))
1417 reset_mask &= ~(RADEON_RESET_GFX | RADEON_RESET_COMPUTE);
1418
1419 if (RREG32(DMA_STATUS_REG) & DMA_IDLE)
1420 reset_mask &= ~RADEON_RESET_DMA;
1421
1422 if (reset_mask == 0)
1423 return 0;
1424
1425 dev_info(rdev->dev, "GPU softreset: 0x%08X\n", reset_mask);
1426
1427 dev_info(rdev->dev, " VM_CONTEXT0_PROTECTION_FAULT_ADDR 0x%08X\n",
1428 RREG32(0x14F8));
1429 dev_info(rdev->dev, " VM_CONTEXT0_PROTECTION_FAULT_STATUS 0x%08X\n",
1430 RREG32(0x14D8));
1431 dev_info(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n",
1432 RREG32(0x14FC));
1433 dev_info(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n",
1434 RREG32(0x14DC));
1435
1436 evergreen_mc_stop(rdev, &save);
1437 if (evergreen_mc_wait_for_idle(rdev)) {
1438 dev_warn(rdev->dev, "Wait for MC idle timedout !\n");
1439 }
1440
1441 if (reset_mask & (RADEON_RESET_GFX | RADEON_RESET_COMPUTE))
1442 cayman_gpu_soft_reset_gfx(rdev);
1443
1444 if (reset_mask & RADEON_RESET_DMA)
1445 cayman_gpu_soft_reset_dma(rdev);
1446
1447 /* Wait a little for things to settle down */
1448 udelay(50);
1449
1390 evergreen_mc_resume(rdev, &save); 1450 evergreen_mc_resume(rdev, &save);
1391 return 0; 1451 return 0;
1392} 1452}
1393 1453
1394int cayman_asic_reset(struct radeon_device *rdev) 1454int cayman_asic_reset(struct radeon_device *rdev)
1395{ 1455{
1396 return cayman_gpu_soft_reset(rdev); 1456 return cayman_gpu_soft_reset(rdev, (RADEON_RESET_GFX |
1457 RADEON_RESET_COMPUTE |
1458 RADEON_RESET_DMA));
1397} 1459}
1398 1460
1399/** 1461/**
diff --git a/drivers/gpu/drm/radeon/nid.h b/drivers/gpu/drm/radeon/nid.h
index b93186b8ee4b..48e5022ee921 100644
--- a/drivers/gpu/drm/radeon/nid.h
+++ b/drivers/gpu/drm/radeon/nid.h
@@ -65,7 +65,7 @@
65#define SOFT_RESET_VMC (1 << 17) 65#define SOFT_RESET_VMC (1 << 17)
66#define SOFT_RESET_DMA (1 << 20) 66#define SOFT_RESET_DMA (1 << 20)
67#define SOFT_RESET_TST (1 << 21) 67#define SOFT_RESET_TST (1 << 21)
68#define SOFT_RESET_REGBB (1 << 22) 68#define SOFT_RESET_REGBB (1 << 22)
69#define SOFT_RESET_ORB (1 << 23) 69#define SOFT_RESET_ORB (1 << 23)
70 70
71#define VM_CONTEXT0_REQUEST_RESPONSE 0x1470 71#define VM_CONTEXT0_REQUEST_RESPONSE 0x1470
@@ -675,4 +675,3 @@
675#define DMA_PACKET_NOP 0xf 675#define DMA_PACKET_NOP 0xf
676 676
677#endif 677#endif
678
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 2aaf147969bd..bc2540b17c5e 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -1258,9 +1258,8 @@ void r600_vram_scratch_fini(struct radeon_device *rdev)
1258 * reset, it's up to the caller to determine if the GPU needs one. We 1258 * reset, it's up to the caller to determine if the GPU needs one. We
1259 * might add an helper function to check that. 1259 * might add an helper function to check that.
1260 */ 1260 */
1261static int r600_gpu_soft_reset(struct radeon_device *rdev) 1261static void r600_gpu_soft_reset_gfx(struct radeon_device *rdev)
1262{ 1262{
1263 struct rv515_mc_save save;
1264 u32 grbm_busy_mask = S_008010_VC_BUSY(1) | S_008010_VGT_BUSY_NO_DMA(1) | 1263 u32 grbm_busy_mask = S_008010_VC_BUSY(1) | S_008010_VGT_BUSY_NO_DMA(1) |
1265 S_008010_VGT_BUSY(1) | S_008010_TA03_BUSY(1) | 1264 S_008010_VGT_BUSY(1) | S_008010_TA03_BUSY(1) |
1266 S_008010_TC_BUSY(1) | S_008010_SX_BUSY(1) | 1265 S_008010_TC_BUSY(1) | S_008010_SX_BUSY(1) |
@@ -1280,14 +1279,13 @@ static int r600_gpu_soft_reset(struct radeon_device *rdev)
1280 u32 tmp; 1279 u32 tmp;
1281 1280
1282 if (!(RREG32(GRBM_STATUS) & GUI_ACTIVE)) 1281 if (!(RREG32(GRBM_STATUS) & GUI_ACTIVE))
1283 return 0; 1282 return;
1284 1283
1285 dev_info(rdev->dev, "GPU softreset \n"); 1284 dev_info(rdev->dev, " R_008010_GRBM_STATUS = 0x%08X\n",
1286 dev_info(rdev->dev, " R_008010_GRBM_STATUS=0x%08X\n",
1287 RREG32(R_008010_GRBM_STATUS)); 1285 RREG32(R_008010_GRBM_STATUS));
1288 dev_info(rdev->dev, " R_008014_GRBM_STATUS2=0x%08X\n", 1286 dev_info(rdev->dev, " R_008014_GRBM_STATUS2 = 0x%08X\n",
1289 RREG32(R_008014_GRBM_STATUS2)); 1287 RREG32(R_008014_GRBM_STATUS2));
1290 dev_info(rdev->dev, " R_000E50_SRBM_STATUS=0x%08X\n", 1288 dev_info(rdev->dev, " R_000E50_SRBM_STATUS = 0x%08X\n",
1291 RREG32(R_000E50_SRBM_STATUS)); 1289 RREG32(R_000E50_SRBM_STATUS));
1292 dev_info(rdev->dev, " R_008674_CP_STALLED_STAT1 = 0x%08X\n", 1290 dev_info(rdev->dev, " R_008674_CP_STALLED_STAT1 = 0x%08X\n",
1293 RREG32(CP_STALLED_STAT1)); 1291 RREG32(CP_STALLED_STAT1));
@@ -1297,12 +1295,10 @@ static int r600_gpu_soft_reset(struct radeon_device *rdev)
1297 RREG32(CP_BUSY_STAT)); 1295 RREG32(CP_BUSY_STAT));
1298 dev_info(rdev->dev, " R_008680_CP_STAT = 0x%08X\n", 1296 dev_info(rdev->dev, " R_008680_CP_STAT = 0x%08X\n",
1299 RREG32(CP_STAT)); 1297 RREG32(CP_STAT));
1300 rv515_mc_stop(rdev, &save); 1298
1301 if (r600_mc_wait_for_idle(rdev)) {
1302 dev_warn(rdev->dev, "Wait for MC idle timedout !\n");
1303 }
1304 /* Disable CP parsing/prefetching */ 1299 /* Disable CP parsing/prefetching */
1305 WREG32(R_0086D8_CP_ME_CNTL, S_0086D8_CP_ME_HALT(1)); 1300 WREG32(R_0086D8_CP_ME_CNTL, S_0086D8_CP_ME_HALT(1));
1301
1306 /* Check if any of the rendering block is busy and reset it */ 1302 /* Check if any of the rendering block is busy and reset it */
1307 if ((RREG32(R_008010_GRBM_STATUS) & grbm_busy_mask) || 1303 if ((RREG32(R_008010_GRBM_STATUS) & grbm_busy_mask) ||
1308 (RREG32(R_008014_GRBM_STATUS2) & grbm2_busy_mask)) { 1304 (RREG32(R_008014_GRBM_STATUS2) & grbm2_busy_mask)) {
@@ -1332,13 +1328,12 @@ static int r600_gpu_soft_reset(struct radeon_device *rdev)
1332 RREG32(R_008020_GRBM_SOFT_RESET); 1328 RREG32(R_008020_GRBM_SOFT_RESET);
1333 mdelay(15); 1329 mdelay(15);
1334 WREG32(R_008020_GRBM_SOFT_RESET, 0); 1330 WREG32(R_008020_GRBM_SOFT_RESET, 0);
1335 /* Wait a little for things to settle down */ 1331
1336 mdelay(1); 1332 dev_info(rdev->dev, " R_008010_GRBM_STATUS = 0x%08X\n",
1337 dev_info(rdev->dev, " R_008010_GRBM_STATUS=0x%08X\n",
1338 RREG32(R_008010_GRBM_STATUS)); 1333 RREG32(R_008010_GRBM_STATUS));
1339 dev_info(rdev->dev, " R_008014_GRBM_STATUS2=0x%08X\n", 1334 dev_info(rdev->dev, " R_008014_GRBM_STATUS2 = 0x%08X\n",
1340 RREG32(R_008014_GRBM_STATUS2)); 1335 RREG32(R_008014_GRBM_STATUS2));
1341 dev_info(rdev->dev, " R_000E50_SRBM_STATUS=0x%08X\n", 1336 dev_info(rdev->dev, " R_000E50_SRBM_STATUS = 0x%08X\n",
1342 RREG32(R_000E50_SRBM_STATUS)); 1337 RREG32(R_000E50_SRBM_STATUS));
1343 dev_info(rdev->dev, " R_008674_CP_STALLED_STAT1 = 0x%08X\n", 1338 dev_info(rdev->dev, " R_008674_CP_STALLED_STAT1 = 0x%08X\n",
1344 RREG32(CP_STALLED_STAT1)); 1339 RREG32(CP_STALLED_STAT1));
@@ -1348,6 +1343,66 @@ static int r600_gpu_soft_reset(struct radeon_device *rdev)
1348 RREG32(CP_BUSY_STAT)); 1343 RREG32(CP_BUSY_STAT));
1349 dev_info(rdev->dev, " R_008680_CP_STAT = 0x%08X\n", 1344 dev_info(rdev->dev, " R_008680_CP_STAT = 0x%08X\n",
1350 RREG32(CP_STAT)); 1345 RREG32(CP_STAT));
1346
1347}
1348
1349static void r600_gpu_soft_reset_dma(struct radeon_device *rdev)
1350{
1351 u32 tmp;
1352
1353 if (RREG32(DMA_STATUS_REG) & DMA_IDLE)
1354 return;
1355
1356 dev_info(rdev->dev, " R_00D034_DMA_STATUS_REG = 0x%08X\n",
1357 RREG32(DMA_STATUS_REG));
1358
1359 /* Disable DMA */
1360 tmp = RREG32(DMA_RB_CNTL);
1361 tmp &= ~DMA_RB_ENABLE;
1362 WREG32(DMA_RB_CNTL, tmp);
1363
1364 /* Reset dma */
1365 if (rdev->family >= CHIP_RV770)
1366 WREG32(SRBM_SOFT_RESET, RV770_SOFT_RESET_DMA);
1367 else
1368 WREG32(SRBM_SOFT_RESET, SOFT_RESET_DMA);
1369 RREG32(SRBM_SOFT_RESET);
1370 udelay(50);
1371 WREG32(SRBM_SOFT_RESET, 0);
1372
1373 dev_info(rdev->dev, " R_00D034_DMA_STATUS_REG = 0x%08X\n",
1374 RREG32(DMA_STATUS_REG));
1375}
1376
1377static int r600_gpu_soft_reset(struct radeon_device *rdev, u32 reset_mask)
1378{
1379 struct rv515_mc_save save;
1380
1381 if (!(RREG32(GRBM_STATUS) & GUI_ACTIVE))
1382 reset_mask &= ~(RADEON_RESET_GFX | RADEON_RESET_COMPUTE);
1383
1384 if (RREG32(DMA_STATUS_REG) & DMA_IDLE)
1385 reset_mask &= ~RADEON_RESET_DMA;
1386
1387 if (reset_mask == 0)
1388 return 0;
1389
1390 dev_info(rdev->dev, "GPU softreset: 0x%08X\n", reset_mask);
1391
1392 rv515_mc_stop(rdev, &save);
1393 if (r600_mc_wait_for_idle(rdev)) {
1394 dev_warn(rdev->dev, "Wait for MC idle timedout !\n");
1395 }
1396
1397 if (reset_mask & (RADEON_RESET_GFX | RADEON_RESET_COMPUTE))
1398 r600_gpu_soft_reset_gfx(rdev);
1399
1400 if (reset_mask & RADEON_RESET_DMA)
1401 r600_gpu_soft_reset_dma(rdev);
1402
1403 /* Wait a little for things to settle down */
1404 mdelay(1);
1405
1351 rv515_mc_resume(rdev, &save); 1406 rv515_mc_resume(rdev, &save);
1352 return 0; 1407 return 0;
1353} 1408}
@@ -1395,7 +1450,9 @@ bool r600_dma_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring)
1395 1450
1396int r600_asic_reset(struct radeon_device *rdev) 1451int r600_asic_reset(struct radeon_device *rdev)
1397{ 1452{
1398 return r600_gpu_soft_reset(rdev); 1453 return r600_gpu_soft_reset(rdev, (RADEON_RESET_GFX |
1454 RADEON_RESET_COMPUTE |
1455 RADEON_RESET_DMA));
1399} 1456}
1400 1457
1401u32 r6xx_remap_render_backend(struct radeon_device *rdev, 1458u32 r6xx_remap_render_backend(struct radeon_device *rdev,
@@ -2256,7 +2313,7 @@ void r600_dma_stop(struct radeon_device *rdev)
2256int r600_dma_resume(struct radeon_device *rdev) 2313int r600_dma_resume(struct radeon_device *rdev)
2257{ 2314{
2258 struct radeon_ring *ring = &rdev->ring[R600_RING_TYPE_DMA_INDEX]; 2315 struct radeon_ring *ring = &rdev->ring[R600_RING_TYPE_DMA_INDEX];
2259 u32 rb_cntl, dma_cntl; 2316 u32 rb_cntl, dma_cntl, ib_cntl;
2260 u32 rb_bufsz; 2317 u32 rb_bufsz;
2261 int r; 2318 int r;
2262 2319
@@ -2296,7 +2353,11 @@ int r600_dma_resume(struct radeon_device *rdev)
2296 WREG32(DMA_RB_BASE, ring->gpu_addr >> 8); 2353 WREG32(DMA_RB_BASE, ring->gpu_addr >> 8);
2297 2354
2298 /* enable DMA IBs */ 2355 /* enable DMA IBs */
2299 WREG32(DMA_IB_CNTL, DMA_IB_ENABLE); 2356 ib_cntl = DMA_IB_ENABLE;
2357#ifdef __BIG_ENDIAN
2358 ib_cntl |= DMA_IB_SWAP_ENABLE;
2359#endif
2360 WREG32(DMA_IB_CNTL, ib_cntl);
2300 2361
2301 dma_cntl = RREG32(DMA_CNTL); 2362 dma_cntl = RREG32(DMA_CNTL);
2302 dma_cntl &= ~CTXEMPTY_INT_ENABLE; 2363 dma_cntl &= ~CTXEMPTY_INT_ENABLE;
@@ -2595,7 +2656,7 @@ int r600_copy_blit(struct radeon_device *rdev,
2595 * @num_gpu_pages: number of GPU pages to xfer 2656 * @num_gpu_pages: number of GPU pages to xfer
2596 * @fence: radeon fence object 2657 * @fence: radeon fence object
2597 * 2658 *
2598 * Copy GPU paging using the DMA engine (r6xx-r7xx). 2659 * Copy GPU paging using the DMA engine (r6xx).
2599 * Used by the radeon ttm implementation to move pages if 2660 * Used by the radeon ttm implementation to move pages if
2600 * registered as the asic copy callback. 2661 * registered as the asic copy callback.
2601 */ 2662 */
@@ -2618,8 +2679,8 @@ int r600_copy_dma(struct radeon_device *rdev,
2618 } 2679 }
2619 2680
2620 size_in_dw = (num_gpu_pages << RADEON_GPU_PAGE_SHIFT) / 4; 2681 size_in_dw = (num_gpu_pages << RADEON_GPU_PAGE_SHIFT) / 4;
2621 num_loops = DIV_ROUND_UP(size_in_dw, 0xffff); 2682 num_loops = DIV_ROUND_UP(size_in_dw, 0xFFFE);
2622 r = radeon_ring_lock(rdev, ring, num_loops * 5 + 8); 2683 r = radeon_ring_lock(rdev, ring, num_loops * 4 + 8);
2623 if (r) { 2684 if (r) {
2624 DRM_ERROR("radeon: moving bo (%d).\n", r); 2685 DRM_ERROR("radeon: moving bo (%d).\n", r);
2625 radeon_semaphore_free(rdev, &sem, NULL); 2686 radeon_semaphore_free(rdev, &sem, NULL);
@@ -2636,14 +2697,14 @@ int r600_copy_dma(struct radeon_device *rdev,
2636 2697
2637 for (i = 0; i < num_loops; i++) { 2698 for (i = 0; i < num_loops; i++) {
2638 cur_size_in_dw = size_in_dw; 2699 cur_size_in_dw = size_in_dw;
2639 if (cur_size_in_dw > 0xFFFF) 2700 if (cur_size_in_dw > 0xFFFE)
2640 cur_size_in_dw = 0xFFFF; 2701 cur_size_in_dw = 0xFFFE;
2641 size_in_dw -= cur_size_in_dw; 2702 size_in_dw -= cur_size_in_dw;
2642 radeon_ring_write(ring, DMA_PACKET(DMA_PACKET_COPY, 0, 0, cur_size_in_dw)); 2703 radeon_ring_write(ring, DMA_PACKET(DMA_PACKET_COPY, 0, 0, cur_size_in_dw));
2643 radeon_ring_write(ring, dst_offset & 0xfffffffc); 2704 radeon_ring_write(ring, dst_offset & 0xfffffffc);
2644 radeon_ring_write(ring, src_offset & 0xfffffffc); 2705 radeon_ring_write(ring, src_offset & 0xfffffffc);
2645 radeon_ring_write(ring, upper_32_bits(dst_offset) & 0xff); 2706 radeon_ring_write(ring, (((upper_32_bits(dst_offset) & 0xff) << 16) |
2646 radeon_ring_write(ring, upper_32_bits(src_offset) & 0xff); 2707 (upper_32_bits(src_offset) & 0xff)));
2647 src_offset += cur_size_in_dw * 4; 2708 src_offset += cur_size_in_dw * 4;
2648 dst_offset += cur_size_in_dw * 4; 2709 dst_offset += cur_size_in_dw * 4;
2649 } 2710 }
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
index 0be768be530c..69ec24ab8d63 100644
--- a/drivers/gpu/drm/radeon/r600_cs.c
+++ b/drivers/gpu/drm/radeon/r600_cs.c
@@ -2294,6 +2294,35 @@ static int r600_packet3_check(struct radeon_cs_parser *p,
2294 ib[idx+4] = upper_32_bits(offset) & 0xff; 2294 ib[idx+4] = upper_32_bits(offset) & 0xff;
2295 } 2295 }
2296 break; 2296 break;
2297 case PACKET3_MEM_WRITE:
2298 {
2299 u64 offset;
2300
2301 if (pkt->count != 3) {
2302 DRM_ERROR("bad MEM_WRITE (invalid count)\n");
2303 return -EINVAL;
2304 }
2305 r = r600_cs_packet_next_reloc(p, &reloc);
2306 if (r) {
2307 DRM_ERROR("bad MEM_WRITE (missing reloc)\n");
2308 return -EINVAL;
2309 }
2310 offset = radeon_get_ib_value(p, idx+0);
2311 offset += ((u64)(radeon_get_ib_value(p, idx+1) & 0xff)) << 32UL;
2312 if (offset & 0x7) {
2313 DRM_ERROR("bad MEM_WRITE (address not qwords aligned)\n");
2314 return -EINVAL;
2315 }
2316 if ((offset + 8) > radeon_bo_size(reloc->robj)) {
2317 DRM_ERROR("bad MEM_WRITE bo too small: 0x%llx, 0x%lx\n",
2318 offset + 8, radeon_bo_size(reloc->robj));
2319 return -EINVAL;
2320 }
2321 offset += reloc->lobj.gpu_offset;
2322 ib[idx+0] = offset;
2323 ib[idx+1] = upper_32_bits(offset) & 0xff;
2324 break;
2325 }
2297 case PACKET3_COPY_DW: 2326 case PACKET3_COPY_DW:
2298 if (pkt->count != 4) { 2327 if (pkt->count != 4) {
2299 DRM_ERROR("bad COPY_DW (invalid count)\n"); 2328 DRM_ERROR("bad COPY_DW (invalid count)\n");
@@ -2447,8 +2476,10 @@ static void r600_cs_parser_fini(struct radeon_cs_parser *parser, int error)
2447 kfree(parser->relocs); 2476 kfree(parser->relocs);
2448 for (i = 0; i < parser->nchunks; i++) { 2477 for (i = 0; i < parser->nchunks; i++) {
2449 kfree(parser->chunks[i].kdata); 2478 kfree(parser->chunks[i].kdata);
2450 kfree(parser->chunks[i].kpage[0]); 2479 if (parser->rdev && (parser->rdev->flags & RADEON_IS_AGP)) {
2451 kfree(parser->chunks[i].kpage[1]); 2480 kfree(parser->chunks[i].kpage[0]);
2481 kfree(parser->chunks[i].kpage[1]);
2482 }
2452 } 2483 }
2453 kfree(parser->chunks); 2484 kfree(parser->chunks);
2454 kfree(parser->chunks_array); 2485 kfree(parser->chunks_array);
@@ -2532,16 +2563,16 @@ int r600_dma_cs_next_reloc(struct radeon_cs_parser *p,
2532 struct radeon_cs_chunk *relocs_chunk; 2563 struct radeon_cs_chunk *relocs_chunk;
2533 unsigned idx; 2564 unsigned idx;
2534 2565
2566 *cs_reloc = NULL;
2535 if (p->chunk_relocs_idx == -1) { 2567 if (p->chunk_relocs_idx == -1) {
2536 DRM_ERROR("No relocation chunk !\n"); 2568 DRM_ERROR("No relocation chunk !\n");
2537 return -EINVAL; 2569 return -EINVAL;
2538 } 2570 }
2539 *cs_reloc = NULL;
2540 relocs_chunk = &p->chunks[p->chunk_relocs_idx]; 2571 relocs_chunk = &p->chunks[p->chunk_relocs_idx];
2541 idx = p->dma_reloc_idx; 2572 idx = p->dma_reloc_idx;
2542 if (idx >= relocs_chunk->length_dw) { 2573 if (idx >= p->nrelocs) {
2543 DRM_ERROR("Relocs at %d after relocations chunk end %d !\n", 2574 DRM_ERROR("Relocs at %d after relocations chunk end %d !\n",
2544 idx, relocs_chunk->length_dw); 2575 idx, p->nrelocs);
2545 return -EINVAL; 2576 return -EINVAL;
2546 } 2577 }
2547 *cs_reloc = p->relocs_ptr[idx]; 2578 *cs_reloc = p->relocs_ptr[idx];
@@ -2648,16 +2679,29 @@ int r600_dma_cs_parse(struct radeon_cs_parser *p)
2648 } 2679 }
2649 p->idx += 7; 2680 p->idx += 7;
2650 } else { 2681 } else {
2651 src_offset = ib[idx+2]; 2682 if (p->family >= CHIP_RV770) {
2652 src_offset |= ((u64)(ib[idx+4] & 0xff)) << 32; 2683 src_offset = ib[idx+2];
2653 dst_offset = ib[idx+1]; 2684 src_offset |= ((u64)(ib[idx+4] & 0xff)) << 32;
2654 dst_offset |= ((u64)(ib[idx+3] & 0xff)) << 32; 2685 dst_offset = ib[idx+1];
2686 dst_offset |= ((u64)(ib[idx+3] & 0xff)) << 32;
2655 2687
2656 ib[idx+1] += (u32)(dst_reloc->lobj.gpu_offset & 0xfffffffc); 2688 ib[idx+1] += (u32)(dst_reloc->lobj.gpu_offset & 0xfffffffc);
2657 ib[idx+2] += (u32)(src_reloc->lobj.gpu_offset & 0xfffffffc); 2689 ib[idx+2] += (u32)(src_reloc->lobj.gpu_offset & 0xfffffffc);
2658 ib[idx+3] += upper_32_bits(dst_reloc->lobj.gpu_offset) & 0xff; 2690 ib[idx+3] += upper_32_bits(dst_reloc->lobj.gpu_offset) & 0xff;
2659 ib[idx+4] += upper_32_bits(src_reloc->lobj.gpu_offset) & 0xff; 2691 ib[idx+4] += upper_32_bits(src_reloc->lobj.gpu_offset) & 0xff;
2660 p->idx += 5; 2692 p->idx += 5;
2693 } else {
2694 src_offset = ib[idx+2];
2695 src_offset |= ((u64)(ib[idx+3] & 0xff)) << 32;
2696 dst_offset = ib[idx+1];
2697 dst_offset |= ((u64)(ib[idx+3] & 0xff0000)) << 16;
2698
2699 ib[idx+1] += (u32)(dst_reloc->lobj.gpu_offset & 0xfffffffc);
2700 ib[idx+2] += (u32)(src_reloc->lobj.gpu_offset & 0xfffffffc);
2701 ib[idx+3] += upper_32_bits(src_reloc->lobj.gpu_offset) & 0xff;
2702 ib[idx+3] += (upper_32_bits(dst_reloc->lobj.gpu_offset) & 0xff) << 16;
2703 p->idx += 4;
2704 }
2661 } 2705 }
2662 if ((src_offset + (count * 4)) > radeon_bo_size(src_reloc->robj)) { 2706 if ((src_offset + (count * 4)) > radeon_bo_size(src_reloc->robj)) {
2663 dev_warn(p->dev, "DMA copy src buffer too small (%llu %lu)\n", 2707 dev_warn(p->dev, "DMA copy src buffer too small (%llu %lu)\n",
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 5dc744d43d12..a08f657329a0 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -132,6 +132,11 @@ extern int radeon_lockup_timeout;
132#define RADEON_VA_RESERVED_SIZE (8 << 20) 132#define RADEON_VA_RESERVED_SIZE (8 << 20)
133#define RADEON_IB_VM_MAX_SIZE (64 << 10) 133#define RADEON_IB_VM_MAX_SIZE (64 << 10)
134 134
135/* reset flags */
136#define RADEON_RESET_GFX (1 << 0)
137#define RADEON_RESET_COMPUTE (1 << 1)
138#define RADEON_RESET_DMA (1 << 2)
139
135/* 140/*
136 * Errata workarounds. 141 * Errata workarounds.
137 */ 142 */
@@ -225,12 +230,13 @@ struct radeon_fence {
225int radeon_fence_driver_start_ring(struct radeon_device *rdev, int ring); 230int radeon_fence_driver_start_ring(struct radeon_device *rdev, int ring);
226int radeon_fence_driver_init(struct radeon_device *rdev); 231int radeon_fence_driver_init(struct radeon_device *rdev);
227void radeon_fence_driver_fini(struct radeon_device *rdev); 232void radeon_fence_driver_fini(struct radeon_device *rdev);
233void radeon_fence_driver_force_completion(struct radeon_device *rdev);
228int radeon_fence_emit(struct radeon_device *rdev, struct radeon_fence **fence, int ring); 234int radeon_fence_emit(struct radeon_device *rdev, struct radeon_fence **fence, int ring);
229void radeon_fence_process(struct radeon_device *rdev, int ring); 235void radeon_fence_process(struct radeon_device *rdev, int ring);
230bool radeon_fence_signaled(struct radeon_fence *fence); 236bool radeon_fence_signaled(struct radeon_fence *fence);
231int radeon_fence_wait(struct radeon_fence *fence, bool interruptible); 237int radeon_fence_wait(struct radeon_fence *fence, bool interruptible);
232int radeon_fence_wait_next_locked(struct radeon_device *rdev, int ring); 238int radeon_fence_wait_next_locked(struct radeon_device *rdev, int ring);
233void radeon_fence_wait_empty_locked(struct radeon_device *rdev, int ring); 239int radeon_fence_wait_empty_locked(struct radeon_device *rdev, int ring);
234int radeon_fence_wait_any(struct radeon_device *rdev, 240int radeon_fence_wait_any(struct radeon_device *rdev,
235 struct radeon_fence **fences, 241 struct radeon_fence **fences,
236 bool intr); 242 bool intr);
@@ -318,7 +324,6 @@ struct radeon_bo {
318 struct list_head list; 324 struct list_head list;
319 /* Protected by tbo.reserved */ 325 /* Protected by tbo.reserved */
320 u32 placements[3]; 326 u32 placements[3];
321 u32 busy_placements[3];
322 struct ttm_placement placement; 327 struct ttm_placement placement;
323 struct ttm_buffer_object tbo; 328 struct ttm_buffer_object tbo;
324 struct ttm_bo_kmap_obj kmap; 329 struct ttm_bo_kmap_obj kmap;
@@ -648,6 +653,8 @@ struct radeon_ring {
648 u32 ptr_reg_mask; 653 u32 ptr_reg_mask;
649 u32 nop; 654 u32 nop;
650 u32 idx; 655 u32 idx;
656 u64 last_semaphore_signal_addr;
657 u64 last_semaphore_wait_addr;
651}; 658};
652 659
653/* 660/*
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c
index 596bcbe80ed0..9056fafb00ea 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.c
+++ b/drivers/gpu/drm/radeon/radeon_asic.c
@@ -1140,9 +1140,9 @@ static struct radeon_asic rv770_asic = {
1140 .copy = { 1140 .copy = {
1141 .blit = &r600_copy_blit, 1141 .blit = &r600_copy_blit,
1142 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX, 1142 .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
1143 .dma = &r600_copy_dma, 1143 .dma = &rv770_copy_dma,
1144 .dma_ring_index = R600_RING_TYPE_DMA_INDEX, 1144 .dma_ring_index = R600_RING_TYPE_DMA_INDEX,
1145 .copy = &r600_copy_dma, 1145 .copy = &rv770_copy_dma,
1146 .copy_ring_index = R600_RING_TYPE_DMA_INDEX, 1146 .copy_ring_index = R600_RING_TYPE_DMA_INDEX,
1147 }, 1147 },
1148 .surface = { 1148 .surface = {
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h
index 5f4882cc2152..15d70e613076 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.h
+++ b/drivers/gpu/drm/radeon/radeon_asic.h
@@ -403,6 +403,10 @@ u32 rv770_page_flip(struct radeon_device *rdev, int crtc, u64 crtc_base);
403void r700_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc); 403void r700_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc);
404void r700_cp_stop(struct radeon_device *rdev); 404void r700_cp_stop(struct radeon_device *rdev);
405void r700_cp_fini(struct radeon_device *rdev); 405void r700_cp_fini(struct radeon_device *rdev);
406int rv770_copy_dma(struct radeon_device *rdev,
407 uint64_t src_offset, uint64_t dst_offset,
408 unsigned num_gpu_pages,
409 struct radeon_fence **fence);
406 410
407/* 411/*
408 * evergreen 412 * evergreen
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c
index 4af89126e223..33a56a09ff10 100644
--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -1548,6 +1548,9 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1548 of_machine_is_compatible("PowerBook6,7")) { 1548 of_machine_is_compatible("PowerBook6,7")) {
1549 /* ibook */ 1549 /* ibook */
1550 rdev->mode_info.connector_table = CT_IBOOK; 1550 rdev->mode_info.connector_table = CT_IBOOK;
1551 } else if (of_machine_is_compatible("PowerMac3,5")) {
1552 /* PowerMac G4 Silver radeon 7500 */
1553 rdev->mode_info.connector_table = CT_MAC_G4_SILVER;
1551 } else if (of_machine_is_compatible("PowerMac4,4")) { 1554 } else if (of_machine_is_compatible("PowerMac4,4")) {
1552 /* emac */ 1555 /* emac */
1553 rdev->mode_info.connector_table = CT_EMAC; 1556 rdev->mode_info.connector_table = CT_EMAC;
@@ -2212,6 +2215,54 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
2212 CONNECTOR_OBJECT_ID_SVIDEO, 2215 CONNECTOR_OBJECT_ID_SVIDEO,
2213 &hpd); 2216 &hpd);
2214 break; 2217 break;
2218 case CT_MAC_G4_SILVER:
2219 DRM_INFO("Connector Table: %d (mac g4 silver)\n",
2220 rdev->mode_info.connector_table);
2221 /* DVI-I - tv dac, int tmds */
2222 ddc_i2c = combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0);
2223 hpd.hpd = RADEON_HPD_1; /* ??? */
2224 radeon_add_legacy_encoder(dev,
2225 radeon_get_encoder_enum(dev,
2226 ATOM_DEVICE_DFP1_SUPPORT,
2227 0),
2228 ATOM_DEVICE_DFP1_SUPPORT);
2229 radeon_add_legacy_encoder(dev,
2230 radeon_get_encoder_enum(dev,
2231 ATOM_DEVICE_CRT2_SUPPORT,
2232 2),
2233 ATOM_DEVICE_CRT2_SUPPORT);
2234 radeon_add_legacy_connector(dev, 0,
2235 ATOM_DEVICE_DFP1_SUPPORT |
2236 ATOM_DEVICE_CRT2_SUPPORT,
2237 DRM_MODE_CONNECTOR_DVII, &ddc_i2c,
2238 CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I,
2239 &hpd);
2240 /* VGA - primary dac */
2241 ddc_i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0);
2242 hpd.hpd = RADEON_HPD_NONE;
2243 radeon_add_legacy_encoder(dev,
2244 radeon_get_encoder_enum(dev,
2245 ATOM_DEVICE_CRT1_SUPPORT,
2246 1),
2247 ATOM_DEVICE_CRT1_SUPPORT);
2248 radeon_add_legacy_connector(dev, 1, ATOM_DEVICE_CRT1_SUPPORT,
2249 DRM_MODE_CONNECTOR_VGA, &ddc_i2c,
2250 CONNECTOR_OBJECT_ID_VGA,
2251 &hpd);
2252 /* TV - TV DAC */
2253 ddc_i2c.valid = false;
2254 hpd.hpd = RADEON_HPD_NONE;
2255 radeon_add_legacy_encoder(dev,
2256 radeon_get_encoder_enum(dev,
2257 ATOM_DEVICE_TV1_SUPPORT,
2258 2),
2259 ATOM_DEVICE_TV1_SUPPORT);
2260 radeon_add_legacy_connector(dev, 2, ATOM_DEVICE_TV1_SUPPORT,
2261 DRM_MODE_CONNECTOR_SVIDEO,
2262 &ddc_i2c,
2263 CONNECTOR_OBJECT_ID_SVIDEO,
2264 &hpd);
2265 break;
2215 default: 2266 default:
2216 DRM_INFO("Connector table: %d (invalid)\n", 2267 DRM_INFO("Connector table: %d (invalid)\n",
2217 rdev->mode_info.connector_table); 2268 rdev->mode_info.connector_table);
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index 47bf162ab9c6..2399f25ec037 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -741,7 +741,7 @@ radeon_vga_detect(struct drm_connector *connector, bool force)
741 ret = connector_status_disconnected; 741 ret = connector_status_disconnected;
742 742
743 if (radeon_connector->ddc_bus) 743 if (radeon_connector->ddc_bus)
744 dret = radeon_ddc_probe(radeon_connector); 744 dret = radeon_ddc_probe(radeon_connector, false);
745 if (dret) { 745 if (dret) {
746 radeon_connector->detected_by_load = false; 746 radeon_connector->detected_by_load = false;
747 if (radeon_connector->edid) { 747 if (radeon_connector->edid) {
@@ -947,7 +947,7 @@ radeon_dvi_detect(struct drm_connector *connector, bool force)
947 return connector->status; 947 return connector->status;
948 948
949 if (radeon_connector->ddc_bus) 949 if (radeon_connector->ddc_bus)
950 dret = radeon_ddc_probe(radeon_connector); 950 dret = radeon_ddc_probe(radeon_connector, false);
951 if (dret) { 951 if (dret) {
952 radeon_connector->detected_by_load = false; 952 radeon_connector->detected_by_load = false;
953 if (radeon_connector->edid) { 953 if (radeon_connector->edid) {
@@ -1401,7 +1401,8 @@ radeon_dp_detect(struct drm_connector *connector, bool force)
1401 if (encoder) { 1401 if (encoder) {
1402 /* setup ddc on the bridge */ 1402 /* setup ddc on the bridge */
1403 radeon_atom_ext_encoder_setup_ddc(encoder); 1403 radeon_atom_ext_encoder_setup_ddc(encoder);
1404 if (radeon_ddc_probe(radeon_connector)) /* try DDC */ 1404 /* bridge chips are always aux */
1405 if (radeon_ddc_probe(radeon_connector, true)) /* try DDC */
1405 ret = connector_status_connected; 1406 ret = connector_status_connected;
1406 else if (radeon_connector->dac_load_detect) { /* try load detection */ 1407 else if (radeon_connector->dac_load_detect) { /* try load detection */
1407 struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private; 1408 struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private;
@@ -1419,7 +1420,8 @@ radeon_dp_detect(struct drm_connector *connector, bool force)
1419 if (radeon_dp_getdpcd(radeon_connector)) 1420 if (radeon_dp_getdpcd(radeon_connector))
1420 ret = connector_status_connected; 1421 ret = connector_status_connected;
1421 } else { 1422 } else {
1422 if (radeon_ddc_probe(radeon_connector)) 1423 /* try non-aux ddc (DP to DVI/HMDI/etc. adapter) */
1424 if (radeon_ddc_probe(radeon_connector, false))
1423 ret = connector_status_connected; 1425 ret = connector_status_connected;
1424 } 1426 }
1425 } 1427 }
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c
index 396baba0141a..5407459e56d2 100644
--- a/drivers/gpu/drm/radeon/radeon_cs.c
+++ b/drivers/gpu/drm/radeon/radeon_cs.c
@@ -279,13 +279,15 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data)
279 p->chunks[p->chunk_ib_idx].length_dw); 279 p->chunks[p->chunk_ib_idx].length_dw);
280 return -EINVAL; 280 return -EINVAL;
281 } 281 }
282 if ((p->rdev->flags & RADEON_IS_AGP)) { 282 if (p->rdev && (p->rdev->flags & RADEON_IS_AGP)) {
283 p->chunks[p->chunk_ib_idx].kpage[0] = kmalloc(PAGE_SIZE, GFP_KERNEL); 283 p->chunks[p->chunk_ib_idx].kpage[0] = kmalloc(PAGE_SIZE, GFP_KERNEL);
284 p->chunks[p->chunk_ib_idx].kpage[1] = kmalloc(PAGE_SIZE, GFP_KERNEL); 284 p->chunks[p->chunk_ib_idx].kpage[1] = kmalloc(PAGE_SIZE, GFP_KERNEL);
285 if (p->chunks[p->chunk_ib_idx].kpage[0] == NULL || 285 if (p->chunks[p->chunk_ib_idx].kpage[0] == NULL ||
286 p->chunks[p->chunk_ib_idx].kpage[1] == NULL) { 286 p->chunks[p->chunk_ib_idx].kpage[1] == NULL) {
287 kfree(p->chunks[i].kpage[0]); 287 kfree(p->chunks[p->chunk_ib_idx].kpage[0]);
288 kfree(p->chunks[i].kpage[1]); 288 kfree(p->chunks[p->chunk_ib_idx].kpage[1]);
289 p->chunks[p->chunk_ib_idx].kpage[0] = NULL;
290 p->chunks[p->chunk_ib_idx].kpage[1] = NULL;
289 return -ENOMEM; 291 return -ENOMEM;
290 } 292 }
291 } 293 }
@@ -583,7 +585,8 @@ static int radeon_cs_update_pages(struct radeon_cs_parser *p, int pg_idx)
583 struct radeon_cs_chunk *ibc = &p->chunks[p->chunk_ib_idx]; 585 struct radeon_cs_chunk *ibc = &p->chunks[p->chunk_ib_idx];
584 int i; 586 int i;
585 int size = PAGE_SIZE; 587 int size = PAGE_SIZE;
586 bool copy1 = (p->rdev->flags & RADEON_IS_AGP) ? false : true; 588 bool copy1 = (p->rdev && (p->rdev->flags & RADEON_IS_AGP)) ?
589 false : true;
587 590
588 for (i = ibc->last_copied_page + 1; i < pg_idx; i++) { 591 for (i = ibc->last_copied_page + 1; i < pg_idx; i++) {
589 if (DRM_COPY_FROM_USER(p->ib.ptr + (i * (PAGE_SIZE/4)), 592 if (DRM_COPY_FROM_USER(p->ib.ptr + (i * (PAGE_SIZE/4)),
diff --git a/drivers/gpu/drm/radeon/radeon_cursor.c b/drivers/gpu/drm/radeon/radeon_cursor.c
index ad6df625e8b8..0d67674b64b1 100644
--- a/drivers/gpu/drm/radeon/radeon_cursor.c
+++ b/drivers/gpu/drm/radeon/radeon_cursor.c
@@ -241,7 +241,8 @@ int radeon_crtc_cursor_move(struct drm_crtc *crtc,
241 y = 0; 241 y = 0;
242 } 242 }
243 243
244 if (ASIC_IS_AVIVO(rdev)) { 244 /* fixed on DCE6 and newer */
245 if (ASIC_IS_AVIVO(rdev) && !ASIC_IS_DCE6(rdev)) {
245 int i = 0; 246 int i = 0;
246 struct drm_crtc *crtc_p; 247 struct drm_crtc *crtc_p;
247 248
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 49b06590001e..0d6562bb0c93 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -429,7 +429,8 @@ bool radeon_card_posted(struct radeon_device *rdev)
429{ 429{
430 uint32_t reg; 430 uint32_t reg;
431 431
432 if (efi_enabled && rdev->pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE) 432 if (efi_enabled(EFI_BOOT) &&
433 rdev->pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE)
433 return false; 434 return false;
434 435
435 /* first check CRTCs */ 436 /* first check CRTCs */
@@ -897,6 +898,25 @@ static void radeon_check_arguments(struct radeon_device *rdev)
897} 898}
898 899
899/** 900/**
901 * radeon_switcheroo_quirk_long_wakeup - return true if longer d3 delay is
902 * needed for waking up.
903 *
904 * @pdev: pci dev pointer
905 */
906static bool radeon_switcheroo_quirk_long_wakeup(struct pci_dev *pdev)
907{
908
909 /* 6600m in a macbook pro */
910 if (pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE &&
911 pdev->subsystem_device == 0x00e2) {
912 printk(KERN_INFO "radeon: quirking longer d3 wakeup delay\n");
913 return true;
914 }
915
916 return false;
917}
918
919/**
900 * radeon_switcheroo_set_state - set switcheroo state 920 * radeon_switcheroo_set_state - set switcheroo state
901 * 921 *
902 * @pdev: pci dev pointer 922 * @pdev: pci dev pointer
@@ -910,10 +930,19 @@ static void radeon_switcheroo_set_state(struct pci_dev *pdev, enum vga_switchero
910 struct drm_device *dev = pci_get_drvdata(pdev); 930 struct drm_device *dev = pci_get_drvdata(pdev);
911 pm_message_t pmm = { .event = PM_EVENT_SUSPEND }; 931 pm_message_t pmm = { .event = PM_EVENT_SUSPEND };
912 if (state == VGA_SWITCHEROO_ON) { 932 if (state == VGA_SWITCHEROO_ON) {
933 unsigned d3_delay = dev->pdev->d3_delay;
934
913 printk(KERN_INFO "radeon: switched on\n"); 935 printk(KERN_INFO "radeon: switched on\n");
914 /* don't suspend or resume card normally */ 936 /* don't suspend or resume card normally */
915 dev->switch_power_state = DRM_SWITCH_POWER_CHANGING; 937 dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
938
939 if (d3_delay < 20 && radeon_switcheroo_quirk_long_wakeup(pdev))
940 dev->pdev->d3_delay = 20;
941
916 radeon_resume_kms(dev); 942 radeon_resume_kms(dev);
943
944 dev->pdev->d3_delay = d3_delay;
945
917 dev->switch_power_state = DRM_SWITCH_POWER_ON; 946 dev->switch_power_state = DRM_SWITCH_POWER_ON;
918 drm_kms_helper_poll_enable(dev); 947 drm_kms_helper_poll_enable(dev);
919 } else { 948 } else {
@@ -1164,6 +1193,7 @@ int radeon_suspend_kms(struct drm_device *dev, pm_message_t state)
1164 struct drm_crtc *crtc; 1193 struct drm_crtc *crtc;
1165 struct drm_connector *connector; 1194 struct drm_connector *connector;
1166 int i, r; 1195 int i, r;
1196 bool force_completion = false;
1167 1197
1168 if (dev == NULL || dev->dev_private == NULL) { 1198 if (dev == NULL || dev->dev_private == NULL) {
1169 return -ENODEV; 1199 return -ENODEV;
@@ -1206,8 +1236,16 @@ int radeon_suspend_kms(struct drm_device *dev, pm_message_t state)
1206 1236
1207 mutex_lock(&rdev->ring_lock); 1237 mutex_lock(&rdev->ring_lock);
1208 /* wait for gpu to finish processing current batch */ 1238 /* wait for gpu to finish processing current batch */
1209 for (i = 0; i < RADEON_NUM_RINGS; i++) 1239 for (i = 0; i < RADEON_NUM_RINGS; i++) {
1210 radeon_fence_wait_empty_locked(rdev, i); 1240 r = radeon_fence_wait_empty_locked(rdev, i);
1241 if (r) {
1242 /* delay GPU reset to resume */
1243 force_completion = true;
1244 }
1245 }
1246 if (force_completion) {
1247 radeon_fence_driver_force_completion(rdev);
1248 }
1211 mutex_unlock(&rdev->ring_lock); 1249 mutex_unlock(&rdev->ring_lock);
1212 1250
1213 radeon_save_bios_scratch_regs(rdev); 1251 radeon_save_bios_scratch_regs(rdev);
@@ -1338,7 +1376,6 @@ retry:
1338 } 1376 }
1339 1377
1340 radeon_restore_bios_scratch_regs(rdev); 1378 radeon_restore_bios_scratch_regs(rdev);
1341 drm_helper_resume_force_mode(rdev->ddev);
1342 1379
1343 if (!r) { 1380 if (!r) {
1344 for (i = 0; i < RADEON_NUM_RINGS; ++i) { 1381 for (i = 0; i < RADEON_NUM_RINGS; ++i) {
@@ -1358,11 +1395,14 @@ retry:
1358 } 1395 }
1359 } 1396 }
1360 } else { 1397 } else {
1398 radeon_fence_driver_force_completion(rdev);
1361 for (i = 0; i < RADEON_NUM_RINGS; ++i) { 1399 for (i = 0; i < RADEON_NUM_RINGS; ++i) {
1362 kfree(ring_data[i]); 1400 kfree(ring_data[i]);
1363 } 1401 }
1364 } 1402 }
1365 1403
1404 drm_helper_resume_force_mode(rdev->ddev);
1405
1366 ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched); 1406 ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched);
1367 if (r) { 1407 if (r) {
1368 /* bad news, how to tell it to userspace ? */ 1408 /* bad news, how to tell it to userspace ? */
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 310c0e5254ba..ff3def784619 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -699,10 +699,15 @@ int radeon_ddc_get_modes(struct radeon_connector *radeon_connector)
699 if (radeon_connector->router.ddc_valid) 699 if (radeon_connector->router.ddc_valid)
700 radeon_router_select_ddc_port(radeon_connector); 700 radeon_router_select_ddc_port(radeon_connector);
701 701
702 if ((radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort) || 702 if (radeon_connector_encoder_get_dp_bridge_encoder_id(&radeon_connector->base) !=
703 (radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_eDP) || 703 ENCODER_OBJECT_ID_NONE) {
704 (radeon_connector_encoder_get_dp_bridge_encoder_id(&radeon_connector->base) != 704 struct radeon_connector_atom_dig *dig = radeon_connector->con_priv;
705 ENCODER_OBJECT_ID_NONE)) { 705
706 if (dig->dp_i2c_bus)
707 radeon_connector->edid = drm_get_edid(&radeon_connector->base,
708 &dig->dp_i2c_bus->adapter);
709 } else if ((radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort) ||
710 (radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_eDP)) {
706 struct radeon_connector_atom_dig *dig = radeon_connector->con_priv; 711 struct radeon_connector_atom_dig *dig = radeon_connector->con_priv;
707 712
708 if ((dig->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT || 713 if ((dig->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT ||
@@ -1117,7 +1122,7 @@ radeon_user_framebuffer_create(struct drm_device *dev,
1117 if (ret) { 1122 if (ret) {
1118 kfree(radeon_fb); 1123 kfree(radeon_fb);
1119 drm_gem_object_unreference_unlocked(obj); 1124 drm_gem_object_unreference_unlocked(obj);
1120 return NULL; 1125 return ERR_PTR(ret);
1121 } 1126 }
1122 1127
1123 return &radeon_fb->base; 1128 return &radeon_fb->base;
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 9b1a727d3c9e..d9bf96ee299a 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -68,9 +68,11 @@
68 * 2.25.0 - eg+: new info request for num SE and num SH 68 * 2.25.0 - eg+: new info request for num SE and num SH
69 * 2.26.0 - r600-eg: fix htile size computation 69 * 2.26.0 - r600-eg: fix htile size computation
70 * 2.27.0 - r600-SI: Add CS ioctl support for async DMA 70 * 2.27.0 - r600-SI: Add CS ioctl support for async DMA
71 * 2.28.0 - r600-eg: Add MEM_WRITE packet support
72 * 2.29.0 - R500 FP16 color clear registers
71 */ 73 */
72#define KMS_DRIVER_MAJOR 2 74#define KMS_DRIVER_MAJOR 2
73#define KMS_DRIVER_MINOR 27 75#define KMS_DRIVER_MINOR 29
74#define KMS_DRIVER_PATCHLEVEL 0 76#define KMS_DRIVER_PATCHLEVEL 0
75int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); 77int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
76int radeon_driver_unload_kms(struct drm_device *dev); 78int radeon_driver_unload_kms(struct drm_device *dev);
@@ -305,8 +307,8 @@ static int radeon_kick_out_firmware_fb(struct pci_dev *pdev)
305 return 0; 307 return 0;
306} 308}
307 309
308static int __devinit 310static int radeon_pci_probe(struct pci_dev *pdev,
309radeon_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 311 const struct pci_device_id *ent)
310{ 312{
311 int ret; 313 int ret;
312 314
diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c
index 410a975a8eec..34356252567a 100644
--- a/drivers/gpu/drm/radeon/radeon_fence.c
+++ b/drivers/gpu/drm/radeon/radeon_fence.c
@@ -609,26 +609,20 @@ int radeon_fence_wait_next_locked(struct radeon_device *rdev, int ring)
609 * Returns 0 if the fences have passed, error for all other cases. 609 * Returns 0 if the fences have passed, error for all other cases.
610 * Caller must hold ring lock. 610 * Caller must hold ring lock.
611 */ 611 */
612void radeon_fence_wait_empty_locked(struct radeon_device *rdev, int ring) 612int radeon_fence_wait_empty_locked(struct radeon_device *rdev, int ring)
613{ 613{
614 uint64_t seq = rdev->fence_drv[ring].sync_seq[ring]; 614 uint64_t seq = rdev->fence_drv[ring].sync_seq[ring];
615 int r;
615 616
616 while(1) { 617 r = radeon_fence_wait_seq(rdev, seq, ring, false, false);
617 int r; 618 if (r) {
618 r = radeon_fence_wait_seq(rdev, seq, ring, false, false);
619 if (r == -EDEADLK) { 619 if (r == -EDEADLK) {
620 mutex_unlock(&rdev->ring_lock); 620 return -EDEADLK;
621 r = radeon_gpu_reset(rdev);
622 mutex_lock(&rdev->ring_lock);
623 if (!r)
624 continue;
625 }
626 if (r) {
627 dev_err(rdev->dev, "error waiting for ring to become"
628 " idle (%d)\n", r);
629 } 621 }
630 return; 622 dev_err(rdev->dev, "error waiting for ring[%d] to become idle (%d)\n",
623 ring, r);
631 } 624 }
625 return 0;
632} 626}
633 627
634/** 628/**
@@ -854,13 +848,17 @@ int radeon_fence_driver_init(struct radeon_device *rdev)
854 */ 848 */
855void radeon_fence_driver_fini(struct radeon_device *rdev) 849void radeon_fence_driver_fini(struct radeon_device *rdev)
856{ 850{
857 int ring; 851 int ring, r;
858 852
859 mutex_lock(&rdev->ring_lock); 853 mutex_lock(&rdev->ring_lock);
860 for (ring = 0; ring < RADEON_NUM_RINGS; ring++) { 854 for (ring = 0; ring < RADEON_NUM_RINGS; ring++) {
861 if (!rdev->fence_drv[ring].initialized) 855 if (!rdev->fence_drv[ring].initialized)
862 continue; 856 continue;
863 radeon_fence_wait_empty_locked(rdev, ring); 857 r = radeon_fence_wait_empty_locked(rdev, ring);
858 if (r) {
859 /* no need to trigger GPU reset as we are unloading */
860 radeon_fence_driver_force_completion(rdev);
861 }
864 wake_up_all(&rdev->fence_queue); 862 wake_up_all(&rdev->fence_queue);
865 radeon_scratch_free(rdev, rdev->fence_drv[ring].scratch_reg); 863 radeon_scratch_free(rdev, rdev->fence_drv[ring].scratch_reg);
866 rdev->fence_drv[ring].initialized = false; 864 rdev->fence_drv[ring].initialized = false;
@@ -868,6 +866,25 @@ void radeon_fence_driver_fini(struct radeon_device *rdev)
868 mutex_unlock(&rdev->ring_lock); 866 mutex_unlock(&rdev->ring_lock);
869} 867}
870 868
869/**
870 * radeon_fence_driver_force_completion - force all fence waiter to complete
871 *
872 * @rdev: radeon device pointer
873 *
874 * In case of GPU reset failure make sure no process keep waiting on fence
875 * that will never complete.
876 */
877void radeon_fence_driver_force_completion(struct radeon_device *rdev)
878{
879 int ring;
880
881 for (ring = 0; ring < RADEON_NUM_RINGS; ring++) {
882 if (!rdev->fence_drv[ring].initialized)
883 continue;
884 radeon_fence_write(rdev, rdev->fence_drv[ring].sync_seq[ring], ring);
885 }
886}
887
871 888
872/* 889/*
873 * Fence debugfs 890 * Fence debugfs
diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c b/drivers/gpu/drm/radeon/radeon_i2c.c
index c5bddd630eb9..fc60b74ee304 100644
--- a/drivers/gpu/drm/radeon/radeon_i2c.c
+++ b/drivers/gpu/drm/radeon/radeon_i2c.c
@@ -39,7 +39,7 @@ extern u32 radeon_atom_hw_i2c_func(struct i2c_adapter *adap);
39 * radeon_ddc_probe 39 * radeon_ddc_probe
40 * 40 *
41 */ 41 */
42bool radeon_ddc_probe(struct radeon_connector *radeon_connector) 42bool radeon_ddc_probe(struct radeon_connector *radeon_connector, bool use_aux)
43{ 43{
44 u8 out = 0x0; 44 u8 out = 0x0;
45 u8 buf[8]; 45 u8 buf[8];
@@ -63,7 +63,13 @@ bool radeon_ddc_probe(struct radeon_connector *radeon_connector)
63 if (radeon_connector->router.ddc_valid) 63 if (radeon_connector->router.ddc_valid)
64 radeon_router_select_ddc_port(radeon_connector); 64 radeon_router_select_ddc_port(radeon_connector);
65 65
66 ret = i2c_transfer(&radeon_connector->ddc_bus->adapter, msgs, 2); 66 if (use_aux) {
67 struct radeon_connector_atom_dig *dig = radeon_connector->con_priv;
68 ret = i2c_transfer(&dig->dp_i2c_bus->adapter, msgs, 2);
69 } else {
70 ret = i2c_transfer(&radeon_connector->ddc_bus->adapter, msgs, 2);
71 }
72
67 if (ret != 2) 73 if (ret != 2)
68 /* Couldn't find an accessible DDC on this connector */ 74 /* Couldn't find an accessible DDC on this connector */
69 return false; 75 return false;
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
index f5ba2241dacc..62cd512f5c8d 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
@@ -640,6 +640,14 @@ static enum drm_connector_status radeon_legacy_primary_dac_detect(struct drm_enc
640 enum drm_connector_status found = connector_status_disconnected; 640 enum drm_connector_status found = connector_status_disconnected;
641 bool color = true; 641 bool color = true;
642 642
643 /* just don't bother on RN50 those chip are often connected to remoting
644 * console hw and often we get failure to load detect those. So to make
645 * everyone happy report the encoder as always connected.
646 */
647 if (ASIC_IS_RN50(rdev)) {
648 return connector_status_connected;
649 }
650
643 /* save the regs we need */ 651 /* save the regs we need */
644 vclk_ecp_cntl = RREG32_PLL(RADEON_VCLK_ECP_CNTL); 652 vclk_ecp_cntl = RREG32_PLL(RADEON_VCLK_ECP_CNTL);
645 crtc_ext_cntl = RREG32(RADEON_CRTC_EXT_CNTL); 653 crtc_ext_cntl = RREG32(RADEON_CRTC_EXT_CNTL);
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index d818b503b42f..4003f5a68c09 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -209,7 +209,8 @@ enum radeon_connector_table {
209 CT_RN50_POWER, 209 CT_RN50_POWER,
210 CT_MAC_X800, 210 CT_MAC_X800,
211 CT_MAC_G5_9600, 211 CT_MAC_G5_9600,
212 CT_SAM440EP 212 CT_SAM440EP,
213 CT_MAC_G4_SILVER
213}; 214};
214 215
215enum radeon_dvo_chip { 216enum radeon_dvo_chip {
@@ -558,7 +559,7 @@ extern void radeon_i2c_put_byte(struct radeon_i2c_chan *i2c,
558 u8 val); 559 u8 val);
559extern void radeon_router_select_ddc_port(struct radeon_connector *radeon_connector); 560extern void radeon_router_select_ddc_port(struct radeon_connector *radeon_connector);
560extern void radeon_router_select_cd_port(struct radeon_connector *radeon_connector); 561extern void radeon_router_select_cd_port(struct radeon_connector *radeon_connector);
561extern bool radeon_ddc_probe(struct radeon_connector *radeon_connector); 562extern bool radeon_ddc_probe(struct radeon_connector *radeon_connector, bool use_aux);
562extern int radeon_ddc_get_modes(struct radeon_connector *radeon_connector); 563extern int radeon_ddc_get_modes(struct radeon_connector *radeon_connector);
563 564
564extern struct drm_encoder *radeon_best_encoder(struct drm_connector *connector); 565extern struct drm_encoder *radeon_best_encoder(struct drm_connector *connector);
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
index 883c95d8d90f..d3aface2d12d 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -84,6 +84,7 @@ void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 domain)
84 rbo->placement.fpfn = 0; 84 rbo->placement.fpfn = 0;
85 rbo->placement.lpfn = 0; 85 rbo->placement.lpfn = 0;
86 rbo->placement.placement = rbo->placements; 86 rbo->placement.placement = rbo->placements;
87 rbo->placement.busy_placement = rbo->placements;
87 if (domain & RADEON_GEM_DOMAIN_VRAM) 88 if (domain & RADEON_GEM_DOMAIN_VRAM)
88 rbo->placements[c++] = TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED | 89 rbo->placements[c++] = TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED |
89 TTM_PL_FLAG_VRAM; 90 TTM_PL_FLAG_VRAM;
@@ -104,14 +105,6 @@ void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 domain)
104 if (!c) 105 if (!c)
105 rbo->placements[c++] = TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM; 106 rbo->placements[c++] = TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM;
106 rbo->placement.num_placement = c; 107 rbo->placement.num_placement = c;
107
108 c = 0;
109 rbo->placement.busy_placement = rbo->busy_placements;
110 if (rbo->rdev->flags & RADEON_IS_AGP) {
111 rbo->busy_placements[c++] = TTM_PL_FLAG_WC | TTM_PL_FLAG_TT;
112 } else {
113 rbo->busy_placements[c++] = TTM_PL_FLAG_CACHED | TTM_PL_FLAG_TT;
114 }
115 rbo->placement.num_busy_placement = c; 108 rbo->placement.num_busy_placement = c;
116} 109}
117 110
@@ -357,6 +350,7 @@ int radeon_bo_list_validate(struct list_head *head)
357{ 350{
358 struct radeon_bo_list *lobj; 351 struct radeon_bo_list *lobj;
359 struct radeon_bo *bo; 352 struct radeon_bo *bo;
353 u32 domain;
360 int r; 354 int r;
361 355
362 r = ttm_eu_reserve_buffers(head); 356 r = ttm_eu_reserve_buffers(head);
@@ -366,9 +360,17 @@ int radeon_bo_list_validate(struct list_head *head)
366 list_for_each_entry(lobj, head, tv.head) { 360 list_for_each_entry(lobj, head, tv.head) {
367 bo = lobj->bo; 361 bo = lobj->bo;
368 if (!bo->pin_count) { 362 if (!bo->pin_count) {
363 domain = lobj->wdomain ? lobj->wdomain : lobj->rdomain;
364
365 retry:
366 radeon_ttm_placement_from_domain(bo, domain);
369 r = ttm_bo_validate(&bo->tbo, &bo->placement, 367 r = ttm_bo_validate(&bo->tbo, &bo->placement,
370 true, false); 368 true, false);
371 if (unlikely(r)) { 369 if (unlikely(r)) {
370 if (r != -ERESTARTSYS && domain == RADEON_GEM_DOMAIN_VRAM) {
371 domain |= RADEON_GEM_DOMAIN_GTT;
372 goto retry;
373 }
372 return r; 374 return r;
373 } 375 }
374 } 376 }
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index aa14dbb7e4fb..0bfa656aa87d 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -234,7 +234,7 @@ static void radeon_set_power_state(struct radeon_device *rdev)
234 234
235static void radeon_pm_set_clocks(struct radeon_device *rdev) 235static void radeon_pm_set_clocks(struct radeon_device *rdev)
236{ 236{
237 int i; 237 int i, r;
238 238
239 /* no need to take locks, etc. if nothing's going to change */ 239 /* no need to take locks, etc. if nothing's going to change */
240 if ((rdev->pm.requested_clock_mode_index == rdev->pm.current_clock_mode_index) && 240 if ((rdev->pm.requested_clock_mode_index == rdev->pm.current_clock_mode_index) &&
@@ -248,8 +248,17 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev)
248 /* wait for the rings to drain */ 248 /* wait for the rings to drain */
249 for (i = 0; i < RADEON_NUM_RINGS; i++) { 249 for (i = 0; i < RADEON_NUM_RINGS; i++) {
250 struct radeon_ring *ring = &rdev->ring[i]; 250 struct radeon_ring *ring = &rdev->ring[i];
251 if (ring->ready) 251 if (!ring->ready) {
252 radeon_fence_wait_empty_locked(rdev, i); 252 continue;
253 }
254 r = radeon_fence_wait_empty_locked(rdev, i);
255 if (r) {
256 /* needs a GPU reset dont reset here */
257 mutex_unlock(&rdev->ring_lock);
258 up_write(&rdev->pm.mclk_lock);
259 mutex_unlock(&rdev->ddev->struct_mutex);
260 return;
261 }
253 } 262 }
254 263
255 radeon_unmap_vram_bos(rdev); 264 radeon_unmap_vram_bos(rdev);
diff --git a/drivers/gpu/drm/radeon/radeon_prime.c b/drivers/gpu/drm/radeon/radeon_prime.c
index e09521858f64..26c23bb651c6 100644
--- a/drivers/gpu/drm/radeon/radeon_prime.c
+++ b/drivers/gpu/drm/radeon/radeon_prime.c
@@ -194,6 +194,7 @@ struct drm_gem_object *radeon_gem_prime_import(struct drm_device *dev,
194 bo = dma_buf->priv; 194 bo = dma_buf->priv;
195 if (bo->gem_base.dev == dev) { 195 if (bo->gem_base.dev == dev) {
196 drm_gem_object_reference(&bo->gem_base); 196 drm_gem_object_reference(&bo->gem_base);
197 dma_buf_put(dma_buf);
197 return &bo->gem_base; 198 return &bo->gem_base;
198 } 199 }
199 } 200 }
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c
index ebd69562ef6c..2430d80b1871 100644
--- a/drivers/gpu/drm/radeon/radeon_ring.c
+++ b/drivers/gpu/drm/radeon/radeon_ring.c
@@ -770,22 +770,30 @@ static int radeon_debugfs_ring_info(struct seq_file *m, void *data)
770 int ridx = *(int*)node->info_ent->data; 770 int ridx = *(int*)node->info_ent->data;
771 struct radeon_ring *ring = &rdev->ring[ridx]; 771 struct radeon_ring *ring = &rdev->ring[ridx];
772 unsigned count, i, j; 772 unsigned count, i, j;
773 u32 tmp;
773 774
774 radeon_ring_free_size(rdev, ring); 775 radeon_ring_free_size(rdev, ring);
775 count = (ring->ring_size / 4) - ring->ring_free_dw; 776 count = (ring->ring_size / 4) - ring->ring_free_dw;
776 seq_printf(m, "wptr(0x%04x): 0x%08x\n", ring->wptr_reg, RREG32(ring->wptr_reg)); 777 tmp = RREG32(ring->wptr_reg) >> ring->ptr_reg_shift;
777 seq_printf(m, "rptr(0x%04x): 0x%08x\n", ring->rptr_reg, RREG32(ring->rptr_reg)); 778 seq_printf(m, "wptr(0x%04x): 0x%08x [%5d]\n", ring->wptr_reg, tmp, tmp);
779 tmp = RREG32(ring->rptr_reg) >> ring->ptr_reg_shift;
780 seq_printf(m, "rptr(0x%04x): 0x%08x [%5d]\n", ring->rptr_reg, tmp, tmp);
778 if (ring->rptr_save_reg) { 781 if (ring->rptr_save_reg) {
779 seq_printf(m, "rptr next(0x%04x): 0x%08x\n", ring->rptr_save_reg, 782 seq_printf(m, "rptr next(0x%04x): 0x%08x\n", ring->rptr_save_reg,
780 RREG32(ring->rptr_save_reg)); 783 RREG32(ring->rptr_save_reg));
781 } 784 }
782 seq_printf(m, "driver's copy of the wptr: 0x%08x\n", ring->wptr); 785 seq_printf(m, "driver's copy of the wptr: 0x%08x [%5d]\n", ring->wptr, ring->wptr);
783 seq_printf(m, "driver's copy of the rptr: 0x%08x\n", ring->rptr); 786 seq_printf(m, "driver's copy of the rptr: 0x%08x [%5d]\n", ring->rptr, ring->rptr);
787 seq_printf(m, "last semaphore signal addr : 0x%016llx\n", ring->last_semaphore_signal_addr);
788 seq_printf(m, "last semaphore wait addr : 0x%016llx\n", ring->last_semaphore_wait_addr);
784 seq_printf(m, "%u free dwords in ring\n", ring->ring_free_dw); 789 seq_printf(m, "%u free dwords in ring\n", ring->ring_free_dw);
785 seq_printf(m, "%u dwords in ring\n", count); 790 seq_printf(m, "%u dwords in ring\n", count);
786 i = ring->rptr; 791 /* print 8 dw before current rptr as often it's the last executed
787 for (j = 0; j <= count; j++) { 792 * packet that is the root issue
788 seq_printf(m, "r[%04d]=0x%08x\n", i, ring->ring[i]); 793 */
794 i = (ring->rptr + ring->ptr_mask + 1 - 32) & ring->ptr_mask;
795 for (j = 0; j <= (count + 32); j++) {
796 seq_printf(m, "r[%5d]=0x%08x\n", i, ring->ring[i]);
789 i = (i + 1) & ring->ptr_mask; 797 i = (i + 1) & ring->ptr_mask;
790 } 798 }
791 return 0; 799 return 0;
@@ -794,11 +802,15 @@ static int radeon_debugfs_ring_info(struct seq_file *m, void *data)
794static int radeon_ring_type_gfx_index = RADEON_RING_TYPE_GFX_INDEX; 802static int radeon_ring_type_gfx_index = RADEON_RING_TYPE_GFX_INDEX;
795static int cayman_ring_type_cp1_index = CAYMAN_RING_TYPE_CP1_INDEX; 803static int cayman_ring_type_cp1_index = CAYMAN_RING_TYPE_CP1_INDEX;
796static int cayman_ring_type_cp2_index = CAYMAN_RING_TYPE_CP2_INDEX; 804static int cayman_ring_type_cp2_index = CAYMAN_RING_TYPE_CP2_INDEX;
805static int radeon_ring_type_dma1_index = R600_RING_TYPE_DMA_INDEX;
806static int radeon_ring_type_dma2_index = CAYMAN_RING_TYPE_DMA1_INDEX;
797 807
798static struct drm_info_list radeon_debugfs_ring_info_list[] = { 808static struct drm_info_list radeon_debugfs_ring_info_list[] = {
799 {"radeon_ring_gfx", radeon_debugfs_ring_info, 0, &radeon_ring_type_gfx_index}, 809 {"radeon_ring_gfx", radeon_debugfs_ring_info, 0, &radeon_ring_type_gfx_index},
800 {"radeon_ring_cp1", radeon_debugfs_ring_info, 0, &cayman_ring_type_cp1_index}, 810 {"radeon_ring_cp1", radeon_debugfs_ring_info, 0, &cayman_ring_type_cp1_index},
801 {"radeon_ring_cp2", radeon_debugfs_ring_info, 0, &cayman_ring_type_cp2_index}, 811 {"radeon_ring_cp2", radeon_debugfs_ring_info, 0, &cayman_ring_type_cp2_index},
812 {"radeon_ring_dma1", radeon_debugfs_ring_info, 0, &radeon_ring_type_dma1_index},
813 {"radeon_ring_dma2", radeon_debugfs_ring_info, 0, &radeon_ring_type_dma2_index},
802}; 814};
803 815
804static int radeon_debugfs_sa_info(struct seq_file *m, void *data) 816static int radeon_debugfs_sa_info(struct seq_file *m, void *data)
diff --git a/drivers/gpu/drm/radeon/radeon_semaphore.c b/drivers/gpu/drm/radeon/radeon_semaphore.c
index 97f3ece81cd2..8dcc20f53d73 100644
--- a/drivers/gpu/drm/radeon/radeon_semaphore.c
+++ b/drivers/gpu/drm/radeon/radeon_semaphore.c
@@ -95,6 +95,10 @@ int radeon_semaphore_sync_rings(struct radeon_device *rdev,
95 /* we assume caller has already allocated space on waiters ring */ 95 /* we assume caller has already allocated space on waiters ring */
96 radeon_semaphore_emit_wait(rdev, waiter, semaphore); 96 radeon_semaphore_emit_wait(rdev, waiter, semaphore);
97 97
98 /* for debugging lockup only, used by sysfs debug files */
99 rdev->ring[signaler].last_semaphore_signal_addr = semaphore->gpu_addr;
100 rdev->ring[waiter].last_semaphore_wait_addr = semaphore->gpu_addr;
101
98 return 0; 102 return 0;
99} 103}
100 104
diff --git a/drivers/gpu/drm/radeon/reg_srcs/rv515 b/drivers/gpu/drm/radeon/reg_srcs/rv515
index 911a8fbd32bb..78d5e99d759d 100644
--- a/drivers/gpu/drm/radeon/reg_srcs/rv515
+++ b/drivers/gpu/drm/radeon/reg_srcs/rv515
@@ -324,6 +324,8 @@ rv515 0x6d40
3240x46AC US_OUT_FMT_2 3240x46AC US_OUT_FMT_2
3250x46B0 US_OUT_FMT_3 3250x46B0 US_OUT_FMT_3
3260x46B4 US_W_FMT 3260x46B4 US_W_FMT
3270x46C0 RB3D_COLOR_CLEAR_VALUE_AR
3280x46C4 RB3D_COLOR_CLEAR_VALUE_GB
3270x4BC0 FG_FOG_BLEND 3290x4BC0 FG_FOG_BLEND
3280x4BC4 FG_FOG_FACTOR 3300x4BC4 FG_FOG_FACTOR
3290x4BC8 FG_FOG_COLOR_R 3310x4BC8 FG_FOG_COLOR_R
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index 87c979c4f721..1b2444f4d8f4 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -887,6 +887,80 @@ static int rv770_mc_init(struct radeon_device *rdev)
887 return 0; 887 return 0;
888} 888}
889 889
890/**
891 * rv770_copy_dma - copy pages using the DMA engine
892 *
893 * @rdev: radeon_device pointer
894 * @src_offset: src GPU address
895 * @dst_offset: dst GPU address
896 * @num_gpu_pages: number of GPU pages to xfer
897 * @fence: radeon fence object
898 *
899 * Copy GPU paging using the DMA engine (r7xx).
900 * Used by the radeon ttm implementation to move pages if
901 * registered as the asic copy callback.
902 */
903int rv770_copy_dma(struct radeon_device *rdev,
904 uint64_t src_offset, uint64_t dst_offset,
905 unsigned num_gpu_pages,
906 struct radeon_fence **fence)
907{
908 struct radeon_semaphore *sem = NULL;
909 int ring_index = rdev->asic->copy.dma_ring_index;
910 struct radeon_ring *ring = &rdev->ring[ring_index];
911 u32 size_in_dw, cur_size_in_dw;
912 int i, num_loops;
913 int r = 0;
914
915 r = radeon_semaphore_create(rdev, &sem);
916 if (r) {
917 DRM_ERROR("radeon: moving bo (%d).\n", r);
918 return r;
919 }
920
921 size_in_dw = (num_gpu_pages << RADEON_GPU_PAGE_SHIFT) / 4;
922 num_loops = DIV_ROUND_UP(size_in_dw, 0xFFFF);
923 r = radeon_ring_lock(rdev, ring, num_loops * 5 + 8);
924 if (r) {
925 DRM_ERROR("radeon: moving bo (%d).\n", r);
926 radeon_semaphore_free(rdev, &sem, NULL);
927 return r;
928 }
929
930 if (radeon_fence_need_sync(*fence, ring->idx)) {
931 radeon_semaphore_sync_rings(rdev, sem, (*fence)->ring,
932 ring->idx);
933 radeon_fence_note_sync(*fence, ring->idx);
934 } else {
935 radeon_semaphore_free(rdev, &sem, NULL);
936 }
937
938 for (i = 0; i < num_loops; i++) {
939 cur_size_in_dw = size_in_dw;
940 if (cur_size_in_dw > 0xFFFF)
941 cur_size_in_dw = 0xFFFF;
942 size_in_dw -= cur_size_in_dw;
943 radeon_ring_write(ring, DMA_PACKET(DMA_PACKET_COPY, 0, 0, cur_size_in_dw));
944 radeon_ring_write(ring, dst_offset & 0xfffffffc);
945 radeon_ring_write(ring, src_offset & 0xfffffffc);
946 radeon_ring_write(ring, upper_32_bits(dst_offset) & 0xff);
947 radeon_ring_write(ring, upper_32_bits(src_offset) & 0xff);
948 src_offset += cur_size_in_dw * 4;
949 dst_offset += cur_size_in_dw * 4;
950 }
951
952 r = radeon_fence_emit(rdev, fence, ring->idx);
953 if (r) {
954 radeon_ring_unlock_undo(rdev, ring);
955 return r;
956 }
957
958 radeon_ring_unlock_commit(rdev, ring);
959 radeon_semaphore_free(rdev, &sem, *fence);
960
961 return r;
962}
963
890static int rv770_startup(struct radeon_device *rdev) 964static int rv770_startup(struct radeon_device *rdev)
891{ 965{
892 struct radeon_ring *ring; 966 struct radeon_ring *ring;
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
index ef683653f0b7..ae8b48205a6c 100644
--- a/drivers/gpu/drm/radeon/si.c
+++ b/drivers/gpu/drm/radeon/si.c
@@ -2126,15 +2126,13 @@ bool si_gpu_is_lockup(struct radeon_device *rdev, struct radeon_ring *ring)
2126 return radeon_ring_test_lockup(rdev, ring); 2126 return radeon_ring_test_lockup(rdev, ring);
2127} 2127}
2128 2128
2129static int si_gpu_soft_reset(struct radeon_device *rdev) 2129static void si_gpu_soft_reset_gfx(struct radeon_device *rdev)
2130{ 2130{
2131 struct evergreen_mc_save save;
2132 u32 grbm_reset = 0; 2131 u32 grbm_reset = 0;
2133 2132
2134 if (!(RREG32(GRBM_STATUS) & GUI_ACTIVE)) 2133 if (!(RREG32(GRBM_STATUS) & GUI_ACTIVE))
2135 return 0; 2134 return;
2136 2135
2137 dev_info(rdev->dev, "GPU softreset \n");
2138 dev_info(rdev->dev, " GRBM_STATUS=0x%08X\n", 2136 dev_info(rdev->dev, " GRBM_STATUS=0x%08X\n",
2139 RREG32(GRBM_STATUS)); 2137 RREG32(GRBM_STATUS));
2140 dev_info(rdev->dev, " GRBM_STATUS2=0x%08X\n", 2138 dev_info(rdev->dev, " GRBM_STATUS2=0x%08X\n",
@@ -2145,10 +2143,7 @@ static int si_gpu_soft_reset(struct radeon_device *rdev)
2145 RREG32(GRBM_STATUS_SE1)); 2143 RREG32(GRBM_STATUS_SE1));
2146 dev_info(rdev->dev, " SRBM_STATUS=0x%08X\n", 2144 dev_info(rdev->dev, " SRBM_STATUS=0x%08X\n",
2147 RREG32(SRBM_STATUS)); 2145 RREG32(SRBM_STATUS));
2148 evergreen_mc_stop(rdev, &save); 2146
2149 if (radeon_mc_wait_for_idle(rdev)) {
2150 dev_warn(rdev->dev, "Wait for MC idle timedout !\n");
2151 }
2152 /* Disable CP parsing/prefetching */ 2147 /* Disable CP parsing/prefetching */
2153 WREG32(CP_ME_CNTL, CP_ME_HALT | CP_PFP_HALT | CP_CE_HALT); 2148 WREG32(CP_ME_CNTL, CP_ME_HALT | CP_PFP_HALT | CP_CE_HALT);
2154 2149
@@ -2173,8 +2168,7 @@ static int si_gpu_soft_reset(struct radeon_device *rdev)
2173 udelay(50); 2168 udelay(50);
2174 WREG32(GRBM_SOFT_RESET, 0); 2169 WREG32(GRBM_SOFT_RESET, 0);
2175 (void)RREG32(GRBM_SOFT_RESET); 2170 (void)RREG32(GRBM_SOFT_RESET);
2176 /* Wait a little for things to settle down */ 2171
2177 udelay(50);
2178 dev_info(rdev->dev, " GRBM_STATUS=0x%08X\n", 2172 dev_info(rdev->dev, " GRBM_STATUS=0x%08X\n",
2179 RREG32(GRBM_STATUS)); 2173 RREG32(GRBM_STATUS));
2180 dev_info(rdev->dev, " GRBM_STATUS2=0x%08X\n", 2174 dev_info(rdev->dev, " GRBM_STATUS2=0x%08X\n",
@@ -2185,13 +2179,81 @@ static int si_gpu_soft_reset(struct radeon_device *rdev)
2185 RREG32(GRBM_STATUS_SE1)); 2179 RREG32(GRBM_STATUS_SE1));
2186 dev_info(rdev->dev, " SRBM_STATUS=0x%08X\n", 2180 dev_info(rdev->dev, " SRBM_STATUS=0x%08X\n",
2187 RREG32(SRBM_STATUS)); 2181 RREG32(SRBM_STATUS));
2182}
2183
2184static void si_gpu_soft_reset_dma(struct radeon_device *rdev)
2185{
2186 u32 tmp;
2187
2188 if (RREG32(DMA_STATUS_REG) & DMA_IDLE)
2189 return;
2190
2191 dev_info(rdev->dev, " DMA_STATUS_REG = 0x%08X\n",
2192 RREG32(DMA_STATUS_REG));
2193
2194 /* dma0 */
2195 tmp = RREG32(DMA_RB_CNTL + DMA0_REGISTER_OFFSET);
2196 tmp &= ~DMA_RB_ENABLE;
2197 WREG32(DMA_RB_CNTL + DMA0_REGISTER_OFFSET, tmp);
2198
2199 /* dma1 */
2200 tmp = RREG32(DMA_RB_CNTL + DMA1_REGISTER_OFFSET);
2201 tmp &= ~DMA_RB_ENABLE;
2202 WREG32(DMA_RB_CNTL + DMA1_REGISTER_OFFSET, tmp);
2203
2204 /* Reset dma */
2205 WREG32(SRBM_SOFT_RESET, SOFT_RESET_DMA | SOFT_RESET_DMA1);
2206 RREG32(SRBM_SOFT_RESET);
2207 udelay(50);
2208 WREG32(SRBM_SOFT_RESET, 0);
2209
2210 dev_info(rdev->dev, " DMA_STATUS_REG = 0x%08X\n",
2211 RREG32(DMA_STATUS_REG));
2212}
2213
2214static int si_gpu_soft_reset(struct radeon_device *rdev, u32 reset_mask)
2215{
2216 struct evergreen_mc_save save;
2217
2218 if (!(RREG32(GRBM_STATUS) & GUI_ACTIVE))
2219 reset_mask &= ~(RADEON_RESET_GFX | RADEON_RESET_COMPUTE);
2220
2221 if (RREG32(DMA_STATUS_REG) & DMA_IDLE)
2222 reset_mask &= ~RADEON_RESET_DMA;
2223
2224 if (reset_mask == 0)
2225 return 0;
2226
2227 dev_info(rdev->dev, "GPU softreset: 0x%08X\n", reset_mask);
2228
2229 dev_info(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x%08X\n",
2230 RREG32(VM_CONTEXT1_PROTECTION_FAULT_ADDR));
2231 dev_info(rdev->dev, " VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x%08X\n",
2232 RREG32(VM_CONTEXT1_PROTECTION_FAULT_STATUS));
2233
2234 evergreen_mc_stop(rdev, &save);
2235 if (radeon_mc_wait_for_idle(rdev)) {
2236 dev_warn(rdev->dev, "Wait for MC idle timedout !\n");
2237 }
2238
2239 if (reset_mask & (RADEON_RESET_GFX | RADEON_RESET_COMPUTE))
2240 si_gpu_soft_reset_gfx(rdev);
2241
2242 if (reset_mask & RADEON_RESET_DMA)
2243 si_gpu_soft_reset_dma(rdev);
2244
2245 /* Wait a little for things to settle down */
2246 udelay(50);
2247
2188 evergreen_mc_resume(rdev, &save); 2248 evergreen_mc_resume(rdev, &save);
2189 return 0; 2249 return 0;
2190} 2250}
2191 2251
2192int si_asic_reset(struct radeon_device *rdev) 2252int si_asic_reset(struct radeon_device *rdev)
2193{ 2253{
2194 return si_gpu_soft_reset(rdev); 2254 return si_gpu_soft_reset(rdev, (RADEON_RESET_GFX |
2255 RADEON_RESET_COMPUTE |
2256 RADEON_RESET_DMA));
2195} 2257}
2196 2258
2197/* MC */ 2259/* MC */
diff --git a/drivers/gpu/drm/radeon/sid.h b/drivers/gpu/drm/radeon/sid.h
index 62b46215d423..c056aae814f0 100644
--- a/drivers/gpu/drm/radeon/sid.h
+++ b/drivers/gpu/drm/radeon/sid.h
@@ -62,6 +62,22 @@
62 62
63#define SRBM_STATUS 0xE50 63#define SRBM_STATUS 0xE50
64 64
65#define SRBM_SOFT_RESET 0x0E60
66#define SOFT_RESET_BIF (1 << 1)
67#define SOFT_RESET_DC (1 << 5)
68#define SOFT_RESET_DMA1 (1 << 6)
69#define SOFT_RESET_GRBM (1 << 8)
70#define SOFT_RESET_HDP (1 << 9)
71#define SOFT_RESET_IH (1 << 10)
72#define SOFT_RESET_MC (1 << 11)
73#define SOFT_RESET_ROM (1 << 14)
74#define SOFT_RESET_SEM (1 << 15)
75#define SOFT_RESET_VMC (1 << 17)
76#define SOFT_RESET_DMA (1 << 20)
77#define SOFT_RESET_TST (1 << 21)
78#define SOFT_RESET_REGBB (1 << 22)
79#define SOFT_RESET_ORB (1 << 23)
80
65#define CC_SYS_RB_BACKEND_DISABLE 0xe80 81#define CC_SYS_RB_BACKEND_DISABLE 0xe80
66#define GC_USER_SYS_RB_BACKEND_DISABLE 0xe84 82#define GC_USER_SYS_RB_BACKEND_DISABLE 0xe84
67 83
@@ -1013,6 +1029,8 @@
1013# define DATA_SWAP_ENABLE (1 << 3) 1029# define DATA_SWAP_ENABLE (1 << 3)
1014# define FENCE_SWAP_ENABLE (1 << 4) 1030# define FENCE_SWAP_ENABLE (1 << 4)
1015# define CTXEMPTY_INT_ENABLE (1 << 28) 1031# define CTXEMPTY_INT_ENABLE (1 << 28)
1032#define DMA_STATUS_REG 0xd034
1033# define DMA_IDLE (1 << 0)
1016#define DMA_TILING_CONFIG 0xd0b8 1034#define DMA_TILING_CONFIG 0xd0b8
1017 1035
1018#define DMA_PACKET(cmd, b, t, s, n) ((((cmd) & 0xF) << 28) | \ 1036#define DMA_PACKET(cmd, b, t, s, n) ((((cmd) & 0xF) << 28) | \
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
index 1c350fc4e449..d1d5306ebf24 100644
--- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c
+++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
@@ -33,7 +33,7 @@
33 * Hardware initialization 33 * Hardware initialization
34 */ 34 */
35 35
36static int __devinit shmob_drm_init_interface(struct shmob_drm_device *sdev) 36static int shmob_drm_init_interface(struct shmob_drm_device *sdev)
37{ 37{
38 static const u32 ldmt1r[] = { 38 static const u32 ldmt1r[] = {
39 [SHMOB_DRM_IFACE_RGB8] = LDMT1R_MIFTYP_RGB8, 39 [SHMOB_DRM_IFACE_RGB8] = LDMT1R_MIFTYP_RGB8,
@@ -67,7 +67,7 @@ static int __devinit shmob_drm_init_interface(struct shmob_drm_device *sdev)
67 return 0; 67 return 0;
68} 68}
69 69
70static int __devinit shmob_drm_setup_clocks(struct shmob_drm_device *sdev, 70static int shmob_drm_setup_clocks(struct shmob_drm_device *sdev,
71 enum shmob_drm_clk_source clksrc) 71 enum shmob_drm_clk_source clksrc)
72{ 72{
73 struct clk *clk; 73 struct clk *clk;
@@ -330,12 +330,12 @@ static const struct dev_pm_ops shmob_drm_pm_ops = {
330 * Platform driver 330 * Platform driver
331 */ 331 */
332 332
333static int __devinit shmob_drm_probe(struct platform_device *pdev) 333static int shmob_drm_probe(struct platform_device *pdev)
334{ 334{
335 return drm_platform_init(&shmob_drm_driver, pdev); 335 return drm_platform_init(&shmob_drm_driver, pdev);
336} 336}
337 337
338static int __devexit shmob_drm_remove(struct platform_device *pdev) 338static int shmob_drm_remove(struct platform_device *pdev)
339{ 339{
340 drm_platform_exit(&shmob_drm_driver, pdev); 340 drm_platform_exit(&shmob_drm_driver, pdev);
341 341
@@ -344,7 +344,7 @@ static int __devexit shmob_drm_remove(struct platform_device *pdev)
344 344
345static struct platform_driver shmob_drm_platform_driver = { 345static struct platform_driver shmob_drm_platform_driver = {
346 .probe = shmob_drm_probe, 346 .probe = shmob_drm_probe,
347 .remove = __devexit_p(shmob_drm_remove), 347 .remove = shmob_drm_remove,
348 .driver = { 348 .driver = {
349 .owner = THIS_MODULE, 349 .owner = THIS_MODULE,
350 .name = "shmob-drm", 350 .name = "shmob-drm",
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 074410371e2a..656b2e3334a6 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -102,12 +102,12 @@ static int tegra_dc_set_timings(struct tegra_dc *dc,
102 ((mode->hsync_end - mode->hsync_start) << 0); 102 ((mode->hsync_end - mode->hsync_start) << 0);
103 tegra_dc_writel(dc, value, DC_DISP_SYNC_WIDTH); 103 tegra_dc_writel(dc, value, DC_DISP_SYNC_WIDTH);
104 104
105 value = ((mode->vsync_start - mode->vdisplay) << 16) |
106 ((mode->hsync_start - mode->hdisplay) << 0);
107 tegra_dc_writel(dc, value, DC_DISP_BACK_PORCH);
108
109 value = ((mode->vtotal - mode->vsync_end) << 16) | 105 value = ((mode->vtotal - mode->vsync_end) << 16) |
110 ((mode->htotal - mode->hsync_end) << 0); 106 ((mode->htotal - mode->hsync_end) << 0);
107 tegra_dc_writel(dc, value, DC_DISP_BACK_PORCH);
108
109 value = ((mode->vsync_start - mode->vdisplay) << 16) |
110 ((mode->hsync_start - mode->hdisplay) << 0);
111 tegra_dc_writel(dc, value, DC_DISP_FRONT_PORCH); 111 tegra_dc_writel(dc, value, DC_DISP_FRONT_PORCH);
112 112
113 value = (mode->vdisplay << 16) | mode->hdisplay; 113 value = (mode->vdisplay << 16) | mode->hdisplay;
@@ -221,8 +221,7 @@ static int tegra_crtc_mode_set(struct drm_crtc *crtc,
221 win.stride = crtc->fb->pitches[0]; 221 win.stride = crtc->fb->pitches[0];
222 222
223 /* program window registers */ 223 /* program window registers */
224 value = tegra_dc_readl(dc, DC_CMD_DISPLAY_WINDOW_HEADER); 224 value = WINDOW_A_SELECT;
225 value |= WINDOW_A_SELECT;
226 tegra_dc_writel(dc, value, DC_CMD_DISPLAY_WINDOW_HEADER); 225 tegra_dc_writel(dc, value, DC_CMD_DISPLAY_WINDOW_HEADER);
227 226
228 tegra_dc_writel(dc, win.fmt, DC_WIN_COLOR_DEPTH); 227 tegra_dc_writel(dc, win.fmt, DC_WIN_COLOR_DEPTH);
diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h
index 3a843a77ddc7..741b5dc2742c 100644
--- a/drivers/gpu/drm/tegra/drm.h
+++ b/drivers/gpu/drm/tegra/drm.h
@@ -204,24 +204,6 @@ extern int tegra_output_parse_dt(struct tegra_output *output);
204extern int tegra_output_init(struct drm_device *drm, struct tegra_output *output); 204extern int tegra_output_init(struct drm_device *drm, struct tegra_output *output);
205extern int tegra_output_exit(struct tegra_output *output); 205extern int tegra_output_exit(struct tegra_output *output);
206 206
207/* from gem.c */
208extern struct tegra_gem_object *tegra_gem_alloc(struct drm_device *drm,
209 size_t size);
210extern int tegra_gem_handle_create(struct drm_device *drm,
211 struct drm_file *file, size_t size,
212 unsigned long flags, uint32_t *handle);
213extern int tegra_gem_dumb_create(struct drm_file *file, struct drm_device *drm,
214 struct drm_mode_create_dumb *args);
215extern int tegra_gem_dumb_map_offset(struct drm_file *file,
216 struct drm_device *drm, uint32_t handle,
217 uint64_t *offset);
218extern int tegra_gem_dumb_destroy(struct drm_file *file,
219 struct drm_device *drm, uint32_t handle);
220extern int tegra_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
221extern int tegra_gem_init_object(struct drm_gem_object *obj);
222extern void tegra_gem_free_object(struct drm_gem_object *obj);
223extern struct vm_operations_struct tegra_gem_vm_ops;
224
225/* from fb.c */ 207/* from fb.c */
226extern int tegra_drm_fb_init(struct drm_device *drm); 208extern int tegra_drm_fb_init(struct drm_device *drm);
227extern void tegra_drm_fb_exit(struct drm_device *drm); 209extern void tegra_drm_fb_exit(struct drm_device *drm);
diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c
index ab4016412bbf..e060c7e6434d 100644
--- a/drivers/gpu/drm/tegra/hdmi.c
+++ b/drivers/gpu/drm/tegra/hdmi.c
@@ -149,7 +149,7 @@ struct tmds_config {
149}; 149};
150 150
151static const struct tmds_config tegra2_tmds_config[] = { 151static const struct tmds_config tegra2_tmds_config[] = {
152 { /* 480p modes */ 152 { /* slow pixel clock modes */
153 .pclk = 27000000, 153 .pclk = 27000000,
154 .pll0 = SOR_PLL_BG_V17_S(3) | SOR_PLL_ICHPMP(1) | 154 .pll0 = SOR_PLL_BG_V17_S(3) | SOR_PLL_ICHPMP(1) |
155 SOR_PLL_RESISTORSEL | SOR_PLL_VCOCAP(0) | 155 SOR_PLL_RESISTORSEL | SOR_PLL_VCOCAP(0) |
@@ -163,21 +163,8 @@ static const struct tmds_config tegra2_tmds_config[] = {
163 DRIVE_CURRENT_LANE1(DRIVE_CURRENT_7_125_mA) | 163 DRIVE_CURRENT_LANE1(DRIVE_CURRENT_7_125_mA) |
164 DRIVE_CURRENT_LANE2(DRIVE_CURRENT_7_125_mA) | 164 DRIVE_CURRENT_LANE2(DRIVE_CURRENT_7_125_mA) |
165 DRIVE_CURRENT_LANE3(DRIVE_CURRENT_7_125_mA), 165 DRIVE_CURRENT_LANE3(DRIVE_CURRENT_7_125_mA),
166 }, { /* 720p modes */ 166 },
167 .pclk = 74250000, 167 { /* high pixel clock modes */
168 .pll0 = SOR_PLL_BG_V17_S(3) | SOR_PLL_ICHPMP(1) |
169 SOR_PLL_RESISTORSEL | SOR_PLL_VCOCAP(1) |
170 SOR_PLL_TX_REG_LOAD(3),
171 .pll1 = SOR_PLL_TMDS_TERM_ENABLE | SOR_PLL_PE_EN,
172 .pe_current = PE_CURRENT0(PE_CURRENT_6_0_mA) |
173 PE_CURRENT1(PE_CURRENT_6_0_mA) |
174 PE_CURRENT2(PE_CURRENT_6_0_mA) |
175 PE_CURRENT3(PE_CURRENT_6_0_mA),
176 .drive_current = DRIVE_CURRENT_LANE0(DRIVE_CURRENT_7_125_mA) |
177 DRIVE_CURRENT_LANE1(DRIVE_CURRENT_7_125_mA) |
178 DRIVE_CURRENT_LANE2(DRIVE_CURRENT_7_125_mA) |
179 DRIVE_CURRENT_LANE3(DRIVE_CURRENT_7_125_mA),
180 }, { /* 1080p modes */
181 .pclk = UINT_MAX, 168 .pclk = UINT_MAX,
182 .pll0 = SOR_PLL_BG_V17_S(3) | SOR_PLL_ICHPMP(1) | 169 .pll0 = SOR_PLL_BG_V17_S(3) | SOR_PLL_ICHPMP(1) |
183 SOR_PLL_RESISTORSEL | SOR_PLL_VCOCAP(1) | 170 SOR_PLL_RESISTORSEL | SOR_PLL_VCOCAP(1) |
@@ -479,7 +466,7 @@ static void tegra_hdmi_setup_avi_infoframe(struct tegra_hdmi *hdmi,
479 return; 466 return;
480 } 467 }
481 468
482 h_front_porch = mode->htotal - mode->hsync_end; 469 h_front_porch = mode->hsync_start - mode->hdisplay;
483 memset(&frame, 0, sizeof(frame)); 470 memset(&frame, 0, sizeof(frame));
484 frame.r = HDMI_AVI_R_SAME; 471 frame.r = HDMI_AVI_R_SAME;
485 472
@@ -634,8 +621,8 @@ static int tegra_output_hdmi_enable(struct tegra_output *output)
634 621
635 pclk = mode->clock * 1000; 622 pclk = mode->clock * 1000;
636 h_sync_width = mode->hsync_end - mode->hsync_start; 623 h_sync_width = mode->hsync_end - mode->hsync_start;
637 h_front_porch = mode->htotal - mode->hsync_end; 624 h_back_porch = mode->htotal - mode->hsync_end;
638 h_back_porch = mode->hsync_start - mode->hdisplay; 625 h_front_porch = mode->hsync_start - mode->hdisplay;
639 626
640 err = regulator_enable(hdmi->vdd); 627 err = regulator_enable(hdmi->vdd);
641 if (err < 0) { 628 if (err < 0) {
diff --git a/drivers/gpu/drm/tegra/host1x.c b/drivers/gpu/drm/tegra/host1x.c
index bdb97a564d82..5d17b113a6fc 100644
--- a/drivers/gpu/drm/tegra/host1x.c
+++ b/drivers/gpu/drm/tegra/host1x.c
@@ -239,6 +239,8 @@ int host1x_register_client(struct host1x *host1x, struct host1x_client *client)
239 } 239 }
240 } 240 }
241 241
242 client->host1x = host1x;
243
242 return 0; 244 return 0;
243} 245}
244 246
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 33d20be87db5..52b20b12c83a 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -434,6 +434,7 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
434 bo->mem = tmp_mem; 434 bo->mem = tmp_mem;
435 bdev->driver->move_notify(bo, mem); 435 bdev->driver->move_notify(bo, mem);
436 bo->mem = *mem; 436 bo->mem = *mem;
437 *mem = tmp_mem;
437 } 438 }
438 439
439 goto out_err; 440 goto out_err;
diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index 9e9c5d2a5c74..44420fca7dfa 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -344,8 +344,12 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
344 344
345 if (ttm->state == tt_unpopulated) { 345 if (ttm->state == tt_unpopulated) {
346 ret = ttm->bdev->driver->ttm_tt_populate(ttm); 346 ret = ttm->bdev->driver->ttm_tt_populate(ttm);
347 if (ret) 347 if (ret) {
348 /* if we fail here don't nuke the mm node
349 * as the bo still owns it */
350 old_copy.mm_node = NULL;
348 goto out1; 351 goto out1;
352 }
349 } 353 }
350 354
351 add = 0; 355 add = 0;
@@ -371,8 +375,11 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
371 prot); 375 prot);
372 } else 376 } else
373 ret = ttm_copy_io_page(new_iomap, old_iomap, page); 377 ret = ttm_copy_io_page(new_iomap, old_iomap, page);
374 if (ret) 378 if (ret) {
379 /* failing here, means keep old copy as-is */
380 old_copy.mm_node = NULL;
375 goto out1; 381 goto out1;
382 }
376 } 383 }
377 mb(); 384 mb();
378out2: 385out2:
@@ -654,11 +661,13 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
654 */ 661 */
655 662
656 set_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags); 663 set_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags);
664
665 /* ttm_buffer_object_transfer accesses bo->sync_obj */
666 ret = ttm_buffer_object_transfer(bo, &ghost_obj);
657 spin_unlock(&bdev->fence_lock); 667 spin_unlock(&bdev->fence_lock);
658 if (tmp_obj) 668 if (tmp_obj)
659 driver->sync_obj_unref(&tmp_obj); 669 driver->sync_obj_unref(&tmp_obj);
660 670
661 ret = ttm_buffer_object_transfer(bo, &ghost_obj);
662 if (ret) 671 if (ret)
663 return ret; 672 return ret;
664 673
diff --git a/drivers/gpu/drm/udl/udl_connector.c b/drivers/gpu/drm/udl/udl_connector.c
index 512f44add89f..fe5cdbcf2636 100644
--- a/drivers/gpu/drm/udl/udl_connector.c
+++ b/drivers/gpu/drm/udl/udl_connector.c
@@ -22,13 +22,17 @@
22static u8 *udl_get_edid(struct udl_device *udl) 22static u8 *udl_get_edid(struct udl_device *udl)
23{ 23{
24 u8 *block; 24 u8 *block;
25 char rbuf[3]; 25 char *rbuf;
26 int ret, i; 26 int ret, i;
27 27
28 block = kmalloc(EDID_LENGTH, GFP_KERNEL); 28 block = kmalloc(EDID_LENGTH, GFP_KERNEL);
29 if (block == NULL) 29 if (block == NULL)
30 return NULL; 30 return NULL;
31 31
32 rbuf = kmalloc(2, GFP_KERNEL);
33 if (rbuf == NULL)
34 goto error;
35
32 for (i = 0; i < EDID_LENGTH; i++) { 36 for (i = 0; i < EDID_LENGTH; i++) {
33 ret = usb_control_msg(udl->ddev->usbdev, 37 ret = usb_control_msg(udl->ddev->usbdev,
34 usb_rcvctrlpipe(udl->ddev->usbdev, 0), (0x02), 38 usb_rcvctrlpipe(udl->ddev->usbdev, 0), (0x02),
@@ -36,16 +40,17 @@ static u8 *udl_get_edid(struct udl_device *udl)
36 HZ); 40 HZ);
37 if (ret < 1) { 41 if (ret < 1) {
38 DRM_ERROR("Read EDID byte %d failed err %x\n", i, ret); 42 DRM_ERROR("Read EDID byte %d failed err %x\n", i, ret);
39 i--;
40 goto error; 43 goto error;
41 } 44 }
42 block[i] = rbuf[1]; 45 block[i] = rbuf[1];
43 } 46 }
44 47
48 kfree(rbuf);
45 return block; 49 return block;
46 50
47error: 51error:
48 kfree(block); 52 kfree(block);
53 kfree(rbuf);
49 return NULL; 54 return NULL;
50} 55}
51 56
@@ -57,6 +62,14 @@ static int udl_get_modes(struct drm_connector *connector)
57 62
58 edid = (struct edid *)udl_get_edid(udl); 63 edid = (struct edid *)udl_get_edid(udl);
59 64
65 /*
66 * We only read the main block, but if the monitor reports extension
67 * blocks then the drm edid code expects them to be present, so patch
68 * the extension count to 0.
69 */
70 edid->checksum += edid->extensions;
71 edid->extensions = 0;
72
60 drm_mode_connector_update_edid_property(connector, edid); 73 drm_mode_connector_update_edid_property(connector, edid);
61 ret = drm_add_edid_modes(connector, edid); 74 ret = drm_add_edid_modes(connector, edid);
62 kfree(edid); 75 kfree(edid);
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 4dfa605e2d14..34e25471aeaa 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -306,6 +306,9 @@
306#define USB_VENDOR_ID_EZKEY 0x0518 306#define USB_VENDOR_ID_EZKEY 0x0518
307#define USB_DEVICE_ID_BTC_8193 0x0002 307#define USB_DEVICE_ID_BTC_8193 0x0002
308 308
309#define USB_VENDOR_ID_FORMOSA 0x147a
310#define USB_DEVICE_ID_FORMOSA_IR_RECEIVER 0xe03e
311
309#define USB_VENDOR_ID_FREESCALE 0x15A2 312#define USB_VENDOR_ID_FREESCALE 0x15A2
310#define USB_DEVICE_ID_FREESCALE_MX28 0x004F 313#define USB_DEVICE_ID_FREESCALE_MX28 0x004F
311 314
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index 9ef222442ca0..e766b5614ef5 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -540,13 +540,24 @@ static int i2c_hid_output_raw_report(struct hid_device *hid, __u8 *buf,
540{ 540{
541 struct i2c_client *client = hid->driver_data; 541 struct i2c_client *client = hid->driver_data;
542 int report_id = buf[0]; 542 int report_id = buf[0];
543 int ret;
543 544
544 if (report_type == HID_INPUT_REPORT) 545 if (report_type == HID_INPUT_REPORT)
545 return -EINVAL; 546 return -EINVAL;
546 547
547 return i2c_hid_set_report(client, 548 if (report_id) {
549 buf++;
550 count--;
551 }
552
553 ret = i2c_hid_set_report(client,
548 report_type == HID_FEATURE_REPORT ? 0x03 : 0x02, 554 report_type == HID_FEATURE_REPORT ? 0x03 : 0x02,
549 report_id, buf, count); 555 report_id, buf, count);
556
557 if (report_id && ret >= 0)
558 ret++; /* add report_id to the number of transfered bytes */
559
560 return ret;
550} 561}
551 562
552static int i2c_hid_parse(struct hid_device *hid) 563static int i2c_hid_parse(struct hid_device *hid)
@@ -731,7 +742,7 @@ static struct hid_ll_driver i2c_hid_ll_driver = {
731 .hidinput_input_event = i2c_hid_hidinput_input_event, 742 .hidinput_input_event = i2c_hid_hidinput_input_event,
732}; 743};
733 744
734static int __devinit i2c_hid_init_irq(struct i2c_client *client) 745static int i2c_hid_init_irq(struct i2c_client *client)
735{ 746{
736 struct i2c_hid *ihid = i2c_get_clientdata(client); 747 struct i2c_hid *ihid = i2c_get_clientdata(client);
737 int ret; 748 int ret;
@@ -753,7 +764,7 @@ static int __devinit i2c_hid_init_irq(struct i2c_client *client)
753 return 0; 764 return 0;
754} 765}
755 766
756static int __devinit i2c_hid_fetch_hid_descriptor(struct i2c_hid *ihid) 767static int i2c_hid_fetch_hid_descriptor(struct i2c_hid *ihid)
757{ 768{
758 struct i2c_client *client = ihid->client; 769 struct i2c_client *client = ihid->client;
759 struct i2c_hid_desc *hdesc = &ihid->hdesc; 770 struct i2c_hid_desc *hdesc = &ihid->hdesc;
@@ -810,8 +821,8 @@ static int __devinit i2c_hid_fetch_hid_descriptor(struct i2c_hid *ihid)
810 return 0; 821 return 0;
811} 822}
812 823
813static int __devinit i2c_hid_probe(struct i2c_client *client, 824static int i2c_hid_probe(struct i2c_client *client,
814 const struct i2c_device_id *dev_id) 825 const struct i2c_device_id *dev_id)
815{ 826{
816 int ret; 827 int ret;
817 struct i2c_hid *ihid; 828 struct i2c_hid *ihid;
@@ -902,7 +913,7 @@ err:
902 return ret; 913 return ret;
903} 914}
904 915
905static int __devexit i2c_hid_remove(struct i2c_client *client) 916static int i2c_hid_remove(struct i2c_client *client)
906{ 917{
907 struct i2c_hid *ihid = i2c_get_clientdata(client); 918 struct i2c_hid *ihid = i2c_get_clientdata(client);
908 struct hid_device *hid; 919 struct hid_device *hid;
@@ -967,7 +978,7 @@ static struct i2c_driver i2c_hid_driver = {
967 }, 978 },
968 979
969 .probe = i2c_hid_probe, 980 .probe = i2c_hid_probe,
970 .remove = __devexit_p(i2c_hid_remove), 981 .remove = i2c_hid_remove,
971 982
972 .id_table = i2c_hid_id_table, 983 .id_table = i2c_hid_id_table,
973}; 984};
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index ac9e35228254..e0e6abf1cd3b 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -70,6 +70,7 @@ static const struct hid_blacklist {
70 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_AXIS_295, HID_QUIRK_NOGET }, 70 { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_AXIS_295, HID_QUIRK_NOGET },
71 { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, 71 { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET },
72 { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, 72 { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET },
73 { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS },
73 { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET }, 74 { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET },
74 { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET }, 75 { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET },
75 { USB_VENDOR_ID_NOVATEK, USB_DEVICE_ID_NOVATEK_MOUSE, HID_QUIRK_NO_INIT_REPORTS }, 76 { USB_VENDOR_ID_NOVATEK, USB_DEVICE_ID_NOVATEK_MOUSE, HID_QUIRK_NO_INIT_REPORTS },
diff --git a/drivers/hsi/clients/hsi_char.c b/drivers/hsi/clients/hsi_char.c
index 3ad91f6447d8..e61e5f991aa5 100644
--- a/drivers/hsi/clients/hsi_char.c
+++ b/drivers/hsi/clients/hsi_char.c
@@ -675,7 +675,7 @@ static const struct file_operations hsc_fops = {
675 .release = hsc_release, 675 .release = hsc_release,
676}; 676};
677 677
678static void __devinit hsc_channel_init(struct hsc_channel *channel) 678static void hsc_channel_init(struct hsc_channel *channel)
679{ 679{
680 init_waitqueue_head(&channel->rx_wait); 680 init_waitqueue_head(&channel->rx_wait);
681 init_waitqueue_head(&channel->tx_wait); 681 init_waitqueue_head(&channel->tx_wait);
@@ -685,7 +685,7 @@ static void __devinit hsc_channel_init(struct hsc_channel *channel)
685 INIT_LIST_HEAD(&channel->tx_msgs_queue); 685 INIT_LIST_HEAD(&channel->tx_msgs_queue);
686} 686}
687 687
688static int __devinit hsc_probe(struct device *dev) 688static int hsc_probe(struct device *dev)
689{ 689{
690 const char devname[] = "hsi_char"; 690 const char devname[] = "hsi_char";
691 struct hsc_client_data *cl_data; 691 struct hsc_client_data *cl_data;
@@ -744,7 +744,7 @@ out1:
744 return ret; 744 return ret;
745} 745}
746 746
747static int __devexit hsc_remove(struct device *dev) 747static int hsc_remove(struct device *dev)
748{ 748{
749 struct hsi_client *cl = to_hsi_client(dev); 749 struct hsi_client *cl = to_hsi_client(dev);
750 struct hsc_client_data *cl_data = hsi_client_drvdata(cl); 750 struct hsc_client_data *cl_data = hsi_client_drvdata(cl);
@@ -763,7 +763,7 @@ static struct hsi_client_driver hsc_driver = {
763 .name = "hsi_char", 763 .name = "hsi_char",
764 .owner = THIS_MODULE, 764 .owner = THIS_MODULE,
765 .probe = hsc_probe, 765 .probe = hsc_probe,
766 .remove = __devexit_p(hsc_remove), 766 .remove = hsc_remove,
767 }, 767 },
768}; 768};
769 769
diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
index f6c0011a0337..dd289fd179ca 100644
--- a/drivers/hv/hv_balloon.c
+++ b/drivers/hv/hv_balloon.c
@@ -403,7 +403,7 @@ struct dm_info_header {
403 */ 403 */
404 404
405struct dm_info_msg { 405struct dm_info_msg {
406 struct dm_info_header header; 406 struct dm_header hdr;
407 __u32 reserved; 407 __u32 reserved;
408 __u32 info_size; 408 __u32 info_size;
409 __u8 info[]; 409 __u8 info[];
@@ -503,13 +503,17 @@ static void hot_add_req(struct hv_dynmem_device *dm, struct dm_hot_add *msg)
503 503
504static void process_info(struct hv_dynmem_device *dm, struct dm_info_msg *msg) 504static void process_info(struct hv_dynmem_device *dm, struct dm_info_msg *msg)
505{ 505{
506 switch (msg->header.type) { 506 struct dm_info_header *info_hdr;
507
508 info_hdr = (struct dm_info_header *)msg->info;
509
510 switch (info_hdr->type) {
507 case INFO_TYPE_MAX_PAGE_CNT: 511 case INFO_TYPE_MAX_PAGE_CNT:
508 pr_info("Received INFO_TYPE_MAX_PAGE_CNT\n"); 512 pr_info("Received INFO_TYPE_MAX_PAGE_CNT\n");
509 pr_info("Data Size is %d\n", msg->header.data_size); 513 pr_info("Data Size is %d\n", info_hdr->data_size);
510 break; 514 break;
511 default: 515 default:
512 pr_info("Received Unknown type: %d\n", msg->header.type); 516 pr_info("Received Unknown type: %d\n", info_hdr->type);
513 } 517 }
514} 518}
515 519
@@ -879,7 +883,7 @@ static int balloon_probe(struct hv_device *dev,
879 balloon_onchannelcallback, dev); 883 balloon_onchannelcallback, dev);
880 884
881 if (ret) 885 if (ret)
882 return ret; 886 goto probe_error0;
883 887
884 dm_device.dev = dev; 888 dm_device.dev = dev;
885 dm_device.state = DM_INITIALIZING; 889 dm_device.state = DM_INITIALIZING;
@@ -891,7 +895,7 @@ static int balloon_probe(struct hv_device *dev,
891 kthread_run(dm_thread_func, &dm_device, "hv_balloon"); 895 kthread_run(dm_thread_func, &dm_device, "hv_balloon");
892 if (IS_ERR(dm_device.thread)) { 896 if (IS_ERR(dm_device.thread)) {
893 ret = PTR_ERR(dm_device.thread); 897 ret = PTR_ERR(dm_device.thread);
894 goto probe_error0; 898 goto probe_error1;
895 } 899 }
896 900
897 hv_set_drvdata(dev, &dm_device); 901 hv_set_drvdata(dev, &dm_device);
@@ -914,12 +918,12 @@ static int balloon_probe(struct hv_device *dev,
914 VM_PKT_DATA_INBAND, 918 VM_PKT_DATA_INBAND,
915 VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); 919 VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
916 if (ret) 920 if (ret)
917 goto probe_error1; 921 goto probe_error2;
918 922
919 t = wait_for_completion_timeout(&dm_device.host_event, 5*HZ); 923 t = wait_for_completion_timeout(&dm_device.host_event, 5*HZ);
920 if (t == 0) { 924 if (t == 0) {
921 ret = -ETIMEDOUT; 925 ret = -ETIMEDOUT;
922 goto probe_error1; 926 goto probe_error2;
923 } 927 }
924 928
925 /* 929 /*
@@ -928,7 +932,7 @@ static int balloon_probe(struct hv_device *dev,
928 */ 932 */
929 if (dm_device.state == DM_INIT_ERROR) { 933 if (dm_device.state == DM_INIT_ERROR) {
930 ret = -ETIMEDOUT; 934 ret = -ETIMEDOUT;
931 goto probe_error1; 935 goto probe_error2;
932 } 936 }
933 /* 937 /*
934 * Now submit our capabilities to the host. 938 * Now submit our capabilities to the host.
@@ -961,12 +965,12 @@ static int balloon_probe(struct hv_device *dev,
961 VM_PKT_DATA_INBAND, 965 VM_PKT_DATA_INBAND,
962 VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); 966 VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
963 if (ret) 967 if (ret)
964 goto probe_error1; 968 goto probe_error2;
965 969
966 t = wait_for_completion_timeout(&dm_device.host_event, 5*HZ); 970 t = wait_for_completion_timeout(&dm_device.host_event, 5*HZ);
967 if (t == 0) { 971 if (t == 0) {
968 ret = -ETIMEDOUT; 972 ret = -ETIMEDOUT;
969 goto probe_error1; 973 goto probe_error2;
970 } 974 }
971 975
972 /* 976 /*
@@ -975,18 +979,20 @@ static int balloon_probe(struct hv_device *dev,
975 */ 979 */
976 if (dm_device.state == DM_INIT_ERROR) { 980 if (dm_device.state == DM_INIT_ERROR) {
977 ret = -ETIMEDOUT; 981 ret = -ETIMEDOUT;
978 goto probe_error1; 982 goto probe_error2;
979 } 983 }
980 984
981 dm_device.state = DM_INITIALIZED; 985 dm_device.state = DM_INITIALIZED;
982 986
983 return 0; 987 return 0;
984 988
985probe_error1: 989probe_error2:
986 kthread_stop(dm_device.thread); 990 kthread_stop(dm_device.thread);
987 991
988probe_error0: 992probe_error1:
989 vmbus_close(dev->channel); 993 vmbus_close(dev->channel);
994probe_error0:
995 kfree(send_buffer);
990 return ret; 996 return ret;
991} 997}
992 998
@@ -999,6 +1005,7 @@ static int balloon_remove(struct hv_device *dev)
999 1005
1000 vmbus_close(dev->channel); 1006 vmbus_close(dev->channel);
1001 kthread_stop(dm->thread); 1007 kthread_stop(dm->thread);
1008 kfree(send_buffer);
1002 1009
1003 return 0; 1010 return 0;
1004} 1011}
diff --git a/drivers/hwmon/emc6w201.c b/drivers/hwmon/emc6w201.c
index a98c917b5888..789bd4fb329b 100644
--- a/drivers/hwmon/emc6w201.c
+++ b/drivers/hwmon/emc6w201.c
@@ -187,7 +187,7 @@ static struct emc6w201_data *emc6w201_update_device(struct device *dev)
187 * Sysfs callback functions 187 * Sysfs callback functions
188 */ 188 */
189 189
190static const u16 nominal_mv[6] = { 2500, 1500, 3300, 5000, 1500, 1500 }; 190static const s16 nominal_mv[6] = { 2500, 1500, 3300, 5000, 1500, 1500 };
191 191
192static ssize_t show_in(struct device *dev, struct device_attribute *devattr, 192static ssize_t show_in(struct device *dev, struct device_attribute *devattr,
193 char *buf) 193 char *buf)
diff --git a/drivers/hwmon/lm73.c b/drivers/hwmon/lm73.c
index 8fa2632cbbaf..7272176a9ec7 100644
--- a/drivers/hwmon/lm73.c
+++ b/drivers/hwmon/lm73.c
@@ -49,6 +49,7 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da,
49 struct i2c_client *client = to_i2c_client(dev); 49 struct i2c_client *client = to_i2c_client(dev);
50 long temp; 50 long temp;
51 short value; 51 short value;
52 s32 err;
52 53
53 int status = kstrtol(buf, 10, &temp); 54 int status = kstrtol(buf, 10, &temp);
54 if (status < 0) 55 if (status < 0)
@@ -57,8 +58,8 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da,
57 /* Write value */ 58 /* Write value */
58 value = (short) SENSORS_LIMIT(temp/250, (LM73_TEMP_MIN*4), 59 value = (short) SENSORS_LIMIT(temp/250, (LM73_TEMP_MIN*4),
59 (LM73_TEMP_MAX*4)) << 5; 60 (LM73_TEMP_MAX*4)) << 5;
60 i2c_smbus_write_word_swapped(client, attr->index, value); 61 err = i2c_smbus_write_word_swapped(client, attr->index, value);
61 return count; 62 return (err < 0) ? err : count;
62} 63}
63 64
64static ssize_t show_temp(struct device *dev, struct device_attribute *da, 65static ssize_t show_temp(struct device *dev, struct device_attribute *da,
@@ -66,11 +67,16 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *da,
66{ 67{
67 struct sensor_device_attribute *attr = to_sensor_dev_attr(da); 68 struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
68 struct i2c_client *client = to_i2c_client(dev); 69 struct i2c_client *client = to_i2c_client(dev);
70 int temp;
71
72 s32 err = i2c_smbus_read_word_swapped(client, attr->index);
73 if (err < 0)
74 return err;
75
69 /* use integer division instead of equivalent right shift to 76 /* use integer division instead of equivalent right shift to
70 guarantee arithmetic shift and preserve the sign */ 77 guarantee arithmetic shift and preserve the sign */
71 int temp = ((s16) (i2c_smbus_read_word_swapped(client, 78 temp = (((s16) err) * 250) / 32;
72 attr->index))*250) / 32; 79 return scnprintf(buf, PAGE_SIZE, "%d\n", temp);
73 return sprintf(buf, "%d\n", temp);
74} 80}
75 81
76 82
diff --git a/drivers/hwmon/vexpress.c b/drivers/hwmon/vexpress.c
index 59fd1268e58a..d867e6bb2be1 100644
--- a/drivers/hwmon/vexpress.c
+++ b/drivers/hwmon/vexpress.c
@@ -19,6 +19,7 @@
19#include <linux/hwmon.h> 19#include <linux/hwmon.h>
20#include <linux/hwmon-sysfs.h> 20#include <linux/hwmon-sysfs.h>
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/of.h>
22#include <linux/of_device.h> 23#include <linux/of_device.h>
23#include <linux/platform_device.h> 24#include <linux/platform_device.h>
24#include <linux/vexpress.h> 25#include <linux/vexpress.h>
@@ -196,7 +197,7 @@ error:
196 return err; 197 return err;
197} 198}
198 199
199static int __devexit vexpress_hwmon_remove(struct platform_device *pdev) 200static int vexpress_hwmon_remove(struct platform_device *pdev)
200{ 201{
201 struct vexpress_hwmon_data *data = platform_get_drvdata(pdev); 202 struct vexpress_hwmon_data *data = platform_get_drvdata(pdev);
202 const struct of_device_id *match; 203 const struct of_device_id *match;
@@ -213,7 +214,7 @@ static int __devexit vexpress_hwmon_remove(struct platform_device *pdev)
213 214
214static struct platform_driver vexpress_hwmon_driver = { 215static struct platform_driver vexpress_hwmon_driver = {
215 .probe = vexpress_hwmon_probe, 216 .probe = vexpress_hwmon_probe,
216 .remove = __devexit_p(vexpress_hwmon_remove), 217 .remove = vexpress_hwmon_remove,
217 .driver = { 218 .driver = {
218 .name = DRVNAME, 219 .name = DRVNAME,
219 .owner = THIS_MODULE, 220 .owner = THIS_MODULE,
diff --git a/drivers/i2c/busses/i2c-ali1535.c b/drivers/i2c/busses/i2c-ali1535.c
index 125cd8e0ad25..3f491815e2c4 100644
--- a/drivers/i2c/busses/i2c-ali1535.c
+++ b/drivers/i2c/busses/i2c-ali1535.c
@@ -139,7 +139,7 @@ static unsigned short ali1535_offset;
139 Note the differences between kernels with the old PCI BIOS interface and 139 Note the differences between kernels with the old PCI BIOS interface and
140 newer kernels with the real PCI interface. In compat.h some things are 140 newer kernels with the real PCI interface. In compat.h some things are
141 defined to make the transition easier. */ 141 defined to make the transition easier. */
142static int __devinit ali1535_setup(struct pci_dev *dev) 142static int ali1535_setup(struct pci_dev *dev)
143{ 143{
144 int retval; 144 int retval;
145 unsigned char temp; 145 unsigned char temp;
@@ -502,7 +502,7 @@ static DEFINE_PCI_DEVICE_TABLE(ali1535_ids) = {
502 502
503MODULE_DEVICE_TABLE(pci, ali1535_ids); 503MODULE_DEVICE_TABLE(pci, ali1535_ids);
504 504
505static int __devinit ali1535_probe(struct pci_dev *dev, const struct pci_device_id *id) 505static int ali1535_probe(struct pci_dev *dev, const struct pci_device_id *id)
506{ 506{
507 if (ali1535_setup(dev)) { 507 if (ali1535_setup(dev)) {
508 dev_warn(&dev->dev, 508 dev_warn(&dev->dev,
@@ -518,7 +518,7 @@ static int __devinit ali1535_probe(struct pci_dev *dev, const struct pci_device_
518 return i2c_add_adapter(&ali1535_adapter); 518 return i2c_add_adapter(&ali1535_adapter);
519} 519}
520 520
521static void __devexit ali1535_remove(struct pci_dev *dev) 521static void ali1535_remove(struct pci_dev *dev)
522{ 522{
523 i2c_del_adapter(&ali1535_adapter); 523 i2c_del_adapter(&ali1535_adapter);
524 release_region(ali1535_smba, ALI1535_SMB_IOSIZE); 524 release_region(ali1535_smba, ALI1535_SMB_IOSIZE);
@@ -528,7 +528,7 @@ static struct pci_driver ali1535_driver = {
528 .name = "ali1535_smbus", 528 .name = "ali1535_smbus",
529 .id_table = ali1535_ids, 529 .id_table = ali1535_ids,
530 .probe = ali1535_probe, 530 .probe = ali1535_probe,
531 .remove = __devexit_p(ali1535_remove), 531 .remove = ali1535_remove,
532}; 532};
533 533
534module_pci_driver(ali1535_driver); 534module_pci_driver(ali1535_driver);
diff --git a/drivers/i2c/busses/i2c-ali1563.c b/drivers/i2c/busses/i2c-ali1563.c
index e02d9f86c6a0..84ccd9496a5e 100644
--- a/drivers/i2c/busses/i2c-ali1563.c
+++ b/drivers/i2c/busses/i2c-ali1563.c
@@ -326,7 +326,7 @@ static u32 ali1563_func(struct i2c_adapter * a)
326} 326}
327 327
328 328
329static int __devinit ali1563_setup(struct pci_dev * dev) 329static int ali1563_setup(struct pci_dev *dev)
330{ 330{
331 u16 ctrl; 331 u16 ctrl;
332 332
@@ -390,8 +390,8 @@ static struct i2c_adapter ali1563_adapter = {
390 .algo = &ali1563_algorithm, 390 .algo = &ali1563_algorithm,
391}; 391};
392 392
393static int __devinit ali1563_probe(struct pci_dev * dev, 393static int ali1563_probe(struct pci_dev *dev,
394 const struct pci_device_id * id_table) 394 const struct pci_device_id *id_table)
395{ 395{
396 int error; 396 int error;
397 397
@@ -411,7 +411,7 @@ exit:
411 return error; 411 return error;
412} 412}
413 413
414static void __devexit ali1563_remove(struct pci_dev * dev) 414static void ali1563_remove(struct pci_dev *dev)
415{ 415{
416 i2c_del_adapter(&ali1563_adapter); 416 i2c_del_adapter(&ali1563_adapter);
417 ali1563_shutdown(dev); 417 ali1563_shutdown(dev);
@@ -428,7 +428,7 @@ static struct pci_driver ali1563_pci_driver = {
428 .name = "ali1563_smbus", 428 .name = "ali1563_smbus",
429 .id_table = ali1563_id_table, 429 .id_table = ali1563_id_table,
430 .probe = ali1563_probe, 430 .probe = ali1563_probe,
431 .remove = __devexit_p(ali1563_remove), 431 .remove = ali1563_remove,
432}; 432};
433 433
434module_pci_driver(ali1563_pci_driver); 434module_pci_driver(ali1563_pci_driver);
diff --git a/drivers/i2c/busses/i2c-ali15x3.c b/drivers/i2c/busses/i2c-ali15x3.c
index ce8d26d053a5..26bcc6127cee 100644
--- a/drivers/i2c/busses/i2c-ali15x3.c
+++ b/drivers/i2c/busses/i2c-ali15x3.c
@@ -131,7 +131,7 @@ MODULE_PARM_DESC(force_addr,
131static struct pci_driver ali15x3_driver; 131static struct pci_driver ali15x3_driver;
132static unsigned short ali15x3_smba; 132static unsigned short ali15x3_smba;
133 133
134static int __devinit ali15x3_setup(struct pci_dev *ALI15X3_dev) 134static int ali15x3_setup(struct pci_dev *ALI15X3_dev)
135{ 135{
136 u16 a; 136 u16 a;
137 unsigned char temp; 137 unsigned char temp;
@@ -484,7 +484,7 @@ static DEFINE_PCI_DEVICE_TABLE(ali15x3_ids) = {
484 484
485MODULE_DEVICE_TABLE (pci, ali15x3_ids); 485MODULE_DEVICE_TABLE (pci, ali15x3_ids);
486 486
487static int __devinit ali15x3_probe(struct pci_dev *dev, const struct pci_device_id *id) 487static int ali15x3_probe(struct pci_dev *dev, const struct pci_device_id *id)
488{ 488{
489 if (ali15x3_setup(dev)) { 489 if (ali15x3_setup(dev)) {
490 dev_err(&dev->dev, 490 dev_err(&dev->dev,
@@ -500,7 +500,7 @@ static int __devinit ali15x3_probe(struct pci_dev *dev, const struct pci_device_
500 return i2c_add_adapter(&ali15x3_adapter); 500 return i2c_add_adapter(&ali15x3_adapter);
501} 501}
502 502
503static void __devexit ali15x3_remove(struct pci_dev *dev) 503static void ali15x3_remove(struct pci_dev *dev)
504{ 504{
505 i2c_del_adapter(&ali15x3_adapter); 505 i2c_del_adapter(&ali15x3_adapter);
506 release_region(ali15x3_smba, ALI15X3_SMB_IOSIZE); 506 release_region(ali15x3_smba, ALI15X3_SMB_IOSIZE);
@@ -510,7 +510,7 @@ static struct pci_driver ali15x3_driver = {
510 .name = "ali15x3_smbus", 510 .name = "ali15x3_smbus",
511 .id_table = ali15x3_ids, 511 .id_table = ali15x3_ids,
512 .probe = ali15x3_probe, 512 .probe = ali15x3_probe,
513 .remove = __devexit_p(ali15x3_remove), 513 .remove = ali15x3_remove,
514}; 514};
515 515
516module_pci_driver(ali15x3_driver); 516module_pci_driver(ali15x3_driver);
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c
index 304aa03b57b2..e13e2aa2d05d 100644
--- a/drivers/i2c/busses/i2c-amd756.c
+++ b/drivers/i2c/busses/i2c-amd756.c
@@ -324,8 +324,7 @@ static DEFINE_PCI_DEVICE_TABLE(amd756_ids) = {
324 324
325MODULE_DEVICE_TABLE (pci, amd756_ids); 325MODULE_DEVICE_TABLE (pci, amd756_ids);
326 326
327static int __devinit amd756_probe(struct pci_dev *pdev, 327static int amd756_probe(struct pci_dev *pdev, const struct pci_device_id *id)
328 const struct pci_device_id *id)
329{ 328{
330 int nforce = (id->driver_data == NFORCE); 329 int nforce = (id->driver_data == NFORCE);
331 int error; 330 int error;
@@ -397,7 +396,7 @@ static int __devinit amd756_probe(struct pci_dev *pdev,
397 return error; 396 return error;
398} 397}
399 398
400static void __devexit amd756_remove(struct pci_dev *dev) 399static void amd756_remove(struct pci_dev *dev)
401{ 400{
402 i2c_del_adapter(&amd756_smbus); 401 i2c_del_adapter(&amd756_smbus);
403 release_region(amd756_ioport, SMB_IOSIZE); 402 release_region(amd756_ioport, SMB_IOSIZE);
@@ -407,7 +406,7 @@ static struct pci_driver amd756_driver = {
407 .name = "amd756_smbus", 406 .name = "amd756_smbus",
408 .id_table = amd756_ids, 407 .id_table = amd756_ids,
409 .probe = amd756_probe, 408 .probe = amd756_probe,
410 .remove = __devexit_p(amd756_remove), 409 .remove = amd756_remove,
411}; 410};
412 411
413module_pci_driver(amd756_driver); 412module_pci_driver(amd756_driver);
diff --git a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c
index 0919ac1d99aa..a44e6e77c5a1 100644
--- a/drivers/i2c/busses/i2c-amd8111.c
+++ b/drivers/i2c/busses/i2c-amd8111.c
@@ -422,8 +422,7 @@ static DEFINE_PCI_DEVICE_TABLE(amd8111_ids) = {
422 422
423MODULE_DEVICE_TABLE (pci, amd8111_ids); 423MODULE_DEVICE_TABLE (pci, amd8111_ids);
424 424
425static int __devinit amd8111_probe(struct pci_dev *dev, 425static int amd8111_probe(struct pci_dev *dev, const struct pci_device_id *id)
426 const struct pci_device_id *id)
427{ 426{
428 struct amd_smbus *smbus; 427 struct amd_smbus *smbus;
429 int error; 428 int error;
@@ -475,7 +474,7 @@ static int __devinit amd8111_probe(struct pci_dev *dev,
475 return error; 474 return error;
476} 475}
477 476
478static void __devexit amd8111_remove(struct pci_dev *dev) 477static void amd8111_remove(struct pci_dev *dev)
479{ 478{
480 struct amd_smbus *smbus = pci_get_drvdata(dev); 479 struct amd_smbus *smbus = pci_get_drvdata(dev);
481 480
@@ -488,7 +487,7 @@ static struct pci_driver amd8111_driver = {
488 .name = "amd8111_smbus2", 487 .name = "amd8111_smbus2",
489 .id_table = amd8111_ids, 488 .id_table = amd8111_ids,
490 .probe = amd8111_probe, 489 .probe = amd8111_probe,
491 .remove = __devexit_p(amd8111_remove), 490 .remove = amd8111_remove,
492}; 491};
493 492
494module_pci_driver(amd8111_driver); 493module_pci_driver(amd8111_driver);
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index b4575ee4bdf3..2bfc04d0a1b1 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -145,7 +145,7 @@ static void at91_init_twi_bus(struct at91_twi_dev *dev)
145 * Calculate symmetric clock as stated in datasheet: 145 * Calculate symmetric clock as stated in datasheet:
146 * twi_clk = F_MAIN / (2 * (cdiv * (1 << ckdiv) + offset)) 146 * twi_clk = F_MAIN / (2 * (cdiv * (1 << ckdiv) + offset))
147 */ 147 */
148static void __devinit at91_calc_twi_clock(struct at91_twi_dev *dev, int twi_clk) 148static void at91_calc_twi_clock(struct at91_twi_dev *dev, int twi_clk)
149{ 149{
150 int ckdiv, cdiv, div; 150 int ckdiv, cdiv, div;
151 struct at91_twi_pdata *pdata = dev->pdata; 151 struct at91_twi_pdata *pdata = dev->pdata;
@@ -604,7 +604,7 @@ MODULE_DEVICE_TABLE(of, atmel_twi_dt_ids);
604#define atmel_twi_dt_ids NULL 604#define atmel_twi_dt_ids NULL
605#endif 605#endif
606 606
607static bool __devinit filter(struct dma_chan *chan, void *slave) 607static bool filter(struct dma_chan *chan, void *slave)
608{ 608{
609 struct at_dma_slave *sl = slave; 609 struct at_dma_slave *sl = slave;
610 610
@@ -616,7 +616,7 @@ static bool __devinit filter(struct dma_chan *chan, void *slave)
616 } 616 }
617} 617}
618 618
619static int __devinit at91_twi_configure_dma(struct at91_twi_dev *dev, u32 phy_addr) 619static int at91_twi_configure_dma(struct at91_twi_dev *dev, u32 phy_addr)
620{ 620{
621 int ret = 0; 621 int ret = 0;
622 struct at_dma_slave *sdata; 622 struct at_dma_slave *sdata;
@@ -688,7 +688,7 @@ error:
688 return ret; 688 return ret;
689} 689}
690 690
691static struct at91_twi_pdata * __devinit at91_twi_get_driver_data( 691static struct at91_twi_pdata *at91_twi_get_driver_data(
692 struct platform_device *pdev) 692 struct platform_device *pdev)
693{ 693{
694 if (pdev->dev.of_node) { 694 if (pdev->dev.of_node) {
@@ -701,7 +701,7 @@ static struct at91_twi_pdata * __devinit at91_twi_get_driver_data(
701 return (struct at91_twi_pdata *) platform_get_device_id(pdev)->driver_data; 701 return (struct at91_twi_pdata *) platform_get_device_id(pdev)->driver_data;
702} 702}
703 703
704static int __devinit at91_twi_probe(struct platform_device *pdev) 704static int at91_twi_probe(struct platform_device *pdev)
705{ 705{
706 struct at91_twi_dev *dev; 706 struct at91_twi_dev *dev;
707 struct resource *mem; 707 struct resource *mem;
@@ -779,7 +779,7 @@ static int __devinit at91_twi_probe(struct platform_device *pdev)
779 return 0; 779 return 0;
780} 780}
781 781
782static int __devexit at91_twi_remove(struct platform_device *pdev) 782static int at91_twi_remove(struct platform_device *pdev)
783{ 783{
784 struct at91_twi_dev *dev = platform_get_drvdata(pdev); 784 struct at91_twi_dev *dev = platform_get_drvdata(pdev);
785 int rc; 785 int rc;
@@ -820,7 +820,7 @@ static const struct dev_pm_ops at91_twi_pm = {
820 820
821static struct platform_driver at91_twi_driver = { 821static struct platform_driver at91_twi_driver = {
822 .probe = at91_twi_probe, 822 .probe = at91_twi_probe,
823 .remove = __devexit_p(at91_twi_remove), 823 .remove = at91_twi_remove,
824 .id_table = at91_twi_devtypes, 824 .id_table = at91_twi_devtypes,
825 .driver = { 825 .driver = {
826 .name = "at91_i2c", 826 .name = "at91_i2c",
diff --git a/drivers/i2c/busses/i2c-au1550.c b/drivers/i2c/busses/i2c-au1550.c
index 582d616db346..b278298787d7 100644
--- a/drivers/i2c/busses/i2c-au1550.c
+++ b/drivers/i2c/busses/i2c-au1550.c
@@ -313,7 +313,7 @@ static void i2c_au1550_disable(struct i2c_au1550_data *priv)
313 * Prior to calling us, the 50MHz clock frequency and routing 313 * Prior to calling us, the 50MHz clock frequency and routing
314 * must have been set up for the PSC indicated by the adapter. 314 * must have been set up for the PSC indicated by the adapter.
315 */ 315 */
316static int __devinit 316static int
317i2c_au1550_probe(struct platform_device *pdev) 317i2c_au1550_probe(struct platform_device *pdev)
318{ 318{
319 struct i2c_au1550_data *priv; 319 struct i2c_au1550_data *priv;
@@ -372,7 +372,7 @@ out:
372 return ret; 372 return ret;
373} 373}
374 374
375static int __devexit i2c_au1550_remove(struct platform_device *pdev) 375static int i2c_au1550_remove(struct platform_device *pdev)
376{ 376{
377 struct i2c_au1550_data *priv = platform_get_drvdata(pdev); 377 struct i2c_au1550_data *priv = platform_get_drvdata(pdev);
378 378
@@ -423,7 +423,7 @@ static struct platform_driver au1xpsc_smbus_driver = {
423 .pm = AU1XPSC_SMBUS_PMOPS, 423 .pm = AU1XPSC_SMBUS_PMOPS,
424 }, 424 },
425 .probe = i2c_au1550_probe, 425 .probe = i2c_au1550_probe,
426 .remove = __devexit_p(i2c_au1550_remove), 426 .remove = i2c_au1550_remove,
427}; 427};
428 428
429module_platform_driver(au1xpsc_smbus_driver); 429module_platform_driver(au1xpsc_smbus_driver);
diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
index c1e1096ba069..2e79c1024191 100644
--- a/drivers/i2c/busses/i2c-cpm.c
+++ b/drivers/i2c/busses/i2c-cpm.c
@@ -426,7 +426,7 @@ static const struct i2c_adapter cpm_ops = {
426 .algo = &cpm_i2c_algo, 426 .algo = &cpm_i2c_algo,
427}; 427};
428 428
429static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm) 429static int cpm_i2c_setup(struct cpm_i2c *cpm)
430{ 430{
431 struct platform_device *ofdev = cpm->ofdev; 431 struct platform_device *ofdev = cpm->ofdev;
432 const u32 *data; 432 const u32 *data;
@@ -634,7 +634,7 @@ static void cpm_i2c_shutdown(struct cpm_i2c *cpm)
634 cpm_muram_free(cpm->i2c_addr); 634 cpm_muram_free(cpm->i2c_addr);
635} 635}
636 636
637static int __devinit cpm_i2c_probe(struct platform_device *ofdev) 637static int cpm_i2c_probe(struct platform_device *ofdev)
638{ 638{
639 int result, len; 639 int result, len;
640 struct cpm_i2c *cpm; 640 struct cpm_i2c *cpm;
@@ -688,7 +688,7 @@ out_free:
688 return result; 688 return result;
689} 689}
690 690
691static int __devexit cpm_i2c_remove(struct platform_device *ofdev) 691static int cpm_i2c_remove(struct platform_device *ofdev)
692{ 692{
693 struct cpm_i2c *cpm = dev_get_drvdata(&ofdev->dev); 693 struct cpm_i2c *cpm = dev_get_drvdata(&ofdev->dev);
694 694
@@ -716,7 +716,7 @@ MODULE_DEVICE_TABLE(of, cpm_i2c_match);
716 716
717static struct platform_driver cpm_i2c_driver = { 717static struct platform_driver cpm_i2c_driver = {
718 .probe = cpm_i2c_probe, 718 .probe = cpm_i2c_probe,
719 .remove = __devexit_p(cpm_i2c_remove), 719 .remove = cpm_i2c_remove,
720 .driver = { 720 .driver = {
721 .name = "fsl-i2c-cpm", 721 .name = "fsl-i2c-cpm",
722 .owner = THIS_MODULE, 722 .owner = THIS_MODULE,
diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c
index cbba7db9ad59..f5258c205de5 100644
--- a/drivers/i2c/busses/i2c-designware-core.c
+++ b/drivers/i2c/busses/i2c-designware-core.c
@@ -34,6 +34,7 @@
34#include <linux/io.h> 34#include <linux/io.h>
35#include <linux/pm_runtime.h> 35#include <linux/pm_runtime.h>
36#include <linux/delay.h> 36#include <linux/delay.h>
37#include <linux/module.h>
37#include "i2c-designware-core.h" 38#include "i2c-designware-core.h"
38 39
39/* 40/*
@@ -725,3 +726,6 @@ u32 i2c_dw_read_comp_param(struct dw_i2c_dev *dev)
725 return dw_readl(dev, DW_IC_COMP_PARAM_1); 726 return dw_readl(dev, DW_IC_COMP_PARAM_1);
726} 727}
727EXPORT_SYMBOL_GPL(i2c_dw_read_comp_param); 728EXPORT_SYMBOL_GPL(i2c_dw_read_comp_param);
729
730MODULE_DESCRIPTION("Synopsys DesignWare I2C bus adapter core");
731MODULE_LICENSE("GPL");
diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c
index 92a1e2c15baa..6add851e9dee 100644
--- a/drivers/i2c/busses/i2c-designware-pcidrv.c
+++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
@@ -207,7 +207,7 @@ static u32 i2c_dw_get_clk_rate_khz(struct dw_i2c_dev *dev)
207 return dev->controller->clk_khz; 207 return dev->controller->clk_khz;
208} 208}
209 209
210static int __devinit i2c_dw_pci_probe(struct pci_dev *pdev, 210static int i2c_dw_pci_probe(struct pci_dev *pdev,
211const struct pci_device_id *id) 211const struct pci_device_id *id)
212{ 212{
213 struct dw_i2c_dev *dev; 213 struct dw_i2c_dev *dev;
@@ -328,7 +328,7 @@ exit:
328 return r; 328 return r;
329} 329}
330 330
331static void __devexit i2c_dw_pci_remove(struct pci_dev *pdev) 331static void i2c_dw_pci_remove(struct pci_dev *pdev)
332{ 332{
333 struct dw_i2c_dev *dev = pci_get_drvdata(pdev); 333 struct dw_i2c_dev *dev = pci_get_drvdata(pdev);
334 334
@@ -368,7 +368,7 @@ static struct pci_driver dw_i2c_driver = {
368 .name = DRIVER_NAME, 368 .name = DRIVER_NAME,
369 .id_table = i2_designware_pci_ids, 369 .id_table = i2_designware_pci_ids,
370 .probe = i2c_dw_pci_probe, 370 .probe = i2c_dw_pci_probe,
371 .remove = __devexit_p(i2c_dw_pci_remove), 371 .remove = i2c_dw_pci_remove,
372 .driver = { 372 .driver = {
373 .pm = &i2c_dw_pm_ops, 373 .pm = &i2c_dw_pm_ops,
374 }, 374 },
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 0506fef8dc00..343357a2b5b4 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -50,7 +50,7 @@ static u32 i2c_dw_get_clk_rate_khz(struct dw_i2c_dev *dev)
50 return clk_get_rate(dev->clk)/1000; 50 return clk_get_rate(dev->clk)/1000;
51} 51}
52 52
53static int __devinit dw_i2c_probe(struct platform_device *pdev) 53static int dw_i2c_probe(struct platform_device *pdev)
54{ 54{
55 struct dw_i2c_dev *dev; 55 struct dw_i2c_dev *dev;
56 struct i2c_adapter *adap; 56 struct i2c_adapter *adap;
@@ -169,7 +169,7 @@ err_release_region:
169 return r; 169 return r;
170} 170}
171 171
172static int __devexit dw_i2c_remove(struct platform_device *pdev) 172static int dw_i2c_remove(struct platform_device *pdev)
173{ 173{
174 struct dw_i2c_dev *dev = platform_get_drvdata(pdev); 174 struct dw_i2c_dev *dev = platform_get_drvdata(pdev);
175 struct resource *mem; 175 struct resource *mem;
@@ -228,7 +228,7 @@ static SIMPLE_DEV_PM_OPS(dw_i2c_dev_pm_ops, dw_i2c_suspend, dw_i2c_resume);
228MODULE_ALIAS("platform:i2c_designware"); 228MODULE_ALIAS("platform:i2c_designware");
229 229
230static struct platform_driver dw_i2c_driver = { 230static struct platform_driver dw_i2c_driver = {
231 .remove = __devexit_p(dw_i2c_remove), 231 .remove = dw_i2c_remove,
232 .driver = { 232 .driver = {
233 .name = "i2c_designware", 233 .name = "i2c_designware",
234 .owner = THIS_MODULE, 234 .owner = THIS_MODULE,
diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c
index 259f7697bf25..5e7886e7136e 100644
--- a/drivers/i2c/busses/i2c-eg20t.c
+++ b/drivers/i2c/busses/i2c-eg20t.c
@@ -758,7 +758,7 @@ static void pch_i2c_disbl_int(struct i2c_algo_pch_data *adap)
758 iowrite32(BUFFER_MODE_INTR_DISBL, p + PCH_I2CBUFMSK); 758 iowrite32(BUFFER_MODE_INTR_DISBL, p + PCH_I2CBUFMSK);
759} 759}
760 760
761static int __devinit pch_i2c_probe(struct pci_dev *pdev, 761static int pch_i2c_probe(struct pci_dev *pdev,
762 const struct pci_device_id *id) 762 const struct pci_device_id *id)
763{ 763{
764 void __iomem *base_addr; 764 void __iomem *base_addr;
@@ -851,7 +851,7 @@ err_pci_enable:
851 return ret; 851 return ret;
852} 852}
853 853
854static void __devexit pch_i2c_remove(struct pci_dev *pdev) 854static void pch_i2c_remove(struct pci_dev *pdev)
855{ 855{
856 int i; 856 int i;
857 struct adapter_info *adap_info = pci_get_drvdata(pdev); 857 struct adapter_info *adap_info = pci_get_drvdata(pdev);
@@ -948,7 +948,7 @@ static struct pci_driver pch_pcidriver = {
948 .name = KBUILD_MODNAME, 948 .name = KBUILD_MODNAME,
949 .id_table = pch_pcidev_id, 949 .id_table = pch_pcidev_id,
950 .probe = pch_i2c_probe, 950 .probe = pch_i2c_probe,
951 .remove = __devexit_p(pch_i2c_remove), 951 .remove = pch_i2c_remove,
952 .suspend = pch_i2c_suspend, 952 .suspend = pch_i2c_suspend,
953 .resume = pch_i2c_resume 953 .resume = pch_i2c_resume
954}; 954};
diff --git a/drivers/i2c/busses/i2c-elektor.c b/drivers/i2c/busses/i2c-elektor.c
index 37e2e82a9c88..485497066ed7 100644
--- a/drivers/i2c/busses/i2c-elektor.c
+++ b/drivers/i2c/busses/i2c-elektor.c
@@ -205,7 +205,7 @@ static struct i2c_adapter pcf_isa_ops = {
205 .name = "i2c-elektor", 205 .name = "i2c-elektor",
206}; 206};
207 207
208static int __devinit elektor_match(struct device *dev, unsigned int id) 208static int elektor_match(struct device *dev, unsigned int id)
209{ 209{
210#ifdef __alpha__ 210#ifdef __alpha__
211 /* check to see we have memory mapped PCF8584 connected to the 211 /* check to see we have memory mapped PCF8584 connected to the
@@ -264,7 +264,7 @@ static int __devinit elektor_match(struct device *dev, unsigned int id)
264 return 1; 264 return 1;
265} 265}
266 266
267static int __devinit elektor_probe(struct device *dev, unsigned int id) 267static int elektor_probe(struct device *dev, unsigned int id)
268{ 268{
269 init_waitqueue_head(&pcf_wait); 269 init_waitqueue_head(&pcf_wait);
270 if (pcf_isa_init()) 270 if (pcf_isa_init())
@@ -293,7 +293,7 @@ static int __devinit elektor_probe(struct device *dev, unsigned int id)
293 return -ENODEV; 293 return -ENODEV;
294} 294}
295 295
296static int __devexit elektor_remove(struct device *dev, unsigned int id) 296static int elektor_remove(struct device *dev, unsigned int id)
297{ 297{
298 i2c_del_adapter(&pcf_isa_ops); 298 i2c_del_adapter(&pcf_isa_ops);
299 299
@@ -316,7 +316,7 @@ static int __devexit elektor_remove(struct device *dev, unsigned int id)
316static struct isa_driver i2c_elektor_driver = { 316static struct isa_driver i2c_elektor_driver = {
317 .match = elektor_match, 317 .match = elektor_match,
318 .probe = elektor_probe, 318 .probe = elektor_probe,
319 .remove = __devexit_p(elektor_remove), 319 .remove = elektor_remove,
320 .driver = { 320 .driver = {
321 .owner = THIS_MODULE, 321 .owner = THIS_MODULE,
322 .name = "i2c-elektor", 322 .name = "i2c-elektor",
diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
index 257299a92df3..f3fa4332bbdf 100644
--- a/drivers/i2c/busses/i2c-gpio.c
+++ b/drivers/i2c/busses/i2c-gpio.c
@@ -85,7 +85,7 @@ static int i2c_gpio_getscl(void *data)
85 return gpio_get_value(pdata->scl_pin); 85 return gpio_get_value(pdata->scl_pin);
86} 86}
87 87
88static int __devinit of_i2c_gpio_probe(struct device_node *np, 88static int of_i2c_gpio_probe(struct device_node *np,
89 struct i2c_gpio_platform_data *pdata) 89 struct i2c_gpio_platform_data *pdata)
90{ 90{
91 u32 reg; 91 u32 reg;
@@ -117,7 +117,7 @@ static int __devinit of_i2c_gpio_probe(struct device_node *np,
117 return 0; 117 return 0;
118} 118}
119 119
120static int __devinit i2c_gpio_probe(struct platform_device *pdev) 120static int i2c_gpio_probe(struct platform_device *pdev)
121{ 121{
122 struct i2c_gpio_private_data *priv; 122 struct i2c_gpio_private_data *priv;
123 struct i2c_gpio_platform_data *pdata; 123 struct i2c_gpio_platform_data *pdata;
@@ -218,7 +218,7 @@ err_request_sda:
218 return ret; 218 return ret;
219} 219}
220 220
221static int __devexit i2c_gpio_remove(struct platform_device *pdev) 221static int i2c_gpio_remove(struct platform_device *pdev)
222{ 222{
223 struct i2c_gpio_private_data *priv; 223 struct i2c_gpio_private_data *priv;
224 struct i2c_gpio_platform_data *pdata; 224 struct i2c_gpio_platform_data *pdata;
@@ -251,7 +251,7 @@ static struct platform_driver i2c_gpio_driver = {
251 .of_match_table = of_match_ptr(i2c_gpio_dt_ids), 251 .of_match_table = of_match_ptr(i2c_gpio_dt_ids),
252 }, 252 },
253 .probe = i2c_gpio_probe, 253 .probe = i2c_gpio_probe,
254 .remove = __devexit_p(i2c_gpio_remove), 254 .remove = i2c_gpio_remove,
255}; 255};
256 256
257static int __init i2c_gpio_init(void) 257static int __init i2c_gpio_init(void)
diff --git a/drivers/i2c/busses/i2c-highlander.c b/drivers/i2c/busses/i2c-highlander.c
index 19515df61021..3351cc7ed11f 100644
--- a/drivers/i2c/busses/i2c-highlander.c
+++ b/drivers/i2c/busses/i2c-highlander.c
@@ -356,7 +356,7 @@ static const struct i2c_algorithm highlander_i2c_algo = {
356 .functionality = highlander_i2c_func, 356 .functionality = highlander_i2c_func,
357}; 357};
358 358
359static int __devinit highlander_i2c_probe(struct platform_device *pdev) 359static int highlander_i2c_probe(struct platform_device *pdev)
360{ 360{
361 struct highlander_i2c_dev *dev; 361 struct highlander_i2c_dev *dev;
362 struct i2c_adapter *adap; 362 struct i2c_adapter *adap;
@@ -441,7 +441,7 @@ err:
441 return ret; 441 return ret;
442} 442}
443 443
444static int __devexit highlander_i2c_remove(struct platform_device *pdev) 444static int highlander_i2c_remove(struct platform_device *pdev)
445{ 445{
446 struct highlander_i2c_dev *dev = platform_get_drvdata(pdev); 446 struct highlander_i2c_dev *dev = platform_get_drvdata(pdev);
447 447
@@ -465,7 +465,7 @@ static struct platform_driver highlander_i2c_driver = {
465 }, 465 },
466 466
467 .probe = highlander_i2c_probe, 467 .probe = highlander_i2c_probe,
468 .remove = __devexit_p(highlander_i2c_remove), 468 .remove = highlander_i2c_remove,
469}; 469};
470 470
471module_platform_driver(highlander_i2c_driver); 471module_platform_driver(highlander_i2c_driver);
diff --git a/drivers/i2c/busses/i2c-hydra.c b/drivers/i2c/busses/i2c-hydra.c
index c9f95e1666a8..79c3d9069a48 100644
--- a/drivers/i2c/busses/i2c-hydra.c
+++ b/drivers/i2c/busses/i2c-hydra.c
@@ -112,7 +112,7 @@ static DEFINE_PCI_DEVICE_TABLE(hydra_ids) = {
112 112
113MODULE_DEVICE_TABLE (pci, hydra_ids); 113MODULE_DEVICE_TABLE (pci, hydra_ids);
114 114
115static int __devinit hydra_probe(struct pci_dev *dev, 115static int hydra_probe(struct pci_dev *dev,
116 const struct pci_device_id *id) 116 const struct pci_device_id *id)
117{ 117{
118 unsigned long base = pci_resource_start(dev, 0); 118 unsigned long base = pci_resource_start(dev, 0);
@@ -139,7 +139,7 @@ static int __devinit hydra_probe(struct pci_dev *dev,
139 return 0; 139 return 0;
140} 140}
141 141
142static void __devexit hydra_remove(struct pci_dev *dev) 142static void hydra_remove(struct pci_dev *dev)
143{ 143{
144 pdregw(hydra_bit_data.data, 0); /* clear SCLK_OE and SDAT_OE */ 144 pdregw(hydra_bit_data.data, 0); /* clear SCLK_OE and SDAT_OE */
145 i2c_del_adapter(&hydra_adap); 145 i2c_del_adapter(&hydra_adap);
@@ -153,7 +153,7 @@ static struct pci_driver hydra_driver = {
153 .name = "hydra_smbus", 153 .name = "hydra_smbus",
154 .id_table = hydra_ids, 154 .id_table = hydra_ids,
155 .probe = hydra_probe, 155 .probe = hydra_probe,
156 .remove = __devexit_p(hydra_remove), 156 .remove = hydra_remove,
157}; 157};
158 158
159module_pci_driver(hydra_driver); 159module_pci_driver(hydra_driver);
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 1e73638225e1..3092387f6ef4 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -841,14 +841,14 @@ struct dmi_onboard_device_info {
841 const char *i2c_type; 841 const char *i2c_type;
842}; 842};
843 843
844static struct dmi_onboard_device_info __devinitdata dmi_devices[] = { 844static const struct dmi_onboard_device_info dmi_devices[] = {
845 { "Syleus", DMI_DEV_TYPE_OTHER, 0x73, "fscsyl" }, 845 { "Syleus", DMI_DEV_TYPE_OTHER, 0x73, "fscsyl" },
846 { "Hermes", DMI_DEV_TYPE_OTHER, 0x73, "fscher" }, 846 { "Hermes", DMI_DEV_TYPE_OTHER, 0x73, "fscher" },
847 { "Hades", DMI_DEV_TYPE_OTHER, 0x73, "fschds" }, 847 { "Hades", DMI_DEV_TYPE_OTHER, 0x73, "fschds" },
848}; 848};
849 849
850static void __devinit dmi_check_onboard_device(u8 type, const char *name, 850static void dmi_check_onboard_device(u8 type, const char *name,
851 struct i2c_adapter *adap) 851 struct i2c_adapter *adap)
852{ 852{
853 int i; 853 int i;
854 struct i2c_board_info info; 854 struct i2c_board_info info;
@@ -871,8 +871,7 @@ static void __devinit dmi_check_onboard_device(u8 type, const char *name,
871/* We use our own function to check for onboard devices instead of 871/* We use our own function to check for onboard devices instead of
872 dmi_find_device() as some buggy BIOS's have the devices we are interested 872 dmi_find_device() as some buggy BIOS's have the devices we are interested
873 in marked as disabled */ 873 in marked as disabled */
874static void __devinit dmi_check_onboard_devices(const struct dmi_header *dm, 874static void dmi_check_onboard_devices(const struct dmi_header *dm, void *adap)
875 void *adap)
876{ 875{
877 int i, count; 876 int i, count;
878 877
@@ -901,7 +900,7 @@ static void __devinit dmi_check_onboard_devices(const struct dmi_header *dm,
901} 900}
902 901
903/* Register optional slaves */ 902/* Register optional slaves */
904static void __devinit i801_probe_optional_slaves(struct i801_priv *priv) 903static void i801_probe_optional_slaves(struct i801_priv *priv)
905{ 904{
906 /* Only register slaves on main SMBus channel */ 905 /* Only register slaves on main SMBus channel */
907 if (priv->features & FEATURE_IDF) 906 if (priv->features & FEATURE_IDF)
@@ -921,7 +920,7 @@ static void __devinit i801_probe_optional_slaves(struct i801_priv *priv)
921} 920}
922#else 921#else
923static void __init input_apanel_init(void) {} 922static void __init input_apanel_init(void) {}
924static void __devinit i801_probe_optional_slaves(struct i801_priv *priv) {} 923static void i801_probe_optional_slaves(struct i801_priv *priv) {}
925#endif /* CONFIG_X86 && CONFIG_DMI */ 924#endif /* CONFIG_X86 && CONFIG_DMI */
926 925
927#if (defined CONFIG_I2C_MUX_GPIO || defined CONFIG_I2C_MUX_GPIO_MODULE) && \ 926#if (defined CONFIG_I2C_MUX_GPIO || defined CONFIG_I2C_MUX_GPIO_MODULE) && \
@@ -944,7 +943,7 @@ static struct i801_mux_config i801_mux_config_asus_z8_d18 = {
944 .n_gpios = 2, 943 .n_gpios = 2,
945}; 944};
946 945
947static struct dmi_system_id __devinitdata mux_dmi_table[] = { 946static const struct dmi_system_id mux_dmi_table[] = {
948 { 947 {
949 .matches = { 948 .matches = {
950 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), 949 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
@@ -1012,7 +1011,7 @@ static struct dmi_system_id __devinitdata mux_dmi_table[] = {
1012}; 1011};
1013 1012
1014/* Setup multiplexing if needed */ 1013/* Setup multiplexing if needed */
1015static int __devinit i801_add_mux(struct i801_priv *priv) 1014static int i801_add_mux(struct i801_priv *priv)
1016{ 1015{
1017 struct device *dev = &priv->adapter.dev; 1016 struct device *dev = &priv->adapter.dev;
1018 const struct i801_mux_config *mux_config; 1017 const struct i801_mux_config *mux_config;
@@ -1048,13 +1047,13 @@ static int __devinit i801_add_mux(struct i801_priv *priv)
1048 return 0; 1047 return 0;
1049} 1048}
1050 1049
1051static void __devexit i801_del_mux(struct i801_priv *priv) 1050static void i801_del_mux(struct i801_priv *priv)
1052{ 1051{
1053 if (priv->mux_pdev) 1052 if (priv->mux_pdev)
1054 platform_device_unregister(priv->mux_pdev); 1053 platform_device_unregister(priv->mux_pdev);
1055} 1054}
1056 1055
1057static unsigned int __devinit i801_get_adapter_class(struct i801_priv *priv) 1056static unsigned int i801_get_adapter_class(struct i801_priv *priv)
1058{ 1057{
1059 const struct dmi_system_id *id; 1058 const struct dmi_system_id *id;
1060 const struct i801_mux_config *mux_config; 1059 const struct i801_mux_config *mux_config;
@@ -1084,8 +1083,7 @@ static inline unsigned int i801_get_adapter_class(struct i801_priv *priv)
1084} 1083}
1085#endif 1084#endif
1086 1085
1087static int __devinit i801_probe(struct pci_dev *dev, 1086static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
1088 const struct pci_device_id *id)
1089{ 1087{
1090 unsigned char temp; 1088 unsigned char temp;
1091 int err, i; 1089 int err, i;
@@ -1226,7 +1224,7 @@ exit:
1226 return err; 1224 return err;
1227} 1225}
1228 1226
1229static void __devexit i801_remove(struct pci_dev *dev) 1227static void i801_remove(struct pci_dev *dev)
1230{ 1228{
1231 struct i801_priv *priv = pci_get_drvdata(dev); 1229 struct i801_priv *priv = pci_get_drvdata(dev);
1232 1230
@@ -1272,7 +1270,7 @@ static struct pci_driver i801_driver = {
1272 .name = "i801_smbus", 1270 .name = "i801_smbus",
1273 .id_table = i801_ids, 1271 .id_table = i801_ids,
1274 .probe = i801_probe, 1272 .probe = i801_probe,
1275 .remove = __devexit_p(i801_remove), 1273 .remove = i801_remove,
1276 .suspend = i801_suspend, 1274 .suspend = i801_suspend,
1277 .resume = i801_resume, 1275 .resume = i801_resume,
1278}; 1276};
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
index 806e225f3de7..33a2abb6c063 100644
--- a/drivers/i2c/busses/i2c-ibm_iic.c
+++ b/drivers/i2c/busses/i2c-ibm_iic.c
@@ -660,7 +660,7 @@ static inline u8 iic_clckdiv(unsigned int opb)
660 return (u8)((opb + 9) / 10 - 1); 660 return (u8)((opb + 9) / 10 - 1);
661} 661}
662 662
663static int __devinit iic_request_irq(struct platform_device *ofdev, 663static int iic_request_irq(struct platform_device *ofdev,
664 struct ibm_iic_private *dev) 664 struct ibm_iic_private *dev)
665{ 665{
666 struct device_node *np = ofdev->dev.of_node; 666 struct device_node *np = ofdev->dev.of_node;
@@ -691,7 +691,7 @@ static int __devinit iic_request_irq(struct platform_device *ofdev,
691/* 691/*
692 * Register single IIC interface 692 * Register single IIC interface
693 */ 693 */
694static int __devinit iic_probe(struct platform_device *ofdev) 694static int iic_probe(struct platform_device *ofdev)
695{ 695{
696 struct device_node *np = ofdev->dev.of_node; 696 struct device_node *np = ofdev->dev.of_node;
697 struct ibm_iic_private *dev; 697 struct ibm_iic_private *dev;
@@ -781,7 +781,7 @@ error_cleanup:
781/* 781/*
782 * Cleanup initialized IIC interface 782 * Cleanup initialized IIC interface
783 */ 783 */
784static int __devexit iic_remove(struct platform_device *ofdev) 784static int iic_remove(struct platform_device *ofdev)
785{ 785{
786 struct ibm_iic_private *dev = dev_get_drvdata(&ofdev->dev); 786 struct ibm_iic_private *dev = dev_get_drvdata(&ofdev->dev);
787 787
@@ -812,7 +812,7 @@ static struct platform_driver ibm_iic_driver = {
812 .of_match_table = ibm_iic_match, 812 .of_match_table = ibm_iic_match,
813 }, 813 },
814 .probe = iic_probe, 814 .probe = iic_probe,
815 .remove = __devexit_p(iic_remove), 815 .remove = iic_remove,
816}; 816};
817 817
818module_platform_driver(ibm_iic_driver); 818module_platform_driver(ibm_iic_driver);
diff --git a/drivers/i2c/busses/i2c-intel-mid.c b/drivers/i2c/busses/i2c-intel-mid.c
index 7c28f10f95ca..de3736bf6465 100644
--- a/drivers/i2c/busses/i2c-intel-mid.c
+++ b/drivers/i2c/busses/i2c-intel-mid.c
@@ -947,7 +947,7 @@ static const struct dev_pm_ops intel_mid_i2c_pm_ops = {
947 * 5. Call intel_mid_i2c_hwinit() for hardware initialization 947 * 5. Call intel_mid_i2c_hwinit() for hardware initialization
948 * 6. Register I2C adapter in i2c-core 948 * 6. Register I2C adapter in i2c-core
949 */ 949 */
950static int __devinit intel_mid_i2c_probe(struct pci_dev *dev, 950static int intel_mid_i2c_probe(struct pci_dev *dev,
951 const struct pci_device_id *id) 951 const struct pci_device_id *id)
952{ 952{
953 struct intel_mid_i2c_private *mrst; 953 struct intel_mid_i2c_private *mrst;
@@ -1079,7 +1079,7 @@ exit:
1079 return err; 1079 return err;
1080} 1080}
1081 1081
1082static void __devexit intel_mid_i2c_remove(struct pci_dev *dev) 1082static void intel_mid_i2c_remove(struct pci_dev *dev)
1083{ 1083{
1084 struct intel_mid_i2c_private *mrst = pci_get_drvdata(dev); 1084 struct intel_mid_i2c_private *mrst = pci_get_drvdata(dev);
1085 intel_mid_i2c_disable(&mrst->adap); 1085 intel_mid_i2c_disable(&mrst->adap);
@@ -1113,7 +1113,7 @@ static struct pci_driver intel_mid_i2c_driver = {
1113 .name = DRIVER_NAME, 1113 .name = DRIVER_NAME,
1114 .id_table = intel_mid_i2c_ids, 1114 .id_table = intel_mid_i2c_ids,
1115 .probe = intel_mid_i2c_probe, 1115 .probe = intel_mid_i2c_probe,
1116 .remove = __devexit_p(intel_mid_i2c_remove), 1116 .remove = intel_mid_i2c_remove,
1117}; 1117};
1118 1118
1119module_pci_driver(intel_mid_i2c_driver); 1119module_pci_driver(intel_mid_i2c_driver);
diff --git a/drivers/i2c/busses/i2c-isch.c b/drivers/i2c/busses/i2c-isch.c
index f90a6057508d..4099f79c2280 100644
--- a/drivers/i2c/busses/i2c-isch.c
+++ b/drivers/i2c/busses/i2c-isch.c
@@ -249,7 +249,7 @@ static struct i2c_adapter sch_adapter = {
249 .algo = &smbus_algorithm, 249 .algo = &smbus_algorithm,
250}; 250};
251 251
252static int __devinit smbus_sch_probe(struct platform_device *dev) 252static int smbus_sch_probe(struct platform_device *dev)
253{ 253{
254 struct resource *res; 254 struct resource *res;
255 int retval; 255 int retval;
@@ -284,7 +284,7 @@ static int __devinit smbus_sch_probe(struct platform_device *dev)
284 return retval; 284 return retval;
285} 285}
286 286
287static int __devexit smbus_sch_remove(struct platform_device *pdev) 287static int smbus_sch_remove(struct platform_device *pdev)
288{ 288{
289 struct resource *res; 289 struct resource *res;
290 if (sch_smba) { 290 if (sch_smba) {
@@ -303,7 +303,7 @@ static struct platform_driver smbus_sch_driver = {
303 .owner = THIS_MODULE, 303 .owner = THIS_MODULE,
304 }, 304 },
305 .probe = smbus_sch_probe, 305 .probe = smbus_sch_probe,
306 .remove = __devexit_p(smbus_sch_remove), 306 .remove = smbus_sch_remove,
307}; 307};
308 308
309module_platform_driver(smbus_sch_driver); 309module_platform_driver(smbus_sch_driver);
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index ca86430cb4a2..a69459e5c3f3 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -175,7 +175,7 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing)
175} 175}
176 176
177#if defined(CONFIG_PPC_MPC52xx) || defined(CONFIG_PPC_MPC512x) 177#if defined(CONFIG_PPC_MPC52xx) || defined(CONFIG_PPC_MPC512x)
178static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] __devinitconst = { 178static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] = {
179 {20, 0x20}, {22, 0x21}, {24, 0x22}, {26, 0x23}, 179 {20, 0x20}, {22, 0x21}, {24, 0x22}, {26, 0x23},
180 {28, 0x24}, {30, 0x01}, {32, 0x25}, {34, 0x02}, 180 {28, 0x24}, {30, 0x01}, {32, 0x25}, {34, 0x02},
181 {36, 0x26}, {40, 0x27}, {44, 0x04}, {48, 0x28}, 181 {36, 0x26}, {40, 0x27}, {44, 0x04}, {48, 0x28},
@@ -196,7 +196,7 @@ static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] __devinitconst = {
196 {10240, 0x9d}, {12288, 0x9e}, {15360, 0x9f} 196 {10240, 0x9d}, {12288, 0x9e}, {15360, 0x9f}
197}; 197};
198 198
199static int __devinit mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock, 199static int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock,
200 int prescaler, u32 *real_clk) 200 int prescaler, u32 *real_clk)
201{ 201{
202 const struct mpc_i2c_divider *div = NULL; 202 const struct mpc_i2c_divider *div = NULL;
@@ -230,7 +230,7 @@ static int __devinit mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock,
230 return (int)div->fdr; 230 return (int)div->fdr;
231} 231}
232 232
233static void __devinit mpc_i2c_setup_52xx(struct device_node *node, 233static void mpc_i2c_setup_52xx(struct device_node *node,
234 struct mpc_i2c *i2c, 234 struct mpc_i2c *i2c,
235 u32 clock, u32 prescaler) 235 u32 clock, u32 prescaler)
236{ 236{
@@ -252,7 +252,7 @@ static void __devinit mpc_i2c_setup_52xx(struct device_node *node,
252 fdr); 252 fdr);
253} 253}
254#else /* !(CONFIG_PPC_MPC52xx || CONFIG_PPC_MPC512x) */ 254#else /* !(CONFIG_PPC_MPC52xx || CONFIG_PPC_MPC512x) */
255static void __devinit mpc_i2c_setup_52xx(struct device_node *node, 255static void mpc_i2c_setup_52xx(struct device_node *node,
256 struct mpc_i2c *i2c, 256 struct mpc_i2c *i2c,
257 u32 clock, u32 prescaler) 257 u32 clock, u32 prescaler)
258{ 258{
@@ -260,7 +260,7 @@ static void __devinit mpc_i2c_setup_52xx(struct device_node *node,
260#endif /* CONFIG_PPC_MPC52xx || CONFIG_PPC_MPC512x */ 260#endif /* CONFIG_PPC_MPC52xx || CONFIG_PPC_MPC512x */
261 261
262#ifdef CONFIG_PPC_MPC512x 262#ifdef CONFIG_PPC_MPC512x
263static void __devinit mpc_i2c_setup_512x(struct device_node *node, 263static void mpc_i2c_setup_512x(struct device_node *node,
264 struct mpc_i2c *i2c, 264 struct mpc_i2c *i2c,
265 u32 clock, u32 prescaler) 265 u32 clock, u32 prescaler)
266{ 266{
@@ -288,7 +288,7 @@ static void __devinit mpc_i2c_setup_512x(struct device_node *node,
288 mpc_i2c_setup_52xx(node, i2c, clock, prescaler); 288 mpc_i2c_setup_52xx(node, i2c, clock, prescaler);
289} 289}
290#else /* CONFIG_PPC_MPC512x */ 290#else /* CONFIG_PPC_MPC512x */
291static void __devinit mpc_i2c_setup_512x(struct device_node *node, 291static void mpc_i2c_setup_512x(struct device_node *node,
292 struct mpc_i2c *i2c, 292 struct mpc_i2c *i2c,
293 u32 clock, u32 prescaler) 293 u32 clock, u32 prescaler)
294{ 294{
@@ -296,7 +296,7 @@ static void __devinit mpc_i2c_setup_512x(struct device_node *node,
296#endif /* CONFIG_PPC_MPC512x */ 296#endif /* CONFIG_PPC_MPC512x */
297 297
298#ifdef CONFIG_FSL_SOC 298#ifdef CONFIG_FSL_SOC
299static const struct mpc_i2c_divider mpc_i2c_dividers_8xxx[] __devinitconst = { 299static const struct mpc_i2c_divider mpc_i2c_dividers_8xxx[] = {
300 {160, 0x0120}, {192, 0x0121}, {224, 0x0122}, {256, 0x0123}, 300 {160, 0x0120}, {192, 0x0121}, {224, 0x0122}, {256, 0x0123},
301 {288, 0x0100}, {320, 0x0101}, {352, 0x0601}, {384, 0x0102}, 301 {288, 0x0100}, {320, 0x0101}, {352, 0x0601}, {384, 0x0102},
302 {416, 0x0602}, {448, 0x0126}, {480, 0x0103}, {512, 0x0127}, 302 {416, 0x0602}, {448, 0x0126}, {480, 0x0103}, {512, 0x0127},
@@ -316,7 +316,7 @@ static const struct mpc_i2c_divider mpc_i2c_dividers_8xxx[] __devinitconst = {
316 {49152, 0x011e}, {61440, 0x011f} 316 {49152, 0x011e}, {61440, 0x011f}
317}; 317};
318 318
319static u32 __devinit mpc_i2c_get_sec_cfg_8xxx(void) 319static u32 mpc_i2c_get_sec_cfg_8xxx(void)
320{ 320{
321 struct device_node *node = NULL; 321 struct device_node *node = NULL;
322 u32 __iomem *reg; 322 u32 __iomem *reg;
@@ -345,7 +345,7 @@ static u32 __devinit mpc_i2c_get_sec_cfg_8xxx(void)
345 return val; 345 return val;
346} 346}
347 347
348static int __devinit mpc_i2c_get_fdr_8xxx(struct device_node *node, u32 clock, 348static int mpc_i2c_get_fdr_8xxx(struct device_node *node, u32 clock,
349 u32 prescaler, u32 *real_clk) 349 u32 prescaler, u32 *real_clk)
350{ 350{
351 const struct mpc_i2c_divider *div = NULL; 351 const struct mpc_i2c_divider *div = NULL;
@@ -383,7 +383,7 @@ static int __devinit mpc_i2c_get_fdr_8xxx(struct device_node *node, u32 clock,
383 return div ? (int)div->fdr : -EINVAL; 383 return div ? (int)div->fdr : -EINVAL;
384} 384}
385 385
386static void __devinit mpc_i2c_setup_8xxx(struct device_node *node, 386static void mpc_i2c_setup_8xxx(struct device_node *node,
387 struct mpc_i2c *i2c, 387 struct mpc_i2c *i2c,
388 u32 clock, u32 prescaler) 388 u32 clock, u32 prescaler)
389{ 389{
@@ -408,7 +408,7 @@ static void __devinit mpc_i2c_setup_8xxx(struct device_node *node,
408} 408}
409 409
410#else /* !CONFIG_FSL_SOC */ 410#else /* !CONFIG_FSL_SOC */
411static void __devinit mpc_i2c_setup_8xxx(struct device_node *node, 411static void mpc_i2c_setup_8xxx(struct device_node *node,
412 struct mpc_i2c *i2c, 412 struct mpc_i2c *i2c,
413 u32 clock, u32 prescaler) 413 u32 clock, u32 prescaler)
414{ 414{
@@ -615,7 +615,7 @@ static struct i2c_adapter mpc_ops = {
615}; 615};
616 616
617static const struct of_device_id mpc_i2c_of_match[]; 617static const struct of_device_id mpc_i2c_of_match[];
618static int __devinit fsl_i2c_probe(struct platform_device *op) 618static int fsl_i2c_probe(struct platform_device *op)
619{ 619{
620 const struct of_device_id *match; 620 const struct of_device_id *match;
621 struct mpc_i2c *i2c; 621 struct mpc_i2c *i2c;
@@ -706,7 +706,7 @@ static int __devinit fsl_i2c_probe(struct platform_device *op)
706 return result; 706 return result;
707}; 707};
708 708
709static int __devexit fsl_i2c_remove(struct platform_device *op) 709static int fsl_i2c_remove(struct platform_device *op)
710{ 710{
711 struct mpc_i2c *i2c = dev_get_drvdata(&op->dev); 711 struct mpc_i2c *i2c = dev_get_drvdata(&op->dev);
712 712
@@ -746,24 +746,24 @@ static int mpc_i2c_resume(struct device *dev)
746SIMPLE_DEV_PM_OPS(mpc_i2c_pm_ops, mpc_i2c_suspend, mpc_i2c_resume); 746SIMPLE_DEV_PM_OPS(mpc_i2c_pm_ops, mpc_i2c_suspend, mpc_i2c_resume);
747#endif 747#endif
748 748
749static const struct mpc_i2c_data mpc_i2c_data_512x __devinitdata = { 749static const struct mpc_i2c_data mpc_i2c_data_512x = {
750 .setup = mpc_i2c_setup_512x, 750 .setup = mpc_i2c_setup_512x,
751}; 751};
752 752
753static const struct mpc_i2c_data mpc_i2c_data_52xx __devinitdata = { 753static const struct mpc_i2c_data mpc_i2c_data_52xx = {
754 .setup = mpc_i2c_setup_52xx, 754 .setup = mpc_i2c_setup_52xx,
755}; 755};
756 756
757static const struct mpc_i2c_data mpc_i2c_data_8313 __devinitdata = { 757static const struct mpc_i2c_data mpc_i2c_data_8313 = {
758 .setup = mpc_i2c_setup_8xxx, 758 .setup = mpc_i2c_setup_8xxx,
759}; 759};
760 760
761static const struct mpc_i2c_data mpc_i2c_data_8543 __devinitdata = { 761static const struct mpc_i2c_data mpc_i2c_data_8543 = {
762 .setup = mpc_i2c_setup_8xxx, 762 .setup = mpc_i2c_setup_8xxx,
763 .prescaler = 2, 763 .prescaler = 2,
764}; 764};
765 765
766static const struct mpc_i2c_data mpc_i2c_data_8544 __devinitdata = { 766static const struct mpc_i2c_data mpc_i2c_data_8544 = {
767 .setup = mpc_i2c_setup_8xxx, 767 .setup = mpc_i2c_setup_8xxx,
768 .prescaler = 3, 768 .prescaler = 3,
769}; 769};
@@ -785,7 +785,7 @@ MODULE_DEVICE_TABLE(of, mpc_i2c_of_match);
785/* Structure for a device driver */ 785/* Structure for a device driver */
786static struct platform_driver mpc_i2c_driver = { 786static struct platform_driver mpc_i2c_driver = {
787 .probe = fsl_i2c_probe, 787 .probe = fsl_i2c_probe,
788 .remove = __devexit_p(fsl_i2c_remove), 788 .remove = fsl_i2c_remove,
789 .driver = { 789 .driver = {
790 .owner = THIS_MODULE, 790 .owner = THIS_MODULE,
791 .name = DRV_NAME, 791 .name = DRV_NAME,
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index 2e9d56719e99..8b20ef8524ac 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -495,7 +495,7 @@ static const struct i2c_algorithm mv64xxx_i2c_algo = {
495 * 495 *
496 ***************************************************************************** 496 *****************************************************************************
497 */ 497 */
498static int __devinit 498static int
499mv64xxx_i2c_map_regs(struct platform_device *pd, 499mv64xxx_i2c_map_regs(struct platform_device *pd,
500 struct mv64xxx_i2c_data *drv_data) 500 struct mv64xxx_i2c_data *drv_data)
501{ 501{
@@ -530,13 +530,13 @@ mv64xxx_i2c_unmap_regs(struct mv64xxx_i2c_data *drv_data)
530} 530}
531 531
532#ifdef CONFIG_OF 532#ifdef CONFIG_OF
533static int __devinit 533static int
534mv64xxx_calc_freq(const int tclk, const int n, const int m) 534mv64xxx_calc_freq(const int tclk, const int n, const int m)
535{ 535{
536 return tclk / (10 * (m + 1) * (2 << n)); 536 return tclk / (10 * (m + 1) * (2 << n));
537} 537}
538 538
539static bool __devinit 539static bool
540mv64xxx_find_baud_factors(const u32 req_freq, const u32 tclk, u32 *best_n, 540mv64xxx_find_baud_factors(const u32 req_freq, const u32 tclk, u32 *best_n,
541 u32 *best_m) 541 u32 *best_m)
542{ 542{
@@ -560,7 +560,7 @@ mv64xxx_find_baud_factors(const u32 req_freq, const u32 tclk, u32 *best_n,
560 return true; 560 return true;
561} 561}
562 562
563static int __devinit 563static int
564mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data, 564mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data,
565 struct device_node *np) 565 struct device_node *np)
566{ 566{
@@ -597,7 +597,7 @@ out:
597#endif 597#endif
598} 598}
599#else /* CONFIG_OF */ 599#else /* CONFIG_OF */
600static int __devinit 600static int
601mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data, 601mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data,
602 struct device_node *np) 602 struct device_node *np)
603{ 603{
@@ -605,7 +605,7 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data,
605} 605}
606#endif /* CONFIG_OF */ 606#endif /* CONFIG_OF */
607 607
608static int __devinit 608static int
609mv64xxx_i2c_probe(struct platform_device *pd) 609mv64xxx_i2c_probe(struct platform_device *pd)
610{ 610{
611 struct mv64xxx_i2c_data *drv_data; 611 struct mv64xxx_i2c_data *drv_data;
@@ -697,7 +697,7 @@ mv64xxx_i2c_probe(struct platform_device *pd)
697 return rc; 697 return rc;
698} 698}
699 699
700static int __devexit 700static int
701mv64xxx_i2c_remove(struct platform_device *dev) 701mv64xxx_i2c_remove(struct platform_device *dev)
702{ 702{
703 struct mv64xxx_i2c_data *drv_data = platform_get_drvdata(dev); 703 struct mv64xxx_i2c_data *drv_data = platform_get_drvdata(dev);
@@ -718,7 +718,7 @@ mv64xxx_i2c_remove(struct platform_device *dev)
718 return rc; 718 return rc;
719} 719}
720 720
721static const struct of_device_id mv64xxx_i2c_of_match_table[] __devinitdata = { 721static const struct of_device_id mv64xxx_i2c_of_match_table[] = {
722 { .compatible = "marvell,mv64xxx-i2c", }, 722 { .compatible = "marvell,mv64xxx-i2c", },
723 {} 723 {}
724}; 724};
@@ -726,7 +726,7 @@ MODULE_DEVICE_TABLE(of, mv64xxx_i2c_of_match_table);
726 726
727static struct platform_driver mv64xxx_i2c_driver = { 727static struct platform_driver mv64xxx_i2c_driver = {
728 .probe = mv64xxx_i2c_probe, 728 .probe = mv64xxx_i2c_probe,
729 .remove = __devexit_p(mv64xxx_i2c_remove), 729 .remove = mv64xxx_i2c_remove,
730 .driver = { 730 .driver = {
731 .owner = THIS_MODULE, 731 .owner = THIS_MODULE,
732 .name = MV64XXX_I2C_CTLR_NAME, 732 .name = MV64XXX_I2C_CTLR_NAME,
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
index 6ed53da9e1f4..d6abaf2cf2e3 100644
--- a/drivers/i2c/busses/i2c-mxs.c
+++ b/drivers/i2c/busses/i2c-mxs.c
@@ -127,7 +127,7 @@ struct mxs_i2c_dev {
127 struct device *dev; 127 struct device *dev;
128 void __iomem *regs; 128 void __iomem *regs;
129 struct completion cmd_complete; 129 struct completion cmd_complete;
130 u32 cmd_err; 130 int cmd_err;
131 struct i2c_adapter adapter; 131 struct i2c_adapter adapter;
132 const struct mxs_i2c_speed_config *speed; 132 const struct mxs_i2c_speed_config *speed;
133 133
@@ -316,7 +316,7 @@ static int mxs_i2c_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg,
316 if (msg->len == 0) 316 if (msg->len == 0)
317 return -EINVAL; 317 return -EINVAL;
318 318
319 init_completion(&i2c->cmd_complete); 319 INIT_COMPLETION(i2c->cmd_complete);
320 i2c->cmd_err = 0; 320 i2c->cmd_err = 0;
321 321
322 ret = mxs_i2c_dma_setup_xfer(adap, msg, flags); 322 ret = mxs_i2c_dma_setup_xfer(adap, msg, flags);
@@ -432,7 +432,7 @@ static int mxs_i2c_get_ofdata(struct mxs_i2c_dev *i2c)
432 return 0; 432 return 0;
433} 433}
434 434
435static int __devinit mxs_i2c_probe(struct platform_device *pdev) 435static int mxs_i2c_probe(struct platform_device *pdev)
436{ 436{
437 struct device *dev = &pdev->dev; 437 struct device *dev = &pdev->dev;
438 struct mxs_i2c_dev *i2c; 438 struct mxs_i2c_dev *i2c;
@@ -473,6 +473,8 @@ static int __devinit mxs_i2c_probe(struct platform_device *pdev)
473 i2c->dev = dev; 473 i2c->dev = dev;
474 i2c->speed = &mxs_i2c_95kHz_config; 474 i2c->speed = &mxs_i2c_95kHz_config;
475 475
476 init_completion(&i2c->cmd_complete);
477
476 if (dev->of_node) { 478 if (dev->of_node) {
477 err = mxs_i2c_get_ofdata(i2c); 479 err = mxs_i2c_get_ofdata(i2c);
478 if (err) 480 if (err)
@@ -515,7 +517,7 @@ static int __devinit mxs_i2c_probe(struct platform_device *pdev)
515 return 0; 517 return 0;
516} 518}
517 519
518static int __devexit mxs_i2c_remove(struct platform_device *pdev) 520static int mxs_i2c_remove(struct platform_device *pdev)
519{ 521{
520 struct mxs_i2c_dev *i2c = platform_get_drvdata(pdev); 522 struct mxs_i2c_dev *i2c = platform_get_drvdata(pdev);
521 int ret; 523 int ret;
@@ -546,7 +548,7 @@ static struct platform_driver mxs_i2c_driver = {
546 .owner = THIS_MODULE, 548 .owner = THIS_MODULE,
547 .of_match_table = mxs_i2c_dt_ids, 549 .of_match_table = mxs_i2c_dt_ids,
548 }, 550 },
549 .remove = __devexit_p(mxs_i2c_remove), 551 .remove = mxs_i2c_remove,
550}; 552};
551 553
552static int __init mxs_i2c_init(void) 554static int __init mxs_i2c_init(void)
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c
index 392303b4be07..adac8542771d 100644
--- a/drivers/i2c/busses/i2c-nforce2.c
+++ b/drivers/i2c/busses/i2c-nforce2.c
@@ -117,7 +117,7 @@ struct nforce2_smbus {
117#define MAX_TIMEOUT 100 117#define MAX_TIMEOUT 100
118 118
119/* We disable the second SMBus channel on these boards */ 119/* We disable the second SMBus channel on these boards */
120static struct dmi_system_id __devinitdata nforce2_dmi_blacklist2[] = { 120static const struct dmi_system_id nforce2_dmi_blacklist2[] = {
121 { 121 {
122 .ident = "DFI Lanparty NF4 Expert", 122 .ident = "DFI Lanparty NF4 Expert",
123 .matches = { 123 .matches = {
@@ -330,8 +330,8 @@ static DEFINE_PCI_DEVICE_TABLE(nforce2_ids) = {
330MODULE_DEVICE_TABLE (pci, nforce2_ids); 330MODULE_DEVICE_TABLE (pci, nforce2_ids);
331 331
332 332
333static int __devinit nforce2_probe_smb (struct pci_dev *dev, int bar, 333static int nforce2_probe_smb(struct pci_dev *dev, int bar, int alt_reg,
334 int alt_reg, struct nforce2_smbus *smbus, const char *name) 334 struct nforce2_smbus *smbus, const char *name)
335{ 335{
336 int error; 336 int error;
337 337
@@ -382,7 +382,7 @@ static int __devinit nforce2_probe_smb (struct pci_dev *dev, int bar,
382} 382}
383 383
384 384
385static int __devinit nforce2_probe(struct pci_dev *dev, const struct pci_device_id *id) 385static int nforce2_probe(struct pci_dev *dev, const struct pci_device_id *id)
386{ 386{
387 struct nforce2_smbus *smbuses; 387 struct nforce2_smbus *smbuses;
388 int res1, res2; 388 int res1, res2;
@@ -430,7 +430,7 @@ static int __devinit nforce2_probe(struct pci_dev *dev, const struct pci_device_
430} 430}
431 431
432 432
433static void __devexit nforce2_remove(struct pci_dev *dev) 433static void nforce2_remove(struct pci_dev *dev)
434{ 434{
435 struct nforce2_smbus *smbuses = pci_get_drvdata(dev); 435 struct nforce2_smbus *smbuses = pci_get_drvdata(dev);
436 436
@@ -450,7 +450,7 @@ static struct pci_driver nforce2_driver = {
450 .name = "nForce2_smbus", 450 .name = "nForce2_smbus",
451 .id_table = nforce2_ids, 451 .id_table = nforce2_ids,
452 .probe = nforce2_probe, 452 .probe = nforce2_probe,
453 .remove = __devexit_p(nforce2_remove), 453 .remove = nforce2_remove,
454}; 454};
455 455
456module_pci_driver(nforce2_driver); 456module_pci_driver(nforce2_driver);
diff --git a/drivers/i2c/busses/i2c-nuc900.c b/drivers/i2c/busses/i2c-nuc900.c
index a23b91b0b738..865ee350adb3 100644
--- a/drivers/i2c/busses/i2c-nuc900.c
+++ b/drivers/i2c/busses/i2c-nuc900.c
@@ -518,7 +518,7 @@ static const struct i2c_algorithm nuc900_i2c_algorithm = {
518 * called by the bus driver when a suitable device is found 518 * called by the bus driver when a suitable device is found
519*/ 519*/
520 520
521static int __devinit nuc900_i2c_probe(struct platform_device *pdev) 521static int nuc900_i2c_probe(struct platform_device *pdev)
522{ 522{
523 struct nuc900_i2c *i2c; 523 struct nuc900_i2c *i2c;
524 struct nuc900_platform_i2c *pdata; 524 struct nuc900_platform_i2c *pdata;
@@ -663,7 +663,7 @@ static int __devinit nuc900_i2c_probe(struct platform_device *pdev)
663 * called when device is removed from the bus 663 * called when device is removed from the bus
664*/ 664*/
665 665
666static int __devexit nuc900_i2c_remove(struct platform_device *pdev) 666static int nuc900_i2c_remove(struct platform_device *pdev)
667{ 667{
668 struct nuc900_i2c *i2c = platform_get_drvdata(pdev); 668 struct nuc900_i2c *i2c = platform_get_drvdata(pdev);
669 669
@@ -684,7 +684,7 @@ static int __devexit nuc900_i2c_remove(struct platform_device *pdev)
684 684
685static struct platform_driver nuc900_i2c_driver = { 685static struct platform_driver nuc900_i2c_driver = {
686 .probe = nuc900_i2c_probe, 686 .probe = nuc900_i2c_probe,
687 .remove = __devexit_p(nuc900_i2c_remove), 687 .remove = nuc900_i2c_remove,
688 .driver = { 688 .driver = {
689 .owner = THIS_MODULE, 689 .owner = THIS_MODULE,
690 .name = "nuc900-i2c0", 690 .name = "nuc900-i2c0",
diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
index 9b35c9fbb2fe..a873d0ad1acb 100644
--- a/drivers/i2c/busses/i2c-ocores.c
+++ b/drivers/i2c/busses/i2c-ocores.c
@@ -343,7 +343,7 @@ static int ocores_i2c_of_probe(struct platform_device *pdev,
343#define ocores_i2c_of_probe(pdev,i2c) -ENODEV 343#define ocores_i2c_of_probe(pdev,i2c) -ENODEV
344#endif 344#endif
345 345
346static int __devinit ocores_i2c_probe(struct platform_device *pdev) 346static int ocores_i2c_probe(struct platform_device *pdev)
347{ 347{
348 struct ocores_i2c *i2c; 348 struct ocores_i2c *i2c;
349 struct ocores_i2c_platform_data *pdata; 349 struct ocores_i2c_platform_data *pdata;
@@ -441,7 +441,7 @@ static int __devinit ocores_i2c_probe(struct platform_device *pdev)
441 return 0; 441 return 0;
442} 442}
443 443
444static int __devexit ocores_i2c_remove(struct platform_device *pdev) 444static int ocores_i2c_remove(struct platform_device *pdev)
445{ 445{
446 struct ocores_i2c *i2c = platform_get_drvdata(pdev); 446 struct ocores_i2c *i2c = platform_get_drvdata(pdev);
447 447
@@ -485,7 +485,7 @@ static SIMPLE_DEV_PM_OPS(ocores_i2c_pm, ocores_i2c_suspend, ocores_i2c_resume);
485 485
486static struct platform_driver ocores_i2c_driver = { 486static struct platform_driver ocores_i2c_driver = {
487 .probe = ocores_i2c_probe, 487 .probe = ocores_i2c_probe,
488 .remove = __devexit_p(ocores_i2c_remove), 488 .remove = ocores_i2c_remove,
489 .driver = { 489 .driver = {
490 .owner = THIS_MODULE, 490 .owner = THIS_MODULE,
491 .name = "ocores-i2c", 491 .name = "ocores-i2c",
diff --git a/drivers/i2c/busses/i2c-octeon.c b/drivers/i2c/busses/i2c-octeon.c
index f44c83549fe5..484ca771fdff 100644
--- a/drivers/i2c/busses/i2c-octeon.c
+++ b/drivers/i2c/busses/i2c-octeon.c
@@ -446,7 +446,7 @@ static struct i2c_adapter octeon_i2c_ops = {
446/** 446/**
447 * octeon_i2c_setclock - Calculate and set clock divisors. 447 * octeon_i2c_setclock - Calculate and set clock divisors.
448 */ 448 */
449static int __devinit octeon_i2c_setclock(struct octeon_i2c *i2c) 449static int octeon_i2c_setclock(struct octeon_i2c *i2c)
450{ 450{
451 int tclk, thp_base, inc, thp_idx, mdiv_idx, ndiv_idx, foscl, diff; 451 int tclk, thp_base, inc, thp_idx, mdiv_idx, ndiv_idx, foscl, diff;
452 int thp = 0x18, mdiv = 2, ndiv = 0, delta_hz = 1000000; 452 int thp = 0x18, mdiv = 2, ndiv = 0, delta_hz = 1000000;
@@ -489,7 +489,7 @@ static int __devinit octeon_i2c_setclock(struct octeon_i2c *i2c)
489 return 0; 489 return 0;
490} 490}
491 491
492static int __devinit octeon_i2c_initlowlevel(struct octeon_i2c *i2c) 492static int octeon_i2c_initlowlevel(struct octeon_i2c *i2c)
493{ 493{
494 u8 status; 494 u8 status;
495 int tries; 495 int tries;
@@ -510,7 +510,7 @@ static int __devinit octeon_i2c_initlowlevel(struct octeon_i2c *i2c)
510 return -EIO; 510 return -EIO;
511} 511}
512 512
513static int __devinit octeon_i2c_probe(struct platform_device *pdev) 513static int octeon_i2c_probe(struct platform_device *pdev)
514{ 514{
515 int irq, result = 0; 515 int irq, result = 0;
516 struct octeon_i2c *i2c; 516 struct octeon_i2c *i2c;
@@ -609,7 +609,7 @@ out:
609 return result; 609 return result;
610}; 610};
611 611
612static int __devexit octeon_i2c_remove(struct platform_device *pdev) 612static int octeon_i2c_remove(struct platform_device *pdev)
613{ 613{
614 struct octeon_i2c *i2c = platform_get_drvdata(pdev); 614 struct octeon_i2c *i2c = platform_get_drvdata(pdev);
615 615
@@ -628,7 +628,7 @@ MODULE_DEVICE_TABLE(of, octeon_i2c_match);
628 628
629static struct platform_driver octeon_i2c_driver = { 629static struct platform_driver octeon_i2c_driver = {
630 .probe = octeon_i2c_probe, 630 .probe = octeon_i2c_probe,
631 .remove = __devexit_p(octeon_i2c_remove), 631 .remove = octeon_i2c_remove,
632 .driver = { 632 .driver = {
633 .owner = THIS_MODULE, 633 .owner = THIS_MODULE,
634 .name = DRV_NAME, 634 .name = DRV_NAME,
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 7a62acb7d262..4cc2f0528c88 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -803,7 +803,7 @@ static int errata_omap3_i462(struct omap_i2c_dev *dev)
803 if (stat & OMAP_I2C_STAT_AL) { 803 if (stat & OMAP_I2C_STAT_AL) {
804 dev_err(dev->dev, "Arbitration lost\n"); 804 dev_err(dev->dev, "Arbitration lost\n");
805 dev->cmd_err |= OMAP_I2C_STAT_AL; 805 dev->cmd_err |= OMAP_I2C_STAT_AL;
806 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_NACK); 806 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_AL);
807 } 807 }
808 808
809 return -EIO; 809 return -EIO;
@@ -963,7 +963,7 @@ omap_i2c_isr_thread(int this_irq, void *dev_id)
963 i2c_omap_errata_i207(dev, stat); 963 i2c_omap_errata_i207(dev, stat);
964 964
965 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_RDR); 965 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_RDR);
966 break; 966 continue;
967 } 967 }
968 968
969 if (stat & OMAP_I2C_STAT_RRDY) { 969 if (stat & OMAP_I2C_STAT_RRDY) {
@@ -989,7 +989,7 @@ omap_i2c_isr_thread(int this_irq, void *dev_id)
989 break; 989 break;
990 990
991 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_XDR); 991 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_XDR);
992 break; 992 continue;
993 } 993 }
994 994
995 if (stat & OMAP_I2C_STAT_XRDY) { 995 if (stat & OMAP_I2C_STAT_XRDY) {
@@ -1069,7 +1069,7 @@ MODULE_DEVICE_TABLE(of, omap_i2c_of_match);
1069#define OMAP_I2C_SCHEME_0 0 1069#define OMAP_I2C_SCHEME_0 0
1070#define OMAP_I2C_SCHEME_1 1 1070#define OMAP_I2C_SCHEME_1 1
1071 1071
1072static int __devinit 1072static int
1073omap_i2c_probe(struct platform_device *pdev) 1073omap_i2c_probe(struct platform_device *pdev)
1074{ 1074{
1075 struct omap_i2c_dev *dev; 1075 struct omap_i2c_dev *dev;
@@ -1267,7 +1267,7 @@ err_free_mem:
1267 return r; 1267 return r;
1268} 1268}
1269 1269
1270static int __devexit omap_i2c_remove(struct platform_device *pdev) 1270static int omap_i2c_remove(struct platform_device *pdev)
1271{ 1271{
1272 struct omap_i2c_dev *dev = platform_get_drvdata(pdev); 1272 struct omap_i2c_dev *dev = platform_get_drvdata(pdev);
1273 int ret; 1273 int ret;
@@ -1333,7 +1333,7 @@ static struct dev_pm_ops omap_i2c_pm_ops = {
1333 1333
1334static struct platform_driver omap_i2c_driver = { 1334static struct platform_driver omap_i2c_driver = {
1335 .probe = omap_i2c_probe, 1335 .probe = omap_i2c_probe,
1336 .remove = __devexit_p(omap_i2c_remove), 1336 .remove = omap_i2c_remove,
1337 .driver = { 1337 .driver = {
1338 .name = "omap_i2c", 1338 .name = "omap_i2c",
1339 .owner = THIS_MODULE, 1339 .owner = THIS_MODULE,
diff --git a/drivers/i2c/busses/i2c-parport-light.c b/drivers/i2c/busses/i2c-parport-light.c
index 4b95f7a63a3b..aa9577881925 100644
--- a/drivers/i2c/busses/i2c-parport-light.c
+++ b/drivers/i2c/busses/i2c-parport-light.c
@@ -135,7 +135,7 @@ static struct lineop parport_ctrl_irq = {
135 .port = PORT_CTRL, 135 .port = PORT_CTRL,
136}; 136};
137 137
138static int __devinit i2c_parport_probe(struct platform_device *pdev) 138static int i2c_parport_probe(struct platform_device *pdev)
139{ 139{
140 int err; 140 int err;
141 141
@@ -169,7 +169,7 @@ static int __devinit i2c_parport_probe(struct platform_device *pdev)
169 return 0; 169 return 0;
170} 170}
171 171
172static int __devexit i2c_parport_remove(struct platform_device *pdev) 172static int i2c_parport_remove(struct platform_device *pdev)
173{ 173{
174 if (ara) { 174 if (ara) {
175 line_set(0, &parport_ctrl_irq); 175 line_set(0, &parport_ctrl_irq);
@@ -191,7 +191,7 @@ static struct platform_driver i2c_parport_driver = {
191 .name = DRVNAME, 191 .name = DRVNAME,
192 }, 192 },
193 .probe = i2c_parport_probe, 193 .probe = i2c_parport_probe,
194 .remove = __devexit_p(i2c_parport_remove), 194 .remove = i2c_parport_remove,
195}; 195};
196 196
197static int __init i2c_parport_device_add(u16 address) 197static int __init i2c_parport_device_add(u16 address)
diff --git a/drivers/i2c/busses/i2c-pasemi.c b/drivers/i2c/busses/i2c-pasemi.c
index 12edefd4183a..615f632c846f 100644
--- a/drivers/i2c/busses/i2c-pasemi.c
+++ b/drivers/i2c/busses/i2c-pasemi.c
@@ -340,7 +340,7 @@ static const struct i2c_algorithm smbus_algorithm = {
340 .functionality = pasemi_smb_func, 340 .functionality = pasemi_smb_func,
341}; 341};
342 342
343static int __devinit pasemi_smb_probe(struct pci_dev *dev, 343static int pasemi_smb_probe(struct pci_dev *dev,
344 const struct pci_device_id *id) 344 const struct pci_device_id *id)
345{ 345{
346 struct pasemi_smbus *smbus; 346 struct pasemi_smbus *smbus;
@@ -392,7 +392,7 @@ static int __devinit pasemi_smb_probe(struct pci_dev *dev,
392 return error; 392 return error;
393} 393}
394 394
395static void __devexit pasemi_smb_remove(struct pci_dev *dev) 395static void pasemi_smb_remove(struct pci_dev *dev)
396{ 396{
397 struct pasemi_smbus *smbus = pci_get_drvdata(dev); 397 struct pasemi_smbus *smbus = pci_get_drvdata(dev);
398 398
@@ -412,7 +412,7 @@ static struct pci_driver pasemi_smb_driver = {
412 .name = "i2c-pasemi", 412 .name = "i2c-pasemi",
413 .id_table = pasemi_smb_ids, 413 .id_table = pasemi_smb_ids,
414 .probe = pasemi_smb_probe, 414 .probe = pasemi_smb_probe,
415 .remove = __devexit_p(pasemi_smb_remove), 415 .remove = pasemi_smb_remove,
416}; 416};
417 417
418module_pci_driver(pasemi_smb_driver); 418module_pci_driver(pasemi_smb_driver);
diff --git a/drivers/i2c/busses/i2c-pca-isa.c b/drivers/i2c/busses/i2c-pca-isa.c
index 29933f87d8fa..323f061a3163 100644
--- a/drivers/i2c/busses/i2c-pca-isa.c
+++ b/drivers/i2c/busses/i2c-pca-isa.c
@@ -119,7 +119,7 @@ static struct i2c_adapter pca_isa_ops = {
119 .timeout = HZ, 119 .timeout = HZ,
120}; 120};
121 121
122static int __devinit pca_isa_match(struct device *dev, unsigned int id) 122static int pca_isa_match(struct device *dev, unsigned int id)
123{ 123{
124 int match = base != 0; 124 int match = base != 0;
125 125
@@ -132,7 +132,7 @@ static int __devinit pca_isa_match(struct device *dev, unsigned int id)
132 return match; 132 return match;
133} 133}
134 134
135static int __devinit pca_isa_probe(struct device *dev, unsigned int id) 135static int pca_isa_probe(struct device *dev, unsigned int id)
136{ 136{
137 init_waitqueue_head(&pca_wait); 137 init_waitqueue_head(&pca_wait);
138 138
@@ -174,7 +174,7 @@ static int __devinit pca_isa_probe(struct device *dev, unsigned int id)
174 return -ENODEV; 174 return -ENODEV;
175} 175}
176 176
177static int __devexit pca_isa_remove(struct device *dev, unsigned int id) 177static int pca_isa_remove(struct device *dev, unsigned int id)
178{ 178{
179 i2c_del_adapter(&pca_isa_ops); 179 i2c_del_adapter(&pca_isa_ops);
180 180
@@ -190,7 +190,7 @@ static int __devexit pca_isa_remove(struct device *dev, unsigned int id)
190static struct isa_driver pca_isa_driver = { 190static struct isa_driver pca_isa_driver = {
191 .match = pca_isa_match, 191 .match = pca_isa_match,
192 .probe = pca_isa_probe, 192 .probe = pca_isa_probe,
193 .remove = __devexit_p(pca_isa_remove), 193 .remove = pca_isa_remove,
194 .driver = { 194 .driver = {
195 .owner = THIS_MODULE, 195 .owner = THIS_MODULE,
196 .name = DRIVER, 196 .name = DRIVER,
diff --git a/drivers/i2c/busses/i2c-pca-platform.c b/drivers/i2c/busses/i2c-pca-platform.c
index 675878f49f76..a30d2f613c03 100644
--- a/drivers/i2c/busses/i2c-pca-platform.c
+++ b/drivers/i2c/busses/i2c-pca-platform.c
@@ -131,7 +131,7 @@ static irqreturn_t i2c_pca_pf_handler(int this_irq, void *dev_id)
131} 131}
132 132
133 133
134static int __devinit i2c_pca_pf_probe(struct platform_device *pdev) 134static int i2c_pca_pf_probe(struct platform_device *pdev)
135{ 135{
136 struct i2c_pca_pf_data *i2c; 136 struct i2c_pca_pf_data *i2c;
137 struct resource *res; 137 struct resource *res;
@@ -257,7 +257,7 @@ e_print:
257 return ret; 257 return ret;
258} 258}
259 259
260static int __devexit i2c_pca_pf_remove(struct platform_device *pdev) 260static int i2c_pca_pf_remove(struct platform_device *pdev)
261{ 261{
262 struct i2c_pca_pf_data *i2c = platform_get_drvdata(pdev); 262 struct i2c_pca_pf_data *i2c = platform_get_drvdata(pdev);
263 platform_set_drvdata(pdev, NULL); 263 platform_set_drvdata(pdev, NULL);
@@ -279,7 +279,7 @@ static int __devexit i2c_pca_pf_remove(struct platform_device *pdev)
279 279
280static struct platform_driver i2c_pca_pf_driver = { 280static struct platform_driver i2c_pca_pf_driver = {
281 .probe = i2c_pca_pf_probe, 281 .probe = i2c_pca_pf_probe,
282 .remove = __devexit_p(i2c_pca_pf_remove), 282 .remove = i2c_pca_pf_remove,
283 .driver = { 283 .driver = {
284 .name = "i2c-pca-platform", 284 .name = "i2c-pca-platform",
285 .owner = THIS_MODULE, 285 .owner = THIS_MODULE,
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
index f7216ed2f3a9..39ab78c1a02c 100644
--- a/drivers/i2c/busses/i2c-piix4.c
+++ b/drivers/i2c/busses/i2c-piix4.c
@@ -99,7 +99,7 @@ MODULE_PARM_DESC(force_addr,
99static int srvrworks_csb5_delay; 99static int srvrworks_csb5_delay;
100static struct pci_driver piix4_driver; 100static struct pci_driver piix4_driver;
101 101
102static struct dmi_system_id __devinitdata piix4_dmi_blacklist[] = { 102static const struct dmi_system_id piix4_dmi_blacklist[] = {
103 { 103 {
104 .ident = "Sapphire AM2RD790", 104 .ident = "Sapphire AM2RD790",
105 .matches = { 105 .matches = {
@@ -119,7 +119,7 @@ static struct dmi_system_id __devinitdata piix4_dmi_blacklist[] = {
119 119
120/* The IBM entry is in a separate table because we only check it 120/* The IBM entry is in a separate table because we only check it
121 on Intel-based systems */ 121 on Intel-based systems */
122static struct dmi_system_id __devinitdata piix4_dmi_ibm[] = { 122static const struct dmi_system_id piix4_dmi_ibm[] = {
123 { 123 {
124 .ident = "IBM", 124 .ident = "IBM",
125 .matches = { DMI_MATCH(DMI_SYS_VENDOR, "IBM"), }, 125 .matches = { DMI_MATCH(DMI_SYS_VENDOR, "IBM"), },
@@ -131,8 +131,8 @@ struct i2c_piix4_adapdata {
131 unsigned short smba; 131 unsigned short smba;
132}; 132};
133 133
134static int __devinit piix4_setup(struct pci_dev *PIIX4_dev, 134static int piix4_setup(struct pci_dev *PIIX4_dev,
135 const struct pci_device_id *id) 135 const struct pci_device_id *id)
136{ 136{
137 unsigned char temp; 137 unsigned char temp;
138 unsigned short piix4_smba; 138 unsigned short piix4_smba;
@@ -230,8 +230,8 @@ static int __devinit piix4_setup(struct pci_dev *PIIX4_dev,
230 return piix4_smba; 230 return piix4_smba;
231} 231}
232 232
233static int __devinit piix4_setup_sb800(struct pci_dev *PIIX4_dev, 233static int piix4_setup_sb800(struct pci_dev *PIIX4_dev,
234 const struct pci_device_id *id) 234 const struct pci_device_id *id)
235{ 235{
236 unsigned short piix4_smba; 236 unsigned short piix4_smba;
237 unsigned short smba_idx = 0xcd6; 237 unsigned short smba_idx = 0xcd6;
@@ -294,9 +294,9 @@ static int __devinit piix4_setup_sb800(struct pci_dev *PIIX4_dev,
294 return piix4_smba; 294 return piix4_smba;
295} 295}
296 296
297static int __devinit piix4_setup_aux(struct pci_dev *PIIX4_dev, 297static int piix4_setup_aux(struct pci_dev *PIIX4_dev,
298 const struct pci_device_id *id, 298 const struct pci_device_id *id,
299 unsigned short base_reg_addr) 299 unsigned short base_reg_addr)
300{ 300{
301 /* Set up auxiliary SMBus controllers found on some 301 /* Set up auxiliary SMBus controllers found on some
302 * AMD chipsets e.g. SP5100 (SB700 derivative) */ 302 * AMD chipsets e.g. SP5100 (SB700 derivative) */
@@ -540,9 +540,8 @@ MODULE_DEVICE_TABLE (pci, piix4_ids);
540static struct i2c_adapter *piix4_main_adapter; 540static struct i2c_adapter *piix4_main_adapter;
541static struct i2c_adapter *piix4_aux_adapter; 541static struct i2c_adapter *piix4_aux_adapter;
542 542
543static int __devinit piix4_add_adapter(struct pci_dev *dev, 543static int piix4_add_adapter(struct pci_dev *dev, unsigned short smba,
544 unsigned short smba, 544 struct i2c_adapter **padap)
545 struct i2c_adapter **padap)
546{ 545{
547 struct i2c_adapter *adap; 546 struct i2c_adapter *adap;
548 struct i2c_piix4_adapdata *adapdata; 547 struct i2c_piix4_adapdata *adapdata;
@@ -588,8 +587,7 @@ static int __devinit piix4_add_adapter(struct pci_dev *dev,
588 return 0; 587 return 0;
589} 588}
590 589
591static int __devinit piix4_probe(struct pci_dev *dev, 590static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id)
592 const struct pci_device_id *id)
593{ 591{
594 int retval; 592 int retval;
595 593
@@ -626,7 +624,7 @@ static int __devinit piix4_probe(struct pci_dev *dev,
626 return 0; 624 return 0;
627} 625}
628 626
629static void __devexit piix4_adap_remove(struct i2c_adapter *adap) 627static void piix4_adap_remove(struct i2c_adapter *adap)
630{ 628{
631 struct i2c_piix4_adapdata *adapdata = i2c_get_adapdata(adap); 629 struct i2c_piix4_adapdata *adapdata = i2c_get_adapdata(adap);
632 630
@@ -638,7 +636,7 @@ static void __devexit piix4_adap_remove(struct i2c_adapter *adap)
638 } 636 }
639} 637}
640 638
641static void __devexit piix4_remove(struct pci_dev *dev) 639static void piix4_remove(struct pci_dev *dev)
642{ 640{
643 if (piix4_main_adapter) { 641 if (piix4_main_adapter) {
644 piix4_adap_remove(piix4_main_adapter); 642 piix4_adap_remove(piix4_main_adapter);
@@ -655,7 +653,7 @@ static struct pci_driver piix4_driver = {
655 .name = "piix4_smbus", 653 .name = "piix4_smbus",
656 .id_table = piix4_ids, 654 .id_table = piix4_ids,
657 .probe = piix4_probe, 655 .probe = piix4_probe,
658 .remove = __devexit_p(piix4_remove), 656 .remove = piix4_remove,
659}; 657};
660 658
661module_pci_driver(piix4_driver); 659module_pci_driver(piix4_driver);
diff --git a/drivers/i2c/busses/i2c-pmcmsp.c b/drivers/i2c/busses/i2c-pmcmsp.c
index 3d71395ae1f7..083d68cfaf0b 100644
--- a/drivers/i2c/busses/i2c-pmcmsp.c
+++ b/drivers/i2c/busses/i2c-pmcmsp.c
@@ -270,7 +270,7 @@ static irqreturn_t pmcmsptwi_interrupt(int irq, void *ptr)
270/* 270/*
271 * Probe for and register the device and return 0 if there is one. 271 * Probe for and register the device and return 0 if there is one.
272 */ 272 */
273static int __devinit pmcmsptwi_probe(struct platform_device *pldev) 273static int pmcmsptwi_probe(struct platform_device *pldev)
274{ 274{
275 struct resource *res; 275 struct resource *res;
276 int rc = -ENODEV; 276 int rc = -ENODEV;
@@ -368,7 +368,7 @@ ret_err:
368/* 368/*
369 * Release the device and return 0 if there is one. 369 * Release the device and return 0 if there is one.
370 */ 370 */
371static int __devexit pmcmsptwi_remove(struct platform_device *pldev) 371static int pmcmsptwi_remove(struct platform_device *pldev)
372{ 372{
373 struct resource *res; 373 struct resource *res;
374 374
@@ -628,7 +628,7 @@ static struct i2c_adapter pmcmsptwi_adapter = {
628 628
629static struct platform_driver pmcmsptwi_driver = { 629static struct platform_driver pmcmsptwi_driver = {
630 .probe = pmcmsptwi_probe, 630 .probe = pmcmsptwi_probe,
631 .remove = __devexit_p(pmcmsptwi_remove), 631 .remove = pmcmsptwi_remove,
632 .driver = { 632 .driver = {
633 .name = DRV_NAME, 633 .name = DRV_NAME,
634 .owner = THIS_MODULE, 634 .owner = THIS_MODULE,
diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
index 8488bddfe465..ce4097012e97 100644
--- a/drivers/i2c/busses/i2c-pnx.c
+++ b/drivers/i2c/busses/i2c-pnx.c
@@ -619,7 +619,7 @@ static SIMPLE_DEV_PM_OPS(i2c_pnx_pm,
619#define PNX_I2C_PM NULL 619#define PNX_I2C_PM NULL
620#endif 620#endif
621 621
622static int __devinit i2c_pnx_probe(struct platform_device *pdev) 622static int i2c_pnx_probe(struct platform_device *pdev)
623{ 623{
624 unsigned long tmp; 624 unsigned long tmp;
625 int ret = 0; 625 int ret = 0;
@@ -765,7 +765,7 @@ err_kzalloc:
765 return ret; 765 return ret;
766} 766}
767 767
768static int __devexit i2c_pnx_remove(struct platform_device *pdev) 768static int i2c_pnx_remove(struct platform_device *pdev)
769{ 769{
770 struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev); 770 struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev);
771 771
@@ -797,7 +797,7 @@ static struct platform_driver i2c_pnx_driver = {
797 .pm = PNX_I2C_PM, 797 .pm = PNX_I2C_PM,
798 }, 798 },
799 .probe = i2c_pnx_probe, 799 .probe = i2c_pnx_probe,
800 .remove = __devexit_p(i2c_pnx_remove), 800 .remove = i2c_pnx_remove,
801}; 801};
802 802
803static int __init i2c_adap_pnx_init(void) 803static int __init i2c_adap_pnx_init(void)
diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c
index 5285f8565de4..0dd5b334d090 100644
--- a/drivers/i2c/busses/i2c-powermac.c
+++ b/drivers/i2c/busses/i2c-powermac.c
@@ -210,7 +210,7 @@ static const struct i2c_algorithm i2c_powermac_algorithm = {
210}; 210};
211 211
212 212
213static int __devexit i2c_powermac_remove(struct platform_device *dev) 213static int i2c_powermac_remove(struct platform_device *dev)
214{ 214{
215 struct i2c_adapter *adapter = platform_get_drvdata(dev); 215 struct i2c_adapter *adapter = platform_get_drvdata(dev);
216 int rc; 216 int rc;
@@ -227,7 +227,7 @@ static int __devexit i2c_powermac_remove(struct platform_device *dev)
227 return 0; 227 return 0;
228} 228}
229 229
230static u32 __devinit i2c_powermac_get_addr(struct i2c_adapter *adap, 230static u32 i2c_powermac_get_addr(struct i2c_adapter *adap,
231 struct pmac_i2c_bus *bus, 231 struct pmac_i2c_bus *bus,
232 struct device_node *node) 232 struct device_node *node)
233{ 233{
@@ -255,7 +255,7 @@ static u32 __devinit i2c_powermac_get_addr(struct i2c_adapter *adap,
255 return 0xffffffff; 255 return 0xffffffff;
256} 256}
257 257
258static void __devinit i2c_powermac_create_one(struct i2c_adapter *adap, 258static void i2c_powermac_create_one(struct i2c_adapter *adap,
259 const char *type, 259 const char *type,
260 u32 addr) 260 u32 addr)
261{ 261{
@@ -271,7 +271,7 @@ static void __devinit i2c_powermac_create_one(struct i2c_adapter *adap,
271 type); 271 type);
272} 272}
273 273
274static void __devinit i2c_powermac_add_missing(struct i2c_adapter *adap, 274static void i2c_powermac_add_missing(struct i2c_adapter *adap,
275 struct pmac_i2c_bus *bus, 275 struct pmac_i2c_bus *bus,
276 bool found_onyx) 276 bool found_onyx)
277{ 277{
@@ -297,7 +297,7 @@ static void __devinit i2c_powermac_add_missing(struct i2c_adapter *adap,
297 } 297 }
298} 298}
299 299
300static bool __devinit i2c_powermac_get_type(struct i2c_adapter *adap, 300static bool i2c_powermac_get_type(struct i2c_adapter *adap,
301 struct device_node *node, 301 struct device_node *node,
302 u32 addr, char *type, int type_size) 302 u32 addr, char *type, int type_size)
303{ 303{
@@ -336,7 +336,7 @@ static bool __devinit i2c_powermac_get_type(struct i2c_adapter *adap,
336 return false; 336 return false;
337} 337}
338 338
339static void __devinit i2c_powermac_register_devices(struct i2c_adapter *adap, 339static void i2c_powermac_register_devices(struct i2c_adapter *adap,
340 struct pmac_i2c_bus *bus) 340 struct pmac_i2c_bus *bus)
341{ 341{
342 struct i2c_client *newdev; 342 struct i2c_client *newdev;
@@ -403,7 +403,7 @@ static void __devinit i2c_powermac_register_devices(struct i2c_adapter *adap,
403 i2c_powermac_add_missing(adap, bus, found_onyx); 403 i2c_powermac_add_missing(adap, bus, found_onyx);
404} 404}
405 405
406static int __devinit i2c_powermac_probe(struct platform_device *dev) 406static int i2c_powermac_probe(struct platform_device *dev)
407{ 407{
408 struct pmac_i2c_bus *bus = dev->dev.platform_data; 408 struct pmac_i2c_bus *bus = dev->dev.platform_data;
409 struct device_node *parent = NULL; 409 struct device_node *parent = NULL;
@@ -467,7 +467,7 @@ static int __devinit i2c_powermac_probe(struct platform_device *dev)
467 467
468static struct platform_driver i2c_powermac_driver = { 468static struct platform_driver i2c_powermac_driver = {
469 .probe = i2c_powermac_probe, 469 .probe = i2c_powermac_probe,
470 .remove = __devexit_p(i2c_powermac_remove), 470 .remove = i2c_powermac_remove,
471 .driver = { 471 .driver = {
472 .name = "i2c-powermac", 472 .name = "i2c-powermac",
473 .bus = &platform_bus_type, 473 .bus = &platform_bus_type,
diff --git a/drivers/i2c/busses/i2c-puv3.c b/drivers/i2c/busses/i2c-puv3.c
index d8515be00b98..d7c512d717a7 100644
--- a/drivers/i2c/busses/i2c-puv3.c
+++ b/drivers/i2c/busses/i2c-puv3.c
@@ -184,7 +184,7 @@ static struct i2c_algorithm puv3_i2c_algorithm = {
184/* 184/*
185 * Main initialization routine. 185 * Main initialization routine.
186 */ 186 */
187static int __devinit puv3_i2c_probe(struct platform_device *pdev) 187static int puv3_i2c_probe(struct platform_device *pdev)
188{ 188{
189 struct i2c_adapter *adapter; 189 struct i2c_adapter *adapter;
190 struct resource *mem; 190 struct resource *mem;
@@ -231,7 +231,7 @@ fail_nomem:
231 return rc; 231 return rc;
232} 232}
233 233
234static int __devexit puv3_i2c_remove(struct platform_device *pdev) 234static int puv3_i2c_remove(struct platform_device *pdev)
235{ 235{
236 struct i2c_adapter *adapter = platform_get_drvdata(pdev); 236 struct i2c_adapter *adapter = platform_get_drvdata(pdev);
237 struct resource *mem; 237 struct resource *mem;
@@ -276,7 +276,7 @@ static SIMPLE_DEV_PM_OPS(puv3_i2c_pm, puv3_i2c_suspend, NULL);
276 276
277static struct platform_driver puv3_i2c_driver = { 277static struct platform_driver puv3_i2c_driver = {
278 .probe = puv3_i2c_probe, 278 .probe = puv3_i2c_probe,
279 .remove = __devexit_p(puv3_i2c_remove), 279 .remove = puv3_i2c_remove,
280 .driver = { 280 .driver = {
281 .name = "PKUnity-v3-I2C", 281 .name = "PKUnity-v3-I2C",
282 .owner = THIS_MODULE, 282 .owner = THIS_MODULE,
diff --git a/drivers/i2c/busses/i2c-pxa-pci.c b/drivers/i2c/busses/i2c-pxa-pci.c
index 4dc9bef17d77..3d4985695aed 100644
--- a/drivers/i2c/busses/i2c-pxa-pci.c
+++ b/drivers/i2c/busses/i2c-pxa-pci.c
@@ -94,7 +94,7 @@ out:
94 return ERR_PTR(ret); 94 return ERR_PTR(ret);
95} 95}
96 96
97static int __devinit ce4100_i2c_probe(struct pci_dev *dev, 97static int ce4100_i2c_probe(struct pci_dev *dev,
98 const struct pci_device_id *ent) 98 const struct pci_device_id *ent)
99{ 99{
100 int ret; 100 int ret;
@@ -135,7 +135,7 @@ err_mem:
135 return ret; 135 return ret;
136} 136}
137 137
138static void __devexit ce4100_i2c_remove(struct pci_dev *dev) 138static void ce4100_i2c_remove(struct pci_dev *dev)
139{ 139{
140 struct ce4100_devices *sds; 140 struct ce4100_devices *sds;
141 unsigned int i; 141 unsigned int i;
@@ -160,7 +160,7 @@ static struct pci_driver ce4100_i2c_driver = {
160 .name = "ce4100_i2c", 160 .name = "ce4100_i2c",
161 .id_table = ce4100_i2c_devices, 161 .id_table = ce4100_i2c_devices,
162 .probe = ce4100_i2c_probe, 162 .probe = ce4100_i2c_probe,
163 .remove = __devexit_p(ce4100_i2c_remove), 163 .remove = ce4100_i2c_remove,
164}; 164};
165 165
166module_pci_driver(ce4100_i2c_driver); 166module_pci_driver(ce4100_i2c_driver);
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 72a8071a5556..9bd4d73d29e3 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -613,7 +613,7 @@ static const struct i2c_algorithm rcar_i2c_algo = {
613 .functionality = rcar_i2c_func, 613 .functionality = rcar_i2c_func,
614}; 614};
615 615
616static int __devinit rcar_i2c_probe(struct platform_device *pdev) 616static int rcar_i2c_probe(struct platform_device *pdev)
617{ 617{
618 struct i2c_rcar_platform_data *pdata = pdev->dev.platform_data; 618 struct i2c_rcar_platform_data *pdata = pdev->dev.platform_data;
619 struct rcar_i2c_priv *priv; 619 struct rcar_i2c_priv *priv;
@@ -682,7 +682,7 @@ static int __devinit rcar_i2c_probe(struct platform_device *pdev)
682 return 0; 682 return 0;
683} 683}
684 684
685static int __devexit rcar_i2c_remove(struct platform_device *pdev) 685static int rcar_i2c_remove(struct platform_device *pdev)
686{ 686{
687 struct rcar_i2c_priv *priv = platform_get_drvdata(pdev); 687 struct rcar_i2c_priv *priv = platform_get_drvdata(pdev);
688 struct device *dev = &pdev->dev; 688 struct device *dev = &pdev->dev;
@@ -699,7 +699,7 @@ static struct platform_driver rcar_i2c_driver = {
699 .owner = THIS_MODULE, 699 .owner = THIS_MODULE,
700 }, 700 },
701 .probe = rcar_i2c_probe, 701 .probe = rcar_i2c_probe,
702 .remove = __devexit_p(rcar_i2c_remove), 702 .remove = rcar_i2c_remove,
703}; 703};
704 704
705module_platform_driver(rcar_i2c_driver); 705module_platform_driver(rcar_i2c_driver);
diff --git a/drivers/i2c/busses/i2c-s6000.c b/drivers/i2c/busses/i2c-s6000.c
index b76a29d1f8e4..008836409efe 100644
--- a/drivers/i2c/busses/i2c-s6000.c
+++ b/drivers/i2c/busses/i2c-s6000.c
@@ -248,7 +248,7 @@ static struct i2c_algorithm s6i2c_algorithm = {
248 .functionality = s6i2c_functionality, 248 .functionality = s6i2c_functionality,
249}; 249};
250 250
251static u16 __devinit nanoseconds_on_clk(struct s6i2c_if *iface, u32 ns) 251static u16 nanoseconds_on_clk(struct s6i2c_if *iface, u32 ns)
252{ 252{
253 u32 dividend = ((clk_get_rate(iface->clk) / 1000) * ns) / 1000000; 253 u32 dividend = ((clk_get_rate(iface->clk) / 1000) * ns) / 1000000;
254 if (dividend > 0xffff) 254 if (dividend > 0xffff)
@@ -256,7 +256,7 @@ static u16 __devinit nanoseconds_on_clk(struct s6i2c_if *iface, u32 ns)
256 return dividend; 256 return dividend;
257} 257}
258 258
259static int __devinit s6i2c_probe(struct platform_device *dev) 259static int s6i2c_probe(struct platform_device *dev)
260{ 260{
261 struct s6i2c_if *iface = &s6i2c_if; 261 struct s6i2c_if *iface = &s6i2c_if;
262 struct i2c_adapter *p_adap; 262 struct i2c_adapter *p_adap;
@@ -361,7 +361,7 @@ err_out:
361 return rc; 361 return rc;
362} 362}
363 363
364static int __devexit s6i2c_remove(struct platform_device *pdev) 364static int s6i2c_remove(struct platform_device *pdev)
365{ 365{
366 struct s6i2c_if *iface = platform_get_drvdata(pdev); 366 struct s6i2c_if *iface = platform_get_drvdata(pdev);
367 i2c_wr16(iface, S6_I2C_ENABLE, 0); 367 i2c_wr16(iface, S6_I2C_ENABLE, 0);
@@ -378,7 +378,7 @@ static int __devexit s6i2c_remove(struct platform_device *pdev)
378 378
379static struct platform_driver s6i2c_driver = { 379static struct platform_driver s6i2c_driver = {
380 .probe = s6i2c_probe, 380 .probe = s6i2c_probe,
381 .remove = __devexit_p(s6i2c_remove), 381 .remove = s6i2c_remove,
382 .driver = { 382 .driver = {
383 .name = DRV_NAME, 383 .name = DRV_NAME,
384 .owner = THIS_MODULE, 384 .owner = THIS_MODULE,
diff --git a/drivers/i2c/busses/i2c-sh7760.c b/drivers/i2c/busses/i2c-sh7760.c
index c0c9dffbdb12..3a2253e1bf59 100644
--- a/drivers/i2c/busses/i2c-sh7760.c
+++ b/drivers/i2c/busses/i2c-sh7760.c
@@ -390,7 +390,7 @@ static const struct i2c_algorithm sh7760_i2c_algo = {
390 * iclk = mclk/(CDF + 1). iclk must be < 20MHz. 390 * iclk = mclk/(CDF + 1). iclk must be < 20MHz.
391 * scl = iclk/(SCGD*8 + 20). 391 * scl = iclk/(SCGD*8 + 20).
392 */ 392 */
393static int __devinit calc_CCR(unsigned long scl_hz) 393static int calc_CCR(unsigned long scl_hz)
394{ 394{
395 struct clk *mclk; 395 struct clk *mclk;
396 unsigned long mck, m1, dff, odff, iclk; 396 unsigned long mck, m1, dff, odff, iclk;
@@ -430,7 +430,7 @@ static int __devinit calc_CCR(unsigned long scl_hz)
430 return ((scgdm << 2) | cdfm); 430 return ((scgdm << 2) | cdfm);
431} 431}
432 432
433static int __devinit sh7760_i2c_probe(struct platform_device *pdev) 433static int sh7760_i2c_probe(struct platform_device *pdev)
434{ 434{
435 struct sh7760_i2c_platdata *pd; 435 struct sh7760_i2c_platdata *pd;
436 struct resource *res; 436 struct resource *res;
@@ -536,7 +536,7 @@ out0:
536 return ret; 536 return ret;
537} 537}
538 538
539static int __devexit sh7760_i2c_remove(struct platform_device *pdev) 539static int sh7760_i2c_remove(struct platform_device *pdev)
540{ 540{
541 struct cami2c *id = platform_get_drvdata(pdev); 541 struct cami2c *id = platform_get_drvdata(pdev);
542 542
@@ -557,7 +557,7 @@ static struct platform_driver sh7760_i2c_drv = {
557 .owner = THIS_MODULE, 557 .owner = THIS_MODULE,
558 }, 558 },
559 .probe = sh7760_i2c_probe, 559 .probe = sh7760_i2c_probe,
560 .remove = __devexit_p(sh7760_i2c_remove), 560 .remove = sh7760_i2c_remove,
561}; 561};
562 562
563module_platform_driver(sh7760_i2c_drv); 563module_platform_driver(sh7760_i2c_drv);
diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
index 9411c1b892c0..b6e7a83a8296 100644
--- a/drivers/i2c/busses/i2c-sh_mobile.c
+++ b/drivers/i2c/busses/i2c-sh_mobile.c
@@ -758,7 +758,7 @@ static const struct dev_pm_ops sh_mobile_i2c_dev_pm_ops = {
758 .runtime_resume = sh_mobile_i2c_runtime_nop, 758 .runtime_resume = sh_mobile_i2c_runtime_nop,
759}; 759};
760 760
761static const struct of_device_id sh_mobile_i2c_dt_ids[] __devinitconst = { 761static const struct of_device_id sh_mobile_i2c_dt_ids[] = {
762 { .compatible = "renesas,rmobile-iic", }, 762 { .compatible = "renesas,rmobile-iic", },
763 {}, 763 {},
764}; 764};
diff --git a/drivers/i2c/busses/i2c-sirf.c b/drivers/i2c/busses/i2c-sirf.c
index 5574a47792fb..e03381aee34f 100644
--- a/drivers/i2c/busses/i2c-sirf.c
+++ b/drivers/i2c/busses/i2c-sirf.c
@@ -12,6 +12,7 @@
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/i2c.h> 14#include <linux/i2c.h>
15#include <linux/of_i2c.h>
15#include <linux/clk.h> 16#include <linux/clk.h>
16#include <linux/err.h> 17#include <linux/err.h>
17#include <linux/io.h> 18#include <linux/io.h>
@@ -258,7 +259,7 @@ static const struct i2c_algorithm i2c_sirfsoc_algo = {
258 .functionality = i2c_sirfsoc_func, 259 .functionality = i2c_sirfsoc_func,
259}; 260};
260 261
261static int __devinit i2c_sirfsoc_probe(struct platform_device *pdev) 262static int i2c_sirfsoc_probe(struct platform_device *pdev)
262{ 263{
263 struct sirfsoc_i2c *siic; 264 struct sirfsoc_i2c *siic;
264 struct i2c_adapter *adap; 265 struct i2c_adapter *adap;
@@ -328,6 +329,7 @@ static int __devinit i2c_sirfsoc_probe(struct platform_device *pdev)
328 adap->algo = &i2c_sirfsoc_algo; 329 adap->algo = &i2c_sirfsoc_algo;
329 adap->algo_data = siic; 330 adap->algo_data = siic;
330 331
332 adap->dev.of_node = pdev->dev.of_node;
331 adap->dev.parent = &pdev->dev; 333 adap->dev.parent = &pdev->dev;
332 adap->nr = pdev->id; 334 adap->nr = pdev->id;
333 335
@@ -371,6 +373,8 @@ static int __devinit i2c_sirfsoc_probe(struct platform_device *pdev)
371 373
372 clk_disable(clk); 374 clk_disable(clk);
373 375
376 of_i2c_register_devices(adap);
377
374 dev_info(&pdev->dev, " I2C adapter ready to operate\n"); 378 dev_info(&pdev->dev, " I2C adapter ready to operate\n");
375 379
376 return 0; 380 return 0;
@@ -385,7 +389,7 @@ err_get_clk:
385 return err; 389 return err;
386} 390}
387 391
388static int __devexit i2c_sirfsoc_remove(struct platform_device *pdev) 392static int i2c_sirfsoc_remove(struct platform_device *pdev)
389{ 393{
390 struct i2c_adapter *adapter = platform_get_drvdata(pdev); 394 struct i2c_adapter *adapter = platform_get_drvdata(pdev);
391 struct sirfsoc_i2c *siic = adapter->algo_data; 395 struct sirfsoc_i2c *siic = adapter->algo_data;
@@ -433,7 +437,7 @@ static const struct dev_pm_ops i2c_sirfsoc_pm_ops = {
433}; 437};
434#endif 438#endif
435 439
436static const struct of_device_id sirfsoc_i2c_of_match[] __devinitconst = { 440static const struct of_device_id sirfsoc_i2c_of_match[] = {
437 { .compatible = "sirf,prima2-i2c", }, 441 { .compatible = "sirf,prima2-i2c", },
438 {}, 442 {},
439}; 443};
@@ -449,7 +453,7 @@ static struct platform_driver i2c_sirfsoc_driver = {
449 .of_match_table = sirfsoc_i2c_of_match, 453 .of_match_table = sirfsoc_i2c_of_match,
450 }, 454 },
451 .probe = i2c_sirfsoc_probe, 455 .probe = i2c_sirfsoc_probe,
452 .remove = __devexit_p(i2c_sirfsoc_remove), 456 .remove = i2c_sirfsoc_remove,
453}; 457};
454module_platform_driver(i2c_sirfsoc_driver); 458module_platform_driver(i2c_sirfsoc_driver);
455 459
diff --git a/drivers/i2c/busses/i2c-sis5595.c b/drivers/i2c/busses/i2c-sis5595.c
index 87e5126d449c..79fd96a04386 100644
--- a/drivers/i2c/busses/i2c-sis5595.c
+++ b/drivers/i2c/busses/i2c-sis5595.c
@@ -142,7 +142,7 @@ static void sis5595_write(u8 reg, u8 data)
142 outb(data, sis5595_base + SMB_DAT); 142 outb(data, sis5595_base + SMB_DAT);
143} 143}
144 144
145static int __devinit sis5595_setup(struct pci_dev *SIS5595_dev) 145static int sis5595_setup(struct pci_dev *SIS5595_dev)
146{ 146{
147 u16 a; 147 u16 a;
148 u8 val; 148 u8 val;
@@ -376,7 +376,7 @@ static DEFINE_PCI_DEVICE_TABLE(sis5595_ids) = {
376 376
377MODULE_DEVICE_TABLE (pci, sis5595_ids); 377MODULE_DEVICE_TABLE (pci, sis5595_ids);
378 378
379static int __devinit sis5595_probe(struct pci_dev *dev, const struct pci_device_id *id) 379static int sis5595_probe(struct pci_dev *dev, const struct pci_device_id *id)
380{ 380{
381 int err; 381 int err;
382 382
diff --git a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c
index 5d6723b7525e..de6dddb9f865 100644
--- a/drivers/i2c/busses/i2c-sis630.c
+++ b/drivers/i2c/busses/i2c-sis630.c
@@ -389,7 +389,7 @@ static u32 sis630_func(struct i2c_adapter *adapter)
389 I2C_FUNC_SMBUS_BLOCK_DATA; 389 I2C_FUNC_SMBUS_BLOCK_DATA;
390} 390}
391 391
392static int __devinit sis630_setup(struct pci_dev *sis630_dev) 392static int sis630_setup(struct pci_dev *sis630_dev)
393{ 393{
394 unsigned char b; 394 unsigned char b;
395 struct pci_dev *dummy = NULL; 395 struct pci_dev *dummy = NULL;
@@ -480,7 +480,7 @@ static DEFINE_PCI_DEVICE_TABLE(sis630_ids) = {
480 480
481MODULE_DEVICE_TABLE (pci, sis630_ids); 481MODULE_DEVICE_TABLE (pci, sis630_ids);
482 482
483static int __devinit sis630_probe(struct pci_dev *dev, const struct pci_device_id *id) 483static int sis630_probe(struct pci_dev *dev, const struct pci_device_id *id)
484{ 484{
485 if (sis630_setup(dev)) { 485 if (sis630_setup(dev)) {
486 dev_err(&dev->dev, "SIS630 comp. bus not detected, module not inserted.\n"); 486 dev_err(&dev->dev, "SIS630 comp. bus not detected, module not inserted.\n");
@@ -496,7 +496,7 @@ static int __devinit sis630_probe(struct pci_dev *dev, const struct pci_device_i
496 return i2c_add_adapter(&sis630_adapter); 496 return i2c_add_adapter(&sis630_adapter);
497} 497}
498 498
499static void __devexit sis630_remove(struct pci_dev *dev) 499static void sis630_remove(struct pci_dev *dev)
500{ 500{
501 if (acpi_base) { 501 if (acpi_base) {
502 i2c_del_adapter(&sis630_adapter); 502 i2c_del_adapter(&sis630_adapter);
@@ -510,7 +510,7 @@ static struct pci_driver sis630_driver = {
510 .name = "sis630_smbus", 510 .name = "sis630_smbus",
511 .id_table = sis630_ids, 511 .id_table = sis630_ids,
512 .probe = sis630_probe, 512 .probe = sis630_probe,
513 .remove = __devexit_p(sis630_remove), 513 .remove = sis630_remove,
514}; 514};
515 515
516module_pci_driver(sis630_driver); 516module_pci_driver(sis630_driver);
diff --git a/drivers/i2c/busses/i2c-sis96x.c b/drivers/i2c/busses/i2c-sis96x.c
index 7b72614a9bc0..b9faf9b6002b 100644
--- a/drivers/i2c/busses/i2c-sis96x.c
+++ b/drivers/i2c/busses/i2c-sis96x.c
@@ -252,7 +252,7 @@ static DEFINE_PCI_DEVICE_TABLE(sis96x_ids) = {
252 252
253MODULE_DEVICE_TABLE (pci, sis96x_ids); 253MODULE_DEVICE_TABLE (pci, sis96x_ids);
254 254
255static int __devinit sis96x_probe(struct pci_dev *dev, 255static int sis96x_probe(struct pci_dev *dev,
256 const struct pci_device_id *id) 256 const struct pci_device_id *id)
257{ 257{
258 u16 ww = 0; 258 u16 ww = 0;
@@ -308,7 +308,7 @@ static int __devinit sis96x_probe(struct pci_dev *dev,
308 return retval; 308 return retval;
309} 309}
310 310
311static void __devexit sis96x_remove(struct pci_dev *dev) 311static void sis96x_remove(struct pci_dev *dev)
312{ 312{
313 if (sis96x_smbus_base) { 313 if (sis96x_smbus_base) {
314 i2c_del_adapter(&sis96x_adapter); 314 i2c_del_adapter(&sis96x_adapter);
@@ -321,7 +321,7 @@ static struct pci_driver sis96x_driver = {
321 .name = "sis96x_smbus", 321 .name = "sis96x_smbus",
322 .id_table = sis96x_ids, 322 .id_table = sis96x_ids,
323 .probe = sis96x_probe, 323 .probe = sis96x_probe,
324 .remove = __devexit_p(sis96x_remove), 324 .remove = sis96x_remove,
325}; 325};
326 326
327module_pci_driver(sis96x_driver); 327module_pci_driver(sis96x_driver);
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index dcea77bf6f50..7b38877ffec1 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -642,7 +642,7 @@ static const struct tegra_i2c_hw_feature tegra30_i2c_hw = {
642 642
643#if defined(CONFIG_OF) 643#if defined(CONFIG_OF)
644/* Match table for of_platform binding */ 644/* Match table for of_platform binding */
645static const struct of_device_id tegra_i2c_of_match[] __devinitconst = { 645static const struct of_device_id tegra_i2c_of_match[] = {
646 { .compatible = "nvidia,tegra30-i2c", .data = &tegra30_i2c_hw, }, 646 { .compatible = "nvidia,tegra30-i2c", .data = &tegra30_i2c_hw, },
647 { .compatible = "nvidia,tegra20-i2c", .data = &tegra20_i2c_hw, }, 647 { .compatible = "nvidia,tegra20-i2c", .data = &tegra20_i2c_hw, },
648 { .compatible = "nvidia,tegra20-i2c-dvc", .data = &tegra20_i2c_hw, }, 648 { .compatible = "nvidia,tegra20-i2c-dvc", .data = &tegra20_i2c_hw, },
@@ -651,7 +651,7 @@ static const struct of_device_id tegra_i2c_of_match[] __devinitconst = {
651MODULE_DEVICE_TABLE(of, tegra_i2c_of_match); 651MODULE_DEVICE_TABLE(of, tegra_i2c_of_match);
652#endif 652#endif
653 653
654static int __devinit tegra_i2c_probe(struct platform_device *pdev) 654static int tegra_i2c_probe(struct platform_device *pdev)
655{ 655{
656 struct tegra_i2c_dev *i2c_dev; 656 struct tegra_i2c_dev *i2c_dev;
657 struct tegra_i2c_platform_data *pdata = pdev->dev.platform_data; 657 struct tegra_i2c_platform_data *pdata = pdev->dev.platform_data;
@@ -769,7 +769,7 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev)
769 return 0; 769 return 0;
770} 770}
771 771
772static int __devexit tegra_i2c_remove(struct platform_device *pdev) 772static int tegra_i2c_remove(struct platform_device *pdev)
773{ 773{
774 struct tegra_i2c_dev *i2c_dev = platform_get_drvdata(pdev); 774 struct tegra_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
775 i2c_del_adapter(&i2c_dev->adapter); 775 i2c_del_adapter(&i2c_dev->adapter);
@@ -817,7 +817,7 @@ static SIMPLE_DEV_PM_OPS(tegra_i2c_pm, tegra_i2c_suspend, tegra_i2c_resume);
817 817
818static struct platform_driver tegra_i2c_driver = { 818static struct platform_driver tegra_i2c_driver = {
819 .probe = tegra_i2c_probe, 819 .probe = tegra_i2c_probe,
820 .remove = __devexit_p(tegra_i2c_remove), 820 .remove = tegra_i2c_remove,
821 .driver = { 821 .driver = {
822 .name = "tegra-i2c", 822 .name = "tegra-i2c",
823 .owner = THIS_MODULE, 823 .owner = THIS_MODULE,
diff --git a/drivers/i2c/busses/i2c-via.c b/drivers/i2c/busses/i2c-via.c
index 7ffee71ca190..be662511c58b 100644
--- a/drivers/i2c/busses/i2c-via.c
+++ b/drivers/i2c/busses/i2c-via.c
@@ -96,7 +96,7 @@ static DEFINE_PCI_DEVICE_TABLE(vt586b_ids) = {
96 96
97MODULE_DEVICE_TABLE (pci, vt586b_ids); 97MODULE_DEVICE_TABLE (pci, vt586b_ids);
98 98
99static int __devinit vt586b_probe(struct pci_dev *dev, const struct pci_device_id *id) 99static int vt586b_probe(struct pci_dev *dev, const struct pci_device_id *id)
100{ 100{
101 u16 base; 101 u16 base;
102 u8 rev; 102 u8 rev;
@@ -146,7 +146,7 @@ static int __devinit vt586b_probe(struct pci_dev *dev, const struct pci_device_i
146 return 0; 146 return 0;
147} 147}
148 148
149static void __devexit vt586b_remove(struct pci_dev *dev) 149static void vt586b_remove(struct pci_dev *dev)
150{ 150{
151 i2c_del_adapter(&vt586b_adapter); 151 i2c_del_adapter(&vt586b_adapter);
152 release_region(I2C_DIR, IOSPACE); 152 release_region(I2C_DIR, IOSPACE);
@@ -158,7 +158,7 @@ static struct pci_driver vt586b_driver = {
158 .name = "vt586b_smbus", 158 .name = "vt586b_smbus",
159 .id_table = vt586b_ids, 159 .id_table = vt586b_ids,
160 .probe = vt586b_probe, 160 .probe = vt586b_probe,
161 .remove = __devexit_p(vt586b_remove), 161 .remove = vt586b_remove,
162}; 162};
163 163
164module_pci_driver(vt586b_driver); 164module_pci_driver(vt586b_driver);
diff --git a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c
index 271c9a2b0fd7..b2d90e105f41 100644
--- a/drivers/i2c/busses/i2c-viapro.c
+++ b/drivers/i2c/busses/i2c-viapro.c
@@ -320,8 +320,8 @@ static struct i2c_adapter vt596_adapter = {
320 .algo = &smbus_algorithm, 320 .algo = &smbus_algorithm,
321}; 321};
322 322
323static int __devinit vt596_probe(struct pci_dev *pdev, 323static int vt596_probe(struct pci_dev *pdev,
324 const struct pci_device_id *id) 324 const struct pci_device_id *id)
325{ 325{
326 unsigned char temp; 326 unsigned char temp;
327 int error; 327 int error;
diff --git a/drivers/i2c/busses/i2c-viperboard.c b/drivers/i2c/busses/i2c-viperboard.c
index f5fa20dea906..f45c32c1ace6 100644
--- a/drivers/i2c/busses/i2c-viperboard.c
+++ b/drivers/i2c/busses/i2c-viperboard.c
@@ -360,7 +360,7 @@ static const struct i2c_algorithm vprbrd_algorithm = {
360 .functionality = vprbrd_i2c_func, 360 .functionality = vprbrd_i2c_func,
361}; 361};
362 362
363static int __devinit vprbrd_i2c_probe(struct platform_device *pdev) 363static int vprbrd_i2c_probe(struct platform_device *pdev)
364{ 364{
365 struct vprbrd *vb = dev_get_drvdata(pdev->dev.parent); 365 struct vprbrd *vb = dev_get_drvdata(pdev->dev.parent);
366 struct vprbrd_i2c *vb_i2c; 366 struct vprbrd_i2c *vb_i2c;
@@ -418,7 +418,7 @@ error:
418 return ret; 418 return ret;
419} 419}
420 420
421static int __devexit vprbrd_i2c_remove(struct platform_device *pdev) 421static int vprbrd_i2c_remove(struct platform_device *pdev)
422{ 422{
423 struct vprbrd_i2c *vb_i2c = platform_get_drvdata(pdev); 423 struct vprbrd_i2c *vb_i2c = platform_get_drvdata(pdev);
424 int ret; 424 int ret;
@@ -432,7 +432,7 @@ static struct platform_driver vprbrd_i2c_driver = {
432 .driver.name = "viperboard-i2c", 432 .driver.name = "viperboard-i2c",
433 .driver.owner = THIS_MODULE, 433 .driver.owner = THIS_MODULE,
434 .probe = vprbrd_i2c_probe, 434 .probe = vprbrd_i2c_probe,
435 .remove = __devexit_p(vprbrd_i2c_remove), 435 .remove = vprbrd_i2c_remove,
436}; 436};
437 437
438static int __init vprbrd_i2c_init(void) 438static int __init vprbrd_i2c_init(void)
diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index 641d0e5e3303..f042f6da0ace 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -689,7 +689,7 @@ static struct i2c_adapter xiic_adapter = {
689}; 689};
690 690
691 691
692static int __devinit xiic_i2c_probe(struct platform_device *pdev) 692static int xiic_i2c_probe(struct platform_device *pdev)
693{ 693{
694 struct xiic_i2c *i2c; 694 struct xiic_i2c *i2c;
695 struct xiic_i2c_platform_data *pdata; 695 struct xiic_i2c_platform_data *pdata;
@@ -774,7 +774,7 @@ resource_missing:
774 return -ENOENT; 774 return -ENOENT;
775} 775}
776 776
777static int __devexit xiic_i2c_remove(struct platform_device* pdev) 777static int xiic_i2c_remove(struct platform_device *pdev)
778{ 778{
779 struct xiic_i2c *i2c = platform_get_drvdata(pdev); 779 struct xiic_i2c *i2c = platform_get_drvdata(pdev);
780 struct resource *res; 780 struct resource *res;
@@ -800,7 +800,7 @@ static int __devexit xiic_i2c_remove(struct platform_device* pdev)
800} 800}
801 801
802#if defined(CONFIG_OF) 802#if defined(CONFIG_OF)
803static const struct of_device_id xiic_of_match[] __devinitconst = { 803static const struct of_device_id xiic_of_match[] = {
804 { .compatible = "xlnx,xps-iic-2.00.a", }, 804 { .compatible = "xlnx,xps-iic-2.00.a", },
805 {}, 805 {},
806}; 806};
@@ -809,7 +809,7 @@ MODULE_DEVICE_TABLE(of, xiic_of_match);
809 809
810static struct platform_driver xiic_i2c_driver = { 810static struct platform_driver xiic_i2c_driver = {
811 .probe = xiic_i2c_probe, 811 .probe = xiic_i2c_probe,
812 .remove = __devexit_p(xiic_i2c_remove), 812 .remove = xiic_i2c_remove,
813 .driver = { 813 .driver = {
814 .owner = THIS_MODULE, 814 .owner = THIS_MODULE,
815 .name = DRIVER_NAME, 815 .name = DRIVER_NAME,
diff --git a/drivers/i2c/busses/i2c-xlr.c b/drivers/i2c/busses/i2c-xlr.c
index 96d3fabd8883..a005265461da 100644
--- a/drivers/i2c/busses/i2c-xlr.c
+++ b/drivers/i2c/busses/i2c-xlr.c
@@ -214,7 +214,7 @@ static struct i2c_algorithm xlr_i2c_algo = {
214 .functionality = xlr_func, 214 .functionality = xlr_func,
215}; 215};
216 216
217static int __devinit xlr_i2c_probe(struct platform_device *pdev) 217static int xlr_i2c_probe(struct platform_device *pdev)
218{ 218{
219 struct xlr_i2c_private *priv; 219 struct xlr_i2c_private *priv;
220 struct resource *res; 220 struct resource *res;
@@ -251,7 +251,7 @@ static int __devinit xlr_i2c_probe(struct platform_device *pdev)
251 return 0; 251 return 0;
252} 252}
253 253
254static int __devexit xlr_i2c_remove(struct platform_device *pdev) 254static int xlr_i2c_remove(struct platform_device *pdev)
255{ 255{
256 struct xlr_i2c_private *priv; 256 struct xlr_i2c_private *priv;
257 257
@@ -263,7 +263,7 @@ static int __devexit xlr_i2c_remove(struct platform_device *pdev)
263 263
264static struct platform_driver xlr_i2c_driver = { 264static struct platform_driver xlr_i2c_driver = {
265 .probe = xlr_i2c_probe, 265 .probe = xlr_i2c_probe,
266 .remove = __devexit_p(xlr_i2c_remove), 266 .remove = xlr_i2c_remove,
267 .driver = { 267 .driver = {
268 .name = "xlr-i2cbus", 268 .name = "xlr-i2cbus",
269 .owner = THIS_MODULE, 269 .owner = THIS_MODULE,
diff --git a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c
index 08aab57337dd..3862a953239c 100644
--- a/drivers/i2c/busses/scx200_acb.c
+++ b/drivers/i2c/busses/scx200_acb.c
@@ -389,7 +389,7 @@ static const struct i2c_algorithm scx200_acb_algorithm = {
389static struct scx200_acb_iface *scx200_acb_list; 389static struct scx200_acb_iface *scx200_acb_list;
390static DEFINE_MUTEX(scx200_acb_list_mutex); 390static DEFINE_MUTEX(scx200_acb_list_mutex);
391 391
392static __devinit int scx200_acb_probe(struct scx200_acb_iface *iface) 392static int scx200_acb_probe(struct scx200_acb_iface *iface)
393{ 393{
394 u8 val; 394 u8 val;
395 395
@@ -424,7 +424,7 @@ static __devinit int scx200_acb_probe(struct scx200_acb_iface *iface)
424 return 0; 424 return 0;
425} 425}
426 426
427static __devinit struct scx200_acb_iface *scx200_create_iface(const char *text, 427static struct scx200_acb_iface *scx200_create_iface(const char *text,
428 struct device *dev, int index) 428 struct device *dev, int index)
429{ 429{
430 struct scx200_acb_iface *iface; 430 struct scx200_acb_iface *iface;
@@ -449,7 +449,7 @@ static __devinit struct scx200_acb_iface *scx200_create_iface(const char *text,
449 return iface; 449 return iface;
450} 450}
451 451
452static int __devinit scx200_acb_create(struct scx200_acb_iface *iface) 452static int scx200_acb_create(struct scx200_acb_iface *iface)
453{ 453{
454 struct i2c_adapter *adapter; 454 struct i2c_adapter *adapter;
455 int rc; 455 int rc;
@@ -480,7 +480,7 @@ static int __devinit scx200_acb_create(struct scx200_acb_iface *iface)
480 return 0; 480 return 0;
481} 481}
482 482
483static struct scx200_acb_iface * __devinit scx200_create_dev(const char *text, 483static struct scx200_acb_iface *scx200_create_dev(const char *text,
484 unsigned long base, int index, struct device *dev) 484 unsigned long base, int index, struct device *dev)
485{ 485{
486 struct scx200_acb_iface *iface; 486 struct scx200_acb_iface *iface;
@@ -508,7 +508,7 @@ static struct scx200_acb_iface * __devinit scx200_create_dev(const char *text,
508 return NULL; 508 return NULL;
509} 509}
510 510
511static int __devinit scx200_probe(struct platform_device *pdev) 511static int scx200_probe(struct platform_device *pdev)
512{ 512{
513 struct scx200_acb_iface *iface; 513 struct scx200_acb_iface *iface;
514 struct resource *res; 514 struct resource *res;
@@ -530,14 +530,14 @@ static int __devinit scx200_probe(struct platform_device *pdev)
530 return 0; 530 return 0;
531} 531}
532 532
533static void __devexit scx200_cleanup_iface(struct scx200_acb_iface *iface) 533static void scx200_cleanup_iface(struct scx200_acb_iface *iface)
534{ 534{
535 i2c_del_adapter(&iface->adapter); 535 i2c_del_adapter(&iface->adapter);
536 release_region(iface->base, 8); 536 release_region(iface->base, 8);
537 kfree(iface); 537 kfree(iface);
538} 538}
539 539
540static int __devexit scx200_remove(struct platform_device *pdev) 540static int scx200_remove(struct platform_device *pdev)
541{ 541{
542 struct scx200_acb_iface *iface; 542 struct scx200_acb_iface *iface;
543 543
@@ -554,7 +554,7 @@ static struct platform_driver scx200_pci_driver = {
554 .owner = THIS_MODULE, 554 .owner = THIS_MODULE,
555 }, 555 },
556 .probe = scx200_probe, 556 .probe = scx200_probe,
557 .remove = __devexit_p(scx200_remove), 557 .remove = scx200_remove,
558}; 558};
559 559
560static DEFINE_PCI_DEVICE_TABLE(scx200_isa) = { 560static DEFINE_PCI_DEVICE_TABLE(scx200_isa) = {
diff --git a/drivers/i2c/muxes/i2c-mux-gpio.c b/drivers/i2c/muxes/i2c-mux-gpio.c
index 3b7bc06fe8a6..9f50ef04a4bd 100644
--- a/drivers/i2c/muxes/i2c-mux-gpio.c
+++ b/drivers/i2c/muxes/i2c-mux-gpio.c
@@ -53,14 +53,14 @@ static int i2c_mux_gpio_deselect(struct i2c_adapter *adap, void *data, u32 chan)
53 return 0; 53 return 0;
54} 54}
55 55
56static int __devinit match_gpio_chip_by_label(struct gpio_chip *chip, 56static int match_gpio_chip_by_label(struct gpio_chip *chip,
57 void *data) 57 void *data)
58{ 58{
59 return !strcmp(chip->label, data); 59 return !strcmp(chip->label, data);
60} 60}
61 61
62#ifdef CONFIG_OF 62#ifdef CONFIG_OF
63static int __devinit i2c_mux_gpio_probe_dt(struct gpiomux *mux, 63static int i2c_mux_gpio_probe_dt(struct gpiomux *mux,
64 struct platform_device *pdev) 64 struct platform_device *pdev)
65{ 65{
66 struct device_node *np = pdev->dev.of_node; 66 struct device_node *np = pdev->dev.of_node;
@@ -125,14 +125,14 @@ static int __devinit i2c_mux_gpio_probe_dt(struct gpiomux *mux,
125 return 0; 125 return 0;
126} 126}
127#else 127#else
128static int __devinit i2c_mux_gpio_probe_dt(struct gpiomux *mux, 128static int i2c_mux_gpio_probe_dt(struct gpiomux *mux,
129 struct platform_device *pdev) 129 struct platform_device *pdev)
130{ 130{
131 return 0; 131 return 0;
132} 132}
133#endif 133#endif
134 134
135static int __devinit i2c_mux_gpio_probe(struct platform_device *pdev) 135static int i2c_mux_gpio_probe(struct platform_device *pdev)
136{ 136{
137 struct gpiomux *mux; 137 struct gpiomux *mux;
138 struct i2c_adapter *parent; 138 struct i2c_adapter *parent;
@@ -239,7 +239,7 @@ alloc_failed:
239 return ret; 239 return ret;
240} 240}
241 241
242static int __devexit i2c_mux_gpio_remove(struct platform_device *pdev) 242static int i2c_mux_gpio_remove(struct platform_device *pdev)
243{ 243{
244 struct gpiomux *mux = platform_get_drvdata(pdev); 244 struct gpiomux *mux = platform_get_drvdata(pdev);
245 int i; 245 int i;
@@ -256,7 +256,7 @@ static int __devexit i2c_mux_gpio_remove(struct platform_device *pdev)
256 return 0; 256 return 0;
257} 257}
258 258
259static const struct of_device_id i2c_mux_gpio_of_match[] __devinitconst = { 259static const struct of_device_id i2c_mux_gpio_of_match[] = {
260 { .compatible = "i2c-mux-gpio", }, 260 { .compatible = "i2c-mux-gpio", },
261 {}, 261 {},
262}; 262};
@@ -264,7 +264,7 @@ MODULE_DEVICE_TABLE(of, i2c_mux_gpio_of_match);
264 264
265static struct platform_driver i2c_mux_gpio_driver = { 265static struct platform_driver i2c_mux_gpio_driver = {
266 .probe = i2c_mux_gpio_probe, 266 .probe = i2c_mux_gpio_probe,
267 .remove = __devexit_p(i2c_mux_gpio_remove), 267 .remove = i2c_mux_gpio_remove,
268 .driver = { 268 .driver = {
269 .owner = THIS_MODULE, 269 .owner = THIS_MODULE,
270 .name = "i2c-mux-gpio", 270 .name = "i2c-mux-gpio",
diff --git a/drivers/i2c/muxes/i2c-mux-pinctrl.c b/drivers/i2c/muxes/i2c-mux-pinctrl.c
index 7fa5b24b16db..a43c0ce5e3d8 100644
--- a/drivers/i2c/muxes/i2c-mux-pinctrl.c
+++ b/drivers/i2c/muxes/i2c-mux-pinctrl.c
@@ -129,7 +129,7 @@ static inline int i2c_mux_pinctrl_parse_dt(struct i2c_mux_pinctrl *mux,
129} 129}
130#endif 130#endif
131 131
132static int __devinit i2c_mux_pinctrl_probe(struct platform_device *pdev) 132static int i2c_mux_pinctrl_probe(struct platform_device *pdev)
133{ 133{
134 struct i2c_mux_pinctrl *mux; 134 struct i2c_mux_pinctrl *mux;
135 int (*deselect)(struct i2c_adapter *, void *, u32); 135 int (*deselect)(struct i2c_adapter *, void *, u32);
@@ -167,7 +167,7 @@ static int __devinit i2c_mux_pinctrl_probe(struct platform_device *pdev)
167 } 167 }
168 168
169 mux->busses = devm_kzalloc(&pdev->dev, 169 mux->busses = devm_kzalloc(&pdev->dev,
170 sizeof(mux->busses) * mux->pdata->bus_count, 170 sizeof(*mux->busses) * mux->pdata->bus_count,
171 GFP_KERNEL); 171 GFP_KERNEL);
172 if (!mux->busses) { 172 if (!mux->busses) {
173 dev_err(&pdev->dev, "Cannot allocate busses\n"); 173 dev_err(&pdev->dev, "Cannot allocate busses\n");
@@ -241,7 +241,7 @@ err:
241 return ret; 241 return ret;
242} 242}
243 243
244static int __devexit i2c_mux_pinctrl_remove(struct platform_device *pdev) 244static int i2c_mux_pinctrl_remove(struct platform_device *pdev)
245{ 245{
246 struct i2c_mux_pinctrl *mux = platform_get_drvdata(pdev); 246 struct i2c_mux_pinctrl *mux = platform_get_drvdata(pdev);
247 int i; 247 int i;
@@ -255,7 +255,7 @@ static int __devexit i2c_mux_pinctrl_remove(struct platform_device *pdev)
255} 255}
256 256
257#ifdef CONFIG_OF 257#ifdef CONFIG_OF
258static const struct of_device_id i2c_mux_pinctrl_of_match[] __devinitconst = { 258static const struct of_device_id i2c_mux_pinctrl_of_match[] = {
259 { .compatible = "i2c-mux-pinctrl", }, 259 { .compatible = "i2c-mux-pinctrl", },
260 {}, 260 {},
261}; 261};
@@ -269,7 +269,7 @@ static struct platform_driver i2c_mux_pinctrl_driver = {
269 .of_match_table = of_match_ptr(i2c_mux_pinctrl_of_match), 269 .of_match_table = of_match_ptr(i2c_mux_pinctrl_of_match),
270 }, 270 },
271 .probe = i2c_mux_pinctrl_probe, 271 .probe = i2c_mux_pinctrl_probe,
272 .remove = __devexit_p(i2c_mux_pinctrl_remove), 272 .remove = i2c_mux_pinctrl_remove,
273}; 273};
274module_platform_driver(i2c_mux_pinctrl_driver); 274module_platform_driver(i2c_mux_pinctrl_driver);
275 275
diff --git a/drivers/ide/aec62xx.c b/drivers/ide/aec62xx.c
index 01451940393b..c7eaf20af926 100644
--- a/drivers/ide/aec62xx.c
+++ b/drivers/ide/aec62xx.c
@@ -181,7 +181,7 @@ static const struct ide_port_ops atp86x_port_ops = {
181 .cable_detect = atp86x_cable_detect, 181 .cable_detect = atp86x_cable_detect,
182}; 182};
183 183
184static const struct ide_port_info aec62xx_chipsets[] __devinitconst = { 184static const struct ide_port_info aec62xx_chipsets[] = {
185 { /* 0: AEC6210 */ 185 { /* 0: AEC6210 */
186 .name = DRV_NAME, 186 .name = DRV_NAME,
187 .init_chipset = init_chipset_aec62xx, 187 .init_chipset = init_chipset_aec62xx,
@@ -251,7 +251,7 @@ static const struct ide_port_info aec62xx_chipsets[] __devinitconst = {
251 * chips, pass a local copy of 'struct ide_port_info' down the call chain. 251 * chips, pass a local copy of 'struct ide_port_info' down the call chain.
252 */ 252 */
253 253
254static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) 254static int aec62xx_init_one(struct pci_dev *dev, const struct pci_device_id *id)
255{ 255{
256 const struct chipset_bus_clock_list_entry *bus_clock; 256 const struct chipset_bus_clock_list_entry *bus_clock;
257 struct ide_port_info d; 257 struct ide_port_info d;
@@ -287,7 +287,7 @@ static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_devi
287 return err; 287 return err;
288} 288}
289 289
290static void __devexit aec62xx_remove(struct pci_dev *dev) 290static void aec62xx_remove(struct pci_dev *dev)
291{ 291{
292 ide_pci_remove(dev); 292 ide_pci_remove(dev);
293 pci_disable_device(dev); 293 pci_disable_device(dev);
@@ -307,7 +307,7 @@ static struct pci_driver aec62xx_pci_driver = {
307 .name = "AEC62xx_IDE", 307 .name = "AEC62xx_IDE",
308 .id_table = aec62xx_pci_tbl, 308 .id_table = aec62xx_pci_tbl,
309 .probe = aec62xx_init_one, 309 .probe = aec62xx_init_one,
310 .remove = __devexit_p(aec62xx_remove), 310 .remove = aec62xx_remove,
311 .suspend = ide_pci_suspend, 311 .suspend = ide_pci_suspend,
312 .resume = ide_pci_resume, 312 .resume = ide_pci_resume,
313}; 313};
diff --git a/drivers/ide/alim15x3.c b/drivers/ide/alim15x3.c
index 911a27ca356b..36f76e28a0bf 100644
--- a/drivers/ide/alim15x3.c
+++ b/drivers/ide/alim15x3.c
@@ -415,7 +415,7 @@ static u8 ali_cable_detect(ide_hwif_t *hwif)
415 * Sparc systems. 415 * Sparc systems.
416 */ 416 */
417 417
418static void __devinit init_hwif_ali15x3 (ide_hwif_t *hwif) 418static void init_hwif_ali15x3(ide_hwif_t *hwif)
419{ 419{
420 u8 ideic, inmir; 420 u8 ideic, inmir;
421 s8 irq_routing_table[] = { -1, 9, 3, 10, 4, 5, 7, 6, 421 s8 irq_routing_table[] = { -1, 9, 3, 10, 4, 5, 7, 6,
@@ -464,8 +464,7 @@ static void __devinit init_hwif_ali15x3 (ide_hwif_t *hwif)
464 * Set up the DMA functionality on the ALi 15x3. 464 * Set up the DMA functionality on the ALi 15x3.
465 */ 465 */
466 466
467static int __devinit init_dma_ali15x3(ide_hwif_t *hwif, 467static int init_dma_ali15x3(ide_hwif_t *hwif, const struct ide_port_info *d)
468 const struct ide_port_info *d)
469{ 468{
470 struct pci_dev *dev = to_pci_dev(hwif->dev); 469 struct pci_dev *dev = to_pci_dev(hwif->dev);
471 unsigned long base = ide_pci_dma_base(hwif, d); 470 unsigned long base = ide_pci_dma_base(hwif, d);
@@ -512,7 +511,7 @@ static const struct ide_dma_ops ali_dma_ops = {
512 .dma_sff_read_status = ide_dma_sff_read_status, 511 .dma_sff_read_status = ide_dma_sff_read_status,
513}; 512};
514 513
515static const struct ide_port_info ali15x3_chipset __devinitconst = { 514static const struct ide_port_info ali15x3_chipset = {
516 .name = DRV_NAME, 515 .name = DRV_NAME,
517 .init_chipset = init_chipset_ali15x3, 516 .init_chipset = init_chipset_ali15x3,
518 .init_hwif = init_hwif_ali15x3, 517 .init_hwif = init_hwif_ali15x3,
@@ -532,7 +531,8 @@ static const struct ide_port_info ali15x3_chipset __devinitconst = {
532 * hot plug layer. 531 * hot plug layer.
533 */ 532 */
534 533
535static int __devinit alim15x3_init_one(struct pci_dev *dev, const struct pci_device_id *id) 534static int alim15x3_init_one(struct pci_dev *dev,
535 const struct pci_device_id *id)
536{ 536{
537 struct ide_port_info d = ali15x3_chipset; 537 struct ide_port_info d = ali15x3_chipset;
538 u8 rev = dev->revision, idx = id->driver_data; 538 u8 rev = dev->revision, idx = id->driver_data;
diff --git a/drivers/ide/amd74xx.c b/drivers/ide/amd74xx.c
index 56fc99557ba2..cbfe846911d1 100644
--- a/drivers/ide/amd74xx.c
+++ b/drivers/ide/amd74xx.c
@@ -223,7 +223,7 @@ static const struct ide_port_ops amd_port_ops = {
223 .udma_mask = udma, \ 223 .udma_mask = udma, \
224 } 224 }
225 225
226static const struct ide_port_info amd74xx_chipsets[] __devinitconst = { 226static const struct ide_port_info amd74xx_chipsets[] = {
227 /* 0: AMD7401 */ DECLARE_AMD_DEV(0x00, ATA_UDMA2), 227 /* 0: AMD7401 */ DECLARE_AMD_DEV(0x00, ATA_UDMA2),
228 /* 1: AMD7409 */ DECLARE_AMD_DEV(ATA_SWDMA2, ATA_UDMA4), 228 /* 1: AMD7409 */ DECLARE_AMD_DEV(ATA_SWDMA2, ATA_UDMA4),
229 /* 2: AMD7411/7441 */ DECLARE_AMD_DEV(ATA_SWDMA2, ATA_UDMA5), 229 /* 2: AMD7411/7441 */ DECLARE_AMD_DEV(ATA_SWDMA2, ATA_UDMA5),
@@ -235,7 +235,7 @@ static const struct ide_port_info amd74xx_chipsets[] __devinitconst = {
235 /* 6: AMD5536 */ DECLARE_AMD_DEV(ATA_SWDMA2, ATA_UDMA5), 235 /* 6: AMD5536 */ DECLARE_AMD_DEV(ATA_SWDMA2, ATA_UDMA5),
236}; 236};
237 237
238static int __devinit amd74xx_probe(struct pci_dev *dev, const struct pci_device_id *id) 238static int amd74xx_probe(struct pci_dev *dev, const struct pci_device_id *id)
239{ 239{
240 struct ide_port_info d; 240 struct ide_port_info d;
241 u8 idx = id->driver_data; 241 u8 idx = id->driver_data;
diff --git a/drivers/ide/atiixp.c b/drivers/ide/atiixp.c
index cb43480b1bd5..dbd0f242ec18 100644
--- a/drivers/ide/atiixp.c
+++ b/drivers/ide/atiixp.c
@@ -139,7 +139,7 @@ static const struct ide_port_ops atiixp_port_ops = {
139 .cable_detect = atiixp_cable_detect, 139 .cable_detect = atiixp_cable_detect,
140}; 140};
141 141
142static const struct ide_port_info atiixp_pci_info[] __devinitconst = { 142static const struct ide_port_info atiixp_pci_info[] = {
143 { /* 0: IXP200/300/400/700 */ 143 { /* 0: IXP200/300/400/700 */
144 .name = DRV_NAME, 144 .name = DRV_NAME,
145 .enablebits = {{0x48,0x01,0x00}, {0x48,0x08,0x00}}, 145 .enablebits = {{0x48,0x01,0x00}, {0x48,0x08,0x00}},
@@ -168,7 +168,7 @@ static const struct ide_port_info atiixp_pci_info[] __devinitconst = {
168 * finds a device matching our IDE device tables. 168 * finds a device matching our IDE device tables.
169 */ 169 */
170 170
171static int __devinit atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id) 171static int atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id)
172{ 172{
173 return ide_pci_init_one(dev, &atiixp_pci_info[id->driver_data], NULL); 173 return ide_pci_init_one(dev, &atiixp_pci_info[id->driver_data], NULL);
174} 174}
diff --git a/drivers/ide/cmd64x.c b/drivers/ide/cmd64x.c
index d1fc43802f5d..b127ed60c733 100644
--- a/drivers/ide/cmd64x.c
+++ b/drivers/ide/cmd64x.c
@@ -327,7 +327,7 @@ static const struct ide_dma_ops cmd646_rev1_dma_ops = {
327 .dma_sff_read_status = ide_dma_sff_read_status, 327 .dma_sff_read_status = ide_dma_sff_read_status,
328}; 328};
329 329
330static const struct ide_port_info cmd64x_chipsets[] __devinitconst = { 330static const struct ide_port_info cmd64x_chipsets[] = {
331 { /* 0: CMD643 */ 331 { /* 0: CMD643 */
332 .name = DRV_NAME, 332 .name = DRV_NAME,
333 .init_chipset = init_chipset_cmd64x, 333 .init_chipset = init_chipset_cmd64x,
@@ -373,7 +373,7 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitconst = {
373 } 373 }
374}; 374};
375 375
376static int __devinit cmd64x_init_one(struct pci_dev *dev, const struct pci_device_id *id) 376static int cmd64x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
377{ 377{
378 struct ide_port_info d; 378 struct ide_port_info d;
379 u8 idx = id->driver_data; 379 u8 idx = id->driver_data;
diff --git a/drivers/ide/cs5520.c b/drivers/ide/cs5520.c
index 14447621e60b..6250aee30503 100644
--- a/drivers/ide/cs5520.c
+++ b/drivers/ide/cs5520.c
@@ -94,7 +94,7 @@ static const struct ide_port_ops cs5520_port_ops = {
94 .set_dma_mode = cs5520_set_dma_mode, 94 .set_dma_mode = cs5520_set_dma_mode,
95}; 95};
96 96
97static const struct ide_port_info cyrix_chipset __devinitconst = { 97static const struct ide_port_info cyrix_chipset = {
98 .name = DRV_NAME, 98 .name = DRV_NAME,
99 .enablebits = { { 0x60, 0x01, 0x01 }, { 0x60, 0x02, 0x02 } }, 99 .enablebits = { { 0x60, 0x01, 0x01 }, { 0x60, 0x02, 0x02 } },
100 .port_ops = &cs5520_port_ops, 100 .port_ops = &cs5520_port_ops,
@@ -108,7 +108,7 @@ static const struct ide_port_info cyrix_chipset __devinitconst = {
108 * work longhand. 108 * work longhand.
109 */ 109 */
110 110
111static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id) 111static int cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id)
112{ 112{
113 const struct ide_port_info *d = &cyrix_chipset; 113 const struct ide_port_info *d = &cyrix_chipset;
114 struct ide_hw hw[2], *hws[] = { NULL, NULL }; 114 struct ide_hw hw[2], *hws[] = { NULL, NULL };
diff --git a/drivers/ide/cs5530.c b/drivers/ide/cs5530.c
index 49b40ad59d1a..65371599b976 100644
--- a/drivers/ide/cs5530.c
+++ b/drivers/ide/cs5530.c
@@ -226,7 +226,7 @@ out:
226 * performs channel-specific pre-initialization before drive probing. 226 * performs channel-specific pre-initialization before drive probing.
227 */ 227 */
228 228
229static void __devinit init_hwif_cs5530 (ide_hwif_t *hwif) 229static void init_hwif_cs5530 (ide_hwif_t *hwif)
230{ 230{
231 unsigned long basereg; 231 unsigned long basereg;
232 u32 d0_timings; 232 u32 d0_timings;
@@ -245,7 +245,7 @@ static const struct ide_port_ops cs5530_port_ops = {
245 .udma_filter = cs5530_udma_filter, 245 .udma_filter = cs5530_udma_filter,
246}; 246};
247 247
248static const struct ide_port_info cs5530_chipset __devinitconst = { 248static const struct ide_port_info cs5530_chipset = {
249 .name = DRV_NAME, 249 .name = DRV_NAME,
250 .init_chipset = init_chipset_cs5530, 250 .init_chipset = init_chipset_cs5530,
251 .init_hwif = init_hwif_cs5530, 251 .init_hwif = init_hwif_cs5530,
@@ -257,7 +257,7 @@ static const struct ide_port_info cs5530_chipset __devinitconst = {
257 .udma_mask = ATA_UDMA2, 257 .udma_mask = ATA_UDMA2,
258}; 258};
259 259
260static int __devinit cs5530_init_one(struct pci_dev *dev, const struct pci_device_id *id) 260static int cs5530_init_one(struct pci_dev *dev, const struct pci_device_id *id)
261{ 261{
262 return ide_pci_init_one(dev, &cs5530_chipset, NULL); 262 return ide_pci_init_one(dev, &cs5530_chipset, NULL);
263} 263}
diff --git a/drivers/ide/cs5535.c b/drivers/ide/cs5535.c
index 18d4c852602b..3bc5b9a34013 100644
--- a/drivers/ide/cs5535.c
+++ b/drivers/ide/cs5535.c
@@ -170,7 +170,7 @@ static const struct ide_port_ops cs5535_port_ops = {
170 .cable_detect = cs5535_cable_detect, 170 .cable_detect = cs5535_cable_detect,
171}; 171};
172 172
173static const struct ide_port_info cs5535_chipset __devinitconst = { 173static const struct ide_port_info cs5535_chipset = {
174 .name = DRV_NAME, 174 .name = DRV_NAME,
175 .port_ops = &cs5535_port_ops, 175 .port_ops = &cs5535_port_ops,
176 .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_POST_SET_MODE, 176 .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_POST_SET_MODE,
@@ -179,8 +179,7 @@ static const struct ide_port_info cs5535_chipset __devinitconst = {
179 .udma_mask = ATA_UDMA4, 179 .udma_mask = ATA_UDMA4,
180}; 180};
181 181
182static int __devinit cs5535_init_one(struct pci_dev *dev, 182static int cs5535_init_one(struct pci_dev *dev, const struct pci_device_id *id)
183 const struct pci_device_id *id)
184{ 183{
185 return ide_pci_init_one(dev, &cs5535_chipset, NULL); 184 return ide_pci_init_one(dev, &cs5535_chipset, NULL);
186} 185}
diff --git a/drivers/ide/cy82c693.c b/drivers/ide/cy82c693.c
index 3ffb49dab574..f5820079a286 100644
--- a/drivers/ide/cy82c693.c
+++ b/drivers/ide/cy82c693.c
@@ -145,7 +145,7 @@ static void cy82c693_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
145 pci_dev_put(dev); 145 pci_dev_put(dev);
146} 146}
147 147
148static void __devinit init_iops_cy82c693(ide_hwif_t *hwif) 148static void init_iops_cy82c693(ide_hwif_t *hwif)
149{ 149{
150 static ide_hwif_t *primary; 150 static ide_hwif_t *primary;
151 struct pci_dev *dev = to_pci_dev(hwif->dev); 151 struct pci_dev *dev = to_pci_dev(hwif->dev);
@@ -163,7 +163,7 @@ static const struct ide_port_ops cy82c693_port_ops = {
163 .set_dma_mode = cy82c693_set_dma_mode, 163 .set_dma_mode = cy82c693_set_dma_mode,
164}; 164};
165 165
166static const struct ide_port_info cy82c693_chipset __devinitconst = { 166static const struct ide_port_info cy82c693_chipset = {
167 .name = DRV_NAME, 167 .name = DRV_NAME,
168 .init_iops = init_iops_cy82c693, 168 .init_iops = init_iops_cy82c693,
169 .port_ops = &cy82c693_port_ops, 169 .port_ops = &cy82c693_port_ops,
@@ -173,7 +173,8 @@ static const struct ide_port_info cy82c693_chipset __devinitconst = {
173 .mwdma_mask = ATA_MWDMA2, 173 .mwdma_mask = ATA_MWDMA2,
174}; 174};
175 175
176static int __devinit cy82c693_init_one(struct pci_dev *dev, const struct pci_device_id *id) 176static int cy82c693_init_one(struct pci_dev *dev,
177 const struct pci_device_id *id)
177{ 178{
178 struct pci_dev *dev2; 179 struct pci_dev *dev2;
179 int ret = -ENODEV; 180 int ret = -ENODEV;
@@ -190,7 +191,7 @@ static int __devinit cy82c693_init_one(struct pci_dev *dev, const struct pci_dev
190 return ret; 191 return ret;
191} 192}
192 193
193static void __devexit cy82c693_remove(struct pci_dev *dev) 194static void cy82c693_remove(struct pci_dev *dev)
194{ 195{
195 struct ide_host *host = pci_get_drvdata(dev); 196 struct ide_host *host = pci_get_drvdata(dev);
196 struct pci_dev *dev2 = host->dev[1] ? to_pci_dev(host->dev[1]) : NULL; 197 struct pci_dev *dev2 = host->dev[1] ? to_pci_dev(host->dev[1]) : NULL;
@@ -209,7 +210,7 @@ static struct pci_driver cy82c693_pci_driver = {
209 .name = "Cypress_IDE", 210 .name = "Cypress_IDE",
210 .id_table = cy82c693_pci_tbl, 211 .id_table = cy82c693_pci_tbl,
211 .probe = cy82c693_init_one, 212 .probe = cy82c693_init_one,
212 .remove = __devexit_p(cy82c693_remove), 213 .remove = cy82c693_remove,
213 .suspend = ide_pci_suspend, 214 .suspend = ide_pci_suspend,
214 .resume = ide_pci_resume, 215 .resume = ide_pci_resume,
215}; 216};
diff --git a/drivers/ide/delkin_cb.c b/drivers/ide/delkin_cb.c
index 1e10eba62ceb..7e27d3295e55 100644
--- a/drivers/ide/delkin_cb.c
+++ b/drivers/ide/delkin_cb.c
@@ -71,8 +71,7 @@ static const struct ide_port_info delkin_cb_port_info = {
71 .chipset = ide_pci, 71 .chipset = ide_pci,
72}; 72};
73 73
74static int __devinit 74static int delkin_cb_probe(struct pci_dev *dev, const struct pci_device_id *id)
75delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id)
76{ 75{
77 struct ide_host *host; 76 struct ide_host *host;
78 unsigned long base; 77 unsigned long base;
@@ -158,7 +157,7 @@ static int delkin_cb_resume(struct pci_dev *dev)
158#define delkin_cb_resume NULL 157#define delkin_cb_resume NULL
159#endif 158#endif
160 159
161static struct pci_device_id delkin_cb_pci_tbl[] __devinitdata = { 160static struct pci_device_id delkin_cb_pci_tbl[] = {
162 { 0x1145, 0xf021, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 161 { 0x1145, 0xf021, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
163 { 0x1145, 0xf024, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 162 { 0x1145, 0xf024, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
164 { 0, }, 163 { 0, },
diff --git a/drivers/ide/hpt366.c b/drivers/ide/hpt366.c
index 4aec3b87ff91..696b6c1ec940 100644
--- a/drivers/ide/hpt366.c
+++ b/drivers/ide/hpt366.c
@@ -443,7 +443,7 @@ static struct hpt_timings hpt37x_timings = {
443 } 443 }
444}; 444};
445 445
446static const struct hpt_info hpt36x __devinitconst = { 446static const struct hpt_info hpt36x = {
447 .chip_name = "HPT36x", 447 .chip_name = "HPT36x",
448 .chip_type = HPT36x, 448 .chip_type = HPT36x,
449 .udma_mask = HPT366_ALLOW_ATA66_3 ? (HPT366_ALLOW_ATA66_4 ? ATA_UDMA4 : ATA_UDMA3) : ATA_UDMA2, 449 .udma_mask = HPT366_ALLOW_ATA66_3 ? (HPT366_ALLOW_ATA66_4 ? ATA_UDMA4 : ATA_UDMA3) : ATA_UDMA2,
@@ -451,7 +451,7 @@ static const struct hpt_info hpt36x __devinitconst = {
451 .timings = &hpt36x_timings 451 .timings = &hpt36x_timings
452}; 452};
453 453
454static const struct hpt_info hpt370 __devinitconst = { 454static const struct hpt_info hpt370 = {
455 .chip_name = "HPT370", 455 .chip_name = "HPT370",
456 .chip_type = HPT370, 456 .chip_type = HPT370,
457 .udma_mask = HPT370_ALLOW_ATA100_5 ? ATA_UDMA5 : ATA_UDMA4, 457 .udma_mask = HPT370_ALLOW_ATA100_5 ? ATA_UDMA5 : ATA_UDMA4,
@@ -459,7 +459,7 @@ static const struct hpt_info hpt370 __devinitconst = {
459 .timings = &hpt37x_timings 459 .timings = &hpt37x_timings
460}; 460};
461 461
462static const struct hpt_info hpt370a __devinitconst = { 462static const struct hpt_info hpt370a = {
463 .chip_name = "HPT370A", 463 .chip_name = "HPT370A",
464 .chip_type = HPT370A, 464 .chip_type = HPT370A,
465 .udma_mask = HPT370_ALLOW_ATA100_5 ? ATA_UDMA5 : ATA_UDMA4, 465 .udma_mask = HPT370_ALLOW_ATA100_5 ? ATA_UDMA5 : ATA_UDMA4,
@@ -467,7 +467,7 @@ static const struct hpt_info hpt370a __devinitconst = {
467 .timings = &hpt37x_timings 467 .timings = &hpt37x_timings
468}; 468};
469 469
470static const struct hpt_info hpt374 __devinitconst = { 470static const struct hpt_info hpt374 = {
471 .chip_name = "HPT374", 471 .chip_name = "HPT374",
472 .chip_type = HPT374, 472 .chip_type = HPT374,
473 .udma_mask = ATA_UDMA5, 473 .udma_mask = ATA_UDMA5,
@@ -475,7 +475,7 @@ static const struct hpt_info hpt374 __devinitconst = {
475 .timings = &hpt37x_timings 475 .timings = &hpt37x_timings
476}; 476};
477 477
478static const struct hpt_info hpt372 __devinitconst = { 478static const struct hpt_info hpt372 = {
479 .chip_name = "HPT372", 479 .chip_name = "HPT372",
480 .chip_type = HPT372, 480 .chip_type = HPT372,
481 .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, 481 .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
@@ -483,7 +483,7 @@ static const struct hpt_info hpt372 __devinitconst = {
483 .timings = &hpt37x_timings 483 .timings = &hpt37x_timings
484}; 484};
485 485
486static const struct hpt_info hpt372a __devinitconst = { 486static const struct hpt_info hpt372a = {
487 .chip_name = "HPT372A", 487 .chip_name = "HPT372A",
488 .chip_type = HPT372A, 488 .chip_type = HPT372A,
489 .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, 489 .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
@@ -491,7 +491,7 @@ static const struct hpt_info hpt372a __devinitconst = {
491 .timings = &hpt37x_timings 491 .timings = &hpt37x_timings
492}; 492};
493 493
494static const struct hpt_info hpt302 __devinitconst = { 494static const struct hpt_info hpt302 = {
495 .chip_name = "HPT302", 495 .chip_name = "HPT302",
496 .chip_type = HPT302, 496 .chip_type = HPT302,
497 .udma_mask = HPT302_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, 497 .udma_mask = HPT302_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
@@ -499,7 +499,7 @@ static const struct hpt_info hpt302 __devinitconst = {
499 .timings = &hpt37x_timings 499 .timings = &hpt37x_timings
500}; 500};
501 501
502static const struct hpt_info hpt371 __devinitconst = { 502static const struct hpt_info hpt371 = {
503 .chip_name = "HPT371", 503 .chip_name = "HPT371",
504 .chip_type = HPT371, 504 .chip_type = HPT371,
505 .udma_mask = HPT371_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, 505 .udma_mask = HPT371_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
@@ -507,7 +507,7 @@ static const struct hpt_info hpt371 __devinitconst = {
507 .timings = &hpt37x_timings 507 .timings = &hpt37x_timings
508}; 508};
509 509
510static const struct hpt_info hpt372n __devinitconst = { 510static const struct hpt_info hpt372n = {
511 .chip_name = "HPT372N", 511 .chip_name = "HPT372N",
512 .chip_type = HPT372N, 512 .chip_type = HPT372N,
513 .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, 513 .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
@@ -515,7 +515,7 @@ static const struct hpt_info hpt372n __devinitconst = {
515 .timings = &hpt37x_timings 515 .timings = &hpt37x_timings
516}; 516};
517 517
518static const struct hpt_info hpt302n __devinitconst = { 518static const struct hpt_info hpt302n = {
519 .chip_name = "HPT302N", 519 .chip_name = "HPT302N",
520 .chip_type = HPT302N, 520 .chip_type = HPT302N,
521 .udma_mask = HPT302_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, 521 .udma_mask = HPT302_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
@@ -523,7 +523,7 @@ static const struct hpt_info hpt302n __devinitconst = {
523 .timings = &hpt37x_timings 523 .timings = &hpt37x_timings
524}; 524};
525 525
526static const struct hpt_info hpt371n __devinitconst = { 526static const struct hpt_info hpt371n = {
527 .chip_name = "HPT371N", 527 .chip_name = "HPT371N",
528 .chip_type = HPT371N, 528 .chip_type = HPT371N,
529 .udma_mask = HPT371_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, 529 .udma_mask = HPT371_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
@@ -1197,7 +1197,7 @@ static u8 hpt3xx_cable_detect(ide_hwif_t *hwif)
1197 return (scr1 & ata66) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; 1197 return (scr1 & ata66) ? ATA_CBL_PATA40 : ATA_CBL_PATA80;
1198} 1198}
1199 1199
1200static void __devinit init_hwif_hpt366(ide_hwif_t *hwif) 1200static void init_hwif_hpt366(ide_hwif_t *hwif)
1201{ 1201{
1202 struct hpt_info *info = hpt3xx_get_info(hwif->dev); 1202 struct hpt_info *info = hpt3xx_get_info(hwif->dev);
1203 u8 chip_type = info->chip_type; 1203 u8 chip_type = info->chip_type;
@@ -1221,7 +1221,7 @@ static void __devinit init_hwif_hpt366(ide_hwif_t *hwif)
1221 } 1221 }
1222} 1222}
1223 1223
1224static int __devinit init_dma_hpt366(ide_hwif_t *hwif, 1224static int init_dma_hpt366(ide_hwif_t *hwif,
1225 const struct ide_port_info *d) 1225 const struct ide_port_info *d)
1226{ 1226{
1227 struct pci_dev *dev = to_pci_dev(hwif->dev); 1227 struct pci_dev *dev = to_pci_dev(hwif->dev);
@@ -1265,7 +1265,7 @@ static int __devinit init_dma_hpt366(ide_hwif_t *hwif,
1265 return 0; 1265 return 0;
1266} 1266}
1267 1267
1268static void __devinit hpt374_init(struct pci_dev *dev, struct pci_dev *dev2) 1268static void hpt374_init(struct pci_dev *dev, struct pci_dev *dev2)
1269{ 1269{
1270 if (dev2->irq != dev->irq) { 1270 if (dev2->irq != dev->irq) {
1271 /* FIXME: we need a core pci_set_interrupt() */ 1271 /* FIXME: we need a core pci_set_interrupt() */
@@ -1275,7 +1275,7 @@ static void __devinit hpt374_init(struct pci_dev *dev, struct pci_dev *dev2)
1275 } 1275 }
1276} 1276}
1277 1277
1278static void __devinit hpt371_init(struct pci_dev *dev) 1278static void hpt371_init(struct pci_dev *dev)
1279{ 1279{
1280 u8 mcr1 = 0; 1280 u8 mcr1 = 0;
1281 1281
@@ -1290,7 +1290,7 @@ static void __devinit hpt371_init(struct pci_dev *dev)
1290 pci_write_config_byte(dev, 0x50, mcr1 & ~0x04); 1290 pci_write_config_byte(dev, 0x50, mcr1 & ~0x04);
1291} 1291}
1292 1292
1293static int __devinit hpt36x_init(struct pci_dev *dev, struct pci_dev *dev2) 1293static int hpt36x_init(struct pci_dev *dev, struct pci_dev *dev2)
1294{ 1294{
1295 u8 mcr1 = 0, pin1 = 0, pin2 = 0; 1295 u8 mcr1 = 0, pin1 = 0, pin2 = 0;
1296 1296
@@ -1361,7 +1361,7 @@ static const struct ide_dma_ops hpt36x_dma_ops = {
1361 .dma_sff_read_status = ide_dma_sff_read_status, 1361 .dma_sff_read_status = ide_dma_sff_read_status,
1362}; 1362};
1363 1363
1364static const struct ide_port_info hpt366_chipsets[] __devinitconst = { 1364static const struct ide_port_info hpt366_chipsets[] = {
1365 { /* 0: HPT36x */ 1365 { /* 0: HPT36x */
1366 .name = DRV_NAME, 1366 .name = DRV_NAME,
1367 .init_chipset = init_chipset_hpt366, 1367 .init_chipset = init_chipset_hpt366,
@@ -1402,7 +1402,7 @@ static const struct ide_port_info hpt366_chipsets[] __devinitconst = {
1402 * Called when the PCI registration layer (or the IDE initialization) 1402 * Called when the PCI registration layer (or the IDE initialization)
1403 * finds a device matching our IDE device tables. 1403 * finds a device matching our IDE device tables.
1404 */ 1404 */
1405static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_device_id *id) 1405static int hpt366_init_one(struct pci_dev *dev, const struct pci_device_id *id)
1406{ 1406{
1407 const struct hpt_info *info = NULL; 1407 const struct hpt_info *info = NULL;
1408 struct hpt_info *dyn_info; 1408 struct hpt_info *dyn_info;
@@ -1499,7 +1499,7 @@ static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_devic
1499 return ret; 1499 return ret;
1500} 1500}
1501 1501
1502static void __devexit hpt366_remove(struct pci_dev *dev) 1502static void hpt366_remove(struct pci_dev *dev)
1503{ 1503{
1504 struct ide_host *host = pci_get_drvdata(dev); 1504 struct ide_host *host = pci_get_drvdata(dev);
1505 struct ide_info *info = host->host_priv; 1505 struct ide_info *info = host->host_priv;
@@ -1510,7 +1510,7 @@ static void __devexit hpt366_remove(struct pci_dev *dev)
1510 kfree(info); 1510 kfree(info);
1511} 1511}
1512 1512
1513static const struct pci_device_id hpt366_pci_tbl[] __devinitconst = { 1513static const struct pci_device_id hpt366_pci_tbl[] = {
1514 { PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT366), 0 }, 1514 { PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT366), 0 },
1515 { PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT372), 1 }, 1515 { PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT372), 1 },
1516 { PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT302), 2 }, 1516 { PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT302), 2 },
@@ -1525,7 +1525,7 @@ static struct pci_driver hpt366_pci_driver = {
1525 .name = "HPT366_IDE", 1525 .name = "HPT366_IDE",
1526 .id_table = hpt366_pci_tbl, 1526 .id_table = hpt366_pci_tbl,
1527 .probe = hpt366_init_one, 1527 .probe = hpt366_init_one,
1528 .remove = __devexit_p(hpt366_remove), 1528 .remove = hpt366_remove,
1529 .suspend = ide_pci_suspend, 1529 .suspend = ide_pci_suspend,
1530 .resume = ide_pci_resume, 1530 .resume = ide_pci_resume,
1531}; 1531};
diff --git a/drivers/ide/icside.c b/drivers/ide/icside.c
index e640d0ac3af6..9f0a48e39b8a 100644
--- a/drivers/ide/icside.c
+++ b/drivers/ide/icside.c
@@ -406,8 +406,8 @@ static const struct ide_port_info icside_v5_port_info = {
406 .chipset = ide_acorn, 406 .chipset = ide_acorn,
407}; 407};
408 408
409static int __devinit 409static int icside_register_v5(struct icside_state *state,
410icside_register_v5(struct icside_state *state, struct expansion_card *ec) 410 struct expansion_card *ec)
411{ 411{
412 void __iomem *base; 412 void __iomem *base;
413 struct ide_host *host; 413 struct ide_host *host;
@@ -460,8 +460,8 @@ static const struct ide_port_info icside_v6_port_info __initconst = {
460 .chipset = ide_acorn, 460 .chipset = ide_acorn,
461}; 461};
462 462
463static int __devinit 463static int icside_register_v6(struct icside_state *state,
464icside_register_v6(struct icside_state *state, struct expansion_card *ec) 464 struct expansion_card *ec)
465{ 465{
466 void __iomem *ioc_base, *easi_base; 466 void __iomem *ioc_base, *easi_base;
467 struct ide_host *host; 467 struct ide_host *host;
@@ -537,8 +537,7 @@ out:
537 return ret; 537 return ret;
538} 538}
539 539
540static int __devinit 540static int icside_probe(struct expansion_card *ec, const struct ecard_id *id)
541icside_probe(struct expansion_card *ec, const struct ecard_id *id)
542{ 541{
543 struct icside_state *state; 542 struct icside_state *state;
544 void __iomem *idmem; 543 void __iomem *idmem;
@@ -604,7 +603,7 @@ icside_probe(struct expansion_card *ec, const struct ecard_id *id)
604 return ret; 603 return ret;
605} 604}
606 605
607static void __devexit icside_remove(struct expansion_card *ec) 606static void icside_remove(struct expansion_card *ec)
608{ 607{
609 struct icside_state *state = ecard_get_drvdata(ec); 608 struct icside_state *state = ecard_get_drvdata(ec);
610 609
@@ -666,7 +665,7 @@ static const struct ecard_id icside_ids[] = {
666 665
667static struct ecard_driver icside_driver = { 666static struct ecard_driver icside_driver = {
668 .probe = icside_probe, 667 .probe = icside_probe,
669 .remove = __devexit_p(icside_remove), 668 .remove = icside_remove,
670 .shutdown = icside_shutdown, 669 .shutdown = icside_shutdown,
671 .id_table = icside_ids, 670 .id_table = icside_ids,
672 .drv = { 671 .drv = {
diff --git a/drivers/ide/ide-pci-generic.c b/drivers/ide/ide-pci-generic.c
index dab5b670bfbf..673420db953f 100644
--- a/drivers/ide/ide-pci-generic.c
+++ b/drivers/ide/ide-pci-generic.c
@@ -53,7 +53,7 @@ static const struct ide_port_ops netcell_port_ops = {
53 .udma_mask = ATA_UDMA6, \ 53 .udma_mask = ATA_UDMA6, \
54 } 54 }
55 55
56static const struct ide_port_info generic_chipsets[] __devinitconst = { 56static const struct ide_port_info generic_chipsets[] = {
57 /* 0: Unknown */ 57 /* 0: Unknown */
58 DECLARE_GENERIC_PCI_DEV(0), 58 DECLARE_GENERIC_PCI_DEV(0),
59 59
@@ -103,7 +103,7 @@ static const struct ide_port_info generic_chipsets[] __devinitconst = {
103 * finds a device matching our IDE device tables. 103 * finds a device matching our IDE device tables.
104 */ 104 */
105 105
106static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_device_id *id) 106static int generic_init_one(struct pci_dev *dev, const struct pci_device_id *id)
107{ 107{
108 const struct ide_port_info *d = &generic_chipsets[id->driver_data]; 108 const struct ide_port_info *d = &generic_chipsets[id->driver_data];
109 int ret = -ENODEV; 109 int ret = -ENODEV;
diff --git a/drivers/ide/ide_platform.c b/drivers/ide/ide_platform.c
index 962693b10a1c..ba4bfbead24b 100644
--- a/drivers/ide/ide_platform.c
+++ b/drivers/ide/ide_platform.c
@@ -22,11 +22,9 @@
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <linux/io.h> 23#include <linux/io.h>
24 24
25static void __devinit plat_ide_setup_ports(struct ide_hw *hw, 25static void plat_ide_setup_ports(struct ide_hw *hw, void __iomem *base,
26 void __iomem *base, 26 void __iomem *ctrl,
27 void __iomem *ctrl, 27 struct pata_platform_info *pdata, int irq)
28 struct pata_platform_info *pdata,
29 int irq)
30{ 28{
31 unsigned long port = (unsigned long)base; 29 unsigned long port = (unsigned long)base;
32 int i; 30 int i;
@@ -48,7 +46,7 @@ static const struct ide_port_info platform_ide_port_info = {
48 .chipset = ide_generic, 46 .chipset = ide_generic,
49}; 47};
50 48
51static int __devinit plat_ide_probe(struct platform_device *pdev) 49static int plat_ide_probe(struct platform_device *pdev)
52{ 50{
53 struct resource *res_base, *res_alt, *res_irq; 51 struct resource *res_base, *res_alt, *res_irq;
54 void __iomem *base, *alt_base; 52 void __iomem *base, *alt_base;
@@ -115,7 +113,7 @@ out:
115 return ret; 113 return ret;
116} 114}
117 115
118static int __devexit plat_ide_remove(struct platform_device *pdev) 116static int plat_ide_remove(struct platform_device *pdev)
119{ 117{
120 struct ide_host *host = dev_get_drvdata(&pdev->dev); 118 struct ide_host *host = dev_get_drvdata(&pdev->dev);
121 119
@@ -130,7 +128,7 @@ static struct platform_driver platform_ide_driver = {
130 .owner = THIS_MODULE, 128 .owner = THIS_MODULE,
131 }, 129 },
132 .probe = plat_ide_probe, 130 .probe = plat_ide_probe,
133 .remove = __devexit_p(plat_ide_remove), 131 .remove = plat_ide_remove,
134}; 132};
135 133
136static int __init platform_ide_init(void) 134static int __init platform_ide_init(void)
diff --git a/drivers/ide/it8172.c b/drivers/ide/it8172.c
index d5dd180c4b85..b6f674ab4fb7 100644
--- a/drivers/ide/it8172.c
+++ b/drivers/ide/it8172.c
@@ -115,7 +115,7 @@ static const struct ide_port_ops it8172_port_ops = {
115 .set_dma_mode = it8172_set_dma_mode, 115 .set_dma_mode = it8172_set_dma_mode,
116}; 116};
117 117
118static const struct ide_port_info it8172_port_info __devinitconst = { 118static const struct ide_port_info it8172_port_info = {
119 .name = DRV_NAME, 119 .name = DRV_NAME,
120 .port_ops = &it8172_port_ops, 120 .port_ops = &it8172_port_ops,
121 .enablebits = { {0x41, 0x80, 0x80}, {0x00, 0x00, 0x00} }, 121 .enablebits = { {0x41, 0x80, 0x80}, {0x00, 0x00, 0x00} },
@@ -125,8 +125,7 @@ static const struct ide_port_info it8172_port_info __devinitconst = {
125 .udma_mask = ATA_UDMA2, 125 .udma_mask = ATA_UDMA2,
126}; 126};
127 127
128static int __devinit it8172_init_one(struct pci_dev *dev, 128static int it8172_init_one(struct pci_dev *dev, const struct pci_device_id *id)
129 const struct pci_device_id *id)
130{ 129{
131 if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE) 130 if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE)
132 return -ENODEV; /* IT8172 is more than an IDE controller */ 131 return -ENODEV; /* IT8172 is more than an IDE controller */
diff --git a/drivers/ide/it8213.c b/drivers/ide/it8213.c
index 1847aeb5450a..6b92846682fc 100644
--- a/drivers/ide/it8213.c
+++ b/drivers/ide/it8213.c
@@ -156,7 +156,7 @@ static const struct ide_port_ops it8213_port_ops = {
156 .cable_detect = it8213_cable_detect, 156 .cable_detect = it8213_cable_detect,
157}; 157};
158 158
159static const struct ide_port_info it8213_chipset __devinitconst = { 159static const struct ide_port_info it8213_chipset = {
160 .name = DRV_NAME, 160 .name = DRV_NAME,
161 .enablebits = { {0x41, 0x80, 0x80} }, 161 .enablebits = { {0x41, 0x80, 0x80} },
162 .port_ops = &it8213_port_ops, 162 .port_ops = &it8213_port_ops,
@@ -177,7 +177,7 @@ static const struct ide_port_info it8213_chipset __devinitconst = {
177 * standard helper functions to do almost all the work for us. 177 * standard helper functions to do almost all the work for us.
178 */ 178 */
179 179
180static int __devinit it8213_init_one(struct pci_dev *dev, const struct pci_device_id *id) 180static int it8213_init_one(struct pci_dev *dev, const struct pci_device_id *id)
181{ 181{
182 return ide_pci_init_one(dev, &it8213_chipset, NULL); 182 return ide_pci_init_one(dev, &it8213_chipset, NULL);
183} 183}
diff --git a/drivers/ide/it821x.c b/drivers/ide/it821x.c
index c5611dbca342..f01ba4606be0 100644
--- a/drivers/ide/it821x.c
+++ b/drivers/ide/it821x.c
@@ -528,7 +528,7 @@ static struct ide_dma_ops it821x_pass_through_dma_ops = {
528 * ide DMA handlers appropriately 528 * ide DMA handlers appropriately
529 */ 529 */
530 530
531static void __devinit init_hwif_it821x(ide_hwif_t *hwif) 531static void init_hwif_it821x(ide_hwif_t *hwif)
532{ 532{
533 struct pci_dev *dev = to_pci_dev(hwif->dev); 533 struct pci_dev *dev = to_pci_dev(hwif->dev);
534 struct ide_host *host = pci_get_drvdata(dev); 534 struct ide_host *host = pci_get_drvdata(dev);
@@ -630,7 +630,7 @@ static const struct ide_port_ops it821x_port_ops = {
630 .cable_detect = it821x_cable_detect, 630 .cable_detect = it821x_cable_detect,
631}; 631};
632 632
633static const struct ide_port_info it821x_chipset __devinitconst = { 633static const struct ide_port_info it821x_chipset = {
634 .name = DRV_NAME, 634 .name = DRV_NAME,
635 .init_chipset = init_chipset_it821x, 635 .init_chipset = init_chipset_it821x,
636 .init_hwif = init_hwif_it821x, 636 .init_hwif = init_hwif_it821x,
@@ -647,7 +647,7 @@ static const struct ide_port_info it821x_chipset __devinitconst = {
647 * We then use the IDE PCI generic helper to do most of the work. 647 * We then use the IDE PCI generic helper to do most of the work.
648 */ 648 */
649 649
650static int __devinit it821x_init_one(struct pci_dev *dev, const struct pci_device_id *id) 650static int it821x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
651{ 651{
652 struct it821x_dev *itdevs; 652 struct it821x_dev *itdevs;
653 int rc; 653 int rc;
@@ -667,7 +667,7 @@ static int __devinit it821x_init_one(struct pci_dev *dev, const struct pci_devic
667 return rc; 667 return rc;
668} 668}
669 669
670static void __devexit it821x_remove(struct pci_dev *dev) 670static void it821x_remove(struct pci_dev *dev)
671{ 671{
672 struct ide_host *host = pci_get_drvdata(dev); 672 struct ide_host *host = pci_get_drvdata(dev);
673 struct it821x_dev *itdevs = host->host_priv; 673 struct it821x_dev *itdevs = host->host_priv;
@@ -689,7 +689,7 @@ static struct pci_driver it821x_pci_driver = {
689 .name = "ITE821x IDE", 689 .name = "ITE821x IDE",
690 .id_table = it821x_pci_tbl, 690 .id_table = it821x_pci_tbl,
691 .probe = it821x_init_one, 691 .probe = it821x_init_one,
692 .remove = __devexit_p(it821x_remove), 692 .remove = it821x_remove,
693 .suspend = ide_pci_suspend, 693 .suspend = ide_pci_suspend,
694 .resume = ide_pci_resume, 694 .resume = ide_pci_resume,
695}; 695};
diff --git a/drivers/ide/jmicron.c b/drivers/ide/jmicron.c
index efddd7d9f92d..ae6480dcbadf 100644
--- a/drivers/ide/jmicron.c
+++ b/drivers/ide/jmicron.c
@@ -102,7 +102,7 @@ static const struct ide_port_ops jmicron_port_ops = {
102 .cable_detect = jmicron_cable_detect, 102 .cable_detect = jmicron_cable_detect,
103}; 103};
104 104
105static const struct ide_port_info jmicron_chipset __devinitconst = { 105static const struct ide_port_info jmicron_chipset = {
106 .name = DRV_NAME, 106 .name = DRV_NAME,
107 .enablebits = { { 0x40, 0x01, 0x01 }, { 0x40, 0x10, 0x10 } }, 107 .enablebits = { { 0x40, 0x01, 0x01 }, { 0x40, 0x10, 0x10 } },
108 .port_ops = &jmicron_port_ops, 108 .port_ops = &jmicron_port_ops,
@@ -120,7 +120,7 @@ static const struct ide_port_info jmicron_chipset __devinitconst = {
120 * We then use the IDE PCI generic helper to do most of the work. 120 * We then use the IDE PCI generic helper to do most of the work.
121 */ 121 */
122 122
123static int __devinit jmicron_init_one(struct pci_dev *dev, const struct pci_device_id *id) 123static int jmicron_init_one(struct pci_dev *dev, const struct pci_device_id *id)
124{ 124{
125 return ide_pci_init_one(dev, &jmicron_chipset, NULL); 125 return ide_pci_init_one(dev, &jmicron_chipset, NULL);
126} 126}
diff --git a/drivers/ide/ns87415.c b/drivers/ide/ns87415.c
index 73f78d872d55..392fd106edf1 100644
--- a/drivers/ide/ns87415.c
+++ b/drivers/ide/ns87415.c
@@ -96,7 +96,7 @@ static const struct ide_tp_ops superio_tp_ops = {
96 .output_data = ide_output_data, 96 .output_data = ide_output_data,
97}; 97};
98 98
99static void __devinit superio_init_iops(struct hwif_s *hwif) 99static void superio_init_iops(struct hwif_s *hwif)
100{ 100{
101 struct pci_dev *pdev = to_pci_dev(hwif->dev); 101 struct pci_dev *pdev = to_pci_dev(hwif->dev);
102 u32 dma_stat; 102 u32 dma_stat;
@@ -201,7 +201,7 @@ static int ns87415_dma_end(ide_drive_t *drive)
201 return (dma_stat & 7) != 4; 201 return (dma_stat & 7) != 4;
202} 202}
203 203
204static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) 204static void init_hwif_ns87415 (ide_hwif_t *hwif)
205{ 205{
206 struct pci_dev *dev = to_pci_dev(hwif->dev); 206 struct pci_dev *dev = to_pci_dev(hwif->dev);
207 unsigned int ctrl, using_inta; 207 unsigned int ctrl, using_inta;
@@ -293,7 +293,7 @@ static const struct ide_dma_ops ns87415_dma_ops = {
293 .dma_sff_read_status = superio_dma_sff_read_status, 293 .dma_sff_read_status = superio_dma_sff_read_status,
294}; 294};
295 295
296static const struct ide_port_info ns87415_chipset __devinitconst = { 296static const struct ide_port_info ns87415_chipset = {
297 .name = DRV_NAME, 297 .name = DRV_NAME,
298 .init_hwif = init_hwif_ns87415, 298 .init_hwif = init_hwif_ns87415,
299 .tp_ops = &ns87415_tp_ops, 299 .tp_ops = &ns87415_tp_ops,
@@ -302,7 +302,7 @@ static const struct ide_port_info ns87415_chipset __devinitconst = {
302 IDE_HFLAG_NO_ATAPI_DMA, 302 IDE_HFLAG_NO_ATAPI_DMA,
303}; 303};
304 304
305static int __devinit ns87415_init_one(struct pci_dev *dev, const struct pci_device_id *id) 305static int ns87415_init_one(struct pci_dev *dev, const struct pci_device_id *id)
306{ 306{
307 struct ide_port_info d = ns87415_chipset; 307 struct ide_port_info d = ns87415_chipset;
308 308
diff --git a/drivers/ide/opti621.c b/drivers/ide/opti621.c
index 39edc66cb96c..26a45007e535 100644
--- a/drivers/ide/opti621.c
+++ b/drivers/ide/opti621.c
@@ -131,7 +131,7 @@ static const struct ide_port_ops opti621_port_ops = {
131 .set_pio_mode = opti621_set_pio_mode, 131 .set_pio_mode = opti621_set_pio_mode,
132}; 132};
133 133
134static const struct ide_port_info opti621_chipset __devinitconst = { 134static const struct ide_port_info opti621_chipset = {
135 .name = DRV_NAME, 135 .name = DRV_NAME,
136 .enablebits = { {0x45, 0x80, 0x00}, {0x40, 0x08, 0x00} }, 136 .enablebits = { {0x45, 0x80, 0x00}, {0x40, 0x08, 0x00} },
137 .port_ops = &opti621_port_ops, 137 .port_ops = &opti621_port_ops,
@@ -139,7 +139,7 @@ static const struct ide_port_info opti621_chipset __devinitconst = {
139 .pio_mask = ATA_PIO4, 139 .pio_mask = ATA_PIO4,
140}; 140};
141 141
142static int __devinit opti621_init_one(struct pci_dev *dev, const struct pci_device_id *id) 142static int opti621_init_one(struct pci_dev *dev, const struct pci_device_id *id)
143{ 143{
144 return ide_pci_init_one(dev, &opti621_chipset, NULL); 144 return ide_pci_init_one(dev, &opti621_chipset, NULL);
145} 145}
diff --git a/drivers/ide/palm_bk3710.c b/drivers/ide/palm_bk3710.c
index 712c7904d03e..6107cc4ee012 100644
--- a/drivers/ide/palm_bk3710.c
+++ b/drivers/ide/palm_bk3710.c
@@ -220,7 +220,7 @@ static void palm_bk3710_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
220 palm_bk3710_setpiomode(base, mate, is_slave, cycle_time, pio); 220 palm_bk3710_setpiomode(base, mate, is_slave, cycle_time, pio);
221} 221}
222 222
223static void __devinit palm_bk3710_chipinit(void __iomem *base) 223static void palm_bk3710_chipinit(void __iomem *base)
224{ 224{
225 /* 225 /*
226 * REVISIT: the ATA reset signal needs to be managed through a 226 * REVISIT: the ATA reset signal needs to be managed through a
@@ -282,8 +282,7 @@ static u8 palm_bk3710_cable_detect(ide_hwif_t *hwif)
282 return ATA_CBL_PATA80; 282 return ATA_CBL_PATA80;
283} 283}
284 284
285static int __devinit palm_bk3710_init_dma(ide_hwif_t *hwif, 285static int palm_bk3710_init_dma(ide_hwif_t *hwif, const struct ide_port_info *d)
286 const struct ide_port_info *d)
287{ 286{
288 printk(KERN_INFO " %s: MMIO-DMA\n", hwif->name); 287 printk(KERN_INFO " %s: MMIO-DMA\n", hwif->name);
289 288
@@ -301,7 +300,7 @@ static const struct ide_port_ops palm_bk3710_ports_ops = {
301 .cable_detect = palm_bk3710_cable_detect, 300 .cable_detect = palm_bk3710_cable_detect,
302}; 301};
303 302
304static struct ide_port_info __devinitdata palm_bk3710_port_info = { 303static struct ide_port_info palm_bk3710_port_info = {
305 .init_dma = palm_bk3710_init_dma, 304 .init_dma = palm_bk3710_init_dma,
306 .port_ops = &palm_bk3710_ports_ops, 305 .port_ops = &palm_bk3710_ports_ops,
307 .dma_ops = &sff_dma_ops, 306 .dma_ops = &sff_dma_ops,
diff --git a/drivers/ide/pdc202xx_new.c b/drivers/ide/pdc202xx_new.c
index 2e5ceb62fb3b..df73cbd9387e 100644
--- a/drivers/ide/pdc202xx_new.c
+++ b/drivers/ide/pdc202xx_new.c
@@ -422,7 +422,7 @@ static int init_chipset_pdcnew(struct pci_dev *dev)
422 return 0; 422 return 0;
423} 423}
424 424
425static struct pci_dev * __devinit pdc20270_get_dev2(struct pci_dev *dev) 425static struct pci_dev *pdc20270_get_dev2(struct pci_dev *dev)
426{ 426{
427 struct pci_dev *dev2; 427 struct pci_dev *dev2;
428 428
@@ -465,7 +465,7 @@ static const struct ide_port_ops pdcnew_port_ops = {
465 .udma_mask = udma, \ 465 .udma_mask = udma, \
466 } 466 }
467 467
468static const struct ide_port_info pdcnew_chipsets[] __devinitconst = { 468static const struct ide_port_info pdcnew_chipsets[] = {
469 /* 0: PDC202{68,70} */ DECLARE_PDCNEW_DEV(ATA_UDMA5), 469 /* 0: PDC202{68,70} */ DECLARE_PDCNEW_DEV(ATA_UDMA5),
470 /* 1: PDC202{69,71,75,76,77} */ DECLARE_PDCNEW_DEV(ATA_UDMA6), 470 /* 1: PDC202{69,71,75,76,77} */ DECLARE_PDCNEW_DEV(ATA_UDMA6),
471}; 471};
@@ -479,7 +479,7 @@ static const struct ide_port_info pdcnew_chipsets[] __devinitconst = {
479 * finds a device matching our IDE device tables. 479 * finds a device matching our IDE device tables.
480 */ 480 */
481 481
482static int __devinit pdc202new_init_one(struct pci_dev *dev, const struct pci_device_id *id) 482static int pdc202new_init_one(struct pci_dev *dev, const struct pci_device_id *id)
483{ 483{
484 const struct ide_port_info *d = &pdcnew_chipsets[id->driver_data]; 484 const struct ide_port_info *d = &pdcnew_chipsets[id->driver_data];
485 struct pci_dev *bridge = dev->bus->self; 485 struct pci_dev *bridge = dev->bus->self;
@@ -514,7 +514,7 @@ static int __devinit pdc202new_init_one(struct pci_dev *dev, const struct pci_de
514 return ide_pci_init_one(dev, d, NULL); 514 return ide_pci_init_one(dev, d, NULL);
515} 515}
516 516
517static void __devexit pdc202new_remove(struct pci_dev *dev) 517static void pdc202new_remove(struct pci_dev *dev)
518{ 518{
519 struct ide_host *host = pci_get_drvdata(dev); 519 struct ide_host *host = pci_get_drvdata(dev);
520 struct pci_dev *dev2 = host->dev[1] ? to_pci_dev(host->dev[1]) : NULL; 520 struct pci_dev *dev2 = host->dev[1] ? to_pci_dev(host->dev[1]) : NULL;
@@ -539,7 +539,7 @@ static struct pci_driver pdc202new_pci_driver = {
539 .name = "Promise_IDE", 539 .name = "Promise_IDE",
540 .id_table = pdc202new_pci_tbl, 540 .id_table = pdc202new_pci_tbl,
541 .probe = pdc202new_init_one, 541 .probe = pdc202new_init_one,
542 .remove = __devexit_p(pdc202new_remove), 542 .remove = pdc202new_remove,
543 .suspend = ide_pci_suspend, 543 .suspend = ide_pci_suspend,
544 .resume = ide_pci_resume, 544 .resume = ide_pci_resume,
545}; 545};
diff --git a/drivers/ide/pdc202xx_old.c b/drivers/ide/pdc202xx_old.c
index 563451096812..224ad46d6cb2 100644
--- a/drivers/ide/pdc202xx_old.c
+++ b/drivers/ide/pdc202xx_old.c
@@ -211,8 +211,7 @@ out:
211 return 0; 211 return 0;
212} 212}
213 213
214static void __devinit pdc202ata4_fixup_irq(struct pci_dev *dev, 214static void pdc202ata4_fixup_irq(struct pci_dev *dev, const char *name)
215 const char *name)
216{ 215{
217 if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE) { 216 if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE) {
218 u8 irq = 0, irq2 = 0; 217 u8 irq = 0, irq2 = 0;
@@ -270,7 +269,7 @@ static const struct ide_dma_ops pdc2026x_dma_ops = {
270 .max_sectors = sectors, \ 269 .max_sectors = sectors, \
271 } 270 }
272 271
273static const struct ide_port_info pdc202xx_chipsets[] __devinitconst = { 272static const struct ide_port_info pdc202xx_chipsets[] = {
274 { /* 0: PDC20246 */ 273 { /* 0: PDC20246 */
275 .name = DRV_NAME, 274 .name = DRV_NAME,
276 .init_chipset = init_chipset_pdc202xx, 275 .init_chipset = init_chipset_pdc202xx,
@@ -297,7 +296,8 @@ static const struct ide_port_info pdc202xx_chipsets[] __devinitconst = {
297 * finds a device matching our IDE device tables. 296 * finds a device matching our IDE device tables.
298 */ 297 */
299 298
300static int __devinit pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) 299static int pdc202xx_init_one(struct pci_dev *dev,
300 const struct pci_device_id *id)
301{ 301{
302 const struct ide_port_info *d; 302 const struct ide_port_info *d;
303 u8 idx = id->driver_data; 303 u8 idx = id->driver_data;
diff --git a/drivers/ide/piix.c b/drivers/ide/piix.c
index fe0fd60cfc09..a671cead6ae7 100644
--- a/drivers/ide/piix.c
+++ b/drivers/ide/piix.c
@@ -297,7 +297,7 @@ static u8 piix_cable_detect(ide_hwif_t *hwif)
297 * capabilities of the hardware. 297 * capabilities of the hardware.
298 */ 298 */
299 299
300static void __devinit init_hwif_piix(ide_hwif_t *hwif) 300static void init_hwif_piix(ide_hwif_t *hwif)
301{ 301{
302 if (!hwif->dma_base) 302 if (!hwif->dma_base)
303 return; 303 return;
@@ -344,7 +344,7 @@ static const struct ide_port_ops ich_port_ops = {
344 .udma_mask = udma, \ 344 .udma_mask = udma, \
345 } 345 }
346 346
347static const struct ide_port_info piix_pci_info[] __devinitconst = { 347static const struct ide_port_info piix_pci_info[] = {
348 /* 0: MPIIX */ 348 /* 0: MPIIX */
349 { /* 349 { /*
350 * MPIIX actually has only a single IDE channel mapped to 350 * MPIIX actually has only a single IDE channel mapped to
@@ -382,7 +382,7 @@ static const struct ide_port_info piix_pci_info[] __devinitconst = {
382 * finds a device matching our IDE device tables. 382 * finds a device matching our IDE device tables.
383 */ 383 */
384 384
385static int __devinit piix_init_one(struct pci_dev *dev, const struct pci_device_id *id) 385static int piix_init_one(struct pci_dev *dev, const struct pci_device_id *id)
386{ 386{
387 return ide_pci_init_one(dev, &piix_pci_info[id->driver_data], NULL); 387 return ide_pci_init_one(dev, &piix_pci_info[id->driver_data], NULL);
388} 388}
@@ -394,7 +394,7 @@ static int __devinit piix_init_one(struct pci_dev *dev, const struct pci_device_
394 * they are found, disable use of DMA IDE 394 * they are found, disable use of DMA IDE
395 */ 395 */
396 396
397static void __devinit piix_check_450nx(void) 397static void piix_check_450nx(void)
398{ 398{
399 struct pci_dev *pdev = NULL; 399 struct pci_dev *pdev = NULL;
400 u16 cfg; 400 u16 cfg;
diff --git a/drivers/ide/pmac.c b/drivers/ide/pmac.c
index e944c7f705f7..bf83d7bb6bc6 100644
--- a/drivers/ide/pmac.c
+++ b/drivers/ide/pmac.c
@@ -1025,8 +1025,7 @@ static const struct ide_port_info pmac_port_info = {
1025 * Setup, register & probe an IDE channel driven by this driver, this is 1025 * Setup, register & probe an IDE channel driven by this driver, this is
1026 * called by one of the 2 probe functions (macio or PCI). 1026 * called by one of the 2 probe functions (macio or PCI).
1027 */ 1027 */
1028static int __devinit pmac_ide_setup_device(pmac_ide_hwif_t *pmif, 1028static int pmac_ide_setup_device(pmac_ide_hwif_t *pmif, struct ide_hw *hw)
1029 struct ide_hw *hw)
1030{ 1029{
1031 struct device_node *np = pmif->node; 1030 struct device_node *np = pmif->node;
1032 const int *bidp; 1031 const int *bidp;
@@ -1126,7 +1125,7 @@ static int __devinit pmac_ide_setup_device(pmac_ide_hwif_t *pmif,
1126 return rc; 1125 return rc;
1127} 1126}
1128 1127
1129static void __devinit pmac_ide_init_ports(struct ide_hw *hw, unsigned long base) 1128static void pmac_ide_init_ports(struct ide_hw *hw, unsigned long base)
1130{ 1129{
1131 int i; 1130 int i;
1132 1131
@@ -1139,8 +1138,8 @@ static void __devinit pmac_ide_init_ports(struct ide_hw *hw, unsigned long base)
1139/* 1138/*
1140 * Attach to a macio probed interface 1139 * Attach to a macio probed interface
1141 */ 1140 */
1142static int __devinit 1141static int pmac_ide_macio_attach(struct macio_dev *mdev,
1143pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match) 1142 const struct of_device_id *match)
1144{ 1143{
1145 void __iomem *base; 1144 void __iomem *base;
1146 unsigned long regbase; 1145 unsigned long regbase;
@@ -1262,8 +1261,8 @@ pmac_ide_macio_resume(struct macio_dev *mdev)
1262/* 1261/*
1263 * Attach to a PCI probed interface 1262 * Attach to a PCI probed interface
1264 */ 1263 */
1265static int __devinit 1264static int pmac_ide_pci_attach(struct pci_dev *pdev,
1266pmac_ide_pci_attach(struct pci_dev *pdev, const struct pci_device_id *id) 1265 const struct pci_device_id *id)
1267{ 1266{
1268 struct device_node *np; 1267 struct device_node *np;
1269 pmac_ide_hwif_t *pmif; 1268 pmac_ide_hwif_t *pmif;
@@ -1692,8 +1691,7 @@ static const struct ide_dma_ops pmac_dma_ops = {
1692 * Allocate the data structures needed for using DMA with an interface 1691 * Allocate the data structures needed for using DMA with an interface
1693 * and fill the proper list of functions pointers 1692 * and fill the proper list of functions pointers
1694 */ 1693 */
1695static int __devinit pmac_ide_init_dma(ide_hwif_t *hwif, 1694static int pmac_ide_init_dma(ide_hwif_t *hwif, const struct ide_port_info *d)
1696 const struct ide_port_info *d)
1697{ 1695{
1698 pmac_ide_hwif_t *pmif = 1696 pmac_ide_hwif_t *pmif =
1699 (pmac_ide_hwif_t *)dev_get_drvdata(hwif->gendev.parent); 1697 (pmac_ide_hwif_t *)dev_get_drvdata(hwif->gendev.parent);
diff --git a/drivers/ide/rapide.c b/drivers/ide/rapide.c
index 48d976aad7ab..d73c3d10087c 100644
--- a/drivers/ide/rapide.c
+++ b/drivers/ide/rapide.c
@@ -29,8 +29,7 @@ static void rapide_setup_ports(struct ide_hw *hw, void __iomem *base,
29 hw->irq = irq; 29 hw->irq = irq;
30} 30}
31 31
32static int __devinit 32static int rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
33rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
34{ 33{
35 void __iomem *base; 34 void __iomem *base;
36 struct ide_host *host; 35 struct ide_host *host;
@@ -64,7 +63,7 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
64 return ret; 63 return ret;
65} 64}
66 65
67static void __devexit rapide_remove(struct expansion_card *ec) 66static void rapide_remove(struct expansion_card *ec)
68{ 67{
69 struct ide_host *host = ecard_get_drvdata(ec); 68 struct ide_host *host = ecard_get_drvdata(ec);
70 69
@@ -82,7 +81,7 @@ static struct ecard_id rapide_ids[] = {
82 81
83static struct ecard_driver rapide_driver = { 82static struct ecard_driver rapide_driver = {
84 .probe = rapide_probe, 83 .probe = rapide_probe,
85 .remove = __devexit_p(rapide_remove), 84 .remove = rapide_remove,
86 .id_table = rapide_ids, 85 .id_table = rapide_ids,
87 .drv = { 86 .drv = {
88 .name = "rapide", 87 .name = "rapide",
diff --git a/drivers/ide/rz1000.c b/drivers/ide/rz1000.c
index c04173e9fc38..f4b66f7ec9fd 100644
--- a/drivers/ide/rz1000.c
+++ b/drivers/ide/rz1000.c
@@ -22,7 +22,7 @@
22 22
23#define DRV_NAME "rz1000" 23#define DRV_NAME "rz1000"
24 24
25static int __devinit rz1000_disable_readahead(struct pci_dev *dev) 25static int rz1000_disable_readahead(struct pci_dev *dev)
26{ 26{
27 u16 reg; 27 u16 reg;
28 28
@@ -38,12 +38,12 @@ static int __devinit rz1000_disable_readahead(struct pci_dev *dev)
38 } 38 }
39} 39}
40 40
41static const struct ide_port_info rz1000_chipset __devinitconst = { 41static const struct ide_port_info rz1000_chipset = {
42 .name = DRV_NAME, 42 .name = DRV_NAME,
43 .host_flags = IDE_HFLAG_NO_DMA, 43 .host_flags = IDE_HFLAG_NO_DMA,
44}; 44};
45 45
46static int __devinit rz1000_init_one(struct pci_dev *dev, const struct pci_device_id *id) 46static int rz1000_init_one(struct pci_dev *dev, const struct pci_device_id *id)
47{ 47{
48 struct ide_port_info d = rz1000_chipset; 48 struct ide_port_info d = rz1000_chipset;
49 int rc; 49 int rc;
diff --git a/drivers/ide/sc1200.c b/drivers/ide/sc1200.c
index d4758ebe77da..a5b701818405 100644
--- a/drivers/ide/sc1200.c
+++ b/drivers/ide/sc1200.c
@@ -291,7 +291,7 @@ static const struct ide_dma_ops sc1200_dma_ops = {
291 .dma_sff_read_status = ide_dma_sff_read_status, 291 .dma_sff_read_status = ide_dma_sff_read_status,
292}; 292};
293 293
294static const struct ide_port_info sc1200_chipset __devinitconst = { 294static const struct ide_port_info sc1200_chipset = {
295 .name = DRV_NAME, 295 .name = DRV_NAME,
296 .port_ops = &sc1200_port_ops, 296 .port_ops = &sc1200_port_ops,
297 .dma_ops = &sc1200_dma_ops, 297 .dma_ops = &sc1200_dma_ops,
@@ -303,7 +303,7 @@ static const struct ide_port_info sc1200_chipset __devinitconst = {
303 .udma_mask = ATA_UDMA2, 303 .udma_mask = ATA_UDMA2,
304}; 304};
305 305
306static int __devinit sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id) 306static int sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id)
307{ 307{
308 struct sc1200_saved_state *ss = NULL; 308 struct sc1200_saved_state *ss = NULL;
309 int rc; 309 int rc;
diff --git a/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c
index 970103810021..2a2d188b5d5b 100644
--- a/drivers/ide/scc_pata.c
+++ b/drivers/ide/scc_pata.c
@@ -585,8 +585,7 @@ static int scc_ide_setup_pci_device(struct pci_dev *dev,
585 * Perform the initial set up for this device. 585 * Perform the initial set up for this device.
586 */ 586 */
587 587
588static int __devinit init_setup_scc(struct pci_dev *dev, 588static int init_setup_scc(struct pci_dev *dev, const struct ide_port_info *d)
589 const struct ide_port_info *d)
590{ 589{
591 unsigned long ctl_base; 590 unsigned long ctl_base;
592 unsigned long dma_base; 591 unsigned long dma_base;
@@ -718,7 +717,7 @@ static void scc_output_data(ide_drive_t *drive, struct ide_cmd *cmd,
718 * 717 *
719 */ 718 */
720 719
721static void __devinit init_mmio_iops_scc(ide_hwif_t *hwif) 720static void init_mmio_iops_scc(ide_hwif_t *hwif)
722{ 721{
723 struct pci_dev *dev = to_pci_dev(hwif->dev); 722 struct pci_dev *dev = to_pci_dev(hwif->dev);
724 struct scc_ports *ports = pci_get_drvdata(dev); 723 struct scc_ports *ports = pci_get_drvdata(dev);
@@ -738,7 +737,7 @@ static void __devinit init_mmio_iops_scc(ide_hwif_t *hwif)
738 * and then do the MMIO setup. 737 * and then do the MMIO setup.
739 */ 738 */
740 739
741static void __devinit init_iops_scc(ide_hwif_t *hwif) 740static void init_iops_scc(ide_hwif_t *hwif)
742{ 741{
743 struct pci_dev *dev = to_pci_dev(hwif->dev); 742 struct pci_dev *dev = to_pci_dev(hwif->dev);
744 743
@@ -748,8 +747,7 @@ static void __devinit init_iops_scc(ide_hwif_t *hwif)
748 init_mmio_iops_scc(hwif); 747 init_mmio_iops_scc(hwif);
749} 748}
750 749
751static int __devinit scc_init_dma(ide_hwif_t *hwif, 750static int scc_init_dma(ide_hwif_t *hwif, const struct ide_port_info *d)
752 const struct ide_port_info *d)
753{ 751{
754 return ide_allocate_dma_engine(hwif); 752 return ide_allocate_dma_engine(hwif);
755} 753}
@@ -768,7 +766,7 @@ static u8 scc_cable_detect(ide_hwif_t *hwif)
768 * ide DMA handlers appropriately. 766 * ide DMA handlers appropriately.
769 */ 767 */
770 768
771static void __devinit init_hwif_scc(ide_hwif_t *hwif) 769static void init_hwif_scc(ide_hwif_t *hwif)
772{ 770{
773 /* PTERADD */ 771 /* PTERADD */
774 out_be32((void __iomem *)(hwif->dma_base + 0x018), hwif->dmatable_dma); 772 out_be32((void __iomem *)(hwif->dma_base + 0x018), hwif->dmatable_dma);
@@ -811,7 +809,7 @@ static const struct ide_dma_ops scc_dma_ops = {
811 .dma_sff_read_status = scc_dma_sff_read_status, 809 .dma_sff_read_status = scc_dma_sff_read_status,
812}; 810};
813 811
814static const struct ide_port_info scc_chipset __devinitconst = { 812static const struct ide_port_info scc_chipset = {
815 .name = "sccIDE", 813 .name = "sccIDE",
816 .init_iops = init_iops_scc, 814 .init_iops = init_iops_scc,
817 .init_dma = scc_init_dma, 815 .init_dma = scc_init_dma,
@@ -834,7 +832,7 @@ static const struct ide_port_info scc_chipset __devinitconst = {
834 * We then use the IDE PCI generic helper to do most of the work. 832 * We then use the IDE PCI generic helper to do most of the work.
835 */ 833 */
836 834
837static int __devinit scc_init_one(struct pci_dev *dev, const struct pci_device_id *id) 835static int scc_init_one(struct pci_dev *dev, const struct pci_device_id *id)
838{ 836{
839 return init_setup_scc(dev, &scc_chipset); 837 return init_setup_scc(dev, &scc_chipset);
840} 838}
@@ -846,7 +844,7 @@ static int __devinit scc_init_one(struct pci_dev *dev, const struct pci_device_i
846 * Called by the PCI code when it removes an SCC PATA controller. 844 * Called by the PCI code when it removes an SCC PATA controller.
847 */ 845 */
848 846
849static void __devexit scc_remove(struct pci_dev *dev) 847static void scc_remove(struct pci_dev *dev)
850{ 848{
851 struct scc_ports *ports = pci_get_drvdata(dev); 849 struct scc_ports *ports = pci_get_drvdata(dev);
852 struct ide_host *host = ports->host; 850 struct ide_host *host = ports->host;
@@ -869,7 +867,7 @@ static struct pci_driver scc_pci_driver = {
869 .name = "SCC IDE", 867 .name = "SCC IDE",
870 .id_table = scc_pci_tbl, 868 .id_table = scc_pci_tbl,
871 .probe = scc_init_one, 869 .probe = scc_init_one,
872 .remove = __devexit_p(scc_remove), 870 .remove = scc_remove,
873}; 871};
874 872
875static int __init scc_ide_init(void) 873static int __init scc_ide_init(void)
diff --git a/drivers/ide/serverworks.c b/drivers/ide/serverworks.c
index 24d72ef23df7..a97affca18ab 100644
--- a/drivers/ide/serverworks.c
+++ b/drivers/ide/serverworks.c
@@ -337,7 +337,7 @@ static const struct ide_port_ops svwks_port_ops = {
337 .cable_detect = svwks_cable_detect, 337 .cable_detect = svwks_cable_detect,
338}; 338};
339 339
340static const struct ide_port_info serverworks_chipsets[] __devinitconst = { 340static const struct ide_port_info serverworks_chipsets[] = {
341 { /* 0: OSB4 */ 341 { /* 0: OSB4 */
342 .name = DRV_NAME, 342 .name = DRV_NAME,
343 .init_chipset = init_chipset_svwks, 343 .init_chipset = init_chipset_svwks,
@@ -391,7 +391,7 @@ static const struct ide_port_info serverworks_chipsets[] __devinitconst = {
391 * finds a device matching our IDE device tables. 391 * finds a device matching our IDE device tables.
392 */ 392 */
393 393
394static int __devinit svwks_init_one(struct pci_dev *dev, const struct pci_device_id *id) 394static int svwks_init_one(struct pci_dev *dev, const struct pci_device_id *id)
395{ 395{
396 struct ide_port_info d; 396 struct ide_port_info d;
397 u8 idx = id->driver_data; 397 u8 idx = id->driver_data;
diff --git a/drivers/ide/sgiioc4.c b/drivers/ide/sgiioc4.c
index e3ea591f66d3..a5ca179a83b3 100644
--- a/drivers/ide/sgiioc4.c
+++ b/drivers/ide/sgiioc4.c
@@ -307,8 +307,7 @@ static u8 sgiioc4_read_status(ide_hwif_t *hwif)
307} 307}
308 308
309/* Creates a DMA map for the scatter-gather list entries */ 309/* Creates a DMA map for the scatter-gather list entries */
310static int __devinit ide_dma_sgiioc4(ide_hwif_t *hwif, 310static int ide_dma_sgiioc4(ide_hwif_t *hwif, const struct ide_port_info *d)
311 const struct ide_port_info *d)
312{ 311{
313 struct pci_dev *dev = to_pci_dev(hwif->dev); 312 struct pci_dev *dev = to_pci_dev(hwif->dev);
314 unsigned long dma_base = pci_resource_start(dev, 0) + IOC4_DMA_OFFSET; 313 unsigned long dma_base = pci_resource_start(dev, 0) + IOC4_DMA_OFFSET;
@@ -520,7 +519,7 @@ static const struct ide_dma_ops sgiioc4_dma_ops = {
520 .dma_lost_irq = sgiioc4_dma_lost_irq, 519 .dma_lost_irq = sgiioc4_dma_lost_irq,
521}; 520};
522 521
523static const struct ide_port_info sgiioc4_port_info __devinitconst = { 522static const struct ide_port_info sgiioc4_port_info = {
524 .name = DRV_NAME, 523 .name = DRV_NAME,
525 .chipset = ide_pci, 524 .chipset = ide_pci,
526 .init_dma = ide_dma_sgiioc4, 525 .init_dma = ide_dma_sgiioc4,
@@ -532,7 +531,7 @@ static const struct ide_port_info sgiioc4_port_info __devinitconst = {
532 .mwdma_mask = ATA_MWDMA2_ONLY, 531 .mwdma_mask = ATA_MWDMA2_ONLY,
533}; 532};
534 533
535static int __devinit sgiioc4_ide_setup_pci_device(struct pci_dev *dev) 534static int sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
536{ 535{
537 unsigned long cmd_base, irqport; 536 unsigned long cmd_base, irqport;
538 unsigned long bar0, cmd_phys_base, ctl; 537 unsigned long bar0, cmd_phys_base, ctl;
@@ -581,7 +580,7 @@ req_mem_rgn_err:
581 return rc; 580 return rc;
582} 581}
583 582
584static unsigned int __devinit pci_init_sgiioc4(struct pci_dev *dev) 583static unsigned int pci_init_sgiioc4(struct pci_dev *dev)
585{ 584{
586 int ret; 585 int ret;
587 586
@@ -601,7 +600,7 @@ out:
601 return ret; 600 return ret;
602} 601}
603 602
604int __devinit ioc4_ide_attach_one(struct ioc4_driver_data *idd) 603int ioc4_ide_attach_one(struct ioc4_driver_data *idd)
605{ 604{
606 /* 605 /*
607 * PCI-RT does not bring out IDE connection. 606 * PCI-RT does not bring out IDE connection.
@@ -613,7 +612,7 @@ int __devinit ioc4_ide_attach_one(struct ioc4_driver_data *idd)
613 return pci_init_sgiioc4(idd->idd_pdev); 612 return pci_init_sgiioc4(idd->idd_pdev);
614} 613}
615 614
616static struct ioc4_submodule __devinitdata ioc4_ide_submodule = { 615static struct ioc4_submodule ioc4_ide_submodule = {
617 .is_name = "IOC4_ide", 616 .is_name = "IOC4_ide",
618 .is_owner = THIS_MODULE, 617 .is_owner = THIS_MODULE,
619 .is_probe = ioc4_ide_attach_one, 618 .is_probe = ioc4_ide_attach_one,
diff --git a/drivers/ide/siimage.c b/drivers/ide/siimage.c
index 46f7e30d3790..6a1849bb476c 100644
--- a/drivers/ide/siimage.c
+++ b/drivers/ide/siimage.c
@@ -546,7 +546,7 @@ static int init_chipset_siimage(struct pci_dev *dev)
546 * extended PRD tables. For better SI3112 support use the libata driver 546 * extended PRD tables. For better SI3112 support use the libata driver
547 */ 547 */
548 548
549static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif) 549static void init_mmio_iops_siimage(ide_hwif_t *hwif)
550{ 550{
551 struct pci_dev *dev = to_pci_dev(hwif->dev); 551 struct pci_dev *dev = to_pci_dev(hwif->dev);
552 struct ide_host *host = pci_get_drvdata(dev); 552 struct ide_host *host = pci_get_drvdata(dev);
@@ -646,7 +646,7 @@ static void sil_quirkproc(ide_drive_t *drive)
646 * can get the iops right before using them. 646 * can get the iops right before using them.
647 */ 647 */
648 648
649static void __devinit init_iops_siimage(ide_hwif_t *hwif) 649static void init_iops_siimage(ide_hwif_t *hwif)
650{ 650{
651 struct pci_dev *dev = to_pci_dev(hwif->dev); 651 struct pci_dev *dev = to_pci_dev(hwif->dev);
652 struct ide_host *host = pci_get_drvdata(dev); 652 struct ide_host *host = pci_get_drvdata(dev);
@@ -719,7 +719,7 @@ static const struct ide_dma_ops sil_dma_ops = {
719 .udma_mask = ATA_UDMA6, \ 719 .udma_mask = ATA_UDMA6, \
720 } 720 }
721 721
722static const struct ide_port_info siimage_chipsets[] __devinitconst = { 722static const struct ide_port_info siimage_chipsets[] = {
723 /* 0: SiI680 */ DECLARE_SII_DEV(&sil_pata_port_ops), 723 /* 0: SiI680 */ DECLARE_SII_DEV(&sil_pata_port_ops),
724 /* 1: SiI3112 */ DECLARE_SII_DEV(&sil_sata_port_ops) 724 /* 1: SiI3112 */ DECLARE_SII_DEV(&sil_sata_port_ops)
725}; 725};
@@ -733,8 +733,7 @@ static const struct ide_port_info siimage_chipsets[] __devinitconst = {
733 * We then use the IDE PCI generic helper to do most of the work. 733 * We then use the IDE PCI generic helper to do most of the work.
734 */ 734 */
735 735
736static int __devinit siimage_init_one(struct pci_dev *dev, 736static int siimage_init_one(struct pci_dev *dev, const struct pci_device_id *id)
737 const struct pci_device_id *id)
738{ 737{
739 void __iomem *ioaddr = NULL; 738 void __iomem *ioaddr = NULL;
740 resource_size_t bar5 = pci_resource_start(dev, 5); 739 resource_size_t bar5 = pci_resource_start(dev, 5);
@@ -790,7 +789,7 @@ static int __devinit siimage_init_one(struct pci_dev *dev,
790 return rc; 789 return rc;
791} 790}
792 791
793static void __devexit siimage_remove(struct pci_dev *dev) 792static void siimage_remove(struct pci_dev *dev)
794{ 793{
795 struct ide_host *host = pci_get_drvdata(dev); 794 struct ide_host *host = pci_get_drvdata(dev);
796 void __iomem *ioaddr = host->host_priv; 795 void __iomem *ioaddr = host->host_priv;
@@ -822,7 +821,7 @@ static struct pci_driver siimage_pci_driver = {
822 .name = "SiI_IDE", 821 .name = "SiI_IDE",
823 .id_table = siimage_pci_tbl, 822 .id_table = siimage_pci_tbl,
824 .probe = siimage_init_one, 823 .probe = siimage_init_one,
825 .remove = __devexit_p(siimage_remove), 824 .remove = siimage_remove,
826 .suspend = ide_pci_suspend, 825 .suspend = ide_pci_suspend,
827 .resume = ide_pci_resume, 826 .resume = ide_pci_resume,
828}; 827};
diff --git a/drivers/ide/sis5513.c b/drivers/ide/sis5513.c
index 09e61b4c5e94..247853ea1368 100644
--- a/drivers/ide/sis5513.c
+++ b/drivers/ide/sis5513.c
@@ -362,7 +362,7 @@ static u8 sis_ata133_udma_filter(ide_drive_t *drive)
362 return (regdw & 0x08) ? ATA_UDMA6 : ATA_UDMA5; 362 return (regdw & 0x08) ? ATA_UDMA6 : ATA_UDMA5;
363} 363}
364 364
365static int __devinit sis_find_family(struct pci_dev *dev) 365static int sis_find_family(struct pci_dev *dev)
366{ 366{
367 struct pci_dev *host; 367 struct pci_dev *host;
368 int i = 0; 368 int i = 0;
@@ -563,7 +563,7 @@ static const struct ide_port_ops sis_ata133_port_ops = {
563 .cable_detect = sis_cable_detect, 563 .cable_detect = sis_cable_detect,
564}; 564};
565 565
566static const struct ide_port_info sis5513_chipset __devinitconst = { 566static const struct ide_port_info sis5513_chipset = {
567 .name = DRV_NAME, 567 .name = DRV_NAME,
568 .init_chipset = init_chipset_sis5513, 568 .init_chipset = init_chipset_sis5513,
569 .enablebits = { {0x4a, 0x02, 0x02}, {0x4a, 0x04, 0x04} }, 569 .enablebits = { {0x4a, 0x02, 0x02}, {0x4a, 0x04, 0x04} },
@@ -572,7 +572,7 @@ static const struct ide_port_info sis5513_chipset __devinitconst = {
572 .mwdma_mask = ATA_MWDMA2, 572 .mwdma_mask = ATA_MWDMA2,
573}; 573};
574 574
575static int __devinit sis5513_init_one(struct pci_dev *dev, const struct pci_device_id *id) 575static int sis5513_init_one(struct pci_dev *dev, const struct pci_device_id *id)
576{ 576{
577 struct ide_port_info d = sis5513_chipset; 577 struct ide_port_info d = sis5513_chipset;
578 u8 udma_rates[] = { 0x00, 0x00, 0x07, 0x1f, 0x3f, 0x3f, 0x7f, 0x7f }; 578 u8 udma_rates[] = { 0x00, 0x00, 0x07, 0x1f, 0x3f, 0x3f, 0x7f, 0x7f };
@@ -595,7 +595,7 @@ static int __devinit sis5513_init_one(struct pci_dev *dev, const struct pci_devi
595 return ide_pci_init_one(dev, &d, NULL); 595 return ide_pci_init_one(dev, &d, NULL);
596} 596}
597 597
598static void __devexit sis5513_remove(struct pci_dev *dev) 598static void sis5513_remove(struct pci_dev *dev)
599{ 599{
600 ide_pci_remove(dev); 600 ide_pci_remove(dev);
601 pci_disable_device(dev); 601 pci_disable_device(dev);
@@ -613,7 +613,7 @@ static struct pci_driver sis5513_pci_driver = {
613 .name = "SIS_IDE", 613 .name = "SIS_IDE",
614 .id_table = sis5513_pci_tbl, 614 .id_table = sis5513_pci_tbl,
615 .probe = sis5513_init_one, 615 .probe = sis5513_init_one,
616 .remove = __devexit_p(sis5513_remove), 616 .remove = sis5513_remove,
617 .suspend = ide_pci_suspend, 617 .suspend = ide_pci_suspend,
618 .resume = ide_pci_resume, 618 .resume = ide_pci_resume,
619}; 619};
diff --git a/drivers/ide/sl82c105.c b/drivers/ide/sl82c105.c
index d051cd224bdb..8755df3330a0 100644
--- a/drivers/ide/sl82c105.c
+++ b/drivers/ide/sl82c105.c
@@ -299,7 +299,7 @@ static const struct ide_dma_ops sl82c105_dma_ops = {
299 .dma_sff_read_status = ide_dma_sff_read_status, 299 .dma_sff_read_status = ide_dma_sff_read_status,
300}; 300};
301 301
302static const struct ide_port_info sl82c105_chipset __devinitconst = { 302static const struct ide_port_info sl82c105_chipset = {
303 .name = DRV_NAME, 303 .name = DRV_NAME,
304 .init_chipset = init_chipset_sl82c105, 304 .init_chipset = init_chipset_sl82c105,
305 .enablebits = {{0x40,0x01,0x01}, {0x40,0x10,0x10}}, 305 .enablebits = {{0x40,0x01,0x01}, {0x40,0x10,0x10}},
@@ -313,7 +313,7 @@ static const struct ide_port_info sl82c105_chipset __devinitconst = {
313 .mwdma_mask = ATA_MWDMA2, 313 .mwdma_mask = ATA_MWDMA2,
314}; 314};
315 315
316static int __devinit sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id) 316static int sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id)
317{ 317{
318 struct ide_port_info d = sl82c105_chipset; 318 struct ide_port_info d = sl82c105_chipset;
319 u8 rev = sl82c105_bridge_revision(dev); 319 u8 rev = sl82c105_bridge_revision(dev);
diff --git a/drivers/ide/slc90e66.c b/drivers/ide/slc90e66.c
index 863a5e9283ca..8af92bbb3dcb 100644
--- a/drivers/ide/slc90e66.c
+++ b/drivers/ide/slc90e66.c
@@ -132,7 +132,7 @@ static const struct ide_port_ops slc90e66_port_ops = {
132 .cable_detect = slc90e66_cable_detect, 132 .cable_detect = slc90e66_cable_detect,
133}; 133};
134 134
135static const struct ide_port_info slc90e66_chipset __devinitconst = { 135static const struct ide_port_info slc90e66_chipset = {
136 .name = DRV_NAME, 136 .name = DRV_NAME,
137 .enablebits = { {0x41, 0x80, 0x80}, {0x43, 0x80, 0x80} }, 137 .enablebits = { {0x41, 0x80, 0x80}, {0x43, 0x80, 0x80} },
138 .port_ops = &slc90e66_port_ops, 138 .port_ops = &slc90e66_port_ops,
@@ -142,7 +142,8 @@ static const struct ide_port_info slc90e66_chipset __devinitconst = {
142 .udma_mask = ATA_UDMA4, 142 .udma_mask = ATA_UDMA4,
143}; 143};
144 144
145static int __devinit slc90e66_init_one(struct pci_dev *dev, const struct pci_device_id *id) 145static int slc90e66_init_one(struct pci_dev *dev,
146 const struct pci_device_id *id)
146{ 147{
147 return ide_pci_init_one(dev, &slc90e66_chipset, NULL); 148 return ide_pci_init_one(dev, &slc90e66_chipset, NULL);
148} 149}
diff --git a/drivers/ide/tc86c001.c b/drivers/ide/tc86c001.c
index 17946785ebf6..17e6132b99bf 100644
--- a/drivers/ide/tc86c001.c
+++ b/drivers/ide/tc86c001.c
@@ -144,7 +144,7 @@ static u8 tc86c001_cable_detect(ide_hwif_t *hwif)
144 return (scr1 & 0x2000) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; 144 return (scr1 & 0x2000) ? ATA_CBL_PATA40 : ATA_CBL_PATA80;
145} 145}
146 146
147static void __devinit init_hwif_tc86c001(ide_hwif_t *hwif) 147static void init_hwif_tc86c001(ide_hwif_t *hwif)
148{ 148{
149 struct pci_dev *dev = to_pci_dev(hwif->dev); 149 struct pci_dev *dev = to_pci_dev(hwif->dev);
150 unsigned long sc_base = pci_resource_start(dev, 5); 150 unsigned long sc_base = pci_resource_start(dev, 5);
@@ -192,7 +192,7 @@ static const struct ide_dma_ops tc86c001_dma_ops = {
192 .dma_sff_read_status = ide_dma_sff_read_status, 192 .dma_sff_read_status = ide_dma_sff_read_status,
193}; 193};
194 194
195static const struct ide_port_info tc86c001_chipset __devinitconst = { 195static const struct ide_port_info tc86c001_chipset = {
196 .name = DRV_NAME, 196 .name = DRV_NAME,
197 .init_hwif = init_hwif_tc86c001, 197 .init_hwif = init_hwif_tc86c001,
198 .port_ops = &tc86c001_port_ops, 198 .port_ops = &tc86c001_port_ops,
@@ -203,8 +203,8 @@ static const struct ide_port_info tc86c001_chipset __devinitconst = {
203 .udma_mask = ATA_UDMA4, 203 .udma_mask = ATA_UDMA4,
204}; 204};
205 205
206static int __devinit tc86c001_init_one(struct pci_dev *dev, 206static int tc86c001_init_one(struct pci_dev *dev,
207 const struct pci_device_id *id) 207 const struct pci_device_id *id)
208{ 208{
209 int rc; 209 int rc;
210 210
@@ -232,7 +232,7 @@ out:
232 return rc; 232 return rc;
233} 233}
234 234
235static void __devexit tc86c001_remove(struct pci_dev *dev) 235static void tc86c001_remove(struct pci_dev *dev)
236{ 236{
237 ide_pci_remove(dev); 237 ide_pci_remove(dev);
238 pci_release_region(dev, 5); 238 pci_release_region(dev, 5);
@@ -249,7 +249,7 @@ static struct pci_driver tc86c001_pci_driver = {
249 .name = "TC86C001", 249 .name = "TC86C001",
250 .id_table = tc86c001_pci_tbl, 250 .id_table = tc86c001_pci_tbl,
251 .probe = tc86c001_init_one, 251 .probe = tc86c001_init_one,
252 .remove = __devexit_p(tc86c001_remove), 252 .remove = tc86c001_remove,
253}; 253};
254 254
255static int __init tc86c001_ide_init(void) 255static int __init tc86c001_ide_init(void)
diff --git a/drivers/ide/triflex.c b/drivers/ide/triflex.c
index 55ce1b80efcb..7f1af9493f0e 100644
--- a/drivers/ide/triflex.c
+++ b/drivers/ide/triflex.c
@@ -92,7 +92,7 @@ static const struct ide_port_ops triflex_port_ops = {
92 .set_dma_mode = triflex_set_mode, 92 .set_dma_mode = triflex_set_mode,
93}; 93};
94 94
95static const struct ide_port_info triflex_device __devinitconst = { 95static const struct ide_port_info triflex_device = {
96 .name = DRV_NAME, 96 .name = DRV_NAME,
97 .enablebits = {{0x80, 0x01, 0x01}, {0x80, 0x02, 0x02}}, 97 .enablebits = {{0x80, 0x01, 0x01}, {0x80, 0x02, 0x02}},
98 .port_ops = &triflex_port_ops, 98 .port_ops = &triflex_port_ops,
@@ -101,8 +101,7 @@ static const struct ide_port_info triflex_device __devinitconst = {
101 .mwdma_mask = ATA_MWDMA2, 101 .mwdma_mask = ATA_MWDMA2,
102}; 102};
103 103
104static int __devinit triflex_init_one(struct pci_dev *dev, 104static int triflex_init_one(struct pci_dev *dev, const struct pci_device_id *id)
105 const struct pci_device_id *id)
106{ 105{
107 return ide_pci_init_one(dev, &triflex_device, NULL); 106 return ide_pci_init_one(dev, &triflex_device, NULL);
108} 107}
diff --git a/drivers/ide/trm290.c b/drivers/ide/trm290.c
index e494a98a43a9..0069f6ce74cf 100644
--- a/drivers/ide/trm290.c
+++ b/drivers/ide/trm290.c
@@ -231,7 +231,7 @@ static void trm290_dma_host_set(ide_drive_t *drive, int on)
231{ 231{
232} 232}
233 233
234static void __devinit init_hwif_trm290(ide_hwif_t *hwif) 234static void init_hwif_trm290(ide_hwif_t *hwif)
235{ 235{
236 struct pci_dev *dev = to_pci_dev(hwif->dev); 236 struct pci_dev *dev = to_pci_dev(hwif->dev);
237 unsigned int cfg_base = pci_resource_start(dev, 4); 237 unsigned int cfg_base = pci_resource_start(dev, 4);
@@ -324,7 +324,7 @@ static struct ide_dma_ops trm290_dma_ops = {
324 .dma_check = trm290_dma_check, 324 .dma_check = trm290_dma_check,
325}; 325};
326 326
327static const struct ide_port_info trm290_chipset __devinitconst = { 327static const struct ide_port_info trm290_chipset = {
328 .name = DRV_NAME, 328 .name = DRV_NAME,
329 .init_hwif = init_hwif_trm290, 329 .init_hwif = init_hwif_trm290,
330 .tp_ops = &trm290_tp_ops, 330 .tp_ops = &trm290_tp_ops,
@@ -338,7 +338,7 @@ static const struct ide_port_info trm290_chipset __devinitconst = {
338 IDE_HFLAG_NO_LBA48, 338 IDE_HFLAG_NO_LBA48,
339}; 339};
340 340
341static int __devinit trm290_init_one(struct pci_dev *dev, const struct pci_device_id *id) 341static int trm290_init_one(struct pci_dev *dev, const struct pci_device_id *id)
342{ 342{
343 return ide_pci_init_one(dev, &trm290_chipset, NULL); 343 return ide_pci_init_one(dev, &trm290_chipset, NULL);
344} 344}
diff --git a/drivers/ide/via82cxxx.c b/drivers/ide/via82cxxx.c
index eb7767864d10..01464f1e2339 100644
--- a/drivers/ide/via82cxxx.c
+++ b/drivers/ide/via82cxxx.c
@@ -403,7 +403,7 @@ static const struct ide_port_ops via_port_ops = {
403 .cable_detect = via82cxxx_cable_detect, 403 .cable_detect = via82cxxx_cable_detect,
404}; 404};
405 405
406static const struct ide_port_info via82cxxx_chipset __devinitconst = { 406static const struct ide_port_info via82cxxx_chipset = {
407 .name = DRV_NAME, 407 .name = DRV_NAME,
408 .init_chipset = init_chipset_via82cxxx, 408 .init_chipset = init_chipset_via82cxxx,
409 .enablebits = { { 0x40, 0x02, 0x02 }, { 0x40, 0x01, 0x01 } }, 409 .enablebits = { { 0x40, 0x02, 0x02 }, { 0x40, 0x01, 0x01 } },
@@ -416,7 +416,7 @@ static const struct ide_port_info via82cxxx_chipset __devinitconst = {
416 .mwdma_mask = ATA_MWDMA2, 416 .mwdma_mask = ATA_MWDMA2,
417}; 417};
418 418
419static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_id *id) 419static int via_init_one(struct pci_dev *dev, const struct pci_device_id *id)
420{ 420{
421 struct pci_dev *isa = NULL; 421 struct pci_dev *isa = NULL;
422 struct via_isa_bridge *via_config; 422 struct via_isa_bridge *via_config;
@@ -489,7 +489,7 @@ static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_i
489 return rc; 489 return rc;
490} 490}
491 491
492static void __devexit via_remove(struct pci_dev *dev) 492static void via_remove(struct pci_dev *dev)
493{ 493{
494 struct ide_host *host = pci_get_drvdata(dev); 494 struct ide_host *host = pci_get_drvdata(dev);
495 struct via82cxxx_dev *vdev = host->host_priv; 495 struct via82cxxx_dev *vdev = host->host_priv;
@@ -514,7 +514,7 @@ static struct pci_driver via_pci_driver = {
514 .name = "VIA_IDE", 514 .name = "VIA_IDE",
515 .id_table = via_pci_tbl, 515 .id_table = via_pci_tbl,
516 .probe = via_init_one, 516 .probe = via_init_one,
517 .remove = __devexit_p(via_remove), 517 .remove = via_remove,
518 .suspend = ide_pci_suspend, 518 .suspend = ide_pci_suspend,
519 .resume = ide_pci_resume, 519 .resume = ide_pci_resume,
520}; 520};
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index c49c04d9c2b0..2df9414a72f7 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -448,8 +448,6 @@ static int intel_idle_probe(void)
448 else 448 else
449 on_each_cpu(__setup_broadcast_timer, (void *)true, 1); 449 on_each_cpu(__setup_broadcast_timer, (void *)true, 1);
450 450
451 register_cpu_notifier(&cpu_hotplug_notifier);
452
453 pr_debug(PREFIX "v" INTEL_IDLE_VERSION 451 pr_debug(PREFIX "v" INTEL_IDLE_VERSION
454 " model 0x%X\n", boot_cpu_data.x86_model); 452 " model 0x%X\n", boot_cpu_data.x86_model);
455 453
@@ -506,7 +504,7 @@ static int intel_idle_cpuidle_driver_init(void)
506 if (*cpuidle_state_table[cstate].name == '\0') 504 if (*cpuidle_state_table[cstate].name == '\0')
507 pr_debug(PREFIX "unaware of model 0x%x" 505 pr_debug(PREFIX "unaware of model 0x%x"
508 " MWAIT %d please" 506 " MWAIT %d please"
509 " contact lenb@kernel.org", 507 " contact lenb@kernel.org\n",
510 boot_cpu_data.x86_model, cstate); 508 boot_cpu_data.x86_model, cstate);
511 continue; 509 continue;
512 } 510 }
@@ -612,6 +610,7 @@ static int __init intel_idle_init(void)
612 return retval; 610 return retval;
613 } 611 }
614 } 612 }
613 register_cpu_notifier(&cpu_hotplug_notifier);
615 614
616 return 0; 615 return 0;
617} 616}
diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig
index fe4bcd7c5b12..05e996fafc9d 100644
--- a/drivers/iio/accel/Kconfig
+++ b/drivers/iio/accel/Kconfig
@@ -8,6 +8,7 @@ config HID_SENSOR_ACCEL_3D
8 select IIO_BUFFER 8 select IIO_BUFFER
9 select IIO_TRIGGERED_BUFFER 9 select IIO_TRIGGERED_BUFFER
10 select HID_SENSOR_IIO_COMMON 10 select HID_SENSOR_IIO_COMMON
11 select HID_SENSOR_IIO_TRIGGER
11 tristate "HID Accelerometers 3D" 12 tristate "HID Accelerometers 3D"
12 help 13 help
13 Say yes here to build support for the HID SENSOR 14 Say yes here to build support for the HID SENSOR
diff --git a/drivers/iio/accel/hid-sensor-accel-3d.c b/drivers/iio/accel/hid-sensor-accel-3d.c
index e67bb912bd19..0b0c3c66f6c0 100644
--- a/drivers/iio/accel/hid-sensor-accel-3d.c
+++ b/drivers/iio/accel/hid-sensor-accel-3d.c
@@ -278,7 +278,7 @@ static int accel_3d_parse_report(struct platform_device *pdev,
278} 278}
279 279
280/* Function to initialize the processing for usage id */ 280/* Function to initialize the processing for usage id */
281static int __devinit hid_accel_3d_probe(struct platform_device *pdev) 281static int hid_accel_3d_probe(struct platform_device *pdev)
282{ 282{
283 int ret = 0; 283 int ret = 0;
284 static const char *name = "accel_3d"; 284 static const char *name = "accel_3d";
@@ -375,7 +375,7 @@ error_ret:
375} 375}
376 376
377/* Function to deinitialize the processing for usage id */ 377/* Function to deinitialize the processing for usage id */
378static int __devinit hid_accel_3d_remove(struct platform_device *pdev) 378static int hid_accel_3d_remove(struct platform_device *pdev)
379{ 379{
380 struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; 380 struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
381 struct iio_dev *indio_dev = platform_get_drvdata(pdev); 381 struct iio_dev *indio_dev = platform_get_drvdata(pdev);
diff --git a/drivers/iio/adc/ad7266.c b/drivers/iio/adc/ad7266.c
index a6f4fc5f8201..bbad9b94cd75 100644
--- a/drivers/iio/adc/ad7266.c
+++ b/drivers/iio/adc/ad7266.c
@@ -367,7 +367,7 @@ static const struct ad7266_chan_info ad7266_chan_infos[] = {
367 }, 367 },
368}; 368};
369 369
370static void __devinit ad7266_init_channels(struct iio_dev *indio_dev) 370static void ad7266_init_channels(struct iio_dev *indio_dev)
371{ 371{
372 struct ad7266_state *st = iio_priv(indio_dev); 372 struct ad7266_state *st = iio_priv(indio_dev);
373 bool is_differential, is_signed; 373 bool is_differential, is_signed;
@@ -391,7 +391,7 @@ static const char * const ad7266_gpio_labels[] = {
391 "AD0", "AD1", "AD2", 391 "AD0", "AD1", "AD2",
392}; 392};
393 393
394static int __devinit ad7266_probe(struct spi_device *spi) 394static int ad7266_probe(struct spi_device *spi)
395{ 395{
396 struct ad7266_platform_data *pdata = spi->dev.platform_data; 396 struct ad7266_platform_data *pdata = spi->dev.platform_data;
397 struct iio_dev *indio_dev; 397 struct iio_dev *indio_dev;
@@ -411,7 +411,11 @@ static int __devinit ad7266_probe(struct spi_device *spi)
411 if (ret) 411 if (ret)
412 goto error_put_reg; 412 goto error_put_reg;
413 413
414 st->vref_uv = regulator_get_voltage(st->reg); 414 ret = regulator_get_voltage(st->reg);
415 if (ret < 0)
416 goto error_disable_reg;
417
418 st->vref_uv = ret;
415 } else { 419 } else {
416 /* Use internal reference */ 420 /* Use internal reference */
417 st->vref_uv = 2500000; 421 st->vref_uv = 2500000;
@@ -494,7 +498,7 @@ error_put_reg:
494 return ret; 498 return ret;
495} 499}
496 500
497static int __devexit ad7266_remove(struct spi_device *spi) 501static int ad7266_remove(struct spi_device *spi)
498{ 502{
499 struct iio_dev *indio_dev = spi_get_drvdata(spi); 503 struct iio_dev *indio_dev = spi_get_drvdata(spi);
500 struct ad7266_state *st = iio_priv(indio_dev); 504 struct ad7266_state *st = iio_priv(indio_dev);
@@ -525,7 +529,7 @@ static struct spi_driver ad7266_driver = {
525 .owner = THIS_MODULE, 529 .owner = THIS_MODULE,
526 }, 530 },
527 .probe = ad7266_probe, 531 .probe = ad7266_probe,
528 .remove = __devexit_p(ad7266_remove), 532 .remove = ad7266_remove,
529 .id_table = ad7266_id, 533 .id_table = ad7266_id,
530}; 534};
531module_spi_driver(ad7266_driver); 535module_spi_driver(ad7266_driver);
diff --git a/drivers/iio/adc/ad7298.c b/drivers/iio/adc/ad7298.c
index 2364807a5d6c..b34d754994d5 100644
--- a/drivers/iio/adc/ad7298.c
+++ b/drivers/iio/adc/ad7298.c
@@ -292,7 +292,7 @@ static const struct iio_info ad7298_info = {
292 .driver_module = THIS_MODULE, 292 .driver_module = THIS_MODULE,
293}; 293};
294 294
295static int __devinit ad7298_probe(struct spi_device *spi) 295static int ad7298_probe(struct spi_device *spi)
296{ 296{
297 struct ad7298_platform_data *pdata = spi->dev.platform_data; 297 struct ad7298_platform_data *pdata = spi->dev.platform_data;
298 struct ad7298_state *st; 298 struct ad7298_state *st;
@@ -370,7 +370,7 @@ error_free:
370 return ret; 370 return ret;
371} 371}
372 372
373static int __devexit ad7298_remove(struct spi_device *spi) 373static int ad7298_remove(struct spi_device *spi)
374{ 374{
375 struct iio_dev *indio_dev = spi_get_drvdata(spi); 375 struct iio_dev *indio_dev = spi_get_drvdata(spi);
376 struct ad7298_state *st = iio_priv(indio_dev); 376 struct ad7298_state *st = iio_priv(indio_dev);
@@ -398,7 +398,7 @@ static struct spi_driver ad7298_driver = {
398 .owner = THIS_MODULE, 398 .owner = THIS_MODULE,
399 }, 399 },
400 .probe = ad7298_probe, 400 .probe = ad7298_probe,
401 .remove = __devexit_p(ad7298_remove), 401 .remove = ad7298_remove,
402 .id_table = ad7298_id, 402 .id_table = ad7298_id,
403}; 403};
404module_spi_driver(ad7298_driver); 404module_spi_driver(ad7298_driver);
diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c
index 330248bfebae..1491fa6debb2 100644
--- a/drivers/iio/adc/ad7476.c
+++ b/drivers/iio/adc/ad7476.c
@@ -207,7 +207,7 @@ static const struct iio_info ad7476_info = {
207 .read_raw = &ad7476_read_raw, 207 .read_raw = &ad7476_read_raw,
208}; 208};
209 209
210static int __devinit ad7476_probe(struct spi_device *spi) 210static int ad7476_probe(struct spi_device *spi)
211{ 211{
212 struct ad7476_state *st; 212 struct ad7476_state *st;
213 struct iio_dev *indio_dev; 213 struct iio_dev *indio_dev;
@@ -277,7 +277,7 @@ error_ret:
277 return ret; 277 return ret;
278} 278}
279 279
280static int __devexit ad7476_remove(struct spi_device *spi) 280static int ad7476_remove(struct spi_device *spi)
281{ 281{
282 struct iio_dev *indio_dev = spi_get_drvdata(spi); 282 struct iio_dev *indio_dev = spi_get_drvdata(spi);
283 struct ad7476_state *st = iio_priv(indio_dev); 283 struct ad7476_state *st = iio_priv(indio_dev);
@@ -322,7 +322,7 @@ static struct spi_driver ad7476_driver = {
322 .owner = THIS_MODULE, 322 .owner = THIS_MODULE,
323 }, 323 },
324 .probe = ad7476_probe, 324 .probe = ad7476_probe,
325 .remove = __devexit_p(ad7476_remove), 325 .remove = ad7476_remove,
326 .id_table = ad7476_id, 326 .id_table = ad7476_id,
327}; 327};
328module_spi_driver(ad7476_driver); 328module_spi_driver(ad7476_driver);
diff --git a/drivers/iio/adc/ad7791.c b/drivers/iio/adc/ad7791.c
index e93740843b2b..5e8d1da6887f 100644
--- a/drivers/iio/adc/ad7791.c
+++ b/drivers/iio/adc/ad7791.c
@@ -325,8 +325,8 @@ static const struct iio_info ad7791_no_filter_info = {
325 .driver_module = THIS_MODULE, 325 .driver_module = THIS_MODULE,
326}; 326};
327 327
328static int __devinit ad7791_setup(struct ad7791_state *st, 328static int ad7791_setup(struct ad7791_state *st,
329 struct ad7791_platform_data *pdata) 329 struct ad7791_platform_data *pdata)
330{ 330{
331 /* Set to poweron-reset default values */ 331 /* Set to poweron-reset default values */
332 st->mode = AD7791_MODE_BUFFER; 332 st->mode = AD7791_MODE_BUFFER;
@@ -349,7 +349,7 @@ static int __devinit ad7791_setup(struct ad7791_state *st,
349 st->mode); 349 st->mode);
350} 350}
351 351
352static int __devinit ad7791_probe(struct spi_device *spi) 352static int ad7791_probe(struct spi_device *spi)
353{ 353{
354 struct ad7791_platform_data *pdata = spi->dev.platform_data; 354 struct ad7791_platform_data *pdata = spi->dev.platform_data;
355 struct iio_dev *indio_dev; 355 struct iio_dev *indio_dev;
@@ -418,7 +418,7 @@ err_iio_free:
418 return ret; 418 return ret;
419} 419}
420 420
421static int __devexit ad7791_remove(struct spi_device *spi) 421static int ad7791_remove(struct spi_device *spi)
422{ 422{
423 struct iio_dev *indio_dev = spi_get_drvdata(spi); 423 struct iio_dev *indio_dev = spi_get_drvdata(spi);
424 struct ad7791_state *st = iio_priv(indio_dev); 424 struct ad7791_state *st = iio_priv(indio_dev);
@@ -450,7 +450,7 @@ static struct spi_driver ad7791_driver = {
450 .owner = THIS_MODULE, 450 .owner = THIS_MODULE,
451 }, 451 },
452 .probe = ad7791_probe, 452 .probe = ad7791_probe,
453 .remove = __devexit_p(ad7791_remove), 453 .remove = ad7791_remove,
454 .id_table = ad7791_spi_ids, 454 .id_table = ad7791_spi_ids,
455}; 455};
456module_spi_driver(ad7791_driver); 456module_spi_driver(ad7791_driver);
diff --git a/drivers/iio/adc/ad7887.c b/drivers/iio/adc/ad7887.c
index 81153fafac7a..a33d5cd1a536 100644
--- a/drivers/iio/adc/ad7887.c
+++ b/drivers/iio/adc/ad7887.c
@@ -233,7 +233,7 @@ static const struct iio_info ad7887_info = {
233 .driver_module = THIS_MODULE, 233 .driver_module = THIS_MODULE,
234}; 234};
235 235
236static int __devinit ad7887_probe(struct spi_device *spi) 236static int ad7887_probe(struct spi_device *spi)
237{ 237{
238 struct ad7887_platform_data *pdata = spi->dev.platform_data; 238 struct ad7887_platform_data *pdata = spi->dev.platform_data;
239 struct ad7887_state *st; 239 struct ad7887_state *st;
@@ -340,7 +340,7 @@ error_free:
340 return ret; 340 return ret;
341} 341}
342 342
343static int __devexit ad7887_remove(struct spi_device *spi) 343static int ad7887_remove(struct spi_device *spi)
344{ 344{
345 struct iio_dev *indio_dev = spi_get_drvdata(spi); 345 struct iio_dev *indio_dev = spi_get_drvdata(spi);
346 struct ad7887_state *st = iio_priv(indio_dev); 346 struct ad7887_state *st = iio_priv(indio_dev);
@@ -368,7 +368,7 @@ static struct spi_driver ad7887_driver = {
368 .owner = THIS_MODULE, 368 .owner = THIS_MODULE,
369 }, 369 },
370 .probe = ad7887_probe, 370 .probe = ad7887_probe,
371 .remove = __devexit_p(ad7887_remove), 371 .remove = ad7887_remove,
372 .id_table = ad7887_id, 372 .id_table = ad7887_id,
373}; 373};
374module_spi_driver(ad7887_driver); 374module_spi_driver(ad7887_driver);
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 03b85940f4ba..a526c0e3aaa8 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -80,7 +80,7 @@ static irqreturn_t at91_adc_trigger_handler(int irq, void *p)
80 *timestamp = pf->timestamp; 80 *timestamp = pf->timestamp;
81 } 81 }
82 82
83 iio_push_to_buffers(indio_dev, (u8 *)st->buffer); 83 iio_push_to_buffers(idev, (u8 *)st->buffer);
84 84
85 iio_trigger_notify_done(idev->trig); 85 iio_trigger_notify_done(idev->trig);
86 86
@@ -514,7 +514,7 @@ static const struct iio_info at91_adc_info = {
514 .read_raw = &at91_adc_read_raw, 514 .read_raw = &at91_adc_read_raw,
515}; 515};
516 516
517static int __devinit at91_adc_probe(struct platform_device *pdev) 517static int at91_adc_probe(struct platform_device *pdev)
518{ 518{
519 unsigned int prsc, mstrclk, ticks, adc_clk; 519 unsigned int prsc, mstrclk, ticks, adc_clk;
520 int ret; 520 int ret;
@@ -678,7 +678,7 @@ error_ret:
678 return ret; 678 return ret;
679} 679}
680 680
681static int __devexit at91_adc_remove(struct platform_device *pdev) 681static int at91_adc_remove(struct platform_device *pdev)
682{ 682{
683 struct iio_dev *idev = platform_get_drvdata(pdev); 683 struct iio_dev *idev = platform_get_drvdata(pdev);
684 struct at91_adc_state *st = iio_priv(idev); 684 struct at91_adc_state *st = iio_priv(idev);
@@ -702,7 +702,7 @@ MODULE_DEVICE_TABLE(of, at91_adc_dt_ids);
702 702
703static struct platform_driver at91_adc_driver = { 703static struct platform_driver at91_adc_driver = {
704 .probe = at91_adc_probe, 704 .probe = at91_adc_probe,
705 .remove = __devexit_p(at91_adc_remove), 705 .remove = at91_adc_remove,
706 .driver = { 706 .driver = {
707 .name = "at91_adc", 707 .name = "at91_adc",
708 .of_match_table = of_match_ptr(at91_adc_dt_ids), 708 .of_match_table = of_match_ptr(at91_adc_dt_ids),
diff --git a/drivers/iio/adc/lp8788_adc.c b/drivers/iio/adc/lp8788_adc.c
index a93aaf0bb841..72955e45e9e0 100644
--- a/drivers/iio/adc/lp8788_adc.c
+++ b/drivers/iio/adc/lp8788_adc.c
@@ -193,7 +193,7 @@ static inline void lp8788_iio_map_unregister(struct iio_dev *indio_dev,
193 iio_map_array_unregister(indio_dev, adc->map); 193 iio_map_array_unregister(indio_dev, adc->map);
194} 194}
195 195
196static int __devinit lp8788_adc_probe(struct platform_device *pdev) 196static int lp8788_adc_probe(struct platform_device *pdev)
197{ 197{
198 struct lp8788 *lp = dev_get_drvdata(pdev->dev.parent); 198 struct lp8788 *lp = dev_get_drvdata(pdev->dev.parent);
199 struct iio_dev *indio_dev; 199 struct iio_dev *indio_dev;
@@ -236,7 +236,7 @@ err_iio_map:
236 return ret; 236 return ret;
237} 237}
238 238
239static int __devexit lp8788_adc_remove(struct platform_device *pdev) 239static int lp8788_adc_remove(struct platform_device *pdev)
240{ 240{
241 struct iio_dev *indio_dev = platform_get_drvdata(pdev); 241 struct iio_dev *indio_dev = platform_get_drvdata(pdev);
242 struct lp8788_adc *adc = iio_priv(indio_dev); 242 struct lp8788_adc *adc = iio_priv(indio_dev);
@@ -250,7 +250,7 @@ static int __devexit lp8788_adc_remove(struct platform_device *pdev)
250 250
251static struct platform_driver lp8788_adc_driver = { 251static struct platform_driver lp8788_adc_driver = {
252 .probe = lp8788_adc_probe, 252 .probe = lp8788_adc_probe,
253 .remove = __devexit_p(lp8788_adc_remove), 253 .remove = lp8788_adc_remove,
254 .driver = { 254 .driver = {
255 .name = LP8788_DEV_ADC, 255 .name = LP8788_DEV_ADC,
256 .owner = THIS_MODULE, 256 .owner = THIS_MODULE,
diff --git a/drivers/iio/adc/max1363.c b/drivers/iio/adc/max1363.c
index 1e84b5b55093..03b25b3dc71e 100644
--- a/drivers/iio/adc/max1363.c
+++ b/drivers/iio/adc/max1363.c
@@ -1402,7 +1402,7 @@ static int max1363_initial_setup(struct max1363_state *st)
1402 return max1363_set_scan_mode(st); 1402 return max1363_set_scan_mode(st);
1403} 1403}
1404 1404
1405static int __devinit max1363_alloc_scan_masks(struct iio_dev *indio_dev) 1405static int max1363_alloc_scan_masks(struct iio_dev *indio_dev)
1406{ 1406{
1407 struct max1363_state *st = iio_priv(indio_dev); 1407 struct max1363_state *st = iio_priv(indio_dev);
1408 unsigned long *masks; 1408 unsigned long *masks;
@@ -1525,8 +1525,8 @@ static void max1363_buffer_cleanup(struct iio_dev *indio_dev)
1525 iio_kfifo_free(indio_dev->buffer); 1525 iio_kfifo_free(indio_dev->buffer);
1526} 1526}
1527 1527
1528static int __devinit max1363_probe(struct i2c_client *client, 1528static int max1363_probe(struct i2c_client *client,
1529 const struct i2c_device_id *id) 1529 const struct i2c_device_id *id)
1530{ 1530{
1531 int ret; 1531 int ret;
1532 struct max1363_state *st; 1532 struct max1363_state *st;
@@ -1605,26 +1605,27 @@ static int __devinit max1363_probe(struct i2c_client *client,
1605 1605
1606 return 0; 1606 return 0;
1607error_free_irq: 1607error_free_irq:
1608 free_irq(st->client->irq, indio_dev); 1608 if (client->irq)
1609 free_irq(st->client->irq, indio_dev);
1609error_uninit_buffer: 1610error_uninit_buffer:
1610 iio_buffer_unregister(indio_dev); 1611 iio_buffer_unregister(indio_dev);
1611error_cleanup_buffer: 1612error_cleanup_buffer:
1612 max1363_buffer_cleanup(indio_dev); 1613 max1363_buffer_cleanup(indio_dev);
1613error_free_available_scan_masks: 1614error_free_available_scan_masks:
1614 kfree(indio_dev->available_scan_masks); 1615 kfree(indio_dev->available_scan_masks);
1615error_unregister_map:
1616 iio_map_array_unregister(indio_dev, client->dev.platform_data);
1617error_disable_reg: 1616error_disable_reg:
1618 regulator_disable(st->reg); 1617 regulator_disable(st->reg);
1619error_put_reg: 1618error_put_reg:
1620 regulator_put(st->reg); 1619 regulator_put(st->reg);
1620error_unregister_map:
1621 iio_map_array_unregister(indio_dev, client->dev.platform_data);
1621error_free_device: 1622error_free_device:
1622 iio_device_free(indio_dev); 1623 iio_device_free(indio_dev);
1623error_out: 1624error_out:
1624 return ret; 1625 return ret;
1625} 1626}
1626 1627
1627static int __devexit max1363_remove(struct i2c_client *client) 1628static int max1363_remove(struct i2c_client *client)
1628{ 1629{
1629 struct iio_dev *indio_dev = i2c_get_clientdata(client); 1630 struct iio_dev *indio_dev = i2c_get_clientdata(client);
1630 struct max1363_state *st = iio_priv(indio_dev); 1631 struct max1363_state *st = iio_priv(indio_dev);
@@ -1635,10 +1636,8 @@ static int __devexit max1363_remove(struct i2c_client *client)
1635 iio_buffer_unregister(indio_dev); 1636 iio_buffer_unregister(indio_dev);
1636 max1363_buffer_cleanup(indio_dev); 1637 max1363_buffer_cleanup(indio_dev);
1637 kfree(indio_dev->available_scan_masks); 1638 kfree(indio_dev->available_scan_masks);
1638 if (!IS_ERR(st->reg)) { 1639 regulator_disable(st->reg);
1639 regulator_disable(st->reg); 1640 regulator_put(st->reg);
1640 regulator_put(st->reg);
1641 }
1642 iio_map_array_unregister(indio_dev, client->dev.platform_data); 1641 iio_map_array_unregister(indio_dev, client->dev.platform_data);
1643 iio_device_free(indio_dev); 1642 iio_device_free(indio_dev);
1644 1643
@@ -1690,7 +1689,7 @@ static struct i2c_driver max1363_driver = {
1690 .name = "max1363", 1689 .name = "max1363",
1691 }, 1690 },
1692 .probe = max1363_probe, 1691 .probe = max1363_probe,
1693 .remove = __devexit_p(max1363_remove), 1692 .remove = max1363_remove,
1694 .id_table = max1363_id, 1693 .id_table = max1363_id,
1695}; 1694};
1696module_i2c_driver(max1363_driver); 1695module_i2c_driver(max1363_driver);
diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
index 02a43c87a8a3..cd030e100c39 100644
--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -136,7 +136,7 @@ static const struct iio_info tiadc_info = {
136 .read_raw = &tiadc_read_raw, 136 .read_raw = &tiadc_read_raw,
137}; 137};
138 138
139static int __devinit tiadc_probe(struct platform_device *pdev) 139static int tiadc_probe(struct platform_device *pdev)
140{ 140{
141 struct iio_dev *indio_dev; 141 struct iio_dev *indio_dev;
142 struct tiadc_device *adc_dev; 142 struct tiadc_device *adc_dev;
@@ -188,7 +188,7 @@ err_ret:
188 return err; 188 return err;
189} 189}
190 190
191static int __devexit tiadc_remove(struct platform_device *pdev) 191static int tiadc_remove(struct platform_device *pdev)
192{ 192{
193 struct iio_dev *indio_dev = platform_get_drvdata(pdev); 193 struct iio_dev *indio_dev = platform_get_drvdata(pdev);
194 194
@@ -250,7 +250,7 @@ static struct platform_driver tiadc_driver = {
250 .pm = TIADC_PM_OPS, 250 .pm = TIADC_PM_OPS,
251 }, 251 },
252 .probe = tiadc_probe, 252 .probe = tiadc_probe,
253 .remove = __devexit_p(tiadc_remove), 253 .remove = tiadc_remove,
254}; 254};
255 255
256module_platform_driver(tiadc_driver); 256module_platform_driver(tiadc_driver);
diff --git a/drivers/iio/adc/viperboard_adc.c b/drivers/iio/adc/viperboard_adc.c
index 10136a8b20d4..ad0261533dee 100644
--- a/drivers/iio/adc/viperboard_adc.c
+++ b/drivers/iio/adc/viperboard_adc.c
@@ -116,7 +116,7 @@ static const struct iio_info vprbrd_adc_iio_info = {
116 .driver_module = THIS_MODULE, 116 .driver_module = THIS_MODULE,
117}; 117};
118 118
119static int __devinit vprbrd_adc_probe(struct platform_device *pdev) 119static int vprbrd_adc_probe(struct platform_device *pdev)
120{ 120{
121 struct vprbrd *vb = dev_get_drvdata(pdev->dev.parent); 121 struct vprbrd *vb = dev_get_drvdata(pdev->dev.parent);
122 struct vprbrd_adc *adc; 122 struct vprbrd_adc *adc;
@@ -154,7 +154,7 @@ error:
154 return ret; 154 return ret;
155} 155}
156 156
157static int __devexit vprbrd_adc_remove(struct platform_device *pdev) 157static int vprbrd_adc_remove(struct platform_device *pdev)
158{ 158{
159 struct iio_dev *indio_dev = platform_get_drvdata(pdev); 159 struct iio_dev *indio_dev = platform_get_drvdata(pdev);
160 160
@@ -170,7 +170,7 @@ static struct platform_driver vprbrd_adc_driver = {
170 .owner = THIS_MODULE, 170 .owner = THIS_MODULE,
171 }, 171 },
172 .probe = vprbrd_adc_probe, 172 .probe = vprbrd_adc_probe,
173 .remove = __devexit_p(vprbrd_adc_remove), 173 .remove = vprbrd_adc_remove,
174}; 174};
175 175
176module_platform_driver(vprbrd_adc_driver); 176module_platform_driver(vprbrd_adc_driver);
diff --git a/drivers/iio/amplifiers/ad8366.c b/drivers/iio/amplifiers/ad8366.c
index d8281cdbfc4a..d6c0af23a2a7 100644
--- a/drivers/iio/amplifiers/ad8366.c
+++ b/drivers/iio/amplifiers/ad8366.c
@@ -133,7 +133,7 @@ static const struct iio_chan_spec ad8366_channels[] = {
133 AD8366_CHAN(1), 133 AD8366_CHAN(1),
134}; 134};
135 135
136static int __devinit ad8366_probe(struct spi_device *spi) 136static int ad8366_probe(struct spi_device *spi)
137{ 137{
138 struct iio_dev *indio_dev; 138 struct iio_dev *indio_dev;
139 struct ad8366_state *st; 139 struct ad8366_state *st;
@@ -182,7 +182,7 @@ error_put_reg:
182 return ret; 182 return ret;
183} 183}
184 184
185static int __devexit ad8366_remove(struct spi_device *spi) 185static int ad8366_remove(struct spi_device *spi)
186{ 186{
187 struct iio_dev *indio_dev = spi_get_drvdata(spi); 187 struct iio_dev *indio_dev = spi_get_drvdata(spi);
188 struct ad8366_state *st = iio_priv(indio_dev); 188 struct ad8366_state *st = iio_priv(indio_dev);
@@ -211,7 +211,7 @@ static struct spi_driver ad8366_driver = {
211 .owner = THIS_MODULE, 211 .owner = THIS_MODULE,
212 }, 212 },
213 .probe = ad8366_probe, 213 .probe = ad8366_probe,
214 .remove = __devexit_p(ad8366_remove), 214 .remove = ad8366_remove,
215 .id_table = ad8366_id, 215 .id_table = ad8366_id,
216}; 216};
217 217
diff --git a/drivers/iio/common/hid-sensors/Kconfig b/drivers/iio/common/hid-sensors/Kconfig
index ae10778da7aa..1178121b55b0 100644
--- a/drivers/iio/common/hid-sensors/Kconfig
+++ b/drivers/iio/common/hid-sensors/Kconfig
@@ -6,7 +6,7 @@ menu "Hid Sensor IIO Common"
6config HID_SENSOR_IIO_COMMON 6config HID_SENSOR_IIO_COMMON
7 tristate "Common modules for all HID Sensor IIO drivers" 7 tristate "Common modules for all HID Sensor IIO drivers"
8 depends on HID_SENSOR_HUB 8 depends on HID_SENSOR_HUB
9 select IIO_TRIGGER if IIO_BUFFER 9 select HID_SENSOR_IIO_TRIGGER if IIO_BUFFER
10 help 10 help
11 Say yes here to build support for HID sensor to use 11 Say yes here to build support for HID sensor to use
12 HID sensor common processing for attributes and IIO triggers. 12 HID sensor common processing for attributes and IIO triggers.
@@ -14,6 +14,17 @@ config HID_SENSOR_IIO_COMMON
14 HID sensor drivers, this module contains processing for those 14 HID sensor drivers, this module contains processing for those
15 attributes. 15 attributes.
16 16
17config HID_SENSOR_IIO_TRIGGER
18 tristate "Common module (trigger) for all HID Sensor IIO drivers"
19 depends on HID_SENSOR_HUB && HID_SENSOR_IIO_COMMON
20 select IIO_TRIGGER
21 help
22 Say yes here to build trigger support for HID sensors.
23 Triggers will be send if all requested attributes were read.
24
25 If this driver is compiled as a module, it will be named
26 hid-sensor-trigger.
27
17config HID_SENSOR_ENUM_BASE_QUIRKS 28config HID_SENSOR_ENUM_BASE_QUIRKS
18 bool "ENUM base quirks for HID Sensor IIO drivers" 29 bool "ENUM base quirks for HID Sensor IIO drivers"
19 depends on HID_SENSOR_IIO_COMMON 30 depends on HID_SENSOR_IIO_COMMON
diff --git a/drivers/iio/common/hid-sensors/Makefile b/drivers/iio/common/hid-sensors/Makefile
index 1f463e00c242..22e7c5a82325 100644
--- a/drivers/iio/common/hid-sensors/Makefile
+++ b/drivers/iio/common/hid-sensors/Makefile
@@ -3,4 +3,5 @@
3# 3#
4 4
5obj-$(CONFIG_HID_SENSOR_IIO_COMMON) += hid-sensor-iio-common.o 5obj-$(CONFIG_HID_SENSOR_IIO_COMMON) += hid-sensor-iio-common.o
6hid-sensor-iio-common-y := hid-sensor-attributes.o hid-sensor-trigger.o 6obj-$(CONFIG_HID_SENSOR_IIO_TRIGGER) += hid-sensor-trigger.o
7hid-sensor-iio-common-y := hid-sensor-attributes.o
diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c
index eb281a2c295b..2fe1d4edcb2f 100644
--- a/drivers/iio/dac/ad5064.c
+++ b/drivers/iio/dac/ad5064.c
@@ -424,8 +424,8 @@ static const char * const ad5064_vref_name(struct ad5064_state *st,
424 return st->chip_info->shared_vref ? "vref" : ad5064_vref_names[vref]; 424 return st->chip_info->shared_vref ? "vref" : ad5064_vref_names[vref];
425} 425}
426 426
427static int __devinit ad5064_probe(struct device *dev, enum ad5064_type type, 427static int ad5064_probe(struct device *dev, enum ad5064_type type,
428 const char *name, ad5064_write_func write) 428 const char *name, ad5064_write_func write)
429{ 429{
430 struct iio_dev *indio_dev; 430 struct iio_dev *indio_dev;
431 struct ad5064_state *st; 431 struct ad5064_state *st;
@@ -495,7 +495,7 @@ error_free:
495 return ret; 495 return ret;
496} 496}
497 497
498static int __devexit ad5064_remove(struct device *dev) 498static int ad5064_remove(struct device *dev)
499{ 499{
500 struct iio_dev *indio_dev = dev_get_drvdata(dev); 500 struct iio_dev *indio_dev = dev_get_drvdata(dev);
501 struct ad5064_state *st = iio_priv(indio_dev); 501 struct ad5064_state *st = iio_priv(indio_dev);
@@ -523,7 +523,7 @@ static int ad5064_spi_write(struct ad5064_state *st, unsigned int cmd,
523 return spi_write(spi, &st->data.spi, sizeof(st->data.spi)); 523 return spi_write(spi, &st->data.spi, sizeof(st->data.spi));
524} 524}
525 525
526static int __devinit ad5064_spi_probe(struct spi_device *spi) 526static int ad5064_spi_probe(struct spi_device *spi)
527{ 527{
528 const struct spi_device_id *id = spi_get_device_id(spi); 528 const struct spi_device_id *id = spi_get_device_id(spi);
529 529
@@ -531,7 +531,7 @@ static int __devinit ad5064_spi_probe(struct spi_device *spi)
531 ad5064_spi_write); 531 ad5064_spi_write);
532} 532}
533 533
534static int __devexit ad5064_spi_remove(struct spi_device *spi) 534static int ad5064_spi_remove(struct spi_device *spi)
535{ 535{
536 return ad5064_remove(&spi->dev); 536 return ad5064_remove(&spi->dev);
537} 537}
@@ -563,7 +563,7 @@ static struct spi_driver ad5064_spi_driver = {
563 .owner = THIS_MODULE, 563 .owner = THIS_MODULE,
564 }, 564 },
565 .probe = ad5064_spi_probe, 565 .probe = ad5064_spi_probe,
566 .remove = __devexit_p(ad5064_spi_remove), 566 .remove = ad5064_spi_remove,
567 .id_table = ad5064_spi_ids, 567 .id_table = ad5064_spi_ids,
568}; 568};
569 569
@@ -596,14 +596,14 @@ static int ad5064_i2c_write(struct ad5064_state *st, unsigned int cmd,
596 return i2c_master_send(i2c, st->data.i2c, 3); 596 return i2c_master_send(i2c, st->data.i2c, 3);
597} 597}
598 598
599static int __devinit ad5064_i2c_probe(struct i2c_client *i2c, 599static int ad5064_i2c_probe(struct i2c_client *i2c,
600 const struct i2c_device_id *id) 600 const struct i2c_device_id *id)
601{ 601{
602 return ad5064_probe(&i2c->dev, id->driver_data, id->name, 602 return ad5064_probe(&i2c->dev, id->driver_data, id->name,
603 ad5064_i2c_write); 603 ad5064_i2c_write);
604} 604}
605 605
606static int __devexit ad5064_i2c_remove(struct i2c_client *i2c) 606static int ad5064_i2c_remove(struct i2c_client *i2c)
607{ 607{
608 return ad5064_remove(&i2c->dev); 608 return ad5064_remove(&i2c->dev);
609} 609}
@@ -625,7 +625,7 @@ static struct i2c_driver ad5064_i2c_driver = {
625 .owner = THIS_MODULE, 625 .owner = THIS_MODULE,
626 }, 626 },
627 .probe = ad5064_i2c_probe, 627 .probe = ad5064_i2c_probe,
628 .remove = __devexit_p(ad5064_i2c_remove), 628 .remove = ad5064_i2c_remove,
629 .id_table = ad5064_i2c_ids, 629 .id_table = ad5064_i2c_ids,
630}; 630};
631 631
diff --git a/drivers/iio/dac/ad5360.c b/drivers/iio/dac/ad5360.c
index 8fce84fe70b1..54b46fd3aede 100644
--- a/drivers/iio/dac/ad5360.c
+++ b/drivers/iio/dac/ad5360.c
@@ -433,7 +433,7 @@ static const char * const ad5360_vref_name[] = {
433 "vref0", "vref1", "vref2" 433 "vref0", "vref1", "vref2"
434}; 434};
435 435
436static int __devinit ad5360_alloc_channels(struct iio_dev *indio_dev) 436static int ad5360_alloc_channels(struct iio_dev *indio_dev)
437{ 437{
438 struct ad5360_state *st = iio_priv(indio_dev); 438 struct ad5360_state *st = iio_priv(indio_dev);
439 struct iio_chan_spec *channels; 439 struct iio_chan_spec *channels;
@@ -456,7 +456,7 @@ static int __devinit ad5360_alloc_channels(struct iio_dev *indio_dev)
456 return 0; 456 return 0;
457} 457}
458 458
459static int __devinit ad5360_probe(struct spi_device *spi) 459static int ad5360_probe(struct spi_device *spi)
460{ 460{
461 enum ad5360_type type = spi_get_device_id(spi)->driver_data; 461 enum ad5360_type type = spi_get_device_id(spi)->driver_data;
462 struct iio_dev *indio_dev; 462 struct iio_dev *indio_dev;
@@ -524,7 +524,7 @@ error_free:
524 return ret; 524 return ret;
525} 525}
526 526
527static int __devexit ad5360_remove(struct spi_device *spi) 527static int ad5360_remove(struct spi_device *spi)
528{ 528{
529 struct iio_dev *indio_dev = spi_get_drvdata(spi); 529 struct iio_dev *indio_dev = spi_get_drvdata(spi);
530 struct ad5360_state *st = iio_priv(indio_dev); 530 struct ad5360_state *st = iio_priv(indio_dev);
@@ -560,7 +560,7 @@ static struct spi_driver ad5360_driver = {
560 .owner = THIS_MODULE, 560 .owner = THIS_MODULE,
561 }, 561 },
562 .probe = ad5360_probe, 562 .probe = ad5360_probe,
563 .remove = __devexit_p(ad5360_remove), 563 .remove = ad5360_remove,
564 .id_table = ad5360_ids, 564 .id_table = ad5360_ids,
565}; 565};
566module_spi_driver(ad5360_driver); 566module_spi_driver(ad5360_driver);
diff --git a/drivers/iio/dac/ad5380.c b/drivers/iio/dac/ad5380.c
index 14991ac55f26..483fc379a2da 100644
--- a/drivers/iio/dac/ad5380.c
+++ b/drivers/iio/dac/ad5380.c
@@ -338,7 +338,7 @@ static const struct ad5380_chip_info ad5380_chip_info_tbl[] = {
338 }, 338 },
339}; 339};
340 340
341static int __devinit ad5380_alloc_channels(struct iio_dev *indio_dev) 341static int ad5380_alloc_channels(struct iio_dev *indio_dev)
342{ 342{
343 struct ad5380_state *st = iio_priv(indio_dev); 343 struct ad5380_state *st = iio_priv(indio_dev);
344 struct iio_chan_spec *channels; 344 struct iio_chan_spec *channels;
@@ -361,8 +361,8 @@ static int __devinit ad5380_alloc_channels(struct iio_dev *indio_dev)
361 return 0; 361 return 0;
362} 362}
363 363
364static int __devinit ad5380_probe(struct device *dev, struct regmap *regmap, 364static int ad5380_probe(struct device *dev, struct regmap *regmap,
365 enum ad5380_type type, const char *name) 365 enum ad5380_type type, const char *name)
366{ 366{
367 struct iio_dev *indio_dev; 367 struct iio_dev *indio_dev;
368 struct ad5380_state *st; 368 struct ad5380_state *st;
@@ -406,7 +406,11 @@ static int __devinit ad5380_probe(struct device *dev, struct regmap *regmap,
406 goto error_free_reg; 406 goto error_free_reg;
407 } 407 }
408 408
409 st->vref = regulator_get_voltage(st->vref_reg); 409 ret = regulator_get_voltage(st->vref_reg);
410 if (ret < 0)
411 goto error_disable_reg;
412
413 st->vref = ret;
410 } else { 414 } else {
411 st->vref = st->chip_info->int_vref; 415 st->vref = st->chip_info->int_vref;
412 ctrl |= AD5380_CTRL_INT_VREF_EN; 416 ctrl |= AD5380_CTRL_INT_VREF_EN;
@@ -441,7 +445,7 @@ error_out:
441 return ret; 445 return ret;
442} 446}
443 447
444static int __devexit ad5380_remove(struct device *dev) 448static int ad5380_remove(struct device *dev)
445{ 449{
446 struct iio_dev *indio_dev = dev_get_drvdata(dev); 450 struct iio_dev *indio_dev = dev_get_drvdata(dev);
447 struct ad5380_state *st = iio_priv(indio_dev); 451 struct ad5380_state *st = iio_priv(indio_dev);
@@ -478,7 +482,7 @@ static const struct regmap_config ad5380_regmap_config = {
478 482
479#if IS_ENABLED(CONFIG_SPI_MASTER) 483#if IS_ENABLED(CONFIG_SPI_MASTER)
480 484
481static int __devinit ad5380_spi_probe(struct spi_device *spi) 485static int ad5380_spi_probe(struct spi_device *spi)
482{ 486{
483 const struct spi_device_id *id = spi_get_device_id(spi); 487 const struct spi_device_id *id = spi_get_device_id(spi);
484 struct regmap *regmap; 488 struct regmap *regmap;
@@ -491,7 +495,7 @@ static int __devinit ad5380_spi_probe(struct spi_device *spi)
491 return ad5380_probe(&spi->dev, regmap, id->driver_data, id->name); 495 return ad5380_probe(&spi->dev, regmap, id->driver_data, id->name);
492} 496}
493 497
494static int __devexit ad5380_spi_remove(struct spi_device *spi) 498static int ad5380_spi_remove(struct spi_device *spi)
495{ 499{
496 return ad5380_remove(&spi->dev); 500 return ad5380_remove(&spi->dev);
497} 501}
@@ -523,7 +527,7 @@ static struct spi_driver ad5380_spi_driver = {
523 .owner = THIS_MODULE, 527 .owner = THIS_MODULE,
524 }, 528 },
525 .probe = ad5380_spi_probe, 529 .probe = ad5380_spi_probe,
526 .remove = __devexit_p(ad5380_spi_remove), 530 .remove = ad5380_spi_remove,
527 .id_table = ad5380_spi_ids, 531 .id_table = ad5380_spi_ids,
528}; 532};
529 533
@@ -552,8 +556,8 @@ static inline void ad5380_spi_unregister_driver(void)
552 556
553#if IS_ENABLED(CONFIG_I2C) 557#if IS_ENABLED(CONFIG_I2C)
554 558
555static int __devinit ad5380_i2c_probe(struct i2c_client *i2c, 559static int ad5380_i2c_probe(struct i2c_client *i2c,
556 const struct i2c_device_id *id) 560 const struct i2c_device_id *id)
557{ 561{
558 struct regmap *regmap; 562 struct regmap *regmap;
559 563
@@ -565,7 +569,7 @@ static int __devinit ad5380_i2c_probe(struct i2c_client *i2c,
565 return ad5380_probe(&i2c->dev, regmap, id->driver_data, id->name); 569 return ad5380_probe(&i2c->dev, regmap, id->driver_data, id->name);
566} 570}
567 571
568static int __devexit ad5380_i2c_remove(struct i2c_client *i2c) 572static int ad5380_i2c_remove(struct i2c_client *i2c)
569{ 573{
570 return ad5380_remove(&i2c->dev); 574 return ad5380_remove(&i2c->dev);
571} 575}
@@ -597,7 +601,7 @@ static struct i2c_driver ad5380_i2c_driver = {
597 .owner = THIS_MODULE, 601 .owner = THIS_MODULE,
598 }, 602 },
599 .probe = ad5380_i2c_probe, 603 .probe = ad5380_i2c_probe,
600 .remove = __devexit_p(ad5380_i2c_remove), 604 .remove = ad5380_i2c_remove,
601 .id_table = ad5380_i2c_ids, 605 .id_table = ad5380_i2c_ids,
602}; 606};
603 607
diff --git a/drivers/iio/dac/ad5421.c b/drivers/iio/dac/ad5421.c
index cdbc5bf25c31..43be948db83e 100644
--- a/drivers/iio/dac/ad5421.c
+++ b/drivers/iio/dac/ad5421.c
@@ -449,7 +449,7 @@ static const struct iio_info ad5421_info = {
449 .driver_module = THIS_MODULE, 449 .driver_module = THIS_MODULE,
450}; 450};
451 451
452static int __devinit ad5421_probe(struct spi_device *spi) 452static int ad5421_probe(struct spi_device *spi)
453{ 453{
454 struct ad5421_platform_data *pdata = dev_get_platdata(&spi->dev); 454 struct ad5421_platform_data *pdata = dev_get_platdata(&spi->dev);
455 struct iio_dev *indio_dev; 455 struct iio_dev *indio_dev;
@@ -516,7 +516,7 @@ error_free:
516 return ret; 516 return ret;
517} 517}
518 518
519static int __devexit ad5421_remove(struct spi_device *spi) 519static int ad5421_remove(struct spi_device *spi)
520{ 520{
521 struct iio_dev *indio_dev = spi_get_drvdata(spi); 521 struct iio_dev *indio_dev = spi_get_drvdata(spi);
522 522
@@ -534,7 +534,7 @@ static struct spi_driver ad5421_driver = {
534 .owner = THIS_MODULE, 534 .owner = THIS_MODULE,
535 }, 535 },
536 .probe = ad5421_probe, 536 .probe = ad5421_probe,
537 .remove = __devexit_p(ad5421_remove), 537 .remove = ad5421_remove,
538}; 538};
539module_spi_driver(ad5421_driver); 539module_spi_driver(ad5421_driver);
540 540
diff --git a/drivers/iio/dac/ad5446.c b/drivers/iio/dac/ad5446.c
index 3310cbbd41e7..f5583aedfb59 100644
--- a/drivers/iio/dac/ad5446.c
+++ b/drivers/iio/dac/ad5446.c
@@ -212,8 +212,8 @@ static const struct iio_info ad5446_info = {
212 .driver_module = THIS_MODULE, 212 .driver_module = THIS_MODULE,
213}; 213};
214 214
215static int __devinit ad5446_probe(struct device *dev, const char *name, 215static int ad5446_probe(struct device *dev, const char *name,
216 const struct ad5446_chip_info *chip_info) 216 const struct ad5446_chip_info *chip_info)
217{ 217{
218 struct ad5446_state *st; 218 struct ad5446_state *st;
219 struct iio_dev *indio_dev; 219 struct iio_dev *indio_dev;
@@ -226,7 +226,11 @@ static int __devinit ad5446_probe(struct device *dev, const char *name,
226 if (ret) 226 if (ret)
227 goto error_put_reg; 227 goto error_put_reg;
228 228
229 voltage_uv = regulator_get_voltage(reg); 229 ret = regulator_get_voltage(reg);
230 if (ret < 0)
231 goto error_disable_reg;
232
233 voltage_uv = ret;
230 } 234 }
231 235
232 indio_dev = iio_device_alloc(sizeof(*st)); 236 indio_dev = iio_device_alloc(sizeof(*st));
@@ -461,7 +465,7 @@ static const struct spi_device_id ad5446_spi_ids[] = {
461}; 465};
462MODULE_DEVICE_TABLE(spi, ad5446_spi_ids); 466MODULE_DEVICE_TABLE(spi, ad5446_spi_ids);
463 467
464static int __devinit ad5446_spi_probe(struct spi_device *spi) 468static int ad5446_spi_probe(struct spi_device *spi)
465{ 469{
466 const struct spi_device_id *id = spi_get_device_id(spi); 470 const struct spi_device_id *id = spi_get_device_id(spi);
467 471
@@ -469,7 +473,7 @@ static int __devinit ad5446_spi_probe(struct spi_device *spi)
469 &ad5446_spi_chip_info[id->driver_data]); 473 &ad5446_spi_chip_info[id->driver_data]);
470} 474}
471 475
472static int __devexit ad5446_spi_remove(struct spi_device *spi) 476static int ad5446_spi_remove(struct spi_device *spi)
473{ 477{
474 return ad5446_remove(&spi->dev); 478 return ad5446_remove(&spi->dev);
475} 479}
@@ -480,7 +484,7 @@ static struct spi_driver ad5446_spi_driver = {
480 .owner = THIS_MODULE, 484 .owner = THIS_MODULE,
481 }, 485 },
482 .probe = ad5446_spi_probe, 486 .probe = ad5446_spi_probe,
483 .remove = __devexit_p(ad5446_spi_remove), 487 .remove = ad5446_spi_remove,
484 .id_table = ad5446_spi_ids, 488 .id_table = ad5446_spi_ids,
485}; 489};
486 490
@@ -539,14 +543,14 @@ static const struct ad5446_chip_info ad5446_i2c_chip_info[] = {
539 }, 543 },
540}; 544};
541 545
542static int __devinit ad5446_i2c_probe(struct i2c_client *i2c, 546static int ad5446_i2c_probe(struct i2c_client *i2c,
543 const struct i2c_device_id *id) 547 const struct i2c_device_id *id)
544{ 548{
545 return ad5446_probe(&i2c->dev, id->name, 549 return ad5446_probe(&i2c->dev, id->name,
546 &ad5446_i2c_chip_info[id->driver_data]); 550 &ad5446_i2c_chip_info[id->driver_data]);
547} 551}
548 552
549static int __devexit ad5446_i2c_remove(struct i2c_client *i2c) 553static int ad5446_i2c_remove(struct i2c_client *i2c)
550{ 554{
551 return ad5446_remove(&i2c->dev); 555 return ad5446_remove(&i2c->dev);
552} 556}
@@ -568,7 +572,7 @@ static struct i2c_driver ad5446_i2c_driver = {
568 .owner = THIS_MODULE, 572 .owner = THIS_MODULE,
569 }, 573 },
570 .probe = ad5446_i2c_probe, 574 .probe = ad5446_i2c_probe,
571 .remove = __devexit_p(ad5446_i2c_remove), 575 .remove = ad5446_i2c_remove,
572 .id_table = ad5446_i2c_ids, 576 .id_table = ad5446_i2c_ids,
573}; 577};
574 578
diff --git a/drivers/iio/dac/ad5449.c b/drivers/iio/dac/ad5449.c
index 0ee6f8eeba8d..c4731b7b577b 100644
--- a/drivers/iio/dac/ad5449.c
+++ b/drivers/iio/dac/ad5449.c
@@ -266,7 +266,7 @@ static const char *ad5449_vref_name(struct ad5449 *st, int n)
266 return "VREFB"; 266 return "VREFB";
267} 267}
268 268
269static int __devinit ad5449_spi_probe(struct spi_device *spi) 269static int ad5449_spi_probe(struct spi_device *spi)
270{ 270{
271 struct ad5449_platform_data *pdata = spi->dev.platform_data; 271 struct ad5449_platform_data *pdata = spi->dev.platform_data;
272 const struct spi_device_id *id = spi_get_device_id(spi); 272 const struct spi_device_id *id = spi_get_device_id(spi);
@@ -333,7 +333,7 @@ error_free:
333 return ret; 333 return ret;
334} 334}
335 335
336static int __devexit ad5449_spi_remove(struct spi_device *spi) 336static int ad5449_spi_remove(struct spi_device *spi)
337{ 337{
338 struct iio_dev *indio_dev = spi_get_drvdata(spi); 338 struct iio_dev *indio_dev = spi_get_drvdata(spi);
339 struct ad5449 *st = iio_priv(indio_dev); 339 struct ad5449 *st = iio_priv(indio_dev);
@@ -366,7 +366,7 @@ static struct spi_driver ad5449_spi_driver = {
366 .owner = THIS_MODULE, 366 .owner = THIS_MODULE,
367 }, 367 },
368 .probe = ad5449_spi_probe, 368 .probe = ad5449_spi_probe,
369 .remove = __devexit_p(ad5449_spi_remove), 369 .remove = ad5449_spi_remove,
370 .id_table = ad5449_spi_ids, 370 .id_table = ad5449_spi_ids,
371}; 371};
372module_spi_driver(ad5449_spi_driver); 372module_spi_driver(ad5449_spi_driver);
diff --git a/drivers/iio/dac/ad5504.c b/drivers/iio/dac/ad5504.c
index 242bdc7d0044..0661829f2773 100644
--- a/drivers/iio/dac/ad5504.c
+++ b/drivers/iio/dac/ad5504.c
@@ -277,7 +277,7 @@ static const struct iio_chan_spec ad5504_channels[] = {
277 AD5504_CHANNEL(3), 277 AD5504_CHANNEL(3),
278}; 278};
279 279
280static int __devinit ad5504_probe(struct spi_device *spi) 280static int ad5504_probe(struct spi_device *spi)
281{ 281{
282 struct ad5504_platform_data *pdata = spi->dev.platform_data; 282 struct ad5504_platform_data *pdata = spi->dev.platform_data;
283 struct iio_dev *indio_dev; 283 struct iio_dev *indio_dev;
@@ -296,7 +296,11 @@ static int __devinit ad5504_probe(struct spi_device *spi)
296 if (ret) 296 if (ret)
297 goto error_put_reg; 297 goto error_put_reg;
298 298
299 voltage_uv = regulator_get_voltage(reg); 299 ret = regulator_get_voltage(reg);
300 if (ret < 0)
301 goto error_disable_reg;
302
303 voltage_uv = ret;
300 } 304 }
301 305
302 spi_set_drvdata(spi, indio_dev); 306 spi_set_drvdata(spi, indio_dev);
@@ -352,7 +356,7 @@ error_ret:
352 return ret; 356 return ret;
353} 357}
354 358
355static int __devexit ad5504_remove(struct spi_device *spi) 359static int ad5504_remove(struct spi_device *spi)
356{ 360{
357 struct iio_dev *indio_dev = spi_get_drvdata(spi); 361 struct iio_dev *indio_dev = spi_get_drvdata(spi);
358 struct ad5504_state *st = iio_priv(indio_dev); 362 struct ad5504_state *st = iio_priv(indio_dev);
@@ -383,7 +387,7 @@ static struct spi_driver ad5504_driver = {
383 .owner = THIS_MODULE, 387 .owner = THIS_MODULE,
384 }, 388 },
385 .probe = ad5504_probe, 389 .probe = ad5504_probe,
386 .remove = __devexit_p(ad5504_remove), 390 .remove = ad5504_remove,
387 .id_table = ad5504_id, 391 .id_table = ad5504_id,
388}; 392};
389module_spi_driver(ad5504_driver); 393module_spi_driver(ad5504_driver);
diff --git a/drivers/iio/dac/ad5624r_spi.c b/drivers/iio/dac/ad5624r_spi.c
index 6a7d6a48cc6d..f6e116627b71 100644
--- a/drivers/iio/dac/ad5624r_spi.c
+++ b/drivers/iio/dac/ad5624r_spi.c
@@ -220,7 +220,7 @@ static const struct ad5624r_chip_info ad5624r_chip_info_tbl[] = {
220 }, 220 },
221}; 221};
222 222
223static int __devinit ad5624r_probe(struct spi_device *spi) 223static int ad5624r_probe(struct spi_device *spi)
224{ 224{
225 struct ad5624r_state *st; 225 struct ad5624r_state *st;
226 struct iio_dev *indio_dev; 226 struct iio_dev *indio_dev;
@@ -238,7 +238,11 @@ static int __devinit ad5624r_probe(struct spi_device *spi)
238 if (ret) 238 if (ret)
239 goto error_put_reg; 239 goto error_put_reg;
240 240
241 voltage_uv = regulator_get_voltage(st->reg); 241 ret = regulator_get_voltage(st->reg);
242 if (ret < 0)
243 goto error_disable_reg;
244
245 voltage_uv = ret;
242 } 246 }
243 247
244 spi_set_drvdata(spi, indio_dev); 248 spi_set_drvdata(spi, indio_dev);
@@ -282,7 +286,7 @@ error_ret:
282 return ret; 286 return ret;
283} 287}
284 288
285static int __devexit ad5624r_remove(struct spi_device *spi) 289static int ad5624r_remove(struct spi_device *spi)
286{ 290{
287 struct iio_dev *indio_dev = spi_get_drvdata(spi); 291 struct iio_dev *indio_dev = spi_get_drvdata(spi);
288 struct ad5624r_state *st = iio_priv(indio_dev); 292 struct ad5624r_state *st = iio_priv(indio_dev);
@@ -314,7 +318,7 @@ static struct spi_driver ad5624r_driver = {
314 .owner = THIS_MODULE, 318 .owner = THIS_MODULE,
315 }, 319 },
316 .probe = ad5624r_probe, 320 .probe = ad5624r_probe,
317 .remove = __devexit_p(ad5624r_remove), 321 .remove = ad5624r_remove,
318 .id_table = ad5624r_id, 322 .id_table = ad5624r_id,
319}; 323};
320module_spi_driver(ad5624r_driver); 324module_spi_driver(ad5624r_driver);
diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c
index bc92ff9309c2..ca9609d7a15c 100644
--- a/drivers/iio/dac/ad5686.c
+++ b/drivers/iio/dac/ad5686.c
@@ -313,7 +313,7 @@ static const struct ad5686_chip_info ad5686_chip_info_tbl[] = {
313}; 313};
314 314
315 315
316static int __devinit ad5686_probe(struct spi_device *spi) 316static int ad5686_probe(struct spi_device *spi)
317{ 317{
318 struct ad5686_state *st; 318 struct ad5686_state *st;
319 struct iio_dev *indio_dev; 319 struct iio_dev *indio_dev;
@@ -332,7 +332,11 @@ static int __devinit ad5686_probe(struct spi_device *spi)
332 if (ret) 332 if (ret)
333 goto error_put_reg; 333 goto error_put_reg;
334 334
335 voltage_uv = regulator_get_voltage(st->reg); 335 ret = regulator_get_voltage(st->reg);
336 if (ret < 0)
337 goto error_disable_reg;
338
339 voltage_uv = ret;
336 } 340 }
337 341
338 st->chip_info = 342 st->chip_info =
@@ -379,7 +383,7 @@ error_put_reg:
379 return ret; 383 return ret;
380} 384}
381 385
382static int __devexit ad5686_remove(struct spi_device *spi) 386static int ad5686_remove(struct spi_device *spi)
383{ 387{
384 struct iio_dev *indio_dev = spi_get_drvdata(spi); 388 struct iio_dev *indio_dev = spi_get_drvdata(spi);
385 struct ad5686_state *st = iio_priv(indio_dev); 389 struct ad5686_state *st = iio_priv(indio_dev);
@@ -408,7 +412,7 @@ static struct spi_driver ad5686_driver = {
408 .owner = THIS_MODULE, 412 .owner = THIS_MODULE,
409 }, 413 },
410 .probe = ad5686_probe, 414 .probe = ad5686_probe,
411 .remove = __devexit_p(ad5686_remove), 415 .remove = ad5686_remove,
412 .id_table = ad5686_id, 416 .id_table = ad5686_id,
413}; 417};
414module_spi_driver(ad5686_driver); 418module_spi_driver(ad5686_driver);
diff --git a/drivers/iio/dac/ad5755.c b/drivers/iio/dac/ad5755.c
index 5db3506034c5..0869bbd27d30 100644
--- a/drivers/iio/dac/ad5755.c
+++ b/drivers/iio/dac/ad5755.c
@@ -447,8 +447,8 @@ static bool ad5755_is_valid_mode(struct ad5755_state *st, enum ad5755_mode mode)
447 } 447 }
448} 448}
449 449
450static int __devinit ad5755_setup_pdata(struct iio_dev *indio_dev, 450static int ad5755_setup_pdata(struct iio_dev *indio_dev,
451 const struct ad5755_platform_data *pdata) 451 const struct ad5755_platform_data *pdata)
452{ 452{
453 struct ad5755_state *st = iio_priv(indio_dev); 453 struct ad5755_state *st = iio_priv(indio_dev);
454 unsigned int val; 454 unsigned int val;
@@ -503,7 +503,7 @@ static int __devinit ad5755_setup_pdata(struct iio_dev *indio_dev,
503 return 0; 503 return 0;
504} 504}
505 505
506static bool __devinit ad5755_is_voltage_mode(enum ad5755_mode mode) 506static bool ad5755_is_voltage_mode(enum ad5755_mode mode)
507{ 507{
508 switch (mode) { 508 switch (mode) {
509 case AD5755_MODE_VOLTAGE_0V_5V: 509 case AD5755_MODE_VOLTAGE_0V_5V:
@@ -516,8 +516,8 @@ static bool __devinit ad5755_is_voltage_mode(enum ad5755_mode mode)
516 } 516 }
517} 517}
518 518
519static int __devinit ad5755_init_channels(struct iio_dev *indio_dev, 519static int ad5755_init_channels(struct iio_dev *indio_dev,
520 const struct ad5755_platform_data *pdata) 520 const struct ad5755_platform_data *pdata)
521{ 521{
522 struct ad5755_state *st = iio_priv(indio_dev); 522 struct ad5755_state *st = iio_priv(indio_dev);
523 struct iio_chan_spec *channels = st->channels; 523 struct iio_chan_spec *channels = st->channels;
@@ -562,7 +562,7 @@ static const struct ad5755_platform_data ad5755_default_pdata = {
562 }, 562 },
563}; 563};
564 564
565static int __devinit ad5755_probe(struct spi_device *spi) 565static int ad5755_probe(struct spi_device *spi)
566{ 566{
567 enum ad5755_type type = spi_get_device_id(spi)->driver_data; 567 enum ad5755_type type = spi_get_device_id(spi)->driver_data;
568 const struct ad5755_platform_data *pdata = dev_get_platdata(&spi->dev); 568 const struct ad5755_platform_data *pdata = dev_get_platdata(&spi->dev);
@@ -614,7 +614,7 @@ error_free:
614 return ret; 614 return ret;
615} 615}
616 616
617static int __devexit ad5755_remove(struct spi_device *spi) 617static int ad5755_remove(struct spi_device *spi)
618{ 618{
619 struct iio_dev *indio_dev = spi_get_drvdata(spi); 619 struct iio_dev *indio_dev = spi_get_drvdata(spi);
620 620
@@ -640,7 +640,7 @@ static struct spi_driver ad5755_driver = {
640 .owner = THIS_MODULE, 640 .owner = THIS_MODULE,
641 }, 641 },
642 .probe = ad5755_probe, 642 .probe = ad5755_probe,
643 .remove = __devexit_p(ad5755_remove), 643 .remove = ad5755_remove,
644 .id_table = ad5755_id, 644 .id_table = ad5755_id,
645}; 645};
646module_spi_driver(ad5755_driver); 646module_spi_driver(ad5755_driver);
diff --git a/drivers/iio/dac/ad5764.c b/drivers/iio/dac/ad5764.c
index ffce30447445..7f9045e6daa4 100644
--- a/drivers/iio/dac/ad5764.c
+++ b/drivers/iio/dac/ad5764.c
@@ -273,7 +273,7 @@ static const struct iio_info ad5764_info = {
273 .driver_module = THIS_MODULE, 273 .driver_module = THIS_MODULE,
274}; 274};
275 275
276static int __devinit ad5764_probe(struct spi_device *spi) 276static int ad5764_probe(struct spi_device *spi)
277{ 277{
278 enum ad5764_type type = spi_get_device_id(spi)->driver_data; 278 enum ad5764_type type = spi_get_device_id(spi)->driver_data;
279 struct iio_dev *indio_dev; 279 struct iio_dev *indio_dev;
@@ -340,7 +340,7 @@ error_free:
340 return ret; 340 return ret;
341} 341}
342 342
343static int __devexit ad5764_remove(struct spi_device *spi) 343static int ad5764_remove(struct spi_device *spi)
344{ 344{
345 struct iio_dev *indio_dev = spi_get_drvdata(spi); 345 struct iio_dev *indio_dev = spi_get_drvdata(spi);
346 struct ad5764_state *st = iio_priv(indio_dev); 346 struct ad5764_state *st = iio_priv(indio_dev);
@@ -372,7 +372,7 @@ static struct spi_driver ad5764_driver = {
372 .owner = THIS_MODULE, 372 .owner = THIS_MODULE,
373 }, 373 },
374 .probe = ad5764_probe, 374 .probe = ad5764_probe,
375 .remove = __devexit_p(ad5764_remove), 375 .remove = ad5764_remove,
376 .id_table = ad5764_ids, 376 .id_table = ad5764_ids,
377}; 377};
378module_spi_driver(ad5764_driver); 378module_spi_driver(ad5764_driver);
diff --git a/drivers/iio/dac/ad5791.c b/drivers/iio/dac/ad5791.c
index 2bd2e37280ff..6407b5407ddd 100644
--- a/drivers/iio/dac/ad5791.c
+++ b/drivers/iio/dac/ad5791.c
@@ -346,7 +346,7 @@ static const struct iio_info ad5791_info = {
346 .driver_module = THIS_MODULE, 346 .driver_module = THIS_MODULE,
347}; 347};
348 348
349static int __devinit ad5791_probe(struct spi_device *spi) 349static int ad5791_probe(struct spi_device *spi)
350{ 350{
351 struct ad5791_platform_data *pdata = spi->dev.platform_data; 351 struct ad5791_platform_data *pdata = spi->dev.platform_data;
352 struct iio_dev *indio_dev; 352 struct iio_dev *indio_dev;
@@ -365,7 +365,11 @@ static int __devinit ad5791_probe(struct spi_device *spi)
365 if (ret) 365 if (ret)
366 goto error_put_reg_pos; 366 goto error_put_reg_pos;
367 367
368 pos_voltage_uv = regulator_get_voltage(st->reg_vdd); 368 ret = regulator_get_voltage(st->reg_vdd);
369 if (ret < 0)
370 goto error_disable_reg_pos;
371
372 pos_voltage_uv = ret;
369 } 373 }
370 374
371 st->reg_vss = regulator_get(&spi->dev, "vss"); 375 st->reg_vss = regulator_get(&spi->dev, "vss");
@@ -374,7 +378,11 @@ static int __devinit ad5791_probe(struct spi_device *spi)
374 if (ret) 378 if (ret)
375 goto error_put_reg_neg; 379 goto error_put_reg_neg;
376 380
377 neg_voltage_uv = regulator_get_voltage(st->reg_vss); 381 ret = regulator_get_voltage(st->reg_vss);
382 if (ret < 0)
383 goto error_disable_reg_neg;
384
385 neg_voltage_uv = ret;
378 } 386 }
379 387
380 st->pwr_down = true; 388 st->pwr_down = true;
@@ -428,6 +436,7 @@ error_put_reg_neg:
428 if (!IS_ERR(st->reg_vss)) 436 if (!IS_ERR(st->reg_vss))
429 regulator_put(st->reg_vss); 437 regulator_put(st->reg_vss);
430 438
439error_disable_reg_pos:
431 if (!IS_ERR(st->reg_vdd)) 440 if (!IS_ERR(st->reg_vdd))
432 regulator_disable(st->reg_vdd); 441 regulator_disable(st->reg_vdd);
433error_put_reg_pos: 442error_put_reg_pos:
@@ -439,7 +448,7 @@ error_ret:
439 return ret; 448 return ret;
440} 449}
441 450
442static int __devexit ad5791_remove(struct spi_device *spi) 451static int ad5791_remove(struct spi_device *spi)
443{ 452{
444 struct iio_dev *indio_dev = spi_get_drvdata(spi); 453 struct iio_dev *indio_dev = spi_get_drvdata(spi);
445 struct ad5791_state *st = iio_priv(indio_dev); 454 struct ad5791_state *st = iio_priv(indio_dev);
@@ -475,7 +484,7 @@ static struct spi_driver ad5791_driver = {
475 .owner = THIS_MODULE, 484 .owner = THIS_MODULE,
476 }, 485 },
477 .probe = ad5791_probe, 486 .probe = ad5791_probe,
478 .remove = __devexit_p(ad5791_remove), 487 .remove = ad5791_remove,
479 .id_table = ad5791_id, 488 .id_table = ad5791_id,
480}; 489};
481module_spi_driver(ad5791_driver); 490module_spi_driver(ad5791_driver);
diff --git a/drivers/iio/dac/max517.c b/drivers/iio/dac/max517.c
index c3d748c25939..352abe2004a4 100644
--- a/drivers/iio/dac/max517.c
+++ b/drivers/iio/dac/max517.c
@@ -156,7 +156,7 @@ static const struct iio_chan_spec max517_channels[] = {
156 MAX517_CHANNEL(1) 156 MAX517_CHANNEL(1)
157}; 157};
158 158
159static int __devinit max517_probe(struct i2c_client *client, 159static int max517_probe(struct i2c_client *client,
160 const struct i2c_device_id *id) 160 const struct i2c_device_id *id)
161{ 161{
162 struct max517_data *data; 162 struct max517_data *data;
@@ -210,7 +210,7 @@ exit:
210 return err; 210 return err;
211} 211}
212 212
213static int __devexit max517_remove(struct i2c_client *client) 213static int max517_remove(struct i2c_client *client)
214{ 214{
215 iio_device_unregister(i2c_get_clientdata(client)); 215 iio_device_unregister(i2c_get_clientdata(client));
216 iio_device_free(i2c_get_clientdata(client)); 216 iio_device_free(i2c_get_clientdata(client));
@@ -232,7 +232,7 @@ static struct i2c_driver max517_driver = {
232 .pm = MAX517_PM_OPS, 232 .pm = MAX517_PM_OPS,
233 }, 233 },
234 .probe = max517_probe, 234 .probe = max517_probe,
235 .remove = __devexit_p(max517_remove), 235 .remove = max517_remove,
236 .id_table = max517_id, 236 .id_table = max517_id,
237}; 237};
238module_i2c_driver(max517_driver); 238module_i2c_driver(max517_driver);
diff --git a/drivers/iio/dac/mcp4725.c b/drivers/iio/dac/mcp4725.c
index e0e168bd5b45..8f88cc4059a2 100644
--- a/drivers/iio/dac/mcp4725.c
+++ b/drivers/iio/dac/mcp4725.c
@@ -141,8 +141,8 @@ static const struct iio_info mcp4725_info = {
141 .driver_module = THIS_MODULE, 141 .driver_module = THIS_MODULE,
142}; 142};
143 143
144static int __devinit mcp4725_probe(struct i2c_client *client, 144static int mcp4725_probe(struct i2c_client *client,
145 const struct i2c_device_id *id) 145 const struct i2c_device_id *id)
146{ 146{
147 struct mcp4725_data *data; 147 struct mcp4725_data *data;
148 struct iio_dev *indio_dev; 148 struct iio_dev *indio_dev;
@@ -195,7 +195,7 @@ exit:
195 return err; 195 return err;
196} 196}
197 197
198static int __devexit mcp4725_remove(struct i2c_client *client) 198static int mcp4725_remove(struct i2c_client *client)
199{ 199{
200 struct iio_dev *indio_dev = i2c_get_clientdata(client); 200 struct iio_dev *indio_dev = i2c_get_clientdata(client);
201 201
@@ -217,7 +217,7 @@ static struct i2c_driver mcp4725_driver = {
217 .pm = MCP4725_PM_OPS, 217 .pm = MCP4725_PM_OPS,
218 }, 218 },
219 .probe = mcp4725_probe, 219 .probe = mcp4725_probe,
220 .remove = __devexit_p(mcp4725_remove), 220 .remove = mcp4725_remove,
221 .id_table = mcp4725_id, 221 .id_table = mcp4725_id,
222}; 222};
223module_i2c_driver(mcp4725_driver); 223module_i2c_driver(mcp4725_driver);
diff --git a/drivers/iio/frequency/ad9523.c b/drivers/iio/frequency/ad9523.c
index b737c64a402d..80307473e3a9 100644
--- a/drivers/iio/frequency/ad9523.c
+++ b/drivers/iio/frequency/ad9523.c
@@ -959,7 +959,7 @@ static int ad9523_setup(struct iio_dev *indio_dev)
959 return 0; 959 return 0;
960} 960}
961 961
962static int __devinit ad9523_probe(struct spi_device *spi) 962static int ad9523_probe(struct spi_device *spi)
963{ 963{
964 struct ad9523_platform_data *pdata = spi->dev.platform_data; 964 struct ad9523_platform_data *pdata = spi->dev.platform_data;
965 struct iio_dev *indio_dev; 965 struct iio_dev *indio_dev;
@@ -1020,7 +1020,7 @@ error_put_reg:
1020 return ret; 1020 return ret;
1021} 1021}
1022 1022
1023static int __devexit ad9523_remove(struct spi_device *spi) 1023static int ad9523_remove(struct spi_device *spi)
1024{ 1024{
1025 struct iio_dev *indio_dev = spi_get_drvdata(spi); 1025 struct iio_dev *indio_dev = spi_get_drvdata(spi);
1026 struct ad9523_state *st = iio_priv(indio_dev); 1026 struct ad9523_state *st = iio_priv(indio_dev);
@@ -1049,7 +1049,7 @@ static struct spi_driver ad9523_driver = {
1049 .owner = THIS_MODULE, 1049 .owner = THIS_MODULE,
1050 }, 1050 },
1051 .probe = ad9523_probe, 1051 .probe = ad9523_probe,
1052 .remove = __devexit_p(ad9523_remove), 1052 .remove = ad9523_remove,
1053 .id_table = ad9523_id, 1053 .id_table = ad9523_id,
1054}; 1054};
1055module_spi_driver(ad9523_driver); 1055module_spi_driver(ad9523_driver);
diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c
index e35bb8f6fe75..a884252ac66b 100644
--- a/drivers/iio/frequency/adf4350.c
+++ b/drivers/iio/frequency/adf4350.c
@@ -173,7 +173,7 @@ static int adf4350_set_freq(struct adf4350_state *st, unsigned long long freq)
173 } while ((st->r1_mod > ADF4350_MAX_MODULUS) && r_cnt); 173 } while ((st->r1_mod > ADF4350_MAX_MODULUS) && r_cnt);
174 } while (r_cnt == 0); 174 } while (r_cnt == 0);
175 175
176 tmp = freq * (u64)st->r1_mod + (st->fpfd > 1); 176 tmp = freq * (u64)st->r1_mod + (st->fpfd >> 1);
177 do_div(tmp, st->fpfd); /* Div round closest (n + d/2)/d */ 177 do_div(tmp, st->fpfd); /* Div round closest (n + d/2)/d */
178 st->r0_fract = do_div(tmp, st->r1_mod); 178 st->r0_fract = do_div(tmp, st->r1_mod);
179 st->r0_int = tmp; 179 st->r0_int = tmp;
@@ -355,7 +355,7 @@ static const struct iio_info adf4350_info = {
355 .driver_module = THIS_MODULE, 355 .driver_module = THIS_MODULE,
356}; 356};
357 357
358static int __devinit adf4350_probe(struct spi_device *spi) 358static int adf4350_probe(struct spi_device *spi)
359{ 359{
360 struct adf4350_platform_data *pdata = spi->dev.platform_data; 360 struct adf4350_platform_data *pdata = spi->dev.platform_data;
361 struct iio_dev *indio_dev; 361 struct iio_dev *indio_dev;
@@ -440,7 +440,7 @@ error_put_reg:
440 return ret; 440 return ret;
441} 441}
442 442
443static int __devexit adf4350_remove(struct spi_device *spi) 443static int adf4350_remove(struct spi_device *spi)
444{ 444{
445 struct iio_dev *indio_dev = spi_get_drvdata(spi); 445 struct iio_dev *indio_dev = spi_get_drvdata(spi);
446 struct adf4350_state *st = iio_priv(indio_dev); 446 struct adf4350_state *st = iio_priv(indio_dev);
@@ -476,7 +476,7 @@ static struct spi_driver adf4350_driver = {
476 .owner = THIS_MODULE, 476 .owner = THIS_MODULE,
477 }, 477 },
478 .probe = adf4350_probe, 478 .probe = adf4350_probe,
479 .remove = __devexit_p(adf4350_remove), 479 .remove = adf4350_remove,
480 .id_table = adf4350_id, 480 .id_table = adf4350_id,
481}; 481};
482module_spi_driver(adf4350_driver); 482module_spi_driver(adf4350_driver);
diff --git a/drivers/iio/gyro/Kconfig b/drivers/iio/gyro/Kconfig
index 48ed1483ff27..96b68f63a902 100644
--- a/drivers/iio/gyro/Kconfig
+++ b/drivers/iio/gyro/Kconfig
@@ -17,6 +17,7 @@ config HID_SENSOR_GYRO_3D
17 select IIO_BUFFER 17 select IIO_BUFFER
18 select IIO_TRIGGERED_BUFFER 18 select IIO_TRIGGERED_BUFFER
19 select HID_SENSOR_IIO_COMMON 19 select HID_SENSOR_IIO_COMMON
20 select HID_SENSOR_IIO_TRIGGER
20 tristate "HID Gyroscope 3D" 21 tristate "HID Gyroscope 3D"
21 help 22 help
22 Say yes here to build support for the HID SENSOR 23 Say yes here to build support for the HID SENSOR
diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c b/drivers/iio/gyro/hid-sensor-gyro-3d.c
index 4c8b158e40e1..06e7cc35450c 100644
--- a/drivers/iio/gyro/hid-sensor-gyro-3d.c
+++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c
@@ -278,7 +278,7 @@ static int gyro_3d_parse_report(struct platform_device *pdev,
278} 278}
279 279
280/* Function to initialize the processing for usage id */ 280/* Function to initialize the processing for usage id */
281static int __devinit hid_gyro_3d_probe(struct platform_device *pdev) 281static int hid_gyro_3d_probe(struct platform_device *pdev)
282{ 282{
283 int ret = 0; 283 int ret = 0;
284 static const char *name = "gyro_3d"; 284 static const char *name = "gyro_3d";
@@ -375,7 +375,7 @@ error_ret:
375} 375}
376 376
377/* Function to deinitialize the processing for usage id */ 377/* Function to deinitialize the processing for usage id */
378static int __devinit hid_gyro_3d_remove(struct platform_device *pdev) 378static int hid_gyro_3d_remove(struct platform_device *pdev)
379{ 379{
380 struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; 380 struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
381 struct iio_dev *indio_dev = platform_get_drvdata(pdev); 381 struct iio_dev *indio_dev = platform_get_drvdata(pdev);
diff --git a/drivers/iio/light/Kconfig b/drivers/iio/light/Kconfig
index 1763c9bcb98a..dbf80abc834f 100644
--- a/drivers/iio/light/Kconfig
+++ b/drivers/iio/light/Kconfig
@@ -47,6 +47,7 @@ config HID_SENSOR_ALS
47 select IIO_BUFFER 47 select IIO_BUFFER
48 select IIO_TRIGGERED_BUFFER 48 select IIO_TRIGGERED_BUFFER
49 select HID_SENSOR_IIO_COMMON 49 select HID_SENSOR_IIO_COMMON
50 select HID_SENSOR_IIO_TRIGGER
50 tristate "HID ALS" 51 tristate "HID ALS"
51 help 52 help
52 Say yes here to build support for the HID SENSOR 53 Say yes here to build support for the HID SENSOR
diff --git a/drivers/iio/light/adjd_s311.c b/drivers/iio/light/adjd_s311.c
index 36d210a06b28..d5b9d39d95b2 100644
--- a/drivers/iio/light/adjd_s311.c
+++ b/drivers/iio/light/adjd_s311.c
@@ -286,8 +286,8 @@ static const struct iio_info adjd_s311_info = {
286 .driver_module = THIS_MODULE, 286 .driver_module = THIS_MODULE,
287}; 287};
288 288
289static int __devinit adjd_s311_probe(struct i2c_client *client, 289static int adjd_s311_probe(struct i2c_client *client,
290 const struct i2c_device_id *id) 290 const struct i2c_device_id *id)
291{ 291{
292 struct adjd_s311_data *data; 292 struct adjd_s311_data *data;
293 struct iio_dev *indio_dev; 293 struct iio_dev *indio_dev;
@@ -330,7 +330,7 @@ exit:
330 return err; 330 return err;
331} 331}
332 332
333static int __devexit adjd_s311_remove(struct i2c_client *client) 333static int adjd_s311_remove(struct i2c_client *client)
334{ 334{
335 struct iio_dev *indio_dev = i2c_get_clientdata(client); 335 struct iio_dev *indio_dev = i2c_get_clientdata(client);
336 struct adjd_s311_data *data = iio_priv(indio_dev); 336 struct adjd_s311_data *data = iio_priv(indio_dev);
@@ -354,7 +354,7 @@ static struct i2c_driver adjd_s311_driver = {
354 .name = ADJD_S311_DRV_NAME, 354 .name = ADJD_S311_DRV_NAME,
355 }, 355 },
356 .probe = adjd_s311_probe, 356 .probe = adjd_s311_probe,
357 .remove = __devexit_p(adjd_s311_remove), 357 .remove = adjd_s311_remove,
358 .id_table = adjd_s311_id, 358 .id_table = adjd_s311_id,
359}; 359};
360module_i2c_driver(adjd_s311_driver); 360module_i2c_driver(adjd_s311_driver);
diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c
index 23eeeef64e84..e2d042f2a544 100644
--- a/drivers/iio/light/hid-sensor-als.c
+++ b/drivers/iio/light/hid-sensor-als.c
@@ -245,7 +245,7 @@ static int als_parse_report(struct platform_device *pdev,
245} 245}
246 246
247/* Function to initialize the processing for usage id */ 247/* Function to initialize the processing for usage id */
248static int __devinit hid_als_probe(struct platform_device *pdev) 248static int hid_als_probe(struct platform_device *pdev)
249{ 249{
250 int ret = 0; 250 int ret = 0;
251 static const char *name = "als"; 251 static const char *name = "als";
@@ -341,7 +341,7 @@ error_ret:
341} 341}
342 342
343/* Function to deinitialize the processing for usage id */ 343/* Function to deinitialize the processing for usage id */
344static int __devinit hid_als_remove(struct platform_device *pdev) 344static int hid_als_remove(struct platform_device *pdev)
345{ 345{
346 struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; 346 struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
347 struct iio_dev *indio_dev = platform_get_drvdata(pdev); 347 struct iio_dev *indio_dev = platform_get_drvdata(pdev);
diff --git a/drivers/iio/light/lm3533-als.c b/drivers/iio/light/lm3533-als.c
index e45712a921ce..7503012ce933 100644
--- a/drivers/iio/light/lm3533-als.c
+++ b/drivers/iio/light/lm3533-als.c
@@ -718,8 +718,7 @@ static struct attribute_group lm3533_als_attribute_group = {
718 .attrs = lm3533_als_attributes 718 .attrs = lm3533_als_attributes
719}; 719};
720 720
721static int __devinit lm3533_als_set_input_mode(struct lm3533_als *als, 721static int lm3533_als_set_input_mode(struct lm3533_als *als, bool pwm_mode)
722 bool pwm_mode)
723{ 722{
724 u8 mask = LM3533_ALS_INPUT_MODE_MASK; 723 u8 mask = LM3533_ALS_INPUT_MODE_MASK;
725 u8 val; 724 u8 val;
@@ -740,7 +739,7 @@ static int __devinit lm3533_als_set_input_mode(struct lm3533_als *als,
740 return 0; 739 return 0;
741} 740}
742 741
743static int __devinit lm3533_als_set_resistor(struct lm3533_als *als, u8 val) 742static int lm3533_als_set_resistor(struct lm3533_als *als, u8 val)
744{ 743{
745 int ret; 744 int ret;
746 745
@@ -756,8 +755,8 @@ static int __devinit lm3533_als_set_resistor(struct lm3533_als *als, u8 val)
756 return 0; 755 return 0;
757} 756}
758 757
759static int __devinit lm3533_als_setup(struct lm3533_als *als, 758static int lm3533_als_setup(struct lm3533_als *als,
760 struct lm3533_als_platform_data *pdata) 759 struct lm3533_als_platform_data *pdata)
761{ 760{
762 int ret; 761 int ret;
763 762
@@ -775,7 +774,7 @@ static int __devinit lm3533_als_setup(struct lm3533_als *als,
775 return 0; 774 return 0;
776} 775}
777 776
778static int __devinit lm3533_als_setup_irq(struct lm3533_als *als, void *dev) 777static int lm3533_als_setup_irq(struct lm3533_als *als, void *dev)
779{ 778{
780 u8 mask = LM3533_ALS_INT_ENABLE_MASK; 779 u8 mask = LM3533_ALS_INT_ENABLE_MASK;
781 int ret; 780 int ret;
@@ -799,7 +798,7 @@ static int __devinit lm3533_als_setup_irq(struct lm3533_als *als, void *dev)
799 return 0; 798 return 0;
800} 799}
801 800
802static int __devinit lm3533_als_enable(struct lm3533_als *als) 801static int lm3533_als_enable(struct lm3533_als *als)
803{ 802{
804 u8 mask = LM3533_ALS_ENABLE_MASK; 803 u8 mask = LM3533_ALS_ENABLE_MASK;
805 int ret; 804 int ret;
@@ -830,7 +829,7 @@ static const struct iio_info lm3533_als_info = {
830 .read_raw = &lm3533_als_read_raw, 829 .read_raw = &lm3533_als_read_raw,
831}; 830};
832 831
833static int __devinit lm3533_als_probe(struct platform_device *pdev) 832static int lm3533_als_probe(struct platform_device *pdev)
834{ 833{
835 struct lm3533 *lm3533; 834 struct lm3533 *lm3533;
836 struct lm3533_als_platform_data *pdata; 835 struct lm3533_als_platform_data *pdata;
@@ -901,7 +900,7 @@ err_free_dev:
901 return ret; 900 return ret;
902} 901}
903 902
904static int __devexit lm3533_als_remove(struct platform_device *pdev) 903static int lm3533_als_remove(struct platform_device *pdev)
905{ 904{
906 struct iio_dev *indio_dev = platform_get_drvdata(pdev); 905 struct iio_dev *indio_dev = platform_get_drvdata(pdev);
907 struct lm3533_als *als = iio_priv(indio_dev); 906 struct lm3533_als *als = iio_priv(indio_dev);
@@ -922,7 +921,7 @@ static struct platform_driver lm3533_als_driver = {
922 .owner = THIS_MODULE, 921 .owner = THIS_MODULE,
923 }, 922 },
924 .probe = lm3533_als_probe, 923 .probe = lm3533_als_probe,
925 .remove = __devexit_p(lm3533_als_remove), 924 .remove = lm3533_als_remove,
926}; 925};
927module_platform_driver(lm3533_als_driver); 926module_platform_driver(lm3533_als_driver);
928 927
diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
index e49cb9784a6f..2aa748fbdc0e 100644
--- a/drivers/iio/light/vcnl4000.c
+++ b/drivers/iio/light/vcnl4000.c
@@ -150,8 +150,8 @@ static const struct iio_info vcnl4000_info = {
150 .driver_module = THIS_MODULE, 150 .driver_module = THIS_MODULE,
151}; 151};
152 152
153static int __devinit vcnl4000_probe(struct i2c_client *client, 153static int vcnl4000_probe(struct i2c_client *client,
154 const struct i2c_device_id *id) 154 const struct i2c_device_id *id)
155{ 155{
156 struct vcnl4000_data *data; 156 struct vcnl4000_data *data;
157 struct iio_dev *indio_dev; 157 struct iio_dev *indio_dev;
@@ -190,7 +190,7 @@ error_free_dev:
190 return ret; 190 return ret;
191} 191}
192 192
193static int __devexit vcnl4000_remove(struct i2c_client *client) 193static int vcnl4000_remove(struct i2c_client *client)
194{ 194{
195 struct iio_dev *indio_dev = i2c_get_clientdata(client); 195 struct iio_dev *indio_dev = i2c_get_clientdata(client);
196 196
@@ -206,7 +206,7 @@ static struct i2c_driver vcnl4000_driver = {
206 .owner = THIS_MODULE, 206 .owner = THIS_MODULE,
207 }, 207 },
208 .probe = vcnl4000_probe, 208 .probe = vcnl4000_probe,
209 .remove = __devexit_p(vcnl4000_remove), 209 .remove = vcnl4000_remove,
210 .id_table = vcnl4000_id, 210 .id_table = vcnl4000_id,
211}; 211};
212 212
diff --git a/drivers/iio/magnetometer/Kconfig b/drivers/iio/magnetometer/Kconfig
index c1f0cdd57037..ff11d68225cf 100644
--- a/drivers/iio/magnetometer/Kconfig
+++ b/drivers/iio/magnetometer/Kconfig
@@ -8,6 +8,7 @@ config HID_SENSOR_MAGNETOMETER_3D
8 select IIO_BUFFER 8 select IIO_BUFFER
9 select IIO_TRIGGERED_BUFFER 9 select IIO_TRIGGERED_BUFFER
10 select HID_SENSOR_IIO_COMMON 10 select HID_SENSOR_IIO_COMMON
11 select HID_SENSOR_IIO_TRIGGER
11 tristate "HID Magenetometer 3D" 12 tristate "HID Magenetometer 3D"
12 help 13 help
13 Say yes here to build support for the HID SENSOR 14 Say yes here to build support for the HID SENSOR
diff --git a/drivers/iio/magnetometer/hid-sensor-magn-3d.c b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
index 8e75eb76ccd9..7ac2c7483ba8 100644
--- a/drivers/iio/magnetometer/hid-sensor-magn-3d.c
+++ b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
@@ -279,7 +279,7 @@ static int magn_3d_parse_report(struct platform_device *pdev,
279} 279}
280 280
281/* Function to initialize the processing for usage id */ 281/* Function to initialize the processing for usage id */
282static int __devinit hid_magn_3d_probe(struct platform_device *pdev) 282static int hid_magn_3d_probe(struct platform_device *pdev)
283{ 283{
284 int ret = 0; 284 int ret = 0;
285 static char *name = "magn_3d"; 285 static char *name = "magn_3d";
@@ -376,7 +376,7 @@ error_ret:
376} 376}
377 377
378/* Function to deinitialize the processing for usage id */ 378/* Function to deinitialize the processing for usage id */
379static int __devinit hid_magn_3d_remove(struct platform_device *pdev) 379static int hid_magn_3d_remove(struct platform_device *pdev)
380{ 380{
381 struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; 381 struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
382 struct iio_dev *indio_dev = platform_get_drvdata(pdev); 382 struct iio_dev *indio_dev = platform_get_drvdata(pdev);
diff --git a/drivers/infiniband/hw/amso1100/c2.c b/drivers/infiniband/hw/amso1100/c2.c
index 5ce7b9e8bff6..7275e727e0f5 100644
--- a/drivers/infiniband/hw/amso1100/c2.c
+++ b/drivers/infiniband/hw/amso1100/c2.c
@@ -920,8 +920,7 @@ static struct net_device *c2_devinit(struct c2_dev *c2dev,
920 return netdev; 920 return netdev;
921} 921}
922 922
923static int __devinit c2_probe(struct pci_dev *pcidev, 923static int c2_probe(struct pci_dev *pcidev, const struct pci_device_id *ent)
924 const struct pci_device_id *ent)
925{ 924{
926 int ret = 0, i; 925 int ret = 0, i;
927 unsigned long reg0_start, reg0_flags, reg0_len; 926 unsigned long reg0_start, reg0_flags, reg0_len;
@@ -1191,7 +1190,7 @@ static int __devinit c2_probe(struct pci_dev *pcidev,
1191 return ret; 1190 return ret;
1192} 1191}
1193 1192
1194static void __devexit c2_remove(struct pci_dev *pcidev) 1193static void c2_remove(struct pci_dev *pcidev)
1195{ 1194{
1196 struct c2_dev *c2dev = pci_get_drvdata(pcidev); 1195 struct c2_dev *c2dev = pci_get_drvdata(pcidev);
1197 struct net_device *netdev = c2dev->netdev; 1196 struct net_device *netdev = c2dev->netdev;
@@ -1236,7 +1235,7 @@ static struct pci_driver c2_pci_driver = {
1236 .name = DRV_NAME, 1235 .name = DRV_NAME,
1237 .id_table = c2_pci_table, 1236 .id_table = c2_pci_table,
1238 .probe = c2_probe, 1237 .probe = c2_probe,
1239 .remove = __devexit_p(c2_remove), 1238 .remove = c2_remove,
1240}; 1239};
1241 1240
1242static int __init c2_init_module(void) 1241static int __init c2_init_module(void)
diff --git a/drivers/infiniband/hw/amso1100/c2.h b/drivers/infiniband/hw/amso1100/c2.h
index 6ae698e68775..ba7a1208ff9e 100644
--- a/drivers/infiniband/hw/amso1100/c2.h
+++ b/drivers/infiniband/hw/amso1100/c2.h
@@ -498,16 +498,16 @@ extern int c2_post_send(struct ib_qp *ibqp, struct ib_send_wr *ib_wr,
498 struct ib_send_wr **bad_wr); 498 struct ib_send_wr **bad_wr);
499extern int c2_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *ib_wr, 499extern int c2_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *ib_wr,
500 struct ib_recv_wr **bad_wr); 500 struct ib_recv_wr **bad_wr);
501extern void __devinit c2_init_qp_table(struct c2_dev *c2dev); 501extern void c2_init_qp_table(struct c2_dev *c2dev);
502extern void __devexit c2_cleanup_qp_table(struct c2_dev *c2dev); 502extern void c2_cleanup_qp_table(struct c2_dev *c2dev);
503extern void c2_set_qp_state(struct c2_qp *, int); 503extern void c2_set_qp_state(struct c2_qp *, int);
504extern struct c2_qp *c2_find_qpn(struct c2_dev *c2dev, int qpn); 504extern struct c2_qp *c2_find_qpn(struct c2_dev *c2dev, int qpn);
505 505
506/* PDs */ 506/* PDs */
507extern int c2_pd_alloc(struct c2_dev *c2dev, int privileged, struct c2_pd *pd); 507extern int c2_pd_alloc(struct c2_dev *c2dev, int privileged, struct c2_pd *pd);
508extern void c2_pd_free(struct c2_dev *c2dev, struct c2_pd *pd); 508extern void c2_pd_free(struct c2_dev *c2dev, struct c2_pd *pd);
509extern int __devinit c2_init_pd_table(struct c2_dev *c2dev); 509extern int c2_init_pd_table(struct c2_dev *c2dev);
510extern void __devexit c2_cleanup_pd_table(struct c2_dev *c2dev); 510extern void c2_cleanup_pd_table(struct c2_dev *c2dev);
511 511
512/* CQs */ 512/* CQs */
513extern int c2_init_cq(struct c2_dev *c2dev, int entries, 513extern int c2_init_cq(struct c2_dev *c2dev, int entries,
diff --git a/drivers/infiniband/hw/amso1100/c2_pd.c b/drivers/infiniband/hw/amso1100/c2_pd.c
index 161f2a285351..f3e81dc357bb 100644
--- a/drivers/infiniband/hw/amso1100/c2_pd.c
+++ b/drivers/infiniband/hw/amso1100/c2_pd.c
@@ -70,7 +70,7 @@ void c2_pd_free(struct c2_dev *c2dev, struct c2_pd *pd)
70 spin_unlock(&c2dev->pd_table.lock); 70 spin_unlock(&c2dev->pd_table.lock);
71} 71}
72 72
73int __devinit c2_init_pd_table(struct c2_dev *c2dev) 73int c2_init_pd_table(struct c2_dev *c2dev)
74{ 74{
75 75
76 c2dev->pd_table.last = 0; 76 c2dev->pd_table.last = 0;
@@ -84,7 +84,7 @@ int __devinit c2_init_pd_table(struct c2_dev *c2dev)
84 return 0; 84 return 0;
85} 85}
86 86
87void __devexit c2_cleanup_pd_table(struct c2_dev *c2dev) 87void c2_cleanup_pd_table(struct c2_dev *c2dev)
88{ 88{
89 kfree(c2dev->pd_table.table); 89 kfree(c2dev->pd_table.table);
90} 90}
diff --git a/drivers/infiniband/hw/amso1100/c2_qp.c b/drivers/infiniband/hw/amso1100/c2_qp.c
index 0d7b6f23caff..28cd5cb51859 100644
--- a/drivers/infiniband/hw/amso1100/c2_qp.c
+++ b/drivers/infiniband/hw/amso1100/c2_qp.c
@@ -1010,13 +1010,13 @@ out:
1010 return err; 1010 return err;
1011} 1011}
1012 1012
1013void __devinit c2_init_qp_table(struct c2_dev *c2dev) 1013void c2_init_qp_table(struct c2_dev *c2dev)
1014{ 1014{
1015 spin_lock_init(&c2dev->qp_table.lock); 1015 spin_lock_init(&c2dev->qp_table.lock);
1016 idr_init(&c2dev->qp_table.idr); 1016 idr_init(&c2dev->qp_table.idr);
1017} 1017}
1018 1018
1019void __devexit c2_cleanup_qp_table(struct c2_dev *c2dev) 1019void c2_cleanup_qp_table(struct c2_dev *c2dev)
1020{ 1020{
1021 idr_destroy(&c2dev->qp_table.idr); 1021 idr_destroy(&c2dev->qp_table.idr);
1022} 1022}
diff --git a/drivers/infiniband/hw/amso1100/c2_rnic.c b/drivers/infiniband/hw/amso1100/c2_rnic.c
index e4a73158fc7f..b7c986990053 100644
--- a/drivers/infiniband/hw/amso1100/c2_rnic.c
+++ b/drivers/infiniband/hw/amso1100/c2_rnic.c
@@ -442,7 +442,7 @@ static int c2_rnic_close(struct c2_dev *c2dev)
442 * involves initializing the various limits and resource pools that 442 * involves initializing the various limits and resource pools that
443 * comprise the RNIC instance. 443 * comprise the RNIC instance.
444 */ 444 */
445int __devinit c2_rnic_init(struct c2_dev *c2dev) 445int c2_rnic_init(struct c2_dev *c2dev)
446{ 446{
447 int err; 447 int err;
448 u32 qsize, msgsize; 448 u32 qsize, msgsize;
@@ -611,7 +611,7 @@ int __devinit c2_rnic_init(struct c2_dev *c2dev)
611/* 611/*
612 * Called by c2_remove to cleanup the RNIC resources. 612 * Called by c2_remove to cleanup the RNIC resources.
613 */ 613 */
614void __devexit c2_rnic_term(struct c2_dev *c2dev) 614void c2_rnic_term(struct c2_dev *c2dev)
615{ 615{
616 616
617 /* Close the open adapter instance */ 617 /* Close the open adapter instance */
diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c
index 832e7a7d0aee..f8a62918a88d 100644
--- a/drivers/infiniband/hw/ehca/ehca_main.c
+++ b/drivers/infiniband/hw/ehca/ehca_main.c
@@ -713,8 +713,8 @@ static struct attribute_group ehca_dev_attr_grp = {
713 .attrs = ehca_dev_attrs 713 .attrs = ehca_dev_attrs
714}; 714};
715 715
716static int __devinit ehca_probe(struct platform_device *dev, 716static int ehca_probe(struct platform_device *dev,
717 const struct of_device_id *id) 717 const struct of_device_id *id)
718{ 718{
719 struct ehca_shca *shca; 719 struct ehca_shca *shca;
720 const u64 *handle; 720 const u64 *handle;
@@ -879,7 +879,7 @@ probe1:
879 return -EINVAL; 879 return -EINVAL;
880} 880}
881 881
882static int __devexit ehca_remove(struct platform_device *dev) 882static int ehca_remove(struct platform_device *dev)
883{ 883{
884 struct ehca_shca *shca = dev_get_drvdata(&dev->dev); 884 struct ehca_shca *shca = dev_get_drvdata(&dev->dev);
885 unsigned long flags; 885 unsigned long flags;
diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c
index bfca37b2432f..7b371f545ece 100644
--- a/drivers/infiniband/hw/ipath/ipath_driver.c
+++ b/drivers/infiniband/hw/ipath/ipath_driver.c
@@ -127,9 +127,8 @@ const char *ipath_ibcstatus_str[] = {
127 "LTState1C", "LTState1D", "LTState1E", "LTState1F" 127 "LTState1C", "LTState1D", "LTState1E", "LTState1F"
128}; 128};
129 129
130static void __devexit ipath_remove_one(struct pci_dev *); 130static void ipath_remove_one(struct pci_dev *);
131static int __devinit ipath_init_one(struct pci_dev *, 131static int ipath_init_one(struct pci_dev *, const struct pci_device_id *);
132 const struct pci_device_id *);
133 132
134/* Only needed for registration, nothing else needs this info */ 133/* Only needed for registration, nothing else needs this info */
135#define PCI_VENDOR_ID_PATHSCALE 0x1fc1 134#define PCI_VENDOR_ID_PATHSCALE 0x1fc1
@@ -148,7 +147,7 @@ MODULE_DEVICE_TABLE(pci, ipath_pci_tbl);
148static struct pci_driver ipath_driver = { 147static struct pci_driver ipath_driver = {
149 .name = IPATH_DRV_NAME, 148 .name = IPATH_DRV_NAME,
150 .probe = ipath_init_one, 149 .probe = ipath_init_one,
151 .remove = __devexit_p(ipath_remove_one), 150 .remove = ipath_remove_one,
152 .id_table = ipath_pci_tbl, 151 .id_table = ipath_pci_tbl,
153 .driver = { 152 .driver = {
154 .groups = ipath_driver_attr_groups, 153 .groups = ipath_driver_attr_groups,
@@ -392,8 +391,7 @@ done:
392 391
393static void cleanup_device(struct ipath_devdata *dd); 392static void cleanup_device(struct ipath_devdata *dd);
394 393
395static int __devinit ipath_init_one(struct pci_dev *pdev, 394static int ipath_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
396 const struct pci_device_id *ent)
397{ 395{
398 int ret, len, j; 396 int ret, len, j;
399 struct ipath_devdata *dd; 397 struct ipath_devdata *dd;
@@ -737,7 +735,7 @@ static void cleanup_device(struct ipath_devdata *dd)
737 kfree(tmp); 735 kfree(tmp);
738} 736}
739 737
740static void __devexit ipath_remove_one(struct pci_dev *pdev) 738static void ipath_remove_one(struct pci_dev *pdev)
741{ 739{
742 struct ipath_devdata *dd = pci_get_drvdata(pdev); 740 struct ipath_devdata *dd = pci_get_drvdata(pdev);
743 741
diff --git a/drivers/infiniband/hw/mthca/mthca_main.c b/drivers/infiniband/hw/mthca/mthca_main.c
index aa12a533ae9e..87897b95666d 100644
--- a/drivers/infiniband/hw/mthca/mthca_main.c
+++ b/drivers/infiniband/hw/mthca/mthca_main.c
@@ -130,7 +130,7 @@ static int log_mtts_per_seg = ilog2(MTHCA_MTT_SEG_SIZE / 8);
130module_param_named(log_mtts_per_seg, log_mtts_per_seg, int, 0444); 130module_param_named(log_mtts_per_seg, log_mtts_per_seg, int, 0444);
131MODULE_PARM_DESC(log_mtts_per_seg, "Log2 number of MTT entries per segment (1-5)"); 131MODULE_PARM_DESC(log_mtts_per_seg, "Log2 number of MTT entries per segment (1-5)");
132 132
133static char mthca_version[] __devinitdata = 133static char mthca_version[] =
134 DRV_NAME ": Mellanox InfiniBand HCA driver v" 134 DRV_NAME ": Mellanox InfiniBand HCA driver v"
135 DRV_VERSION " (" DRV_RELDATE ")\n"; 135 DRV_VERSION " (" DRV_RELDATE ")\n";
136 136
@@ -1139,8 +1139,7 @@ int __mthca_restart_one(struct pci_dev *pdev)
1139 return __mthca_init_one(pdev, hca_type); 1139 return __mthca_init_one(pdev, hca_type);
1140} 1140}
1141 1141
1142static int __devinit mthca_init_one(struct pci_dev *pdev, 1142static int mthca_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
1143 const struct pci_device_id *id)
1144{ 1143{
1145 int ret; 1144 int ret;
1146 1145
@@ -1162,7 +1161,7 @@ static int __devinit mthca_init_one(struct pci_dev *pdev,
1162 return ret; 1161 return ret;
1163} 1162}
1164 1163
1165static void __devexit mthca_remove_one(struct pci_dev *pdev) 1164static void mthca_remove_one(struct pci_dev *pdev)
1166{ 1165{
1167 mutex_lock(&mthca_device_mutex); 1166 mutex_lock(&mthca_device_mutex);
1168 __mthca_remove_one(pdev); 1167 __mthca_remove_one(pdev);
@@ -1199,7 +1198,7 @@ static struct pci_driver mthca_driver = {
1199 .name = DRV_NAME, 1198 .name = DRV_NAME,
1200 .id_table = mthca_pci_table, 1199 .id_table = mthca_pci_table,
1201 .probe = mthca_init_one, 1200 .probe = mthca_init_one,
1202 .remove = __devexit_p(mthca_remove_one) 1201 .remove = mthca_remove_one,
1203}; 1202};
1204 1203
1205static void __init __mthca_check_profile_val(const char *name, int *pval, 1204static void __init __mthca_check_profile_val(const char *name, int *pval,
diff --git a/drivers/infiniband/hw/nes/nes.c b/drivers/infiniband/hw/nes/nes.c
index 748db2d3e465..5b152a366dff 100644
--- a/drivers/infiniband/hw/nes/nes.c
+++ b/drivers/infiniband/hw/nes/nes.c
@@ -444,7 +444,7 @@ static irqreturn_t nes_interrupt(int irq, void *dev_id)
444/** 444/**
445 * nes_probe - Device initialization 445 * nes_probe - Device initialization
446 */ 446 */
447static int __devinit nes_probe(struct pci_dev *pcidev, const struct pci_device_id *ent) 447static int nes_probe(struct pci_dev *pcidev, const struct pci_device_id *ent)
448{ 448{
449 struct net_device *netdev = NULL; 449 struct net_device *netdev = NULL;
450 struct nes_device *nesdev = NULL; 450 struct nes_device *nesdev = NULL;
@@ -749,7 +749,7 @@ static int __devinit nes_probe(struct pci_dev *pcidev, const struct pci_device_i
749/** 749/**
750 * nes_remove - unload from kernel 750 * nes_remove - unload from kernel
751 */ 751 */
752static void __devexit nes_remove(struct pci_dev *pcidev) 752static void nes_remove(struct pci_dev *pcidev)
753{ 753{
754 struct nes_device *nesdev = pci_get_drvdata(pcidev); 754 struct nes_device *nesdev = pci_get_drvdata(pcidev);
755 struct net_device *netdev; 755 struct net_device *netdev;
@@ -810,7 +810,7 @@ static struct pci_driver nes_pci_driver = {
810 .name = DRV_NAME, 810 .name = DRV_NAME,
811 .id_table = nes_pci_table, 811 .id_table = nes_pci_table,
812 .probe = nes_probe, 812 .probe = nes_probe,
813 .remove = __devexit_p(nes_remove), 813 .remove = nes_remove,
814}; 814};
815 815
816static ssize_t nes_show_adapter(struct device_driver *ddp, char *buf) 816static ssize_t nes_show_adapter(struct device_driver *ddp, char *buf)
diff --git a/drivers/infiniband/hw/qib/qib_init.c b/drivers/infiniband/hw/qib/qib_init.c
index 4443adfcd9ee..ddf066d9abb6 100644
--- a/drivers/infiniband/hw/qib/qib_init.c
+++ b/drivers/infiniband/hw/qib/qib_init.c
@@ -1134,9 +1134,8 @@ void qib_disable_after_error(struct qib_devdata *dd)
1134 *dd->devstatusp |= QIB_STATUS_HWERROR; 1134 *dd->devstatusp |= QIB_STATUS_HWERROR;
1135} 1135}
1136 1136
1137static void __devexit qib_remove_one(struct pci_dev *); 1137static void qib_remove_one(struct pci_dev *);
1138static int __devinit qib_init_one(struct pci_dev *, 1138static int qib_init_one(struct pci_dev *, const struct pci_device_id *);
1139 const struct pci_device_id *);
1140 1139
1141#define DRIVER_LOAD_MSG "QLogic " QIB_DRV_NAME " loaded: " 1140#define DRIVER_LOAD_MSG "QLogic " QIB_DRV_NAME " loaded: "
1142#define PFX QIB_DRV_NAME ": " 1141#define PFX QIB_DRV_NAME ": "
@@ -1153,7 +1152,7 @@ MODULE_DEVICE_TABLE(pci, qib_pci_tbl);
1153struct pci_driver qib_driver = { 1152struct pci_driver qib_driver = {
1154 .name = QIB_DRV_NAME, 1153 .name = QIB_DRV_NAME,
1155 .probe = qib_init_one, 1154 .probe = qib_init_one,
1156 .remove = __devexit_p(qib_remove_one), 1155 .remove = qib_remove_one,
1157 .id_table = qib_pci_tbl, 1156 .id_table = qib_pci_tbl,
1158 .err_handler = &qib_pci_err_handler, 1157 .err_handler = &qib_pci_err_handler,
1159}; 1158};
@@ -1342,8 +1341,7 @@ static void qib_postinit_cleanup(struct qib_devdata *dd)
1342 qib_free_devdata(dd); 1341 qib_free_devdata(dd);
1343} 1342}
1344 1343
1345static int __devinit qib_init_one(struct pci_dev *pdev, 1344static int qib_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1346 const struct pci_device_id *ent)
1347{ 1345{
1348 int ret, j, pidx, initfail; 1346 int ret, j, pidx, initfail;
1349 struct qib_devdata *dd = NULL; 1347 struct qib_devdata *dd = NULL;
@@ -1448,7 +1446,7 @@ bail:
1448 return ret; 1446 return ret;
1449} 1447}
1450 1448
1451static void __devexit qib_remove_one(struct pci_dev *pdev) 1449static void qib_remove_one(struct pci_dev *pdev)
1452{ 1450{
1453 struct qib_devdata *dd = pci_get_drvdata(pdev); 1451 struct qib_devdata *dd = pci_get_drvdata(pdev);
1454 int ret; 1452 int ret;
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index d327f5a2bb0e..b29ca651a395 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -602,6 +602,7 @@ gpio_keys_get_devtree_pdata(struct device *dev)
602 602
603 i = 0; 603 i = 0;
604 for_each_child_of_node(node, pp) { 604 for_each_child_of_node(node, pp) {
605 int gpio;
605 enum of_gpio_flags flags; 606 enum of_gpio_flags flags;
606 607
607 if (!of_find_property(pp, "gpios", NULL)) { 608 if (!of_find_property(pp, "gpios", NULL)) {
@@ -610,9 +611,19 @@ gpio_keys_get_devtree_pdata(struct device *dev)
610 continue; 611 continue;
611 } 612 }
612 613
614 gpio = of_get_gpio_flags(pp, 0, &flags);
615 if (gpio < 0) {
616 error = gpio;
617 if (error != -EPROBE_DEFER)
618 dev_err(dev,
619 "Failed to get gpio flags, error: %d\n",
620 error);
621 goto err_free_pdata;
622 }
623
613 button = &pdata->buttons[i++]; 624 button = &pdata->buttons[i++];
614 625
615 button->gpio = of_get_gpio_flags(pp, 0, &flags); 626 button->gpio = gpio;
616 button->active_low = flags & OF_GPIO_ACTIVE_LOW; 627 button->active_low = flags & OF_GPIO_ACTIVE_LOW;
617 628
618 if (of_property_read_u32(pp, "linux,code", &button->code)) { 629 if (of_property_read_u32(pp, "linux,code", &button->code)) {
diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c
index f686fd970553..21147164874d 100644
--- a/drivers/input/keyboard/gpio_keys_polled.c
+++ b/drivers/input/keyboard/gpio_keys_polled.c
@@ -135,6 +135,7 @@ static struct gpio_keys_platform_data *gpio_keys_polled_get_devtree_pdata(struct
135 135
136 i = 0; 136 i = 0;
137 for_each_child_of_node(node, pp) { 137 for_each_child_of_node(node, pp) {
138 int gpio;
138 enum of_gpio_flags flags; 139 enum of_gpio_flags flags;
139 140
140 if (!of_find_property(pp, "gpios", NULL)) { 141 if (!of_find_property(pp, "gpios", NULL)) {
@@ -143,9 +144,19 @@ static struct gpio_keys_platform_data *gpio_keys_polled_get_devtree_pdata(struct
143 continue; 144 continue;
144 } 145 }
145 146
147 gpio = of_get_gpio_flags(pp, 0, &flags);
148 if (gpio < 0) {
149 error = gpio;
150 if (error != -EPROBE_DEFER)
151 dev_err(dev,
152 "Failed to get gpio flags, error: %d\n",
153 error);
154 goto err_free_pdata;
155 }
156
146 button = &pdata->buttons[i++]; 157 button = &pdata->buttons[i++];
147 158
148 button->gpio = of_get_gpio_flags(pp, 0, &flags); 159 button->gpio = gpio;
149 button->active_low = flags & OF_GPIO_ACTIVE_LOW; 160 button->active_low = flags & OF_GPIO_ACTIVE_LOW;
150 161
151 if (of_property_read_u32(pp, "linux,code", &button->code)) { 162 if (of_property_read_u32(pp, "linux,code", &button->code)) {
diff --git a/drivers/input/keyboard/tca8418_keypad.c b/drivers/input/keyboard/tca8418_keypad.c
index 50e9c5e195e1..a34cc6714e5b 100644
--- a/drivers/input/keyboard/tca8418_keypad.c
+++ b/drivers/input/keyboard/tca8418_keypad.c
@@ -384,7 +384,7 @@ static const struct i2c_device_id tca8418_id[] = {
384MODULE_DEVICE_TABLE(i2c, tca8418_id); 384MODULE_DEVICE_TABLE(i2c, tca8418_id);
385 385
386#ifdef CONFIG_OF 386#ifdef CONFIG_OF
387static const struct of_device_id tca8418_dt_ids[] __devinitconst = { 387static const struct of_device_id tca8418_dt_ids[] = {
388 { .compatible = "ti,tca8418", }, 388 { .compatible = "ti,tca8418", },
389 { } 389 { }
390}; 390};
diff --git a/drivers/input/mouse/sentelic.c b/drivers/input/mouse/sentelic.c
index e582922bacf7..cc7e0d4a8f93 100644
--- a/drivers/input/mouse/sentelic.c
+++ b/drivers/input/mouse/sentelic.c
@@ -791,7 +791,7 @@ static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse)
791 fsp_set_slot(dev, 0, fgrs > 0, abs_x, abs_y); 791 fsp_set_slot(dev, 0, fgrs > 0, abs_x, abs_y);
792 fsp_set_slot(dev, 1, false, 0, 0); 792 fsp_set_slot(dev, 1, false, 0, 0);
793 } 793 }
794 if (fgrs > 0) { 794 if (fgrs == 1 || (fgrs == 2 && !(packet[0] & FSP_PB0_MFMC_FGR2))) {
795 input_report_abs(dev, ABS_X, abs_x); 795 input_report_abs(dev, ABS_X, abs_x);
796 input_report_abs(dev, ABS_Y, abs_y); 796 input_report_abs(dev, ABS_Y, abs_y);
797 } 797 }
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 81837b0710a9..faf10ba1ed9a 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -975,6 +975,38 @@ static void __init free_iommu_all(void)
975} 975}
976 976
977/* 977/*
978 * Family15h Model 10h-1fh erratum 746 (IOMMU Logging May Stall Translations)
979 * Workaround:
980 * BIOS should disable L2B micellaneous clock gating by setting
981 * L2_L2B_CK_GATE_CONTROL[CKGateL2BMiscDisable](D0F2xF4_x90[2]) = 1b
982 */
983static void __init amd_iommu_erratum_746_workaround(struct amd_iommu *iommu)
984{
985 u32 value;
986
987 if ((boot_cpu_data.x86 != 0x15) ||
988 (boot_cpu_data.x86_model < 0x10) ||
989 (boot_cpu_data.x86_model > 0x1f))
990 return;
991
992 pci_write_config_dword(iommu->dev, 0xf0, 0x90);
993 pci_read_config_dword(iommu->dev, 0xf4, &value);
994
995 if (value & BIT(2))
996 return;
997
998 /* Select NB indirect register 0x90 and enable writing */
999 pci_write_config_dword(iommu->dev, 0xf0, 0x90 | (1 << 8));
1000
1001 pci_write_config_dword(iommu->dev, 0xf4, value | 0x4);
1002 pr_info("AMD-Vi: Applying erratum 746 workaround for IOMMU at %s\n",
1003 dev_name(&iommu->dev->dev));
1004
1005 /* Clear the enable writing bit */
1006 pci_write_config_dword(iommu->dev, 0xf0, 0x90);
1007}
1008
1009/*
978 * This function clues the initialization function for one IOMMU 1010 * This function clues the initialization function for one IOMMU
979 * together and also allocates the command buffer and programs the 1011 * together and also allocates the command buffer and programs the
980 * hardware. It does NOT enable the IOMMU. This is done afterwards. 1012 * hardware. It does NOT enable the IOMMU. This is done afterwards.
@@ -1172,6 +1204,8 @@ static int iommu_init_pci(struct amd_iommu *iommu)
1172 iommu->stored_l2[i] = iommu_read_l2(iommu, i); 1204 iommu->stored_l2[i] = iommu_read_l2(iommu, i);
1173 } 1205 }
1174 1206
1207 amd_iommu_erratum_746_workaround(iommu);
1208
1175 return pci_enable_device(iommu->dev); 1209 return pci_enable_device(iommu->dev);
1176} 1210}
1177 1211
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index c2c07a4a7f21..eca28014ef3e 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -4234,7 +4234,22 @@ static struct iommu_ops intel_iommu_ops = {
4234 .pgsize_bitmap = INTEL_IOMMU_PGSIZES, 4234 .pgsize_bitmap = INTEL_IOMMU_PGSIZES,
4235}; 4235};
4236 4236
4237static void __devinit quirk_iommu_rwbf(struct pci_dev *dev) 4237static void quirk_iommu_g4x_gfx(struct pci_dev *dev)
4238{
4239 /* G4x/GM45 integrated gfx dmar support is totally busted. */
4240 printk(KERN_INFO "DMAR: Disabling IOMMU for graphics on this chipset\n");
4241 dmar_map_gfx = 0;
4242}
4243
4244DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2a40, quirk_iommu_g4x_gfx);
4245DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2e00, quirk_iommu_g4x_gfx);
4246DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2e10, quirk_iommu_g4x_gfx);
4247DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2e20, quirk_iommu_g4x_gfx);
4248DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2e30, quirk_iommu_g4x_gfx);
4249DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2e40, quirk_iommu_g4x_gfx);
4250DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2e90, quirk_iommu_g4x_gfx);
4251
4252static void quirk_iommu_rwbf(struct pci_dev *dev)
4238{ 4253{
4239 /* 4254 /*
4240 * Mobile 4 Series Chipset neglects to set RWBF capability, 4255 * Mobile 4 Series Chipset neglects to set RWBF capability,
@@ -4242,12 +4257,6 @@ static void __devinit quirk_iommu_rwbf(struct pci_dev *dev)
4242 */ 4257 */
4243 printk(KERN_INFO "DMAR: Forcing write-buffer flush capability\n"); 4258 printk(KERN_INFO "DMAR: Forcing write-buffer flush capability\n");
4244 rwbf_quirk = 1; 4259 rwbf_quirk = 1;
4245
4246 /* https://bugzilla.redhat.com/show_bug.cgi?id=538163 */
4247 if (dev->revision == 0x07) {
4248 printk(KERN_INFO "DMAR: Disabling IOMMU for graphics on this chipset\n");
4249 dmar_map_gfx = 0;
4250 }
4251} 4260}
4252 4261
4253DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2a40, quirk_iommu_rwbf); 4262DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2a40, quirk_iommu_rwbf);
@@ -4262,7 +4271,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2a40, quirk_iommu_rwbf);
4262#define GGC_MEMORY_SIZE_3M_VT (0xa << 8) 4271#define GGC_MEMORY_SIZE_3M_VT (0xa << 8)
4263#define GGC_MEMORY_SIZE_4M_VT (0xb << 8) 4272#define GGC_MEMORY_SIZE_4M_VT (0xb << 8)
4264 4273
4265static void __devinit quirk_calpella_no_shadow_gtt(struct pci_dev *dev) 4274static void quirk_calpella_no_shadow_gtt(struct pci_dev *dev)
4266{ 4275{
4267 unsigned short ggc; 4276 unsigned short ggc;
4268 4277
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index 18108c1405e2..d33c980e9c20 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -934,7 +934,7 @@ static void omap_iommu_detach(struct omap_iommu *obj)
934/* 934/*
935 * OMAP Device MMU(IOMMU) detection 935 * OMAP Device MMU(IOMMU) detection
936 */ 936 */
937static int __devinit omap_iommu_probe(struct platform_device *pdev) 937static int omap_iommu_probe(struct platform_device *pdev)
938{ 938{
939 int err = -ENODEV; 939 int err = -ENODEV;
940 int irq; 940 int irq;
@@ -1003,7 +1003,7 @@ err_mem:
1003 return err; 1003 return err;
1004} 1004}
1005 1005
1006static int __devexit omap_iommu_remove(struct platform_device *pdev) 1006static int omap_iommu_remove(struct platform_device *pdev)
1007{ 1007{
1008 int irq; 1008 int irq;
1009 struct resource *res; 1009 struct resource *res;
@@ -1028,7 +1028,7 @@ static int __devexit omap_iommu_remove(struct platform_device *pdev)
1028 1028
1029static struct platform_driver omap_iommu_driver = { 1029static struct platform_driver omap_iommu_driver = {
1030 .probe = omap_iommu_probe, 1030 .probe = omap_iommu_probe,
1031 .remove = __devexit_p(omap_iommu_remove), 1031 .remove = omap_iommu_remove,
1032 .driver = { 1032 .driver = {
1033 .name = "omap-iommu", 1033 .name = "omap-iommu",
1034 }, 1034 },
diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra-gart.c
index 4c9db62814ff..8219f1d596ee 100644
--- a/drivers/iommu/tegra-gart.c
+++ b/drivers/iommu/tegra-gart.c
@@ -431,7 +431,7 @@ const struct dev_pm_ops tegra_gart_pm_ops = {
431}; 431};
432 432
433#ifdef CONFIG_OF 433#ifdef CONFIG_OF
434static struct of_device_id tegra_gart_of_match[] __devinitdata = { 434static struct of_device_id tegra_gart_of_match[] = {
435 { .compatible = "nvidia,tegra20-gart", }, 435 { .compatible = "nvidia,tegra20-gart", },
436 { }, 436 { },
437}; 437};
@@ -449,7 +449,7 @@ static struct platform_driver tegra_gart_driver = {
449 }, 449 },
450}; 450};
451 451
452static int __devinit tegra_gart_init(void) 452static int tegra_gart_init(void)
453{ 453{
454 return platform_driver_register(&tegra_gart_driver); 454 return platform_driver_register(&tegra_gart_driver);
455} 455}
diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
index 25c1210c0832..fc178893789a 100644
--- a/drivers/iommu/tegra-smmu.c
+++ b/drivers/iommu/tegra-smmu.c
@@ -1255,7 +1255,7 @@ const struct dev_pm_ops tegra_smmu_pm_ops = {
1255}; 1255};
1256 1256
1257#ifdef CONFIG_OF 1257#ifdef CONFIG_OF
1258static struct of_device_id tegra_smmu_of_match[] __devinitdata = { 1258static struct of_device_id tegra_smmu_of_match[] = {
1259 { .compatible = "nvidia,tegra30-smmu", }, 1259 { .compatible = "nvidia,tegra30-smmu", },
1260 { }, 1260 { },
1261}; 1261};
@@ -1273,7 +1273,7 @@ static struct platform_driver tegra_smmu_driver = {
1273 }, 1273 },
1274}; 1274};
1275 1275
1276static int __devinit tegra_smmu_init(void) 1276static int tegra_smmu_init(void)
1277{ 1277{
1278 return platform_driver_register(&tegra_smmu_driver); 1278 return platform_driver_register(&tegra_smmu_driver);
1279} 1279}
diff --git a/drivers/isdn/gigaset/capi.c b/drivers/isdn/gigaset/capi.c
index 68452b768da2..03a0a01a4054 100644
--- a/drivers/isdn/gigaset/capi.c
+++ b/drivers/isdn/gigaset/capi.c
@@ -248,6 +248,8 @@ static inline void dump_rawmsg(enum debuglevel level, const char *tag,
248 CAPIMSG_APPID(data), CAPIMSG_MSGID(data), l, 248 CAPIMSG_APPID(data), CAPIMSG_MSGID(data), l,
249 CAPIMSG_CONTROL(data)); 249 CAPIMSG_CONTROL(data));
250 l -= 12; 250 l -= 12;
251 if (l <= 0)
252 return;
251 dbgline = kmalloc(3 * l, GFP_ATOMIC); 253 dbgline = kmalloc(3 * l, GFP_ATOMIC);
252 if (!dbgline) 254 if (!dbgline)
253 return; 255 return;
diff --git a/drivers/isdn/hardware/avm/b1pci.c b/drivers/isdn/hardware/avm/b1pci.c
index b305e6b2b8ee..ac4863c2ecbc 100644
--- a/drivers/isdn/hardware/avm/b1pci.c
+++ b/drivers/isdn/hardware/avm/b1pci.c
@@ -299,8 +299,8 @@ static void b1pciv4_remove(struct pci_dev *pdev)
299 299
300#endif /* CONFIG_ISDN_DRV_AVMB1_B1PCIV4 */ 300#endif /* CONFIG_ISDN_DRV_AVMB1_B1PCIV4 */
301 301
302static int __devinit b1pci_pci_probe(struct pci_dev *pdev, 302static int b1pci_pci_probe(struct pci_dev *pdev,
303 const struct pci_device_id *ent) 303 const struct pci_device_id *ent)
304{ 304{
305 struct capicardparams param; 305 struct capicardparams param;
306 int retval; 306 int retval;
@@ -344,7 +344,7 @@ static int __devinit b1pci_pci_probe(struct pci_dev *pdev,
344 return retval; 344 return retval;
345} 345}
346 346
347static void __devexit b1pci_pci_remove(struct pci_dev *pdev) 347static void b1pci_pci_remove(struct pci_dev *pdev)
348{ 348{
349#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4 349#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
350 avmcard *card = pci_get_drvdata(pdev); 350 avmcard *card = pci_get_drvdata(pdev);
@@ -362,7 +362,7 @@ static struct pci_driver b1pci_pci_driver = {
362 .name = "b1pci", 362 .name = "b1pci",
363 .id_table = b1pci_pci_tbl, 363 .id_table = b1pci_pci_tbl,
364 .probe = b1pci_pci_probe, 364 .probe = b1pci_pci_probe,
365 .remove = __devexit_p(b1pci_pci_remove), 365 .remove = b1pci_pci_remove,
366}; 366};
367 367
368static struct capi_driver capi_driver_b1pci = { 368static struct capi_driver capi_driver_b1pci = {
diff --git a/drivers/isdn/hardware/avm/c4.c b/drivers/isdn/hardware/avm/c4.c
index 98f18812441d..1d7fc44e3eef 100644
--- a/drivers/isdn/hardware/avm/c4.c
+++ b/drivers/isdn/hardware/avm/c4.c
@@ -1249,8 +1249,7 @@ err:
1249 1249
1250/* ------------------------------------------------------------- */ 1250/* ------------------------------------------------------------- */
1251 1251
1252static int __devinit c4_probe(struct pci_dev *dev, 1252static int c4_probe(struct pci_dev *dev, const struct pci_device_id *ent)
1253 const struct pci_device_id *ent)
1254{ 1253{
1255 int nr = ent->driver_data; 1254 int nr = ent->driver_data;
1256 int retval = 0; 1255 int retval = 0;
diff --git a/drivers/isdn/hardware/avm/t1pci.c b/drivers/isdn/hardware/avm/t1pci.c
index cb9a30427bd2..2180b1685691 100644
--- a/drivers/isdn/hardware/avm/t1pci.c
+++ b/drivers/isdn/hardware/avm/t1pci.c
@@ -187,8 +187,7 @@ static char *t1pci_procinfo(struct capi_ctr *ctrl)
187 187
188/* ------------------------------------------------------------- */ 188/* ------------------------------------------------------------- */
189 189
190static int __devinit t1pci_probe(struct pci_dev *dev, 190static int t1pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
191 const struct pci_device_id *ent)
192{ 191{
193 struct capicardparams param; 192 struct capicardparams param;
194 int retval; 193 int retval;
diff --git a/drivers/isdn/hardware/eicon/divasmain.c b/drivers/isdn/hardware/eicon/divasmain.c
index ca6d276bb256..52377b4bf039 100644
--- a/drivers/isdn/hardware/eicon/divasmain.c
+++ b/drivers/isdn/hardware/eicon/divasmain.c
@@ -150,12 +150,12 @@ MODULE_DEVICE_TABLE(pci, divas_pci_tbl);
150 150
151static int divas_init_one(struct pci_dev *pdev, 151static int divas_init_one(struct pci_dev *pdev,
152 const struct pci_device_id *ent); 152 const struct pci_device_id *ent);
153static void __devexit divas_remove_one(struct pci_dev *pdev); 153static void divas_remove_one(struct pci_dev *pdev);
154 154
155static struct pci_driver diva_pci_driver = { 155static struct pci_driver diva_pci_driver = {
156 .name = "divas", 156 .name = "divas",
157 .probe = divas_init_one, 157 .probe = divas_init_one,
158 .remove = __devexit_p(divas_remove_one), 158 .remove = divas_remove_one,
159 .id_table = divas_pci_tbl, 159 .id_table = divas_pci_tbl,
160}; 160};
161 161
@@ -688,8 +688,7 @@ static int __init divas_register_chrdev(void)
688/* -------------------------------------------------------------------------- 688/* --------------------------------------------------------------------------
689 PCI driver section 689 PCI driver section
690 -------------------------------------------------------------------------- */ 690 -------------------------------------------------------------------------- */
691static int __devinit divas_init_one(struct pci_dev *pdev, 691static int divas_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
692 const struct pci_device_id *ent)
693{ 692{
694 void *pdiva = NULL; 693 void *pdiva = NULL;
695 u8 pci_latency; 694 u8 pci_latency;
@@ -749,7 +748,7 @@ static int __devinit divas_init_one(struct pci_dev *pdev,
749 return (0); 748 return (0);
750} 749}
751 750
752static void __devexit divas_remove_one(struct pci_dev *pdev) 751static void divas_remove_one(struct pci_dev *pdev)
753{ 752{
754 void *pdiva = pci_get_drvdata(pdev); 753 void *pdiva = pci_get_drvdata(pdev);
755 754
diff --git a/drivers/isdn/hardware/mISDN/avmfritz.c b/drivers/isdn/hardware/mISDN/avmfritz.c
index dceaec821b0e..292991c90c02 100644
--- a/drivers/isdn/hardware/mISDN/avmfritz.c
+++ b/drivers/isdn/hardware/mISDN/avmfritz.c
@@ -1034,7 +1034,7 @@ release_card(struct fritzcard *card)
1034 AVM_cnt--; 1034 AVM_cnt--;
1035} 1035}
1036 1036
1037static int __devinit 1037static int
1038setup_instance(struct fritzcard *card) 1038setup_instance(struct fritzcard *card)
1039{ 1039{
1040 int i, err; 1040 int i, err;
@@ -1096,7 +1096,7 @@ error:
1096 return err; 1096 return err;
1097} 1097}
1098 1098
1099static int __devinit 1099static int
1100fritzpci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 1100fritzpci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1101{ 1101{
1102 int err = -ENOMEM; 1102 int err = -ENOMEM;
@@ -1130,7 +1130,7 @@ fritzpci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1130 return err; 1130 return err;
1131} 1131}
1132 1132
1133static void __devexit 1133static void
1134fritz_remove_pci(struct pci_dev *pdev) 1134fritz_remove_pci(struct pci_dev *pdev)
1135{ 1135{
1136 struct fritzcard *card = pci_get_drvdata(pdev); 1136 struct fritzcard *card = pci_get_drvdata(pdev);
@@ -1142,7 +1142,7 @@ fritz_remove_pci(struct pci_dev *pdev)
1142 pr_info("%s: drvdata already removed\n", __func__); 1142 pr_info("%s: drvdata already removed\n", __func__);
1143} 1143}
1144 1144
1145static struct pci_device_id fcpci_ids[] __devinitdata = { 1145static struct pci_device_id fcpci_ids[] = {
1146 { PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_A1, PCI_ANY_ID, PCI_ANY_ID, 1146 { PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_A1, PCI_ANY_ID, PCI_ANY_ID,
1147 0, 0, (unsigned long) "Fritz!Card PCI"}, 1147 0, 0, (unsigned long) "Fritz!Card PCI"},
1148 { PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_A1_V2, PCI_ANY_ID, PCI_ANY_ID, 1148 { PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_A1_V2, PCI_ANY_ID, PCI_ANY_ID,
@@ -1154,7 +1154,7 @@ MODULE_DEVICE_TABLE(pci, fcpci_ids);
1154static struct pci_driver fcpci_driver = { 1154static struct pci_driver fcpci_driver = {
1155 .name = "fcpci", 1155 .name = "fcpci",
1156 .probe = fritzpci_probe, 1156 .probe = fritzpci_probe,
1157 .remove = __devexit_p(fritz_remove_pci), 1157 .remove = fritz_remove_pci,
1158 .id_table = fcpci_ids, 1158 .id_table = fcpci_ids,
1159}; 1159};
1160 1160
diff --git a/drivers/isdn/hardware/mISDN/hfcmulti.c b/drivers/isdn/hardware/mISDN/hfcmulti.c
index f02794203bb1..28543d795188 100644
--- a/drivers/isdn/hardware/mISDN/hfcmulti.c
+++ b/drivers/isdn/hardware/mISDN/hfcmulti.c
@@ -5274,7 +5274,7 @@ free_card:
5274 return ret_err; 5274 return ret_err;
5275} 5275}
5276 5276
5277static void __devexit hfc_remove_pci(struct pci_dev *pdev) 5277static void hfc_remove_pci(struct pci_dev *pdev)
5278{ 5278{
5279 struct hfc_multi *card = pci_get_drvdata(pdev); 5279 struct hfc_multi *card = pci_get_drvdata(pdev);
5280 u_long flags; 5280 u_long flags;
@@ -5351,7 +5351,7 @@ static const struct hm_map hfcm_map[] = {
5351 5351
5352#undef H 5352#undef H
5353#define H(x) ((unsigned long)&hfcm_map[x]) 5353#define H(x) ((unsigned long)&hfcm_map[x])
5354static struct pci_device_id hfmultipci_ids[] __devinitdata = { 5354static struct pci_device_id hfmultipci_ids[] = {
5355 5355
5356 /* Cards with HFC-4S Chip */ 5356 /* Cards with HFC-4S Chip */
5357 { PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_HFC4S, PCI_VENDOR_ID_CCD, 5357 { PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_HFC4S, PCI_VENDOR_ID_CCD,
@@ -5472,7 +5472,7 @@ hfcmulti_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
5472static struct pci_driver hfcmultipci_driver = { 5472static struct pci_driver hfcmultipci_driver = {
5473 .name = "hfc_multi", 5473 .name = "hfc_multi",
5474 .probe = hfcmulti_probe, 5474 .probe = hfcmulti_probe,
5475 .remove = __devexit_p(hfc_remove_pci), 5475 .remove = hfc_remove_pci,
5476 .id_table = hfmultipci_ids, 5476 .id_table = hfmultipci_ids,
5477}; 5477};
5478 5478
diff --git a/drivers/isdn/hardware/mISDN/hfcpci.c b/drivers/isdn/hardware/mISDN/hfcpci.c
index 6e99d73563b8..a7e4939787c9 100644
--- a/drivers/isdn/hardware/mISDN/hfcpci.c
+++ b/drivers/isdn/hardware/mISDN/hfcpci.c
@@ -2215,7 +2215,7 @@ static struct pci_device_id hfc_ids[] =
2215 {}, 2215 {},
2216}; 2216};
2217 2217
2218static int __devinit 2218static int
2219hfc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 2219hfc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2220{ 2220{
2221 int err = -ENOMEM; 2221 int err = -ENOMEM;
@@ -2246,7 +2246,7 @@ hfc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2246 return err; 2246 return err;
2247} 2247}
2248 2248
2249static void __devexit 2249static void
2250hfc_remove_pci(struct pci_dev *pdev) 2250hfc_remove_pci(struct pci_dev *pdev)
2251{ 2251{
2252 struct hfc_pci *card = pci_get_drvdata(pdev); 2252 struct hfc_pci *card = pci_get_drvdata(pdev);
@@ -2263,7 +2263,7 @@ hfc_remove_pci(struct pci_dev *pdev)
2263static struct pci_driver hfc_driver = { 2263static struct pci_driver hfc_driver = {
2264 .name = "hfcpci", 2264 .name = "hfcpci",
2265 .probe = hfc_probe, 2265 .probe = hfc_probe,
2266 .remove = __devexit_p(hfc_remove_pci), 2266 .remove = hfc_remove_pci,
2267 .id_table = hfc_ids, 2267 .id_table = hfc_ids,
2268}; 2268};
2269 2269
diff --git a/drivers/isdn/hardware/mISDN/mISDNinfineon.c b/drivers/isdn/hardware/mISDN/mISDNinfineon.c
index 631eb3fa63cf..c1493f4162fb 100644
--- a/drivers/isdn/hardware/mISDN/mISDNinfineon.c
+++ b/drivers/isdn/hardware/mISDN/mISDNinfineon.c
@@ -125,7 +125,7 @@ struct inf_hw {
125#define PCI_SUBVENDOR_SEDLBAUER_PCI 0x53 125#define PCI_SUBVENDOR_SEDLBAUER_PCI 0x53
126#define PCI_SUB_ID_SEDLBAUER 0x01 126#define PCI_SUB_ID_SEDLBAUER 0x01
127 127
128static struct pci_device_id infineon_ids[] __devinitdata = { 128static struct pci_device_id infineon_ids[] = {
129 { PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_DIVA20), INF_DIVA20 }, 129 { PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_DIVA20), INF_DIVA20 },
130 { PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_DIVA20_U), INF_DIVA20U }, 130 { PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_DIVA20_U), INF_DIVA20U },
131 { PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_DIVA201), INF_DIVA201 }, 131 { PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_DIVA201), INF_DIVA201 },
@@ -603,7 +603,7 @@ inf_ctrl(struct inf_hw *hw, u32 cmd, u_long arg)
603 return ret; 603 return ret;
604} 604}
605 605
606static int __devinit 606static int
607init_irq(struct inf_hw *hw) 607init_irq(struct inf_hw *hw)
608{ 608{
609 int ret, cnt = 3; 609 int ret, cnt = 3;
@@ -662,7 +662,7 @@ release_io(struct inf_hw *hw)
662 } 662 }
663} 663}
664 664
665static int __devinit 665static int
666setup_io(struct inf_hw *hw) 666setup_io(struct inf_hw *hw)
667{ 667{
668 int err = 0; 668 int err = 0;
@@ -896,7 +896,7 @@ release_card(struct inf_hw *card) {
896 inf_cnt--; 896 inf_cnt--;
897} 897}
898 898
899static int __devinit 899static int
900setup_instance(struct inf_hw *card) 900setup_instance(struct inf_hw *card)
901{ 901{
902 int err; 902 int err;
@@ -1060,7 +1060,7 @@ static const struct inf_cinfo inf_card_info[] = {
1060 } 1060 }
1061}; 1061};
1062 1062
1063static const struct inf_cinfo * __devinit 1063static const struct inf_cinfo *
1064get_card_info(enum inf_types typ) 1064get_card_info(enum inf_types typ)
1065{ 1065{
1066 const struct inf_cinfo *ci = inf_card_info; 1066 const struct inf_cinfo *ci = inf_card_info;
@@ -1073,7 +1073,7 @@ get_card_info(enum inf_types typ)
1073 return NULL; 1073 return NULL;
1074} 1074}
1075 1075
1076static int __devinit 1076static int
1077inf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 1077inf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1078{ 1078{
1079 int err = -ENOMEM; 1079 int err = -ENOMEM;
@@ -1135,7 +1135,7 @@ inf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1135 return err; 1135 return err;
1136} 1136}
1137 1137
1138static void __devexit 1138static void
1139inf_remove(struct pci_dev *pdev) 1139inf_remove(struct pci_dev *pdev)
1140{ 1140{
1141 struct inf_hw *card = pci_get_drvdata(pdev); 1141 struct inf_hw *card = pci_get_drvdata(pdev);
@@ -1149,7 +1149,7 @@ inf_remove(struct pci_dev *pdev)
1149static struct pci_driver infineon_driver = { 1149static struct pci_driver infineon_driver = {
1150 .name = "ISDN Infineon pci", 1150 .name = "ISDN Infineon pci",
1151 .probe = inf_probe, 1151 .probe = inf_probe,
1152 .remove = __devexit_p(inf_remove), 1152 .remove = inf_remove,
1153 .id_table = infineon_ids, 1153 .id_table = infineon_ids,
1154}; 1154};
1155 1155
diff --git a/drivers/isdn/hardware/mISDN/netjet.c b/drivers/isdn/hardware/mISDN/netjet.c
index 9bcade59eb73..8e2944784e00 100644
--- a/drivers/isdn/hardware/mISDN/netjet.c
+++ b/drivers/isdn/hardware/mISDN/netjet.c
@@ -1008,7 +1008,7 @@ nj_setup(struct tiger_hw *card)
1008} 1008}
1009 1009
1010 1010
1011static int __devinit 1011static int
1012setup_instance(struct tiger_hw *card) 1012setup_instance(struct tiger_hw *card)
1013{ 1013{
1014 int i, err; 1014 int i, err;
@@ -1059,7 +1059,7 @@ error:
1059 return err; 1059 return err;
1060} 1060}
1061 1061
1062static int __devinit 1062static int
1063nj_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 1063nj_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1064{ 1064{
1065 int err = -ENOMEM; 1065 int err = -ENOMEM;
@@ -1124,7 +1124,7 @@ nj_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1124} 1124}
1125 1125
1126 1126
1127static void __devexit nj_remove(struct pci_dev *pdev) 1127static void nj_remove(struct pci_dev *pdev)
1128{ 1128{
1129 struct tiger_hw *card = pci_get_drvdata(pdev); 1129 struct tiger_hw *card = pci_get_drvdata(pdev);
1130 1130
@@ -1137,7 +1137,7 @@ static void __devexit nj_remove(struct pci_dev *pdev)
1137/* We cannot select cards with PCI_SUB... IDs, since here are cards with 1137/* We cannot select cards with PCI_SUB... IDs, since here are cards with
1138 * SUB IDs set to PCI_ANY_ID, so we need to match all and reject 1138 * SUB IDs set to PCI_ANY_ID, so we need to match all and reject
1139 * known other cards which not work with this driver - see probe function */ 1139 * known other cards which not work with this driver - see probe function */
1140static struct pci_device_id nj_pci_ids[] __devinitdata = { 1140static struct pci_device_id nj_pci_ids[] = {
1141 { PCI_VENDOR_ID_TIGERJET, PCI_DEVICE_ID_TIGERJET_300, 1141 { PCI_VENDOR_ID_TIGERJET, PCI_DEVICE_ID_TIGERJET_300,
1142 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 1142 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
1143 { } 1143 { }
@@ -1147,7 +1147,7 @@ MODULE_DEVICE_TABLE(pci, nj_pci_ids);
1147static struct pci_driver nj_driver = { 1147static struct pci_driver nj_driver = {
1148 .name = "netjet", 1148 .name = "netjet",
1149 .probe = nj_probe, 1149 .probe = nj_probe,
1150 .remove = __devexit_p(nj_remove), 1150 .remove = nj_remove,
1151 .id_table = nj_pci_ids, 1151 .id_table = nj_pci_ids,
1152}; 1152};
1153 1153
diff --git a/drivers/isdn/hardware/mISDN/speedfax.c b/drivers/isdn/hardware/mISDN/speedfax.c
index 93f344d74e54..9815bb4eec9c 100644
--- a/drivers/isdn/hardware/mISDN/speedfax.c
+++ b/drivers/isdn/hardware/mISDN/speedfax.c
@@ -282,7 +282,7 @@ sfax_dctrl(struct mISDNchannel *ch, u32 cmd, void *arg)
282 return err; 282 return err;
283} 283}
284 284
285static int __devinit 285static int
286init_card(struct sfax_hw *sf) 286init_card(struct sfax_hw *sf)
287{ 287{
288 int ret, cnt = 3; 288 int ret, cnt = 3;
@@ -321,7 +321,7 @@ init_card(struct sfax_hw *sf)
321} 321}
322 322
323 323
324static int __devinit 324static int
325setup_speedfax(struct sfax_hw *sf) 325setup_speedfax(struct sfax_hw *sf)
326{ 326{
327 u_long flags; 327 u_long flags;
@@ -371,7 +371,7 @@ release_card(struct sfax_hw *card) {
371 sfax_cnt--; 371 sfax_cnt--;
372} 372}
373 373
374static int __devinit 374static int
375setup_instance(struct sfax_hw *card) 375setup_instance(struct sfax_hw *card)
376{ 376{
377 const struct firmware *firmware; 377 const struct firmware *firmware;
@@ -451,7 +451,7 @@ error_fw:
451 return err; 451 return err;
452} 452}
453 453
454static int __devinit 454static int
455sfaxpci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 455sfaxpci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
456{ 456{
457 int err = -ENOMEM; 457 int err = -ENOMEM;
@@ -480,7 +480,7 @@ sfaxpci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
480 return err; 480 return err;
481} 481}
482 482
483static void __devexit 483static void
484sfax_remove_pci(struct pci_dev *pdev) 484sfax_remove_pci(struct pci_dev *pdev)
485{ 485{
486 struct sfax_hw *card = pci_get_drvdata(pdev); 486 struct sfax_hw *card = pci_get_drvdata(pdev);
@@ -491,7 +491,7 @@ sfax_remove_pci(struct pci_dev *pdev)
491 pr_debug("%s: drvdata already removed\n", __func__); 491 pr_debug("%s: drvdata already removed\n", __func__);
492} 492}
493 493
494static struct pci_device_id sfaxpci_ids[] __devinitdata = { 494static struct pci_device_id sfaxpci_ids[] = {
495 { PCI_VENDOR_ID_TIGERJET, PCI_DEVICE_ID_TIGERJET_100, 495 { PCI_VENDOR_ID_TIGERJET, PCI_DEVICE_ID_TIGERJET_100,
496 PCI_SUBVENDOR_SPEEDFAX_PYRAMID, PCI_SUB_ID_SEDLBAUER, 496 PCI_SUBVENDOR_SPEEDFAX_PYRAMID, PCI_SUB_ID_SEDLBAUER,
497 0, 0, (unsigned long) "Pyramid Speedfax + PCI" 497 0, 0, (unsigned long) "Pyramid Speedfax + PCI"
@@ -507,7 +507,7 @@ MODULE_DEVICE_TABLE(pci, sfaxpci_ids);
507static struct pci_driver sfaxpci_driver = { 507static struct pci_driver sfaxpci_driver = {
508 .name = "speedfax+ pci", 508 .name = "speedfax+ pci",
509 .probe = sfaxpci_probe, 509 .probe = sfaxpci_probe,
510 .remove = __devexit_p(sfax_remove_pci), 510 .remove = sfax_remove_pci,
511 .id_table = sfaxpci_ids, 511 .id_table = sfaxpci_ids,
512}; 512};
513 513
diff --git a/drivers/isdn/hardware/mISDN/w6692.c b/drivers/isdn/hardware/mISDN/w6692.c
index 335fe6455002..de69f6828c76 100644
--- a/drivers/isdn/hardware/mISDN/w6692.c
+++ b/drivers/isdn/hardware/mISDN/w6692.c
@@ -1355,7 +1355,7 @@ error_setup:
1355 return err; 1355 return err;
1356} 1356}
1357 1357
1358static int __devinit 1358static int
1359w6692_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 1359w6692_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1360{ 1360{
1361 int err = -ENOMEM; 1361 int err = -ENOMEM;
@@ -1387,7 +1387,7 @@ w6692_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1387 return err; 1387 return err;
1388} 1388}
1389 1389
1390static void __devexit 1390static void
1391w6692_remove_pci(struct pci_dev *pdev) 1391w6692_remove_pci(struct pci_dev *pdev)
1392{ 1392{
1393 struct w6692_hw *card = pci_get_drvdata(pdev); 1393 struct w6692_hw *card = pci_get_drvdata(pdev);
@@ -1414,7 +1414,7 @@ MODULE_DEVICE_TABLE(pci, w6692_ids);
1414static struct pci_driver w6692_driver = { 1414static struct pci_driver w6692_driver = {
1415 .name = "w6692", 1415 .name = "w6692",
1416 .probe = w6692_probe, 1416 .probe = w6692_probe,
1417 .remove = __devexit_p(w6692_remove_pci), 1417 .remove = w6692_remove_pci,
1418 .id_table = w6692_ids, 1418 .id_table = w6692_ids,
1419}; 1419};
1420 1420
diff --git a/drivers/isdn/hisax/amd7930_fn.c b/drivers/isdn/hisax/amd7930_fn.c
index 525471e776a7..1063babe1d3a 100644
--- a/drivers/isdn/hisax/amd7930_fn.c
+++ b/drivers/isdn/hisax/amd7930_fn.c
@@ -786,8 +786,7 @@ void Amd7930_init(struct IsdnCardState *cs)
786 } 786 }
787} 787}
788 788
789void __devinit 789void setup_Amd7930(struct IsdnCardState *cs)
790setup_Amd7930(struct IsdnCardState *cs)
791{ 790{
792 INIT_WORK(&cs->tqueue, Amd7930_bh); 791 INIT_WORK(&cs->tqueue, Amd7930_bh);
793 cs->dbusytimer.function = (void *) dbusy_timer_handler; 792 cs->dbusytimer.function = (void *) dbusy_timer_handler;
diff --git a/drivers/isdn/hisax/asuscom.c b/drivers/isdn/hisax/asuscom.c
index 2b74a40ad2a0..62f9c43e2377 100644
--- a/drivers/isdn/hisax/asuscom.c
+++ b/drivers/isdn/hisax/asuscom.c
@@ -295,7 +295,7 @@ Asus_card_msg(struct IsdnCardState *cs, int mt, void *arg)
295} 295}
296 296
297#ifdef __ISAPNP__ 297#ifdef __ISAPNP__
298static struct isapnp_device_id asus_ids[] __devinitdata = { 298static struct isapnp_device_id asus_ids[] = {
299 { ISAPNP_VENDOR('A', 'S', 'U'), ISAPNP_FUNCTION(0x1688), 299 { ISAPNP_VENDOR('A', 'S', 'U'), ISAPNP_FUNCTION(0x1688),
300 ISAPNP_VENDOR('A', 'S', 'U'), ISAPNP_FUNCTION(0x1688), 300 ISAPNP_VENDOR('A', 'S', 'U'), ISAPNP_FUNCTION(0x1688),
301 (unsigned long) "Asus1688 PnP" }, 301 (unsigned long) "Asus1688 PnP" },
@@ -311,12 +311,11 @@ static struct isapnp_device_id asus_ids[] __devinitdata = {
311 { 0, } 311 { 0, }
312}; 312};
313 313
314static struct isapnp_device_id *ipid __devinitdata = &asus_ids[0]; 314static struct isapnp_device_id *ipid = &asus_ids[0];
315static struct pnp_card *pnp_c __devinitdata = NULL; 315static struct pnp_card *pnp_c = NULL;
316#endif 316#endif
317 317
318int __devinit 318int setup_asuscom(struct IsdnCard *card)
319setup_asuscom(struct IsdnCard *card)
320{ 319{
321 int bytecnt; 320 int bytecnt;
322 struct IsdnCardState *cs = card->cs; 321 struct IsdnCardState *cs = card->cs;
diff --git a/drivers/isdn/hisax/avm_a1.c b/drivers/isdn/hisax/avm_a1.c
index 402d489cbbf1..7dd74087ad72 100644
--- a/drivers/isdn/hisax/avm_a1.c
+++ b/drivers/isdn/hisax/avm_a1.c
@@ -177,8 +177,7 @@ AVM_card_msg(struct IsdnCardState *cs, int mt, void *arg)
177 return (0); 177 return (0);
178} 178}
179 179
180int __devinit 180int setup_avm_a1(struct IsdnCard *card)
181setup_avm_a1(struct IsdnCard *card)
182{ 181{
183 u_char val; 182 u_char val;
184 struct IsdnCardState *cs = card->cs; 183 struct IsdnCardState *cs = card->cs;
diff --git a/drivers/isdn/hisax/avm_a1p.c b/drivers/isdn/hisax/avm_a1p.c
index 39347198d643..bc52d54ff5e1 100644
--- a/drivers/isdn/hisax/avm_a1p.c
+++ b/drivers/isdn/hisax/avm_a1p.c
@@ -213,7 +213,7 @@ AVM_card_msg(struct IsdnCardState *cs, int mt, void *arg)
213 return 0; 213 return 0;
214} 214}
215 215
216int __devinit setup_avm_a1_pcmcia(struct IsdnCard *card) 216int setup_avm_a1_pcmcia(struct IsdnCard *card)
217{ 217{
218 u_char model, vers; 218 u_char model, vers;
219 struct IsdnCardState *cs = card->cs; 219 struct IsdnCardState *cs = card->cs;
diff --git a/drivers/isdn/hisax/avm_pci.c b/drivers/isdn/hisax/avm_pci.c
index 979492d69dae..ee9b9a03cffa 100644
--- a/drivers/isdn/hisax/avm_pci.c
+++ b/drivers/isdn/hisax/avm_pci.c
@@ -718,7 +718,7 @@ AVM_card_msg(struct IsdnCardState *cs, int mt, void *arg)
718 return (0); 718 return (0);
719} 719}
720 720
721static int __devinit avm_setup_rest(struct IsdnCardState *cs) 721static int avm_setup_rest(struct IsdnCardState *cs)
722{ 722{
723 u_int val, ver; 723 u_int val, ver;
724 724
@@ -770,16 +770,16 @@ static int __devinit avm_setup_rest(struct IsdnCardState *cs)
770 770
771#ifndef __ISAPNP__ 771#ifndef __ISAPNP__
772 772
773static int __devinit avm_pnp_setup(struct IsdnCardState *cs) 773static int avm_pnp_setup(struct IsdnCardState *cs)
774{ 774{
775 return (1); /* no-op: success */ 775 return (1); /* no-op: success */
776} 776}
777 777
778#else 778#else
779 779
780static struct pnp_card *pnp_avm_c __devinitdata = NULL; 780static struct pnp_card *pnp_avm_c = NULL;
781 781
782static int __devinit avm_pnp_setup(struct IsdnCardState *cs) 782static int avm_pnp_setup(struct IsdnCardState *cs)
783{ 783{
784 struct pnp_dev *pnp_avm_d = NULL; 784 struct pnp_dev *pnp_avm_d = NULL;
785 785
@@ -825,16 +825,16 @@ static int __devinit avm_pnp_setup(struct IsdnCardState *cs)
825 825
826#ifndef CONFIG_PCI 826#ifndef CONFIG_PCI
827 827
828static int __devinit avm_pci_setup(struct IsdnCardState *cs) 828static int avm_pci_setup(struct IsdnCardState *cs)
829{ 829{
830 return (1); /* no-op: success */ 830 return (1); /* no-op: success */
831} 831}
832 832
833#else 833#else
834 834
835static struct pci_dev *dev_avm __devinitdata = NULL; 835static struct pci_dev *dev_avm = NULL;
836 836
837static int __devinit avm_pci_setup(struct IsdnCardState *cs) 837static int avm_pci_setup(struct IsdnCardState *cs)
838{ 838{
839 if ((dev_avm = hisax_find_pci_device(PCI_VENDOR_ID_AVM, 839 if ((dev_avm = hisax_find_pci_device(PCI_VENDOR_ID_AVM,
840 PCI_DEVICE_ID_AVM_A1, dev_avm))) { 840 PCI_DEVICE_ID_AVM_A1, dev_avm))) {
@@ -867,8 +867,7 @@ static int __devinit avm_pci_setup(struct IsdnCardState *cs)
867 867
868#endif /* CONFIG_PCI */ 868#endif /* CONFIG_PCI */
869 869
870int __devinit 870int setup_avm_pcipnp(struct IsdnCard *card)
871setup_avm_pcipnp(struct IsdnCard *card)
872{ 871{
873 struct IsdnCardState *cs = card->cs; 872 struct IsdnCardState *cs = card->cs;
874 char tmp[64]; 873 char tmp[64];
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c
index c644557ae614..4e676bcf8506 100644
--- a/drivers/isdn/hisax/avma1_cs.c
+++ b/drivers/isdn/hisax/avma1_cs.c
@@ -38,11 +38,11 @@ module_param(isdnprot, int, 0);
38 38
39/*====================================================================*/ 39/*====================================================================*/
40 40
41static int avma1cs_config(struct pcmcia_device *link) __devinit; 41static int avma1cs_config(struct pcmcia_device *link);
42static void avma1cs_release(struct pcmcia_device *link); 42static void avma1cs_release(struct pcmcia_device *link);
43static void avma1cs_detach(struct pcmcia_device *p_dev) __devexit; 43static void avma1cs_detach(struct pcmcia_device *p_dev);
44 44
45static int __devinit avma1cs_probe(struct pcmcia_device *p_dev) 45static int avma1cs_probe(struct pcmcia_device *p_dev)
46{ 46{
47 dev_dbg(&p_dev->dev, "avma1cs_attach()\n"); 47 dev_dbg(&p_dev->dev, "avma1cs_attach()\n");
48 48
@@ -54,7 +54,7 @@ static int __devinit avma1cs_probe(struct pcmcia_device *p_dev)
54 return avma1cs_config(p_dev); 54 return avma1cs_config(p_dev);
55} /* avma1cs_attach */ 55} /* avma1cs_attach */
56 56
57static void __devexit avma1cs_detach(struct pcmcia_device *link) 57static void avma1cs_detach(struct pcmcia_device *link)
58{ 58{
59 dev_dbg(&link->dev, "avma1cs_detach(0x%p)\n", link); 59 dev_dbg(&link->dev, "avma1cs_detach(0x%p)\n", link);
60 avma1cs_release(link); 60 avma1cs_release(link);
@@ -72,7 +72,7 @@ static int avma1cs_configcheck(struct pcmcia_device *p_dev, void *priv_data)
72} 72}
73 73
74 74
75static int __devinit avma1cs_config(struct pcmcia_device *link) 75static int avma1cs_config(struct pcmcia_device *link)
76{ 76{
77 int i = -1; 77 int i = -1;
78 char devname[128]; 78 char devname[128];
@@ -156,7 +156,7 @@ static struct pcmcia_driver avma1cs_driver = {
156 .owner = THIS_MODULE, 156 .owner = THIS_MODULE,
157 .name = "avma1_cs", 157 .name = "avma1_cs",
158 .probe = avma1cs_probe, 158 .probe = avma1cs_probe,
159 .remove = __devexit_p(avma1cs_detach), 159 .remove = avma1cs_detach,
160 .id_table = avma1cs_ids, 160 .id_table = avma1cs_ids,
161}; 161};
162 162
diff --git a/drivers/isdn/hisax/bkm_a4t.c b/drivers/isdn/hisax/bkm_a4t.c
index f6bf9c68892e..c360164bde1b 100644
--- a/drivers/isdn/hisax/bkm_a4t.c
+++ b/drivers/isdn/hisax/bkm_a4t.c
@@ -253,10 +253,8 @@ BKM_card_msg(struct IsdnCardState *cs, int mt, void *arg)
253 return (0); 253 return (0);
254} 254}
255 255
256static int __devinit a4t_pci_probe(struct pci_dev *dev_a4t, 256static int a4t_pci_probe(struct pci_dev *dev_a4t, struct IsdnCardState *cs,
257 struct IsdnCardState *cs, 257 u_int *found, u_int *pci_memaddr)
258 u_int *found,
259 u_int *pci_memaddr)
260{ 258{
261 u16 sub_sys; 259 u16 sub_sys;
262 u16 sub_vendor; 260 u16 sub_vendor;
@@ -275,9 +273,8 @@ static int __devinit a4t_pci_probe(struct pci_dev *dev_a4t,
275 return (-1); /* continue looping */ 273 return (-1); /* continue looping */
276} 274}
277 275
278static int __devinit a4t_cs_init(struct IsdnCard *card, 276static int a4t_cs_init(struct IsdnCard *card, struct IsdnCardState *cs,
279 struct IsdnCardState *cs, 277 u_int pci_memaddr)
280 u_int pci_memaddr)
281{ 278{
282 I20_REGISTER_FILE *pI20_Regs; 279 I20_REGISTER_FILE *pI20_Regs;
283 280
@@ -323,10 +320,9 @@ static int __devinit a4t_cs_init(struct IsdnCard *card,
323 return (1); 320 return (1);
324} 321}
325 322
326static struct pci_dev *dev_a4t __devinitdata = NULL; 323static struct pci_dev *dev_a4t = NULL;
327 324
328int __devinit 325int setup_bkm_a4t(struct IsdnCard *card)
329setup_bkm_a4t(struct IsdnCard *card)
330{ 326{
331 struct IsdnCardState *cs = card->cs; 327 struct IsdnCardState *cs = card->cs;
332 char tmp[64]; 328 char tmp[64];
diff --git a/drivers/isdn/hisax/bkm_a8.c b/drivers/isdn/hisax/bkm_a8.c
index c9c98f071af6..dd663ea57ec6 100644
--- a/drivers/isdn/hisax/bkm_a8.c
+++ b/drivers/isdn/hisax/bkm_a8.c
@@ -255,8 +255,7 @@ BKM_card_msg(struct IsdnCardState *cs, int mt, void *arg)
255 return (0); 255 return (0);
256} 256}
257 257
258static int __devinit 258static int sct_alloc_io(u_int adr, u_int len)
259sct_alloc_io(u_int adr, u_int len)
260{ 259{
261 if (!request_region(adr, len, "scitel")) { 260 if (!request_region(adr, len, "scitel")) {
262 printk(KERN_WARNING 261 printk(KERN_WARNING
@@ -267,15 +266,14 @@ sct_alloc_io(u_int adr, u_int len)
267 return (0); 266 return (0);
268} 267}
269 268
270static struct pci_dev *dev_a8 __devinitdata = NULL; 269static struct pci_dev *dev_a8 = NULL;
271static u16 sub_vendor_id __devinitdata = 0; 270static u16 sub_vendor_id = 0;
272static u16 sub_sys_id __devinitdata = 0; 271static u16 sub_sys_id = 0;
273static u_char pci_bus __devinitdata = 0; 272static u_char pci_bus = 0;
274static u_char pci_device_fn __devinitdata = 0; 273static u_char pci_device_fn = 0;
275static u_char pci_irq __devinitdata = 0; 274static u_char pci_irq = 0;
276 275
277int __devinit 276int setup_sct_quadro(struct IsdnCard *card)
278setup_sct_quadro(struct IsdnCard *card)
279{ 277{
280 struct IsdnCardState *cs = card->cs; 278 struct IsdnCardState *cs = card->cs;
281 char tmp[64]; 279 char tmp[64];
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c
index b5edc0eeec06..bf04d2a3cf4a 100644
--- a/drivers/isdn/hisax/config.c
+++ b/drivers/isdn/hisax/config.c
@@ -338,11 +338,11 @@ static int io[HISAX_MAX_CARDS] = { 0, };
338#define IO0_IO1 338#define IO0_IO1
339#endif 339#endif
340#ifdef IO0_IO1 340#ifdef IO0_IO1
341static int io0[HISAX_MAX_CARDS] __devinitdata = { 0, }; 341static int io0[HISAX_MAX_CARDS] = { 0, };
342static int io1[HISAX_MAX_CARDS] __devinitdata = { 0, }; 342static int io1[HISAX_MAX_CARDS] = { 0, };
343#endif 343#endif
344static int irq[HISAX_MAX_CARDS] __devinitdata = { 0, }; 344static int irq[HISAX_MAX_CARDS] = { 0, };
345static int mem[HISAX_MAX_CARDS] __devinitdata = { 0, }; 345static int mem[HISAX_MAX_CARDS] = { 0, };
346static char *id = HiSaxID; 346static char *id = HiSaxID;
347 347
348MODULE_DESCRIPTION("ISDN4Linux: Driver for passive ISDN cards"); 348MODULE_DESCRIPTION("ISDN4Linux: Driver for passive ISDN cards");
@@ -852,7 +852,7 @@ static int init_card(struct IsdnCardState *cs)
852 return 3; 852 return 3;
853} 853}
854 854
855static int __devinit hisax_cs_setup_card(struct IsdnCard *card) 855static int hisax_cs_setup_card(struct IsdnCard *card)
856{ 856{
857 int ret; 857 int ret;
858 858
@@ -1171,12 +1171,8 @@ outf_cs:
1171 return 0; 1171 return 0;
1172} 1172}
1173 1173
1174/* Used from an exported function but calls __devinit functions. 1174static int checkcard(int cardnr, char *id, int *busy_flag,
1175 * Tell modpost not to warn (__ref) 1175 struct module *lockowner, hisax_setup_func_t card_setup)
1176 */
1177static int __ref checkcard(int cardnr, char *id, int *busy_flag,
1178 struct module *lockowner,
1179 hisax_setup_func_t card_setup)
1180{ 1176{
1181 int ret; 1177 int ret;
1182 struct IsdnCard *card = cards + cardnr; 1178 struct IsdnCard *card = cards + cardnr;
@@ -1547,9 +1543,7 @@ static void __exit HiSax_exit(void)
1547 printk(KERN_INFO "HiSax module removed\n"); 1543 printk(KERN_INFO "HiSax module removed\n");
1548} 1544}
1549 1545
1550#ifdef CONFIG_HOTPLUG 1546int hisax_init_pcmcia(void *pcm_iob, int *busy_flag, struct IsdnCard *card)
1551
1552int __devinit hisax_init_pcmcia(void *pcm_iob, int *busy_flag, struct IsdnCard *card)
1553{ 1547{
1554 u_char ids[16]; 1548 u_char ids[16];
1555 int ret = -1; 1549 int ret = -1;
@@ -1568,9 +1562,7 @@ int __devinit hisax_init_pcmcia(void *pcm_iob, int *busy_flag, struct IsdnCard *
1568error: 1562error:
1569 return ret; 1563 return ret;
1570} 1564}
1571
1572EXPORT_SYMBOL(hisax_init_pcmcia); 1565EXPORT_SYMBOL(hisax_init_pcmcia);
1573#endif
1574 1566
1575EXPORT_SYMBOL(HiSax_closecard); 1567EXPORT_SYMBOL(HiSax_closecard);
1576 1568
@@ -1917,7 +1909,7 @@ static void EChannel_proc_rcv(struct hisax_d_if *d_if)
1917#ifdef CONFIG_PCI 1909#ifdef CONFIG_PCI
1918#include <linux/pci.h> 1910#include <linux/pci.h>
1919 1911
1920static struct pci_device_id hisax_pci_tbl[] __devinitdata __used = { 1912static struct pci_device_id hisax_pci_tbl[] __used = {
1921#ifdef CONFIG_HISAX_FRITZPCI 1913#ifdef CONFIG_HISAX_FRITZPCI
1922 {PCI_VDEVICE(AVM, PCI_DEVICE_ID_AVM_A1) }, 1914 {PCI_VDEVICE(AVM, PCI_DEVICE_ID_AVM_A1) },
1923#endif 1915#endif
diff --git a/drivers/isdn/hisax/diva.c b/drivers/isdn/hisax/diva.c
index 62a2945fa7f2..8d0cf6e4dc00 100644
--- a/drivers/isdn/hisax/diva.c
+++ b/drivers/isdn/hisax/diva.c
@@ -904,7 +904,7 @@ Diva_card_msg(struct IsdnCardState *cs, int mt, void *arg)
904 return (0); 904 return (0);
905} 905}
906 906
907static int __devinit setup_diva_common(struct IsdnCardState *cs) 907static int setup_diva_common(struct IsdnCardState *cs)
908{ 908{
909 int bytecnt; 909 int bytecnt;
910 u_char val; 910 u_char val;
@@ -997,7 +997,7 @@ static int __devinit setup_diva_common(struct IsdnCardState *cs)
997 997
998#ifdef CONFIG_ISA 998#ifdef CONFIG_ISA
999 999
1000static int __devinit setup_diva_isa(struct IsdnCard *card) 1000static int setup_diva_isa(struct IsdnCard *card)
1001{ 1001{
1002 struct IsdnCardState *cs = card->cs; 1002 struct IsdnCardState *cs = card->cs;
1003 u_char val; 1003 u_char val;
@@ -1033,7 +1033,7 @@ static int __devinit setup_diva_isa(struct IsdnCard *card)
1033 1033
1034#else /* if !CONFIG_ISA */ 1034#else /* if !CONFIG_ISA */
1035 1035
1036static int __devinit setup_diva_isa(struct IsdnCard *card) 1036static int setup_diva_isa(struct IsdnCard *card)
1037{ 1037{
1038 return (-1); /* card not found; continue search */ 1038 return (-1); /* card not found; continue search */
1039} 1039}
@@ -1041,7 +1041,7 @@ static int __devinit setup_diva_isa(struct IsdnCard *card)
1041#endif /* CONFIG_ISA */ 1041#endif /* CONFIG_ISA */
1042 1042
1043#ifdef __ISAPNP__ 1043#ifdef __ISAPNP__
1044static struct isapnp_device_id diva_ids[] __devinitdata = { 1044static struct isapnp_device_id diva_ids[] = {
1045 { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x51), 1045 { ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x51),
1046 ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x51), 1046 ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x51),
1047 (unsigned long) "Diva picola" }, 1047 (unsigned long) "Diva picola" },
@@ -1063,10 +1063,10 @@ static struct isapnp_device_id diva_ids[] __devinitdata = {
1063 { 0, } 1063 { 0, }
1064}; 1064};
1065 1065
1066static struct isapnp_device_id *ipid __devinitdata = &diva_ids[0]; 1066static struct isapnp_device_id *ipid = &diva_ids[0];
1067static struct pnp_card *pnp_c __devinitdata = NULL; 1067static struct pnp_card *pnp_c = NULL;
1068 1068
1069static int __devinit setup_diva_isapnp(struct IsdnCard *card) 1069static int setup_diva_isapnp(struct IsdnCard *card)
1070{ 1070{
1071 struct IsdnCardState *cs = card->cs; 1071 struct IsdnCardState *cs = card->cs;
1072 struct pnp_dev *pnp_d; 1072 struct pnp_dev *pnp_d;
@@ -1141,7 +1141,7 @@ static int __devinit setup_diva_isapnp(struct IsdnCard *card)
1141 1141
1142#else /* if !ISAPNP */ 1142#else /* if !ISAPNP */
1143 1143
1144static int __devinit setup_diva_isapnp(struct IsdnCard *card) 1144static int setup_diva_isapnp(struct IsdnCard *card)
1145{ 1145{
1146 return (-1); /* card not found; continue search */ 1146 return (-1); /* card not found; continue search */
1147} 1147}
@@ -1149,12 +1149,12 @@ static int __devinit setup_diva_isapnp(struct IsdnCard *card)
1149#endif /* ISAPNP */ 1149#endif /* ISAPNP */
1150 1150
1151#ifdef CONFIG_PCI 1151#ifdef CONFIG_PCI
1152static struct pci_dev *dev_diva __devinitdata = NULL; 1152static struct pci_dev *dev_diva = NULL;
1153static struct pci_dev *dev_diva_u __devinitdata = NULL; 1153static struct pci_dev *dev_diva_u = NULL;
1154static struct pci_dev *dev_diva201 __devinitdata = NULL; 1154static struct pci_dev *dev_diva201 = NULL;
1155static struct pci_dev *dev_diva202 __devinitdata = NULL; 1155static struct pci_dev *dev_diva202 = NULL;
1156 1156
1157static int __devinit setup_diva_pci(struct IsdnCard *card) 1157static int setup_diva_pci(struct IsdnCard *card)
1158{ 1158{
1159 struct IsdnCardState *cs = card->cs; 1159 struct IsdnCardState *cs = card->cs;
1160 1160
@@ -1231,15 +1231,14 @@ static int __devinit setup_diva_pci(struct IsdnCard *card)
1231 1231
1232#else /* if !CONFIG_PCI */ 1232#else /* if !CONFIG_PCI */
1233 1233
1234static int __devinit setup_diva_pci(struct IsdnCard *card) 1234static int setup_diva_pci(struct IsdnCard *card)
1235{ 1235{
1236 return (-1); /* card not found; continue search */ 1236 return (-1); /* card not found; continue search */
1237} 1237}
1238 1238
1239#endif /* CONFIG_PCI */ 1239#endif /* CONFIG_PCI */
1240 1240
1241int __devinit 1241int setup_diva(struct IsdnCard *card)
1242setup_diva(struct IsdnCard *card)
1243{ 1242{
1244 int rc, have_card = 0; 1243 int rc, have_card = 0;
1245 struct IsdnCardState *cs = card->cs; 1244 struct IsdnCardState *cs = card->cs;
diff --git a/drivers/isdn/hisax/elsa.c b/drivers/isdn/hisax/elsa.c
index 64ba26a4afe6..1df6f9a56ca2 100644
--- a/drivers/isdn/hisax/elsa.c
+++ b/drivers/isdn/hisax/elsa.c
@@ -831,8 +831,7 @@ probe_elsa(struct IsdnCardState *cs)
831 return (CARD_portlist[i]); 831 return (CARD_portlist[i]);
832} 832}
833 833
834static int __devinit 834static int setup_elsa_isa(struct IsdnCard *card)
835setup_elsa_isa(struct IsdnCard *card)
836{ 835{
837 struct IsdnCardState *cs = card->cs; 836 struct IsdnCardState *cs = card->cs;
838 u_char val; 837 u_char val;
@@ -902,7 +901,7 @@ setup_elsa_isa(struct IsdnCard *card)
902} 901}
903 902
904#ifdef __ISAPNP__ 903#ifdef __ISAPNP__
905static struct isapnp_device_id elsa_ids[] __devinitdata = { 904static struct isapnp_device_id elsa_ids[] = {
906 { ISAPNP_VENDOR('E', 'L', 'S'), ISAPNP_FUNCTION(0x0133), 905 { ISAPNP_VENDOR('E', 'L', 'S'), ISAPNP_FUNCTION(0x0133),
907 ISAPNP_VENDOR('E', 'L', 'S'), ISAPNP_FUNCTION(0x0133), 906 ISAPNP_VENDOR('E', 'L', 'S'), ISAPNP_FUNCTION(0x0133),
908 (unsigned long) "Elsa QS1000" }, 907 (unsigned long) "Elsa QS1000" },
@@ -912,12 +911,11 @@ static struct isapnp_device_id elsa_ids[] __devinitdata = {
912 { 0, } 911 { 0, }
913}; 912};
914 913
915static struct isapnp_device_id *ipid __devinitdata = &elsa_ids[0]; 914static struct isapnp_device_id *ipid = &elsa_ids[0];
916static struct pnp_card *pnp_c __devinitdata = NULL; 915static struct pnp_card *pnp_c = NULL;
917#endif /* __ISAPNP__ */ 916#endif /* __ISAPNP__ */
918 917
919static int __devinit 918static int setup_elsa_isapnp(struct IsdnCard *card)
920setup_elsa_isapnp(struct IsdnCard *card)
921{ 919{
922 struct IsdnCardState *cs = card->cs; 920 struct IsdnCardState *cs = card->cs;
923 921
@@ -994,8 +992,7 @@ setup_elsa_isapnp(struct IsdnCard *card)
994 return (1); 992 return (1);
995} 993}
996 994
997static void __devinit 995static void setup_elsa_pcmcia(struct IsdnCard *card)
998setup_elsa_pcmcia(struct IsdnCard *card)
999{ 996{
1000 struct IsdnCardState *cs = card->cs; 997 struct IsdnCardState *cs = card->cs;
1001 u_char val; 998 u_char val;
@@ -1027,11 +1024,10 @@ setup_elsa_pcmcia(struct IsdnCard *card)
1027} 1024}
1028 1025
1029#ifdef CONFIG_PCI 1026#ifdef CONFIG_PCI
1030static struct pci_dev *dev_qs1000 __devinitdata = NULL; 1027static struct pci_dev *dev_qs1000 = NULL;
1031static struct pci_dev *dev_qs3000 __devinitdata = NULL; 1028static struct pci_dev *dev_qs3000 = NULL;
1032 1029
1033static int __devinit 1030static int setup_elsa_pci(struct IsdnCard *card)
1034setup_elsa_pci(struct IsdnCard *card)
1035{ 1031{
1036 struct IsdnCardState *cs = card->cs; 1032 struct IsdnCardState *cs = card->cs;
1037 1033
@@ -1089,15 +1085,13 @@ setup_elsa_pci(struct IsdnCard *card)
1089 1085
1090#else 1086#else
1091 1087
1092static int __devinit 1088static int setup_elsa_pci(struct IsdnCard *card)
1093setup_elsa_pci(struct IsdnCard *card)
1094{ 1089{
1095 return (1); 1090 return (1);
1096} 1091}
1097#endif /* CONFIG_PCI */ 1092#endif /* CONFIG_PCI */
1098 1093
1099static int __devinit 1094static int setup_elsa_common(struct IsdnCard *card)
1100setup_elsa_common(struct IsdnCard *card)
1101{ 1095{
1102 struct IsdnCardState *cs = card->cs; 1096 struct IsdnCardState *cs = card->cs;
1103 u_char val; 1097 u_char val;
@@ -1212,8 +1206,7 @@ setup_elsa_common(struct IsdnCard *card)
1212 return (1); 1206 return (1);
1213} 1207}
1214 1208
1215int __devinit 1209int setup_elsa(struct IsdnCard *card)
1216setup_elsa(struct IsdnCard *card)
1217{ 1210{
1218 int rc; 1211 int rc;
1219 struct IsdnCardState *cs = card->cs; 1212 struct IsdnCardState *cs = card->cs;
diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c
index a8c4d3fc9a6d..ebe56918f6fc 100644
--- a/drivers/isdn/hisax/elsa_cs.c
+++ b/drivers/isdn/hisax/elsa_cs.c
@@ -62,9 +62,9 @@ MODULE_LICENSE("Dual MPL/GPL");
62static int protocol = 2; /* EURO-ISDN Default */ 62static int protocol = 2; /* EURO-ISDN Default */
63module_param(protocol, int, 0); 63module_param(protocol, int, 0);
64 64
65static int elsa_cs_config(struct pcmcia_device *link) __devinit; 65static int elsa_cs_config(struct pcmcia_device *link);
66static void elsa_cs_release(struct pcmcia_device *link); 66static void elsa_cs_release(struct pcmcia_device *link);
67static void elsa_cs_detach(struct pcmcia_device *p_dev) __devexit; 67static void elsa_cs_detach(struct pcmcia_device *p_dev);
68 68
69typedef struct local_info_t { 69typedef struct local_info_t {
70 struct pcmcia_device *p_dev; 70 struct pcmcia_device *p_dev;
@@ -72,7 +72,7 @@ typedef struct local_info_t {
72 int cardnr; 72 int cardnr;
73} local_info_t; 73} local_info_t;
74 74
75static int __devinit elsa_cs_probe(struct pcmcia_device *link) 75static int elsa_cs_probe(struct pcmcia_device *link)
76{ 76{
77 local_info_t *local; 77 local_info_t *local;
78 78
@@ -90,7 +90,7 @@ static int __devinit elsa_cs_probe(struct pcmcia_device *link)
90 return elsa_cs_config(link); 90 return elsa_cs_config(link);
91} /* elsa_cs_attach */ 91} /* elsa_cs_attach */
92 92
93static void __devexit elsa_cs_detach(struct pcmcia_device *link) 93static void elsa_cs_detach(struct pcmcia_device *link)
94{ 94{
95 local_info_t *info = link->priv; 95 local_info_t *info = link->priv;
96 96
@@ -126,7 +126,7 @@ static int elsa_cs_configcheck(struct pcmcia_device *p_dev, void *priv_data)
126 return -ENODEV; 126 return -ENODEV;
127} 127}
128 128
129static int __devinit elsa_cs_config(struct pcmcia_device *link) 129static int elsa_cs_config(struct pcmcia_device *link)
130{ 130{
131 int i; 131 int i;
132 IsdnCard_t icard; 132 IsdnCard_t icard;
@@ -210,7 +210,7 @@ static struct pcmcia_driver elsa_cs_driver = {
210 .owner = THIS_MODULE, 210 .owner = THIS_MODULE,
211 .name = "elsa_cs", 211 .name = "elsa_cs",
212 .probe = elsa_cs_probe, 212 .probe = elsa_cs_probe,
213 .remove = __devexit_p(elsa_cs_detach), 213 .remove = elsa_cs_detach,
214 .id_table = elsa_ids, 214 .id_table = elsa_ids,
215 .suspend = elsa_suspend, 215 .suspend = elsa_suspend,
216 .resume = elsa_resume, 216 .resume = elsa_resume,
diff --git a/drivers/isdn/hisax/enternow_pci.c b/drivers/isdn/hisax/enternow_pci.c
index b1e38b54ebac..e8d431a8302d 100644
--- a/drivers/isdn/hisax/enternow_pci.c
+++ b/drivers/isdn/hisax/enternow_pci.c
@@ -300,8 +300,7 @@ enpci_interrupt(int intno, void *dev_id)
300 return IRQ_HANDLED; 300 return IRQ_HANDLED;
301} 301}
302 302
303static int __devinit en_pci_probe(struct pci_dev *dev_netjet, 303static int en_pci_probe(struct pci_dev *dev_netjet, struct IsdnCardState *cs)
304 struct IsdnCardState *cs)
305{ 304{
306 if (pci_enable_device(dev_netjet)) 305 if (pci_enable_device(dev_netjet))
307 return (0); 306 return (0);
@@ -326,8 +325,7 @@ static int __devinit en_pci_probe(struct pci_dev *dev_netjet,
326 return (1); 325 return (1);
327} 326}
328 327
329static void __devinit en_cs_init(struct IsdnCard *card, 328static void en_cs_init(struct IsdnCard *card, struct IsdnCardState *cs)
330 struct IsdnCardState *cs)
331{ 329{
332 cs->hw.njet.auxa = cs->hw.njet.base + NETJET_AUXDATA; 330 cs->hw.njet.auxa = cs->hw.njet.base + NETJET_AUXDATA;
333 cs->hw.njet.isac = cs->hw.njet.base + 0xC0; // Fenster zum AMD 331 cs->hw.njet.isac = cs->hw.njet.base + 0xC0; // Fenster zum AMD
@@ -350,8 +348,7 @@ static void __devinit en_cs_init(struct IsdnCard *card,
350 outb(cs->hw.njet.auxd, cs->hw.njet.auxa); 348 outb(cs->hw.njet.auxd, cs->hw.njet.auxa);
351} 349}
352 350
353static int __devinit en_cs_init_rest(struct IsdnCard *card, 351static int en_cs_init_rest(struct IsdnCard *card, struct IsdnCardState *cs)
354 struct IsdnCardState *cs)
355{ 352{
356 const int bytecnt = 256; 353 const int bytecnt = 256;
357 354
@@ -384,11 +381,10 @@ static int __devinit en_cs_init_rest(struct IsdnCard *card,
384 return (1); 381 return (1);
385} 382}
386 383
387static struct pci_dev *dev_netjet __devinitdata = NULL; 384static struct pci_dev *dev_netjet = NULL;
388 385
389/* called by config.c */ 386/* called by config.c */
390int __devinit 387int setup_enternow_pci(struct IsdnCard *card)
391setup_enternow_pci(struct IsdnCard *card)
392{ 388{
393 int ret; 389 int ret;
394 struct IsdnCardState *cs = card->cs; 390 struct IsdnCardState *cs = card->cs;
diff --git a/drivers/isdn/hisax/gazel.c b/drivers/isdn/hisax/gazel.c
index 4fef77562554..35c6df6534ec 100644
--- a/drivers/isdn/hisax/gazel.c
+++ b/drivers/isdn/hisax/gazel.c
@@ -483,8 +483,7 @@ error:
483 return 1; 483 return 1;
484} 484}
485 485
486static int __devinit 486static int setup_gazelisa(struct IsdnCard *card, struct IsdnCardState *cs)
487setup_gazelisa(struct IsdnCard *card, struct IsdnCardState *cs)
488{ 487{
489 printk(KERN_INFO "Gazel: ISA PnP card automatic recognition\n"); 488 printk(KERN_INFO "Gazel: ISA PnP card automatic recognition\n");
490 // we got an irq parameter, assume it is an ISA card 489 // we got an irq parameter, assume it is an ISA card
@@ -532,10 +531,9 @@ setup_gazelisa(struct IsdnCard *card, struct IsdnCardState *cs)
532} 531}
533 532
534#ifdef CONFIG_PCI 533#ifdef CONFIG_PCI
535static struct pci_dev *dev_tel __devinitdata = NULL; 534static struct pci_dev *dev_tel = NULL;
536 535
537static int __devinit 536static int setup_gazelpci(struct IsdnCardState *cs)
538setup_gazelpci(struct IsdnCardState *cs)
539{ 537{
540 u_int pci_ioaddr0 = 0, pci_ioaddr1 = 0; 538 u_int pci_ioaddr0 = 0, pci_ioaddr1 = 0;
541 u_char pci_irq = 0, found; 539 u_char pci_irq = 0, found;
@@ -622,8 +620,7 @@ setup_gazelpci(struct IsdnCardState *cs)
622} 620}
623#endif /* CONFIG_PCI */ 621#endif /* CONFIG_PCI */
624 622
625int __devinit 623int setup_gazel(struct IsdnCard *card)
626setup_gazel(struct IsdnCard *card)
627{ 624{
628 struct IsdnCardState *cs = card->cs; 625 struct IsdnCardState *cs = card->cs;
629 char tmp[64]; 626 char tmp[64];
diff --git a/drivers/isdn/hisax/hfc4s8s_l1.c b/drivers/isdn/hisax/hfc4s8s_l1.c
index dea04de8e7ca..c49c294fc81e 100644
--- a/drivers/isdn/hisax/hfc4s8s_l1.c
+++ b/drivers/isdn/hisax/hfc4s8s_l1.c
@@ -1497,7 +1497,7 @@ enable_pci_ports(hfc4s8s_hw *hw)
1497/* initialise the HFC-4s/8s hardware */ 1497/* initialise the HFC-4s/8s hardware */
1498/* return 0 on success. */ 1498/* return 0 on success. */
1499/*************************************/ 1499/*************************************/
1500static int __devinit 1500static int
1501setup_instance(hfc4s8s_hw *hw) 1501setup_instance(hfc4s8s_hw *hw)
1502{ 1502{
1503 int err = -EIO; 1503 int err = -EIO;
@@ -1585,7 +1585,7 @@ out:
1585/*****************************************/ 1585/*****************************************/
1586/* PCI hotplug interface: probe new card */ 1586/* PCI hotplug interface: probe new card */
1587/*****************************************/ 1587/*****************************************/
1588static int __devinit 1588static int
1589hfc4s8s_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 1589hfc4s8s_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1590{ 1590{
1591 int err = -ENOMEM; 1591 int err = -ENOMEM;
@@ -1640,7 +1640,7 @@ out:
1640/**************************************/ 1640/**************************************/
1641/* PCI hotplug interface: remove card */ 1641/* PCI hotplug interface: remove card */
1642/**************************************/ 1642/**************************************/
1643static void __devexit 1643static void
1644hfc4s8s_remove(struct pci_dev *pdev) 1644hfc4s8s_remove(struct pci_dev *pdev)
1645{ 1645{
1646 hfc4s8s_hw *hw = pci_get_drvdata(pdev); 1646 hfc4s8s_hw *hw = pci_get_drvdata(pdev);
@@ -1662,7 +1662,7 @@ hfc4s8s_remove(struct pci_dev *pdev)
1662static struct pci_driver hfc4s8s_driver = { 1662static struct pci_driver hfc4s8s_driver = {
1663 .name = "hfc4s8s_l1", 1663 .name = "hfc4s8s_l1",
1664 .probe = hfc4s8s_probe, 1664 .probe = hfc4s8s_probe,
1665 .remove = __devexit_p(hfc4s8s_remove), 1665 .remove = hfc4s8s_remove,
1666 .id_table = hfc4s8s_ids, 1666 .id_table = hfc4s8s_ids,
1667}; 1667};
1668 1668
@@ -1688,14 +1688,6 @@ hfc4s8s_module_init(void)
1688 } 1688 }
1689 printk(KERN_INFO "HFC-4S/8S: found %d cards\n", card_cnt); 1689 printk(KERN_INFO "HFC-4S/8S: found %d cards\n", card_cnt);
1690 1690
1691#if !defined(CONFIG_HOTPLUG)
1692 if (err == 0) {
1693 err = -ENODEV;
1694 pci_unregister_driver(&hfc4s8s_driver);
1695 goto out;
1696 }
1697#endif
1698
1699 return 0; 1691 return 0;
1700out: 1692out:
1701 return (err); 1693 return (err);
diff --git a/drivers/isdn/hisax/hfc_pci.c b/drivers/isdn/hisax/hfc_pci.c
index f60d4be58941..3ccd724ff8c2 100644
--- a/drivers/isdn/hisax/hfc_pci.c
+++ b/drivers/isdn/hisax/hfc_pci.c
@@ -1632,9 +1632,9 @@ hfcpci_card_msg(struct IsdnCardState *cs, int mt, void *arg)
1632 1632
1633 1633
1634/* this variable is used as card index when more than one cards are present */ 1634/* this variable is used as card index when more than one cards are present */
1635static struct pci_dev *dev_hfcpci __devinitdata = NULL; 1635static struct pci_dev *dev_hfcpci = NULL;
1636 1636
1637int __devinit 1637int
1638setup_hfcpci(struct IsdnCard *card) 1638setup_hfcpci(struct IsdnCard *card)
1639{ 1639{
1640 u_long flags; 1640 u_long flags;
diff --git a/drivers/isdn/hisax/hfc_sx.c b/drivers/isdn/hisax/hfc_sx.c
index 4ec279ce052f..90f34ae2b80f 100644
--- a/drivers/isdn/hisax/hfc_sx.c
+++ b/drivers/isdn/hisax/hfc_sx.c
@@ -1381,19 +1381,18 @@ hfcsx_card_msg(struct IsdnCardState *cs, int mt, void *arg)
1381} 1381}
1382 1382
1383#ifdef __ISAPNP__ 1383#ifdef __ISAPNP__
1384static struct isapnp_device_id hfc_ids[] __devinitdata = { 1384static struct isapnp_device_id hfc_ids[] = {
1385 { ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2620), 1385 { ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2620),
1386 ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2620), 1386 ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2620),
1387 (unsigned long) "Teles 16.3c2" }, 1387 (unsigned long) "Teles 16.3c2" },
1388 { 0, } 1388 { 0, }
1389}; 1389};
1390 1390
1391static struct isapnp_device_id *ipid __devinitdata = &hfc_ids[0]; 1391static struct isapnp_device_id *ipid = &hfc_ids[0];
1392static struct pnp_card *pnp_c __devinitdata = NULL; 1392static struct pnp_card *pnp_c = NULL;
1393#endif 1393#endif
1394 1394
1395int __devinit 1395int setup_hfcsx(struct IsdnCard *card)
1396setup_hfcsx(struct IsdnCard *card)
1397{ 1396{
1398 struct IsdnCardState *cs = card->cs; 1397 struct IsdnCardState *cs = card->cs;
1399 char tmp[64]; 1398 char tmp[64];
diff --git a/drivers/isdn/hisax/hfcscard.c b/drivers/isdn/hisax/hfcscard.c
index a5f048bd2bb3..394da646e97b 100644
--- a/drivers/isdn/hisax/hfcscard.c
+++ b/drivers/isdn/hisax/hfcscard.c
@@ -136,7 +136,7 @@ hfcs_card_msg(struct IsdnCardState *cs, int mt, void *arg)
136} 136}
137 137
138#ifdef __ISAPNP__ 138#ifdef __ISAPNP__
139static struct isapnp_device_id hfc_ids[] __devinitdata = { 139static struct isapnp_device_id hfc_ids[] = {
140 { ISAPNP_VENDOR('A', 'N', 'X'), ISAPNP_FUNCTION(0x1114), 140 { ISAPNP_VENDOR('A', 'N', 'X'), ISAPNP_FUNCTION(0x1114),
141 ISAPNP_VENDOR('A', 'N', 'X'), ISAPNP_FUNCTION(0x1114), 141 ISAPNP_VENDOR('A', 'N', 'X'), ISAPNP_FUNCTION(0x1114),
142 (unsigned long) "Acer P10" }, 142 (unsigned long) "Acer P10" },
@@ -161,12 +161,11 @@ static struct isapnp_device_id hfc_ids[] __devinitdata = {
161 { 0, } 161 { 0, }
162}; 162};
163 163
164static struct isapnp_device_id *ipid __devinitdata = &hfc_ids[0]; 164static struct isapnp_device_id *ipid = &hfc_ids[0];
165static struct pnp_card *pnp_c __devinitdata = NULL; 165static struct pnp_card *pnp_c = NULL;
166#endif 166#endif
167 167
168int __devinit 168int setup_hfcs(struct IsdnCard *card)
169setup_hfcs(struct IsdnCard *card)
170{ 169{
171 struct IsdnCardState *cs = card->cs; 170 struct IsdnCardState *cs = card->cs;
172 char tmp[64]; 171 char tmp[64];
diff --git a/drivers/isdn/hisax/hisax_fcpcipnp.c b/drivers/isdn/hisax/hisax_fcpcipnp.c
index e4f47fe3f7fd..5e8a5d967162 100644
--- a/drivers/isdn/hisax/hisax_fcpcipnp.c
+++ b/drivers/isdn/hisax/hisax_fcpcipnp.c
@@ -70,7 +70,7 @@ static struct pci_device_id fcpci_ids[] = {
70MODULE_DEVICE_TABLE(pci, fcpci_ids); 70MODULE_DEVICE_TABLE(pci, fcpci_ids);
71 71
72#ifdef CONFIG_PNP 72#ifdef CONFIG_PNP
73static struct pnp_device_id fcpnp_ids[] __devinitdata = { 73static struct pnp_device_id fcpnp_ids[] = {
74 { 74 {
75 .id = "AVM0900", 75 .id = "AVM0900",
76 .driver_data = (unsigned long) "Fritz!Card PnP", 76 .driver_data = (unsigned long) "Fritz!Card PnP",
@@ -712,7 +712,7 @@ static inline void fcpci_init(struct fritz_adapter *adapter)
712 712
713// ---------------------------------------------------------------------- 713// ----------------------------------------------------------------------
714 714
715static int __devinit fcpcipnp_setup(struct fritz_adapter *adapter) 715static int fcpcipnp_setup(struct fritz_adapter *adapter)
716{ 716{
717 u32 val = 0; 717 u32 val = 0;
718 int retval; 718 int retval;
@@ -825,7 +825,7 @@ err:
825 return retval; 825 return retval;
826} 826}
827 827
828static void __devexit fcpcipnp_release(struct fritz_adapter *adapter) 828static void fcpcipnp_release(struct fritz_adapter *adapter)
829{ 829{
830 DBG(1, ""); 830 DBG(1, "");
831 831
@@ -836,8 +836,7 @@ static void __devexit fcpcipnp_release(struct fritz_adapter *adapter)
836 836
837// ---------------------------------------------------------------------- 837// ----------------------------------------------------------------------
838 838
839static struct fritz_adapter * __devinit 839static struct fritz_adapter *new_adapter(void)
840new_adapter(void)
841{ 840{
842 struct fritz_adapter *adapter; 841 struct fritz_adapter *adapter;
843 struct hisax_b_if *b_if[2]; 842 struct hisax_b_if *b_if[2];
@@ -876,8 +875,7 @@ static void delete_adapter(struct fritz_adapter *adapter)
876 kfree(adapter); 875 kfree(adapter);
877} 876}
878 877
879static int __devinit fcpci_probe(struct pci_dev *pdev, 878static int fcpci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
880 const struct pci_device_id *ent)
881{ 879{
882 struct fritz_adapter *adapter; 880 struct fritz_adapter *adapter;
883 int retval; 881 int retval;
@@ -917,7 +915,7 @@ err:
917} 915}
918 916
919#ifdef CONFIG_PNP 917#ifdef CONFIG_PNP
920static int __devinit fcpnp_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id) 918static int fcpnp_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id)
921{ 919{
922 struct fritz_adapter *adapter; 920 struct fritz_adapter *adapter;
923 int retval; 921 int retval;
@@ -959,7 +957,7 @@ err:
959 return retval; 957 return retval;
960} 958}
961 959
962static void __devexit fcpnp_remove(struct pnp_dev *pdev) 960static void fcpnp_remove(struct pnp_dev *pdev)
963{ 961{
964 struct fritz_adapter *adapter = pnp_get_drvdata(pdev); 962 struct fritz_adapter *adapter = pnp_get_drvdata(pdev);
965 963
@@ -973,12 +971,12 @@ static void __devexit fcpnp_remove(struct pnp_dev *pdev)
973static struct pnp_driver fcpnp_driver = { 971static struct pnp_driver fcpnp_driver = {
974 .name = "fcpnp", 972 .name = "fcpnp",
975 .probe = fcpnp_probe, 973 .probe = fcpnp_probe,
976 .remove = __devexit_p(fcpnp_remove), 974 .remove = fcpnp_remove,
977 .id_table = fcpnp_ids, 975 .id_table = fcpnp_ids,
978}; 976};
979#endif 977#endif
980 978
981static void __devexit fcpci_remove(struct pci_dev *pdev) 979static void fcpci_remove(struct pci_dev *pdev)
982{ 980{
983 struct fritz_adapter *adapter = pci_get_drvdata(pdev); 981 struct fritz_adapter *adapter = pci_get_drvdata(pdev);
984 982
@@ -990,7 +988,7 @@ static void __devexit fcpci_remove(struct pci_dev *pdev)
990static struct pci_driver fcpci_driver = { 988static struct pci_driver fcpci_driver = {
991 .name = "fcpci", 989 .name = "fcpci",
992 .probe = fcpci_probe, 990 .probe = fcpci_probe,
993 .remove = __devexit_p(fcpci_remove), 991 .remove = fcpci_remove,
994 .id_table = fcpci_ids, 992 .id_table = fcpci_ids,
995}; 993};
996 994
diff --git a/drivers/isdn/hisax/icc.c b/drivers/isdn/hisax/icc.c
index 7be762b17c70..db5321f6379b 100644
--- a/drivers/isdn/hisax/icc.c
+++ b/drivers/isdn/hisax/icc.c
@@ -673,8 +673,7 @@ clear_pending_icc_ints(struct IsdnCardState *cs)
673 cs->writeisac(cs, ICC_MASK, 0xFF); 673 cs->writeisac(cs, ICC_MASK, 0xFF);
674} 674}
675 675
676void __devinit 676void setup_icc(struct IsdnCardState *cs)
677setup_icc(struct IsdnCardState *cs)
678{ 677{
679 INIT_WORK(&cs->tqueue, icc_bh); 678 INIT_WORK(&cs->tqueue, icc_bh);
680 cs->dbusytimer.function = (void *) dbusy_timer_handler; 679 cs->dbusytimer.function = (void *) dbusy_timer_handler;
diff --git a/drivers/isdn/hisax/isac.c b/drivers/isdn/hisax/isac.c
index bcd70a387307..a365ccc1c99c 100644
--- a/drivers/isdn/hisax/isac.c
+++ b/drivers/isdn/hisax/isac.c
@@ -24,11 +24,11 @@
24#define DBUSY_TIMER_VALUE 80 24#define DBUSY_TIMER_VALUE 80
25#define ARCOFI_USE 1 25#define ARCOFI_USE 1
26 26
27static char *ISACVer[] __devinitdata = 27static char *ISACVer[] =
28{"2086/2186 V1.1", "2085 B1", "2085 B2", 28{"2086/2186 V1.1", "2085 B1", "2085 B2",
29 "2085 V2.3"}; 29 "2085 V2.3"};
30 30
31void __devinit ISACVersion(struct IsdnCardState *cs, char *s) 31void ISACVersion(struct IsdnCardState *cs, char *s)
32{ 32{
33 int val; 33 int val;
34 34
@@ -669,8 +669,7 @@ void clear_pending_isac_ints(struct IsdnCardState *cs)
669 cs->writeisac(cs, ISAC_MASK, 0xFF); 669 cs->writeisac(cs, ISAC_MASK, 0xFF);
670} 670}
671 671
672void __devinit 672void setup_isac(struct IsdnCardState *cs)
673setup_isac(struct IsdnCardState *cs)
674{ 673{
675 INIT_WORK(&cs->tqueue, isac_bh); 674 INIT_WORK(&cs->tqueue, isac_bh);
676 cs->dbusytimer.function = (void *) dbusy_timer_handler; 675 cs->dbusytimer.function = (void *) dbusy_timer_handler;
diff --git a/drivers/isdn/hisax/isurf.c b/drivers/isdn/hisax/isurf.c
index c1530fe248c2..1399ddd4f6cb 100644
--- a/drivers/isdn/hisax/isurf.c
+++ b/drivers/isdn/hisax/isurf.c
@@ -194,11 +194,10 @@ isurf_auxcmd(struct IsdnCardState *cs, isdn_ctrl *ic) {
194} 194}
195 195
196#ifdef __ISAPNP__ 196#ifdef __ISAPNP__
197static struct pnp_card *pnp_c __devinitdata = NULL; 197static struct pnp_card *pnp_c = NULL;
198#endif 198#endif
199 199
200int __devinit 200int setup_isurf(struct IsdnCard *card)
201setup_isurf(struct IsdnCard *card)
202{ 201{
203 int ver; 202 int ver;
204 struct IsdnCardState *cs = card->cs; 203 struct IsdnCardState *cs = card->cs;
diff --git a/drivers/isdn/hisax/ix1_micro.c b/drivers/isdn/hisax/ix1_micro.c
index 5f299f82b801..7ae39f5e865d 100644
--- a/drivers/isdn/hisax/ix1_micro.c
+++ b/drivers/isdn/hisax/ix1_micro.c
@@ -209,7 +209,7 @@ ix1_card_msg(struct IsdnCardState *cs, int mt, void *arg)
209} 209}
210 210
211#ifdef __ISAPNP__ 211#ifdef __ISAPNP__
212static struct isapnp_device_id itk_ids[] __devinitdata = { 212static struct isapnp_device_id itk_ids[] = {
213 { ISAPNP_VENDOR('I', 'T', 'K'), ISAPNP_FUNCTION(0x25), 213 { ISAPNP_VENDOR('I', 'T', 'K'), ISAPNP_FUNCTION(0x25),
214 ISAPNP_VENDOR('I', 'T', 'K'), ISAPNP_FUNCTION(0x25), 214 ISAPNP_VENDOR('I', 'T', 'K'), ISAPNP_FUNCTION(0x25),
215 (unsigned long) "ITK micro 2" }, 215 (unsigned long) "ITK micro 2" },
@@ -219,13 +219,12 @@ static struct isapnp_device_id itk_ids[] __devinitdata = {
219 { 0, } 219 { 0, }
220}; 220};
221 221
222static struct isapnp_device_id *ipid __devinitdata = &itk_ids[0]; 222static struct isapnp_device_id *ipid = &itk_ids[0];
223static struct pnp_card *pnp_c __devinitdata = NULL; 223static struct pnp_card *pnp_c = NULL;
224#endif 224#endif
225 225
226 226
227int __devinit 227int setup_ix1micro(struct IsdnCard *card)
228setup_ix1micro(struct IsdnCard *card)
229{ 228{
230 struct IsdnCardState *cs = card->cs; 229 struct IsdnCardState *cs = card->cs;
231 char tmp[64]; 230 char tmp[64];
diff --git a/drivers/isdn/hisax/mic.c b/drivers/isdn/hisax/mic.c
index 08a6b7fb17f7..93398676f78f 100644
--- a/drivers/isdn/hisax/mic.c
+++ b/drivers/isdn/hisax/mic.c
@@ -187,8 +187,7 @@ mic_card_msg(struct IsdnCardState *cs, int mt, void *arg)
187 return (0); 187 return (0);
188} 188}
189 189
190int __devinit 190int setup_mic(struct IsdnCard *card)
191setup_mic(struct IsdnCard *card)
192{ 191{
193 int bytecnt; 192 int bytecnt;
194 struct IsdnCardState *cs = card->cs; 193 struct IsdnCardState *cs = card->cs;
diff --git a/drivers/isdn/hisax/niccy.c b/drivers/isdn/hisax/niccy.c
index 6569e0315cca..e4c33cfe3ef4 100644
--- a/drivers/isdn/hisax/niccy.c
+++ b/drivers/isdn/hisax/niccy.c
@@ -223,10 +223,10 @@ static int niccy_card_msg(struct IsdnCardState *cs, int mt, void *arg)
223} 223}
224 224
225#ifdef __ISAPNP__ 225#ifdef __ISAPNP__
226static struct pnp_card *pnp_c __devinitdata = NULL; 226static struct pnp_card *pnp_c = NULL;
227#endif 227#endif
228 228
229int __devinit setup_niccy(struct IsdnCard *card) 229int setup_niccy(struct IsdnCard *card)
230{ 230{
231 struct IsdnCardState *cs = card->cs; 231 struct IsdnCardState *cs = card->cs;
232 char tmp[64]; 232 char tmp[64];
@@ -298,7 +298,7 @@ int __devinit setup_niccy(struct IsdnCard *card)
298 } 298 }
299 } else { 299 } else {
300#ifdef CONFIG_PCI 300#ifdef CONFIG_PCI
301 static struct pci_dev *niccy_dev __devinitdata; 301 static struct pci_dev *niccy_dev;
302 302
303 u_int pci_ioaddr; 303 u_int pci_ioaddr;
304 cs->subtyp = 0; 304 cs->subtyp = 0;
diff --git a/drivers/isdn/hisax/nj_s.c b/drivers/isdn/hisax/nj_s.c
index f36ff69c07e1..32b4bbd18eb9 100644
--- a/drivers/isdn/hisax/nj_s.c
+++ b/drivers/isdn/hisax/nj_s.c
@@ -148,8 +148,7 @@ NETjet_S_card_msg(struct IsdnCardState *cs, int mt, void *arg)
148 return (0); 148 return (0);
149} 149}
150 150
151static int __devinit njs_pci_probe(struct pci_dev *dev_netjet, 151static int njs_pci_probe(struct pci_dev *dev_netjet, struct IsdnCardState *cs)
152 struct IsdnCardState *cs)
153{ 152{
154 u32 cfg; 153 u32 cfg;
155 154
@@ -187,8 +186,7 @@ static int __devinit njs_pci_probe(struct pci_dev *dev_netjet,
187 return (1); 186 return (1);
188} 187}
189 188
190static int __devinit njs_cs_init(struct IsdnCard *card, 189static int njs_cs_init(struct IsdnCard *card, struct IsdnCardState *cs)
191 struct IsdnCardState *cs)
192{ 190{
193 191
194 cs->hw.njet.auxa = cs->hw.njet.base + NETJET_AUXDATA; 192 cs->hw.njet.auxa = cs->hw.njet.base + NETJET_AUXDATA;
@@ -225,8 +223,7 @@ static int __devinit njs_cs_init(struct IsdnCard *card,
225 return 1; /* end loop */ 223 return 1; /* end loop */
226} 224}
227 225
228static int __devinit njs_cs_init_rest(struct IsdnCard *card, 226static int njs_cs_init_rest(struct IsdnCard *card, struct IsdnCardState *cs)
229 struct IsdnCardState *cs)
230{ 227{
231 const int bytecnt = 256; 228 const int bytecnt = 256;
232 229
@@ -256,10 +253,9 @@ static int __devinit njs_cs_init_rest(struct IsdnCard *card,
256 return (1); 253 return (1);
257} 254}
258 255
259static struct pci_dev *dev_netjet __devinitdata = NULL; 256static struct pci_dev *dev_netjet = NULL;
260 257
261int __devinit 258int setup_netjet_s(struct IsdnCard *card)
262setup_netjet_s(struct IsdnCard *card)
263{ 259{
264 int ret; 260 int ret;
265 struct IsdnCardState *cs = card->cs; 261 struct IsdnCardState *cs = card->cs;
diff --git a/drivers/isdn/hisax/nj_u.c b/drivers/isdn/hisax/nj_u.c
index 333484aef425..4e8adbede361 100644
--- a/drivers/isdn/hisax/nj_u.c
+++ b/drivers/isdn/hisax/nj_u.c
@@ -128,8 +128,7 @@ NETjet_U_card_msg(struct IsdnCardState *cs, int mt, void *arg)
128 return (0); 128 return (0);
129} 129}
130 130
131static int __devinit nju_pci_probe(struct pci_dev *dev_netjet, 131static int nju_pci_probe(struct pci_dev *dev_netjet, struct IsdnCardState *cs)
132 struct IsdnCardState *cs)
133{ 132{
134 if (pci_enable_device(dev_netjet)) 133 if (pci_enable_device(dev_netjet))
135 return (0); 134 return (0);
@@ -148,8 +147,7 @@ static int __devinit nju_pci_probe(struct pci_dev *dev_netjet,
148 return (1); 147 return (1);
149} 148}
150 149
151static int __devinit nju_cs_init(struct IsdnCard *card, 150static int nju_cs_init(struct IsdnCard *card, struct IsdnCardState *cs)
152 struct IsdnCardState *cs)
153{ 151{
154 cs->hw.njet.auxa = cs->hw.njet.base + NETJET_AUXDATA; 152 cs->hw.njet.auxa = cs->hw.njet.base + NETJET_AUXDATA;
155 cs->hw.njet.isac = cs->hw.njet.base | NETJET_ISAC_OFF; 153 cs->hw.njet.isac = cs->hw.njet.base | NETJET_ISAC_OFF;
@@ -187,8 +185,7 @@ static int __devinit nju_cs_init(struct IsdnCard *card,
187 return 1; /* end loop */ 185 return 1; /* end loop */
188} 186}
189 187
190static int __devinit nju_cs_init_rest(struct IsdnCard *card, 188static int nju_cs_init_rest(struct IsdnCard *card, struct IsdnCardState *cs)
191 struct IsdnCardState *cs)
192{ 189{
193 const int bytecnt = 256; 190 const int bytecnt = 256;
194 191
@@ -219,10 +216,9 @@ static int __devinit nju_cs_init_rest(struct IsdnCard *card,
219 return (1); 216 return (1);
220} 217}
221 218
222static struct pci_dev *dev_netjet __devinitdata = NULL; 219static struct pci_dev *dev_netjet = NULL;
223 220
224int __devinit 221int setup_netjet_u(struct IsdnCard *card)
225setup_netjet_u(struct IsdnCard *card)
226{ 222{
227 int ret; 223 int ret;
228 struct IsdnCardState *cs = card->cs; 224 struct IsdnCardState *cs = card->cs;
diff --git a/drivers/isdn/hisax/s0box.c b/drivers/isdn/hisax/s0box.c
index 383c4e7ce50b..4e7d0aa227ad 100644
--- a/drivers/isdn/hisax/s0box.c
+++ b/drivers/isdn/hisax/s0box.c
@@ -210,8 +210,7 @@ S0Box_card_msg(struct IsdnCardState *cs, int mt, void *arg)
210 return (0); 210 return (0);
211} 211}
212 212
213int __devinit 213int setup_s0box(struct IsdnCard *card)
214setup_s0box(struct IsdnCard *card)
215{ 214{
216 struct IsdnCardState *cs = card->cs; 215 struct IsdnCardState *cs = card->cs;
217 char tmp[64]; 216 char tmp[64];
diff --git a/drivers/isdn/hisax/saphir.c b/drivers/isdn/hisax/saphir.c
index 75dcae6d36e0..6b2d0eccdd56 100644
--- a/drivers/isdn/hisax/saphir.c
+++ b/drivers/isdn/hisax/saphir.c
@@ -240,8 +240,7 @@ saphir_card_msg(struct IsdnCardState *cs, int mt, void *arg)
240} 240}
241 241
242 242
243int __devinit 243int setup_saphir(struct IsdnCard *card)
244setup_saphir(struct IsdnCard *card)
245{ 244{
246 struct IsdnCardState *cs = card->cs; 245 struct IsdnCardState *cs = card->cs;
247 char tmp[64]; 246 char tmp[64];
diff --git a/drivers/isdn/hisax/sedlbauer.c b/drivers/isdn/hisax/sedlbauer.c
index 1ee531b6be99..f16a47bcef48 100644
--- a/drivers/isdn/hisax/sedlbauer.c
+++ b/drivers/isdn/hisax/sedlbauer.c
@@ -517,7 +517,7 @@ Sedl_card_msg(struct IsdnCardState *cs, int mt, void *arg)
517} 517}
518 518
519#ifdef __ISAPNP__ 519#ifdef __ISAPNP__
520static struct isapnp_device_id sedl_ids[] __devinitdata = { 520static struct isapnp_device_id sedl_ids[] = {
521 { ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x01), 521 { ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x01),
522 ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x01), 522 ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x01),
523 (unsigned long) "Speed win" }, 523 (unsigned long) "Speed win" },
@@ -527,11 +527,10 @@ static struct isapnp_device_id sedl_ids[] __devinitdata = {
527 { 0, } 527 { 0, }
528}; 528};
529 529
530static struct isapnp_device_id *ipid __devinitdata = &sedl_ids[0]; 530static struct isapnp_device_id *ipid = &sedl_ids[0];
531static struct pnp_card *pnp_c __devinitdata = NULL; 531static struct pnp_card *pnp_c = NULL;
532 532
533static int __devinit 533static int setup_sedlbauer_isapnp(struct IsdnCard *card, int *bytecnt)
534setup_sedlbauer_isapnp(struct IsdnCard *card, int *bytecnt)
535{ 534{
536 struct IsdnCardState *cs = card->cs; 535 struct IsdnCardState *cs = card->cs;
537 struct pnp_dev *pnp_d; 536 struct pnp_dev *pnp_d;
@@ -591,18 +590,16 @@ setup_sedlbauer_isapnp(struct IsdnCard *card, int *bytecnt)
591} 590}
592#else 591#else
593 592
594static int __devinit 593static int setup_sedlbauer_isapnp(struct IsdnCard *card, int *bytecnt)
595setup_sedlbauer_isapnp(struct IsdnCard *card, int *bytecnt)
596{ 594{
597 return -1; 595 return -1;
598} 596}
599#endif /* __ISAPNP__ */ 597#endif /* __ISAPNP__ */
600 598
601#ifdef CONFIG_PCI 599#ifdef CONFIG_PCI
602static struct pci_dev *dev_sedl __devinitdata = NULL; 600static struct pci_dev *dev_sedl = NULL;
603 601
604static int __devinit 602static int setup_sedlbauer_pci(struct IsdnCard *card)
605setup_sedlbauer_pci(struct IsdnCard *card)
606{ 603{
607 struct IsdnCardState *cs = card->cs; 604 struct IsdnCardState *cs = card->cs;
608 u16 sub_vendor_id, sub_id; 605 u16 sub_vendor_id, sub_id;
@@ -667,16 +664,14 @@ setup_sedlbauer_pci(struct IsdnCard *card)
667 664
668#else 665#else
669 666
670static int __devinit 667static int setup_sedlbauer_pci(struct IsdnCard *card)
671setup_sedlbauer_pci(struct IsdnCard *card)
672{ 668{
673 return (1); 669 return (1);
674} 670}
675 671
676#endif /* CONFIG_PCI */ 672#endif /* CONFIG_PCI */
677 673
678int __devinit 674int setup_sedlbauer(struct IsdnCard *card)
679setup_sedlbauer(struct IsdnCard *card)
680{ 675{
681 int bytecnt = 8, ver, val, rc; 676 int bytecnt = 8, ver, val, rc;
682 struct IsdnCardState *cs = card->cs; 677 struct IsdnCardState *cs = card->cs;
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c
index f0dfc0c976eb..90f81291641b 100644
--- a/drivers/isdn/hisax/sedlbauer_cs.c
+++ b/drivers/isdn/hisax/sedlbauer_cs.c
@@ -62,10 +62,10 @@ MODULE_LICENSE("Dual MPL/GPL");
62static int protocol = 2; /* EURO-ISDN Default */ 62static int protocol = 2; /* EURO-ISDN Default */
63module_param(protocol, int, 0); 63module_param(protocol, int, 0);
64 64
65static int sedlbauer_config(struct pcmcia_device *link) __devinit; 65static int sedlbauer_config(struct pcmcia_device *link);
66static void sedlbauer_release(struct pcmcia_device *link); 66static void sedlbauer_release(struct pcmcia_device *link);
67 67
68static void sedlbauer_detach(struct pcmcia_device *p_dev) __devexit; 68static void sedlbauer_detach(struct pcmcia_device *p_dev);
69 69
70typedef struct local_info_t { 70typedef struct local_info_t {
71 struct pcmcia_device *p_dev; 71 struct pcmcia_device *p_dev;
@@ -73,7 +73,7 @@ typedef struct local_info_t {
73 int cardnr; 73 int cardnr;
74} local_info_t; 74} local_info_t;
75 75
76static int __devinit sedlbauer_probe(struct pcmcia_device *link) 76static int sedlbauer_probe(struct pcmcia_device *link)
77{ 77{
78 local_info_t *local; 78 local_info_t *local;
79 79
@@ -90,7 +90,7 @@ static int __devinit sedlbauer_probe(struct pcmcia_device *link)
90 return sedlbauer_config(link); 90 return sedlbauer_config(link);
91} /* sedlbauer_attach */ 91} /* sedlbauer_attach */
92 92
93static void __devexit sedlbauer_detach(struct pcmcia_device *link) 93static void sedlbauer_detach(struct pcmcia_device *link)
94{ 94{
95 dev_dbg(&link->dev, "sedlbauer_detach(0x%p)\n", link); 95 dev_dbg(&link->dev, "sedlbauer_detach(0x%p)\n", link);
96 96
@@ -110,7 +110,7 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev, void *priv_data)
110 return pcmcia_request_io(p_dev); 110 return pcmcia_request_io(p_dev);
111} 111}
112 112
113static int __devinit sedlbauer_config(struct pcmcia_device *link) 113static int sedlbauer_config(struct pcmcia_device *link)
114{ 114{
115 int ret; 115 int ret;
116 IsdnCard_t icard; 116 IsdnCard_t icard;
@@ -201,7 +201,7 @@ static struct pcmcia_driver sedlbauer_driver = {
201 .owner = THIS_MODULE, 201 .owner = THIS_MODULE,
202 .name = "sedlbauer_cs", 202 .name = "sedlbauer_cs",
203 .probe = sedlbauer_probe, 203 .probe = sedlbauer_probe,
204 .remove = __devexit_p(sedlbauer_detach), 204 .remove = sedlbauer_detach,
205 .id_table = sedlbauer_ids, 205 .id_table = sedlbauer_ids,
206 .suspend = sedlbauer_suspend, 206 .suspend = sedlbauer_suspend,
207 .resume = sedlbauer_resume, 207 .resume = sedlbauer_resume,
diff --git a/drivers/isdn/hisax/sportster.c b/drivers/isdn/hisax/sportster.c
index 1267298ef551..18cee6360d0a 100644
--- a/drivers/isdn/hisax/sportster.c
+++ b/drivers/isdn/hisax/sportster.c
@@ -183,8 +183,7 @@ Sportster_card_msg(struct IsdnCardState *cs, int mt, void *arg)
183 return (0); 183 return (0);
184} 184}
185 185
186static int __devinit 186static int get_io_range(struct IsdnCardState *cs)
187get_io_range(struct IsdnCardState *cs)
188{ 187{
189 int i, j, adr; 188 int i, j, adr;
190 189
@@ -208,8 +207,7 @@ get_io_range(struct IsdnCardState *cs)
208 } 207 }
209} 208}
210 209
211int __devinit 210int setup_sportster(struct IsdnCard *card)
212setup_sportster(struct IsdnCard *card)
213{ 211{
214 struct IsdnCardState *cs = card->cs; 212 struct IsdnCardState *cs = card->cs;
215 char tmp[64]; 213 char tmp[64];
diff --git a/drivers/isdn/hisax/teleint.c b/drivers/isdn/hisax/teleint.c
index fa329e27cc5b..bf647545c70c 100644
--- a/drivers/isdn/hisax/teleint.c
+++ b/drivers/isdn/hisax/teleint.c
@@ -259,8 +259,7 @@ TeleInt_card_msg(struct IsdnCardState *cs, int mt, void *arg)
259 return (0); 259 return (0);
260} 260}
261 261
262int __devinit 262int setup_TeleInt(struct IsdnCard *card)
263setup_TeleInt(struct IsdnCard *card)
264{ 263{
265 struct IsdnCardState *cs = card->cs; 264 struct IsdnCardState *cs = card->cs;
266 char tmp[64]; 265 char tmp[64];
diff --git a/drivers/isdn/hisax/teles0.c b/drivers/isdn/hisax/teles0.c
index 49b4a26f91e0..ce9eabdd2f6e 100644
--- a/drivers/isdn/hisax/teles0.c
+++ b/drivers/isdn/hisax/teles0.c
@@ -263,8 +263,7 @@ Teles_card_msg(struct IsdnCardState *cs, int mt, void *arg)
263 return (0); 263 return (0);
264} 264}
265 265
266int __devinit 266int setup_teles0(struct IsdnCard *card)
267setup_teles0(struct IsdnCard *card)
268{ 267{
269 u_char val; 268 u_char val;
270 struct IsdnCardState *cs = card->cs; 269 struct IsdnCardState *cs = card->cs;
diff --git a/drivers/isdn/hisax/teles3.c b/drivers/isdn/hisax/teles3.c
index 220b919fafc3..38fb2c1a3f0f 100644
--- a/drivers/isdn/hisax/teles3.c
+++ b/drivers/isdn/hisax/teles3.c
@@ -253,7 +253,7 @@ Teles_card_msg(struct IsdnCardState *cs, int mt, void *arg)
253 253
254#ifdef __ISAPNP__ 254#ifdef __ISAPNP__
255 255
256static struct isapnp_device_id teles_ids[] __devinitdata = { 256static struct isapnp_device_id teles_ids[] = {
257 { ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2110), 257 { ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2110),
258 ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2110), 258 ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2110),
259 (unsigned long) "Teles 16.3 PnP" }, 259 (unsigned long) "Teles 16.3 PnP" },
@@ -266,12 +266,11 @@ static struct isapnp_device_id teles_ids[] __devinitdata = {
266 { 0, } 266 { 0, }
267}; 267};
268 268
269static struct isapnp_device_id *ipid __devinitdata = &teles_ids[0]; 269static struct isapnp_device_id *ipid = &teles_ids[0];
270static struct pnp_card *pnp_c __devinitdata = NULL; 270static struct pnp_card *pnp_c = NULL;
271#endif 271#endif
272 272
273int __devinit 273int setup_teles3(struct IsdnCard *card)
274setup_teles3(struct IsdnCard *card)
275{ 274{
276 u_char val; 275 u_char val;
277 struct IsdnCardState *cs = card->cs; 276 struct IsdnCardState *cs = card->cs;
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c
index 4deac451807c..f2476ffb04fd 100644
--- a/drivers/isdn/hisax/teles_cs.c
+++ b/drivers/isdn/hisax/teles_cs.c
@@ -43,9 +43,9 @@ MODULE_LICENSE("GPL");
43static int protocol = 2; /* EURO-ISDN Default */ 43static int protocol = 2; /* EURO-ISDN Default */
44module_param(protocol, int, 0); 44module_param(protocol, int, 0);
45 45
46static int teles_cs_config(struct pcmcia_device *link) __devinit; 46static int teles_cs_config(struct pcmcia_device *link);
47static void teles_cs_release(struct pcmcia_device *link); 47static void teles_cs_release(struct pcmcia_device *link);
48static void teles_detach(struct pcmcia_device *p_dev) __devexit; 48static void teles_detach(struct pcmcia_device *p_dev);
49 49
50typedef struct local_info_t { 50typedef struct local_info_t {
51 struct pcmcia_device *p_dev; 51 struct pcmcia_device *p_dev;
@@ -53,7 +53,7 @@ typedef struct local_info_t {
53 int cardnr; 53 int cardnr;
54} local_info_t; 54} local_info_t;
55 55
56static int __devinit teles_probe(struct pcmcia_device *link) 56static int teles_probe(struct pcmcia_device *link)
57{ 57{
58 local_info_t *local; 58 local_info_t *local;
59 59
@@ -72,7 +72,7 @@ static int __devinit teles_probe(struct pcmcia_device *link)
72 return teles_cs_config(link); 72 return teles_cs_config(link);
73} /* teles_attach */ 73} /* teles_attach */
74 74
75static void __devexit teles_detach(struct pcmcia_device *link) 75static void teles_detach(struct pcmcia_device *link)
76{ 76{
77 local_info_t *info = link->priv; 77 local_info_t *info = link->priv;
78 78
@@ -108,7 +108,7 @@ static int teles_cs_configcheck(struct pcmcia_device *p_dev, void *priv_data)
108 return -ENODEV; 108 return -ENODEV;
109} 109}
110 110
111static int __devinit teles_cs_config(struct pcmcia_device *link) 111static int teles_cs_config(struct pcmcia_device *link)
112{ 112{
113 int i; 113 int i;
114 IsdnCard_t icard; 114 IsdnCard_t icard;
@@ -192,7 +192,7 @@ static struct pcmcia_driver teles_cs_driver = {
192 .owner = THIS_MODULE, 192 .owner = THIS_MODULE,
193 .name = "teles_cs", 193 .name = "teles_cs",
194 .probe = teles_probe, 194 .probe = teles_probe,
195 .remove = __devexit_p(teles_detach), 195 .remove = teles_detach,
196 .id_table = teles_ids, 196 .id_table = teles_ids,
197 .suspend = teles_suspend, 197 .suspend = teles_suspend,
198 .resume = teles_resume, 198 .resume = teles_resume,
diff --git a/drivers/isdn/hisax/telespci.c b/drivers/isdn/hisax/telespci.c
index 9c002c9dc771..f6ab63aa6995 100644
--- a/drivers/isdn/hisax/telespci.c
+++ b/drivers/isdn/hisax/telespci.c
@@ -283,10 +283,9 @@ TelesPCI_card_msg(struct IsdnCardState *cs, int mt, void *arg)
283 return (0); 283 return (0);
284} 284}
285 285
286static struct pci_dev *dev_tel __devinitdata = NULL; 286static struct pci_dev *dev_tel = NULL;
287 287
288int __devinit 288int setup_telespci(struct IsdnCard *card)
289setup_telespci(struct IsdnCard *card)
290{ 289{
291 struct IsdnCardState *cs = card->cs; 290 struct IsdnCardState *cs = card->cs;
292 char tmp[64]; 291 char tmp[64];
diff --git a/drivers/isdn/hisax/w6692.c b/drivers/isdn/hisax/w6692.c
index 0f0d094af85b..d8cac6935818 100644
--- a/drivers/isdn/hisax/w6692.c
+++ b/drivers/isdn/hisax/w6692.c
@@ -991,10 +991,9 @@ w6692_card_msg(struct IsdnCardState *cs, int mt, void *arg)
991 991
992static int id_idx; 992static int id_idx;
993 993
994static struct pci_dev *dev_w6692 __devinitdata = NULL; 994static struct pci_dev *dev_w6692 = NULL;
995 995
996int __devinit 996int setup_w6692(struct IsdnCard *card)
997setup_w6692(struct IsdnCard *card)
998{ 997{
999 struct IsdnCardState *cs = card->cs; 998 struct IsdnCardState *cs = card->cs;
1000 char tmp[64]; 999 char tmp[64];
diff --git a/drivers/isdn/hysdn/hysdn_init.c b/drivers/isdn/hysdn/hysdn_init.c
index b61bbb4bb52b..0db2f7506250 100644
--- a/drivers/isdn/hysdn/hysdn_init.c
+++ b/drivers/isdn/hysdn/hysdn_init.c
@@ -56,8 +56,8 @@ static hysdn_card *card_last = NULL; /* pointer to first card */
56/* is assumed and the module will not be kept in memory. */ 56/* is assumed and the module will not be kept in memory. */
57/****************************************************************************/ 57/****************************************************************************/
58 58
59static int __devinit hysdn_pci_init_one(struct pci_dev *akt_pcidev, 59static int hysdn_pci_init_one(struct pci_dev *akt_pcidev,
60 const struct pci_device_id *ent) 60 const struct pci_device_id *ent)
61{ 61{
62 hysdn_card *card; 62 hysdn_card *card;
63 int rc; 63 int rc;
@@ -109,7 +109,7 @@ err_out:
109 return rc; 109 return rc;
110} 110}
111 111
112static void __devexit hysdn_pci_remove_one(struct pci_dev *akt_pcidev) 112static void hysdn_pci_remove_one(struct pci_dev *akt_pcidev)
113{ 113{
114 hysdn_card *card = pci_get_drvdata(akt_pcidev); 114 hysdn_card *card = pci_get_drvdata(akt_pcidev);
115 115
@@ -147,7 +147,7 @@ static struct pci_driver hysdn_pci_driver = {
147 .name = "hysdn", 147 .name = "hysdn",
148 .id_table = hysdn_pci_tbl, 148 .id_table = hysdn_pci_tbl,
149 .probe = hysdn_pci_init_one, 149 .probe = hysdn_pci_init_one,
150 .remove = __devexit_p(hysdn_pci_remove_one), 150 .remove = hysdn_pci_remove_one,
151}; 151};
152 152
153static int hysdn_have_procfs; 153static int hysdn_have_procfs;
diff --git a/drivers/isdn/mISDN/core.c b/drivers/isdn/mISDN/core.c
index c401634c00ec..3e245712bba7 100644
--- a/drivers/isdn/mISDN/core.c
+++ b/drivers/isdn/mISDN/core.c
@@ -140,7 +140,6 @@ static struct device_attribute mISDN_dev_attrs[] = {
140 {} 140 {}
141}; 141};
142 142
143#ifdef CONFIG_HOTPLUG
144static int mISDN_uevent(struct device *dev, struct kobj_uevent_env *env) 143static int mISDN_uevent(struct device *dev, struct kobj_uevent_env *env)
145{ 144{
146 struct mISDNdevice *mdev = dev_to_mISDN(dev); 145 struct mISDNdevice *mdev = dev_to_mISDN(dev);
@@ -153,7 +152,6 @@ static int mISDN_uevent(struct device *dev, struct kobj_uevent_env *env)
153 152
154 return 0; 153 return 0;
155} 154}
156#endif
157 155
158static void mISDN_class_release(struct class *cls) 156static void mISDN_class_release(struct class *cls)
159{ 157{
@@ -163,9 +161,7 @@ static void mISDN_class_release(struct class *cls)
163static struct class mISDN_class = { 161static struct class mISDN_class = {
164 .name = "mISDN", 162 .name = "mISDN",
165 .owner = THIS_MODULE, 163 .owner = THIS_MODULE,
166#ifdef CONFIG_HOTPLUG
167 .dev_uevent = mISDN_uevent, 164 .dev_uevent = mISDN_uevent,
168#endif
169 .dev_attrs = mISDN_dev_attrs, 165 .dev_attrs = mISDN_dev_attrs,
170 .dev_release = mISDN_dev_release, 166 .dev_release = mISDN_dev_release,
171 .class_release = mISDN_class_release, 167 .class_release = mISDN_class_release,
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index 1885a26776b1..a0d931bcb37c 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -127,8 +127,9 @@ static int create_gpio_led(const struct gpio_led *template,
127 led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME; 127 led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
128 128
129 ret = devm_gpio_request_one(parent, template->gpio, 129 ret = devm_gpio_request_one(parent, template->gpio,
130 GPIOF_DIR_OUT | (led_dat->active_low ^ state), 130 (led_dat->active_low ^ state) ?
131 template->name); 131 GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW,
132 template->name);
132 if (ret < 0) 133 if (ret < 0)
133 return ret; 134 return ret;
134 135
diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c
index ef87310b7662..ac5c87939860 100644
--- a/drivers/macintosh/macio_asic.c
+++ b/drivers/macintosh/macio_asic.c
@@ -679,7 +679,7 @@ void macio_release_resources(struct macio_dev *dev)
679 679
680#ifdef CONFIG_PCI 680#ifdef CONFIG_PCI
681 681
682static int __devinit macio_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 682static int macio_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
683{ 683{
684 struct device_node* np; 684 struct device_node* np;
685 struct macio_chip* chip; 685 struct macio_chip* chip;
@@ -739,7 +739,7 @@ static int __devinit macio_pci_probe(struct pci_dev *pdev, const struct pci_devi
739 return 0; 739 return 0;
740} 740}
741 741
742static void __devexit macio_pci_remove(struct pci_dev* pdev) 742static void macio_pci_remove(struct pci_dev* pdev)
743{ 743{
744 panic("removing of macio-asic not supported !\n"); 744 panic("removing of macio-asic not supported !\n");
745} 745}
@@ -748,7 +748,7 @@ static void __devexit macio_pci_remove(struct pci_dev* pdev)
748 * MacIO is matched against any Apple ID, it's probe() function 748 * MacIO is matched against any Apple ID, it's probe() function
749 * will then decide wether it applies or not 749 * will then decide wether it applies or not
750 */ 750 */
751static const struct pci_device_id __devinitconst pci_ids[] = { { 751static const struct pci_device_id pci_ids[] = { {
752 .vendor = PCI_VENDOR_ID_APPLE, 752 .vendor = PCI_VENDOR_ID_APPLE,
753 .device = PCI_ANY_ID, 753 .device = PCI_ANY_ID,
754 .subvendor = PCI_ANY_ID, 754 .subvendor = PCI_ANY_ID,
diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c
index 3f8d032f180f..d98e566a8f5e 100644
--- a/drivers/macintosh/mediabay.c
+++ b/drivers/macintosh/mediabay.c
@@ -556,7 +556,8 @@ static int media_bay_task(void *x)
556 return 0; 556 return 0;
557} 557}
558 558
559static int __devinit media_bay_attach(struct macio_dev *mdev, const struct of_device_id *match) 559static int media_bay_attach(struct macio_dev *mdev,
560 const struct of_device_id *match)
560{ 561{
561 struct media_bay_info* bay; 562 struct media_bay_info* bay;
562 u32 __iomem *regbase; 563 u32 __iomem *regbase;
diff --git a/drivers/macintosh/rack-meter.c b/drivers/macintosh/rack-meter.c
index 6dc26b61219b..cad0e19b47a2 100644
--- a/drivers/macintosh/rack-meter.c
+++ b/drivers/macintosh/rack-meter.c
@@ -253,7 +253,7 @@ static void rackmeter_do_timer(struct work_struct *work)
253 msecs_to_jiffies(CPU_SAMPLING_RATE)); 253 msecs_to_jiffies(CPU_SAMPLING_RATE));
254} 254}
255 255
256static void __devinit rackmeter_init_cpu_sniffer(struct rackmeter *rm) 256static void rackmeter_init_cpu_sniffer(struct rackmeter *rm)
257{ 257{
258 unsigned int cpu; 258 unsigned int cpu;
259 259
@@ -287,7 +287,7 @@ static void rackmeter_stop_cpu_sniffer(struct rackmeter *rm)
287 cancel_delayed_work_sync(&rm->cpu[1].sniffer); 287 cancel_delayed_work_sync(&rm->cpu[1].sniffer);
288} 288}
289 289
290static int __devinit rackmeter_setup(struct rackmeter *rm) 290static int rackmeter_setup(struct rackmeter *rm)
291{ 291{
292 pr_debug("rackmeter: setting up i2s..\n"); 292 pr_debug("rackmeter: setting up i2s..\n");
293 rackmeter_setup_i2s(rm); 293 rackmeter_setup_i2s(rm);
@@ -362,8 +362,8 @@ static irqreturn_t rackmeter_irq(int irq, void *arg)
362 return IRQ_HANDLED; 362 return IRQ_HANDLED;
363} 363}
364 364
365static int __devinit rackmeter_probe(struct macio_dev* mdev, 365static int rackmeter_probe(struct macio_dev* mdev,
366 const struct of_device_id *match) 366 const struct of_device_id *match)
367{ 367{
368 struct device_node *i2s = NULL, *np = NULL; 368 struct device_node *i2s = NULL, *np = NULL;
369 struct rackmeter *rm = NULL; 369 struct rackmeter *rm = NULL;
@@ -521,7 +521,7 @@ static int __devinit rackmeter_probe(struct macio_dev* mdev,
521 return rc; 521 return rc;
522} 522}
523 523
524static int __devexit rackmeter_remove(struct macio_dev* mdev) 524static int rackmeter_remove(struct macio_dev* mdev)
525{ 525{
526 struct rackmeter *rm = dev_get_drvdata(&mdev->ofdev.dev); 526 struct rackmeter *rm = dev_get_drvdata(&mdev->ofdev.dev);
527 527
@@ -588,7 +588,7 @@ static struct macio_driver rackmeter_driver = {
588 .of_match_table = rackmeter_match, 588 .of_match_table = rackmeter_match,
589 }, 589 },
590 .probe = rackmeter_probe, 590 .probe = rackmeter_probe,
591 .remove = __devexit_p(rackmeter_remove), 591 .remove = rackmeter_remove,
592 .shutdown = rackmeter_shutdown, 592 .shutdown = rackmeter_shutdown,
593}; 593};
594 594
diff --git a/drivers/macintosh/windfarm_ad7417_sensor.c b/drivers/macintosh/windfarm_ad7417_sensor.c
index ac3f243b9c5a..7c28b71246c9 100644
--- a/drivers/macintosh/windfarm_ad7417_sensor.c
+++ b/drivers/macintosh/windfarm_ad7417_sensor.c
@@ -177,9 +177,9 @@ static const struct wf_sensor_ops wf_ad7417_adc_ops = {
177 .owner = THIS_MODULE, 177 .owner = THIS_MODULE,
178}; 178};
179 179
180static void __devinit wf_ad7417_add_sensor(struct wf_ad7417_priv *pv, 180static void wf_ad7417_add_sensor(struct wf_ad7417_priv *pv,
181 int index, const char *name, 181 int index, const char *name,
182 const struct wf_sensor_ops *ops) 182 const struct wf_sensor_ops *ops)
183{ 183{
184 pv->sensors[index].name = kasprintf(GFP_KERNEL, "%s-%d", name, pv->cpu); 184 pv->sensors[index].name = kasprintf(GFP_KERNEL, "%s-%d", name, pv->cpu);
185 pv->sensors[index].priv = pv; 185 pv->sensors[index].priv = pv;
@@ -188,7 +188,7 @@ static void __devinit wf_ad7417_add_sensor(struct wf_ad7417_priv *pv,
188 kref_get(&pv->ref); 188 kref_get(&pv->ref);
189} 189}
190 190
191static void __devinit wf_ad7417_init_chip(struct wf_ad7417_priv *pv) 191static void wf_ad7417_init_chip(struct wf_ad7417_priv *pv)
192{ 192{
193 int rc; 193 int rc;
194 u8 buf[2]; 194 u8 buf[2];
@@ -230,8 +230,8 @@ static void __devinit wf_ad7417_init_chip(struct wf_ad7417_priv *pv)
230 pv->config = config; 230 pv->config = config;
231} 231}
232 232
233static int __devinit wf_ad7417_probe(struct i2c_client *client, 233static int wf_ad7417_probe(struct i2c_client *client,
234 const struct i2c_device_id *id) 234 const struct i2c_device_id *id)
235{ 235{
236 struct wf_ad7417_priv *pv; 236 struct wf_ad7417_priv *pv;
237 const struct mpu_data *mpu; 237 const struct mpu_data *mpu;
@@ -290,7 +290,7 @@ static int __devinit wf_ad7417_probe(struct i2c_client *client,
290 return 0; 290 return 0;
291} 291}
292 292
293static int __devexit wf_ad7417_remove(struct i2c_client *client) 293static int wf_ad7417_remove(struct i2c_client *client)
294{ 294{
295 struct wf_ad7417_priv *pv = dev_get_drvdata(&client->dev); 295 struct wf_ad7417_priv *pv = dev_get_drvdata(&client->dev);
296 int i; 296 int i;
@@ -322,7 +322,7 @@ static struct i2c_driver wf_ad7417_driver = {
322 .id_table = wf_ad7417_id, 322 .id_table = wf_ad7417_id,
323}; 323};
324 324
325static int __devinit wf_ad7417_init(void) 325static int wf_ad7417_init(void)
326{ 326{
327 /* This is only supported on these machines */ 327 /* This is only supported on these machines */
328 if (!of_machine_is_compatible("PowerMac7,2") && 328 if (!of_machine_is_compatible("PowerMac7,2") &&
@@ -333,7 +333,7 @@ static int __devinit wf_ad7417_init(void)
333 return i2c_add_driver(&wf_ad7417_driver); 333 return i2c_add_driver(&wf_ad7417_driver);
334} 334}
335 335
336static void __devexit wf_ad7417_exit(void) 336static void wf_ad7417_exit(void)
337{ 337{
338 i2c_del_driver(&wf_ad7417_driver); 338 i2c_del_driver(&wf_ad7417_driver);
339} 339}
diff --git a/drivers/macintosh/windfarm_fcu_controls.c b/drivers/macintosh/windfarm_fcu_controls.c
index fd6ed15a979d..0226b796a21c 100644
--- a/drivers/macintosh/windfarm_fcu_controls.c
+++ b/drivers/macintosh/windfarm_fcu_controls.c
@@ -282,7 +282,7 @@ static const struct wf_control_ops wf_fcu_fan_pwm_ops = {
282 .owner = THIS_MODULE, 282 .owner = THIS_MODULE,
283}; 283};
284 284
285static void __devinit wf_fcu_get_pump_minmax(struct wf_fcu_fan *fan) 285static void wf_fcu_get_pump_minmax(struct wf_fcu_fan *fan)
286{ 286{
287 const struct mpu_data *mpu = wf_get_mpu(0); 287 const struct mpu_data *mpu = wf_get_mpu(0);
288 u16 pump_min = 0, pump_max = 0xffff; 288 u16 pump_min = 0, pump_max = 0xffff;
@@ -317,7 +317,7 @@ static void __devinit wf_fcu_get_pump_minmax(struct wf_fcu_fan *fan)
317 fan->ctrl.name, pump_min, pump_max); 317 fan->ctrl.name, pump_min, pump_max);
318} 318}
319 319
320static void __devinit wf_fcu_get_rpmfan_minmax(struct wf_fcu_fan *fan) 320static void wf_fcu_get_rpmfan_minmax(struct wf_fcu_fan *fan)
321{ 321{
322 struct wf_fcu_priv *pv = fan->fcu_priv; 322 struct wf_fcu_priv *pv = fan->fcu_priv;
323 const struct mpu_data *mpu0 = wf_get_mpu(0); 323 const struct mpu_data *mpu0 = wf_get_mpu(0);
@@ -359,9 +359,8 @@ static void __devinit wf_fcu_get_rpmfan_minmax(struct wf_fcu_fan *fan)
359 fan->ctrl.name, fan->min, fan->max); 359 fan->ctrl.name, fan->min, fan->max);
360} 360}
361 361
362static void __devinit wf_fcu_add_fan(struct wf_fcu_priv *pv, 362static void wf_fcu_add_fan(struct wf_fcu_priv *pv, const char *name,
363 const char *name, 363 int type, int id)
364 int type, int id)
365{ 364{
366 struct wf_fcu_fan *fan; 365 struct wf_fcu_fan *fan;
367 366
@@ -399,7 +398,7 @@ static void __devinit wf_fcu_add_fan(struct wf_fcu_priv *pv,
399 kref_get(&pv->ref); 398 kref_get(&pv->ref);
400} 399}
401 400
402static void __devinit wf_fcu_lookup_fans(struct wf_fcu_priv *pv) 401static void wf_fcu_lookup_fans(struct wf_fcu_priv *pv)
403{ 402{
404 /* Translation of device-tree location properties to 403 /* Translation of device-tree location properties to
405 * windfarm fan names 404 * windfarm fan names
@@ -481,7 +480,7 @@ static void __devinit wf_fcu_lookup_fans(struct wf_fcu_priv *pv)
481 } 480 }
482} 481}
483 482
484static void __devinit wf_fcu_default_fans(struct wf_fcu_priv *pv) 483static void wf_fcu_default_fans(struct wf_fcu_priv *pv)
485{ 484{
486 /* We only support the default fans for PowerMac7,2 */ 485 /* We only support the default fans for PowerMac7,2 */
487 if (!of_machine_is_compatible("PowerMac7,2")) 486 if (!of_machine_is_compatible("PowerMac7,2"))
@@ -496,7 +495,7 @@ static void __devinit wf_fcu_default_fans(struct wf_fcu_priv *pv)
496 wf_fcu_add_fan(pv, "cpu-rear-fan-1", FCU_FAN_RPM, 6); 495 wf_fcu_add_fan(pv, "cpu-rear-fan-1", FCU_FAN_RPM, 6);
497} 496}
498 497
499static int __devinit wf_fcu_init_chip(struct wf_fcu_priv *pv) 498static int wf_fcu_init_chip(struct wf_fcu_priv *pv)
500{ 499{
501 unsigned char buf = 0xff; 500 unsigned char buf = 0xff;
502 int rc; 501 int rc;
@@ -518,8 +517,8 @@ static int __devinit wf_fcu_init_chip(struct wf_fcu_priv *pv)
518 return 0; 517 return 0;
519} 518}
520 519
521static int __devinit wf_fcu_probe(struct i2c_client *client, 520static int wf_fcu_probe(struct i2c_client *client,
522 const struct i2c_device_id *id) 521 const struct i2c_device_id *id)
523{ 522{
524 struct wf_fcu_priv *pv; 523 struct wf_fcu_priv *pv;
525 524
@@ -564,7 +563,7 @@ static int __devinit wf_fcu_probe(struct i2c_client *client,
564 return 0; 563 return 0;
565} 564}
566 565
567static int __devexit wf_fcu_remove(struct i2c_client *client) 566static int wf_fcu_remove(struct i2c_client *client)
568{ 567{
569 struct wf_fcu_priv *pv = dev_get_drvdata(&client->dev); 568 struct wf_fcu_priv *pv = dev_get_drvdata(&client->dev);
570 struct wf_fcu_fan *fan; 569 struct wf_fcu_fan *fan;
diff --git a/drivers/macintosh/windfarm_pm112.c b/drivers/macintosh/windfarm_pm112.c
index e0ee80700cde..35ef6e2582b8 100644
--- a/drivers/macintosh/windfarm_pm112.c
+++ b/drivers/macintosh/windfarm_pm112.c
@@ -656,7 +656,7 @@ static int wf_pm112_probe(struct platform_device *dev)
656 return 0; 656 return 0;
657} 657}
658 658
659static int __devexit wf_pm112_remove(struct platform_device *dev) 659static int wf_pm112_remove(struct platform_device *dev)
660{ 660{
661 wf_unregister_client(&pm112_events); 661 wf_unregister_client(&pm112_events);
662 /* should release all sensors and controls */ 662 /* should release all sensors and controls */
@@ -665,7 +665,7 @@ static int __devexit wf_pm112_remove(struct platform_device *dev)
665 665
666static struct platform_driver wf_pm112_driver = { 666static struct platform_driver wf_pm112_driver = {
667 .probe = wf_pm112_probe, 667 .probe = wf_pm112_probe,
668 .remove = __devexit_p(wf_pm112_remove), 668 .remove = wf_pm112_remove,
669 .driver = { 669 .driver = {
670 .name = "windfarm", 670 .name = "windfarm",
671 .owner = THIS_MODULE, 671 .owner = THIS_MODULE,
diff --git a/drivers/macintosh/windfarm_pm121.c b/drivers/macintosh/windfarm_pm121.c
index 04067e073aa9..af605e915d41 100644
--- a/drivers/macintosh/windfarm_pm121.c
+++ b/drivers/macintosh/windfarm_pm121.c
@@ -987,7 +987,7 @@ static int pm121_probe(struct platform_device *ddev)
987 return 0; 987 return 0;
988} 988}
989 989
990static int __devexit pm121_remove(struct platform_device *ddev) 990static int pm121_remove(struct platform_device *ddev)
991{ 991{
992 wf_unregister_client(&pm121_events); 992 wf_unregister_client(&pm121_events);
993 return 0; 993 return 0;
@@ -995,7 +995,7 @@ static int __devexit pm121_remove(struct platform_device *ddev)
995 995
996static struct platform_driver pm121_driver = { 996static struct platform_driver pm121_driver = {
997 .probe = pm121_probe, 997 .probe = pm121_probe,
998 .remove = __devexit_p(pm121_remove), 998 .remove = pm121_remove,
999 .driver = { 999 .driver = {
1000 .name = "windfarm", 1000 .name = "windfarm",
1001 .bus = &platform_bus_type, 1001 .bus = &platform_bus_type,
diff --git a/drivers/macintosh/windfarm_pm72.c b/drivers/macintosh/windfarm_pm72.c
index 84ac913d7e3a..6e5585357cd3 100644
--- a/drivers/macintosh/windfarm_pm72.c
+++ b/drivers/macintosh/windfarm_pm72.c
@@ -776,7 +776,7 @@ static int wf_pm72_probe(struct platform_device *dev)
776 return 0; 776 return 0;
777} 777}
778 778
779static int __devexit wf_pm72_remove(struct platform_device *dev) 779static int wf_pm72_remove(struct platform_device *dev)
780{ 780{
781 wf_unregister_client(&pm72_events); 781 wf_unregister_client(&pm72_events);
782 782
diff --git a/drivers/macintosh/windfarm_pm81.c b/drivers/macintosh/windfarm_pm81.c
index 990c87606be9..f84933ff3298 100644
--- a/drivers/macintosh/windfarm_pm81.c
+++ b/drivers/macintosh/windfarm_pm81.c
@@ -720,7 +720,7 @@ static int wf_smu_probe(struct platform_device *ddev)
720 return 0; 720 return 0;
721} 721}
722 722
723static int __devexit wf_smu_remove(struct platform_device *ddev) 723static int wf_smu_remove(struct platform_device *ddev)
724{ 724{
725 wf_unregister_client(&wf_smu_events); 725 wf_unregister_client(&wf_smu_events);
726 726
@@ -763,7 +763,7 @@ static int __devexit wf_smu_remove(struct platform_device *ddev)
763 763
764static struct platform_driver wf_smu_driver = { 764static struct platform_driver wf_smu_driver = {
765 .probe = wf_smu_probe, 765 .probe = wf_smu_probe,
766 .remove = __devexit_p(wf_smu_remove), 766 .remove = wf_smu_remove,
767 .driver = { 767 .driver = {
768 .name = "windfarm", 768 .name = "windfarm",
769 .owner = THIS_MODULE, 769 .owner = THIS_MODULE,
diff --git a/drivers/macintosh/windfarm_pm91.c b/drivers/macintosh/windfarm_pm91.c
index 7653603cb00e..2eb484f213c8 100644
--- a/drivers/macintosh/windfarm_pm91.c
+++ b/drivers/macintosh/windfarm_pm91.c
@@ -642,7 +642,7 @@ static int wf_smu_probe(struct platform_device *ddev)
642 return 0; 642 return 0;
643} 643}
644 644
645static int __devexit wf_smu_remove(struct platform_device *ddev) 645static int wf_smu_remove(struct platform_device *ddev)
646{ 646{
647 wf_unregister_client(&wf_smu_events); 647 wf_unregister_client(&wf_smu_events);
648 648
@@ -692,7 +692,7 @@ static int __devexit wf_smu_remove(struct platform_device *ddev)
692 692
693static struct platform_driver wf_smu_driver = { 693static struct platform_driver wf_smu_driver = {
694 .probe = wf_smu_probe, 694 .probe = wf_smu_probe,
695 .remove = __devexit_p(wf_smu_remove), 695 .remove = wf_smu_remove,
696 .driver = { 696 .driver = {
697 .name = "windfarm", 697 .name = "windfarm",
698 .owner = THIS_MODULE, 698 .owner = THIS_MODULE,
diff --git a/drivers/macintosh/windfarm_rm31.c b/drivers/macintosh/windfarm_rm31.c
index 3eca6d4b52fc..844003fb4ef0 100644
--- a/drivers/macintosh/windfarm_rm31.c
+++ b/drivers/macintosh/windfarm_rm31.c
@@ -669,7 +669,7 @@ static int wf_rm31_probe(struct platform_device *dev)
669 return 0; 669 return 0;
670} 670}
671 671
672static int __devexit wf_rm31_remove(struct platform_device *dev) 672static int wf_rm31_remove(struct platform_device *dev)
673{ 673{
674 wf_unregister_client(&rm31_events); 674 wf_unregister_client(&rm31_events);
675 675
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index 3d8984edeff7..9e58dbd8d8cb 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -340,24 +340,22 @@ static int validate_region_size(struct raid_set *rs, unsigned long region_size)
340} 340}
341 341
342/* 342/*
343 * validate_rebuild_devices 343 * validate_raid_redundancy
344 * @rs 344 * @rs
345 * 345 *
346 * Determine if the devices specified for rebuild can result in a valid 346 * Determine if there are enough devices in the array that haven't
347 * usable array that is capable of rebuilding the given devices. 347 * failed (or are being rebuilt) to form a usable array.
348 * 348 *
349 * Returns: 0 on success, -EINVAL on failure. 349 * Returns: 0 on success, -EINVAL on failure.
350 */ 350 */
351static int validate_rebuild_devices(struct raid_set *rs) 351static int validate_raid_redundancy(struct raid_set *rs)
352{ 352{
353 unsigned i, rebuild_cnt = 0; 353 unsigned i, rebuild_cnt = 0;
354 unsigned rebuilds_per_group, copies, d; 354 unsigned rebuilds_per_group, copies, d;
355 355
356 if (!(rs->print_flags & DMPF_REBUILD))
357 return 0;
358
359 for (i = 0; i < rs->md.raid_disks; i++) 356 for (i = 0; i < rs->md.raid_disks; i++)
360 if (!test_bit(In_sync, &rs->dev[i].rdev.flags)) 357 if (!test_bit(In_sync, &rs->dev[i].rdev.flags) ||
358 !rs->dev[i].rdev.sb_page)
361 rebuild_cnt++; 359 rebuild_cnt++;
362 360
363 switch (rs->raid_type->level) { 361 switch (rs->raid_type->level) {
@@ -393,27 +391,24 @@ static int validate_rebuild_devices(struct raid_set *rs)
393 * A A B B C 391 * A A B B C
394 * C D D E E 392 * C D D E E
395 */ 393 */
396 rebuilds_per_group = 0;
397 for (i = 0; i < rs->md.raid_disks * copies; i++) { 394 for (i = 0; i < rs->md.raid_disks * copies; i++) {
395 if (!(i % copies))
396 rebuilds_per_group = 0;
398 d = i % rs->md.raid_disks; 397 d = i % rs->md.raid_disks;
399 if (!test_bit(In_sync, &rs->dev[d].rdev.flags) && 398 if ((!rs->dev[d].rdev.sb_page ||
399 !test_bit(In_sync, &rs->dev[d].rdev.flags)) &&
400 (++rebuilds_per_group >= copies)) 400 (++rebuilds_per_group >= copies))
401 goto too_many; 401 goto too_many;
402 if (!((i + 1) % copies))
403 rebuilds_per_group = 0;
404 } 402 }
405 break; 403 break;
406 default: 404 default:
407 DMERR("The rebuild parameter is not supported for %s", 405 if (rebuild_cnt)
408 rs->raid_type->name); 406 return -EINVAL;
409 rs->ti->error = "Rebuild not supported for this RAID type";
410 return -EINVAL;
411 } 407 }
412 408
413 return 0; 409 return 0;
414 410
415too_many: 411too_many:
416 rs->ti->error = "Too many rebuild devices specified";
417 return -EINVAL; 412 return -EINVAL;
418} 413}
419 414
@@ -664,9 +659,6 @@ static int parse_raid_params(struct raid_set *rs, char **argv,
664 } 659 }
665 rs->md.dev_sectors = sectors_per_dev; 660 rs->md.dev_sectors = sectors_per_dev;
666 661
667 if (validate_rebuild_devices(rs))
668 return -EINVAL;
669
670 /* Assume there are no metadata devices until the drives are parsed */ 662 /* Assume there are no metadata devices until the drives are parsed */
671 rs->md.persistent = 0; 663 rs->md.persistent = 0;
672 rs->md.external = 1; 664 rs->md.external = 1;
@@ -995,28 +987,10 @@ static int super_validate(struct mddev *mddev, struct md_rdev *rdev)
995static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs) 987static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs)
996{ 988{
997 int ret; 989 int ret;
998 unsigned redundancy = 0;
999 struct raid_dev *dev; 990 struct raid_dev *dev;
1000 struct md_rdev *rdev, *tmp, *freshest; 991 struct md_rdev *rdev, *tmp, *freshest;
1001 struct mddev *mddev = &rs->md; 992 struct mddev *mddev = &rs->md;
1002 993
1003 switch (rs->raid_type->level) {
1004 case 1:
1005 redundancy = rs->md.raid_disks - 1;
1006 break;
1007 case 4:
1008 case 5:
1009 case 6:
1010 redundancy = rs->raid_type->parity_devs;
1011 break;
1012 case 10:
1013 redundancy = raid10_md_layout_to_copies(mddev->layout) - 1;
1014 break;
1015 default:
1016 ti->error = "Unknown RAID type";
1017 return -EINVAL;
1018 }
1019
1020 freshest = NULL; 994 freshest = NULL;
1021 rdev_for_each_safe(rdev, tmp, mddev) { 995 rdev_for_each_safe(rdev, tmp, mddev) {
1022 /* 996 /*
@@ -1045,44 +1019,43 @@ static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs)
1045 break; 1019 break;
1046 default: 1020 default:
1047 dev = container_of(rdev, struct raid_dev, rdev); 1021 dev = container_of(rdev, struct raid_dev, rdev);
1048 if (redundancy--) { 1022 if (dev->meta_dev)
1049 if (dev->meta_dev) 1023 dm_put_device(ti, dev->meta_dev);
1050 dm_put_device(ti, dev->meta_dev);
1051
1052 dev->meta_dev = NULL;
1053 rdev->meta_bdev = NULL;
1054 1024
1055 if (rdev->sb_page) 1025 dev->meta_dev = NULL;
1056 put_page(rdev->sb_page); 1026 rdev->meta_bdev = NULL;
1057 1027
1058 rdev->sb_page = NULL; 1028 if (rdev->sb_page)
1029 put_page(rdev->sb_page);
1059 1030
1060 rdev->sb_loaded = 0; 1031 rdev->sb_page = NULL;
1061 1032
1062 /* 1033 rdev->sb_loaded = 0;
1063 * We might be able to salvage the data device
1064 * even though the meta device has failed. For
1065 * now, we behave as though '- -' had been
1066 * set for this device in the table.
1067 */
1068 if (dev->data_dev)
1069 dm_put_device(ti, dev->data_dev);
1070 1034
1071 dev->data_dev = NULL; 1035 /*
1072 rdev->bdev = NULL; 1036 * We might be able to salvage the data device
1037 * even though the meta device has failed. For
1038 * now, we behave as though '- -' had been
1039 * set for this device in the table.
1040 */
1041 if (dev->data_dev)
1042 dm_put_device(ti, dev->data_dev);
1073 1043
1074 list_del(&rdev->same_set); 1044 dev->data_dev = NULL;
1045 rdev->bdev = NULL;
1075 1046
1076 continue; 1047 list_del(&rdev->same_set);
1077 }
1078 ti->error = "Failed to load superblock";
1079 return ret;
1080 } 1048 }
1081 } 1049 }
1082 1050
1083 if (!freshest) 1051 if (!freshest)
1084 return 0; 1052 return 0;
1085 1053
1054 if (validate_raid_redundancy(rs)) {
1055 rs->ti->error = "Insufficient redundancy to activate array";
1056 return -EINVAL;
1057 }
1058
1086 /* 1059 /*
1087 * Validation of the freshest device provides the source of 1060 * Validation of the freshest device provides the source of
1088 * validation for the remaining devices. 1061 * validation for the remaining devices.
@@ -1432,7 +1405,7 @@ static void raid_resume(struct dm_target *ti)
1432 1405
1433static struct target_type raid_target = { 1406static struct target_type raid_target = {
1434 .name = "raid", 1407 .name = "raid",
1435 .version = {1, 4, 0}, 1408 .version = {1, 4, 1},
1436 .module = THIS_MODULE, 1409 .module = THIS_MODULE,
1437 .ctr = raid_ctr, 1410 .ctr = raid_ctr,
1438 .dtr = raid_dtr, 1411 .dtr = raid_dtr,
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index 675ae5274016..5409607d4875 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -2746,19 +2746,9 @@ static int thin_iterate_devices(struct dm_target *ti,
2746 return 0; 2746 return 0;
2747} 2747}
2748 2748
2749/*
2750 * A thin device always inherits its queue limits from its pool.
2751 */
2752static void thin_io_hints(struct dm_target *ti, struct queue_limits *limits)
2753{
2754 struct thin_c *tc = ti->private;
2755
2756 *limits = bdev_get_queue(tc->pool_dev->bdev)->limits;
2757}
2758
2759static struct target_type thin_target = { 2749static struct target_type thin_target = {
2760 .name = "thin", 2750 .name = "thin",
2761 .version = {1, 6, 0}, 2751 .version = {1, 7, 0},
2762 .module = THIS_MODULE, 2752 .module = THIS_MODULE,
2763 .ctr = thin_ctr, 2753 .ctr = thin_ctr,
2764 .dtr = thin_dtr, 2754 .dtr = thin_dtr,
@@ -2767,7 +2757,6 @@ static struct target_type thin_target = {
2767 .postsuspend = thin_postsuspend, 2757 .postsuspend = thin_postsuspend,
2768 .status = thin_status, 2758 .status = thin_status,
2769 .iterate_devices = thin_iterate_devices, 2759 .iterate_devices = thin_iterate_devices,
2770 .io_hints = thin_io_hints,
2771}; 2760};
2772 2761
2773/*----------------------------------------------------------------*/ 2762/*----------------------------------------------------------------*/
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index c72e4d5a9617..314a0e2faf79 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1188,6 +1188,7 @@ static int __clone_and_map_changing_extent_only(struct clone_info *ci,
1188{ 1188{
1189 struct dm_target *ti; 1189 struct dm_target *ti;
1190 sector_t len; 1190 sector_t len;
1191 unsigned num_requests;
1191 1192
1192 do { 1193 do {
1193 ti = dm_table_find_target(ci->map, ci->sector); 1194 ti = dm_table_find_target(ci->map, ci->sector);
@@ -1200,7 +1201,8 @@ static int __clone_and_map_changing_extent_only(struct clone_info *ci,
1200 * reconfiguration might also have changed that since the 1201 * reconfiguration might also have changed that since the
1201 * check was performed. 1202 * check was performed.
1202 */ 1203 */
1203 if (!get_num_requests || !get_num_requests(ti)) 1204 num_requests = get_num_requests ? get_num_requests(ti) : 0;
1205 if (!num_requests)
1204 return -EOPNOTSUPP; 1206 return -EOPNOTSUPP;
1205 1207
1206 if (is_split_required && !is_split_required(ti)) 1208 if (is_split_required && !is_split_required(ti))
@@ -1208,7 +1210,7 @@ static int __clone_and_map_changing_extent_only(struct clone_info *ci,
1208 else 1210 else
1209 len = min(ci->sector_count, max_io_len(ci->sector, ti)); 1211 len = min(ci->sector_count, max_io_len(ci->sector, ti));
1210 1212
1211 __issue_target_requests(ci, ti, ti->num_discard_requests, len); 1213 __issue_target_requests(ci, ti, num_requests, len);
1212 1214
1213 ci->sector += len; 1215 ci->sector += len;
1214 } while (ci->sector_count -= len); 1216 } while (ci->sector_count -= len);
diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
index 45ecf8db1eae..64d71fb87a96 100644
--- a/drivers/media/i2c/adv7180.c
+++ b/drivers/media/i2c/adv7180.c
@@ -540,8 +540,8 @@ static int init_device(struct i2c_client *client, struct adv7180_state *state)
540 return 0; 540 return 0;
541} 541}
542 542
543static __devinit int adv7180_probe(struct i2c_client *client, 543static int adv7180_probe(struct i2c_client *client,
544 const struct i2c_device_id *id) 544 const struct i2c_device_id *id)
545{ 545{
546 struct adv7180_state *state; 546 struct adv7180_state *state;
547 struct v4l2_subdev *sd; 547 struct v4l2_subdev *sd;
@@ -587,7 +587,7 @@ err:
587 return ret; 587 return ret;
588} 588}
589 589
590static __devexit int adv7180_remove(struct i2c_client *client) 590static int adv7180_remove(struct i2c_client *client)
591{ 591{
592 struct v4l2_subdev *sd = i2c_get_clientdata(client); 592 struct v4l2_subdev *sd = i2c_get_clientdata(client);
593 struct adv7180_state *state = to_state(sd); 593 struct adv7180_state *state = to_state(sd);
@@ -652,7 +652,7 @@ static struct i2c_driver adv7180_driver = {
652 .name = KBUILD_MODNAME, 652 .name = KBUILD_MODNAME,
653 }, 653 },
654 .probe = adv7180_probe, 654 .probe = adv7180_probe,
655 .remove = __devexit_p(adv7180_remove), 655 .remove = adv7180_remove,
656#ifdef CONFIG_PM 656#ifdef CONFIG_PM
657 .suspend = adv7180_suspend, 657 .suspend = adv7180_suspend,
658 .resume = adv7180_resume, 658 .resume = adv7180_resume,
diff --git a/drivers/media/i2c/adv7183.c b/drivers/media/i2c/adv7183.c
index 10c3c1db4cdd..6fed5b74e743 100644
--- a/drivers/media/i2c/adv7183.c
+++ b/drivers/media/i2c/adv7183.c
@@ -677,7 +677,7 @@ static struct i2c_driver adv7183_driver = {
677 .name = "adv7183", 677 .name = "adv7183",
678 }, 678 },
679 .probe = adv7183_probe, 679 .probe = adv7183_probe,
680 .remove = __devexit_p(adv7183_remove), 680 .remove = adv7183_remove,
681 .id_table = adv7183_id, 681 .id_table = adv7183_id,
682}; 682};
683 683
diff --git a/drivers/media/i2c/as3645a.c b/drivers/media/i2c/as3645a.c
index 3bfdbf9d9bf1..58d523f2648f 100644
--- a/drivers/media/i2c/as3645a.c
+++ b/drivers/media/i2c/as3645a.c
@@ -713,7 +713,7 @@ static int as3645a_resume(struct device *dev)
713 * The number of LEDs reported in platform data is used to compute default 713 * The number of LEDs reported in platform data is used to compute default
714 * limits. Parameters passed through platform data can override those limits. 714 * limits. Parameters passed through platform data can override those limits.
715 */ 715 */
716static int __devinit as3645a_init_controls(struct as3645a *flash) 716static int as3645a_init_controls(struct as3645a *flash)
717{ 717{
718 const struct as3645a_platform_data *pdata = flash->pdata; 718 const struct as3645a_platform_data *pdata = flash->pdata;
719 struct v4l2_ctrl *ctrl; 719 struct v4l2_ctrl *ctrl;
@@ -804,8 +804,8 @@ static int __devinit as3645a_init_controls(struct as3645a *flash)
804 return flash->ctrls.error; 804 return flash->ctrls.error;
805} 805}
806 806
807static int __devinit as3645a_probe(struct i2c_client *client, 807static int as3645a_probe(struct i2c_client *client,
808 const struct i2c_device_id *devid) 808 const struct i2c_device_id *devid)
809{ 809{
810 struct as3645a *flash; 810 struct as3645a *flash;
811 int ret; 811 int ret;
@@ -846,7 +846,7 @@ done:
846 return ret; 846 return ret;
847} 847}
848 848
849static int __devexit as3645a_remove(struct i2c_client *client) 849static int as3645a_remove(struct i2c_client *client)
850{ 850{
851 struct v4l2_subdev *subdev = i2c_get_clientdata(client); 851 struct v4l2_subdev *subdev = i2c_get_clientdata(client);
852 struct as3645a *flash = to_as3645a(subdev); 852 struct as3645a *flash = to_as3645a(subdev);
@@ -877,7 +877,7 @@ static struct i2c_driver as3645a_i2c_driver = {
877 .pm = &as3645a_pm_ops, 877 .pm = &as3645a_pm_ops,
878 }, 878 },
879 .probe = as3645a_probe, 879 .probe = as3645a_probe,
880 .remove = __devexit_p(as3645a_remove), 880 .remove = as3645a_remove,
881 .id_table = as3645a_id_table, 881 .id_table = as3645a_id_table,
882}; 882};
883 883
diff --git a/drivers/media/i2c/m5mols/m5mols_core.c b/drivers/media/i2c/m5mols/m5mols_core.c
index 8131d651de9e..d4e7567b367c 100644
--- a/drivers/media/i2c/m5mols/m5mols_core.c
+++ b/drivers/media/i2c/m5mols/m5mols_core.c
@@ -556,7 +556,7 @@ static int m5mols_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
556 mutex_lock(&info->lock); 556 mutex_lock(&info->lock);
557 557
558 format = __find_format(info, fh, fmt->which, info->res_type); 558 format = __find_format(info, fh, fmt->which, info->res_type);
559 if (!format) 559 if (format)
560 fmt->format = *format; 560 fmt->format = *format;
561 else 561 else
562 ret = -EINVAL; 562 ret = -EINVAL;
@@ -926,8 +926,8 @@ static irqreturn_t m5mols_irq_handler(int irq, void *data)
926 return IRQ_HANDLED; 926 return IRQ_HANDLED;
927} 927}
928 928
929static int __devinit m5mols_probe(struct i2c_client *client, 929static int m5mols_probe(struct i2c_client *client,
930 const struct i2c_device_id *id) 930 const struct i2c_device_id *id)
931{ 931{
932 const struct m5mols_platform_data *pdata = client->dev.platform_data; 932 const struct m5mols_platform_data *pdata = client->dev.platform_data;
933 struct m5mols_info *info; 933 struct m5mols_info *info;
@@ -1018,7 +1018,7 @@ out_free:
1018 return ret; 1018 return ret;
1019} 1019}
1020 1020
1021static int __devexit m5mols_remove(struct i2c_client *client) 1021static int m5mols_remove(struct i2c_client *client)
1022{ 1022{
1023 struct v4l2_subdev *sd = i2c_get_clientdata(client); 1023 struct v4l2_subdev *sd = i2c_get_clientdata(client);
1024 struct m5mols_info *info = to_m5mols(sd); 1024 struct m5mols_info *info = to_m5mols(sd);
@@ -1045,7 +1045,7 @@ static struct i2c_driver m5mols_i2c_driver = {
1045 .name = MODULE_NAME, 1045 .name = MODULE_NAME,
1046 }, 1046 },
1047 .probe = m5mols_probe, 1047 .probe = m5mols_probe,
1048 .remove = __devexit_p(m5mols_remove), 1048 .remove = m5mols_remove,
1049 .id_table = m5mols_id, 1049 .id_table = m5mols_id,
1050}; 1050};
1051 1051
diff --git a/drivers/media/i2c/vs6624.c b/drivers/media/i2c/vs6624.c
index f434a19b9bcb..9ac1b8c3a837 100644
--- a/drivers/media/i2c/vs6624.c
+++ b/drivers/media/i2c/vs6624.c
@@ -788,7 +788,7 @@ static const struct v4l2_subdev_ops vs6624_ops = {
788 .video = &vs6624_video_ops, 788 .video = &vs6624_video_ops,
789}; 789};
790 790
791static int __devinit vs6624_probe(struct i2c_client *client, 791static int vs6624_probe(struct i2c_client *client,
792 const struct i2c_device_id *id) 792 const struct i2c_device_id *id)
793{ 793{
794 struct vs6624 *sensor; 794 struct vs6624 *sensor;
@@ -881,7 +881,7 @@ static int __devinit vs6624_probe(struct i2c_client *client,
881 return ret; 881 return ret;
882} 882}
883 883
884static int __devexit vs6624_remove(struct i2c_client *client) 884static int vs6624_remove(struct i2c_client *client)
885{ 885{
886 struct v4l2_subdev *sd = i2c_get_clientdata(client); 886 struct v4l2_subdev *sd = i2c_get_clientdata(client);
887 struct vs6624 *sensor = to_vs6624(sd); 887 struct vs6624 *sensor = to_vs6624(sd);
@@ -906,7 +906,7 @@ static struct i2c_driver vs6624_driver = {
906 .name = "vs6624", 906 .name = "vs6624",
907 }, 907 },
908 .probe = vs6624_probe, 908 .probe = vs6624_probe,
909 .remove = __devexit_p(vs6624_remove), 909 .remove = vs6624_remove,
910 .id_table = vs6624_id, 910 .id_table = vs6624_id,
911}; 911};
912 912
diff --git a/drivers/media/mmc/siano/smssdio.c b/drivers/media/mmc/siano/smssdio.c
index d6f3f100699a..15d34935e00b 100644
--- a/drivers/media/mmc/siano/smssdio.c
+++ b/drivers/media/mmc/siano/smssdio.c
@@ -50,7 +50,7 @@
50#define SMSSDIO_INT 0x04 50#define SMSSDIO_INT 0x04
51#define SMSSDIO_BLOCK_SIZE 128 51#define SMSSDIO_BLOCK_SIZE 128
52 52
53static const struct sdio_device_id smssdio_ids[] __devinitconst = { 53static const struct sdio_device_id smssdio_ids[] = {
54 {SDIO_DEVICE(SDIO_VENDOR_ID_SIANO, SDIO_DEVICE_ID_SIANO_STELLAR), 54 {SDIO_DEVICE(SDIO_VENDOR_ID_SIANO, SDIO_DEVICE_ID_SIANO_STELLAR),
55 .driver_data = SMS1XXX_BOARD_SIANO_STELLAR}, 55 .driver_data = SMS1XXX_BOARD_SIANO_STELLAR},
56 {SDIO_DEVICE(SDIO_VENDOR_ID_SIANO, SDIO_DEVICE_ID_SIANO_NOVA_A0), 56 {SDIO_DEVICE(SDIO_VENDOR_ID_SIANO, SDIO_DEVICE_ID_SIANO_NOVA_A0),
@@ -224,7 +224,7 @@ static void smssdio_interrupt(struct sdio_func *func)
224 smscore_onresponse(smsdev->coredev, cb); 224 smscore_onresponse(smsdev->coredev, cb);
225} 225}
226 226
227static int __devinit smssdio_probe(struct sdio_func *func, 227static int smssdio_probe(struct sdio_func *func,
228 const struct sdio_device_id *id) 228 const struct sdio_device_id *id)
229{ 229{
230 int ret; 230 int ret;
diff --git a/drivers/media/pci/bt8xx/bt878.c b/drivers/media/pci/bt8xx/bt878.c
index b34fa95185e4..66eb0baab0e9 100644
--- a/drivers/media/pci/bt8xx/bt878.c
+++ b/drivers/media/pci/bt8xx/bt878.c
@@ -391,7 +391,7 @@ EXPORT_SYMBOL(bt878_device_control);
391 .driver_data = (unsigned long) name \ 391 .driver_data = (unsigned long) name \
392 } 392 }
393 393
394static struct pci_device_id bt878_pci_tbl[] __devinitdata = { 394static struct pci_device_id bt878_pci_tbl[] = {
395 BROOKTREE_878_DEVICE(0x0071, 0x0101, "Nebula Electronics DigiTV"), 395 BROOKTREE_878_DEVICE(0x0071, 0x0101, "Nebula Electronics DigiTV"),
396 BROOKTREE_878_DEVICE(0x1461, 0x0761, "AverMedia AverTV DVB-T 761"), 396 BROOKTREE_878_DEVICE(0x1461, 0x0761, "AverMedia AverTV DVB-T 761"),
397 BROOKTREE_878_DEVICE(0x11bd, 0x001c, "Pinnacle PCTV Sat"), 397 BROOKTREE_878_DEVICE(0x11bd, 0x001c, "Pinnacle PCTV Sat"),
@@ -410,7 +410,7 @@ static struct pci_device_id bt878_pci_tbl[] __devinitdata = {
410 410
411MODULE_DEVICE_TABLE(pci, bt878_pci_tbl); 411MODULE_DEVICE_TABLE(pci, bt878_pci_tbl);
412 412
413static const char * __devinit card_name(const struct pci_device_id *id) 413static const char * card_name(const struct pci_device_id *id)
414{ 414{
415 return id->driver_data ? (const char *)id->driver_data : "Unknown"; 415 return id->driver_data ? (const char *)id->driver_data : "Unknown";
416} 416}
@@ -419,8 +419,7 @@ static const char * __devinit card_name(const struct pci_device_id *id)
419/* PCI device handling */ 419/* PCI device handling */
420/***********************/ 420/***********************/
421 421
422static int __devinit bt878_probe(struct pci_dev *dev, 422static int bt878_probe(struct pci_dev *dev, const struct pci_device_id *pci_id)
423 const struct pci_device_id *pci_id)
424{ 423{
425 int result = 0; 424 int result = 0;
426 unsigned char lat; 425 unsigned char lat;
@@ -529,7 +528,7 @@ static int __devinit bt878_probe(struct pci_dev *dev,
529 return result; 528 return result;
530} 529}
531 530
532static void __devexit bt878_remove(struct pci_dev *pci_dev) 531static void bt878_remove(struct pci_dev *pci_dev)
533{ 532{
534 u8 command; 533 u8 command;
535 struct bt878 *bt = pci_get_drvdata(pci_dev); 534 struct bt878 *bt = pci_get_drvdata(pci_dev);
@@ -573,7 +572,7 @@ static struct pci_driver bt878_pci_driver = {
573 .name = "bt878", 572 .name = "bt878",
574 .id_table = bt878_pci_tbl, 573 .id_table = bt878_pci_tbl,
575 .probe = bt878_probe, 574 .probe = bt878_probe,
576 .remove = __devexit_p(bt878_remove), 575 .remove = bt878_remove,
577}; 576};
578 577
579/*******************************/ 578/*******************************/
diff --git a/drivers/media/pci/bt8xx/bttv-cards.c b/drivers/media/pci/bt8xx/bttv-cards.c
index 38952faaffda..c4c59175e52c 100644
--- a/drivers/media/pci/bt8xx/bttv-cards.c
+++ b/drivers/media/pci/bt8xx/bttv-cards.c
@@ -87,7 +87,7 @@ static int tea5757_read(struct bttv *btv);
87static int tea5757_write(struct bttv *btv, int value); 87static int tea5757_write(struct bttv *btv, int value);
88static void identify_by_eeprom(struct bttv *btv, 88static void identify_by_eeprom(struct bttv *btv,
89 unsigned char eeprom_data[256]); 89 unsigned char eeprom_data[256]);
90static int __devinit pvr_boot(struct bttv *btv); 90static int pvr_boot(struct bttv *btv);
91 91
92/* config variables */ 92/* config variables */
93static unsigned int triton1; 93static unsigned int triton1;
@@ -151,7 +151,7 @@ static struct CARD {
151 unsigned id; 151 unsigned id;
152 int cardnr; 152 int cardnr;
153 char *name; 153 char *name;
154} cards[] __devinitdata = { 154} cards[] = {
155 { 0x13eb0070, BTTV_BOARD_HAUPPAUGE878, "Hauppauge WinTV" }, 155 { 0x13eb0070, BTTV_BOARD_HAUPPAUGE878, "Hauppauge WinTV" },
156 { 0x39000070, BTTV_BOARD_HAUPPAUGE878, "Hauppauge WinTV-D" }, 156 { 0x39000070, BTTV_BOARD_HAUPPAUGE878, "Hauppauge WinTV-D" },
157 { 0x45000070, BTTV_BOARD_HAUPPAUGEPVR, "Hauppauge WinTV/PVR" }, 157 { 0x45000070, BTTV_BOARD_HAUPPAUGEPVR, "Hauppauge WinTV/PVR" },
@@ -2837,7 +2837,7 @@ static unsigned char eeprom_data[256];
2837/* 2837/*
2838 * identify card 2838 * identify card
2839 */ 2839 */
2840void __devinit bttv_idcard(struct bttv *btv) 2840void bttv_idcard(struct bttv *btv)
2841{ 2841{
2842 unsigned int gpiobits; 2842 unsigned int gpiobits;
2843 int i,type; 2843 int i,type;
@@ -3235,7 +3235,7 @@ static void bttv_reset_audio(struct bttv *btv)
3235} 3235}
3236 3236
3237/* initialization part one -- before registering i2c bus */ 3237/* initialization part one -- before registering i2c bus */
3238void __devinit bttv_init_card1(struct bttv *btv) 3238void bttv_init_card1(struct bttv *btv)
3239{ 3239{
3240 switch (btv->c.type) { 3240 switch (btv->c.type) {
3241 case BTTV_BOARD_HAUPPAUGE: 3241 case BTTV_BOARD_HAUPPAUGE:
@@ -3267,7 +3267,7 @@ void __devinit bttv_init_card1(struct bttv *btv)
3267} 3267}
3268 3268
3269/* initialization part two -- after registering i2c bus */ 3269/* initialization part two -- after registering i2c bus */
3270void __devinit bttv_init_card2(struct bttv *btv) 3270void bttv_init_card2(struct bttv *btv)
3271{ 3271{
3272 btv->tuner_type = UNSET; 3272 btv->tuner_type = UNSET;
3273 3273
@@ -3571,7 +3571,7 @@ no_audio:
3571 3571
3572 3572
3573/* initialize the tuner */ 3573/* initialize the tuner */
3574void __devinit bttv_init_tuner(struct bttv *btv) 3574void bttv_init_tuner(struct bttv *btv)
3575{ 3575{
3576 int addr = ADDR_UNSET; 3576 int addr = ADDR_UNSET;
3577 3577
@@ -3635,7 +3635,7 @@ static void modtec_eeprom(struct bttv *btv)
3635 } 3635 }
3636} 3636}
3637 3637
3638static void __devinit hauppauge_eeprom(struct bttv *btv) 3638static void hauppauge_eeprom(struct bttv *btv)
3639{ 3639{
3640 struct tveeprom tv; 3640 struct tveeprom tv;
3641 3641
@@ -3709,8 +3709,7 @@ static int terratec_active_radio_upgrade(struct bttv *btv)
3709#define BTTV_ALT_DCLK 0x100000 3709#define BTTV_ALT_DCLK 0x100000
3710#define BTTV_ALT_NCONFIG 0x800000 3710#define BTTV_ALT_NCONFIG 0x800000
3711 3711
3712static int __devinit pvr_altera_load(struct bttv *btv, const u8 *micro, 3712static int pvr_altera_load(struct bttv *btv, const u8 *micro, u32 microlen)
3713 u32 microlen)
3714{ 3713{
3715 u32 n; 3714 u32 n;
3716 u8 bits; 3715 u8 bits;
@@ -3747,7 +3746,7 @@ static int __devinit pvr_altera_load(struct bttv *btv, const u8 *micro,
3747 return 0; 3746 return 0;
3748} 3747}
3749 3748
3750static int __devinit pvr_boot(struct bttv *btv) 3749static int pvr_boot(struct bttv *btv)
3751{ 3750{
3752 const struct firmware *fw_entry; 3751 const struct firmware *fw_entry;
3753 int rc; 3752 int rc;
@@ -3767,7 +3766,7 @@ static int __devinit pvr_boot(struct bttv *btv)
3767/* ----------------------------------------------------------------------- */ 3766/* ----------------------------------------------------------------------- */
3768/* some osprey specific stuff */ 3767/* some osprey specific stuff */
3769 3768
3770static void __devinit osprey_eeprom(struct bttv *btv, const u8 ee[256]) 3769static void osprey_eeprom(struct bttv *btv, const u8 ee[256])
3771{ 3770{
3772 int i; 3771 int i;
3773 u32 serial = 0; 3772 u32 serial = 0;
@@ -3898,7 +3897,7 @@ static int tuner_1_table[] = {
3898 TUNER_TEMIC_4012FY5, TUNER_TEMIC_4012FY5, /* TUNER_TEMIC_SECAM */ 3897 TUNER_TEMIC_4012FY5, TUNER_TEMIC_4012FY5, /* TUNER_TEMIC_SECAM */
3899 TUNER_TEMIC_4012FY5, TUNER_TEMIC_PAL}; 3898 TUNER_TEMIC_4012FY5, TUNER_TEMIC_PAL};
3900 3899
3901static void __devinit avermedia_eeprom(struct bttv *btv) 3900static void avermedia_eeprom(struct bttv *btv)
3902{ 3901{
3903 int tuner_make, tuner_tv_fm, tuner_format, tuner_type = 0; 3902 int tuner_make, tuner_tv_fm, tuner_format, tuner_type = 0;
3904 3903
@@ -3960,7 +3959,7 @@ u32 bttv_tda9880_setnorm(struct bttv *btv, u32 gpiobits)
3960 * Hauppauge: pin 5 3959 * Hauppauge: pin 5
3961 * Voodoo: pin 20 3960 * Voodoo: pin 20
3962 */ 3961 */
3963static void __devinit boot_msp34xx(struct bttv *btv, int pin) 3962static void boot_msp34xx(struct bttv *btv, int pin)
3964{ 3963{
3965 int mask = (1 << pin); 3964 int mask = (1 << pin);
3966 3965
@@ -3983,11 +3982,10 @@ static void __devinit boot_msp34xx(struct bttv *btv, int pin)
3983 * used by Alessandro Rubini in his pxc200 3982 * used by Alessandro Rubini in his pxc200
3984 * driver, but using BTTV functions */ 3983 * driver, but using BTTV functions */
3985 3984
3986static void __devinit init_PXC200(struct bttv *btv) 3985static void init_PXC200(struct bttv *btv)
3987{ 3986{
3988 static int vals[] __devinitdata = { 0x08, 0x09, 0x0a, 0x0b, 0x0d, 0x0d, 3987 static int vals[] = { 0x08, 0x09, 0x0a, 0x0b, 0x0d, 0x0d, 0x01, 0x02,
3989 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 3988 0x03, 0x04, 0x05, 0x06, 0x00 };
3990 0x00 };
3991 unsigned int i; 3989 unsigned int i;
3992 int tmp; 3990 int tmp;
3993 u32 val; 3991 u32 val;
@@ -4851,7 +4849,7 @@ void __init bttv_check_chipset(void)
4851 } 4849 }
4852} 4850}
4853 4851
4854int __devinit bttv_handle_chipset(struct bttv *btv) 4852int bttv_handle_chipset(struct bttv *btv)
4855{ 4853{
4856 unsigned char command; 4854 unsigned char command;
4857 4855
diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c
index de6f41f19187..45e5d0661b60 100644
--- a/drivers/media/pci/bt8xx/bttv-driver.c
+++ b/drivers/media/pci/bt8xx/bttv-driver.c
@@ -4199,7 +4199,7 @@ static void bttv_unregister_video(struct bttv *btv)
4199} 4199}
4200 4200
4201/* register video4linux devices */ 4201/* register video4linux devices */
4202static int __devinit bttv_register_video(struct bttv *btv) 4202static int bttv_register_video(struct bttv *btv)
4203{ 4203{
4204 if (no_overlay > 0) 4204 if (no_overlay > 0)
4205 pr_notice("Overlay support disabled\n"); 4205 pr_notice("Overlay support disabled\n");
@@ -4265,8 +4265,7 @@ static void pci_set_command(struct pci_dev *dev)
4265#endif 4265#endif
4266} 4266}
4267 4267
4268static int __devinit bttv_probe(struct pci_dev *dev, 4268static int bttv_probe(struct pci_dev *dev, const struct pci_device_id *pci_id)
4269 const struct pci_device_id *pci_id)
4270{ 4269{
4271 int result; 4270 int result;
4272 unsigned char lat; 4271 unsigned char lat;
@@ -4454,7 +4453,7 @@ fail0:
4454 return result; 4453 return result;
4455} 4454}
4456 4455
4457static void __devexit bttv_remove(struct pci_dev *pci_dev) 4456static void bttv_remove(struct pci_dev *pci_dev)
4458{ 4457{
4459 struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev); 4458 struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev);
4460 struct bttv *btv = to_bttv(v4l2_dev); 4459 struct bttv *btv = to_bttv(v4l2_dev);
@@ -4598,7 +4597,7 @@ static struct pci_driver bttv_pci_driver = {
4598 .name = "bttv", 4597 .name = "bttv",
4599 .id_table = bttv_pci_tbl, 4598 .id_table = bttv_pci_tbl,
4600 .probe = bttv_probe, 4599 .probe = bttv_probe,
4601 .remove = __devexit_p(bttv_remove), 4600 .remove = bttv_remove,
4602#ifdef CONFIG_PM 4601#ifdef CONFIG_PM
4603 .suspend = bttv_suspend, 4602 .suspend = bttv_suspend,
4604 .resume = bttv_resume, 4603 .resume = bttv_resume,
diff --git a/drivers/media/pci/bt8xx/bttv-i2c.c b/drivers/media/pci/bt8xx/bttv-i2c.c
index 580c8e682392..5039b8826e0a 100644
--- a/drivers/media/pci/bt8xx/bttv-i2c.c
+++ b/drivers/media/pci/bt8xx/bttv-i2c.c
@@ -99,7 +99,7 @@ static int bttv_bit_getsda(void *data)
99 return state; 99 return state;
100} 100}
101 101
102static struct i2c_algo_bit_data __devinitdata bttv_i2c_algo_bit_template = { 102static struct i2c_algo_bit_data bttv_i2c_algo_bit_template = {
103 .setsda = bttv_bit_setsda, 103 .setsda = bttv_bit_setsda,
104 .setscl = bttv_bit_setscl, 104 .setscl = bttv_bit_setscl,
105 .getsda = bttv_bit_getsda, 105 .getsda = bttv_bit_getsda,
@@ -312,7 +312,7 @@ int bttv_I2CWrite(struct bttv *btv, unsigned char addr, unsigned char b1,
312} 312}
313 313
314/* read EEPROM content */ 314/* read EEPROM content */
315void __devinit bttv_readee(struct bttv *btv, unsigned char *eedata, int addr) 315void bttv_readee(struct bttv *btv, unsigned char *eedata, int addr)
316{ 316{
317 memset(eedata, 0, 256); 317 memset(eedata, 0, 256);
318 if (0 != btv->i2c_rc) 318 if (0 != btv->i2c_rc)
@@ -347,7 +347,7 @@ static void do_i2c_scan(char *name, struct i2c_client *c)
347} 347}
348 348
349/* init + register i2c adapter */ 349/* init + register i2c adapter */
350int __devinit init_bttv_i2c(struct bttv *btv) 350int init_bttv_i2c(struct bttv *btv)
351{ 351{
352 strlcpy(btv->i2c_client.name, "bttv internal", I2C_NAME_SIZE); 352 strlcpy(btv->i2c_client.name, "bttv internal", I2C_NAME_SIZE);
353 353
diff --git a/drivers/media/pci/bt8xx/bttv-input.c b/drivers/media/pci/bt8xx/bttv-input.c
index ef4c7cd41982..04207a799055 100644
--- a/drivers/media/pci/bt8xx/bttv-input.c
+++ b/drivers/media/pci/bt8xx/bttv-input.c
@@ -368,7 +368,7 @@ static int get_key_pv951(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
368} 368}
369 369
370/* Instantiate the I2C IR receiver device, if present */ 370/* Instantiate the I2C IR receiver device, if present */
371void __devinit init_bttv_i2c_ir(struct bttv *btv) 371void init_bttv_i2c_ir(struct bttv *btv)
372{ 372{
373 const unsigned short addr_list[] = { 373 const unsigned short addr_list[] = {
374 0x1a, 0x18, 0x64, 0x30, 0x71, 374 0x1a, 0x18, 0x64, 0x30, 0x71,
@@ -411,7 +411,7 @@ void __devinit init_bttv_i2c_ir(struct bttv *btv)
411 return; 411 return;
412} 412}
413 413
414int __devexit fini_bttv_i2c(struct bttv *btv) 414int fini_bttv_i2c(struct bttv *btv)
415{ 415{
416 if (0 != btv->i2c_rc) 416 if (0 != btv->i2c_rc)
417 return 0; 417 return 0;
diff --git a/drivers/media/pci/bt8xx/dvb-bt8xx.c b/drivers/media/pci/bt8xx/dvb-bt8xx.c
index 81fab9adc1ca..d407244fd1bc 100644
--- a/drivers/media/pci/bt8xx/dvb-bt8xx.c
+++ b/drivers/media/pci/bt8xx/dvb-bt8xx.c
@@ -118,7 +118,8 @@ static int is_pci_slot_eq(struct pci_dev* adev, struct pci_dev* bdev)
118 return 0; 118 return 0;
119} 119}
120 120
121static struct bt878 __devinit *dvb_bt8xx_878_match(unsigned int bttv_nr, struct pci_dev* bttv_pci_dev) 121static struct bt878 *dvb_bt8xx_878_match(unsigned int bttv_nr,
122 struct pci_dev* bttv_pci_dev)
122{ 123{
123 unsigned int card_nr; 124 unsigned int card_nr;
124 125
@@ -720,7 +721,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type)
720 } 721 }
721} 722}
722 723
723static int __devinit dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type) 724static int dvb_bt8xx_load_card(struct dvb_bt8xx_card *card, u32 type)
724{ 725{
725 int result; 726 int result;
726 727
@@ -811,7 +812,7 @@ err_unregister_adaptor:
811 return result; 812 return result;
812} 813}
813 814
814static int __devinit dvb_bt8xx_probe(struct bttv_sub_device *sub) 815static int dvb_bt8xx_probe(struct bttv_sub_device *sub)
815{ 816{
816 struct dvb_bt8xx_card *card; 817 struct dvb_bt8xx_card *card;
817 struct pci_dev* bttv_pci_dev; 818 struct pci_dev* bttv_pci_dev;
diff --git a/drivers/media/pci/cx18/cx18-driver.c b/drivers/media/pci/cx18/cx18-driver.c
index 039133d692e3..613e5ae7d5ca 100644
--- a/drivers/media/pci/cx18/cx18-driver.c
+++ b/drivers/media/pci/cx18/cx18-driver.c
@@ -53,7 +53,7 @@ int (*cx18_ext_init)(struct cx18 *);
53EXPORT_SYMBOL(cx18_ext_init); 53EXPORT_SYMBOL(cx18_ext_init);
54 54
55/* add your revision and whatnot here */ 55/* add your revision and whatnot here */
56static struct pci_device_id cx18_pci_tbl[] __devinitdata = { 56static struct pci_device_id cx18_pci_tbl[] = {
57 {PCI_VENDOR_ID_CX, PCI_DEVICE_ID_CX23418, 57 {PCI_VENDOR_ID_CX, PCI_DEVICE_ID_CX23418,
58 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 58 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
59 {0,} 59 {0,}
@@ -691,7 +691,7 @@ done:
691 cx->card_i2c = cx->card->i2c; 691 cx->card_i2c = cx->card->i2c;
692} 692}
693 693
694static int __devinit cx18_create_in_workq(struct cx18 *cx) 694static int cx18_create_in_workq(struct cx18 *cx)
695{ 695{
696 snprintf(cx->in_workq_name, sizeof(cx->in_workq_name), "%s-in", 696 snprintf(cx->in_workq_name, sizeof(cx->in_workq_name), "%s-in",
697 cx->v4l2_dev.name); 697 cx->v4l2_dev.name);
@@ -703,7 +703,7 @@ static int __devinit cx18_create_in_workq(struct cx18 *cx)
703 return 0; 703 return 0;
704} 704}
705 705
706static void __devinit cx18_init_in_work_orders(struct cx18 *cx) 706static void cx18_init_in_work_orders(struct cx18 *cx)
707{ 707{
708 int i; 708 int i;
709 for (i = 0; i < CX18_MAX_IN_WORK_ORDERS; i++) { 709 for (i = 0; i < CX18_MAX_IN_WORK_ORDERS; i++) {
@@ -718,7 +718,7 @@ static void __devinit cx18_init_in_work_orders(struct cx18 *cx)
718 No assumptions on the card type may be made here (see cx18_init_struct2 718 No assumptions on the card type may be made here (see cx18_init_struct2
719 for that). 719 for that).
720 */ 720 */
721static int __devinit cx18_init_struct1(struct cx18 *cx) 721static int cx18_init_struct1(struct cx18 *cx)
722{ 722{
723 int ret; 723 int ret;
724 724
@@ -775,7 +775,7 @@ static int __devinit cx18_init_struct1(struct cx18 *cx)
775 775
776/* Second initialization part. Here the card type has been 776/* Second initialization part. Here the card type has been
777 autodetected. */ 777 autodetected. */
778static void __devinit cx18_init_struct2(struct cx18 *cx) 778static void cx18_init_struct2(struct cx18 *cx)
779{ 779{
780 int i; 780 int i;
781 781
@@ -892,8 +892,8 @@ static void cx18_init_subdevs(struct cx18 *cx)
892 cx->sd_extmux = cx18_find_hw(cx, cx->card->hw_muxer); 892 cx->sd_extmux = cx18_find_hw(cx, cx->card->hw_muxer);
893} 893}
894 894
895static int __devinit cx18_probe(struct pci_dev *pci_dev, 895static int cx18_probe(struct pci_dev *pci_dev,
896 const struct pci_device_id *pci_id) 896 const struct pci_device_id *pci_id)
897{ 897{
898 int retval = 0; 898 int retval = 0;
899 int i; 899 int i;
diff --git a/drivers/media/pci/cx23885/cx23885-core.c b/drivers/media/pci/cx23885/cx23885-core.c
index 065ecd54bda3..f0416a668b4c 100644
--- a/drivers/media/pci/cx23885/cx23885-core.c
+++ b/drivers/media/pci/cx23885/cx23885-core.c
@@ -2086,8 +2086,8 @@ void cx23885_gpio_enable(struct cx23885_dev *dev, u32 mask, int asoutput)
2086 /* TODO: 23-19 */ 2086 /* TODO: 23-19 */
2087} 2087}
2088 2088
2089static int __devinit cx23885_initdev(struct pci_dev *pci_dev, 2089static int cx23885_initdev(struct pci_dev *pci_dev,
2090 const struct pci_device_id *pci_id) 2090 const struct pci_device_id *pci_id)
2091{ 2091{
2092 struct cx23885_dev *dev; 2092 struct cx23885_dev *dev;
2093 int err; 2093 int err;
@@ -2167,7 +2167,7 @@ fail_free:
2167 return err; 2167 return err;
2168} 2168}
2169 2169
2170static void __devexit cx23885_finidev(struct pci_dev *pci_dev) 2170static void cx23885_finidev(struct pci_dev *pci_dev)
2171{ 2171{
2172 struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev); 2172 struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev);
2173 struct cx23885_dev *dev = to_cx23885(v4l2_dev); 2173 struct cx23885_dev *dev = to_cx23885(v4l2_dev);
@@ -2210,7 +2210,7 @@ static struct pci_driver cx23885_pci_driver = {
2210 .name = "cx23885", 2210 .name = "cx23885",
2211 .id_table = cx23885_pci_tbl, 2211 .id_table = cx23885_pci_tbl,
2212 .probe = cx23885_initdev, 2212 .probe = cx23885_initdev,
2213 .remove = __devexit_p(cx23885_finidev), 2213 .remove = cx23885_finidev,
2214 /* TODO */ 2214 /* TODO */
2215 .suspend = NULL, 2215 .suspend = NULL,
2216 .resume = NULL, 2216 .resume = NULL,
diff --git a/drivers/media/pci/cx25821/cx25821-core.c b/drivers/media/pci/cx25821/cx25821-core.c
index f11f6f07e915..1884e2cc35e9 100644
--- a/drivers/media/pci/cx25821/cx25821-core.c
+++ b/drivers/media/pci/cx25821/cx25821-core.c
@@ -1361,8 +1361,8 @@ struct cx25821_dev *cx25821_dev_get(struct pci_dev *pci)
1361} 1361}
1362EXPORT_SYMBOL(cx25821_dev_get); 1362EXPORT_SYMBOL(cx25821_dev_get);
1363 1363
1364static int __devinit cx25821_initdev(struct pci_dev *pci_dev, 1364static int cx25821_initdev(struct pci_dev *pci_dev,
1365 const struct pci_device_id *pci_id) 1365 const struct pci_device_id *pci_id)
1366{ 1366{
1367 struct cx25821_dev *dev; 1367 struct cx25821_dev *dev;
1368 int err = 0; 1368 int err = 0;
@@ -1433,7 +1433,7 @@ fail_free:
1433 return err; 1433 return err;
1434} 1434}
1435 1435
1436static void __devexit cx25821_finidev(struct pci_dev *pci_dev) 1436static void cx25821_finidev(struct pci_dev *pci_dev)
1437{ 1437{
1438 struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev); 1438 struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev);
1439 struct cx25821_dev *dev = get_cx25821(v4l2_dev); 1439 struct cx25821_dev *dev = get_cx25821(v4l2_dev);
@@ -1478,7 +1478,7 @@ static struct pci_driver cx25821_pci_driver = {
1478 .name = "cx25821", 1478 .name = "cx25821",
1479 .id_table = cx25821_pci_tbl, 1479 .id_table = cx25821_pci_tbl,
1480 .probe = cx25821_initdev, 1480 .probe = cx25821_initdev,
1481 .remove = __devexit_p(cx25821_finidev), 1481 .remove = cx25821_finidev,
1482 /* TODO */ 1482 /* TODO */
1483 .suspend = NULL, 1483 .suspend = NULL,
1484 .resume = NULL, 1484 .resume = NULL,
diff --git a/drivers/media/pci/cx88/cx88-alsa.c b/drivers/media/pci/cx88/cx88-alsa.c
index d2de1a913e19..27d62623274b 100644
--- a/drivers/media/pci/cx88/cx88-alsa.c
+++ b/drivers/media/pci/cx88/cx88-alsa.c
@@ -540,7 +540,7 @@ static struct snd_pcm_ops snd_cx88_pcm_ops = {
540/* 540/*
541 * create a PCM device 541 * create a PCM device
542 */ 542 */
543static int __devinit snd_cx88_pcm(snd_cx88_card_t *chip, int device, const char *name) 543static int snd_cx88_pcm(snd_cx88_card_t *chip, int device, const char *name)
544{ 544{
545 int err; 545 int err;
546 struct snd_pcm *pcm; 546 struct snd_pcm *pcm;
@@ -753,7 +753,7 @@ static struct snd_kcontrol_new snd_cx88_alc_switch = {
753 * Only boards with eeprom and byte 1 at eeprom=1 have it 753 * Only boards with eeprom and byte 1 at eeprom=1 have it
754 */ 754 */
755 755
756static const struct pci_device_id cx88_audio_pci_tbl[] __devinitdata = { 756static const struct pci_device_id cx88_audio_pci_tbl[] = {
757 {0x14f1,0x8801,PCI_ANY_ID,PCI_ANY_ID,0,0,0}, 757 {0x14f1,0x8801,PCI_ANY_ID,PCI_ANY_ID,0,0,0},
758 {0x14f1,0x8811,PCI_ANY_ID,PCI_ANY_ID,0,0,0}, 758 {0x14f1,0x8811,PCI_ANY_ID,PCI_ANY_ID,0,0,0},
759 {0, } 759 {0, }
@@ -792,10 +792,9 @@ static void snd_cx88_dev_free(struct snd_card * card)
792 */ 792 */
793 793
794static int devno; 794static int devno;
795static int __devinit snd_cx88_create(struct snd_card *card, 795static int snd_cx88_create(struct snd_card *card, struct pci_dev *pci,
796 struct pci_dev *pci, 796 snd_cx88_card_t **rchip,
797 snd_cx88_card_t **rchip, 797 struct cx88_core **core_ptr)
798 struct cx88_core **core_ptr)
799{ 798{
800 snd_cx88_card_t *chip; 799 snd_cx88_card_t *chip;
801 struct cx88_core *core; 800 struct cx88_core *core;
@@ -862,8 +861,8 @@ static int __devinit snd_cx88_create(struct snd_card *card,
862 return 0; 861 return 0;
863} 862}
864 863
865static int __devinit cx88_audio_initdev(struct pci_dev *pci, 864static int cx88_audio_initdev(struct pci_dev *pci,
866 const struct pci_device_id *pci_id) 865 const struct pci_device_id *pci_id)
867{ 866{
868 struct snd_card *card; 867 struct snd_card *card;
869 snd_cx88_card_t *chip; 868 snd_cx88_card_t *chip;
@@ -931,7 +930,7 @@ error:
931/* 930/*
932 * ALSA destructor 931 * ALSA destructor
933 */ 932 */
934static void __devexit cx88_audio_finidev(struct pci_dev *pci) 933static void cx88_audio_finidev(struct pci_dev *pci)
935{ 934{
936 struct cx88_audio_dev *card = pci_get_drvdata(pci); 935 struct cx88_audio_dev *card = pci_get_drvdata(pci);
937 936
@@ -950,7 +949,7 @@ static struct pci_driver cx88_audio_pci_driver = {
950 .name = "cx88_audio", 949 .name = "cx88_audio",
951 .id_table = cx88_audio_pci_tbl, 950 .id_table = cx88_audio_pci_tbl,
952 .probe = cx88_audio_initdev, 951 .probe = cx88_audio_initdev,
953 .remove = __devexit_p(cx88_audio_finidev), 952 .remove = cx88_audio_finidev,
954}; 953};
955 954
956/**************************************************************************** 955/****************************************************************************
diff --git a/drivers/media/pci/cx88/cx88-mpeg.c b/drivers/media/pci/cx88/cx88-mpeg.c
index d46b008a46b8..c9d3182f79d5 100644
--- a/drivers/media/pci/cx88/cx88-mpeg.c
+++ b/drivers/media/pci/cx88/cx88-mpeg.c
@@ -791,8 +791,8 @@ int cx8802_unregister_driver(struct cx8802_driver *drv)
791} 791}
792 792
793/* ----------------------------------------------------------- */ 793/* ----------------------------------------------------------- */
794static int __devinit cx8802_probe(struct pci_dev *pci_dev, 794static int cx8802_probe(struct pci_dev *pci_dev,
795 const struct pci_device_id *pci_id) 795 const struct pci_device_id *pci_id)
796{ 796{
797 struct cx8802_dev *dev; 797 struct cx8802_dev *dev;
798 struct cx88_core *core; 798 struct cx88_core *core;
@@ -840,7 +840,7 @@ static int __devinit cx8802_probe(struct pci_dev *pci_dev,
840 return err; 840 return err;
841} 841}
842 842
843static void __devexit cx8802_remove(struct pci_dev *pci_dev) 843static void cx8802_remove(struct pci_dev *pci_dev)
844{ 844{
845 struct cx8802_dev *dev; 845 struct cx8802_dev *dev;
846 846
@@ -898,7 +898,7 @@ static struct pci_driver cx8802_pci_driver = {
898 .name = "cx88-mpeg driver manager", 898 .name = "cx88-mpeg driver manager",
899 .id_table = cx8802_pci_tbl, 899 .id_table = cx8802_pci_tbl,
900 .probe = cx8802_probe, 900 .probe = cx8802_probe,
901 .remove = __devexit_p(cx8802_remove), 901 .remove = cx8802_remove,
902}; 902};
903 903
904static int __init cx8802_init(void) 904static int __init cx8802_init(void)
diff --git a/drivers/media/pci/cx88/cx88-video.c b/drivers/media/pci/cx88/cx88-video.c
index 05171457bf28..bc78354262ac 100644
--- a/drivers/media/pci/cx88/cx88-video.c
+++ b/drivers/media/pci/cx88/cx88-video.c
@@ -1696,8 +1696,8 @@ static void cx8800_unregister_video(struct cx8800_dev *dev)
1696 } 1696 }
1697} 1697}
1698 1698
1699static int __devinit cx8800_initdev(struct pci_dev *pci_dev, 1699static int cx8800_initdev(struct pci_dev *pci_dev,
1700 const struct pci_device_id *pci_id) 1700 const struct pci_device_id *pci_id)
1701{ 1701{
1702 struct cx8800_dev *dev; 1702 struct cx8800_dev *dev;
1703 struct cx88_core *core; 1703 struct cx88_core *core;
@@ -1923,7 +1923,7 @@ fail_free:
1923 return err; 1923 return err;
1924} 1924}
1925 1925
1926static void __devexit cx8800_finidev(struct pci_dev *pci_dev) 1926static void cx8800_finidev(struct pci_dev *pci_dev)
1927{ 1927{
1928 struct cx8800_dev *dev = pci_get_drvdata(pci_dev); 1928 struct cx8800_dev *dev = pci_get_drvdata(pci_dev);
1929 struct cx88_core *core = dev->core; 1929 struct cx88_core *core = dev->core;
@@ -2052,7 +2052,7 @@ static struct pci_driver cx8800_pci_driver = {
2052 .name = "cx8800", 2052 .name = "cx8800",
2053 .id_table = cx8800_pci_tbl, 2053 .id_table = cx8800_pci_tbl,
2054 .probe = cx8800_initdev, 2054 .probe = cx8800_initdev,
2055 .remove = __devexit_p(cx8800_finidev), 2055 .remove = cx8800_finidev,
2056#ifdef CONFIG_PM 2056#ifdef CONFIG_PM
2057 .suspend = cx8800_suspend, 2057 .suspend = cx8800_suspend,
2058 .resume = cx8800_resume, 2058 .resume = cx8800_resume,
diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c
index feff57ee5a08..36e34522b9a8 100644
--- a/drivers/media/pci/ddbridge/ddbridge-core.c
+++ b/drivers/media/pci/ddbridge/ddbridge-core.c
@@ -1542,7 +1542,7 @@ static void ddb_unmap(struct ddb *dev)
1542} 1542}
1543 1543
1544 1544
1545static void __devexit ddb_remove(struct pci_dev *pdev) 1545static void ddb_remove(struct pci_dev *pdev)
1546{ 1546{
1547 struct ddb *dev = (struct ddb *) pci_get_drvdata(pdev); 1547 struct ddb *dev = (struct ddb *) pci_get_drvdata(pdev);
1548 1548
@@ -1565,8 +1565,7 @@ static void __devexit ddb_remove(struct pci_dev *pdev)
1565} 1565}
1566 1566
1567 1567
1568static int __devinit ddb_probe(struct pci_dev *pdev, 1568static int ddb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1569 const struct pci_device_id *id)
1570{ 1569{
1571 struct ddb *dev; 1570 struct ddb *dev;
1572 int stat = 0; 1571 int stat = 0;
@@ -1679,7 +1678,7 @@ static struct ddb_info ddb_v6 = {
1679 .subvendor = _subvend, .subdevice = _subdev, \ 1678 .subvendor = _subvend, .subdevice = _subdev, \
1680 .driver_data = (unsigned long)&_driverdata } 1679 .driver_data = (unsigned long)&_driverdata }
1681 1680
1682static const struct pci_device_id ddb_id_tbl[] __devinitdata = { 1681static const struct pci_device_id ddb_id_tbl[] = {
1683 DDB_ID(DDVID, 0x0002, DDVID, 0x0001, ddb_octopus), 1682 DDB_ID(DDVID, 0x0002, DDVID, 0x0001, ddb_octopus),
1684 DDB_ID(DDVID, 0x0003, DDVID, 0x0001, ddb_octopus), 1683 DDB_ID(DDVID, 0x0003, DDVID, 0x0001, ddb_octopus),
1685 DDB_ID(DDVID, 0x0003, DDVID, 0x0002, ddb_octopus_le), 1684 DDB_ID(DDVID, 0x0003, DDVID, 0x0002, ddb_octopus_le),
@@ -1696,7 +1695,7 @@ static struct pci_driver ddb_pci_driver = {
1696 .name = "DDBridge", 1695 .name = "DDBridge",
1697 .id_table = ddb_id_tbl, 1696 .id_table = ddb_id_tbl,
1698 .probe = ddb_probe, 1697 .probe = ddb_probe,
1699 .remove = __devexit_p(ddb_remove), 1698 .remove = ddb_remove,
1700}; 1699};
1701 1700
1702static __init int module_init_ddbridge(void) 1701static __init int module_init_ddbridge(void)
diff --git a/drivers/media/pci/dm1105/dm1105.c b/drivers/media/pci/dm1105/dm1105.c
index f288ffcc4b6b..904c3ea350f5 100644
--- a/drivers/media/pci/dm1105/dm1105.c
+++ b/drivers/media/pci/dm1105/dm1105.c
@@ -616,7 +616,7 @@ static void dm1105_set_dma_addr(struct dm1105_dev *dev)
616 dm_writel(DM1105_STADR, cpu_to_le32(dev->dma_addr)); 616 dm_writel(DM1105_STADR, cpu_to_le32(dev->dma_addr));
617} 617}
618 618
619static int __devinit dm1105_dma_map(struct dm1105_dev *dev) 619static int dm1105_dma_map(struct dm1105_dev *dev)
620{ 620{
621 dev->ts_buf = pci_alloc_consistent(dev->pdev, 621 dev->ts_buf = pci_alloc_consistent(dev->pdev,
622 6 * DM1105_DMA_BYTES, 622 6 * DM1105_DMA_BYTES,
@@ -736,7 +736,7 @@ static irqreturn_t dm1105_irq(int irq, void *dev_id)
736 return IRQ_HANDLED; 736 return IRQ_HANDLED;
737} 737}
738 738
739static int __devinit dm1105_ir_init(struct dm1105_dev *dm1105) 739static int dm1105_ir_init(struct dm1105_dev *dm1105)
740{ 740{
741 struct rc_dev *dev; 741 struct rc_dev *dev;
742 int err = -ENOMEM; 742 int err = -ENOMEM;
@@ -776,12 +776,12 @@ static int __devinit dm1105_ir_init(struct dm1105_dev *dm1105)
776 return 0; 776 return 0;
777} 777}
778 778
779static void __devexit dm1105_ir_exit(struct dm1105_dev *dm1105) 779static void dm1105_ir_exit(struct dm1105_dev *dm1105)
780{ 780{
781 rc_unregister_device(dm1105->ir.dev); 781 rc_unregister_device(dm1105->ir.dev);
782} 782}
783 783
784static int __devinit dm1105_hw_init(struct dm1105_dev *dev) 784static int dm1105_hw_init(struct dm1105_dev *dev)
785{ 785{
786 dm1105_disable_irqs(dev); 786 dm1105_disable_irqs(dev);
787 787
@@ -849,7 +849,7 @@ static struct ds3000_config dvbworld_ds3000_config = {
849 .demod_address = 0x68, 849 .demod_address = 0x68,
850}; 850};
851 851
852static int __devinit frontend_init(struct dm1105_dev *dev) 852static int frontend_init(struct dm1105_dev *dev)
853{ 853{
854 int ret; 854 int ret;
855 855
@@ -949,7 +949,7 @@ static int __devinit frontend_init(struct dm1105_dev *dev)
949 return 0; 949 return 0;
950} 950}
951 951
952static void __devinit dm1105_read_mac(struct dm1105_dev *dev, u8 *mac) 952static void dm1105_read_mac(struct dm1105_dev *dev, u8 *mac)
953{ 953{
954 static u8 command[1] = { 0x28 }; 954 static u8 command[1] = { 0x28 };
955 955
@@ -971,7 +971,7 @@ static void __devinit dm1105_read_mac(struct dm1105_dev *dev, u8 *mac)
971 dev_info(&dev->pdev->dev, "MAC %pM\n", mac); 971 dev_info(&dev->pdev->dev, "MAC %pM\n", mac);
972} 972}
973 973
974static int __devinit dm1105_probe(struct pci_dev *pdev, 974static int dm1105_probe(struct pci_dev *pdev,
975 const struct pci_device_id *ent) 975 const struct pci_device_id *ent)
976{ 976{
977 struct dm1105_dev *dev; 977 struct dm1105_dev *dev;
@@ -1174,7 +1174,7 @@ err_kfree:
1174 return ret; 1174 return ret;
1175} 1175}
1176 1176
1177static void __devexit dm1105_remove(struct pci_dev *pdev) 1177static void dm1105_remove(struct pci_dev *pdev)
1178{ 1178{
1179 struct dm1105_dev *dev = pci_get_drvdata(pdev); 1179 struct dm1105_dev *dev = pci_get_drvdata(pdev);
1180 struct dvb_adapter *dvb_adapter = &dev->dvb_adapter; 1180 struct dvb_adapter *dvb_adapter = &dev->dvb_adapter;
@@ -1207,7 +1207,7 @@ static void __devexit dm1105_remove(struct pci_dev *pdev)
1207 kfree(dev); 1207 kfree(dev);
1208} 1208}
1209 1209
1210static struct pci_device_id dm1105_id_table[] __devinitdata = { 1210static struct pci_device_id dm1105_id_table[] = {
1211 { 1211 {
1212 .vendor = PCI_VENDOR_ID_TRIGEM, 1212 .vendor = PCI_VENDOR_ID_TRIGEM,
1213 .device = PCI_DEVICE_ID_DM1105, 1213 .device = PCI_DEVICE_ID_DM1105,
@@ -1229,7 +1229,7 @@ static struct pci_driver dm1105_driver = {
1229 .name = DRIVER_NAME, 1229 .name = DRIVER_NAME,
1230 .id_table = dm1105_id_table, 1230 .id_table = dm1105_id_table,
1231 .probe = dm1105_probe, 1231 .probe = dm1105_probe,
1232 .remove = __devexit_p(dm1105_remove), 1232 .remove = dm1105_remove,
1233}; 1233};
1234 1234
1235static int __init dm1105_init(void) 1235static int __init dm1105_init(void)
diff --git a/drivers/media/pci/ivtv/ivtv-driver.c b/drivers/media/pci/ivtv/ivtv-driver.c
index 74e9a5032364..df88dc4ab555 100644
--- a/drivers/media/pci/ivtv/ivtv-driver.c
+++ b/drivers/media/pci/ivtv/ivtv-driver.c
@@ -73,7 +73,7 @@ int (*ivtv_ext_init)(struct ivtv *);
73EXPORT_SYMBOL(ivtv_ext_init); 73EXPORT_SYMBOL(ivtv_ext_init);
74 74
75/* add your revision and whatnot here */ 75/* add your revision and whatnot here */
76static struct pci_device_id ivtv_pci_tbl[] __devinitdata = { 76static struct pci_device_id ivtv_pci_tbl[] = {
77 {PCI_VENDOR_ID_ICOMP, PCI_DEVICE_ID_IVTV15, 77 {PCI_VENDOR_ID_ICOMP, PCI_DEVICE_ID_IVTV15,
78 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 78 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
79 {PCI_VENDOR_ID_ICOMP, PCI_DEVICE_ID_IVTV16, 79 {PCI_VENDOR_ID_ICOMP, PCI_DEVICE_ID_IVTV16,
@@ -736,7 +736,7 @@ done:
736 No assumptions on the card type may be made here (see ivtv_init_struct2 736 No assumptions on the card type may be made here (see ivtv_init_struct2
737 for that). 737 for that).
738 */ 738 */
739static int __devinit ivtv_init_struct1(struct ivtv *itv) 739static int ivtv_init_struct1(struct ivtv *itv)
740{ 740{
741 struct sched_param param = { .sched_priority = 99 }; 741 struct sched_param param = { .sched_priority = 99 };
742 742
@@ -802,7 +802,7 @@ static int __devinit ivtv_init_struct1(struct ivtv *itv)
802 802
803/* Second initialization part. Here the card type has been 803/* Second initialization part. Here the card type has been
804 autodetected. */ 804 autodetected. */
805static void __devinit ivtv_init_struct2(struct ivtv *itv) 805static void ivtv_init_struct2(struct ivtv *itv)
806{ 806{
807 int i; 807 int i;
808 808
@@ -1001,8 +1001,7 @@ static void ivtv_load_and_init_modules(struct ivtv *itv)
1001 } 1001 }
1002} 1002}
1003 1003
1004static int __devinit ivtv_probe(struct pci_dev *pdev, 1004static int ivtv_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
1005 const struct pci_device_id *pci_id)
1006{ 1005{
1007 int retval = 0; 1006 int retval = 0;
1008 int vbi_buf_size; 1007 int vbi_buf_size;
diff --git a/drivers/media/pci/mantis/hopper_cards.c b/drivers/media/pci/mantis/hopper_cards.c
index cc0251e01077..6fe9fe5293dc 100644
--- a/drivers/media/pci/mantis/hopper_cards.c
+++ b/drivers/media/pci/mantis/hopper_cards.c
@@ -151,7 +151,8 @@ static irqreturn_t hopper_irq_handler(int irq, void *dev_id)
151 return IRQ_HANDLED; 151 return IRQ_HANDLED;
152} 152}
153 153
154static int __devinit hopper_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) 154static int hopper_pci_probe(struct pci_dev *pdev,
155 const struct pci_device_id *pci_id)
155{ 156{
156 struct mantis_pci *mantis; 157 struct mantis_pci *mantis;
157 struct mantis_hwconfig *config; 158 struct mantis_hwconfig *config;
@@ -230,7 +231,7 @@ fail0:
230 return err; 231 return err;
231} 232}
232 233
233static void __devexit hopper_pci_remove(struct pci_dev *pdev) 234static void hopper_pci_remove(struct pci_dev *pdev)
234{ 235{
235 struct mantis_pci *mantis = pci_get_drvdata(pdev); 236 struct mantis_pci *mantis = pci_get_drvdata(pdev);
236 237
@@ -259,12 +260,12 @@ static struct pci_driver hopper_pci_driver = {
259 .remove = hopper_pci_remove, 260 .remove = hopper_pci_remove,
260}; 261};
261 262
262static int __devinit hopper_init(void) 263static int hopper_init(void)
263{ 264{
264 return pci_register_driver(&hopper_pci_driver); 265 return pci_register_driver(&hopper_pci_driver);
265} 266}
266 267
267static void __devexit hopper_exit(void) 268static void hopper_exit(void)
268{ 269{
269 return pci_unregister_driver(&hopper_pci_driver); 270 return pci_unregister_driver(&hopper_pci_driver);
270} 271}
diff --git a/drivers/media/pci/mantis/mantis_cards.c b/drivers/media/pci/mantis/mantis_cards.c
index 0207d1f064e0..932a0d73a7f8 100644
--- a/drivers/media/pci/mantis/mantis_cards.c
+++ b/drivers/media/pci/mantis/mantis_cards.c
@@ -159,7 +159,8 @@ static irqreturn_t mantis_irq_handler(int irq, void *dev_id)
159 return IRQ_HANDLED; 159 return IRQ_HANDLED;
160} 160}
161 161
162static int __devinit mantis_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) 162static int mantis_pci_probe(struct pci_dev *pdev,
163 const struct pci_device_id *pci_id)
163{ 164{
164 struct mantis_pci *mantis; 165 struct mantis_pci *mantis;
165 struct mantis_hwconfig *config; 166 struct mantis_hwconfig *config;
@@ -249,7 +250,7 @@ fail0:
249 return err; 250 return err;
250} 251}
251 252
252static void __devexit mantis_pci_remove(struct pci_dev *pdev) 253static void mantis_pci_remove(struct pci_dev *pdev)
253{ 254{
254 struct mantis_pci *mantis = pci_get_drvdata(pdev); 255 struct mantis_pci *mantis = pci_get_drvdata(pdev);
255 256
@@ -289,12 +290,12 @@ static struct pci_driver mantis_pci_driver = {
289 .remove = mantis_pci_remove, 290 .remove = mantis_pci_remove,
290}; 291};
291 292
292static int __devinit mantis_init(void) 293static int mantis_init(void)
293{ 294{
294 return pci_register_driver(&mantis_pci_driver); 295 return pci_register_driver(&mantis_pci_driver);
295} 296}
296 297
297static void __devexit mantis_exit(void) 298static void mantis_exit(void)
298{ 299{
299 return pci_unregister_driver(&mantis_pci_driver); 300 return pci_unregister_driver(&mantis_pci_driver);
300} 301}
diff --git a/drivers/media/pci/mantis/mantis_dvb.c b/drivers/media/pci/mantis/mantis_dvb.c
index 5d15c6b74d9b..5a71e1791cf5 100644
--- a/drivers/media/pci/mantis/mantis_dvb.c
+++ b/drivers/media/pci/mantis/mantis_dvb.c
@@ -144,7 +144,7 @@ static int mantis_dvb_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
144 return 0; 144 return 0;
145} 145}
146 146
147int __devinit mantis_dvb_init(struct mantis_pci *mantis) 147int mantis_dvb_init(struct mantis_pci *mantis)
148{ 148{
149 struct mantis_hwconfig *config = mantis->hwconfig; 149 struct mantis_hwconfig *config = mantis->hwconfig;
150 int result = -1; 150 int result = -1;
@@ -271,7 +271,7 @@ err0:
271} 271}
272EXPORT_SYMBOL_GPL(mantis_dvb_init); 272EXPORT_SYMBOL_GPL(mantis_dvb_init);
273 273
274int __devexit mantis_dvb_exit(struct mantis_pci *mantis) 274int mantis_dvb_exit(struct mantis_pci *mantis)
275{ 275{
276 int err; 276 int err;
277 277
diff --git a/drivers/media/pci/mantis/mantis_i2c.c b/drivers/media/pci/mantis/mantis_i2c.c
index e7794517fe26..937fb9d50213 100644
--- a/drivers/media/pci/mantis/mantis_i2c.c
+++ b/drivers/media/pci/mantis/mantis_i2c.c
@@ -217,7 +217,7 @@ static struct i2c_algorithm mantis_algo = {
217 .functionality = mantis_i2c_func, 217 .functionality = mantis_i2c_func,
218}; 218};
219 219
220int __devinit mantis_i2c_init(struct mantis_pci *mantis) 220int mantis_i2c_init(struct mantis_pci *mantis)
221{ 221{
222 u32 intstat, intmask; 222 u32 intstat, intmask;
223 struct i2c_adapter *i2c_adapter = &mantis->adapter; 223 struct i2c_adapter *i2c_adapter = &mantis->adapter;
diff --git a/drivers/media/pci/mantis/mantis_pci.c b/drivers/media/pci/mantis/mantis_pci.c
index 371558af2d96..a846036ea022 100644
--- a/drivers/media/pci/mantis/mantis_pci.c
+++ b/drivers/media/pci/mantis/mantis_pci.c
@@ -46,7 +46,7 @@
46 46
47#define DRIVER_NAME "Mantis Core" 47#define DRIVER_NAME "Mantis Core"
48 48
49int __devinit mantis_pci_init(struct mantis_pci *mantis) 49int mantis_pci_init(struct mantis_pci *mantis)
50{ 50{
51 u8 latency; 51 u8 latency;
52 struct mantis_hwconfig *config = mantis->hwconfig; 52 struct mantis_hwconfig *config = mantis->hwconfig;
diff --git a/drivers/media/pci/meye/meye.c b/drivers/media/pci/meye/meye.c
index ae7d32027bf7..049e18667cd0 100644
--- a/drivers/media/pci/meye/meye.c
+++ b/drivers/media/pci/meye/meye.c
@@ -1728,8 +1728,7 @@ static int meye_resume(struct pci_dev *pdev)
1728} 1728}
1729#endif 1729#endif
1730 1730
1731static int __devinit meye_probe(struct pci_dev *pcidev, 1731static int meye_probe(struct pci_dev *pcidev, const struct pci_device_id *ent)
1732 const struct pci_device_id *ent)
1733{ 1732{
1734 struct v4l2_device *v4l2_dev = &meye.v4l2_dev; 1733 struct v4l2_device *v4l2_dev = &meye.v4l2_dev;
1735 int ret = -EBUSY; 1734 int ret = -EBUSY;
@@ -1889,7 +1888,7 @@ outnotdev:
1889 return ret; 1888 return ret;
1890} 1889}
1891 1890
1892static void __devexit meye_remove(struct pci_dev *pcidev) 1891static void meye_remove(struct pci_dev *pcidev)
1893{ 1892{
1894 video_unregister_device(meye.vdev); 1893 video_unregister_device(meye.vdev);
1895 1894
@@ -1935,7 +1934,7 @@ static struct pci_driver meye_driver = {
1935 .name = "meye", 1934 .name = "meye",
1936 .id_table = meye_pci_tbl, 1935 .id_table = meye_pci_tbl,
1937 .probe = meye_probe, 1936 .probe = meye_probe,
1938 .remove = __devexit_p(meye_remove), 1937 .remove = meye_remove,
1939#ifdef CONFIG_PM 1938#ifdef CONFIG_PM
1940 .suspend = meye_suspend, 1939 .suspend = meye_suspend,
1941 .resume = meye_resume, 1940 .resume = meye_resume,
diff --git a/drivers/media/pci/ngene/ngene-cards.c b/drivers/media/pci/ngene/ngene-cards.c
index b38bce529566..fad214113669 100644
--- a/drivers/media/pci/ngene/ngene-cards.c
+++ b/drivers/media/pci/ngene/ngene-cards.c
@@ -743,7 +743,7 @@ static struct ngene_info ngene_info_terratec = {
743 743
744/****************************************************************************/ 744/****************************************************************************/
745 745
746static const struct pci_device_id ngene_id_tbl[] __devinitdata = { 746static const struct pci_device_id ngene_id_tbl[] = {
747 NGENE_ID(0x18c3, 0xabc3, ngene_info_cineS2), 747 NGENE_ID(0x18c3, 0xabc3, ngene_info_cineS2),
748 NGENE_ID(0x18c3, 0xabc4, ngene_info_cineS2), 748 NGENE_ID(0x18c3, 0xabc4, ngene_info_cineS2),
749 NGENE_ID(0x18c3, 0xdb01, ngene_info_satixS2), 749 NGENE_ID(0x18c3, 0xdb01, ngene_info_satixS2),
@@ -800,7 +800,7 @@ static struct pci_driver ngene_pci_driver = {
800 .name = "ngene", 800 .name = "ngene",
801 .id_table = ngene_id_tbl, 801 .id_table = ngene_id_tbl,
802 .probe = ngene_probe, 802 .probe = ngene_probe,
803 .remove = __devexit_p(ngene_remove), 803 .remove = ngene_remove,
804 .err_handler = &ngene_errors, 804 .err_handler = &ngene_errors,
805 .shutdown = ngene_shutdown, 805 .shutdown = ngene_shutdown,
806}; 806};
diff --git a/drivers/media/pci/ngene/ngene-core.c b/drivers/media/pci/ngene/ngene-core.c
index 8eeec4f50ccb..37ebc42392ad 100644
--- a/drivers/media/pci/ngene/ngene-core.c
+++ b/drivers/media/pci/ngene/ngene-core.c
@@ -1636,7 +1636,7 @@ void ngene_shutdown(struct pci_dev *pdev)
1636/* device probe/remove calls ************************************************/ 1636/* device probe/remove calls ************************************************/
1637/****************************************************************************/ 1637/****************************************************************************/
1638 1638
1639void __devexit ngene_remove(struct pci_dev *pdev) 1639void ngene_remove(struct pci_dev *pdev)
1640{ 1640{
1641 struct ngene *dev = pci_get_drvdata(pdev); 1641 struct ngene *dev = pci_get_drvdata(pdev);
1642 int i; 1642 int i;
@@ -1652,8 +1652,7 @@ void __devexit ngene_remove(struct pci_dev *pdev)
1652 pci_disable_device(pdev); 1652 pci_disable_device(pdev);
1653} 1653}
1654 1654
1655int __devinit ngene_probe(struct pci_dev *pci_dev, 1655int ngene_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)
1656 const struct pci_device_id *id)
1657{ 1656{
1658 struct ngene *dev; 1657 struct ngene *dev;
1659 int stat = 0; 1658 int stat = 0;
diff --git a/drivers/media/pci/ngene/ngene.h b/drivers/media/pci/ngene/ngene.h
index 5443dc0caea5..22c39ff6bfa0 100644
--- a/drivers/media/pci/ngene/ngene.h
+++ b/drivers/media/pci/ngene/ngene.h
@@ -887,9 +887,8 @@ struct ngene_buffer {
887 887
888 888
889/* Provided by ngene-core.c */ 889/* Provided by ngene-core.c */
890int __devinit ngene_probe(struct pci_dev *pci_dev, 890int ngene_probe(struct pci_dev *pci_dev, const struct pci_device_id *id);
891 const struct pci_device_id *id); 891void ngene_remove(struct pci_dev *pdev);
892void __devexit ngene_remove(struct pci_dev *pdev);
893void ngene_shutdown(struct pci_dev *pdev); 892void ngene_shutdown(struct pci_dev *pdev);
894int ngene_command(struct ngene *dev, struct ngene_command *com); 893int ngene_command(struct ngene *dev, struct ngene_command *com);
895int ngene_command_gpio_set(struct ngene *dev, u8 select, u8 level); 894int ngene_command_gpio_set(struct ngene *dev, u8 select, u8 level);
diff --git a/drivers/media/pci/pluto2/pluto2.c b/drivers/media/pci/pluto2/pluto2.c
index f148b19a206a..2290faee5852 100644
--- a/drivers/media/pci/pluto2/pluto2.c
+++ b/drivers/media/pci/pluto2/pluto2.c
@@ -240,7 +240,7 @@ static void pluto_set_dma_addr(struct pluto *pluto)
240 pluto_writereg(pluto, REG_PCAR, pluto->dma_addr); 240 pluto_writereg(pluto, REG_PCAR, pluto->dma_addr);
241} 241}
242 242
243static int __devinit pluto_dma_map(struct pluto *pluto) 243static int pluto_dma_map(struct pluto *pluto)
244{ 244{
245 pluto->dma_addr = pci_map_single(pluto->pdev, pluto->dma_buf, 245 pluto->dma_addr = pci_map_single(pluto->pdev, pluto->dma_buf,
246 TS_DMA_BYTES, PCI_DMA_FROMDEVICE); 246 TS_DMA_BYTES, PCI_DMA_FROMDEVICE);
@@ -368,7 +368,7 @@ static irqreturn_t pluto_irq(int irq, void *dev_id)
368 return IRQ_HANDLED; 368 return IRQ_HANDLED;
369} 369}
370 370
371static void __devinit pluto_enable_irqs(struct pluto *pluto) 371static void pluto_enable_irqs(struct pluto *pluto)
372{ 372{
373 u32 val = pluto_readreg(pluto, REG_TSCR); 373 u32 val = pluto_readreg(pluto, REG_TSCR);
374 374
@@ -394,7 +394,7 @@ static void pluto_disable_irqs(struct pluto *pluto)
394 pluto_write_tscr(pluto, val); 394 pluto_write_tscr(pluto, val);
395} 395}
396 396
397static int __devinit pluto_hw_init(struct pluto *pluto) 397static int pluto_hw_init(struct pluto *pluto)
398{ 398{
399 pluto_reset_frontend(pluto, 1); 399 pluto_reset_frontend(pluto, 1);
400 400
@@ -505,7 +505,7 @@ static int pluto2_request_firmware(struct dvb_frontend *fe,
505 return request_firmware(fw, name, &pluto->pdev->dev); 505 return request_firmware(fw, name, &pluto->pdev->dev);
506} 506}
507 507
508static struct tda1004x_config pluto2_fe_config __devinitdata = { 508static struct tda1004x_config pluto2_fe_config = {
509 .demod_address = I2C_ADDR_TDA10046 >> 1, 509 .demod_address = I2C_ADDR_TDA10046 >> 1,
510 .invert = 1, 510 .invert = 1,
511 .invert_oclk = 0, 511 .invert_oclk = 0,
@@ -515,7 +515,7 @@ static struct tda1004x_config pluto2_fe_config __devinitdata = {
515 .request_firmware = pluto2_request_firmware, 515 .request_firmware = pluto2_request_firmware,
516}; 516};
517 517
518static int __devinit frontend_init(struct pluto *pluto) 518static int frontend_init(struct pluto *pluto)
519{ 519{
520 int ret; 520 int ret;
521 521
@@ -536,14 +536,14 @@ static int __devinit frontend_init(struct pluto *pluto)
536 return 0; 536 return 0;
537} 537}
538 538
539static void __devinit pluto_read_rev(struct pluto *pluto) 539static void pluto_read_rev(struct pluto *pluto)
540{ 540{
541 u32 val = pluto_readreg(pluto, REG_MISC) & MISC_DVR; 541 u32 val = pluto_readreg(pluto, REG_MISC) & MISC_DVR;
542 dev_info(&pluto->pdev->dev, "board revision %d.%d\n", 542 dev_info(&pluto->pdev->dev, "board revision %d.%d\n",
543 (val >> 12) & 0x0f, (val >> 4) & 0xff); 543 (val >> 12) & 0x0f, (val >> 4) & 0xff);
544} 544}
545 545
546static void __devinit pluto_read_mac(struct pluto *pluto, u8 *mac) 546static void pluto_read_mac(struct pluto *pluto, u8 *mac)
547{ 547{
548 u32 val = pluto_readreg(pluto, REG_MMAC); 548 u32 val = pluto_readreg(pluto, REG_MMAC);
549 mac[0] = (val >> 8) & 0xff; 549 mac[0] = (val >> 8) & 0xff;
@@ -560,7 +560,7 @@ static void __devinit pluto_read_mac(struct pluto *pluto, u8 *mac)
560 dev_info(&pluto->pdev->dev, "MAC %pM\n", mac); 560 dev_info(&pluto->pdev->dev, "MAC %pM\n", mac);
561} 561}
562 562
563static int __devinit pluto_read_serial(struct pluto *pluto) 563static int pluto_read_serial(struct pluto *pluto)
564{ 564{
565 struct pci_dev *pdev = pluto->pdev; 565 struct pci_dev *pdev = pluto->pdev;
566 unsigned int i, j; 566 unsigned int i, j;
@@ -588,8 +588,7 @@ out:
588 return 0; 588 return 0;
589} 589}
590 590
591static int __devinit pluto2_probe(struct pci_dev *pdev, 591static int pluto2_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
592 const struct pci_device_id *ent)
593{ 592{
594 struct pluto *pluto; 593 struct pluto *pluto;
595 struct dvb_adapter *dvb_adapter; 594 struct dvb_adapter *dvb_adapter;
@@ -742,7 +741,7 @@ err_kfree:
742 goto out; 741 goto out;
743} 742}
744 743
745static void __devexit pluto2_remove(struct pci_dev *pdev) 744static void pluto2_remove(struct pci_dev *pdev)
746{ 745{
747 struct pluto *pluto = pci_get_drvdata(pdev); 746 struct pluto *pluto = pci_get_drvdata(pdev);
748 struct dvb_adapter *dvb_adapter = &pluto->dvb_adapter; 747 struct dvb_adapter *dvb_adapter = &pluto->dvb_adapter;
@@ -777,7 +776,7 @@ static void __devexit pluto2_remove(struct pci_dev *pdev)
777#define PCI_DEVICE_ID_PLUTO2 0x0001 776#define PCI_DEVICE_ID_PLUTO2 0x0001
778#endif 777#endif
779 778
780static struct pci_device_id pluto2_id_table[] __devinitdata = { 779static struct pci_device_id pluto2_id_table[] = {
781 { 780 {
782 .vendor = PCI_VENDOR_ID_SCM, 781 .vendor = PCI_VENDOR_ID_SCM,
783 .device = PCI_DEVICE_ID_PLUTO2, 782 .device = PCI_DEVICE_ID_PLUTO2,
@@ -794,7 +793,7 @@ static struct pci_driver pluto2_driver = {
794 .name = DRIVER_NAME, 793 .name = DRIVER_NAME,
795 .id_table = pluto2_id_table, 794 .id_table = pluto2_id_table,
796 .probe = pluto2_probe, 795 .probe = pluto2_probe,
797 .remove = __devexit_p(pluto2_remove), 796 .remove = pluto2_remove,
798}; 797};
799 798
800static int __init pluto2_init(void) 799static int __init pluto2_init(void)
diff --git a/drivers/media/pci/pt1/pt1.c b/drivers/media/pci/pt1/pt1.c
index 15b35c4725f1..e9211086df49 100644
--- a/drivers/media/pci/pt1/pt1.c
+++ b/drivers/media/pci/pt1/pt1.c
@@ -1058,7 +1058,7 @@ static void pt1_i2c_init(struct pt1 *pt1)
1058 pt1_i2c_emit(pt1, i, 0, 0, 1, 1, 0); 1058 pt1_i2c_emit(pt1, i, 0, 0, 1, 1, 0);
1059} 1059}
1060 1060
1061static void __devexit pt1_remove(struct pci_dev *pdev) 1061static void pt1_remove(struct pci_dev *pdev)
1062{ 1062{
1063 struct pt1 *pt1; 1063 struct pt1 *pt1;
1064 void __iomem *regs; 1064 void __iomem *regs;
@@ -1083,8 +1083,7 @@ static void __devexit pt1_remove(struct pci_dev *pdev)
1083 pci_disable_device(pdev); 1083 pci_disable_device(pdev);
1084} 1084}
1085 1085
1086static int __devinit 1086static int pt1_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1087pt1_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1088{ 1087{
1089 int ret; 1088 int ret;
1090 void __iomem *regs; 1089 void __iomem *regs;
@@ -1222,7 +1221,7 @@ MODULE_DEVICE_TABLE(pci, pt1_id_table);
1222static struct pci_driver pt1_driver = { 1221static struct pci_driver pt1_driver = {
1223 .name = DRIVER_NAME, 1222 .name = DRIVER_NAME,
1224 .probe = pt1_probe, 1223 .probe = pt1_probe,
1225 .remove = __devexit_p(pt1_remove), 1224 .remove = pt1_remove,
1226 .id_table = pt1_id_table, 1225 .id_table = pt1_id_table,
1227}; 1226};
1228 1227
diff --git a/drivers/media/pci/saa7134/saa7134-core.c b/drivers/media/pci/saa7134/saa7134-core.c
index 8976d0e65813..e359d200d698 100644
--- a/drivers/media/pci/saa7134/saa7134-core.c
+++ b/drivers/media/pci/saa7134/saa7134-core.c
@@ -754,7 +754,7 @@ static int saa7134_hwfini(struct saa7134_dev *dev)
754 return 0; 754 return 0;
755} 755}
756 756
757static void __devinit must_configure_manually(int has_eeprom) 757static void must_configure_manually(int has_eeprom)
758{ 758{
759 unsigned int i,p; 759 unsigned int i,p;
760 760
@@ -860,8 +860,8 @@ static void mpeg_ops_detach(struct saa7134_mpeg_ops *ops,
860 dev->mops = NULL; 860 dev->mops = NULL;
861} 861}
862 862
863static int __devinit saa7134_initdev(struct pci_dev *pci_dev, 863static int saa7134_initdev(struct pci_dev *pci_dev,
864 const struct pci_device_id *pci_id) 864 const struct pci_device_id *pci_id)
865{ 865{
866 struct saa7134_dev *dev; 866 struct saa7134_dev *dev;
867 struct saa7134_mpeg_ops *mops; 867 struct saa7134_mpeg_ops *mops;
@@ -1102,7 +1102,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
1102 return err; 1102 return err;
1103} 1103}
1104 1104
1105static void __devexit saa7134_finidev(struct pci_dev *pci_dev) 1105static void saa7134_finidev(struct pci_dev *pci_dev)
1106{ 1106{
1107 struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev); 1107 struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev);
1108 struct saa7134_dev *dev = container_of(v4l2_dev, struct saa7134_dev, v4l2_dev); 1108 struct saa7134_dev *dev = container_of(v4l2_dev, struct saa7134_dev, v4l2_dev);
@@ -1322,7 +1322,7 @@ static struct pci_driver saa7134_pci_driver = {
1322 .name = "saa7134", 1322 .name = "saa7134",
1323 .id_table = saa7134_pci_tbl, 1323 .id_table = saa7134_pci_tbl,
1324 .probe = saa7134_initdev, 1324 .probe = saa7134_initdev,
1325 .remove = __devexit_p(saa7134_finidev), 1325 .remove = saa7134_finidev,
1326#ifdef CONFIG_PM 1326#ifdef CONFIG_PM
1327 .suspend = saa7134_suspend, 1327 .suspend = saa7134_suspend,
1328 .resume = saa7134_resume 1328 .resume = saa7134_resume
diff --git a/drivers/media/pci/saa7134/saa7134.h b/drivers/media/pci/saa7134/saa7134.h
index c24b6512bd8f..075908fae4d9 100644
--- a/drivers/media/pci/saa7134/saa7134.h
+++ b/drivers/media/pci/saa7134/saa7134.h
@@ -739,7 +739,7 @@ extern int (*saa7134_dmasound_exit)(struct saa7134_dev *dev);
739 739
740extern struct saa7134_board saa7134_boards[]; 740extern struct saa7134_board saa7134_boards[];
741extern const unsigned int saa7134_bcount; 741extern const unsigned int saa7134_bcount;
742extern struct pci_device_id __devinitdata saa7134_pci_tbl[]; 742extern struct pci_device_id saa7134_pci_tbl[];
743 743
744extern int saa7134_board_init1(struct saa7134_dev *dev); 744extern int saa7134_board_init1(struct saa7134_dev *dev);
745extern int saa7134_board_init2(struct saa7134_dev *dev); 745extern int saa7134_board_init2(struct saa7134_dev *dev);
diff --git a/drivers/media/pci/saa7164/saa7164-core.c b/drivers/media/pci/saa7164/saa7164-core.c
index 063047f56766..63502e7a2a76 100644
--- a/drivers/media/pci/saa7164/saa7164-core.c
+++ b/drivers/media/pci/saa7164/saa7164-core.c
@@ -1185,8 +1185,8 @@ static int saa7164_thread_function(void *data)
1185 return 0; 1185 return 0;
1186} 1186}
1187 1187
1188static int __devinit saa7164_initdev(struct pci_dev *pci_dev, 1188static int saa7164_initdev(struct pci_dev *pci_dev,
1189 const struct pci_device_id *pci_id) 1189 const struct pci_device_id *pci_id)
1190{ 1190{
1191 struct saa7164_dev *dev; 1191 struct saa7164_dev *dev;
1192 int err, i; 1192 int err, i;
@@ -1376,7 +1376,7 @@ static void saa7164_shutdown(struct saa7164_dev *dev)
1376 dprintk(1, "%s()\n", __func__); 1376 dprintk(1, "%s()\n", __func__);
1377} 1377}
1378 1378
1379static void __devexit saa7164_finidev(struct pci_dev *pci_dev) 1379static void saa7164_finidev(struct pci_dev *pci_dev)
1380{ 1380{
1381 struct saa7164_dev *dev = pci_get_drvdata(pci_dev); 1381 struct saa7164_dev *dev = pci_get_drvdata(pci_dev);
1382 1382
@@ -1459,7 +1459,7 @@ static struct pci_driver saa7164_pci_driver = {
1459 .name = "saa7164", 1459 .name = "saa7164",
1460 .id_table = saa7164_pci_tbl, 1460 .id_table = saa7164_pci_tbl,
1461 .probe = saa7164_initdev, 1461 .probe = saa7164_initdev,
1462 .remove = __devexit_p(saa7164_finidev), 1462 .remove = saa7164_finidev,
1463 /* TODO */ 1463 /* TODO */
1464 .suspend = NULL, 1464 .suspend = NULL,
1465 .resume = NULL, 1465 .resume = NULL,
diff --git a/drivers/media/pci/sta2x11/sta2x11_vip.c b/drivers/media/pci/sta2x11/sta2x11_vip.c
index 4c10205264d4..27ae48842656 100644
--- a/drivers/media/pci/sta2x11/sta2x11_vip.c
+++ b/drivers/media/pci/sta2x11/sta2x11_vip.c
@@ -1205,8 +1205,8 @@ static void vip_gpio_release(struct device *dev, int pin, const char *name)
1205 * 1205 *
1206 * -ENODEV, device could not be detected or registered 1206 * -ENODEV, device could not be detected or registered
1207 */ 1207 */
1208static int __devinit sta2x11_vip_init_one(struct pci_dev *pdev, 1208static int sta2x11_vip_init_one(struct pci_dev *pdev,
1209 const struct pci_device_id *ent) 1209 const struct pci_device_id *ent)
1210{ 1210{
1211 int ret; 1211 int ret;
1212 struct sta2x11_vip *vip; 1212 struct sta2x11_vip *vip;
@@ -1376,7 +1376,7 @@ disable:
1376 * free memory 1376 * free memory
1377 * free GPIO pins 1377 * free GPIO pins
1378 */ 1378 */
1379static void __devexit sta2x11_vip_remove_one(struct pci_dev *pdev) 1379static void sta2x11_vip_remove_one(struct pci_dev *pdev)
1380{ 1380{
1381 struct v4l2_device *v4l2_dev = pci_get_drvdata(pdev); 1381 struct v4l2_device *v4l2_dev = pci_get_drvdata(pdev);
1382 struct sta2x11_vip *vip = 1382 struct sta2x11_vip *vip =
@@ -1517,7 +1517,7 @@ static DEFINE_PCI_DEVICE_TABLE(sta2x11_vip_pci_tbl) = {
1517static struct pci_driver sta2x11_vip_driver = { 1517static struct pci_driver sta2x11_vip_driver = {
1518 .name = DRV_NAME, 1518 .name = DRV_NAME,
1519 .probe = sta2x11_vip_init_one, 1519 .probe = sta2x11_vip_init_one,
1520 .remove = __devexit_p(sta2x11_vip_remove_one), 1520 .remove = sta2x11_vip_remove_one,
1521 .id_table = sta2x11_vip_pci_tbl, 1521 .id_table = sta2x11_vip_pci_tbl,
1522#ifdef CONFIG_PM 1522#ifdef CONFIG_PM
1523 .suspend = sta2x11_vip_suspend, 1523 .suspend = sta2x11_vip_suspend,
diff --git a/drivers/media/pci/ttpci/av7110.c b/drivers/media/pci/ttpci/av7110.c
index 4bd8bd56befc..4656d4a10af0 100644
--- a/drivers/media/pci/ttpci/av7110.c
+++ b/drivers/media/pci/ttpci/av7110.c
@@ -2367,8 +2367,8 @@ static int frontend_init(struct av7110 *av7110)
2367 * The same behaviour of missing VSYNC can be duplicated on budget 2367 * The same behaviour of missing VSYNC can be duplicated on budget
2368 * cards, by seting DD1_INIT trigger mode 7 in 3rd nibble. 2368 * cards, by seting DD1_INIT trigger mode 7 in 3rd nibble.
2369 */ 2369 */
2370static int __devinit av7110_attach(struct saa7146_dev* dev, 2370static int av7110_attach(struct saa7146_dev* dev,
2371 struct saa7146_pci_extension_data *pci_ext) 2371 struct saa7146_pci_extension_data *pci_ext)
2372{ 2372{
2373 const int length = TS_WIDTH * TS_HEIGHT; 2373 const int length = TS_WIDTH * TS_HEIGHT;
2374 struct pci_dev *pdev = dev->pci; 2374 struct pci_dev *pdev = dev->pci;
@@ -2761,7 +2761,7 @@ err_kfree_0:
2761 goto out; 2761 goto out;
2762} 2762}
2763 2763
2764static int __devexit av7110_detach(struct saa7146_dev* saa) 2764static int av7110_detach(struct saa7146_dev* saa)
2765{ 2765{
2766 struct av7110 *av7110 = saa->ext_priv; 2766 struct av7110 *av7110 = saa->ext_priv;
2767 dprintk(4, "%p\n", av7110); 2767 dprintk(4, "%p\n", av7110);
@@ -2910,7 +2910,7 @@ static struct saa7146_extension av7110_extension_driver = {
2910 .module = THIS_MODULE, 2910 .module = THIS_MODULE,
2911 .pci_tbl = &pci_tbl[0], 2911 .pci_tbl = &pci_tbl[0],
2912 .attach = av7110_attach, 2912 .attach = av7110_attach,
2913 .detach = __devexit_p(av7110_detach), 2913 .detach = av7110_detach,
2914 2914
2915 .irq_mask = MASK_19 | MASK_03 | MASK_10, 2915 .irq_mask = MASK_19 | MASK_03 | MASK_10,
2916 .irq_func = av7110_irq, 2916 .irq_func = av7110_irq,
diff --git a/drivers/media/pci/ttpci/av7110_ir.c b/drivers/media/pci/ttpci/av7110_ir.c
index 908f272fe26c..eb822862a646 100644
--- a/drivers/media/pci/ttpci/av7110_ir.c
+++ b/drivers/media/pci/ttpci/av7110_ir.c
@@ -324,7 +324,7 @@ static void ir_handler(struct av7110 *av7110, u32 ircom)
324} 324}
325 325
326 326
327int __devinit av7110_ir_init(struct av7110 *av7110) 327int av7110_ir_init(struct av7110 *av7110)
328{ 328{
329 struct input_dev *input_dev; 329 struct input_dev *input_dev;
330 static struct proc_dir_entry *e; 330 static struct proc_dir_entry *e;
@@ -385,7 +385,7 @@ int __devinit av7110_ir_init(struct av7110 *av7110)
385} 385}
386 386
387 387
388void __devexit av7110_ir_exit(struct av7110 *av7110) 388void av7110_ir_exit(struct av7110 *av7110)
389{ 389{
390 int i; 390 int i;
391 391
diff --git a/drivers/media/pci/zoran/zoran_card.c b/drivers/media/pci/zoran/zoran_card.c
index fffc54b452c8..a90a3b9b09bf 100644
--- a/drivers/media/pci/zoran/zoran_card.c
+++ b/drivers/media/pci/zoran/zoran_card.c
@@ -369,7 +369,7 @@ static const unsigned short bt819_addrs[] = { 0x45, I2C_CLIENT_END };
369static const unsigned short bt856_addrs[] = { 0x44, I2C_CLIENT_END }; 369static const unsigned short bt856_addrs[] = { 0x44, I2C_CLIENT_END };
370static const unsigned short bt866_addrs[] = { 0x44, I2C_CLIENT_END }; 370static const unsigned short bt866_addrs[] = { 0x44, I2C_CLIENT_END };
371 371
372static struct card_info zoran_cards[NUM_CARDS] __devinitdata = { 372static struct card_info zoran_cards[NUM_CARDS] = {
373 { 373 {
374 .type = DC10_old, 374 .type = DC10_old,
375 .name = "DC10(old)", 375 .name = "DC10(old)",
@@ -948,8 +948,7 @@ zoran_open_init_params (struct zoran *zr)
948 zr->testing = 0; 948 zr->testing = 0;
949} 949}
950 950
951static void __devinit 951static void test_interrupts (struct zoran *zr)
952test_interrupts (struct zoran *zr)
953{ 952{
954 DEFINE_WAIT(wait); 953 DEFINE_WAIT(wait);
955 int timeout, icr; 954 int timeout, icr;
@@ -974,8 +973,7 @@ test_interrupts (struct zoran *zr)
974 btwrite(icr, ZR36057_ICR); 973 btwrite(icr, ZR36057_ICR);
975} 974}
976 975
977static int __devinit 976static int zr36057_init (struct zoran *zr)
978zr36057_init (struct zoran *zr)
979{ 977{
980 int j, err; 978 int j, err;
981 979
@@ -1083,7 +1081,7 @@ exit_free:
1083 return err; 1081 return err;
1084} 1082}
1085 1083
1086static void __devexit zoran_remove(struct pci_dev *pdev) 1084static void zoran_remove(struct pci_dev *pdev)
1087{ 1085{
1088 struct v4l2_device *v4l2_dev = dev_get_drvdata(&pdev->dev); 1086 struct v4l2_device *v4l2_dev = dev_get_drvdata(&pdev->dev);
1089 struct zoran *zr = to_zoran(v4l2_dev); 1087 struct zoran *zr = to_zoran(v4l2_dev);
@@ -1129,9 +1127,8 @@ zoran_vdev_release (struct video_device *vdev)
1129 kfree(vdev); 1127 kfree(vdev);
1130} 1128}
1131 1129
1132static struct videocodec_master * __devinit 1130static struct videocodec_master *zoran_setup_videocodec(struct zoran *zr,
1133zoran_setup_videocodec (struct zoran *zr, 1131 int type)
1134 int type)
1135{ 1132{
1136 struct videocodec_master *m = NULL; 1133 struct videocodec_master *m = NULL;
1137 1134
@@ -1192,8 +1189,7 @@ static void zoran_subdev_notify(struct v4l2_subdev *sd, unsigned int cmd, void *
1192 * Scan for a Buz card (actually for the PCI controller ZR36057), 1189 * Scan for a Buz card (actually for the PCI controller ZR36057),
1193 * request the irq and map the io memory 1190 * request the irq and map the io memory
1194 */ 1191 */
1195static int __devinit zoran_probe(struct pci_dev *pdev, 1192static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1196 const struct pci_device_id *ent)
1197{ 1193{
1198 unsigned char latency, need_latency; 1194 unsigned char latency, need_latency;
1199 struct zoran *zr; 1195 struct zoran *zr;
@@ -1459,7 +1455,7 @@ static struct pci_driver zoran_driver = {
1459 .name = "zr36067", 1455 .name = "zr36067",
1460 .id_table = zr36067_pci_tbl, 1456 .id_table = zr36067_pci_tbl,
1461 .probe = zoran_probe, 1457 .probe = zoran_probe,
1462 .remove = __devexit_p(zoran_remove), 1458 .remove = zoran_remove,
1463}; 1459};
1464 1460
1465static int __init zoran_init(void) 1461static int __init zoran_init(void)
diff --git a/drivers/media/pci/zoran/zoran_driver.c b/drivers/media/pci/zoran/zoran_driver.c
index 53f12c7466b0..e60ae41e2319 100644
--- a/drivers/media/pci/zoran/zoran_driver.c
+++ b/drivers/media/pci/zoran/zoran_driver.c
@@ -3080,7 +3080,7 @@ static const struct v4l2_file_operations zoran_fops = {
3080 .poll = zoran_poll, 3080 .poll = zoran_poll,
3081}; 3081};
3082 3082
3083struct video_device zoran_template __devinitdata = { 3083struct video_device zoran_template = {
3084 .name = ZORAN_NAME, 3084 .name = ZORAN_NAME,
3085 .fops = &zoran_fops, 3085 .fops = &zoran_fops,
3086 .ioctl_ops = &zoran_ioctl_ops, 3086 .ioctl_ops = &zoran_ioctl_ops,
diff --git a/drivers/media/platform/blackfin/bfin_capture.c b/drivers/media/platform/blackfin/bfin_capture.c
index ec476ef5b709..1aad2a65d2f3 100644
--- a/drivers/media/platform/blackfin/bfin_capture.c
+++ b/drivers/media/platform/blackfin/bfin_capture.c
@@ -862,7 +862,7 @@ static struct v4l2_file_operations bcap_fops = {
862 .poll = bcap_poll 862 .poll = bcap_poll
863}; 863};
864 864
865static int __devinit bcap_probe(struct platform_device *pdev) 865static int bcap_probe(struct platform_device *pdev)
866{ 866{
867 struct bcap_device *bcap_dev; 867 struct bcap_device *bcap_dev;
868 struct video_device *vfd; 868 struct video_device *vfd;
@@ -1026,7 +1026,7 @@ err_free_dev:
1026 return ret; 1026 return ret;
1027} 1027}
1028 1028
1029static int __devexit bcap_remove(struct platform_device *pdev) 1029static int bcap_remove(struct platform_device *pdev)
1030{ 1030{
1031 struct v4l2_device *v4l2_dev = platform_get_drvdata(pdev); 1031 struct v4l2_device *v4l2_dev = platform_get_drvdata(pdev);
1032 struct bcap_device *bcap_dev = container_of(v4l2_dev, 1032 struct bcap_device *bcap_dev = container_of(v4l2_dev,
@@ -1048,7 +1048,7 @@ static struct platform_driver bcap_driver = {
1048 .owner = THIS_MODULE, 1048 .owner = THIS_MODULE,
1049 }, 1049 },
1050 .probe = bcap_probe, 1050 .probe = bcap_probe,
1051 .remove = __devexit_p(bcap_remove), 1051 .remove = bcap_remove,
1052}; 1052};
1053module_platform_driver(bcap_driver); 1053module_platform_driver(bcap_driver);
1054 1054
diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index 7b8b547f2d51..4a980e029ca7 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -23,8 +23,8 @@
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/videodev2.h> 24#include <linux/videodev2.h>
25#include <linux/of.h> 25#include <linux/of.h>
26#include <linux/platform_data/imx-iram.h>
26 27
27#include <mach/iram.h>
28#include <media/v4l2-ctrls.h> 28#include <media/v4l2-ctrls.h>
29#include <media/v4l2-device.h> 29#include <media/v4l2-device.h>
30#include <media/v4l2-ioctl.h> 30#include <media/v4l2-ioctl.h>
@@ -1891,7 +1891,7 @@ static const struct of_device_id coda_dt_ids[] = {
1891MODULE_DEVICE_TABLE(of, coda_dt_ids); 1891MODULE_DEVICE_TABLE(of, coda_dt_ids);
1892#endif 1892#endif
1893 1893
1894static int __devinit coda_probe(struct platform_device *pdev) 1894static int coda_probe(struct platform_device *pdev)
1895{ 1895{
1896 const struct of_device_id *of_id = 1896 const struct of_device_id *of_id =
1897 of_match_device(of_match_ptr(coda_dt_ids), &pdev->dev); 1897 of_match_device(of_match_ptr(coda_dt_ids), &pdev->dev);
@@ -2033,7 +2033,7 @@ static int coda_remove(struct platform_device *pdev)
2033 2033
2034static struct platform_driver coda_driver = { 2034static struct platform_driver coda_driver = {
2035 .probe = coda_probe, 2035 .probe = coda_probe,
2036 .remove = __devexit_p(coda_remove), 2036 .remove = coda_remove,
2037 .driver = { 2037 .driver = {
2038 .name = CODA_NAME, 2038 .name = CODA_NAME,
2039 .owner = THIS_MODULE, 2039 .owner = THIS_MODULE,
diff --git a/drivers/media/platform/davinci/dm355_ccdc.c b/drivers/media/platform/davinci/dm355_ccdc.c
index 030950dcfb16..f263cabade7a 100644
--- a/drivers/media/platform/davinci/dm355_ccdc.c
+++ b/drivers/media/platform/davinci/dm355_ccdc.c
@@ -965,7 +965,7 @@ static struct ccdc_hw_device ccdc_hw_dev = {
965 }, 965 },
966}; 966};
967 967
968static int __devinit dm355_ccdc_probe(struct platform_device *pdev) 968static int dm355_ccdc_probe(struct platform_device *pdev)
969{ 969{
970 void (*setup_pinmux)(void); 970 void (*setup_pinmux)(void);
971 struct resource *res; 971 struct resource *res;
@@ -1069,7 +1069,7 @@ static struct platform_driver dm355_ccdc_driver = {
1069 .name = "dm355_ccdc", 1069 .name = "dm355_ccdc",
1070 .owner = THIS_MODULE, 1070 .owner = THIS_MODULE,
1071 }, 1071 },
1072 .remove = __devexit_p(dm355_ccdc_remove), 1072 .remove = dm355_ccdc_remove,
1073 .probe = dm355_ccdc_probe, 1073 .probe = dm355_ccdc_probe,
1074}; 1074};
1075 1075
diff --git a/drivers/media/platform/davinci/dm644x_ccdc.c b/drivers/media/platform/davinci/dm644x_ccdc.c
index 0215ab6ebc90..318e80512998 100644
--- a/drivers/media/platform/davinci/dm644x_ccdc.c
+++ b/drivers/media/platform/davinci/dm644x_ccdc.c
@@ -957,7 +957,7 @@ static struct ccdc_hw_device ccdc_hw_dev = {
957 }, 957 },
958}; 958};
959 959
960static int __devinit dm644x_ccdc_probe(struct platform_device *pdev) 960static int dm644x_ccdc_probe(struct platform_device *pdev)
961{ 961{
962 struct resource *res; 962 struct resource *res;
963 int status = 0; 963 int status = 0;
@@ -1078,7 +1078,7 @@ static struct platform_driver dm644x_ccdc_driver = {
1078 .owner = THIS_MODULE, 1078 .owner = THIS_MODULE,
1079 .pm = &dm644x_ccdc_pm_ops, 1079 .pm = &dm644x_ccdc_pm_ops,
1080 }, 1080 },
1081 .remove = __devexit_p(dm644x_ccdc_remove), 1081 .remove = dm644x_ccdc_remove,
1082 .probe = dm644x_ccdc_probe, 1082 .probe = dm644x_ccdc_probe,
1083}; 1083};
1084 1084
diff --git a/drivers/media/platform/davinci/isif.c b/drivers/media/platform/davinci/isif.c
index 2c26c3e1837e..5050f9265f48 100644
--- a/drivers/media/platform/davinci/isif.c
+++ b/drivers/media/platform/davinci/isif.c
@@ -1032,7 +1032,7 @@ static struct ccdc_hw_device isif_hw_dev = {
1032 }, 1032 },
1033}; 1033};
1034 1034
1035static int __devinit isif_probe(struct platform_device *pdev) 1035static int isif_probe(struct platform_device *pdev)
1036{ 1036{
1037 void (*setup_pinmux)(void); 1037 void (*setup_pinmux)(void);
1038 struct resource *res; 1038 struct resource *res;
@@ -1156,7 +1156,7 @@ static struct platform_driver isif_driver = {
1156 .name = "isif", 1156 .name = "isif",
1157 .owner = THIS_MODULE, 1157 .owner = THIS_MODULE,
1158 }, 1158 },
1159 .remove = __devexit_p(isif_remove), 1159 .remove = isif_remove,
1160 .probe = isif_probe, 1160 .probe = isif_probe,
1161}; 1161};
1162 1162
diff --git a/drivers/media/platform/davinci/vpbe.c b/drivers/media/platform/davinci/vpbe.c
index 7f5cf9b347b2..841b91a3d255 100644
--- a/drivers/media/platform/davinci/vpbe.c
+++ b/drivers/media/platform/davinci/vpbe.c
@@ -807,7 +807,7 @@ static struct vpbe_device_ops vpbe_dev_ops = {
807 .set_mode = vpbe_set_mode, 807 .set_mode = vpbe_set_mode,
808}; 808};
809 809
810static __devinit int vpbe_probe(struct platform_device *pdev) 810static int vpbe_probe(struct platform_device *pdev)
811{ 811{
812 struct vpbe_device *vpbe_dev; 812 struct vpbe_device *vpbe_dev;
813 struct vpbe_config *cfg; 813 struct vpbe_config *cfg;
diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c
index 2bfde7958fef..e707a6f2325b 100644
--- a/drivers/media/platform/davinci/vpbe_display.c
+++ b/drivers/media/platform/davinci/vpbe_display.c
@@ -1662,8 +1662,8 @@ static int vpbe_device_get(struct device *dev, void *data)
1662 return 0; 1662 return 0;
1663} 1663}
1664 1664
1665static __devinit int init_vpbe_layer(int i, struct vpbe_display *disp_dev, 1665static int init_vpbe_layer(int i, struct vpbe_display *disp_dev,
1666 struct platform_device *pdev) 1666 struct platform_device *pdev)
1667{ 1667{
1668 struct vpbe_layer *vpbe_display_layer = NULL; 1668 struct vpbe_layer *vpbe_display_layer = NULL;
1669 struct video_device *vbd = NULL; 1669 struct video_device *vbd = NULL;
@@ -1718,9 +1718,10 @@ static __devinit int init_vpbe_layer(int i, struct vpbe_display *disp_dev,
1718 return 0; 1718 return 0;
1719} 1719}
1720 1720
1721static __devinit int register_device(struct vpbe_layer *vpbe_display_layer, 1721static int register_device(struct vpbe_layer *vpbe_display_layer,
1722 struct vpbe_display *disp_dev, 1722 struct vpbe_display *disp_dev,
1723 struct platform_device *pdev) { 1723 struct platform_device *pdev)
1724{
1724 int err; 1725 int err;
1725 1726
1726 v4l2_info(&disp_dev->vpbe_dev->v4l2_dev, 1727 v4l2_info(&disp_dev->vpbe_dev->v4l2_dev,
@@ -1752,7 +1753,7 @@ static __devinit int register_device(struct vpbe_layer *vpbe_display_layer,
1752 * This function creates device entries by register itself to the V4L2 driver 1753 * This function creates device entries by register itself to the V4L2 driver
1753 * and initializes fields of each layer objects 1754 * and initializes fields of each layer objects
1754 */ 1755 */
1755static __devinit int vpbe_display_probe(struct platform_device *pdev) 1756static int vpbe_display_probe(struct platform_device *pdev)
1756{ 1757{
1757 struct vpbe_layer *vpbe_display_layer; 1758 struct vpbe_layer *vpbe_display_layer;
1758 struct vpbe_display *disp_dev; 1759 struct vpbe_display *disp_dev;
@@ -1886,7 +1887,7 @@ static struct platform_driver vpbe_display_driver = {
1886 .bus = &platform_bus_type, 1887 .bus = &platform_bus_type,
1887 }, 1888 },
1888 .probe = vpbe_display_probe, 1889 .probe = vpbe_display_probe,
1889 .remove = __devexit_p(vpbe_display_remove), 1890 .remove = vpbe_display_remove,
1890}; 1891};
1891 1892
1892module_platform_driver(vpbe_display_driver); 1893module_platform_driver(vpbe_display_driver);
diff --git a/drivers/media/platform/davinci/vpfe_capture.c b/drivers/media/platform/davinci/vpfe_capture.c
index 8be492cd8ed4..be9d3e1b4868 100644
--- a/drivers/media/platform/davinci/vpfe_capture.c
+++ b/drivers/media/platform/davinci/vpfe_capture.c
@@ -1831,7 +1831,7 @@ static struct vpfe_device *vpfe_initialize(void)
1831 * itself to the V4L2 driver and initializes fields of each 1831 * itself to the V4L2 driver and initializes fields of each
1832 * device objects 1832 * device objects
1833 */ 1833 */
1834static __devinit int vpfe_probe(struct platform_device *pdev) 1834static int vpfe_probe(struct platform_device *pdev)
1835{ 1835{
1836 struct vpfe_subdev_info *sdinfo; 1836 struct vpfe_subdev_info *sdinfo;
1837 struct vpfe_config *vpfe_cfg; 1837 struct vpfe_config *vpfe_cfg;
@@ -2038,7 +2038,7 @@ probe_free_dev_mem:
2038/* 2038/*
2039 * vpfe_remove : It un-register device from V4L2 driver 2039 * vpfe_remove : It un-register device from V4L2 driver
2040 */ 2040 */
2041static int __devexit vpfe_remove(struct platform_device *pdev) 2041static int vpfe_remove(struct platform_device *pdev)
2042{ 2042{
2043 struct vpfe_device *vpfe_dev = platform_get_drvdata(pdev); 2043 struct vpfe_device *vpfe_dev = platform_get_drvdata(pdev);
2044 2044
@@ -2075,7 +2075,7 @@ static struct platform_driver vpfe_driver = {
2075 .pm = &vpfe_dev_pm_ops, 2075 .pm = &vpfe_dev_pm_ops,
2076 }, 2076 },
2077 .probe = vpfe_probe, 2077 .probe = vpfe_probe,
2078 .remove = __devexit_p(vpfe_remove), 2078 .remove = vpfe_remove,
2079}; 2079};
2080 2080
2081module_platform_driver(vpfe_driver); 2081module_platform_driver(vpfe_driver);
diff --git a/drivers/media/platform/davinci/vpif.c b/drivers/media/platform/davinci/vpif.c
index 0d6cc8e4deb2..28638a86f129 100644
--- a/drivers/media/platform/davinci/vpif.c
+++ b/drivers/media/platform/davinci/vpif.c
@@ -419,7 +419,7 @@ int vpif_channel_getfid(u8 channel_id)
419} 419}
420EXPORT_SYMBOL(vpif_channel_getfid); 420EXPORT_SYMBOL(vpif_channel_getfid);
421 421
422static int __devinit vpif_probe(struct platform_device *pdev) 422static int vpif_probe(struct platform_device *pdev)
423{ 423{
424 int status = 0; 424 int status = 0;
425 425
@@ -457,7 +457,7 @@ fail:
457 return status; 457 return status;
458} 458}
459 459
460static int __devexit vpif_remove(struct platform_device *pdev) 460static int vpif_remove(struct platform_device *pdev)
461{ 461{
462 if (vpif_clk) { 462 if (vpif_clk) {
463 clk_disable_unprepare(vpif_clk); 463 clk_disable_unprepare(vpif_clk);
@@ -498,7 +498,7 @@ static struct platform_driver vpif_driver = {
498 .owner = THIS_MODULE, 498 .owner = THIS_MODULE,
499 .pm = vpif_pm_ops, 499 .pm = vpif_pm_ops,
500 }, 500 },
501 .remove = __devexit_p(vpif_remove), 501 .remove = vpif_remove,
502 .probe = vpif_probe, 502 .probe = vpif_probe,
503}; 503};
504 504
diff --git a/drivers/media/platform/davinci/vpss.c b/drivers/media/platform/davinci/vpss.c
index 146e4b01ac17..cdbff88e0f1e 100644
--- a/drivers/media/platform/davinci/vpss.c
+++ b/drivers/media/platform/davinci/vpss.c
@@ -357,7 +357,7 @@ void dm365_vpss_set_pg_frame_size(struct vpss_pg_frame_size frame_size)
357} 357}
358EXPORT_SYMBOL(dm365_vpss_set_pg_frame_size); 358EXPORT_SYMBOL(dm365_vpss_set_pg_frame_size);
359 359
360static int __devinit vpss_probe(struct platform_device *pdev) 360static int vpss_probe(struct platform_device *pdev)
361{ 361{
362 struct resource *r1, *r2; 362 struct resource *r1, *r2;
363 char *platform_name; 363 char *platform_name;
@@ -445,7 +445,7 @@ fail1:
445 return status; 445 return status;
446} 446}
447 447
448static int __devexit vpss_remove(struct platform_device *pdev) 448static int vpss_remove(struct platform_device *pdev)
449{ 449{
450 struct resource *res; 450 struct resource *res;
451 451
@@ -465,7 +465,7 @@ static struct platform_driver vpss_driver = {
465 .name = "vpss", 465 .name = "vpss",
466 .owner = THIS_MODULE, 466 .owner = THIS_MODULE,
467 }, 467 },
468 .remove = __devexit_p(vpss_remove), 468 .remove = vpss_remove,
469 .probe = vpss_probe, 469 .probe = vpss_probe,
470}; 470};
471 471
diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c
index cc7b218d047c..2b1b9f30e1f9 100644
--- a/drivers/media/platform/exynos-gsc/gsc-core.c
+++ b/drivers/media/platform/exynos-gsc/gsc-core.c
@@ -1151,7 +1151,7 @@ err_clk:
1151 return ret; 1151 return ret;
1152} 1152}
1153 1153
1154static int __devexit gsc_remove(struct platform_device *pdev) 1154static int gsc_remove(struct platform_device *pdev)
1155{ 1155{
1156 struct gsc_dev *gsc = platform_get_drvdata(pdev); 1156 struct gsc_dev *gsc = platform_get_drvdata(pdev);
1157 1157
@@ -1237,7 +1237,7 @@ static const struct dev_pm_ops gsc_pm_ops = {
1237 1237
1238static struct platform_driver gsc_driver = { 1238static struct platform_driver gsc_driver = {
1239 .probe = gsc_probe, 1239 .probe = gsc_probe,
1240 .remove = __devexit_p(gsc_remove), 1240 .remove = gsc_remove,
1241 .id_table = gsc_driver_ids, 1241 .id_table = gsc_driver_ids,
1242 .driver = { 1242 .driver = {
1243 .name = GSC_MODULE_NAME, 1243 .name = GSC_MODULE_NAME,
diff --git a/drivers/media/platform/fsl-viu.c b/drivers/media/platform/fsl-viu.c
index a8ddb0cacab8..9115a2c8d075 100644
--- a/drivers/media/platform/fsl-viu.c
+++ b/drivers/media/platform/fsl-viu.c
@@ -1478,7 +1478,7 @@ static struct video_device viu_template = {
1478 .current_norm = V4L2_STD_NTSC_M, 1478 .current_norm = V4L2_STD_NTSC_M,
1479}; 1479};
1480 1480
1481static int __devinit viu_of_probe(struct platform_device *op) 1481static int viu_of_probe(struct platform_device *op)
1482{ 1482{
1483 struct viu_dev *viu_dev; 1483 struct viu_dev *viu_dev;
1484 struct video_device *vdev; 1484 struct video_device *vdev;
@@ -1615,7 +1615,7 @@ err:
1615 return ret; 1615 return ret;
1616} 1616}
1617 1617
1618static int __devexit viu_of_remove(struct platform_device *op) 1618static int viu_of_remove(struct platform_device *op)
1619{ 1619{
1620 struct v4l2_device *v4l2_dev = dev_get_drvdata(&op->dev); 1620 struct v4l2_device *v4l2_dev = dev_get_drvdata(&op->dev);
1621 struct viu_dev *dev = container_of(v4l2_dev, struct viu_dev, v4l2_dev); 1621 struct viu_dev *dev = container_of(v4l2_dev, struct viu_dev, v4l2_dev);
@@ -1668,7 +1668,7 @@ MODULE_DEVICE_TABLE(of, mpc512x_viu_of_match);
1668 1668
1669static struct platform_driver viu_of_platform_driver = { 1669static struct platform_driver viu_of_platform_driver = {
1670 .probe = viu_of_probe, 1670 .probe = viu_of_probe,
1671 .remove = __devexit_p(viu_of_remove), 1671 .remove = viu_of_remove,
1672#ifdef CONFIG_PM 1672#ifdef CONFIG_PM
1673 .suspend = viu_suspend, 1673 .suspend = viu_suspend,
1674 .resume = viu_resume, 1674 .resume = viu_resume,
diff --git a/drivers/media/platform/omap24xxcam.c b/drivers/media/platform/omap24xxcam.c
index 70f45c381318..8b7ccea982e7 100644
--- a/drivers/media/platform/omap24xxcam.c
+++ b/drivers/media/platform/omap24xxcam.c
@@ -1736,7 +1736,7 @@ static struct v4l2_int_device omap24xxcam = {
1736 * 1736 *
1737 */ 1737 */
1738 1738
1739static int __devinit omap24xxcam_probe(struct platform_device *pdev) 1739static int omap24xxcam_probe(struct platform_device *pdev)
1740{ 1740{
1741 struct omap24xxcam_device *cam; 1741 struct omap24xxcam_device *cam;
1742 struct resource *mem; 1742 struct resource *mem;
diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
index a9f6de5b69d8..e4aaee91201d 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -71,8 +71,6 @@
71#include <media/v4l2-common.h> 71#include <media/v4l2-common.h>
72#include <media/v4l2-device.h> 72#include <media/v4l2-device.h>
73 73
74#include <plat/cpu.h>
75
76#include "isp.h" 74#include "isp.h"
77#include "ispreg.h" 75#include "ispreg.h"
78#include "ispccdc.h" 76#include "ispccdc.h"
@@ -1992,7 +1990,7 @@ error_csiphy:
1992 * 1990 *
1993 * Always returns 0. 1991 * Always returns 0.
1994 */ 1992 */
1995static int __devexit isp_remove(struct platform_device *pdev) 1993static int isp_remove(struct platform_device *pdev)
1996{ 1994{
1997 struct isp_device *isp = platform_get_drvdata(pdev); 1995 struct isp_device *isp = platform_get_drvdata(pdev);
1998 int i; 1996 int i;
@@ -2073,7 +2071,7 @@ static int isp_map_mem_resource(struct platform_device *pdev,
2073 * -EINVAL if couldn't install ISR, 2071 * -EINVAL if couldn't install ISR,
2074 * or clk_get return error value. 2072 * or clk_get return error value.
2075 */ 2073 */
2076static int __devinit isp_probe(struct platform_device *pdev) 2074static int isp_probe(struct platform_device *pdev)
2077{ 2075{
2078 struct isp_platform_data *pdata = pdev->dev.platform_data; 2076 struct isp_platform_data *pdata = pdev->dev.platform_data;
2079 struct isp_device *isp; 2077 struct isp_device *isp;
@@ -2252,7 +2250,7 @@ MODULE_DEVICE_TABLE(platform, omap3isp_id_table);
2252 2250
2253static struct platform_driver omap3isp_driver = { 2251static struct platform_driver omap3isp_driver = {
2254 .probe = isp_probe, 2252 .probe = isp_probe,
2255 .remove = __devexit_p(isp_remove), 2253 .remove = isp_remove,
2256 .id_table = omap3isp_id_table, 2254 .id_table = omap3isp_id_table,
2257 .driver = { 2255 .driver = {
2258 .owner = THIS_MODULE, 2256 .owner = THIS_MODULE,
diff --git a/drivers/media/platform/omap3isp/ispvideo.c b/drivers/media/platform/omap3isp/ispvideo.c
index e0d73a642186..8dac17511e61 100644
--- a/drivers/media/platform/omap3isp/ispvideo.c
+++ b/drivers/media/platform/omap3isp/ispvideo.c
@@ -35,9 +35,6 @@
35#include <linux/vmalloc.h> 35#include <linux/vmalloc.h>
36#include <media/v4l2-dev.h> 36#include <media/v4l2-dev.h>
37#include <media/v4l2-ioctl.h> 37#include <media/v4l2-ioctl.h>
38#include <plat/iommu.h>
39#include <plat/iovmm.h>
40#include <plat/omap-pm.h>
41 38
42#include "ispvideo.h" 39#include "ispvideo.h"
43#include "isp.h" 40#include "isp.h"
diff --git a/drivers/media/platform/s3c-camif/camif-core.c b/drivers/media/platform/s3c-camif/camif-core.c
index 0dd65376c067..e2716c35f8f1 100644
--- a/drivers/media/platform/s3c-camif/camif-core.c
+++ b/drivers/media/platform/s3c-camif/camif-core.c
@@ -531,7 +531,7 @@ err_sd:
531 return ret; 531 return ret;
532} 532}
533 533
534static int __devexit s3c_camif_remove(struct platform_device *pdev) 534static int s3c_camif_remove(struct platform_device *pdev)
535{ 535{
536 struct camif_dev *camif = platform_get_drvdata(pdev); 536 struct camif_dev *camif = platform_get_drvdata(pdev);
537 struct s3c_camif_plat_data *pdata = &camif->pdata; 537 struct s3c_camif_plat_data *pdata = &camif->pdata;
@@ -645,7 +645,7 @@ static const struct dev_pm_ops s3c_camif_pm_ops = {
645 645
646static struct platform_driver s3c_camif_driver = { 646static struct platform_driver s3c_camif_driver = {
647 .probe = s3c_camif_probe, 647 .probe = s3c_camif_probe,
648 .remove = __devexit_p(s3c_camif_remove), 648 .remove = s3c_camif_remove,
649 .id_table = s3c_camif_driver_ids, 649 .id_table = s3c_camif_driver_ids,
650 .driver = { 650 .driver = {
651 .name = S3C_CAMIF_DRIVER_NAME, 651 .name = S3C_CAMIF_DRIVER_NAME,
diff --git a/drivers/media/platform/s5p-fimc/fimc-core.c b/drivers/media/platform/s5p-fimc/fimc-core.c
index 8d0d2b94a135..545b46ae12a1 100644
--- a/drivers/media/platform/s5p-fimc/fimc-core.c
+++ b/drivers/media/platform/s5p-fimc/fimc-core.c
@@ -1035,7 +1035,7 @@ static int fimc_suspend(struct device *dev)
1035} 1035}
1036#endif /* CONFIG_PM_SLEEP */ 1036#endif /* CONFIG_PM_SLEEP */
1037 1037
1038static int __devexit fimc_remove(struct platform_device *pdev) 1038static int fimc_remove(struct platform_device *pdev)
1039{ 1039{
1040 struct fimc_dev *fimc = platform_get_drvdata(pdev); 1040 struct fimc_dev *fimc = platform_get_drvdata(pdev);
1041 1041
@@ -1234,7 +1234,7 @@ static const struct dev_pm_ops fimc_pm_ops = {
1234 1234
1235static struct platform_driver fimc_driver = { 1235static struct platform_driver fimc_driver = {
1236 .probe = fimc_probe, 1236 .probe = fimc_probe,
1237 .remove = __devexit_p(fimc_remove), 1237 .remove = fimc_remove,
1238 .id_table = fimc_driver_ids, 1238 .id_table = fimc_driver_ids,
1239 .driver = { 1239 .driver = {
1240 .name = FIMC_MODULE_NAME, 1240 .name = FIMC_MODULE_NAME,
diff --git a/drivers/media/platform/s5p-fimc/fimc-lite.c b/drivers/media/platform/s5p-fimc/fimc-lite.c
index 1b309a72f09f..ed67220d0a64 100644
--- a/drivers/media/platform/s5p-fimc/fimc-lite.c
+++ b/drivers/media/platform/s5p-fimc/fimc-lite.c
@@ -1406,7 +1406,7 @@ static int fimc_lite_clk_get(struct fimc_lite *fimc)
1406 return ret; 1406 return ret;
1407} 1407}
1408 1408
1409static int __devinit fimc_lite_probe(struct platform_device *pdev) 1409static int fimc_lite_probe(struct platform_device *pdev)
1410{ 1410{
1411 struct flite_drvdata *drv_data = fimc_lite_get_drvdata(pdev); 1411 struct flite_drvdata *drv_data = fimc_lite_get_drvdata(pdev);
1412 struct fimc_lite *fimc; 1412 struct fimc_lite *fimc;
@@ -1547,7 +1547,7 @@ static int fimc_lite_suspend(struct device *dev)
1547} 1547}
1548#endif /* CONFIG_PM_SLEEP */ 1548#endif /* CONFIG_PM_SLEEP */
1549 1549
1550static int __devexit fimc_lite_remove(struct platform_device *pdev) 1550static int fimc_lite_remove(struct platform_device *pdev)
1551{ 1551{
1552 struct fimc_lite *fimc = platform_get_drvdata(pdev); 1552 struct fimc_lite *fimc = platform_get_drvdata(pdev);
1553 struct device *dev = &pdev->dev; 1553 struct device *dev = &pdev->dev;
@@ -1595,7 +1595,7 @@ static const struct dev_pm_ops fimc_lite_pm_ops = {
1595 1595
1596static struct platform_driver fimc_lite_driver = { 1596static struct platform_driver fimc_lite_driver = {
1597 .probe = fimc_lite_probe, 1597 .probe = fimc_lite_probe,
1598 .remove = __devexit_p(fimc_lite_remove), 1598 .remove = fimc_lite_remove,
1599 .id_table = fimc_lite_driver_ids, 1599 .id_table = fimc_lite_driver_ids,
1600 .driver = { 1600 .driver = {
1601 .name = FIMC_LITE_DRV_NAME, 1601 .name = FIMC_LITE_DRV_NAME,
diff --git a/drivers/media/platform/s5p-fimc/fimc-mdevice.c b/drivers/media/platform/s5p-fimc/fimc-mdevice.c
index 1bd5678cfeb9..b4a68ecf0ca7 100644
--- a/drivers/media/platform/s5p-fimc/fimc-mdevice.c
+++ b/drivers/media/platform/s5p-fimc/fimc-mdevice.c
@@ -593,7 +593,7 @@ static int __fimc_md_create_flite_source_links(struct fimc_md *fmd)
593{ 593{
594 struct media_entity *source, *sink; 594 struct media_entity *source, *sink;
595 unsigned int flags = MEDIA_LNK_FL_ENABLED; 595 unsigned int flags = MEDIA_LNK_FL_ENABLED;
596 int i, ret; 596 int i, ret = 0;
597 597
598 for (i = 0; i < FIMC_LITE_MAX_DEVS; i++) { 598 for (i = 0; i < FIMC_LITE_MAX_DEVS; i++) {
599 struct fimc_lite *fimc = fmd->fimc_lite[i]; 599 struct fimc_lite *fimc = fmd->fimc_lite[i];
@@ -1000,7 +1000,7 @@ err_md:
1000 return ret; 1000 return ret;
1001} 1001}
1002 1002
1003static int __devexit fimc_md_remove(struct platform_device *pdev) 1003static int fimc_md_remove(struct platform_device *pdev)
1004{ 1004{
1005 struct fimc_md *fmd = platform_get_drvdata(pdev); 1005 struct fimc_md *fmd = platform_get_drvdata(pdev);
1006 1006
@@ -1015,7 +1015,7 @@ static int __devexit fimc_md_remove(struct platform_device *pdev)
1015 1015
1016static struct platform_driver fimc_md_driver = { 1016static struct platform_driver fimc_md_driver = {
1017 .probe = fimc_md_probe, 1017 .probe = fimc_md_probe,
1018 .remove = __devexit_p(fimc_md_remove), 1018 .remove = fimc_md_remove,
1019 .driver = { 1019 .driver = {
1020 .name = "s5p-fimc-md", 1020 .name = "s5p-fimc-md",
1021 .owner = THIS_MODULE, 1021 .owner = THIS_MODULE,
diff --git a/drivers/media/platform/s5p-fimc/mipi-csis.c b/drivers/media/platform/s5p-fimc/mipi-csis.c
index 4c961b1b68e6..ec3fa7d75306 100644
--- a/drivers/media/platform/s5p-fimc/mipi-csis.c
+++ b/drivers/media/platform/s5p-fimc/mipi-csis.c
@@ -654,7 +654,7 @@ static irqreturn_t s5pcsis_irq_handler(int irq, void *dev_id)
654 return IRQ_HANDLED; 654 return IRQ_HANDLED;
655} 655}
656 656
657static int __devinit s5pcsis_probe(struct platform_device *pdev) 657static int s5pcsis_probe(struct platform_device *pdev)
658{ 658{
659 struct s5p_platform_mipi_csis *pdata; 659 struct s5p_platform_mipi_csis *pdata;
660 struct resource *mem_res; 660 struct resource *mem_res;
@@ -851,7 +851,7 @@ static int s5pcsis_runtime_resume(struct device *dev)
851} 851}
852#endif 852#endif
853 853
854static int __devexit s5pcsis_remove(struct platform_device *pdev) 854static int s5pcsis_remove(struct platform_device *pdev)
855{ 855{
856 struct v4l2_subdev *sd = platform_get_drvdata(pdev); 856 struct v4l2_subdev *sd = platform_get_drvdata(pdev);
857 struct csis_state *state = sd_to_csis_state(sd); 857 struct csis_state *state = sd_to_csis_state(sd);
@@ -876,7 +876,7 @@ static const struct dev_pm_ops s5pcsis_pm_ops = {
876 876
877static struct platform_driver s5pcsis_driver = { 877static struct platform_driver s5pcsis_driver = {
878 .probe = s5pcsis_probe, 878 .probe = s5pcsis_probe,
879 .remove = __devexit_p(s5pcsis_remove), 879 .remove = s5pcsis_remove,
880 .driver = { 880 .driver = {
881 .name = CSIS_DRIVER_NAME, 881 .name = CSIS_DRIVER_NAME,
882 .owner = THIS_MODULE, 882 .owner = THIS_MODULE,
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index 3afe879d54d7..681bc6ba149d 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -412,62 +412,48 @@ leave_handle_frame:
412} 412}
413 413
414/* Error handling for interrupt */ 414/* Error handling for interrupt */
415static void s5p_mfc_handle_error(struct s5p_mfc_ctx *ctx, 415static void s5p_mfc_handle_error(struct s5p_mfc_dev *dev,
416 unsigned int reason, unsigned int err) 416 struct s5p_mfc_ctx *ctx, unsigned int reason, unsigned int err)
417{ 417{
418 struct s5p_mfc_dev *dev;
419 unsigned long flags; 418 unsigned long flags;
420 419
421 /* If no context is available then all necessary
422 * processing has been done. */
423 if (ctx == NULL)
424 return;
425
426 dev = ctx->dev;
427 mfc_err("Interrupt Error: %08x\n", err); 420 mfc_err("Interrupt Error: %08x\n", err);
428 s5p_mfc_hw_call(dev->mfc_ops, clear_int_flags, dev);
429 wake_up_dev(dev, reason, err);
430 421
431 /* Error recovery is dependent on the state of context */ 422 if (ctx != NULL) {
432 switch (ctx->state) { 423 /* Error recovery is dependent on the state of context */
433 case MFCINST_INIT: 424 switch (ctx->state) {
434 /* This error had to happen while acquireing instance */ 425 case MFCINST_RES_CHANGE_INIT:
435 case MFCINST_GOT_INST: 426 case MFCINST_RES_CHANGE_FLUSH:
436 /* This error had to happen while parsing the header */ 427 case MFCINST_RES_CHANGE_END:
437 case MFCINST_HEAD_PARSED: 428 case MFCINST_FINISHING:
438 /* This error had to happen while setting dst buffers */ 429 case MFCINST_FINISHED:
439 case MFCINST_RETURN_INST: 430 case MFCINST_RUNNING:
440 /* This error had to happen while releasing instance */ 431 /* It is higly probable that an error occured
441 clear_work_bit(ctx); 432 * while decoding a frame */
442 wake_up_ctx(ctx, reason, err); 433 clear_work_bit(ctx);
443 if (test_and_clear_bit(0, &dev->hw_lock) == 0) 434 ctx->state = MFCINST_ERROR;
444 BUG(); 435 /* Mark all dst buffers as having an error */
445 s5p_mfc_clock_off(); 436 spin_lock_irqsave(&dev->irqlock, flags);
446 ctx->state = MFCINST_ERROR; 437 s5p_mfc_hw_call(dev->mfc_ops, cleanup_queue,
447 break; 438 &ctx->dst_queue, &ctx->vq_dst);
448 case MFCINST_FINISHING: 439 /* Mark all src buffers as having an error */
449 case MFCINST_FINISHED: 440 s5p_mfc_hw_call(dev->mfc_ops, cleanup_queue,
450 case MFCINST_RUNNING: 441 &ctx->src_queue, &ctx->vq_src);
451 /* It is higly probable that an error occured 442 spin_unlock_irqrestore(&dev->irqlock, flags);
452 * while decoding a frame */ 443 wake_up_ctx(ctx, reason, err);
453 clear_work_bit(ctx); 444 break;
454 ctx->state = MFCINST_ERROR; 445 default:
455 /* Mark all dst buffers as having an error */ 446 clear_work_bit(ctx);
456 spin_lock_irqsave(&dev->irqlock, flags); 447 ctx->state = MFCINST_ERROR;
457 s5p_mfc_hw_call(dev->mfc_ops, cleanup_queue, &ctx->dst_queue, 448 wake_up_ctx(ctx, reason, err);
458 &ctx->vq_dst); 449 break;
459 /* Mark all src buffers as having an error */ 450 }
460 s5p_mfc_hw_call(dev->mfc_ops, cleanup_queue, &ctx->src_queue,
461 &ctx->vq_src);
462 spin_unlock_irqrestore(&dev->irqlock, flags);
463 if (test_and_clear_bit(0, &dev->hw_lock) == 0)
464 BUG();
465 s5p_mfc_clock_off();
466 break;
467 default:
468 mfc_err("Encountered an error interrupt which had not been handled\n");
469 break;
470 } 451 }
452 if (test_and_clear_bit(0, &dev->hw_lock) == 0)
453 BUG();
454 s5p_mfc_hw_call(dev->mfc_ops, clear_int_flags, dev);
455 s5p_mfc_clock_off();
456 wake_up_dev(dev, reason, err);
471 return; 457 return;
472} 458}
473 459
@@ -632,7 +618,7 @@ static irqreturn_t s5p_mfc_irq(int irq, void *priv)
632 dev->warn_start) 618 dev->warn_start)
633 s5p_mfc_handle_frame(ctx, reason, err); 619 s5p_mfc_handle_frame(ctx, reason, err);
634 else 620 else
635 s5p_mfc_handle_error(ctx, reason, err); 621 s5p_mfc_handle_error(dev, ctx, reason, err);
636 clear_bit(0, &dev->enter_suspend); 622 clear_bit(0, &dev->enter_suspend);
637 break; 623 break;
638 624
@@ -1203,7 +1189,7 @@ err_res:
1203} 1189}
1204 1190
1205/* Remove the driver */ 1191/* Remove the driver */
1206static int __devexit s5p_mfc_remove(struct platform_device *pdev) 1192static int s5p_mfc_remove(struct platform_device *pdev)
1207{ 1193{
1208 struct s5p_mfc_dev *dev = platform_get_drvdata(pdev); 1194 struct s5p_mfc_dev *dev = platform_get_drvdata(pdev);
1209 1195
@@ -1368,7 +1354,7 @@ MODULE_DEVICE_TABLE(platform, mfc_driver_ids);
1368 1354
1369static struct platform_driver s5p_mfc_driver = { 1355static struct platform_driver s5p_mfc_driver = {
1370 .probe = s5p_mfc_probe, 1356 .probe = s5p_mfc_probe,
1371 .remove = __devexit_p(s5p_mfc_remove), 1357 .remove = s5p_mfc_remove,
1372 .id_table = mfc_driver_ids, 1358 .id_table = mfc_driver_ids,
1373 .driver = { 1359 .driver = {
1374 .name = S5P_MFC_NAME, 1360 .name = S5P_MFC_NAME,
diff --git a/drivers/media/platform/s5p-tv/hdmi_drv.c b/drivers/media/platform/s5p-tv/hdmi_drv.c
index 8a9cf43018f6..7c1116c73bf3 100644
--- a/drivers/media/platform/s5p-tv/hdmi_drv.c
+++ b/drivers/media/platform/s5p-tv/hdmi_drv.c
@@ -830,7 +830,7 @@ fail:
830 return -ENODEV; 830 return -ENODEV;
831} 831}
832 832
833static int __devinit hdmi_probe(struct platform_device *pdev) 833static int hdmi_probe(struct platform_device *pdev)
834{ 834{
835 struct device *dev = &pdev->dev; 835 struct device *dev = &pdev->dev;
836 struct resource *res; 836 struct resource *res;
@@ -979,7 +979,7 @@ fail:
979 return ret; 979 return ret;
980} 980}
981 981
982static int __devexit hdmi_remove(struct platform_device *pdev) 982static int hdmi_remove(struct platform_device *pdev)
983{ 983{
984 struct device *dev = &pdev->dev; 984 struct device *dev = &pdev->dev;
985 struct v4l2_subdev *sd = dev_get_drvdata(dev); 985 struct v4l2_subdev *sd = dev_get_drvdata(dev);
@@ -997,7 +997,7 @@ static int __devexit hdmi_remove(struct platform_device *pdev)
997 997
998static struct platform_driver hdmi_driver __refdata = { 998static struct platform_driver hdmi_driver __refdata = {
999 .probe = hdmi_probe, 999 .probe = hdmi_probe,
1000 .remove = __devexit_p(hdmi_remove), 1000 .remove = hdmi_remove,
1001 .id_table = hdmi_driver_types, 1001 .id_table = hdmi_driver_types,
1002 .driver = { 1002 .driver = {
1003 .name = "s5p-hdmi", 1003 .name = "s5p-hdmi",
diff --git a/drivers/media/platform/s5p-tv/hdmiphy_drv.c b/drivers/media/platform/s5p-tv/hdmiphy_drv.c
index f67b38631801..06b5d2dbb2d9 100644
--- a/drivers/media/platform/s5p-tv/hdmiphy_drv.c
+++ b/drivers/media/platform/s5p-tv/hdmiphy_drv.c
@@ -279,8 +279,8 @@ static const struct v4l2_subdev_ops hdmiphy_ops = {
279 .video = &hdmiphy_video_ops, 279 .video = &hdmiphy_video_ops,
280}; 280};
281 281
282static int __devinit hdmiphy_probe(struct i2c_client *client, 282static int hdmiphy_probe(struct i2c_client *client,
283 const struct i2c_device_id *id) 283 const struct i2c_device_id *id)
284{ 284{
285 struct hdmiphy_ctx *ctx; 285 struct hdmiphy_ctx *ctx;
286 286
@@ -295,7 +295,7 @@ static int __devinit hdmiphy_probe(struct i2c_client *client,
295 return 0; 295 return 0;
296} 296}
297 297
298static int __devexit hdmiphy_remove(struct i2c_client *client) 298static int hdmiphy_remove(struct i2c_client *client)
299{ 299{
300 struct v4l2_subdev *sd = i2c_get_clientdata(client); 300 struct v4l2_subdev *sd = i2c_get_clientdata(client);
301 struct hdmiphy_ctx *ctx = sd_to_ctx(sd); 301 struct hdmiphy_ctx *ctx = sd_to_ctx(sd);
@@ -322,7 +322,7 @@ static struct i2c_driver hdmiphy_driver = {
322 .owner = THIS_MODULE, 322 .owner = THIS_MODULE,
323 }, 323 },
324 .probe = hdmiphy_probe, 324 .probe = hdmiphy_probe,
325 .remove = __devexit_p(hdmiphy_remove), 325 .remove = hdmiphy_remove,
326 .id_table = hdmiphy_id, 326 .id_table = hdmiphy_id,
327}; 327};
328 328
diff --git a/drivers/media/platform/s5p-tv/mixer.h b/drivers/media/platform/s5p-tv/mixer.h
index ddb422e23550..b671e20e9318 100644
--- a/drivers/media/platform/s5p-tv/mixer.h
+++ b/drivers/media/platform/s5p-tv/mixer.h
@@ -290,7 +290,7 @@ static inline struct v4l2_subdev *to_outsd(struct mxr_device *mdev)
290struct mxr_platform_data; 290struct mxr_platform_data;
291 291
292/** acquiring common video resources */ 292/** acquiring common video resources */
293int __devinit mxr_acquire_video(struct mxr_device *mdev, 293int mxr_acquire_video(struct mxr_device *mdev,
294 struct mxr_output_conf *output_cont, int output_count); 294 struct mxr_output_conf *output_cont, int output_count);
295 295
296/** releasing common video resources */ 296/** releasing common video resources */
diff --git a/drivers/media/platform/s5p-tv/mixer_drv.c b/drivers/media/platform/s5p-tv/mixer_drv.c
index ca0f29717448..02faea03aa7d 100644
--- a/drivers/media/platform/s5p-tv/mixer_drv.c
+++ b/drivers/media/platform/s5p-tv/mixer_drv.c
@@ -151,8 +151,8 @@ void mxr_power_put(struct mxr_device *mdev)
151 151
152/* --------- RESOURCE MANAGEMENT -------------*/ 152/* --------- RESOURCE MANAGEMENT -------------*/
153 153
154static int __devinit mxr_acquire_plat_resources(struct mxr_device *mdev, 154static int mxr_acquire_plat_resources(struct mxr_device *mdev,
155 struct platform_device *pdev) 155 struct platform_device *pdev)
156{ 156{
157 struct resource *res; 157 struct resource *res;
158 int ret; 158 int ret;
@@ -271,8 +271,8 @@ fail:
271 return -ENODEV; 271 return -ENODEV;
272} 272}
273 273
274static int __devinit mxr_acquire_resources(struct mxr_device *mdev, 274static int mxr_acquire_resources(struct mxr_device *mdev,
275 struct platform_device *pdev) 275 struct platform_device *pdev)
276{ 276{
277 int ret; 277 int ret;
278 ret = mxr_acquire_plat_resources(mdev, pdev); 278 ret = mxr_acquire_plat_resources(mdev, pdev);
@@ -310,8 +310,8 @@ static void mxr_release_layers(struct mxr_device *mdev)
310 mxr_layer_release(mdev->layer[i]); 310 mxr_layer_release(mdev->layer[i]);
311} 311}
312 312
313static int __devinit mxr_acquire_layers(struct mxr_device *mdev, 313static int mxr_acquire_layers(struct mxr_device *mdev,
314 struct mxr_platform_data *pdata) 314 struct mxr_platform_data *pdata)
315{ 315{
316 mdev->layer[0] = mxr_graph_layer_create(mdev, 0); 316 mdev->layer[0] = mxr_graph_layer_create(mdev, 0);
317 mdev->layer[1] = mxr_graph_layer_create(mdev, 1); 317 mdev->layer[1] = mxr_graph_layer_create(mdev, 1);
@@ -372,7 +372,7 @@ static const struct dev_pm_ops mxr_pm_ops = {
372 372
373/* --------- DRIVER INITIALIZATION ---------- */ 373/* --------- DRIVER INITIALIZATION ---------- */
374 374
375static int __devinit mxr_probe(struct platform_device *pdev) 375static int mxr_probe(struct platform_device *pdev)
376{ 376{
377 struct device *dev = &pdev->dev; 377 struct device *dev = &pdev->dev;
378 struct mxr_platform_data *pdata = dev->platform_data; 378 struct mxr_platform_data *pdata = dev->platform_data;
@@ -431,7 +431,7 @@ fail:
431 return ret; 431 return ret;
432} 432}
433 433
434static int __devexit mxr_remove(struct platform_device *pdev) 434static int mxr_remove(struct platform_device *pdev)
435{ 435{
436 struct device *dev = &pdev->dev; 436 struct device *dev = &pdev->dev;
437 struct mxr_device *mdev = to_mdev(dev); 437 struct mxr_device *mdev = to_mdev(dev);
@@ -450,7 +450,7 @@ static int __devexit mxr_remove(struct platform_device *pdev)
450 450
451static struct platform_driver mxr_driver __refdata = { 451static struct platform_driver mxr_driver __refdata = {
452 .probe = mxr_probe, 452 .probe = mxr_probe,
453 .remove = __devexit_p(mxr_remove), 453 .remove = mxr_remove,
454 .driver = { 454 .driver = {
455 .name = MXR_DRIVER_NAME, 455 .name = MXR_DRIVER_NAME,
456 .owner = THIS_MODULE, 456 .owner = THIS_MODULE,
diff --git a/drivers/media/platform/s5p-tv/mixer_video.c b/drivers/media/platform/s5p-tv/mixer_video.c
index 7379e77bf4e1..1f3b7436511c 100644
--- a/drivers/media/platform/s5p-tv/mixer_video.c
+++ b/drivers/media/platform/s5p-tv/mixer_video.c
@@ -62,8 +62,8 @@ done:
62 return sd; 62 return sd;
63} 63}
64 64
65int __devinit mxr_acquire_video(struct mxr_device *mdev, 65int mxr_acquire_video(struct mxr_device *mdev,
66 struct mxr_output_conf *output_conf, int output_count) 66 struct mxr_output_conf *output_conf, int output_count)
67{ 67{
68 struct device *dev = mdev->dev; 68 struct device *dev = mdev->dev;
69 struct v4l2_device *v4l2_dev = &mdev->v4l2_dev; 69 struct v4l2_device *v4l2_dev = &mdev->v4l2_dev;
diff --git a/drivers/media/platform/s5p-tv/sdo_drv.c b/drivers/media/platform/s5p-tv/sdo_drv.c
index ad68bbed014e..91a6939a270a 100644
--- a/drivers/media/platform/s5p-tv/sdo_drv.c
+++ b/drivers/media/platform/s5p-tv/sdo_drv.c
@@ -292,7 +292,7 @@ static const struct dev_pm_ops sdo_pm_ops = {
292 .runtime_resume = sdo_runtime_resume, 292 .runtime_resume = sdo_runtime_resume,
293}; 293};
294 294
295static int __devinit sdo_probe(struct platform_device *pdev) 295static int sdo_probe(struct platform_device *pdev)
296{ 296{
297 struct device *dev = &pdev->dev; 297 struct device *dev = &pdev->dev;
298 struct sdo_device *sdev; 298 struct sdo_device *sdev;
@@ -419,7 +419,7 @@ fail:
419 return ret; 419 return ret;
420} 420}
421 421
422static int __devexit sdo_remove(struct platform_device *pdev) 422static int sdo_remove(struct platform_device *pdev)
423{ 423{
424 struct v4l2_subdev *sd = dev_get_drvdata(&pdev->dev); 424 struct v4l2_subdev *sd = dev_get_drvdata(&pdev->dev);
425 struct sdo_device *sdev = sd_to_sdev(sd); 425 struct sdo_device *sdev = sd_to_sdev(sd);
@@ -437,7 +437,7 @@ static int __devexit sdo_remove(struct platform_device *pdev)
437 437
438static struct platform_driver sdo_driver __refdata = { 438static struct platform_driver sdo_driver __refdata = {
439 .probe = sdo_probe, 439 .probe = sdo_probe,
440 .remove = __devexit_p(sdo_remove), 440 .remove = sdo_remove,
441 .driver = { 441 .driver = {
442 .name = "s5p-sdo", 442 .name = "s5p-sdo",
443 .owner = THIS_MODULE, 443 .owner = THIS_MODULE,
diff --git a/drivers/media/platform/s5p-tv/sii9234_drv.c b/drivers/media/platform/s5p-tv/sii9234_drv.c
index 716d4846f8bd..49191aac9634 100644
--- a/drivers/media/platform/s5p-tv/sii9234_drv.c
+++ b/drivers/media/platform/s5p-tv/sii9234_drv.c
@@ -315,8 +315,8 @@ static const struct v4l2_subdev_ops sii9234_ops = {
315 .video = &sii9234_video_ops, 315 .video = &sii9234_video_ops,
316}; 316};
317 317
318static int __devinit sii9234_probe(struct i2c_client *client, 318static int sii9234_probe(struct i2c_client *client,
319 const struct i2c_device_id *id) 319 const struct i2c_device_id *id)
320{ 320{
321 struct device *dev = &client->dev; 321 struct device *dev = &client->dev;
322 struct sii9234_platform_data *pdata = dev->platform_data; 322 struct sii9234_platform_data *pdata = dev->platform_data;
@@ -378,7 +378,7 @@ fail:
378 return ret; 378 return ret;
379} 379}
380 380
381static int __devexit sii9234_remove(struct i2c_client *client) 381static int sii9234_remove(struct i2c_client *client)
382{ 382{
383 struct device *dev = &client->dev; 383 struct device *dev = &client->dev;
384 struct v4l2_subdev *sd = i2c_get_clientdata(client); 384 struct v4l2_subdev *sd = i2c_get_clientdata(client);
@@ -406,7 +406,7 @@ static struct i2c_driver sii9234_driver = {
406 .pm = &sii9234_pm_ops, 406 .pm = &sii9234_pm_ops,
407 }, 407 },
408 .probe = sii9234_probe, 408 .probe = sii9234_probe,
409 .remove = __devexit_p(sii9234_remove), 409 .remove = sii9234_remove,
410 .id_table = sii9234_id, 410 .id_table = sii9234_id,
411}; 411};
412 412
diff --git a/drivers/media/platform/sh_vou.c b/drivers/media/platform/sh_vou.c
index a1c87f0ceaab..f3c4571ac01e 100644
--- a/drivers/media/platform/sh_vou.c
+++ b/drivers/media/platform/sh_vou.c
@@ -1326,7 +1326,7 @@ static const struct video_device sh_vou_video_template = {
1326 .vfl_dir = VFL_DIR_TX, 1326 .vfl_dir = VFL_DIR_TX,
1327}; 1327};
1328 1328
1329static int __devinit sh_vou_probe(struct platform_device *pdev) 1329static int sh_vou_probe(struct platform_device *pdev)
1330{ 1330{
1331 struct sh_vou_pdata *vou_pdata = pdev->dev.platform_data; 1331 struct sh_vou_pdata *vou_pdata = pdev->dev.platform_data;
1332 struct v4l2_rect *rect; 1332 struct v4l2_rect *rect;
@@ -1461,7 +1461,7 @@ ereqmemreg:
1461 return ret; 1461 return ret;
1462} 1462}
1463 1463
1464static int __devexit sh_vou_remove(struct platform_device *pdev) 1464static int sh_vou_remove(struct platform_device *pdev)
1465{ 1465{
1466 int irq = platform_get_irq(pdev, 0); 1466 int irq = platform_get_irq(pdev, 0);
1467 struct v4l2_device *v4l2_dev = platform_get_drvdata(pdev); 1467 struct v4l2_device *v4l2_dev = platform_get_drvdata(pdev);
@@ -1487,7 +1487,7 @@ static int __devexit sh_vou_remove(struct platform_device *pdev)
1487} 1487}
1488 1488
1489static struct platform_driver __refdata sh_vou = { 1489static struct platform_driver __refdata sh_vou = {
1490 .remove = __devexit_p(sh_vou_remove), 1490 .remove = sh_vou_remove,
1491 .driver = { 1491 .driver = {
1492 .name = "sh-vou", 1492 .name = "sh-vou",
1493 .owner = THIS_MODULE, 1493 .owner = THIS_MODULE,
diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c
index 6274a91c25c7..d96c8c7e01d9 100644
--- a/drivers/media/platform/soc_camera/atmel-isi.c
+++ b/drivers/media/platform/soc_camera/atmel-isi.c
@@ -897,7 +897,7 @@ static struct soc_camera_host_ops isi_soc_camera_host_ops = {
897}; 897};
898 898
899/* -----------------------------------------------------------------------*/ 899/* -----------------------------------------------------------------------*/
900static int __devexit atmel_isi_remove(struct platform_device *pdev) 900static int atmel_isi_remove(struct platform_device *pdev)
901{ 901{
902 struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev); 902 struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev);
903 struct atmel_isi *isi = container_of(soc_host, 903 struct atmel_isi *isi = container_of(soc_host,
@@ -921,7 +921,7 @@ static int __devexit atmel_isi_remove(struct platform_device *pdev)
921 return 0; 921 return 0;
922} 922}
923 923
924static int __devinit atmel_isi_probe(struct platform_device *pdev) 924static int atmel_isi_probe(struct platform_device *pdev)
925{ 925{
926 unsigned int irq; 926 unsigned int irq;
927 struct atmel_isi *isi; 927 struct atmel_isi *isi;
@@ -1074,7 +1074,7 @@ err_clk_prepare_pclk:
1074 1074
1075static struct platform_driver atmel_isi_driver = { 1075static struct platform_driver atmel_isi_driver = {
1076 .probe = atmel_isi_probe, 1076 .probe = atmel_isi_probe,
1077 .remove = __devexit_p(atmel_isi_remove), 1077 .remove = atmel_isi_remove,
1078 .driver = { 1078 .driver = {
1079 .name = "atmel_isi", 1079 .name = "atmel_isi",
1080 .owner = THIS_MODULE, 1080 .owner = THIS_MODULE,
diff --git a/drivers/media/platform/soc_camera/mx2_camera.c b/drivers/media/platform/soc_camera/mx2_camera.c
index 791cd1d54a76..8bda2c908aba 100644
--- a/drivers/media/platform/soc_camera/mx2_camera.c
+++ b/drivers/media/platform/soc_camera/mx2_camera.c
@@ -1692,7 +1692,7 @@ static irqreturn_t mx27_camera_emma_irq(int irq_emma, void *data)
1692 return IRQ_HANDLED; 1692 return IRQ_HANDLED;
1693} 1693}
1694 1694
1695static int __devinit mx27_camera_emma_init(struct platform_device *pdev) 1695static int mx27_camera_emma_init(struct platform_device *pdev)
1696{ 1696{
1697 struct mx2_camera_dev *pcdev = platform_get_drvdata(pdev); 1697 struct mx2_camera_dev *pcdev = platform_get_drvdata(pdev);
1698 struct resource *res_emma; 1698 struct resource *res_emma;
@@ -1750,7 +1750,7 @@ out:
1750 return err; 1750 return err;
1751} 1751}
1752 1752
1753static int __devinit mx2_camera_probe(struct platform_device *pdev) 1753static int mx2_camera_probe(struct platform_device *pdev)
1754{ 1754{
1755 struct mx2_camera_dev *pcdev; 1755 struct mx2_camera_dev *pcdev;
1756 struct resource *res_csi; 1756 struct resource *res_csi;
@@ -1887,7 +1887,7 @@ exit:
1887 return err; 1887 return err;
1888} 1888}
1889 1889
1890static int __devexit mx2_camera_remove(struct platform_device *pdev) 1890static int mx2_camera_remove(struct platform_device *pdev)
1891{ 1891{
1892 struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev); 1892 struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev);
1893 struct mx2_camera_dev *pcdev = container_of(soc_host, 1893 struct mx2_camera_dev *pcdev = container_of(soc_host,
@@ -1912,7 +1912,7 @@ static struct platform_driver mx2_camera_driver = {
1912 .name = MX2_CAM_DRV_NAME, 1912 .name = MX2_CAM_DRV_NAME,
1913 }, 1913 },
1914 .id_table = mx2_camera_devtype, 1914 .id_table = mx2_camera_devtype,
1915 .remove = __devexit_p(mx2_camera_remove), 1915 .remove = mx2_camera_remove,
1916}; 1916};
1917 1917
1918 1918
diff --git a/drivers/media/platform/soc_camera/mx3_camera.c b/drivers/media/platform/soc_camera/mx3_camera.c
index 06d16de76377..45aef1053a49 100644
--- a/drivers/media/platform/soc_camera/mx3_camera.c
+++ b/drivers/media/platform/soc_camera/mx3_camera.c
@@ -1143,7 +1143,7 @@ static struct soc_camera_host_ops mx3_soc_camera_host_ops = {
1143 .set_bus_param = mx3_camera_set_bus_param, 1143 .set_bus_param = mx3_camera_set_bus_param,
1144}; 1144};
1145 1145
1146static int __devinit mx3_camera_probe(struct platform_device *pdev) 1146static int mx3_camera_probe(struct platform_device *pdev)
1147{ 1147{
1148 struct mx3_camera_dev *mx3_cam; 1148 struct mx3_camera_dev *mx3_cam;
1149 struct resource *res; 1149 struct resource *res;
@@ -1246,7 +1246,7 @@ egetres:
1246 return err; 1246 return err;
1247} 1247}
1248 1248
1249static int __devexit mx3_camera_remove(struct platform_device *pdev) 1249static int mx3_camera_remove(struct platform_device *pdev)
1250{ 1250{
1251 struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev); 1251 struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev);
1252 struct mx3_camera_dev *mx3_cam = container_of(soc_host, 1252 struct mx3_camera_dev *mx3_cam = container_of(soc_host,
@@ -1279,7 +1279,7 @@ static struct platform_driver mx3_camera_driver = {
1279 .name = MX3_CAM_DRV_NAME, 1279 .name = MX3_CAM_DRV_NAME,
1280 }, 1280 },
1281 .probe = mx3_camera_probe, 1281 .probe = mx3_camera_probe,
1282 .remove = __devexit_p(mx3_camera_remove), 1282 .remove = mx3_camera_remove,
1283}; 1283};
1284 1284
1285module_platform_driver(mx3_camera_driver); 1285module_platform_driver(mx3_camera_driver);
diff --git a/drivers/media/platform/soc_camera/pxa_camera.c b/drivers/media/platform/soc_camera/pxa_camera.c
index 3434ffe79c6e..523330d00dee 100644
--- a/drivers/media/platform/soc_camera/pxa_camera.c
+++ b/drivers/media/platform/soc_camera/pxa_camera.c
@@ -1651,7 +1651,7 @@ static struct soc_camera_host_ops pxa_soc_camera_host_ops = {
1651 .set_bus_param = pxa_camera_set_bus_param, 1651 .set_bus_param = pxa_camera_set_bus_param,
1652}; 1652};
1653 1653
1654static int __devinit pxa_camera_probe(struct platform_device *pdev) 1654static int pxa_camera_probe(struct platform_device *pdev)
1655{ 1655{
1656 struct pxa_camera_dev *pcdev; 1656 struct pxa_camera_dev *pcdev;
1657 struct resource *res; 1657 struct resource *res;
@@ -1801,7 +1801,7 @@ exit:
1801 return err; 1801 return err;
1802} 1802}
1803 1803
1804static int __devexit pxa_camera_remove(struct platform_device *pdev) 1804static int pxa_camera_remove(struct platform_device *pdev)
1805{ 1805{
1806 struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev); 1806 struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev);
1807 struct pxa_camera_dev *pcdev = container_of(soc_host, 1807 struct pxa_camera_dev *pcdev = container_of(soc_host,
@@ -1840,7 +1840,7 @@ static struct platform_driver pxa_camera_driver = {
1840 .pm = &pxa_camera_pm, 1840 .pm = &pxa_camera_pm,
1841 }, 1841 },
1842 .probe = pxa_camera_probe, 1842 .probe = pxa_camera_probe,
1843 .remove = __devexit_p(pxa_camera_remove), 1843 .remove = pxa_camera_remove,
1844}; 1844};
1845 1845
1846module_platform_driver(pxa_camera_driver); 1846module_platform_driver(pxa_camera_driver);
diff --git a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c
index 2d8861c0e8f2..ebbc126e71a6 100644
--- a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c
+++ b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c
@@ -2071,7 +2071,7 @@ static int bus_notify(struct notifier_block *nb,
2071 return NOTIFY_DONE; 2071 return NOTIFY_DONE;
2072} 2072}
2073 2073
2074static int __devinit sh_mobile_ceu_probe(struct platform_device *pdev) 2074static int sh_mobile_ceu_probe(struct platform_device *pdev)
2075{ 2075{
2076 struct sh_mobile_ceu_dev *pcdev; 2076 struct sh_mobile_ceu_dev *pcdev;
2077 struct resource *res; 2077 struct resource *res;
@@ -2258,7 +2258,7 @@ exit:
2258 return err; 2258 return err;
2259} 2259}
2260 2260
2261static int __devexit sh_mobile_ceu_remove(struct platform_device *pdev) 2261static int sh_mobile_ceu_remove(struct platform_device *pdev)
2262{ 2262{
2263 struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev); 2263 struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev);
2264 struct sh_mobile_ceu_dev *pcdev = container_of(soc_host, 2264 struct sh_mobile_ceu_dev *pcdev = container_of(soc_host,
@@ -2307,7 +2307,7 @@ static struct platform_driver sh_mobile_ceu_driver = {
2307 .pm = &sh_mobile_ceu_dev_pm_ops, 2307 .pm = &sh_mobile_ceu_dev_pm_ops,
2308 }, 2308 },
2309 .probe = sh_mobile_ceu_probe, 2309 .probe = sh_mobile_ceu_probe,
2310 .remove = __devexit_p(sh_mobile_ceu_remove), 2310 .remove = sh_mobile_ceu_remove,
2311}; 2311};
2312 2312
2313static int __init sh_mobile_ceu_init(void) 2313static int __init sh_mobile_ceu_init(void)
diff --git a/drivers/media/platform/soc_camera/sh_mobile_csi2.c b/drivers/media/platform/soc_camera/sh_mobile_csi2.c
index 05286500b4d4..a17aba9a0104 100644
--- a/drivers/media/platform/soc_camera/sh_mobile_csi2.c
+++ b/drivers/media/platform/soc_camera/sh_mobile_csi2.c
@@ -294,7 +294,7 @@ static struct v4l2_subdev_ops sh_csi2_subdev_ops = {
294 .video = &sh_csi2_subdev_video_ops, 294 .video = &sh_csi2_subdev_video_ops,
295}; 295};
296 296
297static __devinit int sh_csi2_probe(struct platform_device *pdev) 297static int sh_csi2_probe(struct platform_device *pdev)
298{ 298{
299 struct resource *res; 299 struct resource *res;
300 unsigned int irq; 300 unsigned int irq;
@@ -366,7 +366,7 @@ ereqreg:
366 return ret; 366 return ret;
367} 367}
368 368
369static __devexit int sh_csi2_remove(struct platform_device *pdev) 369static int sh_csi2_remove(struct platform_device *pdev)
370{ 370{
371 struct sh_csi2 *priv = platform_get_drvdata(pdev); 371 struct sh_csi2 *priv = platform_get_drvdata(pdev);
372 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 372 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -382,7 +382,7 @@ static __devexit int sh_csi2_remove(struct platform_device *pdev)
382} 382}
383 383
384static struct platform_driver __refdata sh_csi2_pdrv = { 384static struct platform_driver __refdata sh_csi2_pdrv = {
385 .remove = __devexit_p(sh_csi2_remove), 385 .remove = sh_csi2_remove,
386 .probe = sh_csi2_probe, 386 .probe = sh_csi2_probe,
387 .driver = { 387 .driver = {
388 .name = "sh-mobile-csi2", 388 .name = "sh-mobile-csi2",
diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c
index 4e3735679f17..2ec90eae6ba0 100644
--- a/drivers/media/platform/soc_camera/soc_camera.c
+++ b/drivers/media/platform/soc_camera/soc_camera.c
@@ -1530,7 +1530,7 @@ static int soc_camera_video_start(struct soc_camera_device *icd)
1530 return 0; 1530 return 0;
1531} 1531}
1532 1532
1533static int __devinit soc_camera_pdrv_probe(struct platform_device *pdev) 1533static int soc_camera_pdrv_probe(struct platform_device *pdev)
1534{ 1534{
1535 struct soc_camera_link *icl = pdev->dev.platform_data; 1535 struct soc_camera_link *icl = pdev->dev.platform_data;
1536 struct soc_camera_device *icd; 1536 struct soc_camera_device *icd;
@@ -1558,7 +1558,7 @@ static int __devinit soc_camera_pdrv_probe(struct platform_device *pdev)
1558 * hot-pluggable. Now we know, that all our users - hosts and devices have 1558 * hot-pluggable. Now we know, that all our users - hosts and devices have
1559 * been unloaded already 1559 * been unloaded already
1560 */ 1560 */
1561static int __devexit soc_camera_pdrv_remove(struct platform_device *pdev) 1561static int soc_camera_pdrv_remove(struct platform_device *pdev)
1562{ 1562{
1563 struct soc_camera_device *icd = platform_get_drvdata(pdev); 1563 struct soc_camera_device *icd = platform_get_drvdata(pdev);
1564 1564
@@ -1572,7 +1572,7 @@ static int __devexit soc_camera_pdrv_remove(struct platform_device *pdev)
1572 1572
1573static struct platform_driver __refdata soc_camera_pdrv = { 1573static struct platform_driver __refdata soc_camera_pdrv = {
1574 .probe = soc_camera_pdrv_probe, 1574 .probe = soc_camera_pdrv_probe,
1575 .remove = __devexit_p(soc_camera_pdrv_remove), 1575 .remove = soc_camera_pdrv_remove,
1576 .driver = { 1576 .driver = {
1577 .name = "soc-camera-pdrv", 1577 .name = "soc-camera-pdrv",
1578 .owner = THIS_MODULE, 1578 .owner = THIS_MODULE,
diff --git a/drivers/media/platform/timblogiw.c b/drivers/media/platform/timblogiw.c
index 02194c056b00..d854d08a6c7f 100644
--- a/drivers/media/platform/timblogiw.c
+++ b/drivers/media/platform/timblogiw.c
@@ -745,7 +745,7 @@ static int timblogiw_mmap(struct file *file, struct vm_area_struct *vma)
745 745
746/* Platform device functions */ 746/* Platform device functions */
747 747
748static __devinitconst struct v4l2_ioctl_ops timblogiw_ioctl_ops = { 748static struct v4l2_ioctl_ops timblogiw_ioctl_ops = {
749 .vidioc_querycap = timblogiw_querycap, 749 .vidioc_querycap = timblogiw_querycap,
750 .vidioc_enum_fmt_vid_cap = timblogiw_enum_fmt, 750 .vidioc_enum_fmt_vid_cap = timblogiw_enum_fmt,
751 .vidioc_g_fmt_vid_cap = timblogiw_g_fmt, 751 .vidioc_g_fmt_vid_cap = timblogiw_g_fmt,
@@ -767,7 +767,7 @@ static __devinitconst struct v4l2_ioctl_ops timblogiw_ioctl_ops = {
767 .vidioc_enum_framesizes = timblogiw_enum_framesizes, 767 .vidioc_enum_framesizes = timblogiw_enum_framesizes,
768}; 768};
769 769
770static __devinitconst struct v4l2_file_operations timblogiw_fops = { 770static struct v4l2_file_operations timblogiw_fops = {
771 .owner = THIS_MODULE, 771 .owner = THIS_MODULE,
772 .open = timblogiw_open, 772 .open = timblogiw_open,
773 .release = timblogiw_close, 773 .release = timblogiw_close,
@@ -777,7 +777,7 @@ static __devinitconst struct v4l2_file_operations timblogiw_fops = {
777 .poll = timblogiw_poll, 777 .poll = timblogiw_poll,
778}; 778};
779 779
780static __devinitconst struct video_device timblogiw_template = { 780static struct video_device timblogiw_template = {
781 .name = TIMBLOGIWIN_NAME, 781 .name = TIMBLOGIWIN_NAME,
782 .fops = &timblogiw_fops, 782 .fops = &timblogiw_fops,
783 .ioctl_ops = &timblogiw_ioctl_ops, 783 .ioctl_ops = &timblogiw_ioctl_ops,
@@ -786,7 +786,7 @@ static __devinitconst struct video_device timblogiw_template = {
786 .tvnorms = V4L2_STD_PAL | V4L2_STD_NTSC 786 .tvnorms = V4L2_STD_PAL | V4L2_STD_NTSC
787}; 787};
788 788
789static int __devinit timblogiw_probe(struct platform_device *pdev) 789static int timblogiw_probe(struct platform_device *pdev)
790{ 790{
791 int err; 791 int err;
792 struct timblogiw *lw = NULL; 792 struct timblogiw *lw = NULL;
@@ -848,7 +848,7 @@ err:
848 return err; 848 return err;
849} 849}
850 850
851static int __devexit timblogiw_remove(struct platform_device *pdev) 851static int timblogiw_remove(struct platform_device *pdev)
852{ 852{
853 struct timblogiw *lw = platform_get_drvdata(pdev); 853 struct timblogiw *lw = platform_get_drvdata(pdev);
854 854
@@ -869,7 +869,7 @@ static struct platform_driver timblogiw_platform_driver = {
869 .owner = THIS_MODULE, 869 .owner = THIS_MODULE,
870 }, 870 },
871 .probe = timblogiw_probe, 871 .probe = timblogiw_probe,
872 .remove = __devexit_p(timblogiw_remove), 872 .remove = timblogiw_remove,
873}; 873};
874 874
875module_platform_driver(timblogiw_platform_driver); 875module_platform_driver(timblogiw_platform_driver);
diff --git a/drivers/media/platform/via-camera.c b/drivers/media/platform/via-camera.c
index eb404c2ce270..63e8c3461239 100644
--- a/drivers/media/platform/via-camera.c
+++ b/drivers/media/platform/via-camera.c
@@ -1324,7 +1324,7 @@ static struct video_device viacam_v4l_template = {
1324#define VIACAM_SERIAL_CREG 0x46 1324#define VIACAM_SERIAL_CREG 0x46
1325#define VIACAM_SERIAL_BIT 0x40 1325#define VIACAM_SERIAL_BIT 0x40
1326 1326
1327static __devinit bool viacam_serial_is_enabled(void) 1327static bool viacam_serial_is_enabled(void)
1328{ 1328{
1329 struct pci_bus *pbus = pci_find_bus(0, 0); 1329 struct pci_bus *pbus = pci_find_bus(0, 0);
1330 u8 cbyte; 1330 u8 cbyte;
@@ -1353,7 +1353,7 @@ static struct ov7670_config sensor_cfg = {
1353 .clock_speed = 90, 1353 .clock_speed = 90,
1354}; 1354};
1355 1355
1356static __devinit int viacam_probe(struct platform_device *pdev) 1356static int viacam_probe(struct platform_device *pdev)
1357{ 1357{
1358 int ret; 1358 int ret;
1359 struct i2c_adapter *sensor_adapter; 1359 struct i2c_adapter *sensor_adapter;
@@ -1490,7 +1490,7 @@ out_unregister:
1490 return ret; 1490 return ret;
1491} 1491}
1492 1492
1493static __devexit int viacam_remove(struct platform_device *pdev) 1493static int viacam_remove(struct platform_device *pdev)
1494{ 1494{
1495 struct via_camera *cam = via_cam_info; 1495 struct via_camera *cam = via_cam_info;
1496 struct viafb_dev *viadev = pdev->dev.platform_data; 1496 struct viafb_dev *viadev = pdev->dev.platform_data;
diff --git a/drivers/media/radio/radio-maxiradio.c b/drivers/media/radio/radio-maxiradio.c
index b415211d0c4b..bd4d3a7cdadd 100644
--- a/drivers/media/radio/radio-maxiradio.c
+++ b/drivers/media/radio/radio-maxiradio.c
@@ -114,7 +114,8 @@ static struct snd_tea575x_ops maxiradio_tea_ops = {
114 .set_direction = maxiradio_tea575x_set_direction, 114 .set_direction = maxiradio_tea575x_set_direction,
115}; 115};
116 116
117static int __devinit maxiradio_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 117static int maxiradio_probe(struct pci_dev *pdev,
118 const struct pci_device_id *ent)
118{ 119{
119 struct maxiradio *dev; 120 struct maxiradio *dev;
120 struct v4l2_device *v4l2_dev; 121 struct v4l2_device *v4l2_dev;
@@ -172,7 +173,7 @@ errfr:
172 return retval; 173 return retval;
173} 174}
174 175
175static void __devexit maxiradio_remove(struct pci_dev *pdev) 176static void maxiradio_remove(struct pci_dev *pdev)
176{ 177{
177 struct v4l2_device *v4l2_dev = dev_get_drvdata(&pdev->dev); 178 struct v4l2_device *v4l2_dev = dev_get_drvdata(&pdev->dev);
178 struct maxiradio *dev = to_maxiradio(v4l2_dev); 179 struct maxiradio *dev = to_maxiradio(v4l2_dev);
@@ -196,7 +197,7 @@ static struct pci_driver maxiradio_driver = {
196 .name = "radio-maxiradio", 197 .name = "radio-maxiradio",
197 .id_table = maxiradio_pci_tbl, 198 .id_table = maxiradio_pci_tbl,
198 .probe = maxiradio_probe, 199 .probe = maxiradio_probe,
199 .remove = __devexit_p(maxiradio_remove), 200 .remove = maxiradio_remove,
200}; 201};
201 202
202static int __init maxiradio_init(void) 203static int __init maxiradio_init(void)
diff --git a/drivers/media/radio/radio-sf16fmi.c b/drivers/media/radio/radio-sf16fmi.c
index c260a2a354b1..637a55564958 100644
--- a/drivers/media/radio/radio-sf16fmi.c
+++ b/drivers/media/radio/radio-sf16fmi.c
@@ -265,7 +265,7 @@ static const struct v4l2_ioctl_ops fmi_ioctl_ops = {
265}; 265};
266 266
267/* ladis: this is my card. does any other types exist? */ 267/* ladis: this is my card. does any other types exist? */
268static struct isapnp_device_id id_table[] __devinitdata = { 268static struct isapnp_device_id id_table[] = {
269 /* SF16-FMI */ 269 /* SF16-FMI */
270 { ISAPNP_ANY_ID, ISAPNP_ANY_ID, 270 { ISAPNP_ANY_ID, ISAPNP_ANY_ID,
271 ISAPNP_VENDOR('M','F','R'), ISAPNP_FUNCTION(0xad10), 0}, 271 ISAPNP_VENDOR('M','F','R'), ISAPNP_FUNCTION(0xad10), 0},
diff --git a/drivers/media/radio/radio-sf16fmr2.c b/drivers/media/radio/radio-sf16fmr2.c
index 4efcbec74c52..9c0990457a7c 100644
--- a/drivers/media/radio/radio-sf16fmr2.c
+++ b/drivers/media/radio/radio-sf16fmr2.c
@@ -197,13 +197,13 @@ static int fmr2_tea_ext_init(struct snd_tea575x *tea)
197 return 0; 197 return 0;
198} 198}
199 199
200static struct pnp_device_id fmr2_pnp_ids[] __devinitdata = { 200static struct pnp_device_id fmr2_pnp_ids[] = {
201 { .id = "MFRad13" }, /* tuner subdevice of SF16-FMD2 */ 201 { .id = "MFRad13" }, /* tuner subdevice of SF16-FMD2 */
202 { .id = "" } 202 { .id = "" }
203}; 203};
204MODULE_DEVICE_TABLE(pnp, fmr2_pnp_ids); 204MODULE_DEVICE_TABLE(pnp, fmr2_pnp_ids);
205 205
206static int __devinit fmr2_probe(struct fmr2 *fmr2, struct device *pdev, int io) 206static int fmr2_probe(struct fmr2 *fmr2, struct device *pdev, int io)
207{ 207{
208 int err, i; 208 int err, i;
209 char *card_name = fmr2->is_fmd2 ? "SF16-FMD2" : "SF16-FMR2"; 209 char *card_name = fmr2->is_fmd2 ? "SF16-FMD2" : "SF16-FMR2";
@@ -249,7 +249,7 @@ static int __devinit fmr2_probe(struct fmr2 *fmr2, struct device *pdev, int io)
249 return 0; 249 return 0;
250} 250}
251 251
252static int __devinit fmr2_isa_match(struct device *pdev, unsigned int ndev) 252static int fmr2_isa_match(struct device *pdev, unsigned int ndev)
253{ 253{
254 struct fmr2 *fmr2 = kzalloc(sizeof(*fmr2), GFP_KERNEL); 254 struct fmr2 *fmr2 = kzalloc(sizeof(*fmr2), GFP_KERNEL);
255 if (!fmr2) 255 if (!fmr2)
@@ -265,8 +265,7 @@ static int __devinit fmr2_isa_match(struct device *pdev, unsigned int ndev)
265 return 1; 265 return 1;
266} 266}
267 267
268static int __devinit fmr2_pnp_probe(struct pnp_dev *pdev, 268static int fmr2_pnp_probe(struct pnp_dev *pdev, const struct pnp_device_id *id)
269 const struct pnp_device_id *id)
270{ 269{
271 int ret; 270 int ret;
272 struct fmr2 *fmr2 = kzalloc(sizeof(*fmr2), GFP_KERNEL); 271 struct fmr2 *fmr2 = kzalloc(sizeof(*fmr2), GFP_KERNEL);
@@ -285,7 +284,7 @@ static int __devinit fmr2_pnp_probe(struct pnp_dev *pdev,
285 return 0; 284 return 0;
286} 285}
287 286
288static void __devexit fmr2_remove(struct fmr2 *fmr2) 287static void fmr2_remove(struct fmr2 *fmr2)
289{ 288{
290 snd_tea575x_exit(&fmr2->tea); 289 snd_tea575x_exit(&fmr2->tea);
291 release_region(fmr2->io, 2); 290 release_region(fmr2->io, 2);
@@ -293,7 +292,7 @@ static void __devexit fmr2_remove(struct fmr2 *fmr2)
293 kfree(fmr2); 292 kfree(fmr2);
294} 293}
295 294
296static int __devexit fmr2_isa_remove(struct device *pdev, unsigned int ndev) 295static int fmr2_isa_remove(struct device *pdev, unsigned int ndev)
297{ 296{
298 fmr2_remove(dev_get_drvdata(pdev)); 297 fmr2_remove(dev_get_drvdata(pdev));
299 dev_set_drvdata(pdev, NULL); 298 dev_set_drvdata(pdev, NULL);
@@ -301,7 +300,7 @@ static int __devexit fmr2_isa_remove(struct device *pdev, unsigned int ndev)
301 return 0; 300 return 0;
302} 301}
303 302
304static void __devexit fmr2_pnp_remove(struct pnp_dev *pdev) 303static void fmr2_pnp_remove(struct pnp_dev *pdev)
305{ 304{
306 fmr2_remove(pnp_get_drvdata(pdev)); 305 fmr2_remove(pnp_get_drvdata(pdev));
307 pnp_set_drvdata(pdev, NULL); 306 pnp_set_drvdata(pdev, NULL);
@@ -309,7 +308,7 @@ static void __devexit fmr2_pnp_remove(struct pnp_dev *pdev)
309 308
310struct isa_driver fmr2_isa_driver = { 309struct isa_driver fmr2_isa_driver = {
311 .match = fmr2_isa_match, 310 .match = fmr2_isa_match,
312 .remove = __devexit_p(fmr2_isa_remove), 311 .remove = fmr2_isa_remove,
313 .driver = { 312 .driver = {
314 .name = "radio-sf16fmr2", 313 .name = "radio-sf16fmr2",
315 }, 314 },
@@ -319,7 +318,7 @@ struct pnp_driver fmr2_pnp_driver = {
319 .name = "radio-sf16fmr2", 318 .name = "radio-sf16fmr2",
320 .id_table = fmr2_pnp_ids, 319 .id_table = fmr2_pnp_ids,
321 .probe = fmr2_pnp_probe, 320 .probe = fmr2_pnp_probe,
322 .remove = __devexit_p(fmr2_pnp_remove), 321 .remove = fmr2_pnp_remove,
323}; 322};
324 323
325static int __init fmr2_init(void) 324static int __init fmr2_init(void)
diff --git a/drivers/media/radio/radio-tea5764.c b/drivers/media/radio/radio-tea5764.c
index 36aec575e0ec..1978516af67e 100644
--- a/drivers/media/radio/radio-tea5764.c
+++ b/drivers/media/radio/radio-tea5764.c
@@ -493,8 +493,8 @@ static struct video_device tea5764_radio_template = {
493}; 493};
494 494
495/* I2C probe: check if the device exists and register with v4l if it is */ 495/* I2C probe: check if the device exists and register with v4l if it is */
496static int __devinit tea5764_i2c_probe(struct i2c_client *client, 496static int tea5764_i2c_probe(struct i2c_client *client,
497 const struct i2c_device_id *id) 497 const struct i2c_device_id *id)
498{ 498{
499 struct tea5764_device *radio; 499 struct tea5764_device *radio;
500 struct tea5764_regs *r; 500 struct tea5764_regs *r;
@@ -552,7 +552,7 @@ errfr:
552 return ret; 552 return ret;
553} 553}
554 554
555static int __devexit tea5764_i2c_remove(struct i2c_client *client) 555static int tea5764_i2c_remove(struct i2c_client *client)
556{ 556{
557 struct tea5764_device *radio = i2c_get_clientdata(client); 557 struct tea5764_device *radio = i2c_get_clientdata(client);
558 558
@@ -578,7 +578,7 @@ static struct i2c_driver tea5764_i2c_driver = {
578 .owner = THIS_MODULE, 578 .owner = THIS_MODULE,
579 }, 579 },
580 .probe = tea5764_i2c_probe, 580 .probe = tea5764_i2c_probe,
581 .remove = __devexit_p(tea5764_i2c_remove), 581 .remove = tea5764_i2c_remove,
582 .id_table = tea5764_id, 582 .id_table = tea5764_id,
583}; 583};
584 584
diff --git a/drivers/media/radio/radio-timb.c b/drivers/media/radio/radio-timb.c
index 5cf07779f4bb..b87effeb5dc6 100644
--- a/drivers/media/radio/radio-timb.c
+++ b/drivers/media/radio/radio-timb.c
@@ -145,7 +145,7 @@ static const struct v4l2_file_operations timbradio_fops = {
145 .unlocked_ioctl = video_ioctl2, 145 .unlocked_ioctl = video_ioctl2,
146}; 146};
147 147
148static int __devinit timbradio_probe(struct platform_device *pdev) 148static int timbradio_probe(struct platform_device *pdev)
149{ 149{
150 struct timb_radio_platform_data *pdata = pdev->dev.platform_data; 150 struct timb_radio_platform_data *pdata = pdev->dev.platform_data;
151 struct timbradio *tr; 151 struct timbradio *tr;
@@ -201,7 +201,7 @@ err:
201 return err; 201 return err;
202} 202}
203 203
204static int __devexit timbradio_remove(struct platform_device *pdev) 204static int timbradio_remove(struct platform_device *pdev)
205{ 205{
206 struct timbradio *tr = platform_get_drvdata(pdev); 206 struct timbradio *tr = platform_get_drvdata(pdev);
207 207
@@ -219,7 +219,7 @@ static struct platform_driver timbradio_platform_driver = {
219 .owner = THIS_MODULE, 219 .owner = THIS_MODULE,
220 }, 220 },
221 .probe = timbradio_probe, 221 .probe = timbradio_probe,
222 .remove = __devexit_p(timbradio_remove), 222 .remove = timbradio_remove,
223}; 223};
224 224
225module_platform_driver(timbradio_platform_driver); 225module_platform_driver(timbradio_platform_driver);
diff --git a/drivers/media/radio/radio-wl1273.c b/drivers/media/radio/radio-wl1273.c
index 9b0c9fa0beb8..c48be195bbad 100644
--- a/drivers/media/radio/radio-wl1273.c
+++ b/drivers/media/radio/radio-wl1273.c
@@ -1990,7 +1990,7 @@ static int wl1273_fm_radio_remove(struct platform_device *pdev)
1990 return 0; 1990 return 0;
1991} 1991}
1992 1992
1993static int __devinit wl1273_fm_radio_probe(struct platform_device *pdev) 1993static int wl1273_fm_radio_probe(struct platform_device *pdev)
1994{ 1994{
1995 struct wl1273_core **core = pdev->dev.platform_data; 1995 struct wl1273_core **core = pdev->dev.platform_data;
1996 struct wl1273_device *radio; 1996 struct wl1273_device *radio;
@@ -2145,7 +2145,7 @@ pdata_err:
2145 2145
2146static struct platform_driver wl1273_fm_radio_driver = { 2146static struct platform_driver wl1273_fm_radio_driver = {
2147 .probe = wl1273_fm_radio_probe, 2147 .probe = wl1273_fm_radio_probe,
2148 .remove = __devexit_p(wl1273_fm_radio_remove), 2148 .remove = wl1273_fm_radio_remove,
2149 .driver = { 2149 .driver = {
2150 .name = "wl1273_fm_radio", 2150 .name = "wl1273_fm_radio",
2151 .owner = THIS_MODULE, 2151 .owner = THIS_MODULE,
diff --git a/drivers/media/radio/saa7706h.c b/drivers/media/radio/saa7706h.c
index 54db36ccb9ee..06c06cc9ff25 100644
--- a/drivers/media/radio/saa7706h.c
+++ b/drivers/media/radio/saa7706h.c
@@ -373,8 +373,8 @@ static const struct v4l2_subdev_ops saa7706h_ops = {
373 * concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1' 373 * concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1'
374 */ 374 */
375 375
376static int __devinit saa7706h_probe(struct i2c_client *client, 376static int saa7706h_probe(struct i2c_client *client,
377 const struct i2c_device_id *id) 377 const struct i2c_device_id *id)
378{ 378{
379 struct saa7706h_state *state; 379 struct saa7706h_state *state;
380 struct v4l2_subdev *sd; 380 struct v4l2_subdev *sd;
@@ -418,7 +418,7 @@ err:
418 return err; 418 return err;
419} 419}
420 420
421static int __devexit saa7706h_remove(struct i2c_client *client) 421static int saa7706h_remove(struct i2c_client *client)
422{ 422{
423 struct v4l2_subdev *sd = i2c_get_clientdata(client); 423 struct v4l2_subdev *sd = i2c_get_clientdata(client);
424 424
@@ -441,7 +441,7 @@ static struct i2c_driver saa7706h_driver = {
441 .name = DRIVER_NAME, 441 .name = DRIVER_NAME,
442 }, 442 },
443 .probe = saa7706h_probe, 443 .probe = saa7706h_probe,
444 .remove = __devexit_p(saa7706h_remove), 444 .remove = saa7706h_remove,
445 .id_table = saa7706h_id, 445 .id_table = saa7706h_id,
446}; 446};
447 447
diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c
index 4ef55ec8045e..e5fc9acd0c4f 100644
--- a/drivers/media/radio/si470x/radio-si470x-i2c.c
+++ b/drivers/media/radio/si470x/radio-si470x-i2c.c
@@ -347,8 +347,8 @@ end:
347/* 347/*
348 * si470x_i2c_probe - probe for the device 348 * si470x_i2c_probe - probe for the device
349 */ 349 */
350static int __devinit si470x_i2c_probe(struct i2c_client *client, 350static int si470x_i2c_probe(struct i2c_client *client,
351 const struct i2c_device_id *id) 351 const struct i2c_device_id *id)
352{ 352{
353 struct si470x_device *radio; 353 struct si470x_device *radio;
354 int retval = 0; 354 int retval = 0;
@@ -451,7 +451,7 @@ err_initial:
451/* 451/*
452 * si470x_i2c_remove - remove the device 452 * si470x_i2c_remove - remove the device
453 */ 453 */
454static __devexit int si470x_i2c_remove(struct i2c_client *client) 454static int si470x_i2c_remove(struct i2c_client *client)
455{ 455{
456 struct si470x_device *radio = i2c_get_clientdata(client); 456 struct si470x_device *radio = i2c_get_clientdata(client);
457 457
@@ -514,7 +514,7 @@ static struct i2c_driver si470x_i2c_driver = {
514#endif 514#endif
515 }, 515 },
516 .probe = si470x_i2c_probe, 516 .probe = si470x_i2c_probe,
517 .remove = __devexit_p(si470x_i2c_remove), 517 .remove = si470x_i2c_remove,
518 .id_table = si470x_i2c_id, 518 .id_table = si470x_i2c_id,
519}; 519};
520 520
diff --git a/drivers/media/radio/tef6862.c b/drivers/media/radio/tef6862.c
index 06d47e5cce9f..b18c2dc268ba 100644
--- a/drivers/media/radio/tef6862.c
+++ b/drivers/media/radio/tef6862.c
@@ -165,8 +165,8 @@ static const struct v4l2_subdev_ops tef6862_ops = {
165 * concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1' 165 * concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1'
166 */ 166 */
167 167
168static int __devinit tef6862_probe(struct i2c_client *client, 168static int tef6862_probe(struct i2c_client *client,
169 const struct i2c_device_id *id) 169 const struct i2c_device_id *id)
170{ 170{
171 struct tef6862_state *state; 171 struct tef6862_state *state;
172 struct v4l2_subdev *sd; 172 struct v4l2_subdev *sd;
@@ -189,7 +189,7 @@ static int __devinit tef6862_probe(struct i2c_client *client,
189 return 0; 189 return 0;
190} 190}
191 191
192static int __devexit tef6862_remove(struct i2c_client *client) 192static int tef6862_remove(struct i2c_client *client)
193{ 193{
194 struct v4l2_subdev *sd = i2c_get_clientdata(client); 194 struct v4l2_subdev *sd = i2c_get_clientdata(client);
195 195
@@ -211,7 +211,7 @@ static struct i2c_driver tef6862_driver = {
211 .name = DRIVER_NAME, 211 .name = DRIVER_NAME,
212 }, 212 },
213 .probe = tef6862_probe, 213 .probe = tef6862_probe,
214 .remove = __devexit_p(tef6862_remove), 214 .remove = tef6862_remove,
215 .id_table = tef6862_id, 215 .id_table = tef6862_id,
216}; 216};
217 217
diff --git a/drivers/media/rc/ene_ir.c b/drivers/media/rc/ene_ir.c
index 22231dd4f62b..cef04786b52f 100644
--- a/drivers/media/rc/ene_ir.c
+++ b/drivers/media/rc/ene_ir.c
@@ -1172,7 +1172,7 @@ static struct pnp_driver ene_driver = {
1172 .flags = PNP_DRIVER_RES_DO_NOT_CHANGE, 1172 .flags = PNP_DRIVER_RES_DO_NOT_CHANGE,
1173 1173
1174 .probe = ene_probe, 1174 .probe = ene_probe,
1175 .remove = __devexit_p(ene_remove), 1175 .remove = ene_remove,
1176#ifdef CONFIG_PM 1176#ifdef CONFIG_PM
1177 .suspend = ene_suspend, 1177 .suspend = ene_suspend,
1178 .resume = ene_resume, 1178 .resume = ene_resume,
diff --git a/drivers/media/rc/fintek-cir.c b/drivers/media/rc/fintek-cir.c
index 936c3f79b62c..1df410e13688 100644
--- a/drivers/media/rc/fintek-cir.c
+++ b/drivers/media/rc/fintek-cir.c
@@ -590,7 +590,7 @@ failure:
590 return ret; 590 return ret;
591} 591}
592 592
593static void __devexit fintek_remove(struct pnp_dev *pdev) 593static void fintek_remove(struct pnp_dev *pdev)
594{ 594{
595 struct fintek_dev *fintek = pnp_get_drvdata(pdev); 595 struct fintek_dev *fintek = pnp_get_drvdata(pdev);
596 unsigned long flags; 596 unsigned long flags;
@@ -678,7 +678,7 @@ static struct pnp_driver fintek_driver = {
678 .id_table = fintek_ids, 678 .id_table = fintek_ids,
679 .flags = PNP_DRIVER_RES_DO_NOT_CHANGE, 679 .flags = PNP_DRIVER_RES_DO_NOT_CHANGE,
680 .probe = fintek_probe, 680 .probe = fintek_probe,
681 .remove = __devexit_p(fintek_remove), 681 .remove = fintek_remove,
682 .suspend = fintek_suspend, 682 .suspend = fintek_suspend,
683 .resume = fintek_resume, 683 .resume = fintek_resume,
684 .shutdown = fintek_shutdown, 684 .shutdown = fintek_shutdown,
diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c
index ba1a1eb356cf..4f71a7d1f019 100644
--- a/drivers/media/rc/gpio-ir-recv.c
+++ b/drivers/media/rc/gpio-ir-recv.c
@@ -58,7 +58,7 @@ err_get_value:
58 return IRQ_HANDLED; 58 return IRQ_HANDLED;
59} 59}
60 60
61static int __devinit gpio_ir_recv_probe(struct platform_device *pdev) 61static int gpio_ir_recv_probe(struct platform_device *pdev)
62{ 62{
63 struct gpio_rc_dev *gpio_dev; 63 struct gpio_rc_dev *gpio_dev;
64 struct rc_dev *rcdev; 64 struct rc_dev *rcdev;
@@ -140,7 +140,7 @@ err_allocate_device:
140 return rc; 140 return rc;
141} 141}
142 142
143static int __devexit gpio_ir_recv_remove(struct platform_device *pdev) 143static int gpio_ir_recv_remove(struct platform_device *pdev)
144{ 144{
145 struct gpio_rc_dev *gpio_dev = platform_get_drvdata(pdev); 145 struct gpio_rc_dev *gpio_dev = platform_get_drvdata(pdev);
146 146
@@ -188,7 +188,7 @@ static const struct dev_pm_ops gpio_ir_recv_pm_ops = {
188 188
189static struct platform_driver gpio_ir_recv_driver = { 189static struct platform_driver gpio_ir_recv_driver = {
190 .probe = gpio_ir_recv_probe, 190 .probe = gpio_ir_recv_probe,
191 .remove = __devexit_p(gpio_ir_recv_remove), 191 .remove = gpio_ir_recv_remove,
192 .driver = { 192 .driver = {
193 .name = GPIO_IR_DRIVER_NAME, 193 .name = GPIO_IR_DRIVER_NAME,
194 .owner = THIS_MODULE, 194 .owner = THIS_MODULE,
diff --git a/drivers/media/rc/iguanair.c b/drivers/media/rc/iguanair.c
index 5a9163da63c3..b99b096d8a8f 100644
--- a/drivers/media/rc/iguanair.c
+++ b/drivers/media/rc/iguanair.c
@@ -425,8 +425,8 @@ static void iguanair_close(struct rc_dev *rdev)
425 mutex_unlock(&ir->lock); 425 mutex_unlock(&ir->lock);
426} 426}
427 427
428static int __devinit iguanair_probe(struct usb_interface *intf, 428static int iguanair_probe(struct usb_interface *intf,
429 const struct usb_device_id *id) 429 const struct usb_device_id *id)
430{ 430{
431 struct usb_device *udev = interface_to_usbdev(intf); 431 struct usb_device *udev = interface_to_usbdev(intf);
432 struct iguanair *ir; 432 struct iguanair *ir;
@@ -538,7 +538,7 @@ out:
538 return ret; 538 return ret;
539} 539}
540 540
541static void __devexit iguanair_disconnect(struct usb_interface *intf) 541static void iguanair_disconnect(struct usb_interface *intf)
542{ 542{
543 struct iguanair *ir = usb_get_intfdata(intf); 543 struct iguanair *ir = usb_get_intfdata(intf);
544 544
@@ -604,7 +604,7 @@ static const struct usb_device_id iguanair_table[] = {
604static struct usb_driver iguanair_driver = { 604static struct usb_driver iguanair_driver = {
605 .name = DRIVER_NAME, 605 .name = DRIVER_NAME,
606 .probe = iguanair_probe, 606 .probe = iguanair_probe,
607 .disconnect = __devexit_p(iguanair_disconnect), 607 .disconnect = iguanair_disconnect,
608 .suspend = iguanair_suspend, 608 .suspend = iguanair_suspend,
609 .resume = iguanair_resume, 609 .resume = iguanair_resume,
610 .reset_resume = iguanair_resume, 610 .reset_resume = iguanair_resume,
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index 8f6a28921ed4..78d109b978dd 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -255,7 +255,7 @@ static struct usb_device_id imon_usb_id_table[] = {
255static struct usb_driver imon_driver = { 255static struct usb_driver imon_driver = {
256 .name = MOD_NAME, 256 .name = MOD_NAME,
257 .probe = imon_probe, 257 .probe = imon_probe,
258 .disconnect = __devexit_p(imon_disconnect), 258 .disconnect = imon_disconnect,
259 .suspend = imon_suspend, 259 .suspend = imon_suspend,
260 .resume = imon_resume, 260 .resume = imon_resume,
261 .id_table = imon_usb_id_table, 261 .id_table = imon_usb_id_table,
@@ -2288,8 +2288,8 @@ static void imon_init_display(struct imon_context *ictx,
2288/** 2288/**
2289 * Callback function for USB core API: Probe 2289 * Callback function for USB core API: Probe
2290 */ 2290 */
2291static int __devinit imon_probe(struct usb_interface *interface, 2291static int imon_probe(struct usb_interface *interface,
2292 const struct usb_device_id *id) 2292 const struct usb_device_id *id)
2293{ 2293{
2294 struct usb_device *usbdev = NULL; 2294 struct usb_device *usbdev = NULL;
2295 struct usb_host_interface *iface_desc = NULL; 2295 struct usb_host_interface *iface_desc = NULL;
@@ -2372,7 +2372,7 @@ fail:
2372/** 2372/**
2373 * Callback function for USB core API: disconnect 2373 * Callback function for USB core API: disconnect
2374 */ 2374 */
2375static void __devexit imon_disconnect(struct usb_interface *interface) 2375static void imon_disconnect(struct usb_interface *interface)
2376{ 2376{
2377 struct imon_context *ictx; 2377 struct imon_context *ictx;
2378 struct device *dev; 2378 struct device *dev;
diff --git a/drivers/media/rc/ir-rx51.c b/drivers/media/rc/ir-rx51.c
index 9e76c7b40af2..8ead492d03aa 100644
--- a/drivers/media/rc/ir-rx51.c
+++ b/drivers/media/rc/ir-rx51.c
@@ -443,7 +443,7 @@ static int lirc_rx51_resume(struct platform_device *dev)
443 443
444#endif /* CONFIG_PM */ 444#endif /* CONFIG_PM */
445 445
446static int __devinit lirc_rx51_probe(struct platform_device *dev) 446static int lirc_rx51_probe(struct platform_device *dev)
447{ 447{
448 lirc_rx51_driver.features = LIRC_RX51_DRIVER_FEATURES; 448 lirc_rx51_driver.features = LIRC_RX51_DRIVER_FEATURES;
449 lirc_rx51.pdata = dev->dev.platform_data; 449 lirc_rx51.pdata = dev->dev.platform_data;
diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c
index 5e5a7f2b8184..1b8669b6d042 100644
--- a/drivers/media/rc/ite-cir.c
+++ b/drivers/media/rc/ite-cir.c
@@ -1620,7 +1620,7 @@ failure:
1620 return ret; 1620 return ret;
1621} 1621}
1622 1622
1623static void __devexit ite_remove(struct pnp_dev *pdev) 1623static void ite_remove(struct pnp_dev *pdev)
1624{ 1624{
1625 struct ite_dev *dev = pnp_get_drvdata(pdev); 1625 struct ite_dev *dev = pnp_get_drvdata(pdev);
1626 unsigned long flags; 1626 unsigned long flags;
@@ -1702,7 +1702,7 @@ static struct pnp_driver ite_driver = {
1702 .name = ITE_DRIVER_NAME, 1702 .name = ITE_DRIVER_NAME,
1703 .id_table = ite_ids, 1703 .id_table = ite_ids,
1704 .probe = ite_probe, 1704 .probe = ite_probe,
1705 .remove = __devexit_p(ite_remove), 1705 .remove = ite_remove,
1706 .suspend = ite_suspend, 1706 .suspend = ite_suspend,
1707 .resume = ite_resume, 1707 .resume = ite_resume,
1708 .shutdown = ite_shutdown, 1708 .shutdown = ite_shutdown,
diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index b2146cd99fd8..9afb9331217d 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -1229,8 +1229,8 @@ out:
1229 return NULL; 1229 return NULL;
1230} 1230}
1231 1231
1232static int __devinit mceusb_dev_probe(struct usb_interface *intf, 1232static int mceusb_dev_probe(struct usb_interface *intf,
1233 const struct usb_device_id *id) 1233 const struct usb_device_id *id)
1234{ 1234{
1235 struct usb_device *dev = interface_to_usbdev(intf); 1235 struct usb_device *dev = interface_to_usbdev(intf);
1236 struct usb_host_interface *idesc; 1236 struct usb_host_interface *idesc;
@@ -1393,7 +1393,7 @@ mem_alloc_fail:
1393} 1393}
1394 1394
1395 1395
1396static void __devexit mceusb_dev_disconnect(struct usb_interface *intf) 1396static void mceusb_dev_disconnect(struct usb_interface *intf)
1397{ 1397{
1398 struct usb_device *dev = interface_to_usbdev(intf); 1398 struct usb_device *dev = interface_to_usbdev(intf);
1399 struct mceusb_dev *ir = usb_get_intfdata(intf); 1399 struct mceusb_dev *ir = usb_get_intfdata(intf);
@@ -1432,7 +1432,7 @@ static int mceusb_dev_resume(struct usb_interface *intf)
1432static struct usb_driver mceusb_dev_driver = { 1432static struct usb_driver mceusb_dev_driver = {
1433 .name = DRIVER_NAME, 1433 .name = DRIVER_NAME,
1434 .probe = mceusb_dev_probe, 1434 .probe = mceusb_dev_probe,
1435 .disconnect = __devexit_p(mceusb_dev_disconnect), 1435 .disconnect = mceusb_dev_disconnect,
1436 .suspend = mceusb_dev_suspend, 1436 .suspend = mceusb_dev_suspend,
1437 .resume = mceusb_dev_resume, 1437 .resume = mceusb_dev_resume,
1438 .reset_resume = mceusb_dev_resume, 1438 .reset_resume = mceusb_dev_resume,
diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c
index e4ea89a11eed..b8aa9abb31ff 100644
--- a/drivers/media/rc/nuvoton-cir.c
+++ b/drivers/media/rc/nuvoton-cir.c
@@ -1113,7 +1113,7 @@ failure:
1113 return ret; 1113 return ret;
1114} 1114}
1115 1115
1116static void __devexit nvt_remove(struct pnp_dev *pdev) 1116static void nvt_remove(struct pnp_dev *pdev)
1117{ 1117{
1118 struct nvt_dev *nvt = pnp_get_drvdata(pdev); 1118 struct nvt_dev *nvt = pnp_get_drvdata(pdev);
1119 unsigned long flags; 1119 unsigned long flags;
@@ -1211,7 +1211,7 @@ static struct pnp_driver nvt_driver = {
1211 .id_table = nvt_ids, 1211 .id_table = nvt_ids,
1212 .flags = PNP_DRIVER_RES_DO_NOT_CHANGE, 1212 .flags = PNP_DRIVER_RES_DO_NOT_CHANGE,
1213 .probe = nvt_probe, 1213 .probe = nvt_probe,
1214 .remove = __devexit_p(nvt_remove), 1214 .remove = nvt_remove,
1215 .suspend = nvt_suspend, 1215 .suspend = nvt_suspend,
1216 .resume = nvt_resume, 1216 .resume = nvt_resume,
1217 .shutdown = nvt_shutdown, 1217 .shutdown = nvt_shutdown,
diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c
index a8887aba9faf..1800326f93e6 100644
--- a/drivers/media/rc/redrat3.c
+++ b/drivers/media/rc/redrat3.c
@@ -1102,8 +1102,8 @@ out:
1102 return NULL; 1102 return NULL;
1103} 1103}
1104 1104
1105static int __devinit redrat3_dev_probe(struct usb_interface *intf, 1105static int redrat3_dev_probe(struct usb_interface *intf,
1106 const struct usb_device_id *id) 1106 const struct usb_device_id *id)
1107{ 1107{
1108 struct usb_device *udev = interface_to_usbdev(intf); 1108 struct usb_device *udev = interface_to_usbdev(intf);
1109 struct device *dev = &intf->dev; 1109 struct device *dev = &intf->dev;
@@ -1241,7 +1241,7 @@ no_endpoints:
1241 return retval; 1241 return retval;
1242} 1242}
1243 1243
1244static void __devexit redrat3_dev_disconnect(struct usb_interface *intf) 1244static void redrat3_dev_disconnect(struct usb_interface *intf)
1245{ 1245{
1246 struct usb_device *udev = interface_to_usbdev(intf); 1246 struct usb_device *udev = interface_to_usbdev(intf);
1247 struct redrat3_dev *rr3 = usb_get_intfdata(intf); 1247 struct redrat3_dev *rr3 = usb_get_intfdata(intf);
@@ -1281,7 +1281,7 @@ static int redrat3_dev_resume(struct usb_interface *intf)
1281static struct usb_driver redrat3_dev_driver = { 1281static struct usb_driver redrat3_dev_driver = {
1282 .name = DRIVER_NAME, 1282 .name = DRIVER_NAME,
1283 .probe = redrat3_dev_probe, 1283 .probe = redrat3_dev_probe,
1284 .disconnect = __devexit_p(redrat3_dev_disconnect), 1284 .disconnect = redrat3_dev_disconnect,
1285 .suspend = redrat3_dev_suspend, 1285 .suspend = redrat3_dev_suspend,
1286 .resume = redrat3_dev_resume, 1286 .resume = redrat3_dev_resume,
1287 .reset_resume = redrat3_dev_resume, 1287 .reset_resume = redrat3_dev_resume,
diff --git a/drivers/media/rc/streamzap.c b/drivers/media/rc/streamzap.c
index c720f12f661e..d7b11e6a9982 100644
--- a/drivers/media/rc/streamzap.c
+++ b/drivers/media/rc/streamzap.c
@@ -346,8 +346,8 @@ out:
346 * On any failure the return value is the ERROR 346 * On any failure the return value is the ERROR
347 * On success return 0 347 * On success return 0
348 */ 348 */
349static int __devinit streamzap_probe(struct usb_interface *intf, 349static int streamzap_probe(struct usb_interface *intf,
350 const struct usb_device_id *id) 350 const struct usb_device_id *id)
351{ 351{
352 struct usb_device *usbdev = interface_to_usbdev(intf); 352 struct usb_device *usbdev = interface_to_usbdev(intf);
353 struct usb_host_interface *iface_host; 353 struct usb_host_interface *iface_host;
diff --git a/drivers/media/rc/ttusbir.c b/drivers/media/rc/ttusbir.c
index f0921b5483eb..78be8a914225 100644
--- a/drivers/media/rc/ttusbir.c
+++ b/drivers/media/rc/ttusbir.c
@@ -194,8 +194,8 @@ static void ttusbir_urb_complete(struct urb *urb)
194 dev_warn(tt->dev, "failed to resubmit urb: %d\n", rc); 194 dev_warn(tt->dev, "failed to resubmit urb: %d\n", rc);
195} 195}
196 196
197static int __devinit ttusbir_probe(struct usb_interface *intf, 197static int ttusbir_probe(struct usb_interface *intf,
198 const struct usb_device_id *id) 198 const struct usb_device_id *id)
199{ 199{
200 struct ttusbir *tt; 200 struct ttusbir *tt;
201 struct usb_interface_descriptor *idesc; 201 struct usb_interface_descriptor *idesc;
@@ -367,7 +367,7 @@ out:
367 return ret; 367 return ret;
368} 368}
369 369
370static void __devexit ttusbir_disconnect(struct usb_interface *intf) 370static void ttusbir_disconnect(struct usb_interface *intf)
371{ 371{
372 struct ttusbir *tt = usb_get_intfdata(intf); 372 struct ttusbir *tt = usb_get_intfdata(intf);
373 struct usb_device *udev = tt->udev; 373 struct usb_device *udev = tt->udev;
@@ -435,7 +435,7 @@ static struct usb_driver ttusbir_driver = {
435 .suspend = ttusbir_suspend, 435 .suspend = ttusbir_suspend,
436 .resume = ttusbir_resume, 436 .resume = ttusbir_resume,
437 .reset_resume = ttusbir_resume, 437 .reset_resume = ttusbir_resume,
438 .disconnect = __devexit_p(ttusbir_disconnect) 438 .disconnect = ttusbir_disconnect,
439}; 439};
440 440
441module_usb_driver(ttusbir_driver); 441module_usb_driver(ttusbir_driver);
diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c
index 7f3c476dde05..930c61499037 100644
--- a/drivers/media/rc/winbond-cir.c
+++ b/drivers/media/rc/winbond-cir.c
@@ -1008,7 +1008,7 @@ wbcir_resume(struct pnp_dev *device)
1008 return 0; 1008 return 0;
1009} 1009}
1010 1010
1011static int __devinit 1011static int
1012wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id) 1012wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id)
1013{ 1013{
1014 struct device *dev = &device->dev; 1014 struct device *dev = &device->dev;
@@ -1155,7 +1155,7 @@ exit:
1155 return err; 1155 return err;
1156} 1156}
1157 1157
1158static void __devexit 1158static void
1159wbcir_remove(struct pnp_dev *device) 1159wbcir_remove(struct pnp_dev *device)
1160{ 1160{
1161 struct wbcir_data *data = pnp_get_drvdata(device); 1161 struct wbcir_data *data = pnp_get_drvdata(device);
@@ -1201,7 +1201,7 @@ static struct pnp_driver wbcir_driver = {
1201 .name = WBCIR_NAME, 1201 .name = WBCIR_NAME,
1202 .id_table = wbcir_ids, 1202 .id_table = wbcir_ids,
1203 .probe = wbcir_probe, 1203 .probe = wbcir_probe,
1204 .remove = __devexit_p(wbcir_remove), 1204 .remove = wbcir_remove,
1205 .suspend = wbcir_suspend, 1205 .suspend = wbcir_suspend,
1206 .resume = wbcir_resume, 1206 .resume = wbcir_resume,
1207 .shutdown = wbcir_shutdown 1207 .shutdown = wbcir_shutdown
diff --git a/drivers/media/usb/gspca/kinect.c b/drivers/media/usb/gspca/kinect.c
index 40ad6687ee5d..3773a8a745df 100644
--- a/drivers/media/usb/gspca/kinect.c
+++ b/drivers/media/usb/gspca/kinect.c
@@ -381,6 +381,7 @@ static const struct sd_desc sd_desc = {
381/* -- module initialisation -- */ 381/* -- module initialisation -- */
382static const struct usb_device_id device_table[] = { 382static const struct usb_device_id device_table[] = {
383 {USB_DEVICE(0x045e, 0x02ae)}, 383 {USB_DEVICE(0x045e, 0x02ae)},
384 {USB_DEVICE(0x045e, 0x02bf)},
384 {} 385 {}
385}; 386};
386 387
diff --git a/drivers/media/usb/gspca/sonixb.c b/drivers/media/usb/gspca/sonixb.c
index 70511d5f9538..1220340e7602 100644
--- a/drivers/media/usb/gspca/sonixb.c
+++ b/drivers/media/usb/gspca/sonixb.c
@@ -496,7 +496,7 @@ static void reg_w(struct gspca_dev *gspca_dev,
496 } 496 }
497} 497}
498 498
499static void i2c_w(struct gspca_dev *gspca_dev, const __u8 *buffer) 499static void i2c_w(struct gspca_dev *gspca_dev, const u8 *buf)
500{ 500{
501 int retry = 60; 501 int retry = 60;
502 502
@@ -504,16 +504,19 @@ static void i2c_w(struct gspca_dev *gspca_dev, const __u8 *buffer)
504 return; 504 return;
505 505
506 /* is i2c ready */ 506 /* is i2c ready */
507 reg_w(gspca_dev, 0x08, buffer, 8); 507 reg_w(gspca_dev, 0x08, buf, 8);
508 while (retry--) { 508 while (retry--) {
509 if (gspca_dev->usb_err < 0) 509 if (gspca_dev->usb_err < 0)
510 return; 510 return;
511 msleep(10); 511 msleep(1);
512 reg_r(gspca_dev, 0x08); 512 reg_r(gspca_dev, 0x08);
513 if (gspca_dev->usb_buf[0] & 0x04) { 513 if (gspca_dev->usb_buf[0] & 0x04) {
514 if (gspca_dev->usb_buf[0] & 0x08) { 514 if (gspca_dev->usb_buf[0] & 0x08) {
515 dev_err(gspca_dev->v4l2_dev.dev, 515 dev_err(gspca_dev->v4l2_dev.dev,
516 "i2c write error\n"); 516 "i2c error writing %02x %02x %02x %02x"
517 " %02x %02x %02x %02x\n",
518 buf[0], buf[1], buf[2], buf[3],
519 buf[4], buf[5], buf[6], buf[7]);
517 gspca_dev->usb_err = -EIO; 520 gspca_dev->usb_err = -EIO;
518 } 521 }
519 return; 522 return;
@@ -530,7 +533,7 @@ static void i2c_w_vector(struct gspca_dev *gspca_dev,
530 for (;;) { 533 for (;;) {
531 if (gspca_dev->usb_err < 0) 534 if (gspca_dev->usb_err < 0)
532 return; 535 return;
533 reg_w(gspca_dev, 0x08, *buffer, 8); 536 i2c_w(gspca_dev, *buffer);
534 len -= 8; 537 len -= 8;
535 if (len <= 0) 538 if (len <= 0)
536 break; 539 break;
diff --git a/drivers/media/usb/gspca/sonixj.c b/drivers/media/usb/gspca/sonixj.c
index 5a86047b846f..36307a9028a9 100644
--- a/drivers/media/usb/gspca/sonixj.c
+++ b/drivers/media/usb/gspca/sonixj.c
@@ -1550,6 +1550,7 @@ static void i2c_w1(struct gspca_dev *gspca_dev, u8 reg, u8 val)
1550 0, 1550 0,
1551 gspca_dev->usb_buf, 8, 1551 gspca_dev->usb_buf, 8,
1552 500); 1552 500);
1553 msleep(2);
1553 if (ret < 0) { 1554 if (ret < 0) {
1554 pr_err("i2c_w1 err %d\n", ret); 1555 pr_err("i2c_w1 err %d\n", ret);
1555 gspca_dev->usb_err = ret; 1556 gspca_dev->usb_err = ret;
diff --git a/drivers/media/usb/gspca/spca506.c b/drivers/media/usb/gspca/spca506.c
index bab01c86c315..bcd2c04c770e 100644
--- a/drivers/media/usb/gspca/spca506.c
+++ b/drivers/media/usb/gspca/spca506.c
@@ -590,8 +590,7 @@ static const struct usb_device_id device_table[] = {
590MODULE_DEVICE_TABLE(usb, device_table); 590MODULE_DEVICE_TABLE(usb, device_table);
591 591
592/* -- device connect -- */ 592/* -- device connect -- */
593static int __devinit sd_probe(struct usb_interface *intf, 593static int sd_probe(struct usb_interface *intf, const struct usb_device_id *id)
594 const struct usb_device_id *id)
595{ 594{
596 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), 595 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
597 THIS_MODULE); 596 THIS_MODULE);
diff --git a/drivers/media/usb/siano/smsusb.c b/drivers/media/usb/siano/smsusb.c
index aac622200e99..de2c10289eec 100644
--- a/drivers/media/usb/siano/smsusb.c
+++ b/drivers/media/usb/siano/smsusb.c
@@ -389,7 +389,7 @@ static int smsusb_init_device(struct usb_interface *intf, int board_id)
389 return rc; 389 return rc;
390} 390}
391 391
392static int __devinit smsusb_probe(struct usb_interface *intf, 392static int smsusb_probe(struct usb_interface *intf,
393 const struct usb_device_id *id) 393 const struct usb_device_id *id)
394{ 394{
395 struct usb_device *udev = interface_to_usbdev(intf); 395 struct usb_device *udev = interface_to_usbdev(intf);
diff --git a/drivers/media/usb/usbvision/usbvision-video.c b/drivers/media/usb/usbvision/usbvision-video.c
index 5c36a57e6590..ad7f7448072e 100644
--- a/drivers/media/usb/usbvision/usbvision-video.c
+++ b/drivers/media/usb/usbvision/usbvision-video.c
@@ -1363,7 +1363,7 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision)
1363} 1363}
1364 1364
1365/* register video4linux devices */ 1365/* register video4linux devices */
1366static int __devinit usbvision_register_video(struct usb_usbvision *usbvision) 1366static int usbvision_register_video(struct usb_usbvision *usbvision)
1367{ 1367{
1368 /* Video Device: */ 1368 /* Video Device: */
1369 usbvision->vdev = usbvision_vdev_init(usbvision, 1369 usbvision->vdev = usbvision_vdev_init(usbvision,
@@ -1510,8 +1510,8 @@ static void usbvision_configure_video(struct usb_usbvision *usbvision)
1510 * if it looks like USBVISION video device 1510 * if it looks like USBVISION video device
1511 * 1511 *
1512 */ 1512 */
1513static int __devinit usbvision_probe(struct usb_interface *intf, 1513static int usbvision_probe(struct usb_interface *intf,
1514 const struct usb_device_id *devid) 1514 const struct usb_device_id *devid)
1515{ 1515{
1516 struct usb_device *dev = usb_get_dev(interface_to_usbdev(intf)); 1516 struct usb_device *dev = usb_get_dev(interface_to_usbdev(intf));
1517 struct usb_interface *uif; 1517 struct usb_interface *uif;
@@ -1619,7 +1619,7 @@ static int __devinit usbvision_probe(struct usb_interface *intf,
1619 * with no ill consequences. 1619 * with no ill consequences.
1620 * 1620 *
1621 */ 1621 */
1622static void __devexit usbvision_disconnect(struct usb_interface *intf) 1622static void usbvision_disconnect(struct usb_interface *intf)
1623{ 1623{
1624 struct usb_usbvision *usbvision = to_usbvision(usb_get_intfdata(intf)); 1624 struct usb_usbvision *usbvision = to_usbvision(usb_get_intfdata(intf));
1625 1625
@@ -1664,7 +1664,7 @@ static struct usb_driver usbvision_driver = {
1664 .name = "usbvision", 1664 .name = "usbvision",
1665 .id_table = usbvision_table, 1665 .id_table = usbvision_table,
1666 .probe = usbvision_probe, 1666 .probe = usbvision_probe,
1667 .disconnect = __devexit_p(usbvision_disconnect), 1667 .disconnect = usbvision_disconnect,
1668}; 1668};
1669 1669
1670/* 1670/*
diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
index 516a5b188ea5..d5baab17a5ef 100644
--- a/drivers/media/usb/uvc/uvc_ctrl.c
+++ b/drivers/media/usb/uvc/uvc_ctrl.c
@@ -1061,7 +1061,7 @@ int uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,
1061 1061
1062 ctrl = uvc_find_control(chain, v4l2_ctrl->id, &mapping); 1062 ctrl = uvc_find_control(chain, v4l2_ctrl->id, &mapping);
1063 if (ctrl == NULL) { 1063 if (ctrl == NULL) {
1064 ret = -ENOENT; 1064 ret = -EINVAL;
1065 goto done; 1065 goto done;
1066 } 1066 }
1067 1067
@@ -1099,13 +1099,12 @@ int uvc_query_v4l2_menu(struct uvc_video_chain *chain,
1099 return -ERESTARTSYS; 1099 return -ERESTARTSYS;
1100 1100
1101 ctrl = uvc_find_control(chain, query_menu->id, &mapping); 1101 ctrl = uvc_find_control(chain, query_menu->id, &mapping);
1102 if (ctrl == NULL) { 1102 if (ctrl == NULL || mapping->v4l2_type != V4L2_CTRL_TYPE_MENU) {
1103 ret = -ENOENT; 1103 ret = -EINVAL;
1104 goto done; 1104 goto done;
1105 } 1105 }
1106 1106
1107 if (mapping->v4l2_type != V4L2_CTRL_TYPE_MENU || 1107 if (query_menu->index >= mapping->menu_count) {
1108 query_menu->index >= mapping->menu_count) {
1109 ret = -EINVAL; 1108 ret = -EINVAL;
1110 goto done; 1109 goto done;
1111 } 1110 }
@@ -1264,7 +1263,7 @@ static int uvc_ctrl_add_event(struct v4l2_subscribed_event *sev, unsigned elems)
1264 1263
1265 ctrl = uvc_find_control(handle->chain, sev->id, &mapping); 1264 ctrl = uvc_find_control(handle->chain, sev->id, &mapping);
1266 if (ctrl == NULL) { 1265 if (ctrl == NULL) {
1267 ret = -ENOENT; 1266 ret = -EINVAL;
1268 goto done; 1267 goto done;
1269 } 1268 }
1270 1269
@@ -1415,7 +1414,7 @@ int uvc_ctrl_get(struct uvc_video_chain *chain,
1415 1414
1416 ctrl = uvc_find_control(chain, xctrl->id, &mapping); 1415 ctrl = uvc_find_control(chain, xctrl->id, &mapping);
1417 if (ctrl == NULL) 1416 if (ctrl == NULL)
1418 return -ENOENT; 1417 return -EINVAL;
1419 1418
1420 return __uvc_ctrl_get(chain, ctrl, mapping, &xctrl->value); 1419 return __uvc_ctrl_get(chain, ctrl, mapping, &xctrl->value);
1421} 1420}
@@ -1433,7 +1432,7 @@ int uvc_ctrl_set(struct uvc_video_chain *chain,
1433 1432
1434 ctrl = uvc_find_control(chain, xctrl->id, &mapping); 1433 ctrl = uvc_find_control(chain, xctrl->id, &mapping);
1435 if (ctrl == NULL) 1434 if (ctrl == NULL)
1436 return -ENOENT; 1435 return -EINVAL;
1437 if (!(ctrl->info.flags & UVC_CTRL_FLAG_SET_CUR)) 1436 if (!(ctrl->info.flags & UVC_CTRL_FLAG_SET_CUR))
1438 return -EACCES; 1437 return -EACCES;
1439 1438
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
index 8e056046bc20..68d59b527492 100644
--- a/drivers/media/usb/uvc/uvc_v4l2.c
+++ b/drivers/media/usb/uvc/uvc_v4l2.c
@@ -607,10 +607,8 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
607 607
608 ret = uvc_ctrl_get(chain, &xctrl); 608 ret = uvc_ctrl_get(chain, &xctrl);
609 uvc_ctrl_rollback(handle); 609 uvc_ctrl_rollback(handle);
610 if (ret < 0) 610 if (ret >= 0)
611 return ret == -ENOENT ? -EINVAL : ret; 611 ctrl->value = xctrl.value;
612
613 ctrl->value = xctrl.value;
614 break; 612 break;
615 } 613 }
616 614
@@ -634,7 +632,7 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
634 ret = uvc_ctrl_set(chain, &xctrl); 632 ret = uvc_ctrl_set(chain, &xctrl);
635 if (ret < 0) { 633 if (ret < 0) {
636 uvc_ctrl_rollback(handle); 634 uvc_ctrl_rollback(handle);
637 return ret == -ENOENT ? -EINVAL : ret; 635 return ret;
638 } 636 }
639 ret = uvc_ctrl_commit(handle, &xctrl, 1); 637 ret = uvc_ctrl_commit(handle, &xctrl, 1);
640 if (ret == 0) 638 if (ret == 0)
@@ -659,9 +657,8 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
659 ret = uvc_ctrl_get(chain, ctrl); 657 ret = uvc_ctrl_get(chain, ctrl);
660 if (ret < 0) { 658 if (ret < 0) {
661 uvc_ctrl_rollback(handle); 659 uvc_ctrl_rollback(handle);
662 ctrls->error_idx = ret == -ENOENT 660 ctrls->error_idx = i;
663 ? ctrls->count : i; 661 return ret;
664 return ret == -ENOENT ? -EINVAL : ret;
665 } 662 }
666 } 663 }
667 ctrls->error_idx = 0; 664 ctrls->error_idx = 0;
@@ -688,10 +685,9 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
688 ret = uvc_ctrl_set(chain, ctrl); 685 ret = uvc_ctrl_set(chain, ctrl);
689 if (ret < 0) { 686 if (ret < 0) {
690 uvc_ctrl_rollback(handle); 687 uvc_ctrl_rollback(handle);
691 ctrls->error_idx = (ret == -ENOENT && 688 ctrls->error_idx = cmd == VIDIOC_S_EXT_CTRLS
692 cmd == VIDIOC_S_EXT_CTRLS)
693 ? ctrls->count : i; 689 ? ctrls->count : i;
694 return ret == -ENOENT ? -EINVAL : ret; 690 return ret;
695 } 691 }
696 } 692 }
697 693
diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
index 9f81be23a81f..e02c4797b1c6 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -921,8 +921,10 @@ static void __fill_vb2_buffer(struct vb2_buffer *vb, const struct v4l2_buffer *b
921 * In videobuf we use our internal V4l2_planes struct for 921 * In videobuf we use our internal V4l2_planes struct for
922 * single-planar buffers as well, for simplicity. 922 * single-planar buffers as well, for simplicity.
923 */ 923 */
924 if (V4L2_TYPE_IS_OUTPUT(b->type)) 924 if (V4L2_TYPE_IS_OUTPUT(b->type)) {
925 v4l2_planes[0].bytesused = b->bytesused; 925 v4l2_planes[0].bytesused = b->bytesused;
926 v4l2_planes[0].data_offset = 0;
927 }
926 928
927 if (b->memory == V4L2_MEMORY_USERPTR) { 929 if (b->memory == V4L2_MEMORY_USERPTR) {
928 v4l2_planes[0].m.userptr = b->m.userptr; 930 v4l2_planes[0].m.userptr = b->m.userptr;
diff --git a/drivers/memory/tegra20-mc.c b/drivers/memory/tegra20-mc.c
index e6764bb41cb9..186f27d9e5f1 100644
--- a/drivers/memory/tegra20-mc.c
+++ b/drivers/memory/tegra20-mc.c
@@ -177,7 +177,7 @@ static void tegra20_mc_decode(struct tegra20_mc *mc, int n)
177 "carveout" : "trustzone") : ""); 177 "carveout" : "trustzone") : "");
178} 178}
179 179
180static const struct of_device_id tegra20_mc_of_match[] __devinitconst = { 180static const struct of_device_id tegra20_mc_of_match[] = {
181 { .compatible = "nvidia,tegra20-mc", }, 181 { .compatible = "nvidia,tegra20-mc", },
182 {}, 182 {},
183}; 183};
@@ -198,7 +198,7 @@ static irqreturn_t tegra20_mc_isr(int irq, void *data)
198 return IRQ_HANDLED; 198 return IRQ_HANDLED;
199} 199}
200 200
201static int __devinit tegra20_mc_probe(struct platform_device *pdev) 201static int tegra20_mc_probe(struct platform_device *pdev)
202{ 202{
203 struct resource *irq; 203 struct resource *irq;
204 struct tegra20_mc *mc; 204 struct tegra20_mc *mc;
diff --git a/drivers/memory/tegra30-mc.c b/drivers/memory/tegra30-mc.c
index 802b9ea431fa..0b7ab9332a18 100644
--- a/drivers/memory/tegra30-mc.c
+++ b/drivers/memory/tegra30-mc.c
@@ -295,7 +295,7 @@ static UNIVERSAL_DEV_PM_OPS(tegra30_mc_pm,
295 tegra30_mc_suspend, 295 tegra30_mc_suspend,
296 tegra30_mc_resume, NULL); 296 tegra30_mc_resume, NULL);
297 297
298static const struct of_device_id tegra30_mc_of_match[] __devinitconst = { 298static const struct of_device_id tegra30_mc_of_match[] = {
299 { .compatible = "nvidia,tegra30-mc", }, 299 { .compatible = "nvidia,tegra30-mc", },
300 {}, 300 {},
301}; 301};
@@ -316,7 +316,7 @@ static irqreturn_t tegra30_mc_isr(int irq, void *data)
316 return IRQ_HANDLED; 316 return IRQ_HANDLED;
317} 317}
318 318
319static int __devinit tegra30_mc_probe(struct platform_device *pdev) 319static int tegra30_mc_probe(struct platform_device *pdev)
320{ 320{
321 struct resource *irq; 321 struct resource *irq;
322 struct tegra30_mc *mc; 322 struct tegra30_mc *mc;
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index d784c36707c0..c13cd9bc590b 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -100,7 +100,7 @@ static int mptfc_slave_alloc(struct scsi_device *sdev);
100static int mptfc_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *SCpnt); 100static int mptfc_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *SCpnt);
101static void mptfc_target_destroy(struct scsi_target *starget); 101static void mptfc_target_destroy(struct scsi_target *starget);
102static void mptfc_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout); 102static void mptfc_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout);
103static void __devexit mptfc_remove(struct pci_dev *pdev); 103static void mptfc_remove(struct pci_dev *pdev);
104static int mptfc_abort(struct scsi_cmnd *SCpnt); 104static int mptfc_abort(struct scsi_cmnd *SCpnt);
105static int mptfc_dev_reset(struct scsi_cmnd *SCpnt); 105static int mptfc_dev_reset(struct scsi_cmnd *SCpnt);
106static int mptfc_bus_reset(struct scsi_cmnd *SCpnt); 106static int mptfc_bus_reset(struct scsi_cmnd *SCpnt);
@@ -1360,7 +1360,7 @@ static struct pci_driver mptfc_driver = {
1360 .name = "mptfc", 1360 .name = "mptfc",
1361 .id_table = mptfc_pci_table, 1361 .id_table = mptfc_pci_table,
1362 .probe = mptfc_probe, 1362 .probe = mptfc_probe,
1363 .remove = __devexit_p(mptfc_remove), 1363 .remove = mptfc_remove,
1364 .shutdown = mptscsih_shutdown, 1364 .shutdown = mptscsih_shutdown,
1365#ifdef CONFIG_PM 1365#ifdef CONFIG_PM
1366 .suspend = mptscsih_suspend, 1366 .suspend = mptscsih_suspend,
@@ -1496,8 +1496,7 @@ mptfc_init(void)
1496 * @pdev: Pointer to pci_dev structure 1496 * @pdev: Pointer to pci_dev structure
1497 * 1497 *
1498 */ 1498 */
1499static void __devexit 1499static void mptfc_remove(struct pci_dev *pdev)
1500mptfc_remove(struct pci_dev *pdev)
1501{ 1500{
1502 MPT_ADAPTER *ioc = pci_get_drvdata(pdev); 1501 MPT_ADAPTER *ioc = pci_get_drvdata(pdev);
1503 struct mptfc_rport_info *p, *n; 1502 struct mptfc_rport_info *p, *n;
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 551262e4b96e..fa43c391c8ed 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -5332,7 +5332,7 @@ mptsas_shutdown(struct pci_dev *pdev)
5332 mptsas_cleanup_fw_event_q(ioc); 5332 mptsas_cleanup_fw_event_q(ioc);
5333} 5333}
5334 5334
5335static void __devexit mptsas_remove(struct pci_dev *pdev) 5335static void mptsas_remove(struct pci_dev *pdev)
5336{ 5336{
5337 MPT_ADAPTER *ioc = pci_get_drvdata(pdev); 5337 MPT_ADAPTER *ioc = pci_get_drvdata(pdev);
5338 struct mptsas_portinfo *p, *n; 5338 struct mptsas_portinfo *p, *n;
@@ -5387,7 +5387,7 @@ static struct pci_driver mptsas_driver = {
5387 .name = "mptsas", 5387 .name = "mptsas",
5388 .id_table = mptsas_pci_table, 5388 .id_table = mptsas_pci_table,
5389 .probe = mptsas_probe, 5389 .probe = mptsas_probe,
5390 .remove = __devexit_p(mptsas_remove), 5390 .remove = mptsas_remove,
5391 .shutdown = mptsas_shutdown, 5391 .shutdown = mptsas_shutdown,
5392#ifdef CONFIG_PM 5392#ifdef CONFIG_PM
5393 .suspend = mptscsih_suspend, 5393 .suspend = mptscsih_suspend,
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c
index 8f61ba6aac23..c3aabde2dc4f 100644
--- a/drivers/message/fusion/mptspi.c
+++ b/drivers/message/fusion/mptspi.c
@@ -1550,7 +1550,7 @@ static struct pci_driver mptspi_driver = {
1550 .name = "mptspi", 1550 .name = "mptspi",
1551 .id_table = mptspi_pci_table, 1551 .id_table = mptspi_pci_table,
1552 .probe = mptspi_probe, 1552 .probe = mptspi_probe,
1553 .remove = __devexit_p(mptscsih_remove), 1553 .remove = mptscsih_remove,
1554 .shutdown = mptscsih_shutdown, 1554 .shutdown = mptscsih_shutdown,
1555#ifdef CONFIG_PM 1555#ifdef CONFIG_PM
1556 .suspend = mptscsih_suspend, 1556 .suspend = mptscsih_suspend,
diff --git a/drivers/message/i2o/pci.c b/drivers/message/i2o/pci.c
index 7190d5239b4f..0f9f3e1a2b6b 100644
--- a/drivers/message/i2o/pci.c
+++ b/drivers/message/i2o/pci.c
@@ -37,7 +37,7 @@
37#define OSM_DESCRIPTION "I2O-subsystem" 37#define OSM_DESCRIPTION "I2O-subsystem"
38 38
39/* PCI device id table for all I2O controllers */ 39/* PCI device id table for all I2O controllers */
40static struct pci_device_id __devinitdata i2o_pci_ids[] = { 40static struct pci_device_id i2o_pci_ids[] = {
41 {PCI_DEVICE_CLASS(PCI_CLASS_INTELLIGENT_I2O << 8, 0xffff00)}, 41 {PCI_DEVICE_CLASS(PCI_CLASS_INTELLIGENT_I2O << 8, 0xffff00)},
42 {PCI_DEVICE(PCI_VENDOR_ID_DPT, 0xa511)}, 42 {PCI_DEVICE(PCI_VENDOR_ID_DPT, 0xa511)},
43 {.vendor = PCI_VENDOR_ID_INTEL,.device = 0x1962, 43 {.vendor = PCI_VENDOR_ID_INTEL,.device = 0x1962,
@@ -84,7 +84,7 @@ static void i2o_pci_free(struct i2o_controller *c)
84 * 84 *
85 * Returns 0 on success or negative error code on failure. 85 * Returns 0 on success or negative error code on failure.
86 */ 86 */
87static int __devinit i2o_pci_alloc(struct i2o_controller *c) 87static int i2o_pci_alloc(struct i2o_controller *c)
88{ 88{
89 struct pci_dev *pdev = c->pdev; 89 struct pci_dev *pdev = c->pdev;
90 struct device *dev = &pdev->dev; 90 struct device *dev = &pdev->dev;
@@ -315,8 +315,7 @@ static void i2o_pci_irq_disable(struct i2o_controller *c)
315 * 315 *
316 * Returns 0 on success or negative error code on failure. 316 * Returns 0 on success or negative error code on failure.
317 */ 317 */
318static int __devinit i2o_pci_probe(struct pci_dev *pdev, 318static int i2o_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
319 const struct pci_device_id *id)
320{ 319{
321 struct i2o_controller *c; 320 struct i2o_controller *c;
322 int rc; 321 int rc;
@@ -453,7 +452,7 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev,
453 * Reset the I2O controller, disable interrupts and remove all allocated 452 * Reset the I2O controller, disable interrupts and remove all allocated
454 * resources. 453 * resources.
455 */ 454 */
456static void __devexit i2o_pci_remove(struct pci_dev *pdev) 455static void i2o_pci_remove(struct pci_dev *pdev)
457{ 456{
458 struct i2o_controller *c; 457 struct i2o_controller *c;
459 c = pci_get_drvdata(pdev); 458 c = pci_get_drvdata(pdev);
@@ -474,7 +473,7 @@ static struct pci_driver i2o_pci_driver = {
474 .name = "PCI_I2O", 473 .name = "PCI_I2O",
475 .id_table = i2o_pci_ids, 474 .id_table = i2o_pci_ids,
476 .probe = i2o_pci_probe, 475 .probe = i2o_pci_probe,
477 .remove = __devexit_p(i2o_pci_remove), 476 .remove = i2o_pci_remove,
478}; 477};
479 478
480/** 479/**
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 1c0abd4dfc43..ff553babf455 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -237,6 +237,7 @@ config MFD_TPS65910
237 depends on I2C=y && GPIOLIB 237 depends on I2C=y && GPIOLIB
238 select MFD_CORE 238 select MFD_CORE
239 select REGMAP_I2C 239 select REGMAP_I2C
240 select REGMAP_IRQ
240 select IRQ_DOMAIN 241 select IRQ_DOMAIN
241 help 242 help
242 if you say yes here you get support for the TPS65910 series of 243 if you say yes here you get support for the TPS65910 series of
@@ -292,6 +293,7 @@ config TWL4030_CORE
292 bool "Texas Instruments TWL4030/TWL5030/TWL6030/TPS659x0 Support" 293 bool "Texas Instruments TWL4030/TWL5030/TWL6030/TPS659x0 Support"
293 depends on I2C=y && GENERIC_HARDIRQS 294 depends on I2C=y && GENERIC_HARDIRQS
294 select IRQ_DOMAIN 295 select IRQ_DOMAIN
296 select REGMAP_I2C
295 help 297 help
296 Say yes here if you have TWL4030 / TWL6030 family chip on your board. 298 Say yes here if you have TWL4030 / TWL6030 family chip on your board.
297 This core driver provides register access and IRQ handling 299 This core driver provides register access and IRQ handling
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c
index e1650badd106..4778bb124efe 100644
--- a/drivers/mfd/ab8500-core.c
+++ b/drivers/mfd/ab8500-core.c
@@ -19,6 +19,7 @@
19#include <linux/mfd/core.h> 19#include <linux/mfd/core.h>
20#include <linux/mfd/abx500.h> 20#include <linux/mfd/abx500.h>
21#include <linux/mfd/abx500/ab8500.h> 21#include <linux/mfd/abx500/ab8500.h>
22#include <linux/mfd/abx500/ab8500-bm.h>
22#include <linux/mfd/dbx500-prcmu.h> 23#include <linux/mfd/dbx500-prcmu.h>
23#include <linux/regulator/ab8500.h> 24#include <linux/regulator/ab8500.h>
24#include <linux/of.h> 25#include <linux/of.h>
diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
index bc8a3edb6bbf..222c03a5ddc0 100644
--- a/drivers/mfd/arizona-core.c
+++ b/drivers/mfd/arizona-core.c
@@ -239,7 +239,12 @@ static int arizona_runtime_resume(struct device *dev)
239 return ret; 239 return ret;
240 } 240 }
241 241
242 regcache_sync(arizona->regmap); 242 ret = regcache_sync(arizona->regmap);
243 if (ret != 0) {
244 dev_err(arizona->dev, "Failed to restore register cache\n");
245 regulator_disable(arizona->dcvdd);
246 return ret;
247 }
243 248
244 return 0; 249 return 0;
245} 250}
diff --git a/drivers/mfd/arizona-irq.c b/drivers/mfd/arizona-irq.c
index 74713bf5371f..2bec5f0db3ee 100644
--- a/drivers/mfd/arizona-irq.c
+++ b/drivers/mfd/arizona-irq.c
@@ -176,14 +176,7 @@ int arizona_irq_init(struct arizona *arizona)
176 aod = &wm5102_aod; 176 aod = &wm5102_aod;
177 irq = &wm5102_irq; 177 irq = &wm5102_irq;
178 178
179 switch (arizona->rev) { 179 ctrlif_error = false;
180 case 0:
181 case 1:
182 ctrlif_error = false;
183 break;
184 default:
185 break;
186 }
187 break; 180 break;
188#endif 181#endif
189#ifdef CONFIG_MFD_WM5110 182#ifdef CONFIG_MFD_WM5110
@@ -191,14 +184,7 @@ int arizona_irq_init(struct arizona *arizona)
191 aod = &wm5110_aod; 184 aod = &wm5110_aod;
192 irq = &wm5110_irq; 185 irq = &wm5110_irq;
193 186
194 switch (arizona->rev) { 187 ctrlif_error = false;
195 case 0:
196 case 1:
197 ctrlif_error = false;
198 break;
199 default:
200 break;
201 }
202 break; 188 break;
203#endif 189#endif
204 default: 190 default:
diff --git a/drivers/mfd/da9052-i2c.c b/drivers/mfd/da9052-i2c.c
index ac74a4d1daea..885e56780358 100644
--- a/drivers/mfd/da9052-i2c.c
+++ b/drivers/mfd/da9052-i2c.c
@@ -27,6 +27,66 @@
27#include <linux/of_device.h> 27#include <linux/of_device.h>
28#endif 28#endif
29 29
30/* I2C safe register check */
31static inline bool i2c_safe_reg(unsigned char reg)
32{
33 switch (reg) {
34 case DA9052_STATUS_A_REG:
35 case DA9052_STATUS_B_REG:
36 case DA9052_STATUS_C_REG:
37 case DA9052_STATUS_D_REG:
38 case DA9052_ADC_RES_L_REG:
39 case DA9052_ADC_RES_H_REG:
40 case DA9052_VDD_RES_REG:
41 case DA9052_ICHG_AV_REG:
42 case DA9052_TBAT_RES_REG:
43 case DA9052_ADCIN4_RES_REG:
44 case DA9052_ADCIN5_RES_REG:
45 case DA9052_ADCIN6_RES_REG:
46 case DA9052_TJUNC_RES_REG:
47 case DA9052_TSI_X_MSB_REG:
48 case DA9052_TSI_Y_MSB_REG:
49 case DA9052_TSI_LSB_REG:
50 case DA9052_TSI_Z_MSB_REG:
51 return true;
52 default:
53 return false;
54 }
55}
56
57/*
58 * There is an issue with DA9052 and DA9053_AA/BA/BB PMIC where the PMIC
59 * gets lockup up or fails to respond following a system reset.
60 * This fix is to follow any read or write with a dummy read to a safe
61 * register.
62 */
63int da9052_i2c_fix(struct da9052 *da9052, unsigned char reg)
64{
65 int val;
66
67 switch (da9052->chip_id) {
68 case DA9052:
69 case DA9053_AA:
70 case DA9053_BA:
71 case DA9053_BB:
72 /* A dummy read to a safe register address. */
73 if (!i2c_safe_reg(reg))
74 return regmap_read(da9052->regmap,
75 DA9052_PARK_REGISTER,
76 &val);
77 break;
78 default:
79 /*
80 * For other chips parking of I2C register
81 * to a safe place is not required.
82 */
83 break;
84 }
85
86 return 0;
87}
88EXPORT_SYMBOL(da9052_i2c_fix);
89
30static int da9052_i2c_enable_multiwrite(struct da9052 *da9052) 90static int da9052_i2c_enable_multiwrite(struct da9052 *da9052)
31{ 91{
32 int reg_val, ret; 92 int reg_val, ret;
@@ -83,6 +143,7 @@ static int da9052_i2c_probe(struct i2c_client *client,
83 143
84 da9052->dev = &client->dev; 144 da9052->dev = &client->dev;
85 da9052->chip_irq = client->irq; 145 da9052->chip_irq = client->irq;
146 da9052->fix_io = da9052_i2c_fix;
86 147
87 i2c_set_clientdata(client, da9052); 148 i2c_set_clientdata(client, da9052);
88 149
diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c
index dc8826d8d69d..268f45d42394 100644
--- a/drivers/mfd/db8500-prcmu.c
+++ b/drivers/mfd/db8500-prcmu.c
@@ -2524,7 +2524,7 @@ static bool read_mailbox_0(void)
2524 2524
2525 for (n = 0; n < NUM_PRCMU_WAKEUPS; n++) { 2525 for (n = 0; n < NUM_PRCMU_WAKEUPS; n++) {
2526 if (ev & prcmu_irq_bit[n]) 2526 if (ev & prcmu_irq_bit[n])
2527 generic_handle_irq(IRQ_PRCMU_BASE + n); 2527 generic_handle_irq(irq_find_mapping(db8500_irq_domain, n));
2528 } 2528 }
2529 r = true; 2529 r = true;
2530 break; 2530 break;
@@ -2737,13 +2737,14 @@ static int db8500_irq_map(struct irq_domain *d, unsigned int virq,
2737} 2737}
2738 2738
2739static struct irq_domain_ops db8500_irq_ops = { 2739static struct irq_domain_ops db8500_irq_ops = {
2740 .map = db8500_irq_map, 2740 .map = db8500_irq_map,
2741 .xlate = irq_domain_xlate_twocell, 2741 .xlate = irq_domain_xlate_twocell,
2742}; 2742};
2743 2743
2744static int db8500_irq_init(struct device_node *np) 2744static int db8500_irq_init(struct device_node *np)
2745{ 2745{
2746 int irq_base = -1; 2746 int irq_base = 0;
2747 int i;
2747 2748
2748 /* In the device tree case, just take some IRQs */ 2749 /* In the device tree case, just take some IRQs */
2749 if (!np) 2750 if (!np)
@@ -2758,6 +2759,10 @@ static int db8500_irq_init(struct device_node *np)
2758 return -ENOSYS; 2759 return -ENOSYS;
2759 } 2760 }
2760 2761
2762 /* All wakeups will be used, so create mappings for all */
2763 for (i = 0; i < NUM_PRCMU_WAKEUPS; i++)
2764 irq_create_mapping(db8500_irq_domain, i);
2765
2761 return 0; 2766 return 0;
2762} 2767}
2763 2768
diff --git a/drivers/mfd/max77686.c b/drivers/mfd/max77686.c
index f6878f8db57d..4d73963cd8f0 100644
--- a/drivers/mfd/max77686.c
+++ b/drivers/mfd/max77686.c
@@ -93,15 +93,6 @@ static int max77686_i2c_probe(struct i2c_client *i2c,
93 if (max77686 == NULL) 93 if (max77686 == NULL)
94 return -ENOMEM; 94 return -ENOMEM;
95 95
96 max77686->regmap = regmap_init_i2c(i2c, &max77686_regmap_config);
97 if (IS_ERR(max77686->regmap)) {
98 ret = PTR_ERR(max77686->regmap);
99 dev_err(max77686->dev, "Failed to allocate register map: %d\n",
100 ret);
101 kfree(max77686);
102 return ret;
103 }
104
105 i2c_set_clientdata(i2c, max77686); 96 i2c_set_clientdata(i2c, max77686);
106 max77686->dev = &i2c->dev; 97 max77686->dev = &i2c->dev;
107 max77686->i2c = i2c; 98 max77686->i2c = i2c;
@@ -111,6 +102,15 @@ static int max77686_i2c_probe(struct i2c_client *i2c,
111 max77686->irq_gpio = pdata->irq_gpio; 102 max77686->irq_gpio = pdata->irq_gpio;
112 max77686->irq = i2c->irq; 103 max77686->irq = i2c->irq;
113 104
105 max77686->regmap = regmap_init_i2c(i2c, &max77686_regmap_config);
106 if (IS_ERR(max77686->regmap)) {
107 ret = PTR_ERR(max77686->regmap);
108 dev_err(max77686->dev, "Failed to allocate register map: %d\n",
109 ret);
110 kfree(max77686);
111 return ret;
112 }
113
114 if (regmap_read(max77686->regmap, 114 if (regmap_read(max77686->regmap,
115 MAX77686_REG_DEVICE_ID, &data) < 0) { 115 MAX77686_REG_DEVICE_ID, &data) < 0) {
116 dev_err(max77686->dev, 116 dev_err(max77686->dev,
diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c
index cc5155e20494..9e60fed5ff82 100644
--- a/drivers/mfd/max77693.c
+++ b/drivers/mfd/max77693.c
@@ -114,35 +114,37 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
114 u8 reg_data; 114 u8 reg_data;
115 int ret = 0; 115 int ret = 0;
116 116
117 if (!pdata) {
118 dev_err(&i2c->dev, "No platform data found.\n");
119 return -EINVAL;
120 }
121
117 max77693 = devm_kzalloc(&i2c->dev, 122 max77693 = devm_kzalloc(&i2c->dev,
118 sizeof(struct max77693_dev), GFP_KERNEL); 123 sizeof(struct max77693_dev), GFP_KERNEL);
119 if (max77693 == NULL) 124 if (max77693 == NULL)
120 return -ENOMEM; 125 return -ENOMEM;
121 126
122 max77693->regmap = devm_regmap_init_i2c(i2c, &max77693_regmap_config);
123 if (IS_ERR(max77693->regmap)) {
124 ret = PTR_ERR(max77693->regmap);
125 dev_err(max77693->dev,"failed to allocate register map: %d\n",
126 ret);
127 goto err_regmap;
128 }
129
130 i2c_set_clientdata(i2c, max77693); 127 i2c_set_clientdata(i2c, max77693);
131 max77693->dev = &i2c->dev; 128 max77693->dev = &i2c->dev;
132 max77693->i2c = i2c; 129 max77693->i2c = i2c;
133 max77693->irq = i2c->irq; 130 max77693->irq = i2c->irq;
134 max77693->type = id->driver_data; 131 max77693->type = id->driver_data;
135 132
136 if (!pdata) 133 max77693->regmap = devm_regmap_init_i2c(i2c, &max77693_regmap_config);
137 goto err_regmap; 134 if (IS_ERR(max77693->regmap)) {
135 ret = PTR_ERR(max77693->regmap);
136 dev_err(max77693->dev, "failed to allocate register map: %d\n",
137 ret);
138 return ret;
139 }
138 140
139 max77693->wakeup = pdata->wakeup; 141 max77693->wakeup = pdata->wakeup;
140 142
141 if (max77693_read_reg(max77693->regmap, 143 ret = max77693_read_reg(max77693->regmap, MAX77693_PMIC_REG_PMIC_ID2,
142 MAX77693_PMIC_REG_PMIC_ID2, &reg_data) < 0) { 144 &reg_data);
145 if (ret < 0) {
143 dev_err(max77693->dev, "device not found on this channel\n"); 146 dev_err(max77693->dev, "device not found on this channel\n");
144 ret = -ENODEV; 147 return ret;
145 goto err_regmap;
146 } else 148 } else
147 dev_info(max77693->dev, "device ID: 0x%x\n", reg_data); 149 dev_info(max77693->dev, "device ID: 0x%x\n", reg_data);
148 150
@@ -163,7 +165,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
163 ret = PTR_ERR(max77693->regmap_muic); 165 ret = PTR_ERR(max77693->regmap_muic);
164 dev_err(max77693->dev, 166 dev_err(max77693->dev,
165 "failed to allocate register map: %d\n", ret); 167 "failed to allocate register map: %d\n", ret);
166 goto err_regmap; 168 goto err_regmap_muic;
167 } 169 }
168 170
169 ret = max77693_irq_init(max77693); 171 ret = max77693_irq_init(max77693);
@@ -184,9 +186,9 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
184err_mfd: 186err_mfd:
185 max77693_irq_exit(max77693); 187 max77693_irq_exit(max77693);
186err_irq: 188err_irq:
189err_regmap_muic:
187 i2c_unregister_device(max77693->muic); 190 i2c_unregister_device(max77693->muic);
188 i2c_unregister_device(max77693->haptic); 191 i2c_unregister_device(max77693->haptic);
189err_regmap:
190 return ret; 192 return ret;
191} 193}
192 194
diff --git a/drivers/mfd/max8997.c b/drivers/mfd/max8997.c
index abd5c80c7cf5..14714058f2d2 100644
--- a/drivers/mfd/max8997.c
+++ b/drivers/mfd/max8997.c
@@ -50,7 +50,7 @@ static struct mfd_cell max8997_devs[] = {
50}; 50};
51 51
52#ifdef CONFIG_OF 52#ifdef CONFIG_OF
53static struct of_device_id __devinitdata max8997_pmic_dt_match[] = { 53static struct of_device_id max8997_pmic_dt_match[] = {
54 { .compatible = "maxim,max8997-pmic", .data = TYPE_MAX8997 }, 54 { .compatible = "maxim,max8997-pmic", .data = TYPE_MAX8997 },
55 {}, 55 {},
56}; 56};
diff --git a/drivers/mfd/pcf50633-core.c b/drivers/mfd/pcf50633-core.c
index 64803f13bcec..d11567307fbe 100644
--- a/drivers/mfd/pcf50633-core.c
+++ b/drivers/mfd/pcf50633-core.c
@@ -208,6 +208,8 @@ static int pcf50633_probe(struct i2c_client *client,
208 if (!pcf) 208 if (!pcf)
209 return -ENOMEM; 209 return -ENOMEM;
210 210
211 i2c_set_clientdata(client, pcf);
212 pcf->dev = &client->dev;
211 pcf->pdata = pdata; 213 pcf->pdata = pdata;
212 214
213 mutex_init(&pcf->lock); 215 mutex_init(&pcf->lock);
@@ -219,9 +221,6 @@ static int pcf50633_probe(struct i2c_client *client,
219 return ret; 221 return ret;
220 } 222 }
221 223
222 i2c_set_clientdata(client, pcf);
223 pcf->dev = &client->dev;
224
225 version = pcf50633_reg_read(pcf, 0); 224 version = pcf50633_reg_read(pcf, 0);
226 variant = pcf50633_reg_read(pcf, 1); 225 variant = pcf50633_reg_read(pcf, 1);
227 if (version < 0 || variant < 0) { 226 if (version < 0 || variant < 0) {
diff --git a/drivers/mfd/retu-mfd.c b/drivers/mfd/retu-mfd.c
index 7ff4a37ab0c0..3ba048655bf3 100644
--- a/drivers/mfd/retu-mfd.c
+++ b/drivers/mfd/retu-mfd.c
@@ -171,8 +171,7 @@ static struct regmap_config retu_config = {
171 .val_bits = 16, 171 .val_bits = 16,
172}; 172};
173 173
174static int __devinit retu_probe(struct i2c_client *i2c, 174static int retu_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
175 const struct i2c_device_id *id)
176{ 175{
177 struct retu_dev *rdev; 176 struct retu_dev *rdev;
178 int ret; 177 int ret;
@@ -225,7 +224,7 @@ static int __devinit retu_probe(struct i2c_client *i2c,
225 return 0; 224 return 0;
226} 225}
227 226
228static int __devexit retu_remove(struct i2c_client *i2c) 227static int retu_remove(struct i2c_client *i2c)
229{ 228{
230 struct retu_dev *rdev = i2c_get_clientdata(i2c); 229 struct retu_dev *rdev = i2c_get_clientdata(i2c);
231 230
diff --git a/drivers/mfd/rtl8411.c b/drivers/mfd/rtl8411.c
index 89f046ca9e41..3d3b4addf81a 100644
--- a/drivers/mfd/rtl8411.c
+++ b/drivers/mfd/rtl8411.c
@@ -112,6 +112,21 @@ static int rtl8411_card_power_off(struct rtsx_pcr *pcr, int card)
112 BPP_LDO_POWB, BPP_LDO_SUSPEND); 112 BPP_LDO_POWB, BPP_LDO_SUSPEND);
113} 113}
114 114
115static int rtl8411_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage)
116{
117 u8 mask, val;
118
119 mask = (BPP_REG_TUNED18 << BPP_TUNED18_SHIFT_8411) | BPP_PAD_MASK;
120 if (voltage == OUTPUT_3V3)
121 val = (BPP_ASIC_3V3 << BPP_TUNED18_SHIFT_8411) | BPP_PAD_3V3;
122 else if (voltage == OUTPUT_1V8)
123 val = (BPP_ASIC_1V8 << BPP_TUNED18_SHIFT_8411) | BPP_PAD_1V8;
124 else
125 return -EINVAL;
126
127 return rtsx_pci_write_register(pcr, LDO_CTL, mask, val);
128}
129
115static unsigned int rtl8411_cd_deglitch(struct rtsx_pcr *pcr) 130static unsigned int rtl8411_cd_deglitch(struct rtsx_pcr *pcr)
116{ 131{
117 unsigned int card_exist; 132 unsigned int card_exist;
@@ -163,6 +178,18 @@ static unsigned int rtl8411_cd_deglitch(struct rtsx_pcr *pcr)
163 return card_exist; 178 return card_exist;
164} 179}
165 180
181static int rtl8411_conv_clk_and_div_n(int input, int dir)
182{
183 int output;
184
185 if (dir == CLK_TO_DIV_N)
186 output = input * 4 / 5 - 2;
187 else
188 output = (input + 2) * 5 / 4;
189
190 return output;
191}
192
166static const struct pcr_ops rtl8411_pcr_ops = { 193static const struct pcr_ops rtl8411_pcr_ops = {
167 .extra_init_hw = rtl8411_extra_init_hw, 194 .extra_init_hw = rtl8411_extra_init_hw,
168 .optimize_phy = NULL, 195 .optimize_phy = NULL,
@@ -172,7 +199,9 @@ static const struct pcr_ops rtl8411_pcr_ops = {
172 .disable_auto_blink = rtl8411_disable_auto_blink, 199 .disable_auto_blink = rtl8411_disable_auto_blink,
173 .card_power_on = rtl8411_card_power_on, 200 .card_power_on = rtl8411_card_power_on,
174 .card_power_off = rtl8411_card_power_off, 201 .card_power_off = rtl8411_card_power_off,
202 .switch_output_voltage = rtl8411_switch_output_voltage,
175 .cd_deglitch = rtl8411_cd_deglitch, 203 .cd_deglitch = rtl8411_cd_deglitch,
204 .conv_clk_and_div_n = rtl8411_conv_clk_and_div_n,
176}; 205};
177 206
178/* SD Pull Control Enable: 207/* SD Pull Control Enable:
diff --git a/drivers/mfd/rts5209.c b/drivers/mfd/rts5209.c
index 283a4f148084..98fe0f39463e 100644
--- a/drivers/mfd/rts5209.c
+++ b/drivers/mfd/rts5209.c
@@ -144,6 +144,25 @@ static int rts5209_card_power_off(struct rtsx_pcr *pcr, int card)
144 return rtsx_pci_send_cmd(pcr, 100); 144 return rtsx_pci_send_cmd(pcr, 100);
145} 145}
146 146
147static int rts5209_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage)
148{
149 int err;
150
151 if (voltage == OUTPUT_3V3) {
152 err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4FC0 | 0x24);
153 if (err < 0)
154 return err;
155 } else if (voltage == OUTPUT_1V8) {
156 err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4C40 | 0x24);
157 if (err < 0)
158 return err;
159 } else {
160 return -EINVAL;
161 }
162
163 return 0;
164}
165
147static const struct pcr_ops rts5209_pcr_ops = { 166static const struct pcr_ops rts5209_pcr_ops = {
148 .extra_init_hw = rts5209_extra_init_hw, 167 .extra_init_hw = rts5209_extra_init_hw,
149 .optimize_phy = rts5209_optimize_phy, 168 .optimize_phy = rts5209_optimize_phy,
@@ -153,7 +172,9 @@ static const struct pcr_ops rts5209_pcr_ops = {
153 .disable_auto_blink = rts5209_disable_auto_blink, 172 .disable_auto_blink = rts5209_disable_auto_blink,
154 .card_power_on = rts5209_card_power_on, 173 .card_power_on = rts5209_card_power_on,
155 .card_power_off = rts5209_card_power_off, 174 .card_power_off = rts5209_card_power_off,
175 .switch_output_voltage = rts5209_switch_output_voltage,
156 .cd_deglitch = NULL, 176 .cd_deglitch = NULL,
177 .conv_clk_and_div_n = NULL,
157}; 178};
158 179
159/* SD Pull Control Enable: 180/* SD Pull Control Enable:
diff --git a/drivers/mfd/rts5229.c b/drivers/mfd/rts5229.c
index b9dbab266fda..29d889cbb9c5 100644
--- a/drivers/mfd/rts5229.c
+++ b/drivers/mfd/rts5229.c
@@ -114,6 +114,25 @@ static int rts5229_card_power_off(struct rtsx_pcr *pcr, int card)
114 return rtsx_pci_send_cmd(pcr, 100); 114 return rtsx_pci_send_cmd(pcr, 100);
115} 115}
116 116
117static int rts5229_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage)
118{
119 int err;
120
121 if (voltage == OUTPUT_3V3) {
122 err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4FC0 | 0x24);
123 if (err < 0)
124 return err;
125 } else if (voltage == OUTPUT_1V8) {
126 err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4C40 | 0x24);
127 if (err < 0)
128 return err;
129 } else {
130 return -EINVAL;
131 }
132
133 return 0;
134}
135
117static const struct pcr_ops rts5229_pcr_ops = { 136static const struct pcr_ops rts5229_pcr_ops = {
118 .extra_init_hw = rts5229_extra_init_hw, 137 .extra_init_hw = rts5229_extra_init_hw,
119 .optimize_phy = rts5229_optimize_phy, 138 .optimize_phy = rts5229_optimize_phy,
@@ -123,7 +142,9 @@ static const struct pcr_ops rts5229_pcr_ops = {
123 .disable_auto_blink = rts5229_disable_auto_blink, 142 .disable_auto_blink = rts5229_disable_auto_blink,
124 .card_power_on = rts5229_card_power_on, 143 .card_power_on = rts5229_card_power_on,
125 .card_power_off = rts5229_card_power_off, 144 .card_power_off = rts5229_card_power_off,
145 .switch_output_voltage = rts5229_switch_output_voltage,
126 .cd_deglitch = NULL, 146 .cd_deglitch = NULL,
147 .conv_clk_and_div_n = NULL,
127}; 148};
128 149
129/* SD Pull Control Enable: 150/* SD Pull Control Enable:
diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c
index 3a44efa29203..9fc57009e228 100644
--- a/drivers/mfd/rtsx_pcr.c
+++ b/drivers/mfd/rtsx_pcr.c
@@ -630,7 +630,10 @@ int rtsx_pci_switch_clock(struct rtsx_pcr *pcr, unsigned int card_clock,
630 if (clk == pcr->cur_clock) 630 if (clk == pcr->cur_clock)
631 return 0; 631 return 0;
632 632
633 N = (u8)(clk - 2); 633 if (pcr->ops->conv_clk_and_div_n)
634 N = (u8)pcr->ops->conv_clk_and_div_n(clk, CLK_TO_DIV_N);
635 else
636 N = (u8)(clk - 2);
634 if ((clk <= 2) || (N > max_N)) 637 if ((clk <= 2) || (N > max_N))
635 return -EINVAL; 638 return -EINVAL;
636 639
@@ -641,7 +644,14 @@ int rtsx_pci_switch_clock(struct rtsx_pcr *pcr, unsigned int card_clock,
641 /* Make sure that the SSC clock div_n is equal or greater than min_N */ 644 /* Make sure that the SSC clock div_n is equal or greater than min_N */
642 div = CLK_DIV_1; 645 div = CLK_DIV_1;
643 while ((N < min_N) && (div < max_div)) { 646 while ((N < min_N) && (div < max_div)) {
644 N = (N + 2) * 2 - 2; 647 if (pcr->ops->conv_clk_and_div_n) {
648 int dbl_clk = pcr->ops->conv_clk_and_div_n(N,
649 DIV_N_TO_CLK) * 2;
650 N = (u8)pcr->ops->conv_clk_and_div_n(dbl_clk,
651 CLK_TO_DIV_N);
652 } else {
653 N = (N + 2) * 2 - 2;
654 }
645 div++; 655 div++;
646 } 656 }
647 dev_dbg(&(pcr->pci->dev), "N = %d, div = %d\n", N, div); 657 dev_dbg(&(pcr->pci->dev), "N = %d, div = %d\n", N, div);
@@ -703,6 +713,15 @@ int rtsx_pci_card_power_off(struct rtsx_pcr *pcr, int card)
703} 713}
704EXPORT_SYMBOL_GPL(rtsx_pci_card_power_off); 714EXPORT_SYMBOL_GPL(rtsx_pci_card_power_off);
705 715
716int rtsx_pci_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage)
717{
718 if (pcr->ops->switch_output_voltage)
719 return pcr->ops->switch_output_voltage(pcr, voltage);
720
721 return 0;
722}
723EXPORT_SYMBOL_GPL(rtsx_pci_switch_output_voltage);
724
706unsigned int rtsx_pci_card_exist(struct rtsx_pcr *pcr) 725unsigned int rtsx_pci_card_exist(struct rtsx_pcr *pcr)
707{ 726{
708 unsigned int val; 727 unsigned int val;
@@ -767,10 +786,10 @@ static void rtsx_pci_card_detect(struct work_struct *work)
767 786
768 spin_unlock_irqrestore(&pcr->lock, flags); 787 spin_unlock_irqrestore(&pcr->lock, flags);
769 788
770 if (card_detect & SD_EXIST) 789 if ((card_detect & SD_EXIST) && pcr->slots[RTSX_SD_CARD].card_event)
771 pcr->slots[RTSX_SD_CARD].card_event( 790 pcr->slots[RTSX_SD_CARD].card_event(
772 pcr->slots[RTSX_SD_CARD].p_dev); 791 pcr->slots[RTSX_SD_CARD].p_dev);
773 if (card_detect & MS_EXIST) 792 if ((card_detect & MS_EXIST) && pcr->slots[RTSX_MS_CARD].card_event)
774 pcr->slots[RTSX_MS_CARD].card_event( 793 pcr->slots[RTSX_MS_CARD].card_event(
775 pcr->slots[RTSX_MS_CARD].p_dev); 794 pcr->slots[RTSX_MS_CARD].p_dev);
776} 795}
@@ -998,8 +1017,8 @@ static int rtsx_pci_init_chip(struct rtsx_pcr *pcr)
998 return 0; 1017 return 0;
999} 1018}
1000 1019
1001static int __devinit rtsx_pci_probe(struct pci_dev *pcidev, 1020static int rtsx_pci_probe(struct pci_dev *pcidev,
1002 const struct pci_device_id *id) 1021 const struct pci_device_id *id)
1003{ 1022{
1004 struct rtsx_pcr *pcr; 1023 struct rtsx_pcr *pcr;
1005 struct pcr_handle *handle; 1024 struct pcr_handle *handle;
@@ -1123,7 +1142,7 @@ disable:
1123 return ret; 1142 return ret;
1124} 1143}
1125 1144
1126static void __devexit rtsx_pci_remove(struct pci_dev *pcidev) 1145static void rtsx_pci_remove(struct pci_dev *pcidev)
1127{ 1146{
1128 struct pcr_handle *handle = pci_get_drvdata(pcidev); 1147 struct pcr_handle *handle = pci_get_drvdata(pcidev);
1129 struct rtsx_pcr *pcr = handle->pcr; 1148 struct rtsx_pcr *pcr = handle->pcr;
@@ -1241,7 +1260,7 @@ static struct pci_driver rtsx_pci_driver = {
1241 .name = DRV_NAME_RTSX_PCI, 1260 .name = DRV_NAME_RTSX_PCI,
1242 .id_table = rtsx_pci_ids, 1261 .id_table = rtsx_pci_ids,
1243 .probe = rtsx_pci_probe, 1262 .probe = rtsx_pci_probe,
1244 .remove = __devexit_p(rtsx_pci_remove), 1263 .remove = rtsx_pci_remove,
1245 .suspend = rtsx_pci_suspend, 1264 .suspend = rtsx_pci_suspend,
1246 .resume = rtsx_pci_resume, 1265 .resume = rtsx_pci_resume,
1247}; 1266};
diff --git a/drivers/mfd/sta2x11-mfd.c b/drivers/mfd/sta2x11-mfd.c
index 1225dcbcfcfc..9bd33169a111 100644
--- a/drivers/mfd/sta2x11-mfd.c
+++ b/drivers/mfd/sta2x11-mfd.c
@@ -510,19 +510,19 @@ enum mfd1_bar1_cells {
510 STA2X11_APB_SOC_REGS = 0, 510 STA2X11_APB_SOC_REGS = 0,
511}; 511};
512 512
513static const __devinitconst struct resource vic_resources[] = { 513static const struct resource vic_resources[] = {
514 CELL_4K(STA2X11_MFD_VIC_NAME, STA2X11_VIC), 514 CELL_4K(STA2X11_MFD_VIC_NAME, STA2X11_VIC),
515}; 515};
516 516
517static const __devinitconst struct resource apb_soc_regs_resources[] = { 517static const struct resource apb_soc_regs_resources[] = {
518 CELL_4K(STA2X11_MFD_APB_SOC_REGS_NAME, STA2X11_APB_SOC_REGS), 518 CELL_4K(STA2X11_MFD_APB_SOC_REGS_NAME, STA2X11_APB_SOC_REGS),
519}; 519};
520 520
521static __devinitdata struct mfd_cell sta2x11_mfd1_bar0[] = { 521static struct mfd_cell sta2x11_mfd1_bar0[] = {
522 DEV(STA2X11_MFD_VIC_NAME, vic_resources), 522 DEV(STA2X11_MFD_VIC_NAME, vic_resources),
523}; 523};
524 524
525static __devinitdata struct mfd_cell sta2x11_mfd1_bar1[] = { 525static struct mfd_cell sta2x11_mfd1_bar1[] = {
526 DEV(STA2X11_MFD_APB_SOC_REGS_NAME, apb_soc_regs_resources), 526 DEV(STA2X11_MFD_APB_SOC_REGS_NAME, apb_soc_regs_resources),
527}; 527};
528 528
diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c
index 5e8e6927cfcd..4b11202061be 100644
--- a/drivers/mfd/stmpe.c
+++ b/drivers/mfd/stmpe.c
@@ -892,8 +892,7 @@ static struct irq_domain_ops stmpe_irq_ops = {
892 .xlate = irq_domain_xlate_twocell, 892 .xlate = irq_domain_xlate_twocell,
893}; 893};
894 894
895static int __devinit stmpe_irq_init(struct stmpe *stmpe, 895static int stmpe_irq_init(struct stmpe *stmpe, struct device_node *np)
896 struct device_node *np)
897{ 896{
898 int base = 0; 897 int base = 0;
899 int num_irqs = stmpe->variant->num_irqs; 898 int num_irqs = stmpe->variant->num_irqs;
@@ -911,7 +910,7 @@ static int __devinit stmpe_irq_init(struct stmpe *stmpe,
911 return 0; 910 return 0;
912} 911}
913 912
914static int __devinit stmpe_chip_init(struct stmpe *stmpe) 913static int stmpe_chip_init(struct stmpe *stmpe)
915{ 914{
916 unsigned int irq_trigger = stmpe->pdata->irq_trigger; 915 unsigned int irq_trigger = stmpe->pdata->irq_trigger;
917 int autosleep_timeout = stmpe->pdata->autosleep_timeout; 916 int autosleep_timeout = stmpe->pdata->autosleep_timeout;
@@ -970,14 +969,13 @@ static int __devinit stmpe_chip_init(struct stmpe *stmpe)
970 return stmpe_reg_write(stmpe, stmpe->regs[STMPE_IDX_ICR_LSB], icr); 969 return stmpe_reg_write(stmpe, stmpe->regs[STMPE_IDX_ICR_LSB], icr);
971} 970}
972 971
973static int __devinit stmpe_add_device(struct stmpe *stmpe, 972static int stmpe_add_device(struct stmpe *stmpe, struct mfd_cell *cell)
974 struct mfd_cell *cell)
975{ 973{
976 return mfd_add_devices(stmpe->dev, stmpe->pdata->id, cell, 1, 974 return mfd_add_devices(stmpe->dev, stmpe->pdata->id, cell, 1,
977 NULL, stmpe->irq_base, stmpe->domain); 975 NULL, stmpe->irq_base, stmpe->domain);
978} 976}
979 977
980static int __devinit stmpe_devices_init(struct stmpe *stmpe) 978static int stmpe_devices_init(struct stmpe *stmpe)
981{ 979{
982 struct stmpe_variant_info *variant = stmpe->variant; 980 struct stmpe_variant_info *variant = stmpe->variant;
983 unsigned int platform_blocks = stmpe->pdata->blocks; 981 unsigned int platform_blocks = stmpe->pdata->blocks;
@@ -1013,8 +1011,7 @@ static int __devinit stmpe_devices_init(struct stmpe *stmpe)
1013 return ret; 1011 return ret;
1014} 1012}
1015 1013
1016void __devinit stmpe_of_probe(struct stmpe_platform_data *pdata, 1014void stmpe_of_probe(struct stmpe_platform_data *pdata, struct device_node *np)
1017 struct device_node *np)
1018{ 1015{
1019 struct device_node *child; 1016 struct device_node *child;
1020 1017
@@ -1044,7 +1041,7 @@ void __devinit stmpe_of_probe(struct stmpe_platform_data *pdata,
1044} 1041}
1045 1042
1046/* Called from client specific probe routines */ 1043/* Called from client specific probe routines */
1047int __devinit stmpe_probe(struct stmpe_client_info *ci, int partnum) 1044int stmpe_probe(struct stmpe_client_info *ci, int partnum)
1048{ 1045{
1049 struct stmpe_platform_data *pdata = dev_get_platdata(ci->dev); 1046 struct stmpe_platform_data *pdata = dev_get_platdata(ci->dev);
1050 struct device_node *np = ci->dev->of_node; 1047 struct device_node *np = ci->dev->of_node;
diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c
index a06d66b929b1..ecc092c7f745 100644
--- a/drivers/mfd/tc3589x.c
+++ b/drivers/mfd/tc3589x.c
@@ -219,25 +219,18 @@ static void tc3589x_irq_unmap(struct irq_domain *d, unsigned int virq)
219} 219}
220 220
221static struct irq_domain_ops tc3589x_irq_ops = { 221static struct irq_domain_ops tc3589x_irq_ops = {
222 .map = tc3589x_irq_map, 222 .map = tc3589x_irq_map,
223 .unmap = tc3589x_irq_unmap, 223 .unmap = tc3589x_irq_unmap,
224 .xlate = irq_domain_xlate_twocell, 224 .xlate = irq_domain_xlate_twocell,
225}; 225};
226 226
227static int tc3589x_irq_init(struct tc3589x *tc3589x, struct device_node *np) 227static int tc3589x_irq_init(struct tc3589x *tc3589x, struct device_node *np)
228{ 228{
229 int base = tc3589x->irq_base; 229 int base = tc3589x->irq_base;
230 230
231 if (base) { 231 tc3589x->domain = irq_domain_add_simple(
232 tc3589x->domain = irq_domain_add_legacy( 232 np, TC3589x_NR_INTERNAL_IRQS, base,
233 NULL, TC3589x_NR_INTERNAL_IRQS, base, 233 &tc3589x_irq_ops, tc3589x);
234 0, &tc3589x_irq_ops, tc3589x);
235 }
236 else {
237 tc3589x->domain = irq_domain_add_linear(
238 np, TC3589x_NR_INTERNAL_IRQS,
239 &tc3589x_irq_ops, tc3589x);
240 }
241 234
242 if (!tc3589x->domain) { 235 if (!tc3589x->domain) {
243 dev_err(tc3589x->dev, "Failed to create irqdomain\n"); 236 dev_err(tc3589x->dev, "Failed to create irqdomain\n");
diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index 8ca3bf023fb2..e9f3fb510b44 100644
--- a/drivers/mfd/ti_am335x_tscadc.c
+++ b/drivers/mfd/ti_am335x_tscadc.c
@@ -58,7 +58,7 @@ static void tscadc_idle_config(struct ti_tscadc_dev *config)
58 tscadc_writel(config, REG_IDLECONFIG, idleconfig); 58 tscadc_writel(config, REG_IDLECONFIG, idleconfig);
59} 59}
60 60
61static int __devinit ti_tscadc_probe(struct platform_device *pdev) 61static int ti_tscadc_probe(struct platform_device *pdev)
62{ 62{
63 struct ti_tscadc_dev *tscadc; 63 struct ti_tscadc_dev *tscadc;
64 struct resource *res; 64 struct resource *res;
@@ -202,7 +202,7 @@ ret:
202 return err; 202 return err;
203} 203}
204 204
205static int __devexit ti_tscadc_remove(struct platform_device *pdev) 205static int ti_tscadc_remove(struct platform_device *pdev)
206{ 206{
207 struct ti_tscadc_dev *tscadc = platform_get_drvdata(pdev); 207 struct ti_tscadc_dev *tscadc = platform_get_drvdata(pdev);
208 208
@@ -263,7 +263,7 @@ static struct platform_driver ti_tscadc_driver = {
263 .pm = TSCADC_PM_OPS, 263 .pm = TSCADC_PM_OPS,
264 }, 264 },
265 .probe = ti_tscadc_probe, 265 .probe = ti_tscadc_probe,
266 .remove = __devexit_p(ti_tscadc_remove), 266 .remove = ti_tscadc_remove,
267 267
268}; 268};
269 269
diff --git a/drivers/mfd/tps80031.c b/drivers/mfd/tps80031.c
index 10b51f7dfff3..c90a2c450f51 100644
--- a/drivers/mfd/tps80031.c
+++ b/drivers/mfd/tps80031.c
@@ -269,8 +269,7 @@ static int tps80031_init_ext_control(struct tps80031 *tps80031,
269 return ret; 269 return ret;
270} 270}
271 271
272static int __devinit tps80031_irq_init(struct tps80031 *tps80031, int irq, 272static int tps80031_irq_init(struct tps80031 *tps80031, int irq, int irq_base)
273 int irq_base)
274{ 273{
275 struct device *dev = tps80031->dev; 274 struct device *dev = tps80031->dev;
276 int i, ret; 275 int i, ret;
@@ -416,8 +415,8 @@ static const struct regmap_config tps80031_regmap_configs[] = {
416 }, 415 },
417}; 416};
418 417
419static int __devinit tps80031_probe(struct i2c_client *client, 418static int tps80031_probe(struct i2c_client *client,
420 const struct i2c_device_id *id) 419 const struct i2c_device_id *id)
421{ 420{
422 struct tps80031_platform_data *pdata = client->dev.platform_data; 421 struct tps80031_platform_data *pdata = client->dev.platform_data;
423 struct tps80031 *tps80031; 422 struct tps80031 *tps80031;
@@ -519,7 +518,7 @@ fail_client_reg:
519 return ret; 518 return ret;
520} 519}
521 520
522static int __devexit tps80031_remove(struct i2c_client *client) 521static int tps80031_remove(struct i2c_client *client)
523{ 522{
524 struct tps80031 *tps80031 = i2c_get_clientdata(client); 523 struct tps80031 *tps80031 = i2c_get_clientdata(client);
525 int i; 524 int i;
@@ -553,7 +552,7 @@ static struct i2c_driver tps80031_driver = {
553 .owner = THIS_MODULE, 552 .owner = THIS_MODULE,
554 }, 553 },
555 .probe = tps80031_probe, 554 .probe = tps80031_probe,
556 .remove = __devexit_p(tps80031_remove), 555 .remove = tps80031_remove,
557 .id_table = tps80031_id_table, 556 .id_table = tps80031_id_table,
558}; 557};
559 558
diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
index 4dae241e5017..dd362c1078e1 100644
--- a/drivers/mfd/twl4030-power.c
+++ b/drivers/mfd/twl4030-power.c
@@ -159,7 +159,7 @@ out:
159static int twl4030_write_script(u8 address, struct twl4030_ins *script, 159static int twl4030_write_script(u8 address, struct twl4030_ins *script,
160 int len) 160 int len)
161{ 161{
162 int err; 162 int err = -EINVAL;
163 163
164 for (; len; len--, address++, script++) { 164 for (; len; len--, address++, script++) {
165 if (len == 1) { 165 if (len == 1) {
diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c
index 583be76e36a8..f361bf38a0aa 100644
--- a/drivers/mfd/twl6040.c
+++ b/drivers/mfd/twl6040.c
@@ -517,8 +517,8 @@ static struct regmap_irq_chip twl6040_irq_chip = {
517 .mask_base = TWL6040_REG_INTMR, 517 .mask_base = TWL6040_REG_INTMR,
518}; 518};
519 519
520static int __devinit twl6040_probe(struct i2c_client *client, 520static int twl6040_probe(struct i2c_client *client,
521 const struct i2c_device_id *id) 521 const struct i2c_device_id *id)
522{ 522{
523 struct twl6040_platform_data *pdata = client->dev.platform_data; 523 struct twl6040_platform_data *pdata = client->dev.platform_data;
524 struct device_node *node = client->dev.of_node; 524 struct device_node *node = client->dev.of_node;
@@ -699,7 +699,7 @@ err:
699 return ret; 699 return ret;
700} 700}
701 701
702static int __devexit twl6040_remove(struct i2c_client *client) 702static int twl6040_remove(struct i2c_client *client)
703{ 703{
704 struct twl6040 *twl6040 = i2c_get_clientdata(client); 704 struct twl6040 *twl6040 = i2c_get_clientdata(client);
705 705
@@ -735,7 +735,7 @@ static struct i2c_driver twl6040_driver = {
735 .owner = THIS_MODULE, 735 .owner = THIS_MODULE,
736 }, 736 },
737 .probe = twl6040_probe, 737 .probe = twl6040_probe,
738 .remove = __devexit_p(twl6040_remove), 738 .remove = twl6040_remove,
739 .id_table = twl6040_i2c_id, 739 .id_table = twl6040_i2c_id,
740}; 740};
741 741
diff --git a/drivers/mfd/vexpress-config.c b/drivers/mfd/vexpress-config.c
index fae15d880758..3c1723aa6225 100644
--- a/drivers/mfd/vexpress-config.c
+++ b/drivers/mfd/vexpress-config.c
@@ -67,6 +67,7 @@ struct vexpress_config_bridge *vexpress_config_bridge_register(
67 67
68 return bridge; 68 return bridge;
69} 69}
70EXPORT_SYMBOL(vexpress_config_bridge_register);
70 71
71void vexpress_config_bridge_unregister(struct vexpress_config_bridge *bridge) 72void vexpress_config_bridge_unregister(struct vexpress_config_bridge *bridge)
72{ 73{
@@ -83,6 +84,7 @@ void vexpress_config_bridge_unregister(struct vexpress_config_bridge *bridge)
83 while (!list_empty(&__bridge.transactions)) 84 while (!list_empty(&__bridge.transactions))
84 cpu_relax(); 85 cpu_relax();
85} 86}
87EXPORT_SYMBOL(vexpress_config_bridge_unregister);
86 88
87 89
88struct vexpress_config_func { 90struct vexpress_config_func {
@@ -142,6 +144,7 @@ struct vexpress_config_func *__vexpress_config_func_get(struct device *dev,
142 144
143 return func; 145 return func;
144} 146}
147EXPORT_SYMBOL(__vexpress_config_func_get);
145 148
146void vexpress_config_func_put(struct vexpress_config_func *func) 149void vexpress_config_func_put(struct vexpress_config_func *func)
147{ 150{
@@ -149,7 +152,7 @@ void vexpress_config_func_put(struct vexpress_config_func *func)
149 of_node_put(func->bridge->node); 152 of_node_put(func->bridge->node);
150 kfree(func); 153 kfree(func);
151} 154}
152 155EXPORT_SYMBOL(vexpress_config_func_put);
153 156
154struct vexpress_config_trans { 157struct vexpress_config_trans {
155 struct vexpress_config_func *func; 158 struct vexpress_config_func *func;
@@ -229,6 +232,7 @@ void vexpress_config_complete(struct vexpress_config_bridge *bridge,
229 232
230 complete(&trans->completion); 233 complete(&trans->completion);
231} 234}
235EXPORT_SYMBOL(vexpress_config_complete);
232 236
233int vexpress_config_wait(struct vexpress_config_trans *trans) 237int vexpress_config_wait(struct vexpress_config_trans *trans)
234{ 238{
@@ -236,7 +240,7 @@ int vexpress_config_wait(struct vexpress_config_trans *trans)
236 240
237 return trans->status; 241 return trans->status;
238} 242}
239 243EXPORT_SYMBOL(vexpress_config_wait);
240 244
241int vexpress_config_read(struct vexpress_config_func *func, int offset, 245int vexpress_config_read(struct vexpress_config_func *func, int offset,
242 u32 *data) 246 u32 *data)
diff --git a/drivers/mfd/vexpress-sysreg.c b/drivers/mfd/vexpress-sysreg.c
index 733c06bd2d17..77048b18439e 100644
--- a/drivers/mfd/vexpress-sysreg.c
+++ b/drivers/mfd/vexpress-sysreg.c
@@ -313,19 +313,11 @@ static void vexpress_sysreg_config_complete(unsigned long data)
313} 313}
314 314
315 315
316void __init vexpress_sysreg_early_init(void __iomem *base) 316void __init vexpress_sysreg_setup(struct device_node *node)
317{ 317{
318 struct device_node *node = of_find_compatible_node(NULL, NULL, 318 if (WARN_ON(!vexpress_sysreg_base))
319 "arm,vexpress-sysreg");
320
321 if (node)
322 base = of_iomap(node, 0);
323
324 if (WARN_ON(!base))
325 return; 319 return;
326 320
327 vexpress_sysreg_base = base;
328
329 if (readl(vexpress_sysreg_base + SYS_MISC) & SYS_MISC_MASTERSITE) 321 if (readl(vexpress_sysreg_base + SYS_MISC) & SYS_MISC_MASTERSITE)
330 vexpress_master_site = VEXPRESS_SITE_DB2; 322 vexpress_master_site = VEXPRESS_SITE_DB2;
331 else 323 else
@@ -336,9 +328,23 @@ void __init vexpress_sysreg_early_init(void __iomem *base)
336 WARN_ON(!vexpress_sysreg_config_bridge); 328 WARN_ON(!vexpress_sysreg_config_bridge);
337} 329}
338 330
331void __init vexpress_sysreg_early_init(void __iomem *base)
332{
333 vexpress_sysreg_base = base;
334 vexpress_sysreg_setup(NULL);
335}
336
339void __init vexpress_sysreg_of_early_init(void) 337void __init vexpress_sysreg_of_early_init(void)
340{ 338{
341 vexpress_sysreg_early_init(NULL); 339 struct device_node *node = of_find_compatible_node(NULL, NULL,
340 "arm,vexpress-sysreg");
341
342 if (node) {
343 vexpress_sysreg_base = of_iomap(node, 0);
344 vexpress_sysreg_setup(node);
345 } else {
346 pr_info("vexpress-sysreg: No Device Tree node found.");
347 }
342} 348}
343 349
344 350
@@ -414,7 +420,7 @@ static ssize_t vexpress_sysreg_sys_id_show(struct device *dev,
414 420
415DEVICE_ATTR(sys_id, S_IRUGO, vexpress_sysreg_sys_id_show, NULL); 421DEVICE_ATTR(sys_id, S_IRUGO, vexpress_sysreg_sys_id_show, NULL);
416 422
417static int __devinit vexpress_sysreg_probe(struct platform_device *pdev) 423static int vexpress_sysreg_probe(struct platform_device *pdev)
418{ 424{
419 int err; 425 int err;
420 struct resource *res = platform_get_resource(pdev, 426 struct resource *res = platform_get_resource(pdev,
@@ -426,9 +432,11 @@ static int __devinit vexpress_sysreg_probe(struct platform_device *pdev)
426 return -EBUSY; 432 return -EBUSY;
427 } 433 }
428 434
429 if (!vexpress_sysreg_base) 435 if (!vexpress_sysreg_base) {
430 vexpress_sysreg_base = devm_ioremap(&pdev->dev, res->start, 436 vexpress_sysreg_base = devm_ioremap(&pdev->dev, res->start,
431 resource_size(res)); 437 resource_size(res));
438 vexpress_sysreg_setup(pdev->dev.of_node);
439 }
432 440
433 if (!vexpress_sysreg_base) { 441 if (!vexpress_sysreg_base) {
434 dev_err(&pdev->dev, "Failed to obtain base address!\n"); 442 dev_err(&pdev->dev, "Failed to obtain base address!\n");
diff --git a/drivers/mfd/wm5102-tables.c b/drivers/mfd/wm5102-tables.c
index 088872ab6338..1133a64c2dc9 100644
--- a/drivers/mfd/wm5102-tables.c
+++ b/drivers/mfd/wm5102-tables.c
@@ -1882,7 +1882,7 @@ static bool wm5102_volatile_register(struct device *dev, unsigned int reg)
1882 } 1882 }
1883} 1883}
1884 1884
1885#define WM5102_MAX_REGISTER 0x1a8fff 1885#define WM5102_MAX_REGISTER 0x1a9800
1886 1886
1887const struct regmap_config wm5102_spi_regmap = { 1887const struct regmap_config wm5102_spi_regmap = {
1888 .reg_bits = 32, 1888 .reg_bits = 32,
diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
index 158da5a81a66..3c09cbb70b1d 100644
--- a/drivers/misc/atmel-ssc.c
+++ b/drivers/misc/atmel-ssc.c
@@ -19,6 +19,7 @@
19#include <linux/module.h> 19#include <linux/module.h>
20 20
21#include <linux/of.h> 21#include <linux/of.h>
22#include <linux/pinctrl/consumer.h>
22 23
23/* Serialize access to ssc_list and user count */ 24/* Serialize access to ssc_list and user count */
24static DEFINE_SPINLOCK(user_lock); 25static DEFINE_SPINLOCK(user_lock);
@@ -131,6 +132,13 @@ static int ssc_probe(struct platform_device *pdev)
131 struct resource *regs; 132 struct resource *regs;
132 struct ssc_device *ssc; 133 struct ssc_device *ssc;
133 const struct atmel_ssc_platform_data *plat_dat; 134 const struct atmel_ssc_platform_data *plat_dat;
135 struct pinctrl *pinctrl;
136
137 pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
138 if (IS_ERR(pinctrl)) {
139 dev_err(&pdev->dev, "Failed to request pinctrl\n");
140 return PTR_ERR(pinctrl);
141 }
134 142
135 ssc = devm_kzalloc(&pdev->dev, sizeof(struct ssc_device), GFP_KERNEL); 143 ssc = devm_kzalloc(&pdev->dev, sizeof(struct ssc_device), GFP_KERNEL);
136 if (!ssc) { 144 if (!ssc) {
diff --git a/drivers/misc/mei/amthif.c b/drivers/misc/mei/amthif.c
index 18794aea6062..e40ffd9502d1 100644
--- a/drivers/misc/mei/amthif.c
+++ b/drivers/misc/mei/amthif.c
@@ -187,13 +187,13 @@ int mei_amthif_read(struct mei_device *dev, struct file *file,
187 wait_ret = wait_event_interruptible(dev->iamthif_cl.wait, 187 wait_ret = wait_event_interruptible(dev->iamthif_cl.wait,
188 (cb = mei_amthif_find_read_list_entry(dev, file))); 188 (cb = mei_amthif_find_read_list_entry(dev, file)));
189 189
190 /* Locking again the Mutex */
191 mutex_lock(&dev->device_lock);
192
190 if (wait_ret) 193 if (wait_ret)
191 return -ERESTARTSYS; 194 return -ERESTARTSYS;
192 195
193 dev_dbg(&dev->pdev->dev, "woke up from sleep\n"); 196 dev_dbg(&dev->pdev->dev, "woke up from sleep\n");
194
195 /* Locking again the Mutex */
196 mutex_lock(&dev->device_lock);
197 } 197 }
198 198
199 199
diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
index 9ff942a346ed..83269f1d16e3 100644
--- a/drivers/misc/ti-st/st_kim.c
+++ b/drivers/misc/ti-st/st_kim.c
@@ -468,6 +468,11 @@ long st_kim_start(void *kim_data)
468 if (pdata->chip_enable) 468 if (pdata->chip_enable)
469 pdata->chip_enable(kim_gdata); 469 pdata->chip_enable(kim_gdata);
470 470
471 /* Configure BT nShutdown to HIGH state */
472 gpio_set_value(kim_gdata->nshutdown, GPIO_LOW);
473 mdelay(5); /* FIXME: a proper toggle */
474 gpio_set_value(kim_gdata->nshutdown, GPIO_HIGH);
475 mdelay(100);
471 /* re-initialize the completion */ 476 /* re-initialize the completion */
472 INIT_COMPLETION(kim_gdata->ldisc_installed); 477 INIT_COMPLETION(kim_gdata->ldisc_installed);
473 /* send notification to UIM */ 478 /* send notification to UIM */
@@ -509,7 +514,8 @@ long st_kim_start(void *kim_data)
509 * (b) upon failure to either install ldisc or download firmware. 514 * (b) upon failure to either install ldisc or download firmware.
510 * The function is responsible to (a) notify UIM about un-installation, 515 * The function is responsible to (a) notify UIM about un-installation,
511 * (b) flush UART if the ldisc was installed. 516 * (b) flush UART if the ldisc was installed.
512 * (c) invoke platform's chip disabling routine. 517 * (c) reset BT_EN - pull down nshutdown at the end.
518 * (d) invoke platform's chip disabling routine.
513 */ 519 */
514long st_kim_stop(void *kim_data) 520long st_kim_stop(void *kim_data)
515{ 521{
@@ -541,6 +547,13 @@ long st_kim_stop(void *kim_data)
541 err = -ETIMEDOUT; 547 err = -ETIMEDOUT;
542 } 548 }
543 549
550 /* By default configure BT nShutdown to LOW state */
551 gpio_set_value(kim_gdata->nshutdown, GPIO_LOW);
552 mdelay(1);
553 gpio_set_value(kim_gdata->nshutdown, GPIO_HIGH);
554 mdelay(1);
555 gpio_set_value(kim_gdata->nshutdown, GPIO_LOW);
556
544 /* platform specific disable */ 557 /* platform specific disable */
545 if (pdata->chip_disable) 558 if (pdata->chip_disable)
546 pdata->chip_disable(kim_gdata); 559 pdata->chip_disable(kim_gdata);
@@ -733,6 +746,20 @@ static int kim_probe(struct platform_device *pdev)
733 /* refer to itself */ 746 /* refer to itself */
734 kim_gdata->core_data->kim_data = kim_gdata; 747 kim_gdata->core_data->kim_data = kim_gdata;
735 748
749 /* Claim the chip enable nShutdown gpio from the system */
750 kim_gdata->nshutdown = pdata->nshutdown_gpio;
751 err = gpio_request(kim_gdata->nshutdown, "kim");
752 if (unlikely(err)) {
753 pr_err(" gpio %ld request failed ", kim_gdata->nshutdown);
754 return err;
755 }
756
757 /* Configure nShutdown GPIO as output=0 */
758 err = gpio_direction_output(kim_gdata->nshutdown, 0);
759 if (unlikely(err)) {
760 pr_err(" unable to configure gpio %ld", kim_gdata->nshutdown);
761 return err;
762 }
736 /* get reference of pdev for request_firmware 763 /* get reference of pdev for request_firmware
737 */ 764 */
738 kim_gdata->kim_pdev = pdev; 765 kim_gdata->kim_pdev = pdev;
@@ -779,10 +806,18 @@ err_core_init:
779 806
780static int kim_remove(struct platform_device *pdev) 807static int kim_remove(struct platform_device *pdev)
781{ 808{
809 /* free the GPIOs requested */
810 struct ti_st_plat_data *pdata = pdev->dev.platform_data;
782 struct kim_data_s *kim_gdata; 811 struct kim_data_s *kim_gdata;
783 812
784 kim_gdata = dev_get_drvdata(&pdev->dev); 813 kim_gdata = dev_get_drvdata(&pdev->dev);
785 814
815 /* Free the Bluetooth/FM/GPIO
816 * nShutdown gpio from the system
817 */
818 gpio_free(pdata->nshutdown_gpio);
819 pr_info("nshutdown GPIO Freed");
820
786 debugfs_remove_recursive(kim_debugfs_dir); 821 debugfs_remove_recursive(kim_debugfs_dir);
787 sysfs_remove_group(&pdev->dev.kobj, &uim_attr_grp); 822 sysfs_remove_group(&pdev->dev.kobj, &uim_attr_grp);
788 pr_info("sysfs entries removed"); 823 pr_info("sysfs entries removed");
diff --git a/drivers/mmc/host/dw_mmc-pci.c b/drivers/mmc/host/dw_mmc-pci.c
index 8ee0f74f9374..083fcd29c9c6 100644
--- a/drivers/mmc/host/dw_mmc-pci.c
+++ b/drivers/mmc/host/dw_mmc-pci.c
@@ -134,7 +134,7 @@ static struct pci_driver dw_mci_pci_driver = {
134 .name = "dw_mmc_pci", 134 .name = "dw_mmc_pci",
135 .id_table = dw_mci_pci_id, 135 .id_table = dw_mci_pci_id,
136 .probe = dw_mci_pci_probe, 136 .probe = dw_mci_pci_probe,
137 .remove = __devexit_p(dw_mci_pci_remove), 137 .remove = dw_mci_pci_remove,
138 .driver = { 138 .driver = {
139 .pm = &dw_mci_pci_pmops 139 .pm = &dw_mci_pci_pmops
140 }, 140 },
diff --git a/drivers/mmc/host/dw_mmc-pltfm.c b/drivers/mmc/host/dw_mmc-pltfm.c
index 222036c9e053..5e1fb1d2c422 100644
--- a/drivers/mmc/host/dw_mmc-pltfm.c
+++ b/drivers/mmc/host/dw_mmc-pltfm.c
@@ -120,7 +120,7 @@ MODULE_DEVICE_TABLE(of, dw_mci_pltfm_match);
120 120
121static struct platform_driver dw_mci_pltfm_driver = { 121static struct platform_driver dw_mci_pltfm_driver = {
122 .probe = dw_mci_pltfm_probe, 122 .probe = dw_mci_pltfm_probe,
123 .remove = __devexit_p(dw_mci_pltfm_remove), 123 .remove = dw_mci_pltfm_remove,
124 .driver = { 124 .driver = {
125 .name = "dw_mmc", 125 .name = "dw_mmc",
126 .of_match_table = of_match_ptr(dw_mci_pltfm_match), 126 .of_match_table = of_match_ptr(dw_mci_pltfm_match),
diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c
index de4c20b3936c..f8dd36102949 100644
--- a/drivers/mmc/host/mvsdio.c
+++ b/drivers/mmc/host/mvsdio.c
@@ -50,8 +50,6 @@ struct mvsd_host {
50 struct timer_list timer; 50 struct timer_list timer;
51 struct mmc_host *mmc; 51 struct mmc_host *mmc;
52 struct device *dev; 52 struct device *dev;
53 struct resource *res;
54 int irq;
55 struct clk *clk; 53 struct clk *clk;
56 int gpio_card_detect; 54 int gpio_card_detect;
57 int gpio_write_protect; 55 int gpio_write_protect;
@@ -718,10 +716,6 @@ static int __init mvsd_probe(struct platform_device *pdev)
718 if (!r || irq < 0 || !mvsd_data) 716 if (!r || irq < 0 || !mvsd_data)
719 return -ENXIO; 717 return -ENXIO;
720 718
721 r = request_mem_region(r->start, SZ_1K, DRIVER_NAME);
722 if (!r)
723 return -EBUSY;
724
725 mmc = mmc_alloc_host(sizeof(struct mvsd_host), &pdev->dev); 719 mmc = mmc_alloc_host(sizeof(struct mvsd_host), &pdev->dev);
726 if (!mmc) { 720 if (!mmc) {
727 ret = -ENOMEM; 721 ret = -ENOMEM;
@@ -731,8 +725,8 @@ static int __init mvsd_probe(struct platform_device *pdev)
731 host = mmc_priv(mmc); 725 host = mmc_priv(mmc);
732 host->mmc = mmc; 726 host->mmc = mmc;
733 host->dev = &pdev->dev; 727 host->dev = &pdev->dev;
734 host->res = r;
735 host->base_clock = mvsd_data->clock / 2; 728 host->base_clock = mvsd_data->clock / 2;
729 host->clk = ERR_PTR(-EINVAL);
736 730
737 mmc->ops = &mvsd_ops; 731 mmc->ops = &mvsd_ops;
738 732
@@ -752,7 +746,7 @@ static int __init mvsd_probe(struct platform_device *pdev)
752 746
753 spin_lock_init(&host->lock); 747 spin_lock_init(&host->lock);
754 748
755 host->base = ioremap(r->start, SZ_4K); 749 host->base = devm_request_and_ioremap(&pdev->dev, r);
756 if (!host->base) { 750 if (!host->base) {
757 ret = -ENOMEM; 751 ret = -ENOMEM;
758 goto out; 752 goto out;
@@ -765,44 +759,45 @@ static int __init mvsd_probe(struct platform_device *pdev)
765 759
766 mvsd_power_down(host); 760 mvsd_power_down(host);
767 761
768 ret = request_irq(irq, mvsd_irq, 0, DRIVER_NAME, host); 762 ret = devm_request_irq(&pdev->dev, irq, mvsd_irq, 0, DRIVER_NAME, host);
769 if (ret) { 763 if (ret) {
770 pr_err("%s: cannot assign irq %d\n", DRIVER_NAME, irq); 764 pr_err("%s: cannot assign irq %d\n", DRIVER_NAME, irq);
771 goto out; 765 goto out;
772 } else 766 }
773 host->irq = irq;
774 767
775 /* Not all platforms can gate the clock, so it is not 768 /* Not all platforms can gate the clock, so it is not
776 an error if the clock does not exists. */ 769 an error if the clock does not exists. */
777 host->clk = clk_get(&pdev->dev, NULL); 770 host->clk = devm_clk_get(&pdev->dev, NULL);
778 if (!IS_ERR(host->clk)) { 771 if (!IS_ERR(host->clk))
779 clk_prepare_enable(host->clk); 772 clk_prepare_enable(host->clk);
780 }
781 773
782 if (mvsd_data->gpio_card_detect) { 774 if (mvsd_data->gpio_card_detect) {
783 ret = gpio_request(mvsd_data->gpio_card_detect, 775 ret = devm_gpio_request_one(&pdev->dev,
784 DRIVER_NAME " cd"); 776 mvsd_data->gpio_card_detect,
777 GPIOF_IN, DRIVER_NAME " cd");
785 if (ret == 0) { 778 if (ret == 0) {
786 gpio_direction_input(mvsd_data->gpio_card_detect);
787 irq = gpio_to_irq(mvsd_data->gpio_card_detect); 779 irq = gpio_to_irq(mvsd_data->gpio_card_detect);
788 ret = request_irq(irq, mvsd_card_detect_irq, 780 ret = devm_request_irq(&pdev->dev, irq,
789 IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING, 781 mvsd_card_detect_irq,
790 DRIVER_NAME " cd", host); 782 IRQ_TYPE_EDGE_RISING |
783 IRQ_TYPE_EDGE_FALLING,
784 DRIVER_NAME " cd", host);
791 if (ret == 0) 785 if (ret == 0)
792 host->gpio_card_detect = 786 host->gpio_card_detect =
793 mvsd_data->gpio_card_detect; 787 mvsd_data->gpio_card_detect;
794 else 788 else
795 gpio_free(mvsd_data->gpio_card_detect); 789 devm_gpio_free(&pdev->dev,
790 mvsd_data->gpio_card_detect);
796 } 791 }
797 } 792 }
798 if (!host->gpio_card_detect) 793 if (!host->gpio_card_detect)
799 mmc->caps |= MMC_CAP_NEEDS_POLL; 794 mmc->caps |= MMC_CAP_NEEDS_POLL;
800 795
801 if (mvsd_data->gpio_write_protect) { 796 if (mvsd_data->gpio_write_protect) {
802 ret = gpio_request(mvsd_data->gpio_write_protect, 797 ret = devm_gpio_request_one(&pdev->dev,
803 DRIVER_NAME " wp"); 798 mvsd_data->gpio_write_protect,
799 GPIOF_IN, DRIVER_NAME " wp");
804 if (ret == 0) { 800 if (ret == 0) {
805 gpio_direction_input(mvsd_data->gpio_write_protect);
806 host->gpio_write_protect = 801 host->gpio_write_protect =
807 mvsd_data->gpio_write_protect; 802 mvsd_data->gpio_write_protect;
808 } 803 }
@@ -824,26 +819,11 @@ static int __init mvsd_probe(struct platform_device *pdev)
824 return 0; 819 return 0;
825 820
826out: 821out:
827 if (host) { 822 if (mmc) {
828 if (host->irq) 823 if (!IS_ERR(host->clk))
829 free_irq(host->irq, host);
830 if (host->gpio_card_detect) {
831 free_irq(gpio_to_irq(host->gpio_card_detect), host);
832 gpio_free(host->gpio_card_detect);
833 }
834 if (host->gpio_write_protect)
835 gpio_free(host->gpio_write_protect);
836 if (host->base)
837 iounmap(host->base);
838 }
839 if (r)
840 release_resource(r);
841 if (mmc)
842 if (!IS_ERR_OR_NULL(host->clk)) {
843 clk_disable_unprepare(host->clk); 824 clk_disable_unprepare(host->clk);
844 clk_put(host->clk);
845 }
846 mmc_free_host(mmc); 825 mmc_free_host(mmc);
826 }
847 827
848 return ret; 828 return ret;
849} 829}
@@ -852,28 +832,16 @@ static int __exit mvsd_remove(struct platform_device *pdev)
852{ 832{
853 struct mmc_host *mmc = platform_get_drvdata(pdev); 833 struct mmc_host *mmc = platform_get_drvdata(pdev);
854 834
855 if (mmc) { 835 struct mvsd_host *host = mmc_priv(mmc);
856 struct mvsd_host *host = mmc_priv(mmc);
857 836
858 if (host->gpio_card_detect) { 837 mmc_remove_host(mmc);
859 free_irq(gpio_to_irq(host->gpio_card_detect), host); 838 del_timer_sync(&host->timer);
860 gpio_free(host->gpio_card_detect); 839 mvsd_power_down(host);
861 } 840
862 mmc_remove_host(mmc); 841 if (!IS_ERR(host->clk))
863 free_irq(host->irq, host); 842 clk_disable_unprepare(host->clk);
864 if (host->gpio_write_protect) 843 mmc_free_host(mmc);
865 gpio_free(host->gpio_write_protect);
866 del_timer_sync(&host->timer);
867 mvsd_power_down(host);
868 iounmap(host->base);
869 release_resource(host->res);
870 844
871 if (!IS_ERR(host->clk)) {
872 clk_disable_unprepare(host->clk);
873 clk_put(host->clk);
874 }
875 mmc_free_host(mmc);
876 }
877 platform_set_drvdata(pdev, NULL); 845 platform_set_drvdata(pdev, NULL);
878 return 0; 846 return 0;
879} 847}
diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c
index 571915dfb218..f74b5adca642 100644
--- a/drivers/mmc/host/rtsx_pci_sdmmc.c
+++ b/drivers/mmc/host/rtsx_pci_sdmmc.c
@@ -1060,26 +1060,6 @@ static int sd_wait_voltage_stable_2(struct realtek_pci_sdmmc *host)
1060 return 0; 1060 return 0;
1061} 1061}
1062 1062
1063static int sd_change_bank_voltage(struct realtek_pci_sdmmc *host, u8 voltage)
1064{
1065 struct rtsx_pcr *pcr = host->pcr;
1066 int err;
1067
1068 if (voltage == SD_IO_3V3) {
1069 err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4FC0 | 0x24);
1070 if (err < 0)
1071 return err;
1072 } else if (voltage == SD_IO_1V8) {
1073 err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4C40 | 0x24);
1074 if (err < 0)
1075 return err;
1076 } else {
1077 return -EINVAL;
1078 }
1079
1080 return 0;
1081}
1082
1083static int sdmmc_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios) 1063static int sdmmc_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios)
1084{ 1064{
1085 struct realtek_pci_sdmmc *host = mmc_priv(mmc); 1065 struct realtek_pci_sdmmc *host = mmc_priv(mmc);
@@ -1098,11 +1078,11 @@ static int sdmmc_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios)
1098 rtsx_pci_start_run(pcr); 1078 rtsx_pci_start_run(pcr);
1099 1079
1100 if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330) 1080 if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330)
1101 voltage = SD_IO_3V3; 1081 voltage = OUTPUT_3V3;
1102 else 1082 else
1103 voltage = SD_IO_1V8; 1083 voltage = OUTPUT_1V8;
1104 1084
1105 if (voltage == SD_IO_1V8) { 1085 if (voltage == OUTPUT_1V8) {
1106 err = rtsx_pci_write_register(pcr, 1086 err = rtsx_pci_write_register(pcr,
1107 SD30_DRIVE_SEL, 0x07, DRIVER_TYPE_B); 1087 SD30_DRIVE_SEL, 0x07, DRIVER_TYPE_B);
1108 if (err < 0) 1088 if (err < 0)
@@ -1113,11 +1093,11 @@ static int sdmmc_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios)
1113 goto out; 1093 goto out;
1114 } 1094 }
1115 1095
1116 err = sd_change_bank_voltage(host, voltage); 1096 err = rtsx_pci_switch_output_voltage(pcr, voltage);
1117 if (err < 0) 1097 if (err < 0)
1118 goto out; 1098 goto out;
1119 1099
1120 if (voltage == SD_IO_1V8) { 1100 if (voltage == OUTPUT_1V8) {
1121 err = sd_wait_voltage_stable_2(host); 1101 err = sd_wait_voltage_stable_2(host);
1122 if (err < 0) 1102 if (err < 0)
1123 goto out; 1103 goto out;
diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
index 12b0a78497f6..2592dddbd965 100644
--- a/drivers/mmc/host/sdhci-acpi.c
+++ b/drivers/mmc/host/sdhci-acpi.c
@@ -111,7 +111,7 @@ static const struct sdhci_acpi_slot *sdhci_acpi_get_slot(const char *hid)
111 return NULL; 111 return NULL;
112} 112}
113 113
114static int __devinit sdhci_acpi_probe(struct platform_device *pdev) 114static int sdhci_acpi_probe(struct platform_device *pdev)
115{ 115{
116 struct device *dev = &pdev->dev; 116 struct device *dev = &pdev->dev;
117 acpi_handle handle = ACPI_HANDLE(dev); 117 acpi_handle handle = ACPI_HANDLE(dev);
@@ -214,7 +214,7 @@ err_free:
214 return err; 214 return err;
215} 215}
216 216
217static int __devexit sdhci_acpi_remove(struct platform_device *pdev) 217static int sdhci_acpi_remove(struct platform_device *pdev)
218{ 218{
219 struct sdhci_acpi_host *c = platform_get_drvdata(pdev); 219 struct sdhci_acpi_host *c = platform_get_drvdata(pdev);
220 struct device *dev = &pdev->dev; 220 struct device *dev = &pdev->dev;
@@ -302,7 +302,7 @@ static struct platform_driver sdhci_acpi_driver = {
302 .pm = &sdhci_acpi_pm_ops, 302 .pm = &sdhci_acpi_pm_ops,
303 }, 303 },
304 .probe = sdhci_acpi_probe, 304 .probe = sdhci_acpi_probe,
305 .remove = __devexit_p(sdhci_acpi_remove), 305 .remove = sdhci_acpi_remove,
306}; 306};
307 307
308module_platform_driver(sdhci_acpi_driver); 308module_platform_driver(sdhci_acpi_driver);
diff --git a/drivers/mmc/host/wmt-sdmmc.c b/drivers/mmc/host/wmt-sdmmc.c
index 5ba4605e4f80..154f0e8e931c 100644
--- a/drivers/mmc/host/wmt-sdmmc.c
+++ b/drivers/mmc/host/wmt-sdmmc.c
@@ -766,7 +766,7 @@ static struct of_device_id wmt_mci_dt_ids[] = {
766 { /* Sentinel */ }, 766 { /* Sentinel */ },
767}; 767};
768 768
769static int __devinit wmt_mci_probe(struct platform_device *pdev) 769static int wmt_mci_probe(struct platform_device *pdev)
770{ 770{
771 struct mmc_host *mmc; 771 struct mmc_host *mmc;
772 struct wmt_mci_priv *priv; 772 struct wmt_mci_priv *priv;
@@ -892,7 +892,7 @@ fail1:
892 return ret; 892 return ret;
893} 893}
894 894
895static int __devexit wmt_mci_remove(struct platform_device *pdev) 895static int wmt_mci_remove(struct platform_device *pdev)
896{ 896{
897 struct mmc_host *mmc; 897 struct mmc_host *mmc;
898 struct wmt_mci_priv *priv; 898 struct wmt_mci_priv *priv;
diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index ea7ea7b595d8..945c9f762349 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -618,9 +618,8 @@ static char *otp_setup(struct mtd_info *device, char revision)
618/* 618/*
619 * Register DataFlash device with MTD subsystem. 619 * Register DataFlash device with MTD subsystem.
620 */ 620 */
621static int 621static int add_dataflash_otp(struct spi_device *spi, char *name, int nr_pages,
622add_dataflash_otp(struct spi_device *spi, char *name, 622 int pagesize, int pageoffset, char revision)
623 int nr_pages, int pagesize, int pageoffset, char revision)
624{ 623{
625 struct dataflash *priv; 624 struct dataflash *priv;
626 struct mtd_info *device; 625 struct mtd_info *device;
@@ -679,9 +678,8 @@ add_dataflash_otp(struct spi_device *spi, char *name,
679 return err; 678 return err;
680} 679}
681 680
682static inline int 681static inline int add_dataflash(struct spi_device *spi, char *name,
683add_dataflash(struct spi_device *spi, char *name, 682 int nr_pages, int pagesize, int pageoffset)
684 int nr_pages, int pagesize, int pageoffset)
685{ 683{
686 return add_dataflash_otp(spi, name, nr_pages, pagesize, 684 return add_dataflash_otp(spi, name, nr_pages, pagesize,
687 pageoffset, 0); 685 pageoffset, 0);
diff --git a/drivers/mtd/devices/spear_smi.c b/drivers/mtd/devices/spear_smi.c
index 2d2c2a5d4d2a..2aabd96bf0ff 100644
--- a/drivers/mtd/devices/spear_smi.c
+++ b/drivers/mtd/devices/spear_smi.c
@@ -757,7 +757,7 @@ err_probe:
757 757
758#ifdef CONFIG_OF 758#ifdef CONFIG_OF
759static int spear_smi_probe_config_dt(struct platform_device *pdev, 759static int spear_smi_probe_config_dt(struct platform_device *pdev,
760 struct device_node *np) 760 struct device_node *np)
761{ 761{
762 struct spear_smi_plat_data *pdata = dev_get_platdata(&pdev->dev); 762 struct spear_smi_plat_data *pdata = dev_get_platdata(&pdev->dev);
763 struct device_node *pp = NULL; 763 struct device_node *pp = NULL;
@@ -800,7 +800,7 @@ static int spear_smi_probe_config_dt(struct platform_device *pdev,
800} 800}
801#else 801#else
802static int spear_smi_probe_config_dt(struct platform_device *pdev, 802static int spear_smi_probe_config_dt(struct platform_device *pdev,
803 struct device_node *np) 803 struct device_node *np)
804{ 804{
805 return -ENOSYS; 805 return -ENOSYS;
806} 806}
diff --git a/drivers/mtd/maps/esb2rom.c b/drivers/mtd/maps/esb2rom.c
index ff8681a25831..f784cf0caa13 100644
--- a/drivers/mtd/maps/esb2rom.c
+++ b/drivers/mtd/maps/esb2rom.c
@@ -145,7 +145,7 @@ static void esb2rom_cleanup(struct esb2rom_window *window)
145} 145}
146 146
147static int esb2rom_init_one(struct pci_dev *pdev, 147static int esb2rom_init_one(struct pci_dev *pdev,
148 const struct pci_device_id *ent) 148 const struct pci_device_id *ent)
149{ 149{
150 static char *rom_probe_types[] = { "cfi_probe", "jedec_probe", NULL }; 150 static char *rom_probe_types[] = { "cfi_probe", "jedec_probe", NULL };
151 struct esb2rom_window *window = &esb2rom_window; 151 struct esb2rom_window *window = &esb2rom_window;
diff --git a/drivers/mtd/maps/intel_vr_nor.c b/drivers/mtd/maps/intel_vr_nor.c
index 3ee2ad1dcbe7..b14053b25026 100644
--- a/drivers/mtd/maps/intel_vr_nor.c
+++ b/drivers/mtd/maps/intel_vr_nor.c
@@ -189,8 +189,7 @@ static void vr_nor_pci_remove(struct pci_dev *dev)
189 pci_disable_device(dev); 189 pci_disable_device(dev);
190} 190}
191 191
192static int 192static int vr_nor_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
193vr_nor_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
194{ 193{
195 struct vr_nor_mtd *p = NULL; 194 struct vr_nor_mtd *p = NULL;
196 unsigned int exp_timing_cs0; 195 unsigned int exp_timing_cs0;
diff --git a/drivers/mtd/maps/pci.c b/drivers/mtd/maps/pci.c
index ed82914966f5..c3aebd5da5d6 100644
--- a/drivers/mtd/maps/pci.c
+++ b/drivers/mtd/maps/pci.c
@@ -253,8 +253,7 @@ static struct pci_device_id mtd_pci_ids[] = {
253 * Generic code follows. 253 * Generic code follows.
254 */ 254 */
255 255
256static int 256static int mtd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
257mtd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
258{ 257{
259 struct mtd_pci_info *info = (struct mtd_pci_info *)id->driver_data; 258 struct mtd_pci_info *info = (struct mtd_pci_info *)id->driver_data;
260 struct map_pci_info *map = NULL; 259 struct map_pci_info *map = NULL;
@@ -308,8 +307,7 @@ out:
308 return err; 307 return err;
309} 308}
310 309
311static void 310static void mtd_pci_remove(struct pci_dev *dev)
312mtd_pci_remove(struct pci_dev *dev)
313{ 311{
314 struct mtd_info *mtd = pci_get_drvdata(dev); 312 struct mtd_info *mtd = pci_get_drvdata(dev);
315 struct map_pci_info *map = mtd->priv; 313 struct map_pci_info *map = mtd->priv;
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
index 37cdc201652f..67cc73c18ddd 100644
--- a/drivers/mtd/maps/physmap_of.c
+++ b/drivers/mtd/maps/physmap_of.c
@@ -78,7 +78,7 @@ static int of_flash_remove(struct platform_device *dev)
78 * compatible binding, which has an extra "probe-type" property 78 * compatible binding, which has an extra "probe-type" property
79 * describing the type of flash probe necessary. */ 79 * describing the type of flash probe necessary. */
80static struct mtd_info *obsolete_probe(struct platform_device *dev, 80static struct mtd_info *obsolete_probe(struct platform_device *dev,
81 struct map_info *map) 81 struct map_info *map)
82{ 82{
83 struct device_node *dp = dev->dev.of_node; 83 struct device_node *dp = dev->dev.of_node;
84 const char *of_probe; 84 const char *of_probe;
diff --git a/drivers/mtd/maps/pismo.c b/drivers/mtd/maps/pismo.c
index afea93b515d5..dc6df9abea0b 100644
--- a/drivers/mtd/maps/pismo.c
+++ b/drivers/mtd/maps/pismo.c
@@ -66,8 +66,8 @@ static unsigned int pismo_width_to_bytes(unsigned int width)
66 return 1 << width; 66 return 1 << width;
67} 67}
68 68
69static int pismo_eeprom_read(struct i2c_client *client, void *buf, 69static int pismo_eeprom_read(struct i2c_client *client, void *buf, u8 addr,
70 u8 addr, size_t size) 70 size_t size)
71{ 71{
72 int ret; 72 int ret;
73 struct i2c_msg msg[] = { 73 struct i2c_msg msg[] = {
@@ -89,7 +89,8 @@ static int pismo_eeprom_read(struct i2c_client *client, void *buf,
89} 89}
90 90
91static int pismo_add_device(struct pismo_data *pismo, int i, 91static int pismo_add_device(struct pismo_data *pismo, int i,
92 struct pismo_mem *region, const char *name, void *pdata, size_t psize) 92 struct pismo_mem *region, const char *name,
93 void *pdata, size_t psize)
93{ 94{
94 struct platform_device *dev; 95 struct platform_device *dev;
95 struct resource res = { }; 96 struct resource res = { };
@@ -130,7 +131,7 @@ static int pismo_add_device(struct pismo_data *pismo, int i,
130} 131}
131 132
132static int pismo_add_nor(struct pismo_data *pismo, int i, 133static int pismo_add_nor(struct pismo_data *pismo, int i,
133 struct pismo_mem *region) 134 struct pismo_mem *region)
134{ 135{
135 struct physmap_flash_data data = { 136 struct physmap_flash_data data = {
136 .width = region->width, 137 .width = region->width,
@@ -144,7 +145,7 @@ static int pismo_add_nor(struct pismo_data *pismo, int i,
144} 145}
145 146
146static int pismo_add_sram(struct pismo_data *pismo, int i, 147static int pismo_add_sram(struct pismo_data *pismo, int i,
147 struct pismo_mem *region) 148 struct pismo_mem *region)
148{ 149{
149 struct platdata_mtd_ram data = { 150 struct platdata_mtd_ram data = {
150 .bankwidth = region->width, 151 .bankwidth = region->width,
@@ -155,7 +156,7 @@ static int pismo_add_sram(struct pismo_data *pismo, int i,
155} 156}
156 157
157static void pismo_add_one(struct pismo_data *pismo, int i, 158static void pismo_add_one(struct pismo_data *pismo, int i,
158 const struct pismo_cs_block *cs, phys_addr_t base) 159 const struct pismo_cs_block *cs, phys_addr_t base)
159{ 160{
160 struct device *dev = &pismo->client->dev; 161 struct device *dev = &pismo->client->dev;
161 struct pismo_mem region; 162 struct pismo_mem region;
@@ -211,7 +212,7 @@ static int pismo_remove(struct i2c_client *client)
211} 212}
212 213
213static int pismo_probe(struct i2c_client *client, 214static int pismo_probe(struct i2c_client *client,
214 const struct i2c_device_id *id) 215 const struct i2c_device_id *id)
215{ 216{
216 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); 217 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
217 struct pismo_pdata *pdata = client->dev.platform_data; 218 struct pismo_pdata *pdata = client->dev.platform_data;
diff --git a/drivers/mtd/maps/scb2_flash.c b/drivers/mtd/maps/scb2_flash.c
index 71796137e97b..c77b68c9412f 100644
--- a/drivers/mtd/maps/scb2_flash.c
+++ b/drivers/mtd/maps/scb2_flash.c
@@ -69,8 +69,7 @@ static struct map_info scb2_map = {
69}; 69};
70static int region_fail; 70static int region_fail;
71 71
72static int 72static int scb2_fixup_mtd(struct mtd_info *mtd)
73scb2_fixup_mtd(struct mtd_info *mtd)
74{ 73{
75 int i; 74 int i;
76 int done = 0; 75 int done = 0;
@@ -133,8 +132,8 @@ scb2_fixup_mtd(struct mtd_info *mtd)
133/* CSB5's 'Function Control Register' has bits for decoding @ >= 0xffc00000 */ 132/* CSB5's 'Function Control Register' has bits for decoding @ >= 0xffc00000 */
134#define CSB5_FCR 0x41 133#define CSB5_FCR 0x41
135#define CSB5_FCR_DECODE_ALL 0x0e 134#define CSB5_FCR_DECODE_ALL 0x0e
136static int 135static int scb2_flash_probe(struct pci_dev *dev,
137scb2_flash_probe(struct pci_dev *dev, const struct pci_device_id *ent) 136 const struct pci_device_id *ent)
138{ 137{
139 u8 reg; 138 u8 reg;
140 139
@@ -197,8 +196,7 @@ scb2_flash_probe(struct pci_dev *dev, const struct pci_device_id *ent)
197 return 0; 196 return 0;
198} 197}
199 198
200static void 199static void scb2_flash_remove(struct pci_dev *dev)
201scb2_flash_remove(struct pci_dev *dev)
202{ 200{
203 if (!scb2_mtd) 201 if (!scb2_mtd)
204 return; 202 return;
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 90bdca61c797..c516a9408087 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -338,7 +338,7 @@ static int pmecc_get_ecc_bytes(int cap, int sector_size)
338} 338}
339 339
340static void pmecc_config_ecc_layout(struct nand_ecclayout *layout, 340static void pmecc_config_ecc_layout(struct nand_ecclayout *layout,
341 int oobsize, int ecc_len) 341 int oobsize, int ecc_len)
342{ 342{
343 int i; 343 int i;
344 344
@@ -1213,7 +1213,7 @@ static void atmel_nand_hwctl(struct mtd_info *mtd, int mode)
1213 1213
1214#if defined(CONFIG_OF) 1214#if defined(CONFIG_OF)
1215static int atmel_of_init_port(struct atmel_nand_host *host, 1215static int atmel_of_init_port(struct atmel_nand_host *host,
1216 struct device_node *np) 1216 struct device_node *np)
1217{ 1217{
1218 u32 val, table_offset; 1218 u32 val, table_offset;
1219 u32 offset[2]; 1219 u32 offset[2];
@@ -1300,7 +1300,7 @@ static int atmel_of_init_port(struct atmel_nand_host *host,
1300} 1300}
1301#else 1301#else
1302static int atmel_of_init_port(struct atmel_nand_host *host, 1302static int atmel_of_init_port(struct atmel_nand_host *host,
1303 struct device_node *np) 1303 struct device_node *np)
1304{ 1304{
1305 return -EINVAL; 1305 return -EINVAL;
1306} 1306}
diff --git a/drivers/mtd/nand/bcm47xxnflash/main.c b/drivers/mtd/nand/bcm47xxnflash/main.c
index 2b8b05bec3dd..8363a9a5fa3f 100644
--- a/drivers/mtd/nand/bcm47xxnflash/main.c
+++ b/drivers/mtd/nand/bcm47xxnflash/main.c
@@ -66,7 +66,7 @@ out:
66 return err; 66 return err;
67} 67}
68 68
69static int __devexit bcm47xxnflash_remove(struct platform_device *pdev) 69static int bcm47xxnflash_remove(struct platform_device *pdev)
70{ 70{
71 struct bcma_nflash *nflash = dev_get_platdata(&pdev->dev); 71 struct bcma_nflash *nflash = dev_get_platdata(&pdev->dev);
72 72
@@ -77,7 +77,7 @@ static int __devexit bcm47xxnflash_remove(struct platform_device *pdev)
77} 77}
78 78
79static struct platform_driver bcm47xxnflash_driver = { 79static struct platform_driver bcm47xxnflash_driver = {
80 .remove = __devexit_p(bcm47xxnflash_remove), 80 .remove = bcm47xxnflash_remove,
81 .driver = { 81 .driver = {
82 .name = "bcma_nflash", 82 .name = "bcma_nflash",
83 .owner = THIS_MODULE, 83 .owner = THIS_MODULE,
diff --git a/drivers/mtd/nand/fsl_upm.c b/drivers/mtd/nand/fsl_upm.c
index 5a8f5c4ce512..04e07252d74b 100644
--- a/drivers/mtd/nand/fsl_upm.c
+++ b/drivers/mtd/nand/fsl_upm.c
@@ -153,8 +153,8 @@ static void fun_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
153} 153}
154 154
155static int fun_chip_init(struct fsl_upm_nand *fun, 155static int fun_chip_init(struct fsl_upm_nand *fun,
156 const struct device_node *upm_np, 156 const struct device_node *upm_np,
157 const struct resource *io_res) 157 const struct resource *io_res)
158{ 158{
159 int ret; 159 int ret;
160 struct device_node *flash_np; 160 struct device_node *flash_np;
diff --git a/drivers/mtd/nand/fsmc_nand.c b/drivers/mtd/nand/fsmc_nand.c
index 1d7446434b0e..67e62d3d495c 100644
--- a/drivers/mtd/nand/fsmc_nand.c
+++ b/drivers/mtd/nand/fsmc_nand.c
@@ -865,7 +865,7 @@ static bool filter(struct dma_chan *chan, void *slave)
865 865
866#ifdef CONFIG_OF 866#ifdef CONFIG_OF
867static int fsmc_nand_probe_config_dt(struct platform_device *pdev, 867static int fsmc_nand_probe_config_dt(struct platform_device *pdev,
868 struct device_node *np) 868 struct device_node *np)
869{ 869{
870 struct fsmc_nand_platform_data *pdata = dev_get_platdata(&pdev->dev); 870 struct fsmc_nand_platform_data *pdata = dev_get_platdata(&pdev->dev);
871 u32 val; 871 u32 val;
@@ -887,7 +887,7 @@ static int fsmc_nand_probe_config_dt(struct platform_device *pdev,
887} 887}
888#else 888#else
889static int fsmc_nand_probe_config_dt(struct platform_device *pdev, 889static int fsmc_nand_probe_config_dt(struct platform_device *pdev,
890 struct device_node *np) 890 struct device_node *np)
891{ 891{
892 return -ENOSYS; 892 return -ENOSYS;
893} 893}
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
index 5cd141f7bfc2..e9b1c47e3cf9 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
@@ -319,8 +319,8 @@ int start_dma_with_bch_irq(struct gpmi_nand_data *this,
319 return 0; 319 return 0;
320} 320}
321 321
322static int 322static int acquire_register_block(struct gpmi_nand_data *this,
323acquire_register_block(struct gpmi_nand_data *this, const char *res_name) 323 const char *res_name)
324{ 324{
325 struct platform_device *pdev = this->pdev; 325 struct platform_device *pdev = this->pdev;
326 struct resources *res = &this->resources; 326 struct resources *res = &this->resources;
@@ -360,8 +360,7 @@ static void release_register_block(struct gpmi_nand_data *this)
360 res->bch_regs = NULL; 360 res->bch_regs = NULL;
361} 361}
362 362
363static int 363static int acquire_bch_irq(struct gpmi_nand_data *this, irq_handler_t irq_h)
364acquire_bch_irq(struct gpmi_nand_data *this, irq_handler_t irq_h)
365{ 364{
366 struct platform_device *pdev = this->pdev; 365 struct platform_device *pdev = this->pdev;
367 struct resources *res = &this->resources; 366 struct resources *res = &this->resources;
diff --git a/drivers/mtd/nand/jz4740_nand.c b/drivers/mtd/nand/jz4740_nand.c
index 8d415f014e1d..b76460eeaf22 100644
--- a/drivers/mtd/nand/jz4740_nand.c
+++ b/drivers/mtd/nand/jz4740_nand.c
@@ -326,7 +326,8 @@ static inline void jz_nand_iounmap_resource(struct resource *res,
326static int jz_nand_detect_bank(struct platform_device *pdev, 326static int jz_nand_detect_bank(struct platform_device *pdev,
327 struct jz_nand *nand, unsigned char bank, 327 struct jz_nand *nand, unsigned char bank,
328 size_t chipnr, uint8_t *nand_maf_id, 328 size_t chipnr, uint8_t *nand_maf_id,
329 uint8_t *nand_dev_id) { 329 uint8_t *nand_dev_id)
330{
330 int ret; 331 int ret;
331 int gpio; 332 int gpio;
332 char gpio_name[9]; 333 char gpio_name[9];
diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c
index 5233b8f58d77..58607f196c9e 100644
--- a/drivers/net/can/c_can/c_can.c
+++ b/drivers/net/can/c_can/c_can.c
@@ -960,7 +960,7 @@ static int c_can_handle_bus_err(struct net_device *dev,
960 break; 960 break;
961 case LEC_ACK_ERROR: 961 case LEC_ACK_ERROR:
962 netdev_dbg(dev, "ack error\n"); 962 netdev_dbg(dev, "ack error\n");
963 cf->data[2] |= (CAN_ERR_PROT_LOC_ACK | 963 cf->data[3] |= (CAN_ERR_PROT_LOC_ACK |
964 CAN_ERR_PROT_LOC_ACK_DEL); 964 CAN_ERR_PROT_LOC_ACK_DEL);
965 break; 965 break;
966 case LEC_BIT1_ERROR: 966 case LEC_BIT1_ERROR:
@@ -973,7 +973,7 @@ static int c_can_handle_bus_err(struct net_device *dev,
973 break; 973 break;
974 case LEC_CRC_ERROR: 974 case LEC_CRC_ERROR:
975 netdev_dbg(dev, "CRC error\n"); 975 netdev_dbg(dev, "CRC error\n");
976 cf->data[2] |= (CAN_ERR_PROT_LOC_CRC_SEQ | 976 cf->data[3] |= (CAN_ERR_PROT_LOC_CRC_SEQ |
977 CAN_ERR_PROT_LOC_CRC_DEL); 977 CAN_ERR_PROT_LOC_CRC_DEL);
978 break; 978 break;
979 default: 979 default:
diff --git a/drivers/net/can/pch_can.c b/drivers/net/can/pch_can.c
index 7d1748575b1f..5c314a961970 100644
--- a/drivers/net/can/pch_can.c
+++ b/drivers/net/can/pch_can.c
@@ -560,7 +560,7 @@ static void pch_can_error(struct net_device *ndev, u32 status)
560 stats->rx_errors++; 560 stats->rx_errors++;
561 break; 561 break;
562 case PCH_CRC_ERR: 562 case PCH_CRC_ERR:
563 cf->data[2] |= CAN_ERR_PROT_LOC_CRC_SEQ | 563 cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ |
564 CAN_ERR_PROT_LOC_CRC_DEL; 564 CAN_ERR_PROT_LOC_CRC_DEL;
565 priv->can.can_stats.bus_error++; 565 priv->can.can_stats.bus_error++;
566 stats->rx_errors++; 566 stats->rx_errors++;
diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c
index f898c6363729..300581b24ff3 100644
--- a/drivers/net/can/ti_hecc.c
+++ b/drivers/net/can/ti_hecc.c
@@ -746,12 +746,12 @@ static int ti_hecc_error(struct net_device *ndev, int int_status,
746 } 746 }
747 if (err_status & HECC_CANES_CRCE) { 747 if (err_status & HECC_CANES_CRCE) {
748 hecc_set_bit(priv, HECC_CANES, HECC_CANES_CRCE); 748 hecc_set_bit(priv, HECC_CANES, HECC_CANES_CRCE);
749 cf->data[2] |= CAN_ERR_PROT_LOC_CRC_SEQ | 749 cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ |
750 CAN_ERR_PROT_LOC_CRC_DEL; 750 CAN_ERR_PROT_LOC_CRC_DEL;
751 } 751 }
752 if (err_status & HECC_CANES_ACKE) { 752 if (err_status & HECC_CANES_ACKE) {
753 hecc_set_bit(priv, HECC_CANES, HECC_CANES_ACKE); 753 hecc_set_bit(priv, HECC_CANES, HECC_CANES_ACKE);
754 cf->data[2] |= CAN_ERR_PROT_LOC_ACK | 754 cf->data[3] |= CAN_ERR_PROT_LOC_ACK |
755 CAN_ERR_PROT_LOC_ACK_DEL; 755 CAN_ERR_PROT_LOC_ACK_DEL;
756 } 756 }
757 } 757 }
diff --git a/drivers/net/ethernet/3com/3c574_cs.c b/drivers/net/ethernet/3com/3c574_cs.c
index 66df93638085..ffd8de28a76a 100644
--- a/drivers/net/ethernet/3com/3c574_cs.c
+++ b/drivers/net/ethernet/3com/3c574_cs.c
@@ -432,7 +432,7 @@ static int tc574_config(struct pcmcia_device *link)
432 netdev_info(dev, "%s at io %#3lx, irq %d, hw_addr %pM\n", 432 netdev_info(dev, "%s at io %#3lx, irq %d, hw_addr %pM\n",
433 cardname, dev->base_addr, dev->irq, dev->dev_addr); 433 cardname, dev->base_addr, dev->irq, dev->dev_addr);
434 netdev_info(dev, " %dK FIFO split %s Rx:Tx, %sMII interface.\n", 434 netdev_info(dev, " %dK FIFO split %s Rx:Tx, %sMII interface.\n",
435 8 << config & Ram_size, 435 8 << (config & Ram_size),
436 ram_split[(config & Ram_split) >> Ram_split_shift], 436 ram_split[(config & Ram_split) >> Ram_split_shift],
437 config & Autoselect ? "autoselect " : ""); 437 config & Autoselect ? "autoselect " : "");
438 438
diff --git a/drivers/net/ethernet/adi/Kconfig b/drivers/net/ethernet/adi/Kconfig
index e49c0eff040b..a9481606bbcd 100644
--- a/drivers/net/ethernet/adi/Kconfig
+++ b/drivers/net/ethernet/adi/Kconfig
@@ -61,6 +61,7 @@ config BFIN_RX_DESC_NUM
61 61
62config BFIN_MAC_USE_HWSTAMP 62config BFIN_MAC_USE_HWSTAMP
63 bool "Use IEEE 1588 hwstamp" 63 bool "Use IEEE 1588 hwstamp"
64 depends on BFIN_MAC && BF518
64 select PTP_1588_CLOCK 65 select PTP_1588_CLOCK
65 default y 66 default y
66 ---help--- 67 ---help---
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index 01588b66a38c..f771ddfba646 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -80,12 +80,37 @@ static inline void bnx2x_move_fp(struct bnx2x *bp, int from, int to)
80 new_txdata_index = new_max_eth_txqs + FCOE_TXQ_IDX_OFFSET; 80 new_txdata_index = new_max_eth_txqs + FCOE_TXQ_IDX_OFFSET;
81 } 81 }
82 82
83 memcpy(&bp->bnx2x_txq[old_txdata_index], 83 memcpy(&bp->bnx2x_txq[new_txdata_index],
84 &bp->bnx2x_txq[new_txdata_index], 84 &bp->bnx2x_txq[old_txdata_index],
85 sizeof(struct bnx2x_fp_txdata)); 85 sizeof(struct bnx2x_fp_txdata));
86 to_fp->txdata_ptr[0] = &bp->bnx2x_txq[new_txdata_index]; 86 to_fp->txdata_ptr[0] = &bp->bnx2x_txq[new_txdata_index];
87} 87}
88 88
89/**
90 * bnx2x_shrink_eth_fp - guarantees fastpath structures stay intact
91 *
92 * @bp: driver handle
93 * @delta: number of eth queues which were not allocated
94 */
95static void bnx2x_shrink_eth_fp(struct bnx2x *bp, int delta)
96{
97 int i, cos, old_eth_num = BNX2X_NUM_ETH_QUEUES(bp);
98
99 /* Queue pointer cannot be re-set on an fp-basis, as moving pointer
100 * backward along the array could cause memory to be overriden
101 */
102 for (cos = 1; cos < bp->max_cos; cos++) {
103 for (i = 0; i < old_eth_num - delta; i++) {
104 struct bnx2x_fastpath *fp = &bp->fp[i];
105 int new_idx = cos * (old_eth_num - delta) + i;
106
107 memcpy(&bp->bnx2x_txq[new_idx], fp->txdata_ptr[cos],
108 sizeof(struct bnx2x_fp_txdata));
109 fp->txdata_ptr[cos] = &bp->bnx2x_txq[new_idx];
110 }
111 }
112}
113
89int load_count[2][3] = { {0} }; /* per-path: 0-common, 1-port0, 2-port1 */ 114int load_count[2][3] = { {0} }; /* per-path: 0-common, 1-port0, 2-port1 */
90 115
91/* free skb in the packet ring at pos idx 116/* free skb in the packet ring at pos idx
@@ -3863,6 +3888,7 @@ int bnx2x_alloc_fp_mem(struct bnx2x *bp)
3863 int delta = BNX2X_NUM_ETH_QUEUES(bp) - i; 3888 int delta = BNX2X_NUM_ETH_QUEUES(bp) - i;
3864 3889
3865 WARN_ON(delta < 0); 3890 WARN_ON(delta < 0);
3891 bnx2x_shrink_eth_fp(bp, delta);
3866 if (CNIC_SUPPORT(bp)) 3892 if (CNIC_SUPPORT(bp))
3867 /* move non eth FPs next to last eth FP 3893 /* move non eth FPs next to last eth FP
3868 * must be done in that order 3894 * must be done in that order
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
index 277f17e3c8f8..a427b49a886c 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
@@ -2777,10 +2777,10 @@ static int bnx2x_set_rss_flags(struct bnx2x *bp, struct ethtool_rxnfc *info)
2777 } else if ((info->flow_type == UDP_V6_FLOW) && 2777 } else if ((info->flow_type == UDP_V6_FLOW) &&
2778 (bp->rss_conf_obj.udp_rss_v6 != udp_rss_requested)) { 2778 (bp->rss_conf_obj.udp_rss_v6 != udp_rss_requested)) {
2779 bp->rss_conf_obj.udp_rss_v6 = udp_rss_requested; 2779 bp->rss_conf_obj.udp_rss_v6 = udp_rss_requested;
2780 return bnx2x_config_rss_pf(bp, &bp->rss_conf_obj, 0);
2781 DP(BNX2X_MSG_ETHTOOL, 2780 DP(BNX2X_MSG_ETHTOOL,
2782 "rss re-configured, UDP 4-tupple %s\n", 2781 "rss re-configured, UDP 4-tupple %s\n",
2783 udp_rss_requested ? "enabled" : "disabled"); 2782 udp_rss_requested ? "enabled" : "disabled");
2783 return bnx2x_config_rss_pf(bp, &bp->rss_conf_obj, 0);
2784 } else { 2784 } else {
2785 return 0; 2785 return 0;
2786 } 2786 }
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 940ef859dc60..5523da3afcdc 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -127,6 +127,17 @@ MODULE_PARM_DESC(debug, " Default debug msglevel");
127 127
128struct workqueue_struct *bnx2x_wq; 128struct workqueue_struct *bnx2x_wq;
129 129
130struct bnx2x_mac_vals {
131 u32 xmac_addr;
132 u32 xmac_val;
133 u32 emac_addr;
134 u32 emac_val;
135 u32 umac_addr;
136 u32 umac_val;
137 u32 bmac_addr;
138 u32 bmac_val[2];
139};
140
130enum bnx2x_board_type { 141enum bnx2x_board_type {
131 BCM57710 = 0, 142 BCM57710 = 0,
132 BCM57711, 143 BCM57711,
@@ -9420,12 +9431,19 @@ static inline void bnx2x_undi_int_disable(struct bnx2x *bp)
9420 bnx2x_undi_int_disable_e1h(bp); 9431 bnx2x_undi_int_disable_e1h(bp);
9421} 9432}
9422 9433
9423static void bnx2x_prev_unload_close_mac(struct bnx2x *bp) 9434static void bnx2x_prev_unload_close_mac(struct bnx2x *bp,
9435 struct bnx2x_mac_vals *vals)
9424{ 9436{
9425 u32 val, base_addr, offset, mask, reset_reg; 9437 u32 val, base_addr, offset, mask, reset_reg;
9426 bool mac_stopped = false; 9438 bool mac_stopped = false;
9427 u8 port = BP_PORT(bp); 9439 u8 port = BP_PORT(bp);
9428 9440
9441 /* reset addresses as they also mark which values were changed */
9442 vals->bmac_addr = 0;
9443 vals->umac_addr = 0;
9444 vals->xmac_addr = 0;
9445 vals->emac_addr = 0;
9446
9429 reset_reg = REG_RD(bp, MISC_REG_RESET_REG_2); 9447 reset_reg = REG_RD(bp, MISC_REG_RESET_REG_2);
9430 9448
9431 if (!CHIP_IS_E3(bp)) { 9449 if (!CHIP_IS_E3(bp)) {
@@ -9447,14 +9465,18 @@ static void bnx2x_prev_unload_close_mac(struct bnx2x *bp)
9447 */ 9465 */
9448 wb_data[0] = REG_RD(bp, base_addr + offset); 9466 wb_data[0] = REG_RD(bp, base_addr + offset);
9449 wb_data[1] = REG_RD(bp, base_addr + offset + 0x4); 9467 wb_data[1] = REG_RD(bp, base_addr + offset + 0x4);
9468 vals->bmac_addr = base_addr + offset;
9469 vals->bmac_val[0] = wb_data[0];
9470 vals->bmac_val[1] = wb_data[1];
9450 wb_data[0] &= ~BMAC_CONTROL_RX_ENABLE; 9471 wb_data[0] &= ~BMAC_CONTROL_RX_ENABLE;
9451 REG_WR(bp, base_addr + offset, wb_data[0]); 9472 REG_WR(bp, vals->bmac_addr, wb_data[0]);
9452 REG_WR(bp, base_addr + offset + 0x4, wb_data[1]); 9473 REG_WR(bp, vals->bmac_addr + 0x4, wb_data[1]);
9453 9474
9454 } 9475 }
9455 BNX2X_DEV_INFO("Disable emac Rx\n"); 9476 BNX2X_DEV_INFO("Disable emac Rx\n");
9456 REG_WR(bp, NIG_REG_NIG_EMAC0_EN + BP_PORT(bp)*4, 0); 9477 vals->emac_addr = NIG_REG_NIG_EMAC0_EN + BP_PORT(bp)*4;
9457 9478 vals->emac_val = REG_RD(bp, vals->emac_addr);
9479 REG_WR(bp, vals->emac_addr, 0);
9458 mac_stopped = true; 9480 mac_stopped = true;
9459 } else { 9481 } else {
9460 if (reset_reg & MISC_REGISTERS_RESET_REG_2_XMAC) { 9482 if (reset_reg & MISC_REGISTERS_RESET_REG_2_XMAC) {
@@ -9465,14 +9487,18 @@ static void bnx2x_prev_unload_close_mac(struct bnx2x *bp)
9465 val & ~(1 << 1)); 9487 val & ~(1 << 1));
9466 REG_WR(bp, base_addr + XMAC_REG_PFC_CTRL_HI, 9488 REG_WR(bp, base_addr + XMAC_REG_PFC_CTRL_HI,
9467 val | (1 << 1)); 9489 val | (1 << 1));
9468 REG_WR(bp, base_addr + XMAC_REG_CTRL, 0); 9490 vals->xmac_addr = base_addr + XMAC_REG_CTRL;
9491 vals->xmac_val = REG_RD(bp, vals->xmac_addr);
9492 REG_WR(bp, vals->xmac_addr, 0);
9469 mac_stopped = true; 9493 mac_stopped = true;
9470 } 9494 }
9471 mask = MISC_REGISTERS_RESET_REG_2_UMAC0 << port; 9495 mask = MISC_REGISTERS_RESET_REG_2_UMAC0 << port;
9472 if (mask & reset_reg) { 9496 if (mask & reset_reg) {
9473 BNX2X_DEV_INFO("Disable umac Rx\n"); 9497 BNX2X_DEV_INFO("Disable umac Rx\n");
9474 base_addr = BP_PORT(bp) ? GRCBASE_UMAC1 : GRCBASE_UMAC0; 9498 base_addr = BP_PORT(bp) ? GRCBASE_UMAC1 : GRCBASE_UMAC0;
9475 REG_WR(bp, base_addr + UMAC_REG_COMMAND_CONFIG, 0); 9499 vals->umac_addr = base_addr + UMAC_REG_COMMAND_CONFIG;
9500 vals->umac_val = REG_RD(bp, vals->umac_addr);
9501 REG_WR(bp, vals->umac_addr, 0);
9476 mac_stopped = true; 9502 mac_stopped = true;
9477 } 9503 }
9478 } 9504 }
@@ -9664,12 +9690,16 @@ static int bnx2x_prev_unload_common(struct bnx2x *bp)
9664{ 9690{
9665 u32 reset_reg, tmp_reg = 0, rc; 9691 u32 reset_reg, tmp_reg = 0, rc;
9666 bool prev_undi = false; 9692 bool prev_undi = false;
9693 struct bnx2x_mac_vals mac_vals;
9694
9667 /* It is possible a previous function received 'common' answer, 9695 /* It is possible a previous function received 'common' answer,
9668 * but hasn't loaded yet, therefore creating a scenario of 9696 * but hasn't loaded yet, therefore creating a scenario of
9669 * multiple functions receiving 'common' on the same path. 9697 * multiple functions receiving 'common' on the same path.
9670 */ 9698 */
9671 BNX2X_DEV_INFO("Common unload Flow\n"); 9699 BNX2X_DEV_INFO("Common unload Flow\n");
9672 9700
9701 memset(&mac_vals, 0, sizeof(mac_vals));
9702
9673 if (bnx2x_prev_is_path_marked(bp)) 9703 if (bnx2x_prev_is_path_marked(bp))
9674 return bnx2x_prev_mcp_done(bp); 9704 return bnx2x_prev_mcp_done(bp);
9675 9705
@@ -9680,7 +9710,10 @@ static int bnx2x_prev_unload_common(struct bnx2x *bp)
9680 u32 timer_count = 1000; 9710 u32 timer_count = 1000;
9681 9711
9682 /* Close the MAC Rx to prevent BRB from filling up */ 9712 /* Close the MAC Rx to prevent BRB from filling up */
9683 bnx2x_prev_unload_close_mac(bp); 9713 bnx2x_prev_unload_close_mac(bp, &mac_vals);
9714
9715 /* close LLH filters towards the BRB */
9716 bnx2x_set_rx_filter(&bp->link_params, 0);
9684 9717
9685 /* Check if the UNDI driver was previously loaded 9718 /* Check if the UNDI driver was previously loaded
9686 * UNDI driver initializes CID offset for normal bell to 0x7 9719 * UNDI driver initializes CID offset for normal bell to 0x7
@@ -9727,6 +9760,17 @@ static int bnx2x_prev_unload_common(struct bnx2x *bp)
9727 /* No packets are in the pipeline, path is ready for reset */ 9760 /* No packets are in the pipeline, path is ready for reset */
9728 bnx2x_reset_common(bp); 9761 bnx2x_reset_common(bp);
9729 9762
9763 if (mac_vals.xmac_addr)
9764 REG_WR(bp, mac_vals.xmac_addr, mac_vals.xmac_val);
9765 if (mac_vals.umac_addr)
9766 REG_WR(bp, mac_vals.umac_addr, mac_vals.umac_val);
9767 if (mac_vals.emac_addr)
9768 REG_WR(bp, mac_vals.emac_addr, mac_vals.emac_val);
9769 if (mac_vals.bmac_addr) {
9770 REG_WR(bp, mac_vals.bmac_addr, mac_vals.bmac_val[0]);
9771 REG_WR(bp, mac_vals.bmac_addr + 4, mac_vals.bmac_val[1]);
9772 }
9773
9730 rc = bnx2x_prev_mark_path(bp, prev_undi); 9774 rc = bnx2x_prev_mark_path(bp, prev_undi);
9731 if (rc) { 9775 if (rc) {
9732 bnx2x_prev_mcp_done(bp); 9776 bnx2x_prev_mcp_done(bp);
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 78ea90c40e19..bdb086934cd9 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -1283,14 +1283,26 @@ static int tg3_phy_auxctl_write(struct tg3 *tp, int reg, u32 set)
1283 return tg3_writephy(tp, MII_TG3_AUX_CTRL, set | reg); 1283 return tg3_writephy(tp, MII_TG3_AUX_CTRL, set | reg);
1284} 1284}
1285 1285
1286#define TG3_PHY_AUXCTL_SMDSP_ENABLE(tp) \ 1286static int tg3_phy_toggle_auxctl_smdsp(struct tg3 *tp, bool enable)
1287 tg3_phy_auxctl_write((tp), MII_TG3_AUXCTL_SHDWSEL_AUXCTL, \ 1287{
1288 MII_TG3_AUXCTL_ACTL_SMDSP_ENA | \ 1288 u32 val;
1289 MII_TG3_AUXCTL_ACTL_TX_6DB) 1289 int err;
1290 1290
1291#define TG3_PHY_AUXCTL_SMDSP_DISABLE(tp) \ 1291 err = tg3_phy_auxctl_read(tp, MII_TG3_AUXCTL_SHDWSEL_AUXCTL, &val);
1292 tg3_phy_auxctl_write((tp), MII_TG3_AUXCTL_SHDWSEL_AUXCTL, \ 1292
1293 MII_TG3_AUXCTL_ACTL_TX_6DB); 1293 if (err)
1294 return err;
1295 if (enable)
1296
1297 val |= MII_TG3_AUXCTL_ACTL_SMDSP_ENA;
1298 else
1299 val &= ~MII_TG3_AUXCTL_ACTL_SMDSP_ENA;
1300
1301 err = tg3_phy_auxctl_write((tp), MII_TG3_AUXCTL_SHDWSEL_AUXCTL,
1302 val | MII_TG3_AUXCTL_ACTL_TX_6DB);
1303
1304 return err;
1305}
1294 1306
1295static int tg3_bmcr_reset(struct tg3 *tp) 1307static int tg3_bmcr_reset(struct tg3 *tp)
1296{ 1308{
@@ -2223,7 +2235,7 @@ static void tg3_phy_apply_otp(struct tg3 *tp)
2223 2235
2224 otp = tp->phy_otp; 2236 otp = tp->phy_otp;
2225 2237
2226 if (TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) 2238 if (tg3_phy_toggle_auxctl_smdsp(tp, true))
2227 return; 2239 return;
2228 2240
2229 phy = ((otp & TG3_OTP_AGCTGT_MASK) >> TG3_OTP_AGCTGT_SHIFT); 2241 phy = ((otp & TG3_OTP_AGCTGT_MASK) >> TG3_OTP_AGCTGT_SHIFT);
@@ -2248,7 +2260,7 @@ static void tg3_phy_apply_otp(struct tg3 *tp)
2248 ((otp & TG3_OTP_RCOFF_MASK) >> TG3_OTP_RCOFF_SHIFT); 2260 ((otp & TG3_OTP_RCOFF_MASK) >> TG3_OTP_RCOFF_SHIFT);
2249 tg3_phydsp_write(tp, MII_TG3_DSP_EXP97, phy); 2261 tg3_phydsp_write(tp, MII_TG3_DSP_EXP97, phy);
2250 2262
2251 TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); 2263 tg3_phy_toggle_auxctl_smdsp(tp, false);
2252} 2264}
2253 2265
2254static void tg3_phy_eee_adjust(struct tg3 *tp, u32 current_link_up) 2266static void tg3_phy_eee_adjust(struct tg3 *tp, u32 current_link_up)
@@ -2284,9 +2296,9 @@ static void tg3_phy_eee_adjust(struct tg3 *tp, u32 current_link_up)
2284 2296
2285 if (!tp->setlpicnt) { 2297 if (!tp->setlpicnt) {
2286 if (current_link_up == 1 && 2298 if (current_link_up == 1 &&
2287 !TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) { 2299 !tg3_phy_toggle_auxctl_smdsp(tp, true)) {
2288 tg3_phydsp_write(tp, MII_TG3_DSP_TAP26, 0x0000); 2300 tg3_phydsp_write(tp, MII_TG3_DSP_TAP26, 0x0000);
2289 TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); 2301 tg3_phy_toggle_auxctl_smdsp(tp, false);
2290 } 2302 }
2291 2303
2292 val = tr32(TG3_CPMU_EEE_MODE); 2304 val = tr32(TG3_CPMU_EEE_MODE);
@@ -2302,11 +2314,11 @@ static void tg3_phy_eee_enable(struct tg3 *tp)
2302 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 || 2314 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 ||
2303 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 || 2315 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
2304 tg3_flag(tp, 57765_CLASS)) && 2316 tg3_flag(tp, 57765_CLASS)) &&
2305 !TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) { 2317 !tg3_phy_toggle_auxctl_smdsp(tp, true)) {
2306 val = MII_TG3_DSP_TAP26_ALNOKO | 2318 val = MII_TG3_DSP_TAP26_ALNOKO |
2307 MII_TG3_DSP_TAP26_RMRXSTO; 2319 MII_TG3_DSP_TAP26_RMRXSTO;
2308 tg3_phydsp_write(tp, MII_TG3_DSP_TAP26, val); 2320 tg3_phydsp_write(tp, MII_TG3_DSP_TAP26, val);
2309 TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); 2321 tg3_phy_toggle_auxctl_smdsp(tp, false);
2310 } 2322 }
2311 2323
2312 val = tr32(TG3_CPMU_EEE_MODE); 2324 val = tr32(TG3_CPMU_EEE_MODE);
@@ -2450,7 +2462,7 @@ static int tg3_phy_reset_5703_4_5(struct tg3 *tp)
2450 tg3_writephy(tp, MII_CTRL1000, 2462 tg3_writephy(tp, MII_CTRL1000,
2451 CTL1000_AS_MASTER | CTL1000_ENABLE_MASTER); 2463 CTL1000_AS_MASTER | CTL1000_ENABLE_MASTER);
2452 2464
2453 err = TG3_PHY_AUXCTL_SMDSP_ENABLE(tp); 2465 err = tg3_phy_toggle_auxctl_smdsp(tp, true);
2454 if (err) 2466 if (err)
2455 return err; 2467 return err;
2456 2468
@@ -2471,7 +2483,7 @@ static int tg3_phy_reset_5703_4_5(struct tg3 *tp)
2471 tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x8200); 2483 tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x8200);
2472 tg3_writephy(tp, MII_TG3_DSP_CONTROL, 0x0000); 2484 tg3_writephy(tp, MII_TG3_DSP_CONTROL, 0x0000);
2473 2485
2474 TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); 2486 tg3_phy_toggle_auxctl_smdsp(tp, false);
2475 2487
2476 tg3_writephy(tp, MII_CTRL1000, phy9_orig); 2488 tg3_writephy(tp, MII_CTRL1000, phy9_orig);
2477 2489
@@ -2572,10 +2584,10 @@ static int tg3_phy_reset(struct tg3 *tp)
2572 2584
2573out: 2585out:
2574 if ((tp->phy_flags & TG3_PHYFLG_ADC_BUG) && 2586 if ((tp->phy_flags & TG3_PHYFLG_ADC_BUG) &&
2575 !TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) { 2587 !tg3_phy_toggle_auxctl_smdsp(tp, true)) {
2576 tg3_phydsp_write(tp, 0x201f, 0x2aaa); 2588 tg3_phydsp_write(tp, 0x201f, 0x2aaa);
2577 tg3_phydsp_write(tp, 0x000a, 0x0323); 2589 tg3_phydsp_write(tp, 0x000a, 0x0323);
2578 TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); 2590 tg3_phy_toggle_auxctl_smdsp(tp, false);
2579 } 2591 }
2580 2592
2581 if (tp->phy_flags & TG3_PHYFLG_5704_A0_BUG) { 2593 if (tp->phy_flags & TG3_PHYFLG_5704_A0_BUG) {
@@ -2584,14 +2596,14 @@ out:
2584 } 2596 }
2585 2597
2586 if (tp->phy_flags & TG3_PHYFLG_BER_BUG) { 2598 if (tp->phy_flags & TG3_PHYFLG_BER_BUG) {
2587 if (!TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) { 2599 if (!tg3_phy_toggle_auxctl_smdsp(tp, true)) {
2588 tg3_phydsp_write(tp, 0x000a, 0x310b); 2600 tg3_phydsp_write(tp, 0x000a, 0x310b);
2589 tg3_phydsp_write(tp, 0x201f, 0x9506); 2601 tg3_phydsp_write(tp, 0x201f, 0x9506);
2590 tg3_phydsp_write(tp, 0x401f, 0x14e2); 2602 tg3_phydsp_write(tp, 0x401f, 0x14e2);
2591 TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); 2603 tg3_phy_toggle_auxctl_smdsp(tp, false);
2592 } 2604 }
2593 } else if (tp->phy_flags & TG3_PHYFLG_JITTER_BUG) { 2605 } else if (tp->phy_flags & TG3_PHYFLG_JITTER_BUG) {
2594 if (!TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) { 2606 if (!tg3_phy_toggle_auxctl_smdsp(tp, true)) {
2595 tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x000a); 2607 tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x000a);
2596 if (tp->phy_flags & TG3_PHYFLG_ADJUST_TRIM) { 2608 if (tp->phy_flags & TG3_PHYFLG_ADJUST_TRIM) {
2597 tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x110b); 2609 tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x110b);
@@ -2600,7 +2612,7 @@ out:
2600 } else 2612 } else
2601 tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x010b); 2613 tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x010b);
2602 2614
2603 TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); 2615 tg3_phy_toggle_auxctl_smdsp(tp, false);
2604 } 2616 }
2605 } 2617 }
2606 2618
@@ -4009,7 +4021,7 @@ static int tg3_phy_autoneg_cfg(struct tg3 *tp, u32 advertise, u32 flowctrl)
4009 tw32(TG3_CPMU_EEE_MODE, 4021 tw32(TG3_CPMU_EEE_MODE,
4010 tr32(TG3_CPMU_EEE_MODE) & ~TG3_CPMU_EEEMD_LPI_ENABLE); 4022 tr32(TG3_CPMU_EEE_MODE) & ~TG3_CPMU_EEEMD_LPI_ENABLE);
4011 4023
4012 err = TG3_PHY_AUXCTL_SMDSP_ENABLE(tp); 4024 err = tg3_phy_toggle_auxctl_smdsp(tp, true);
4013 if (!err) { 4025 if (!err) {
4014 u32 err2; 4026 u32 err2;
4015 4027
@@ -4042,7 +4054,7 @@ static int tg3_phy_autoneg_cfg(struct tg3 *tp, u32 advertise, u32 flowctrl)
4042 MII_TG3_DSP_CH34TP2_HIBW01); 4054 MII_TG3_DSP_CH34TP2_HIBW01);
4043 } 4055 }
4044 4056
4045 err2 = TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); 4057 err2 = tg3_phy_toggle_auxctl_smdsp(tp, false);
4046 if (!err) 4058 if (!err)
4047 err = err2; 4059 err = err2;
4048 } 4060 }
@@ -6950,6 +6962,9 @@ static void tg3_poll_controller(struct net_device *dev)
6950 int i; 6962 int i;
6951 struct tg3 *tp = netdev_priv(dev); 6963 struct tg3 *tp = netdev_priv(dev);
6952 6964
6965 if (tg3_irq_sync(tp))
6966 return;
6967
6953 for (i = 0; i < tp->irq_cnt; i++) 6968 for (i = 0; i < tp->irq_cnt; i++)
6954 tg3_interrupt(tp->napi[i].irq_vec, &tp->napi[i]); 6969 tg3_interrupt(tp->napi[i].irq_vec, &tp->napi[i]);
6955} 6970}
@@ -16367,6 +16382,7 @@ static int tg3_init_one(struct pci_dev *pdev,
16367 tp->pm_cap = pm_cap; 16382 tp->pm_cap = pm_cap;
16368 tp->rx_mode = TG3_DEF_RX_MODE; 16383 tp->rx_mode = TG3_DEF_RX_MODE;
16369 tp->tx_mode = TG3_DEF_TX_MODE; 16384 tp->tx_mode = TG3_DEF_TX_MODE;
16385 tp->irq_sync = 1;
16370 16386
16371 if (tg3_debug > 0) 16387 if (tg3_debug > 0)
16372 tp->msg_enable = tg3_debug; 16388 tp->msg_enable = tg3_debug;
diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c
index b407043ce9b0..f7f02900f650 100644
--- a/drivers/net/ethernet/calxeda/xgmac.c
+++ b/drivers/net/ethernet/calxeda/xgmac.c
@@ -548,6 +548,10 @@ static int desc_get_rx_status(struct xgmac_priv *priv, struct xgmac_dma_desc *p)
548 return -1; 548 return -1;
549 } 549 }
550 550
551 /* All frames should fit into a single buffer */
552 if (!(status & RXDESC_FIRST_SEG) || !(status & RXDESC_LAST_SEG))
553 return -1;
554
551 /* Check if packet has checksum already */ 555 /* Check if packet has checksum already */
552 if ((status & RXDESC_FRAME_TYPE) && (status & RXDESC_EXT_STATUS) && 556 if ((status & RXDESC_FRAME_TYPE) && (status & RXDESC_EXT_STATUS) &&
553 !(ext_status & RXDESC_IP_PAYLOAD_MASK)) 557 !(ext_status & RXDESC_IP_PAYLOAD_MASK))
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index f0718e1a8369..c306df7d4568 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -1994,9 +1994,20 @@ static int set_coalesce(struct net_device *dev, struct ethtool_coalesce *c)
1994{ 1994{
1995 const struct port_info *pi = netdev_priv(dev); 1995 const struct port_info *pi = netdev_priv(dev);
1996 struct adapter *adap = pi->adapter; 1996 struct adapter *adap = pi->adapter;
1997 1997 struct sge_rspq *q;
1998 return set_rxq_intr_params(adap, &adap->sge.ethrxq[pi->first_qset].rspq, 1998 int i;
1999 c->rx_coalesce_usecs, c->rx_max_coalesced_frames); 1999 int r = 0;
2000
2001 for (i = pi->first_qset; i < pi->first_qset + pi->nqsets; i++) {
2002 q = &adap->sge.ethrxq[i].rspq;
2003 r = set_rxq_intr_params(adap, q, c->rx_coalesce_usecs,
2004 c->rx_max_coalesced_frames);
2005 if (r) {
2006 dev_err(&dev->dev, "failed to set coalesce %d\n", r);
2007 break;
2008 }
2009 }
2010 return r;
2000} 2011}
2001 2012
2002static int get_coalesce(struct net_device *dev, struct ethtool_coalesce *c) 2013static int get_coalesce(struct net_device *dev, struct ethtool_coalesce *c)
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index 3bc1912afba9..4eba17b83ba8 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -190,6 +190,7 @@ struct be_eq_obj {
190 190
191 u8 idx; /* array index */ 191 u8 idx; /* array index */
192 u16 tx_budget; 192 u16 tx_budget;
193 u16 spurious_intr;
193 struct napi_struct napi; 194 struct napi_struct napi;
194 struct be_adapter *adapter; 195 struct be_adapter *adapter;
195} ____cacheline_aligned_in_smp; 196} ____cacheline_aligned_in_smp;
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 9dca22be8125..5c995700e534 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -2026,19 +2026,30 @@ static irqreturn_t be_intx(int irq, void *dev)
2026 struct be_adapter *adapter = eqo->adapter; 2026 struct be_adapter *adapter = eqo->adapter;
2027 int num_evts = 0; 2027 int num_evts = 0;
2028 2028
2029 /* On Lancer, clear-intr bit of the EQ DB does not work. 2029 /* IRQ is not expected when NAPI is scheduled as the EQ
2030 * INTx is de-asserted only on notifying num evts. 2030 * will not be armed.
2031 * But, this can happen on Lancer INTx where it takes
2032 * a while to de-assert INTx or in BE2 where occasionaly
2033 * an interrupt may be raised even when EQ is unarmed.
2034 * If NAPI is already scheduled, then counting & notifying
2035 * events will orphan them.
2031 */ 2036 */
2032 if (lancer_chip(adapter)) 2037 if (napi_schedule_prep(&eqo->napi)) {
2033 num_evts = events_get(eqo); 2038 num_evts = events_get(eqo);
2039 __napi_schedule(&eqo->napi);
2040 if (num_evts)
2041 eqo->spurious_intr = 0;
2042 }
2043 be_eq_notify(adapter, eqo->q.id, false, true, num_evts);
2034 2044
2035 /* The EQ-notify may not de-assert INTx rightaway, causing 2045 /* Return IRQ_HANDLED only for the the first spurious intr
2036 * the ISR to be invoked again. So, return HANDLED even when 2046 * after a valid intr to stop the kernel from branding
2037 * num_evts is zero. 2047 * this irq as a bad one!
2038 */ 2048 */
2039 be_eq_notify(adapter, eqo->q.id, false, true, num_evts); 2049 if (num_evts || eqo->spurious_intr++ == 0)
2040 napi_schedule(&eqo->napi); 2050 return IRQ_HANDLED;
2041 return IRQ_HANDLED; 2051 else
2052 return IRQ_NONE;
2042} 2053}
2043 2054
2044static irqreturn_t be_msix(int irq, void *dev) 2055static irqreturn_t be_msix(int irq, void *dev)
diff --git a/drivers/net/ethernet/intel/ixgbe/Makefile b/drivers/net/ethernet/intel/ixgbe/Makefile
index f3a632bf8d96..687c83d1bdab 100644
--- a/drivers/net/ethernet/intel/ixgbe/Makefile
+++ b/drivers/net/ethernet/intel/ixgbe/Makefile
@@ -32,7 +32,7 @@
32 32
33obj-$(CONFIG_IXGBE) += ixgbe.o 33obj-$(CONFIG_IXGBE) += ixgbe.o
34 34
35ixgbe-objs := ixgbe_main.o ixgbe_common.o ixgbe_ethtool.o ixgbe_debugfs.o\ 35ixgbe-objs := ixgbe_main.o ixgbe_common.o ixgbe_ethtool.o \
36 ixgbe_82599.o ixgbe_82598.o ixgbe_phy.o ixgbe_sriov.o \ 36 ixgbe_82599.o ixgbe_82598.o ixgbe_phy.o ixgbe_sriov.o \
37 ixgbe_mbx.o ixgbe_x540.o ixgbe_lib.o ixgbe_ptp.o 37 ixgbe_mbx.o ixgbe_x540.o ixgbe_lib.o ixgbe_ptp.o
38 38
@@ -40,4 +40,5 @@ ixgbe-$(CONFIG_IXGBE_DCB) += ixgbe_dcb.o ixgbe_dcb_82598.o \
40 ixgbe_dcb_82599.o ixgbe_dcb_nl.o 40 ixgbe_dcb_82599.o ixgbe_dcb_nl.o
41 41
42ixgbe-$(CONFIG_IXGBE_HWMON) += ixgbe_sysfs.o 42ixgbe-$(CONFIG_IXGBE_HWMON) += ixgbe_sysfs.o
43ixgbe-$(CONFIG_DEBUG_FS) += ixgbe_debugfs.o
43ixgbe-$(CONFIG_FCOE:m=y) += ixgbe_fcoe.o 44ixgbe-$(CONFIG_FCOE:m=y) += ixgbe_fcoe.o
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_debugfs.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_debugfs.c
index 50aa546b8c7a..3504686d3af5 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_debugfs.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_debugfs.c
@@ -24,9 +24,6 @@
24 Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 24 Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
25 25
26*******************************************************************************/ 26*******************************************************************************/
27
28#ifdef CONFIG_DEBUG_FS
29
30#include <linux/debugfs.h> 27#include <linux/debugfs.h>
31#include <linux/module.h> 28#include <linux/module.h>
32 29
@@ -277,5 +274,3 @@ void ixgbe_dbg_exit(void)
277{ 274{
278 debugfs_remove_recursive(ixgbe_dbg_root); 275 debugfs_remove_recursive(ixgbe_dbg_root);
279} 276}
280
281#endif /* CONFIG_DEBUG_FS */
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
index 1a751c9d09c4..bb9256a1b0a9 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
@@ -660,11 +660,11 @@ int ixgbe_ptp_hwtstamp_ioctl(struct ixgbe_adapter *adapter,
660 break; 660 break;
661 case HWTSTAMP_FILTER_PTP_V1_L4_SYNC: 661 case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
662 tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_L4_V1; 662 tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_L4_V1;
663 tsync_rx_mtrl = IXGBE_RXMTRL_V1_SYNC_MSG; 663 tsync_rx_mtrl |= IXGBE_RXMTRL_V1_SYNC_MSG;
664 break; 664 break;
665 case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ: 665 case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
666 tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_L4_V1; 666 tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_L4_V1;
667 tsync_rx_mtrl = IXGBE_RXMTRL_V1_DELAY_REQ_MSG; 667 tsync_rx_mtrl |= IXGBE_RXMTRL_V1_DELAY_REQ_MSG;
668 break; 668 break;
669 case HWTSTAMP_FILTER_PTP_V2_EVENT: 669 case HWTSTAMP_FILTER_PTP_V2_EVENT:
670 case HWTSTAMP_FILTER_PTP_V2_L2_EVENT: 670 case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index 6d6002bab060..74f1c157a480 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -141,7 +141,7 @@ static int orion_mdio_reset(struct mii_bus *bus)
141 return 0; 141 return 0;
142} 142}
143 143
144static int __devinit orion_mdio_probe(struct platform_device *pdev) 144static int orion_mdio_probe(struct platform_device *pdev)
145{ 145{
146 struct device_node *np = pdev->dev.of_node; 146 struct device_node *np = pdev->dev.of_node;
147 struct mii_bus *bus; 147 struct mii_bus *bus;
@@ -197,7 +197,7 @@ static int __devinit orion_mdio_probe(struct platform_device *pdev)
197 return 0; 197 return 0;
198} 198}
199 199
200static int __devexit orion_mdio_remove(struct platform_device *pdev) 200static int orion_mdio_remove(struct platform_device *pdev)
201{ 201{
202 struct mii_bus *bus = platform_get_drvdata(pdev); 202 struct mii_bus *bus = platform_get_drvdata(pdev);
203 mdiobus_unregister(bus); 203 mdiobus_unregister(bus);
@@ -214,7 +214,7 @@ MODULE_DEVICE_TABLE(of, orion_mdio_match);
214 214
215static struct platform_driver orion_mdio_driver = { 215static struct platform_driver orion_mdio_driver = {
216 .probe = orion_mdio_probe, 216 .probe = orion_mdio_probe,
217 .remove = __devexit_p(orion_mdio_remove), 217 .remove = orion_mdio_remove,
218 .driver = { 218 .driver = {
219 .name = "orion-mdio", 219 .name = "orion-mdio",
220 .of_match_table = orion_mdio_match, 220 .of_match_table = orion_mdio_match,
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 3f8086b9f5e5..b6025c305e10 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -635,7 +635,7 @@ static void mvneta_rxq_bm_disable(struct mvneta_port *pp,
635 635
636 636
637/* Sets the RGMII Enable bit (RGMIIEn) in port MAC control register */ 637/* Sets the RGMII Enable bit (RGMIIEn) in port MAC control register */
638static void __devinit mvneta_gmac_rgmii_set(struct mvneta_port *pp, int enable) 638static void mvneta_gmac_rgmii_set(struct mvneta_port *pp, int enable)
639{ 639{
640 u32 val; 640 u32 val;
641 641
@@ -650,7 +650,7 @@ static void __devinit mvneta_gmac_rgmii_set(struct mvneta_port *pp, int enable)
650} 650}
651 651
652/* Config SGMII port */ 652/* Config SGMII port */
653static void __devinit mvneta_port_sgmii_config(struct mvneta_port *pp) 653static void mvneta_port_sgmii_config(struct mvneta_port *pp)
654{ 654{
655 u32 val; 655 u32 val;
656 656
@@ -2564,7 +2564,7 @@ const struct ethtool_ops mvneta_eth_tool_ops = {
2564}; 2564};
2565 2565
2566/* Initialize hw */ 2566/* Initialize hw */
2567static int __devinit mvneta_init(struct mvneta_port *pp, int phy_addr) 2567static int mvneta_init(struct mvneta_port *pp, int phy_addr)
2568{ 2568{
2569 int queue; 2569 int queue;
2570 2570
@@ -2613,9 +2613,8 @@ static void mvneta_deinit(struct mvneta_port *pp)
2613} 2613}
2614 2614
2615/* platform glue : initialize decoding windows */ 2615/* platform glue : initialize decoding windows */
2616static void __devinit 2616static void mvneta_conf_mbus_windows(struct mvneta_port *pp,
2617mvneta_conf_mbus_windows(struct mvneta_port *pp, 2617 const struct mbus_dram_target_info *dram)
2618 const struct mbus_dram_target_info *dram)
2619{ 2618{
2620 u32 win_enable; 2619 u32 win_enable;
2621 u32 win_protect; 2620 u32 win_protect;
@@ -2648,7 +2647,7 @@ mvneta_conf_mbus_windows(struct mvneta_port *pp,
2648} 2647}
2649 2648
2650/* Power up the port */ 2649/* Power up the port */
2651static void __devinit mvneta_port_power_up(struct mvneta_port *pp, int phy_mode) 2650static void mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
2652{ 2651{
2653 u32 val; 2652 u32 val;
2654 2653
@@ -2671,7 +2670,7 @@ static void __devinit mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
2671} 2670}
2672 2671
2673/* Device initialization routine */ 2672/* Device initialization routine */
2674static int __devinit mvneta_probe(struct platform_device *pdev) 2673static int mvneta_probe(struct platform_device *pdev)
2675{ 2674{
2676 const struct mbus_dram_target_info *dram_target_info; 2675 const struct mbus_dram_target_info *dram_target_info;
2677 struct device_node *dn = pdev->dev.of_node; 2676 struct device_node *dn = pdev->dev.of_node;
@@ -2803,7 +2802,7 @@ err_free_netdev:
2803} 2802}
2804 2803
2805/* Device removal routine */ 2804/* Device removal routine */
2806static int __devexit mvneta_remove(struct platform_device *pdev) 2805static int mvneta_remove(struct platform_device *pdev)
2807{ 2806{
2808 struct net_device *dev = platform_get_drvdata(pdev); 2807 struct net_device *dev = platform_get_drvdata(pdev);
2809 struct mvneta_port *pp = netdev_priv(dev); 2808 struct mvneta_port *pp = netdev_priv(dev);
@@ -2828,7 +2827,7 @@ MODULE_DEVICE_TABLE(of, mvneta_match);
2828 2827
2829static struct platform_driver mvneta_driver = { 2828static struct platform_driver mvneta_driver = {
2830 .probe = mvneta_probe, 2829 .probe = mvneta_probe,
2831 .remove = __devexit_p(mvneta_remove), 2830 .remove = mvneta_remove,
2832 .driver = { 2831 .driver = {
2833 .name = MVNETA_DRIVER_NAME, 2832 .name = MVNETA_DRIVER_NAME,
2834 .of_match_table = mvneta_match, 2833 .of_match_table = mvneta_match,
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
index 2b799f4f1c37..6771b69f40d5 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
@@ -630,10 +630,15 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
630 ring->tx_csum++; 630 ring->tx_csum++;
631 } 631 }
632 632
633 /* Copy dst mac address to wqe */ 633 if (mlx4_is_mfunc(mdev->dev) || priv->validate_loopback) {
634 ethh = (struct ethhdr *)skb->data; 634 /* Copy dst mac address to wqe. This allows loopback in eSwitch,
635 tx_desc->ctrl.srcrb_flags16[0] = get_unaligned((__be16 *)ethh->h_dest); 635 * so that VFs and PF can communicate with each other
636 tx_desc->ctrl.imm = get_unaligned((__be32 *)(ethh->h_dest + 2)); 636 */
637 ethh = (struct ethhdr *)skb->data;
638 tx_desc->ctrl.srcrb_flags16[0] = get_unaligned((__be16 *)ethh->h_dest);
639 tx_desc->ctrl.imm = get_unaligned((__be32 *)(ethh->h_dest + 2));
640 }
641
637 /* Handle LSO (TSO) packets */ 642 /* Handle LSO (TSO) packets */
638 if (lso_header_size) { 643 if (lso_header_size) {
639 /* Mark opcode as LSO */ 644 /* Mark opcode as LSO */
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index e1bafffbc3b1..a6542d75374c 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -1790,15 +1790,8 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev)
1790 int i; 1790 int i;
1791 1791
1792 if (msi_x) { 1792 if (msi_x) {
1793 /* In multifunction mode each function gets 2 msi-X vectors 1793 nreq = min_t(int, dev->caps.num_eqs - dev->caps.reserved_eqs,
1794 * one for data path completions anf the other for asynch events 1794 nreq);
1795 * or command completions */
1796 if (mlx4_is_mfunc(dev)) {
1797 nreq = 2;
1798 } else {
1799 nreq = min_t(int, dev->caps.num_eqs -
1800 dev->caps.reserved_eqs, nreq);
1801 }
1802 1795
1803 entries = kcalloc(nreq, sizeof *entries, GFP_KERNEL); 1796 entries = kcalloc(nreq, sizeof *entries, GFP_KERNEL);
1804 if (!entries) 1797 if (!entries)
diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c
index 653487dc7b52..87fa5919c455 100644
--- a/drivers/net/ethernet/nvidia/forcedeth.c
+++ b/drivers/net/ethernet/nvidia/forcedeth.c
@@ -1821,6 +1821,11 @@ static int nv_alloc_rx(struct net_device *dev)
1821 skb->data, 1821 skb->data,
1822 skb_tailroom(skb), 1822 skb_tailroom(skb),
1823 PCI_DMA_FROMDEVICE); 1823 PCI_DMA_FROMDEVICE);
1824 if (pci_dma_mapping_error(np->pci_dev,
1825 np->put_rx_ctx->dma)) {
1826 kfree_skb(skb);
1827 goto packet_dropped;
1828 }
1824 np->put_rx_ctx->dma_len = skb_tailroom(skb); 1829 np->put_rx_ctx->dma_len = skb_tailroom(skb);
1825 np->put_rx.orig->buf = cpu_to_le32(np->put_rx_ctx->dma); 1830 np->put_rx.orig->buf = cpu_to_le32(np->put_rx_ctx->dma);
1826 wmb(); 1831 wmb();
@@ -1830,6 +1835,7 @@ static int nv_alloc_rx(struct net_device *dev)
1830 if (unlikely(np->put_rx_ctx++ == np->last_rx_ctx)) 1835 if (unlikely(np->put_rx_ctx++ == np->last_rx_ctx))
1831 np->put_rx_ctx = np->first_rx_ctx; 1836 np->put_rx_ctx = np->first_rx_ctx;
1832 } else { 1837 } else {
1838packet_dropped:
1833 u64_stats_update_begin(&np->swstats_rx_syncp); 1839 u64_stats_update_begin(&np->swstats_rx_syncp);
1834 np->stat_rx_dropped++; 1840 np->stat_rx_dropped++;
1835 u64_stats_update_end(&np->swstats_rx_syncp); 1841 u64_stats_update_end(&np->swstats_rx_syncp);
@@ -1856,6 +1862,11 @@ static int nv_alloc_rx_optimized(struct net_device *dev)
1856 skb->data, 1862 skb->data,
1857 skb_tailroom(skb), 1863 skb_tailroom(skb),
1858 PCI_DMA_FROMDEVICE); 1864 PCI_DMA_FROMDEVICE);
1865 if (pci_dma_mapping_error(np->pci_dev,
1866 np->put_rx_ctx->dma)) {
1867 kfree_skb(skb);
1868 goto packet_dropped;
1869 }
1859 np->put_rx_ctx->dma_len = skb_tailroom(skb); 1870 np->put_rx_ctx->dma_len = skb_tailroom(skb);
1860 np->put_rx.ex->bufhigh = cpu_to_le32(dma_high(np->put_rx_ctx->dma)); 1871 np->put_rx.ex->bufhigh = cpu_to_le32(dma_high(np->put_rx_ctx->dma));
1861 np->put_rx.ex->buflow = cpu_to_le32(dma_low(np->put_rx_ctx->dma)); 1872 np->put_rx.ex->buflow = cpu_to_le32(dma_low(np->put_rx_ctx->dma));
@@ -1866,6 +1877,7 @@ static int nv_alloc_rx_optimized(struct net_device *dev)
1866 if (unlikely(np->put_rx_ctx++ == np->last_rx_ctx)) 1877 if (unlikely(np->put_rx_ctx++ == np->last_rx_ctx))
1867 np->put_rx_ctx = np->first_rx_ctx; 1878 np->put_rx_ctx = np->first_rx_ctx;
1868 } else { 1879 } else {
1880packet_dropped:
1869 u64_stats_update_begin(&np->swstats_rx_syncp); 1881 u64_stats_update_begin(&np->swstats_rx_syncp);
1870 np->stat_rx_dropped++; 1882 np->stat_rx_dropped++;
1871 u64_stats_update_end(&np->swstats_rx_syncp); 1883 u64_stats_update_end(&np->swstats_rx_syncp);
@@ -2217,6 +2229,15 @@ static netdev_tx_t nv_start_xmit(struct sk_buff *skb, struct net_device *dev)
2217 bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size; 2229 bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size;
2218 np->put_tx_ctx->dma = pci_map_single(np->pci_dev, skb->data + offset, bcnt, 2230 np->put_tx_ctx->dma = pci_map_single(np->pci_dev, skb->data + offset, bcnt,
2219 PCI_DMA_TODEVICE); 2231 PCI_DMA_TODEVICE);
2232 if (pci_dma_mapping_error(np->pci_dev,
2233 np->put_tx_ctx->dma)) {
2234 /* on DMA mapping error - drop the packet */
2235 kfree_skb(skb);
2236 u64_stats_update_begin(&np->swstats_tx_syncp);
2237 np->stat_tx_dropped++;
2238 u64_stats_update_end(&np->swstats_tx_syncp);
2239 return NETDEV_TX_OK;
2240 }
2220 np->put_tx_ctx->dma_len = bcnt; 2241 np->put_tx_ctx->dma_len = bcnt;
2221 np->put_tx_ctx->dma_single = 1; 2242 np->put_tx_ctx->dma_single = 1;
2222 put_tx->buf = cpu_to_le32(np->put_tx_ctx->dma); 2243 put_tx->buf = cpu_to_le32(np->put_tx_ctx->dma);
@@ -2337,6 +2358,15 @@ static netdev_tx_t nv_start_xmit_optimized(struct sk_buff *skb,
2337 bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size; 2358 bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size;
2338 np->put_tx_ctx->dma = pci_map_single(np->pci_dev, skb->data + offset, bcnt, 2359 np->put_tx_ctx->dma = pci_map_single(np->pci_dev, skb->data + offset, bcnt,
2339 PCI_DMA_TODEVICE); 2360 PCI_DMA_TODEVICE);
2361 if (pci_dma_mapping_error(np->pci_dev,
2362 np->put_tx_ctx->dma)) {
2363 /* on DMA mapping error - drop the packet */
2364 kfree_skb(skb);
2365 u64_stats_update_begin(&np->swstats_tx_syncp);
2366 np->stat_tx_dropped++;
2367 u64_stats_update_end(&np->swstats_tx_syncp);
2368 return NETDEV_TX_OK;
2369 }
2340 np->put_tx_ctx->dma_len = bcnt; 2370 np->put_tx_ctx->dma_len = bcnt;
2341 np->put_tx_ctx->dma_single = 1; 2371 np->put_tx_ctx->dma_single = 1;
2342 put_tx->bufhigh = cpu_to_le32(dma_high(np->put_tx_ctx->dma)); 2372 put_tx->bufhigh = cpu_to_le32(dma_high(np->put_tx_ctx->dma));
@@ -5003,6 +5033,11 @@ static int nv_loopback_test(struct net_device *dev)
5003 test_dma_addr = pci_map_single(np->pci_dev, tx_skb->data, 5033 test_dma_addr = pci_map_single(np->pci_dev, tx_skb->data,
5004 skb_tailroom(tx_skb), 5034 skb_tailroom(tx_skb),
5005 PCI_DMA_FROMDEVICE); 5035 PCI_DMA_FROMDEVICE);
5036 if (pci_dma_mapping_error(np->pci_dev,
5037 test_dma_addr)) {
5038 dev_kfree_skb_any(tx_skb);
5039 goto out;
5040 }
5006 pkt_data = skb_put(tx_skb, pkt_len); 5041 pkt_data = skb_put(tx_skb, pkt_len);
5007 for (i = 0; i < pkt_len; i++) 5042 for (i = 0; i < pkt_len; i++)
5008 pkt_data[i] = (u8)(i & 0xff); 5043 pkt_data[i] = (u8)(i & 0xff);
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
index bc165f4d0f65..695667d471a1 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
@@ -144,7 +144,7 @@ void netxen_release_tx_buffers(struct netxen_adapter *adapter)
144 buffrag->length, PCI_DMA_TODEVICE); 144 buffrag->length, PCI_DMA_TODEVICE);
145 buffrag->dma = 0ULL; 145 buffrag->dma = 0ULL;
146 } 146 }
147 for (j = 0; j < cmd_buf->frag_count; j++) { 147 for (j = 1; j < cmd_buf->frag_count; j++) {
148 buffrag++; 148 buffrag++;
149 if (buffrag->dma) { 149 if (buffrag->dma) {
150 pci_unmap_page(adapter->pdev, buffrag->dma, 150 pci_unmap_page(adapter->pdev, buffrag->dma,
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
index 6098fd4adfeb..69e321a65077 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
@@ -1963,10 +1963,12 @@ unwind:
1963 while (--i >= 0) { 1963 while (--i >= 0) {
1964 nf = &pbuf->frag_array[i+1]; 1964 nf = &pbuf->frag_array[i+1];
1965 pci_unmap_page(pdev, nf->dma, nf->length, PCI_DMA_TODEVICE); 1965 pci_unmap_page(pdev, nf->dma, nf->length, PCI_DMA_TODEVICE);
1966 nf->dma = 0ULL;
1966 } 1967 }
1967 1968
1968 nf = &pbuf->frag_array[0]; 1969 nf = &pbuf->frag_array[0];
1969 pci_unmap_single(pdev, nf->dma, skb_headlen(skb), PCI_DMA_TODEVICE); 1970 pci_unmap_single(pdev, nf->dma, skb_headlen(skb), PCI_DMA_TODEVICE);
1971 nf->dma = 0ULL;
1970 1972
1971out_err: 1973out_err:
1972 return -ENOMEM; 1974 return -ENOMEM;
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
index f80cd975daed..3e73742024b0 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c
+++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
@@ -4678,7 +4678,7 @@ static int qlge_probe(struct pci_dev *pdev,
4678 qdev = netdev_priv(ndev); 4678 qdev = netdev_priv(ndev);
4679 SET_NETDEV_DEV(ndev, &pdev->dev); 4679 SET_NETDEV_DEV(ndev, &pdev->dev);
4680 ndev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | 4680 ndev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM |
4681 NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN | 4681 NETIF_F_TSO | NETIF_F_TSO_ECN |
4682 NETIF_F_HW_VLAN_TX | NETIF_F_RXCSUM; 4682 NETIF_F_HW_VLAN_TX | NETIF_F_RXCSUM;
4683 ndev->features = ndev->hw_features | 4683 ndev->features = ndev->hw_features |
4684 NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER; 4684 NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER;
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index ed96f309bca8..11702324a071 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -1826,8 +1826,6 @@ static void rtl8169_rx_vlan_tag(struct RxDesc *desc, struct sk_buff *skb)
1826 1826
1827 if (opts2 & RxVlanTag) 1827 if (opts2 & RxVlanTag)
1828 __vlan_hwaccel_put_tag(skb, swab16(opts2 & 0xffff)); 1828 __vlan_hwaccel_put_tag(skb, swab16(opts2 & 0xffff));
1829
1830 desc->opts2 = 0;
1831} 1829}
1832 1830
1833static int rtl8169_gset_tbi(struct net_device *dev, struct ethtool_cmd *cmd) 1831static int rtl8169_gset_tbi(struct net_device *dev, struct ethtool_cmd *cmd)
@@ -6064,8 +6062,6 @@ static int rtl_rx(struct net_device *dev, struct rtl8169_private *tp, u32 budget
6064 !(status & (RxRWT | RxFOVF)) && 6062 !(status & (RxRWT | RxFOVF)) &&
6065 (dev->features & NETIF_F_RXALL)) 6063 (dev->features & NETIF_F_RXALL))
6066 goto process_pkt; 6064 goto process_pkt;
6067
6068 rtl8169_mark_to_asic(desc, rx_buf_sz);
6069 } else { 6065 } else {
6070 struct sk_buff *skb; 6066 struct sk_buff *skb;
6071 dma_addr_t addr; 6067 dma_addr_t addr;
@@ -6086,16 +6082,14 @@ process_pkt:
6086 if (unlikely(rtl8169_fragmented_frame(status))) { 6082 if (unlikely(rtl8169_fragmented_frame(status))) {
6087 dev->stats.rx_dropped++; 6083 dev->stats.rx_dropped++;
6088 dev->stats.rx_length_errors++; 6084 dev->stats.rx_length_errors++;
6089 rtl8169_mark_to_asic(desc, rx_buf_sz); 6085 goto release_descriptor;
6090 continue;
6091 } 6086 }
6092 6087
6093 skb = rtl8169_try_rx_copy(tp->Rx_databuff[entry], 6088 skb = rtl8169_try_rx_copy(tp->Rx_databuff[entry],
6094 tp, pkt_size, addr); 6089 tp, pkt_size, addr);
6095 rtl8169_mark_to_asic(desc, rx_buf_sz);
6096 if (!skb) { 6090 if (!skb) {
6097 dev->stats.rx_dropped++; 6091 dev->stats.rx_dropped++;
6098 continue; 6092 goto release_descriptor;
6099 } 6093 }
6100 6094
6101 rtl8169_rx_csum(skb, status); 6095 rtl8169_rx_csum(skb, status);
@@ -6111,13 +6105,10 @@ process_pkt:
6111 tp->rx_stats.bytes += pkt_size; 6105 tp->rx_stats.bytes += pkt_size;
6112 u64_stats_update_end(&tp->rx_stats.syncp); 6106 u64_stats_update_end(&tp->rx_stats.syncp);
6113 } 6107 }
6114 6108release_descriptor:
6115 /* Work around for AMD plateform. */ 6109 desc->opts2 = 0;
6116 if ((desc->opts2 & cpu_to_le32(0xfffe000)) && 6110 wmb();
6117 (tp->mac_version == RTL_GIGA_MAC_VER_05)) { 6111 rtl8169_mark_to_asic(desc, rx_buf_sz);
6118 desc->opts2 = 0;
6119 cur_rx++;
6120 }
6121 } 6112 }
6122 6113
6123 count = cur_rx - tp->cur_rx; 6114 count = cur_rx - tp->cur_rx;
diff --git a/drivers/net/ethernet/ti/cpts.c b/drivers/net/ethernet/ti/cpts.c
index 5e62c1aeeffb..463597f919f1 100644
--- a/drivers/net/ethernet/ti/cpts.c
+++ b/drivers/net/ethernet/ti/cpts.c
@@ -247,8 +247,7 @@ static void cpts_clk_init(struct cpts *cpts)
247 cpts->refclk = NULL; 247 cpts->refclk = NULL;
248 return; 248 return;
249 } 249 }
250 clk_enable(cpts->refclk); 250 clk_prepare_enable(cpts->refclk);
251 cpts->freq = cpts->refclk->recalc(cpts->refclk);
252} 251}
253 252
254static void cpts_clk_release(struct cpts *cpts) 253static void cpts_clk_release(struct cpts *cpts)
diff --git a/drivers/net/ethernet/ti/cpts.h b/drivers/net/ethernet/ti/cpts.h
index e1bba3a496b2..fe993cdd7e23 100644
--- a/drivers/net/ethernet/ti/cpts.h
+++ b/drivers/net/ethernet/ti/cpts.h
@@ -120,7 +120,6 @@ struct cpts {
120 struct delayed_work overflow_work; 120 struct delayed_work overflow_work;
121 int phc_index; 121 int phc_index;
122 struct clk *refclk; 122 struct clk *refclk;
123 unsigned long freq;
124 struct list_head events; 123 struct list_head events;
125 struct list_head pool; 124 struct list_head pool;
126 struct cpts_event pool_data[CPTS_MAX_EVENTS]; 125 struct cpts_event pool_data[CPTS_MAX_EVENTS];
diff --git a/drivers/net/ethernet/xilinx/Kconfig b/drivers/net/ethernet/xilinx/Kconfig
index 5778a4ae1164..122d60c0481b 100644
--- a/drivers/net/ethernet/xilinx/Kconfig
+++ b/drivers/net/ethernet/xilinx/Kconfig
@@ -27,7 +27,7 @@ config XILINX_EMACLITE
27 27
28config XILINX_AXI_EMAC 28config XILINX_AXI_EMAC
29 tristate "Xilinx 10/100/1000 AXI Ethernet support" 29 tristate "Xilinx 10/100/1000 AXI Ethernet support"
30 depends on (PPC32 || MICROBLAZE) 30 depends on MICROBLAZE
31 select PHYLIB 31 select PHYLIB
32 ---help--- 32 ---help---
33 This driver supports the 10/100/1000 Ethernet from Xilinx for the 33 This driver supports the 10/100/1000 Ethernet from Xilinx for the
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index d9f69b82cc4f..6f47100e58d7 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -1590,7 +1590,7 @@ static int axienet_of_probe(struct platform_device *op)
1590 lp->rx_irq = irq_of_parse_and_map(np, 1); 1590 lp->rx_irq = irq_of_parse_and_map(np, 1);
1591 lp->tx_irq = irq_of_parse_and_map(np, 0); 1591 lp->tx_irq = irq_of_parse_and_map(np, 0);
1592 of_node_put(np); 1592 of_node_put(np);
1593 if ((lp->rx_irq == NO_IRQ) || (lp->tx_irq == NO_IRQ)) { 1593 if ((lp->rx_irq <= 0) || (lp->tx_irq <= 0)) {
1594 dev_err(&op->dev, "could not determine irqs\n"); 1594 dev_err(&op->dev, "could not determine irqs\n");
1595 ret = -ENOMEM; 1595 ret = -ENOMEM;
1596 goto err_iounmap_2; 1596 goto err_iounmap_2;
diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
index 5fd6f4674326..e6fe0d80d612 100644
--- a/drivers/net/hyperv/hyperv_net.h
+++ b/drivers/net/hyperv/hyperv_net.h
@@ -84,7 +84,7 @@ struct hv_netvsc_packet {
84}; 84};
85 85
86struct netvsc_device_info { 86struct netvsc_device_info {
87 unsigned char mac_adr[6]; 87 unsigned char mac_adr[ETH_ALEN];
88 bool link_state; /* 0 - link up, 1 - link down */ 88 bool link_state; /* 0 - link up, 1 - link down */
89 int ring_size; 89 int ring_size;
90}; 90};
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index f825a629a699..8264f0ef7692 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -349,7 +349,7 @@ static int netvsc_set_mac_addr(struct net_device *ndev, void *p)
349 struct net_device_context *ndevctx = netdev_priv(ndev); 349 struct net_device_context *ndevctx = netdev_priv(ndev);
350 struct hv_device *hdev = ndevctx->device_ctx; 350 struct hv_device *hdev = ndevctx->device_ctx;
351 struct sockaddr *addr = p; 351 struct sockaddr *addr = p;
352 char save_adr[14]; 352 char save_adr[ETH_ALEN];
353 unsigned char save_aatype; 353 unsigned char save_aatype;
354 int err; 354 int err;
355 355
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index 81f8f9e31db5..fcbf680c3e62 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -77,6 +77,11 @@ static netdev_tx_t loopback_xmit(struct sk_buff *skb,
77 77
78 skb_orphan(skb); 78 skb_orphan(skb);
79 79
80 /* Before queueing this packet to netif_rx(),
81 * make sure dst is refcounted.
82 */
83 skb_dst_force(skb);
84
80 skb->protocol = eth_type_trans(skb, dev); 85 skb->protocol = eth_type_trans(skb, dev);
81 86
82 /* it's OK to use per_cpu_ptr() because BHs are off */ 87 /* it's OK to use per_cpu_ptr() because BHs are off */
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 68a43fe602e7..d3fb97d97cbc 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -822,7 +822,10 @@ static int macvlan_changelink(struct net_device *dev,
822 822
823static size_t macvlan_get_size(const struct net_device *dev) 823static size_t macvlan_get_size(const struct net_device *dev)
824{ 824{
825 return nla_total_size(4); 825 return (0
826 + nla_total_size(4) /* IFLA_MACVLAN_MODE */
827 + nla_total_size(2) /* IFLA_MACVLAN_FLAGS */
828 );
826} 829}
827 830
828static int macvlan_fill_info(struct sk_buff *skb, 831static int macvlan_fill_info(struct sk_buff *skb,
diff --git a/drivers/net/phy/icplus.c b/drivers/net/phy/icplus.c
index d5199cb4caec..b5ddd5077a80 100644
--- a/drivers/net/phy/icplus.c
+++ b/drivers/net/phy/icplus.c
@@ -36,8 +36,9 @@ MODULE_LICENSE("GPL");
36 36
37/* IP101A/G - IP1001 */ 37/* IP101A/G - IP1001 */
38#define IP10XX_SPEC_CTRL_STATUS 16 /* Spec. Control Register */ 38#define IP10XX_SPEC_CTRL_STATUS 16 /* Spec. Control Register */
39#define IP1001_RXPHASE_SEL (1<<0) /* Add delay on RX_CLK */
40#define IP1001_TXPHASE_SEL (1<<1) /* Add delay on TX_CLK */
39#define IP1001_SPEC_CTRL_STATUS_2 20 /* IP1001 Spec. Control Reg 2 */ 41#define IP1001_SPEC_CTRL_STATUS_2 20 /* IP1001 Spec. Control Reg 2 */
40#define IP1001_PHASE_SEL_MASK 3 /* IP1001 RX/TXPHASE_SEL */
41#define IP1001_APS_ON 11 /* IP1001 APS Mode bit */ 42#define IP1001_APS_ON 11 /* IP1001 APS Mode bit */
42#define IP101A_G_APS_ON 2 /* IP101A/G APS Mode bit */ 43#define IP101A_G_APS_ON 2 /* IP101A/G APS Mode bit */
43#define IP101A_G_IRQ_CONF_STATUS 0x11 /* Conf Info IRQ & Status Reg */ 44#define IP101A_G_IRQ_CONF_STATUS 0x11 /* Conf Info IRQ & Status Reg */
@@ -138,19 +139,24 @@ static int ip1001_config_init(struct phy_device *phydev)
138 if (c < 0) 139 if (c < 0)
139 return c; 140 return c;
140 141
141 /* INTR pin used: speed/link/duplex will cause an interrupt */ 142 if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) ||
142 c = phy_write(phydev, IP101A_G_IRQ_CONF_STATUS, IP101A_G_IRQ_DEFAULT); 143 (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) ||
143 if (c < 0) 144 (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) ||
144 return c; 145 (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)) {
145 146
146 if (phydev->interface == PHY_INTERFACE_MODE_RGMII) {
147 /* Additional delay (2ns) used to adjust RX clock phase
148 * at RGMII interface */
149 c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS); 147 c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS);
150 if (c < 0) 148 if (c < 0)
151 return c; 149 return c;
152 150
153 c |= IP1001_PHASE_SEL_MASK; 151 c &= ~(IP1001_RXPHASE_SEL | IP1001_TXPHASE_SEL);
152
153 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
154 c |= (IP1001_RXPHASE_SEL | IP1001_TXPHASE_SEL);
155 else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID)
156 c |= IP1001_RXPHASE_SEL;
157 else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)
158 c |= IP1001_TXPHASE_SEL;
159
154 c = phy_write(phydev, IP10XX_SPEC_CTRL_STATUS, c); 160 c = phy_write(phydev, IP10XX_SPEC_CTRL_STATUS, c);
155 if (c < 0) 161 if (c < 0)
156 return c; 162 return c;
@@ -167,6 +173,11 @@ static int ip101a_g_config_init(struct phy_device *phydev)
167 if (c < 0) 173 if (c < 0)
168 return c; 174 return c;
169 175
176 /* INTR pin used: speed/link/duplex will cause an interrupt */
177 c = phy_write(phydev, IP101A_G_IRQ_CONF_STATUS, IP101A_G_IRQ_DEFAULT);
178 if (c < 0)
179 return c;
180
170 /* Enable Auto Power Saving mode */ 181 /* Enable Auto Power Saving mode */
171 c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS); 182 c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS);
172 c |= IP101A_G_APS_ON; 183 c |= IP101A_G_APS_ON;
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 5d2a3f215887..22dec9c7ef05 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -353,15 +353,6 @@ static int m88e1111_config_init(struct phy_device *phydev)
353 int err; 353 int err;
354 int temp; 354 int temp;
355 355
356 /* Enable Fiber/Copper auto selection */
357 temp = phy_read(phydev, MII_M1111_PHY_EXT_SR);
358 temp &= ~MII_M1111_HWCFG_FIBER_COPPER_AUTO;
359 phy_write(phydev, MII_M1111_PHY_EXT_SR, temp);
360
361 temp = phy_read(phydev, MII_BMCR);
362 temp |= BMCR_RESET;
363 phy_write(phydev, MII_BMCR, temp);
364
365 if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) || 356 if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) ||
366 (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) || 357 (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) ||
367 (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) || 358 (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) ||
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 504f7f1cad94..cc09b67c23bc 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -109,11 +109,11 @@ struct tap_filter {
109 unsigned char addr[FLT_EXACT_COUNT][ETH_ALEN]; 109 unsigned char addr[FLT_EXACT_COUNT][ETH_ALEN];
110}; 110};
111 111
112/* 1024 is probably a high enough limit: modern hypervisors seem to support on 112/* DEFAULT_MAX_NUM_RSS_QUEUES were choosed to let the rx/tx queues allocated for
113 * the order of 100-200 CPUs so this leaves us some breathing space if we want 113 * the netdevice to be fit in one page. So we can make sure the success of
114 * to match a queue per guest CPU. 114 * memory allocation. TODO: increase the limit. */
115 */ 115#define MAX_TAP_QUEUES DEFAULT_MAX_NUM_RSS_QUEUES
116#define MAX_TAP_QUEUES 1024 116#define MAX_TAP_FLOWS 4096
117 117
118#define TUN_FLOW_EXPIRE (3 * HZ) 118#define TUN_FLOW_EXPIRE (3 * HZ)
119 119
@@ -180,12 +180,13 @@ struct tun_struct {
180 int debug; 180 int debug;
181#endif 181#endif
182 spinlock_t lock; 182 spinlock_t lock;
183 struct kmem_cache *flow_cache;
184 struct hlist_head flows[TUN_NUM_FLOW_ENTRIES]; 183 struct hlist_head flows[TUN_NUM_FLOW_ENTRIES];
185 struct timer_list flow_gc_timer; 184 struct timer_list flow_gc_timer;
186 unsigned long ageing_time; 185 unsigned long ageing_time;
187 unsigned int numdisabled; 186 unsigned int numdisabled;
188 struct list_head disabled; 187 struct list_head disabled;
188 void *security;
189 u32 flow_count;
189}; 190};
190 191
191static inline u32 tun_hashfn(u32 rxhash) 192static inline u32 tun_hashfn(u32 rxhash)
@@ -209,8 +210,8 @@ static struct tun_flow_entry *tun_flow_create(struct tun_struct *tun,
209 struct hlist_head *head, 210 struct hlist_head *head,
210 u32 rxhash, u16 queue_index) 211 u32 rxhash, u16 queue_index)
211{ 212{
212 struct tun_flow_entry *e = kmem_cache_alloc(tun->flow_cache, 213 struct tun_flow_entry *e = kmalloc(sizeof(*e), GFP_ATOMIC);
213 GFP_ATOMIC); 214
214 if (e) { 215 if (e) {
215 tun_debug(KERN_INFO, tun, "create flow: hash %u index %u\n", 216 tun_debug(KERN_INFO, tun, "create flow: hash %u index %u\n",
216 rxhash, queue_index); 217 rxhash, queue_index);
@@ -219,23 +220,18 @@ static struct tun_flow_entry *tun_flow_create(struct tun_struct *tun,
219 e->queue_index = queue_index; 220 e->queue_index = queue_index;
220 e->tun = tun; 221 e->tun = tun;
221 hlist_add_head_rcu(&e->hash_link, head); 222 hlist_add_head_rcu(&e->hash_link, head);
223 ++tun->flow_count;
222 } 224 }
223 return e; 225 return e;
224} 226}
225 227
226static void tun_flow_free(struct rcu_head *head)
227{
228 struct tun_flow_entry *e
229 = container_of(head, struct tun_flow_entry, rcu);
230 kmem_cache_free(e->tun->flow_cache, e);
231}
232
233static void tun_flow_delete(struct tun_struct *tun, struct tun_flow_entry *e) 228static void tun_flow_delete(struct tun_struct *tun, struct tun_flow_entry *e)
234{ 229{
235 tun_debug(KERN_INFO, tun, "delete flow: hash %u index %u\n", 230 tun_debug(KERN_INFO, tun, "delete flow: hash %u index %u\n",
236 e->rxhash, e->queue_index); 231 e->rxhash, e->queue_index);
237 hlist_del_rcu(&e->hash_link); 232 hlist_del_rcu(&e->hash_link);
238 call_rcu(&e->rcu, tun_flow_free); 233 kfree_rcu(e, rcu);
234 --tun->flow_count;
239} 235}
240 236
241static void tun_flow_flush(struct tun_struct *tun) 237static void tun_flow_flush(struct tun_struct *tun)
@@ -325,7 +321,8 @@ static void tun_flow_update(struct tun_struct *tun, u32 rxhash,
325 e->updated = jiffies; 321 e->updated = jiffies;
326 } else { 322 } else {
327 spin_lock_bh(&tun->lock); 323 spin_lock_bh(&tun->lock);
328 if (!tun_flow_find(head, rxhash)) 324 if (!tun_flow_find(head, rxhash) &&
325 tun->flow_count < MAX_TAP_FLOWS)
329 tun_flow_create(tun, head, rxhash, queue_index); 326 tun_flow_create(tun, head, rxhash, queue_index);
330 327
331 if (!timer_pending(&tun->flow_gc_timer)) 328 if (!timer_pending(&tun->flow_gc_timer))
@@ -412,8 +409,8 @@ static void __tun_detach(struct tun_file *tfile, bool clean)
412 struct tun_struct *tun; 409 struct tun_struct *tun;
413 struct net_device *dev; 410 struct net_device *dev;
414 411
415 tun = rcu_dereference_protected(tfile->tun, 412 tun = rtnl_dereference(tfile->tun);
416 lockdep_rtnl_is_held()); 413
417 if (tun) { 414 if (tun) {
418 u16 index = tfile->queue_index; 415 u16 index = tfile->queue_index;
419 BUG_ON(index >= tun->numqueues); 416 BUG_ON(index >= tun->numqueues);
@@ -422,8 +419,7 @@ static void __tun_detach(struct tun_file *tfile, bool clean)
422 rcu_assign_pointer(tun->tfiles[index], 419 rcu_assign_pointer(tun->tfiles[index],
423 tun->tfiles[tun->numqueues - 1]); 420 tun->tfiles[tun->numqueues - 1]);
424 rcu_assign_pointer(tfile->tun, NULL); 421 rcu_assign_pointer(tfile->tun, NULL);
425 ntfile = rcu_dereference_protected(tun->tfiles[index], 422 ntfile = rtnl_dereference(tun->tfiles[index]);
426 lockdep_rtnl_is_held());
427 ntfile->queue_index = index; 423 ntfile->queue_index = index;
428 424
429 --tun->numqueues; 425 --tun->numqueues;
@@ -437,8 +433,10 @@ static void __tun_detach(struct tun_file *tfile, bool clean)
437 /* Drop read queue */ 433 /* Drop read queue */
438 skb_queue_purge(&tfile->sk.sk_receive_queue); 434 skb_queue_purge(&tfile->sk.sk_receive_queue);
439 tun_set_real_num_queues(tun); 435 tun_set_real_num_queues(tun);
440 } else if (tfile->detached && clean) 436 } else if (tfile->detached && clean) {
441 tun = tun_enable_queue(tfile); 437 tun = tun_enable_queue(tfile);
438 sock_put(&tfile->sk);
439 }
442 440
443 if (clean) { 441 if (clean) {
444 if (tun && tun->numqueues == 0 && tun->numdisabled == 0 && 442 if (tun && tun->numqueues == 0 && tun->numdisabled == 0 &&
@@ -466,8 +464,7 @@ static void tun_detach_all(struct net_device *dev)
466 int i, n = tun->numqueues; 464 int i, n = tun->numqueues;
467 465
468 for (i = 0; i < n; i++) { 466 for (i = 0; i < n; i++) {
469 tfile = rcu_dereference_protected(tun->tfiles[i], 467 tfile = rtnl_dereference(tun->tfiles[i]);
470 lockdep_rtnl_is_held());
471 BUG_ON(!tfile); 468 BUG_ON(!tfile);
472 wake_up_all(&tfile->wq.wait); 469 wake_up_all(&tfile->wq.wait);
473 rcu_assign_pointer(tfile->tun, NULL); 470 rcu_assign_pointer(tfile->tun, NULL);
@@ -477,8 +474,7 @@ static void tun_detach_all(struct net_device *dev)
477 474
478 synchronize_net(); 475 synchronize_net();
479 for (i = 0; i < n; i++) { 476 for (i = 0; i < n; i++) {
480 tfile = rcu_dereference_protected(tun->tfiles[i], 477 tfile = rtnl_dereference(tun->tfiles[i]);
481 lockdep_rtnl_is_held());
482 /* Drop read queue */ 478 /* Drop read queue */
483 skb_queue_purge(&tfile->sk.sk_receive_queue); 479 skb_queue_purge(&tfile->sk.sk_receive_queue);
484 sock_put(&tfile->sk); 480 sock_put(&tfile->sk);
@@ -489,6 +485,9 @@ static void tun_detach_all(struct net_device *dev)
489 sock_put(&tfile->sk); 485 sock_put(&tfile->sk);
490 } 486 }
491 BUG_ON(tun->numdisabled != 0); 487 BUG_ON(tun->numdisabled != 0);
488
489 if (tun->flags & TUN_PERSIST)
490 module_put(THIS_MODULE);
492} 491}
493 492
494static int tun_attach(struct tun_struct *tun, struct file *file) 493static int tun_attach(struct tun_struct *tun, struct file *file)
@@ -496,8 +495,12 @@ static int tun_attach(struct tun_struct *tun, struct file *file)
496 struct tun_file *tfile = file->private_data; 495 struct tun_file *tfile = file->private_data;
497 int err; 496 int err;
498 497
498 err = security_tun_dev_attach(tfile->socket.sk, tun->security);
499 if (err < 0)
500 goto out;
501
499 err = -EINVAL; 502 err = -EINVAL;
500 if (rcu_dereference_protected(tfile->tun, lockdep_rtnl_is_held())) 503 if (rtnl_dereference(tfile->tun))
501 goto out; 504 goto out;
502 505
503 err = -EBUSY; 506 err = -EBUSY;
@@ -833,12 +836,6 @@ static int tun_flow_init(struct tun_struct *tun)
833{ 836{
834 int i; 837 int i;
835 838
836 tun->flow_cache = kmem_cache_create("tun_flow_cache",
837 sizeof(struct tun_flow_entry), 0, 0,
838 NULL);
839 if (!tun->flow_cache)
840 return -ENOMEM;
841
842 for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++) 839 for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++)
843 INIT_HLIST_HEAD(&tun->flows[i]); 840 INIT_HLIST_HEAD(&tun->flows[i]);
844 841
@@ -854,10 +851,6 @@ static void tun_flow_uninit(struct tun_struct *tun)
854{ 851{
855 del_timer_sync(&tun->flow_gc_timer); 852 del_timer_sync(&tun->flow_gc_timer);
856 tun_flow_flush(tun); 853 tun_flow_flush(tun);
857
858 /* Wait for completion of call_rcu()'s */
859 rcu_barrier();
860 kmem_cache_destroy(tun->flow_cache);
861} 854}
862 855
863/* Initialize net device. */ 856/* Initialize net device. */
@@ -1389,6 +1382,7 @@ static void tun_free_netdev(struct net_device *dev)
1389 1382
1390 BUG_ON(!(list_empty(&tun->disabled))); 1383 BUG_ON(!(list_empty(&tun->disabled)));
1391 tun_flow_uninit(tun); 1384 tun_flow_uninit(tun);
1385 security_tun_dev_free_security(tun->security);
1392 free_netdev(dev); 1386 free_netdev(dev);
1393} 1387}
1394 1388
@@ -1562,6 +1556,9 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
1562 struct net_device *dev; 1556 struct net_device *dev;
1563 int err; 1557 int err;
1564 1558
1559 if (tfile->detached)
1560 return -EINVAL;
1561
1565 dev = __dev_get_by_name(net, ifr->ifr_name); 1562 dev = __dev_get_by_name(net, ifr->ifr_name);
1566 if (dev) { 1563 if (dev) {
1567 if (ifr->ifr_flags & IFF_TUN_EXCL) 1564 if (ifr->ifr_flags & IFF_TUN_EXCL)
@@ -1575,7 +1572,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
1575 1572
1576 if (tun_not_capable(tun)) 1573 if (tun_not_capable(tun))
1577 return -EPERM; 1574 return -EPERM;
1578 err = security_tun_dev_attach(tfile->socket.sk); 1575 err = security_tun_dev_open(tun->security);
1579 if (err < 0) 1576 if (err < 0)
1580 return err; 1577 return err;
1581 1578
@@ -1590,6 +1587,8 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
1590 else { 1587 else {
1591 char *name; 1588 char *name;
1592 unsigned long flags = 0; 1589 unsigned long flags = 0;
1590 int queues = ifr->ifr_flags & IFF_MULTI_QUEUE ?
1591 MAX_TAP_QUEUES : 1;
1593 1592
1594 if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) 1593 if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
1595 return -EPERM; 1594 return -EPERM;
@@ -1613,8 +1612,8 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
1613 name = ifr->ifr_name; 1612 name = ifr->ifr_name;
1614 1613
1615 dev = alloc_netdev_mqs(sizeof(struct tun_struct), name, 1614 dev = alloc_netdev_mqs(sizeof(struct tun_struct), name,
1616 tun_setup, 1615 tun_setup, queues, queues);
1617 MAX_TAP_QUEUES, MAX_TAP_QUEUES); 1616
1618 if (!dev) 1617 if (!dev)
1619 return -ENOMEM; 1618 return -ENOMEM;
1620 1619
@@ -1632,7 +1631,9 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
1632 1631
1633 spin_lock_init(&tun->lock); 1632 spin_lock_init(&tun->lock);
1634 1633
1635 security_tun_dev_post_create(&tfile->sk); 1634 err = security_tun_dev_alloc_security(&tun->security);
1635 if (err < 0)
1636 goto err_free_dev;
1636 1637
1637 tun_net_init(dev); 1638 tun_net_init(dev);
1638 1639
@@ -1756,8 +1757,7 @@ static void tun_detach_filter(struct tun_struct *tun, int n)
1756 struct tun_file *tfile; 1757 struct tun_file *tfile;
1757 1758
1758 for (i = 0; i < n; i++) { 1759 for (i = 0; i < n; i++) {
1759 tfile = rcu_dereference_protected(tun->tfiles[i], 1760 tfile = rtnl_dereference(tun->tfiles[i]);
1760 lockdep_rtnl_is_held());
1761 sk_detach_filter(tfile->socket.sk); 1761 sk_detach_filter(tfile->socket.sk);
1762 } 1762 }
1763 1763
@@ -1770,8 +1770,7 @@ static int tun_attach_filter(struct tun_struct *tun)
1770 struct tun_file *tfile; 1770 struct tun_file *tfile;
1771 1771
1772 for (i = 0; i < tun->numqueues; i++) { 1772 for (i = 0; i < tun->numqueues; i++) {
1773 tfile = rcu_dereference_protected(tun->tfiles[i], 1773 tfile = rtnl_dereference(tun->tfiles[i]);
1774 lockdep_rtnl_is_held());
1775 ret = sk_attach_filter(&tun->fprog, tfile->socket.sk); 1774 ret = sk_attach_filter(&tun->fprog, tfile->socket.sk);
1776 if (ret) { 1775 if (ret) {
1777 tun_detach_filter(tun, i); 1776 tun_detach_filter(tun, i);
@@ -1789,8 +1788,7 @@ static void tun_set_sndbuf(struct tun_struct *tun)
1789 int i; 1788 int i;
1790 1789
1791 for (i = 0; i < tun->numqueues; i++) { 1790 for (i = 0; i < tun->numqueues; i++) {
1792 tfile = rcu_dereference_protected(tun->tfiles[i], 1791 tfile = rtnl_dereference(tun->tfiles[i]);
1793 lockdep_rtnl_is_held());
1794 tfile->socket.sk->sk_sndbuf = tun->sndbuf; 1792 tfile->socket.sk->sk_sndbuf = tun->sndbuf;
1795 } 1793 }
1796} 1794}
@@ -1805,15 +1803,16 @@ static int tun_set_queue(struct file *file, struct ifreq *ifr)
1805 1803
1806 if (ifr->ifr_flags & IFF_ATTACH_QUEUE) { 1804 if (ifr->ifr_flags & IFF_ATTACH_QUEUE) {
1807 tun = tfile->detached; 1805 tun = tfile->detached;
1808 if (!tun) 1806 if (!tun) {
1809 ret = -EINVAL; 1807 ret = -EINVAL;
1810 else if (tun_not_capable(tun)) 1808 goto unlock;
1811 ret = -EPERM; 1809 }
1812 else 1810 ret = security_tun_dev_attach_queue(tun->security);
1813 ret = tun_attach(tun, file); 1811 if (ret < 0)
1812 goto unlock;
1813 ret = tun_attach(tun, file);
1814 } else if (ifr->ifr_flags & IFF_DETACH_QUEUE) { 1814 } else if (ifr->ifr_flags & IFF_DETACH_QUEUE) {
1815 tun = rcu_dereference_protected(tfile->tun, 1815 tun = rtnl_dereference(tfile->tun);
1816 lockdep_rtnl_is_held());
1817 if (!tun || !(tun->flags & TUN_TAP_MQ)) 1816 if (!tun || !(tun->flags & TUN_TAP_MQ))
1818 ret = -EINVAL; 1817 ret = -EINVAL;
1819 else 1818 else
@@ -1821,6 +1820,7 @@ static int tun_set_queue(struct file *file, struct ifreq *ifr)
1821 } else 1820 } else
1822 ret = -EINVAL; 1821 ret = -EINVAL;
1823 1822
1823unlock:
1824 rtnl_unlock(); 1824 rtnl_unlock();
1825 return ret; 1825 return ret;
1826} 1826}
@@ -1898,10 +1898,11 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
1898 /* Disable/Enable persist mode. Keep an extra reference to the 1898 /* Disable/Enable persist mode. Keep an extra reference to the
1899 * module to prevent the module being unprobed. 1899 * module to prevent the module being unprobed.
1900 */ 1900 */
1901 if (arg) { 1901 if (arg && !(tun->flags & TUN_PERSIST)) {
1902 tun->flags |= TUN_PERSIST; 1902 tun->flags |= TUN_PERSIST;
1903 __module_get(THIS_MODULE); 1903 __module_get(THIS_MODULE);
1904 } else { 1904 }
1905 if (!arg && (tun->flags & TUN_PERSIST)) {
1905 tun->flags &= ~TUN_PERSIST; 1906 tun->flags &= ~TUN_PERSIST;
1906 module_put(THIS_MODULE); 1907 module_put(THIS_MODULE);
1907 } 1908 }
diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c
index 42f51c71ec1f..248d2dc765a5 100644
--- a/drivers/net/usb/cdc_mbim.c
+++ b/drivers/net/usb/cdc_mbim.c
@@ -374,6 +374,21 @@ static const struct driver_info cdc_mbim_info = {
374 .tx_fixup = cdc_mbim_tx_fixup, 374 .tx_fixup = cdc_mbim_tx_fixup,
375}; 375};
376 376
377/* MBIM and NCM devices should not need a ZLP after NTBs with
378 * dwNtbOutMaxSize length. This driver_info is for the exceptional
379 * devices requiring it anyway, allowing them to be supported without
380 * forcing the performance penalty on all the sane devices.
381 */
382static const struct driver_info cdc_mbim_info_zlp = {
383 .description = "CDC MBIM",
384 .flags = FLAG_NO_SETINT | FLAG_MULTI_PACKET | FLAG_WWAN | FLAG_SEND_ZLP,
385 .bind = cdc_mbim_bind,
386 .unbind = cdc_mbim_unbind,
387 .manage_power = cdc_mbim_manage_power,
388 .rx_fixup = cdc_mbim_rx_fixup,
389 .tx_fixup = cdc_mbim_tx_fixup,
390};
391
377static const struct usb_device_id mbim_devs[] = { 392static const struct usb_device_id mbim_devs[] = {
378 /* This duplicate NCM entry is intentional. MBIM devices can 393 /* This duplicate NCM entry is intentional. MBIM devices can
379 * be disguised as NCM by default, and this is necessary to 394 * be disguised as NCM by default, and this is necessary to
@@ -385,6 +400,10 @@ static const struct usb_device_id mbim_devs[] = {
385 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE), 400 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE),
386 .driver_info = (unsigned long)&cdc_mbim_info, 401 .driver_info = (unsigned long)&cdc_mbim_info,
387 }, 402 },
403 /* Sierra Wireless MC7710 need ZLPs */
404 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x68a2, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE),
405 .driver_info = (unsigned long)&cdc_mbim_info_zlp,
406 },
388 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE), 407 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE),
389 .driver_info = (unsigned long)&cdc_mbim_info, 408 .driver_info = (unsigned long)&cdc_mbim_info,
390 }, 409 },
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 71b6e92b8e9b..9197b2c72ca3 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -435,6 +435,13 @@ advance:
435 len -= temp; 435 len -= temp;
436 } 436 }
437 437
438 /* some buggy devices have an IAD but no CDC Union */
439 if (!ctx->union_desc && intf->intf_assoc && intf->intf_assoc->bInterfaceCount == 2) {
440 ctx->control = intf;
441 ctx->data = usb_ifnum_to_if(dev->udev, intf->cur_altsetting->desc.bInterfaceNumber + 1);
442 dev_dbg(&intf->dev, "CDC Union missing - got slave from IAD\n");
443 }
444
438 /* check if we got everything */ 445 /* check if we got everything */
439 if ((ctx->control == NULL) || (ctx->data == NULL) || 446 if ((ctx->control == NULL) || (ctx->data == NULL) ||
440 ((!ctx->mbim_desc) && ((ctx->ether_desc == NULL) || (ctx->control != intf)))) 447 ((!ctx->mbim_desc) && ((ctx->ether_desc == NULL) || (ctx->control != intf))))
@@ -497,7 +504,8 @@ advance:
497error2: 504error2:
498 usb_set_intfdata(ctx->control, NULL); 505 usb_set_intfdata(ctx->control, NULL);
499 usb_set_intfdata(ctx->data, NULL); 506 usb_set_intfdata(ctx->data, NULL);
500 usb_driver_release_interface(driver, ctx->data); 507 if (ctx->data != ctx->control)
508 usb_driver_release_interface(driver, ctx->data);
501error: 509error:
502 cdc_ncm_free((struct cdc_ncm_ctx *)dev->data[0]); 510 cdc_ncm_free((struct cdc_ncm_ctx *)dev->data[0]);
503 dev->data[0] = 0; 511 dev->data[0] = 0;
@@ -1155,6 +1163,20 @@ static const struct driver_info wwan_info = {
1155 .tx_fixup = cdc_ncm_tx_fixup, 1163 .tx_fixup = cdc_ncm_tx_fixup,
1156}; 1164};
1157 1165
1166/* Same as wwan_info, but with FLAG_NOARP */
1167static const struct driver_info wwan_noarp_info = {
1168 .description = "Mobile Broadband Network Device (NO ARP)",
1169 .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET
1170 | FLAG_WWAN | FLAG_NOARP,
1171 .bind = cdc_ncm_bind,
1172 .unbind = cdc_ncm_unbind,
1173 .check_connect = cdc_ncm_check_connect,
1174 .manage_power = usbnet_manage_power,
1175 .status = cdc_ncm_status,
1176 .rx_fixup = cdc_ncm_rx_fixup,
1177 .tx_fixup = cdc_ncm_tx_fixup,
1178};
1179
1158static const struct usb_device_id cdc_devs[] = { 1180static const struct usb_device_id cdc_devs[] = {
1159 /* Ericsson MBM devices like F5521gw */ 1181 /* Ericsson MBM devices like F5521gw */
1160 { .match_flags = USB_DEVICE_ID_MATCH_INT_INFO 1182 { .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
@@ -1194,6 +1216,13 @@ static const struct usb_device_id cdc_devs[] = {
1194 .driver_info = (unsigned long)&wwan_info, 1216 .driver_info = (unsigned long)&wwan_info,
1195 }, 1217 },
1196 1218
1219 /* Infineon(now Intel) HSPA Modem platform */
1220 { USB_DEVICE_AND_INTERFACE_INFO(0x1519, 0x0443,
1221 USB_CLASS_COMM,
1222 USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE),
1223 .driver_info = (unsigned long)&wwan_noarp_info,
1224 },
1225
1197 /* Generic CDC-NCM devices */ 1226 /* Generic CDC-NCM devices */
1198 { USB_INTERFACE_INFO(USB_CLASS_COMM, 1227 { USB_INTERFACE_INFO(USB_CLASS_COMM,
1199 USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE), 1228 USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE),
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c
index 3f554c1149f3..d7e99445518e 100644
--- a/drivers/net/usb/dm9601.c
+++ b/drivers/net/usb/dm9601.c
@@ -45,6 +45,12 @@
45#define DM_MCAST_ADDR 0x16 /* 8 bytes */ 45#define DM_MCAST_ADDR 0x16 /* 8 bytes */
46#define DM_GPR_CTRL 0x1e 46#define DM_GPR_CTRL 0x1e
47#define DM_GPR_DATA 0x1f 47#define DM_GPR_DATA 0x1f
48#define DM_CHIP_ID 0x2c
49#define DM_MODE_CTRL 0x91 /* only on dm9620 */
50
51/* chip id values */
52#define ID_DM9601 0
53#define ID_DM9620 1
48 54
49#define DM_MAX_MCAST 64 55#define DM_MAX_MCAST 64
50#define DM_MCAST_SIZE 8 56#define DM_MCAST_SIZE 8
@@ -53,7 +59,6 @@
53#define DM_RX_OVERHEAD 7 /* 3 byte header + 4 byte crc tail */ 59#define DM_RX_OVERHEAD 7 /* 3 byte header + 4 byte crc tail */
54#define DM_TIMEOUT 1000 60#define DM_TIMEOUT 1000
55 61
56
57static int dm_read(struct usbnet *dev, u8 reg, u16 length, void *data) 62static int dm_read(struct usbnet *dev, u8 reg, u16 length, void *data)
58{ 63{
59 int err; 64 int err;
@@ -84,32 +89,23 @@ static int dm_write(struct usbnet *dev, u8 reg, u16 length, void *data)
84 89
85static int dm_write_reg(struct usbnet *dev, u8 reg, u8 value) 90static int dm_write_reg(struct usbnet *dev, u8 reg, u8 value)
86{ 91{
87 return usbnet_write_cmd(dev, DM_WRITE_REGS, 92 return usbnet_write_cmd(dev, DM_WRITE_REG,
88 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 93 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
89 value, reg, NULL, 0); 94 value, reg, NULL, 0);
90} 95}
91 96
92static void dm_write_async_helper(struct usbnet *dev, u8 reg, u8 value, 97static void dm_write_async(struct usbnet *dev, u8 reg, u16 length, void *data)
93 u16 length, void *data)
94{ 98{
95 usbnet_write_cmd_async(dev, DM_WRITE_REGS, 99 usbnet_write_cmd_async(dev, DM_WRITE_REGS,
96 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 100 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
97 value, reg, data, length); 101 0, reg, data, length);
98}
99
100static void dm_write_async(struct usbnet *dev, u8 reg, u16 length, void *data)
101{
102 netdev_dbg(dev->net, "dm_write_async() reg=0x%02x length=%d\n", reg, length);
103
104 dm_write_async_helper(dev, reg, 0, length, data);
105} 102}
106 103
107static void dm_write_reg_async(struct usbnet *dev, u8 reg, u8 value) 104static void dm_write_reg_async(struct usbnet *dev, u8 reg, u8 value)
108{ 105{
109 netdev_dbg(dev->net, "dm_write_reg_async() reg=0x%02x value=0x%02x\n", 106 usbnet_write_cmd_async(dev, DM_WRITE_REG,
110 reg, value); 107 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
111 108 value, reg, NULL, 0);
112 dm_write_async_helper(dev, reg, value, 0, NULL);
113} 109}
114 110
115static int dm_read_shared_word(struct usbnet *dev, int phy, u8 reg, __le16 *value) 111static int dm_read_shared_word(struct usbnet *dev, int phy, u8 reg, __le16 *value)
@@ -358,7 +354,7 @@ static const struct net_device_ops dm9601_netdev_ops = {
358static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf) 354static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf)
359{ 355{
360 int ret; 356 int ret;
361 u8 mac[ETH_ALEN]; 357 u8 mac[ETH_ALEN], id;
362 358
363 ret = usbnet_get_endpoints(dev, intf); 359 ret = usbnet_get_endpoints(dev, intf);
364 if (ret) 360 if (ret)
@@ -399,6 +395,24 @@ static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf)
399 __dm9601_set_mac_address(dev); 395 __dm9601_set_mac_address(dev);
400 } 396 }
401 397
398 if (dm_read_reg(dev, DM_CHIP_ID, &id) < 0) {
399 netdev_err(dev->net, "Error reading chip ID\n");
400 ret = -ENODEV;
401 goto out;
402 }
403
404 /* put dm9620 devices in dm9601 mode */
405 if (id == ID_DM9620) {
406 u8 mode;
407
408 if (dm_read_reg(dev, DM_MODE_CTRL, &mode) < 0) {
409 netdev_err(dev->net, "Error reading MODE_CTRL\n");
410 ret = -ENODEV;
411 goto out;
412 }
413 dm_write_reg(dev, DM_MODE_CTRL, mode & 0x7f);
414 }
415
402 /* power up phy */ 416 /* power up phy */
403 dm_write_reg(dev, DM_GPR_CTRL, 1); 417 dm_write_reg(dev, DM_GPR_CTRL, 1);
404 dm_write_reg(dev, DM_GPR_DATA, 0); 418 dm_write_reg(dev, DM_GPR_DATA, 0);
@@ -581,6 +595,10 @@ static const struct usb_device_id products[] = {
581 USB_DEVICE(0x0a46, 0x9000), /* DM9000E */ 595 USB_DEVICE(0x0a46, 0x9000), /* DM9000E */
582 .driver_info = (unsigned long)&dm9601_info, 596 .driver_info = (unsigned long)&dm9601_info,
583 }, 597 },
598 {
599 USB_DEVICE(0x0a46, 0x9620), /* DM9620 USB to Fast Ethernet Adapter */
600 .driver_info = (unsigned long)&dm9601_info,
601 },
584 {}, // END 602 {}, // END
585}; 603};
586 604
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 91d7cb9728eb..575a5839ee34 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -433,6 +433,7 @@ static const struct usb_device_id products[] = {
433 {QMI_FIXED_INTF(0x19d2, 0x0199, 1)}, /* ZTE MF820S */ 433 {QMI_FIXED_INTF(0x19d2, 0x0199, 1)}, /* ZTE MF820S */
434 {QMI_FIXED_INTF(0x19d2, 0x0200, 1)}, 434 {QMI_FIXED_INTF(0x19d2, 0x0200, 1)},
435 {QMI_FIXED_INTF(0x19d2, 0x0257, 3)}, /* ZTE MF821 */ 435 {QMI_FIXED_INTF(0x19d2, 0x0257, 3)}, /* ZTE MF821 */
436 {QMI_FIXED_INTF(0x19d2, 0x0265, 4)}, /* ONDA MT8205 4G LTE */
436 {QMI_FIXED_INTF(0x19d2, 0x0284, 4)}, /* ZTE MF880 */ 437 {QMI_FIXED_INTF(0x19d2, 0x0284, 4)}, /* ZTE MF880 */
437 {QMI_FIXED_INTF(0x19d2, 0x0326, 4)}, /* ZTE MF821D */ 438 {QMI_FIXED_INTF(0x19d2, 0x0326, 4)}, /* ZTE MF821D */
438 {QMI_FIXED_INTF(0x19d2, 0x1008, 4)}, /* ZTE (Vodafone) K3570-Z */ 439 {QMI_FIXED_INTF(0x19d2, 0x1008, 4)}, /* ZTE (Vodafone) K3570-Z */
@@ -458,6 +459,8 @@ static const struct usb_device_id products[] = {
458 {QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */ 459 {QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */
459 {QMI_FIXED_INTF(0x1199, 0x68a2, 19)}, /* Sierra Wireless MC7710 in QMI mode */ 460 {QMI_FIXED_INTF(0x1199, 0x68a2, 19)}, /* Sierra Wireless MC7710 in QMI mode */
460 {QMI_FIXED_INTF(0x1199, 0x901c, 8)}, /* Sierra Wireless EM7700 */ 461 {QMI_FIXED_INTF(0x1199, 0x901c, 8)}, /* Sierra Wireless EM7700 */
462 {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */
463 {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */
461 464
462 /* 4. Gobi 1000 devices */ 465 /* 4. Gobi 1000 devices */
463 {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ 466 {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 3d4bf01641b4..f34b2ebee815 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1448,6 +1448,10 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
1448 if ((dev->driver_info->flags & FLAG_WWAN) != 0) 1448 if ((dev->driver_info->flags & FLAG_WWAN) != 0)
1449 strcpy(net->name, "wwan%d"); 1449 strcpy(net->name, "wwan%d");
1450 1450
1451 /* devices that cannot do ARP */
1452 if ((dev->driver_info->flags & FLAG_NOARP) != 0)
1453 net->flags |= IFF_NOARP;
1454
1451 /* maybe the remote can't receive an Ethernet MTU */ 1455 /* maybe the remote can't receive an Ethernet MTU */
1452 if (net->mtu > (dev->hard_mtu - net->hard_header_len)) 1456 if (net->mtu > (dev->hard_mtu - net->hard_header_len))
1453 net->mtu = dev->hard_mtu - net->hard_header_len; 1457 net->mtu = dev->hard_mtu - net->hard_header_len;
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index a6fcf15adc4f..35c00c5ea02a 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -26,6 +26,7 @@
26#include <linux/scatterlist.h> 26#include <linux/scatterlist.h>
27#include <linux/if_vlan.h> 27#include <linux/if_vlan.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/cpu.h>
29 30
30static int napi_weight = 128; 31static int napi_weight = 128;
31module_param(napi_weight, int, 0444); 32module_param(napi_weight, int, 0444);
@@ -123,6 +124,12 @@ struct virtnet_info {
123 124
124 /* Does the affinity hint is set for virtqueues? */ 125 /* Does the affinity hint is set for virtqueues? */
125 bool affinity_hint_set; 126 bool affinity_hint_set;
127
128 /* Per-cpu variable to show the mapping from CPU to virtqueue */
129 int __percpu *vq_index;
130
131 /* CPU hot plug notifier */
132 struct notifier_block nb;
126}; 133};
127 134
128struct skb_vnet_hdr { 135struct skb_vnet_hdr {
@@ -1013,32 +1020,75 @@ static int virtnet_vlan_rx_kill_vid(struct net_device *dev, u16 vid)
1013 return 0; 1020 return 0;
1014} 1021}
1015 1022
1016static void virtnet_set_affinity(struct virtnet_info *vi, bool set) 1023static void virtnet_clean_affinity(struct virtnet_info *vi, long hcpu)
1017{ 1024{
1018 int i; 1025 int i;
1026 int cpu;
1027
1028 if (vi->affinity_hint_set) {
1029 for (i = 0; i < vi->max_queue_pairs; i++) {
1030 virtqueue_set_affinity(vi->rq[i].vq, -1);
1031 virtqueue_set_affinity(vi->sq[i].vq, -1);
1032 }
1033
1034 vi->affinity_hint_set = false;
1035 }
1036
1037 i = 0;
1038 for_each_online_cpu(cpu) {
1039 if (cpu == hcpu) {
1040 *per_cpu_ptr(vi->vq_index, cpu) = -1;
1041 } else {
1042 *per_cpu_ptr(vi->vq_index, cpu) =
1043 ++i % vi->curr_queue_pairs;
1044 }
1045 }
1046}
1047
1048static void virtnet_set_affinity(struct virtnet_info *vi)
1049{
1050 int i;
1051 int cpu;
1019 1052
1020 /* In multiqueue mode, when the number of cpu is equal to the number of 1053 /* In multiqueue mode, when the number of cpu is equal to the number of
1021 * queue pairs, we let the queue pairs to be private to one cpu by 1054 * queue pairs, we let the queue pairs to be private to one cpu by
1022 * setting the affinity hint to eliminate the contention. 1055 * setting the affinity hint to eliminate the contention.
1023 */ 1056 */
1024 if ((vi->curr_queue_pairs == 1 || 1057 if (vi->curr_queue_pairs == 1 ||
1025 vi->max_queue_pairs != num_online_cpus()) && set) { 1058 vi->max_queue_pairs != num_online_cpus()) {
1026 if (vi->affinity_hint_set) 1059 virtnet_clean_affinity(vi, -1);
1027 set = false; 1060 return;
1028 else
1029 return;
1030 } 1061 }
1031 1062
1032 for (i = 0; i < vi->max_queue_pairs; i++) { 1063 i = 0;
1033 int cpu = set ? i : -1; 1064 for_each_online_cpu(cpu) {
1034 virtqueue_set_affinity(vi->rq[i].vq, cpu); 1065 virtqueue_set_affinity(vi->rq[i].vq, cpu);
1035 virtqueue_set_affinity(vi->sq[i].vq, cpu); 1066 virtqueue_set_affinity(vi->sq[i].vq, cpu);
1067 *per_cpu_ptr(vi->vq_index, cpu) = i;
1068 i++;
1036 } 1069 }
1037 1070
1038 if (set) 1071 vi->affinity_hint_set = true;
1039 vi->affinity_hint_set = true; 1072}
1040 else 1073
1041 vi->affinity_hint_set = false; 1074static int virtnet_cpu_callback(struct notifier_block *nfb,
1075 unsigned long action, void *hcpu)
1076{
1077 struct virtnet_info *vi = container_of(nfb, struct virtnet_info, nb);
1078
1079 switch(action & ~CPU_TASKS_FROZEN) {
1080 case CPU_ONLINE:
1081 case CPU_DOWN_FAILED:
1082 case CPU_DEAD:
1083 virtnet_set_affinity(vi);
1084 break;
1085 case CPU_DOWN_PREPARE:
1086 virtnet_clean_affinity(vi, (long)hcpu);
1087 break;
1088 default:
1089 break;
1090 }
1091 return NOTIFY_OK;
1042} 1092}
1043 1093
1044static void virtnet_get_ringparam(struct net_device *dev, 1094static void virtnet_get_ringparam(struct net_device *dev,
@@ -1082,13 +1132,15 @@ static int virtnet_set_channels(struct net_device *dev,
1082 if (queue_pairs > vi->max_queue_pairs) 1132 if (queue_pairs > vi->max_queue_pairs)
1083 return -EINVAL; 1133 return -EINVAL;
1084 1134
1135 get_online_cpus();
1085 err = virtnet_set_queues(vi, queue_pairs); 1136 err = virtnet_set_queues(vi, queue_pairs);
1086 if (!err) { 1137 if (!err) {
1087 netif_set_real_num_tx_queues(dev, queue_pairs); 1138 netif_set_real_num_tx_queues(dev, queue_pairs);
1088 netif_set_real_num_rx_queues(dev, queue_pairs); 1139 netif_set_real_num_rx_queues(dev, queue_pairs);
1089 1140
1090 virtnet_set_affinity(vi, true); 1141 virtnet_set_affinity(vi);
1091 } 1142 }
1143 put_online_cpus();
1092 1144
1093 return err; 1145 return err;
1094} 1146}
@@ -1127,12 +1179,19 @@ static int virtnet_change_mtu(struct net_device *dev, int new_mtu)
1127 1179
1128/* To avoid contending a lock hold by a vcpu who would exit to host, select the 1180/* To avoid contending a lock hold by a vcpu who would exit to host, select the
1129 * txq based on the processor id. 1181 * txq based on the processor id.
1130 * TODO: handle cpu hotplug.
1131 */ 1182 */
1132static u16 virtnet_select_queue(struct net_device *dev, struct sk_buff *skb) 1183static u16 virtnet_select_queue(struct net_device *dev, struct sk_buff *skb)
1133{ 1184{
1134 int txq = skb_rx_queue_recorded(skb) ? skb_get_rx_queue(skb) : 1185 int txq;
1135 smp_processor_id(); 1186 struct virtnet_info *vi = netdev_priv(dev);
1187
1188 if (skb_rx_queue_recorded(skb)) {
1189 txq = skb_get_rx_queue(skb);
1190 } else {
1191 txq = *__this_cpu_ptr(vi->vq_index);
1192 if (txq == -1)
1193 txq = 0;
1194 }
1136 1195
1137 while (unlikely(txq >= dev->real_num_tx_queues)) 1196 while (unlikely(txq >= dev->real_num_tx_queues))
1138 txq -= dev->real_num_tx_queues; 1197 txq -= dev->real_num_tx_queues;
@@ -1248,7 +1307,7 @@ static void virtnet_del_vqs(struct virtnet_info *vi)
1248{ 1307{
1249 struct virtio_device *vdev = vi->vdev; 1308 struct virtio_device *vdev = vi->vdev;
1250 1309
1251 virtnet_set_affinity(vi, false); 1310 virtnet_clean_affinity(vi, -1);
1252 1311
1253 vdev->config->del_vqs(vdev); 1312 vdev->config->del_vqs(vdev);
1254 1313
@@ -1371,7 +1430,10 @@ static int init_vqs(struct virtnet_info *vi)
1371 if (ret) 1430 if (ret)
1372 goto err_free; 1431 goto err_free;
1373 1432
1374 virtnet_set_affinity(vi, true); 1433 get_online_cpus();
1434 virtnet_set_affinity(vi);
1435 put_online_cpus();
1436
1375 return 0; 1437 return 0;
1376 1438
1377err_free: 1439err_free:
@@ -1453,6 +1515,10 @@ static int virtnet_probe(struct virtio_device *vdev)
1453 if (vi->stats == NULL) 1515 if (vi->stats == NULL)
1454 goto free; 1516 goto free;
1455 1517
1518 vi->vq_index = alloc_percpu(int);
1519 if (vi->vq_index == NULL)
1520 goto free_stats;
1521
1456 mutex_init(&vi->config_lock); 1522 mutex_init(&vi->config_lock);
1457 vi->config_enable = true; 1523 vi->config_enable = true;
1458 INIT_WORK(&vi->config_work, virtnet_config_changed_work); 1524 INIT_WORK(&vi->config_work, virtnet_config_changed_work);
@@ -1476,7 +1542,7 @@ static int virtnet_probe(struct virtio_device *vdev)
1476 /* Allocate/initialize the rx/tx queues, and invoke find_vqs */ 1542 /* Allocate/initialize the rx/tx queues, and invoke find_vqs */
1477 err = init_vqs(vi); 1543 err = init_vqs(vi);
1478 if (err) 1544 if (err)
1479 goto free_stats; 1545 goto free_index;
1480 1546
1481 netif_set_real_num_tx_queues(dev, 1); 1547 netif_set_real_num_tx_queues(dev, 1);
1482 netif_set_real_num_rx_queues(dev, 1); 1548 netif_set_real_num_rx_queues(dev, 1);
@@ -1499,6 +1565,13 @@ static int virtnet_probe(struct virtio_device *vdev)
1499 } 1565 }
1500 } 1566 }
1501 1567
1568 vi->nb.notifier_call = &virtnet_cpu_callback;
1569 err = register_hotcpu_notifier(&vi->nb);
1570 if (err) {
1571 pr_debug("virtio_net: registering cpu notifier failed\n");
1572 goto free_recv_bufs;
1573 }
1574
1502 /* Assume link up if device can't report link status, 1575 /* Assume link up if device can't report link status,
1503 otherwise get link status from config. */ 1576 otherwise get link status from config. */
1504 if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_STATUS)) { 1577 if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_STATUS)) {
@@ -1520,6 +1593,8 @@ free_recv_bufs:
1520free_vqs: 1593free_vqs:
1521 cancel_delayed_work_sync(&vi->refill); 1594 cancel_delayed_work_sync(&vi->refill);
1522 virtnet_del_vqs(vi); 1595 virtnet_del_vqs(vi);
1596free_index:
1597 free_percpu(vi->vq_index);
1523free_stats: 1598free_stats:
1524 free_percpu(vi->stats); 1599 free_percpu(vi->stats);
1525free: 1600free:
@@ -1543,6 +1618,8 @@ static void virtnet_remove(struct virtio_device *vdev)
1543{ 1618{
1544 struct virtnet_info *vi = vdev->priv; 1619 struct virtnet_info *vi = vdev->priv;
1545 1620
1621 unregister_hotcpu_notifier(&vi->nb);
1622
1546 /* Prevent config work handler from accessing the device. */ 1623 /* Prevent config work handler from accessing the device. */
1547 mutex_lock(&vi->config_lock); 1624 mutex_lock(&vi->config_lock);
1548 vi->config_enable = false; 1625 vi->config_enable = false;
@@ -1554,6 +1631,7 @@ static void virtnet_remove(struct virtio_device *vdev)
1554 1631
1555 flush_work(&vi->config_work); 1632 flush_work(&vi->config_work);
1556 1633
1634 free_percpu(vi->vq_index);
1557 free_percpu(vi->stats); 1635 free_percpu(vi->stats);
1558 free_netdev(vi->dev); 1636 free_netdev(vi->dev);
1559} 1637}
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 3b3fdf648ea7..656230e0d18c 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -505,7 +505,8 @@ static int vxlan_join_group(struct net_device *dev)
505 struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id); 505 struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id);
506 struct sock *sk = vn->sock->sk; 506 struct sock *sk = vn->sock->sk;
507 struct ip_mreqn mreq = { 507 struct ip_mreqn mreq = {
508 .imr_multiaddr.s_addr = vxlan->gaddr, 508 .imr_multiaddr.s_addr = vxlan->gaddr,
509 .imr_ifindex = vxlan->link,
509 }; 510 };
510 int err; 511 int err;
511 512
@@ -532,7 +533,8 @@ static int vxlan_leave_group(struct net_device *dev)
532 int err = 0; 533 int err = 0;
533 struct sock *sk = vn->sock->sk; 534 struct sock *sk = vn->sock->sk;
534 struct ip_mreqn mreq = { 535 struct ip_mreqn mreq = {
535 .imr_multiaddr.s_addr = vxlan->gaddr, 536 .imr_multiaddr.s_addr = vxlan->gaddr,
537 .imr_ifindex = vxlan->link,
536 }; 538 };
537 539
538 /* Only leave group when last vxlan is done. */ 540 /* Only leave group when last vxlan is done. */
@@ -1189,6 +1191,7 @@ static void vxlan_setup(struct net_device *dev)
1189 1191
1190 dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM; 1192 dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM;
1191 dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; 1193 dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
1194 dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
1192 1195
1193 spin_lock_init(&vxlan->hash_lock); 1196 spin_lock_init(&vxlan->hash_lock);
1194 1197
diff --git a/drivers/net/wireless/ath/Kconfig b/drivers/net/wireless/ath/Kconfig
index 1a67a4f829fe..2c02b4e84094 100644
--- a/drivers/net/wireless/ath/Kconfig
+++ b/drivers/net/wireless/ath/Kconfig
@@ -30,5 +30,6 @@ source "drivers/net/wireless/ath/ath9k/Kconfig"
30source "drivers/net/wireless/ath/carl9170/Kconfig" 30source "drivers/net/wireless/ath/carl9170/Kconfig"
31source "drivers/net/wireless/ath/ath6kl/Kconfig" 31source "drivers/net/wireless/ath/ath6kl/Kconfig"
32source "drivers/net/wireless/ath/ar5523/Kconfig" 32source "drivers/net/wireless/ath/ar5523/Kconfig"
33source "drivers/net/wireless/ath/wil6210/Kconfig"
33 34
34endif 35endif
diff --git a/drivers/net/wireless/ath/Makefile b/drivers/net/wireless/ath/Makefile
index 1e18621326dc..97b964ded2be 100644
--- a/drivers/net/wireless/ath/Makefile
+++ b/drivers/net/wireless/ath/Makefile
@@ -3,6 +3,7 @@ obj-$(CONFIG_ATH9K_HW) += ath9k/
3obj-$(CONFIG_CARL9170) += carl9170/ 3obj-$(CONFIG_CARL9170) += carl9170/
4obj-$(CONFIG_ATH6KL) += ath6kl/ 4obj-$(CONFIG_ATH6KL) += ath6kl/
5obj-$(CONFIG_AR5523) += ar5523/ 5obj-$(CONFIG_AR5523) += ar5523/
6obj-$(CONFIG_WIL6210) += wil6210/
6 7
7obj-$(CONFIG_ATH_COMMON) += ath.o 8obj-$(CONFIG_ATH_COMMON) += ath.o
8 9
diff --git a/drivers/net/wireless/ath/ath9k/Kconfig b/drivers/net/wireless/ath/ath9k/Kconfig
index 5fc15bf8be09..7647ed6b73d7 100644
--- a/drivers/net/wireless/ath/ath9k/Kconfig
+++ b/drivers/net/wireless/ath/ath9k/Kconfig
@@ -2,6 +2,7 @@ config ATH9K_HW
2 tristate 2 tristate
3config ATH9K_COMMON 3config ATH9K_COMMON
4 tristate 4 tristate
5 select ATH_COMMON
5config ATH9K_DFS_DEBUGFS 6config ATH9K_DFS_DEBUGFS
6 def_bool y 7 def_bool y
7 depends on ATH9K_DEBUGFS && ATH9K_DFS_CERTIFIED 8 depends on ATH9K_DEBUGFS && ATH9K_DFS_CERTIFIED
@@ -17,7 +18,6 @@ config ATH9K_BTCOEX_SUPPORT
17config ATH9K 18config ATH9K
18 tristate "Atheros 802.11n wireless cards support" 19 tristate "Atheros 802.11n wireless cards support"
19 depends on MAC80211 20 depends on MAC80211
20 select ATH_COMMON
21 select ATH9K_HW 21 select ATH9K_HW
22 select MAC80211_LEDS 22 select MAC80211_LEDS
23 select LEDS_CLASS 23 select LEDS_CLASS
@@ -56,7 +56,8 @@ config ATH9K_AHB
56 56
57config ATH9K_DEBUGFS 57config ATH9K_DEBUGFS
58 bool "Atheros ath9k debugging" 58 bool "Atheros ath9k debugging"
59 depends on ATH9K && DEBUG_FS 59 depends on ATH9K
60 select MAC80211_DEBUGFS
60 ---help--- 61 ---help---
61 Say Y, if you need access to ath9k's statistics for 62 Say Y, if you need access to ath9k's statistics for
62 interrupts, rate control, etc. 63 interrupts, rate control, etc.
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
index 8b0d8dcd7625..56317b0fb6b6 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
@@ -976,6 +976,8 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah,
976 AR_PHY_CL_TAB_1, 976 AR_PHY_CL_TAB_1,
977 AR_PHY_CL_TAB_2 }; 977 AR_PHY_CL_TAB_2 };
978 978
979 ar9003_hw_set_chain_masks(ah, ah->caps.rx_chainmask, ah->caps.tx_chainmask);
980
979 if (rtt) { 981 if (rtt) {
980 if (!ar9003_hw_rtt_restore(ah, chan)) 982 if (!ar9003_hw_rtt_restore(ah, chan))
981 run_rtt_cal = true; 983 run_rtt_cal = true;
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_hw.c b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
index 74fd3977feeb..59bf5f31e212 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
@@ -544,7 +544,7 @@ static void ar9003_rx_gain_table_mode0(struct ath_hw *ah)
544 ar9340Common_rx_gain_table_1p0); 544 ar9340Common_rx_gain_table_1p0);
545 else if (AR_SREV_9485_11(ah)) 545 else if (AR_SREV_9485_11(ah))
546 INIT_INI_ARRAY(&ah->iniModesRxGain, 546 INIT_INI_ARRAY(&ah->iniModesRxGain,
547 ar9485Common_wo_xlna_rx_gain_1_1); 547 ar9485_common_rx_gain_1_1);
548 else if (AR_SREV_9550(ah)) { 548 else if (AR_SREV_9550(ah)) {
549 INIT_INI_ARRAY(&ah->iniModesRxGain, 549 INIT_INI_ARRAY(&ah->iniModesRxGain,
550 ar955x_1p0_common_rx_gain_table); 550 ar955x_1p0_common_rx_gain_table);
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
index ce19c09fa8e8..3afc24bde6d6 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
@@ -586,32 +586,19 @@ static void ar9003_hw_init_bb(struct ath_hw *ah,
586 ath9k_hw_synth_delay(ah, chan, synthDelay); 586 ath9k_hw_synth_delay(ah, chan, synthDelay);
587} 587}
588 588
589static void ar9003_hw_set_chain_masks(struct ath_hw *ah, u8 rx, u8 tx) 589void ar9003_hw_set_chain_masks(struct ath_hw *ah, u8 rx, u8 tx)
590{ 590{
591 switch (rx) { 591 if (ah->caps.tx_chainmask == 5 || ah->caps.rx_chainmask == 5)
592 case 0x5:
593 REG_SET_BIT(ah, AR_PHY_ANALOG_SWAP, 592 REG_SET_BIT(ah, AR_PHY_ANALOG_SWAP,
594 AR_PHY_SWAP_ALT_CHAIN); 593 AR_PHY_SWAP_ALT_CHAIN);
595 case 0x3: 594
596 case 0x1: 595 REG_WRITE(ah, AR_PHY_RX_CHAINMASK, rx);
597 case 0x2: 596 REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, rx);
598 case 0x7:
599 REG_WRITE(ah, AR_PHY_RX_CHAINMASK, rx);
600 REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, rx);
601 break;
602 default:
603 break;
604 }
605 597
606 if ((ah->caps.hw_caps & ATH9K_HW_CAP_APM) && (tx == 0x7)) 598 if ((ah->caps.hw_caps & ATH9K_HW_CAP_APM) && (tx == 0x7))
607 REG_WRITE(ah, AR_SELFGEN_MASK, 0x3); 599 tx = 3;
608 else
609 REG_WRITE(ah, AR_SELFGEN_MASK, tx);
610 600
611 if (tx == 0x5) { 601 REG_WRITE(ah, AR_SELFGEN_MASK, tx);
612 REG_SET_BIT(ah, AR_PHY_ANALOG_SWAP,
613 AR_PHY_SWAP_ALT_CHAIN);
614 }
615} 602}
616 603
617/* 604/*
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 86e26a19efda..42794c546a40 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -317,7 +317,6 @@ struct ath_rx {
317 u32 *rxlink; 317 u32 *rxlink;
318 u32 num_pkts; 318 u32 num_pkts;
319 unsigned int rxfilter; 319 unsigned int rxfilter;
320 spinlock_t rxbuflock;
321 struct list_head rxbuf; 320 struct list_head rxbuf;
322 struct ath_descdma rxdma; 321 struct ath_descdma rxdma;
323 struct ath_buf *rx_bufptr; 322 struct ath_buf *rx_bufptr;
@@ -328,7 +327,6 @@ struct ath_rx {
328 327
329int ath_startrecv(struct ath_softc *sc); 328int ath_startrecv(struct ath_softc *sc);
330bool ath_stoprecv(struct ath_softc *sc); 329bool ath_stoprecv(struct ath_softc *sc);
331void ath_flushrecv(struct ath_softc *sc);
332u32 ath_calcrxfilter(struct ath_softc *sc); 330u32 ath_calcrxfilter(struct ath_softc *sc);
333int ath_rx_init(struct ath_softc *sc, int nbufs); 331int ath_rx_init(struct ath_softc *sc, int nbufs);
334void ath_rx_cleanup(struct ath_softc *sc); 332void ath_rx_cleanup(struct ath_softc *sc);
@@ -646,7 +644,6 @@ void ath_ant_comb_update(struct ath_softc *sc);
646enum sc_op_flags { 644enum sc_op_flags {
647 SC_OP_INVALID, 645 SC_OP_INVALID,
648 SC_OP_BEACONS, 646 SC_OP_BEACONS,
649 SC_OP_RXFLUSH,
650 SC_OP_ANI_RUN, 647 SC_OP_ANI_RUN,
651 SC_OP_PRIM_STA_VIF, 648 SC_OP_PRIM_STA_VIF,
652 SC_OP_HW_RESET, 649 SC_OP_HW_RESET,
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c
index 531fffd801a3..2ca355e94da6 100644
--- a/drivers/net/wireless/ath/ath9k/beacon.c
+++ b/drivers/net/wireless/ath/ath9k/beacon.c
@@ -147,6 +147,7 @@ static struct ath_buf *ath9k_beacon_generate(struct ieee80211_hw *hw,
147 skb->len, DMA_TO_DEVICE); 147 skb->len, DMA_TO_DEVICE);
148 dev_kfree_skb_any(skb); 148 dev_kfree_skb_any(skb);
149 bf->bf_buf_addr = 0; 149 bf->bf_buf_addr = 0;
150 bf->bf_mpdu = NULL;
150 } 151 }
151 152
152 skb = ieee80211_beacon_get(hw, vif); 153 skb = ieee80211_beacon_get(hw, vif);
@@ -359,7 +360,6 @@ void ath9k_beacon_tasklet(unsigned long data)
359 return; 360 return;
360 361
361 bf = ath9k_beacon_generate(sc->hw, vif); 362 bf = ath9k_beacon_generate(sc->hw, vif);
362 WARN_ON(!bf);
363 363
364 if (sc->beacon.bmisscnt != 0) { 364 if (sc->beacon.bmisscnt != 0) {
365 ath_dbg(common, BSTUCK, "resume beacon xmit after %u misses\n", 365 ath_dbg(common, BSTUCK, "resume beacon xmit after %u misses\n",
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index 13ff9edc2401..e585fc827c50 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -861,7 +861,6 @@ static ssize_t read_file_recv(struct file *file, char __user *user_buf,
861 RXS_ERR("RX-LENGTH-ERR", rx_len_err); 861 RXS_ERR("RX-LENGTH-ERR", rx_len_err);
862 RXS_ERR("RX-OOM-ERR", rx_oom_err); 862 RXS_ERR("RX-OOM-ERR", rx_oom_err);
863 RXS_ERR("RX-RATE-ERR", rx_rate_err); 863 RXS_ERR("RX-RATE-ERR", rx_rate_err);
864 RXS_ERR("RX-DROP-RXFLUSH", rx_drop_rxflush);
865 RXS_ERR("RX-TOO-MANY-FRAGS", rx_too_many_frags_err); 864 RXS_ERR("RX-TOO-MANY-FRAGS", rx_too_many_frags_err);
866 865
867 PHY_ERR("UNDERRUN ERR", ATH9K_PHYERR_UNDERRUN); 866 PHY_ERR("UNDERRUN ERR", ATH9K_PHYERR_UNDERRUN);
diff --git a/drivers/net/wireless/ath/ath9k/debug.h b/drivers/net/wireless/ath/ath9k/debug.h
index 375c3b46411e..6df2ab62dcb7 100644
--- a/drivers/net/wireless/ath/ath9k/debug.h
+++ b/drivers/net/wireless/ath/ath9k/debug.h
@@ -216,7 +216,6 @@ struct ath_tx_stats {
216 * @rx_oom_err: No. of frames dropped due to OOM issues. 216 * @rx_oom_err: No. of frames dropped due to OOM issues.
217 * @rx_rate_err: No. of frames dropped due to rate errors. 217 * @rx_rate_err: No. of frames dropped due to rate errors.
218 * @rx_too_many_frags_err: Frames dropped due to too-many-frags received. 218 * @rx_too_many_frags_err: Frames dropped due to too-many-frags received.
219 * @rx_drop_rxflush: No. of frames dropped due to RX-FLUSH.
220 * @rx_beacons: No. of beacons received. 219 * @rx_beacons: No. of beacons received.
221 * @rx_frags: No. of rx-fragements received. 220 * @rx_frags: No. of rx-fragements received.
222 */ 221 */
@@ -235,7 +234,6 @@ struct ath_rx_stats {
235 u32 rx_oom_err; 234 u32 rx_oom_err;
236 u32 rx_rate_err; 235 u32 rx_rate_err;
237 u32 rx_too_many_frags_err; 236 u32 rx_too_many_frags_err;
238 u32 rx_drop_rxflush;
239 u32 rx_beacons; 237 u32 rx_beacons;
240 u32 rx_frags; 238 u32 rx_frags;
241}; 239};
diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c
index 4a9570dfba72..aac4a406a513 100644
--- a/drivers/net/wireless/ath/ath9k/htc_hst.c
+++ b/drivers/net/wireless/ath/ath9k/htc_hst.c
@@ -344,6 +344,8 @@ void ath9k_htc_txcompletion_cb(struct htc_target *htc_handle,
344 endpoint->ep_callbacks.tx(endpoint->ep_callbacks.priv, 344 endpoint->ep_callbacks.tx(endpoint->ep_callbacks.priv,
345 skb, htc_hdr->endpoint_id, 345 skb, htc_hdr->endpoint_id,
346 txok); 346 txok);
347 } else {
348 kfree_skb(skb);
347 } 349 }
348 } 350 }
349 351
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index 7f1a8e91c908..9d26fc56ca56 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -1066,6 +1066,7 @@ void ar9003_paprd_setup_gain_table(struct ath_hw *ah, int chain);
1066int ar9003_paprd_init_table(struct ath_hw *ah); 1066int ar9003_paprd_init_table(struct ath_hw *ah);
1067bool ar9003_paprd_is_done(struct ath_hw *ah); 1067bool ar9003_paprd_is_done(struct ath_hw *ah);
1068bool ar9003_is_paprd_enabled(struct ath_hw *ah); 1068bool ar9003_is_paprd_enabled(struct ath_hw *ah);
1069void ar9003_hw_set_chain_masks(struct ath_hw *ah, u8 rx, u8 tx);
1069 1070
1070/* Hardware family op attach helpers */ 1071/* Hardware family op attach helpers */
1071void ar5008_hw_attach_phy_ops(struct ath_hw *ah); 1072void ar5008_hw_attach_phy_ops(struct ath_hw *ah);
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index be30a9af1528..dd91f8fdc01c 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -182,7 +182,7 @@ static void ath_restart_work(struct ath_softc *sc)
182 ath_start_ani(sc); 182 ath_start_ani(sc);
183} 183}
184 184
185static bool ath_prepare_reset(struct ath_softc *sc, bool retry_tx, bool flush) 185static bool ath_prepare_reset(struct ath_softc *sc, bool retry_tx)
186{ 186{
187 struct ath_hw *ah = sc->sc_ah; 187 struct ath_hw *ah = sc->sc_ah;
188 bool ret = true; 188 bool ret = true;
@@ -202,14 +202,6 @@ static bool ath_prepare_reset(struct ath_softc *sc, bool retry_tx, bool flush)
202 if (!ath_drain_all_txq(sc, retry_tx)) 202 if (!ath_drain_all_txq(sc, retry_tx))
203 ret = false; 203 ret = false;
204 204
205 if (!flush) {
206 if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
207 ath_rx_tasklet(sc, 1, true);
208 ath_rx_tasklet(sc, 1, false);
209 } else {
210 ath_flushrecv(sc);
211 }
212
213 return ret; 205 return ret;
214} 206}
215 207
@@ -262,11 +254,11 @@ static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan,
262 struct ath_common *common = ath9k_hw_common(ah); 254 struct ath_common *common = ath9k_hw_common(ah);
263 struct ath9k_hw_cal_data *caldata = NULL; 255 struct ath9k_hw_cal_data *caldata = NULL;
264 bool fastcc = true; 256 bool fastcc = true;
265 bool flush = false;
266 int r; 257 int r;
267 258
268 __ath_cancel_work(sc); 259 __ath_cancel_work(sc);
269 260
261 tasklet_disable(&sc->intr_tq);
270 spin_lock_bh(&sc->sc_pcu_lock); 262 spin_lock_bh(&sc->sc_pcu_lock);
271 263
272 if (!(sc->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)) { 264 if (!(sc->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)) {
@@ -276,11 +268,10 @@ static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan,
276 268
277 if (!hchan) { 269 if (!hchan) {
278 fastcc = false; 270 fastcc = false;
279 flush = true;
280 hchan = ah->curchan; 271 hchan = ah->curchan;
281 } 272 }
282 273
283 if (!ath_prepare_reset(sc, retry_tx, flush)) 274 if (!ath_prepare_reset(sc, retry_tx))
284 fastcc = false; 275 fastcc = false;
285 276
286 ath_dbg(common, CONFIG, "Reset to %u MHz, HT40: %d fastcc: %d\n", 277 ath_dbg(common, CONFIG, "Reset to %u MHz, HT40: %d fastcc: %d\n",
@@ -302,6 +293,8 @@ static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan,
302 293
303out: 294out:
304 spin_unlock_bh(&sc->sc_pcu_lock); 295 spin_unlock_bh(&sc->sc_pcu_lock);
296 tasklet_enable(&sc->intr_tq);
297
305 return r; 298 return r;
306} 299}
307 300
@@ -804,7 +797,7 @@ static void ath9k_stop(struct ieee80211_hw *hw)
804 ath9k_hw_cfg_gpio_input(ah, ah->led_pin); 797 ath9k_hw_cfg_gpio_input(ah, ah->led_pin);
805 } 798 }
806 799
807 ath_prepare_reset(sc, false, true); 800 ath_prepare_reset(sc, false);
808 801
809 if (sc->rx.frag) { 802 if (sc->rx.frag) {
810 dev_kfree_skb_any(sc->rx.frag); 803 dev_kfree_skb_any(sc->rx.frag);
@@ -1833,6 +1826,9 @@ static u32 fill_chainmask(u32 cap, u32 new)
1833 1826
1834static bool validate_antenna_mask(struct ath_hw *ah, u32 val) 1827static bool validate_antenna_mask(struct ath_hw *ah, u32 val)
1835{ 1828{
1829 if (AR_SREV_9300_20_OR_LATER(ah))
1830 return true;
1831
1836 switch (val & 0x7) { 1832 switch (val & 0x7) {
1837 case 0x1: 1833 case 0x1:
1838 case 0x3: 1834 case 0x3:
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index d4df98a938bf..90752f246970 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -254,8 +254,6 @@ rx_init_fail:
254 254
255static void ath_edma_start_recv(struct ath_softc *sc) 255static void ath_edma_start_recv(struct ath_softc *sc)
256{ 256{
257 spin_lock_bh(&sc->rx.rxbuflock);
258
259 ath9k_hw_rxena(sc->sc_ah); 257 ath9k_hw_rxena(sc->sc_ah);
260 258
261 ath_rx_addbuffer_edma(sc, ATH9K_RX_QUEUE_HP, 259 ath_rx_addbuffer_edma(sc, ATH9K_RX_QUEUE_HP,
@@ -267,8 +265,6 @@ static void ath_edma_start_recv(struct ath_softc *sc)
267 ath_opmode_init(sc); 265 ath_opmode_init(sc);
268 266
269 ath9k_hw_startpcureceive(sc->sc_ah, !!(sc->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)); 267 ath9k_hw_startpcureceive(sc->sc_ah, !!(sc->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL));
270
271 spin_unlock_bh(&sc->rx.rxbuflock);
272} 268}
273 269
274static void ath_edma_stop_recv(struct ath_softc *sc) 270static void ath_edma_stop_recv(struct ath_softc *sc)
@@ -285,8 +281,6 @@ int ath_rx_init(struct ath_softc *sc, int nbufs)
285 int error = 0; 281 int error = 0;
286 282
287 spin_lock_init(&sc->sc_pcu_lock); 283 spin_lock_init(&sc->sc_pcu_lock);
288 spin_lock_init(&sc->rx.rxbuflock);
289 clear_bit(SC_OP_RXFLUSH, &sc->sc_flags);
290 284
291 common->rx_bufsize = IEEE80211_MAX_MPDU_LEN / 2 + 285 common->rx_bufsize = IEEE80211_MAX_MPDU_LEN / 2 +
292 sc->sc_ah->caps.rx_status_len; 286 sc->sc_ah->caps.rx_status_len;
@@ -447,7 +441,6 @@ int ath_startrecv(struct ath_softc *sc)
447 return 0; 441 return 0;
448 } 442 }
449 443
450 spin_lock_bh(&sc->rx.rxbuflock);
451 if (list_empty(&sc->rx.rxbuf)) 444 if (list_empty(&sc->rx.rxbuf))
452 goto start_recv; 445 goto start_recv;
453 446
@@ -468,26 +461,31 @@ start_recv:
468 ath_opmode_init(sc); 461 ath_opmode_init(sc);
469 ath9k_hw_startpcureceive(ah, !!(sc->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)); 462 ath9k_hw_startpcureceive(ah, !!(sc->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL));
470 463
471 spin_unlock_bh(&sc->rx.rxbuflock);
472
473 return 0; 464 return 0;
474} 465}
475 466
467static void ath_flushrecv(struct ath_softc *sc)
468{
469 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
470 ath_rx_tasklet(sc, 1, true);
471 ath_rx_tasklet(sc, 1, false);
472}
473
476bool ath_stoprecv(struct ath_softc *sc) 474bool ath_stoprecv(struct ath_softc *sc)
477{ 475{
478 struct ath_hw *ah = sc->sc_ah; 476 struct ath_hw *ah = sc->sc_ah;
479 bool stopped, reset = false; 477 bool stopped, reset = false;
480 478
481 spin_lock_bh(&sc->rx.rxbuflock);
482 ath9k_hw_abortpcurecv(ah); 479 ath9k_hw_abortpcurecv(ah);
483 ath9k_hw_setrxfilter(ah, 0); 480 ath9k_hw_setrxfilter(ah, 0);
484 stopped = ath9k_hw_stopdmarecv(ah, &reset); 481 stopped = ath9k_hw_stopdmarecv(ah, &reset);
485 482
483 ath_flushrecv(sc);
484
486 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) 485 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
487 ath_edma_stop_recv(sc); 486 ath_edma_stop_recv(sc);
488 else 487 else
489 sc->rx.rxlink = NULL; 488 sc->rx.rxlink = NULL;
490 spin_unlock_bh(&sc->rx.rxbuflock);
491 489
492 if (!(ah->ah_flags & AH_UNPLUGGED) && 490 if (!(ah->ah_flags & AH_UNPLUGGED) &&
493 unlikely(!stopped)) { 491 unlikely(!stopped)) {
@@ -499,15 +497,6 @@ bool ath_stoprecv(struct ath_softc *sc)
499 return stopped && !reset; 497 return stopped && !reset;
500} 498}
501 499
502void ath_flushrecv(struct ath_softc *sc)
503{
504 set_bit(SC_OP_RXFLUSH, &sc->sc_flags);
505 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)
506 ath_rx_tasklet(sc, 1, true);
507 ath_rx_tasklet(sc, 1, false);
508 clear_bit(SC_OP_RXFLUSH, &sc->sc_flags);
509}
510
511static bool ath_beacon_dtim_pending_cab(struct sk_buff *skb) 500static bool ath_beacon_dtim_pending_cab(struct sk_buff *skb)
512{ 501{
513 /* Check whether the Beacon frame has DTIM indicating buffered bc/mc */ 502 /* Check whether the Beacon frame has DTIM indicating buffered bc/mc */
@@ -744,6 +733,7 @@ static struct ath_buf *ath_get_next_rx_buf(struct ath_softc *sc,
744 return NULL; 733 return NULL;
745 } 734 }
746 735
736 list_del(&bf->list);
747 if (!bf->bf_mpdu) 737 if (!bf->bf_mpdu)
748 return bf; 738 return bf;
749 739
@@ -1059,16 +1049,12 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)
1059 dma_type = DMA_FROM_DEVICE; 1049 dma_type = DMA_FROM_DEVICE;
1060 1050
1061 qtype = hp ? ATH9K_RX_QUEUE_HP : ATH9K_RX_QUEUE_LP; 1051 qtype = hp ? ATH9K_RX_QUEUE_HP : ATH9K_RX_QUEUE_LP;
1062 spin_lock_bh(&sc->rx.rxbuflock);
1063 1052
1064 tsf = ath9k_hw_gettsf64(ah); 1053 tsf = ath9k_hw_gettsf64(ah);
1065 tsf_lower = tsf & 0xffffffff; 1054 tsf_lower = tsf & 0xffffffff;
1066 1055
1067 do { 1056 do {
1068 bool decrypt_error = false; 1057 bool decrypt_error = false;
1069 /* If handling rx interrupt and flush is in progress => exit */
1070 if (test_bit(SC_OP_RXFLUSH, &sc->sc_flags) && (flush == 0))
1071 break;
1072 1058
1073 memset(&rs, 0, sizeof(rs)); 1059 memset(&rs, 0, sizeof(rs));
1074 if (edma) 1060 if (edma)
@@ -1111,15 +1097,6 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)
1111 1097
1112 ath_debug_stat_rx(sc, &rs); 1098 ath_debug_stat_rx(sc, &rs);
1113 1099
1114 /*
1115 * If we're asked to flush receive queue, directly
1116 * chain it back at the queue without processing it.
1117 */
1118 if (test_bit(SC_OP_RXFLUSH, &sc->sc_flags)) {
1119 RX_STAT_INC(rx_drop_rxflush);
1120 goto requeue_drop_frag;
1121 }
1122
1123 memset(rxs, 0, sizeof(struct ieee80211_rx_status)); 1100 memset(rxs, 0, sizeof(struct ieee80211_rx_status));
1124 1101
1125 rxs->mactime = (tsf & ~0xffffffffULL) | rs.rs_tstamp; 1102 rxs->mactime = (tsf & ~0xffffffffULL) | rs.rs_tstamp;
@@ -1254,19 +1231,18 @@ requeue_drop_frag:
1254 sc->rx.frag = NULL; 1231 sc->rx.frag = NULL;
1255 } 1232 }
1256requeue: 1233requeue:
1234 list_add_tail(&bf->list, &sc->rx.rxbuf);
1235 if (flush)
1236 continue;
1237
1257 if (edma) { 1238 if (edma) {
1258 list_add_tail(&bf->list, &sc->rx.rxbuf);
1259 ath_rx_edma_buf_link(sc, qtype); 1239 ath_rx_edma_buf_link(sc, qtype);
1260 } else { 1240 } else {
1261 list_move_tail(&bf->list, &sc->rx.rxbuf);
1262 ath_rx_buf_link(sc, bf); 1241 ath_rx_buf_link(sc, bf);
1263 if (!flush) 1242 ath9k_hw_rxena(ah);
1264 ath9k_hw_rxena(ah);
1265 } 1243 }
1266 } while (1); 1244 } while (1);
1267 1245
1268 spin_unlock_bh(&sc->rx.rxbuflock);
1269
1270 if (!(ah->imask & ATH9K_INT_RXEOL)) { 1246 if (!(ah->imask & ATH9K_INT_RXEOL)) {
1271 ah->imask |= (ATH9K_INT_RXEOL | ATH9K_INT_RXORN); 1247 ah->imask |= (ATH9K_INT_RXEOL | ATH9K_INT_RXORN);
1272 ath9k_hw_set_interrupts(ah); 1248 ath9k_hw_set_interrupts(ah);
diff --git a/drivers/net/wireless/ath/carl9170/fw.c b/drivers/net/wireless/ath/carl9170/fw.c
index aaebecd19e59..63fd9af3fd39 100644
--- a/drivers/net/wireless/ath/carl9170/fw.c
+++ b/drivers/net/wireless/ath/carl9170/fw.c
@@ -336,8 +336,12 @@ static int carl9170_fw(struct ar9170 *ar, const __u8 *data, size_t len)
336 if (SUPP(CARL9170FW_WLANTX_CAB)) { 336 if (SUPP(CARL9170FW_WLANTX_CAB)) {
337 if_comb_types |= 337 if_comb_types |=
338 BIT(NL80211_IFTYPE_AP) | 338 BIT(NL80211_IFTYPE_AP) |
339 BIT(NL80211_IFTYPE_MESH_POINT) |
340 BIT(NL80211_IFTYPE_P2P_GO); 339 BIT(NL80211_IFTYPE_P2P_GO);
340
341#ifdef CONFIG_MAC80211_MESH
342 if_comb_types |=
343 BIT(NL80211_IFTYPE_MESH_POINT);
344#endif /* CONFIG_MAC80211_MESH */
341 } 345 }
342 } 346 }
343 347
diff --git a/drivers/net/wireless/ath/wil6210/Kconfig b/drivers/net/wireless/ath/wil6210/Kconfig
new file mode 100644
index 000000000000..bac3d98a0cfb
--- /dev/null
+++ b/drivers/net/wireless/ath/wil6210/Kconfig
@@ -0,0 +1,29 @@
1config WIL6210
2 tristate "Wilocity 60g WiFi card wil6210 support"
3 depends on CFG80211
4 depends on PCI
5 default n
6 ---help---
7 This module adds support for wireless adapter based on
8 wil6210 chip by Wilocity. It supports operation on the
9 60 GHz band, covered by the IEEE802.11ad standard.
10
11 http://wireless.kernel.org/en/users/Drivers/wil6210
12
13 If you choose to build it as a module, it will be called
14 wil6210
15
16config WIL6210_ISR_COR
17 bool "Use Clear-On-Read mode for ISR registers for wil6210"
18 depends on WIL6210
19 default y
20 ---help---
21 ISR registers on wil6210 chip may operate in either
22 COR (Clear-On-Read) or W1C (Write-1-to-Clear) mode.
23 For production code, use COR (say y); is default since
24 it saves extra target transaction;
25 For ISR debug, use W1C (say n); is allows to monitor ISR
26 registers with debugfs. If COR were used, ISR would
27 self-clear when accessed for debug purposes, it makes
28 such monitoring impossible.
29 Say y unless you debug interrupts
diff --git a/drivers/net/wireless/ath/wil6210/Makefile b/drivers/net/wireless/ath/wil6210/Makefile
new file mode 100644
index 000000000000..9396dc9fe3c5
--- /dev/null
+++ b/drivers/net/wireless/ath/wil6210/Makefile
@@ -0,0 +1,13 @@
1obj-$(CONFIG_WIL6210) += wil6210.o
2
3wil6210-objs := main.o
4wil6210-objs += netdev.o
5wil6210-objs += cfg80211.o
6wil6210-objs += pcie_bus.o
7wil6210-objs += debugfs.o
8wil6210-objs += wmi.o
9wil6210-objs += interrupt.o
10wil6210-objs += txrx.o
11
12subdir-ccflags-y += -Werror
13subdir-ccflags-y += -D__CHECK_ENDIAN__
diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c b/drivers/net/wireless/ath/wil6210/cfg80211.c
new file mode 100644
index 000000000000..116f4e807ae1
--- /dev/null
+++ b/drivers/net/wireless/ath/wil6210/cfg80211.c
@@ -0,0 +1,573 @@
1/*
2 * Copyright (c) 2012 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#include <linux/kernel.h>
18#include <linux/netdevice.h>
19#include <linux/sched.h>
20#include <linux/etherdevice.h>
21#include <linux/wireless.h>
22#include <linux/ieee80211.h>
23#include <linux/slab.h>
24#include <linux/version.h>
25#include <net/cfg80211.h>
26
27#include "wil6210.h"
28#include "wmi.h"
29
30#define CHAN60G(_channel, _flags) { \
31 .band = IEEE80211_BAND_60GHZ, \
32 .center_freq = 56160 + (2160 * (_channel)), \
33 .hw_value = (_channel), \
34 .flags = (_flags), \
35 .max_antenna_gain = 0, \
36 .max_power = 40, \
37}
38
39static struct ieee80211_channel wil_60ghz_channels[] = {
40 CHAN60G(1, 0),
41 CHAN60G(2, 0),
42 CHAN60G(3, 0),
43/* channel 4 not supported yet */
44};
45
46static struct ieee80211_supported_band wil_band_60ghz = {
47 .channels = wil_60ghz_channels,
48 .n_channels = ARRAY_SIZE(wil_60ghz_channels),
49 .ht_cap = {
50 .ht_supported = true,
51 .cap = 0, /* TODO */
52 .ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, /* TODO */
53 .ampdu_density = IEEE80211_HT_MPDU_DENSITY_8, /* TODO */
54 .mcs = {
55 /* MCS 1..12 - SC PHY */
56 .rx_mask = {0xfe, 0x1f}, /* 1..12 */
57 .tx_params = IEEE80211_HT_MCS_TX_DEFINED, /* TODO */
58 },
59 },
60};
61
62static const struct ieee80211_txrx_stypes
63wil_mgmt_stypes[NUM_NL80211_IFTYPES] = {
64 [NL80211_IFTYPE_STATION] = {
65 .tx = BIT(IEEE80211_STYPE_ACTION >> 4) |
66 BIT(IEEE80211_STYPE_PROBE_RESP >> 4),
67 .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
68 BIT(IEEE80211_STYPE_PROBE_REQ >> 4)
69 },
70 [NL80211_IFTYPE_AP] = {
71 .tx = BIT(IEEE80211_STYPE_ACTION >> 4) |
72 BIT(IEEE80211_STYPE_PROBE_RESP >> 4),
73 .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
74 BIT(IEEE80211_STYPE_PROBE_REQ >> 4)
75 },
76 [NL80211_IFTYPE_P2P_CLIENT] = {
77 .tx = BIT(IEEE80211_STYPE_ACTION >> 4) |
78 BIT(IEEE80211_STYPE_PROBE_RESP >> 4),
79 .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
80 BIT(IEEE80211_STYPE_PROBE_REQ >> 4)
81 },
82 [NL80211_IFTYPE_P2P_GO] = {
83 .tx = BIT(IEEE80211_STYPE_ACTION >> 4) |
84 BIT(IEEE80211_STYPE_PROBE_RESP >> 4),
85 .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
86 BIT(IEEE80211_STYPE_PROBE_REQ >> 4)
87 },
88};
89
90static const u32 wil_cipher_suites[] = {
91 WLAN_CIPHER_SUITE_GCMP,
92};
93
94int wil_iftype_nl2wmi(enum nl80211_iftype type)
95{
96 static const struct {
97 enum nl80211_iftype nl;
98 enum wmi_network_type wmi;
99 } __nl2wmi[] = {
100 {NL80211_IFTYPE_ADHOC, WMI_NETTYPE_ADHOC},
101 {NL80211_IFTYPE_STATION, WMI_NETTYPE_INFRA},
102 {NL80211_IFTYPE_AP, WMI_NETTYPE_AP},
103 {NL80211_IFTYPE_P2P_CLIENT, WMI_NETTYPE_P2P},
104 {NL80211_IFTYPE_P2P_GO, WMI_NETTYPE_P2P},
105 {NL80211_IFTYPE_MONITOR, WMI_NETTYPE_ADHOC}, /* FIXME */
106 };
107 uint i;
108
109 for (i = 0; i < ARRAY_SIZE(__nl2wmi); i++) {
110 if (__nl2wmi[i].nl == type)
111 return __nl2wmi[i].wmi;
112 }
113
114 return -EOPNOTSUPP;
115}
116
117static int wil_cfg80211_get_station(struct wiphy *wiphy,
118 struct net_device *ndev,
119 u8 *mac, struct station_info *sinfo)
120{
121 struct wil6210_priv *wil = wiphy_to_wil(wiphy);
122 int rc;
123 struct wmi_notify_req_cmd cmd = {
124 .cid = 0,
125 .interval_usec = 0,
126 };
127
128 if (memcmp(mac, wil->dst_addr[0], ETH_ALEN))
129 return -ENOENT;
130
131 /* WMI_NOTIFY_REQ_DONE_EVENTID handler fills wil->stats.bf_mcs */
132 rc = wmi_call(wil, WMI_NOTIFY_REQ_CMDID, &cmd, sizeof(cmd),
133 WMI_NOTIFY_REQ_DONE_EVENTID, NULL, 0, 20);
134 if (rc)
135 return rc;
136
137 sinfo->generation = wil->sinfo_gen;
138
139 sinfo->filled |= STATION_INFO_TX_BITRATE;
140 sinfo->txrate.flags = RATE_INFO_FLAGS_MCS | RATE_INFO_FLAGS_60G;
141 sinfo->txrate.mcs = wil->stats.bf_mcs;
142 sinfo->filled |= STATION_INFO_RX_BITRATE;
143 sinfo->rxrate.flags = RATE_INFO_FLAGS_MCS | RATE_INFO_FLAGS_60G;
144 sinfo->rxrate.mcs = wil->stats.last_mcs_rx;
145
146 if (test_bit(wil_status_fwconnected, &wil->status)) {
147 sinfo->filled |= STATION_INFO_SIGNAL;
148 sinfo->signal = 12; /* TODO: provide real value */
149 }
150
151 return 0;
152}
153
154static int wil_cfg80211_change_iface(struct wiphy *wiphy,
155 struct net_device *ndev,
156 enum nl80211_iftype type, u32 *flags,
157 struct vif_params *params)
158{
159 struct wil6210_priv *wil = wiphy_to_wil(wiphy);
160 struct wireless_dev *wdev = wil->wdev;
161
162 switch (type) {
163 case NL80211_IFTYPE_STATION:
164 case NL80211_IFTYPE_AP:
165 case NL80211_IFTYPE_P2P_CLIENT:
166 case NL80211_IFTYPE_P2P_GO:
167 break;
168 case NL80211_IFTYPE_MONITOR:
169 if (flags)
170 wil->monitor_flags = *flags;
171 else
172 wil->monitor_flags = 0;
173
174 break;
175 default:
176 return -EOPNOTSUPP;
177 }
178
179 wdev->iftype = type;
180
181 return 0;
182}
183
184static int wil_cfg80211_scan(struct wiphy *wiphy,
185 struct cfg80211_scan_request *request)
186{
187 struct wil6210_priv *wil = wiphy_to_wil(wiphy);
188 struct wireless_dev *wdev = wil->wdev;
189 struct {
190 struct wmi_start_scan_cmd cmd;
191 u16 chnl[4];
192 } __packed cmd;
193 uint i, n;
194
195 if (wil->scan_request) {
196 wil_err(wil, "Already scanning\n");
197 return -EAGAIN;
198 }
199
200 /* check we are client side */
201 switch (wdev->iftype) {
202 case NL80211_IFTYPE_STATION:
203 case NL80211_IFTYPE_P2P_CLIENT:
204 break;
205 default:
206 return -EOPNOTSUPP;
207
208 }
209
210 /* FW don't support scan after connection attempt */
211 if (test_bit(wil_status_dontscan, &wil->status)) {
212 wil_err(wil, "Scan after connect attempt not supported\n");
213 return -EBUSY;
214 }
215
216 wil->scan_request = request;
217
218 memset(&cmd, 0, sizeof(cmd));
219 cmd.cmd.num_channels = 0;
220 n = min(request->n_channels, 4U);
221 for (i = 0; i < n; i++) {
222 int ch = request->channels[i]->hw_value;
223 if (ch == 0) {
224 wil_err(wil,
225 "Scan requested for unknown frequency %dMhz\n",
226 request->channels[i]->center_freq);
227 continue;
228 }
229 /* 0-based channel indexes */
230 cmd.cmd.channel_list[cmd.cmd.num_channels++].channel = ch - 1;
231 wil_dbg(wil, "Scan for ch %d : %d MHz\n", ch,
232 request->channels[i]->center_freq);
233 }
234
235 return wmi_send(wil, WMI_START_SCAN_CMDID, &cmd, sizeof(cmd.cmd) +
236 cmd.cmd.num_channels * sizeof(cmd.cmd.channel_list[0]));
237}
238
239static int wil_cfg80211_connect(struct wiphy *wiphy,
240 struct net_device *ndev,
241 struct cfg80211_connect_params *sme)
242{
243 struct wil6210_priv *wil = wiphy_to_wil(wiphy);
244 struct cfg80211_bss *bss;
245 struct wmi_connect_cmd conn;
246 const u8 *ssid_eid;
247 const u8 *rsn_eid;
248 int ch;
249 int rc = 0;
250
251 bss = cfg80211_get_bss(wiphy, sme->channel, sme->bssid,
252 sme->ssid, sme->ssid_len,
253 WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
254 if (!bss) {
255 wil_err(wil, "Unable to find BSS\n");
256 return -ENOENT;
257 }
258
259 ssid_eid = ieee80211_bss_get_ie(bss, WLAN_EID_SSID);
260 if (!ssid_eid) {
261 wil_err(wil, "No SSID\n");
262 rc = -ENOENT;
263 goto out;
264 }
265
266 rsn_eid = sme->ie ?
267 cfg80211_find_ie(WLAN_EID_RSN, sme->ie, sme->ie_len) :
268 NULL;
269 if (rsn_eid) {
270 if (sme->ie_len > WMI_MAX_IE_LEN) {
271 rc = -ERANGE;
272 wil_err(wil, "IE too large (%td bytes)\n",
273 sme->ie_len);
274 goto out;
275 }
276 /*
277 * For secure assoc, send:
278 * (1) WMI_DELETE_CIPHER_KEY_CMD
279 * (2) WMI_SET_APPIE_CMD
280 */
281 rc = wmi_del_cipher_key(wil, 0, bss->bssid);
282 if (rc) {
283 wil_err(wil, "WMI_DELETE_CIPHER_KEY_CMD failed\n");
284 goto out;
285 }
286 /* WMI_SET_APPIE_CMD */
287 rc = wmi_set_ie(wil, WMI_FRAME_ASSOC_REQ, sme->ie_len, sme->ie);
288 if (rc) {
289 wil_err(wil, "WMI_SET_APPIE_CMD failed\n");
290 goto out;
291 }
292 }
293
294 /* WMI_CONNECT_CMD */
295 memset(&conn, 0, sizeof(conn));
296 switch (bss->capability & 0x03) {
297 case WLAN_CAPABILITY_DMG_TYPE_AP:
298 conn.network_type = WMI_NETTYPE_INFRA;
299 break;
300 case WLAN_CAPABILITY_DMG_TYPE_PBSS:
301 conn.network_type = WMI_NETTYPE_P2P;
302 break;
303 default:
304 wil_err(wil, "Unsupported BSS type, capability= 0x%04x\n",
305 bss->capability);
306 goto out;
307 }
308 if (rsn_eid) {
309 conn.dot11_auth_mode = WMI_AUTH11_SHARED;
310 conn.auth_mode = WMI_AUTH_WPA2_PSK;
311 conn.pairwise_crypto_type = WMI_CRYPT_AES_GCMP;
312 conn.pairwise_crypto_len = 16;
313 } else {
314 conn.dot11_auth_mode = WMI_AUTH11_OPEN;
315 conn.auth_mode = WMI_AUTH_NONE;
316 }
317
318 conn.ssid_len = min_t(u8, ssid_eid[1], 32);
319 memcpy(conn.ssid, ssid_eid+2, conn.ssid_len);
320
321 ch = bss->channel->hw_value;
322 if (ch == 0) {
323 wil_err(wil, "BSS at unknown frequency %dMhz\n",
324 bss->channel->center_freq);
325 rc = -EOPNOTSUPP;
326 goto out;
327 }
328 conn.channel = ch - 1;
329
330 memcpy(conn.bssid, bss->bssid, 6);
331 memcpy(conn.dst_mac, bss->bssid, 6);
332 /*
333 * FW don't support scan after connection attempt
334 */
335 set_bit(wil_status_dontscan, &wil->status);
336
337 rc = wmi_send(wil, WMI_CONNECT_CMDID, &conn, sizeof(conn));
338 if (rc == 0) {
339 /* Connect can take lots of time */
340 mod_timer(&wil->connect_timer,
341 jiffies + msecs_to_jiffies(2000));
342 }
343
344 out:
345 cfg80211_put_bss(bss);
346
347 return rc;
348}
349
350static int wil_cfg80211_disconnect(struct wiphy *wiphy,
351 struct net_device *ndev,
352 u16 reason_code)
353{
354 int rc;
355 struct wil6210_priv *wil = wiphy_to_wil(wiphy);
356
357 rc = wmi_send(wil, WMI_DISCONNECT_CMDID, NULL, 0);
358
359 return rc;
360}
361
362static int wil_cfg80211_set_channel(struct wiphy *wiphy,
363 struct cfg80211_chan_def *chandef)
364{
365 struct wil6210_priv *wil = wiphy_to_wil(wiphy);
366 struct wireless_dev *wdev = wil->wdev;
367
368 wdev->preset_chandef = *chandef;
369
370 return 0;
371}
372
373static int wil_cfg80211_add_key(struct wiphy *wiphy,
374 struct net_device *ndev,
375 u8 key_index, bool pairwise,
376 const u8 *mac_addr,
377 struct key_params *params)
378{
379 struct wil6210_priv *wil = wiphy_to_wil(wiphy);
380
381 /* group key is not used */
382 if (!pairwise)
383 return 0;
384
385 return wmi_add_cipher_key(wil, key_index, mac_addr,
386 params->key_len, params->key);
387}
388
389static int wil_cfg80211_del_key(struct wiphy *wiphy,
390 struct net_device *ndev,
391 u8 key_index, bool pairwise,
392 const u8 *mac_addr)
393{
394 struct wil6210_priv *wil = wiphy_to_wil(wiphy);
395
396 /* group key is not used */
397 if (!pairwise)
398 return 0;
399
400 return wmi_del_cipher_key(wil, key_index, mac_addr);
401}
402
403/* Need to be present or wiphy_new() will WARN */
404static int wil_cfg80211_set_default_key(struct wiphy *wiphy,
405 struct net_device *ndev,
406 u8 key_index, bool unicast,
407 bool multicast)
408{
409 return 0;
410}
411
412static int wil_cfg80211_start_ap(struct wiphy *wiphy,
413 struct net_device *ndev,
414 struct cfg80211_ap_settings *info)
415{
416 int rc = 0;
417 struct wil6210_priv *wil = wiphy_to_wil(wiphy);
418 struct wireless_dev *wdev = ndev->ieee80211_ptr;
419 struct ieee80211_channel *channel = info->chandef.chan;
420 struct cfg80211_beacon_data *bcon = &info->beacon;
421 u8 wmi_nettype = wil_iftype_nl2wmi(wdev->iftype);
422
423 if (!channel) {
424 wil_err(wil, "AP: No channel???\n");
425 return -EINVAL;
426 }
427
428 wil_dbg(wil, "AP on Channel %d %d MHz, %s\n", channel->hw_value,
429 channel->center_freq, info->privacy ? "secure" : "open");
430 print_hex_dump_bytes("SSID ", DUMP_PREFIX_OFFSET,
431 info->ssid, info->ssid_len);
432
433 rc = wil_reset(wil);
434 if (rc)
435 return rc;
436
437 rc = wmi_set_ssid(wil, info->ssid_len, info->ssid);
438 if (rc)
439 return rc;
440
441 rc = wmi_set_channel(wil, channel->hw_value);
442 if (rc)
443 return rc;
444
445 /* MAC address - pre-requisite for other commands */
446 wmi_set_mac_address(wil, ndev->dev_addr);
447
448 /* IE's */
449 /* bcon 'head IE's are not relevant for 60g band */
450 wmi_set_ie(wil, WMI_FRAME_BEACON, bcon->beacon_ies_len,
451 bcon->beacon_ies);
452 wmi_set_ie(wil, WMI_FRAME_PROBE_RESP, bcon->proberesp_ies_len,
453 bcon->proberesp_ies);
454 wmi_set_ie(wil, WMI_FRAME_ASSOC_RESP, bcon->assocresp_ies_len,
455 bcon->assocresp_ies);
456
457 wil->secure_pcp = info->privacy;
458
459 rc = wmi_set_bcon(wil, info->beacon_interval, wmi_nettype);
460 if (rc)
461 return rc;
462
463 /* Rx VRING. After MAC and beacon */
464 rc = wil_rx_init(wil);
465
466 netif_carrier_on(ndev);
467
468 return rc;
469}
470
471static int wil_cfg80211_stop_ap(struct wiphy *wiphy,
472 struct net_device *ndev)
473{
474 int rc = 0;
475 struct wil6210_priv *wil = wiphy_to_wil(wiphy);
476 struct wireless_dev *wdev = ndev->ieee80211_ptr;
477 u8 wmi_nettype = wil_iftype_nl2wmi(wdev->iftype);
478
479 /* To stop beaconing, set BI to 0 */
480 rc = wmi_set_bcon(wil, 0, wmi_nettype);
481
482 return rc;
483}
484
485static struct cfg80211_ops wil_cfg80211_ops = {
486 .scan = wil_cfg80211_scan,
487 .connect = wil_cfg80211_connect,
488 .disconnect = wil_cfg80211_disconnect,
489 .change_virtual_intf = wil_cfg80211_change_iface,
490 .get_station = wil_cfg80211_get_station,
491 .set_monitor_channel = wil_cfg80211_set_channel,
492 .add_key = wil_cfg80211_add_key,
493 .del_key = wil_cfg80211_del_key,
494 .set_default_key = wil_cfg80211_set_default_key,
495 /* AP mode */
496 .start_ap = wil_cfg80211_start_ap,
497 .stop_ap = wil_cfg80211_stop_ap,
498};
499
500static void wil_wiphy_init(struct wiphy *wiphy)
501{
502 /* TODO: set real value */
503 wiphy->max_scan_ssids = 10;
504 wiphy->max_num_pmkids = 0 /* TODO: */;
505 wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
506 BIT(NL80211_IFTYPE_AP) |
507 BIT(NL80211_IFTYPE_MONITOR);
508 /* TODO: enable P2P when integrated with supplicant:
509 * BIT(NL80211_IFTYPE_P2P_CLIENT) | BIT(NL80211_IFTYPE_P2P_GO)
510 */
511 wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME |
512 WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD;
513 dev_warn(wiphy_dev(wiphy), "%s : flags = 0x%08x\n",
514 __func__, wiphy->flags);
515 wiphy->probe_resp_offload =
516 NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS |
517 NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 |
518 NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P;
519
520 wiphy->bands[IEEE80211_BAND_60GHZ] = &wil_band_60ghz;
521
522 /* TODO: figure this out */
523 wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
524
525 wiphy->cipher_suites = wil_cipher_suites;
526 wiphy->n_cipher_suites = ARRAY_SIZE(wil_cipher_suites);
527 wiphy->mgmt_stypes = wil_mgmt_stypes;
528}
529
530struct wireless_dev *wil_cfg80211_init(struct device *dev)
531{
532 int rc = 0;
533 struct wireless_dev *wdev;
534
535 wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL);
536 if (!wdev)
537 return ERR_PTR(-ENOMEM);
538
539 wdev->wiphy = wiphy_new(&wil_cfg80211_ops,
540 sizeof(struct wil6210_priv));
541 if (!wdev->wiphy) {
542 rc = -ENOMEM;
543 goto out;
544 }
545
546 set_wiphy_dev(wdev->wiphy, dev);
547 wil_wiphy_init(wdev->wiphy);
548
549 rc = wiphy_register(wdev->wiphy);
550 if (rc < 0)
551 goto out_failed_reg;
552
553 return wdev;
554
555out_failed_reg:
556 wiphy_free(wdev->wiphy);
557out:
558 kfree(wdev);
559
560 return ERR_PTR(rc);
561}
562
563void wil_wdev_free(struct wil6210_priv *wil)
564{
565 struct wireless_dev *wdev = wil_to_wdev(wil);
566
567 if (!wdev)
568 return;
569
570 wiphy_unregister(wdev->wiphy);
571 wiphy_free(wdev->wiphy);
572 kfree(wdev);
573}
diff --git a/drivers/net/wireless/ath/wil6210/dbg_hexdump.h b/drivers/net/wireless/ath/wil6210/dbg_hexdump.h
new file mode 100644
index 000000000000..6a315ba5aa7d
--- /dev/null
+++ b/drivers/net/wireless/ath/wil6210/dbg_hexdump.h
@@ -0,0 +1,30 @@
1#ifndef WIL_DBG_HEXDUMP_H_
2#define WIL_DBG_HEXDUMP_H_
3
4#if defined(CONFIG_DYNAMIC_DEBUG)
5#define wil_dynamic_hex_dump(prefix_str, prefix_type, rowsize, \
6 groupsize, buf, len, ascii) \
7do { \
8 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, \
9 __builtin_constant_p(prefix_str) ? prefix_str : "hexdump");\
10 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \
11 print_hex_dump(KERN_DEBUG, prefix_str, \
12 prefix_type, rowsize, groupsize, \
13 buf, len, ascii); \
14} while (0)
15
16#define wil_print_hex_dump_debug(prefix_str, prefix_type, rowsize, \
17 groupsize, buf, len, ascii) \
18 wil_dynamic_hex_dump(prefix_str, prefix_type, rowsize, \
19 groupsize, buf, len, ascii)
20
21#define print_hex_dump_bytes(prefix_str, prefix_type, buf, len) \
22 wil_dynamic_hex_dump(prefix_str, prefix_type, 16, 1, buf, len, true)
23#else /* defined(CONFIG_DYNAMIC_DEBUG) */
24#define wil_print_hex_dump_debug(prefix_str, prefix_type, rowsize, \
25 groupsize, buf, len, ascii) \
26 print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, rowsize, \
27 groupsize, buf, len, ascii)
28#endif /* defined(CONFIG_DYNAMIC_DEBUG) */
29
30#endif /* WIL_DBG_HEXDUMP_H_ */
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c
new file mode 100644
index 000000000000..65fc9683bfd8
--- /dev/null
+++ b/drivers/net/wireless/ath/wil6210/debugfs.c
@@ -0,0 +1,603 @@
1/*
2 * Copyright (c) 2012 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#include <linux/module.h>
18#include <linux/debugfs.h>
19#include <linux/seq_file.h>
20#include <linux/pci.h>
21#include <linux/rtnetlink.h>
22
23#include "wil6210.h"
24#include "txrx.h"
25
26/* Nasty hack. Better have per device instances */
27static u32 mem_addr;
28static u32 dbg_txdesc_index;
29
30static void wil_print_vring(struct seq_file *s, struct wil6210_priv *wil,
31 const char *name, struct vring *vring)
32{
33 void __iomem *x = wmi_addr(wil, vring->hwtail);
34
35 seq_printf(s, "VRING %s = {\n", name);
36 seq_printf(s, " pa = 0x%016llx\n", (unsigned long long)vring->pa);
37 seq_printf(s, " va = 0x%p\n", vring->va);
38 seq_printf(s, " size = %d\n", vring->size);
39 seq_printf(s, " swtail = %d\n", vring->swtail);
40 seq_printf(s, " swhead = %d\n", vring->swhead);
41 seq_printf(s, " hwtail = [0x%08x] -> ", vring->hwtail);
42 if (x)
43 seq_printf(s, "0x%08x\n", ioread32(x));
44 else
45 seq_printf(s, "???\n");
46
47 if (vring->va && (vring->size < 1025)) {
48 uint i;
49 for (i = 0; i < vring->size; i++) {
50 volatile struct vring_tx_desc *d = &vring->va[i].tx;
51 if ((i % 64) == 0 && (i != 0))
52 seq_printf(s, "\n");
53 seq_printf(s, "%s", (d->dma.status & BIT(0)) ?
54 "S" : (vring->ctx[i] ? "H" : "h"));
55 }
56 seq_printf(s, "\n");
57 }
58 seq_printf(s, "}\n");
59}
60
61static int wil_vring_debugfs_show(struct seq_file *s, void *data)
62{
63 uint i;
64 struct wil6210_priv *wil = s->private;
65
66 wil_print_vring(s, wil, "rx", &wil->vring_rx);
67
68 for (i = 0; i < ARRAY_SIZE(wil->vring_tx); i++) {
69 struct vring *vring = &(wil->vring_tx[i]);
70 if (vring->va) {
71 char name[10];
72 snprintf(name, sizeof(name), "tx_%2d", i);
73 wil_print_vring(s, wil, name, vring);
74 }
75 }
76
77 return 0;
78}
79
80static int wil_vring_seq_open(struct inode *inode, struct file *file)
81{
82 return single_open(file, wil_vring_debugfs_show, inode->i_private);
83}
84
85static const struct file_operations fops_vring = {
86 .open = wil_vring_seq_open,
87 .release = single_release,
88 .read = seq_read,
89 .llseek = seq_lseek,
90};
91
92static void wil_print_ring(struct seq_file *s, const char *prefix,
93 void __iomem *off)
94{
95 struct wil6210_priv *wil = s->private;
96 struct wil6210_mbox_ring r;
97 int rsize;
98 uint i;
99
100 wil_memcpy_fromio_32(&r, off, sizeof(r));
101 wil_mbox_ring_le2cpus(&r);
102 /*
103 * we just read memory block from NIC. This memory may be
104 * garbage. Check validity before using it.
105 */
106 rsize = r.size / sizeof(struct wil6210_mbox_ring_desc);
107
108 seq_printf(s, "ring %s = {\n", prefix);
109 seq_printf(s, " base = 0x%08x\n", r.base);
110 seq_printf(s, " size = 0x%04x bytes -> %d entries\n", r.size, rsize);
111 seq_printf(s, " tail = 0x%08x\n", r.tail);
112 seq_printf(s, " head = 0x%08x\n", r.head);
113 seq_printf(s, " entry size = %d\n", r.entry_size);
114
115 if (r.size % sizeof(struct wil6210_mbox_ring_desc)) {
116 seq_printf(s, " ??? size is not multiple of %zd, garbage?\n",
117 sizeof(struct wil6210_mbox_ring_desc));
118 goto out;
119 }
120
121 if (!wmi_addr(wil, r.base) ||
122 !wmi_addr(wil, r.tail) ||
123 !wmi_addr(wil, r.head)) {
124 seq_printf(s, " ??? pointers are garbage?\n");
125 goto out;
126 }
127
128 for (i = 0; i < rsize; i++) {
129 struct wil6210_mbox_ring_desc d;
130 struct wil6210_mbox_hdr hdr;
131 size_t delta = i * sizeof(d);
132 void __iomem *x = wil->csr + HOSTADDR(r.base) + delta;
133
134 wil_memcpy_fromio_32(&d, x, sizeof(d));
135
136 seq_printf(s, " [%2x] %s %s%s 0x%08x", i,
137 d.sync ? "F" : "E",
138 (r.tail - r.base == delta) ? "t" : " ",
139 (r.head - r.base == delta) ? "h" : " ",
140 le32_to_cpu(d.addr));
141 if (0 == wmi_read_hdr(wil, d.addr, &hdr)) {
142 u16 len = le16_to_cpu(hdr.len);
143 seq_printf(s, " -> %04x %04x %04x %02x\n",
144 le16_to_cpu(hdr.seq), len,
145 le16_to_cpu(hdr.type), hdr.flags);
146 if (len <= MAX_MBOXITEM_SIZE) {
147 int n = 0;
148 unsigned char printbuf[16 * 3 + 2];
149 unsigned char databuf[MAX_MBOXITEM_SIZE];
150 void __iomem *src = wmi_buffer(wil, d.addr) +
151 sizeof(struct wil6210_mbox_hdr);
152 /*
153 * No need to check @src for validity -
154 * we already validated @d.addr while
155 * reading header
156 */
157 wil_memcpy_fromio_32(databuf, src, len);
158 while (n < len) {
159 int l = min(len - n, 16);
160 hex_dump_to_buffer(databuf + n, l,
161 16, 1, printbuf,
162 sizeof(printbuf),
163 false);
164 seq_printf(s, " : %s\n", printbuf);
165 n += l;
166 }
167 }
168 } else {
169 seq_printf(s, "\n");
170 }
171 }
172 out:
173 seq_printf(s, "}\n");
174}
175
176static int wil_mbox_debugfs_show(struct seq_file *s, void *data)
177{
178 struct wil6210_priv *wil = s->private;
179
180 wil_print_ring(s, "tx", wil->csr + HOST_MBOX +
181 offsetof(struct wil6210_mbox_ctl, tx));
182 wil_print_ring(s, "rx", wil->csr + HOST_MBOX +
183 offsetof(struct wil6210_mbox_ctl, rx));
184
185 return 0;
186}
187
188static int wil_mbox_seq_open(struct inode *inode, struct file *file)
189{
190 return single_open(file, wil_mbox_debugfs_show, inode->i_private);
191}
192
193static const struct file_operations fops_mbox = {
194 .open = wil_mbox_seq_open,
195 .release = single_release,
196 .read = seq_read,
197 .llseek = seq_lseek,
198};
199
200static int wil_debugfs_iomem_x32_set(void *data, u64 val)
201{
202 iowrite32(val, (void __iomem *)data);
203 wmb(); /* make sure write propagated to HW */
204
205 return 0;
206}
207
208static int wil_debugfs_iomem_x32_get(void *data, u64 *val)
209{
210 *val = ioread32((void __iomem *)data);
211
212 return 0;
213}
214
215DEFINE_SIMPLE_ATTRIBUTE(fops_iomem_x32, wil_debugfs_iomem_x32_get,
216 wil_debugfs_iomem_x32_set, "0x%08llx\n");
217
218static struct dentry *wil_debugfs_create_iomem_x32(const char *name,
219 mode_t mode,
220 struct dentry *parent,
221 void __iomem *value)
222{
223 return debugfs_create_file(name, mode, parent, (void * __force)value,
224 &fops_iomem_x32);
225}
226
227static int wil6210_debugfs_create_ISR(struct wil6210_priv *wil,
228 const char *name,
229 struct dentry *parent, u32 off)
230{
231 struct dentry *d = debugfs_create_dir(name, parent);
232
233 if (IS_ERR_OR_NULL(d))
234 return -ENODEV;
235
236 wil_debugfs_create_iomem_x32("ICC", S_IRUGO | S_IWUSR, d,
237 wil->csr + off);
238 wil_debugfs_create_iomem_x32("ICR", S_IRUGO | S_IWUSR, d,
239 wil->csr + off + 4);
240 wil_debugfs_create_iomem_x32("ICM", S_IRUGO | S_IWUSR, d,
241 wil->csr + off + 8);
242 wil_debugfs_create_iomem_x32("ICS", S_IWUSR, d,
243 wil->csr + off + 12);
244 wil_debugfs_create_iomem_x32("IMV", S_IRUGO | S_IWUSR, d,
245 wil->csr + off + 16);
246 wil_debugfs_create_iomem_x32("IMS", S_IWUSR, d,
247 wil->csr + off + 20);
248 wil_debugfs_create_iomem_x32("IMC", S_IWUSR, d,
249 wil->csr + off + 24);
250
251 return 0;
252}
253
254static int wil6210_debugfs_create_pseudo_ISR(struct wil6210_priv *wil,
255 struct dentry *parent)
256{
257 struct dentry *d = debugfs_create_dir("PSEUDO_ISR", parent);
258
259 if (IS_ERR_OR_NULL(d))
260 return -ENODEV;
261
262 wil_debugfs_create_iomem_x32("CAUSE", S_IRUGO, d, wil->csr +
263 HOSTADDR(RGF_DMA_PSEUDO_CAUSE));
264 wil_debugfs_create_iomem_x32("MASK_SW", S_IRUGO, d, wil->csr +
265 HOSTADDR(RGF_DMA_PSEUDO_CAUSE_MASK_SW));
266 wil_debugfs_create_iomem_x32("MASK_FW", S_IRUGO, d, wil->csr +
267 HOSTADDR(RGF_DMA_PSEUDO_CAUSE_MASK_FW));
268
269 return 0;
270}
271
272static int wil6210_debugfs_create_ITR_CNT(struct wil6210_priv *wil,
273 struct dentry *parent)
274{
275 struct dentry *d = debugfs_create_dir("ITR_CNT", parent);
276
277 if (IS_ERR_OR_NULL(d))
278 return -ENODEV;
279
280 wil_debugfs_create_iomem_x32("TRSH", S_IRUGO, d, wil->csr +
281 HOSTADDR(RGF_DMA_ITR_CNT_TRSH));
282 wil_debugfs_create_iomem_x32("DATA", S_IRUGO, d, wil->csr +
283 HOSTADDR(RGF_DMA_ITR_CNT_DATA));
284 wil_debugfs_create_iomem_x32("CTL", S_IRUGO, d, wil->csr +
285 HOSTADDR(RGF_DMA_ITR_CNT_CRL));
286
287 return 0;
288}
289
290static int wil_memread_debugfs_show(struct seq_file *s, void *data)
291{
292 struct wil6210_priv *wil = s->private;
293 void __iomem *a = wmi_buffer(wil, cpu_to_le32(mem_addr));
294
295 if (a)
296 seq_printf(s, "[0x%08x] = 0x%08x\n", mem_addr, ioread32(a));
297 else
298 seq_printf(s, "[0x%08x] = INVALID\n", mem_addr);
299
300 return 0;
301}
302
303static int wil_memread_seq_open(struct inode *inode, struct file *file)
304{
305 return single_open(file, wil_memread_debugfs_show, inode->i_private);
306}
307
308static const struct file_operations fops_memread = {
309 .open = wil_memread_seq_open,
310 .release = single_release,
311 .read = seq_read,
312 .llseek = seq_lseek,
313};
314
315static int wil_default_open(struct inode *inode, struct file *file)
316{
317 if (inode->i_private)
318 file->private_data = inode->i_private;
319
320 return 0;
321}
322
323static ssize_t wil_read_file_ioblob(struct file *file, char __user *user_buf,
324 size_t count, loff_t *ppos)
325{
326 enum { max_count = 4096 };
327 struct debugfs_blob_wrapper *blob = file->private_data;
328 loff_t pos = *ppos;
329 size_t available = blob->size;
330 void *buf;
331 size_t ret;
332
333 if (pos < 0)
334 return -EINVAL;
335
336 if (pos >= available || !count)
337 return 0;
338
339 if (count > available - pos)
340 count = available - pos;
341 if (count > max_count)
342 count = max_count;
343
344 buf = kmalloc(count, GFP_KERNEL);
345 if (!buf)
346 return -ENOMEM;
347
348 wil_memcpy_fromio_32(buf, (const volatile void __iomem *)blob->data +
349 pos, count);
350
351 ret = copy_to_user(user_buf, buf, count);
352 kfree(buf);
353 if (ret == count)
354 return -EFAULT;
355
356 count -= ret;
357 *ppos = pos + count;
358
359 return count;
360}
361
362static const struct file_operations fops_ioblob = {
363 .read = wil_read_file_ioblob,
364 .open = wil_default_open,
365 .llseek = default_llseek,
366};
367
368static
369struct dentry *wil_debugfs_create_ioblob(const char *name,
370 mode_t mode,
371 struct dentry *parent,
372 struct debugfs_blob_wrapper *blob)
373{
374 return debugfs_create_file(name, mode, parent, blob, &fops_ioblob);
375}
376/*---reset---*/
377static ssize_t wil_write_file_reset(struct file *file, const char __user *buf,
378 size_t len, loff_t *ppos)
379{
380 struct wil6210_priv *wil = file->private_data;
381 struct net_device *ndev = wil_to_ndev(wil);
382
383 /**
384 * BUG:
385 * this code does NOT sync device state with the rest of system
386 * use with care, debug only!!!
387 */
388 rtnl_lock();
389 dev_close(ndev);
390 ndev->flags &= ~IFF_UP;
391 rtnl_unlock();
392 wil_reset(wil);
393
394 return len;
395}
396
397static const struct file_operations fops_reset = {
398 .write = wil_write_file_reset,
399 .open = wil_default_open,
400};
401/*---------Tx descriptor------------*/
402
403static int wil_txdesc_debugfs_show(struct seq_file *s, void *data)
404{
405 struct wil6210_priv *wil = s->private;
406 struct vring *vring = &(wil->vring_tx[0]);
407
408 if (!vring->va) {
409 seq_printf(s, "No Tx VRING\n");
410 return 0;
411 }
412
413 if (dbg_txdesc_index < vring->size) {
414 volatile struct vring_tx_desc *d =
415 &(vring->va[dbg_txdesc_index].tx);
416 volatile u32 *u = (volatile u32 *)d;
417 struct sk_buff *skb = vring->ctx[dbg_txdesc_index];
418
419 seq_printf(s, "Tx[%3d] = {\n", dbg_txdesc_index);
420 seq_printf(s, " MAC = 0x%08x 0x%08x 0x%08x 0x%08x\n",
421 u[0], u[1], u[2], u[3]);
422 seq_printf(s, " DMA = 0x%08x 0x%08x 0x%08x 0x%08x\n",
423 u[4], u[5], u[6], u[7]);
424 seq_printf(s, " SKB = %p\n", skb);
425
426 if (skb) {
427 unsigned char printbuf[16 * 3 + 2];
428 int i = 0;
429 int len = skb_headlen(skb);
430 void *p = skb->data;
431
432 seq_printf(s, " len = %d\n", len);
433
434 while (i < len) {
435 int l = min(len - i, 16);
436 hex_dump_to_buffer(p + i, l, 16, 1, printbuf,
437 sizeof(printbuf), false);
438 seq_printf(s, " : %s\n", printbuf);
439 i += l;
440 }
441 }
442 seq_printf(s, "}\n");
443 } else {
444 seq_printf(s, "TxDesc index (%d) >= size (%d)\n",
445 dbg_txdesc_index, vring->size);
446 }
447
448 return 0;
449}
450
451static int wil_txdesc_seq_open(struct inode *inode, struct file *file)
452{
453 return single_open(file, wil_txdesc_debugfs_show, inode->i_private);
454}
455
456static const struct file_operations fops_txdesc = {
457 .open = wil_txdesc_seq_open,
458 .release = single_release,
459 .read = seq_read,
460 .llseek = seq_lseek,
461};
462
463/*---------beamforming------------*/
464static int wil_bf_debugfs_show(struct seq_file *s, void *data)
465{
466 struct wil6210_priv *wil = s->private;
467 seq_printf(s,
468 "TSF : 0x%016llx\n"
469 "TxMCS : %d\n"
470 "Sectors(rx:tx) my %2d:%2d peer %2d:%2d\n",
471 wil->stats.tsf, wil->stats.bf_mcs,
472 wil->stats.my_rx_sector, wil->stats.my_tx_sector,
473 wil->stats.peer_rx_sector, wil->stats.peer_tx_sector);
474 return 0;
475}
476
477static int wil_bf_seq_open(struct inode *inode, struct file *file)
478{
479 return single_open(file, wil_bf_debugfs_show, inode->i_private);
480}
481
482static const struct file_operations fops_bf = {
483 .open = wil_bf_seq_open,
484 .release = single_release,
485 .read = seq_read,
486 .llseek = seq_lseek,
487};
488/*---------SSID------------*/
489static ssize_t wil_read_file_ssid(struct file *file, char __user *user_buf,
490 size_t count, loff_t *ppos)
491{
492 struct wil6210_priv *wil = file->private_data;
493 struct wireless_dev *wdev = wil_to_wdev(wil);
494
495 return simple_read_from_buffer(user_buf, count, ppos,
496 wdev->ssid, wdev->ssid_len);
497}
498
499static ssize_t wil_write_file_ssid(struct file *file, const char __user *buf,
500 size_t count, loff_t *ppos)
501{
502 struct wil6210_priv *wil = file->private_data;
503 struct wireless_dev *wdev = wil_to_wdev(wil);
504 struct net_device *ndev = wil_to_ndev(wil);
505
506 if (*ppos != 0) {
507 wil_err(wil, "Unable to set SSID substring from [%d]\n",
508 (int)*ppos);
509 return -EINVAL;
510 }
511
512 if (count > sizeof(wdev->ssid)) {
513 wil_err(wil, "SSID too long, len = %d\n", (int)count);
514 return -EINVAL;
515 }
516 if (netif_running(ndev)) {
517 wil_err(wil, "Unable to change SSID on running interface\n");
518 return -EINVAL;
519 }
520
521 wdev->ssid_len = count;
522 return simple_write_to_buffer(wdev->ssid, wdev->ssid_len, ppos,
523 buf, count);
524}
525
526static const struct file_operations fops_ssid = {
527 .read = wil_read_file_ssid,
528 .write = wil_write_file_ssid,
529 .open = wil_default_open,
530};
531
532/*----------------*/
533int wil6210_debugfs_init(struct wil6210_priv *wil)
534{
535 struct dentry *dbg = wil->debug = debugfs_create_dir(WIL_NAME,
536 wil_to_wiphy(wil)->debugfsdir);
537
538 if (IS_ERR_OR_NULL(dbg))
539 return -ENODEV;
540
541 debugfs_create_file("mbox", S_IRUGO, dbg, wil, &fops_mbox);
542 debugfs_create_file("vrings", S_IRUGO, dbg, wil, &fops_vring);
543 debugfs_create_file("txdesc", S_IRUGO, dbg, wil, &fops_txdesc);
544 debugfs_create_u32("txdesc_index", S_IRUGO | S_IWUSR, dbg,
545 &dbg_txdesc_index);
546 debugfs_create_file("bf", S_IRUGO, dbg, wil, &fops_bf);
547 debugfs_create_file("ssid", S_IRUGO | S_IWUSR, dbg, wil, &fops_ssid);
548 debugfs_create_u32("secure_pcp", S_IRUGO | S_IWUSR, dbg,
549 &wil->secure_pcp);
550
551 wil6210_debugfs_create_ISR(wil, "USER_ICR", dbg,
552 HOSTADDR(RGF_USER_USER_ICR));
553 wil6210_debugfs_create_ISR(wil, "DMA_EP_TX_ICR", dbg,
554 HOSTADDR(RGF_DMA_EP_TX_ICR));
555 wil6210_debugfs_create_ISR(wil, "DMA_EP_RX_ICR", dbg,
556 HOSTADDR(RGF_DMA_EP_RX_ICR));
557 wil6210_debugfs_create_ISR(wil, "DMA_EP_MISC_ICR", dbg,
558 HOSTADDR(RGF_DMA_EP_MISC_ICR));
559 wil6210_debugfs_create_pseudo_ISR(wil, dbg);
560 wil6210_debugfs_create_ITR_CNT(wil, dbg);
561
562 debugfs_create_u32("mem_addr", S_IRUGO | S_IWUSR, dbg, &mem_addr);
563 debugfs_create_file("mem_val", S_IRUGO, dbg, wil, &fops_memread);
564
565 debugfs_create_file("reset", S_IWUSR, dbg, wil, &fops_reset);
566
567 wil->rgf_blob.data = (void * __force)wil->csr + 0;
568 wil->rgf_blob.size = 0xa000;
569 wil_debugfs_create_ioblob("blob_rgf", S_IRUGO, dbg, &wil->rgf_blob);
570
571 wil->fw_code_blob.data = (void * __force)wil->csr + 0x40000;
572 wil->fw_code_blob.size = 0x40000;
573 wil_debugfs_create_ioblob("blob_fw_code", S_IRUGO, dbg,
574 &wil->fw_code_blob);
575
576 wil->fw_data_blob.data = (void * __force)wil->csr + 0x80000;
577 wil->fw_data_blob.size = 0x8000;
578 wil_debugfs_create_ioblob("blob_fw_data", S_IRUGO, dbg,
579 &wil->fw_data_blob);
580
581 wil->fw_peri_blob.data = (void * __force)wil->csr + 0x88000;
582 wil->fw_peri_blob.size = 0x18000;
583 wil_debugfs_create_ioblob("blob_fw_peri", S_IRUGO, dbg,
584 &wil->fw_peri_blob);
585
586 wil->uc_code_blob.data = (void * __force)wil->csr + 0xa0000;
587 wil->uc_code_blob.size = 0x10000;
588 wil_debugfs_create_ioblob("blob_uc_code", S_IRUGO, dbg,
589 &wil->uc_code_blob);
590
591 wil->uc_data_blob.data = (void * __force)wil->csr + 0xb0000;
592 wil->uc_data_blob.size = 0x4000;
593 wil_debugfs_create_ioblob("blob_uc_data", S_IRUGO, dbg,
594 &wil->uc_data_blob);
595
596 return 0;
597}
598
599void wil6210_debugfs_remove(struct wil6210_priv *wil)
600{
601 debugfs_remove_recursive(wil->debug);
602 wil->debug = NULL;
603}
diff --git a/drivers/net/wireless/ath/wil6210/interrupt.c b/drivers/net/wireless/ath/wil6210/interrupt.c
new file mode 100644
index 000000000000..38049da71049
--- /dev/null
+++ b/drivers/net/wireless/ath/wil6210/interrupt.c
@@ -0,0 +1,471 @@
1/*
2 * Copyright (c) 2012 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#include <linux/interrupt.h>
18
19#include "wil6210.h"
20
21/**
22 * Theory of operation:
23 *
24 * There is ISR pseudo-cause register,
25 * dma_rgf->DMA_RGF.PSEUDO_CAUSE.PSEUDO_CAUSE
26 * Its bits represents OR'ed bits from 3 real ISR registers:
27 * TX, RX, and MISC.
28 *
29 * Registers may be configured to either "write 1 to clear" or
30 * "clear on read" mode
31 *
32 * When handling interrupt, one have to mask/unmask interrupts for the
33 * real ISR registers, or hardware may malfunction.
34 *
35 */
36
37#define WIL6210_IRQ_DISABLE (0xFFFFFFFFUL)
38#define WIL6210_IMC_RX BIT_DMA_EP_RX_ICR_RX_DONE
39#define WIL6210_IMC_TX (BIT_DMA_EP_TX_ICR_TX_DONE | \
40 BIT_DMA_EP_TX_ICR_TX_DONE_N(0))
41#define WIL6210_IMC_MISC (ISR_MISC_FW_READY | ISR_MISC_MBOX_EVT)
42
43#define WIL6210_IRQ_PSEUDO_MASK (u32)(~(BIT_DMA_PSEUDO_CAUSE_RX | \
44 BIT_DMA_PSEUDO_CAUSE_TX | \
45 BIT_DMA_PSEUDO_CAUSE_MISC))
46
47#if defined(CONFIG_WIL6210_ISR_COR)
48/* configure to Clear-On-Read mode */
49#define WIL_ICR_ICC_VALUE (0xFFFFFFFFUL)
50
51static inline void wil_icr_clear(u32 x, void __iomem *addr)
52{
53
54}
55#else /* defined(CONFIG_WIL6210_ISR_COR) */
56/* configure to Write-1-to-Clear mode */
57#define WIL_ICR_ICC_VALUE (0UL)
58
59static inline void wil_icr_clear(u32 x, void __iomem *addr)
60{
61 iowrite32(x, addr);
62}
63#endif /* defined(CONFIG_WIL6210_ISR_COR) */
64
65static inline u32 wil_ioread32_and_clear(void __iomem *addr)
66{
67 u32 x = ioread32(addr);
68
69 wil_icr_clear(x, addr);
70
71 return x;
72}
73
74static void wil6210_mask_irq_tx(struct wil6210_priv *wil)
75{
76 iowrite32(WIL6210_IRQ_DISABLE, wil->csr +
77 HOSTADDR(RGF_DMA_EP_TX_ICR) +
78 offsetof(struct RGF_ICR, IMS));
79}
80
81static void wil6210_mask_irq_rx(struct wil6210_priv *wil)
82{
83 iowrite32(WIL6210_IRQ_DISABLE, wil->csr +
84 HOSTADDR(RGF_DMA_EP_RX_ICR) +
85 offsetof(struct RGF_ICR, IMS));
86}
87
88static void wil6210_mask_irq_misc(struct wil6210_priv *wil)
89{
90 iowrite32(WIL6210_IRQ_DISABLE, wil->csr +
91 HOSTADDR(RGF_DMA_EP_MISC_ICR) +
92 offsetof(struct RGF_ICR, IMS));
93}
94
95static void wil6210_mask_irq_pseudo(struct wil6210_priv *wil)
96{
97 wil_dbg_IRQ(wil, "%s()\n", __func__);
98
99 iowrite32(WIL6210_IRQ_DISABLE, wil->csr +
100 HOSTADDR(RGF_DMA_PSEUDO_CAUSE_MASK_SW));
101
102 clear_bit(wil_status_irqen, &wil->status);
103}
104
105static void wil6210_unmask_irq_tx(struct wil6210_priv *wil)
106{
107 iowrite32(WIL6210_IMC_TX, wil->csr +
108 HOSTADDR(RGF_DMA_EP_TX_ICR) +
109 offsetof(struct RGF_ICR, IMC));
110}
111
112static void wil6210_unmask_irq_rx(struct wil6210_priv *wil)
113{
114 iowrite32(WIL6210_IMC_RX, wil->csr +
115 HOSTADDR(RGF_DMA_EP_RX_ICR) +
116 offsetof(struct RGF_ICR, IMC));
117}
118
119static void wil6210_unmask_irq_misc(struct wil6210_priv *wil)
120{
121 iowrite32(WIL6210_IMC_MISC, wil->csr +
122 HOSTADDR(RGF_DMA_EP_MISC_ICR) +
123 offsetof(struct RGF_ICR, IMC));
124}
125
126static void wil6210_unmask_irq_pseudo(struct wil6210_priv *wil)
127{
128 wil_dbg_IRQ(wil, "%s()\n", __func__);
129
130 set_bit(wil_status_irqen, &wil->status);
131
132 iowrite32(WIL6210_IRQ_PSEUDO_MASK, wil->csr +
133 HOSTADDR(RGF_DMA_PSEUDO_CAUSE_MASK_SW));
134}
135
136void wil6210_disable_irq(struct wil6210_priv *wil)
137{
138 wil_dbg_IRQ(wil, "%s()\n", __func__);
139
140 wil6210_mask_irq_tx(wil);
141 wil6210_mask_irq_rx(wil);
142 wil6210_mask_irq_misc(wil);
143 wil6210_mask_irq_pseudo(wil);
144}
145
146void wil6210_enable_irq(struct wil6210_priv *wil)
147{
148 wil_dbg_IRQ(wil, "%s()\n", __func__);
149
150 iowrite32(WIL_ICR_ICC_VALUE, wil->csr + HOSTADDR(RGF_DMA_EP_RX_ICR) +
151 offsetof(struct RGF_ICR, ICC));
152 iowrite32(WIL_ICR_ICC_VALUE, wil->csr + HOSTADDR(RGF_DMA_EP_TX_ICR) +
153 offsetof(struct RGF_ICR, ICC));
154 iowrite32(WIL_ICR_ICC_VALUE, wil->csr + HOSTADDR(RGF_DMA_EP_MISC_ICR) +
155 offsetof(struct RGF_ICR, ICC));
156
157 wil6210_unmask_irq_pseudo(wil);
158 wil6210_unmask_irq_tx(wil);
159 wil6210_unmask_irq_rx(wil);
160 wil6210_unmask_irq_misc(wil);
161}
162
163static irqreturn_t wil6210_irq_rx(int irq, void *cookie)
164{
165 struct wil6210_priv *wil = cookie;
166 u32 isr = wil_ioread32_and_clear(wil->csr +
167 HOSTADDR(RGF_DMA_EP_RX_ICR) +
168 offsetof(struct RGF_ICR, ICR));
169
170 wil_dbg_IRQ(wil, "ISR RX 0x%08x\n", isr);
171
172 if (!isr) {
173 wil_err(wil, "spurious IRQ: RX\n");
174 return IRQ_NONE;
175 }
176
177 wil6210_mask_irq_rx(wil);
178
179 if (isr & BIT_DMA_EP_RX_ICR_RX_DONE) {
180 wil_dbg_IRQ(wil, "RX done\n");
181 isr &= ~BIT_DMA_EP_RX_ICR_RX_DONE;
182 wil_rx_handle(wil);
183 }
184
185 if (isr)
186 wil_err(wil, "un-handled RX ISR bits 0x%08x\n", isr);
187
188 wil6210_unmask_irq_rx(wil);
189
190 return IRQ_HANDLED;
191}
192
193static irqreturn_t wil6210_irq_tx(int irq, void *cookie)
194{
195 struct wil6210_priv *wil = cookie;
196 u32 isr = wil_ioread32_and_clear(wil->csr +
197 HOSTADDR(RGF_DMA_EP_TX_ICR) +
198 offsetof(struct RGF_ICR, ICR));
199
200 wil_dbg_IRQ(wil, "ISR TX 0x%08x\n", isr);
201
202 if (!isr) {
203 wil_err(wil, "spurious IRQ: TX\n");
204 return IRQ_NONE;
205 }
206
207 wil6210_mask_irq_tx(wil);
208
209 if (isr & BIT_DMA_EP_TX_ICR_TX_DONE) {
210 uint i;
211 wil_dbg_IRQ(wil, "TX done\n");
212 isr &= ~BIT_DMA_EP_TX_ICR_TX_DONE;
213 for (i = 0; i < 24; i++) {
214 u32 mask = BIT_DMA_EP_TX_ICR_TX_DONE_N(i);
215 if (isr & mask) {
216 isr &= ~mask;
217 wil_dbg_IRQ(wil, "TX done(%i)\n", i);
218 wil_tx_complete(wil, i);
219 }
220 }
221 }
222
223 if (isr)
224 wil_err(wil, "un-handled TX ISR bits 0x%08x\n", isr);
225
226 wil6210_unmask_irq_tx(wil);
227
228 return IRQ_HANDLED;
229}
230
231static irqreturn_t wil6210_irq_misc(int irq, void *cookie)
232{
233 struct wil6210_priv *wil = cookie;
234 u32 isr = wil_ioread32_and_clear(wil->csr +
235 HOSTADDR(RGF_DMA_EP_MISC_ICR) +
236 offsetof(struct RGF_ICR, ICR));
237
238 wil_dbg_IRQ(wil, "ISR MISC 0x%08x\n", isr);
239
240 if (!isr) {
241 wil_err(wil, "spurious IRQ: MISC\n");
242 return IRQ_NONE;
243 }
244
245 wil6210_mask_irq_misc(wil);
246
247 if (isr & ISR_MISC_FW_READY) {
248 wil_dbg_IRQ(wil, "IRQ: FW ready\n");
249 /**
250 * Actual FW ready indicated by the
251 * WMI_FW_READY_EVENTID
252 */
253 isr &= ~ISR_MISC_FW_READY;
254 }
255
256 wil->isr_misc = isr;
257
258 if (isr) {
259 return IRQ_WAKE_THREAD;
260 } else {
261 wil6210_unmask_irq_misc(wil);
262 return IRQ_HANDLED;
263 }
264}
265
266static irqreturn_t wil6210_irq_misc_thread(int irq, void *cookie)
267{
268 struct wil6210_priv *wil = cookie;
269 u32 isr = wil->isr_misc;
270
271 wil_dbg_IRQ(wil, "Thread ISR MISC 0x%08x\n", isr);
272
273 if (isr & ISR_MISC_MBOX_EVT) {
274 wil_dbg_IRQ(wil, "MBOX event\n");
275 wmi_recv_cmd(wil);
276 isr &= ~ISR_MISC_MBOX_EVT;
277 }
278
279 if (isr)
280 wil_err(wil, "un-handled MISC ISR bits 0x%08x\n", isr);
281
282 wil->isr_misc = 0;
283
284 wil6210_unmask_irq_misc(wil);
285
286 return IRQ_HANDLED;
287}
288
289/**
290 * thread IRQ handler
291 */
292static irqreturn_t wil6210_thread_irq(int irq, void *cookie)
293{
294 struct wil6210_priv *wil = cookie;
295
296 wil_dbg_IRQ(wil, "Thread IRQ\n");
297 /* Discover real IRQ cause */
298 if (wil->isr_misc)
299 wil6210_irq_misc_thread(irq, cookie);
300
301 wil6210_unmask_irq_pseudo(wil);
302
303 return IRQ_HANDLED;
304}
305
306/* DEBUG
307 * There is subtle bug in hardware that causes IRQ to raise when it should be
308 * masked. It is quite rare and hard to debug.
309 *
310 * Catch irq issue if it happens and print all I can.
311 */
312static int wil6210_debug_irq_mask(struct wil6210_priv *wil, u32 pseudo_cause)
313{
314 if (!test_bit(wil_status_irqen, &wil->status)) {
315 u32 icm_rx = wil_ioread32_and_clear(wil->csr +
316 HOSTADDR(RGF_DMA_EP_RX_ICR) +
317 offsetof(struct RGF_ICR, ICM));
318 u32 icr_rx = wil_ioread32_and_clear(wil->csr +
319 HOSTADDR(RGF_DMA_EP_RX_ICR) +
320 offsetof(struct RGF_ICR, ICR));
321 u32 imv_rx = ioread32(wil->csr +
322 HOSTADDR(RGF_DMA_EP_RX_ICR) +
323 offsetof(struct RGF_ICR, IMV));
324 u32 icm_tx = wil_ioread32_and_clear(wil->csr +
325 HOSTADDR(RGF_DMA_EP_TX_ICR) +
326 offsetof(struct RGF_ICR, ICM));
327 u32 icr_tx = wil_ioread32_and_clear(wil->csr +
328 HOSTADDR(RGF_DMA_EP_TX_ICR) +
329 offsetof(struct RGF_ICR, ICR));
330 u32 imv_tx = ioread32(wil->csr +
331 HOSTADDR(RGF_DMA_EP_TX_ICR) +
332 offsetof(struct RGF_ICR, IMV));
333 u32 icm_misc = wil_ioread32_and_clear(wil->csr +
334 HOSTADDR(RGF_DMA_EP_MISC_ICR) +
335 offsetof(struct RGF_ICR, ICM));
336 u32 icr_misc = wil_ioread32_and_clear(wil->csr +
337 HOSTADDR(RGF_DMA_EP_MISC_ICR) +
338 offsetof(struct RGF_ICR, ICR));
339 u32 imv_misc = ioread32(wil->csr +
340 HOSTADDR(RGF_DMA_EP_MISC_ICR) +
341 offsetof(struct RGF_ICR, IMV));
342 wil_err(wil, "IRQ when it should be masked: pseudo 0x%08x\n"
343 "Rx icm:icr:imv 0x%08x 0x%08x 0x%08x\n"
344 "Tx icm:icr:imv 0x%08x 0x%08x 0x%08x\n"
345 "Misc icm:icr:imv 0x%08x 0x%08x 0x%08x\n",
346 pseudo_cause,
347 icm_rx, icr_rx, imv_rx,
348 icm_tx, icr_tx, imv_tx,
349 icm_misc, icr_misc, imv_misc);
350
351 return -EINVAL;
352 }
353
354 return 0;
355}
356
357static irqreturn_t wil6210_hardirq(int irq, void *cookie)
358{
359 irqreturn_t rc = IRQ_HANDLED;
360 struct wil6210_priv *wil = cookie;
361 u32 pseudo_cause = ioread32(wil->csr + HOSTADDR(RGF_DMA_PSEUDO_CAUSE));
362
363 /**
364 * pseudo_cause is Clear-On-Read, no need to ACK
365 */
366 if ((pseudo_cause == 0) || ((pseudo_cause & 0xff) == 0xff))
367 return IRQ_NONE;
368
369 /* FIXME: IRQ mask debug */
370 if (wil6210_debug_irq_mask(wil, pseudo_cause))
371 return IRQ_NONE;
372
373 wil6210_mask_irq_pseudo(wil);
374
375 /* Discover real IRQ cause
376 * There are 2 possible phases for every IRQ:
377 * - hard IRQ handler called right here
378 * - threaded handler called later
379 *
380 * Hard IRQ handler reads and clears ISR.
381 *
382 * If threaded handler requested, hard IRQ handler
383 * returns IRQ_WAKE_THREAD and saves ISR register value
384 * for the threaded handler use.
385 *
386 * voting for wake thread - need at least 1 vote
387 */
388 if ((pseudo_cause & BIT_DMA_PSEUDO_CAUSE_RX) &&
389 (wil6210_irq_rx(irq, cookie) == IRQ_WAKE_THREAD))
390 rc = IRQ_WAKE_THREAD;
391
392 if ((pseudo_cause & BIT_DMA_PSEUDO_CAUSE_TX) &&
393 (wil6210_irq_tx(irq, cookie) == IRQ_WAKE_THREAD))
394 rc = IRQ_WAKE_THREAD;
395
396 if ((pseudo_cause & BIT_DMA_PSEUDO_CAUSE_MISC) &&
397 (wil6210_irq_misc(irq, cookie) == IRQ_WAKE_THREAD))
398 rc = IRQ_WAKE_THREAD;
399
400 /* if thread is requested, it will unmask IRQ */
401 if (rc != IRQ_WAKE_THREAD)
402 wil6210_unmask_irq_pseudo(wil);
403
404 wil_dbg_IRQ(wil, "Hard IRQ 0x%08x\n", pseudo_cause);
405
406 return rc;
407}
408
409static int wil6210_request_3msi(struct wil6210_priv *wil, int irq)
410{
411 int rc;
412 /*
413 * IRQ's are in the following order:
414 * - Tx
415 * - Rx
416 * - Misc
417 */
418
419 rc = request_irq(irq, wil6210_irq_tx, IRQF_SHARED,
420 WIL_NAME"_tx", wil);
421 if (rc)
422 return rc;
423
424 rc = request_irq(irq + 1, wil6210_irq_rx, IRQF_SHARED,
425 WIL_NAME"_rx", wil);
426 if (rc)
427 goto free0;
428
429 rc = request_threaded_irq(irq + 2, wil6210_irq_misc,
430 wil6210_irq_misc_thread,
431 IRQF_SHARED, WIL_NAME"_misc", wil);
432 if (rc)
433 goto free1;
434
435 return 0;
436 /* error branch */
437free1:
438 free_irq(irq + 1, wil);
439free0:
440 free_irq(irq, wil);
441
442 return rc;
443}
444
445int wil6210_init_irq(struct wil6210_priv *wil, int irq)
446{
447 int rc;
448 if (wil->n_msi == 3)
449 rc = wil6210_request_3msi(wil, irq);
450 else
451 rc = request_threaded_irq(irq, wil6210_hardirq,
452 wil6210_thread_irq,
453 wil->n_msi ? 0 : IRQF_SHARED,
454 WIL_NAME, wil);
455 if (rc)
456 return rc;
457
458 wil6210_enable_irq(wil);
459
460 return 0;
461}
462
463void wil6210_fini_irq(struct wil6210_priv *wil, int irq)
464{
465 wil6210_disable_irq(wil);
466 free_irq(irq, wil);
467 if (wil->n_msi == 3) {
468 free_irq(irq + 1, wil);
469 free_irq(irq + 2, wil);
470 }
471}
diff --git a/drivers/net/wireless/ath/wil6210/main.c b/drivers/net/wireless/ath/wil6210/main.c
new file mode 100644
index 000000000000..95fcd361322b
--- /dev/null
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -0,0 +1,407 @@
1/*
2 * Copyright (c) 2012 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#include <linux/kernel.h>
18#include <linux/netdevice.h>
19#include <linux/sched.h>
20#include <linux/ieee80211.h>
21#include <linux/wireless.h>
22#include <linux/slab.h>
23#include <linux/moduleparam.h>
24#include <linux/if_arp.h>
25
26#include "wil6210.h"
27
28/*
29 * Due to a hardware issue,
30 * one has to read/write to/from NIC in 32-bit chunks;
31 * regular memcpy_fromio and siblings will
32 * not work on 64-bit platform - it uses 64-bit transactions
33 *
34 * Force 32-bit transactions to enable NIC on 64-bit platforms
35 *
36 * To avoid byte swap on big endian host, __raw_{read|write}l
37 * should be used - {read|write}l would swap bytes to provide
38 * little endian on PCI value in host endianness.
39 */
40void wil_memcpy_fromio_32(void *dst, const volatile void __iomem *src,
41 size_t count)
42{
43 u32 *d = dst;
44 const volatile u32 __iomem *s = src;
45
46 /* size_t is unsigned, if (count%4 != 0) it will wrap */
47 for (count += 4; count > 4; count -= 4)
48 *d++ = __raw_readl(s++);
49}
50
51void wil_memcpy_toio_32(volatile void __iomem *dst, const void *src,
52 size_t count)
53{
54 volatile u32 __iomem *d = dst;
55 const u32 *s = src;
56
57 for (count += 4; count > 4; count -= 4)
58 __raw_writel(*s++, d++);
59}
60
61static void _wil6210_disconnect(struct wil6210_priv *wil, void *bssid)
62{
63 uint i;
64 struct net_device *ndev = wil_to_ndev(wil);
65 struct wireless_dev *wdev = wil->wdev;
66
67 wil_dbg(wil, "%s()\n", __func__);
68
69 wil_link_off(wil);
70 clear_bit(wil_status_fwconnected, &wil->status);
71
72 switch (wdev->sme_state) {
73 case CFG80211_SME_CONNECTED:
74 cfg80211_disconnected(ndev, WLAN_STATUS_UNSPECIFIED_FAILURE,
75 NULL, 0, GFP_KERNEL);
76 break;
77 case CFG80211_SME_CONNECTING:
78 cfg80211_connect_result(ndev, bssid, NULL, 0, NULL, 0,
79 WLAN_STATUS_UNSPECIFIED_FAILURE,
80 GFP_KERNEL);
81 break;
82 default:
83 ;
84 }
85
86 for (i = 0; i < ARRAY_SIZE(wil->vring_tx); i++)
87 wil_vring_fini_tx(wil, i);
88}
89
90static void wil_disconnect_worker(struct work_struct *work)
91{
92 struct wil6210_priv *wil = container_of(work,
93 struct wil6210_priv, disconnect_worker);
94
95 _wil6210_disconnect(wil, NULL);
96}
97
98static void wil_connect_timer_fn(ulong x)
99{
100 struct wil6210_priv *wil = (void *)x;
101
102 wil_dbg(wil, "Connect timeout\n");
103
104 /* reschedule to thread context - disconnect won't
105 * run from atomic context
106 */
107 schedule_work(&wil->disconnect_worker);
108}
109
110int wil_priv_init(struct wil6210_priv *wil)
111{
112 wil_dbg(wil, "%s()\n", __func__);
113
114 mutex_init(&wil->mutex);
115 mutex_init(&wil->wmi_mutex);
116
117 init_completion(&wil->wmi_ready);
118
119 wil->pending_connect_cid = -1;
120 setup_timer(&wil->connect_timer, wil_connect_timer_fn, (ulong)wil);
121
122 INIT_WORK(&wil->wmi_connect_worker, wmi_connect_worker);
123 INIT_WORK(&wil->disconnect_worker, wil_disconnect_worker);
124 INIT_WORK(&wil->wmi_event_worker, wmi_event_worker);
125
126 INIT_LIST_HEAD(&wil->pending_wmi_ev);
127 spin_lock_init(&wil->wmi_ev_lock);
128
129 wil->wmi_wq = create_singlethread_workqueue(WIL_NAME"_wmi");
130 if (!wil->wmi_wq)
131 return -EAGAIN;
132
133 wil->wmi_wq_conn = create_singlethread_workqueue(WIL_NAME"_connect");
134 if (!wil->wmi_wq_conn) {
135 destroy_workqueue(wil->wmi_wq);
136 return -EAGAIN;
137 }
138
139 /* make shadow copy of registers that should not change on run time */
140 wil_memcpy_fromio_32(&wil->mbox_ctl, wil->csr + HOST_MBOX,
141 sizeof(struct wil6210_mbox_ctl));
142 wil_mbox_ring_le2cpus(&wil->mbox_ctl.rx);
143 wil_mbox_ring_le2cpus(&wil->mbox_ctl.tx);
144
145 return 0;
146}
147
148void wil6210_disconnect(struct wil6210_priv *wil, void *bssid)
149{
150 del_timer_sync(&wil->connect_timer);
151 _wil6210_disconnect(wil, bssid);
152}
153
154void wil_priv_deinit(struct wil6210_priv *wil)
155{
156 cancel_work_sync(&wil->disconnect_worker);
157 wil6210_disconnect(wil, NULL);
158 wmi_event_flush(wil);
159 destroy_workqueue(wil->wmi_wq_conn);
160 destroy_workqueue(wil->wmi_wq);
161}
162
163static void wil_target_reset(struct wil6210_priv *wil)
164{
165 wil_dbg(wil, "Resetting...\n");
166
167 /* register write */
168#define W(a, v) iowrite32(v, wil->csr + HOSTADDR(a))
169 /* register set = read, OR, write */
170#define S(a, v) iowrite32(ioread32(wil->csr + HOSTADDR(a)) | v, \
171 wil->csr + HOSTADDR(a))
172
173 /* hpal_perst_from_pad_src_n_mask */
174 S(RGF_USER_CLKS_CTL_SW_RST_MASK_0, BIT(6));
175 /* car_perst_rst_src_n_mask */
176 S(RGF_USER_CLKS_CTL_SW_RST_MASK_0, BIT(7));
177
178 W(RGF_USER_MAC_CPU_0, BIT(1)); /* mac_cpu_man_rst */
179 W(RGF_USER_USER_CPU_0, BIT(1)); /* user_cpu_man_rst */
180
181 msleep(100);
182
183 W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0xFE000000);
184 W(RGF_USER_CLKS_CTL_SW_RST_VEC_1, 0x0000003F);
185 W(RGF_USER_CLKS_CTL_SW_RST_VEC_3, 0x00000170);
186 W(RGF_USER_CLKS_CTL_SW_RST_VEC_0, 0xFFE7FC00);
187
188 msleep(100);
189
190 W(RGF_USER_CLKS_CTL_SW_RST_VEC_3, 0);
191 W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0);
192 W(RGF_USER_CLKS_CTL_SW_RST_VEC_1, 0);
193 W(RGF_USER_CLKS_CTL_SW_RST_VEC_0, 0);
194
195 W(RGF_USER_CLKS_CTL_SW_RST_VEC_3, 0x00000001);
196 W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0x00000080);
197 W(RGF_USER_CLKS_CTL_SW_RST_VEC_0, 0);
198
199 msleep(2000);
200
201 W(RGF_USER_USER_CPU_0, BIT(0)); /* user_cpu_man_de_rst */
202
203 msleep(2000);
204
205 wil_dbg(wil, "Reset completed\n");
206
207#undef W
208#undef S
209}
210
211void wil_mbox_ring_le2cpus(struct wil6210_mbox_ring *r)
212{
213 le32_to_cpus(&r->base);
214 le16_to_cpus(&r->entry_size);
215 le16_to_cpus(&r->size);
216 le32_to_cpus(&r->tail);
217 le32_to_cpus(&r->head);
218}
219
220static int wil_wait_for_fw_ready(struct wil6210_priv *wil)
221{
222 ulong to = msecs_to_jiffies(1000);
223 ulong left = wait_for_completion_timeout(&wil->wmi_ready, to);
224 if (0 == left) {
225 wil_err(wil, "Firmware not ready\n");
226 return -ETIME;
227 } else {
228 wil_dbg(wil, "FW ready after %d ms\n",
229 jiffies_to_msecs(to-left));
230 }
231 return 0;
232}
233
234/*
235 * We reset all the structures, and we reset the UMAC.
236 * After calling this routine, you're expected to reload
237 * the firmware.
238 */
239int wil_reset(struct wil6210_priv *wil)
240{
241 int rc;
242
243 cancel_work_sync(&wil->disconnect_worker);
244 wil6210_disconnect(wil, NULL);
245
246 wmi_event_flush(wil);
247
248 flush_workqueue(wil->wmi_wq);
249 flush_workqueue(wil->wmi_wq_conn);
250
251 wil6210_disable_irq(wil);
252 wil->status = 0;
253
254 /* TODO: put MAC in reset */
255 wil_target_reset(wil);
256
257 /* init after reset */
258 wil->pending_connect_cid = -1;
259 INIT_COMPLETION(wil->wmi_ready);
260
261 /* make shadow copy of registers that should not change on run time */
262 wil_memcpy_fromio_32(&wil->mbox_ctl, wil->csr + HOST_MBOX,
263 sizeof(struct wil6210_mbox_ctl));
264 wil_mbox_ring_le2cpus(&wil->mbox_ctl.rx);
265 wil_mbox_ring_le2cpus(&wil->mbox_ctl.tx);
266
267 /* TODO: release MAC reset */
268 wil6210_enable_irq(wil);
269
270 /* we just started MAC, wait for FW ready */
271 rc = wil_wait_for_fw_ready(wil);
272
273 return rc;
274}
275
276
277void wil_link_on(struct wil6210_priv *wil)
278{
279 struct net_device *ndev = wil_to_ndev(wil);
280
281 wil_dbg(wil, "%s()\n", __func__);
282
283 netif_carrier_on(ndev);
284 netif_tx_wake_all_queues(ndev);
285}
286
287void wil_link_off(struct wil6210_priv *wil)
288{
289 struct net_device *ndev = wil_to_ndev(wil);
290
291 wil_dbg(wil, "%s()\n", __func__);
292
293 netif_tx_stop_all_queues(ndev);
294 netif_carrier_off(ndev);
295}
296
297static int __wil_up(struct wil6210_priv *wil)
298{
299 struct net_device *ndev = wil_to_ndev(wil);
300 struct wireless_dev *wdev = wil->wdev;
301 struct ieee80211_channel *channel = wdev->preset_chandef.chan;
302 int rc;
303 int bi;
304 u16 wmi_nettype = wil_iftype_nl2wmi(wdev->iftype);
305
306 rc = wil_reset(wil);
307 if (rc)
308 return rc;
309
310 /* FIXME Firmware works now in PBSS mode(ToDS=0, FromDS=0) */
311 wmi_nettype = wil_iftype_nl2wmi(NL80211_IFTYPE_ADHOC);
312 switch (wdev->iftype) {
313 case NL80211_IFTYPE_STATION:
314 wil_dbg(wil, "type: STATION\n");
315 bi = 0;
316 ndev->type = ARPHRD_ETHER;
317 break;
318 case NL80211_IFTYPE_AP:
319 wil_dbg(wil, "type: AP\n");
320 bi = 100;
321 ndev->type = ARPHRD_ETHER;
322 break;
323 case NL80211_IFTYPE_P2P_CLIENT:
324 wil_dbg(wil, "type: P2P_CLIENT\n");
325 bi = 0;
326 ndev->type = ARPHRD_ETHER;
327 break;
328 case NL80211_IFTYPE_P2P_GO:
329 wil_dbg(wil, "type: P2P_GO\n");
330 bi = 100;
331 ndev->type = ARPHRD_ETHER;
332 break;
333 case NL80211_IFTYPE_MONITOR:
334 wil_dbg(wil, "type: Monitor\n");
335 bi = 0;
336 ndev->type = ARPHRD_IEEE80211_RADIOTAP;
337 /* ARPHRD_IEEE80211 or ARPHRD_IEEE80211_RADIOTAP ? */
338 break;
339 default:
340 return -EOPNOTSUPP;
341 }
342
343 /* Apply profile in the following order: */
344 /* SSID and channel for the AP */
345 switch (wdev->iftype) {
346 case NL80211_IFTYPE_AP:
347 case NL80211_IFTYPE_P2P_GO:
348 if (wdev->ssid_len == 0) {
349 wil_err(wil, "SSID not set\n");
350 return -EINVAL;
351 }
352 wmi_set_ssid(wil, wdev->ssid_len, wdev->ssid);
353 if (channel)
354 wmi_set_channel(wil, channel->hw_value);
355 break;
356 default:
357 ;
358 }
359
360 /* MAC address - pre-requisite for other commands */
361 wmi_set_mac_address(wil, ndev->dev_addr);
362
363 /* Set up beaconing if required. */
364 rc = wmi_set_bcon(wil, bi, wmi_nettype);
365 if (rc)
366 return rc;
367
368 /* Rx VRING. After MAC and beacon */
369 wil_rx_init(wil);
370
371 return 0;
372}
373
374int wil_up(struct wil6210_priv *wil)
375{
376 int rc;
377
378 mutex_lock(&wil->mutex);
379 rc = __wil_up(wil);
380 mutex_unlock(&wil->mutex);
381
382 return rc;
383}
384
385static int __wil_down(struct wil6210_priv *wil)
386{
387 if (wil->scan_request) {
388 cfg80211_scan_done(wil->scan_request, true);
389 wil->scan_request = NULL;
390 }
391
392 wil6210_disconnect(wil, NULL);
393 wil_rx_fini(wil);
394
395 return 0;
396}
397
398int wil_down(struct wil6210_priv *wil)
399{
400 int rc;
401
402 mutex_lock(&wil->mutex);
403 rc = __wil_down(wil);
404 mutex_unlock(&wil->mutex);
405
406 return rc;
407}
diff --git a/drivers/net/wireless/ath/wil6210/netdev.c b/drivers/net/wireless/ath/wil6210/netdev.c
new file mode 100644
index 000000000000..3068b5cb53a7
--- /dev/null
+++ b/drivers/net/wireless/ath/wil6210/netdev.c
@@ -0,0 +1,157 @@
1/*
2 * Copyright (c) 2012 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#include <linux/module.h>
18#include <linux/netdevice.h>
19#include <linux/etherdevice.h>
20#include <linux/slab.h>
21
22#include "wil6210.h"
23
24static int wil_open(struct net_device *ndev)
25{
26 struct wil6210_priv *wil = ndev_to_wil(ndev);
27
28 return wil_up(wil);
29}
30
31static int wil_stop(struct net_device *ndev)
32{
33 struct wil6210_priv *wil = ndev_to_wil(ndev);
34
35 return wil_down(wil);
36}
37
38/*
39 * AC to queue mapping
40 *
41 * AC_VO -> queue 3
42 * AC_VI -> queue 2
43 * AC_BE -> queue 1
44 * AC_BK -> queue 0
45 */
46static u16 wil_select_queue(struct net_device *ndev, struct sk_buff *skb)
47{
48 static const u16 wil_1d_to_queue[8] = { 1, 0, 0, 1, 2, 2, 3, 3 };
49 struct wil6210_priv *wil = ndev_to_wil(ndev);
50 u16 rc;
51
52 skb->priority = cfg80211_classify8021d(skb);
53
54 rc = wil_1d_to_queue[skb->priority];
55
56 wil_dbg_TXRX(wil, "%s() %d -> %d\n", __func__, (int)skb->priority,
57 (int)rc);
58
59 return rc;
60}
61
62static const struct net_device_ops wil_netdev_ops = {
63 .ndo_open = wil_open,
64 .ndo_stop = wil_stop,
65 .ndo_start_xmit = wil_start_xmit,
66 .ndo_select_queue = wil_select_queue,
67 .ndo_set_mac_address = eth_mac_addr,
68 .ndo_validate_addr = eth_validate_addr,
69};
70
71void *wil_if_alloc(struct device *dev, void __iomem *csr)
72{
73 struct net_device *ndev;
74 struct wireless_dev *wdev;
75 struct wil6210_priv *wil;
76 struct ieee80211_channel *ch;
77 int rc = 0;
78
79 wdev = wil_cfg80211_init(dev);
80 if (IS_ERR(wdev)) {
81 dev_err(dev, "wil_cfg80211_init failed\n");
82 return wdev;
83 }
84
85 wil = wdev_to_wil(wdev);
86 wil->csr = csr;
87 wil->wdev = wdev;
88
89 rc = wil_priv_init(wil);
90 if (rc) {
91 dev_err(dev, "wil_priv_init failed\n");
92 goto out_wdev;
93 }
94
95 wdev->iftype = NL80211_IFTYPE_STATION; /* TODO */
96 /* default monitor channel */
97 ch = wdev->wiphy->bands[IEEE80211_BAND_60GHZ]->channels;
98 cfg80211_chandef_create(&wdev->preset_chandef, ch, NL80211_CHAN_NO_HT);
99
100 ndev = alloc_netdev_mqs(0, "wlan%d", ether_setup, WIL6210_TX_QUEUES, 1);
101 if (!ndev) {
102 dev_err(dev, "alloc_netdev_mqs failed\n");
103 rc = -ENOMEM;
104 goto out_priv;
105 }
106
107 ndev->netdev_ops = &wil_netdev_ops;
108 ndev->ieee80211_ptr = wdev;
109 SET_NETDEV_DEV(ndev, wiphy_dev(wdev->wiphy));
110 wdev->netdev = ndev;
111
112 wil_link_off(wil);
113
114 return wil;
115
116 out_priv:
117 wil_priv_deinit(wil);
118
119 out_wdev:
120 wil_wdev_free(wil);
121
122 return ERR_PTR(rc);
123}
124
125void wil_if_free(struct wil6210_priv *wil)
126{
127 struct net_device *ndev = wil_to_ndev(wil);
128 if (!ndev)
129 return;
130
131 free_netdev(ndev);
132 wil_priv_deinit(wil);
133 wil_wdev_free(wil);
134}
135
136int wil_if_add(struct wil6210_priv *wil)
137{
138 struct net_device *ndev = wil_to_ndev(wil);
139 int rc;
140
141 rc = register_netdev(ndev);
142 if (rc < 0) {
143 dev_err(&ndev->dev, "Failed to register netdev: %d\n", rc);
144 return rc;
145 }
146
147 wil_link_off(wil);
148
149 return 0;
150}
151
152void wil_if_remove(struct wil6210_priv *wil)
153{
154 struct net_device *ndev = wil_to_ndev(wil);
155
156 unregister_netdev(ndev);
157}
diff --git a/drivers/net/wireless/ath/wil6210/pcie_bus.c b/drivers/net/wireless/ath/wil6210/pcie_bus.c
new file mode 100644
index 000000000000..0fc83edd6bad
--- /dev/null
+++ b/drivers/net/wireless/ath/wil6210/pcie_bus.c
@@ -0,0 +1,223 @@
1/*
2 * Copyright (c) 2012 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#include <linux/kernel.h>
18#include <linux/module.h>
19#include <linux/slab.h>
20#include <linux/netdevice.h>
21#include <linux/debugfs.h>
22#include <linux/pci.h>
23#include <linux/moduleparam.h>
24
25#include "wil6210.h"
26
27static int use_msi = 1;
28module_param(use_msi, int, S_IRUGO);
29MODULE_PARM_DESC(use_msi,
30 " Use MSI interrupt: "
31 "0 - don't, 1 - (default) - single, or 3");
32
33/* Bus ops */
34static int wil_if_pcie_enable(struct wil6210_priv *wil)
35{
36 struct pci_dev *pdev = wil->pdev;
37 int rc;
38
39 pci_set_master(pdev);
40
41 /*
42 * how many MSI interrupts to request?
43 */
44 switch (use_msi) {
45 case 3:
46 case 1:
47 case 0:
48 break;
49 default:
50 wil_err(wil, "Invalid use_msi=%d, default to 1\n",
51 use_msi);
52 use_msi = 1;
53 }
54 wil->n_msi = use_msi;
55 if (wil->n_msi) {
56 wil_dbg(wil, "Setup %d MSI interrupts\n", use_msi);
57 rc = pci_enable_msi_block(pdev, wil->n_msi);
58 if (rc && (wil->n_msi == 3)) {
59 wil_err(wil, "3 MSI mode failed, try 1 MSI\n");
60 wil->n_msi = 1;
61 rc = pci_enable_msi_block(pdev, wil->n_msi);
62 }
63 if (rc) {
64 wil_err(wil, "pci_enable_msi failed, use INTx\n");
65 wil->n_msi = 0;
66 }
67 } else {
68 wil_dbg(wil, "MSI interrupts disabled, use INTx\n");
69 }
70
71 rc = wil6210_init_irq(wil, pdev->irq);
72 if (rc)
73 goto stop_master;
74
75 /* need reset here to obtain MAC */
76 rc = wil_reset(wil);
77 if (rc)
78 goto release_irq;
79
80 return 0;
81
82 release_irq:
83 wil6210_fini_irq(wil, pdev->irq);
84 /* safe to call if no MSI */
85 pci_disable_msi(pdev);
86 stop_master:
87 pci_clear_master(pdev);
88 return rc;
89}
90
91static int wil_if_pcie_disable(struct wil6210_priv *wil)
92{
93 struct pci_dev *pdev = wil->pdev;
94
95 pci_clear_master(pdev);
96 /* disable and release IRQ */
97 wil6210_fini_irq(wil, pdev->irq);
98 /* safe to call if no MSI */
99 pci_disable_msi(pdev);
100 /* TODO: disable HW */
101
102 return 0;
103}
104
105static int wil_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id)
106{
107 struct wil6210_priv *wil;
108 struct device *dev = &pdev->dev;
109 void __iomem *csr;
110 int rc;
111
112 /* check HW */
113 dev_info(&pdev->dev, WIL_NAME " device found [%04x:%04x] (rev %x)\n",
114 (int)pdev->vendor, (int)pdev->device, (int)pdev->revision);
115
116 if (pci_resource_len(pdev, 0) != WIL6210_MEM_SIZE) {
117 dev_err(&pdev->dev, "Not " WIL_NAME "? "
118 "BAR0 size is %lu while expecting %lu\n",
119 (ulong)pci_resource_len(pdev, 0), WIL6210_MEM_SIZE);
120 return -ENODEV;
121 }
122
123 rc = pci_enable_device(pdev);
124 if (rc) {
125 dev_err(&pdev->dev, "pci_enable_device failed\n");
126 return -ENODEV;
127 }
128 /* rollback to err_disable_pdev */
129
130 rc = pci_request_region(pdev, 0, WIL_NAME);
131 if (rc) {
132 dev_err(&pdev->dev, "pci_request_region failed\n");
133 goto err_disable_pdev;
134 }
135 /* rollback to err_release_reg */
136
137 csr = pci_ioremap_bar(pdev, 0);
138 if (!csr) {
139 dev_err(&pdev->dev, "pci_ioremap_bar failed\n");
140 rc = -ENODEV;
141 goto err_release_reg;
142 }
143 /* rollback to err_iounmap */
144 dev_info(&pdev->dev, "CSR at %pR -> %p\n", &pdev->resource[0], csr);
145
146 wil = wil_if_alloc(dev, csr);
147 if (IS_ERR(wil)) {
148 rc = (int)PTR_ERR(wil);
149 dev_err(dev, "wil_if_alloc failed: %d\n", rc);
150 goto err_iounmap;
151 }
152 /* rollback to if_free */
153
154 pci_set_drvdata(pdev, wil);
155 wil->pdev = pdev;
156
157 /* FW should raise IRQ when ready */
158 rc = wil_if_pcie_enable(wil);
159 if (rc) {
160 wil_err(wil, "Enable device failed\n");
161 goto if_free;
162 }
163 /* rollback to bus_disable */
164
165 rc = wil_if_add(wil);
166 if (rc) {
167 wil_err(wil, "wil_if_add failed: %d\n", rc);
168 goto bus_disable;
169 }
170
171 wil6210_debugfs_init(wil);
172
173 /* check FW is alive */
174 wmi_echo(wil);
175
176 return 0;
177
178 bus_disable:
179 wil_if_pcie_disable(wil);
180 if_free:
181 wil_if_free(wil);
182 err_iounmap:
183 pci_iounmap(pdev, csr);
184 err_release_reg:
185 pci_release_region(pdev, 0);
186 err_disable_pdev:
187 pci_disable_device(pdev);
188
189 return rc;
190}
191
192static void wil_pcie_remove(struct pci_dev *pdev)
193{
194 struct wil6210_priv *wil = pci_get_drvdata(pdev);
195
196 wil6210_debugfs_remove(wil);
197 wil_if_pcie_disable(wil);
198 wil_if_remove(wil);
199 wil_if_free(wil);
200 pci_iounmap(pdev, wil->csr);
201 pci_release_region(pdev, 0);
202 pci_disable_device(pdev);
203 pci_set_drvdata(pdev, NULL);
204}
205
206static DEFINE_PCI_DEVICE_TABLE(wil6210_pcie_ids) = {
207 { PCI_DEVICE(0x1ae9, 0x0301) },
208 { /* end: all zeroes */ },
209};
210MODULE_DEVICE_TABLE(pci, wil6210_pcie_ids);
211
212static struct pci_driver wil6210_driver = {
213 .probe = wil_pcie_probe,
214 .remove = wil_pcie_remove,
215 .id_table = wil6210_pcie_ids,
216 .name = WIL_NAME,
217};
218
219module_pci_driver(wil6210_driver);
220
221MODULE_LICENSE("Dual BSD/GPL");
222MODULE_AUTHOR("Qualcomm Atheros <wil6210@qca.qualcomm.com>");
223MODULE_DESCRIPTION("Driver for 60g WiFi WIL6210 card");
diff --git a/drivers/net/wireless/ath/wil6210/txrx.c b/drivers/net/wireless/ath/wil6210/txrx.c
new file mode 100644
index 000000000000..f29c294413cf
--- /dev/null
+++ b/drivers/net/wireless/ath/wil6210/txrx.c
@@ -0,0 +1,871 @@
1/*
2 * Copyright (c) 2012 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#include <linux/kernel.h>
18#include <linux/netdevice.h>
19#include <linux/etherdevice.h>
20#include <linux/hardirq.h>
21#include <net/ieee80211_radiotap.h>
22#include <linux/if_arp.h>
23#include <linux/moduleparam.h>
24
25#include "wil6210.h"
26#include "wmi.h"
27#include "txrx.h"
28
29static bool rtap_include_phy_info;
30module_param(rtap_include_phy_info, bool, S_IRUGO);
31MODULE_PARM_DESC(rtap_include_phy_info,
32 " Include PHY info in the radiotap header, default - no");
33
34static inline int wil_vring_is_empty(struct vring *vring)
35{
36 return vring->swhead == vring->swtail;
37}
38
39static inline u32 wil_vring_next_tail(struct vring *vring)
40{
41 return (vring->swtail + 1) % vring->size;
42}
43
44static inline void wil_vring_advance_head(struct vring *vring, int n)
45{
46 vring->swhead = (vring->swhead + n) % vring->size;
47}
48
49static inline int wil_vring_is_full(struct vring *vring)
50{
51 return wil_vring_next_tail(vring) == vring->swhead;
52}
53/*
54 * Available space in Tx Vring
55 */
56static inline int wil_vring_avail_tx(struct vring *vring)
57{
58 u32 swhead = vring->swhead;
59 u32 swtail = vring->swtail;
60 int used = (vring->size + swhead - swtail) % vring->size;
61
62 return vring->size - used - 1;
63}
64
65static int wil_vring_alloc(struct wil6210_priv *wil, struct vring *vring)
66{
67 struct device *dev = wil_to_dev(wil);
68 size_t sz = vring->size * sizeof(vring->va[0]);
69 uint i;
70
71 BUILD_BUG_ON(sizeof(vring->va[0]) != 32);
72
73 vring->swhead = 0;
74 vring->swtail = 0;
75 vring->ctx = kzalloc(vring->size * sizeof(vring->ctx[0]), GFP_KERNEL);
76 if (!vring->ctx) {
77 wil_err(wil, "vring_alloc [%d] failed to alloc ctx mem\n",
78 vring->size);
79 vring->va = NULL;
80 return -ENOMEM;
81 }
82 /*
83 * vring->va should be aligned on its size rounded up to power of 2
84 * This is granted by the dma_alloc_coherent
85 */
86 vring->va = dma_alloc_coherent(dev, sz, &vring->pa, GFP_KERNEL);
87 if (!vring->va) {
88 wil_err(wil, "vring_alloc [%d] failed to alloc DMA mem\n",
89 vring->size);
90 kfree(vring->ctx);
91 vring->ctx = NULL;
92 return -ENOMEM;
93 }
94 /* initially, all descriptors are SW owned
95 * For Tx and Rx, ownership bit is at the same location, thus
96 * we can use any
97 */
98 for (i = 0; i < vring->size; i++) {
99 volatile struct vring_tx_desc *d = &(vring->va[i].tx);
100 d->dma.status = TX_DMA_STATUS_DU;
101 }
102
103 wil_dbg(wil, "vring[%d] 0x%p:0x%016llx 0x%p\n", vring->size,
104 vring->va, (unsigned long long)vring->pa, vring->ctx);
105
106 return 0;
107}
108
109static void wil_vring_free(struct wil6210_priv *wil, struct vring *vring,
110 int tx)
111{
112 struct device *dev = wil_to_dev(wil);
113 size_t sz = vring->size * sizeof(vring->va[0]);
114
115 while (!wil_vring_is_empty(vring)) {
116 if (tx) {
117 volatile struct vring_tx_desc *d =
118 &vring->va[vring->swtail].tx;
119 dma_addr_t pa = d->dma.addr_low |
120 ((u64)d->dma.addr_high << 32);
121 struct sk_buff *skb = vring->ctx[vring->swtail];
122 if (skb) {
123 dma_unmap_single(dev, pa, d->dma.length,
124 DMA_TO_DEVICE);
125 dev_kfree_skb_any(skb);
126 vring->ctx[vring->swtail] = NULL;
127 } else {
128 dma_unmap_page(dev, pa, d->dma.length,
129 DMA_TO_DEVICE);
130 }
131 vring->swtail = wil_vring_next_tail(vring);
132 } else { /* rx */
133 volatile struct vring_rx_desc *d =
134 &vring->va[vring->swtail].rx;
135 dma_addr_t pa = d->dma.addr_low |
136 ((u64)d->dma.addr_high << 32);
137 struct sk_buff *skb = vring->ctx[vring->swhead];
138 dma_unmap_single(dev, pa, d->dma.length,
139 DMA_FROM_DEVICE);
140 kfree_skb(skb);
141 wil_vring_advance_head(vring, 1);
142 }
143 }
144 dma_free_coherent(dev, sz, (void *)vring->va, vring->pa);
145 kfree(vring->ctx);
146 vring->pa = 0;
147 vring->va = NULL;
148 vring->ctx = NULL;
149}
150
151/**
152 * Allocate one skb for Rx VRING
153 *
154 * Safe to call from IRQ
155 */
156static int wil_vring_alloc_skb(struct wil6210_priv *wil, struct vring *vring,
157 u32 i, int headroom)
158{
159 struct device *dev = wil_to_dev(wil);
160 unsigned int sz = RX_BUF_LEN;
161 volatile struct vring_rx_desc *d = &(vring->va[i].rx);
162 dma_addr_t pa;
163
164 /* TODO align */
165 struct sk_buff *skb = dev_alloc_skb(sz + headroom);
166 if (unlikely(!skb))
167 return -ENOMEM;
168
169 skb_reserve(skb, headroom);
170 skb_put(skb, sz);
171
172 pa = dma_map_single(dev, skb->data, skb->len, DMA_FROM_DEVICE);
173 if (unlikely(dma_mapping_error(dev, pa))) {
174 kfree_skb(skb);
175 return -ENOMEM;
176 }
177
178 d->dma.d0 = BIT(9) | RX_DMA_D0_CMD_DMA_IT;
179 d->dma.addr_low = lower_32_bits(pa);
180 d->dma.addr_high = (u16)upper_32_bits(pa);
181 /* ip_length don't care */
182 /* b11 don't care */
183 /* error don't care */
184 d->dma.status = 0; /* BIT(0) should be 0 for HW_OWNED */
185 d->dma.length = sz;
186 vring->ctx[i] = skb;
187
188 return 0;
189}
190
191/**
192 * Adds radiotap header
193 *
194 * Any error indicated as "Bad FCS"
195 *
196 * Vendor data for 04:ce:14-1 (Wilocity-1) consists of:
197 * - Rx descriptor: 32 bytes
198 * - Phy info
199 */
200static void wil_rx_add_radiotap_header(struct wil6210_priv *wil,
201 struct sk_buff *skb,
202 volatile struct vring_rx_desc *d)
203{
204 struct wireless_dev *wdev = wil->wdev;
205 struct wil6210_rtap {
206 struct ieee80211_radiotap_header rthdr;
207 /* fields should be in the order of bits in rthdr.it_present */
208 /* flags */
209 u8 flags;
210 /* channel */
211 __le16 chnl_freq __aligned(2);
212 __le16 chnl_flags;
213 /* MCS */
214 u8 mcs_present;
215 u8 mcs_flags;
216 u8 mcs_index;
217 } __packed;
218 struct wil6210_rtap_vendor {
219 struct wil6210_rtap rtap;
220 /* vendor */
221 u8 vendor_oui[3] __aligned(2);
222 u8 vendor_ns;
223 __le16 vendor_skip;
224 u8 vendor_data[0];
225 } __packed;
226 struct wil6210_rtap_vendor *rtap_vendor;
227 int rtap_len = sizeof(struct wil6210_rtap);
228 int phy_length = 0; /* phy info header size, bytes */
229 static char phy_data[128];
230 struct ieee80211_channel *ch = wdev->preset_chandef.chan;
231
232 if (rtap_include_phy_info) {
233 rtap_len = sizeof(*rtap_vendor) + sizeof(*d);
234 /* calculate additional length */
235 if (d->dma.status & RX_DMA_STATUS_PHY_INFO) {
236 /**
237 * PHY info starts from 8-byte boundary
238 * there are 8-byte lines, last line may be partially
239 * written (HW bug), thus FW configures for last line
240 * to be excessive. Driver skips this last line.
241 */
242 int len = min_t(int, 8 + sizeof(phy_data),
243 wil_rxdesc_phy_length(d));
244 if (len > 8) {
245 void *p = skb_tail_pointer(skb);
246 void *pa = PTR_ALIGN(p, 8);
247 if (skb_tailroom(skb) >= len + (pa - p)) {
248 phy_length = len - 8;
249 memcpy(phy_data, pa, phy_length);
250 }
251 }
252 }
253 rtap_len += phy_length;
254 }
255
256 if (skb_headroom(skb) < rtap_len &&
257 pskb_expand_head(skb, rtap_len, 0, GFP_ATOMIC)) {
258 wil_err(wil, "Unable to expand headrom to %d\n", rtap_len);
259 return;
260 }
261
262 rtap_vendor = (void *)skb_push(skb, rtap_len);
263 memset(rtap_vendor, 0, rtap_len);
264
265 rtap_vendor->rtap.rthdr.it_version = PKTHDR_RADIOTAP_VERSION;
266 rtap_vendor->rtap.rthdr.it_len = cpu_to_le16(rtap_len);
267 rtap_vendor->rtap.rthdr.it_present = cpu_to_le32(
268 (1 << IEEE80211_RADIOTAP_FLAGS) |
269 (1 << IEEE80211_RADIOTAP_CHANNEL) |
270 (1 << IEEE80211_RADIOTAP_MCS));
271 if (d->dma.status & RX_DMA_STATUS_ERROR)
272 rtap_vendor->rtap.flags |= IEEE80211_RADIOTAP_F_BADFCS;
273
274 rtap_vendor->rtap.chnl_freq = cpu_to_le16(ch ? ch->center_freq : 58320);
275 rtap_vendor->rtap.chnl_flags = cpu_to_le16(0);
276
277 rtap_vendor->rtap.mcs_present = IEEE80211_RADIOTAP_MCS_HAVE_MCS;
278 rtap_vendor->rtap.mcs_flags = 0;
279 rtap_vendor->rtap.mcs_index = wil_rxdesc_mcs(d);
280
281 if (rtap_include_phy_info) {
282 rtap_vendor->rtap.rthdr.it_present |= cpu_to_le32(1 <<
283 IEEE80211_RADIOTAP_VENDOR_NAMESPACE);
284 /* OUI for Wilocity 04:ce:14 */
285 rtap_vendor->vendor_oui[0] = 0x04;
286 rtap_vendor->vendor_oui[1] = 0xce;
287 rtap_vendor->vendor_oui[2] = 0x14;
288 rtap_vendor->vendor_ns = 1;
289 /* Rx descriptor + PHY data */
290 rtap_vendor->vendor_skip = cpu_to_le16(sizeof(*d) +
291 phy_length);
292 memcpy(rtap_vendor->vendor_data, (void *)d, sizeof(*d));
293 memcpy(rtap_vendor->vendor_data + sizeof(*d), phy_data,
294 phy_length);
295 }
296}
297
298/*
299 * Fast swap in place between 2 registers
300 */
301static void wil_swap_u16(u16 *a, u16 *b)
302{
303 *a ^= *b;
304 *b ^= *a;
305 *a ^= *b;
306}
307
308static void wil_swap_ethaddr(void *data)
309{
310 struct ethhdr *eth = data;
311 u16 *s = (u16 *)eth->h_source;
312 u16 *d = (u16 *)eth->h_dest;
313
314 wil_swap_u16(s++, d++);
315 wil_swap_u16(s++, d++);
316 wil_swap_u16(s, d);
317}
318
319/**
320 * reap 1 frame from @swhead
321 *
322 * Safe to call from IRQ
323 */
324static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil,
325 struct vring *vring)
326{
327 struct device *dev = wil_to_dev(wil);
328 struct net_device *ndev = wil_to_ndev(wil);
329 volatile struct vring_rx_desc *d;
330 struct sk_buff *skb;
331 dma_addr_t pa;
332 unsigned int sz = RX_BUF_LEN;
333 u8 ftype;
334 u8 ds_bits;
335
336 if (wil_vring_is_empty(vring))
337 return NULL;
338
339 d = &(vring->va[vring->swhead].rx);
340 if (!(d->dma.status & RX_DMA_STATUS_DU)) {
341 /* it is not error, we just reached end of Rx done area */
342 return NULL;
343 }
344
345 pa = d->dma.addr_low | ((u64)d->dma.addr_high << 32);
346 skb = vring->ctx[vring->swhead];
347 dma_unmap_single(dev, pa, sz, DMA_FROM_DEVICE);
348 skb_trim(skb, d->dma.length);
349
350 wil->stats.last_mcs_rx = wil_rxdesc_mcs(d);
351
352 /* use radiotap header only if required */
353 if (ndev->type == ARPHRD_IEEE80211_RADIOTAP)
354 wil_rx_add_radiotap_header(wil, skb, d);
355
356 wil_dbg_TXRX(wil, "Rx[%3d] : %d bytes\n", vring->swhead, d->dma.length);
357 wil_hex_dump_TXRX("Rx ", DUMP_PREFIX_NONE, 32, 4,
358 (const void *)d, sizeof(*d), false);
359
360 wil_vring_advance_head(vring, 1);
361
362 /* no extra checks if in sniffer mode */
363 if (ndev->type != ARPHRD_ETHER)
364 return skb;
365 /*
366 * Non-data frames may be delivered through Rx DMA channel (ex: BAR)
367 * Driver should recognize it by frame type, that is found
368 * in Rx descriptor. If type is not data, it is 802.11 frame as is
369 */
370 ftype = wil_rxdesc_ftype(d) << 2;
371 if (ftype != IEEE80211_FTYPE_DATA) {
372 wil_dbg_TXRX(wil, "Non-data frame ftype 0x%08x\n", ftype);
373 /* TODO: process it */
374 kfree_skb(skb);
375 return NULL;
376 }
377
378 if (skb->len < ETH_HLEN) {
379 wil_err(wil, "Short frame, len = %d\n", skb->len);
380 /* TODO: process it (i.e. BAR) */
381 kfree_skb(skb);
382 return NULL;
383 }
384
385 ds_bits = wil_rxdesc_ds_bits(d);
386 if (ds_bits == 1) {
387 /*
388 * HW bug - in ToDS mode, i.e. Rx on AP side,
389 * addresses get swapped
390 */
391 wil_swap_ethaddr(skb->data);
392 }
393
394 return skb;
395}
396
397/**
398 * allocate and fill up to @count buffers in rx ring
399 * buffers posted at @swtail
400 */
401static int wil_rx_refill(struct wil6210_priv *wil, int count)
402{
403 struct net_device *ndev = wil_to_ndev(wil);
404 struct vring *v = &wil->vring_rx;
405 u32 next_tail;
406 int rc = 0;
407 int headroom = ndev->type == ARPHRD_IEEE80211_RADIOTAP ?
408 WIL6210_RTAP_SIZE : 0;
409
410 for (; next_tail = wil_vring_next_tail(v),
411 (next_tail != v->swhead) && (count-- > 0);
412 v->swtail = next_tail) {
413 rc = wil_vring_alloc_skb(wil, v, v->swtail, headroom);
414 if (rc) {
415 wil_err(wil, "Error %d in wil_rx_refill[%d]\n",
416 rc, v->swtail);
417 break;
418 }
419 }
420 iowrite32(v->swtail, wil->csr + HOSTADDR(v->hwtail));
421
422 return rc;
423}
424
425/*
426 * Pass Rx packet to the netif. Update statistics.
427 */
428static void wil_netif_rx_any(struct sk_buff *skb, struct net_device *ndev)
429{
430 int rc;
431 unsigned int len = skb->len;
432
433 if (in_interrupt())
434 rc = netif_rx(skb);
435 else
436 rc = netif_rx_ni(skb);
437
438 if (likely(rc == NET_RX_SUCCESS)) {
439 ndev->stats.rx_packets++;
440 ndev->stats.rx_bytes += len;
441
442 } else {
443 ndev->stats.rx_dropped++;
444 }
445}
446
447/**
448 * Proceed all completed skb's from Rx VRING
449 *
450 * Safe to call from IRQ
451 */
452void wil_rx_handle(struct wil6210_priv *wil)
453{
454 struct net_device *ndev = wil_to_ndev(wil);
455 struct vring *v = &wil->vring_rx;
456 struct sk_buff *skb;
457
458 if (!v->va) {
459 wil_err(wil, "Rx IRQ while Rx not yet initialized\n");
460 return;
461 }
462 wil_dbg_TXRX(wil, "%s()\n", __func__);
463 while (NULL != (skb = wil_vring_reap_rx(wil, v))) {
464 wil_hex_dump_TXRX("Rx ", DUMP_PREFIX_OFFSET, 16, 1,
465 skb->data, skb_headlen(skb), false);
466
467 skb_orphan(skb);
468
469 if (wil->wdev->iftype == NL80211_IFTYPE_MONITOR) {
470 skb->dev = ndev;
471 skb_reset_mac_header(skb);
472 skb->ip_summed = CHECKSUM_UNNECESSARY;
473 skb->pkt_type = PACKET_OTHERHOST;
474 skb->protocol = htons(ETH_P_802_2);
475
476 } else {
477 skb->protocol = eth_type_trans(skb, ndev);
478 }
479
480 wil_netif_rx_any(skb, ndev);
481 }
482 wil_rx_refill(wil, v->size);
483}
484
485int wil_rx_init(struct wil6210_priv *wil)
486{
487 struct net_device *ndev = wil_to_ndev(wil);
488 struct wireless_dev *wdev = wil->wdev;
489 struct vring *vring = &wil->vring_rx;
490 int rc;
491 struct wmi_cfg_rx_chain_cmd cmd = {
492 .action = WMI_RX_CHAIN_ADD,
493 .rx_sw_ring = {
494 .max_mpdu_size = cpu_to_le16(RX_BUF_LEN),
495 },
496 .mid = 0, /* TODO - what is it? */
497 .decap_trans_type = WMI_DECAP_TYPE_802_3,
498 };
499 struct {
500 struct wil6210_mbox_hdr_wmi wmi;
501 struct wmi_cfg_rx_chain_done_event evt;
502 } __packed evt;
503
504 vring->size = WIL6210_RX_RING_SIZE;
505 rc = wil_vring_alloc(wil, vring);
506 if (rc)
507 return rc;
508
509 cmd.rx_sw_ring.ring_mem_base = cpu_to_le64(vring->pa);
510 cmd.rx_sw_ring.ring_size = cpu_to_le16(vring->size);
511 if (wdev->iftype == NL80211_IFTYPE_MONITOR) {
512 struct ieee80211_channel *ch = wdev->preset_chandef.chan;
513
514 cmd.sniffer_cfg.mode = cpu_to_le32(WMI_SNIFFER_ON);
515 if (ch)
516 cmd.sniffer_cfg.channel = ch->hw_value - 1;
517 cmd.sniffer_cfg.phy_info_mode =
518 cpu_to_le32(ndev->type == ARPHRD_IEEE80211_RADIOTAP);
519 cmd.sniffer_cfg.phy_support =
520 cpu_to_le32((wil->monitor_flags & MONITOR_FLAG_CONTROL)
521 ? WMI_SNIFFER_CP : WMI_SNIFFER_DP);
522 }
523 /* typical time for secure PCP is 840ms */
524 rc = wmi_call(wil, WMI_CFG_RX_CHAIN_CMDID, &cmd, sizeof(cmd),
525 WMI_CFG_RX_CHAIN_DONE_EVENTID, &evt, sizeof(evt), 2000);
526 if (rc)
527 goto err_free;
528
529 vring->hwtail = le32_to_cpu(evt.evt.rx_ring_tail_ptr);
530
531 wil_dbg(wil, "Rx init: status %d tail 0x%08x\n",
532 le32_to_cpu(evt.evt.status), vring->hwtail);
533
534 rc = wil_rx_refill(wil, vring->size);
535 if (rc)
536 goto err_free;
537
538 return 0;
539 err_free:
540 wil_vring_free(wil, vring, 0);
541
542 return rc;
543}
544
545void wil_rx_fini(struct wil6210_priv *wil)
546{
547 struct vring *vring = &wil->vring_rx;
548
549 if (vring->va) {
550 int rc;
551 struct wmi_cfg_rx_chain_cmd cmd = {
552 .action = cpu_to_le32(WMI_RX_CHAIN_DEL),
553 .rx_sw_ring = {
554 .max_mpdu_size = cpu_to_le16(RX_BUF_LEN),
555 },
556 };
557 struct {
558 struct wil6210_mbox_hdr_wmi wmi;
559 struct wmi_cfg_rx_chain_done_event cfg;
560 } __packed wmi_rx_cfg_reply;
561
562 rc = wmi_call(wil, WMI_CFG_RX_CHAIN_CMDID, &cmd, sizeof(cmd),
563 WMI_CFG_RX_CHAIN_DONE_EVENTID,
564 &wmi_rx_cfg_reply, sizeof(wmi_rx_cfg_reply),
565 100);
566 wil_vring_free(wil, vring, 0);
567 }
568}
569
570int wil_vring_init_tx(struct wil6210_priv *wil, int id, int size,
571 int cid, int tid)
572{
573 int rc;
574 struct wmi_vring_cfg_cmd cmd = {
575 .action = cpu_to_le32(WMI_VRING_CMD_ADD),
576 .vring_cfg = {
577 .tx_sw_ring = {
578 .max_mpdu_size = cpu_to_le16(TX_BUF_LEN),
579 },
580 .ringid = id,
581 .cidxtid = (cid & 0xf) | ((tid & 0xf) << 4),
582 .encap_trans_type = WMI_VRING_ENC_TYPE_802_3,
583 .mac_ctrl = 0,
584 .to_resolution = 0,
585 .agg_max_wsize = 16,
586 .schd_params = {
587 .priority = cpu_to_le16(0),
588 .timeslot_us = cpu_to_le16(0xfff),
589 },
590 },
591 };
592 struct {
593 struct wil6210_mbox_hdr_wmi wmi;
594 struct wmi_vring_cfg_done_event cmd;
595 } __packed reply;
596 struct vring *vring = &wil->vring_tx[id];
597
598 if (vring->va) {
599 wil_err(wil, "Tx ring [%d] already allocated\n", id);
600 rc = -EINVAL;
601 goto out;
602 }
603
604 vring->size = size;
605 rc = wil_vring_alloc(wil, vring);
606 if (rc)
607 goto out;
608
609 cmd.vring_cfg.tx_sw_ring.ring_mem_base = cpu_to_le64(vring->pa);
610 cmd.vring_cfg.tx_sw_ring.ring_size = cpu_to_le16(vring->size);
611
612 rc = wmi_call(wil, WMI_VRING_CFG_CMDID, &cmd, sizeof(cmd),
613 WMI_VRING_CFG_DONE_EVENTID, &reply, sizeof(reply), 100);
614 if (rc)
615 goto out_free;
616
617 if (reply.cmd.status != WMI_VRING_CFG_SUCCESS) {
618 wil_err(wil, "Tx config failed, status 0x%02x\n",
619 reply.cmd.status);
620 goto out_free;
621 }
622 vring->hwtail = le32_to_cpu(reply.cmd.tx_vring_tail_ptr);
623
624 return 0;
625 out_free:
626 wil_vring_free(wil, vring, 1);
627 out:
628
629 return rc;
630}
631
632void wil_vring_fini_tx(struct wil6210_priv *wil, int id)
633{
634 struct vring *vring = &wil->vring_tx[id];
635
636 if (!vring->va)
637 return;
638
639 wil_vring_free(wil, vring, 1);
640}
641
642static struct vring *wil_find_tx_vring(struct wil6210_priv *wil,
643 struct sk_buff *skb)
644{
645 struct vring *v = &wil->vring_tx[0];
646
647 if (v->va)
648 return v;
649
650 return NULL;
651}
652
653static int wil_tx_desc_map(volatile struct vring_tx_desc *d,
654 dma_addr_t pa, u32 len)
655{
656 d->dma.addr_low = lower_32_bits(pa);
657 d->dma.addr_high = (u16)upper_32_bits(pa);
658 d->dma.ip_length = 0;
659 /* 0..6: mac_length; 7:ip_version 0-IP6 1-IP4*/
660 d->dma.b11 = 0/*14 | BIT(7)*/;
661 d->dma.error = 0;
662 d->dma.status = 0; /* BIT(0) should be 0 for HW_OWNED */
663 d->dma.length = len;
664 d->dma.d0 = 0;
665 d->mac.d[0] = 0;
666 d->mac.d[1] = 0;
667 d->mac.d[2] = 0;
668 d->mac.ucode_cmd = 0;
669 /* use dst index 0 */
670 d->mac.d[1] |= BIT(MAC_CFG_DESC_TX_1_DST_INDEX_EN_POS) |
671 (0 << MAC_CFG_DESC_TX_1_DST_INDEX_POS);
672 /* translation type: 0 - bypass; 1 - 802.3; 2 - native wifi */
673 d->mac.d[2] = BIT(MAC_CFG_DESC_TX_2_SNAP_HDR_INSERTION_EN_POS) |
674 (1 << MAC_CFG_DESC_TX_2_L2_TRANSLATION_TYPE_POS);
675
676 return 0;
677}
678
679static int wil_tx_vring(struct wil6210_priv *wil, struct vring *vring,
680 struct sk_buff *skb)
681{
682 struct device *dev = wil_to_dev(wil);
683 volatile struct vring_tx_desc *d;
684 u32 swhead = vring->swhead;
685 int avail = wil_vring_avail_tx(vring);
686 int nr_frags = skb_shinfo(skb)->nr_frags;
687 uint f;
688 int vring_index = vring - wil->vring_tx;
689 uint i = swhead;
690 dma_addr_t pa;
691
692 wil_dbg_TXRX(wil, "%s()\n", __func__);
693
694 if (avail < vring->size/8)
695 netif_tx_stop_all_queues(wil_to_ndev(wil));
696 if (avail < 1 + nr_frags) {
697 wil_err(wil, "Tx ring full. No space for %d fragments\n",
698 1 + nr_frags);
699 return -ENOMEM;
700 }
701 d = &(vring->va[i].tx);
702
703 /* FIXME FW can accept only unicast frames for the peer */
704 memcpy(skb->data, wil->dst_addr[vring_index], ETH_ALEN);
705
706 pa = dma_map_single(dev, skb->data,
707 skb_headlen(skb), DMA_TO_DEVICE);
708
709 wil_dbg_TXRX(wil, "Tx skb %d bytes %p -> %#08llx\n", skb_headlen(skb),
710 skb->data, (unsigned long long)pa);
711 wil_hex_dump_TXRX("Tx ", DUMP_PREFIX_OFFSET, 16, 1,
712 skb->data, skb_headlen(skb), false);
713
714 if (unlikely(dma_mapping_error(dev, pa)))
715 return -EINVAL;
716 /* 1-st segment */
717 wil_tx_desc_map(d, pa, skb_headlen(skb));
718 d->mac.d[2] |= ((nr_frags + 1) <<
719 MAC_CFG_DESC_TX_2_NUM_OF_DESCRIPTORS_POS);
720 /* middle segments */
721 for (f = 0; f < nr_frags; f++) {
722 const struct skb_frag_struct *frag =
723 &skb_shinfo(skb)->frags[f];
724 int len = skb_frag_size(frag);
725 i = (swhead + f + 1) % vring->size;
726 d = &(vring->va[i].tx);
727 pa = skb_frag_dma_map(dev, frag, 0, skb_frag_size(frag),
728 DMA_TO_DEVICE);
729 if (unlikely(dma_mapping_error(dev, pa)))
730 goto dma_error;
731 wil_tx_desc_map(d, pa, len);
732 vring->ctx[i] = NULL;
733 }
734 /* for the last seg only */
735 d->dma.d0 |= BIT(DMA_CFG_DESC_TX_0_CMD_EOP_POS);
736 d->dma.d0 |= BIT(9); /* BUG: undocumented bit */
737 d->dma.d0 |= BIT(DMA_CFG_DESC_TX_0_CMD_DMA_IT_POS);
738 d->dma.d0 |= (vring_index << DMA_CFG_DESC_TX_0_QID_POS);
739
740 wil_hex_dump_TXRX("Tx ", DUMP_PREFIX_NONE, 32, 4,
741 (const void *)d, sizeof(*d), false);
742
743 /* advance swhead */
744 wil_vring_advance_head(vring, nr_frags + 1);
745 wil_dbg_TXRX(wil, "Tx swhead %d -> %d\n", swhead, vring->swhead);
746 iowrite32(vring->swhead, wil->csr + HOSTADDR(vring->hwtail));
747 /* hold reference to skb
748 * to prevent skb release before accounting
749 * in case of immediate "tx done"
750 */
751 vring->ctx[i] = skb_get(skb);
752
753 return 0;
754 dma_error:
755 /* unmap what we have mapped */
756 /* Note: increment @f to operate with positive index */
757 for (f++; f > 0; f--) {
758 i = (swhead + f) % vring->size;
759 d = &(vring->va[i].tx);
760 d->dma.status = TX_DMA_STATUS_DU;
761 pa = d->dma.addr_low | ((u64)d->dma.addr_high << 32);
762 if (vring->ctx[i])
763 dma_unmap_single(dev, pa, d->dma.length, DMA_TO_DEVICE);
764 else
765 dma_unmap_page(dev, pa, d->dma.length, DMA_TO_DEVICE);
766 }
767
768 return -EINVAL;
769}
770
771
772netdev_tx_t wil_start_xmit(struct sk_buff *skb, struct net_device *ndev)
773{
774 struct wil6210_priv *wil = ndev_to_wil(ndev);
775 struct vring *vring;
776 int rc;
777
778 wil_dbg_TXRX(wil, "%s()\n", __func__);
779 if (!test_bit(wil_status_fwready, &wil->status)) {
780 wil_err(wil, "FW not ready\n");
781 goto drop;
782 }
783 if (!test_bit(wil_status_fwconnected, &wil->status)) {
784 wil_err(wil, "FW not connected\n");
785 goto drop;
786 }
787 if (wil->wdev->iftype == NL80211_IFTYPE_MONITOR) {
788 wil_err(wil, "Xmit in monitor mode not supported\n");
789 goto drop;
790 }
791 if (skb->protocol == cpu_to_be16(ETH_P_PAE)) {
792 rc = wmi_tx_eapol(wil, skb);
793 } else {
794 /* find vring */
795 vring = wil_find_tx_vring(wil, skb);
796 if (!vring) {
797 wil_err(wil, "No Tx VRING available\n");
798 goto drop;
799 }
800 /* set up vring entry */
801 rc = wil_tx_vring(wil, vring, skb);
802 }
803 switch (rc) {
804 case 0:
805 ndev->stats.tx_packets++;
806 ndev->stats.tx_bytes += skb->len;
807 dev_kfree_skb_any(skb);
808 return NETDEV_TX_OK;
809 case -ENOMEM:
810 return NETDEV_TX_BUSY;
811 default:
812 ; /* goto drop; */
813 break;
814 }
815 drop:
816 netif_tx_stop_all_queues(ndev);
817 ndev->stats.tx_dropped++;
818 dev_kfree_skb_any(skb);
819
820 return NET_XMIT_DROP;
821}
822
823/**
824 * Clean up transmitted skb's from the Tx VRING
825 *
826 * Safe to call from IRQ
827 */
828void wil_tx_complete(struct wil6210_priv *wil, int ringid)
829{
830 struct device *dev = wil_to_dev(wil);
831 struct vring *vring = &wil->vring_tx[ringid];
832
833 if (!vring->va) {
834 wil_err(wil, "Tx irq[%d]: vring not initialized\n", ringid);
835 return;
836 }
837
838 wil_dbg_TXRX(wil, "%s(%d)\n", __func__, ringid);
839
840 while (!wil_vring_is_empty(vring)) {
841 volatile struct vring_tx_desc *d = &vring->va[vring->swtail].tx;
842 dma_addr_t pa;
843 struct sk_buff *skb;
844 if (!(d->dma.status & TX_DMA_STATUS_DU))
845 break;
846
847 wil_dbg_TXRX(wil,
848 "Tx[%3d] : %d bytes, status 0x%02x err 0x%02x\n",
849 vring->swtail, d->dma.length, d->dma.status,
850 d->dma.error);
851 wil_hex_dump_TXRX("TxC ", DUMP_PREFIX_NONE, 32, 4,
852 (const void *)d, sizeof(*d), false);
853
854 pa = d->dma.addr_low | ((u64)d->dma.addr_high << 32);
855 skb = vring->ctx[vring->swtail];
856 if (skb) {
857 dma_unmap_single(dev, pa, d->dma.length, DMA_TO_DEVICE);
858 dev_kfree_skb_any(skb);
859 vring->ctx[vring->swtail] = NULL;
860 } else {
861 dma_unmap_page(dev, pa, d->dma.length, DMA_TO_DEVICE);
862 }
863 d->dma.addr_low = 0;
864 d->dma.addr_high = 0;
865 d->dma.length = 0;
866 d->dma.status = TX_DMA_STATUS_DU;
867 vring->swtail = wil_vring_next_tail(vring);
868 }
869 if (wil_vring_avail_tx(vring) > vring->size/4)
870 netif_tx_wake_all_queues(wil_to_ndev(wil));
871}
diff --git a/drivers/net/wireless/ath/wil6210/txrx.h b/drivers/net/wireless/ath/wil6210/txrx.h
new file mode 100644
index 000000000000..45a61f597c5c
--- /dev/null
+++ b/drivers/net/wireless/ath/wil6210/txrx.h
@@ -0,0 +1,362 @@
1/*
2 * Copyright (c) 2012 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef WIL6210_TXRX_H
18#define WIL6210_TXRX_H
19
20#define BUF_SW_OWNED (1)
21#define BUF_HW_OWNED (0)
22
23/* size of max. Rx packet */
24#define RX_BUF_LEN (2048)
25#define TX_BUF_LEN (2048)
26/* how many bytes to reserve for rtap header? */
27#define WIL6210_RTAP_SIZE (128)
28
29/* Tx/Rx path */
30/*
31 * Tx descriptor - MAC part
32 * [dword 0]
33 * bit 0.. 9 : lifetime_expiry_value:10
34 * bit 10 : interrup_en:1
35 * bit 11 : status_en:1
36 * bit 12..13 : txss_override:2
37 * bit 14 : timestamp_insertion:1
38 * bit 15 : duration_preserve:1
39 * bit 16..21 : reserved0:6
40 * bit 22..26 : mcs_index:5
41 * bit 27 : mcs_en:1
42 * bit 28..29 : reserved1:2
43 * bit 30 : reserved2:1
44 * bit 31 : sn_preserved:1
45 * [dword 1]
46 * bit 0.. 3 : pkt_mode:4
47 * bit 4 : pkt_mode_en:1
48 * bit 5.. 7 : reserved0:3
49 * bit 8..13 : reserved1:6
50 * bit 14 : reserved2:1
51 * bit 15 : ack_policy_en:1
52 * bit 16..19 : dst_index:4
53 * bit 20 : dst_index_en:1
54 * bit 21..22 : ack_policy:2
55 * bit 23 : lifetime_en:1
56 * bit 24..30 : max_retry:7
57 * bit 31 : max_retry_en:1
58 * [dword 2]
59 * bit 0.. 7 : num_of_descriptors:8
60 * bit 8..17 : reserved:10
61 * bit 18..19 : l2_translation_type:2
62 * bit 20 : snap_hdr_insertion_en:1
63 * bit 21 : vlan_removal_en:1
64 * bit 22..31 : reserved0:10
65 * [dword 3]
66 * bit 0.. 31: ucode_cmd:32
67 */
68struct vring_tx_mac {
69 u32 d[3];
70 u32 ucode_cmd;
71} __packed;
72
73/* TX MAC Dword 0 */
74#define MAC_CFG_DESC_TX_0_LIFETIME_EXPIRY_VALUE_POS 0
75#define MAC_CFG_DESC_TX_0_LIFETIME_EXPIRY_VALUE_LEN 10
76#define MAC_CFG_DESC_TX_0_LIFETIME_EXPIRY_VALUE_MSK 0x3FF
77
78#define MAC_CFG_DESC_TX_0_INTERRUP_EN_POS 10
79#define MAC_CFG_DESC_TX_0_INTERRUP_EN_LEN 1
80#define MAC_CFG_DESC_TX_0_INTERRUP_EN_MSK 0x400
81
82#define MAC_CFG_DESC_TX_0_STATUS_EN_POS 11
83#define MAC_CFG_DESC_TX_0_STATUS_EN_LEN 1
84#define MAC_CFG_DESC_TX_0_STATUS_EN_MSK 0x800
85
86#define MAC_CFG_DESC_TX_0_TXSS_OVERRIDE_POS 12
87#define MAC_CFG_DESC_TX_0_TXSS_OVERRIDE_LEN 2
88#define MAC_CFG_DESC_TX_0_TXSS_OVERRIDE_MSK 0x3000
89
90#define MAC_CFG_DESC_TX_0_TIMESTAMP_INSERTION_POS 14
91#define MAC_CFG_DESC_TX_0_TIMESTAMP_INSERTION_LEN 1
92#define MAC_CFG_DESC_TX_0_TIMESTAMP_INSERTION_MSK 0x4000
93
94#define MAC_CFG_DESC_TX_0_DURATION_PRESERVE_POS 15
95#define MAC_CFG_DESC_TX_0_DURATION_PRESERVE_LEN 1
96#define MAC_CFG_DESC_TX_0_DURATION_PRESERVE_MSK 0x8000
97
98#define MAC_CFG_DESC_TX_0_MCS_INDEX_POS 22
99#define MAC_CFG_DESC_TX_0_MCS_INDEX_LEN 5
100#define MAC_CFG_DESC_TX_0_MCS_INDEX_MSK 0x7C00000
101
102#define MAC_CFG_DESC_TX_0_MCS_EN_POS 27
103#define MAC_CFG_DESC_TX_0_MCS_EN_LEN 1
104#define MAC_CFG_DESC_TX_0_MCS_EN_MSK 0x8000000
105
106#define MAC_CFG_DESC_TX_0_SN_PRESERVED_POS 31
107#define MAC_CFG_DESC_TX_0_SN_PRESERVED_LEN 1
108#define MAC_CFG_DESC_TX_0_SN_PRESERVED_MSK 0x80000000
109
110/* TX MAC Dword 1 */
111#define MAC_CFG_DESC_TX_1_PKT_MODE_POS 0
112#define MAC_CFG_DESC_TX_1_PKT_MODE_LEN 4
113#define MAC_CFG_DESC_TX_1_PKT_MODE_MSK 0xF
114
115#define MAC_CFG_DESC_TX_1_PKT_MODE_EN_POS 4
116#define MAC_CFG_DESC_TX_1_PKT_MODE_EN_LEN 1
117#define MAC_CFG_DESC_TX_1_PKT_MODE_EN_MSK 0x10
118
119#define MAC_CFG_DESC_TX_1_ACK_POLICY_EN_POS 15
120#define MAC_CFG_DESC_TX_1_ACK_POLICY_EN_LEN 1
121#define MAC_CFG_DESC_TX_1_ACK_POLICY_EN_MSK 0x8000
122
123#define MAC_CFG_DESC_TX_1_DST_INDEX_POS 16
124#define MAC_CFG_DESC_TX_1_DST_INDEX_LEN 4
125#define MAC_CFG_DESC_TX_1_DST_INDEX_MSK 0xF0000
126
127#define MAC_CFG_DESC_TX_1_DST_INDEX_EN_POS 20
128#define MAC_CFG_DESC_TX_1_DST_INDEX_EN_LEN 1
129#define MAC_CFG_DESC_TX_1_DST_INDEX_EN_MSK 0x100000
130
131#define MAC_CFG_DESC_TX_1_ACK_POLICY_POS 21
132#define MAC_CFG_DESC_TX_1_ACK_POLICY_LEN 2
133#define MAC_CFG_DESC_TX_1_ACK_POLICY_MSK 0x600000
134
135#define MAC_CFG_DESC_TX_1_LIFETIME_EN_POS 23
136#define MAC_CFG_DESC_TX_1_LIFETIME_EN_LEN 1
137#define MAC_CFG_DESC_TX_1_LIFETIME_EN_MSK 0x800000
138
139#define MAC_CFG_DESC_TX_1_MAX_RETRY_POS 24
140#define MAC_CFG_DESC_TX_1_MAX_RETRY_LEN 7
141#define MAC_CFG_DESC_TX_1_MAX_RETRY_MSK 0x7F000000
142
143#define MAC_CFG_DESC_TX_1_MAX_RETRY_EN_POS 31
144#define MAC_CFG_DESC_TX_1_MAX_RETRY_EN_LEN 1
145#define MAC_CFG_DESC_TX_1_MAX_RETRY_EN_MSK 0x80000000
146
147/* TX MAC Dword 2 */
148#define MAC_CFG_DESC_TX_2_NUM_OF_DESCRIPTORS_POS 0
149#define MAC_CFG_DESC_TX_2_NUM_OF_DESCRIPTORS_LEN 8
150#define MAC_CFG_DESC_TX_2_NUM_OF_DESCRIPTORS_MSK 0xFF
151
152#define MAC_CFG_DESC_TX_2_RESERVED_POS 8
153#define MAC_CFG_DESC_TX_2_RESERVED_LEN 10
154#define MAC_CFG_DESC_TX_2_RESERVED_MSK 0x3FF00
155
156#define MAC_CFG_DESC_TX_2_L2_TRANSLATION_TYPE_POS 18
157#define MAC_CFG_DESC_TX_2_L2_TRANSLATION_TYPE_LEN 2
158#define MAC_CFG_DESC_TX_2_L2_TRANSLATION_TYPE_MSK 0xC0000
159
160#define MAC_CFG_DESC_TX_2_SNAP_HDR_INSERTION_EN_POS 20
161#define MAC_CFG_DESC_TX_2_SNAP_HDR_INSERTION_EN_LEN 1
162#define MAC_CFG_DESC_TX_2_SNAP_HDR_INSERTION_EN_MSK 0x100000
163
164#define MAC_CFG_DESC_TX_2_VLAN_REMOVAL_EN_POS 21
165#define MAC_CFG_DESC_TX_2_VLAN_REMOVAL_EN_LEN 1
166#define MAC_CFG_DESC_TX_2_VLAN_REMOVAL_EN_MSK 0x200000
167
168/* TX MAC Dword 3 */
169#define MAC_CFG_DESC_TX_3_UCODE_CMD_POS 0
170#define MAC_CFG_DESC_TX_3_UCODE_CMD_LEN 32
171#define MAC_CFG_DESC_TX_3_UCODE_CMD_MSK 0xFFFFFFFF
172
173/* TX DMA Dword 0 */
174#define DMA_CFG_DESC_TX_0_L4_LENGTH_POS 0
175#define DMA_CFG_DESC_TX_0_L4_LENGTH_LEN 8
176#define DMA_CFG_DESC_TX_0_L4_LENGTH_MSK 0xFF
177
178#define DMA_CFG_DESC_TX_0_CMD_EOP_POS 8
179#define DMA_CFG_DESC_TX_0_CMD_EOP_LEN 1
180#define DMA_CFG_DESC_TX_0_CMD_EOP_MSK 0x100
181
182#define DMA_CFG_DESC_TX_0_CMD_DMA_IT_POS 10
183#define DMA_CFG_DESC_TX_0_CMD_DMA_IT_LEN 1
184#define DMA_CFG_DESC_TX_0_CMD_DMA_IT_MSK 0x400
185
186#define DMA_CFG_DESC_TX_0_SEGMENT_BUF_DETAILS_POS 11
187#define DMA_CFG_DESC_TX_0_SEGMENT_BUF_DETAILS_LEN 2
188#define DMA_CFG_DESC_TX_0_SEGMENT_BUF_DETAILS_MSK 0x1800
189
190#define DMA_CFG_DESC_TX_0_TCP_SEG_EN_POS 13
191#define DMA_CFG_DESC_TX_0_TCP_SEG_EN_LEN 1
192#define DMA_CFG_DESC_TX_0_TCP_SEG_EN_MSK 0x2000
193
194#define DMA_CFG_DESC_TX_0_IPV4_CHECKSUM_EN_POS 14
195#define DMA_CFG_DESC_TX_0_IPV4_CHECKSUM_EN_LEN 1
196#define DMA_CFG_DESC_TX_0_IPV4_CHECKSUM_EN_MSK 0x4000
197
198#define DMA_CFG_DESC_TX_0_TCP_UDP_CHECKSUM_EN_POS 15
199#define DMA_CFG_DESC_TX_0_TCP_UDP_CHECKSUM_EN_LEN 1
200#define DMA_CFG_DESC_TX_0_TCP_UDP_CHECKSUM_EN_MSK 0x8000
201
202#define DMA_CFG_DESC_TX_0_QID_POS 16
203#define DMA_CFG_DESC_TX_0_QID_LEN 5
204#define DMA_CFG_DESC_TX_0_QID_MSK 0x1F0000
205
206#define DMA_CFG_DESC_TX_0_PSEUDO_HEADER_CALC_EN_POS 21
207#define DMA_CFG_DESC_TX_0_PSEUDO_HEADER_CALC_EN_LEN 1
208#define DMA_CFG_DESC_TX_0_PSEUDO_HEADER_CALC_EN_MSK 0x200000
209
210#define DMA_CFG_DESC_TX_0_L4_TYPE_POS 30
211#define DMA_CFG_DESC_TX_0_L4_TYPE_LEN 2
212#define DMA_CFG_DESC_TX_0_L4_TYPE_MSK 0xC0000000
213
214
215#define TX_DMA_STATUS_DU BIT(0)
216
217struct vring_tx_dma {
218 u32 d0;
219 u32 addr_low;
220 u16 addr_high;
221 u8 ip_length;
222 u8 b11; /* 0..6: mac_length; 7:ip_version */
223 u8 error; /* 0..2: err; 3..7: reserved; */
224 u8 status; /* 0: used; 1..7; reserved */
225 u16 length;
226} __packed;
227
228/*
229 * Rx descriptor - MAC part
230 * [dword 0]
231 * bit 0.. 3 : tid:4 The QoS (b3-0) TID Field
232 * bit 4.. 6 : connection_id:3 :The Source index that was found during
233 * Parsing the TA. This field is used to define the source of the packet
234 * bit 7 : reserved:1
235 * bit 8.. 9 : mac_id:2 : The MAC virtual Ring number (always zero)
236 * bit 10..11 : frame_type:2 : The FC Control (b3-2) - MPDU Type
237 * (management, data, control and extension)
238 * bit 12..15 : frame_subtype:4 : The FC Control (b7-4) - Frame Subtype
239 * bit 16..27 : seq_number:12 The received Sequence number field
240 * bit 28..31 : extended:4 extended subtype
241 * [dword 1]
242 * bit 0.. 3 : reserved
243 * bit 4.. 5 : key_id:2
244 * bit 6 : decrypt_bypass:1
245 * bit 7 : security:1
246 * bit 8.. 9 : ds_bits:2
247 * bit 10 : a_msdu_present:1 from qos header
248 * bit 11 : a_msdu_type:1 from qos header
249 * bit 12 : a_mpdu:1 part of AMPDU aggregation
250 * bit 13 : broadcast:1
251 * bit 14 : mutlicast:1
252 * bit 15 : reserved:1
253 * bit 16..20 : rx_mac_qid:5 The Queue Identifier that the packet
254 * is received from
255 * bit 21..24 : mcs:4
256 * bit 25..28 : mic_icr:4
257 * bit 29..31 : reserved:3
258 * [dword 2]
259 * bit 0.. 2 : time_slot:3 The timeslot that the MPDU is received
260 * bit 3 : fc_protocol_ver:1 The FC Control (b0) - Protocol Version
261 * bit 4 : fc_order:1 The FC Control (b15) -Order
262 * bit 5.. 7 : qos_ack_policy:3 The QoS (b6-5) ack policy Field
263 * bit 8 : esop:1 The QoS (b4) ESOP field
264 * bit 9 : qos_rdg_more_ppdu:1 The QoS (b9) RDG field
265 * bit 10..14 : qos_reserved:5 The QoS (b14-10) Reserved field
266 * bit 15 : qos_ac_constraint:1
267 * bit 16..31 : pn_15_0:16 low 2 bytes of PN
268 * [dword 3]
269 * bit 0..31 : pn_47_16:32 high 4 bytes of PN
270 */
271struct vring_rx_mac {
272 u32 d0;
273 u32 d1;
274 u16 w4;
275 u16 pn_15_0;
276 u32 pn_47_16;
277} __packed;
278
279/*
280 * Rx descriptor - DMA part
281 * [dword 0]
282 * bit 0.. 7 : l4_length:8 layer 4 length
283 * bit 8.. 9 : reserved:2
284 * bit 10 : cmd_dma_it:1
285 * bit 11..15 : reserved:5
286 * bit 16..29 : phy_info_length:14
287 * bit 30..31 : l4_type:2 valid if the L4I bit is set in the status field
288 * [dword 1]
289 * bit 0..31 : addr_low:32 The payload buffer low address
290 * [dword 2]
291 * bit 0..15 : addr_high:16 The payload buffer high address
292 * bit 16..23 : ip_length:8
293 * bit 24..30 : mac_length:7
294 * bit 31 : ip_version:1
295 * [dword 3]
296 * [byte 12] error
297 * [byte 13] status
298 * bit 0 : du:1
299 * bit 1 : eop:1
300 * bit 2 : error:1
301 * bit 3 : mi:1
302 * bit 4 : l3_identified:1
303 * bit 5 : l4_identified:1
304 * bit 6 : phy_info_included:1
305 * bit 7 : reserved:1
306 * [word 7] length
307 *
308 */
309
310#define RX_DMA_D0_CMD_DMA_IT BIT(10)
311
312#define RX_DMA_STATUS_DU BIT(0)
313#define RX_DMA_STATUS_ERROR BIT(2)
314#define RX_DMA_STATUS_PHY_INFO BIT(6)
315
316struct vring_rx_dma {
317 u32 d0;
318 u32 addr_low;
319 u16 addr_high;
320 u8 ip_length;
321 u8 b11;
322 u8 error;
323 u8 status;
324 u16 length;
325} __packed;
326
327struct vring_tx_desc {
328 struct vring_tx_mac mac;
329 struct vring_tx_dma dma;
330} __packed;
331
332struct vring_rx_desc {
333 struct vring_rx_mac mac;
334 struct vring_rx_dma dma;
335} __packed;
336
337union vring_desc {
338 struct vring_tx_desc tx;
339 struct vring_rx_desc rx;
340} __packed;
341
342static inline int wil_rxdesc_phy_length(volatile struct vring_rx_desc *d)
343{
344 return WIL_GET_BITS(d->dma.d0, 16, 29);
345}
346
347static inline int wil_rxdesc_mcs(volatile struct vring_rx_desc *d)
348{
349 return WIL_GET_BITS(d->mac.d1, 21, 24);
350}
351
352static inline int wil_rxdesc_ds_bits(volatile struct vring_rx_desc *d)
353{
354 return WIL_GET_BITS(d->mac.d1, 8, 9);
355}
356
357static inline int wil_rxdesc_ftype(volatile struct vring_rx_desc *d)
358{
359 return WIL_GET_BITS(d->mac.d0, 10, 11);
360}
361
362#endif /* WIL6210_TXRX_H */
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h b/drivers/net/wireless/ath/wil6210/wil6210.h
new file mode 100644
index 000000000000..9bcfffa4006c
--- /dev/null
+++ b/drivers/net/wireless/ath/wil6210/wil6210.h
@@ -0,0 +1,363 @@
1/*
2 * Copyright (c) 2012 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef __WIL6210_H__
18#define __WIL6210_H__
19
20#include <linux/netdevice.h>
21#include <linux/wireless.h>
22#include <net/cfg80211.h>
23
24#include "dbg_hexdump.h"
25
26#define WIL_NAME "wil6210"
27
28/**
29 * extract bits [@b0:@b1] (inclusive) from the value @x
30 * it should be @b0 <= @b1, or result is incorrect
31 */
32static inline u32 WIL_GET_BITS(u32 x, int b0, int b1)
33{
34 return (x >> b0) & ((1 << (b1 - b0 + 1)) - 1);
35}
36
37#define WIL6210_MEM_SIZE (2*1024*1024UL)
38
39#define WIL6210_TX_QUEUES (4)
40
41#define WIL6210_RX_RING_SIZE (128)
42#define WIL6210_TX_RING_SIZE (128)
43#define WIL6210_MAX_TX_RINGS (24)
44
45/* Hardware definitions begin */
46
47/*
48 * Mapping
49 * RGF File | Host addr | FW addr
50 * | |
51 * user_rgf | 0x000000 | 0x880000
52 * dma_rgf | 0x001000 | 0x881000
53 * pcie_rgf | 0x002000 | 0x882000
54 * | |
55 */
56
57/* Where various structures placed in host address space */
58#define WIL6210_FW_HOST_OFF (0x880000UL)
59
60#define HOSTADDR(fwaddr) (fwaddr - WIL6210_FW_HOST_OFF)
61
62/*
63 * Interrupt control registers block
64 *
65 * each interrupt controlled by the same bit in all registers
66 */
67struct RGF_ICR {
68 u32 ICC; /* Cause Control, RW: 0 - W1C, 1 - COR */
69 u32 ICR; /* Cause, W1C/COR depending on ICC */
70 u32 ICM; /* Cause masked (ICR & ~IMV), W1C/COR depending on ICC */
71 u32 ICS; /* Cause Set, WO */
72 u32 IMV; /* Mask, RW+S/C */
73 u32 IMS; /* Mask Set, write 1 to set */
74 u32 IMC; /* Mask Clear, write 1 to clear */
75} __packed;
76
77/* registers - FW addresses */
78#define RGF_USER_USER_SCRATCH_PAD (0x8802bc)
79#define RGF_USER_USER_ICR (0x880b4c) /* struct RGF_ICR */
80 #define BIT_USER_USER_ICR_SW_INT_2 BIT(18)
81#define RGF_USER_CLKS_CTL_SW_RST_MASK_0 (0x880b14)
82#define RGF_USER_MAC_CPU_0 (0x8801fc)
83#define RGF_USER_USER_CPU_0 (0x8801e0)
84#define RGF_USER_CLKS_CTL_SW_RST_VEC_0 (0x880b04)
85#define RGF_USER_CLKS_CTL_SW_RST_VEC_1 (0x880b08)
86#define RGF_USER_CLKS_CTL_SW_RST_VEC_2 (0x880b0c)
87#define RGF_USER_CLKS_CTL_SW_RST_VEC_3 (0x880b10)
88
89#define RGF_DMA_PSEUDO_CAUSE (0x881c68)
90#define RGF_DMA_PSEUDO_CAUSE_MASK_SW (0x881c6c)
91#define RGF_DMA_PSEUDO_CAUSE_MASK_FW (0x881c70)
92 #define BIT_DMA_PSEUDO_CAUSE_RX BIT(0)
93 #define BIT_DMA_PSEUDO_CAUSE_TX BIT(1)
94 #define BIT_DMA_PSEUDO_CAUSE_MISC BIT(2)
95
96#define RGF_DMA_EP_TX_ICR (0x881bb4) /* struct RGF_ICR */
97 #define BIT_DMA_EP_TX_ICR_TX_DONE BIT(0)
98 #define BIT_DMA_EP_TX_ICR_TX_DONE_N(n) BIT(n+1) /* n = [0..23] */
99#define RGF_DMA_EP_RX_ICR (0x881bd0) /* struct RGF_ICR */
100 #define BIT_DMA_EP_RX_ICR_RX_DONE BIT(0)
101#define RGF_DMA_EP_MISC_ICR (0x881bec) /* struct RGF_ICR */
102 #define BIT_DMA_EP_MISC_ICR_RX_HTRSH BIT(0)
103 #define BIT_DMA_EP_MISC_ICR_TX_NO_ACT BIT(1)
104 #define BIT_DMA_EP_MISC_ICR_FW_INT0 BIT(28)
105 #define BIT_DMA_EP_MISC_ICR_FW_INT1 BIT(29)
106
107/* Interrupt moderation control */
108#define RGF_DMA_ITR_CNT_TRSH (0x881c5c)
109#define RGF_DMA_ITR_CNT_DATA (0x881c60)
110#define RGF_DMA_ITR_CNT_CRL (0x881C64)
111 #define BIT_DMA_ITR_CNT_CRL_EN BIT(0)
112 #define BIT_DMA_ITR_CNT_CRL_EXT_TICK BIT(1)
113 #define BIT_DMA_ITR_CNT_CRL_FOREVER BIT(2)
114 #define BIT_DMA_ITR_CNT_CRL_CLR BIT(3)
115 #define BIT_DMA_ITR_CNT_CRL_REACH_TRSH BIT(4)
116
117/* popular locations */
118#define HOST_MBOX HOSTADDR(RGF_USER_USER_SCRATCH_PAD)
119#define HOST_SW_INT (HOSTADDR(RGF_USER_USER_ICR) + \
120 offsetof(struct RGF_ICR, ICS))
121#define SW_INT_MBOX BIT_USER_USER_ICR_SW_INT_2
122
123/* ISR register bits */
124#define ISR_MISC_FW_READY BIT_DMA_EP_MISC_ICR_FW_INT0
125#define ISR_MISC_MBOX_EVT BIT_DMA_EP_MISC_ICR_FW_INT1
126
127/* Hardware definitions end */
128
129struct wil6210_mbox_ring {
130 u32 base;
131 u16 entry_size; /* max. size of mbox entry, incl. all headers */
132 u16 size;
133 u32 tail;
134 u32 head;
135} __packed;
136
137struct wil6210_mbox_ring_desc {
138 __le32 sync;
139 __le32 addr;
140} __packed;
141
142/* at HOST_OFF_WIL6210_MBOX_CTL */
143struct wil6210_mbox_ctl {
144 struct wil6210_mbox_ring tx;
145 struct wil6210_mbox_ring rx;
146} __packed;
147
148struct wil6210_mbox_hdr {
149 __le16 seq;
150 __le16 len; /* payload, bytes after this header */
151 __le16 type;
152 u8 flags;
153 u8 reserved;
154} __packed;
155
156#define WIL_MBOX_HDR_TYPE_WMI (0)
157
158/* max. value for wil6210_mbox_hdr.len */
159#define MAX_MBOXITEM_SIZE (240)
160
161struct wil6210_mbox_hdr_wmi {
162 u8 reserved0[2];
163 __le16 id;
164 __le16 info1; /* bits [0..3] - device_id, rest - unused */
165 u8 reserved1[2];
166} __packed;
167
168struct pending_wmi_event {
169 struct list_head list;
170 struct {
171 struct wil6210_mbox_hdr hdr;
172 struct wil6210_mbox_hdr_wmi wmi;
173 u8 data[0];
174 } __packed event;
175};
176
177union vring_desc;
178
179struct vring {
180 dma_addr_t pa;
181 volatile union vring_desc *va; /* vring_desc[size], WriteBack by DMA */
182 u16 size; /* number of vring_desc elements */
183 u32 swtail;
184 u32 swhead;
185 u32 hwtail; /* write here to inform hw */
186 void **ctx; /* void *ctx[size] - software context */
187};
188
189enum { /* for wil6210_priv.status */
190 wil_status_fwready = 0,
191 wil_status_fwconnected,
192 wil_status_dontscan,
193 wil_status_irqen, /* FIXME: interrupts enabled - for debug */
194};
195
196struct pci_dev;
197
198struct wil6210_stats {
199 u64 tsf;
200 u32 snr;
201 u16 last_mcs_rx;
202 u16 bf_mcs; /* last BF, used for Tx */
203 u16 my_rx_sector;
204 u16 my_tx_sector;
205 u16 peer_rx_sector;
206 u16 peer_tx_sector;
207};
208
209struct wil6210_priv {
210 struct pci_dev *pdev;
211 int n_msi;
212 struct wireless_dev *wdev;
213 void __iomem *csr;
214 ulong status;
215 /* profile */
216 u32 monitor_flags;
217 u32 secure_pcp; /* create secure PCP? */
218 int sinfo_gen;
219 /* cached ISR registers */
220 u32 isr_misc;
221 /* mailbox related */
222 struct mutex wmi_mutex;
223 struct wil6210_mbox_ctl mbox_ctl;
224 struct completion wmi_ready;
225 u16 wmi_seq;
226 u16 reply_id; /**< wait for this WMI event */
227 void *reply_buf;
228 u16 reply_size;
229 struct workqueue_struct *wmi_wq; /* for deferred calls */
230 struct work_struct wmi_event_worker;
231 struct workqueue_struct *wmi_wq_conn; /* for connect worker */
232 struct work_struct wmi_connect_worker;
233 struct work_struct disconnect_worker;
234 struct timer_list connect_timer;
235 int pending_connect_cid;
236 struct list_head pending_wmi_ev;
237 /*
238 * protect pending_wmi_ev
239 * - fill in IRQ from wil6210_irq_misc,
240 * - consumed in thread by wmi_event_worker
241 */
242 spinlock_t wmi_ev_lock;
243 /* DMA related */
244 struct vring vring_rx;
245 struct vring vring_tx[WIL6210_MAX_TX_RINGS];
246 u8 dst_addr[WIL6210_MAX_TX_RINGS][ETH_ALEN];
247 /* scan */
248 struct cfg80211_scan_request *scan_request;
249
250 struct mutex mutex; /* for wil6210_priv access in wil_{up|down} */
251 /* statistics */
252 struct wil6210_stats stats;
253 /* debugfs */
254 struct dentry *debug;
255 struct debugfs_blob_wrapper fw_code_blob;
256 struct debugfs_blob_wrapper fw_data_blob;
257 struct debugfs_blob_wrapper fw_peri_blob;
258 struct debugfs_blob_wrapper uc_code_blob;
259 struct debugfs_blob_wrapper uc_data_blob;
260 struct debugfs_blob_wrapper rgf_blob;
261};
262
263#define wil_to_wiphy(i) (i->wdev->wiphy)
264#define wil_to_dev(i) (wiphy_dev(wil_to_wiphy(i)))
265#define wiphy_to_wil(w) (struct wil6210_priv *)(wiphy_priv(w))
266#define wil_to_wdev(i) (i->wdev)
267#define wdev_to_wil(w) (struct wil6210_priv *)(wdev_priv(w))
268#define wil_to_ndev(i) (wil_to_wdev(i)->netdev)
269#define ndev_to_wil(n) (wdev_to_wil(n->ieee80211_ptr))
270
271#define wil_dbg(wil, fmt, arg...) netdev_dbg(wil_to_ndev(wil), fmt, ##arg)
272#define wil_info(wil, fmt, arg...) netdev_info(wil_to_ndev(wil), fmt, ##arg)
273#define wil_err(wil, fmt, arg...) netdev_err(wil_to_ndev(wil), fmt, ##arg)
274
275#define wil_dbg_IRQ(wil, fmt, arg...) wil_dbg(wil, "DBG[ IRQ]" fmt, ##arg)
276#define wil_dbg_TXRX(wil, fmt, arg...) wil_dbg(wil, "DBG[TXRX]" fmt, ##arg)
277#define wil_dbg_WMI(wil, fmt, arg...) wil_dbg(wil, "DBG[ WMI]" fmt, ##arg)
278
279#define wil_hex_dump_TXRX(prefix_str, prefix_type, rowsize, \
280 groupsize, buf, len, ascii) \
281 wil_print_hex_dump_debug("DBG[TXRX]" prefix_str,\
282 prefix_type, rowsize, \
283 groupsize, buf, len, ascii)
284
285#define wil_hex_dump_WMI(prefix_str, prefix_type, rowsize, \
286 groupsize, buf, len, ascii) \
287 wil_print_hex_dump_debug("DBG[ WMI]" prefix_str,\
288 prefix_type, rowsize, \
289 groupsize, buf, len, ascii)
290
291void wil_memcpy_fromio_32(void *dst, const volatile void __iomem *src,
292 size_t count);
293void wil_memcpy_toio_32(volatile void __iomem *dst, const void *src,
294 size_t count);
295
296void *wil_if_alloc(struct device *dev, void __iomem *csr);
297void wil_if_free(struct wil6210_priv *wil);
298int wil_if_add(struct wil6210_priv *wil);
299void wil_if_remove(struct wil6210_priv *wil);
300int wil_priv_init(struct wil6210_priv *wil);
301void wil_priv_deinit(struct wil6210_priv *wil);
302int wil_reset(struct wil6210_priv *wil);
303void wil_link_on(struct wil6210_priv *wil);
304void wil_link_off(struct wil6210_priv *wil);
305int wil_up(struct wil6210_priv *wil);
306int wil_down(struct wil6210_priv *wil);
307void wil_mbox_ring_le2cpus(struct wil6210_mbox_ring *r);
308
309void __iomem *wmi_buffer(struct wil6210_priv *wil, __le32 ptr);
310void __iomem *wmi_addr(struct wil6210_priv *wil, u32 ptr);
311int wmi_read_hdr(struct wil6210_priv *wil, __le32 ptr,
312 struct wil6210_mbox_hdr *hdr);
313int wmi_send(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len);
314void wmi_recv_cmd(struct wil6210_priv *wil);
315int wmi_call(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len,
316 u16 reply_id, void *reply, u8 reply_size, int to_msec);
317void wmi_connect_worker(struct work_struct *work);
318void wmi_event_worker(struct work_struct *work);
319void wmi_event_flush(struct wil6210_priv *wil);
320int wmi_set_ssid(struct wil6210_priv *wil, u8 ssid_len, const void *ssid);
321int wmi_get_ssid(struct wil6210_priv *wil, u8 *ssid_len, void *ssid);
322int wmi_set_channel(struct wil6210_priv *wil, int channel);
323int wmi_get_channel(struct wil6210_priv *wil, int *channel);
324int wmi_tx_eapol(struct wil6210_priv *wil, struct sk_buff *skb);
325int wmi_del_cipher_key(struct wil6210_priv *wil, u8 key_index,
326 const void *mac_addr);
327int wmi_add_cipher_key(struct wil6210_priv *wil, u8 key_index,
328 const void *mac_addr, int key_len, const void *key);
329int wmi_echo(struct wil6210_priv *wil);
330int wmi_set_ie(struct wil6210_priv *wil, u8 type, u16 ie_len, const void *ie);
331
332int wil6210_init_irq(struct wil6210_priv *wil, int irq);
333void wil6210_fini_irq(struct wil6210_priv *wil, int irq);
334void wil6210_disable_irq(struct wil6210_priv *wil);
335void wil6210_enable_irq(struct wil6210_priv *wil);
336
337int wil6210_debugfs_init(struct wil6210_priv *wil);
338void wil6210_debugfs_remove(struct wil6210_priv *wil);
339
340struct wireless_dev *wil_cfg80211_init(struct device *dev);
341void wil_wdev_free(struct wil6210_priv *wil);
342
343int wmi_set_mac_address(struct wil6210_priv *wil, void *addr);
344int wmi_set_bcon(struct wil6210_priv *wil, int bi, u8 wmi_nettype);
345void wil6210_disconnect(struct wil6210_priv *wil, void *bssid);
346
347int wil_rx_init(struct wil6210_priv *wil);
348void wil_rx_fini(struct wil6210_priv *wil);
349
350/* TX API */
351int wil_vring_init_tx(struct wil6210_priv *wil, int id, int size,
352 int cid, int tid);
353void wil_vring_fini_tx(struct wil6210_priv *wil, int id);
354
355netdev_tx_t wil_start_xmit(struct sk_buff *skb, struct net_device *ndev);
356void wil_tx_complete(struct wil6210_priv *wil, int ringid);
357
358/* RX API */
359void wil_rx_handle(struct wil6210_priv *wil);
360
361int wil_iftype_nl2wmi(enum nl80211_iftype type);
362
363#endif /* __WIL6210_H__ */
diff --git a/drivers/net/wireless/ath/wil6210/wmi.c b/drivers/net/wireless/ath/wil6210/wmi.c
new file mode 100644
index 000000000000..12915f6e7617
--- /dev/null
+++ b/drivers/net/wireless/ath/wil6210/wmi.c
@@ -0,0 +1,975 @@
1/*
2 * Copyright (c) 2012 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#include <linux/pci.h>
18#include <linux/io.h>
19#include <linux/list.h>
20#include <linux/etherdevice.h>
21
22#include "wil6210.h"
23#include "wmi.h"
24
25/**
26 * WMI event receiving - theory of operations
27 *
28 * When firmware about to report WMI event, it fills memory area
29 * in the mailbox and raises misc. IRQ. Thread interrupt handler invoked for
30 * the misc IRQ, function @wmi_recv_cmd called by thread IRQ handler.
31 *
32 * @wmi_recv_cmd reads event, allocates memory chunk and attaches it to the
33 * event list @wil->pending_wmi_ev. Then, work queue @wil->wmi_wq wakes up
34 * and handles events within the @wmi_event_worker. Every event get detached
35 * from list, processed and deleted.
36 *
37 * Purpose for this mechanism is to release IRQ thread; otherwise,
38 * if WMI event handling involves another WMI command flow, this 2-nd flow
39 * won't be completed because of blocked IRQ thread.
40 */
41
42/**
43 * Addressing - theory of operations
44 *
45 * There are several buses present on the WIL6210 card.
46 * Same memory areas are visible at different address on
47 * the different busses. There are 3 main bus masters:
48 * - MAC CPU (ucode)
49 * - User CPU (firmware)
50 * - AHB (host)
51 *
52 * On the PCI bus, there is one BAR (BAR0) of 2Mb size, exposing
53 * AHB addresses starting from 0x880000
54 *
55 * Internally, firmware uses addresses that allows faster access but
56 * are invisible from the host. To read from these addresses, alternative
57 * AHB address must be used.
58 *
59 * Memory mapping
60 * Linker address PCI/Host address
61 * 0x880000 .. 0xa80000 2Mb BAR0
62 * 0x800000 .. 0x807000 0x900000 .. 0x907000 28k DCCM
63 * 0x840000 .. 0x857000 0x908000 .. 0x91f000 92k PERIPH
64 */
65
66/**
67 * @fw_mapping provides memory remapping table
68 */
69static const struct {
70 u32 from; /* linker address - from, inclusive */
71 u32 to; /* linker address - to, exclusive */
72 u32 host; /* PCI/Host address - BAR0 + 0x880000 */
73} fw_mapping[] = {
74 {0x000000, 0x040000, 0x8c0000}, /* FW code RAM 256k */
75 {0x800000, 0x808000, 0x900000}, /* FW data RAM 32k */
76 {0x840000, 0x860000, 0x908000}, /* peripheral data RAM 128k/96k used */
77 {0x880000, 0x88a000, 0x880000}, /* various RGF */
78 {0x8c0000, 0x932000, 0x8c0000}, /* trivial mapping for upper area */
79 /*
80 * 920000..930000 ucode code RAM
81 * 930000..932000 ucode data RAM
82 */
83};
84
85/**
86 * return AHB address for given firmware/ucode internal (linker) address
87 * @x - internal address
88 * If address have no valid AHB mapping, return 0
89 */
90static u32 wmi_addr_remap(u32 x)
91{
92 uint i;
93
94 for (i = 0; i < ARRAY_SIZE(fw_mapping); i++) {
95 if ((x >= fw_mapping[i].from) && (x < fw_mapping[i].to))
96 return x + fw_mapping[i].host - fw_mapping[i].from;
97 }
98
99 return 0;
100}
101
102/**
103 * Check address validity for WMI buffer; remap if needed
104 * @ptr - internal (linker) fw/ucode address
105 *
106 * Valid buffer should be DWORD aligned
107 *
108 * return address for accessing buffer from the host;
109 * if buffer is not valid, return NULL.
110 */
111void __iomem *wmi_buffer(struct wil6210_priv *wil, __le32 ptr_)
112{
113 u32 off;
114 u32 ptr = le32_to_cpu(ptr_);
115
116 if (ptr % 4)
117 return NULL;
118
119 ptr = wmi_addr_remap(ptr);
120 if (ptr < WIL6210_FW_HOST_OFF)
121 return NULL;
122
123 off = HOSTADDR(ptr);
124 if (off > WIL6210_MEM_SIZE - 4)
125 return NULL;
126
127 return wil->csr + off;
128}
129
130/**
131 * Check address validity
132 */
133void __iomem *wmi_addr(struct wil6210_priv *wil, u32 ptr)
134{
135 u32 off;
136
137 if (ptr % 4)
138 return NULL;
139
140 if (ptr < WIL6210_FW_HOST_OFF)
141 return NULL;
142
143 off = HOSTADDR(ptr);
144 if (off > WIL6210_MEM_SIZE - 4)
145 return NULL;
146
147 return wil->csr + off;
148}
149
150int wmi_read_hdr(struct wil6210_priv *wil, __le32 ptr,
151 struct wil6210_mbox_hdr *hdr)
152{
153 void __iomem *src = wmi_buffer(wil, ptr);
154 if (!src)
155 return -EINVAL;
156
157 wil_memcpy_fromio_32(hdr, src, sizeof(*hdr));
158
159 return 0;
160}
161
162static int __wmi_send(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len)
163{
164 struct {
165 struct wil6210_mbox_hdr hdr;
166 struct wil6210_mbox_hdr_wmi wmi;
167 } __packed cmd = {
168 .hdr = {
169 .type = WIL_MBOX_HDR_TYPE_WMI,
170 .flags = 0,
171 .len = cpu_to_le16(sizeof(cmd.wmi) + len),
172 },
173 .wmi = {
174 .id = cpu_to_le16(cmdid),
175 .info1 = 0,
176 },
177 };
178 struct wil6210_mbox_ring *r = &wil->mbox_ctl.tx;
179 struct wil6210_mbox_ring_desc d_head;
180 u32 next_head;
181 void __iomem *dst;
182 void __iomem *head = wmi_addr(wil, r->head);
183 uint retry;
184
185 if (sizeof(cmd) + len > r->entry_size) {
186 wil_err(wil, "WMI size too large: %d bytes, max is %d\n",
187 (int)(sizeof(cmd) + len), r->entry_size);
188 return -ERANGE;
189
190 }
191
192 might_sleep();
193
194 if (!test_bit(wil_status_fwready, &wil->status)) {
195 wil_err(wil, "FW not ready\n");
196 return -EAGAIN;
197 }
198
199 if (!head) {
200 wil_err(wil, "WMI head is garbage: 0x%08x\n", r->head);
201 return -EINVAL;
202 }
203 /* read Tx head till it is not busy */
204 for (retry = 5; retry > 0; retry--) {
205 wil_memcpy_fromio_32(&d_head, head, sizeof(d_head));
206 if (d_head.sync == 0)
207 break;
208 msleep(20);
209 }
210 if (d_head.sync != 0) {
211 wil_err(wil, "WMI head busy\n");
212 return -EBUSY;
213 }
214 /* next head */
215 next_head = r->base + ((r->head - r->base + sizeof(d_head)) % r->size);
216 wil_dbg_WMI(wil, "Head 0x%08x -> 0x%08x\n", r->head, next_head);
217 /* wait till FW finish with previous command */
218 for (retry = 5; retry > 0; retry--) {
219 r->tail = ioread32(wil->csr + HOST_MBOX +
220 offsetof(struct wil6210_mbox_ctl, tx.tail));
221 if (next_head != r->tail)
222 break;
223 msleep(20);
224 }
225 if (next_head == r->tail) {
226 wil_err(wil, "WMI ring full\n");
227 return -EBUSY;
228 }
229 dst = wmi_buffer(wil, d_head.addr);
230 if (!dst) {
231 wil_err(wil, "invalid WMI buffer: 0x%08x\n",
232 le32_to_cpu(d_head.addr));
233 return -EINVAL;
234 }
235 cmd.hdr.seq = cpu_to_le16(++wil->wmi_seq);
236 /* set command */
237 wil_dbg_WMI(wil, "WMI command 0x%04x [%d]\n", cmdid, len);
238 wil_hex_dump_WMI("Cmd ", DUMP_PREFIX_OFFSET, 16, 1, &cmd,
239 sizeof(cmd), true);
240 wil_hex_dump_WMI("cmd ", DUMP_PREFIX_OFFSET, 16, 1, buf,
241 len, true);
242 wil_memcpy_toio_32(dst, &cmd, sizeof(cmd));
243 wil_memcpy_toio_32(dst + sizeof(cmd), buf, len);
244 /* mark entry as full */
245 iowrite32(1, wil->csr + HOSTADDR(r->head) +
246 offsetof(struct wil6210_mbox_ring_desc, sync));
247 /* advance next ptr */
248 iowrite32(r->head = next_head, wil->csr + HOST_MBOX +
249 offsetof(struct wil6210_mbox_ctl, tx.head));
250
251 /* interrupt to FW */
252 iowrite32(SW_INT_MBOX, wil->csr + HOST_SW_INT);
253
254 return 0;
255}
256
257int wmi_send(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len)
258{
259 int rc;
260
261 mutex_lock(&wil->wmi_mutex);
262 rc = __wmi_send(wil, cmdid, buf, len);
263 mutex_unlock(&wil->wmi_mutex);
264
265 return rc;
266}
267
268/*=== Event handlers ===*/
269static void wmi_evt_ready(struct wil6210_priv *wil, int id, void *d, int len)
270{
271 struct net_device *ndev = wil_to_ndev(wil);
272 struct wireless_dev *wdev = wil->wdev;
273 struct wmi_ready_event *evt = d;
274 u32 ver = le32_to_cpu(evt->sw_version);
275
276 wil_dbg_WMI(wil, "FW ver. %d; MAC %pM\n", ver, evt->mac);
277
278 if (!is_valid_ether_addr(ndev->dev_addr)) {
279 memcpy(ndev->dev_addr, evt->mac, ETH_ALEN);
280 memcpy(ndev->perm_addr, evt->mac, ETH_ALEN);
281 }
282 snprintf(wdev->wiphy->fw_version, sizeof(wdev->wiphy->fw_version),
283 "%d", ver);
284}
285
286static void wmi_evt_fw_ready(struct wil6210_priv *wil, int id, void *d,
287 int len)
288{
289 wil_dbg_WMI(wil, "WMI: FW ready\n");
290
291 set_bit(wil_status_fwready, &wil->status);
292 /* reuse wmi_ready for the firmware ready indication */
293 complete(&wil->wmi_ready);
294}
295
296static void wmi_evt_rx_mgmt(struct wil6210_priv *wil, int id, void *d, int len)
297{
298 struct wmi_rx_mgmt_packet_event *data = d;
299 struct wiphy *wiphy = wil_to_wiphy(wil);
300 struct ieee80211_mgmt *rx_mgmt_frame =
301 (struct ieee80211_mgmt *)data->payload;
302 int ch_no = data->info.channel+1;
303 u32 freq = ieee80211_channel_to_frequency(ch_no,
304 IEEE80211_BAND_60GHZ);
305 struct ieee80211_channel *channel = ieee80211_get_channel(wiphy, freq);
306 /* TODO convert LE to CPU */
307 s32 signal = 0; /* TODO */
308 __le16 fc = rx_mgmt_frame->frame_control;
309 u32 d_len = le32_to_cpu(data->info.len);
310 u16 d_status = le16_to_cpu(data->info.status);
311
312 wil_dbg_WMI(wil, "MGMT: channel %d MCS %d SNR %d\n",
313 data->info.channel, data->info.mcs, data->info.snr);
314 wil_dbg_WMI(wil, "status 0x%04x len %d stype %04x\n", d_status, d_len,
315 le16_to_cpu(data->info.stype));
316 wil_dbg_WMI(wil, "qid %d mid %d cid %d\n",
317 data->info.qid, data->info.mid, data->info.cid);
318
319 if (!channel) {
320 wil_err(wil, "Frame on unsupported channel\n");
321 return;
322 }
323
324 if (ieee80211_is_beacon(fc) || ieee80211_is_probe_resp(fc)) {
325 struct cfg80211_bss *bss;
326 u64 tsf = le64_to_cpu(rx_mgmt_frame->u.beacon.timestamp);
327 u16 cap = le16_to_cpu(rx_mgmt_frame->u.beacon.capab_info);
328 u16 bi = le16_to_cpu(rx_mgmt_frame->u.beacon.beacon_int);
329 const u8 *ie_buf = rx_mgmt_frame->u.beacon.variable;
330 size_t ie_len = d_len - offsetof(struct ieee80211_mgmt,
331 u.beacon.variable);
332 wil_dbg_WMI(wil, "Capability info : 0x%04x\n", cap);
333
334 bss = cfg80211_inform_bss(wiphy, channel, rx_mgmt_frame->bssid,
335 tsf, cap, bi, ie_buf, ie_len,
336 signal, GFP_KERNEL);
337 if (bss) {
338 wil_dbg_WMI(wil, "Added BSS %pM\n",
339 rx_mgmt_frame->bssid);
340 cfg80211_put_bss(bss);
341 } else {
342 wil_err(wil, "cfg80211_inform_bss() failed\n");
343 }
344 }
345}
346
347static void wmi_evt_scan_complete(struct wil6210_priv *wil, int id,
348 void *d, int len)
349{
350 if (wil->scan_request) {
351 struct wmi_scan_complete_event *data = d;
352 bool aborted = (data->status != 0);
353
354 wil_dbg_WMI(wil, "SCAN_COMPLETE(0x%08x)\n", data->status);
355 cfg80211_scan_done(wil->scan_request, aborted);
356 wil->scan_request = NULL;
357 } else {
358 wil_err(wil, "SCAN_COMPLETE while not scanning\n");
359 }
360}
361
362static void wmi_evt_connect(struct wil6210_priv *wil, int id, void *d, int len)
363{
364 struct net_device *ndev = wil_to_ndev(wil);
365 struct wireless_dev *wdev = wil->wdev;
366 struct wmi_connect_event *evt = d;
367 int ch; /* channel number */
368 struct station_info sinfo;
369 u8 *assoc_req_ie, *assoc_resp_ie;
370 size_t assoc_req_ielen, assoc_resp_ielen;
371 /* capinfo(u16) + listen_interval(u16) + IEs */
372 const size_t assoc_req_ie_offset = sizeof(u16) * 2;
373 /* capinfo(u16) + status_code(u16) + associd(u16) + IEs */
374 const size_t assoc_resp_ie_offset = sizeof(u16) * 3;
375
376 if (len < sizeof(*evt)) {
377 wil_err(wil, "Connect event too short : %d bytes\n", len);
378 return;
379 }
380 if (len != sizeof(*evt) + evt->beacon_ie_len + evt->assoc_req_len +
381 evt->assoc_resp_len) {
382 wil_err(wil,
383 "Connect event corrupted : %d != %d + %d + %d + %d\n",
384 len, (int)sizeof(*evt), evt->beacon_ie_len,
385 evt->assoc_req_len, evt->assoc_resp_len);
386 return;
387 }
388 ch = evt->channel + 1;
389 wil_dbg_WMI(wil, "Connect %pM channel [%d] cid %d\n",
390 evt->bssid, ch, evt->cid);
391 wil_hex_dump_WMI("connect AI : ", DUMP_PREFIX_OFFSET, 16, 1,
392 evt->assoc_info, len - sizeof(*evt), true);
393
394 /* figure out IE's */
395 assoc_req_ie = &evt->assoc_info[evt->beacon_ie_len +
396 assoc_req_ie_offset];
397 assoc_req_ielen = evt->assoc_req_len - assoc_req_ie_offset;
398 if (evt->assoc_req_len <= assoc_req_ie_offset) {
399 assoc_req_ie = NULL;
400 assoc_req_ielen = 0;
401 }
402
403 assoc_resp_ie = &evt->assoc_info[evt->beacon_ie_len +
404 evt->assoc_req_len +
405 assoc_resp_ie_offset];
406 assoc_resp_ielen = evt->assoc_resp_len - assoc_resp_ie_offset;
407 if (evt->assoc_resp_len <= assoc_resp_ie_offset) {
408 assoc_resp_ie = NULL;
409 assoc_resp_ielen = 0;
410 }
411
412 if ((wdev->iftype == NL80211_IFTYPE_STATION) ||
413 (wdev->iftype == NL80211_IFTYPE_P2P_CLIENT)) {
414 if (wdev->sme_state != CFG80211_SME_CONNECTING) {
415 wil_err(wil, "Not in connecting state\n");
416 return;
417 }
418 del_timer_sync(&wil->connect_timer);
419 cfg80211_connect_result(ndev, evt->bssid,
420 assoc_req_ie, assoc_req_ielen,
421 assoc_resp_ie, assoc_resp_ielen,
422 WLAN_STATUS_SUCCESS, GFP_KERNEL);
423
424 } else if ((wdev->iftype == NL80211_IFTYPE_AP) ||
425 (wdev->iftype == NL80211_IFTYPE_P2P_GO)) {
426 memset(&sinfo, 0, sizeof(sinfo));
427
428 sinfo.generation = wil->sinfo_gen++;
429
430 if (assoc_req_ie) {
431 sinfo.assoc_req_ies = assoc_req_ie;
432 sinfo.assoc_req_ies_len = assoc_req_ielen;
433 sinfo.filled |= STATION_INFO_ASSOC_REQ_IES;
434 }
435
436 cfg80211_new_sta(ndev, evt->bssid, &sinfo, GFP_KERNEL);
437 }
438 set_bit(wil_status_fwconnected, &wil->status);
439
440 /* FIXME FW can transmit only ucast frames to peer */
441 /* FIXME real ring_id instead of hard coded 0 */
442 memcpy(wil->dst_addr[0], evt->bssid, ETH_ALEN);
443
444 wil->pending_connect_cid = evt->cid;
445 queue_work(wil->wmi_wq_conn, &wil->wmi_connect_worker);
446}
447
448static void wmi_evt_disconnect(struct wil6210_priv *wil, int id,
449 void *d, int len)
450{
451 struct wmi_disconnect_event *evt = d;
452
453 wil_dbg_WMI(wil, "Disconnect %pM reason %d proto %d wmi\n",
454 evt->bssid,
455 evt->protocol_reason_status, evt->disconnect_reason);
456
457 wil->sinfo_gen++;
458
459 wil6210_disconnect(wil, evt->bssid);
460 clear_bit(wil_status_dontscan, &wil->status);
461}
462
463static void wmi_evt_notify(struct wil6210_priv *wil, int id, void *d, int len)
464{
465 struct wmi_notify_req_done_event *evt = d;
466
467 if (len < sizeof(*evt)) {
468 wil_err(wil, "Short NOTIFY event\n");
469 return;
470 }
471
472 wil->stats.tsf = le64_to_cpu(evt->tsf);
473 wil->stats.snr = le32_to_cpu(evt->snr_val);
474 wil->stats.bf_mcs = le16_to_cpu(evt->bf_mcs);
475 wil->stats.my_rx_sector = le16_to_cpu(evt->my_rx_sector);
476 wil->stats.my_tx_sector = le16_to_cpu(evt->my_tx_sector);
477 wil->stats.peer_rx_sector = le16_to_cpu(evt->other_rx_sector);
478 wil->stats.peer_tx_sector = le16_to_cpu(evt->other_tx_sector);
479 wil_dbg_WMI(wil, "Link status, MCS %d TSF 0x%016llx\n"
480 "BF status 0x%08x SNR 0x%08x\n"
481 "Tx Tpt %d goodput %d Rx goodput %d\n"
482 "Sectors(rx:tx) my %d:%d peer %d:%d\n",
483 wil->stats.bf_mcs, wil->stats.tsf, evt->status,
484 wil->stats.snr, le32_to_cpu(evt->tx_tpt),
485 le32_to_cpu(evt->tx_goodput), le32_to_cpu(evt->rx_goodput),
486 wil->stats.my_rx_sector, wil->stats.my_tx_sector,
487 wil->stats.peer_rx_sector, wil->stats.peer_tx_sector);
488}
489
490/*
491 * Firmware reports EAPOL frame using WME event.
492 * Reconstruct Ethernet frame and deliver it via normal Rx
493 */
494static void wmi_evt_eapol_rx(struct wil6210_priv *wil, int id,
495 void *d, int len)
496{
497 struct net_device *ndev = wil_to_ndev(wil);
498 struct wmi_eapol_rx_event *evt = d;
499 u16 eapol_len = le16_to_cpu(evt->eapol_len);
500 int sz = eapol_len + ETH_HLEN;
501 struct sk_buff *skb;
502 struct ethhdr *eth;
503
504 wil_dbg_WMI(wil, "EAPOL len %d from %pM\n", eapol_len,
505 evt->src_mac);
506
507 if (eapol_len > 196) { /* TODO: revisit size limit */
508 wil_err(wil, "EAPOL too large\n");
509 return;
510 }
511
512 skb = alloc_skb(sz, GFP_KERNEL);
513 if (!skb) {
514 wil_err(wil, "Failed to allocate skb\n");
515 return;
516 }
517 eth = (struct ethhdr *)skb_put(skb, ETH_HLEN);
518 memcpy(eth->h_dest, ndev->dev_addr, ETH_ALEN);
519 memcpy(eth->h_source, evt->src_mac, ETH_ALEN);
520 eth->h_proto = cpu_to_be16(ETH_P_PAE);
521 memcpy(skb_put(skb, eapol_len), evt->eapol, eapol_len);
522 skb->protocol = eth_type_trans(skb, ndev);
523 if (likely(netif_rx_ni(skb) == NET_RX_SUCCESS)) {
524 ndev->stats.rx_packets++;
525 ndev->stats.rx_bytes += skb->len;
526 } else {
527 ndev->stats.rx_dropped++;
528 }
529}
530
531static const struct {
532 int eventid;
533 void (*handler)(struct wil6210_priv *wil, int eventid,
534 void *data, int data_len);
535} wmi_evt_handlers[] = {
536 {WMI_READY_EVENTID, wmi_evt_ready},
537 {WMI_FW_READY_EVENTID, wmi_evt_fw_ready},
538 {WMI_RX_MGMT_PACKET_EVENTID, wmi_evt_rx_mgmt},
539 {WMI_SCAN_COMPLETE_EVENTID, wmi_evt_scan_complete},
540 {WMI_CONNECT_EVENTID, wmi_evt_connect},
541 {WMI_DISCONNECT_EVENTID, wmi_evt_disconnect},
542 {WMI_NOTIFY_REQ_DONE_EVENTID, wmi_evt_notify},
543 {WMI_EAPOL_RX_EVENTID, wmi_evt_eapol_rx},
544};
545
546/*
547 * Run in IRQ context
548 * Extract WMI command from mailbox. Queue it to the @wil->pending_wmi_ev
549 * that will be eventually handled by the @wmi_event_worker in the thread
550 * context of thread "wil6210_wmi"
551 */
552void wmi_recv_cmd(struct wil6210_priv *wil)
553{
554 struct wil6210_mbox_ring_desc d_tail;
555 struct wil6210_mbox_hdr hdr;
556 struct wil6210_mbox_ring *r = &wil->mbox_ctl.rx;
557 struct pending_wmi_event *evt;
558 u8 *cmd;
559 void __iomem *src;
560 ulong flags;
561
562 for (;;) {
563 u16 len;
564
565 r->head = ioread32(wil->csr + HOST_MBOX +
566 offsetof(struct wil6210_mbox_ctl, rx.head));
567 if (r->tail == r->head)
568 return;
569
570 /* read cmd from tail */
571 wil_memcpy_fromio_32(&d_tail, wil->csr + HOSTADDR(r->tail),
572 sizeof(struct wil6210_mbox_ring_desc));
573 if (d_tail.sync == 0) {
574 wil_err(wil, "Mbox evt not owned by FW?\n");
575 return;
576 }
577
578 if (0 != wmi_read_hdr(wil, d_tail.addr, &hdr)) {
579 wil_err(wil, "Mbox evt at 0x%08x?\n",
580 le32_to_cpu(d_tail.addr));
581 return;
582 }
583
584 len = le16_to_cpu(hdr.len);
585 src = wmi_buffer(wil, d_tail.addr) +
586 sizeof(struct wil6210_mbox_hdr);
587 evt = kmalloc(ALIGN(offsetof(struct pending_wmi_event,
588 event.wmi) + len, 4),
589 GFP_KERNEL);
590 if (!evt) {
591 wil_err(wil, "kmalloc for WMI event (%d) failed\n",
592 len);
593 return;
594 }
595 evt->event.hdr = hdr;
596 cmd = (void *)&evt->event.wmi;
597 wil_memcpy_fromio_32(cmd, src, len);
598 /* mark entry as empty */
599 iowrite32(0, wil->csr + HOSTADDR(r->tail) +
600 offsetof(struct wil6210_mbox_ring_desc, sync));
601 /* indicate */
602 wil_dbg_WMI(wil, "Mbox evt %04x %04x %04x %02x\n",
603 le16_to_cpu(hdr.seq), len, le16_to_cpu(hdr.type),
604 hdr.flags);
605 if ((hdr.type == WIL_MBOX_HDR_TYPE_WMI) &&
606 (len >= sizeof(struct wil6210_mbox_hdr_wmi))) {
607 wil_dbg_WMI(wil, "WMI event 0x%04x\n",
608 evt->event.wmi.id);
609 }
610 wil_hex_dump_WMI("evt ", DUMP_PREFIX_OFFSET, 16, 1,
611 &evt->event.hdr, sizeof(hdr) + len, true);
612
613 /* advance tail */
614 r->tail = r->base + ((r->tail - r->base +
615 sizeof(struct wil6210_mbox_ring_desc)) % r->size);
616 iowrite32(r->tail, wil->csr + HOST_MBOX +
617 offsetof(struct wil6210_mbox_ctl, rx.tail));
618
619 /* add to the pending list */
620 spin_lock_irqsave(&wil->wmi_ev_lock, flags);
621 list_add_tail(&evt->list, &wil->pending_wmi_ev);
622 spin_unlock_irqrestore(&wil->wmi_ev_lock, flags);
623 {
624 int q = queue_work(wil->wmi_wq,
625 &wil->wmi_event_worker);
626 wil_dbg_WMI(wil, "queue_work -> %d\n", q);
627 }
628 }
629}
630
631int wmi_call(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len,
632 u16 reply_id, void *reply, u8 reply_size, int to_msec)
633{
634 int rc;
635 int remain;
636
637 mutex_lock(&wil->wmi_mutex);
638
639 rc = __wmi_send(wil, cmdid, buf, len);
640 if (rc)
641 goto out;
642
643 wil->reply_id = reply_id;
644 wil->reply_buf = reply;
645 wil->reply_size = reply_size;
646 remain = wait_for_completion_timeout(&wil->wmi_ready,
647 msecs_to_jiffies(to_msec));
648 if (0 == remain) {
649 wil_err(wil, "wmi_call(0x%04x->0x%04x) timeout %d msec\n",
650 cmdid, reply_id, to_msec);
651 rc = -ETIME;
652 } else {
653 wil_dbg_WMI(wil,
654 "wmi_call(0x%04x->0x%04x) completed in %d msec\n",
655 cmdid, reply_id,
656 to_msec - jiffies_to_msecs(remain));
657 }
658 wil->reply_id = 0;
659 wil->reply_buf = NULL;
660 wil->reply_size = 0;
661 out:
662 mutex_unlock(&wil->wmi_mutex);
663
664 return rc;
665}
666
667int wmi_echo(struct wil6210_priv *wil)
668{
669 struct wmi_echo_cmd cmd = {
670 .value = cpu_to_le32(0x12345678),
671 };
672
673 return wmi_call(wil, WMI_ECHO_CMDID, &cmd, sizeof(cmd),
674 WMI_ECHO_RSP_EVENTID, NULL, 0, 20);
675}
676
677int wmi_set_mac_address(struct wil6210_priv *wil, void *addr)
678{
679 struct wmi_set_mac_address_cmd cmd;
680
681 memcpy(cmd.mac, addr, ETH_ALEN);
682
683 wil_dbg_WMI(wil, "Set MAC %pM\n", addr);
684
685 return wmi_send(wil, WMI_SET_MAC_ADDRESS_CMDID, &cmd, sizeof(cmd));
686}
687
688int wmi_set_bcon(struct wil6210_priv *wil, int bi, u8 wmi_nettype)
689{
690 struct wmi_bcon_ctrl_cmd cmd = {
691 .bcon_interval = cpu_to_le16(bi),
692 .network_type = wmi_nettype,
693 .disable_sec_offload = 1,
694 };
695
696 if (!wil->secure_pcp)
697 cmd.disable_sec = 1;
698
699 return wmi_send(wil, WMI_BCON_CTRL_CMDID, &cmd, sizeof(cmd));
700}
701
702int wmi_set_ssid(struct wil6210_priv *wil, u8 ssid_len, const void *ssid)
703{
704 struct wmi_set_ssid_cmd cmd = {
705 .ssid_len = cpu_to_le32(ssid_len),
706 };
707
708 if (ssid_len > sizeof(cmd.ssid))
709 return -EINVAL;
710
711 memcpy(cmd.ssid, ssid, ssid_len);
712
713 return wmi_send(wil, WMI_SET_SSID_CMDID, &cmd, sizeof(cmd));
714}
715
716int wmi_get_ssid(struct wil6210_priv *wil, u8 *ssid_len, void *ssid)
717{
718 int rc;
719 struct {
720 struct wil6210_mbox_hdr_wmi wmi;
721 struct wmi_set_ssid_cmd cmd;
722 } __packed reply;
723 int len; /* reply.cmd.ssid_len in CPU order */
724
725 rc = wmi_call(wil, WMI_GET_SSID_CMDID, NULL, 0, WMI_GET_SSID_EVENTID,
726 &reply, sizeof(reply), 20);
727 if (rc)
728 return rc;
729
730 len = le32_to_cpu(reply.cmd.ssid_len);
731 if (len > sizeof(reply.cmd.ssid))
732 return -EINVAL;
733
734 *ssid_len = len;
735 memcpy(ssid, reply.cmd.ssid, len);
736
737 return 0;
738}
739
740int wmi_set_channel(struct wil6210_priv *wil, int channel)
741{
742 struct wmi_set_pcp_channel_cmd cmd = {
743 .channel = channel - 1,
744 };
745
746 return wmi_send(wil, WMI_SET_PCP_CHANNEL_CMDID, &cmd, sizeof(cmd));
747}
748
749int wmi_get_channel(struct wil6210_priv *wil, int *channel)
750{
751 int rc;
752 struct {
753 struct wil6210_mbox_hdr_wmi wmi;
754 struct wmi_set_pcp_channel_cmd cmd;
755 } __packed reply;
756
757 rc = wmi_call(wil, WMI_GET_PCP_CHANNEL_CMDID, NULL, 0,
758 WMI_GET_PCP_CHANNEL_EVENTID, &reply, sizeof(reply), 20);
759 if (rc)
760 return rc;
761
762 if (reply.cmd.channel > 3)
763 return -EINVAL;
764
765 *channel = reply.cmd.channel + 1;
766
767 return 0;
768}
769
770int wmi_tx_eapol(struct wil6210_priv *wil, struct sk_buff *skb)
771{
772 struct wmi_eapol_tx_cmd *cmd;
773 struct ethhdr *eth;
774 u16 eapol_len = skb->len - ETH_HLEN;
775 void *eapol = skb->data + ETH_HLEN;
776 uint i;
777 int rc;
778
779 skb_set_mac_header(skb, 0);
780 eth = eth_hdr(skb);
781 wil_dbg_WMI(wil, "EAPOL %d bytes to %pM\n", eapol_len, eth->h_dest);
782 for (i = 0; i < ARRAY_SIZE(wil->vring_tx); i++) {
783 if (memcmp(wil->dst_addr[i], eth->h_dest, ETH_ALEN) == 0)
784 goto found_dest;
785 }
786
787 return -EINVAL;
788
789 found_dest:
790 /* find out eapol data & len */
791 cmd = kzalloc(sizeof(*cmd) + eapol_len, GFP_KERNEL);
792 if (!cmd)
793 return -EINVAL;
794
795 memcpy(cmd->dst_mac, eth->h_dest, ETH_ALEN);
796 cmd->eapol_len = cpu_to_le16(eapol_len);
797 memcpy(cmd->eapol, eapol, eapol_len);
798 rc = wmi_send(wil, WMI_EAPOL_TX_CMDID, cmd, sizeof(*cmd) + eapol_len);
799 kfree(cmd);
800
801 return rc;
802}
803
804int wmi_del_cipher_key(struct wil6210_priv *wil, u8 key_index,
805 const void *mac_addr)
806{
807 struct wmi_delete_cipher_key_cmd cmd = {
808 .key_index = key_index,
809 };
810
811 if (mac_addr)
812 memcpy(cmd.mac, mac_addr, WMI_MAC_LEN);
813
814 return wmi_send(wil, WMI_DELETE_CIPHER_KEY_CMDID, &cmd, sizeof(cmd));
815}
816
817int wmi_add_cipher_key(struct wil6210_priv *wil, u8 key_index,
818 const void *mac_addr, int key_len, const void *key)
819{
820 struct wmi_add_cipher_key_cmd cmd = {
821 .key_index = key_index,
822 .key_usage = WMI_KEY_USE_PAIRWISE,
823 .key_len = key_len,
824 };
825
826 if (!key || (key_len > sizeof(cmd.key)))
827 return -EINVAL;
828
829 memcpy(cmd.key, key, key_len);
830 if (mac_addr)
831 memcpy(cmd.mac, mac_addr, WMI_MAC_LEN);
832
833 return wmi_send(wil, WMI_ADD_CIPHER_KEY_CMDID, &cmd, sizeof(cmd));
834}
835
836int wmi_set_ie(struct wil6210_priv *wil, u8 type, u16 ie_len, const void *ie)
837{
838 int rc;
839 u16 len = sizeof(struct wmi_set_appie_cmd) + ie_len;
840 struct wmi_set_appie_cmd *cmd = kzalloc(len, GFP_KERNEL);
841 if (!cmd) {
842 wil_err(wil, "kmalloc(%d) failed\n", len);
843 return -ENOMEM;
844 }
845
846 cmd->mgmt_frm_type = type;
847 /* BUG: FW API define ieLen as u8. Will fix FW */
848 cmd->ie_len = cpu_to_le16(ie_len);
849 memcpy(cmd->ie_info, ie, ie_len);
850 rc = wmi_send(wil, WMI_SET_APPIE_CMDID, &cmd, len);
851 kfree(cmd);
852
853 return rc;
854}
855
856void wmi_event_flush(struct wil6210_priv *wil)
857{
858 struct pending_wmi_event *evt, *t;
859
860 wil_dbg_WMI(wil, "%s()\n", __func__);
861
862 list_for_each_entry_safe(evt, t, &wil->pending_wmi_ev, list) {
863 list_del(&evt->list);
864 kfree(evt);
865 }
866}
867
868static bool wmi_evt_call_handler(struct wil6210_priv *wil, int id,
869 void *d, int len)
870{
871 uint i;
872
873 for (i = 0; i < ARRAY_SIZE(wmi_evt_handlers); i++) {
874 if (wmi_evt_handlers[i].eventid == id) {
875 wmi_evt_handlers[i].handler(wil, id, d, len);
876 return true;
877 }
878 }
879
880 return false;
881}
882
883static void wmi_event_handle(struct wil6210_priv *wil,
884 struct wil6210_mbox_hdr *hdr)
885{
886 u16 len = le16_to_cpu(hdr->len);
887
888 if ((hdr->type == WIL_MBOX_HDR_TYPE_WMI) &&
889 (len >= sizeof(struct wil6210_mbox_hdr_wmi))) {
890 struct wil6210_mbox_hdr_wmi *wmi = (void *)(&hdr[1]);
891 void *evt_data = (void *)(&wmi[1]);
892 u16 id = le16_to_cpu(wmi->id);
893 /* check if someone waits for this event */
894 if (wil->reply_id && wil->reply_id == id) {
895 if (wil->reply_buf) {
896 memcpy(wil->reply_buf, wmi,
897 min(len, wil->reply_size));
898 } else {
899 wmi_evt_call_handler(wil, id, evt_data,
900 len - sizeof(*wmi));
901 }
902 wil_dbg_WMI(wil, "Complete WMI 0x%04x\n", id);
903 complete(&wil->wmi_ready);
904 return;
905 }
906 /* unsolicited event */
907 /* search for handler */
908 if (!wmi_evt_call_handler(wil, id, evt_data,
909 len - sizeof(*wmi))) {
910 wil_err(wil, "Unhandled event 0x%04x\n", id);
911 }
912 } else {
913 wil_err(wil, "Unknown event type\n");
914 print_hex_dump(KERN_ERR, "evt?? ", DUMP_PREFIX_OFFSET, 16, 1,
915 hdr, sizeof(*hdr) + len, true);
916 }
917}
918
919/*
920 * Retrieve next WMI event from the pending list
921 */
922static struct list_head *next_wmi_ev(struct wil6210_priv *wil)
923{
924 ulong flags;
925 struct list_head *ret = NULL;
926
927 spin_lock_irqsave(&wil->wmi_ev_lock, flags);
928
929 if (!list_empty(&wil->pending_wmi_ev)) {
930 ret = wil->pending_wmi_ev.next;
931 list_del(ret);
932 }
933
934 spin_unlock_irqrestore(&wil->wmi_ev_lock, flags);
935
936 return ret;
937}
938
939/*
940 * Handler for the WMI events
941 */
942void wmi_event_worker(struct work_struct *work)
943{
944 struct wil6210_priv *wil = container_of(work, struct wil6210_priv,
945 wmi_event_worker);
946 struct pending_wmi_event *evt;
947 struct list_head *lh;
948
949 while ((lh = next_wmi_ev(wil)) != NULL) {
950 evt = list_entry(lh, struct pending_wmi_event, list);
951 wmi_event_handle(wil, &evt->event.hdr);
952 kfree(evt);
953 }
954}
955
956void wmi_connect_worker(struct work_struct *work)
957{
958 int rc;
959 struct wil6210_priv *wil = container_of(work, struct wil6210_priv,
960 wmi_connect_worker);
961
962 if (wil->pending_connect_cid < 0) {
963 wil_err(wil, "No connection pending\n");
964 return;
965 }
966
967 wil_dbg_WMI(wil, "Configure for connection CID %d\n",
968 wil->pending_connect_cid);
969
970 rc = wil_vring_init_tx(wil, 0, WIL6210_TX_RING_SIZE,
971 wil->pending_connect_cid, 0);
972 wil->pending_connect_cid = -1;
973 if (rc == 0)
974 wil_link_on(wil);
975}
diff --git a/drivers/net/wireless/ath/wil6210/wmi.h b/drivers/net/wireless/ath/wil6210/wmi.h
new file mode 100644
index 000000000000..3bbf87572b07
--- /dev/null
+++ b/drivers/net/wireless/ath/wil6210/wmi.h
@@ -0,0 +1,1116 @@
1/*
2 * Copyright (c) 2012 Qualcomm Atheros, Inc.
3 * Copyright (c) 2006-2012 Wilocity .
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18/*
19 * This file contains the definitions of the WMI protocol specified in the
20 * Wireless Module Interface (WMI) for the Wilocity
21 * MARLON 60 Gigabit wireless solution.
22 * It includes definitions of all the commands and events.
23 * Commands are messages from the host to the WM.
24 * Events are messages from the WM to the host.
25 */
26
27#ifndef __WILOCITY_WMI_H__
28#define __WILOCITY_WMI_H__
29
30/* General */
31
32#define WMI_MAC_LEN (6)
33#define WMI_PROX_RANGE_NUM (3)
34
35/* List of Commands */
36enum wmi_command_id {
37 WMI_CONNECT_CMDID = 0x0001,
38 WMI_DISCONNECT_CMDID = 0x0003,
39 WMI_START_SCAN_CMDID = 0x0007,
40 WMI_SET_BSS_FILTER_CMDID = 0x0009,
41 WMI_SET_PROBED_SSID_CMDID = 0x000a,
42 WMI_SET_LISTEN_INT_CMDID = 0x000b,
43 WMI_BCON_CTRL_CMDID = 0x000f,
44 WMI_ADD_CIPHER_KEY_CMDID = 0x0016,
45 WMI_DELETE_CIPHER_KEY_CMDID = 0x0017,
46 WMI_SET_APPIE_CMDID = 0x003f,
47 WMI_GET_APPIE_CMDID = 0x0040,
48 WMI_SET_WSC_STATUS_CMDID = 0x0041,
49 WMI_PXMT_RANGE_CFG_CMDID = 0x0042,
50 WMI_PXMT_SNR2_RANGE_CFG_CMDID = 0x0043,
51 WMI_FAST_MEM_ACC_MODE_CMDID = 0x0300,
52 WMI_MEM_READ_CMDID = 0x0800,
53 WMI_MEM_WR_CMDID = 0x0801,
54 WMI_ECHO_CMDID = 0x0803,
55 WMI_DEEP_ECHO_CMDID = 0x0804,
56 WMI_CONFIG_MAC_CMDID = 0x0805,
57 WMI_CONFIG_PHY_DEBUG_CMDID = 0x0806,
58 WMI_ADD_STATION_CMDID = 0x0807,
59 WMI_ADD_DEBUG_TX_PCKT_CMDID = 0x0808,
60 WMI_PHY_GET_STATISTICS_CMDID = 0x0809,
61 WMI_FS_TUNE_CMDID = 0x080a,
62 WMI_CORR_MEASURE_CMDID = 0x080b,
63 WMI_TEMP_SENSE_CMDID = 0x080e,
64 WMI_DC_CALIB_CMDID = 0x080f,
65 WMI_SEND_TONE_CMDID = 0x0810,
66 WMI_IQ_TX_CALIB_CMDID = 0x0811,
67 WMI_IQ_RX_CALIB_CMDID = 0x0812,
68 WMI_SET_UCODE_IDLE_CMDID = 0x0813,
69 WMI_SET_WORK_MODE_CMDID = 0x0815,
70 WMI_LO_LEAKAGE_CALIB_CMDID = 0x0816,
71 WMI_MARLON_R_ACTIVATE_CMDID = 0x0817,
72 WMI_MARLON_R_READ_CMDID = 0x0818,
73 WMI_MARLON_R_WRITE_CMDID = 0x0819,
74 WMI_MARLON_R_TXRX_SEL_CMDID = 0x081a,
75 MAC_IO_STATIC_PARAMS_CMDID = 0x081b,
76 MAC_IO_DYNAMIC_PARAMS_CMDID = 0x081c,
77 WMI_SILENT_RSSI_CALIB_CMDID = 0x081d,
78 WMI_CFG_RX_CHAIN_CMDID = 0x0820,
79 WMI_VRING_CFG_CMDID = 0x0821,
80 WMI_RX_ON_CMDID = 0x0822,
81 WMI_VRING_BA_EN_CMDID = 0x0823,
82 WMI_VRING_BA_DIS_CMDID = 0x0824,
83 WMI_RCP_ADDBA_RESP_CMDID = 0x0825,
84 WMI_RCP_DELBA_CMDID = 0x0826,
85 WMI_SET_SSID_CMDID = 0x0827,
86 WMI_GET_SSID_CMDID = 0x0828,
87 WMI_SET_PCP_CHANNEL_CMDID = 0x0829,
88 WMI_GET_PCP_CHANNEL_CMDID = 0x082a,
89 WMI_SW_TX_REQ_CMDID = 0x082b,
90 WMI_RX_OFF_CMDID = 0x082c,
91 WMI_READ_MAC_RXQ_CMDID = 0x0830,
92 WMI_READ_MAC_TXQ_CMDID = 0x0831,
93 WMI_WRITE_MAC_RXQ_CMDID = 0x0832,
94 WMI_WRITE_MAC_TXQ_CMDID = 0x0833,
95 WMI_WRITE_MAC_XQ_FIELD_CMDID = 0x0834,
96 WMI_MLME_PUSH_CMDID = 0x0835,
97 WMI_BEAMFORMING_MGMT_CMDID = 0x0836,
98 WMI_BF_TXSS_MGMT_CMDID = 0x0837,
99 WMI_BF_SM_MGMT_CMDID = 0x0838,
100 WMI_BF_RXSS_MGMT_CMDID = 0x0839,
101 WMI_SET_SECTORS_CMDID = 0x0849,
102 WMI_MAINTAIN_PAUSE_CMDID = 0x0850,
103 WMI_MAINTAIN_RESUME_CMDID = 0x0851,
104 WMI_RS_MGMT_CMDID = 0x0852,
105 WMI_RF_MGMT_CMDID = 0x0853,
106 /* Performance monitoring commands */
107 WMI_BF_CTRL_CMDID = 0x0862,
108 WMI_NOTIFY_REQ_CMDID = 0x0863,
109 WMI_GET_STATUS_CMDID = 0x0864,
110 WMI_UNIT_TEST_CMDID = 0x0900,
111 WMI_HICCUP_CMDID = 0x0901,
112 WMI_FLASH_READ_CMDID = 0x0902,
113 WMI_FLASH_WRITE_CMDID = 0x0903,
114 WMI_SECURITY_UNIT_TEST_CMDID = 0x0904,
115
116 WMI_SET_MAC_ADDRESS_CMDID = 0xf003,
117 WMI_ABORT_SCAN_CMDID = 0xf007,
118 WMI_SET_PMK_CMDID = 0xf028,
119
120 WMI_SET_PROMISCUOUS_MODE_CMDID = 0xf041,
121 WMI_GET_PMK_CMDID = 0xf048,
122 WMI_SET_PASSPHRASE_CMDID = 0xf049,
123 WMI_SEND_ASSOC_RES_CMDID = 0xf04a,
124 WMI_SET_ASSOC_REQ_RELAY_CMDID = 0xf04b,
125 WMI_EAPOL_TX_CMDID = 0xf04c,
126 WMI_MAC_ADDR_REQ_CMDID = 0xf04d,
127 WMI_FW_VER_CMDID = 0xf04e,
128};
129
130/*
131 * Commands data structures
132 */
133
134/*
135 * Frame Types
136 */
137enum wmi_mgmt_frame_type {
138 WMI_FRAME_BEACON = 0,
139 WMI_FRAME_PROBE_REQ = 1,
140 WMI_FRAME_PROBE_RESP = 2,
141 WMI_FRAME_ASSOC_REQ = 3,
142 WMI_FRAME_ASSOC_RESP = 4,
143 WMI_NUM_MGMT_FRAME,
144};
145
146/*
147 * WMI_CONNECT_CMDID
148 */
149enum wmi_network_type {
150 WMI_NETTYPE_INFRA = 0x01,
151 WMI_NETTYPE_ADHOC = 0x02,
152 WMI_NETTYPE_ADHOC_CREATOR = 0x04,
153 WMI_NETTYPE_AP = 0x10,
154 WMI_NETTYPE_P2P = 0x20,
155 WMI_NETTYPE_WBE = 0x40, /* PCIE over 60g */
156};
157
158enum wmi_dot11_auth_mode {
159 WMI_AUTH11_OPEN = 0x01,
160 WMI_AUTH11_SHARED = 0x02,
161 WMI_AUTH11_LEAP = 0x04,
162 WMI_AUTH11_WSC = 0x08,
163};
164
165enum wmi_auth_mode {
166 WMI_AUTH_NONE = 0x01,
167 WMI_AUTH_WPA = 0x02,
168 WMI_AUTH_WPA2 = 0x04,
169 WMI_AUTH_WPA_PSK = 0x08,
170 WMI_AUTH_WPA2_PSK = 0x10,
171 WMI_AUTH_WPA_CCKM = 0x20,
172 WMI_AUTH_WPA2_CCKM = 0x40,
173};
174
175enum wmi_crypto_type {
176 WMI_CRYPT_NONE = 0x01,
177 WMI_CRYPT_WEP = 0x02,
178 WMI_CRYPT_TKIP = 0x04,
179 WMI_CRYPT_AES = 0x08,
180 WMI_CRYPT_AES_GCMP = 0x20,
181};
182
183
184enum wmi_connect_ctrl_flag_bits {
185 WMI_CONNECT_ASSOC_POLICY_USER = 0x0001,
186 WMI_CONNECT_SEND_REASSOC = 0x0002,
187 WMI_CONNECT_IGNORE_WPAx_GROUP_CIPHER = 0x0004,
188 WMI_CONNECT_PROFILE_MATCH_DONE = 0x0008,
189 WMI_CONNECT_IGNORE_AAC_BEACON = 0x0010,
190 WMI_CONNECT_CSA_FOLLOW_BSS = 0x0020,
191 WMI_CONNECT_DO_WPA_OFFLOAD = 0x0040,
192 WMI_CONNECT_DO_NOT_DEAUTH = 0x0080,
193};
194
195#define WMI_MAX_SSID_LEN (32)
196
197struct wmi_connect_cmd {
198 u8 network_type;
199 u8 dot11_auth_mode;
200 u8 auth_mode;
201 u8 pairwise_crypto_type;
202 u8 pairwise_crypto_len;
203 u8 group_crypto_type;
204 u8 group_crypto_len;
205 u8 ssid_len;
206 u8 ssid[WMI_MAX_SSID_LEN];
207 u8 channel;
208 u8 reserved0;
209 u8 bssid[WMI_MAC_LEN];
210 __le32 ctrl_flags;
211 u8 dst_mac[WMI_MAC_LEN];
212 u8 reserved1[2];
213} __packed;
214
215
216/*
217 * WMI_RECONNECT_CMDID
218 */
219struct wmi_reconnect_cmd {
220 u8 channel; /* hint */
221 u8 reserved;
222 u8 bssid[WMI_MAC_LEN]; /* mandatory if set */
223} __packed;
224
225
226/*
227 * WMI_SET_PMK_CMDID
228 */
229
230#define WMI_MIN_KEY_INDEX (0)
231#define WMI_MAX_KEY_INDEX (3)
232#define WMI_MAX_KEY_LEN (32)
233#define WMI_PASSPHRASE_LEN (64)
234#define WMI_PMK_LEN (32)
235
236struct wmi_set_pmk_cmd {
237 u8 pmk[WMI_PMK_LEN];
238} __packed;
239
240
241/*
242 * WMI_SET_PASSPHRASE_CMDID
243 */
244struct wmi_set_passphrase_cmd {
245 u8 ssid[WMI_MAX_SSID_LEN];
246 u8 passphrase[WMI_PASSPHRASE_LEN];
247 u8 ssid_len;
248 u8 passphrase_len;
249} __packed;
250
251/*
252 * WMI_ADD_CIPHER_KEY_CMDID
253 */
254enum wmi_key_usage {
255 WMI_KEY_USE_PAIRWISE = 0,
256 WMI_KEY_USE_GROUP = 1,
257 WMI_KEY_USE_TX = 2, /* default Tx Key - Static WEP only */
258};
259
260struct wmi_add_cipher_key_cmd {
261 u8 key_index;
262 u8 key_type;
263 u8 key_usage; /* enum wmi_key_usage */
264 u8 key_len;
265 u8 key_rsc[8]; /* key replay sequence counter */
266 u8 key[WMI_MAX_KEY_LEN];
267 u8 key_op_ctrl; /* Additional Key Control information */
268 u8 mac[WMI_MAC_LEN];
269} __packed;
270
271/*
272 * WMI_DELETE_CIPHER_KEY_CMDID
273 */
274struct wmi_delete_cipher_key_cmd {
275 u8 key_index;
276 u8 mac[WMI_MAC_LEN];
277} __packed;
278
279
280/*
281 * WMI_START_SCAN_CMDID
282 *
283 * Start L1 scan operation
284 *
285 * Returned events:
286 * - WMI_RX_MGMT_PACKET_EVENTID - for every probe resp.
287 * - WMI_SCAN_COMPLETE_EVENTID
288 */
289enum wmi_scan_type {
290 WMI_LONG_SCAN = 0,
291 WMI_SHORT_SCAN = 1,
292};
293
294struct wmi_start_scan_cmd {
295 u8 reserved[8];
296 __le32 home_dwell_time; /* Max duration in the home channel(ms) */
297 __le32 force_scan_interval; /* Time interval between scans (ms)*/
298 u8 scan_type; /* wmi_scan_type */
299 u8 num_channels; /* how many channels follow */
300 struct {
301 u8 channel;
302 u8 reserved;
303 } channel_list[0]; /* channels ID's */
304 /* 0 - 58320 MHz */
305 /* 1 - 60480 MHz */
306 /* 2 - 62640 MHz */
307} __packed;
308
309/*
310 * WMI_SET_PROBED_SSID_CMDID
311 */
312#define MAX_PROBED_SSID_INDEX (15)
313
314enum wmi_ssid_flag {
315 WMI_SSID_FLAG_DISABLE = 0, /* disables entry */
316 WMI_SSID_FLAG_SPECIFIC = 1, /* probes specified ssid */
317 WMI_SSID_FLAG_ANY = 2, /* probes for any ssid */
318};
319
320struct wmi_probed_ssid_cmd {
321 u8 entry_index; /* 0 to MAX_PROBED_SSID_INDEX */
322 u8 flag; /* enum wmi_ssid_flag */
323 u8 ssid_len;
324 u8 ssid[WMI_MAX_SSID_LEN];
325} __packed;
326
327/*
328 * WMI_SET_APPIE_CMDID
329 * Add Application specified IE to a management frame
330 */
331struct wmi_set_appie_cmd {
332 u8 mgmt_frm_type; /* enum wmi_mgmt_frame_type */
333 u8 reserved;
334 __le16 ie_len; /* Length of the IE to be added to MGMT frame */
335 u8 ie_info[0];
336} __packed;
337
338#define WMI_MAX_IE_LEN (1024)
339
340struct wmi_pxmt_range_cfg_cmd {
341 u8 dst_mac[WMI_MAC_LEN];
342 __le16 range;
343} __packed;
344
345struct wmi_pxmt_snr2_range_cfg_cmd {
346 s8 snr2range_arr[WMI_PROX_RANGE_NUM-1];
347} __packed;
348
349/*
350 * WMI_RF_MGMT_CMDID
351 */
352enum wmi_rf_mgmt_type {
353 WMI_RF_MGMT_W_DISABLE = 0,
354 WMI_RF_MGMT_W_ENABLE = 1,
355 WMI_RF_MGMT_GET_STATUS = 2,
356};
357
358struct wmi_rf_mgmt_cmd {
359 __le32 rf_mgmt_type;
360} __packed;
361
362/*
363 * WMI_SET_SSID_CMDID
364 */
365struct wmi_set_ssid_cmd {
366 __le32 ssid_len;
367 u8 ssid[WMI_MAX_SSID_LEN];
368} __packed;
369
370/*
371 * WMI_SET_PCP_CHANNEL_CMDID
372 */
373struct wmi_set_pcp_channel_cmd {
374 u8 channel;
375 u8 reserved[3];
376} __packed;
377
378/*
379 * WMI_BCON_CTRL_CMDID
380 */
381struct wmi_bcon_ctrl_cmd {
382 __le16 bcon_interval;
383 __le16 frag_num;
384 __le64 ss_mask;
385 u8 network_type;
386 u8 reserved;
387 u8 disable_sec_offload;
388 u8 disable_sec;
389} __packed;
390
391/*
392 * WMI_SW_TX_REQ_CMDID
393 */
394struct wmi_sw_tx_req_cmd {
395 u8 dst_mac[WMI_MAC_LEN];
396 __le16 len;
397 u8 payload[0];
398} __packed;
399
400/*
401 * WMI_VRING_CFG_CMDID
402 */
403
404struct wmi_sw_ring_cfg {
405 __le64 ring_mem_base;
406 __le16 ring_size;
407 __le16 max_mpdu_size;
408} __packed;
409
410struct wmi_vring_cfg_schd {
411 __le16 priority;
412 __le16 timeslot_us;
413} __packed;
414
415enum wmi_vring_cfg_encap_trans_type {
416 WMI_VRING_ENC_TYPE_802_3 = 0,
417 WMI_VRING_ENC_TYPE_NATIVE_WIFI = 1,
418};
419
420enum wmi_vring_cfg_ds_cfg {
421 WMI_VRING_DS_PBSS = 0,
422 WMI_VRING_DS_STATION = 1,
423 WMI_VRING_DS_AP = 2,
424 WMI_VRING_DS_ADDR4 = 3,
425};
426
427enum wmi_vring_cfg_nwifi_ds_trans_type {
428 WMI_NWIFI_TX_TRANS_MODE_NO = 0,
429 WMI_NWIFI_TX_TRANS_MODE_AP2PBSS = 1,
430 WMI_NWIFI_TX_TRANS_MODE_STA2PBSS = 2,
431};
432
433enum wmi_vring_cfg_schd_params_priority {
434 WMI_SCH_PRIO_REGULAR = 0,
435 WMI_SCH_PRIO_HIGH = 1,
436};
437
438struct wmi_vring_cfg {
439 struct wmi_sw_ring_cfg tx_sw_ring;
440 u8 ringid; /* 0-23 vrings */
441
442 #define CIDXTID_CID_POS (0)
443 #define CIDXTID_CID_LEN (4)
444 #define CIDXTID_CID_MSK (0xF)
445 #define CIDXTID_TID_POS (4)
446 #define CIDXTID_TID_LEN (4)
447 #define CIDXTID_TID_MSK (0xF0)
448 u8 cidxtid;
449
450 u8 encap_trans_type;
451 u8 ds_cfg; /* 802.3 DS cfg */
452 u8 nwifi_ds_trans_type;
453
454 #define VRING_CFG_MAC_CTRL_LIFETIME_EN_POS (0)
455 #define VRING_CFG_MAC_CTRL_LIFETIME_EN_LEN (1)
456 #define VRING_CFG_MAC_CTRL_LIFETIME_EN_MSK (0x1)
457 #define VRING_CFG_MAC_CTRL_AGGR_EN_POS (1)
458 #define VRING_CFG_MAC_CTRL_AGGR_EN_LEN (1)
459 #define VRING_CFG_MAC_CTRL_AGGR_EN_MSK (0x2)
460 u8 mac_ctrl;
461
462 #define VRING_CFG_TO_RESOLUTION_VALUE_POS (0)
463 #define VRING_CFG_TO_RESOLUTION_VALUE_LEN (6)
464 #define VRING_CFG_TO_RESOLUTION_VALUE_MSK (0x3F)
465 u8 to_resolution;
466 u8 agg_max_wsize;
467 struct wmi_vring_cfg_schd schd_params;
468} __packed;
469
470enum wmi_vring_cfg_cmd_action {
471 WMI_VRING_CMD_ADD = 0,
472 WMI_VRING_CMD_MODIFY = 1,
473 WMI_VRING_CMD_DELETE = 2,
474};
475
476struct wmi_vring_cfg_cmd {
477 __le32 action;
478 struct wmi_vring_cfg vring_cfg;
479} __packed;
480
481/*
482 * WMI_VRING_BA_EN_CMDID
483 */
484struct wmi_vring_ba_en_cmd {
485 u8 ringid;
486 u8 agg_max_wsize;
487 __le16 ba_timeout;
488} __packed;
489
490/*
491 * WMI_VRING_BA_DIS_CMDID
492 */
493struct wmi_vring_ba_dis_cmd {
494 u8 ringid;
495 u8 reserved;
496 __le16 reason;
497} __packed;
498
499/*
500 * WMI_NOTIFY_REQ_CMDID
501 */
502struct wmi_notify_req_cmd {
503 u8 cid;
504 u8 reserved[3];
505 __le32 interval_usec;
506} __packed;
507
508/*
509 * WMI_CFG_RX_CHAIN_CMDID
510 */
511enum wmi_sniffer_cfg_mode {
512 WMI_SNIFFER_OFF = 0,
513 WMI_SNIFFER_ON = 1,
514};
515
516enum wmi_sniffer_cfg_phy_info_mode {
517 WMI_SNIFFER_PHY_INFO_DISABLED = 0,
518 WMI_SNIFFER_PHY_INFO_ENABLED = 1,
519};
520
521enum wmi_sniffer_cfg_phy_support {
522 WMI_SNIFFER_CP = 0,
523 WMI_SNIFFER_DP = 1,
524 WMI_SNIFFER_BOTH_PHYS = 2,
525};
526
527struct wmi_sniffer_cfg {
528 __le32 mode; /* enum wmi_sniffer_cfg_mode */
529 __le32 phy_info_mode; /* enum wmi_sniffer_cfg_phy_info_mode */
530 __le32 phy_support; /* enum wmi_sniffer_cfg_phy_support */
531 u8 channel;
532 u8 reserved[3];
533} __packed;
534
535enum wmi_cfg_rx_chain_cmd_action {
536 WMI_RX_CHAIN_ADD = 0,
537 WMI_RX_CHAIN_DEL = 1,
538};
539
540enum wmi_cfg_rx_chain_cmd_decap_trans_type {
541 WMI_DECAP_TYPE_802_3 = 0,
542 WMI_DECAP_TYPE_NATIVE_WIFI = 1,
543};
544
545enum wmi_cfg_rx_chain_cmd_nwifi_ds_trans_type {
546 WMI_NWIFI_RX_TRANS_MODE_NO = 0,
547 WMI_NWIFI_RX_TRANS_MODE_PBSS2AP = 1,
548 WMI_NWIFI_RX_TRANS_MODE_PBSS2STA = 2,
549};
550
551struct wmi_cfg_rx_chain_cmd {
552 __le32 action;
553 struct wmi_sw_ring_cfg rx_sw_ring;
554 u8 mid;
555 u8 decap_trans_type;
556
557 #define L2_802_3_OFFLOAD_CTRL_VLAN_TAG_INSERTION_POS (0)
558 #define L2_802_3_OFFLOAD_CTRL_VLAN_TAG_INSERTION_LEN (1)
559 #define L2_802_3_OFFLOAD_CTRL_VLAN_TAG_INSERTION_MSK (0x1)
560 u8 l2_802_3_offload_ctrl;
561
562 #define L2_NWIFI_OFFLOAD_CTRL_REMOVE_QOS_POS (0)
563 #define L2_NWIFI_OFFLOAD_CTRL_REMOVE_QOS_LEN (1)
564 #define L2_NWIFI_OFFLOAD_CTRL_REMOVE_QOS_MSK (0x1)
565 #define L2_NWIFI_OFFLOAD_CTRL_REMOVE_PN_POS (1)
566 #define L2_NWIFI_OFFLOAD_CTRL_REMOVE_PN_LEN (1)
567 #define L2_NWIFI_OFFLOAD_CTRL_REMOVE_PN_MSK (0x2)
568 u8 l2_nwifi_offload_ctrl;
569
570 u8 vlan_id;
571 u8 nwifi_ds_trans_type;
572
573 #define L3_L4_CTRL_IPV4_CHECKSUM_EN_POS (0)
574 #define L3_L4_CTRL_IPV4_CHECKSUM_EN_LEN (1)
575 #define L3_L4_CTRL_IPV4_CHECKSUM_EN_MSK (0x1)
576 #define L3_L4_CTRL_TCPIP_CHECKSUM_EN_POS (1)
577 #define L3_L4_CTRL_TCPIP_CHECKSUM_EN_LEN (1)
578 #define L3_L4_CTRL_TCPIP_CHECKSUM_EN_MSK (0x2)
579 u8 l3_l4_ctrl;
580
581 #define RING_CTRL_OVERRIDE_PREFETCH_THRSH_POS (0)
582 #define RING_CTRL_OVERRIDE_PREFETCH_THRSH_LEN (1)
583 #define RING_CTRL_OVERRIDE_PREFETCH_THRSH_MSK (0x1)
584 #define RING_CTRL_OVERRIDE_WB_THRSH_POS (1)
585 #define RING_CTRL_OVERRIDE_WB_THRSH_LEN (1)
586 #define RING_CTRL_OVERRIDE_WB_THRSH_MSK (0x2)
587 #define RING_CTRL_OVERRIDE_ITR_THRSH_POS (2)
588 #define RING_CTRL_OVERRIDE_ITR_THRSH_LEN (1)
589 #define RING_CTRL_OVERRIDE_ITR_THRSH_MSK (0x4)
590 #define RING_CTRL_OVERRIDE_HOST_THRSH_POS (3)
591 #define RING_CTRL_OVERRIDE_HOST_THRSH_LEN (1)
592 #define RING_CTRL_OVERRIDE_HOST_THRSH_MSK (0x8)
593 u8 ring_ctrl;
594
595 __le16 prefetch_thrsh;
596 __le16 wb_thrsh;
597 __le32 itr_value;
598 __le16 host_thrsh;
599 u8 reserved[2];
600 struct wmi_sniffer_cfg sniffer_cfg;
601} __packed;
602
603/*
604 * WMI_RCP_ADDBA_RESP_CMDID
605 */
606struct wmi_rcp_addba_resp_cmd {
607
608 #define CIDXTID_CID_POS (0)
609 #define CIDXTID_CID_LEN (4)
610 #define CIDXTID_CID_MSK (0xF)
611 #define CIDXTID_TID_POS (4)
612 #define CIDXTID_TID_LEN (4)
613 #define CIDXTID_TID_MSK (0xF0)
614 u8 cidxtid;
615
616 u8 dialog_token;
617 __le16 status_code;
618 __le16 ba_param_set; /* ieee80211_ba_parameterset field to send */
619 __le16 ba_timeout;
620} __packed;
621
622/*
623 * WMI_RCP_DELBA_CMDID
624 */
625struct wmi_rcp_delba_cmd {
626
627 #define CIDXTID_CID_POS (0)
628 #define CIDXTID_CID_LEN (4)
629 #define CIDXTID_CID_MSK (0xF)
630 #define CIDXTID_TID_POS (4)
631 #define CIDXTID_TID_LEN (4)
632 #define CIDXTID_TID_MSK (0xF0)
633 u8 cidxtid;
634
635 u8 reserved;
636 __le16 reason;
637} __packed;
638
639/*
640 * WMI_RCP_ADDBA_REQ_CMDID
641 */
642struct wmi_rcp_addba_req_cmd {
643
644 #define CIDXTID_CID_POS (0)
645 #define CIDXTID_CID_LEN (4)
646 #define CIDXTID_CID_MSK (0xF)
647 #define CIDXTID_TID_POS (4)
648 #define CIDXTID_TID_LEN (4)
649 #define CIDXTID_TID_MSK (0xF0)
650 u8 cidxtid;
651
652 u8 dialog_token;
653 /* ieee80211_ba_parameterset field as it received */
654 __le16 ba_param_set;
655 __le16 ba_timeout;
656 /* ieee80211_ba_seqstrl field as it received */
657 __le16 ba_seq_ctrl;
658} __packed;
659
660/*
661 * WMI_SET_MAC_ADDRESS_CMDID
662 */
663struct wmi_set_mac_address_cmd {
664 u8 mac[WMI_MAC_LEN];
665 u8 reserved[2];
666} __packed;
667
668
669/*
670* WMI_EAPOL_TX_CMDID
671*/
672struct wmi_eapol_tx_cmd {
673 u8 dst_mac[WMI_MAC_LEN];
674 __le16 eapol_len;
675 u8 eapol[0];
676} __packed;
677
678/*
679 * WMI_ECHO_CMDID
680 *
681 * Check FW is alive
682 *
683 * WMI_DEEP_ECHO_CMDID
684 *
685 * Check FW and ucode are alive
686 *
687 * Returned event: WMI_ECHO_RSP_EVENTID
688 * same event for both commands
689 */
690struct wmi_echo_cmd {
691 __le32 value;
692} __packed;
693
694/*
695 * WMI Events
696 */
697
698/*
699 * List of Events (target to host)
700 */
701enum wmi_event_id {
702 WMI_IMM_RSP_EVENTID = 0x0000,
703 WMI_READY_EVENTID = 0x1001,
704 WMI_CONNECT_EVENTID = 0x1002,
705 WMI_DISCONNECT_EVENTID = 0x1003,
706 WMI_SCAN_COMPLETE_EVENTID = 0x100a,
707 WMI_REPORT_STATISTICS_EVENTID = 0x100b,
708 WMI_RD_MEM_RSP_EVENTID = 0x1800,
709 WMI_FW_READY_EVENTID = 0x1801,
710 WMI_EXIT_FAST_MEM_ACC_MODE_EVENTID = 0x0200,
711 WMI_ECHO_RSP_EVENTID = 0x1803,
712 WMI_CONFIG_MAC_DONE_EVENTID = 0x1805,
713 WMI_CONFIG_PHY_DEBUG_DONE_EVENTID = 0x1806,
714 WMI_ADD_STATION_DONE_EVENTID = 0x1807,
715 WMI_ADD_DEBUG_TX_PCKT_DONE_EVENTID = 0x1808,
716 WMI_PHY_GET_STATISTICS_EVENTID = 0x1809,
717 WMI_FS_TUNE_DONE_EVENTID = 0x180a,
718 WMI_CORR_MEASURE_DONE_EVENTID = 0x180b,
719 WMI_TEMP_SENSE_DONE_EVENTID = 0x180e,
720 WMI_DC_CALIB_DONE_EVENTID = 0x180f,
721 WMI_IQ_TX_CALIB_DONE_EVENTID = 0x1811,
722 WMI_IQ_RX_CALIB_DONE_EVENTID = 0x1812,
723 WMI_SET_WORK_MODE_DONE_EVENTID = 0x1815,
724 WMI_LO_LEAKAGE_CALIB_DONE_EVENTID = 0x1816,
725 WMI_MARLON_R_ACTIVATE_DONE_EVENTID = 0x1817,
726 WMI_MARLON_R_READ_DONE_EVENTID = 0x1818,
727 WMI_MARLON_R_WRITE_DONE_EVENTID = 0x1819,
728 WMI_MARLON_R_TXRX_SEL_DONE_EVENTID = 0x181a,
729 WMI_SILENT_RSSI_CALIB_DONE_EVENTID = 0x181d,
730
731 WMI_CFG_RX_CHAIN_DONE_EVENTID = 0x1820,
732 WMI_VRING_CFG_DONE_EVENTID = 0x1821,
733 WMI_RX_ON_DONE_EVENTID = 0x1822,
734 WMI_BA_STATUS_EVENTID = 0x1823,
735 WMI_RCP_ADDBA_REQ_EVENTID = 0x1824,
736 WMI_ADDBA_RESP_SENT_EVENTID = 0x1825,
737 WMI_DELBA_EVENTID = 0x1826,
738 WMI_GET_SSID_EVENTID = 0x1828,
739 WMI_GET_PCP_CHANNEL_EVENTID = 0x182a,
740 WMI_SW_TX_COMPLETE_EVENTID = 0x182b,
741 WMI_RX_OFF_DONE_EVENTID = 0x182c,
742
743 WMI_READ_MAC_RXQ_EVENTID = 0x1830,
744 WMI_READ_MAC_TXQ_EVENTID = 0x1831,
745 WMI_WRITE_MAC_RXQ_EVENTID = 0x1832,
746 WMI_WRITE_MAC_TXQ_EVENTID = 0x1833,
747 WMI_WRITE_MAC_XQ_FIELD_EVENTID = 0x1834,
748
749 WMI_BEAFORMING_MGMT_DONE_EVENTID = 0x1836,
750 WMI_BF_TXSS_MGMT_DONE_EVENTID = 0x1837,
751 WMI_BF_RXSS_MGMT_DONE_EVENTID = 0x1839,
752 WMI_RS_MGMT_DONE_EVENTID = 0x1852,
753 WMI_RF_MGMT_STATUS_EVENTID = 0x1853,
754 WMI_BF_SM_MGMT_DONE_EVENTID = 0x1838,
755 WMI_RX_MGMT_PACKET_EVENTID = 0x1840,
756
757 /* Performance monitoring events */
758 WMI_DATA_PORT_OPEN_EVENTID = 0x1860,
759 WMI_WBE_LINKDOWN_EVENTID = 0x1861,
760
761 WMI_BF_CTRL_DONE_EVENTID = 0x1862,
762 WMI_NOTIFY_REQ_DONE_EVENTID = 0x1863,
763 WMI_GET_STATUS_DONE_EVENTID = 0x1864,
764
765 WMI_UNIT_TEST_EVENTID = 0x1900,
766 WMI_FLASH_READ_DONE_EVENTID = 0x1902,
767 WMI_FLASH_WRITE_DONE_EVENTID = 0x1903,
768
769 WMI_SET_CHANNEL_EVENTID = 0x9000,
770 WMI_ASSOC_REQ_EVENTID = 0x9001,
771 WMI_EAPOL_RX_EVENTID = 0x9002,
772 WMI_MAC_ADDR_RESP_EVENTID = 0x9003,
773 WMI_FW_VER_EVENTID = 0x9004,
774};
775
776/*
777 * Events data structures
778 */
779
780/*
781 * WMI_RF_MGMT_STATUS_EVENTID
782 */
783enum wmi_rf_status {
784 WMI_RF_ENABLED = 0,
785 WMI_RF_DISABLED_HW = 1,
786 WMI_RF_DISABLED_SW = 2,
787 WMI_RF_DISABLED_HW_SW = 3,
788};
789
790struct wmi_rf_mgmt_status_event {
791 __le32 rf_status;
792} __packed;
793
794/*
795 * WMI_GET_STATUS_DONE_EVENTID
796 */
797struct wmi_get_status_done_event {
798 __le32 is_associated;
799 u8 cid;
800 u8 reserved0[3];
801 u8 bssid[WMI_MAC_LEN];
802 u8 channel;
803 u8 reserved1;
804 u8 network_type;
805 u8 reserved2[3];
806 __le32 ssid_len;
807 u8 ssid[WMI_MAX_SSID_LEN];
808 __le32 rf_status;
809 __le32 is_secured;
810} __packed;
811
812/*
813 * WMI_FW_VER_EVENTID
814 */
815struct wmi_fw_ver_event {
816 u8 major;
817 u8 minor;
818 __le16 subminor;
819 __le16 build;
820} __packed;
821
822/*
823* WMI_MAC_ADDR_RESP_EVENTID
824*/
825struct wmi_mac_addr_resp_event {
826 u8 mac[WMI_MAC_LEN];
827 u8 auth_mode;
828 u8 crypt_mode;
829 __le32 offload_mode;
830} __packed;
831
832/*
833* WMI_EAPOL_RX_EVENTID
834*/
835struct wmi_eapol_rx_event {
836 u8 src_mac[WMI_MAC_LEN];
837 __le16 eapol_len;
838 u8 eapol[0];
839} __packed;
840
841/*
842* WMI_READY_EVENTID
843*/
844enum wmi_phy_capability {
845 WMI_11A_CAPABILITY = 1,
846 WMI_11G_CAPABILITY = 2,
847 WMI_11AG_CAPABILITY = 3,
848 WMI_11NA_CAPABILITY = 4,
849 WMI_11NG_CAPABILITY = 5,
850 WMI_11NAG_CAPABILITY = 6,
851 WMI_11AD_CAPABILITY = 7,
852 WMI_11N_CAPABILITY_OFFSET = WMI_11NA_CAPABILITY - WMI_11A_CAPABILITY,
853};
854
855struct wmi_ready_event {
856 __le32 sw_version;
857 __le32 abi_version;
858 u8 mac[WMI_MAC_LEN];
859 u8 phy_capability; /* enum wmi_phy_capability */
860 u8 reserved;
861} __packed;
862
863/*
864 * WMI_NOTIFY_REQ_DONE_EVENTID
865 */
866struct wmi_notify_req_done_event {
867 __le32 status;
868 __le64 tsf;
869 __le32 snr_val;
870 __le32 tx_tpt;
871 __le32 tx_goodput;
872 __le32 rx_goodput;
873 __le16 bf_mcs;
874 __le16 my_rx_sector;
875 __le16 my_tx_sector;
876 __le16 other_rx_sector;
877 __le16 other_tx_sector;
878 __le16 range;
879} __packed;
880
881/*
882 * WMI_CONNECT_EVENTID
883 */
884struct wmi_connect_event {
885 u8 channel;
886 u8 reserved0;
887 u8 bssid[WMI_MAC_LEN];
888 __le16 listen_interval;
889 __le16 beacon_interval;
890 u8 network_type;
891 u8 reserved1[3];
892 u8 beacon_ie_len;
893 u8 assoc_req_len;
894 u8 assoc_resp_len;
895 u8 cid;
896 u8 reserved2[3];
897 u8 assoc_info[0];
898} __packed;
899
900/*
901 * WMI_DISCONNECT_EVENTID
902 */
903enum wmi_disconnect_reason {
904 WMI_DIS_REASON_NO_NETWORK_AVAIL = 1,
905 WMI_DIS_REASON_LOST_LINK = 2, /* bmiss */
906 WMI_DIS_REASON_DISCONNECT_CMD = 3,
907 WMI_DIS_REASON_BSS_DISCONNECTED = 4,
908 WMI_DIS_REASON_AUTH_FAILED = 5,
909 WMI_DIS_REASON_ASSOC_FAILED = 6,
910 WMI_DIS_REASON_NO_RESOURCES_AVAIL = 7,
911 WMI_DIS_REASON_CSERV_DISCONNECT = 8,
912 WMI_DIS_REASON_INVALID_PROFILE = 10,
913 WMI_DIS_REASON_DOT11H_CHANNEL_SWITCH = 11,
914 WMI_DIS_REASON_PROFILE_MISMATCH = 12,
915 WMI_DIS_REASON_CONNECTION_EVICTED = 13,
916 WMI_DIS_REASON_IBSS_MERGE = 14,
917};
918
919struct wmi_disconnect_event {
920 __le16 protocol_reason_status; /* reason code, see 802.11 spec. */
921 u8 bssid[WMI_MAC_LEN]; /* set if known */
922 u8 disconnect_reason; /* see wmi_disconnect_reason_e */
923 u8 assoc_resp_len;
924 u8 assoc_info[0];
925} __packed;
926
927/*
928 * WMI_SCAN_COMPLETE_EVENTID
929 */
930struct wmi_scan_complete_event {
931 __le32 status;
932} __packed;
933
934/*
935 * WMI_BA_STATUS_EVENTID
936 */
937enum wmi_vring_ba_status {
938 WMI_BA_AGREED = 0,
939 WMI_BA_NON_AGREED = 1,
940};
941
942struct wmi_vring_ba_status_event {
943 __le16 status;
944 u8 reserved[2];
945 u8 ringid;
946 u8 agg_wsize;
947 __le16 ba_timeout;
948} __packed;
949
950/*
951 * WMI_DELBA_EVENTID
952 */
953struct wmi_delba_event {
954
955 #define CIDXTID_CID_POS (0)
956 #define CIDXTID_CID_LEN (4)
957 #define CIDXTID_CID_MSK (0xF)
958 #define CIDXTID_TID_POS (4)
959 #define CIDXTID_TID_LEN (4)
960 #define CIDXTID_TID_MSK (0xF0)
961 u8 cidxtid;
962
963 u8 from_initiator;
964 __le16 reason;
965} __packed;
966
967/*
968 * WMI_VRING_CFG_DONE_EVENTID
969 */
970enum wmi_vring_cfg_done_event_status {
971 WMI_VRING_CFG_SUCCESS = 0,
972 WMI_VRING_CFG_FAILURE = 1,
973};
974
975struct wmi_vring_cfg_done_event {
976 u8 ringid;
977 u8 status;
978 u8 reserved[2];
979 __le32 tx_vring_tail_ptr;
980} __packed;
981
982/*
983 * WMI_ADDBA_RESP_SENT_EVENTID
984 */
985enum wmi_rcp_addba_resp_sent_event_status {
986 WMI_ADDBA_SUCCESS = 0,
987 WMI_ADDBA_FAIL = 1,
988};
989
990struct wmi_rcp_addba_resp_sent_event {
991
992 #define CIDXTID_CID_POS (0)
993 #define CIDXTID_CID_LEN (4)
994 #define CIDXTID_CID_MSK (0xF)
995 #define CIDXTID_TID_POS (4)
996 #define CIDXTID_TID_LEN (4)
997 #define CIDXTID_TID_MSK (0xF0)
998 u8 cidxtid;
999
1000 u8 reserved;
1001 __le16 status;
1002} __packed;
1003
1004/*
1005 * WMI_RCP_ADDBA_REQ_EVENTID
1006 */
1007struct wmi_rcp_addba_req_event {
1008
1009 #define CIDXTID_CID_POS (0)
1010 #define CIDXTID_CID_LEN (4)
1011 #define CIDXTID_CID_MSK (0xF)
1012 #define CIDXTID_TID_POS (4)
1013 #define CIDXTID_TID_LEN (4)
1014 #define CIDXTID_TID_MSK (0xF0)
1015 u8 cidxtid;
1016
1017 u8 dialog_token;
1018 __le16 ba_param_set; /* ieee80211_ba_parameterset as it received */
1019 __le16 ba_timeout;
1020 __le16 ba_seq_ctrl; /* ieee80211_ba_seqstrl field as it received */
1021} __packed;
1022
1023/*
1024 * WMI_CFG_RX_CHAIN_DONE_EVENTID
1025 */
1026enum wmi_cfg_rx_chain_done_event_status {
1027 WMI_CFG_RX_CHAIN_SUCCESS = 1,
1028};
1029
1030struct wmi_cfg_rx_chain_done_event {
1031 __le32 rx_ring_tail_ptr; /* Rx V-Ring Tail pointer */
1032 __le32 status;
1033} __packed;
1034
1035/*
1036 * WMI_WBE_LINKDOWN_EVENTID
1037 */
1038enum wmi_wbe_link_down_event_reason {
1039 WMI_WBE_REASON_USER_REQUEST = 0,
1040 WMI_WBE_REASON_RX_DISASSOC = 1,
1041 WMI_WBE_REASON_BAD_PHY_LINK = 2,
1042};
1043
1044struct wmi_wbe_link_down_event {
1045 u8 cid;
1046 u8 reserved[3];
1047 __le32 reason;
1048} __packed;
1049
1050/*
1051 * WMI_DATA_PORT_OPEN_EVENTID
1052 */
1053struct wmi_data_port_open_event {
1054 u8 cid;
1055 u8 reserved[3];
1056} __packed;
1057
1058/*
1059 * WMI_GET_PCP_CHANNEL_EVENTID
1060 */
1061struct wmi_get_pcp_channel_event {
1062 u8 channel;
1063 u8 reserved[3];
1064} __packed;
1065
1066/*
1067 * WMI_SW_TX_COMPLETE_EVENTID
1068 */
1069enum wmi_sw_tx_status {
1070 WMI_TX_SW_STATUS_SUCCESS = 0,
1071 WMI_TX_SW_STATUS_FAILED_NO_RESOURCES = 1,
1072 WMI_TX_SW_STATUS_FAILED_TX = 2,
1073};
1074
1075struct wmi_sw_tx_complete_event {
1076 u8 status; /* enum wmi_sw_tx_status */
1077 u8 reserved[3];
1078} __packed;
1079
1080/*
1081 * WMI_GET_SSID_EVENTID
1082 */
1083struct wmi_get_ssid_event {
1084 __le32 ssid_len;
1085 u8 ssid[WMI_MAX_SSID_LEN];
1086} __packed;
1087
1088/*
1089 * WMI_RX_MGMT_PACKET_EVENTID
1090 */
1091struct wmi_rx_mgmt_info {
1092 u8 mcs;
1093 s8 snr;
1094 __le16 range;
1095 __le16 stype;
1096 __le16 status;
1097 __le32 len;
1098 u8 qid;
1099 u8 mid;
1100 u8 cid;
1101 u8 channel; /* From Radio MNGR */
1102} __packed;
1103
1104struct wmi_rx_mgmt_packet_event {
1105 struct wmi_rx_mgmt_info info;
1106 u8 payload[0];
1107} __packed;
1108
1109/*
1110 * WMI_ECHO_RSP_EVENTID
1111 */
1112struct wmi_echo_event {
1113 __le32 echoed_value;
1114} __packed;
1115
1116#endif /* __WILOCITY_WMI_H__ */
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index b298e5d68be2..10e288d470e7 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -7,6 +7,7 @@
7#include <linux/hw_random.h> 7#include <linux/hw_random.h>
8#include <linux/bcma/bcma.h> 8#include <linux/bcma/bcma.h>
9#include <linux/ssb/ssb.h> 9#include <linux/ssb/ssb.h>
10#include <linux/completion.h>
10#include <net/mac80211.h> 11#include <net/mac80211.h>
11 12
12#include "debugfs.h" 13#include "debugfs.h"
@@ -722,6 +723,10 @@ enum b43_firmware_file_type {
722struct b43_request_fw_context { 723struct b43_request_fw_context {
723 /* The device we are requesting the fw for. */ 724 /* The device we are requesting the fw for. */
724 struct b43_wldev *dev; 725 struct b43_wldev *dev;
726 /* a completion event structure needed if this call is asynchronous */
727 struct completion fw_load_complete;
728 /* a pointer to the firmware object */
729 const struct firmware *blob;
725 /* The type of firmware to request. */ 730 /* The type of firmware to request. */
726 enum b43_firmware_file_type req_type; 731 enum b43_firmware_file_type req_type;
727 /* Error messages for each firmware type. */ 732 /* Error messages for each firmware type. */
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 16ab280359bd..806e34c19281 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -2088,11 +2088,18 @@ static void b43_print_fw_helptext(struct b43_wl *wl, bool error)
2088 b43warn(wl, text); 2088 b43warn(wl, text);
2089} 2089}
2090 2090
2091static void b43_fw_cb(const struct firmware *firmware, void *context)
2092{
2093 struct b43_request_fw_context *ctx = context;
2094
2095 ctx->blob = firmware;
2096 complete(&ctx->fw_load_complete);
2097}
2098
2091int b43_do_request_fw(struct b43_request_fw_context *ctx, 2099int b43_do_request_fw(struct b43_request_fw_context *ctx,
2092 const char *name, 2100 const char *name,
2093 struct b43_firmware_file *fw) 2101 struct b43_firmware_file *fw, bool async)
2094{ 2102{
2095 const struct firmware *blob;
2096 struct b43_fw_header *hdr; 2103 struct b43_fw_header *hdr;
2097 u32 size; 2104 u32 size;
2098 int err; 2105 int err;
@@ -2131,11 +2138,31 @@ int b43_do_request_fw(struct b43_request_fw_context *ctx,
2131 B43_WARN_ON(1); 2138 B43_WARN_ON(1);
2132 return -ENOSYS; 2139 return -ENOSYS;
2133 } 2140 }
2134 err = request_firmware(&blob, ctx->fwname, ctx->dev->dev->dev); 2141 if (async) {
2142 /* do this part asynchronously */
2143 init_completion(&ctx->fw_load_complete);
2144 err = request_firmware_nowait(THIS_MODULE, 1, ctx->fwname,
2145 ctx->dev->dev->dev, GFP_KERNEL,
2146 ctx, b43_fw_cb);
2147 if (err < 0) {
2148 pr_err("Unable to load firmware\n");
2149 return err;
2150 }
2151 /* stall here until fw ready */
2152 wait_for_completion(&ctx->fw_load_complete);
2153 if (ctx->blob)
2154 goto fw_ready;
2155 /* On some ARM systems, the async request will fail, but the next sync
2156 * request works. For this reason, we dall through here
2157 */
2158 }
2159 err = request_firmware(&ctx->blob, ctx->fwname,
2160 ctx->dev->dev->dev);
2135 if (err == -ENOENT) { 2161 if (err == -ENOENT) {
2136 snprintf(ctx->errors[ctx->req_type], 2162 snprintf(ctx->errors[ctx->req_type],
2137 sizeof(ctx->errors[ctx->req_type]), 2163 sizeof(ctx->errors[ctx->req_type]),
2138 "Firmware file \"%s\" not found\n", ctx->fwname); 2164 "Firmware file \"%s\" not found\n",
2165 ctx->fwname);
2139 return err; 2166 return err;
2140 } else if (err) { 2167 } else if (err) {
2141 snprintf(ctx->errors[ctx->req_type], 2168 snprintf(ctx->errors[ctx->req_type],
@@ -2144,14 +2171,15 @@ int b43_do_request_fw(struct b43_request_fw_context *ctx,
2144 ctx->fwname, err); 2171 ctx->fwname, err);
2145 return err; 2172 return err;
2146 } 2173 }
2147 if (blob->size < sizeof(struct b43_fw_header)) 2174fw_ready:
2175 if (ctx->blob->size < sizeof(struct b43_fw_header))
2148 goto err_format; 2176 goto err_format;
2149 hdr = (struct b43_fw_header *)(blob->data); 2177 hdr = (struct b43_fw_header *)(ctx->blob->data);
2150 switch (hdr->type) { 2178 switch (hdr->type) {
2151 case B43_FW_TYPE_UCODE: 2179 case B43_FW_TYPE_UCODE:
2152 case B43_FW_TYPE_PCM: 2180 case B43_FW_TYPE_PCM:
2153 size = be32_to_cpu(hdr->size); 2181 size = be32_to_cpu(hdr->size);
2154 if (size != blob->size - sizeof(struct b43_fw_header)) 2182 if (size != ctx->blob->size - sizeof(struct b43_fw_header))
2155 goto err_format; 2183 goto err_format;
2156 /* fallthrough */ 2184 /* fallthrough */
2157 case B43_FW_TYPE_IV: 2185 case B43_FW_TYPE_IV:
@@ -2162,7 +2190,7 @@ int b43_do_request_fw(struct b43_request_fw_context *ctx,
2162 goto err_format; 2190 goto err_format;
2163 } 2191 }
2164 2192
2165 fw->data = blob; 2193 fw->data = ctx->blob;
2166 fw->filename = name; 2194 fw->filename = name;
2167 fw->type = ctx->req_type; 2195 fw->type = ctx->req_type;
2168 2196
@@ -2172,7 +2200,7 @@ err_format:
2172 snprintf(ctx->errors[ctx->req_type], 2200 snprintf(ctx->errors[ctx->req_type],
2173 sizeof(ctx->errors[ctx->req_type]), 2201 sizeof(ctx->errors[ctx->req_type]),
2174 "Firmware file \"%s\" format error.\n", ctx->fwname); 2202 "Firmware file \"%s\" format error.\n", ctx->fwname);
2175 release_firmware(blob); 2203 release_firmware(ctx->blob);
2176 2204
2177 return -EPROTO; 2205 return -EPROTO;
2178} 2206}
@@ -2223,7 +2251,7 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx)
2223 goto err_no_ucode; 2251 goto err_no_ucode;
2224 } 2252 }
2225 } 2253 }
2226 err = b43_do_request_fw(ctx, filename, &fw->ucode); 2254 err = b43_do_request_fw(ctx, filename, &fw->ucode, true);
2227 if (err) 2255 if (err)
2228 goto err_load; 2256 goto err_load;
2229 2257
@@ -2235,7 +2263,7 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx)
2235 else 2263 else
2236 goto err_no_pcm; 2264 goto err_no_pcm;
2237 fw->pcm_request_failed = false; 2265 fw->pcm_request_failed = false;
2238 err = b43_do_request_fw(ctx, filename, &fw->pcm); 2266 err = b43_do_request_fw(ctx, filename, &fw->pcm, false);
2239 if (err == -ENOENT) { 2267 if (err == -ENOENT) {
2240 /* We did not find a PCM file? Not fatal, but 2268 /* We did not find a PCM file? Not fatal, but
2241 * core rev <= 10 must do without hwcrypto then. */ 2269 * core rev <= 10 must do without hwcrypto then. */
@@ -2296,7 +2324,7 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx)
2296 default: 2324 default:
2297 goto err_no_initvals; 2325 goto err_no_initvals;
2298 } 2326 }
2299 err = b43_do_request_fw(ctx, filename, &fw->initvals); 2327 err = b43_do_request_fw(ctx, filename, &fw->initvals, false);
2300 if (err) 2328 if (err)
2301 goto err_load; 2329 goto err_load;
2302 2330
@@ -2355,7 +2383,7 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx)
2355 default: 2383 default:
2356 goto err_no_initvals; 2384 goto err_no_initvals;
2357 } 2385 }
2358 err = b43_do_request_fw(ctx, filename, &fw->initvals_band); 2386 err = b43_do_request_fw(ctx, filename, &fw->initvals_band, false);
2359 if (err) 2387 if (err)
2360 goto err_load; 2388 goto err_load;
2361 2389
diff --git a/drivers/net/wireless/b43/main.h b/drivers/net/wireless/b43/main.h
index 8c684cd33529..abac25ee958d 100644
--- a/drivers/net/wireless/b43/main.h
+++ b/drivers/net/wireless/b43/main.h
@@ -137,9 +137,8 @@ void b43_mac_phy_clock_set(struct b43_wldev *dev, bool on);
137 137
138 138
139struct b43_request_fw_context; 139struct b43_request_fw_context;
140int b43_do_request_fw(struct b43_request_fw_context *ctx, 140int b43_do_request_fw(struct b43_request_fw_context *ctx, const char *name,
141 const char *name, 141 struct b43_firmware_file *fw, bool async);
142 struct b43_firmware_file *fw);
143void b43_do_release_fw(struct b43_firmware_file *fw); 142void b43_do_release_fw(struct b43_firmware_file *fw);
144 143
145#endif /* B43_MAIN_H_ */ 144#endif /* B43_MAIN_H_ */
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
index 1261a9b84e04..75464ad4fbd1 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
@@ -3091,10 +3091,11 @@ brcmf_configure_wpaie(struct net_device *ndev, struct brcmf_vs_tlv *wpa_ie,
3091 3091
3092 len = wpa_ie->len + TLV_HDR_LEN; 3092 len = wpa_ie->len + TLV_HDR_LEN;
3093 data = (u8 *)wpa_ie; 3093 data = (u8 *)wpa_ie;
3094 offset = 0; 3094 offset = TLV_HDR_LEN;
3095 if (!is_rsn_ie) 3095 if (!is_rsn_ie)
3096 offset += VS_IE_FIXED_HDR_LEN; 3096 offset += VS_IE_FIXED_HDR_LEN;
3097 offset += WPA_IE_VERSION_LEN; 3097 else
3098 offset += WPA_IE_VERSION_LEN;
3098 3099
3099 /* check for multicast cipher suite */ 3100 /* check for multicast cipher suite */
3100 if (offset + WPA_IE_MIN_OUI_LEN > len) { 3101 if (offset + WPA_IE_MIN_OUI_LEN > len) {
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/debug.h b/drivers/net/wireless/brcm80211/brcmsmac/debug.h
index 796836b0f469..822781cf15d4 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/debug.h
+++ b/drivers/net/wireless/brcm80211/brcmsmac/debug.h
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright (c) 2012 Broadcom Corporation 2 * Copyright (c) 2012 Broadcom Corporation
3 * Copyright (c) 2012 Canonical Ltd.
3 * 4 *
4 * Permission to use, copy, modify, and/or distribute this software for any 5 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above 6 * purpose with or without fee is hereby granted, provided that the above
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
index 1fbd8ecbe2ea..0f71d1d4339d 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
@@ -1407,9 +1407,10 @@ void brcms_add_timer(struct brcms_timer *t, uint ms, int periodic)
1407#endif 1407#endif
1408 t->ms = ms; 1408 t->ms = ms;
1409 t->periodic = (bool) periodic; 1409 t->periodic = (bool) periodic;
1410 t->set = true; 1410 if (!t->set) {
1411 1411 t->set = true;
1412 atomic_inc(&t->wl->callbacks); 1412 atomic_inc(&t->wl->callbacks);
1413 }
1413 1414
1414 ieee80211_queue_delayed_work(hw, &t->dly_wrk, msecs_to_jiffies(ms)); 1415 ieee80211_queue_delayed_work(hw, &t->dly_wrk, msecs_to_jiffies(ms));
1415} 1416}
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
index 606b534347bc..21a824232478 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
@@ -1343,13 +1343,13 @@ static bool wlc_lcnphy_rx_iq_cal_gain(struct brcms_phy *pi, u16 biq1_gain,
1343 1343
1344 wlc_lcnphy_rx_gain_override_enable(pi, true); 1344 wlc_lcnphy_rx_gain_override_enable(pi, true);
1345 wlc_lcnphy_start_tx_tone(pi, 2000, (40 >> 1), 0); 1345 wlc_lcnphy_start_tx_tone(pi, 2000, (40 >> 1), 0);
1346 usleep_range(500, 500); 1346 udelay(500);
1347 write_radio_reg(pi, RADIO_2064_REG112, 0); 1347 write_radio_reg(pi, RADIO_2064_REG112, 0);
1348 if (!wlc_lcnphy_rx_iq_est(pi, 1024, 32, &iq_est_l)) 1348 if (!wlc_lcnphy_rx_iq_est(pi, 1024, 32, &iq_est_l))
1349 return false; 1349 return false;
1350 1350
1351 wlc_lcnphy_start_tx_tone(pi, 2000, 40, 0); 1351 wlc_lcnphy_start_tx_tone(pi, 2000, 40, 0);
1352 usleep_range(500, 500); 1352 udelay(500);
1353 write_radio_reg(pi, RADIO_2064_REG112, 0); 1353 write_radio_reg(pi, RADIO_2064_REG112, 0);
1354 if (!wlc_lcnphy_rx_iq_est(pi, 1024, 32, &iq_est_h)) 1354 if (!wlc_lcnphy_rx_iq_est(pi, 1024, 32, &iq_est_h))
1355 return false; 1355 return false;
diff --git a/drivers/net/wireless/iwlegacy/3945-mac.c b/drivers/net/wireless/iwlegacy/3945-mac.c
index d604b4036a76..3726cd6fcd75 100644
--- a/drivers/net/wireless/iwlegacy/3945-mac.c
+++ b/drivers/net/wireless/iwlegacy/3945-mac.c
@@ -3273,7 +3273,7 @@ il3945_store_measurement(struct device *d, struct device_attribute *attr,
3273 3273
3274 if (count) { 3274 if (count) {
3275 char *p = buffer; 3275 char *p = buffer;
3276 strncpy(buffer, buf, min(sizeof(buffer), count)); 3276 strlcpy(buffer, buf, sizeof(buffer));
3277 channel = simple_strtoul(p, NULL, 0); 3277 channel = simple_strtoul(p, NULL, 0);
3278 if (channel) 3278 if (channel)
3279 params.channel = channel; 3279 params.channel = channel;
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c
index 7e16d10a7f14..90b8970eadf0 100644
--- a/drivers/net/wireless/iwlegacy/common.c
+++ b/drivers/net/wireless/iwlegacy/common.c
@@ -3958,17 +3958,21 @@ il_connection_init_rx_config(struct il_priv *il)
3958 3958
3959 memset(&il->staging, 0, sizeof(il->staging)); 3959 memset(&il->staging, 0, sizeof(il->staging));
3960 3960
3961 if (!il->vif) { 3961 switch (il->iw_mode) {
3962 case NL80211_IFTYPE_UNSPECIFIED:
3962 il->staging.dev_type = RXON_DEV_TYPE_ESS; 3963 il->staging.dev_type = RXON_DEV_TYPE_ESS;
3963 } else if (il->vif->type == NL80211_IFTYPE_STATION) { 3964 break;
3965 case NL80211_IFTYPE_STATION:
3964 il->staging.dev_type = RXON_DEV_TYPE_ESS; 3966 il->staging.dev_type = RXON_DEV_TYPE_ESS;
3965 il->staging.filter_flags = RXON_FILTER_ACCEPT_GRP_MSK; 3967 il->staging.filter_flags = RXON_FILTER_ACCEPT_GRP_MSK;
3966 } else if (il->vif->type == NL80211_IFTYPE_ADHOC) { 3968 break;
3969 case NL80211_IFTYPE_ADHOC:
3967 il->staging.dev_type = RXON_DEV_TYPE_IBSS; 3970 il->staging.dev_type = RXON_DEV_TYPE_IBSS;
3968 il->staging.flags = RXON_FLG_SHORT_PREAMBLE_MSK; 3971 il->staging.flags = RXON_FLG_SHORT_PREAMBLE_MSK;
3969 il->staging.filter_flags = 3972 il->staging.filter_flags =
3970 RXON_FILTER_BCON_AWARE_MSK | RXON_FILTER_ACCEPT_GRP_MSK; 3973 RXON_FILTER_BCON_AWARE_MSK | RXON_FILTER_ACCEPT_GRP_MSK;
3971 } else { 3974 break;
3975 default:
3972 IL_ERR("Unsupported interface type %d\n", il->vif->type); 3976 IL_ERR("Unsupported interface type %d\n", il->vif->type);
3973 return; 3977 return;
3974 } 3978 }
@@ -4550,8 +4554,7 @@ out:
4550EXPORT_SYMBOL(il_mac_add_interface); 4554EXPORT_SYMBOL(il_mac_add_interface);
4551 4555
4552static void 4556static void
4553il_teardown_interface(struct il_priv *il, struct ieee80211_vif *vif, 4557il_teardown_interface(struct il_priv *il, struct ieee80211_vif *vif)
4554 bool mode_change)
4555{ 4558{
4556 lockdep_assert_held(&il->mutex); 4559 lockdep_assert_held(&il->mutex);
4557 4560
@@ -4560,9 +4563,7 @@ il_teardown_interface(struct il_priv *il, struct ieee80211_vif *vif,
4560 il_force_scan_end(il); 4563 il_force_scan_end(il);
4561 } 4564 }
4562 4565
4563 if (!mode_change) 4566 il_set_mode(il);
4564 il_set_mode(il);
4565
4566} 4567}
4567 4568
4568void 4569void
@@ -4575,8 +4576,8 @@ il_mac_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
4575 4576
4576 WARN_ON(il->vif != vif); 4577 WARN_ON(il->vif != vif);
4577 il->vif = NULL; 4578 il->vif = NULL;
4578 4579 il->iw_mode = NL80211_IFTYPE_UNSPECIFIED;
4579 il_teardown_interface(il, vif, false); 4580 il_teardown_interface(il, vif);
4580 memset(il->bssid, 0, ETH_ALEN); 4581 memset(il->bssid, 0, ETH_ALEN);
4581 4582
4582 D_MAC80211("leave\n"); 4583 D_MAC80211("leave\n");
@@ -4685,18 +4686,10 @@ il_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
4685 } 4686 }
4686 4687
4687 /* success */ 4688 /* success */
4688 il_teardown_interface(il, vif, true);
4689 vif->type = newtype; 4689 vif->type = newtype;
4690 vif->p2p = false; 4690 vif->p2p = false;
4691 err = il_set_mode(il); 4691 il->iw_mode = newtype;
4692 WARN_ON(err); 4692 il_teardown_interface(il, vif);
4693 /*
4694 * We've switched internally, but submitting to the
4695 * device may have failed for some reason. Mask this
4696 * error, because otherwise mac80211 will not switch
4697 * (and set the interface type back) and we'll be
4698 * out of sync with it.
4699 */
4700 err = 0; 4693 err = 0;
4701 4694
4702out: 4695out:
diff --git a/drivers/net/wireless/iwlwifi/dvm/tx.c b/drivers/net/wireless/iwlwifi/dvm/tx.c
index da21328ca8ed..31534f7c0548 100644
--- a/drivers/net/wireless/iwlwifi/dvm/tx.c
+++ b/drivers/net/wireless/iwlwifi/dvm/tx.c
@@ -1079,6 +1079,8 @@ static void iwlagn_set_tx_status(struct iwl_priv *priv,
1079{ 1079{
1080 u16 status = le16_to_cpu(tx_resp->status.status); 1080 u16 status = le16_to_cpu(tx_resp->status.status);
1081 1081
1082 info->flags &= ~IEEE80211_TX_CTL_AMPDU;
1083
1082 info->status.rates[0].count = tx_resp->failure_frame + 1; 1084 info->status.rates[0].count = tx_resp->failure_frame + 1;
1083 info->flags |= iwl_tx_status_to_mac80211(status); 1085 info->flags |= iwl_tx_status_to_mac80211(status);
1084 iwlagn_hwrate_to_tx_control(priv, le32_to_cpu(tx_resp->rate_n_flags), 1086 iwlagn_hwrate_to_tx_control(priv, le32_to_cpu(tx_resp->rate_n_flags),
@@ -1151,13 +1153,6 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb,
1151 next_reclaimed = ssn; 1153 next_reclaimed = ssn;
1152 } 1154 }
1153 1155
1154 if (tid != IWL_TID_NON_QOS) {
1155 priv->tid_data[sta_id][tid].next_reclaimed =
1156 next_reclaimed;
1157 IWL_DEBUG_TX_REPLY(priv, "Next reclaimed packet:%d\n",
1158 next_reclaimed);
1159 }
1160
1161 iwl_trans_reclaim(priv->trans, txq_id, ssn, &skbs); 1156 iwl_trans_reclaim(priv->trans, txq_id, ssn, &skbs);
1162 1157
1163 iwlagn_check_ratid_empty(priv, sta_id, tid); 1158 iwlagn_check_ratid_empty(priv, sta_id, tid);
@@ -1208,11 +1203,28 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb,
1208 if (!is_agg) 1203 if (!is_agg)
1209 iwlagn_non_agg_tx_status(priv, ctx, hdr->addr1); 1204 iwlagn_non_agg_tx_status(priv, ctx, hdr->addr1);
1210 1205
1206 /*
1207 * W/A for FW bug - the seq_ctl isn't updated when the
1208 * queues are flushed. Fetch it from the packet itself
1209 */
1210 if (!is_agg && status == TX_STATUS_FAIL_FIFO_FLUSHED) {
1211 next_reclaimed = le16_to_cpu(hdr->seq_ctrl);
1212 next_reclaimed =
1213 SEQ_TO_SN(next_reclaimed + 0x10);
1214 }
1215
1211 is_offchannel_skb = 1216 is_offchannel_skb =
1212 (info->flags & IEEE80211_TX_CTL_TX_OFFCHAN); 1217 (info->flags & IEEE80211_TX_CTL_TX_OFFCHAN);
1213 freed++; 1218 freed++;
1214 } 1219 }
1215 1220
1221 if (tid != IWL_TID_NON_QOS) {
1222 priv->tid_data[sta_id][tid].next_reclaimed =
1223 next_reclaimed;
1224 IWL_DEBUG_TX_REPLY(priv, "Next reclaimed packet:%d\n",
1225 next_reclaimed);
1226 }
1227
1216 WARN_ON(!is_agg && freed != 1); 1228 WARN_ON(!is_agg && freed != 1);
1217 1229
1218 /* 1230 /*
diff --git a/drivers/net/wireless/iwlwifi/pcie/rx.c b/drivers/net/wireless/iwlwifi/pcie/rx.c
index dad4c4aad91f..8389cd38338b 100644
--- a/drivers/net/wireless/iwlwifi/pcie/rx.c
+++ b/drivers/net/wireless/iwlwifi/pcie/rx.c
@@ -1166,6 +1166,7 @@ static irqreturn_t iwl_pcie_isr(int irq, void *data)
1166 else if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) && 1166 else if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) &&
1167 !trans_pcie->inta) 1167 !trans_pcie->inta)
1168 iwl_enable_interrupts(trans); 1168 iwl_enable_interrupts(trans);
1169 return IRQ_HANDLED;
1169 1170
1170none: 1171none:
1171 /* re-enable interrupts here since we don't have anything to service. */ 1172 /* re-enable interrupts here since we don't have anything to service. */
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index a875499f8945..cdb11b3964e2 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -1459,7 +1459,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid,
1459 struct cfg80211_ssid req_ssid; 1459 struct cfg80211_ssid req_ssid;
1460 int ret, auth_type = 0; 1460 int ret, auth_type = 0;
1461 struct cfg80211_bss *bss = NULL; 1461 struct cfg80211_bss *bss = NULL;
1462 u8 is_scanning_required = 0, config_bands = 0; 1462 u8 is_scanning_required = 0;
1463 1463
1464 memset(&req_ssid, 0, sizeof(struct cfg80211_ssid)); 1464 memset(&req_ssid, 0, sizeof(struct cfg80211_ssid));
1465 1465
@@ -1478,19 +1478,6 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid,
1478 /* disconnect before try to associate */ 1478 /* disconnect before try to associate */
1479 mwifiex_deauthenticate(priv, NULL); 1479 mwifiex_deauthenticate(priv, NULL);
1480 1480
1481 if (channel) {
1482 if (mode == NL80211_IFTYPE_STATION) {
1483 if (channel->band == IEEE80211_BAND_2GHZ)
1484 config_bands = BAND_B | BAND_G | BAND_GN;
1485 else
1486 config_bands = BAND_A | BAND_AN;
1487
1488 if (!((config_bands | priv->adapter->fw_bands) &
1489 ~priv->adapter->fw_bands))
1490 priv->adapter->config_bands = config_bands;
1491 }
1492 }
1493
1494 /* As this is new association, clear locally stored 1481 /* As this is new association, clear locally stored
1495 * keys and security related flags */ 1482 * keys and security related flags */
1496 priv->sec_info.wpa_enabled = false; 1483 priv->sec_info.wpa_enabled = false;
@@ -1707,9 +1694,9 @@ static int mwifiex_set_ibss_params(struct mwifiex_private *priv,
1707 1694
1708 if (cfg80211_get_chandef_type(&params->chandef) != 1695 if (cfg80211_get_chandef_type(&params->chandef) !=
1709 NL80211_CHAN_NO_HT) 1696 NL80211_CHAN_NO_HT)
1710 config_bands |= BAND_GN; 1697 config_bands |= BAND_G | BAND_GN;
1711 } else { 1698 } else {
1712 if (cfg80211_get_chandef_type(&params->chandef) != 1699 if (cfg80211_get_chandef_type(&params->chandef) ==
1713 NL80211_CHAN_NO_HT) 1700 NL80211_CHAN_NO_HT)
1714 config_bands = BAND_A; 1701 config_bands = BAND_A;
1715 else 1702 else
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c
index 13fbc4eb1595..b879e1338a54 100644
--- a/drivers/net/wireless/mwifiex/pcie.c
+++ b/drivers/net/wireless/mwifiex/pcie.c
@@ -161,7 +161,7 @@ static int mwifiex_pcie_suspend(struct pci_dev *pdev, pm_message_t state)
161 161
162 if (pdev) { 162 if (pdev) {
163 card = (struct pcie_service_card *) pci_get_drvdata(pdev); 163 card = (struct pcie_service_card *) pci_get_drvdata(pdev);
164 if (!card || card->adapter) { 164 if (!card || !card->adapter) {
165 pr_err("Card or adapter structure is not valid\n"); 165 pr_err("Card or adapter structure is not valid\n");
166 return 0; 166 return 0;
167 } 167 }
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c
index cb682561c438..f542bb8ccbc8 100644
--- a/drivers/net/wireless/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/mwifiex/sta_ioctl.c
@@ -56,7 +56,6 @@ int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list *mlist,
56 */ 56 */
57int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter) 57int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter)
58{ 58{
59 bool cancel_flag = false;
60 int status; 59 int status;
61 struct cmd_ctrl_node *cmd_queued; 60 struct cmd_ctrl_node *cmd_queued;
62 61
@@ -70,14 +69,11 @@ int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter)
70 atomic_inc(&adapter->cmd_pending); 69 atomic_inc(&adapter->cmd_pending);
71 70
72 /* Wait for completion */ 71 /* Wait for completion */
73 wait_event_interruptible(adapter->cmd_wait_q.wait, 72 status = wait_event_interruptible(adapter->cmd_wait_q.wait,
74 *(cmd_queued->condition)); 73 *(cmd_queued->condition));
75 if (!*(cmd_queued->condition)) 74 if (status) {
76 cancel_flag = true; 75 dev_err(adapter->dev, "cmd_wait_q terminated: %d\n", status);
77 76 return status;
78 if (cancel_flag) {
79 mwifiex_cancel_pending_ioctl(adapter);
80 dev_dbg(adapter->dev, "cmd cancel\n");
81 } 77 }
82 78
83 status = adapter->cmd_wait_q.status; 79 status = adapter->cmd_wait_q.status;
@@ -287,6 +283,20 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss,
287 if (ret) 283 if (ret)
288 goto done; 284 goto done;
289 285
286 if (bss_desc) {
287 u8 config_bands = 0;
288
289 if (mwifiex_band_to_radio_type((u8) bss_desc->bss_band)
290 == HostCmd_SCAN_RADIO_TYPE_BG)
291 config_bands = BAND_B | BAND_G | BAND_GN;
292 else
293 config_bands = BAND_A | BAND_AN;
294
295 if (!((config_bands | adapter->fw_bands) &
296 ~adapter->fw_bands))
297 adapter->config_bands = config_bands;
298 }
299
290 ret = mwifiex_check_network_compatibility(priv, bss_desc); 300 ret = mwifiex_check_network_compatibility(priv, bss_desc);
291 if (ret) 301 if (ret)
292 goto done; 302 goto done;
@@ -496,8 +506,11 @@ int mwifiex_enable_hs(struct mwifiex_adapter *adapter)
496 return false; 506 return false;
497 } 507 }
498 508
499 wait_event_interruptible(adapter->hs_activate_wait_q, 509 if (wait_event_interruptible(adapter->hs_activate_wait_q,
500 adapter->hs_activate_wait_q_woken); 510 adapter->hs_activate_wait_q_woken)) {
511 dev_err(adapter->dev, "hs_activate_wait_q terminated\n");
512 return false;
513 }
501 514
502 return true; 515 return true;
503} 516}
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c
index f221b95b90b3..83564d36e801 100644
--- a/drivers/net/wireless/mwl8k.c
+++ b/drivers/net/wireless/mwl8k.c
@@ -4250,9 +4250,11 @@ static int mwl8k_cmd_update_stadb_add(struct ieee80211_hw *hw,
4250 p->amsdu_enabled = 0; 4250 p->amsdu_enabled = 0;
4251 4251
4252 rc = mwl8k_post_cmd(hw, &cmd->header); 4252 rc = mwl8k_post_cmd(hw, &cmd->header);
4253 if (!rc)
4254 rc = p->station_id;
4253 kfree(cmd); 4255 kfree(cmd);
4254 4256
4255 return rc ? rc : p->station_id; 4257 return rc;
4256} 4258}
4257 4259
4258static int mwl8k_cmd_update_stadb_del(struct ieee80211_hw *hw, 4260static int mwl8k_cmd_update_stadb_del(struct ieee80211_hw *hw,
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
index e71c702e2eb1..800a16526c8e 100644
--- a/drivers/net/wireless/p54/p54usb.c
+++ b/drivers/net/wireless/p54/p54usb.c
@@ -47,6 +47,7 @@ static struct usb_device_id p54u_table[] = {
47 {USB_DEVICE(0x0411, 0x0050)}, /* Buffalo WLI2-USB2-G54 */ 47 {USB_DEVICE(0x0411, 0x0050)}, /* Buffalo WLI2-USB2-G54 */
48 {USB_DEVICE(0x045e, 0x00c2)}, /* Microsoft MN-710 */ 48 {USB_DEVICE(0x045e, 0x00c2)}, /* Microsoft MN-710 */
49 {USB_DEVICE(0x0506, 0x0a11)}, /* 3COM 3CRWE254G72 */ 49 {USB_DEVICE(0x0506, 0x0a11)}, /* 3COM 3CRWE254G72 */
50 {USB_DEVICE(0x0675, 0x0530)}, /* DrayTek Vigor 530 */
50 {USB_DEVICE(0x06b9, 0x0120)}, /* Thomson SpeedTouch 120g */ 51 {USB_DEVICE(0x06b9, 0x0120)}, /* Thomson SpeedTouch 120g */
51 {USB_DEVICE(0x0707, 0xee06)}, /* SMC 2862W-G */ 52 {USB_DEVICE(0x0707, 0xee06)}, /* SMC 2862W-G */
52 {USB_DEVICE(0x07aa, 0x001c)}, /* Corega CG-WLUSB2GT */ 53 {USB_DEVICE(0x07aa, 0x001c)}, /* Corega CG-WLUSB2GT */
@@ -82,6 +83,8 @@ static struct usb_device_id p54u_table[] = {
82 {USB_DEVICE(0x06a9, 0x000e)}, /* Westell 802.11g USB (A90-211WG-01) */ 83 {USB_DEVICE(0x06a9, 0x000e)}, /* Westell 802.11g USB (A90-211WG-01) */
83 {USB_DEVICE(0x06b9, 0x0121)}, /* Thomson SpeedTouch 121g */ 84 {USB_DEVICE(0x06b9, 0x0121)}, /* Thomson SpeedTouch 121g */
84 {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */ 85 {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */
86 {USB_DEVICE(0x0803, 0x4310)}, /* Zoom 4410a */
87 {USB_DEVICE(0x083a, 0x4503)}, /* T-Com Sinus 154 data II */
85 {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */ 88 {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */
86 {USB_DEVICE(0x083a, 0xc501)}, /* Zoom Wireless-G 4410 */ 89 {USB_DEVICE(0x083a, 0xc501)}, /* Zoom Wireless-G 4410 */
87 {USB_DEVICE(0x083a, 0xf503)}, /* Accton FD7050E ver 1010ec */ 90 {USB_DEVICE(0x083a, 0xf503)}, /* Accton FD7050E ver 1010ec */
@@ -101,6 +104,7 @@ static struct usb_device_id p54u_table[] = {
101 {USB_DEVICE(0x13B1, 0x000C)}, /* Linksys WUSB54AG */ 104 {USB_DEVICE(0x13B1, 0x000C)}, /* Linksys WUSB54AG */
102 {USB_DEVICE(0x1413, 0x5400)}, /* Telsey 802.11g USB2.0 Adapter */ 105 {USB_DEVICE(0x1413, 0x5400)}, /* Telsey 802.11g USB2.0 Adapter */
103 {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */ 106 {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */
107 /* {USB_DEVICE(0x15a9, 0x0002)}, * Also SparkLAN WL-682 with 3887 */
104 {USB_DEVICE(0x1668, 0x1050)}, /* Actiontec 802UIG-1 */ 108 {USB_DEVICE(0x1668, 0x1050)}, /* Actiontec 802UIG-1 */
105 {USB_DEVICE(0x1740, 0x1000)}, /* Senao NUB-350 */ 109 {USB_DEVICE(0x1740, 0x1000)}, /* Senao NUB-350 */
106 {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */ 110 {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */
diff --git a/drivers/net/wireless/rtlwifi/Kconfig b/drivers/net/wireless/rtlwifi/Kconfig
index 21b1bbb93a7e..b80bc4612581 100644
--- a/drivers/net/wireless/rtlwifi/Kconfig
+++ b/drivers/net/wireless/rtlwifi/Kconfig
@@ -57,12 +57,12 @@ config RTL8192CU
57 57
58config RTLWIFI 58config RTLWIFI
59 tristate 59 tristate
60 depends on RTL8192CE || RTL8192CU || RTL8192SE || RTL8192DE 60 depends on RTL8192CE || RTL8192CU || RTL8192SE || RTL8192DE || RTL8723AE
61 default m 61 default m
62 62
63config RTLWIFI_DEBUG 63config RTLWIFI_DEBUG
64 bool "Additional debugging output" 64 bool "Additional debugging output"
65 depends on RTL8192CE || RTL8192CU || RTL8192SE || RTL8192DE 65 depends on RTL8192CE || RTL8192CU || RTL8192SE || RTL8192DE || RTL8723AE
66 default y 66 default y
67 67
68config RTL8192C_COMMON 68config RTL8192C_COMMON
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
index 3deacafdcd5e..4261e8ecc4c3 100644
--- a/drivers/net/wireless/rtlwifi/pci.c
+++ b/drivers/net/wireless/rtlwifi/pci.c
@@ -743,6 +743,8 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
743 743
744done: 744done:
745 bufferaddress = (*((dma_addr_t *)skb->cb)); 745 bufferaddress = (*((dma_addr_t *)skb->cb));
746 if (pci_dma_mapping_error(rtlpci->pdev, bufferaddress))
747 return;
746 tmp_one = 1; 748 tmp_one = 1;
747 rtlpriv->cfg->ops->set_desc((u8 *) pdesc, false, 749 rtlpriv->cfg->ops->set_desc((u8 *) pdesc, false,
748 HW_DESC_RXBUFF_ADDR, 750 HW_DESC_RXBUFF_ADDR,
@@ -1115,6 +1117,10 @@ static int _rtl_pci_init_rx_ring(struct ieee80211_hw *hw)
1115 PCI_DMA_FROMDEVICE); 1117 PCI_DMA_FROMDEVICE);
1116 1118
1117 bufferaddress = (*((dma_addr_t *)skb->cb)); 1119 bufferaddress = (*((dma_addr_t *)skb->cb));
1120 if (pci_dma_mapping_error(rtlpci->pdev, bufferaddress)) {
1121 dev_kfree_skb_any(skb);
1122 return 1;
1123 }
1118 rtlpriv->cfg->ops->set_desc((u8 *)entry, false, 1124 rtlpriv->cfg->ops->set_desc((u8 *)entry, false,
1119 HW_DESC_RXBUFF_ADDR, 1125 HW_DESC_RXBUFF_ADDR,
1120 (u8 *)&bufferaddress); 1126 (u8 *)&bufferaddress);
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c
index 1d5d3604e3e0..246e5352f2e1 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c
@@ -692,7 +692,7 @@ u8 rtl92c_phy_sw_chnl(struct ieee80211_hw *hw)
692 if (!(is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) { 692 if (!(is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) {
693 rtl92c_phy_sw_chnl_callback(hw); 693 rtl92c_phy_sw_chnl_callback(hw);
694 RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, 694 RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD,
695 "sw_chnl_inprogress false schdule workitem\n"); 695 "sw_chnl_inprogress false schedule workitem\n");
696 rtlphy->sw_chnl_inprogress = false; 696 rtlphy->sw_chnl_inprogress = false;
697 } else { 697 } else {
698 RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, 698 RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD,
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c
index 173424756149..c31795e379f7 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c
@@ -611,8 +611,14 @@ void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw,
611 dma_addr_t mapping = pci_map_single(rtlpci->pdev, 611 dma_addr_t mapping = pci_map_single(rtlpci->pdev,
612 skb->data, skb->len, 612 skb->data, skb->len,
613 PCI_DMA_TODEVICE); 613 PCI_DMA_TODEVICE);
614
614 u8 bw_40 = 0; 615 u8 bw_40 = 0;
615 616
617 if (pci_dma_mapping_error(rtlpci->pdev, mapping)) {
618 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE,
619 "DMA mapping error");
620 return;
621 }
616 rcu_read_lock(); 622 rcu_read_lock();
617 sta = get_sta(hw, mac->vif, mac->bssid); 623 sta = get_sta(hw, mac->vif, mac->bssid);
618 if (mac->opmode == NL80211_IFTYPE_STATION) { 624 if (mac->opmode == NL80211_IFTYPE_STATION) {
@@ -774,6 +780,11 @@ void rtl92ce_tx_fill_cmddesc(struct ieee80211_hw *hw,
774 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data); 780 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data);
775 __le16 fc = hdr->frame_control; 781 __le16 fc = hdr->frame_control;
776 782
783 if (pci_dma_mapping_error(rtlpci->pdev, mapping)) {
784 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE,
785 "DMA mapping error");
786 return;
787 }
777 CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); 788 CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE);
778 789
779 if (firstseg) 790 if (firstseg)
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/trx.c b/drivers/net/wireless/rtlwifi/rtl8192de/trx.c
index f9f3861046c1..a0fbf284420e 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/trx.c
@@ -587,6 +587,11 @@ void rtl92de_tx_fill_desc(struct ieee80211_hw *hw,
587 buf_len = skb->len; 587 buf_len = skb->len;
588 mapping = pci_map_single(rtlpci->pdev, skb->data, skb->len, 588 mapping = pci_map_single(rtlpci->pdev, skb->data, skb->len,
589 PCI_DMA_TODEVICE); 589 PCI_DMA_TODEVICE);
590 if (pci_dma_mapping_error(rtlpci->pdev, mapping)) {
591 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE,
592 "DMA mapping error");
593 return;
594 }
590 CLEAR_PCI_TX_DESC_CONTENT(pdesc, sizeof(struct tx_desc_92d)); 595 CLEAR_PCI_TX_DESC_CONTENT(pdesc, sizeof(struct tx_desc_92d));
591 if (ieee80211_is_nullfunc(fc) || ieee80211_is_ctl(fc)) { 596 if (ieee80211_is_nullfunc(fc) || ieee80211_is_ctl(fc)) {
592 firstseg = true; 597 firstseg = true;
@@ -740,6 +745,11 @@ void rtl92de_tx_fill_cmddesc(struct ieee80211_hw *hw,
740 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data); 745 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data);
741 __le16 fc = hdr->frame_control; 746 __le16 fc = hdr->frame_control;
742 747
748 if (pci_dma_mapping_error(rtlpci->pdev, mapping)) {
749 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE,
750 "DMA mapping error");
751 return;
752 }
743 CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); 753 CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE);
744 if (firstseg) 754 if (firstseg)
745 SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN); 755 SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN);
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c
index 0e9f6ebf078a..206561d7282f 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c
@@ -611,6 +611,11 @@ void rtl92se_tx_fill_desc(struct ieee80211_hw *hw,
611 PCI_DMA_TODEVICE); 611 PCI_DMA_TODEVICE);
612 u8 bw_40 = 0; 612 u8 bw_40 = 0;
613 613
614 if (pci_dma_mapping_error(rtlpci->pdev, mapping)) {
615 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE,
616 "DMA mapping error");
617 return;
618 }
614 if (mac->opmode == NL80211_IFTYPE_STATION) { 619 if (mac->opmode == NL80211_IFTYPE_STATION) {
615 bw_40 = mac->bw_40; 620 bw_40 = mac->bw_40;
616 } else if (mac->opmode == NL80211_IFTYPE_AP || 621 } else if (mac->opmode == NL80211_IFTYPE_AP ||
@@ -763,6 +768,7 @@ void rtl92se_tx_fill_desc(struct ieee80211_hw *hw,
763void rtl92se_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc, 768void rtl92se_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc,
764 bool firstseg, bool lastseg, struct sk_buff *skb) 769 bool firstseg, bool lastseg, struct sk_buff *skb)
765{ 770{
771 struct rtl_priv *rtlpriv = rtl_priv(hw);
766 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 772 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
767 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 773 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
768 struct rtl_tcb_desc *tcb_desc = (struct rtl_tcb_desc *)(skb->cb); 774 struct rtl_tcb_desc *tcb_desc = (struct rtl_tcb_desc *)(skb->cb);
@@ -770,7 +776,12 @@ void rtl92se_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc,
770 dma_addr_t mapping = pci_map_single(rtlpci->pdev, skb->data, skb->len, 776 dma_addr_t mapping = pci_map_single(rtlpci->pdev, skb->data, skb->len,
771 PCI_DMA_TODEVICE); 777 PCI_DMA_TODEVICE);
772 778
773 /* Clear all status */ 779 if (pci_dma_mapping_error(rtlpci->pdev, mapping)) {
780 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE,
781 "DMA mapping error");
782 return;
783 }
784 /* Clear all status */
774 CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_CMDDESC_SIZE_RTL8192S); 785 CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_CMDDESC_SIZE_RTL8192S);
775 786
776 /* This bit indicate this packet is used for FW download. */ 787 /* This bit indicate this packet is used for FW download. */
diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/phy.c b/drivers/net/wireless/rtlwifi/rtl8723ae/phy.c
index 39cc7938eedf..3d8536bb0d2b 100644
--- a/drivers/net/wireless/rtlwifi/rtl8723ae/phy.c
+++ b/drivers/net/wireless/rtlwifi/rtl8723ae/phy.c
@@ -1106,7 +1106,7 @@ u8 rtl8723ae_phy_sw_chnl(struct ieee80211_hw *hw)
1106 if (!(is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) { 1106 if (!(is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) {
1107 rtl8723ae_phy_sw_chnl_callback(hw); 1107 rtl8723ae_phy_sw_chnl_callback(hw);
1108 RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, 1108 RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD,
1109 "sw_chnl_inprogress false schdule workitem\n"); 1109 "sw_chnl_inprogress false schedule workitem\n");
1110 rtlphy->sw_chnl_inprogress = false; 1110 rtlphy->sw_chnl_inprogress = false;
1111 } else { 1111 } else {
1112 RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, 1112 RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD,
diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c b/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
index 18b0bc51766b..bb7cc90bafb2 100644
--- a/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
@@ -341,7 +341,7 @@ static struct rtl_hal_cfg rtl8723ae_hal_cfg = {
341 .maps[RTL_RC_HT_RATEMCS15] = DESC92_RATEMCS15, 341 .maps[RTL_RC_HT_RATEMCS15] = DESC92_RATEMCS15,
342}; 342};
343 343
344static struct pci_device_id rtl8723ae_pci_ids[] __devinitdata = { 344static struct pci_device_id rtl8723ae_pci_ids[] = {
345 {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8723, rtl8723ae_hal_cfg)}, 345 {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8723, rtl8723ae_hal_cfg)},
346 {}, 346 {},
347}; 347};
diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c b/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c
index 87331d826d73..a313be8c21d2 100644
--- a/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c
@@ -387,6 +387,11 @@ void rtl8723ae_tx_fill_desc(struct ieee80211_hw *hw,
387 PCI_DMA_TODEVICE); 387 PCI_DMA_TODEVICE);
388 u8 bw_40 = 0; 388 u8 bw_40 = 0;
389 389
390 if (pci_dma_mapping_error(rtlpci->pdev, mapping)) {
391 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE,
392 "DMA mapping error");
393 return;
394 }
390 if (mac->opmode == NL80211_IFTYPE_STATION) { 395 if (mac->opmode == NL80211_IFTYPE_STATION) {
391 bw_40 = mac->bw_40; 396 bw_40 = mac->bw_40;
392 } else if (mac->opmode == NL80211_IFTYPE_AP || 397 } else if (mac->opmode == NL80211_IFTYPE_AP ||
@@ -542,6 +547,11 @@ void rtl8723ae_tx_fill_cmddesc(struct ieee80211_hw *hw,
542 PCI_DMA_TODEVICE); 547 PCI_DMA_TODEVICE);
543 __le16 fc = hdr->frame_control; 548 __le16 fc = hdr->frame_control;
544 549
550 if (pci_dma_mapping_error(rtlpci->pdev, mapping)) {
551 RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE,
552 "DMA mapping error");
553 return;
554 }
545 CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); 555 CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE);
546 556
547 if (firstseg) 557 if (firstseg)
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c
index 29f0969e4ba0..f2ecdeb3a90d 100644
--- a/drivers/net/wireless/rtlwifi/usb.c
+++ b/drivers/net/wireless/rtlwifi/usb.c
@@ -210,17 +210,16 @@ static void _usb_writeN_sync(struct rtl_priv *rtlpriv, u32 addr, void *data,
210 u16 index = REALTEK_USB_VENQT_CMD_IDX; 210 u16 index = REALTEK_USB_VENQT_CMD_IDX;
211 int pipe = usb_sndctrlpipe(udev, 0); /* write_out */ 211 int pipe = usb_sndctrlpipe(udev, 0); /* write_out */
212 u8 *buffer; 212 u8 *buffer;
213 dma_addr_t dma_addr;
214 213
215 wvalue = (u16)(addr&0x0000ffff); 214 wvalue = (u16)(addr & 0x0000ffff);
216 buffer = usb_alloc_coherent(udev, (size_t)len, GFP_ATOMIC, &dma_addr); 215 buffer = kmalloc(len, GFP_ATOMIC);
217 if (!buffer) 216 if (!buffer)
218 return; 217 return;
219 memcpy(buffer, data, len); 218 memcpy(buffer, data, len);
220 usb_control_msg(udev, pipe, request, reqtype, wvalue, 219 usb_control_msg(udev, pipe, request, reqtype, wvalue,
221 index, buffer, len, 50); 220 index, buffer, len, 50);
222 221
223 usb_free_coherent(udev, (size_t)len, buffer, dma_addr); 222 kfree(buffer);
224} 223}
225 224
226static void _rtl_usb_io_handler_init(struct device *dev, 225static void _rtl_usb_io_handler_init(struct device *dev,
@@ -640,6 +639,7 @@ static int _rtl_usb_receive(struct ieee80211_hw *hw)
640 RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG, 639 RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG,
641 "Failed to prep_rx_urb!!\n"); 640 "Failed to prep_rx_urb!!\n");
642 err = PTR_ERR(skb); 641 err = PTR_ERR(skb);
642 usb_free_urb(urb);
643 goto err_out; 643 goto err_out;
644 } 644 }
645 645
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index c26e28b4bd9f..7ffa43bd7cf9 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1015,29 +1015,10 @@ err:
1015 i = xennet_fill_frags(np, skb, &tmpq); 1015 i = xennet_fill_frags(np, skb, &tmpq);
1016 1016
1017 /* 1017 /*
1018 * Truesize approximates the size of true data plus 1018 * Truesize is the actual allocation size, even if the
1019 * any supervisor overheads. Adding hypervisor 1019 * allocation is only partially used.
1020 * overheads has been shown to significantly reduce 1020 */
1021 * achievable bandwidth with the default receive 1021 skb->truesize += PAGE_SIZE * skb_shinfo(skb)->nr_frags;
1022 * buffer size. It is therefore not wise to account
1023 * for it here.
1024 *
1025 * After alloc_skb(RX_COPY_THRESHOLD), truesize is set
1026 * to RX_COPY_THRESHOLD + the supervisor
1027 * overheads. Here, we add the size of the data pulled
1028 * in xennet_fill_frags().
1029 *
1030 * We also adjust for any unused space in the main
1031 * data area by subtracting (RX_COPY_THRESHOLD -
1032 * len). This is especially important with drivers
1033 * which split incoming packets into header and data,
1034 * using only 66 bytes of the main data area (see the
1035 * e1000 driver for example.) On such systems,
1036 * without this last adjustement, our achievable
1037 * receive throughout using the standard receive
1038 * buffer size was cut by 25%(!!!).
1039 */
1040 skb->truesize += skb->data_len - RX_COPY_THRESHOLD;
1041 skb->len += skb->data_len; 1022 skb->len += skb->data_len;
1042 1023
1043 if (rx->flags & XEN_NETRXF_csum_blank) 1024 if (rx->flags & XEN_NETRXF_csum_blank)
diff --git a/drivers/nfc/pn544/i2c.c b/drivers/nfc/pn544/i2c.c
index 7da9071b68b6..2a9c8d93d2e8 100644
--- a/drivers/nfc/pn544/i2c.c
+++ b/drivers/nfc/pn544/i2c.c
@@ -361,8 +361,8 @@ static struct nfc_phy_ops i2c_phy_ops = {
361 .disable = pn544_hci_i2c_disable, 361 .disable = pn544_hci_i2c_disable,
362}; 362};
363 363
364static int __devinit pn544_hci_i2c_probe(struct i2c_client *client, 364static int pn544_hci_i2c_probe(struct i2c_client *client,
365 const struct i2c_device_id *id) 365 const struct i2c_device_id *id)
366{ 366{
367 struct pn544_i2c_phy *phy; 367 struct pn544_i2c_phy *phy;
368 struct pn544_nfc_platform_data *pdata; 368 struct pn544_nfc_platform_data *pdata;
@@ -442,7 +442,7 @@ err_phy_alloc:
442 return r; 442 return r;
443} 443}
444 444
445static __devexit int pn544_hci_i2c_remove(struct i2c_client *client) 445static int pn544_hci_i2c_remove(struct i2c_client *client)
446{ 446{
447 struct pn544_i2c_phy *phy = i2c_get_clientdata(client); 447 struct pn544_i2c_phy *phy = i2c_get_clientdata(client);
448 struct pn544_nfc_platform_data *pdata = client->dev.platform_data; 448 struct pn544_nfc_platform_data *pdata = client->dev.platform_data;
@@ -469,7 +469,7 @@ static struct i2c_driver pn544_hci_i2c_driver = {
469 }, 469 },
470 .probe = pn544_hci_i2c_probe, 470 .probe = pn544_hci_i2c_probe,
471 .id_table = pn544_hci_i2c_id_table, 471 .id_table = pn544_hci_i2c_id_table,
472 .remove = __devexit_p(pn544_hci_i2c_remove), 472 .remove = pn544_hci_i2c_remove,
473}; 473};
474 474
475static int __init pn544_hci_i2c_init(void) 475static int __init pn544_hci_i2c_init(void)
diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c
index fb6a1fe21b93..8e4e86b78428 100644
--- a/drivers/parisc/dino.c
+++ b/drivers/parisc/dino.c
@@ -430,7 +430,7 @@ static void dino_choose_irq(struct parisc_device *dev, void *ctrl)
430 * Cirrus 6832 Cardbus reports wrong irq on RDI Tadpole PARISC Laptop (deller@gmx.de) 430 * Cirrus 6832 Cardbus reports wrong irq on RDI Tadpole PARISC Laptop (deller@gmx.de)
431 * (the irqs are off-by-one, not sure yet if this is a cirrus, dino-hardware or dino-driver problem...) 431 * (the irqs are off-by-one, not sure yet if this is a cirrus, dino-hardware or dino-driver problem...)
432 */ 432 */
433static void __devinit quirk_cirrus_cardbus(struct pci_dev *dev) 433static void quirk_cirrus_cardbus(struct pci_dev *dev)
434{ 434{
435 u8 new_irq = dev->irq - 1; 435 u8 new_irq = dev->irq - 1;
436 printk(KERN_INFO "PCI: Cirrus Cardbus IRQ fixup for %s, from %d to %d\n", 436 printk(KERN_INFO "PCI: Cirrus Cardbus IRQ fixup for %s, from %d to %d\n",
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c
index fdd63a6a62d6..2ef7103270bb 100644
--- a/drivers/parisc/lba_pci.c
+++ b/drivers/parisc/lba_pci.c
@@ -34,7 +34,7 @@
34#include <linux/types.h> 34#include <linux/types.h>
35#include <linux/kernel.h> 35#include <linux/kernel.h>
36#include <linux/spinlock.h> 36#include <linux/spinlock.h>
37#include <linux/init.h> /* for __init and __devinit */ 37#include <linux/init.h> /* for __init */
38#include <linux/pci.h> 38#include <linux/pci.h>
39#include <linux/ioport.h> 39#include <linux/ioport.h>
40#include <linux/slab.h> 40#include <linux/slab.h>
diff --git a/drivers/parport/parport_gsc.c b/drivers/parport/parport_gsc.c
index 352f96180bc7..050773c36823 100644
--- a/drivers/parport/parport_gsc.c
+++ b/drivers/parport/parport_gsc.c
@@ -137,7 +137,7 @@ struct parport_operations parport_gsc_ops =
137/* 137/*
138 * Checks for port existence, all ports support SPP MODE 138 * Checks for port existence, all ports support SPP MODE
139 */ 139 */
140static int __devinit parport_SPP_supported(struct parport *pb) 140static int parport_SPP_supported(struct parport *pb)
141{ 141{
142 unsigned char r, w; 142 unsigned char r, w;
143 143
@@ -201,7 +201,7 @@ static int __devinit parport_SPP_supported(struct parport *pb)
201 * be misdetected here is rather academic. 201 * be misdetected here is rather academic.
202 */ 202 */
203 203
204static int __devinit parport_PS2_supported(struct parport *pb) 204static int parport_PS2_supported(struct parport *pb)
205{ 205{
206 int ok = 0; 206 int ok = 0;
207 207
@@ -232,10 +232,9 @@ static int __devinit parport_PS2_supported(struct parport *pb)
232 232
233/* --- Initialisation code -------------------------------- */ 233/* --- Initialisation code -------------------------------- */
234 234
235struct parport *__devinit parport_gsc_probe_port (unsigned long base, 235struct parport *parport_gsc_probe_port(unsigned long base,
236 unsigned long base_hi, 236 unsigned long base_hi, int irq,
237 int irq, int dma, 237 int dma, struct pci_dev *dev)
238 struct pci_dev *dev)
239{ 238{
240 struct parport_gsc_private *priv; 239 struct parport_gsc_private *priv;
241 struct parport_operations *ops; 240 struct parport_operations *ops;
@@ -345,9 +344,9 @@ struct parport *__devinit parport_gsc_probe_port (unsigned long base,
345 344
346#define PARPORT_GSC_OFFSET 0x800 345#define PARPORT_GSC_OFFSET 0x800
347 346
348static int __devinitdata parport_count; 347static int parport_count;
349 348
350static int __devinit parport_init_chip(struct parisc_device *dev) 349static int parport_init_chip(struct parisc_device *dev)
351{ 350{
352 struct parport *p; 351 struct parport *p;
353 unsigned long port; 352 unsigned long port;
@@ -382,7 +381,7 @@ static int __devinit parport_init_chip(struct parisc_device *dev)
382 return 0; 381 return 0;
383} 382}
384 383
385static int __devexit parport_remove_chip(struct parisc_device *dev) 384static int parport_remove_chip(struct parisc_device *dev)
386{ 385{
387 struct parport *p = dev_get_drvdata(&dev->dev); 386 struct parport *p = dev_get_drvdata(&dev->dev);
388 if (p) { 387 if (p) {
@@ -415,15 +414,15 @@ static struct parisc_driver parport_driver = {
415 .name = "Parallel", 414 .name = "Parallel",
416 .id_table = parport_tbl, 415 .id_table = parport_tbl,
417 .probe = parport_init_chip, 416 .probe = parport_init_chip,
418 .remove = __devexit_p(parport_remove_chip), 417 .remove = parport_remove_chip,
419}; 418};
420 419
421int __devinit parport_gsc_init(void) 420int parport_gsc_init(void)
422{ 421{
423 return register_parisc_driver(&parport_driver); 422 return register_parisc_driver(&parport_driver);
424} 423}
425 424
426static void __devexit parport_gsc_exit(void) 425static void parport_gsc_exit(void)
427{ 426{
428 unregister_parisc_driver(&parport_driver); 427 unregister_parisc_driver(&parport_driver);
429} 428}
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index 5abffe58a9d2..903e1285fda0 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -953,7 +953,7 @@ static struct superio_struct *find_free_superio(void)
953 953
954 954
955/* Super-IO chipset detection, Winbond, SMSC */ 955/* Super-IO chipset detection, Winbond, SMSC */
956static void __devinit show_parconfig_smsc37c669(int io, int key) 956static void show_parconfig_smsc37c669(int io, int key)
957{ 957{
958 int cr1, cr4, cra, cr23, cr26, cr27; 958 int cr1, cr4, cra, cr23, cr26, cr27;
959 struct superio_struct *s; 959 struct superio_struct *s;
@@ -1038,7 +1038,7 @@ static void __devinit show_parconfig_smsc37c669(int io, int key)
1038} 1038}
1039 1039
1040 1040
1041static void __devinit show_parconfig_winbond(int io, int key) 1041static void show_parconfig_winbond(int io, int key)
1042{ 1042{
1043 int cr30, cr60, cr61, cr70, cr74, crf0; 1043 int cr30, cr60, cr61, cr70, cr74, crf0;
1044 struct superio_struct *s; 1044 struct superio_struct *s;
@@ -1106,8 +1106,7 @@ static void __devinit show_parconfig_winbond(int io, int key)
1106 } 1106 }
1107} 1107}
1108 1108
1109static void __devinit decode_winbond(int efer, int key, int devid, 1109static void decode_winbond(int efer, int key, int devid, int devrev, int oldid)
1110 int devrev, int oldid)
1111{ 1110{
1112 const char *type = "unknown"; 1111 const char *type = "unknown";
1113 int id, progif = 2; 1112 int id, progif = 2;
@@ -1159,7 +1158,7 @@ static void __devinit decode_winbond(int efer, int key, int devid,
1159 show_parconfig_winbond(efer, key); 1158 show_parconfig_winbond(efer, key);
1160} 1159}
1161 1160
1162static void __devinit decode_smsc(int efer, int key, int devid, int devrev) 1161static void decode_smsc(int efer, int key, int devid, int devrev)
1163{ 1162{
1164 const char *type = "unknown"; 1163 const char *type = "unknown";
1165 void (*func)(int io, int key); 1164 void (*func)(int io, int key);
@@ -1193,7 +1192,7 @@ static void __devinit decode_smsc(int efer, int key, int devid, int devrev)
1193} 1192}
1194 1193
1195 1194
1196static void __devinit winbond_check(int io, int key) 1195static void winbond_check(int io, int key)
1197{ 1196{
1198 int origval, devid, devrev, oldid, x_devid, x_devrev, x_oldid; 1197 int origval, devid, devrev, oldid, x_devid, x_devrev, x_oldid;
1199 1198
@@ -1231,7 +1230,7 @@ out:
1231 release_region(io, 3); 1230 release_region(io, 3);
1232} 1231}
1233 1232
1234static void __devinit winbond_check2(int io, int key) 1233static void winbond_check2(int io, int key)
1235{ 1234{
1236 int origval[3], devid, devrev, oldid, x_devid, x_devrev, x_oldid; 1235 int origval[3], devid, devrev, oldid, x_devid, x_devrev, x_oldid;
1237 1236
@@ -1272,7 +1271,7 @@ out:
1272 release_region(io, 3); 1271 release_region(io, 3);
1273} 1272}
1274 1273
1275static void __devinit smsc_check(int io, int key) 1274static void smsc_check(int io, int key)
1276{ 1275{
1277 int origval, id, rev, oldid, oldrev, x_id, x_rev, x_oldid, x_oldrev; 1276 int origval, id, rev, oldid, oldrev, x_id, x_rev, x_oldid, x_oldrev;
1278 1277
@@ -1316,7 +1315,7 @@ out:
1316} 1315}
1317 1316
1318 1317
1319static void __devinit detect_and_report_winbond(void) 1318static void detect_and_report_winbond(void)
1320{ 1319{
1321 if (verbose_probing) 1320 if (verbose_probing)
1322 printk(KERN_DEBUG "Winbond Super-IO detection, now testing ports 3F0,370,250,4E,2E ...\n"); 1321 printk(KERN_DEBUG "Winbond Super-IO detection, now testing ports 3F0,370,250,4E,2E ...\n");
@@ -1329,7 +1328,7 @@ static void __devinit detect_and_report_winbond(void)
1329 winbond_check2(0x250, 0x89); 1328 winbond_check2(0x250, 0x89);
1330} 1329}
1331 1330
1332static void __devinit detect_and_report_smsc(void) 1331static void detect_and_report_smsc(void)
1333{ 1332{
1334 if (verbose_probing) 1333 if (verbose_probing)
1335 printk(KERN_DEBUG "SMSC Super-IO detection, now testing Ports 2F0, 370 ...\n"); 1334 printk(KERN_DEBUG "SMSC Super-IO detection, now testing Ports 2F0, 370 ...\n");
@@ -1339,7 +1338,7 @@ static void __devinit detect_and_report_smsc(void)
1339 smsc_check(0x370, 0x44); 1338 smsc_check(0x370, 0x44);
1340} 1339}
1341 1340
1342static void __devinit detect_and_report_it87(void) 1341static void detect_and_report_it87(void)
1343{ 1342{
1344 u16 dev; 1343 u16 dev;
1345 u8 origval, r; 1344 u8 origval, r;
@@ -1796,24 +1795,24 @@ static int parport_ECPEPP_supported(struct parport *pb)
1796#else /* No IEEE 1284 support */ 1795#else /* No IEEE 1284 support */
1797 1796
1798/* Don't bother probing for modes we know we won't use. */ 1797/* Don't bother probing for modes we know we won't use. */
1799static int __devinit parport_PS2_supported(struct parport *pb) { return 0; } 1798static int parport_PS2_supported(struct parport *pb) { return 0; }
1800#ifdef CONFIG_PARPORT_PC_FIFO 1799#ifdef CONFIG_PARPORT_PC_FIFO
1801static int parport_ECP_supported(struct parport *pb) 1800static int parport_ECP_supported(struct parport *pb)
1802{ 1801{
1803 return 0; 1802 return 0;
1804} 1803}
1805#endif 1804#endif
1806static int __devinit parport_EPP_supported(struct parport *pb) 1805static int parport_EPP_supported(struct parport *pb)
1807{ 1806{
1808 return 0; 1807 return 0;
1809} 1808}
1810 1809
1811static int __devinit parport_ECPEPP_supported(struct parport *pb) 1810static int parport_ECPEPP_supported(struct parport *pb)
1812{ 1811{
1813 return 0; 1812 return 0;
1814} 1813}
1815 1814
1816static int __devinit parport_ECPPS2_supported(struct parport *pb) 1815static int parport_ECPPS2_supported(struct parport *pb)
1817{ 1816{
1818 return 0; 1817 return 0;
1819} 1818}
@@ -2269,9 +2268,8 @@ EXPORT_SYMBOL(parport_pc_unregister_port);
2269#ifdef CONFIG_PCI 2268#ifdef CONFIG_PCI
2270 2269
2271/* ITE support maintained by Rich Liu <richliu@poorman.org> */ 2270/* ITE support maintained by Rich Liu <richliu@poorman.org> */
2272static int __devinit sio_ite_8872_probe(struct pci_dev *pdev, int autoirq, 2271static int sio_ite_8872_probe(struct pci_dev *pdev, int autoirq, int autodma,
2273 int autodma, 2272 const struct parport_pc_via_data *via)
2274 const struct parport_pc_via_data *via)
2275{ 2273{
2276 short inta_addr[6] = { 0x2A0, 0x2C0, 0x220, 0x240, 0x1E0 }; 2274 short inta_addr[6] = { 0x2A0, 0x2C0, 0x220, 0x240, 0x1E0 };
2277 u32 ite8872set; 2275 u32 ite8872set;
@@ -2377,10 +2375,10 @@ static int __devinit sio_ite_8872_probe(struct pci_dev *pdev, int autoirq,
2377 2375
2378/* VIA 8231 support by Pavel Fedin <sonic_amiga@rambler.ru> 2376/* VIA 8231 support by Pavel Fedin <sonic_amiga@rambler.ru>
2379 based on VIA 686a support code by Jeff Garzik <jgarzik@pobox.com> */ 2377 based on VIA 686a support code by Jeff Garzik <jgarzik@pobox.com> */
2380static int __devinitdata parport_init_mode; 2378static int parport_init_mode;
2381 2379
2382/* Data for two known VIA chips */ 2380/* Data for two known VIA chips */
2383static struct parport_pc_via_data via_686a_data __devinitdata = { 2381static struct parport_pc_via_data via_686a_data = {
2384 0x51, 2382 0x51,
2385 0x50, 2383 0x50,
2386 0x85, 2384 0x85,
@@ -2389,7 +2387,7 @@ static struct parport_pc_via_data via_686a_data __devinitdata = {
2389 0xF0, 2387 0xF0,
2390 0xE6 2388 0xE6
2391}; 2389};
2392static struct parport_pc_via_data via_8231_data __devinitdata = { 2390static struct parport_pc_via_data via_8231_data = {
2393 0x45, 2391 0x45,
2394 0x44, 2392 0x44,
2395 0x50, 2393 0x50,
@@ -2399,9 +2397,8 @@ static struct parport_pc_via_data via_8231_data __devinitdata = {
2399 0xF6 2397 0xF6
2400}; 2398};
2401 2399
2402static int __devinit sio_via_probe(struct pci_dev *pdev, int autoirq, 2400static int sio_via_probe(struct pci_dev *pdev, int autoirq, int autodma,
2403 int autodma, 2401 const struct parport_pc_via_data *via)
2404 const struct parport_pc_via_data *via)
2405{ 2402{
2406 u8 tmp, tmp2, siofunc; 2403 u8 tmp, tmp2, siofunc;
2407 u8 ppcontrol = 0; 2404 u8 ppcontrol = 0;
@@ -2575,7 +2572,7 @@ static struct parport_pc_superio {
2575 int (*probe) (struct pci_dev *pdev, int autoirq, int autodma, 2572 int (*probe) (struct pci_dev *pdev, int autoirq, int autodma,
2576 const struct parport_pc_via_data *via); 2573 const struct parport_pc_via_data *via);
2577 const struct parport_pc_via_data *via; 2574 const struct parport_pc_via_data *via;
2578} parport_pc_superio_info[] __devinitdata = { 2575} parport_pc_superio_info[] = {
2579 { sio_via_probe, &via_686a_data, }, 2576 { sio_via_probe, &via_686a_data, },
2580 { sio_via_probe, &via_8231_data, }, 2577 { sio_via_probe, &via_8231_data, },
2581 { sio_ite_8872_probe, NULL, }, 2578 { sio_ite_8872_probe, NULL, },
@@ -2860,7 +2857,7 @@ static int parport_pc_pci_probe(struct pci_dev *dev,
2860 return -ENODEV; 2857 return -ENODEV;
2861} 2858}
2862 2859
2863static void __devexit parport_pc_pci_remove(struct pci_dev *dev) 2860static void parport_pc_pci_remove(struct pci_dev *dev)
2864{ 2861{
2865 struct pci_parport_data *data = pci_get_drvdata(dev); 2862 struct pci_parport_data *data = pci_get_drvdata(dev);
2866 int i; 2863 int i;
@@ -2879,7 +2876,7 @@ static struct pci_driver parport_pc_pci_driver = {
2879 .name = "parport_pc", 2876 .name = "parport_pc",
2880 .id_table = parport_pc_pci_tbl, 2877 .id_table = parport_pc_pci_tbl,
2881 .probe = parport_pc_pci_probe, 2878 .probe = parport_pc_pci_probe,
2882 .remove = __devexit_p(parport_pc_pci_remove), 2879 .remove = parport_pc_pci_remove,
2883}; 2880};
2884 2881
2885static int __init parport_pc_init_superio(int autoirq, int autodma) 2882static int __init parport_pc_init_superio(int autoirq, int autodma)
@@ -2983,7 +2980,7 @@ static struct pnp_driver parport_pc_pnp_driver = {
2983static struct pnp_driver parport_pc_pnp_driver; 2980static struct pnp_driver parport_pc_pnp_driver;
2984#endif /* CONFIG_PNP */ 2981#endif /* CONFIG_PNP */
2985 2982
2986static int __devinit parport_pc_platform_probe(struct platform_device *pdev) 2983static int parport_pc_platform_probe(struct platform_device *pdev)
2987{ 2984{
2988 /* Always succeed, the actual probing is done in 2985 /* Always succeed, the actual probing is done in
2989 * parport_pc_probe_port(). */ 2986 * parport_pc_probe_port(). */
@@ -2999,7 +2996,7 @@ static struct platform_driver parport_pc_platform_driver = {
2999}; 2996};
3000 2997
3001/* This is called by parport_pc_find_nonpci_ports (in asm/parport.h) */ 2998/* This is called by parport_pc_find_nonpci_ports (in asm/parport.h) */
3002static int __devinit __attribute__((unused)) 2999static int __attribute__((unused))
3003parport_pc_find_isa_ports(int autoirq, int autodma) 3000parport_pc_find_isa_ports(int autoirq, int autodma)
3004{ 3001{
3005 int count = 0; 3002 int count = 0;
diff --git a/drivers/parport/parport_serial.c b/drivers/parport/parport_serial.c
index 1631eeaf440e..ef6169adb845 100644
--- a/drivers/parport/parport_serial.c
+++ b/drivers/parport/parport_serial.c
@@ -87,7 +87,8 @@ struct parport_pc_pci {
87 struct parport_pc_pci *card, int failed); 87 struct parport_pc_pci *card, int failed);
88}; 88};
89 89
90static int __devinit netmos_parallel_init(struct pci_dev *dev, struct parport_pc_pci *par, int autoirq, int autodma) 90static int netmos_parallel_init(struct pci_dev *dev, struct parport_pc_pci *par,
91 int autoirq, int autodma)
91{ 92{
92 /* the rule described below doesn't hold for this device */ 93 /* the rule described below doesn't hold for this device */
93 if (dev->device == PCI_DEVICE_ID_NETMOS_9835 && 94 if (dev->device == PCI_DEVICE_ID_NETMOS_9835 &&
@@ -111,7 +112,7 @@ static int __devinit netmos_parallel_init(struct pci_dev *dev, struct parport_pc
111 return 0; 112 return 0;
112} 113}
113 114
114static struct parport_pc_pci cards[] __devinitdata = { 115static struct parport_pc_pci cards[] = {
115 /* titan_110l */ { 1, { { 3, -1 }, } }, 116 /* titan_110l */ { 1, { { 3, -1 }, } },
116 /* titan_210l */ { 1, { { 3, -1 }, } }, 117 /* titan_210l */ { 1, { { 3, -1 }, } },
117 /* netmos_9xx5_combo */ { 1, { { 2, -1 }, }, netmos_parallel_init }, 118 /* netmos_9xx5_combo */ { 1, { { 2, -1 }, }, netmos_parallel_init },
@@ -258,7 +259,7 @@ MODULE_DEVICE_TABLE(pci,parport_serial_pci_tbl);
258 * Cards not tested are marked n/t 259 * Cards not tested are marked n/t
259 * If you have one of these cards and it works for you, please tell me.. 260 * If you have one of these cards and it works for you, please tell me..
260 */ 261 */
261static struct pciserial_board pci_parport_serial_boards[] __devinitdata = { 262static struct pciserial_board pci_parport_serial_boards[] = {
262 [titan_110l] = { 263 [titan_110l] = {
263 .flags = FL_BASE1 | FL_BASE_BARS, 264 .flags = FL_BASE1 | FL_BASE_BARS,
264 .num_ports = 1, 265 .num_ports = 1,
@@ -479,8 +480,7 @@ struct parport_serial_private {
479}; 480};
480 481
481/* Register the serial port(s) of a PCI card. */ 482/* Register the serial port(s) of a PCI card. */
482static int __devinit serial_register (struct pci_dev *dev, 483static int serial_register(struct pci_dev *dev, const struct pci_device_id *id)
483 const struct pci_device_id *id)
484{ 484{
485 struct parport_serial_private *priv = pci_get_drvdata (dev); 485 struct parport_serial_private *priv = pci_get_drvdata (dev);
486 struct pciserial_board *board; 486 struct pciserial_board *board;
@@ -501,8 +501,7 @@ static int __devinit serial_register (struct pci_dev *dev,
501} 501}
502 502
503/* Register the parallel port(s) of a PCI card. */ 503/* Register the parallel port(s) of a PCI card. */
504static int __devinit parport_register (struct pci_dev *dev, 504static int parport_register(struct pci_dev *dev, const struct pci_device_id *id)
505 const struct pci_device_id *id)
506{ 505{
507 struct parport_pc_pci *card; 506 struct parport_pc_pci *card;
508 struct parport_serial_private *priv = pci_get_drvdata (dev); 507 struct parport_serial_private *priv = pci_get_drvdata (dev);
@@ -563,8 +562,8 @@ static int __devinit parport_register (struct pci_dev *dev,
563 return 0; 562 return 0;
564} 563}
565 564
566static int __devinit parport_serial_pci_probe (struct pci_dev *dev, 565static int parport_serial_pci_probe(struct pci_dev *dev,
567 const struct pci_device_id *id) 566 const struct pci_device_id *id)
568{ 567{
569 struct parport_serial_private *priv; 568 struct parport_serial_private *priv;
570 int err; 569 int err;
@@ -599,7 +598,7 @@ static int __devinit parport_serial_pci_probe (struct pci_dev *dev,
599 return 0; 598 return 0;
600} 599}
601 600
602static void __devexit parport_serial_pci_remove (struct pci_dev *dev) 601static void parport_serial_pci_remove(struct pci_dev *dev)
603{ 602{
604 struct parport_serial_private *priv = pci_get_drvdata (dev); 603 struct parport_serial_private *priv = pci_get_drvdata (dev);
605 int i; 604 int i;
@@ -664,7 +663,7 @@ static struct pci_driver parport_serial_pci_driver = {
664 .name = "parport_serial", 663 .name = "parport_serial",
665 .id_table = parport_serial_pci_tbl, 664 .id_table = parport_serial_pci_tbl,
666 .probe = parport_serial_pci_probe, 665 .probe = parport_serial_pci_probe,
667 .remove = __devexit_p(parport_serial_pci_remove), 666 .remove = parport_serial_pci_remove,
668#ifdef CONFIG_PM 667#ifdef CONFIG_PM
669 .suspend = parport_serial_pci_suspend, 668 .suspend = parport_serial_pci_suspend,
670 .resume = parport_serial_pci_resume, 669 .resume = parport_serial_pci_resume,
diff --git a/drivers/parport/parport_sunbpp.c b/drivers/parport/parport_sunbpp.c
index 983a2d2df659..5c4b6a1db6ca 100644
--- a/drivers/parport/parport_sunbpp.c
+++ b/drivers/parport/parport_sunbpp.c
@@ -265,7 +265,7 @@ static struct parport_operations parport_sunbpp_ops =
265 .owner = THIS_MODULE, 265 .owner = THIS_MODULE,
266}; 266};
267 267
268static int __devinit bpp_probe(struct platform_device *op) 268static int bpp_probe(struct platform_device *op)
269{ 269{
270 struct parport_operations *ops; 270 struct parport_operations *ops;
271 struct bpp_regs __iomem *regs; 271 struct bpp_regs __iomem *regs;
@@ -330,7 +330,7 @@ out_unmap:
330 return err; 330 return err;
331} 331}
332 332
333static int __devexit bpp_remove(struct platform_device *op) 333static int bpp_remove(struct platform_device *op)
334{ 334{
335 struct parport *p = dev_get_drvdata(&op->dev); 335 struct parport *p = dev_get_drvdata(&op->dev);
336 struct parport_operations *ops = p->ops; 336 struct parport_operations *ops = p->ops;
@@ -367,7 +367,7 @@ static struct platform_driver bpp_sbus_driver = {
367 .of_match_table = bpp_match, 367 .of_match_table = bpp_match,
368 }, 368 },
369 .probe = bpp_probe, 369 .probe = bpp_probe,
370 .remove = __devexit_p(bpp_remove), 370 .remove = bpp_remove,
371}; 371};
372 372
373module_platform_driver(bpp_sbus_driver); 373module_platform_driver(bpp_sbus_driver);
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h
index 26ffd3e3fb74..2c113de94323 100644
--- a/drivers/pci/hotplug/pciehp.h
+++ b/drivers/pci/hotplug/pciehp.h
@@ -44,7 +44,6 @@ extern bool pciehp_poll_mode;
44extern int pciehp_poll_time; 44extern int pciehp_poll_time;
45extern bool pciehp_debug; 45extern bool pciehp_debug;
46extern bool pciehp_force; 46extern bool pciehp_force;
47extern struct workqueue_struct *pciehp_wq;
48 47
49#define dbg(format, arg...) \ 48#define dbg(format, arg...) \
50do { \ 49do { \
@@ -78,6 +77,7 @@ struct slot {
78 struct hotplug_slot *hotplug_slot; 77 struct hotplug_slot *hotplug_slot;
79 struct delayed_work work; /* work for button event */ 78 struct delayed_work work; /* work for button event */
80 struct mutex lock; 79 struct mutex lock;
80 struct workqueue_struct *wq;
81}; 81};
82 82
83struct event_info { 83struct event_info {
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
index 916bf4f53aba..939bd1d4b5b1 100644
--- a/drivers/pci/hotplug/pciehp_core.c
+++ b/drivers/pci/hotplug/pciehp_core.c
@@ -42,7 +42,6 @@ bool pciehp_debug;
42bool pciehp_poll_mode; 42bool pciehp_poll_mode;
43int pciehp_poll_time; 43int pciehp_poll_time;
44bool pciehp_force; 44bool pciehp_force;
45struct workqueue_struct *pciehp_wq;
46 45
47#define DRIVER_VERSION "0.4" 46#define DRIVER_VERSION "0.4"
48#define DRIVER_AUTHOR "Dan Zink <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>, Dely Sy <dely.l.sy@intel.com>" 47#define DRIVER_AUTHOR "Dan Zink <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>, Dely Sy <dely.l.sy@intel.com>"
@@ -340,18 +339,13 @@ static int __init pcied_init(void)
340{ 339{
341 int retval = 0; 340 int retval = 0;
342 341
343 pciehp_wq = alloc_workqueue("pciehp", 0, 0);
344 if (!pciehp_wq)
345 return -ENOMEM;
346
347 pciehp_firmware_init(); 342 pciehp_firmware_init();
348 retval = pcie_port_service_register(&hpdriver_portdrv); 343 retval = pcie_port_service_register(&hpdriver_portdrv);
349 dbg("pcie_port_service_register = %d\n", retval); 344 dbg("pcie_port_service_register = %d\n", retval);
350 info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); 345 info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
351 if (retval) { 346 if (retval)
352 destroy_workqueue(pciehp_wq);
353 dbg("Failure to register service\n"); 347 dbg("Failure to register service\n");
354 } 348
355 return retval; 349 return retval;
356} 350}
357 351
@@ -359,7 +353,6 @@ static void __exit pcied_cleanup(void)
359{ 353{
360 dbg("unload_pciehpd()\n"); 354 dbg("unload_pciehpd()\n");
361 pcie_port_service_unregister(&hpdriver_portdrv); 355 pcie_port_service_unregister(&hpdriver_portdrv);
362 destroy_workqueue(pciehp_wq);
363 info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n"); 356 info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n");
364} 357}
365 358
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
index 27f44295a657..38f018679175 100644
--- a/drivers/pci/hotplug/pciehp_ctrl.c
+++ b/drivers/pci/hotplug/pciehp_ctrl.c
@@ -49,7 +49,7 @@ static int queue_interrupt_event(struct slot *p_slot, u32 event_type)
49 info->p_slot = p_slot; 49 info->p_slot = p_slot;
50 INIT_WORK(&info->work, interrupt_event_handler); 50 INIT_WORK(&info->work, interrupt_event_handler);
51 51
52 queue_work(pciehp_wq, &info->work); 52 queue_work(p_slot->wq, &info->work);
53 53
54 return 0; 54 return 0;
55} 55}
@@ -344,7 +344,7 @@ void pciehp_queue_pushbutton_work(struct work_struct *work)
344 kfree(info); 344 kfree(info);
345 goto out; 345 goto out;
346 } 346 }
347 queue_work(pciehp_wq, &info->work); 347 queue_work(p_slot->wq, &info->work);
348 out: 348 out:
349 mutex_unlock(&p_slot->lock); 349 mutex_unlock(&p_slot->lock);
350} 350}
@@ -377,7 +377,7 @@ static void handle_button_press_event(struct slot *p_slot)
377 if (ATTN_LED(ctrl)) 377 if (ATTN_LED(ctrl))
378 pciehp_set_attention_status(p_slot, 0); 378 pciehp_set_attention_status(p_slot, 0);
379 379
380 queue_delayed_work(pciehp_wq, &p_slot->work, 5*HZ); 380 queue_delayed_work(p_slot->wq, &p_slot->work, 5*HZ);
381 break; 381 break;
382 case BLINKINGOFF_STATE: 382 case BLINKINGOFF_STATE:
383 case BLINKINGON_STATE: 383 case BLINKINGON_STATE:
@@ -439,7 +439,7 @@ static void handle_surprise_event(struct slot *p_slot)
439 else 439 else
440 p_slot->state = POWERON_STATE; 440 p_slot->state = POWERON_STATE;
441 441
442 queue_work(pciehp_wq, &info->work); 442 queue_work(p_slot->wq, &info->work);
443} 443}
444 444
445static void interrupt_event_handler(struct work_struct *work) 445static void interrupt_event_handler(struct work_struct *work)
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 13b2eaf7ba43..5127f3f41821 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -773,23 +773,32 @@ static void pcie_shutdown_notification(struct controller *ctrl)
773static int pcie_init_slot(struct controller *ctrl) 773static int pcie_init_slot(struct controller *ctrl)
774{ 774{
775 struct slot *slot; 775 struct slot *slot;
776 char name[32];
776 777
777 slot = kzalloc(sizeof(*slot), GFP_KERNEL); 778 slot = kzalloc(sizeof(*slot), GFP_KERNEL);
778 if (!slot) 779 if (!slot)
779 return -ENOMEM; 780 return -ENOMEM;
780 781
782 snprintf(name, sizeof(name), "pciehp-%u", PSN(ctrl));
783 slot->wq = alloc_workqueue(name, 0, 0);
784 if (!slot->wq)
785 goto abort;
786
781 slot->ctrl = ctrl; 787 slot->ctrl = ctrl;
782 mutex_init(&slot->lock); 788 mutex_init(&slot->lock);
783 INIT_DELAYED_WORK(&slot->work, pciehp_queue_pushbutton_work); 789 INIT_DELAYED_WORK(&slot->work, pciehp_queue_pushbutton_work);
784 ctrl->slot = slot; 790 ctrl->slot = slot;
785 return 0; 791 return 0;
792abort:
793 kfree(slot);
794 return -ENOMEM;
786} 795}
787 796
788static void pcie_cleanup_slot(struct controller *ctrl) 797static void pcie_cleanup_slot(struct controller *ctrl)
789{ 798{
790 struct slot *slot = ctrl->slot; 799 struct slot *slot = ctrl->slot;
791 cancel_delayed_work(&slot->work); 800 cancel_delayed_work(&slot->work);
792 flush_workqueue(pciehp_wq); 801 destroy_workqueue(slot->wq);
793 kfree(slot); 802 kfree(slot);
794} 803}
795 804
diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h
index ca64932e658b..b849f995075a 100644
--- a/drivers/pci/hotplug/shpchp.h
+++ b/drivers/pci/hotplug/shpchp.h
@@ -46,8 +46,6 @@
46extern bool shpchp_poll_mode; 46extern bool shpchp_poll_mode;
47extern int shpchp_poll_time; 47extern int shpchp_poll_time;
48extern bool shpchp_debug; 48extern bool shpchp_debug;
49extern struct workqueue_struct *shpchp_wq;
50extern struct workqueue_struct *shpchp_ordered_wq;
51 49
52#define dbg(format, arg...) \ 50#define dbg(format, arg...) \
53do { \ 51do { \
@@ -91,6 +89,7 @@ struct slot {
91 struct list_head slot_list; 89 struct list_head slot_list;
92 struct delayed_work work; /* work for button event */ 90 struct delayed_work work; /* work for button event */
93 struct mutex lock; 91 struct mutex lock;
92 struct workqueue_struct *wq;
94 u8 hp_slot; 93 u8 hp_slot;
95}; 94};
96 95
diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c
index b6de307248e4..3100c52c837c 100644
--- a/drivers/pci/hotplug/shpchp_core.c
+++ b/drivers/pci/hotplug/shpchp_core.c
@@ -39,8 +39,6 @@
39bool shpchp_debug; 39bool shpchp_debug;
40bool shpchp_poll_mode; 40bool shpchp_poll_mode;
41int shpchp_poll_time; 41int shpchp_poll_time;
42struct workqueue_struct *shpchp_wq;
43struct workqueue_struct *shpchp_ordered_wq;
44 42
45#define DRIVER_VERSION "0.4" 43#define DRIVER_VERSION "0.4"
46#define DRIVER_AUTHOR "Dan Zink <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>, Dely Sy <dely.l.sy@intel.com>" 44#define DRIVER_AUTHOR "Dan Zink <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>, Dely Sy <dely.l.sy@intel.com>"
@@ -129,6 +127,14 @@ static int init_slots(struct controller *ctrl)
129 slot->device = ctrl->slot_device_offset + i; 127 slot->device = ctrl->slot_device_offset + i;
130 slot->hpc_ops = ctrl->hpc_ops; 128 slot->hpc_ops = ctrl->hpc_ops;
131 slot->number = ctrl->first_slot + (ctrl->slot_num_inc * i); 129 slot->number = ctrl->first_slot + (ctrl->slot_num_inc * i);
130
131 snprintf(name, sizeof(name), "shpchp-%d", slot->number);
132 slot->wq = alloc_workqueue(name, 0, 0);
133 if (!slot->wq) {
134 retval = -ENOMEM;
135 goto error_info;
136 }
137
132 mutex_init(&slot->lock); 138 mutex_init(&slot->lock);
133 INIT_DELAYED_WORK(&slot->work, shpchp_queue_pushbutton_work); 139 INIT_DELAYED_WORK(&slot->work, shpchp_queue_pushbutton_work);
134 140
@@ -148,7 +154,7 @@ static int init_slots(struct controller *ctrl)
148 if (retval) { 154 if (retval) {
149 ctrl_err(ctrl, "pci_hp_register failed with error %d\n", 155 ctrl_err(ctrl, "pci_hp_register failed with error %d\n",
150 retval); 156 retval);
151 goto error_info; 157 goto error_slotwq;
152 } 158 }
153 159
154 get_power_status(hotplug_slot, &info->power_status); 160 get_power_status(hotplug_slot, &info->power_status);
@@ -160,6 +166,8 @@ static int init_slots(struct controller *ctrl)
160 } 166 }
161 167
162 return 0; 168 return 0;
169error_slotwq:
170 destroy_workqueue(slot->wq);
163error_info: 171error_info:
164 kfree(info); 172 kfree(info);
165error_hpslot: 173error_hpslot:
@@ -180,8 +188,7 @@ void cleanup_slots(struct controller *ctrl)
180 slot = list_entry(tmp, struct slot, slot_list); 188 slot = list_entry(tmp, struct slot, slot_list);
181 list_del(&slot->slot_list); 189 list_del(&slot->slot_list);
182 cancel_delayed_work(&slot->work); 190 cancel_delayed_work(&slot->work);
183 flush_workqueue(shpchp_wq); 191 destroy_workqueue(slot->wq);
184 flush_workqueue(shpchp_ordered_wq);
185 pci_hp_deregister(slot->hotplug_slot); 192 pci_hp_deregister(slot->hotplug_slot);
186 } 193 }
187} 194}
@@ -364,25 +371,12 @@ static struct pci_driver shpc_driver = {
364 371
365static int __init shpcd_init(void) 372static int __init shpcd_init(void)
366{ 373{
367 int retval = 0; 374 int retval;
368
369 shpchp_wq = alloc_ordered_workqueue("shpchp", 0);
370 if (!shpchp_wq)
371 return -ENOMEM;
372
373 shpchp_ordered_wq = alloc_ordered_workqueue("shpchp_ordered", 0);
374 if (!shpchp_ordered_wq) {
375 destroy_workqueue(shpchp_wq);
376 return -ENOMEM;
377 }
378 375
379 retval = pci_register_driver(&shpc_driver); 376 retval = pci_register_driver(&shpc_driver);
380 dbg("%s: pci_register_driver = %d\n", __func__, retval); 377 dbg("%s: pci_register_driver = %d\n", __func__, retval);
381 info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); 378 info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
382 if (retval) { 379
383 destroy_workqueue(shpchp_ordered_wq);
384 destroy_workqueue(shpchp_wq);
385 }
386 return retval; 380 return retval;
387} 381}
388 382
@@ -390,8 +384,6 @@ static void __exit shpcd_cleanup(void)
390{ 384{
391 dbg("unload_shpchpd()\n"); 385 dbg("unload_shpchpd()\n");
392 pci_unregister_driver(&shpc_driver); 386 pci_unregister_driver(&shpc_driver);
393 destroy_workqueue(shpchp_ordered_wq);
394 destroy_workqueue(shpchp_wq);
395 info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n"); 387 info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n");
396} 388}
397 389
diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c
index f9b5a52e4115..58499277903a 100644
--- a/drivers/pci/hotplug/shpchp_ctrl.c
+++ b/drivers/pci/hotplug/shpchp_ctrl.c
@@ -51,7 +51,7 @@ static int queue_interrupt_event(struct slot *p_slot, u32 event_type)
51 info->p_slot = p_slot; 51 info->p_slot = p_slot;
52 INIT_WORK(&info->work, interrupt_event_handler); 52 INIT_WORK(&info->work, interrupt_event_handler);
53 53
54 queue_work(shpchp_wq, &info->work); 54 queue_work(p_slot->wq, &info->work);
55 55
56 return 0; 56 return 0;
57} 57}
@@ -453,7 +453,7 @@ void shpchp_queue_pushbutton_work(struct work_struct *work)
453 kfree(info); 453 kfree(info);
454 goto out; 454 goto out;
455 } 455 }
456 queue_work(shpchp_ordered_wq, &info->work); 456 queue_work(p_slot->wq, &info->work);
457 out: 457 out:
458 mutex_unlock(&p_slot->lock); 458 mutex_unlock(&p_slot->lock);
459} 459}
@@ -501,7 +501,7 @@ static void handle_button_press_event(struct slot *p_slot)
501 p_slot->hpc_ops->green_led_blink(p_slot); 501 p_slot->hpc_ops->green_led_blink(p_slot);
502 p_slot->hpc_ops->set_attention_status(p_slot, 0); 502 p_slot->hpc_ops->set_attention_status(p_slot, 0);
503 503
504 queue_delayed_work(shpchp_wq, &p_slot->work, 5*HZ); 504 queue_delayed_work(p_slot->wq, &p_slot->work, 5*HZ);
505 break; 505 break;
506 case BLINKINGOFF_STATE: 506 case BLINKINGOFF_STATE:
507 case BLINKINGON_STATE: 507 case BLINKINGON_STATE:
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
index bafd2bbcaf65..c18e5bf444fa 100644
--- a/drivers/pci/iov.c
+++ b/drivers/pci/iov.c
@@ -739,7 +739,7 @@ EXPORT_SYMBOL_GPL(pci_num_vf);
739/** 739/**
740 * pci_sriov_set_totalvfs -- reduce the TotalVFs available 740 * pci_sriov_set_totalvfs -- reduce the TotalVFs available
741 * @dev: the PCI PF device 741 * @dev: the PCI PF device
742 * numvfs: number that should be used for TotalVFs supported 742 * @numvfs: number that should be used for TotalVFs supported
743 * 743 *
744 * Should be called from PF driver's probe routine with 744 * Should be called from PF driver's probe routine with
745 * device's mutex held. 745 * device's mutex held.
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 05b78b16d20b..9c6e9bb674ec 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -422,77 +422,60 @@ static ssize_t sriov_numvfs_show(struct device *dev,
422} 422}
423 423
424/* 424/*
425 * num_vfs > 0; number of vfs to enable 425 * num_vfs > 0; number of VFs to enable
426 * num_vfs = 0; disable all vfs 426 * num_vfs = 0; disable all VFs
427 * 427 *
428 * Note: SRIOV spec doesn't allow partial VF 428 * Note: SRIOV spec doesn't allow partial VF
429 * disable, so its all or none. 429 * disable, so it's all or none.
430 */ 430 */
431static ssize_t sriov_numvfs_store(struct device *dev, 431static ssize_t sriov_numvfs_store(struct device *dev,
432 struct device_attribute *attr, 432 struct device_attribute *attr,
433 const char *buf, size_t count) 433 const char *buf, size_t count)
434{ 434{
435 struct pci_dev *pdev = to_pci_dev(dev); 435 struct pci_dev *pdev = to_pci_dev(dev);
436 int num_vfs_enabled = 0; 436 int ret;
437 int num_vfs; 437 u16 num_vfs;
438 int ret = 0;
439 u16 total;
440 438
441 if (kstrtoint(buf, 0, &num_vfs) < 0) 439 ret = kstrtou16(buf, 0, &num_vfs);
442 return -EINVAL; 440 if (ret < 0)
441 return ret;
442
443 if (num_vfs > pci_sriov_get_totalvfs(pdev))
444 return -ERANGE;
445
446 if (num_vfs == pdev->sriov->num_VFs)
447 return count; /* no change */
443 448
444 /* is PF driver loaded w/callback */ 449 /* is PF driver loaded w/callback */
445 if (!pdev->driver || !pdev->driver->sriov_configure) { 450 if (!pdev->driver || !pdev->driver->sriov_configure) {
446 dev_info(&pdev->dev, 451 dev_info(&pdev->dev, "Driver doesn't support SRIOV configuration via sysfs\n");
447 "Driver doesn't support SRIOV configuration via sysfs\n");
448 return -ENOSYS; 452 return -ENOSYS;
449 } 453 }
450 454
451 /* if enabling vf's ... */ 455 if (num_vfs == 0) {
452 total = pci_sriov_get_totalvfs(pdev); 456 /* disable VFs */
453 /* Requested VFs to enable < totalvfs and none enabled already */ 457 ret = pdev->driver->sriov_configure(pdev, 0);
454 if ((num_vfs > 0) && (num_vfs <= total)) { 458 if (ret < 0)
455 if (pdev->sriov->num_VFs == 0) { 459 return ret;
456 num_vfs_enabled = 460 return count;
457 pdev->driver->sriov_configure(pdev, num_vfs);
458 if ((num_vfs_enabled >= 0) &&
459 (num_vfs_enabled != num_vfs)) {
460 dev_warn(&pdev->dev,
461 "Only %d VFs enabled\n",
462 num_vfs_enabled);
463 return count;
464 } else if (num_vfs_enabled < 0)
465 /* error code from driver callback */
466 return num_vfs_enabled;
467 } else if (num_vfs == pdev->sriov->num_VFs) {
468 dev_warn(&pdev->dev,
469 "%d VFs already enabled; no enable action taken\n",
470 num_vfs);
471 return count;
472 } else {
473 dev_warn(&pdev->dev,
474 "%d VFs already enabled. Disable before enabling %d VFs\n",
475 pdev->sriov->num_VFs, num_vfs);
476 return -EINVAL;
477 }
478 } 461 }
479 462
480 /* disable vfs */ 463 /* enable VFs */
481 if (num_vfs == 0) { 464 if (pdev->sriov->num_VFs) {
482 if (pdev->sriov->num_VFs != 0) { 465 dev_warn(&pdev->dev, "%d VFs already enabled. Disable before enabling %d VFs\n",
483 ret = pdev->driver->sriov_configure(pdev, 0); 466 pdev->sriov->num_VFs, num_vfs);
484 return ret ? ret : count; 467 return -EBUSY;
485 } else {
486 dev_warn(&pdev->dev,
487 "All VFs disabled; no disable action taken\n");
488 return count;
489 }
490 } 468 }
491 469
492 dev_err(&pdev->dev, 470 ret = pdev->driver->sriov_configure(pdev, num_vfs);
493 "Invalid value for number of VFs to enable: %d\n", num_vfs); 471 if (ret < 0)
472 return ret;
494 473
495 return -EINVAL; 474 if (ret != num_vfs)
475 dev_warn(&pdev->dev, "%d VFs requested; only %d enabled\n",
476 num_vfs, ret);
477
478 return count;
496} 479}
497 480
498static struct device_attribute sriov_totalvfs_attr = __ATTR_RO(sriov_totalvfs); 481static struct device_attribute sriov_totalvfs_attr = __ATTR_RO(sriov_totalvfs);
diff --git a/drivers/pci/pcie/Kconfig b/drivers/pci/pcie/Kconfig
index 6c8bc5809787..fde4a32a0295 100644
--- a/drivers/pci/pcie/Kconfig
+++ b/drivers/pci/pcie/Kconfig
@@ -82,4 +82,4 @@ endchoice
82 82
83config PCIE_PME 83config PCIE_PME
84 def_bool y 84 def_bool y
85 depends on PCIEPORTBUS && PM_RUNTIME && EXPERIMENTAL && ACPI 85 depends on PCIEPORTBUS && PM_RUNTIME && ACPI
diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c
index 421bbc5fee32..564d97f94b6c 100644
--- a/drivers/pci/pcie/aer/aerdrv_core.c
+++ b/drivers/pci/pcie/aer/aerdrv_core.c
@@ -630,6 +630,7 @@ static void aer_recover_work_func(struct work_struct *work)
630 continue; 630 continue;
631 } 631 }
632 do_recovery(pdev, entry.severity); 632 do_recovery(pdev, entry.severity);
633 pci_dev_put(pdev);
633 } 634 }
634} 635}
635#endif 636#endif
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index b52630b8eada..8474b6a4fc9b 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -771,6 +771,9 @@ void pcie_clear_aspm(struct pci_bus *bus)
771{ 771{
772 struct pci_dev *child; 772 struct pci_dev *child;
773 773
774 if (aspm_force)
775 return;
776
774 /* 777 /*
775 * Clear any ASPM setup that the firmware has carried out on this bus 778 * Clear any ASPM setup that the firmware has carried out on this bus
776 */ 779 */
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
index d4824cb78b49..08c243ab034e 100644
--- a/drivers/pci/pcie/portdrv_pci.c
+++ b/drivers/pci/pcie/portdrv_pci.c
@@ -134,10 +134,28 @@ static int pcie_port_runtime_resume(struct device *dev)
134 return 0; 134 return 0;
135} 135}
136 136
137static int pci_dev_pme_poll(struct pci_dev *pdev, void *data)
138{
139 bool *pme_poll = data;
140
141 if (pdev->pme_poll)
142 *pme_poll = true;
143 return 0;
144}
145
137static int pcie_port_runtime_idle(struct device *dev) 146static int pcie_port_runtime_idle(struct device *dev)
138{ 147{
148 struct pci_dev *pdev = to_pci_dev(dev);
149 bool pme_poll = false;
150
151 /*
152 * If any subordinate device needs pme poll, we should keep
153 * the port in D0, because we need port in D0 to poll it.
154 */
155 pci_walk_bus(pdev->subordinate, pci_dev_pme_poll, &pme_poll);
139 /* Delay for a short while to prevent too frequent suspend/resume */ 156 /* Delay for a short while to prevent too frequent suspend/resume */
140 pm_schedule_suspend(dev, 10); 157 if (!pme_poll)
158 pm_schedule_suspend(dev, 10);
141 return -EBUSY; 159 return -EBUSY;
142} 160}
143#else 161#else
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 8f7a6344e79e..0369fb6fc1da 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -2725,7 +2725,7 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev)
2725 if (PCI_FUNC(dev->devfn)) 2725 if (PCI_FUNC(dev->devfn))
2726 return; 2726 return;
2727 /* 2727 /*
2728 * RICOH 0xe823 SD/MMC card reader fails to recognize 2728 * RICOH 0xe822 and 0xe823 SD/MMC card readers fail to recognize
2729 * certain types of SD/MMC cards. Lowering the SD base 2729 * certain types of SD/MMC cards. Lowering the SD base
2730 * clock frequency from 200Mhz to 50Mhz fixes this issue. 2730 * clock frequency from 200Mhz to 50Mhz fixes this issue.
2731 * 2731 *
@@ -2736,7 +2736,8 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev)
2736 * 0xf9 - Key register for 0x150 2736 * 0xf9 - Key register for 0x150
2737 * 0xfc - key register for 0xe1 2737 * 0xfc - key register for 0xe1
2738 */ 2738 */
2739 if (dev->device == PCI_DEVICE_ID_RICOH_R5CE823) { 2739 if (dev->device == PCI_DEVICE_ID_RICOH_R5CE822 ||
2740 dev->device == PCI_DEVICE_ID_RICOH_R5CE823) {
2740 pci_write_config_byte(dev, 0xf9, 0xfc); 2741 pci_write_config_byte(dev, 0xf9, 0xfc);
2741 pci_write_config_byte(dev, 0x150, 0x10); 2742 pci_write_config_byte(dev, 0x150, 0x10);
2742 pci_write_config_byte(dev, 0xf9, 0x00); 2743 pci_write_config_byte(dev, 0xf9, 0x00);
@@ -2763,6 +2764,8 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev)
2763} 2764}
2764DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832); 2765DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832);
2765DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832); 2766DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832);
2767DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE822, ricoh_mmc_fixup_r5c832);
2768DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE822, ricoh_mmc_fixup_r5c832);
2766DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832); 2769DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832);
2767DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832); 2770DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832);
2768#endif /*CONFIG_MMC_RICOH_MMC*/ 2771#endif /*CONFIG_MMC_RICOH_MMC*/
diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
index c31aeb01bb00..efaecefe3f8c 100644
--- a/drivers/pinctrl/Kconfig
+++ b/drivers/pinctrl/Kconfig
@@ -181,7 +181,6 @@ config PINCTRL_COH901
181 181
182config PINCTRL_SAMSUNG 182config PINCTRL_SAMSUNG
183 bool 183 bool
184 depends on OF && GPIOLIB
185 select PINMUX 184 select PINMUX
186 select PINCONF 185 select PINCONF
187 186
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 5cdee8669ea3..59f5a965bdc4 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -700,7 +700,7 @@ static struct pinctrl *create_pinctrl(struct device *dev)
700 } 700 }
701 } 701 }
702 702
703 /* Add the pinmux to the global list */ 703 /* Add the pinctrl handle to the global list */
704 list_add_tail(&p->node, &pinctrl_list); 704 list_add_tail(&p->node, &pinctrl_list);
705 705
706 return p; 706 return p;
diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-370.c b/drivers/pinctrl/mvebu/pinctrl-armada-370.c
index c907647de6ad..48e21a229483 100644
--- a/drivers/pinctrl/mvebu/pinctrl-armada-370.c
+++ b/drivers/pinctrl/mvebu/pinctrl-armada-370.c
@@ -367,7 +367,7 @@ static struct mvebu_mpp_mode mv88f6710_mpp_modes[] = {
367 367
368static struct mvebu_pinctrl_soc_info armada_370_pinctrl_info; 368static struct mvebu_pinctrl_soc_info armada_370_pinctrl_info;
369 369
370static struct of_device_id armada_370_pinctrl_of_match[] __devinitdata = { 370static struct of_device_id armada_370_pinctrl_of_match[] = {
371 { .compatible = "marvell,mv88f6710-pinctrl" }, 371 { .compatible = "marvell,mv88f6710-pinctrl" },
372 { }, 372 { },
373}; 373};
@@ -382,7 +382,7 @@ static struct pinctrl_gpio_range mv88f6710_mpp_gpio_ranges[] = {
382 MPP_GPIO_RANGE(2, 64, 64, 2), 382 MPP_GPIO_RANGE(2, 64, 64, 2),
383}; 383};
384 384
385static int __devinit armada_370_pinctrl_probe(struct platform_device *pdev) 385static int armada_370_pinctrl_probe(struct platform_device *pdev)
386{ 386{
387 struct mvebu_pinctrl_soc_info *soc = &armada_370_pinctrl_info; 387 struct mvebu_pinctrl_soc_info *soc = &armada_370_pinctrl_info;
388 388
@@ -399,7 +399,7 @@ static int __devinit armada_370_pinctrl_probe(struct platform_device *pdev)
399 return mvebu_pinctrl_probe(pdev); 399 return mvebu_pinctrl_probe(pdev);
400} 400}
401 401
402static int __devexit armada_370_pinctrl_remove(struct platform_device *pdev) 402static int armada_370_pinctrl_remove(struct platform_device *pdev)
403{ 403{
404 return mvebu_pinctrl_remove(pdev); 404 return mvebu_pinctrl_remove(pdev);
405} 405}
@@ -411,7 +411,7 @@ static struct platform_driver armada_370_pinctrl_driver = {
411 .of_match_table = of_match_ptr(armada_370_pinctrl_of_match), 411 .of_match_table = of_match_ptr(armada_370_pinctrl_of_match),
412 }, 412 },
413 .probe = armada_370_pinctrl_probe, 413 .probe = armada_370_pinctrl_probe,
414 .remove = __devexit_p(armada_370_pinctrl_remove), 414 .remove = armada_370_pinctrl_remove,
415}; 415};
416 416
417module_platform_driver(armada_370_pinctrl_driver); 417module_platform_driver(armada_370_pinctrl_driver);
diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-xp.c b/drivers/pinctrl/mvebu/pinctrl-armada-xp.c
index 40bd52a46b4e..ab5dc04b3e8a 100644
--- a/drivers/pinctrl/mvebu/pinctrl-armada-xp.c
+++ b/drivers/pinctrl/mvebu/pinctrl-armada-xp.c
@@ -349,7 +349,7 @@ static struct mvebu_mpp_mode armada_xp_mpp_modes[] = {
349 349
350static struct mvebu_pinctrl_soc_info armada_xp_pinctrl_info; 350static struct mvebu_pinctrl_soc_info armada_xp_pinctrl_info;
351 351
352static struct of_device_id armada_xp_pinctrl_of_match[] __devinitdata = { 352static struct of_device_id armada_xp_pinctrl_of_match[] = {
353 { 353 {
354 .compatible = "marvell,mv78230-pinctrl", 354 .compatible = "marvell,mv78230-pinctrl",
355 .data = (void *) V_MV78230, 355 .data = (void *) V_MV78230,
@@ -394,7 +394,7 @@ static struct pinctrl_gpio_range mv78460_mpp_gpio_ranges[] = {
394 MPP_GPIO_RANGE(2, 64, 64, 3), 394 MPP_GPIO_RANGE(2, 64, 64, 3),
395}; 395};
396 396
397static int __devinit armada_xp_pinctrl_probe(struct platform_device *pdev) 397static int armada_xp_pinctrl_probe(struct platform_device *pdev)
398{ 398{
399 struct mvebu_pinctrl_soc_info *soc = &armada_xp_pinctrl_info; 399 struct mvebu_pinctrl_soc_info *soc = &armada_xp_pinctrl_info;
400 const struct of_device_id *match = 400 const struct of_device_id *match =
@@ -446,7 +446,7 @@ static int __devinit armada_xp_pinctrl_probe(struct platform_device *pdev)
446 return mvebu_pinctrl_probe(pdev); 446 return mvebu_pinctrl_probe(pdev);
447} 447}
448 448
449static int __devexit armada_xp_pinctrl_remove(struct platform_device *pdev) 449static int armada_xp_pinctrl_remove(struct platform_device *pdev)
450{ 450{
451 return mvebu_pinctrl_remove(pdev); 451 return mvebu_pinctrl_remove(pdev);
452} 452}
@@ -458,7 +458,7 @@ static struct platform_driver armada_xp_pinctrl_driver = {
458 .of_match_table = of_match_ptr(armada_xp_pinctrl_of_match), 458 .of_match_table = of_match_ptr(armada_xp_pinctrl_of_match),
459 }, 459 },
460 .probe = armada_xp_pinctrl_probe, 460 .probe = armada_xp_pinctrl_probe,
461 .remove = __devexit_p(armada_xp_pinctrl_remove), 461 .remove = armada_xp_pinctrl_remove,
462}; 462};
463 463
464module_platform_driver(armada_xp_pinctrl_driver); 464module_platform_driver(armada_xp_pinctrl_driver);
diff --git a/drivers/pinctrl/mvebu/pinctrl-dove.c b/drivers/pinctrl/mvebu/pinctrl-dove.c
index 40c9c3eecd94..428ea96a94d3 100644
--- a/drivers/pinctrl/mvebu/pinctrl-dove.c
+++ b/drivers/pinctrl/mvebu/pinctrl-dove.c
@@ -579,29 +579,32 @@ static struct mvebu_pinctrl_soc_info dove_pinctrl_info = {
579 579
580static struct clk *clk; 580static struct clk *clk;
581 581
582static struct of_device_id dove_pinctrl_of_match[] __devinitdata = { 582static struct of_device_id dove_pinctrl_of_match[] = {
583 { .compatible = "marvell,dove-pinctrl", .data = &dove_pinctrl_info }, 583 { .compatible = "marvell,dove-pinctrl", .data = &dove_pinctrl_info },
584 { } 584 { }
585}; 585};
586 586
587static int __devinit dove_pinctrl_probe(struct platform_device *pdev) 587static int dove_pinctrl_probe(struct platform_device *pdev)
588{ 588{
589 const struct of_device_id *match = 589 const struct of_device_id *match =
590 of_match_device(dove_pinctrl_of_match, &pdev->dev); 590 of_match_device(dove_pinctrl_of_match, &pdev->dev);
591 pdev->dev.platform_data = match->data; 591 pdev->dev.platform_data = (void *)match->data;
592 592
593 /* 593 /*
594 * General MPP Configuration Register is part of pdma registers. 594 * General MPP Configuration Register is part of pdma registers.
595 * grab clk to make sure it is ticking. 595 * grab clk to make sure it is ticking.
596 */ 596 */
597 clk = devm_clk_get(&pdev->dev, NULL); 597 clk = devm_clk_get(&pdev->dev, NULL);
598 if (!IS_ERR(clk)) 598 if (IS_ERR(clk)) {
599 clk_prepare_enable(clk); 599 dev_err(&pdev->dev, "Unable to get pdma clock");
600 return PTR_RET(clk);
601 }
602 clk_prepare_enable(clk);
600 603
601 return mvebu_pinctrl_probe(pdev); 604 return mvebu_pinctrl_probe(pdev);
602} 605}
603 606
604static int __devexit dove_pinctrl_remove(struct platform_device *pdev) 607static int dove_pinctrl_remove(struct platform_device *pdev)
605{ 608{
606 int ret; 609 int ret;
607 610
@@ -618,7 +621,7 @@ static struct platform_driver dove_pinctrl_driver = {
618 .of_match_table = of_match_ptr(dove_pinctrl_of_match), 621 .of_match_table = of_match_ptr(dove_pinctrl_of_match),
619 }, 622 },
620 .probe = dove_pinctrl_probe, 623 .probe = dove_pinctrl_probe,
621 .remove = __devexit_p(dove_pinctrl_remove), 624 .remove = dove_pinctrl_remove,
622}; 625};
623 626
624module_platform_driver(dove_pinctrl_driver); 627module_platform_driver(dove_pinctrl_driver);
diff --git a/drivers/pinctrl/mvebu/pinctrl-kirkwood.c b/drivers/pinctrl/mvebu/pinctrl-kirkwood.c
index fa6ce31c94d9..cdd483df673e 100644
--- a/drivers/pinctrl/mvebu/pinctrl-kirkwood.c
+++ b/drivers/pinctrl/mvebu/pinctrl-kirkwood.c
@@ -66,9 +66,9 @@ static struct mvebu_mpp_mode mv88f6xxx_mpp_modes[] = {
66 MPP_VAR_FUNCTION(0x5, "sata0", "act", V(0, 1, 1, 1, 1, 0)), 66 MPP_VAR_FUNCTION(0x5, "sata0", "act", V(0, 1, 1, 1, 1, 0)),
67 MPP_VAR_FUNCTION(0xb, "lcd", "vsync", V(0, 0, 0, 0, 1, 0))), 67 MPP_VAR_FUNCTION(0xb, "lcd", "vsync", V(0, 0, 0, 0, 1, 0))),
68 MPP_MODE(6, 68 MPP_MODE(6,
69 MPP_VAR_FUNCTION(0x0, "sysrst", "out", V(1, 1, 1, 1, 1, 1)), 69 MPP_VAR_FUNCTION(0x1, "sysrst", "out", V(1, 1, 1, 1, 1, 1)),
70 MPP_VAR_FUNCTION(0x1, "spi", "mosi", V(1, 1, 1, 1, 1, 1)), 70 MPP_VAR_FUNCTION(0x2, "spi", "mosi", V(1, 1, 1, 1, 1, 1)),
71 MPP_VAR_FUNCTION(0x2, "ptp", "trig", V(1, 1, 1, 1, 0, 0))), 71 MPP_VAR_FUNCTION(0x3, "ptp", "trig", V(1, 1, 1, 1, 0, 0))),
72 MPP_MODE(7, 72 MPP_MODE(7,
73 MPP_VAR_FUNCTION(0x0, "gpo", NULL, V(1, 1, 1, 1, 1, 1)), 73 MPP_VAR_FUNCTION(0x0, "gpo", NULL, V(1, 1, 1, 1, 1, 1)),
74 MPP_VAR_FUNCTION(0x1, "pex", "rsto", V(1, 1, 1, 1, 0, 1)), 74 MPP_VAR_FUNCTION(0x1, "pex", "rsto", V(1, 1, 1, 1, 0, 1)),
@@ -444,7 +444,7 @@ static struct mvebu_pinctrl_soc_info mv98dx4122_info = {
444 .ngpioranges = ARRAY_SIZE(mv88f628x_gpio_ranges), 444 .ngpioranges = ARRAY_SIZE(mv88f628x_gpio_ranges),
445}; 445};
446 446
447static struct of_device_id kirkwood_pinctrl_of_match[] __devinitdata = { 447static struct of_device_id kirkwood_pinctrl_of_match[] = {
448 { .compatible = "marvell,88f6180-pinctrl", .data = &mv88f6180_info }, 448 { .compatible = "marvell,88f6180-pinctrl", .data = &mv88f6180_info },
449 { .compatible = "marvell,88f6190-pinctrl", .data = &mv88f6190_info }, 449 { .compatible = "marvell,88f6190-pinctrl", .data = &mv88f6190_info },
450 { .compatible = "marvell,88f6192-pinctrl", .data = &mv88f6192_info }, 450 { .compatible = "marvell,88f6192-pinctrl", .data = &mv88f6192_info },
@@ -454,15 +454,15 @@ static struct of_device_id kirkwood_pinctrl_of_match[] __devinitdata = {
454 { } 454 { }
455}; 455};
456 456
457static int __devinit kirkwood_pinctrl_probe(struct platform_device *pdev) 457static int kirkwood_pinctrl_probe(struct platform_device *pdev)
458{ 458{
459 const struct of_device_id *match = 459 const struct of_device_id *match =
460 of_match_device(kirkwood_pinctrl_of_match, &pdev->dev); 460 of_match_device(kirkwood_pinctrl_of_match, &pdev->dev);
461 pdev->dev.platform_data = match->data; 461 pdev->dev.platform_data = (void *)match->data;
462 return mvebu_pinctrl_probe(pdev); 462 return mvebu_pinctrl_probe(pdev);
463} 463}
464 464
465static int __devexit kirkwood_pinctrl_remove(struct platform_device *pdev) 465static int kirkwood_pinctrl_remove(struct platform_device *pdev)
466{ 466{
467 return mvebu_pinctrl_remove(pdev); 467 return mvebu_pinctrl_remove(pdev);
468} 468}
@@ -474,7 +474,7 @@ static struct platform_driver kirkwood_pinctrl_driver = {
474 .of_match_table = of_match_ptr(kirkwood_pinctrl_of_match), 474 .of_match_table = of_match_ptr(kirkwood_pinctrl_of_match),
475 }, 475 },
476 .probe = kirkwood_pinctrl_probe, 476 .probe = kirkwood_pinctrl_probe,
477 .remove = __devexit_p(kirkwood_pinctrl_remove), 477 .remove = kirkwood_pinctrl_remove,
478}; 478};
479 479
480module_platform_driver(kirkwood_pinctrl_driver); 480module_platform_driver(kirkwood_pinctrl_driver);
diff --git a/drivers/pinctrl/mvebu/pinctrl-mvebu.c b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
index 6c44b7e8964c..c689c04a4f52 100644
--- a/drivers/pinctrl/mvebu/pinctrl-mvebu.c
+++ b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
@@ -478,8 +478,7 @@ static struct pinctrl_ops mvebu_pinctrl_ops = {
478 .dt_free_map = mvebu_pinctrl_dt_free_map, 478 .dt_free_map = mvebu_pinctrl_dt_free_map,
479}; 479};
480 480
481static int __devinit _add_function(struct mvebu_pinctrl_function *funcs, 481static int _add_function(struct mvebu_pinctrl_function *funcs, const char *name)
482 const char *name)
483{ 482{
484 while (funcs->num_groups) { 483 while (funcs->num_groups) {
485 /* function already there */ 484 /* function already there */
@@ -494,8 +493,8 @@ static int __devinit _add_function(struct mvebu_pinctrl_function *funcs,
494 return 0; 493 return 0;
495} 494}
496 495
497static int __devinit mvebu_pinctrl_build_functions(struct platform_device *pdev, 496static int mvebu_pinctrl_build_functions(struct platform_device *pdev,
498 struct mvebu_pinctrl *pctl) 497 struct mvebu_pinctrl *pctl)
499{ 498{
500 struct mvebu_pinctrl_function *funcs; 499 struct mvebu_pinctrl_function *funcs;
501 int num = 0; 500 int num = 0;
@@ -568,7 +567,7 @@ static int __devinit mvebu_pinctrl_build_functions(struct platform_device *pdev,
568 return 0; 567 return 0;
569} 568}
570 569
571int __devinit mvebu_pinctrl_probe(struct platform_device *pdev) 570int mvebu_pinctrl_probe(struct platform_device *pdev)
572{ 571{
573 struct mvebu_pinctrl_soc_info *soc = dev_get_platdata(&pdev->dev); 572 struct mvebu_pinctrl_soc_info *soc = dev_get_platdata(&pdev->dev);
574 struct device_node *np = pdev->dev.of_node; 573 struct device_node *np = pdev->dev.of_node;
@@ -745,7 +744,7 @@ int __devinit mvebu_pinctrl_probe(struct platform_device *pdev)
745 return 0; 744 return 0;
746} 745}
747 746
748int __devexit mvebu_pinctrl_remove(struct platform_device *pdev) 747int mvebu_pinctrl_remove(struct platform_device *pdev)
749{ 748{
750 struct mvebu_pinctrl *pctl = platform_get_drvdata(pdev); 749 struct mvebu_pinctrl *pctl = platform_get_drvdata(pdev);
751 pinctrl_unregister(pctl->pctldev); 750 pinctrl_unregister(pctl->pctldev);
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index c5e757157183..471c71f7f8b6 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -265,7 +265,7 @@ static int at91_dt_node_to_map(struct pinctrl_dev *pctldev,
265 /* create mux map */ 265 /* create mux map */
266 parent = of_get_parent(np); 266 parent = of_get_parent(np);
267 if (!parent) { 267 if (!parent) {
268 kfree(new_map); 268 devm_kfree(pctldev->dev, new_map);
269 return -EINVAL; 269 return -EINVAL;
270 } 270 }
271 new_map[0].type = PIN_MAP_TYPE_MUX_GROUP; 271 new_map[0].type = PIN_MAP_TYPE_MUX_GROUP;
@@ -792,8 +792,8 @@ static struct pinctrl_desc at91_pinctrl_desc = {
792 792
793static const char *gpio_compat = "atmel,at91rm9200-gpio"; 793static const char *gpio_compat = "atmel,at91rm9200-gpio";
794 794
795static void __devinit at91_pinctrl_child_count(struct at91_pinctrl *info, 795static void at91_pinctrl_child_count(struct at91_pinctrl *info,
796 struct device_node *np) 796 struct device_node *np)
797{ 797{
798 struct device_node *child; 798 struct device_node *child;
799 799
@@ -807,8 +807,8 @@ static void __devinit at91_pinctrl_child_count(struct at91_pinctrl *info,
807 } 807 }
808} 808}
809 809
810static int __devinit at91_pinctrl_mux_mask(struct at91_pinctrl *info, 810static int at91_pinctrl_mux_mask(struct at91_pinctrl *info,
811 struct device_node *np) 811 struct device_node *np)
812{ 812{
813 int ret = 0; 813 int ret = 0;
814 int size; 814 int size;
@@ -840,10 +840,9 @@ static int __devinit at91_pinctrl_mux_mask(struct at91_pinctrl *info,
840 return ret; 840 return ret;
841} 841}
842 842
843static int __devinit at91_pinctrl_parse_groups(struct device_node *np, 843static int at91_pinctrl_parse_groups(struct device_node *np,
844 struct at91_pin_group *grp, 844 struct at91_pin_group *grp,
845 struct at91_pinctrl *info, 845 struct at91_pinctrl *info, u32 index)
846 u32 index)
847{ 846{
848 struct at91_pmx_pin *pin; 847 struct at91_pmx_pin *pin;
849 int size; 848 int size;
@@ -889,8 +888,8 @@ static int __devinit at91_pinctrl_parse_groups(struct device_node *np,
889 return 0; 888 return 0;
890} 889}
891 890
892static int __devinit at91_pinctrl_parse_functions(struct device_node *np, 891static int at91_pinctrl_parse_functions(struct device_node *np,
893 struct at91_pinctrl *info, u32 index) 892 struct at91_pinctrl *info, u32 index)
894{ 893{
895 struct device_node *child; 894 struct device_node *child;
896 struct at91_pmx_func *func; 895 struct at91_pmx_func *func;
@@ -926,14 +925,14 @@ static int __devinit at91_pinctrl_parse_functions(struct device_node *np,
926 return 0; 925 return 0;
927} 926}
928 927
929static struct of_device_id at91_pinctrl_of_match[] __devinitdata = { 928static struct of_device_id at91_pinctrl_of_match[] = {
930 { .compatible = "atmel,at91sam9x5-pinctrl", .data = &at91sam9x5_ops }, 929 { .compatible = "atmel,at91sam9x5-pinctrl", .data = &at91sam9x5_ops },
931 { .compatible = "atmel,at91rm9200-pinctrl", .data = &at91rm9200_ops }, 930 { .compatible = "atmel,at91rm9200-pinctrl", .data = &at91rm9200_ops },
932 { /* sentinel */ } 931 { /* sentinel */ }
933}; 932};
934 933
935static int __devinit at91_pinctrl_probe_dt(struct platform_device *pdev, 934static int at91_pinctrl_probe_dt(struct platform_device *pdev,
936 struct at91_pinctrl *info) 935 struct at91_pinctrl *info)
937{ 936{
938 int ret = 0; 937 int ret = 0;
939 int i, j; 938 int i, j;
@@ -999,7 +998,7 @@ static int __devinit at91_pinctrl_probe_dt(struct platform_device *pdev,
999 return 0; 998 return 0;
1000} 999}
1001 1000
1002static int __devinit at91_pinctrl_probe(struct platform_device *pdev) 1001static int at91_pinctrl_probe(struct platform_device *pdev)
1003{ 1002{
1004 struct at91_pinctrl *info; 1003 struct at91_pinctrl *info;
1005 struct pinctrl_pin_desc *pdesc; 1004 struct pinctrl_pin_desc *pdesc;
@@ -1063,7 +1062,7 @@ err:
1063 return ret; 1062 return ret;
1064} 1063}
1065 1064
1066static int __devexit at91_pinctrl_remove(struct platform_device *pdev) 1065static int at91_pinctrl_remove(struct platform_device *pdev)
1067{ 1066{
1068 struct at91_pinctrl *info = platform_get_drvdata(pdev); 1067 struct at91_pinctrl *info = platform_get_drvdata(pdev);
1069 1068
@@ -1443,7 +1442,7 @@ static struct gpio_chip at91_gpio_template = {
1443 .ngpio = MAX_NB_GPIO_PER_BANK, 1442 .ngpio = MAX_NB_GPIO_PER_BANK,
1444}; 1443};
1445 1444
1446static void __devinit at91_gpio_probe_fixup(void) 1445static void at91_gpio_probe_fixup(void)
1447{ 1446{
1448 unsigned i; 1447 unsigned i;
1449 struct at91_gpio_chip *at91_gpio, *last = NULL; 1448 struct at91_gpio_chip *at91_gpio, *last = NULL;
@@ -1461,13 +1460,13 @@ static void __devinit at91_gpio_probe_fixup(void)
1461 } 1460 }
1462} 1461}
1463 1462
1464static struct of_device_id at91_gpio_of_match[] __devinitdata = { 1463static struct of_device_id at91_gpio_of_match[] = {
1465 { .compatible = "atmel,at91sam9x5-gpio", .data = &at91sam9x5_ops, }, 1464 { .compatible = "atmel,at91sam9x5-gpio", .data = &at91sam9x5_ops, },
1466 { .compatible = "atmel,at91rm9200-gpio", .data = &at91rm9200_ops }, 1465 { .compatible = "atmel,at91rm9200-gpio", .data = &at91rm9200_ops },
1467 { /* sentinel */ } 1466 { /* sentinel */ }
1468}; 1467};
1469 1468
1470static int __devinit at91_gpio_probe(struct platform_device *pdev) 1469static int at91_gpio_probe(struct platform_device *pdev)
1471{ 1470{
1472 struct device_node *np = pdev->dev.of_node; 1471 struct device_node *np = pdev->dev.of_node;
1473 struct resource *res; 1472 struct resource *res;
@@ -1609,7 +1608,7 @@ static struct platform_driver at91_pinctrl_driver = {
1609 .of_match_table = of_match_ptr(at91_pinctrl_of_match), 1608 .of_match_table = of_match_ptr(at91_pinctrl_of_match),
1610 }, 1609 },
1611 .probe = at91_pinctrl_probe, 1610 .probe = at91_pinctrl_probe,
1612 .remove = __devexit_p(at91_pinctrl_remove), 1611 .remove = at91_pinctrl_remove,
1613}; 1612};
1614 1613
1615static int __init at91_pinctrl_init(void) 1614static int __init at91_pinctrl_init(void)
diff --git a/drivers/pinctrl/pinctrl-bcm2835.c b/drivers/pinctrl/pinctrl-bcm2835.c
index 0b0e9b49a1b5..d347b9f2eae3 100644
--- a/drivers/pinctrl/pinctrl-bcm2835.c
+++ b/drivers/pinctrl/pinctrl-bcm2835.c
@@ -936,7 +936,7 @@ static struct pinctrl_gpio_range bcm2835_pinctrl_gpio_range = {
936 .npins = BCM2835_NUM_GPIOS, 936 .npins = BCM2835_NUM_GPIOS,
937}; 937};
938 938
939static int __devinit bcm2835_pinctrl_probe(struct platform_device *pdev) 939static int bcm2835_pinctrl_probe(struct platform_device *pdev)
940{ 940{
941 struct device *dev = &pdev->dev; 941 struct device *dev = &pdev->dev;
942 struct device_node *np = dev->of_node; 942 struct device_node *np = dev->of_node;
diff --git a/drivers/pinctrl/pinctrl-exynos5440.c b/drivers/pinctrl/pinctrl-exynos5440.c
index 07db89528dc3..142729914c34 100644
--- a/drivers/pinctrl/pinctrl-exynos5440.c
+++ b/drivers/pinctrl/pinctrl-exynos5440.c
@@ -599,7 +599,7 @@ static int exynos5440_gpio_direction_output(struct gpio_chip *gc, unsigned offse
599} 599}
600 600
601/* parse the pin numbers listed in the 'samsung,exynos5440-pins' property */ 601/* parse the pin numbers listed in the 'samsung,exynos5440-pins' property */
602static int __init exynos5440_pinctrl_parse_dt_pins(struct platform_device *pdev, 602static int exynos5440_pinctrl_parse_dt_pins(struct platform_device *pdev,
603 struct device_node *cfg_np, unsigned int **pin_list, 603 struct device_node *cfg_np, unsigned int **pin_list,
604 unsigned int *npins) 604 unsigned int *npins)
605{ 605{
@@ -630,7 +630,7 @@ static int __init exynos5440_pinctrl_parse_dt_pins(struct platform_device *pdev,
630 * Parse the information about all the available pin groups and pin functions 630 * Parse the information about all the available pin groups and pin functions
631 * from device node of the pin-controller. 631 * from device node of the pin-controller.
632 */ 632 */
633static int __init exynos5440_pinctrl_parse_dt(struct platform_device *pdev, 633static int exynos5440_pinctrl_parse_dt(struct platform_device *pdev,
634 struct exynos5440_pinctrl_priv_data *priv) 634 struct exynos5440_pinctrl_priv_data *priv)
635{ 635{
636 struct device *dev = &pdev->dev; 636 struct device *dev = &pdev->dev;
@@ -723,7 +723,7 @@ static int __init exynos5440_pinctrl_parse_dt(struct platform_device *pdev,
723} 723}
724 724
725/* register the pinctrl interface with the pinctrl subsystem */ 725/* register the pinctrl interface with the pinctrl subsystem */
726static int __init exynos5440_pinctrl_register(struct platform_device *pdev, 726static int exynos5440_pinctrl_register(struct platform_device *pdev,
727 struct exynos5440_pinctrl_priv_data *priv) 727 struct exynos5440_pinctrl_priv_data *priv)
728{ 728{
729 struct device *dev = &pdev->dev; 729 struct device *dev = &pdev->dev;
@@ -798,7 +798,7 @@ static int __init exynos5440_pinctrl_register(struct platform_device *pdev,
798} 798}
799 799
800/* register the gpiolib interface with the gpiolib subsystem */ 800/* register the gpiolib interface with the gpiolib subsystem */
801static int __init exynos5440_gpiolib_register(struct platform_device *pdev, 801static int exynos5440_gpiolib_register(struct platform_device *pdev,
802 struct exynos5440_pinctrl_priv_data *priv) 802 struct exynos5440_pinctrl_priv_data *priv)
803{ 803{
804 struct gpio_chip *gc; 804 struct gpio_chip *gc;
@@ -831,7 +831,7 @@ static int __init exynos5440_gpiolib_register(struct platform_device *pdev,
831} 831}
832 832
833/* unregister the gpiolib interface with the gpiolib subsystem */ 833/* unregister the gpiolib interface with the gpiolib subsystem */
834static int __init exynos5440_gpiolib_unregister(struct platform_device *pdev, 834static int exynos5440_gpiolib_unregister(struct platform_device *pdev,
835 struct exynos5440_pinctrl_priv_data *priv) 835 struct exynos5440_pinctrl_priv_data *priv)
836{ 836{
837 int ret = gpiochip_remove(priv->gc); 837 int ret = gpiochip_remove(priv->gc);
@@ -842,7 +842,7 @@ static int __init exynos5440_gpiolib_unregister(struct platform_device *pdev,
842 return 0; 842 return 0;
843} 843}
844 844
845static int __devinit exynos5440_pinctrl_probe(struct platform_device *pdev) 845static int exynos5440_pinctrl_probe(struct platform_device *pdev)
846{ 846{
847 struct device *dev = &pdev->dev; 847 struct device *dev = &pdev->dev;
848 struct exynos5440_pinctrl_priv_data *priv; 848 struct exynos5440_pinctrl_priv_data *priv;
diff --git a/drivers/pinctrl/pinctrl-imx.c b/drivers/pinctrl/pinctrl-imx.c
index 131d86d7c2a5..43a6f1ffc786 100644
--- a/drivers/pinctrl/pinctrl-imx.c
+++ b/drivers/pinctrl/pinctrl-imx.c
@@ -425,10 +425,10 @@ static int imx_pinctrl_get_pin_id_and_mux(const struct imx_pinctrl_soc_info *inf
425 return 0; 425 return 0;
426} 426}
427 427
428static int __devinit imx_pinctrl_parse_groups(struct device_node *np, 428static int imx_pinctrl_parse_groups(struct device_node *np,
429 struct imx_pin_group *grp, 429 struct imx_pin_group *grp,
430 struct imx_pinctrl_soc_info *info, 430 struct imx_pinctrl_soc_info *info,
431 u32 index) 431 u32 index)
432{ 432{
433 unsigned int pin_func_id; 433 unsigned int pin_func_id;
434 int ret, size; 434 int ret, size;
@@ -482,8 +482,9 @@ static int __devinit imx_pinctrl_parse_groups(struct device_node *np,
482 return 0; 482 return 0;
483} 483}
484 484
485static int __devinit imx_pinctrl_parse_functions(struct device_node *np, 485static int imx_pinctrl_parse_functions(struct device_node *np,
486 struct imx_pinctrl_soc_info *info, u32 index) 486 struct imx_pinctrl_soc_info *info,
487 u32 index)
487{ 488{
488 struct device_node *child; 489 struct device_node *child;
489 struct imx_pmx_func *func; 490 struct imx_pmx_func *func;
@@ -517,7 +518,7 @@ static int __devinit imx_pinctrl_parse_functions(struct device_node *np,
517 return 0; 518 return 0;
518} 519}
519 520
520static int __devinit imx_pinctrl_probe_dt(struct platform_device *pdev, 521static int imx_pinctrl_probe_dt(struct platform_device *pdev,
521 struct imx_pinctrl_soc_info *info) 522 struct imx_pinctrl_soc_info *info)
522{ 523{
523 struct device_node *np = pdev->dev.of_node; 524 struct device_node *np = pdev->dev.of_node;
@@ -560,8 +561,8 @@ static int __devinit imx_pinctrl_probe_dt(struct platform_device *pdev,
560 return 0; 561 return 0;
561} 562}
562 563
563int __devinit imx_pinctrl_probe(struct platform_device *pdev, 564int imx_pinctrl_probe(struct platform_device *pdev,
564 struct imx_pinctrl_soc_info *info) 565 struct imx_pinctrl_soc_info *info)
565{ 566{
566 struct imx_pinctrl *ipctl; 567 struct imx_pinctrl *ipctl;
567 struct resource *res; 568 struct resource *res;
diff --git a/drivers/pinctrl/pinctrl-imx23.c b/drivers/pinctrl/pinctrl-imx23.c
index 04364f7822b7..e76d75c9d1ba 100644
--- a/drivers/pinctrl/pinctrl-imx23.c
+++ b/drivers/pinctrl/pinctrl-imx23.c
@@ -267,7 +267,7 @@ static struct mxs_pinctrl_soc_data imx23_pinctrl_data = {
267 .npins = ARRAY_SIZE(imx23_pins), 267 .npins = ARRAY_SIZE(imx23_pins),
268}; 268};
269 269
270static int __devinit imx23_pinctrl_probe(struct platform_device *pdev) 270static int imx23_pinctrl_probe(struct platform_device *pdev)
271{ 271{
272 return mxs_pinctrl_probe(pdev, &imx23_pinctrl_data); 272 return mxs_pinctrl_probe(pdev, &imx23_pinctrl_data);
273} 273}
diff --git a/drivers/pinctrl/pinctrl-imx28.c b/drivers/pinctrl/pinctrl-imx28.c
index e1af2ba89004..79c9c8d296af 100644
--- a/drivers/pinctrl/pinctrl-imx28.c
+++ b/drivers/pinctrl/pinctrl-imx28.c
@@ -383,7 +383,7 @@ static struct mxs_pinctrl_soc_data imx28_pinctrl_data = {
383 .npins = ARRAY_SIZE(imx28_pins), 383 .npins = ARRAY_SIZE(imx28_pins),
384}; 384};
385 385
386static int __devinit imx28_pinctrl_probe(struct platform_device *pdev) 386static int imx28_pinctrl_probe(struct platform_device *pdev)
387{ 387{
388 return mxs_pinctrl_probe(pdev, &imx28_pinctrl_data); 388 return mxs_pinctrl_probe(pdev, &imx28_pinctrl_data);
389} 389}
diff --git a/drivers/pinctrl/pinctrl-imx35.c b/drivers/pinctrl/pinctrl-imx35.c
index 1dbf5278acec..6e214110e3d5 100644
--- a/drivers/pinctrl/pinctrl-imx35.c
+++ b/drivers/pinctrl/pinctrl-imx35.c
@@ -1564,7 +1564,7 @@ static struct of_device_id imx35_pinctrl_of_match[] = {
1564 { /* sentinel */ } 1564 { /* sentinel */ }
1565}; 1565};
1566 1566
1567static int __devinit imx35_pinctrl_probe(struct platform_device *pdev) 1567static int imx35_pinctrl_probe(struct platform_device *pdev)
1568{ 1568{
1569 return imx_pinctrl_probe(pdev, &imx35_pinctrl_info); 1569 return imx_pinctrl_probe(pdev, &imx35_pinctrl_info);
1570} 1570}
diff --git a/drivers/pinctrl/pinctrl-imx51.c b/drivers/pinctrl/pinctrl-imx51.c
index 131216558a7b..9a92aaad150f 100644
--- a/drivers/pinctrl/pinctrl-imx51.c
+++ b/drivers/pinctrl/pinctrl-imx51.c
@@ -1291,7 +1291,7 @@ static struct of_device_id imx51_pinctrl_of_match[] = {
1291 { /* sentinel */ } 1291 { /* sentinel */ }
1292}; 1292};
1293 1293
1294static int __devinit imx51_pinctrl_probe(struct platform_device *pdev) 1294static int imx51_pinctrl_probe(struct platform_device *pdev)
1295{ 1295{
1296 return imx_pinctrl_probe(pdev, &imx51_pinctrl_info); 1296 return imx_pinctrl_probe(pdev, &imx51_pinctrl_info);
1297} 1297}
diff --git a/drivers/pinctrl/pinctrl-imx53.c b/drivers/pinctrl/pinctrl-imx53.c
index ec4048691775..2c9c8e2334da 100644
--- a/drivers/pinctrl/pinctrl-imx53.c
+++ b/drivers/pinctrl/pinctrl-imx53.c
@@ -1371,7 +1371,7 @@ static struct imx_pin_reg imx53_pin_regs[] = {
1371 IMX_PIN_REG(MX53_PAD_GPIO_8, 0x6C8, 0x338, 0, 0x7F8, 1), /* MX53_PAD_GPIO_8__ESAI1_TX5_RX0 */ 1371 IMX_PIN_REG(MX53_PAD_GPIO_8, 0x6C8, 0x338, 0, 0x7F8, 1), /* MX53_PAD_GPIO_8__ESAI1_TX5_RX0 */
1372 IMX_PIN_REG(MX53_PAD_GPIO_8, 0x6C8, 0x338, 1, 0x000, 0), /* MX53_PAD_GPIO_8__GPIO1_8 */ 1372 IMX_PIN_REG(MX53_PAD_GPIO_8, 0x6C8, 0x338, 1, 0x000, 0), /* MX53_PAD_GPIO_8__GPIO1_8 */
1373 IMX_PIN_REG(MX53_PAD_GPIO_8, 0x6C8, 0x338, 2, 0x000, 0), /* MX53_PAD_GPIO_8__EPIT2_EPITO */ 1373 IMX_PIN_REG(MX53_PAD_GPIO_8, 0x6C8, 0x338, 2, 0x000, 0), /* MX53_PAD_GPIO_8__EPIT2_EPITO */
1374 IMX_PIN_REG(MX53_PAD_GPIO_8, 0x6C8, 0x338, 3, 0x760, 3), /* MX53_PAD_GPIO_8__CAN1_RXCAN */ 1374 IMX_PIN_REG(MX53_PAD_GPIO_8, 0x6C8, 0x338, 3, 0x760, 2), /* MX53_PAD_GPIO_8__CAN1_RXCAN */
1375 IMX_PIN_REG(MX53_PAD_GPIO_8, 0x6C8, 0x338, 4, 0x880, 5), /* MX53_PAD_GPIO_8__UART2_RXD_MUX */ 1375 IMX_PIN_REG(MX53_PAD_GPIO_8, 0x6C8, 0x338, 4, 0x880, 5), /* MX53_PAD_GPIO_8__UART2_RXD_MUX */
1376 IMX_PIN_REG(MX53_PAD_GPIO_8, 0x6C8, 0x338, 5, 0x000, 0), /* MX53_PAD_GPIO_8__FIRI_TXD */ 1376 IMX_PIN_REG(MX53_PAD_GPIO_8, 0x6C8, 0x338, 5, 0x000, 0), /* MX53_PAD_GPIO_8__FIRI_TXD */
1377 IMX_PIN_REG(MX53_PAD_GPIO_8, 0x6C8, 0x338, 6, 0x000, 0), /* MX53_PAD_GPIO_8__SPDIF_SRCLK */ 1377 IMX_PIN_REG(MX53_PAD_GPIO_8, 0x6C8, 0x338, 6, 0x000, 0), /* MX53_PAD_GPIO_8__SPDIF_SRCLK */
@@ -1618,7 +1618,7 @@ static struct of_device_id imx53_pinctrl_of_match[] = {
1618 { /* sentinel */ } 1618 { /* sentinel */ }
1619}; 1619};
1620 1620
1621static int __devinit imx53_pinctrl_probe(struct platform_device *pdev) 1621static int imx53_pinctrl_probe(struct platform_device *pdev)
1622{ 1622{
1623 return imx_pinctrl_probe(pdev, &imx53_pinctrl_info); 1623 return imx_pinctrl_probe(pdev, &imx53_pinctrl_info);
1624} 1624}
diff --git a/drivers/pinctrl/pinctrl-imx6q.c b/drivers/pinctrl/pinctrl-imx6q.c
index 844ab13c93a3..663346bb765e 100644
--- a/drivers/pinctrl/pinctrl-imx6q.c
+++ b/drivers/pinctrl/pinctrl-imx6q.c
@@ -2302,7 +2302,7 @@ static struct of_device_id imx6q_pinctrl_of_match[] = {
2302 { /* sentinel */ } 2302 { /* sentinel */ }
2303}; 2303};
2304 2304
2305static int __devinit imx6q_pinctrl_probe(struct platform_device *pdev) 2305static int imx6q_pinctrl_probe(struct platform_device *pdev)
2306{ 2306{
2307 return imx_pinctrl_probe(pdev, &imx6q_pinctrl_info); 2307 return imx_pinctrl_probe(pdev, &imx6q_pinctrl_info);
2308} 2308}
diff --git a/drivers/pinctrl/pinctrl-mmp2.c b/drivers/pinctrl/pinctrl-mmp2.c
index 4fbb3db3f1c1..4afa56a3a51d 100644
--- a/drivers/pinctrl/pinctrl-mmp2.c
+++ b/drivers/pinctrl/pinctrl-mmp2.c
@@ -686,7 +686,7 @@ static struct pxa3xx_pinmux_info mmp2_info = {
686 .ds_shift = MMP2_DS_SHIFT, 686 .ds_shift = MMP2_DS_SHIFT,
687}; 687};
688 688
689static int __devinit mmp2_pinmux_probe(struct platform_device *pdev) 689static int mmp2_pinmux_probe(struct platform_device *pdev)
690{ 690{
691 return pxa3xx_pinctrl_register(pdev, &mmp2_info); 691 return pxa3xx_pinctrl_register(pdev, &mmp2_info);
692} 692}
diff --git a/drivers/pinctrl/pinctrl-mxs.c b/drivers/pinctrl/pinctrl-mxs.c
index 180f16379ec1..23af9f1f9c35 100644
--- a/drivers/pinctrl/pinctrl-mxs.c
+++ b/drivers/pinctrl/pinctrl-mxs.c
@@ -146,7 +146,7 @@ free:
146static void mxs_dt_free_map(struct pinctrl_dev *pctldev, 146static void mxs_dt_free_map(struct pinctrl_dev *pctldev,
147 struct pinctrl_map *map, unsigned num_maps) 147 struct pinctrl_map *map, unsigned num_maps)
148{ 148{
149 int i; 149 u32 i;
150 150
151 for (i = 0; i < num_maps; i++) { 151 for (i = 0; i < num_maps; i++) {
152 if (map[i].type == PIN_MAP_TYPE_MUX_GROUP) 152 if (map[i].type == PIN_MAP_TYPE_MUX_GROUP)
@@ -203,7 +203,7 @@ static int mxs_pinctrl_enable(struct pinctrl_dev *pctldev, unsigned selector,
203 void __iomem *reg; 203 void __iomem *reg;
204 u8 bank, shift; 204 u8 bank, shift;
205 u16 pin; 205 u16 pin;
206 int i; 206 u32 i;
207 207
208 for (i = 0; i < g->npins; i++) { 208 for (i = 0; i < g->npins; i++) {
209 bank = PINID_TO_BANK(g->pins[i]); 209 bank = PINID_TO_BANK(g->pins[i]);
@@ -256,7 +256,7 @@ static int mxs_pinconf_group_set(struct pinctrl_dev *pctldev,
256 void __iomem *reg; 256 void __iomem *reg;
257 u8 ma, vol, pull, bank, shift; 257 u8 ma, vol, pull, bank, shift;
258 u16 pin; 258 u16 pin;
259 int i; 259 u32 i;
260 260
261 ma = CONFIG_TO_MA(config); 261 ma = CONFIG_TO_MA(config);
262 vol = CONFIG_TO_VOL(config); 262 vol = CONFIG_TO_VOL(config);
@@ -335,9 +335,9 @@ static struct pinctrl_desc mxs_pinctrl_desc = {
335 .owner = THIS_MODULE, 335 .owner = THIS_MODULE,
336}; 336};
337 337
338static int __devinit mxs_pinctrl_parse_group(struct platform_device *pdev, 338static int mxs_pinctrl_parse_group(struct platform_device *pdev,
339 struct device_node *np, int idx, 339 struct device_node *np, int idx,
340 const char **out_name) 340 const char **out_name)
341{ 341{
342 struct mxs_pinctrl_data *d = platform_get_drvdata(pdev); 342 struct mxs_pinctrl_data *d = platform_get_drvdata(pdev);
343 struct mxs_group *g = &d->soc->groups[idx]; 343 struct mxs_group *g = &d->soc->groups[idx];
@@ -345,8 +345,7 @@ static int __devinit mxs_pinctrl_parse_group(struct platform_device *pdev,
345 const char *propname = "fsl,pinmux-ids"; 345 const char *propname = "fsl,pinmux-ids";
346 char *group; 346 char *group;
347 int length = strlen(np->name) + SUFFIX_LEN; 347 int length = strlen(np->name) + SUFFIX_LEN;
348 int i; 348 u32 val, i;
349 u32 val;
350 349
351 group = devm_kzalloc(&pdev->dev, length, GFP_KERNEL); 350 group = devm_kzalloc(&pdev->dev, length, GFP_KERNEL);
352 if (!group) 351 if (!group)
@@ -384,8 +383,8 @@ static int __devinit mxs_pinctrl_parse_group(struct platform_device *pdev,
384 return 0; 383 return 0;
385} 384}
386 385
387static int __devinit mxs_pinctrl_probe_dt(struct platform_device *pdev, 386static int mxs_pinctrl_probe_dt(struct platform_device *pdev,
388 struct mxs_pinctrl_data *d) 387 struct mxs_pinctrl_data *d)
389{ 388{
390 struct mxs_pinctrl_soc_data *soc = d->soc; 389 struct mxs_pinctrl_soc_data *soc = d->soc;
391 struct device_node *np = pdev->dev.of_node; 390 struct device_node *np = pdev->dev.of_node;
@@ -476,8 +475,8 @@ static int __devinit mxs_pinctrl_probe_dt(struct platform_device *pdev,
476 return 0; 475 return 0;
477} 476}
478 477
479int __devinit mxs_pinctrl_probe(struct platform_device *pdev, 478int mxs_pinctrl_probe(struct platform_device *pdev,
480 struct mxs_pinctrl_soc_data *soc) 479 struct mxs_pinctrl_soc_data *soc)
481{ 480{
482 struct device_node *np = pdev->dev.of_node; 481 struct device_node *np = pdev->dev.of_node;
483 struct mxs_pinctrl_data *d; 482 struct mxs_pinctrl_data *d;
diff --git a/drivers/pinctrl/pinctrl-nomadik-db8500.c b/drivers/pinctrl/pinctrl-nomadik-db8500.c
index 7d88ae352119..30b4da91ef7e 100644
--- a/drivers/pinctrl/pinctrl-nomadik-db8500.c
+++ b/drivers/pinctrl/pinctrl-nomadik-db8500.c
@@ -1251,8 +1251,7 @@ static const struct nmk_pinctrl_soc_data nmk_db8500_soc = {
1251 .prcm_gpiocr_registers = db8500_prcm_gpiocr_regs, 1251 .prcm_gpiocr_registers = db8500_prcm_gpiocr_regs,
1252}; 1252};
1253 1253
1254void __devinit 1254void nmk_pinctrl_db8500_init(const struct nmk_pinctrl_soc_data **soc)
1255nmk_pinctrl_db8500_init(const struct nmk_pinctrl_soc_data **soc)
1256{ 1255{
1257 *soc = &nmk_db8500_soc; 1256 *soc = &nmk_db8500_soc;
1258} 1257}
diff --git a/drivers/pinctrl/pinctrl-nomadik-db8540.c b/drivers/pinctrl/pinctrl-nomadik-db8540.c
index bb6a4016322a..d7ba5443bae0 100644
--- a/drivers/pinctrl/pinctrl-nomadik-db8540.c
+++ b/drivers/pinctrl/pinctrl-nomadik-db8540.c
@@ -1260,8 +1260,7 @@ static const struct nmk_pinctrl_soc_data nmk_db8540_soc = {
1260 .prcm_gpiocr_registers = db8540_prcm_gpiocr_regs, 1260 .prcm_gpiocr_registers = db8540_prcm_gpiocr_regs,
1261}; 1261};
1262 1262
1263void __devinit 1263void nmk_pinctrl_db8540_init(const struct nmk_pinctrl_soc_data **soc)
1264nmk_pinctrl_db8540_init(const struct nmk_pinctrl_soc_data **soc)
1265{ 1264{
1266 *soc = &nmk_db8540_soc; 1265 *soc = &nmk_db8540_soc;
1267} 1266}
diff --git a/drivers/pinctrl/pinctrl-nomadik-stn8815.c b/drivers/pinctrl/pinctrl-nomadik-stn8815.c
index 7d432c3bc359..924a3393fa82 100644
--- a/drivers/pinctrl/pinctrl-nomadik-stn8815.c
+++ b/drivers/pinctrl/pinctrl-nomadik-stn8815.c
@@ -350,8 +350,7 @@ static const struct nmk_pinctrl_soc_data nmk_stn8815_soc = {
350 .ngroups = ARRAY_SIZE(nmk_stn8815_groups), 350 .ngroups = ARRAY_SIZE(nmk_stn8815_groups),
351}; 351};
352 352
353void __devinit 353void nmk_pinctrl_stn8815_init(const struct nmk_pinctrl_soc_data **soc)
354nmk_pinctrl_stn8815_init(const struct nmk_pinctrl_soc_data **soc)
355{ 354{
356 *soc = &nmk_stn8815_soc; 355 *soc = &nmk_stn8815_soc;
357} 356}
diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c
index ef66f98e9202..5767b18ebdff 100644
--- a/drivers/pinctrl/pinctrl-nomadik.c
+++ b/drivers/pinctrl/pinctrl-nomadik.c
@@ -259,6 +259,9 @@ static void nmk_prcm_altcx_set_mode(struct nmk_pinctrl *npct,
259 const struct prcm_gpiocr_altcx_pin_desc *pin_desc; 259 const struct prcm_gpiocr_altcx_pin_desc *pin_desc;
260 const u16 *gpiocr_regs; 260 const u16 *gpiocr_regs;
261 261
262 if (!npct->prcm_base)
263 return;
264
262 if (alt_num > PRCM_IDX_GPIOCR_ALTC_MAX) { 265 if (alt_num > PRCM_IDX_GPIOCR_ALTC_MAX) {
263 dev_err(npct->dev, "PRCM GPIOCR: alternate-C%i is invalid\n", 266 dev_err(npct->dev, "PRCM GPIOCR: alternate-C%i is invalid\n",
264 alt_num); 267 alt_num);
@@ -673,7 +676,7 @@ int nmk_gpio_set_mode(int gpio, int gpio_mode)
673} 676}
674EXPORT_SYMBOL(nmk_gpio_set_mode); 677EXPORT_SYMBOL(nmk_gpio_set_mode);
675 678
676static int nmk_prcm_gpiocr_get_mode(struct pinctrl_dev *pctldev, int gpio) 679static int __maybe_unused nmk_prcm_gpiocr_get_mode(struct pinctrl_dev *pctldev, int gpio)
677{ 680{
678 int i; 681 int i;
679 u16 reg; 682 u16 reg;
@@ -682,6 +685,9 @@ static int nmk_prcm_gpiocr_get_mode(struct pinctrl_dev *pctldev, int gpio)
682 const struct prcm_gpiocr_altcx_pin_desc *pin_desc; 685 const struct prcm_gpiocr_altcx_pin_desc *pin_desc;
683 const u16 *gpiocr_regs; 686 const u16 *gpiocr_regs;
684 687
688 if (!npct->prcm_base)
689 return NMK_GPIO_ALT_C;
690
685 for (i = 0; i < npct->soc->npins_altcx; i++) { 691 for (i = 0; i < npct->soc->npins_altcx; i++) {
686 if (npct->soc->altcx_pins[i].pin == gpio) 692 if (npct->soc->altcx_pins[i].pin == gpio)
687 break; 693 break;
@@ -1306,7 +1312,7 @@ const struct irq_domain_ops nmk_gpio_irq_simple_ops = {
1306 .xlate = irq_domain_xlate_twocell, 1312 .xlate = irq_domain_xlate_twocell,
1307}; 1313};
1308 1314
1309static int __devinit nmk_gpio_probe(struct platform_device *dev) 1315static int nmk_gpio_probe(struct platform_device *dev)
1310{ 1316{
1311 struct nmk_gpio_platform_data *pdata = dev->dev.platform_data; 1317 struct nmk_gpio_platform_data *pdata = dev->dev.platform_data;
1312 struct device_node *np = dev->dev.of_node; 1318 struct device_node *np = dev->dev.of_node;
@@ -1846,7 +1852,7 @@ static const struct of_device_id nmk_pinctrl_match[] = {
1846 {}, 1852 {},
1847}; 1853};
1848 1854
1849static int __devinit nmk_pinctrl_probe(struct platform_device *pdev) 1855static int nmk_pinctrl_probe(struct platform_device *pdev)
1850{ 1856{
1851 const struct platform_device_id *platid = platform_get_device_id(pdev); 1857 const struct platform_device_id *platid = platform_get_device_id(pdev);
1852 struct device_node *np = pdev->dev.of_node; 1858 struct device_node *np = pdev->dev.of_node;
@@ -1887,9 +1893,12 @@ static int __devinit nmk_pinctrl_probe(struct platform_device *pdev)
1887 "failed to ioremap PRCM registers\n"); 1893 "failed to ioremap PRCM registers\n");
1888 return -ENOMEM; 1894 return -ENOMEM;
1889 } 1895 }
1890 } else { 1896 } else if (version == PINCTRL_NMK_STN8815) {
1891 dev_info(&pdev->dev, 1897 dev_info(&pdev->dev,
1892 "No PRCM base, assume no ALT-Cx control is available\n"); 1898 "No PRCM base, assume no ALT-Cx control is available\n");
1899 } else {
1900 dev_err(&pdev->dev, "missing PRCM base address\n");
1901 return -EINVAL;
1893 } 1902 }
1894 1903
1895 /* 1904 /*
diff --git a/drivers/pinctrl/pinctrl-pxa168.c b/drivers/pinctrl/pinctrl-pxa168.c
index cb771e4a6355..d9cd2b457484 100644
--- a/drivers/pinctrl/pinctrl-pxa168.c
+++ b/drivers/pinctrl/pinctrl-pxa168.c
@@ -615,7 +615,7 @@ static struct pxa3xx_pinmux_info pxa168_info = {
615 .ds_shift = PXA168_DS_SHIFT, 615 .ds_shift = PXA168_DS_SHIFT,
616}; 616};
617 617
618static int __devinit pxa168_pinmux_probe(struct platform_device *pdev) 618static int pxa168_pinmux_probe(struct platform_device *pdev)
619{ 619{
620 return pxa3xx_pinctrl_register(pdev, &pxa168_info); 620 return pxa3xx_pinctrl_register(pdev, &pxa168_info);
621} 621}
diff --git a/drivers/pinctrl/pinctrl-pxa910.c b/drivers/pinctrl/pinctrl-pxa910.c
index 5fecd221b830..a2f917b847fb 100644
--- a/drivers/pinctrl/pinctrl-pxa910.c
+++ b/drivers/pinctrl/pinctrl-pxa910.c
@@ -971,7 +971,7 @@ static struct pxa3xx_pinmux_info pxa910_info = {
971 .ds_shift = PXA910_DS_SHIFT, 971 .ds_shift = PXA910_DS_SHIFT,
972}; 972};
973 973
974static int __devinit pxa910_pinmux_probe(struct platform_device *pdev) 974static int pxa910_pinmux_probe(struct platform_device *pdev)
975{ 975{
976 return pxa3xx_pinctrl_register(pdev, &pxa910_info); 976 return pxa3xx_pinctrl_register(pdev, &pxa910_info);
977} 977}
diff --git a/drivers/pinctrl/pinctrl-samsung.c b/drivers/pinctrl/pinctrl-samsung.c
index 864fed822f9d..fd7b24cd8908 100644
--- a/drivers/pinctrl/pinctrl-samsung.c
+++ b/drivers/pinctrl/pinctrl-samsung.c
@@ -549,9 +549,11 @@ static int samsung_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
549 * Parse the pin names listed in the 'samsung,pins' property and convert it 549 * Parse the pin names listed in the 'samsung,pins' property and convert it
550 * into a list of gpio numbers are create a pin group from it. 550 * into a list of gpio numbers are create a pin group from it.
551 */ 551 */
552static int __devinit samsung_pinctrl_parse_dt_pins(struct platform_device *pdev, 552static int samsung_pinctrl_parse_dt_pins(struct platform_device *pdev,
553 struct device_node *cfg_np, struct pinctrl_desc *pctl, 553 struct device_node *cfg_np,
554 unsigned int **pin_list, unsigned int *npins) 554 struct pinctrl_desc *pctl,
555 unsigned int **pin_list,
556 unsigned int *npins)
555{ 557{
556 struct device *dev = &pdev->dev; 558 struct device *dev = &pdev->dev;
557 struct property *prop; 559 struct property *prop;
@@ -596,8 +598,8 @@ static int __devinit samsung_pinctrl_parse_dt_pins(struct platform_device *pdev,
596 * from device node of the pin-controller. A pin group is formed with all 598 * from device node of the pin-controller. A pin group is formed with all
597 * the pins listed in the "samsung,pins" property. 599 * the pins listed in the "samsung,pins" property.
598 */ 600 */
599static int __devinit samsung_pinctrl_parse_dt(struct platform_device *pdev, 601static int samsung_pinctrl_parse_dt(struct platform_device *pdev,
600 struct samsung_pinctrl_drv_data *drvdata) 602 struct samsung_pinctrl_drv_data *drvdata)
601{ 603{
602 struct device *dev = &pdev->dev; 604 struct device *dev = &pdev->dev;
603 struct device_node *dev_np = dev->of_node; 605 struct device_node *dev_np = dev->of_node;
@@ -691,8 +693,8 @@ static int __devinit samsung_pinctrl_parse_dt(struct platform_device *pdev,
691} 693}
692 694
693/* register the pinctrl interface with the pinctrl subsystem */ 695/* register the pinctrl interface with the pinctrl subsystem */
694static int __devinit samsung_pinctrl_register(struct platform_device *pdev, 696static int samsung_pinctrl_register(struct platform_device *pdev,
695 struct samsung_pinctrl_drv_data *drvdata) 697 struct samsung_pinctrl_drv_data *drvdata)
696{ 698{
697 struct pinctrl_desc *ctrldesc = &drvdata->pctl; 699 struct pinctrl_desc *ctrldesc = &drvdata->pctl;
698 struct pinctrl_pin_desc *pindesc, *pdesc; 700 struct pinctrl_pin_desc *pindesc, *pdesc;
@@ -778,8 +780,8 @@ static const struct gpio_chip samsung_gpiolib_chip = {
778}; 780};
779 781
780/* register the gpiolib interface with the gpiolib subsystem */ 782/* register the gpiolib interface with the gpiolib subsystem */
781static int __devinit samsung_gpiolib_register(struct platform_device *pdev, 783static int samsung_gpiolib_register(struct platform_device *pdev,
782 struct samsung_pinctrl_drv_data *drvdata) 784 struct samsung_pinctrl_drv_data *drvdata)
783{ 785{
784 struct samsung_pin_ctrl *ctrl = drvdata->ctrl; 786 struct samsung_pin_ctrl *ctrl = drvdata->ctrl;
785 struct samsung_pin_bank *bank = ctrl->pin_banks; 787 struct samsung_pin_bank *bank = ctrl->pin_banks;
@@ -816,8 +818,8 @@ fail:
816} 818}
817 819
818/* unregister the gpiolib interface with the gpiolib subsystem */ 820/* unregister the gpiolib interface with the gpiolib subsystem */
819static int __devinit samsung_gpiolib_unregister(struct platform_device *pdev, 821static int samsung_gpiolib_unregister(struct platform_device *pdev,
820 struct samsung_pinctrl_drv_data *drvdata) 822 struct samsung_pinctrl_drv_data *drvdata)
821{ 823{
822 struct samsung_pin_ctrl *ctrl = drvdata->ctrl; 824 struct samsung_pin_ctrl *ctrl = drvdata->ctrl;
823 struct samsung_pin_bank *bank = ctrl->pin_banks; 825 struct samsung_pin_bank *bank = ctrl->pin_banks;
@@ -881,7 +883,7 @@ static struct samsung_pin_ctrl *samsung_pinctrl_get_soc_data(
881 return ctrl; 883 return ctrl;
882} 884}
883 885
884static int __devinit samsung_pinctrl_probe(struct platform_device *pdev) 886static int samsung_pinctrl_probe(struct platform_device *pdev)
885{ 887{
886 struct samsung_pinctrl_drv_data *drvdata; 888 struct samsung_pinctrl_drv_data *drvdata;
887 struct device *dev = &pdev->dev; 889 struct device *dev = &pdev->dev;
diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index 79642831bba2..5c32e880bcb2 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -30,7 +30,6 @@
30#define PCS_MUX_BITS_NAME "pinctrl-single,bits" 30#define PCS_MUX_BITS_NAME "pinctrl-single,bits"
31#define PCS_REG_NAME_LEN ((sizeof(unsigned long) * 2) + 1) 31#define PCS_REG_NAME_LEN ((sizeof(unsigned long) * 2) + 1)
32#define PCS_OFF_DISABLED ~0U 32#define PCS_OFF_DISABLED ~0U
33#define PCS_MAX_GPIO_VALUES 2
34 33
35/** 34/**
36 * struct pcs_pingroup - pingroups for a function 35 * struct pcs_pingroup - pingroups for a function
@@ -78,16 +77,6 @@ struct pcs_function {
78}; 77};
79 78
80/** 79/**
81 * struct pcs_gpio_range - pinctrl gpio range
82 * @range: subrange of the GPIO number space
83 * @gpio_func: gpio function value in the pinmux register
84 */
85struct pcs_gpio_range {
86 struct pinctrl_gpio_range range;
87 int gpio_func;
88};
89
90/**
91 * struct pcs_data - wrapper for data needed by pinctrl framework 80 * struct pcs_data - wrapper for data needed by pinctrl framework
92 * @pa: pindesc array 81 * @pa: pindesc array
93 * @cur: index to current element 82 * @cur: index to current element
@@ -414,26 +403,9 @@ static void pcs_disable(struct pinctrl_dev *pctldev, unsigned fselector,
414} 403}
415 404
416static int pcs_request_gpio(struct pinctrl_dev *pctldev, 405static int pcs_request_gpio(struct pinctrl_dev *pctldev,
417 struct pinctrl_gpio_range *range, unsigned pin) 406 struct pinctrl_gpio_range *range, unsigned offset)
418{ 407{
419 struct pcs_device *pcs = pinctrl_dev_get_drvdata(pctldev); 408 return -ENOTSUPP;
420 struct pcs_gpio_range *gpio = NULL;
421 int end, mux_bytes;
422 unsigned data;
423
424 gpio = container_of(range, struct pcs_gpio_range, range);
425 end = range->pin_base + range->npins - 1;
426 if (pin < range->pin_base || pin > end) {
427 dev_err(pctldev->dev,
428 "pin %d isn't in the range of %d to %d\n",
429 pin, range->pin_base, end);
430 return -EINVAL;
431 }
432 mux_bytes = pcs->width / BITS_PER_BYTE;
433 data = pcs->read(pcs->base + pin * mux_bytes) & ~pcs->fmask;
434 data |= gpio->gpio_func;
435 pcs->write(data, pcs->base + pin * mux_bytes);
436 return 0;
437} 409}
438 410
439static struct pinmux_ops pcs_pinmux_ops = { 411static struct pinmux_ops pcs_pinmux_ops = {
@@ -493,7 +465,7 @@ static struct pinconf_ops pcs_pinconf_ops = {
493 * @pcs: pcs driver instance 465 * @pcs: pcs driver instance
494 * @offset: register offset from base 466 * @offset: register offset from base
495 */ 467 */
496static int __devinit pcs_add_pin(struct pcs_device *pcs, unsigned offset) 468static int pcs_add_pin(struct pcs_device *pcs, unsigned offset)
497{ 469{
498 struct pinctrl_pin_desc *pin; 470 struct pinctrl_pin_desc *pin;
499 struct pcs_name *pn; 471 struct pcs_name *pn;
@@ -526,7 +498,7 @@ static int __devinit pcs_add_pin(struct pcs_device *pcs, unsigned offset)
526 * If your hardware needs holes in the address space, then just set 498 * If your hardware needs holes in the address space, then just set
527 * up multiple driver instances. 499 * up multiple driver instances.
528 */ 500 */
529static int __devinit pcs_allocate_pin_table(struct pcs_device *pcs) 501static int pcs_allocate_pin_table(struct pcs_device *pcs)
530{ 502{
531 int mux_bytes, nr_pins, i; 503 int mux_bytes, nr_pins, i;
532 504
@@ -907,51 +879,7 @@ static void pcs_free_resources(struct pcs_device *pcs)
907 879
908static struct of_device_id pcs_of_match[]; 880static struct of_device_id pcs_of_match[];
909 881
910static int __devinit pcs_add_gpio_range(struct device_node *node, 882static int pcs_probe(struct platform_device *pdev)
911 struct pcs_device *pcs)
912{
913 struct pcs_gpio_range *gpio;
914 struct device_node *child;
915 struct resource r;
916 const char name[] = "pinctrl-single";
917 u32 gpiores[PCS_MAX_GPIO_VALUES];
918 int ret, i = 0, mux_bytes = 0;
919
920 for_each_child_of_node(node, child) {
921 ret = of_address_to_resource(child, 0, &r);
922 if (ret < 0)
923 continue;
924 memset(gpiores, 0, sizeof(u32) * PCS_MAX_GPIO_VALUES);
925 ret = of_property_read_u32_array(child, "pinctrl-single,gpio",
926 gpiores, PCS_MAX_GPIO_VALUES);
927 if (ret < 0)
928 continue;
929 gpio = devm_kzalloc(pcs->dev, sizeof(*gpio), GFP_KERNEL);
930 if (!gpio) {
931 dev_err(pcs->dev, "failed to allocate pcs gpio\n");
932 return -ENOMEM;
933 }
934 gpio->range.name = devm_kzalloc(pcs->dev, sizeof(name),
935 GFP_KERNEL);
936 if (!gpio->range.name) {
937 dev_err(pcs->dev, "failed to allocate range name\n");
938 return -ENOMEM;
939 }
940 memcpy((char *)gpio->range.name, name, sizeof(name));
941
942 gpio->range.id = i++;
943 gpio->range.base = gpiores[0];
944 gpio->gpio_func = gpiores[1];
945 mux_bytes = pcs->width / BITS_PER_BYTE;
946 gpio->range.pin_base = (r.start - pcs->res->start) / mux_bytes;
947 gpio->range.npins = (r.end - r.start) / mux_bytes + 1;
948
949 pinctrl_add_gpio_range(pcs->pctl, &gpio->range);
950 }
951 return 0;
952}
953
954static int __devinit pcs_probe(struct platform_device *pdev)
955{ 883{
956 struct device_node *np = pdev->dev.of_node; 884 struct device_node *np = pdev->dev.of_node;
957 const struct of_device_id *match; 885 const struct of_device_id *match;
@@ -1047,10 +975,6 @@ static int __devinit pcs_probe(struct platform_device *pdev)
1047 goto free; 975 goto free;
1048 } 976 }
1049 977
1050 ret = pcs_add_gpio_range(np, pcs);
1051 if (ret < 0)
1052 goto free;
1053
1054 dev_info(pcs->dev, "%i pins at pa %p size %u\n", 978 dev_info(pcs->dev, "%i pins at pa %p size %u\n",
1055 pcs->desc.npins, pcs->base, pcs->size); 979 pcs->desc.npins, pcs->base, pcs->size);
1056 980
diff --git a/drivers/pinctrl/pinctrl-sirf.c b/drivers/pinctrl/pinctrl-sirf.c
index a4f0c5e487d5..498b2ba905de 100644
--- a/drivers/pinctrl/pinctrl-sirf.c
+++ b/drivers/pinctrl/pinctrl-sirf.c
@@ -1246,7 +1246,7 @@ static void __iomem *sirfsoc_rsc_of_iomap(void)
1246 return of_iomap(np, 0); 1246 return of_iomap(np, 0);
1247} 1247}
1248 1248
1249static int __devinit sirfsoc_pinmux_probe(struct platform_device *pdev) 1249static int sirfsoc_pinmux_probe(struct platform_device *pdev)
1250{ 1250{
1251 int ret; 1251 int ret;
1252 struct sirfsoc_pmx *spmx; 1252 struct sirfsoc_pmx *spmx;
@@ -1663,7 +1663,45 @@ const struct irq_domain_ops sirfsoc_gpio_irq_simple_ops = {
1663 .xlate = irq_domain_xlate_twocell, 1663 .xlate = irq_domain_xlate_twocell,
1664}; 1664};
1665 1665
1666static int __devinit sirfsoc_gpio_probe(struct device_node *np) 1666static void sirfsoc_gpio_set_pullup(const u32 *pullups)
1667{
1668 int i, n;
1669 const unsigned long *p = (const unsigned long *)pullups;
1670
1671 for (i = 0; i < SIRFSOC_GPIO_NO_OF_BANKS; i++) {
1672 n = find_first_bit(p + i, BITS_PER_LONG);
1673 while (n < BITS_PER_LONG) {
1674 u32 offset = SIRFSOC_GPIO_CTRL(i, n);
1675 u32 val = readl(sgpio_bank[i].chip.regs + offset);
1676 val |= SIRFSOC_GPIO_CTL_PULL_MASK;
1677 val |= SIRFSOC_GPIO_CTL_PULL_HIGH;
1678 writel(val, sgpio_bank[i].chip.regs + offset);
1679
1680 n = find_next_bit(p + i, BITS_PER_LONG, n + 1);
1681 }
1682 }
1683}
1684
1685static void sirfsoc_gpio_set_pulldown(const u32 *pulldowns)
1686{
1687 int i, n;
1688 const unsigned long *p = (const unsigned long *)pulldowns;
1689
1690 for (i = 0; i < SIRFSOC_GPIO_NO_OF_BANKS; i++) {
1691 n = find_first_bit(p + i, BITS_PER_LONG);
1692 while (n < BITS_PER_LONG) {
1693 u32 offset = SIRFSOC_GPIO_CTRL(i, n);
1694 u32 val = readl(sgpio_bank[i].chip.regs + offset);
1695 val |= SIRFSOC_GPIO_CTL_PULL_MASK;
1696 val &= ~SIRFSOC_GPIO_CTL_PULL_HIGH;
1697 writel(val, sgpio_bank[i].chip.regs + offset);
1698
1699 n = find_next_bit(p + i, BITS_PER_LONG, n + 1);
1700 }
1701 }
1702}
1703
1704static int sirfsoc_gpio_probe(struct device_node *np)
1667{ 1705{
1668 int i, err = 0; 1706 int i, err = 0;
1669 struct sirfsoc_gpio_bank *bank; 1707 struct sirfsoc_gpio_bank *bank;
@@ -1671,6 +1709,8 @@ static int __devinit sirfsoc_gpio_probe(struct device_node *np)
1671 struct platform_device *pdev; 1709 struct platform_device *pdev;
1672 bool is_marco = false; 1710 bool is_marco = false;
1673 1711
1712 u32 pullups[SIRFSOC_GPIO_NO_OF_BANKS], pulldowns[SIRFSOC_GPIO_NO_OF_BANKS];
1713
1674 pdev = of_find_device_by_node(np); 1714 pdev = of_find_device_by_node(np);
1675 if (!pdev) 1715 if (!pdev)
1676 return -ENODEV; 1716 return -ENODEV;
@@ -1726,6 +1766,14 @@ static int __devinit sirfsoc_gpio_probe(struct device_node *np)
1726 irq_set_handler_data(bank->parent_irq, bank); 1766 irq_set_handler_data(bank->parent_irq, bank);
1727 } 1767 }
1728 1768
1769 if (!of_property_read_u32_array(np, "sirf,pullups", pullups,
1770 SIRFSOC_GPIO_NO_OF_BANKS))
1771 sirfsoc_gpio_set_pullup(pullups);
1772
1773 if (!of_property_read_u32_array(np, "sirf,pulldowns", pulldowns,
1774 SIRFSOC_GPIO_NO_OF_BANKS))
1775 sirfsoc_gpio_set_pulldown(pulldowns);
1776
1729 return 0; 1777 return 0;
1730 1778
1731out: 1779out:
diff --git a/drivers/pinctrl/pinctrl-tegra.c b/drivers/pinctrl/pinctrl-tegra.c
index e356b0380fa7..ae1e4bb3259d 100644
--- a/drivers/pinctrl/pinctrl-tegra.c
+++ b/drivers/pinctrl/pinctrl-tegra.c
@@ -687,7 +687,7 @@ static struct pinctrl_desc tegra_pinctrl_desc = {
687 .owner = THIS_MODULE, 687 .owner = THIS_MODULE,
688}; 688};
689 689
690int __devinit tegra_pinctrl_probe(struct platform_device *pdev, 690int tegra_pinctrl_probe(struct platform_device *pdev,
691 const struct tegra_pinctrl_soc_data *soc_data) 691 const struct tegra_pinctrl_soc_data *soc_data)
692{ 692{
693 struct tegra_pmx *pmx; 693 struct tegra_pmx *pmx;
diff --git a/drivers/pinctrl/pinctrl-tegra20.c b/drivers/pinctrl/pinctrl-tegra20.c
index 1524bfd66602..e848189038f0 100644
--- a/drivers/pinctrl/pinctrl-tegra20.c
+++ b/drivers/pinctrl/pinctrl-tegra20.c
@@ -2856,7 +2856,7 @@ static const struct tegra_pinctrl_soc_data tegra20_pinctrl = {
2856 .ngroups = ARRAY_SIZE(tegra20_groups), 2856 .ngroups = ARRAY_SIZE(tegra20_groups),
2857}; 2857};
2858 2858
2859static int __devinit tegra20_pinctrl_probe(struct platform_device *pdev) 2859static int tegra20_pinctrl_probe(struct platform_device *pdev)
2860{ 2860{
2861 return tegra_pinctrl_probe(pdev, &tegra20_pinctrl); 2861 return tegra_pinctrl_probe(pdev, &tegra20_pinctrl);
2862} 2862}
diff --git a/drivers/pinctrl/pinctrl-tegra30.c b/drivers/pinctrl/pinctrl-tegra30.c
index cf579ebf346f..9ad87ea735d4 100644
--- a/drivers/pinctrl/pinctrl-tegra30.c
+++ b/drivers/pinctrl/pinctrl-tegra30.c
@@ -3722,7 +3722,7 @@ static const struct tegra_pinctrl_soc_data tegra30_pinctrl = {
3722 .ngroups = ARRAY_SIZE(tegra30_groups), 3722 .ngroups = ARRAY_SIZE(tegra30_groups),
3723}; 3723};
3724 3724
3725static int __devinit tegra30_pinctrl_probe(struct platform_device *pdev) 3725static int tegra30_pinctrl_probe(struct platform_device *pdev)
3726{ 3726{
3727 return tegra_pinctrl_probe(pdev, &tegra30_pinctrl); 3727 return tegra_pinctrl_probe(pdev, &tegra30_pinctrl);
3728} 3728}
diff --git a/drivers/pinctrl/pinctrl-u300.c b/drivers/pinctrl/pinctrl-u300.c
index 8c039ad22baf..718ec5762683 100644
--- a/drivers/pinctrl/pinctrl-u300.c
+++ b/drivers/pinctrl/pinctrl-u300.c
@@ -1062,7 +1062,7 @@ static struct pinctrl_desc u300_pmx_desc = {
1062 .owner = THIS_MODULE, 1062 .owner = THIS_MODULE,
1063}; 1063};
1064 1064
1065static int __devinit u300_pmx_probe(struct platform_device *pdev) 1065static int u300_pmx_probe(struct platform_device *pdev)
1066{ 1066{
1067 struct u300_pmx *upmx; 1067 struct u300_pmx *upmx;
1068 struct resource *res; 1068 struct resource *res;
diff --git a/drivers/pinctrl/pinctrl-xway.c b/drivers/pinctrl/pinctrl-xway.c
index ad90984ec500..5f0eb04c2336 100644
--- a/drivers/pinctrl/pinctrl-xway.c
+++ b/drivers/pinctrl/pinctrl-xway.c
@@ -674,7 +674,7 @@ static const struct of_device_id xway_match[] = {
674}; 674};
675MODULE_DEVICE_TABLE(of, xway_match); 675MODULE_DEVICE_TABLE(of, xway_match);
676 676
677static int __devinit pinmux_xway_probe(struct platform_device *pdev) 677static int pinmux_xway_probe(struct platform_device *pdev)
678{ 678{
679 const struct of_device_id *match; 679 const struct of_device_id *match;
680 const struct pinctrl_xway_soc *xway_soc; 680 const struct pinctrl_xway_soc *xway_soc;
diff --git a/drivers/pinctrl/spear/pinctrl-plgpio.c b/drivers/pinctrl/spear/pinctrl-plgpio.c
index 4c045053bbdd..3cf4ecd9302c 100644
--- a/drivers/pinctrl/spear/pinctrl-plgpio.c
+++ b/drivers/pinctrl/spear/pinctrl-plgpio.c
@@ -451,8 +451,7 @@ int spear310_o2p(int offset)
451 return offset + 2; 451 return offset + 2;
452} 452}
453 453
454static int __devinit plgpio_probe_dt(struct platform_device *pdev, 454static int plgpio_probe_dt(struct platform_device *pdev, struct plgpio *plgpio)
455 struct plgpio *plgpio)
456{ 455{
457 struct device_node *np = pdev->dev.of_node; 456 struct device_node *np = pdev->dev.of_node;
458 int ret = -EINVAL; 457 int ret = -EINVAL;
@@ -522,7 +521,7 @@ static int __devinit plgpio_probe_dt(struct platform_device *pdev,
522end: 521end:
523 return ret; 522 return ret;
524} 523}
525static int __devinit plgpio_probe(struct platform_device *pdev) 524static int plgpio_probe(struct platform_device *pdev)
526{ 525{
527 struct device_node *np = pdev->dev.of_node; 526 struct device_node *np = pdev->dev.of_node;
528 struct plgpio *plgpio; 527 struct plgpio *plgpio;
diff --git a/drivers/pinctrl/spear/pinctrl-spear.c b/drivers/pinctrl/spear/pinctrl-spear.c
index 922c057521a1..6a7dae70db08 100644
--- a/drivers/pinctrl/spear/pinctrl-spear.c
+++ b/drivers/pinctrl/spear/pinctrl-spear.c
@@ -82,9 +82,8 @@ static int set_mode(struct spear_pmx *pmx, int mode)
82 return 0; 82 return 0;
83} 83}
84 84
85void __devinit 85void pmx_init_gpio_pingroup_addr(struct spear_gpio_pingroup *gpio_pingroup,
86pmx_init_gpio_pingroup_addr(struct spear_gpio_pingroup *gpio_pingroup, 86 unsigned count, u16 reg)
87 unsigned count, u16 reg)
88{ 87{
89 int i, j; 88 int i, j;
90 89
@@ -93,7 +92,7 @@ pmx_init_gpio_pingroup_addr(struct spear_gpio_pingroup *gpio_pingroup,
93 gpio_pingroup[i].muxregs[j].reg = reg; 92 gpio_pingroup[i].muxregs[j].reg = reg;
94} 93}
95 94
96void __devinit pmx_init_addr(struct spear_pinctrl_machdata *machdata, u16 reg) 95void pmx_init_addr(struct spear_pinctrl_machdata *machdata, u16 reg)
97{ 96{
98 struct spear_pingroup *pgroup; 97 struct spear_pingroup *pgroup;
99 struct spear_modemux *modemux; 98 struct spear_modemux *modemux;
@@ -358,8 +357,8 @@ static struct pinctrl_desc spear_pinctrl_desc = {
358 .owner = THIS_MODULE, 357 .owner = THIS_MODULE,
359}; 358};
360 359
361int __devinit spear_pinctrl_probe(struct platform_device *pdev, 360int spear_pinctrl_probe(struct platform_device *pdev,
362 struct spear_pinctrl_machdata *machdata) 361 struct spear_pinctrl_machdata *machdata)
363{ 362{
364 struct device_node *np = pdev->dev.of_node; 363 struct device_node *np = pdev->dev.of_node;
365 struct resource *res; 364 struct resource *res;
diff --git a/drivers/pinctrl/spear/pinctrl-spear.h b/drivers/pinctrl/spear/pinctrl-spear.h
index 1be46ecc6d91..dc8bf85ecb2a 100644
--- a/drivers/pinctrl/spear/pinctrl-spear.h
+++ b/drivers/pinctrl/spear/pinctrl-spear.h
@@ -192,12 +192,11 @@ static inline void pmx_writel(struct spear_pmx *pmx, u32 val, u32 reg)
192 writel_relaxed(val, pmx->vbase + reg); 192 writel_relaxed(val, pmx->vbase + reg);
193} 193}
194 194
195void __devinit pmx_init_addr(struct spear_pinctrl_machdata *machdata, u16 reg); 195void pmx_init_addr(struct spear_pinctrl_machdata *machdata, u16 reg);
196void __devinit 196void pmx_init_gpio_pingroup_addr(struct spear_gpio_pingroup *gpio_pingroup,
197pmx_init_gpio_pingroup_addr(struct spear_gpio_pingroup *gpio_pingroup, 197 unsigned count, u16 reg);
198 unsigned count, u16 reg); 198int spear_pinctrl_probe(struct platform_device *pdev,
199int __devinit spear_pinctrl_probe(struct platform_device *pdev, 199 struct spear_pinctrl_machdata *machdata);
200 struct spear_pinctrl_machdata *machdata);
201int spear_pinctrl_remove(struct platform_device *pdev); 200int spear_pinctrl_remove(struct platform_device *pdev);
202 201
203#define SPEAR_PIN_0_TO_101 \ 202#define SPEAR_PIN_0_TO_101 \
diff --git a/drivers/pinctrl/spear/pinctrl-spear1310.c b/drivers/pinctrl/spear/pinctrl-spear1310.c
index e40d785a3fc2..1a8bbfec60ca 100644
--- a/drivers/pinctrl/spear/pinctrl-spear1310.c
+++ b/drivers/pinctrl/spear/pinctrl-spear1310.c
@@ -2699,7 +2699,7 @@ static struct of_device_id spear1310_pinctrl_of_match[] = {
2699 {}, 2699 {},
2700}; 2700};
2701 2701
2702static int __devinit spear1310_pinctrl_probe(struct platform_device *pdev) 2702static int spear1310_pinctrl_probe(struct platform_device *pdev)
2703{ 2703{
2704 return spear_pinctrl_probe(pdev, &spear1310_machdata); 2704 return spear_pinctrl_probe(pdev, &spear1310_machdata);
2705} 2705}
diff --git a/drivers/pinctrl/spear/pinctrl-spear1340.c b/drivers/pinctrl/spear/pinctrl-spear1340.c
index 8deaaff3156c..873966e2b99f 100644
--- a/drivers/pinctrl/spear/pinctrl-spear1340.c
+++ b/drivers/pinctrl/spear/pinctrl-spear1340.c
@@ -2015,7 +2015,7 @@ static struct of_device_id spear1340_pinctrl_of_match[] = {
2015 {}, 2015 {},
2016}; 2016};
2017 2017
2018static int __devinit spear1340_pinctrl_probe(struct platform_device *pdev) 2018static int spear1340_pinctrl_probe(struct platform_device *pdev)
2019{ 2019{
2020 return spear_pinctrl_probe(pdev, &spear1340_machdata); 2020 return spear_pinctrl_probe(pdev, &spear1340_machdata);
2021} 2021}
diff --git a/drivers/pinctrl/spear/pinctrl-spear300.c b/drivers/pinctrl/spear/pinctrl-spear300.c
index f48e466e605a..4777c0d0e730 100644
--- a/drivers/pinctrl/spear/pinctrl-spear300.c
+++ b/drivers/pinctrl/spear/pinctrl-spear300.c
@@ -653,7 +653,7 @@ static struct of_device_id spear300_pinctrl_of_match[] = {
653 {}, 653 {},
654}; 654};
655 655
656static int __devinit spear300_pinctrl_probe(struct platform_device *pdev) 656static int spear300_pinctrl_probe(struct platform_device *pdev)
657{ 657{
658 int ret; 658 int ret;
659 659
diff --git a/drivers/pinctrl/spear/pinctrl-spear310.c b/drivers/pinctrl/spear/pinctrl-spear310.c
index 5b954c19a6d2..06c7e6f1c7f2 100644
--- a/drivers/pinctrl/spear/pinctrl-spear310.c
+++ b/drivers/pinctrl/spear/pinctrl-spear310.c
@@ -378,7 +378,7 @@ static struct of_device_id spear310_pinctrl_of_match[] = {
378 {}, 378 {},
379}; 379};
380 380
381static int __devinit spear310_pinctrl_probe(struct platform_device *pdev) 381static int spear310_pinctrl_probe(struct platform_device *pdev)
382{ 382{
383 int ret; 383 int ret;
384 384
diff --git a/drivers/pinctrl/spear/pinctrl-spear320.c b/drivers/pinctrl/spear/pinctrl-spear320.c
index e9a5e6d39242..b8e290a8c8c9 100644
--- a/drivers/pinctrl/spear/pinctrl-spear320.c
+++ b/drivers/pinctrl/spear/pinctrl-spear320.c
@@ -3417,7 +3417,7 @@ static struct of_device_id spear320_pinctrl_of_match[] = {
3417 {}, 3417 {},
3418}; 3418};
3419 3419
3420static int __devinit spear320_pinctrl_probe(struct platform_device *pdev) 3420static int spear320_pinctrl_probe(struct platform_device *pdev)
3421{ 3421{
3422 int ret; 3422 int ret;
3423 3423
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index 934d861a3235..afed7018a2b5 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -125,8 +125,11 @@ static const struct key_entry acer_wmi_keymap[] = {
125 {KE_IGNORE, 0x63, {KEY_BRIGHTNESSDOWN} }, 125 {KE_IGNORE, 0x63, {KEY_BRIGHTNESSDOWN} },
126 {KE_KEY, 0x64, {KEY_SWITCHVIDEOMODE} }, /* Display Switch */ 126 {KE_KEY, 0x64, {KEY_SWITCHVIDEOMODE} }, /* Display Switch */
127 {KE_IGNORE, 0x81, {KEY_SLEEP} }, 127 {KE_IGNORE, 0x81, {KEY_SLEEP} },
128 {KE_KEY, 0x82, {KEY_TOUCHPAD_TOGGLE} }, /* Touch Pad On/Off */ 128 {KE_KEY, 0x82, {KEY_TOUCHPAD_TOGGLE} }, /* Touch Pad Toggle */
129 {KE_KEY, KEY_TOUCHPAD_ON, {KEY_TOUCHPAD_ON} },
130 {KE_KEY, KEY_TOUCHPAD_OFF, {KEY_TOUCHPAD_OFF} },
129 {KE_IGNORE, 0x83, {KEY_TOUCHPAD_TOGGLE} }, 131 {KE_IGNORE, 0x83, {KEY_TOUCHPAD_TOGGLE} },
132 {KE_KEY, 0x85, {KEY_TOUCHPAD_TOGGLE} },
130 {KE_END, 0} 133 {KE_END, 0}
131}; 134};
132 135
@@ -147,6 +150,7 @@ struct event_return_value {
147#define ACER_WMID3_GDS_THREEG (1<<6) /* 3G */ 150#define ACER_WMID3_GDS_THREEG (1<<6) /* 3G */
148#define ACER_WMID3_GDS_WIMAX (1<<7) /* WiMAX */ 151#define ACER_WMID3_GDS_WIMAX (1<<7) /* WiMAX */
149#define ACER_WMID3_GDS_BLUETOOTH (1<<11) /* BT */ 152#define ACER_WMID3_GDS_BLUETOOTH (1<<11) /* BT */
153#define ACER_WMID3_GDS_TOUCHPAD (1<<1) /* Touchpad */
150 154
151struct lm_input_params { 155struct lm_input_params {
152 u8 function_num; /* Function Number */ 156 u8 function_num; /* Function Number */
@@ -335,7 +339,7 @@ static struct quirk_entry quirk_lenovo_ideapad_s205 = {
335}; 339};
336 340
337/* The Aspire One has a dummy ACPI-WMI interface - disable it */ 341/* The Aspire One has a dummy ACPI-WMI interface - disable it */
338static struct dmi_system_id __devinitdata acer_blacklist[] = { 342static struct dmi_system_id acer_blacklist[] = {
339 { 343 {
340 .ident = "Acer Aspire One (SSD)", 344 .ident = "Acer Aspire One (SSD)",
341 .matches = { 345 .matches = {
@@ -875,7 +879,7 @@ WMI_execute_u32(u32 method_id, u32 in, u32 *out)
875 struct acpi_buffer input = { (acpi_size) sizeof(u32), (void *)(&in) }; 879 struct acpi_buffer input = { (acpi_size) sizeof(u32), (void *)(&in) };
876 struct acpi_buffer result = { ACPI_ALLOCATE_BUFFER, NULL }; 880 struct acpi_buffer result = { ACPI_ALLOCATE_BUFFER, NULL };
877 union acpi_object *obj; 881 union acpi_object *obj;
878 u32 tmp; 882 u32 tmp = 0;
879 acpi_status status; 883 acpi_status status;
880 884
881 status = wmi_evaluate_method(WMID_GUID1, 1, method_id, &input, &result); 885 status = wmi_evaluate_method(WMID_GUID1, 1, method_id, &input, &result);
@@ -884,14 +888,14 @@ WMI_execute_u32(u32 method_id, u32 in, u32 *out)
884 return status; 888 return status;
885 889
886 obj = (union acpi_object *) result.pointer; 890 obj = (union acpi_object *) result.pointer;
887 if (obj && obj->type == ACPI_TYPE_BUFFER && 891 if (obj) {
888 (obj->buffer.length == sizeof(u32) || 892 if (obj->type == ACPI_TYPE_BUFFER &&
889 obj->buffer.length == sizeof(u64))) { 893 (obj->buffer.length == sizeof(u32) ||
890 tmp = *((u32 *) obj->buffer.pointer); 894 obj->buffer.length == sizeof(u64))) {
891 } else if (obj->type == ACPI_TYPE_INTEGER) { 895 tmp = *((u32 *) obj->buffer.pointer);
892 tmp = (u32) obj->integer.value; 896 } else if (obj->type == ACPI_TYPE_INTEGER) {
893 } else { 897 tmp = (u32) obj->integer.value;
894 tmp = 0; 898 }
895 } 899 }
896 900
897 if (out) 901 if (out)
@@ -1193,12 +1197,14 @@ static acpi_status WMID_set_capabilities(void)
1193 return status; 1197 return status;
1194 1198
1195 obj = (union acpi_object *) out.pointer; 1199 obj = (union acpi_object *) out.pointer;
1196 if (obj && obj->type == ACPI_TYPE_BUFFER && 1200 if (obj) {
1197 (obj->buffer.length == sizeof(u32) || 1201 if (obj->type == ACPI_TYPE_BUFFER &&
1198 obj->buffer.length == sizeof(u64))) { 1202 (obj->buffer.length == sizeof(u32) ||
1199 devices = *((u32 *) obj->buffer.pointer); 1203 obj->buffer.length == sizeof(u64))) {
1200 } else if (obj->type == ACPI_TYPE_INTEGER) { 1204 devices = *((u32 *) obj->buffer.pointer);
1201 devices = (u32) obj->integer.value; 1205 } else if (obj->type == ACPI_TYPE_INTEGER) {
1206 devices = (u32) obj->integer.value;
1207 }
1202 } else { 1208 } else {
1203 kfree(out.pointer); 1209 kfree(out.pointer);
1204 return AE_ERROR; 1210 return AE_ERROR;
@@ -1330,7 +1336,7 @@ static struct led_classdev mail_led = {
1330 .brightness_set = mail_led_set, 1336 .brightness_set = mail_led_set,
1331}; 1337};
1332 1338
1333static int __devinit acer_led_init(struct device *dev) 1339static int acer_led_init(struct device *dev)
1334{ 1340{
1335 return led_classdev_register(dev, &mail_led); 1341 return led_classdev_register(dev, &mail_led);
1336} 1342}
@@ -1372,7 +1378,7 @@ static const struct backlight_ops acer_bl_ops = {
1372 .update_status = update_bl_status, 1378 .update_status = update_bl_status,
1373}; 1379};
1374 1380
1375static int __devinit acer_backlight_init(struct device *dev) 1381static int acer_backlight_init(struct device *dev)
1376{ 1382{
1377 struct backlight_properties props; 1383 struct backlight_properties props;
1378 struct backlight_device *bd; 1384 struct backlight_device *bd;
@@ -1676,6 +1682,7 @@ static void acer_wmi_notify(u32 value, void *context)
1676 acpi_status status; 1682 acpi_status status;
1677 u16 device_state; 1683 u16 device_state;
1678 const struct key_entry *key; 1684 const struct key_entry *key;
1685 u32 scancode;
1679 1686
1680 status = wmi_get_event_data(value, &response); 1687 status = wmi_get_event_data(value, &response);
1681 if (status != AE_OK) { 1688 if (status != AE_OK) {
@@ -1712,6 +1719,7 @@ static void acer_wmi_notify(u32 value, void *context)
1712 pr_warn("Unknown key number - 0x%x\n", 1719 pr_warn("Unknown key number - 0x%x\n",
1713 return_value.key_num); 1720 return_value.key_num);
1714 } else { 1721 } else {
1722 scancode = return_value.key_num;
1715 switch (key->keycode) { 1723 switch (key->keycode) {
1716 case KEY_WLAN: 1724 case KEY_WLAN:
1717 case KEY_BLUETOOTH: 1725 case KEY_BLUETOOTH:
@@ -1725,9 +1733,11 @@ static void acer_wmi_notify(u32 value, void *context)
1725 rfkill_set_sw_state(bluetooth_rfkill, 1733 rfkill_set_sw_state(bluetooth_rfkill,
1726 !(device_state & ACER_WMID3_GDS_BLUETOOTH)); 1734 !(device_state & ACER_WMID3_GDS_BLUETOOTH));
1727 break; 1735 break;
1736 case KEY_TOUCHPAD_TOGGLE:
1737 scancode = (device_state & ACER_WMID3_GDS_TOUCHPAD) ?
1738 KEY_TOUCHPAD_ON : KEY_TOUCHPAD_OFF;
1728 } 1739 }
1729 sparse_keymap_report_entry(acer_wmi_input_dev, key, 1740 sparse_keymap_report_event(acer_wmi_input_dev, scancode, 1, true);
1730 1, true);
1731 } 1741 }
1732 break; 1742 break;
1733 case WMID_ACCEL_EVENT: 1743 case WMID_ACCEL_EVENT:
@@ -1946,12 +1956,14 @@ static u32 get_wmid_devices(void)
1946 return 0; 1956 return 0;
1947 1957
1948 obj = (union acpi_object *) out.pointer; 1958 obj = (union acpi_object *) out.pointer;
1949 if (obj && obj->type == ACPI_TYPE_BUFFER && 1959 if (obj) {
1950 (obj->buffer.length == sizeof(u32) || 1960 if (obj->type == ACPI_TYPE_BUFFER &&
1951 obj->buffer.length == sizeof(u64))) { 1961 (obj->buffer.length == sizeof(u32) ||
1952 devices = *((u32 *) obj->buffer.pointer); 1962 obj->buffer.length == sizeof(u64))) {
1953 } else if (obj->type == ACPI_TYPE_INTEGER) { 1963 devices = *((u32 *) obj->buffer.pointer);
1954 devices = (u32) obj->integer.value; 1964 } else if (obj->type == ACPI_TYPE_INTEGER) {
1965 devices = (u32) obj->integer.value;
1966 }
1955 } 1967 }
1956 1968
1957 kfree(out.pointer); 1969 kfree(out.pointer);
@@ -1961,7 +1973,7 @@ static u32 get_wmid_devices(void)
1961/* 1973/*
1962 * Platform device 1974 * Platform device
1963 */ 1975 */
1964static int __devinit acer_platform_probe(struct platform_device *device) 1976static int acer_platform_probe(struct platform_device *device)
1965{ 1977{
1966 int err; 1978 int err;
1967 1979
diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index c2e3e63d2c15..f94467c05225 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -515,7 +515,7 @@ static int acerhdf_suspend(struct device *dev)
515 return 0; 515 return 0;
516} 516}
517 517
518static int __devinit acerhdf_probe(struct platform_device *device) 518static int acerhdf_probe(struct platform_device *device)
519{ 519{
520 return 0; 520 return 0;
521} 521}
diff --git a/drivers/platform/x86/amilo-rfkill.c b/drivers/platform/x86/amilo-rfkill.c
index 1deca7f6c4ea..6296f078b7bc 100644
--- a/drivers/platform/x86/amilo-rfkill.c
+++ b/drivers/platform/x86/amilo-rfkill.c
@@ -74,7 +74,7 @@ static const struct rfkill_ops amilo_m7440_rfkill_ops = {
74 .set_block = amilo_m7440_rfkill_set_block 74 .set_block = amilo_m7440_rfkill_set_block
75}; 75};
76 76
77static const struct dmi_system_id __devinitconst amilo_rfkill_id_table[] = { 77static const struct dmi_system_id amilo_rfkill_id_table[] = {
78 { 78 {
79 .matches = { 79 .matches = {
80 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), 80 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
@@ -95,7 +95,7 @@ static const struct dmi_system_id __devinitconst amilo_rfkill_id_table[] = {
95static struct platform_device *amilo_rfkill_pdev; 95static struct platform_device *amilo_rfkill_pdev;
96static struct rfkill *amilo_rfkill_dev; 96static struct rfkill *amilo_rfkill_dev;
97 97
98static int __devinit amilo_rfkill_probe(struct platform_device *device) 98static int amilo_rfkill_probe(struct platform_device *device)
99{ 99{
100 int rc; 100 int rc;
101 const struct dmi_system_id *system_id = 101 const struct dmi_system_id *system_id =
diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c
index db8f63841b42..f74bfcbb7bad 100644
--- a/drivers/platform/x86/apple-gmux.c
+++ b/drivers/platform/x86/apple-gmux.c
@@ -411,8 +411,7 @@ static int gmux_resume(struct pnp_dev *pnp)
411 return 0; 411 return 0;
412} 412}
413 413
414static int __devinit gmux_probe(struct pnp_dev *pnp, 414static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
415 const struct pnp_device_id *id)
416{ 415{
417 struct apple_gmux_data *gmux_data; 416 struct apple_gmux_data *gmux_data;
418 struct resource *res; 417 struct resource *res;
@@ -577,7 +576,7 @@ err_free:
577 return ret; 576 return ret;
578} 577}
579 578
580static void __devexit gmux_remove(struct pnp_dev *pnp) 579static void gmux_remove(struct pnp_dev *pnp)
581{ 580{
582 struct apple_gmux_data *gmux_data = pnp_get_drvdata(pnp); 581 struct apple_gmux_data *gmux_data = pnp_get_drvdata(pnp);
583 582
@@ -609,7 +608,7 @@ static const struct pnp_device_id gmux_device_ids[] = {
609static struct pnp_driver gmux_pnp_driver = { 608static struct pnp_driver gmux_pnp_driver = {
610 .name = "apple-gmux", 609 .name = "apple-gmux",
611 .probe = gmux_probe, 610 .probe = gmux_probe,
612 .remove = __devexit_p(gmux_remove), 611 .remove = gmux_remove,
613 .id_table = gmux_device_ids, 612 .id_table = gmux_device_ids,
614 .suspend = gmux_suspend, 613 .suspend = gmux_suspend,
615 .resume = gmux_resume 614 .resume = gmux_resume
diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c
index 4b568df56643..fcde4e528819 100644
--- a/drivers/platform/x86/asus-laptop.c
+++ b/drivers/platform/x86/asus-laptop.c
@@ -860,8 +860,10 @@ static ssize_t show_infos(struct device *dev,
860 /* 860 /*
861 * The HWRS method return informations about the hardware. 861 * The HWRS method return informations about the hardware.
862 * 0x80 bit is for WLAN, 0x100 for Bluetooth. 862 * 0x80 bit is for WLAN, 0x100 for Bluetooth.
863 * 0x40 for WWAN, 0x10 for WIMAX.
863 * The significance of others is yet to be found. 864 * The significance of others is yet to be found.
864 * If we don't find the method, we assume the device are present. 865 * We don't currently use this for device detection, and it
866 * takes several seconds to run on some systems.
865 */ 867 */
866 rv = acpi_evaluate_integer(asus->handle, "HWRS", NULL, &temp); 868 rv = acpi_evaluate_integer(asus->handle, "HWRS", NULL, &temp);
867 if (!ACPI_FAILURE(rv)) 869 if (!ACPI_FAILURE(rv))
@@ -1682,7 +1684,7 @@ static int asus_laptop_get_info(struct asus_laptop *asus)
1682{ 1684{
1683 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 1685 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
1684 union acpi_object *model = NULL; 1686 union acpi_object *model = NULL;
1685 unsigned long long bsts_result, hwrs_result; 1687 unsigned long long bsts_result;
1686 char *string = NULL; 1688 char *string = NULL;
1687 acpi_status status; 1689 acpi_status status;
1688 1690
@@ -1741,20 +1743,9 @@ static int asus_laptop_get_info(struct asus_laptop *asus)
1741 return -ENOMEM; 1743 return -ENOMEM;
1742 } 1744 }
1743 1745
1744 if (*string) 1746 if (string)
1745 pr_notice(" %s model detected\n", string); 1747 pr_notice(" %s model detected\n", string);
1746 1748
1747 /*
1748 * The HWRS method return informations about the hardware.
1749 * 0x80 bit is for WLAN, 0x100 for Bluetooth,
1750 * 0x40 for WWAN, 0x10 for WIMAX.
1751 * The significance of others is yet to be found.
1752 */
1753 status =
1754 acpi_evaluate_integer(asus->handle, "HWRS", NULL, &hwrs_result);
1755 if (!ACPI_FAILURE(status))
1756 pr_notice(" HWRS returned %x", (int)hwrs_result);
1757
1758 if (!acpi_check_handle(asus->handle, METHOD_WL_STATUS, NULL)) 1749 if (!acpi_check_handle(asus->handle, METHOD_WL_STATUS, NULL))
1759 asus->have_rsts = true; 1750 asus->have_rsts = true;
1760 1751
@@ -1763,7 +1754,7 @@ static int asus_laptop_get_info(struct asus_laptop *asus)
1763 return AE_OK; 1754 return AE_OK;
1764} 1755}
1765 1756
1766static int __devinit asus_acpi_init(struct asus_laptop *asus) 1757static int asus_acpi_init(struct asus_laptop *asus)
1767{ 1758{
1768 int result = 0; 1759 int result = 0;
1769 1760
@@ -1823,7 +1814,7 @@ static int __devinit asus_acpi_init(struct asus_laptop *asus)
1823 return result; 1814 return result;
1824} 1815}
1825 1816
1826static void __devinit asus_dmi_check(void) 1817static void asus_dmi_check(void)
1827{ 1818{
1828 const char *model; 1819 const char *model;
1829 1820
@@ -1839,7 +1830,7 @@ static void __devinit asus_dmi_check(void)
1839 1830
1840static bool asus_device_present; 1831static bool asus_device_present;
1841 1832
1842static int __devinit asus_acpi_add(struct acpi_device *device) 1833static int asus_acpi_add(struct acpi_device *device)
1843{ 1834{
1844 struct asus_laptop *asus; 1835 struct asus_laptop *asus;
1845 int result; 1836 int result;
diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c
index 1887e2f166a4..475cc5242511 100644
--- a/drivers/platform/x86/compal-laptop.c
+++ b/drivers/platform/x86/compal-laptop.c
@@ -713,15 +713,15 @@ static struct attribute_group compal_attribute_group = {
713 .attrs = compal_attributes 713 .attrs = compal_attributes
714}; 714};
715 715
716static int __devinit compal_probe(struct platform_device *); 716static int compal_probe(struct platform_device *);
717static int __devexit compal_remove(struct platform_device *); 717static int compal_remove(struct platform_device *);
718static struct platform_driver compal_driver = { 718static struct platform_driver compal_driver = {
719 .driver = { 719 .driver = {
720 .name = DRIVER_NAME, 720 .name = DRIVER_NAME,
721 .owner = THIS_MODULE, 721 .owner = THIS_MODULE,
722 }, 722 },
723 .probe = compal_probe, 723 .probe = compal_probe,
724 .remove = __devexit_p(compal_remove) 724 .remove = compal_remove,
725}; 725};
726 726
727static enum power_supply_property compal_bat_properties[] = { 727static enum power_supply_property compal_bat_properties[] = {
@@ -1015,7 +1015,7 @@ err_backlight:
1015 return ret; 1015 return ret;
1016} 1016}
1017 1017
1018static int __devinit compal_probe(struct platform_device *pdev) 1018static int compal_probe(struct platform_device *pdev)
1019{ 1019{
1020 int err; 1020 int err;
1021 struct compal_data *data; 1021 struct compal_data *data;
@@ -1067,7 +1067,7 @@ static void __exit compal_cleanup(void)
1067 pr_info("Driver unloaded\n"); 1067 pr_info("Driver unloaded\n");
1068} 1068}
1069 1069
1070static int __devexit compal_remove(struct platform_device *pdev) 1070static int compal_remove(struct platform_device *pdev)
1071{ 1071{
1072 struct compal_data *data; 1072 struct compal_data *data;
1073 1073
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
index 927c33af67ec..fa3ee6209572 100644
--- a/drivers/platform/x86/dell-laptop.c
+++ b/drivers/platform/x86/dell-laptop.c
@@ -115,7 +115,7 @@ static const struct dmi_system_id dell_device_table[] __initconst = {
115}; 115};
116MODULE_DEVICE_TABLE(dmi, dell_device_table); 116MODULE_DEVICE_TABLE(dmi, dell_device_table);
117 117
118static struct dmi_system_id __devinitdata dell_quirks[] = { 118static struct dmi_system_id dell_quirks[] = {
119 { 119 {
120 .callback = dmi_matched, 120 .callback = dmi_matched,
121 .ident = "Dell Vostro V130", 121 .ident = "Dell Vostro V130",
@@ -503,7 +503,7 @@ static struct led_classdev touchpad_led = {
503 .flags = LED_CORE_SUSPENDRESUME, 503 .flags = LED_CORE_SUSPENDRESUME,
504}; 504};
505 505
506static int __devinit touchpad_led_init(struct device *dev) 506static int touchpad_led_init(struct device *dev)
507{ 507{
508 return led_classdev_register(dev, &touchpad_led); 508 return led_classdev_register(dev, &touchpad_led);
509} 509}
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index 5ca264179f4e..528e9495458d 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -1375,7 +1375,7 @@ static void cmsg_quirks(struct eeepc_laptop *eeepc)
1375 cmsg_quirk(eeepc, CM_ASL_TPD, "TPD"); 1375 cmsg_quirk(eeepc, CM_ASL_TPD, "TPD");
1376} 1376}
1377 1377
1378static int __devinit eeepc_acpi_init(struct eeepc_laptop *eeepc) 1378static int eeepc_acpi_init(struct eeepc_laptop *eeepc)
1379{ 1379{
1380 unsigned int init_flags; 1380 unsigned int init_flags;
1381 int result; 1381 int result;
@@ -1407,7 +1407,7 @@ static int __devinit eeepc_acpi_init(struct eeepc_laptop *eeepc)
1407 return 0; 1407 return 0;
1408} 1408}
1409 1409
1410static void __devinit eeepc_enable_camera(struct eeepc_laptop *eeepc) 1410static void eeepc_enable_camera(struct eeepc_laptop *eeepc)
1411{ 1411{
1412 /* 1412 /*
1413 * If the following call to set_acpi() fails, it's because there's no 1413 * If the following call to set_acpi() fails, it's because there's no
@@ -1419,7 +1419,7 @@ static void __devinit eeepc_enable_camera(struct eeepc_laptop *eeepc)
1419 1419
1420static bool eeepc_device_present; 1420static bool eeepc_device_present;
1421 1421
1422static int __devinit eeepc_acpi_add(struct acpi_device *device) 1422static int eeepc_acpi_add(struct acpi_device *device)
1423{ 1423{
1424 struct eeepc_laptop *eeepc; 1424 struct eeepc_laptop *eeepc;
1425 int result; 1425 int result;
diff --git a/drivers/platform/x86/fujitsu-tablet.c b/drivers/platform/x86/fujitsu-tablet.c
index f77484528b1b..174ca01c4aa7 100644
--- a/drivers/platform/x86/fujitsu-tablet.c
+++ b/drivers/platform/x86/fujitsu-tablet.c
@@ -192,8 +192,8 @@ static void fujitsu_reset(void)
192 fujitsu_send_state(); 192 fujitsu_send_state();
193} 193}
194 194
195static int __devinit input_fujitsu_setup(struct device *parent, 195static int input_fujitsu_setup(struct device *parent, const char *name,
196 const char *name, const char *phys) 196 const char *phys)
197{ 197{
198 struct input_dev *idev; 198 struct input_dev *idev;
199 int error; 199 int error;
@@ -277,21 +277,21 @@ static irqreturn_t fujitsu_interrupt(int irq, void *dev_id)
277 return IRQ_HANDLED; 277 return IRQ_HANDLED;
278} 278}
279 279
280static void __devinit fujitsu_dmi_common(const struct dmi_system_id *dmi) 280static void fujitsu_dmi_common(const struct dmi_system_id *dmi)
281{ 281{
282 pr_info("%s\n", dmi->ident); 282 pr_info("%s\n", dmi->ident);
283 memcpy(fujitsu.config.keymap, dmi->driver_data, 283 memcpy(fujitsu.config.keymap, dmi->driver_data,
284 sizeof(fujitsu.config.keymap)); 284 sizeof(fujitsu.config.keymap));
285} 285}
286 286
287static int __devinit fujitsu_dmi_lifebook(const struct dmi_system_id *dmi) 287static int fujitsu_dmi_lifebook(const struct dmi_system_id *dmi)
288{ 288{
289 fujitsu_dmi_common(dmi); 289 fujitsu_dmi_common(dmi);
290 fujitsu.config.quirks |= INVERT_TABLET_MODE_BIT; 290 fujitsu.config.quirks |= INVERT_TABLET_MODE_BIT;
291 return 1; 291 return 1;
292} 292}
293 293
294static int __devinit fujitsu_dmi_stylistic(const struct dmi_system_id *dmi) 294static int fujitsu_dmi_stylistic(const struct dmi_system_id *dmi)
295{ 295{
296 fujitsu_dmi_common(dmi); 296 fujitsu_dmi_common(dmi);
297 fujitsu.config.quirks |= FORCE_TABLET_MODE_IF_UNDOCK; 297 fujitsu.config.quirks |= FORCE_TABLET_MODE_IF_UNDOCK;
@@ -366,8 +366,7 @@ static const struct dmi_system_id dmi_ids[] __initconst = {
366 { NULL } 366 { NULL }
367}; 367};
368 368
369static acpi_status __devinit 369static acpi_status fujitsu_walk_resources(struct acpi_resource *res, void *data)
370fujitsu_walk_resources(struct acpi_resource *res, void *data)
371{ 370{
372 switch (res->type) { 371 switch (res->type) {
373 case ACPI_RESOURCE_TYPE_IRQ: 372 case ACPI_RESOURCE_TYPE_IRQ:
@@ -390,7 +389,7 @@ fujitsu_walk_resources(struct acpi_resource *res, void *data)
390 } 389 }
391} 390}
392 391
393static int __devinit acpi_fujitsu_add(struct acpi_device *adev) 392static int acpi_fujitsu_add(struct acpi_device *adev)
394{ 393{
395 acpi_status status; 394 acpi_status status;
396 int error; 395 int error;
@@ -432,7 +431,7 @@ static int __devinit acpi_fujitsu_add(struct acpi_device *adev)
432 return 0; 431 return 0;
433} 432}
434 433
435static int __devexit acpi_fujitsu_remove(struct acpi_device *adev, int type) 434static int acpi_fujitsu_remove(struct acpi_device *adev, int type)
436{ 435{
437 free_irq(fujitsu.irq, fujitsu_interrupt); 436 free_irq(fujitsu.irq, fujitsu_interrupt);
438 release_region(fujitsu.io_base, fujitsu.io_length); 437 release_region(fujitsu.io_base, fujitsu.io_length);
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index 387183a2d6dd..1dde7accf27c 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -72,7 +72,7 @@ enum hp_wmi_event_ids {
72 HPWMI_LOCK_SWITCH = 7, 72 HPWMI_LOCK_SWITCH = 7,
73}; 73};
74 74
75static int __devinit hp_wmi_bios_setup(struct platform_device *device); 75static int hp_wmi_bios_setup(struct platform_device *device);
76static int __exit hp_wmi_bios_remove(struct platform_device *device); 76static int __exit hp_wmi_bios_remove(struct platform_device *device);
77static int hp_wmi_resume_handler(struct device *device); 77static int hp_wmi_resume_handler(struct device *device);
78 78
@@ -619,7 +619,7 @@ static void cleanup_sysfs(struct platform_device *device)
619 device_remove_file(&device->dev, &dev_attr_tablet); 619 device_remove_file(&device->dev, &dev_attr_tablet);
620} 620}
621 621
622static int __devinit hp_wmi_rfkill_setup(struct platform_device *device) 622static int hp_wmi_rfkill_setup(struct platform_device *device)
623{ 623{
624 int err; 624 int err;
625 int wireless = 0; 625 int wireless = 0;
@@ -698,7 +698,7 @@ register_wifi_error:
698 return err; 698 return err;
699} 699}
700 700
701static int __devinit hp_wmi_rfkill2_setup(struct platform_device *device) 701static int hp_wmi_rfkill2_setup(struct platform_device *device)
702{ 702{
703 int err, i; 703 int err, i;
704 struct bios_rfkill2_state state; 704 struct bios_rfkill2_state state;
@@ -778,7 +778,7 @@ fail:
778 return err; 778 return err;
779} 779}
780 780
781static int __devinit hp_wmi_bios_setup(struct platform_device *device) 781static int hp_wmi_bios_setup(struct platform_device *device)
782{ 782{
783 int err; 783 int err;
784 784
diff --git a/drivers/platform/x86/ibm_rtl.c b/drivers/platform/x86/ibm_rtl.c
index 7481146a5b47..97c2be195efc 100644
--- a/drivers/platform/x86/ibm_rtl.c
+++ b/drivers/platform/x86/ibm_rtl.c
@@ -244,7 +244,7 @@ static int __init ibm_rtl_init(void) {
244 if (force) 244 if (force)
245 pr_warn("module loaded by force\n"); 245 pr_warn("module loaded by force\n");
246 /* first ensure that we are running on IBM HW */ 246 /* first ensure that we are running on IBM HW */
247 else if (efi_enabled || !dmi_check_system(ibm_rtl_dmi_table)) 247 else if (efi_enabled(EFI_BOOT) || !dmi_check_system(ibm_rtl_dmi_table))
248 return -ENODEV; 248 return -ENODEV;
249 249
250 /* Get the address for the Extended BIOS Data Area */ 250 /* Get the address for the Extended BIOS Data Area */
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index 5ff4f2e314d2..64bfb30a52e9 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -298,7 +298,7 @@ static const struct file_operations debugfs_cfg_fops = {
298 .release = single_release, 298 .release = single_release,
299}; 299};
300 300
301static int __devinit ideapad_debugfs_init(struct ideapad_private *priv) 301static int ideapad_debugfs_init(struct ideapad_private *priv)
302{ 302{
303 struct dentry *node; 303 struct dentry *node;
304 304
@@ -468,8 +468,7 @@ static void ideapad_sync_rfk_state(struct ideapad_private *priv)
468 rfkill_set_hw_state(priv->rfk[i], hw_blocked); 468 rfkill_set_hw_state(priv->rfk[i], hw_blocked);
469} 469}
470 470
471static int __devinit ideapad_register_rfkill(struct acpi_device *adevice, 471static int ideapad_register_rfkill(struct acpi_device *adevice, int dev)
472 int dev)
473{ 472{
474 struct ideapad_private *priv = dev_get_drvdata(&adevice->dev); 473 struct ideapad_private *priv = dev_get_drvdata(&adevice->dev);
475 int ret; 474 int ret;
@@ -519,7 +518,7 @@ static void ideapad_unregister_rfkill(struct acpi_device *adevice, int dev)
519/* 518/*
520 * Platform device 519 * Platform device
521 */ 520 */
522static int __devinit ideapad_platform_init(struct ideapad_private *priv) 521static int ideapad_platform_init(struct ideapad_private *priv)
523{ 522{
524 int result; 523 int result;
525 524
@@ -569,7 +568,7 @@ static const struct key_entry ideapad_keymap[] = {
569 { KE_END, 0 }, 568 { KE_END, 0 },
570}; 569};
571 570
572static int __devinit ideapad_input_init(struct ideapad_private *priv) 571static int ideapad_input_init(struct ideapad_private *priv)
573{ 572{
574 struct input_dev *inputdev; 573 struct input_dev *inputdev;
575 int error; 574 int error;
@@ -776,7 +775,7 @@ static void ideapad_sync_touchpad_state(struct acpi_device *adevice)
776 } 775 }
777} 776}
778 777
779static int __devinit ideapad_acpi_add(struct acpi_device *adevice) 778static int ideapad_acpi_add(struct acpi_device *adevice)
780{ 779{
781 int ret, i; 780 int ret, i;
782 int cfg; 781 int cfg;
@@ -835,7 +834,7 @@ platform_failed:
835 return ret; 834 return ret;
836} 835}
837 836
838static int __devexit ideapad_acpi_remove(struct acpi_device *adevice, int type) 837static int ideapad_acpi_remove(struct acpi_device *adevice, int type)
839{ 838{
840 struct ideapad_private *priv = dev_get_drvdata(&adevice->dev); 839 struct ideapad_private *priv = dev_get_drvdata(&adevice->dev);
841 int i; 840 int i;
diff --git a/drivers/platform/x86/intel_mid_powerbtn.c b/drivers/platform/x86/intel_mid_powerbtn.c
index bcbad8452a6f..f59683aa13d5 100644
--- a/drivers/platform/x86/intel_mid_powerbtn.c
+++ b/drivers/platform/x86/intel_mid_powerbtn.c
@@ -56,7 +56,7 @@ static irqreturn_t mfld_pb_isr(int irq, void *dev_id)
56 return IRQ_HANDLED; 56 return IRQ_HANDLED;
57} 57}
58 58
59static int __devinit mfld_pb_probe(struct platform_device *pdev) 59static int mfld_pb_probe(struct platform_device *pdev)
60{ 60{
61 struct input_dev *input; 61 struct input_dev *input;
62 int irq = platform_get_irq(pdev, 0); 62 int irq = platform_get_irq(pdev, 0);
@@ -121,7 +121,7 @@ err_free_input:
121 return error; 121 return error;
122} 122}
123 123
124static int __devexit mfld_pb_remove(struct platform_device *pdev) 124static int mfld_pb_remove(struct platform_device *pdev)
125{ 125{
126 struct input_dev *input = platform_get_drvdata(pdev); 126 struct input_dev *input = platform_get_drvdata(pdev);
127 int irq = platform_get_irq(pdev, 0); 127 int irq = platform_get_irq(pdev, 0);
@@ -139,7 +139,7 @@ static struct platform_driver mfld_pb_driver = {
139 .owner = THIS_MODULE, 139 .owner = THIS_MODULE,
140 }, 140 },
141 .probe = mfld_pb_probe, 141 .probe = mfld_pb_probe,
142 .remove = __devexit_p(mfld_pb_remove), 142 .remove = mfld_pb_remove,
143}; 143};
144 144
145module_platform_driver(mfld_pb_driver); 145module_platform_driver(mfld_pb_driver);
diff --git a/drivers/platform/x86/intel_mid_thermal.c b/drivers/platform/x86/intel_mid_thermal.c
index 93de09019d1d..81c491e74b34 100644
--- a/drivers/platform/x86/intel_mid_thermal.c
+++ b/drivers/platform/x86/intel_mid_thermal.c
@@ -563,7 +563,7 @@ static struct platform_driver mid_thermal_driver = {
563 .pm = &mid_thermal_pm, 563 .pm = &mid_thermal_pm,
564 }, 564 },
565 .probe = mid_thermal_probe, 565 .probe = mid_thermal_probe,
566 .remove = __devexit_p(mid_thermal_remove), 566 .remove = mid_thermal_remove,
567 .id_table = therm_id_table, 567 .id_table = therm_id_table,
568}; 568};
569 569
diff --git a/drivers/platform/x86/intel_oaktrail.c b/drivers/platform/x86/intel_oaktrail.c
index 79a0c2f6be53..f6f18cde0f11 100644
--- a/drivers/platform/x86/intel_oaktrail.c
+++ b/drivers/platform/x86/intel_oaktrail.c
@@ -278,12 +278,12 @@ static void oaktrail_backlight_exit(void)
278 backlight_device_unregister(oaktrail_bl_device); 278 backlight_device_unregister(oaktrail_bl_device);
279} 279}
280 280
281static int __devinit oaktrail_probe(struct platform_device *pdev) 281static int oaktrail_probe(struct platform_device *pdev)
282{ 282{
283 return 0; 283 return 0;
284} 284}
285 285
286static int __devexit oaktrail_remove(struct platform_device *pdev) 286static int oaktrail_remove(struct platform_device *pdev)
287{ 287{
288 return 0; 288 return 0;
289} 289}
@@ -294,7 +294,7 @@ static struct platform_driver oaktrail_driver = {
294 .owner = THIS_MODULE, 294 .owner = THIS_MODULE,
295 }, 295 },
296 .probe = oaktrail_probe, 296 .probe = oaktrail_probe,
297 .remove = __devexit_p(oaktrail_remove) 297 .remove = oaktrail_remove,
298}; 298};
299 299
300static int dmi_check_cb(const struct dmi_system_id *id) 300static int dmi_check_cb(const struct dmi_system_id *id)
diff --git a/drivers/platform/x86/intel_pmic_gpio.c b/drivers/platform/x86/intel_pmic_gpio.c
index 1686c1e07d5d..6f4b7289a059 100644
--- a/drivers/platform/x86/intel_pmic_gpio.c
+++ b/drivers/platform/x86/intel_pmic_gpio.c
@@ -230,7 +230,7 @@ static irqreturn_t pmic_irq_handler(int irq, void *data)
230 return ret; 230 return ret;
231} 231}
232 232
233static int __devinit platform_pmic_gpio_probe(struct platform_device *pdev) 233static int platform_pmic_gpio_probe(struct platform_device *pdev)
234{ 234{
235 struct device *dev = &pdev->dev; 235 struct device *dev = &pdev->dev;
236 int irq = platform_get_irq(pdev, 0); 236 int irq = platform_get_irq(pdev, 0);
diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
index dd90d15f5210..d1f030053176 100644
--- a/drivers/platform/x86/samsung-laptop.c
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -26,6 +26,7 @@
26#include <linux/seq_file.h> 26#include <linux/seq_file.h>
27#include <linux/debugfs.h> 27#include <linux/debugfs.h>
28#include <linux/ctype.h> 28#include <linux/ctype.h>
29#include <linux/efi.h>
29#include <acpi/video.h> 30#include <acpi/video.h>
30 31
31/* 32/*
@@ -1523,6 +1524,16 @@ static struct dmi_system_id __initdata samsung_dmi_table[] = {
1523 }, 1524 },
1524 .driver_data = &samsung_broken_acpi_video, 1525 .driver_data = &samsung_broken_acpi_video,
1525 }, 1526 },
1527 {
1528 .callback = samsung_dmi_matched,
1529 .ident = "N250P",
1530 .matches = {
1531 DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
1532 DMI_MATCH(DMI_PRODUCT_NAME, "N250P"),
1533 DMI_MATCH(DMI_BOARD_NAME, "N250P"),
1534 },
1535 .driver_data = &samsung_broken_acpi_video,
1536 },
1526 { }, 1537 { },
1527}; 1538};
1528MODULE_DEVICE_TABLE(dmi, samsung_dmi_table); 1539MODULE_DEVICE_TABLE(dmi, samsung_dmi_table);
@@ -1534,6 +1545,9 @@ static int __init samsung_init(void)
1534 struct samsung_laptop *samsung; 1545 struct samsung_laptop *samsung;
1535 int ret; 1546 int ret;
1536 1547
1548 if (efi_enabled(EFI_BOOT))
1549 return -ENODEV;
1550
1537 quirks = &samsung_unknown; 1551 quirks = &samsung_unknown;
1538 if (!force && !dmi_check_system(samsung_dmi_table)) 1552 if (!force && !dmi_check_system(samsung_dmi_table))
1539 return -ENODEV; 1553 return -ENODEV;
diff --git a/drivers/platform/x86/samsung-q10.c b/drivers/platform/x86/samsung-q10.c
index 1e54ae74274c..5f770059fd4d 100644
--- a/drivers/platform/x86/samsung-q10.c
+++ b/drivers/platform/x86/samsung-q10.c
@@ -77,7 +77,7 @@ static int samsungq10_resume(struct device *dev)
77static SIMPLE_DEV_PM_OPS(samsungq10_pm_ops, 77static SIMPLE_DEV_PM_OPS(samsungq10_pm_ops,
78 samsungq10_suspend, samsungq10_resume); 78 samsungq10_suspend, samsungq10_resume);
79 79
80static int __devinit samsungq10_probe(struct platform_device *pdev) 80static int samsungq10_probe(struct platform_device *pdev)
81{ 81{
82 82
83 struct backlight_properties props; 83 struct backlight_properties props;
@@ -99,7 +99,7 @@ static int __devinit samsungq10_probe(struct platform_device *pdev)
99 return 0; 99 return 0;
100} 100}
101 101
102static int __devexit samsungq10_remove(struct platform_device *pdev) 102static int samsungq10_remove(struct platform_device *pdev)
103{ 103{
104 104
105 struct backlight_device *bd = platform_get_drvdata(pdev); 105 struct backlight_device *bd = platform_get_drvdata(pdev);
@@ -119,7 +119,7 @@ static struct platform_driver samsungq10_driver = {
119 .pm = &samsungq10_pm_ops, 119 .pm = &samsungq10_pm_ops,
120 }, 120 },
121 .probe = samsungq10_probe, 121 .probe = samsungq10_probe,
122 .remove = __devexit_p(samsungq10_remove), 122 .remove = samsungq10_remove,
123}; 123};
124 124
125static struct platform_device *samsungq10_device; 125static struct platform_device *samsungq10_device;
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index daaddec68def..b8ad71f7863f 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -786,28 +786,29 @@ static int sony_nc_int_call(acpi_handle handle, char *name, int *value,
786static int sony_nc_buffer_call(acpi_handle handle, char *name, u64 *value, 786static int sony_nc_buffer_call(acpi_handle handle, char *name, u64 *value,
787 void *buffer, size_t buflen) 787 void *buffer, size_t buflen)
788{ 788{
789 int ret = 0;
789 size_t len = len; 790 size_t len = len;
790 union acpi_object *object = __call_snc_method(handle, name, value); 791 union acpi_object *object = __call_snc_method(handle, name, value);
791 792
792 if (!object) 793 if (!object)
793 return -EINVAL; 794 return -EINVAL;
794 795
795 if (object->type == ACPI_TYPE_BUFFER) 796 if (object->type == ACPI_TYPE_BUFFER) {
796 len = MIN(buflen, object->buffer.length); 797 len = MIN(buflen, object->buffer.length);
798 memcpy(buffer, object->buffer.pointer, len);
797 799
798 else if (object->type == ACPI_TYPE_INTEGER) 800 } else if (object->type == ACPI_TYPE_INTEGER) {
799 len = MIN(buflen, sizeof(object->integer.value)); 801 len = MIN(buflen, sizeof(object->integer.value));
802 memcpy(buffer, &object->integer.value, len);
800 803
801 else { 804 } else {
802 pr_warn("Invalid acpi_object: expected 0x%x got 0x%x\n", 805 pr_warn("Invalid acpi_object: expected 0x%x got 0x%x\n",
803 ACPI_TYPE_BUFFER, object->type); 806 ACPI_TYPE_BUFFER, object->type);
804 kfree(object); 807 ret = -EINVAL;
805 return -EINVAL;
806 } 808 }
807 809
808 memcpy(buffer, object->buffer.pointer, len);
809 kfree(object); 810 kfree(object);
810 return 0; 811 return ret;
811} 812}
812 813
813struct sony_nc_handles { 814struct sony_nc_handles {
diff --git a/drivers/platform/x86/tc1100-wmi.c b/drivers/platform/x86/tc1100-wmi.c
index e24f5ae475af..9b93fdb61ed7 100644
--- a/drivers/platform/x86/tc1100-wmi.c
+++ b/drivers/platform/x86/tc1100-wmi.c
@@ -187,7 +187,7 @@ static int __init tc1100_probe(struct platform_device *device)
187} 187}
188 188
189 189
190static int __devexit tc1100_remove(struct platform_device *device) 190static int tc1100_remove(struct platform_device *device)
191{ 191{
192 sysfs_remove_group(&device->dev.kobj, &tc1100_attribute_group); 192 sysfs_remove_group(&device->dev.kobj, &tc1100_attribute_group);
193 193
@@ -241,7 +241,7 @@ static struct platform_driver tc1100_driver = {
241 .pm = &tc1100_pm_ops, 241 .pm = &tc1100_pm_ops,
242#endif 242#endif
243 }, 243 },
244 .remove = __devexit_p(tc1100_remove), 244 .remove = tc1100_remove,
245}; 245};
246 246
247static int __init tc1100_init(void) 247static int __init tc1100_init(void)
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 75dd651664ae..f946ca7cb762 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -6732,7 +6732,7 @@ static int volume_alsa_mute_put(struct snd_kcontrol *kcontrol,
6732 return volume_alsa_set_mute(!ucontrol->value.integer.value[0]); 6732 return volume_alsa_set_mute(!ucontrol->value.integer.value[0]);
6733} 6733}
6734 6734
6735static struct snd_kcontrol_new volume_alsa_control_vol __devinitdata = { 6735static struct snd_kcontrol_new volume_alsa_control_vol = {
6736 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 6736 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6737 .name = "Console Playback Volume", 6737 .name = "Console Playback Volume",
6738 .index = 0, 6738 .index = 0,
@@ -6741,7 +6741,7 @@ static struct snd_kcontrol_new volume_alsa_control_vol __devinitdata = {
6741 .get = volume_alsa_vol_get, 6741 .get = volume_alsa_vol_get,
6742}; 6742};
6743 6743
6744static struct snd_kcontrol_new volume_alsa_control_mute __devinitdata = { 6744static struct snd_kcontrol_new volume_alsa_control_mute = {
6745 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 6745 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6746 .name = "Console Playback Switch", 6746 .name = "Console Playback Switch",
6747 .index = 0, 6747 .index = 0,
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index 5f1256d5e933..c2727895794c 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -150,7 +150,7 @@ static const struct acpi_device_id toshiba_device_ids[] = {
150}; 150};
151MODULE_DEVICE_TABLE(acpi, toshiba_device_ids); 151MODULE_DEVICE_TABLE(acpi, toshiba_device_ids);
152 152
153static const struct key_entry toshiba_acpi_keymap[] __devinitconst = { 153static const struct key_entry toshiba_acpi_keymap[] = {
154 { KE_KEY, 0x101, { KEY_MUTE } }, 154 { KE_KEY, 0x101, { KEY_MUTE } },
155 { KE_KEY, 0x102, { KEY_ZOOMOUT } }, 155 { KE_KEY, 0x102, { KEY_ZOOMOUT } },
156 { KE_KEY, 0x103, { KEY_ZOOMIN } }, 156 { KE_KEY, 0x103, { KEY_ZOOMIN } },
@@ -875,8 +875,7 @@ static const struct file_operations version_proc_fops = {
875 875
876#define PROC_TOSHIBA "toshiba" 876#define PROC_TOSHIBA "toshiba"
877 877
878static void __devinit 878static void create_toshiba_proc_entries(struct toshiba_acpi_dev *dev)
879create_toshiba_proc_entries(struct toshiba_acpi_dev *dev)
880{ 879{
881 if (dev->backlight_dev) 880 if (dev->backlight_dev)
882 proc_create_data("lcd", S_IRUGO | S_IWUSR, toshiba_proc_dir, 881 proc_create_data("lcd", S_IRUGO | S_IWUSR, toshiba_proc_dir,
@@ -979,7 +978,7 @@ static void toshiba_acpi_report_hotkey(struct toshiba_acpi_dev *dev,
979 pr_info("Unknown key %x\n", scancode); 978 pr_info("Unknown key %x\n", scancode);
980} 979}
981 980
982static int __devinit toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev) 981static int toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev)
983{ 982{
984 acpi_status status; 983 acpi_status status;
985 acpi_handle ec_handle, handle; 984 acpi_handle ec_handle, handle;
@@ -1069,7 +1068,7 @@ static int __devinit toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev)
1069 return error; 1068 return error;
1070} 1069}
1071 1070
1072static int __devinit toshiba_acpi_setup_backlight(struct toshiba_acpi_dev *dev) 1071static int toshiba_acpi_setup_backlight(struct toshiba_acpi_dev *dev)
1073{ 1072{
1074 struct backlight_properties props; 1073 struct backlight_properties props;
1075 int brightness; 1074 int brightness;
@@ -1154,7 +1153,7 @@ static int toshiba_acpi_remove(struct acpi_device *acpi_dev, int type)
1154 return 0; 1153 return 0;
1155} 1154}
1156 1155
1157static const char * __devinit find_hci_method(acpi_handle handle) 1156static const char *find_hci_method(acpi_handle handle)
1158{ 1157{
1159 acpi_status status; 1158 acpi_status status;
1160 acpi_handle hci_handle; 1159 acpi_handle hci_handle;
@@ -1170,7 +1169,7 @@ static const char * __devinit find_hci_method(acpi_handle handle)
1170 return NULL; 1169 return NULL;
1171} 1170}
1172 1171
1173static int __devinit toshiba_acpi_add(struct acpi_device *acpi_dev) 1172static int toshiba_acpi_add(struct acpi_device *acpi_dev)
1174{ 1173{
1175 struct toshiba_acpi_dev *dev; 1174 struct toshiba_acpi_dev *dev;
1176 const char *hci_method; 1175 const char *hci_method;
diff --git a/drivers/platform/x86/xo1-rfkill.c b/drivers/platform/x86/xo1-rfkill.c
index 1da13ed34b04..4bd17248dfc6 100644
--- a/drivers/platform/x86/xo1-rfkill.c
+++ b/drivers/platform/x86/xo1-rfkill.c
@@ -40,7 +40,7 @@ static const struct rfkill_ops rfkill_ops = {
40 .set_block = rfkill_set_block, 40 .set_block = rfkill_set_block,
41}; 41};
42 42
43static int __devinit xo1_rfkill_probe(struct platform_device *pdev) 43static int xo1_rfkill_probe(struct platform_device *pdev)
44{ 44{
45 struct rfkill *rfk; 45 struct rfkill *rfk;
46 int r; 46 int r;
@@ -60,7 +60,7 @@ static int __devinit xo1_rfkill_probe(struct platform_device *pdev)
60 return 0; 60 return 0;
61} 61}
62 62
63static int __devexit xo1_rfkill_remove(struct platform_device *pdev) 63static int xo1_rfkill_remove(struct platform_device *pdev)
64{ 64{
65 struct rfkill *rfk = platform_get_drvdata(pdev); 65 struct rfkill *rfk = platform_get_drvdata(pdev);
66 rfkill_unregister(rfk); 66 rfkill_unregister(rfk);
@@ -74,7 +74,7 @@ static struct platform_driver xo1_rfkill_driver = {
74 .owner = THIS_MODULE, 74 .owner = THIS_MODULE,
75 }, 75 },
76 .probe = xo1_rfkill_probe, 76 .probe = xo1_rfkill_probe,
77 .remove = __devexit_p(xo1_rfkill_remove), 77 .remove = xo1_rfkill_remove,
78}; 78};
79 79
80module_platform_driver(xo1_rfkill_driver); 80module_platform_driver(xo1_rfkill_driver);
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c
index cfaf5b73540b..0c201317284b 100644
--- a/drivers/pnp/interface.c
+++ b/drivers/pnp/interface.c
@@ -298,6 +298,39 @@ static ssize_t pnp_show_current_resources(struct device *dmdev,
298 return ret; 298 return ret;
299} 299}
300 300
301static char *pnp_get_resource_value(char *buf,
302 unsigned long type,
303 resource_size_t *start,
304 resource_size_t *end,
305 unsigned long *flags)
306{
307 if (start)
308 *start = 0;
309 if (end)
310 *end = 0;
311 if (flags)
312 *flags = 0;
313
314 /* TBD: allow for disabled resources */
315
316 buf = skip_spaces(buf);
317 if (start) {
318 *start = simple_strtoull(buf, &buf, 0);
319 if (end) {
320 buf = skip_spaces(buf);
321 if (*buf == '-') {
322 buf = skip_spaces(buf + 1);
323 *end = simple_strtoull(buf, &buf, 0);
324 } else
325 *end = *start;
326 }
327 }
328
329 /* TBD: allow for additional flags, e.g., IORESOURCE_WINDOW */
330
331 return buf;
332}
333
301static ssize_t pnp_set_current_resources(struct device *dmdev, 334static ssize_t pnp_set_current_resources(struct device *dmdev,
302 struct device_attribute *attr, 335 struct device_attribute *attr,
303 const char *ubuf, size_t count) 336 const char *ubuf, size_t count)
@@ -305,7 +338,6 @@ static ssize_t pnp_set_current_resources(struct device *dmdev,
305 struct pnp_dev *dev = to_pnp_dev(dmdev); 338 struct pnp_dev *dev = to_pnp_dev(dmdev);
306 char *buf = (void *)ubuf; 339 char *buf = (void *)ubuf;
307 int retval = 0; 340 int retval = 0;
308 resource_size_t start, end;
309 341
310 if (dev->status & PNP_ATTACHED) { 342 if (dev->status & PNP_ATTACHED) {
311 retval = -EBUSY; 343 retval = -EBUSY;
@@ -349,6 +381,10 @@ static ssize_t pnp_set_current_resources(struct device *dmdev,
349 goto done; 381 goto done;
350 } 382 }
351 if (!strnicmp(buf, "set", 3)) { 383 if (!strnicmp(buf, "set", 3)) {
384 resource_size_t start;
385 resource_size_t end;
386 unsigned long flags;
387
352 if (dev->active) 388 if (dev->active)
353 goto done; 389 goto done;
354 buf += 3; 390 buf += 3;
@@ -357,42 +393,37 @@ static ssize_t pnp_set_current_resources(struct device *dmdev,
357 while (1) { 393 while (1) {
358 buf = skip_spaces(buf); 394 buf = skip_spaces(buf);
359 if (!strnicmp(buf, "io", 2)) { 395 if (!strnicmp(buf, "io", 2)) {
360 buf = skip_spaces(buf + 2); 396 buf = pnp_get_resource_value(buf + 2,
361 start = simple_strtoul(buf, &buf, 0); 397 IORESOURCE_IO,
362 buf = skip_spaces(buf); 398 &start, &end,
363 if (*buf == '-') { 399 &flags);
364 buf = skip_spaces(buf + 1); 400 pnp_add_io_resource(dev, start, end, flags);
365 end = simple_strtoul(buf, &buf, 0); 401 } else if (!strnicmp(buf, "mem", 3)) {
366 } else 402 buf = pnp_get_resource_value(buf + 3,
367 end = start; 403 IORESOURCE_MEM,
368 pnp_add_io_resource(dev, start, end, 0); 404 &start, &end,
369 continue; 405 &flags);
370 } 406 pnp_add_mem_resource(dev, start, end, flags);
371 if (!strnicmp(buf, "mem", 3)) { 407 } else if (!strnicmp(buf, "irq", 3)) {
372 buf = skip_spaces(buf + 3); 408 buf = pnp_get_resource_value(buf + 3,
373 start = simple_strtoul(buf, &buf, 0); 409 IORESOURCE_IRQ,
374 buf = skip_spaces(buf); 410 &start, NULL,
375 if (*buf == '-') { 411 &flags);
376 buf = skip_spaces(buf + 1); 412 pnp_add_irq_resource(dev, start, flags);
377 end = simple_strtoul(buf, &buf, 0); 413 } else if (!strnicmp(buf, "dma", 3)) {
378 } else 414 buf = pnp_get_resource_value(buf + 3,
379 end = start; 415 IORESOURCE_DMA,
380 pnp_add_mem_resource(dev, start, end, 0); 416 &start, NULL,
381 continue; 417 &flags);
382 } 418 pnp_add_dma_resource(dev, start, flags);
383 if (!strnicmp(buf, "irq", 3)) { 419 } else if (!strnicmp(buf, "bus", 3)) {
384 buf = skip_spaces(buf + 3); 420 buf = pnp_get_resource_value(buf + 3,
385 start = simple_strtoul(buf, &buf, 0); 421 IORESOURCE_BUS,
386 pnp_add_irq_resource(dev, start, 0); 422 &start, &end,
387 continue; 423 NULL);
388 } 424 pnp_add_bus_resource(dev, start, end);
389 if (!strnicmp(buf, "dma", 3)) { 425 } else
390 buf = skip_spaces(buf + 3); 426 break;
391 start = simple_strtoul(buf, &buf, 0);
392 pnp_add_dma_resource(dev, start, 0);
393 continue;
394 }
395 break;
396 } 427 }
397 mutex_unlock(&pnp_res_mutex); 428 mutex_unlock(&pnp_res_mutex);
398 goto done; 429 goto done;
diff --git a/drivers/pnp/manager.c b/drivers/pnp/manager.c
index ed9ce507149a..95cebf0185de 100644
--- a/drivers/pnp/manager.c
+++ b/drivers/pnp/manager.c
@@ -18,11 +18,27 @@
18 18
19DEFINE_MUTEX(pnp_res_mutex); 19DEFINE_MUTEX(pnp_res_mutex);
20 20
21static struct resource *pnp_find_resource(struct pnp_dev *dev,
22 unsigned char rule,
23 unsigned long type,
24 unsigned int bar)
25{
26 struct resource *res = pnp_get_resource(dev, type, bar);
27
28 /* when the resource already exists, set its resource bits from rule */
29 if (res) {
30 res->flags &= ~IORESOURCE_BITS;
31 res->flags |= rule & IORESOURCE_BITS;
32 }
33
34 return res;
35}
36
21static int pnp_assign_port(struct pnp_dev *dev, struct pnp_port *rule, int idx) 37static int pnp_assign_port(struct pnp_dev *dev, struct pnp_port *rule, int idx)
22{ 38{
23 struct resource *res, local_res; 39 struct resource *res, local_res;
24 40
25 res = pnp_get_resource(dev, IORESOURCE_IO, idx); 41 res = pnp_find_resource(dev, rule->flags, IORESOURCE_IO, idx);
26 if (res) { 42 if (res) {
27 pnp_dbg(&dev->dev, " io %d already set to %#llx-%#llx " 43 pnp_dbg(&dev->dev, " io %d already set to %#llx-%#llx "
28 "flags %#lx\n", idx, (unsigned long long) res->start, 44 "flags %#lx\n", idx, (unsigned long long) res->start,
@@ -65,7 +81,7 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx)
65{ 81{
66 struct resource *res, local_res; 82 struct resource *res, local_res;
67 83
68 res = pnp_get_resource(dev, IORESOURCE_MEM, idx); 84 res = pnp_find_resource(dev, rule->flags, IORESOURCE_MEM, idx);
69 if (res) { 85 if (res) {
70 pnp_dbg(&dev->dev, " mem %d already set to %#llx-%#llx " 86 pnp_dbg(&dev->dev, " mem %d already set to %#llx-%#llx "
71 "flags %#lx\n", idx, (unsigned long long) res->start, 87 "flags %#lx\n", idx, (unsigned long long) res->start,
@@ -78,6 +94,7 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx)
78 res->start = 0; 94 res->start = 0;
79 res->end = 0; 95 res->end = 0;
80 96
97 /* ??? rule->flags restricted to 8 bits, all tests bogus ??? */
81 if (!(rule->flags & IORESOURCE_MEM_WRITEABLE)) 98 if (!(rule->flags & IORESOURCE_MEM_WRITEABLE))
82 res->flags |= IORESOURCE_READONLY; 99 res->flags |= IORESOURCE_READONLY;
83 if (rule->flags & IORESOURCE_MEM_CACHEABLE) 100 if (rule->flags & IORESOURCE_MEM_CACHEABLE)
@@ -123,7 +140,7 @@ static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx)
123 5, 10, 11, 12, 9, 14, 15, 7, 3, 4, 13, 0, 1, 6, 8, 2 140 5, 10, 11, 12, 9, 14, 15, 7, 3, 4, 13, 0, 1, 6, 8, 2
124 }; 141 };
125 142
126 res = pnp_get_resource(dev, IORESOURCE_IRQ, idx); 143 res = pnp_find_resource(dev, rule->flags, IORESOURCE_IRQ, idx);
127 if (res) { 144 if (res) {
128 pnp_dbg(&dev->dev, " irq %d already set to %d flags %#lx\n", 145 pnp_dbg(&dev->dev, " irq %d already set to %d flags %#lx\n",
129 idx, (int) res->start, res->flags); 146 idx, (int) res->start, res->flags);
@@ -182,7 +199,7 @@ static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
182 1, 3, 5, 6, 7, 0, 2, 4 199 1, 3, 5, 6, 7, 0, 2, 4
183 }; 200 };
184 201
185 res = pnp_get_resource(dev, IORESOURCE_DMA, idx); 202 res = pnp_find_resource(dev, rule->flags, IORESOURCE_DMA, idx);
186 if (res) { 203 if (res) {
187 pnp_dbg(&dev->dev, " dma %d already set to %d flags %#lx\n", 204 pnp_dbg(&dev->dev, " dma %d already set to %d flags %#lx\n",
188 idx, (int) res->start, res->flags); 205 idx, (int) res->start, res->flags);
diff --git a/drivers/power/ab8500_bmdata.c b/drivers/power/ab8500_bmdata.c
index 03cc528425cb..f034ae43e045 100644
--- a/drivers/power/ab8500_bmdata.c
+++ b/drivers/power/ab8500_bmdata.c
@@ -452,10 +452,8 @@ struct abx500_bm_data ab8500_bm_data = {
452 .fg_params = &fg, 452 .fg_params = &fg,
453}; 453};
454 454
455int __devinit 455int bmdevs_of_probe(struct device *dev, struct device_node *np,
456bmdevs_of_probe(struct device *dev, 456 struct abx500_bm_data **battery)
457 struct device_node *np,
458 struct abx500_bm_data **battery)
459{ 457{
460 struct abx500_battery_type *btype; 458 struct abx500_battery_type *btype;
461 struct device_node *np_bat_supply; 459 struct device_node *np_bat_supply;
diff --git a/drivers/power/avs/smartreflex.c b/drivers/power/avs/smartreflex.c
index a17d08411723..6b2238bb6a81 100644
--- a/drivers/power/avs/smartreflex.c
+++ b/drivers/power/avs/smartreflex.c
@@ -27,8 +27,6 @@
27#include <linux/pm_runtime.h> 27#include <linux/pm_runtime.h>
28#include <linux/power/smartreflex.h> 28#include <linux/power/smartreflex.h>
29 29
30#include <plat/cpu.h>
31
32#define SMARTREFLEX_NAME_LEN 16 30#define SMARTREFLEX_NAME_LEN 16
33#define NVALUE_NAME_LEN 40 31#define NVALUE_NAME_LEN 40
34#define SR_DISABLE_TIMEOUT 200 32#define SR_DISABLE_TIMEOUT 200
diff --git a/drivers/power/olpc_battery.c b/drivers/power/olpc_battery.c
index 298c47d111b4..1ec810ada5ed 100644
--- a/drivers/power/olpc_battery.c
+++ b/drivers/power/olpc_battery.c
@@ -668,7 +668,7 @@ static int olpc_battery_remove(struct platform_device *pdev)
668 return 0; 668 return 0;
669} 669}
670 670
671static const struct of_device_id olpc_battery_ids[] __devinitconst = { 671static const struct of_device_id olpc_battery_ids[] = {
672 { .compatible = "olpc,xo1-battery" }, 672 { .compatible = "olpc,xo1-battery" },
673 {} 673 {}
674}; 674};
diff --git a/drivers/power/reset/gpio-poweroff.c b/drivers/power/reset/gpio-poweroff.c
index 0491e5335d02..e290d48ddd99 100644
--- a/drivers/power/reset/gpio-poweroff.c
+++ b/drivers/power/reset/gpio-poweroff.c
@@ -29,15 +29,16 @@ static int gpio_active_low;
29 29
30static void gpio_poweroff_do_poweroff(void) 30static void gpio_poweroff_do_poweroff(void)
31{ 31{
32 BUG_ON(gpio_num == -1); 32 BUG_ON(!gpio_is_valid(gpio_num));
33 33
34 /* drive it active */ 34 /* drive it active, also inactive->active edge */
35 gpio_direction_output(gpio_num, !gpio_active_low); 35 gpio_direction_output(gpio_num, !gpio_active_low);
36 mdelay(100); 36 mdelay(100);
37 /* rising edge or drive inactive */ 37 /* drive inactive, also active->inactive edge */
38 gpio_set_value(gpio_num, gpio_active_low); 38 gpio_set_value(gpio_num, gpio_active_low);
39 mdelay(100); 39 mdelay(100);
40 /* falling edge */ 40
41 /* drive it active, also inactive->active edge */
41 gpio_set_value(gpio_num, !gpio_active_low); 42 gpio_set_value(gpio_num, !gpio_active_low);
42 43
43 /* give it some time */ 44 /* give it some time */
@@ -46,7 +47,7 @@ static void gpio_poweroff_do_poweroff(void)
46 WARN_ON(1); 47 WARN_ON(1);
47} 48}
48 49
49static int __devinit gpio_poweroff_probe(struct platform_device *pdev) 50static int gpio_poweroff_probe(struct platform_device *pdev)
50{ 51{
51 enum of_gpio_flags flags; 52 enum of_gpio_flags flags;
52 bool input = false; 53 bool input = false;
@@ -60,15 +61,12 @@ static int __devinit gpio_poweroff_probe(struct platform_device *pdev)
60 } 61 }
61 62
62 gpio_num = of_get_gpio_flags(pdev->dev.of_node, 0, &flags); 63 gpio_num = of_get_gpio_flags(pdev->dev.of_node, 0, &flags);
63 if (gpio_num < 0) { 64 if (!gpio_is_valid(gpio_num))
64 pr_err("%s: Could not get GPIO configuration: %d", 65 return gpio_num;
65 __func__, gpio_num); 66
66 return -ENODEV;
67 }
68 gpio_active_low = flags & OF_GPIO_ACTIVE_LOW; 67 gpio_active_low = flags & OF_GPIO_ACTIVE_LOW;
69 68
70 if (of_get_property(pdev->dev.of_node, "input", NULL)) 69 input = of_property_read_bool(pdev->dev.of_node, "input");
71 input = true;
72 70
73 ret = gpio_request(gpio_num, "poweroff-gpio"); 71 ret = gpio_request(gpio_num, "poweroff-gpio");
74 if (ret) { 72 if (ret) {
@@ -96,10 +94,9 @@ err:
96 return -ENODEV; 94 return -ENODEV;
97} 95}
98 96
99static int __devexit gpio_poweroff_remove(struct platform_device *pdev) 97static int gpio_poweroff_remove(struct platform_device *pdev)
100{ 98{
101 if (gpio_num != -1) 99 gpio_free(gpio_num);
102 gpio_free(gpio_num);
103 if (pm_power_off == &gpio_poweroff_do_poweroff) 100 if (pm_power_off == &gpio_poweroff_do_poweroff)
104 pm_power_off = NULL; 101 pm_power_off = NULL;
105 102
@@ -113,17 +110,17 @@ static const struct of_device_id of_gpio_poweroff_match[] = {
113 110
114static struct platform_driver gpio_poweroff_driver = { 111static struct platform_driver gpio_poweroff_driver = {
115 .probe = gpio_poweroff_probe, 112 .probe = gpio_poweroff_probe,
116 .remove = __devexit_p(gpio_poweroff_remove), 113 .remove = gpio_poweroff_remove,
117 .driver = { 114 .driver = {
118 .name = "poweroff-gpio", 115 .name = "poweroff-gpio",
119 .owner = THIS_MODULE, 116 .owner = THIS_MODULE,
120 .of_match_table = of_gpio_poweroff_match, 117 .of_match_table = of_gpio_poweroff_match,
121 }, 118 },
122}; 119};
123 120
124module_platform_driver(gpio_poweroff_driver); 121module_platform_driver(gpio_poweroff_driver);
125 122
126MODULE_AUTHOR("Jamie Lentin <jm@lentin.co.uk>"); 123MODULE_AUTHOR("Jamie Lentin <jm@lentin.co.uk>");
127MODULE_DESCRIPTION("GPIO poweroff driver"); 124MODULE_DESCRIPTION("GPIO poweroff driver");
128MODULE_LICENSE("GPL"); 125MODULE_LICENSE("GPL v2");
129MODULE_ALIAS("platform:poweroff-gpio"); 126MODULE_ALIAS("platform:poweroff-gpio");
diff --git a/drivers/power/rx51_battery.c b/drivers/power/rx51_battery.c
index ca49d6c0ee9d..8208888b844e 100644
--- a/drivers/power/rx51_battery.c
+++ b/drivers/power/rx51_battery.c
@@ -197,7 +197,7 @@ static enum power_supply_property rx51_battery_props[] = {
197 POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, 197 POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
198}; 198};
199 199
200static int __devinit rx51_battery_probe(struct platform_device *pdev) 200static int rx51_battery_probe(struct platform_device *pdev)
201{ 201{
202 struct rx51_device_info *di; 202 struct rx51_device_info *di;
203 int ret; 203 int ret;
@@ -224,7 +224,7 @@ static int __devinit rx51_battery_probe(struct platform_device *pdev)
224 return 0; 224 return 0;
225} 225}
226 226
227static int __devexit rx51_battery_remove(struct platform_device *pdev) 227static int rx51_battery_remove(struct platform_device *pdev)
228{ 228{
229 struct rx51_device_info *di = platform_get_drvdata(pdev); 229 struct rx51_device_info *di = platform_get_drvdata(pdev);
230 230
@@ -237,7 +237,7 @@ static int __devexit rx51_battery_remove(struct platform_device *pdev)
237 237
238static struct platform_driver rx51_battery_driver = { 238static struct platform_driver rx51_battery_driver = {
239 .probe = rx51_battery_probe, 239 .probe = rx51_battery_probe,
240 .remove = __devexit_p(rx51_battery_remove), 240 .remove = rx51_battery_remove,
241 .driver = { 241 .driver = {
242 .name = "rx51-battery", 242 .name = "rx51-battery",
243 .owner = THIS_MODULE, 243 .owner = THIS_MODULE,
diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
index 655055545479..2bf0c1b608dd 100644
--- a/drivers/pps/clients/pps-gpio.c
+++ b/drivers/pps/clients/pps-gpio.c
@@ -196,7 +196,7 @@ static int pps_gpio_remove(struct platform_device *pdev)
196 196
197static struct platform_driver pps_gpio_driver = { 197static struct platform_driver pps_gpio_driver = {
198 .probe = pps_gpio_probe, 198 .probe = pps_gpio_probe,
199 .remove = __devexit_p(pps_gpio_remove), 199 .remove = pps_gpio_remove,
200 .driver = { 200 .driver = {
201 .name = PPS_GPIO_NAME, 201 .name = PPS_GPIO_NAME,
202 .owner = THIS_MODULE 202 .owner = THIS_MODULE
diff --git a/drivers/ps3/ps3-lpm.c b/drivers/ps3/ps3-lpm.c
index 643697f71390..b139b7792e9f 100644
--- a/drivers/ps3/ps3-lpm.c
+++ b/drivers/ps3/ps3-lpm.c
@@ -1185,7 +1185,7 @@ int ps3_lpm_close(void)
1185} 1185}
1186EXPORT_SYMBOL_GPL(ps3_lpm_close); 1186EXPORT_SYMBOL_GPL(ps3_lpm_close);
1187 1187
1188static int __devinit ps3_lpm_probe(struct ps3_system_bus_device *dev) 1188static int ps3_lpm_probe(struct ps3_system_bus_device *dev)
1189{ 1189{
1190 dev_dbg(&dev->core, " -> %s:%u\n", __func__, __LINE__); 1190 dev_dbg(&dev->core, " -> %s:%u\n", __func__, __LINE__);
1191 1191
diff --git a/drivers/ps3/ps3-sys-manager.c b/drivers/ps3/ps3-sys-manager.c
index 1b98367110c4..f2ab435954f6 100644
--- a/drivers/ps3/ps3-sys-manager.c
+++ b/drivers/ps3/ps3-sys-manager.c
@@ -706,7 +706,7 @@ static void ps3_sys_manager_work(struct ps3_system_bus_device *dev)
706 ps3_vuart_read_async(dev, PS3_SM_RX_MSG_LEN_MIN); 706 ps3_vuart_read_async(dev, PS3_SM_RX_MSG_LEN_MIN);
707} 707}
708 708
709static int __devinit ps3_sys_manager_probe(struct ps3_system_bus_device *dev) 709static int ps3_sys_manager_probe(struct ps3_system_bus_device *dev)
710{ 710{
711 int result; 711 int result;
712 struct ps3_sys_manager_ops ops; 712 struct ps3_sys_manager_ops ops;
diff --git a/drivers/ps3/ps3av.c b/drivers/ps3/ps3av.c
index 93d0a8b7718a..437fc35beb7b 100644
--- a/drivers/ps3/ps3av.c
+++ b/drivers/ps3/ps3av.c
@@ -932,7 +932,7 @@ int ps3av_audio_mute(int mute)
932} 932}
933EXPORT_SYMBOL_GPL(ps3av_audio_mute); 933EXPORT_SYMBOL_GPL(ps3av_audio_mute);
934 934
935static int __devinit ps3av_probe(struct ps3_system_bus_device *dev) 935static int ps3av_probe(struct ps3_system_bus_device *dev)
936{ 936{
937 int res; 937 int res;
938 int id; 938 int id;
diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c
index 0199eeea63b1..8f39cac661d2 100644
--- a/drivers/regulator/anatop-regulator.c
+++ b/drivers/regulator/anatop-regulator.c
@@ -188,7 +188,7 @@ static int anatop_regulator_remove(struct platform_device *pdev)
188 return 0; 188 return 0;
189} 189}
190 190
191static struct of_device_id __devinitdata of_anatop_regulator_match_tbl[] = { 191static struct of_device_id of_anatop_regulator_match_tbl[] = {
192 { .compatible = "fsl,anatop-regulator", }, 192 { .compatible = "fsl,anatop-regulator", },
193 { /* end */ } 193 { /* end */ }
194}; 194};
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 0f65b246cc0c..278584302f2d 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1885,9 +1885,15 @@ int regulator_can_change_voltage(struct regulator *regulator)
1885 struct regulator_dev *rdev = regulator->rdev; 1885 struct regulator_dev *rdev = regulator->rdev;
1886 1886
1887 if (rdev->constraints && 1887 if (rdev->constraints &&
1888 rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE && 1888 (rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) {
1889 (rdev->desc->n_voltages - rdev->desc->linear_min_sel) > 1) 1889 if (rdev->desc->n_voltages - rdev->desc->linear_min_sel > 1)
1890 return 1; 1890 return 1;
1891
1892 if (rdev->desc->continuous_voltage_range &&
1893 rdev->constraints->min_uV && rdev->constraints->max_uV &&
1894 rdev->constraints->min_uV != rdev->constraints->max_uV)
1895 return 1;
1896 }
1891 1897
1892 return 0; 1898 return 0;
1893} 1899}
@@ -3315,7 +3321,8 @@ static void rdev_init_debugfs(struct regulator_dev *rdev)
3315 * @config: runtime configuration for regulator 3321 * @config: runtime configuration for regulator
3316 * 3322 *
3317 * Called by regulator drivers to register a regulator. 3323 * Called by regulator drivers to register a regulator.
3318 * Returns 0 on success. 3324 * Returns a valid pointer to struct regulator_dev on success
3325 * or an ERR_PTR() on error.
3319 */ 3326 */
3320struct regulator_dev * 3327struct regulator_dev *
3321regulator_register(const struct regulator_desc *regulator_desc, 3328regulator_register(const struct regulator_desc *regulator_desc,
diff --git a/drivers/regulator/da9055-regulator.c b/drivers/regulator/da9055-regulator.c
index a4b9cb8c4317..1a05ac66878f 100644
--- a/drivers/regulator/da9055-regulator.c
+++ b/drivers/regulator/da9055-regulator.c
@@ -442,9 +442,9 @@ static struct da9055_regulator_info da9055_regulator_info[] = {
442 * GPIO can control regulator state and/or select the regulator register 442 * GPIO can control regulator state and/or select the regulator register
443 * set A/B for voltage ramping. 443 * set A/B for voltage ramping.
444 */ 444 */
445static __devinit int da9055_gpio_init(struct da9055_regulator *regulator, 445static int da9055_gpio_init(struct da9055_regulator *regulator,
446 struct regulator_config *config, 446 struct regulator_config *config,
447 struct da9055_pdata *pdata, int id) 447 struct da9055_pdata *pdata, int id)
448{ 448{
449 struct da9055_regulator_info *info = regulator->info; 449 struct da9055_regulator_info *info = regulator->info;
450 int ret = 0; 450 int ret = 0;
@@ -533,7 +533,7 @@ static inline struct da9055_regulator_info *find_regulator_info(int id)
533 return NULL; 533 return NULL;
534} 534}
535 535
536static int __devinit da9055_regulator_probe(struct platform_device *pdev) 536static int da9055_regulator_probe(struct platform_device *pdev)
537{ 537{
538 struct regulator_config config = { }; 538 struct regulator_config config = { };
539 struct da9055_regulator *regulator; 539 struct da9055_regulator *regulator;
@@ -605,7 +605,7 @@ err_regulator:
605 return ret; 605 return ret;
606} 606}
607 607
608static int __devexit da9055_regulator_remove(struct platform_device *pdev) 608static int da9055_regulator_remove(struct platform_device *pdev)
609{ 609{
610 struct da9055_regulator *regulator = platform_get_drvdata(pdev); 610 struct da9055_regulator *regulator = platform_get_drvdata(pdev);
611 611
@@ -616,7 +616,7 @@ static int __devexit da9055_regulator_remove(struct platform_device *pdev)
616 616
617static struct platform_driver da9055_regulator_driver = { 617static struct platform_driver da9055_regulator_driver = {
618 .probe = da9055_regulator_probe, 618 .probe = da9055_regulator_probe,
619 .remove = __devexit_p(da9055_regulator_remove), 619 .remove = da9055_regulator_remove,
620 .driver = { 620 .driver = {
621 .name = "da9055-regulator", 621 .name = "da9055-regulator",
622 .owner = THIS_MODULE, 622 .owner = THIS_MODULE,
diff --git a/drivers/regulator/dbx500-prcmu.c b/drivers/regulator/dbx500-prcmu.c
index 261f3d2299bc..89bd2faaef8c 100644
--- a/drivers/regulator/dbx500-prcmu.c
+++ b/drivers/regulator/dbx500-prcmu.c
@@ -14,6 +14,7 @@
14#include <linux/debugfs.h> 14#include <linux/debugfs.h>
15#include <linux/seq_file.h> 15#include <linux/seq_file.h>
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/module.h>
17 18
18#include "dbx500-prcmu.h" 19#include "dbx500-prcmu.h"
19 20
diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index 48d5b7608b00..e5c03b534fae 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -246,7 +246,7 @@ static int reg_fixed_voltage_remove(struct platform_device *pdev)
246} 246}
247 247
248#if defined(CONFIG_OF) 248#if defined(CONFIG_OF)
249static const struct of_device_id fixed_of_match[] __devinitconst = { 249static const struct of_device_id fixed_of_match[] = {
250 { .compatible = "regulator-fixed", }, 250 { .compatible = "regulator-fixed", },
251 {}, 251 {},
252}; 252};
diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c
index 8ae288fc150b..bae681ccd3ea 100644
--- a/drivers/regulator/gpio-regulator.c
+++ b/drivers/regulator/gpio-regulator.c
@@ -365,7 +365,7 @@ static int gpio_regulator_remove(struct platform_device *pdev)
365} 365}
366 366
367#if defined(CONFIG_OF) 367#if defined(CONFIG_OF)
368static const struct of_device_id regulator_gpio_of_match[] __devinitconst = { 368static const struct of_device_id regulator_gpio_of_match[] = {
369 { .compatible = "regulator-gpio", }, 369 { .compatible = "regulator-gpio", },
370 {}, 370 {},
371}; 371};
diff --git a/drivers/regulator/max8973-regulator.c b/drivers/regulator/max8973-regulator.c
index 3ee26387b121..9a8ea9163005 100644
--- a/drivers/regulator/max8973-regulator.c
+++ b/drivers/regulator/max8973-regulator.c
@@ -248,8 +248,8 @@ static struct regulator_ops max8973_dcdc_ops = {
248 .get_mode = max8973_dcdc_get_mode, 248 .get_mode = max8973_dcdc_get_mode,
249}; 249};
250 250
251static int __devinit max8973_init_dcdc(struct max8973_chip *max, 251static int max8973_init_dcdc(struct max8973_chip *max,
252 struct max8973_regulator_platform_data *pdata) 252 struct max8973_regulator_platform_data *pdata)
253{ 253{
254 int ret; 254 int ret;
255 uint8_t control1 = 0; 255 uint8_t control1 = 0;
@@ -359,8 +359,8 @@ static const struct regmap_config max8973_regmap_config = {
359 .cache_type = REGCACHE_RBTREE, 359 .cache_type = REGCACHE_RBTREE,
360}; 360};
361 361
362static int __devinit max8973_probe(struct i2c_client *client, 362static int max8973_probe(struct i2c_client *client,
363 const struct i2c_device_id *id) 363 const struct i2c_device_id *id)
364{ 364{
365 struct max8973_regulator_platform_data *pdata; 365 struct max8973_regulator_platform_data *pdata;
366 struct regulator_config config = { }; 366 struct regulator_config config = { };
@@ -463,7 +463,7 @@ static int __devinit max8973_probe(struct i2c_client *client,
463 return 0; 463 return 0;
464} 464}
465 465
466static int __devexit max8973_remove(struct i2c_client *client) 466static int max8973_remove(struct i2c_client *client)
467{ 467{
468 struct max8973_chip *max = i2c_get_clientdata(client); 468 struct max8973_chip *max = i2c_get_clientdata(client);
469 469
@@ -484,7 +484,7 @@ static struct i2c_driver max8973_i2c_driver = {
484 .owner = THIS_MODULE, 484 .owner = THIS_MODULE,
485 }, 485 },
486 .probe = max8973_probe, 486 .probe = max8973_probe,
487 .remove = __devexit_p(max8973_remove), 487 .remove = max8973_remove,
488 .id_table = max8973_id, 488 .id_table = max8973_id,
489}; 489};
490 490
diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c
index df0eafb0dc7e..02be7fcae32f 100644
--- a/drivers/regulator/max8997.c
+++ b/drivers/regulator/max8997.c
@@ -71,26 +71,26 @@ struct voltage_map_desc {
71 int step; 71 int step;
72}; 72};
73 73
74/* Voltage maps in mV */ 74/* Voltage maps in uV */
75static const struct voltage_map_desc ldo_voltage_map_desc = { 75static const struct voltage_map_desc ldo_voltage_map_desc = {
76 .min = 800, .max = 3950, .step = 50, 76 .min = 800000, .max = 3950000, .step = 50000,
77}; /* LDO1 ~ 18, 21 all */ 77}; /* LDO1 ~ 18, 21 all */
78 78
79static const struct voltage_map_desc buck1245_voltage_map_desc = { 79static const struct voltage_map_desc buck1245_voltage_map_desc = {
80 .min = 650, .max = 2225, .step = 25, 80 .min = 650000, .max = 2225000, .step = 25000,
81}; /* Buck1, 2, 4, 5 */ 81}; /* Buck1, 2, 4, 5 */
82 82
83static const struct voltage_map_desc buck37_voltage_map_desc = { 83static const struct voltage_map_desc buck37_voltage_map_desc = {
84 .min = 750, .max = 3900, .step = 50, 84 .min = 750000, .max = 3900000, .step = 50000,
85}; /* Buck3, 7 */ 85}; /* Buck3, 7 */
86 86
87/* current map in mA */ 87/* current map in uA */
88static const struct voltage_map_desc charger_current_map_desc = { 88static const struct voltage_map_desc charger_current_map_desc = {
89 .min = 200, .max = 950, .step = 50, 89 .min = 200000, .max = 950000, .step = 50000,
90}; 90};
91 91
92static const struct voltage_map_desc topoff_current_map_desc = { 92static const struct voltage_map_desc topoff_current_map_desc = {
93 .min = 50, .max = 200, .step = 10, 93 .min = 50000, .max = 200000, .step = 10000,
94}; 94};
95 95
96static const struct voltage_map_desc *reg_voltage_map[] = { 96static const struct voltage_map_desc *reg_voltage_map[] = {
@@ -194,7 +194,7 @@ static int max8997_list_voltage(struct regulator_dev *rdev,
194 if (val > desc->max) 194 if (val > desc->max)
195 return -EINVAL; 195 return -EINVAL;
196 196
197 return val * 1000; 197 return val;
198} 198}
199 199
200static int max8997_get_enable_register(struct regulator_dev *rdev, 200static int max8997_get_enable_register(struct regulator_dev *rdev,
@@ -485,7 +485,6 @@ static int max8997_set_voltage_ldobuck(struct regulator_dev *rdev,
485{ 485{
486 struct max8997_data *max8997 = rdev_get_drvdata(rdev); 486 struct max8997_data *max8997 = rdev_get_drvdata(rdev);
487 struct i2c_client *i2c = max8997->iodev->i2c; 487 struct i2c_client *i2c = max8997->iodev->i2c;
488 int min_vol = min_uV / 1000, max_vol = max_uV / 1000;
489 const struct voltage_map_desc *desc; 488 const struct voltage_map_desc *desc;
490 int rid = rdev_get_id(rdev); 489 int rid = rdev_get_id(rdev);
491 int i, reg, shift, mask, ret; 490 int i, reg, shift, mask, ret;
@@ -509,7 +508,7 @@ static int max8997_set_voltage_ldobuck(struct regulator_dev *rdev,
509 508
510 desc = reg_voltage_map[rid]; 509 desc = reg_voltage_map[rid];
511 510
512 i = max8997_get_voltage_proper_val(desc, min_vol, max_vol); 511 i = max8997_get_voltage_proper_val(desc, min_uV, max_uV);
513 if (i < 0) 512 if (i < 0)
514 return i; 513 return i;
515 514
@@ -557,7 +556,7 @@ static int max8997_set_voltage_ldobuck_time_sel(struct regulator_dev *rdev,
557 case MAX8997_BUCK4: 556 case MAX8997_BUCK4:
558 case MAX8997_BUCK5: 557 case MAX8997_BUCK5:
559 return DIV_ROUND_UP(desc->step * (new_selector - old_selector), 558 return DIV_ROUND_UP(desc->step * (new_selector - old_selector),
560 max8997->ramp_delay); 559 max8997->ramp_delay * 1000);
561 } 560 }
562 561
563 return 0; 562 return 0;
@@ -656,7 +655,6 @@ static int max8997_set_voltage_buck(struct regulator_dev *rdev,
656 const struct voltage_map_desc *desc; 655 const struct voltage_map_desc *desc;
657 int new_val, new_idx, damage, tmp_val, tmp_idx, tmp_dmg; 656 int new_val, new_idx, damage, tmp_val, tmp_idx, tmp_dmg;
658 bool gpio_dvs_mode = false; 657 bool gpio_dvs_mode = false;
659 int min_vol = min_uV / 1000, max_vol = max_uV / 1000;
660 658
661 if (rid < MAX8997_BUCK1 || rid > MAX8997_BUCK7) 659 if (rid < MAX8997_BUCK1 || rid > MAX8997_BUCK7)
662 return -EINVAL; 660 return -EINVAL;
@@ -681,7 +679,7 @@ static int max8997_set_voltage_buck(struct regulator_dev *rdev,
681 selector); 679 selector);
682 680
683 desc = reg_voltage_map[rid]; 681 desc = reg_voltage_map[rid];
684 new_val = max8997_get_voltage_proper_val(desc, min_vol, max_vol); 682 new_val = max8997_get_voltage_proper_val(desc, min_uV, max_uV);
685 if (new_val < 0) 683 if (new_val < 0)
686 return new_val; 684 return new_val;
687 685
@@ -1123,8 +1121,8 @@ static int max8997_pmic_probe(struct platform_device *pdev)
1123 max8997->buck1_vol[i] = ret = 1121 max8997->buck1_vol[i] = ret =
1124 max8997_get_voltage_proper_val( 1122 max8997_get_voltage_proper_val(
1125 &buck1245_voltage_map_desc, 1123 &buck1245_voltage_map_desc,
1126 pdata->buck1_voltage[i] / 1000, 1124 pdata->buck1_voltage[i],
1127 pdata->buck1_voltage[i] / 1000 + 1125 pdata->buck1_voltage[i] +
1128 buck1245_voltage_map_desc.step); 1126 buck1245_voltage_map_desc.step);
1129 if (ret < 0) 1127 if (ret < 0)
1130 goto err_out; 1128 goto err_out;
@@ -1132,8 +1130,8 @@ static int max8997_pmic_probe(struct platform_device *pdev)
1132 max8997->buck2_vol[i] = ret = 1130 max8997->buck2_vol[i] = ret =
1133 max8997_get_voltage_proper_val( 1131 max8997_get_voltage_proper_val(
1134 &buck1245_voltage_map_desc, 1132 &buck1245_voltage_map_desc,
1135 pdata->buck2_voltage[i] / 1000, 1133 pdata->buck2_voltage[i],
1136 pdata->buck2_voltage[i] / 1000 + 1134 pdata->buck2_voltage[i] +
1137 buck1245_voltage_map_desc.step); 1135 buck1245_voltage_map_desc.step);
1138 if (ret < 0) 1136 if (ret < 0)
1139 goto err_out; 1137 goto err_out;
@@ -1141,8 +1139,8 @@ static int max8997_pmic_probe(struct platform_device *pdev)
1141 max8997->buck5_vol[i] = ret = 1139 max8997->buck5_vol[i] = ret =
1142 max8997_get_voltage_proper_val( 1140 max8997_get_voltage_proper_val(
1143 &buck1245_voltage_map_desc, 1141 &buck1245_voltage_map_desc,
1144 pdata->buck5_voltage[i] / 1000, 1142 pdata->buck5_voltage[i],
1145 pdata->buck5_voltage[i] / 1000 + 1143 pdata->buck5_voltage[i] +
1146 buck1245_voltage_map_desc.step); 1144 buck1245_voltage_map_desc.step);
1147 if (ret < 0) 1145 if (ret < 0)
1148 goto err_out; 1146 goto err_out;
diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c
index b821d08eb64a..1f0df4046b86 100644
--- a/drivers/regulator/max8998.c
+++ b/drivers/regulator/max8998.c
@@ -51,39 +51,39 @@ struct voltage_map_desc {
51 int step; 51 int step;
52}; 52};
53 53
54/* Voltage maps */ 54/* Voltage maps in uV*/
55static const struct voltage_map_desc ldo23_voltage_map_desc = { 55static const struct voltage_map_desc ldo23_voltage_map_desc = {
56 .min = 800, .step = 50, .max = 1300, 56 .min = 800000, .step = 50000, .max = 1300000,
57}; 57};
58static const struct voltage_map_desc ldo456711_voltage_map_desc = { 58static const struct voltage_map_desc ldo456711_voltage_map_desc = {
59 .min = 1600, .step = 100, .max = 3600, 59 .min = 1600000, .step = 100000, .max = 3600000,
60}; 60};
61static const struct voltage_map_desc ldo8_voltage_map_desc = { 61static const struct voltage_map_desc ldo8_voltage_map_desc = {
62 .min = 3000, .step = 100, .max = 3600, 62 .min = 3000000, .step = 100000, .max = 3600000,
63}; 63};
64static const struct voltage_map_desc ldo9_voltage_map_desc = { 64static const struct voltage_map_desc ldo9_voltage_map_desc = {
65 .min = 2800, .step = 100, .max = 3100, 65 .min = 2800000, .step = 100000, .max = 3100000,
66}; 66};
67static const struct voltage_map_desc ldo10_voltage_map_desc = { 67static const struct voltage_map_desc ldo10_voltage_map_desc = {
68 .min = 950, .step = 50, .max = 1300, 68 .min = 95000, .step = 50000, .max = 1300000,
69}; 69};
70static const struct voltage_map_desc ldo1213_voltage_map_desc = { 70static const struct voltage_map_desc ldo1213_voltage_map_desc = {
71 .min = 800, .step = 100, .max = 3300, 71 .min = 800000, .step = 100000, .max = 3300000,
72}; 72};
73static const struct voltage_map_desc ldo1415_voltage_map_desc = { 73static const struct voltage_map_desc ldo1415_voltage_map_desc = {
74 .min = 1200, .step = 100, .max = 3300, 74 .min = 1200000, .step = 100000, .max = 3300000,
75}; 75};
76static const struct voltage_map_desc ldo1617_voltage_map_desc = { 76static const struct voltage_map_desc ldo1617_voltage_map_desc = {
77 .min = 1600, .step = 100, .max = 3600, 77 .min = 1600000, .step = 100000, .max = 3600000,
78}; 78};
79static const struct voltage_map_desc buck12_voltage_map_desc = { 79static const struct voltage_map_desc buck12_voltage_map_desc = {
80 .min = 750, .step = 25, .max = 1525, 80 .min = 750000, .step = 25000, .max = 1525000,
81}; 81};
82static const struct voltage_map_desc buck3_voltage_map_desc = { 82static const struct voltage_map_desc buck3_voltage_map_desc = {
83 .min = 1600, .step = 100, .max = 3600, 83 .min = 1600000, .step = 100000, .max = 3600000,
84}; 84};
85static const struct voltage_map_desc buck4_voltage_map_desc = { 85static const struct voltage_map_desc buck4_voltage_map_desc = {
86 .min = 800, .step = 100, .max = 2300, 86 .min = 800000, .step = 100000, .max = 2300000,
87}; 87};
88 88
89static const struct voltage_map_desc *ldo_voltage_map[] = { 89static const struct voltage_map_desc *ldo_voltage_map[] = {
@@ -445,9 +445,9 @@ static int max8998_set_voltage_buck_time_sel(struct regulator_dev *rdev,
445 if (max8998->iodev->type == TYPE_MAX8998 && !(val & MAX8998_ENRAMP)) 445 if (max8998->iodev->type == TYPE_MAX8998 && !(val & MAX8998_ENRAMP))
446 return 0; 446 return 0;
447 447
448 difference = (new_selector - old_selector) * desc->step; 448 difference = (new_selector - old_selector) * desc->step / 1000;
449 if (difference > 0) 449 if (difference > 0)
450 return difference / ((val & 0x0f) + 1); 450 return DIV_ROUND_UP(difference, (val & 0x0f) + 1);
451 451
452 return 0; 452 return 0;
453} 453}
@@ -702,7 +702,7 @@ static int max8998_pmic_probe(struct platform_device *pdev)
702 i = 0; 702 i = 0;
703 while (buck12_voltage_map_desc.min + 703 while (buck12_voltage_map_desc.min +
704 buck12_voltage_map_desc.step*i 704 buck12_voltage_map_desc.step*i
705 < (pdata->buck1_voltage1 / 1000)) 705 < pdata->buck1_voltage1)
706 i++; 706 i++;
707 max8998->buck1_vol[0] = i; 707 max8998->buck1_vol[0] = i;
708 ret = max8998_write_reg(i2c, MAX8998_REG_BUCK1_VOLTAGE1, i); 708 ret = max8998_write_reg(i2c, MAX8998_REG_BUCK1_VOLTAGE1, i);
@@ -713,7 +713,7 @@ static int max8998_pmic_probe(struct platform_device *pdev)
713 i = 0; 713 i = 0;
714 while (buck12_voltage_map_desc.min + 714 while (buck12_voltage_map_desc.min +
715 buck12_voltage_map_desc.step*i 715 buck12_voltage_map_desc.step*i
716 < (pdata->buck1_voltage2 / 1000)) 716 < pdata->buck1_voltage2)
717 i++; 717 i++;
718 718
719 max8998->buck1_vol[1] = i; 719 max8998->buck1_vol[1] = i;
@@ -725,7 +725,7 @@ static int max8998_pmic_probe(struct platform_device *pdev)
725 i = 0; 725 i = 0;
726 while (buck12_voltage_map_desc.min + 726 while (buck12_voltage_map_desc.min +
727 buck12_voltage_map_desc.step*i 727 buck12_voltage_map_desc.step*i
728 < (pdata->buck1_voltage3 / 1000)) 728 < pdata->buck1_voltage3)
729 i++; 729 i++;
730 730
731 max8998->buck1_vol[2] = i; 731 max8998->buck1_vol[2] = i;
@@ -737,7 +737,7 @@ static int max8998_pmic_probe(struct platform_device *pdev)
737 i = 0; 737 i = 0;
738 while (buck12_voltage_map_desc.min + 738 while (buck12_voltage_map_desc.min +
739 buck12_voltage_map_desc.step*i 739 buck12_voltage_map_desc.step*i
740 < (pdata->buck1_voltage4 / 1000)) 740 < pdata->buck1_voltage4)
741 i++; 741 i++;
742 742
743 max8998->buck1_vol[3] = i; 743 max8998->buck1_vol[3] = i;
@@ -763,7 +763,7 @@ static int max8998_pmic_probe(struct platform_device *pdev)
763 i = 0; 763 i = 0;
764 while (buck12_voltage_map_desc.min + 764 while (buck12_voltage_map_desc.min +
765 buck12_voltage_map_desc.step*i 765 buck12_voltage_map_desc.step*i
766 < (pdata->buck2_voltage1 / 1000)) 766 < pdata->buck2_voltage1)
767 i++; 767 i++;
768 max8998->buck2_vol[0] = i; 768 max8998->buck2_vol[0] = i;
769 ret = max8998_write_reg(i2c, MAX8998_REG_BUCK2_VOLTAGE1, i); 769 ret = max8998_write_reg(i2c, MAX8998_REG_BUCK2_VOLTAGE1, i);
@@ -774,7 +774,7 @@ static int max8998_pmic_probe(struct platform_device *pdev)
774 i = 0; 774 i = 0;
775 while (buck12_voltage_map_desc.min + 775 while (buck12_voltage_map_desc.min +
776 buck12_voltage_map_desc.step*i 776 buck12_voltage_map_desc.step*i
777 < (pdata->buck2_voltage2 / 1000)) 777 < pdata->buck2_voltage2)
778 i++; 778 i++;
779 max8998->buck2_vol[1] = i; 779 max8998->buck2_vol[1] = i;
780 ret = max8998_write_reg(i2c, MAX8998_REG_BUCK2_VOLTAGE2, i); 780 ret = max8998_write_reg(i2c, MAX8998_REG_BUCK2_VOLTAGE2, i);
@@ -792,8 +792,8 @@ static int max8998_pmic_probe(struct platform_device *pdev)
792 int count = (desc->max - desc->min) / desc->step + 1; 792 int count = (desc->max - desc->min) / desc->step + 1;
793 793
794 regulators[index].n_voltages = count; 794 regulators[index].n_voltages = count;
795 regulators[index].min_uV = desc->min * 1000; 795 regulators[index].min_uV = desc->min;
796 regulators[index].uV_step = desc->step * 1000; 796 regulators[index].uV_step = desc->step;
797 } 797 }
798 798
799 config.dev = max8998->dev; 799 config.dev = max8998->dev;
diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c
index e915629a25cf..c9e912f583bc 100644
--- a/drivers/regulator/palmas-regulator.c
+++ b/drivers/regulator/palmas-regulator.c
@@ -806,7 +806,7 @@ static int palmas_remove(struct platform_device *pdev)
806 return 0; 806 return 0;
807} 807}
808 808
809static struct of_device_id __devinitdata of_palmas_match_tbl[] = { 809static struct of_device_id of_palmas_match_tbl[] = {
810 { .compatible = "ti,palmas-pmic", }, 810 { .compatible = "ti,palmas-pmic", },
811 { /* end */ } 811 { /* end */ }
812}; 812};
diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
index 9f991f2c525a..33b65c9ad5d5 100644
--- a/drivers/regulator/s5m8767.c
+++ b/drivers/regulator/s5m8767.c
@@ -214,7 +214,7 @@ static int s5m8767_reg_is_enabled(struct regulator_dev *rdev)
214 struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev); 214 struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);
215 int ret, reg; 215 int ret, reg;
216 int mask = 0xc0, enable_ctrl; 216 int mask = 0xc0, enable_ctrl;
217 u8 val; 217 unsigned int val;
218 218
219 ret = s5m8767_get_register(rdev, &reg, &enable_ctrl); 219 ret = s5m8767_get_register(rdev, &reg, &enable_ctrl);
220 if (ret == -EINVAL) 220 if (ret == -EINVAL)
@@ -306,7 +306,7 @@ static int s5m8767_get_voltage_sel(struct regulator_dev *rdev)
306 struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev); 306 struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);
307 int reg, mask, ret; 307 int reg, mask, ret;
308 int reg_id = rdev_get_id(rdev); 308 int reg_id = rdev_get_id(rdev);
309 u8 val; 309 unsigned int val;
310 310
311 ret = s5m8767_get_voltage_register(rdev, &reg); 311 ret = s5m8767_get_voltage_register(rdev, &reg);
312 if (ret) 312 if (ret)
diff --git a/drivers/regulator/tps80031-regulator.c b/drivers/regulator/tps80031-regulator.c
index b15d711bc8c6..9019d0e7ecb6 100644
--- a/drivers/regulator/tps80031-regulator.c
+++ b/drivers/regulator/tps80031-regulator.c
@@ -728,7 +728,7 @@ static int tps80031_regulator_probe(struct platform_device *pdev)
728 } 728 }
729 } 729 }
730 rdev = regulator_register(&ri->rinfo->desc, &config); 730 rdev = regulator_register(&ri->rinfo->desc, &config);
731 if (IS_ERR_OR_NULL(rdev)) { 731 if (IS_ERR(rdev)) {
732 dev_err(&pdev->dev, 732 dev_err(&pdev->dev,
733 "register regulator failed %s\n", 733 "register regulator failed %s\n",
734 ri->rinfo->desc.name); 734 ri->rinfo->desc.name);
diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
index 493c8c6a241f..74508cc62d67 100644
--- a/drivers/regulator/twl-regulator.c
+++ b/drivers/regulator/twl-regulator.c
@@ -1064,7 +1064,7 @@ static u8 twl_get_smps_mult(void)
1064#define TWLFIXED_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWLFIXED, label) 1064#define TWLFIXED_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWLFIXED, label)
1065#define TWLSMPS_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWLSMPS, label) 1065#define TWLSMPS_OF_MATCH(comp, label) TWL_OF_MATCH(comp, TWLSMPS, label)
1066 1066
1067static const struct of_device_id twl_of_match[] __devinitconst = { 1067static const struct of_device_id twl_of_match[] = {
1068 TWL4030_OF_MATCH("ti,twl4030-vaux1", VAUX1), 1068 TWL4030_OF_MATCH("ti,twl4030-vaux1", VAUX1),
1069 TWL4030_OF_MATCH("ti,twl4030-vaux2", VAUX2_4030), 1069 TWL4030_OF_MATCH("ti,twl4030-vaux2", VAUX2_4030),
1070 TWL4030_OF_MATCH("ti,twl5030-vaux2", VAUX2), 1070 TWL4030_OF_MATCH("ti,twl5030-vaux2", VAUX2),
diff --git a/drivers/remoteproc/omap_remoteproc.c b/drivers/remoteproc/omap_remoteproc.c
index 32c289c2ba13..0e396c155b3b 100644
--- a/drivers/remoteproc/omap_remoteproc.c
+++ b/drivers/remoteproc/omap_remoteproc.c
@@ -179,7 +179,7 @@ static struct rproc_ops omap_rproc_ops = {
179 .kick = omap_rproc_kick, 179 .kick = omap_rproc_kick,
180}; 180};
181 181
182static int __devinit omap_rproc_probe(struct platform_device *pdev) 182static int omap_rproc_probe(struct platform_device *pdev)
183{ 183{
184 struct omap_rproc_pdata *pdata = pdev->dev.platform_data; 184 struct omap_rproc_pdata *pdata = pdev->dev.platform_data;
185 struct omap_rproc *oproc; 185 struct omap_rproc *oproc;
@@ -213,7 +213,7 @@ free_rproc:
213 return ret; 213 return ret;
214} 214}
215 215
216static int __devexit omap_rproc_remove(struct platform_device *pdev) 216static int omap_rproc_remove(struct platform_device *pdev)
217{ 217{
218 struct rproc *rproc = platform_get_drvdata(pdev); 218 struct rproc *rproc = platform_get_drvdata(pdev);
219 219
@@ -225,7 +225,7 @@ static int __devexit omap_rproc_remove(struct platform_device *pdev)
225 225
226static struct platform_driver omap_rproc_driver = { 226static struct platform_driver omap_rproc_driver = {
227 .probe = omap_rproc_probe, 227 .probe = omap_rproc_probe,
228 .remove = __devexit_p(omap_rproc_remove), 228 .remove = omap_rproc_remove,
229 .driver = { 229 .driver = {
230 .name = "omap-rproc", 230 .name = "omap-rproc",
231 .owner = THIS_MODULE, 231 .owner = THIS_MODULE,
diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c
index 027096fe6a12..f1e323924f12 100644
--- a/drivers/rpmsg/virtio_rpmsg_bus.c
+++ b/drivers/rpmsg/virtio_rpmsg_bus.c
@@ -1022,7 +1022,7 @@ static int rpmsg_remove_device(struct device *dev, void *data)
1022 return 0; 1022 return 0;
1023} 1023}
1024 1024
1025static void __devexit rpmsg_remove(struct virtio_device *vdev) 1025static void rpmsg_remove(struct virtio_device *vdev)
1026{ 1026{
1027 struct virtproc_info *vrp = vdev->priv; 1027 struct virtproc_info *vrp = vdev->priv;
1028 int ret; 1028 int ret;
@@ -1063,7 +1063,7 @@ static struct virtio_driver virtio_ipc_driver = {
1063 .driver.owner = THIS_MODULE, 1063 .driver.owner = THIS_MODULE,
1064 .id_table = id_table, 1064 .id_table = id_table,
1065 .probe = rpmsg_probe, 1065 .probe = rpmsg_probe,
1066 .remove = __devexit_p(rpmsg_remove), 1066 .remove = rpmsg_remove,
1067}; 1067};
1068 1068
1069static int __init rpmsg_init(void) 1069static int __init rpmsg_init(void)
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index d0cea02b5dfc..923a9da9c829 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -352,6 +352,14 @@ config RTC_DRV_TWL4030
352 This driver can also be built as a module. If so, the module 352 This driver can also be built as a module. If so, the module
353 will be called rtc-twl. 353 will be called rtc-twl.
354 354
355config RTC_DRV_TPS6586X
356 tristate "TI TPS6586X RTC driver"
357 depends on MFD_TPS6586X
358 help
359 TI Power Managment IC TPS6586X supports RTC functionality
360 along with alarm. This driver supports the RTC driver for
361 the TPS6586X RTC module.
362
355config RTC_DRV_TPS65910 363config RTC_DRV_TPS65910
356 tristate "TI TPS65910 RTC driver" 364 tristate "TI TPS65910 RTC driver"
357 depends on RTC_CLASS && MFD_TPS65910 365 depends on RTC_CLASS && MFD_TPS65910
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index c3f62c80dc06..4418ef3f9ecc 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -111,6 +111,7 @@ obj-$(CONFIG_RTC_DRV_TEGRA) += rtc-tegra.o
111obj-$(CONFIG_RTC_DRV_TEST) += rtc-test.o 111obj-$(CONFIG_RTC_DRV_TEST) += rtc-test.o
112obj-$(CONFIG_RTC_DRV_TILE) += rtc-tile.o 112obj-$(CONFIG_RTC_DRV_TILE) += rtc-tile.o
113obj-$(CONFIG_RTC_DRV_TWL4030) += rtc-twl.o 113obj-$(CONFIG_RTC_DRV_TWL4030) += rtc-twl.o
114obj-$(CONFIG_RTC_DRV_TPS6586X) += rtc-tps6586x.o
114obj-$(CONFIG_RTC_DRV_TPS65910) += rtc-tps65910.o 115obj-$(CONFIG_RTC_DRV_TPS65910) += rtc-tps65910.o
115obj-$(CONFIG_RTC_DRV_TX4939) += rtc-tx4939.o 116obj-$(CONFIG_RTC_DRV_TX4939) += rtc-tx4939.o
116obj-$(CONFIG_RTC_DRV_V3020) += rtc-v3020.o 117obj-$(CONFIG_RTC_DRV_V3020) += rtc-v3020.o
diff --git a/drivers/rtc/rtc-88pm80x.c b/drivers/rtc/rtc-88pm80x.c
index 6367984e0565..63b17ebe90e8 100644
--- a/drivers/rtc/rtc-88pm80x.c
+++ b/drivers/rtc/rtc-88pm80x.c
@@ -248,7 +248,7 @@ static int pm80x_rtc_resume(struct device *dev)
248 248
249static SIMPLE_DEV_PM_OPS(pm80x_rtc_pm_ops, pm80x_rtc_suspend, pm80x_rtc_resume); 249static SIMPLE_DEV_PM_OPS(pm80x_rtc_pm_ops, pm80x_rtc_suspend, pm80x_rtc_resume);
250 250
251static int __devinit pm80x_rtc_probe(struct platform_device *pdev) 251static int pm80x_rtc_probe(struct platform_device *pdev)
252{ 252{
253 struct pm80x_chip *chip = dev_get_drvdata(pdev->dev.parent); 253 struct pm80x_chip *chip = dev_get_drvdata(pdev->dev.parent);
254 struct pm80x_platform_data *pm80x_pdata; 254 struct pm80x_platform_data *pm80x_pdata;
@@ -342,7 +342,7 @@ out:
342 return ret; 342 return ret;
343} 343}
344 344
345static int __devexit pm80x_rtc_remove(struct platform_device *pdev) 345static int pm80x_rtc_remove(struct platform_device *pdev)
346{ 346{
347 struct pm80x_rtc_info *info = platform_get_drvdata(pdev); 347 struct pm80x_rtc_info *info = platform_get_drvdata(pdev);
348 platform_set_drvdata(pdev, NULL); 348 platform_set_drvdata(pdev, NULL);
@@ -358,7 +358,7 @@ static struct platform_driver pm80x_rtc_driver = {
358 .pm = &pm80x_rtc_pm_ops, 358 .pm = &pm80x_rtc_pm_ops,
359 }, 359 },
360 .probe = pm80x_rtc_probe, 360 .probe = pm80x_rtc_probe,
361 .remove = __devexit_p(pm80x_rtc_remove), 361 .remove = pm80x_rtc_remove,
362}; 362};
363 363
364module_platform_driver(pm80x_rtc_driver); 364module_platform_driver(pm80x_rtc_driver);
diff --git a/drivers/rtc/rtc-88pm860x.c b/drivers/rtc/rtc-88pm860x.c
index de9e854b326a..f663746f4603 100644
--- a/drivers/rtc/rtc-88pm860x.c
+++ b/drivers/rtc/rtc-88pm860x.c
@@ -286,8 +286,8 @@ out:
286#endif 286#endif
287 287
288#ifdef CONFIG_OF 288#ifdef CONFIG_OF
289static int __devinit pm860x_rtc_dt_init(struct platform_device *pdev, 289static int pm860x_rtc_dt_init(struct platform_device *pdev,
290 struct pm860x_rtc_info *info) 290 struct pm860x_rtc_info *info)
291{ 291{
292 struct device_node *np = pdev->dev.parent->of_node; 292 struct device_node *np = pdev->dev.parent->of_node;
293 int ret; 293 int ret;
@@ -307,7 +307,7 @@ static int __devinit pm860x_rtc_dt_init(struct platform_device *pdev,
307#define pm860x_rtc_dt_init(x, y) (-1) 307#define pm860x_rtc_dt_init(x, y) (-1)
308#endif 308#endif
309 309
310static int __devinit pm860x_rtc_probe(struct platform_device *pdev) 310static int pm860x_rtc_probe(struct platform_device *pdev)
311{ 311{
312 struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); 312 struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent);
313 struct pm860x_rtc_pdata *pdata = NULL; 313 struct pm860x_rtc_pdata *pdata = NULL;
@@ -412,7 +412,7 @@ out:
412 return ret; 412 return ret;
413} 413}
414 414
415static int __devexit pm860x_rtc_remove(struct platform_device *pdev) 415static int pm860x_rtc_remove(struct platform_device *pdev)
416{ 416{
417 struct pm860x_rtc_info *info = platform_get_drvdata(pdev); 417 struct pm860x_rtc_info *info = platform_get_drvdata(pdev);
418 418
@@ -459,7 +459,7 @@ static struct platform_driver pm860x_rtc_driver = {
459 .pm = &pm860x_rtc_pm_ops, 459 .pm = &pm860x_rtc_pm_ops,
460 }, 460 },
461 .probe = pm860x_rtc_probe, 461 .probe = pm860x_rtc_probe,
462 .remove = __devexit_p(pm860x_rtc_remove), 462 .remove = pm860x_rtc_remove,
463}; 463};
464 464
465module_platform_driver(pm860x_rtc_driver); 465module_platform_driver(pm860x_rtc_driver);
diff --git a/drivers/rtc/rtc-ab8500.c b/drivers/rtc/rtc-ab8500.c
index 2e5970fe9eeb..57cde2b061e6 100644
--- a/drivers/rtc/rtc-ab8500.c
+++ b/drivers/rtc/rtc-ab8500.c
@@ -389,7 +389,7 @@ static const struct rtc_class_ops ab8500_rtc_ops = {
389 .alarm_irq_enable = ab8500_rtc_irq_enable, 389 .alarm_irq_enable = ab8500_rtc_irq_enable,
390}; 390};
391 391
392static int __devinit ab8500_rtc_probe(struct platform_device *pdev) 392static int ab8500_rtc_probe(struct platform_device *pdev)
393{ 393{
394 int err; 394 int err;
395 struct rtc_device *rtc; 395 struct rtc_device *rtc;
@@ -448,7 +448,7 @@ static int __devinit ab8500_rtc_probe(struct platform_device *pdev)
448 return 0; 448 return 0;
449} 449}
450 450
451static int __devexit ab8500_rtc_remove(struct platform_device *pdev) 451static int ab8500_rtc_remove(struct platform_device *pdev)
452{ 452{
453 struct rtc_device *rtc = platform_get_drvdata(pdev); 453 struct rtc_device *rtc = platform_get_drvdata(pdev);
454 int irq = platform_get_irq_byname(pdev, "ALARM"); 454 int irq = platform_get_irq_byname(pdev, "ALARM");
@@ -468,7 +468,7 @@ static struct platform_driver ab8500_rtc_driver = {
468 .owner = THIS_MODULE, 468 .owner = THIS_MODULE,
469 }, 469 },
470 .probe = ab8500_rtc_probe, 470 .probe = ab8500_rtc_probe,
471 .remove = __devexit_p(ab8500_rtc_remove), 471 .remove = ab8500_rtc_remove,
472}; 472};
473 473
474module_platform_driver(ab8500_rtc_driver); 474module_platform_driver(ab8500_rtc_driver);
diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c
index e981798e9a9b..39cfd2ee0042 100644
--- a/drivers/rtc/rtc-at91sam9.c
+++ b/drivers/rtc/rtc-at91sam9.c
@@ -289,7 +289,7 @@ static const struct rtc_class_ops at91_rtc_ops = {
289/* 289/*
290 * Initialize and install RTC driver 290 * Initialize and install RTC driver
291 */ 291 */
292static int __devinit at91_rtc_probe(struct platform_device *pdev) 292static int at91_rtc_probe(struct platform_device *pdev)
293{ 293{
294 struct resource *r, *r_gpbr; 294 struct resource *r, *r_gpbr;
295 struct sam9_rtc *rtc; 295 struct sam9_rtc *rtc;
@@ -387,7 +387,7 @@ fail:
387/* 387/*
388 * Disable and remove the RTC driver 388 * Disable and remove the RTC driver
389 */ 389 */
390static int __devexit at91_rtc_remove(struct platform_device *pdev) 390static int at91_rtc_remove(struct platform_device *pdev)
391{ 391{
392 struct sam9_rtc *rtc = platform_get_drvdata(pdev); 392 struct sam9_rtc *rtc = platform_get_drvdata(pdev);
393 u32 mr = rtt_readl(rtc, MR); 393 u32 mr = rtt_readl(rtc, MR);
@@ -463,7 +463,7 @@ static int at91_rtc_resume(struct platform_device *pdev)
463 463
464static struct platform_driver at91_rtc_driver = { 464static struct platform_driver at91_rtc_driver = {
465 .probe = at91_rtc_probe, 465 .probe = at91_rtc_probe,
466 .remove = __devexit_p(at91_rtc_remove), 466 .remove = at91_rtc_remove,
467 .shutdown = at91_rtc_shutdown, 467 .shutdown = at91_rtc_shutdown,
468 .suspend = at91_rtc_suspend, 468 .suspend = at91_rtc_suspend,
469 .resume = at91_rtc_resume, 469 .resume = at91_rtc_resume,
diff --git a/drivers/rtc/rtc-au1xxx.c b/drivers/rtc/rtc-au1xxx.c
index 979ed0406ce9..b309da4ec745 100644
--- a/drivers/rtc/rtc-au1xxx.c
+++ b/drivers/rtc/rtc-au1xxx.c
@@ -62,7 +62,7 @@ static struct rtc_class_ops au1xtoy_rtc_ops = {
62 .set_time = au1xtoy_rtc_set_time, 62 .set_time = au1xtoy_rtc_set_time,
63}; 63};
64 64
65static int __devinit au1xtoy_rtc_probe(struct platform_device *pdev) 65static int au1xtoy_rtc_probe(struct platform_device *pdev)
66{ 66{
67 struct rtc_device *rtcdev; 67 struct rtc_device *rtcdev;
68 unsigned long t; 68 unsigned long t;
@@ -116,7 +116,7 @@ out_err:
116 return ret; 116 return ret;
117} 117}
118 118
119static int __devexit au1xtoy_rtc_remove(struct platform_device *pdev) 119static int au1xtoy_rtc_remove(struct platform_device *pdev)
120{ 120{
121 struct rtc_device *rtcdev = platform_get_drvdata(pdev); 121 struct rtc_device *rtcdev = platform_get_drvdata(pdev);
122 122
@@ -131,7 +131,7 @@ static struct platform_driver au1xrtc_driver = {
131 .name = "rtc-au1xxx", 131 .name = "rtc-au1xxx",
132 .owner = THIS_MODULE, 132 .owner = THIS_MODULE,
133 }, 133 },
134 .remove = __devexit_p(au1xtoy_rtc_remove), 134 .remove = au1xtoy_rtc_remove,
135}; 135};
136 136
137static int __init au1xtoy_rtc_init(void) 137static int __init au1xtoy_rtc_init(void)
diff --git a/drivers/rtc/rtc-bfin.c b/drivers/rtc/rtc-bfin.c
index abfc1a0c07d9..4ec614b0954d 100644
--- a/drivers/rtc/rtc-bfin.c
+++ b/drivers/rtc/rtc-bfin.c
@@ -342,7 +342,7 @@ static struct rtc_class_ops bfin_rtc_ops = {
342 .alarm_irq_enable = bfin_rtc_alarm_irq_enable, 342 .alarm_irq_enable = bfin_rtc_alarm_irq_enable,
343}; 343};
344 344
345static int __devinit bfin_rtc_probe(struct platform_device *pdev) 345static int bfin_rtc_probe(struct platform_device *pdev)
346{ 346{
347 struct bfin_rtc *rtc; 347 struct bfin_rtc *rtc;
348 struct device *dev = &pdev->dev; 348 struct device *dev = &pdev->dev;
@@ -388,7 +388,7 @@ err:
388 return ret; 388 return ret;
389} 389}
390 390
391static int __devexit bfin_rtc_remove(struct platform_device *pdev) 391static int bfin_rtc_remove(struct platform_device *pdev)
392{ 392{
393 struct bfin_rtc *rtc = platform_get_drvdata(pdev); 393 struct bfin_rtc *rtc = platform_get_drvdata(pdev);
394 struct device *dev = &pdev->dev; 394 struct device *dev = &pdev->dev;
@@ -451,7 +451,7 @@ static struct platform_driver bfin_rtc_driver = {
451 .owner = THIS_MODULE, 451 .owner = THIS_MODULE,
452 }, 452 },
453 .probe = bfin_rtc_probe, 453 .probe = bfin_rtc_probe,
454 .remove = __devexit_p(bfin_rtc_remove), 454 .remove = bfin_rtc_remove,
455 .suspend = bfin_rtc_suspend, 455 .suspend = bfin_rtc_suspend,
456 .resume = bfin_rtc_resume, 456 .resume = bfin_rtc_resume,
457}; 457};
diff --git a/drivers/rtc/rtc-bq32k.c b/drivers/rtc/rtc-bq32k.c
index f090159dce4a..036cb89f8188 100644
--- a/drivers/rtc/rtc-bq32k.c
+++ b/drivers/rtc/rtc-bq32k.c
@@ -163,7 +163,7 @@ static int bq32k_probe(struct i2c_client *client,
163 return 0; 163 return 0;
164} 164}
165 165
166static int __devexit bq32k_remove(struct i2c_client *client) 166static int bq32k_remove(struct i2c_client *client)
167{ 167{
168 struct rtc_device *rtc = i2c_get_clientdata(client); 168 struct rtc_device *rtc = i2c_get_clientdata(client);
169 169
@@ -183,7 +183,7 @@ static struct i2c_driver bq32k_driver = {
183 .owner = THIS_MODULE, 183 .owner = THIS_MODULE,
184 }, 184 },
185 .probe = bq32k_probe, 185 .probe = bq32k_probe,
186 .remove = __devexit_p(bq32k_remove), 186 .remove = bq32k_remove,
187 .id_table = bq32k_id, 187 .id_table = bq32k_id,
188}; 188};
189 189
diff --git a/drivers/rtc/rtc-bq4802.c b/drivers/rtc/rtc-bq4802.c
index bf612ef22941..693be71b5b18 100644
--- a/drivers/rtc/rtc-bq4802.c
+++ b/drivers/rtc/rtc-bq4802.c
@@ -140,7 +140,7 @@ static const struct rtc_class_ops bq4802_ops = {
140 .set_time = bq4802_set_time, 140 .set_time = bq4802_set_time,
141}; 141};
142 142
143static int __devinit bq4802_probe(struct platform_device *pdev) 143static int bq4802_probe(struct platform_device *pdev)
144{ 144{
145 struct bq4802 *p = kzalloc(sizeof(*p), GFP_KERNEL); 145 struct bq4802 *p = kzalloc(sizeof(*p), GFP_KERNEL);
146 int err = -ENOMEM; 146 int err = -ENOMEM;
@@ -191,7 +191,7 @@ out_free:
191 goto out; 191 goto out;
192} 192}
193 193
194static int __devexit bq4802_remove(struct platform_device *pdev) 194static int bq4802_remove(struct platform_device *pdev)
195{ 195{
196 struct bq4802 *p = platform_get_drvdata(pdev); 196 struct bq4802 *p = platform_get_drvdata(pdev);
197 197
@@ -215,7 +215,7 @@ static struct platform_driver bq4802_driver = {
215 .owner = THIS_MODULE, 215 .owner = THIS_MODULE,
216 }, 216 },
217 .probe = bq4802_probe, 217 .probe = bq4802_probe,
218 .remove = __devexit_p(bq4802_remove), 218 .remove = bq4802_remove,
219}; 219};
220 220
221module_platform_driver(bq4802_driver); 221module_platform_driver(bq4802_driver);
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index 4267789ca995..16630aa87f45 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -947,8 +947,7 @@ static void rtc_wake_off(struct device *dev)
947 */ 947 */
948static struct cmos_rtc_board_info acpi_rtc_info; 948static struct cmos_rtc_board_info acpi_rtc_info;
949 949
950static void __devinit 950static void cmos_wake_setup(struct device *dev)
951cmos_wake_setup(struct device *dev)
952{ 951{
953 if (acpi_disabled) 952 if (acpi_disabled)
954 return; 953 return;
@@ -980,8 +979,7 @@ cmos_wake_setup(struct device *dev)
980 979
981#else 980#else
982 981
983static void __devinit 982static void cmos_wake_setup(struct device *dev)
984cmos_wake_setup(struct device *dev)
985{ 983{
986} 984}
987 985
@@ -991,8 +989,7 @@ cmos_wake_setup(struct device *dev)
991 989
992#include <linux/pnp.h> 990#include <linux/pnp.h>
993 991
994static int __devinit 992static int cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
995cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
996{ 993{
997 cmos_wake_setup(&pnp->dev); 994 cmos_wake_setup(&pnp->dev);
998 995
diff --git a/drivers/rtc/rtc-da9052.c b/drivers/rtc/rtc-da9052.c
index 78070255bd3f..60b826e520e2 100644
--- a/drivers/rtc/rtc-da9052.c
+++ b/drivers/rtc/rtc-da9052.c
@@ -228,7 +228,7 @@ static const struct rtc_class_ops da9052_rtc_ops = {
228 .alarm_irq_enable = da9052_rtc_alarm_irq_enable, 228 .alarm_irq_enable = da9052_rtc_alarm_irq_enable,
229}; 229};
230 230
231static int __devinit da9052_rtc_probe(struct platform_device *pdev) 231static int da9052_rtc_probe(struct platform_device *pdev)
232{ 232{
233 struct da9052_rtc *rtc; 233 struct da9052_rtc *rtc;
234 int ret; 234 int ret;
@@ -262,7 +262,7 @@ err_free_irq:
262 return ret; 262 return ret;
263} 263}
264 264
265static int __devexit da9052_rtc_remove(struct platform_device *pdev) 265static int da9052_rtc_remove(struct platform_device *pdev)
266{ 266{
267 struct da9052_rtc *rtc = pdev->dev.platform_data; 267 struct da9052_rtc *rtc = pdev->dev.platform_data;
268 268
@@ -275,7 +275,7 @@ static int __devexit da9052_rtc_remove(struct platform_device *pdev)
275 275
276static struct platform_driver da9052_rtc_driver = { 276static struct platform_driver da9052_rtc_driver = {
277 .probe = da9052_rtc_probe, 277 .probe = da9052_rtc_probe,
278 .remove = __devexit_p(da9052_rtc_remove), 278 .remove = da9052_rtc_remove,
279 .driver = { 279 .driver = {
280 .name = "da9052-rtc", 280 .name = "da9052-rtc",
281 .owner = THIS_MODULE, 281 .owner = THIS_MODULE,
diff --git a/drivers/rtc/rtc-da9055.c b/drivers/rtc/rtc-da9055.c
index 96bafc5c3bf8..8f0dcfedb83c 100644
--- a/drivers/rtc/rtc-da9055.c
+++ b/drivers/rtc/rtc-da9055.c
@@ -227,7 +227,7 @@ static const struct rtc_class_ops da9055_rtc_ops = {
227 .alarm_irq_enable = da9055_rtc_alarm_irq_enable, 227 .alarm_irq_enable = da9055_rtc_alarm_irq_enable,
228}; 228};
229 229
230static int __init da9055_rtc_device_init(struct da9055 *da9055, 230static int da9055_rtc_device_init(struct da9055 *da9055,
231 struct da9055_pdata *pdata) 231 struct da9055_pdata *pdata)
232{ 232{
233 int ret; 233 int ret;
diff --git a/drivers/rtc/rtc-davinci.c b/drivers/rtc/rtc-davinci.c
index 07cd03eae606..5f7982f7c1b5 100644
--- a/drivers/rtc/rtc-davinci.c
+++ b/drivers/rtc/rtc-davinci.c
@@ -567,7 +567,7 @@ fail2:
567 return ret; 567 return ret;
568} 568}
569 569
570static int __devexit davinci_rtc_remove(struct platform_device *pdev) 570static int davinci_rtc_remove(struct platform_device *pdev)
571{ 571{
572 struct davinci_rtc *davinci_rtc = platform_get_drvdata(pdev); 572 struct davinci_rtc *davinci_rtc = platform_get_drvdata(pdev);
573 573
@@ -589,7 +589,7 @@ static int __devexit davinci_rtc_remove(struct platform_device *pdev)
589 589
590static struct platform_driver davinci_rtc_driver = { 590static struct platform_driver davinci_rtc_driver = {
591 .probe = davinci_rtc_probe, 591 .probe = davinci_rtc_probe,
592 .remove = __devexit_p(davinci_rtc_remove), 592 .remove = davinci_rtc_remove,
593 .driver = { 593 .driver = {
594 .name = "rtc_davinci", 594 .name = "rtc_davinci",
595 .owner = THIS_MODULE, 595 .owner = THIS_MODULE,
diff --git a/drivers/rtc/rtc-dm355evm.c b/drivers/rtc/rtc-dm355evm.c
index d4457afcba89..b2ed2c94b081 100644
--- a/drivers/rtc/rtc-dm355evm.c
+++ b/drivers/rtc/rtc-dm355evm.c
@@ -123,7 +123,7 @@ static struct rtc_class_ops dm355evm_rtc_ops = {
123 123
124/*----------------------------------------------------------------------*/ 124/*----------------------------------------------------------------------*/
125 125
126static int __devinit dm355evm_rtc_probe(struct platform_device *pdev) 126static int dm355evm_rtc_probe(struct platform_device *pdev)
127{ 127{
128 struct rtc_device *rtc; 128 struct rtc_device *rtc;
129 129
@@ -139,7 +139,7 @@ static int __devinit dm355evm_rtc_probe(struct platform_device *pdev)
139 return 0; 139 return 0;
140} 140}
141 141
142static int __devexit dm355evm_rtc_remove(struct platform_device *pdev) 142static int dm355evm_rtc_remove(struct platform_device *pdev)
143{ 143{
144 struct rtc_device *rtc = platform_get_drvdata(pdev); 144 struct rtc_device *rtc = platform_get_drvdata(pdev);
145 145
@@ -154,7 +154,7 @@ static int __devexit dm355evm_rtc_remove(struct platform_device *pdev)
154 */ 154 */
155static struct platform_driver rtc_dm355evm_driver = { 155static struct platform_driver rtc_dm355evm_driver = {
156 .probe = dm355evm_rtc_probe, 156 .probe = dm355evm_rtc_probe,
157 .remove = __devexit_p(dm355evm_rtc_remove), 157 .remove = dm355evm_rtc_remove,
158 .driver = { 158 .driver = {
159 .owner = THIS_MODULE, 159 .owner = THIS_MODULE,
160 .name = "rtc-dm355evm", 160 .name = "rtc-dm355evm",
diff --git a/drivers/rtc/rtc-ds1286.c b/drivers/rtc/rtc-ds1286.c
index 990c3ff489bf..d989412a348a 100644
--- a/drivers/rtc/rtc-ds1286.c
+++ b/drivers/rtc/rtc-ds1286.c
@@ -329,7 +329,7 @@ static const struct rtc_class_ops ds1286_ops = {
329 .alarm_irq_enable = ds1286_alarm_irq_enable, 329 .alarm_irq_enable = ds1286_alarm_irq_enable,
330}; 330};
331 331
332static int __devinit ds1286_probe(struct platform_device *pdev) 332static int ds1286_probe(struct platform_device *pdev)
333{ 333{
334 struct rtc_device *rtc; 334 struct rtc_device *rtc;
335 struct resource *res; 335 struct resource *res;
@@ -376,7 +376,7 @@ out:
376 return ret; 376 return ret;
377} 377}
378 378
379static int __devexit ds1286_remove(struct platform_device *pdev) 379static int ds1286_remove(struct platform_device *pdev)
380{ 380{
381 struct ds1286_priv *priv = platform_get_drvdata(pdev); 381 struct ds1286_priv *priv = platform_get_drvdata(pdev);
382 382
@@ -393,7 +393,7 @@ static struct platform_driver ds1286_platform_driver = {
393 .owner = THIS_MODULE, 393 .owner = THIS_MODULE,
394 }, 394 },
395 .probe = ds1286_probe, 395 .probe = ds1286_probe,
396 .remove = __devexit_p(ds1286_remove), 396 .remove = ds1286_remove,
397}; 397};
398 398
399module_platform_driver(ds1286_platform_driver); 399module_platform_driver(ds1286_platform_driver);
diff --git a/drivers/rtc/rtc-ds1302.c b/drivers/rtc/rtc-ds1302.c
index f0d638922644..fdbcdb289d60 100644
--- a/drivers/rtc/rtc-ds1302.c
+++ b/drivers/rtc/rtc-ds1302.c
@@ -234,7 +234,7 @@ static int __init ds1302_rtc_probe(struct platform_device *pdev)
234 return 0; 234 return 0;
235} 235}
236 236
237static int __devexit ds1302_rtc_remove(struct platform_device *pdev) 237static int ds1302_rtc_remove(struct platform_device *pdev)
238{ 238{
239 struct rtc_device *rtc = platform_get_drvdata(pdev); 239 struct rtc_device *rtc = platform_get_drvdata(pdev);
240 240
@@ -249,7 +249,7 @@ static struct platform_driver ds1302_platform_driver = {
249 .name = DRV_NAME, 249 .name = DRV_NAME,
250 .owner = THIS_MODULE, 250 .owner = THIS_MODULE,
251 }, 251 },
252 .remove = __devexit_p(ds1302_rtc_remove), 252 .remove = ds1302_rtc_remove,
253}; 253};
254 254
255static int __init ds1302_rtc_init(void) 255static int __init ds1302_rtc_init(void)
diff --git a/drivers/rtc/rtc-ds1305.c b/drivers/rtc/rtc-ds1305.c
index 686a865913e1..d578773f5ce2 100644
--- a/drivers/rtc/rtc-ds1305.c
+++ b/drivers/rtc/rtc-ds1305.c
@@ -601,7 +601,7 @@ static struct bin_attribute nvram = {
601 * Interface to SPI stack 601 * Interface to SPI stack
602 */ 602 */
603 603
604static int __devinit ds1305_probe(struct spi_device *spi) 604static int ds1305_probe(struct spi_device *spi)
605{ 605{
606 struct ds1305 *ds1305; 606 struct ds1305 *ds1305;
607 int status; 607 int status;
@@ -787,7 +787,7 @@ fail0:
787 return status; 787 return status;
788} 788}
789 789
790static int __devexit ds1305_remove(struct spi_device *spi) 790static int ds1305_remove(struct spi_device *spi)
791{ 791{
792 struct ds1305 *ds1305 = spi_get_drvdata(spi); 792 struct ds1305 *ds1305 = spi_get_drvdata(spi);
793 793
@@ -810,7 +810,7 @@ static struct spi_driver ds1305_driver = {
810 .driver.name = "rtc-ds1305", 810 .driver.name = "rtc-ds1305",
811 .driver.owner = THIS_MODULE, 811 .driver.owner = THIS_MODULE,
812 .probe = ds1305_probe, 812 .probe = ds1305_probe,
813 .remove = __devexit_p(ds1305_remove), 813 .remove = ds1305_remove,
814 /* REVISIT add suspend/resume */ 814 /* REVISIT add suspend/resume */
815}; 815};
816 816
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index 836710ce750e..e0d0ba4de03f 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -617,8 +617,8 @@ ds1307_nvram_write(struct file *filp, struct kobject *kobj,
617 617
618/*----------------------------------------------------------------------*/ 618/*----------------------------------------------------------------------*/
619 619
620static int __devinit ds1307_probe(struct i2c_client *client, 620static int ds1307_probe(struct i2c_client *client,
621 const struct i2c_device_id *id) 621 const struct i2c_device_id *id)
622{ 622{
623 struct ds1307 *ds1307; 623 struct ds1307 *ds1307;
624 int err = -ENODEV; 624 int err = -ENODEV;
@@ -938,7 +938,7 @@ exit_free:
938 return err; 938 return err;
939} 939}
940 940
941static int __devexit ds1307_remove(struct i2c_client *client) 941static int ds1307_remove(struct i2c_client *client)
942{ 942{
943 struct ds1307 *ds1307 = i2c_get_clientdata(client); 943 struct ds1307 *ds1307 = i2c_get_clientdata(client);
944 944
@@ -963,7 +963,7 @@ static struct i2c_driver ds1307_driver = {
963 .owner = THIS_MODULE, 963 .owner = THIS_MODULE,
964 }, 964 },
965 .probe = ds1307_probe, 965 .probe = ds1307_probe,
966 .remove = __devexit_p(ds1307_remove), 966 .remove = ds1307_remove,
967 .id_table = ds1307_id, 967 .id_table = ds1307_id,
968}; 968};
969 969
diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c
index 966316088b7f..fef76868aae0 100644
--- a/drivers/rtc/rtc-ds1374.c
+++ b/drivers/rtc/rtc-ds1374.c
@@ -391,7 +391,7 @@ out_free:
391 return ret; 391 return ret;
392} 392}
393 393
394static int __devexit ds1374_remove(struct i2c_client *client) 394static int ds1374_remove(struct i2c_client *client)
395{ 395{
396 struct ds1374 *ds1374 = i2c_get_clientdata(client); 396 struct ds1374 *ds1374 = i2c_get_clientdata(client);
397 397
@@ -442,7 +442,7 @@ static struct i2c_driver ds1374_driver = {
442 .pm = DS1374_PM, 442 .pm = DS1374_PM,
443 }, 443 },
444 .probe = ds1374_probe, 444 .probe = ds1374_probe,
445 .remove = __devexit_p(ds1374_remove), 445 .remove = ds1374_remove,
446 .id_table = ds1374_id, 446 .id_table = ds1374_id,
447}; 447};
448 448
diff --git a/drivers/rtc/rtc-ds1390.c b/drivers/rtc/rtc-ds1390.c
index b0a99e1b25be..f994257981a0 100644
--- a/drivers/rtc/rtc-ds1390.c
+++ b/drivers/rtc/rtc-ds1390.c
@@ -121,7 +121,7 @@ static const struct rtc_class_ops ds1390_rtc_ops = {
121 .set_time = ds1390_set_time, 121 .set_time = ds1390_set_time,
122}; 122};
123 123
124static int __devinit ds1390_probe(struct spi_device *spi) 124static int ds1390_probe(struct spi_device *spi)
125{ 125{
126 unsigned char tmp; 126 unsigned char tmp;
127 struct ds1390 *chip; 127 struct ds1390 *chip;
@@ -156,7 +156,7 @@ static int __devinit ds1390_probe(struct spi_device *spi)
156 return res; 156 return res;
157} 157}
158 158
159static int __devexit ds1390_remove(struct spi_device *spi) 159static int ds1390_remove(struct spi_device *spi)
160{ 160{
161 struct ds1390 *chip = spi_get_drvdata(spi); 161 struct ds1390 *chip = spi_get_drvdata(spi);
162 162
@@ -172,7 +172,7 @@ static struct spi_driver ds1390_driver = {
172 .owner = THIS_MODULE, 172 .owner = THIS_MODULE,
173 }, 173 },
174 .probe = ds1390_probe, 174 .probe = ds1390_probe,
175 .remove = __devexit_p(ds1390_remove), 175 .remove = ds1390_remove,
176}; 176};
177 177
178module_spi_driver(ds1390_driver); 178module_spi_driver(ds1390_driver);
diff --git a/drivers/rtc/rtc-ds1511.c b/drivers/rtc/rtc-ds1511.c
index 1f675f5294f5..6a3fcfe3b0e7 100644
--- a/drivers/rtc/rtc-ds1511.c
+++ b/drivers/rtc/rtc-ds1511.c
@@ -476,8 +476,7 @@ static struct bin_attribute ds1511_nvram_attr = {
476 .write = ds1511_nvram_write, 476 .write = ds1511_nvram_write,
477}; 477};
478 478
479 static int __devinit 479static int ds1511_rtc_probe(struct platform_device *pdev)
480ds1511_rtc_probe(struct platform_device *pdev)
481{ 480{
482 struct rtc_device *rtc; 481 struct rtc_device *rtc;
483 struct resource *res; 482 struct resource *res;
@@ -551,8 +550,7 @@ ds1511_rtc_probe(struct platform_device *pdev)
551 return ret; 550 return ret;
552} 551}
553 552
554 static int __devexit 553static int ds1511_rtc_remove(struct platform_device *pdev)
555ds1511_rtc_remove(struct platform_device *pdev)
556{ 554{
557 struct rtc_plat_data *pdata = platform_get_drvdata(pdev); 555 struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
558 556
@@ -573,7 +571,7 @@ MODULE_ALIAS("platform:ds1511");
573 571
574static struct platform_driver ds1511_rtc_driver = { 572static struct platform_driver ds1511_rtc_driver = {
575 .probe = ds1511_rtc_probe, 573 .probe = ds1511_rtc_probe,
576 .remove = __devexit_p(ds1511_rtc_remove), 574 .remove = ds1511_rtc_remove,
577 .driver = { 575 .driver = {
578 .name = "ds1511", 576 .name = "ds1511",
579 .owner = THIS_MODULE, 577 .owner = THIS_MODULE,
diff --git a/drivers/rtc/rtc-ds1553.c b/drivers/rtc/rtc-ds1553.c
index 6ccedbbf923c..25ce0621ade9 100644
--- a/drivers/rtc/rtc-ds1553.c
+++ b/drivers/rtc/rtc-ds1553.c
@@ -276,7 +276,7 @@ static struct bin_attribute ds1553_nvram_attr = {
276 .write = ds1553_nvram_write, 276 .write = ds1553_nvram_write,
277}; 277};
278 278
279static int __devinit ds1553_rtc_probe(struct platform_device *pdev) 279static int ds1553_rtc_probe(struct platform_device *pdev)
280{ 280{
281 struct rtc_device *rtc; 281 struct rtc_device *rtc;
282 struct resource *res; 282 struct resource *res;
@@ -338,7 +338,7 @@ static int __devinit ds1553_rtc_probe(struct platform_device *pdev)
338 return ret; 338 return ret;
339} 339}
340 340
341static int __devexit ds1553_rtc_remove(struct platform_device *pdev) 341static int ds1553_rtc_remove(struct platform_device *pdev)
342{ 342{
343 struct rtc_plat_data *pdata = platform_get_drvdata(pdev); 343 struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
344 344
@@ -354,7 +354,7 @@ MODULE_ALIAS("platform:rtc-ds1553");
354 354
355static struct platform_driver ds1553_rtc_driver = { 355static struct platform_driver ds1553_rtc_driver = {
356 .probe = ds1553_rtc_probe, 356 .probe = ds1553_rtc_probe,
357 .remove = __devexit_p(ds1553_rtc_remove), 357 .remove = ds1553_rtc_remove,
358 .driver = { 358 .driver = {
359 .name = "rtc-ds1553", 359 .name = "rtc-ds1553",
360 .owner = THIS_MODULE, 360 .owner = THIS_MODULE,
diff --git a/drivers/rtc/rtc-ds1742.c b/drivers/rtc/rtc-ds1742.c
index 76112667c507..609c870e2cc5 100644
--- a/drivers/rtc/rtc-ds1742.c
+++ b/drivers/rtc/rtc-ds1742.c
@@ -159,7 +159,7 @@ static ssize_t ds1742_nvram_write(struct file *filp, struct kobject *kobj,
159 return count; 159 return count;
160} 160}
161 161
162static int __devinit ds1742_rtc_probe(struct platform_device *pdev) 162static int ds1742_rtc_probe(struct platform_device *pdev)
163{ 163{
164 struct rtc_device *rtc; 164 struct rtc_device *rtc;
165 struct resource *res; 165 struct resource *res;
@@ -222,7 +222,7 @@ static int __devinit ds1742_rtc_probe(struct platform_device *pdev)
222 return ret; 222 return ret;
223} 223}
224 224
225static int __devexit ds1742_rtc_remove(struct platform_device *pdev) 225static int ds1742_rtc_remove(struct platform_device *pdev)
226{ 226{
227 struct rtc_plat_data *pdata = platform_get_drvdata(pdev); 227 struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
228 228
@@ -233,7 +233,7 @@ static int __devexit ds1742_rtc_remove(struct platform_device *pdev)
233 233
234static struct platform_driver ds1742_rtc_driver = { 234static struct platform_driver ds1742_rtc_driver = {
235 .probe = ds1742_rtc_probe, 235 .probe = ds1742_rtc_probe,
236 .remove = __devexit_p(ds1742_rtc_remove), 236 .remove = ds1742_rtc_remove,
237 .driver = { 237 .driver = {
238 .name = "rtc-ds1742", 238 .name = "rtc-ds1742",
239 .owner = THIS_MODULE, 239 .owner = THIS_MODULE,
diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c
index e1945095814e..db0ca08db315 100644
--- a/drivers/rtc/rtc-ds3232.c
+++ b/drivers/rtc/rtc-ds3232.c
@@ -391,8 +391,8 @@ static const struct rtc_class_ops ds3232_rtc_ops = {
391 .alarm_irq_enable = ds3232_alarm_irq_enable, 391 .alarm_irq_enable = ds3232_alarm_irq_enable,
392}; 392};
393 393
394static int __devinit ds3232_probe(struct i2c_client *client, 394static int ds3232_probe(struct i2c_client *client,
395 const struct i2c_device_id *id) 395 const struct i2c_device_id *id)
396{ 396{
397 struct ds3232 *ds3232; 397 struct ds3232 *ds3232;
398 int ret; 398 int ret;
@@ -439,7 +439,7 @@ out_free:
439 return ret; 439 return ret;
440} 440}
441 441
442static int __devexit ds3232_remove(struct i2c_client *client) 442static int ds3232_remove(struct i2c_client *client)
443{ 443{
444 struct ds3232 *ds3232 = i2c_get_clientdata(client); 444 struct ds3232 *ds3232 = i2c_get_clientdata(client);
445 445
@@ -469,7 +469,7 @@ static struct i2c_driver ds3232_driver = {
469 .owner = THIS_MODULE, 469 .owner = THIS_MODULE,
470 }, 470 },
471 .probe = ds3232_probe, 471 .probe = ds3232_probe,
472 .remove = __devexit_p(ds3232_remove), 472 .remove = ds3232_remove,
473 .id_table = ds3232_id, 473 .id_table = ds3232_id,
474}; 474};
475 475
diff --git a/drivers/rtc/rtc-ds3234.c b/drivers/rtc/rtc-ds3234.c
index fda707926f02..7a4495ef1c39 100644
--- a/drivers/rtc/rtc-ds3234.c
+++ b/drivers/rtc/rtc-ds3234.c
@@ -105,7 +105,7 @@ static const struct rtc_class_ops ds3234_rtc_ops = {
105 .set_time = ds3234_set_time, 105 .set_time = ds3234_set_time,
106}; 106};
107 107
108static int __devinit ds3234_probe(struct spi_device *spi) 108static int ds3234_probe(struct spi_device *spi)
109{ 109{
110 struct rtc_device *rtc; 110 struct rtc_device *rtc;
111 unsigned char tmp; 111 unsigned char tmp;
@@ -156,7 +156,7 @@ static int __devinit ds3234_probe(struct spi_device *spi)
156 return 0; 156 return 0;
157} 157}
158 158
159static int __devexit ds3234_remove(struct spi_device *spi) 159static int ds3234_remove(struct spi_device *spi)
160{ 160{
161 struct rtc_device *rtc = spi_get_drvdata(spi); 161 struct rtc_device *rtc = spi_get_drvdata(spi);
162 162
@@ -170,7 +170,7 @@ static struct spi_driver ds3234_driver = {
170 .owner = THIS_MODULE, 170 .owner = THIS_MODULE,
171 }, 171 },
172 .probe = ds3234_probe, 172 .probe = ds3234_probe,
173 .remove = __devexit_p(ds3234_remove), 173 .remove = ds3234_remove,
174}; 174};
175 175
176module_spi_driver(ds3234_driver); 176module_spi_driver(ds3234_driver);
diff --git a/drivers/rtc/rtc-ep93xx.c b/drivers/rtc/rtc-ep93xx.c
index 9602278ff988..1a4e5e4a70cd 100644
--- a/drivers/rtc/rtc-ep93xx.c
+++ b/drivers/rtc/rtc-ep93xx.c
@@ -127,7 +127,7 @@ static const struct attribute_group ep93xx_rtc_sysfs_files = {
127 .attrs = ep93xx_rtc_attrs, 127 .attrs = ep93xx_rtc_attrs,
128}; 128};
129 129
130static int __devinit ep93xx_rtc_probe(struct platform_device *pdev) 130static int ep93xx_rtc_probe(struct platform_device *pdev)
131{ 131{
132 struct ep93xx_rtc *ep93xx_rtc; 132 struct ep93xx_rtc *ep93xx_rtc;
133 struct resource *res; 133 struct resource *res;
@@ -174,7 +174,7 @@ exit:
174 return err; 174 return err;
175} 175}
176 176
177static int __devexit ep93xx_rtc_remove(struct platform_device *pdev) 177static int ep93xx_rtc_remove(struct platform_device *pdev)
178{ 178{
179 struct ep93xx_rtc *ep93xx_rtc = platform_get_drvdata(pdev); 179 struct ep93xx_rtc *ep93xx_rtc = platform_get_drvdata(pdev);
180 180
@@ -192,7 +192,7 @@ static struct platform_driver ep93xx_rtc_driver = {
192 .owner = THIS_MODULE, 192 .owner = THIS_MODULE,
193 }, 193 },
194 .probe = ep93xx_rtc_probe, 194 .probe = ep93xx_rtc_probe,
195 .remove = __devexit_p(ep93xx_rtc_remove), 195 .remove = ep93xx_rtc_remove,
196}; 196};
197 197
198module_platform_driver(ep93xx_rtc_driver); 198module_platform_driver(ep93xx_rtc_driver);
diff --git a/drivers/rtc/rtc-fm3130.c b/drivers/rtc/rtc-fm3130.c
index 86b6ecce99f0..04e93c6597f8 100644
--- a/drivers/rtc/rtc-fm3130.c
+++ b/drivers/rtc/rtc-fm3130.c
@@ -361,8 +361,8 @@ static const struct rtc_class_ops fm3130_rtc_ops = {
361 361
362static struct i2c_driver fm3130_driver; 362static struct i2c_driver fm3130_driver;
363 363
364static int __devinit fm3130_probe(struct i2c_client *client, 364static int fm3130_probe(struct i2c_client *client,
365 const struct i2c_device_id *id) 365 const struct i2c_device_id *id)
366{ 366{
367 struct fm3130 *fm3130; 367 struct fm3130 *fm3130;
368 int err = -ENODEV; 368 int err = -ENODEV;
@@ -546,7 +546,7 @@ exit_free:
546 return err; 546 return err;
547} 547}
548 548
549static int __devexit fm3130_remove(struct i2c_client *client) 549static int fm3130_remove(struct i2c_client *client)
550{ 550{
551 struct fm3130 *fm3130 = i2c_get_clientdata(client); 551 struct fm3130 *fm3130 = i2c_get_clientdata(client);
552 552
@@ -561,7 +561,7 @@ static struct i2c_driver fm3130_driver = {
561 .owner = THIS_MODULE, 561 .owner = THIS_MODULE,
562 }, 562 },
563 .probe = fm3130_probe, 563 .probe = fm3130_probe,
564 .remove = __devexit_p(fm3130_remove), 564 .remove = fm3130_remove,
565 .id_table = fm3130_id, 565 .id_table = fm3130_id,
566}; 566};
567 567
diff --git a/drivers/rtc/rtc-imxdi.c b/drivers/rtc/rtc-imxdi.c
index 8da7a5cf83c6..75d307ab37f4 100644
--- a/drivers/rtc/rtc-imxdi.c
+++ b/drivers/rtc/rtc-imxdi.c
@@ -480,7 +480,7 @@ err:
480 return rc; 480 return rc;
481} 481}
482 482
483static int __devexit dryice_rtc_remove(struct platform_device *pdev) 483static int dryice_rtc_remove(struct platform_device *pdev)
484{ 484{
485 struct imxdi_dev *imxdi = platform_get_drvdata(pdev); 485 struct imxdi_dev *imxdi = platform_get_drvdata(pdev);
486 486
@@ -512,7 +512,7 @@ static struct platform_driver dryice_rtc_driver = {
512 .owner = THIS_MODULE, 512 .owner = THIS_MODULE,
513 .of_match_table = of_match_ptr(dryice_dt_ids), 513 .of_match_table = of_match_ptr(dryice_dt_ids),
514 }, 514 },
515 .remove = __devexit_p(dryice_rtc_remove), 515 .remove = dryice_rtc_remove,
516}; 516};
517 517
518static int __init dryice_rtc_init(void) 518static int __init dryice_rtc_init(void)
diff --git a/drivers/rtc/rtc-jz4740.c b/drivers/rtc/rtc-jz4740.c
index 1224182d3eab..1e48686ca6d2 100644
--- a/drivers/rtc/rtc-jz4740.c
+++ b/drivers/rtc/rtc-jz4740.c
@@ -210,7 +210,7 @@ void jz4740_rtc_poweroff(struct device *dev)
210} 210}
211EXPORT_SYMBOL_GPL(jz4740_rtc_poweroff); 211EXPORT_SYMBOL_GPL(jz4740_rtc_poweroff);
212 212
213static int __devinit jz4740_rtc_probe(struct platform_device *pdev) 213static int jz4740_rtc_probe(struct platform_device *pdev)
214{ 214{
215 int ret; 215 int ret;
216 struct jz4740_rtc *rtc; 216 struct jz4740_rtc *rtc;
@@ -297,7 +297,7 @@ err_free:
297 return ret; 297 return ret;
298} 298}
299 299
300static int __devexit jz4740_rtc_remove(struct platform_device *pdev) 300static int jz4740_rtc_remove(struct platform_device *pdev)
301{ 301{
302 struct jz4740_rtc *rtc = platform_get_drvdata(pdev); 302 struct jz4740_rtc *rtc = platform_get_drvdata(pdev);
303 303
@@ -347,7 +347,7 @@ static const struct dev_pm_ops jz4740_pm_ops = {
347 347
348static struct platform_driver jz4740_rtc_driver = { 348static struct platform_driver jz4740_rtc_driver = {
349 .probe = jz4740_rtc_probe, 349 .probe = jz4740_rtc_probe,
350 .remove = __devexit_p(jz4740_rtc_remove), 350 .remove = jz4740_rtc_remove,
351 .driver = { 351 .driver = {
352 .name = "jz4740-rtc", 352 .name = "jz4740-rtc",
353 .owner = THIS_MODULE, 353 .owner = THIS_MODULE,
diff --git a/drivers/rtc/rtc-lpc32xx.c b/drivers/rtc/rtc-lpc32xx.c
index d5218553741f..40a598332bac 100644
--- a/drivers/rtc/rtc-lpc32xx.c
+++ b/drivers/rtc/rtc-lpc32xx.c
@@ -197,7 +197,7 @@ static const struct rtc_class_ops lpc32xx_rtc_ops = {
197 .alarm_irq_enable = lpc32xx_rtc_alarm_irq_enable, 197 .alarm_irq_enable = lpc32xx_rtc_alarm_irq_enable,
198}; 198};
199 199
200static int __devinit lpc32xx_rtc_probe(struct platform_device *pdev) 200static int lpc32xx_rtc_probe(struct platform_device *pdev)
201{ 201{
202 struct resource *res; 202 struct resource *res;
203 struct lpc32xx_rtc *rtc; 203 struct lpc32xx_rtc *rtc;
@@ -299,7 +299,7 @@ static int __devinit lpc32xx_rtc_probe(struct platform_device *pdev)
299 return 0; 299 return 0;
300} 300}
301 301
302static int __devexit lpc32xx_rtc_remove(struct platform_device *pdev) 302static int lpc32xx_rtc_remove(struct platform_device *pdev)
303{ 303{
304 struct lpc32xx_rtc *rtc = platform_get_drvdata(pdev); 304 struct lpc32xx_rtc *rtc = platform_get_drvdata(pdev);
305 305
@@ -397,7 +397,7 @@ MODULE_DEVICE_TABLE(of, lpc32xx_rtc_match);
397 397
398static struct platform_driver lpc32xx_rtc_driver = { 398static struct platform_driver lpc32xx_rtc_driver = {
399 .probe = lpc32xx_rtc_probe, 399 .probe = lpc32xx_rtc_probe,
400 .remove = __devexit_p(lpc32xx_rtc_remove), 400 .remove = lpc32xx_rtc_remove,
401 .driver = { 401 .driver = {
402 .name = RTC_NAME, 402 .name = RTC_NAME,
403 .owner = THIS_MODULE, 403 .owner = THIS_MODULE,
diff --git a/drivers/rtc/rtc-ls1x.c b/drivers/rtc/rtc-ls1x.c
index 07e81c5f8247..f59b6349551a 100644
--- a/drivers/rtc/rtc-ls1x.c
+++ b/drivers/rtc/rtc-ls1x.c
@@ -143,7 +143,7 @@ static struct rtc_class_ops ls1x_rtc_ops = {
143 .set_time = ls1x_rtc_set_time, 143 .set_time = ls1x_rtc_set_time,
144}; 144};
145 145
146static int __devinit ls1x_rtc_probe(struct platform_device *pdev) 146static int ls1x_rtc_probe(struct platform_device *pdev)
147{ 147{
148 struct rtc_device *rtcdev; 148 struct rtc_device *rtcdev;
149 unsigned long v; 149 unsigned long v;
@@ -185,7 +185,7 @@ err:
185 return ret; 185 return ret;
186} 186}
187 187
188static int __devexit ls1x_rtc_remove(struct platform_device *pdev) 188static int ls1x_rtc_remove(struct platform_device *pdev)
189{ 189{
190 struct rtc_device *rtcdev = platform_get_drvdata(pdev); 190 struct rtc_device *rtcdev = platform_get_drvdata(pdev);
191 191
@@ -200,7 +200,7 @@ static struct platform_driver ls1x_rtc_driver = {
200 .name = "ls1x-rtc", 200 .name = "ls1x-rtc",
201 .owner = THIS_MODULE, 201 .owner = THIS_MODULE,
202 }, 202 },
203 .remove = __devexit_p(ls1x_rtc_remove), 203 .remove = ls1x_rtc_remove,
204 .probe = ls1x_rtc_probe, 204 .probe = ls1x_rtc_probe,
205}; 205};
206 206
diff --git a/drivers/rtc/rtc-m41t93.c b/drivers/rtc/rtc-m41t93.c
index efab3d48cb15..49169680786e 100644
--- a/drivers/rtc/rtc-m41t93.c
+++ b/drivers/rtc/rtc-m41t93.c
@@ -170,7 +170,7 @@ static const struct rtc_class_ops m41t93_rtc_ops = {
170 170
171static struct spi_driver m41t93_driver; 171static struct spi_driver m41t93_driver;
172 172
173static int __devinit m41t93_probe(struct spi_device *spi) 173static int m41t93_probe(struct spi_device *spi)
174{ 174{
175 struct rtc_device *rtc; 175 struct rtc_device *rtc;
176 int res; 176 int res;
@@ -195,7 +195,7 @@ static int __devinit m41t93_probe(struct spi_device *spi)
195} 195}
196 196
197 197
198static int __devexit m41t93_remove(struct spi_device *spi) 198static int m41t93_remove(struct spi_device *spi)
199{ 199{
200 struct rtc_device *rtc = spi_get_drvdata(spi); 200 struct rtc_device *rtc = spi_get_drvdata(spi);
201 201
@@ -211,7 +211,7 @@ static struct spi_driver m41t93_driver = {
211 .owner = THIS_MODULE, 211 .owner = THIS_MODULE,
212 }, 212 },
213 .probe = m41t93_probe, 213 .probe = m41t93_probe,
214 .remove = __devexit_p(m41t93_remove), 214 .remove = m41t93_remove,
215}; 215};
216 216
217module_spi_driver(m41t93_driver); 217module_spi_driver(m41t93_driver);
diff --git a/drivers/rtc/rtc-m41t94.c b/drivers/rtc/rtc-m41t94.c
index 6e78193e026b..89266c6764bc 100644
--- a/drivers/rtc/rtc-m41t94.c
+++ b/drivers/rtc/rtc-m41t94.c
@@ -110,7 +110,7 @@ static const struct rtc_class_ops m41t94_rtc_ops = {
110 110
111static struct spi_driver m41t94_driver; 111static struct spi_driver m41t94_driver;
112 112
113static int __devinit m41t94_probe(struct spi_device *spi) 113static int m41t94_probe(struct spi_device *spi)
114{ 114{
115 struct rtc_device *rtc; 115 struct rtc_device *rtc;
116 int res; 116 int res;
@@ -134,7 +134,7 @@ static int __devinit m41t94_probe(struct spi_device *spi)
134 return 0; 134 return 0;
135} 135}
136 136
137static int __devexit m41t94_remove(struct spi_device *spi) 137static int m41t94_remove(struct spi_device *spi)
138{ 138{
139 struct rtc_device *rtc = spi_get_drvdata(spi); 139 struct rtc_device *rtc = spi_get_drvdata(spi);
140 140
@@ -150,7 +150,7 @@ static struct spi_driver m41t94_driver = {
150 .owner = THIS_MODULE, 150 .owner = THIS_MODULE,
151 }, 151 },
152 .probe = m41t94_probe, 152 .probe = m41t94_probe,
153 .remove = __devexit_p(m41t94_remove), 153 .remove = m41t94_remove,
154}; 154};
155 155
156module_spi_driver(m41t94_driver); 156module_spi_driver(m41t94_driver);
diff --git a/drivers/rtc/rtc-m48t35.c b/drivers/rtc/rtc-m48t35.c
index f9e3b3583733..31c9190a1fcb 100644
--- a/drivers/rtc/rtc-m48t35.c
+++ b/drivers/rtc/rtc-m48t35.c
@@ -141,7 +141,7 @@ static const struct rtc_class_ops m48t35_ops = {
141 .set_time = m48t35_set_time, 141 .set_time = m48t35_set_time,
142}; 142};
143 143
144static int __devinit m48t35_probe(struct platform_device *pdev) 144static int m48t35_probe(struct platform_device *pdev)
145{ 145{
146 struct resource *res; 146 struct resource *res;
147 struct m48t35_priv *priv; 147 struct m48t35_priv *priv;
@@ -194,7 +194,7 @@ out:
194 return ret; 194 return ret;
195} 195}
196 196
197static int __devexit m48t35_remove(struct platform_device *pdev) 197static int m48t35_remove(struct platform_device *pdev)
198{ 198{
199 struct m48t35_priv *priv = platform_get_drvdata(pdev); 199 struct m48t35_priv *priv = platform_get_drvdata(pdev);
200 200
@@ -213,7 +213,7 @@ static struct platform_driver m48t35_platform_driver = {
213 .owner = THIS_MODULE, 213 .owner = THIS_MODULE,
214 }, 214 },
215 .probe = m48t35_probe, 215 .probe = m48t35_probe,
216 .remove = __devexit_p(m48t35_remove), 216 .remove = m48t35_remove,
217}; 217};
218 218
219module_platform_driver(m48t35_platform_driver); 219module_platform_driver(m48t35_platform_driver);
diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c
index 30ebfec9fd2b..130f29af3869 100644
--- a/drivers/rtc/rtc-m48t59.c
+++ b/drivers/rtc/rtc-m48t59.c
@@ -383,7 +383,7 @@ static struct bin_attribute m48t59_nvram_attr = {
383 .write = m48t59_nvram_write, 383 .write = m48t59_nvram_write,
384}; 384};
385 385
386static int __devinit m48t59_rtc_probe(struct platform_device *pdev) 386static int m48t59_rtc_probe(struct platform_device *pdev)
387{ 387{
388 struct m48t59_plat_data *pdata = pdev->dev.platform_data; 388 struct m48t59_plat_data *pdata = pdev->dev.platform_data;
389 struct m48t59_private *m48t59 = NULL; 389 struct m48t59_private *m48t59 = NULL;
@@ -501,7 +501,7 @@ out:
501 return ret; 501 return ret;
502} 502}
503 503
504static int __devexit m48t59_rtc_remove(struct platform_device *pdev) 504static int m48t59_rtc_remove(struct platform_device *pdev)
505{ 505{
506 struct m48t59_private *m48t59 = platform_get_drvdata(pdev); 506 struct m48t59_private *m48t59 = platform_get_drvdata(pdev);
507 struct m48t59_plat_data *pdata = pdev->dev.platform_data; 507 struct m48t59_plat_data *pdata = pdev->dev.platform_data;
@@ -527,7 +527,7 @@ static struct platform_driver m48t59_rtc_driver = {
527 .owner = THIS_MODULE, 527 .owner = THIS_MODULE,
528 }, 528 },
529 .probe = m48t59_rtc_probe, 529 .probe = m48t59_rtc_probe,
530 .remove = __devexit_p(m48t59_rtc_remove), 530 .remove = m48t59_rtc_remove,
531}; 531};
532 532
533module_platform_driver(m48t59_rtc_driver); 533module_platform_driver(m48t59_rtc_driver);
diff --git a/drivers/rtc/rtc-m48t86.c b/drivers/rtc/rtc-m48t86.c
index 863fb3363aa6..2ffbcacd2439 100644
--- a/drivers/rtc/rtc-m48t86.c
+++ b/drivers/rtc/rtc-m48t86.c
@@ -144,7 +144,7 @@ static const struct rtc_class_ops m48t86_rtc_ops = {
144 .proc = m48t86_rtc_proc, 144 .proc = m48t86_rtc_proc,
145}; 145};
146 146
147static int __devinit m48t86_rtc_probe(struct platform_device *dev) 147static int m48t86_rtc_probe(struct platform_device *dev)
148{ 148{
149 unsigned char reg; 149 unsigned char reg;
150 struct m48t86_ops *ops = dev->dev.platform_data; 150 struct m48t86_ops *ops = dev->dev.platform_data;
@@ -164,7 +164,7 @@ static int __devinit m48t86_rtc_probe(struct platform_device *dev)
164 return 0; 164 return 0;
165} 165}
166 166
167static int __devexit m48t86_rtc_remove(struct platform_device *dev) 167static int m48t86_rtc_remove(struct platform_device *dev)
168{ 168{
169 struct rtc_device *rtc = platform_get_drvdata(dev); 169 struct rtc_device *rtc = platform_get_drvdata(dev);
170 170
@@ -182,7 +182,7 @@ static struct platform_driver m48t86_rtc_platform_driver = {
182 .owner = THIS_MODULE, 182 .owner = THIS_MODULE,
183 }, 183 },
184 .probe = m48t86_rtc_probe, 184 .probe = m48t86_rtc_probe,
185 .remove = __devexit_p(m48t86_rtc_remove), 185 .remove = m48t86_rtc_remove,
186}; 186};
187 187
188module_platform_driver(m48t86_rtc_platform_driver); 188module_platform_driver(m48t86_rtc_platform_driver);
diff --git a/drivers/rtc/rtc-max6902.c b/drivers/rtc/rtc-max6902.c
index 36c74d22e8b5..7d0bf698b79e 100644
--- a/drivers/rtc/rtc-max6902.c
+++ b/drivers/rtc/rtc-max6902.c
@@ -120,7 +120,7 @@ static const struct rtc_class_ops max6902_rtc_ops = {
120 .set_time = max6902_set_time, 120 .set_time = max6902_set_time,
121}; 121};
122 122
123static int __devinit max6902_probe(struct spi_device *spi) 123static int max6902_probe(struct spi_device *spi)
124{ 124{
125 struct rtc_device *rtc; 125 struct rtc_device *rtc;
126 unsigned char tmp; 126 unsigned char tmp;
@@ -143,7 +143,7 @@ static int __devinit max6902_probe(struct spi_device *spi)
143 return 0; 143 return 0;
144} 144}
145 145
146static int __devexit max6902_remove(struct spi_device *spi) 146static int max6902_remove(struct spi_device *spi)
147{ 147{
148 struct rtc_device *rtc = dev_get_drvdata(&spi->dev); 148 struct rtc_device *rtc = dev_get_drvdata(&spi->dev);
149 149
@@ -157,7 +157,7 @@ static struct spi_driver max6902_driver = {
157 .owner = THIS_MODULE, 157 .owner = THIS_MODULE,
158 }, 158 },
159 .probe = max6902_probe, 159 .probe = max6902_probe,
160 .remove = __devexit_p(max6902_remove), 160 .remove = max6902_remove,
161}; 161};
162 162
163module_spi_driver(max6902_driver); 163module_spi_driver(max6902_driver);
diff --git a/drivers/rtc/rtc-max8907.c b/drivers/rtc/rtc-max8907.c
index e094ffa434f8..1d049da16c85 100644
--- a/drivers/rtc/rtc-max8907.c
+++ b/drivers/rtc/rtc-max8907.c
@@ -176,7 +176,7 @@ static const struct rtc_class_ops max8907_rtc_ops = {
176 .set_alarm = max8907_rtc_set_alarm, 176 .set_alarm = max8907_rtc_set_alarm,
177}; 177};
178 178
179static int __devinit max8907_rtc_probe(struct platform_device *pdev) 179static int max8907_rtc_probe(struct platform_device *pdev)
180{ 180{
181 struct max8907 *max8907 = dev_get_drvdata(pdev->dev.parent); 181 struct max8907 *max8907 = dev_get_drvdata(pdev->dev.parent);
182 struct max8907_rtc *rtc; 182 struct max8907_rtc *rtc;
@@ -220,7 +220,7 @@ err_unregister:
220 return ret; 220 return ret;
221} 221}
222 222
223static int __devexit max8907_rtc_remove(struct platform_device *pdev) 223static int max8907_rtc_remove(struct platform_device *pdev)
224{ 224{
225 struct max8907_rtc *rtc = platform_get_drvdata(pdev); 225 struct max8907_rtc *rtc = platform_get_drvdata(pdev);
226 226
@@ -236,7 +236,7 @@ static struct platform_driver max8907_rtc_driver = {
236 .owner = THIS_MODULE, 236 .owner = THIS_MODULE,
237 }, 237 },
238 .probe = max8907_rtc_probe, 238 .probe = max8907_rtc_probe,
239 .remove = __devexit_p(max8907_rtc_remove), 239 .remove = max8907_rtc_remove,
240}; 240};
241module_platform_driver(max8907_rtc_driver); 241module_platform_driver(max8907_rtc_driver);
242 242
diff --git a/drivers/rtc/rtc-max8925.c b/drivers/rtc/rtc-max8925.c
index 34e4349611db..a0c8265646d2 100644
--- a/drivers/rtc/rtc-max8925.c
+++ b/drivers/rtc/rtc-max8925.c
@@ -247,7 +247,7 @@ static const struct rtc_class_ops max8925_rtc_ops = {
247 .set_alarm = max8925_rtc_set_alarm, 247 .set_alarm = max8925_rtc_set_alarm,
248}; 248};
249 249
250static int __devinit max8925_rtc_probe(struct platform_device *pdev) 250static int max8925_rtc_probe(struct platform_device *pdev)
251{ 251{
252 struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); 252 struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent);
253 struct max8925_rtc_info *info; 253 struct max8925_rtc_info *info;
@@ -292,7 +292,7 @@ out_irq:
292 return ret; 292 return ret;
293} 293}
294 294
295static int __devexit max8925_rtc_remove(struct platform_device *pdev) 295static int max8925_rtc_remove(struct platform_device *pdev)
296{ 296{
297 struct max8925_rtc_info *info = platform_get_drvdata(pdev); 297 struct max8925_rtc_info *info = platform_get_drvdata(pdev);
298 298
@@ -334,7 +334,7 @@ static struct platform_driver max8925_rtc_driver = {
334 .pm = &max8925_rtc_pm_ops, 334 .pm = &max8925_rtc_pm_ops,
335 }, 335 },
336 .probe = max8925_rtc_probe, 336 .probe = max8925_rtc_probe,
337 .remove = __devexit_p(max8925_rtc_remove), 337 .remove = max8925_rtc_remove,
338}; 338};
339 339
340module_platform_driver(max8925_rtc_driver); 340module_platform_driver(max8925_rtc_driver);
diff --git a/drivers/rtc/rtc-max8998.c b/drivers/rtc/rtc-max8998.c
index 7196f438c089..8f234a075e8f 100644
--- a/drivers/rtc/rtc-max8998.c
+++ b/drivers/rtc/rtc-max8998.c
@@ -249,7 +249,7 @@ static const struct rtc_class_ops max8998_rtc_ops = {
249 .alarm_irq_enable = max8998_rtc_alarm_irq_enable, 249 .alarm_irq_enable = max8998_rtc_alarm_irq_enable,
250}; 250};
251 251
252static int __devinit max8998_rtc_probe(struct platform_device *pdev) 252static int max8998_rtc_probe(struct platform_device *pdev)
253{ 253{
254 struct max8998_dev *max8998 = dev_get_drvdata(pdev->dev.parent); 254 struct max8998_dev *max8998 = dev_get_drvdata(pdev->dev.parent);
255 struct max8998_platform_data *pdata = dev_get_platdata(max8998->dev); 255 struct max8998_platform_data *pdata = dev_get_platdata(max8998->dev);
@@ -298,7 +298,7 @@ out_rtc:
298 return ret; 298 return ret;
299} 299}
300 300
301static int __devexit max8998_rtc_remove(struct platform_device *pdev) 301static int max8998_rtc_remove(struct platform_device *pdev)
302{ 302{
303 struct max8998_rtc_info *info = platform_get_drvdata(pdev); 303 struct max8998_rtc_info *info = platform_get_drvdata(pdev);
304 304
@@ -323,7 +323,7 @@ static struct platform_driver max8998_rtc_driver = {
323 .owner = THIS_MODULE, 323 .owner = THIS_MODULE,
324 }, 324 },
325 .probe = max8998_rtc_probe, 325 .probe = max8998_rtc_probe,
326 .remove = __devexit_p(max8998_rtc_remove), 326 .remove = max8998_rtc_remove,
327 .id_table = max8998_rtc_id, 327 .id_table = max8998_rtc_id,
328}; 328};
329 329
diff --git a/drivers/rtc/rtc-mpc5121.c b/drivers/rtc/rtc-mpc5121.c
index 029e421baaed..bec10be96f84 100644
--- a/drivers/rtc/rtc-mpc5121.c
+++ b/drivers/rtc/rtc-mpc5121.c
@@ -306,7 +306,7 @@ static const struct rtc_class_ops mpc5200_rtc_ops = {
306 .alarm_irq_enable = mpc5121_rtc_alarm_irq_enable, 306 .alarm_irq_enable = mpc5121_rtc_alarm_irq_enable,
307}; 307};
308 308
309static int __devinit mpc5121_rtc_probe(struct platform_device *op) 309static int mpc5121_rtc_probe(struct platform_device *op)
310{ 310{
311 struct mpc5121_rtc_data *rtc; 311 struct mpc5121_rtc_data *rtc;
312 int err = 0; 312 int err = 0;
@@ -382,7 +382,7 @@ out_free:
382 return err; 382 return err;
383} 383}
384 384
385static int __devexit mpc5121_rtc_remove(struct platform_device *op) 385static int mpc5121_rtc_remove(struct platform_device *op)
386{ 386{
387 struct mpc5121_rtc_data *rtc = dev_get_drvdata(&op->dev); 387 struct mpc5121_rtc_data *rtc = dev_get_drvdata(&op->dev);
388 struct mpc5121_rtc_regs __iomem *regs = rtc->regs; 388 struct mpc5121_rtc_regs __iomem *regs = rtc->regs;
@@ -403,7 +403,7 @@ static int __devexit mpc5121_rtc_remove(struct platform_device *op)
403 return 0; 403 return 0;
404} 404}
405 405
406static struct of_device_id mpc5121_rtc_match[] __devinitdata = { 406static struct of_device_id mpc5121_rtc_match[] = {
407 { .compatible = "fsl,mpc5121-rtc", }, 407 { .compatible = "fsl,mpc5121-rtc", },
408 { .compatible = "fsl,mpc5200-rtc", }, 408 { .compatible = "fsl,mpc5200-rtc", },
409 {}, 409 {},
@@ -416,7 +416,7 @@ static struct platform_driver mpc5121_rtc_driver = {
416 .of_match_table = mpc5121_rtc_match, 416 .of_match_table = mpc5121_rtc_match,
417 }, 417 },
418 .probe = mpc5121_rtc_probe, 418 .probe = mpc5121_rtc_probe,
419 .remove = __devexit_p(mpc5121_rtc_remove), 419 .remove = mpc5121_rtc_remove,
420}; 420};
421 421
422module_platform_driver(mpc5121_rtc_driver); 422module_platform_driver(mpc5121_rtc_driver);
diff --git a/drivers/rtc/rtc-mrst.c b/drivers/rtc/rtc-mrst.c
index f51719bf4a75..578baf9d9725 100644
--- a/drivers/rtc/rtc-mrst.c
+++ b/drivers/rtc/rtc-mrst.c
@@ -322,8 +322,8 @@ static irqreturn_t mrst_rtc_irq(int irq, void *p)
322 return IRQ_NONE; 322 return IRQ_NONE;
323} 323}
324 324
325static int __devinit 325static int vrtc_mrst_do_probe(struct device *dev, struct resource *iomem,
326vrtc_mrst_do_probe(struct device *dev, struct resource *iomem, int rtc_irq) 326 int rtc_irq)
327{ 327{
328 int retval = 0; 328 int retval = 0;
329 unsigned char rtc_control; 329 unsigned char rtc_control;
@@ -394,7 +394,7 @@ static void rtc_mrst_do_shutdown(void)
394 spin_unlock_irq(&rtc_lock); 394 spin_unlock_irq(&rtc_lock);
395} 395}
396 396
397static void __devexit rtc_mrst_do_remove(struct device *dev) 397static void rtc_mrst_do_remove(struct device *dev)
398{ 398{
399 struct mrst_rtc *mrst = dev_get_drvdata(dev); 399 struct mrst_rtc *mrst = dev_get_drvdata(dev);
400 struct resource *iomem; 400 struct resource *iomem;
@@ -503,14 +503,14 @@ static inline int mrst_poweroff(struct device *dev)
503 503
504#endif 504#endif
505 505
506static int __devinit vrtc_mrst_platform_probe(struct platform_device *pdev) 506static int vrtc_mrst_platform_probe(struct platform_device *pdev)
507{ 507{
508 return vrtc_mrst_do_probe(&pdev->dev, 508 return vrtc_mrst_do_probe(&pdev->dev,
509 platform_get_resource(pdev, IORESOURCE_MEM, 0), 509 platform_get_resource(pdev, IORESOURCE_MEM, 0),
510 platform_get_irq(pdev, 0)); 510 platform_get_irq(pdev, 0));
511} 511}
512 512
513static int __devexit vrtc_mrst_platform_remove(struct platform_device *pdev) 513static int vrtc_mrst_platform_remove(struct platform_device *pdev)
514{ 514{
515 rtc_mrst_do_remove(&pdev->dev); 515 rtc_mrst_do_remove(&pdev->dev);
516 return 0; 516 return 0;
@@ -528,7 +528,7 @@ MODULE_ALIAS("platform:vrtc_mrst");
528 528
529static struct platform_driver vrtc_mrst_platform_driver = { 529static struct platform_driver vrtc_mrst_platform_driver = {
530 .probe = vrtc_mrst_platform_probe, 530 .probe = vrtc_mrst_platform_probe,
531 .remove = __devexit_p(vrtc_mrst_platform_remove), 531 .remove = vrtc_mrst_platform_remove,
532 .shutdown = vrtc_mrst_platform_shutdown, 532 .shutdown = vrtc_mrst_platform_shutdown,
533 .driver = { 533 .driver = {
534 .name = (char *) driver_name, 534 .name = (char *) driver_name,
diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c
index ebc1649d45d6..57233c885998 100644
--- a/drivers/rtc/rtc-mv.c
+++ b/drivers/rtc/rtc-mv.c
@@ -215,7 +215,7 @@ static const struct rtc_class_ops mv_rtc_alarm_ops = {
215 .alarm_irq_enable = mv_rtc_alarm_irq_enable, 215 .alarm_irq_enable = mv_rtc_alarm_irq_enable,
216}; 216};
217 217
218static int __devinit mv_rtc_probe(struct platform_device *pdev) 218static int mv_rtc_probe(struct platform_device *pdev)
219{ 219{
220 struct resource *res; 220 struct resource *res;
221 struct rtc_plat_data *pdata; 221 struct rtc_plat_data *pdata;
diff --git a/drivers/rtc/rtc-mxc.c b/drivers/rtc/rtc-mxc.c
index 7304139934aa..1c3ef7289565 100644
--- a/drivers/rtc/rtc-mxc.c
+++ b/drivers/rtc/rtc-mxc.c
@@ -368,7 +368,7 @@ static struct rtc_class_ops mxc_rtc_ops = {
368 .alarm_irq_enable = mxc_rtc_alarm_irq_enable, 368 .alarm_irq_enable = mxc_rtc_alarm_irq_enable,
369}; 369};
370 370
371static int __devinit mxc_rtc_probe(struct platform_device *pdev) 371static int mxc_rtc_probe(struct platform_device *pdev)
372{ 372{
373 struct resource *res; 373 struct resource *res;
374 struct rtc_device *rtc; 374 struct rtc_device *rtc;
@@ -460,7 +460,7 @@ exit_free_pdata:
460 return ret; 460 return ret;
461} 461}
462 462
463static int __devexit mxc_rtc_remove(struct platform_device *pdev) 463static int mxc_rtc_remove(struct platform_device *pdev)
464{ 464{
465 struct rtc_plat_data *pdata = platform_get_drvdata(pdev); 465 struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
466 466
@@ -509,7 +509,7 @@ static struct platform_driver mxc_rtc_driver = {
509 }, 509 },
510 .id_table = imx_rtc_devtype, 510 .id_table = imx_rtc_devtype,
511 .probe = mxc_rtc_probe, 511 .probe = mxc_rtc_probe,
512 .remove = __devexit_p(mxc_rtc_remove), 512 .remove = mxc_rtc_remove,
513}; 513};
514 514
515module_platform_driver(mxc_rtc_driver) 515module_platform_driver(mxc_rtc_driver)
diff --git a/drivers/rtc/rtc-nuc900.c b/drivers/rtc/rtc-nuc900.c
index b79010987d1e..a63680850fef 100644
--- a/drivers/rtc/rtc-nuc900.c
+++ b/drivers/rtc/rtc-nuc900.c
@@ -222,7 +222,7 @@ static struct rtc_class_ops nuc900_rtc_ops = {
222 .alarm_irq_enable = nuc900_alarm_irq_enable, 222 .alarm_irq_enable = nuc900_alarm_irq_enable,
223}; 223};
224 224
225static int __devinit nuc900_rtc_probe(struct platform_device *pdev) 225static int nuc900_rtc_probe(struct platform_device *pdev)
226{ 226{
227 struct resource *res; 227 struct resource *res;
228 struct nuc900_rtc *nuc900_rtc; 228 struct nuc900_rtc *nuc900_rtc;
@@ -284,7 +284,7 @@ fail1: kfree(nuc900_rtc);
284 return err; 284 return err;
285} 285}
286 286
287static int __devexit nuc900_rtc_remove(struct platform_device *pdev) 287static int nuc900_rtc_remove(struct platform_device *pdev)
288{ 288{
289 struct nuc900_rtc *nuc900_rtc = platform_get_drvdata(pdev); 289 struct nuc900_rtc *nuc900_rtc = platform_get_drvdata(pdev);
290 struct resource *res; 290 struct resource *res;
@@ -304,7 +304,7 @@ static int __devexit nuc900_rtc_remove(struct platform_device *pdev)
304} 304}
305 305
306static struct platform_driver nuc900_rtc_driver = { 306static struct platform_driver nuc900_rtc_driver = {
307 .remove = __devexit_p(nuc900_rtc_remove), 307 .remove = nuc900_rtc_remove,
308 .driver = { 308 .driver = {
309 .name = "nuc900-rtc", 309 .name = "nuc900-rtc",
310 .owner = THIS_MODULE, 310 .owner = THIS_MODULE,
diff --git a/drivers/rtc/rtc-pcap.c b/drivers/rtc/rtc-pcap.c
index cd4f198cc2ef..e0019cd0bf71 100644
--- a/drivers/rtc/rtc-pcap.c
+++ b/drivers/rtc/rtc-pcap.c
@@ -139,7 +139,7 @@ static const struct rtc_class_ops pcap_rtc_ops = {
139 .alarm_irq_enable = pcap_rtc_alarm_irq_enable, 139 .alarm_irq_enable = pcap_rtc_alarm_irq_enable,
140}; 140};
141 141
142static int __devinit pcap_rtc_probe(struct platform_device *pdev) 142static int pcap_rtc_probe(struct platform_device *pdev)
143{ 143{
144 struct pcap_rtc *pcap_rtc; 144 struct pcap_rtc *pcap_rtc;
145 int timer_irq, alarm_irq; 145 int timer_irq, alarm_irq;
@@ -183,7 +183,7 @@ fail_rtc:
183 return err; 183 return err;
184} 184}
185 185
186static int __devexit pcap_rtc_remove(struct platform_device *pdev) 186static int pcap_rtc_remove(struct platform_device *pdev)
187{ 187{
188 struct pcap_rtc *pcap_rtc = platform_get_drvdata(pdev); 188 struct pcap_rtc *pcap_rtc = platform_get_drvdata(pdev);
189 189
@@ -196,7 +196,7 @@ static int __devexit pcap_rtc_remove(struct platform_device *pdev)
196} 196}
197 197
198static struct platform_driver pcap_rtc_driver = { 198static struct platform_driver pcap_rtc_driver = {
199 .remove = __devexit_p(pcap_rtc_remove), 199 .remove = pcap_rtc_remove,
200 .driver = { 200 .driver = {
201 .name = "pcap-rtc", 201 .name = "pcap-rtc",
202 .owner = THIS_MODULE, 202 .owner = THIS_MODULE,
diff --git a/drivers/rtc/rtc-pcf2123.c b/drivers/rtc/rtc-pcf2123.c
index 13e4df63974f..02b742afa761 100644
--- a/drivers/rtc/rtc-pcf2123.c
+++ b/drivers/rtc/rtc-pcf2123.c
@@ -219,7 +219,7 @@ static const struct rtc_class_ops pcf2123_rtc_ops = {
219 .set_time = pcf2123_rtc_set_time, 219 .set_time = pcf2123_rtc_set_time,
220}; 220};
221 221
222static int __devinit pcf2123_probe(struct spi_device *spi) 222static int pcf2123_probe(struct spi_device *spi)
223{ 223{
224 struct rtc_device *rtc; 224 struct rtc_device *rtc;
225 struct pcf2123_plat_data *pdata; 225 struct pcf2123_plat_data *pdata;
@@ -319,7 +319,7 @@ kfree_exit:
319 return ret; 319 return ret;
320} 320}
321 321
322static int __devexit pcf2123_remove(struct spi_device *spi) 322static int pcf2123_remove(struct spi_device *spi)
323{ 323{
324 struct pcf2123_plat_data *pdata = spi->dev.platform_data; 324 struct pcf2123_plat_data *pdata = spi->dev.platform_data;
325 int i; 325 int i;
@@ -345,7 +345,7 @@ static struct spi_driver pcf2123_driver = {
345 .owner = THIS_MODULE, 345 .owner = THIS_MODULE,
346 }, 346 },
347 .probe = pcf2123_probe, 347 .probe = pcf2123_probe,
348 .remove = __devexit_p(pcf2123_remove), 348 .remove = pcf2123_remove,
349}; 349};
350 350
351module_spi_driver(pcf2123_driver); 351module_spi_driver(pcf2123_driver);
diff --git a/drivers/rtc/rtc-pcf50633.c b/drivers/rtc/rtc-pcf50633.c
index a20202f9ee57..e9f3135d305f 100644
--- a/drivers/rtc/rtc-pcf50633.c
+++ b/drivers/rtc/rtc-pcf50633.c
@@ -248,7 +248,7 @@ static void pcf50633_rtc_irq(int irq, void *data)
248 rtc->alarm_pending = 1; 248 rtc->alarm_pending = 1;
249} 249}
250 250
251static int __devinit pcf50633_rtc_probe(struct platform_device *pdev) 251static int pcf50633_rtc_probe(struct platform_device *pdev)
252{ 252{
253 struct pcf50633_rtc *rtc; 253 struct pcf50633_rtc *rtc;
254 254
@@ -272,7 +272,7 @@ static int __devinit pcf50633_rtc_probe(struct platform_device *pdev)
272 return 0; 272 return 0;
273} 273}
274 274
275static int __devexit pcf50633_rtc_remove(struct platform_device *pdev) 275static int pcf50633_rtc_remove(struct platform_device *pdev)
276{ 276{
277 struct pcf50633_rtc *rtc; 277 struct pcf50633_rtc *rtc;
278 278
@@ -291,7 +291,7 @@ static struct platform_driver pcf50633_rtc_driver = {
291 .name = "pcf50633-rtc", 291 .name = "pcf50633-rtc",
292 }, 292 },
293 .probe = pcf50633_rtc_probe, 293 .probe = pcf50633_rtc_probe,
294 .remove = __devexit_p(pcf50633_rtc_remove), 294 .remove = pcf50633_rtc_remove,
295}; 295};
296 296
297module_platform_driver(pcf50633_rtc_driver); 297module_platform_driver(pcf50633_rtc_driver);
diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c
index 98e3a2b681e6..7098ee89bd29 100644
--- a/drivers/rtc/rtc-pcf8563.c
+++ b/drivers/rtc/rtc-pcf8563.c
@@ -296,7 +296,7 @@ static const struct i2c_device_id pcf8563_id[] = {
296MODULE_DEVICE_TABLE(i2c, pcf8563_id); 296MODULE_DEVICE_TABLE(i2c, pcf8563_id);
297 297
298#ifdef CONFIG_OF 298#ifdef CONFIG_OF
299static const struct of_device_id pcf8563_of_match[] __devinitconst = { 299static const struct of_device_id pcf8563_of_match[] = {
300 { .compatible = "nxp,pcf8563" }, 300 { .compatible = "nxp,pcf8563" },
301 {} 301 {}
302}; 302};
diff --git a/drivers/rtc/rtc-pcf8583.c b/drivers/rtc/rtc-pcf8583.c
index 019ff3571168..3415b8f18555 100644
--- a/drivers/rtc/rtc-pcf8583.c
+++ b/drivers/rtc/rtc-pcf8583.c
@@ -294,7 +294,7 @@ exit_kfree:
294 return err; 294 return err;
295} 295}
296 296
297static int __devexit pcf8583_remove(struct i2c_client *client) 297static int pcf8583_remove(struct i2c_client *client)
298{ 298{
299 struct pcf8583 *pcf8583 = i2c_get_clientdata(client); 299 struct pcf8583 *pcf8583 = i2c_get_clientdata(client);
300 300
@@ -316,7 +316,7 @@ static struct i2c_driver pcf8583_driver = {
316 .owner = THIS_MODULE, 316 .owner = THIS_MODULE,
317 }, 317 },
318 .probe = pcf8583_probe, 318 .probe = pcf8583_probe,
319 .remove = __devexit_p(pcf8583_remove), 319 .remove = pcf8583_remove,
320 .id_table = pcf8583_id, 320 .id_table = pcf8583_id,
321}; 321};
322 322
diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
index d00bd24342a3..f1a6557261f3 100644
--- a/drivers/rtc/rtc-pm8xxx.c
+++ b/drivers/rtc/rtc-pm8xxx.c
@@ -382,7 +382,7 @@ rtc_alarm_handled:
382 return IRQ_HANDLED; 382 return IRQ_HANDLED;
383} 383}
384 384
385static int __devinit pm8xxx_rtc_probe(struct platform_device *pdev) 385static int pm8xxx_rtc_probe(struct platform_device *pdev)
386{ 386{
387 int rc; 387 int rc;
388 u8 ctrl_reg; 388 u8 ctrl_reg;
@@ -485,7 +485,7 @@ fail_rtc_enable:
485 return rc; 485 return rc;
486} 486}
487 487
488static int __devexit pm8xxx_rtc_remove(struct platform_device *pdev) 488static int pm8xxx_rtc_remove(struct platform_device *pdev)
489{ 489{
490 struct pm8xxx_rtc *rtc_dd = platform_get_drvdata(pdev); 490 struct pm8xxx_rtc *rtc_dd = platform_get_drvdata(pdev);
491 491
@@ -524,7 +524,7 @@ static SIMPLE_DEV_PM_OPS(pm8xxx_rtc_pm_ops, pm8xxx_rtc_suspend, pm8xxx_rtc_resum
524 524
525static struct platform_driver pm8xxx_rtc_driver = { 525static struct platform_driver pm8xxx_rtc_driver = {
526 .probe = pm8xxx_rtc_probe, 526 .probe = pm8xxx_rtc_probe,
527 .remove = __devexit_p(pm8xxx_rtc_remove), 527 .remove = pm8xxx_rtc_remove,
528 .driver = { 528 .driver = {
529 .name = PM8XXX_RTC_DEV_NAME, 529 .name = PM8XXX_RTC_DEV_NAME,
530 .owner = THIS_MODULE, 530 .owner = THIS_MODULE,
diff --git a/drivers/rtc/rtc-puv3.c b/drivers/rtc/rtc-puv3.c
index ab0acaeb2371..0407e13d4de4 100644
--- a/drivers/rtc/rtc-puv3.c
+++ b/drivers/rtc/rtc-puv3.c
@@ -220,7 +220,7 @@ static void puv3_rtc_enable(struct platform_device *pdev, int en)
220 } 220 }
221} 221}
222 222
223static int __devexit puv3_rtc_remove(struct platform_device *dev) 223static int puv3_rtc_remove(struct platform_device *dev)
224{ 224{
225 struct rtc_device *rtc = platform_get_drvdata(dev); 225 struct rtc_device *rtc = platform_get_drvdata(dev);
226 226
@@ -236,7 +236,7 @@ static int __devexit puv3_rtc_remove(struct platform_device *dev)
236 return 0; 236 return 0;
237} 237}
238 238
239static int __devinit puv3_rtc_probe(struct platform_device *pdev) 239static int puv3_rtc_probe(struct platform_device *pdev)
240{ 240{
241 struct rtc_device *rtc; 241 struct rtc_device *rtc;
242 struct resource *res; 242 struct resource *res;
@@ -328,7 +328,7 @@ static int puv3_rtc_resume(struct platform_device *pdev)
328 328
329static struct platform_driver puv3_rtc_driver = { 329static struct platform_driver puv3_rtc_driver = {
330 .probe = puv3_rtc_probe, 330 .probe = puv3_rtc_probe,
331 .remove = __devexit_p(puv3_rtc_remove), 331 .remove = puv3_rtc_remove,
332 .suspend = puv3_rtc_suspend, 332 .suspend = puv3_rtc_suspend,
333 .resume = puv3_rtc_resume, 333 .resume = puv3_rtc_resume,
334 .driver = { 334 .driver = {
diff --git a/drivers/rtc/rtc-r9701.c b/drivers/rtc/rtc-r9701.c
index 2c183ebff715..7726f4a4f2d0 100644
--- a/drivers/rtc/rtc-r9701.c
+++ b/drivers/rtc/rtc-r9701.c
@@ -119,7 +119,7 @@ static const struct rtc_class_ops r9701_rtc_ops = {
119 .set_time = r9701_set_datetime, 119 .set_time = r9701_set_datetime,
120}; 120};
121 121
122static int __devinit r9701_probe(struct spi_device *spi) 122static int r9701_probe(struct spi_device *spi)
123{ 123{
124 struct rtc_device *rtc; 124 struct rtc_device *rtc;
125 struct rtc_time dt; 125 struct rtc_time dt;
@@ -164,7 +164,7 @@ static int __devinit r9701_probe(struct spi_device *spi)
164 return 0; 164 return 0;
165} 165}
166 166
167static int __devexit r9701_remove(struct spi_device *spi) 167static int r9701_remove(struct spi_device *spi)
168{ 168{
169 struct rtc_device *rtc = dev_get_drvdata(&spi->dev); 169 struct rtc_device *rtc = dev_get_drvdata(&spi->dev);
170 170
@@ -178,7 +178,7 @@ static struct spi_driver r9701_driver = {
178 .owner = THIS_MODULE, 178 .owner = THIS_MODULE,
179 }, 179 },
180 .probe = r9701_probe, 180 .probe = r9701_probe,
181 .remove = __devexit_p(r9701_remove), 181 .remove = r9701_remove,
182}; 182};
183 183
184module_spi_driver(r9701_driver); 184module_spi_driver(r9701_driver);
diff --git a/drivers/rtc/rtc-rc5t583.c b/drivers/rtc/rtc-rc5t583.c
index cdb140c29c56..eb3194d664a8 100644
--- a/drivers/rtc/rtc-rc5t583.c
+++ b/drivers/rtc/rtc-rc5t583.c
@@ -211,7 +211,7 @@ static const struct rtc_class_ops rc5t583_rtc_ops = {
211 .alarm_irq_enable = rc5t583_rtc_alarm_irq_enable, 211 .alarm_irq_enable = rc5t583_rtc_alarm_irq_enable,
212}; 212};
213 213
214static int __devinit rc5t583_rtc_probe(struct platform_device *pdev) 214static int rc5t583_rtc_probe(struct platform_device *pdev)
215{ 215{
216 struct rc5t583 *rc5t583 = dev_get_drvdata(pdev->dev.parent); 216 struct rc5t583 *rc5t583 = dev_get_drvdata(pdev->dev.parent);
217 struct rc5t583_rtc *ricoh_rtc; 217 struct rc5t583_rtc *ricoh_rtc;
@@ -271,7 +271,7 @@ static int __devinit rc5t583_rtc_probe(struct platform_device *pdev)
271 * Disable rc5t583 RTC interrupts. 271 * Disable rc5t583 RTC interrupts.
272 * Sets status flag to free. 272 * Sets status flag to free.
273 */ 273 */
274static int __devexit rc5t583_rtc_remove(struct platform_device *pdev) 274static int rc5t583_rtc_remove(struct platform_device *pdev)
275{ 275{
276 struct rc5t583_rtc *rc5t583_rtc = dev_get_drvdata(&pdev->dev); 276 struct rc5t583_rtc *rc5t583_rtc = dev_get_drvdata(&pdev->dev);
277 277
@@ -317,7 +317,7 @@ static const struct dev_pm_ops rc5t583_rtc_pm_ops = {
317 317
318static struct platform_driver rc5t583_rtc_driver = { 318static struct platform_driver rc5t583_rtc_driver = {
319 .probe = rc5t583_rtc_probe, 319 .probe = rc5t583_rtc_probe,
320 .remove = __devexit_p(rc5t583_rtc_remove), 320 .remove = rc5t583_rtc_remove,
321 .driver = { 321 .driver = {
322 .owner = THIS_MODULE, 322 .owner = THIS_MODULE,
323 .name = "rtc-rc5t583", 323 .name = "rtc-rc5t583",
diff --git a/drivers/rtc/rtc-rs5c313.c b/drivers/rtc/rtc-rs5c313.c
index e3ff179b99ca..d1aee793ecc8 100644
--- a/drivers/rtc/rtc-rs5c313.c
+++ b/drivers/rtc/rtc-rs5c313.c
@@ -377,7 +377,7 @@ static int rs5c313_rtc_probe(struct platform_device *pdev)
377 return 0; 377 return 0;
378} 378}
379 379
380static int __devexit rs5c313_rtc_remove(struct platform_device *pdev) 380static int rs5c313_rtc_remove(struct platform_device *pdev)
381{ 381{
382 struct rtc_device *rtc = platform_get_drvdata( pdev ); 382 struct rtc_device *rtc = platform_get_drvdata( pdev );
383 383
@@ -392,7 +392,7 @@ static struct platform_driver rs5c313_rtc_platform_driver = {
392 .owner = THIS_MODULE, 392 .owner = THIS_MODULE,
393 }, 393 },
394 .probe = rs5c313_rtc_probe, 394 .probe = rs5c313_rtc_probe,
395 .remove = __devexit_p( rs5c313_rtc_remove ), 395 .remove = rs5c313_rtc_remove,
396}; 396};
397 397
398static int __init rs5c313_rtc_init(void) 398static int __init rs5c313_rtc_init(void)
diff --git a/drivers/rtc/rtc-rs5c348.c b/drivers/rtc/rtc-rs5c348.c
index fd5c7af04ae5..72ef10be8662 100644
--- a/drivers/rtc/rtc-rs5c348.c
+++ b/drivers/rtc/rtc-rs5c348.c
@@ -152,7 +152,7 @@ static const struct rtc_class_ops rs5c348_rtc_ops = {
152 152
153static struct spi_driver rs5c348_driver; 153static struct spi_driver rs5c348_driver;
154 154
155static int __devinit rs5c348_probe(struct spi_device *spi) 155static int rs5c348_probe(struct spi_device *spi)
156{ 156{
157 int ret; 157 int ret;
158 struct rtc_device *rtc; 158 struct rtc_device *rtc;
@@ -218,7 +218,7 @@ static int __devinit rs5c348_probe(struct spi_device *spi)
218 return ret; 218 return ret;
219} 219}
220 220
221static int __devexit rs5c348_remove(struct spi_device *spi) 221static int rs5c348_remove(struct spi_device *spi)
222{ 222{
223 struct rs5c348_plat_data *pdata = spi->dev.platform_data; 223 struct rs5c348_plat_data *pdata = spi->dev.platform_data;
224 struct rtc_device *rtc = pdata->rtc; 224 struct rtc_device *rtc = pdata->rtc;
@@ -235,7 +235,7 @@ static struct spi_driver rs5c348_driver = {
235 .owner = THIS_MODULE, 235 .owner = THIS_MODULE,
236 }, 236 },
237 .probe = rs5c348_probe, 237 .probe = rs5c348_probe,
238 .remove = __devexit_p(rs5c348_remove), 238 .remove = rs5c348_remove,
239}; 239};
240 240
241module_spi_driver(rs5c348_driver); 241module_spi_driver(rs5c348_driver);
diff --git a/drivers/rtc/rtc-rv3029c2.c b/drivers/rtc/rtc-rv3029c2.c
index 0fbe57b2f6d2..f8ee8ad7825e 100644
--- a/drivers/rtc/rtc-rv3029c2.c
+++ b/drivers/rtc/rtc-rv3029c2.c
@@ -385,8 +385,8 @@ static struct i2c_device_id rv3029c2_id[] = {
385}; 385};
386MODULE_DEVICE_TABLE(i2c, rv3029c2_id); 386MODULE_DEVICE_TABLE(i2c, rv3029c2_id);
387 387
388static int __devinit 388static int rv3029c2_probe(struct i2c_client *client,
389rv3029c2_probe(struct i2c_client *client, const struct i2c_device_id *id) 389 const struct i2c_device_id *id)
390{ 390{
391 struct rtc_device *rtc; 391 struct rtc_device *rtc;
392 int rc = 0; 392 int rc = 0;
@@ -418,7 +418,7 @@ exit_unregister:
418 return rc; 418 return rc;
419} 419}
420 420
421static int __devexit rv3029c2_remove(struct i2c_client *client) 421static int rv3029c2_remove(struct i2c_client *client)
422{ 422{
423 struct rtc_device *rtc = i2c_get_clientdata(client); 423 struct rtc_device *rtc = i2c_get_clientdata(client);
424 424
@@ -432,7 +432,7 @@ static struct i2c_driver rv3029c2_driver = {
432 .name = "rtc-rv3029c2", 432 .name = "rtc-rv3029c2",
433 }, 433 },
434 .probe = rv3029c2_probe, 434 .probe = rv3029c2_probe,
435 .remove = __devexit_p(rv3029c2_remove), 435 .remove = rv3029c2_remove,
436 .id_table = rv3029c2_id, 436 .id_table = rv3029c2_id,
437}; 437};
438 438
diff --git a/drivers/rtc/rtc-rx8025.c b/drivers/rtc/rtc-rx8025.c
index 0de902dc1cd5..0722d36b9c9a 100644
--- a/drivers/rtc/rtc-rx8025.c
+++ b/drivers/rtc/rtc-rx8025.c
@@ -534,8 +534,8 @@ static void rx8025_sysfs_unregister(struct device *dev)
534 device_remove_file(dev, &dev_attr_clock_adjust_ppb); 534 device_remove_file(dev, &dev_attr_clock_adjust_ppb);
535} 535}
536 536
537static int __devinit rx8025_probe(struct i2c_client *client, 537static int rx8025_probe(struct i2c_client *client,
538 const struct i2c_device_id *id) 538 const struct i2c_device_id *id)
539{ 539{
540 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); 540 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
541 struct rx8025_data *rx8025; 541 struct rx8025_data *rx8025;
@@ -614,7 +614,7 @@ errout:
614 return err; 614 return err;
615} 615}
616 616
617static int __devexit rx8025_remove(struct i2c_client *client) 617static int rx8025_remove(struct i2c_client *client)
618{ 618{
619 struct rx8025_data *rx8025 = i2c_get_clientdata(client); 619 struct rx8025_data *rx8025 = i2c_get_clientdata(client);
620 struct mutex *lock = &rx8025->rtc->ops_lock; 620 struct mutex *lock = &rx8025->rtc->ops_lock;
@@ -640,7 +640,7 @@ static struct i2c_driver rx8025_driver = {
640 .owner = THIS_MODULE, 640 .owner = THIS_MODULE,
641 }, 641 },
642 .probe = rx8025_probe, 642 .probe = rx8025_probe,
643 .remove = __devexit_p(rx8025_remove), 643 .remove = rx8025_remove,
644 .id_table = rx8025_id, 644 .id_table = rx8025_id,
645}; 645};
646 646
diff --git a/drivers/rtc/rtc-rx8581.c b/drivers/rtc/rtc-rx8581.c
index d84825124a7a..b0c272658fa2 100644
--- a/drivers/rtc/rtc-rx8581.c
+++ b/drivers/rtc/rtc-rx8581.c
@@ -228,8 +228,8 @@ static const struct rtc_class_ops rx8581_rtc_ops = {
228 .set_time = rx8581_rtc_set_time, 228 .set_time = rx8581_rtc_set_time,
229}; 229};
230 230
231static int __devinit rx8581_probe(struct i2c_client *client, 231static int rx8581_probe(struct i2c_client *client,
232 const struct i2c_device_id *id) 232 const struct i2c_device_id *id)
233{ 233{
234 struct rtc_device *rtc; 234 struct rtc_device *rtc;
235 235
@@ -251,7 +251,7 @@ static int __devinit rx8581_probe(struct i2c_client *client,
251 return 0; 251 return 0;
252} 252}
253 253
254static int __devexit rx8581_remove(struct i2c_client *client) 254static int rx8581_remove(struct i2c_client *client)
255{ 255{
256 struct rtc_device *rtc = i2c_get_clientdata(client); 256 struct rtc_device *rtc = i2c_get_clientdata(client);
257 257
@@ -272,7 +272,7 @@ static struct i2c_driver rx8581_driver = {
272 .owner = THIS_MODULE, 272 .owner = THIS_MODULE,
273 }, 273 },
274 .probe = rx8581_probe, 274 .probe = rx8581_probe,
275 .remove = __devexit_p(rx8581_remove), 275 .remove = rx8581_remove,
276 .id_table = rx8581_id, 276 .id_table = rx8581_id,
277}; 277};
278 278
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 4bd9414aee65..404651464d45 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -421,7 +421,7 @@ static void s3c_rtc_enable(struct platform_device *pdev, int en)
421 clk_disable(rtc_clk); 421 clk_disable(rtc_clk);
422} 422}
423 423
424static int __devexit s3c_rtc_remove(struct platform_device *dev) 424static int s3c_rtc_remove(struct platform_device *dev)
425{ 425{
426 struct rtc_device *rtc = platform_get_drvdata(dev); 426 struct rtc_device *rtc = platform_get_drvdata(dev);
427 427
@@ -451,7 +451,7 @@ static inline int s3c_rtc_get_driver_data(struct platform_device *pdev)
451 return platform_get_device_id(pdev)->driver_data; 451 return platform_get_device_id(pdev)->driver_data;
452} 452}
453 453
454static int __devinit s3c_rtc_probe(struct platform_device *pdev) 454static int s3c_rtc_probe(struct platform_device *pdev)
455{ 455{
456 struct rtc_device *rtc; 456 struct rtc_device *rtc;
457 struct rtc_time rtc_tm; 457 struct rtc_time rtc_tm;
@@ -686,7 +686,7 @@ MODULE_DEVICE_TABLE(platform, s3c_rtc_driver_ids);
686 686
687static struct platform_driver s3c_rtc_driver = { 687static struct platform_driver s3c_rtc_driver = {
688 .probe = s3c_rtc_probe, 688 .probe = s3c_rtc_probe,
689 .remove = __devexit_p(s3c_rtc_remove), 689 .remove = s3c_rtc_remove,
690 .suspend = s3c_rtc_suspend, 690 .suspend = s3c_rtc_suspend,
691 .resume = s3c_rtc_resume, 691 .resume = s3c_rtc_resume,
692 .id_table = s3c_rtc_driver_ids, 692 .id_table = s3c_rtc_driver_ids,
diff --git a/drivers/rtc/rtc-snvs.c b/drivers/rtc/rtc-snvs.c
index 3c0da333f465..d5ec7854a651 100644
--- a/drivers/rtc/rtc-snvs.c
+++ b/drivers/rtc/rtc-snvs.c
@@ -241,7 +241,7 @@ static irqreturn_t snvs_rtc_irq_handler(int irq, void *dev_id)
241 return events ? IRQ_HANDLED : IRQ_NONE; 241 return events ? IRQ_HANDLED : IRQ_NONE;
242} 242}
243 243
244static int __devinit snvs_rtc_probe(struct platform_device *pdev) 244static int snvs_rtc_probe(struct platform_device *pdev)
245{ 245{
246 struct snvs_rtc_data *data; 246 struct snvs_rtc_data *data;
247 struct resource *res; 247 struct resource *res;
@@ -294,7 +294,7 @@ static int __devinit snvs_rtc_probe(struct platform_device *pdev)
294 return 0; 294 return 0;
295} 295}
296 296
297static int __devexit snvs_rtc_remove(struct platform_device *pdev) 297static int snvs_rtc_remove(struct platform_device *pdev)
298{ 298{
299 struct snvs_rtc_data *data = platform_get_drvdata(pdev); 299 struct snvs_rtc_data *data = platform_get_drvdata(pdev);
300 300
@@ -327,7 +327,7 @@ static int snvs_rtc_resume(struct device *dev)
327 327
328static SIMPLE_DEV_PM_OPS(snvs_rtc_pm_ops, snvs_rtc_suspend, snvs_rtc_resume); 328static SIMPLE_DEV_PM_OPS(snvs_rtc_pm_ops, snvs_rtc_suspend, snvs_rtc_resume);
329 329
330static const struct of_device_id __devinitconst snvs_dt_ids[] = { 330static const struct of_device_id snvs_dt_ids[] = {
331 { .compatible = "fsl,sec-v4.0-mon-rtc-lp", }, 331 { .compatible = "fsl,sec-v4.0-mon-rtc-lp", },
332 { /* sentinel */ } 332 { /* sentinel */ }
333}; 333};
@@ -341,7 +341,7 @@ static struct platform_driver snvs_rtc_driver = {
341 .of_match_table = snvs_dt_ids, 341 .of_match_table = snvs_dt_ids,
342 }, 342 },
343 .probe = snvs_rtc_probe, 343 .probe = snvs_rtc_probe,
344 .remove = __devexit_p(snvs_rtc_remove), 344 .remove = snvs_rtc_remove,
345}; 345};
346module_platform_driver(snvs_rtc_driver); 346module_platform_driver(snvs_rtc_driver);
347 347
diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c
index 141fc945295f..c2121b5a01f2 100644
--- a/drivers/rtc/rtc-spear.c
+++ b/drivers/rtc/rtc-spear.c
@@ -351,7 +351,7 @@ static struct rtc_class_ops spear_rtc_ops = {
351 .alarm_irq_enable = spear_alarm_irq_enable, 351 .alarm_irq_enable = spear_alarm_irq_enable,
352}; 352};
353 353
354static int __devinit spear_rtc_probe(struct platform_device *pdev) 354static int spear_rtc_probe(struct platform_device *pdev)
355{ 355{
356 struct resource *res; 356 struct resource *res;
357 struct spear_rtc_config *config; 357 struct spear_rtc_config *config;
@@ -425,7 +425,7 @@ err_disable_clock:
425 return status; 425 return status;
426} 426}
427 427
428static int __devexit spear_rtc_remove(struct platform_device *pdev) 428static int spear_rtc_remove(struct platform_device *pdev)
429{ 429{
430 struct spear_rtc_config *config = platform_get_drvdata(pdev); 430 struct spear_rtc_config *config = platform_get_drvdata(pdev);
431 431
@@ -499,7 +499,7 @@ MODULE_DEVICE_TABLE(of, spear_rtc_id_table);
499 499
500static struct platform_driver spear_rtc_driver = { 500static struct platform_driver spear_rtc_driver = {
501 .probe = spear_rtc_probe, 501 .probe = spear_rtc_probe,
502 .remove = __devexit_p(spear_rtc_remove), 502 .remove = spear_rtc_remove,
503 .suspend = spear_rtc_suspend, 503 .suspend = spear_rtc_suspend,
504 .resume = spear_rtc_resume, 504 .resume = spear_rtc_resume,
505 .shutdown = spear_rtc_shutdown, 505 .shutdown = spear_rtc_shutdown,
diff --git a/drivers/rtc/rtc-stk17ta8.c b/drivers/rtc/rtc-stk17ta8.c
index 279f5cfa691a..7e4a6f65cb91 100644
--- a/drivers/rtc/rtc-stk17ta8.c
+++ b/drivers/rtc/rtc-stk17ta8.c
@@ -285,7 +285,7 @@ static struct bin_attribute stk17ta8_nvram_attr = {
285 .write = stk17ta8_nvram_write, 285 .write = stk17ta8_nvram_write,
286}; 286};
287 287
288static int __devinit stk17ta8_rtc_probe(struct platform_device *pdev) 288static int stk17ta8_rtc_probe(struct platform_device *pdev)
289{ 289{
290 struct resource *res; 290 struct resource *res;
291 unsigned int cal; 291 unsigned int cal;
@@ -347,7 +347,7 @@ static int __devinit stk17ta8_rtc_probe(struct platform_device *pdev)
347 return ret; 347 return ret;
348} 348}
349 349
350static int __devexit stk17ta8_rtc_remove(struct platform_device *pdev) 350static int stk17ta8_rtc_remove(struct platform_device *pdev)
351{ 351{
352 struct rtc_plat_data *pdata = platform_get_drvdata(pdev); 352 struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
353 353
@@ -363,7 +363,7 @@ MODULE_ALIAS("platform:stk17ta8");
363 363
364static struct platform_driver stk17ta8_rtc_driver = { 364static struct platform_driver stk17ta8_rtc_driver = {
365 .probe = stk17ta8_rtc_probe, 365 .probe = stk17ta8_rtc_probe,
366 .remove = __devexit_p(stk17ta8_rtc_remove), 366 .remove = stk17ta8_rtc_remove,
367 .driver = { 367 .driver = {
368 .name = "stk17ta8", 368 .name = "stk17ta8",
369 .owner = THIS_MODULE, 369 .owner = THIS_MODULE,
diff --git a/drivers/rtc/rtc-tegra.c b/drivers/rtc/rtc-tegra.c
index c006025cecc8..c84ea6659f49 100644
--- a/drivers/rtc/rtc-tegra.c
+++ b/drivers/rtc/rtc-tegra.c
@@ -303,7 +303,13 @@ static struct rtc_class_ops tegra_rtc_ops = {
303 .alarm_irq_enable = tegra_rtc_alarm_irq_enable, 303 .alarm_irq_enable = tegra_rtc_alarm_irq_enable,
304}; 304};
305 305
306static int __devinit tegra_rtc_probe(struct platform_device *pdev) 306static const struct of_device_id tegra_rtc_dt_match[] = {
307 { .compatible = "nvidia,tegra20-rtc", },
308 {}
309};
310MODULE_DEVICE_TABLE(of, tegra_rtc_dt_match);
311
312static int tegra_rtc_probe(struct platform_device *pdev)
307{ 313{
308 struct tegra_rtc_info *info; 314 struct tegra_rtc_info *info;
309 struct resource *res; 315 struct resource *res;
@@ -375,7 +381,7 @@ err_dev_unreg:
375 return ret; 381 return ret;
376} 382}
377 383
378static int __devexit tegra_rtc_remove(struct platform_device *pdev) 384static int tegra_rtc_remove(struct platform_device *pdev)
379{ 385{
380 struct tegra_rtc_info *info = platform_get_drvdata(pdev); 386 struct tegra_rtc_info *info = platform_get_drvdata(pdev);
381 387
@@ -435,11 +441,12 @@ static void tegra_rtc_shutdown(struct platform_device *pdev)
435 441
436MODULE_ALIAS("platform:tegra_rtc"); 442MODULE_ALIAS("platform:tegra_rtc");
437static struct platform_driver tegra_rtc_driver = { 443static struct platform_driver tegra_rtc_driver = {
438 .remove = __devexit_p(tegra_rtc_remove), 444 .remove = tegra_rtc_remove,
439 .shutdown = tegra_rtc_shutdown, 445 .shutdown = tegra_rtc_shutdown,
440 .driver = { 446 .driver = {
441 .name = "tegra_rtc", 447 .name = "tegra_rtc",
442 .owner = THIS_MODULE, 448 .owner = THIS_MODULE,
449 .of_match_table = tegra_rtc_dt_match,
443 }, 450 },
444#ifdef CONFIG_PM 451#ifdef CONFIG_PM
445 .suspend = tegra_rtc_suspend, 452 .suspend = tegra_rtc_suspend,
diff --git a/drivers/rtc/rtc-test.c b/drivers/rtc/rtc-test.c
index 974b9ae252ab..b92e0f6383e6 100644
--- a/drivers/rtc/rtc-test.c
+++ b/drivers/rtc/rtc-test.c
@@ -119,7 +119,7 @@ err:
119 return err; 119 return err;
120} 120}
121 121
122static int __devexit test_remove(struct platform_device *plat_dev) 122static int test_remove(struct platform_device *plat_dev)
123{ 123{
124 struct rtc_device *rtc = platform_get_drvdata(plat_dev); 124 struct rtc_device *rtc = platform_get_drvdata(plat_dev);
125 125
@@ -131,7 +131,7 @@ static int __devexit test_remove(struct platform_device *plat_dev)
131 131
132static struct platform_driver test_driver = { 132static struct platform_driver test_driver = {
133 .probe = test_probe, 133 .probe = test_probe,
134 .remove = __devexit_p(test_remove), 134 .remove = test_remove,
135 .driver = { 135 .driver = {
136 .name = "rtc-test", 136 .name = "rtc-test",
137 .owner = THIS_MODULE, 137 .owner = THIS_MODULE,
diff --git a/drivers/rtc/rtc-tile.c b/drivers/rtc/rtc-tile.c
index eb65dafee66e..62db4841078b 100644
--- a/drivers/rtc/rtc-tile.c
+++ b/drivers/rtc/rtc-tile.c
@@ -76,7 +76,7 @@ static const struct rtc_class_ops tile_rtc_ops = {
76/* 76/*
77 * Device probe routine. 77 * Device probe routine.
78 */ 78 */
79static int __devinit tile_rtc_probe(struct platform_device *dev) 79static int tile_rtc_probe(struct platform_device *dev)
80{ 80{
81 struct rtc_device *rtc; 81 struct rtc_device *rtc;
82 82
@@ -94,7 +94,7 @@ static int __devinit tile_rtc_probe(struct platform_device *dev)
94/* 94/*
95 * Device cleanup routine. 95 * Device cleanup routine.
96 */ 96 */
97static int __devexit tile_rtc_remove(struct platform_device *dev) 97static int tile_rtc_remove(struct platform_device *dev)
98{ 98{
99 struct rtc_device *rtc = platform_get_drvdata(dev); 99 struct rtc_device *rtc = platform_get_drvdata(dev);
100 100
@@ -112,7 +112,7 @@ static struct platform_driver tile_rtc_platform_driver = {
112 .owner = THIS_MODULE, 112 .owner = THIS_MODULE,
113 }, 113 },
114 .probe = tile_rtc_probe, 114 .probe = tile_rtc_probe,
115 .remove = __devexit_p(tile_rtc_remove), 115 .remove = tile_rtc_remove,
116}; 116};
117 117
118/* 118/*
diff --git a/drivers/rtc/rtc-tps6586x.c b/drivers/rtc/rtc-tps6586x.c
new file mode 100644
index 000000000000..70f61b8e9e6f
--- /dev/null
+++ b/drivers/rtc/rtc-tps6586x.c
@@ -0,0 +1,356 @@
1/*
2 * rtc-tps6586x.c: RTC driver for TI PMIC TPS6586X
3 *
4 * Copyright (c) 2012, NVIDIA Corporation.
5 *
6 * Author: Laxman Dewangan <ldewangan@nvidia.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation version 2.
11 *
12 * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
13 * whether express or implied; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 * 02111-1307, USA
21 */
22
23#include <linux/device.h>
24#include <linux/err.h>
25#include <linux/init.h>
26#include <linux/kernel.h>
27#include <linux/mfd/tps6586x.h>
28#include <linux/module.h>
29#include <linux/platform_device.h>
30#include <linux/pm_runtime.h>
31#include <linux/rtc.h>
32#include <linux/slab.h>
33
34#define RTC_CTRL 0xc0
35#define POR_RESET_N BIT(7)
36#define OSC_SRC_SEL BIT(6)
37#define RTC_ENABLE BIT(5) /* enables alarm */
38#define RTC_BUF_ENABLE BIT(4) /* 32 KHz buffer enable */
39#define PRE_BYPASS BIT(3) /* 0=1KHz or 1=32KHz updates */
40#define CL_SEL_MASK (BIT(2)|BIT(1))
41#define CL_SEL_POS 1
42#define RTC_ALARM1_HI 0xc1
43#define RTC_COUNT4 0xc6
44
45/* start a PMU RTC access by reading the register prior to the RTC_COUNT4 */
46#define RTC_COUNT4_DUMMYREAD 0xc5
47
48/*only 14-bits width in second*/
49#define ALM1_VALID_RANGE_IN_SEC 0x3FFF
50
51#define TPS6586X_RTC_CL_SEL_1_5PF 0x0
52#define TPS6586X_RTC_CL_SEL_6_5PF 0x1
53#define TPS6586X_RTC_CL_SEL_7_5PF 0x2
54#define TPS6586X_RTC_CL_SEL_12_5PF 0x3
55
56struct tps6586x_rtc {
57 struct device *dev;
58 struct rtc_device *rtc;
59 int irq;
60 bool irq_en;
61 unsigned long long epoch_start;
62};
63
64static inline struct device *to_tps6586x_dev(struct device *dev)
65{
66 return dev->parent;
67}
68
69static int tps6586x_rtc_read_time(struct device *dev, struct rtc_time *tm)
70{
71 struct tps6586x_rtc *rtc = dev_get_drvdata(dev);
72 struct device *tps_dev = to_tps6586x_dev(dev);
73 unsigned long long ticks = 0;
74 unsigned long seconds;
75 u8 buff[6];
76 int ret;
77 int i;
78
79 ret = tps6586x_reads(tps_dev, RTC_COUNT4_DUMMYREAD, sizeof(buff), buff);
80 if (ret < 0) {
81 dev_err(dev, "read counter failed with err %d\n", ret);
82 return ret;
83 }
84
85 for (i = 1; i < sizeof(buff); i++) {
86 ticks <<= 8;
87 ticks |= buff[i];
88 }
89
90 seconds = ticks >> 10;
91 seconds += rtc->epoch_start;
92 rtc_time_to_tm(seconds, tm);
93 return rtc_valid_tm(tm);
94}
95
96static int tps6586x_rtc_set_time(struct device *dev, struct rtc_time *tm)
97{
98 struct tps6586x_rtc *rtc = dev_get_drvdata(dev);
99 struct device *tps_dev = to_tps6586x_dev(dev);
100 unsigned long long ticks;
101 unsigned long seconds;
102 u8 buff[5];
103 int ret;
104
105 rtc_tm_to_time(tm, &seconds);
106 if (seconds < rtc->epoch_start) {
107 dev_err(dev, "requested time unsupported\n");
108 return -EINVAL;
109 }
110 seconds -= rtc->epoch_start;
111
112 ticks = (unsigned long long)seconds << 10;
113 buff[0] = (ticks >> 32) & 0xff;
114 buff[1] = (ticks >> 24) & 0xff;
115 buff[2] = (ticks >> 16) & 0xff;
116 buff[3] = (ticks >> 8) & 0xff;
117 buff[4] = ticks & 0xff;
118
119 /* Disable RTC before changing time */
120 ret = tps6586x_clr_bits(tps_dev, RTC_CTRL, RTC_ENABLE);
121 if (ret < 0) {
122 dev_err(dev, "failed to clear RTC_ENABLE\n");
123 return ret;
124 }
125
126 ret = tps6586x_writes(tps_dev, RTC_COUNT4, sizeof(buff), buff);
127 if (ret < 0) {
128 dev_err(dev, "failed to program new time\n");
129 return ret;
130 }
131
132 /* Enable RTC */
133 ret = tps6586x_set_bits(tps_dev, RTC_CTRL, RTC_ENABLE);
134 if (ret < 0) {
135 dev_err(dev, "failed to set RTC_ENABLE\n");
136 return ret;
137 }
138 return 0;
139}
140
141static int tps6586x_rtc_alarm_irq_enable(struct device *dev,
142 unsigned int enabled)
143{
144 struct tps6586x_rtc *rtc = dev_get_drvdata(dev);
145
146 if (enabled && !rtc->irq_en) {
147 enable_irq(rtc->irq);
148 rtc->irq_en = true;
149 } else if (!enabled && rtc->irq_en) {
150 disable_irq(rtc->irq);
151 rtc->irq_en = false;
152 }
153 return 0;
154}
155
156static int tps6586x_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
157{
158 struct tps6586x_rtc *rtc = dev_get_drvdata(dev);
159 struct device *tps_dev = to_tps6586x_dev(dev);
160 unsigned long seconds;
161 unsigned long ticks;
162 unsigned long rtc_current_time;
163 unsigned long long rticks = 0;
164 u8 buff[3];
165 u8 rbuff[6];
166 int ret;
167 int i;
168
169 rtc_tm_to_time(&alrm->time, &seconds);
170
171 if (alrm->enabled && (seconds < rtc->epoch_start)) {
172 dev_err(dev, "can't set alarm to requested time\n");
173 return -EINVAL;
174 }
175
176 ret = tps6586x_rtc_alarm_irq_enable(dev, alrm->enabled);
177 if (ret < 0) {
178 dev_err(dev, "can't set alarm irq, err %d\n", ret);
179 return ret;
180 }
181
182 seconds -= rtc->epoch_start;
183 ret = tps6586x_reads(tps_dev, RTC_COUNT4_DUMMYREAD,
184 sizeof(rbuff), rbuff);
185 if (ret < 0) {
186 dev_err(dev, "read counter failed with err %d\n", ret);
187 return ret;
188 }
189
190 for (i = 1; i < sizeof(rbuff); i++) {
191 rticks <<= 8;
192 rticks |= rbuff[i];
193 }
194
195 rtc_current_time = rticks >> 10;
196 if ((seconds - rtc_current_time) > ALM1_VALID_RANGE_IN_SEC)
197 seconds = rtc_current_time - 1;
198
199 ticks = (unsigned long long)seconds << 10;
200 buff[0] = (ticks >> 16) & 0xff;
201 buff[1] = (ticks >> 8) & 0xff;
202 buff[2] = ticks & 0xff;
203
204 ret = tps6586x_writes(tps_dev, RTC_ALARM1_HI, sizeof(buff), buff);
205 if (ret)
206 dev_err(dev, "programming alarm failed with err %d\n", ret);
207
208 return ret;
209}
210
211static int tps6586x_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
212{
213 struct tps6586x_rtc *rtc = dev_get_drvdata(dev);
214 struct device *tps_dev = to_tps6586x_dev(dev);
215 unsigned long ticks;
216 unsigned long seconds;
217 u8 buff[3];
218 int ret;
219
220 ret = tps6586x_reads(tps_dev, RTC_ALARM1_HI, sizeof(buff), buff);
221 if (ret) {
222 dev_err(dev, "read RTC_ALARM1_HI failed with err %d\n", ret);
223 return ret;
224 }
225
226 ticks = (buff[0] << 16) | (buff[1] << 8) | buff[2];
227 seconds = ticks >> 10;
228 seconds += rtc->epoch_start;
229
230 rtc_time_to_tm(seconds, &alrm->time);
231 return 0;
232}
233
234static const struct rtc_class_ops tps6586x_rtc_ops = {
235 .read_time = tps6586x_rtc_read_time,
236 .set_time = tps6586x_rtc_set_time,
237 .set_alarm = tps6586x_rtc_set_alarm,
238 .read_alarm = tps6586x_rtc_read_alarm,
239 .alarm_irq_enable = tps6586x_rtc_alarm_irq_enable,
240};
241
242static irqreturn_t tps6586x_rtc_irq(int irq, void *data)
243{
244 struct tps6586x_rtc *rtc = data;
245
246 rtc_update_irq(rtc->rtc, 1, RTC_IRQF | RTC_AF);
247 return IRQ_HANDLED;
248}
249
250static int tps6586x_rtc_probe(struct platform_device *pdev)
251{
252 struct device *tps_dev = to_tps6586x_dev(&pdev->dev);
253 struct tps6586x_rtc *rtc;
254 int ret;
255
256 rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
257 if (!rtc)
258 return -ENOMEM;
259
260 rtc->dev = &pdev->dev;
261 rtc->irq = platform_get_irq(pdev, 0);
262
263 /* Set epoch start as 00:00:00:01:01:2009 */
264 rtc->epoch_start = mktime(2009, 1, 1, 0, 0, 0);
265
266 /* 1 kHz tick mode, enable tick counting */
267 ret = tps6586x_update(tps_dev, RTC_CTRL,
268 RTC_ENABLE | OSC_SRC_SEL |
269 ((TPS6586X_RTC_CL_SEL_1_5PF << CL_SEL_POS) & CL_SEL_MASK),
270 RTC_ENABLE | OSC_SRC_SEL | PRE_BYPASS | CL_SEL_MASK);
271 if (ret < 0) {
272 dev_err(&pdev->dev, "unable to start counter\n");
273 return ret;
274 }
275
276 platform_set_drvdata(pdev, rtc);
277 rtc->rtc = rtc_device_register(dev_name(&pdev->dev), &pdev->dev,
278 &tps6586x_rtc_ops, THIS_MODULE);
279 if (IS_ERR(rtc->rtc)) {
280 ret = PTR_ERR(rtc->rtc);
281 dev_err(&pdev->dev, "RTC device register: ret %d\n", ret);
282 goto fail_rtc_register;
283 }
284
285 ret = request_threaded_irq(rtc->irq, NULL, tps6586x_rtc_irq,
286 IRQF_ONESHOT | IRQF_EARLY_RESUME,
287 dev_name(&pdev->dev), rtc);
288 if (ret < 0) {
289 dev_err(&pdev->dev, "request IRQ(%d) failed with ret %d\n",
290 rtc->irq, ret);
291 goto fail_req_irq;
292 }
293 disable_irq(rtc->irq);
294 device_set_wakeup_capable(&pdev->dev, 1);
295 return 0;
296
297fail_req_irq:
298 rtc_device_unregister(rtc->rtc);
299
300fail_rtc_register:
301 tps6586x_update(tps_dev, RTC_CTRL, 0,
302 RTC_ENABLE | OSC_SRC_SEL | PRE_BYPASS | CL_SEL_MASK);
303 return ret;
304};
305
306static int tps6586x_rtc_remove(struct platform_device *pdev)
307{
308 struct tps6586x_rtc *rtc = platform_get_drvdata(pdev);
309 struct device *tps_dev = to_tps6586x_dev(&pdev->dev);
310
311 tps6586x_update(tps_dev, RTC_CTRL, 0,
312 RTC_ENABLE | OSC_SRC_SEL | PRE_BYPASS | CL_SEL_MASK);
313 rtc_device_unregister(rtc->rtc);
314 free_irq(rtc->irq, rtc);
315 return 0;
316}
317
318#ifdef CONFIG_PM_SLEEP
319static int tps6586x_rtc_suspend(struct device *dev)
320{
321 struct tps6586x_rtc *rtc = dev_get_drvdata(dev);
322
323 if (device_may_wakeup(dev))
324 enable_irq_wake(rtc->irq);
325 return 0;
326}
327
328static int tps6586x_rtc_resume(struct device *dev)
329{
330 struct tps6586x_rtc *rtc = dev_get_drvdata(dev);
331
332 if (device_may_wakeup(dev))
333 disable_irq_wake(rtc->irq);
334 return 0;
335}
336#endif
337
338static const struct dev_pm_ops tps6586x_pm_ops = {
339 SET_SYSTEM_SLEEP_PM_OPS(tps6586x_rtc_suspend, tps6586x_rtc_resume)
340};
341
342static struct platform_driver tps6586x_rtc_driver = {
343 .driver = {
344 .name = "tps6586x-rtc",
345 .owner = THIS_MODULE,
346 .pm = &tps6586x_pm_ops,
347 },
348 .probe = tps6586x_rtc_probe,
349 .remove = tps6586x_rtc_remove,
350};
351module_platform_driver(tps6586x_rtc_driver);
352
353MODULE_ALIAS("platform:rtc-tps6586x");
354MODULE_DESCRIPTION("TI TPS6586x RTC driver");
355MODULE_AUTHOR("Laxman dewangan <ldewangan@nvidia.com>");
356MODULE_LICENSE("GPL v2");
diff --git a/drivers/rtc/rtc-tps65910.c b/drivers/rtc/rtc-tps65910.c
index 22eb4ebfa1a6..e5fef141a0e2 100644
--- a/drivers/rtc/rtc-tps65910.c
+++ b/drivers/rtc/rtc-tps65910.c
@@ -222,7 +222,7 @@ static const struct rtc_class_ops tps65910_rtc_ops = {
222 .alarm_irq_enable = tps65910_rtc_alarm_irq_enable, 222 .alarm_irq_enable = tps65910_rtc_alarm_irq_enable,
223}; 223};
224 224
225static int __devinit tps65910_rtc_probe(struct platform_device *pdev) 225static int tps65910_rtc_probe(struct platform_device *pdev)
226{ 226{
227 struct tps65910 *tps65910 = NULL; 227 struct tps65910 *tps65910 = NULL;
228 struct tps65910_rtc *tps_rtc = NULL; 228 struct tps65910_rtc *tps_rtc = NULL;
@@ -292,7 +292,7 @@ static int __devinit tps65910_rtc_probe(struct platform_device *pdev)
292 * Disable tps65910 RTC interrupts. 292 * Disable tps65910 RTC interrupts.
293 * Sets status flag to free. 293 * Sets status flag to free.
294 */ 294 */
295static int __devexit tps65910_rtc_remove(struct platform_device *pdev) 295static int tps65910_rtc_remove(struct platform_device *pdev)
296{ 296{
297 /* leave rtc running, but disable irqs */ 297 /* leave rtc running, but disable irqs */
298 struct tps65910_rtc *tps_rtc = platform_get_drvdata(pdev); 298 struct tps65910_rtc *tps_rtc = platform_get_drvdata(pdev);
@@ -342,7 +342,7 @@ static const struct dev_pm_ops tps65910_rtc_pm_ops = {
342 342
343static struct platform_driver tps65910_rtc_driver = { 343static struct platform_driver tps65910_rtc_driver = {
344 .probe = tps65910_rtc_probe, 344 .probe = tps65910_rtc_probe,
345 .remove = __devexit_p(tps65910_rtc_remove), 345 .remove = tps65910_rtc_remove,
346 .driver = { 346 .driver = {
347 .owner = THIS_MODULE, 347 .owner = THIS_MODULE,
348 .name = "tps65910-rtc", 348 .name = "tps65910-rtc",
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
index 8b7464c8b5cf..ccd4ad370b32 100644
--- a/drivers/rtc/rtc-twl.c
+++ b/drivers/rtc/rtc-twl.c
@@ -458,7 +458,7 @@ static struct rtc_class_ops twl_rtc_ops = {
458 458
459/*----------------------------------------------------------------------*/ 459/*----------------------------------------------------------------------*/
460 460
461static int __devinit twl_rtc_probe(struct platform_device *pdev) 461static int twl_rtc_probe(struct platform_device *pdev)
462{ 462{
463 struct rtc_device *rtc; 463 struct rtc_device *rtc;
464 int ret = -EINVAL; 464 int ret = -EINVAL;
@@ -535,7 +535,7 @@ out1:
535 * Disable all TWL RTC module interrupts. 535 * Disable all TWL RTC module interrupts.
536 * Sets status flag to free. 536 * Sets status flag to free.
537 */ 537 */
538static int __devexit twl_rtc_remove(struct platform_device *pdev) 538static int twl_rtc_remove(struct platform_device *pdev)
539{ 539{
540 /* leave rtc running, but disable irqs */ 540 /* leave rtc running, but disable irqs */
541 struct rtc_device *rtc = platform_get_drvdata(pdev); 541 struct rtc_device *rtc = platform_get_drvdata(pdev);
@@ -597,7 +597,7 @@ MODULE_ALIAS("platform:twl_rtc");
597 597
598static struct platform_driver twl4030rtc_driver = { 598static struct platform_driver twl4030rtc_driver = {
599 .probe = twl_rtc_probe, 599 .probe = twl_rtc_probe,
600 .remove = __devexit_p(twl_rtc_remove), 600 .remove = twl_rtc_remove,
601 .shutdown = twl_rtc_shutdown, 601 .shutdown = twl_rtc_shutdown,
602 .suspend = twl_rtc_suspend, 602 .suspend = twl_rtc_suspend,
603 .resume = twl_rtc_resume, 603 .resume = twl_rtc_resume,
diff --git a/drivers/rtc/rtc-vr41xx.c b/drivers/rtc/rtc-vr41xx.c
index 5f60a7c6a155..6c3774cf5a24 100644
--- a/drivers/rtc/rtc-vr41xx.c
+++ b/drivers/rtc/rtc-vr41xx.c
@@ -280,7 +280,7 @@ static const struct rtc_class_ops vr41xx_rtc_ops = {
280 .set_alarm = vr41xx_rtc_set_alarm, 280 .set_alarm = vr41xx_rtc_set_alarm,
281}; 281};
282 282
283static int __devinit rtc_probe(struct platform_device *pdev) 283static int rtc_probe(struct platform_device *pdev)
284{ 284{
285 struct resource *res; 285 struct resource *res;
286 struct rtc_device *rtc; 286 struct rtc_device *rtc;
@@ -373,7 +373,7 @@ err_rtc1_iounmap:
373 return retval; 373 return retval;
374} 374}
375 375
376static int __devexit rtc_remove(struct platform_device *pdev) 376static int rtc_remove(struct platform_device *pdev)
377{ 377{
378 struct rtc_device *rtc; 378 struct rtc_device *rtc;
379 379
@@ -398,7 +398,7 @@ MODULE_ALIAS("platform:RTC");
398 398
399static struct platform_driver rtc_platform_driver = { 399static struct platform_driver rtc_platform_driver = {
400 .probe = rtc_probe, 400 .probe = rtc_probe,
401 .remove = __devexit_p(rtc_remove), 401 .remove = rtc_remove,
402 .driver = { 402 .driver = {
403 .name = rtc_name, 403 .name = rtc_name,
404 .owner = THIS_MODULE, 404 .owner = THIS_MODULE,
diff --git a/drivers/rtc/rtc-vt8500.c b/drivers/rtc/rtc-vt8500.c
index 14e2d8cfcc83..00c930f4b6f3 100644
--- a/drivers/rtc/rtc-vt8500.c
+++ b/drivers/rtc/rtc-vt8500.c
@@ -70,7 +70,7 @@
70 | ALARM_SEC_BIT) 70 | ALARM_SEC_BIT)
71 71
72#define VT8500_RTC_CR_ENABLE (1 << 0) /* Enable RTC */ 72#define VT8500_RTC_CR_ENABLE (1 << 0) /* Enable RTC */
73#define VT8500_RTC_CR_24H (1 << 1) /* 24h time format */ 73#define VT8500_RTC_CR_12H (1 << 1) /* 12h time format */
74#define VT8500_RTC_CR_SM_ENABLE (1 << 2) /* Enable periodic irqs */ 74#define VT8500_RTC_CR_SM_ENABLE (1 << 2) /* Enable periodic irqs */
75#define VT8500_RTC_CR_SM_SEC (1 << 3) /* 0: 1Hz/60, 1: 1Hz */ 75#define VT8500_RTC_CR_SM_SEC (1 << 3) /* 0: 1Hz/60, 1: 1Hz */
76#define VT8500_RTC_CR_CALIB (1 << 4) /* Enable calibration */ 76#define VT8500_RTC_CR_CALIB (1 << 4) /* Enable calibration */
@@ -119,7 +119,7 @@ static int vt8500_rtc_read_time(struct device *dev, struct rtc_time *tm)
119 tm->tm_min = bcd2bin((time & TIME_MIN_MASK) >> TIME_MIN_S); 119 tm->tm_min = bcd2bin((time & TIME_MIN_MASK) >> TIME_MIN_S);
120 tm->tm_hour = bcd2bin((time & TIME_HOUR_MASK) >> TIME_HOUR_S); 120 tm->tm_hour = bcd2bin((time & TIME_HOUR_MASK) >> TIME_HOUR_S);
121 tm->tm_mday = bcd2bin(date & DATE_DAY_MASK); 121 tm->tm_mday = bcd2bin(date & DATE_DAY_MASK);
122 tm->tm_mon = bcd2bin((date & DATE_MONTH_MASK) >> DATE_MONTH_S); 122 tm->tm_mon = bcd2bin((date & DATE_MONTH_MASK) >> DATE_MONTH_S) - 1;
123 tm->tm_year = bcd2bin((date & DATE_YEAR_MASK) >> DATE_YEAR_S) 123 tm->tm_year = bcd2bin((date & DATE_YEAR_MASK) >> DATE_YEAR_S)
124 + ((date >> DATE_CENTURY_S) & 1 ? 200 : 100); 124 + ((date >> DATE_CENTURY_S) & 1 ? 200 : 100);
125 tm->tm_wday = (time & TIME_DOW_MASK) >> TIME_DOW_S; 125 tm->tm_wday = (time & TIME_DOW_MASK) >> TIME_DOW_S;
@@ -138,8 +138,9 @@ static int vt8500_rtc_set_time(struct device *dev, struct rtc_time *tm)
138 } 138 }
139 139
140 writel((bin2bcd(tm->tm_year - 100) << DATE_YEAR_S) 140 writel((bin2bcd(tm->tm_year - 100) << DATE_YEAR_S)
141 | (bin2bcd(tm->tm_mon) << DATE_MONTH_S) 141 | (bin2bcd(tm->tm_mon + 1) << DATE_MONTH_S)
142 | (bin2bcd(tm->tm_mday)), 142 | (bin2bcd(tm->tm_mday))
143 | ((tm->tm_year >= 200) << DATE_CENTURY_S),
143 vt8500_rtc->regbase + VT8500_RTC_DS); 144 vt8500_rtc->regbase + VT8500_RTC_DS);
144 writel((bin2bcd(tm->tm_wday) << TIME_DOW_S) 145 writel((bin2bcd(tm->tm_wday) << TIME_DOW_S)
145 | (bin2bcd(tm->tm_hour) << TIME_HOUR_S) 146 | (bin2bcd(tm->tm_hour) << TIME_HOUR_S)
@@ -205,7 +206,7 @@ static const struct rtc_class_ops vt8500_rtc_ops = {
205 .alarm_irq_enable = vt8500_alarm_irq_enable, 206 .alarm_irq_enable = vt8500_alarm_irq_enable,
206}; 207};
207 208
208static int __devinit vt8500_rtc_probe(struct platform_device *pdev) 209static int vt8500_rtc_probe(struct platform_device *pdev)
209{ 210{
210 struct vt8500_rtc *vt8500_rtc; 211 struct vt8500_rtc *vt8500_rtc;
211 int ret; 212 int ret;
@@ -247,7 +248,7 @@ static int __devinit vt8500_rtc_probe(struct platform_device *pdev)
247 } 248 }
248 249
249 /* Enable RTC and set it to 24-hour mode */ 250 /* Enable RTC and set it to 24-hour mode */
250 writel(VT8500_RTC_CR_ENABLE | VT8500_RTC_CR_24H, 251 writel(VT8500_RTC_CR_ENABLE,
251 vt8500_rtc->regbase + VT8500_RTC_CR); 252 vt8500_rtc->regbase + VT8500_RTC_CR);
252 253
253 vt8500_rtc->rtc = rtc_device_register("vt8500-rtc", &pdev->dev, 254 vt8500_rtc->rtc = rtc_device_register("vt8500-rtc", &pdev->dev,
@@ -279,7 +280,7 @@ err_release:
279 return ret; 280 return ret;
280} 281}
281 282
282static int __devexit vt8500_rtc_remove(struct platform_device *pdev) 283static int vt8500_rtc_remove(struct platform_device *pdev)
283{ 284{
284 struct vt8500_rtc *vt8500_rtc = platform_get_drvdata(pdev); 285 struct vt8500_rtc *vt8500_rtc = platform_get_drvdata(pdev);
285 286
@@ -305,7 +306,7 @@ static const struct of_device_id wmt_dt_ids[] = {
305 306
306static struct platform_driver vt8500_rtc_driver = { 307static struct platform_driver vt8500_rtc_driver = {
307 .probe = vt8500_rtc_probe, 308 .probe = vt8500_rtc_probe,
308 .remove = __devexit_p(vt8500_rtc_remove), 309 .remove = vt8500_rtc_remove,
309 .driver = { 310 .driver = {
310 .name = "vt8500-rtc", 311 .name = "vt8500-rtc",
311 .owner = THIS_MODULE, 312 .owner = THIS_MODULE,
diff --git a/drivers/rtc/rtc-wm831x.c b/drivers/rtc/rtc-wm831x.c
index ea5c6f857ca5..1b0affbe2659 100644
--- a/drivers/rtc/rtc-wm831x.c
+++ b/drivers/rtc/rtc-wm831x.c
@@ -459,7 +459,7 @@ err:
459 return ret; 459 return ret;
460} 460}
461 461
462static int __devexit wm831x_rtc_remove(struct platform_device *pdev) 462static int wm831x_rtc_remove(struct platform_device *pdev)
463{ 463{
464 struct wm831x_rtc *wm831x_rtc = platform_get_drvdata(pdev); 464 struct wm831x_rtc *wm831x_rtc = platform_get_drvdata(pdev);
465 int alm_irq = platform_get_irq_byname(pdev, "ALM"); 465 int alm_irq = platform_get_irq_byname(pdev, "ALM");
@@ -483,7 +483,7 @@ static const struct dev_pm_ops wm831x_rtc_pm_ops = {
483 483
484static struct platform_driver wm831x_rtc_driver = { 484static struct platform_driver wm831x_rtc_driver = {
485 .probe = wm831x_rtc_probe, 485 .probe = wm831x_rtc_probe,
486 .remove = __devexit_p(wm831x_rtc_remove), 486 .remove = wm831x_rtc_remove,
487 .driver = { 487 .driver = {
488 .name = "wm831x-rtc", 488 .name = "wm831x-rtc",
489 .pm = &wm831x_rtc_pm_ops, 489 .pm = &wm831x_rtc_pm_ops,
diff --git a/drivers/rtc/rtc-wm8350.c b/drivers/rtc/rtc-wm8350.c
index c2e52d15abb2..8ad86ae0d30f 100644
--- a/drivers/rtc/rtc-wm8350.c
+++ b/drivers/rtc/rtc-wm8350.c
@@ -459,7 +459,7 @@ static int wm8350_rtc_probe(struct platform_device *pdev)
459 return 0; 459 return 0;
460} 460}
461 461
462static int __devexit wm8350_rtc_remove(struct platform_device *pdev) 462static int wm8350_rtc_remove(struct platform_device *pdev)
463{ 463{
464 struct wm8350 *wm8350 = platform_get_drvdata(pdev); 464 struct wm8350 *wm8350 = platform_get_drvdata(pdev);
465 struct wm8350_rtc *wm_rtc = &wm8350->rtc; 465 struct wm8350_rtc *wm_rtc = &wm8350->rtc;
@@ -479,7 +479,7 @@ static struct dev_pm_ops wm8350_rtc_pm_ops = {
479 479
480static struct platform_driver wm8350_rtc_driver = { 480static struct platform_driver wm8350_rtc_driver = {
481 .probe = wm8350_rtc_probe, 481 .probe = wm8350_rtc_probe,
482 .remove = __devexit_p(wm8350_rtc_remove), 482 .remove = wm8350_rtc_remove,
483 .driver = { 483 .driver = {
484 .name = "wm8350-rtc", 484 .name = "wm8350-rtc",
485 .pm = &wm8350_rtc_pm_ops, 485 .pm = &wm8350_rtc_pm_ops,
diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c
index 9bd5da36f99e..704488d0f819 100644
--- a/drivers/s390/block/dasd_diag.c
+++ b/drivers/s390/block/dasd_diag.c
@@ -248,7 +248,7 @@ static void dasd_ext_handler(struct ext_code ext_code,
248 default: 248 default:
249 return; 249 return;
250 } 250 }
251 kstat_cpu(smp_processor_id()).irqs[EXTINT_DSD]++; 251 inc_irq_stat(IRQEXT_DSD);
252 if (!ip) { /* no intparm: unsolicited interrupt */ 252 if (!ip) { /* no intparm: unsolicited interrupt */
253 DBF_EVENT(DBF_NOTICE, "%s", "caught unsolicited " 253 DBF_EVENT(DBF_NOTICE, "%s", "caught unsolicited "
254 "interrupt"); 254 "interrupt");
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index 806fe912d6e7..e37bc1620d14 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -4274,7 +4274,7 @@ static struct ccw_driver dasd_eckd_driver = {
4274 .thaw = dasd_generic_restore_device, 4274 .thaw = dasd_generic_restore_device,
4275 .restore = dasd_generic_restore_device, 4275 .restore = dasd_generic_restore_device,
4276 .uc_handler = dasd_generic_uc_handler, 4276 .uc_handler = dasd_generic_uc_handler,
4277 .int_class = IOINT_DAS, 4277 .int_class = IRQIO_DAS,
4278}; 4278};
4279 4279
4280/* 4280/*
diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c
index eb748507c7fa..414698584344 100644
--- a/drivers/s390/block/dasd_fba.c
+++ b/drivers/s390/block/dasd_fba.c
@@ -78,7 +78,7 @@ static struct ccw_driver dasd_fba_driver = {
78 .freeze = dasd_generic_pm_freeze, 78 .freeze = dasd_generic_pm_freeze,
79 .thaw = dasd_generic_restore_device, 79 .thaw = dasd_generic_restore_device,
80 .restore = dasd_generic_restore_device, 80 .restore = dasd_generic_restore_device,
81 .int_class = IOINT_DAS, 81 .int_class = IRQIO_DAS,
82}; 82};
83 83
84static void 84static void
diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c
index 40084501c31b..33b7141a182f 100644
--- a/drivers/s390/char/con3215.c
+++ b/drivers/s390/char/con3215.c
@@ -44,6 +44,7 @@
44#define RAW3215_NR_CCWS 3 44#define RAW3215_NR_CCWS 3
45#define RAW3215_TIMEOUT HZ/10 /* time for delayed output */ 45#define RAW3215_TIMEOUT HZ/10 /* time for delayed output */
46 46
47#define RAW3215_FIXED 1 /* 3215 console device is not be freed */
47#define RAW3215_WORKING 4 /* set if a request is being worked on */ 48#define RAW3215_WORKING 4 /* set if a request is being worked on */
48#define RAW3215_THROTTLED 8 /* set if reading is disabled */ 49#define RAW3215_THROTTLED 8 /* set if reading is disabled */
49#define RAW3215_STOPPED 16 /* set if writing is disabled */ 50#define RAW3215_STOPPED 16 /* set if writing is disabled */
@@ -630,7 +631,8 @@ static void raw3215_shutdown(struct raw3215_info *raw)
630 DECLARE_WAITQUEUE(wait, current); 631 DECLARE_WAITQUEUE(wait, current);
631 unsigned long flags; 632 unsigned long flags;
632 633
633 if (!(raw->port.flags & ASYNC_INITIALIZED)) 634 if (!(raw->port.flags & ASYNC_INITIALIZED) ||
635 (raw->flags & RAW3215_FIXED))
634 return; 636 return;
635 /* Wait for outstanding requests, then free irq */ 637 /* Wait for outstanding requests, then free irq */
636 spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); 638 spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
@@ -805,7 +807,7 @@ static struct ccw_driver raw3215_ccw_driver = {
805 .freeze = &raw3215_pm_stop, 807 .freeze = &raw3215_pm_stop,
806 .thaw = &raw3215_pm_start, 808 .thaw = &raw3215_pm_start,
807 .restore = &raw3215_pm_start, 809 .restore = &raw3215_pm_start,
808 .int_class = IOINT_C15, 810 .int_class = IRQIO_C15,
809}; 811};
810 812
811#ifdef CONFIG_TN3215_CONSOLE 813#ifdef CONFIG_TN3215_CONSOLE
@@ -927,6 +929,8 @@ static int __init con3215_init(void)
927 dev_set_drvdata(&cdev->dev, raw); 929 dev_set_drvdata(&cdev->dev, raw);
928 cdev->handler = raw3215_irq; 930 cdev->handler = raw3215_irq;
929 931
932 raw->flags |= RAW3215_FIXED;
933
930 /* Request the console irq */ 934 /* Request the console irq */
931 if (raw3215_startup(raw) != 0) { 935 if (raw3215_startup(raw) != 0) {
932 raw3215_free_info(raw); 936 raw3215_free_info(raw);
diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c
index f3b8bb84faf2..9a6c140c5f07 100644
--- a/drivers/s390/char/raw3270.c
+++ b/drivers/s390/char/raw3270.c
@@ -1396,7 +1396,7 @@ static struct ccw_driver raw3270_ccw_driver = {
1396 .freeze = &raw3270_pm_stop, 1396 .freeze = &raw3270_pm_stop,
1397 .thaw = &raw3270_pm_start, 1397 .thaw = &raw3270_pm_start,
1398 .restore = &raw3270_pm_start, 1398 .restore = &raw3270_pm_start,
1399 .int_class = IOINT_C70, 1399 .int_class = IRQIO_C70,
1400}; 1400};
1401 1401
1402static int 1402static int
diff --git a/drivers/s390/char/sclp.c b/drivers/s390/char/sclp.c
index 4fa21f7e2308..12c16a65dd25 100644
--- a/drivers/s390/char/sclp.c
+++ b/drivers/s390/char/sclp.c
@@ -400,7 +400,7 @@ static void sclp_interrupt_handler(struct ext_code ext_code,
400 u32 finished_sccb; 400 u32 finished_sccb;
401 u32 evbuf_pending; 401 u32 evbuf_pending;
402 402
403 kstat_cpu(smp_processor_id()).irqs[EXTINT_SCP]++; 403 inc_irq_stat(IRQEXT_SCP);
404 spin_lock(&sclp_lock); 404 spin_lock(&sclp_lock);
405 finished_sccb = param32 & 0xfffffff8; 405 finished_sccb = param32 & 0xfffffff8;
406 evbuf_pending = param32 & 0x3; 406 evbuf_pending = param32 & 0x3;
@@ -813,7 +813,7 @@ static void sclp_check_handler(struct ext_code ext_code,
813{ 813{
814 u32 finished_sccb; 814 u32 finished_sccb;
815 815
816 kstat_cpu(smp_processor_id()).irqs[EXTINT_SCP]++; 816 inc_irq_stat(IRQEXT_SCP);
817 finished_sccb = param32 & 0xfffffff8; 817 finished_sccb = param32 & 0xfffffff8;
818 /* Is this the interrupt we are waiting for? */ 818 /* Is this the interrupt we are waiting for? */
819 if (finished_sccb == 0) 819 if (finished_sccb == 0)
diff --git a/drivers/s390/char/tape_34xx.c b/drivers/s390/char/tape_34xx.c
index 6ae929c024ae..9aa79702b370 100644
--- a/drivers/s390/char/tape_34xx.c
+++ b/drivers/s390/char/tape_34xx.c
@@ -1193,7 +1193,7 @@ static struct ccw_driver tape_34xx_driver = {
1193 .set_online = tape_34xx_online, 1193 .set_online = tape_34xx_online,
1194 .set_offline = tape_generic_offline, 1194 .set_offline = tape_generic_offline,
1195 .freeze = tape_generic_pm_suspend, 1195 .freeze = tape_generic_pm_suspend,
1196 .int_class = IOINT_TAP, 1196 .int_class = IRQIO_TAP,
1197}; 1197};
1198 1198
1199static int 1199static int
diff --git a/drivers/s390/char/tape_3590.c b/drivers/s390/char/tape_3590.c
index 1b0eb49f739c..327cb19ad0b0 100644
--- a/drivers/s390/char/tape_3590.c
+++ b/drivers/s390/char/tape_3590.c
@@ -1656,7 +1656,7 @@ static struct ccw_driver tape_3590_driver = {
1656 .set_offline = tape_generic_offline, 1656 .set_offline = tape_generic_offline,
1657 .set_online = tape_3590_online, 1657 .set_online = tape_3590_online,
1658 .freeze = tape_generic_pm_suspend, 1658 .freeze = tape_generic_pm_suspend,
1659 .int_class = IOINT_TAP, 1659 .int_class = IRQIO_TAP,
1660}; 1660};
1661 1661
1662/* 1662/*
diff --git a/drivers/s390/char/vmur.c b/drivers/s390/char/vmur.c
index 73bef0bd394c..483f72ba030d 100644
--- a/drivers/s390/char/vmur.c
+++ b/drivers/s390/char/vmur.c
@@ -74,7 +74,7 @@ static struct ccw_driver ur_driver = {
74 .set_online = ur_set_online, 74 .set_online = ur_set_online,
75 .set_offline = ur_set_offline, 75 .set_offline = ur_set_offline,
76 .freeze = ur_pm_suspend, 76 .freeze = ur_pm_suspend,
77 .int_class = IOINT_VMR, 77 .int_class = IRQIO_VMR,
78}; 78};
79 79
80static DEFINE_MUTEX(vmur_mutex); 80static DEFINE_MUTEX(vmur_mutex);
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c
index 68e80e2734a4..10729bbceced 100644
--- a/drivers/s390/cio/chsc.c
+++ b/drivers/s390/cio/chsc.c
@@ -283,7 +283,7 @@ struct chsc_sei_nt2_area {
283 u8 ccdf[PAGE_SIZE - 24 - 56]; /* content-code dependent field */ 283 u8 ccdf[PAGE_SIZE - 24 - 56]; /* content-code dependent field */
284} __packed; 284} __packed;
285 285
286#define CHSC_SEI_NT0 0ULL 286#define CHSC_SEI_NT0 (1ULL << 63)
287#define CHSC_SEI_NT2 (1ULL << 61) 287#define CHSC_SEI_NT2 (1ULL << 61)
288 288
289struct chsc_sei { 289struct chsc_sei {
@@ -291,7 +291,8 @@ struct chsc_sei {
291 u32 reserved1; 291 u32 reserved1;
292 u64 ntsm; /* notification type mask */ 292 u64 ntsm; /* notification type mask */
293 struct chsc_header response; 293 struct chsc_header response;
294 u32 reserved2; 294 u32 :24;
295 u8 nt;
295 union { 296 union {
296 struct chsc_sei_nt0_area nt0_area; 297 struct chsc_sei_nt0_area nt0_area;
297 struct chsc_sei_nt2_area nt2_area; 298 struct chsc_sei_nt2_area nt2_area;
@@ -496,17 +497,17 @@ static int __chsc_process_crw(struct chsc_sei *sei, u64 ntsm)
496 css_schedule_eval_all(); 497 css_schedule_eval_all();
497 } 498 }
498 499
499 switch (sei->ntsm) { 500 switch (sei->nt) {
500 case CHSC_SEI_NT0: 501 case 0:
501 chsc_process_sei_nt0(&sei->u.nt0_area); 502 chsc_process_sei_nt0(&sei->u.nt0_area);
502 return 1; 503 break;
503 case CHSC_SEI_NT2: 504 case 2:
504 chsc_process_sei_nt2(&sei->u.nt2_area); 505 chsc_process_sei_nt2(&sei->u.nt2_area);
505 return 1; 506 break;
506 default: 507 default:
507 CIO_CRW_EVENT(2, "chsc: unhandled nt (nt=%08Lx)\n", 508 CIO_CRW_EVENT(2, "chsc: unhandled nt=%d\n",
508 sei->ntsm); 509 sei->nt);
509 return 0; 510 break;
510 } 511 }
511 } else { 512 } else {
512 CIO_CRW_EVENT(2, "chsc: sei failed (rc=%04x)\n", 513 CIO_CRW_EVENT(2, "chsc: sei failed (rc=%04x)\n",
@@ -537,15 +538,7 @@ static void chsc_process_crw(struct crw *crw0, struct crw *crw1, int overflow)
537 sei = sei_page; 538 sei = sei_page;
538 539
539 CIO_TRACE_EVENT(2, "prcss"); 540 CIO_TRACE_EVENT(2, "prcss");
540 541 __chsc_process_crw(sei, CHSC_SEI_NT0 | CHSC_SEI_NT2);
541 /*
542 * The ntsm does not allow to select NT0 and NT2 together. We need to
543 * first check for NT2, than additionally for NT0...
544 */
545#ifdef CONFIG_PCI
546 if (!__chsc_process_crw(sei, CHSC_SEI_NT2))
547#endif
548 __chsc_process_crw(sei, CHSC_SEI_NT0);
549} 542}
550 543
551void chsc_chp_online(struct chp_id chpid) 544void chsc_chp_online(struct chp_id chpid)
diff --git a/drivers/s390/cio/chsc_sch.c b/drivers/s390/cio/chsc_sch.c
index 8f9a1a384496..facdf809113f 100644
--- a/drivers/s390/cio/chsc_sch.c
+++ b/drivers/s390/cio/chsc_sch.c
@@ -58,7 +58,7 @@ static void chsc_subchannel_irq(struct subchannel *sch)
58 58
59 CHSC_LOG(4, "irb"); 59 CHSC_LOG(4, "irb");
60 CHSC_LOG_HEX(4, irb, sizeof(*irb)); 60 CHSC_LOG_HEX(4, irb, sizeof(*irb));
61 kstat_cpu(smp_processor_id()).irqs[IOINT_CSC]++; 61 inc_irq_stat(IRQIO_CSC);
62 62
63 /* Copy irb to provided request and set done. */ 63 /* Copy irb to provided request and set done. */
64 if (!request) { 64 if (!request) {
diff --git a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c
index 8e927b9f285f..c8faf6230b0f 100644
--- a/drivers/s390/cio/cio.c
+++ b/drivers/s390/cio/cio.c
@@ -611,7 +611,7 @@ void __irq_entry do_IRQ(struct pt_regs *regs)
611 tpi_info = (struct tpi_info *)&S390_lowcore.subchannel_id; 611 tpi_info = (struct tpi_info *)&S390_lowcore.subchannel_id;
612 irb = (struct irb *)&S390_lowcore.irb; 612 irb = (struct irb *)&S390_lowcore.irb;
613 do { 613 do {
614 kstat_cpu(smp_processor_id()).irqs[IO_INTERRUPT]++; 614 kstat_incr_irqs_this_cpu(IO_INTERRUPT, NULL);
615 if (tpi_info->adapter_IO) { 615 if (tpi_info->adapter_IO) {
616 do_adapter_IO(tpi_info->isc); 616 do_adapter_IO(tpi_info->isc);
617 continue; 617 continue;
@@ -619,7 +619,7 @@ void __irq_entry do_IRQ(struct pt_regs *regs)
619 sch = (struct subchannel *)(unsigned long)tpi_info->intparm; 619 sch = (struct subchannel *)(unsigned long)tpi_info->intparm;
620 if (!sch) { 620 if (!sch) {
621 /* Clear pending interrupt condition. */ 621 /* Clear pending interrupt condition. */
622 kstat_cpu(smp_processor_id()).irqs[IOINT_CIO]++; 622 inc_irq_stat(IRQIO_CIO);
623 tsch(tpi_info->schid, irb); 623 tsch(tpi_info->schid, irb);
624 continue; 624 continue;
625 } 625 }
@@ -633,9 +633,9 @@ void __irq_entry do_IRQ(struct pt_regs *regs)
633 if (sch->driver && sch->driver->irq) 633 if (sch->driver && sch->driver->irq)
634 sch->driver->irq(sch); 634 sch->driver->irq(sch);
635 else 635 else
636 kstat_cpu(smp_processor_id()).irqs[IOINT_CIO]++; 636 inc_irq_stat(IRQIO_CIO);
637 } else 637 } else
638 kstat_cpu(smp_processor_id()).irqs[IOINT_CIO]++; 638 inc_irq_stat(IRQIO_CIO);
639 spin_unlock(sch->lock); 639 spin_unlock(sch->lock);
640 /* 640 /*
641 * Are more interrupts pending? 641 * Are more interrupts pending?
@@ -678,7 +678,7 @@ static void cio_tsch(struct subchannel *sch)
678 if (sch->driver && sch->driver->irq) 678 if (sch->driver && sch->driver->irq)
679 sch->driver->irq(sch); 679 sch->driver->irq(sch);
680 else 680 else
681 kstat_cpu(smp_processor_id()).irqs[IOINT_CIO]++; 681 inc_irq_stat(IRQIO_CIO);
682 if (!irq_context) { 682 if (!irq_context) {
683 irq_exit(); 683 irq_exit();
684 _local_bh_enable(); 684 _local_bh_enable();
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 6995cff44636..7cd5c6812ac7 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -758,7 +758,7 @@ static int io_subchannel_initialize_dev(struct subchannel *sch,
758 struct ccw_device *cdev) 758 struct ccw_device *cdev)
759{ 759{
760 cdev->private->cdev = cdev; 760 cdev->private->cdev = cdev;
761 cdev->private->int_class = IOINT_CIO; 761 cdev->private->int_class = IRQIO_CIO;
762 atomic_set(&cdev->private->onoff, 0); 762 atomic_set(&cdev->private->onoff, 0);
763 cdev->dev.parent = &sch->dev; 763 cdev->dev.parent = &sch->dev;
764 cdev->dev.release = ccw_device_release; 764 cdev->dev.release = ccw_device_release;
@@ -1023,7 +1023,7 @@ static void io_subchannel_irq(struct subchannel *sch)
1023 if (cdev) 1023 if (cdev)
1024 dev_fsm_event(cdev, DEV_EVENT_INTERRUPT); 1024 dev_fsm_event(cdev, DEV_EVENT_INTERRUPT);
1025 else 1025 else
1026 kstat_cpu(smp_processor_id()).irqs[IOINT_CIO]++; 1026 inc_irq_stat(IRQIO_CIO);
1027} 1027}
1028 1028
1029void io_subchannel_init_config(struct subchannel *sch) 1029void io_subchannel_init_config(struct subchannel *sch)
@@ -1634,7 +1634,7 @@ ccw_device_probe_console(void)
1634 memset(&console_private, 0, sizeof(struct ccw_device_private)); 1634 memset(&console_private, 0, sizeof(struct ccw_device_private));
1635 console_cdev.private = &console_private; 1635 console_cdev.private = &console_private;
1636 console_private.cdev = &console_cdev; 1636 console_private.cdev = &console_cdev;
1637 console_private.int_class = IOINT_CIO; 1637 console_private.int_class = IRQIO_CIO;
1638 ret = ccw_device_console_enable(&console_cdev, sch); 1638 ret = ccw_device_console_enable(&console_cdev, sch);
1639 if (ret) { 1639 if (ret) {
1640 cio_release_console(); 1640 cio_release_console();
@@ -1715,13 +1715,13 @@ ccw_device_probe (struct device *dev)
1715 if (cdrv->int_class != 0) 1715 if (cdrv->int_class != 0)
1716 cdev->private->int_class = cdrv->int_class; 1716 cdev->private->int_class = cdrv->int_class;
1717 else 1717 else
1718 cdev->private->int_class = IOINT_CIO; 1718 cdev->private->int_class = IRQIO_CIO;
1719 1719
1720 ret = cdrv->probe ? cdrv->probe(cdev) : -ENODEV; 1720 ret = cdrv->probe ? cdrv->probe(cdev) : -ENODEV;
1721 1721
1722 if (ret) { 1722 if (ret) {
1723 cdev->drv = NULL; 1723 cdev->drv = NULL;
1724 cdev->private->int_class = IOINT_CIO; 1724 cdev->private->int_class = IRQIO_CIO;
1725 return ret; 1725 return ret;
1726 } 1726 }
1727 1727
@@ -1755,7 +1755,7 @@ ccw_device_remove (struct device *dev)
1755 } 1755 }
1756 ccw_device_set_timeout(cdev, 0); 1756 ccw_device_set_timeout(cdev, 0);
1757 cdev->drv = NULL; 1757 cdev->drv = NULL;
1758 cdev->private->int_class = IOINT_CIO; 1758 cdev->private->int_class = IRQIO_CIO;
1759 return 0; 1759 return 0;
1760} 1760}
1761 1761
diff --git a/drivers/s390/cio/device.h b/drivers/s390/cio/device.h
index 2e575cff9845..7d4ecb65db00 100644
--- a/drivers/s390/cio/device.h
+++ b/drivers/s390/cio/device.h
@@ -61,11 +61,10 @@ dev_fsm_event(struct ccw_device *cdev, enum dev_event dev_event)
61 61
62 if (dev_event == DEV_EVENT_INTERRUPT) { 62 if (dev_event == DEV_EVENT_INTERRUPT) {
63 if (state == DEV_STATE_ONLINE) 63 if (state == DEV_STATE_ONLINE)
64 kstat_cpu(smp_processor_id()). 64 inc_irq_stat(cdev->private->int_class);
65 irqs[cdev->private->int_class]++;
66 else if (state != DEV_STATE_CMFCHANGE && 65 else if (state != DEV_STATE_CMFCHANGE &&
67 state != DEV_STATE_CMFUPDATE) 66 state != DEV_STATE_CMFUPDATE)
68 kstat_cpu(smp_processor_id()).irqs[IOINT_CIO]++; 67 inc_irq_stat(IRQIO_CIO);
69 } 68 }
70 dev_jumptable[state][dev_event](cdev, dev_event); 69 dev_jumptable[state][dev_event](cdev, dev_event);
71} 70}
diff --git a/drivers/s390/cio/eadm_sch.c b/drivers/s390/cio/eadm_sch.c
index 6c9673400464..d9eddcba7e88 100644
--- a/drivers/s390/cio/eadm_sch.c
+++ b/drivers/s390/cio/eadm_sch.c
@@ -139,7 +139,7 @@ static void eadm_subchannel_irq(struct subchannel *sch)
139 EADM_LOG(6, "irq"); 139 EADM_LOG(6, "irq");
140 EADM_LOG_HEX(6, irb, sizeof(*irb)); 140 EADM_LOG_HEX(6, irb, sizeof(*irb));
141 141
142 kstat_cpu(smp_processor_id()).irqs[IOINT_ADM]++; 142 inc_irq_stat(IRQIO_ADM);
143 143
144 if ((scsw->stctl & (SCSW_STCTL_ALERT_STATUS | SCSW_STCTL_STATUS_PEND)) 144 if ((scsw->stctl & (SCSW_STCTL_ALERT_STATUS | SCSW_STCTL_STATUS_PEND))
145 && scsw->eswf == 1 && irb->esw.eadm.erw.r) 145 && scsw->eswf == 1 && irb->esw.eadm.erw.r)
diff --git a/drivers/s390/cio/qdio_thinint.c b/drivers/s390/cio/qdio_thinint.c
index bdb394b066fc..bde5255200dc 100644
--- a/drivers/s390/cio/qdio_thinint.c
+++ b/drivers/s390/cio/qdio_thinint.c
@@ -182,7 +182,7 @@ static void tiqdio_thinint_handler(void *alsi, void *data)
182 struct qdio_q *q; 182 struct qdio_q *q;
183 183
184 last_ai_time = S390_lowcore.int_clock; 184 last_ai_time = S390_lowcore.int_clock;
185 kstat_cpu(smp_processor_id()).irqs[IOINT_QAI]++; 185 inc_irq_stat(IRQIO_QAI);
186 186
187 /* protect tiq_list entries, only changed in activate or shutdown */ 187 /* protect tiq_list entries, only changed in activate or shutdown */
188 rcu_read_lock(); 188 rcu_read_lock();
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
index 7b865a7300e6..b8b340ac5332 100644
--- a/drivers/s390/crypto/ap_bus.c
+++ b/drivers/s390/crypto/ap_bus.c
@@ -1272,7 +1272,7 @@ out:
1272 1272
1273static void ap_interrupt_handler(void *unused1, void *unused2) 1273static void ap_interrupt_handler(void *unused1, void *unused2)
1274{ 1274{
1275 kstat_cpu(smp_processor_id()).irqs[IOINT_APB]++; 1275 inc_irq_stat(IRQIO_APB);
1276 tasklet_schedule(&ap_tasklet); 1276 tasklet_schedule(&ap_tasklet);
1277} 1277}
1278 1278
diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c
index 7dabef624da3..8491111aec12 100644
--- a/drivers/s390/kvm/kvm_virtio.c
+++ b/drivers/s390/kvm/kvm_virtio.c
@@ -392,7 +392,7 @@ static void kvm_extint_handler(struct ext_code ext_code,
392 392
393 if ((ext_code.subcode & 0xff00) != VIRTIO_SUBCODE_64) 393 if ((ext_code.subcode & 0xff00) != VIRTIO_SUBCODE_64)
394 return; 394 return;
395 kstat_cpu(smp_processor_id()).irqs[EXTINT_VRT]++; 395 inc_irq_stat(IRQEXT_VRT);
396 396
397 /* The LSB might be overloaded, we have to mask it */ 397 /* The LSB might be overloaded, we have to mask it */
398 vq = (struct virtqueue *)(param64 & ~1UL); 398 vq = (struct virtqueue *)(param64 & ~1UL);
diff --git a/drivers/s390/net/claw.c b/drivers/s390/net/claw.c
index 5c70a6599578..83bc9c5fa0c1 100644
--- a/drivers/s390/net/claw.c
+++ b/drivers/s390/net/claw.c
@@ -282,7 +282,7 @@ static struct ccw_driver claw_ccw_driver = {
282 .ids = claw_ids, 282 .ids = claw_ids,
283 .probe = ccwgroup_probe_ccwdev, 283 .probe = ccwgroup_probe_ccwdev,
284 .remove = ccwgroup_remove_ccwdev, 284 .remove = ccwgroup_remove_ccwdev,
285 .int_class = IOINT_CLW, 285 .int_class = IRQIO_CLW,
286}; 286};
287 287
288static ssize_t claw_driver_group_store(struct device_driver *ddrv, 288static ssize_t claw_driver_group_store(struct device_driver *ddrv,
diff --git a/drivers/s390/net/ctcm_main.c b/drivers/s390/net/ctcm_main.c
index 817b68925ddd..676f12049a36 100644
--- a/drivers/s390/net/ctcm_main.c
+++ b/drivers/s390/net/ctcm_main.c
@@ -1755,7 +1755,7 @@ static struct ccw_driver ctcm_ccw_driver = {
1755 .ids = ctcm_ids, 1755 .ids = ctcm_ids,
1756 .probe = ccwgroup_probe_ccwdev, 1756 .probe = ccwgroup_probe_ccwdev,
1757 .remove = ccwgroup_remove_ccwdev, 1757 .remove = ccwgroup_remove_ccwdev,
1758 .int_class = IOINT_CTC, 1758 .int_class = IRQIO_CTC,
1759}; 1759};
1760 1760
1761static struct ccwgroup_driver ctcm_group_driver = { 1761static struct ccwgroup_driver ctcm_group_driver = {
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c
index 2ca0f1dd7a00..c645dc9e98af 100644
--- a/drivers/s390/net/lcs.c
+++ b/drivers/s390/net/lcs.c
@@ -2384,7 +2384,7 @@ static struct ccw_driver lcs_ccw_driver = {
2384 .ids = lcs_ids, 2384 .ids = lcs_ids,
2385 .probe = ccwgroup_probe_ccwdev, 2385 .probe = ccwgroup_probe_ccwdev,
2386 .remove = ccwgroup_remove_ccwdev, 2386 .remove = ccwgroup_remove_ccwdev,
2387 .int_class = IOINT_LCS, 2387 .int_class = IRQIO_LCS,
2388}; 2388};
2389 2389
2390/** 2390/**
diff --git a/drivers/sbus/char/bbc_i2c.c b/drivers/sbus/char/bbc_i2c.c
index 542668292900..1a9d1e3ce64c 100644
--- a/drivers/sbus/char/bbc_i2c.c
+++ b/drivers/sbus/char/bbc_i2c.c
@@ -355,7 +355,7 @@ fail:
355extern int bbc_envctrl_init(struct bbc_i2c_bus *bp); 355extern int bbc_envctrl_init(struct bbc_i2c_bus *bp);
356extern void bbc_envctrl_cleanup(struct bbc_i2c_bus *bp); 356extern void bbc_envctrl_cleanup(struct bbc_i2c_bus *bp);
357 357
358static int __devinit bbc_i2c_probe(struct platform_device *op) 358static int bbc_i2c_probe(struct platform_device *op)
359{ 359{
360 struct bbc_i2c_bus *bp; 360 struct bbc_i2c_bus *bp;
361 int err, index = 0; 361 int err, index = 0;
@@ -379,7 +379,7 @@ static int __devinit bbc_i2c_probe(struct platform_device *op)
379 return err; 379 return err;
380} 380}
381 381
382static int __devexit bbc_i2c_remove(struct platform_device *op) 382static int bbc_i2c_remove(struct platform_device *op)
383{ 383{
384 struct bbc_i2c_bus *bp = dev_get_drvdata(&op->dev); 384 struct bbc_i2c_bus *bp = dev_get_drvdata(&op->dev);
385 385
@@ -413,7 +413,7 @@ static struct platform_driver bbc_i2c_driver = {
413 .of_match_table = bbc_i2c_match, 413 .of_match_table = bbc_i2c_match,
414 }, 414 },
415 .probe = bbc_i2c_probe, 415 .probe = bbc_i2c_probe,
416 .remove = __devexit_p(bbc_i2c_remove), 416 .remove = bbc_i2c_remove,
417}; 417};
418 418
419module_platform_driver(bbc_i2c_driver); 419module_platform_driver(bbc_i2c_driver);
diff --git a/drivers/sbus/char/display7seg.c b/drivers/sbus/char/display7seg.c
index b160073e54b6..e85c803b30cd 100644
--- a/drivers/sbus/char/display7seg.c
+++ b/drivers/sbus/char/display7seg.c
@@ -171,7 +171,7 @@ static struct miscdevice d7s_miscdev = {
171 .fops = &d7s_fops 171 .fops = &d7s_fops
172}; 172};
173 173
174static int __devinit d7s_probe(struct platform_device *op) 174static int d7s_probe(struct platform_device *op)
175{ 175{
176 struct device_node *opts; 176 struct device_node *opts;
177 int err = -EINVAL; 177 int err = -EINVAL;
@@ -236,7 +236,7 @@ out_free:
236 goto out; 236 goto out;
237} 237}
238 238
239static int __devexit d7s_remove(struct platform_device *op) 239static int d7s_remove(struct platform_device *op)
240{ 240{
241 struct d7s *p = dev_get_drvdata(&op->dev); 241 struct d7s *p = dev_get_drvdata(&op->dev);
242 u8 regs = readb(p->regs); 242 u8 regs = readb(p->regs);
@@ -272,7 +272,7 @@ static struct platform_driver d7s_driver = {
272 .of_match_table = d7s_match, 272 .of_match_table = d7s_match,
273 }, 273 },
274 .probe = d7s_probe, 274 .probe = d7s_probe,
275 .remove = __devexit_p(d7s_remove), 275 .remove = d7s_remove,
276}; 276};
277 277
278module_platform_driver(d7s_driver); 278module_platform_driver(d7s_driver);
diff --git a/drivers/sbus/char/envctrl.c b/drivers/sbus/char/envctrl.c
index 0bc18569f9c0..ddbe5a9e713d 100644
--- a/drivers/sbus/char/envctrl.c
+++ b/drivers/sbus/char/envctrl.c
@@ -1028,7 +1028,7 @@ static int kenvctrld(void *__unused)
1028 return 0; 1028 return 0;
1029} 1029}
1030 1030
1031static int __devinit envctrl_probe(struct platform_device *op) 1031static int envctrl_probe(struct platform_device *op)
1032{ 1032{
1033 struct device_node *dp; 1033 struct device_node *dp;
1034 int index, err; 1034 int index, err;
@@ -1104,7 +1104,7 @@ out_iounmap:
1104 return err; 1104 return err;
1105} 1105}
1106 1106
1107static int __devexit envctrl_remove(struct platform_device *op) 1107static int envctrl_remove(struct platform_device *op)
1108{ 1108{
1109 int index; 1109 int index;
1110 1110
@@ -1135,7 +1135,7 @@ static struct platform_driver envctrl_driver = {
1135 .of_match_table = envctrl_match, 1135 .of_match_table = envctrl_match,
1136 }, 1136 },
1137 .probe = envctrl_probe, 1137 .probe = envctrl_probe,
1138 .remove = __devexit_p(envctrl_remove), 1138 .remove = envctrl_remove,
1139}; 1139};
1140 1140
1141module_platform_driver(envctrl_driver); 1141module_platform_driver(envctrl_driver);
diff --git a/drivers/sbus/char/flash.c b/drivers/sbus/char/flash.c
index 327657e2e264..d9f268f23774 100644
--- a/drivers/sbus/char/flash.c
+++ b/drivers/sbus/char/flash.c
@@ -159,7 +159,7 @@ static const struct file_operations flash_fops = {
159 159
160static struct miscdevice flash_dev = { FLASH_MINOR, "flash", &flash_fops }; 160static struct miscdevice flash_dev = { FLASH_MINOR, "flash", &flash_fops };
161 161
162static int __devinit flash_probe(struct platform_device *op) 162static int flash_probe(struct platform_device *op)
163{ 163{
164 struct device_node *dp = op->dev.of_node; 164 struct device_node *dp = op->dev.of_node;
165 struct device_node *parent; 165 struct device_node *parent;
@@ -190,7 +190,7 @@ static int __devinit flash_probe(struct platform_device *op)
190 return misc_register(&flash_dev); 190 return misc_register(&flash_dev);
191} 191}
192 192
193static int __devexit flash_remove(struct platform_device *op) 193static int flash_remove(struct platform_device *op)
194{ 194{
195 misc_deregister(&flash_dev); 195 misc_deregister(&flash_dev);
196 196
@@ -212,7 +212,7 @@ static struct platform_driver flash_driver = {
212 .of_match_table = flash_match, 212 .of_match_table = flash_match,
213 }, 213 },
214 .probe = flash_probe, 214 .probe = flash_probe,
215 .remove = __devexit_p(flash_remove), 215 .remove = flash_remove,
216}; 216};
217 217
218module_platform_driver(flash_driver); 218module_platform_driver(flash_driver);
diff --git a/drivers/sbus/char/uctrl.c b/drivers/sbus/char/uctrl.c
index a9e468cc1cac..b0aae0536d58 100644
--- a/drivers/sbus/char/uctrl.c
+++ b/drivers/sbus/char/uctrl.c
@@ -347,7 +347,7 @@ static void uctrl_get_external_status(struct uctrl_driver *driver)
347 347
348} 348}
349 349
350static int __devinit uctrl_probe(struct platform_device *op) 350static int uctrl_probe(struct platform_device *op)
351{ 351{
352 struct uctrl_driver *p; 352 struct uctrl_driver *p;
353 int err = -ENOMEM; 353 int err = -ENOMEM;
@@ -402,7 +402,7 @@ out_free:
402 goto out; 402 goto out;
403} 403}
404 404
405static int __devexit uctrl_remove(struct platform_device *op) 405static int uctrl_remove(struct platform_device *op)
406{ 406{
407 struct uctrl_driver *p = dev_get_drvdata(&op->dev); 407 struct uctrl_driver *p = dev_get_drvdata(&op->dev);
408 408
@@ -430,7 +430,7 @@ static struct platform_driver uctrl_driver = {
430 .of_match_table = uctrl_match, 430 .of_match_table = uctrl_match,
431 }, 431 },
432 .probe = uctrl_probe, 432 .probe = uctrl_probe,
433 .remove = __devexit_p(uctrl_remove), 433 .remove = uctrl_remove,
434}; 434};
435 435
436 436
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index 3868ab2397c6..d1f0120cdb98 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -2029,7 +2029,7 @@ static struct scsi_host_template driver_template = {
2029}; 2029};
2030 2030
2031/* This function will probe and initialize a card */ 2031/* This function will probe and initialize a card */
2032static int __devinit twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id) 2032static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
2033{ 2033{
2034 struct Scsi_Host *host = NULL; 2034 struct Scsi_Host *host = NULL;
2035 TW_Device_Extension *tw_dev; 2035 TW_Device_Extension *tw_dev;
@@ -2305,7 +2305,7 @@ out_disable_device:
2305#endif 2305#endif
2306 2306
2307/* PCI Devices supported by this driver */ 2307/* PCI Devices supported by this driver */
2308static struct pci_device_id twa_pci_tbl[] __devinitdata = { 2308static struct pci_device_id twa_pci_tbl[] = {
2309 { PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_9000, 2309 { PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_9000,
2310 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 2310 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
2311 { PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_9550SX, 2311 { PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_9550SX,
diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c
index 13e39e1fdfe2..52a2f0580d97 100644
--- a/drivers/scsi/3w-sas.c
+++ b/drivers/scsi/3w-sas.c
@@ -1604,7 +1604,7 @@ static struct scsi_host_template driver_template = {
1604}; 1604};
1605 1605
1606/* This function will probe and initialize a card */ 1606/* This function will probe and initialize a card */
1607static int __devinit twl_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id) 1607static int twl_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
1608{ 1608{
1609 struct Scsi_Host *host = NULL; 1609 struct Scsi_Host *host = NULL;
1610 TW_Device_Extension *tw_dev; 1610 TW_Device_Extension *tw_dev;
@@ -1893,7 +1893,7 @@ out_disable_device:
1893#endif 1893#endif
1894 1894
1895/* PCI Devices supported by this driver */ 1895/* PCI Devices supported by this driver */
1896static struct pci_device_id twl_pci_tbl[] __devinitdata = { 1896static struct pci_device_id twl_pci_tbl[] = {
1897 { PCI_VDEVICE(3WARE, PCI_DEVICE_ID_3WARE_9750) }, 1897 { PCI_VDEVICE(3WARE, PCI_DEVICE_ID_3WARE_9750) },
1898 { } 1898 { }
1899}; 1899};
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
index 7fe96ff60c58..62071d2fc1ce 100644
--- a/drivers/scsi/3w-xxxx.c
+++ b/drivers/scsi/3w-xxxx.c
@@ -2281,7 +2281,7 @@ static struct scsi_host_template driver_template = {
2281}; 2281};
2282 2282
2283/* This function will probe and initialize a card */ 2283/* This function will probe and initialize a card */
2284static int __devinit tw_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id) 2284static int tw_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
2285{ 2285{
2286 struct Scsi_Host *host = NULL; 2286 struct Scsi_Host *host = NULL;
2287 TW_Device_Extension *tw_dev; 2287 TW_Device_Extension *tw_dev;
@@ -2422,7 +2422,7 @@ static void tw_remove(struct pci_dev *pdev)
2422} /* End tw_remove() */ 2422} /* End tw_remove() */
2423 2423
2424/* PCI Devices supported by this driver */ 2424/* PCI Devices supported by this driver */
2425static struct pci_device_id tw_pci_tbl[] __devinitdata = { 2425static struct pci_device_id tw_pci_tbl[] = {
2426 { PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_1000, 2426 { PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_1000,
2427 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 2427 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
2428 { PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_7000, 2428 { PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_7000,
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
index d4da3708763b..d7ca247efa35 100644
--- a/drivers/scsi/BusLogic.c
+++ b/drivers/scsi/BusLogic.c
@@ -3615,7 +3615,7 @@ static void __exit BusLogic_exit(void)
3615__setup("BusLogic=", BusLogic_Setup); 3615__setup("BusLogic=", BusLogic_Setup);
3616 3616
3617#ifdef MODULE 3617#ifdef MODULE
3618static struct pci_device_id BusLogic_pci_tbl[] __devinitdata = { 3618static struct pci_device_id BusLogic_pci_tbl[] = {
3619 { PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER, 3619 { PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER,
3620 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 3620 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
3621 { PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC, 3621 { PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC,
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index 165e4dd865d9..450353e04dde 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -814,7 +814,7 @@ static char *lprint_opcode(int opcode, char *pos, char *buffer, int length)
814 * Locks: interrupts must be enabled when we are called 814 * Locks: interrupts must be enabled when we are called
815 */ 815 */
816 816
817static int __devinit NCR5380_init(struct Scsi_Host *instance, int flags) 817static int NCR5380_init(struct Scsi_Host *instance, int flags)
818{ 818{
819 NCR5380_local_declare(); 819 NCR5380_local_declare();
820 int i, pass; 820 int i, pass;
diff --git a/drivers/scsi/NCR_D700.c b/drivers/scsi/NCR_D700.c
index 8647256ad66d..b39a2409a507 100644
--- a/drivers/scsi/NCR_D700.c
+++ b/drivers/scsi/NCR_D700.c
@@ -114,7 +114,7 @@ MODULE_DESCRIPTION("NCR Dual700 SCSI Driver");
114MODULE_LICENSE("GPL"); 114MODULE_LICENSE("GPL");
115module_param(NCR_D700, charp, 0); 115module_param(NCR_D700, charp, 0);
116 116
117static __u8 __devinitdata id_array[2*(MCA_MAX_SLOT_NR + 1)] = 117static __u8 id_array[2*(MCA_MAX_SLOT_NR + 1)] =
118 { [0 ... 2*(MCA_MAX_SLOT_NR + 1)-1] = 7 }; 118 { [0 ... 2*(MCA_MAX_SLOT_NR + 1)-1] = 7 };
119 119
120#ifdef MODULE 120#ifdef MODULE
@@ -173,7 +173,7 @@ struct NCR_D700_private {
173 char pad; 173 char pad;
174}; 174};
175 175
176static int __devinit 176static int
177NCR_D700_probe_one(struct NCR_D700_private *p, int siop, int irq, 177NCR_D700_probe_one(struct NCR_D700_private *p, int siop, int irq,
178 int slot, u32 region, int differential) 178 int slot, u32 region, int differential)
179{ 179{
@@ -243,7 +243,7 @@ NCR_D700_intr(int irq, void *data)
243 * essentially connectecd to the MCA bus independently, it is easier 243 * essentially connectecd to the MCA bus independently, it is easier
244 * to set them up as two separate host adapters, rather than one 244 * to set them up as two separate host adapters, rather than one
245 * adapter with two channels */ 245 * adapter with two channels */
246static int __devinit 246static int
247NCR_D700_probe(struct device *dev) 247NCR_D700_probe(struct device *dev)
248{ 248{
249 struct NCR_D700_private *p; 249 struct NCR_D700_private *p;
@@ -349,7 +349,7 @@ NCR_D700_probe(struct device *dev)
349 return 0; 349 return 0;
350} 350}
351 351
352static void __devexit 352static void
353NCR_D700_remove_one(struct Scsi_Host *host) 353NCR_D700_remove_one(struct Scsi_Host *host)
354{ 354{
355 scsi_remove_host(host); 355 scsi_remove_host(host);
@@ -359,7 +359,7 @@ NCR_D700_remove_one(struct Scsi_Host *host)
359 release_region(host->base, 64); 359 release_region(host->base, 64);
360} 360}
361 361
362static int __devexit 362static int
363NCR_D700_remove(struct device *dev) 363NCR_D700_remove(struct device *dev)
364{ 364{
365 struct NCR_D700_private *p = dev_get_drvdata(dev); 365 struct NCR_D700_private *p = dev_get_drvdata(dev);
@@ -380,7 +380,7 @@ static struct mca_driver NCR_D700_driver = {
380 .name = "NCR_D700", 380 .name = "NCR_D700",
381 .bus = &mca_bus_type, 381 .bus = &mca_bus_type,
382 .probe = NCR_D700_probe, 382 .probe = NCR_D700_probe,
383 .remove = __devexit_p(NCR_D700_remove), 383 .remove = NCR_D700_remove,
384 }, 384 },
385}; 385};
386 386
diff --git a/drivers/scsi/NCR_Q720.c b/drivers/scsi/NCR_Q720.c
index afdbb9addf18..05835bf1bf9c 100644
--- a/drivers/scsi/NCR_Q720.c
+++ b/drivers/scsi/NCR_Q720.c
@@ -351,7 +351,7 @@ static struct mca_driver NCR_Q720_driver = {
351 .name = "NCR_Q720", 351 .name = "NCR_Q720",
352 .bus = &mca_bus_type, 352 .bus = &mca_bus_type,
353 .probe = NCR_Q720_probe, 353 .probe = NCR_Q720_probe,
354 .remove = __devexit_p(NCR_Q720_remove), 354 .remove = NCR_Q720_remove,
355 }, 355 },
356}; 356};
357 357
diff --git a/drivers/scsi/a100u2w.c b/drivers/scsi/a100u2w.c
index a391090a17c5..0163457c12bb 100644
--- a/drivers/scsi/a100u2w.c
+++ b/drivers/scsi/a100u2w.c
@@ -1082,8 +1082,8 @@ static struct scsi_host_template inia100_template = {
1082 .use_clustering = ENABLE_CLUSTERING, 1082 .use_clustering = ENABLE_CLUSTERING,
1083}; 1083};
1084 1084
1085static int __devinit inia100_probe_one(struct pci_dev *pdev, 1085static int inia100_probe_one(struct pci_dev *pdev,
1086 const struct pci_device_id *id) 1086 const struct pci_device_id *id)
1087{ 1087{
1088 struct Scsi_Host *shost; 1088 struct Scsi_Host *shost;
1089 struct orc_host *host; 1089 struct orc_host *host;
@@ -1197,7 +1197,7 @@ out:
1197 return error; 1197 return error;
1198} 1198}
1199 1199
1200static void __devexit inia100_remove_one(struct pci_dev *pdev) 1200static void inia100_remove_one(struct pci_dev *pdev)
1201{ 1201{
1202 struct Scsi_Host *shost = pci_get_drvdata(pdev); 1202 struct Scsi_Host *shost = pci_get_drvdata(pdev);
1203 struct orc_host *host = (struct orc_host *)shost->hostdata; 1203 struct orc_host *host = (struct orc_host *)shost->hostdata;
@@ -1224,7 +1224,7 @@ static struct pci_driver inia100_pci_driver = {
1224 .name = "inia100", 1224 .name = "inia100",
1225 .id_table = inia100_pci_tbl, 1225 .id_table = inia100_pci_tbl,
1226 .probe = inia100_probe_one, 1226 .probe = inia100_probe_one,
1227 .remove = __devexit_p(inia100_remove_one), 1227 .remove = inia100_remove_one,
1228}; 1228};
1229 1229
1230static int __init inia100_init(void) 1230static int __init inia100_init(void)
diff --git a/drivers/scsi/a2091.c b/drivers/scsi/a2091.c
index 79a30633d4aa..3e09aa21c1ca 100644
--- a/drivers/scsi/a2091.c
+++ b/drivers/scsi/a2091.c
@@ -179,8 +179,7 @@ static struct scsi_host_template a2091_scsi_template = {
179 .use_clustering = DISABLE_CLUSTERING 179 .use_clustering = DISABLE_CLUSTERING
180}; 180};
181 181
182static int __devinit a2091_probe(struct zorro_dev *z, 182static int a2091_probe(struct zorro_dev *z, const struct zorro_device_id *ent)
183 const struct zorro_device_id *ent)
184{ 183{
185 struct Scsi_Host *instance; 184 struct Scsi_Host *instance;
186 int error; 185 int error;
@@ -239,7 +238,7 @@ fail_alloc:
239 return error; 238 return error;
240} 239}
241 240
242static void __devexit a2091_remove(struct zorro_dev *z) 241static void a2091_remove(struct zorro_dev *z)
243{ 242{
244 struct Scsi_Host *instance = zorro_get_drvdata(z); 243 struct Scsi_Host *instance = zorro_get_drvdata(z);
245 struct a2091_hostdata *hdata = shost_priv(instance); 244 struct a2091_hostdata *hdata = shost_priv(instance);
@@ -251,7 +250,7 @@ static void __devexit a2091_remove(struct zorro_dev *z)
251 release_mem_region(z->resource.start, 256); 250 release_mem_region(z->resource.start, 256);
252} 251}
253 252
254static struct zorro_device_id a2091_zorro_tbl[] __devinitdata = { 253static struct zorro_device_id a2091_zorro_tbl[] = {
255 { ZORRO_PROD_CBM_A590_A2091_1 }, 254 { ZORRO_PROD_CBM_A590_A2091_1 },
256 { ZORRO_PROD_CBM_A590_A2091_2 }, 255 { ZORRO_PROD_CBM_A590_A2091_2 },
257 { 0 } 256 { 0 }
@@ -262,7 +261,7 @@ static struct zorro_driver a2091_driver = {
262 .name = "a2091", 261 .name = "a2091",
263 .id_table = a2091_zorro_tbl, 262 .id_table = a2091_zorro_tbl,
264 .probe = a2091_probe, 263 .probe = a2091_probe,
265 .remove = __devexit_p(a2091_remove), 264 .remove = a2091_remove,
266}; 265};
267 266
268static int __init a2091_init(void) 267static int __init a2091_init(void)
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index cb7f1582a6d1..408a42ef787a 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -88,13 +88,7 @@ char aac_driver_version[] = AAC_DRIVER_FULL_VERSION;
88 * 88 *
89 * Note: The last field is used to index into aac_drivers below. 89 * Note: The last field is used to index into aac_drivers below.
90 */ 90 */
91#ifdef DECLARE_PCI_DEVICE_TABLE 91static const struct pci_device_id aac_pci_tbl[] = {
92static DECLARE_PCI_DEVICE_TABLE(aac_pci_tbl) = {
93#elif defined(__devinitconst)
94static const struct pci_device_id aac_pci_tbl[] __devinitconst = {
95#else
96static const struct pci_device_id aac_pci_tbl[] __devinitconst = {
97#endif
98 { 0x1028, 0x0001, 0x1028, 0x0001, 0, 0, 0 }, /* PERC 2/Si (Iguana/PERC2Si) */ 92 { 0x1028, 0x0001, 0x1028, 0x0001, 0, 0, 0 }, /* PERC 2/Si (Iguana/PERC2Si) */
99 { 0x1028, 0x0002, 0x1028, 0x0002, 0, 0, 1 }, /* PERC 3/Di (Opal/PERC3Di) */ 93 { 0x1028, 0x0002, 0x1028, 0x0002, 0, 0, 1 }, /* PERC 3/Di (Opal/PERC3Di) */
100 { 0x1028, 0x0003, 0x1028, 0x0003, 0, 0, 2 }, /* PERC 3/Si (SlimFast/PERC3Si */ 94 { 0x1028, 0x0003, 0x1028, 0x0003, 0, 0, 2 }, /* PERC 3/Si (SlimFast/PERC3Si */
@@ -1107,8 +1101,7 @@ static void __aac_shutdown(struct aac_dev * aac)
1107 pci_disable_msi(aac->pdev); 1101 pci_disable_msi(aac->pdev);
1108} 1102}
1109 1103
1110static int __devinit aac_probe_one(struct pci_dev *pdev, 1104static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
1111 const struct pci_device_id *id)
1112{ 1105{
1113 unsigned index = id->driver_data; 1106 unsigned index = id->driver_data;
1114 struct Scsi_Host *shost; 1107 struct Scsi_Host *shost;
@@ -1310,7 +1303,7 @@ static void aac_shutdown(struct pci_dev *dev)
1310 __aac_shutdown((struct aac_dev *)shost->hostdata); 1303 __aac_shutdown((struct aac_dev *)shost->hostdata);
1311} 1304}
1312 1305
1313static void __devexit aac_remove_one(struct pci_dev *pdev) 1306static void aac_remove_one(struct pci_dev *pdev)
1314{ 1307{
1315 struct Scsi_Host *shost = pci_get_drvdata(pdev); 1308 struct Scsi_Host *shost = pci_get_drvdata(pdev);
1316 struct aac_dev *aac = (struct aac_dev *)shost->hostdata; 1309 struct aac_dev *aac = (struct aac_dev *)shost->hostdata;
@@ -1341,7 +1334,7 @@ static struct pci_driver aac_pci_driver = {
1341 .name = AAC_DRIVERNAME, 1334 .name = AAC_DRIVERNAME,
1342 .id_table = aac_pci_tbl, 1335 .id_table = aac_pci_tbl,
1343 .probe = aac_probe_one, 1336 .probe = aac_probe_one,
1344 .remove = __devexit_p(aac_remove_one), 1337 .remove = aac_remove_one,
1345 .shutdown = aac_shutdown, 1338 .shutdown = aac_shutdown,
1346}; 1339};
1347 1340
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 374c4edf4fcb..dcfaee66a8b9 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -9526,7 +9526,7 @@ advansys_queuecommand_lck(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd *
9526 9526
9527static DEF_SCSI_QCMD(advansys_queuecommand) 9527static DEF_SCSI_QCMD(advansys_queuecommand)
9528 9528
9529static ushort __devinit AscGetEisaChipCfg(PortAddr iop_base) 9529static ushort AscGetEisaChipCfg(PortAddr iop_base)
9530{ 9530{
9531 PortAddr eisa_cfg_iop = (PortAddr) ASC_GET_EISA_SLOT(iop_base) | 9531 PortAddr eisa_cfg_iop = (PortAddr) ASC_GET_EISA_SLOT(iop_base) |
9532 (PortAddr) (ASC_EISA_CFG_IOP_MASK); 9532 (PortAddr) (ASC_EISA_CFG_IOP_MASK);
@@ -9537,8 +9537,8 @@ static ushort __devinit AscGetEisaChipCfg(PortAddr iop_base)
9537 * Return the BIOS address of the adapter at the specified 9537 * Return the BIOS address of the adapter at the specified
9538 * I/O port and with the specified bus type. 9538 * I/O port and with the specified bus type.
9539 */ 9539 */
9540static unsigned short __devinit 9540static unsigned short AscGetChipBiosAddress(PortAddr iop_base,
9541AscGetChipBiosAddress(PortAddr iop_base, unsigned short bus_type) 9541 unsigned short bus_type)
9542{ 9542{
9543 unsigned short cfg_lsw; 9543 unsigned short cfg_lsw;
9544 unsigned short bios_addr; 9544 unsigned short bios_addr;
@@ -9569,7 +9569,7 @@ AscGetChipBiosAddress(PortAddr iop_base, unsigned short bus_type)
9569 return bios_addr; 9569 return bios_addr;
9570} 9570}
9571 9571
9572static uchar __devinit AscSetChipScsiID(PortAddr iop_base, uchar new_host_id) 9572static uchar AscSetChipScsiID(PortAddr iop_base, uchar new_host_id)
9573{ 9573{
9574 ushort cfg_lsw; 9574 ushort cfg_lsw;
9575 9575
@@ -9583,7 +9583,7 @@ static uchar __devinit AscSetChipScsiID(PortAddr iop_base, uchar new_host_id)
9583 return (AscGetChipScsiID(iop_base)); 9583 return (AscGetChipScsiID(iop_base));
9584} 9584}
9585 9585
9586static unsigned char __devinit AscGetChipScsiCtrl(PortAddr iop_base) 9586static unsigned char AscGetChipScsiCtrl(PortAddr iop_base)
9587{ 9587{
9588 unsigned char sc; 9588 unsigned char sc;
9589 9589
@@ -9593,8 +9593,8 @@ static unsigned char __devinit AscGetChipScsiCtrl(PortAddr iop_base)
9593 return sc; 9593 return sc;
9594} 9594}
9595 9595
9596static unsigned char __devinit 9596static unsigned char AscGetChipVersion(PortAddr iop_base,
9597AscGetChipVersion(PortAddr iop_base, unsigned short bus_type) 9597 unsigned short bus_type)
9598{ 9598{
9599 if (bus_type & ASC_IS_EISA) { 9599 if (bus_type & ASC_IS_EISA) {
9600 PortAddr eisa_iop; 9600 PortAddr eisa_iop;
@@ -9608,7 +9608,7 @@ AscGetChipVersion(PortAddr iop_base, unsigned short bus_type)
9608} 9608}
9609 9609
9610#ifdef CONFIG_ISA 9610#ifdef CONFIG_ISA
9611static void __devinit AscEnableIsaDma(uchar dma_channel) 9611static void AscEnableIsaDma(uchar dma_channel)
9612{ 9612{
9613 if (dma_channel < 4) { 9613 if (dma_channel < 4) {
9614 outp(0x000B, (ushort)(0xC0 | dma_channel)); 9614 outp(0x000B, (ushort)(0xC0 | dma_channel));
@@ -9638,7 +9638,7 @@ static int AscStopQueueExe(PortAddr iop_base)
9638 return (0); 9638 return (0);
9639} 9639}
9640 9640
9641static ASC_DCNT __devinit AscGetMaxDmaCount(ushort bus_type) 9641static ASC_DCNT AscGetMaxDmaCount(ushort bus_type)
9642{ 9642{
9643 if (bus_type & ASC_IS_ISA) 9643 if (bus_type & ASC_IS_ISA)
9644 return ASC_MAX_ISA_DMA_COUNT; 9644 return ASC_MAX_ISA_DMA_COUNT;
@@ -9648,7 +9648,7 @@ static ASC_DCNT __devinit AscGetMaxDmaCount(ushort bus_type)
9648} 9648}
9649 9649
9650#ifdef CONFIG_ISA 9650#ifdef CONFIG_ISA
9651static ushort __devinit AscGetIsaDmaChannel(PortAddr iop_base) 9651static ushort AscGetIsaDmaChannel(PortAddr iop_base)
9652{ 9652{
9653 ushort channel; 9653 ushort channel;
9654 9654
@@ -9660,7 +9660,7 @@ static ushort __devinit AscGetIsaDmaChannel(PortAddr iop_base)
9660 return (channel + 4); 9660 return (channel + 4);
9661} 9661}
9662 9662
9663static ushort __devinit AscSetIsaDmaChannel(PortAddr iop_base, ushort dma_channel) 9663static ushort AscSetIsaDmaChannel(PortAddr iop_base, ushort dma_channel)
9664{ 9664{
9665 ushort cfg_lsw; 9665 ushort cfg_lsw;
9666 uchar value; 9666 uchar value;
@@ -9678,7 +9678,7 @@ static ushort __devinit AscSetIsaDmaChannel(PortAddr iop_base, ushort dma_channe
9678 return 0; 9678 return 0;
9679} 9679}
9680 9680
9681static uchar __devinit AscGetIsaDmaSpeed(PortAddr iop_base) 9681static uchar AscGetIsaDmaSpeed(PortAddr iop_base)
9682{ 9682{
9683 uchar speed_value; 9683 uchar speed_value;
9684 9684
@@ -9689,7 +9689,7 @@ static uchar __devinit AscGetIsaDmaSpeed(PortAddr iop_base)
9689 return speed_value; 9689 return speed_value;
9690} 9690}
9691 9691
9692static uchar __devinit AscSetIsaDmaSpeed(PortAddr iop_base, uchar speed_value) 9692static uchar AscSetIsaDmaSpeed(PortAddr iop_base, uchar speed_value)
9693{ 9693{
9694 speed_value &= 0x07; 9694 speed_value &= 0x07;
9695 AscSetBank(iop_base, 1); 9695 AscSetBank(iop_base, 1);
@@ -9699,7 +9699,7 @@ static uchar __devinit AscSetIsaDmaSpeed(PortAddr iop_base, uchar speed_value)
9699} 9699}
9700#endif /* CONFIG_ISA */ 9700#endif /* CONFIG_ISA */
9701 9701
9702static ushort __devinit AscInitAscDvcVar(ASC_DVC_VAR *asc_dvc) 9702static ushort AscInitAscDvcVar(ASC_DVC_VAR *asc_dvc)
9703{ 9703{
9704 int i; 9704 int i;
9705 PortAddr iop_base; 9705 PortAddr iop_base;
@@ -9786,7 +9786,7 @@ static ushort __devinit AscInitAscDvcVar(ASC_DVC_VAR *asc_dvc)
9786 return warn_code; 9786 return warn_code;
9787} 9787}
9788 9788
9789static int __devinit AscWriteEEPCmdReg(PortAddr iop_base, uchar cmd_reg) 9789static int AscWriteEEPCmdReg(PortAddr iop_base, uchar cmd_reg)
9790{ 9790{
9791 int retry; 9791 int retry;
9792 9792
@@ -9801,12 +9801,12 @@ static int __devinit AscWriteEEPCmdReg(PortAddr iop_base, uchar cmd_reg)
9801 return 0; 9801 return 0;
9802} 9802}
9803 9803
9804static void __devinit AscWaitEEPRead(void) 9804static void AscWaitEEPRead(void)
9805{ 9805{
9806 mdelay(1); 9806 mdelay(1);
9807} 9807}
9808 9808
9809static ushort __devinit AscReadEEPWord(PortAddr iop_base, uchar addr) 9809static ushort AscReadEEPWord(PortAddr iop_base, uchar addr)
9810{ 9810{
9811 ushort read_wval; 9811 ushort read_wval;
9812 uchar cmd_reg; 9812 uchar cmd_reg;
@@ -9821,8 +9821,8 @@ static ushort __devinit AscReadEEPWord(PortAddr iop_base, uchar addr)
9821 return read_wval; 9821 return read_wval;
9822} 9822}
9823 9823
9824static ushort __devinit 9824static ushort AscGetEEPConfig(PortAddr iop_base, ASCEEP_CONFIG *cfg_buf,
9825AscGetEEPConfig(PortAddr iop_base, ASCEEP_CONFIG *cfg_buf, ushort bus_type) 9825 ushort bus_type)
9826{ 9826{
9827 ushort wval; 9827 ushort wval;
9828 ushort sum; 9828 ushort sum;
@@ -9868,7 +9868,7 @@ AscGetEEPConfig(PortAddr iop_base, ASCEEP_CONFIG *cfg_buf, ushort bus_type)
9868 return sum; 9868 return sum;
9869} 9869}
9870 9870
9871static int __devinit AscTestExternalLram(ASC_DVC_VAR *asc_dvc) 9871static int AscTestExternalLram(ASC_DVC_VAR *asc_dvc)
9872{ 9872{
9873 PortAddr iop_base; 9873 PortAddr iop_base;
9874 ushort q_addr; 9874 ushort q_addr;
@@ -9890,12 +9890,12 @@ static int __devinit AscTestExternalLram(ASC_DVC_VAR *asc_dvc)
9890 return (sta); 9890 return (sta);
9891} 9891}
9892 9892
9893static void __devinit AscWaitEEPWrite(void) 9893static void AscWaitEEPWrite(void)
9894{ 9894{
9895 mdelay(20); 9895 mdelay(20);
9896} 9896}
9897 9897
9898static int __devinit AscWriteEEPDataReg(PortAddr iop_base, ushort data_reg) 9898static int AscWriteEEPDataReg(PortAddr iop_base, ushort data_reg)
9899{ 9899{
9900 ushort read_back; 9900 ushort read_back;
9901 int retry; 9901 int retry;
@@ -9914,8 +9914,7 @@ static int __devinit AscWriteEEPDataReg(PortAddr iop_base, ushort data_reg)
9914 } 9914 }
9915} 9915}
9916 9916
9917static ushort __devinit 9917static ushort AscWriteEEPWord(PortAddr iop_base, uchar addr, ushort word_val)
9918AscWriteEEPWord(PortAddr iop_base, uchar addr, ushort word_val)
9919{ 9918{
9920 ushort read_wval; 9919 ushort read_wval;
9921 9920
@@ -9935,8 +9934,8 @@ AscWriteEEPWord(PortAddr iop_base, uchar addr, ushort word_val)
9935 return (read_wval); 9934 return (read_wval);
9936} 9935}
9937 9936
9938static int __devinit 9937static int AscSetEEPConfigOnce(PortAddr iop_base, ASCEEP_CONFIG *cfg_buf,
9939AscSetEEPConfigOnce(PortAddr iop_base, ASCEEP_CONFIG *cfg_buf, ushort bus_type) 9938 ushort bus_type)
9940{ 9939{
9941 int n_error; 9940 int n_error;
9942 ushort *wbuf; 9941 ushort *wbuf;
@@ -10031,8 +10030,8 @@ AscSetEEPConfigOnce(PortAddr iop_base, ASCEEP_CONFIG *cfg_buf, ushort bus_type)
10031 return n_error; 10030 return n_error;
10032} 10031}
10033 10032
10034static int __devinit 10033static int AscSetEEPConfig(PortAddr iop_base, ASCEEP_CONFIG *cfg_buf,
10035AscSetEEPConfig(PortAddr iop_base, ASCEEP_CONFIG *cfg_buf, ushort bus_type) 10034 ushort bus_type)
10036{ 10035{
10037 int retry; 10036 int retry;
10038 int n_error; 10037 int n_error;
@@ -10050,7 +10049,7 @@ AscSetEEPConfig(PortAddr iop_base, ASCEEP_CONFIG *cfg_buf, ushort bus_type)
10050 return n_error; 10049 return n_error;
10051} 10050}
10052 10051
10053static ushort __devinit AscInitFromEEP(ASC_DVC_VAR *asc_dvc) 10052static ushort AscInitFromEEP(ASC_DVC_VAR *asc_dvc)
10054{ 10053{
10055 ASCEEP_CONFIG eep_config_buf; 10054 ASCEEP_CONFIG eep_config_buf;
10056 ASCEEP_CONFIG *eep_config; 10055 ASCEEP_CONFIG *eep_config;
@@ -10215,7 +10214,7 @@ static ushort __devinit AscInitFromEEP(ASC_DVC_VAR *asc_dvc)
10215 return (warn_code); 10214 return (warn_code);
10216} 10215}
10217 10216
10218static int __devinit AscInitGetConfig(struct Scsi_Host *shost) 10217static int AscInitGetConfig(struct Scsi_Host *shost)
10219{ 10218{
10220 struct asc_board *board = shost_priv(shost); 10219 struct asc_board *board = shost_priv(shost);
10221 ASC_DVC_VAR *asc_dvc = &board->dvc_var.asc_dvc_var; 10220 ASC_DVC_VAR *asc_dvc = &board->dvc_var.asc_dvc_var;
@@ -10269,7 +10268,7 @@ static int __devinit AscInitGetConfig(struct Scsi_Host *shost)
10269 return asc_dvc->err_code; 10268 return asc_dvc->err_code;
10270} 10269}
10271 10270
10272static int __devinit AscInitSetConfig(struct pci_dev *pdev, struct Scsi_Host *shost) 10271static int AscInitSetConfig(struct pci_dev *pdev, struct Scsi_Host *shost)
10273{ 10272{
10274 struct asc_board *board = shost_priv(shost); 10273 struct asc_board *board = shost_priv(shost);
10275 ASC_DVC_VAR *asc_dvc = &board->dvc_var.asc_dvc_var; 10274 ASC_DVC_VAR *asc_dvc = &board->dvc_var.asc_dvc_var;
@@ -10383,7 +10382,7 @@ static int __devinit AscInitSetConfig(struct pci_dev *pdev, struct Scsi_Host *sh
10383 * on big-endian platforms so char fields read as words are actually being 10382 * on big-endian platforms so char fields read as words are actually being
10384 * unswapped on big-endian platforms. 10383 * unswapped on big-endian platforms.
10385 */ 10384 */
10386static ADVEEP_3550_CONFIG Default_3550_EEPROM_Config __devinitdata = { 10385static ADVEEP_3550_CONFIG Default_3550_EEPROM_Config = {
10387 ADV_EEPROM_BIOS_ENABLE, /* cfg_lsw */ 10386 ADV_EEPROM_BIOS_ENABLE, /* cfg_lsw */
10388 0x0000, /* cfg_msw */ 10387 0x0000, /* cfg_msw */
10389 0xFFFF, /* disc_enable */ 10388 0xFFFF, /* disc_enable */
@@ -10421,7 +10420,7 @@ static ADVEEP_3550_CONFIG Default_3550_EEPROM_Config __devinitdata = {
10421 0 /* num_of_err */ 10420 0 /* num_of_err */
10422}; 10421};
10423 10422
10424static ADVEEP_3550_CONFIG ADVEEP_3550_Config_Field_IsChar __devinitdata = { 10423static ADVEEP_3550_CONFIG ADVEEP_3550_Config_Field_IsChar = {
10425 0, /* cfg_lsw */ 10424 0, /* cfg_lsw */
10426 0, /* cfg_msw */ 10425 0, /* cfg_msw */
10427 0, /* -disc_enable */ 10426 0, /* -disc_enable */
@@ -10459,7 +10458,7 @@ static ADVEEP_3550_CONFIG ADVEEP_3550_Config_Field_IsChar __devinitdata = {
10459 0 /* num_of_err */ 10458 0 /* num_of_err */
10460}; 10459};
10461 10460
10462static ADVEEP_38C0800_CONFIG Default_38C0800_EEPROM_Config __devinitdata = { 10461static ADVEEP_38C0800_CONFIG Default_38C0800_EEPROM_Config = {
10463 ADV_EEPROM_BIOS_ENABLE, /* 00 cfg_lsw */ 10462 ADV_EEPROM_BIOS_ENABLE, /* 00 cfg_lsw */
10464 0x0000, /* 01 cfg_msw */ 10463 0x0000, /* 01 cfg_msw */
10465 0xFFFF, /* 02 disc_enable */ 10464 0xFFFF, /* 02 disc_enable */
@@ -10524,7 +10523,7 @@ static ADVEEP_38C0800_CONFIG Default_38C0800_EEPROM_Config __devinitdata = {
10524 0 /* 63 reserved */ 10523 0 /* 63 reserved */
10525}; 10524};
10526 10525
10527static ADVEEP_38C0800_CONFIG ADVEEP_38C0800_Config_Field_IsChar __devinitdata = { 10526static ADVEEP_38C0800_CONFIG ADVEEP_38C0800_Config_Field_IsChar = {
10528 0, /* 00 cfg_lsw */ 10527 0, /* 00 cfg_lsw */
10529 0, /* 01 cfg_msw */ 10528 0, /* 01 cfg_msw */
10530 0, /* 02 disc_enable */ 10529 0, /* 02 disc_enable */
@@ -10589,7 +10588,7 @@ static ADVEEP_38C0800_CONFIG ADVEEP_38C0800_Config_Field_IsChar __devinitdata =
10589 0 /* 63 reserved */ 10588 0 /* 63 reserved */
10590}; 10589};
10591 10590
10592static ADVEEP_38C1600_CONFIG Default_38C1600_EEPROM_Config __devinitdata = { 10591static ADVEEP_38C1600_CONFIG Default_38C1600_EEPROM_Config = {
10593 ADV_EEPROM_BIOS_ENABLE, /* 00 cfg_lsw */ 10592 ADV_EEPROM_BIOS_ENABLE, /* 00 cfg_lsw */
10594 0x0000, /* 01 cfg_msw */ 10593 0x0000, /* 01 cfg_msw */
10595 0xFFFF, /* 02 disc_enable */ 10594 0xFFFF, /* 02 disc_enable */
@@ -10654,7 +10653,7 @@ static ADVEEP_38C1600_CONFIG Default_38C1600_EEPROM_Config __devinitdata = {
10654 0 /* 63 reserved */ 10653 0 /* 63 reserved */
10655}; 10654};
10656 10655
10657static ADVEEP_38C1600_CONFIG ADVEEP_38C1600_Config_Field_IsChar __devinitdata = { 10656static ADVEEP_38C1600_CONFIG ADVEEP_38C1600_Config_Field_IsChar = {
10658 0, /* 00 cfg_lsw */ 10657 0, /* 00 cfg_lsw */
10659 0, /* 01 cfg_msw */ 10658 0, /* 01 cfg_msw */
10660 0, /* 02 disc_enable */ 10659 0, /* 02 disc_enable */
@@ -10723,7 +10722,7 @@ static ADVEEP_38C1600_CONFIG ADVEEP_38C1600_Config_Field_IsChar __devinitdata =
10723/* 10722/*
10724 * Wait for EEPROM command to complete 10723 * Wait for EEPROM command to complete
10725 */ 10724 */
10726static void __devinit AdvWaitEEPCmd(AdvPortAddr iop_base) 10725static void AdvWaitEEPCmd(AdvPortAddr iop_base)
10727{ 10726{
10728 int eep_delay_ms; 10727 int eep_delay_ms;
10729 10728
@@ -10742,7 +10741,7 @@ static void __devinit AdvWaitEEPCmd(AdvPortAddr iop_base)
10742/* 10741/*
10743 * Read the EEPROM from specified location 10742 * Read the EEPROM from specified location
10744 */ 10743 */
10745static ushort __devinit AdvReadEEPWord(AdvPortAddr iop_base, int eep_word_addr) 10744static ushort AdvReadEEPWord(AdvPortAddr iop_base, int eep_word_addr)
10746{ 10745{
10747 AdvWriteWordRegister(iop_base, IOPW_EE_CMD, 10746 AdvWriteWordRegister(iop_base, IOPW_EE_CMD,
10748 ASC_EEP_CMD_READ | eep_word_addr); 10747 ASC_EEP_CMD_READ | eep_word_addr);
@@ -10753,8 +10752,8 @@ static ushort __devinit AdvReadEEPWord(AdvPortAddr iop_base, int eep_word_addr)
10753/* 10752/*
10754 * Write the EEPROM from 'cfg_buf'. 10753 * Write the EEPROM from 'cfg_buf'.
10755 */ 10754 */
10756static void __devinit 10755static void AdvSet3550EEPConfig(AdvPortAddr iop_base,
10757AdvSet3550EEPConfig(AdvPortAddr iop_base, ADVEEP_3550_CONFIG *cfg_buf) 10756 ADVEEP_3550_CONFIG *cfg_buf)
10758{ 10757{
10759 ushort *wbuf; 10758 ushort *wbuf;
10760 ushort addr, chksum; 10759 ushort addr, chksum;
@@ -10820,8 +10819,8 @@ AdvSet3550EEPConfig(AdvPortAddr iop_base, ADVEEP_3550_CONFIG *cfg_buf)
10820/* 10819/*
10821 * Write the EEPROM from 'cfg_buf'. 10820 * Write the EEPROM from 'cfg_buf'.
10822 */ 10821 */
10823static void __devinit 10822static void AdvSet38C0800EEPConfig(AdvPortAddr iop_base,
10824AdvSet38C0800EEPConfig(AdvPortAddr iop_base, ADVEEP_38C0800_CONFIG *cfg_buf) 10823 ADVEEP_38C0800_CONFIG *cfg_buf)
10825{ 10824{
10826 ushort *wbuf; 10825 ushort *wbuf;
10827 ushort *charfields; 10826 ushort *charfields;
@@ -10887,8 +10886,8 @@ AdvSet38C0800EEPConfig(AdvPortAddr iop_base, ADVEEP_38C0800_CONFIG *cfg_buf)
10887/* 10886/*
10888 * Write the EEPROM from 'cfg_buf'. 10887 * Write the EEPROM from 'cfg_buf'.
10889 */ 10888 */
10890static void __devinit 10889static void AdvSet38C1600EEPConfig(AdvPortAddr iop_base,
10891AdvSet38C1600EEPConfig(AdvPortAddr iop_base, ADVEEP_38C1600_CONFIG *cfg_buf) 10890 ADVEEP_38C1600_CONFIG *cfg_buf)
10892{ 10891{
10893 ushort *wbuf; 10892 ushort *wbuf;
10894 ushort *charfields; 10893 ushort *charfields;
@@ -10956,8 +10955,8 @@ AdvSet38C1600EEPConfig(AdvPortAddr iop_base, ADVEEP_38C1600_CONFIG *cfg_buf)
10956 * 10955 *
10957 * Return a checksum based on the EEPROM configuration read. 10956 * Return a checksum based on the EEPROM configuration read.
10958 */ 10957 */
10959static ushort __devinit 10958static ushort AdvGet3550EEPConfig(AdvPortAddr iop_base,
10960AdvGet3550EEPConfig(AdvPortAddr iop_base, ADVEEP_3550_CONFIG *cfg_buf) 10959 ADVEEP_3550_CONFIG *cfg_buf)
10961{ 10960{
10962 ushort wval, chksum; 10961 ushort wval, chksum;
10963 ushort *wbuf; 10962 ushort *wbuf;
@@ -10999,8 +10998,8 @@ AdvGet3550EEPConfig(AdvPortAddr iop_base, ADVEEP_3550_CONFIG *cfg_buf)
10999 * 10998 *
11000 * Return a checksum based on the EEPROM configuration read. 10999 * Return a checksum based on the EEPROM configuration read.
11001 */ 11000 */
11002static ushort __devinit 11001static ushort AdvGet38C0800EEPConfig(AdvPortAddr iop_base,
11003AdvGet38C0800EEPConfig(AdvPortAddr iop_base, ADVEEP_38C0800_CONFIG *cfg_buf) 11002 ADVEEP_38C0800_CONFIG *cfg_buf)
11004{ 11003{
11005 ushort wval, chksum; 11004 ushort wval, chksum;
11006 ushort *wbuf; 11005 ushort *wbuf;
@@ -11042,8 +11041,8 @@ AdvGet38C0800EEPConfig(AdvPortAddr iop_base, ADVEEP_38C0800_CONFIG *cfg_buf)
11042 * 11041 *
11043 * Return a checksum based on the EEPROM configuration read. 11042 * Return a checksum based on the EEPROM configuration read.
11044 */ 11043 */
11045static ushort __devinit 11044static ushort AdvGet38C1600EEPConfig(AdvPortAddr iop_base,
11046AdvGet38C1600EEPConfig(AdvPortAddr iop_base, ADVEEP_38C1600_CONFIG *cfg_buf) 11045 ADVEEP_38C1600_CONFIG *cfg_buf)
11047{ 11046{
11048 ushort wval, chksum; 11047 ushort wval, chksum;
11049 ushort *wbuf; 11048 ushort *wbuf;
@@ -11092,7 +11091,7 @@ AdvGet38C1600EEPConfig(AdvPortAddr iop_base, ADVEEP_38C1600_CONFIG *cfg_buf)
11092 * 11091 *
11093 * Note: Chip is stopped on entry. 11092 * Note: Chip is stopped on entry.
11094 */ 11093 */
11095static int __devinit AdvInitFrom3550EEP(ADV_DVC_VAR *asc_dvc) 11094static int AdvInitFrom3550EEP(ADV_DVC_VAR *asc_dvc)
11096{ 11095{
11097 AdvPortAddr iop_base; 11096 AdvPortAddr iop_base;
11098 ushort warn_code; 11097 ushort warn_code;
@@ -11242,7 +11241,7 @@ static int __devinit AdvInitFrom3550EEP(ADV_DVC_VAR *asc_dvc)
11242 * 11241 *
11243 * Note: Chip is stopped on entry. 11242 * Note: Chip is stopped on entry.
11244 */ 11243 */
11245static int __devinit AdvInitFrom38C0800EEP(ADV_DVC_VAR *asc_dvc) 11244static int AdvInitFrom38C0800EEP(ADV_DVC_VAR *asc_dvc)
11246{ 11245{
11247 AdvPortAddr iop_base; 11246 AdvPortAddr iop_base;
11248 ushort warn_code; 11247 ushort warn_code;
@@ -11441,7 +11440,7 @@ static int __devinit AdvInitFrom38C0800EEP(ADV_DVC_VAR *asc_dvc)
11441 * 11440 *
11442 * Note: Chip is stopped on entry. 11441 * Note: Chip is stopped on entry.
11443 */ 11442 */
11444static int __devinit AdvInitFrom38C1600EEP(ADV_DVC_VAR *asc_dvc) 11443static int AdvInitFrom38C1600EEP(ADV_DVC_VAR *asc_dvc)
11445{ 11444{
11446 AdvPortAddr iop_base; 11445 AdvPortAddr iop_base;
11447 ushort warn_code; 11446 ushort warn_code;
@@ -11661,8 +11660,7 @@ static int __devinit AdvInitFrom38C1600EEP(ADV_DVC_VAR *asc_dvc)
11661 * For a non-fatal error return a warning code. If there are no warnings 11660 * For a non-fatal error return a warning code. If there are no warnings
11662 * then 0 is returned. 11661 * then 0 is returned.
11663 */ 11662 */
11664static int __devinit 11663static int AdvInitGetConfig(struct pci_dev *pdev, struct Scsi_Host *shost)
11665AdvInitGetConfig(struct pci_dev *pdev, struct Scsi_Host *shost)
11666{ 11664{
11667 struct asc_board *board = shost_priv(shost); 11665 struct asc_board *board = shost_priv(shost);
11668 ADV_DVC_VAR *asc_dvc = &board->dvc_var.adv_dvc_var; 11666 ADV_DVC_VAR *asc_dvc = &board->dvc_var.adv_dvc_var;
@@ -11769,7 +11767,7 @@ static struct scsi_host_template advansys_template = {
11769 .use_clustering = ENABLE_CLUSTERING, 11767 .use_clustering = ENABLE_CLUSTERING,
11770}; 11768};
11771 11769
11772static int __devinit advansys_wide_init_chip(struct Scsi_Host *shost) 11770static int advansys_wide_init_chip(struct Scsi_Host *shost)
11773{ 11771{
11774 struct asc_board *board = shost_priv(shost); 11772 struct asc_board *board = shost_priv(shost);
11775 struct adv_dvc_var *adv_dvc = &board->dvc_var.adv_dvc_var; 11773 struct adv_dvc_var *adv_dvc = &board->dvc_var.adv_dvc_var;
@@ -11882,8 +11880,8 @@ static void advansys_wide_free_mem(struct asc_board *board)
11882 } 11880 }
11883} 11881}
11884 11882
11885static int __devinit advansys_board_found(struct Scsi_Host *shost, 11883static int advansys_board_found(struct Scsi_Host *shost, unsigned int iop,
11886 unsigned int iop, int bus_type) 11884 int bus_type)
11887{ 11885{
11888 struct pci_dev *pdev; 11886 struct pci_dev *pdev;
11889 struct asc_board *boardp = shost_priv(shost); 11887 struct asc_board *boardp = shost_priv(shost);
@@ -12428,7 +12426,7 @@ static PortAddr _asc_def_iop_base[ASC_IOADR_TABLE_MAX_IX] = {
12428 * 10: 12 12426 * 10: 12
12429 * 11: 15 12427 * 11: 15
12430 */ 12428 */
12431static unsigned int __devinit advansys_isa_irq_no(PortAddr iop_base) 12429static unsigned int advansys_isa_irq_no(PortAddr iop_base)
12432{ 12430{
12433 unsigned short cfg_lsw = AscGetChipCfgLsw(iop_base); 12431 unsigned short cfg_lsw = AscGetChipCfgLsw(iop_base);
12434 unsigned int chip_irq = ((cfg_lsw >> 2) & 0x03) + 10; 12432 unsigned int chip_irq = ((cfg_lsw >> 2) & 0x03) + 10;
@@ -12437,7 +12435,7 @@ static unsigned int __devinit advansys_isa_irq_no(PortAddr iop_base)
12437 return chip_irq; 12435 return chip_irq;
12438} 12436}
12439 12437
12440static int __devinit advansys_isa_probe(struct device *dev, unsigned int id) 12438static int advansys_isa_probe(struct device *dev, unsigned int id)
12441{ 12439{
12442 int err = -ENODEV; 12440 int err = -ENODEV;
12443 PortAddr iop_base = _asc_def_iop_base[id]; 12441 PortAddr iop_base = _asc_def_iop_base[id];
@@ -12477,7 +12475,7 @@ static int __devinit advansys_isa_probe(struct device *dev, unsigned int id)
12477 return err; 12475 return err;
12478} 12476}
12479 12477
12480static int __devexit advansys_isa_remove(struct device *dev, unsigned int id) 12478static int advansys_isa_remove(struct device *dev, unsigned int id)
12481{ 12479{
12482 int ioport = _asc_def_iop_base[id]; 12480 int ioport = _asc_def_iop_base[id];
12483 advansys_release(dev_get_drvdata(dev)); 12481 advansys_release(dev_get_drvdata(dev));
@@ -12487,7 +12485,7 @@ static int __devexit advansys_isa_remove(struct device *dev, unsigned int id)
12487 12485
12488static struct isa_driver advansys_isa_driver = { 12486static struct isa_driver advansys_isa_driver = {
12489 .probe = advansys_isa_probe, 12487 .probe = advansys_isa_probe,
12490 .remove = __devexit_p(advansys_isa_remove), 12488 .remove = advansys_isa_remove,
12491 .driver = { 12489 .driver = {
12492 .owner = THIS_MODULE, 12490 .owner = THIS_MODULE,
12493 .name = DRV_NAME, 12491 .name = DRV_NAME,
@@ -12505,7 +12503,7 @@ static struct isa_driver advansys_isa_driver = {
12505 * 110: 15 12503 * 110: 15
12506 * 111: invalid 12504 * 111: invalid
12507 */ 12505 */
12508static unsigned int __devinit advansys_vlb_irq_no(PortAddr iop_base) 12506static unsigned int advansys_vlb_irq_no(PortAddr iop_base)
12509{ 12507{
12510 unsigned short cfg_lsw = AscGetChipCfgLsw(iop_base); 12508 unsigned short cfg_lsw = AscGetChipCfgLsw(iop_base);
12511 unsigned int chip_irq = ((cfg_lsw >> 2) & 0x07) + 9; 12509 unsigned int chip_irq = ((cfg_lsw >> 2) & 0x07) + 9;
@@ -12514,7 +12512,7 @@ static unsigned int __devinit advansys_vlb_irq_no(PortAddr iop_base)
12514 return chip_irq; 12512 return chip_irq;
12515} 12513}
12516 12514
12517static int __devinit advansys_vlb_probe(struct device *dev, unsigned int id) 12515static int advansys_vlb_probe(struct device *dev, unsigned int id)
12518{ 12516{
12519 int err = -ENODEV; 12517 int err = -ENODEV;
12520 PortAddr iop_base = _asc_def_iop_base[id]; 12518 PortAddr iop_base = _asc_def_iop_base[id];
@@ -12561,14 +12559,14 @@ static int __devinit advansys_vlb_probe(struct device *dev, unsigned int id)
12561 12559
12562static struct isa_driver advansys_vlb_driver = { 12560static struct isa_driver advansys_vlb_driver = {
12563 .probe = advansys_vlb_probe, 12561 .probe = advansys_vlb_probe,
12564 .remove = __devexit_p(advansys_isa_remove), 12562 .remove = advansys_isa_remove,
12565 .driver = { 12563 .driver = {
12566 .owner = THIS_MODULE, 12564 .owner = THIS_MODULE,
12567 .name = "advansys_vlb", 12565 .name = "advansys_vlb",
12568 }, 12566 },
12569}; 12567};
12570 12568
12571static struct eisa_device_id advansys_eisa_table[] __devinitdata = { 12569static struct eisa_device_id advansys_eisa_table[] = {
12572 { "ABP7401" }, 12570 { "ABP7401" },
12573 { "ABP7501" }, 12571 { "ABP7501" },
12574 { "" } 12572 { "" }
@@ -12595,7 +12593,7 @@ struct eisa_scsi_data {
12595 * 110: invalid 12593 * 110: invalid
12596 * 111: invalid 12594 * 111: invalid
12597 */ 12595 */
12598static unsigned int __devinit advansys_eisa_irq_no(struct eisa_device *edev) 12596static unsigned int advansys_eisa_irq_no(struct eisa_device *edev)
12599{ 12597{
12600 unsigned short cfg_lsw = inw(edev->base_addr + 0xc86); 12598 unsigned short cfg_lsw = inw(edev->base_addr + 0xc86);
12601 unsigned int chip_irq = ((cfg_lsw >> 8) & 0x07) + 10; 12599 unsigned int chip_irq = ((cfg_lsw >> 8) & 0x07) + 10;
@@ -12604,7 +12602,7 @@ static unsigned int __devinit advansys_eisa_irq_no(struct eisa_device *edev)
12604 return chip_irq; 12602 return chip_irq;
12605} 12603}
12606 12604
12607static int __devinit advansys_eisa_probe(struct device *dev) 12605static int advansys_eisa_probe(struct device *dev)
12608{ 12606{
12609 int i, ioport, irq = 0; 12607 int i, ioport, irq = 0;
12610 int err; 12608 int err;
@@ -12677,7 +12675,7 @@ static int __devinit advansys_eisa_probe(struct device *dev)
12677 return err; 12675 return err;
12678} 12676}
12679 12677
12680static __devexit int advansys_eisa_remove(struct device *dev) 12678static int advansys_eisa_remove(struct device *dev)
12681{ 12679{
12682 int i; 12680 int i;
12683 struct eisa_scsi_data *data = dev_get_drvdata(dev); 12681 struct eisa_scsi_data *data = dev_get_drvdata(dev);
@@ -12701,12 +12699,12 @@ static struct eisa_driver advansys_eisa_driver = {
12701 .driver = { 12699 .driver = {
12702 .name = DRV_NAME, 12700 .name = DRV_NAME,
12703 .probe = advansys_eisa_probe, 12701 .probe = advansys_eisa_probe,
12704 .remove = __devexit_p(advansys_eisa_remove), 12702 .remove = advansys_eisa_remove,
12705 } 12703 }
12706}; 12704};
12707 12705
12708/* PCI Devices supported by this driver */ 12706/* PCI Devices supported by this driver */
12709static struct pci_device_id advansys_pci_tbl[] __devinitdata = { 12707static struct pci_device_id advansys_pci_tbl[] = {
12710 {PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_ASP_1200A, 12708 {PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_ASP_1200A,
12711 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 12709 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
12712 {PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_ASP_ABP940, 12710 {PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_ASP_ABP940,
@@ -12724,7 +12722,7 @@ static struct pci_device_id advansys_pci_tbl[] __devinitdata = {
12724 12722
12725MODULE_DEVICE_TABLE(pci, advansys_pci_tbl); 12723MODULE_DEVICE_TABLE(pci, advansys_pci_tbl);
12726 12724
12727static void __devinit advansys_set_latency(struct pci_dev *pdev) 12725static void advansys_set_latency(struct pci_dev *pdev)
12728{ 12726{
12729 if ((pdev->device == PCI_DEVICE_ID_ASP_1200A) || 12727 if ((pdev->device == PCI_DEVICE_ID_ASP_1200A) ||
12730 (pdev->device == PCI_DEVICE_ID_ASP_ABP940)) { 12728 (pdev->device == PCI_DEVICE_ID_ASP_ABP940)) {
@@ -12737,8 +12735,8 @@ static void __devinit advansys_set_latency(struct pci_dev *pdev)
12737 } 12735 }
12738} 12736}
12739 12737
12740static int __devinit 12738static int advansys_pci_probe(struct pci_dev *pdev,
12741advansys_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 12739 const struct pci_device_id *ent)
12742{ 12740{
12743 int err, ioport; 12741 int err, ioport;
12744 struct Scsi_Host *shost; 12742 struct Scsi_Host *shost;
@@ -12791,7 +12789,7 @@ advansys_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
12791 return err; 12789 return err;
12792} 12790}
12793 12791
12794static void __devexit advansys_pci_remove(struct pci_dev *pdev) 12792static void advansys_pci_remove(struct pci_dev *pdev)
12795{ 12793{
12796 advansys_release(pci_get_drvdata(pdev)); 12794 advansys_release(pci_get_drvdata(pdev));
12797 pci_release_regions(pdev); 12795 pci_release_regions(pdev);
@@ -12802,7 +12800,7 @@ static struct pci_driver advansys_pci_driver = {
12802 .name = DRV_NAME, 12800 .name = DRV_NAME,
12803 .id_table = advansys_pci_tbl, 12801 .id_table = advansys_pci_tbl,
12804 .probe = advansys_pci_probe, 12802 .probe = advansys_pci_probe,
12805 .remove = __devexit_p(advansys_pci_remove), 12803 .remove = advansys_pci_remove,
12806}; 12804};
12807 12805
12808static int __init advansys_init(void) 12806static int __init advansys_init(void)
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index dd4547bf6881..a284be17699f 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -420,7 +420,7 @@ MODULE_PARM_DESC(aha152x1, "parameters for second controller");
420#endif /* MODULE */ 420#endif /* MODULE */
421 421
422#ifdef __ISAPNP__ 422#ifdef __ISAPNP__
423static struct isapnp_device_id id_table[] __devinitdata = { 423static struct isapnp_device_id id_table[] = {
424 { ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('A', 'D', 'P'), ISAPNP_FUNCTION(0x1502), 0 }, 424 { ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('A', 'D', 'P'), ISAPNP_FUNCTION(0x1502), 0 },
425 { ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('A', 'D', 'P'), ISAPNP_FUNCTION(0x1505), 0 }, 425 { ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('A', 'D', 'P'), ISAPNP_FUNCTION(0x1505), 0 },
426 { ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('A', 'D', 'P'), ISAPNP_FUNCTION(0x1510), 0 }, 426 { ISAPNP_ANY_ID, ISAPNP_ANY_ID, ISAPNP_VENDOR('A', 'D', 'P'), ISAPNP_FUNCTION(0x1510), 0 },
diff --git a/drivers/scsi/aha1740.c b/drivers/scsi/aha1740.c
index a3e6ed353917..df775e6ba579 100644
--- a/drivers/scsi/aha1740.c
+++ b/drivers/scsi/aha1740.c
@@ -646,7 +646,7 @@ static int aha1740_probe (struct device *dev)
646 return -ENODEV; 646 return -ENODEV;
647} 647}
648 648
649static __devexit int aha1740_remove (struct device *dev) 649static int aha1740_remove (struct device *dev)
650{ 650{
651 struct Scsi_Host *shpnt = dev_get_drvdata(dev); 651 struct Scsi_Host *shpnt = dev_get_drvdata(dev);
652 struct aha1740_hostdata *host = HOSTDATA (shpnt); 652 struct aha1740_hostdata *host = HOSTDATA (shpnt);
@@ -677,7 +677,7 @@ static struct eisa_driver aha1740_driver = {
677 .driver = { 677 .driver = {
678 .name = "aha1740", 678 .name = "aha1740",
679 .probe = aha1740_probe, 679 .probe = aha1740_probe,
680 .remove = __devexit_p (aha1740_remove), 680 .remove = aha1740_remove,
681 }, 681 },
682}; 682};
683 683
diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c
index 1c4120c3db41..c56741fc4b99 100644
--- a/drivers/scsi/aic94xx/aic94xx_init.c
+++ b/drivers/scsi/aic94xx/aic94xx_init.c
@@ -85,7 +85,7 @@ static struct scsi_host_template aic94xx_sht = {
85 .ioctl = sas_ioctl, 85 .ioctl = sas_ioctl,
86}; 86};
87 87
88static int __devinit asd_map_memio(struct asd_ha_struct *asd_ha) 88static int asd_map_memio(struct asd_ha_struct *asd_ha)
89{ 89{
90 int err, i; 90 int err, i;
91 struct asd_ha_addrspace *io_handle; 91 struct asd_ha_addrspace *io_handle;
@@ -146,7 +146,7 @@ static void asd_unmap_memio(struct asd_ha_struct *asd_ha)
146 pci_release_region(asd_ha->pcidev, 0); 146 pci_release_region(asd_ha->pcidev, 0);
147} 147}
148 148
149static int __devinit asd_map_ioport(struct asd_ha_struct *asd_ha) 149static int asd_map_ioport(struct asd_ha_struct *asd_ha)
150{ 150{
151 int i = PCI_IOBAR_OFFSET, err; 151 int i = PCI_IOBAR_OFFSET, err;
152 struct asd_ha_addrspace *io_handle = &asd_ha->io_handle[0]; 152 struct asd_ha_addrspace *io_handle = &asd_ha->io_handle[0];
@@ -175,7 +175,7 @@ static void asd_unmap_ioport(struct asd_ha_struct *asd_ha)
175 pci_release_region(asd_ha->pcidev, PCI_IOBAR_OFFSET); 175 pci_release_region(asd_ha->pcidev, PCI_IOBAR_OFFSET);
176} 176}
177 177
178static int __devinit asd_map_ha(struct asd_ha_struct *asd_ha) 178static int asd_map_ha(struct asd_ha_struct *asd_ha)
179{ 179{
180 int err; 180 int err;
181 u16 cmd_reg; 181 u16 cmd_reg;
@@ -221,7 +221,7 @@ static const char *asd_dev_rev[30] = {
221 [8] = "B0", 221 [8] = "B0",
222}; 222};
223 223
224static int __devinit asd_common_setup(struct asd_ha_struct *asd_ha) 224static int asd_common_setup(struct asd_ha_struct *asd_ha)
225{ 225{
226 int err, i; 226 int err, i;
227 227
@@ -257,7 +257,7 @@ Err:
257 return err; 257 return err;
258} 258}
259 259
260static int __devinit asd_aic9410_setup(struct asd_ha_struct *asd_ha) 260static int asd_aic9410_setup(struct asd_ha_struct *asd_ha)
261{ 261{
262 int err = asd_common_setup(asd_ha); 262 int err = asd_common_setup(asd_ha);
263 263
@@ -272,7 +272,7 @@ static int __devinit asd_aic9410_setup(struct asd_ha_struct *asd_ha)
272 return 0; 272 return 0;
273} 273}
274 274
275static int __devinit asd_aic9405_setup(struct asd_ha_struct *asd_ha) 275static int asd_aic9405_setup(struct asd_ha_struct *asd_ha)
276{ 276{
277 int err = asd_common_setup(asd_ha); 277 int err = asd_common_setup(asd_ha);
278 278
@@ -531,7 +531,7 @@ static void asd_remove_dev_attrs(struct asd_ha_struct *asd_ha)
531static const struct asd_pcidev_struct { 531static const struct asd_pcidev_struct {
532 const char * name; 532 const char * name;
533 int (*setup)(struct asd_ha_struct *asd_ha); 533 int (*setup)(struct asd_ha_struct *asd_ha);
534} asd_pcidev_data[] __devinitconst = { 534} asd_pcidev_data[] = {
535 /* Id 0 is used for dynamic ids. */ 535 /* Id 0 is used for dynamic ids. */
536 { .name = "Adaptec AIC-94xx SAS/SATA Host Adapter", 536 { .name = "Adaptec AIC-94xx SAS/SATA Host Adapter",
537 .setup = asd_aic9410_setup 537 .setup = asd_aic9410_setup
@@ -731,8 +731,7 @@ static int asd_unregister_sas_ha(struct asd_ha_struct *asd_ha)
731 return err; 731 return err;
732} 732}
733 733
734static int __devinit asd_pci_probe(struct pci_dev *dev, 734static int asd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
735 const struct pci_device_id *id)
736{ 735{
737 const struct asd_pcidev_struct *asd_dev; 736 const struct asd_pcidev_struct *asd_dev;
738 unsigned asd_id = (unsigned) id->driver_data; 737 unsigned asd_id = (unsigned) id->driver_data;
@@ -924,7 +923,7 @@ static void asd_turn_off_leds(struct asd_ha_struct *asd_ha)
924 } 923 }
925} 924}
926 925
927static void __devexit asd_pci_remove(struct pci_dev *dev) 926static void asd_pci_remove(struct pci_dev *dev)
928{ 927{
929 struct asd_ha_struct *asd_ha = pci_get_drvdata(dev); 928 struct asd_ha_struct *asd_ha = pci_get_drvdata(dev);
930 929
@@ -1012,7 +1011,7 @@ static struct sas_domain_function_template aic94xx_transport_functions = {
1012 .lldd_ata_set_dmamode = asd_set_dmamode, 1011 .lldd_ata_set_dmamode = asd_set_dmamode,
1013}; 1012};
1014 1013
1015static const struct pci_device_id aic94xx_pci_table[] __devinitconst = { 1014static const struct pci_device_id aic94xx_pci_table[] = {
1016 {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x410),0, 0, 1}, 1015 {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x410),0, 0, 1},
1017 {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x412),0, 0, 1}, 1016 {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x412),0, 0, 1},
1018 {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x416),0, 0, 1}, 1017 {PCI_DEVICE(PCI_VENDOR_ID_ADAPTEC2, 0x416),0, 0, 1},
@@ -1031,7 +1030,7 @@ static struct pci_driver aic94xx_pci_driver = {
1031 .name = ASD_DRIVER_NAME, 1030 .name = ASD_DRIVER_NAME,
1032 .id_table = aic94xx_pci_table, 1031 .id_table = aic94xx_pci_table,
1033 .probe = asd_pci_probe, 1032 .probe = asd_pci_probe,
1034 .remove = __devexit_p(asd_pci_remove), 1033 .remove = asd_pci_remove,
1035}; 1034};
1036 1035
1037static int __init aic94xx_init(void) 1036static int __init aic94xx_init(void)
diff --git a/drivers/scsi/arm/acornscsi.c b/drivers/scsi/arm/acornscsi.c
index b330438ac662..3e1172adb37b 100644
--- a/drivers/scsi/arm/acornscsi.c
+++ b/drivers/scsi/arm/acornscsi.c
@@ -2965,8 +2965,7 @@ static struct scsi_host_template acornscsi_template = {
2965 .proc_name = "acornscsi", 2965 .proc_name = "acornscsi",
2966}; 2966};
2967 2967
2968static int __devinit 2968static int acornscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
2969acornscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
2970{ 2969{
2971 struct Scsi_Host *host; 2970 struct Scsi_Host *host;
2972 AS_Host *ashost; 2971 AS_Host *ashost;
@@ -3032,7 +3031,7 @@ acornscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
3032 return ret; 3031 return ret;
3033} 3032}
3034 3033
3035static void __devexit acornscsi_remove(struct expansion_card *ec) 3034static void acornscsi_remove(struct expansion_card *ec)
3036{ 3035{
3037 struct Scsi_Host *host = ecard_get_drvdata(ec); 3036 struct Scsi_Host *host = ecard_get_drvdata(ec);
3038 AS_Host *ashost = (AS_Host *)host->hostdata; 3037 AS_Host *ashost = (AS_Host *)host->hostdata;
@@ -3063,7 +3062,7 @@ static const struct ecard_id acornscsi_cids[] = {
3063 3062
3064static struct ecard_driver acornscsi_driver = { 3063static struct ecard_driver acornscsi_driver = {
3065 .probe = acornscsi_probe, 3064 .probe = acornscsi_probe,
3066 .remove = __devexit_p(acornscsi_remove), 3065 .remove = acornscsi_remove,
3067 .id_table = acornscsi_cids, 3066 .id_table = acornscsi_cids,
3068 .drv = { 3067 .drv = {
3069 .name = "acornscsi", 3068 .name = "acornscsi",
diff --git a/drivers/scsi/arm/arxescsi.c b/drivers/scsi/arm/arxescsi.c
index 2a28b4ad1975..9274510294ac 100644
--- a/drivers/scsi/arm/arxescsi.c
+++ b/drivers/scsi/arm/arxescsi.c
@@ -276,8 +276,7 @@ static struct scsi_host_template arxescsi_template = {
276 .proc_name = "arxescsi", 276 .proc_name = "arxescsi",
277}; 277};
278 278
279static int __devinit 279static int arxescsi_probe(struct expansion_card *ec, const struct ecard_id *id)
280arxescsi_probe(struct expansion_card *ec, const struct ecard_id *id)
281{ 280{
282 struct Scsi_Host *host; 281 struct Scsi_Host *host;
283 struct arxescsi_info *info; 282 struct arxescsi_info *info;
@@ -340,7 +339,7 @@ arxescsi_probe(struct expansion_card *ec, const struct ecard_id *id)
340 return ret; 339 return ret;
341} 340}
342 341
343static void __devexit arxescsi_remove(struct expansion_card *ec) 342static void arxescsi_remove(struct expansion_card *ec)
344{ 343{
345 struct Scsi_Host *host = ecard_get_drvdata(ec); 344 struct Scsi_Host *host = ecard_get_drvdata(ec);
346 345
@@ -359,7 +358,7 @@ static const struct ecard_id arxescsi_cids[] = {
359 358
360static struct ecard_driver arxescsi_driver = { 359static struct ecard_driver arxescsi_driver = {
361 .probe = arxescsi_probe, 360 .probe = arxescsi_probe,
362 .remove = __devexit_p(arxescsi_remove), 361 .remove = arxescsi_remove,
363 .id_table = arxescsi_cids, 362 .id_table = arxescsi_cids,
364 .drv = { 363 .drv = {
365 .name = "arxescsi", 364 .name = "arxescsi",
diff --git a/drivers/scsi/arm/cumana_1.c b/drivers/scsi/arm/cumana_1.c
index c3b99c93637a..c93938b246d5 100644
--- a/drivers/scsi/arm/cumana_1.c
+++ b/drivers/scsi/arm/cumana_1.c
@@ -225,8 +225,8 @@ static struct scsi_host_template cumanascsi_template = {
225 .proc_name = "CumanaSCSI-1", 225 .proc_name = "CumanaSCSI-1",
226}; 226};
227 227
228static int __devinit 228static int cumanascsi1_probe(struct expansion_card *ec,
229cumanascsi1_probe(struct expansion_card *ec, const struct ecard_id *id) 229 const struct ecard_id *id)
230{ 230{
231 struct Scsi_Host *host; 231 struct Scsi_Host *host;
232 int ret; 232 int ret;
@@ -298,7 +298,7 @@ cumanascsi1_probe(struct expansion_card *ec, const struct ecard_id *id)
298 return ret; 298 return ret;
299} 299}
300 300
301static void __devexit cumanascsi1_remove(struct expansion_card *ec) 301static void cumanascsi1_remove(struct expansion_card *ec)
302{ 302{
303 struct Scsi_Host *host = ecard_get_drvdata(ec); 303 struct Scsi_Host *host = ecard_get_drvdata(ec);
304 304
@@ -320,7 +320,7 @@ static const struct ecard_id cumanascsi1_cids[] = {
320 320
321static struct ecard_driver cumanascsi1_driver = { 321static struct ecard_driver cumanascsi1_driver = {
322 .probe = cumanascsi1_probe, 322 .probe = cumanascsi1_probe,
323 .remove = __devexit_p(cumanascsi1_remove), 323 .remove = cumanascsi1_remove,
324 .id_table = cumanascsi1_cids, 324 .id_table = cumanascsi1_cids,
325 .drv = { 325 .drv = {
326 .name = "cumanascsi1", 326 .name = "cumanascsi1",
diff --git a/drivers/scsi/arm/cumana_2.c b/drivers/scsi/arm/cumana_2.c
index 547987b86384..e3bae93c3c22 100644
--- a/drivers/scsi/arm/cumana_2.c
+++ b/drivers/scsi/arm/cumana_2.c
@@ -397,8 +397,8 @@ static struct scsi_host_template cumanascsi2_template = {
397 .proc_name = "cumanascsi2", 397 .proc_name = "cumanascsi2",
398}; 398};
399 399
400static int __devinit 400static int cumanascsi2_probe(struct expansion_card *ec,
401cumanascsi2_probe(struct expansion_card *ec, const struct ecard_id *id) 401 const struct ecard_id *id)
402{ 402{
403 struct Scsi_Host *host; 403 struct Scsi_Host *host;
404 struct cumanascsi2_info *info; 404 struct cumanascsi2_info *info;
@@ -495,7 +495,7 @@ cumanascsi2_probe(struct expansion_card *ec, const struct ecard_id *id)
495 return ret; 495 return ret;
496} 496}
497 497
498static void __devexit cumanascsi2_remove(struct expansion_card *ec) 498static void cumanascsi2_remove(struct expansion_card *ec)
499{ 499{
500 struct Scsi_Host *host = ecard_get_drvdata(ec); 500 struct Scsi_Host *host = ecard_get_drvdata(ec);
501 struct cumanascsi2_info *info = (struct cumanascsi2_info *)host->hostdata; 501 struct cumanascsi2_info *info = (struct cumanascsi2_info *)host->hostdata;
@@ -519,7 +519,7 @@ static const struct ecard_id cumanascsi2_cids[] = {
519 519
520static struct ecard_driver cumanascsi2_driver = { 520static struct ecard_driver cumanascsi2_driver = {
521 .probe = cumanascsi2_probe, 521 .probe = cumanascsi2_probe,
522 .remove = __devexit_p(cumanascsi2_remove), 522 .remove = cumanascsi2_remove,
523 .id_table = cumanascsi2_cids, 523 .id_table = cumanascsi2_cids,
524 .drv = { 524 .drv = {
525 .name = "cumanascsi2", 525 .name = "cumanascsi2",
diff --git a/drivers/scsi/arm/eesox.c b/drivers/scsi/arm/eesox.c
index 968d08358d20..8e36908415ec 100644
--- a/drivers/scsi/arm/eesox.c
+++ b/drivers/scsi/arm/eesox.c
@@ -515,8 +515,7 @@ static struct scsi_host_template eesox_template = {
515 .proc_name = "eesox", 515 .proc_name = "eesox",
516}; 516};
517 517
518static int __devinit 518static int eesoxscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
519eesoxscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
520{ 519{
521 struct Scsi_Host *host; 520 struct Scsi_Host *host;
522 struct eesoxscsi_info *info; 521 struct eesoxscsi_info *info;
@@ -617,7 +616,7 @@ eesoxscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
617 return ret; 616 return ret;
618} 617}
619 618
620static void __devexit eesoxscsi_remove(struct expansion_card *ec) 619static void eesoxscsi_remove(struct expansion_card *ec)
621{ 620{
622 struct Scsi_Host *host = ecard_get_drvdata(ec); 621 struct Scsi_Host *host = ecard_get_drvdata(ec);
623 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata; 622 struct eesoxscsi_info *info = (struct eesoxscsi_info *)host->hostdata;
@@ -643,7 +642,7 @@ static const struct ecard_id eesoxscsi_cids[] = {
643 642
644static struct ecard_driver eesoxscsi_driver = { 643static struct ecard_driver eesoxscsi_driver = {
645 .probe = eesoxscsi_probe, 644 .probe = eesoxscsi_probe,
646 .remove = __devexit_p(eesoxscsi_remove), 645 .remove = eesoxscsi_remove,
647 .id_table = eesoxscsi_cids, 646 .id_table = eesoxscsi_cids,
648 .drv = { 647 .drv = {
649 .name = "eesoxscsi", 648 .name = "eesoxscsi",
diff --git a/drivers/scsi/arm/oak.c b/drivers/scsi/arm/oak.c
index fc6a5aabf66e..48facdc18002 100644
--- a/drivers/scsi/arm/oak.c
+++ b/drivers/scsi/arm/oak.c
@@ -129,8 +129,7 @@ static struct scsi_host_template oakscsi_template = {
129 .proc_name = "oakscsi", 129 .proc_name = "oakscsi",
130}; 130};
131 131
132static int __devinit 132static int oakscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
133oakscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
134{ 133{
135 struct Scsi_Host *host; 134 struct Scsi_Host *host;
136 int ret = -ENOMEM; 135 int ret = -ENOMEM;
@@ -182,7 +181,7 @@ oakscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
182 return ret; 181 return ret;
183} 182}
184 183
185static void __devexit oakscsi_remove(struct expansion_card *ec) 184static void oakscsi_remove(struct expansion_card *ec)
186{ 185{
187 struct Scsi_Host *host = ecard_get_drvdata(ec); 186 struct Scsi_Host *host = ecard_get_drvdata(ec);
188 187
@@ -202,7 +201,7 @@ static const struct ecard_id oakscsi_cids[] = {
202 201
203static struct ecard_driver oakscsi_driver = { 202static struct ecard_driver oakscsi_driver = {
204 .probe = oakscsi_probe, 203 .probe = oakscsi_probe,
205 .remove = __devexit_p(oakscsi_remove), 204 .remove = oakscsi_remove,
206 .id_table = oakscsi_cids, 205 .id_table = oakscsi_cids,
207 .drv = { 206 .drv = {
208 .name = "oakscsi", 207 .name = "oakscsi",
diff --git a/drivers/scsi/arm/powertec.c b/drivers/scsi/arm/powertec.c
index 9274c0677b9c..246600b93555 100644
--- a/drivers/scsi/arm/powertec.c
+++ b/drivers/scsi/arm/powertec.c
@@ -309,8 +309,8 @@ static struct scsi_host_template powertecscsi_template = {
309 .proc_name = "powertec", 309 .proc_name = "powertec",
310}; 310};
311 311
312static int __devinit 312static int powertecscsi_probe(struct expansion_card *ec,
313powertecscsi_probe(struct expansion_card *ec, const struct ecard_id *id) 313 const struct ecard_id *id)
314{ 314{
315 struct Scsi_Host *host; 315 struct Scsi_Host *host;
316 struct powertec_info *info; 316 struct powertec_info *info;
@@ -409,7 +409,7 @@ powertecscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
409 return ret; 409 return ret;
410} 410}
411 411
412static void __devexit powertecscsi_remove(struct expansion_card *ec) 412static void powertecscsi_remove(struct expansion_card *ec)
413{ 413{
414 struct Scsi_Host *host = ecard_get_drvdata(ec); 414 struct Scsi_Host *host = ecard_get_drvdata(ec);
415 struct powertec_info *info = (struct powertec_info *)host->hostdata; 415 struct powertec_info *info = (struct powertec_info *)host->hostdata;
@@ -435,7 +435,7 @@ static const struct ecard_id powertecscsi_cids[] = {
435 435
436static struct ecard_driver powertecscsi_driver = { 436static struct ecard_driver powertecscsi_driver = {
437 .probe = powertecscsi_probe, 437 .probe = powertecscsi_probe,
438 .remove = __devexit_p(powertecscsi_remove), 438 .remove = powertecscsi_remove,
439 .id_table = powertecscsi_cids, 439 .id_table = powertecscsi_cids,
440 .drv = { 440 .drv = {
441 .name = "powertecscsi", 441 .name = "powertecscsi",
diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c
index a540162ac59c..cfc73041f102 100644
--- a/drivers/scsi/atp870u.c
+++ b/drivers/scsi/atp870u.c
@@ -3210,7 +3210,7 @@ static struct pci_driver atp870u_driver = {
3210 .id_table = atp870u_id_table, 3210 .id_table = atp870u_id_table,
3211 .name = "atp870u", 3211 .name = "atp870u",
3212 .probe = atp870u_probe, 3212 .probe = atp870u_probe,
3213 .remove = __devexit_p(atp870u_remove), 3213 .remove = atp870u_remove,
3214}; 3214};
3215 3215
3216static int __init atp870u_init(void) 3216static int __init atp870u_init(void)
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 48d37dded8f1..4e2733d23003 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -4790,8 +4790,8 @@ beiscsi_hw_health_check(struct work_struct *work)
4790 msecs_to_jiffies(1000)); 4790 msecs_to_jiffies(1000));
4791} 4791}
4792 4792
4793static int __devinit beiscsi_dev_probe(struct pci_dev *pcidev, 4793static int beiscsi_dev_probe(struct pci_dev *pcidev,
4794 const struct pci_device_id *id) 4794 const struct pci_device_id *id)
4795{ 4795{
4796 struct beiscsi_hba *phba = NULL; 4796 struct beiscsi_hba *phba = NULL;
4797 struct hwi_controller *phwi_ctrlr; 4797 struct hwi_controller *phwi_ctrlr;
diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c
index 895b0e516e07..e6bf12675db8 100644
--- a/drivers/scsi/bfa/bfad.c
+++ b/drivers/scsi/bfa/bfad.c
@@ -1739,7 +1739,7 @@ static struct pci_driver bfad_pci_driver = {
1739 .name = BFAD_DRIVER_NAME, 1739 .name = BFAD_DRIVER_NAME,
1740 .id_table = bfad_id_table, 1740 .id_table = bfad_id_table,
1741 .probe = bfad_pci_probe, 1741 .probe = bfad_pci_probe,
1742 .remove = __devexit_p(bfad_pci_remove), 1742 .remove = bfad_pci_remove,
1743 .err_handler = &bfad_err_handler, 1743 .err_handler = &bfad_err_handler,
1744}; 1744};
1745 1745
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index e0558656c646..70ecd953a579 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -25,7 +25,7 @@ DEFINE_PER_CPU(struct bnx2fc_percpu_s, bnx2fc_percpu);
25#define DRV_MODULE_RELDATE "Jun 04, 2012" 25#define DRV_MODULE_RELDATE "Jun 04, 2012"
26 26
27 27
28static char version[] __devinitdata = 28static char version[] =
29 "Broadcom NetXtreme II FCoE Driver " DRV_MODULE_NAME \ 29 "Broadcom NetXtreme II FCoE Driver " DRV_MODULE_NAME \
30 " v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; 30 " v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
31 31
diff --git a/drivers/scsi/bnx2i/bnx2i_init.c b/drivers/scsi/bnx2i/bnx2i_init.c
index ee009e4ad097..50fef6963a81 100644
--- a/drivers/scsi/bnx2i/bnx2i_init.c
+++ b/drivers/scsi/bnx2i/bnx2i_init.c
@@ -21,7 +21,7 @@ static u32 adapter_count;
21#define DRV_MODULE_VERSION "2.7.2.2" 21#define DRV_MODULE_VERSION "2.7.2.2"
22#define DRV_MODULE_RELDATE "Apr 25, 2012" 22#define DRV_MODULE_RELDATE "Apr 25, 2012"
23 23
24static char version[] __devinitdata = 24static char version[] =
25 "Broadcom NetXtreme II iSCSI Driver " DRV_MODULE_NAME \ 25 "Broadcom NetXtreme II iSCSI Driver " DRV_MODULE_NAME \
26 " v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; 26 " v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
27 27
diff --git a/drivers/scsi/bvme6000_scsi.c b/drivers/scsi/bvme6000_scsi.c
index d40ea2f5be10..1e3f96adf9da 100644
--- a/drivers/scsi/bvme6000_scsi.c
+++ b/drivers/scsi/bvme6000_scsi.c
@@ -34,7 +34,7 @@ static struct scsi_host_template bvme6000_scsi_driver_template = {
34 34
35static struct platform_device *bvme6000_scsi_device; 35static struct platform_device *bvme6000_scsi_device;
36 36
37static __devinit int 37static int
38bvme6000_probe(struct platform_device *dev) 38bvme6000_probe(struct platform_device *dev)
39{ 39{
40 struct Scsi_Host *host; 40 struct Scsi_Host *host;
@@ -88,7 +88,7 @@ bvme6000_probe(struct platform_device *dev)
88 return -ENODEV; 88 return -ENODEV;
89} 89}
90 90
91static __devexit int 91static int
92bvme6000_device_remove(struct platform_device *dev) 92bvme6000_device_remove(struct platform_device *dev)
93{ 93{
94 struct Scsi_Host *host = platform_get_drvdata(dev); 94 struct Scsi_Host *host = platform_get_drvdata(dev);
@@ -108,7 +108,7 @@ static struct platform_driver bvme6000_scsi_driver = {
108 .owner = THIS_MODULE, 108 .owner = THIS_MODULE,
109 }, 109 },
110 .probe = bvme6000_probe, 110 .probe = bvme6000_probe,
111 .remove = __devexit_p(bvme6000_device_remove), 111 .remove = bvme6000_device_remove,
112}; 112};
113 113
114static int __init bvme6000_scsi_init(void) 114static int __init bvme6000_scsi_init(void)
diff --git a/drivers/scsi/csiostor/csio_init.c b/drivers/scsi/csiostor/csio_init.c
index fdd408ff80ad..b42cbbd3d92d 100644
--- a/drivers/scsi/csiostor/csio_init.c
+++ b/drivers/scsi/csiostor/csio_init.c
@@ -115,9 +115,8 @@ static const struct file_operations csio_mem_debugfs_fops = {
115 .llseek = default_llseek, 115 .llseek = default_llseek,
116}; 116};
117 117
118static void __devinit 118static void csio_add_debugfs_mem(struct csio_hw *hw, const char *name,
119csio_add_debugfs_mem(struct csio_hw *hw, const char *name, 119 unsigned int idx, unsigned int size_mb)
120 unsigned int idx, unsigned int size_mb)
121{ 120{
122 struct dentry *de; 121 struct dentry *de;
123 122
@@ -127,8 +126,7 @@ csio_add_debugfs_mem(struct csio_hw *hw, const char *name,
127 de->d_inode->i_size = size_mb << 20; 126 de->d_inode->i_size = size_mb << 20;
128} 127}
129 128
130static int __devinit 129static int csio_setup_debugfs(struct csio_hw *hw)
131csio_setup_debugfs(struct csio_hw *hw)
132{ 130{
133 int i; 131 int i;
134 132
@@ -531,8 +529,7 @@ csio_resource_free(struct csio_hw *hw)
531 * Allocates HW structure, DMA, memory resources, maps BARS to 529 * Allocates HW structure, DMA, memory resources, maps BARS to
532 * host memory and initializes HW module. 530 * host memory and initializes HW module.
533 */ 531 */
534static struct csio_hw * __devinit 532static struct csio_hw *csio_hw_alloc(struct pci_dev *pdev)
535csio_hw_alloc(struct pci_dev *pdev)
536{ 533{
537 struct csio_hw *hw; 534 struct csio_hw *hw;
538 535
@@ -956,8 +953,7 @@ csio_lnode_init_post(struct csio_lnode *ln)
956 * - Once hardware is ready, initiated scan of the host via 953 * - Once hardware is ready, initiated scan of the host via
957 * scsi_scan_host. 954 * scsi_scan_host.
958 */ 955 */
959static int __devinit 956static int csio_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
960csio_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
961{ 957{
962 int rv; 958 int rv;
963 int bars; 959 int bars;
@@ -1036,8 +1032,7 @@ err:
1036 * 1032 *
1037 * Used during hotplug operation. 1033 * Used during hotplug operation.
1038 */ 1034 */
1039static void __devexit 1035static void csio_remove_one(struct pci_dev *pdev)
1040csio_remove_one(struct pci_dev *pdev)
1041{ 1036{
1042 struct csio_hw *hw = pci_get_drvdata(pdev); 1037 struct csio_hw *hw = pci_get_drvdata(pdev);
1043 int bars = pci_select_bars(pdev, IORESOURCE_MEM); 1038 int bars = pci_select_bars(pdev, IORESOURCE_MEM);
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
index 13aeca3d51f2..865c64fa923c 100644
--- a/drivers/scsi/dc395x.c
+++ b/drivers/scsi/dc395x.c
@@ -489,7 +489,7 @@ struct ParameterData {
489 int def; /* default value */ 489 int def; /* default value */
490 int safe; /* safe value */ 490 int safe; /* safe value */
491}; 491};
492static struct ParameterData __devinitdata cfg_data[] = { 492static struct ParameterData cfg_data[] = {
493 { /* adapter id */ 493 { /* adapter id */
494 CFG_PARAM_UNSET, 494 CFG_PARAM_UNSET,
495 0, 495 0,
@@ -574,7 +574,7 @@ MODULE_PARM_DESC(reset_delay, "Reset delay in seconds. Default 1 (0-180)");
574 * set_safe_settings - if the use_safe_settings option is set then 574 * set_safe_settings - if the use_safe_settings option is set then
575 * set all values to the safe and slow values. 575 * set all values to the safe and slow values.
576 **/ 576 **/
577static void __devinit set_safe_settings(void) 577static void set_safe_settings(void)
578{ 578{
579 if (use_safe_settings) 579 if (use_safe_settings)
580 { 580 {
@@ -593,7 +593,7 @@ static void __devinit set_safe_settings(void)
593 * fix_settings - reset any boot parameters which are out of range 593 * fix_settings - reset any boot parameters which are out of range
594 * back to the default values. 594 * back to the default values.
595 **/ 595 **/
596static void __devinit fix_settings(void) 596static void fix_settings(void)
597{ 597{
598 int i; 598 int i;
599 599
@@ -620,7 +620,7 @@ static void __devinit fix_settings(void)
620 * Mapping from the eeprom delay index value (index into this array) 620 * Mapping from the eeprom delay index value (index into this array)
621 * to the number of actual seconds that the delay should be for. 621 * to the number of actual seconds that the delay should be for.
622 */ 622 */
623static char __devinitdata eeprom_index_to_delay_map[] = 623static char eeprom_index_to_delay_map[] =
624 { 1, 3, 5, 10, 16, 30, 60, 120 }; 624 { 1, 3, 5, 10, 16, 30, 60, 120 };
625 625
626 626
@@ -630,7 +630,7 @@ static char __devinitdata eeprom_index_to_delay_map[] =
630 * 630 *
631 * @eeprom: The eeprom structure in which we find the delay index to map. 631 * @eeprom: The eeprom structure in which we find the delay index to map.
632 **/ 632 **/
633static void __devinit eeprom_index_to_delay(struct NvRamType *eeprom) 633static void eeprom_index_to_delay(struct NvRamType *eeprom)
634{ 634{
635 eeprom->delay_time = eeprom_index_to_delay_map[eeprom->delay_time]; 635 eeprom->delay_time = eeprom_index_to_delay_map[eeprom->delay_time];
636} 636}
@@ -643,7 +643,7 @@ static void __devinit eeprom_index_to_delay(struct NvRamType *eeprom)
643 * 643 *
644 * @delay: The delay, in seconds, to find the eeprom index for. 644 * @delay: The delay, in seconds, to find the eeprom index for.
645 **/ 645 **/
646static int __devinit delay_to_eeprom_index(int delay) 646static int delay_to_eeprom_index(int delay)
647{ 647{
648 u8 idx = 0; 648 u8 idx = 0;
649 while (idx < 7 && eeprom_index_to_delay_map[idx] < delay) 649 while (idx < 7 && eeprom_index_to_delay_map[idx] < delay)
@@ -659,7 +659,7 @@ static int __devinit delay_to_eeprom_index(int delay)
659 * 659 *
660 * @eeprom: The eeprom data to override with command line options. 660 * @eeprom: The eeprom data to override with command line options.
661 **/ 661 **/
662static void __devinit eeprom_override(struct NvRamType *eeprom) 662static void eeprom_override(struct NvRamType *eeprom)
663{ 663{
664 u8 id; 664 u8 id;
665 665
@@ -3938,7 +3938,7 @@ static void dc395x_slave_destroy(struct scsi_device *scsi_device)
3938 * 3938 *
3939 * @io_port: base I/O address 3939 * @io_port: base I/O address
3940 **/ 3940 **/
3941static void __devinit trms1040_wait_30us(unsigned long io_port) 3941static void trms1040_wait_30us(unsigned long io_port)
3942{ 3942{
3943 /* ScsiPortStallExecution(30); wait 30 us */ 3943 /* ScsiPortStallExecution(30); wait 30 us */
3944 outb(5, io_port + TRM_S1040_GEN_TIMER); 3944 outb(5, io_port + TRM_S1040_GEN_TIMER);
@@ -3955,7 +3955,7 @@ static void __devinit trms1040_wait_30us(unsigned long io_port)
3955 * @cmd: SB + op code (command) to send 3955 * @cmd: SB + op code (command) to send
3956 * @addr: address to send 3956 * @addr: address to send
3957 **/ 3957 **/
3958static void __devinit trms1040_write_cmd(unsigned long io_port, u8 cmd, u8 addr) 3958static void trms1040_write_cmd(unsigned long io_port, u8 cmd, u8 addr)
3959{ 3959{
3960 int i; 3960 int i;
3961 u8 send_data; 3961 u8 send_data;
@@ -4000,7 +4000,7 @@ static void __devinit trms1040_write_cmd(unsigned long io_port, u8 cmd, u8 addr)
4000 * @addr: offset into EEPROM 4000 * @addr: offset into EEPROM
4001 * @byte: bytes to write 4001 * @byte: bytes to write
4002 **/ 4002 **/
4003static void __devinit trms1040_set_data(unsigned long io_port, u8 addr, u8 byte) 4003static void trms1040_set_data(unsigned long io_port, u8 addr, u8 byte)
4004{ 4004{
4005 int i; 4005 int i;
4006 u8 send_data; 4006 u8 send_data;
@@ -4054,7 +4054,7 @@ static void __devinit trms1040_set_data(unsigned long io_port, u8 addr, u8 byte)
4054 * @eeprom: the data to write 4054 * @eeprom: the data to write
4055 * @io_port: the base io port 4055 * @io_port: the base io port
4056 **/ 4056 **/
4057static void __devinit trms1040_write_all(struct NvRamType *eeprom, unsigned long io_port) 4057static void trms1040_write_all(struct NvRamType *eeprom, unsigned long io_port)
4058{ 4058{
4059 u8 *b_eeprom = (u8 *)eeprom; 4059 u8 *b_eeprom = (u8 *)eeprom;
4060 u8 addr; 4060 u8 addr;
@@ -4094,7 +4094,7 @@ static void __devinit trms1040_write_all(struct NvRamType *eeprom, unsigned long
4094 * 4094 *
4095 * Returns the byte read. 4095 * Returns the byte read.
4096 **/ 4096 **/
4097static u8 __devinit trms1040_get_data(unsigned long io_port, u8 addr) 4097static u8 trms1040_get_data(unsigned long io_port, u8 addr)
4098{ 4098{
4099 int i; 4099 int i;
4100 u8 read_byte; 4100 u8 read_byte;
@@ -4132,7 +4132,7 @@ static u8 __devinit trms1040_get_data(unsigned long io_port, u8 addr)
4132 * @eeprom: where to store the data 4132 * @eeprom: where to store the data
4133 * @io_port: the base io port 4133 * @io_port: the base io port
4134 **/ 4134 **/
4135static void __devinit trms1040_read_all(struct NvRamType *eeprom, unsigned long io_port) 4135static void trms1040_read_all(struct NvRamType *eeprom, unsigned long io_port)
4136{ 4136{
4137 u8 *b_eeprom = (u8 *)eeprom; 4137 u8 *b_eeprom = (u8 *)eeprom;
4138 u8 addr; 4138 u8 addr;
@@ -4162,7 +4162,7 @@ static void __devinit trms1040_read_all(struct NvRamType *eeprom, unsigned long
4162 * @eeprom: caller allocated strcuture to read the eeprom data into 4162 * @eeprom: caller allocated strcuture to read the eeprom data into
4163 * @io_port: io port to read from 4163 * @io_port: io port to read from
4164 **/ 4164 **/
4165static void __devinit check_eeprom(struct NvRamType *eeprom, unsigned long io_port) 4165static void check_eeprom(struct NvRamType *eeprom, unsigned long io_port)
4166{ 4166{
4167 u16 *w_eeprom = (u16 *)eeprom; 4167 u16 *w_eeprom = (u16 *)eeprom;
4168 u16 w_addr; 4168 u16 w_addr;
@@ -4232,7 +4232,7 @@ static void __devinit check_eeprom(struct NvRamType *eeprom, unsigned long io_po
4232 * 4232 *
4233 * @eeprom: The eeprom data strucutre to show details for. 4233 * @eeprom: The eeprom data strucutre to show details for.
4234 **/ 4234 **/
4235static void __devinit print_eeprom_settings(struct NvRamType *eeprom) 4235static void print_eeprom_settings(struct NvRamType *eeprom)
4236{ 4236{
4237 dprintkl(KERN_INFO, "Used settings: AdapterID=%02i, Speed=%i(%02i.%01iMHz), dev_mode=0x%02x\n", 4237 dprintkl(KERN_INFO, "Used settings: AdapterID=%02i, Speed=%i(%02i.%01iMHz), dev_mode=0x%02x\n",
4238 eeprom->scsi_id, 4238 eeprom->scsi_id,
@@ -4260,7 +4260,7 @@ static void adapter_sg_tables_free(struct AdapterCtlBlk *acb)
4260/* 4260/*
4261 * Allocate SG tables; as we have to pci_map them, an SG list (struct SGentry*) 4261 * Allocate SG tables; as we have to pci_map them, an SG list (struct SGentry*)
4262 * should never cross a page boundary */ 4262 * should never cross a page boundary */
4263static int __devinit adapter_sg_tables_alloc(struct AdapterCtlBlk *acb) 4263static int adapter_sg_tables_alloc(struct AdapterCtlBlk *acb)
4264{ 4264{
4265 const unsigned mem_needed = (DC395x_MAX_SRB_CNT+1) 4265 const unsigned mem_needed = (DC395x_MAX_SRB_CNT+1)
4266 *SEGMENTX_LEN; 4266 *SEGMENTX_LEN;
@@ -4306,7 +4306,7 @@ static int __devinit adapter_sg_tables_alloc(struct AdapterCtlBlk *acb)
4306 * 4306 *
4307 * @acb: The adapter to print the information for. 4307 * @acb: The adapter to print the information for.
4308 **/ 4308 **/
4309static void __devinit adapter_print_config(struct AdapterCtlBlk *acb) 4309static void adapter_print_config(struct AdapterCtlBlk *acb)
4310{ 4310{
4311 u8 bval; 4311 u8 bval;
4312 4312
@@ -4350,7 +4350,7 @@ static void __devinit adapter_print_config(struct AdapterCtlBlk *acb)
4350 * 4350 *
4351 * @acb: The adapter to initialize. 4351 * @acb: The adapter to initialize.
4352 **/ 4352 **/
4353static void __devinit adapter_init_params(struct AdapterCtlBlk *acb) 4353static void adapter_init_params(struct AdapterCtlBlk *acb)
4354{ 4354{
4355 struct NvRamType *eeprom = &acb->eeprom; 4355 struct NvRamType *eeprom = &acb->eeprom;
4356 int i; 4356 int i;
@@ -4412,7 +4412,7 @@ static void __devinit adapter_init_params(struct AdapterCtlBlk *acb)
4412 * 4412 *
4413 * @host: The scsi host instance to fill in the values for. 4413 * @host: The scsi host instance to fill in the values for.
4414 **/ 4414 **/
4415static void __devinit adapter_init_scsi_host(struct Scsi_Host *host) 4415static void adapter_init_scsi_host(struct Scsi_Host *host)
4416{ 4416{
4417 struct AdapterCtlBlk *acb = (struct AdapterCtlBlk *)host->hostdata; 4417 struct AdapterCtlBlk *acb = (struct AdapterCtlBlk *)host->hostdata;
4418 struct NvRamType *eeprom = &acb->eeprom; 4418 struct NvRamType *eeprom = &acb->eeprom;
@@ -4453,7 +4453,7 @@ static void __devinit adapter_init_scsi_host(struct Scsi_Host *host)
4453 * 4453 *
4454 * @acb: The adapter which we are to init. 4454 * @acb: The adapter which we are to init.
4455 **/ 4455 **/
4456static void __devinit adapter_init_chip(struct AdapterCtlBlk *acb) 4456static void adapter_init_chip(struct AdapterCtlBlk *acb)
4457{ 4457{
4458 struct NvRamType *eeprom = &acb->eeprom; 4458 struct NvRamType *eeprom = &acb->eeprom;
4459 4459
@@ -4506,8 +4506,8 @@ static void __devinit adapter_init_chip(struct AdapterCtlBlk *acb)
4506 * Returns 0 if the initialization succeeds, any other value on 4506 * Returns 0 if the initialization succeeds, any other value on
4507 * failure. 4507 * failure.
4508 **/ 4508 **/
4509static int __devinit adapter_init(struct AdapterCtlBlk *acb, 4509static int adapter_init(struct AdapterCtlBlk *acb, unsigned long io_port,
4510 unsigned long io_port, u32 io_port_len, unsigned int irq) 4510 u32 io_port_len, unsigned int irq)
4511{ 4511{
4512 if (!request_region(io_port, io_port_len, DC395X_NAME)) { 4512 if (!request_region(io_port, io_port_len, DC395X_NAME)) {
4513 dprintkl(KERN_ERR, "Failed to reserve IO region 0x%lx\n", io_port); 4513 dprintkl(KERN_ERR, "Failed to reserve IO region 0x%lx\n", io_port);
@@ -4794,8 +4794,7 @@ static void banner_display(void)
4794 * 4794 *
4795 * Returns 0 on success, or an error code (-ve) on failure. 4795 * Returns 0 on success, or an error code (-ve) on failure.
4796 **/ 4796 **/
4797static int __devinit dc395x_init_one(struct pci_dev *dev, 4797static int dc395x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
4798 const struct pci_device_id *id)
4799{ 4798{
4800 struct Scsi_Host *scsi_host = NULL; 4799 struct Scsi_Host *scsi_host = NULL;
4801 struct AdapterCtlBlk *acb = NULL; 4800 struct AdapterCtlBlk *acb = NULL;
@@ -4861,7 +4860,7 @@ fail:
4861 * 4860 *
4862 * @dev: The PCI device to initialize. 4861 * @dev: The PCI device to initialize.
4863 **/ 4862 **/
4864static void __devexit dc395x_remove_one(struct pci_dev *dev) 4863static void dc395x_remove_one(struct pci_dev *dev)
4865{ 4864{
4866 struct Scsi_Host *scsi_host = pci_get_drvdata(dev); 4865 struct Scsi_Host *scsi_host = pci_get_drvdata(dev);
4867 struct AdapterCtlBlk *acb = (struct AdapterCtlBlk *)(scsi_host->hostdata); 4866 struct AdapterCtlBlk *acb = (struct AdapterCtlBlk *)(scsi_host->hostdata);
@@ -4892,7 +4891,7 @@ static struct pci_driver dc395x_driver = {
4892 .name = DC395X_NAME, 4891 .name = DC395X_NAME,
4893 .id_table = dc395x_pci_table, 4892 .id_table = dc395x_pci_table,
4894 .probe = dc395x_init_one, 4893 .probe = dc395x_init_one,
4895 .remove = __devexit_p(dc395x_remove_one), 4894 .remove = dc395x_remove_one,
4896}; 4895};
4897 4896
4898 4897
diff --git a/drivers/scsi/dmx3191d.c b/drivers/scsi/dmx3191d.c
index 207352cc70cc..4b0dd8c56707 100644
--- a/drivers/scsi/dmx3191d.c
+++ b/drivers/scsi/dmx3191d.c
@@ -68,8 +68,8 @@ static struct scsi_host_template dmx3191d_driver_template = {
68 .use_clustering = DISABLE_CLUSTERING, 68 .use_clustering = DISABLE_CLUSTERING,
69}; 69};
70 70
71static int __devinit dmx3191d_probe_one(struct pci_dev *pdev, 71static int dmx3191d_probe_one(struct pci_dev *pdev,
72 const struct pci_device_id *id) 72 const struct pci_device_id *id)
73{ 73{
74 struct Scsi_Host *shost; 74 struct Scsi_Host *shost;
75 unsigned long io; 75 unsigned long io;
@@ -123,7 +123,7 @@ static int __devinit dmx3191d_probe_one(struct pci_dev *pdev,
123 return error; 123 return error;
124} 124}
125 125
126static void __devexit dmx3191d_remove_one(struct pci_dev *pdev) 126static void dmx3191d_remove_one(struct pci_dev *pdev)
127{ 127{
128 struct Scsi_Host *shost = pci_get_drvdata(pdev); 128 struct Scsi_Host *shost = pci_get_drvdata(pdev);
129 129
@@ -150,7 +150,7 @@ static struct pci_driver dmx3191d_pci_driver = {
150 .name = DMX3191D_DRIVER_NAME, 150 .name = DMX3191D_DRIVER_NAME,
151 .id_table = dmx3191d_pci_tbl, 151 .id_table = dmx3191d_pci_tbl,
152 .probe = dmx3191d_probe_one, 152 .probe = dmx3191d_probe_one,
153 .remove = __devexit_p(dmx3191d_remove_one), 153 .remove = dmx3191d_remove_one,
154}; 154};
155 155
156static int __init dmx3191d_init(void) 156static int __init dmx3191d_init(void)
diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c
index 1a2a1e5824e3..fff682976c56 100644
--- a/drivers/scsi/fdomain.c
+++ b/drivers/scsi/fdomain.c
@@ -1771,7 +1771,7 @@ struct scsi_host_template fdomain_driver_template = {
1771#ifndef PCMCIA 1771#ifndef PCMCIA
1772#ifdef CONFIG_PCI 1772#ifdef CONFIG_PCI
1773 1773
1774static struct pci_device_id fdomain_pci_tbl[] __devinitdata = { 1774static struct pci_device_id fdomain_pci_tbl[] = {
1775 { PCI_VENDOR_ID_FD, PCI_DEVICE_ID_FD_36C70, 1775 { PCI_VENDOR_ID_FD, PCI_DEVICE_ID_FD_36C70,
1776 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, 1776 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
1777 { } 1777 { }
diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
index fc98eb61e760..fbf3ac6e0c55 100644
--- a/drivers/scsi/fnic/fnic_main.c
+++ b/drivers/scsi/fnic/fnic_main.c
@@ -399,8 +399,7 @@ static u8 *fnic_get_mac(struct fc_lport *lport)
399 return fnic->data_src_addr; 399 return fnic->data_src_addr;
400} 400}
401 401
402static int __devinit fnic_probe(struct pci_dev *pdev, 402static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
403 const struct pci_device_id *ent)
404{ 403{
405 struct Scsi_Host *host; 404 struct Scsi_Host *host;
406 struct fc_lport *lp; 405 struct fc_lport *lp;
@@ -774,7 +773,7 @@ err_out:
774 return err; 773 return err;
775} 774}
776 775
777static void __devexit fnic_remove(struct pci_dev *pdev) 776static void fnic_remove(struct pci_dev *pdev)
778{ 777{
779 struct fnic *fnic = pci_get_drvdata(pdev); 778 struct fnic *fnic = pci_get_drvdata(pdev);
780 struct fc_lport *lp = fnic->lport; 779 struct fc_lport *lp = fnic->lport;
@@ -849,7 +848,7 @@ static struct pci_driver fnic_driver = {
849 .name = DRV_NAME, 848 .name = DRV_NAME,
850 .id_table = fnic_id_table, 849 .id_table = fnic_id_table,
851 .probe = fnic_probe, 850 .probe = fnic_probe,
852 .remove = __devexit_p(fnic_remove), 851 .remove = fnic_remove,
853}; 852};
854 853
855static int __init fnic_init_module(void) 854static int __init fnic_init_module(void)
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index 1a5954f0915a..5041f925c191 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -939,7 +939,7 @@ module_param(dtc_3181e, int, 0);
939MODULE_LICENSE("GPL"); 939MODULE_LICENSE("GPL");
940 940
941#ifndef SCSI_G_NCR5380_MEM 941#ifndef SCSI_G_NCR5380_MEM
942static struct isapnp_device_id id_table[] __devinitdata = { 942static struct isapnp_device_id id_table[] = {
943 { 943 {
944 ISAPNP_ANY_ID, ISAPNP_ANY_ID, 944 ISAPNP_ANY_ID, ISAPNP_ANY_ID,
945 ISAPNP_VENDOR('D', 'T', 'C'), ISAPNP_FUNCTION(0x436e), 945 ISAPNP_VENDOR('D', 'T', 'C'), ISAPNP_FUNCTION(0x436e),
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 5d72274c507f..599790e41a98 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -590,7 +590,7 @@ static struct pci_driver gdth_pci_driver = {
590 .remove = gdth_pci_remove_one, 590 .remove = gdth_pci_remove_one,
591}; 591};
592 592
593static void __devexit gdth_pci_remove_one(struct pci_dev *pdev) 593static void gdth_pci_remove_one(struct pci_dev *pdev)
594{ 594{
595 gdth_ha_str *ha = pci_get_drvdata(pdev); 595 gdth_ha_str *ha = pci_get_drvdata(pdev);
596 596
@@ -602,8 +602,8 @@ static void __devexit gdth_pci_remove_one(struct pci_dev *pdev)
602 pci_disable_device(pdev); 602 pci_disable_device(pdev);
603} 603}
604 604
605static int __devinit gdth_pci_init_one(struct pci_dev *pdev, 605static int gdth_pci_init_one(struct pci_dev *pdev,
606 const struct pci_device_id *ent) 606 const struct pci_device_id *ent)
607{ 607{
608 u16 vendor = pdev->vendor; 608 u16 vendor = pdev->vendor;
609 u16 device = pdev->device; 609 u16 device = pdev->device;
@@ -855,8 +855,8 @@ static int __init gdth_init_isa(u32 bios_adr,gdth_ha_str *ha)
855#endif /* CONFIG_ISA */ 855#endif /* CONFIG_ISA */
856 856
857#ifdef CONFIG_PCI 857#ifdef CONFIG_PCI
858static int __devinit gdth_init_pci(struct pci_dev *pdev, gdth_pci_str *pcistr, 858static int gdth_init_pci(struct pci_dev *pdev, gdth_pci_str *pcistr,
859 gdth_ha_str *ha) 859 gdth_ha_str *ha)
860{ 860{
861 register gdt6_dpram_str __iomem *dp6_ptr; 861 register gdt6_dpram_str __iomem *dp6_ptr;
862 register gdt6c_dpram_str __iomem *dp6c_ptr; 862 register gdt6c_dpram_str __iomem *dp6c_ptr;
@@ -1239,7 +1239,7 @@ static int __devinit gdth_init_pci(struct pci_dev *pdev, gdth_pci_str *pcistr,
1239 1239
1240/* controller protocol functions */ 1240/* controller protocol functions */
1241 1241
1242static void __devinit gdth_enable_int(gdth_ha_str *ha) 1242static void gdth_enable_int(gdth_ha_str *ha)
1243{ 1243{
1244 unsigned long flags; 1244 unsigned long flags;
1245 gdt2_dpram_str __iomem *dp2_ptr; 1245 gdt2_dpram_str __iomem *dp2_ptr;
@@ -1555,7 +1555,7 @@ static int gdth_internal_cmd(gdth_ha_str *ha, u8 service, u16 opcode,
1555 1555
1556/* search for devices */ 1556/* search for devices */
1557 1557
1558static int __devinit gdth_search_drives(gdth_ha_str *ha) 1558static int gdth_search_drives(gdth_ha_str *ha)
1559{ 1559{
1560 u16 cdev_cnt, i; 1560 u16 cdev_cnt, i;
1561 int ok; 1561 int ok;
@@ -4959,8 +4959,7 @@ static int __init gdth_eisa_probe_one(u16 eisa_slot)
4959#endif /* CONFIG_EISA */ 4959#endif /* CONFIG_EISA */
4960 4960
4961#ifdef CONFIG_PCI 4961#ifdef CONFIG_PCI
4962static int __devinit gdth_pci_probe_one(gdth_pci_str *pcistr, 4962static int gdth_pci_probe_one(gdth_pci_str *pcistr, gdth_ha_str **ha_out)
4963 gdth_ha_str **ha_out)
4964{ 4963{
4965 struct Scsi_Host *shp; 4964 struct Scsi_Host *shp;
4966 gdth_ha_str *ha; 4965 gdth_ha_str *ha;
diff --git a/drivers/scsi/gvp11.c b/drivers/scsi/gvp11.c
index 488fbc648656..dbe4cc6b9f8b 100644
--- a/drivers/scsi/gvp11.c
+++ b/drivers/scsi/gvp11.c
@@ -204,7 +204,7 @@ static struct scsi_host_template gvp11_scsi_template = {
204 .use_clustering = DISABLE_CLUSTERING 204 .use_clustering = DISABLE_CLUSTERING
205}; 205};
206 206
207static int __devinit check_wd33c93(struct gvp11_scsiregs *regs) 207static int check_wd33c93(struct gvp11_scsiregs *regs)
208{ 208{
209#ifdef CHECK_WD33C93 209#ifdef CHECK_WD33C93
210 volatile unsigned char *sasr_3393, *scmd_3393; 210 volatile unsigned char *sasr_3393, *scmd_3393;
@@ -284,8 +284,7 @@ static int __devinit check_wd33c93(struct gvp11_scsiregs *regs)
284 return 0; 284 return 0;
285} 285}
286 286
287static int __devinit gvp11_probe(struct zorro_dev *z, 287static int gvp11_probe(struct zorro_dev *z, const struct zorro_device_id *ent)
288 const struct zorro_device_id *ent)
289{ 288{
290 struct Scsi_Host *instance; 289 struct Scsi_Host *instance;
291 unsigned long address; 290 unsigned long address;
@@ -380,7 +379,7 @@ fail_check_or_alloc:
380 return error; 379 return error;
381} 380}
382 381
383static void __devexit gvp11_remove(struct zorro_dev *z) 382static void gvp11_remove(struct zorro_dev *z)
384{ 383{
385 struct Scsi_Host *instance = zorro_get_drvdata(z); 384 struct Scsi_Host *instance = zorro_get_drvdata(z);
386 struct gvp11_hostdata *hdata = shost_priv(instance); 385 struct gvp11_hostdata *hdata = shost_priv(instance);
@@ -398,7 +397,7 @@ static void __devexit gvp11_remove(struct zorro_dev *z)
398 * SERIES I though). 397 * SERIES I though).
399 */ 398 */
400 399
401static struct zorro_device_id gvp11_zorro_tbl[] __devinitdata = { 400static struct zorro_device_id gvp11_zorro_tbl[] = {
402 { ZORRO_PROD_GVP_COMBO_030_R3_SCSI, ~0x00ffffff }, 401 { ZORRO_PROD_GVP_COMBO_030_R3_SCSI, ~0x00ffffff },
403 { ZORRO_PROD_GVP_SERIES_II, ~0x00ffffff }, 402 { ZORRO_PROD_GVP_SERIES_II, ~0x00ffffff },
404 { ZORRO_PROD_GVP_GFORCE_030_SCSI, ~0x01ffffff }, 403 { ZORRO_PROD_GVP_GFORCE_030_SCSI, ~0x01ffffff },
@@ -414,7 +413,7 @@ static struct zorro_driver gvp11_driver = {
414 .name = "gvp11", 413 .name = "gvp11",
415 .id_table = gvp11_zorro_tbl, 414 .id_table = gvp11_zorro_tbl,
416 .probe = gvp11_probe, 415 .probe = gvp11_probe,
417 .remove = __devexit_p(gvp11_remove), 416 .remove = gvp11_remove,
418}; 417};
419 418
420static int __init gvp11_init(void) 419static int __init gvp11_init(void)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 4217e49aea46..4f338061b5c3 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -189,16 +189,16 @@ static void check_ioctl_unit_attention(struct ctlr_info *h,
189/* performant mode helper functions */ 189/* performant mode helper functions */
190static void calc_bucket_map(int *bucket, int num_buckets, 190static void calc_bucket_map(int *bucket, int num_buckets,
191 int nsgs, int *bucket_map); 191 int nsgs, int *bucket_map);
192static __devinit void hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h); 192static void hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h);
193static inline u32 next_command(struct ctlr_info *h, u8 q); 193static inline u32 next_command(struct ctlr_info *h, u8 q);
194static int __devinit hpsa_find_cfg_addrs(struct pci_dev *pdev, 194static int hpsa_find_cfg_addrs(struct pci_dev *pdev, void __iomem *vaddr,
195 void __iomem *vaddr, u32 *cfg_base_addr, u64 *cfg_base_addr_index, 195 u32 *cfg_base_addr, u64 *cfg_base_addr_index,
196 u64 *cfg_offset); 196 u64 *cfg_offset);
197static int __devinit hpsa_pci_find_memory_BAR(struct pci_dev *pdev, 197static int hpsa_pci_find_memory_BAR(struct pci_dev *pdev,
198 unsigned long *memory_bar); 198 unsigned long *memory_bar);
199static int __devinit hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id); 199static int hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id);
200static int __devinit hpsa_wait_for_board_state(struct pci_dev *pdev, 200static int hpsa_wait_for_board_state(struct pci_dev *pdev, void __iomem *vaddr,
201 void __iomem *vaddr, int wait_for_ready); 201 int wait_for_ready);
202static inline void finish_cmd(struct CommandList *c); 202static inline void finish_cmd(struct CommandList *c);
203#define BOARD_NOT_READY 0 203#define BOARD_NOT_READY 0
204#define BOARD_READY 1 204#define BOARD_READY 1
@@ -3182,8 +3182,8 @@ static int hpsa_ioctl(struct scsi_device *dev, int cmd, void *arg)
3182 } 3182 }
3183} 3183}
3184 3184
3185static int __devinit hpsa_send_host_reset(struct ctlr_info *h, 3185static int hpsa_send_host_reset(struct ctlr_info *h, unsigned char *scsi3addr,
3186 unsigned char *scsi3addr, u8 reset_type) 3186 u8 reset_type)
3187{ 3187{
3188 struct CommandList *c; 3188 struct CommandList *c;
3189 3189
@@ -3606,8 +3606,8 @@ static irqreturn_t do_hpsa_intr_msi(int irq, void *queue)
3606 * in simple mode, not performant mode due to the tag lookup. 3606 * in simple mode, not performant mode due to the tag lookup.
3607 * We only ever use this immediately after a controller reset. 3607 * We only ever use this immediately after a controller reset.
3608 */ 3608 */
3609static __devinit int hpsa_message(struct pci_dev *pdev, unsigned char opcode, 3609static int hpsa_message(struct pci_dev *pdev, unsigned char opcode,
3610 unsigned char type) 3610 unsigned char type)
3611{ 3611{
3612 struct Command { 3612 struct Command {
3613 struct CommandListHeader CommandHeader; 3613 struct CommandListHeader CommandHeader;
@@ -3756,14 +3756,13 @@ static int hpsa_controller_hard_reset(struct pci_dev *pdev,
3756 return 0; 3756 return 0;
3757} 3757}
3758 3758
3759static __devinit void init_driver_version(char *driver_version, int len) 3759static void init_driver_version(char *driver_version, int len)
3760{ 3760{
3761 memset(driver_version, 0, len); 3761 memset(driver_version, 0, len);
3762 strncpy(driver_version, HPSA " " HPSA_DRIVER_VERSION, len - 1); 3762 strncpy(driver_version, HPSA " " HPSA_DRIVER_VERSION, len - 1);
3763} 3763}
3764 3764
3765static __devinit int write_driver_ver_to_cfgtable( 3765static int write_driver_ver_to_cfgtable(struct CfgTable __iomem *cfgtable)
3766 struct CfgTable __iomem *cfgtable)
3767{ 3766{
3768 char *driver_version; 3767 char *driver_version;
3769 int i, size = sizeof(cfgtable->driver_version); 3768 int i, size = sizeof(cfgtable->driver_version);
@@ -3779,8 +3778,8 @@ static __devinit int write_driver_ver_to_cfgtable(
3779 return 0; 3778 return 0;
3780} 3779}
3781 3780
3782static __devinit void read_driver_ver_from_cfgtable( 3781static void read_driver_ver_from_cfgtable(struct CfgTable __iomem *cfgtable,
3783 struct CfgTable __iomem *cfgtable, unsigned char *driver_ver) 3782 unsigned char *driver_ver)
3784{ 3783{
3785 int i; 3784 int i;
3786 3785
@@ -3788,8 +3787,7 @@ static __devinit void read_driver_ver_from_cfgtable(
3788 driver_ver[i] = readb(&cfgtable->driver_version[i]); 3787 driver_ver[i] = readb(&cfgtable->driver_version[i]);
3789} 3788}
3790 3789
3791static __devinit int controller_reset_failed( 3790static int controller_reset_failed(struct CfgTable __iomem *cfgtable)
3792 struct CfgTable __iomem *cfgtable)
3793{ 3791{
3794 3792
3795 char *driver_ver, *old_driver_ver; 3793 char *driver_ver, *old_driver_ver;
@@ -3812,7 +3810,7 @@ static __devinit int controller_reset_failed(
3812/* This does a hard reset of the controller using PCI power management 3810/* This does a hard reset of the controller using PCI power management
3813 * states or the using the doorbell register. 3811 * states or the using the doorbell register.
3814 */ 3812 */
3815static __devinit int hpsa_kdump_hard_reset_controller(struct pci_dev *pdev) 3813static int hpsa_kdump_hard_reset_controller(struct pci_dev *pdev)
3816{ 3814{
3817 u64 cfg_offset; 3815 u64 cfg_offset;
3818 u32 cfg_base_addr; 3816 u32 cfg_base_addr;
@@ -4029,7 +4027,7 @@ static int find_PCI_BAR_index(struct pci_dev *pdev, unsigned long pci_bar_addr)
4029 * controllers that are capable. If not, we use IO-APIC mode. 4027 * controllers that are capable. If not, we use IO-APIC mode.
4030 */ 4028 */
4031 4029
4032static void __devinit hpsa_interrupt_mode(struct ctlr_info *h) 4030static void hpsa_interrupt_mode(struct ctlr_info *h)
4033{ 4031{
4034#ifdef CONFIG_PCI_MSI 4032#ifdef CONFIG_PCI_MSI
4035 int err, i; 4033 int err, i;
@@ -4077,7 +4075,7 @@ default_int_mode:
4077 h->intr[h->intr_mode] = h->pdev->irq; 4075 h->intr[h->intr_mode] = h->pdev->irq;
4078} 4076}
4079 4077
4080static int __devinit hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id) 4078static int hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id)
4081{ 4079{
4082 int i; 4080 int i;
4083 u32 subsystem_vendor_id, subsystem_device_id; 4081 u32 subsystem_vendor_id, subsystem_device_id;
@@ -4101,8 +4099,8 @@ static int __devinit hpsa_lookup_board_id(struct pci_dev *pdev, u32 *board_id)
4101 return ARRAY_SIZE(products) - 1; /* generic unknown smart array */ 4099 return ARRAY_SIZE(products) - 1; /* generic unknown smart array */
4102} 4100}
4103 4101
4104static int __devinit hpsa_pci_find_memory_BAR(struct pci_dev *pdev, 4102static int hpsa_pci_find_memory_BAR(struct pci_dev *pdev,
4105 unsigned long *memory_bar) 4103 unsigned long *memory_bar)
4106{ 4104{
4107 int i; 4105 int i;
4108 4106
@@ -4118,8 +4116,8 @@ static int __devinit hpsa_pci_find_memory_BAR(struct pci_dev *pdev,
4118 return -ENODEV; 4116 return -ENODEV;
4119} 4117}
4120 4118
4121static int __devinit hpsa_wait_for_board_state(struct pci_dev *pdev, 4119static int hpsa_wait_for_board_state(struct pci_dev *pdev, void __iomem *vaddr,
4122 void __iomem *vaddr, int wait_for_ready) 4120 int wait_for_ready)
4123{ 4121{
4124 int i, iterations; 4122 int i, iterations;
4125 u32 scratchpad; 4123 u32 scratchpad;
@@ -4143,9 +4141,9 @@ static int __devinit hpsa_wait_for_board_state(struct pci_dev *pdev,
4143 return -ENODEV; 4141 return -ENODEV;
4144} 4142}
4145 4143
4146static int __devinit hpsa_find_cfg_addrs(struct pci_dev *pdev, 4144static int hpsa_find_cfg_addrs(struct pci_dev *pdev, void __iomem *vaddr,
4147 void __iomem *vaddr, u32 *cfg_base_addr, u64 *cfg_base_addr_index, 4145 u32 *cfg_base_addr, u64 *cfg_base_addr_index,
4148 u64 *cfg_offset) 4146 u64 *cfg_offset)
4149{ 4147{
4150 *cfg_base_addr = readl(vaddr + SA5_CTCFG_OFFSET); 4148 *cfg_base_addr = readl(vaddr + SA5_CTCFG_OFFSET);
4151 *cfg_offset = readl(vaddr + SA5_CTMEM_OFFSET); 4149 *cfg_offset = readl(vaddr + SA5_CTMEM_OFFSET);
@@ -4158,7 +4156,7 @@ static int __devinit hpsa_find_cfg_addrs(struct pci_dev *pdev,
4158 return 0; 4156 return 0;
4159} 4157}
4160 4158
4161static int __devinit hpsa_find_cfgtables(struct ctlr_info *h) 4159static int hpsa_find_cfgtables(struct ctlr_info *h)
4162{ 4160{
4163 u64 cfg_offset; 4161 u64 cfg_offset;
4164 u32 cfg_base_addr; 4162 u32 cfg_base_addr;
@@ -4187,7 +4185,7 @@ static int __devinit hpsa_find_cfgtables(struct ctlr_info *h)
4187 return 0; 4185 return 0;
4188} 4186}
4189 4187
4190static void __devinit hpsa_get_max_perf_mode_cmds(struct ctlr_info *h) 4188static void hpsa_get_max_perf_mode_cmds(struct ctlr_info *h)
4191{ 4189{
4192 h->max_commands = readl(&(h->cfgtable->MaxPerformantModeCommands)); 4190 h->max_commands = readl(&(h->cfgtable->MaxPerformantModeCommands));
4193 4191
@@ -4208,7 +4206,7 @@ static void __devinit hpsa_get_max_perf_mode_cmds(struct ctlr_info *h)
4208 * max commands, max SG elements without chaining, and with chaining, 4206 * max commands, max SG elements without chaining, and with chaining,
4209 * SG chain block size, etc. 4207 * SG chain block size, etc.
4210 */ 4208 */
4211static void __devinit hpsa_find_board_params(struct ctlr_info *h) 4209static void hpsa_find_board_params(struct ctlr_info *h)
4212{ 4210{
4213 hpsa_get_max_perf_mode_cmds(h); 4211 hpsa_get_max_perf_mode_cmds(h);
4214 h->nr_cmds = h->max_commands - 4; /* Allow room for some ioctls */ 4212 h->nr_cmds = h->max_commands - 4; /* Allow room for some ioctls */
@@ -4266,7 +4264,7 @@ static inline void hpsa_p600_dma_prefetch_quirk(struct ctlr_info *h)
4266 writel(dma_prefetch, h->vaddr + I2O_DMA1_CFG); 4264 writel(dma_prefetch, h->vaddr + I2O_DMA1_CFG);
4267} 4265}
4268 4266
4269static void __devinit hpsa_wait_for_mode_change_ack(struct ctlr_info *h) 4267static void hpsa_wait_for_mode_change_ack(struct ctlr_info *h)
4270{ 4268{
4271 int i; 4269 int i;
4272 u32 doorbell_value; 4270 u32 doorbell_value;
@@ -4287,7 +4285,7 @@ static void __devinit hpsa_wait_for_mode_change_ack(struct ctlr_info *h)
4287 } 4285 }
4288} 4286}
4289 4287
4290static int __devinit hpsa_enter_simple_mode(struct ctlr_info *h) 4288static int hpsa_enter_simple_mode(struct ctlr_info *h)
4291{ 4289{
4292 u32 trans_support; 4290 u32 trans_support;
4293 4291
@@ -4310,7 +4308,7 @@ static int __devinit hpsa_enter_simple_mode(struct ctlr_info *h)
4310 return 0; 4308 return 0;
4311} 4309}
4312 4310
4313static int __devinit hpsa_pci_init(struct ctlr_info *h) 4311static int hpsa_pci_init(struct ctlr_info *h)
4314{ 4312{
4315 int prod_index, err; 4313 int prod_index, err;
4316 4314
@@ -4378,7 +4376,7 @@ err_out_free_res:
4378 return err; 4376 return err;
4379} 4377}
4380 4378
4381static void __devinit hpsa_hba_inquiry(struct ctlr_info *h) 4379static void hpsa_hba_inquiry(struct ctlr_info *h)
4382{ 4380{
4383 int rc; 4381 int rc;
4384 4382
@@ -4394,7 +4392,7 @@ static void __devinit hpsa_hba_inquiry(struct ctlr_info *h)
4394 } 4392 }
4395} 4393}
4396 4394
4397static __devinit int hpsa_init_reset_devices(struct pci_dev *pdev) 4395static int hpsa_init_reset_devices(struct pci_dev *pdev)
4398{ 4396{
4399 int rc, i; 4397 int rc, i;
4400 4398
@@ -4426,7 +4424,7 @@ static __devinit int hpsa_init_reset_devices(struct pci_dev *pdev)
4426 return 0; 4424 return 0;
4427} 4425}
4428 4426
4429static __devinit int hpsa_allocate_cmd_pool(struct ctlr_info *h) 4427static int hpsa_allocate_cmd_pool(struct ctlr_info *h)
4430{ 4428{
4431 h->cmd_pool_bits = kzalloc( 4429 h->cmd_pool_bits = kzalloc(
4432 DIV_ROUND_UP(h->nr_cmds, BITS_PER_LONG) * 4430 DIV_ROUND_UP(h->nr_cmds, BITS_PER_LONG) *
@@ -4499,7 +4497,7 @@ static int hpsa_request_irq(struct ctlr_info *h,
4499 return 0; 4497 return 0;
4500} 4498}
4501 4499
4502static int __devinit hpsa_kdump_soft_reset(struct ctlr_info *h) 4500static int hpsa_kdump_soft_reset(struct ctlr_info *h)
4503{ 4501{
4504 if (hpsa_send_host_reset(h, RAID_CTLR_LUNID, 4502 if (hpsa_send_host_reset(h, RAID_CTLR_LUNID,
4505 HPSA_RESET_TYPE_CONTROLLER)) { 4503 HPSA_RESET_TYPE_CONTROLLER)) {
@@ -4713,8 +4711,7 @@ static void stop_controller_lockup_detector(struct ctlr_info *h)
4713 spin_unlock_irqrestore(&lockup_detector_lock, flags); 4711 spin_unlock_irqrestore(&lockup_detector_lock, flags);
4714} 4712}
4715 4713
4716static int __devinit hpsa_init_one(struct pci_dev *pdev, 4714static int hpsa_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
4717 const struct pci_device_id *ent)
4718{ 4715{
4719 int dac, rc; 4716 int dac, rc;
4720 struct ctlr_info *h; 4717 struct ctlr_info *h;
@@ -4910,7 +4907,7 @@ static void hpsa_shutdown(struct pci_dev *pdev)
4910 hpsa_free_irqs_and_disable_msix(h); 4907 hpsa_free_irqs_and_disable_msix(h);
4911} 4908}
4912 4909
4913static void __devexit hpsa_free_device_info(struct ctlr_info *h) 4910static void hpsa_free_device_info(struct ctlr_info *h)
4914{ 4911{
4915 int i; 4912 int i;
4916 4913
@@ -4918,7 +4915,7 @@ static void __devexit hpsa_free_device_info(struct ctlr_info *h)
4918 kfree(h->dev[i]); 4915 kfree(h->dev[i]);
4919} 4916}
4920 4917
4921static void __devexit hpsa_remove_one(struct pci_dev *pdev) 4918static void hpsa_remove_one(struct pci_dev *pdev)
4922{ 4919{
4923 struct ctlr_info *h; 4920 struct ctlr_info *h;
4924 4921
@@ -4966,7 +4963,7 @@ static int hpsa_resume(__attribute__((unused)) struct pci_dev *pdev)
4966static struct pci_driver hpsa_pci_driver = { 4963static struct pci_driver hpsa_pci_driver = {
4967 .name = HPSA, 4964 .name = HPSA,
4968 .probe = hpsa_init_one, 4965 .probe = hpsa_init_one,
4969 .remove = __devexit_p(hpsa_remove_one), 4966 .remove = hpsa_remove_one,
4970 .id_table = hpsa_pci_device_id, /* id_table */ 4967 .id_table = hpsa_pci_device_id, /* id_table */
4971 .shutdown = hpsa_shutdown, 4968 .shutdown = hpsa_shutdown,
4972 .suspend = hpsa_suspend, 4969 .suspend = hpsa_suspend,
@@ -5010,8 +5007,7 @@ static void calc_bucket_map(int bucket[], int num_buckets,
5010 } 5007 }
5011} 5008}
5012 5009
5013static __devinit void hpsa_enter_performant_mode(struct ctlr_info *h, 5010static void hpsa_enter_performant_mode(struct ctlr_info *h, u32 use_short_tags)
5014 u32 use_short_tags)
5015{ 5011{
5016 int i; 5012 int i;
5017 unsigned long register_value; 5013 unsigned long register_value;
@@ -5079,7 +5075,7 @@ static __devinit void hpsa_enter_performant_mode(struct ctlr_info *h,
5079 h->transMethod = CFGTBL_Trans_Performant; 5075 h->transMethod = CFGTBL_Trans_Performant;
5080} 5076}
5081 5077
5082static __devinit void hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h) 5078static void hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h)
5083{ 5079{
5084 u32 trans_support; 5080 u32 trans_support;
5085 int i; 5081 int i;
diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
index 138e573f37ef..ee196b363d81 100644
--- a/drivers/scsi/hptiop.c
+++ b/drivers/scsi/hptiop.c
@@ -1282,8 +1282,7 @@ static int hptiop_internal_memfree_mvfrey(struct hptiop_hba *hba)
1282 return -1; 1282 return -1;
1283} 1283}
1284 1284
1285static int __devinit hptiop_probe(struct pci_dev *pcidev, 1285static int hptiop_probe(struct pci_dev *pcidev, const struct pci_device_id *id)
1286 const struct pci_device_id *id)
1287{ 1286{
1288 struct Scsi_Host *host = NULL; 1287 struct Scsi_Host *host = NULL;
1289 struct hptiop_hba *hba; 1288 struct hptiop_hba *hba;
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index 5e8d51bd03de..cc82d0f322b6 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -4905,7 +4905,7 @@ static unsigned long ibmvfc_get_desired_dma(struct vio_dev *vdev)
4905 return pool_dma + ((512 * 1024) * driver_template.cmd_per_lun); 4905 return pool_dma + ((512 * 1024) * driver_template.cmd_per_lun);
4906} 4906}
4907 4907
4908static struct vio_device_id ibmvfc_device_table[] __devinitdata = { 4908static struct vio_device_id ibmvfc_device_table[] = {
4909 {"fcp", "IBM,vfc-client"}, 4909 {"fcp", "IBM,vfc-client"},
4910 { "", "" } 4910 { "", "" }
4911}; 4911};
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index ef9a54c7da67..a044f593e8b9 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -2362,7 +2362,7 @@ static int ibmvscsi_resume(struct device *dev)
2362 * ibmvscsi_device_table: Used by vio.c to match devices in the device tree we 2362 * ibmvscsi_device_table: Used by vio.c to match devices in the device tree we
2363 * support. 2363 * support.
2364 */ 2364 */
2365static struct vio_device_id ibmvscsi_device_table[] __devinitdata = { 2365static struct vio_device_id ibmvscsi_device_table[] = {
2366 {"vscsi", "IBM,v-scsi"}, 2366 {"vscsi", "IBM,v-scsi"},
2367 { "", "" } 2367 { "", "" }
2368}; 2368};
diff --git a/drivers/scsi/ibmvscsi/ibmvstgt.c b/drivers/scsi/ibmvscsi/ibmvstgt.c
index aa7ed81e9237..bf9eca845166 100644
--- a/drivers/scsi/ibmvscsi/ibmvstgt.c
+++ b/drivers/scsi/ibmvscsi/ibmvstgt.c
@@ -907,7 +907,7 @@ static int ibmvstgt_remove(struct vio_dev *dev)
907 return 0; 907 return 0;
908} 908}
909 909
910static struct vio_device_id ibmvstgt_device_table[] __devinitdata = { 910static struct vio_device_id ibmvstgt_device_table[] = {
911 {"v-scsi-host", "IBM,v-scsi-host"}, 911 {"v-scsi-host", "IBM,v-scsi-host"},
912 {"",""} 912 {"",""}
913}; 913};
diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c
index dd741bcd6ccd..280d5af113d1 100644
--- a/drivers/scsi/initio.c
+++ b/drivers/scsi/initio.c
@@ -2992,7 +2992,7 @@ static struct pci_driver initio_pci_driver = {
2992 .name = "initio", 2992 .name = "initio",
2993 .id_table = initio_pci_tbl, 2993 .id_table = initio_pci_tbl,
2994 .probe = initio_probe_one, 2994 .probe = initio_probe_one,
2995 .remove = __devexit_p(initio_remove_one), 2995 .remove = initio_remove_one,
2996}; 2996};
2997 2997
2998static int __init initio_init_driver(void) 2998static int __init initio_init_driver(void)
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index fe6029f4df16..1d7da3f41ebb 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -8296,7 +8296,7 @@ static pci_ers_result_t ipr_pci_error_detected(struct pci_dev *pdev,
8296 * Return value: 8296 * Return value:
8297 * 0 on success / -EIO on failure 8297 * 0 on success / -EIO on failure
8298 **/ 8298 **/
8299static int __devinit ipr_probe_ioa_part2(struct ipr_ioa_cfg *ioa_cfg) 8299static int ipr_probe_ioa_part2(struct ipr_ioa_cfg *ioa_cfg)
8300{ 8300{
8301 int rc = 0; 8301 int rc = 0;
8302 unsigned long host_lock_flags = 0; 8302 unsigned long host_lock_flags = 0;
@@ -8425,7 +8425,7 @@ static void ipr_free_all_resources(struct ipr_ioa_cfg *ioa_cfg)
8425 * Return value: 8425 * Return value:
8426 * 0 on success / -ENOMEM on allocation failure 8426 * 0 on success / -ENOMEM on allocation failure
8427 **/ 8427 **/
8428static int __devinit ipr_alloc_cmd_blks(struct ipr_ioa_cfg *ioa_cfg) 8428static int ipr_alloc_cmd_blks(struct ipr_ioa_cfg *ioa_cfg)
8429{ 8429{
8430 struct ipr_cmnd *ipr_cmd; 8430 struct ipr_cmnd *ipr_cmd;
8431 struct ipr_ioarcb *ioarcb; 8431 struct ipr_ioarcb *ioarcb;
@@ -8497,7 +8497,7 @@ static int __devinit ipr_alloc_cmd_blks(struct ipr_ioa_cfg *ioa_cfg)
8497 * Return value: 8497 * Return value:
8498 * 0 on success / non-zero for error 8498 * 0 on success / non-zero for error
8499 **/ 8499 **/
8500static int __devinit ipr_alloc_mem(struct ipr_ioa_cfg *ioa_cfg) 8500static int ipr_alloc_mem(struct ipr_ioa_cfg *ioa_cfg)
8501{ 8501{
8502 struct pci_dev *pdev = ioa_cfg->pdev; 8502 struct pci_dev *pdev = ioa_cfg->pdev;
8503 int i, rc = -ENOMEM; 8503 int i, rc = -ENOMEM;
@@ -8601,7 +8601,7 @@ out_free_res_entries:
8601 * Return value: 8601 * Return value:
8602 * none 8602 * none
8603 **/ 8603 **/
8604static void __devinit ipr_initialize_bus_attr(struct ipr_ioa_cfg *ioa_cfg) 8604static void ipr_initialize_bus_attr(struct ipr_ioa_cfg *ioa_cfg)
8605{ 8605{
8606 int i; 8606 int i;
8607 8607
@@ -8625,8 +8625,8 @@ static void __devinit ipr_initialize_bus_attr(struct ipr_ioa_cfg *ioa_cfg)
8625 * Return value: 8625 * Return value:
8626 * none 8626 * none
8627 **/ 8627 **/
8628static void __devinit ipr_init_ioa_cfg(struct ipr_ioa_cfg *ioa_cfg, 8628static void ipr_init_ioa_cfg(struct ipr_ioa_cfg *ioa_cfg,
8629 struct Scsi_Host *host, struct pci_dev *pdev) 8629 struct Scsi_Host *host, struct pci_dev *pdev)
8630{ 8630{
8631 const struct ipr_interrupt_offsets *p; 8631 const struct ipr_interrupt_offsets *p;
8632 struct ipr_interrupts *t; 8632 struct ipr_interrupts *t;
@@ -8712,7 +8712,7 @@ static void __devinit ipr_init_ioa_cfg(struct ipr_ioa_cfg *ioa_cfg,
8712 * Return value: 8712 * Return value:
8713 * ptr to chip information on success / NULL on failure 8713 * ptr to chip information on success / NULL on failure
8714 **/ 8714 **/
8715static const struct ipr_chip_t * __devinit 8715static const struct ipr_chip_t *
8716ipr_get_chip_info(const struct pci_device_id *dev_id) 8716ipr_get_chip_info(const struct pci_device_id *dev_id)
8717{ 8717{
8718 int i; 8718 int i;
@@ -8734,7 +8734,7 @@ ipr_get_chip_info(const struct pci_device_id *dev_id)
8734 * Return value: 8734 * Return value:
8735 * 0 on success / non-zero on failure 8735 * 0 on success / non-zero on failure
8736 **/ 8736 **/
8737static irqreturn_t __devinit ipr_test_intr(int irq, void *devp) 8737static irqreturn_t ipr_test_intr(int irq, void *devp)
8738{ 8738{
8739 struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)devp; 8739 struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)devp;
8740 unsigned long lock_flags = 0; 8740 unsigned long lock_flags = 0;
@@ -8761,8 +8761,7 @@ static irqreturn_t __devinit ipr_test_intr(int irq, void *devp)
8761 * Return value: 8761 * Return value:
8762 * 0 on success / non-zero on failure 8762 * 0 on success / non-zero on failure
8763 **/ 8763 **/
8764static int __devinit ipr_test_msi(struct ipr_ioa_cfg *ioa_cfg, 8764static int ipr_test_msi(struct ipr_ioa_cfg *ioa_cfg, struct pci_dev *pdev)
8765 struct pci_dev *pdev)
8766{ 8765{
8767 int rc; 8766 int rc;
8768 volatile u32 int_reg; 8767 volatile u32 int_reg;
@@ -8815,8 +8814,8 @@ static int __devinit ipr_test_msi(struct ipr_ioa_cfg *ioa_cfg,
8815 * Return value: 8814 * Return value:
8816 * 0 on success / non-zero on failure 8815 * 0 on success / non-zero on failure
8817 **/ 8816 **/
8818static int __devinit ipr_probe_ioa(struct pci_dev *pdev, 8817static int ipr_probe_ioa(struct pci_dev *pdev,
8819 const struct pci_device_id *dev_id) 8818 const struct pci_device_id *dev_id)
8820{ 8819{
8821 struct ipr_ioa_cfg *ioa_cfg; 8820 struct ipr_ioa_cfg *ioa_cfg;
8822 struct Scsi_Host *host; 8821 struct Scsi_Host *host;
@@ -9113,7 +9112,7 @@ static void __ipr_remove(struct pci_dev *pdev)
9113 * Return value: 9112 * Return value:
9114 * none 9113 * none
9115 **/ 9114 **/
9116static void __devexit ipr_remove(struct pci_dev *pdev) 9115static void ipr_remove(struct pci_dev *pdev)
9117{ 9116{
9118 struct ipr_ioa_cfg *ioa_cfg = pci_get_drvdata(pdev); 9117 struct ipr_ioa_cfg *ioa_cfg = pci_get_drvdata(pdev);
9119 9118
@@ -9136,8 +9135,7 @@ static void __devexit ipr_remove(struct pci_dev *pdev)
9136 * Return value: 9135 * Return value:
9137 * 0 on success / non-zero on failure 9136 * 0 on success / non-zero on failure
9138 **/ 9137 **/
9139static int __devinit ipr_probe(struct pci_dev *pdev, 9138static int ipr_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
9140 const struct pci_device_id *dev_id)
9141{ 9139{
9142 struct ipr_ioa_cfg *ioa_cfg; 9140 struct ipr_ioa_cfg *ioa_cfg;
9143 int rc; 9141 int rc;
@@ -9218,7 +9216,7 @@ static void ipr_shutdown(struct pci_dev *pdev)
9218 wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload); 9216 wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload);
9219} 9217}
9220 9218
9221static struct pci_device_id ipr_pci_table[] __devinitdata = { 9219static struct pci_device_id ipr_pci_table[] = {
9222 { PCI_VENDOR_ID_MYLEX, PCI_DEVICE_ID_IBM_GEMSTONE, 9220 { PCI_VENDOR_ID_MYLEX, PCI_DEVICE_ID_IBM_GEMSTONE,
9223 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_5702, 0, 0, 0 }, 9221 PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_5702, 0, 0, 0 },
9224 { PCI_VENDOR_ID_MYLEX, PCI_DEVICE_ID_IBM_GEMSTONE, 9222 { PCI_VENDOR_ID_MYLEX, PCI_DEVICE_ID_IBM_GEMSTONE,
@@ -9305,7 +9303,7 @@ static struct pci_driver ipr_driver = {
9305 .name = IPR_NAME, 9303 .name = IPR_NAME,
9306 .id_table = ipr_pci_table, 9304 .id_table = ipr_pci_table,
9307 .probe = ipr_probe, 9305 .probe = ipr_probe,
9308 .remove = __devexit_p(ipr_remove), 9306 .remove = ipr_remove,
9309 .shutdown = ipr_shutdown, 9307 .shutdown = ipr_shutdown,
9310 .err_handler = &ipr_err_handler, 9308 .err_handler = &ipr_err_handler,
9311}; 9309};
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index b6d7a5c2fc94..9aa86a315a08 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -389,14 +389,14 @@ MODULE_DEVICE_TABLE( pci, ips_pci_table );
389 389
390static char ips_hot_plug_name[] = "ips"; 390static char ips_hot_plug_name[] = "ips";
391 391
392static int __devinit ips_insert_device(struct pci_dev *pci_dev, const struct pci_device_id *ent); 392static int ips_insert_device(struct pci_dev *pci_dev, const struct pci_device_id *ent);
393static void __devexit ips_remove_device(struct pci_dev *pci_dev); 393static void ips_remove_device(struct pci_dev *pci_dev);
394 394
395static struct pci_driver ips_pci_driver = { 395static struct pci_driver ips_pci_driver = {
396 .name = ips_hot_plug_name, 396 .name = ips_hot_plug_name,
397 .id_table = ips_pci_table, 397 .id_table = ips_pci_table,
398 .probe = ips_insert_device, 398 .probe = ips_insert_device,
399 .remove = __devexit_p(ips_remove_device), 399 .remove = ips_remove_device,
400}; 400};
401 401
402 402
@@ -6837,7 +6837,7 @@ err_out_sh:
6837/* Routine Description: */ 6837/* Routine Description: */
6838/* Remove one Adapter ( Hot Plugging ) */ 6838/* Remove one Adapter ( Hot Plugging ) */
6839/*---------------------------------------------------------------------------*/ 6839/*---------------------------------------------------------------------------*/
6840static void __devexit 6840static void
6841ips_remove_device(struct pci_dev *pci_dev) 6841ips_remove_device(struct pci_dev *pci_dev)
6842{ 6842{
6843 struct Scsi_Host *sh = pci_get_drvdata(pci_dev); 6843 struct Scsi_Host *sh = pci_get_drvdata(pci_dev);
@@ -6898,7 +6898,7 @@ module_exit(ips_module_exit);
6898/* Return Value: */ 6898/* Return Value: */
6899/* 0 if Successful, else non-zero */ 6899/* 0 if Successful, else non-zero */
6900/*---------------------------------------------------------------------------*/ 6900/*---------------------------------------------------------------------------*/
6901static int __devinit 6901static int
6902ips_insert_device(struct pci_dev *pci_dev, const struct pci_device_id *ent) 6902ips_insert_device(struct pci_dev *pci_dev, const struct pci_device_id *ent)
6903{ 6903{
6904 int index = -1; 6904 int index = -1;
diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c
index b74050b95d6a..2839baa82a5a 100644
--- a/drivers/scsi/isci/init.c
+++ b/drivers/scsi/isci/init.c
@@ -282,7 +282,7 @@ static void isci_unregister(struct isci_host *isci_host)
282 scsi_host_put(shost); 282 scsi_host_put(shost);
283} 283}
284 284
285static int __devinit isci_pci_init(struct pci_dev *pdev) 285static int isci_pci_init(struct pci_dev *pdev)
286{ 286{
287 int err, bar_num, bar_mask = 0; 287 int err, bar_num, bar_mask = 0;
288 void __iomem * const *iomap; 288 void __iomem * const *iomap;
@@ -616,7 +616,7 @@ static struct isci_host *isci_host_alloc(struct pci_dev *pdev, int id)
616 return NULL; 616 return NULL;
617} 617}
618 618
619static int __devinit isci_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) 619static int isci_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
620{ 620{
621 struct isci_pci_info *pci_info; 621 struct isci_pci_info *pci_info;
622 int err, i; 622 int err, i;
@@ -633,7 +633,7 @@ static int __devinit isci_pci_probe(struct pci_dev *pdev, const struct pci_devic
633 return -ENOMEM; 633 return -ENOMEM;
634 pci_set_drvdata(pdev, pci_info); 634 pci_set_drvdata(pdev, pci_info);
635 635
636 if (efi_enabled) 636 if (efi_enabled(EFI_RUNTIME_SERVICES))
637 orom = isci_get_efi_var(pdev); 637 orom = isci_get_efi_var(pdev);
638 638
639 if (!orom) 639 if (!orom)
@@ -709,7 +709,7 @@ static int __devinit isci_pci_probe(struct pci_dev *pdev, const struct pci_devic
709 return err; 709 return err;
710} 710}
711 711
712static void __devexit isci_pci_remove(struct pci_dev *pdev) 712static void isci_pci_remove(struct pci_dev *pdev)
713{ 713{
714 struct isci_host *ihost; 714 struct isci_host *ihost;
715 int i; 715 int i;
@@ -778,7 +778,7 @@ static struct pci_driver isci_pci_driver = {
778 .name = DRV_NAME, 778 .name = DRV_NAME,
779 .id_table = isci_id_table, 779 .id_table = isci_id_table,
780 .probe = isci_pci_probe, 780 .probe = isci_pci_probe,
781 .remove = __devexit_p(isci_pci_remove), 781 .remove = isci_pci_remove,
782#ifdef CONFIG_PM 782#ifdef CONFIG_PM
783 .driver.pm = &isci_pm_ops, 783 .driver.pm = &isci_pm_ops,
784#endif 784#endif
diff --git a/drivers/scsi/jazz_esp.c b/drivers/scsi/jazz_esp.c
index 27cfb0cb186c..69efbf12b299 100644
--- a/drivers/scsi/jazz_esp.c
+++ b/drivers/scsi/jazz_esp.c
@@ -129,7 +129,7 @@ static const struct esp_driver_ops jazz_esp_ops = {
129 .dma_error = jazz_esp_dma_error, 129 .dma_error = jazz_esp_dma_error,
130}; 130};
131 131
132static int __devinit esp_jazz_probe(struct platform_device *dev) 132static int esp_jazz_probe(struct platform_device *dev)
133{ 133{
134 struct scsi_host_template *tpnt = &scsi_esp_template; 134 struct scsi_host_template *tpnt = &scsi_esp_template;
135 struct Scsi_Host *host; 135 struct Scsi_Host *host;
@@ -201,7 +201,7 @@ fail:
201 return err; 201 return err;
202} 202}
203 203
204static int __devexit esp_jazz_remove(struct platform_device *dev) 204static int esp_jazz_remove(struct platform_device *dev)
205{ 205{
206 struct esp *esp = dev_get_drvdata(&dev->dev); 206 struct esp *esp = dev_get_drvdata(&dev->dev);
207 unsigned int irq = esp->host->irq; 207 unsigned int irq = esp->host->irq;
@@ -223,7 +223,7 @@ MODULE_ALIAS("platform:jazz_esp");
223 223
224static struct platform_driver esp_jazz_driver = { 224static struct platform_driver esp_jazz_driver = {
225 .probe = esp_jazz_probe, 225 .probe = esp_jazz_probe,
226 .remove = __devexit_p(esp_jazz_remove), 226 .remove = esp_jazz_remove,
227 .driver = { 227 .driver = {
228 .name = "jazz_esp", 228 .name = "jazz_esp",
229 .owner = THIS_MODULE, 229 .owner = THIS_MODULE,
diff --git a/drivers/scsi/lasi700.c b/drivers/scsi/lasi700.c
index 23880f8fe7e4..5c4ded997265 100644
--- a/drivers/scsi/lasi700.c
+++ b/drivers/scsi/lasi700.c
@@ -168,7 +168,7 @@ static struct parisc_driver lasi700_driver = {
168 .name = "lasi_scsi", 168 .name = "lasi_scsi",
169 .id_table = lasi700_ids, 169 .id_table = lasi700_ids,
170 .probe = lasi700_probe, 170 .probe = lasi700_probe,
171 .remove = __devexit_p(lasi700_driver_remove), 171 .remove = lasi700_driver_remove,
172}; 172};
173 173
174static int __init 174static int __init
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index c20eec78adc1..89ad55807012 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -8813,7 +8813,7 @@ lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
8813 * 0 - driver can claim the device 8813 * 0 - driver can claim the device
8814 * negative value - driver can not claim the device 8814 * negative value - driver can not claim the device
8815 **/ 8815 **/
8816static int __devinit 8816static int
8817lpfc_pci_probe_one_s3(struct pci_dev *pdev, const struct pci_device_id *pid) 8817lpfc_pci_probe_one_s3(struct pci_dev *pdev, const struct pci_device_id *pid)
8818{ 8818{
8819 struct lpfc_hba *phba; 8819 struct lpfc_hba *phba;
@@ -8980,7 +8980,7 @@ out_free_phba:
8980 * removed from PCI bus, it performs all the necessary cleanup for the HBA 8980 * removed from PCI bus, it performs all the necessary cleanup for the HBA
8981 * device to be removed from the PCI subsystem properly. 8981 * device to be removed from the PCI subsystem properly.
8982 **/ 8982 **/
8983static void __devexit 8983static void
8984lpfc_pci_remove_one_s3(struct pci_dev *pdev) 8984lpfc_pci_remove_one_s3(struct pci_dev *pdev)
8985{ 8985{
8986 struct Scsi_Host *shost = pci_get_drvdata(pdev); 8986 struct Scsi_Host *shost = pci_get_drvdata(pdev);
@@ -9587,7 +9587,7 @@ lpfc_sli4_request_firmware_update(struct lpfc_hba *phba, uint8_t fw_upgrade)
9587 * 0 - driver can claim the device 9587 * 0 - driver can claim the device
9588 * negative value - driver can not claim the device 9588 * negative value - driver can not claim the device
9589 **/ 9589 **/
9590static int __devinit 9590static int
9591lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid) 9591lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid)
9592{ 9592{
9593 struct lpfc_hba *phba; 9593 struct lpfc_hba *phba;
@@ -9779,7 +9779,7 @@ out_free_phba:
9779 * removed from PCI bus, it performs all the necessary cleanup for the HBA 9779 * removed from PCI bus, it performs all the necessary cleanup for the HBA
9780 * device to be removed from the PCI subsystem properly. 9780 * device to be removed from the PCI subsystem properly.
9781 **/ 9781 **/
9782static void __devexit 9782static void
9783lpfc_pci_remove_one_s4(struct pci_dev *pdev) 9783lpfc_pci_remove_one_s4(struct pci_dev *pdev)
9784{ 9784{
9785 struct Scsi_Host *shost = pci_get_drvdata(pdev); 9785 struct Scsi_Host *shost = pci_get_drvdata(pdev);
@@ -10205,7 +10205,7 @@ lpfc_io_resume_s4(struct pci_dev *pdev)
10205 * 0 - driver can claim the device 10205 * 0 - driver can claim the device
10206 * negative value - driver can not claim the device 10206 * negative value - driver can not claim the device
10207 **/ 10207 **/
10208static int __devinit 10208static int
10209lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) 10209lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
10210{ 10210{
10211 int rc; 10211 int rc;
@@ -10233,7 +10233,7 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
10233 * remove routine, which will perform all the necessary cleanup for the 10233 * remove routine, which will perform all the necessary cleanup for the
10234 * device to be removed from the PCI subsystem properly. 10234 * device to be removed from the PCI subsystem properly.
10235 **/ 10235 **/
10236static void __devexit 10236static void
10237lpfc_pci_remove_one(struct pci_dev *pdev) 10237lpfc_pci_remove_one(struct pci_dev *pdev)
10238{ 10238{
10239 struct Scsi_Host *shost = pci_get_drvdata(pdev); 10239 struct Scsi_Host *shost = pci_get_drvdata(pdev);
@@ -10575,7 +10575,7 @@ static struct pci_driver lpfc_driver = {
10575 .name = LPFC_DRIVER_NAME, 10575 .name = LPFC_DRIVER_NAME,
10576 .id_table = lpfc_id_table, 10576 .id_table = lpfc_id_table,
10577 .probe = lpfc_pci_probe_one, 10577 .probe = lpfc_pci_probe_one,
10578 .remove = __devexit_p(lpfc_pci_remove_one), 10578 .remove = lpfc_pci_remove_one,
10579 .suspend = lpfc_pci_suspend_one, 10579 .suspend = lpfc_pci_suspend_one,
10580 .resume = lpfc_pci_resume_one, 10580 .resume = lpfc_pci_resume_one,
10581 .err_handler = &lpfc_err_handler, 10581 .err_handler = &lpfc_err_handler,
diff --git a/drivers/scsi/mac_esp.c b/drivers/scsi/mac_esp.c
index 70eb1f79b1ba..994fc5caf036 100644
--- a/drivers/scsi/mac_esp.c
+++ b/drivers/scsi/mac_esp.c
@@ -481,7 +481,7 @@ static struct esp_driver_ops mac_esp_ops = {
481 .dma_error = mac_esp_dma_error, 481 .dma_error = mac_esp_dma_error,
482}; 482};
483 483
484static int __devinit esp_mac_probe(struct platform_device *dev) 484static int esp_mac_probe(struct platform_device *dev)
485{ 485{
486 struct scsi_host_template *tpnt = &scsi_esp_template; 486 struct scsi_host_template *tpnt = &scsi_esp_template;
487 struct Scsi_Host *host; 487 struct Scsi_Host *host;
@@ -591,7 +591,7 @@ fail:
591 return err; 591 return err;
592} 592}
593 593
594static int __devexit esp_mac_remove(struct platform_device *dev) 594static int esp_mac_remove(struct platform_device *dev)
595{ 595{
596 struct mac_esp_priv *mep = platform_get_drvdata(dev); 596 struct mac_esp_priv *mep = platform_get_drvdata(dev);
597 struct esp *esp = mep->esp; 597 struct esp *esp = mep->esp;
@@ -614,7 +614,7 @@ static int __devexit esp_mac_remove(struct platform_device *dev)
614 614
615static struct platform_driver esp_mac_driver = { 615static struct platform_driver esp_mac_driver = {
616 .probe = esp_mac_probe, 616 .probe = esp_mac_probe,
617 .remove = __devexit_p(esp_mac_remove), 617 .remove = esp_mac_remove,
618 .driver = { 618 .driver = {
619 .name = DRV_MODULE_NAME, 619 .name = DRV_MODULE_NAME,
620 .owner = THIS_MODULE, 620 .owner = THIS_MODULE,
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 76ad72d32c3f..9504ec0ec682 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -4522,7 +4522,7 @@ static struct scsi_host_template megaraid_template = {
4522 .eh_host_reset_handler = megaraid_reset, 4522 .eh_host_reset_handler = megaraid_reset,
4523}; 4523};
4524 4524
4525static int __devinit 4525static int
4526megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) 4526megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
4527{ 4527{
4528 struct Scsi_Host *host; 4528 struct Scsi_Host *host;
@@ -4914,7 +4914,7 @@ __megaraid_shutdown(adapter_t *adapter)
4914 mdelay(1000); 4914 mdelay(1000);
4915} 4915}
4916 4916
4917static void __devexit 4917static void
4918megaraid_remove_one(struct pci_dev *pdev) 4918megaraid_remove_one(struct pci_dev *pdev)
4919{ 4919{
4920 struct Scsi_Host *host = pci_get_drvdata(pdev); 4920 struct Scsi_Host *host = pci_get_drvdata(pdev);
@@ -5008,7 +5008,7 @@ static struct pci_driver megaraid_pci_driver = {
5008 .name = "megaraid_legacy", 5008 .name = "megaraid_legacy",
5009 .id_table = megaraid_pci_tbl, 5009 .id_table = megaraid_pci_tbl,
5010 .probe = megaraid_probe_one, 5010 .probe = megaraid_probe_one,
5011 .remove = __devexit_p(megaraid_remove_one), 5011 .remove = megaraid_remove_one,
5012 .shutdown = megaraid_shutdown, 5012 .shutdown = megaraid_shutdown,
5013}; 5013};
5014 5014
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
index 54b1c5bb310f..e6a1e0b38a19 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -305,7 +305,7 @@ static struct pci_driver megaraid_pci_driver = {
305 .name = "megaraid", 305 .name = "megaraid",
306 .id_table = pci_id_table_g, 306 .id_table = pci_id_table_g,
307 .probe = megaraid_probe_one, 307 .probe = megaraid_probe_one,
308 .remove = __devexit_p(megaraid_detach_one), 308 .remove = megaraid_detach_one,
309 .shutdown = megaraid_mbox_shutdown, 309 .shutdown = megaraid_mbox_shutdown,
310}; 310};
311 311
@@ -434,7 +434,7 @@ megaraid_exit(void)
434 * This routine should be called whenever a new adapter is detected by the 434 * This routine should be called whenever a new adapter is detected by the
435 * PCI hotplug susbsystem. 435 * PCI hotplug susbsystem.
436 */ 436 */
437static int __devinit 437static int
438megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) 438megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
439{ 439{
440 adapter_t *adapter; 440 adapter_t *adapter;
@@ -735,7 +735,7 @@ megaraid_io_detach(adapter_t *adapter)
735 * - Allocate memory required for all the commands 735 * - Allocate memory required for all the commands
736 * - Use internal library of FW routines, build up complete soft state 736 * - Use internal library of FW routines, build up complete soft state
737 */ 737 */
738static int __devinit 738static int
739megaraid_init_mbox(adapter_t *adapter) 739megaraid_init_mbox(adapter_t *adapter)
740{ 740{
741 struct pci_dev *pdev; 741 struct pci_dev *pdev;
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index e4f2baacf1e1..66a0fec0437b 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -3972,8 +3972,8 @@ fail_set_dma_mask:
3972 * @pdev: PCI device structure 3972 * @pdev: PCI device structure
3973 * @id: PCI ids of supported hotplugged adapter 3973 * @id: PCI ids of supported hotplugged adapter
3974 */ 3974 */
3975static int __devinit 3975static int megasas_probe_one(struct pci_dev *pdev,
3976megasas_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) 3976 const struct pci_device_id *id)
3977{ 3977{
3978 int rval, pos, i, j; 3978 int rval, pos, i, j;
3979 struct Scsi_Host *host; 3979 struct Scsi_Host *host;
@@ -4525,7 +4525,7 @@ fail_ready_state:
4525 * megasas_detach_one - PCI hot"un"plug entry point 4525 * megasas_detach_one - PCI hot"un"plug entry point
4526 * @pdev: PCI device structure 4526 * @pdev: PCI device structure
4527 */ 4527 */
4528static void __devexit megasas_detach_one(struct pci_dev *pdev) 4528static void megasas_detach_one(struct pci_dev *pdev)
4529{ 4529{
4530 int i; 4530 int i;
4531 struct Scsi_Host *host; 4531 struct Scsi_Host *host;
@@ -5119,7 +5119,7 @@ static struct pci_driver megasas_pci_driver = {
5119 .name = "megaraid_sas", 5119 .name = "megaraid_sas",
5120 .id_table = megasas_pci_table, 5120 .id_table = megasas_pci_table,
5121 .probe = megasas_probe_one, 5121 .probe = megasas_probe_one,
5122 .remove = __devexit_p(megasas_detach_one), 5122 .remove = megasas_detach_one,
5123 .suspend = megasas_suspend, 5123 .suspend = megasas_suspend,
5124 .resume = megasas_resume, 5124 .resume = megasas_resume,
5125 .shutdown = megasas_shutdown, 5125 .shutdown = megasas_shutdown,
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index af4e6c451b1b..c6bdc9267229 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -7686,7 +7686,7 @@ _scsih_shutdown(struct pci_dev *pdev)
7686 * Routine called when unloading the driver. 7686 * Routine called when unloading the driver.
7687 * Return nothing. 7687 * Return nothing.
7688 */ 7688 */
7689static void __devexit 7689static void
7690_scsih_remove(struct pci_dev *pdev) 7690_scsih_remove(struct pci_dev *pdev)
7691{ 7691{
7692 struct Scsi_Host *shost = pci_get_drvdata(pdev); 7692 struct Scsi_Host *shost = pci_get_drvdata(pdev);
@@ -8338,7 +8338,7 @@ static struct pci_driver scsih_driver = {
8338 .name = MPT2SAS_DRIVER_NAME, 8338 .name = MPT2SAS_DRIVER_NAME,
8339 .id_table = scsih_pci_table, 8339 .id_table = scsih_pci_table,
8340 .probe = _scsih_probe, 8340 .probe = _scsih_probe,
8341 .remove = __devexit_p(_scsih_remove), 8341 .remove = _scsih_remove,
8342 .shutdown = _scsih_shutdown, 8342 .shutdown = _scsih_shutdown,
8343 .err_handler = &_scsih_err_handler, 8343 .err_handler = &_scsih_err_handler,
8344#ifdef CONFIG_PM 8344#ifdef CONFIG_PM
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 05f80450ac7e..6421a06c4ce2 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -7374,8 +7374,7 @@ _scsih_ir_shutdown(struct MPT3SAS_ADAPTER *ioc)
7374 * Routine called when unloading the driver. 7374 * Routine called when unloading the driver.
7375 * Return nothing. 7375 * Return nothing.
7376 */ 7376 */
7377static void __devexit 7377static void _scsih_remove(struct pci_dev *pdev)
7378_scsih_remove(struct pci_dev *pdev)
7379{ 7378{
7380 struct Scsi_Host *shost = pci_get_drvdata(pdev); 7379 struct Scsi_Host *shost = pci_get_drvdata(pdev);
7381 struct MPT3SAS_ADAPTER *ioc = shost_priv(shost); 7380 struct MPT3SAS_ADAPTER *ioc = shost_priv(shost);
@@ -8044,7 +8043,7 @@ static struct pci_driver scsih_driver = {
8044 .name = MPT3SAS_DRIVER_NAME, 8043 .name = MPT3SAS_DRIVER_NAME,
8045 .id_table = scsih_pci_table, 8044 .id_table = scsih_pci_table,
8046 .probe = _scsih_probe, 8045 .probe = _scsih_probe,
8047 .remove = __devexit_p(_scsih_remove), 8046 .remove = _scsih_remove,
8048 .shutdown = _scsih_shutdown, 8047 .shutdown = _scsih_shutdown,
8049 .err_handler = &_scsih_err_handler, 8048 .err_handler = &_scsih_err_handler,
8050#ifdef CONFIG_PM 8049#ifdef CONFIG_PM
diff --git a/drivers/scsi/mvme16x_scsi.c b/drivers/scsi/mvme16x_scsi.c
index 39f554f5f261..8fbb97a8bfd3 100644
--- a/drivers/scsi/mvme16x_scsi.c
+++ b/drivers/scsi/mvme16x_scsi.c
@@ -34,8 +34,7 @@ static struct scsi_host_template mvme16x_scsi_driver_template = {
34 34
35static struct platform_device *mvme16x_scsi_device; 35static struct platform_device *mvme16x_scsi_device;
36 36
37static __devinit int 37static int mvme16x_probe(struct platform_device *dev)
38mvme16x_probe(struct platform_device *dev)
39{ 38{
40 struct Scsi_Host * host = NULL; 39 struct Scsi_Host * host = NULL;
41 struct NCR_700_Host_Parameters *hostdata; 40 struct NCR_700_Host_Parameters *hostdata;
@@ -103,8 +102,7 @@ mvme16x_probe(struct platform_device *dev)
103 return -ENODEV; 102 return -ENODEV;
104} 103}
105 104
106static __devexit int 105static int mvme16x_device_remove(struct platform_device *dev)
107mvme16x_device_remove(struct platform_device *dev)
108{ 106{
109 struct Scsi_Host *host = platform_get_drvdata(dev); 107 struct Scsi_Host *host = platform_get_drvdata(dev);
110 struct NCR_700_Host_Parameters *hostdata = shost_priv(host); 108 struct NCR_700_Host_Parameters *hostdata = shost_priv(host);
@@ -131,7 +129,7 @@ static struct platform_driver mvme16x_scsi_driver = {
131 .owner = THIS_MODULE, 129 .owner = THIS_MODULE,
132 }, 130 },
133 .probe = mvme16x_probe, 131 .probe = mvme16x_probe,
134 .remove = __devexit_p(mvme16x_device_remove), 132 .remove = mvme16x_device_remove,
135}; 133};
136 134
137static int __init mvme16x_scsi_init(void) 135static int __init mvme16x_scsi_init(void)
diff --git a/drivers/scsi/mvsas/mv_64xx.c b/drivers/scsi/mvsas/mv_64xx.c
index 8ba47229049f..8bb06995adfb 100644
--- a/drivers/scsi/mvsas/mv_64xx.c
+++ b/drivers/scsi/mvsas/mv_64xx.c
@@ -41,7 +41,7 @@ static void mvs_64xx_detect_porttype(struct mvs_info *mvi, int i)
41 phy->phy_type |= PORT_TYPE_SATA; 41 phy->phy_type |= PORT_TYPE_SATA;
42} 42}
43 43
44static void __devinit mvs_64xx_enable_xmt(struct mvs_info *mvi, int phy_id) 44static void mvs_64xx_enable_xmt(struct mvs_info *mvi, int phy_id)
45{ 45{
46 void __iomem *regs = mvi->regs; 46 void __iomem *regs = mvi->regs;
47 u32 tmp; 47 u32 tmp;
@@ -54,7 +54,7 @@ static void __devinit mvs_64xx_enable_xmt(struct mvs_info *mvi, int phy_id)
54 mw32(MVS_PCS, tmp); 54 mw32(MVS_PCS, tmp);
55} 55}
56 56
57static void __devinit mvs_64xx_phy_hacks(struct mvs_info *mvi) 57static void mvs_64xx_phy_hacks(struct mvs_info *mvi)
58{ 58{
59 void __iomem *regs = mvi->regs; 59 void __iomem *regs = mvi->regs;
60 int i; 60 int i;
@@ -156,7 +156,7 @@ void mvs_64xx_clear_srs_irq(struct mvs_info *mvi, u8 reg_set, u8 clear_all)
156 } 156 }
157} 157}
158 158
159static int __devinit mvs_64xx_chip_reset(struct mvs_info *mvi) 159static int mvs_64xx_chip_reset(struct mvs_info *mvi)
160{ 160{
161 void __iomem *regs = mvi->regs; 161 void __iomem *regs = mvi->regs;
162 u32 tmp; 162 u32 tmp;
@@ -250,7 +250,7 @@ static void mvs_64xx_phy_enable(struct mvs_info *mvi, u32 phy_id)
250 } 250 }
251} 251}
252 252
253static int __devinit mvs_64xx_init(struct mvs_info *mvi) 253static int mvs_64xx_init(struct mvs_info *mvi)
254{ 254{
255 void __iomem *regs = mvi->regs; 255 void __iomem *regs = mvi->regs;
256 int i; 256 int i;
diff --git a/drivers/scsi/mvsas/mv_94xx.c b/drivers/scsi/mvsas/mv_94xx.c
index 7e423e5ad5e1..1e4479f3331a 100644
--- a/drivers/scsi/mvsas/mv_94xx.c
+++ b/drivers/scsi/mvsas/mv_94xx.c
@@ -216,8 +216,7 @@ void set_phy_rate(struct mvs_info *mvi, int phy_id, u8 rate)
216 mvs_write_port_vsr_data(mvi, phy_id, phy_cfg.v); 216 mvs_write_port_vsr_data(mvi, phy_id, phy_cfg.v);
217} 217}
218 218
219static void __devinit 219static void mvs_94xx_config_reg_from_hba(struct mvs_info *mvi, int phy_id)
220mvs_94xx_config_reg_from_hba(struct mvs_info *mvi, int phy_id)
221{ 220{
222 u32 temp; 221 u32 temp;
223 temp = (u32)(*(u32 *)&mvi->hba_info_param.phy_tuning[phy_id]); 222 temp = (u32)(*(u32 *)&mvi->hba_info_param.phy_tuning[phy_id]);
@@ -258,7 +257,7 @@ mvs_94xx_config_reg_from_hba(struct mvs_info *mvi, int phy_id)
258 mvi->hba_info_param.phy_rate[phy_id]); 257 mvi->hba_info_param.phy_rate[phy_id]);
259} 258}
260 259
261static void __devinit mvs_94xx_enable_xmt(struct mvs_info *mvi, int phy_id) 260static void mvs_94xx_enable_xmt(struct mvs_info *mvi, int phy_id)
262{ 261{
263 void __iomem *regs = mvi->regs; 262 void __iomem *regs = mvi->regs;
264 u32 tmp; 263 u32 tmp;
@@ -331,7 +330,7 @@ static void mvs_94xx_phy_enable(struct mvs_info *mvi, u32 phy_id)
331 mvs_write_port_vsr_data(mvi, phy_id, tmp & 0xfd7fffff); 330 mvs_write_port_vsr_data(mvi, phy_id, tmp & 0xfd7fffff);
332} 331}
333 332
334static int __devinit mvs_94xx_init(struct mvs_info *mvi) 333static int mvs_94xx_init(struct mvs_info *mvi)
335{ 334{
336 void __iomem *regs = mvi->regs; 335 void __iomem *regs = mvi->regs;
337 int i; 336 int i;
diff --git a/drivers/scsi/mvsas/mv_chips.h b/drivers/scsi/mvsas/mv_chips.h
index bcc408042cee..8c4479ab49e8 100644
--- a/drivers/scsi/mvsas/mv_chips.h
+++ b/drivers/scsi/mvsas/mv_chips.h
@@ -160,7 +160,7 @@ static inline void mvs_write_port_irq_mask(struct mvs_info *mvi,
160 MVS_P4_INT_MASK, port, val); 160 MVS_P4_INT_MASK, port, val);
161} 161}
162 162
163static inline void __devinit mvs_phy_hacks(struct mvs_info *mvi) 163static inline void mvs_phy_hacks(struct mvs_info *mvi)
164{ 164{
165 u32 tmp; 165 u32 tmp;
166 166
diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c
index cc59dff3810b..ce90d0546cdd 100644
--- a/drivers/scsi/mvsas/mv_init.c
+++ b/drivers/scsi/mvsas/mv_init.c
@@ -96,7 +96,7 @@ static struct sas_domain_function_template mvs_transport_ops = {
96 96
97}; 97};
98 98
99static void __devinit mvs_phy_init(struct mvs_info *mvi, int phy_id) 99static void mvs_phy_init(struct mvs_info *mvi, int phy_id)
100{ 100{
101 struct mvs_phy *phy = &mvi->phy[phy_id]; 101 struct mvs_phy *phy = &mvi->phy[phy_id];
102 struct asd_sas_phy *sas_phy = &phy->sas_phy; 102 struct asd_sas_phy *sas_phy = &phy->sas_phy;
@@ -235,7 +235,7 @@ static irqreturn_t mvs_interrupt(int irq, void *opaque)
235 return IRQ_HANDLED; 235 return IRQ_HANDLED;
236} 236}
237 237
238static int __devinit mvs_alloc(struct mvs_info *mvi, struct Scsi_Host *shost) 238static int mvs_alloc(struct mvs_info *mvi, struct Scsi_Host *shost)
239{ 239{
240 int i = 0, slot_nr; 240 int i = 0, slot_nr;
241 char pool_name[32]; 241 char pool_name[32];
@@ -373,7 +373,7 @@ void mvs_iounmap(void __iomem *regs)
373 iounmap(regs); 373 iounmap(regs);
374} 374}
375 375
376static struct mvs_info *__devinit mvs_pci_alloc(struct pci_dev *pdev, 376static struct mvs_info *mvs_pci_alloc(struct pci_dev *pdev,
377 const struct pci_device_id *ent, 377 const struct pci_device_id *ent,
378 struct Scsi_Host *shost, unsigned int id) 378 struct Scsi_Host *shost, unsigned int id)
379{ 379{
@@ -444,7 +444,7 @@ static int pci_go_64(struct pci_dev *pdev)
444 return rc; 444 return rc;
445} 445}
446 446
447static int __devinit mvs_prep_sas_ha_init(struct Scsi_Host *shost, 447static int mvs_prep_sas_ha_init(struct Scsi_Host *shost,
448 const struct mvs_chip_info *chip_info) 448 const struct mvs_chip_info *chip_info)
449{ 449{
450 int phy_nr, port_nr; unsigned short core_nr; 450 int phy_nr, port_nr; unsigned short core_nr;
@@ -486,7 +486,7 @@ exit_free:
486 486
487} 487}
488 488
489static void __devinit mvs_post_sas_ha_init(struct Scsi_Host *shost, 489static void mvs_post_sas_ha_init(struct Scsi_Host *shost,
490 const struct mvs_chip_info *chip_info) 490 const struct mvs_chip_info *chip_info)
491{ 491{
492 int can_queue, i = 0, j = 0; 492 int can_queue, i = 0, j = 0;
@@ -537,8 +537,7 @@ static void mvs_init_sas_add(struct mvs_info *mvi)
537 memcpy(mvi->sas_addr, &mvi->phy[0].dev_sas_addr, SAS_ADDR_SIZE); 537 memcpy(mvi->sas_addr, &mvi->phy[0].dev_sas_addr, SAS_ADDR_SIZE);
538} 538}
539 539
540static int __devinit mvs_pci_init(struct pci_dev *pdev, 540static int mvs_pci_init(struct pci_dev *pdev, const struct pci_device_id *ent)
541 const struct pci_device_id *ent)
542{ 541{
543 unsigned int rc, nhost = 0; 542 unsigned int rc, nhost = 0;
544 struct mvs_info *mvi; 543 struct mvs_info *mvi;
@@ -645,7 +644,7 @@ err_out_enable:
645 return rc; 644 return rc;
646} 645}
647 646
648static void __devexit mvs_pci_remove(struct pci_dev *pdev) 647static void mvs_pci_remove(struct pci_dev *pdev)
649{ 648{
650 unsigned short core_nr, i = 0; 649 unsigned short core_nr, i = 0;
651 struct sas_ha_struct *sha = pci_get_drvdata(pdev); 650 struct sas_ha_struct *sha = pci_get_drvdata(pdev);
@@ -677,7 +676,7 @@ static void __devexit mvs_pci_remove(struct pci_dev *pdev)
677 return; 676 return;
678} 677}
679 678
680static struct pci_device_id __devinitdata mvs_pci_table[] = { 679static struct pci_device_id mvs_pci_table[] = {
681 { PCI_VDEVICE(MARVELL, 0x6320), chip_6320 }, 680 { PCI_VDEVICE(MARVELL, 0x6320), chip_6320 },
682 { PCI_VDEVICE(MARVELL, 0x6340), chip_6440 }, 681 { PCI_VDEVICE(MARVELL, 0x6340), chip_6440 },
683 { 682 {
@@ -748,7 +747,7 @@ static struct pci_driver mvs_pci_driver = {
748 .name = DRV_NAME, 747 .name = DRV_NAME,
749 .id_table = mvs_pci_table, 748 .id_table = mvs_pci_table,
750 .probe = mvs_pci_init, 749 .probe = mvs_pci_init,
751 .remove = __devexit_p(mvs_pci_remove), 750 .remove = mvs_pci_remove,
752}; 751};
753 752
754static ssize_t 753static ssize_t
diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
index a3776d6ced60..078c63913b55 100644
--- a/drivers/scsi/mvsas/mv_sas.c
+++ b/drivers/scsi/mvsas/mv_sas.c
@@ -220,8 +220,8 @@ int mvs_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func,
220 return rc; 220 return rc;
221} 221}
222 222
223void __devinit mvs_set_sas_addr(struct mvs_info *mvi, int port_id, 223void mvs_set_sas_addr(struct mvs_info *mvi, int port_id, u32 off_lo,
224 u32 off_lo, u32 off_hi, u64 sas_addr) 224 u32 off_hi, u64 sas_addr)
225{ 225{
226 u32 lo = (u32)sas_addr; 226 u32 lo = (u32)sas_addr;
227 u32 hi = (u32)(sas_addr>>32); 227 u32 hi = (u32)(sas_addr>>32);
diff --git a/drivers/scsi/mvsas/mv_sas.h b/drivers/scsi/mvsas/mv_sas.h
index da249553858c..2ae77a0394b2 100644
--- a/drivers/scsi/mvsas/mv_sas.h
+++ b/drivers/scsi/mvsas/mv_sas.h
@@ -456,8 +456,8 @@ int mvs_ioremap(struct mvs_info *mvi, int bar, int bar_ex);
456void mvs_phys_reset(struct mvs_info *mvi, u32 phy_mask, int hard); 456void mvs_phys_reset(struct mvs_info *mvi, u32 phy_mask, int hard);
457int mvs_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func, 457int mvs_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func,
458 void *funcdata); 458 void *funcdata);
459void __devinit mvs_set_sas_addr(struct mvs_info *mvi, int port_id, 459void mvs_set_sas_addr(struct mvs_info *mvi, int port_id, u32 off_lo,
460 u32 off_lo, u32 off_hi, u64 sas_addr); 460 u32 off_hi, u64 sas_addr);
461void mvs_scan_start(struct Scsi_Host *shost); 461void mvs_scan_start(struct Scsi_Host *shost);
462int mvs_scan_finished(struct Scsi_Host *shost, unsigned long time); 462int mvs_scan_finished(struct Scsi_Host *shost, unsigned long time);
463int mvs_queue_command(struct sas_task *task, const int num, 463int mvs_queue_command(struct sas_task *task, const int num,
diff --git a/drivers/scsi/mvumi.c b/drivers/scsi/mvumi.c
index c585a925b3cd..4594ccaaf49b 100644
--- a/drivers/scsi/mvumi.c
+++ b/drivers/scsi/mvumi.c
@@ -2506,8 +2506,7 @@ fail_add_device:
2506 * @pdev: PCI device structure 2506 * @pdev: PCI device structure
2507 * @id: PCI ids of supported hotplugged adapter 2507 * @id: PCI ids of supported hotplugged adapter
2508 */ 2508 */
2509static int __devinit mvumi_probe_one(struct pci_dev *pdev, 2509static int mvumi_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
2510 const struct pci_device_id *id)
2511{ 2510{
2512 struct Scsi_Host *host; 2511 struct Scsi_Host *host;
2513 struct mvumi_hba *mhba; 2512 struct mvumi_hba *mhba;
@@ -2728,7 +2727,7 @@ static struct pci_driver mvumi_pci_driver = {
2728 .name = MV_DRIVER_NAME, 2727 .name = MV_DRIVER_NAME,
2729 .id_table = mvumi_pci_table, 2728 .id_table = mvumi_pci_table,
2730 .probe = mvumi_probe_one, 2729 .probe = mvumi_probe_one,
2731 .remove = __devexit_p(mvumi_detach_one), 2730 .remove = mvumi_detach_one,
2732 .shutdown = mvumi_shutdown, 2731 .shutdown = mvumi_shutdown,
2733#ifdef CONFIG_PM 2732#ifdef CONFIG_PM
2734 .suspend = mvumi_suspend, 2733 .suspend = mvumi_suspend,
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
index 62b616891a33..1cc0c1c69c88 100644
--- a/drivers/scsi/nsp32.c
+++ b/drivers/scsi/nsp32.c
@@ -76,7 +76,7 @@ static const char *nsp32_release_version = "1.2";
76/**************************************************************************** 76/****************************************************************************
77 * Supported hardware 77 * Supported hardware
78 */ 78 */
79static struct pci_device_id nsp32_pci_table[] __devinitdata = { 79static struct pci_device_id nsp32_pci_table[] = {
80 { 80 {
81 .vendor = PCI_VENDOR_ID_IODATA, 81 .vendor = PCI_VENDOR_ID_IODATA,
82 .device = PCI_DEVICE_ID_NINJASCSI_32BI_CBSC_II, 82 .device = PCI_DEVICE_ID_NINJASCSI_32BI_CBSC_II,
@@ -186,10 +186,10 @@ static nsp32_sync_table nsp32_sync_table_pci[] = {
186 * function declaration 186 * function declaration
187 */ 187 */
188/* module entry point */ 188/* module entry point */
189static int __devinit nsp32_probe (struct pci_dev *, const struct pci_device_id *); 189static int nsp32_probe (struct pci_dev *, const struct pci_device_id *);
190static void __devexit nsp32_remove(struct pci_dev *); 190static void nsp32_remove(struct pci_dev *);
191static int __init init_nsp32 (void); 191static int __init init_nsp32 (void);
192static void __exit exit_nsp32 (void); 192static void __exit exit_nsp32 (void);
193 193
194/* struct struct scsi_host_template */ 194/* struct struct scsi_host_template */
195static int nsp32_proc_info (struct Scsi_Host *, char *, char **, off_t, int, int); 195static int nsp32_proc_info (struct Scsi_Host *, char *, char **, off_t, int, int);
@@ -3382,7 +3382,7 @@ static int nsp32_resume(struct pci_dev *pdev)
3382/************************************************************************ 3382/************************************************************************
3383 * PCI/Cardbus probe/remove routine 3383 * PCI/Cardbus probe/remove routine
3384 */ 3384 */
3385static int __devinit nsp32_probe(struct pci_dev *pdev, const struct pci_device_id *id) 3385static int nsp32_probe(struct pci_dev *pdev, const struct pci_device_id *id)
3386{ 3386{
3387 int ret; 3387 int ret;
3388 nsp32_hw_data *data = &nsp32_data_base; 3388 nsp32_hw_data *data = &nsp32_data_base;
@@ -3418,7 +3418,7 @@ static int __devinit nsp32_probe(struct pci_dev *pdev, const struct pci_device_i
3418 return ret; 3418 return ret;
3419} 3419}
3420 3420
3421static void __devexit nsp32_remove(struct pci_dev *pdev) 3421static void nsp32_remove(struct pci_dev *pdev)
3422{ 3422{
3423 struct Scsi_Host *host = pci_get_drvdata(pdev); 3423 struct Scsi_Host *host = pci_get_drvdata(pdev);
3424 3424
@@ -3435,7 +3435,7 @@ static struct pci_driver nsp32_driver = {
3435 .name = "nsp32", 3435 .name = "nsp32",
3436 .id_table = nsp32_pci_table, 3436 .id_table = nsp32_pci_table,
3437 .probe = nsp32_probe, 3437 .probe = nsp32_probe,
3438 .remove = __devexit_p(nsp32_remove), 3438 .remove = nsp32_remove,
3439#ifdef CONFIG_PM 3439#ifdef CONFIG_PM
3440 .suspend = nsp32_suspend, 3440 .suspend = nsp32_suspend,
3441 .resume = nsp32_resume, 3441 .resume = nsp32_resume,
diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
index bf54aafc2d71..b8dd05074abb 100644
--- a/drivers/scsi/pm8001/pm8001_hwi.c
+++ b/drivers/scsi/pm8001/pm8001_hwi.c
@@ -47,7 +47,7 @@
47 * read_main_config_table - read the configure table and save it. 47 * read_main_config_table - read the configure table and save it.
48 * @pm8001_ha: our hba card information 48 * @pm8001_ha: our hba card information
49 */ 49 */
50static void __devinit read_main_config_table(struct pm8001_hba_info *pm8001_ha) 50static void read_main_config_table(struct pm8001_hba_info *pm8001_ha)
51{ 51{
52 void __iomem *address = pm8001_ha->main_cfg_tbl_addr; 52 void __iomem *address = pm8001_ha->main_cfg_tbl_addr;
53 pm8001_ha->main_cfg_tbl.signature = pm8001_mr32(address, 0x00); 53 pm8001_ha->main_cfg_tbl.signature = pm8001_mr32(address, 0x00);
@@ -83,8 +83,7 @@ static void __devinit read_main_config_table(struct pm8001_hba_info *pm8001_ha)
83 * read_general_status_table - read the general status table and save it. 83 * read_general_status_table - read the general status table and save it.
84 * @pm8001_ha: our hba card information 84 * @pm8001_ha: our hba card information
85 */ 85 */
86static void __devinit 86static void read_general_status_table(struct pm8001_hba_info *pm8001_ha)
87read_general_status_table(struct pm8001_hba_info *pm8001_ha)
88{ 87{
89 void __iomem *address = pm8001_ha->general_stat_tbl_addr; 88 void __iomem *address = pm8001_ha->general_stat_tbl_addr;
90 pm8001_ha->gs_tbl.gst_len_mpistate = pm8001_mr32(address, 0x00); 89 pm8001_ha->gs_tbl.gst_len_mpistate = pm8001_mr32(address, 0x00);
@@ -118,8 +117,7 @@ read_general_status_table(struct pm8001_hba_info *pm8001_ha)
118 * read_inbnd_queue_table - read the inbound queue table and save it. 117 * read_inbnd_queue_table - read the inbound queue table and save it.
119 * @pm8001_ha: our hba card information 118 * @pm8001_ha: our hba card information
120 */ 119 */
121static void __devinit 120static void read_inbnd_queue_table(struct pm8001_hba_info *pm8001_ha)
122read_inbnd_queue_table(struct pm8001_hba_info *pm8001_ha)
123{ 121{
124 int inbQ_num = 1; 122 int inbQ_num = 1;
125 int i; 123 int i;
@@ -137,8 +135,7 @@ read_inbnd_queue_table(struct pm8001_hba_info *pm8001_ha)
137 * read_outbnd_queue_table - read the outbound queue table and save it. 135 * read_outbnd_queue_table - read the outbound queue table and save it.
138 * @pm8001_ha: our hba card information 136 * @pm8001_ha: our hba card information
139 */ 137 */
140static void __devinit 138static void read_outbnd_queue_table(struct pm8001_hba_info *pm8001_ha)
141read_outbnd_queue_table(struct pm8001_hba_info *pm8001_ha)
142{ 139{
143 int outbQ_num = 1; 140 int outbQ_num = 1;
144 int i; 141 int i;
@@ -156,8 +153,7 @@ read_outbnd_queue_table(struct pm8001_hba_info *pm8001_ha)
156 * init_default_table_values - init the default table. 153 * init_default_table_values - init the default table.
157 * @pm8001_ha: our hba card information 154 * @pm8001_ha: our hba card information
158 */ 155 */
159static void __devinit 156static void init_default_table_values(struct pm8001_hba_info *pm8001_ha)
160init_default_table_values(struct pm8001_hba_info *pm8001_ha)
161{ 157{
162 int qn = 1; 158 int qn = 1;
163 int i; 159 int i;
@@ -250,8 +246,7 @@ init_default_table_values(struct pm8001_hba_info *pm8001_ha)
250 * update_main_config_table - update the main default table to the HBA. 246 * update_main_config_table - update the main default table to the HBA.
251 * @pm8001_ha: our hba card information 247 * @pm8001_ha: our hba card information
252 */ 248 */
253static void __devinit 249static void update_main_config_table(struct pm8001_hba_info *pm8001_ha)
254update_main_config_table(struct pm8001_hba_info *pm8001_ha)
255{ 250{
256 void __iomem *address = pm8001_ha->main_cfg_tbl_addr; 251 void __iomem *address = pm8001_ha->main_cfg_tbl_addr;
257 pm8001_mw32(address, 0x24, 252 pm8001_mw32(address, 0x24,
@@ -297,8 +292,8 @@ update_main_config_table(struct pm8001_hba_info *pm8001_ha)
297 * update_inbnd_queue_table - update the inbound queue table to the HBA. 292 * update_inbnd_queue_table - update the inbound queue table to the HBA.
298 * @pm8001_ha: our hba card information 293 * @pm8001_ha: our hba card information
299 */ 294 */
300static void __devinit 295static void update_inbnd_queue_table(struct pm8001_hba_info *pm8001_ha,
301update_inbnd_queue_table(struct pm8001_hba_info *pm8001_ha, int number) 296 int number)
302{ 297{
303 void __iomem *address = pm8001_ha->inbnd_q_tbl_addr; 298 void __iomem *address = pm8001_ha->inbnd_q_tbl_addr;
304 u16 offset = number * 0x20; 299 u16 offset = number * 0x20;
@@ -318,8 +313,8 @@ update_inbnd_queue_table(struct pm8001_hba_info *pm8001_ha, int number)
318 * update_outbnd_queue_table - update the outbound queue table to the HBA. 313 * update_outbnd_queue_table - update the outbound queue table to the HBA.
319 * @pm8001_ha: our hba card information 314 * @pm8001_ha: our hba card information
320 */ 315 */
321static void __devinit 316static void update_outbnd_queue_table(struct pm8001_hba_info *pm8001_ha,
322update_outbnd_queue_table(struct pm8001_hba_info *pm8001_ha, int number) 317 int number)
323{ 318{
324 void __iomem *address = pm8001_ha->outbnd_q_tbl_addr; 319 void __iomem *address = pm8001_ha->outbnd_q_tbl_addr;
325 u16 offset = number * 0x24; 320 u16 offset = number * 0x24;
@@ -370,8 +365,8 @@ int pm8001_bar4_shift(struct pm8001_hba_info *pm8001_ha, u32 shiftValue)
370 * @pm8001_ha: our hba card information 365 * @pm8001_ha: our hba card information
371 * @SSCbit: set SSCbit to 0 to disable all phys ssc; 1 to enable all phys ssc. 366 * @SSCbit: set SSCbit to 0 to disable all phys ssc; 1 to enable all phys ssc.
372 */ 367 */
373static void __devinit 368static void mpi_set_phys_g3_with_ssc(struct pm8001_hba_info *pm8001_ha,
374mpi_set_phys_g3_with_ssc(struct pm8001_hba_info *pm8001_ha, u32 SSCbit) 369 u32 SSCbit)
375{ 370{
376 u32 value, offset, i; 371 u32 value, offset, i;
377 unsigned long flags; 372 unsigned long flags;
@@ -438,9 +433,8 @@ mpi_set_phys_g3_with_ssc(struct pm8001_hba_info *pm8001_ha, u32 SSCbit)
438 * @pm8001_ha: our hba card information 433 * @pm8001_ha: our hba card information
439 * @interval - interval time for each OPEN_REJECT (RETRY). The units are in 1us. 434 * @interval - interval time for each OPEN_REJECT (RETRY). The units are in 1us.
440 */ 435 */
441static void __devinit 436static void mpi_set_open_retry_interval_reg(struct pm8001_hba_info *pm8001_ha,
442mpi_set_open_retry_interval_reg(struct pm8001_hba_info *pm8001_ha, 437 u32 interval)
443 u32 interval)
444{ 438{
445 u32 offset; 439 u32 offset;
446 u32 value; 440 u32 value;
@@ -601,7 +595,7 @@ static void init_pci_device_addresses(struct pm8001_hba_info *pm8001_ha)
601 * pm8001_chip_init - the main init function that initialize whole PM8001 chip. 595 * pm8001_chip_init - the main init function that initialize whole PM8001 chip.
602 * @pm8001_ha: our hba card information 596 * @pm8001_ha: our hba card information
603 */ 597 */
604static int __devinit pm8001_chip_init(struct pm8001_hba_info *pm8001_ha) 598static int pm8001_chip_init(struct pm8001_hba_info *pm8001_ha)
605{ 599{
606 /* check the firmware status */ 600 /* check the firmware status */
607 if (-1 == check_fw_ready(pm8001_ha)) { 601 if (-1 == check_fw_ready(pm8001_ha)) {
diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c
index 0267c22f8741..4c9fe733fe88 100644
--- a/drivers/scsi/pm8001/pm8001_init.c
+++ b/drivers/scsi/pm8001/pm8001_init.c
@@ -104,8 +104,7 @@ static struct sas_domain_function_template pm8001_transport_ops = {
104 *@pm8001_ha: our hba structure. 104 *@pm8001_ha: our hba structure.
105 *@phy_id: phy id. 105 *@phy_id: phy id.
106 */ 106 */
107static void __devinit pm8001_phy_init(struct pm8001_hba_info *pm8001_ha, 107static void pm8001_phy_init(struct pm8001_hba_info *pm8001_ha, int phy_id)
108 int phy_id)
109{ 108{
110 struct pm8001_phy *phy = &pm8001_ha->phy[phy_id]; 109 struct pm8001_phy *phy = &pm8001_ha->phy[phy_id];
111 struct asd_sas_phy *sas_phy = &phy->sas_phy; 110 struct asd_sas_phy *sas_phy = &phy->sas_phy;
@@ -195,7 +194,7 @@ static irqreturn_t pm8001_interrupt(int irq, void *opaque)
195 * @pm8001_ha:our hba structure. 194 * @pm8001_ha:our hba structure.
196 * 195 *
197 */ 196 */
198static int __devinit pm8001_alloc(struct pm8001_hba_info *pm8001_ha) 197static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha)
199{ 198{
200 int i; 199 int i;
201 spin_lock_init(&pm8001_ha->lock); 200 spin_lock_init(&pm8001_ha->lock);
@@ -360,8 +359,9 @@ static int pm8001_ioremap(struct pm8001_hba_info *pm8001_ha)
360 * @ent: ent 359 * @ent: ent
361 * @shost: scsi host struct which has been initialized before. 360 * @shost: scsi host struct which has been initialized before.
362 */ 361 */
363static struct pm8001_hba_info *__devinit 362static struct pm8001_hba_info *pm8001_pci_alloc(struct pci_dev *pdev,
364pm8001_pci_alloc(struct pci_dev *pdev, u32 chip_id, struct Scsi_Host *shost) 363 u32 chip_id,
364 struct Scsi_Host *shost)
365{ 365{
366 struct pm8001_hba_info *pm8001_ha; 366 struct pm8001_hba_info *pm8001_ha;
367 struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); 367 struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
@@ -433,8 +433,8 @@ static int pci_go_44(struct pci_dev *pdev)
433 * @shost: scsi host which has been allocated outside. 433 * @shost: scsi host which has been allocated outside.
434 * @chip_info: our ha struct. 434 * @chip_info: our ha struct.
435 */ 435 */
436static int __devinit pm8001_prep_sas_ha_init(struct Scsi_Host * shost, 436static int pm8001_prep_sas_ha_init(struct Scsi_Host *shost,
437 const struct pm8001_chip_info *chip_info) 437 const struct pm8001_chip_info *chip_info)
438{ 438{
439 int phy_nr, port_nr; 439 int phy_nr, port_nr;
440 struct asd_sas_phy **arr_phy; 440 struct asd_sas_phy **arr_phy;
@@ -479,8 +479,8 @@ exit:
479 * @shost: scsi host which has been allocated outside 479 * @shost: scsi host which has been allocated outside
480 * @chip_info: our ha struct. 480 * @chip_info: our ha struct.
481 */ 481 */
482static void __devinit pm8001_post_sas_ha_init(struct Scsi_Host *shost, 482static void pm8001_post_sas_ha_init(struct Scsi_Host *shost,
483 const struct pm8001_chip_info *chip_info) 483 const struct pm8001_chip_info *chip_info)
484{ 484{
485 int i = 0; 485 int i = 0;
486 struct pm8001_hba_info *pm8001_ha; 486 struct pm8001_hba_info *pm8001_ha;
@@ -615,8 +615,8 @@ intx:
615 * pci driver it is invoked, all struct an hardware initilization should be done 615 * pci driver it is invoked, all struct an hardware initilization should be done
616 * here, also, register interrupt 616 * here, also, register interrupt
617 */ 617 */
618static int __devinit pm8001_pci_probe(struct pci_dev *pdev, 618static int pm8001_pci_probe(struct pci_dev *pdev,
619 const struct pci_device_id *ent) 619 const struct pci_device_id *ent)
620{ 620{
621 unsigned int rc; 621 unsigned int rc;
622 u32 pci_reg; 622 u32 pci_reg;
@@ -707,7 +707,7 @@ err_out_enable:
707 return rc; 707 return rc;
708} 708}
709 709
710static void __devexit pm8001_pci_remove(struct pci_dev *pdev) 710static void pm8001_pci_remove(struct pci_dev *pdev)
711{ 711{
712 struct sas_ha_struct *sha = pci_get_drvdata(pdev); 712 struct sas_ha_struct *sha = pci_get_drvdata(pdev);
713 struct pm8001_hba_info *pm8001_ha; 713 struct pm8001_hba_info *pm8001_ha;
@@ -842,7 +842,7 @@ err_out_enable:
842 return rc; 842 return rc;
843} 843}
844 844
845static struct pci_device_id __devinitdata pm8001_pci_table[] = { 845static struct pci_device_id pm8001_pci_table[] = {
846 { 846 {
847 PCI_VDEVICE(PMC_Sierra, 0x8001), chip_8001 847 PCI_VDEVICE(PMC_Sierra, 0x8001), chip_8001
848 }, 848 },
@@ -857,7 +857,7 @@ static struct pci_driver pm8001_pci_driver = {
857 .name = DRV_NAME, 857 .name = DRV_NAME,
858 .id_table = pm8001_pci_table, 858 .id_table = pm8001_pci_table,
859 .probe = pm8001_pci_probe, 859 .probe = pm8001_pci_probe,
860 .remove = __devexit_p(pm8001_pci_remove), 860 .remove = pm8001_pci_remove,
861 .suspend = pm8001_pci_suspend, 861 .suspend = pm8001_pci_suspend,
862 .resume = pm8001_pci_resume, 862 .resume = pm8001_pci_resume,
863}; 863};
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index af763eab2039..b46f5e906837 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -125,7 +125,7 @@ static struct pmcraid_chip_details pmcraid_chip_cfg[] = {
125/* 125/*
126 * PCI device ids supported by pmcraid driver 126 * PCI device ids supported by pmcraid driver
127 */ 127 */
128static struct pci_device_id pmcraid_pci_table[] __devinitdata = { 128static struct pci_device_id pmcraid_pci_table[] = {
129 { PCI_DEVICE(PCI_VENDOR_ID_PMC, PCI_DEVICE_ID_PMC_MAXRAID), 129 { PCI_DEVICE(PCI_VENDOR_ID_PMC, PCI_DEVICE_ID_PMC_MAXRAID),
130 0, 0, (kernel_ulong_t)&pmcraid_chip_cfg[0] 130 0, 0, (kernel_ulong_t)&pmcraid_chip_cfg[0]
131 }, 131 },
@@ -4818,8 +4818,7 @@ pmcraid_release_control_blocks(
4818 * Return Value 4818 * Return Value
4819 * 0 in case of success; -ENOMEM in case of failure 4819 * 0 in case of success; -ENOMEM in case of failure
4820 */ 4820 */
4821static int __devinit 4821static int pmcraid_allocate_cmd_blocks(struct pmcraid_instance *pinstance)
4822pmcraid_allocate_cmd_blocks(struct pmcraid_instance *pinstance)
4823{ 4822{
4824 int i; 4823 int i;
4825 4824
@@ -4855,8 +4854,7 @@ pmcraid_allocate_cmd_blocks(struct pmcraid_instance *pinstance)
4855 * Return Value 4854 * Return Value
4856 * 0 in case it can allocate all control blocks, otherwise -ENOMEM 4855 * 0 in case it can allocate all control blocks, otherwise -ENOMEM
4857 */ 4856 */
4858static int __devinit 4857static int pmcraid_allocate_control_blocks(struct pmcraid_instance *pinstance)
4859pmcraid_allocate_control_blocks(struct pmcraid_instance *pinstance)
4860{ 4858{
4861 int i; 4859 int i;
4862 4860
@@ -4922,8 +4920,7 @@ pmcraid_release_host_rrqs(struct pmcraid_instance *pinstance, int maxindex)
4922 * Return value 4920 * Return value
4923 * 0 hrrq buffers are allocated, -ENOMEM otherwise. 4921 * 0 hrrq buffers are allocated, -ENOMEM otherwise.
4924 */ 4922 */
4925static int __devinit 4923static int pmcraid_allocate_host_rrqs(struct pmcraid_instance *pinstance)
4926pmcraid_allocate_host_rrqs(struct pmcraid_instance *pinstance)
4927{ 4924{
4928 int i, buffer_size; 4925 int i, buffer_size;
4929 4926
@@ -5062,8 +5059,7 @@ static void pmcraid_release_config_buffers(struct pmcraid_instance *pinstance)
5062 * Return Value 5059 * Return Value
5063 * 0 for successful allocation, -ENOMEM for any failure 5060 * 0 for successful allocation, -ENOMEM for any failure
5064 */ 5061 */
5065static int __devinit 5062static int pmcraid_allocate_config_buffers(struct pmcraid_instance *pinstance)
5066pmcraid_allocate_config_buffers(struct pmcraid_instance *pinstance)
5067{ 5063{
5068 int i; 5064 int i;
5069 5065
@@ -5181,7 +5177,7 @@ static void pmcraid_release_buffers(struct pmcraid_instance *pinstance)
5181 * Return Value 5177 * Return Value
5182 * 0 in case all of the blocks are allocated, -ENOMEM otherwise. 5178 * 0 in case all of the blocks are allocated, -ENOMEM otherwise.
5183 */ 5179 */
5184static int __devinit pmcraid_init_buffers(struct pmcraid_instance *pinstance) 5180static int pmcraid_init_buffers(struct pmcraid_instance *pinstance)
5185{ 5181{
5186 int i; 5182 int i;
5187 5183
@@ -5281,11 +5277,8 @@ static void pmcraid_reinit_buffers(struct pmcraid_instance *pinstance)
5281 * Return Value 5277 * Return Value
5282 * 0 on success, non-zero in case of any failure 5278 * 0 on success, non-zero in case of any failure
5283 */ 5279 */
5284static int __devinit pmcraid_init_instance( 5280static int pmcraid_init_instance(struct pci_dev *pdev, struct Scsi_Host *host,
5285 struct pci_dev *pdev, 5281 void __iomem *mapped_pci_addr)
5286 struct Scsi_Host *host,
5287 void __iomem *mapped_pci_addr
5288)
5289{ 5282{
5290 struct pmcraid_instance *pinstance = 5283 struct pmcraid_instance *pinstance =
5291 (struct pmcraid_instance *)host->hostdata; 5284 (struct pmcraid_instance *)host->hostdata;
@@ -5442,7 +5435,7 @@ static void pmcraid_release_chrdev(struct pmcraid_instance *pinstance)
5442 * Return value 5435 * Return value
5443 * none 5436 * none
5444 */ 5437 */
5445static void __devexit pmcraid_remove(struct pci_dev *pdev) 5438static void pmcraid_remove(struct pci_dev *pdev)
5446{ 5439{
5447 struct pmcraid_instance *pinstance = pci_get_drvdata(pdev); 5440 struct pmcraid_instance *pinstance = pci_get_drvdata(pdev);
5448 5441
@@ -5883,10 +5876,8 @@ static void pmcraid_querycfg(struct pmcraid_cmd *cmd)
5883 * returns 0 if the device is claimed and successfully configured. 5876 * returns 0 if the device is claimed and successfully configured.
5884 * returns non-zero error code in case of any failure 5877 * returns non-zero error code in case of any failure
5885 */ 5878 */
5886static int __devinit pmcraid_probe( 5879static int pmcraid_probe(struct pci_dev *pdev,
5887 struct pci_dev *pdev, 5880 const struct pci_device_id *dev_id)
5888 const struct pci_device_id *dev_id
5889)
5890{ 5881{
5891 struct pmcraid_instance *pinstance; 5882 struct pmcraid_instance *pinstance;
5892 struct Scsi_Host *host; 5883 struct Scsi_Host *host;
diff --git a/drivers/scsi/ps3rom.c b/drivers/scsi/ps3rom.c
index 959f10055be7..e6e2a30493e6 100644
--- a/drivers/scsi/ps3rom.c
+++ b/drivers/scsi/ps3rom.c
@@ -359,7 +359,7 @@ static struct scsi_host_template ps3rom_host_template = {
359}; 359};
360 360
361 361
362static int __devinit ps3rom_probe(struct ps3_system_bus_device *_dev) 362static int ps3rom_probe(struct ps3_system_bus_device *_dev)
363{ 363{
364 struct ps3_storage_device *dev = to_ps3_storage_device(&_dev->core); 364 struct ps3_storage_device *dev = to_ps3_storage_device(&_dev->core);
365 int error; 365 int error;
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index 538230be5cca..5a522c5bbd43 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -1438,7 +1438,7 @@ qla1280_return_status(struct response * sts, struct scsi_cmnd *cp)
1438 * Returns: 1438 * Returns:
1439 * 0 = success 1439 * 0 = success
1440 */ 1440 */
1441static int __devinit 1441static int
1442qla1280_initialize_adapter(struct scsi_qla_host *ha) 1442qla1280_initialize_adapter(struct scsi_qla_host *ha)
1443{ 1443{
1444 struct device_reg __iomem *reg; 1444 struct device_reg __iomem *reg;
@@ -4230,7 +4230,7 @@ static struct scsi_host_template qla1280_driver_template = {
4230}; 4230};
4231 4231
4232 4232
4233static int __devinit 4233static int
4234qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) 4234qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
4235{ 4235{
4236 int devnum = id->driver_data; 4236 int devnum = id->driver_data;
@@ -4399,7 +4399,7 @@ qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
4399} 4399}
4400 4400
4401 4401
4402static void __devexit 4402static void
4403qla1280_remove_one(struct pci_dev *pdev) 4403qla1280_remove_one(struct pci_dev *pdev)
4404{ 4404{
4405 struct Scsi_Host *host = pci_get_drvdata(pdev); 4405 struct Scsi_Host *host = pci_get_drvdata(pdev);
@@ -4433,7 +4433,7 @@ static struct pci_driver qla1280_pci_driver = {
4433 .name = "qla1280", 4433 .name = "qla1280",
4434 .id_table = qla1280_pci_tbl, 4434 .id_table = qla1280_pci_tbl,
4435 .probe = qla1280_probe_one, 4435 .probe = qla1280_probe_one,
4436 .remove = __devexit_p(qla1280_remove_one), 4436 .remove = qla1280_remove_one,
4437}; 4437};
4438 4438
4439static int __init 4439static int __init
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 3a1661cf8c1e..10d23f8b7036 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -2154,7 +2154,7 @@ qla2xxx_scan_finished(struct Scsi_Host *shost, unsigned long time)
2154/* 2154/*
2155 * PCI driver interface 2155 * PCI driver interface
2156 */ 2156 */
2157static int __devinit 2157static int
2158qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) 2158qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
2159{ 2159{
2160 int ret = -ENODEV; 2160 int ret = -ENODEV;
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index fbc546e893ac..4cec123a6a6a 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -5124,8 +5124,8 @@ void qla4xxx_build_ddb_list(struct scsi_qla_host *ha, int is_reset)
5124 * It returns zero if successful. It also initializes all data necessary for 5124 * It returns zero if successful. It also initializes all data necessary for
5125 * the driver. 5125 * the driver.
5126 **/ 5126 **/
5127static int __devinit qla4xxx_probe_adapter(struct pci_dev *pdev, 5127static int qla4xxx_probe_adapter(struct pci_dev *pdev,
5128 const struct pci_device_id *ent) 5128 const struct pci_device_id *ent)
5129{ 5129{
5130 int ret = -ENODEV, status; 5130 int ret = -ENODEV, status;
5131 struct Scsi_Host *host; 5131 struct Scsi_Host *host;
@@ -5464,7 +5464,7 @@ static void qla4xxx_destroy_fw_ddb_session(struct scsi_qla_host *ha)
5464 * qla4xxx_remove_adapter - callback function to remove adapter. 5464 * qla4xxx_remove_adapter - callback function to remove adapter.
5465 * @pci_dev: PCI device pointer 5465 * @pci_dev: PCI device pointer
5466 **/ 5466 **/
5467static void __devexit qla4xxx_remove_adapter(struct pci_dev *pdev) 5467static void qla4xxx_remove_adapter(struct pci_dev *pdev)
5468{ 5468{
5469 struct scsi_qla_host *ha; 5469 struct scsi_qla_host *ha;
5470 5470
diff --git a/drivers/scsi/qlogicfas.c b/drivers/scsi/qlogicfas.c
index 1e874f1fb5c6..13d628b56ff7 100644
--- a/drivers/scsi/qlogicfas.c
+++ b/drivers/scsi/qlogicfas.c
@@ -142,7 +142,7 @@ module_param_array(irq, int, NULL, 0);
142MODULE_PARM_DESC(iobase, "I/O address"); 142MODULE_PARM_DESC(iobase, "I/O address");
143MODULE_PARM_DESC(irq, "IRQ"); 143MODULE_PARM_DESC(irq, "IRQ");
144 144
145static int __devinit qlogicfas_detect(struct scsi_host_template *sht) 145static int qlogicfas_detect(struct scsi_host_template *sht)
146{ 146{
147 struct Scsi_Host *shost; 147 struct Scsi_Host *shost;
148 struct qlogicfas408_priv *priv; 148 struct qlogicfas408_priv *priv;
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
index 71fddbc60f18..6d48d30bed05 100644
--- a/drivers/scsi/qlogicpti.c
+++ b/drivers/scsi/qlogicpti.c
@@ -461,7 +461,7 @@ static int qlogicpti_reset_hardware(struct Scsi_Host *host)
461 461
462#define PTI_RESET_LIMIT 400 462#define PTI_RESET_LIMIT 400
463 463
464static int __devinit qlogicpti_load_firmware(struct qlogicpti *qpti) 464static int qlogicpti_load_firmware(struct qlogicpti *qpti)
465{ 465{
466 const struct firmware *fw; 466 const struct firmware *fw;
467 const char fwname[] = "qlogic/isp1000.bin"; 467 const char fwname[] = "qlogic/isp1000.bin";
@@ -670,7 +670,7 @@ static int qlogicpti_verify_tmon(struct qlogicpti *qpti)
670 670
671static irqreturn_t qpti_intr(int irq, void *dev_id); 671static irqreturn_t qpti_intr(int irq, void *dev_id);
672 672
673static void __devinit qpti_chain_add(struct qlogicpti *qpti) 673static void qpti_chain_add(struct qlogicpti *qpti)
674{ 674{
675 spin_lock_irq(&qptichain_lock); 675 spin_lock_irq(&qptichain_lock);
676 if (qptichain != NULL) { 676 if (qptichain != NULL) {
@@ -686,7 +686,7 @@ static void __devinit qpti_chain_add(struct qlogicpti *qpti)
686 spin_unlock_irq(&qptichain_lock); 686 spin_unlock_irq(&qptichain_lock);
687} 687}
688 688
689static void __devexit qpti_chain_del(struct qlogicpti *qpti) 689static void qpti_chain_del(struct qlogicpti *qpti)
690{ 690{
691 spin_lock_irq(&qptichain_lock); 691 spin_lock_irq(&qptichain_lock);
692 if (qptichain == qpti) { 692 if (qptichain == qpti) {
@@ -701,7 +701,7 @@ static void __devexit qpti_chain_del(struct qlogicpti *qpti)
701 spin_unlock_irq(&qptichain_lock); 701 spin_unlock_irq(&qptichain_lock);
702} 702}
703 703
704static int __devinit qpti_map_regs(struct qlogicpti *qpti) 704static int qpti_map_regs(struct qlogicpti *qpti)
705{ 705{
706 struct platform_device *op = qpti->op; 706 struct platform_device *op = qpti->op;
707 707
@@ -724,7 +724,7 @@ static int __devinit qpti_map_regs(struct qlogicpti *qpti)
724 return 0; 724 return 0;
725} 725}
726 726
727static int __devinit qpti_register_irq(struct qlogicpti *qpti) 727static int qpti_register_irq(struct qlogicpti *qpti)
728{ 728{
729 struct platform_device *op = qpti->op; 729 struct platform_device *op = qpti->op;
730 730
@@ -749,7 +749,7 @@ fail:
749 return -1; 749 return -1;
750} 750}
751 751
752static void __devinit qpti_get_scsi_id(struct qlogicpti *qpti) 752static void qpti_get_scsi_id(struct qlogicpti *qpti)
753{ 753{
754 struct platform_device *op = qpti->op; 754 struct platform_device *op = qpti->op;
755 struct device_node *dp; 755 struct device_node *dp;
@@ -803,7 +803,7 @@ static void qpti_get_clock(struct qlogicpti *qpti)
803/* The request and response queues must each be aligned 803/* The request and response queues must each be aligned
804 * on a page boundary. 804 * on a page boundary.
805 */ 805 */
806static int __devinit qpti_map_queues(struct qlogicpti *qpti) 806static int qpti_map_queues(struct qlogicpti *qpti)
807{ 807{
808 struct platform_device *op = qpti->op; 808 struct platform_device *op = qpti->op;
809 809
@@ -1292,7 +1292,7 @@ static struct scsi_host_template qpti_template = {
1292}; 1292};
1293 1293
1294static const struct of_device_id qpti_match[]; 1294static const struct of_device_id qpti_match[];
1295static int __devinit qpti_sbus_probe(struct platform_device *op) 1295static int qpti_sbus_probe(struct platform_device *op)
1296{ 1296{
1297 struct device_node *dp = op->dev.of_node; 1297 struct device_node *dp = op->dev.of_node;
1298 struct Scsi_Host *host; 1298 struct Scsi_Host *host;
@@ -1402,7 +1402,7 @@ fail_unlink:
1402 return -ENODEV; 1402 return -ENODEV;
1403} 1403}
1404 1404
1405static int __devexit qpti_sbus_remove(struct platform_device *op) 1405static int qpti_sbus_remove(struct platform_device *op)
1406{ 1406{
1407 struct qlogicpti *qpti = dev_get_drvdata(&op->dev); 1407 struct qlogicpti *qpti = dev_get_drvdata(&op->dev);
1408 1408
@@ -1459,7 +1459,7 @@ static struct platform_driver qpti_sbus_driver = {
1459 .of_match_table = qpti_match, 1459 .of_match_table = qpti_match,
1460 }, 1460 },
1461 .probe = qpti_sbus_probe, 1461 .probe = qpti_sbus_probe,
1462 .remove = __devexit_p(qpti_sbus_remove), 1462 .remove = qpti_sbus_remove,
1463}; 1463};
1464 1464
1465static int __init qpti_init(void) 1465static int __init qpti_init(void)
diff --git a/drivers/scsi/sgiwd93.c b/drivers/scsi/sgiwd93.c
index 3a9d85ca6047..a464d959f66e 100644
--- a/drivers/scsi/sgiwd93.c
+++ b/drivers/scsi/sgiwd93.c
@@ -226,7 +226,7 @@ static struct scsi_host_template sgiwd93_template = {
226 .use_clustering = DISABLE_CLUSTERING, 226 .use_clustering = DISABLE_CLUSTERING,
227}; 227};
228 228
229static int __devinit sgiwd93_probe(struct platform_device *pdev) 229static int sgiwd93_probe(struct platform_device *pdev)
230{ 230{
231 struct sgiwd93_platform_data *pd = pdev->dev.platform_data; 231 struct sgiwd93_platform_data *pd = pdev->dev.platform_data;
232 unsigned char *wdregs = pd->wdregs; 232 unsigned char *wdregs = pd->wdregs;
@@ -312,7 +312,7 @@ static int __exit sgiwd93_remove(struct platform_device *pdev)
312 312
313static struct platform_driver sgiwd93_driver = { 313static struct platform_driver sgiwd93_driver = {
314 .probe = sgiwd93_probe, 314 .probe = sgiwd93_probe,
315 .remove = __devexit_p(sgiwd93_remove), 315 .remove = sgiwd93_remove,
316 .driver = { 316 .driver = {
317 .name = "sgiwd93", 317 .name = "sgiwd93",
318 .owner = THIS_MODULE, 318 .owner = THIS_MODULE,
diff --git a/drivers/scsi/sim710.c b/drivers/scsi/sim710.c
index a318264a4ba1..3b3b56f4a830 100644
--- a/drivers/scsi/sim710.c
+++ b/drivers/scsi/sim710.c
@@ -94,9 +94,9 @@ static struct scsi_host_template sim710_driver_template = {
94 .module = THIS_MODULE, 94 .module = THIS_MODULE,
95}; 95};
96 96
97static __devinit int 97static int sim710_probe_common(struct device *dev, unsigned long base_addr,
98sim710_probe_common(struct device *dev, unsigned long base_addr, 98 int irq, int clock, int differential,
99 int irq, int clock, int differential, int scsi_id) 99 int scsi_id)
100{ 100{
101 struct Scsi_Host * host = NULL; 101 struct Scsi_Host * host = NULL;
102 struct NCR_700_Host_Parameters *hostdata = 102 struct NCR_700_Host_Parameters *hostdata =
@@ -153,8 +153,7 @@ sim710_probe_common(struct device *dev, unsigned long base_addr,
153 return -ENODEV; 153 return -ENODEV;
154} 154}
155 155
156static __devexit int 156static int sim710_device_remove(struct device *dev)
157sim710_device_remove(struct device *dev)
158{ 157{
159 struct Scsi_Host *host = dev_get_drvdata(dev); 158 struct Scsi_Host *host = dev_get_drvdata(dev);
160 struct NCR_700_Host_Parameters *hostdata = 159 struct NCR_700_Host_Parameters *hostdata =
@@ -221,7 +220,7 @@ static struct eisa_driver sim710_eisa_driver = {
221 .driver = { 220 .driver = {
222 .name = "sim710", 221 .name = "sim710",
223 .probe = sim710_eisa_probe, 222 .probe = sim710_eisa_probe,
224 .remove = __devexit_p(sim710_device_remove), 223 .remove = sim710_device_remove,
225 }, 224 },
226}; 225};
227#endif /* CONFIG_EISA */ 226#endif /* CONFIG_EISA */
diff --git a/drivers/scsi/sni_53c710.c b/drivers/scsi/sni_53c710.c
index cf51432f8e72..52d54e7425db 100644
--- a/drivers/scsi/sni_53c710.c
+++ b/drivers/scsi/sni_53c710.c
@@ -65,7 +65,7 @@ static struct scsi_host_template snirm710_template = {
65 .module = THIS_MODULE, 65 .module = THIS_MODULE,
66}; 66};
67 67
68static int __devinit snirm710_probe(struct platform_device *dev) 68static int snirm710_probe(struct platform_device *dev)
69{ 69{
70 unsigned long base; 70 unsigned long base;
71 struct NCR_700_Host_Parameters *hostdata; 71 struct NCR_700_Host_Parameters *hostdata;
@@ -134,7 +134,7 @@ static int __exit snirm710_driver_remove(struct platform_device *dev)
134 134
135static struct platform_driver snirm710_driver = { 135static struct platform_driver snirm710_driver = {
136 .probe = snirm710_probe, 136 .probe = snirm710_probe,
137 .remove = __devexit_p(snirm710_driver_remove), 137 .remove = snirm710_driver_remove,
138 .driver = { 138 .driver = {
139 .name = "snirm_53c710", 139 .name = "snirm_53c710",
140 .owner = THIS_MODULE, 140 .owner = THIS_MODULE,
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index 606215e54b88..325c31caa6e0 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -1540,8 +1540,7 @@ static void stex_free_irq(struct st_hba *hba)
1540 pci_disable_msi(pdev); 1540 pci_disable_msi(pdev);
1541} 1541}
1542 1542
1543static int __devinit 1543static int stex_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1544stex_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1545{ 1544{
1546 struct st_hba *hba; 1545 struct st_hba *hba;
1547 struct Scsi_Host *host; 1546 struct Scsi_Host *host;
@@ -1815,7 +1814,7 @@ static struct pci_driver stex_pci_driver = {
1815 .name = DRV_NAME, 1814 .name = DRV_NAME,
1816 .id_table = stex_pci_tbl, 1815 .id_table = stex_pci_tbl,
1817 .probe = stex_probe, 1816 .probe = stex_probe,
1818 .remove = __devexit_p(stex_remove), 1817 .remove = stex_remove,
1819 .shutdown = stex_shutdown, 1818 .shutdown = stex_shutdown,
1820}; 1819};
1821 1820
diff --git a/drivers/scsi/sun3x_esp.c b/drivers/scsi/sun3x_esp.c
index 0621037f0271..534eb96fc3a7 100644
--- a/drivers/scsi/sun3x_esp.c
+++ b/drivers/scsi/sun3x_esp.c
@@ -194,7 +194,7 @@ static const struct esp_driver_ops sun3x_esp_ops = {
194 .dma_error = sun3x_esp_dma_error, 194 .dma_error = sun3x_esp_dma_error,
195}; 195};
196 196
197static int __devinit esp_sun3x_probe(struct platform_device *dev) 197static int esp_sun3x_probe(struct platform_device *dev)
198{ 198{
199 struct scsi_host_template *tpnt = &scsi_esp_template; 199 struct scsi_host_template *tpnt = &scsi_esp_template;
200 struct Scsi_Host *host; 200 struct Scsi_Host *host;
@@ -268,7 +268,7 @@ fail:
268 return err; 268 return err;
269} 269}
270 270
271static int __devexit esp_sun3x_remove(struct platform_device *dev) 271static int esp_sun3x_remove(struct platform_device *dev)
272{ 272{
273 struct esp *esp = dev_get_drvdata(&dev->dev); 273 struct esp *esp = dev_get_drvdata(&dev->dev);
274 unsigned int irq = esp->host->irq; 274 unsigned int irq = esp->host->irq;
@@ -292,7 +292,7 @@ static int __devexit esp_sun3x_remove(struct platform_device *dev)
292 292
293static struct platform_driver esp_sun3x_driver = { 293static struct platform_driver esp_sun3x_driver = {
294 .probe = esp_sun3x_probe, 294 .probe = esp_sun3x_probe,
295 .remove = __devexit_p(esp_sun3x_remove), 295 .remove = esp_sun3x_remove,
296 .driver = { 296 .driver = {
297 .name = "sun3x_esp", 297 .name = "sun3x_esp",
298 .owner = THIS_MODULE, 298 .owner = THIS_MODULE,
diff --git a/drivers/scsi/sun_esp.c b/drivers/scsi/sun_esp.c
index 676fe9ac7f61..f2e68459f7ea 100644
--- a/drivers/scsi/sun_esp.c
+++ b/drivers/scsi/sun_esp.c
@@ -43,8 +43,7 @@ enum dvma_rev {
43 dvmahme 43 dvmahme
44}; 44};
45 45
46static int __devinit esp_sbus_setup_dma(struct esp *esp, 46static int esp_sbus_setup_dma(struct esp *esp, struct platform_device *dma_of)
47 struct platform_device *dma_of)
48{ 47{
49 esp->dma = dma_of; 48 esp->dma = dma_of;
50 49
@@ -79,7 +78,7 @@ static int __devinit esp_sbus_setup_dma(struct esp *esp,
79 78
80} 79}
81 80
82static int __devinit esp_sbus_map_regs(struct esp *esp, int hme) 81static int esp_sbus_map_regs(struct esp *esp, int hme)
83{ 82{
84 struct platform_device *op = esp->dev; 83 struct platform_device *op = esp->dev;
85 struct resource *res; 84 struct resource *res;
@@ -99,7 +98,7 @@ static int __devinit esp_sbus_map_regs(struct esp *esp, int hme)
99 return 0; 98 return 0;
100} 99}
101 100
102static int __devinit esp_sbus_map_command_block(struct esp *esp) 101static int esp_sbus_map_command_block(struct esp *esp)
103{ 102{
104 struct platform_device *op = esp->dev; 103 struct platform_device *op = esp->dev;
105 104
@@ -111,7 +110,7 @@ static int __devinit esp_sbus_map_command_block(struct esp *esp)
111 return 0; 110 return 0;
112} 111}
113 112
114static int __devinit esp_sbus_register_irq(struct esp *esp) 113static int esp_sbus_register_irq(struct esp *esp)
115{ 114{
116 struct Scsi_Host *host = esp->host; 115 struct Scsi_Host *host = esp->host;
117 struct platform_device *op = esp->dev; 116 struct platform_device *op = esp->dev;
@@ -120,7 +119,7 @@ static int __devinit esp_sbus_register_irq(struct esp *esp)
120 return request_irq(host->irq, scsi_esp_intr, IRQF_SHARED, "ESP", esp); 119 return request_irq(host->irq, scsi_esp_intr, IRQF_SHARED, "ESP", esp);
121} 120}
122 121
123static void __devinit esp_get_scsi_id(struct esp *esp, struct platform_device *espdma) 122static void esp_get_scsi_id(struct esp *esp, struct platform_device *espdma)
124{ 123{
125 struct platform_device *op = esp->dev; 124 struct platform_device *op = esp->dev;
126 struct device_node *dp; 125 struct device_node *dp;
@@ -142,7 +141,7 @@ done:
142 esp->scsi_id_mask = (1 << esp->scsi_id); 141 esp->scsi_id_mask = (1 << esp->scsi_id);
143} 142}
144 143
145static void __devinit esp_get_differential(struct esp *esp) 144static void esp_get_differential(struct esp *esp)
146{ 145{
147 struct platform_device *op = esp->dev; 146 struct platform_device *op = esp->dev;
148 struct device_node *dp; 147 struct device_node *dp;
@@ -154,7 +153,7 @@ static void __devinit esp_get_differential(struct esp *esp)
154 esp->flags &= ~ESP_FLAG_DIFFERENTIAL; 153 esp->flags &= ~ESP_FLAG_DIFFERENTIAL;
155} 154}
156 155
157static void __devinit esp_get_clock_params(struct esp *esp) 156static void esp_get_clock_params(struct esp *esp)
158{ 157{
159 struct platform_device *op = esp->dev; 158 struct platform_device *op = esp->dev;
160 struct device_node *bus_dp, *dp; 159 struct device_node *bus_dp, *dp;
@@ -170,7 +169,7 @@ static void __devinit esp_get_clock_params(struct esp *esp)
170 esp->cfreq = fmhz; 169 esp->cfreq = fmhz;
171} 170}
172 171
173static void __devinit esp_get_bursts(struct esp *esp, struct platform_device *dma_of) 172static void esp_get_bursts(struct esp *esp, struct platform_device *dma_of)
174{ 173{
175 struct device_node *dma_dp = dma_of->dev.of_node; 174 struct device_node *dma_dp = dma_of->dev.of_node;
176 struct platform_device *op = esp->dev; 175 struct platform_device *op = esp->dev;
@@ -195,7 +194,7 @@ static void __devinit esp_get_bursts(struct esp *esp, struct platform_device *dm
195 esp->bursts = bursts; 194 esp->bursts = bursts;
196} 195}
197 196
198static void __devinit esp_sbus_get_props(struct esp *esp, struct platform_device *espdma) 197static void esp_sbus_get_props(struct esp *esp, struct platform_device *espdma)
199{ 198{
200 esp_get_scsi_id(esp, espdma); 199 esp_get_scsi_id(esp, espdma);
201 esp_get_differential(esp); 200 esp_get_differential(esp);
@@ -487,9 +486,8 @@ static const struct esp_driver_ops sbus_esp_ops = {
487 .dma_error = sbus_esp_dma_error, 486 .dma_error = sbus_esp_dma_error,
488}; 487};
489 488
490static int __devinit esp_sbus_probe_one(struct platform_device *op, 489static int esp_sbus_probe_one(struct platform_device *op,
491 struct platform_device *espdma, 490 struct platform_device *espdma, int hme)
492 int hme)
493{ 491{
494 struct scsi_host_template *tpnt = &scsi_esp_template; 492 struct scsi_host_template *tpnt = &scsi_esp_template;
495 struct Scsi_Host *host; 493 struct Scsi_Host *host;
@@ -562,7 +560,7 @@ fail:
562 return err; 560 return err;
563} 561}
564 562
565static int __devinit esp_sbus_probe(struct platform_device *op) 563static int esp_sbus_probe(struct platform_device *op)
566{ 564{
567 struct device_node *dma_node = NULL; 565 struct device_node *dma_node = NULL;
568 struct device_node *dp = op->dev.of_node; 566 struct device_node *dp = op->dev.of_node;
@@ -585,7 +583,7 @@ static int __devinit esp_sbus_probe(struct platform_device *op)
585 return esp_sbus_probe_one(op, dma_of, hme); 583 return esp_sbus_probe_one(op, dma_of, hme);
586} 584}
587 585
588static int __devexit esp_sbus_remove(struct platform_device *op) 586static int esp_sbus_remove(struct platform_device *op)
589{ 587{
590 struct esp *esp = dev_get_drvdata(&op->dev); 588 struct esp *esp = dev_get_drvdata(&op->dev);
591 struct platform_device *dma_of = esp->dma; 589 struct platform_device *dma_of = esp->dma;
@@ -639,7 +637,7 @@ static struct platform_driver esp_sbus_driver = {
639 .of_match_table = esp_match, 637 .of_match_table = esp_match,
640 }, 638 },
641 .probe = esp_sbus_probe, 639 .probe = esp_sbus_probe,
642 .remove = __devexit_p(esp_sbus_remove), 640 .remove = esp_sbus_remove,
643}; 641};
644 642
645static int __init sunesp_init(void) 643static int __init sunesp_init(void)
diff --git a/drivers/scsi/sym53c416.c b/drivers/scsi/sym53c416.c
index ac4eca6a5328..0b7819f3e09b 100644
--- a/drivers/scsi/sym53c416.c
+++ b/drivers/scsi/sym53c416.c
@@ -581,7 +581,7 @@ static int sym53c416_test(int base)
581} 581}
582 582
583 583
584static struct isapnp_device_id id_table[] __devinitdata = { 584static struct isapnp_device_id id_table[] = {
585 { ISAPNP_ANY_ID, ISAPNP_ANY_ID, 585 { ISAPNP_ANY_ID, ISAPNP_ANY_ID,
586 ISAPNP_VENDOR('S','L','I'), ISAPNP_FUNCTION(0x4161), 0 }, 586 ISAPNP_VENDOR('S','L','I'), ISAPNP_FUNCTION(0x4161), 0 },
587 { ISAPNP_ANY_ID, ISAPNP_ANY_ID, 587 { ISAPNP_ANY_ID, ISAPNP_ANY_ID,
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
index e2b8e68b57e7..599568299fbe 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -1284,8 +1284,7 @@ static int sym53c8xx_proc_info(struct Scsi_Host *shost, char *buffer,
1284 * sym_free_resources() should be used instead of this function after calling 1284 * sym_free_resources() should be used instead of this function after calling
1285 * sym_attach(). 1285 * sym_attach().
1286 */ 1286 */
1287static void __devinit 1287static void sym_iounmap_device(struct sym_device *device)
1288sym_iounmap_device(struct sym_device *device)
1289{ 1288{
1290 if (device->s.ioaddr) 1289 if (device->s.ioaddr)
1291 pci_iounmap(device->pdev, device->s.ioaddr); 1290 pci_iounmap(device->pdev, device->s.ioaddr);
@@ -1325,8 +1324,8 @@ static void sym_free_resources(struct sym_hcb *np, struct pci_dev *pdev,
1325 * If all is OK, install interrupt handling and 1324 * If all is OK, install interrupt handling and
1326 * start the timer daemon. 1325 * start the timer daemon.
1327 */ 1326 */
1328static struct Scsi_Host * __devinit sym_attach(struct scsi_host_template *tpnt, 1327static struct Scsi_Host *sym_attach(struct scsi_host_template *tpnt, int unit,
1329 int unit, struct sym_device *dev) 1328 struct sym_device *dev)
1330{ 1329{
1331 struct sym_data *sym_data; 1330 struct sym_data *sym_data;
1332 struct sym_hcb *np = NULL; 1331 struct sym_hcb *np = NULL;
@@ -1481,7 +1480,7 @@ static struct Scsi_Host * __devinit sym_attach(struct scsi_host_template *tpnt,
1481 * Detect and try to read SYMBIOS and TEKRAM NVRAM. 1480 * Detect and try to read SYMBIOS and TEKRAM NVRAM.
1482 */ 1481 */
1483#if SYM_CONF_NVRAM_SUPPORT 1482#if SYM_CONF_NVRAM_SUPPORT
1484static void __devinit sym_get_nvram(struct sym_device *devp, struct sym_nvram *nvp) 1483static void sym_get_nvram(struct sym_device *devp, struct sym_nvram *nvp)
1485{ 1484{
1486 devp->nvram = nvp; 1485 devp->nvram = nvp;
1487 nvp->type = 0; 1486 nvp->type = 0;
@@ -1494,7 +1493,7 @@ static inline void sym_get_nvram(struct sym_device *devp, struct sym_nvram *nvp)
1494} 1493}
1495#endif /* SYM_CONF_NVRAM_SUPPORT */ 1494#endif /* SYM_CONF_NVRAM_SUPPORT */
1496 1495
1497static int __devinit sym_check_supported(struct sym_device *device) 1496static int sym_check_supported(struct sym_device *device)
1498{ 1497{
1499 struct sym_chip *chip; 1498 struct sym_chip *chip;
1500 struct pci_dev *pdev = device->pdev; 1499 struct pci_dev *pdev = device->pdev;
@@ -1531,7 +1530,7 @@ static int __devinit sym_check_supported(struct sym_device *device)
1531 * Ignore Symbios chips controlled by various RAID controllers. 1530 * Ignore Symbios chips controlled by various RAID controllers.
1532 * These controllers set value 0x52414944 at RAM end - 16. 1531 * These controllers set value 0x52414944 at RAM end - 16.
1533 */ 1532 */
1534static int __devinit sym_check_raid(struct sym_device *device) 1533static int sym_check_raid(struct sym_device *device)
1535{ 1534{
1536 unsigned int ram_size, ram_val; 1535 unsigned int ram_size, ram_val;
1537 1536
@@ -1552,7 +1551,7 @@ static int __devinit sym_check_raid(struct sym_device *device)
1552 return -ENODEV; 1551 return -ENODEV;
1553} 1552}
1554 1553
1555static int __devinit sym_set_workarounds(struct sym_device *device) 1554static int sym_set_workarounds(struct sym_device *device)
1556{ 1555{
1557 struct sym_chip *chip = &device->chip; 1556 struct sym_chip *chip = &device->chip;
1558 struct pci_dev *pdev = device->pdev; 1557 struct pci_dev *pdev = device->pdev;
@@ -1602,8 +1601,7 @@ static int __devinit sym_set_workarounds(struct sym_device *device)
1602/* 1601/*
1603 * Map HBA registers and on-chip SRAM (if present). 1602 * Map HBA registers and on-chip SRAM (if present).
1604 */ 1603 */
1605static int __devinit 1604static int sym_iomap_device(struct sym_device *device)
1606sym_iomap_device(struct sym_device *device)
1607{ 1605{
1608 struct pci_dev *pdev = device->pdev; 1606 struct pci_dev *pdev = device->pdev;
1609 struct pci_bus_region bus_addr; 1607 struct pci_bus_region bus_addr;
@@ -1751,8 +1749,7 @@ static struct scsi_host_template sym2_template = {
1751 1749
1752static int attach_count; 1750static int attach_count;
1753 1751
1754static int __devinit sym2_probe(struct pci_dev *pdev, 1752static int sym2_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1755 const struct pci_device_id *ent)
1756{ 1753{
1757 struct sym_device sym_dev; 1754 struct sym_device sym_dev;
1758 struct sym_nvram nvram; 1755 struct sym_nvram nvram;
@@ -2077,7 +2074,7 @@ static struct spi_function_template sym2_transport_functions = {
2077 .get_signalling = sym2_get_signalling, 2074 .get_signalling = sym2_get_signalling,
2078}; 2075};
2079 2076
2080static struct pci_device_id sym2_id_table[] __devinitdata = { 2077static struct pci_device_id sym2_id_table[] = {
2081 { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_NCR_53C810, 2078 { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_NCR_53C810,
2082 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, 2079 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
2083 { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_NCR_53C820, 2080 { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_NCR_53C820,
diff --git a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c
index a1baccce05f0..9327f5fcec4e 100644
--- a/drivers/scsi/tmscsim.c
+++ b/drivers/scsi/tmscsim.c
@@ -2219,7 +2219,7 @@ static struct scsi_host_template driver_template = {
2219 * 2219 *
2220 **********************************************************************/ 2220 **********************************************************************/
2221 2221
2222static void __devinit dc390_eeprom_prepare_read(struct pci_dev *pdev, u8 cmd) 2222static void dc390_eeprom_prepare_read(struct pci_dev *pdev, u8 cmd)
2223{ 2223{
2224 u8 carryFlag = 1, j = 0x80, bval; 2224 u8 carryFlag = 1, j = 0x80, bval;
2225 int i; 2225 int i;
@@ -2242,7 +2242,7 @@ static void __devinit dc390_eeprom_prepare_read(struct pci_dev *pdev, u8 cmd)
2242 } 2242 }
2243} 2243}
2244 2244
2245static u16 __devinit dc390_eeprom_get_data(struct pci_dev *pdev) 2245static u16 dc390_eeprom_get_data(struct pci_dev *pdev)
2246{ 2246{
2247 int i; 2247 int i;
2248 u16 wval = 0; 2248 u16 wval = 0;
@@ -2264,7 +2264,7 @@ static u16 __devinit dc390_eeprom_get_data(struct pci_dev *pdev)
2264 return wval; 2264 return wval;
2265} 2265}
2266 2266
2267static void __devinit dc390_read_eeprom(struct pci_dev *pdev, u16 *ptr) 2267static void dc390_read_eeprom(struct pci_dev *pdev, u16 *ptr)
2268{ 2268{
2269 u8 cmd = EEPROM_READ, i; 2269 u8 cmd = EEPROM_READ, i;
2270 2270
@@ -2282,7 +2282,7 @@ static void __devinit dc390_read_eeprom(struct pci_dev *pdev, u16 *ptr)
2282} 2282}
2283 2283
2284/* Override EEprom values with explicitly set values */ 2284/* Override EEprom values with explicitly set values */
2285static void __devinit dc390_eeprom_override(u8 index) 2285static void dc390_eeprom_override(u8 index)
2286{ 2286{
2287 u8 *ptr = (u8 *) dc390_eepromBuf[index], id; 2287 u8 *ptr = (u8 *) dc390_eepromBuf[index], id;
2288 2288
@@ -2305,7 +2305,7 @@ static void __devinit dc390_eeprom_override(u8 index)
2305 } 2305 }
2306} 2306}
2307 2307
2308static int __devinitdata tmscsim_def[] = { 2308static int tmscsim_def[] = {
2309 7, 2309 7,
2310 0 /* 10MHz */, 2310 0 /* 10MHz */,
2311 PARITY_CHK_ | SEND_START_ | EN_DISCONNECT_ | SYNC_NEGO_ | TAG_QUEUEING_, 2311 PARITY_CHK_ | SEND_START_ | EN_DISCONNECT_ | SYNC_NEGO_ | TAG_QUEUEING_,
@@ -2315,7 +2315,7 @@ static int __devinitdata tmscsim_def[] = {
2315}; 2315};
2316 2316
2317/* Copy defaults over set values where missing */ 2317/* Copy defaults over set values where missing */
2318static void __devinit dc390_fill_with_defaults (void) 2318static void dc390_fill_with_defaults (void)
2319{ 2319{
2320 int i; 2320 int i;
2321 2321
@@ -2335,7 +2335,7 @@ static void __devinit dc390_fill_with_defaults (void)
2335 tmscsim[5] = 180; 2335 tmscsim[5] = 180;
2336} 2336}
2337 2337
2338static void __devinit dc390_check_eeprom(struct pci_dev *pdev, u8 index) 2338static void dc390_check_eeprom(struct pci_dev *pdev, u8 index)
2339{ 2339{
2340 u8 interpd[] = {1, 3, 5, 10, 16, 30, 60, 120}; 2340 u8 interpd[] = {1, 3, 5, 10, 16, 30, 60, 120};
2341 u8 EEbuf[128]; 2341 u8 EEbuf[128];
@@ -2372,7 +2372,7 @@ static void __devinit dc390_check_eeprom(struct pci_dev *pdev, u8 index)
2372 } 2372 }
2373} 2373}
2374 2374
2375static void __devinit dc390_init_hw(struct dc390_acb *pACB, u8 index) 2375static void dc390_init_hw(struct dc390_acb *pACB, u8 index)
2376{ 2376{
2377 struct Scsi_Host *shost = pACB->pScsiHost; 2377 struct Scsi_Host *shost = pACB->pScsiHost;
2378 u8 dstate; 2378 u8 dstate;
@@ -2422,8 +2422,7 @@ static void __devinit dc390_init_hw(struct dc390_acb *pACB, u8 index)
2422 DC390_write8(DMA_Status, dstate); 2422 DC390_write8(DMA_Status, dstate);
2423} 2423}
2424 2424
2425static int __devinit dc390_probe_one(struct pci_dev *pdev, 2425static int dc390_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
2426 const struct pci_device_id *id)
2427{ 2426{
2428 struct dc390_acb *pACB; 2427 struct dc390_acb *pACB;
2429 struct Scsi_Host *shost; 2428 struct Scsi_Host *shost;
@@ -2532,7 +2531,7 @@ static int __devinit dc390_probe_one(struct pci_dev *pdev,
2532 * 2531 *
2533 * @dev: The PCI device to remove. 2532 * @dev: The PCI device to remove.
2534 */ 2533 */
2535static void __devexit dc390_remove_one(struct pci_dev *dev) 2534static void dc390_remove_one(struct pci_dev *dev)
2536{ 2535{
2537 struct Scsi_Host *scsi_host = pci_get_drvdata(dev); 2536 struct Scsi_Host *scsi_host = pci_get_drvdata(dev);
2538 unsigned long iflags; 2537 unsigned long iflags;
@@ -2568,7 +2567,7 @@ static struct pci_driver dc390_driver = {
2568 .name = "tmscsim", 2567 .name = "tmscsim",
2569 .id_table = tmscsim_pci_tbl, 2568 .id_table = tmscsim_pci_tbl,
2570 .probe = dc390_probe_one, 2569 .probe = dc390_probe_one,
2571 .remove = __devexit_p(dc390_remove_one), 2570 .remove = dc390_remove_one,
2572}; 2571};
2573 2572
2574static int __init dc390_module_init(void) 2573static int __init dc390_module_init(void)
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 58f4ba6fe412..91a4046ca9ba 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -1811,8 +1811,7 @@ static int ufshcd_set_dma_mask(struct ufs_hba *hba)
1811 * 1811 *
1812 * Returns 0 on success, non-zero value on failure 1812 * Returns 0 on success, non-zero value on failure
1813 */ 1813 */
1814static int __devinit 1814static int ufshcd_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1815ufshcd_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1816{ 1815{
1817 struct Scsi_Host *host; 1816 struct Scsi_Host *host;
1818 struct ufs_hba *hba; 1817 struct ufs_hba *hba;
@@ -1947,7 +1946,7 @@ static struct pci_driver ufshcd_pci_driver = {
1947 .name = UFSHCD, 1946 .name = UFSHCD,
1948 .id_table = ufshcd_pci_tbl, 1947 .id_table = ufshcd_pci_tbl,
1949 .probe = ufshcd_probe, 1948 .probe = ufshcd_probe,
1950 .remove = __devexit_p(ufshcd_remove), 1949 .remove = ufshcd_remove,
1951 .shutdown = ufshcd_shutdown, 1950 .shutdown = ufshcd_shutdown,
1952#ifdef CONFIG_PM 1951#ifdef CONFIG_PM
1953 .suspend = ufshcd_suspend, 1952 .suspend = ufshcd_suspend,
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index 74ab67a169ec..3449a1f8c656 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -679,7 +679,7 @@ out:
679 return err; 679 return err;
680} 680}
681 681
682static int __devinit virtscsi_probe(struct virtio_device *vdev) 682static int virtscsi_probe(struct virtio_device *vdev)
683{ 683{
684 struct Scsi_Host *shost; 684 struct Scsi_Host *shost;
685 struct virtio_scsi *vscsi; 685 struct virtio_scsi *vscsi;
@@ -733,7 +733,7 @@ virtscsi_init_failed:
733 return err; 733 return err;
734} 734}
735 735
736static void __devexit virtscsi_remove(struct virtio_device *vdev) 736static void virtscsi_remove(struct virtio_device *vdev)
737{ 737{
738 struct Scsi_Host *shost = virtio_scsi_host(vdev); 738 struct Scsi_Host *shost = virtio_scsi_host(vdev);
739 struct virtio_scsi *vscsi = shost_priv(shost); 739 struct virtio_scsi *vscsi = shost_priv(shost);
@@ -785,7 +785,7 @@ static struct virtio_driver virtio_scsi_driver = {
785 .freeze = virtscsi_freeze, 785 .freeze = virtscsi_freeze,
786 .restore = virtscsi_restore, 786 .restore = virtscsi_restore,
787#endif 787#endif
788 .remove = __devexit_p(virtscsi_remove), 788 .remove = virtscsi_remove,
789}; 789};
790 790
791static int __init init(void) 791static int __init init(void)
diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c
index 20b3a483c2cc..3bfaa66fa0d1 100644
--- a/drivers/scsi/vmw_pvscsi.c
+++ b/drivers/scsi/vmw_pvscsi.c
@@ -397,7 +397,7 @@ static void pvscsi_unmap_buffers(const struct pvscsi_adapter *adapter,
397 SCSI_SENSE_BUFFERSIZE, PCI_DMA_FROMDEVICE); 397 SCSI_SENSE_BUFFERSIZE, PCI_DMA_FROMDEVICE);
398} 398}
399 399
400static int __devinit pvscsi_allocate_rings(struct pvscsi_adapter *adapter) 400static int pvscsi_allocate_rings(struct pvscsi_adapter *adapter)
401{ 401{
402 adapter->rings_state = pci_alloc_consistent(adapter->dev, PAGE_SIZE, 402 adapter->rings_state = pci_alloc_consistent(adapter->dev, PAGE_SIZE,
403 &adapter->ringStatePA); 403 &adapter->ringStatePA);
@@ -1152,7 +1152,7 @@ static void pvscsi_release_resources(struct pvscsi_adapter *adapter)
1152 * just use a statically allocated scatter list. 1152 * just use a statically allocated scatter list.
1153 * 1153 *
1154 */ 1154 */
1155static int __devinit pvscsi_allocate_sg(struct pvscsi_adapter *adapter) 1155static int pvscsi_allocate_sg(struct pvscsi_adapter *adapter)
1156{ 1156{
1157 struct pvscsi_ctx *ctx; 1157 struct pvscsi_ctx *ctx;
1158 int i; 1158 int i;
@@ -1233,8 +1233,7 @@ exit:
1233 return numPhys; 1233 return numPhys;
1234} 1234}
1235 1235
1236static int __devinit pvscsi_probe(struct pci_dev *pdev, 1236static int pvscsi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1237 const struct pci_device_id *id)
1238{ 1237{
1239 struct pvscsi_adapter *adapter; 1238 struct pvscsi_adapter *adapter;
1240 struct Scsi_Host *host; 1239 struct Scsi_Host *host;
@@ -1454,7 +1453,7 @@ static struct pci_driver pvscsi_pci_driver = {
1454 .name = "vmw_pvscsi", 1453 .name = "vmw_pvscsi",
1455 .id_table = pvscsi_pci_tbl, 1454 .id_table = pvscsi_pci_tbl,
1456 .probe = pvscsi_probe, 1455 .probe = pvscsi_probe,
1457 .remove = __devexit_p(pvscsi_remove), 1456 .remove = pvscsi_remove,
1458 .shutdown = pvscsi_shutdown, 1457 .shutdown = pvscsi_shutdown,
1459}; 1458};
1460 1459
diff --git a/drivers/scsi/zalon.c b/drivers/scsi/zalon.c
index 27e84e4b1fa9..97ccb0383539 100644
--- a/drivers/scsi/zalon.c
+++ b/drivers/scsi/zalon.c
@@ -182,7 +182,7 @@ static struct parisc_driver zalon_driver = {
182 .name = "zalon", 182 .name = "zalon",
183 .id_table = zalon_tbl, 183 .id_table = zalon_tbl,
184 .probe = zalon_probe, 184 .probe = zalon_probe,
185 .remove = __devexit_p(zalon_remove), 185 .remove = zalon_remove,
186}; 186};
187 187
188static int __init zalon7xx_init(void) 188static int __init zalon7xx_init(void)
diff --git a/drivers/scsi/zorro7xx.c b/drivers/scsi/zorro7xx.c
index e17764d71476..cbf3476c68cd 100644
--- a/drivers/scsi/zorro7xx.c
+++ b/drivers/scsi/zorro7xx.c
@@ -38,7 +38,7 @@ static struct zorro_driver_data {
38 const char *name; 38 const char *name;
39 unsigned long offset; 39 unsigned long offset;
40 int absolute; /* offset is absolute address */ 40 int absolute; /* offset is absolute address */
41} zorro7xx_driver_data[] __devinitdata = { 41} zorro7xx_driver_data[] = {
42 { .name = "PowerUP 603e+", .offset = 0xf40000, .absolute = 1 }, 42 { .name = "PowerUP 603e+", .offset = 0xf40000, .absolute = 1 },
43 { .name = "WarpEngine 40xx", .offset = 0x40000 }, 43 { .name = "WarpEngine 40xx", .offset = 0x40000 },
44 { .name = "A4091", .offset = 0x800000 }, 44 { .name = "A4091", .offset = 0x800000 },
@@ -46,7 +46,7 @@ static struct zorro_driver_data {
46 { 0 } 46 { 0 }
47}; 47};
48 48
49static struct zorro_device_id zorro7xx_zorro_tbl[] __devinitdata = { 49static struct zorro_device_id zorro7xx_zorro_tbl[] = {
50 { 50 {
51 .id = ZORRO_PROD_PHASE5_BLIZZARD_603E_PLUS, 51 .id = ZORRO_PROD_PHASE5_BLIZZARD_603E_PLUS,
52 .driver_data = (unsigned long)&zorro7xx_driver_data[0], 52 .driver_data = (unsigned long)&zorro7xx_driver_data[0],
@@ -71,8 +71,8 @@ static struct zorro_device_id zorro7xx_zorro_tbl[] __devinitdata = {
71}; 71};
72MODULE_DEVICE_TABLE(zorro, zorro7xx_zorro_tbl); 72MODULE_DEVICE_TABLE(zorro, zorro7xx_zorro_tbl);
73 73
74static int __devinit zorro7xx_init_one(struct zorro_dev *z, 74static int zorro7xx_init_one(struct zorro_dev *z,
75 const struct zorro_device_id *ent) 75 const struct zorro_device_id *ent)
76{ 76{
77 struct Scsi_Host *host; 77 struct Scsi_Host *host;
78 struct NCR_700_Host_Parameters *hostdata; 78 struct NCR_700_Host_Parameters *hostdata;
@@ -150,7 +150,7 @@ static int __devinit zorro7xx_init_one(struct zorro_dev *z,
150 return -ENODEV; 150 return -ENODEV;
151} 151}
152 152
153static __devexit void zorro7xx_remove_one(struct zorro_dev *z) 153static void zorro7xx_remove_one(struct zorro_dev *z)
154{ 154{
155 struct Scsi_Host *host = zorro_get_drvdata(z); 155 struct Scsi_Host *host = zorro_get_drvdata(z);
156 struct NCR_700_Host_Parameters *hostdata = shost_priv(host); 156 struct NCR_700_Host_Parameters *hostdata = shost_priv(host);
@@ -167,7 +167,7 @@ static struct zorro_driver zorro7xx_driver = {
167 .name = "zorro7xx-scsi", 167 .name = "zorro7xx-scsi",
168 .id_table = zorro7xx_zorro_tbl, 168 .id_table = zorro7xx_zorro_tbl,
169 .probe = zorro7xx_init_one, 169 .probe = zorro7xx_init_one,
170 .remove = __devexit_p(zorro7xx_remove_one), 170 .remove = zorro7xx_remove_one,
171}; 171};
172 172
173static int __init zorro7xx_scsi_init(void) 173static int __init zorro7xx_scsi_init(void)
diff --git a/drivers/sh/clk/cpg.c b/drivers/sh/clk/cpg.c
index 5aedcdf4ac5c..1ebe67cd1833 100644
--- a/drivers/sh/clk/cpg.c
+++ b/drivers/sh/clk/cpg.c
@@ -126,6 +126,12 @@ static int sh_clk_div_set_rate(struct clk *clk, unsigned long rate)
126 126
127static int sh_clk_div_enable(struct clk *clk) 127static int sh_clk_div_enable(struct clk *clk)
128{ 128{
129 if (clk->div_mask == SH_CLK_DIV6_MSK) {
130 int ret = sh_clk_div_set_rate(clk, clk->rate);
131 if (ret < 0)
132 return ret;
133 }
134
129 sh_clk_write(sh_clk_read(clk) & ~CPG_CKSTP_BIT, clk); 135 sh_clk_write(sh_clk_read(clk) & ~CPG_CKSTP_BIT, clk);
130 return 0; 136 return 0;
131} 137}
diff --git a/drivers/sh/pfc/gpio.c b/drivers/sh/pfc/gpio.c
index 038fa071382a..6a24f07c2013 100644
--- a/drivers/sh/pfc/gpio.c
+++ b/drivers/sh/pfc/gpio.c
@@ -165,7 +165,7 @@ static int sh_pfc_gpio_match(struct gpio_chip *gc, void *data)
165 return !!strstr(gc->label, data); 165 return !!strstr(gc->label, data);
166} 166}
167 167
168static int __devinit sh_pfc_gpio_probe(struct platform_device *pdev) 168static int sh_pfc_gpio_probe(struct platform_device *pdev)
169{ 169{
170 struct sh_pfc_chip *chip; 170 struct sh_pfc_chip *chip;
171 struct gpio_chip *gc; 171 struct gpio_chip *gc;
@@ -184,7 +184,7 @@ static int __devinit sh_pfc_gpio_probe(struct platform_device *pdev)
184 return 0; 184 return 0;
185} 185}
186 186
187static int __devexit sh_pfc_gpio_remove(struct platform_device *pdev) 187static int sh_pfc_gpio_remove(struct platform_device *pdev)
188{ 188{
189 struct sh_pfc_chip *chip = platform_get_drvdata(pdev); 189 struct sh_pfc_chip *chip = platform_get_drvdata(pdev);
190 int ret; 190 int ret;
@@ -199,7 +199,7 @@ static int __devexit sh_pfc_gpio_remove(struct platform_device *pdev)
199 199
200static struct platform_driver sh_pfc_gpio_driver = { 200static struct platform_driver sh_pfc_gpio_driver = {
201 .probe = sh_pfc_gpio_probe, 201 .probe = sh_pfc_gpio_probe,
202 .remove = __devexit_p(sh_pfc_gpio_remove), 202 .remove = sh_pfc_gpio_remove,
203 .driver = { 203 .driver = {
204 .name = KBUILD_MODNAME, 204 .name = KBUILD_MODNAME,
205 .owner = THIS_MODULE, 205 .owner = THIS_MODULE,
diff --git a/drivers/sh/pfc/pinctrl.c b/drivers/sh/pfc/pinctrl.c
index 0646bf6e7889..4109b769eac0 100644
--- a/drivers/sh/pfc/pinctrl.c
+++ b/drivers/sh/pfc/pinctrl.c
@@ -328,10 +328,10 @@ static struct pinctrl_desc sh_pfc_pinctrl_desc = {
328 .confops = &sh_pfc_pinconf_ops, 328 .confops = &sh_pfc_pinconf_ops,
329}; 329};
330 330
331static inline void __devinit sh_pfc_map_one_gpio(struct sh_pfc *pfc, 331static inline void sh_pfc_map_one_gpio(struct sh_pfc *pfc,
332 struct sh_pfc_pinctrl *pmx, 332 struct sh_pfc_pinctrl *pmx,
333 struct pinmux_gpio *gpio, 333 struct pinmux_gpio *gpio,
334 unsigned offset) 334 unsigned offset)
335{ 335{
336 struct pinmux_data_reg *dummy; 336 struct pinmux_data_reg *dummy;
337 unsigned long flags; 337 unsigned long flags;
@@ -351,8 +351,7 @@ static inline void __devinit sh_pfc_map_one_gpio(struct sh_pfc *pfc,
351} 351}
352 352
353/* pinmux ranges -> pinctrl pin descs */ 353/* pinmux ranges -> pinctrl pin descs */
354static int __devinit sh_pfc_map_gpios(struct sh_pfc *pfc, 354static int sh_pfc_map_gpios(struct sh_pfc *pfc, struct sh_pfc_pinctrl *pmx)
355 struct sh_pfc_pinctrl *pmx)
356{ 355{
357 unsigned long flags; 356 unsigned long flags;
358 int i; 357 int i;
@@ -396,8 +395,7 @@ static int __devinit sh_pfc_map_gpios(struct sh_pfc *pfc,
396 return 0; 395 return 0;
397} 396}
398 397
399static int __devinit sh_pfc_map_functions(struct sh_pfc *pfc, 398static int sh_pfc_map_functions(struct sh_pfc *pfc, struct sh_pfc_pinctrl *pmx)
400 struct sh_pfc_pinctrl *pmx)
401{ 399{
402 unsigned long flags; 400 unsigned long flags;
403 int i, fn; 401 int i, fn;
@@ -421,7 +419,7 @@ static int __devinit sh_pfc_map_functions(struct sh_pfc *pfc,
421 return 0; 419 return 0;
422} 420}
423 421
424static int __devinit sh_pfc_pinctrl_probe(struct platform_device *pdev) 422static int sh_pfc_pinctrl_probe(struct platform_device *pdev)
425{ 423{
426 struct sh_pfc *pfc; 424 struct sh_pfc *pfc;
427 int ret; 425 int ret;
@@ -465,7 +463,7 @@ free_pads:
465 return ret; 463 return ret;
466} 464}
467 465
468static int __devexit sh_pfc_pinctrl_remove(struct platform_device *pdev) 466static int sh_pfc_pinctrl_remove(struct platform_device *pdev)
469{ 467{
470 struct sh_pfc_pinctrl *pmx = platform_get_drvdata(pdev); 468 struct sh_pfc_pinctrl *pmx = platform_get_drvdata(pdev);
471 469
@@ -482,7 +480,7 @@ static int __devexit sh_pfc_pinctrl_remove(struct platform_device *pdev)
482 480
483static struct platform_driver sh_pfc_pinctrl_driver = { 481static struct platform_driver sh_pfc_pinctrl_driver = {
484 .probe = sh_pfc_pinctrl_probe, 482 .probe = sh_pfc_pinctrl_probe,
485 .remove = __devexit_p(sh_pfc_pinctrl_remove), 483 .remove = sh_pfc_pinctrl_remove,
486 .driver = { 484 .driver = {
487 .name = DRV_NAME, 485 .name = DRV_NAME,
488 .owner = THIS_MODULE, 486 .owner = THIS_MODULE,
diff --git a/drivers/sn/ioc3.c b/drivers/sn/ioc3.c
index b3b33fa26acd..fb7ea0d9a734 100644
--- a/drivers/sn/ioc3.c
+++ b/drivers/sn/ioc3.c
@@ -575,11 +575,10 @@ void ioc3_unregister_submodule(struct ioc3_submodule *is)
575 * Device management * 575 * Device management *
576 *********************/ 576 *********************/
577 577
578static char * __devinitdata 578static char *ioc3_class_names[] = { "unknown", "IP27 BaseIO", "IP30 system",
579ioc3_class_names[]={"unknown", "IP27 BaseIO", "IP30 system", "MENET 1/2/3", 579 "MENET 1/2/3", "MENET 4", "CADduo", "Altix Serial" };
580 "MENET 4", "CADduo", "Altix Serial"};
581 580
582static int __devinit ioc3_class(struct ioc3_driver_data *idd) 581static int ioc3_class(struct ioc3_driver_data *idd)
583{ 582{
584 int res = IOC3_CLASS_NONE; 583 int res = IOC3_CLASS_NONE;
585 /* NIC-based logic */ 584 /* NIC-based logic */
@@ -602,8 +601,7 @@ static int __devinit ioc3_class(struct ioc3_driver_data *idd)
602 return res; 601 return res;
603} 602}
604/* Adds a new instance of an IOC3 card */ 603/* Adds a new instance of an IOC3 card */
605static int __devinit 604static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
606ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
607{ 605{
608 struct ioc3_driver_data *idd; 606 struct ioc3_driver_data *idd;
609 uint32_t pcmd; 607 uint32_t pcmd;
@@ -755,7 +753,7 @@ out:
755} 753}
756 754
757/* Removes a particular instance of an IOC3 card. */ 755/* Removes a particular instance of an IOC3 card. */
758static void __devexit ioc3_remove(struct pci_dev *pdev) 756static void ioc3_remove(struct pci_dev *pdev)
759{ 757{
760 int id; 758 int id;
761 struct ioc3_driver_data *idd; 759 struct ioc3_driver_data *idd;
@@ -807,7 +805,7 @@ static struct pci_driver ioc3_driver = {
807 .name = "IOC3", 805 .name = "IOC3",
808 .id_table = ioc3_id_table, 806 .id_table = ioc3_id_table,
809 .probe = ioc3_probe, 807 .probe = ioc3_probe,
810 .remove = __devexit_p(ioc3_remove), 808 .remove = ioc3_remove,
811}; 809};
812 810
813MODULE_DEVICE_TABLE(pci, ioc3_id_table); 811MODULE_DEVICE_TABLE(pci, ioc3_id_table);
diff --git a/drivers/ssb/Kconfig b/drivers/ssb/Kconfig
index ff3c8a21f10d..5d6f2ec1c705 100644
--- a/drivers/ssb/Kconfig
+++ b/drivers/ssb/Kconfig
@@ -162,8 +162,7 @@ config SSB_DRIVER_GIGE
162 162
163config SSB_DRIVER_GPIO 163config SSB_DRIVER_GPIO
164 bool "SSB GPIO driver" 164 bool "SSB GPIO driver"
165 depends on SSB 165 depends on SSB && GPIOLIB
166 select GPIOLIB
167 help 166 help
168 Driver to provide access to the GPIO pins on the bus. 167 Driver to provide access to the GPIO pins on the bus.
169 168
diff --git a/drivers/ssb/driver_gige.c b/drivers/ssb/driver_gige.c
index f30ea689933a..21f71a1581fa 100644
--- a/drivers/ssb/driver_gige.c
+++ b/drivers/ssb/driver_gige.c
@@ -107,9 +107,8 @@ void gige_pcicfg_write32(struct ssb_gige *dev,
107 gige_write32(dev, SSB_GIGE_PCICFG + offset, value); 107 gige_write32(dev, SSB_GIGE_PCICFG + offset, value);
108} 108}
109 109
110static int __devinit ssb_gige_pci_read_config(struct pci_bus *bus, 110static int ssb_gige_pci_read_config(struct pci_bus *bus, unsigned int devfn,
111 unsigned int devfn, int reg, 111 int reg, int size, u32 *val)
112 int size, u32 *val)
113{ 112{
114 struct ssb_gige *dev = container_of(bus->ops, struct ssb_gige, pci_ops); 113 struct ssb_gige *dev = container_of(bus->ops, struct ssb_gige, pci_ops);
115 unsigned long flags; 114 unsigned long flags;
@@ -138,9 +137,8 @@ static int __devinit ssb_gige_pci_read_config(struct pci_bus *bus,
138 return PCIBIOS_SUCCESSFUL; 137 return PCIBIOS_SUCCESSFUL;
139} 138}
140 139
141static int __devinit ssb_gige_pci_write_config(struct pci_bus *bus, 140static int ssb_gige_pci_write_config(struct pci_bus *bus, unsigned int devfn,
142 unsigned int devfn, int reg, 141 int reg, int size, u32 val)
143 int size, u32 val)
144{ 142{
145 struct ssb_gige *dev = container_of(bus->ops, struct ssb_gige, pci_ops); 143 struct ssb_gige *dev = container_of(bus->ops, struct ssb_gige, pci_ops);
146 unsigned long flags; 144 unsigned long flags;
@@ -169,8 +167,8 @@ static int __devinit ssb_gige_pci_write_config(struct pci_bus *bus,
169 return PCIBIOS_SUCCESSFUL; 167 return PCIBIOS_SUCCESSFUL;
170} 168}
171 169
172static int __devinit ssb_gige_probe(struct ssb_device *sdev, 170static int ssb_gige_probe(struct ssb_device *sdev,
173 const struct ssb_device_id *id) 171 const struct ssb_device_id *id)
174{ 172{
175 struct ssb_gige *dev; 173 struct ssb_gige *dev;
176 u32 base, tmslow, tmshigh; 174 u32 base, tmslow, tmshigh;
diff --git a/drivers/ssb/driver_pcicore.c b/drivers/ssb/driver_pcicore.c
index 49d209173f55..59801d23d7ec 100644
--- a/drivers/ssb/driver_pcicore.c
+++ b/drivers/ssb/driver_pcicore.c
@@ -315,7 +315,7 @@ int ssb_pcicore_pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
315 return ssb_mips_irq(extpci_core->dev) + 2; 315 return ssb_mips_irq(extpci_core->dev) + 2;
316} 316}
317 317
318static void __devinit ssb_pcicore_init_hostmode(struct ssb_pcicore *pc) 318static void ssb_pcicore_init_hostmode(struct ssb_pcicore *pc)
319{ 319{
320 u32 val; 320 u32 val;
321 321
@@ -380,7 +380,7 @@ static void __devinit ssb_pcicore_init_hostmode(struct ssb_pcicore *pc)
380 register_pci_controller(&ssb_pcicore_controller); 380 register_pci_controller(&ssb_pcicore_controller);
381} 381}
382 382
383static int __devinit pcicore_is_in_hostmode(struct ssb_pcicore *pc) 383static int pcicore_is_in_hostmode(struct ssb_pcicore *pc)
384{ 384{
385 struct ssb_bus *bus = pc->dev->bus; 385 struct ssb_bus *bus = pc->dev->bus;
386 u16 chipid_top; 386 u16 chipid_top;
@@ -413,7 +413,7 @@ static int __devinit pcicore_is_in_hostmode(struct ssb_pcicore *pc)
413 * Workarounds. 413 * Workarounds.
414 **************************************************/ 414 **************************************************/
415 415
416static void __devinit ssb_pcicore_fix_sprom_core_index(struct ssb_pcicore *pc) 416static void ssb_pcicore_fix_sprom_core_index(struct ssb_pcicore *pc)
417{ 417{
418 u16 tmp = pcicore_read16(pc, SSB_PCICORE_SPROM(0)); 418 u16 tmp = pcicore_read16(pc, SSB_PCICORE_SPROM(0));
419 if (((tmp & 0xF000) >> 12) != pc->dev->core_index) { 419 if (((tmp & 0xF000) >> 12) != pc->dev->core_index) {
@@ -515,7 +515,7 @@ static void ssb_pcicore_pcie_setup_workarounds(struct ssb_pcicore *pc)
515 * Generic and Clientmode operation code. 515 * Generic and Clientmode operation code.
516 **************************************************/ 516 **************************************************/
517 517
518static void __devinit ssb_pcicore_init_clientmode(struct ssb_pcicore *pc) 518static void ssb_pcicore_init_clientmode(struct ssb_pcicore *pc)
519{ 519{
520 struct ssb_device *pdev = pc->dev; 520 struct ssb_device *pdev = pc->dev;
521 struct ssb_bus *bus = pdev->bus; 521 struct ssb_bus *bus = pdev->bus;
@@ -534,7 +534,7 @@ static void __devinit ssb_pcicore_init_clientmode(struct ssb_pcicore *pc)
534 } 534 }
535} 535}
536 536
537void __devinit ssb_pcicore_init(struct ssb_pcicore *pc) 537void ssb_pcicore_init(struct ssb_pcicore *pc)
538{ 538{
539 struct ssb_device *dev = pc->dev; 539 struct ssb_device *dev = pc->dev;
540 540
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c
index c82c5c95fe85..772ad9b5c304 100644
--- a/drivers/ssb/main.c
+++ b/drivers/ssb/main.c
@@ -548,7 +548,7 @@ error:
548} 548}
549 549
550/* Needs ssb_buses_lock() */ 550/* Needs ssb_buses_lock() */
551static int __devinit ssb_attach_queued_buses(void) 551static int ssb_attach_queued_buses(void)
552{ 552{
553 struct ssb_bus *bus, *n; 553 struct ssb_bus *bus, *n;
554 int err = 0; 554 int err = 0;
@@ -761,9 +761,9 @@ out:
761 return err; 761 return err;
762} 762}
763 763
764static int __devinit ssb_bus_register(struct ssb_bus *bus, 764static int ssb_bus_register(struct ssb_bus *bus,
765 ssb_invariants_func_t get_invariants, 765 ssb_invariants_func_t get_invariants,
766 unsigned long baseaddr) 766 unsigned long baseaddr)
767{ 767{
768 int err; 768 int err;
769 769
@@ -851,8 +851,7 @@ err_disable_xtal:
851} 851}
852 852
853#ifdef CONFIG_SSB_PCIHOST 853#ifdef CONFIG_SSB_PCIHOST
854int __devinit ssb_bus_pcibus_register(struct ssb_bus *bus, 854int ssb_bus_pcibus_register(struct ssb_bus *bus, struct pci_dev *host_pci)
855 struct pci_dev *host_pci)
856{ 855{
857 int err; 856 int err;
858 857
@@ -875,9 +874,9 @@ EXPORT_SYMBOL(ssb_bus_pcibus_register);
875#endif /* CONFIG_SSB_PCIHOST */ 874#endif /* CONFIG_SSB_PCIHOST */
876 875
877#ifdef CONFIG_SSB_PCMCIAHOST 876#ifdef CONFIG_SSB_PCMCIAHOST
878int __devinit ssb_bus_pcmciabus_register(struct ssb_bus *bus, 877int ssb_bus_pcmciabus_register(struct ssb_bus *bus,
879 struct pcmcia_device *pcmcia_dev, 878 struct pcmcia_device *pcmcia_dev,
880 unsigned long baseaddr) 879 unsigned long baseaddr)
881{ 880{
882 int err; 881 int err;
883 882
@@ -897,9 +896,8 @@ EXPORT_SYMBOL(ssb_bus_pcmciabus_register);
897#endif /* CONFIG_SSB_PCMCIAHOST */ 896#endif /* CONFIG_SSB_PCMCIAHOST */
898 897
899#ifdef CONFIG_SSB_SDIOHOST 898#ifdef CONFIG_SSB_SDIOHOST
900int __devinit ssb_bus_sdiobus_register(struct ssb_bus *bus, 899int ssb_bus_sdiobus_register(struct ssb_bus *bus, struct sdio_func *func,
901 struct sdio_func *func, 900 unsigned int quirks)
902 unsigned int quirks)
903{ 901{
904 int err; 902 int err;
905 903
@@ -919,9 +917,8 @@ int __devinit ssb_bus_sdiobus_register(struct ssb_bus *bus,
919EXPORT_SYMBOL(ssb_bus_sdiobus_register); 917EXPORT_SYMBOL(ssb_bus_sdiobus_register);
920#endif /* CONFIG_SSB_PCMCIAHOST */ 918#endif /* CONFIG_SSB_PCMCIAHOST */
921 919
922int __devinit ssb_bus_ssbbus_register(struct ssb_bus *bus, 920int ssb_bus_ssbbus_register(struct ssb_bus *bus, unsigned long baseaddr,
923 unsigned long baseaddr, 921 ssb_invariants_func_t get_invariants)
924 ssb_invariants_func_t get_invariants)
925{ 922{
926 int err; 923 int err;
927 924
diff --git a/drivers/ssb/pcihost_wrapper.c b/drivers/ssb/pcihost_wrapper.c
index af5448f5e2d2..32ed1fa4a82e 100644
--- a/drivers/ssb/pcihost_wrapper.c
+++ b/drivers/ssb/pcihost_wrapper.c
@@ -54,8 +54,8 @@ static int ssb_pcihost_resume(struct pci_dev *dev)
54# define ssb_pcihost_resume NULL 54# define ssb_pcihost_resume NULL
55#endif /* CONFIG_PM */ 55#endif /* CONFIG_PM */
56 56
57static int __devinit ssb_pcihost_probe(struct pci_dev *dev, 57static int ssb_pcihost_probe(struct pci_dev *dev,
58 const struct pci_device_id *id) 58 const struct pci_device_id *id)
59{ 59{
60 struct ssb_bus *ssb; 60 struct ssb_bus *ssb;
61 int err = -ENOMEM; 61 int err = -ENOMEM;
@@ -111,7 +111,7 @@ static void ssb_pcihost_remove(struct pci_dev *dev)
111 pci_set_drvdata(dev, NULL); 111 pci_set_drvdata(dev, NULL);
112} 112}
113 113
114int __devinit ssb_pcihost_register(struct pci_driver *driver) 114int ssb_pcihost_register(struct pci_driver *driver)
115{ 115{
116 driver->probe = ssb_pcihost_probe; 116 driver->probe = ssb_pcihost_probe;
117 driver->remove = ssb_pcihost_remove; 117 driver->remove = ssb_pcihost_remove;
diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig
index 7de2a10213bd..36eec320569c 100644
--- a/drivers/staging/comedi/Kconfig
+++ b/drivers/staging/comedi/Kconfig
@@ -444,6 +444,7 @@ config COMEDI_ADQ12B
444 444
445config COMEDI_NI_AT_A2150 445config COMEDI_NI_AT_A2150
446 tristate "NI AT-A2150 ISA card support" 446 tristate "NI AT-A2150 ISA card support"
447 select COMEDI_FC
447 depends on VIRT_TO_BUS 448 depends on VIRT_TO_BUS
448 ---help--- 449 ---help---
449 Enable support for National Instruments AT-A2150 cards 450 Enable support for National Instruments AT-A2150 cards
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index b7bba1790a20..9b038e4a7e71 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -1549,6 +1549,9 @@ static long comedi_unlocked_ioctl(struct file *file, unsigned int cmd,
1549 if (cmd == COMEDI_DEVCONFIG) { 1549 if (cmd == COMEDI_DEVCONFIG) {
1550 rc = do_devconfig_ioctl(dev, 1550 rc = do_devconfig_ioctl(dev,
1551 (struct comedi_devconfig __user *)arg); 1551 (struct comedi_devconfig __user *)arg);
1552 if (rc == 0)
1553 /* Evade comedi_auto_unconfig(). */
1554 dev_file_info->hardware_device = NULL;
1552 goto done; 1555 goto done;
1553 } 1556 }
1554 1557
diff --git a/drivers/staging/comedi/drivers/comedi_test.c b/drivers/staging/comedi/drivers/comedi_test.c
index fb3d09323ba1..01de996239f1 100644
--- a/drivers/staging/comedi/drivers/comedi_test.c
+++ b/drivers/staging/comedi/drivers/comedi_test.c
@@ -345,7 +345,7 @@ static int waveform_ai_cancel(struct comedi_device *dev,
345 struct waveform_private *devpriv = dev->private; 345 struct waveform_private *devpriv = dev->private;
346 346
347 devpriv->timer_running = 0; 347 devpriv->timer_running = 0;
348 del_timer(&devpriv->timer); 348 del_timer_sync(&devpriv->timer);
349 return 0; 349 return 0;
350} 350}
351 351
diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c b/drivers/staging/comedi/drivers/ni_pcimio.c
index aaac0b2cc9eb..fd1662b4175d 100644
--- a/drivers/staging/comedi/drivers/ni_pcimio.c
+++ b/drivers/staging/comedi/drivers/ni_pcimio.c
@@ -963,7 +963,7 @@ static const struct ni_board_struct ni_boards[] = {
963 .ao_range_table = &range_ni_M_625x_ao, 963 .ao_range_table = &range_ni_M_625x_ao,
964 .reg_type = ni_reg_625x, 964 .reg_type = ni_reg_625x,
965 .ao_unipolar = 0, 965 .ao_unipolar = 0,
966 .ao_speed = 357, 966 .ao_speed = 350,
967 .num_p0_dio_channels = 8, 967 .num_p0_dio_channels = 8,
968 .caldac = {caldac_none}, 968 .caldac = {caldac_none},
969 .has_8255 = 0, 969 .has_8255 = 0,
@@ -982,7 +982,7 @@ static const struct ni_board_struct ni_boards[] = {
982 .ao_range_table = &range_ni_M_625x_ao, 982 .ao_range_table = &range_ni_M_625x_ao,
983 .reg_type = ni_reg_625x, 983 .reg_type = ni_reg_625x,
984 .ao_unipolar = 0, 984 .ao_unipolar = 0,
985 .ao_speed = 357, 985 .ao_speed = 350,
986 .num_p0_dio_channels = 8, 986 .num_p0_dio_channels = 8,
987 .caldac = {caldac_none}, 987 .caldac = {caldac_none},
988 .has_8255 = 0, 988 .has_8255 = 0,
@@ -1001,7 +1001,7 @@ static const struct ni_board_struct ni_boards[] = {
1001 .ao_range_table = &range_ni_M_625x_ao, 1001 .ao_range_table = &range_ni_M_625x_ao,
1002 .reg_type = ni_reg_625x, 1002 .reg_type = ni_reg_625x,
1003 .ao_unipolar = 0, 1003 .ao_unipolar = 0,
1004 .ao_speed = 357, 1004 .ao_speed = 350,
1005 .num_p0_dio_channels = 8, 1005 .num_p0_dio_channels = 8,
1006 .caldac = {caldac_none}, 1006 .caldac = {caldac_none},
1007 .has_8255 = 0, 1007 .has_8255 = 0,
@@ -1037,7 +1037,7 @@ static const struct ni_board_struct ni_boards[] = {
1037 .ao_range_table = &range_ni_M_625x_ao, 1037 .ao_range_table = &range_ni_M_625x_ao,
1038 .reg_type = ni_reg_625x, 1038 .reg_type = ni_reg_625x,
1039 .ao_unipolar = 0, 1039 .ao_unipolar = 0,
1040 .ao_speed = 357, 1040 .ao_speed = 350,
1041 .num_p0_dio_channels = 32, 1041 .num_p0_dio_channels = 32,
1042 .caldac = {caldac_none}, 1042 .caldac = {caldac_none},
1043 .has_8255 = 0, 1043 .has_8255 = 0,
@@ -1056,7 +1056,7 @@ static const struct ni_board_struct ni_boards[] = {
1056 .ao_range_table = &range_ni_M_625x_ao, 1056 .ao_range_table = &range_ni_M_625x_ao,
1057 .reg_type = ni_reg_625x, 1057 .reg_type = ni_reg_625x,
1058 .ao_unipolar = 0, 1058 .ao_unipolar = 0,
1059 .ao_speed = 357, 1059 .ao_speed = 350,
1060 .num_p0_dio_channels = 32, 1060 .num_p0_dio_channels = 32,
1061 .caldac = {caldac_none}, 1061 .caldac = {caldac_none},
1062 .has_8255 = 0, 1062 .has_8255 = 0,
@@ -1092,7 +1092,7 @@ static const struct ni_board_struct ni_boards[] = {
1092 .ao_range_table = &range_ni_M_628x_ao, 1092 .ao_range_table = &range_ni_M_628x_ao,
1093 .reg_type = ni_reg_628x, 1093 .reg_type = ni_reg_628x,
1094 .ao_unipolar = 1, 1094 .ao_unipolar = 1,
1095 .ao_speed = 357, 1095 .ao_speed = 350,
1096 .num_p0_dio_channels = 8, 1096 .num_p0_dio_channels = 8,
1097 .caldac = {caldac_none}, 1097 .caldac = {caldac_none},
1098 .has_8255 = 0, 1098 .has_8255 = 0,
@@ -1111,7 +1111,7 @@ static const struct ni_board_struct ni_boards[] = {
1111 .ao_range_table = &range_ni_M_628x_ao, 1111 .ao_range_table = &range_ni_M_628x_ao,
1112 .reg_type = ni_reg_628x, 1112 .reg_type = ni_reg_628x,
1113 .ao_unipolar = 1, 1113 .ao_unipolar = 1,
1114 .ao_speed = 357, 1114 .ao_speed = 350,
1115 .num_p0_dio_channels = 8, 1115 .num_p0_dio_channels = 8,
1116 .caldac = {caldac_none}, 1116 .caldac = {caldac_none},
1117 .has_8255 = 0, 1117 .has_8255 = 0,
@@ -1147,7 +1147,7 @@ static const struct ni_board_struct ni_boards[] = {
1147 .ao_range_table = &range_ni_M_628x_ao, 1147 .ao_range_table = &range_ni_M_628x_ao,
1148 .reg_type = ni_reg_628x, 1148 .reg_type = ni_reg_628x,
1149 .ao_unipolar = 1, 1149 .ao_unipolar = 1,
1150 .ao_speed = 357, 1150 .ao_speed = 350,
1151 .num_p0_dio_channels = 32, 1151 .num_p0_dio_channels = 32,
1152 .caldac = {caldac_none}, 1152 .caldac = {caldac_none},
1153 .has_8255 = 0, 1153 .has_8255 = 0,
diff --git a/drivers/staging/fwserial/Kconfig b/drivers/staging/fwserial/Kconfig
index 580406cb1808..b2f8331e4acf 100644
--- a/drivers/staging/fwserial/Kconfig
+++ b/drivers/staging/fwserial/Kconfig
@@ -3,7 +3,9 @@ config FIREWIRE_SERIAL
3 depends on FIREWIRE 3 depends on FIREWIRE
4 help 4 help
5 This enables TTY over IEEE 1394, providing high-speed serial 5 This enables TTY over IEEE 1394, providing high-speed serial
6 connectivity to cabled peers. 6 connectivity to cabled peers. This driver implements a
7 ad-hoc transport protocol and is currently limited to
8 Linux-to-Linux communication.
7 9
8 To compile this driver as a module, say M here: the module will 10 To compile this driver as a module, say M here: the module will
9 be called firewire-serial. 11 be called firewire-serial.
diff --git a/drivers/staging/fwserial/TODO b/drivers/staging/fwserial/TODO
index 726900548eae..8dae8fb25223 100644
--- a/drivers/staging/fwserial/TODO
+++ b/drivers/staging/fwserial/TODO
@@ -1,5 +1,5 @@
1TODOs 1TODOs prior to this driver moving out of staging
2----- 2------------------------------------------------
31. Implement retries for RCODE_BUSY, RCODE_NO_ACK and RCODE_SEND_ERROR 31. Implement retries for RCODE_BUSY, RCODE_NO_ACK and RCODE_SEND_ERROR
4 - I/O is handled asynchronously which presents some issues when error 4 - I/O is handled asynchronously which presents some issues when error
5 conditions occur. 5 conditions occur.
@@ -11,17 +11,9 @@ TODOs
11-- Issues with firewire stack -- 11-- Issues with firewire stack --
121. This driver uses the same unregistered vendor id that the firewire core does 121. This driver uses the same unregistered vendor id that the firewire core does
13 (0xd00d1e). Perhaps this could be exposed as a define in 13 (0xd00d1e). Perhaps this could be exposed as a define in
14 firewire-constants.h? 14 firewire.h?
152. MAX_ASYNC_PAYLOAD needs to be publicly exposed by core/ohci
16 - otherwise how will this driver know the max size of address window to
17 open for one packet write?
183. Maybe device_max_receive() and link_speed_to_max_payload() should be 153. Maybe device_max_receive() and link_speed_to_max_payload() should be
19 taken up by the firewire core? 16 taken up by the firewire core?
204. To avoid dropping rx data while still limiting the maximum buffering,
21 the size of the AR context must be known. How to expose this to drivers?
225. Explore if bigger AR context will reduce RCODE_BUSY responses
23 (or auto-grow to certain max size -- but this would require major surgery
24 as the current AR is contiguously mapped)
25 17
26-- Issues with TTY core -- 18-- Issues with TTY core --
27 1. Hack for alternate device name scheme 19 1. Hack for alternate device name scheme
diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c
index 61ee29083b26..d03a7f57e8d4 100644
--- a/drivers/staging/fwserial/fwserial.c
+++ b/drivers/staging/fwserial/fwserial.c
@@ -179,7 +179,7 @@ static void dump_profile(struct seq_file *m, struct stats *stats)
179/* Returns the max receive packet size for the given card */ 179/* Returns the max receive packet size for the given card */
180static inline int device_max_receive(struct fw_device *fw_device) 180static inline int device_max_receive(struct fw_device *fw_device)
181{ 181{
182 return 1 << (clamp_t(int, fw_device->max_rec, 8U, 13U) + 1); 182 return 1 << (clamp_t(int, fw_device->max_rec, 8U, 11U) + 1);
183} 183}
184 184
185static void fwtty_log_tx_error(struct fwtty_port *port, int rcode) 185static void fwtty_log_tx_error(struct fwtty_port *port, int rcode)
diff --git a/drivers/staging/fwserial/fwserial.h b/drivers/staging/fwserial/fwserial.h
index 8b572edf9563..caa1c1ea82d5 100644
--- a/drivers/staging/fwserial/fwserial.h
+++ b/drivers/staging/fwserial/fwserial.h
@@ -374,10 +374,10 @@ static inline void fwtty_bind_console(struct fwtty_port *port,
374 */ 374 */
375static inline int link_speed_to_max_payload(unsigned speed) 375static inline int link_speed_to_max_payload(unsigned speed)
376{ 376{
377 static const int max_async[] = { 307, 614, 1229, 2458, 4916, 9832, }; 377 static const int max_async[] = { 307, 614, 1229, 2458, };
378 BUILD_BUG_ON(ARRAY_SIZE(max_async) - 1 != SCODE_3200); 378 BUILD_BUG_ON(ARRAY_SIZE(max_async) - 1 != SCODE_800);
379 379
380 speed = clamp(speed, (unsigned) SCODE_100, (unsigned) SCODE_3200); 380 speed = clamp(speed, (unsigned) SCODE_100, (unsigned) SCODE_800);
381 if (limit_bw) 381 if (limit_bw)
382 return max_async[speed]; 382 return max_async[speed];
383 else 383 else
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
index fb31b457a56a..c5ceb9d90ea8 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -239,7 +239,7 @@ static irqreturn_t mxs_lradc_trigger_handler(int irq, void *p)
239 struct mxs_lradc *lradc = iio_priv(iio); 239 struct mxs_lradc *lradc = iio_priv(iio);
240 const uint32_t chan_value = LRADC_CH_ACCUMULATE | 240 const uint32_t chan_value = LRADC_CH_ACCUMULATE |
241 ((LRADC_DELAY_TIMER_LOOP - 1) << LRADC_CH_NUM_SAMPLES_OFFSET); 241 ((LRADC_DELAY_TIMER_LOOP - 1) << LRADC_CH_NUM_SAMPLES_OFFSET);
242 int i, j = 0; 242 unsigned int i, j = 0;
243 243
244 for_each_set_bit(i, iio->active_scan_mask, iio->masklength) { 244 for_each_set_bit(i, iio->active_scan_mask, iio->masklength) {
245 lradc->buffer[j] = readl(lradc->base + LRADC_CH(j)); 245 lradc->buffer[j] = readl(lradc->base + LRADC_CH(j));
diff --git a/drivers/staging/iio/gyro/Kconfig b/drivers/staging/iio/gyro/Kconfig
index ea295b25308c..87979a0d03a9 100644
--- a/drivers/staging/iio/gyro/Kconfig
+++ b/drivers/staging/iio/gyro/Kconfig
@@ -27,8 +27,8 @@ config ADIS16130
27config ADIS16260 27config ADIS16260
28 tristate "Analog Devices ADIS16260 Digital Gyroscope Sensor SPI driver" 28 tristate "Analog Devices ADIS16260 Digital Gyroscope Sensor SPI driver"
29 depends on SPI 29 depends on SPI
30 select IIO_TRIGGER if IIO_BUFFER 30 select IIO_ADIS_LIB
31 select IIO_SW_RING if IIO_BUFFER 31 select IIO_ADIS_LIB_BUFFER if IIO_BUFFER
32 help 32 help
33 Say yes here to build support for Analog Devices ADIS16260 ADIS16265 33 Say yes here to build support for Analog Devices ADIS16260 ADIS16265
34 ADIS16250 ADIS16255 and ADIS16251 programmable digital gyroscope sensors. 34 ADIS16250 ADIS16255 and ADIS16251 programmable digital gyroscope sensors.
diff --git a/drivers/staging/iio/gyro/adis16080_core.c b/drivers/staging/iio/gyro/adis16080_core.c
index 3525a68d6a75..41d7350d030f 100644
--- a/drivers/staging/iio/gyro/adis16080_core.c
+++ b/drivers/staging/iio/gyro/adis16080_core.c
@@ -69,7 +69,7 @@ static int adis16080_spi_read(struct iio_dev *indio_dev,
69 ret = spi_read(st->us, st->buf, 2); 69 ret = spi_read(st->us, st->buf, 2);
70 70
71 if (ret == 0) 71 if (ret == 0)
72 *val = ((st->buf[0] & 0xF) << 8) | st->buf[1]; 72 *val = sign_extend32(((st->buf[0] & 0xF) << 8) | st->buf[1], 11);
73 mutex_unlock(&st->buf_lock); 73 mutex_unlock(&st->buf_lock);
74 74
75 return ret; 75 return ret;
diff --git a/drivers/staging/imx-drm/imx-drm-core.c b/drivers/staging/imx-drm/imx-drm-core.c
index ecf0f44bc70e..cec19f1cf56c 100644
--- a/drivers/staging/imx-drm/imx-drm-core.c
+++ b/drivers/staging/imx-drm/imx-drm-core.c
@@ -584,7 +584,6 @@ int imx_drm_add_encoder(struct drm_encoder *encoder,
584 584
585 ret = imx_drm_encoder_register(imx_drm_encoder); 585 ret = imx_drm_encoder_register(imx_drm_encoder);
586 if (ret) { 586 if (ret) {
587 kfree(imx_drm_encoder);
588 ret = -ENOMEM; 587 ret = -ENOMEM;
589 goto err_register; 588 goto err_register;
590 } 589 }
diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-common.c b/drivers/staging/imx-drm/ipu-v3/ipu-common.c
index 677e665ca86d..f7059cddd7fd 100644
--- a/drivers/staging/imx-drm/ipu-v3/ipu-common.c
+++ b/drivers/staging/imx-drm/ipu-v3/ipu-common.c
@@ -1104,7 +1104,9 @@ static int ipu_probe(struct platform_device *pdev)
1104 if (ret) 1104 if (ret)
1105 goto out_failed_irq; 1105 goto out_failed_irq;
1106 1106
1107 ipu_reset(ipu); 1107 ret = ipu_reset(ipu);
1108 if (ret)
1109 goto out_failed_reset;
1108 1110
1109 /* Set MCU_T to divide MCU access window into 2 */ 1111 /* Set MCU_T to divide MCU access window into 2 */
1110 ipu_cm_write(ipu, 0x00400000L | (IPU_MCU_T_DEFAULT << 18), 1112 ipu_cm_write(ipu, 0x00400000L | (IPU_MCU_T_DEFAULT << 18),
@@ -1129,6 +1131,7 @@ failed_add_clients:
1129 ipu_submodules_exit(ipu); 1131 ipu_submodules_exit(ipu);
1130failed_submodules_init: 1132failed_submodules_init:
1131 ipu_irq_exit(ipu); 1133 ipu_irq_exit(ipu);
1134out_failed_reset:
1132out_failed_irq: 1135out_failed_irq:
1133 clk_disable_unprepare(ipu->clk); 1136 clk_disable_unprepare(ipu->clk);
1134failed_clk_get: 1137failed_clk_get:
diff --git a/drivers/staging/imx-drm/ipuv3-crtc.c b/drivers/staging/imx-drm/ipuv3-crtc.c
index 1892006526b5..4b3a019409b5 100644
--- a/drivers/staging/imx-drm/ipuv3-crtc.c
+++ b/drivers/staging/imx-drm/ipuv3-crtc.c
@@ -452,7 +452,7 @@ static int ipu_get_resources(struct ipu_crtc *ipu_crtc,
452 int ret; 452 int ret;
453 453
454 ipu_crtc->ipu_ch = ipu_idmac_get(ipu, pdata->dma[0]); 454 ipu_crtc->ipu_ch = ipu_idmac_get(ipu, pdata->dma[0]);
455 if (IS_ERR_OR_NULL(ipu_crtc->ipu_ch)) { 455 if (IS_ERR(ipu_crtc->ipu_ch)) {
456 ret = PTR_ERR(ipu_crtc->ipu_ch); 456 ret = PTR_ERR(ipu_crtc->ipu_ch);
457 goto err_out; 457 goto err_out;
458 } 458 }
@@ -472,7 +472,7 @@ static int ipu_get_resources(struct ipu_crtc *ipu_crtc,
472 if (pdata->dp >= 0) { 472 if (pdata->dp >= 0) {
473 ipu_crtc->dp = ipu_dp_get(ipu, pdata->dp); 473 ipu_crtc->dp = ipu_dp_get(ipu, pdata->dp);
474 if (IS_ERR(ipu_crtc->dp)) { 474 if (IS_ERR(ipu_crtc->dp)) {
475 ret = PTR_ERR(ipu_crtc->ipu_ch); 475 ret = PTR_ERR(ipu_crtc->dp);
476 goto err_out; 476 goto err_out;
477 } 477 }
478 } 478 }
@@ -548,6 +548,8 @@ static int ipu_drm_probe(struct platform_device *pdev)
548 ipu_crtc->dev = &pdev->dev; 548 ipu_crtc->dev = &pdev->dev;
549 549
550 ret = ipu_crtc_init(ipu_crtc, pdata); 550 ret = ipu_crtc_init(ipu_crtc, pdata);
551 if (ret)
552 return ret;
551 553
552 platform_set_drvdata(pdev, ipu_crtc); 554 platform_set_drvdata(pdev, ipu_crtc);
553 555
diff --git a/drivers/staging/omapdrm/Makefile b/drivers/staging/omapdrm/Makefile
index 1ca0e0016de4..d85e058f2845 100644
--- a/drivers/staging/omapdrm/Makefile
+++ b/drivers/staging/omapdrm/Makefile
@@ -5,6 +5,7 @@
5 5
6ccflags-y := -Iinclude/drm -Werror 6ccflags-y := -Iinclude/drm -Werror
7omapdrm-y := omap_drv.o \ 7omapdrm-y := omap_drv.o \
8 omap_irq.o \
8 omap_debugfs.o \ 9 omap_debugfs.o \
9 omap_crtc.o \ 10 omap_crtc.o \
10 omap_plane.o \ 11 omap_plane.o \
diff --git a/drivers/staging/omapdrm/TODO b/drivers/staging/omapdrm/TODO
index 938c7888ca31..abeeb00aaa12 100644
--- a/drivers/staging/omapdrm/TODO
+++ b/drivers/staging/omapdrm/TODO
@@ -17,9 +17,6 @@ TODO
17. Revisit GEM sync object infrastructure.. TTM has some framework for this 17. Revisit GEM sync object infrastructure.. TTM has some framework for this
18 already. Possibly this could be refactored out and made more common? 18 already. Possibly this could be refactored out and made more common?
19 There should be some way to do this with less wheel-reinvention. 19 There should be some way to do this with less wheel-reinvention.
20. Review DSS vs KMS mismatches. The omap_dss_device is sort of part encoder,
21 part connector. Which results in a bit of duct tape to fwd calls from
22 encoder to connector. Possibly this could be done a bit better.
23. Solve PM sequencing on resume. DMM/TILER must be reloaded before any 20. Solve PM sequencing on resume. DMM/TILER must be reloaded before any
24 access is made from any component in the system. Which means on suspend 21 access is made from any component in the system. Which means on suspend
25 CRTC's should be disabled, and on resume the LUT should be reprogrammed 22 CRTC's should be disabled, and on resume the LUT should be reprogrammed
diff --git a/drivers/staging/omapdrm/omap_connector.c b/drivers/staging/omapdrm/omap_connector.c
index 91edb3f96972..4cc9ee733c5f 100644
--- a/drivers/staging/omapdrm/omap_connector.c
+++ b/drivers/staging/omapdrm/omap_connector.c
@@ -31,9 +31,10 @@
31struct omap_connector { 31struct omap_connector {
32 struct drm_connector base; 32 struct drm_connector base;
33 struct omap_dss_device *dssdev; 33 struct omap_dss_device *dssdev;
34 struct drm_encoder *encoder;
34}; 35};
35 36
36static inline void copy_timings_omap_to_drm(struct drm_display_mode *mode, 37void copy_timings_omap_to_drm(struct drm_display_mode *mode,
37 struct omap_video_timings *timings) 38 struct omap_video_timings *timings)
38{ 39{
39 mode->clock = timings->pixel_clock; 40 mode->clock = timings->pixel_clock;
@@ -64,7 +65,7 @@ static inline void copy_timings_omap_to_drm(struct drm_display_mode *mode,
64 mode->flags |= DRM_MODE_FLAG_NVSYNC; 65 mode->flags |= DRM_MODE_FLAG_NVSYNC;
65} 66}
66 67
67static inline void copy_timings_drm_to_omap(struct omap_video_timings *timings, 68void copy_timings_drm_to_omap(struct omap_video_timings *timings,
68 struct drm_display_mode *mode) 69 struct drm_display_mode *mode)
69{ 70{
70 timings->pixel_clock = mode->clock; 71 timings->pixel_clock = mode->clock;
@@ -96,48 +97,7 @@ static inline void copy_timings_drm_to_omap(struct omap_video_timings *timings,
96 timings->sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES; 97 timings->sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES;
97} 98}
98 99
99static void omap_connector_dpms(struct drm_connector *connector, int mode) 100static enum drm_connector_status omap_connector_detect(
100{
101 struct omap_connector *omap_connector = to_omap_connector(connector);
102 struct omap_dss_device *dssdev = omap_connector->dssdev;
103 int old_dpms;
104
105 DBG("%s: %d", dssdev->name, mode);
106
107 old_dpms = connector->dpms;
108
109 /* from off to on, do from crtc to connector */
110 if (mode < old_dpms)
111 drm_helper_connector_dpms(connector, mode);
112
113 if (mode == DRM_MODE_DPMS_ON) {
114 /* store resume info for suspended displays */
115 switch (dssdev->state) {
116 case OMAP_DSS_DISPLAY_SUSPENDED:
117 dssdev->activate_after_resume = true;
118 break;
119 case OMAP_DSS_DISPLAY_DISABLED: {
120 int ret = dssdev->driver->enable(dssdev);
121 if (ret) {
122 DBG("%s: failed to enable: %d",
123 dssdev->name, ret);
124 dssdev->driver->disable(dssdev);
125 }
126 break;
127 }
128 default:
129 break;
130 }
131 } else {
132 /* TODO */
133 }
134
135 /* from on to off, do from connector to crtc */
136 if (mode > old_dpms)
137 drm_helper_connector_dpms(connector, mode);
138}
139
140enum drm_connector_status omap_connector_detect(
141 struct drm_connector *connector, bool force) 101 struct drm_connector *connector, bool force)
142{ 102{
143 struct omap_connector *omap_connector = to_omap_connector(connector); 103 struct omap_connector *omap_connector = to_omap_connector(connector);
@@ -164,8 +124,6 @@ static void omap_connector_destroy(struct drm_connector *connector)
164 struct omap_connector *omap_connector = to_omap_connector(connector); 124 struct omap_connector *omap_connector = to_omap_connector(connector);
165 struct omap_dss_device *dssdev = omap_connector->dssdev; 125 struct omap_dss_device *dssdev = omap_connector->dssdev;
166 126
167 dssdev->driver->disable(dssdev);
168
169 DBG("%s", omap_connector->dssdev->name); 127 DBG("%s", omap_connector->dssdev->name);
170 drm_sysfs_connector_remove(connector); 128 drm_sysfs_connector_remove(connector);
171 drm_connector_cleanup(connector); 129 drm_connector_cleanup(connector);
@@ -261,36 +219,12 @@ static int omap_connector_mode_valid(struct drm_connector *connector,
261struct drm_encoder *omap_connector_attached_encoder( 219struct drm_encoder *omap_connector_attached_encoder(
262 struct drm_connector *connector) 220 struct drm_connector *connector)
263{ 221{
264 int i;
265 struct omap_connector *omap_connector = to_omap_connector(connector); 222 struct omap_connector *omap_connector = to_omap_connector(connector);
266 223 return omap_connector->encoder;
267 for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) {
268 struct drm_mode_object *obj;
269
270 if (connector->encoder_ids[i] == 0)
271 break;
272
273 obj = drm_mode_object_find(connector->dev,
274 connector->encoder_ids[i],
275 DRM_MODE_OBJECT_ENCODER);
276
277 if (obj) {
278 struct drm_encoder *encoder = obj_to_encoder(obj);
279 struct omap_overlay_manager *mgr =
280 omap_encoder_get_manager(encoder);
281 DBG("%s: found %s", omap_connector->dssdev->name,
282 mgr->name);
283 return encoder;
284 }
285 }
286
287 DBG("%s: no encoder", omap_connector->dssdev->name);
288
289 return NULL;
290} 224}
291 225
292static const struct drm_connector_funcs omap_connector_funcs = { 226static const struct drm_connector_funcs omap_connector_funcs = {
293 .dpms = omap_connector_dpms, 227 .dpms = drm_helper_connector_dpms,
294 .detect = omap_connector_detect, 228 .detect = omap_connector_detect,
295 .fill_modes = drm_helper_probe_single_connector_modes, 229 .fill_modes = drm_helper_probe_single_connector_modes,
296 .destroy = omap_connector_destroy, 230 .destroy = omap_connector_destroy,
@@ -302,34 +236,6 @@ static const struct drm_connector_helper_funcs omap_connector_helper_funcs = {
302 .best_encoder = omap_connector_attached_encoder, 236 .best_encoder = omap_connector_attached_encoder,
303}; 237};
304 238
305/* called from encoder when mode is set, to propagate settings to the dssdev */
306void omap_connector_mode_set(struct drm_connector *connector,
307 struct drm_display_mode *mode)
308{
309 struct drm_device *dev = connector->dev;
310 struct omap_connector *omap_connector = to_omap_connector(connector);
311 struct omap_dss_device *dssdev = omap_connector->dssdev;
312 struct omap_dss_driver *dssdrv = dssdev->driver;
313 struct omap_video_timings timings = {0};
314
315 copy_timings_drm_to_omap(&timings, mode);
316
317 DBG("%s: set mode: %d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x",
318 omap_connector->dssdev->name,
319 mode->base.id, mode->name, mode->vrefresh, mode->clock,
320 mode->hdisplay, mode->hsync_start,
321 mode->hsync_end, mode->htotal,
322 mode->vdisplay, mode->vsync_start,
323 mode->vsync_end, mode->vtotal, mode->type, mode->flags);
324
325 if (dssdrv->check_timings(dssdev, &timings)) {
326 dev_err(dev->dev, "could not set timings\n");
327 return;
328 }
329
330 dssdrv->set_timings(dssdev, &timings);
331}
332
333/* flush an area of the framebuffer (in case of manual update display that 239/* flush an area of the framebuffer (in case of manual update display that
334 * is not automatically flushed) 240 * is not automatically flushed)
335 */ 241 */
@@ -344,7 +250,8 @@ void omap_connector_flush(struct drm_connector *connector,
344 250
345/* initialize connector */ 251/* initialize connector */
346struct drm_connector *omap_connector_init(struct drm_device *dev, 252struct drm_connector *omap_connector_init(struct drm_device *dev,
347 int connector_type, struct omap_dss_device *dssdev) 253 int connector_type, struct omap_dss_device *dssdev,
254 struct drm_encoder *encoder)
348{ 255{
349 struct drm_connector *connector = NULL; 256 struct drm_connector *connector = NULL;
350 struct omap_connector *omap_connector; 257 struct omap_connector *omap_connector;
@@ -360,6 +267,8 @@ struct drm_connector *omap_connector_init(struct drm_device *dev,
360 } 267 }
361 268
362 omap_connector->dssdev = dssdev; 269 omap_connector->dssdev = dssdev;
270 omap_connector->encoder = encoder;
271
363 connector = &omap_connector->base; 272 connector = &omap_connector->base;
364 273
365 drm_connector_init(dev, connector, &omap_connector_funcs, 274 drm_connector_init(dev, connector, &omap_connector_funcs,
diff --git a/drivers/staging/omapdrm/omap_crtc.c b/drivers/staging/omapdrm/omap_crtc.c
index d87bd84257bd..5c6ed6040eff 100644
--- a/drivers/staging/omapdrm/omap_crtc.c
+++ b/drivers/staging/omapdrm/omap_crtc.c
@@ -28,19 +28,131 @@
28struct omap_crtc { 28struct omap_crtc {
29 struct drm_crtc base; 29 struct drm_crtc base;
30 struct drm_plane *plane; 30 struct drm_plane *plane;
31
31 const char *name; 32 const char *name;
32 int id; 33 int pipe;
34 enum omap_channel channel;
35 struct omap_overlay_manager_info info;
36
37 /*
38 * Temporary: eventually this will go away, but it is needed
39 * for now to keep the output's happy. (They only need
40 * mgr->id.) Eventually this will be replaced w/ something
41 * more common-panel-framework-y
42 */
43 struct omap_overlay_manager mgr;
44
45 struct omap_video_timings timings;
46 bool enabled;
47 bool full_update;
48
49 struct omap_drm_apply apply;
50
51 struct omap_drm_irq apply_irq;
52 struct omap_drm_irq error_irq;
53
54 /* list of in-progress apply's: */
55 struct list_head pending_applies;
56
57 /* list of queued apply's: */
58 struct list_head queued_applies;
59
60 /* for handling queued and in-progress applies: */
61 struct work_struct apply_work;
33 62
34 /* if there is a pending flip, these will be non-null: */ 63 /* if there is a pending flip, these will be non-null: */
35 struct drm_pending_vblank_event *event; 64 struct drm_pending_vblank_event *event;
36 struct drm_framebuffer *old_fb; 65 struct drm_framebuffer *old_fb;
66
67 /* for handling page flips without caring about what
68 * the callback is called from. Possibly we should just
69 * make omap_gem always call the cb from the worker so
70 * we don't have to care about this..
71 *
72 * XXX maybe fold into apply_work??
73 */
74 struct work_struct page_flip_work;
75};
76
77/*
78 * Manager-ops, callbacks from output when they need to configure
79 * the upstream part of the video pipe.
80 *
81 * Most of these we can ignore until we add support for command-mode
82 * panels.. for video-mode the crtc-helpers already do an adequate
83 * job of sequencing the setup of the video pipe in the proper order
84 */
85
86/* we can probably ignore these until we support command-mode panels: */
87static void omap_crtc_start_update(struct omap_overlay_manager *mgr)
88{
89}
90
91static int omap_crtc_enable(struct omap_overlay_manager *mgr)
92{
93 return 0;
94}
95
96static void omap_crtc_disable(struct omap_overlay_manager *mgr)
97{
98}
99
100static void omap_crtc_set_timings(struct omap_overlay_manager *mgr,
101 const struct omap_video_timings *timings)
102{
103 struct omap_crtc *omap_crtc = container_of(mgr, struct omap_crtc, mgr);
104 DBG("%s", omap_crtc->name);
105 omap_crtc->timings = *timings;
106 omap_crtc->full_update = true;
107}
108
109static void omap_crtc_set_lcd_config(struct omap_overlay_manager *mgr,
110 const struct dss_lcd_mgr_config *config)
111{
112 struct omap_crtc *omap_crtc = container_of(mgr, struct omap_crtc, mgr);
113 DBG("%s", omap_crtc->name);
114 dispc_mgr_set_lcd_config(omap_crtc->channel, config);
115}
116
117static int omap_crtc_register_framedone_handler(
118 struct omap_overlay_manager *mgr,
119 void (*handler)(void *), void *data)
120{
121 return 0;
122}
123
124static void omap_crtc_unregister_framedone_handler(
125 struct omap_overlay_manager *mgr,
126 void (*handler)(void *), void *data)
127{
128}
129
130static const struct dss_mgr_ops mgr_ops = {
131 .start_update = omap_crtc_start_update,
132 .enable = omap_crtc_enable,
133 .disable = omap_crtc_disable,
134 .set_timings = omap_crtc_set_timings,
135 .set_lcd_config = omap_crtc_set_lcd_config,
136 .register_framedone_handler = omap_crtc_register_framedone_handler,
137 .unregister_framedone_handler = omap_crtc_unregister_framedone_handler,
37}; 138};
38 139
140/*
141 * CRTC funcs:
142 */
143
39static void omap_crtc_destroy(struct drm_crtc *crtc) 144static void omap_crtc_destroy(struct drm_crtc *crtc)
40{ 145{
41 struct omap_crtc *omap_crtc = to_omap_crtc(crtc); 146 struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
147
148 DBG("%s", omap_crtc->name);
149
150 WARN_ON(omap_crtc->apply_irq.registered);
151 omap_irq_unregister(crtc->dev, &omap_crtc->error_irq);
152
42 omap_crtc->plane->funcs->destroy(omap_crtc->plane); 153 omap_crtc->plane->funcs->destroy(omap_crtc->plane);
43 drm_crtc_cleanup(crtc); 154 drm_crtc_cleanup(crtc);
155
44 kfree(omap_crtc); 156 kfree(omap_crtc);
45} 157}
46 158
@@ -48,14 +160,25 @@ static void omap_crtc_dpms(struct drm_crtc *crtc, int mode)
48{ 160{
49 struct omap_drm_private *priv = crtc->dev->dev_private; 161 struct omap_drm_private *priv = crtc->dev->dev_private;
50 struct omap_crtc *omap_crtc = to_omap_crtc(crtc); 162 struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
163 bool enabled = (mode == DRM_MODE_DPMS_ON);
51 int i; 164 int i;
52 165
53 WARN_ON(omap_plane_dpms(omap_crtc->plane, mode)); 166 DBG("%s: %d", omap_crtc->name, mode);
167
168 if (enabled != omap_crtc->enabled) {
169 omap_crtc->enabled = enabled;
170 omap_crtc->full_update = true;
171 omap_crtc_apply(crtc, &omap_crtc->apply);
54 172
55 for (i = 0; i < priv->num_planes; i++) { 173 /* also enable our private plane: */
56 struct drm_plane *plane = priv->planes[i]; 174 WARN_ON(omap_plane_dpms(omap_crtc->plane, mode));
57 if (plane->crtc == crtc) 175
58 WARN_ON(omap_plane_dpms(plane, mode)); 176 /* and any attached overlay planes: */
177 for (i = 0; i < priv->num_planes; i++) {
178 struct drm_plane *plane = priv->planes[i];
179 if (plane->crtc == crtc)
180 WARN_ON(omap_plane_dpms(plane, mode));
181 }
59 } 182 }
60} 183}
61 184
@@ -73,12 +196,26 @@ static int omap_crtc_mode_set(struct drm_crtc *crtc,
73 struct drm_framebuffer *old_fb) 196 struct drm_framebuffer *old_fb)
74{ 197{
75 struct omap_crtc *omap_crtc = to_omap_crtc(crtc); 198 struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
76 struct drm_plane *plane = omap_crtc->plane;
77 199
78 return omap_plane_mode_set(plane, crtc, crtc->fb, 200 mode = adjusted_mode;
201
202 DBG("%s: set mode: %d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x",
203 omap_crtc->name, mode->base.id, mode->name,
204 mode->vrefresh, mode->clock,
205 mode->hdisplay, mode->hsync_start,
206 mode->hsync_end, mode->htotal,
207 mode->vdisplay, mode->vsync_start,
208 mode->vsync_end, mode->vtotal,
209 mode->type, mode->flags);
210
211 copy_timings_drm_to_omap(&omap_crtc->timings, mode);
212 omap_crtc->full_update = true;
213
214 return omap_plane_mode_set(omap_crtc->plane, crtc, crtc->fb,
79 0, 0, mode->hdisplay, mode->vdisplay, 215 0, 0, mode->hdisplay, mode->vdisplay,
80 x << 16, y << 16, 216 x << 16, y << 16,
81 mode->hdisplay << 16, mode->vdisplay << 16); 217 mode->hdisplay << 16, mode->vdisplay << 16,
218 NULL, NULL);
82} 219}
83 220
84static void omap_crtc_prepare(struct drm_crtc *crtc) 221static void omap_crtc_prepare(struct drm_crtc *crtc)
@@ -102,10 +239,11 @@ static int omap_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
102 struct drm_plane *plane = omap_crtc->plane; 239 struct drm_plane *plane = omap_crtc->plane;
103 struct drm_display_mode *mode = &crtc->mode; 240 struct drm_display_mode *mode = &crtc->mode;
104 241
105 return plane->funcs->update_plane(plane, crtc, crtc->fb, 242 return omap_plane_mode_set(plane, crtc, crtc->fb,
106 0, 0, mode->hdisplay, mode->vdisplay, 243 0, 0, mode->hdisplay, mode->vdisplay,
107 x << 16, y << 16, 244 x << 16, y << 16,
108 mode->hdisplay << 16, mode->vdisplay << 16); 245 mode->hdisplay << 16, mode->vdisplay << 16,
246 NULL, NULL);
109} 247}
110 248
111static void omap_crtc_load_lut(struct drm_crtc *crtc) 249static void omap_crtc_load_lut(struct drm_crtc *crtc)
@@ -114,63 +252,54 @@ static void omap_crtc_load_lut(struct drm_crtc *crtc)
114 252
115static void vblank_cb(void *arg) 253static void vblank_cb(void *arg)
116{ 254{
117 static uint32_t sequence;
118 struct drm_crtc *crtc = arg; 255 struct drm_crtc *crtc = arg;
119 struct drm_device *dev = crtc->dev; 256 struct drm_device *dev = crtc->dev;
120 struct omap_crtc *omap_crtc = to_omap_crtc(crtc); 257 struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
121 struct drm_pending_vblank_event *event = omap_crtc->event;
122 unsigned long flags; 258 unsigned long flags;
123 struct timeval now;
124 259
125 WARN_ON(!event); 260 spin_lock_irqsave(&dev->event_lock, flags);
261
262 /* wakeup userspace */
263 if (omap_crtc->event)
264 drm_send_vblank_event(dev, omap_crtc->pipe, omap_crtc->event);
126 265
127 omap_crtc->event = NULL; 266 omap_crtc->event = NULL;
267 omap_crtc->old_fb = NULL;
128 268
129 /* wakeup userspace */ 269 spin_unlock_irqrestore(&dev->event_lock, flags);
130 if (event) {
131 do_gettimeofday(&now);
132
133 spin_lock_irqsave(&dev->event_lock, flags);
134 /* TODO: we can't yet use the vblank time accounting,
135 * because omapdss lower layer is the one that knows
136 * the irq # and registers the handler, which more or
137 * less defeats how drm_irq works.. for now just fake
138 * the sequence number and use gettimeofday..
139 *
140 event->event.sequence = drm_vblank_count_and_time(
141 dev, omap_crtc->id, &now);
142 */
143 event->event.sequence = sequence++;
144 event->event.tv_sec = now.tv_sec;
145 event->event.tv_usec = now.tv_usec;
146 list_add_tail(&event->base.link,
147 &event->base.file_priv->event_list);
148 wake_up_interruptible(&event->base.file_priv->event_wait);
149 spin_unlock_irqrestore(&dev->event_lock, flags);
150 }
151} 270}
152 271
153static void page_flip_cb(void *arg) 272static void page_flip_worker(struct work_struct *work)
154{ 273{
155 struct drm_crtc *crtc = arg; 274 struct omap_crtc *omap_crtc =
156 struct omap_crtc *omap_crtc = to_omap_crtc(crtc); 275 container_of(work, struct omap_crtc, page_flip_work);
157 struct drm_framebuffer *old_fb = omap_crtc->old_fb; 276 struct drm_crtc *crtc = &omap_crtc->base;
277 struct drm_device *dev = crtc->dev;
278 struct drm_display_mode *mode = &crtc->mode;
158 struct drm_gem_object *bo; 279 struct drm_gem_object *bo;
159 280
160 omap_crtc->old_fb = NULL; 281 mutex_lock(&dev->mode_config.mutex);
161 282 omap_plane_mode_set(omap_crtc->plane, crtc, crtc->fb,
162 omap_crtc_mode_set_base(crtc, crtc->x, crtc->y, old_fb); 283 0, 0, mode->hdisplay, mode->vdisplay,
163 284 crtc->x << 16, crtc->y << 16,
164 /* really we'd like to setup the callback atomically w/ setting the 285 mode->hdisplay << 16, mode->vdisplay << 16,
165 * new scanout buffer to avoid getting stuck waiting an extra vblank 286 vblank_cb, crtc);
166 * cycle.. for now go for correctness and later figure out speed.. 287 mutex_unlock(&dev->mode_config.mutex);
167 */
168 omap_plane_on_endwin(omap_crtc->plane, vblank_cb, crtc);
169 288
170 bo = omap_framebuffer_bo(crtc->fb, 0); 289 bo = omap_framebuffer_bo(crtc->fb, 0);
171 drm_gem_object_unreference_unlocked(bo); 290 drm_gem_object_unreference_unlocked(bo);
172} 291}
173 292
293static void page_flip_cb(void *arg)
294{
295 struct drm_crtc *crtc = arg;
296 struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
297 struct omap_drm_private *priv = crtc->dev->dev_private;
298
299 /* avoid assumptions about what ctxt we are called from: */
300 queue_work(priv->wq, &omap_crtc->page_flip_work);
301}
302
174static int omap_crtc_page_flip_locked(struct drm_crtc *crtc, 303static int omap_crtc_page_flip_locked(struct drm_crtc *crtc,
175 struct drm_framebuffer *fb, 304 struct drm_framebuffer *fb,
176 struct drm_pending_vblank_event *event) 305 struct drm_pending_vblank_event *event)
@@ -179,14 +308,14 @@ static int omap_crtc_page_flip_locked(struct drm_crtc *crtc,
179 struct omap_crtc *omap_crtc = to_omap_crtc(crtc); 308 struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
180 struct drm_gem_object *bo; 309 struct drm_gem_object *bo;
181 310
182 DBG("%d -> %d", crtc->fb ? crtc->fb->base.id : -1, fb->base.id); 311 DBG("%d -> %d (event=%p)", crtc->fb ? crtc->fb->base.id : -1,
312 fb->base.id, event);
183 313
184 if (omap_crtc->event) { 314 if (omap_crtc->old_fb) {
185 dev_err(dev->dev, "already a pending flip\n"); 315 dev_err(dev->dev, "already a pending flip\n");
186 return -EINVAL; 316 return -EINVAL;
187 } 317 }
188 318
189 omap_crtc->old_fb = crtc->fb;
190 omap_crtc->event = event; 319 omap_crtc->event = event;
191 crtc->fb = fb; 320 crtc->fb = fb;
192 321
@@ -234,14 +363,244 @@ static const struct drm_crtc_helper_funcs omap_crtc_helper_funcs = {
234 .load_lut = omap_crtc_load_lut, 363 .load_lut = omap_crtc_load_lut,
235}; 364};
236 365
366const struct omap_video_timings *omap_crtc_timings(struct drm_crtc *crtc)
367{
368 struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
369 return &omap_crtc->timings;
370}
371
372enum omap_channel omap_crtc_channel(struct drm_crtc *crtc)
373{
374 struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
375 return omap_crtc->channel;
376}
377
378static void omap_crtc_error_irq(struct omap_drm_irq *irq, uint32_t irqstatus)
379{
380 struct omap_crtc *omap_crtc =
381 container_of(irq, struct omap_crtc, error_irq);
382 struct drm_crtc *crtc = &omap_crtc->base;
383 DRM_ERROR("%s: errors: %08x\n", omap_crtc->name, irqstatus);
384 /* avoid getting in a flood, unregister the irq until next vblank */
385 omap_irq_unregister(crtc->dev, &omap_crtc->error_irq);
386}
387
388static void omap_crtc_apply_irq(struct omap_drm_irq *irq, uint32_t irqstatus)
389{
390 struct omap_crtc *omap_crtc =
391 container_of(irq, struct omap_crtc, apply_irq);
392 struct drm_crtc *crtc = &omap_crtc->base;
393
394 if (!omap_crtc->error_irq.registered)
395 omap_irq_register(crtc->dev, &omap_crtc->error_irq);
396
397 if (!dispc_mgr_go_busy(omap_crtc->channel)) {
398 struct omap_drm_private *priv =
399 crtc->dev->dev_private;
400 DBG("%s: apply done", omap_crtc->name);
401 omap_irq_unregister(crtc->dev, &omap_crtc->apply_irq);
402 queue_work(priv->wq, &omap_crtc->apply_work);
403 }
404}
405
406static void apply_worker(struct work_struct *work)
407{
408 struct omap_crtc *omap_crtc =
409 container_of(work, struct omap_crtc, apply_work);
410 struct drm_crtc *crtc = &omap_crtc->base;
411 struct drm_device *dev = crtc->dev;
412 struct omap_drm_apply *apply, *n;
413 bool need_apply;
414
415 /*
416 * Synchronize everything on mode_config.mutex, to keep
417 * the callbacks and list modification all serialized
418 * with respect to modesetting ioctls from userspace.
419 */
420 mutex_lock(&dev->mode_config.mutex);
421 dispc_runtime_get();
422
423 /*
424 * If we are still pending a previous update, wait.. when the
425 * pending update completes, we get kicked again.
426 */
427 if (omap_crtc->apply_irq.registered)
428 goto out;
429
430 /* finish up previous apply's: */
431 list_for_each_entry_safe(apply, n,
432 &omap_crtc->pending_applies, pending_node) {
433 apply->post_apply(apply);
434 list_del(&apply->pending_node);
435 }
436
437 need_apply = !list_empty(&omap_crtc->queued_applies);
438
439 /* then handle the next round of of queued apply's: */
440 list_for_each_entry_safe(apply, n,
441 &omap_crtc->queued_applies, queued_node) {
442 apply->pre_apply(apply);
443 list_del(&apply->queued_node);
444 apply->queued = false;
445 list_add_tail(&apply->pending_node,
446 &omap_crtc->pending_applies);
447 }
448
449 if (need_apply) {
450 enum omap_channel channel = omap_crtc->channel;
451
452 DBG("%s: GO", omap_crtc->name);
453
454 if (dispc_mgr_is_enabled(channel)) {
455 omap_irq_register(dev, &omap_crtc->apply_irq);
456 dispc_mgr_go(channel);
457 } else {
458 struct omap_drm_private *priv = dev->dev_private;
459 queue_work(priv->wq, &omap_crtc->apply_work);
460 }
461 }
462
463out:
464 dispc_runtime_put();
465 mutex_unlock(&dev->mode_config.mutex);
466}
467
468int omap_crtc_apply(struct drm_crtc *crtc,
469 struct omap_drm_apply *apply)
470{
471 struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
472 struct drm_device *dev = crtc->dev;
473
474 WARN_ON(!mutex_is_locked(&dev->mode_config.mutex));
475
476 /* no need to queue it again if it is already queued: */
477 if (apply->queued)
478 return 0;
479
480 apply->queued = true;
481 list_add_tail(&apply->queued_node, &omap_crtc->queued_applies);
482
483 /*
484 * If there are no currently pending updates, then go ahead and
485 * kick the worker immediately, otherwise it will run again when
486 * the current update finishes.
487 */
488 if (list_empty(&omap_crtc->pending_applies)) {
489 struct omap_drm_private *priv = crtc->dev->dev_private;
490 queue_work(priv->wq, &omap_crtc->apply_work);
491 }
492
493 return 0;
494}
495
496/* called only from apply */
497static void set_enabled(struct drm_crtc *crtc, bool enable)
498{
499 struct drm_device *dev = crtc->dev;
500 struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
501 enum omap_channel channel = omap_crtc->channel;
502 struct omap_irq_wait *wait = NULL;
503
504 if (dispc_mgr_is_enabled(channel) == enable)
505 return;
506
507 /* ignore sync-lost irqs during enable/disable */
508 omap_irq_unregister(crtc->dev, &omap_crtc->error_irq);
509
510 if (dispc_mgr_get_framedone_irq(channel)) {
511 if (!enable) {
512 wait = omap_irq_wait_init(dev,
513 dispc_mgr_get_framedone_irq(channel), 1);
514 }
515 } else {
516 /*
517 * When we disable digit output, we need to wait until fields
518 * are done. Otherwise the DSS is still working, and turning
519 * off the clocks prevents DSS from going to OFF mode. And when
520 * enabling, we need to wait for the extra sync losts
521 */
522 wait = omap_irq_wait_init(dev,
523 dispc_mgr_get_vsync_irq(channel), 2);
524 }
525
526 dispc_mgr_enable(channel, enable);
527
528 if (wait) {
529 int ret = omap_irq_wait(dev, wait, msecs_to_jiffies(100));
530 if (ret) {
531 dev_err(dev->dev, "%s: timeout waiting for %s\n",
532 omap_crtc->name, enable ? "enable" : "disable");
533 }
534 }
535
536 omap_irq_register(crtc->dev, &omap_crtc->error_irq);
537}
538
539static void omap_crtc_pre_apply(struct omap_drm_apply *apply)
540{
541 struct omap_crtc *omap_crtc =
542 container_of(apply, struct omap_crtc, apply);
543 struct drm_crtc *crtc = &omap_crtc->base;
544 struct drm_encoder *encoder = NULL;
545
546 DBG("%s: enabled=%d, full=%d", omap_crtc->name,
547 omap_crtc->enabled, omap_crtc->full_update);
548
549 if (omap_crtc->full_update) {
550 struct omap_drm_private *priv = crtc->dev->dev_private;
551 int i;
552 for (i = 0; i < priv->num_encoders; i++) {
553 if (priv->encoders[i]->crtc == crtc) {
554 encoder = priv->encoders[i];
555 break;
556 }
557 }
558 }
559
560 if (!omap_crtc->enabled) {
561 set_enabled(&omap_crtc->base, false);
562 if (encoder)
563 omap_encoder_set_enabled(encoder, false);
564 } else {
565 if (encoder) {
566 omap_encoder_set_enabled(encoder, false);
567 omap_encoder_update(encoder, &omap_crtc->mgr,
568 &omap_crtc->timings);
569 omap_encoder_set_enabled(encoder, true);
570 omap_crtc->full_update = false;
571 }
572
573 dispc_mgr_setup(omap_crtc->channel, &omap_crtc->info);
574 dispc_mgr_set_timings(omap_crtc->channel,
575 &omap_crtc->timings);
576 set_enabled(&omap_crtc->base, true);
577 }
578
579 omap_crtc->full_update = false;
580}
581
582static void omap_crtc_post_apply(struct omap_drm_apply *apply)
583{
584 /* nothing needed for post-apply */
585}
586
587static const char *channel_names[] = {
588 [OMAP_DSS_CHANNEL_LCD] = "lcd",
589 [OMAP_DSS_CHANNEL_DIGIT] = "tv",
590 [OMAP_DSS_CHANNEL_LCD2] = "lcd2",
591};
592
237/* initialize crtc */ 593/* initialize crtc */
238struct drm_crtc *omap_crtc_init(struct drm_device *dev, 594struct drm_crtc *omap_crtc_init(struct drm_device *dev,
239 struct omap_overlay *ovl, int id) 595 struct drm_plane *plane, enum omap_channel channel, int id)
240{ 596{
241 struct drm_crtc *crtc = NULL; 597 struct drm_crtc *crtc = NULL;
242 struct omap_crtc *omap_crtc = kzalloc(sizeof(*omap_crtc), GFP_KERNEL); 598 struct omap_crtc *omap_crtc;
599 struct omap_overlay_manager_info *info;
600
601 DBG("%s", channel_names[channel]);
243 602
244 DBG("%s", ovl->name); 603 omap_crtc = kzalloc(sizeof(*omap_crtc), GFP_KERNEL);
245 604
246 if (!omap_crtc) { 605 if (!omap_crtc) {
247 dev_err(dev->dev, "could not allocate CRTC\n"); 606 dev_err(dev->dev, "could not allocate CRTC\n");
@@ -250,10 +609,40 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
250 609
251 crtc = &omap_crtc->base; 610 crtc = &omap_crtc->base;
252 611
253 omap_crtc->plane = omap_plane_init(dev, ovl, (1 << id), true); 612 INIT_WORK(&omap_crtc->page_flip_work, page_flip_worker);
613 INIT_WORK(&omap_crtc->apply_work, apply_worker);
614
615 INIT_LIST_HEAD(&omap_crtc->pending_applies);
616 INIT_LIST_HEAD(&omap_crtc->queued_applies);
617
618 omap_crtc->apply.pre_apply = omap_crtc_pre_apply;
619 omap_crtc->apply.post_apply = omap_crtc_post_apply;
620
621 omap_crtc->apply_irq.irqmask = pipe2vbl(id);
622 omap_crtc->apply_irq.irq = omap_crtc_apply_irq;
623
624 omap_crtc->error_irq.irqmask =
625 dispc_mgr_get_sync_lost_irq(channel);
626 omap_crtc->error_irq.irq = omap_crtc_error_irq;
627 omap_irq_register(dev, &omap_crtc->error_irq);
628
629 omap_crtc->channel = channel;
630 omap_crtc->plane = plane;
254 omap_crtc->plane->crtc = crtc; 631 omap_crtc->plane->crtc = crtc;
255 omap_crtc->name = ovl->name; 632 omap_crtc->name = channel_names[channel];
256 omap_crtc->id = id; 633 omap_crtc->pipe = id;
634
635 /* temporary: */
636 omap_crtc->mgr.id = channel;
637
638 dss_install_mgr_ops(&mgr_ops);
639
640 /* TODO: fix hard-coded setup.. add properties! */
641 info = &omap_crtc->info;
642 info->default_color = 0x00000000;
643 info->trans_key = 0x00000000;
644 info->trans_key_type = OMAP_DSS_COLOR_KEY_GFX_DST;
645 info->trans_enabled = false;
257 646
258 drm_crtc_init(dev, crtc, &omap_crtc_funcs); 647 drm_crtc_init(dev, crtc, &omap_crtc_funcs);
259 drm_crtc_helper_add(crtc, &omap_crtc_helper_funcs); 648 drm_crtc_helper_add(crtc, &omap_crtc_helper_funcs);
diff --git a/drivers/staging/omapdrm/omap_drv.c b/drivers/staging/omapdrm/omap_drv.c
index 84943e5ba1d6..ae5ecc2efbc7 100644
--- a/drivers/staging/omapdrm/omap_drv.c
+++ b/drivers/staging/omapdrm/omap_drv.c
@@ -74,320 +74,99 @@ static int get_connector_type(struct omap_dss_device *dssdev)
74 } 74 }
75} 75}
76 76
77#if 0 /* enable when dss2 supports hotplug */ 77static int omap_modeset_init(struct drm_device *dev)
78static int omap_drm_notifier(struct notifier_block *nb,
79 unsigned long evt, void *arg)
80{
81 switch (evt) {
82 case OMAP_DSS_SIZE_CHANGE:
83 case OMAP_DSS_HOTPLUG_CONNECT:
84 case OMAP_DSS_HOTPLUG_DISCONNECT: {
85 struct drm_device *dev = drm_device;
86 DBG("hotplug event: evt=%d, dev=%p", evt, dev);
87 if (dev)
88 drm_sysfs_hotplug_event(dev);
89
90 return NOTIFY_OK;
91 }
92 default: /* don't care about other events for now */
93 return NOTIFY_DONE;
94 }
95}
96#endif
97
98static void dump_video_chains(void)
99{
100 int i;
101
102 DBG("dumping video chains: ");
103 for (i = 0; i < omap_dss_get_num_overlays(); i++) {
104 struct omap_overlay *ovl = omap_dss_get_overlay(i);
105 struct omap_overlay_manager *mgr = ovl->manager;
106 struct omap_dss_device *dssdev = mgr ?
107 mgr->get_device(mgr) : NULL;
108 if (dssdev) {
109 DBG("%d: %s -> %s -> %s", i, ovl->name, mgr->name,
110 dssdev->name);
111 } else if (mgr) {
112 DBG("%d: %s -> %s", i, ovl->name, mgr->name);
113 } else {
114 DBG("%d: %s", i, ovl->name);
115 }
116 }
117}
118
119/* create encoders for each manager */
120static int create_encoder(struct drm_device *dev,
121 struct omap_overlay_manager *mgr)
122{
123 struct omap_drm_private *priv = dev->dev_private;
124 struct drm_encoder *encoder = omap_encoder_init(dev, mgr);
125
126 if (!encoder) {
127 dev_err(dev->dev, "could not create encoder: %s\n",
128 mgr->name);
129 return -ENOMEM;
130 }
131
132 BUG_ON(priv->num_encoders >= ARRAY_SIZE(priv->encoders));
133
134 priv->encoders[priv->num_encoders++] = encoder;
135
136 return 0;
137}
138
139/* create connectors for each display device */
140static int create_connector(struct drm_device *dev,
141 struct omap_dss_device *dssdev)
142{ 78{
143 struct omap_drm_private *priv = dev->dev_private; 79 struct omap_drm_private *priv = dev->dev_private;
144 static struct notifier_block *notifier; 80 struct omap_dss_device *dssdev = NULL;
145 struct drm_connector *connector; 81 int num_ovls = dss_feat_get_num_ovls();
146 int j; 82 int id;
147
148 if (!dssdev->driver) {
149 dev_warn(dev->dev, "%s has no driver.. skipping it\n",
150 dssdev->name);
151 return 0;
152 }
153 83
154 if (!(dssdev->driver->get_timings || 84 drm_mode_config_init(dev);
155 dssdev->driver->read_edid)) {
156 dev_warn(dev->dev, "%s driver does not support "
157 "get_timings or read_edid.. skipping it!\n",
158 dssdev->name);
159 return 0;
160 }
161 85
162 connector = omap_connector_init(dev, 86 omap_drm_irq_install(dev);
163 get_connector_type(dssdev), dssdev);
164 87
165 if (!connector) { 88 /*
166 dev_err(dev->dev, "could not create connector: %s\n", 89 * Create private planes and CRTCs for the last NUM_CRTCs overlay
167 dssdev->name); 90 * plus manager:
168 return -ENOMEM; 91 */
169 } 92 for (id = 0; id < min(num_crtc, num_ovls); id++) {
170 93 struct drm_plane *plane;
171 BUG_ON(priv->num_connectors >= ARRAY_SIZE(priv->connectors)); 94 struct drm_crtc *crtc;
172 95
173 priv->connectors[priv->num_connectors++] = connector; 96 plane = omap_plane_init(dev, id, true);
97 crtc = omap_crtc_init(dev, plane, pipe2chan(id), id);
174 98
175#if 0 /* enable when dss2 supports hotplug */ 99 BUG_ON(priv->num_crtcs >= ARRAY_SIZE(priv->crtcs));
176 notifier = kzalloc(sizeof(struct notifier_block), GFP_KERNEL); 100 priv->crtcs[id] = crtc;
177 notifier->notifier_call = omap_drm_notifier; 101 priv->num_crtcs++;
178 omap_dss_add_notify(dssdev, notifier);
179#else
180 notifier = NULL;
181#endif
182 102
183 for (j = 0; j < priv->num_encoders; j++) { 103 priv->planes[id] = plane;
184 struct omap_overlay_manager *mgr = 104 priv->num_planes++;
185 omap_encoder_get_manager(priv->encoders[j]);
186 if (mgr->get_device(mgr) == dssdev) {
187 drm_mode_connector_attach_encoder(connector,
188 priv->encoders[j]);
189 }
190 } 105 }
191 106
192 return 0; 107 /*
193} 108 * Create normal planes for the remaining overlays:
194
195/* create up to max_overlays CRTCs mapping to overlays.. by default,
196 * connect the overlays to different managers/encoders, giving priority
197 * to encoders connected to connectors with a detected connection
198 */
199static int create_crtc(struct drm_device *dev, struct omap_overlay *ovl,
200 int *j, unsigned int connected_connectors)
201{
202 struct omap_drm_private *priv = dev->dev_private;
203 struct omap_overlay_manager *mgr = NULL;
204 struct drm_crtc *crtc;
205
206 /* find next best connector, ones with detected connection first
207 */ 109 */
208 while (*j < priv->num_connectors && !mgr) { 110 for (; id < num_ovls; id++) {
209 if (connected_connectors & (1 << *j)) { 111 struct drm_plane *plane = omap_plane_init(dev, id, false);
210 struct drm_encoder *encoder =
211 omap_connector_attached_encoder(
212 priv->connectors[*j]);
213 if (encoder)
214 mgr = omap_encoder_get_manager(encoder);
215 112
216 } 113 BUG_ON(priv->num_planes >= ARRAY_SIZE(priv->planes));
217 (*j)++; 114 priv->planes[priv->num_planes++] = plane;
218 } 115 }
219 116
220 /* if we couldn't find another connected connector, lets start 117 for_each_dss_dev(dssdev) {
221 * looking at the unconnected connectors: 118 struct drm_connector *connector;
222 * 119 struct drm_encoder *encoder;
223 * note: it might not be immediately apparent, but thanks to
224 * the !mgr check in both this loop and the one above, the only
225 * way to enter this loop is with *j == priv->num_connectors,
226 * so idx can never go negative.
227 */
228 while (*j < 2 * priv->num_connectors && !mgr) {
229 int idx = *j - priv->num_connectors;
230 if (!(connected_connectors & (1 << idx))) {
231 struct drm_encoder *encoder =
232 omap_connector_attached_encoder(
233 priv->connectors[idx]);
234 if (encoder)
235 mgr = omap_encoder_get_manager(encoder);
236 120
121 if (!dssdev->driver) {
122 dev_warn(dev->dev, "%s has no driver.. skipping it\n",
123 dssdev->name);
124 return 0;
237 } 125 }
238 (*j)++;
239 }
240
241 crtc = omap_crtc_init(dev, ovl, priv->num_crtcs);
242
243 if (!crtc) {
244 dev_err(dev->dev, "could not create CRTC: %s\n",
245 ovl->name);
246 return -ENOMEM;
247 }
248 126
249 BUG_ON(priv->num_crtcs >= ARRAY_SIZE(priv->crtcs)); 127 if (!(dssdev->driver->get_timings ||
250 128 dssdev->driver->read_edid)) {
251 priv->crtcs[priv->num_crtcs++] = crtc; 129 dev_warn(dev->dev, "%s driver does not support "
252 130 "get_timings or read_edid.. skipping it!\n",
253 return 0; 131 dssdev->name);
254} 132 return 0;
255
256static int create_plane(struct drm_device *dev, struct omap_overlay *ovl,
257 unsigned int possible_crtcs)
258{
259 struct omap_drm_private *priv = dev->dev_private;
260 struct drm_plane *plane =
261 omap_plane_init(dev, ovl, possible_crtcs, false);
262
263 if (!plane) {
264 dev_err(dev->dev, "could not create plane: %s\n",
265 ovl->name);
266 return -ENOMEM;
267 }
268
269 BUG_ON(priv->num_planes >= ARRAY_SIZE(priv->planes));
270
271 priv->planes[priv->num_planes++] = plane;
272
273 return 0;
274}
275
276static int match_dev_name(struct omap_dss_device *dssdev, void *data)
277{
278 return !strcmp(dssdev->name, data);
279}
280
281static unsigned int detect_connectors(struct drm_device *dev)
282{
283 struct omap_drm_private *priv = dev->dev_private;
284 unsigned int connected_connectors = 0;
285 int i;
286
287 for (i = 0; i < priv->num_connectors; i++) {
288 struct drm_connector *connector = priv->connectors[i];
289 if (omap_connector_detect(connector, true) ==
290 connector_status_connected) {
291 connected_connectors |= (1 << i);
292 } 133 }
293 }
294
295 return connected_connectors;
296}
297 134
298static int omap_modeset_init(struct drm_device *dev) 135 encoder = omap_encoder_init(dev, dssdev);
299{
300 const struct omap_drm_platform_data *pdata = dev->dev->platform_data;
301 struct omap_kms_platform_data *kms_pdata = NULL;
302 struct omap_drm_private *priv = dev->dev_private;
303 struct omap_dss_device *dssdev = NULL;
304 int i, j;
305 unsigned int connected_connectors = 0;
306 136
307 drm_mode_config_init(dev); 137 if (!encoder) {
308 138 dev_err(dev->dev, "could not create encoder: %s\n",
309 if (pdata && pdata->kms_pdata) { 139 dssdev->name);
310 kms_pdata = pdata->kms_pdata; 140 return -ENOMEM;
311
312 /* if platform data is provided by the board file, use it to
313 * control which overlays, managers, and devices we own.
314 */
315 for (i = 0; i < kms_pdata->mgr_cnt; i++) {
316 struct omap_overlay_manager *mgr =
317 omap_dss_get_overlay_manager(
318 kms_pdata->mgr_ids[i]);
319 create_encoder(dev, mgr);
320 }
321
322 for (i = 0; i < kms_pdata->dev_cnt; i++) {
323 struct omap_dss_device *dssdev =
324 omap_dss_find_device(
325 (void *)kms_pdata->dev_names[i],
326 match_dev_name);
327 if (!dssdev) {
328 dev_warn(dev->dev, "no such dssdev: %s\n",
329 kms_pdata->dev_names[i]);
330 continue;
331 }
332 create_connector(dev, dssdev);
333 } 141 }
334 142
335 connected_connectors = detect_connectors(dev); 143 connector = omap_connector_init(dev,
144 get_connector_type(dssdev), dssdev, encoder);
336 145
337 j = 0; 146 if (!connector) {
338 for (i = 0; i < kms_pdata->ovl_cnt; i++) { 147 dev_err(dev->dev, "could not create connector: %s\n",
339 struct omap_overlay *ovl = 148 dssdev->name);
340 omap_dss_get_overlay(kms_pdata->ovl_ids[i]); 149 return -ENOMEM;
341 create_crtc(dev, ovl, &j, connected_connectors);
342 } 150 }
343 151
344 for (i = 0; i < kms_pdata->pln_cnt; i++) { 152 BUG_ON(priv->num_encoders >= ARRAY_SIZE(priv->encoders));
345 struct omap_overlay *ovl = 153 BUG_ON(priv->num_connectors >= ARRAY_SIZE(priv->connectors));
346 omap_dss_get_overlay(kms_pdata->pln_ids[i]);
347 create_plane(dev, ovl, (1 << priv->num_crtcs) - 1);
348 }
349 } else {
350 /* otherwise just grab up to CONFIG_DRM_OMAP_NUM_CRTCS and try
351 * to make educated guesses about everything else
352 */
353 int max_overlays = min(omap_dss_get_num_overlays(), num_crtc);
354 154
355 for (i = 0; i < omap_dss_get_num_overlay_managers(); i++) 155 priv->encoders[priv->num_encoders++] = encoder;
356 create_encoder(dev, omap_dss_get_overlay_manager(i)); 156 priv->connectors[priv->num_connectors++] = connector;
357
358 for_each_dss_dev(dssdev) {
359 create_connector(dev, dssdev);
360 }
361 157
362 connected_connectors = detect_connectors(dev); 158 drm_mode_connector_attach_encoder(connector, encoder);
363 159
364 j = 0; 160 /* figure out which crtc's we can connect the encoder to: */
365 for (i = 0; i < max_overlays; i++) { 161 encoder->possible_crtcs = 0;
366 create_crtc(dev, omap_dss_get_overlay(i), 162 for (id = 0; id < priv->num_crtcs; id++) {
367 &j, connected_connectors); 163 enum omap_dss_output_id supported_outputs =
368 } 164 dss_feat_get_supported_outputs(pipe2chan(id));
369 165 if (supported_outputs & dssdev->output->id)
370 /* use any remaining overlays as drm planes */ 166 encoder->possible_crtcs |= (1 << id);
371 for (; i < omap_dss_get_num_overlays(); i++) {
372 struct omap_overlay *ovl = omap_dss_get_overlay(i);
373 create_plane(dev, ovl, (1 << priv->num_crtcs) - 1);
374 } 167 }
375 } 168 }
376 169
377 /* for now keep the mapping of CRTCs and encoders static.. */
378 for (i = 0; i < priv->num_encoders; i++) {
379 struct drm_encoder *encoder = priv->encoders[i];
380 struct omap_overlay_manager *mgr =
381 omap_encoder_get_manager(encoder);
382
383 encoder->possible_crtcs = (1 << priv->num_crtcs) - 1;
384
385 DBG("%s: possible_crtcs=%08x", mgr->name,
386 encoder->possible_crtcs);
387 }
388
389 dump_video_chains();
390
391 dev->mode_config.min_width = 32; 170 dev->mode_config.min_width = 32;
392 dev->mode_config.min_height = 32; 171 dev->mode_config.min_height = 32;
393 172
@@ -450,7 +229,7 @@ static int ioctl_gem_new(struct drm_device *dev, void *data,
450 struct drm_file *file_priv) 229 struct drm_file *file_priv)
451{ 230{
452 struct drm_omap_gem_new *args = data; 231 struct drm_omap_gem_new *args = data;
453 DBG("%p:%p: size=0x%08x, flags=%08x", dev, file_priv, 232 VERB("%p:%p: size=0x%08x, flags=%08x", dev, file_priv,
454 args->size.bytes, args->flags); 233 args->size.bytes, args->flags);
455 return omap_gem_new_handle(dev, file_priv, args->size, 234 return omap_gem_new_handle(dev, file_priv, args->size,
456 args->flags, &args->handle); 235 args->flags, &args->handle);
@@ -510,7 +289,7 @@ static int ioctl_gem_info(struct drm_device *dev, void *data,
510 struct drm_gem_object *obj; 289 struct drm_gem_object *obj;
511 int ret = 0; 290 int ret = 0;
512 291
513 DBG("%p:%p: handle=%d", dev, file_priv, args->handle); 292 VERB("%p:%p: handle=%d", dev, file_priv, args->handle);
514 293
515 obj = drm_gem_object_lookup(dev, file_priv, args->handle); 294 obj = drm_gem_object_lookup(dev, file_priv, args->handle);
516 if (!obj) 295 if (!obj)
@@ -565,14 +344,6 @@ static int dev_load(struct drm_device *dev, unsigned long flags)
565 344
566 dev->dev_private = priv; 345 dev->dev_private = priv;
567 346
568 ret = omapdss_compat_init();
569 if (ret) {
570 dev_err(dev->dev, "coult not init omapdss\n");
571 dev->dev_private = NULL;
572 kfree(priv);
573 return ret;
574 }
575
576 priv->wq = alloc_ordered_workqueue("omapdrm", 0); 347 priv->wq = alloc_ordered_workqueue("omapdrm", 0);
577 348
578 INIT_LIST_HEAD(&priv->obj_list); 349 INIT_LIST_HEAD(&priv->obj_list);
@@ -584,10 +355,13 @@ static int dev_load(struct drm_device *dev, unsigned long flags)
584 dev_err(dev->dev, "omap_modeset_init failed: ret=%d\n", ret); 355 dev_err(dev->dev, "omap_modeset_init failed: ret=%d\n", ret);
585 dev->dev_private = NULL; 356 dev->dev_private = NULL;
586 kfree(priv); 357 kfree(priv);
587 omapdss_compat_uninit();
588 return ret; 358 return ret;
589 } 359 }
590 360
361 ret = drm_vblank_init(dev, priv->num_crtcs);
362 if (ret)
363 dev_warn(dev->dev, "could not init vblank\n");
364
591 priv->fbdev = omap_fbdev_init(dev); 365 priv->fbdev = omap_fbdev_init(dev);
592 if (!priv->fbdev) { 366 if (!priv->fbdev) {
593 dev_warn(dev->dev, "omap_fbdev_init failed\n"); 367 dev_warn(dev->dev, "omap_fbdev_init failed\n");
@@ -596,10 +370,6 @@ static int dev_load(struct drm_device *dev, unsigned long flags)
596 370
597 drm_kms_helper_poll_init(dev); 371 drm_kms_helper_poll_init(dev);
598 372
599 ret = drm_vblank_init(dev, priv->num_crtcs);
600 if (ret)
601 dev_warn(dev->dev, "could not init vblank\n");
602
603 return 0; 373 return 0;
604} 374}
605 375
@@ -609,8 +379,9 @@ static int dev_unload(struct drm_device *dev)
609 379
610 DBG("unload: dev=%p", dev); 380 DBG("unload: dev=%p", dev);
611 381
612 drm_vblank_cleanup(dev);
613 drm_kms_helper_poll_fini(dev); 382 drm_kms_helper_poll_fini(dev);
383 drm_vblank_cleanup(dev);
384 omap_drm_irq_uninstall(dev);
614 385
615 omap_fbdev_free(dev); 386 omap_fbdev_free(dev);
616 omap_modeset_free(dev); 387 omap_modeset_free(dev);
@@ -619,8 +390,6 @@ static int dev_unload(struct drm_device *dev)
619 flush_workqueue(priv->wq); 390 flush_workqueue(priv->wq);
620 destroy_workqueue(priv->wq); 391 destroy_workqueue(priv->wq);
621 392
622 omapdss_compat_uninit();
623
624 kfree(dev->dev_private); 393 kfree(dev->dev_private);
625 dev->dev_private = NULL; 394 dev->dev_private = NULL;
626 395
@@ -680,7 +449,9 @@ static void dev_lastclose(struct drm_device *dev)
680 } 449 }
681 } 450 }
682 451
452 mutex_lock(&dev->mode_config.mutex);
683 ret = drm_fb_helper_restore_fbdev_mode(priv->fbdev); 453 ret = drm_fb_helper_restore_fbdev_mode(priv->fbdev);
454 mutex_unlock(&dev->mode_config.mutex);
684 if (ret) 455 if (ret)
685 DBG("failed to restore crtc mode"); 456 DBG("failed to restore crtc mode");
686} 457}
@@ -695,60 +466,6 @@ static void dev_postclose(struct drm_device *dev, struct drm_file *file)
695 DBG("postclose: dev=%p, file=%p", dev, file); 466 DBG("postclose: dev=%p, file=%p", dev, file);
696} 467}
697 468
698/**
699 * enable_vblank - enable vblank interrupt events
700 * @dev: DRM device
701 * @crtc: which irq to enable
702 *
703 * Enable vblank interrupts for @crtc. If the device doesn't have
704 * a hardware vblank counter, this routine should be a no-op, since
705 * interrupts will have to stay on to keep the count accurate.
706 *
707 * RETURNS
708 * Zero on success, appropriate errno if the given @crtc's vblank
709 * interrupt cannot be enabled.
710 */
711static int dev_enable_vblank(struct drm_device *dev, int crtc)
712{
713 DBG("enable_vblank: dev=%p, crtc=%d", dev, crtc);
714 return 0;
715}
716
717/**
718 * disable_vblank - disable vblank interrupt events
719 * @dev: DRM device
720 * @crtc: which irq to enable
721 *
722 * Disable vblank interrupts for @crtc. If the device doesn't have
723 * a hardware vblank counter, this routine should be a no-op, since
724 * interrupts will have to stay on to keep the count accurate.
725 */
726static void dev_disable_vblank(struct drm_device *dev, int crtc)
727{
728 DBG("disable_vblank: dev=%p, crtc=%d", dev, crtc);
729}
730
731static irqreturn_t dev_irq_handler(DRM_IRQ_ARGS)
732{
733 return IRQ_HANDLED;
734}
735
736static void dev_irq_preinstall(struct drm_device *dev)
737{
738 DBG("irq_preinstall: dev=%p", dev);
739}
740
741static int dev_irq_postinstall(struct drm_device *dev)
742{
743 DBG("irq_postinstall: dev=%p", dev);
744 return 0;
745}
746
747static void dev_irq_uninstall(struct drm_device *dev)
748{
749 DBG("irq_uninstall: dev=%p", dev);
750}
751
752static const struct vm_operations_struct omap_gem_vm_ops = { 469static const struct vm_operations_struct omap_gem_vm_ops = {
753 .fault = omap_gem_fault, 470 .fault = omap_gem_fault,
754 .open = drm_gem_vm_open, 471 .open = drm_gem_vm_open,
@@ -778,12 +495,12 @@ static struct drm_driver omap_drm_driver = {
778 .preclose = dev_preclose, 495 .preclose = dev_preclose,
779 .postclose = dev_postclose, 496 .postclose = dev_postclose,
780 .get_vblank_counter = drm_vblank_count, 497 .get_vblank_counter = drm_vblank_count,
781 .enable_vblank = dev_enable_vblank, 498 .enable_vblank = omap_irq_enable_vblank,
782 .disable_vblank = dev_disable_vblank, 499 .disable_vblank = omap_irq_disable_vblank,
783 .irq_preinstall = dev_irq_preinstall, 500 .irq_preinstall = omap_irq_preinstall,
784 .irq_postinstall = dev_irq_postinstall, 501 .irq_postinstall = omap_irq_postinstall,
785 .irq_uninstall = dev_irq_uninstall, 502 .irq_uninstall = omap_irq_uninstall,
786 .irq_handler = dev_irq_handler, 503 .irq_handler = omap_irq_handler,
787#ifdef CONFIG_DEBUG_FS 504#ifdef CONFIG_DEBUG_FS
788 .debugfs_init = omap_debugfs_init, 505 .debugfs_init = omap_debugfs_init,
789 .debugfs_cleanup = omap_debugfs_cleanup, 506 .debugfs_cleanup = omap_debugfs_cleanup,
diff --git a/drivers/staging/omapdrm/omap_drv.h b/drivers/staging/omapdrm/omap_drv.h
index 1d4aea53b75d..cd1f22b0b124 100644
--- a/drivers/staging/omapdrm/omap_drv.h
+++ b/drivers/staging/omapdrm/omap_drv.h
@@ -28,6 +28,7 @@
28#include <linux/platform_data/omap_drm.h> 28#include <linux/platform_data/omap_drm.h>
29#include "omap_drm.h" 29#include "omap_drm.h"
30 30
31
31#define DBG(fmt, ...) DRM_DEBUG(fmt"\n", ##__VA_ARGS__) 32#define DBG(fmt, ...) DRM_DEBUG(fmt"\n", ##__VA_ARGS__)
32#define VERB(fmt, ...) if (0) DRM_DEBUG(fmt, ##__VA_ARGS__) /* verbose debug */ 33#define VERB(fmt, ...) if (0) DRM_DEBUG(fmt, ##__VA_ARGS__) /* verbose debug */
33 34
@@ -39,6 +40,51 @@
39 */ 40 */
40#define MAX_MAPPERS 2 41#define MAX_MAPPERS 2
41 42
43/* parameters which describe (unrotated) coordinates of scanout within a fb: */
44struct omap_drm_window {
45 uint32_t rotation;
46 int32_t crtc_x, crtc_y; /* signed because can be offscreen */
47 uint32_t crtc_w, crtc_h;
48 uint32_t src_x, src_y;
49 uint32_t src_w, src_h;
50};
51
52/* Once GO bit is set, we can't make further updates to shadowed registers
53 * until the GO bit is cleared. So various parts in the kms code that need
54 * to update shadowed registers queue up a pair of callbacks, pre_apply
55 * which is called before setting GO bit, and post_apply that is called
56 * after GO bit is cleared. The crtc manages the queuing, and everyone
57 * else goes thru omap_crtc_apply() using these callbacks so that the
58 * code which has to deal w/ GO bit state is centralized.
59 */
60struct omap_drm_apply {
61 struct list_head pending_node, queued_node;
62 bool queued;
63 void (*pre_apply)(struct omap_drm_apply *apply);
64 void (*post_apply)(struct omap_drm_apply *apply);
65};
66
67/* For transiently registering for different DSS irqs that various parts
68 * of the KMS code need during setup/configuration. We these are not
69 * necessarily the same as what drm_vblank_get/put() are requesting, and
70 * the hysteresis in drm_vblank_put() is not necessarily desirable for
71 * internal housekeeping related irq usage.
72 */
73struct omap_drm_irq {
74 struct list_head node;
75 uint32_t irqmask;
76 bool registered;
77 void (*irq)(struct omap_drm_irq *irq, uint32_t irqstatus);
78};
79
80/* For KMS code that needs to wait for a certain # of IRQs:
81 */
82struct omap_irq_wait;
83struct omap_irq_wait * omap_irq_wait_init(struct drm_device *dev,
84 uint32_t irqmask, int count);
85int omap_irq_wait(struct drm_device *dev, struct omap_irq_wait *wait,
86 unsigned long timeout);
87
42struct omap_drm_private { 88struct omap_drm_private {
43 uint32_t omaprev; 89 uint32_t omaprev;
44 90
@@ -58,6 +104,7 @@ struct omap_drm_private {
58 104
59 struct workqueue_struct *wq; 105 struct workqueue_struct *wq;
60 106
107 /* list of GEM objects: */
61 struct list_head obj_list; 108 struct list_head obj_list;
62 109
63 bool has_dmm; 110 bool has_dmm;
@@ -65,6 +112,11 @@ struct omap_drm_private {
65 /* properties: */ 112 /* properties: */
66 struct drm_property *rotation_prop; 113 struct drm_property *rotation_prop;
67 struct drm_property *zorder_prop; 114 struct drm_property *zorder_prop;
115
116 /* irq handling: */
117 struct list_head irq_list; /* list of omap_drm_irq */
118 uint32_t vblank_mask; /* irq bits set for userspace vblank */
119 struct omap_drm_irq error_handler;
68}; 120};
69 121
70/* this should probably be in drm-core to standardize amongst drivers */ 122/* this should probably be in drm-core to standardize amongst drivers */
@@ -75,15 +127,6 @@ struct omap_drm_private {
75#define DRM_REFLECT_X 4 127#define DRM_REFLECT_X 4
76#define DRM_REFLECT_Y 5 128#define DRM_REFLECT_Y 5
77 129
78/* parameters which describe (unrotated) coordinates of scanout within a fb: */
79struct omap_drm_window {
80 uint32_t rotation;
81 int32_t crtc_x, crtc_y; /* signed because can be offscreen */
82 uint32_t crtc_w, crtc_h;
83 uint32_t src_x, src_y;
84 uint32_t src_w, src_h;
85};
86
87#ifdef CONFIG_DEBUG_FS 130#ifdef CONFIG_DEBUG_FS
88int omap_debugfs_init(struct drm_minor *minor); 131int omap_debugfs_init(struct drm_minor *minor);
89void omap_debugfs_cleanup(struct drm_minor *minor); 132void omap_debugfs_cleanup(struct drm_minor *minor);
@@ -92,23 +135,36 @@ void omap_gem_describe(struct drm_gem_object *obj, struct seq_file *m);
92void omap_gem_describe_objects(struct list_head *list, struct seq_file *m); 135void omap_gem_describe_objects(struct list_head *list, struct seq_file *m);
93#endif 136#endif
94 137
138int omap_irq_enable_vblank(struct drm_device *dev, int crtc);
139void omap_irq_disable_vblank(struct drm_device *dev, int crtc);
140irqreturn_t omap_irq_handler(DRM_IRQ_ARGS);
141void omap_irq_preinstall(struct drm_device *dev);
142int omap_irq_postinstall(struct drm_device *dev);
143void omap_irq_uninstall(struct drm_device *dev);
144void omap_irq_register(struct drm_device *dev, struct omap_drm_irq *irq);
145void omap_irq_unregister(struct drm_device *dev, struct omap_drm_irq *irq);
146int omap_drm_irq_uninstall(struct drm_device *dev);
147int omap_drm_irq_install(struct drm_device *dev);
148
95struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev); 149struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev);
96void omap_fbdev_free(struct drm_device *dev); 150void omap_fbdev_free(struct drm_device *dev);
97 151
152const struct omap_video_timings *omap_crtc_timings(struct drm_crtc *crtc);
153enum omap_channel omap_crtc_channel(struct drm_crtc *crtc);
154int omap_crtc_apply(struct drm_crtc *crtc,
155 struct omap_drm_apply *apply);
98struct drm_crtc *omap_crtc_init(struct drm_device *dev, 156struct drm_crtc *omap_crtc_init(struct drm_device *dev,
99 struct omap_overlay *ovl, int id); 157 struct drm_plane *plane, enum omap_channel channel, int id);
100 158
101struct drm_plane *omap_plane_init(struct drm_device *dev, 159struct drm_plane *omap_plane_init(struct drm_device *dev,
102 struct omap_overlay *ovl, unsigned int possible_crtcs, 160 int plane_id, bool private_plane);
103 bool priv);
104int omap_plane_dpms(struct drm_plane *plane, int mode); 161int omap_plane_dpms(struct drm_plane *plane, int mode);
105int omap_plane_mode_set(struct drm_plane *plane, 162int omap_plane_mode_set(struct drm_plane *plane,
106 struct drm_crtc *crtc, struct drm_framebuffer *fb, 163 struct drm_crtc *crtc, struct drm_framebuffer *fb,
107 int crtc_x, int crtc_y, 164 int crtc_x, int crtc_y,
108 unsigned int crtc_w, unsigned int crtc_h, 165 unsigned int crtc_w, unsigned int crtc_h,
109 uint32_t src_x, uint32_t src_y, 166 uint32_t src_x, uint32_t src_y,
110 uint32_t src_w, uint32_t src_h); 167 uint32_t src_w, uint32_t src_h,
111void omap_plane_on_endwin(struct drm_plane *plane,
112 void (*fxn)(void *), void *arg); 168 void (*fxn)(void *), void *arg);
113void omap_plane_install_properties(struct drm_plane *plane, 169void omap_plane_install_properties(struct drm_plane *plane,
114 struct drm_mode_object *obj); 170 struct drm_mode_object *obj);
@@ -116,21 +172,25 @@ int omap_plane_set_property(struct drm_plane *plane,
116 struct drm_property *property, uint64_t val); 172 struct drm_property *property, uint64_t val);
117 173
118struct drm_encoder *omap_encoder_init(struct drm_device *dev, 174struct drm_encoder *omap_encoder_init(struct drm_device *dev,
119 struct omap_overlay_manager *mgr); 175 struct omap_dss_device *dssdev);
120struct omap_overlay_manager *omap_encoder_get_manager( 176int omap_encoder_set_enabled(struct drm_encoder *encoder, bool enabled);
177int omap_encoder_update(struct drm_encoder *encoder,
178 struct omap_overlay_manager *mgr,
179 struct omap_video_timings *timings);
180
181struct drm_connector *omap_connector_init(struct drm_device *dev,
182 int connector_type, struct omap_dss_device *dssdev,
121 struct drm_encoder *encoder); 183 struct drm_encoder *encoder);
122struct drm_encoder *omap_connector_attached_encoder( 184struct drm_encoder *omap_connector_attached_encoder(
123 struct drm_connector *connector); 185 struct drm_connector *connector);
124enum drm_connector_status omap_connector_detect(
125 struct drm_connector *connector, bool force);
126
127struct drm_connector *omap_connector_init(struct drm_device *dev,
128 int connector_type, struct omap_dss_device *dssdev);
129void omap_connector_mode_set(struct drm_connector *connector,
130 struct drm_display_mode *mode);
131void omap_connector_flush(struct drm_connector *connector, 186void omap_connector_flush(struct drm_connector *connector,
132 int x, int y, int w, int h); 187 int x, int y, int w, int h);
133 188
189void copy_timings_omap_to_drm(struct drm_display_mode *mode,
190 struct omap_video_timings *timings);
191void copy_timings_drm_to_omap(struct omap_video_timings *timings,
192 struct drm_display_mode *mode);
193
134uint32_t omap_framebuffer_get_formats(uint32_t *pixel_formats, 194uint32_t omap_framebuffer_get_formats(uint32_t *pixel_formats,
135 uint32_t max_formats, enum omap_color_mode supported_modes); 195 uint32_t max_formats, enum omap_color_mode supported_modes);
136struct drm_framebuffer *omap_framebuffer_create(struct drm_device *dev, 196struct drm_framebuffer *omap_framebuffer_create(struct drm_device *dev,
@@ -207,6 +267,40 @@ static inline int align_pitch(int pitch, int width, int bpp)
207 return ALIGN(pitch, 8 * bytespp); 267 return ALIGN(pitch, 8 * bytespp);
208} 268}
209 269
270static inline enum omap_channel pipe2chan(int pipe)
271{
272 int num_mgrs = dss_feat_get_num_mgrs();
273
274 /*
275 * We usually don't want to create a CRTC for each manager,
276 * at least not until we have a way to expose private planes
277 * to userspace. Otherwise there would not be enough video
278 * pipes left for drm planes. The higher #'d managers tend
279 * to have more features so start in reverse order.
280 */
281 return num_mgrs - pipe - 1;
282}
283
284/* map crtc to vblank mask */
285static inline uint32_t pipe2vbl(int crtc)
286{
287 enum omap_channel channel = pipe2chan(crtc);
288 return dispc_mgr_get_vsync_irq(channel);
289}
290
291static inline int crtc2pipe(struct drm_device *dev, struct drm_crtc *crtc)
292{
293 struct omap_drm_private *priv = dev->dev_private;
294 int i;
295
296 for (i = 0; i < ARRAY_SIZE(priv->crtcs); i++)
297 if (priv->crtcs[i] == crtc)
298 return i;
299
300 BUG(); /* bogus CRTC ptr */
301 return -1;
302}
303
210/* should these be made into common util helpers? 304/* should these be made into common util helpers?
211 */ 305 */
212 306
diff --git a/drivers/staging/omapdrm/omap_encoder.c b/drivers/staging/omapdrm/omap_encoder.c
index 5341d5e3e317..e053160d2db3 100644
--- a/drivers/staging/omapdrm/omap_encoder.c
+++ b/drivers/staging/omapdrm/omap_encoder.c
@@ -22,37 +22,56 @@
22#include "drm_crtc.h" 22#include "drm_crtc.h"
23#include "drm_crtc_helper.h" 23#include "drm_crtc_helper.h"
24 24
25#include <linux/list.h>
26
27
25/* 28/*
26 * encoder funcs 29 * encoder funcs
27 */ 30 */
28 31
29#define to_omap_encoder(x) container_of(x, struct omap_encoder, base) 32#define to_omap_encoder(x) container_of(x, struct omap_encoder, base)
30 33
34/* The encoder and connector both map to same dssdev.. the encoder
35 * handles the 'active' parts, ie. anything the modifies the state
36 * of the hw, and the connector handles the 'read-only' parts, like
37 * detecting connection and reading edid.
38 */
31struct omap_encoder { 39struct omap_encoder {
32 struct drm_encoder base; 40 struct drm_encoder base;
33 struct omap_overlay_manager *mgr; 41 struct omap_dss_device *dssdev;
34}; 42};
35 43
36static void omap_encoder_destroy(struct drm_encoder *encoder) 44static void omap_encoder_destroy(struct drm_encoder *encoder)
37{ 45{
38 struct omap_encoder *omap_encoder = to_omap_encoder(encoder); 46 struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
39 DBG("%s", omap_encoder->mgr->name);
40 drm_encoder_cleanup(encoder); 47 drm_encoder_cleanup(encoder);
41 kfree(omap_encoder); 48 kfree(omap_encoder);
42} 49}
43 50
51static const struct drm_encoder_funcs omap_encoder_funcs = {
52 .destroy = omap_encoder_destroy,
53};
54
55/*
56 * The CRTC drm_crtc_helper_set_mode() doesn't really give us the right
57 * order.. the easiest way to work around this for now is to make all
58 * the encoder-helper's no-op's and have the omap_crtc code take care
59 * of the sequencing and call us in the right points.
60 *
61 * Eventually to handle connecting CRTCs to different encoders properly,
62 * either the CRTC helpers need to change or we need to replace
63 * drm_crtc_helper_set_mode(), but lets wait until atomic-modeset for
64 * that.
65 */
66
44static void omap_encoder_dpms(struct drm_encoder *encoder, int mode) 67static void omap_encoder_dpms(struct drm_encoder *encoder, int mode)
45{ 68{
46 struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
47 DBG("%s: %d", omap_encoder->mgr->name, mode);
48} 69}
49 70
50static bool omap_encoder_mode_fixup(struct drm_encoder *encoder, 71static bool omap_encoder_mode_fixup(struct drm_encoder *encoder,
51 const struct drm_display_mode *mode, 72 const struct drm_display_mode *mode,
52 struct drm_display_mode *adjusted_mode) 73 struct drm_display_mode *adjusted_mode)
53{ 74{
54 struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
55 DBG("%s", omap_encoder->mgr->name);
56 return true; 75 return true;
57} 76}
58 77
@@ -60,47 +79,16 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder,
60 struct drm_display_mode *mode, 79 struct drm_display_mode *mode,
61 struct drm_display_mode *adjusted_mode) 80 struct drm_display_mode *adjusted_mode)
62{ 81{
63 struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
64 struct drm_device *dev = encoder->dev;
65 struct omap_drm_private *priv = dev->dev_private;
66 int i;
67
68 mode = adjusted_mode;
69
70 DBG("%s: set mode: %dx%d", omap_encoder->mgr->name,
71 mode->hdisplay, mode->vdisplay);
72
73 for (i = 0; i < priv->num_connectors; i++) {
74 struct drm_connector *connector = priv->connectors[i];
75 if (connector->encoder == encoder)
76 omap_connector_mode_set(connector, mode);
77
78 }
79} 82}
80 83
81static void omap_encoder_prepare(struct drm_encoder *encoder) 84static void omap_encoder_prepare(struct drm_encoder *encoder)
82{ 85{
83 struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
84 struct drm_encoder_helper_funcs *encoder_funcs =
85 encoder->helper_private;
86 DBG("%s", omap_encoder->mgr->name);
87 encoder_funcs->dpms(encoder, DRM_MODE_DPMS_OFF);
88} 86}
89 87
90static void omap_encoder_commit(struct drm_encoder *encoder) 88static void omap_encoder_commit(struct drm_encoder *encoder)
91{ 89{
92 struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
93 struct drm_encoder_helper_funcs *encoder_funcs =
94 encoder->helper_private;
95 DBG("%s", omap_encoder->mgr->name);
96 omap_encoder->mgr->apply(omap_encoder->mgr);
97 encoder_funcs->dpms(encoder, DRM_MODE_DPMS_ON);
98} 90}
99 91
100static const struct drm_encoder_funcs omap_encoder_funcs = {
101 .destroy = omap_encoder_destroy,
102};
103
104static const struct drm_encoder_helper_funcs omap_encoder_helper_funcs = { 92static const struct drm_encoder_helper_funcs omap_encoder_helper_funcs = {
105 .dpms = omap_encoder_dpms, 93 .dpms = omap_encoder_dpms,
106 .mode_fixup = omap_encoder_mode_fixup, 94 .mode_fixup = omap_encoder_mode_fixup,
@@ -109,23 +97,54 @@ static const struct drm_encoder_helper_funcs omap_encoder_helper_funcs = {
109 .commit = omap_encoder_commit, 97 .commit = omap_encoder_commit,
110}; 98};
111 99
112struct omap_overlay_manager *omap_encoder_get_manager( 100/*
113 struct drm_encoder *encoder) 101 * Instead of relying on the helpers for modeset, the omap_crtc code
102 * calls these functions in the proper sequence.
103 */
104
105int omap_encoder_set_enabled(struct drm_encoder *encoder, bool enabled)
114{ 106{
115 struct omap_encoder *omap_encoder = to_omap_encoder(encoder); 107 struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
116 return omap_encoder->mgr; 108 struct omap_dss_device *dssdev = omap_encoder->dssdev;
109 struct omap_dss_driver *dssdrv = dssdev->driver;
110
111 if (enabled) {
112 return dssdrv->enable(dssdev);
113 } else {
114 dssdrv->disable(dssdev);
115 return 0;
116 }
117}
118
119int omap_encoder_update(struct drm_encoder *encoder,
120 struct omap_overlay_manager *mgr,
121 struct omap_video_timings *timings)
122{
123 struct drm_device *dev = encoder->dev;
124 struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
125 struct omap_dss_device *dssdev = omap_encoder->dssdev;
126 struct omap_dss_driver *dssdrv = dssdev->driver;
127 int ret;
128
129 dssdev->output->manager = mgr;
130
131 ret = dssdrv->check_timings(dssdev, timings);
132 if (ret) {
133 dev_err(dev->dev, "could not set timings: %d\n", ret);
134 return ret;
135 }
136
137 dssdrv->set_timings(dssdev, timings);
138
139 return 0;
117} 140}
118 141
119/* initialize encoder */ 142/* initialize encoder */
120struct drm_encoder *omap_encoder_init(struct drm_device *dev, 143struct drm_encoder *omap_encoder_init(struct drm_device *dev,
121 struct omap_overlay_manager *mgr) 144 struct omap_dss_device *dssdev)
122{ 145{
123 struct drm_encoder *encoder = NULL; 146 struct drm_encoder *encoder = NULL;
124 struct omap_encoder *omap_encoder; 147 struct omap_encoder *omap_encoder;
125 struct omap_overlay_manager_info info;
126 int ret;
127
128 DBG("%s", mgr->name);
129 148
130 omap_encoder = kzalloc(sizeof(*omap_encoder), GFP_KERNEL); 149 omap_encoder = kzalloc(sizeof(*omap_encoder), GFP_KERNEL);
131 if (!omap_encoder) { 150 if (!omap_encoder) {
@@ -133,33 +152,14 @@ struct drm_encoder *omap_encoder_init(struct drm_device *dev,
133 goto fail; 152 goto fail;
134 } 153 }
135 154
136 omap_encoder->mgr = mgr; 155 omap_encoder->dssdev = dssdev;
156
137 encoder = &omap_encoder->base; 157 encoder = &omap_encoder->base;
138 158
139 drm_encoder_init(dev, encoder, &omap_encoder_funcs, 159 drm_encoder_init(dev, encoder, &omap_encoder_funcs,
140 DRM_MODE_ENCODER_TMDS); 160 DRM_MODE_ENCODER_TMDS);
141 drm_encoder_helper_add(encoder, &omap_encoder_helper_funcs); 161 drm_encoder_helper_add(encoder, &omap_encoder_helper_funcs);
142 162
143 mgr->get_manager_info(mgr, &info);
144
145 /* TODO: fix hard-coded setup.. */
146 info.default_color = 0x00000000;
147 info.trans_key = 0x00000000;
148 info.trans_key_type = OMAP_DSS_COLOR_KEY_GFX_DST;
149 info.trans_enabled = false;
150
151 ret = mgr->set_manager_info(mgr, &info);
152 if (ret) {
153 dev_err(dev->dev, "could not set manager info\n");
154 goto fail;
155 }
156
157 ret = mgr->apply(mgr);
158 if (ret) {
159 dev_err(dev->dev, "could not apply\n");
160 goto fail;
161 }
162
163 return encoder; 163 return encoder;
164 164
165fail: 165fail:
diff --git a/drivers/staging/omapdrm/omap_gem_dmabuf.c b/drivers/staging/omapdrm/omap_gem_dmabuf.c
index 9a302062b031..b6c5b5c6c8c5 100644
--- a/drivers/staging/omapdrm/omap_gem_dmabuf.c
+++ b/drivers/staging/omapdrm/omap_gem_dmabuf.c
@@ -194,7 +194,7 @@ struct dma_buf_ops omap_dmabuf_ops = {
194struct dma_buf *omap_gem_prime_export(struct drm_device *dev, 194struct dma_buf *omap_gem_prime_export(struct drm_device *dev,
195 struct drm_gem_object *obj, int flags) 195 struct drm_gem_object *obj, int flags)
196{ 196{
197 return dma_buf_export(obj, &omap_dmabuf_ops, obj->size, 0600); 197 return dma_buf_export(obj, &omap_dmabuf_ops, obj->size, flags);
198} 198}
199 199
200struct drm_gem_object *omap_gem_prime_import(struct drm_device *dev, 200struct drm_gem_object *omap_gem_prime_import(struct drm_device *dev,
@@ -207,7 +207,12 @@ struct drm_gem_object *omap_gem_prime_import(struct drm_device *dev,
207 obj = buffer->priv; 207 obj = buffer->priv;
208 /* is it from our device? */ 208 /* is it from our device? */
209 if (obj->dev == dev) { 209 if (obj->dev == dev) {
210 /*
211 * Importing dmabuf exported from out own gem increases
212 * refcount on gem itself instead of f_count of dmabuf.
213 */
210 drm_gem_object_reference(obj); 214 drm_gem_object_reference(obj);
215 dma_buf_put(buffer);
211 return obj; 216 return obj;
212 } 217 }
213 } 218 }
diff --git a/drivers/staging/omapdrm/omap_irq.c b/drivers/staging/omapdrm/omap_irq.c
new file mode 100644
index 000000000000..2629ba7be6c8
--- /dev/null
+++ b/drivers/staging/omapdrm/omap_irq.c
@@ -0,0 +1,322 @@
1/*
2 * drivers/staging/omapdrm/omap_irq.c
3 *
4 * Copyright (C) 2012 Texas Instruments
5 * Author: Rob Clark <rob.clark@linaro.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include "omap_drv.h"
21
22static DEFINE_SPINLOCK(list_lock);
23
24static void omap_irq_error_handler(struct omap_drm_irq *irq,
25 uint32_t irqstatus)
26{
27 DRM_ERROR("errors: %08x\n", irqstatus);
28}
29
30/* call with list_lock and dispc runtime held */
31static void omap_irq_update(struct drm_device *dev)
32{
33 struct omap_drm_private *priv = dev->dev_private;
34 struct omap_drm_irq *irq;
35 uint32_t irqmask = priv->vblank_mask;
36
37 BUG_ON(!spin_is_locked(&list_lock));
38
39 list_for_each_entry(irq, &priv->irq_list, node)
40 irqmask |= irq->irqmask;
41
42 DBG("irqmask=%08x", irqmask);
43
44 dispc_write_irqenable(irqmask);
45 dispc_read_irqenable(); /* flush posted write */
46}
47
48void omap_irq_register(struct drm_device *dev, struct omap_drm_irq *irq)
49{
50 struct omap_drm_private *priv = dev->dev_private;
51 unsigned long flags;
52
53 dispc_runtime_get();
54 spin_lock_irqsave(&list_lock, flags);
55
56 if (!WARN_ON(irq->registered)) {
57 irq->registered = true;
58 list_add(&irq->node, &priv->irq_list);
59 omap_irq_update(dev);
60 }
61
62 spin_unlock_irqrestore(&list_lock, flags);
63 dispc_runtime_put();
64}
65
66void omap_irq_unregister(struct drm_device *dev, struct omap_drm_irq *irq)
67{
68 unsigned long flags;
69
70 dispc_runtime_get();
71 spin_lock_irqsave(&list_lock, flags);
72
73 if (!WARN_ON(!irq->registered)) {
74 irq->registered = false;
75 list_del(&irq->node);
76 omap_irq_update(dev);
77 }
78
79 spin_unlock_irqrestore(&list_lock, flags);
80 dispc_runtime_put();
81}
82
83struct omap_irq_wait {
84 struct omap_drm_irq irq;
85 int count;
86};
87
88static DECLARE_WAIT_QUEUE_HEAD(wait_event);
89
90static void wait_irq(struct omap_drm_irq *irq, uint32_t irqstatus)
91{
92 struct omap_irq_wait *wait =
93 container_of(irq, struct omap_irq_wait, irq);
94 wait->count--;
95 wake_up_all(&wait_event);
96}
97
98struct omap_irq_wait * omap_irq_wait_init(struct drm_device *dev,
99 uint32_t irqmask, int count)
100{
101 struct omap_irq_wait *wait = kzalloc(sizeof(*wait), GFP_KERNEL);
102 wait->irq.irq = wait_irq;
103 wait->irq.irqmask = irqmask;
104 wait->count = count;
105 omap_irq_register(dev, &wait->irq);
106 return wait;
107}
108
109int omap_irq_wait(struct drm_device *dev, struct omap_irq_wait *wait,
110 unsigned long timeout)
111{
112 int ret = wait_event_timeout(wait_event, (wait->count <= 0), timeout);
113 omap_irq_unregister(dev, &wait->irq);
114 kfree(wait);
115 if (ret == 0)
116 return -1;
117 return 0;
118}
119
120/**
121 * enable_vblank - enable vblank interrupt events
122 * @dev: DRM device
123 * @crtc: which irq to enable
124 *
125 * Enable vblank interrupts for @crtc. If the device doesn't have
126 * a hardware vblank counter, this routine should be a no-op, since
127 * interrupts will have to stay on to keep the count accurate.
128 *
129 * RETURNS
130 * Zero on success, appropriate errno if the given @crtc's vblank
131 * interrupt cannot be enabled.
132 */
133int omap_irq_enable_vblank(struct drm_device *dev, int crtc)
134{
135 struct omap_drm_private *priv = dev->dev_private;
136 unsigned long flags;
137
138 DBG("dev=%p, crtc=%d", dev, crtc);
139
140 dispc_runtime_get();
141 spin_lock_irqsave(&list_lock, flags);
142 priv->vblank_mask |= pipe2vbl(crtc);
143 omap_irq_update(dev);
144 spin_unlock_irqrestore(&list_lock, flags);
145 dispc_runtime_put();
146
147 return 0;
148}
149
150/**
151 * disable_vblank - disable vblank interrupt events
152 * @dev: DRM device
153 * @crtc: which irq to enable
154 *
155 * Disable vblank interrupts for @crtc. If the device doesn't have
156 * a hardware vblank counter, this routine should be a no-op, since
157 * interrupts will have to stay on to keep the count accurate.
158 */
159void omap_irq_disable_vblank(struct drm_device *dev, int crtc)
160{
161 struct omap_drm_private *priv = dev->dev_private;
162 unsigned long flags;
163
164 DBG("dev=%p, crtc=%d", dev, crtc);
165
166 dispc_runtime_get();
167 spin_lock_irqsave(&list_lock, flags);
168 priv->vblank_mask &= ~pipe2vbl(crtc);
169 omap_irq_update(dev);
170 spin_unlock_irqrestore(&list_lock, flags);
171 dispc_runtime_put();
172}
173
174irqreturn_t omap_irq_handler(DRM_IRQ_ARGS)
175{
176 struct drm_device *dev = (struct drm_device *) arg;
177 struct omap_drm_private *priv = dev->dev_private;
178 struct omap_drm_irq *handler, *n;
179 unsigned long flags;
180 unsigned int id;
181 u32 irqstatus;
182
183 irqstatus = dispc_read_irqstatus();
184 dispc_clear_irqstatus(irqstatus);
185 dispc_read_irqstatus(); /* flush posted write */
186
187 VERB("irqs: %08x", irqstatus);
188
189 for (id = 0; id < priv->num_crtcs; id++)
190 if (irqstatus & pipe2vbl(id))
191 drm_handle_vblank(dev, id);
192
193 spin_lock_irqsave(&list_lock, flags);
194 list_for_each_entry_safe(handler, n, &priv->irq_list, node) {
195 if (handler->irqmask & irqstatus) {
196 spin_unlock_irqrestore(&list_lock, flags);
197 handler->irq(handler, handler->irqmask & irqstatus);
198 spin_lock_irqsave(&list_lock, flags);
199 }
200 }
201 spin_unlock_irqrestore(&list_lock, flags);
202
203 return IRQ_HANDLED;
204}
205
206void omap_irq_preinstall(struct drm_device *dev)
207{
208 DBG("dev=%p", dev);
209 dispc_runtime_get();
210 dispc_clear_irqstatus(0xffffffff);
211 dispc_runtime_put();
212}
213
214int omap_irq_postinstall(struct drm_device *dev)
215{
216 struct omap_drm_private *priv = dev->dev_private;
217 struct omap_drm_irq *error_handler = &priv->error_handler;
218
219 DBG("dev=%p", dev);
220
221 INIT_LIST_HEAD(&priv->irq_list);
222
223 error_handler->irq = omap_irq_error_handler;
224 error_handler->irqmask = DISPC_IRQ_OCP_ERR;
225
226 /* for now ignore DISPC_IRQ_SYNC_LOST_DIGIT.. really I think
227 * we just need to ignore it while enabling tv-out
228 */
229 error_handler->irqmask &= ~DISPC_IRQ_SYNC_LOST_DIGIT;
230
231 omap_irq_register(dev, error_handler);
232
233 return 0;
234}
235
236void omap_irq_uninstall(struct drm_device *dev)
237{
238 DBG("dev=%p", dev);
239 // TODO prolly need to call drm_irq_uninstall() somewhere too
240}
241
242/*
243 * We need a special version, instead of just using drm_irq_install(),
244 * because we need to register the irq via omapdss. Once omapdss and
245 * omapdrm are merged together we can assign the dispc hwmod data to
246 * ourselves and drop these and just use drm_irq_{install,uninstall}()
247 */
248
249int omap_drm_irq_install(struct drm_device *dev)
250{
251 int ret;
252
253 mutex_lock(&dev->struct_mutex);
254
255 if (dev->irq_enabled) {
256 mutex_unlock(&dev->struct_mutex);
257 return -EBUSY;
258 }
259 dev->irq_enabled = 1;
260 mutex_unlock(&dev->struct_mutex);
261
262 /* Before installing handler */
263 if (dev->driver->irq_preinstall)
264 dev->driver->irq_preinstall(dev);
265
266 ret = dispc_request_irq(dev->driver->irq_handler, dev);
267
268 if (ret < 0) {
269 mutex_lock(&dev->struct_mutex);
270 dev->irq_enabled = 0;
271 mutex_unlock(&dev->struct_mutex);
272 return ret;
273 }
274
275 /* After installing handler */
276 if (dev->driver->irq_postinstall)
277 ret = dev->driver->irq_postinstall(dev);
278
279 if (ret < 0) {
280 mutex_lock(&dev->struct_mutex);
281 dev->irq_enabled = 0;
282 mutex_unlock(&dev->struct_mutex);
283 dispc_free_irq(dev);
284 }
285
286 return ret;
287}
288
289int omap_drm_irq_uninstall(struct drm_device *dev)
290{
291 unsigned long irqflags;
292 int irq_enabled, i;
293
294 mutex_lock(&dev->struct_mutex);
295 irq_enabled = dev->irq_enabled;
296 dev->irq_enabled = 0;
297 mutex_unlock(&dev->struct_mutex);
298
299 /*
300 * Wake up any waiters so they don't hang.
301 */
302 if (dev->num_crtcs) {
303 spin_lock_irqsave(&dev->vbl_lock, irqflags);
304 for (i = 0; i < dev->num_crtcs; i++) {
305 DRM_WAKEUP(&dev->vbl_queue[i]);
306 dev->vblank_enabled[i] = 0;
307 dev->last_vblank[i] =
308 dev->driver->get_vblank_counter(dev, i);
309 }
310 spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
311 }
312
313 if (!irq_enabled)
314 return -EINVAL;
315
316 if (dev->driver->irq_uninstall)
317 dev->driver->irq_uninstall(dev);
318
319 dispc_free_irq(dev);
320
321 return 0;
322}
diff --git a/drivers/staging/omapdrm/omap_plane.c b/drivers/staging/omapdrm/omap_plane.c
index 2a8e5bab49c9..bb989d7f026d 100644
--- a/drivers/staging/omapdrm/omap_plane.c
+++ b/drivers/staging/omapdrm/omap_plane.c
@@ -41,12 +41,14 @@ struct callback {
41 41
42struct omap_plane { 42struct omap_plane {
43 struct drm_plane base; 43 struct drm_plane base;
44 struct omap_overlay *ovl; 44 int id; /* TODO rename omap_plane -> omap_plane_id in omapdss so I can use the enum */
45 const char *name;
45 struct omap_overlay_info info; 46 struct omap_overlay_info info;
47 struct omap_drm_apply apply;
46 48
47 /* position/orientation of scanout within the fb: */ 49 /* position/orientation of scanout within the fb: */
48 struct omap_drm_window win; 50 struct omap_drm_window win;
49 51 bool enabled;
50 52
51 /* last fb that we pinned: */ 53 /* last fb that we pinned: */
52 struct drm_framebuffer *pinned_fb; 54 struct drm_framebuffer *pinned_fb;
@@ -54,189 +56,15 @@ struct omap_plane {
54 uint32_t nformats; 56 uint32_t nformats;
55 uint32_t formats[32]; 57 uint32_t formats[32];
56 58
57 /* for synchronizing access to unpins fifo */ 59 struct omap_drm_irq error_irq;
58 struct mutex unpin_mutex;
59 60
60 /* set of bo's pending unpin until next END_WIN irq */ 61 /* set of bo's pending unpin until next post_apply() */
61 DECLARE_KFIFO_PTR(unpin_fifo, struct drm_gem_object *); 62 DECLARE_KFIFO_PTR(unpin_fifo, struct drm_gem_object *);
62 int num_unpins, pending_num_unpins;
63
64 /* for deferred unpin when we need to wait for scanout complete irq */
65 struct work_struct work;
66
67 /* callback on next endwin irq */
68 struct callback endwin;
69};
70 63
71/* map from ovl->id to the irq we are interested in for scanout-done */ 64 // XXX maybe get rid of this and handle vblank in crtc too?
72static const uint32_t id2irq[] = { 65 struct callback apply_done_cb;
73 [OMAP_DSS_GFX] = DISPC_IRQ_GFX_END_WIN,
74 [OMAP_DSS_VIDEO1] = DISPC_IRQ_VID1_END_WIN,
75 [OMAP_DSS_VIDEO2] = DISPC_IRQ_VID2_END_WIN,
76 [OMAP_DSS_VIDEO3] = DISPC_IRQ_VID3_END_WIN,
77}; 66};
78 67
79static void dispc_isr(void *arg, uint32_t mask)
80{
81 struct drm_plane *plane = arg;
82 struct omap_plane *omap_plane = to_omap_plane(plane);
83 struct omap_drm_private *priv = plane->dev->dev_private;
84
85 omap_dispc_unregister_isr(dispc_isr, plane,
86 id2irq[omap_plane->ovl->id]);
87
88 queue_work(priv->wq, &omap_plane->work);
89}
90
91static void unpin_worker(struct work_struct *work)
92{
93 struct omap_plane *omap_plane =
94 container_of(work, struct omap_plane, work);
95 struct callback endwin;
96
97 mutex_lock(&omap_plane->unpin_mutex);
98 DBG("unpinning %d of %d", omap_plane->num_unpins,
99 omap_plane->num_unpins + omap_plane->pending_num_unpins);
100 while (omap_plane->num_unpins > 0) {
101 struct drm_gem_object *bo = NULL;
102 int ret = kfifo_get(&omap_plane->unpin_fifo, &bo);
103 WARN_ON(!ret);
104 omap_gem_put_paddr(bo);
105 drm_gem_object_unreference_unlocked(bo);
106 omap_plane->num_unpins--;
107 }
108 endwin = omap_plane->endwin;
109 omap_plane->endwin.fxn = NULL;
110 mutex_unlock(&omap_plane->unpin_mutex);
111
112 if (endwin.fxn)
113 endwin.fxn(endwin.arg);
114}
115
116static void install_irq(struct drm_plane *plane)
117{
118 struct omap_plane *omap_plane = to_omap_plane(plane);
119 struct omap_overlay *ovl = omap_plane->ovl;
120 int ret;
121
122 ret = omap_dispc_register_isr(dispc_isr, plane, id2irq[ovl->id]);
123
124 /*
125 * omapdss has upper limit on # of registered irq handlers,
126 * which we shouldn't hit.. but if we do the limit should
127 * be raised or bad things happen:
128 */
129 WARN_ON(ret == -EBUSY);
130}
131
132/* push changes down to dss2 */
133static int commit(struct drm_plane *plane)
134{
135 struct drm_device *dev = plane->dev;
136 struct omap_plane *omap_plane = to_omap_plane(plane);
137 struct omap_overlay *ovl = omap_plane->ovl;
138 struct omap_overlay_info *info = &omap_plane->info;
139 int ret;
140
141 DBG("%s", ovl->name);
142 DBG("%dx%d -> %dx%d (%d)", info->width, info->height, info->out_width,
143 info->out_height, info->screen_width);
144 DBG("%d,%d %08x %08x", info->pos_x, info->pos_y,
145 info->paddr, info->p_uv_addr);
146
147 /* NOTE: do we want to do this at all here, or just wait
148 * for dpms(ON) since other CRTC's may not have their mode
149 * set yet, so fb dimensions may still change..
150 */
151 ret = ovl->set_overlay_info(ovl, info);
152 if (ret) {
153 dev_err(dev->dev, "could not set overlay info\n");
154 return ret;
155 }
156
157 mutex_lock(&omap_plane->unpin_mutex);
158 omap_plane->num_unpins += omap_plane->pending_num_unpins;
159 omap_plane->pending_num_unpins = 0;
160 mutex_unlock(&omap_plane->unpin_mutex);
161
162 /* our encoder doesn't necessarily get a commit() after this, in
163 * particular in the dpms() and mode_set_base() cases, so force the
164 * manager to update:
165 *
166 * could this be in the encoder somehow?
167 */
168 if (ovl->manager) {
169 ret = ovl->manager->apply(ovl->manager);
170 if (ret) {
171 dev_err(dev->dev, "could not apply settings\n");
172 return ret;
173 }
174
175 /*
176 * NOTE: really this should be atomic w/ mgr->apply() but
177 * omapdss does not expose such an API
178 */
179 if (omap_plane->num_unpins > 0)
180 install_irq(plane);
181
182 } else {
183 struct omap_drm_private *priv = dev->dev_private;
184 queue_work(priv->wq, &omap_plane->work);
185 }
186
187
188 if (ovl->is_enabled(ovl)) {
189 omap_framebuffer_flush(plane->fb, info->pos_x, info->pos_y,
190 info->out_width, info->out_height);
191 }
192
193 return 0;
194}
195
196/* when CRTC that we are attached to has potentially changed, this checks
197 * if we are attached to proper manager, and if necessary updates.
198 */
199static void update_manager(struct drm_plane *plane)
200{
201 struct omap_drm_private *priv = plane->dev->dev_private;
202 struct omap_plane *omap_plane = to_omap_plane(plane);
203 struct omap_overlay *ovl = omap_plane->ovl;
204 struct omap_overlay_manager *mgr = NULL;
205 int i;
206
207 if (plane->crtc) {
208 for (i = 0; i < priv->num_encoders; i++) {
209 struct drm_encoder *encoder = priv->encoders[i];
210 if (encoder->crtc == plane->crtc) {
211 mgr = omap_encoder_get_manager(encoder);
212 break;
213 }
214 }
215 }
216
217 if (ovl->manager != mgr) {
218 bool enabled = ovl->is_enabled(ovl);
219
220 /* don't switch things around with enabled overlays: */
221 if (enabled)
222 omap_plane_dpms(plane, DRM_MODE_DPMS_OFF);
223
224 if (ovl->manager) {
225 DBG("disconnecting %s from %s", ovl->name,
226 ovl->manager->name);
227 ovl->unset_manager(ovl);
228 }
229
230 if (mgr) {
231 DBG("connecting %s to %s", ovl->name, mgr->name);
232 ovl->set_manager(ovl, mgr);
233 }
234
235 if (enabled && mgr)
236 omap_plane_dpms(plane, DRM_MODE_DPMS_ON);
237 }
238}
239
240static void unpin(void *arg, struct drm_gem_object *bo) 68static void unpin(void *arg, struct drm_gem_object *bo)
241{ 69{
242 struct drm_plane *plane = arg; 70 struct drm_plane *plane = arg;
@@ -244,7 +72,6 @@ static void unpin(void *arg, struct drm_gem_object *bo)
244 72
245 if (kfifo_put(&omap_plane->unpin_fifo, 73 if (kfifo_put(&omap_plane->unpin_fifo,
246 (const struct drm_gem_object **)&bo)) { 74 (const struct drm_gem_object **)&bo)) {
247 omap_plane->pending_num_unpins++;
248 /* also hold a ref so it isn't free'd while pinned */ 75 /* also hold a ref so it isn't free'd while pinned */
249 drm_gem_object_reference(bo); 76 drm_gem_object_reference(bo);
250 } else { 77 } else {
@@ -264,13 +91,19 @@ static int update_pin(struct drm_plane *plane, struct drm_framebuffer *fb)
264 91
265 DBG("%p -> %p", pinned_fb, fb); 92 DBG("%p -> %p", pinned_fb, fb);
266 93
267 mutex_lock(&omap_plane->unpin_mutex); 94 if (fb)
95 drm_framebuffer_reference(fb);
96
268 ret = omap_framebuffer_replace(pinned_fb, fb, plane, unpin); 97 ret = omap_framebuffer_replace(pinned_fb, fb, plane, unpin);
269 mutex_unlock(&omap_plane->unpin_mutex); 98
99 if (pinned_fb)
100 drm_framebuffer_unreference(pinned_fb);
270 101
271 if (ret) { 102 if (ret) {
272 dev_err(plane->dev->dev, "could not swap %p -> %p\n", 103 dev_err(plane->dev->dev, "could not swap %p -> %p\n",
273 omap_plane->pinned_fb, fb); 104 omap_plane->pinned_fb, fb);
105 if (fb)
106 drm_framebuffer_unreference(fb);
274 omap_plane->pinned_fb = NULL; 107 omap_plane->pinned_fb = NULL;
275 return ret; 108 return ret;
276 } 109 }
@@ -281,31 +114,90 @@ static int update_pin(struct drm_plane *plane, struct drm_framebuffer *fb)
281 return 0; 114 return 0;
282} 115}
283 116
284/* update parameters that are dependent on the framebuffer dimensions and 117static void omap_plane_pre_apply(struct omap_drm_apply *apply)
285 * position within the fb that this plane scans out from. This is called
286 * when framebuffer or x,y base may have changed.
287 */
288static void update_scanout(struct drm_plane *plane)
289{ 118{
290 struct omap_plane *omap_plane = to_omap_plane(plane); 119 struct omap_plane *omap_plane =
291 struct omap_overlay_info *info = &omap_plane->info; 120 container_of(apply, struct omap_plane, apply);
292 struct omap_drm_window *win = &omap_plane->win; 121 struct omap_drm_window *win = &omap_plane->win;
122 struct drm_plane *plane = &omap_plane->base;
123 struct drm_device *dev = plane->dev;
124 struct omap_overlay_info *info = &omap_plane->info;
125 struct drm_crtc *crtc = plane->crtc;
126 enum omap_channel channel;
127 bool enabled = omap_plane->enabled && crtc;
128 bool ilace, replication;
293 int ret; 129 int ret;
294 130
295 ret = update_pin(plane, plane->fb); 131 DBG("%s, enabled=%d", omap_plane->name, enabled);
296 if (ret) { 132
297 dev_err(plane->dev->dev, 133 /* if fb has changed, pin new fb: */
298 "could not pin fb: %d\n", ret); 134 update_pin(plane, enabled ? plane->fb : NULL);
299 omap_plane_dpms(plane, DRM_MODE_DPMS_OFF); 135
136 if (!enabled) {
137 dispc_ovl_enable(omap_plane->id, false);
300 return; 138 return;
301 } 139 }
302 140
141 channel = omap_crtc_channel(crtc);
142
143 /* update scanout: */
303 omap_framebuffer_update_scanout(plane->fb, win, info); 144 omap_framebuffer_update_scanout(plane->fb, win, info);
304 145
305 DBG("%s: %d,%d: %08x %08x (%d)", omap_plane->ovl->name, 146 DBG("%dx%d -> %dx%d (%d)", info->width, info->height,
306 win->src_x, win->src_y, 147 info->out_width, info->out_height,
307 (u32)info->paddr, (u32)info->p_uv_addr,
308 info->screen_width); 148 info->screen_width);
149 DBG("%d,%d %08x %08x", info->pos_x, info->pos_y,
150 info->paddr, info->p_uv_addr);
151
152 /* TODO: */
153 ilace = false;
154 replication = false;
155
156 /* and finally, update omapdss: */
157 ret = dispc_ovl_setup(omap_plane->id, info,
158 replication, omap_crtc_timings(crtc), false);
159 if (ret) {
160 dev_err(dev->dev, "dispc_ovl_setup failed: %d\n", ret);
161 return;
162 }
163
164 dispc_ovl_enable(omap_plane->id, true);
165 dispc_ovl_set_channel_out(omap_plane->id, channel);
166}
167
168static void omap_plane_post_apply(struct omap_drm_apply *apply)
169{
170 struct omap_plane *omap_plane =
171 container_of(apply, struct omap_plane, apply);
172 struct drm_plane *plane = &omap_plane->base;
173 struct omap_overlay_info *info = &omap_plane->info;
174 struct drm_gem_object *bo = NULL;
175 struct callback cb;
176
177 cb = omap_plane->apply_done_cb;
178 omap_plane->apply_done_cb.fxn = NULL;
179
180 while (kfifo_get(&omap_plane->unpin_fifo, &bo)) {
181 omap_gem_put_paddr(bo);
182 drm_gem_object_unreference_unlocked(bo);
183 }
184
185 if (cb.fxn)
186 cb.fxn(cb.arg);
187
188 if (omap_plane->enabled) {
189 omap_framebuffer_flush(plane->fb, info->pos_x, info->pos_y,
190 info->out_width, info->out_height);
191 }
192}
193
194static int apply(struct drm_plane *plane)
195{
196 if (plane->crtc) {
197 struct omap_plane *omap_plane = to_omap_plane(plane);
198 return omap_crtc_apply(plane->crtc, &omap_plane->apply);
199 }
200 return 0;
309} 201}
310 202
311int omap_plane_mode_set(struct drm_plane *plane, 203int omap_plane_mode_set(struct drm_plane *plane,
@@ -313,7 +205,8 @@ int omap_plane_mode_set(struct drm_plane *plane,
313 int crtc_x, int crtc_y, 205 int crtc_x, int crtc_y,
314 unsigned int crtc_w, unsigned int crtc_h, 206 unsigned int crtc_w, unsigned int crtc_h,
315 uint32_t src_x, uint32_t src_y, 207 uint32_t src_x, uint32_t src_y,
316 uint32_t src_w, uint32_t src_h) 208 uint32_t src_w, uint32_t src_h,
209 void (*fxn)(void *), void *arg)
317{ 210{
318 struct omap_plane *omap_plane = to_omap_plane(plane); 211 struct omap_plane *omap_plane = to_omap_plane(plane);
319 struct omap_drm_window *win = &omap_plane->win; 212 struct omap_drm_window *win = &omap_plane->win;
@@ -329,17 +222,20 @@ int omap_plane_mode_set(struct drm_plane *plane,
329 win->src_w = src_w >> 16; 222 win->src_w = src_w >> 16;
330 win->src_h = src_h >> 16; 223 win->src_h = src_h >> 16;
331 224
332 /* note: this is done after this fxn returns.. but if we need 225 if (fxn) {
333 * to do a commit/update_scanout, etc before this returns we 226 /* omap_crtc should ensure that a new page flip
334 * need the current value. 227 * isn't permitted while there is one pending:
335 */ 228 */
229 BUG_ON(omap_plane->apply_done_cb.fxn);
230
231 omap_plane->apply_done_cb.fxn = fxn;
232 omap_plane->apply_done_cb.arg = arg;
233 }
234
336 plane->fb = fb; 235 plane->fb = fb;
337 plane->crtc = crtc; 236 plane->crtc = crtc;
338 237
339 update_scanout(plane); 238 return apply(plane);
340 update_manager(plane);
341
342 return 0;
343} 239}
344 240
345static int omap_plane_update(struct drm_plane *plane, 241static int omap_plane_update(struct drm_plane *plane,
@@ -349,9 +245,12 @@ static int omap_plane_update(struct drm_plane *plane,
349 uint32_t src_x, uint32_t src_y, 245 uint32_t src_x, uint32_t src_y,
350 uint32_t src_w, uint32_t src_h) 246 uint32_t src_w, uint32_t src_h)
351{ 247{
352 omap_plane_mode_set(plane, crtc, fb, crtc_x, crtc_y, crtc_w, crtc_h, 248 struct omap_plane *omap_plane = to_omap_plane(plane);
353 src_x, src_y, src_w, src_h); 249 omap_plane->enabled = true;
354 return omap_plane_dpms(plane, DRM_MODE_DPMS_ON); 250 return omap_plane_mode_set(plane, crtc, fb,
251 crtc_x, crtc_y, crtc_w, crtc_h,
252 src_x, src_y, src_w, src_h,
253 NULL, NULL);
355} 254}
356 255
357static int omap_plane_disable(struct drm_plane *plane) 256static int omap_plane_disable(struct drm_plane *plane)
@@ -364,48 +263,32 @@ static int omap_plane_disable(struct drm_plane *plane)
364static void omap_plane_destroy(struct drm_plane *plane) 263static void omap_plane_destroy(struct drm_plane *plane)
365{ 264{
366 struct omap_plane *omap_plane = to_omap_plane(plane); 265 struct omap_plane *omap_plane = to_omap_plane(plane);
367 DBG("%s", omap_plane->ovl->name); 266
267 DBG("%s", omap_plane->name);
268
269 omap_irq_unregister(plane->dev, &omap_plane->error_irq);
270
368 omap_plane_disable(plane); 271 omap_plane_disable(plane);
369 drm_plane_cleanup(plane); 272 drm_plane_cleanup(plane);
370 WARN_ON(omap_plane->pending_num_unpins + omap_plane->num_unpins > 0); 273
274 WARN_ON(!kfifo_is_empty(&omap_plane->unpin_fifo));
371 kfifo_free(&omap_plane->unpin_fifo); 275 kfifo_free(&omap_plane->unpin_fifo);
276
372 kfree(omap_plane); 277 kfree(omap_plane);
373} 278}
374 279
375int omap_plane_dpms(struct drm_plane *plane, int mode) 280int omap_plane_dpms(struct drm_plane *plane, int mode)
376{ 281{
377 struct omap_plane *omap_plane = to_omap_plane(plane); 282 struct omap_plane *omap_plane = to_omap_plane(plane);
378 struct omap_overlay *ovl = omap_plane->ovl; 283 bool enabled = (mode == DRM_MODE_DPMS_ON);
379 int r; 284 int ret = 0;
380 285
381 DBG("%s: %d", omap_plane->ovl->name, mode); 286 if (enabled != omap_plane->enabled) {
382 287 omap_plane->enabled = enabled;
383 if (mode == DRM_MODE_DPMS_ON) { 288 ret = apply(plane);
384 update_scanout(plane);
385 r = commit(plane);
386 if (!r)
387 r = ovl->enable(ovl);
388 } else {
389 struct omap_drm_private *priv = plane->dev->dev_private;
390 r = ovl->disable(ovl);
391 update_pin(plane, NULL);
392 queue_work(priv->wq, &omap_plane->work);
393 } 289 }
394 290
395 return r; 291 return ret;
396}
397
398void omap_plane_on_endwin(struct drm_plane *plane,
399 void (*fxn)(void *), void *arg)
400{
401 struct omap_plane *omap_plane = to_omap_plane(plane);
402
403 mutex_lock(&omap_plane->unpin_mutex);
404 omap_plane->endwin.fxn = fxn;
405 omap_plane->endwin.arg = arg;
406 mutex_unlock(&omap_plane->unpin_mutex);
407
408 install_irq(plane);
409} 292}
410 293
411/* helper to install properties which are common to planes and crtcs */ 294/* helper to install properties which are common to planes and crtcs */
@@ -454,25 +337,13 @@ int omap_plane_set_property(struct drm_plane *plane,
454 int ret = -EINVAL; 337 int ret = -EINVAL;
455 338
456 if (property == priv->rotation_prop) { 339 if (property == priv->rotation_prop) {
457 struct omap_overlay *ovl = omap_plane->ovl; 340 DBG("%s: rotation: %02x", omap_plane->name, (uint32_t)val);
458
459 DBG("%s: rotation: %02x", ovl->name, (uint32_t)val);
460 omap_plane->win.rotation = val; 341 omap_plane->win.rotation = val;
461 342 ret = apply(plane);
462 if (ovl->is_enabled(ovl))
463 ret = omap_plane_dpms(plane, DRM_MODE_DPMS_ON);
464 else
465 ret = 0;
466 } else if (property == priv->zorder_prop) { 343 } else if (property == priv->zorder_prop) {
467 struct omap_overlay *ovl = omap_plane->ovl; 344 DBG("%s: zorder: %02x", omap_plane->name, (uint32_t)val);
468
469 DBG("%s: zorder: %d", ovl->name, (uint32_t)val);
470 omap_plane->info.zorder = val; 345 omap_plane->info.zorder = val;
471 346 ret = apply(plane);
472 if (ovl->is_enabled(ovl))
473 ret = omap_plane_dpms(plane, DRM_MODE_DPMS_ON);
474 else
475 ret = 0;
476 } 347 }
477 348
478 return ret; 349 return ret;
@@ -485,20 +356,38 @@ static const struct drm_plane_funcs omap_plane_funcs = {
485 .set_property = omap_plane_set_property, 356 .set_property = omap_plane_set_property,
486}; 357};
487 358
359static void omap_plane_error_irq(struct omap_drm_irq *irq, uint32_t irqstatus)
360{
361 struct omap_plane *omap_plane =
362 container_of(irq, struct omap_plane, error_irq);
363 DRM_ERROR("%s: errors: %08x\n", omap_plane->name, irqstatus);
364}
365
366static const char *plane_names[] = {
367 [OMAP_DSS_GFX] = "gfx",
368 [OMAP_DSS_VIDEO1] = "vid1",
369 [OMAP_DSS_VIDEO2] = "vid2",
370 [OMAP_DSS_VIDEO3] = "vid3",
371};
372
373static const uint32_t error_irqs[] = {
374 [OMAP_DSS_GFX] = DISPC_IRQ_GFX_FIFO_UNDERFLOW,
375 [OMAP_DSS_VIDEO1] = DISPC_IRQ_VID1_FIFO_UNDERFLOW,
376 [OMAP_DSS_VIDEO2] = DISPC_IRQ_VID2_FIFO_UNDERFLOW,
377 [OMAP_DSS_VIDEO3] = DISPC_IRQ_VID3_FIFO_UNDERFLOW,
378};
379
488/* initialize plane */ 380/* initialize plane */
489struct drm_plane *omap_plane_init(struct drm_device *dev, 381struct drm_plane *omap_plane_init(struct drm_device *dev,
490 struct omap_overlay *ovl, unsigned int possible_crtcs, 382 int id, bool private_plane)
491 bool priv)
492{ 383{
384 struct omap_drm_private *priv = dev->dev_private;
493 struct drm_plane *plane = NULL; 385 struct drm_plane *plane = NULL;
494 struct omap_plane *omap_plane; 386 struct omap_plane *omap_plane;
387 struct omap_overlay_info *info;
495 int ret; 388 int ret;
496 389
497 DBG("%s: possible_crtcs=%08x, priv=%d", ovl->name, 390 DBG("%s: priv=%d", plane_names[id], private_plane);
498 possible_crtcs, priv);
499
500 /* friendly reminder to update table for future hw: */
501 WARN_ON(ovl->id >= ARRAY_SIZE(id2irq));
502 391
503 omap_plane = kzalloc(sizeof(*omap_plane), GFP_KERNEL); 392 omap_plane = kzalloc(sizeof(*omap_plane), GFP_KERNEL);
504 if (!omap_plane) { 393 if (!omap_plane) {
@@ -506,47 +395,50 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,
506 goto fail; 395 goto fail;
507 } 396 }
508 397
509 mutex_init(&omap_plane->unpin_mutex);
510
511 ret = kfifo_alloc(&omap_plane->unpin_fifo, 16, GFP_KERNEL); 398 ret = kfifo_alloc(&omap_plane->unpin_fifo, 16, GFP_KERNEL);
512 if (ret) { 399 if (ret) {
513 dev_err(dev->dev, "could not allocate unpin FIFO\n"); 400 dev_err(dev->dev, "could not allocate unpin FIFO\n");
514 goto fail; 401 goto fail;
515 } 402 }
516 403
517 INIT_WORK(&omap_plane->work, unpin_worker);
518
519 omap_plane->nformats = omap_framebuffer_get_formats( 404 omap_plane->nformats = omap_framebuffer_get_formats(
520 omap_plane->formats, ARRAY_SIZE(omap_plane->formats), 405 omap_plane->formats, ARRAY_SIZE(omap_plane->formats),
521 ovl->supported_modes); 406 dss_feat_get_supported_color_modes(id));
522 omap_plane->ovl = ovl; 407 omap_plane->id = id;
408 omap_plane->name = plane_names[id];
409
523 plane = &omap_plane->base; 410 plane = &omap_plane->base;
524 411
525 drm_plane_init(dev, plane, possible_crtcs, &omap_plane_funcs, 412 omap_plane->apply.pre_apply = omap_plane_pre_apply;
526 omap_plane->formats, omap_plane->nformats, priv); 413 omap_plane->apply.post_apply = omap_plane_post_apply;
414
415 omap_plane->error_irq.irqmask = error_irqs[id];
416 omap_plane->error_irq.irq = omap_plane_error_irq;
417 omap_irq_register(dev, &omap_plane->error_irq);
418
419 drm_plane_init(dev, plane, (1 << priv->num_crtcs) - 1, &omap_plane_funcs,
420 omap_plane->formats, omap_plane->nformats, private_plane);
527 421
528 omap_plane_install_properties(plane, &plane->base); 422 omap_plane_install_properties(plane, &plane->base);
529 423
530 /* get our starting configuration, set defaults for parameters 424 /* get our starting configuration, set defaults for parameters
531 * we don't currently use, etc: 425 * we don't currently use, etc:
532 */ 426 */
533 ovl->get_overlay_info(ovl, &omap_plane->info); 427 info = &omap_plane->info;
534 omap_plane->info.rotation_type = OMAP_DSS_ROT_DMA; 428 info->rotation_type = OMAP_DSS_ROT_DMA;
535 omap_plane->info.rotation = OMAP_DSS_ROT_0; 429 info->rotation = OMAP_DSS_ROT_0;
536 omap_plane->info.global_alpha = 0xff; 430 info->global_alpha = 0xff;
537 omap_plane->info.mirror = 0; 431 info->mirror = 0;
538 432
539 /* Set defaults depending on whether we are a CRTC or overlay 433 /* Set defaults depending on whether we are a CRTC or overlay
540 * layer. 434 * layer.
541 * TODO add ioctl to give userspace an API to change this.. this 435 * TODO add ioctl to give userspace an API to change this.. this
542 * will come in a subsequent patch. 436 * will come in a subsequent patch.
543 */ 437 */
544 if (priv) 438 if (private_plane)
545 omap_plane->info.zorder = 0; 439 omap_plane->info.zorder = 0;
546 else 440 else
547 omap_plane->info.zorder = ovl->id; 441 omap_plane->info.zorder = id;
548
549 update_manager(plane);
550 442
551 return plane; 443 return plane;
552 444
diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c
index ae38475854b5..d10d75e8a33f 100644
--- a/drivers/staging/rtl8187se/r8180_core.c
+++ b/drivers/staging/rtl8187se/r8180_core.c
@@ -937,7 +937,8 @@ short alloc_rx_desc_ring(struct net_device *dev, u16 bufsize, int count)
937 937
938 dma_tmp = pci_map_single(pdev, buf, bufsize * sizeof(u8), 938 dma_tmp = pci_map_single(pdev, buf, bufsize * sizeof(u8),
939 PCI_DMA_FROMDEVICE); 939 PCI_DMA_FROMDEVICE);
940 940 if (pci_dma_mapping_error(pdev, dma_tmp))
941 return -1;
941 if (-1 == buffer_add(&(priv->rxbuffer), buf, dma_tmp, 942 if (-1 == buffer_add(&(priv->rxbuffer), buf, dma_tmp,
942 &(priv->rxbufferhead))) { 943 &(priv->rxbufferhead))) {
943 DMESGE("Unable to allocate mem RX buf"); 944 DMESGE("Unable to allocate mem RX buf");
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
index 808aab6fa5ef..a9d78e9651c6 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
@@ -1183,6 +1183,8 @@ void rtl8192_tx_fill_desc(struct net_device *dev, struct tx_desc *pdesc,
1183 pTxFwInfo->TxRate, 1183 pTxFwInfo->TxRate,
1184 cb_desc); 1184 cb_desc);
1185 1185
1186 if (pci_dma_mapping_error(priv->pdev, mapping))
1187 RT_TRACE(COMP_ERR, "DMA Mapping error\n");;
1186 if (cb_desc->bAMPDUEnable) { 1188 if (cb_desc->bAMPDUEnable) {
1187 pTxFwInfo->AllowAggregation = 1; 1189 pTxFwInfo->AllowAggregation = 1;
1188 pTxFwInfo->RxMF = cb_desc->ampdu_factor; 1190 pTxFwInfo->RxMF = cb_desc->ampdu_factor;
@@ -1280,6 +1282,8 @@ void rtl8192_tx_fill_cmd_desc(struct net_device *dev,
1280 dma_addr_t mapping = pci_map_single(priv->pdev, skb->data, skb->len, 1282 dma_addr_t mapping = pci_map_single(priv->pdev, skb->data, skb->len,
1281 PCI_DMA_TODEVICE); 1283 PCI_DMA_TODEVICE);
1282 1284
1285 if (pci_dma_mapping_error(priv->pdev, mapping))
1286 RT_TRACE(COMP_ERR, "DMA Mapping error\n");;
1283 memset(entry, 0, 12); 1287 memset(entry, 0, 12);
1284 entry->LINIP = cb_desc->bLastIniPkt; 1288 entry->LINIP = cb_desc->bLastIniPkt;
1285 entry->FirstSeg = 1; 1289 entry->FirstSeg = 1;
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index 1a70f324552f..4ebf99b30975 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -2104,7 +2104,10 @@ static short rtl8192_alloc_rx_desc_ring(struct net_device *dev)
2104 skb_tail_pointer_rsl(skb), 2104 skb_tail_pointer_rsl(skb),
2105 priv->rxbuffersize, 2105 priv->rxbuffersize,
2106 PCI_DMA_FROMDEVICE); 2106 PCI_DMA_FROMDEVICE);
2107 2107 if (pci_dma_mapping_error(priv->pdev, *mapping)) {
2108 dev_kfree_skb_any(skb);
2109 return -1;
2110 }
2108 entry->BufferAddress = cpu_to_le32(*mapping); 2111 entry->BufferAddress = cpu_to_le32(*mapping);
2109 2112
2110 entry->Length = priv->rxbuffersize; 2113 entry->Length = priv->rxbuffersize;
@@ -2397,7 +2400,11 @@ static void rtl8192_rx_normal(struct net_device *dev)
2397 skb_tail_pointer_rsl(skb), 2400 skb_tail_pointer_rsl(skb),
2398 priv->rxbuffersize, 2401 priv->rxbuffersize,
2399 PCI_DMA_FROMDEVICE); 2402 PCI_DMA_FROMDEVICE);
2400 2403 if (pci_dma_mapping_error(priv->pdev,
2404 *((dma_addr_t *)skb->cb))) {
2405 dev_kfree_skb_any(skb);
2406 return;
2407 }
2401 } 2408 }
2402done: 2409done:
2403 pdesc->BufferAddress = cpu_to_le32(*((dma_addr_t *)skb->cb)); 2410 pdesc->BufferAddress = cpu_to_le32(*((dma_addr_t *)skb->cb));
diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c
index 6b73843e580a..a96cd06d69dd 100644
--- a/drivers/staging/rtl8712/usb_intf.c
+++ b/drivers/staging/rtl8712/usb_intf.c
@@ -63,6 +63,8 @@ static struct usb_device_id rtl871x_usb_id_tbl[] = {
63 {USB_DEVICE(0x0B05, 0x1791)}, /* 11n mode disable */ 63 {USB_DEVICE(0x0B05, 0x1791)}, /* 11n mode disable */
64 /* Belkin */ 64 /* Belkin */
65 {USB_DEVICE(0x050D, 0x945A)}, 65 {USB_DEVICE(0x050D, 0x945A)},
66 /* ISY IWL - Belkin clone */
67 {USB_DEVICE(0x050D, 0x11F1)},
66 /* Corega */ 68 /* Corega */
67 {USB_DEVICE(0x07AA, 0x0047)}, 69 {USB_DEVICE(0x07AA, 0x0047)},
68 /* D-Link */ 70 /* D-Link */
diff --git a/drivers/staging/sb105x/Kconfig b/drivers/staging/sb105x/Kconfig
index ac87c5e38dee..1facad625554 100644
--- a/drivers/staging/sb105x/Kconfig
+++ b/drivers/staging/sb105x/Kconfig
@@ -2,6 +2,7 @@ config SB105X
2 tristate "SystemBase PCI Multiport UART" 2 tristate "SystemBase PCI Multiport UART"
3 select SERIAL_CORE 3 select SERIAL_CORE
4 depends on PCI 4 depends on PCI
5 depends on X86
5 help 6 help
6 A driver for the SystemBase Multi-2/PCI serial card 7 A driver for the SystemBase Multi-2/PCI serial card
7 8
diff --git a/drivers/staging/sb105x/sb_pci_mp.c b/drivers/staging/sb105x/sb_pci_mp.c
index edb2a85b9d52..9464f3874346 100644
--- a/drivers/staging/sb105x/sb_pci_mp.c
+++ b/drivers/staging/sb105x/sb_pci_mp.c
@@ -3054,6 +3054,7 @@ static int init_mp_dev(struct pci_dev *pcidev, mppcibrd_t brd)
3054 sbdev->nr_ports = ((portnum_hex/16)*10) + (portnum_hex % 16); 3054 sbdev->nr_ports = ((portnum_hex/16)*10) + (portnum_hex % 16);
3055 } 3055 }
3056 break; 3056 break;
3057#ifdef CONFIG_PARPORT_PC
3057 case PCI_DEVICE_ID_MP2S1P : 3058 case PCI_DEVICE_ID_MP2S1P :
3058 sbdev->nr_ports = 2; 3059 sbdev->nr_ports = 2;
3059 3060
@@ -3073,6 +3074,7 @@ static int init_mp_dev(struct pci_dev *pcidev, mppcibrd_t brd)
3073 /* add PC compatible parallel port */ 3074 /* add PC compatible parallel port */
3074 parport_pc_probe_port(pcidev->resource[2].start, pcidev->resource[3].start, PARPORT_IRQ_NONE, PARPORT_DMA_NONE, &pcidev->dev, 0); 3075 parport_pc_probe_port(pcidev->resource[2].start, pcidev->resource[3].start, PARPORT_IRQ_NONE, PARPORT_DMA_NONE, &pcidev->dev, 0);
3075 break; 3076 break;
3077#endif
3076 } 3078 }
3077 3079
3078 ret = request_region(sbdev->uart_access_addr, (8*sbdev->nr_ports), sbdev->name); 3080 ret = request_region(sbdev->uart_access_addr, (8*sbdev->nr_ports), sbdev->name);
diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
index df9533798095..7616f058a00b 100644
--- a/drivers/staging/speakup/synth.c
+++ b/drivers/staging/speakup/synth.c
@@ -342,7 +342,7 @@ int synth_init(char *synth_name)
342 342
343 mutex_lock(&spk_mutex); 343 mutex_lock(&spk_mutex);
344 /* First, check if we already have it loaded. */ 344 /* First, check if we already have it loaded. */
345 for (i = 0; synths[i] != NULL && i < MAXSYNTHS; i++) 345 for (i = 0; i < MAXSYNTHS && synths[i] != NULL; i++)
346 if (strcmp(synths[i]->name, synth_name) == 0) 346 if (strcmp(synths[i]->name, synth_name) == 0)
347 synth = synths[i]; 347 synth = synths[i];
348 348
@@ -423,7 +423,7 @@ int synth_add(struct spk_synth *in_synth)
423 int i; 423 int i;
424 int status = 0; 424 int status = 0;
425 mutex_lock(&spk_mutex); 425 mutex_lock(&spk_mutex);
426 for (i = 0; synths[i] != NULL && i < MAXSYNTHS; i++) 426 for (i = 0; i < MAXSYNTHS && synths[i] != NULL; i++)
427 /* synth_remove() is responsible for rotating the array down */ 427 /* synth_remove() is responsible for rotating the array down */
428 if (in_synth == synths[i]) { 428 if (in_synth == synths[i]) {
429 mutex_unlock(&spk_mutex); 429 mutex_unlock(&spk_mutex);
diff --git a/drivers/staging/tidspbridge/core/_tiomap.h b/drivers/staging/tidspbridge/core/_tiomap.h
index 543a127c7d4d..b783bfa59b1c 100644
--- a/drivers/staging/tidspbridge/core/_tiomap.h
+++ b/drivers/staging/tidspbridge/core/_tiomap.h
@@ -31,7 +31,7 @@
31 * driver should read or write to PRM/CM registers directly; they 31 * driver should read or write to PRM/CM registers directly; they
32 * should rely on OMAP core code to do this. 32 * should rely on OMAP core code to do this.
33 */ 33 */
34#include <mach-omap2/cm2xxx_3xxx.h> 34#include <mach-omap2/cm3xxx.h>
35#include <mach-omap2/prm-regbits-34xx.h> 35#include <mach-omap2/prm-regbits-34xx.h>
36#include <mach-omap2/cm-regbits-34xx.h> 36#include <mach-omap2/cm-regbits-34xx.h>
37#include <dspbridge/devdefs.h> 37#include <dspbridge/devdefs.h>
diff --git a/drivers/staging/tidspbridge/core/dsp-clock.c b/drivers/staging/tidspbridge/core/dsp-clock.c
index b647207928b1..2f084e181d39 100644
--- a/drivers/staging/tidspbridge/core/dsp-clock.c
+++ b/drivers/staging/tidspbridge/core/dsp-clock.c
@@ -121,9 +121,13 @@ void dsp_clk_exit(void)
121 for (i = 0; i < DM_TIMER_CLOCKS; i++) 121 for (i = 0; i < DM_TIMER_CLOCKS; i++)
122 omap_dm_timer_free(timer[i]); 122 omap_dm_timer_free(timer[i]);
123 123
124 clk_unprepare(iva2_clk);
124 clk_put(iva2_clk); 125 clk_put(iva2_clk);
126 clk_unprepare(ssi.sst_fck);
125 clk_put(ssi.sst_fck); 127 clk_put(ssi.sst_fck);
128 clk_unprepare(ssi.ssr_fck);
126 clk_put(ssi.ssr_fck); 129 clk_put(ssi.ssr_fck);
130 clk_unprepare(ssi.ick);
127 clk_put(ssi.ick); 131 clk_put(ssi.ick);
128} 132}
129 133
@@ -145,14 +149,21 @@ void dsp_clk_init(void)
145 iva2_clk = clk_get(&dspbridge_device.dev, "iva2_ck"); 149 iva2_clk = clk_get(&dspbridge_device.dev, "iva2_ck");
146 if (IS_ERR(iva2_clk)) 150 if (IS_ERR(iva2_clk))
147 dev_err(bridge, "failed to get iva2 clock %p\n", iva2_clk); 151 dev_err(bridge, "failed to get iva2 clock %p\n", iva2_clk);
152 else
153 clk_prepare(iva2_clk);
148 154
149 ssi.sst_fck = clk_get(&dspbridge_device.dev, "ssi_sst_fck"); 155 ssi.sst_fck = clk_get(&dspbridge_device.dev, "ssi_sst_fck");
150 ssi.ssr_fck = clk_get(&dspbridge_device.dev, "ssi_ssr_fck"); 156 ssi.ssr_fck = clk_get(&dspbridge_device.dev, "ssi_ssr_fck");
151 ssi.ick = clk_get(&dspbridge_device.dev, "ssi_ick"); 157 ssi.ick = clk_get(&dspbridge_device.dev, "ssi_ick");
152 158
153 if (IS_ERR(ssi.sst_fck) || IS_ERR(ssi.ssr_fck) || IS_ERR(ssi.ick)) 159 if (IS_ERR(ssi.sst_fck) || IS_ERR(ssi.ssr_fck) || IS_ERR(ssi.ick)) {
154 dev_err(bridge, "failed to get ssi: sst %p, ssr %p, ick %p\n", 160 dev_err(bridge, "failed to get ssi: sst %p, ssr %p, ick %p\n",
155 ssi.sst_fck, ssi.ssr_fck, ssi.ick); 161 ssi.sst_fck, ssi.ssr_fck, ssi.ick);
162 } else {
163 clk_prepare(ssi.sst_fck);
164 clk_prepare(ssi.ssr_fck);
165 clk_prepare(ssi.ick);
166 }
156} 167}
157 168
158/** 169/**
diff --git a/drivers/staging/tidspbridge/core/wdt.c b/drivers/staging/tidspbridge/core/wdt.c
index 1dce36fb828f..7ff0e6c98039 100644
--- a/drivers/staging/tidspbridge/core/wdt.c
+++ b/drivers/staging/tidspbridge/core/wdt.c
@@ -63,11 +63,15 @@ int dsp_wdt_init(void)
63 dsp_wdt.fclk = clk_get(NULL, "wdt3_fck"); 63 dsp_wdt.fclk = clk_get(NULL, "wdt3_fck");
64 64
65 if (!IS_ERR(dsp_wdt.fclk)) { 65 if (!IS_ERR(dsp_wdt.fclk)) {
66 clk_prepare(dsp_wdt.fclk);
67
66 dsp_wdt.iclk = clk_get(NULL, "wdt3_ick"); 68 dsp_wdt.iclk = clk_get(NULL, "wdt3_ick");
67 if (IS_ERR(dsp_wdt.iclk)) { 69 if (IS_ERR(dsp_wdt.iclk)) {
68 clk_put(dsp_wdt.fclk); 70 clk_put(dsp_wdt.fclk);
69 dsp_wdt.fclk = NULL; 71 dsp_wdt.fclk = NULL;
70 ret = -EFAULT; 72 ret = -EFAULT;
73 } else {
74 clk_prepare(dsp_wdt.iclk);
71 } 75 }
72 } else 76 } else
73 ret = -EFAULT; 77 ret = -EFAULT;
@@ -95,10 +99,14 @@ void dsp_wdt_exit(void)
95 free_irq(INT_34XX_WDT3_IRQ, &dsp_wdt); 99 free_irq(INT_34XX_WDT3_IRQ, &dsp_wdt);
96 tasklet_kill(&dsp_wdt.wdt3_tasklet); 100 tasklet_kill(&dsp_wdt.wdt3_tasklet);
97 101
98 if (dsp_wdt.fclk) 102 if (dsp_wdt.fclk) {
103 clk_unprepare(dsp_wdt.fclk);
99 clk_put(dsp_wdt.fclk); 104 clk_put(dsp_wdt.fclk);
100 if (dsp_wdt.iclk) 105 }
106 if (dsp_wdt.iclk) {
107 clk_unprepare(dsp_wdt.iclk);
101 clk_put(dsp_wdt.iclk); 108 clk_put(dsp_wdt.iclk);
109 }
102 110
103 dsp_wdt.fclk = NULL; 111 dsp_wdt.fclk = NULL;
104 dsp_wdt.iclk = NULL; 112 dsp_wdt.iclk = NULL;
diff --git a/drivers/staging/vme/devices/vme_pio2_core.c b/drivers/staging/vme/devices/vme_pio2_core.c
index 0331178ca3b3..bf73ba26e88a 100644
--- a/drivers/staging/vme/devices/vme_pio2_core.c
+++ b/drivers/staging/vme/devices/vme_pio2_core.c
@@ -162,11 +162,9 @@ static struct vme_driver pio2_driver = {
162 162
163static int __init pio2_init(void) 163static int __init pio2_init(void)
164{ 164{
165 int retval = 0;
166
167 if (bus_num == 0) { 165 if (bus_num == 0) {
168 pr_err("No cards, skipping registration\n"); 166 pr_err("No cards, skipping registration\n");
169 goto err_nocard; 167 return -ENODEV;
170 } 168 }
171 169
172 if (bus_num > PIO2_CARDS_MAX) { 170 if (bus_num > PIO2_CARDS_MAX) {
@@ -176,15 +174,7 @@ static int __init pio2_init(void)
176 } 174 }
177 175
178 /* Register the PIO2 driver */ 176 /* Register the PIO2 driver */
179 retval = vme_register_driver(&pio2_driver, bus_num); 177 return vme_register_driver(&pio2_driver, bus_num);
180 if (retval != 0)
181 goto err_reg;
182
183 return retval;
184
185err_reg:
186err_nocard:
187 return retval;
188} 178}
189 179
190static int pio2_match(struct vme_dev *vdev) 180static int pio2_match(struct vme_dev *vdev)
diff --git a/drivers/staging/vt6656/bssdb.h b/drivers/staging/vt6656/bssdb.h
index 6b2ec390e775..806cbf72fb59 100644
--- a/drivers/staging/vt6656/bssdb.h
+++ b/drivers/staging/vt6656/bssdb.h
@@ -90,7 +90,6 @@ typedef struct tagSRSNCapObject {
90} SRSNCapObject, *PSRSNCapObject; 90} SRSNCapObject, *PSRSNCapObject;
91 91
92// BSS info(AP) 92// BSS info(AP)
93#pragma pack(1)
94typedef struct tagKnownBSS { 93typedef struct tagKnownBSS {
95 // BSS info 94 // BSS info
96 BOOL bActive; 95 BOOL bActive;
diff --git a/drivers/staging/vt6656/int.h b/drivers/staging/vt6656/int.h
index 5d8faf9f96ec..e0d2b07ba608 100644
--- a/drivers/staging/vt6656/int.h
+++ b/drivers/staging/vt6656/int.h
@@ -34,7 +34,6 @@
34#include "device.h" 34#include "device.h"
35 35
36/*--------------------- Export Definitions -------------------------*/ 36/*--------------------- Export Definitions -------------------------*/
37#pragma pack(1)
38typedef struct tagSINTData { 37typedef struct tagSINTData {
39 BYTE byTSR0; 38 BYTE byTSR0;
40 BYTE byPkt0; 39 BYTE byPkt0;
diff --git a/drivers/staging/vt6656/iocmd.h b/drivers/staging/vt6656/iocmd.h
index 22710cef751d..ae6e2d237b20 100644
--- a/drivers/staging/vt6656/iocmd.h
+++ b/drivers/staging/vt6656/iocmd.h
@@ -95,13 +95,12 @@ typedef enum tagWZONETYPE {
95// Ioctl interface structure 95// Ioctl interface structure
96// Command structure 96// Command structure
97// 97//
98#pragma pack(1)
99typedef struct tagSCmdRequest { 98typedef struct tagSCmdRequest {
100 u8 name[16]; 99 u8 name[16];
101 void *data; 100 void *data;
102 u16 wResult; 101 u16 wResult;
103 u16 wCmdCode; 102 u16 wCmdCode;
104} SCmdRequest, *PSCmdRequest; 103} __packed SCmdRequest, *PSCmdRequest;
105 104
106// 105//
107// Scan 106// Scan
@@ -111,7 +110,7 @@ typedef struct tagSCmdScan {
111 110
112 u8 ssid[SSID_MAXLEN + 2]; 111 u8 ssid[SSID_MAXLEN + 2];
113 112
114} SCmdScan, *PSCmdScan; 113} __packed SCmdScan, *PSCmdScan;
115 114
116// 115//
117// BSS Join 116// BSS Join
@@ -126,7 +125,7 @@ typedef struct tagSCmdBSSJoin {
126 BOOL bPSEnable; 125 BOOL bPSEnable;
127 BOOL bShareKeyAuth; 126 BOOL bShareKeyAuth;
128 127
129} SCmdBSSJoin, *PSCmdBSSJoin; 128} __packed SCmdBSSJoin, *PSCmdBSSJoin;
130 129
131// 130//
132// Zonetype Setting 131// Zonetype Setting
@@ -137,7 +136,7 @@ typedef struct tagSCmdZoneTypeSet {
137 BOOL bWrite; 136 BOOL bWrite;
138 WZONETYPE ZoneType; 137 WZONETYPE ZoneType;
139 138
140} SCmdZoneTypeSet, *PSCmdZoneTypeSet; 139} __packed SCmdZoneTypeSet, *PSCmdZoneTypeSet;
141 140
142typedef struct tagSWPAResult { 141typedef struct tagSWPAResult {
143 char ifname[100]; 142 char ifname[100];
@@ -145,7 +144,7 @@ typedef struct tagSWPAResult {
145 u8 key_mgmt; 144 u8 key_mgmt;
146 u8 eap_type; 145 u8 eap_type;
147 BOOL authenticated; 146 BOOL authenticated;
148} SWPAResult, *PSWPAResult; 147} __packed SWPAResult, *PSWPAResult;
149 148
150typedef struct tagSCmdStartAP { 149typedef struct tagSCmdStartAP {
151 150
@@ -157,7 +156,7 @@ typedef struct tagSCmdStartAP {
157 BOOL bShareKeyAuth; 156 BOOL bShareKeyAuth;
158 u8 byBasicRate; 157 u8 byBasicRate;
159 158
160} SCmdStartAP, *PSCmdStartAP; 159} __packed SCmdStartAP, *PSCmdStartAP;
161 160
162typedef struct tagSCmdSetWEP { 161typedef struct tagSCmdSetWEP {
163 162
@@ -167,7 +166,7 @@ typedef struct tagSCmdSetWEP {
167 BOOL bWepKeyAvailable[WEP_NKEYS]; 166 BOOL bWepKeyAvailable[WEP_NKEYS];
168 u32 auWepKeyLength[WEP_NKEYS]; 167 u32 auWepKeyLength[WEP_NKEYS];
169 168
170} SCmdSetWEP, *PSCmdSetWEP; 169} __packed SCmdSetWEP, *PSCmdSetWEP;
171 170
172typedef struct tagSBSSIDItem { 171typedef struct tagSBSSIDItem {
173 172
@@ -180,14 +179,14 @@ typedef struct tagSBSSIDItem {
180 BOOL bWEPOn; 179 BOOL bWEPOn;
181 u32 uRSSI; 180 u32 uRSSI;
182 181
183} SBSSIDItem; 182} __packed SBSSIDItem;
184 183
185 184
186typedef struct tagSBSSIDList { 185typedef struct tagSBSSIDList {
187 186
188 u32 uItem; 187 u32 uItem;
189 SBSSIDItem sBSSIDList[0]; 188 SBSSIDItem sBSSIDList[0];
190} SBSSIDList, *PSBSSIDList; 189} __packed SBSSIDList, *PSBSSIDList;
191 190
192 191
193typedef struct tagSNodeItem { 192typedef struct tagSNodeItem {
@@ -208,7 +207,7 @@ typedef struct tagSNodeItem {
208 u32 uTxAttempts; 207 u32 uTxAttempts;
209 u16 wFailureRatio; 208 u16 wFailureRatio;
210 209
211} SNodeItem; 210} __packed SNodeItem;
212 211
213 212
214typedef struct tagSNodeList { 213typedef struct tagSNodeList {
@@ -216,7 +215,7 @@ typedef struct tagSNodeList {
216 u32 uItem; 215 u32 uItem;
217 SNodeItem sNodeList[0]; 216 SNodeItem sNodeList[0];
218 217
219} SNodeList, *PSNodeList; 218} __packed SNodeList, *PSNodeList;
220 219
221 220
222typedef struct tagSCmdLinkStatus { 221typedef struct tagSCmdLinkStatus {
@@ -229,7 +228,7 @@ typedef struct tagSCmdLinkStatus {
229 u32 uChannel; 228 u32 uChannel;
230 u32 uLinkRate; 229 u32 uLinkRate;
231 230
232} SCmdLinkStatus, *PSCmdLinkStatus; 231} __packed SCmdLinkStatus, *PSCmdLinkStatus;
233 232
234// 233//
235// 802.11 counter 234// 802.11 counter
@@ -247,7 +246,7 @@ typedef struct tagSDot11MIBCount {
247 u32 ReceivedFragmentCount; 246 u32 ReceivedFragmentCount;
248 u32 MulticastReceivedFrameCount; 247 u32 MulticastReceivedFrameCount;
249 u32 FCSErrorCount; 248 u32 FCSErrorCount;
250} SDot11MIBCount, *PSDot11MIBCount; 249} __packed SDot11MIBCount, *PSDot11MIBCount;
251 250
252 251
253 252
@@ -355,13 +354,13 @@ typedef struct tagSStatMIBCount {
355 u32 ullTxBroadcastBytes[2]; 354 u32 ullTxBroadcastBytes[2];
356 u32 ullTxMulticastBytes[2]; 355 u32 ullTxMulticastBytes[2];
357 u32 ullTxDirectedBytes[2]; 356 u32 ullTxDirectedBytes[2];
358} SStatMIBCount, *PSStatMIBCount; 357} __packed SStatMIBCount, *PSStatMIBCount;
359 358
360typedef struct tagSCmdValue { 359typedef struct tagSCmdValue {
361 360
362 u32 dwValue; 361 u32 dwValue;
363 362
364} SCmdValue, *PSCmdValue; 363} __packed SCmdValue, *PSCmdValue;
365 364
366// 365//
367// hostapd & viawget ioctl related 366// hostapd & viawget ioctl related
@@ -431,7 +430,7 @@ struct viawget_hostapd_param {
431 u8 ssid[32]; 430 u8 ssid[32];
432 } scan_req; 431 } scan_req;
433 } u; 432 } u;
434}; 433} __packed;
435 434
436/*--------------------- Export Classes ----------------------------*/ 435/*--------------------- Export Classes ----------------------------*/
437 436
diff --git a/drivers/staging/vt6656/iowpa.h b/drivers/staging/vt6656/iowpa.h
index 959c8868f6e2..2522ddec718d 100644
--- a/drivers/staging/vt6656/iowpa.h
+++ b/drivers/staging/vt6656/iowpa.h
@@ -67,12 +67,11 @@ enum {
67 67
68 68
69 69
70#pragma pack(1)
71typedef struct viawget_wpa_header { 70typedef struct viawget_wpa_header {
72 u8 type; 71 u8 type;
73 u16 req_ie_len; 72 u16 req_ie_len;
74 u16 resp_ie_len; 73 u16 resp_ie_len;
75} viawget_wpa_header; 74} __packed viawget_wpa_header;
76 75
77struct viawget_wpa_param { 76struct viawget_wpa_param {
78 u32 cmd; 77 u32 cmd;
@@ -113,9 +112,8 @@ struct viawget_wpa_param {
113 u8 *buf; 112 u8 *buf;
114 } scan_results; 113 } scan_results;
115 } u; 114 } u;
116}; 115} __packed;
117 116
118#pragma pack(1)
119struct viawget_scan_result { 117struct viawget_scan_result {
120 u8 bssid[6]; 118 u8 bssid[6];
121 u8 ssid[32]; 119 u8 ssid[32];
@@ -130,7 +128,7 @@ struct viawget_scan_result {
130 int noise; 128 int noise;
131 int level; 129 int level;
132 int maxrate; 130 int maxrate;
133}; 131} __packed;
134 132
135/*--------------------- Export Classes ----------------------------*/ 133/*--------------------- Export Classes ----------------------------*/
136 134
diff --git a/drivers/staging/wlan-ng/cfg80211.c b/drivers/staging/wlan-ng/cfg80211.c
index 18c06a59c091..1d31eab19d16 100644
--- a/drivers/staging/wlan-ng/cfg80211.c
+++ b/drivers/staging/wlan-ng/cfg80211.c
@@ -638,8 +638,8 @@ int prism2_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
638} 638}
639 639
640 640
641int prism2_set_tx_power(struct wiphy *wiphy, enum nl80211_tx_power_setting type, 641int prism2_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
642 int mbm) 642 enum nl80211_tx_power_setting type, int mbm)
643{ 643{
644 struct prism2_wiphy_private *priv = wiphy_priv(wiphy); 644 struct prism2_wiphy_private *priv = wiphy_priv(wiphy);
645 wlandevice_t *wlandev = priv->wlandev; 645 wlandevice_t *wlandev = priv->wlandev;
@@ -665,7 +665,8 @@ exit:
665 return err; 665 return err;
666} 666}
667 667
668int prism2_get_tx_power(struct wiphy *wiphy, int *dbm) 668int prism2_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
669 int *dbm)
669{ 670{
670 struct prism2_wiphy_private *priv = wiphy_priv(wiphy); 671 struct prism2_wiphy_private *priv = wiphy_priv(wiphy);
671 wlandevice_t *wlandev = priv->wlandev; 672 wlandevice_t *wlandev = priv->wlandev;
diff --git a/drivers/staging/wlan-ng/prism2mgmt.c b/drivers/staging/wlan-ng/prism2mgmt.c
index 4efa9bc0fcf0..89bfd858bb28 100644
--- a/drivers/staging/wlan-ng/prism2mgmt.c
+++ b/drivers/staging/wlan-ng/prism2mgmt.c
@@ -406,7 +406,7 @@ int prism2mgmt_scan_results(wlandevice_t *wlandev, void *msgp)
406 /* SSID */ 406 /* SSID */
407 req->ssid.status = P80211ENUM_msgitem_status_data_ok; 407 req->ssid.status = P80211ENUM_msgitem_status_data_ok;
408 req->ssid.data.len = le16_to_cpu(item->ssid.len); 408 req->ssid.data.len = le16_to_cpu(item->ssid.len);
409 req->ssid.data.len = min_t(u16, req->ssid.data.len, WLAN_BSSID_LEN); 409 req->ssid.data.len = min_t(u16, req->ssid.data.len, WLAN_SSID_MAXLEN);
410 memcpy(req->ssid.data.data, item->ssid.data, req->ssid.data.len); 410 memcpy(req->ssid.data.data, item->ssid.data, req->ssid.data.len);
411 411
412 /* supported rates */ 412 /* supported rates */
diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
index fb4a7c94aed3..f2a73bd739fb 100644
--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@ -265,7 +265,7 @@ out_cleanup:
265static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, 265static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,
266 int offset) 266 int offset)
267{ 267{
268 int ret; 268 int ret = 0;
269 size_t clen; 269 size_t clen;
270 unsigned long handle; 270 unsigned long handle;
271 struct page *page; 271 struct page *page;
@@ -286,10 +286,8 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,
286 goto out; 286 goto out;
287 } 287 }
288 ret = zram_decompress_page(zram, uncmem, index); 288 ret = zram_decompress_page(zram, uncmem, index);
289 if (ret) { 289 if (ret)
290 kfree(uncmem);
291 goto out; 290 goto out;
292 }
293 } 291 }
294 292
295 /* 293 /*
@@ -302,16 +300,18 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,
302 300
303 user_mem = kmap_atomic(page); 301 user_mem = kmap_atomic(page);
304 302
305 if (is_partial_io(bvec)) 303 if (is_partial_io(bvec)) {
306 memcpy(uncmem + offset, user_mem + bvec->bv_offset, 304 memcpy(uncmem + offset, user_mem + bvec->bv_offset,
307 bvec->bv_len); 305 bvec->bv_len);
308 else 306 kunmap_atomic(user_mem);
307 user_mem = NULL;
308 } else {
309 uncmem = user_mem; 309 uncmem = user_mem;
310 }
310 311
311 if (page_zero_filled(uncmem)) { 312 if (page_zero_filled(uncmem)) {
312 kunmap_atomic(user_mem); 313 if (!is_partial_io(bvec))
313 if (is_partial_io(bvec)) 314 kunmap_atomic(user_mem);
314 kfree(uncmem);
315 zram_stat_inc(&zram->stats.pages_zero); 315 zram_stat_inc(&zram->stats.pages_zero);
316 zram_set_flag(zram, index, ZRAM_ZERO); 316 zram_set_flag(zram, index, ZRAM_ZERO);
317 ret = 0; 317 ret = 0;
@@ -321,9 +321,11 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,
321 ret = lzo1x_1_compress(uncmem, PAGE_SIZE, src, &clen, 321 ret = lzo1x_1_compress(uncmem, PAGE_SIZE, src, &clen,
322 zram->compress_workmem); 322 zram->compress_workmem);
323 323
324 kunmap_atomic(user_mem); 324 if (!is_partial_io(bvec)) {
325 if (is_partial_io(bvec)) 325 kunmap_atomic(user_mem);
326 kfree(uncmem); 326 user_mem = NULL;
327 uncmem = NULL;
328 }
327 329
328 if (unlikely(ret != LZO_E_OK)) { 330 if (unlikely(ret != LZO_E_OK)) {
329 pr_err("Compression failed! err=%d\n", ret); 331 pr_err("Compression failed! err=%d\n", ret);
@@ -332,8 +334,10 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,
332 334
333 if (unlikely(clen > max_zpage_size)) { 335 if (unlikely(clen > max_zpage_size)) {
334 zram_stat_inc(&zram->stats.bad_compress); 336 zram_stat_inc(&zram->stats.bad_compress);
335 src = uncmem;
336 clen = PAGE_SIZE; 337 clen = PAGE_SIZE;
338 src = NULL;
339 if (is_partial_io(bvec))
340 src = uncmem;
337 } 341 }
338 342
339 handle = zs_malloc(zram->mem_pool, clen); 343 handle = zs_malloc(zram->mem_pool, clen);
@@ -345,7 +349,11 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,
345 } 349 }
346 cmem = zs_map_object(zram->mem_pool, handle, ZS_MM_WO); 350 cmem = zs_map_object(zram->mem_pool, handle, ZS_MM_WO);
347 351
352 if ((clen == PAGE_SIZE) && !is_partial_io(bvec))
353 src = kmap_atomic(page);
348 memcpy(cmem, src, clen); 354 memcpy(cmem, src, clen);
355 if ((clen == PAGE_SIZE) && !is_partial_io(bvec))
356 kunmap_atomic(src);
349 357
350 zs_unmap_object(zram->mem_pool, handle); 358 zs_unmap_object(zram->mem_pool, handle);
351 359
@@ -358,9 +366,10 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,
358 if (clen <= PAGE_SIZE / 2) 366 if (clen <= PAGE_SIZE / 2)
359 zram_stat_inc(&zram->stats.good_compress); 367 zram_stat_inc(&zram->stats.good_compress);
360 368
361 return 0;
362
363out: 369out:
370 if (is_partial_io(bvec))
371 kfree(uncmem);
372
364 if (ret) 373 if (ret)
365 zram_stat64_inc(zram, &zram->stats.failed_writes); 374 zram_stat64_inc(zram, &zram->stats.failed_writes);
366 return ret; 375 return ret;
diff --git a/drivers/target/iscsi/iscsi_target_erl2.c b/drivers/target/iscsi/iscsi_target_erl2.c
index 9ac4c151eae4..ba6091bf93fc 100644
--- a/drivers/target/iscsi/iscsi_target_erl2.c
+++ b/drivers/target/iscsi/iscsi_target_erl2.c
@@ -372,7 +372,7 @@ int iscsit_prepare_cmds_for_realligance(struct iscsi_conn *conn)
372 * made generic here. 372 * made generic here.
373 */ 373 */
374 if (!(cmd->cmd_flags & ICF_OOO_CMDSN) && !cmd->immediate_cmd && 374 if (!(cmd->cmd_flags & ICF_OOO_CMDSN) && !cmd->immediate_cmd &&
375 iscsi_sna_gte(cmd->stat_sn, conn->sess->exp_cmd_sn)) { 375 iscsi_sna_gte(cmd->cmd_sn, conn->sess->exp_cmd_sn)) {
376 list_del(&cmd->i_conn_node); 376 list_del(&cmd->i_conn_node);
377 spin_unlock_bh(&conn->cmd_lock); 377 spin_unlock_bh(&conn->cmd_lock);
378 iscsit_free_cmd(cmd); 378 iscsit_free_cmd(cmd);
diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c
index 85140f7dde1e..7d4ec02e29a9 100644
--- a/drivers/target/target_core_alua.c
+++ b/drivers/target/target_core_alua.c
@@ -212,7 +212,7 @@ target_emulate_set_target_port_groups(struct se_cmd *cmd)
212 struct t10_alua_tg_pt_gp_member *tg_pt_gp_mem, *l_tg_pt_gp_mem; 212 struct t10_alua_tg_pt_gp_member *tg_pt_gp_mem, *l_tg_pt_gp_mem;
213 unsigned char *buf; 213 unsigned char *buf;
214 unsigned char *ptr; 214 unsigned char *ptr;
215 sense_reason_t rc; 215 sense_reason_t rc = TCM_NO_SENSE;
216 u32 len = 4; /* Skip over RESERVED area in header */ 216 u32 len = 4; /* Skip over RESERVED area in header */
217 int alua_access_state, primary = 0; 217 int alua_access_state, primary = 0;
218 u16 tg_pt_id, rtpi; 218 u16 tg_pt_id, rtpi;
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
index e35dbf85841f..8e0290b38e43 100644
--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
@@ -2053,7 +2053,7 @@ core_scsi3_emulate_pro_register(struct se_cmd *cmd, u64 res_key, u64 sa_res_key,
2053 /* Used for APTPL metadata w/ UNREGISTER */ 2053 /* Used for APTPL metadata w/ UNREGISTER */
2054 unsigned char *pr_aptpl_buf = NULL; 2054 unsigned char *pr_aptpl_buf = NULL;
2055 unsigned char isid_buf[PR_REG_ISID_LEN], *isid_ptr = NULL; 2055 unsigned char isid_buf[PR_REG_ISID_LEN], *isid_ptr = NULL;
2056 sense_reason_t ret; 2056 sense_reason_t ret = TCM_NO_SENSE;
2057 int pr_holder = 0, type; 2057 int pr_holder = 0, type;
2058 2058
2059 if (!se_sess || !se_lun) { 2059 if (!se_sess || !se_lun) {
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index c23c76ccef65..bd587b70661a 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -541,9 +541,6 @@ static void transport_lun_remove_cmd(struct se_cmd *cmd)
541 541
542void transport_cmd_finish_abort(struct se_cmd *cmd, int remove) 542void transport_cmd_finish_abort(struct se_cmd *cmd, int remove)
543{ 543{
544 if (!(cmd->se_cmd_flags & SCF_SCSI_TMR_CDB))
545 transport_lun_remove_cmd(cmd);
546
547 if (transport_cmd_check_stop_to_fabric(cmd)) 544 if (transport_cmd_check_stop_to_fabric(cmd))
548 return; 545 return;
549 if (remove) 546 if (remove)
@@ -1396,6 +1393,8 @@ static void target_complete_tmr_failure(struct work_struct *work)
1396 1393
1397 se_cmd->se_tmr_req->response = TMR_LUN_DOES_NOT_EXIST; 1394 se_cmd->se_tmr_req->response = TMR_LUN_DOES_NOT_EXIST;
1398 se_cmd->se_tfo->queue_tm_rsp(se_cmd); 1395 se_cmd->se_tfo->queue_tm_rsp(se_cmd);
1396
1397 transport_cmd_check_stop_to_fabric(se_cmd);
1399} 1398}
1400 1399
1401/** 1400/**
@@ -1688,6 +1687,7 @@ void target_execute_cmd(struct se_cmd *cmd)
1688 } 1687 }
1689 1688
1690 cmd->t_state = TRANSPORT_PROCESSING; 1689 cmd->t_state = TRANSPORT_PROCESSING;
1690 cmd->transport_state |= CMD_T_ACTIVE;
1691 spin_unlock_irq(&cmd->t_state_lock); 1691 spin_unlock_irq(&cmd->t_state_lock);
1692 1692
1693 if (!target_handle_task_attr(cmd)) 1693 if (!target_handle_task_attr(cmd))
@@ -2597,6 +2597,16 @@ transport_send_check_condition_and_sense(struct se_cmd *cmd,
2597 * SENSE KEY values from include/scsi/scsi.h 2597 * SENSE KEY values from include/scsi/scsi.h
2598 */ 2598 */
2599 switch (reason) { 2599 switch (reason) {
2600 case TCM_NO_SENSE:
2601 /* CURRENT ERROR */
2602 buffer[0] = 0x70;
2603 buffer[SPC_ADD_SENSE_LEN_OFFSET] = 10;
2604 /* Not Ready */
2605 buffer[SPC_SENSE_KEY_OFFSET] = NOT_READY;
2606 /* NO ADDITIONAL SENSE INFORMATION */
2607 buffer[SPC_ASC_KEY_OFFSET] = 0;
2608 buffer[SPC_ASCQ_KEY_OFFSET] = 0;
2609 break;
2600 case TCM_NON_EXISTENT_LUN: 2610 case TCM_NON_EXISTENT_LUN:
2601 /* CURRENT ERROR */ 2611 /* CURRENT ERROR */
2602 buffer[0] = 0x70; 2612 buffer[0] = 0x70;
@@ -2743,7 +2753,7 @@ transport_send_check_condition_and_sense(struct se_cmd *cmd,
2743 /* ILLEGAL REQUEST */ 2753 /* ILLEGAL REQUEST */
2744 buffer[SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST; 2754 buffer[SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
2745 /* LOGICAL UNIT COMMUNICATION FAILURE */ 2755 /* LOGICAL UNIT COMMUNICATION FAILURE */
2746 buffer[SPC_ASC_KEY_OFFSET] = 0x80; 2756 buffer[SPC_ASC_KEY_OFFSET] = 0x08;
2747 break; 2757 break;
2748 } 2758 }
2749 /* 2759 /*
@@ -2804,6 +2814,8 @@ void transport_send_task_abort(struct se_cmd *cmd)
2804 } 2814 }
2805 cmd->scsi_status = SAM_STAT_TASK_ABORTED; 2815 cmd->scsi_status = SAM_STAT_TASK_ABORTED;
2806 2816
2817 transport_lun_remove_cmd(cmd);
2818
2807 pr_debug("Setting SAM_STAT_TASK_ABORTED status for CDB: 0x%02x," 2819 pr_debug("Setting SAM_STAT_TASK_ABORTED status for CDB: 0x%02x,"
2808 " ITT: 0x%08x\n", cmd->t_task_cdb[0], 2820 " ITT: 0x%08x\n", cmd->t_task_cdb[0],
2809 cmd->se_tfo->get_task_tag(cmd)); 2821 cmd->se_tfo->get_task_tag(cmd));
diff --git a/drivers/target/tcm_fc/tfc_sess.c b/drivers/target/tcm_fc/tfc_sess.c
index 12d6fa21e5e1..6659dd36e806 100644
--- a/drivers/target/tcm_fc/tfc_sess.c
+++ b/drivers/target/tcm_fc/tfc_sess.c
@@ -355,11 +355,11 @@ static int ft_prli_locked(struct fc_rport_priv *rdata, u32 spp_len,
355 355
356 tport = ft_tport_create(rdata->local_port); 356 tport = ft_tport_create(rdata->local_port);
357 if (!tport) 357 if (!tport)
358 return 0; /* not a target for this local port */ 358 goto not_target; /* not a target for this local port */
359 359
360 acl = ft_acl_get(tport->tpg, rdata); 360 acl = ft_acl_get(tport->tpg, rdata);
361 if (!acl) 361 if (!acl)
362 return 0; 362 goto not_target; /* no target for this remote */
363 363
364 if (!rspp) 364 if (!rspp)
365 goto fill; 365 goto fill;
@@ -396,12 +396,18 @@ static int ft_prli_locked(struct fc_rport_priv *rdata, u32 spp_len,
396 396
397 /* 397 /*
398 * OR in our service parameters with other provider (initiator), if any. 398 * OR in our service parameters with other provider (initiator), if any.
399 * TBD XXX - indicate RETRY capability?
400 */ 399 */
401fill: 400fill:
402 fcp_parm = ntohl(spp->spp_params); 401 fcp_parm = ntohl(spp->spp_params);
402 fcp_parm &= ~FCP_SPPF_RETRY;
403 spp->spp_params = htonl(fcp_parm | FCP_SPPF_TARG_FCN); 403 spp->spp_params = htonl(fcp_parm | FCP_SPPF_TARG_FCN);
404 return FC_SPP_RESP_ACK; 404 return FC_SPP_RESP_ACK;
405
406not_target:
407 fcp_parm = ntohl(spp->spp_params);
408 fcp_parm &= ~FCP_SPPF_TARG_FCN;
409 spp->spp_params = htonl(fcp_parm);
410 return 0;
405} 411}
406 412
407/** 413/**
diff --git a/drivers/thermal/exynos_thermal.c b/drivers/thermal/exynos_thermal.c
index 7772d1603769..224751e9f5ff 100644
--- a/drivers/thermal/exynos_thermal.c
+++ b/drivers/thermal/exynos_thermal.c
@@ -832,7 +832,7 @@ static inline struct exynos_tmu_platform_data *exynos_get_driver_data(
832 return (struct exynos_tmu_platform_data *) 832 return (struct exynos_tmu_platform_data *)
833 platform_get_device_id(pdev)->driver_data; 833 platform_get_device_id(pdev)->driver_data;
834} 834}
835static int __devinit exynos_tmu_probe(struct platform_device *pdev) 835static int exynos_tmu_probe(struct platform_device *pdev)
836{ 836{
837 struct exynos_tmu_data *data; 837 struct exynos_tmu_data *data;
838 struct exynos_tmu_platform_data *pdata = pdev->dev.platform_data; 838 struct exynos_tmu_platform_data *pdata = pdev->dev.platform_data;
@@ -937,7 +937,7 @@ err_clk:
937 return ret; 937 return ret;
938} 938}
939 939
940static int __devexit exynos_tmu_remove(struct platform_device *pdev) 940static int exynos_tmu_remove(struct platform_device *pdev)
941{ 941{
942 struct exynos_tmu_data *data = platform_get_drvdata(pdev); 942 struct exynos_tmu_data *data = platform_get_drvdata(pdev);
943 943
@@ -985,7 +985,7 @@ static struct platform_driver exynos_tmu_driver = {
985 .of_match_table = exynos_tmu_match, 985 .of_match_table = exynos_tmu_match,
986 }, 986 },
987 .probe = exynos_tmu_probe, 987 .probe = exynos_tmu_probe,
988 .remove = __devexit_p(exynos_tmu_remove), 988 .remove = exynos_tmu_remove,
989 .id_table = exynos_tmu_driver_ids, 989 .id_table = exynos_tmu_driver_ids,
990}; 990};
991 991
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index be6a373601b7..79ff3a5e925d 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -441,6 +441,8 @@ static int pty_bsd_ioctl(struct tty_struct *tty,
441 return pty_get_pktmode(tty, (int __user *)arg); 441 return pty_get_pktmode(tty, (int __user *)arg);
442 case TIOCSIG: /* Send signal to other side of pty */ 442 case TIOCSIG: /* Send signal to other side of pty */
443 return pty_signal(tty, (int) arg); 443 return pty_signal(tty, (int) arg);
444 case TIOCGPTN: /* TTY returns ENOTTY, but glibc expects EINVAL here */
445 return -EINVAL;
444 } 446 }
445 return -ENOIOCTLCMD; 447 return -ENOIOCTLCMD;
446} 448}
diff --git a/drivers/tty/serial/8250/8250.c b/drivers/tty/serial/8250/8250.c
index d085e3a8ec06..f9320437a649 100644
--- a/drivers/tty/serial/8250/8250.c
+++ b/drivers/tty/serial/8250/8250.c
@@ -300,6 +300,12 @@ static const struct serial8250_config uart_config[] = {
300 UART_FCR_R_TRIG_00 | UART_FCR_T_TRIG_00, 300 UART_FCR_R_TRIG_00 | UART_FCR_T_TRIG_00,
301 .flags = UART_CAP_FIFO, 301 .flags = UART_CAP_FIFO,
302 }, 302 },
303 [PORT_BRCM_TRUMANAGE] = {
304 .name = "TruManage",
305 .fifo_size = 1,
306 .tx_loadsz = 1024,
307 .flags = UART_CAP_HFIFO,
308 },
303 [PORT_8250_CIR] = { 309 [PORT_8250_CIR] = {
304 .name = "CIR port" 310 .name = "CIR port"
305 } 311 }
@@ -1490,6 +1496,11 @@ void serial8250_tx_chars(struct uart_8250_port *up)
1490 port->icount.tx++; 1496 port->icount.tx++;
1491 if (uart_circ_empty(xmit)) 1497 if (uart_circ_empty(xmit))
1492 break; 1498 break;
1499 if (up->capabilities & UART_CAP_HFIFO) {
1500 if ((serial_port_in(port, UART_LSR) & BOTH_EMPTY) !=
1501 BOTH_EMPTY)
1502 break;
1503 }
1493 } while (--count > 0); 1504 } while (--count > 0);
1494 1505
1495 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) 1506 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h
index 3b4ea84898c2..12caa1292b75 100644
--- a/drivers/tty/serial/8250/8250.h
+++ b/drivers/tty/serial/8250/8250.h
@@ -40,6 +40,7 @@ struct serial8250_config {
40#define UART_CAP_AFE (1 << 11) /* MCR-based hw flow control */ 40#define UART_CAP_AFE (1 << 11) /* MCR-based hw flow control */
41#define UART_CAP_UUE (1 << 12) /* UART needs IER bit 6 set (Xscale) */ 41#define UART_CAP_UUE (1 << 12) /* UART needs IER bit 6 set (Xscale) */
42#define UART_CAP_RTOIE (1 << 13) /* UART needs IER bit 4 set (Xscale, Tegra) */ 42#define UART_CAP_RTOIE (1 << 13) /* UART needs IER bit 4 set (Xscale, Tegra) */
43#define UART_CAP_HFIFO (1 << 14) /* UART has a "hidden" FIFO */
43 44
44#define UART_BUG_QUOT (1 << 0) /* UART has buggy quot LSB */ 45#define UART_BUG_QUOT (1 << 0) /* UART has buggy quot LSB */
45#define UART_BUG_TXEN (1 << 1) /* UART has buggy TX IIR status */ 46#define UART_BUG_TXEN (1 << 1) /* UART has buggy TX IIR status */
diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index 1d0dba2d562d..096d2ef48b32 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -79,7 +79,7 @@ static int dw8250_handle_irq(struct uart_port *p)
79 } else if ((iir & UART_IIR_BUSY) == UART_IIR_BUSY) { 79 } else if ((iir & UART_IIR_BUSY) == UART_IIR_BUSY) {
80 /* Clear the USR and write the LCR again. */ 80 /* Clear the USR and write the LCR again. */
81 (void)p->serial_in(p, UART_USR); 81 (void)p->serial_in(p, UART_USR);
82 p->serial_out(p, d->last_lcr, UART_LCR); 82 p->serial_out(p, UART_LCR, d->last_lcr);
83 83
84 return 1; 84 return 1;
85 } 85 }
diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
index 26b9dc012ed0..a27a98e1b066 100644
--- a/drivers/tty/serial/8250/8250_pci.c
+++ b/drivers/tty/serial/8250/8250_pci.c
@@ -1085,6 +1085,18 @@ pci_omegapci_setup(struct serial_private *priv,
1085 return setup_port(priv, port, 2, idx * 8, 0); 1085 return setup_port(priv, port, 2, idx * 8, 0);
1086} 1086}
1087 1087
1088static int
1089pci_brcm_trumanage_setup(struct serial_private *priv,
1090 const struct pciserial_board *board,
1091 struct uart_8250_port *port, int idx)
1092{
1093 int ret = pci_default_setup(priv, board, port, idx);
1094
1095 port->port.type = PORT_BRCM_TRUMANAGE;
1096 port->port.flags = (port->port.flags | UPF_FIXED_PORT | UPF_FIXED_TYPE);
1097 return ret;
1098}
1099
1088static int skip_tx_en_setup(struct serial_private *priv, 1100static int skip_tx_en_setup(struct serial_private *priv,
1089 const struct pciserial_board *board, 1101 const struct pciserial_board *board,
1090 struct uart_8250_port *port, int idx) 1102 struct uart_8250_port *port, int idx)
@@ -1301,9 +1313,10 @@ pci_wch_ch353_setup(struct serial_private *priv,
1301#define PCI_VENDOR_ID_AGESTAR 0x5372 1313#define PCI_VENDOR_ID_AGESTAR 0x5372
1302#define PCI_DEVICE_ID_AGESTAR_9375 0x6872 1314#define PCI_DEVICE_ID_AGESTAR_9375 0x6872
1303#define PCI_VENDOR_ID_ASIX 0x9710 1315#define PCI_VENDOR_ID_ASIX 0x9710
1304#define PCI_DEVICE_ID_COMMTECH_4222PCIE 0x0019
1305#define PCI_DEVICE_ID_COMMTECH_4224PCIE 0x0020 1316#define PCI_DEVICE_ID_COMMTECH_4224PCIE 0x0020
1306#define PCI_DEVICE_ID_COMMTECH_4228PCIE 0x0021 1317#define PCI_DEVICE_ID_COMMTECH_4228PCIE 0x0021
1318#define PCI_DEVICE_ID_COMMTECH_4222PCIE 0x0022
1319#define PCI_DEVICE_ID_BROADCOM_TRUMANAGE 0x160a
1307 1320
1308 1321
1309/* Unknown vendors/cards - this should not be in linux/pci_ids.h */ 1322/* Unknown vendors/cards - this should not be in linux/pci_ids.h */
@@ -1954,6 +1967,17 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
1954 .setup = pci_xr17v35x_setup, 1967 .setup = pci_xr17v35x_setup,
1955 }, 1968 },
1956 /* 1969 /*
1970 * Broadcom TruManage (NetXtreme)
1971 */
1972 {
1973 .vendor = PCI_VENDOR_ID_BROADCOM,
1974 .device = PCI_DEVICE_ID_BROADCOM_TRUMANAGE,
1975 .subvendor = PCI_ANY_ID,
1976 .subdevice = PCI_ANY_ID,
1977 .setup = pci_brcm_trumanage_setup,
1978 },
1979
1980 /*
1957 * Default "match everything" terminator entry 1981 * Default "match everything" terminator entry
1958 */ 1982 */
1959 { 1983 {
@@ -2148,6 +2172,7 @@ enum pci_board_num_t {
2148 pbn_ce4100_1_115200, 2172 pbn_ce4100_1_115200,
2149 pbn_omegapci, 2173 pbn_omegapci,
2150 pbn_NETMOS9900_2s_115200, 2174 pbn_NETMOS9900_2s_115200,
2175 pbn_brcm_trumanage,
2151}; 2176};
2152 2177
2153/* 2178/*
@@ -2246,7 +2271,7 @@ static struct pciserial_board pci_boards[] = {
2246 2271
2247 [pbn_b0_8_1152000_200] = { 2272 [pbn_b0_8_1152000_200] = {
2248 .flags = FL_BASE0, 2273 .flags = FL_BASE0,
2249 .num_ports = 2, 2274 .num_ports = 8,
2250 .base_baud = 1152000, 2275 .base_baud = 1152000,
2251 .uart_offset = 0x200, 2276 .uart_offset = 0x200,
2252 }, 2277 },
@@ -2892,6 +2917,12 @@ static struct pciserial_board pci_boards[] = {
2892 .num_ports = 2, 2917 .num_ports = 2,
2893 .base_baud = 115200, 2918 .base_baud = 115200,
2894 }, 2919 },
2920 [pbn_brcm_trumanage] = {
2921 .flags = FL_BASE0,
2922 .num_ports = 1,
2923 .reg_shift = 2,
2924 .base_baud = 115200,
2925 },
2895}; 2926};
2896 2927
2897static const struct pci_device_id blacklist[] = { 2928static const struct pci_device_id blacklist[] = {
@@ -4471,6 +4502,13 @@ static struct pci_device_id serial_pci_tbl[] = {
4471 pbn_omegapci }, 4502 pbn_omegapci },
4472 4503
4473 /* 4504 /*
4505 * Broadcom TruManage
4506 */
4507 { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_BROADCOM_TRUMANAGE,
4508 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4509 pbn_brcm_trumanage },
4510
4511 /*
4474 * AgeStar as-prs2-009 4512 * AgeStar as-prs2-009
4475 */ 4513 */
4476 { PCI_VENDOR_ID_AGESTAR, PCI_DEVICE_ID_AGESTAR_9375, 4514 { PCI_VENDOR_ID_AGESTAR, PCI_DEVICE_ID_AGESTAR_9375,
diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index 675d94ab0aff..8cb6d8d66a13 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -637,6 +637,7 @@ static void ifx_port_shutdown(struct tty_port *port)
637 637
638 clear_bit(IFX_SPI_STATE_IO_AVAILABLE, &ifx_dev->flags); 638 clear_bit(IFX_SPI_STATE_IO_AVAILABLE, &ifx_dev->flags);
639 mrdy_set_low(ifx_dev); 639 mrdy_set_low(ifx_dev);
640 del_timer(&ifx_dev->spi_timer);
640 clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags); 641 clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags);
641 tasklet_kill(&ifx_dev->io_work_tasklet); 642 tasklet_kill(&ifx_dev->io_work_tasklet);
642} 643}
@@ -810,7 +811,8 @@ static void ifx_spi_io(unsigned long data)
810 ifx_dev->spi_xfer.cs_change = 0; 811 ifx_dev->spi_xfer.cs_change = 0;
811 ifx_dev->spi_xfer.speed_hz = ifx_dev->spi_dev->max_speed_hz; 812 ifx_dev->spi_xfer.speed_hz = ifx_dev->spi_dev->max_speed_hz;
812 /* ifx_dev->spi_xfer.speed_hz = 390625; */ 813 /* ifx_dev->spi_xfer.speed_hz = 390625; */
813 ifx_dev->spi_xfer.bits_per_word = spi_bpw; 814 ifx_dev->spi_xfer.bits_per_word =
815 ifx_dev->spi_dev->bits_per_word;
814 816
815 ifx_dev->spi_xfer.tx_buf = ifx_dev->tx_buffer; 817 ifx_dev->spi_xfer.tx_buf = ifx_dev->tx_buffer;
816 ifx_dev->spi_xfer.rx_buf = ifx_dev->rx_buffer; 818 ifx_dev->spi_xfer.rx_buf = ifx_dev->rx_buffer;
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
index 6db23b035efe..e55615eb34ad 100644
--- a/drivers/tty/serial/mxs-auart.c
+++ b/drivers/tty/serial/mxs-auart.c
@@ -253,7 +253,7 @@ static void mxs_auart_tx_chars(struct mxs_auart_port *s)
253 struct circ_buf *xmit = &s->port.state->xmit; 253 struct circ_buf *xmit = &s->port.state->xmit;
254 254
255 if (auart_dma_enabled(s)) { 255 if (auart_dma_enabled(s)) {
256 int i = 0; 256 u32 i = 0;
257 int size; 257 int size;
258 void *buffer = s->tx_dma_buf; 258 void *buffer = s->tx_dma_buf;
259 259
@@ -412,10 +412,12 @@ static void mxs_auart_set_mctrl(struct uart_port *u, unsigned mctrl)
412 412
413 u32 ctrl = readl(u->membase + AUART_CTRL2); 413 u32 ctrl = readl(u->membase + AUART_CTRL2);
414 414
415 ctrl &= ~AUART_CTRL2_RTSEN; 415 ctrl &= ~(AUART_CTRL2_RTSEN | AUART_CTRL2_RTS);
416 if (mctrl & TIOCM_RTS) { 416 if (mctrl & TIOCM_RTS) {
417 if (tty_port_cts_enabled(&u->state->port)) 417 if (tty_port_cts_enabled(&u->state->port))
418 ctrl |= AUART_CTRL2_RTSEN; 418 ctrl |= AUART_CTRL2_RTSEN;
419 else
420 ctrl |= AUART_CTRL2_RTS;
419 } 421 }
420 422
421 s->ctrl = mctrl; 423 s->ctrl = mctrl;
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index 12e5249d053e..e514b3a4dc57 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -1006,7 +1006,6 @@ static void s3c24xx_serial_resetport(struct uart_port *port,
1006 1006
1007 ucon &= ucon_mask; 1007 ucon &= ucon_mask;
1008 wr_regl(port, S3C2410_UCON, ucon | cfg->ucon); 1008 wr_regl(port, S3C2410_UCON, ucon | cfg->ucon);
1009 wr_regl(port, S3C2410_ULCON, cfg->ulcon);
1010 1009
1011 /* reset both fifos */ 1010 /* reset both fifos */
1012 wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH); 1011 wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH);
diff --git a/drivers/tty/serial/vt8500_serial.c b/drivers/tty/serial/vt8500_serial.c
index 8fd181436a6b..d5ed9f613005 100644
--- a/drivers/tty/serial/vt8500_serial.c
+++ b/drivers/tty/serial/vt8500_serial.c
@@ -604,7 +604,7 @@ static int vt8500_serial_probe(struct platform_device *pdev)
604 vt8500_port->uart.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF; 604 vt8500_port->uart.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF;
605 605
606 vt8500_port->clk = of_clk_get(pdev->dev.of_node, 0); 606 vt8500_port->clk = of_clk_get(pdev->dev.of_node, 0);
607 if (vt8500_port->clk) { 607 if (!IS_ERR(vt8500_port->clk)) {
608 vt8500_port->uart.uartclk = clk_get_rate(vt8500_port->clk); 608 vt8500_port->uart.uartclk = clk_get_rate(vt8500_port->clk);
609 } else { 609 } else {
610 /* use the default of 24Mhz if not specified and warn */ 610 /* use the default of 24Mhz if not specified and warn */
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 4c90b510d016..640ae6c6d2d2 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -37,6 +37,7 @@ config USB_ARCH_HAS_EHCI
37 default y if ARCH_W90X900 37 default y if ARCH_W90X900
38 default y if ARCH_AT91 38 default y if ARCH_AT91
39 default y if ARCH_MXC 39 default y if ARCH_MXC
40 default y if ARCH_MXS
40 default y if ARCH_OMAP3 41 default y if ARCH_OMAP3
41 default y if ARCH_CNS3XXX 42 default y if ARCH_CNS3XXX
42 default y if ARCH_VT8500 43 default y if ARCH_VT8500
diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
index caecad9213f5..8e9d31277c43 100644
--- a/drivers/usb/chipidea/host.c
+++ b/drivers/usb/chipidea/host.c
@@ -70,6 +70,9 @@ static int host_start(struct ci13xxx *ci)
70 else 70 else
71 ci->hcd = hcd; 71 ci->hcd = hcd;
72 72
73 if (ci->platdata->flags & CI13XXX_DISABLE_STREAMING)
74 hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS);
75
73 return ret; 76 return ret;
74} 77}
75 78
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 8d809a811e16..2d92cce260d7 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1602,6 +1602,9 @@ static const struct usb_device_id acm_ids[] = {
1602 { USB_DEVICE(0x0572, 0x1340), /* Conexant CX93010-2x UCMxx */ 1602 { USB_DEVICE(0x0572, 0x1340), /* Conexant CX93010-2x UCMxx */
1603 .driver_info = NO_UNION_NORMAL, 1603 .driver_info = NO_UNION_NORMAL,
1604 }, 1604 },
1605 { USB_DEVICE(0x05f9, 0x4002), /* PSC Scanning, Magellan 800i */
1606 .driver_info = NO_UNION_NORMAL,
1607 },
1605 { USB_DEVICE(0x1bbb, 0x0003), /* Alcatel OT-I650 */ 1608 { USB_DEVICE(0x1bbb, 0x0003), /* Alcatel OT-I650 */
1606 .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */ 1609 .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */
1607 }, 1610 },
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index a815fd2cc5e7..957ed2c41482 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -877,6 +877,60 @@ static int hub_hub_status(struct usb_hub *hub,
877 return ret; 877 return ret;
878} 878}
879 879
880static int hub_set_port_link_state(struct usb_hub *hub, int port1,
881 unsigned int link_status)
882{
883 return set_port_feature(hub->hdev,
884 port1 | (link_status << 3),
885 USB_PORT_FEAT_LINK_STATE);
886}
887
888/*
889 * If USB 3.0 ports are placed into the Disabled state, they will no longer
890 * detect any device connects or disconnects. This is generally not what the
891 * USB core wants, since it expects a disabled port to produce a port status
892 * change event when a new device connects.
893 *
894 * Instead, set the link state to Disabled, wait for the link to settle into
895 * that state, clear any change bits, and then put the port into the RxDetect
896 * state.
897 */
898static int hub_usb3_port_disable(struct usb_hub *hub, int port1)
899{
900 int ret;
901 int total_time;
902 u16 portchange, portstatus;
903
904 if (!hub_is_superspeed(hub->hdev))
905 return -EINVAL;
906
907 ret = hub_set_port_link_state(hub, port1, USB_SS_PORT_LS_SS_DISABLED);
908 if (ret) {
909 dev_err(hub->intfdev, "cannot disable port %d (err = %d)\n",
910 port1, ret);
911 return ret;
912 }
913
914 /* Wait for the link to enter the disabled state. */
915 for (total_time = 0; ; total_time += HUB_DEBOUNCE_STEP) {
916 ret = hub_port_status(hub, port1, &portstatus, &portchange);
917 if (ret < 0)
918 return ret;
919
920 if ((portstatus & USB_PORT_STAT_LINK_STATE) ==
921 USB_SS_PORT_LS_SS_DISABLED)
922 break;
923 if (total_time >= HUB_DEBOUNCE_TIMEOUT)
924 break;
925 msleep(HUB_DEBOUNCE_STEP);
926 }
927 if (total_time >= HUB_DEBOUNCE_TIMEOUT)
928 dev_warn(hub->intfdev, "Could not disable port %d after %d ms\n",
929 port1, total_time);
930
931 return hub_set_port_link_state(hub, port1, USB_SS_PORT_LS_RX_DETECT);
932}
933
880static int hub_port_disable(struct usb_hub *hub, int port1, int set_state) 934static int hub_port_disable(struct usb_hub *hub, int port1, int set_state)
881{ 935{
882 struct usb_device *hdev = hub->hdev; 936 struct usb_device *hdev = hub->hdev;
@@ -885,8 +939,13 @@ static int hub_port_disable(struct usb_hub *hub, int port1, int set_state)
885 if (hub->ports[port1 - 1]->child && set_state) 939 if (hub->ports[port1 - 1]->child && set_state)
886 usb_set_device_state(hub->ports[port1 - 1]->child, 940 usb_set_device_state(hub->ports[port1 - 1]->child,
887 USB_STATE_NOTATTACHED); 941 USB_STATE_NOTATTACHED);
888 if (!hub->error && !hub_is_superspeed(hub->hdev)) 942 if (!hub->error) {
889 ret = clear_port_feature(hdev, port1, USB_PORT_FEAT_ENABLE); 943 if (hub_is_superspeed(hub->hdev))
944 ret = hub_usb3_port_disable(hub, port1);
945 else
946 ret = clear_port_feature(hdev, port1,
947 USB_PORT_FEAT_ENABLE);
948 }
890 if (ret) 949 if (ret)
891 dev_err(hub->intfdev, "cannot disable port %d (err = %d)\n", 950 dev_err(hub->intfdev, "cannot disable port %d (err = %d)\n",
892 port1, ret); 951 port1, ret);
@@ -2440,7 +2499,7 @@ static unsigned hub_is_wusb(struct usb_hub *hub)
2440#define HUB_SHORT_RESET_TIME 10 2499#define HUB_SHORT_RESET_TIME 10
2441#define HUB_BH_RESET_TIME 50 2500#define HUB_BH_RESET_TIME 50
2442#define HUB_LONG_RESET_TIME 200 2501#define HUB_LONG_RESET_TIME 200
2443#define HUB_RESET_TIMEOUT 500 2502#define HUB_RESET_TIMEOUT 800
2444 2503
2445static int hub_port_reset(struct usb_hub *hub, int port1, 2504static int hub_port_reset(struct usb_hub *hub, int port1,
2446 struct usb_device *udev, unsigned int delay, bool warm); 2505 struct usb_device *udev, unsigned int delay, bool warm);
@@ -2475,6 +2534,10 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1,
2475 if (ret < 0) 2534 if (ret < 0)
2476 return ret; 2535 return ret;
2477 2536
2537 /* The port state is unknown until the reset completes. */
2538 if ((portstatus & USB_PORT_STAT_RESET))
2539 goto delay;
2540
2478 /* 2541 /*
2479 * Some buggy devices require a warm reset to be issued even 2542 * Some buggy devices require a warm reset to be issued even
2480 * when the port appears not to be connected. 2543 * when the port appears not to be connected.
@@ -2520,11 +2583,7 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1,
2520 if ((portchange & USB_PORT_STAT_C_CONNECTION)) 2583 if ((portchange & USB_PORT_STAT_C_CONNECTION))
2521 return -ENOTCONN; 2584 return -ENOTCONN;
2522 2585
2523 /* if we`ve finished resetting, then break out of 2586 if ((portstatus & USB_PORT_STAT_ENABLE)) {
2524 * the loop
2525 */
2526 if (!(portstatus & USB_PORT_STAT_RESET) &&
2527 (portstatus & USB_PORT_STAT_ENABLE)) {
2528 if (hub_is_wusb(hub)) 2587 if (hub_is_wusb(hub))
2529 udev->speed = USB_SPEED_WIRELESS; 2588 udev->speed = USB_SPEED_WIRELESS;
2530 else if (hub_is_superspeed(hub->hdev)) 2589 else if (hub_is_superspeed(hub->hdev))
@@ -2538,10 +2597,15 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1,
2538 return 0; 2597 return 0;
2539 } 2598 }
2540 } else { 2599 } else {
2541 if (portchange & USB_PORT_STAT_C_BH_RESET) 2600 if (!(portstatus & USB_PORT_STAT_CONNECTION) ||
2542 return 0; 2601 hub_port_warm_reset_required(hub,
2602 portstatus))
2603 return -ENOTCONN;
2604
2605 return 0;
2543 } 2606 }
2544 2607
2608delay:
2545 /* switch to the long delay after two short delay failures */ 2609 /* switch to the long delay after two short delay failures */
2546 if (delay_time >= 2 * HUB_SHORT_RESET_TIME) 2610 if (delay_time >= 2 * HUB_SHORT_RESET_TIME)
2547 delay = HUB_LONG_RESET_TIME; 2611 delay = HUB_LONG_RESET_TIME;
@@ -2565,14 +2629,11 @@ static void hub_port_finish_reset(struct usb_hub *hub, int port1,
2565 msleep(10 + 40); 2629 msleep(10 + 40);
2566 update_devnum(udev, 0); 2630 update_devnum(udev, 0);
2567 hcd = bus_to_hcd(udev->bus); 2631 hcd = bus_to_hcd(udev->bus);
2568 if (hcd->driver->reset_device) { 2632 /* The xHC may think the device is already reset,
2569 *status = hcd->driver->reset_device(hcd, udev); 2633 * so ignore the status.
2570 if (*status < 0) { 2634 */
2571 dev_err(&udev->dev, "Cannot reset " 2635 if (hcd->driver->reset_device)
2572 "HCD device state\n"); 2636 hcd->driver->reset_device(hcd, udev);
2573 break;
2574 }
2575 }
2576 } 2637 }
2577 /* FALL THROUGH */ 2638 /* FALL THROUGH */
2578 case -ENOTCONN: 2639 case -ENOTCONN:
@@ -2580,16 +2641,16 @@ static void hub_port_finish_reset(struct usb_hub *hub, int port1,
2580 clear_port_feature(hub->hdev, 2641 clear_port_feature(hub->hdev,
2581 port1, USB_PORT_FEAT_C_RESET); 2642 port1, USB_PORT_FEAT_C_RESET);
2582 /* FIXME need disconnect() for NOTATTACHED device */ 2643 /* FIXME need disconnect() for NOTATTACHED device */
2583 if (warm) { 2644 if (hub_is_superspeed(hub->hdev)) {
2584 clear_port_feature(hub->hdev, port1, 2645 clear_port_feature(hub->hdev, port1,
2585 USB_PORT_FEAT_C_BH_PORT_RESET); 2646 USB_PORT_FEAT_C_BH_PORT_RESET);
2586 clear_port_feature(hub->hdev, port1, 2647 clear_port_feature(hub->hdev, port1,
2587 USB_PORT_FEAT_C_PORT_LINK_STATE); 2648 USB_PORT_FEAT_C_PORT_LINK_STATE);
2588 } else { 2649 }
2650 if (!warm)
2589 usb_set_device_state(udev, *status 2651 usb_set_device_state(udev, *status
2590 ? USB_STATE_NOTATTACHED 2652 ? USB_STATE_NOTATTACHED
2591 : USB_STATE_DEFAULT); 2653 : USB_STATE_DEFAULT);
2592 }
2593 break; 2654 break;
2594 } 2655 }
2595} 2656}
@@ -2939,7 +3000,7 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg)
2939static int finish_port_resume(struct usb_device *udev) 3000static int finish_port_resume(struct usb_device *udev)
2940{ 3001{
2941 int status = 0; 3002 int status = 0;
2942 u16 devstatus; 3003 u16 devstatus = 0;
2943 3004
2944 /* caller owns the udev device lock */ 3005 /* caller owns the udev device lock */
2945 dev_dbg(&udev->dev, "%s\n", 3006 dev_dbg(&udev->dev, "%s\n",
@@ -2984,7 +3045,13 @@ static int finish_port_resume(struct usb_device *udev)
2984 if (status) { 3045 if (status) {
2985 dev_dbg(&udev->dev, "gone after usb resume? status %d\n", 3046 dev_dbg(&udev->dev, "gone after usb resume? status %d\n",
2986 status); 3047 status);
2987 } else if (udev->actconfig) { 3048 /*
3049 * There are a few quirky devices which violate the standard
3050 * by claiming to have remote wakeup enabled after a reset,
3051 * which crash if the feature is cleared, hence check for
3052 * udev->reset_resume
3053 */
3054 } else if (udev->actconfig && !udev->reset_resume) {
2988 le16_to_cpus(&devstatus); 3055 le16_to_cpus(&devstatus);
2989 if (devstatus & (1 << USB_DEVICE_REMOTE_WAKEUP)) { 3056 if (devstatus & (1 << USB_DEVICE_REMOTE_WAKEUP)) {
2990 status = usb_control_msg(udev, 3057 status = usb_control_msg(udev,
@@ -4638,9 +4705,14 @@ static void hub_events(void)
4638 * SS.Inactive state. 4705 * SS.Inactive state.
4639 */ 4706 */
4640 if (hub_port_warm_reset_required(hub, portstatus)) { 4707 if (hub_port_warm_reset_required(hub, portstatus)) {
4708 int status;
4709
4641 dev_dbg(hub_dev, "warm reset port %d\n", i); 4710 dev_dbg(hub_dev, "warm reset port %d\n", i);
4642 hub_port_reset(hub, i, NULL, 4711 status = hub_port_reset(hub, i, NULL,
4643 HUB_BH_RESET_TIME, true); 4712 HUB_BH_RESET_TIME, true);
4713 if (status < 0)
4714 hub_port_disable(hub, i, 1);
4715 connect_change = 0;
4644 } 4716 }
4645 4717
4646 if (connect_change) 4718 if (connect_change)
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index fdefd9c7f7af..3113c1d71442 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -43,6 +43,9 @@ static const struct usb_device_id usb_quirk_list[] = {
43 /* Creative SB Audigy 2 NX */ 43 /* Creative SB Audigy 2 NX */
44 { USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME }, 44 { USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME },
45 45
46 /* Microsoft LifeCam-VX700 v2.0 */
47 { USB_DEVICE(0x045e, 0x0770), .driver_info = USB_QUIRK_RESET_RESUME },
48
46 /* Logitech Quickcam Fusion */ 49 /* Logitech Quickcam Fusion */
47 { USB_DEVICE(0x046d, 0x08c1), .driver_info = USB_QUIRK_RESET_RESUME }, 50 { USB_DEVICE(0x046d, 0x08c1), .driver_info = USB_QUIRK_RESET_RESUME },
48 51
diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c
index 92604b4f9712..5945aadaa1c9 100644
--- a/drivers/usb/dwc3/debugfs.c
+++ b/drivers/usb/dwc3/debugfs.c
@@ -56,7 +56,7 @@
56#define dump_register(nm) \ 56#define dump_register(nm) \
57{ \ 57{ \
58 .name = __stringify(nm), \ 58 .name = __stringify(nm), \
59 .offset = DWC3_ ##nm, \ 59 .offset = DWC3_ ##nm - DWC3_GLOBALS_REGS_START, \
60} 60}
61 61
62static const struct debugfs_reg32 dwc3_regs[] = { 62static const struct debugfs_reg32 dwc3_regs[] = {
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 2e43b332aae8..2fdd767f8fe8 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1605,6 +1605,7 @@ static int dwc3_gadget_init_endpoints(struct dwc3 *dwc)
1605 1605
1606 if (epnum == 0 || epnum == 1) { 1606 if (epnum == 0 || epnum == 1) {
1607 dep->endpoint.maxpacket = 512; 1607 dep->endpoint.maxpacket = 512;
1608 dep->endpoint.maxburst = 1;
1608 dep->endpoint.ops = &dwc3_gadget_ep0_ops; 1609 dep->endpoint.ops = &dwc3_gadget_ep0_ops;
1609 if (!epnum) 1610 if (!epnum)
1610 dwc->gadget.ep0 = &dep->endpoint; 1611 dwc->gadget.ep0 = &dep->endpoint;
diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c
index fc0ec5e0d58e..d9f6b9372491 100644
--- a/drivers/usb/gadget/amd5536udc.c
+++ b/drivers/usb/gadget/amd5536udc.c
@@ -3231,7 +3231,7 @@ static int udc_pci_probe(
3231 } 3231 }
3232 3232
3233 if (!pdev->irq) { 3233 if (!pdev->irq) {
3234 dev_err(&dev->pdev->dev, "irq not set\n"); 3234 dev_err(&pdev->dev, "irq not set\n");
3235 kfree(dev); 3235 kfree(dev);
3236 dev = NULL; 3236 dev = NULL;
3237 retval = -ENODEV; 3237 retval = -ENODEV;
@@ -3250,7 +3250,7 @@ static int udc_pci_probe(
3250 dev->txfifo = (u32 __iomem *)(dev->virt_addr + UDC_TXFIFO_ADDR); 3250 dev->txfifo = (u32 __iomem *)(dev->virt_addr + UDC_TXFIFO_ADDR);
3251 3251
3252 if (request_irq(pdev->irq, udc_irq, IRQF_SHARED, name, dev) != 0) { 3252 if (request_irq(pdev->irq, udc_irq, IRQF_SHARED, name, dev) != 0) {
3253 dev_dbg(&dev->pdev->dev, "request_irq(%d) fail\n", pdev->irq); 3253 dev_dbg(&pdev->dev, "request_irq(%d) fail\n", pdev->irq);
3254 kfree(dev); 3254 kfree(dev);
3255 dev = NULL; 3255 dev = NULL;
3256 retval = -EBUSY; 3256 retval = -EBUSY;
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index 95d584dbed13..8cf0c0f6fa1f 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -130,10 +130,7 @@ static const char ep0name[] = "ep0";
130static const char *const ep_name[] = { 130static const char *const ep_name[] = {
131 ep0name, /* everyone has ep0 */ 131 ep0name, /* everyone has ep0 */
132 132
133 /* act like a net2280: high speed, six configurable endpoints */ 133 /* act like a pxa250: fifteen fixed function endpoints */
134 "ep-a", "ep-b", "ep-c", "ep-d", "ep-e", "ep-f",
135
136 /* or like pxa250: fifteen fixed function endpoints */
137 "ep1in-bulk", "ep2out-bulk", "ep3in-iso", "ep4out-iso", "ep5in-int", 134 "ep1in-bulk", "ep2out-bulk", "ep3in-iso", "ep4out-iso", "ep5in-int",
138 "ep6in-bulk", "ep7out-bulk", "ep8in-iso", "ep9out-iso", "ep10in-int", 135 "ep6in-bulk", "ep7out-bulk", "ep8in-iso", "ep9out-iso", "ep10in-int",
139 "ep11in-bulk", "ep12out-bulk", "ep13in-iso", "ep14out-iso", 136 "ep11in-bulk", "ep12out-bulk", "ep13in-iso", "ep14out-iso",
@@ -141,6 +138,10 @@ static const char *const ep_name[] = {
141 138
142 /* or like sa1100: two fixed function endpoints */ 139 /* or like sa1100: two fixed function endpoints */
143 "ep1out-bulk", "ep2in-bulk", 140 "ep1out-bulk", "ep2in-bulk",
141
142 /* and now some generic EPs so we have enough in multi config */
143 "ep3out", "ep4in", "ep5out", "ep6out", "ep7in", "ep8out", "ep9in",
144 "ep10out", "ep11out", "ep12in", "ep13out", "ep14in", "ep15out",
144}; 145};
145#define DUMMY_ENDPOINTS ARRAY_SIZE(ep_name) 146#define DUMMY_ENDPOINTS ARRAY_SIZE(ep_name)
146 147
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
index 4a6961c517f2..8c2f25121149 100644
--- a/drivers/usb/gadget/f_fs.c
+++ b/drivers/usb/gadget/f_fs.c
@@ -1153,15 +1153,15 @@ static int ffs_fs_parse_opts(struct ffs_sb_fill_data *data, char *opts)
1153 pr_err("%s: unmapped value: %lu\n", opts, value); 1153 pr_err("%s: unmapped value: %lu\n", opts, value);
1154 return -EINVAL; 1154 return -EINVAL;
1155 } 1155 }
1156 } 1156 } else if (!memcmp(opts, "gid", 3)) {
1157 else if (!memcmp(opts, "gid", 3))
1158 data->perms.gid = make_kgid(current_user_ns(), value); 1157 data->perms.gid = make_kgid(current_user_ns(), value);
1159 if (!gid_valid(data->perms.gid)) { 1158 if (!gid_valid(data->perms.gid)) {
1160 pr_err("%s: unmapped value: %lu\n", opts, value); 1159 pr_err("%s: unmapped value: %lu\n", opts, value);
1161 return -EINVAL; 1160 return -EINVAL;
1162 } 1161 }
1163 else 1162 } else {
1164 goto invalid; 1163 goto invalid;
1164 }
1165 break; 1165 break;
1166 1166
1167 default: 1167 default:
diff --git a/drivers/usb/gadget/fsl_mxc_udc.c b/drivers/usb/gadget/fsl_mxc_udc.c
index 1b0f086426bd..d3bd7b095ba3 100644
--- a/drivers/usb/gadget/fsl_mxc_udc.c
+++ b/drivers/usb/gadget/fsl_mxc_udc.c
@@ -18,14 +18,13 @@
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/io.h> 19#include <linux/io.h>
20 20
21#include <mach/hardware.h>
22
23static struct clk *mxc_ahb_clk; 21static struct clk *mxc_ahb_clk;
24static struct clk *mxc_per_clk; 22static struct clk *mxc_per_clk;
25static struct clk *mxc_ipg_clk; 23static struct clk *mxc_ipg_clk;
26 24
27/* workaround ENGcm09152 for i.MX35 */ 25/* workaround ENGcm09152 for i.MX35 */
28#define USBPHYCTRL_OTGBASE_OFFSET 0x608 26#define MX35_USBPHYCTRL_OFFSET 0x600
27#define USBPHYCTRL_OTGBASE_OFFSET 0x8
29#define USBPHYCTRL_EVDO (1 << 23) 28#define USBPHYCTRL_EVDO (1 << 23)
30 29
31int fsl_udc_clk_init(struct platform_device *pdev) 30int fsl_udc_clk_init(struct platform_device *pdev)
@@ -59,7 +58,7 @@ int fsl_udc_clk_init(struct platform_device *pdev)
59 clk_prepare_enable(mxc_per_clk); 58 clk_prepare_enable(mxc_per_clk);
60 59
61 /* make sure USB_CLK is running at 60 MHz +/- 1000 Hz */ 60 /* make sure USB_CLK is running at 60 MHz +/- 1000 Hz */
62 if (!cpu_is_mx51()) { 61 if (!strcmp(pdev->id_entry->name, "imx-udc-mx27")) {
63 freq = clk_get_rate(mxc_per_clk); 62 freq = clk_get_rate(mxc_per_clk);
64 if (pdata->phy_mode != FSL_USB2_PHY_ULPI && 63 if (pdata->phy_mode != FSL_USB2_PHY_ULPI &&
65 (freq < 59999000 || freq > 60001000)) { 64 (freq < 59999000 || freq > 60001000)) {
@@ -79,27 +78,40 @@ eclkrate:
79 return ret; 78 return ret;
80} 79}
81 80
82void fsl_udc_clk_finalize(struct platform_device *pdev) 81int fsl_udc_clk_finalize(struct platform_device *pdev)
83{ 82{
84 struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data; 83 struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data;
85 if (cpu_is_mx35()) { 84 int ret = 0;
86 unsigned int v;
87 85
88 /* workaround ENGcm09152 for i.MX35 */ 86 /* workaround ENGcm09152 for i.MX35 */
89 if (pdata->workaround & FLS_USB2_WORKAROUND_ENGCM09152) { 87 if (pdata->workaround & FLS_USB2_WORKAROUND_ENGCM09152) {
90 v = readl(MX35_IO_ADDRESS(MX35_USB_BASE_ADDR + 88 unsigned int v;
91 USBPHYCTRL_OTGBASE_OFFSET)); 89 struct resource *res = platform_get_resource
92 writel(v | USBPHYCTRL_EVDO, 90 (pdev, IORESOURCE_MEM, 0);
93 MX35_IO_ADDRESS(MX35_USB_BASE_ADDR + 91 void __iomem *phy_regs = ioremap(res->start +
94 USBPHYCTRL_OTGBASE_OFFSET)); 92 MX35_USBPHYCTRL_OFFSET, 512);
93 if (!phy_regs) {
94 dev_err(&pdev->dev, "ioremap for phy address fails\n");
95 ret = -EINVAL;
96 goto ioremap_err;
95 } 97 }
98
99 v = readl(phy_regs + USBPHYCTRL_OTGBASE_OFFSET);
100 writel(v | USBPHYCTRL_EVDO,
101 phy_regs + USBPHYCTRL_OTGBASE_OFFSET);
102
103 iounmap(phy_regs);
96 } 104 }
97 105
106
107ioremap_err:
98 /* ULPI transceivers don't need usbpll */ 108 /* ULPI transceivers don't need usbpll */
99 if (pdata->phy_mode == FSL_USB2_PHY_ULPI) { 109 if (pdata->phy_mode == FSL_USB2_PHY_ULPI) {
100 clk_disable_unprepare(mxc_per_clk); 110 clk_disable_unprepare(mxc_per_clk);
101 mxc_per_clk = NULL; 111 mxc_per_clk = NULL;
102 } 112 }
113
114 return ret;
103} 115}
104 116
105void fsl_udc_clk_release(void) 117void fsl_udc_clk_release(void)
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
index c19f7f13790b..667275cb7bad 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -41,6 +41,7 @@
41#include <linux/fsl_devices.h> 41#include <linux/fsl_devices.h>
42#include <linux/dmapool.h> 42#include <linux/dmapool.h>
43#include <linux/delay.h> 43#include <linux/delay.h>
44#include <linux/of_device.h>
44 45
45#include <asm/byteorder.h> 46#include <asm/byteorder.h>
46#include <asm/io.h> 47#include <asm/io.h>
@@ -2438,11 +2439,6 @@ static int __init fsl_udc_probe(struct platform_device *pdev)
2438 unsigned int i; 2439 unsigned int i;
2439 u32 dccparams; 2440 u32 dccparams;
2440 2441
2441 if (strcmp(pdev->name, driver_name)) {
2442 VDBG("Wrong device");
2443 return -ENODEV;
2444 }
2445
2446 udc_controller = kzalloc(sizeof(struct fsl_udc), GFP_KERNEL); 2442 udc_controller = kzalloc(sizeof(struct fsl_udc), GFP_KERNEL);
2447 if (udc_controller == NULL) { 2443 if (udc_controller == NULL) {
2448 ERR("malloc udc failed\n"); 2444 ERR("malloc udc failed\n");
@@ -2547,7 +2543,9 @@ static int __init fsl_udc_probe(struct platform_device *pdev)
2547 dr_controller_setup(udc_controller); 2543 dr_controller_setup(udc_controller);
2548 } 2544 }
2549 2545
2550 fsl_udc_clk_finalize(pdev); 2546 ret = fsl_udc_clk_finalize(pdev);
2547 if (ret)
2548 goto err_free_irq;
2551 2549
2552 /* Setup gadget structure */ 2550 /* Setup gadget structure */
2553 udc_controller->gadget.ops = &fsl_gadget_ops; 2551 udc_controller->gadget.ops = &fsl_gadget_ops;
@@ -2756,22 +2754,32 @@ static int fsl_udc_otg_resume(struct device *dev)
2756 2754
2757 return fsl_udc_resume(NULL); 2755 return fsl_udc_resume(NULL);
2758} 2756}
2759
2760/*------------------------------------------------------------------------- 2757/*-------------------------------------------------------------------------
2761 Register entry point for the peripheral controller driver 2758 Register entry point for the peripheral controller driver
2762--------------------------------------------------------------------------*/ 2759--------------------------------------------------------------------------*/
2763 2760static const struct platform_device_id fsl_udc_devtype[] = {
2761 {
2762 .name = "imx-udc-mx27",
2763 }, {
2764 .name = "imx-udc-mx51",
2765 }, {
2766 /* sentinel */
2767 }
2768};
2769MODULE_DEVICE_TABLE(platform, fsl_udc_devtype);
2764static struct platform_driver udc_driver = { 2770static struct platform_driver udc_driver = {
2765 .remove = __exit_p(fsl_udc_remove), 2771 .remove = __exit_p(fsl_udc_remove),
2772 /* Just for FSL i.mx SoC currently */
2773 .id_table = fsl_udc_devtype,
2766 /* these suspend and resume are not usb suspend and resume */ 2774 /* these suspend and resume are not usb suspend and resume */
2767 .suspend = fsl_udc_suspend, 2775 .suspend = fsl_udc_suspend,
2768 .resume = fsl_udc_resume, 2776 .resume = fsl_udc_resume,
2769 .driver = { 2777 .driver = {
2770 .name = (char *)driver_name, 2778 .name = (char *)driver_name,
2771 .owner = THIS_MODULE, 2779 .owner = THIS_MODULE,
2772 /* udc suspend/resume called from OTG driver */ 2780 /* udc suspend/resume called from OTG driver */
2773 .suspend = fsl_udc_otg_suspend, 2781 .suspend = fsl_udc_otg_suspend,
2774 .resume = fsl_udc_otg_resume, 2782 .resume = fsl_udc_otg_resume,
2775 }, 2783 },
2776}; 2784};
2777 2785
diff --git a/drivers/usb/gadget/fsl_usb2_udc.h b/drivers/usb/gadget/fsl_usb2_udc.h
index f61a967f7082..c6703bb07b23 100644
--- a/drivers/usb/gadget/fsl_usb2_udc.h
+++ b/drivers/usb/gadget/fsl_usb2_udc.h
@@ -592,15 +592,16 @@ static inline struct ep_queue_head *get_qh_by_ep(struct fsl_ep *ep)
592struct platform_device; 592struct platform_device;
593#ifdef CONFIG_ARCH_MXC 593#ifdef CONFIG_ARCH_MXC
594int fsl_udc_clk_init(struct platform_device *pdev); 594int fsl_udc_clk_init(struct platform_device *pdev);
595void fsl_udc_clk_finalize(struct platform_device *pdev); 595int fsl_udc_clk_finalize(struct platform_device *pdev);
596void fsl_udc_clk_release(void); 596void fsl_udc_clk_release(void);
597#else 597#else
598static inline int fsl_udc_clk_init(struct platform_device *pdev) 598static inline int fsl_udc_clk_init(struct platform_device *pdev)
599{ 599{
600 return 0; 600 return 0;
601} 601}
602static inline void fsl_udc_clk_finalize(struct platform_device *pdev) 602static inline int fsl_udc_clk_finalize(struct platform_device *pdev)
603{ 603{
604 return 0;
604} 605}
605static inline void fsl_udc_clk_release(void) 606static inline void fsl_udc_clk_release(void)
606{ 607{
diff --git a/drivers/usb/gadget/mv_udc_core.c b/drivers/usb/gadget/mv_udc_core.c
index 379aac7b82fc..6e8b1272ebce 100644
--- a/drivers/usb/gadget/mv_udc_core.c
+++ b/drivers/usb/gadget/mv_udc_core.c
@@ -1012,7 +1012,7 @@ static void udc_clock_enable(struct mv_udc *udc)
1012 unsigned int i; 1012 unsigned int i;
1013 1013
1014 for (i = 0; i < udc->clknum; i++) 1014 for (i = 0; i < udc->clknum; i++)
1015 clk_enable(udc->clk[i]); 1015 clk_prepare_enable(udc->clk[i]);
1016} 1016}
1017 1017
1018static void udc_clock_disable(struct mv_udc *udc) 1018static void udc_clock_disable(struct mv_udc *udc)
@@ -1020,7 +1020,7 @@ static void udc_clock_disable(struct mv_udc *udc)
1020 unsigned int i; 1020 unsigned int i;
1021 1021
1022 for (i = 0; i < udc->clknum; i++) 1022 for (i = 0; i < udc->clknum; i++)
1023 clk_disable(udc->clk[i]); 1023 clk_disable_unprepare(udc->clk[i]);
1024} 1024}
1025 1025
1026static void udc_stop(struct mv_udc *udc) 1026static void udc_stop(struct mv_udc *udc)
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
index 141971d9051e..439c3f972f8c 100644
--- a/drivers/usb/gadget/s3c-hsotg.c
+++ b/drivers/usb/gadget/s3c-hsotg.c
@@ -3477,12 +3477,11 @@ static void s3c_hsotg_delete_debug(struct s3c_hsotg *hsotg)
3477/** 3477/**
3478 * s3c_hsotg_release - release callback for hsotg device 3478 * s3c_hsotg_release - release callback for hsotg device
3479 * @dev: Device to for which release is called 3479 * @dev: Device to for which release is called
3480 *
3481 * Nothing to do as the resource is allocated using devm_ API.
3480 */ 3482 */
3481static void s3c_hsotg_release(struct device *dev) 3483static void s3c_hsotg_release(struct device *dev)
3482{ 3484{
3483 struct s3c_hsotg *hsotg = dev_get_drvdata(dev);
3484
3485 kfree(hsotg);
3486} 3485}
3487 3486
3488/** 3487/**
diff --git a/drivers/usb/gadget/tcm_usb_gadget.c b/drivers/usb/gadget/tcm_usb_gadget.c
index 4f7f76f00c74..7cacd6ae818e 100644
--- a/drivers/usb/gadget/tcm_usb_gadget.c
+++ b/drivers/usb/gadget/tcm_usb_gadget.c
@@ -1794,9 +1794,10 @@ static int tcm_usbg_drop_nexus(struct usbg_tpg *tpg)
1794 tpg->tpg_nexus = NULL; 1794 tpg->tpg_nexus = NULL;
1795 1795
1796 kfree(tv_nexus); 1796 kfree(tv_nexus);
1797 ret = 0;
1797out: 1798out:
1798 mutex_unlock(&tpg->tpg_mutex); 1799 mutex_unlock(&tpg->tpg_mutex);
1799 return 0; 1800 return ret;
1800} 1801}
1801 1802
1802static ssize_t tcm_usbg_tpg_store_nexus( 1803static ssize_t tcm_usbg_tpg_store_nexus(
diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c
index d0f95482f40e..598dcc1212f0 100644
--- a/drivers/usb/gadget/u_serial.c
+++ b/drivers/usb/gadget/u_serial.c
@@ -887,7 +887,7 @@ static void gs_close(struct tty_struct *tty, struct file *file)
887 pr_debug("gs_close: ttyGS%d (%p,%p) done!\n", 887 pr_debug("gs_close: ttyGS%d (%p,%p) done!\n",
888 port->port_num, tty, file); 888 port->port_num, tty, file);
889 889
890 wake_up_interruptible(&port->port.close_wait); 890 wake_up(&port->port.close_wait);
891exit: 891exit:
892 spin_unlock_irq(&port->port_lock); 892 spin_unlock_irq(&port->port_lock);
893} 893}
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index d6bb128ce21e..3a21c5d683c0 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -148,7 +148,7 @@ config USB_EHCI_FSL
148 Variation of ARC USB block used in some Freescale chips. 148 Variation of ARC USB block used in some Freescale chips.
149 149
150config USB_EHCI_MXC 150config USB_EHCI_MXC
151 bool "Support for Freescale i.MX on-chip EHCI USB controller" 151 tristate "Support for Freescale i.MX on-chip EHCI USB controller"
152 depends on USB_EHCI_HCD && ARCH_MXC 152 depends on USB_EHCI_HCD && ARCH_MXC
153 select USB_EHCI_ROOT_HUB_TT 153 select USB_EHCI_ROOT_HUB_TT
154 ---help--- 154 ---help---
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 1eb4c3006e9e..001fbff2fdef 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_PCI) += pci-quirks.o
26obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o 26obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o
27obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o 27obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o
28obj-$(CONFIG_USB_EHCI_HCD_PLATFORM) += ehci-platform.o 28obj-$(CONFIG_USB_EHCI_HCD_PLATFORM) += ehci-platform.o
29obj-$(CONFIG_USB_EHCI_MXC) += ehci-mxc.o
29 30
30obj-$(CONFIG_USB_OXU210HP_HCD) += oxu210hp-hcd.o 31obj-$(CONFIG_USB_OXU210HP_HCD) += oxu210hp-hcd.o
31obj-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o 32obj-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index fd9b5424b860..d81d2fcbff18 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -230,7 +230,7 @@ static int ehci_fsl_setup_phy(struct usb_hcd *hcd,
230 230
231 switch (phy_mode) { 231 switch (phy_mode) {
232 case FSL_USB2_PHY_ULPI: 232 case FSL_USB2_PHY_ULPI:
233 if (pdata->controller_ver) { 233 if (pdata->have_sysif_regs && pdata->controller_ver) {
234 /* controller version 1.6 or above */ 234 /* controller version 1.6 or above */
235 setbits32(non_ehci + FSL_SOC_USB_CTRL, 235 setbits32(non_ehci + FSL_SOC_USB_CTRL,
236 ULPI_PHY_CLK_SEL); 236 ULPI_PHY_CLK_SEL);
@@ -251,7 +251,7 @@ static int ehci_fsl_setup_phy(struct usb_hcd *hcd,
251 portsc |= PORT_PTS_PTW; 251 portsc |= PORT_PTS_PTW;
252 /* fall through */ 252 /* fall through */
253 case FSL_USB2_PHY_UTMI: 253 case FSL_USB2_PHY_UTMI:
254 if (pdata->controller_ver) { 254 if (pdata->have_sysif_regs && pdata->controller_ver) {
255 /* controller version 1.6 or above */ 255 /* controller version 1.6 or above */
256 setbits32(non_ehci + FSL_SOC_USB_CTRL, UTMI_PHY_EN); 256 setbits32(non_ehci + FSL_SOC_USB_CTRL, UTMI_PHY_EN);
257 mdelay(FSL_UTMI_PHY_DLY); /* Delay for UTMI PHY CLK to 257 mdelay(FSL_UTMI_PHY_DLY); /* Delay for UTMI PHY CLK to
@@ -267,7 +267,8 @@ static int ehci_fsl_setup_phy(struct usb_hcd *hcd,
267 break; 267 break;
268 } 268 }
269 269
270 if (pdata->controller_ver && (phy_mode == FSL_USB2_PHY_ULPI)) { 270 if (pdata->have_sysif_regs && pdata->controller_ver &&
271 (phy_mode == FSL_USB2_PHY_ULPI)) {
271 /* check PHY_CLK_VALID to get phy clk valid */ 272 /* check PHY_CLK_VALID to get phy clk valid */
272 if (!spin_event_timeout(in_be32(non_ehci + FSL_SOC_USB_CTRL) & 273 if (!spin_event_timeout(in_be32(non_ehci + FSL_SOC_USB_CTRL) &
273 PHY_CLK_VALID, FSL_USB_PHY_CLK_TIMEOUT, 0)) { 274 PHY_CLK_VALID, FSL_USB_PHY_CLK_TIMEOUT, 0)) {
@@ -278,7 +279,7 @@ static int ehci_fsl_setup_phy(struct usb_hcd *hcd,
278 279
279 ehci_writel(ehci, portsc, &ehci->regs->port_status[port_offset]); 280 ehci_writel(ehci, portsc, &ehci->regs->port_status[port_offset]);
280 281
281 if (phy_mode != FSL_USB2_PHY_ULPI) 282 if (phy_mode != FSL_USB2_PHY_ULPI && pdata->have_sysif_regs)
282 setbits32(non_ehci + FSL_SOC_USB_CTRL, USB_CTRL_USB_EN); 283 setbits32(non_ehci + FSL_SOC_USB_CTRL, USB_CTRL_USB_EN);
283 284
284 return 0; 285 return 0;
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index c97503bb0b0e..09537b2f1002 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -74,10 +74,6 @@ static const char hcd_name [] = "ehci_hcd";
74#undef VERBOSE_DEBUG 74#undef VERBOSE_DEBUG
75#undef EHCI_URB_TRACE 75#undef EHCI_URB_TRACE
76 76
77#ifdef DEBUG
78#define EHCI_STATS
79#endif
80
81/* magic numbers that can affect system performance */ 77/* magic numbers that can affect system performance */
82#define EHCI_TUNE_CERR 3 /* 0-3 qtd retries; 0 == don't stop */ 78#define EHCI_TUNE_CERR 3 /* 0-3 qtd retries; 0 == don't stop */
83#define EHCI_TUNE_RL_HS 4 /* nak throttle; see 4.9 */ 79#define EHCI_TUNE_RL_HS 4 /* nak throttle; see 4.9 */
@@ -1250,11 +1246,6 @@ MODULE_LICENSE ("GPL");
1250#define PLATFORM_DRIVER ehci_fsl_driver 1246#define PLATFORM_DRIVER ehci_fsl_driver
1251#endif 1247#endif
1252 1248
1253#ifdef CONFIG_USB_EHCI_MXC
1254#include "ehci-mxc.c"
1255#define PLATFORM_DRIVER ehci_mxc_driver
1256#endif
1257
1258#ifdef CONFIG_USB_EHCI_SH 1249#ifdef CONFIG_USB_EHCI_SH
1259#include "ehci-sh.c" 1250#include "ehci-sh.c"
1260#define PLATFORM_DRIVER ehci_hcd_sh_driver 1251#define PLATFORM_DRIVER ehci_hcd_sh_driver
@@ -1352,7 +1343,8 @@ MODULE_LICENSE ("GPL");
1352 1343
1353#if !IS_ENABLED(CONFIG_USB_EHCI_PCI) && \ 1344#if !IS_ENABLED(CONFIG_USB_EHCI_PCI) && \
1354 !IS_ENABLED(CONFIG_USB_EHCI_HCD_PLATFORM) && \ 1345 !IS_ENABLED(CONFIG_USB_EHCI_HCD_PLATFORM) && \
1355 !defined(CONFIG_USB_CHIPIDEA_HOST) && \ 1346 !IS_ENABLED(CONFIG_USB_CHIPIDEA_HOST) && \
1347 !IS_ENABLED(CONFIG_USB_EHCI_MXC) && \
1356 !defined(PLATFORM_DRIVER) && \ 1348 !defined(PLATFORM_DRIVER) && \
1357 !defined(PS3_SYSTEM_BUS_DRIVER) && \ 1349 !defined(PS3_SYSTEM_BUS_DRIVER) && \
1358 !defined(OF_PLATFORM_DRIVER) && \ 1350 !defined(OF_PLATFORM_DRIVER) && \
diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c
index f7bfc0b898b9..6c56297ea16b 100644
--- a/drivers/usb/host/ehci-mv.c
+++ b/drivers/usb/host/ehci-mv.c
@@ -43,7 +43,7 @@ static void ehci_clock_enable(struct ehci_hcd_mv *ehci_mv)
43 unsigned int i; 43 unsigned int i;
44 44
45 for (i = 0; i < ehci_mv->clknum; i++) 45 for (i = 0; i < ehci_mv->clknum; i++)
46 clk_enable(ehci_mv->clk[i]); 46 clk_prepare_enable(ehci_mv->clk[i]);
47} 47}
48 48
49static void ehci_clock_disable(struct ehci_hcd_mv *ehci_mv) 49static void ehci_clock_disable(struct ehci_hcd_mv *ehci_mv)
@@ -51,7 +51,7 @@ static void ehci_clock_disable(struct ehci_hcd_mv *ehci_mv)
51 unsigned int i; 51 unsigned int i;
52 52
53 for (i = 0; i < ehci_mv->clknum; i++) 53 for (i = 0; i < ehci_mv->clknum; i++)
54 clk_disable(ehci_mv->clk[i]); 54 clk_disable_unprepare(ehci_mv->clk[i]);
55} 55}
56 56
57static int mv_ehci_enable(struct ehci_hcd_mv *ehci_mv) 57static int mv_ehci_enable(struct ehci_hcd_mv *ehci_mv)
diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c
index ec7f5d2c90de..dedb80bb8d40 100644
--- a/drivers/usb/host/ehci-mxc.c
+++ b/drivers/usb/host/ehci-mxc.c
@@ -17,75 +17,38 @@
17 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */ 18 */
19 19
20#include <linux/kernel.h>
21#include <linux/module.h>
22#include <linux/io.h>
20#include <linux/platform_device.h> 23#include <linux/platform_device.h>
21#include <linux/clk.h> 24#include <linux/clk.h>
22#include <linux/delay.h> 25#include <linux/delay.h>
23#include <linux/usb/otg.h> 26#include <linux/usb/otg.h>
24#include <linux/usb/ulpi.h> 27#include <linux/usb/ulpi.h>
25#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/usb.h>
30#include <linux/usb/hcd.h>
26 31
27#include <linux/platform_data/usb-ehci-mxc.h> 32#include <linux/platform_data/usb-ehci-mxc.h>
28 33
29#include <asm/mach-types.h> 34#include <asm/mach-types.h>
30 35
36#include "ehci.h"
37
38#define DRIVER_DESC "Freescale On-Chip EHCI Host driver"
39
40static const char hcd_name[] = "ehci-mxc";
41
31#define ULPI_VIEWPORT_OFFSET 0x170 42#define ULPI_VIEWPORT_OFFSET 0x170
32 43
33struct ehci_mxc_priv { 44struct ehci_mxc_priv {
34 struct clk *usbclk, *ahbclk, *phyclk; 45 struct clk *usbclk, *ahbclk, *phyclk;
35 struct usb_hcd *hcd;
36}; 46};
37 47
38/* called during probe() after chip reset completes */ 48static struct hc_driver __read_mostly ehci_mxc_hc_driver;
39static int ehci_mxc_setup(struct usb_hcd *hcd)
40{
41 hcd->has_tt = 1;
42
43 return ehci_setup(hcd);
44}
45 49
46static const struct hc_driver ehci_mxc_hc_driver = { 50static const struct ehci_driver_overrides ehci_mxc_overrides __initdata = {
47 .description = hcd_name, 51 .extra_priv_size = sizeof(struct ehci_mxc_priv),
48 .product_desc = "Freescale On-Chip EHCI Host Controller",
49 .hcd_priv_size = sizeof(struct ehci_hcd),
50
51 /*
52 * generic hardware linkage
53 */
54 .irq = ehci_irq,
55 .flags = HCD_USB2 | HCD_MEMORY,
56
57 /*
58 * basic lifecycle operations
59 */
60 .reset = ehci_mxc_setup,
61 .start = ehci_run,
62 .stop = ehci_stop,
63 .shutdown = ehci_shutdown,
64
65 /*
66 * managing i/o requests and associated device resources
67 */
68 .urb_enqueue = ehci_urb_enqueue,
69 .urb_dequeue = ehci_urb_dequeue,
70 .endpoint_disable = ehci_endpoint_disable,
71 .endpoint_reset = ehci_endpoint_reset,
72
73 /*
74 * scheduling support
75 */
76 .get_frame_number = ehci_get_frame,
77
78 /*
79 * root hub support
80 */
81 .hub_status_data = ehci_hub_status_data,
82 .hub_control = ehci_hub_control,
83 .bus_suspend = ehci_bus_suspend,
84 .bus_resume = ehci_bus_resume,
85 .relinquish_port = ehci_relinquish_port,
86 .port_handed_over = ehci_port_handed_over,
87
88 .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
89}; 52};
90 53
91static int ehci_mxc_drv_probe(struct platform_device *pdev) 54static int ehci_mxc_drv_probe(struct platform_device *pdev)
@@ -112,12 +75,6 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev)
112 if (!hcd) 75 if (!hcd)
113 return -ENOMEM; 76 return -ENOMEM;
114 77
115 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
116 if (!priv) {
117 ret = -ENOMEM;
118 goto err_alloc;
119 }
120
121 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 78 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
122 if (!res) { 79 if (!res) {
123 dev_err(dev, "Found HC with no register addr. Check setup!\n"); 80 dev_err(dev, "Found HC with no register addr. Check setup!\n");
@@ -135,6 +92,10 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev)
135 goto err_alloc; 92 goto err_alloc;
136 } 93 }
137 94
95 hcd->has_tt = 1;
96 ehci = hcd_to_ehci(hcd);
97 priv = (struct ehci_mxc_priv *) ehci->priv;
98
138 /* enable clocks */ 99 /* enable clocks */
139 priv->usbclk = devm_clk_get(&pdev->dev, "ipg"); 100 priv->usbclk = devm_clk_get(&pdev->dev, "ipg");
140 if (IS_ERR(priv->usbclk)) { 101 if (IS_ERR(priv->usbclk)) {
@@ -169,8 +130,6 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev)
169 mdelay(10); 130 mdelay(10);
170 } 131 }
171 132
172 ehci = hcd_to_ehci(hcd);
173
174 /* EHCI registers start at offset 0x100 */ 133 /* EHCI registers start at offset 0x100 */
175 ehci->caps = hcd->regs + 0x100; 134 ehci->caps = hcd->regs + 0x100;
176 ehci->regs = hcd->regs + 0x100 + 135 ehci->regs = hcd->regs + 0x100 +
@@ -198,8 +157,7 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev)
198 } 157 }
199 } 158 }
200 159
201 priv->hcd = hcd; 160 platform_set_drvdata(pdev, hcd);
202 platform_set_drvdata(pdev, priv);
203 161
204 ret = usb_add_hcd(hcd, irq, IRQF_SHARED); 162 ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
205 if (ret) 163 if (ret)
@@ -244,8 +202,11 @@ err_alloc:
244static int __exit ehci_mxc_drv_remove(struct platform_device *pdev) 202static int __exit ehci_mxc_drv_remove(struct platform_device *pdev)
245{ 203{
246 struct mxc_usbh_platform_data *pdata = pdev->dev.platform_data; 204 struct mxc_usbh_platform_data *pdata = pdev->dev.platform_data;
247 struct ehci_mxc_priv *priv = platform_get_drvdata(pdev); 205 struct usb_hcd *hcd = platform_get_drvdata(pdev);
248 struct usb_hcd *hcd = priv->hcd; 206 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
207 struct ehci_mxc_priv *priv = (struct ehci_mxc_priv *) ehci->priv;
208
209 usb_remove_hcd(hcd);
249 210
250 if (pdata && pdata->exit) 211 if (pdata && pdata->exit)
251 pdata->exit(pdev); 212 pdata->exit(pdev);
@@ -253,23 +214,20 @@ static int __exit ehci_mxc_drv_remove(struct platform_device *pdev)
253 if (pdata->otg) 214 if (pdata->otg)
254 usb_phy_shutdown(pdata->otg); 215 usb_phy_shutdown(pdata->otg);
255 216
256 usb_remove_hcd(hcd);
257 usb_put_hcd(hcd);
258 platform_set_drvdata(pdev, NULL);
259
260 clk_disable_unprepare(priv->usbclk); 217 clk_disable_unprepare(priv->usbclk);
261 clk_disable_unprepare(priv->ahbclk); 218 clk_disable_unprepare(priv->ahbclk);
262 219
263 if (priv->phyclk) 220 if (priv->phyclk)
264 clk_disable_unprepare(priv->phyclk); 221 clk_disable_unprepare(priv->phyclk);
265 222
223 usb_put_hcd(hcd);
224 platform_set_drvdata(pdev, NULL);
266 return 0; 225 return 0;
267} 226}
268 227
269static void ehci_mxc_drv_shutdown(struct platform_device *pdev) 228static void ehci_mxc_drv_shutdown(struct platform_device *pdev)
270{ 229{
271 struct ehci_mxc_priv *priv = platform_get_drvdata(pdev); 230 struct usb_hcd *hcd = platform_get_drvdata(pdev);
272 struct usb_hcd *hcd = priv->hcd;
273 231
274 if (hcd->driver->shutdown) 232 if (hcd->driver->shutdown)
275 hcd->driver->shutdown(hcd); 233 hcd->driver->shutdown(hcd);
@@ -279,9 +237,31 @@ MODULE_ALIAS("platform:mxc-ehci");
279 237
280static struct platform_driver ehci_mxc_driver = { 238static struct platform_driver ehci_mxc_driver = {
281 .probe = ehci_mxc_drv_probe, 239 .probe = ehci_mxc_drv_probe,
282 .remove = __exit_p(ehci_mxc_drv_remove), 240 .remove = ehci_mxc_drv_remove,
283 .shutdown = ehci_mxc_drv_shutdown, 241 .shutdown = ehci_mxc_drv_shutdown,
284 .driver = { 242 .driver = {
285 .name = "mxc-ehci", 243 .name = "mxc-ehci",
286 }, 244 },
287}; 245};
246
247static int __init ehci_mxc_init(void)
248{
249 if (usb_disabled())
250 return -ENODEV;
251
252 pr_info("%s: " DRIVER_DESC "\n", hcd_name);
253
254 ehci_init_driver(&ehci_mxc_hc_driver, &ehci_mxc_overrides);
255 return platform_driver_register(&ehci_mxc_driver);
256}
257module_init(ehci_mxc_init);
258
259static void __exit ehci_mxc_cleanup(void)
260{
261 platform_driver_unregister(&ehci_mxc_driver);
262}
263module_exit(ehci_mxc_cleanup);
264
265MODULE_DESCRIPTION(DRIVER_DESC);
266MODULE_AUTHOR("Sascha Hauer");
267MODULE_LICENSE("GPL");
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c
index a7d1f5b4c4ed..914a3ecfb5d3 100644
--- a/drivers/usb/host/ehci-orion.c
+++ b/drivers/usb/host/ehci-orion.c
@@ -325,7 +325,7 @@ static int __exit ehci_orion_drv_remove(struct platform_device *pdev)
325 325
326MODULE_ALIAS("platform:orion-ehci"); 326MODULE_ALIAS("platform:orion-ehci");
327 327
328static const struct of_device_id ehci_orion_dt_ids[] __devinitdata = { 328static const struct of_device_id ehci_orion_dt_ids[] = {
329 { .compatible = "marvell,orion-ehci", }, 329 { .compatible = "marvell,orion-ehci", },
330 {}, 330 {},
331}; 331};
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index dabb20494826..170b9399e09f 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -200,6 +200,26 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
200 break; 200 break;
201 } 201 }
202 202
203 /* optional debug port, normally in the first BAR */
204 temp = pci_find_capability(pdev, PCI_CAP_ID_DBG);
205 if (temp) {
206 pci_read_config_dword(pdev, temp, &temp);
207 temp >>= 16;
208 if (((temp >> 13) & 7) == 1) {
209 u32 hcs_params = ehci_readl(ehci,
210 &ehci->caps->hcs_params);
211
212 temp &= 0x1fff;
213 ehci->debug = hcd->regs + temp;
214 temp = ehci_readl(ehci, &ehci->debug->control);
215 ehci_info(ehci, "debug port %d%s\n",
216 HCS_DEBUG_PORT(hcs_params),
217 (temp & DBGP_ENABLED) ? " IN USE" : "");
218 if (!(temp & DBGP_ENABLED))
219 ehci->debug = NULL;
220 }
221 }
222
203 retval = ehci_setup(hcd); 223 retval = ehci_setup(hcd);
204 if (retval) 224 if (retval)
205 return retval; 225 return retval;
@@ -228,25 +248,6 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
228 break; 248 break;
229 } 249 }
230 250
231 /* optional debug port, normally in the first BAR */
232 temp = pci_find_capability(pdev, 0x0a);
233 if (temp) {
234 pci_read_config_dword(pdev, temp, &temp);
235 temp >>= 16;
236 if ((temp & (3 << 13)) == (1 << 13)) {
237 temp &= 0x1fff;
238 ehci->debug = hcd->regs + temp;
239 temp = ehci_readl(ehci, &ehci->debug->control);
240 ehci_info(ehci, "debug port %d%s\n",
241 HCS_DEBUG_PORT(ehci->hcs_params),
242 (temp & DBGP_ENABLED)
243 ? " IN USE"
244 : "");
245 if (!(temp & DBGP_ENABLED))
246 ehci->debug = NULL;
247 }
248 }
249
250 /* at least the Genesys GL880S needs fixup here */ 251 /* at least the Genesys GL880S needs fixup here */
251 temp = HCS_N_CC(ehci->hcs_params) * HCS_N_PCC(ehci->hcs_params); 252 temp = HCS_N_CC(ehci->hcs_params) * HCS_N_PCC(ehci->hcs_params);
252 temp &= 0x0f; 253 temp &= 0x0f;
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index 9dadc7118d68..36c3a8210595 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -38,6 +38,10 @@ typedef __u16 __bitwise __hc16;
38#endif 38#endif
39 39
40/* statistics can be kept for tuning/monitoring */ 40/* statistics can be kept for tuning/monitoring */
41#ifdef DEBUG
42#define EHCI_STATS
43#endif
44
41struct ehci_stats { 45struct ehci_stats {
42 /* irq usage */ 46 /* irq usage */
43 unsigned long normal; 47 unsigned long normal;
@@ -221,6 +225,9 @@ struct ehci_hcd { /* one per controller */
221#ifdef DEBUG 225#ifdef DEBUG
222 struct dentry *debug_dir; 226 struct dentry *debug_dir;
223#endif 227#endif
228
229 /* platform-specific data -- must come last */
230 unsigned long priv[0] __aligned(sizeof(s64));
224}; 231};
225 232
226/* convert between an HCD pointer and the corresponding EHCI_HCD */ 233/* convert between an HCD pointer and the corresponding EHCI_HCD */
diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c
index 5105127c1d4b..11e0b79ff9d5 100644
--- a/drivers/usb/host/fsl-mph-dr-of.c
+++ b/drivers/usb/host/fsl-mph-dr-of.c
@@ -142,6 +142,9 @@ static int usb_get_ver_info(struct device_node *np)
142 return ver; 142 return ver;
143 } 143 }
144 144
145 if (of_device_is_compatible(np, "fsl,mpc5121-usb2-dr"))
146 return FSL_USB_VER_OLD;
147
145 if (of_device_is_compatible(np, "fsl-usb2-mph")) { 148 if (of_device_is_compatible(np, "fsl-usb2-mph")) {
146 if (of_device_is_compatible(np, "fsl-usb2-mph-v1.6")) 149 if (of_device_is_compatible(np, "fsl-usb2-mph-v1.6"))
147 ver = FSL_USB_VER_1_6; 150 ver = FSL_USB_VER_1_6;
diff --git a/drivers/usb/host/imx21-hcd.c b/drivers/usb/host/imx21-hcd.c
index bd6a7447ccc9..f0ebe8e7c58b 100644
--- a/drivers/usb/host/imx21-hcd.c
+++ b/drivers/usb/host/imx21-hcd.c
@@ -58,6 +58,7 @@
58#include <linux/usb.h> 58#include <linux/usb.h>
59#include <linux/usb/hcd.h> 59#include <linux/usb/hcd.h>
60#include <linux/dma-mapping.h> 60#include <linux/dma-mapping.h>
61#include <linux/module.h>
61 62
62#include "imx21-hcd.h" 63#include "imx21-hcd.h"
63 64
diff --git a/drivers/usb/host/ohci-tmio.c b/drivers/usb/host/ohci-tmio.c
index d370245a4ee2..5e3a6deb62b1 100644
--- a/drivers/usb/host/ohci-tmio.c
+++ b/drivers/usb/host/ohci-tmio.c
@@ -128,7 +128,8 @@ static void tmio_start_hc(struct platform_device *dev)
128 tmio_iowrite8(2, tmio->ccr + CCR_INTC); 128 tmio_iowrite8(2, tmio->ccr + CCR_INTC);
129 129
130 dev_info(&dev->dev, "revision %d @ 0x%08llx, irq %d\n", 130 dev_info(&dev->dev, "revision %d @ 0x%08llx, irq %d\n",
131 tmio_ioread8(tmio->ccr + CCR_REVID), hcd->rsrc_start, hcd->irq); 131 tmio_ioread8(tmio->ccr + CCR_REVID),
132 (u64) hcd->rsrc_start, hcd->irq);
132} 133}
133 134
134static int ohci_tmio_start(struct usb_hcd *hcd) 135static int ohci_tmio_start(struct usb_hcd *hcd)
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index 4b9e9aba2665..4f64d24eebc8 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -447,6 +447,10 @@ static irqreturn_t uhci_irq(struct usb_hcd *hcd)
447 return IRQ_NONE; 447 return IRQ_NONE;
448 uhci_writew(uhci, status, USBSTS); /* Clear it */ 448 uhci_writew(uhci, status, USBSTS); /* Clear it */
449 449
450 spin_lock(&uhci->lock);
451 if (unlikely(!uhci->is_initialized)) /* not yet configured */
452 goto done;
453
450 if (status & ~(USBSTS_USBINT | USBSTS_ERROR | USBSTS_RD)) { 454 if (status & ~(USBSTS_USBINT | USBSTS_ERROR | USBSTS_RD)) {
451 if (status & USBSTS_HSE) 455 if (status & USBSTS_HSE)
452 dev_err(uhci_dev(uhci), "host system error, " 456 dev_err(uhci_dev(uhci), "host system error, "
@@ -455,7 +459,6 @@ static irqreturn_t uhci_irq(struct usb_hcd *hcd)
455 dev_err(uhci_dev(uhci), "host controller process " 459 dev_err(uhci_dev(uhci), "host controller process "
456 "error, something bad happened!\n"); 460 "error, something bad happened!\n");
457 if (status & USBSTS_HCH) { 461 if (status & USBSTS_HCH) {
458 spin_lock(&uhci->lock);
459 if (uhci->rh_state >= UHCI_RH_RUNNING) { 462 if (uhci->rh_state >= UHCI_RH_RUNNING) {
460 dev_err(uhci_dev(uhci), 463 dev_err(uhci_dev(uhci),
461 "host controller halted, " 464 "host controller halted, "
@@ -473,15 +476,15 @@ static irqreturn_t uhci_irq(struct usb_hcd *hcd)
473 * pending unlinks */ 476 * pending unlinks */
474 mod_timer(&hcd->rh_timer, jiffies); 477 mod_timer(&hcd->rh_timer, jiffies);
475 } 478 }
476 spin_unlock(&uhci->lock);
477 } 479 }
478 } 480 }
479 481
480 if (status & USBSTS_RD) 482 if (status & USBSTS_RD) {
483 spin_unlock(&uhci->lock);
481 usb_hcd_poll_rh_status(hcd); 484 usb_hcd_poll_rh_status(hcd);
482 else { 485 } else {
483 spin_lock(&uhci->lock);
484 uhci_scan_schedule(uhci); 486 uhci_scan_schedule(uhci);
487 done:
485 spin_unlock(&uhci->lock); 488 spin_unlock(&uhci->lock);
486 } 489 }
487 490
@@ -662,9 +665,9 @@ static int uhci_start(struct usb_hcd *hcd)
662 */ 665 */
663 mb(); 666 mb();
664 667
668 spin_lock_irq(&uhci->lock);
665 configure_hc(uhci); 669 configure_hc(uhci);
666 uhci->is_initialized = 1; 670 uhci->is_initialized = 1;
667 spin_lock_irq(&uhci->lock);
668 start_rh(uhci); 671 start_rh(uhci);
669 spin_unlock_irq(&uhci->lock); 672 spin_unlock_irq(&uhci->lock);
670 return 0; 673 return 0;
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index a686cf4905bb..68914429482f 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -761,12 +761,39 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
761 break; 761 break;
762 case USB_PORT_FEAT_LINK_STATE: 762 case USB_PORT_FEAT_LINK_STATE:
763 temp = xhci_readl(xhci, port_array[wIndex]); 763 temp = xhci_readl(xhci, port_array[wIndex]);
764
765 /* Disable port */
766 if (link_state == USB_SS_PORT_LS_SS_DISABLED) {
767 xhci_dbg(xhci, "Disable port %d\n", wIndex);
768 temp = xhci_port_state_to_neutral(temp);
769 /*
770 * Clear all change bits, so that we get a new
771 * connection event.
772 */
773 temp |= PORT_CSC | PORT_PEC | PORT_WRC |
774 PORT_OCC | PORT_RC | PORT_PLC |
775 PORT_CEC;
776 xhci_writel(xhci, temp | PORT_PE,
777 port_array[wIndex]);
778 temp = xhci_readl(xhci, port_array[wIndex]);
779 break;
780 }
781
782 /* Put link in RxDetect (enable port) */
783 if (link_state == USB_SS_PORT_LS_RX_DETECT) {
784 xhci_dbg(xhci, "Enable port %d\n", wIndex);
785 xhci_set_link_state(xhci, port_array, wIndex,
786 link_state);
787 temp = xhci_readl(xhci, port_array[wIndex]);
788 break;
789 }
790
764 /* Software should not attempt to set 791 /* Software should not attempt to set
765 * port link state above '5' (Rx.Detect) and the port 792 * port link state above '3' (U3) and the port
766 * must be enabled. 793 * must be enabled.
767 */ 794 */
768 if ((temp & PORT_PE) == 0 || 795 if ((temp & PORT_PE) == 0 ||
769 (link_state > USB_SS_PORT_LS_RX_DETECT)) { 796 (link_state > USB_SS_PORT_LS_U3)) {
770 xhci_warn(xhci, "Cannot set link state.\n"); 797 xhci_warn(xhci, "Cannot set link state.\n");
771 goto error; 798 goto error;
772 } 799 }
@@ -957,6 +984,7 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf)
957 int max_ports; 984 int max_ports;
958 __le32 __iomem **port_array; 985 __le32 __iomem **port_array;
959 struct xhci_bus_state *bus_state; 986 struct xhci_bus_state *bus_state;
987 bool reset_change = false;
960 988
961 max_ports = xhci_get_ports(hcd, &port_array); 989 max_ports = xhci_get_ports(hcd, &port_array);
962 bus_state = &xhci->bus_state[hcd_index(hcd)]; 990 bus_state = &xhci->bus_state[hcd_index(hcd)];
@@ -988,6 +1016,12 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf)
988 buf[(i + 1) / 8] |= 1 << (i + 1) % 8; 1016 buf[(i + 1) / 8] |= 1 << (i + 1) % 8;
989 status = 1; 1017 status = 1;
990 } 1018 }
1019 if ((temp & PORT_RC))
1020 reset_change = true;
1021 }
1022 if (!status && !reset_change) {
1023 xhci_dbg(xhci, "%s: stopping port polling.\n", __func__);
1024 clear_bit(HCD_FLAG_POLL_RH, &hcd->flags);
991 } 1025 }
992 spin_unlock_irqrestore(&xhci->lock, flags); 1026 spin_unlock_irqrestore(&xhci->lock, flags);
993 return status ? retval : 0; 1027 return status ? retval : 0;
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index fb51c7085ad0..35616ffbe3ae 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1250,6 +1250,8 @@ static unsigned int xhci_microframes_to_exponent(struct usb_device *udev,
1250static unsigned int xhci_parse_microframe_interval(struct usb_device *udev, 1250static unsigned int xhci_parse_microframe_interval(struct usb_device *udev,
1251 struct usb_host_endpoint *ep) 1251 struct usb_host_endpoint *ep)
1252{ 1252{
1253 if (ep->desc.bInterval == 0)
1254 return 0;
1253 return xhci_microframes_to_exponent(udev, ep, 1255 return xhci_microframes_to_exponent(udev, ep,
1254 ep->desc.bInterval, 0, 15); 1256 ep->desc.bInterval, 0, 15);
1255} 1257}
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index cbb44b7b9d65..59fb5c677dbe 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1725,6 +1725,15 @@ cleanup:
1725 if (bogus_port_status) 1725 if (bogus_port_status)
1726 return; 1726 return;
1727 1727
1728 /*
1729 * xHCI port-status-change events occur when the "or" of all the
1730 * status-change bits in the portsc register changes from 0 to 1.
1731 * New status changes won't cause an event if any other change
1732 * bits are still set. When an event occurs, switch over to
1733 * polling to avoid losing status changes.
1734 */
1735 xhci_dbg(xhci, "%s: starting port polling.\n", __func__);
1736 set_bit(HCD_FLAG_POLL_RH, &hcd->flags);
1728 spin_unlock(&xhci->lock); 1737 spin_unlock(&xhci->lock);
1729 /* Pass this up to the core */ 1738 /* Pass this up to the core */
1730 usb_hcd_poll_rh_status(hcd); 1739 usb_hcd_poll_rh_status(hcd);
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 5c72c431bab1..f1f01a834ba7 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -884,6 +884,11 @@ int xhci_suspend(struct xhci_hcd *xhci)
884 xhci->shared_hcd->state != HC_STATE_SUSPENDED) 884 xhci->shared_hcd->state != HC_STATE_SUSPENDED)
885 return -EINVAL; 885 return -EINVAL;
886 886
887 /* Don't poll the roothubs on bus suspend. */
888 xhci_dbg(xhci, "%s: stopping port polling.\n", __func__);
889 clear_bit(HCD_FLAG_POLL_RH, &hcd->flags);
890 del_timer_sync(&hcd->rh_timer);
891
887 spin_lock_irq(&xhci->lock); 892 spin_lock_irq(&xhci->lock);
888 clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); 893 clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
889 clear_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags); 894 clear_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags);
@@ -1069,6 +1074,11 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
1069 if (xhci->quirks & XHCI_COMP_MODE_QUIRK) 1074 if (xhci->quirks & XHCI_COMP_MODE_QUIRK)
1070 compliance_mode_recovery_timer_init(xhci); 1075 compliance_mode_recovery_timer_init(xhci);
1071 1076
1077 /* Re-enable port polling. */
1078 xhci_dbg(xhci, "%s: starting port polling.\n", __func__);
1079 set_bit(HCD_FLAG_POLL_RH, &hcd->flags);
1080 usb_hcd_poll_rh_status(hcd);
1081
1072 return retval; 1082 return retval;
1073} 1083}
1074#endif /* CONFIG_PM */ 1084#endif /* CONFIG_PM */
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
index 7667b12f2ff5..268148de9714 100644
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -2179,7 +2179,7 @@ usbtest_ioctl(struct usb_interface *intf, unsigned int code, void *buf)
2179 if (dev->out_pipe == 0 || !param->length || param->sglen < 4) 2179 if (dev->out_pipe == 0 || !param->length || param->sglen < 4)
2180 break; 2180 break;
2181 retval = 0; 2181 retval = 0;
2182 dev_info(&intf->dev, "TEST 17: unlink from %d queues of " 2182 dev_info(&intf->dev, "TEST 24: unlink from %d queues of "
2183 "%d %d-byte writes\n", 2183 "%d %d-byte writes\n",
2184 param->iterations, param->sglen, param->length); 2184 param->iterations, param->sglen, param->length);
2185 for (i = param->iterations; retval == 0 && i > 0; --i) { 2185 for (i = param->iterations; retval == 0 && i > 0; --i) {
diff --git a/drivers/usb/musb/cppi_dma.c b/drivers/usb/musb/cppi_dma.c
index 0968dd7a859d..f522000e8f06 100644
--- a/drivers/usb/musb/cppi_dma.c
+++ b/drivers/usb/musb/cppi_dma.c
@@ -105,7 +105,7 @@ static void cppi_reset_tx(struct cppi_tx_stateram __iomem *tx, u32 ptr)
105 musb_writel(&tx->tx_complete, 0, ptr); 105 musb_writel(&tx->tx_complete, 0, ptr);
106} 106}
107 107
108static void __init cppi_pool_init(struct cppi *cppi, struct cppi_channel *c) 108static void cppi_pool_init(struct cppi *cppi, struct cppi_channel *c)
109{ 109{
110 int j; 110 int j;
111 111
@@ -150,7 +150,7 @@ static void cppi_pool_free(struct cppi_channel *c)
150 c->last_processed = NULL; 150 c->last_processed = NULL;
151} 151}
152 152
153static int __init cppi_controller_start(struct dma_controller *c) 153static int cppi_controller_start(struct dma_controller *c)
154{ 154{
155 struct cppi *controller; 155 struct cppi *controller;
156 void __iomem *tibase; 156 void __iomem *tibase;
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index f1c6c5470b92..fd3486745e64 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -2298,10 +2298,7 @@ static int __init musb_init(void)
2298 if (usb_disabled()) 2298 if (usb_disabled())
2299 return 0; 2299 return 0;
2300 2300
2301 pr_info("%s: version " MUSB_VERSION ", " 2301 pr_info("%s: version " MUSB_VERSION ", ?dma?, otg (peripheral+host)\n",
2302 "?dma?"
2303 ", "
2304 "otg (peripheral+host)",
2305 musb_driver_name); 2302 musb_driver_name);
2306 return platform_driver_register(&musb_driver); 2303 return platform_driver_register(&musb_driver);
2307} 2304}
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index e6f2ae8368bb..f7d764de6fda 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -134,6 +134,11 @@ static const resource_size_t dsps_control_module_phys[] = {
134 DSPS_AM33XX_CONTROL_MODULE_PHYS_1, 134 DSPS_AM33XX_CONTROL_MODULE_PHYS_1,
135}; 135};
136 136
137#define USBPHY_CM_PWRDN (1 << 0)
138#define USBPHY_OTG_PWRDN (1 << 1)
139#define USBPHY_OTGVDET_EN (1 << 19)
140#define USBPHY_OTGSESSEND_EN (1 << 20)
141
137/** 142/**
138 * musb_dsps_phy_control - phy on/off 143 * musb_dsps_phy_control - phy on/off
139 * @glue: struct dsps_glue * 144 * @glue: struct dsps_glue *
diff --git a/drivers/usb/otg/Kconfig b/drivers/usb/otg/Kconfig
index 6223062d5d1b..37962c99ff1e 100644
--- a/drivers/usb/otg/Kconfig
+++ b/drivers/usb/otg/Kconfig
@@ -110,7 +110,7 @@ config AB8500_USB
110 110
111config FSL_USB2_OTG 111config FSL_USB2_OTG
112 bool "Freescale USB OTG Transceiver Driver" 112 bool "Freescale USB OTG Transceiver Driver"
113 depends on USB_EHCI_FSL && USB_GADGET_FSL_USB2 && USB_SUSPEND 113 depends on USB_EHCI_FSL && USB_FSL_USB2 && USB_SUSPEND
114 select USB_OTG 114 select USB_OTG
115 select USB_OTG_UTILS 115 select USB_OTG_UTILS
116 help 116 help
diff --git a/drivers/usb/otg/mv_otg.c b/drivers/usb/otg/mv_otg.c
index 1dd57504186d..eace975991a8 100644
--- a/drivers/usb/otg/mv_otg.c
+++ b/drivers/usb/otg/mv_otg.c
@@ -240,7 +240,7 @@ static void otg_clock_enable(struct mv_otg *mvotg)
240 unsigned int i; 240 unsigned int i;
241 241
242 for (i = 0; i < mvotg->clknum; i++) 242 for (i = 0; i < mvotg->clknum; i++)
243 clk_enable(mvotg->clk[i]); 243 clk_prepare_enable(mvotg->clk[i]);
244} 244}
245 245
246static void otg_clock_disable(struct mv_otg *mvotg) 246static void otg_clock_disable(struct mv_otg *mvotg)
@@ -248,7 +248,7 @@ static void otg_clock_disable(struct mv_otg *mvotg)
248 unsigned int i; 248 unsigned int i;
249 249
250 for (i = 0; i < mvotg->clknum; i++) 250 for (i = 0; i < mvotg->clknum; i++)
251 clk_disable(mvotg->clk[i]); 251 clk_disable_unprepare(mvotg->clk[i]);
252} 252}
253 253
254static int mv_otg_enable_internal(struct mv_otg *mvotg) 254static int mv_otg_enable_internal(struct mv_otg *mvotg)
diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c
index dd41f61893ef..f2985cd88021 100644
--- a/drivers/usb/renesas_usbhs/mod_gadget.c
+++ b/drivers/usb/renesas_usbhs/mod_gadget.c
@@ -545,15 +545,6 @@ static int usbhsg_pipe_disable(struct usbhsg_uep *uep)
545 return 0; 545 return 0;
546} 546}
547 547
548static void usbhsg_uep_init(struct usbhsg_gpriv *gpriv)
549{
550 int i;
551 struct usbhsg_uep *uep;
552
553 usbhsg_for_each_uep_with_dcp(uep, gpriv, i)
554 uep->pipe = NULL;
555}
556
557/* 548/*
558 * 549 *
559 * usb_ep_ops 550 * usb_ep_ops
@@ -610,7 +601,12 @@ static int usbhsg_ep_disable(struct usb_ep *ep)
610{ 601{
611 struct usbhsg_uep *uep = usbhsg_ep_to_uep(ep); 602 struct usbhsg_uep *uep = usbhsg_ep_to_uep(ep);
612 603
613 return usbhsg_pipe_disable(uep); 604 usbhsg_pipe_disable(uep);
605
606 uep->pipe->mod_private = NULL;
607 uep->pipe = NULL;
608
609 return 0;
614} 610}
615 611
616static struct usb_request *usbhsg_ep_alloc_request(struct usb_ep *ep, 612static struct usb_request *usbhsg_ep_alloc_request(struct usb_ep *ep,
@@ -761,9 +757,8 @@ static int usbhsg_try_start(struct usbhs_priv *priv, u32 status)
761 usbhs_pipe_init(priv, 757 usbhs_pipe_init(priv,
762 usbhsg_dma_map_ctrl); 758 usbhsg_dma_map_ctrl);
763 usbhs_fifo_init(priv); 759 usbhs_fifo_init(priv);
764 usbhsg_uep_init(gpriv);
765 760
766 /* dcp init */ 761 /* dcp init instead of usbhsg_ep_enable() */
767 dcp->pipe = usbhs_dcp_malloc(priv); 762 dcp->pipe = usbhs_dcp_malloc(priv);
768 dcp->pipe->mod_private = dcp; 763 dcp->pipe->mod_private = dcp;
769 usbhs_pipe_config_update(dcp->pipe, 0, 0, 64); 764 usbhs_pipe_config_update(dcp->pipe, 0, 0, 64);
@@ -825,7 +820,7 @@ static int usbhsg_try_stop(struct usbhs_priv *priv, u32 status)
825 usbhs_sys_set_test_mode(priv, 0); 820 usbhs_sys_set_test_mode(priv, 0);
826 usbhs_sys_function_ctrl(priv, 0); 821 usbhs_sys_function_ctrl(priv, 0);
827 822
828 usbhsg_pipe_disable(dcp); 823 usbhsg_ep_disable(&dcp->ep);
829 824
830 dev_dbg(dev, "stop gadget\n"); 825 dev_dbg(dev, "stop gadget\n");
831 826
@@ -998,6 +993,7 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv)
998 */ 993 */
999 usbhsg_for_each_uep_with_dcp(uep, gpriv, i) { 994 usbhsg_for_each_uep_with_dcp(uep, gpriv, i) {
1000 uep->gpriv = gpriv; 995 uep->gpriv = gpriv;
996 uep->pipe = NULL;
1001 snprintf(uep->ep_name, EP_NAME_SIZE, "ep%d", i); 997 snprintf(uep->ep_name, EP_NAME_SIZE, "ep%d", i);
1002 998
1003 uep->ep.name = uep->ep_name; 999 uep->ep.name = uep->ep_name;
diff --git a/drivers/usb/renesas_usbhs/mod_host.c b/drivers/usb/renesas_usbhs/mod_host.c
index 3d3cd6ca2689..b86815421c8d 100644
--- a/drivers/usb/renesas_usbhs/mod_host.c
+++ b/drivers/usb/renesas_usbhs/mod_host.c
@@ -661,9 +661,10 @@ static void usbhsh_queue_done(struct usbhs_priv *priv, struct usbhs_pkt *pkt)
661 status = -ESHUTDOWN; 661 status = -ESHUTDOWN;
662 662
663 urb->actual_length = pkt->actual; 663 urb->actual_length = pkt->actual;
664 usbhsh_ureq_free(hpriv, ureq);
665 664
666 usbhsh_endpoint_sequence_save(hpriv, urb, pkt); 665 usbhsh_endpoint_sequence_save(hpriv, urb, pkt);
666 usbhsh_ureq_free(hpriv, ureq);
667
667 usbhsh_pipe_detach(hpriv, usbhsh_ep_to_uep(urb->ep)); 668 usbhsh_pipe_detach(hpriv, usbhsh_ep_to_uep(urb->ep));
668 669
669 usb_hcd_unlink_urb_from_ep(hcd, urb); 670 usb_hcd_unlink_urb_from_ep(hcd, urb);
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 0a373b3ae96a..ba68835d06a6 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -875,6 +875,8 @@ static struct usb_device_id id_table_combined [] = {
875 { USB_DEVICE(FTDI_VID, FTDI_DISTORTEC_JTAG_LOCK_PICK_PID), 875 { USB_DEVICE(FTDI_VID, FTDI_DISTORTEC_JTAG_LOCK_PICK_PID),
876 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 876 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
877 { USB_DEVICE(FTDI_VID, FTDI_LUMEL_PD12_PID) }, 877 { USB_DEVICE(FTDI_VID, FTDI_LUMEL_PD12_PID) },
878 /* Crucible Devices */
879 { USB_DEVICE(FTDI_VID, FTDI_CT_COMET_PID) },
878 { }, /* Optional parameter entry */ 880 { }, /* Optional parameter entry */
879 { } /* Terminating entry */ 881 { } /* Terminating entry */
880}; 882};
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index 049b6e715fa4..fa5d56038276 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -1259,3 +1259,9 @@
1259 * ATI command output: Cinterion MC55i 1259 * ATI command output: Cinterion MC55i
1260 */ 1260 */
1261#define FTDI_CINTERION_MC55I_PID 0xA951 1261#define FTDI_CINTERION_MC55I_PID 0xA951
1262
1263/*
1264 * Product: Comet Caller ID decoder
1265 * Manufacturer: Crucible Technologies
1266 */
1267#define FTDI_CT_COMET_PID 0x8e08
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index 58184f3de686..82afc4d6a327 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -530,6 +530,9 @@ static void chase_port(struct edgeport_port *port, unsigned long timeout,
530 wait_queue_t wait; 530 wait_queue_t wait;
531 unsigned long flags; 531 unsigned long flags;
532 532
533 if (!tty)
534 return;
535
533 if (!timeout) 536 if (!timeout)
534 timeout = (HZ * EDGE_CLOSING_WAIT)/100; 537 timeout = (HZ * EDGE_CLOSING_WAIT)/100;
535 538
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index e6f87b76c715..0d9dac9e7f93 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -288,6 +288,7 @@ static void option_instat_callback(struct urb *urb);
288#define ALCATEL_VENDOR_ID 0x1bbb 288#define ALCATEL_VENDOR_ID 0x1bbb
289#define ALCATEL_PRODUCT_X060S_X200 0x0000 289#define ALCATEL_PRODUCT_X060S_X200 0x0000
290#define ALCATEL_PRODUCT_X220_X500D 0x0017 290#define ALCATEL_PRODUCT_X220_X500D 0x0017
291#define ALCATEL_PRODUCT_L100V 0x011e
291 292
292#define PIRELLI_VENDOR_ID 0x1266 293#define PIRELLI_VENDOR_ID 0x1266
293#define PIRELLI_PRODUCT_C100_1 0x1002 294#define PIRELLI_PRODUCT_C100_1 0x1002
@@ -429,9 +430,12 @@ static void option_instat_callback(struct urb *urb);
429#define MEDIATEK_VENDOR_ID 0x0e8d 430#define MEDIATEK_VENDOR_ID 0x0e8d
430#define MEDIATEK_PRODUCT_DC_1COM 0x00a0 431#define MEDIATEK_PRODUCT_DC_1COM 0x00a0
431#define MEDIATEK_PRODUCT_DC_4COM 0x00a5 432#define MEDIATEK_PRODUCT_DC_4COM 0x00a5
433#define MEDIATEK_PRODUCT_DC_4COM2 0x00a7
432#define MEDIATEK_PRODUCT_DC_5COM 0x00a4 434#define MEDIATEK_PRODUCT_DC_5COM 0x00a4
433#define MEDIATEK_PRODUCT_7208_1COM 0x7101 435#define MEDIATEK_PRODUCT_7208_1COM 0x7101
434#define MEDIATEK_PRODUCT_7208_2COM 0x7102 436#define MEDIATEK_PRODUCT_7208_2COM 0x7102
437#define MEDIATEK_PRODUCT_7103_2COM 0x7103
438#define MEDIATEK_PRODUCT_7106_2COM 0x7106
435#define MEDIATEK_PRODUCT_FP_1COM 0x0003 439#define MEDIATEK_PRODUCT_FP_1COM 0x0003
436#define MEDIATEK_PRODUCT_FP_2COM 0x0023 440#define MEDIATEK_PRODUCT_FP_2COM 0x0023
437#define MEDIATEK_PRODUCT_FPDC_1COM 0x0043 441#define MEDIATEK_PRODUCT_FPDC_1COM 0x0043
@@ -441,6 +445,14 @@ static void option_instat_callback(struct urb *urb);
441#define CELLIENT_VENDOR_ID 0x2692 445#define CELLIENT_VENDOR_ID 0x2692
442#define CELLIENT_PRODUCT_MEN200 0x9005 446#define CELLIENT_PRODUCT_MEN200 0x9005
443 447
448/* Hyundai Petatel Inc. products */
449#define PETATEL_VENDOR_ID 0x1ff4
450#define PETATEL_PRODUCT_NP10T 0x600e
451
452/* TP-LINK Incorporated products */
453#define TPLINK_VENDOR_ID 0x2357
454#define TPLINK_PRODUCT_MA180 0x0201
455
444/* some devices interfaces need special handling due to a number of reasons */ 456/* some devices interfaces need special handling due to a number of reasons */
445enum option_blacklist_reason { 457enum option_blacklist_reason {
446 OPTION_BLACKLIST_NONE = 0, 458 OPTION_BLACKLIST_NONE = 0,
@@ -922,8 +934,10 @@ static const struct usb_device_id option_ids[] = {
922 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0254, 0xff, 0xff, 0xff) }, 934 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0254, 0xff, 0xff, 0xff) },
923 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0257, 0xff, 0xff, 0xff), /* ZTE MF821 */ 935 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0257, 0xff, 0xff, 0xff), /* ZTE MF821 */
924 .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, 936 .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
925 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0265, 0xff, 0xff, 0xff) }, 937 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0265, 0xff, 0xff, 0xff), /* ONDA MT8205 */
926 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0284, 0xff, 0xff, 0xff) }, 938 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
939 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0284, 0xff, 0xff, 0xff), /* ZTE MF880 */
940 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
927 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0317, 0xff, 0xff, 0xff) }, 941 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0317, 0xff, 0xff, 0xff) },
928 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0326, 0xff, 0xff, 0xff), 942 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0326, 0xff, 0xff, 0xff),
929 .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, 943 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
@@ -1190,6 +1204,8 @@ static const struct usb_device_id option_ids[] = {
1190 .driver_info = (kernel_ulong_t)&alcatel_x200_blacklist 1204 .driver_info = (kernel_ulong_t)&alcatel_x200_blacklist
1191 }, 1205 },
1192 { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X220_X500D) }, 1206 { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X220_X500D) },
1207 { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_L100V),
1208 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1193 { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) }, 1209 { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) },
1194 { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) }, 1210 { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) },
1195 { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14), 1211 { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14),
@@ -1294,7 +1310,14 @@ static const struct usb_device_id option_ids[] = {
1294 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FP_2COM, 0x0a, 0x00, 0x00) }, 1310 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FP_2COM, 0x0a, 0x00, 0x00) },
1295 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FPDC_1COM, 0x0a, 0x00, 0x00) }, 1311 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FPDC_1COM, 0x0a, 0x00, 0x00) },
1296 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FPDC_2COM, 0x0a, 0x00, 0x00) }, 1312 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FPDC_2COM, 0x0a, 0x00, 0x00) },
1313 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_7103_2COM, 0xff, 0x00, 0x00) },
1314 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_7106_2COM, 0x02, 0x02, 0x01) },
1315 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM2, 0xff, 0x02, 0x01) },
1316 { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM2, 0xff, 0x00, 0x00) },
1297 { USB_DEVICE(CELLIENT_VENDOR_ID, CELLIENT_PRODUCT_MEN200) }, 1317 { USB_DEVICE(CELLIENT_VENDOR_ID, CELLIENT_PRODUCT_MEN200) },
1318 { USB_DEVICE(PETATEL_VENDOR_ID, PETATEL_PRODUCT_NP10T) },
1319 { USB_DEVICE(TPLINK_VENDOR_ID, TPLINK_PRODUCT_MA180),
1320 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1298 { } /* Terminating entry */ 1321 { } /* Terminating entry */
1299}; 1322};
1300MODULE_DEVICE_TABLE(usb, option_ids); 1323MODULE_DEVICE_TABLE(usb, option_ids);
diff --git a/drivers/vfio/pci/vfio_pci_rdwr.c b/drivers/vfio/pci/vfio_pci_rdwr.c
index 4362d9e7baa3..f72323ef618f 100644
--- a/drivers/vfio/pci/vfio_pci_rdwr.c
+++ b/drivers/vfio/pci/vfio_pci_rdwr.c
@@ -240,17 +240,17 @@ ssize_t vfio_pci_mem_readwrite(struct vfio_pci_device *vdev, char __user *buf,
240 filled = 1; 240 filled = 1;
241 } else { 241 } else {
242 /* Drop writes, fill reads with FF */ 242 /* Drop writes, fill reads with FF */
243 filled = min((size_t)(x_end - pos), count);
243 if (!iswrite) { 244 if (!iswrite) {
244 char val = 0xFF; 245 char val = 0xFF;
245 size_t i; 246 size_t i;
246 247
247 for (i = 0; i < x_end - pos; i++) { 248 for (i = 0; i < filled; i++) {
248 if (put_user(val, buf + i)) 249 if (put_user(val, buf + i))
249 goto out; 250 goto out;
250 } 251 }
251 } 252 }
252 253
253 filled = x_end - pos;
254 } 254 }
255 255
256 count -= filled; 256 count -= filled;
diff --git a/drivers/video/acornfb.c b/drivers/video/acornfb.c
index b303f1715065..6488a7351a60 100644
--- a/drivers/video/acornfb.c
+++ b/drivers/video/acornfb.c
@@ -66,7 +66,7 @@
66 * have. Allow 1% either way on the nominal for TVs. 66 * have. Allow 1% either way on the nominal for TVs.
67 */ 67 */
68#define NR_MONTYPES 6 68#define NR_MONTYPES 6
69static struct fb_monspecs monspecs[NR_MONTYPES] __devinitdata = { 69static struct fb_monspecs monspecs[NR_MONTYPES] = {
70 { /* TV */ 70 { /* TV */
71 .hfmin = 15469, 71 .hfmin = 15469,
72 .hfmax = 15781, 72 .hfmax = 15781,
@@ -874,7 +874,7 @@ static struct fb_ops acornfb_ops = {
874/* 874/*
875 * Everything after here is initialisation!!! 875 * Everything after here is initialisation!!!
876 */ 876 */
877static struct fb_videomode modedb[] __devinitdata = { 877static struct fb_videomode modedb[] = {
878 { /* 320x256 @ 50Hz */ 878 { /* 320x256 @ 50Hz */
879 NULL, 50, 320, 256, 125000, 92, 62, 35, 19, 38, 2, 879 NULL, 50, 320, 256, 125000, 92, 62, 35, 19, 38, 2,
880 FB_SYNC_COMP_HIGH_ACT, 880 FB_SYNC_COMP_HIGH_ACT,
@@ -926,7 +926,7 @@ static struct fb_videomode modedb[] __devinitdata = {
926 } 926 }
927}; 927};
928 928
929static struct fb_videomode acornfb_default_mode __devinitdata = { 929static struct fb_videomode acornfb_default_mode = {
930 .name = NULL, 930 .name = NULL,
931 .refresh = 60, 931 .refresh = 60,
932 .xres = 640, 932 .xres = 640,
@@ -942,7 +942,7 @@ static struct fb_videomode acornfb_default_mode __devinitdata = {
942 .vmode = FB_VMODE_NONINTERLACED 942 .vmode = FB_VMODE_NONINTERLACED
943}; 943};
944 944
945static void __devinit acornfb_init_fbinfo(void) 945static void acornfb_init_fbinfo(void)
946{ 946{
947 static int first = 1; 947 static int first = 1;
948 948
@@ -1018,7 +1018,7 @@ static void __devinit acornfb_init_fbinfo(void)
1018 * size can optionally be followed by 'M' or 'K' for 1018 * size can optionally be followed by 'M' or 'K' for
1019 * MB or KB respectively. 1019 * MB or KB respectively.
1020 */ 1020 */
1021static void __devinit acornfb_parse_mon(char *opt) 1021static void acornfb_parse_mon(char *opt)
1022{ 1022{
1023 char *p = opt; 1023 char *p = opt;
1024 1024
@@ -1065,7 +1065,7 @@ bad:
1065 current_par.montype = -1; 1065 current_par.montype = -1;
1066} 1066}
1067 1067
1068static void __devinit acornfb_parse_montype(char *opt) 1068static void acornfb_parse_montype(char *opt)
1069{ 1069{
1070 current_par.montype = -2; 1070 current_par.montype = -2;
1071 1071
@@ -1106,7 +1106,7 @@ static void __devinit acornfb_parse_montype(char *opt)
1106 } 1106 }
1107} 1107}
1108 1108
1109static void __devinit acornfb_parse_dram(char *opt) 1109static void acornfb_parse_dram(char *opt)
1110{ 1110{
1111 unsigned int size; 1111 unsigned int size;
1112 1112
@@ -1131,14 +1131,14 @@ static void __devinit acornfb_parse_dram(char *opt)
1131static struct options { 1131static struct options {
1132 char *name; 1132 char *name;
1133 void (*parse)(char *opt); 1133 void (*parse)(char *opt);
1134} opt_table[] __devinitdata = { 1134} opt_table[] = {
1135 { "mon", acornfb_parse_mon }, 1135 { "mon", acornfb_parse_mon },
1136 { "montype", acornfb_parse_montype }, 1136 { "montype", acornfb_parse_montype },
1137 { "dram", acornfb_parse_dram }, 1137 { "dram", acornfb_parse_dram },
1138 { NULL, NULL } 1138 { NULL, NULL }
1139}; 1139};
1140 1140
1141static int __devinit acornfb_setup(char *options) 1141static int acornfb_setup(char *options)
1142{ 1142{
1143 struct options *optp; 1143 struct options *optp;
1144 char *opt; 1144 char *opt;
@@ -1175,7 +1175,7 @@ static int __devinit acornfb_setup(char *options)
1175 * Detect type of monitor connected 1175 * Detect type of monitor connected
1176 * For now, we just assume SVGA 1176 * For now, we just assume SVGA
1177 */ 1177 */
1178static int __devinit acornfb_detect_monitortype(void) 1178static int acornfb_detect_monitortype(void)
1179{ 1179{
1180 return 4; 1180 return 4;
1181} 1181}
@@ -1216,7 +1216,7 @@ free_unused_pages(unsigned int virtual_start, unsigned int virtual_end)
1216 printk("acornfb: freed %dK memory\n", mb_freed); 1216 printk("acornfb: freed %dK memory\n", mb_freed);
1217} 1217}
1218 1218
1219static int __devinit acornfb_probe(struct platform_device *dev) 1219static int acornfb_probe(struct platform_device *dev)
1220{ 1220{
1221 unsigned long size; 1221 unsigned long size;
1222 u_int h_sync, v_sync; 1222 u_int h_sync, v_sync;
diff --git a/drivers/video/arcfb.c b/drivers/video/arcfb.c
index 4659d5da6ff8..e43401afdd03 100644
--- a/drivers/video/arcfb.c
+++ b/drivers/video/arcfb.c
@@ -79,7 +79,7 @@ struct arcfb_par {
79 spinlock_t lock; 79 spinlock_t lock;
80}; 80};
81 81
82static struct fb_fix_screeninfo arcfb_fix __devinitdata = { 82static struct fb_fix_screeninfo arcfb_fix = {
83 .id = "arcfb", 83 .id = "arcfb",
84 .type = FB_TYPE_PACKED_PIXELS, 84 .type = FB_TYPE_PACKED_PIXELS,
85 .visual = FB_VISUAL_MONO01, 85 .visual = FB_VISUAL_MONO01,
@@ -89,7 +89,7 @@ static struct fb_fix_screeninfo arcfb_fix __devinitdata = {
89 .accel = FB_ACCEL_NONE, 89 .accel = FB_ACCEL_NONE,
90}; 90};
91 91
92static struct fb_var_screeninfo arcfb_var __devinitdata = { 92static struct fb_var_screeninfo arcfb_var = {
93 .xres = 128, 93 .xres = 128,
94 .yres = 64, 94 .yres = 64,
95 .xres_virtual = 128, 95 .xres_virtual = 128,
@@ -502,7 +502,7 @@ static struct fb_ops arcfb_ops = {
502 .fb_ioctl = arcfb_ioctl, 502 .fb_ioctl = arcfb_ioctl,
503}; 503};
504 504
505static int __devinit arcfb_probe(struct platform_device *dev) 505static int arcfb_probe(struct platform_device *dev)
506{ 506{
507 struct fb_info *info; 507 struct fb_info *info;
508 int retval = -ENOMEM; 508 int retval = -ENOMEM;
@@ -587,7 +587,7 @@ err:
587 return retval; 587 return retval;
588} 588}
589 589
590static int __devexit arcfb_remove(struct platform_device *dev) 590static int arcfb_remove(struct platform_device *dev)
591{ 591{
592 struct fb_info *info = platform_get_drvdata(dev); 592 struct fb_info *info = platform_get_drvdata(dev);
593 593
@@ -601,7 +601,7 @@ static int __devexit arcfb_remove(struct platform_device *dev)
601 601
602static struct platform_driver arcfb_driver = { 602static struct platform_driver arcfb_driver = {
603 .probe = arcfb_probe, 603 .probe = arcfb_probe,
604 .remove = __devexit_p(arcfb_remove), 604 .remove = arcfb_remove,
605 .driver = { 605 .driver = {
606 .name = "arcfb", 606 .name = "arcfb",
607 }, 607 },
diff --git a/drivers/video/arkfb.c b/drivers/video/arkfb.c
index 555dd4c64f5b..94a51f1ef904 100644
--- a/drivers/video/arkfb.c
+++ b/drivers/video/arkfb.c
@@ -100,7 +100,7 @@ static const struct svga_timing_regs ark_timing_regs = {
100 100
101/* Module parameters */ 101/* Module parameters */
102 102
103static char *mode_option __devinitdata = "640x480-8@60"; 103static char *mode_option = "640x480-8@60";
104 104
105#ifdef CONFIG_MTRR 105#ifdef CONFIG_MTRR
106static int mtrr = 1; 106static int mtrr = 1;
@@ -950,7 +950,7 @@ static struct fb_ops arkfb_ops = {
950 950
951 951
952/* PCI probe */ 952/* PCI probe */
953static int __devinit ark_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) 953static int ark_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
954{ 954{
955 struct pci_bus_region bus_reg; 955 struct pci_bus_region bus_reg;
956 struct resource vga_res; 956 struct resource vga_res;
@@ -1086,7 +1086,7 @@ err_enable_device:
1086 1086
1087/* PCI remove */ 1087/* PCI remove */
1088 1088
1089static void __devexit ark_pci_remove(struct pci_dev *dev) 1089static void ark_pci_remove(struct pci_dev *dev)
1090{ 1090{
1091 struct fb_info *info = pci_get_drvdata(dev); 1091 struct fb_info *info = pci_get_drvdata(dev);
1092 1092
@@ -1184,7 +1184,7 @@ fail:
1184 1184
1185/* List of boards that we are trying to support */ 1185/* List of boards that we are trying to support */
1186 1186
1187static struct pci_device_id ark_devices[] __devinitdata = { 1187static struct pci_device_id ark_devices[] = {
1188 {PCI_DEVICE(0xEDD8, 0xA099)}, 1188 {PCI_DEVICE(0xEDD8, 0xA099)},
1189 {0, 0, 0, 0, 0, 0, 0} 1189 {0, 0, 0, 0, 0, 0, 0}
1190}; 1190};
@@ -1196,7 +1196,7 @@ static struct pci_driver arkfb_pci_driver = {
1196 .name = "arkfb", 1196 .name = "arkfb",
1197 .id_table = ark_devices, 1197 .id_table = ark_devices,
1198 .probe = ark_pci_probe, 1198 .probe = ark_pci_probe,
1199 .remove = __devexit_p(ark_pci_remove), 1199 .remove = ark_pci_remove,
1200 .suspend = ark_pci_suspend, 1200 .suspend = ark_pci_suspend,
1201 .resume = ark_pci_resume, 1201 .resume = ark_pci_resume,
1202}; 1202};
diff --git a/drivers/video/asiliantfb.c b/drivers/video/asiliantfb.c
index 8cdf88e20b4b..d5a37d62847b 100644
--- a/drivers/video/asiliantfb.c
+++ b/drivers/video/asiliantfb.c
@@ -451,7 +451,7 @@ static struct chips_init_reg chips_init_xr[] =
451 {0xd1, 0x01}, 451 {0xd1, 0x01},
452}; 452};
453 453
454static void __devinit chips_hw_init(struct fb_info *p) 454static void chips_hw_init(struct fb_info *p)
455{ 455{
456 int i; 456 int i;
457 457
@@ -474,7 +474,7 @@ static void __devinit chips_hw_init(struct fb_info *p)
474 write_fr(chips_init_fr[i].addr, chips_init_fr[i].data); 474 write_fr(chips_init_fr[i].addr, chips_init_fr[i].data);
475} 475}
476 476
477static struct fb_fix_screeninfo asiliantfb_fix __devinitdata = { 477static struct fb_fix_screeninfo asiliantfb_fix = {
478 .id = "Asiliant 69000", 478 .id = "Asiliant 69000",
479 .type = FB_TYPE_PACKED_PIXELS, 479 .type = FB_TYPE_PACKED_PIXELS,
480 .visual = FB_VISUAL_PSEUDOCOLOR, 480 .visual = FB_VISUAL_PSEUDOCOLOR,
@@ -483,7 +483,7 @@ static struct fb_fix_screeninfo asiliantfb_fix __devinitdata = {
483 .smem_len = 0x200000, /* 2MB */ 483 .smem_len = 0x200000, /* 2MB */
484}; 484};
485 485
486static struct fb_var_screeninfo asiliantfb_var __devinitdata = { 486static struct fb_var_screeninfo asiliantfb_var = {
487 .xres = 640, 487 .xres = 640,
488 .yres = 480, 488 .yres = 480,
489 .xres_virtual = 640, 489 .xres_virtual = 640,
@@ -504,7 +504,7 @@ static struct fb_var_screeninfo asiliantfb_var __devinitdata = {
504 .vsync_len = 2, 504 .vsync_len = 2,
505}; 505};
506 506
507static int __devinit init_asiliant(struct fb_info *p, unsigned long addr) 507static int init_asiliant(struct fb_info *p, unsigned long addr)
508{ 508{
509 int err; 509 int err;
510 510
@@ -535,8 +535,8 @@ static int __devinit init_asiliant(struct fb_info *p, unsigned long addr)
535 return 0; 535 return 0;
536} 536}
537 537
538static int __devinit 538static int asiliantfb_pci_init(struct pci_dev *dp,
539asiliantfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent) 539 const struct pci_device_id *ent)
540{ 540{
541 unsigned long addr, size; 541 unsigned long addr, size;
542 struct fb_info *p; 542 struct fb_info *p;
@@ -581,7 +581,7 @@ asiliantfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent)
581 return 0; 581 return 0;
582} 582}
583 583
584static void __devexit asiliantfb_remove(struct pci_dev *dp) 584static void asiliantfb_remove(struct pci_dev *dp)
585{ 585{
586 struct fb_info *p = pci_get_drvdata(dp); 586 struct fb_info *p = pci_get_drvdata(dp);
587 587
@@ -593,7 +593,7 @@ static void __devexit asiliantfb_remove(struct pci_dev *dp)
593 framebuffer_release(p); 593 framebuffer_release(p);
594} 594}
595 595
596static struct pci_device_id asiliantfb_pci_tbl[] __devinitdata = { 596static struct pci_device_id asiliantfb_pci_tbl[] = {
597 { PCI_VENDOR_ID_CT, PCI_DEVICE_ID_CT_69000, PCI_ANY_ID, PCI_ANY_ID }, 597 { PCI_VENDOR_ID_CT, PCI_DEVICE_ID_CT_69000, PCI_ANY_ID, PCI_ANY_ID },
598 { 0 } 598 { 0 }
599}; 599};
@@ -604,7 +604,7 @@ static struct pci_driver asiliantfb_driver = {
604 .name = "asiliantfb", 604 .name = "asiliantfb",
605 .id_table = asiliantfb_pci_tbl, 605 .id_table = asiliantfb_pci_tbl,
606 .probe = asiliantfb_pci_init, 606 .probe = asiliantfb_pci_init,
607 .remove = __devexit_p(asiliantfb_remove), 607 .remove = asiliantfb_remove,
608}; 608};
609 609
610static int __init asiliantfb_init(void) 610static int __init asiliantfb_init(void)
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c
index 0fefa84ed9ae..8c55011313dc 100644
--- a/drivers/video/aty/aty128fb.c
+++ b/drivers/video/aty/aty128fb.c
@@ -98,7 +98,7 @@
98 98
99#ifndef CONFIG_PPC_PMAC 99#ifndef CONFIG_PPC_PMAC
100/* default mode */ 100/* default mode */
101static struct fb_var_screeninfo default_var __devinitdata = { 101static struct fb_var_screeninfo default_var = {
102 /* 640x480, 60 Hz, Non-Interlaced (25.175 MHz dotclock) */ 102 /* 640x480, 60 Hz, Non-Interlaced (25.175 MHz dotclock) */
103 640, 480, 640, 480, 0, 0, 8, 0, 103 640, 480, 640, 480, 0, 0, 8, 0,
104 {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0}, 104 {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0},
@@ -121,7 +121,7 @@ static struct fb_var_screeninfo default_var = {
121 121
122/* default modedb mode */ 122/* default modedb mode */
123/* 640x480, 60 Hz, Non-Interlaced (25.172 MHz dotclock) */ 123/* 640x480, 60 Hz, Non-Interlaced (25.172 MHz dotclock) */
124static struct fb_videomode defaultmode __devinitdata = { 124static struct fb_videomode defaultmode = {
125 .refresh = 60, 125 .refresh = 60,
126 .xres = 640, 126 .xres = 640,
127 .yres = 480, 127 .yres = 480,
@@ -149,7 +149,7 @@ enum {
149}; 149};
150 150
151/* Must match above enum */ 151/* Must match above enum */
152static char * const r128_family[] __devinitconst = { 152static char * const r128_family[] = {
153 "AGP", 153 "AGP",
154 "PCI", 154 "PCI",
155 "PRO AGP", 155 "PRO AGP",
@@ -275,7 +275,7 @@ static struct pci_driver aty128fb_driver = {
275 .name = "aty128fb", 275 .name = "aty128fb",
276 .id_table = aty128_pci_tbl, 276 .id_table = aty128_pci_tbl,
277 .probe = aty128_probe, 277 .probe = aty128_probe,
278 .remove = __devexit_p(aty128_remove), 278 .remove = aty128_remove,
279 .suspend = aty128_pci_suspend, 279 .suspend = aty128_pci_suspend,
280 .resume = aty128_pci_resume, 280 .resume = aty128_pci_resume,
281}; 281};
@@ -333,7 +333,7 @@ static const struct aty128_meminfo sdr_sgram =
333static const struct aty128_meminfo ddr_sgram = 333static const struct aty128_meminfo ddr_sgram =
334 { 4, 4, 3, 3, 2, 3, 1, 16, 31, 16, "64-bit DDR SGRAM" }; 334 { 4, 4, 3, 3, 2, 3, 1, 16, 31, 16, "64-bit DDR SGRAM" };
335 335
336static struct fb_fix_screeninfo aty128fb_fix __devinitdata = { 336static struct fb_fix_screeninfo aty128fb_fix = {
337 .id = "ATY Rage128", 337 .id = "ATY Rage128",
338 .type = FB_TYPE_PACKED_PIXELS, 338 .type = FB_TYPE_PACKED_PIXELS,
339 .visual = FB_VISUAL_PSEUDOCOLOR, 339 .visual = FB_VISUAL_PSEUDOCOLOR,
@@ -343,24 +343,24 @@ static struct fb_fix_screeninfo aty128fb_fix __devinitdata = {
343 .accel = FB_ACCEL_ATI_RAGE128, 343 .accel = FB_ACCEL_ATI_RAGE128,
344}; 344};
345 345
346static char *mode_option __devinitdata = NULL; 346static char *mode_option = NULL;
347 347
348#ifdef CONFIG_PPC_PMAC 348#ifdef CONFIG_PPC_PMAC
349static int default_vmode __devinitdata = VMODE_1024_768_60; 349static int default_vmode = VMODE_1024_768_60;
350static int default_cmode __devinitdata = CMODE_8; 350static int default_cmode = CMODE_8;
351#endif 351#endif
352 352
353static int default_crt_on __devinitdata = 0; 353static int default_crt_on = 0;
354static int default_lcd_on __devinitdata = 1; 354static int default_lcd_on = 1;
355 355
356#ifdef CONFIG_MTRR 356#ifdef CONFIG_MTRR
357static bool mtrr = true; 357static bool mtrr = true;
358#endif 358#endif
359 359
360#ifdef CONFIG_PMAC_BACKLIGHT 360#ifdef CONFIG_PMAC_BACKLIGHT
361static int backlight __devinitdata = 1; 361static int backlight = 1;
362#else 362#else
363static int backlight __devinitdata = 0; 363static int backlight = 0;
364#endif 364#endif
365 365
366/* PLL constants */ 366/* PLL constants */
@@ -449,10 +449,9 @@ static int aty128_encode_var(struct fb_var_screeninfo *var,
449static int aty128_decode_var(struct fb_var_screeninfo *var, 449static int aty128_decode_var(struct fb_var_screeninfo *var,
450 struct aty128fb_par *par); 450 struct aty128fb_par *par);
451#if 0 451#if 0
452static void __devinit aty128_get_pllinfo(struct aty128fb_par *par, 452static void aty128_get_pllinfo(struct aty128fb_par *par, void __iomem *bios);
453 void __iomem *bios); 453static void __iomem *aty128_map_ROM(struct pci_dev *pdev,
454static void __devinit __iomem *aty128_map_ROM(struct pci_dev *pdev, 454 const struct aty128fb_par *par);
455 const struct aty128fb_par *par);
456#endif 455#endif
457static void aty128_timings(struct aty128fb_par *par); 456static void aty128_timings(struct aty128fb_par *par);
458static void aty128_init_engine(struct aty128fb_par *par); 457static void aty128_init_engine(struct aty128fb_par *par);
@@ -582,7 +581,7 @@ static void aty_pll_writeupdate(const struct aty128fb_par *par)
582 581
583 582
584/* write to the scratch register to test r/w functionality */ 583/* write to the scratch register to test r/w functionality */
585static int __devinit register_test(const struct aty128fb_par *par) 584static int register_test(const struct aty128fb_par *par)
586{ 585{
587 u32 val; 586 u32 val;
588 int flag = 0; 587 int flag = 0;
@@ -781,8 +780,8 @@ static u32 depth_to_dst(u32 depth)
781 780
782 781
783#ifndef __sparc__ 782#ifndef __sparc__
784static void __iomem * __devinit aty128_map_ROM(const struct aty128fb_par *par, 783static void __iomem *aty128_map_ROM(const struct aty128fb_par *par,
785 struct pci_dev *dev) 784 struct pci_dev *dev)
786{ 785{
787 u16 dptr; 786 u16 dptr;
788 u8 rom_type; 787 u8 rom_type;
@@ -868,8 +867,8 @@ static void __iomem * __devinit aty128_map_ROM(const struct aty128fb_par *par,
868 return NULL; 867 return NULL;
869} 868}
870 869
871static void __devinit aty128_get_pllinfo(struct aty128fb_par *par, 870static void aty128_get_pllinfo(struct aty128fb_par *par,
872 unsigned char __iomem *bios) 871 unsigned char __iomem *bios)
873{ 872{
874 unsigned int bios_hdr; 873 unsigned int bios_hdr;
875 unsigned int bios_pll; 874 unsigned int bios_pll;
@@ -891,7 +890,7 @@ static void __devinit aty128_get_pllinfo(struct aty128fb_par *par,
891} 890}
892 891
893#ifdef CONFIG_X86 892#ifdef CONFIG_X86
894static void __iomem * __devinit aty128_find_mem_vbios(struct aty128fb_par *par) 893static void __iomem *aty128_find_mem_vbios(struct aty128fb_par *par)
895{ 894{
896 /* I simplified this code as we used to miss the signatures in 895 /* I simplified this code as we used to miss the signatures in
897 * a lot of case. It's now closer to XFree, we just don't check 896 * a lot of case. It's now closer to XFree, we just don't check
@@ -916,7 +915,7 @@ static void __iomem * __devinit aty128_find_mem_vbios(struct aty128fb_par *par)
916#endif /* ndef(__sparc__) */ 915#endif /* ndef(__sparc__) */
917 916
918/* fill in known card constants if pll_block is not available */ 917/* fill in known card constants if pll_block is not available */
919static void __devinit aty128_timings(struct aty128fb_par *par) 918static void aty128_timings(struct aty128fb_par *par)
920{ 919{
921#ifdef CONFIG_PPC_OF 920#ifdef CONFIG_PPC_OF
922 /* instead of a table lookup, assume OF has properly 921 /* instead of a table lookup, assume OF has properly
@@ -1658,7 +1657,7 @@ static int aty128fb_sync(struct fb_info *info)
1658} 1657}
1659 1658
1660#ifndef MODULE 1659#ifndef MODULE
1661static int __devinit aty128fb_setup(char *options) 1660static int aty128fb_setup(char *options)
1662{ 1661{
1663 char *this_opt; 1662 char *this_opt;
1664 1663
@@ -1888,8 +1887,7 @@ static void aty128_early_resume(void *data)
1888} 1887}
1889#endif /* CONFIG_PPC_PMAC */ 1888#endif /* CONFIG_PPC_PMAC */
1890 1889
1891static int __devinit aty128_init(struct pci_dev *pdev, 1890static int aty128_init(struct pci_dev *pdev, const struct pci_device_id *ent)
1892 const struct pci_device_id *ent)
1893{ 1891{
1894 struct fb_info *info = pci_get_drvdata(pdev); 1892 struct fb_info *info = pci_get_drvdata(pdev);
1895 struct aty128fb_par *par = info->par; 1893 struct aty128fb_par *par = info->par;
@@ -2039,8 +2037,7 @@ static int __devinit aty128_init(struct pci_dev *pdev,
2039 2037
2040#ifdef CONFIG_PCI 2038#ifdef CONFIG_PCI
2041/* register a card ++ajoshi */ 2039/* register a card ++ajoshi */
2042static int __devinit aty128_probe(struct pci_dev *pdev, 2040static int aty128_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2043 const struct pci_device_id *ent)
2044{ 2041{
2045 unsigned long fb_addr, reg_addr; 2042 unsigned long fb_addr, reg_addr;
2046 struct aty128fb_par *par; 2043 struct aty128fb_par *par;
@@ -2156,7 +2153,7 @@ err_free_fb:
2156 return -ENODEV; 2153 return -ENODEV;
2157} 2154}
2158 2155
2159static void __devexit aty128_remove(struct pci_dev *pdev) 2156static void aty128_remove(struct pci_dev *pdev)
2160{ 2157{
2161 struct fb_info *info = pci_get_drvdata(pdev); 2158 struct fb_info *info = pci_get_drvdata(pdev);
2162 struct aty128fb_par *par; 2159 struct aty128fb_par *par;
@@ -2558,7 +2555,7 @@ static int aty128_pci_resume(struct pci_dev *pdev)
2558} 2555}
2559 2556
2560 2557
2561static int __devinit aty128fb_init(void) 2558static int aty128fb_init(void)
2562{ 2559{
2563#ifndef MODULE 2560#ifndef MODULE
2564 char *option = NULL; 2561 char *option = NULL;
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index 868932f904ef..4f27fdc58d84 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -214,7 +214,7 @@ struct pci_mmap_map {
214 unsigned long prot_mask; 214 unsigned long prot_mask;
215}; 215};
216 216
217static struct fb_fix_screeninfo atyfb_fix __devinitdata = { 217static struct fb_fix_screeninfo atyfb_fix = {
218 .id = "ATY Mach64", 218 .id = "ATY Mach64",
219 .type = FB_TYPE_PACKED_PIXELS, 219 .type = FB_TYPE_PACKED_PIXELS,
220 .visual = FB_VISUAL_PSEUDOCOLOR, 220 .visual = FB_VISUAL_PSEUDOCOLOR,
@@ -309,18 +309,18 @@ static int vram;
309static int pll; 309static int pll;
310static int mclk; 310static int mclk;
311static int xclk; 311static int xclk;
312static int comp_sync __devinitdata = -1; 312static int comp_sync = -1;
313static char *mode; 313static char *mode;
314 314
315#ifdef CONFIG_PMAC_BACKLIGHT 315#ifdef CONFIG_PMAC_BACKLIGHT
316static int backlight __devinitdata = 1; 316static int backlight = 1;
317#else 317#else
318static int backlight __devinitdata = 0; 318static int backlight = 0;
319#endif 319#endif
320 320
321#ifdef CONFIG_PPC 321#ifdef CONFIG_PPC
322static int default_vmode __devinitdata = VMODE_CHOOSE; 322static int default_vmode = VMODE_CHOOSE;
323static int default_cmode __devinitdata = CMODE_CHOOSE; 323static int default_cmode = CMODE_CHOOSE;
324 324
325module_param_named(vmode, default_vmode, int, 0); 325module_param_named(vmode, default_vmode, int, 0);
326MODULE_PARM_DESC(vmode, "int: video mode for mac"); 326MODULE_PARM_DESC(vmode, "int: video mode for mac");
@@ -329,10 +329,10 @@ MODULE_PARM_DESC(cmode, "int: color mode for mac");
329#endif 329#endif
330 330
331#ifdef CONFIG_ATARI 331#ifdef CONFIG_ATARI
332static unsigned int mach64_count __devinitdata = 0; 332static unsigned int mach64_count = 0;
333static unsigned long phys_vmembase[FB_MAX] __devinitdata = { 0, }; 333static unsigned long phys_vmembase[FB_MAX] = { 0, };
334static unsigned long phys_size[FB_MAX] __devinitdata = { 0, }; 334static unsigned long phys_size[FB_MAX] = { 0, };
335static unsigned long phys_guiregbase[FB_MAX] __devinitdata = { 0, }; 335static unsigned long phys_guiregbase[FB_MAX] = { 0, };
336#endif 336#endif
337 337
338/* top -> down is an evolution of mach64 chipset, any corrections? */ 338/* top -> down is an evolution of mach64 chipset, any corrections? */
@@ -371,7 +371,7 @@ static struct {
371 const char *name; 371 const char *name;
372 int pll, mclk, xclk, ecp_max; 372 int pll, mclk, xclk, ecp_max;
373 u32 features; 373 u32 features;
374} aty_chips[] __devinitdata = { 374} aty_chips[] = {
375#ifdef CONFIG_FB_ATY_GX 375#ifdef CONFIG_FB_ATY_GX
376 /* Mach64 GX */ 376 /* Mach64 GX */
377 { PCI_CHIP_MACH64GX, "ATI888GX00 (Mach64 GX)", 135, 50, 50, 0, ATI_CHIP_88800GX }, 377 { PCI_CHIP_MACH64GX, "ATI888GX00 (Mach64 GX)", 135, 50, 50, 0, ATI_CHIP_88800GX },
@@ -426,7 +426,7 @@ static struct {
426#endif /* CONFIG_FB_ATY_CT */ 426#endif /* CONFIG_FB_ATY_CT */
427}; 427};
428 428
429static int __devinit correct_chipset(struct atyfb_par *par) 429static int correct_chipset(struct atyfb_par *par)
430{ 430{
431 u8 rev; 431 u8 rev;
432 u16 type; 432 u16 type;
@@ -531,34 +531,34 @@ static int __devinit correct_chipset(struct atyfb_par *par)
531 return 0; 531 return 0;
532} 532}
533 533
534static char ram_dram[] __devinitdata = "DRAM"; 534static char ram_dram[] = "DRAM";
535static char ram_resv[] __devinitdata = "RESV"; 535static char ram_resv[] = "RESV";
536#ifdef CONFIG_FB_ATY_GX 536#ifdef CONFIG_FB_ATY_GX
537static char ram_vram[] __devinitdata = "VRAM"; 537static char ram_vram[] = "VRAM";
538#endif /* CONFIG_FB_ATY_GX */ 538#endif /* CONFIG_FB_ATY_GX */
539#ifdef CONFIG_FB_ATY_CT 539#ifdef CONFIG_FB_ATY_CT
540static char ram_edo[] __devinitdata = "EDO"; 540static char ram_edo[] = "EDO";
541static char ram_sdram[] __devinitdata = "SDRAM (1:1)"; 541static char ram_sdram[] = "SDRAM (1:1)";
542static char ram_sgram[] __devinitdata = "SGRAM (1:1)"; 542static char ram_sgram[] = "SGRAM (1:1)";
543static char ram_sdram32[] __devinitdata = "SDRAM (2:1) (32-bit)"; 543static char ram_sdram32[] = "SDRAM (2:1) (32-bit)";
544static char ram_wram[] __devinitdata = "WRAM"; 544static char ram_wram[] = "WRAM";
545static char ram_off[] __devinitdata = "OFF"; 545static char ram_off[] = "OFF";
546#endif /* CONFIG_FB_ATY_CT */ 546#endif /* CONFIG_FB_ATY_CT */
547 547
548 548
549#ifdef CONFIG_FB_ATY_GX 549#ifdef CONFIG_FB_ATY_GX
550static char *aty_gx_ram[8] __devinitdata = { 550static char *aty_gx_ram[8] = {
551 ram_dram, ram_vram, ram_vram, ram_dram, 551 ram_dram, ram_vram, ram_vram, ram_dram,
552 ram_dram, ram_vram, ram_vram, ram_resv 552 ram_dram, ram_vram, ram_vram, ram_resv
553}; 553};
554#endif /* CONFIG_FB_ATY_GX */ 554#endif /* CONFIG_FB_ATY_GX */
555 555
556#ifdef CONFIG_FB_ATY_CT 556#ifdef CONFIG_FB_ATY_CT
557static char *aty_ct_ram[8] __devinitdata = { 557static char *aty_ct_ram[8] = {
558 ram_off, ram_dram, ram_edo, ram_edo, 558 ram_off, ram_dram, ram_edo, ram_edo,
559 ram_sdram, ram_sgram, ram_wram, ram_resv 559 ram_sdram, ram_sgram, ram_wram, ram_resv
560}; 560};
561static char *aty_xl_ram[8] __devinitdata = { 561static char *aty_xl_ram[8] = {
562 ram_off, ram_dram, ram_edo, ram_edo, 562 ram_off, ram_dram, ram_edo, ram_edo,
563 ram_sdram, ram_sgram, ram_sdram32, ram_resv 563 ram_sdram, ram_sgram, ram_sdram32, ram_resv
564}; 564};
@@ -588,7 +588,7 @@ static u32 atyfb_get_pixclock(struct fb_var_screeninfo *var,
588 * Apple monitor sense 588 * Apple monitor sense
589 */ 589 */
590 590
591static int __devinit read_aty_sense(const struct atyfb_par *par) 591static int read_aty_sense(const struct atyfb_par *par)
592{ 592{
593 int sense, i; 593 int sense, i;
594 594
@@ -2273,7 +2273,7 @@ static void aty_bl_exit(struct backlight_device *bd)
2273 2273
2274#endif /* CONFIG_FB_ATY_BACKLIGHT */ 2274#endif /* CONFIG_FB_ATY_BACKLIGHT */
2275 2275
2276static void __devinit aty_calc_mem_refresh(struct atyfb_par *par, int xclk) 2276static void aty_calc_mem_refresh(struct atyfb_par *par, int xclk)
2277{ 2277{
2278 const int ragepro_tbl[] = { 2278 const int ragepro_tbl[] = {
2279 44, 50, 55, 66, 75, 80, 100 2279 44, 50, 55, 66, 75, 80, 100
@@ -2307,8 +2307,8 @@ static void __devinit aty_calc_mem_refresh(struct atyfb_par *par, int xclk)
2307static struct fb_info *fb_list = NULL; 2307static struct fb_info *fb_list = NULL;
2308 2308
2309#if defined(__i386__) && defined(CONFIG_FB_ATY_GENERIC_LCD) 2309#if defined(__i386__) && defined(CONFIG_FB_ATY_GENERIC_LCD)
2310static int __devinit atyfb_get_timings_from_lcd(struct atyfb_par *par, 2310static int atyfb_get_timings_from_lcd(struct atyfb_par *par,
2311 struct fb_var_screeninfo *var) 2311 struct fb_var_screeninfo *var)
2312{ 2312{
2313 int ret = -EINVAL; 2313 int ret = -EINVAL;
2314 2314
@@ -2333,7 +2333,7 @@ static int __devinit atyfb_get_timings_from_lcd(struct atyfb_par *par,
2333} 2333}
2334#endif /* defined(__i386__) && defined(CONFIG_FB_ATY_GENERIC_LCD) */ 2334#endif /* defined(__i386__) && defined(CONFIG_FB_ATY_GENERIC_LCD) */
2335 2335
2336static int __devinit aty_init(struct fb_info *info) 2336static int aty_init(struct fb_info *info)
2337{ 2337{
2338 struct atyfb_par *par = (struct atyfb_par *) info->par; 2338 struct atyfb_par *par = (struct atyfb_par *) info->par;
2339 const char *ramname = NULL, *xtal; 2339 const char *ramname = NULL, *xtal;
@@ -2787,7 +2787,7 @@ aty_init_exit:
2787} 2787}
2788 2788
2789#if defined(CONFIG_ATARI) && !defined(MODULE) 2789#if defined(CONFIG_ATARI) && !defined(MODULE)
2790static int __devinit store_video_par(char *video_str, unsigned char m64_num) 2790static int store_video_par(char *video_str, unsigned char m64_num)
2791{ 2791{
2792 char *p; 2792 char *p;
2793 unsigned long vmembase, size, guiregbase; 2793 unsigned long vmembase, size, guiregbase;
@@ -2961,9 +2961,8 @@ static int atyfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
2961 2961
2962#ifdef __sparc__ 2962#ifdef __sparc__
2963 2963
2964static int __devinit atyfb_setup_sparc(struct pci_dev *pdev, 2964static int atyfb_setup_sparc(struct pci_dev *pdev, struct fb_info *info,
2965 struct fb_info *info, 2965 unsigned long addr)
2966 unsigned long addr)
2967{ 2966{
2968 struct atyfb_par *par = info->par; 2967 struct atyfb_par *par = info->par;
2969 struct device_node *dp; 2968 struct device_node *dp;
@@ -3161,7 +3160,7 @@ static int __devinit atyfb_setup_sparc(struct pci_dev *pdev,
3161 3160
3162#ifdef __i386__ 3161#ifdef __i386__
3163#ifdef CONFIG_FB_ATY_GENERIC_LCD 3162#ifdef CONFIG_FB_ATY_GENERIC_LCD
3164static void __devinit aty_init_lcd(struct atyfb_par *par, u32 bios_base) 3163static void aty_init_lcd(struct atyfb_par *par, u32 bios_base)
3165{ 3164{
3166 u32 driv_inf_tab, sig; 3165 u32 driv_inf_tab, sig;
3167 u16 lcd_ofs; 3166 u16 lcd_ofs;
@@ -3392,7 +3391,7 @@ static void __devinit aty_init_lcd(struct atyfb_par *par, u32 bios_base)
3392} 3391}
3393#endif /* CONFIG_FB_ATY_GENERIC_LCD */ 3392#endif /* CONFIG_FB_ATY_GENERIC_LCD */
3394 3393
3395static int __devinit init_from_bios(struct atyfb_par *par) 3394static int init_from_bios(struct atyfb_par *par)
3396{ 3395{
3397 u32 bios_base, rom_addr; 3396 u32 bios_base, rom_addr;
3398 int ret; 3397 int ret;
@@ -3445,9 +3444,8 @@ static int __devinit init_from_bios(struct atyfb_par *par)
3445} 3444}
3446#endif /* __i386__ */ 3445#endif /* __i386__ */
3447 3446
3448static int __devinit atyfb_setup_generic(struct pci_dev *pdev, 3447static int atyfb_setup_generic(struct pci_dev *pdev, struct fb_info *info,
3449 struct fb_info *info, 3448 unsigned long addr)
3450 unsigned long addr)
3451{ 3449{
3452 struct atyfb_par *par = info->par; 3450 struct atyfb_par *par = info->par;
3453 u16 tmp; 3451 u16 tmp;
@@ -3525,8 +3523,8 @@ atyfb_setup_generic_fail:
3525 3523
3526#endif /* !__sparc__ */ 3524#endif /* !__sparc__ */
3527 3525
3528static int __devinit atyfb_pci_probe(struct pci_dev *pdev, 3526static int atyfb_pci_probe(struct pci_dev *pdev,
3529 const struct pci_device_id *ent) 3527 const struct pci_device_id *ent)
3530{ 3528{
3531 unsigned long addr, res_start, res_size; 3529 unsigned long addr, res_start, res_size;
3532 struct fb_info *info; 3530 struct fb_info *info;
@@ -3714,7 +3712,7 @@ static int __init atyfb_atari_probe(void)
3714 3712
3715#ifdef CONFIG_PCI 3713#ifdef CONFIG_PCI
3716 3714
3717static void __devexit atyfb_remove(struct fb_info *info) 3715static void atyfb_remove(struct fb_info *info)
3718{ 3716{
3719 struct atyfb_par *par = (struct atyfb_par *) info->par; 3717 struct atyfb_par *par = (struct atyfb_par *) info->par;
3720 3718
@@ -3762,7 +3760,7 @@ static void __devexit atyfb_remove(struct fb_info *info)
3762} 3760}
3763 3761
3764 3762
3765static void __devexit atyfb_pci_remove(struct pci_dev *pdev) 3763static void atyfb_pci_remove(struct pci_dev *pdev)
3766{ 3764{
3767 struct fb_info *info = pci_get_drvdata(pdev); 3765 struct fb_info *info = pci_get_drvdata(pdev);
3768 3766
@@ -3834,7 +3832,7 @@ static struct pci_driver atyfb_driver = {
3834 .name = "atyfb", 3832 .name = "atyfb",
3835 .id_table = atyfb_pci_tbl, 3833 .id_table = atyfb_pci_tbl,
3836 .probe = atyfb_pci_probe, 3834 .probe = atyfb_pci_probe,
3837 .remove = __devexit_p(atyfb_pci_remove), 3835 .remove = atyfb_pci_remove,
3838#ifdef CONFIG_PM 3836#ifdef CONFIG_PM
3839 .suspend = atyfb_pci_suspend, 3837 .suspend = atyfb_pci_suspend,
3840 .resume = atyfb_pci_resume, 3838 .resume = atyfb_pci_resume,
diff --git a/drivers/video/aty/mach64_ct.c b/drivers/video/aty/mach64_ct.c
index 2745b8539485..51f29d627ceb 100644
--- a/drivers/video/aty/mach64_ct.c
+++ b/drivers/video/aty/mach64_ct.c
@@ -373,8 +373,7 @@ void aty_set_pll_ct(const struct fb_info *info, const union aty_pll *pll)
373#endif 373#endif
374} 374}
375 375
376static void __devinit aty_get_pll_ct(const struct fb_info *info, 376static void aty_get_pll_ct(const struct fb_info *info, union aty_pll *pll)
377 union aty_pll *pll)
378{ 377{
379 struct atyfb_par *par = (struct atyfb_par *) info->par; 378 struct atyfb_par *par = (struct atyfb_par *) info->par;
380 u8 tmp, clock; 379 u8 tmp, clock;
@@ -397,8 +396,7 @@ static void __devinit aty_get_pll_ct(const struct fb_info *info,
397 } 396 }
398} 397}
399 398
400static int __devinit aty_init_pll_ct(const struct fb_info *info, 399static int aty_init_pll_ct(const struct fb_info *info, union aty_pll *pll)
401 union aty_pll *pll)
402{ 400{
403 struct atyfb_par *par = (struct atyfb_par *) info->par; 401 struct atyfb_par *par = (struct atyfb_par *) info->par;
404 u8 mpost_div, xpost_div, sclk_post_div_real; 402 u8 mpost_div, xpost_div, sclk_post_div_real;
diff --git a/drivers/video/aty/mach64_cursor.c b/drivers/video/aty/mach64_cursor.c
index 46f72ed53510..95ec042ddbf8 100644
--- a/drivers/video/aty/mach64_cursor.c
+++ b/drivers/video/aty/mach64_cursor.c
@@ -183,7 +183,7 @@ static int atyfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
183 return 0; 183 return 0;
184} 184}
185 185
186int __devinit aty_init_cursor(struct fb_info *info) 186int aty_init_cursor(struct fb_info *info)
187{ 187{
188 unsigned long addr; 188 unsigned long addr;
189 189
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c
index 9e279ee38da8..1e30b2b3e79f 100644
--- a/drivers/video/aty/radeon_base.c
+++ b/drivers/video/aty/radeon_base.c
@@ -293,7 +293,7 @@ static void radeon_unmap_ROM(struct radeonfb_info *rinfo, struct pci_dev *dev)
293 pci_unmap_rom(dev, rinfo->bios_seg); 293 pci_unmap_rom(dev, rinfo->bios_seg);
294} 294}
295 295
296static int __devinit radeon_map_ROM(struct radeonfb_info *rinfo, struct pci_dev *dev) 296static int radeon_map_ROM(struct radeonfb_info *rinfo, struct pci_dev *dev)
297{ 297{
298 void __iomem *rom; 298 void __iomem *rom;
299 u16 dptr; 299 u16 dptr;
@@ -388,7 +388,7 @@ static int __devinit radeon_map_ROM(struct radeonfb_info *rinfo, struct pci_dev
388} 388}
389 389
390#ifdef CONFIG_X86 390#ifdef CONFIG_X86
391static int __devinit radeon_find_mem_vbios(struct radeonfb_info *rinfo) 391static int radeon_find_mem_vbios(struct radeonfb_info *rinfo)
392{ 392{
393 /* I simplified this code as we used to miss the signatures in 393 /* I simplified this code as we used to miss the signatures in
394 * a lot of case. It's now closer to XFree, we just don't check 394 * a lot of case. It's now closer to XFree, we just don't check
@@ -423,7 +423,7 @@ static int __devinit radeon_find_mem_vbios(struct radeonfb_info *rinfo)
423 * Read XTAL (ref clock), SCLK and MCLK from Open Firmware device 423 * Read XTAL (ref clock), SCLK and MCLK from Open Firmware device
424 * tree. Hopefully, ATI OF driver is kind enough to fill these 424 * tree. Hopefully, ATI OF driver is kind enough to fill these
425 */ 425 */
426static int __devinit radeon_read_xtal_OF (struct radeonfb_info *rinfo) 426static int radeon_read_xtal_OF(struct radeonfb_info *rinfo)
427{ 427{
428 struct device_node *dp = rinfo->of_node; 428 struct device_node *dp = rinfo->of_node;
429 const u32 *val; 429 const u32 *val;
@@ -453,7 +453,7 @@ static int __devinit radeon_read_xtal_OF (struct radeonfb_info *rinfo)
453/* 453/*
454 * Read PLL infos from chip registers 454 * Read PLL infos from chip registers
455 */ 455 */
456static int __devinit radeon_probe_pll_params(struct radeonfb_info *rinfo) 456static int radeon_probe_pll_params(struct radeonfb_info *rinfo)
457{ 457{
458 unsigned char ppll_div_sel; 458 unsigned char ppll_div_sel;
459 unsigned Ns, Nm, M; 459 unsigned Ns, Nm, M;
@@ -591,7 +591,7 @@ static int __devinit radeon_probe_pll_params(struct radeonfb_info *rinfo)
591/* 591/*
592 * Retrieve PLL infos by different means (BIOS, Open Firmware, register probing...) 592 * Retrieve PLL infos by different means (BIOS, Open Firmware, register probing...)
593 */ 593 */
594static void __devinit radeon_get_pllinfo(struct radeonfb_info *rinfo) 594static void radeon_get_pllinfo(struct radeonfb_info *rinfo)
595{ 595{
596 /* 596 /*
597 * In the case nothing works, these are defaults; they are mostly 597 * In the case nothing works, these are defaults; they are mostly
@@ -1868,7 +1868,7 @@ static struct fb_ops radeonfb_ops = {
1868}; 1868};
1869 1869
1870 1870
1871static int __devinit radeon_set_fbinfo (struct radeonfb_info *rinfo) 1871static int radeon_set_fbinfo(struct radeonfb_info *rinfo)
1872{ 1872{
1873 struct fb_info *info = rinfo->info; 1873 struct fb_info *info = rinfo->info;
1874 1874
@@ -2143,8 +2143,8 @@ static struct bin_attribute edid2_attr = {
2143}; 2143};
2144 2144
2145 2145
2146static int __devinit radeonfb_pci_register (struct pci_dev *pdev, 2146static int radeonfb_pci_register(struct pci_dev *pdev,
2147 const struct pci_device_id *ent) 2147 const struct pci_device_id *ent)
2148{ 2148{
2149 struct fb_info *info; 2149 struct fb_info *info;
2150 struct radeonfb_info *rinfo; 2150 struct radeonfb_info *rinfo;
@@ -2407,7 +2407,7 @@ err_out:
2407 2407
2408 2408
2409 2409
2410static void __devexit radeonfb_pci_unregister (struct pci_dev *pdev) 2410static void radeonfb_pci_unregister(struct pci_dev *pdev)
2411{ 2411{
2412 struct fb_info *info = pci_get_drvdata(pdev); 2412 struct fb_info *info = pci_get_drvdata(pdev);
2413 struct radeonfb_info *rinfo = info->par; 2413 struct radeonfb_info *rinfo = info->par;
@@ -2465,7 +2465,7 @@ static struct pci_driver radeonfb_driver = {
2465 .name = "radeonfb", 2465 .name = "radeonfb",
2466 .id_table = radeonfb_pci_table, 2466 .id_table = radeonfb_pci_table,
2467 .probe = radeonfb_pci_register, 2467 .probe = radeonfb_pci_register,
2468 .remove = __devexit_p(radeonfb_pci_unregister), 2468 .remove = radeonfb_pci_unregister,
2469#ifdef CONFIG_PM 2469#ifdef CONFIG_PM
2470 .suspend = radeonfb_pci_suspend, 2470 .suspend = radeonfb_pci_suspend,
2471 .resume = radeonfb_pci_resume, 2471 .resume = radeonfb_pci_resume,
diff --git a/drivers/video/aty/radeon_monitor.c b/drivers/video/aty/radeon_monitor.c
index 5c23eac0eb9a..bc078d50d8f1 100644
--- a/drivers/video/aty/radeon_monitor.c
+++ b/drivers/video/aty/radeon_monitor.c
@@ -62,8 +62,8 @@ static char *radeon_get_mon_name(int type)
62 * models with broken OF probing by hard-coding known EDIDs for some Mac 62 * models with broken OF probing by hard-coding known EDIDs for some Mac
63 * laptops internal LVDS panel. (XXX: not done yet) 63 * laptops internal LVDS panel. (XXX: not done yet)
64 */ 64 */
65static int __devinit radeon_parse_montype_prop(struct device_node *dp, u8 **out_EDID, 65static int radeon_parse_montype_prop(struct device_node *dp, u8 **out_EDID,
66 int hdno) 66 int hdno)
67{ 67{
68 static char *propnames[] = { "DFP,EDID", "LCD,EDID", "EDID", 68 static char *propnames[] = { "DFP,EDID", "LCD,EDID", "EDID",
69 "EDID1", "EDID2", NULL }; 69 "EDID1", "EDID2", NULL };
@@ -115,8 +115,8 @@ static int __devinit radeon_parse_montype_prop(struct device_node *dp, u8 **out_
115 return mt; 115 return mt;
116} 116}
117 117
118static int __devinit radeon_probe_OF_head(struct radeonfb_info *rinfo, int head_no, 118static int radeon_probe_OF_head(struct radeonfb_info *rinfo, int head_no,
119 u8 **out_EDID) 119 u8 **out_EDID)
120{ 120{
121 struct device_node *dp; 121 struct device_node *dp;
122 122
@@ -163,7 +163,7 @@ static int __devinit radeon_probe_OF_head(struct radeonfb_info *rinfo, int head_
163#endif /* CONFIG_PPC_OF || CONFIG_SPARC */ 163#endif /* CONFIG_PPC_OF || CONFIG_SPARC */
164 164
165 165
166static int __devinit radeon_get_panel_info_BIOS(struct radeonfb_info *rinfo) 166static int radeon_get_panel_info_BIOS(struct radeonfb_info *rinfo)
167{ 167{
168 unsigned long tmp, tmp0; 168 unsigned long tmp, tmp0;
169 char stmp[30]; 169 char stmp[30];
@@ -251,7 +251,7 @@ static int __devinit radeon_get_panel_info_BIOS(struct radeonfb_info *rinfo)
251 * doesn't quite work yet, but it's output is still useful for 251 * doesn't quite work yet, but it's output is still useful for
252 * debugging 252 * debugging
253 */ 253 */
254static void __devinit radeon_parse_connector_info(struct radeonfb_info *rinfo) 254static void radeon_parse_connector_info(struct radeonfb_info *rinfo)
255{ 255{
256 int offset, chips, connectors, tmp, i, conn, type; 256 int offset, chips, connectors, tmp, i, conn, type;
257 257
@@ -297,7 +297,7 @@ static void __devinit radeon_parse_connector_info(struct radeonfb_info *rinfo)
297 * as well and currently is only implemented for the CRT DAC, the 297 * as well and currently is only implemented for the CRT DAC, the
298 * code for the TVDAC is commented out in XFree as "non working" 298 * code for the TVDAC is commented out in XFree as "non working"
299 */ 299 */
300static int __devinit radeon_crt_is_connected(struct radeonfb_info *rinfo, int is_crt_dac) 300static int radeon_crt_is_connected(struct radeonfb_info *rinfo, int is_crt_dac)
301{ 301{
302 int connected = 0; 302 int connected = 0;
303 303
@@ -369,8 +369,8 @@ static int __devinit radeon_crt_is_connected(struct radeonfb_info *rinfo, int is
369 * Parse the "monitor_layout" string if any. This code is mostly 369 * Parse the "monitor_layout" string if any. This code is mostly
370 * copied from XFree's radeon driver 370 * copied from XFree's radeon driver
371 */ 371 */
372static int __devinit radeon_parse_monitor_layout(struct radeonfb_info *rinfo, 372static int radeon_parse_monitor_layout(struct radeonfb_info *rinfo,
373 const char *monitor_layout) 373 const char *monitor_layout)
374{ 374{
375 char s1[5], s2[5]; 375 char s1[5], s2[5];
376 int i = 0, second = 0; 376 int i = 0, second = 0;
@@ -433,8 +433,8 @@ static int __devinit radeon_parse_monitor_layout(struct radeonfb_info *rinfo,
433 * try to retrieve EDID. The algorithm here comes from XFree's radeon 433 * try to retrieve EDID. The algorithm here comes from XFree's radeon
434 * driver 434 * driver
435 */ 435 */
436void __devinit radeon_probe_screens(struct radeonfb_info *rinfo, 436void radeon_probe_screens(struct radeonfb_info *rinfo,
437 const char *monitor_layout, int ignore_edid) 437 const char *monitor_layout, int ignore_edid)
438{ 438{
439#ifdef CONFIG_FB_RADEON_I2C 439#ifdef CONFIG_FB_RADEON_I2C
440 int ddc_crt2_used = 0; 440 int ddc_crt2_used = 0;
@@ -753,7 +753,7 @@ static int is_powerblade(const char *model)
753 * Build the modedb for head 1 (head 2 will come later), check panel infos 753 * Build the modedb for head 1 (head 2 will come later), check panel infos
754 * from either BIOS or EDID, and pick up the default mode 754 * from either BIOS or EDID, and pick up the default mode
755 */ 755 */
756void __devinit radeon_check_modes(struct radeonfb_info *rinfo, const char *mode_option) 756void radeon_check_modes(struct radeonfb_info *rinfo, const char *mode_option)
757{ 757{
758 struct fb_info * info = rinfo->info; 758 struct fb_info * info = rinfo->info;
759 int has_default_mode = 0; 759 int has_default_mode = 0;
diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c
index fe3b6ec87122..ddabaa867b0d 100644
--- a/drivers/video/au1100fb.c
+++ b/drivers/video/au1100fb.c
@@ -83,7 +83,7 @@ struct fb_bitfield rgb_bitfields[][4] =
83 { { 8, 4, 0 }, { 4, 4, 0 }, { 0, 4, 0 }, { 0, 0, 0 } }, 83 { { 8, 4, 0 }, { 4, 4, 0 }, { 0, 4, 0 }, { 0, 0, 0 } },
84}; 84};
85 85
86static struct fb_fix_screeninfo au1100fb_fix __devinitdata = { 86static struct fb_fix_screeninfo au1100fb_fix = {
87 .id = "AU1100 FB", 87 .id = "AU1100 FB",
88 .xpanstep = 1, 88 .xpanstep = 1,
89 .ypanstep = 1, 89 .ypanstep = 1,
@@ -91,7 +91,7 @@ static struct fb_fix_screeninfo au1100fb_fix __devinitdata = {
91 .accel = FB_ACCEL_NONE, 91 .accel = FB_ACCEL_NONE,
92}; 92};
93 93
94static struct fb_var_screeninfo au1100fb_var __devinitdata = { 94static struct fb_var_screeninfo au1100fb_var = {
95 .activate = FB_ACTIVATE_NOW, 95 .activate = FB_ACTIVATE_NOW,
96 .height = -1, 96 .height = -1,
97 .width = -1, 97 .width = -1,
@@ -469,7 +469,7 @@ static int au1100fb_setup(struct au1100fb_device *fbdev)
469 return 0; 469 return 0;
470} 470}
471 471
472static int __devinit au1100fb_drv_probe(struct platform_device *dev) 472static int au1100fb_drv_probe(struct platform_device *dev)
473{ 473{
474 struct au1100fb_device *fbdev = NULL; 474 struct au1100fb_device *fbdev = NULL;
475 struct resource *regs_res; 475 struct resource *regs_res;
diff --git a/drivers/video/au1200fb.c b/drivers/video/au1200fb.c
index 7ca79f02056e..1b59054fc6a4 100644
--- a/drivers/video/au1200fb.c
+++ b/drivers/video/au1200fb.c
@@ -1673,7 +1673,7 @@ out:
1673} 1673}
1674 1674
1675/* AU1200 LCD controller device driver */ 1675/* AU1200 LCD controller device driver */
1676static int __devinit au1200fb_drv_probe(struct platform_device *dev) 1676static int au1200fb_drv_probe(struct platform_device *dev)
1677{ 1677{
1678 struct au1200fb_device *fbdev; 1678 struct au1200fb_device *fbdev;
1679 struct au1200fb_platdata *pd; 1679 struct au1200fb_platdata *pd;
@@ -1798,7 +1798,7 @@ failed:
1798 return ret; 1798 return ret;
1799} 1799}
1800 1800
1801static int __devexit au1200fb_drv_remove(struct platform_device *dev) 1801static int au1200fb_drv_remove(struct platform_device *dev)
1802{ 1802{
1803 struct au1200fb_platdata *pd = platform_get_drvdata(dev); 1803 struct au1200fb_platdata *pd = platform_get_drvdata(dev);
1804 struct au1200fb_device *fbdev; 1804 struct au1200fb_device *fbdev;
@@ -1876,7 +1876,7 @@ static struct platform_driver au1200fb_driver = {
1876 .pm = AU1200FB_PMOPS, 1876 .pm = AU1200FB_PMOPS,
1877 }, 1877 },
1878 .probe = au1200fb_drv_probe, 1878 .probe = au1200fb_drv_probe,
1879 .remove = __devexit_p(au1200fb_drv_remove), 1879 .remove = au1200fb_drv_remove,
1880}; 1880};
1881 1881
1882/*-------------------------------------------------------------------------*/ 1882/*-------------------------------------------------------------------------*/
diff --git a/drivers/video/auo_k1900fb.c b/drivers/video/auo_k1900fb.c
index c36cf961dcb2..1a9ac6e1f4b3 100644
--- a/drivers/video/auo_k1900fb.c
+++ b/drivers/video/auo_k1900fb.c
@@ -156,7 +156,7 @@ static bool auok1900fb_need_refresh(struct auok190xfb_par *par)
156 return (par->update_cnt > 10); 156 return (par->update_cnt > 10);
157} 157}
158 158
159static int __devinit auok1900fb_probe(struct platform_device *pdev) 159static int auok1900fb_probe(struct platform_device *pdev)
160{ 160{
161 struct auok190x_init_data init; 161 struct auok190x_init_data init;
162 struct auok190x_board *board; 162 struct auok190x_board *board;
@@ -177,14 +177,14 @@ static int __devinit auok1900fb_probe(struct platform_device *pdev)
177 return auok190x_common_probe(pdev, &init); 177 return auok190x_common_probe(pdev, &init);
178} 178}
179 179
180static int __devexit auok1900fb_remove(struct platform_device *pdev) 180static int auok1900fb_remove(struct platform_device *pdev)
181{ 181{
182 return auok190x_common_remove(pdev); 182 return auok190x_common_remove(pdev);
183} 183}
184 184
185static struct platform_driver auok1900fb_driver = { 185static struct platform_driver auok1900fb_driver = {
186 .probe = auok1900fb_probe, 186 .probe = auok1900fb_probe,
187 .remove = __devexit_p(auok1900fb_remove), 187 .remove = auok1900fb_remove,
188 .driver = { 188 .driver = {
189 .owner = THIS_MODULE, 189 .owner = THIS_MODULE,
190 .name = "auo_k1900fb", 190 .name = "auo_k1900fb",
diff --git a/drivers/video/auo_k1901fb.c b/drivers/video/auo_k1901fb.c
index 1c054c18616e..d1db1653cd88 100644
--- a/drivers/video/auo_k1901fb.c
+++ b/drivers/video/auo_k1901fb.c
@@ -209,7 +209,7 @@ static bool auok1901fb_need_refresh(struct auok190xfb_par *par)
209 return (par->update_cnt > 10); 209 return (par->update_cnt > 10);
210} 210}
211 211
212static int __devinit auok1901fb_probe(struct platform_device *pdev) 212static int auok1901fb_probe(struct platform_device *pdev)
213{ 213{
214 struct auok190x_init_data init; 214 struct auok190x_init_data init;
215 struct auok190x_board *board; 215 struct auok190x_board *board;
@@ -230,14 +230,14 @@ static int __devinit auok1901fb_probe(struct platform_device *pdev)
230 return auok190x_common_probe(pdev, &init); 230 return auok190x_common_probe(pdev, &init);
231} 231}
232 232
233static int __devexit auok1901fb_remove(struct platform_device *pdev) 233static int auok1901fb_remove(struct platform_device *pdev)
234{ 234{
235 return auok190x_common_remove(pdev); 235 return auok190x_common_remove(pdev);
236} 236}
237 237
238static struct platform_driver auok1901fb_driver = { 238static struct platform_driver auok1901fb_driver = {
239 .probe = auok1901fb_probe, 239 .probe = auok1901fb_probe,
240 .remove = __devexit_p(auok1901fb_remove), 240 .remove = auok1901fb_remove,
241 .driver = { 241 .driver = {
242 .owner = THIS_MODULE, 242 .owner = THIS_MODULE,
243 .name = "auo_k1901fb", 243 .name = "auo_k1901fb",
diff --git a/drivers/video/auo_k190x.c b/drivers/video/auo_k190x.c
index c03ecdd31e4c..97f79356141e 100644
--- a/drivers/video/auo_k190x.c
+++ b/drivers/video/auo_k190x.c
@@ -773,8 +773,8 @@ EXPORT_SYMBOL_GPL(auok190x_pm);
773 * Common probe and remove code 773 * Common probe and remove code
774 */ 774 */
775 775
776int __devinit auok190x_common_probe(struct platform_device *pdev, 776int auok190x_common_probe(struct platform_device *pdev,
777 struct auok190x_init_data *init) 777 struct auok190x_init_data *init)
778{ 778{
779 struct auok190x_board *board = init->board; 779 struct auok190x_board *board = init->board;
780 struct auok190xfb_par *par; 780 struct auok190xfb_par *par;
@@ -1006,7 +1006,7 @@ err_reg:
1006} 1006}
1007EXPORT_SYMBOL_GPL(auok190x_common_probe); 1007EXPORT_SYMBOL_GPL(auok190x_common_probe);
1008 1008
1009int __devexit auok190x_common_remove(struct platform_device *pdev) 1009int auok190x_common_remove(struct platform_device *pdev)
1010{ 1010{
1011 struct fb_info *info = platform_get_drvdata(pdev); 1011 struct fb_info *info = platform_get_drvdata(pdev);
1012 struct auok190xfb_par *par = info->par; 1012 struct auok190xfb_par *par = info->par;
diff --git a/drivers/video/bf537-lq035.c b/drivers/video/bf537-lq035.c
index 7347aa1e5e4a..a82d2578d976 100644
--- a/drivers/video/bf537-lq035.c
+++ b/drivers/video/bf537-lq035.c
@@ -87,8 +87,8 @@ static void set_vcomm(void)
87 pr_err("i2c_smbus_write_byte_data fail: %d\n", nr); 87 pr_err("i2c_smbus_write_byte_data fail: %d\n", nr);
88} 88}
89 89
90static int __devinit ad5280_probe(struct i2c_client *client, 90static int ad5280_probe(struct i2c_client *client,
91 const struct i2c_device_id *id) 91 const struct i2c_device_id *id)
92{ 92{
93 int ret; 93 int ret;
94 if (!i2c_check_functionality(client->adapter, 94 if (!i2c_check_functionality(client->adapter,
@@ -108,7 +108,7 @@ static int __devinit ad5280_probe(struct i2c_client *client,
108 return 0; 108 return 0;
109} 109}
110 110
111static int __devexit ad5280_remove(struct i2c_client *client) 111static int ad5280_remove(struct i2c_client *client)
112{ 112{
113 ad5280_client = NULL; 113 ad5280_client = NULL;
114 return 0; 114 return 0;
@@ -126,7 +126,7 @@ static struct i2c_driver ad5280_driver = {
126 .name = "bf537-lq035-ad5280", 126 .name = "bf537-lq035-ad5280",
127 }, 127 },
128 .probe = ad5280_probe, 128 .probe = ad5280_probe,
129 .remove = __devexit_p(ad5280_remove), 129 .remove = ad5280_remove,
130 .id_table = ad5280_id, 130 .id_table = ad5280_id,
131}; 131};
132 132
@@ -360,7 +360,7 @@ static int config_dma(void)
360 return 0; 360 return 0;
361} 361}
362 362
363static int __devinit request_ports(void) 363static int request_ports(void)
364{ 364{
365 u16 tmr_req[] = TIMERS; 365 u16 tmr_req[] = TIMERS;
366 366
@@ -443,7 +443,7 @@ static struct fb_var_screeninfo bfin_lq035_fb_defined = {
443 .transp = {0, 0, 0}, 443 .transp = {0, 0, 0},
444}; 444};
445 445
446static struct fb_fix_screeninfo bfin_lq035_fb_fix __devinitdata = { 446static struct fb_fix_screeninfo bfin_lq035_fb_fix = {
447 .id = KBUILD_MODNAME, 447 .id = KBUILD_MODNAME,
448 .smem_len = ACTIVE_VIDEO_MEM_SIZE, 448 .smem_len = ACTIVE_VIDEO_MEM_SIZE,
449 .type = FB_TYPE_PACKED_PIXELS, 449 .type = FB_TYPE_PACKED_PIXELS,
@@ -686,7 +686,7 @@ static struct lcd_ops bfin_lcd_ops = {
686 686
687static struct lcd_device *lcd_dev; 687static struct lcd_device *lcd_dev;
688 688
689static int __devinit bfin_lq035_probe(struct platform_device *pdev) 689static int bfin_lq035_probe(struct platform_device *pdev)
690{ 690{
691 struct backlight_properties props; 691 struct backlight_properties props;
692 dma_addr_t dma_handle; 692 dma_addr_t dma_handle;
@@ -816,7 +816,7 @@ out_ports:
816 return ret; 816 return ret;
817} 817}
818 818
819static int __devexit bfin_lq035_remove(struct platform_device *pdev) 819static int bfin_lq035_remove(struct platform_device *pdev)
820{ 820{
821 if (fb_buffer != NULL) 821 if (fb_buffer != NULL)
822 dma_free_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, fb_buffer, 0); 822 dma_free_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, fb_buffer, 0);
@@ -889,7 +889,7 @@ static int bfin_lq035_resume(struct platform_device *pdev)
889 889
890static struct platform_driver bfin_lq035_driver = { 890static struct platform_driver bfin_lq035_driver = {
891 .probe = bfin_lq035_probe, 891 .probe = bfin_lq035_probe,
892 .remove = __devexit_p(bfin_lq035_remove), 892 .remove = bfin_lq035_remove,
893 .suspend = bfin_lq035_suspend, 893 .suspend = bfin_lq035_suspend,
894 .resume = bfin_lq035_resume, 894 .resume = bfin_lq035_resume,
895 .driver = { 895 .driver = {
diff --git a/drivers/video/bf54x-lq043fb.c b/drivers/video/bf54x-lq043fb.c
index ff5663f5c64f..2726a5b66741 100644
--- a/drivers/video/bf54x-lq043fb.c
+++ b/drivers/video/bf54x-lq043fb.c
@@ -497,7 +497,7 @@ static irqreturn_t bfin_bf54x_irq_error(int irq, void *dev_id)
497 return IRQ_HANDLED; 497 return IRQ_HANDLED;
498} 498}
499 499
500static int __devinit bfin_bf54x_probe(struct platform_device *pdev) 500static int bfin_bf54x_probe(struct platform_device *pdev)
501{ 501{
502#ifndef NO_BL_SUPPORT 502#ifndef NO_BL_SUPPORT
503 struct backlight_properties props; 503 struct backlight_properties props;
@@ -686,7 +686,7 @@ out1:
686 return ret; 686 return ret;
687} 687}
688 688
689static int __devexit bfin_bf54x_remove(struct platform_device *pdev) 689static int bfin_bf54x_remove(struct platform_device *pdev)
690{ 690{
691 691
692 struct fb_info *fbinfo = platform_get_drvdata(pdev); 692 struct fb_info *fbinfo = platform_get_drvdata(pdev);
@@ -754,7 +754,7 @@ static int bfin_bf54x_resume(struct platform_device *pdev)
754 754
755static struct platform_driver bfin_bf54x_driver = { 755static struct platform_driver bfin_bf54x_driver = {
756 .probe = bfin_bf54x_probe, 756 .probe = bfin_bf54x_probe,
757 .remove = __devexit_p(bfin_bf54x_remove), 757 .remove = bfin_bf54x_remove,
758 .suspend = bfin_bf54x_suspend, 758 .suspend = bfin_bf54x_suspend,
759 .resume = bfin_bf54x_resume, 759 .resume = bfin_bf54x_resume,
760 .driver = { 760 .driver = {
diff --git a/drivers/video/bfin-lq035q1-fb.c b/drivers/video/bfin-lq035q1-fb.c
index 6fbc75c2f0a1..29d8c0443a1f 100644
--- a/drivers/video/bfin-lq035q1-fb.c
+++ b/drivers/video/bfin-lq035q1-fb.c
@@ -137,7 +137,7 @@ static int lq035q1_control(struct spi_device *spi, unsigned char reg, unsigned s
137 return ret; 137 return ret;
138} 138}
139 139
140static int __devinit lq035q1_spidev_probe(struct spi_device *spi) 140static int lq035q1_spidev_probe(struct spi_device *spi)
141{ 141{
142 int ret; 142 int ret;
143 struct spi_control *ctl; 143 struct spi_control *ctl;
@@ -358,8 +358,8 @@ static inline void bfin_lq035q1_free_ports(unsigned ppi16)
358 gpio_free(P_IDENT(P_PPI0_FS3)); 358 gpio_free(P_IDENT(P_PPI0_FS3));
359} 359}
360 360
361static int __devinit bfin_lq035q1_request_ports(struct platform_device *pdev, 361static int bfin_lq035q1_request_ports(struct platform_device *pdev,
362 unsigned ppi16) 362 unsigned ppi16)
363{ 363{
364 int ret; 364 int ret;
365 /* ANOMALY_05000400 - PPI Does Not Start Properly In Specific Mode: 365 /* ANOMALY_05000400 - PPI Does Not Start Properly In Specific Mode:
@@ -555,7 +555,7 @@ static irqreturn_t bfin_lq035q1_irq_error(int irq, void *dev_id)
555 return IRQ_HANDLED; 555 return IRQ_HANDLED;
556} 556}
557 557
558static int __devinit bfin_lq035q1_probe(struct platform_device *pdev) 558static int bfin_lq035q1_probe(struct platform_device *pdev)
559{ 559{
560 struct bfin_lq035q1fb_info *info; 560 struct bfin_lq035q1fb_info *info;
561 struct fb_info *fbinfo; 561 struct fb_info *fbinfo;
@@ -706,7 +706,7 @@ static int __devinit bfin_lq035q1_probe(struct platform_device *pdev)
706 706
707 info->spidrv.driver.name = DRIVER_NAME"-spi"; 707 info->spidrv.driver.name = DRIVER_NAME"-spi";
708 info->spidrv.probe = lq035q1_spidev_probe; 708 info->spidrv.probe = lq035q1_spidev_probe;
709 info->spidrv.remove = __devexit_p(lq035q1_spidev_remove); 709 info->spidrv.remove = lq035q1_spidev_remove;
710 info->spidrv.shutdown = lq035q1_spidev_shutdown; 710 info->spidrv.shutdown = lq035q1_spidev_shutdown;
711 info->spidrv.suspend = lq035q1_spidev_suspend; 711 info->spidrv.suspend = lq035q1_spidev_suspend;
712 info->spidrv.resume = lq035q1_spidev_resume; 712 info->spidrv.resume = lq035q1_spidev_resume;
@@ -764,7 +764,7 @@ static int __devinit bfin_lq035q1_probe(struct platform_device *pdev)
764 return ret; 764 return ret;
765} 765}
766 766
767static int __devexit bfin_lq035q1_remove(struct platform_device *pdev) 767static int bfin_lq035q1_remove(struct platform_device *pdev)
768{ 768{
769 struct fb_info *fbinfo = platform_get_drvdata(pdev); 769 struct fb_info *fbinfo = platform_get_drvdata(pdev);
770 struct bfin_lq035q1fb_info *info = fbinfo->par; 770 struct bfin_lq035q1fb_info *info = fbinfo->par;
@@ -845,7 +845,7 @@ static struct dev_pm_ops bfin_lq035q1_dev_pm_ops = {
845 845
846static struct platform_driver bfin_lq035q1_driver = { 846static struct platform_driver bfin_lq035q1_driver = {
847 .probe = bfin_lq035q1_probe, 847 .probe = bfin_lq035q1_probe,
848 .remove = __devexit_p(bfin_lq035q1_remove), 848 .remove = bfin_lq035q1_remove,
849 .driver = { 849 .driver = {
850 .name = DRIVER_NAME, 850 .name = DRIVER_NAME,
851#ifdef CONFIG_PM 851#ifdef CONFIG_PM
diff --git a/drivers/video/bfin-t350mcqb-fb.c b/drivers/video/bfin-t350mcqb-fb.c
index ae0fb24b8b43..d46da01c31ae 100644
--- a/drivers/video/bfin-t350mcqb-fb.c
+++ b/drivers/video/bfin-t350mcqb-fb.c
@@ -418,7 +418,7 @@ static irqreturn_t bfin_t350mcqb_irq_error(int irq, void *dev_id)
418 return IRQ_HANDLED; 418 return IRQ_HANDLED;
419} 419}
420 420
421static int __devinit bfin_t350mcqb_probe(struct platform_device *pdev) 421static int bfin_t350mcqb_probe(struct platform_device *pdev)
422{ 422{
423#ifndef NO_BL_SUPPORT 423#ifndef NO_BL_SUPPORT
424 struct backlight_properties props; 424 struct backlight_properties props;
@@ -583,7 +583,7 @@ out1:
583 return ret; 583 return ret;
584} 584}
585 585
586static int __devexit bfin_t350mcqb_remove(struct platform_device *pdev) 586static int bfin_t350mcqb_remove(struct platform_device *pdev)
587{ 587{
588 588
589 struct fb_info *fbinfo = platform_get_drvdata(pdev); 589 struct fb_info *fbinfo = platform_get_drvdata(pdev);
@@ -658,7 +658,7 @@ static int bfin_t350mcqb_resume(struct platform_device *pdev)
658 658
659static struct platform_driver bfin_t350mcqb_driver = { 659static struct platform_driver bfin_t350mcqb_driver = {
660 .probe = bfin_t350mcqb_probe, 660 .probe = bfin_t350mcqb_probe,
661 .remove = __devexit_p(bfin_t350mcqb_remove), 661 .remove = bfin_t350mcqb_remove,
662 .suspend = bfin_t350mcqb_suspend, 662 .suspend = bfin_t350mcqb_suspend,
663 .resume = bfin_t350mcqb_resume, 663 .resume = bfin_t350mcqb_resume,
664 .driver = { 664 .driver = {
diff --git a/drivers/video/bfin_adv7393fb.c b/drivers/video/bfin_adv7393fb.c
index d0f121bd8b25..8d411a3c9966 100644
--- a/drivers/video/bfin_adv7393fb.c
+++ b/drivers/video/bfin_adv7393fb.c
@@ -88,7 +88,7 @@ static struct fb_var_screeninfo bfin_adv7393_fb_defined = {
88 .transp = {0, 0, 0}, 88 .transp = {0, 0, 0},
89}; 89};
90 90
91static struct fb_fix_screeninfo bfin_adv7393_fb_fix __devinitdata = { 91static struct fb_fix_screeninfo bfin_adv7393_fb_fix = {
92 .id = "BFIN ADV7393", 92 .id = "BFIN ADV7393",
93 .smem_len = 720 * 480 * 2, 93 .smem_len = 720 * 480 * 2,
94 .type = FB_TYPE_PACKED_PIXELS, 94 .type = FB_TYPE_PACKED_PIXELS,
@@ -368,8 +368,8 @@ adv7393_write_proc(struct file *file, const char __user * buffer,
368 return count; 368 return count;
369} 369}
370 370
371static int __devinit bfin_adv7393_fb_probe(struct i2c_client *client, 371static int bfin_adv7393_fb_probe(struct i2c_client *client,
372 const struct i2c_device_id *id) 372 const struct i2c_device_id *id)
373{ 373{
374 int ret = 0; 374 int ret = 0;
375 struct proc_dir_entry *entry; 375 struct proc_dir_entry *entry;
@@ -719,7 +719,7 @@ static int bfin_adv7393_fb_setcolreg(u_int regno, u_int red, u_int green,
719 return 0; 719 return 0;
720} 720}
721 721
722static int __devexit bfin_adv7393_fb_remove(struct i2c_client *client) 722static int bfin_adv7393_fb_remove(struct i2c_client *client)
723{ 723{
724 struct adv7393fb_device *fbdev = i2c_get_clientdata(client); 724 struct adv7393fb_device *fbdev = i2c_get_clientdata(client);
725 725
@@ -794,7 +794,7 @@ static struct i2c_driver bfin_adv7393_fb_driver = {
794#endif 794#endif
795 }, 795 },
796 .probe = bfin_adv7393_fb_probe, 796 .probe = bfin_adv7393_fb_probe,
797 .remove = __devexit_p(bfin_adv7393_fb_remove), 797 .remove = bfin_adv7393_fb_remove,
798 .id_table = bfin_adv7393_id, 798 .id_table = bfin_adv7393_id,
799}; 799};
800 800
diff --git a/drivers/video/broadsheetfb.c b/drivers/video/broadsheetfb.c
index c95b417d0d41..b09701c79432 100644
--- a/drivers/video/broadsheetfb.c
+++ b/drivers/video/broadsheetfb.c
@@ -91,7 +91,7 @@ static struct panel_info panel_table[] = {
91#define DPY_W 800 91#define DPY_W 800
92#define DPY_H 600 92#define DPY_H 600
93 93
94static struct fb_fix_screeninfo broadsheetfb_fix __devinitdata = { 94static struct fb_fix_screeninfo broadsheetfb_fix = {
95 .id = "broadsheetfb", 95 .id = "broadsheetfb",
96 .type = FB_TYPE_PACKED_PIXELS, 96 .type = FB_TYPE_PACKED_PIXELS,
97 .visual = FB_VISUAL_STATIC_PSEUDOCOLOR, 97 .visual = FB_VISUAL_STATIC_PSEUDOCOLOR,
@@ -102,7 +102,7 @@ static struct fb_fix_screeninfo broadsheetfb_fix __devinitdata = {
102 .accel = FB_ACCEL_NONE, 102 .accel = FB_ACCEL_NONE,
103}; 103};
104 104
105static struct fb_var_screeninfo broadsheetfb_var __devinitdata = { 105static struct fb_var_screeninfo broadsheetfb_var = {
106 .xres = DPY_W, 106 .xres = DPY_W,
107 .yres = DPY_H, 107 .yres = DPY_H,
108 .xres_virtual = DPY_W, 108 .xres_virtual = DPY_W,
@@ -774,7 +774,7 @@ static DEVICE_ATTR(loadstore_waveform, S_IWUSR, NULL,
774 broadsheet_loadstore_waveform); 774 broadsheet_loadstore_waveform);
775 775
776/* upper level functions that manipulate the display and other stuff */ 776/* upper level functions that manipulate the display and other stuff */
777static void __devinit broadsheet_init_display(struct broadsheetfb_par *par) 777static void broadsheet_init_display(struct broadsheetfb_par *par)
778{ 778{
779 u16 args[5]; 779 u16 args[5];
780 int xres = par->info->var.xres; 780 int xres = par->info->var.xres;
@@ -834,7 +834,7 @@ static void __devinit broadsheet_init_display(struct broadsheetfb_par *par)
834 par->board->wait_for_rdy(par); 834 par->board->wait_for_rdy(par);
835} 835}
836 836
837static void __devinit broadsheet_identify(struct broadsheetfb_par *par) 837static void broadsheet_identify(struct broadsheetfb_par *par)
838{ 838{
839 u16 rev, prc; 839 u16 rev, prc;
840 struct device *dev = par->info->device; 840 struct device *dev = par->info->device;
@@ -849,7 +849,7 @@ static void __devinit broadsheet_identify(struct broadsheetfb_par *par)
849 dev_warn(dev, "Unrecognized Broadsheet Revision\n"); 849 dev_warn(dev, "Unrecognized Broadsheet Revision\n");
850} 850}
851 851
852static void __devinit broadsheet_init(struct broadsheetfb_par *par) 852static void broadsheet_init(struct broadsheetfb_par *par)
853{ 853{
854 broadsheet_send_command(par, BS_CMD_INIT_SYS_RUN); 854 broadsheet_send_command(par, BS_CMD_INIT_SYS_RUN);
855 /* the controller needs a second */ 855 /* the controller needs a second */
@@ -1058,7 +1058,7 @@ static struct fb_deferred_io broadsheetfb_defio = {
1058 .deferred_io = broadsheetfb_dpy_deferred_io, 1058 .deferred_io = broadsheetfb_dpy_deferred_io,
1059}; 1059};
1060 1060
1061static int __devinit broadsheetfb_probe(struct platform_device *dev) 1061static int broadsheetfb_probe(struct platform_device *dev)
1062{ 1062{
1063 struct fb_info *info; 1063 struct fb_info *info;
1064 struct broadsheet_board *board; 1064 struct broadsheet_board *board;
@@ -1190,7 +1190,7 @@ err:
1190 1190
1191} 1191}
1192 1192
1193static int __devexit broadsheetfb_remove(struct platform_device *dev) 1193static int broadsheetfb_remove(struct platform_device *dev)
1194{ 1194{
1195 struct fb_info *info = platform_get_drvdata(dev); 1195 struct fb_info *info = platform_get_drvdata(dev);
1196 1196
@@ -1211,7 +1211,7 @@ static int __devexit broadsheetfb_remove(struct platform_device *dev)
1211 1211
1212static struct platform_driver broadsheetfb_driver = { 1212static struct platform_driver broadsheetfb_driver = {
1213 .probe = broadsheetfb_probe, 1213 .probe = broadsheetfb_probe,
1214 .remove = __devexit_p(broadsheetfb_remove), 1214 .remove = broadsheetfb_remove,
1215 .driver = { 1215 .driver = {
1216 .owner = THIS_MODULE, 1216 .owner = THIS_MODULE,
1217 .name = "broadsheetfb", 1217 .name = "broadsheetfb",
diff --git a/drivers/video/bw2.c b/drivers/video/bw2.c
index 6bea9a936798..60017fc634b5 100644
--- a/drivers/video/bw2.c
+++ b/drivers/video/bw2.c
@@ -179,7 +179,7 @@ static int bw2_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
179 * Initialisation 179 * Initialisation
180 */ 180 */
181 181
182static void __devinit bw2_init_fix(struct fb_info *info, int linebytes) 182static void bw2_init_fix(struct fb_info *info, int linebytes)
183{ 183{
184 strlcpy(info->fix.id, "bwtwo", sizeof(info->fix.id)); 184 strlcpy(info->fix.id, "bwtwo", sizeof(info->fix.id));
185 185
@@ -191,44 +191,43 @@ static void __devinit bw2_init_fix(struct fb_info *info, int linebytes)
191 info->fix.accel = FB_ACCEL_SUN_BWTWO; 191 info->fix.accel = FB_ACCEL_SUN_BWTWO;
192} 192}
193 193
194static u8 bw2regs_1600[] __devinitdata = { 194static u8 bw2regs_1600[] = {
195 0x14, 0x8b, 0x15, 0x28, 0x16, 0x03, 0x17, 0x13, 195 0x14, 0x8b, 0x15, 0x28, 0x16, 0x03, 0x17, 0x13,
196 0x18, 0x7b, 0x19, 0x05, 0x1a, 0x34, 0x1b, 0x2e, 196 0x18, 0x7b, 0x19, 0x05, 0x1a, 0x34, 0x1b, 0x2e,
197 0x1c, 0x00, 0x1d, 0x0a, 0x1e, 0xff, 0x1f, 0x01, 197 0x1c, 0x00, 0x1d, 0x0a, 0x1e, 0xff, 0x1f, 0x01,
198 0x10, 0x21, 0 198 0x10, 0x21, 0
199}; 199};
200 200
201static u8 bw2regs_ecl[] __devinitdata = { 201static u8 bw2regs_ecl[] = {
202 0x14, 0x65, 0x15, 0x1e, 0x16, 0x04, 0x17, 0x0c, 202 0x14, 0x65, 0x15, 0x1e, 0x16, 0x04, 0x17, 0x0c,
203 0x18, 0x5e, 0x19, 0x03, 0x1a, 0xa7, 0x1b, 0x23, 203 0x18, 0x5e, 0x19, 0x03, 0x1a, 0xa7, 0x1b, 0x23,
204 0x1c, 0x00, 0x1d, 0x08, 0x1e, 0xff, 0x1f, 0x01, 204 0x1c, 0x00, 0x1d, 0x08, 0x1e, 0xff, 0x1f, 0x01,
205 0x10, 0x20, 0 205 0x10, 0x20, 0
206}; 206};
207 207
208static u8 bw2regs_analog[] __devinitdata = { 208static u8 bw2regs_analog[] = {
209 0x14, 0xbb, 0x15, 0x2b, 0x16, 0x03, 0x17, 0x13, 209 0x14, 0xbb, 0x15, 0x2b, 0x16, 0x03, 0x17, 0x13,
210 0x18, 0xb0, 0x19, 0x03, 0x1a, 0xa6, 0x1b, 0x22, 210 0x18, 0xb0, 0x19, 0x03, 0x1a, 0xa6, 0x1b, 0x22,
211 0x1c, 0x01, 0x1d, 0x05, 0x1e, 0xff, 0x1f, 0x01, 211 0x1c, 0x01, 0x1d, 0x05, 0x1e, 0xff, 0x1f, 0x01,
212 0x10, 0x20, 0 212 0x10, 0x20, 0
213}; 213};
214 214
215static u8 bw2regs_76hz[] __devinitdata = { 215static u8 bw2regs_76hz[] = {
216 0x14, 0xb7, 0x15, 0x27, 0x16, 0x03, 0x17, 0x0f, 216 0x14, 0xb7, 0x15, 0x27, 0x16, 0x03, 0x17, 0x0f,
217 0x18, 0xae, 0x19, 0x03, 0x1a, 0xae, 0x1b, 0x2a, 217 0x18, 0xae, 0x19, 0x03, 0x1a, 0xae, 0x1b, 0x2a,
218 0x1c, 0x01, 0x1d, 0x09, 0x1e, 0xff, 0x1f, 0x01, 218 0x1c, 0x01, 0x1d, 0x09, 0x1e, 0xff, 0x1f, 0x01,
219 0x10, 0x24, 0 219 0x10, 0x24, 0
220}; 220};
221 221
222static u8 bw2regs_66hz[] __devinitdata = { 222static u8 bw2regs_66hz[] = {
223 0x14, 0xbb, 0x15, 0x2b, 0x16, 0x04, 0x17, 0x14, 223 0x14, 0xbb, 0x15, 0x2b, 0x16, 0x04, 0x17, 0x14,
224 0x18, 0xae, 0x19, 0x03, 0x1a, 0xa8, 0x1b, 0x24, 224 0x18, 0xae, 0x19, 0x03, 0x1a, 0xa8, 0x1b, 0x24,
225 0x1c, 0x01, 0x1d, 0x05, 0x1e, 0xff, 0x1f, 0x01, 225 0x1c, 0x01, 0x1d, 0x05, 0x1e, 0xff, 0x1f, 0x01,
226 0x10, 0x20, 0 226 0x10, 0x20, 0
227}; 227};
228 228
229static int __devinit bw2_do_default_mode(struct bw2_par *par, 229static int bw2_do_default_mode(struct bw2_par *par, struct fb_info *info,
230 struct fb_info *info, 230 int *linebytes)
231 int *linebytes)
232{ 231{
233 u8 status, mon; 232 u8 status, mon;
234 u8 *p; 233 u8 *p;
@@ -273,7 +272,7 @@ static int __devinit bw2_do_default_mode(struct bw2_par *par,
273 return 0; 272 return 0;
274} 273}
275 274
276static int __devinit bw2_probe(struct platform_device *op) 275static int bw2_probe(struct platform_device *op)
277{ 276{
278 struct device_node *dp = op->dev.of_node; 277 struct device_node *dp = op->dev.of_node;
279 struct fb_info *info; 278 struct fb_info *info;
@@ -352,7 +351,7 @@ out_err:
352 return err; 351 return err;
353} 352}
354 353
355static int __devexit bw2_remove(struct platform_device *op) 354static int bw2_remove(struct platform_device *op)
356{ 355{
357 struct fb_info *info = dev_get_drvdata(&op->dev); 356 struct fb_info *info = dev_get_drvdata(&op->dev);
358 struct bw2_par *par = info->par; 357 struct bw2_par *par = info->par;
@@ -384,7 +383,7 @@ static struct platform_driver bw2_driver = {
384 .of_match_table = bw2_match, 383 .of_match_table = bw2_match,
385 }, 384 },
386 .probe = bw2_probe, 385 .probe = bw2_probe,
387 .remove = __devexit_p(bw2_remove), 386 .remove = bw2_remove,
388}; 387};
389 388
390static int __init bw2_init(void) 389static int __init bw2_init(void)
diff --git a/drivers/video/carminefb.c b/drivers/video/carminefb.c
index 2c76fdf23f2a..153dd65b0ae8 100644
--- a/drivers/video/carminefb.c
+++ b/drivers/video/carminefb.c
@@ -78,7 +78,7 @@ struct carmine_fb {
78 u32 pseudo_palette[16]; 78 u32 pseudo_palette[16];
79}; 79};
80 80
81static struct fb_fix_screeninfo carminefb_fix __devinitdata = { 81static struct fb_fix_screeninfo carminefb_fix = {
82 .id = "Carmine", 82 .id = "Carmine",
83 .type = FB_TYPE_PACKED_PIXELS, 83 .type = FB_TYPE_PACKED_PIXELS,
84 .visual = FB_VISUAL_TRUECOLOR, 84 .visual = FB_VISUAL_TRUECOLOR,
@@ -537,8 +537,9 @@ static struct fb_ops carminefb_ops = {
537 .fb_setcolreg = carmine_setcolreg, 537 .fb_setcolreg = carmine_setcolreg,
538}; 538};
539 539
540static int __devinit alloc_carmine_fb(void __iomem *regs, void __iomem *smem_base, 540static int alloc_carmine_fb(void __iomem *regs, void __iomem *smem_base,
541 int smem_offset, struct device *device, struct fb_info **rinfo) 541 int smem_offset, struct device *device,
542 struct fb_info **rinfo)
542{ 543{
543 int ret; 544 int ret;
544 struct fb_info *info; 545 struct fb_info *info;
@@ -606,8 +607,7 @@ static void cleanup_fb_device(struct fb_info *info)
606 } 607 }
607} 608}
608 609
609static int __devinit carminefb_probe(struct pci_dev *dev, 610static int carminefb_probe(struct pci_dev *dev, const struct pci_device_id *ent)
610 const struct pci_device_id *ent)
611{ 611{
612 struct carmine_hw *hw; 612 struct carmine_hw *hw;
613 struct device *device = &dev->dev; 613 struct device *device = &dev->dev;
@@ -721,7 +721,7 @@ err_enable_pci:
721 return ret; 721 return ret;
722} 722}
723 723
724static void __devexit carminefb_remove(struct pci_dev *dev) 724static void carminefb_remove(struct pci_dev *dev)
725{ 725{
726 struct carmine_hw *hw = pci_get_drvdata(dev); 726 struct carmine_hw *hw = pci_get_drvdata(dev);
727 struct fb_fix_screeninfo fix; 727 struct fb_fix_screeninfo fix;
@@ -752,7 +752,7 @@ static void __devexit carminefb_remove(struct pci_dev *dev)
752} 752}
753 753
754#define PCI_VENDOR_ID_FUJITU_LIMITED 0x10cf 754#define PCI_VENDOR_ID_FUJITU_LIMITED 0x10cf
755static struct pci_device_id carmine_devices[] __devinitdata = { 755static struct pci_device_id carmine_devices[] = {
756{ 756{
757 PCI_DEVICE(PCI_VENDOR_ID_FUJITU_LIMITED, 0x202b)}, 757 PCI_DEVICE(PCI_VENDOR_ID_FUJITU_LIMITED, 0x202b)},
758 {0, 0, 0, 0, 0, 0, 0} 758 {0, 0, 0, 0, 0, 0, 0}
@@ -764,7 +764,7 @@ static struct pci_driver carmine_pci_driver = {
764 .name = "carminefb", 764 .name = "carminefb",
765 .id_table = carmine_devices, 765 .id_table = carmine_devices,
766 .probe = carminefb_probe, 766 .probe = carminefb_probe,
767 .remove = __devexit_p(carminefb_remove), 767 .remove = carminefb_remove,
768}; 768};
769 769
770static int __init carminefb_init(void) 770static int __init carminefb_init(void)
diff --git a/drivers/video/cg14.c b/drivers/video/cg14.c
index f18895006627..ed3b8891e006 100644
--- a/drivers/video/cg14.c
+++ b/drivers/video/cg14.c
@@ -352,8 +352,8 @@ static int cg14_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
352 * Initialisation 352 * Initialisation
353 */ 353 */
354 354
355static void __devinit cg14_init_fix(struct fb_info *info, int linebytes, 355static void cg14_init_fix(struct fb_info *info, int linebytes,
356 struct device_node *dp) 356 struct device_node *dp)
357{ 357{
358 const char *name = dp->name; 358 const char *name = dp->name;
359 359
@@ -367,7 +367,7 @@ static void __devinit cg14_init_fix(struct fb_info *info, int linebytes,
367 info->fix.accel = FB_ACCEL_SUN_CG14; 367 info->fix.accel = FB_ACCEL_SUN_CG14;
368} 368}
369 369
370static struct sbus_mmap_map __cg14_mmap_map[CG14_MMAP_ENTRIES] __devinitdata = { 370static struct sbus_mmap_map __cg14_mmap_map[CG14_MMAP_ENTRIES] = {
371 { 371 {
372 .voff = CG14_REGS, 372 .voff = CG14_REGS,
373 .poff = 0x80000000, 373 .poff = 0x80000000,
@@ -463,7 +463,7 @@ static void cg14_unmap_regs(struct platform_device *op, struct fb_info *info,
463 info->screen_base, info->fix.smem_len); 463 info->screen_base, info->fix.smem_len);
464} 464}
465 465
466static int __devinit cg14_probe(struct platform_device *op) 466static int cg14_probe(struct platform_device *op)
467{ 467{
468 struct device_node *dp = op->dev.of_node; 468 struct device_node *dp = op->dev.of_node;
469 struct fb_info *info; 469 struct fb_info *info;
@@ -571,7 +571,7 @@ out_err:
571 return err; 571 return err;
572} 572}
573 573
574static int __devexit cg14_remove(struct platform_device *op) 574static int cg14_remove(struct platform_device *op)
575{ 575{
576 struct fb_info *info = dev_get_drvdata(&op->dev); 576 struct fb_info *info = dev_get_drvdata(&op->dev);
577 struct cg14_par *par = info->par; 577 struct cg14_par *par = info->par;
@@ -603,7 +603,7 @@ static struct platform_driver cg14_driver = {
603 .of_match_table = cg14_match, 603 .of_match_table = cg14_match,
604 }, 604 },
605 .probe = cg14_probe, 605 .probe = cg14_probe,
606 .remove = __devexit_p(cg14_remove), 606 .remove = cg14_remove,
607}; 607};
608 608
609static int __init cg14_init(void) 609static int __init cg14_init(void)
diff --git a/drivers/video/cg3.c b/drivers/video/cg3.c
index c5e7612ff876..9f63507ded37 100644
--- a/drivers/video/cg3.c
+++ b/drivers/video/cg3.c
@@ -243,8 +243,8 @@ static int cg3_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
243 * Initialisation 243 * Initialisation
244 */ 244 */
245 245
246static void __devinit cg3_init_fix(struct fb_info *info, int linebytes, 246static void cg3_init_fix(struct fb_info *info, int linebytes,
247 struct device_node *dp) 247 struct device_node *dp)
248{ 248{
249 strlcpy(info->fix.id, dp->name, sizeof(info->fix.id)); 249 strlcpy(info->fix.id, dp->name, sizeof(info->fix.id));
250 250
@@ -256,8 +256,8 @@ static void __devinit cg3_init_fix(struct fb_info *info, int linebytes,
256 info->fix.accel = FB_ACCEL_SUN_CGTHREE; 256 info->fix.accel = FB_ACCEL_SUN_CGTHREE;
257} 257}
258 258
259static void __devinit cg3_rdi_maybe_fixup_var(struct fb_var_screeninfo *var, 259static void cg3_rdi_maybe_fixup_var(struct fb_var_screeninfo *var,
260 struct device_node *dp) 260 struct device_node *dp)
261{ 261{
262 const char *params; 262 const char *params;
263 char *p; 263 char *p;
@@ -279,36 +279,36 @@ static void __devinit cg3_rdi_maybe_fixup_var(struct fb_var_screeninfo *var,
279 } 279 }
280} 280}
281 281
282static u8 cg3regvals_66hz[] __devinitdata = { /* 1152 x 900, 66 Hz */ 282static u8 cg3regvals_66hz[] = { /* 1152 x 900, 66 Hz */
283 0x14, 0xbb, 0x15, 0x2b, 0x16, 0x04, 0x17, 0x14, 283 0x14, 0xbb, 0x15, 0x2b, 0x16, 0x04, 0x17, 0x14,
284 0x18, 0xae, 0x19, 0x03, 0x1a, 0xa8, 0x1b, 0x24, 284 0x18, 0xae, 0x19, 0x03, 0x1a, 0xa8, 0x1b, 0x24,
285 0x1c, 0x01, 0x1d, 0x05, 0x1e, 0xff, 0x1f, 0x01, 285 0x1c, 0x01, 0x1d, 0x05, 0x1e, 0xff, 0x1f, 0x01,
286 0x10, 0x20, 0 286 0x10, 0x20, 0
287}; 287};
288 288
289static u8 cg3regvals_76hz[] __devinitdata = { /* 1152 x 900, 76 Hz */ 289static u8 cg3regvals_76hz[] = { /* 1152 x 900, 76 Hz */
290 0x14, 0xb7, 0x15, 0x27, 0x16, 0x03, 0x17, 0x0f, 290 0x14, 0xb7, 0x15, 0x27, 0x16, 0x03, 0x17, 0x0f,
291 0x18, 0xae, 0x19, 0x03, 0x1a, 0xae, 0x1b, 0x2a, 291 0x18, 0xae, 0x19, 0x03, 0x1a, 0xae, 0x1b, 0x2a,
292 0x1c, 0x01, 0x1d, 0x09, 0x1e, 0xff, 0x1f, 0x01, 292 0x1c, 0x01, 0x1d, 0x09, 0x1e, 0xff, 0x1f, 0x01,
293 0x10, 0x24, 0 293 0x10, 0x24, 0
294}; 294};
295 295
296static u8 cg3regvals_rdi[] __devinitdata = { /* 640 x 480, cgRDI */ 296static u8 cg3regvals_rdi[] = { /* 640 x 480, cgRDI */
297 0x14, 0x70, 0x15, 0x20, 0x16, 0x08, 0x17, 0x10, 297 0x14, 0x70, 0x15, 0x20, 0x16, 0x08, 0x17, 0x10,
298 0x18, 0x06, 0x19, 0x02, 0x1a, 0x31, 0x1b, 0x51, 298 0x18, 0x06, 0x19, 0x02, 0x1a, 0x31, 0x1b, 0x51,
299 0x1c, 0x06, 0x1d, 0x0c, 0x1e, 0xff, 0x1f, 0x01, 299 0x1c, 0x06, 0x1d, 0x0c, 0x1e, 0xff, 0x1f, 0x01,
300 0x10, 0x22, 0 300 0x10, 0x22, 0
301}; 301};
302 302
303static u8 *cg3_regvals[] __devinitdata = { 303static u8 *cg3_regvals[] = {
304 cg3regvals_66hz, cg3regvals_76hz, cg3regvals_rdi 304 cg3regvals_66hz, cg3regvals_76hz, cg3regvals_rdi
305}; 305};
306 306
307static u_char cg3_dacvals[] __devinitdata = { 307static u_char cg3_dacvals[] = {
308 4, 0xff, 5, 0x00, 6, 0x70, 7, 0x00, 0 308 4, 0xff, 5, 0x00, 6, 0x70, 7, 0x00, 0
309}; 309};
310 310
311static int __devinit cg3_do_default_mode(struct cg3_par *par) 311static int cg3_do_default_mode(struct cg3_par *par)
312{ 312{
313 enum cg3_type type; 313 enum cg3_type type;
314 u8 *p; 314 u8 *p;
@@ -346,7 +346,7 @@ static int __devinit cg3_do_default_mode(struct cg3_par *par)
346 return 0; 346 return 0;
347} 347}
348 348
349static int __devinit cg3_probe(struct platform_device *op) 349static int cg3_probe(struct platform_device *op)
350{ 350{
351 struct device_node *dp = op->dev.of_node; 351 struct device_node *dp = op->dev.of_node;
352 struct fb_info *info; 352 struct fb_info *info;
@@ -433,7 +433,7 @@ out_err:
433 return err; 433 return err;
434} 434}
435 435
436static int __devexit cg3_remove(struct platform_device *op) 436static int cg3_remove(struct platform_device *op)
437{ 437{
438 struct fb_info *info = dev_get_drvdata(&op->dev); 438 struct fb_info *info = dev_get_drvdata(&op->dev);
439 struct cg3_par *par = info->par; 439 struct cg3_par *par = info->par;
@@ -469,7 +469,7 @@ static struct platform_driver cg3_driver = {
469 .of_match_table = cg3_match, 469 .of_match_table = cg3_match,
470 }, 470 },
471 .probe = cg3_probe, 471 .probe = cg3_probe,
472 .remove = __devexit_p(cg3_remove), 472 .remove = cg3_remove,
473}; 473};
474 474
475static int __init cg3_init(void) 475static int __init cg3_init(void)
diff --git a/drivers/video/cg6.c b/drivers/video/cg6.c
index 179e96cdb323..3545decc7485 100644
--- a/drivers/video/cg6.c
+++ b/drivers/video/cg6.c
@@ -607,7 +607,7 @@ static int cg6_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
607 * Initialisation 607 * Initialisation
608 */ 608 */
609 609
610static void __devinit cg6_init_fix(struct fb_info *info, int linebytes) 610static void cg6_init_fix(struct fb_info *info, int linebytes)
611{ 611{
612 struct cg6_par *par = (struct cg6_par *)info->par; 612 struct cg6_par *par = (struct cg6_par *)info->par;
613 const char *cg6_cpu_name, *cg6_card_name; 613 const char *cg6_cpu_name, *cg6_card_name;
@@ -649,7 +649,7 @@ static void __devinit cg6_init_fix(struct fb_info *info, int linebytes)
649} 649}
650 650
651/* Initialize Brooktree DAC */ 651/* Initialize Brooktree DAC */
652static void __devinit cg6_bt_init(struct cg6_par *par) 652static void cg6_bt_init(struct cg6_par *par)
653{ 653{
654 struct bt_regs __iomem *bt = par->bt; 654 struct bt_regs __iomem *bt = par->bt;
655 655
@@ -663,7 +663,7 @@ static void __devinit cg6_bt_init(struct cg6_par *par)
663 sbus_writel(0x00 << 24, &bt->control); 663 sbus_writel(0x00 << 24, &bt->control);
664} 664}
665 665
666static void __devinit cg6_chip_init(struct fb_info *info) 666static void cg6_chip_init(struct fb_info *info)
667{ 667{
668 struct cg6_par *par = (struct cg6_par *)info->par; 668 struct cg6_par *par = (struct cg6_par *)info->par;
669 struct cg6_tec __iomem *tec = par->tec; 669 struct cg6_tec __iomem *tec = par->tec;
@@ -737,7 +737,7 @@ static void cg6_unmap_regs(struct platform_device *op, struct fb_info *info,
737 info->fix.smem_len); 737 info->fix.smem_len);
738} 738}
739 739
740static int __devinit cg6_probe(struct platform_device *op) 740static int cg6_probe(struct platform_device *op)
741{ 741{
742 struct device_node *dp = op->dev.of_node; 742 struct device_node *dp = op->dev.of_node;
743 struct fb_info *info; 743 struct fb_info *info;
@@ -827,7 +827,7 @@ out_err:
827 return err; 827 return err;
828} 828}
829 829
830static int __devexit cg6_remove(struct platform_device *op) 830static int cg6_remove(struct platform_device *op)
831{ 831{
832 struct fb_info *info = dev_get_drvdata(&op->dev); 832 struct fb_info *info = dev_get_drvdata(&op->dev);
833 struct cg6_par *par = info->par; 833 struct cg6_par *par = info->par;
@@ -862,7 +862,7 @@ static struct platform_driver cg6_driver = {
862 .of_match_table = cg6_match, 862 .of_match_table = cg6_match,
863 }, 863 },
864 .probe = cg6_probe, 864 .probe = cg6_probe,
865 .remove = __devexit_p(cg6_remove), 865 .remove = cg6_remove,
866}; 866};
867 867
868static int __init cg6_init(void) 868static int __init cg6_init(void)
diff --git a/drivers/video/chipsfb.c b/drivers/video/chipsfb.c
index cff742abdc5d..206a66b61072 100644
--- a/drivers/video/chipsfb.c
+++ b/drivers/video/chipsfb.c
@@ -292,7 +292,7 @@ static void __init chips_hw_init(void)
292 write_fr(chips_init_fr[i].addr, chips_init_fr[i].data); 292 write_fr(chips_init_fr[i].addr, chips_init_fr[i].data);
293} 293}
294 294
295static struct fb_fix_screeninfo chipsfb_fix __devinitdata = { 295static struct fb_fix_screeninfo chipsfb_fix = {
296 .id = "C&T 65550", 296 .id = "C&T 65550",
297 .type = FB_TYPE_PACKED_PIXELS, 297 .type = FB_TYPE_PACKED_PIXELS,
298 .visual = FB_VISUAL_PSEUDOCOLOR, 298 .visual = FB_VISUAL_PSEUDOCOLOR,
@@ -309,7 +309,7 @@ static struct fb_fix_screeninfo chipsfb_fix __devinitdata = {
309 .smem_len = 0x100000, /* 1MB */ 309 .smem_len = 0x100000, /* 1MB */
310}; 310};
311 311
312static struct fb_var_screeninfo chipsfb_var __devinitdata = { 312static struct fb_var_screeninfo chipsfb_var = {
313 .xres = 800, 313 .xres = 800,
314 .yres = 600, 314 .yres = 600,
315 .xres_virtual = 800, 315 .xres_virtual = 800,
@@ -330,7 +330,7 @@ static struct fb_var_screeninfo chipsfb_var __devinitdata = {
330 .vsync_len = 8, 330 .vsync_len = 8,
331}; 331};
332 332
333static void __devinit init_chips(struct fb_info *p, unsigned long addr) 333static void init_chips(struct fb_info *p, unsigned long addr)
334{ 334{
335 memset(p->screen_base, 0, 0x100000); 335 memset(p->screen_base, 0, 0x100000);
336 336
@@ -347,8 +347,7 @@ static void __devinit init_chips(struct fb_info *p, unsigned long addr)
347 chips_hw_init(); 347 chips_hw_init();
348} 348}
349 349
350static int __devinit 350static int chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent)
351chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent)
352{ 351{
353 struct fb_info *p; 352 struct fb_info *p;
354 unsigned long addr, size; 353 unsigned long addr, size;
@@ -438,7 +437,7 @@ chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent)
438 return rc; 437 return rc;
439} 438}
440 439
441static void __devexit chipsfb_remove(struct pci_dev *dp) 440static void chipsfb_remove(struct pci_dev *dp)
442{ 441{
443 struct fb_info *p = pci_get_drvdata(dp); 442 struct fb_info *p = pci_get_drvdata(dp);
444 443
@@ -495,7 +494,7 @@ static struct pci_driver chipsfb_driver = {
495 .name = "chipsfb", 494 .name = "chipsfb",
496 .id_table = chipsfb_pci_tbl, 495 .id_table = chipsfb_pci_tbl,
497 .probe = chipsfb_pci_init, 496 .probe = chipsfb_pci_init,
498 .remove = __devexit_p(chipsfb_remove), 497 .remove = chipsfb_remove,
499#ifdef CONFIG_PM 498#ifdef CONFIG_PM
500 .suspend = chipsfb_pci_suspend, 499 .suspend = chipsfb_pci_suspend,
501 .resume = chipsfb_pci_resume, 500 .resume = chipsfb_pci_resume,
diff --git a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c
index bc67d05cad60..c3dbbe6e3acf 100644
--- a/drivers/video/cirrusfb.c
+++ b/drivers/video/cirrusfb.c
@@ -290,34 +290,34 @@ struct zorrocl {
290 zorro_id ramid2; /* Zorro ID of optional second RAM device */ 290 zorro_id ramid2; /* Zorro ID of optional second RAM device */
291}; 291};
292 292
293static const struct zorrocl zcl_sd64 __devinitconst = { 293static const struct zorrocl zcl_sd64 = {
294 .type = BT_SD64, 294 .type = BT_SD64,
295 .ramid = ZORRO_PROD_HELFRICH_SD64_RAM, 295 .ramid = ZORRO_PROD_HELFRICH_SD64_RAM,
296}; 296};
297 297
298static const struct zorrocl zcl_piccolo __devinitconst = { 298static const struct zorrocl zcl_piccolo = {
299 .type = BT_PICCOLO, 299 .type = BT_PICCOLO,
300 .ramid = ZORRO_PROD_HELFRICH_PICCOLO_RAM, 300 .ramid = ZORRO_PROD_HELFRICH_PICCOLO_RAM,
301}; 301};
302 302
303static const struct zorrocl zcl_picasso __devinitconst = { 303static const struct zorrocl zcl_picasso = {
304 .type = BT_PICASSO, 304 .type = BT_PICASSO,
305 .ramid = ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_RAM, 305 .ramid = ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_RAM,
306}; 306};
307 307
308static const struct zorrocl zcl_spectrum __devinitconst = { 308static const struct zorrocl zcl_spectrum = {
309 .type = BT_SPECTRUM, 309 .type = BT_SPECTRUM,
310 .ramid = ZORRO_PROD_GVP_EGS_28_24_SPECTRUM_RAM, 310 .ramid = ZORRO_PROD_GVP_EGS_28_24_SPECTRUM_RAM,
311}; 311};
312 312
313static const struct zorrocl zcl_picasso4_z3 __devinitconst = { 313static const struct zorrocl zcl_picasso4_z3 = {
314 .type = BT_PICASSO4, 314 .type = BT_PICASSO4,
315 .regoffset = 0x00600000, 315 .regoffset = 0x00600000,
316 .ramsize = 4 * MB_, 316 .ramsize = 4 * MB_,
317 .ramoffset = 0x01000000, /* 0x02000000 for 64 MiB boards */ 317 .ramoffset = 0x01000000, /* 0x02000000 for 64 MiB boards */
318}; 318};
319 319
320static const struct zorrocl zcl_picasso4_z2 __devinitconst = { 320static const struct zorrocl zcl_picasso4_z2 = {
321 .type = BT_PICASSO4, 321 .type = BT_PICASSO4,
322 .regoffset = 0x10000, 322 .regoffset = 0x10000,
323 .ramid = ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_RAM1, 323 .ramid = ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_RAM1,
@@ -325,7 +325,7 @@ static const struct zorrocl zcl_picasso4_z2 __devinitconst = {
325}; 325};
326 326
327 327
328static const struct zorro_device_id cirrusfb_zorro_table[] __devinitconst = { 328static const struct zorro_device_id cirrusfb_zorro_table[] = {
329 { 329 {
330 .id = ZORRO_PROD_HELFRICH_SD64_REG, 330 .id = ZORRO_PROD_HELFRICH_SD64_REG,
331 .driver_data = (unsigned long)&zcl_sd64, 331 .driver_data = (unsigned long)&zcl_sd64,
@@ -372,8 +372,8 @@ struct cirrusfb_info {
372 void (*unmap)(struct fb_info *info); 372 void (*unmap)(struct fb_info *info);
373}; 373};
374 374
375static bool noaccel __devinitdata; 375static bool noaccel;
376static char *mode_option __devinitdata = "640x480@60"; 376static char *mode_option = "640x480@60";
377 377
378/****************************************************************************/ 378/****************************************************************************/
379/**** BEGIN PROTOTYPES ******************************************************/ 379/**** BEGIN PROTOTYPES ******************************************************/
@@ -1892,8 +1892,8 @@ static int release_io_ports;
1892 * based on the DRAM bandwidth bit and DRAM bank switching bit. This 1892 * based on the DRAM bandwidth bit and DRAM bank switching bit. This
1893 * works with 1MB, 2MB and 4MB configurations (which the Motorola boards 1893 * works with 1MB, 2MB and 4MB configurations (which the Motorola boards
1894 * seem to have. */ 1894 * seem to have. */
1895static unsigned int __devinit cirrusfb_get_memsize(struct fb_info *info, 1895static unsigned int cirrusfb_get_memsize(struct fb_info *info,
1896 u8 __iomem *regbase) 1896 u8 __iomem *regbase)
1897{ 1897{
1898 unsigned long mem; 1898 unsigned long mem;
1899 struct cirrusfb_info *cinfo = info->par; 1899 struct cirrusfb_info *cinfo = info->par;
@@ -2003,7 +2003,7 @@ static struct fb_ops cirrusfb_ops = {
2003 .fb_imageblit = cirrusfb_imageblit, 2003 .fb_imageblit = cirrusfb_imageblit,
2004}; 2004};
2005 2005
2006static int __devinit cirrusfb_set_fbinfo(struct fb_info *info) 2006static int cirrusfb_set_fbinfo(struct fb_info *info)
2007{ 2007{
2008 struct cirrusfb_info *cinfo = info->par; 2008 struct cirrusfb_info *cinfo = info->par;
2009 struct fb_var_screeninfo *var = &info->var; 2009 struct fb_var_screeninfo *var = &info->var;
@@ -2052,7 +2052,7 @@ static int __devinit cirrusfb_set_fbinfo(struct fb_info *info)
2052 return 0; 2052 return 0;
2053} 2053}
2054 2054
2055static int __devinit cirrusfb_register(struct fb_info *info) 2055static int cirrusfb_register(struct fb_info *info)
2056{ 2056{
2057 struct cirrusfb_info *cinfo = info->par; 2057 struct cirrusfb_info *cinfo = info->par;
2058 int err; 2058 int err;
@@ -2096,7 +2096,7 @@ err_dealloc_cmap:
2096 return err; 2096 return err;
2097} 2097}
2098 2098
2099static void __devexit cirrusfb_cleanup(struct fb_info *info) 2099static void cirrusfb_cleanup(struct fb_info *info)
2100{ 2100{
2101 struct cirrusfb_info *cinfo = info->par; 2101 struct cirrusfb_info *cinfo = info->par;
2102 2102
@@ -2109,8 +2109,8 @@ static void __devexit cirrusfb_cleanup(struct fb_info *info)
2109} 2109}
2110 2110
2111#ifdef CONFIG_PCI 2111#ifdef CONFIG_PCI
2112static int __devinit cirrusfb_pci_register(struct pci_dev *pdev, 2112static int cirrusfb_pci_register(struct pci_dev *pdev,
2113 const struct pci_device_id *ent) 2113 const struct pci_device_id *ent)
2114{ 2114{
2115 struct cirrusfb_info *cinfo; 2115 struct cirrusfb_info *cinfo;
2116 struct fb_info *info; 2116 struct fb_info *info;
@@ -2215,7 +2215,7 @@ err_out:
2215 return ret; 2215 return ret;
2216} 2216}
2217 2217
2218static void __devexit cirrusfb_pci_unregister(struct pci_dev *pdev) 2218static void cirrusfb_pci_unregister(struct pci_dev *pdev)
2219{ 2219{
2220 struct fb_info *info = pci_get_drvdata(pdev); 2220 struct fb_info *info = pci_get_drvdata(pdev);
2221 2221
@@ -2226,7 +2226,7 @@ static struct pci_driver cirrusfb_pci_driver = {
2226 .name = "cirrusfb", 2226 .name = "cirrusfb",
2227 .id_table = cirrusfb_pci_table, 2227 .id_table = cirrusfb_pci_table,
2228 .probe = cirrusfb_pci_register, 2228 .probe = cirrusfb_pci_register,
2229 .remove = __devexit_p(cirrusfb_pci_unregister), 2229 .remove = cirrusfb_pci_unregister,
2230#ifdef CONFIG_PM 2230#ifdef CONFIG_PM
2231#if 0 2231#if 0
2232 .suspend = cirrusfb_pci_suspend, 2232 .suspend = cirrusfb_pci_suspend,
@@ -2237,8 +2237,8 @@ static struct pci_driver cirrusfb_pci_driver = {
2237#endif /* CONFIG_PCI */ 2237#endif /* CONFIG_PCI */
2238 2238
2239#ifdef CONFIG_ZORRO 2239#ifdef CONFIG_ZORRO
2240static int __devinit cirrusfb_zorro_register(struct zorro_dev *z, 2240static int cirrusfb_zorro_register(struct zorro_dev *z,
2241 const struct zorro_device_id *ent) 2241 const struct zorro_device_id *ent)
2242{ 2242{
2243 struct fb_info *info; 2243 struct fb_info *info;
2244 int error; 2244 int error;
@@ -2352,7 +2352,7 @@ err_release_fb:
2352 return error; 2352 return error;
2353} 2353}
2354 2354
2355void __devexit cirrusfb_zorro_unregister(struct zorro_dev *z) 2355void cirrusfb_zorro_unregister(struct zorro_dev *z)
2356{ 2356{
2357 struct fb_info *info = zorro_get_drvdata(z); 2357 struct fb_info *info = zorro_get_drvdata(z);
2358 2358
@@ -2364,7 +2364,7 @@ static struct zorro_driver cirrusfb_zorro_driver = {
2364 .name = "cirrusfb", 2364 .name = "cirrusfb",
2365 .id_table = cirrusfb_zorro_table, 2365 .id_table = cirrusfb_zorro_table,
2366 .probe = cirrusfb_zorro_register, 2366 .probe = cirrusfb_zorro_register,
2367 .remove = __devexit_p(cirrusfb_zorro_unregister), 2367 .remove = cirrusfb_zorro_unregister,
2368}; 2368};
2369#endif /* CONFIG_ZORRO */ 2369#endif /* CONFIG_ZORRO */
2370 2370
diff --git a/drivers/video/clps711xfb.c b/drivers/video/clps711xfb.c
index 63ecdf8f7baf..5a7af0deced2 100644
--- a/drivers/video/clps711xfb.c
+++ b/drivers/video/clps711xfb.c
@@ -178,7 +178,7 @@ static struct fb_ops clps7111fb_ops = {
178 .fb_imageblit = cfb_imageblit, 178 .fb_imageblit = cfb_imageblit,
179}; 179};
180 180
181static void __devinit clps711x_guess_lcd_params(struct fb_info *info) 181static void clps711x_guess_lcd_params(struct fb_info *info)
182{ 182{
183 unsigned int lcdcon, syscon, size; 183 unsigned int lcdcon, syscon, size;
184 unsigned long phys_base = PAGE_OFFSET; 184 unsigned long phys_base = PAGE_OFFSET;
@@ -266,7 +266,7 @@ static void __devinit clps711x_guess_lcd_params(struct fb_info *info)
266 info->fix.type = FB_TYPE_PACKED_PIXELS; 266 info->fix.type = FB_TYPE_PACKED_PIXELS;
267} 267}
268 268
269static int __devinit clps711x_fb_probe(struct platform_device *pdev) 269static int clps711x_fb_probe(struct platform_device *pdev)
270{ 270{
271 int err = -ENOMEM; 271 int err = -ENOMEM;
272 272
@@ -291,7 +291,7 @@ static int __devinit clps711x_fb_probe(struct platform_device *pdev)
291out: return err; 291out: return err;
292} 292}
293 293
294static int __devexit clps711x_fb_remove(struct platform_device *pdev) 294static int clps711x_fb_remove(struct platform_device *pdev)
295{ 295{
296 unregister_framebuffer(cfb); 296 unregister_framebuffer(cfb);
297 kfree(cfb); 297 kfree(cfb);
@@ -305,7 +305,7 @@ static struct platform_driver clps711x_fb_driver = {
305 .owner = THIS_MODULE, 305 .owner = THIS_MODULE,
306 }, 306 },
307 .probe = clps711x_fb_probe, 307 .probe = clps711x_fb_probe,
308 .remove = __devexit_p(clps711x_fb_remove), 308 .remove = clps711x_fb_remove,
309}; 309};
310module_platform_driver(clps711x_fb_driver); 310module_platform_driver(clps711x_fb_driver);
311 311
diff --git a/drivers/video/cobalt_lcdfb.c b/drivers/video/cobalt_lcdfb.c
index 01a4ee7cc6b1..a9031498e10c 100644
--- a/drivers/video/cobalt_lcdfb.c
+++ b/drivers/video/cobalt_lcdfb.c
@@ -167,7 +167,7 @@ static void lcd_clear(struct fb_info *info)
167 lcd_write_control(info, LCD_RESET); 167 lcd_write_control(info, LCD_RESET);
168} 168}
169 169
170static struct fb_fix_screeninfo cobalt_lcdfb_fix __devinitdata = { 170static struct fb_fix_screeninfo cobalt_lcdfb_fix = {
171 .id = "cobalt-lcd", 171 .id = "cobalt-lcd",
172 .type = FB_TYPE_TEXT, 172 .type = FB_TYPE_TEXT,
173 .type_aux = FB_AUX_TEXT_MDA, 173 .type_aux = FB_AUX_TEXT_MDA,
@@ -331,7 +331,7 @@ static struct fb_ops cobalt_lcd_fbops = {
331 .fb_cursor = cobalt_lcdfb_cursor, 331 .fb_cursor = cobalt_lcdfb_cursor,
332}; 332};
333 333
334static int __devinit cobalt_lcdfb_probe(struct platform_device *dev) 334static int cobalt_lcdfb_probe(struct platform_device *dev)
335{ 335{
336 struct fb_info *info; 336 struct fb_info *info;
337 struct resource *res; 337 struct resource *res;
@@ -374,7 +374,7 @@ static int __devinit cobalt_lcdfb_probe(struct platform_device *dev)
374 return 0; 374 return 0;
375} 375}
376 376
377static int __devexit cobalt_lcdfb_remove(struct platform_device *dev) 377static int cobalt_lcdfb_remove(struct platform_device *dev)
378{ 378{
379 struct fb_info *info; 379 struct fb_info *info;
380 380
@@ -389,7 +389,7 @@ static int __devexit cobalt_lcdfb_remove(struct platform_device *dev)
389 389
390static struct platform_driver cobalt_lcdfb_driver = { 390static struct platform_driver cobalt_lcdfb_driver = {
391 .probe = cobalt_lcdfb_probe, 391 .probe = cobalt_lcdfb_probe,
392 .remove = __devexit_p(cobalt_lcdfb_remove), 392 .remove = cobalt_lcdfb_remove,
393 .driver = { 393 .driver = {
394 .name = "cobalt-lcd", 394 .name = "cobalt-lcd",
395 .owner = THIS_MODULE, 395 .owner = THIS_MODULE,
diff --git a/drivers/video/console/sticore.c b/drivers/video/console/sticore.c
index 39571f9e0162..35687fd56456 100644
--- a/drivers/video/console/sticore.c
+++ b/drivers/video/console/sticore.c
@@ -238,8 +238,7 @@ static void sti_flush(unsigned long start, unsigned long end)
238 flush_icache_range(start, end); 238 flush_icache_range(start, end);
239} 239}
240 240
241static void __devinit sti_rom_copy(unsigned long base, unsigned long count, 241static void sti_rom_copy(unsigned long base, unsigned long count, void *dest)
242 void *dest)
243{ 242{
244 unsigned long dest_start = (unsigned long) dest; 243 unsigned long dest_start = (unsigned long) dest;
245 244
@@ -266,7 +265,7 @@ static void __devinit sti_rom_copy(unsigned long base, unsigned long count,
266static char default_sti_path[21] __read_mostly; 265static char default_sti_path[21] __read_mostly;
267 266
268#ifndef MODULE 267#ifndef MODULE
269static int __devinit sti_setup(char *str) 268static int sti_setup(char *str)
270{ 269{
271 if (str) 270 if (str)
272 strlcpy (default_sti_path, str, sizeof (default_sti_path)); 271 strlcpy (default_sti_path, str, sizeof (default_sti_path));
@@ -285,12 +284,12 @@ __setup("sti=", sti_setup);
285 284
286 285
287 286
288static char __devinitdata *font_name[MAX_STI_ROMS] = { "VGA8x16", }; 287static char *font_name[MAX_STI_ROMS] = { "VGA8x16", };
289static int __devinitdata font_index[MAX_STI_ROMS], 288static int font_index[MAX_STI_ROMS],
290 font_height[MAX_STI_ROMS], 289 font_height[MAX_STI_ROMS],
291 font_width[MAX_STI_ROMS]; 290 font_width[MAX_STI_ROMS];
292#ifndef MODULE 291#ifndef MODULE
293static int __devinit sti_font_setup(char *str) 292static int sti_font_setup(char *str)
294{ 293{
295 char *x; 294 char *x;
296 int i = 0; 295 int i = 0;
@@ -343,8 +342,8 @@ __setup("sti_font=", sti_font_setup);
343 342
344 343
345 344
346static void __devinit 345static void sti_dump_globcfg(struct sti_glob_cfg *glob_cfg,
347sti_dump_globcfg(struct sti_glob_cfg *glob_cfg, unsigned int sti_mem_request) 346 unsigned int sti_mem_request)
348{ 347{
349 struct sti_glob_cfg_ext *cfg; 348 struct sti_glob_cfg_ext *cfg;
350 349
@@ -383,8 +382,7 @@ sti_dump_globcfg(struct sti_glob_cfg *glob_cfg, unsigned int sti_mem_request)
383 cfg->sti_mem_addr, sti_mem_request)); 382 cfg->sti_mem_addr, sti_mem_request));
384} 383}
385 384
386static void __devinit 385static void sti_dump_outptr(struct sti_struct *sti)
387sti_dump_outptr(struct sti_struct *sti)
388{ 386{
389 DPRINTK((KERN_INFO 387 DPRINTK((KERN_INFO
390 "%d bits per pixel\n" 388 "%d bits per pixel\n"
@@ -397,9 +395,8 @@ sti_dump_outptr(struct sti_struct *sti)
397 sti->outptr.attributes)); 395 sti->outptr.attributes));
398} 396}
399 397
400static int __devinit 398static int sti_init_glob_cfg(struct sti_struct *sti, unsigned long rom_address,
401sti_init_glob_cfg(struct sti_struct *sti, 399 unsigned long hpa)
402 unsigned long rom_address, unsigned long hpa)
403{ 400{
404 struct sti_glob_cfg *glob_cfg; 401 struct sti_glob_cfg *glob_cfg;
405 struct sti_glob_cfg_ext *glob_cfg_ext; 402 struct sti_glob_cfg_ext *glob_cfg_ext;
@@ -479,8 +476,8 @@ sti_init_glob_cfg(struct sti_struct *sti,
479} 476}
480 477
481#ifdef CONFIG_FB 478#ifdef CONFIG_FB
482static struct sti_cooked_font __devinit 479static struct sti_cooked_font *
483*sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name) 480sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name)
484{ 481{
485 const struct font_desc *fbfont; 482 const struct font_desc *fbfont;
486 unsigned int size, bpc; 483 unsigned int size, bpc;
@@ -535,16 +532,15 @@ static struct sti_cooked_font __devinit
535 return cooked_font; 532 return cooked_font;
536} 533}
537#else 534#else
538static struct sti_cooked_font __devinit 535static struct sti_cooked_font *
539*sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name) 536sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name)
540{ 537{
541 return NULL; 538 return NULL;
542} 539}
543#endif 540#endif
544 541
545static struct sti_cooked_font __devinit 542static struct sti_cooked_font *sti_select_font(struct sti_cooked_rom *rom,
546*sti_select_font(struct sti_cooked_rom *rom, 543 int (*search_font_fnc)(struct sti_cooked_rom *, int, int))
547 int (*search_font_fnc)(struct sti_cooked_rom *, int, int))
548{ 544{
549 struct sti_cooked_font *font; 545 struct sti_cooked_font *font;
550 int i; 546 int i;
@@ -569,8 +565,7 @@ static struct sti_cooked_font __devinit
569} 565}
570 566
571 567
572static void __devinit 568static void sti_dump_rom(struct sti_rom *rom)
573sti_dump_rom(struct sti_rom *rom)
574{ 569{
575 printk(KERN_INFO " id %04x-%04x, conforms to spec rev. %d.%02x\n", 570 printk(KERN_INFO " id %04x-%04x, conforms to spec rev. %d.%02x\n",
576 rom->graphics_id[0], 571 rom->graphics_id[0],
@@ -587,9 +582,8 @@ sti_dump_rom(struct sti_rom *rom)
587} 582}
588 583
589 584
590static int __devinit 585static int sti_cook_fonts(struct sti_cooked_rom *cooked_rom,
591sti_cook_fonts(struct sti_cooked_rom *cooked_rom, 586 struct sti_rom *raw_rom)
592 struct sti_rom *raw_rom)
593{ 587{
594 struct sti_rom_font *raw_font, *font_start; 588 struct sti_rom_font *raw_font, *font_start;
595 struct sti_cooked_font *cooked_font; 589 struct sti_cooked_font *cooked_font;
@@ -622,8 +616,7 @@ sti_cook_fonts(struct sti_cooked_rom *cooked_rom,
622} 616}
623 617
624 618
625static int __devinit 619static int sti_search_font(struct sti_cooked_rom *rom, int height, int width)
626sti_search_font(struct sti_cooked_rom *rom, int height, int width)
627{ 620{
628 struct sti_cooked_font *font; 621 struct sti_cooked_font *font;
629 int i = 0; 622 int i = 0;
@@ -639,8 +632,7 @@ sti_search_font(struct sti_cooked_rom *rom, int height, int width)
639#define BMODE_RELOCATE(offset) offset = (offset) / 4; 632#define BMODE_RELOCATE(offset) offset = (offset) / 4;
640#define BMODE_LAST_ADDR_OFFS 0x50 633#define BMODE_LAST_ADDR_OFFS 0x50
641 634
642static void * __devinit 635static void *sti_bmode_font_raw(struct sti_cooked_font *f)
643sti_bmode_font_raw(struct sti_cooked_font *f)
644{ 636{
645 unsigned char *n, *p, *q; 637 unsigned char *n, *p, *q;
646 int size = f->raw->bytes_per_char*256+sizeof(struct sti_rom_font); 638 int size = f->raw->bytes_per_char*256+sizeof(struct sti_rom_font);
@@ -657,8 +649,8 @@ sti_bmode_font_raw(struct sti_cooked_font *f)
657 return n + 3; 649 return n + 3;
658} 650}
659 651
660static void __devinit 652static void sti_bmode_rom_copy(unsigned long base, unsigned long count,
661sti_bmode_rom_copy(unsigned long base, unsigned long count, void *dest) 653 void *dest)
662{ 654{
663 unsigned long dest_start = (unsigned long) dest; 655 unsigned long dest_start = (unsigned long) dest;
664 656
@@ -672,8 +664,7 @@ sti_bmode_rom_copy(unsigned long base, unsigned long count, void *dest)
672 sti_flush(dest_start, (unsigned long)dest); 664 sti_flush(dest_start, (unsigned long)dest);
673} 665}
674 666
675static struct sti_rom * __devinit 667static struct sti_rom *sti_get_bmode_rom (unsigned long address)
676sti_get_bmode_rom (unsigned long address)
677{ 668{
678 struct sti_rom *raw; 669 struct sti_rom *raw;
679 u32 size; 670 u32 size;
@@ -708,7 +699,7 @@ sti_get_bmode_rom (unsigned long address)
708 return raw; 699 return raw;
709} 700}
710 701
711static struct sti_rom __devinit *sti_get_wmode_rom(unsigned long address) 702static struct sti_rom *sti_get_wmode_rom(unsigned long address)
712{ 703{
713 struct sti_rom *raw; 704 struct sti_rom *raw;
714 unsigned long size; 705 unsigned long size;
@@ -723,8 +714,8 @@ static struct sti_rom __devinit *sti_get_wmode_rom(unsigned long address)
723 return raw; 714 return raw;
724} 715}
725 716
726static int __devinit sti_read_rom(int wordmode, struct sti_struct *sti, 717static int sti_read_rom(int wordmode, struct sti_struct *sti,
727 unsigned long address) 718 unsigned long address)
728{ 719{
729 struct sti_cooked_rom *cooked; 720 struct sti_cooked_rom *cooked;
730 struct sti_rom *raw = NULL; 721 struct sti_rom *raw = NULL;
@@ -806,8 +797,9 @@ out_err:
806 return 0; 797 return 0;
807} 798}
808 799
809static struct sti_struct * __devinit 800static struct sti_struct *sti_try_rom_generic(unsigned long address,
810sti_try_rom_generic(unsigned long address, unsigned long hpa, struct pci_dev *pd) 801 unsigned long hpa,
802 struct pci_dev *pd)
811{ 803{
812 struct sti_struct *sti; 804 struct sti_struct *sti;
813 int ok; 805 int ok;
@@ -921,7 +913,7 @@ out_err:
921 return NULL; 913 return NULL;
922} 914}
923 915
924static void __devinit sticore_check_for_default_sti(struct sti_struct *sti, char *path) 916static void sticore_check_for_default_sti(struct sti_struct *sti, char *path)
925{ 917{
926 if (strcmp (path, default_sti_path) == 0) 918 if (strcmp (path, default_sti_path) == 0)
927 default_sti = sti; 919 default_sti = sti;
@@ -932,7 +924,7 @@ static void __devinit sticore_check_for_default_sti(struct sti_struct *sti, char
932 * in the additional address field addr[1] while on 924 * in the additional address field addr[1] while on
933 * older Systems the PDC stores it in page0->proc_sti 925 * older Systems the PDC stores it in page0->proc_sti
934 */ 926 */
935static int __devinit sticore_pa_init(struct parisc_device *dev) 927static int sticore_pa_init(struct parisc_device *dev)
936{ 928{
937 char pa_path[21]; 929 char pa_path[21];
938 struct sti_struct *sti = NULL; 930 struct sti_struct *sti = NULL;
@@ -953,8 +945,7 @@ static int __devinit sticore_pa_init(struct parisc_device *dev)
953} 945}
954 946
955 947
956static int __devinit sticore_pci_init(struct pci_dev *pd, 948static int sticore_pci_init(struct pci_dev *pd, const struct pci_device_id *ent)
957 const struct pci_device_id *ent)
958{ 949{
959#ifdef CONFIG_PCI 950#ifdef CONFIG_PCI
960 unsigned long fb_base, rom_base; 951 unsigned long fb_base, rom_base;
@@ -1001,7 +992,7 @@ static int __devinit sticore_pci_init(struct pci_dev *pd,
1001} 992}
1002 993
1003 994
1004static void __devexit sticore_pci_remove(struct pci_dev *pd) 995static void sticore_pci_remove(struct pci_dev *pd)
1005{ 996{
1006 BUG(); 997 BUG();
1007} 998}
@@ -1043,7 +1034,7 @@ static struct parisc_driver pa_sti_driver = {
1043 1034
1044static int sticore_initialized __read_mostly; 1035static int sticore_initialized __read_mostly;
1045 1036
1046static void __devinit sti_init_roms(void) 1037static void sti_init_roms(void)
1047{ 1038{
1048 if (sticore_initialized) 1039 if (sticore_initialized)
1049 return; 1040 return;
diff --git a/drivers/video/cyber2000fb.c b/drivers/video/cyber2000fb.c
index e40125cb313e..57886787ead0 100644
--- a/drivers/video/cyber2000fb.c
+++ b/drivers/video/cyber2000fb.c
@@ -1230,7 +1230,7 @@ static int cyber2000fb_ddc_getsda(void *data)
1230 return retval; 1230 return retval;
1231} 1231}
1232 1232
1233static int __devinit cyber2000fb_setup_ddc_bus(struct cfb_info *cfb) 1233static int cyber2000fb_setup_ddc_bus(struct cfb_info *cfb)
1234{ 1234{
1235 strlcpy(cfb->ddc_adapter.name, cfb->fb.fix.id, 1235 strlcpy(cfb->ddc_adapter.name, cfb->fb.fix.id,
1236 sizeof(cfb->ddc_adapter.name)); 1236 sizeof(cfb->ddc_adapter.name));
@@ -1305,7 +1305,7 @@ static int cyber2000fb_i2c_getscl(void *data)
1305 return ret; 1305 return ret;
1306} 1306}
1307 1307
1308static int __devinit cyber2000fb_i2c_register(struct cfb_info *cfb) 1308static int cyber2000fb_i2c_register(struct cfb_info *cfb)
1309{ 1309{
1310 strlcpy(cfb->i2c_adapter.name, cfb->fb.fix.id, 1310 strlcpy(cfb->i2c_adapter.name, cfb->fb.fix.id,
1311 sizeof(cfb->i2c_adapter.name)); 1311 sizeof(cfb->i2c_adapter.name));
@@ -1336,7 +1336,7 @@ static void cyber2000fb_i2c_unregister(struct cfb_info *cfb)
1336 * These parameters give 1336 * These parameters give
1337 * 640x480, hsync 31.5kHz, vsync 60Hz 1337 * 640x480, hsync 31.5kHz, vsync 60Hz
1338 */ 1338 */
1339static struct fb_videomode __devinitdata cyber2000fb_default_mode = { 1339static struct fb_videomode cyber2000fb_default_mode = {
1340 .refresh = 60, 1340 .refresh = 60,
1341 .xres = 640, 1341 .xres = 640,
1342 .yres = 480, 1342 .yres = 480,
@@ -1404,8 +1404,7 @@ static void cyberpro_init_hw(struct cfb_info *cfb)
1404 } 1404 }
1405} 1405}
1406 1406
1407static struct cfb_info __devinit *cyberpro_alloc_fb_info(unsigned int id, 1407static struct cfb_info *cyberpro_alloc_fb_info(unsigned int id, char *name)
1408 char *name)
1409{ 1408{
1410 struct cfb_info *cfb; 1409 struct cfb_info *cfb;
1411 1410
@@ -1524,7 +1523,7 @@ static int cyber2000fb_setup(char *options)
1524 * - memory mapped access to the registers 1523 * - memory mapped access to the registers
1525 * - initialised mem_ctl1 and mem_ctl2 appropriately. 1524 * - initialised mem_ctl1 and mem_ctl2 appropriately.
1526 */ 1525 */
1527static int __devinit cyberpro_common_probe(struct cfb_info *cfb) 1526static int cyberpro_common_probe(struct cfb_info *cfb)
1528{ 1527{
1529 u_long smem_size; 1528 u_long smem_size;
1530 u_int h_sync, v_sync; 1529 u_int h_sync, v_sync;
@@ -1615,7 +1614,7 @@ failed:
1615 return err; 1614 return err;
1616} 1615}
1617 1616
1618static void __devexit cyberpro_common_remove(struct cfb_info *cfb) 1617static void cyberpro_common_remove(struct cfb_info *cfb)
1619{ 1618{
1620 unregister_framebuffer(&cfb->fb); 1619 unregister_framebuffer(&cfb->fb);
1621#ifdef CONFIG_FB_CYBER2000_DDC 1620#ifdef CONFIG_FB_CYBER2000_DDC
@@ -1646,7 +1645,7 @@ static void cyberpro_common_resume(struct cfb_info *cfb)
1646 1645
1647#include <mach/framebuffer.h> 1646#include <mach/framebuffer.h>
1648 1647
1649static int __devinit cyberpro_vl_probe(void) 1648static int cyberpro_vl_probe(void)
1650{ 1649{
1651 struct cfb_info *cfb; 1650 struct cfb_info *cfb;
1652 int err = -ENOMEM; 1651 int err = -ENOMEM;
@@ -1780,8 +1779,8 @@ static int cyberpro_pci_enable_mmio(struct cfb_info *cfb)
1780 return 0; 1779 return 0;
1781} 1780}
1782 1781
1783static int __devinit 1782static int cyberpro_pci_probe(struct pci_dev *dev,
1784cyberpro_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) 1783 const struct pci_device_id *id)
1785{ 1784{
1786 struct cfb_info *cfb; 1785 struct cfb_info *cfb;
1787 char name[16]; 1786 char name[16];
@@ -1863,7 +1862,7 @@ failed_release:
1863 return err; 1862 return err;
1864} 1863}
1865 1864
1866static void __devexit cyberpro_pci_remove(struct pci_dev *dev) 1865static void cyberpro_pci_remove(struct pci_dev *dev)
1867{ 1866{
1868 struct cfb_info *cfb = pci_get_drvdata(dev); 1867 struct cfb_info *cfb = pci_get_drvdata(dev);
1869 1868
@@ -1923,7 +1922,7 @@ MODULE_DEVICE_TABLE(pci, cyberpro_pci_table);
1923static struct pci_driver cyberpro_driver = { 1922static struct pci_driver cyberpro_driver = {
1924 .name = "CyberPro", 1923 .name = "CyberPro",
1925 .probe = cyberpro_pci_probe, 1924 .probe = cyberpro_pci_probe,
1926 .remove = __devexit_p(cyberpro_pci_remove), 1925 .remove = cyberpro_pci_remove,
1927 .suspend = cyberpro_pci_suspend, 1926 .suspend = cyberpro_pci_suspend,
1928 .resume = cyberpro_pci_resume, 1927 .resume = cyberpro_pci_resume,
1929 .id_table = cyberpro_pci_table 1928 .id_table = cyberpro_pci_table
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 46534e00fe01..0810939936f4 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -185,7 +185,7 @@ struct da8xx_fb_par {
185}; 185};
186 186
187/* Variable Screen Information */ 187/* Variable Screen Information */
188static struct fb_var_screeninfo da8xx_fb_var __devinitdata = { 188static struct fb_var_screeninfo da8xx_fb_var = {
189 .xoffset = 0, 189 .xoffset = 0,
190 .yoffset = 0, 190 .yoffset = 0,
191 .transp = {0, 0, 0}, 191 .transp = {0, 0, 0},
@@ -202,7 +202,7 @@ static struct fb_var_screeninfo da8xx_fb_var __devinitdata = {
202 .vmode = FB_VMODE_NONINTERLACED 202 .vmode = FB_VMODE_NONINTERLACED
203}; 203};
204 204
205static struct fb_fix_screeninfo da8xx_fb_fix __devinitdata = { 205static struct fb_fix_screeninfo da8xx_fb_fix = {
206 .id = "DA8xx FB Drv", 206 .id = "DA8xx FB Drv",
207 .type = FB_TYPE_PACKED_PIXELS, 207 .type = FB_TYPE_PACKED_PIXELS,
208 .type_aux = 0, 208 .type_aux = 0,
@@ -993,7 +993,7 @@ static inline void lcd_da8xx_cpufreq_deregister(struct da8xx_fb_par *par)
993} 993}
994#endif 994#endif
995 995
996static int __devexit fb_remove(struct platform_device *dev) 996static int fb_remove(struct platform_device *dev)
997{ 997{
998 struct fb_info *info = dev_get_drvdata(&dev->dev); 998 struct fb_info *info = dev_get_drvdata(&dev->dev);
999 999
@@ -1211,7 +1211,7 @@ static unsigned int da8xxfb_pixel_clk_period(struct da8xx_fb_par *par)
1211 return pix_clk_period_picosec; 1211 return pix_clk_period_picosec;
1212} 1212}
1213 1213
1214static int __devinit fb_probe(struct platform_device *device) 1214static int fb_probe(struct platform_device *device)
1215{ 1215{
1216 struct da8xx_lcdc_platform_data *fb_pdata = 1216 struct da8xx_lcdc_platform_data *fb_pdata =
1217 device->dev.platform_data; 1217 device->dev.platform_data;
@@ -1580,7 +1580,7 @@ static int fb_resume(struct platform_device *dev)
1580 1580
1581static struct platform_driver da8xx_fb_driver = { 1581static struct platform_driver da8xx_fb_driver = {
1582 .probe = fb_probe, 1582 .probe = fb_probe,
1583 .remove = __devexit_p(fb_remove), 1583 .remove = fb_remove,
1584 .suspend = fb_suspend, 1584 .suspend = fb_suspend,
1585 .resume = fb_resume, 1585 .resume = fb_resume,
1586 .driver = { 1586 .driver = {
diff --git a/drivers/video/dnfb.c b/drivers/video/dnfb.c
index 49e3dda1a361..3526899da61b 100644
--- a/drivers/video/dnfb.c
+++ b/drivers/video/dnfb.c
@@ -115,7 +115,7 @@ static struct fb_ops dn_fb_ops = {
115 .fb_imageblit = cfb_imageblit, 115 .fb_imageblit = cfb_imageblit,
116}; 116};
117 117
118struct fb_var_screeninfo dnfb_var __devinitdata = { 118struct fb_var_screeninfo dnfb_var = {
119 .xres = 1280, 119 .xres = 1280,
120 .yres = 1024, 120 .yres = 1024,
121 .xres_virtual = 2048, 121 .xres_virtual = 2048,
@@ -126,7 +126,7 @@ struct fb_var_screeninfo dnfb_var __devinitdata = {
126 .vmode = FB_VMODE_NONINTERLACED, 126 .vmode = FB_VMODE_NONINTERLACED,
127}; 127};
128 128
129static struct fb_fix_screeninfo dnfb_fix __devinitdata = { 129static struct fb_fix_screeninfo dnfb_fix = {
130 .id = "Apollo Mono", 130 .id = "Apollo Mono",
131 .smem_start = (FRAME_BUFFER_START + IO_BASE), 131 .smem_start = (FRAME_BUFFER_START + IO_BASE),
132 .smem_len = FRAME_BUFFER_LEN, 132 .smem_len = FRAME_BUFFER_LEN,
@@ -224,7 +224,7 @@ void dnfb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
224 * Initialization 224 * Initialization
225 */ 225 */
226 226
227static int __devinit dnfb_probe(struct platform_device *dev) 227static int dnfb_probe(struct platform_device *dev)
228{ 228{
229 struct fb_info *info; 229 struct fb_info *info;
230 int err = 0; 230 int err = 0;
diff --git a/drivers/video/efifb.c b/drivers/video/efifb.c
index 932abaa58a89..50fe668c6172 100644
--- a/drivers/video/efifb.c
+++ b/drivers/video/efifb.c
@@ -20,7 +20,7 @@ static bool request_mem_succeeded = false;
20 20
21static struct pci_dev *default_vga; 21static struct pci_dev *default_vga;
22 22
23static struct fb_var_screeninfo efifb_defined __devinitdata = { 23static struct fb_var_screeninfo efifb_defined = {
24 .activate = FB_ACTIVATE_NOW, 24 .activate = FB_ACTIVATE_NOW,
25 .height = -1, 25 .height = -1,
26 .width = -1, 26 .width = -1,
@@ -31,7 +31,7 @@ static struct fb_var_screeninfo efifb_defined __devinitdata = {
31 .vmode = FB_VMODE_NONINTERLACED, 31 .vmode = FB_VMODE_NONINTERLACED,
32}; 32};
33 33
34static struct fb_fix_screeninfo efifb_fix __devinitdata = { 34static struct fb_fix_screeninfo efifb_fix = {
35 .id = "EFI VGA", 35 .id = "EFI VGA",
36 .type = FB_TYPE_PACKED_PIXELS, 36 .type = FB_TYPE_PACKED_PIXELS,
37 .accel = FB_ACCEL_NONE, 37 .accel = FB_ACCEL_NONE,
diff --git a/drivers/video/ep93xx-fb.c b/drivers/video/ep93xx-fb.c
index 755ef3e65caf..3f2519d30715 100644
--- a/drivers/video/ep93xx-fb.c
+++ b/drivers/video/ep93xx-fb.c
@@ -484,7 +484,7 @@ static void ep93xxfb_dealloc_videomem(struct fb_info *info)
484 info->screen_base, info->fix.smem_start); 484 info->screen_base, info->fix.smem_start);
485} 485}
486 486
487static int __devinit ep93xxfb_probe(struct platform_device *pdev) 487static int ep93xxfb_probe(struct platform_device *pdev)
488{ 488{
489 struct ep93xxfb_mach_info *mach_info = pdev->dev.platform_data; 489 struct ep93xxfb_mach_info *mach_info = pdev->dev.platform_data;
490 struct fb_info *info; 490 struct fb_info *info;
@@ -599,7 +599,7 @@ failed_cmap:
599 return err; 599 return err;
600} 600}
601 601
602static int __devexit ep93xxfb_remove(struct platform_device *pdev) 602static int ep93xxfb_remove(struct platform_device *pdev)
603{ 603{
604 struct fb_info *info = platform_get_drvdata(pdev); 604 struct fb_info *info = platform_get_drvdata(pdev);
605 struct ep93xx_fbi *fbi = info->par; 605 struct ep93xx_fbi *fbi = info->par;
@@ -620,14 +620,14 @@ static int __devexit ep93xxfb_remove(struct platform_device *pdev)
620 620
621static struct platform_driver ep93xxfb_driver = { 621static struct platform_driver ep93xxfb_driver = {
622 .probe = ep93xxfb_probe, 622 .probe = ep93xxfb_probe,
623 .remove = __devexit_p(ep93xxfb_remove), 623 .remove = ep93xxfb_remove,
624 .driver = { 624 .driver = {
625 .name = "ep93xx-fb", 625 .name = "ep93xx-fb",
626 .owner = THIS_MODULE, 626 .owner = THIS_MODULE,
627 }, 627 },
628}; 628};
629 629
630static int __devinit ep93xxfb_init(void) 630static int ep93xxfb_init(void)
631{ 631{
632 return platform_driver_register(&ep93xxfb_driver); 632 return platform_driver_register(&ep93xxfb_driver);
633} 633}
diff --git a/drivers/video/exynos/exynos_dp_core.c b/drivers/video/exynos/exynos_dp_core.c
index 28fd686c6b81..4ef18e2e90cc 100644
--- a/drivers/video/exynos/exynos_dp_core.c
+++ b/drivers/video/exynos/exynos_dp_core.c
@@ -1033,7 +1033,7 @@ static void exynos_dp_phy_exit(struct exynos_dp_device *dp)
1033} 1033}
1034#endif /* CONFIG_OF */ 1034#endif /* CONFIG_OF */
1035 1035
1036static int __devinit exynos_dp_probe(struct platform_device *pdev) 1036static int exynos_dp_probe(struct platform_device *pdev)
1037{ 1037{
1038 struct resource *res; 1038 struct resource *res;
1039 struct exynos_dp_device *dp; 1039 struct exynos_dp_device *dp;
@@ -1114,7 +1114,7 @@ static int __devinit exynos_dp_probe(struct platform_device *pdev)
1114 return 0; 1114 return 0;
1115} 1115}
1116 1116
1117static int __devexit exynos_dp_remove(struct platform_device *pdev) 1117static int exynos_dp_remove(struct platform_device *pdev)
1118{ 1118{
1119 struct exynos_dp_platdata *pdata = pdev->dev.platform_data; 1119 struct exynos_dp_platdata *pdata = pdev->dev.platform_data;
1120 struct exynos_dp_device *dp = platform_get_drvdata(pdev); 1120 struct exynos_dp_device *dp = platform_get_drvdata(pdev);
@@ -1195,7 +1195,7 @@ MODULE_DEVICE_TABLE(of, exynos_dp_match);
1195 1195
1196static struct platform_driver exynos_dp_driver = { 1196static struct platform_driver exynos_dp_driver = {
1197 .probe = exynos_dp_probe, 1197 .probe = exynos_dp_probe,
1198 .remove = __devexit_p(exynos_dp_remove), 1198 .remove = exynos_dp_remove,
1199 .driver = { 1199 .driver = {
1200 .name = "exynos-dp", 1200 .name = "exynos-dp",
1201 .owner = THIS_MODULE, 1201 .owner = THIS_MODULE,
diff --git a/drivers/video/exynos/exynos_mipi_dsi.c b/drivers/video/exynos/exynos_mipi_dsi.c
index 07d70a3a628b..4a17cdccef34 100644
--- a/drivers/video/exynos/exynos_mipi_dsi.c
+++ b/drivers/video/exynos/exynos_mipi_dsi.c
@@ -490,7 +490,7 @@ err_platform_get_irq:
490 return ret; 490 return ret;
491} 491}
492 492
493static int __devexit exynos_mipi_dsi_remove(struct platform_device *pdev) 493static int exynos_mipi_dsi_remove(struct platform_device *pdev)
494{ 494{
495 struct mipi_dsim_device *dsim = platform_get_drvdata(pdev); 495 struct mipi_dsim_device *dsim = platform_get_drvdata(pdev);
496 struct mipi_dsim_ddi *dsim_ddi, *next; 496 struct mipi_dsim_ddi *dsim_ddi, *next;
@@ -595,7 +595,7 @@ static const struct dev_pm_ops exynos_mipi_dsi_pm_ops = {
595 595
596static struct platform_driver exynos_mipi_dsi_driver = { 596static struct platform_driver exynos_mipi_dsi_driver = {
597 .probe = exynos_mipi_dsi_probe, 597 .probe = exynos_mipi_dsi_probe,
598 .remove = __devexit_p(exynos_mipi_dsi_remove), 598 .remove = exynos_mipi_dsi_remove,
599 .driver = { 599 .driver = {
600 .name = "exynos-mipi-dsim", 600 .name = "exynos-mipi-dsim",
601 .owner = THIS_MODULE, 601 .owner = THIS_MODULE,
diff --git a/drivers/video/ffb.c b/drivers/video/ffb.c
index 14102a3f70f5..6d2744794dd1 100644
--- a/drivers/video/ffb.c
+++ b/drivers/video/ffb.c
@@ -893,7 +893,7 @@ static void ffb_init_fix(struct fb_info *info)
893 info->fix.accel = FB_ACCEL_SUN_CREATOR; 893 info->fix.accel = FB_ACCEL_SUN_CREATOR;
894} 894}
895 895
896static int __devinit ffb_probe(struct platform_device *op) 896static int ffb_probe(struct platform_device *op)
897{ 897{
898 struct device_node *dp = op->dev.of_node; 898 struct device_node *dp = op->dev.of_node;
899 struct ffb_fbc __iomem *fbc; 899 struct ffb_fbc __iomem *fbc;
@@ -1022,7 +1022,7 @@ out_err:
1022 return err; 1022 return err;
1023} 1023}
1024 1024
1025static int __devexit ffb_remove(struct platform_device *op) 1025static int ffb_remove(struct platform_device *op)
1026{ 1026{
1027 struct fb_info *info = dev_get_drvdata(&op->dev); 1027 struct fb_info *info = dev_get_drvdata(&op->dev);
1028 struct ffb_par *par = info->par; 1028 struct ffb_par *par = info->par;
@@ -1058,7 +1058,7 @@ static struct platform_driver ffb_driver = {
1058 .of_match_table = ffb_match, 1058 .of_match_table = ffb_match,
1059 }, 1059 },
1060 .probe = ffb_probe, 1060 .probe = ffb_probe,
1061 .remove = __devexit_p(ffb_remove), 1061 .remove = ffb_remove,
1062}; 1062};
1063 1063
1064static int __init ffb_init(void) 1064static int __init ffb_init(void)
diff --git a/drivers/video/fm2fb.c b/drivers/video/fm2fb.c
index d0533b7aad79..c99c9671302b 100644
--- a/drivers/video/fm2fb.c
+++ b/drivers/video/fm2fb.c
@@ -127,7 +127,7 @@
127 127
128static volatile unsigned char *fm2fb_reg; 128static volatile unsigned char *fm2fb_reg;
129 129
130static struct fb_fix_screeninfo fb_fix __devinitdata = { 130static struct fb_fix_screeninfo fb_fix = {
131 .smem_len = FRAMEMASTER_REG, 131 .smem_len = FRAMEMASTER_REG,
132 .type = FB_TYPE_PACKED_PIXELS, 132 .type = FB_TYPE_PACKED_PIXELS,
133 .visual = FB_VISUAL_TRUECOLOR, 133 .visual = FB_VISUAL_TRUECOLOR,
@@ -136,12 +136,12 @@ static struct fb_fix_screeninfo fb_fix __devinitdata = {
136 .accel = FB_ACCEL_NONE, 136 .accel = FB_ACCEL_NONE,
137}; 137};
138 138
139static int fm2fb_mode __devinitdata = -1; 139static int fm2fb_mode = -1;
140 140
141#define FM2FB_MODE_PAL 0 141#define FM2FB_MODE_PAL 0
142#define FM2FB_MODE_NTSC 1 142#define FM2FB_MODE_NTSC 1
143 143
144static struct fb_var_screeninfo fb_var_modes[] __devinitdata = { 144static struct fb_var_screeninfo fb_var_modes[] = {
145 { 145 {
146 /* 768 x 576, 32 bpp (PAL) */ 146 /* 768 x 576, 32 bpp (PAL) */
147 768, 576, 768, 576, 0, 0, 32, 0, 147 768, 576, 768, 576, 0, 0, 32, 0,
@@ -211,10 +211,9 @@ static int fm2fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
211 * Initialisation 211 * Initialisation
212 */ 212 */
213 213
214static int __devinit fm2fb_probe(struct zorro_dev *z, 214static int fm2fb_probe(struct zorro_dev *z, const struct zorro_device_id *id);
215 const struct zorro_device_id *id);
216 215
217static struct zorro_device_id fm2fb_devices[] __devinitdata = { 216static struct zorro_device_id fm2fb_devices[] = {
218 { ZORRO_PROD_BSC_FRAMEMASTER_II }, 217 { ZORRO_PROD_BSC_FRAMEMASTER_II },
219 { ZORRO_PROD_HELFRICH_RAINBOW_II }, 218 { ZORRO_PROD_HELFRICH_RAINBOW_II },
220 { 0 } 219 { 0 }
@@ -227,8 +226,7 @@ static struct zorro_driver fm2fb_driver = {
227 .probe = fm2fb_probe, 226 .probe = fm2fb_probe,
228}; 227};
229 228
230static int __devinit fm2fb_probe(struct zorro_dev *z, 229static int fm2fb_probe(struct zorro_dev *z, const struct zorro_device_id *id)
231 const struct zorro_device_id *id)
232{ 230{
233 struct fb_info *info; 231 struct fb_info *info;
234 unsigned long *ptr; 232 unsigned long *ptr;
diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c
index d3fc92eaee89..19cfd7a92563 100644
--- a/drivers/video/fsl-diu-fb.c
+++ b/drivers/video/fsl-diu-fb.c
@@ -55,7 +55,7 @@
55 * order if increasing resolution and frequency. The 320x240-60 mode is 55 * order if increasing resolution and frequency. The 320x240-60 mode is
56 * the initial AOI for the second and third planes. 56 * the initial AOI for the second and third planes.
57 */ 57 */
58static struct fb_videomode __devinitdata fsl_diu_mode_db[] = { 58static struct fb_videomode fsl_diu_mode_db[] = {
59 { 59 {
60 .refresh = 60, 60 .refresh = 60,
61 .xres = 1024, 61 .xres = 1024,
@@ -1307,7 +1307,7 @@ static struct fb_ops fsl_diu_ops = {
1307 .fb_release = fsl_diu_release, 1307 .fb_release = fsl_diu_release,
1308}; 1308};
1309 1309
1310static int __devinit install_fb(struct fb_info *info) 1310static int install_fb(struct fb_info *info)
1311{ 1311{
1312 int rc; 1312 int rc;
1313 struct mfb_info *mfbi = info->par; 1313 struct mfb_info *mfbi = info->par;
@@ -1518,7 +1518,7 @@ static ssize_t show_monitor(struct device *device,
1518 return 0; 1518 return 0;
1519} 1519}
1520 1520
1521static int __devinit fsl_diu_probe(struct platform_device *pdev) 1521static int fsl_diu_probe(struct platform_device *pdev)
1522{ 1522{
1523 struct device_node *np = pdev->dev.of_node; 1523 struct device_node *np = pdev->dev.of_node;
1524 struct mfb_info *mfbi; 1524 struct mfb_info *mfbi;
diff --git a/drivers/video/gbefb.c b/drivers/video/gbefb.c
index 3dad31975db8..bda5e3941510 100644
--- a/drivers/video/gbefb.c
+++ b/drivers/video/gbefb.c
@@ -91,10 +91,10 @@ static uint32_t pseudo_palette[16];
91static uint32_t gbe_cmap[256]; 91static uint32_t gbe_cmap[256];
92static int gbe_turned_on; /* 0 turned off, 1 turned on */ 92static int gbe_turned_on; /* 0 turned off, 1 turned on */
93 93
94static char *mode_option __devinitdata = NULL; 94static char *mode_option = NULL;
95 95
96/* default CRT mode */ 96/* default CRT mode */
97static struct fb_var_screeninfo default_var_CRT __devinitdata = { 97static struct fb_var_screeninfo default_var_CRT = {
98 /* 640x480, 60 Hz, Non-Interlaced (25.175 MHz dotclock) */ 98 /* 640x480, 60 Hz, Non-Interlaced (25.175 MHz dotclock) */
99 .xres = 640, 99 .xres = 640,
100 .yres = 480, 100 .yres = 480,
@@ -125,7 +125,7 @@ static struct fb_var_screeninfo default_var_CRT __devinitdata = {
125}; 125};
126 126
127/* default LCD mode */ 127/* default LCD mode */
128static struct fb_var_screeninfo default_var_LCD __devinitdata = { 128static struct fb_var_screeninfo default_var_LCD = {
129 /* 1600x1024, 8 bpp */ 129 /* 1600x1024, 8 bpp */
130 .xres = 1600, 130 .xres = 1600,
131 .yres = 1024, 131 .yres = 1024,
@@ -157,7 +157,7 @@ static struct fb_var_screeninfo default_var_LCD __devinitdata = {
157 157
158/* default modedb mode */ 158/* default modedb mode */
159/* 640x480, 60 Hz, Non-Interlaced (25.172 MHz dotclock) */ 159/* 640x480, 60 Hz, Non-Interlaced (25.172 MHz dotclock) */
160static struct fb_videomode default_mode_CRT __devinitdata = { 160static struct fb_videomode default_mode_CRT = {
161 .refresh = 60, 161 .refresh = 60,
162 .xres = 640, 162 .xres = 640,
163 .yres = 480, 163 .yres = 480,
@@ -172,7 +172,7 @@ static struct fb_videomode default_mode_CRT __devinitdata = {
172 .vmode = FB_VMODE_NONINTERLACED, 172 .vmode = FB_VMODE_NONINTERLACED,
173}; 173};
174/* 1600x1024 SGI flatpanel 1600sw */ 174/* 1600x1024 SGI flatpanel 1600sw */
175static struct fb_videomode default_mode_LCD __devinitdata = { 175static struct fb_videomode default_mode_LCD = {
176 /* 1600x1024, 8 bpp */ 176 /* 1600x1024, 8 bpp */
177 .xres = 1600, 177 .xres = 1600,
178 .yres = 1024, 178 .yres = 1024,
@@ -186,8 +186,8 @@ static struct fb_videomode default_mode_LCD __devinitdata = {
186 .vmode = FB_VMODE_NONINTERLACED, 186 .vmode = FB_VMODE_NONINTERLACED,
187}; 187};
188 188
189static struct fb_videomode *default_mode __devinitdata = &default_mode_CRT; 189static struct fb_videomode *default_mode = &default_mode_CRT;
190static struct fb_var_screeninfo *default_var __devinitdata = &default_var_CRT; 190static struct fb_var_screeninfo *default_var = &default_var_CRT;
191 191
192static int flat_panel_enabled = 0; 192static int flat_panel_enabled = 0;
193 193
@@ -1082,7 +1082,7 @@ static ssize_t gbefb_show_rev(struct device *device, struct device_attribute *at
1082 1082
1083static DEVICE_ATTR(revision, S_IRUGO, gbefb_show_rev, NULL); 1083static DEVICE_ATTR(revision, S_IRUGO, gbefb_show_rev, NULL);
1084 1084
1085static void __devexit gbefb_remove_sysfs(struct device *dev) 1085static void gbefb_remove_sysfs(struct device *dev)
1086{ 1086{
1087 device_remove_file(dev, &dev_attr_size); 1087 device_remove_file(dev, &dev_attr_size);
1088 device_remove_file(dev, &dev_attr_revision); 1088 device_remove_file(dev, &dev_attr_revision);
@@ -1098,7 +1098,7 @@ static void gbefb_create_sysfs(struct device *dev)
1098 * Initialization 1098 * Initialization
1099 */ 1099 */
1100 1100
1101static int __devinit gbefb_setup(char *options) 1101static int gbefb_setup(char *options)
1102{ 1102{
1103 char *this_opt; 1103 char *this_opt;
1104 1104
@@ -1129,7 +1129,7 @@ static int __devinit gbefb_setup(char *options)
1129 return 0; 1129 return 0;
1130} 1130}
1131 1131
1132static int __devinit gbefb_probe(struct platform_device *p_dev) 1132static int gbefb_probe(struct platform_device *p_dev)
1133{ 1133{
1134 int i, ret = 0; 1134 int i, ret = 0;
1135 struct fb_info *info; 1135 struct fb_info *info;
@@ -1254,7 +1254,7 @@ out_release_framebuffer:
1254 return ret; 1254 return ret;
1255} 1255}
1256 1256
1257static int __devexit gbefb_remove(struct platform_device* p_dev) 1257static int gbefb_remove(struct platform_device* p_dev)
1258{ 1258{
1259 struct fb_info *info = platform_get_drvdata(p_dev); 1259 struct fb_info *info = platform_get_drvdata(p_dev);
1260 1260
@@ -1273,7 +1273,7 @@ static int __devexit gbefb_remove(struct platform_device* p_dev)
1273 1273
1274static struct platform_driver gbefb_driver = { 1274static struct platform_driver gbefb_driver = {
1275 .probe = gbefb_probe, 1275 .probe = gbefb_probe,
1276 .remove = __devexit_p(gbefb_remove), 1276 .remove = gbefb_remove,
1277 .driver = { 1277 .driver = {
1278 .name = "gbefb", 1278 .name = "gbefb",
1279 }, 1279 },
diff --git a/drivers/video/geode/gx1fb_core.c b/drivers/video/geode/gx1fb_core.c
index 265c5ed59ade..ebbaada7b941 100644
--- a/drivers/video/geode/gx1fb_core.c
+++ b/drivers/video/geode/gx1fb_core.c
@@ -29,7 +29,7 @@ static int crt_option = 1;
29static char panel_option[32] = ""; 29static char panel_option[32] = "";
30 30
31/* Modes relevant to the GX1 (taken from modedb.c) */ 31/* Modes relevant to the GX1 (taken from modedb.c) */
32static const struct fb_videomode __devinitconst gx1_modedb[] = { 32static const struct fb_videomode gx1_modedb[] = {
33 /* 640x480-60 VESA */ 33 /* 640x480-60 VESA */
34 { NULL, 60, 640, 480, 39682, 48, 16, 33, 10, 96, 2, 34 { NULL, 60, 640, 480, 39682, 48, 16, 33, 10, 96, 2,
35 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA }, 35 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
@@ -195,7 +195,7 @@ static int gx1fb_blank(int blank_mode, struct fb_info *info)
195 return par->vid_ops->blank_display(info, blank_mode); 195 return par->vid_ops->blank_display(info, blank_mode);
196} 196}
197 197
198static int __devinit gx1fb_map_video_memory(struct fb_info *info, struct pci_dev *dev) 198static int gx1fb_map_video_memory(struct fb_info *info, struct pci_dev *dev)
199{ 199{
200 struct geodefb_par *par = info->par; 200 struct geodefb_par *par = info->par;
201 unsigned gx_base; 201 unsigned gx_base;
@@ -268,7 +268,7 @@ static struct fb_ops gx1fb_ops = {
268 .fb_imageblit = cfb_imageblit, 268 .fb_imageblit = cfb_imageblit,
269}; 269};
270 270
271static struct fb_info * __devinit gx1fb_init_fbinfo(struct device *dev) 271static struct fb_info *gx1fb_init_fbinfo(struct device *dev)
272{ 272{
273 struct geodefb_par *par; 273 struct geodefb_par *par;
274 struct fb_info *info; 274 struct fb_info *info;
@@ -318,7 +318,7 @@ static struct fb_info * __devinit gx1fb_init_fbinfo(struct device *dev)
318 return info; 318 return info;
319} 319}
320 320
321static int __devinit gx1fb_probe(struct pci_dev *pdev, const struct pci_device_id *id) 321static int gx1fb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
322{ 322{
323 struct geodefb_par *par; 323 struct geodefb_par *par;
324 struct fb_info *info; 324 struct fb_info *info;
@@ -382,7 +382,7 @@ static int __devinit gx1fb_probe(struct pci_dev *pdev, const struct pci_device_i
382 return ret; 382 return ret;
383} 383}
384 384
385static void __devexit gx1fb_remove(struct pci_dev *pdev) 385static void gx1fb_remove(struct pci_dev *pdev)
386{ 386{
387 struct fb_info *info = pci_get_drvdata(pdev); 387 struct fb_info *info = pci_get_drvdata(pdev);
388 struct geodefb_par *par = info->par; 388 struct geodefb_par *par = info->par;
@@ -441,7 +441,7 @@ static struct pci_driver gx1fb_driver = {
441 .name = "gx1fb", 441 .name = "gx1fb",
442 .id_table = gx1fb_id_table, 442 .id_table = gx1fb_id_table,
443 .probe = gx1fb_probe, 443 .probe = gx1fb_probe,
444 .remove = __devexit_p(gx1fb_remove), 444 .remove = gx1fb_remove,
445}; 445};
446 446
447static int __init gx1fb_init(void) 447static int __init gx1fb_init(void)
@@ -456,7 +456,7 @@ static int __init gx1fb_init(void)
456 return pci_register_driver(&gx1fb_driver); 456 return pci_register_driver(&gx1fb_driver);
457} 457}
458 458
459static void __devexit gx1fb_cleanup(void) 459static void gx1fb_cleanup(void)
460{ 460{
461 pci_unregister_driver(&gx1fb_driver); 461 pci_unregister_driver(&gx1fb_driver);
462} 462}
diff --git a/drivers/video/geode/gxfb_core.c b/drivers/video/geode/gxfb_core.c
index b4f19db9bb54..19f0c1add747 100644
--- a/drivers/video/geode/gxfb_core.c
+++ b/drivers/video/geode/gxfb_core.c
@@ -40,7 +40,7 @@ static int vram;
40static int vt_switch; 40static int vt_switch;
41 41
42/* Modes relevant to the GX (taken from modedb.c) */ 42/* Modes relevant to the GX (taken from modedb.c) */
43static struct fb_videomode gx_modedb[] __devinitdata = { 43static struct fb_videomode gx_modedb[] = {
44 /* 640x480-60 VESA */ 44 /* 640x480-60 VESA */
45 { NULL, 60, 640, 480, 39682, 48, 16, 33, 10, 96, 2, 45 { NULL, 60, 640, 480, 39682, 48, 16, 33, 10, 96, 2,
46 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA }, 46 0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
@@ -110,15 +110,14 @@ static struct fb_videomode gx_modedb[] __devinitdata = {
110#ifdef CONFIG_OLPC 110#ifdef CONFIG_OLPC
111#include <asm/olpc.h> 111#include <asm/olpc.h>
112 112
113static struct fb_videomode gx_dcon_modedb[] __devinitdata = { 113static struct fb_videomode gx_dcon_modedb[] = {
114 /* The only mode the DCON has is 1200x900 */ 114 /* The only mode the DCON has is 1200x900 */
115 { NULL, 50, 1200, 900, 17460, 24, 8, 4, 5, 8, 3, 115 { NULL, 50, 1200, 900, 17460, 24, 8, 4, 5, 8, 3,
116 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 116 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
117 FB_VMODE_NONINTERLACED, 0 } 117 FB_VMODE_NONINTERLACED, 0 }
118}; 118};
119 119
120static void __devinit get_modedb(struct fb_videomode **modedb, 120static void get_modedb(struct fb_videomode **modedb, unsigned int *size)
121 unsigned int *size)
122{ 121{
123 if (olpc_has_dcon()) { 122 if (olpc_has_dcon()) {
124 *modedb = (struct fb_videomode *) gx_dcon_modedb; 123 *modedb = (struct fb_videomode *) gx_dcon_modedb;
@@ -130,8 +129,7 @@ static void __devinit get_modedb(struct fb_videomode **modedb,
130} 129}
131 130
132#else 131#else
133static void __devinit get_modedb(struct fb_videomode **modedb, 132static void get_modedb(struct fb_videomode **modedb, unsigned int *size)
134 unsigned int *size)
135{ 133{
136 *modedb = (struct fb_videomode *) gx_modedb; 134 *modedb = (struct fb_videomode *) gx_modedb;
137 *size = ARRAY_SIZE(gx_modedb); 135 *size = ARRAY_SIZE(gx_modedb);
@@ -228,8 +226,7 @@ static int gxfb_blank(int blank_mode, struct fb_info *info)
228 return gx_blank_display(info, blank_mode); 226 return gx_blank_display(info, blank_mode);
229} 227}
230 228
231static int __devinit gxfb_map_video_memory(struct fb_info *info, 229static int gxfb_map_video_memory(struct fb_info *info, struct pci_dev *dev)
232 struct pci_dev *dev)
233{ 230{
234 struct gxfb_par *par = info->par; 231 struct gxfb_par *par = info->par;
235 int ret; 232 int ret;
@@ -293,7 +290,7 @@ static struct fb_ops gxfb_ops = {
293 .fb_imageblit = cfb_imageblit, 290 .fb_imageblit = cfb_imageblit,
294}; 291};
295 292
296static struct fb_info *__devinit gxfb_init_fbinfo(struct device *dev) 293static struct fb_info *gxfb_init_fbinfo(struct device *dev)
297{ 294{
298 struct gxfb_par *par; 295 struct gxfb_par *par;
299 struct fb_info *info; 296 struct fb_info *info;
@@ -374,8 +371,7 @@ static int gxfb_resume(struct pci_dev *pdev)
374} 371}
375#endif 372#endif
376 373
377static int __devinit gxfb_probe(struct pci_dev *pdev, 374static int gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
378 const struct pci_device_id *id)
379{ 375{
380 struct gxfb_par *par; 376 struct gxfb_par *par;
381 struct fb_info *info; 377 struct fb_info *info;
@@ -455,7 +451,7 @@ static int __devinit gxfb_probe(struct pci_dev *pdev,
455 return ret; 451 return ret;
456} 452}
457 453
458static void __devexit gxfb_remove(struct pci_dev *pdev) 454static void gxfb_remove(struct pci_dev *pdev)
459{ 455{
460 struct fb_info *info = pci_get_drvdata(pdev); 456 struct fb_info *info = pci_get_drvdata(pdev);
461 struct gxfb_par *par = info->par; 457 struct gxfb_par *par = info->par;
diff --git a/drivers/video/geode/lxfb_core.c b/drivers/video/geode/lxfb_core.c
index 416851ca8754..4dd7b5566962 100644
--- a/drivers/video/geode/lxfb_core.c
+++ b/drivers/video/geode/lxfb_core.c
@@ -35,7 +35,7 @@ static int vt_switch;
35 * we try to make it something sane - 640x480-60 is sane 35 * we try to make it something sane - 640x480-60 is sane
36 */ 36 */
37 37
38static struct fb_videomode geode_modedb[] __devinitdata = { 38static struct fb_videomode geode_modedb[] = {
39 /* 640x480-60 */ 39 /* 640x480-60 */
40 { NULL, 60, 640, 480, 39682, 48, 8, 25, 2, 88, 2, 40 { NULL, 60, 640, 480, 39682, 48, 8, 25, 2, 88, 2,
41 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 41 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
@@ -219,15 +219,14 @@ static struct fb_videomode geode_modedb[] __devinitdata = {
219#ifdef CONFIG_OLPC 219#ifdef CONFIG_OLPC
220#include <asm/olpc.h> 220#include <asm/olpc.h>
221 221
222static struct fb_videomode olpc_dcon_modedb[] __devinitdata = { 222static struct fb_videomode olpc_dcon_modedb[] = {
223 /* The only mode the DCON has is 1200x900 */ 223 /* The only mode the DCON has is 1200x900 */
224 { NULL, 50, 1200, 900, 17460, 24, 8, 4, 5, 8, 3, 224 { NULL, 50, 1200, 900, 17460, 24, 8, 4, 5, 8, 3,
225 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 225 FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
226 FB_VMODE_NONINTERLACED, 0 } 226 FB_VMODE_NONINTERLACED, 0 }
227}; 227};
228 228
229static void __devinit get_modedb(struct fb_videomode **modedb, 229static void get_modedb(struct fb_videomode **modedb, unsigned int *size)
230 unsigned int *size)
231{ 230{
232 if (olpc_has_dcon()) { 231 if (olpc_has_dcon()) {
233 *modedb = (struct fb_videomode *) olpc_dcon_modedb; 232 *modedb = (struct fb_videomode *) olpc_dcon_modedb;
@@ -239,8 +238,7 @@ static void __devinit get_modedb(struct fb_videomode **modedb,
239} 238}
240 239
241#else 240#else
242static void __devinit get_modedb(struct fb_videomode **modedb, 241static void get_modedb(struct fb_videomode **modedb, unsigned int *size)
243 unsigned int *size)
244{ 242{
245 *modedb = (struct fb_videomode *) geode_modedb; 243 *modedb = (struct fb_videomode *) geode_modedb;
246 *size = ARRAY_SIZE(geode_modedb); 244 *size = ARRAY_SIZE(geode_modedb);
@@ -336,8 +334,7 @@ static int lxfb_blank(int blank_mode, struct fb_info *info)
336} 334}
337 335
338 336
339static int __devinit lxfb_map_video_memory(struct fb_info *info, 337static int lxfb_map_video_memory(struct fb_info *info, struct pci_dev *dev)
340 struct pci_dev *dev)
341{ 338{
342 struct lxfb_par *par = info->par; 339 struct lxfb_par *par = info->par;
343 int ret; 340 int ret;
@@ -414,7 +411,7 @@ static struct fb_ops lxfb_ops = {
414 .fb_imageblit = cfb_imageblit, 411 .fb_imageblit = cfb_imageblit,
415}; 412};
416 413
417static struct fb_info * __devinit lxfb_init_fbinfo(struct device *dev) 414static struct fb_info *lxfb_init_fbinfo(struct device *dev)
418{ 415{
419 struct lxfb_par *par; 416 struct lxfb_par *par;
420 struct fb_info *info; 417 struct fb_info *info;
@@ -498,8 +495,7 @@ static int lxfb_resume(struct pci_dev *pdev)
498#define lxfb_resume NULL 495#define lxfb_resume NULL
499#endif 496#endif
500 497
501static int __devinit lxfb_probe(struct pci_dev *pdev, 498static int lxfb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
502 const struct pci_device_id *id)
503{ 499{
504 struct lxfb_par *par; 500 struct lxfb_par *par;
505 struct fb_info *info; 501 struct fb_info *info;
@@ -590,7 +586,7 @@ err:
590 return ret; 586 return ret;
591} 587}
592 588
593static void __devexit lxfb_remove(struct pci_dev *pdev) 589static void lxfb_remove(struct pci_dev *pdev)
594{ 590{
595 struct fb_info *info = pci_get_drvdata(pdev); 591 struct fb_info *info = pci_get_drvdata(pdev);
596 struct lxfb_par *par = info->par; 592 struct lxfb_par *par = info->par;
diff --git a/drivers/video/grvga.c b/drivers/video/grvga.c
index 5245f9a71892..861109e7de1b 100644
--- a/drivers/video/grvga.c
+++ b/drivers/video/grvga.c
@@ -70,7 +70,7 @@ static const struct fb_videomode grvga_modedb[] = {
70 } 70 }
71 }; 71 };
72 72
73static struct fb_fix_screeninfo grvga_fix __devinitdata = { 73static struct fb_fix_screeninfo grvga_fix = {
74 .id = "AG SVGACTRL", 74 .id = "AG SVGACTRL",
75 .type = FB_TYPE_PACKED_PIXELS, 75 .type = FB_TYPE_PACKED_PIXELS,
76 .visual = FB_VISUAL_PSEUDOCOLOR, 76 .visual = FB_VISUAL_PSEUDOCOLOR,
@@ -267,8 +267,8 @@ static struct fb_ops grvga_ops = {
267 .fb_imageblit = cfb_imageblit 267 .fb_imageblit = cfb_imageblit
268}; 268};
269 269
270static int __devinit grvga_parse_custom(char *options, 270static int grvga_parse_custom(char *options,
271 struct fb_var_screeninfo *screendata) 271 struct fb_var_screeninfo *screendata)
272{ 272{
273 char *this_opt; 273 char *this_opt;
274 int count = 0; 274 int count = 0;
@@ -329,7 +329,7 @@ static int __devinit grvga_parse_custom(char *options,
329 return 0; 329 return 0;
330} 330}
331 331
332static int __devinit grvga_probe(struct platform_device *dev) 332static int grvga_probe(struct platform_device *dev)
333{ 333{
334 struct fb_info *info; 334 struct fb_info *info;
335 int retval = -ENOMEM; 335 int retval = -ENOMEM;
@@ -512,7 +512,7 @@ free_fb:
512 return retval; 512 return retval;
513} 513}
514 514
515static int __devexit grvga_remove(struct platform_device *device) 515static int grvga_remove(struct platform_device *device)
516{ 516{
517 struct fb_info *info = dev_get_drvdata(&device->dev); 517 struct fb_info *info = dev_get_drvdata(&device->dev);
518 struct grvga_par *par = info->par; 518 struct grvga_par *par = info->par;
@@ -554,7 +554,7 @@ static struct platform_driver grvga_driver = {
554 .of_match_table = svgactrl_of_match, 554 .of_match_table = svgactrl_of_match,
555 }, 555 },
556 .probe = grvga_probe, 556 .probe = grvga_probe,
557 .remove = __devexit_p(grvga_remove), 557 .remove = grvga_remove,
558}; 558};
559 559
560 560
diff --git a/drivers/video/gxt4500.c b/drivers/video/gxt4500.c
index 4bdea6e9bd55..c35663f6a54a 100644
--- a/drivers/video/gxt4500.c
+++ b/drivers/video/gxt4500.c
@@ -159,7 +159,7 @@ struct gxt4500_par {
159static char *mode_option; 159static char *mode_option;
160 160
161/* default mode: 1280x1024 @ 60 Hz, 8 bpp */ 161/* default mode: 1280x1024 @ 60 Hz, 8 bpp */
162static const struct fb_videomode defaultmode __devinitconst = { 162static const struct fb_videomode defaultmode = {
163 .refresh = 60, 163 .refresh = 60,
164 .xres = 1280, 164 .xres = 1280,
165 .yres = 1024, 165 .yres = 1024,
@@ -588,7 +588,7 @@ static int gxt4500_blank(int blank, struct fb_info *info)
588 return 0; 588 return 0;
589} 589}
590 590
591static const struct fb_fix_screeninfo gxt4500_fix __devinitconst = { 591static const struct fb_fix_screeninfo gxt4500_fix = {
592 .id = "IBM GXT4500P", 592 .id = "IBM GXT4500P",
593 .type = FB_TYPE_PACKED_PIXELS, 593 .type = FB_TYPE_PACKED_PIXELS,
594 .visual = FB_VISUAL_PSEUDOCOLOR, 594 .visual = FB_VISUAL_PSEUDOCOLOR,
@@ -610,8 +610,7 @@ static struct fb_ops gxt4500_ops = {
610}; 610};
611 611
612/* PCI functions */ 612/* PCI functions */
613static int __devinit gxt4500_probe(struct pci_dev *pdev, 613static int gxt4500_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
614 const struct pci_device_id *ent)
615{ 614{
616 int err; 615 int err;
617 unsigned long reg_phys, fb_phys; 616 unsigned long reg_phys, fb_phys;
@@ -720,7 +719,7 @@ static int __devinit gxt4500_probe(struct pci_dev *pdev,
720 return -ENODEV; 719 return -ENODEV;
721} 720}
722 721
723static void __devexit gxt4500_remove(struct pci_dev *pdev) 722static void gxt4500_remove(struct pci_dev *pdev)
724{ 723{
725 struct fb_info *info = pci_get_drvdata(pdev); 724 struct fb_info *info = pci_get_drvdata(pdev);
726 struct gxt4500_par *par; 725 struct gxt4500_par *par;
@@ -758,10 +757,10 @@ static struct pci_driver gxt4500_driver = {
758 .name = "gxt4500", 757 .name = "gxt4500",
759 .id_table = gxt4500_pci_tbl, 758 .id_table = gxt4500_pci_tbl,
760 .probe = gxt4500_probe, 759 .probe = gxt4500_probe,
761 .remove = __devexit_p(gxt4500_remove), 760 .remove = gxt4500_remove,
762}; 761};
763 762
764static int __devinit gxt4500_init(void) 763static int gxt4500_init(void)
765{ 764{
766#ifndef MODULE 765#ifndef MODULE
767 if (fb_get_options("gxt4500", &mode_option)) 766 if (fb_get_options("gxt4500", &mode_option))
diff --git a/drivers/video/hecubafb.c b/drivers/video/hecubafb.c
index 614251a9af91..59d23181fdb0 100644
--- a/drivers/video/hecubafb.c
+++ b/drivers/video/hecubafb.c
@@ -47,7 +47,7 @@
47#define DPY_W 600 47#define DPY_W 600
48#define DPY_H 800 48#define DPY_H 800
49 49
50static struct fb_fix_screeninfo hecubafb_fix __devinitdata = { 50static struct fb_fix_screeninfo hecubafb_fix = {
51 .id = "hecubafb", 51 .id = "hecubafb",
52 .type = FB_TYPE_PACKED_PIXELS, 52 .type = FB_TYPE_PACKED_PIXELS,
53 .visual = FB_VISUAL_MONO01, 53 .visual = FB_VISUAL_MONO01,
@@ -58,7 +58,7 @@ static struct fb_fix_screeninfo hecubafb_fix __devinitdata = {
58 .accel = FB_ACCEL_NONE, 58 .accel = FB_ACCEL_NONE,
59}; 59};
60 60
61static struct fb_var_screeninfo hecubafb_var __devinitdata = { 61static struct fb_var_screeninfo hecubafb_var = {
62 .xres = DPY_W, 62 .xres = DPY_W,
63 .yres = DPY_H, 63 .yres = DPY_H,
64 .xres_virtual = DPY_W, 64 .xres_virtual = DPY_W,
@@ -211,7 +211,7 @@ static struct fb_deferred_io hecubafb_defio = {
211 .deferred_io = hecubafb_dpy_deferred_io, 211 .deferred_io = hecubafb_dpy_deferred_io,
212}; 212};
213 213
214static int __devinit hecubafb_probe(struct platform_device *dev) 214static int hecubafb_probe(struct platform_device *dev)
215{ 215{
216 struct fb_info *info; 216 struct fb_info *info;
217 struct hecuba_board *board; 217 struct hecuba_board *board;
@@ -280,7 +280,7 @@ err_videomem_alloc:
280 return retval; 280 return retval;
281} 281}
282 282
283static int __devexit hecubafb_remove(struct platform_device *dev) 283static int hecubafb_remove(struct platform_device *dev)
284{ 284{
285 struct fb_info *info = platform_get_drvdata(dev); 285 struct fb_info *info = platform_get_drvdata(dev);
286 286
@@ -299,7 +299,7 @@ static int __devexit hecubafb_remove(struct platform_device *dev)
299 299
300static struct platform_driver hecubafb_driver = { 300static struct platform_driver hecubafb_driver = {
301 .probe = hecubafb_probe, 301 .probe = hecubafb_probe,
302 .remove = __devexit_p(hecubafb_remove), 302 .remove = hecubafb_remove,
303 .driver = { 303 .driver = {
304 .owner = THIS_MODULE, 304 .owner = THIS_MODULE,
305 .name = "hecubafb", 305 .name = "hecubafb",
diff --git a/drivers/video/hgafb.c b/drivers/video/hgafb.c
index c645f9282650..1e9e2d819d1f 100644
--- a/drivers/video/hgafb.c
+++ b/drivers/video/hgafb.c
@@ -106,7 +106,7 @@ static DEFINE_SPINLOCK(hga_reg_lock);
106 106
107/* Framebuffer driver structures */ 107/* Framebuffer driver structures */
108 108
109static struct fb_var_screeninfo hga_default_var __devinitdata = { 109static struct fb_var_screeninfo hga_default_var = {
110 .xres = 720, 110 .xres = 720,
111 .yres = 348, 111 .yres = 348,
112 .xres_virtual = 720, 112 .xres_virtual = 720,
@@ -120,7 +120,7 @@ static struct fb_var_screeninfo hga_default_var __devinitdata = {
120 .width = -1, 120 .width = -1,
121}; 121};
122 122
123static struct fb_fix_screeninfo hga_fix __devinitdata = { 123static struct fb_fix_screeninfo hga_fix = {
124 .id = "HGA", 124 .id = "HGA",
125 .type = FB_TYPE_PACKED_PIXELS, /* (not sure) */ 125 .type = FB_TYPE_PACKED_PIXELS, /* (not sure) */
126 .visual = FB_VISUAL_MONO10, 126 .visual = FB_VISUAL_MONO10,
@@ -276,7 +276,7 @@ static void hga_blank(int blank_mode)
276 spin_unlock_irqrestore(&hga_reg_lock, flags); 276 spin_unlock_irqrestore(&hga_reg_lock, flags);
277} 277}
278 278
279static int __devinit hga_card_detect(void) 279static int hga_card_detect(void)
280{ 280{
281 int count = 0; 281 int count = 0;
282 void __iomem *p, *q; 282 void __iomem *p, *q;
@@ -546,7 +546,7 @@ static struct fb_ops hgafb_ops = {
546 * Initialization 546 * Initialization
547 */ 547 */
548 548
549static int __devinit hgafb_probe(struct platform_device *pdev) 549static int hgafb_probe(struct platform_device *pdev)
550{ 550{
551 struct fb_info *info; 551 struct fb_info *info;
552 552
@@ -592,7 +592,7 @@ static int __devinit hgafb_probe(struct platform_device *pdev)
592 return 0; 592 return 0;
593} 593}
594 594
595static int __devexit hgafb_remove(struct platform_device *pdev) 595static int hgafb_remove(struct platform_device *pdev)
596{ 596{
597 struct fb_info *info = platform_get_drvdata(pdev); 597 struct fb_info *info = platform_get_drvdata(pdev);
598 598
@@ -617,7 +617,7 @@ static int __devexit hgafb_remove(struct platform_device *pdev)
617 617
618static struct platform_driver hgafb_driver = { 618static struct platform_driver hgafb_driver = {
619 .probe = hgafb_probe, 619 .probe = hgafb_probe,
620 .remove = __devexit_p(hgafb_remove), 620 .remove = hgafb_remove,
621 .driver = { 621 .driver = {
622 .name = "hgafb", 622 .name = "hgafb",
623 }, 623 },
diff --git a/drivers/video/hitfb.c b/drivers/video/hitfb.c
index cfb8d6451014..c2414d6ab646 100644
--- a/drivers/video/hitfb.c
+++ b/drivers/video/hitfb.c
@@ -30,14 +30,14 @@
30 30
31#define WIDTH 640 31#define WIDTH 640
32 32
33static struct fb_var_screeninfo hitfb_var __devinitdata = { 33static struct fb_var_screeninfo hitfb_var = {
34 .activate = FB_ACTIVATE_NOW, 34 .activate = FB_ACTIVATE_NOW,
35 .height = -1, 35 .height = -1,
36 .width = -1, 36 .width = -1,
37 .vmode = FB_VMODE_NONINTERLACED, 37 .vmode = FB_VMODE_NONINTERLACED,
38}; 38};
39 39
40static struct fb_fix_screeninfo hitfb_fix __devinitdata = { 40static struct fb_fix_screeninfo hitfb_fix = {
41 .id = "Hitachi HD64461", 41 .id = "Hitachi HD64461",
42 .type = FB_TYPE_PACKED_PIXELS, 42 .type = FB_TYPE_PACKED_PIXELS,
43 .accel = FB_ACCEL_NONE, 43 .accel = FB_ACCEL_NONE,
@@ -324,7 +324,7 @@ static struct fb_ops hitfb_ops = {
324 .fb_imageblit = cfb_imageblit, 324 .fb_imageblit = cfb_imageblit,
325}; 325};
326 326
327static int __devinit hitfb_probe(struct platform_device *dev) 327static int hitfb_probe(struct platform_device *dev)
328{ 328{
329 unsigned short lcdclor, ldr3, ldvndr; 329 unsigned short lcdclor, ldr3, ldvndr;
330 struct fb_info *info; 330 struct fb_info *info;
@@ -417,7 +417,7 @@ err_fb:
417 return ret; 417 return ret;
418} 418}
419 419
420static int __devexit hitfb_remove(struct platform_device *dev) 420static int hitfb_remove(struct platform_device *dev)
421{ 421{
422 struct fb_info *info = platform_get_drvdata(dev); 422 struct fb_info *info = platform_get_drvdata(dev);
423 423
@@ -462,7 +462,7 @@ static const struct dev_pm_ops hitfb_dev_pm_ops = {
462 462
463static struct platform_driver hitfb_driver = { 463static struct platform_driver hitfb_driver = {
464 .probe = hitfb_probe, 464 .probe = hitfb_probe,
465 .remove = __devexit_p(hitfb_remove), 465 .remove = hitfb_remove,
466 .driver = { 466 .driver = {
467 .name = "hitfb", 467 .name = "hitfb",
468 .owner = THIS_MODULE, 468 .owner = THIS_MODULE,
diff --git a/drivers/video/hpfb.c b/drivers/video/hpfb.c
index 7324865f965f..b802f93cef5d 100644
--- a/drivers/video/hpfb.c
+++ b/drivers/video/hpfb.c
@@ -206,8 +206,7 @@ static struct fb_ops hpfb_ops = {
206#define HPFB_FBOMSB 0x5d /* Frame buffer offset */ 206#define HPFB_FBOMSB 0x5d /* Frame buffer offset */
207#define HPFB_FBOLSB 0x5f 207#define HPFB_FBOLSB 0x5f
208 208
209static int __devinit hpfb_init_one(unsigned long phys_base, 209static int hpfb_init_one(unsigned long phys_base, unsigned long virt_base)
210 unsigned long virt_base)
211{ 210{
212 unsigned long fboff, fb_width, fb_height, fb_start; 211 unsigned long fboff, fb_width, fb_height, fb_start;
213 int ret; 212 int ret;
@@ -327,7 +326,7 @@ unmap_screen_base:
327/* 326/*
328 * Initialise the framebuffer 327 * Initialise the framebuffer
329 */ 328 */
330static int __devinit hpfb_dio_probe(struct dio_dev * d, const struct dio_device_id * ent) 329static int hpfb_dio_probe(struct dio_dev *d, const struct dio_device_id *ent)
331{ 330{
332 unsigned long paddr, vaddr; 331 unsigned long paddr, vaddr;
333 332
@@ -350,7 +349,7 @@ static int __devinit hpfb_dio_probe(struct dio_dev * d, const struct dio_device_
350 return 0; 349 return 0;
351} 350}
352 351
353static void __devexit hpfb_remove_one(struct dio_dev *d) 352static void hpfb_remove_one(struct dio_dev *d)
354{ 353{
355 unregister_framebuffer(&fb_info); 354 unregister_framebuffer(&fb_info);
356 if (d->scode >= DIOII_SCBASE) 355 if (d->scode >= DIOII_SCBASE)
@@ -373,7 +372,7 @@ static struct dio_driver hpfb_driver = {
373 .name = "hpfb", 372 .name = "hpfb",
374 .id_table = hpfb_dio_tbl, 373 .id_table = hpfb_dio_tbl,
375 .probe = hpfb_dio_probe, 374 .probe = hpfb_dio_probe,
376 .remove = __devexit_p(hpfb_remove_one), 375 .remove = hpfb_remove_one,
377}; 376};
378 377
379int __init hpfb_init(void) 378int __init hpfb_init(void)
diff --git a/drivers/video/i740fb.c b/drivers/video/i740fb.c
index ff3f8808e4e9..cfd0c52e8f73 100644
--- a/drivers/video/i740fb.c
+++ b/drivers/video/i740fb.c
@@ -33,10 +33,10 @@
33 33
34#include "i740_reg.h" 34#include "i740_reg.h"
35 35
36static char *mode_option __devinitdata; 36static char *mode_option;
37 37
38#ifdef CONFIG_MTRR 38#ifdef CONFIG_MTRR
39static int mtrr __devinitdata = 1; 39static int mtrr = 1;
40#endif 40#endif
41 41
42struct i740fb_par { 42struct i740fb_par {
@@ -91,7 +91,7 @@ struct i740fb_par {
91#define DACSPEED24_SD 128 91#define DACSPEED24_SD 128
92#define DACSPEED32 86 92#define DACSPEED32 86
93 93
94static struct fb_fix_screeninfo i740fb_fix __devinitdata = { 94static struct fb_fix_screeninfo i740fb_fix = {
95 .id = "i740fb", 95 .id = "i740fb",
96 .type = FB_TYPE_PACKED_PIXELS, 96 .type = FB_TYPE_PACKED_PIXELS,
97 .visual = FB_VISUAL_TRUECOLOR, 97 .visual = FB_VISUAL_TRUECOLOR,
@@ -163,7 +163,7 @@ static int i740fb_ddc_getsda(void *data)
163 return !!(i740inreg(par, XRX, REG_DDC_STATE) & DDC_SDA); 163 return !!(i740inreg(par, XRX, REG_DDC_STATE) & DDC_SDA);
164} 164}
165 165
166static int __devinit i740fb_setup_ddc_bus(struct fb_info *info) 166static int i740fb_setup_ddc_bus(struct fb_info *info)
167{ 167{
168 struct i740fb_par *par = info->par; 168 struct i740fb_par *par = info->par;
169 169
@@ -1007,8 +1007,7 @@ static struct fb_ops i740fb_ops = {
1007 1007
1008/* ------------------------------------------------------------------------- */ 1008/* ------------------------------------------------------------------------- */
1009 1009
1010static int __devinit i740fb_probe(struct pci_dev *dev, 1010static int i740fb_probe(struct pci_dev *dev, const struct pci_device_id *ent)
1011 const struct pci_device_id *ent)
1012{ 1011{
1013 struct fb_info *info; 1012 struct fb_info *info;
1014 struct i740fb_par *par; 1013 struct i740fb_par *par;
@@ -1174,7 +1173,7 @@ err_enable_device:
1174 return ret; 1173 return ret;
1175} 1174}
1176 1175
1177static void __devexit i740fb_remove(struct pci_dev *dev) 1176static void i740fb_remove(struct pci_dev *dev)
1178{ 1177{
1179 struct fb_info *info = pci_get_drvdata(dev); 1178 struct fb_info *info = pci_get_drvdata(dev);
1180 1179
@@ -1275,7 +1274,7 @@ static struct pci_driver i740fb_driver = {
1275 .name = "i740fb", 1274 .name = "i740fb",
1276 .id_table = i740fb_id_table, 1275 .id_table = i740fb_id_table,
1277 .probe = i740fb_probe, 1276 .probe = i740fb_probe,
1278 .remove = __devexit_p(i740fb_remove), 1277 .remove = i740fb_remove,
1279 .suspend = i740fb_suspend, 1278 .suspend = i740fb_suspend,
1280 .resume = i740fb_resume, 1279 .resume = i740fb_resume,
1281}; 1280};
diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c
index 5c067816a81d..4ce3438ade6f 100644
--- a/drivers/video/i810/i810_main.c
+++ b/drivers/video/i810/i810_main.c
@@ -74,12 +74,12 @@
74 * 74 *
75 * Experiment with v_offset to find out which works best for you. 75 * Experiment with v_offset to find out which works best for you.
76 */ 76 */
77static u32 v_offset_default __devinitdata; /* For 32 MiB Aper size, 8 should be the default */ 77static u32 v_offset_default; /* For 32 MiB Aper size, 8 should be the default */
78static u32 voffset __devinitdata; 78static u32 voffset;
79 79
80static int i810fb_cursor(struct fb_info *info, struct fb_cursor *cursor); 80static int i810fb_cursor(struct fb_info *info, struct fb_cursor *cursor);
81static int __devinit i810fb_init_pci (struct pci_dev *dev, 81static int i810fb_init_pci(struct pci_dev *dev,
82 const struct pci_device_id *entry); 82 const struct pci_device_id *entry);
83static void __exit i810fb_remove_pci(struct pci_dev *dev); 83static void __exit i810fb_remove_pci(struct pci_dev *dev);
84static int i810fb_resume(struct pci_dev *dev); 84static int i810fb_resume(struct pci_dev *dev);
85static int i810fb_suspend(struct pci_dev *dev, pm_message_t state); 85static int i810fb_suspend(struct pci_dev *dev, pm_message_t state);
@@ -97,7 +97,7 @@ static int i810fb_blank (int blank_mode, struct fb_info *info);
97static void i810fb_release_resource (struct fb_info *info, struct i810fb_par *par); 97static void i810fb_release_resource (struct fb_info *info, struct i810fb_par *par);
98 98
99/* PCI */ 99/* PCI */
100static const char * const i810_pci_list[] __devinitconst = { 100static const char * const i810_pci_list[] = {
101 "Intel(R) 810 Framebuffer Device" , 101 "Intel(R) 810 Framebuffer Device" ,
102 "Intel(R) 810-DC100 Framebuffer Device" , 102 "Intel(R) 810-DC100 Framebuffer Device" ,
103 "Intel(R) 810E Framebuffer Device" , 103 "Intel(R) 810E Framebuffer Device" ,
@@ -132,22 +132,22 @@ static struct pci_driver i810fb_driver = {
132 .resume = i810fb_resume, 132 .resume = i810fb_resume,
133}; 133};
134 134
135static char *mode_option __devinitdata = NULL; 135static char *mode_option = NULL;
136static int vram __devinitdata = 4; 136static int vram = 4;
137static int bpp __devinitdata = 8; 137static int bpp = 8;
138static bool mtrr __devinitdata; 138static bool mtrr;
139static bool accel __devinitdata; 139static bool accel;
140static int hsync1 __devinitdata; 140static int hsync1;
141static int hsync2 __devinitdata; 141static int hsync2;
142static int vsync1 __devinitdata; 142static int vsync1;
143static int vsync2 __devinitdata; 143static int vsync2;
144static int xres __devinitdata; 144static int xres;
145static int yres; 145static int yres;
146static int vyres __devinitdata; 146static int vyres;
147static bool sync __devinitdata; 147static bool sync;
148static bool extvga __devinitdata; 148static bool extvga;
149static bool dcolor __devinitdata; 149static bool dcolor;
150static bool ddc3 __devinitdata; 150static bool ddc3;
151 151
152/*------------------------------------------------------------*/ 152/*------------------------------------------------------------*/
153 153
@@ -1541,7 +1541,7 @@ static int i810fb_cursor(struct fb_info *info, struct fb_cursor *cursor)
1541 return 0; 1541 return 0;
1542} 1542}
1543 1543
1544static struct fb_ops i810fb_ops __devinitdata = { 1544static struct fb_ops i810fb_ops = {
1545 .owner = THIS_MODULE, 1545 .owner = THIS_MODULE,
1546 .fb_open = i810fb_open, 1546 .fb_open = i810fb_open,
1547 .fb_release = i810fb_release, 1547 .fb_release = i810fb_release,
@@ -1628,7 +1628,7 @@ fail:
1628 * AGP resource allocation * 1628 * AGP resource allocation *
1629 ***********************************************************************/ 1629 ***********************************************************************/
1630 1630
1631static void __devinit i810_fix_pointers(struct i810fb_par *par) 1631static void i810_fix_pointers(struct i810fb_par *par)
1632{ 1632{
1633 par->fb.physical = par->aperture.physical+(par->fb.offset << 12); 1633 par->fb.physical = par->aperture.physical+(par->fb.offset << 12);
1634 par->fb.virtual = par->aperture.virtual+(par->fb.offset << 12); 1634 par->fb.virtual = par->aperture.virtual+(par->fb.offset << 12);
@@ -1640,7 +1640,7 @@ static void __devinit i810_fix_pointers(struct i810fb_par *par)
1640 (par->cursor_heap.offset << 12); 1640 (par->cursor_heap.offset << 12);
1641} 1641}
1642 1642
1643static void __devinit i810_fix_offsets(struct i810fb_par *par) 1643static void i810_fix_offsets(struct i810fb_par *par)
1644{ 1644{
1645 if (vram + 1 > par->aperture.size >> 20) 1645 if (vram + 1 > par->aperture.size >> 20)
1646 vram = (par->aperture.size >> 20) - 1; 1646 vram = (par->aperture.size >> 20) - 1;
@@ -1660,7 +1660,7 @@ static void __devinit i810_fix_offsets(struct i810fb_par *par)
1660 par->cursor_heap.size = 4096; 1660 par->cursor_heap.size = 4096;
1661} 1661}
1662 1662
1663static int __devinit i810_alloc_agp_mem(struct fb_info *info) 1663static int i810_alloc_agp_mem(struct fb_info *info)
1664{ 1664{
1665 struct i810fb_par *par = info->par; 1665 struct i810fb_par *par = info->par;
1666 int size; 1666 int size;
@@ -1723,7 +1723,7 @@ static int __devinit i810_alloc_agp_mem(struct fb_info *info)
1723 * Sets the user monitor's horizontal and vertical 1723 * Sets the user monitor's horizontal and vertical
1724 * frequency limits 1724 * frequency limits
1725 */ 1725 */
1726static void __devinit i810_init_monspecs(struct fb_info *info) 1726static void i810_init_monspecs(struct fb_info *info)
1727{ 1727{
1728 if (!hsync1) 1728 if (!hsync1)
1729 hsync1 = HFMIN; 1729 hsync1 = HFMIN;
@@ -1755,8 +1755,7 @@ static void __devinit i810_init_monspecs(struct fb_info *info)
1755 * @par: pointer to i810fb_par structure 1755 * @par: pointer to i810fb_par structure
1756 * @info: pointer to current fb_info structure 1756 * @info: pointer to current fb_info structure
1757 */ 1757 */
1758static void __devinit i810_init_defaults(struct i810fb_par *par, 1758static void i810_init_defaults(struct i810fb_par *par, struct fb_info *info)
1759 struct fb_info *info)
1760{ 1759{
1761 mutex_init(&par->open_lock); 1760 mutex_init(&par->open_lock);
1762 1761
@@ -1812,7 +1811,7 @@ static void __devinit i810_init_defaults(struct i810fb_par *par,
1812 * i810_init_device - initialize device 1811 * i810_init_device - initialize device
1813 * @par: pointer to i810fb_par structure 1812 * @par: pointer to i810fb_par structure
1814 */ 1813 */
1815static void __devinit i810_init_device(struct i810fb_par *par) 1814static void i810_init_device(struct i810fb_par *par)
1816{ 1815{
1817 u8 reg; 1816 u8 reg;
1818 u8 __iomem *mmio = par->mmio_start_virtual; 1817 u8 __iomem *mmio = par->mmio_start_virtual;
@@ -1833,9 +1832,8 @@ static void __devinit i810_init_device(struct i810fb_par *par)
1833 1832
1834} 1833}
1835 1834
1836static int __devinit 1835static int i810_allocate_pci_resource(struct i810fb_par *par,
1837i810_allocate_pci_resource(struct i810fb_par *par, 1836 const struct pci_device_id *entry)
1838 const struct pci_device_id *entry)
1839{ 1837{
1840 int err; 1838 int err;
1841 1839
@@ -1892,7 +1890,7 @@ i810_allocate_pci_resource(struct i810fb_par *par,
1892 return 0; 1890 return 0;
1893} 1891}
1894 1892
1895static void __devinit i810fb_find_init_mode(struct fb_info *info) 1893static void i810fb_find_init_mode(struct fb_info *info)
1896{ 1894{
1897 struct fb_videomode mode; 1895 struct fb_videomode mode;
1898 struct fb_var_screeninfo var; 1896 struct fb_var_screeninfo var;
@@ -1956,7 +1954,7 @@ static void __devinit i810fb_find_init_mode(struct fb_info *info)
1956} 1954}
1957 1955
1958#ifndef MODULE 1956#ifndef MODULE
1959static int __devinit i810fb_setup(char *options) 1957static int i810fb_setup(char *options)
1960{ 1958{
1961 char *this_opt, *suffix = NULL; 1959 char *this_opt, *suffix = NULL;
1962 1960
@@ -2007,8 +2005,8 @@ static int __devinit i810fb_setup(char *options)
2007} 2005}
2008#endif 2006#endif
2009 2007
2010static int __devinit i810fb_init_pci (struct pci_dev *dev, 2008static int i810fb_init_pci(struct pci_dev *dev,
2011 const struct pci_device_id *entry) 2009 const struct pci_device_id *entry)
2012{ 2010{
2013 struct fb_info *info; 2011 struct fb_info *info;
2014 struct i810fb_par *par = NULL; 2012 struct i810fb_par *par = NULL;
@@ -2136,7 +2134,7 @@ static void __exit i810fb_remove_pci(struct pci_dev *dev)
2136} 2134}
2137 2135
2138#ifndef MODULE 2136#ifndef MODULE
2139static int __devinit i810fb_init(void) 2137static int i810fb_init(void)
2140{ 2138{
2141 char *option = NULL; 2139 char *option = NULL;
2142 2140
@@ -2154,7 +2152,7 @@ static int __devinit i810fb_init(void)
2154 2152
2155#ifdef MODULE 2153#ifdef MODULE
2156 2154
2157static int __devinit i810fb_init(void) 2155static int i810fb_init(void)
2158{ 2156{
2159 hsync1 *= 1000; 2157 hsync1 *= 1000;
2160 hsync2 *= 1000; 2158 hsync2 *= 1000;
diff --git a/drivers/video/i810/i810_main.h b/drivers/video/i810/i810_main.h
index 51d4f3d4116d..a25afaa534ba 100644
--- a/drivers/video/i810/i810_main.h
+++ b/drivers/video/i810/i810_main.h
@@ -64,7 +64,7 @@ static inline void flush_cache(void)
64 64
65#include <asm/mtrr.h> 65#include <asm/mtrr.h>
66 66
67static inline void __devinit set_mtrr(struct i810fb_par *par) 67static inline void set_mtrr(struct i810fb_par *par)
68{ 68{
69 par->mtrr_reg = mtrr_add((u32) par->aperture.physical, 69 par->mtrr_reg = mtrr_add((u32) par->aperture.physical,
70 par->aperture.size, MTRR_TYPE_WRCOMB, 1); 70 par->aperture.size, MTRR_TYPE_WRCOMB, 1);
diff --git a/drivers/video/igafb.c b/drivers/video/igafb.c
index 2d97752f79a5..79cbfa7d1a9b 100644
--- a/drivers/video/igafb.c
+++ b/drivers/video/igafb.c
@@ -571,7 +571,7 @@ static int __init igafb_setup(char *options)
571 571
572module_init(igafb_init); 572module_init(igafb_init);
573MODULE_LICENSE("GPL"); 573MODULE_LICENSE("GPL");
574static struct pci_device_id igafb_pci_tbl[] __devinitdata = { 574static struct pci_device_id igafb_pci_tbl[] = {
575 { PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_1682, 575 { PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_1682,
576 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 576 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
577 { } 577 { }
diff --git a/drivers/video/imsttfb.c b/drivers/video/imsttfb.c
index 8149356471e4..d5220cc90e93 100644
--- a/drivers/video/imsttfb.c
+++ b/drivers/video/imsttfb.c
@@ -225,7 +225,7 @@ struct initvalues {
225 __u8 addr, value; 225 __u8 addr, value;
226}; 226};
227 227
228static struct initvalues ibm_initregs[] __devinitdata = { 228static struct initvalues ibm_initregs[] = {
229 { CLKCTL, 0x21 }, 229 { CLKCTL, 0x21 },
230 { SYNCCTL, 0x00 }, 230 { SYNCCTL, 0x00 },
231 { HSYNCPOS, 0x00 }, 231 { HSYNCPOS, 0x00 },
@@ -272,7 +272,7 @@ static struct initvalues ibm_initregs[] __devinitdata = {
272 { KEYCTL, 0x00 } 272 { KEYCTL, 0x00 }
273}; 273};
274 274
275static struct initvalues tvp_initregs[] __devinitdata = { 275static struct initvalues tvp_initregs[] = {
276 { TVPIRICC, 0x00 }, 276 { TVPIRICC, 0x00 },
277 { TVPIRBRC, 0xe4 }, 277 { TVPIRBRC, 0xe4 },
278 { TVPIRLAC, 0x06 }, 278 { TVPIRLAC, 0x06 },
@@ -336,7 +336,7 @@ enum {
336static int inverse = 0; 336static int inverse = 0;
337static char fontname[40] __initdata = { 0 }; 337static char fontname[40] __initdata = { 0 };
338#if defined(CONFIG_PPC) 338#if defined(CONFIG_PPC)
339static signed char init_vmode __devinitdata = -1, init_cmode __devinitdata = -1; 339static signed char init_vmode = -1, init_cmode = -1;
340#endif 340#endif
341 341
342static struct imstt_regvals tvp_reg_init_2 = { 342static struct imstt_regvals tvp_reg_init_2 = {
@@ -1333,7 +1333,7 @@ static struct pci_driver imsttfb_pci_driver = {
1333 .name = "imsttfb", 1333 .name = "imsttfb",
1334 .id_table = imsttfb_pci_tbl, 1334 .id_table = imsttfb_pci_tbl,
1335 .probe = imsttfb_probe, 1335 .probe = imsttfb_probe,
1336 .remove = __devexit_p(imsttfb_remove), 1336 .remove = imsttfb_remove,
1337}; 1337};
1338 1338
1339static struct fb_ops imsttfb_ops = { 1339static struct fb_ops imsttfb_ops = {
@@ -1349,8 +1349,7 @@ static struct fb_ops imsttfb_ops = {
1349 .fb_ioctl = imsttfb_ioctl, 1349 .fb_ioctl = imsttfb_ioctl,
1350}; 1350};
1351 1351
1352static void __devinit 1352static void init_imstt(struct fb_info *info)
1353init_imstt(struct fb_info *info)
1354{ 1353{
1355 struct imstt_par *par = info->par; 1354 struct imstt_par *par = info->par;
1356 __u32 i, tmp, *ip, *end; 1355 __u32 i, tmp, *ip, *end;
@@ -1466,8 +1465,7 @@ init_imstt(struct fb_info *info)
1466 info->node, info->fix.id, info->fix.smem_len >> 20, tmp); 1465 info->node, info->fix.id, info->fix.smem_len >> 20, tmp);
1467} 1466}
1468 1467
1469static int __devinit 1468static int imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1470imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1471{ 1469{
1472 unsigned long addr, size; 1470 unsigned long addr, size;
1473 struct imstt_par *par; 1471 struct imstt_par *par;
@@ -1534,8 +1532,7 @@ imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1534 return 0; 1532 return 0;
1535} 1533}
1536 1534
1537static void __devexit 1535static void imsttfb_remove(struct pci_dev *pdev)
1538imsttfb_remove(struct pci_dev *pdev)
1539{ 1536{
1540 struct fb_info *info = pci_get_drvdata(pdev); 1537 struct fb_info *info = pci_get_drvdata(pdev);
1541 struct imstt_par *par = info->par; 1538 struct imstt_par *par = info->par;
diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c
index e501dbc966b3..0abf2bf20836 100644
--- a/drivers/video/imxfb.c
+++ b/drivers/video/imxfb.c
@@ -139,6 +139,7 @@ struct imxfb_info {
139 struct clk *clk_ahb; 139 struct clk *clk_ahb;
140 struct clk *clk_per; 140 struct clk *clk_per;
141 enum imxfb_type devtype; 141 enum imxfb_type devtype;
142 bool enabled;
142 143
143 /* 144 /*
144 * These are the addresses we mapped 145 * These are the addresses we mapped
@@ -536,6 +537,10 @@ static void imxfb_exit_backlight(struct imxfb_info *fbi)
536 537
537static void imxfb_enable_controller(struct imxfb_info *fbi) 538static void imxfb_enable_controller(struct imxfb_info *fbi)
538{ 539{
540
541 if (fbi->enabled)
542 return;
543
539 pr_debug("Enabling LCD controller\n"); 544 pr_debug("Enabling LCD controller\n");
540 545
541 writel(fbi->screen_dma, fbi->regs + LCDC_SSA); 546 writel(fbi->screen_dma, fbi->regs + LCDC_SSA);
@@ -556,6 +561,7 @@ static void imxfb_enable_controller(struct imxfb_info *fbi)
556 clk_prepare_enable(fbi->clk_ipg); 561 clk_prepare_enable(fbi->clk_ipg);
557 clk_prepare_enable(fbi->clk_ahb); 562 clk_prepare_enable(fbi->clk_ahb);
558 clk_prepare_enable(fbi->clk_per); 563 clk_prepare_enable(fbi->clk_per);
564 fbi->enabled = true;
559 565
560 if (fbi->backlight_power) 566 if (fbi->backlight_power)
561 fbi->backlight_power(1); 567 fbi->backlight_power(1);
@@ -565,6 +571,9 @@ static void imxfb_enable_controller(struct imxfb_info *fbi)
565 571
566static void imxfb_disable_controller(struct imxfb_info *fbi) 572static void imxfb_disable_controller(struct imxfb_info *fbi)
567{ 573{
574 if (!fbi->enabled)
575 return;
576
568 pr_debug("Disabling LCD controller\n"); 577 pr_debug("Disabling LCD controller\n");
569 578
570 if (fbi->backlight_power) 579 if (fbi->backlight_power)
@@ -575,6 +584,7 @@ static void imxfb_disable_controller(struct imxfb_info *fbi)
575 clk_disable_unprepare(fbi->clk_per); 584 clk_disable_unprepare(fbi->clk_per);
576 clk_disable_unprepare(fbi->clk_ipg); 585 clk_disable_unprepare(fbi->clk_ipg);
577 clk_disable_unprepare(fbi->clk_ahb); 586 clk_disable_unprepare(fbi->clk_ahb);
587 fbi->enabled = false;
578 588
579 writel(0, fbi->regs + LCDC_RMCR); 589 writel(0, fbi->regs + LCDC_RMCR);
580} 590}
@@ -729,6 +739,8 @@ static int __init imxfb_init_fbinfo(struct platform_device *pdev)
729 739
730 memset(fbi, 0, sizeof(struct imxfb_info)); 740 memset(fbi, 0, sizeof(struct imxfb_info));
731 741
742 fbi->devtype = pdev->id_entry->driver_data;
743
732 strlcpy(info->fix.id, IMX_NAME, sizeof(info->fix.id)); 744 strlcpy(info->fix.id, IMX_NAME, sizeof(info->fix.id));
733 745
734 info->fix.type = FB_TYPE_PACKED_PIXELS; 746 info->fix.type = FB_TYPE_PACKED_PIXELS;
@@ -789,7 +801,6 @@ static int __init imxfb_probe(struct platform_device *pdev)
789 return -ENOMEM; 801 return -ENOMEM;
790 802
791 fbi = info->par; 803 fbi = info->par;
792 fbi->devtype = pdev->id_entry->driver_data;
793 804
794 if (!fb_mode) 805 if (!fb_mode)
795 fb_mode = pdata->mode[0].mode.name; 806 fb_mode = pdata->mode[0].mode.name;
@@ -917,7 +928,7 @@ failed_init:
917 return ret; 928 return ret;
918} 929}
919 930
920static int __devexit imxfb_remove(struct platform_device *pdev) 931static int imxfb_remove(struct platform_device *pdev)
921{ 932{
922 struct imx_fb_platform_data *pdata; 933 struct imx_fb_platform_data *pdata;
923 struct fb_info *info = platform_get_drvdata(pdev); 934 struct fb_info *info = platform_get_drvdata(pdev);
@@ -959,7 +970,7 @@ void imxfb_shutdown(struct platform_device * dev)
959static struct platform_driver imxfb_driver = { 970static struct platform_driver imxfb_driver = {
960 .suspend = imxfb_suspend, 971 .suspend = imxfb_suspend,
961 .resume = imxfb_resume, 972 .resume = imxfb_resume,
962 .remove = __devexit_p(imxfb_remove), 973 .remove = imxfb_remove,
963 .shutdown = imxfb_shutdown, 974 .shutdown = imxfb_shutdown,
964 .driver = { 975 .driver = {
965 .name = DRIVER_NAME, 976 .name = DRIVER_NAME,
diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c
index bdcbfbae2777..8209e46c5d28 100644
--- a/drivers/video/intelfb/intelfbdrv.c
+++ b/drivers/video/intelfb/intelfbdrv.c
@@ -132,7 +132,7 @@
132#include "intelfbhw.h" 132#include "intelfbhw.h"
133#include "../edid.h" 133#include "../edid.h"
134 134
135static void __devinit get_initial_mode(struct intelfb_info *dinfo); 135static void get_initial_mode(struct intelfb_info *dinfo);
136static void update_dinfo(struct intelfb_info *dinfo, 136static void update_dinfo(struct intelfb_info *dinfo,
137 struct fb_var_screeninfo *var); 137 struct fb_var_screeninfo *var);
138static int intelfb_open(struct fb_info *info, int user); 138static int intelfb_open(struct fb_info *info, int user);
@@ -162,10 +162,10 @@ static int intelfb_sync(struct fb_info *info);
162static int intelfb_ioctl(struct fb_info *info, 162static int intelfb_ioctl(struct fb_info *info,
163 unsigned int cmd, unsigned long arg); 163 unsigned int cmd, unsigned long arg);
164 164
165static int __devinit intelfb_pci_register(struct pci_dev *pdev, 165static int intelfb_pci_register(struct pci_dev *pdev,
166 const struct pci_device_id *ent); 166 const struct pci_device_id *ent);
167static void __devexit intelfb_pci_unregister(struct pci_dev *pdev); 167static void intelfb_pci_unregister(struct pci_dev *pdev);
168static int __devinit intelfb_set_fbinfo(struct intelfb_info *dinfo); 168static int intelfb_set_fbinfo(struct intelfb_info *dinfo);
169 169
170/* 170/*
171 * Limiting the class to PCI_CLASS_DISPLAY_VGA prevents function 1 of the 171 * Limiting the class to PCI_CLASS_DISPLAY_VGA prevents function 1 of the
@@ -177,7 +177,7 @@ static int __devinit intelfb_set_fbinfo(struct intelfb_info *dinfo);
177#define INTELFB_CLASS_MASK 0 177#define INTELFB_CLASS_MASK 0
178#endif 178#endif
179 179
180static struct pci_device_id intelfb_pci_table[] __devinitdata = { 180static struct pci_device_id intelfb_pci_table[] = {
181 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_830M, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_830M }, 181 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_830M, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_830M },
182 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_845G, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_845G }, 182 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_845G, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_845G },
183 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_85XGM, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_85XGM }, 183 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_85XGM, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, INTELFB_CLASS_MASK, INTEL_85XGM },
@@ -219,7 +219,7 @@ static struct pci_driver intelfb_driver = {
219 .name = "intelfb", 219 .name = "intelfb",
220 .id_table = intelfb_pci_table, 220 .id_table = intelfb_pci_table,
221 .probe = intelfb_pci_register, 221 .probe = intelfb_pci_register,
222 .remove = __devexit_p(intelfb_pci_unregister) 222 .remove = intelfb_pci_unregister,
223}; 223};
224 224
225/* Module description/parameters */ 225/* Module description/parameters */
@@ -415,7 +415,7 @@ module_exit(intelfb_exit);
415 ***************************************************************/ 415 ***************************************************************/
416 416
417#ifdef CONFIG_MTRR 417#ifdef CONFIG_MTRR
418static inline void __devinit set_mtrr(struct intelfb_info *dinfo) 418static inline void set_mtrr(struct intelfb_info *dinfo)
419{ 419{
420 dinfo->mtrr_reg = mtrr_add(dinfo->aperture.physical, 420 dinfo->mtrr_reg = mtrr_add(dinfo->aperture.physical,
421 dinfo->aperture.size, MTRR_TYPE_WRCOMB, 1); 421 dinfo->aperture.size, MTRR_TYPE_WRCOMB, 1);
@@ -497,8 +497,8 @@ static void cleanup(struct intelfb_info *dinfo)
497} while (0) 497} while (0)
498 498
499 499
500static int __devinit intelfb_pci_register(struct pci_dev *pdev, 500static int intelfb_pci_register(struct pci_dev *pdev,
501 const struct pci_device_id *ent) 501 const struct pci_device_id *ent)
502{ 502{
503 struct fb_info *info; 503 struct fb_info *info;
504 struct intelfb_info *dinfo; 504 struct intelfb_info *dinfo;
@@ -921,8 +921,7 @@ err_out_cmap:
921 return -ENODEV; 921 return -ENODEV;
922} 922}
923 923
924static void __devexit 924static void intelfb_pci_unregister(struct pci_dev *pdev)
925intelfb_pci_unregister(struct pci_dev *pdev)
926{ 925{
927 struct intelfb_info *dinfo = pci_get_drvdata(pdev); 926 struct intelfb_info *dinfo = pci_get_drvdata(pdev);
928 927
@@ -970,7 +969,7 @@ static __inline__ int var_to_refresh(const struct fb_var_screeninfo *var)
970 * Various intialisation functions * 969 * Various intialisation functions *
971 ***************************************************************/ 970 ***************************************************************/
972 971
973static void __devinit get_initial_mode(struct intelfb_info *dinfo) 972static void get_initial_mode(struct intelfb_info *dinfo)
974{ 973{
975 struct fb_var_screeninfo *var; 974 struct fb_var_screeninfo *var;
976 int xtot, ytot; 975 int xtot, ytot;
@@ -1037,7 +1036,7 @@ static void __devinit get_initial_mode(struct intelfb_info *dinfo)
1037 } 1036 }
1038} 1037}
1039 1038
1040static int __devinit intelfb_init_var(struct intelfb_info *dinfo) 1039static int intelfb_init_var(struct intelfb_info *dinfo)
1041{ 1040{
1042 struct fb_var_screeninfo *var; 1041 struct fb_var_screeninfo *var;
1043 int msrc = 0; 1042 int msrc = 0;
@@ -1118,7 +1117,7 @@ static int __devinit intelfb_init_var(struct intelfb_info *dinfo)
1118 return 0; 1117 return 0;
1119} 1118}
1120 1119
1121static int __devinit intelfb_set_fbinfo(struct intelfb_info *dinfo) 1120static int intelfb_set_fbinfo(struct intelfb_info *dinfo)
1122{ 1121{
1123 struct fb_info *info = dinfo->info; 1122 struct fb_info *info = dinfo->info;
1124 1123
diff --git a/drivers/video/jz4740_fb.c b/drivers/video/jz4740_fb.c
index 4d25711b9982..d999bb5e0485 100644
--- a/drivers/video/jz4740_fb.c
+++ b/drivers/video/jz4740_fb.c
@@ -136,7 +136,7 @@ struct jzfb {
136 uint32_t pseudo_palette[16]; 136 uint32_t pseudo_palette[16];
137}; 137};
138 138
139static const struct fb_fix_screeninfo jzfb_fix __devinitconst = { 139static const struct fb_fix_screeninfo jzfb_fix = {
140 .id = "JZ4740 FB", 140 .id = "JZ4740 FB",
141 .type = FB_TYPE_PACKED_PIXELS, 141 .type = FB_TYPE_PACKED_PIXELS,
142 .visual = FB_VISUAL_TRUECOLOR, 142 .visual = FB_VISUAL_TRUECOLOR,
@@ -619,7 +619,7 @@ static struct fb_ops jzfb_ops = {
619 .fb_setcolreg = jzfb_setcolreg, 619 .fb_setcolreg = jzfb_setcolreg,
620}; 620};
621 621
622static int __devinit jzfb_probe(struct platform_device *pdev) 622static int jzfb_probe(struct platform_device *pdev)
623{ 623{
624 int ret; 624 int ret;
625 struct jzfb *jzfb; 625 struct jzfb *jzfb;
@@ -725,7 +725,7 @@ err_framebuffer_release:
725 return ret; 725 return ret;
726} 726}
727 727
728static int __devexit jzfb_remove(struct platform_device *pdev) 728static int jzfb_remove(struct platform_device *pdev)
729{ 729{
730 struct jzfb *jzfb = platform_get_drvdata(pdev); 730 struct jzfb *jzfb = platform_get_drvdata(pdev);
731 731
@@ -794,7 +794,7 @@ static const struct dev_pm_ops jzfb_pm_ops = {
794 794
795static struct platform_driver jzfb_driver = { 795static struct platform_driver jzfb_driver = {
796 .probe = jzfb_probe, 796 .probe = jzfb_probe,
797 .remove = __devexit_p(jzfb_remove), 797 .remove = jzfb_remove,
798 .driver = { 798 .driver = {
799 .name = "jz4740-fb", 799 .name = "jz4740-fb",
800 .pm = JZFB_PM_OPS, 800 .pm = JZFB_PM_OPS,
diff --git a/drivers/video/kyro/fbdev.c b/drivers/video/kyro/fbdev.c
index acb9370fdb14..6157f74ac600 100644
--- a/drivers/video/kyro/fbdev.c
+++ b/drivers/video/kyro/fbdev.c
@@ -40,14 +40,14 @@
40#define KHZ2PICOS(a) (1000000000UL/(a)) 40#define KHZ2PICOS(a) (1000000000UL/(a))
41 41
42/****************************************************************************/ 42/****************************************************************************/
43static struct fb_fix_screeninfo kyro_fix __devinitdata = { 43static struct fb_fix_screeninfo kyro_fix = {
44 .id = "ST Kyro", 44 .id = "ST Kyro",
45 .type = FB_TYPE_PACKED_PIXELS, 45 .type = FB_TYPE_PACKED_PIXELS,
46 .visual = FB_VISUAL_TRUECOLOR, 46 .visual = FB_VISUAL_TRUECOLOR,
47 .accel = FB_ACCEL_NONE, 47 .accel = FB_ACCEL_NONE,
48}; 48};
49 49
50static struct fb_var_screeninfo kyro_var __devinitdata = { 50static struct fb_var_screeninfo kyro_var = {
51 /* 640x480, 16bpp @ 60 Hz */ 51 /* 640x480, 16bpp @ 60 Hz */
52 .xres = 640, 52 .xres = 640,
53 .yres = 480, 53 .yres = 480,
@@ -81,18 +81,18 @@ typedef struct {
81/* global graphics card info structure (one per card) */ 81/* global graphics card info structure (one per card) */
82static device_info_t deviceInfo; 82static device_info_t deviceInfo;
83 83
84static char *mode_option __devinitdata = NULL; 84static char *mode_option = NULL;
85static int nopan __devinitdata = 0; 85static int nopan = 0;
86static int nowrap __devinitdata = 1; 86static int nowrap = 1;
87#ifdef CONFIG_MTRR 87#ifdef CONFIG_MTRR
88static int nomtrr __devinitdata = 0; 88static int nomtrr = 0;
89#endif 89#endif
90 90
91/* PCI driver prototypes */ 91/* PCI driver prototypes */
92static int kyrofb_probe(struct pci_dev *pdev, const struct pci_device_id *ent); 92static int kyrofb_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
93static void kyrofb_remove(struct pci_dev *pdev); 93static void kyrofb_remove(struct pci_dev *pdev);
94 94
95static struct fb_videomode kyro_modedb[] __devinitdata = { 95static struct fb_videomode kyro_modedb[] = {
96 { 96 {
97 /* 640x350 @ 85Hz */ 97 /* 640x350 @ 85Hz */
98 NULL, 85, 640, 350, KHZ2PICOS(31500), 98 NULL, 85, 640, 350, KHZ2PICOS(31500),
@@ -653,7 +653,7 @@ static struct pci_driver kyrofb_pci_driver = {
653 .name = "kyrofb", 653 .name = "kyrofb",
654 .id_table = kyrofb_pci_tbl, 654 .id_table = kyrofb_pci_tbl,
655 .probe = kyrofb_probe, 655 .probe = kyrofb_probe,
656 .remove = __devexit_p(kyrofb_remove), 656 .remove = kyrofb_remove,
657}; 657};
658 658
659static struct fb_ops kyrofb_ops = { 659static struct fb_ops kyrofb_ops = {
@@ -667,8 +667,7 @@ static struct fb_ops kyrofb_ops = {
667 .fb_imageblit = cfb_imageblit, 667 .fb_imageblit = cfb_imageblit,
668}; 668};
669 669
670static int __devinit kyrofb_probe(struct pci_dev *pdev, 670static int kyrofb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
671 const struct pci_device_id *ent)
672{ 671{
673 struct fb_info *info; 672 struct fb_info *info;
674 struct kyrofb_info *currentpar; 673 struct kyrofb_info *currentpar;
@@ -754,7 +753,7 @@ out_unmap:
754 return -EINVAL; 753 return -EINVAL;
755} 754}
756 755
757static void __devexit kyrofb_remove(struct pci_dev *pdev) 756static void kyrofb_remove(struct pci_dev *pdev)
758{ 757{
759 struct fb_info *info = pci_get_drvdata(pdev); 758 struct fb_info *info = pci_get_drvdata(pdev);
760 struct kyrofb_info *par = info->par; 759 struct kyrofb_info *par = info->par;
diff --git a/drivers/video/leo.c b/drivers/video/leo.c
index 9e946e2c1da9..b17f5009a436 100644
--- a/drivers/video/leo.c
+++ b/drivers/video/leo.c
@@ -547,7 +547,7 @@ static void leo_unmap_regs(struct platform_device *op, struct fb_info *info,
547 of_iounmap(&op->resource[0], info->screen_base, 0x800000); 547 of_iounmap(&op->resource[0], info->screen_base, 0x800000);
548} 548}
549 549
550static int __devinit leo_probe(struct platform_device *op) 550static int leo_probe(struct platform_device *op)
551{ 551{
552 struct device_node *dp = op->dev.of_node; 552 struct device_node *dp = op->dev.of_node;
553 struct fb_info *info; 553 struct fb_info *info;
@@ -636,7 +636,7 @@ out_err:
636 return err; 636 return err;
637} 637}
638 638
639static int __devexit leo_remove(struct platform_device *op) 639static int leo_remove(struct platform_device *op)
640{ 640{
641 struct fb_info *info = dev_get_drvdata(&op->dev); 641 struct fb_info *info = dev_get_drvdata(&op->dev);
642 struct leo_par *par = info->par; 642 struct leo_par *par = info->par;
@@ -668,7 +668,7 @@ static struct platform_driver leo_driver = {
668 .of_match_table = leo_match, 668 .of_match_table = leo_match,
669 }, 669 },
670 .probe = leo_probe, 670 .probe = leo_probe,
671 .remove = __devexit_p(leo_remove), 671 .remove = leo_remove,
672}; 672};
673 673
674static int __init leo_init(void) 674static int __init leo_init(void)
diff --git a/drivers/video/mb862xx/mb862xxfbdrv.c b/drivers/video/mb862xx/mb862xxfbdrv.c
index d68e332aa21c..91c59c9fb082 100644
--- a/drivers/video/mb862xx/mb862xxfbdrv.c
+++ b/drivers/video/mb862xx/mb862xxfbdrv.c
@@ -668,7 +668,7 @@ static int mb862xx_gdc_init(struct mb862xxfb_par *par)
668 return 0; 668 return 0;
669} 669}
670 670
671static int __devinit of_platform_mb862xx_probe(struct platform_device *ofdev) 671static int of_platform_mb862xx_probe(struct platform_device *ofdev)
672{ 672{
673 struct device_node *np = ofdev->dev.of_node; 673 struct device_node *np = ofdev->dev.of_node;
674 struct device *dev = &ofdev->dev; 674 struct device *dev = &ofdev->dev;
@@ -786,7 +786,7 @@ fbrel:
786 return ret; 786 return ret;
787} 787}
788 788
789static int __devexit of_platform_mb862xx_remove(struct platform_device *ofdev) 789static int of_platform_mb862xx_remove(struct platform_device *ofdev)
790{ 790{
791 struct fb_info *fbi = dev_get_drvdata(&ofdev->dev); 791 struct fb_info *fbi = dev_get_drvdata(&ofdev->dev);
792 struct mb862xxfb_par *par = fbi->par; 792 struct mb862xxfb_par *par = fbi->par;
@@ -823,7 +823,7 @@ static int __devexit of_platform_mb862xx_remove(struct platform_device *ofdev)
823/* 823/*
824 * common types 824 * common types
825 */ 825 */
826static struct of_device_id __devinitdata of_platform_mb862xx_tbl[] = { 826static struct of_device_id of_platform_mb862xx_tbl[] = {
827 { .compatible = "fujitsu,MB86276", }, 827 { .compatible = "fujitsu,MB86276", },
828 { .compatible = "fujitsu,lime", }, 828 { .compatible = "fujitsu,lime", },
829 { .compatible = "fujitsu,MB86277", }, 829 { .compatible = "fujitsu,MB86277", },
@@ -841,7 +841,7 @@ static struct platform_driver of_platform_mb862xxfb_driver = {
841 .of_match_table = of_platform_mb862xx_tbl, 841 .of_match_table = of_platform_mb862xx_tbl,
842 }, 842 },
843 .probe = of_platform_mb862xx_probe, 843 .probe = of_platform_mb862xx_probe,
844 .remove = __devexit_p(of_platform_mb862xx_remove), 844 .remove = of_platform_mb862xx_remove,
845}; 845};
846#endif 846#endif
847 847
@@ -984,7 +984,7 @@ static inline int mb862xx_pci_gdc_init(struct mb862xxfb_par *par)
984#define CHIP_ID(id) \ 984#define CHIP_ID(id) \
985 { PCI_DEVICE(PCI_VENDOR_ID_FUJITSU_LIMITED, id) } 985 { PCI_DEVICE(PCI_VENDOR_ID_FUJITSU_LIMITED, id) }
986 986
987static struct pci_device_id mb862xx_pci_tbl[] __devinitdata = { 987static struct pci_device_id mb862xx_pci_tbl[] = {
988 /* MB86295/MB86296 */ 988 /* MB86295/MB86296 */
989 CHIP_ID(PCI_DEVICE_ID_FUJITSU_CORALP), 989 CHIP_ID(PCI_DEVICE_ID_FUJITSU_CORALP),
990 CHIP_ID(PCI_DEVICE_ID_FUJITSU_CORALPA), 990 CHIP_ID(PCI_DEVICE_ID_FUJITSU_CORALPA),
@@ -995,8 +995,8 @@ static struct pci_device_id mb862xx_pci_tbl[] __devinitdata = {
995 995
996MODULE_DEVICE_TABLE(pci, mb862xx_pci_tbl); 996MODULE_DEVICE_TABLE(pci, mb862xx_pci_tbl);
997 997
998static int __devinit mb862xx_pci_probe(struct pci_dev *pdev, 998static int mb862xx_pci_probe(struct pci_dev *pdev,
999 const struct pci_device_id *ent) 999 const struct pci_device_id *ent)
1000{ 1000{
1001 struct mb862xxfb_par *par; 1001 struct mb862xxfb_par *par;
1002 struct fb_info *info; 1002 struct fb_info *info;
@@ -1133,7 +1133,7 @@ out:
1133 return ret; 1133 return ret;
1134} 1134}
1135 1135
1136static void __devexit mb862xx_pci_remove(struct pci_dev *pdev) 1136static void mb862xx_pci_remove(struct pci_dev *pdev)
1137{ 1137{
1138 struct fb_info *fbi = pci_get_drvdata(pdev); 1138 struct fb_info *fbi = pci_get_drvdata(pdev);
1139 struct mb862xxfb_par *par = fbi->par; 1139 struct mb862xxfb_par *par = fbi->par;
@@ -1174,11 +1174,11 @@ static struct pci_driver mb862xxfb_pci_driver = {
1174 .name = DRV_NAME, 1174 .name = DRV_NAME,
1175 .id_table = mb862xx_pci_tbl, 1175 .id_table = mb862xx_pci_tbl,
1176 .probe = mb862xx_pci_probe, 1176 .probe = mb862xx_pci_probe,
1177 .remove = __devexit_p(mb862xx_pci_remove), 1177 .remove = mb862xx_pci_remove,
1178}; 1178};
1179#endif 1179#endif
1180 1180
1181static int __devinit mb862xxfb_init(void) 1181static int mb862xxfb_init(void)
1182{ 1182{
1183 int ret = -ENODEV; 1183 int ret = -ENODEV;
1184 1184
diff --git a/drivers/video/mbx/mbxdebugfs.c b/drivers/video/mbx/mbxdebugfs.c
index 12dec7634c55..4449f249b0e7 100644
--- a/drivers/video/mbx/mbxdebugfs.c
+++ b/drivers/video/mbx/mbxdebugfs.c
@@ -213,7 +213,7 @@ static const struct file_operations misc_fops = {
213 .llseek = default_llseek, 213 .llseek = default_llseek,
214}; 214};
215 215
216static void __devinit mbxfb_debugfs_init(struct fb_info *fbi) 216static void mbxfb_debugfs_init(struct fb_info *fbi)
217{ 217{
218 struct mbxfb_info *mfbi = fbi->par; 218 struct mbxfb_info *mfbi = fbi->par;
219 struct mbxfb_debugfs_data *dbg; 219 struct mbxfb_debugfs_data *dbg;
@@ -236,7 +236,7 @@ static void __devinit mbxfb_debugfs_init(struct fb_info *fbi)
236 fbi, &misc_fops); 236 fbi, &misc_fops);
237} 237}
238 238
239static void __devexit mbxfb_debugfs_remove(struct fb_info *fbi) 239static void mbxfb_debugfs_remove(struct fb_info *fbi)
240{ 240{
241 struct mbxfb_info *mfbi = fbi->par; 241 struct mbxfb_info *mfbi = fbi->par;
242 struct mbxfb_debugfs_data *dbg = mfbi->debugfs_data; 242 struct mbxfb_debugfs_data *dbg = mfbi->debugfs_data;
diff --git a/drivers/video/mbx/mbxfb.c b/drivers/video/mbx/mbxfb.c
index 6563e50413c1..0c1a874ffd2b 100644
--- a/drivers/video/mbx/mbxfb.c
+++ b/drivers/video/mbx/mbxfb.c
@@ -79,7 +79,7 @@ struct mbxfb_info {
79 79
80}; 80};
81 81
82static struct fb_var_screeninfo mbxfb_default __devinitdata = { 82static struct fb_var_screeninfo mbxfb_default = {
83 .xres = 640, 83 .xres = 640,
84 .yres = 480, 84 .yres = 480,
85 .xres_virtual = 640, 85 .xres_virtual = 640,
@@ -102,7 +102,7 @@ static struct fb_var_screeninfo mbxfb_default __devinitdata = {
102 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 102 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
103}; 103};
104 104
105static struct fb_fix_screeninfo mbxfb_fix __devinitdata = { 105static struct fb_fix_screeninfo mbxfb_fix = {
106 .id = "MBX", 106 .id = "MBX",
107 .type = FB_TYPE_PACKED_PIXELS, 107 .type = FB_TYPE_PACKED_PIXELS,
108 .visual = FB_VISUAL_TRUECOLOR, 108 .visual = FB_VISUAL_TRUECOLOR,
@@ -687,7 +687,7 @@ static struct fb_ops mbxfb_ops = {
687 Enable external SDRAM controller. Assume that all clocks are active 687 Enable external SDRAM controller. Assume that all clocks are active
688 by now. 688 by now.
689*/ 689*/
690static void __devinit setup_memc(struct fb_info *fbi) 690static void setup_memc(struct fb_info *fbi)
691{ 691{
692 unsigned long tmp; 692 unsigned long tmp;
693 int i; 693 int i;
@@ -747,7 +747,7 @@ static void enable_clocks(struct fb_info *fbi)
747 write_reg_dly(0x00000001, PIXCLKDIV); 747 write_reg_dly(0x00000001, PIXCLKDIV);
748} 748}
749 749
750static void __devinit setup_graphics(struct fb_info *fbi) 750static void setup_graphics(struct fb_info *fbi)
751{ 751{
752 unsigned long gsctrl; 752 unsigned long gsctrl;
753 unsigned long vscadr; 753 unsigned long vscadr;
@@ -781,7 +781,7 @@ static void __devinit setup_graphics(struct fb_info *fbi)
781 write_reg_dly(vscadr, VSCADR); 781 write_reg_dly(vscadr, VSCADR);
782} 782}
783 783
784static void __devinit setup_display(struct fb_info *fbi) 784static void setup_display(struct fb_info *fbi)
785{ 785{
786 unsigned long dsctrl = 0; 786 unsigned long dsctrl = 0;
787 787
@@ -795,7 +795,7 @@ static void __devinit setup_display(struct fb_info *fbi)
795 write_reg_dly((readl(DSCTRL) | DSCTRL_SYNCGEN_EN), DSCTRL); 795 write_reg_dly((readl(DSCTRL) | DSCTRL_SYNCGEN_EN), DSCTRL);
796} 796}
797 797
798static void __devinit enable_controller(struct fb_info *fbi) 798static void enable_controller(struct fb_info *fbi)
799{ 799{
800 u32 svctrl, shctrl; 800 u32 svctrl, shctrl;
801 801
@@ -881,7 +881,7 @@ static int mbxfb_resume(struct platform_device *dev)
881 881
882#define res_size(_r) (((_r)->end - (_r)->start) + 1) 882#define res_size(_r) (((_r)->end - (_r)->start) + 1)
883 883
884static int __devinit mbxfb_probe(struct platform_device *dev) 884static int mbxfb_probe(struct platform_device *dev)
885{ 885{
886 int ret; 886 int ret;
887 struct fb_info *fbi; 887 struct fb_info *fbi;
@@ -1006,7 +1006,7 @@ err1:
1006 return ret; 1006 return ret;
1007} 1007}
1008 1008
1009static int __devexit mbxfb_remove(struct platform_device *dev) 1009static int mbxfb_remove(struct platform_device *dev)
1010{ 1010{
1011 struct fb_info *fbi = platform_get_drvdata(dev); 1011 struct fb_info *fbi = platform_get_drvdata(dev);
1012 1012
@@ -1038,7 +1038,7 @@ static int __devexit mbxfb_remove(struct platform_device *dev)
1038 1038
1039static struct platform_driver mbxfb_driver = { 1039static struct platform_driver mbxfb_driver = {
1040 .probe = mbxfb_probe, 1040 .probe = mbxfb_probe,
1041 .remove = __devexit_p(mbxfb_remove), 1041 .remove = mbxfb_remove,
1042 .suspend = mbxfb_suspend, 1042 .suspend = mbxfb_suspend,
1043 .resume = mbxfb_resume, 1043 .resume = mbxfb_resume,
1044 .driver = { 1044 .driver = {
diff --git a/drivers/video/metronomefb.c b/drivers/video/metronomefb.c
index 97d45e5115e2..f30150d71be9 100644
--- a/drivers/video/metronomefb.c
+++ b/drivers/video/metronomefb.c
@@ -99,7 +99,7 @@ static struct epd_frame epd_frame_table[] = {
99 }, 99 },
100}; 100};
101 101
102static struct fb_fix_screeninfo metronomefb_fix __devinitdata = { 102static struct fb_fix_screeninfo metronomefb_fix = {
103 .id = "metronomefb", 103 .id = "metronomefb",
104 .type = FB_TYPE_PACKED_PIXELS, 104 .type = FB_TYPE_PACKED_PIXELS,
105 .visual = FB_VISUAL_STATIC_PSEUDOCOLOR, 105 .visual = FB_VISUAL_STATIC_PSEUDOCOLOR,
@@ -110,7 +110,7 @@ static struct fb_fix_screeninfo metronomefb_fix __devinitdata = {
110 .accel = FB_ACCEL_NONE, 110 .accel = FB_ACCEL_NONE,
111}; 111};
112 112
113static struct fb_var_screeninfo metronomefb_var __devinitdata = { 113static struct fb_var_screeninfo metronomefb_var = {
114 .xres = DPY_W, 114 .xres = DPY_W,
115 .yres = DPY_H, 115 .yres = DPY_H,
116 .xres_virtual = DPY_W, 116 .xres_virtual = DPY_W,
@@ -167,8 +167,8 @@ static u16 calc_img_cksum(u16 *start, int length)
167} 167}
168 168
169/* here we decode the incoming waveform file and populate metromem */ 169/* here we decode the incoming waveform file and populate metromem */
170static int __devinit load_waveform(u8 *mem, size_t size, int m, int t, 170static int load_waveform(u8 *mem, size_t size, int m, int t,
171 struct metronomefb_par *par) 171 struct metronomefb_par *par)
172{ 172{
173 int tta; 173 int tta;
174 int wmta; 174 int wmta;
@@ -338,7 +338,7 @@ static int metronome_display_cmd(struct metronomefb_par *par)
338 return par->board->met_wait_event_intr(par); 338 return par->board->met_wait_event_intr(par);
339} 339}
340 340
341static int __devinit metronome_powerup_cmd(struct metronomefb_par *par) 341static int metronome_powerup_cmd(struct metronomefb_par *par)
342{ 342{
343 int i; 343 int i;
344 u16 cs; 344 u16 cs;
@@ -367,7 +367,7 @@ static int __devinit metronome_powerup_cmd(struct metronomefb_par *par)
367 return par->board->met_wait_event(par); 367 return par->board->met_wait_event(par);
368} 368}
369 369
370static int __devinit metronome_config_cmd(struct metronomefb_par *par) 370static int metronome_config_cmd(struct metronomefb_par *par)
371{ 371{
372 /* setup config command 372 /* setup config command
373 we can't immediately set the opcode since the controller 373 we can't immediately set the opcode since the controller
@@ -385,7 +385,7 @@ static int __devinit metronome_config_cmd(struct metronomefb_par *par)
385 return par->board->met_wait_event(par); 385 return par->board->met_wait_event(par);
386} 386}
387 387
388static int __devinit metronome_init_cmd(struct metronomefb_par *par) 388static int metronome_init_cmd(struct metronomefb_par *par)
389{ 389{
390 int i; 390 int i;
391 u16 cs; 391 u16 cs;
@@ -411,7 +411,7 @@ static int __devinit metronome_init_cmd(struct metronomefb_par *par)
411 return par->board->met_wait_event(par); 411 return par->board->met_wait_event(par);
412} 412}
413 413
414static int __devinit metronome_init_regs(struct metronomefb_par *par) 414static int metronome_init_regs(struct metronomefb_par *par)
415{ 415{
416 int res; 416 int res;
417 417
@@ -569,7 +569,7 @@ static struct fb_deferred_io metronomefb_defio = {
569 .deferred_io = metronomefb_dpy_deferred_io, 569 .deferred_io = metronomefb_dpy_deferred_io,
570}; 570};
571 571
572static int __devinit metronomefb_probe(struct platform_device *dev) 572static int metronomefb_probe(struct platform_device *dev)
573{ 573{
574 struct fb_info *info; 574 struct fb_info *info;
575 struct metronome_board *board; 575 struct metronome_board *board;
@@ -741,7 +741,7 @@ err:
741 return retval; 741 return retval;
742} 742}
743 743
744static int __devexit metronomefb_remove(struct platform_device *dev) 744static int metronomefb_remove(struct platform_device *dev)
745{ 745{
746 struct fb_info *info = platform_get_drvdata(dev); 746 struct fb_info *info = platform_get_drvdata(dev);
747 747
@@ -763,7 +763,7 @@ static int __devexit metronomefb_remove(struct platform_device *dev)
763 763
764static struct platform_driver metronomefb_driver = { 764static struct platform_driver metronomefb_driver = {
765 .probe = metronomefb_probe, 765 .probe = metronomefb_probe,
766 .remove = __devexit_p(metronomefb_remove), 766 .remove = metronomefb_remove,
767 .driver = { 767 .driver = {
768 .owner = THIS_MODULE, 768 .owner = THIS_MODULE,
769 .name = "metronomefb", 769 .name = "metronomefb",
diff --git a/drivers/video/msm/mddi.c b/drivers/video/msm/mddi.c
index 35ac9e8bee63..e0f8011a3c4b 100644
--- a/drivers/video/msm/mddi.c
+++ b/drivers/video/msm/mddi.c
@@ -417,7 +417,7 @@ static void mddi_resume(struct msm_mddi_client_data *cdata)
417 mddi_set_auto_hibernate(&mddi->client_data, 1); 417 mddi_set_auto_hibernate(&mddi->client_data, 1);
418} 418}
419 419
420static int __devinit mddi_get_client_caps(struct mddi_info *mddi) 420static int mddi_get_client_caps(struct mddi_info *mddi)
421{ 421{
422 int i, j; 422 int i, j;
423 423
@@ -619,9 +619,8 @@ uint32_t mddi_remote_read(struct msm_mddi_client_data *cdata, uint32_t reg)
619 619
620static struct mddi_info mddi_info[2]; 620static struct mddi_info mddi_info[2];
621 621
622static int __devinit mddi_clk_setup(struct platform_device *pdev, 622static int mddi_clk_setup(struct platform_device *pdev, struct mddi_info *mddi,
623 struct mddi_info *mddi, 623 unsigned long clk_rate)
624 unsigned long clk_rate)
625{ 624{
626 int ret; 625 int ret;
627 626
@@ -664,7 +663,7 @@ static int __init mddi_rev_data_setup(struct mddi_info *mddi)
664 return 0; 663 return 0;
665} 664}
666 665
667static int __devinit mddi_probe(struct platform_device *pdev) 666static int mddi_probe(struct platform_device *pdev)
668{ 667{
669 struct msm_mddi_platform_data *pdata = pdev->dev.platform_data; 668 struct msm_mddi_platform_data *pdata = pdev->dev.platform_data;
670 struct mddi_info *mddi = &mddi_info[pdev->id]; 669 struct mddi_info *mddi = &mddi_info[pdev->id];
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index 49619b441500..755556ca5b2d 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -369,7 +369,8 @@ static void mxsfb_disable_controller(struct fb_info *fb_info)
369 loop--; 369 loop--;
370 } 370 }
371 371
372 writel(VDCTRL4_SYNC_SIGNALS_ON, host->base + LCDC_VDCTRL4 + REG_CLR); 372 reg = readl(host->base + LCDC_VDCTRL4);
373 writel(reg & ~VDCTRL4_SYNC_SIGNALS_ON, host->base + LCDC_VDCTRL4);
373 374
374 clk_disable_unprepare(host->clk); 375 clk_disable_unprepare(host->clk);
375 376
@@ -586,7 +587,7 @@ static struct fb_ops mxsfb_ops = {
586 .fb_imageblit = cfb_imageblit, 587 .fb_imageblit = cfb_imageblit,
587}; 588};
588 589
589static int __devinit mxsfb_restore_mode(struct mxsfb_info *host) 590static int mxsfb_restore_mode(struct mxsfb_info *host)
590{ 591{
591 struct fb_info *fb_info = &host->fb_info; 592 struct fb_info *fb_info = &host->fb_info;
592 unsigned line_count; 593 unsigned line_count;
@@ -677,7 +678,7 @@ static int __devinit mxsfb_restore_mode(struct mxsfb_info *host)
677 return 0; 678 return 0;
678} 679}
679 680
680static int __devinit mxsfb_init_fbinfo(struct mxsfb_info *host) 681static int mxsfb_init_fbinfo(struct mxsfb_info *host)
681{ 682{
682 struct fb_info *fb_info = &host->fb_info; 683 struct fb_info *fb_info = &host->fb_info;
683 struct fb_var_screeninfo *var = &fb_info->var; 684 struct fb_var_screeninfo *var = &fb_info->var;
@@ -739,7 +740,7 @@ static int __devinit mxsfb_init_fbinfo(struct mxsfb_info *host)
739 return 0; 740 return 0;
740} 741}
741 742
742static void __devexit mxsfb_free_videomem(struct mxsfb_info *host) 743static void mxsfb_free_videomem(struct mxsfb_info *host)
743{ 744{
744 struct fb_info *fb_info = &host->fb_info; 745 struct fb_info *fb_info = &host->fb_info;
745 746
@@ -772,7 +773,7 @@ static const struct of_device_id mxsfb_dt_ids[] = {
772}; 773};
773MODULE_DEVICE_TABLE(of, mxsfb_dt_ids); 774MODULE_DEVICE_TABLE(of, mxsfb_dt_ids);
774 775
775static int __devinit mxsfb_probe(struct platform_device *pdev) 776static int mxsfb_probe(struct platform_device *pdev)
776{ 777{
777 const struct of_device_id *of_id = 778 const struct of_device_id *of_id =
778 of_match_device(mxsfb_dt_ids, &pdev->dev); 779 of_match_device(mxsfb_dt_ids, &pdev->dev);
@@ -912,7 +913,7 @@ error_alloc_info:
912 return ret; 913 return ret;
913} 914}
914 915
915static int __devexit mxsfb_remove(struct platform_device *pdev) 916static int mxsfb_remove(struct platform_device *pdev)
916{ 917{
917 struct fb_info *fb_info = platform_get_drvdata(pdev); 918 struct fb_info *fb_info = platform_get_drvdata(pdev);
918 struct mxsfb_info *host = to_imxfb_host(fb_info); 919 struct mxsfb_info *host = to_imxfb_host(fb_info);
@@ -949,7 +950,7 @@ static void mxsfb_shutdown(struct platform_device *pdev)
949 950
950static struct platform_driver mxsfb_driver = { 951static struct platform_driver mxsfb_driver = {
951 .probe = mxsfb_probe, 952 .probe = mxsfb_probe,
952 .remove = __devexit_p(mxsfb_remove), 953 .remove = mxsfb_remove,
953 .shutdown = mxsfb_shutdown, 954 .shutdown = mxsfb_shutdown,
954 .id_table = mxsfb_devtype, 955 .id_table = mxsfb_devtype,
955 .driver = { 956 .driver = {
diff --git a/drivers/video/neofb.c b/drivers/video/neofb.c
index afc9521173ef..7ef079c146e7 100644
--- a/drivers/video/neofb.c
+++ b/drivers/video/neofb.c
@@ -88,7 +88,7 @@ static bool external;
88static bool libretto; 88static bool libretto;
89static bool nostretch; 89static bool nostretch;
90static bool nopciburst; 90static bool nopciburst;
91static char *mode_option __devinitdata = NULL; 91static char *mode_option = NULL;
92 92
93#ifdef MODULE 93#ifdef MODULE
94 94
@@ -1632,7 +1632,7 @@ static struct fb_ops neofb_ops = {
1632 1632
1633/* --------------------------------------------------------------------- */ 1633/* --------------------------------------------------------------------- */
1634 1634
1635static struct fb_videomode __devinitdata mode800x480 = { 1635static struct fb_videomode mode800x480 = {
1636 .xres = 800, 1636 .xres = 800,
1637 .yres = 480, 1637 .yres = 480,
1638 .pixclock = 25000, 1638 .pixclock = 25000,
@@ -1646,8 +1646,7 @@ static struct fb_videomode __devinitdata mode800x480 = {
1646 .vmode = FB_VMODE_NONINTERLACED 1646 .vmode = FB_VMODE_NONINTERLACED
1647}; 1647};
1648 1648
1649static int __devinit neo_map_mmio(struct fb_info *info, 1649static int neo_map_mmio(struct fb_info *info, struct pci_dev *dev)
1650 struct pci_dev *dev)
1651{ 1650{
1652 struct neofb_par *par = info->par; 1651 struct neofb_par *par = info->par;
1653 1652
@@ -1707,8 +1706,8 @@ static void neo_unmap_mmio(struct fb_info *info)
1707 info->fix.mmio_len); 1706 info->fix.mmio_len);
1708} 1707}
1709 1708
1710static int __devinit neo_map_video(struct fb_info *info, 1709static int neo_map_video(struct fb_info *info, struct pci_dev *dev,
1711 struct pci_dev *dev, int video_len) 1710 int video_len)
1712{ 1711{
1713 //unsigned long addr; 1712 //unsigned long addr;
1714 1713
@@ -1772,7 +1771,7 @@ static void neo_unmap_video(struct fb_info *info)
1772 info->fix.smem_len); 1771 info->fix.smem_len);
1773} 1772}
1774 1773
1775static int __devinit neo_scan_monitor(struct fb_info *info) 1774static int neo_scan_monitor(struct fb_info *info)
1776{ 1775{
1777 struct neofb_par *par = info->par; 1776 struct neofb_par *par = info->par;
1778 unsigned char type, display; 1777 unsigned char type, display;
@@ -1851,7 +1850,7 @@ static int __devinit neo_scan_monitor(struct fb_info *info)
1851 return 0; 1850 return 0;
1852} 1851}
1853 1852
1854static int __devinit neo_init_hw(struct fb_info *info) 1853static int neo_init_hw(struct fb_info *info)
1855{ 1854{
1856 struct neofb_par *par = info->par; 1855 struct neofb_par *par = info->par;
1857 int videoRam = 896; 1856 int videoRam = 896;
@@ -1939,8 +1938,8 @@ static int __devinit neo_init_hw(struct fb_info *info)
1939} 1938}
1940 1939
1941 1940
1942static struct fb_info *__devinit neo_alloc_fb_info(struct pci_dev *dev, const struct 1941static struct fb_info *neo_alloc_fb_info(struct pci_dev *dev,
1943 pci_device_id *id) 1942 const struct pci_device_id *id)
1944{ 1943{
1945 struct fb_info *info; 1944 struct fb_info *info;
1946 struct neofb_par *par; 1945 struct neofb_par *par;
@@ -2038,8 +2037,7 @@ static void neo_free_fb_info(struct fb_info *info)
2038 2037
2039/* --------------------------------------------------------------------- */ 2038/* --------------------------------------------------------------------- */
2040 2039
2041static int __devinit neofb_probe(struct pci_dev *dev, 2040static int neofb_probe(struct pci_dev *dev, const struct pci_device_id *id)
2042 const struct pci_device_id *id)
2043{ 2041{
2044 struct fb_info *info; 2042 struct fb_info *info;
2045 u_int h_sync, v_sync; 2043 u_int h_sync, v_sync;
@@ -2128,7 +2126,7 @@ err_map_mmio:
2128 return err; 2126 return err;
2129} 2127}
2130 2128
2131static void __devexit neofb_remove(struct pci_dev *dev) 2129static void neofb_remove(struct pci_dev *dev)
2132{ 2130{
2133 struct fb_info *info = pci_get_drvdata(dev); 2131 struct fb_info *info = pci_get_drvdata(dev);
2134 2132
@@ -2194,7 +2192,7 @@ static struct pci_driver neofb_driver = {
2194 .name = "neofb", 2192 .name = "neofb",
2195 .id_table = neofb_devices, 2193 .id_table = neofb_devices,
2196 .probe = neofb_probe, 2194 .probe = neofb_probe,
2197 .remove = __devexit_p(neofb_remove) 2195 .remove = neofb_remove,
2198}; 2196};
2199 2197
2200/* ************************* init in-kernel code ************************** */ 2198/* ************************* init in-kernel code ************************** */
diff --git a/drivers/video/nuc900fb.c b/drivers/video/nuc900fb.c
index 475dfee82c4a..32581c72ad09 100644
--- a/drivers/video/nuc900fb.c
+++ b/drivers/video/nuc900fb.c
@@ -387,7 +387,7 @@ static int nuc900fb_init_registers(struct fb_info *info)
387 * The buffer should be a non-cached, non-buffered, memory region 387 * The buffer should be a non-cached, non-buffered, memory region
388 * to allow palette and pixel writes without flushing the cache. 388 * to allow palette and pixel writes without flushing the cache.
389 */ 389 */
390static int __devinit nuc900fb_map_video_memory(struct fb_info *info) 390static int nuc900fb_map_video_memory(struct fb_info *info)
391{ 391{
392 struct nuc900fb_info *fbi = info->par; 392 struct nuc900fb_info *fbi = info->par;
393 dma_addr_t map_dma; 393 dma_addr_t map_dma;
@@ -499,7 +499,7 @@ static inline void nuc900fb_cpufreq_deregister(struct nuc900fb_info *info)
499 499
500static char driver_name[] = "nuc900fb"; 500static char driver_name[] = "nuc900fb";
501 501
502static int __devinit nuc900fb_probe(struct platform_device *pdev) 502static int nuc900fb_probe(struct platform_device *pdev)
503{ 503{
504 struct nuc900fb_info *fbi; 504 struct nuc900fb_info *fbi;
505 struct nuc900fb_display *display; 505 struct nuc900fb_display *display;
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c
index fe13ac567d54..ff228713425e 100644
--- a/drivers/video/nvidia/nvidia.c
+++ b/drivers/video/nvidia/nvidia.c
@@ -70,34 +70,34 @@ static struct pci_device_id nvidiafb_pci_tbl[] = {
70MODULE_DEVICE_TABLE(pci, nvidiafb_pci_tbl); 70MODULE_DEVICE_TABLE(pci, nvidiafb_pci_tbl);
71 71
72/* command line data, set in nvidiafb_setup() */ 72/* command line data, set in nvidiafb_setup() */
73static int flatpanel __devinitdata = -1; /* Autodetect later */ 73static int flatpanel = -1; /* Autodetect later */
74static int fpdither __devinitdata = -1; 74static int fpdither = -1;
75static int forceCRTC __devinitdata = -1; 75static int forceCRTC = -1;
76static int hwcur __devinitdata = 0; 76static int hwcur = 0;
77static int noaccel __devinitdata = 0; 77static int noaccel = 0;
78static int noscale __devinitdata = 0; 78static int noscale = 0;
79static int paneltweak __devinitdata = 0; 79static int paneltweak = 0;
80static int vram __devinitdata = 0; 80static int vram = 0;
81static int bpp __devinitdata = 8; 81static int bpp = 8;
82static int reverse_i2c __devinitdata; 82static int reverse_i2c;
83#ifdef CONFIG_MTRR 83#ifdef CONFIG_MTRR
84static bool nomtrr __devinitdata = false; 84static bool nomtrr = false;
85#endif 85#endif
86#ifdef CONFIG_PMAC_BACKLIGHT 86#ifdef CONFIG_PMAC_BACKLIGHT
87static int backlight __devinitdata = 1; 87static int backlight = 1;
88#else 88#else
89static int backlight __devinitdata = 0; 89static int backlight = 0;
90#endif 90#endif
91 91
92static char *mode_option __devinitdata = NULL; 92static char *mode_option = NULL;
93 93
94static struct fb_fix_screeninfo __devinitdata nvidiafb_fix = { 94static struct fb_fix_screeninfo nvidiafb_fix = {
95 .type = FB_TYPE_PACKED_PIXELS, 95 .type = FB_TYPE_PACKED_PIXELS,
96 .xpanstep = 8, 96 .xpanstep = 8,
97 .ypanstep = 1, 97 .ypanstep = 1,
98}; 98};
99 99
100static struct fb_var_screeninfo __devinitdata nvidiafb_default_var = { 100static struct fb_var_screeninfo nvidiafb_default_var = {
101 .xres = 640, 101 .xres = 640,
102 .yres = 480, 102 .yres = 480,
103 .xres_virtual = 640, 103 .xres_virtual = 640,
@@ -1105,7 +1105,7 @@ fail:
1105#define nvidiafb_resume NULL 1105#define nvidiafb_resume NULL
1106#endif 1106#endif
1107 1107
1108static int __devinit nvidia_set_fbinfo(struct fb_info *info) 1108static int nvidia_set_fbinfo(struct fb_info *info)
1109{ 1109{
1110 struct fb_monspecs *specs = &info->monspecs; 1110 struct fb_monspecs *specs = &info->monspecs;
1111 struct fb_videomode modedb; 1111 struct fb_videomode modedb;
@@ -1201,7 +1201,7 @@ static int __devinit nvidia_set_fbinfo(struct fb_info *info)
1201 return nvidiafb_check_var(&info->var, info); 1201 return nvidiafb_check_var(&info->var, info);
1202} 1202}
1203 1203
1204static u32 __devinit nvidia_get_chipset(struct fb_info *info) 1204static u32 nvidia_get_chipset(struct fb_info *info)
1205{ 1205{
1206 struct nvidia_par *par = info->par; 1206 struct nvidia_par *par = info->par;
1207 u32 id = (par->pci_dev->vendor << 16) | par->pci_dev->device; 1207 u32 id = (par->pci_dev->vendor << 16) | par->pci_dev->device;
@@ -1224,7 +1224,7 @@ static u32 __devinit nvidia_get_chipset(struct fb_info *info)
1224 return id; 1224 return id;
1225} 1225}
1226 1226
1227static u32 __devinit nvidia_get_arch(struct fb_info *info) 1227static u32 nvidia_get_arch(struct fb_info *info)
1228{ 1228{
1229 struct nvidia_par *par = info->par; 1229 struct nvidia_par *par = info->par;
1230 u32 arch = 0; 1230 u32 arch = 0;
@@ -1276,8 +1276,7 @@ static u32 __devinit nvidia_get_arch(struct fb_info *info)
1276 return arch; 1276 return arch;
1277} 1277}
1278 1278
1279static int __devinit nvidiafb_probe(struct pci_dev *pd, 1279static int nvidiafb_probe(struct pci_dev *pd, const struct pci_device_id *ent)
1280 const struct pci_device_id *ent)
1281{ 1280{
1282 struct nvidia_par *par; 1281 struct nvidia_par *par;
1283 struct fb_info *info; 1282 struct fb_info *info;
@@ -1438,7 +1437,7 @@ err_out:
1438 return -ENODEV; 1437 return -ENODEV;
1439} 1438}
1440 1439
1441static void __devexit nvidiafb_remove(struct pci_dev *pd) 1440static void nvidiafb_remove(struct pci_dev *pd)
1442{ 1441{
1443 struct fb_info *info = pci_get_drvdata(pd); 1442 struct fb_info *info = pci_get_drvdata(pd);
1444 struct nvidia_par *par = info->par; 1443 struct nvidia_par *par = info->par;
@@ -1473,7 +1472,7 @@ static void __devexit nvidiafb_remove(struct pci_dev *pd)
1473 * ------------------------------------------------------------------------- */ 1472 * ------------------------------------------------------------------------- */
1474 1473
1475#ifndef MODULE 1474#ifndef MODULE
1476static int __devinit nvidiafb_setup(char *options) 1475static int nvidiafb_setup(char *options)
1477{ 1476{
1478 char *this_opt; 1477 char *this_opt;
1479 1478
@@ -1529,7 +1528,7 @@ static struct pci_driver nvidiafb_driver = {
1529 .probe = nvidiafb_probe, 1528 .probe = nvidiafb_probe,
1530 .suspend = nvidiafb_suspend, 1529 .suspend = nvidiafb_suspend,
1531 .resume = nvidiafb_resume, 1530 .resume = nvidiafb_resume,
1532 .remove = __devexit_p(nvidiafb_remove), 1531 .remove = nvidiafb_remove,
1533}; 1532};
1534 1533
1535/* ------------------------------------------------------------------------- * 1534/* ------------------------------------------------------------------------- *
@@ -1538,7 +1537,7 @@ static struct pci_driver nvidiafb_driver = {
1538 * 1537 *
1539 * ------------------------------------------------------------------------- */ 1538 * ------------------------------------------------------------------------- */
1540 1539
1541static int __devinit nvidiafb_init(void) 1540static int nvidiafb_init(void)
1542{ 1541{
1543#ifndef MODULE 1542#ifndef MODULE
1544 char *option = NULL; 1543 char *option = NULL;
diff --git a/drivers/video/omap/lcd_mipid.c b/drivers/video/omap/lcd_mipid.c
index b739600c51ac..803fee618d57 100644
--- a/drivers/video/omap/lcd_mipid.c
+++ b/drivers/video/omap/lcd_mipid.c
@@ -606,7 +606,7 @@ static struct spi_driver mipid_spi_driver = {
606 .owner = THIS_MODULE, 606 .owner = THIS_MODULE,
607 }, 607 },
608 .probe = mipid_spi_probe, 608 .probe = mipid_spi_probe,
609 .remove = __devexit_p(mipid_spi_remove), 609 .remove = mipid_spi_remove,
610}; 610};
611 611
612module_spi_driver(mipid_spi_driver); 612module_spi_driver(mipid_spi_driver);
diff --git a/drivers/video/omap2/displays/panel-acx565akm.c b/drivers/video/omap2/displays/panel-acx565akm.c
index 65eb76c840a1..72699f88c002 100644
--- a/drivers/video/omap2/displays/panel-acx565akm.c
+++ b/drivers/video/omap2/displays/panel-acx565akm.c
@@ -777,7 +777,7 @@ static struct spi_driver acx565akm_spi_driver = {
777 .owner = THIS_MODULE, 777 .owner = THIS_MODULE,
778 }, 778 },
779 .probe = acx565akm_spi_probe, 779 .probe = acx565akm_spi_probe,
780 .remove = __devexit_p(acx565akm_spi_remove), 780 .remove = acx565akm_spi_remove,
781}; 781};
782 782
783module_spi_driver(acx565akm_spi_driver); 783module_spi_driver(acx565akm_spi_driver);
diff --git a/drivers/video/omap2/displays/panel-lgphilips-lb035q02.c b/drivers/video/omap2/displays/panel-lgphilips-lb035q02.c
index ace419b801eb..6e5abe8fd2dd 100644
--- a/drivers/video/omap2/displays/panel-lgphilips-lb035q02.c
+++ b/drivers/video/omap2/displays/panel-lgphilips-lb035q02.c
@@ -216,13 +216,13 @@ static void init_lb035q02_panel(struct spi_device *spi)
216 lb035q02_write_reg(spi, 0x3b, 0x0806); 216 lb035q02_write_reg(spi, 0x3b, 0x0806);
217} 217}
218 218
219static int __devinit lb035q02_panel_spi_probe(struct spi_device *spi) 219static int lb035q02_panel_spi_probe(struct spi_device *spi)
220{ 220{
221 init_lb035q02_panel(spi); 221 init_lb035q02_panel(spi);
222 return omap_dss_register_driver(&lb035q02_driver); 222 return omap_dss_register_driver(&lb035q02_driver);
223} 223}
224 224
225static int __devexit lb035q02_panel_spi_remove(struct spi_device *spi) 225static int lb035q02_panel_spi_remove(struct spi_device *spi)
226{ 226{
227 omap_dss_unregister_driver(&lb035q02_driver); 227 omap_dss_unregister_driver(&lb035q02_driver);
228 return 0; 228 return 0;
@@ -234,7 +234,7 @@ static struct spi_driver lb035q02_spi_driver = {
234 .owner = THIS_MODULE, 234 .owner = THIS_MODULE,
235 }, 235 },
236 .probe = lb035q02_panel_spi_probe, 236 .probe = lb035q02_panel_spi_probe,
237 .remove = __devexit_p(lb035q02_panel_spi_remove), 237 .remove = lb035q02_panel_spi_remove,
238}; 238};
239 239
240module_spi_driver(lb035q02_spi_driver); 240module_spi_driver(lb035q02_spi_driver);
diff --git a/drivers/video/omap2/displays/panel-n8x0.c b/drivers/video/omap2/displays/panel-n8x0.c
index d1cb722fcdbc..dd1294750802 100644
--- a/drivers/video/omap2/displays/panel-n8x0.c
+++ b/drivers/video/omap2/displays/panel-n8x0.c
@@ -680,7 +680,7 @@ static struct spi_driver mipid_spi_driver = {
680 .owner = THIS_MODULE, 680 .owner = THIS_MODULE,
681 }, 681 },
682 .probe = mipid_spi_probe, 682 .probe = mipid_spi_probe,
683 .remove = __devexit_p(mipid_spi_remove), 683 .remove = mipid_spi_remove,
684}; 684};
685module_spi_driver(mipid_spi_driver); 685module_spi_driver(mipid_spi_driver);
686 686
diff --git a/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c b/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c
index 2a79c283bebe..c4e9c2b1b465 100644
--- a/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c
+++ b/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c
@@ -323,7 +323,7 @@ static int nec_8048_spi_resume(struct spi_device *spi)
323 323
324static struct spi_driver nec_8048_spi_driver = { 324static struct spi_driver nec_8048_spi_driver = {
325 .probe = nec_8048_spi_probe, 325 .probe = nec_8048_spi_probe,
326 .remove = __devexit_p(nec_8048_spi_remove), 326 .remove = nec_8048_spi_remove,
327 .suspend = nec_8048_spi_suspend, 327 .suspend = nec_8048_spi_suspend,
328 .resume = nec_8048_spi_resume, 328 .resume = nec_8048_spi_resume,
329 .driver = { 329 .driver = {
diff --git a/drivers/video/omap2/displays/panel-tpo-td043mtea1.c b/drivers/video/omap2/displays/panel-tpo-td043mtea1.c
index 316b3da6d2cb..6b6643911d29 100644
--- a/drivers/video/omap2/displays/panel-tpo-td043mtea1.c
+++ b/drivers/video/omap2/displays/panel-tpo-td043mtea1.c
@@ -528,7 +528,7 @@ static int tpo_td043_spi_probe(struct spi_device *spi)
528 return 0; 528 return 0;
529} 529}
530 530
531static int __devexit tpo_td043_spi_remove(struct spi_device *spi) 531static int tpo_td043_spi_remove(struct spi_device *spi)
532{ 532{
533 struct tpo_td043_device *tpo_td043 = dev_get_drvdata(&spi->dev); 533 struct tpo_td043_device *tpo_td043 = dev_get_drvdata(&spi->dev);
534 534
@@ -580,7 +580,7 @@ static struct spi_driver tpo_td043_spi_driver = {
580 .pm = &tpo_td043_spi_pm, 580 .pm = &tpo_td043_spi_pm,
581 }, 581 },
582 .probe = tpo_td043_spi_probe, 582 .probe = tpo_td043_spi_probe,
583 .remove = __devexit_p(tpo_td043_spi_remove), 583 .remove = tpo_td043_spi_remove,
584}; 584};
585 585
586module_spi_driver(tpo_td043_spi_driver); 586module_spi_driver(tpo_td043_spi_driver);
diff --git a/drivers/video/p9100.c b/drivers/video/p9100.c
index d57cc58c5168..4b23af6e5c28 100644
--- a/drivers/video/p9100.c
+++ b/drivers/video/p9100.c
@@ -249,7 +249,7 @@ static void p9100_init_fix(struct fb_info *info, int linebytes, struct device_no
249 info->fix.accel = FB_ACCEL_SUN_CGTHREE; 249 info->fix.accel = FB_ACCEL_SUN_CGTHREE;
250} 250}
251 251
252static int __devinit p9100_probe(struct platform_device *op) 252static int p9100_probe(struct platform_device *op)
253{ 253{
254 struct device_node *dp = op->dev.of_node; 254 struct device_node *dp = op->dev.of_node;
255 struct fb_info *info; 255 struct fb_info *info;
@@ -326,7 +326,7 @@ out_err:
326 return err; 326 return err;
327} 327}
328 328
329static int __devexit p9100_remove(struct platform_device *op) 329static int p9100_remove(struct platform_device *op)
330{ 330{
331 struct fb_info *info = dev_get_drvdata(&op->dev); 331 struct fb_info *info = dev_get_drvdata(&op->dev);
332 struct p9100_par *par = info->par; 332 struct p9100_par *par = info->par;
@@ -359,7 +359,7 @@ static struct platform_driver p9100_driver = {
359 .of_match_table = p9100_match, 359 .of_match_table = p9100_match,
360 }, 360 },
361 .probe = p9100_probe, 361 .probe = p9100_probe,
362 .remove = __devexit_p(p9100_remove), 362 .remove = p9100_remove,
363}; 363};
364 364
365static int __init p9100_init(void) 365static int __init p9100_init(void)
diff --git a/drivers/video/platinumfb.c b/drivers/video/platinumfb.c
index ae3caa6755c2..3d86bac62d3e 100644
--- a/drivers/video/platinumfb.c
+++ b/drivers/video/platinumfb.c
@@ -313,7 +313,8 @@ static void platinum_set_hardware(struct fb_info_platinum *pinfo)
313/* 313/*
314 * Set misc info vars for this driver 314 * Set misc info vars for this driver
315 */ 315 */
316static void __devinit platinum_init_info(struct fb_info *info, struct fb_info_platinum *pinfo) 316static void platinum_init_info(struct fb_info *info,
317 struct fb_info_platinum *pinfo)
317{ 318{
318 /* Fill fb_info */ 319 /* Fill fb_info */
319 info->fbops = &platinumfb_ops; 320 info->fbops = &platinumfb_ops;
@@ -338,7 +339,7 @@ static void __devinit platinum_init_info(struct fb_info *info, struct fb_info_pl
338} 339}
339 340
340 341
341static int __devinit platinum_init_fb(struct fb_info *info) 342static int platinum_init_fb(struct fb_info *info)
342{ 343{
343 struct fb_info_platinum *pinfo = info->par; 344 struct fb_info_platinum *pinfo = info->par;
344 struct fb_var_screeninfo var; 345 struct fb_var_screeninfo var;
@@ -533,7 +534,7 @@ static int __init platinumfb_setup(char *options)
533#define invalidate_cache(addr) 534#define invalidate_cache(addr)
534#endif 535#endif
535 536
536static int __devinit platinumfb_probe(struct platform_device* odev) 537static int platinumfb_probe(struct platform_device* odev)
537{ 538{
538 struct device_node *dp = odev->dev.of_node; 539 struct device_node *dp = odev->dev.of_node;
539 struct fb_info *info; 540 struct fb_info *info;
@@ -645,7 +646,7 @@ static int __devinit platinumfb_probe(struct platform_device* odev)
645 return rc; 646 return rc;
646} 647}
647 648
648static int __devexit platinumfb_remove(struct platform_device* odev) 649static int platinumfb_remove(struct platform_device* odev)
649{ 650{
650 struct fb_info *info = dev_get_drvdata(&odev->dev); 651 struct fb_info *info = dev_get_drvdata(&odev->dev);
651 struct fb_info_platinum *pinfo = info->par; 652 struct fb_info_platinum *pinfo = info->par;
@@ -683,7 +684,7 @@ static struct platform_driver platinum_driver =
683 .of_match_table = platinumfb_match, 684 .of_match_table = platinumfb_match,
684 }, 685 },
685 .probe = platinumfb_probe, 686 .probe = platinumfb_probe,
686 .remove = __devexit_p(platinumfb_remove), 687 .remove = platinumfb_remove,
687}; 688};
688 689
689static int __init platinumfb_init(void) 690static int __init platinumfb_init(void)
diff --git a/drivers/video/pm2fb.c b/drivers/video/pm2fb.c
index df31a24a5026..81354eeab021 100644
--- a/drivers/video/pm2fb.c
+++ b/drivers/video/pm2fb.c
@@ -67,7 +67,7 @@
67 * Driver data 67 * Driver data
68 */ 68 */
69static int hwcursor = 1; 69static int hwcursor = 1;
70static char *mode_option __devinitdata; 70static char *mode_option;
71 71
72/* 72/*
73 * The XFree GLINT driver will (I think to implement hardware cursor 73 * The XFree GLINT driver will (I think to implement hardware cursor
@@ -80,10 +80,10 @@ static char *mode_option __devinitdata;
80 */ 80 */
81static bool lowhsync; 81static bool lowhsync;
82static bool lowvsync; 82static bool lowvsync;
83static bool noaccel __devinitdata; 83static bool noaccel;
84/* mtrr option */ 84/* mtrr option */
85#ifdef CONFIG_MTRR 85#ifdef CONFIG_MTRR
86static bool nomtrr __devinitdata; 86static bool nomtrr;
87#endif 87#endif
88 88
89/* 89/*
@@ -107,7 +107,7 @@ struct pm2fb_par
107 * Here we define the default structs fb_fix_screeninfo and fb_var_screeninfo 107 * Here we define the default structs fb_fix_screeninfo and fb_var_screeninfo
108 * if we don't use modedb. 108 * if we don't use modedb.
109 */ 109 */
110static struct fb_fix_screeninfo pm2fb_fix __devinitdata = { 110static struct fb_fix_screeninfo pm2fb_fix = {
111 .id = "", 111 .id = "",
112 .type = FB_TYPE_PACKED_PIXELS, 112 .type = FB_TYPE_PACKED_PIXELS,
113 .visual = FB_VISUAL_PSEUDOCOLOR, 113 .visual = FB_VISUAL_PSEUDOCOLOR,
@@ -120,7 +120,7 @@ static struct fb_fix_screeninfo pm2fb_fix __devinitdata = {
120/* 120/*
121 * Default video mode. In case the modedb doesn't work. 121 * Default video mode. In case the modedb doesn't work.
122 */ 122 */
123static struct fb_var_screeninfo pm2fb_var __devinitdata = { 123static struct fb_var_screeninfo pm2fb_var = {
124 /* "640x480, 8 bpp @ 60 Hz */ 124 /* "640x480, 8 bpp @ 60 Hz */
125 .xres = 640, 125 .xres = 640,
126 .yres = 480, 126 .yres = 480,
@@ -1515,8 +1515,7 @@ static struct fb_ops pm2fb_ops = {
1515 * @param pdev PCI device. 1515 * @param pdev PCI device.
1516 * @param id PCI device ID. 1516 * @param id PCI device ID.
1517 */ 1517 */
1518static int __devinit pm2fb_probe(struct pci_dev *pdev, 1518static int pm2fb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1519 const struct pci_device_id *id)
1520{ 1519{
1521 struct pm2fb_par *default_par; 1520 struct pm2fb_par *default_par;
1522 struct fb_info *info; 1521 struct fb_info *info;
@@ -1727,7 +1726,7 @@ static int __devinit pm2fb_probe(struct pci_dev *pdev,
1727 * 1726 *
1728 * @param pdev PCI device to clean up. 1727 * @param pdev PCI device to clean up.
1729 */ 1728 */
1730static void __devexit pm2fb_remove(struct pci_dev *pdev) 1729static void pm2fb_remove(struct pci_dev *pdev)
1731{ 1730{
1732 struct fb_info *info = pci_get_drvdata(pdev); 1731 struct fb_info *info = pci_get_drvdata(pdev);
1733 struct fb_fix_screeninfo *fix = &info->fix; 1732 struct fb_fix_screeninfo *fix = &info->fix;
@@ -1765,7 +1764,7 @@ static struct pci_driver pm2fb_driver = {
1765 .name = "pm2fb", 1764 .name = "pm2fb",
1766 .id_table = pm2fb_id_table, 1765 .id_table = pm2fb_id_table,
1767 .probe = pm2fb_probe, 1766 .probe = pm2fb_probe,
1768 .remove = __devexit_p(pm2fb_remove), 1767 .remove = pm2fb_remove,
1769}; 1768};
1770 1769
1771MODULE_DEVICE_TABLE(pci, pm2fb_id_table); 1770MODULE_DEVICE_TABLE(pci, pm2fb_id_table);
diff --git a/drivers/video/pm3fb.c b/drivers/video/pm3fb.c
index 055e527a8e45..7718faa4a73b 100644
--- a/drivers/video/pm3fb.c
+++ b/drivers/video/pm3fb.c
@@ -56,12 +56,12 @@
56 * Driver data 56 * Driver data
57 */ 57 */
58static int hwcursor = 1; 58static int hwcursor = 1;
59static char *mode_option __devinitdata; 59static char *mode_option;
60static bool noaccel __devinitdata; 60static bool noaccel;
61 61
62/* mtrr option */ 62/* mtrr option */
63#ifdef CONFIG_MTRR 63#ifdef CONFIG_MTRR
64static bool nomtrr __devinitdata; 64static bool nomtrr;
65#endif 65#endif
66 66
67/* 67/*
@@ -84,7 +84,7 @@ struct pm3_par {
84 * if we don't use modedb. If we do use modedb see pm3fb_init how to use it 84 * if we don't use modedb. If we do use modedb see pm3fb_init how to use it
85 * to get a fb_var_screeninfo. Otherwise define a default var as well. 85 * to get a fb_var_screeninfo. Otherwise define a default var as well.
86 */ 86 */
87static struct fb_fix_screeninfo pm3fb_fix __devinitdata = { 87static struct fb_fix_screeninfo pm3fb_fix = {
88 .id = "Permedia3", 88 .id = "Permedia3",
89 .type = FB_TYPE_PACKED_PIXELS, 89 .type = FB_TYPE_PACKED_PIXELS,
90 .visual = FB_VISUAL_PSEUDOCOLOR, 90 .visual = FB_VISUAL_PSEUDOCOLOR,
@@ -1229,7 +1229,7 @@ static struct fb_ops pm3fb_ops = {
1229 1229
1230/* mmio register are already mapped when this function is called */ 1230/* mmio register are already mapped when this function is called */
1231/* the pm3fb_fix.smem_start is also set */ 1231/* the pm3fb_fix.smem_start is also set */
1232static unsigned long __devinit pm3fb_size_memory(struct pm3_par *par) 1232static unsigned long pm3fb_size_memory(struct pm3_par *par)
1233{ 1233{
1234 unsigned long memsize = 0; 1234 unsigned long memsize = 0;
1235 unsigned long tempBypass, i, temp1, temp2; 1235 unsigned long tempBypass, i, temp1, temp2;
@@ -1314,8 +1314,7 @@ static unsigned long __devinit pm3fb_size_memory(struct pm3_par *par)
1314 return memsize; 1314 return memsize;
1315} 1315}
1316 1316
1317static int __devinit pm3fb_probe(struct pci_dev *dev, 1317static int pm3fb_probe(struct pci_dev *dev, const struct pci_device_id *ent)
1318 const struct pci_device_id *ent)
1319{ 1318{
1320 struct fb_info *info; 1319 struct fb_info *info;
1321 struct pm3_par *par; 1320 struct pm3_par *par;
@@ -1469,7 +1468,7 @@ static int __devinit pm3fb_probe(struct pci_dev *dev,
1469 /* 1468 /*
1470 * Cleanup 1469 * Cleanup
1471 */ 1470 */
1472static void __devexit pm3fb_remove(struct pci_dev *dev) 1471static void pm3fb_remove(struct pci_dev *dev)
1473{ 1472{
1474 struct fb_info *info = pci_get_drvdata(dev); 1473 struct fb_info *info = pci_get_drvdata(dev);
1475 1474
@@ -1507,7 +1506,7 @@ static struct pci_driver pm3fb_driver = {
1507 .name = "pm3fb", 1506 .name = "pm3fb",
1508 .id_table = pm3fb_id_table, 1507 .id_table = pm3fb_id_table,
1509 .probe = pm3fb_probe, 1508 .probe = pm3fb_probe,
1510 .remove = __devexit_p(pm3fb_remove), 1509 .remove = pm3fb_remove,
1511}; 1510};
1512 1511
1513MODULE_DEVICE_TABLE(pci, pm3fb_id_table); 1512MODULE_DEVICE_TABLE(pci, pm3fb_id_table);
diff --git a/drivers/video/pmag-ba-fb.c b/drivers/video/pmag-ba-fb.c
index 9b4a60b52a4c..d1e46cedb1f7 100644
--- a/drivers/video/pmag-ba-fb.c
+++ b/drivers/video/pmag-ba-fb.c
@@ -43,7 +43,7 @@ struct pmagbafb_par {
43}; 43};
44 44
45 45
46static struct fb_var_screeninfo pmagbafb_defined __devinitdata = { 46static struct fb_var_screeninfo pmagbafb_defined = {
47 .xres = 1024, 47 .xres = 1024,
48 .yres = 864, 48 .yres = 864,
49 .xres_virtual = 1024, 49 .xres_virtual = 1024,
@@ -67,7 +67,7 @@ static struct fb_var_screeninfo pmagbafb_defined __devinitdata = {
67 .vmode = FB_VMODE_NONINTERLACED, 67 .vmode = FB_VMODE_NONINTERLACED,
68}; 68};
69 69
70static struct fb_fix_screeninfo pmagbafb_fix __devinitdata = { 70static struct fb_fix_screeninfo pmagbafb_fix = {
71 .id = "PMAG-BA", 71 .id = "PMAG-BA",
72 .smem_len = (1024 * 1024), 72 .smem_len = (1024 * 1024),
73 .type = FB_TYPE_PACKED_PIXELS, 73 .type = FB_TYPE_PACKED_PIXELS,
@@ -141,7 +141,7 @@ static void __init pmagbafb_erase_cursor(struct fb_info *info)
141} 141}
142 142
143 143
144static int __devinit pmagbafb_probe(struct device *dev) 144static int pmagbafb_probe(struct device *dev)
145{ 145{
146 struct tc_dev *tdev = to_tc_dev(dev); 146 struct tc_dev *tdev = to_tc_dev(dev);
147 resource_size_t start, len; 147 resource_size_t start, len;
diff --git a/drivers/video/pmagb-b-fb.c b/drivers/video/pmagb-b-fb.c
index 4e7a9c46e112..0e1317400328 100644
--- a/drivers/video/pmagb-b-fb.c
+++ b/drivers/video/pmagb-b-fb.c
@@ -44,7 +44,7 @@ struct pmagbbfb_par {
44}; 44};
45 45
46 46
47static struct fb_var_screeninfo pmagbbfb_defined __devinitdata = { 47static struct fb_var_screeninfo pmagbbfb_defined = {
48 .bits_per_pixel = 8, 48 .bits_per_pixel = 8,
49 .red.length = 8, 49 .red.length = 8,
50 .green.length = 8, 50 .green.length = 8,
@@ -57,7 +57,7 @@ static struct fb_var_screeninfo pmagbbfb_defined __devinitdata = {
57 .vmode = FB_VMODE_NONINTERLACED, 57 .vmode = FB_VMODE_NONINTERLACED,
58}; 58};
59 59
60static struct fb_fix_screeninfo pmagbbfb_fix __devinitdata = { 60static struct fb_fix_screeninfo pmagbbfb_fix = {
61 .id = "PMAGB-BA", 61 .id = "PMAGB-BA",
62 .smem_len = (2048 * 1024), 62 .smem_len = (2048 * 1024),
63 .type = FB_TYPE_PACKED_PIXELS, 63 .type = FB_TYPE_PACKED_PIXELS,
@@ -147,7 +147,7 @@ static void __init pmagbbfb_erase_cursor(struct fb_info *info)
147/* 147/*
148 * Set up screen parameters. 148 * Set up screen parameters.
149 */ 149 */
150static void __devinit pmagbbfb_screen_setup(struct fb_info *info) 150static void pmagbbfb_screen_setup(struct fb_info *info)
151{ 151{
152 struct pmagbbfb_par *par = info->par; 152 struct pmagbbfb_par *par = info->par;
153 153
@@ -179,9 +179,9 @@ static void __devinit pmagbbfb_screen_setup(struct fb_info *info)
179/* 179/*
180 * Determine oscillator configuration. 180 * Determine oscillator configuration.
181 */ 181 */
182static void __devinit pmagbbfb_osc_setup(struct fb_info *info) 182static void pmagbbfb_osc_setup(struct fb_info *info)
183{ 183{
184 static unsigned int pmagbbfb_freqs[] __devinitdata = { 184 static unsigned int pmagbbfb_freqs[] = {
185 130808, 119843, 104000, 92980, 74370, 72800, 185 130808, 119843, 104000, 92980, 74370, 72800,
186 69197, 66000, 65000, 50350, 36000, 32000, 25175 186 69197, 66000, 65000, 50350, 36000, 32000, 25175
187 }; 187 };
@@ -246,7 +246,7 @@ static void __devinit pmagbbfb_osc_setup(struct fb_info *info)
246}; 246};
247 247
248 248
249static int __devinit pmagbbfb_probe(struct device *dev) 249static int pmagbbfb_probe(struct device *dev)
250{ 250{
251 struct tc_dev *tdev = to_tc_dev(dev); 251 struct tc_dev *tdev = to_tc_dev(dev);
252 resource_size_t start, len; 252 resource_size_t start, len;
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c
index 0b340d6ff8a4..920c27bf3947 100644
--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -259,7 +259,7 @@ static const struct fb_videomode ps3fb_modedb[] = {
259static int ps3fb_mode; 259static int ps3fb_mode;
260module_param(ps3fb_mode, int, 0); 260module_param(ps3fb_mode, int, 0);
261 261
262static char *mode_option __devinitdata; 262static char *mode_option;
263 263
264static int ps3fb_cmp_mode(const struct fb_videomode *vmode, 264static int ps3fb_cmp_mode(const struct fb_videomode *vmode,
265 const struct fb_var_screeninfo *var) 265 const struct fb_var_screeninfo *var)
@@ -965,7 +965,7 @@ static struct fb_fix_screeninfo ps3fb_fix __initdata = {
965 .accel = FB_ACCEL_NONE, 965 .accel = FB_ACCEL_NONE,
966}; 966};
967 967
968static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev) 968static int ps3fb_probe(struct ps3_system_bus_device *dev)
969{ 969{
970 struct fb_info *info; 970 struct fb_info *info;
971 struct ps3fb_par *par; 971 struct ps3fb_par *par;
diff --git a/drivers/video/pvr2fb.c b/drivers/video/pvr2fb.c
index bcd44c32a2ed..df07860563e6 100644
--- a/drivers/video/pvr2fb.c
+++ b/drivers/video/pvr2fb.c
@@ -112,11 +112,11 @@ enum { VO_PAL, VO_NTSC, VO_VGA };
112enum { PAL_ARGB1555, PAL_RGB565, PAL_ARGB4444, PAL_ARGB8888 }; 112enum { PAL_ARGB1555, PAL_RGB565, PAL_ARGB4444, PAL_ARGB8888 };
113 113
114struct pvr2_params { unsigned int val; char *name; }; 114struct pvr2_params { unsigned int val; char *name; };
115static struct pvr2_params cables[] __devinitdata = { 115static struct pvr2_params cables[] = {
116 { CT_VGA, "VGA" }, { CT_RGB, "RGB" }, { CT_COMPOSITE, "COMPOSITE" }, 116 { CT_VGA, "VGA" }, { CT_RGB, "RGB" }, { CT_COMPOSITE, "COMPOSITE" },
117}; 117};
118 118
119static struct pvr2_params outputs[] __devinitdata = { 119static struct pvr2_params outputs[] = {
120 { VO_PAL, "PAL" }, { VO_NTSC, "NTSC" }, { VO_VGA, "VGA" }, 120 { VO_PAL, "PAL" }, { VO_NTSC, "NTSC" }, { VO_VGA, "VGA" },
121}; 121};
122 122
@@ -145,7 +145,7 @@ static struct pvr2fb_par {
145 145
146static struct fb_info *fb_info; 146static struct fb_info *fb_info;
147 147
148static struct fb_fix_screeninfo pvr2_fix __devinitdata = { 148static struct fb_fix_screeninfo pvr2_fix = {
149 .id = "NEC PowerVR2", 149 .id = "NEC PowerVR2",
150 .type = FB_TYPE_PACKED_PIXELS, 150 .type = FB_TYPE_PACKED_PIXELS,
151 .visual = FB_VISUAL_TRUECOLOR, 151 .visual = FB_VISUAL_TRUECOLOR,
@@ -154,7 +154,7 @@ static struct fb_fix_screeninfo pvr2_fix __devinitdata = {
154 .accel = FB_ACCEL_NONE, 154 .accel = FB_ACCEL_NONE,
155}; 155};
156 156
157static struct fb_var_screeninfo pvr2_var __devinitdata = { 157static struct fb_var_screeninfo pvr2_var = {
158 .xres = 640, 158 .xres = 640,
159 .yres = 480, 159 .yres = 480,
160 .xres_virtual = 640, 160 .xres_virtual = 640,
@@ -226,7 +226,7 @@ static struct fb_ops pvr2fb_ops = {
226 .fb_imageblit = cfb_imageblit, 226 .fb_imageblit = cfb_imageblit,
227}; 227};
228 228
229static struct fb_videomode pvr2_modedb[] __devinitdata = { 229static struct fb_videomode pvr2_modedb[] = {
230 /* 230 /*
231 * Broadcast video modes (PAL and NTSC). I'm unfamiliar with 231 * Broadcast video modes (PAL and NTSC). I'm unfamiliar with
232 * PAL-M and PAL-N, but from what I've read both modes parallel PAL and 232 * PAL-M and PAL-N, but from what I've read both modes parallel PAL and
@@ -256,7 +256,7 @@ static struct fb_videomode pvr2_modedb[] __devinitdata = {
256#define DEFMODE_VGA 2 256#define DEFMODE_VGA 2
257 257
258static int defmode = DEFMODE_NTSC; 258static int defmode = DEFMODE_NTSC;
259static char *mode_option __devinitdata = NULL; 259static char *mode_option = NULL;
260 260
261static inline void pvr2fb_set_pal_type(unsigned int type) 261static inline void pvr2fb_set_pal_type(unsigned int type)
262{ 262{
@@ -763,7 +763,7 @@ out_unmap:
763 * in for flexibility anyways. Who knows, maybe someone has tv-out on a 763 * in for flexibility anyways. Who knows, maybe someone has tv-out on a
764 * PCI-based version of these things ;-) 764 * PCI-based version of these things ;-)
765 */ 765 */
766static int __devinit pvr2fb_common_init(void) 766static int pvr2fb_common_init(void)
767{ 767{
768 struct pvr2fb_par *par = currentpar; 768 struct pvr2fb_par *par = currentpar;
769 unsigned long modememused, rev; 769 unsigned long modememused, rev;
@@ -922,8 +922,8 @@ static void __exit pvr2fb_dc_exit(void)
922#endif /* CONFIG_SH_DREAMCAST */ 922#endif /* CONFIG_SH_DREAMCAST */
923 923
924#ifdef CONFIG_PCI 924#ifdef CONFIG_PCI
925static int __devinit pvr2fb_pci_probe(struct pci_dev *pdev, 925static int pvr2fb_pci_probe(struct pci_dev *pdev,
926 const struct pci_device_id *ent) 926 const struct pci_device_id *ent)
927{ 927{
928 int ret; 928 int ret;
929 929
@@ -953,7 +953,7 @@ static int __devinit pvr2fb_pci_probe(struct pci_dev *pdev,
953 return pvr2fb_common_init(); 953 return pvr2fb_common_init();
954} 954}
955 955
956static void __devexit pvr2fb_pci_remove(struct pci_dev *pdev) 956static void pvr2fb_pci_remove(struct pci_dev *pdev)
957{ 957{
958 if (fb_info->screen_base) { 958 if (fb_info->screen_base) {
959 iounmap(fb_info->screen_base); 959 iounmap(fb_info->screen_base);
@@ -967,7 +967,7 @@ static void __devexit pvr2fb_pci_remove(struct pci_dev *pdev)
967 pci_release_regions(pdev); 967 pci_release_regions(pdev);
968} 968}
969 969
970static struct pci_device_id pvr2fb_pci_tbl[] __devinitdata = { 970static struct pci_device_id pvr2fb_pci_tbl[] = {
971 { PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_NEON250, 971 { PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_NEON250,
972 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 972 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
973 { 0, }, 973 { 0, },
@@ -979,7 +979,7 @@ static struct pci_driver pvr2fb_pci_driver = {
979 .name = "pvr2fb", 979 .name = "pvr2fb",
980 .id_table = pvr2fb_pci_tbl, 980 .id_table = pvr2fb_pci_tbl,
981 .probe = pvr2fb_pci_probe, 981 .probe = pvr2fb_pci_probe,
982 .remove = __devexit_p(pvr2fb_pci_remove), 982 .remove = pvr2fb_pci_remove,
983}; 983};
984 984
985static int __init pvr2fb_pci_init(void) 985static int __init pvr2fb_pci_init(void)
@@ -993,8 +993,8 @@ static void __exit pvr2fb_pci_exit(void)
993} 993}
994#endif /* CONFIG_PCI */ 994#endif /* CONFIG_PCI */
995 995
996static int __devinit pvr2_get_param(const struct pvr2_params *p, const char *s, 996static int pvr2_get_param(const struct pvr2_params *p, const char *s, int val,
997 int val, int size) 997 int size)
998{ 998{
999 int i; 999 int i;
1000 1000
diff --git a/drivers/video/pxa168fb.c b/drivers/video/pxa168fb.c
index f146089261f4..aa9bd1f76d60 100644
--- a/drivers/video/pxa168fb.c
+++ b/drivers/video/pxa168fb.c
@@ -560,7 +560,7 @@ static struct fb_ops pxa168fb_ops = {
560 .fb_imageblit = cfb_imageblit, 560 .fb_imageblit = cfb_imageblit,
561}; 561};
562 562
563static int __devinit pxa168fb_init_mode(struct fb_info *info, 563static int pxa168fb_init_mode(struct fb_info *info,
564 struct pxa168fb_mach_info *mi) 564 struct pxa168fb_mach_info *mi)
565{ 565{
566 struct pxa168fb_info *fbi = info->par; 566 struct pxa168fb_info *fbi = info->par;
@@ -600,7 +600,7 @@ static int __devinit pxa168fb_init_mode(struct fb_info *info,
600 return ret; 600 return ret;
601} 601}
602 602
603static int __devinit pxa168fb_probe(struct platform_device *pdev) 603static int pxa168fb_probe(struct platform_device *pdev)
604{ 604{
605 struct pxa168fb_mach_info *mi; 605 struct pxa168fb_mach_info *mi;
606 struct fb_info *info = 0; 606 struct fb_info *info = 0;
@@ -783,7 +783,7 @@ failed_put_clk:
783 return ret; 783 return ret;
784} 784}
785 785
786static int __devexit pxa168fb_remove(struct platform_device *pdev) 786static int pxa168fb_remove(struct platform_device *pdev)
787{ 787{
788 struct pxa168fb_info *fbi = platform_get_drvdata(pdev); 788 struct pxa168fb_info *fbi = platform_get_drvdata(pdev);
789 struct fb_info *info; 789 struct fb_info *info;
@@ -826,7 +826,7 @@ static struct platform_driver pxa168fb_driver = {
826 .owner = THIS_MODULE, 826 .owner = THIS_MODULE,
827 }, 827 },
828 .probe = pxa168fb_probe, 828 .probe = pxa168fb_probe,
829 .remove = __devexit_p(pxa168fb_remove), 829 .remove = pxa168fb_remove,
830}; 830};
831 831
832module_platform_driver(pxa168fb_driver); 832module_platform_driver(pxa168fb_driver);
diff --git a/drivers/video/pxa3xx-gcu.c b/drivers/video/pxa3xx-gcu.c
index 0b4ae0cebeda..6c984eacc7e3 100644
--- a/drivers/video/pxa3xx-gcu.c
+++ b/drivers/video/pxa3xx-gcu.c
@@ -574,8 +574,7 @@ free_buffers(struct platform_device *dev,
574 priv->free = NULL; 574 priv->free = NULL;
575} 575}
576 576
577static int __devinit 577static int pxa3xx_gcu_probe(struct platform_device *dev)
578pxa3xx_gcu_probe(struct platform_device *dev)
579{ 578{
580 int i, ret, irq; 579 int i, ret, irq;
581 struct resource *r; 580 struct resource *r;
@@ -714,8 +713,7 @@ err_free_priv:
714 return ret; 713 return ret;
715} 714}
716 715
717static int __devexit 716static int pxa3xx_gcu_remove(struct platform_device *dev)
718pxa3xx_gcu_remove(struct platform_device *dev)
719{ 717{
720 struct pxa3xx_gcu_priv *priv = platform_get_drvdata(dev); 718 struct pxa3xx_gcu_priv *priv = platform_get_drvdata(dev);
721 struct resource *r = priv->resource_mem; 719 struct resource *r = priv->resource_mem;
@@ -737,7 +735,7 @@ pxa3xx_gcu_remove(struct platform_device *dev)
737 735
738static struct platform_driver pxa3xx_gcu_driver = { 736static struct platform_driver pxa3xx_gcu_driver = {
739 .probe = pxa3xx_gcu_probe, 737 .probe = pxa3xx_gcu_probe,
740 .remove = __devexit_p(pxa3xx_gcu_remove), 738 .remove = pxa3xx_gcu_remove,
741 .driver = { 739 .driver = {
742 .owner = THIS_MODULE, 740 .owner = THIS_MODULE,
743 .name = DRV_NAME, 741 .name = DRV_NAME,
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index 4fa2ad43fd97..580f80cc586f 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -869,8 +869,8 @@ static struct fb_ops overlay_fb_ops = {
869 .fb_set_par = overlayfb_set_par, 869 .fb_set_par = overlayfb_set_par,
870}; 870};
871 871
872static void __devinit init_pxafb_overlay(struct pxafb_info *fbi, 872static void init_pxafb_overlay(struct pxafb_info *fbi, struct pxafb_layer *ofb,
873 struct pxafb_layer *ofb, int id) 873 int id)
874{ 874{
875 sprintf(ofb->fb.fix.id, "overlay%d", id + 1); 875 sprintf(ofb->fb.fix.id, "overlay%d", id + 1);
876 876
@@ -903,8 +903,8 @@ static inline int pxafb_overlay_supported(void)
903 return 0; 903 return 0;
904} 904}
905 905
906static int __devinit pxafb_overlay_map_video_memory(struct pxafb_info *pxafb, 906static int pxafb_overlay_map_video_memory(struct pxafb_info *pxafb,
907 struct pxafb_layer *ofb) 907 struct pxafb_layer *ofb)
908{ 908{
909 /* We assume that user will use at most video_mem_size for overlay fb, 909 /* We assume that user will use at most video_mem_size for overlay fb,
910 * anyway, it's useless to use 16bpp main plane and 24bpp overlay 910 * anyway, it's useless to use 16bpp main plane and 24bpp overlay
@@ -927,7 +927,7 @@ static int __devinit pxafb_overlay_map_video_memory(struct pxafb_info *pxafb,
927 return 0; 927 return 0;
928} 928}
929 929
930static void __devinit pxafb_overlay_init(struct pxafb_info *fbi) 930static void pxafb_overlay_init(struct pxafb_info *fbi)
931{ 931{
932 int i, ret; 932 int i, ret;
933 933
@@ -959,7 +959,7 @@ static void __devinit pxafb_overlay_init(struct pxafb_info *fbi)
959 pr_info("PXA Overlay driver loaded successfully!\n"); 959 pr_info("PXA Overlay driver loaded successfully!\n");
960} 960}
961 961
962static void __devexit pxafb_overlay_exit(struct pxafb_info *fbi) 962static void pxafb_overlay_exit(struct pxafb_info *fbi)
963{ 963{
964 int i; 964 int i;
965 965
@@ -1706,7 +1706,7 @@ static const struct dev_pm_ops pxafb_pm_ops = {
1706}; 1706};
1707#endif 1707#endif
1708 1708
1709static int __devinit pxafb_init_video_memory(struct pxafb_info *fbi) 1709static int pxafb_init_video_memory(struct pxafb_info *fbi)
1710{ 1710{
1711 int size = PAGE_ALIGN(fbi->video_mem_size); 1711 int size = PAGE_ALIGN(fbi->video_mem_size);
1712 1712
@@ -1789,7 +1789,7 @@ decode_mode:
1789 fbi->video_mem_size = video_mem_size; 1789 fbi->video_mem_size = video_mem_size;
1790} 1790}
1791 1791
1792static struct pxafb_info * __devinit pxafb_init_fbinfo(struct device *dev) 1792static struct pxafb_info *pxafb_init_fbinfo(struct device *dev)
1793{ 1793{
1794 struct pxafb_info *fbi; 1794 struct pxafb_info *fbi;
1795 void *addr; 1795 void *addr;
@@ -1853,7 +1853,7 @@ static struct pxafb_info * __devinit pxafb_init_fbinfo(struct device *dev)
1853} 1853}
1854 1854
1855#ifdef CONFIG_FB_PXA_PARAMETERS 1855#ifdef CONFIG_FB_PXA_PARAMETERS
1856static int __devinit parse_opt_mode(struct device *dev, const char *this_opt) 1856static int parse_opt_mode(struct device *dev, const char *this_opt)
1857{ 1857{
1858 struct pxafb_mach_info *inf = dev->platform_data; 1858 struct pxafb_mach_info *inf = dev->platform_data;
1859 1859
@@ -1912,7 +1912,7 @@ done:
1912 return 0; 1912 return 0;
1913} 1913}
1914 1914
1915static int __devinit parse_opt(struct device *dev, char *this_opt) 1915static int parse_opt(struct device *dev, char *this_opt)
1916{ 1916{
1917 struct pxafb_mach_info *inf = dev->platform_data; 1917 struct pxafb_mach_info *inf = dev->platform_data;
1918 struct pxafb_mode_info *mode = &inf->modes[0]; 1918 struct pxafb_mode_info *mode = &inf->modes[0];
@@ -2012,7 +2012,7 @@ static int __devinit parse_opt(struct device *dev, char *this_opt)
2012 return 0; 2012 return 0;
2013} 2013}
2014 2014
2015static int __devinit pxafb_parse_options(struct device *dev, char *options) 2015static int pxafb_parse_options(struct device *dev, char *options)
2016{ 2016{
2017 char *this_opt; 2017 char *this_opt;
2018 int ret; 2018 int ret;
@@ -2031,7 +2031,7 @@ static int __devinit pxafb_parse_options(struct device *dev, char *options)
2031 return 0; 2031 return 0;
2032} 2032}
2033 2033
2034static char g_options[256] __devinitdata = ""; 2034static char g_options[256] = "";
2035 2035
2036#ifndef MODULE 2036#ifndef MODULE
2037static int __init pxafb_setup_options(void) 2037static int __init pxafb_setup_options(void)
@@ -2061,8 +2061,7 @@ MODULE_PARM_DESC(options, "LCD parameters (see Documentation/fb/pxafb.txt)");
2061#ifdef DEBUG_VAR 2061#ifdef DEBUG_VAR
2062/* Check for various illegal bit-combinations. Currently only 2062/* Check for various illegal bit-combinations. Currently only
2063 * a warning is given. */ 2063 * a warning is given. */
2064static void __devinit pxafb_check_options(struct device *dev, 2064static void pxafb_check_options(struct device *dev, struct pxafb_mach_info *inf)
2065 struct pxafb_mach_info *inf)
2066{ 2065{
2067 if (inf->lcd_conn) 2066 if (inf->lcd_conn)
2068 return; 2067 return;
@@ -2094,7 +2093,7 @@ static void __devinit pxafb_check_options(struct device *dev,
2094#define pxafb_check_options(...) do {} while (0) 2093#define pxafb_check_options(...) do {} while (0)
2095#endif 2094#endif
2096 2095
2097static int __devinit pxafb_probe(struct platform_device *dev) 2096static int pxafb_probe(struct platform_device *dev)
2098{ 2097{
2099 struct pxafb_info *fbi; 2098 struct pxafb_info *fbi;
2100 struct pxafb_mach_info *inf; 2099 struct pxafb_mach_info *inf;
@@ -2263,7 +2262,7 @@ failed:
2263 return ret; 2262 return ret;
2264} 2263}
2265 2264
2266static int __devexit pxafb_remove(struct platform_device *dev) 2265static int pxafb_remove(struct platform_device *dev)
2267{ 2266{
2268 struct pxafb_info *fbi = platform_get_drvdata(dev); 2267 struct pxafb_info *fbi = platform_get_drvdata(dev);
2269 struct resource *r; 2268 struct resource *r;
@@ -2304,7 +2303,7 @@ static int __devexit pxafb_remove(struct platform_device *dev)
2304 2303
2305static struct platform_driver pxafb_driver = { 2304static struct platform_driver pxafb_driver = {
2306 .probe = pxafb_probe, 2305 .probe = pxafb_probe,
2307 .remove = __devexit_p(pxafb_remove), 2306 .remove = pxafb_remove,
2308 .driver = { 2307 .driver = {
2309 .owner = THIS_MODULE, 2308 .owner = THIS_MODULE,
2310 .name = "pxa2xx-fb", 2309 .name = "pxa2xx-fb",
diff --git a/drivers/video/q40fb.c b/drivers/video/q40fb.c
index a104e8cd2f54..d44c7351de0f 100644
--- a/drivers/video/q40fb.c
+++ b/drivers/video/q40fb.c
@@ -27,7 +27,7 @@
27 27
28#define Q40_PHYS_SCREEN_ADDR 0xFE800000 28#define Q40_PHYS_SCREEN_ADDR 0xFE800000
29 29
30static struct fb_fix_screeninfo q40fb_fix __devinitdata = { 30static struct fb_fix_screeninfo q40fb_fix = {
31 .id = "Q40", 31 .id = "Q40",
32 .smem_len = 1024*1024, 32 .smem_len = 1024*1024,
33 .type = FB_TYPE_PACKED_PIXELS, 33 .type = FB_TYPE_PACKED_PIXELS,
@@ -36,7 +36,7 @@ static struct fb_fix_screeninfo q40fb_fix __devinitdata = {
36 .accel = FB_ACCEL_NONE, 36 .accel = FB_ACCEL_NONE,
37}; 37};
38 38
39static struct fb_var_screeninfo q40fb_var __devinitdata = { 39static struct fb_var_screeninfo q40fb_var = {
40 .xres = 1024, 40 .xres = 1024,
41 .yres = 512, 41 .yres = 512,
42 .xres_virtual = 1024, 42 .xres_virtual = 1024,
@@ -83,7 +83,7 @@ static struct fb_ops q40fb_ops = {
83 .fb_imageblit = cfb_imageblit, 83 .fb_imageblit = cfb_imageblit,
84}; 84};
85 85
86static int __devinit q40fb_probe(struct platform_device *dev) 86static int q40fb_probe(struct platform_device *dev)
87{ 87{
88 struct fb_info *info; 88 struct fb_info *info;
89 89
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c
index 90df1a60bd16..9536715b5a1b 100644
--- a/drivers/video/riva/fbdev.c
+++ b/drivers/video/riva/fbdev.c
@@ -205,28 +205,28 @@ MODULE_DEVICE_TABLE(pci, rivafb_pci_tbl);
205 * ------------------------------------------------------------------------- */ 205 * ------------------------------------------------------------------------- */
206 206
207/* command line data, set in rivafb_setup() */ 207/* command line data, set in rivafb_setup() */
208static int flatpanel __devinitdata = -1; /* Autodetect later */ 208static int flatpanel = -1; /* Autodetect later */
209static int forceCRTC __devinitdata = -1; 209static int forceCRTC = -1;
210static bool noaccel __devinitdata = 0; 210static bool noaccel = 0;
211#ifdef CONFIG_MTRR 211#ifdef CONFIG_MTRR
212static bool nomtrr __devinitdata = 0; 212static bool nomtrr = 0;
213#endif 213#endif
214#ifdef CONFIG_PMAC_BACKLIGHT 214#ifdef CONFIG_PMAC_BACKLIGHT
215static int backlight __devinitdata = 1; 215static int backlight = 1;
216#else 216#else
217static int backlight __devinitdata = 0; 217static int backlight = 0;
218#endif 218#endif
219 219
220static char *mode_option __devinitdata = NULL; 220static char *mode_option = NULL;
221static bool strictmode = 0; 221static bool strictmode = 0;
222 222
223static struct fb_fix_screeninfo __devinitdata rivafb_fix = { 223static struct fb_fix_screeninfo rivafb_fix = {
224 .type = FB_TYPE_PACKED_PIXELS, 224 .type = FB_TYPE_PACKED_PIXELS,
225 .xpanstep = 1, 225 .xpanstep = 1,
226 .ypanstep = 1, 226 .ypanstep = 1,
227}; 227};
228 228
229static struct fb_var_screeninfo __devinitdata rivafb_default_var = { 229static struct fb_var_screeninfo rivafb_default_var = {
230 .xres = 640, 230 .xres = 640,
231 .yres = 480, 231 .yres = 480,
232 .xres_virtual = 640, 232 .xres_virtual = 640,
@@ -1709,7 +1709,7 @@ static struct fb_ops riva_fb_ops = {
1709 .fb_sync = rivafb_sync, 1709 .fb_sync = rivafb_sync,
1710}; 1710};
1711 1711
1712static int __devinit riva_set_fbinfo(struct fb_info *info) 1712static int riva_set_fbinfo(struct fb_info *info)
1713{ 1713{
1714 unsigned int cmap_len; 1714 unsigned int cmap_len;
1715 struct riva_par *par = info->par; 1715 struct riva_par *par = info->par;
@@ -1747,7 +1747,7 @@ static int __devinit riva_set_fbinfo(struct fb_info *info)
1747} 1747}
1748 1748
1749#ifdef CONFIG_PPC_OF 1749#ifdef CONFIG_PPC_OF
1750static int __devinit riva_get_EDID_OF(struct fb_info *info, struct pci_dev *pd) 1750static int riva_get_EDID_OF(struct fb_info *info, struct pci_dev *pd)
1751{ 1751{
1752 struct riva_par *par = info->par; 1752 struct riva_par *par = info->par;
1753 struct device_node *dp; 1753 struct device_node *dp;
@@ -1780,7 +1780,7 @@ static int __devinit riva_get_EDID_OF(struct fb_info *info, struct pci_dev *pd)
1780#endif /* CONFIG_PPC_OF */ 1780#endif /* CONFIG_PPC_OF */
1781 1781
1782#if defined(CONFIG_FB_RIVA_I2C) && !defined(CONFIG_PPC_OF) 1782#if defined(CONFIG_FB_RIVA_I2C) && !defined(CONFIG_PPC_OF)
1783static int __devinit riva_get_EDID_i2c(struct fb_info *info) 1783static int riva_get_EDID_i2c(struct fb_info *info)
1784{ 1784{
1785 struct riva_par *par = info->par; 1785 struct riva_par *par = info->par;
1786 struct fb_var_screeninfo var; 1786 struct fb_var_screeninfo var;
@@ -1803,8 +1803,8 @@ static int __devinit riva_get_EDID_i2c(struct fb_info *info)
1803} 1803}
1804#endif /* CONFIG_FB_RIVA_I2C */ 1804#endif /* CONFIG_FB_RIVA_I2C */
1805 1805
1806static void __devinit riva_update_default_var(struct fb_var_screeninfo *var, 1806static void riva_update_default_var(struct fb_var_screeninfo *var,
1807 struct fb_info *info) 1807 struct fb_info *info)
1808{ 1808{
1809 struct fb_monspecs *specs = &info->monspecs; 1809 struct fb_monspecs *specs = &info->monspecs;
1810 struct fb_videomode modedb; 1810 struct fb_videomode modedb;
@@ -1836,7 +1836,7 @@ static void __devinit riva_update_default_var(struct fb_var_screeninfo *var,
1836} 1836}
1837 1837
1838 1838
1839static void __devinit riva_get_EDID(struct fb_info *info, struct pci_dev *pdev) 1839static void riva_get_EDID(struct fb_info *info, struct pci_dev *pdev)
1840{ 1840{
1841 NVTRACE_ENTER(); 1841 NVTRACE_ENTER();
1842#ifdef CONFIG_PPC_OF 1842#ifdef CONFIG_PPC_OF
@@ -1850,7 +1850,7 @@ static void __devinit riva_get_EDID(struct fb_info *info, struct pci_dev *pdev)
1850} 1850}
1851 1851
1852 1852
1853static void __devinit riva_get_edidinfo(struct fb_info *info) 1853static void riva_get_edidinfo(struct fb_info *info)
1854{ 1854{
1855 struct fb_var_screeninfo *var = &rivafb_default_var; 1855 struct fb_var_screeninfo *var = &rivafb_default_var;
1856 struct riva_par *par = info->par; 1856 struct riva_par *par = info->par;
@@ -1871,7 +1871,7 @@ static void __devinit riva_get_edidinfo(struct fb_info *info)
1871 * 1871 *
1872 * ------------------------------------------------------------------------- */ 1872 * ------------------------------------------------------------------------- */
1873 1873
1874static u32 __devinit riva_get_arch(struct pci_dev *pd) 1874static u32 riva_get_arch(struct pci_dev *pd)
1875{ 1875{
1876 u32 arch = 0; 1876 u32 arch = 0;
1877 1877
@@ -1909,8 +1909,7 @@ static u32 __devinit riva_get_arch(struct pci_dev *pd)
1909 return arch; 1909 return arch;
1910} 1910}
1911 1911
1912static int __devinit rivafb_probe(struct pci_dev *pd, 1912static int rivafb_probe(struct pci_dev *pd, const struct pci_device_id *ent)
1913 const struct pci_device_id *ent)
1914{ 1913{
1915 struct riva_par *default_par; 1914 struct riva_par *default_par;
1916 struct fb_info *info; 1915 struct fb_info *info;
@@ -2105,7 +2104,7 @@ err_ret:
2105 return ret; 2104 return ret;
2106} 2105}
2107 2106
2108static void __devexit rivafb_remove(struct pci_dev *pd) 2107static void rivafb_remove(struct pci_dev *pd)
2109{ 2108{
2110 struct fb_info *info = pci_get_drvdata(pd); 2109 struct fb_info *info = pci_get_drvdata(pd);
2111 struct riva_par *par = info->par; 2110 struct riva_par *par = info->par;
@@ -2145,7 +2144,7 @@ static void __devexit rivafb_remove(struct pci_dev *pd)
2145 * ------------------------------------------------------------------------- */ 2144 * ------------------------------------------------------------------------- */
2146 2145
2147#ifndef MODULE 2146#ifndef MODULE
2148static int __devinit rivafb_setup(char *options) 2147static int rivafb_setup(char *options)
2149{ 2148{
2150 char *this_opt; 2149 char *this_opt;
2151 2150
@@ -2186,7 +2185,7 @@ static struct pci_driver rivafb_driver = {
2186 .name = "rivafb", 2185 .name = "rivafb",
2187 .id_table = rivafb_pci_tbl, 2186 .id_table = rivafb_pci_tbl,
2188 .probe = rivafb_probe, 2187 .probe = rivafb_probe,
2189 .remove = __devexit_p(rivafb_remove), 2188 .remove = rivafb_remove,
2190}; 2189};
2191 2190
2192 2191
@@ -2197,7 +2196,7 @@ static struct pci_driver rivafb_driver = {
2197 * 2196 *
2198 * ------------------------------------------------------------------------- */ 2197 * ------------------------------------------------------------------------- */
2199 2198
2200static int __devinit rivafb_init(void) 2199static int rivafb_init(void)
2201{ 2200{
2202#ifndef MODULE 2201#ifndef MODULE
2203 char *option = NULL; 2202 char *option = NULL;
diff --git a/drivers/video/riva/rivafb-i2c.c b/drivers/video/riva/rivafb-i2c.c
index 167400e2a182..6a183375ced1 100644
--- a/drivers/video/riva/rivafb-i2c.c
+++ b/drivers/video/riva/rivafb-i2c.c
@@ -86,9 +86,8 @@ static int riva_gpio_getsda(void* data)
86 return val; 86 return val;
87} 87}
88 88
89static int __devinit riva_setup_i2c_bus(struct riva_i2c_chan *chan, 89static int riva_setup_i2c_bus(struct riva_i2c_chan *chan, const char *name,
90 const char *name, 90 unsigned int i2c_class)
91 unsigned int i2c_class)
92{ 91{
93 int rc; 92 int rc;
94 93
@@ -124,7 +123,7 @@ static int __devinit riva_setup_i2c_bus(struct riva_i2c_chan *chan,
124 return rc; 123 return rc;
125} 124}
126 125
127void __devinit riva_create_i2c_busses(struct riva_par *par) 126void riva_create_i2c_busses(struct riva_par *par)
128{ 127{
129 par->chan[0].par = par; 128 par->chan[0].par = par;
130 par->chan[1].par = par; 129 par->chan[1].par = par;
@@ -150,7 +149,7 @@ void riva_delete_i2c_busses(struct riva_par *par)
150 } 149 }
151} 150}
152 151
153int __devinit riva_probe_i2c_connector(struct riva_par *par, int conn, u8 **out_edid) 152int riva_probe_i2c_connector(struct riva_par *par, int conn, u8 **out_edid)
154{ 153{
155 u8 *edid = NULL; 154 u8 *edid = NULL;
156 155
diff --git a/drivers/video/s1d13xxxfb.c b/drivers/video/s1d13xxxfb.c
index 28b1c6c3d8ac..76d9053d88c1 100644
--- a/drivers/video/s1d13xxxfb.c
+++ b/drivers/video/s1d13xxxfb.c
@@ -84,7 +84,7 @@ static const char *s1d13xxxfb_prod_names[] = {
84/* 84/*
85 * here we define the default struct fb_fix_screeninfo 85 * here we define the default struct fb_fix_screeninfo
86 */ 86 */
87static struct fb_fix_screeninfo __devinitdata s1d13xxxfb_fix = { 87static struct fb_fix_screeninfo s1d13xxxfb_fix = {
88 .id = S1D_FBID, 88 .id = S1D_FBID,
89 .type = FB_TYPE_PACKED_PIXELS, 89 .type = FB_TYPE_PACKED_PIXELS,
90 .visual = FB_VISUAL_PSEUDOCOLOR, 90 .visual = FB_VISUAL_PSEUDOCOLOR,
@@ -622,7 +622,7 @@ static struct fb_ops s1d13xxxfb_fbops = {
622 .fb_imageblit = cfb_imageblit, 622 .fb_imageblit = cfb_imageblit,
623}; 623};
624 624
625static int s1d13xxxfb_width_tab[2][4] __devinitdata = { 625static int s1d13xxxfb_width_tab[2][4] = {
626 {4, 8, 16, -1}, 626 {4, 8, 16, -1},
627 {9, 12, 18, -1}, 627 {9, 12, 18, -1},
628}; 628};
@@ -642,8 +642,7 @@ static int s1d13xxxfb_width_tab[2][4] __devinitdata = {
642 * Note: some of the hardcoded values here might need some love to 642 * Note: some of the hardcoded values here might need some love to
643 * work on various chips, and might need to no longer be hardcoded. 643 * work on various chips, and might need to no longer be hardcoded.
644 */ 644 */
645static void __devinit 645static void s1d13xxxfb_fetch_hw_state(struct fb_info *info)
646s1d13xxxfb_fetch_hw_state(struct fb_info *info)
647{ 646{
648 struct fb_var_screeninfo *var = &info->var; 647 struct fb_var_screeninfo *var = &info->var;
649 struct fb_fix_screeninfo *fix = &info->fix; 648 struct fb_fix_screeninfo *fix = &info->fix;
@@ -764,8 +763,7 @@ s1d13xxxfb_remove(struct platform_device *pdev)
764 return 0; 763 return 0;
765} 764}
766 765
767static int __devinit 766static int s1d13xxxfb_probe(struct platform_device *pdev)
768s1d13xxxfb_probe(struct platform_device *pdev)
769{ 767{
770 struct s1d13xxxfb_par *default_par; 768 struct s1d13xxxfb_par *default_par;
771 struct fb_info *info; 769 struct fb_info *info;
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
index 1a00ad241edd..9b57a235c9bc 100644
--- a/drivers/video/s3c-fb.c
+++ b/drivers/video/s3c-fb.c
@@ -1081,8 +1081,7 @@ static void s3c_fb_missing_pixclock(struct fb_videomode *mode)
1081 * 1081 *
1082 * Allocate memory for the given framebuffer. 1082 * Allocate memory for the given framebuffer.
1083 */ 1083 */
1084static int __devinit s3c_fb_alloc_memory(struct s3c_fb *sfb, 1084static int s3c_fb_alloc_memory(struct s3c_fb *sfb, struct s3c_fb_win *win)
1085 struct s3c_fb_win *win)
1086{ 1085{
1087 struct s3c_fb_pd_win *windata = win->windata; 1086 struct s3c_fb_pd_win *windata = win->windata;
1088 unsigned int real_size, virt_size, size; 1087 unsigned int real_size, virt_size, size;
@@ -1172,9 +1171,9 @@ static void s3c_fb_release_win(struct s3c_fb *sfb, struct s3c_fb_win *win)
1172 * Allocate and do the basic initialisation for one of the hardware's graphics 1171 * Allocate and do the basic initialisation for one of the hardware's graphics
1173 * windows. 1172 * windows.
1174 */ 1173 */
1175static int __devinit s3c_fb_probe_win(struct s3c_fb *sfb, unsigned int win_no, 1174static int s3c_fb_probe_win(struct s3c_fb *sfb, unsigned int win_no,
1176 struct s3c_fb_win_variant *variant, 1175 struct s3c_fb_win_variant *variant,
1177 struct s3c_fb_win **res) 1176 struct s3c_fb_win **res)
1178{ 1177{
1179 struct fb_var_screeninfo *var; 1178 struct fb_var_screeninfo *var;
1180 struct fb_videomode initmode; 1179 struct fb_videomode initmode;
@@ -1360,7 +1359,7 @@ static void s3c_fb_clear_win(struct s3c_fb *sfb, int win)
1360 } 1359 }
1361} 1360}
1362 1361
1363static int __devinit s3c_fb_probe(struct platform_device *pdev) 1362static int s3c_fb_probe(struct platform_device *pdev)
1364{ 1363{
1365 const struct platform_device_id *platid; 1364 const struct platform_device_id *platid;
1366 struct s3c_fb_driverdata *fbdrv; 1365 struct s3c_fb_driverdata *fbdrv;
@@ -1521,7 +1520,7 @@ err_bus_clk:
1521 * Shutdown and then release all the resources that the driver allocated 1520 * Shutdown and then release all the resources that the driver allocated
1522 * on initialisation. 1521 * on initialisation.
1523 */ 1522 */
1524static int __devexit s3c_fb_remove(struct platform_device *pdev) 1523static int s3c_fb_remove(struct platform_device *pdev)
1525{ 1524{
1526 struct s3c_fb *sfb = platform_get_drvdata(pdev); 1525 struct s3c_fb *sfb = platform_get_drvdata(pdev);
1527 int win; 1526 int win;
@@ -2035,7 +2034,7 @@ static const struct dev_pm_ops s3cfb_pm_ops = {
2035 2034
2036static struct platform_driver s3c_fb_driver = { 2035static struct platform_driver s3c_fb_driver = {
2037 .probe = s3c_fb_probe, 2036 .probe = s3c_fb_probe,
2038 .remove = __devexit_p(s3c_fb_remove), 2037 .remove = s3c_fb_remove,
2039 .id_table = s3c_fb_driver_ids, 2038 .id_table = s3c_fb_driver_ids,
2040 .driver = { 2039 .driver = {
2041 .name = "s3c-fb", 2040 .name = "s3c-fb",
diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c
index 1083bb9469ee..76a0e7fbd692 100644
--- a/drivers/video/s3c2410fb.c
+++ b/drivers/video/s3c2410fb.c
@@ -637,7 +637,7 @@ static struct fb_ops s3c2410fb_ops = {
637 * cache. Once this area is remapped, all virtual memory 637 * cache. Once this area is remapped, all virtual memory
638 * access to the video memory should occur at the new region. 638 * access to the video memory should occur at the new region.
639 */ 639 */
640static int __devinit s3c2410fb_map_video_memory(struct fb_info *info) 640static int s3c2410fb_map_video_memory(struct fb_info *info)
641{ 641{
642 struct s3c2410fb_info *fbi = info->par; 642 struct s3c2410fb_info *fbi = info->par;
643 dma_addr_t map_dma; 643 dma_addr_t map_dma;
@@ -819,8 +819,8 @@ static inline void s3c2410fb_cpufreq_deregister(struct s3c2410fb_info *info)
819 819
820static const char driver_name[] = "s3c2410fb"; 820static const char driver_name[] = "s3c2410fb";
821 821
822static int __devinit s3c24xxfb_probe(struct platform_device *pdev, 822static int s3c24xxfb_probe(struct platform_device *pdev,
823 enum s3c_drv_type drv_type) 823 enum s3c_drv_type drv_type)
824{ 824{
825 struct s3c2410fb_info *info; 825 struct s3c2410fb_info *info;
826 struct s3c2410fb_display *display; 826 struct s3c2410fb_display *display;
@@ -1010,12 +1010,12 @@ dealloc_fb:
1010 return ret; 1010 return ret;
1011} 1011}
1012 1012
1013static int __devinit s3c2410fb_probe(struct platform_device *pdev) 1013static int s3c2410fb_probe(struct platform_device *pdev)
1014{ 1014{
1015 return s3c24xxfb_probe(pdev, DRV_S3C2410); 1015 return s3c24xxfb_probe(pdev, DRV_S3C2410);
1016} 1016}
1017 1017
1018static int __devinit s3c2412fb_probe(struct platform_device *pdev) 1018static int s3c2412fb_probe(struct platform_device *pdev)
1019{ 1019{
1020 return s3c24xxfb_probe(pdev, DRV_S3C2412); 1020 return s3c24xxfb_probe(pdev, DRV_S3C2412);
1021} 1021}
@@ -1024,7 +1024,7 @@ static int __devinit s3c2412fb_probe(struct platform_device *pdev)
1024/* 1024/*
1025 * Cleanup 1025 * Cleanup
1026 */ 1026 */
1027static int __devexit s3c2410fb_remove(struct platform_device *pdev) 1027static int s3c2410fb_remove(struct platform_device *pdev)
1028{ 1028{
1029 struct fb_info *fbinfo = platform_get_drvdata(pdev); 1029 struct fb_info *fbinfo = platform_get_drvdata(pdev);
1030 struct s3c2410fb_info *info = fbinfo->par; 1030 struct s3c2410fb_info *info = fbinfo->par;
@@ -1101,7 +1101,7 @@ static int s3c2410fb_resume(struct platform_device *dev)
1101 1101
1102static struct platform_driver s3c2410fb_driver = { 1102static struct platform_driver s3c2410fb_driver = {
1103 .probe = s3c2410fb_probe, 1103 .probe = s3c2410fb_probe,
1104 .remove = __devexit_p(s3c2410fb_remove), 1104 .remove = s3c2410fb_remove,
1105 .suspend = s3c2410fb_suspend, 1105 .suspend = s3c2410fb_suspend,
1106 .resume = s3c2410fb_resume, 1106 .resume = s3c2410fb_resume,
1107 .driver = { 1107 .driver = {
@@ -1112,7 +1112,7 @@ static struct platform_driver s3c2410fb_driver = {
1112 1112
1113static struct platform_driver s3c2412fb_driver = { 1113static struct platform_driver s3c2412fb_driver = {
1114 .probe = s3c2412fb_probe, 1114 .probe = s3c2412fb_probe,
1115 .remove = __devexit_p(s3c2410fb_remove), 1115 .remove = s3c2410fb_remove,
1116 .suspend = s3c2410fb_suspend, 1116 .suspend = s3c2410fb_suspend,
1117 .resume = s3c2410fb_resume, 1117 .resume = s3c2410fb_resume,
1118 .driver = { 1118 .driver = {
diff --git a/drivers/video/s3fb.c b/drivers/video/s3fb.c
index 1d007366b917..47ca86c5c6c0 100644
--- a/drivers/video/s3fb.c
+++ b/drivers/video/s3fb.c
@@ -153,10 +153,10 @@ static const struct svga_timing_regs s3_timing_regs = {
153/* Module parameters */ 153/* Module parameters */
154 154
155 155
156static char *mode_option __devinitdata; 156static char *mode_option;
157 157
158#ifdef CONFIG_MTRR 158#ifdef CONFIG_MTRR
159static int mtrr __devinitdata = 1; 159static int mtrr = 1;
160#endif 160#endif
161 161
162static int fasttext = 1; 162static int fasttext = 1;
@@ -255,7 +255,7 @@ static int s3fb_ddc_getsda(void *data)
255 return !!(s3fb_ddc_read(par) & DDC_SDA_IN); 255 return !!(s3fb_ddc_read(par) & DDC_SDA_IN);
256} 256}
257 257
258static int __devinit s3fb_setup_ddc_bus(struct fb_info *info) 258static int s3fb_setup_ddc_bus(struct fb_info *info)
259{ 259{
260 struct s3fb_info *par = info->par; 260 struct s3fb_info *par = info->par;
261 261
@@ -1066,7 +1066,7 @@ static struct fb_ops s3fb_ops = {
1066 1066
1067/* ------------------------------------------------------------------------- */ 1067/* ------------------------------------------------------------------------- */
1068 1068
1069static int __devinit s3_identification(struct s3fb_info *par) 1069static int s3_identification(struct s3fb_info *par)
1070{ 1070{
1071 int chip = par->chip; 1071 int chip = par->chip;
1072 1072
@@ -1122,7 +1122,7 @@ static int __devinit s3_identification(struct s3fb_info *par)
1122 1122
1123/* PCI probe */ 1123/* PCI probe */
1124 1124
1125static int __devinit s3_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) 1125static int s3_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
1126{ 1126{
1127 struct pci_bus_region bus_reg; 1127 struct pci_bus_region bus_reg;
1128 struct resource vga_res; 1128 struct resource vga_res;
@@ -1403,7 +1403,7 @@ err_enable_device:
1403 1403
1404/* PCI remove */ 1404/* PCI remove */
1405 1405
1406static void __devexit s3_pci_remove(struct pci_dev *dev) 1406static void s3_pci_remove(struct pci_dev *dev)
1407{ 1407{
1408 struct fb_info *info = pci_get_drvdata(dev); 1408 struct fb_info *info = pci_get_drvdata(dev);
1409 struct s3fb_info __maybe_unused *par = info->par; 1409 struct s3fb_info __maybe_unused *par = info->par;
@@ -1509,7 +1509,7 @@ static int s3_pci_resume(struct pci_dev* dev)
1509 1509
1510/* List of boards that we are trying to support */ 1510/* List of boards that we are trying to support */
1511 1511
1512static struct pci_device_id s3_devices[] __devinitdata = { 1512static struct pci_device_id s3_devices[] = {
1513 {PCI_DEVICE(PCI_VENDOR_ID_S3, 0x8810), .driver_data = CHIP_XXX_TRIO}, 1513 {PCI_DEVICE(PCI_VENDOR_ID_S3, 0x8810), .driver_data = CHIP_XXX_TRIO},
1514 {PCI_DEVICE(PCI_VENDOR_ID_S3, 0x8811), .driver_data = CHIP_XXX_TRIO}, 1514 {PCI_DEVICE(PCI_VENDOR_ID_S3, 0x8811), .driver_data = CHIP_XXX_TRIO},
1515 {PCI_DEVICE(PCI_VENDOR_ID_S3, 0x8812), .driver_data = CHIP_M65_AURORA64VP}, 1515 {PCI_DEVICE(PCI_VENDOR_ID_S3, 0x8812), .driver_data = CHIP_M65_AURORA64VP},
@@ -1537,7 +1537,7 @@ static struct pci_driver s3fb_pci_driver = {
1537 .name = "s3fb", 1537 .name = "s3fb",
1538 .id_table = s3_devices, 1538 .id_table = s3_devices,
1539 .probe = s3_pci_probe, 1539 .probe = s3_pci_probe,
1540 .remove = __devexit_p(s3_pci_remove), 1540 .remove = s3_pci_remove,
1541 .suspend = s3_pci_suspend, 1541 .suspend = s3_pci_suspend,
1542 .resume = s3_pci_resume, 1542 .resume = s3_pci_resume,
1543}; 1543};
diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c
index b6325848ad61..cfbde5e85cbf 100644
--- a/drivers/video/sa1100fb.c
+++ b/drivers/video/sa1100fb.c
@@ -1090,7 +1090,7 @@ static int sa1100fb_resume(struct platform_device *dev)
1090 * cache. Once this area is remapped, all virtual memory 1090 * cache. Once this area is remapped, all virtual memory
1091 * access to the video memory should occur at the new region. 1091 * access to the video memory should occur at the new region.
1092 */ 1092 */
1093static int __devinit sa1100fb_map_video_memory(struct sa1100fb_info *fbi) 1093static int sa1100fb_map_video_memory(struct sa1100fb_info *fbi)
1094{ 1094{
1095 /* 1095 /*
1096 * We reserve one page for the palette, plus the size 1096 * We reserve one page for the palette, plus the size
@@ -1116,7 +1116,7 @@ static int __devinit sa1100fb_map_video_memory(struct sa1100fb_info *fbi)
1116} 1116}
1117 1117
1118/* Fake monspecs to fill in fbinfo structure */ 1118/* Fake monspecs to fill in fbinfo structure */
1119static struct fb_monspecs monspecs __devinitdata = { 1119static struct fb_monspecs monspecs = {
1120 .hfmin = 30000, 1120 .hfmin = 30000,
1121 .hfmax = 70000, 1121 .hfmax = 70000,
1122 .vfmin = 50, 1122 .vfmin = 50,
@@ -1124,7 +1124,7 @@ static struct fb_monspecs monspecs __devinitdata = {
1124}; 1124};
1125 1125
1126 1126
1127static struct sa1100fb_info * __devinit sa1100fb_init_fbinfo(struct device *dev) 1127static struct sa1100fb_info *sa1100fb_init_fbinfo(struct device *dev)
1128{ 1128{
1129 struct sa1100fb_mach_info *inf = dev->platform_data; 1129 struct sa1100fb_mach_info *inf = dev->platform_data;
1130 struct sa1100fb_info *fbi; 1130 struct sa1100fb_info *fbi;
@@ -1205,7 +1205,7 @@ static struct sa1100fb_info * __devinit sa1100fb_init_fbinfo(struct device *dev)
1205 return fbi; 1205 return fbi;
1206} 1206}
1207 1207
1208static int __devinit sa1100fb_probe(struct platform_device *pdev) 1208static int sa1100fb_probe(struct platform_device *pdev)
1209{ 1209{
1210 struct sa1100fb_info *fbi; 1210 struct sa1100fb_info *fbi;
1211 struct resource *res; 1211 struct resource *res;
diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/savage/savagefb_driver.c
index f4f53b082d05..741b2395d01e 100644
--- a/drivers/video/savage/savagefb_driver.c
+++ b/drivers/video/savage/savagefb_driver.c
@@ -69,7 +69,7 @@
69/* --------------------------------------------------------------------- */ 69/* --------------------------------------------------------------------- */
70 70
71 71
72static char *mode_option __devinitdata = NULL; 72static char *mode_option = NULL;
73 73
74#ifdef MODULE 74#ifdef MODULE
75 75
@@ -1664,7 +1664,7 @@ static struct fb_ops savagefb_ops = {
1664 1664
1665/* --------------------------------------------------------------------- */ 1665/* --------------------------------------------------------------------- */
1666 1666
1667static struct fb_var_screeninfo __devinitdata savagefb_var800x600x8 = { 1667static struct fb_var_screeninfo savagefb_var800x600x8 = {
1668 .accel_flags = FB_ACCELF_TEXT, 1668 .accel_flags = FB_ACCELF_TEXT,
1669 .xres = 800, 1669 .xres = 800,
1670 .yres = 600, 1670 .yres = 600,
@@ -1715,7 +1715,7 @@ static void savage_disable_mmio(struct savagefb_par *par)
1715} 1715}
1716 1716
1717 1717
1718static int __devinit savage_map_mmio(struct fb_info *info) 1718static int savage_map_mmio(struct fb_info *info)
1719{ 1719{
1720 struct savagefb_par *par = info->par; 1720 struct savagefb_par *par = info->par;
1721 DBG("savage_map_mmio"); 1721 DBG("savage_map_mmio");
@@ -1761,8 +1761,7 @@ static void savage_unmap_mmio(struct fb_info *info)
1761 } 1761 }
1762} 1762}
1763 1763
1764static int __devinit savage_map_video(struct fb_info *info, 1764static int savage_map_video(struct fb_info *info, int video_len)
1765 int video_len)
1766{ 1765{
1767 struct savagefb_par *par = info->par; 1766 struct savagefb_par *par = info->par;
1768 int resource; 1767 int resource;
@@ -2052,9 +2051,8 @@ static int savage_init_hw(struct savagefb_par *par)
2052 return videoRambytes; 2051 return videoRambytes;
2053} 2052}
2054 2053
2055static int __devinit savage_init_fb_info(struct fb_info *info, 2054static int savage_init_fb_info(struct fb_info *info, struct pci_dev *dev,
2056 struct pci_dev *dev, 2055 const struct pci_device_id *id)
2057 const struct pci_device_id *id)
2058{ 2056{
2059 struct savagefb_par *par = info->par; 2057 struct savagefb_par *par = info->par;
2060 int err = 0; 2058 int err = 0;
@@ -2178,8 +2176,7 @@ static int __devinit savage_init_fb_info(struct fb_info *info,
2178 2176
2179/* --------------------------------------------------------------------- */ 2177/* --------------------------------------------------------------------- */
2180 2178
2181static int __devinit savagefb_probe(struct pci_dev* dev, 2179static int savagefb_probe(struct pci_dev *dev, const struct pci_device_id *id)
2182 const struct pci_device_id* id)
2183{ 2180{
2184 struct fb_info *info; 2181 struct fb_info *info;
2185 struct savagefb_par *par; 2182 struct savagefb_par *par;
@@ -2340,7 +2337,7 @@ static int __devinit savagefb_probe(struct pci_dev* dev,
2340 return err; 2337 return err;
2341} 2338}
2342 2339
2343static void __devexit savagefb_remove(struct pci_dev *dev) 2340static void savagefb_remove(struct pci_dev *dev)
2344{ 2341{
2345 struct fb_info *info = pci_get_drvdata(dev); 2342 struct fb_info *info = pci_get_drvdata(dev);
2346 2343
@@ -2449,7 +2446,7 @@ static int savagefb_resume(struct pci_dev* dev)
2449} 2446}
2450 2447
2451 2448
2452static struct pci_device_id savagefb_devices[] __devinitdata = { 2449static struct pci_device_id savagefb_devices[] = {
2453 {PCI_VENDOR_ID_S3, PCI_CHIP_SUPSAV_MX128, 2450 {PCI_VENDOR_ID_S3, PCI_CHIP_SUPSAV_MX128,
2454 PCI_ANY_ID, PCI_ANY_ID, 0, 0, FB_ACCEL_SUPERSAVAGE}, 2451 PCI_ANY_ID, PCI_ANY_ID, 0, 0, FB_ACCEL_SUPERSAVAGE},
2455 2452
@@ -2530,7 +2527,7 @@ static struct pci_driver savagefb_driver = {
2530 .probe = savagefb_probe, 2527 .probe = savagefb_probe,
2531 .suspend = savagefb_suspend, 2528 .suspend = savagefb_suspend,
2532 .resume = savagefb_resume, 2529 .resume = savagefb_resume,
2533 .remove = __devexit_p(savagefb_remove) 2530 .remove = savagefb_remove,
2534}; 2531};
2535 2532
2536/* **************************** exit-time only **************************** */ 2533/* **************************** exit-time only **************************** */
diff --git a/drivers/video/sgivwfb.c b/drivers/video/sgivwfb.c
index 53455f295510..2331fadc272b 100644
--- a/drivers/video/sgivwfb.c
+++ b/drivers/video/sgivwfb.c
@@ -47,7 +47,7 @@ static int ywrap = 0;
47 47
48static int flatpanel_id = -1; 48static int flatpanel_id = -1;
49 49
50static struct fb_fix_screeninfo sgivwfb_fix __devinitdata = { 50static struct fb_fix_screeninfo sgivwfb_fix = {
51 .id = "SGI Vis WS FB", 51 .id = "SGI Vis WS FB",
52 .type = FB_TYPE_PACKED_PIXELS, 52 .type = FB_TYPE_PACKED_PIXELS,
53 .visual = FB_VISUAL_PSEUDOCOLOR, 53 .visual = FB_VISUAL_PSEUDOCOLOR,
@@ -57,7 +57,7 @@ static struct fb_fix_screeninfo sgivwfb_fix __devinitdata = {
57 .line_length = 640, 57 .line_length = 640,
58}; 58};
59 59
60static struct fb_var_screeninfo sgivwfb_var __devinitdata = { 60static struct fb_var_screeninfo sgivwfb_var = {
61 /* 640x480, 8 bpp */ 61 /* 640x480, 8 bpp */
62 .xres = 640, 62 .xres = 640,
63 .yres = 480, 63 .yres = 480,
@@ -79,7 +79,7 @@ static struct fb_var_screeninfo sgivwfb_var __devinitdata = {
79 .vmode = FB_VMODE_NONINTERLACED 79 .vmode = FB_VMODE_NONINTERLACED
80}; 80};
81 81
82static struct fb_var_screeninfo sgivwfb_var1600sw __devinitdata = { 82static struct fb_var_screeninfo sgivwfb_var1600sw = {
83 /* 1600x1024, 8 bpp */ 83 /* 1600x1024, 8 bpp */
84 .xres = 1600, 84 .xres = 1600,
85 .yres = 1024, 85 .yres = 1024,
@@ -745,7 +745,7 @@ int __init sgivwfb_setup(char *options)
745/* 745/*
746 * Initialisation 746 * Initialisation
747 */ 747 */
748static int __devinit sgivwfb_probe(struct platform_device *dev) 748static int sgivwfb_probe(struct platform_device *dev)
749{ 749{
750 struct sgivw_par *par; 750 struct sgivw_par *par;
751 struct fb_info *info; 751 struct fb_info *info;
@@ -825,7 +825,7 @@ fail_ioremap_regs:
825 return -ENXIO; 825 return -ENXIO;
826} 826}
827 827
828static int __devexit sgivwfb_remove(struct platform_device *dev) 828static int sgivwfb_remove(struct platform_device *dev)
829{ 829{
830 struct fb_info *info = platform_get_drvdata(dev); 830 struct fb_info *info = platform_get_drvdata(dev);
831 831
@@ -845,7 +845,7 @@ static int __devexit sgivwfb_remove(struct platform_device *dev)
845 845
846static struct platform_driver sgivwfb_driver = { 846static struct platform_driver sgivwfb_driver = {
847 .probe = sgivwfb_probe, 847 .probe = sgivwfb_probe,
848 .remove = __devexit_p(sgivwfb_remove), 848 .remove = sgivwfb_remove,
849 .driver = { 849 .driver = {
850 .name = "sgivwfb", 850 .name = "sgivwfb",
851 }, 851 },
diff --git a/drivers/video/sh7760fb.c b/drivers/video/sh7760fb.c
index 83b16e237a0e..5fbb0c7ab0c8 100644
--- a/drivers/video/sh7760fb.c
+++ b/drivers/video/sh7760fb.c
@@ -431,7 +431,7 @@ static int sh7760fb_alloc_mem(struct fb_info *info)
431 return 0; 431 return 0;
432} 432}
433 433
434static int __devinit sh7760fb_probe(struct platform_device *pdev) 434static int sh7760fb_probe(struct platform_device *pdev)
435{ 435{
436 struct fb_info *info; 436 struct fb_info *info;
437 struct resource *res; 437 struct resource *res;
@@ -557,7 +557,7 @@ out_fb:
557 return ret; 557 return ret;
558} 558}
559 559
560static int __devexit sh7760fb_remove(struct platform_device *dev) 560static int sh7760fb_remove(struct platform_device *dev)
561{ 561{
562 struct fb_info *info = platform_get_drvdata(dev); 562 struct fb_info *info = platform_get_drvdata(dev);
563 struct sh7760fb_par *par = info->par; 563 struct sh7760fb_par *par = info->par;
@@ -582,7 +582,7 @@ static struct platform_driver sh7760_lcdc_driver = {
582 .owner = THIS_MODULE, 582 .owner = THIS_MODULE,
583 }, 583 },
584 .probe = sh7760fb_probe, 584 .probe = sh7760fb_probe,
585 .remove = __devexit_p(sh7760fb_remove), 585 .remove = sh7760fb_remove,
586}; 586};
587 587
588module_platform_driver(sh7760_lcdc_driver); 588module_platform_driver(sh7760_lcdc_driver);
diff --git a/drivers/video/sh_mipi_dsi.c b/drivers/video/sh_mipi_dsi.c
index f4962292792c..701b461cf8a9 100644
--- a/drivers/video/sh_mipi_dsi.c
+++ b/drivers/video/sh_mipi_dsi.c
@@ -533,7 +533,7 @@ efindslot:
533 return ret; 533 return ret;
534} 534}
535 535
536static int __devexit sh_mipi_remove(struct platform_device *pdev) 536static int sh_mipi_remove(struct platform_device *pdev)
537{ 537{
538 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 538 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
539 struct resource *res2 = platform_get_resource(pdev, IORESOURCE_MEM, 1); 539 struct resource *res2 = platform_get_resource(pdev, IORESOURCE_MEM, 1);
@@ -574,7 +574,7 @@ static int __devexit sh_mipi_remove(struct platform_device *pdev)
574} 574}
575 575
576static struct platform_driver sh_mipi_driver = { 576static struct platform_driver sh_mipi_driver = {
577 .remove = __devexit_p(sh_mipi_remove), 577 .remove = sh_mipi_remove,
578 .shutdown = sh_mipi_shutdown, 578 .shutdown = sh_mipi_shutdown,
579 .driver = { 579 .driver = {
580 .name = "sh-mipi-dsi", 580 .name = "sh-mipi-dsi",
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index e78fe4bc1524..63203acef812 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -1649,7 +1649,7 @@ sh_mobile_lcdc_overlay_fb_unregister(struct sh_mobile_lcdc_overlay *ovl)
1649 unregister_framebuffer(ovl->info); 1649 unregister_framebuffer(ovl->info);
1650} 1650}
1651 1651
1652static int __devinit 1652static int
1653sh_mobile_lcdc_overlay_fb_register(struct sh_mobile_lcdc_overlay *ovl) 1653sh_mobile_lcdc_overlay_fb_register(struct sh_mobile_lcdc_overlay *ovl)
1654{ 1654{
1655 struct sh_mobile_lcdc_priv *lcdc = ovl->channel->lcdc; 1655 struct sh_mobile_lcdc_priv *lcdc = ovl->channel->lcdc;
@@ -1688,7 +1688,7 @@ sh_mobile_lcdc_overlay_fb_cleanup(struct sh_mobile_lcdc_overlay *ovl)
1688 framebuffer_release(info); 1688 framebuffer_release(info);
1689} 1689}
1690 1690
1691static int __devinit 1691static int
1692sh_mobile_lcdc_overlay_fb_init(struct sh_mobile_lcdc_overlay *ovl) 1692sh_mobile_lcdc_overlay_fb_init(struct sh_mobile_lcdc_overlay *ovl)
1693{ 1693{
1694 struct sh_mobile_lcdc_priv *priv = ovl->channel->lcdc; 1694 struct sh_mobile_lcdc_priv *priv = ovl->channel->lcdc;
@@ -2137,7 +2137,7 @@ sh_mobile_lcdc_channel_fb_unregister(struct sh_mobile_lcdc_chan *ch)
2137 unregister_framebuffer(ch->info); 2137 unregister_framebuffer(ch->info);
2138} 2138}
2139 2139
2140static int __devinit 2140static int
2141sh_mobile_lcdc_channel_fb_register(struct sh_mobile_lcdc_chan *ch) 2141sh_mobile_lcdc_channel_fb_register(struct sh_mobile_lcdc_chan *ch)
2142{ 2142{
2143 struct fb_info *info = ch->info; 2143 struct fb_info *info = ch->info;
@@ -2185,7 +2185,7 @@ sh_mobile_lcdc_channel_fb_cleanup(struct sh_mobile_lcdc_chan *ch)
2185 framebuffer_release(info); 2185 framebuffer_release(info);
2186} 2186}
2187 2187
2188static int __devinit 2188static int
2189sh_mobile_lcdc_channel_fb_init(struct sh_mobile_lcdc_chan *ch, 2189sh_mobile_lcdc_channel_fb_init(struct sh_mobile_lcdc_chan *ch,
2190 const struct fb_videomode *modes, 2190 const struct fb_videomode *modes,
2191 unsigned int num_modes) 2191 unsigned int num_modes)
@@ -2417,7 +2417,7 @@ static int sh_mobile_lcdc_notify(struct notifier_block *nb,
2417 * Probe/remove and driver init/exit 2417 * Probe/remove and driver init/exit
2418 */ 2418 */
2419 2419
2420static const struct fb_videomode default_720p __devinitconst = { 2420static const struct fb_videomode default_720p = {
2421 .name = "HDMI 720p", 2421 .name = "HDMI 720p",
2422 .xres = 1280, 2422 .xres = 1280,
2423 .yres = 720, 2423 .yres = 720,
@@ -2496,7 +2496,7 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
2496 return 0; 2496 return 0;
2497} 2497}
2498 2498
2499static int __devinit sh_mobile_lcdc_check_interface(struct sh_mobile_lcdc_chan *ch) 2499static int sh_mobile_lcdc_check_interface(struct sh_mobile_lcdc_chan *ch)
2500{ 2500{
2501 int interface_type = ch->cfg->interface_type; 2501 int interface_type = ch->cfg->interface_type;
2502 2502
@@ -2536,7 +2536,7 @@ static int __devinit sh_mobile_lcdc_check_interface(struct sh_mobile_lcdc_chan *
2536 return 0; 2536 return 0;
2537} 2537}
2538 2538
2539static int __devinit 2539static int
2540sh_mobile_lcdc_overlay_init(struct sh_mobile_lcdc_overlay *ovl) 2540sh_mobile_lcdc_overlay_init(struct sh_mobile_lcdc_overlay *ovl)
2541{ 2541{
2542 const struct sh_mobile_lcdc_format_info *format; 2542 const struct sh_mobile_lcdc_format_info *format;
@@ -2591,7 +2591,7 @@ sh_mobile_lcdc_overlay_init(struct sh_mobile_lcdc_overlay *ovl)
2591 return 0; 2591 return 0;
2592} 2592}
2593 2593
2594static int __devinit 2594static int
2595sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch) 2595sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch)
2596{ 2596{
2597 const struct sh_mobile_lcdc_format_info *format; 2597 const struct sh_mobile_lcdc_format_info *format;
@@ -2695,7 +2695,7 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch)
2695 return sh_mobile_lcdc_channel_fb_init(ch, mode, num_modes); 2695 return sh_mobile_lcdc_channel_fb_init(ch, mode, num_modes);
2696} 2696}
2697 2697
2698static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev) 2698static int sh_mobile_lcdc_probe(struct platform_device *pdev)
2699{ 2699{
2700 struct sh_mobile_lcdc_info *pdata = pdev->dev.platform_data; 2700 struct sh_mobile_lcdc_info *pdata = pdev->dev.platform_data;
2701 struct sh_mobile_lcdc_priv *priv; 2701 struct sh_mobile_lcdc_priv *priv;
diff --git a/drivers/video/sh_mobile_meram.c b/drivers/video/sh_mobile_meram.c
index 7a0ba8bb3fbe..e0f098562a74 100644
--- a/drivers/video/sh_mobile_meram.c
+++ b/drivers/video/sh_mobile_meram.c
@@ -620,7 +620,7 @@ static UNIVERSAL_DEV_PM_OPS(sh_mobile_meram_dev_pm_ops,
620 * Probe/remove and driver init/exit 620 * Probe/remove and driver init/exit
621 */ 621 */
622 622
623static int __devinit sh_mobile_meram_probe(struct platform_device *pdev) 623static int sh_mobile_meram_probe(struct platform_device *pdev)
624{ 624{
625 struct sh_mobile_meram_priv *priv; 625 struct sh_mobile_meram_priv *priv;
626 struct sh_mobile_meram_info *pdata = pdev->dev.platform_data; 626 struct sh_mobile_meram_info *pdata = pdev->dev.platform_data;
diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c
index a7a48db64ce2..977e27927a21 100644
--- a/drivers/video/sis/sis_main.c
+++ b/drivers/video/sis/sis_main.c
@@ -106,8 +106,7 @@ sisfb_setdefaultparms(void)
106 106
107/* ------------- Parameter parsing -------------- */ 107/* ------------- Parameter parsing -------------- */
108 108
109static void __devinit 109static void sisfb_search_vesamode(unsigned int vesamode, bool quiet)
110sisfb_search_vesamode(unsigned int vesamode, bool quiet)
111{ 110{
112 int i = 0, j = 0; 111 int i = 0, j = 0;
113 112
@@ -146,8 +145,7 @@ sisfb_search_vesamode(unsigned int vesamode, bool quiet)
146 printk(KERN_ERR "sisfb: Invalid VESA mode 0x%x'\n", vesamode); 145 printk(KERN_ERR "sisfb: Invalid VESA mode 0x%x'\n", vesamode);
147} 146}
148 147
149static void __devinit 148static void sisfb_search_mode(char *name, bool quiet)
150sisfb_search_mode(char *name, bool quiet)
151{ 149{
152 unsigned int j = 0, xres = 0, yres = 0, depth = 0, rate = 0; 150 unsigned int j = 0, xres = 0, yres = 0, depth = 0, rate = 0;
153 int i = 0; 151 int i = 0;
@@ -225,8 +223,7 @@ sisfb_search_mode(char *name, bool quiet)
225} 223}
226 224
227#ifndef MODULE 225#ifndef MODULE
228static void __devinit 226static void sisfb_get_vga_mode_from_kernel(void)
229sisfb_get_vga_mode_from_kernel(void)
230{ 227{
231#ifdef CONFIG_X86 228#ifdef CONFIG_X86
232 char mymode[32]; 229 char mymode[32];
@@ -345,8 +342,7 @@ sisfb_search_specialtiming(const char *name)
345 342
346/* ----------- Various detection routines ----------- */ 343/* ----------- Various detection routines ----------- */
347 344
348static void __devinit 345static void sisfb_detect_custom_timing(struct sis_video_info *ivideo)
349sisfb_detect_custom_timing(struct sis_video_info *ivideo)
350{ 346{
351 unsigned char *biosver = NULL; 347 unsigned char *biosver = NULL;
352 unsigned char *biosdate = NULL; 348 unsigned char *biosdate = NULL;
@@ -403,8 +399,7 @@ sisfb_detect_custom_timing(struct sis_video_info *ivideo)
403 } while(mycustomttable[i].chipID); 399 } while(mycustomttable[i].chipID);
404} 400}
405 401
406static bool __devinit 402static bool sisfb_interpret_edid(struct sisfb_monitor *monitor, u8 *buffer)
407sisfb_interpret_edid(struct sisfb_monitor *monitor, u8 *buffer)
408{ 403{
409 int i, j, xres, yres, refresh, index; 404 int i, j, xres, yres, refresh, index;
410 u32 emodes; 405 u32 emodes;
@@ -505,8 +500,8 @@ sisfb_interpret_edid(struct sisfb_monitor *monitor, u8 *buffer)
505 return monitor->datavalid; 500 return monitor->datavalid;
506} 501}
507 502
508static void __devinit 503static void sisfb_handle_ddc(struct sis_video_info *ivideo,
509sisfb_handle_ddc(struct sis_video_info *ivideo, struct sisfb_monitor *monitor, int crtno) 504 struct sisfb_monitor *monitor, int crtno)
510{ 505{
511 unsigned short temp, i, realcrtno = crtno; 506 unsigned short temp, i, realcrtno = crtno;
512 unsigned char buffer[256]; 507 unsigned char buffer[256];
@@ -1898,8 +1893,7 @@ static struct fb_ops sisfb_ops = {
1898 1893
1899/* ---------------- Chip generation dependent routines ---------------- */ 1894/* ---------------- Chip generation dependent routines ---------------- */
1900 1895
1901static struct pci_dev * __devinit 1896static struct pci_dev *sisfb_get_northbridge(int basechipid)
1902sisfb_get_northbridge(int basechipid)
1903{ 1897{
1904 struct pci_dev *pdev = NULL; 1898 struct pci_dev *pdev = NULL;
1905 int nbridgenum, nbridgeidx, i; 1899 int nbridgenum, nbridgeidx, i;
@@ -1938,8 +1932,7 @@ sisfb_get_northbridge(int basechipid)
1938 return pdev; 1932 return pdev;
1939} 1933}
1940 1934
1941static int __devinit 1935static int sisfb_get_dram_size(struct sis_video_info *ivideo)
1942sisfb_get_dram_size(struct sis_video_info *ivideo)
1943{ 1936{
1944#if defined(CONFIG_FB_SIS_300) || defined(CONFIG_FB_SIS_315) 1937#if defined(CONFIG_FB_SIS_300) || defined(CONFIG_FB_SIS_315)
1945 u8 reg; 1938 u8 reg;
@@ -2038,8 +2031,7 @@ sisfb_get_dram_size(struct sis_video_info *ivideo)
2038 2031
2039/* -------------- video bridge device detection --------------- */ 2032/* -------------- video bridge device detection --------------- */
2040 2033
2041static void __devinit 2034static void sisfb_detect_VB_connect(struct sis_video_info *ivideo)
2042sisfb_detect_VB_connect(struct sis_video_info *ivideo)
2043{ 2035{
2044 u8 cr32, temp; 2036 u8 cr32, temp;
2045 2037
@@ -2164,8 +2156,7 @@ sisfb_detect_VB_connect(struct sis_video_info *ivideo)
2164 2156
2165/* ------------------ Sensing routines ------------------ */ 2157/* ------------------ Sensing routines ------------------ */
2166 2158
2167static bool __devinit 2159static bool sisfb_test_DDC1(struct sis_video_info *ivideo)
2168sisfb_test_DDC1(struct sis_video_info *ivideo)
2169{ 2160{
2170 unsigned short old; 2161 unsigned short old;
2171 int count = 48; 2162 int count = 48;
@@ -2177,8 +2168,7 @@ sisfb_test_DDC1(struct sis_video_info *ivideo)
2177 return (count != -1); 2168 return (count != -1);
2178} 2169}
2179 2170
2180static void __devinit 2171static void sisfb_sense_crt1(struct sis_video_info *ivideo)
2181sisfb_sense_crt1(struct sis_video_info *ivideo)
2182{ 2172{
2183 bool mustwait = false; 2173 bool mustwait = false;
2184 u8 sr1F, cr17; 2174 u8 sr1F, cr17;
@@ -2259,8 +2249,7 @@ sisfb_sense_crt1(struct sis_video_info *ivideo)
2259} 2249}
2260 2250
2261/* Determine and detect attached devices on SiS30x */ 2251/* Determine and detect attached devices on SiS30x */
2262static void __devinit 2252static void SiS_SenseLCD(struct sis_video_info *ivideo)
2263SiS_SenseLCD(struct sis_video_info *ivideo)
2264{ 2253{
2265 unsigned char buffer[256]; 2254 unsigned char buffer[256];
2266 unsigned short temp, realcrtno, i; 2255 unsigned short temp, realcrtno, i;
@@ -2347,8 +2336,7 @@ SiS_SenseLCD(struct sis_video_info *ivideo)
2347 ivideo->SiS_Pr.PanelSelfDetected = true; 2336 ivideo->SiS_Pr.PanelSelfDetected = true;
2348} 2337}
2349 2338
2350static int __devinit 2339static int SISDoSense(struct sis_video_info *ivideo, u16 type, u16 test)
2351SISDoSense(struct sis_video_info *ivideo, u16 type, u16 test)
2352{ 2340{
2353 int temp, mytest, result, i, j; 2341 int temp, mytest, result, i, j;
2354 2342
@@ -2377,8 +2365,7 @@ SISDoSense(struct sis_video_info *ivideo, u16 type, u16 test)
2377 return result; 2365 return result;
2378} 2366}
2379 2367
2380static void __devinit 2368static void SiS_Sense30x(struct sis_video_info *ivideo)
2381SiS_Sense30x(struct sis_video_info *ivideo)
2382{ 2369{
2383 u8 backupP4_0d,backupP2_00,backupP2_4d,backupSR_1e,biosflag=0; 2370 u8 backupP4_0d,backupP2_00,backupP2_4d,backupSR_1e,biosflag=0;
2384 u16 svhs=0, svhs_c=0; 2371 u16 svhs=0, svhs_c=0;
@@ -2518,8 +2505,7 @@ SiS_Sense30x(struct sis_video_info *ivideo)
2518} 2505}
2519 2506
2520/* Determine and detect attached TV's on Chrontel */ 2507/* Determine and detect attached TV's on Chrontel */
2521static void __devinit 2508static void SiS_SenseCh(struct sis_video_info *ivideo)
2522SiS_SenseCh(struct sis_video_info *ivideo)
2523{ 2509{
2524#if defined(CONFIG_FB_SIS_300) || defined(CONFIG_FB_SIS_315) 2510#if defined(CONFIG_FB_SIS_300) || defined(CONFIG_FB_SIS_315)
2525 u8 temp1, temp2; 2511 u8 temp1, temp2;
@@ -2643,8 +2629,7 @@ SiS_SenseCh(struct sis_video_info *ivideo)
2643 } 2629 }
2644} 2630}
2645 2631
2646static void __devinit 2632static void sisfb_get_VB_type(struct sis_video_info *ivideo)
2647sisfb_get_VB_type(struct sis_video_info *ivideo)
2648{ 2633{
2649 char stdstr[] = "sisfb: Detected"; 2634 char stdstr[] = "sisfb: Detected";
2650 char bridgestr[] = "video bridge"; 2635 char bridgestr[] = "video bridge";
@@ -2906,8 +2891,7 @@ sisfb_engine_init(struct sis_video_info *ivideo)
2906 ivideo->engineok = 1; 2891 ivideo->engineok = 1;
2907} 2892}
2908 2893
2909static void __devinit 2894static void sisfb_detect_lcd_type(struct sis_video_info *ivideo)
2910sisfb_detect_lcd_type(struct sis_video_info *ivideo)
2911{ 2895{
2912 u8 reg; 2896 u8 reg;
2913 int i; 2897 int i;
@@ -2962,8 +2946,7 @@ sisfb_detect_lcd_type(struct sis_video_info *ivideo)
2962 ivideo->lcdxres, ivideo->lcdyres); 2946 ivideo->lcdxres, ivideo->lcdyres);
2963} 2947}
2964 2948
2965static void __devinit 2949static void sisfb_save_pdc_emi(struct sis_video_info *ivideo)
2966sisfb_save_pdc_emi(struct sis_video_info *ivideo)
2967{ 2950{
2968#ifdef CONFIG_FB_SIS_300 2951#ifdef CONFIG_FB_SIS_300
2969 /* Save the current PanelDelayCompensation if the LCD is currently used */ 2952 /* Save the current PanelDelayCompensation if the LCD is currently used */
@@ -3081,8 +3064,7 @@ sisfb_save_pdc_emi(struct sis_video_info *ivideo)
3081 3064
3082/* -------------------- Memory manager routines ---------------------- */ 3065/* -------------------- Memory manager routines ---------------------- */
3083 3066
3084static u32 __devinit 3067static u32 sisfb_getheapstart(struct sis_video_info *ivideo)
3085sisfb_getheapstart(struct sis_video_info *ivideo)
3086{ 3068{
3087 u32 ret = ivideo->sisfb_parm_mem * 1024; 3069 u32 ret = ivideo->sisfb_parm_mem * 1024;
3088 u32 maxoffs = ivideo->video_size - ivideo->hwcursor_size - ivideo->cmdQueueSize; 3070 u32 maxoffs = ivideo->video_size - ivideo->hwcursor_size - ivideo->cmdQueueSize;
@@ -3128,8 +3110,7 @@ sisfb_getheapstart(struct sis_video_info *ivideo)
3128 return ret; 3110 return ret;
3129} 3111}
3130 3112
3131static u32 __devinit 3113static u32 sisfb_getheapsize(struct sis_video_info *ivideo)
3132sisfb_getheapsize(struct sis_video_info *ivideo)
3133{ 3114{
3134 u32 max = ivideo->video_size - ivideo->hwcursor_size - ivideo->cmdQueueSize; 3115 u32 max = ivideo->video_size - ivideo->hwcursor_size - ivideo->cmdQueueSize;
3135 u32 ret = 0; 3116 u32 ret = 0;
@@ -3154,8 +3135,7 @@ sisfb_getheapsize(struct sis_video_info *ivideo)
3154 return ret; 3135 return ret;
3155} 3136}
3156 3137
3157static int __devinit 3138static int sisfb_heap_init(struct sis_video_info *ivideo)
3158sisfb_heap_init(struct sis_video_info *ivideo)
3159{ 3139{
3160 struct SIS_OH *poh; 3140 struct SIS_OH *poh;
3161 3141
@@ -4061,8 +4041,8 @@ static int __init sisfb_setup(char *options)
4061} 4041}
4062#endif 4042#endif
4063 4043
4064static int __devinit 4044static int sisfb_check_rom(void __iomem *rom_base,
4065sisfb_check_rom(void __iomem *rom_base, struct sis_video_info *ivideo) 4045 struct sis_video_info *ivideo)
4066{ 4046{
4067 void __iomem *rom; 4047 void __iomem *rom;
4068 int romptr; 4048 int romptr;
@@ -4089,8 +4069,7 @@ sisfb_check_rom(void __iomem *rom_base, struct sis_video_info *ivideo)
4089 return 1; 4069 return 1;
4090} 4070}
4091 4071
4092static unsigned char * __devinit 4072static unsigned char *sisfb_find_rom(struct pci_dev *pdev)
4093sisfb_find_rom(struct pci_dev *pdev)
4094{ 4073{
4095 struct sis_video_info *ivideo = pci_get_drvdata(pdev); 4074 struct sis_video_info *ivideo = pci_get_drvdata(pdev);
4096 void __iomem *rom_base; 4075 void __iomem *rom_base;
@@ -4149,9 +4128,8 @@ sisfb_find_rom(struct pci_dev *pdev)
4149 return myrombase; 4128 return myrombase;
4150} 4129}
4151 4130
4152static void __devinit 4131static void sisfb_post_map_vram(struct sis_video_info *ivideo,
4153sisfb_post_map_vram(struct sis_video_info *ivideo, unsigned int *mapsize, 4132 unsigned int *mapsize, unsigned int min)
4154 unsigned int min)
4155{ 4133{
4156 if (*mapsize < (min << 20)) 4134 if (*mapsize < (min << 20))
4157 return; 4135 return;
@@ -4176,8 +4154,7 @@ sisfb_post_map_vram(struct sis_video_info *ivideo, unsigned int *mapsize,
4176} 4154}
4177 4155
4178#ifdef CONFIG_FB_SIS_300 4156#ifdef CONFIG_FB_SIS_300
4179static int __devinit 4157static int sisfb_post_300_buswidth(struct sis_video_info *ivideo)
4180sisfb_post_300_buswidth(struct sis_video_info *ivideo)
4181{ 4158{
4182 void __iomem *FBAddress = ivideo->video_vbase; 4159 void __iomem *FBAddress = ivideo->video_vbase;
4183 unsigned short temp; 4160 unsigned short temp;
@@ -4222,7 +4199,7 @@ sisfb_post_300_buswidth(struct sis_video_info *ivideo)
4222 return 1; /* 32bit */ 4199 return 1; /* 32bit */
4223} 4200}
4224 4201
4225static const unsigned short __devinitconst SiS_DRAMType[17][5] = { 4202static const unsigned short SiS_DRAMType[17][5] = {
4226 {0x0C,0x0A,0x02,0x40,0x39}, 4203 {0x0C,0x0A,0x02,0x40,0x39},
4227 {0x0D,0x0A,0x01,0x40,0x48}, 4204 {0x0D,0x0A,0x01,0x40,0x48},
4228 {0x0C,0x09,0x02,0x20,0x35}, 4205 {0x0C,0x09,0x02,0x20,0x35},
@@ -4242,10 +4219,9 @@ static const unsigned short __devinitconst SiS_DRAMType[17][5] = {
4242 {0x09,0x08,0x01,0x01,0x00} 4219 {0x09,0x08,0x01,0x01,0x00}
4243}; 4220};
4244 4221
4245static int __devinit 4222static int sisfb_post_300_rwtest(struct sis_video_info *ivideo, int iteration,
4246sisfb_post_300_rwtest(struct sis_video_info *ivideo, int iteration, int buswidth, 4223 int buswidth, int PseudoRankCapacity,
4247 int PseudoRankCapacity, int PseudoAdrPinCount, 4224 int PseudoAdrPinCount, unsigned int mapsize)
4248 unsigned int mapsize)
4249{ 4225{
4250 void __iomem *FBAddr = ivideo->video_vbase; 4226 void __iomem *FBAddr = ivideo->video_vbase;
4251 unsigned short sr14; 4227 unsigned short sr14;
@@ -4309,8 +4285,7 @@ sisfb_post_300_rwtest(struct sis_video_info *ivideo, int iteration, int buswidth
4309 return 0; 4285 return 0;
4310} 4286}
4311 4287
4312static void __devinit 4288static void sisfb_post_300_ramsize(struct pci_dev *pdev, unsigned int mapsize)
4313sisfb_post_300_ramsize(struct pci_dev *pdev, unsigned int mapsize)
4314{ 4289{
4315 struct sis_video_info *ivideo = pci_get_drvdata(pdev); 4290 struct sis_video_info *ivideo = pci_get_drvdata(pdev);
4316 int i, j, buswidth; 4291 int i, j, buswidth;
@@ -4335,8 +4310,7 @@ sisfb_post_300_ramsize(struct pci_dev *pdev, unsigned int mapsize)
4335 } 4310 }
4336} 4311}
4337 4312
4338static void __devinit 4313static void sisfb_post_sis300(struct pci_dev *pdev)
4339sisfb_post_sis300(struct pci_dev *pdev)
4340{ 4314{
4341 struct sis_video_info *ivideo = pci_get_drvdata(pdev); 4315 struct sis_video_info *ivideo = pci_get_drvdata(pdev);
4342 unsigned char *bios = ivideo->SiS_Pr.VirtualRomBase; 4316 unsigned char *bios = ivideo->SiS_Pr.VirtualRomBase;
@@ -4547,8 +4521,7 @@ sisfb_post_sis300(struct pci_dev *pdev)
4547 4521
4548#ifdef CONFIG_FB_SIS_315 4522#ifdef CONFIG_FB_SIS_315
4549#if 0 4523#if 0
4550static void __devinit 4524static void sisfb_post_sis315330(struct pci_dev *pdev)
4551sisfb_post_sis315330(struct pci_dev *pdev)
4552{ 4525{
4553 /* TODO */ 4526 /* TODO */
4554} 4527}
@@ -4559,8 +4532,7 @@ static inline int sisfb_xgi_is21(struct sis_video_info *ivideo)
4559 return ivideo->chip_real_id == XGI_21; 4532 return ivideo->chip_real_id == XGI_21;
4560} 4533}
4561 4534
4562static void __devinit 4535static void sisfb_post_xgi_delay(struct sis_video_info *ivideo, int delay)
4563sisfb_post_xgi_delay(struct sis_video_info *ivideo, int delay)
4564{ 4536{
4565 unsigned int i; 4537 unsigned int i;
4566 u8 reg; 4538 u8 reg;
@@ -4571,9 +4543,9 @@ sisfb_post_xgi_delay(struct sis_video_info *ivideo, int delay)
4571 } 4543 }
4572} 4544}
4573 4545
4574static int __devinit 4546static int sisfb_find_host_bridge(struct sis_video_info *ivideo,
4575sisfb_find_host_bridge(struct sis_video_info *ivideo, struct pci_dev *mypdev, 4547 struct pci_dev *mypdev,
4576 unsigned short pcivendor) 4548 unsigned short pcivendor)
4577{ 4549{
4578 struct pci_dev *pdev = NULL; 4550 struct pci_dev *pdev = NULL;
4579 unsigned short temp; 4551 unsigned short temp;
@@ -4591,9 +4563,8 @@ sisfb_find_host_bridge(struct sis_video_info *ivideo, struct pci_dev *mypdev,
4591 return ret; 4563 return ret;
4592} 4564}
4593 4565
4594static int __devinit 4566static int sisfb_post_xgi_rwtest(struct sis_video_info *ivideo, int starta,
4595sisfb_post_xgi_rwtest(struct sis_video_info *ivideo, int starta, 4567 unsigned int enda, unsigned int mapsize)
4596 unsigned int enda, unsigned int mapsize)
4597{ 4568{
4598 unsigned int pos; 4569 unsigned int pos;
4599 int i; 4570 int i;
@@ -4623,8 +4594,7 @@ sisfb_post_xgi_rwtest(struct sis_video_info *ivideo, int starta,
4623 return 1; 4594 return 1;
4624} 4595}
4625 4596
4626static int __devinit 4597static int sisfb_post_xgi_ramsize(struct sis_video_info *ivideo)
4627sisfb_post_xgi_ramsize(struct sis_video_info *ivideo)
4628{ 4598{
4629 unsigned int buswidth, ranksize, channelab, mapsize; 4599 unsigned int buswidth, ranksize, channelab, mapsize;
4630 int i, j, k, l, status; 4600 int i, j, k, l, status;
@@ -4876,8 +4846,7 @@ bail_out:
4876 return status; 4846 return status;
4877} 4847}
4878 4848
4879static void __devinit 4849static void sisfb_post_xgi_setclocks(struct sis_video_info *ivideo, u8 regb)
4880sisfb_post_xgi_setclocks(struct sis_video_info *ivideo, u8 regb)
4881{ 4850{
4882 u8 v1, v2, v3; 4851 u8 v1, v2, v3;
4883 int index; 4852 int index;
@@ -4932,8 +4901,8 @@ sisfb_post_xgi_setclocks(struct sis_video_info *ivideo, u8 regb)
4932 sisfb_post_xgi_delay(ivideo, 0x43); 4901 sisfb_post_xgi_delay(ivideo, 0x43);
4933} 4902}
4934 4903
4935static void __devinit 4904static void sisfb_post_xgi_ddr2_mrs_default(struct sis_video_info *ivideo,
4936sisfb_post_xgi_ddr2_mrs_default(struct sis_video_info *ivideo, u8 regb) 4905 u8 regb)
4937{ 4906{
4938 unsigned char *bios = ivideo->bios_abase; 4907 unsigned char *bios = ivideo->bios_abase;
4939 u8 v1; 4908 u8 v1;
@@ -4973,8 +4942,7 @@ sisfb_post_xgi_ddr2_mrs_default(struct sis_video_info *ivideo, u8 regb)
4973 sisfb_post_xgi_delay(ivideo, 1); 4942 sisfb_post_xgi_delay(ivideo, 1);
4974} 4943}
4975 4944
4976static void __devinit 4945static void sisfb_post_xgi_ddr2_mrs_xg21(struct sis_video_info *ivideo)
4977sisfb_post_xgi_ddr2_mrs_xg21(struct sis_video_info *ivideo)
4978{ 4946{
4979 sisfb_post_xgi_setclocks(ivideo, 1); 4947 sisfb_post_xgi_setclocks(ivideo, 1);
4980 4948
@@ -5015,8 +4983,7 @@ sisfb_post_xgi_ddr2_mrs_xg21(struct sis_video_info *ivideo)
5015 sisfb_post_xgi_delay(ivideo, 1); 4983 sisfb_post_xgi_delay(ivideo, 1);
5016} 4984}
5017 4985
5018static void __devinit 4986static void sisfb_post_xgi_ddr2(struct sis_video_info *ivideo, u8 regb)
5019sisfb_post_xgi_ddr2(struct sis_video_info *ivideo, u8 regb)
5020{ 4987{
5021 unsigned char *bios = ivideo->bios_abase; 4988 unsigned char *bios = ivideo->bios_abase;
5022 static const u8 cs158[8] = { 4989 static const u8 cs158[8] = {
@@ -5061,8 +5028,7 @@ sisfb_post_xgi_ddr2(struct sis_video_info *ivideo, u8 regb)
5061 sisfb_post_xgi_ddr2_mrs_default(ivideo, regb); 5028 sisfb_post_xgi_ddr2_mrs_default(ivideo, regb);
5062} 5029}
5063 5030
5064static u8 __devinit 5031static u8 sisfb_post_xgi_ramtype(struct sis_video_info *ivideo)
5065sisfb_post_xgi_ramtype(struct sis_video_info *ivideo)
5066{ 5032{
5067 unsigned char *bios = ivideo->bios_abase; 5033 unsigned char *bios = ivideo->bios_abase;
5068 u8 ramtype; 5034 u8 ramtype;
@@ -5101,8 +5067,7 @@ sisfb_post_xgi_ramtype(struct sis_video_info *ivideo)
5101 return ramtype; 5067 return ramtype;
5102} 5068}
5103 5069
5104static int __devinit 5070static int sisfb_post_xgi(struct pci_dev *pdev)
5105sisfb_post_xgi(struct pci_dev *pdev)
5106{ 5071{
5107 struct sis_video_info *ivideo = pci_get_drvdata(pdev); 5072 struct sis_video_info *ivideo = pci_get_drvdata(pdev);
5108 unsigned char *bios = ivideo->bios_abase; 5073 unsigned char *bios = ivideo->bios_abase;
@@ -5839,8 +5804,7 @@ sisfb_post_xgi(struct pci_dev *pdev)
5839} 5804}
5840#endif 5805#endif
5841 5806
5842static int __devinit 5807static int sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
5843sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
5844{ 5808{
5845 struct sisfb_chip_info *chipinfo = &sisfb_chip_info[ent->driver_data]; 5809 struct sisfb_chip_info *chipinfo = &sisfb_chip_info[ent->driver_data];
5846 struct sis_video_info *ivideo = NULL; 5810 struct sis_video_info *ivideo = NULL;
@@ -6530,7 +6494,7 @@ error_3: vfree(ivideo->bios_abase);
6530/* PCI DEVICE HANDLING */ 6494/* PCI DEVICE HANDLING */
6531/*****************************************************/ 6495/*****************************************************/
6532 6496
6533static void __devexit sisfb_remove(struct pci_dev *pdev) 6497static void sisfb_remove(struct pci_dev *pdev)
6534{ 6498{
6535 struct sis_video_info *ivideo = pci_get_drvdata(pdev); 6499 struct sis_video_info *ivideo = pci_get_drvdata(pdev);
6536 struct fb_info *sis_fb_info = ivideo->memyselfandi; 6500 struct fb_info *sis_fb_info = ivideo->memyselfandi;
@@ -6591,7 +6555,7 @@ static struct pci_driver sisfb_driver = {
6591 .name = "sisfb", 6555 .name = "sisfb",
6592 .id_table = sisfb_pci_table, 6556 .id_table = sisfb_pci_table,
6593 .probe = sisfb_probe, 6557 .probe = sisfb_probe,
6594 .remove = __devexit_p(sisfb_remove) 6558 .remove = sisfb_remove,
6595}; 6559};
6596 6560
6597static int __init sisfb_init(void) 6561static int __init sisfb_init(void)
diff --git a/drivers/video/sis/sis_main.h b/drivers/video/sis/sis_main.h
index 9540e977270e..32e23c209430 100644
--- a/drivers/video/sis/sis_main.h
+++ b/drivers/video/sis/sis_main.h
@@ -98,7 +98,7 @@ static struct sisfb_chip_info {
98 int hwcursor_size; 98 int hwcursor_size;
99 int CRT2_write_enable; 99 int CRT2_write_enable;
100 const char *chip_name; 100 const char *chip_name;
101} sisfb_chip_info[] __devinitdata = { 101} sisfb_chip_info[] = {
102 { SIS_300, SIS_300_VGA, 0, HW_CURSOR_AREA_SIZE_300 * 2, SIS_CRT2_WENABLE_300, "SiS 300/305" }, 102 { SIS_300, SIS_300_VGA, 0, HW_CURSOR_AREA_SIZE_300 * 2, SIS_CRT2_WENABLE_300, "SiS 300/305" },
103 { SIS_540, SIS_300_VGA, 0, HW_CURSOR_AREA_SIZE_300 * 2, SIS_CRT2_WENABLE_300, "SiS 540" }, 103 { SIS_540, SIS_300_VGA, 0, HW_CURSOR_AREA_SIZE_300 * 2, SIS_CRT2_WENABLE_300, "SiS 540" },
104 { SIS_630, SIS_300_VGA, 0, HW_CURSOR_AREA_SIZE_300 * 2, SIS_CRT2_WENABLE_300, "SiS 630" }, 104 { SIS_630, SIS_300_VGA, 0, HW_CURSOR_AREA_SIZE_300 * 2, SIS_CRT2_WENABLE_300, "SiS 630" },
@@ -113,7 +113,7 @@ static struct sisfb_chip_info {
113 { XGI_40, SIS_315_VGA, 1, HW_CURSOR_AREA_SIZE_315 * 4, SIS_CRT2_WENABLE_315, "XGI V3XT/V5/V8" }, 113 { XGI_40, SIS_315_VGA, 1, HW_CURSOR_AREA_SIZE_315 * 4, SIS_CRT2_WENABLE_315, "XGI V3XT/V5/V8" },
114}; 114};
115 115
116static struct pci_device_id __devinitdata sisfb_pci_table[] = { 116static struct pci_device_id sisfb_pci_table[] = {
117#ifdef CONFIG_FB_SIS_300 117#ifdef CONFIG_FB_SIS_300
118 { PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 118 { PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
119 { PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_540_VGA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1}, 119 { PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_540_VGA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
@@ -317,7 +317,7 @@ static struct _sis_lcd_data {
317 u16 xres; 317 u16 xres;
318 u16 yres; 318 u16 yres;
319 u8 default_mode_idx; 319 u8 default_mode_idx;
320} sis_lcd_data[] __devinitdata = { 320} sis_lcd_data[] = {
321 { LCD_640x480, 640, 480, 23 }, 321 { LCD_640x480, 640, 480, 23 },
322 { LCD_800x600, 800, 600, 43 }, 322 { LCD_800x600, 800, 600, 43 },
323 { LCD_1024x600, 1024, 600, 67 }, 323 { LCD_1024x600, 1024, 600, 67 },
@@ -339,21 +339,21 @@ static struct _sis_lcd_data {
339}; 339};
340 340
341/* CR36 evaluation */ 341/* CR36 evaluation */
342static unsigned short sis300paneltype[] __devinitdata = { 342static unsigned short sis300paneltype[] = {
343 LCD_UNKNOWN, LCD_800x600, LCD_1024x768, LCD_1280x1024, 343 LCD_UNKNOWN, LCD_800x600, LCD_1024x768, LCD_1280x1024,
344 LCD_1280x960, LCD_640x480, LCD_1024x600, LCD_1152x768, 344 LCD_1280x960, LCD_640x480, LCD_1024x600, LCD_1152x768,
345 LCD_UNKNOWN, LCD_UNKNOWN, LCD_UNKNOWN, LCD_UNKNOWN, 345 LCD_UNKNOWN, LCD_UNKNOWN, LCD_UNKNOWN, LCD_UNKNOWN,
346 LCD_UNKNOWN, LCD_UNKNOWN, LCD_UNKNOWN, LCD_UNKNOWN 346 LCD_UNKNOWN, LCD_UNKNOWN, LCD_UNKNOWN, LCD_UNKNOWN
347}; 347};
348 348
349static unsigned short sis310paneltype[] __devinitdata = { 349static unsigned short sis310paneltype[] = {
350 LCD_UNKNOWN, LCD_800x600, LCD_1024x768, LCD_1280x1024, 350 LCD_UNKNOWN, LCD_800x600, LCD_1024x768, LCD_1280x1024,
351 LCD_640x480, LCD_1024x600, LCD_1152x864, LCD_1280x960, 351 LCD_640x480, LCD_1024x600, LCD_1152x864, LCD_1280x960,
352 LCD_1152x768, LCD_1400x1050, LCD_1280x768, LCD_1600x1200, 352 LCD_1152x768, LCD_1400x1050, LCD_1280x768, LCD_1600x1200,
353 LCD_320x240_2, LCD_320x240_3, LCD_UNKNOWN, LCD_UNKNOWN 353 LCD_320x240_2, LCD_320x240_3, LCD_UNKNOWN, LCD_UNKNOWN
354}; 354};
355 355
356static unsigned short sis661paneltype[] __devinitdata = { 356static unsigned short sis661paneltype[] = {
357 LCD_UNKNOWN, LCD_800x600, LCD_1024x768, LCD_1280x1024, 357 LCD_UNKNOWN, LCD_800x600, LCD_1024x768, LCD_1280x1024,
358 LCD_640x480, LCD_1024x600, LCD_1152x864, LCD_1280x960, 358 LCD_640x480, LCD_1024x600, LCD_1152x864, LCD_1280x960,
359 LCD_1280x854, LCD_1400x1050, LCD_1280x768, LCD_1600x1200, 359 LCD_1280x854, LCD_1400x1050, LCD_1280x768, LCD_1600x1200,
@@ -466,7 +466,7 @@ static struct _sisfbddcsmodes {
466 u16 h; 466 u16 h;
467 u16 v; 467 u16 v;
468 u32 d; 468 u32 d;
469} sisfb_ddcsmodes[] __devinitdata = { 469} sisfb_ddcsmodes[] = {
470 { 0x10000, 67, 75, 108000}, 470 { 0x10000, 67, 75, 108000},
471 { 0x08000, 48, 72, 50000}, 471 { 0x08000, 48, 72, 50000},
472 { 0x04000, 46, 75, 49500}, 472 { 0x04000, 46, 75, 49500},
@@ -488,7 +488,7 @@ static struct _sisfbddcfmodes {
488 u16 v; 488 u16 v;
489 u16 h; 489 u16 h;
490 u32 d; 490 u32 d;
491} sisfb_ddcfmodes[] __devinitdata = { 491} sisfb_ddcfmodes[] = {
492 { 1280, 1024, 85, 92, 157500}, 492 { 1280, 1024, 85, 92, 157500},
493 { 1600, 1200, 60, 75, 162000}, 493 { 1600, 1200, 60, 75, 162000},
494 { 1600, 1200, 65, 82, 175500}, 494 { 1600, 1200, 65, 82, 175500},
@@ -505,7 +505,7 @@ static struct _chswtable {
505 u16 subsysCard; 505 u16 subsysCard;
506 char *vendorName; 506 char *vendorName;
507 char *cardName; 507 char *cardName;
508} mychswtable[] __devinitdata = { 508} mychswtable[] = {
509 { 0x1631, 0x1002, "Mitachi", "0x1002" }, 509 { 0x1631, 0x1002, "Mitachi", "0x1002" },
510 { 0x1071, 0x7521, "Mitac" , "7521P" }, 510 { 0x1071, 0x7521, "Mitac" , "7521P" },
511 { 0, 0, "" , "" } 511 { 0, 0, "" , "" }
@@ -525,7 +525,7 @@ static struct _customttable {
525 char *cardName; 525 char *cardName;
526 u32 SpecialID; 526 u32 SpecialID;
527 char *optionName; 527 char *optionName;
528} mycustomttable[] __devinitdata = { 528} mycustomttable[] = {
529 { SIS_630, "2.00.07", "09/27/2002-13:38:25", 529 { SIS_630, "2.00.07", "09/27/2002-13:38:25",
530 0x3240A8, 530 0x3240A8,
531 { 0x220, 0x227, 0x228, 0x229, 0x0ee }, 531 { 0x220, 0x227, 0x228, 0x229, 0x0ee },
diff --git a/drivers/video/skeletonfb.c b/drivers/video/skeletonfb.c
index 5b6abc6de84b..2d4694c6b9e0 100644
--- a/drivers/video/skeletonfb.c
+++ b/drivers/video/skeletonfb.c
@@ -63,7 +63,7 @@
63/* 63/*
64 * Driver data 64 * Driver data
65 */ 65 */
66static char *mode_option __devinitdata; 66static char *mode_option;
67 67
68/* 68/*
69 * If your driver supports multiple boards, you should make the 69 * If your driver supports multiple boards, you should make the
@@ -84,7 +84,7 @@ struct xxx_par;
84 * if we don't use modedb. If we do use modedb see xxxfb_init how to use it 84 * if we don't use modedb. If we do use modedb see xxxfb_init how to use it
85 * to get a fb_var_screeninfo. Otherwise define a default var as well. 85 * to get a fb_var_screeninfo. Otherwise define a default var as well.
86 */ 86 */
87static struct fb_fix_screeninfo xxxfb_fix __devinitdata = { 87static struct fb_fix_screeninfo xxxfb_fix = {
88 .id = "FB's name", 88 .id = "FB's name",
89 .type = FB_TYPE_PACKED_PIXELS, 89 .type = FB_TYPE_PACKED_PIXELS,
90 .visual = FB_VISUAL_PSEUDOCOLOR, 90 .visual = FB_VISUAL_PSEUDOCOLOR,
@@ -678,8 +678,7 @@ static struct fb_ops xxxfb_ops = {
678 */ 678 */
679 679
680/* static int __init xxfb_probe (struct platform_device *pdev) -- for platform devs */ 680/* static int __init xxfb_probe (struct platform_device *pdev) -- for platform devs */
681static int __devinit xxxfb_probe(struct pci_dev *dev, 681static int xxxfb_probe(struct pci_dev *dev, const struct pci_device_id *ent)
682 const struct pci_device_id *ent)
683{ 682{
684 struct fb_info *info; 683 struct fb_info *info;
685 struct xxx_par *par; 684 struct xxx_par *par;
@@ -705,9 +704,7 @@ static int __devinit xxxfb_probe(struct pci_dev *dev,
705 */ 704 */
706 info->screen_base = framebuffer_virtual_memory; 705 info->screen_base = framebuffer_virtual_memory;
707 info->fbops = &xxxfb_ops; 706 info->fbops = &xxxfb_ops;
708 info->fix = xxxfb_fix; /* this will be the only time xxxfb_fix will be 707 info->fix = xxxfb_fix;
709 * used, so mark it as __devinitdata
710 */
711 info->pseudo_palette = pseudo_palette; /* The pseudopalette is an 708 info->pseudo_palette = pseudo_palette; /* The pseudopalette is an
712 * 16-member array 709 * 16-member array
713 */ 710 */
@@ -836,8 +833,8 @@ static int __devinit xxxfb_probe(struct pci_dev *dev,
836 /* 833 /*
837 * Cleanup 834 * Cleanup
838 */ 835 */
839/* static void __devexit xxxfb_remove(struct platform_device *pdev) */ 836/* static void xxxfb_remove(struct platform_device *pdev) */
840static void __devexit xxxfb_remove(struct pci_dev *dev) 837static void xxxfb_remove(struct pci_dev *dev)
841{ 838{
842 struct fb_info *info = pci_get_drvdata(dev); 839 struct fb_info *info = pci_get_drvdata(dev);
843 /* or platform_get_drvdata(pdev); */ 840 /* or platform_get_drvdata(pdev); */
@@ -899,7 +896,7 @@ static struct pci_driver xxxfb_driver = {
899 .name = "xxxfb", 896 .name = "xxxfb",
900 .id_table = xxxfb_id_table, 897 .id_table = xxxfb_id_table,
901 .probe = xxxfb_probe, 898 .probe = xxxfb_probe,
902 .remove = __devexit_p(xxxfb_remove), 899 .remove = xxxfb_remove,
903 .suspend = xxxfb_suspend, /* optional but recommended */ 900 .suspend = xxxfb_suspend, /* optional but recommended */
904 .resume = xxxfb_resume, /* optional but recommended */ 901 .resume = xxxfb_resume, /* optional but recommended */
905}; 902};
diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c
index 3690effbedcc..1501979099dc 100644
--- a/drivers/video/sm501fb.c
+++ b/drivers/video/sm501fb.c
@@ -46,7 +46,7 @@
46static char *fb_mode = "640x480-16@60"; 46static char *fb_mode = "640x480-16@60";
47static unsigned long default_bpp = 16; 47static unsigned long default_bpp = 16;
48 48
49static struct fb_videomode __devinitdata sm501_default_mode = { 49static struct fb_videomode sm501_default_mode = {
50 .refresh = 60, 50 .refresh = 60,
51 .xres = 640, 51 .xres = 640,
52 .yres = 480, 52 .yres = 480,
@@ -1664,8 +1664,7 @@ static void sm501fb_stop(struct sm501fb_info *info)
1664 resource_size(info->regs_res)); 1664 resource_size(info->regs_res));
1665} 1665}
1666 1666
1667static int __devinit sm501fb_init_fb(struct fb_info *fb, 1667static int sm501fb_init_fb(struct fb_info *fb, enum sm501_controller head,
1668 enum sm501_controller head,
1669 const char *fbname) 1668 const char *fbname)
1670{ 1669{
1671 struct sm501_platdata_fbsub *pd; 1670 struct sm501_platdata_fbsub *pd;
@@ -1850,8 +1849,8 @@ static struct sm501_platdata_fb sm501fb_def_pdata = {
1850static char driver_name_crt[] = "sm501fb-crt"; 1849static char driver_name_crt[] = "sm501fb-crt";
1851static char driver_name_pnl[] = "sm501fb-panel"; 1850static char driver_name_pnl[] = "sm501fb-panel";
1852 1851
1853static int __devinit sm501fb_probe_one(struct sm501fb_info *info, 1852static int sm501fb_probe_one(struct sm501fb_info *info,
1854 enum sm501_controller head) 1853 enum sm501_controller head)
1855{ 1854{
1856 unsigned char *name = (head == HEAD_CRT) ? "crt" : "panel"; 1855 unsigned char *name = (head == HEAD_CRT) ? "crt" : "panel";
1857 struct sm501_platdata_fbsub *pd; 1856 struct sm501_platdata_fbsub *pd;
@@ -1892,9 +1891,8 @@ static void sm501_free_init_fb(struct sm501fb_info *info,
1892 fb_dealloc_cmap(&fbi->cmap); 1891 fb_dealloc_cmap(&fbi->cmap);
1893} 1892}
1894 1893
1895static int __devinit sm501fb_start_one(struct sm501fb_info *info, 1894static int sm501fb_start_one(struct sm501fb_info *info,
1896 enum sm501_controller head, 1895 enum sm501_controller head, const char *drvname)
1897 const char *drvname)
1898{ 1896{
1899 struct fb_info *fbi = info->fb[head]; 1897 struct fb_info *fbi = info->fb[head];
1900 int ret; 1898 int ret;
@@ -1922,7 +1920,7 @@ static int __devinit sm501fb_start_one(struct sm501fb_info *info,
1922 return 0; 1920 return 0;
1923} 1921}
1924 1922
1925static int __devinit sm501fb_probe(struct platform_device *pdev) 1923static int sm501fb_probe(struct platform_device *pdev)
1926{ 1924{
1927 struct sm501fb_info *info; 1925 struct sm501fb_info *info;
1928 struct device *dev = &pdev->dev; 1926 struct device *dev = &pdev->dev;
diff --git a/drivers/video/ssd1307fb.c b/drivers/video/ssd1307fb.c
index 6101f5c2f62f..395cb6a8d8f3 100644
--- a/drivers/video/ssd1307fb.c
+++ b/drivers/video/ssd1307fb.c
@@ -36,7 +36,7 @@ struct ssd1307fb_par {
36 int reset; 36 int reset;
37}; 37};
38 38
39static struct fb_fix_screeninfo ssd1307fb_fix __devinitdata = { 39static struct fb_fix_screeninfo ssd1307fb_fix = {
40 .id = "Solomon SSD1307", 40 .id = "Solomon SSD1307",
41 .type = FB_TYPE_PACKED_PIXELS, 41 .type = FB_TYPE_PACKED_PIXELS,
42 .visual = FB_VISUAL_MONO10, 42 .visual = FB_VISUAL_MONO10,
@@ -47,7 +47,7 @@ static struct fb_fix_screeninfo ssd1307fb_fix __devinitdata = {
47 .accel = FB_ACCEL_NONE, 47 .accel = FB_ACCEL_NONE,
48}; 48};
49 49
50static struct fb_var_screeninfo ssd1307fb_var __devinitdata = { 50static struct fb_var_screeninfo ssd1307fb_var = {
51 .xres = SSD1307FB_WIDTH, 51 .xres = SSD1307FB_WIDTH,
52 .yres = SSD1307FB_HEIGHT, 52 .yres = SSD1307FB_HEIGHT,
53 .xres_virtual = SSD1307FB_WIDTH, 53 .xres_virtual = SSD1307FB_WIDTH,
@@ -145,8 +145,8 @@ static void ssd1307fb_update_display(struct ssd1307fb_par *par)
145 u32 page_length = SSD1307FB_WIDTH * i; 145 u32 page_length = SSD1307FB_WIDTH * i;
146 u32 index = page_length + (SSD1307FB_WIDTH * k + j) / 8; 146 u32 index = page_length + (SSD1307FB_WIDTH * k + j) / 8;
147 u8 byte = *(vmem + index); 147 u8 byte = *(vmem + index);
148 u8 bit = byte & (1 << (7 - (j % 8))); 148 u8 bit = byte & (1 << (j % 8));
149 bit = bit >> (7 - (j % 8)); 149 bit = bit >> (j % 8);
150 buf |= bit << k; 150 buf |= bit << k;
151 } 151 }
152 ssd1307fb_write_data(par->client, buf); 152 ssd1307fb_write_data(par->client, buf);
@@ -227,7 +227,8 @@ static struct fb_deferred_io ssd1307fb_defio = {
227 .deferred_io = ssd1307fb_deferred_io, 227 .deferred_io = ssd1307fb_deferred_io,
228}; 228};
229 229
230static int __devinit ssd1307fb_probe(struct i2c_client *client, const struct i2c_device_id *id) 230static int ssd1307fb_probe(struct i2c_client *client,
231 const struct i2c_device_id *id)
231{ 232{
232 struct fb_info *info; 233 struct fb_info *info;
233 u32 vmem_size = SSD1307FB_WIDTH * SSD1307FB_HEIGHT / 8; 234 u32 vmem_size = SSD1307FB_WIDTH * SSD1307FB_HEIGHT / 8;
@@ -352,7 +353,7 @@ fb_alloc_error:
352 return ret; 353 return ret;
353} 354}
354 355
355static int __devexit ssd1307fb_remove(struct i2c_client *client) 356static int ssd1307fb_remove(struct i2c_client *client)
356{ 357{
357 struct fb_info *info = i2c_get_clientdata(client); 358 struct fb_info *info = i2c_get_clientdata(client);
358 struct ssd1307fb_par *par = info->par; 359 struct ssd1307fb_par *par = info->par;
@@ -380,7 +381,7 @@ MODULE_DEVICE_TABLE(of, ssd1307fb_of_match);
380 381
381static struct i2c_driver ssd1307fb_driver = { 382static struct i2c_driver ssd1307fb_driver = {
382 .probe = ssd1307fb_probe, 383 .probe = ssd1307fb_probe,
383 .remove = __devexit_p(ssd1307fb_remove), 384 .remove = ssd1307fb_remove,
384 .id_table = ssd1307fb_i2c_id, 385 .id_table = ssd1307fb_i2c_id,
385 .driver = { 386 .driver = {
386 .name = "ssd1307fb", 387 .name = "ssd1307fb",
diff --git a/drivers/video/sstfb.c b/drivers/video/sstfb.c
index 111fb32e8769..9c00026e3ae2 100644
--- a/drivers/video/sstfb.c
+++ b/drivers/video/sstfb.c
@@ -104,7 +104,7 @@ static bool slowpci; /* slow PCI settings */
104*/ 104*/
105#define DEFAULT_VIDEO_MODE "640x480@60" 105#define DEFAULT_VIDEO_MODE "640x480@60"
106 106
107static char *mode_option __devinitdata = DEFAULT_VIDEO_MODE; 107static char *mode_option = DEFAULT_VIDEO_MODE;
108 108
109enum { 109enum {
110 ID_VOODOO1 = 0, 110 ID_VOODOO1 = 0,
@@ -113,7 +113,7 @@ enum {
113 113
114#define IS_VOODOO2(par) ((par)->type == ID_VOODOO2) 114#define IS_VOODOO2(par) ((par)->type == ID_VOODOO2)
115 115
116static struct sst_spec voodoo_spec[] __devinitdata = { 116static struct sst_spec voodoo_spec[] = {
117 { .name = "Voodoo Graphics", .default_gfx_clock = 50000, .max_gfxclk = 60 }, 117 { .name = "Voodoo Graphics", .default_gfx_clock = 50000, .max_gfxclk = 60 },
118 { .name = "Voodoo2", .default_gfx_clock = 75000, .max_gfxclk = 85 }, 118 { .name = "Voodoo2", .default_gfx_clock = 75000, .max_gfxclk = 85 },
119}; 119};
@@ -822,7 +822,7 @@ static void sstfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
822/* 822/*
823 * get lfb size 823 * get lfb size
824 */ 824 */
825static int __devinit sst_get_memsize(struct fb_info *info, __u32 *memsize) 825static int sst_get_memsize(struct fb_info *info, __u32 *memsize)
826{ 826{
827 u8 __iomem *fbbase_virt = info->screen_base; 827 u8 __iomem *fbbase_virt = info->screen_base;
828 828
@@ -865,7 +865,7 @@ static int __devinit sst_get_memsize(struct fb_info *info, __u32 *memsize)
865/* fbi should be idle, and fifo emty and mem disabled */ 865/* fbi should be idle, and fifo emty and mem disabled */
866/* supposed to detect AT&T ATT20C409 and Ti TVP3409 ramdacs */ 866/* supposed to detect AT&T ATT20C409 and Ti TVP3409 ramdacs */
867 867
868static int __devinit sst_detect_att(struct fb_info *info) 868static int sst_detect_att(struct fb_info *info)
869{ 869{
870 struct sstfb_par *par = info->par; 870 struct sstfb_par *par = info->par;
871 int i, mir, dir; 871 int i, mir, dir;
@@ -890,7 +890,7 @@ static int __devinit sst_detect_att(struct fb_info *info)
890 return 0; 890 return 0;
891} 891}
892 892
893static int __devinit sst_detect_ti(struct fb_info *info) 893static int sst_detect_ti(struct fb_info *info)
894{ 894{
895 struct sstfb_par *par = info->par; 895 struct sstfb_par *par = info->par;
896 int i, mir, dir; 896 int i, mir, dir;
@@ -926,7 +926,7 @@ static int __devinit sst_detect_ti(struct fb_info *info)
926 * touched... 926 * touched...
927 * is it really safe ? how can i reset this ramdac ? geee... 927 * is it really safe ? how can i reset this ramdac ? geee...
928 */ 928 */
929static int __devinit sst_detect_ics(struct fb_info *info) 929static int sst_detect_ics(struct fb_info *info)
930{ 930{
931 struct sstfb_par *par = info->par; 931 struct sstfb_par *par = info->par;
932 int m_clk0_1, m_clk0_7, m_clk1_b; 932 int m_clk0_1, m_clk0_7, m_clk1_b;
@@ -1105,7 +1105,7 @@ static void sst_set_vidmod_ics(struct fb_info *info, const int bpp)
1105 */ 1105 */
1106 1106
1107 1107
1108static struct dac_switch dacs[] __devinitdata = { 1108static struct dac_switch dacs[] = {
1109 { .name = "TI TVP3409", 1109 { .name = "TI TVP3409",
1110 .detect = sst_detect_ti, 1110 .detect = sst_detect_ti,
1111 .set_pll = sst_set_pll_att_ti, 1111 .set_pll = sst_set_pll_att_ti,
@@ -1121,7 +1121,7 @@ static struct dac_switch dacs[] __devinitdata = {
1121 .set_vidmod = sst_set_vidmod_ics }, 1121 .set_vidmod = sst_set_vidmod_ics },
1122}; 1122};
1123 1123
1124static int __devinit sst_detect_dactype(struct fb_info *info, struct sstfb_par *par) 1124static int sst_detect_dactype(struct fb_info *info, struct sstfb_par *par)
1125{ 1125{
1126 int i, ret = 0; 1126 int i, ret = 0;
1127 1127
@@ -1140,7 +1140,7 @@ static int __devinit sst_detect_dactype(struct fb_info *info, struct sstfb_par *
1140/* 1140/*
1141 * Internal Routines 1141 * Internal Routines
1142 */ 1142 */
1143static int __devinit sst_init(struct fb_info *info, struct sstfb_par *par) 1143static int sst_init(struct fb_info *info, struct sstfb_par *par)
1144{ 1144{
1145 u32 fbiinit0, fbiinit1, fbiinit4; 1145 u32 fbiinit0, fbiinit1, fbiinit4;
1146 struct pci_dev *dev = par->dev; 1146 struct pci_dev *dev = par->dev;
@@ -1239,7 +1239,7 @@ static int __devinit sst_init(struct fb_info *info, struct sstfb_par *par)
1239 return 1; 1239 return 1;
1240} 1240}
1241 1241
1242static void __devexit sst_shutdown(struct fb_info *info) 1242static void sst_shutdown(struct fb_info *info)
1243{ 1243{
1244 struct sstfb_par *par = info->par; 1244 struct sstfb_par *par = info->par;
1245 struct pci_dev *dev = par->dev; 1245 struct pci_dev *dev = par->dev;
@@ -1271,7 +1271,7 @@ static void __devexit sst_shutdown(struct fb_info *info)
1271/* 1271/*
1272 * Interface to the world 1272 * Interface to the world
1273 */ 1273 */
1274static int __devinit sstfb_setup(char *options) 1274static int sstfb_setup(char *options)
1275{ 1275{
1276 char *this_opt; 1276 char *this_opt;
1277 1277
@@ -1317,8 +1317,7 @@ static struct fb_ops sstfb_ops = {
1317 .fb_ioctl = sstfb_ioctl, 1317 .fb_ioctl = sstfb_ioctl,
1318}; 1318};
1319 1319
1320static int __devinit sstfb_probe(struct pci_dev *pdev, 1320static int sstfb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1321 const struct pci_device_id *id)
1322{ 1321{
1323 struct fb_info *info; 1322 struct fb_info *info;
1324 struct fb_fix_screeninfo *fix; 1323 struct fb_fix_screeninfo *fix;
@@ -1458,7 +1457,7 @@ fail_mmio_mem:
1458 return -ENXIO; /* no voodoo detected */ 1457 return -ENXIO; /* no voodoo detected */
1459} 1458}
1460 1459
1461static void __devexit sstfb_remove(struct pci_dev *pdev) 1460static void sstfb_remove(struct pci_dev *pdev)
1462{ 1461{
1463 struct sstfb_par *par; 1462 struct sstfb_par *par;
1464 struct fb_info *info; 1463 struct fb_info *info;
@@ -1490,11 +1489,11 @@ static struct pci_driver sstfb_driver = {
1490 .name = "sstfb", 1489 .name = "sstfb",
1491 .id_table = sstfb_id_tbl, 1490 .id_table = sstfb_id_tbl,
1492 .probe = sstfb_probe, 1491 .probe = sstfb_probe,
1493 .remove = __devexit_p(sstfb_remove), 1492 .remove = sstfb_remove,
1494}; 1493};
1495 1494
1496 1495
1497static int __devinit sstfb_init(void) 1496static int sstfb_init(void)
1498{ 1497{
1499 char *option = NULL; 1498 char *option = NULL;
1500 1499
@@ -1505,7 +1504,7 @@ static int __devinit sstfb_init(void)
1505 return pci_register_driver(&sstfb_driver); 1504 return pci_register_driver(&sstfb_driver);
1506} 1505}
1507 1506
1508static void __devexit sstfb_exit(void) 1507static void sstfb_exit(void)
1509{ 1508{
1510 pci_unregister_driver(&sstfb_driver); 1509 pci_unregister_driver(&sstfb_driver);
1511} 1510}
diff --git a/drivers/video/sunxvr1000.c b/drivers/video/sunxvr1000.c
index 729a50722bdf..cc6f48bba36b 100644
--- a/drivers/video/sunxvr1000.c
+++ b/drivers/video/sunxvr1000.c
@@ -25,7 +25,7 @@ struct gfb_info {
25 u32 pseudo_palette[16]; 25 u32 pseudo_palette[16];
26}; 26};
27 27
28static int __devinit gfb_get_props(struct gfb_info *gp) 28static int gfb_get_props(struct gfb_info *gp)
29{ 29{
30 gp->width = of_getintprop_default(gp->of_node, "width", 0); 30 gp->width = of_getintprop_default(gp->of_node, "width", 0);
31 gp->height = of_getintprop_default(gp->of_node, "height", 0); 31 gp->height = of_getintprop_default(gp->of_node, "height", 0);
@@ -66,7 +66,7 @@ static struct fb_ops gfb_ops = {
66 .fb_imageblit = cfb_imageblit, 66 .fb_imageblit = cfb_imageblit,
67}; 67};
68 68
69static int __devinit gfb_set_fbinfo(struct gfb_info *gp) 69static int gfb_set_fbinfo(struct gfb_info *gp)
70{ 70{
71 struct fb_info *info = gp->info; 71 struct fb_info *info = gp->info;
72 struct fb_var_screeninfo *var = &info->var; 72 struct fb_var_screeninfo *var = &info->var;
@@ -111,7 +111,7 @@ static int __devinit gfb_set_fbinfo(struct gfb_info *gp)
111 return 0; 111 return 0;
112} 112}
113 113
114static int __devinit gfb_probe(struct platform_device *op) 114static int gfb_probe(struct platform_device *op)
115{ 115{
116 struct device_node *dp = op->dev.of_node; 116 struct device_node *dp = op->dev.of_node;
117 struct fb_info *info; 117 struct fb_info *info;
@@ -173,7 +173,7 @@ err_out:
173 return err; 173 return err;
174} 174}
175 175
176static int __devexit gfb_remove(struct platform_device *op) 176static int gfb_remove(struct platform_device *op)
177{ 177{
178 struct fb_info *info = dev_get_drvdata(&op->dev); 178 struct fb_info *info = dev_get_drvdata(&op->dev);
179 struct gfb_info *gp = info->par; 179 struct gfb_info *gp = info->par;
@@ -201,7 +201,7 @@ MODULE_DEVICE_TABLE(of, ffb_match);
201 201
202static struct platform_driver gfb_driver = { 202static struct platform_driver gfb_driver = {
203 .probe = gfb_probe, 203 .probe = gfb_probe,
204 .remove = __devexit_p(gfb_remove), 204 .remove = gfb_remove,
205 .driver = { 205 .driver = {
206 .name = "gfb", 206 .name = "gfb",
207 .owner = THIS_MODULE, 207 .owner = THIS_MODULE,
diff --git a/drivers/video/sunxvr2500.c b/drivers/video/sunxvr2500.c
index 7fbcba86d1a2..843b6bab0483 100644
--- a/drivers/video/sunxvr2500.c
+++ b/drivers/video/sunxvr2500.c
@@ -29,7 +29,7 @@ struct s3d_info {
29 u32 pseudo_palette[16]; 29 u32 pseudo_palette[16];
30}; 30};
31 31
32static int __devinit s3d_get_props(struct s3d_info *sp) 32static int s3d_get_props(struct s3d_info *sp)
33{ 33{
34 sp->width = of_getintprop_default(sp->of_node, "width", 0); 34 sp->width = of_getintprop_default(sp->of_node, "width", 0);
35 sp->height = of_getintprop_default(sp->of_node, "height", 0); 35 sp->height = of_getintprop_default(sp->of_node, "height", 0);
@@ -70,7 +70,7 @@ static struct fb_ops s3d_ops = {
70 .fb_imageblit = cfb_imageblit, 70 .fb_imageblit = cfb_imageblit,
71}; 71};
72 72
73static int __devinit s3d_set_fbinfo(struct s3d_info *sp) 73static int s3d_set_fbinfo(struct s3d_info *sp)
74{ 74{
75 struct fb_info *info = sp->info; 75 struct fb_info *info = sp->info;
76 struct fb_var_screeninfo *var = &info->var; 76 struct fb_var_screeninfo *var = &info->var;
@@ -115,8 +115,8 @@ static int __devinit s3d_set_fbinfo(struct s3d_info *sp)
115 return 0; 115 return 0;
116} 116}
117 117
118static int __devinit s3d_pci_register(struct pci_dev *pdev, 118static int s3d_pci_register(struct pci_dev *pdev,
119 const struct pci_device_id *ent) 119 const struct pci_device_id *ent)
120{ 120{
121 struct fb_info *info; 121 struct fb_info *info;
122 struct s3d_info *sp; 122 struct s3d_info *sp;
@@ -219,7 +219,7 @@ err_out:
219 return err; 219 return err;
220} 220}
221 221
222static void __devexit s3d_pci_unregister(struct pci_dev *pdev) 222static void s3d_pci_unregister(struct pci_dev *pdev)
223{ 223{
224 struct fb_info *info = pci_get_drvdata(pdev); 224 struct fb_info *info = pci_get_drvdata(pdev);
225 struct s3d_info *sp = info->par; 225 struct s3d_info *sp = info->par;
@@ -251,7 +251,7 @@ static struct pci_driver s3d_driver = {
251 .name = "s3d", 251 .name = "s3d",
252 .id_table = s3d_pci_table, 252 .id_table = s3d_pci_table,
253 .probe = s3d_pci_register, 253 .probe = s3d_pci_register,
254 .remove = __devexit_p(s3d_pci_unregister), 254 .remove = s3d_pci_unregister,
255}; 255};
256 256
257static int __init s3d_init(void) 257static int __init s3d_init(void)
diff --git a/drivers/video/sunxvr500.c b/drivers/video/sunxvr500.c
index 6c71b1b44477..387350d004df 100644
--- a/drivers/video/sunxvr500.c
+++ b/drivers/video/sunxvr500.c
@@ -51,7 +51,7 @@ struct e3d_info {
51 u32 pseudo_palette[16]; 51 u32 pseudo_palette[16];
52}; 52};
53 53
54static int __devinit e3d_get_props(struct e3d_info *ep) 54static int e3d_get_props(struct e3d_info *ep)
55{ 55{
56 ep->width = of_getintprop_default(ep->of_node, "width", 0); 56 ep->width = of_getintprop_default(ep->of_node, "width", 0);
57 ep->height = of_getintprop_default(ep->of_node, "height", 0); 57 ep->height = of_getintprop_default(ep->of_node, "height", 0);
@@ -193,7 +193,7 @@ static struct fb_ops e3d_ops = {
193 .fb_imageblit = e3d_imageblit, 193 .fb_imageblit = e3d_imageblit,
194}; 194};
195 195
196static int __devinit e3d_set_fbinfo(struct e3d_info *ep) 196static int e3d_set_fbinfo(struct e3d_info *ep)
197{ 197{
198 struct fb_info *info = ep->info; 198 struct fb_info *info = ep->info;
199 struct fb_var_screeninfo *var = &info->var; 199 struct fb_var_screeninfo *var = &info->var;
@@ -238,8 +238,8 @@ static int __devinit e3d_set_fbinfo(struct e3d_info *ep)
238 return 0; 238 return 0;
239} 239}
240 240
241static int __devinit e3d_pci_register(struct pci_dev *pdev, 241static int e3d_pci_register(struct pci_dev *pdev,
242 const struct pci_device_id *ent) 242 const struct pci_device_id *ent)
243{ 243{
244 struct device_node *of_node; 244 struct device_node *of_node;
245 const char *device_type; 245 const char *device_type;
@@ -392,7 +392,7 @@ err_out:
392 return err; 392 return err;
393} 393}
394 394
395static void __devexit e3d_pci_unregister(struct pci_dev *pdev) 395static void e3d_pci_unregister(struct pci_dev *pdev)
396{ 396{
397 struct fb_info *info = pci_get_drvdata(pdev); 397 struct fb_info *info = pci_get_drvdata(pdev);
398 struct e3d_info *ep = info->par; 398 struct e3d_info *ep = info->par;
@@ -437,7 +437,7 @@ static struct pci_driver e3d_driver = {
437 .name = "e3d", 437 .name = "e3d",
438 .id_table = e3d_pci_table, 438 .id_table = e3d_pci_table,
439 .probe = e3d_pci_register, 439 .probe = e3d_pci_register,
440 .remove = __devexit_p(e3d_pci_unregister), 440 .remove = e3d_pci_unregister,
441}; 441};
442 442
443static int __init e3d_init(void) 443static int __init e3d_init(void)
diff --git a/drivers/video/tcx.c b/drivers/video/tcx.c
index 07c66e946634..c000852500aa 100644
--- a/drivers/video/tcx.c
+++ b/drivers/video/tcx.c
@@ -362,7 +362,7 @@ static void tcx_unmap_regs(struct platform_device *op, struct fb_info *info,
362 info->screen_base, info->fix.smem_len); 362 info->screen_base, info->fix.smem_len);
363} 363}
364 364
365static int __devinit tcx_probe(struct platform_device *op) 365static int tcx_probe(struct platform_device *op)
366{ 366{
367 struct device_node *dp = op->dev.of_node; 367 struct device_node *dp = op->dev.of_node;
368 struct fb_info *info; 368 struct fb_info *info;
@@ -486,7 +486,7 @@ out_err:
486 return err; 486 return err;
487} 487}
488 488
489static int __devexit tcx_remove(struct platform_device *op) 489static int tcx_remove(struct platform_device *op)
490{ 490{
491 struct fb_info *info = dev_get_drvdata(&op->dev); 491 struct fb_info *info = dev_get_drvdata(&op->dev);
492 struct tcx_par *par = info->par; 492 struct tcx_par *par = info->par;
@@ -518,7 +518,7 @@ static struct platform_driver tcx_driver = {
518 .of_match_table = tcx_match, 518 .of_match_table = tcx_match,
519 }, 519 },
520 .probe = tcx_probe, 520 .probe = tcx_probe,
521 .remove = __devexit_p(tcx_remove), 521 .remove = tcx_remove,
522}; 522};
523 523
524static int __init tcx_init(void) 524static int __init tcx_init(void)
diff --git a/drivers/video/tdfxfb.c b/drivers/video/tdfxfb.c
index e026724a3a56..64bc28ba4037 100644
--- a/drivers/video/tdfxfb.c
+++ b/drivers/video/tdfxfb.c
@@ -100,7 +100,7 @@ static inline int mtrr_del(int reg, unsigned long base,
100#define VOODOO3_MAX_PIXCLOCK 300000 100#define VOODOO3_MAX_PIXCLOCK 300000
101#define VOODOO5_MAX_PIXCLOCK 350000 101#define VOODOO5_MAX_PIXCLOCK 350000
102 102
103static struct fb_fix_screeninfo tdfx_fix __devinitdata = { 103static struct fb_fix_screeninfo tdfx_fix = {
104 .type = FB_TYPE_PACKED_PIXELS, 104 .type = FB_TYPE_PACKED_PIXELS,
105 .visual = FB_VISUAL_PSEUDOCOLOR, 105 .visual = FB_VISUAL_PSEUDOCOLOR,
106 .ypanstep = 1, 106 .ypanstep = 1,
@@ -108,7 +108,7 @@ static struct fb_fix_screeninfo tdfx_fix __devinitdata = {
108 .accel = FB_ACCEL_3DFX_BANSHEE 108 .accel = FB_ACCEL_3DFX_BANSHEE
109}; 109};
110 110
111static struct fb_var_screeninfo tdfx_var __devinitdata = { 111static struct fb_var_screeninfo tdfx_var = {
112 /* "640x480, 8 bpp @ 60 Hz */ 112 /* "640x480, 8 bpp @ 60 Hz */
113 .xres = 640, 113 .xres = 640,
114 .yres = 480, 114 .yres = 480,
@@ -135,9 +135,8 @@ static struct fb_var_screeninfo tdfx_var __devinitdata = {
135/* 135/*
136 * PCI driver prototypes 136 * PCI driver prototypes
137 */ 137 */
138static int __devinit tdfxfb_probe(struct pci_dev *pdev, 138static int tdfxfb_probe(struct pci_dev *pdev, const struct pci_device_id *id);
139 const struct pci_device_id *id); 139static void tdfxfb_remove(struct pci_dev *pdev);
140static void __devexit tdfxfb_remove(struct pci_dev *pdev);
141 140
142static struct pci_device_id tdfxfb_id_table[] = { 141static struct pci_device_id tdfxfb_id_table[] = {
143 { PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_BANSHEE, 142 { PCI_VENDOR_ID_3DFX, PCI_DEVICE_ID_3DFX_BANSHEE,
@@ -156,7 +155,7 @@ static struct pci_driver tdfxfb_driver = {
156 .name = "tdfxfb", 155 .name = "tdfxfb",
157 .id_table = tdfxfb_id_table, 156 .id_table = tdfxfb_id_table,
158 .probe = tdfxfb_probe, 157 .probe = tdfxfb_probe,
159 .remove = __devexit_p(tdfxfb_remove), 158 .remove = tdfxfb_remove,
160}; 159};
161 160
162MODULE_DEVICE_TABLE(pci, tdfxfb_id_table); 161MODULE_DEVICE_TABLE(pci, tdfxfb_id_table);
@@ -167,9 +166,9 @@ MODULE_DEVICE_TABLE(pci, tdfxfb_id_table);
167static int nopan; 166static int nopan;
168static int nowrap = 1; /* not implemented (yet) */ 167static int nowrap = 1; /* not implemented (yet) */
169static int hwcursor = 1; 168static int hwcursor = 1;
170static char *mode_option __devinitdata; 169static char *mode_option;
171/* mtrr option */ 170/* mtrr option */
172static bool nomtrr __devinitdata; 171static bool nomtrr;
173 172
174/* ------------------------------------------------------------------------- 173/* -------------------------------------------------------------------------
175 * Hardware-specific funcions 174 * Hardware-specific funcions
@@ -1279,8 +1278,8 @@ static int tdfxfb_ddc_getsda(void *data)
1279 return (0 != (tdfx_inl(par, VIDSERPARPORT) & DDC_SDA_IN)); 1278 return (0 != (tdfx_inl(par, VIDSERPARPORT) & DDC_SDA_IN));
1280} 1279}
1281 1280
1282static int __devinit tdfxfb_setup_ddc_bus(struct tdfxfb_i2c_chan *chan, 1281static int tdfxfb_setup_ddc_bus(struct tdfxfb_i2c_chan *chan, const char *name,
1283 const char *name, struct device *dev) 1282 struct device *dev)
1284{ 1283{
1285 int rc; 1284 int rc;
1286 1285
@@ -1308,8 +1307,8 @@ static int __devinit tdfxfb_setup_ddc_bus(struct tdfxfb_i2c_chan *chan,
1308 return rc; 1307 return rc;
1309} 1308}
1310 1309
1311static int __devinit tdfxfb_setup_i2c_bus(struct tdfxfb_i2c_chan *chan, 1310static int tdfxfb_setup_i2c_bus(struct tdfxfb_i2c_chan *chan, const char *name,
1312 const char *name, struct device *dev) 1311 struct device *dev)
1313{ 1312{
1314 int rc; 1313 int rc;
1315 1314
@@ -1336,7 +1335,7 @@ static int __devinit tdfxfb_setup_i2c_bus(struct tdfxfb_i2c_chan *chan,
1336 return rc; 1335 return rc;
1337} 1336}
1338 1337
1339static void __devinit tdfxfb_create_i2c_busses(struct fb_info *info) 1338static void tdfxfb_create_i2c_busses(struct fb_info *info)
1340{ 1339{
1341 struct tdfx_par *par = info->par; 1340 struct tdfx_par *par = info->par;
1342 1341
@@ -1388,8 +1387,7 @@ static int tdfxfb_probe_i2c_connector(struct tdfx_par *par,
1388 * Initializes and allocates resources for PCI device @pdev. 1387 * Initializes and allocates resources for PCI device @pdev.
1389 * 1388 *
1390 */ 1389 */
1391static int __devinit tdfxfb_probe(struct pci_dev *pdev, 1390static int tdfxfb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1392 const struct pci_device_id *id)
1393{ 1391{
1394 struct tdfx_par *default_par; 1392 struct tdfx_par *default_par;
1395 struct fb_info *info; 1393 struct fb_info *info;
@@ -1626,7 +1624,7 @@ static void __init tdfxfb_setup(char *options)
1626 * lifetime for the PCI device @pdev. 1624 * lifetime for the PCI device @pdev.
1627 * 1625 *
1628 */ 1626 */
1629static void __devexit tdfxfb_remove(struct pci_dev *pdev) 1627static void tdfxfb_remove(struct pci_dev *pdev)
1630{ 1628{
1631 struct fb_info *info = pci_get_drvdata(pdev); 1629 struct fb_info *info = pci_get_drvdata(pdev);
1632 struct tdfx_par *par = info->par; 1630 struct tdfx_par *par = info->par;
diff --git a/drivers/video/tgafb.c b/drivers/video/tgafb.c
index aba7686b1a32..c9c8e5a1fdee 100644
--- a/drivers/video/tgafb.c
+++ b/drivers/video/tgafb.c
@@ -61,8 +61,8 @@ static void tgafb_fillrect(struct fb_info *, const struct fb_fillrect *);
61static void tgafb_copyarea(struct fb_info *, const struct fb_copyarea *); 61static void tgafb_copyarea(struct fb_info *, const struct fb_copyarea *);
62static int tgafb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info); 62static int tgafb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info);
63 63
64static int __devinit tgafb_register(struct device *dev); 64static int tgafb_register(struct device *dev);
65static void __devexit tgafb_unregister(struct device *dev); 65static void tgafb_unregister(struct device *dev);
66 66
67static const char *mode_option; 67static const char *mode_option;
68static const char *mode_option_pci = "640x480@60"; 68static const char *mode_option_pci = "640x480@60";
@@ -93,9 +93,8 @@ static struct fb_ops tgafb_ops = {
93/* 93/*
94 * PCI registration operations 94 * PCI registration operations
95 */ 95 */
96static int __devinit tgafb_pci_register(struct pci_dev *, 96static int tgafb_pci_register(struct pci_dev *, const struct pci_device_id *);
97 const struct pci_device_id *); 97static void tgafb_pci_unregister(struct pci_dev *);
98static void __devexit tgafb_pci_unregister(struct pci_dev *);
99 98
100static struct pci_device_id const tgafb_pci_table[] = { 99static struct pci_device_id const tgafb_pci_table[] = {
101 { PCI_DEVICE(PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TGA) }, 100 { PCI_DEVICE(PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TGA) },
@@ -107,17 +106,16 @@ static struct pci_driver tgafb_pci_driver = {
107 .name = "tgafb", 106 .name = "tgafb",
108 .id_table = tgafb_pci_table, 107 .id_table = tgafb_pci_table,
109 .probe = tgafb_pci_register, 108 .probe = tgafb_pci_register,
110 .remove = __devexit_p(tgafb_pci_unregister), 109 .remove = tgafb_pci_unregister,
111}; 110};
112 111
113static int __devinit 112static int tgafb_pci_register(struct pci_dev *pdev,
114tgafb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent) 113 const struct pci_device_id *ent)
115{ 114{
116 return tgafb_register(&pdev->dev); 115 return tgafb_register(&pdev->dev);
117} 116}
118 117
119static void __devexit 118static void tgafb_pci_unregister(struct pci_dev *pdev)
120tgafb_pci_unregister(struct pci_dev *pdev)
121{ 119{
122 tgafb_unregister(&pdev->dev); 120 tgafb_unregister(&pdev->dev);
123} 121}
@@ -127,8 +125,8 @@ tgafb_pci_unregister(struct pci_dev *pdev)
127/* 125/*
128 * TC registration operations 126 * TC registration operations
129 */ 127 */
130static int __devinit tgafb_tc_register(struct device *); 128static int tgafb_tc_register(struct device *);
131static int __devexit tgafb_tc_unregister(struct device *); 129static int tgafb_tc_unregister(struct device *);
132 130
133static struct tc_device_id const tgafb_tc_table[] = { 131static struct tc_device_id const tgafb_tc_table[] = {
134 { "DEC ", "PMAGD-AA" }, 132 { "DEC ", "PMAGD-AA" },
@@ -143,12 +141,11 @@ static struct tc_driver tgafb_tc_driver = {
143 .name = "tgafb", 141 .name = "tgafb",
144 .bus = &tc_bus_type, 142 .bus = &tc_bus_type,
145 .probe = tgafb_tc_register, 143 .probe = tgafb_tc_register,
146 .remove = __devexit_p(tgafb_tc_unregister), 144 .remove = tgafb_tc_unregister,
147 }, 145 },
148}; 146};
149 147
150static int __devinit 148static int tgafb_tc_register(struct device *dev)
151tgafb_tc_register(struct device *dev)
152{ 149{
153 int status = tgafb_register(dev); 150 int status = tgafb_register(dev);
154 if (!status) 151 if (!status)
@@ -156,8 +153,7 @@ tgafb_tc_register(struct device *dev)
156 return status; 153 return status;
157} 154}
158 155
159static int __devexit 156static int tgafb_tc_unregister(struct device *dev)
160tgafb_tc_unregister(struct device *dev)
161{ 157{
162 put_device(dev); 158 put_device(dev);
163 tgafb_unregister(dev); 159 tgafb_unregister(dev);
@@ -1546,8 +1542,7 @@ static int tgafb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info
1546 return 0; 1542 return 0;
1547} 1543}
1548 1544
1549static int __devinit 1545static int tgafb_register(struct device *dev)
1550tgafb_register(struct device *dev)
1551{ 1546{
1552 static const struct fb_videomode modedb_tc = { 1547 static const struct fb_videomode modedb_tc = {
1553 /* 1280x1024 @ 72 Hz, 76.8 kHz hsync */ 1548 /* 1280x1024 @ 72 Hz, 76.8 kHz hsync */
@@ -1692,8 +1687,7 @@ tgafb_register(struct device *dev)
1692 return ret; 1687 return ret;
1693} 1688}
1694 1689
1695static void __devexit 1690static void tgafb_unregister(struct device *dev)
1696tgafb_unregister(struct device *dev)
1697{ 1691{
1698 resource_size_t bar0_start = 0, bar0_len = 0; 1692 resource_size_t bar0_start = 0, bar0_len = 0;
1699 int tga_bus_pci = TGA_BUS_PCI(dev); 1693 int tga_bus_pci = TGA_BUS_PCI(dev);
@@ -1721,16 +1715,14 @@ tgafb_unregister(struct device *dev)
1721 framebuffer_release(info); 1715 framebuffer_release(info);
1722} 1716}
1723 1717
1724static void __devexit 1718static void tgafb_exit(void)
1725tgafb_exit(void)
1726{ 1719{
1727 tc_unregister_driver(&tgafb_tc_driver); 1720 tc_unregister_driver(&tgafb_tc_driver);
1728 pci_unregister_driver(&tgafb_pci_driver); 1721 pci_unregister_driver(&tgafb_pci_driver);
1729} 1722}
1730 1723
1731#ifndef MODULE 1724#ifndef MODULE
1732static int __devinit 1725static int tgafb_setup(char *arg)
1733tgafb_setup(char *arg)
1734{ 1726{
1735 char *this_opt; 1727 char *this_opt;
1736 1728
@@ -1751,8 +1743,7 @@ tgafb_setup(char *arg)
1751} 1743}
1752#endif /* !MODULE */ 1744#endif /* !MODULE */
1753 1745
1754static int __devinit 1746static int tgafb_init(void)
1755tgafb_init(void)
1756{ 1747{
1757 int status; 1748 int status;
1758#ifndef MODULE 1749#ifndef MODULE
diff --git a/drivers/video/tmiofb.c b/drivers/video/tmiofb.c
index b244f060f151..dc4fb8620156 100644
--- a/drivers/video/tmiofb.c
+++ b/drivers/video/tmiofb.c
@@ -191,7 +191,7 @@
191#define LCR_VCLKHW 0x1b4 /* VCLK High Width */ 191#define LCR_VCLKHW 0x1b4 /* VCLK High Width */
192#define LCR_OC 0x1b6 /* Output Control */ 192#define LCR_OC 0x1b6 /* Output Control */
193 193
194static char *mode_option __devinitdata; 194static char *mode_option;
195 195
196struct tmiofb_par { 196struct tmiofb_par {
197 u32 pseudo_palette[16]; 197 u32 pseudo_palette[16];
@@ -675,7 +675,7 @@ static struct fb_ops tmiofb_ops = {
675 675
676/*--------------------------------------------------------------------------*/ 676/*--------------------------------------------------------------------------*/
677 677
678static int __devinit tmiofb_probe(struct platform_device *dev) 678static int tmiofb_probe(struct platform_device *dev)
679{ 679{
680 const struct mfd_cell *cell = mfd_get_cell(dev); 680 const struct mfd_cell *cell = mfd_get_cell(dev);
681 struct tmio_fb_data *data = dev->dev.platform_data; 681 struct tmio_fb_data *data = dev->dev.platform_data;
@@ -807,7 +807,7 @@ err_ioremap_ccr:
807 return retval; 807 return retval;
808} 808}
809 809
810static int __devexit tmiofb_remove(struct platform_device *dev) 810static int tmiofb_remove(struct platform_device *dev)
811{ 811{
812 const struct mfd_cell *cell = mfd_get_cell(dev); 812 const struct mfd_cell *cell = mfd_get_cell(dev);
813 struct fb_info *info = platform_get_drvdata(dev); 813 struct fb_info *info = platform_get_drvdata(dev);
@@ -1002,7 +1002,7 @@ static struct platform_driver tmiofb_driver = {
1002 .driver.name = "tmio-fb", 1002 .driver.name = "tmio-fb",
1003 .driver.owner = THIS_MODULE, 1003 .driver.owner = THIS_MODULE,
1004 .probe = tmiofb_probe, 1004 .probe = tmiofb_probe,
1005 .remove = __devexit_p(tmiofb_remove), 1005 .remove = tmiofb_remove,
1006 .suspend = tmiofb_suspend, 1006 .suspend = tmiofb_suspend,
1007 .resume = tmiofb_resume, 1007 .resume = tmiofb_resume,
1008}; 1008};
diff --git a/drivers/video/tridentfb.c b/drivers/video/tridentfb.c
index 34cf019bba44..ab57d387d6b5 100644
--- a/drivers/video/tridentfb.c
+++ b/drivers/video/tridentfb.c
@@ -53,19 +53,19 @@ static struct fb_fix_screeninfo tridentfb_fix = {
53/* defaults which are normally overriden by user values */ 53/* defaults which are normally overriden by user values */
54 54
55/* video mode */ 55/* video mode */
56static char *mode_option __devinitdata = "640x480-8@60"; 56static char *mode_option = "640x480-8@60";
57static int bpp __devinitdata = 8; 57static int bpp = 8;
58 58
59static int noaccel __devinitdata; 59static int noaccel;
60 60
61static int center; 61static int center;
62static int stretch; 62static int stretch;
63 63
64static int fp __devinitdata; 64static int fp;
65static int crt __devinitdata; 65static int crt;
66 66
67static int memsize __devinitdata; 67static int memsize;
68static int memdiff __devinitdata; 68static int memdiff;
69static int nativex; 69static int nativex;
70 70
71module_param(mode_option, charp, 0); 71module_param(mode_option, charp, 0);
@@ -637,7 +637,7 @@ static inline void crtc_unlock(struct tridentfb_par *par)
637} 637}
638 638
639/* Return flat panel's maximum x resolution */ 639/* Return flat panel's maximum x resolution */
640static int __devinit get_nativex(struct tridentfb_par *par) 640static int get_nativex(struct tridentfb_par *par)
641{ 641{
642 int x, y, tmp; 642 int x, y, tmp;
643 643
@@ -771,7 +771,7 @@ static void set_number_of_lines(struct tridentfb_par *par, int lines)
771 * If we see that FP is active we assume we have one. 771 * If we see that FP is active we assume we have one.
772 * Otherwise we have a CRT display. User can override. 772 * Otherwise we have a CRT display. User can override.
773 */ 773 */
774static int __devinit is_flatpanel(struct tridentfb_par *par) 774static int is_flatpanel(struct tridentfb_par *par)
775{ 775{
776 if (fp) 776 if (fp)
777 return 1; 777 return 1;
@@ -781,7 +781,7 @@ static int __devinit is_flatpanel(struct tridentfb_par *par)
781} 781}
782 782
783/* Try detecting the video memory size */ 783/* Try detecting the video memory size */
784static unsigned int __devinit get_memsize(struct tridentfb_par *par) 784static unsigned int get_memsize(struct tridentfb_par *par)
785{ 785{
786 unsigned char tmp, tmp2; 786 unsigned char tmp, tmp2;
787 unsigned int k; 787 unsigned int k;
@@ -1331,8 +1331,8 @@ static struct fb_ops tridentfb_ops = {
1331 .fb_sync = tridentfb_sync, 1331 .fb_sync = tridentfb_sync,
1332}; 1332};
1333 1333
1334static int __devinit trident_pci_probe(struct pci_dev *dev, 1334static int trident_pci_probe(struct pci_dev *dev,
1335 const struct pci_device_id *id) 1335 const struct pci_device_id *id)
1336{ 1336{
1337 int err; 1337 int err;
1338 unsigned char revision; 1338 unsigned char revision;
@@ -1543,7 +1543,7 @@ out_unmap1:
1543 return err; 1543 return err;
1544} 1544}
1545 1545
1546static void __devexit trident_pci_remove(struct pci_dev *dev) 1546static void trident_pci_remove(struct pci_dev *dev)
1547{ 1547{
1548 struct fb_info *info = pci_get_drvdata(dev); 1548 struct fb_info *info = pci_get_drvdata(dev);
1549 struct tridentfb_par *par = info->par; 1549 struct tridentfb_par *par = info->par;
@@ -1591,7 +1591,7 @@ static struct pci_driver tridentfb_pci_driver = {
1591 .name = "tridentfb", 1591 .name = "tridentfb",
1592 .id_table = trident_devices, 1592 .id_table = trident_devices,
1593 .probe = trident_pci_probe, 1593 .probe = trident_pci_probe,
1594 .remove = __devexit_p(trident_pci_remove) 1594 .remove = trident_pci_remove,
1595}; 1595};
1596 1596
1597/* 1597/*
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
index 2f8f82d874a1..b75db0186488 100644
--- a/drivers/video/uvesafb.c
+++ b/drivers/video/uvesafb.c
@@ -36,26 +36,26 @@ static struct cb_id uvesafb_cn_id = {
36static char v86d_path[PATH_MAX] = "/sbin/v86d"; 36static char v86d_path[PATH_MAX] = "/sbin/v86d";
37static char v86d_started; /* has v86d been started by uvesafb? */ 37static char v86d_started; /* has v86d been started by uvesafb? */
38 38
39static struct fb_fix_screeninfo uvesafb_fix __devinitdata = { 39static struct fb_fix_screeninfo uvesafb_fix = {
40 .id = "VESA VGA", 40 .id = "VESA VGA",
41 .type = FB_TYPE_PACKED_PIXELS, 41 .type = FB_TYPE_PACKED_PIXELS,
42 .accel = FB_ACCEL_NONE, 42 .accel = FB_ACCEL_NONE,
43 .visual = FB_VISUAL_TRUECOLOR, 43 .visual = FB_VISUAL_TRUECOLOR,
44}; 44};
45 45
46static int mtrr __devinitdata = 3; /* enable mtrr by default */ 46static int mtrr = 3; /* enable mtrr by default */
47static bool blank = 1; /* enable blanking by default */ 47static bool blank = 1; /* enable blanking by default */
48static int ypan = 1; /* 0: scroll, 1: ypan, 2: ywrap */ 48static int ypan = 1; /* 0: scroll, 1: ypan, 2: ywrap */
49static bool pmi_setpal __devinitdata = true; /* use PMI for palette changes */ 49static bool pmi_setpal = true; /* use PMI for palette changes */
50static bool nocrtc __devinitdata; /* ignore CRTC settings */ 50static bool nocrtc; /* ignore CRTC settings */
51static bool noedid __devinitdata; /* don't try DDC transfers */ 51static bool noedid; /* don't try DDC transfers */
52static int vram_remap __devinitdata; /* set amt. of memory to be used */ 52static int vram_remap; /* set amt. of memory to be used */
53static int vram_total __devinitdata; /* set total amount of memory */ 53static int vram_total; /* set total amount of memory */
54static u16 maxclk __devinitdata; /* maximum pixel clock */ 54static u16 maxclk; /* maximum pixel clock */
55static u16 maxvf __devinitdata; /* maximum vertical frequency */ 55static u16 maxvf; /* maximum vertical frequency */
56static u16 maxhf __devinitdata; /* maximum horizontal frequency */ 56static u16 maxhf; /* maximum horizontal frequency */
57static u16 vbemode __devinitdata; /* force use of a specific VBE mode */ 57static u16 vbemode; /* force use of a specific VBE mode */
58static char *mode_option __devinitdata; 58static char *mode_option;
59static u8 dac_width = 6; 59static u8 dac_width = 6;
60 60
61static struct uvesafb_ktask *uvfb_tasks[UVESAFB_TASKS_MAX]; 61static struct uvesafb_ktask *uvfb_tasks[UVESAFB_TASKS_MAX];
@@ -418,8 +418,8 @@ static void uvesafb_vbe_state_restore(struct uvesafb_par *par, u8 *state_buf)
418 uvesafb_free(task); 418 uvesafb_free(task);
419} 419}
420 420
421static int __devinit uvesafb_vbe_getinfo(struct uvesafb_ktask *task, 421static int uvesafb_vbe_getinfo(struct uvesafb_ktask *task,
422 struct uvesafb_par *par) 422 struct uvesafb_par *par)
423{ 423{
424 int err; 424 int err;
425 425
@@ -477,8 +477,8 @@ static int __devinit uvesafb_vbe_getinfo(struct uvesafb_ktask *task,
477 return 0; 477 return 0;
478} 478}
479 479
480static int __devinit uvesafb_vbe_getmodes(struct uvesafb_ktask *task, 480static int uvesafb_vbe_getmodes(struct uvesafb_ktask *task,
481 struct uvesafb_par *par) 481 struct uvesafb_par *par)
482{ 482{
483 int off = 0, err; 483 int off = 0, err;
484 u16 *mode; 484 u16 *mode;
@@ -556,8 +556,8 @@ static int __devinit uvesafb_vbe_getmodes(struct uvesafb_ktask *task,
556 * x86 and not x86_64. 556 * x86 and not x86_64.
557 */ 557 */
558#ifdef CONFIG_X86_32 558#ifdef CONFIG_X86_32
559static int __devinit uvesafb_vbe_getpmi(struct uvesafb_ktask *task, 559static int uvesafb_vbe_getpmi(struct uvesafb_ktask *task,
560 struct uvesafb_par *par) 560 struct uvesafb_par *par)
561{ 561{
562 int i, err; 562 int i, err;
563 563
@@ -602,8 +602,8 @@ static int __devinit uvesafb_vbe_getpmi(struct uvesafb_ktask *task,
602 * Check whether a video mode is supported by the Video BIOS and is 602 * Check whether a video mode is supported by the Video BIOS and is
603 * compatible with the monitor limits. 603 * compatible with the monitor limits.
604 */ 604 */
605static int __devinit uvesafb_is_valid_mode(struct fb_videomode *mode, 605static int uvesafb_is_valid_mode(struct fb_videomode *mode,
606 struct fb_info *info) 606 struct fb_info *info)
607{ 607{
608 if (info->monspecs.gtf) { 608 if (info->monspecs.gtf) {
609 fb_videomode_to_var(&info->var, mode); 609 fb_videomode_to_var(&info->var, mode);
@@ -618,8 +618,7 @@ static int __devinit uvesafb_is_valid_mode(struct fb_videomode *mode,
618 return 1; 618 return 1;
619} 619}
620 620
621static int __devinit uvesafb_vbe_getedid(struct uvesafb_ktask *task, 621static int uvesafb_vbe_getedid(struct uvesafb_ktask *task, struct fb_info *info)
622 struct fb_info *info)
623{ 622{
624 struct uvesafb_par *par = info->par; 623 struct uvesafb_par *par = info->par;
625 int err = 0; 624 int err = 0;
@@ -684,8 +683,8 @@ static int __devinit uvesafb_vbe_getedid(struct uvesafb_ktask *task,
684 return err; 683 return err;
685} 684}
686 685
687static void __devinit uvesafb_vbe_getmonspecs(struct uvesafb_ktask *task, 686static void uvesafb_vbe_getmonspecs(struct uvesafb_ktask *task,
688 struct fb_info *info) 687 struct fb_info *info)
689{ 688{
690 struct uvesafb_par *par = info->par; 689 struct uvesafb_par *par = info->par;
691 int i; 690 int i;
@@ -765,8 +764,8 @@ static void __devinit uvesafb_vbe_getmonspecs(struct uvesafb_ktask *task,
765 return; 764 return;
766} 765}
767 766
768static void __devinit uvesafb_vbe_getstatesize(struct uvesafb_ktask *task, 767static void uvesafb_vbe_getstatesize(struct uvesafb_ktask *task,
769 struct uvesafb_par *par) 768 struct uvesafb_par *par)
770{ 769{
771 int err; 770 int err;
772 771
@@ -794,7 +793,7 @@ static void __devinit uvesafb_vbe_getstatesize(struct uvesafb_ktask *task,
794 par->vbe_state_size = 64 * (task->t.regs.ebx & 0xffff); 793 par->vbe_state_size = 64 * (task->t.regs.ebx & 0xffff);
795} 794}
796 795
797static int __devinit uvesafb_vbe_init(struct fb_info *info) 796static int uvesafb_vbe_init(struct fb_info *info)
798{ 797{
799 struct uvesafb_ktask *task = NULL; 798 struct uvesafb_ktask *task = NULL;
800 struct uvesafb_par *par = info->par; 799 struct uvesafb_par *par = info->par;
@@ -839,7 +838,7 @@ out: uvesafb_free(task);
839 return err; 838 return err;
840} 839}
841 840
842static int __devinit uvesafb_vbe_init_mode(struct fb_info *info) 841static int uvesafb_vbe_init_mode(struct fb_info *info)
843{ 842{
844 struct list_head *pos; 843 struct list_head *pos;
845 struct fb_modelist *modelist; 844 struct fb_modelist *modelist;
@@ -1444,8 +1443,7 @@ static struct fb_ops uvesafb_ops = {
1444 .fb_set_par = uvesafb_set_par, 1443 .fb_set_par = uvesafb_set_par,
1445}; 1444};
1446 1445
1447static void __devinit uvesafb_init_info(struct fb_info *info, 1446static void uvesafb_init_info(struct fb_info *info, struct vbe_mode_ib *mode)
1448 struct vbe_mode_ib *mode)
1449{ 1447{
1450 unsigned int size_vmode; 1448 unsigned int size_vmode;
1451 unsigned int size_remap; 1449 unsigned int size_remap;
@@ -1540,7 +1538,7 @@ static void __devinit uvesafb_init_info(struct fb_info *info,
1540 info->fbops->fb_pan_display = NULL; 1538 info->fbops->fb_pan_display = NULL;
1541} 1539}
1542 1540
1543static void __devinit uvesafb_init_mtrr(struct fb_info *info) 1541static void uvesafb_init_mtrr(struct fb_info *info)
1544{ 1542{
1545#ifdef CONFIG_MTRR 1543#ifdef CONFIG_MTRR
1546 if (mtrr && !(info->fix.smem_start & (PAGE_SIZE - 1))) { 1544 if (mtrr && !(info->fix.smem_start & (PAGE_SIZE - 1))) {
@@ -1582,7 +1580,7 @@ static void __devinit uvesafb_init_mtrr(struct fb_info *info)
1582#endif /* CONFIG_MTRR */ 1580#endif /* CONFIG_MTRR */
1583} 1581}
1584 1582
1585static void __devinit uvesafb_ioremap(struct fb_info *info) 1583static void uvesafb_ioremap(struct fb_info *info)
1586{ 1584{
1587#ifdef CONFIG_X86 1585#ifdef CONFIG_X86
1588 switch (mtrr) { 1586 switch (mtrr) {
@@ -1738,7 +1736,7 @@ static struct attribute_group uvesafb_dev_attgrp = {
1738 .attrs = uvesafb_dev_attrs, 1736 .attrs = uvesafb_dev_attrs,
1739}; 1737};
1740 1738
1741static int __devinit uvesafb_probe(struct platform_device *dev) 1739static int uvesafb_probe(struct platform_device *dev)
1742{ 1740{
1743 struct fb_info *info; 1741 struct fb_info *info;
1744 struct vbe_mode_ib *mode = NULL; 1742 struct vbe_mode_ib *mode = NULL;
@@ -1882,7 +1880,7 @@ static struct platform_driver uvesafb_driver = {
1882static struct platform_device *uvesafb_device; 1880static struct platform_device *uvesafb_device;
1883 1881
1884#ifndef MODULE 1882#ifndef MODULE
1885static int __devinit uvesafb_setup(char *options) 1883static int uvesafb_setup(char *options)
1886{ 1884{
1887 char *this_opt; 1885 char *this_opt;
1888 1886
@@ -1950,7 +1948,7 @@ static ssize_t store_v86d(struct device_driver *dev, const char *buf,
1950 1948
1951static DRIVER_ATTR(v86d, S_IRUGO | S_IWUSR, show_v86d, store_v86d); 1949static DRIVER_ATTR(v86d, S_IRUGO | S_IWUSR, show_v86d, store_v86d);
1952 1950
1953static int __devinit uvesafb_init(void) 1951static int uvesafb_init(void)
1954{ 1952{
1955 int err; 1953 int err;
1956 1954
@@ -1994,7 +1992,7 @@ static int __devinit uvesafb_init(void)
1994 1992
1995module_init(uvesafb_init); 1993module_init(uvesafb_init);
1996 1994
1997static void __devexit uvesafb_exit(void) 1995static void uvesafb_exit(void)
1998{ 1996{
1999 struct uvesafb_ktask *task; 1997 struct uvesafb_ktask *task;
2000 1998
diff --git a/drivers/video/vermilion/vermilion.c b/drivers/video/vermilion/vermilion.c
index 4709edc3cb7f..0aa516fc59cd 100644
--- a/drivers/video/vermilion/vermilion.c
+++ b/drivers/video/vermilion/vermilion.c
@@ -393,7 +393,7 @@ static void vmlfb_release_devices(struct vml_par *par)
393 * Free up allocated resources for a device. 393 * Free up allocated resources for a device.
394 */ 394 */
395 395
396static void __devexit vml_pci_remove(struct pci_dev *dev) 396static void vml_pci_remove(struct pci_dev *dev)
397{ 397{
398 struct fb_info *info; 398 struct fb_info *info;
399 struct vml_info *vinfo; 399 struct vml_info *vinfo;
@@ -452,8 +452,7 @@ static void vmlfb_set_pref_pixel_format(struct fb_var_screeninfo *var)
452 * struct per pipe. Currently we have only one pipe. 452 * struct per pipe. Currently we have only one pipe.
453 */ 453 */
454 454
455static int __devinit vml_pci_probe(struct pci_dev *dev, 455static int vml_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
456 const struct pci_device_id *id)
457{ 456{
458 struct vml_info *vinfo; 457 struct vml_info *vinfo;
459 struct fb_info *info; 458 struct fb_info *info;
@@ -1060,7 +1059,7 @@ static struct pci_driver vmlfb_pci_driver = {
1060 .name = "vmlfb", 1059 .name = "vmlfb",
1061 .id_table = vml_ids, 1060 .id_table = vml_ids,
1062 .probe = vml_pci_probe, 1061 .probe = vml_pci_probe,
1063 .remove = __devexit_p(vml_pci_remove) 1062 .remove = vml_pci_remove,
1064}; 1063};
1065 1064
1066static void __exit vmlfb_cleanup(void) 1065static void __exit vmlfb_cleanup(void)
diff --git a/drivers/video/vfb.c b/drivers/video/vfb.c
index c7f692525b88..8bc1f9398945 100644
--- a/drivers/video/vfb.c
+++ b/drivers/video/vfb.c
@@ -78,7 +78,7 @@ static void rvfree(void *mem, unsigned long size)
78 vfree(mem); 78 vfree(mem);
79} 79}
80 80
81static struct fb_var_screeninfo vfb_default __devinitdata = { 81static struct fb_var_screeninfo vfb_default = {
82 .xres = 640, 82 .xres = 640,
83 .yres = 480, 83 .yres = 480,
84 .xres_virtual = 640, 84 .xres_virtual = 640,
@@ -100,7 +100,7 @@ static struct fb_var_screeninfo vfb_default __devinitdata = {
100 .vmode = FB_VMODE_NONINTERLACED, 100 .vmode = FB_VMODE_NONINTERLACED,
101}; 101};
102 102
103static struct fb_fix_screeninfo vfb_fix __devinitdata = { 103static struct fb_fix_screeninfo vfb_fix = {
104 .id = "Virtual FB", 104 .id = "Virtual FB",
105 .type = FB_TYPE_PACKED_PIXELS, 105 .type = FB_TYPE_PACKED_PIXELS,
106 .visual = FB_VISUAL_PSEUDOCOLOR, 106 .visual = FB_VISUAL_PSEUDOCOLOR,
@@ -477,7 +477,7 @@ static int __init vfb_setup(char *options)
477 * Initialisation 477 * Initialisation
478 */ 478 */
479 479
480static int __devinit vfb_probe(struct platform_device *dev) 480static int vfb_probe(struct platform_device *dev)
481{ 481{
482 struct fb_info *info; 482 struct fb_info *info;
483 int retval = -ENOMEM; 483 int retval = -ENOMEM;
diff --git a/drivers/video/vga16fb.c b/drivers/video/vga16fb.c
index 0267acd8dc83..545faeccdb44 100644
--- a/drivers/video/vga16fb.c
+++ b/drivers/video/vga16fb.c
@@ -65,7 +65,7 @@ struct vga16fb_par {
65 65
66/* --------------------------------------------------------------------- */ 66/* --------------------------------------------------------------------- */
67 67
68static struct fb_var_screeninfo vga16fb_defined __devinitdata = { 68static struct fb_var_screeninfo vga16fb_defined = {
69 .xres = 640, 69 .xres = 640,
70 .yres = 480, 70 .yres = 480,
71 .xres_virtual = 640, 71 .xres_virtual = 640,
@@ -85,7 +85,7 @@ static struct fb_var_screeninfo vga16fb_defined __devinitdata = {
85}; 85};
86 86
87/* name should not depend on EGA/VGA */ 87/* name should not depend on EGA/VGA */
88static struct fb_fix_screeninfo vga16fb_fix __devinitdata = { 88static struct fb_fix_screeninfo vga16fb_fix = {
89 .id = "VGA16 VGA", 89 .id = "VGA16 VGA",
90 .smem_start = VGA_FB_PHYS, 90 .smem_start = VGA_FB_PHYS,
91 .smem_len = VGA_FB_PHYS_LEN, 91 .smem_len = VGA_FB_PHYS_LEN,
@@ -1303,7 +1303,7 @@ static int __init vga16fb_setup(char *options)
1303} 1303}
1304#endif 1304#endif
1305 1305
1306static int __devinit vga16fb_probe(struct platform_device *dev) 1306static int vga16fb_probe(struct platform_device *dev)
1307{ 1307{
1308 struct fb_info *info; 1308 struct fb_info *info;
1309 struct vga16fb_par *par; 1309 struct vga16fb_par *par;
@@ -1395,7 +1395,7 @@ static int __devinit vga16fb_probe(struct platform_device *dev)
1395 return ret; 1395 return ret;
1396} 1396}
1397 1397
1398static int __devexit vga16fb_remove(struct platform_device *dev) 1398static int vga16fb_remove(struct platform_device *dev)
1399{ 1399{
1400 struct fb_info *info = platform_get_drvdata(dev); 1400 struct fb_info *info = platform_get_drvdata(dev);
1401 1401
@@ -1407,7 +1407,7 @@ static int __devexit vga16fb_remove(struct platform_device *dev)
1407 1407
1408static struct platform_driver vga16fb_driver = { 1408static struct platform_driver vga16fb_driver = {
1409 .probe = vga16fb_probe, 1409 .probe = vga16fb_probe,
1410 .remove = __devexit_p(vga16fb_remove), 1410 .remove = vga16fb_remove,
1411 .driver = { 1411 .driver = {
1412 .name = "vga16fb", 1412 .name = "vga16fb",
1413 }, 1413 },
diff --git a/drivers/video/via/dvi.c b/drivers/video/via/dvi.c
index 6be72f0ba21d..7789553952d3 100644
--- a/drivers/video/via/dvi.c
+++ b/drivers/video/via/dvi.c
@@ -25,7 +25,7 @@
25static void tmds_register_write(int index, u8 data); 25static void tmds_register_write(int index, u8 data);
26static int tmds_register_read(int index); 26static int tmds_register_read(int index);
27static int tmds_register_read_bytes(int index, u8 *buff, int buff_len); 27static int tmds_register_read_bytes(int index, u8 *buff, int buff_len);
28static void __devinit dvi_get_panel_size_from_DDCv1( 28static void dvi_get_panel_size_from_DDCv1(
29 struct tmds_chip_information *tmds_chip, 29 struct tmds_chip_information *tmds_chip,
30 struct tmds_setting_information *tmds_setting); 30 struct tmds_setting_information *tmds_setting);
31static int viafb_dvi_query_EDID(void); 31static int viafb_dvi_query_EDID(void);
@@ -35,8 +35,8 @@ static inline bool check_tmds_chip(int device_id_subaddr, int device_id)
35 return tmds_register_read(device_id_subaddr) == device_id; 35 return tmds_register_read(device_id_subaddr) == device_id;
36} 36}
37 37
38void __devinit viafb_init_dvi_size(struct tmds_chip_information *tmds_chip, 38void viafb_init_dvi_size(struct tmds_chip_information *tmds_chip,
39 struct tmds_setting_information *tmds_setting) 39 struct tmds_setting_information *tmds_setting)
40{ 40{
41 DEBUG_MSG(KERN_INFO "viafb_init_dvi_size()\n"); 41 DEBUG_MSG(KERN_INFO "viafb_init_dvi_size()\n");
42 42
@@ -47,7 +47,7 @@ void __devinit viafb_init_dvi_size(struct tmds_chip_information *tmds_chip,
47 return; 47 return;
48} 48}
49 49
50bool __devinit viafb_tmds_trasmitter_identify(void) 50bool viafb_tmds_trasmitter_identify(void)
51{ 51{
52 unsigned char sr2a = 0, sr1e = 0, sr3e = 0; 52 unsigned char sr2a = 0, sr1e = 0, sr3e = 0;
53 53
@@ -285,7 +285,7 @@ static int viafb_dvi_query_EDID(void)
285} 285}
286 286
287/* Get Panel Size Using EDID1 Table */ 287/* Get Panel Size Using EDID1 Table */
288static void __devinit dvi_get_panel_size_from_DDCv1( 288static void dvi_get_panel_size_from_DDCv1(
289 struct tmds_chip_information *tmds_chip, 289 struct tmds_chip_information *tmds_chip,
290 struct tmds_setting_information *tmds_setting) 290 struct tmds_setting_information *tmds_setting)
291{ 291{
diff --git a/drivers/video/via/dvi.h b/drivers/video/via/dvi.h
index db757850c216..4c6bfba57d11 100644
--- a/drivers/video/via/dvi.h
+++ b/drivers/video/via/dvi.h
@@ -56,8 +56,8 @@
56int viafb_dvi_sense(void); 56int viafb_dvi_sense(void);
57void viafb_dvi_disable(void); 57void viafb_dvi_disable(void);
58void viafb_dvi_enable(void); 58void viafb_dvi_enable(void);
59bool __devinit viafb_tmds_trasmitter_identify(void); 59bool viafb_tmds_trasmitter_identify(void);
60void __devinit viafb_init_dvi_size(struct tmds_chip_information *tmds_chip, 60void viafb_init_dvi_size(struct tmds_chip_information *tmds_chip,
61 struct tmds_setting_information *tmds_setting); 61 struct tmds_setting_information *tmds_setting);
62void viafb_dvi_set_mode(const struct fb_var_screeninfo *var, 62void viafb_dvi_set_mode(const struct fb_var_screeninfo *var,
63 u16 cxres, u16 cyres, int iga); 63 u16 cxres, u16 cyres, int iga);
diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index 898590db5e14..80233dae358a 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -465,9 +465,9 @@ static struct via_device_mapping device_mapping[] = {
465static struct via_clock clock; 465static struct via_clock clock;
466 466
467static void load_fix_bit_crtc_reg(void); 467static void load_fix_bit_crtc_reg(void);
468static void __devinit init_gfx_chip_info(int chip_type); 468static void init_gfx_chip_info(int chip_type);
469static void __devinit init_tmds_chip_info(void); 469static void init_tmds_chip_info(void);
470static void __devinit init_lvds_chip_info(void); 470static void init_lvds_chip_info(void);
471static void device_screen_off(void); 471static void device_screen_off(void);
472static void device_screen_on(void); 472static void device_screen_on(void);
473static void set_display_channel(void); 473static void set_display_channel(void);
@@ -1507,7 +1507,7 @@ void viafb_fill_crtc_timing(const struct fb_var_screeninfo *var,
1507 viafb_set_vclock(PICOS2KHZ(var->pixclock) * 1000, iga); 1507 viafb_set_vclock(PICOS2KHZ(var->pixclock) * 1000, iga);
1508} 1508}
1509 1509
1510void __devinit viafb_init_chip_info(int chip_type) 1510void viafb_init_chip_info(int chip_type)
1511{ 1511{
1512 via_clock_init(&clock, chip_type); 1512 via_clock_init(&clock, chip_type);
1513 init_gfx_chip_info(chip_type); 1513 init_gfx_chip_info(chip_type);
@@ -1540,7 +1540,7 @@ void viafb_update_device_setting(int hres, int vres, int bpp, int flag)
1540 } 1540 }
1541} 1541}
1542 1542
1543static void __devinit init_gfx_chip_info(int chip_type) 1543static void init_gfx_chip_info(int chip_type)
1544{ 1544{
1545 u8 tmp; 1545 u8 tmp;
1546 1546
@@ -1593,7 +1593,7 @@ static void __devinit init_gfx_chip_info(int chip_type)
1593 } 1593 }
1594} 1594}
1595 1595
1596static void __devinit init_tmds_chip_info(void) 1596static void init_tmds_chip_info(void)
1597{ 1597{
1598 viafb_tmds_trasmitter_identify(); 1598 viafb_tmds_trasmitter_identify();
1599 1599
@@ -1638,7 +1638,7 @@ static void __devinit init_tmds_chip_info(void)
1638 &viaparinfo->shared->tmds_setting_info); 1638 &viaparinfo->shared->tmds_setting_info);
1639} 1639}
1640 1640
1641static void __devinit init_lvds_chip_info(void) 1641static void init_lvds_chip_info(void)
1642{ 1642{
1643 viafb_lvds_trasmitter_identify(); 1643 viafb_lvds_trasmitter_identify();
1644 viafb_init_lcd_size(); 1644 viafb_init_lcd_size();
@@ -1672,7 +1672,7 @@ static void __devinit init_lvds_chip_info(void)
1672 viaparinfo->chip_info->lvds_chip_info.output_interface); 1672 viaparinfo->chip_info->lvds_chip_info.output_interface);
1673} 1673}
1674 1674
1675void __devinit viafb_init_dac(int set_iga) 1675void viafb_init_dac(int set_iga)
1676{ 1676{
1677 int i; 1677 int i;
1678 u8 tmp; 1678 u8 tmp;
diff --git a/drivers/video/via/hw.h b/drivers/video/via/hw.h
index 6be243cfc823..a8205754c736 100644
--- a/drivers/video/via/hw.h
+++ b/drivers/video/via/hw.h
@@ -663,8 +663,8 @@ void viafb_set_dpa_gfx(int output_interface, struct GFX_DPA_SETTING\
663int viafb_setmode(void); 663int viafb_setmode(void);
664void viafb_fill_var_timing_info(struct fb_var_screeninfo *var, 664void viafb_fill_var_timing_info(struct fb_var_screeninfo *var,
665 const struct fb_videomode *mode); 665 const struct fb_videomode *mode);
666void __devinit viafb_init_chip_info(int chip_type); 666void viafb_init_chip_info(int chip_type);
667void __devinit viafb_init_dac(int set_iga); 667void viafb_init_dac(int set_iga);
668int viafb_get_refresh(int hres, int vres, u32 float_refresh); 668int viafb_get_refresh(int hres, int vres, u32 float_refresh);
669void viafb_update_device_setting(int hres, int vres, int bpp, int flag); 669void viafb_update_device_setting(int hres, int vres, int bpp, int flag);
670 670
diff --git a/drivers/video/via/lcd.c b/drivers/video/via/lcd.c
index 165037910536..980ee1b1dcf3 100644
--- a/drivers/video/via/lcd.c
+++ b/drivers/video/via/lcd.c
@@ -49,7 +49,7 @@ static struct _lcd_scaling_factor lcd_scaling_factor_CLE = {
49}; 49};
50 50
51static bool lvds_identify_integratedlvds(void); 51static bool lvds_identify_integratedlvds(void);
52static void __devinit fp_id_to_vindex(int panel_id); 52static void fp_id_to_vindex(int panel_id);
53static int lvds_register_read(int index); 53static int lvds_register_read(int index);
54static void load_lcd_scaling(int set_hres, int set_vres, int panel_hres, 54static void load_lcd_scaling(int set_hres, int set_vres, int panel_hres,
55 int panel_vres); 55 int panel_vres);
@@ -81,7 +81,7 @@ static inline bool check_lvds_chip(int device_id_subaddr, int device_id)
81 return lvds_register_read(device_id_subaddr) == device_id; 81 return lvds_register_read(device_id_subaddr) == device_id;
82} 82}
83 83
84void __devinit viafb_init_lcd_size(void) 84void viafb_init_lcd_size(void)
85{ 85{
86 DEBUG_MSG(KERN_INFO "viafb_init_lcd_size()\n"); 86 DEBUG_MSG(KERN_INFO "viafb_init_lcd_size()\n");
87 87
@@ -139,7 +139,7 @@ static bool lvds_identify_integratedlvds(void)
139 return true; 139 return true;
140} 140}
141 141
142bool __devinit viafb_lvds_trasmitter_identify(void) 142bool viafb_lvds_trasmitter_identify(void)
143{ 143{
144 if (viafb_lvds_identify_vt1636(VIA_PORT_31)) { 144 if (viafb_lvds_identify_vt1636(VIA_PORT_31)) {
145 viaparinfo->chip_info->lvds_chip_info.i2c_port = VIA_PORT_31; 145 viaparinfo->chip_info->lvds_chip_info.i2c_port = VIA_PORT_31;
@@ -180,7 +180,7 @@ bool __devinit viafb_lvds_trasmitter_identify(void)
180 return false; 180 return false;
181} 181}
182 182
183static void __devinit fp_id_to_vindex(int panel_id) 183static void fp_id_to_vindex(int panel_id)
184{ 184{
185 DEBUG_MSG(KERN_INFO "fp_get_panel_id()\n"); 185 DEBUG_MSG(KERN_INFO "fp_get_panel_id()\n");
186 186
@@ -914,7 +914,7 @@ static void check_diport_of_integrated_lvds(
914 plvds_chip_info->output_interface); 914 plvds_chip_info->output_interface);
915} 915}
916 916
917void __devinit viafb_init_lvds_output_interface(struct lvds_chip_information 917void viafb_init_lvds_output_interface(struct lvds_chip_information
918 *plvds_chip_info, 918 *plvds_chip_info,
919 struct lvds_setting_information 919 struct lvds_setting_information
920 *plvds_setting_info) 920 *plvds_setting_info)
diff --git a/drivers/video/via/lcd.h b/drivers/video/via/lcd.h
index 8f3e4e06156c..5c988a063ad5 100644
--- a/drivers/video/via/lcd.h
+++ b/drivers/video/via/lcd.h
@@ -71,15 +71,15 @@ void viafb_enable_lvds_vt1636(struct lvds_setting_information
71 struct lvds_chip_information *plvds_chip_info); 71 struct lvds_chip_information *plvds_chip_info);
72void viafb_lcd_disable(void); 72void viafb_lcd_disable(void);
73void viafb_lcd_enable(void); 73void viafb_lcd_enable(void);
74void __devinit viafb_init_lcd_size(void); 74void viafb_init_lcd_size(void);
75void __devinit viafb_init_lvds_output_interface(struct lvds_chip_information 75void viafb_init_lvds_output_interface(struct lvds_chip_information
76 *plvds_chip_info, 76 *plvds_chip_info,
77 struct lvds_setting_information 77 struct lvds_setting_information
78 *plvds_setting_info); 78 *plvds_setting_info);
79void viafb_lcd_set_mode(const struct fb_var_screeninfo *var, u16 cxres, 79void viafb_lcd_set_mode(const struct fb_var_screeninfo *var, u16 cxres,
80 u16 cyres, struct lvds_setting_information *plvds_setting_info, 80 u16 cyres, struct lvds_setting_information *plvds_setting_info,
81 struct lvds_chip_information *plvds_chip_info); 81 struct lvds_chip_information *plvds_chip_info);
82bool __devinit viafb_lvds_trasmitter_identify(void); 82bool viafb_lvds_trasmitter_identify(void);
83void viafb_init_lvds_output_interface(struct lvds_chip_information 83void viafb_init_lvds_output_interface(struct lvds_chip_information
84 *plvds_chip_info, 84 *plvds_chip_info,
85 struct lvds_setting_information 85 struct lvds_setting_information
diff --git a/drivers/video/via/via-core.c b/drivers/video/via/via-core.c
index dd58b530c0df..6e274825fb31 100644
--- a/drivers/video/via/via-core.c
+++ b/drivers/video/via/via-core.c
@@ -80,7 +80,7 @@ static inline int viafb_mmio_read(int reg)
80 */ 80 */
81static u32 viafb_enabled_ints; 81static u32 viafb_enabled_ints;
82 82
83static void __devinit viafb_int_init(void) 83static void viafb_int_init(void)
84{ 84{
85 viafb_enabled_ints = 0; 85 viafb_enabled_ints = 0;
86 86
@@ -475,7 +475,7 @@ static int viafb_get_fb_size_from_pci(int chip_type)
475/* 475/*
476 * Figure out and map our MMIO regions. 476 * Figure out and map our MMIO regions.
477 */ 477 */
478static int __devinit via_pci_setup_mmio(struct viafb_dev *vdev) 478static int via_pci_setup_mmio(struct viafb_dev *vdev)
479{ 479{
480 int ret; 480 int ret;
481 /* 481 /*
@@ -550,8 +550,8 @@ static struct viafb_subdev_info {
550}; 550};
551#define N_SUBDEVS ARRAY_SIZE(viafb_subdevs) 551#define N_SUBDEVS ARRAY_SIZE(viafb_subdevs)
552 552
553static int __devinit via_create_subdev(struct viafb_dev *vdev, 553static int via_create_subdev(struct viafb_dev *vdev,
554 struct viafb_subdev_info *info) 554 struct viafb_subdev_info *info)
555{ 555{
556 int ret; 556 int ret;
557 557
@@ -573,7 +573,7 @@ static int __devinit via_create_subdev(struct viafb_dev *vdev,
573 return ret; 573 return ret;
574} 574}
575 575
576static int __devinit via_setup_subdevs(struct viafb_dev *vdev) 576static int via_setup_subdevs(struct viafb_dev *vdev)
577{ 577{
578 int i; 578 int i;
579 579
@@ -671,8 +671,7 @@ static int via_resume(struct pci_dev *pdev)
671} 671}
672#endif /* CONFIG_PM */ 672#endif /* CONFIG_PM */
673 673
674static int __devinit via_pci_probe(struct pci_dev *pdev, 674static int via_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
675 const struct pci_device_id *ent)
676{ 675{
677 int ret; 676 int ret;
678 677
@@ -716,7 +715,7 @@ out_disable:
716 return ret; 715 return ret;
717} 716}
718 717
719static void __devexit via_pci_remove(struct pci_dev *pdev) 718static void via_pci_remove(struct pci_dev *pdev)
720{ 719{
721 via_teardown_subdevs(); 720 via_teardown_subdevs();
722 via_fb_pci_remove(pdev); 721 via_fb_pci_remove(pdev);
@@ -725,7 +724,7 @@ static void __devexit via_pci_remove(struct pci_dev *pdev)
725} 724}
726 725
727 726
728static struct pci_device_id via_pci_table[] __devinitdata = { 727static struct pci_device_id via_pci_table[] = {
729 { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_CLE266_DID), 728 { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_CLE266_DID),
730 .driver_data = UNICHROME_CLE266 }, 729 .driver_data = UNICHROME_CLE266 },
731 { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_K400_DID), 730 { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_K400_DID),
@@ -760,7 +759,7 @@ static struct pci_driver via_driver = {
760 .name = "viafb", 759 .name = "viafb",
761 .id_table = via_pci_table, 760 .id_table = via_pci_table,
762 .probe = via_pci_probe, 761 .probe = via_pci_probe,
763 .remove = __devexit_p(via_pci_remove), 762 .remove = via_pci_remove,
764#ifdef CONFIG_PM 763#ifdef CONFIG_PM
765 .suspend = via_suspend, 764 .suspend = via_suspend,
766 .resume = via_resume, 765 .resume = via_resume,
diff --git a/drivers/video/via/via-gpio.c b/drivers/video/via/via-gpio.c
index d69cfef7c338..e408679081ab 100644
--- a/drivers/video/via/via-gpio.c
+++ b/drivers/video/via/via-gpio.c
@@ -212,7 +212,7 @@ EXPORT_SYMBOL_GPL(viafb_gpio_lookup);
212/* 212/*
213 * Platform device stuff. 213 * Platform device stuff.
214 */ 214 */
215static __devinit int viafb_gpio_probe(struct platform_device *platdev) 215static int viafb_gpio_probe(struct platform_device *platdev)
216{ 216{
217 struct viafb_dev *vdev = platdev->dev.platform_data; 217 struct viafb_dev *vdev = platdev->dev.platform_data;
218 struct via_port_cfg *port_cfg = vdev->port_cfg; 218 struct via_port_cfg *port_cfg = vdev->port_cfg;
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index c80e770e1800..325c43c6ff97 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -1072,7 +1072,7 @@ static int __init parse_active_dev(void)
1072 return 0; 1072 return 0;
1073} 1073}
1074 1074
1075static int __devinit parse_port(char *opt_str, int *output_interface) 1075static int parse_port(char *opt_str, int *output_interface)
1076{ 1076{
1077 if (!strncmp(opt_str, "DVP0", 4)) 1077 if (!strncmp(opt_str, "DVP0", 4))
1078 *output_interface = INTERFACE_DVP0; 1078 *output_interface = INTERFACE_DVP0;
@@ -1089,7 +1089,7 @@ static int __devinit parse_port(char *opt_str, int *output_interface)
1089 return 0; 1089 return 0;
1090} 1090}
1091 1091
1092static void __devinit parse_lcd_port(void) 1092static void parse_lcd_port(void)
1093{ 1093{
1094 parse_port(viafb_lcd_port, &viaparinfo->chip_info->lvds_chip_info. 1094 parse_port(viafb_lcd_port, &viaparinfo->chip_info->lvds_chip_info.
1095 output_interface); 1095 output_interface);
@@ -1102,7 +1102,7 @@ static void __devinit parse_lcd_port(void)
1102 output_interface); 1102 output_interface);
1103} 1103}
1104 1104
1105static void __devinit parse_dvi_port(void) 1105static void parse_dvi_port(void)
1106{ 1106{
1107 parse_port(viafb_dvi_port, &viaparinfo->chip_info->tmds_chip_info. 1107 parse_port(viafb_dvi_port, &viaparinfo->chip_info->tmds_chip_info.
1108 output_interface); 1108 output_interface);
@@ -1727,7 +1727,7 @@ static struct viafb_pm_hooks viafb_fb_pm_hooks = {
1727 1727
1728#endif 1728#endif
1729 1729
1730static void __devinit i2c_bus_probe(struct viafb_shared *shared) 1730static void i2c_bus_probe(struct viafb_shared *shared)
1731{ 1731{
1732 /* should be always CRT */ 1732 /* should be always CRT */
1733 printk(KERN_INFO "viafb: Probing I2C bus 0x26\n"); 1733 printk(KERN_INFO "viafb: Probing I2C bus 0x26\n");
@@ -1753,7 +1753,7 @@ static void i2c_bus_free(struct viafb_shared *shared)
1753 via_aux_free(shared->i2c_2C); 1753 via_aux_free(shared->i2c_2C);
1754} 1754}
1755 1755
1756int __devinit via_fb_pci_probe(struct viafb_dev *vdev) 1756int via_fb_pci_probe(struct viafb_dev *vdev)
1757{ 1757{
1758 u32 default_xres, default_yres; 1758 u32 default_xres, default_yres;
1759 struct fb_var_screeninfo default_var; 1759 struct fb_var_screeninfo default_var;
@@ -1945,7 +1945,7 @@ out_fb_release:
1945 return rc; 1945 return rc;
1946} 1946}
1947 1947
1948void __devexit via_fb_pci_remove(struct pci_dev *pdev) 1948void via_fb_pci_remove(struct pci_dev *pdev)
1949{ 1949{
1950 DEBUG_MSG(KERN_INFO "via_pci_remove!\n"); 1950 DEBUG_MSG(KERN_INFO "via_pci_remove!\n");
1951 fb_dealloc_cmap(&viafbinfo->cmap); 1951 fb_dealloc_cmap(&viafbinfo->cmap);
diff --git a/drivers/video/vt8500lcdfb.c b/drivers/video/vt8500lcdfb.c
index 9af8da70e781..aa2579c2364a 100644
--- a/drivers/video/vt8500lcdfb.c
+++ b/drivers/video/vt8500lcdfb.c
@@ -273,7 +273,7 @@ static irqreturn_t vt8500lcd_handle_irq(int irq, void *dev_id)
273 return IRQ_HANDLED; 273 return IRQ_HANDLED;
274} 274}
275 275
276static int __devinit vt8500lcd_probe(struct platform_device *pdev) 276static int vt8500lcd_probe(struct platform_device *pdev)
277{ 277{
278 struct vt8500lcd_info *fbi; 278 struct vt8500lcd_info *fbi;
279 struct resource *res; 279 struct resource *res;
@@ -469,7 +469,7 @@ failed:
469 return ret; 469 return ret;
470} 470}
471 471
472static int __devexit vt8500lcd_remove(struct platform_device *pdev) 472static int vt8500lcd_remove(struct platform_device *pdev)
473{ 473{
474 struct vt8500lcd_info *fbi = platform_get_drvdata(pdev); 474 struct vt8500lcd_info *fbi = platform_get_drvdata(pdev);
475 struct resource *res; 475 struct resource *res;
@@ -505,7 +505,7 @@ static const struct of_device_id via_dt_ids[] = {
505 505
506static struct platform_driver vt8500lcd_driver = { 506static struct platform_driver vt8500lcd_driver = {
507 .probe = vt8500lcd_probe, 507 .probe = vt8500lcd_probe,
508 .remove = __devexit_p(vt8500lcd_remove), 508 .remove = vt8500lcd_remove,
509 .driver = { 509 .driver = {
510 .owner = THIS_MODULE, 510 .owner = THIS_MODULE,
511 .name = "vt8500-lcd", 511 .name = "vt8500-lcd",
diff --git a/drivers/video/vt8623fb.c b/drivers/video/vt8623fb.c
index 4e74d262cf3e..e9557fa014ee 100644
--- a/drivers/video/vt8623fb.c
+++ b/drivers/video/vt8623fb.c
@@ -660,7 +660,7 @@ static struct fb_ops vt8623fb_ops = {
660 660
661/* PCI probe */ 661/* PCI probe */
662 662
663static int __devinit vt8623_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) 663static int vt8623_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
664{ 664{
665 struct pci_bus_region bus_reg; 665 struct pci_bus_region bus_reg;
666 struct resource vga_res; 666 struct resource vga_res;
@@ -807,7 +807,7 @@ err_enable_device:
807 807
808/* PCI remove */ 808/* PCI remove */
809 809
810static void __devexit vt8623_pci_remove(struct pci_dev *dev) 810static void vt8623_pci_remove(struct pci_dev *dev)
811{ 811{
812 struct fb_info *info = pci_get_drvdata(dev); 812 struct fb_info *info = pci_get_drvdata(dev);
813 813
@@ -906,7 +906,7 @@ fail:
906 906
907/* List of boards that we are trying to support */ 907/* List of boards that we are trying to support */
908 908
909static struct pci_device_id vt8623_devices[] __devinitdata = { 909static struct pci_device_id vt8623_devices[] = {
910 {PCI_DEVICE(PCI_VENDOR_ID_VIA, 0x3122)}, 910 {PCI_DEVICE(PCI_VENDOR_ID_VIA, 0x3122)},
911 {0, 0, 0, 0, 0, 0, 0} 911 {0, 0, 0, 0, 0, 0, 0}
912}; 912};
@@ -917,7 +917,7 @@ static struct pci_driver vt8623fb_pci_driver = {
917 .name = "vt8623fb", 917 .name = "vt8623fb",
918 .id_table = vt8623_devices, 918 .id_table = vt8623_devices,
919 .probe = vt8623_pci_probe, 919 .probe = vt8623_pci_probe,
920 .remove = __devexit_p(vt8623_pci_remove), 920 .remove = vt8623_pci_remove,
921 .suspend = vt8623_pci_suspend, 921 .suspend = vt8623_pci_suspend,
922 .resume = vt8623_pci_resume, 922 .resume = vt8623_pci_resume,
923}; 923};
diff --git a/drivers/video/w100fb.c b/drivers/video/w100fb.c
index 2f6b2b835f88..7a299e951f75 100644
--- a/drivers/video/w100fb.c
+++ b/drivers/video/w100fb.c
@@ -54,7 +54,7 @@ static void w100_update_enable(void);
54static void w100_update_disable(void); 54static void w100_update_disable(void);
55static void calc_hsync(struct w100fb_par *par); 55static void calc_hsync(struct w100fb_par *par);
56static void w100_init_graphic_engine(struct w100fb_par *par); 56static void w100_init_graphic_engine(struct w100fb_par *par);
57struct w100_pll_info *w100_get_xtal_table(unsigned int freq) __devinit; 57struct w100_pll_info *w100_get_xtal_table(unsigned int freq);
58 58
59/* Pseudo palette size */ 59/* Pseudo palette size */
60#define MAX_PALETTES 16 60#define MAX_PALETTES 16
@@ -630,7 +630,7 @@ static int w100fb_resume(struct platform_device *dev)
630#endif 630#endif
631 631
632 632
633int __devinit w100fb_probe(struct platform_device *pdev) 633int w100fb_probe(struct platform_device *pdev)
634{ 634{
635 int err = -EIO; 635 int err = -EIO;
636 struct w100fb_mach_info *inf; 636 struct w100fb_mach_info *inf;
@@ -783,7 +783,7 @@ out:
783} 783}
784 784
785 785
786static int __devexit w100fb_remove(struct platform_device *pdev) 786static int w100fb_remove(struct platform_device *pdev)
787{ 787{
788 struct fb_info *info = platform_get_drvdata(pdev); 788 struct fb_info *info = platform_get_drvdata(pdev);
789 struct w100fb_par *par=info->par; 789 struct w100fb_par *par=info->par;
@@ -1021,7 +1021,7 @@ static struct pll_entries {
1021 { 0 }, 1021 { 0 },
1022}; 1022};
1023 1023
1024struct w100_pll_info __devinit *w100_get_xtal_table(unsigned int freq) 1024struct w100_pll_info *w100_get_xtal_table(unsigned int freq)
1025{ 1025{
1026 struct pll_entries *pll_entry = w100_pll_tables; 1026 struct pll_entries *pll_entry = w100_pll_tables;
1027 1027
@@ -1624,7 +1624,7 @@ static void w100_vsync(void)
1624 1624
1625static struct platform_driver w100fb_driver = { 1625static struct platform_driver w100fb_driver = {
1626 .probe = w100fb_probe, 1626 .probe = w100fb_probe,
1627 .remove = __devexit_p(w100fb_remove), 1627 .remove = w100fb_remove,
1628 .suspend = w100fb_suspend, 1628 .suspend = w100fb_suspend,
1629 .resume = w100fb_resume, 1629 .resume = w100fb_resume,
1630 .driver = { 1630 .driver = {
diff --git a/drivers/video/wm8505fb.c b/drivers/video/wm8505fb.c
index 77539c1b56a0..4dd0580f96fd 100644
--- a/drivers/video/wm8505fb.c
+++ b/drivers/video/wm8505fb.c
@@ -260,7 +260,7 @@ static struct fb_ops wm8505fb_ops = {
260 .fb_blank = wm8505fb_blank, 260 .fb_blank = wm8505fb_blank,
261}; 261};
262 262
263static int __devinit wm8505fb_probe(struct platform_device *pdev) 263static int wm8505fb_probe(struct platform_device *pdev)
264{ 264{
265 struct wm8505fb_info *fbi; 265 struct wm8505fb_info *fbi;
266 struct resource *res; 266 struct resource *res;
@@ -431,7 +431,7 @@ failed:
431 return ret; 431 return ret;
432} 432}
433 433
434static int __devexit wm8505fb_remove(struct platform_device *pdev) 434static int wm8505fb_remove(struct platform_device *pdev)
435{ 435{
436 struct wm8505fb_info *fbi = platform_get_drvdata(pdev); 436 struct wm8505fb_info *fbi = platform_get_drvdata(pdev);
437 struct resource *res; 437 struct resource *res;
@@ -462,7 +462,7 @@ static const struct of_device_id wmt_dt_ids[] = {
462 462
463static struct platform_driver wm8505fb_driver = { 463static struct platform_driver wm8505fb_driver = {
464 .probe = wm8505fb_probe, 464 .probe = wm8505fb_probe,
465 .remove = __devexit_p(wm8505fb_remove), 465 .remove = wm8505fb_remove,
466 .driver = { 466 .driver = {
467 .owner = THIS_MODULE, 467 .owner = THIS_MODULE,
468 .name = DRIVER_NAME, 468 .name = DRIVER_NAME,
diff --git a/drivers/video/wmt_ge_rops.c b/drivers/video/wmt_ge_rops.c
index ba025b4c7d09..4aaeb18223bc 100644
--- a/drivers/video/wmt_ge_rops.c
+++ b/drivers/video/wmt_ge_rops.c
@@ -124,7 +124,7 @@ int wmt_ge_sync(struct fb_info *p)
124} 124}
125EXPORT_SYMBOL_GPL(wmt_ge_sync); 125EXPORT_SYMBOL_GPL(wmt_ge_sync);
126 126
127static int __devinit wmt_ge_rops_probe(struct platform_device *pdev) 127static int wmt_ge_rops_probe(struct platform_device *pdev)
128{ 128{
129 struct resource *res; 129 struct resource *res;
130 130
@@ -152,7 +152,7 @@ static int __devinit wmt_ge_rops_probe(struct platform_device *pdev)
152 return 0; 152 return 0;
153} 153}
154 154
155static int __devexit wmt_ge_rops_remove(struct platform_device *pdev) 155static int wmt_ge_rops_remove(struct platform_device *pdev)
156{ 156{
157 iounmap(regbase); 157 iounmap(regbase);
158 return 0; 158 return 0;
@@ -165,7 +165,7 @@ static const struct of_device_id wmt_dt_ids[] = {
165 165
166static struct platform_driver wmt_ge_rops_driver = { 166static struct platform_driver wmt_ge_rops_driver = {
167 .probe = wmt_ge_rops_probe, 167 .probe = wmt_ge_rops_probe,
168 .remove = __devexit_p(wmt_ge_rops_remove), 168 .remove = wmt_ge_rops_remove,
169 .driver = { 169 .driver = {
170 .owner = THIS_MODULE, 170 .owner = THIS_MODULE,
171 .name = "wmt_ge_rops", 171 .name = "wmt_ge_rops",
diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c
index 917bb5681684..cd005c227a23 100644
--- a/drivers/video/xen-fbfront.c
+++ b/drivers/video/xen-fbfront.c
@@ -358,8 +358,8 @@ static irqreturn_t xenfb_event_handler(int rq, void *dev_id)
358 return IRQ_HANDLED; 358 return IRQ_HANDLED;
359} 359}
360 360
361static int __devinit xenfb_probe(struct xenbus_device *dev, 361static int xenfb_probe(struct xenbus_device *dev,
362 const struct xenbus_device_id *id) 362 const struct xenbus_device_id *id)
363{ 363{
364 struct xenfb_info *info; 364 struct xenfb_info *info;
365 struct fb_info *fb_info; 365 struct fb_info *fb_info;
@@ -487,8 +487,7 @@ error:
487 return ret; 487 return ret;
488} 488}
489 489
490static __devinit void 490static void xenfb_make_preferred_console(void)
491xenfb_make_preferred_console(void)
492{ 491{
493 struct console *c; 492 struct console *c;
494 493
diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c
index 18084525402a..af0b4fdf9aa9 100644
--- a/drivers/video/xilinxfb.c
+++ b/drivers/video/xilinxfb.c
@@ -403,7 +403,7 @@ static int xilinxfb_release(struct device *dev)
403 * OF bus binding 403 * OF bus binding
404 */ 404 */
405 405
406static int __devinit xilinxfb_of_probe(struct platform_device *op) 406static int xilinxfb_of_probe(struct platform_device *op)
407{ 407{
408 const u32 *prop; 408 const u32 *prop;
409 u32 *p; 409 u32 *p;
@@ -485,13 +485,13 @@ static int __devinit xilinxfb_of_probe(struct platform_device *op)
485 return -ENODEV; 485 return -ENODEV;
486} 486}
487 487
488static int __devexit xilinxfb_of_remove(struct platform_device *op) 488static int xilinxfb_of_remove(struct platform_device *op)
489{ 489{
490 return xilinxfb_release(&op->dev); 490 return xilinxfb_release(&op->dev);
491} 491}
492 492
493/* Match table for of_platform binding */ 493/* Match table for of_platform binding */
494static struct of_device_id xilinxfb_of_match[] __devinitdata = { 494static struct of_device_id xilinxfb_of_match[] = {
495 { .compatible = "xlnx,xps-tft-1.00.a", }, 495 { .compatible = "xlnx,xps-tft-1.00.a", },
496 { .compatible = "xlnx,xps-tft-2.00.a", }, 496 { .compatible = "xlnx,xps-tft-2.00.a", },
497 { .compatible = "xlnx,xps-tft-2.01.a", }, 497 { .compatible = "xlnx,xps-tft-2.01.a", },
@@ -503,7 +503,7 @@ MODULE_DEVICE_TABLE(of, xilinxfb_of_match);
503 503
504static struct platform_driver xilinxfb_of_driver = { 504static struct platform_driver xilinxfb_of_driver = {
505 .probe = xilinxfb_of_probe, 505 .probe = xilinxfb_of_probe,
506 .remove = __devexit_p(xilinxfb_of_remove), 506 .remove = xilinxfb_of_remove,
507 .driver = { 507 .driver = {
508 .name = DRIVER_NAME, 508 .name = DRIVER_NAME,
509 .owner = THIS_MODULE, 509 .owner = THIS_MODULE,
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index d19fe3e323b4..797e1c79a104 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -500,7 +500,7 @@ static void remove_common(struct virtio_balloon *vb)
500 vb->vdev->config->del_vqs(vb->vdev); 500 vb->vdev->config->del_vqs(vb->vdev);
501} 501}
502 502
503static void __devexit virtballoon_remove(struct virtio_device *vdev) 503static void virtballoon_remove(struct virtio_device *vdev)
504{ 504{
505 struct virtio_balloon *vb = vdev->priv; 505 struct virtio_balloon *vb = vdev->priv;
506 506
@@ -552,7 +552,7 @@ static struct virtio_driver virtio_balloon_driver = {
552 .driver.owner = THIS_MODULE, 552 .driver.owner = THIS_MODULE,
553 .id_table = id_table, 553 .id_table = id_table,
554 .probe = virtballoon_probe, 554 .probe = virtballoon_probe,
555 .remove = __devexit_p(virtballoon_remove), 555 .remove = virtballoon_remove,
556 .config_changed = virtballoon_changed, 556 .config_changed = virtballoon_changed,
557#ifdef CONFIG_PM 557#ifdef CONFIG_PM
558 .freeze = virtballoon_freeze, 558 .freeze = virtballoon_freeze,
diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
index 634f80bcdbd7..31f966f4d27f 100644
--- a/drivers/virtio/virtio_mmio.c
+++ b/drivers/virtio/virtio_mmio.c
@@ -440,7 +440,7 @@ static struct virtio_config_ops virtio_mmio_config_ops = {
440 440
441/* Platform device */ 441/* Platform device */
442 442
443static int __devinit virtio_mmio_probe(struct platform_device *pdev) 443static int virtio_mmio_probe(struct platform_device *pdev)
444{ 444{
445 struct virtio_mmio_device *vm_dev; 445 struct virtio_mmio_device *vm_dev;
446 struct resource *mem; 446 struct resource *mem;
@@ -493,7 +493,7 @@ static int __devinit virtio_mmio_probe(struct platform_device *pdev)
493 return register_virtio_device(&vm_dev->vdev); 493 return register_virtio_device(&vm_dev->vdev);
494} 494}
495 495
496static int __devexit virtio_mmio_remove(struct platform_device *pdev) 496static int virtio_mmio_remove(struct platform_device *pdev)
497{ 497{
498 struct virtio_mmio_device *vm_dev = platform_get_drvdata(pdev); 498 struct virtio_mmio_device *vm_dev = platform_get_drvdata(pdev);
499 499
@@ -638,7 +638,7 @@ MODULE_DEVICE_TABLE(of, virtio_mmio_match);
638 638
639static struct platform_driver virtio_mmio_driver = { 639static struct platform_driver virtio_mmio_driver = {
640 .probe = virtio_mmio_probe, 640 .probe = virtio_mmio_probe,
641 .remove = __devexit_p(virtio_mmio_remove), 641 .remove = virtio_mmio_remove,
642 .driver = { 642 .driver = {
643 .name = "virtio-mmio", 643 .name = "virtio-mmio",
644 .owner = THIS_MODULE, 644 .owner = THIS_MODULE,
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
index e3ecc94591ad..0c142892c105 100644
--- a/drivers/virtio/virtio_pci.c
+++ b/drivers/virtio/virtio_pci.c
@@ -676,8 +676,8 @@ static void virtio_pci_release_dev(struct device *_d)
676} 676}
677 677
678/* the PCI probing function */ 678/* the PCI probing function */
679static int __devinit virtio_pci_probe(struct pci_dev *pci_dev, 679static int virtio_pci_probe(struct pci_dev *pci_dev,
680 const struct pci_device_id *id) 680 const struct pci_device_id *id)
681{ 681{
682 struct virtio_pci_device *vp_dev; 682 struct virtio_pci_device *vp_dev;
683 int err; 683 int err;
@@ -751,7 +751,7 @@ out:
751 return err; 751 return err;
752} 752}
753 753
754static void __devexit virtio_pci_remove(struct pci_dev *pci_dev) 754static void virtio_pci_remove(struct pci_dev *pci_dev)
755{ 755{
756 struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev); 756 struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev);
757 757
@@ -822,7 +822,7 @@ static struct pci_driver virtio_pci_driver = {
822 .name = "virtio-pci", 822 .name = "virtio-pci",
823 .id_table = virtio_pci_id_table, 823 .id_table = virtio_pci_id_table,
824 .probe = virtio_pci_probe, 824 .probe = virtio_pci_probe,
825 .remove = __devexit_p(virtio_pci_remove), 825 .remove = virtio_pci_remove,
826#ifdef CONFIG_PM 826#ifdef CONFIG_PM
827 .driver.pm = &virtio_pci_pm_ops, 827 .driver.pm = &virtio_pci_pm_ops,
828#endif 828#endif
diff --git a/drivers/vlynq/vlynq.c b/drivers/vlynq/vlynq.c
index aa250cebecd2..7b07135ab26e 100644
--- a/drivers/vlynq/vlynq.c
+++ b/drivers/vlynq/vlynq.c
@@ -772,7 +772,7 @@ static int vlynq_remove(struct platform_device *pdev)
772static struct platform_driver vlynq_platform_driver = { 772static struct platform_driver vlynq_platform_driver = {
773 .driver.name = "vlynq", 773 .driver.name = "vlynq",
774 .probe = vlynq_probe, 774 .probe = vlynq_probe,
775 .remove = __devexit_p(vlynq_remove), 775 .remove = vlynq_remove,
776}; 776};
777 777
778struct bus_type vlynq_bus_type = { 778struct bus_type vlynq_bus_type = {
@@ -783,7 +783,7 @@ struct bus_type vlynq_bus_type = {
783}; 783};
784EXPORT_SYMBOL(vlynq_bus_type); 784EXPORT_SYMBOL(vlynq_bus_type);
785 785
786static int __devinit vlynq_init(void) 786static int vlynq_init(void)
787{ 787{
788 int res = 0; 788 int res = 0;
789 789
@@ -803,7 +803,7 @@ fail_bus:
803 return res; 803 return res;
804} 804}
805 805
806static void __devexit vlynq_exit(void) 806static void vlynq_exit(void)
807{ 807{
808 platform_driver_unregister(&vlynq_platform_driver); 808 platform_driver_unregister(&vlynq_platform_driver);
809 bus_unregister(&vlynq_bus_type); 809 bus_unregister(&vlynq_bus_type);
diff --git a/drivers/w1/masters/mxc_w1.c b/drivers/w1/masters/mxc_w1.c
index d338b56ea2f0..708a25fc9961 100644
--- a/drivers/w1/masters/mxc_w1.c
+++ b/drivers/w1/masters/mxc_w1.c
@@ -191,7 +191,7 @@ static struct platform_driver mxc_w1_driver = {
191 .name = "mxc_w1", 191 .name = "mxc_w1",
192 }, 192 },
193 .probe = mxc_w1_probe, 193 .probe = mxc_w1_probe,
194 .remove = __devexit_p(mxc_w1_remove), 194 .remove = mxc_w1_remove,
195}; 195};
196module_platform_driver(mxc_w1_driver); 196module_platform_driver(mxc_w1_driver);
197 197
diff --git a/drivers/watchdog/da9055_wdt.c b/drivers/watchdog/da9055_wdt.c
index 709ea1aefebb..f5ad10546fc9 100644
--- a/drivers/watchdog/da9055_wdt.c
+++ b/drivers/watchdog/da9055_wdt.c
@@ -72,20 +72,21 @@ static int da9055_wdt_set_timeout(struct watchdog_device *wdt_dev,
72 DA9055_TWDSCALE_MASK, 72 DA9055_TWDSCALE_MASK,
73 da9055_wdt_maps[i].reg_val << 73 da9055_wdt_maps[i].reg_val <<
74 DA9055_TWDSCALE_SHIFT); 74 DA9055_TWDSCALE_SHIFT);
75 if (ret < 0) 75 if (ret < 0) {
76 dev_err(da9055->dev, 76 dev_err(da9055->dev,
77 "Failed to update timescale bit, %d\n", ret); 77 "Failed to update timescale bit, %d\n", ret);
78 return ret;
79 }
78 80
79 wdt_dev->timeout = timeout; 81 wdt_dev->timeout = timeout;
80 82
81 return ret; 83 return 0;
82} 84}
83 85
84static int da9055_wdt_ping(struct watchdog_device *wdt_dev) 86static int da9055_wdt_ping(struct watchdog_device *wdt_dev)
85{ 87{
86 struct da9055_wdt_data *driver_data = watchdog_get_drvdata(wdt_dev); 88 struct da9055_wdt_data *driver_data = watchdog_get_drvdata(wdt_dev);
87 struct da9055 *da9055 = driver_data->da9055; 89 struct da9055 *da9055 = driver_data->da9055;
88 int ret;
89 90
90 /* 91 /*
91 * We have a minimum time for watchdog window called TWDMIN. A write 92 * We have a minimum time for watchdog window called TWDMIN. A write
@@ -94,18 +95,12 @@ static int da9055_wdt_ping(struct watchdog_device *wdt_dev)
94 mdelay(DA9055_TWDMIN); 95 mdelay(DA9055_TWDMIN);
95 96
96 /* Reset the watchdog timer */ 97 /* Reset the watchdog timer */
97 ret = da9055_reg_update(da9055, DA9055_REG_CONTROL_E, 98 return da9055_reg_update(da9055, DA9055_REG_CONTROL_E,
98 DA9055_WATCHDOG_MASK, 1); 99 DA9055_WATCHDOG_MASK, 1);
99
100 return ret;
101} 100}
102 101
103static void da9055_wdt_release_resources(struct kref *r) 102static void da9055_wdt_release_resources(struct kref *r)
104{ 103{
105 struct da9055_wdt_data *driver_data =
106 container_of(r, struct da9055_wdt_data, kref);
107
108 kfree(driver_data);
109} 104}
110 105
111static void da9055_wdt_ref(struct watchdog_device *wdt_dev) 106static void da9055_wdt_ref(struct watchdog_device *wdt_dev)
diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index 34ed61ea02b4..b0e541d022e6 100644
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -296,7 +296,6 @@ static int omap_wdt_remove(struct platform_device *pdev)
296{ 296{
297 struct watchdog_device *wdog = platform_get_drvdata(pdev); 297 struct watchdog_device *wdog = platform_get_drvdata(pdev);
298 struct omap_wdt_dev *wdev = watchdog_get_drvdata(wdog); 298 struct omap_wdt_dev *wdev = watchdog_get_drvdata(wdog);
299 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
300 299
301 pm_runtime_disable(wdev->dev); 300 pm_runtime_disable(wdev->dev);
302 watchdog_unregister_device(wdog); 301 watchdog_unregister_device(wdog);
diff --git a/drivers/watchdog/twl4030_wdt.c b/drivers/watchdog/twl4030_wdt.c
index 81918cf8993b..0f03106f7516 100644
--- a/drivers/watchdog/twl4030_wdt.c
+++ b/drivers/watchdog/twl4030_wdt.c
@@ -131,14 +131,21 @@ static int twl4030_wdt_resume(struct platform_device *pdev)
131#define twl4030_wdt_resume NULL 131#define twl4030_wdt_resume NULL
132#endif 132#endif
133 133
134static const struct of_device_id twl_wdt_of_match[] = {
135 { .compatible = "ti,twl4030-wdt", },
136 { },
137};
138MODULE_DEVICE_TABLE(of, twl_wdt_of_match);
139
134static struct platform_driver twl4030_wdt_driver = { 140static struct platform_driver twl4030_wdt_driver = {
135 .probe = twl4030_wdt_probe, 141 .probe = twl4030_wdt_probe,
136 .remove = twl4030_wdt_remove, 142 .remove = twl4030_wdt_remove,
137 .suspend = twl4030_wdt_suspend, 143 .suspend = twl4030_wdt_suspend,
138 .resume = twl4030_wdt_resume, 144 .resume = twl4030_wdt_resume,
139 .driver = { 145 .driver = {
140 .owner = THIS_MODULE, 146 .owner = THIS_MODULE,
141 .name = "twl4030_wdt", 147 .name = "twl4030_wdt",
148 .of_match_table = twl_wdt_of_match,
142 }, 149 },
143}; 150};
144 151
diff --git a/drivers/xen/cpu_hotplug.c b/drivers/xen/cpu_hotplug.c
index 4dcfced107f5..084041d42c9a 100644
--- a/drivers/xen/cpu_hotplug.c
+++ b/drivers/xen/cpu_hotplug.c
@@ -25,10 +25,10 @@ static void disable_hotplug_cpu(int cpu)
25static int vcpu_online(unsigned int cpu) 25static int vcpu_online(unsigned int cpu)
26{ 26{
27 int err; 27 int err;
28 char dir[32], state[32]; 28 char dir[16], state[16];
29 29
30 sprintf(dir, "cpu/%u", cpu); 30 sprintf(dir, "cpu/%u", cpu);
31 err = xenbus_scanf(XBT_NIL, dir, "availability", "%s", state); 31 err = xenbus_scanf(XBT_NIL, dir, "availability", "%15s", state);
32 if (err != 1) { 32 if (err != 1) {
33 if (!xen_initial_domain()) 33 if (!xen_initial_domain())
34 printk(KERN_ERR "XENBUS: Unable to read cpu state\n"); 34 printk(KERN_ERR "XENBUS: Unable to read cpu state\n");
diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
index 2e22df2f7a3f..3c8803feba26 100644
--- a/drivers/xen/gntdev.c
+++ b/drivers/xen/gntdev.c
@@ -56,10 +56,15 @@ MODULE_PARM_DESC(limit, "Maximum number of grants that may be mapped by "
56static atomic_t pages_mapped = ATOMIC_INIT(0); 56static atomic_t pages_mapped = ATOMIC_INIT(0);
57 57
58static int use_ptemod; 58static int use_ptemod;
59#define populate_freeable_maps use_ptemod
59 60
60struct gntdev_priv { 61struct gntdev_priv {
62 /* maps with visible offsets in the file descriptor */
61 struct list_head maps; 63 struct list_head maps;
62 /* lock protects maps from concurrent changes */ 64 /* maps that are not visible; will be freed on munmap.
65 * Only populated if populate_freeable_maps == 1 */
66 struct list_head freeable_maps;
67 /* lock protects maps and freeable_maps */
63 spinlock_t lock; 68 spinlock_t lock;
64 struct mm_struct *mm; 69 struct mm_struct *mm;
65 struct mmu_notifier mn; 70 struct mmu_notifier mn;
@@ -193,7 +198,7 @@ static struct grant_map *gntdev_find_map_index(struct gntdev_priv *priv,
193 return NULL; 198 return NULL;
194} 199}
195 200
196static void gntdev_put_map(struct grant_map *map) 201static void gntdev_put_map(struct gntdev_priv *priv, struct grant_map *map)
197{ 202{
198 if (!map) 203 if (!map)
199 return; 204 return;
@@ -208,6 +213,12 @@ static void gntdev_put_map(struct grant_map *map)
208 evtchn_put(map->notify.event); 213 evtchn_put(map->notify.event);
209 } 214 }
210 215
216 if (populate_freeable_maps && priv) {
217 spin_lock(&priv->lock);
218 list_del(&map->next);
219 spin_unlock(&priv->lock);
220 }
221
211 if (map->pages && !use_ptemod) 222 if (map->pages && !use_ptemod)
212 unmap_grant_pages(map, 0, map->count); 223 unmap_grant_pages(map, 0, map->count);
213 gntdev_free_map(map); 224 gntdev_free_map(map);
@@ -301,17 +312,10 @@ static int __unmap_grant_pages(struct grant_map *map, int offset, int pages)
301 312
302 if (map->notify.flags & UNMAP_NOTIFY_CLEAR_BYTE) { 313 if (map->notify.flags & UNMAP_NOTIFY_CLEAR_BYTE) {
303 int pgno = (map->notify.addr >> PAGE_SHIFT); 314 int pgno = (map->notify.addr >> PAGE_SHIFT);
304 if (pgno >= offset && pgno < offset + pages && use_ptemod) { 315 if (pgno >= offset && pgno < offset + pages) {
305 void __user *tmp = (void __user *) 316 /* No need for kmap, pages are in lowmem */
306 map->vma->vm_start + map->notify.addr; 317 uint8_t *tmp = pfn_to_kaddr(page_to_pfn(map->pages[pgno]));
307 err = copy_to_user(tmp, &err, 1);
308 if (err)
309 return -EFAULT;
310 map->notify.flags &= ~UNMAP_NOTIFY_CLEAR_BYTE;
311 } else if (pgno >= offset && pgno < offset + pages) {
312 uint8_t *tmp = kmap(map->pages[pgno]);
313 tmp[map->notify.addr & (PAGE_SIZE-1)] = 0; 318 tmp[map->notify.addr & (PAGE_SIZE-1)] = 0;
314 kunmap(map->pages[pgno]);
315 map->notify.flags &= ~UNMAP_NOTIFY_CLEAR_BYTE; 319 map->notify.flags &= ~UNMAP_NOTIFY_CLEAR_BYTE;
316 } 320 }
317 } 321 }
@@ -376,11 +380,24 @@ static void gntdev_vma_open(struct vm_area_struct *vma)
376static void gntdev_vma_close(struct vm_area_struct *vma) 380static void gntdev_vma_close(struct vm_area_struct *vma)
377{ 381{
378 struct grant_map *map = vma->vm_private_data; 382 struct grant_map *map = vma->vm_private_data;
383 struct file *file = vma->vm_file;
384 struct gntdev_priv *priv = file->private_data;
379 385
380 pr_debug("gntdev_vma_close %p\n", vma); 386 pr_debug("gntdev_vma_close %p\n", vma);
381 map->vma = NULL; 387 if (use_ptemod) {
388 /* It is possible that an mmu notifier could be running
389 * concurrently, so take priv->lock to ensure that the vma won't
390 * vanishing during the unmap_grant_pages call, since we will
391 * spin here until that completes. Such a concurrent call will
392 * not do any unmapping, since that has been done prior to
393 * closing the vma, but it may still iterate the unmap_ops list.
394 */
395 spin_lock(&priv->lock);
396 map->vma = NULL;
397 spin_unlock(&priv->lock);
398 }
382 vma->vm_private_data = NULL; 399 vma->vm_private_data = NULL;
383 gntdev_put_map(map); 400 gntdev_put_map(priv, map);
384} 401}
385 402
386static struct vm_operations_struct gntdev_vmops = { 403static struct vm_operations_struct gntdev_vmops = {
@@ -390,33 +407,43 @@ static struct vm_operations_struct gntdev_vmops = {
390 407
391/* ------------------------------------------------------------------ */ 408/* ------------------------------------------------------------------ */
392 409
410static void unmap_if_in_range(struct grant_map *map,
411 unsigned long start, unsigned long end)
412{
413 unsigned long mstart, mend;
414 int err;
415
416 if (!map->vma)
417 return;
418 if (map->vma->vm_start >= end)
419 return;
420 if (map->vma->vm_end <= start)
421 return;
422 mstart = max(start, map->vma->vm_start);
423 mend = min(end, map->vma->vm_end);
424 pr_debug("map %d+%d (%lx %lx), range %lx %lx, mrange %lx %lx\n",
425 map->index, map->count,
426 map->vma->vm_start, map->vma->vm_end,
427 start, end, mstart, mend);
428 err = unmap_grant_pages(map,
429 (mstart - map->vma->vm_start) >> PAGE_SHIFT,
430 (mend - mstart) >> PAGE_SHIFT);
431 WARN_ON(err);
432}
433
393static void mn_invl_range_start(struct mmu_notifier *mn, 434static void mn_invl_range_start(struct mmu_notifier *mn,
394 struct mm_struct *mm, 435 struct mm_struct *mm,
395 unsigned long start, unsigned long end) 436 unsigned long start, unsigned long end)
396{ 437{
397 struct gntdev_priv *priv = container_of(mn, struct gntdev_priv, mn); 438 struct gntdev_priv *priv = container_of(mn, struct gntdev_priv, mn);
398 struct grant_map *map; 439 struct grant_map *map;
399 unsigned long mstart, mend;
400 int err;
401 440
402 spin_lock(&priv->lock); 441 spin_lock(&priv->lock);
403 list_for_each_entry(map, &priv->maps, next) { 442 list_for_each_entry(map, &priv->maps, next) {
404 if (!map->vma) 443 unmap_if_in_range(map, start, end);
405 continue; 444 }
406 if (map->vma->vm_start >= end) 445 list_for_each_entry(map, &priv->freeable_maps, next) {
407 continue; 446 unmap_if_in_range(map, start, end);
408 if (map->vma->vm_end <= start)
409 continue;
410 mstart = max(start, map->vma->vm_start);
411 mend = min(end, map->vma->vm_end);
412 pr_debug("map %d+%d (%lx %lx), range %lx %lx, mrange %lx %lx\n",
413 map->index, map->count,
414 map->vma->vm_start, map->vma->vm_end,
415 start, end, mstart, mend);
416 err = unmap_grant_pages(map,
417 (mstart - map->vma->vm_start) >> PAGE_SHIFT,
418 (mend - mstart) >> PAGE_SHIFT);
419 WARN_ON(err);
420 } 447 }
421 spin_unlock(&priv->lock); 448 spin_unlock(&priv->lock);
422} 449}
@@ -445,6 +472,15 @@ static void mn_release(struct mmu_notifier *mn,
445 err = unmap_grant_pages(map, /* offset */ 0, map->count); 472 err = unmap_grant_pages(map, /* offset */ 0, map->count);
446 WARN_ON(err); 473 WARN_ON(err);
447 } 474 }
475 list_for_each_entry(map, &priv->freeable_maps, next) {
476 if (!map->vma)
477 continue;
478 pr_debug("map %d+%d (%lx %lx)\n",
479 map->index, map->count,
480 map->vma->vm_start, map->vma->vm_end);
481 err = unmap_grant_pages(map, /* offset */ 0, map->count);
482 WARN_ON(err);
483 }
448 spin_unlock(&priv->lock); 484 spin_unlock(&priv->lock);
449} 485}
450 486
@@ -466,6 +502,7 @@ static int gntdev_open(struct inode *inode, struct file *flip)
466 return -ENOMEM; 502 return -ENOMEM;
467 503
468 INIT_LIST_HEAD(&priv->maps); 504 INIT_LIST_HEAD(&priv->maps);
505 INIT_LIST_HEAD(&priv->freeable_maps);
469 spin_lock_init(&priv->lock); 506 spin_lock_init(&priv->lock);
470 507
471 if (use_ptemod) { 508 if (use_ptemod) {
@@ -500,8 +537,9 @@ static int gntdev_release(struct inode *inode, struct file *flip)
500 while (!list_empty(&priv->maps)) { 537 while (!list_empty(&priv->maps)) {
501 map = list_entry(priv->maps.next, struct grant_map, next); 538 map = list_entry(priv->maps.next, struct grant_map, next);
502 list_del(&map->next); 539 list_del(&map->next);
503 gntdev_put_map(map); 540 gntdev_put_map(NULL /* already removed */, map);
504 } 541 }
542 WARN_ON(!list_empty(&priv->freeable_maps));
505 543
506 if (use_ptemod) 544 if (use_ptemod)
507 mmu_notifier_unregister(&priv->mn, priv->mm); 545 mmu_notifier_unregister(&priv->mn, priv->mm);
@@ -529,14 +567,14 @@ static long gntdev_ioctl_map_grant_ref(struct gntdev_priv *priv,
529 567
530 if (unlikely(atomic_add_return(op.count, &pages_mapped) > limit)) { 568 if (unlikely(atomic_add_return(op.count, &pages_mapped) > limit)) {
531 pr_debug("can't map: over limit\n"); 569 pr_debug("can't map: over limit\n");
532 gntdev_put_map(map); 570 gntdev_put_map(NULL, map);
533 return err; 571 return err;
534 } 572 }
535 573
536 if (copy_from_user(map->grants, &u->refs, 574 if (copy_from_user(map->grants, &u->refs,
537 sizeof(map->grants[0]) * op.count) != 0) { 575 sizeof(map->grants[0]) * op.count) != 0) {
538 gntdev_put_map(map); 576 gntdev_put_map(NULL, map);
539 return err; 577 return -EFAULT;
540 } 578 }
541 579
542 spin_lock(&priv->lock); 580 spin_lock(&priv->lock);
@@ -565,11 +603,13 @@ static long gntdev_ioctl_unmap_grant_ref(struct gntdev_priv *priv,
565 map = gntdev_find_map_index(priv, op.index >> PAGE_SHIFT, op.count); 603 map = gntdev_find_map_index(priv, op.index >> PAGE_SHIFT, op.count);
566 if (map) { 604 if (map) {
567 list_del(&map->next); 605 list_del(&map->next);
606 if (populate_freeable_maps)
607 list_add_tail(&map->next, &priv->freeable_maps);
568 err = 0; 608 err = 0;
569 } 609 }
570 spin_unlock(&priv->lock); 610 spin_unlock(&priv->lock);
571 if (map) 611 if (map)
572 gntdev_put_map(map); 612 gntdev_put_map(priv, map);
573 return err; 613 return err;
574} 614}
575 615
@@ -579,25 +619,31 @@ static long gntdev_ioctl_get_offset_for_vaddr(struct gntdev_priv *priv,
579 struct ioctl_gntdev_get_offset_for_vaddr op; 619 struct ioctl_gntdev_get_offset_for_vaddr op;
580 struct vm_area_struct *vma; 620 struct vm_area_struct *vma;
581 struct grant_map *map; 621 struct grant_map *map;
622 int rv = -EINVAL;
582 623
583 if (copy_from_user(&op, u, sizeof(op)) != 0) 624 if (copy_from_user(&op, u, sizeof(op)) != 0)
584 return -EFAULT; 625 return -EFAULT;
585 pr_debug("priv %p, offset for vaddr %lx\n", priv, (unsigned long)op.vaddr); 626 pr_debug("priv %p, offset for vaddr %lx\n", priv, (unsigned long)op.vaddr);
586 627
628 down_read(&current->mm->mmap_sem);
587 vma = find_vma(current->mm, op.vaddr); 629 vma = find_vma(current->mm, op.vaddr);
588 if (!vma || vma->vm_ops != &gntdev_vmops) 630 if (!vma || vma->vm_ops != &gntdev_vmops)
589 return -EINVAL; 631 goto out_unlock;
590 632
591 map = vma->vm_private_data; 633 map = vma->vm_private_data;
592 if (!map) 634 if (!map)
593 return -EINVAL; 635 goto out_unlock;
594 636
595 op.offset = map->index << PAGE_SHIFT; 637 op.offset = map->index << PAGE_SHIFT;
596 op.count = map->count; 638 op.count = map->count;
639 rv = 0;
597 640
598 if (copy_to_user(u, &op, sizeof(op)) != 0) 641 out_unlock:
642 up_read(&current->mm->mmap_sem);
643
644 if (rv == 0 && copy_to_user(u, &op, sizeof(op)) != 0)
599 return -EFAULT; 645 return -EFAULT;
600 return 0; 646 return rv;
601} 647}
602 648
603static long gntdev_ioctl_notify(struct gntdev_priv *priv, void __user *u) 649static long gntdev_ioctl_notify(struct gntdev_priv *priv, void __user *u)
@@ -778,7 +824,7 @@ out_unlock_put:
778out_put_map: 824out_put_map:
779 if (use_ptemod) 825 if (use_ptemod)
780 map->vma = NULL; 826 map->vma = NULL;
781 gntdev_put_map(map); 827 gntdev_put_map(priv, map);
782 return err; 828 return err;
783} 829}
784 830
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index b91f14e83164..157c0ccda3ef 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -56,10 +56,6 @@
56/* External tools reserve first few grant table entries. */ 56/* External tools reserve first few grant table entries. */
57#define NR_RESERVED_ENTRIES 8 57#define NR_RESERVED_ENTRIES 8
58#define GNTTAB_LIST_END 0xffffffff 58#define GNTTAB_LIST_END 0xffffffff
59#define GREFS_PER_GRANT_FRAME \
60(grant_table_version == 1 ? \
61(PAGE_SIZE / sizeof(struct grant_entry_v1)) : \
62(PAGE_SIZE / sizeof(union grant_entry_v2)))
63 59
64static grant_ref_t **gnttab_list; 60static grant_ref_t **gnttab_list;
65static unsigned int nr_grant_frames; 61static unsigned int nr_grant_frames;
@@ -154,6 +150,7 @@ static struct gnttab_ops *gnttab_interface;
154static grant_status_t *grstatus; 150static grant_status_t *grstatus;
155 151
156static int grant_table_version; 152static int grant_table_version;
153static int grefs_per_grant_frame;
157 154
158static struct gnttab_free_callback *gnttab_free_callback_list; 155static struct gnttab_free_callback *gnttab_free_callback_list;
159 156
@@ -767,12 +764,14 @@ static int grow_gnttab_list(unsigned int more_frames)
767 unsigned int new_nr_grant_frames, extra_entries, i; 764 unsigned int new_nr_grant_frames, extra_entries, i;
768 unsigned int nr_glist_frames, new_nr_glist_frames; 765 unsigned int nr_glist_frames, new_nr_glist_frames;
769 766
767 BUG_ON(grefs_per_grant_frame == 0);
768
770 new_nr_grant_frames = nr_grant_frames + more_frames; 769 new_nr_grant_frames = nr_grant_frames + more_frames;
771 extra_entries = more_frames * GREFS_PER_GRANT_FRAME; 770 extra_entries = more_frames * grefs_per_grant_frame;
772 771
773 nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP; 772 nr_glist_frames = (nr_grant_frames * grefs_per_grant_frame + RPP - 1) / RPP;
774 new_nr_glist_frames = 773 new_nr_glist_frames =
775 (new_nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP; 774 (new_nr_grant_frames * grefs_per_grant_frame + RPP - 1) / RPP;
776 for (i = nr_glist_frames; i < new_nr_glist_frames; i++) { 775 for (i = nr_glist_frames; i < new_nr_glist_frames; i++) {
777 gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_ATOMIC); 776 gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_ATOMIC);
778 if (!gnttab_list[i]) 777 if (!gnttab_list[i])
@@ -780,12 +779,12 @@ static int grow_gnttab_list(unsigned int more_frames)
780 } 779 }
781 780
782 781
783 for (i = GREFS_PER_GRANT_FRAME * nr_grant_frames; 782 for (i = grefs_per_grant_frame * nr_grant_frames;
784 i < GREFS_PER_GRANT_FRAME * new_nr_grant_frames - 1; i++) 783 i < grefs_per_grant_frame * new_nr_grant_frames - 1; i++)
785 gnttab_entry(i) = i + 1; 784 gnttab_entry(i) = i + 1;
786 785
787 gnttab_entry(i) = gnttab_free_head; 786 gnttab_entry(i) = gnttab_free_head;
788 gnttab_free_head = GREFS_PER_GRANT_FRAME * nr_grant_frames; 787 gnttab_free_head = grefs_per_grant_frame * nr_grant_frames;
789 gnttab_free_count += extra_entries; 788 gnttab_free_count += extra_entries;
790 789
791 nr_grant_frames = new_nr_grant_frames; 790 nr_grant_frames = new_nr_grant_frames;
@@ -957,7 +956,8 @@ EXPORT_SYMBOL_GPL(gnttab_unmap_refs);
957 956
958static unsigned nr_status_frames(unsigned nr_grant_frames) 957static unsigned nr_status_frames(unsigned nr_grant_frames)
959{ 958{
960 return (nr_grant_frames * GREFS_PER_GRANT_FRAME + SPP - 1) / SPP; 959 BUG_ON(grefs_per_grant_frame == 0);
960 return (nr_grant_frames * grefs_per_grant_frame + SPP - 1) / SPP;
961} 961}
962 962
963static int gnttab_map_frames_v1(xen_pfn_t *frames, unsigned int nr_gframes) 963static int gnttab_map_frames_v1(xen_pfn_t *frames, unsigned int nr_gframes)
@@ -1115,6 +1115,7 @@ static void gnttab_request_version(void)
1115 rc = HYPERVISOR_grant_table_op(GNTTABOP_set_version, &gsv, 1); 1115 rc = HYPERVISOR_grant_table_op(GNTTABOP_set_version, &gsv, 1);
1116 if (rc == 0 && gsv.version == 2) { 1116 if (rc == 0 && gsv.version == 2) {
1117 grant_table_version = 2; 1117 grant_table_version = 2;
1118 grefs_per_grant_frame = PAGE_SIZE / sizeof(union grant_entry_v2);
1118 gnttab_interface = &gnttab_v2_ops; 1119 gnttab_interface = &gnttab_v2_ops;
1119 } else if (grant_table_version == 2) { 1120 } else if (grant_table_version == 2) {
1120 /* 1121 /*
@@ -1127,17 +1128,17 @@ static void gnttab_request_version(void)
1127 panic("we need grant tables version 2, but only version 1 is available"); 1128 panic("we need grant tables version 2, but only version 1 is available");
1128 } else { 1129 } else {
1129 grant_table_version = 1; 1130 grant_table_version = 1;
1131 grefs_per_grant_frame = PAGE_SIZE / sizeof(struct grant_entry_v1);
1130 gnttab_interface = &gnttab_v1_ops; 1132 gnttab_interface = &gnttab_v1_ops;
1131 } 1133 }
1132 printk(KERN_INFO "Grant tables using version %d layout.\n", 1134 printk(KERN_INFO "Grant tables using version %d layout.\n",
1133 grant_table_version); 1135 grant_table_version);
1134} 1136}
1135 1137
1136int gnttab_resume(void) 1138static int gnttab_setup(void)
1137{ 1139{
1138 unsigned int max_nr_gframes; 1140 unsigned int max_nr_gframes;
1139 1141
1140 gnttab_request_version();
1141 max_nr_gframes = gnttab_max_grant_frames(); 1142 max_nr_gframes = gnttab_max_grant_frames();
1142 if (max_nr_gframes < nr_grant_frames) 1143 if (max_nr_gframes < nr_grant_frames)
1143 return -ENOSYS; 1144 return -ENOSYS;
@@ -1160,6 +1161,12 @@ int gnttab_resume(void)
1160 return 0; 1161 return 0;
1161} 1162}
1162 1163
1164int gnttab_resume(void)
1165{
1166 gnttab_request_version();
1167 return gnttab_setup();
1168}
1169
1163int gnttab_suspend(void) 1170int gnttab_suspend(void)
1164{ 1171{
1165 gnttab_interface->unmap_frames(); 1172 gnttab_interface->unmap_frames();
@@ -1171,9 +1178,10 @@ static int gnttab_expand(unsigned int req_entries)
1171 int rc; 1178 int rc;
1172 unsigned int cur, extra; 1179 unsigned int cur, extra;
1173 1180
1181 BUG_ON(grefs_per_grant_frame == 0);
1174 cur = nr_grant_frames; 1182 cur = nr_grant_frames;
1175 extra = ((req_entries + (GREFS_PER_GRANT_FRAME-1)) / 1183 extra = ((req_entries + (grefs_per_grant_frame-1)) /
1176 GREFS_PER_GRANT_FRAME); 1184 grefs_per_grant_frame);
1177 if (cur + extra > gnttab_max_grant_frames()) 1185 if (cur + extra > gnttab_max_grant_frames())
1178 return -ENOSPC; 1186 return -ENOSPC;
1179 1187
@@ -1191,21 +1199,23 @@ int gnttab_init(void)
1191 unsigned int nr_init_grefs; 1199 unsigned int nr_init_grefs;
1192 int ret; 1200 int ret;
1193 1201
1202 gnttab_request_version();
1194 nr_grant_frames = 1; 1203 nr_grant_frames = 1;
1195 boot_max_nr_grant_frames = __max_nr_grant_frames(); 1204 boot_max_nr_grant_frames = __max_nr_grant_frames();
1196 1205
1197 /* Determine the maximum number of frames required for the 1206 /* Determine the maximum number of frames required for the
1198 * grant reference free list on the current hypervisor. 1207 * grant reference free list on the current hypervisor.
1199 */ 1208 */
1209 BUG_ON(grefs_per_grant_frame == 0);
1200 max_nr_glist_frames = (boot_max_nr_grant_frames * 1210 max_nr_glist_frames = (boot_max_nr_grant_frames *
1201 GREFS_PER_GRANT_FRAME / RPP); 1211 grefs_per_grant_frame / RPP);
1202 1212
1203 gnttab_list = kmalloc(max_nr_glist_frames * sizeof(grant_ref_t *), 1213 gnttab_list = kmalloc(max_nr_glist_frames * sizeof(grant_ref_t *),
1204 GFP_KERNEL); 1214 GFP_KERNEL);
1205 if (gnttab_list == NULL) 1215 if (gnttab_list == NULL)
1206 return -ENOMEM; 1216 return -ENOMEM;
1207 1217
1208 nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP; 1218 nr_glist_frames = (nr_grant_frames * grefs_per_grant_frame + RPP - 1) / RPP;
1209 for (i = 0; i < nr_glist_frames; i++) { 1219 for (i = 0; i < nr_glist_frames; i++) {
1210 gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_KERNEL); 1220 gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_KERNEL);
1211 if (gnttab_list[i] == NULL) { 1221 if (gnttab_list[i] == NULL) {
@@ -1214,12 +1224,12 @@ int gnttab_init(void)
1214 } 1224 }
1215 } 1225 }
1216 1226
1217 if (gnttab_resume() < 0) { 1227 if (gnttab_setup() < 0) {
1218 ret = -ENODEV; 1228 ret = -ENODEV;
1219 goto ini_nomem; 1229 goto ini_nomem;
1220 } 1230 }
1221 1231
1222 nr_init_grefs = nr_grant_frames * GREFS_PER_GRANT_FRAME; 1232 nr_init_grefs = nr_grant_frames * grefs_per_grant_frame;
1223 1233
1224 for (i = NR_RESERVED_ENTRIES; i < nr_init_grefs - 1; i++) 1234 for (i = NR_RESERVED_ENTRIES; i < nr_init_grefs - 1; i++)
1225 gnttab_entry(i) = i + 1; 1235 gnttab_entry(i) = i + 1;
@@ -1239,7 +1249,7 @@ int gnttab_init(void)
1239} 1249}
1240EXPORT_SYMBOL_GPL(gnttab_init); 1250EXPORT_SYMBOL_GPL(gnttab_init);
1241 1251
1242static int __devinit __gnttab_init(void) 1252static int __gnttab_init(void)
1243{ 1253{
1244 /* Delay grant-table initialization in the PV on HVM case */ 1254 /* Delay grant-table initialization in the PV on HVM case */
1245 if (xen_hvm_domain()) 1255 if (xen_hvm_domain())
diff --git a/drivers/xen/platform-pci.c b/drivers/xen/platform-pci.c
index 97ca359ae2bd..99db9e1eb8ba 100644
--- a/drivers/xen/platform-pci.c
+++ b/drivers/xen/platform-pci.c
@@ -101,8 +101,8 @@ static int platform_pci_resume(struct pci_dev *pdev)
101 return 0; 101 return 0;
102} 102}
103 103
104static int __devinit platform_pci_init(struct pci_dev *pdev, 104static int platform_pci_init(struct pci_dev *pdev,
105 const struct pci_device_id *ent) 105 const struct pci_device_id *ent)
106{ 106{
107 int i, ret; 107 int i, ret;
108 long ioaddr; 108 long ioaddr;
@@ -170,7 +170,7 @@ pci_out:
170 return ret; 170 return ret;
171} 171}
172 172
173static struct pci_device_id platform_pci_tbl[] __devinitdata = { 173static struct pci_device_id platform_pci_tbl[] = {
174 {PCI_VENDOR_ID_XEN, PCI_DEVICE_ID_XEN_PLATFORM, 174 {PCI_VENDOR_ID_XEN, PCI_DEVICE_ID_XEN_PLATFORM,
175 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 175 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
176 {0,} 176 {0,}
diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c
index 0bbbccbb1f12..ca2b00e9d558 100644
--- a/drivers/xen/privcmd.c
+++ b/drivers/xen/privcmd.c
@@ -199,9 +199,6 @@ static long privcmd_ioctl_mmap(void __user *udata)
199 LIST_HEAD(pagelist); 199 LIST_HEAD(pagelist);
200 struct mmap_mfn_state state; 200 struct mmap_mfn_state state;
201 201
202 if (!xen_initial_domain())
203 return -EPERM;
204
205 /* We only support privcmd_ioctl_mmap_batch for auto translated. */ 202 /* We only support privcmd_ioctl_mmap_batch for auto translated. */
206 if (xen_feature(XENFEAT_auto_translated_physmap)) 203 if (xen_feature(XENFEAT_auto_translated_physmap))
207 return -ENOSYS; 204 return -ENOSYS;
@@ -261,11 +258,12 @@ struct mmap_batch_state {
261 * -ENOENT if at least 1 -ENOENT has happened. 258 * -ENOENT if at least 1 -ENOENT has happened.
262 */ 259 */
263 int global_error; 260 int global_error;
264 /* An array for individual errors */ 261 int version;
265 int *err;
266 262
267 /* User-space mfn array to store errors in the second pass for V1. */ 263 /* User-space mfn array to store errors in the second pass for V1. */
268 xen_pfn_t __user *user_mfn; 264 xen_pfn_t __user *user_mfn;
265 /* User-space int array to store errors in the second pass for V2. */
266 int __user *user_err;
269}; 267};
270 268
271/* auto translated dom0 note: if domU being created is PV, then mfn is 269/* auto translated dom0 note: if domU being created is PV, then mfn is
@@ -288,7 +286,19 @@ static int mmap_batch_fn(void *data, void *state)
288 &cur_page); 286 &cur_page);
289 287
290 /* Store error code for second pass. */ 288 /* Store error code for second pass. */
291 *(st->err++) = ret; 289 if (st->version == 1) {
290 if (ret < 0) {
291 /*
292 * V1 encodes the error codes in the 32bit top nibble of the
293 * mfn (with its known limitations vis-a-vis 64 bit callers).
294 */
295 *mfnp |= (ret == -ENOENT) ?
296 PRIVCMD_MMAPBATCH_PAGED_ERROR :
297 PRIVCMD_MMAPBATCH_MFN_ERROR;
298 }
299 } else { /* st->version == 2 */
300 *((int *) mfnp) = ret;
301 }
292 302
293 /* And see if it affects the global_error. */ 303 /* And see if it affects the global_error. */
294 if (ret < 0) { 304 if (ret < 0) {
@@ -305,20 +315,25 @@ static int mmap_batch_fn(void *data, void *state)
305 return 0; 315 return 0;
306} 316}
307 317
308static int mmap_return_errors_v1(void *data, void *state) 318static int mmap_return_errors(void *data, void *state)
309{ 319{
310 xen_pfn_t *mfnp = data;
311 struct mmap_batch_state *st = state; 320 struct mmap_batch_state *st = state;
312 int err = *(st->err++);
313 321
314 /* 322 if (st->version == 1) {
315 * V1 encodes the error codes in the 32bit top nibble of the 323 xen_pfn_t mfnp = *((xen_pfn_t *) data);
316 * mfn (with its known limitations vis-a-vis 64 bit callers). 324 if (mfnp & PRIVCMD_MMAPBATCH_MFN_ERROR)
317 */ 325 return __put_user(mfnp, st->user_mfn++);
318 *mfnp |= (err == -ENOENT) ? 326 else
319 PRIVCMD_MMAPBATCH_PAGED_ERROR : 327 st->user_mfn++;
320 PRIVCMD_MMAPBATCH_MFN_ERROR; 328 } else { /* st->version == 2 */
321 return __put_user(*mfnp, st->user_mfn++); 329 int err = *((int *) data);
330 if (err)
331 return __put_user(err, st->user_err++);
332 else
333 st->user_err++;
334 }
335
336 return 0;
322} 337}
323 338
324/* Allocate pfns that are then mapped with gmfns from foreign domid. Update 339/* Allocate pfns that are then mapped with gmfns from foreign domid. Update
@@ -357,12 +372,8 @@ static long privcmd_ioctl_mmap_batch(void __user *udata, int version)
357 struct vm_area_struct *vma; 372 struct vm_area_struct *vma;
358 unsigned long nr_pages; 373 unsigned long nr_pages;
359 LIST_HEAD(pagelist); 374 LIST_HEAD(pagelist);
360 int *err_array = NULL;
361 struct mmap_batch_state state; 375 struct mmap_batch_state state;
362 376
363 if (!xen_initial_domain())
364 return -EPERM;
365
366 switch (version) { 377 switch (version) {
367 case 1: 378 case 1:
368 if (copy_from_user(&m, udata, sizeof(struct privcmd_mmapbatch))) 379 if (copy_from_user(&m, udata, sizeof(struct privcmd_mmapbatch)))
@@ -396,10 +407,12 @@ static long privcmd_ioctl_mmap_batch(void __user *udata, int version)
396 goto out; 407 goto out;
397 } 408 }
398 409
399 err_array = kcalloc(m.num, sizeof(int), GFP_KERNEL); 410 if (version == 2) {
400 if (err_array == NULL) { 411 /* Zero error array now to only copy back actual errors. */
401 ret = -ENOMEM; 412 if (clear_user(m.err, sizeof(int) * m.num)) {
402 goto out; 413 ret = -EFAULT;
414 goto out;
415 }
403 } 416 }
404 417
405 down_write(&mm->mmap_sem); 418 down_write(&mm->mmap_sem);
@@ -427,7 +440,7 @@ static long privcmd_ioctl_mmap_batch(void __user *udata, int version)
427 state.va = m.addr; 440 state.va = m.addr;
428 state.index = 0; 441 state.index = 0;
429 state.global_error = 0; 442 state.global_error = 0;
430 state.err = err_array; 443 state.version = version;
431 444
432 /* mmap_batch_fn guarantees ret == 0 */ 445 /* mmap_batch_fn guarantees ret == 0 */
433 BUG_ON(traverse_pages(m.num, sizeof(xen_pfn_t), 446 BUG_ON(traverse_pages(m.num, sizeof(xen_pfn_t),
@@ -435,21 +448,14 @@ static long privcmd_ioctl_mmap_batch(void __user *udata, int version)
435 448
436 up_write(&mm->mmap_sem); 449 up_write(&mm->mmap_sem);
437 450
438 if (version == 1) { 451 if (state.global_error) {
439 if (state.global_error) { 452 /* Write back errors in second pass. */
440 /* Write back errors in second pass. */ 453 state.user_mfn = (xen_pfn_t *)m.arr;
441 state.user_mfn = (xen_pfn_t *)m.arr; 454 state.user_err = m.err;
442 state.err = err_array; 455 ret = traverse_pages(m.num, sizeof(xen_pfn_t),
443 ret = traverse_pages(m.num, sizeof(xen_pfn_t), 456 &pagelist, mmap_return_errors, &state);
444 &pagelist, mmap_return_errors_v1, &state); 457 } else
445 } else 458 ret = 0;
446 ret = 0;
447
448 } else if (version == 2) {
449 ret = __copy_to_user(m.err, err_array, m.num * sizeof(int));
450 if (ret)
451 ret = -EFAULT;
452 }
453 459
454 /* If we have not had any EFAULT-like global errors then set the global 460 /* If we have not had any EFAULT-like global errors then set the global
455 * error to -ENOENT if necessary. */ 461 * error to -ENOENT if necessary. */
@@ -457,7 +463,6 @@ static long privcmd_ioctl_mmap_batch(void __user *udata, int version)
457 ret = -ENOENT; 463 ret = -ENOENT;
458 464
459out: 465out:
460 kfree(err_array);
461 free_page_list(&pagelist); 466 free_page_list(&pagelist);
462 467
463 return ret; 468 return ret;
diff --git a/drivers/xen/xen-pciback/pci_stub.c b/drivers/xen/xen-pciback/pci_stub.c
index cd50d251998e..9204126f1560 100644
--- a/drivers/xen/xen-pciback/pci_stub.c
+++ b/drivers/xen/xen-pciback/pci_stub.c
@@ -272,8 +272,8 @@ void pcistub_put_pci_dev(struct pci_dev *dev)
272 up_write(&pcistub_sem); 272 up_write(&pcistub_sem);
273} 273}
274 274
275static int __devinit pcistub_match_one(struct pci_dev *dev, 275static int pcistub_match_one(struct pci_dev *dev,
276 struct pcistub_device_id *pdev_id) 276 struct pcistub_device_id *pdev_id)
277{ 277{
278 /* Match the specified device by domain, bus, slot, func and also if 278 /* Match the specified device by domain, bus, slot, func and also if
279 * any of the device's parent bridges match. 279 * any of the device's parent bridges match.
@@ -292,7 +292,7 @@ static int __devinit pcistub_match_one(struct pci_dev *dev,
292 return 0; 292 return 0;
293} 293}
294 294
295static int __devinit pcistub_match(struct pci_dev *dev) 295static int pcistub_match(struct pci_dev *dev)
296{ 296{
297 struct pcistub_device_id *pdev_id; 297 struct pcistub_device_id *pdev_id;
298 unsigned long flags; 298 unsigned long flags;
@@ -310,7 +310,7 @@ static int __devinit pcistub_match(struct pci_dev *dev)
310 return found; 310 return found;
311} 311}
312 312
313static int __devinit pcistub_init_device(struct pci_dev *dev) 313static int pcistub_init_device(struct pci_dev *dev)
314{ 314{
315 struct xen_pcibk_dev_data *dev_data; 315 struct xen_pcibk_dev_data *dev_data;
316 int err = 0; 316 int err = 0;
@@ -428,7 +428,7 @@ static int __init pcistub_init_devices_late(void)
428 return 0; 428 return 0;
429} 429}
430 430
431static int __devinit pcistub_seize(struct pci_dev *dev) 431static int pcistub_seize(struct pci_dev *dev)
432{ 432{
433 struct pcistub_device *psdev; 433 struct pcistub_device *psdev;
434 unsigned long flags; 434 unsigned long flags;
@@ -463,8 +463,7 @@ static int __devinit pcistub_seize(struct pci_dev *dev)
463 return err; 463 return err;
464} 464}
465 465
466static int __devinit pcistub_probe(struct pci_dev *dev, 466static int pcistub_probe(struct pci_dev *dev, const struct pci_device_id *id)
467 const struct pci_device_id *id)
468{ 467{
469 int err = 0; 468 int err = 0;
470 469
diff --git a/drivers/xen/xen-pciback/pciback.h b/drivers/xen/xen-pciback/pciback.h
index a7def010eba3..f72af87640e0 100644
--- a/drivers/xen/xen-pciback/pciback.h
+++ b/drivers/xen/xen-pciback/pciback.h
@@ -124,7 +124,7 @@ static inline int xen_pcibk_add_pci_dev(struct xen_pcibk_device *pdev,
124static inline void xen_pcibk_release_pci_dev(struct xen_pcibk_device *pdev, 124static inline void xen_pcibk_release_pci_dev(struct xen_pcibk_device *pdev,
125 struct pci_dev *dev) 125 struct pci_dev *dev)
126{ 126{
127 if (xen_pcibk_backend && xen_pcibk_backend->free) 127 if (xen_pcibk_backend && xen_pcibk_backend->release)
128 return xen_pcibk_backend->release(pdev, dev); 128 return xen_pcibk_backend->release(pdev, dev);
129} 129}
130 130
diff --git a/drivers/zorro/zorro-driver.c b/drivers/zorro/zorro-driver.c
index 229624f867d3..ac1db7f1bcab 100644
--- a/drivers/zorro/zorro-driver.c
+++ b/drivers/zorro/zorro-driver.c
@@ -142,7 +142,6 @@ static int zorro_bus_match(struct device *dev, struct device_driver *drv)
142 142
143static int zorro_uevent(struct device *dev, struct kobj_uevent_env *env) 143static int zorro_uevent(struct device *dev, struct kobj_uevent_env *env)
144{ 144{
145#ifdef CONFIG_HOTPLUG
146 struct zorro_dev *z; 145 struct zorro_dev *z;
147 146
148 if (!dev) 147 if (!dev)
@@ -159,9 +158,6 @@ static int zorro_uevent(struct device *dev, struct kobj_uevent_env *env)
159 return -ENOMEM; 158 return -ENOMEM;
160 159
161 return 0; 160 return 0;
162#else /* !CONFIG_HOTPLUG */
163 return -ENODEV;
164#endif /* !CONFIG_HOTPLUG */
165} 161}
166 162
167struct bus_type zorro_bus_type = { 163struct bus_type zorro_bus_type = {
diff --git a/fs/Kconfig b/fs/Kconfig
index cfe512fd1caf..780725a463b1 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -68,16 +68,6 @@ source "fs/quota/Kconfig"
68source "fs/autofs4/Kconfig" 68source "fs/autofs4/Kconfig"
69source "fs/fuse/Kconfig" 69source "fs/fuse/Kconfig"
70 70
71config CUSE
72 tristate "Character device in Userspace support"
73 depends on FUSE_FS
74 help
75 This FUSE extension allows character devices to be
76 implemented in userspace.
77
78 If you want to develop or use userspace character device
79 based on CUSE, answer Y or M.
80
81config GENERIC_ACL 71config GENERIC_ACL
82 bool 72 bool
83 select FS_POSIX_ACL 73 select FS_POSIX_ACL
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 521e9d4424f6..a8b8adc05070 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -3997,7 +3997,7 @@ again:
3997 * We make the other tasks wait for the flush only when we can flush 3997 * We make the other tasks wait for the flush only when we can flush
3998 * all things. 3998 * all things.
3999 */ 3999 */
4000 if (ret && flush == BTRFS_RESERVE_FLUSH_ALL) { 4000 if (ret && flush != BTRFS_RESERVE_NO_FLUSH) {
4001 flushing = true; 4001 flushing = true;
4002 space_info->flush = 1; 4002 space_info->flush = 1;
4003 } 4003 }
@@ -5560,7 +5560,7 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
5560 int empty_cluster = 2 * 1024 * 1024; 5560 int empty_cluster = 2 * 1024 * 1024;
5561 struct btrfs_space_info *space_info; 5561 struct btrfs_space_info *space_info;
5562 int loop = 0; 5562 int loop = 0;
5563 int index = 0; 5563 int index = __get_raid_index(data);
5564 int alloc_type = (data & BTRFS_BLOCK_GROUP_DATA) ? 5564 int alloc_type = (data & BTRFS_BLOCK_GROUP_DATA) ?
5565 RESERVE_ALLOC_NO_ACCOUNT : RESERVE_ALLOC; 5565 RESERVE_ALLOC_NO_ACCOUNT : RESERVE_ALLOC;
5566 bool found_uncached_bg = false; 5566 bool found_uncached_bg = false;
@@ -6788,11 +6788,13 @@ static noinline int walk_up_proc(struct btrfs_trans_handle *trans,
6788 &wc->flags[level]); 6788 &wc->flags[level]);
6789 if (ret < 0) { 6789 if (ret < 0) {
6790 btrfs_tree_unlock_rw(eb, path->locks[level]); 6790 btrfs_tree_unlock_rw(eb, path->locks[level]);
6791 path->locks[level] = 0;
6791 return ret; 6792 return ret;
6792 } 6793 }
6793 BUG_ON(wc->refs[level] == 0); 6794 BUG_ON(wc->refs[level] == 0);
6794 if (wc->refs[level] == 1) { 6795 if (wc->refs[level] == 1) {
6795 btrfs_tree_unlock_rw(eb, path->locks[level]); 6796 btrfs_tree_unlock_rw(eb, path->locks[level]);
6797 path->locks[level] = 0;
6796 return 1; 6798 return 1;
6797 } 6799 }
6798 } 6800 }
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
index f169d6b11d7f..2e8cae63d247 100644
--- a/fs/btrfs/extent_map.c
+++ b/fs/btrfs/extent_map.c
@@ -171,6 +171,10 @@ static int mergable_maps(struct extent_map *prev, struct extent_map *next)
171 if (test_bit(EXTENT_FLAG_COMPRESSED, &prev->flags)) 171 if (test_bit(EXTENT_FLAG_COMPRESSED, &prev->flags))
172 return 0; 172 return 0;
173 173
174 if (test_bit(EXTENT_FLAG_LOGGING, &prev->flags) ||
175 test_bit(EXTENT_FLAG_LOGGING, &next->flags))
176 return 0;
177
174 if (extent_map_end(prev) == next->start && 178 if (extent_map_end(prev) == next->start &&
175 prev->flags == next->flags && 179 prev->flags == next->flags &&
176 prev->bdev == next->bdev && 180 prev->bdev == next->bdev &&
@@ -255,7 +259,8 @@ int unpin_extent_cache(struct extent_map_tree *tree, u64 start, u64 len,
255 if (!em) 259 if (!em)
256 goto out; 260 goto out;
257 261
258 list_move(&em->list, &tree->modified_extents); 262 if (!test_bit(EXTENT_FLAG_LOGGING, &em->flags))
263 list_move(&em->list, &tree->modified_extents);
259 em->generation = gen; 264 em->generation = gen;
260 clear_bit(EXTENT_FLAG_PINNED, &em->flags); 265 clear_bit(EXTENT_FLAG_PINNED, &em->flags);
261 em->mod_start = em->start; 266 em->mod_start = em->start;
@@ -280,6 +285,12 @@ out:
280 285
281} 286}
282 287
288void clear_em_logging(struct extent_map_tree *tree, struct extent_map *em)
289{
290 clear_bit(EXTENT_FLAG_LOGGING, &em->flags);
291 try_merge_map(tree, em);
292}
293
283/** 294/**
284 * add_extent_mapping - add new extent map to the extent tree 295 * add_extent_mapping - add new extent map to the extent tree
285 * @tree: tree to insert new map in 296 * @tree: tree to insert new map in
diff --git a/fs/btrfs/extent_map.h b/fs/btrfs/extent_map.h
index 922943ce29e8..c6598c89cff8 100644
--- a/fs/btrfs/extent_map.h
+++ b/fs/btrfs/extent_map.h
@@ -69,6 +69,7 @@ void free_extent_map(struct extent_map *em);
69int __init extent_map_init(void); 69int __init extent_map_init(void);
70void extent_map_exit(void); 70void extent_map_exit(void);
71int unpin_extent_cache(struct extent_map_tree *tree, u64 start, u64 len, u64 gen); 71int unpin_extent_cache(struct extent_map_tree *tree, u64 start, u64 len, u64 gen);
72void clear_em_logging(struct extent_map_tree *tree, struct extent_map *em);
72struct extent_map *search_extent_mapping(struct extent_map_tree *tree, 73struct extent_map *search_extent_mapping(struct extent_map_tree *tree,
73 u64 start, u64 len); 74 u64 start, u64 len);
74#endif 75#endif
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c
index bd38cef42358..94aa53b38721 100644
--- a/fs/btrfs/file-item.c
+++ b/fs/btrfs/file-item.c
@@ -460,8 +460,8 @@ int btrfs_csum_one_bio(struct btrfs_root *root, struct inode *inode,
460 if (!contig) 460 if (!contig)
461 offset = page_offset(bvec->bv_page) + bvec->bv_offset; 461 offset = page_offset(bvec->bv_page) + bvec->bv_offset;
462 462
463 if (!contig && (offset >= ordered->file_offset + ordered->len || 463 if (offset >= ordered->file_offset + ordered->len ||
464 offset < ordered->file_offset)) { 464 offset < ordered->file_offset) {
465 unsigned long bytes_left; 465 unsigned long bytes_left;
466 sums->len = this_sum_bytes; 466 sums->len = this_sum_bytes;
467 this_sum_bytes = 0; 467 this_sum_bytes = 0;
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 77061bf43edb..f76b1fd160d4 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -2241,6 +2241,7 @@ static int find_desired_extent(struct inode *inode, loff_t *offset, int whence)
2241 if (lockend <= lockstart) 2241 if (lockend <= lockstart)
2242 lockend = lockstart + root->sectorsize; 2242 lockend = lockstart + root->sectorsize;
2243 2243
2244 lockend--;
2244 len = lockend - lockstart + 1; 2245 len = lockend - lockstart + 1;
2245 2246
2246 len = max_t(u64, len, root->sectorsize); 2247 len = max_t(u64, len, root->sectorsize);
@@ -2307,9 +2308,12 @@ static int find_desired_extent(struct inode *inode, loff_t *offset, int whence)
2307 } 2308 }
2308 } 2309 }
2309 2310
2310 *offset = start; 2311 if (!test_bit(EXTENT_FLAG_PREALLOC,
2311 free_extent_map(em); 2312 &em->flags)) {
2312 break; 2313 *offset = start;
2314 free_extent_map(em);
2315 break;
2316 }
2313 } 2317 }
2314 } 2318 }
2315 2319
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 59ea2e4349c9..0be7a8742a43 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -1862,11 +1862,13 @@ int btrfs_remove_free_space(struct btrfs_block_group_cache *block_group,
1862{ 1862{
1863 struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl; 1863 struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl;
1864 struct btrfs_free_space *info; 1864 struct btrfs_free_space *info;
1865 int ret = 0; 1865 int ret;
1866 bool re_search = false;
1866 1867
1867 spin_lock(&ctl->tree_lock); 1868 spin_lock(&ctl->tree_lock);
1868 1869
1869again: 1870again:
1871 ret = 0;
1870 if (!bytes) 1872 if (!bytes)
1871 goto out_lock; 1873 goto out_lock;
1872 1874
@@ -1879,17 +1881,17 @@ again:
1879 info = tree_search_offset(ctl, offset_to_bitmap(ctl, offset), 1881 info = tree_search_offset(ctl, offset_to_bitmap(ctl, offset),
1880 1, 0); 1882 1, 0);
1881 if (!info) { 1883 if (!info) {
1882 /* the tree logging code might be calling us before we 1884 /*
1883 * have fully loaded the free space rbtree for this 1885 * If we found a partial bit of our free space in a
1884 * block group. So it is possible the entry won't 1886 * bitmap but then couldn't find the other part this may
1885 * be in the rbtree yet at all. The caching code 1887 * be a problem, so WARN about it.
1886 * will make sure not to put it in the rbtree if
1887 * the logging code has pinned it.
1888 */ 1888 */
1889 WARN_ON(re_search);
1889 goto out_lock; 1890 goto out_lock;
1890 } 1891 }
1891 } 1892 }
1892 1893
1894 re_search = false;
1893 if (!info->bitmap) { 1895 if (!info->bitmap) {
1894 unlink_free_space(ctl, info); 1896 unlink_free_space(ctl, info);
1895 if (offset == info->offset) { 1897 if (offset == info->offset) {
@@ -1935,8 +1937,10 @@ again:
1935 } 1937 }
1936 1938
1937 ret = remove_from_bitmap(ctl, info, &offset, &bytes); 1939 ret = remove_from_bitmap(ctl, info, &offset, &bytes);
1938 if (ret == -EAGAIN) 1940 if (ret == -EAGAIN) {
1941 re_search = true;
1939 goto again; 1942 goto again;
1943 }
1940 BUG_ON(ret); /* logic error */ 1944 BUG_ON(ret); /* logic error */
1941out_lock: 1945out_lock:
1942 spin_unlock(&ctl->tree_lock); 1946 spin_unlock(&ctl->tree_lock);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 16d9e8e191e6..cc93b23ca352 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -88,7 +88,7 @@ static unsigned char btrfs_type_by_mode[S_IFMT >> S_SHIFT] = {
88 [S_IFLNK >> S_SHIFT] = BTRFS_FT_SYMLINK, 88 [S_IFLNK >> S_SHIFT] = BTRFS_FT_SYMLINK,
89}; 89};
90 90
91static int btrfs_setsize(struct inode *inode, loff_t newsize); 91static int btrfs_setsize(struct inode *inode, struct iattr *attr);
92static int btrfs_truncate(struct inode *inode); 92static int btrfs_truncate(struct inode *inode);
93static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent); 93static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent);
94static noinline int cow_file_range(struct inode *inode, 94static noinline int cow_file_range(struct inode *inode,
@@ -2478,6 +2478,18 @@ int btrfs_orphan_cleanup(struct btrfs_root *root)
2478 continue; 2478 continue;
2479 } 2479 }
2480 nr_truncate++; 2480 nr_truncate++;
2481
2482 /* 1 for the orphan item deletion. */
2483 trans = btrfs_start_transaction(root, 1);
2484 if (IS_ERR(trans)) {
2485 ret = PTR_ERR(trans);
2486 goto out;
2487 }
2488 ret = btrfs_orphan_add(trans, inode);
2489 btrfs_end_transaction(trans, root);
2490 if (ret)
2491 goto out;
2492
2481 ret = btrfs_truncate(inode); 2493 ret = btrfs_truncate(inode);
2482 } else { 2494 } else {
2483 nr_unlink++; 2495 nr_unlink++;
@@ -3665,6 +3677,7 @@ int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size)
3665 block_end - cur_offset, 0); 3677 block_end - cur_offset, 0);
3666 if (IS_ERR(em)) { 3678 if (IS_ERR(em)) {
3667 err = PTR_ERR(em); 3679 err = PTR_ERR(em);
3680 em = NULL;
3668 break; 3681 break;
3669 } 3682 }
3670 last_byte = min(extent_map_end(em), block_end); 3683 last_byte = min(extent_map_end(em), block_end);
@@ -3748,16 +3761,27 @@ next:
3748 return err; 3761 return err;
3749} 3762}
3750 3763
3751static int btrfs_setsize(struct inode *inode, loff_t newsize) 3764static int btrfs_setsize(struct inode *inode, struct iattr *attr)
3752{ 3765{
3753 struct btrfs_root *root = BTRFS_I(inode)->root; 3766 struct btrfs_root *root = BTRFS_I(inode)->root;
3754 struct btrfs_trans_handle *trans; 3767 struct btrfs_trans_handle *trans;
3755 loff_t oldsize = i_size_read(inode); 3768 loff_t oldsize = i_size_read(inode);
3769 loff_t newsize = attr->ia_size;
3770 int mask = attr->ia_valid;
3756 int ret; 3771 int ret;
3757 3772
3758 if (newsize == oldsize) 3773 if (newsize == oldsize)
3759 return 0; 3774 return 0;
3760 3775
3776 /*
3777 * The regular truncate() case without ATTR_CTIME and ATTR_MTIME is a
3778 * special case where we need to update the times despite not having
3779 * these flags set. For all other operations the VFS set these flags
3780 * explicitly if it wants a timestamp update.
3781 */
3782 if (newsize != oldsize && (!(mask & (ATTR_CTIME | ATTR_MTIME))))
3783 inode->i_ctime = inode->i_mtime = current_fs_time(inode->i_sb);
3784
3761 if (newsize > oldsize) { 3785 if (newsize > oldsize) {
3762 truncate_pagecache(inode, oldsize, newsize); 3786 truncate_pagecache(inode, oldsize, newsize);
3763 ret = btrfs_cont_expand(inode, oldsize, newsize); 3787 ret = btrfs_cont_expand(inode, oldsize, newsize);
@@ -3783,9 +3807,34 @@ static int btrfs_setsize(struct inode *inode, loff_t newsize)
3783 set_bit(BTRFS_INODE_ORDERED_DATA_CLOSE, 3807 set_bit(BTRFS_INODE_ORDERED_DATA_CLOSE,
3784 &BTRFS_I(inode)->runtime_flags); 3808 &BTRFS_I(inode)->runtime_flags);
3785 3809
3810 /*
3811 * 1 for the orphan item we're going to add
3812 * 1 for the orphan item deletion.
3813 */
3814 trans = btrfs_start_transaction(root, 2);
3815 if (IS_ERR(trans))
3816 return PTR_ERR(trans);
3817
3818 /*
3819 * We need to do this in case we fail at _any_ point during the
3820 * actual truncate. Once we do the truncate_setsize we could
3821 * invalidate pages which forces any outstanding ordered io to
3822 * be instantly completed which will give us extents that need
3823 * to be truncated. If we fail to get an orphan inode down we
3824 * could have left over extents that were never meant to live,
3825 * so we need to garuntee from this point on that everything
3826 * will be consistent.
3827 */
3828 ret = btrfs_orphan_add(trans, inode);
3829 btrfs_end_transaction(trans, root);
3830 if (ret)
3831 return ret;
3832
3786 /* we don't support swapfiles, so vmtruncate shouldn't fail */ 3833 /* we don't support swapfiles, so vmtruncate shouldn't fail */
3787 truncate_setsize(inode, newsize); 3834 truncate_setsize(inode, newsize);
3788 ret = btrfs_truncate(inode); 3835 ret = btrfs_truncate(inode);
3836 if (ret && inode->i_nlink)
3837 btrfs_orphan_del(NULL, inode);
3789 } 3838 }
3790 3839
3791 return ret; 3840 return ret;
@@ -3805,7 +3854,7 @@ static int btrfs_setattr(struct dentry *dentry, struct iattr *attr)
3805 return err; 3854 return err;
3806 3855
3807 if (S_ISREG(inode->i_mode) && (attr->ia_valid & ATTR_SIZE)) { 3856 if (S_ISREG(inode->i_mode) && (attr->ia_valid & ATTR_SIZE)) {
3808 err = btrfs_setsize(inode, attr->ia_size); 3857 err = btrfs_setsize(inode, attr);
3809 if (err) 3858 if (err)
3810 return err; 3859 return err;
3811 } 3860 }
@@ -5572,10 +5621,13 @@ struct extent_map *btrfs_get_extent_fiemap(struct inode *inode, struct page *pag
5572 return em; 5621 return em;
5573 if (em) { 5622 if (em) {
5574 /* 5623 /*
5575 * if our em maps to a hole, there might 5624 * if our em maps to
5576 * actually be delalloc bytes behind it 5625 * - a hole or
5626 * - a pre-alloc extent,
5627 * there might actually be delalloc bytes behind it.
5577 */ 5628 */
5578 if (em->block_start != EXTENT_MAP_HOLE) 5629 if (em->block_start != EXTENT_MAP_HOLE &&
5630 !test_bit(EXTENT_FLAG_PREALLOC, &em->flags))
5579 return em; 5631 return em;
5580 else 5632 else
5581 hole_em = em; 5633 hole_em = em;
@@ -5657,6 +5709,8 @@ struct extent_map *btrfs_get_extent_fiemap(struct inode *inode, struct page *pag
5657 */ 5709 */
5658 em->block_start = hole_em->block_start; 5710 em->block_start = hole_em->block_start;
5659 em->block_len = hole_len; 5711 em->block_len = hole_len;
5712 if (test_bit(EXTENT_FLAG_PREALLOC, &hole_em->flags))
5713 set_bit(EXTENT_FLAG_PREALLOC, &em->flags);
5660 } else { 5714 } else {
5661 em->start = range_start; 5715 em->start = range_start;
5662 em->len = found; 5716 em->len = found;
@@ -6915,11 +6969,9 @@ static int btrfs_truncate(struct inode *inode)
6915 6969
6916 /* 6970 /*
6917 * 1 for the truncate slack space 6971 * 1 for the truncate slack space
6918 * 1 for the orphan item we're going to add
6919 * 1 for the orphan item deletion
6920 * 1 for updating the inode. 6972 * 1 for updating the inode.
6921 */ 6973 */
6922 trans = btrfs_start_transaction(root, 4); 6974 trans = btrfs_start_transaction(root, 2);
6923 if (IS_ERR(trans)) { 6975 if (IS_ERR(trans)) {
6924 err = PTR_ERR(trans); 6976 err = PTR_ERR(trans);
6925 goto out; 6977 goto out;
@@ -6930,12 +6982,6 @@ static int btrfs_truncate(struct inode *inode)
6930 min_size); 6982 min_size);
6931 BUG_ON(ret); 6983 BUG_ON(ret);
6932 6984
6933 ret = btrfs_orphan_add(trans, inode);
6934 if (ret) {
6935 btrfs_end_transaction(trans, root);
6936 goto out;
6937 }
6938
6939 /* 6985 /*
6940 * setattr is responsible for setting the ordered_data_close flag, 6986 * setattr is responsible for setting the ordered_data_close flag,
6941 * but that is only tested during the last file release. That 6987 * but that is only tested during the last file release. That
@@ -7004,12 +7050,6 @@ static int btrfs_truncate(struct inode *inode)
7004 ret = btrfs_orphan_del(trans, inode); 7050 ret = btrfs_orphan_del(trans, inode);
7005 if (ret) 7051 if (ret)
7006 err = ret; 7052 err = ret;
7007 } else if (ret && inode->i_nlink > 0) {
7008 /*
7009 * Failed to do the truncate, remove us from the in memory
7010 * orphan list.
7011 */
7012 ret = btrfs_orphan_del(NULL, inode);
7013 } 7053 }
7014 7054
7015 if (trans) { 7055 if (trans) {
@@ -7531,41 +7571,61 @@ void btrfs_wait_and_free_delalloc_work(struct btrfs_delalloc_work *work)
7531 */ 7571 */
7532int btrfs_start_delalloc_inodes(struct btrfs_root *root, int delay_iput) 7572int btrfs_start_delalloc_inodes(struct btrfs_root *root, int delay_iput)
7533{ 7573{
7534 struct list_head *head = &root->fs_info->delalloc_inodes;
7535 struct btrfs_inode *binode; 7574 struct btrfs_inode *binode;
7536 struct inode *inode; 7575 struct inode *inode;
7537 struct btrfs_delalloc_work *work, *next; 7576 struct btrfs_delalloc_work *work, *next;
7538 struct list_head works; 7577 struct list_head works;
7578 struct list_head splice;
7539 int ret = 0; 7579 int ret = 0;
7540 7580
7541 if (root->fs_info->sb->s_flags & MS_RDONLY) 7581 if (root->fs_info->sb->s_flags & MS_RDONLY)
7542 return -EROFS; 7582 return -EROFS;
7543 7583
7544 INIT_LIST_HEAD(&works); 7584 INIT_LIST_HEAD(&works);
7545 7585 INIT_LIST_HEAD(&splice);
7586again:
7546 spin_lock(&root->fs_info->delalloc_lock); 7587 spin_lock(&root->fs_info->delalloc_lock);
7547 while (!list_empty(head)) { 7588 list_splice_init(&root->fs_info->delalloc_inodes, &splice);
7548 binode = list_entry(head->next, struct btrfs_inode, 7589 while (!list_empty(&splice)) {
7590 binode = list_entry(splice.next, struct btrfs_inode,
7549 delalloc_inodes); 7591 delalloc_inodes);
7592
7593 list_del_init(&binode->delalloc_inodes);
7594
7550 inode = igrab(&binode->vfs_inode); 7595 inode = igrab(&binode->vfs_inode);
7551 if (!inode) 7596 if (!inode)
7552 list_del_init(&binode->delalloc_inodes); 7597 continue;
7598
7599 list_add_tail(&binode->delalloc_inodes,
7600 &root->fs_info->delalloc_inodes);
7553 spin_unlock(&root->fs_info->delalloc_lock); 7601 spin_unlock(&root->fs_info->delalloc_lock);
7554 if (inode) { 7602
7555 work = btrfs_alloc_delalloc_work(inode, 0, delay_iput); 7603 work = btrfs_alloc_delalloc_work(inode, 0, delay_iput);
7556 if (!work) { 7604 if (unlikely(!work)) {
7557 ret = -ENOMEM; 7605 ret = -ENOMEM;
7558 goto out; 7606 goto out;
7559 }
7560 list_add_tail(&work->list, &works);
7561 btrfs_queue_worker(&root->fs_info->flush_workers,
7562 &work->work);
7563 } 7607 }
7608 list_add_tail(&work->list, &works);
7609 btrfs_queue_worker(&root->fs_info->flush_workers,
7610 &work->work);
7611
7564 cond_resched(); 7612 cond_resched();
7565 spin_lock(&root->fs_info->delalloc_lock); 7613 spin_lock(&root->fs_info->delalloc_lock);
7566 } 7614 }
7567 spin_unlock(&root->fs_info->delalloc_lock); 7615 spin_unlock(&root->fs_info->delalloc_lock);
7568 7616
7617 list_for_each_entry_safe(work, next, &works, list) {
7618 list_del_init(&work->list);
7619 btrfs_wait_and_free_delalloc_work(work);
7620 }
7621
7622 spin_lock(&root->fs_info->delalloc_lock);
7623 if (!list_empty(&root->fs_info->delalloc_inodes)) {
7624 spin_unlock(&root->fs_info->delalloc_lock);
7625 goto again;
7626 }
7627 spin_unlock(&root->fs_info->delalloc_lock);
7628
7569 /* the filemap_flush will queue IO into the worker threads, but 7629 /* the filemap_flush will queue IO into the worker threads, but
7570 * we have to make sure the IO is actually started and that 7630 * we have to make sure the IO is actually started and that
7571 * ordered extents get created before we return 7631 * ordered extents get created before we return
@@ -7578,11 +7638,18 @@ int btrfs_start_delalloc_inodes(struct btrfs_root *root, int delay_iput)
7578 atomic_read(&root->fs_info->async_delalloc_pages) == 0)); 7638 atomic_read(&root->fs_info->async_delalloc_pages) == 0));
7579 } 7639 }
7580 atomic_dec(&root->fs_info->async_submit_draining); 7640 atomic_dec(&root->fs_info->async_submit_draining);
7641 return 0;
7581out: 7642out:
7582 list_for_each_entry_safe(work, next, &works, list) { 7643 list_for_each_entry_safe(work, next, &works, list) {
7583 list_del_init(&work->list); 7644 list_del_init(&work->list);
7584 btrfs_wait_and_free_delalloc_work(work); 7645 btrfs_wait_and_free_delalloc_work(work);
7585 } 7646 }
7647
7648 if (!list_empty_careful(&splice)) {
7649 spin_lock(&root->fs_info->delalloc_lock);
7650 list_splice_tail(&splice, &root->fs_info->delalloc_inodes);
7651 spin_unlock(&root->fs_info->delalloc_lock);
7652 }
7586 return ret; 7653 return ret;
7587} 7654}
7588 7655
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 4b4516770f05..5b22d45d3c6a 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1339,7 +1339,8 @@ static noinline int btrfs_ioctl_resize(struct file *file,
1339 if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running, 1339 if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running,
1340 1)) { 1340 1)) {
1341 pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n"); 1341 pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n");
1342 return -EINPROGRESS; 1342 mnt_drop_write_file(file);
1343 return -EINVAL;
1343 } 1344 }
1344 1345
1345 mutex_lock(&root->fs_info->volume_mutex); 1346 mutex_lock(&root->fs_info->volume_mutex);
@@ -1362,6 +1363,7 @@ static noinline int btrfs_ioctl_resize(struct file *file,
1362 printk(KERN_INFO "btrfs: resizing devid %llu\n", 1363 printk(KERN_INFO "btrfs: resizing devid %llu\n",
1363 (unsigned long long)devid); 1364 (unsigned long long)devid);
1364 } 1365 }
1366
1365 device = btrfs_find_device(root->fs_info, devid, NULL, NULL); 1367 device = btrfs_find_device(root->fs_info, devid, NULL, NULL);
1366 if (!device) { 1368 if (!device) {
1367 printk(KERN_INFO "btrfs: resizer unable to find device %llu\n", 1369 printk(KERN_INFO "btrfs: resizer unable to find device %llu\n",
@@ -1369,9 +1371,10 @@ static noinline int btrfs_ioctl_resize(struct file *file,
1369 ret = -EINVAL; 1371 ret = -EINVAL;
1370 goto out_free; 1372 goto out_free;
1371 } 1373 }
1372 if (device->fs_devices && device->fs_devices->seeding) { 1374
1375 if (!device->writeable) {
1373 printk(KERN_INFO "btrfs: resizer unable to apply on " 1376 printk(KERN_INFO "btrfs: resizer unable to apply on "
1374 "seeding device %llu\n", 1377 "readonly device %llu\n",
1375 (unsigned long long)devid); 1378 (unsigned long long)devid);
1376 ret = -EINVAL; 1379 ret = -EINVAL;
1377 goto out_free; 1380 goto out_free;
@@ -1443,8 +1446,8 @@ out_free:
1443 kfree(vol_args); 1446 kfree(vol_args);
1444out: 1447out:
1445 mutex_unlock(&root->fs_info->volume_mutex); 1448 mutex_unlock(&root->fs_info->volume_mutex);
1446 mnt_drop_write_file(file);
1447 atomic_set(&root->fs_info->mutually_exclusive_operation_running, 0); 1449 atomic_set(&root->fs_info->mutually_exclusive_operation_running, 0);
1450 mnt_drop_write_file(file);
1448 return ret; 1451 return ret;
1449} 1452}
1450 1453
@@ -2095,13 +2098,13 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
2095 err = inode_permission(inode, MAY_WRITE | MAY_EXEC); 2098 err = inode_permission(inode, MAY_WRITE | MAY_EXEC);
2096 if (err) 2099 if (err)
2097 goto out_dput; 2100 goto out_dput;
2098
2099 /* check if subvolume may be deleted by a non-root user */
2100 err = btrfs_may_delete(dir, dentry, 1);
2101 if (err)
2102 goto out_dput;
2103 } 2101 }
2104 2102
2103 /* check if subvolume may be deleted by a user */
2104 err = btrfs_may_delete(dir, dentry, 1);
2105 if (err)
2106 goto out_dput;
2107
2105 if (btrfs_ino(inode) != BTRFS_FIRST_FREE_OBJECTID) { 2108 if (btrfs_ino(inode) != BTRFS_FIRST_FREE_OBJECTID) {
2106 err = -EINVAL; 2109 err = -EINVAL;
2107 goto out_dput; 2110 goto out_dput;
@@ -2183,19 +2186,20 @@ static int btrfs_ioctl_defrag(struct file *file, void __user *argp)
2183 struct btrfs_ioctl_defrag_range_args *range; 2186 struct btrfs_ioctl_defrag_range_args *range;
2184 int ret; 2187 int ret;
2185 2188
2186 if (btrfs_root_readonly(root)) 2189 ret = mnt_want_write_file(file);
2187 return -EROFS; 2190 if (ret)
2191 return ret;
2188 2192
2189 if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running, 2193 if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running,
2190 1)) { 2194 1)) {
2191 pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n"); 2195 pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n");
2192 return -EINPROGRESS; 2196 mnt_drop_write_file(file);
2197 return -EINVAL;
2193 } 2198 }
2194 ret = mnt_want_write_file(file); 2199
2195 if (ret) { 2200 if (btrfs_root_readonly(root)) {
2196 atomic_set(&root->fs_info->mutually_exclusive_operation_running, 2201 ret = -EROFS;
2197 0); 2202 goto out;
2198 return ret;
2199 } 2203 }
2200 2204
2201 switch (inode->i_mode & S_IFMT) { 2205 switch (inode->i_mode & S_IFMT) {
@@ -2247,8 +2251,8 @@ static int btrfs_ioctl_defrag(struct file *file, void __user *argp)
2247 ret = -EINVAL; 2251 ret = -EINVAL;
2248 } 2252 }
2249out: 2253out:
2250 mnt_drop_write_file(file);
2251 atomic_set(&root->fs_info->mutually_exclusive_operation_running, 0); 2254 atomic_set(&root->fs_info->mutually_exclusive_operation_running, 0);
2255 mnt_drop_write_file(file);
2252 return ret; 2256 return ret;
2253} 2257}
2254 2258
@@ -2263,7 +2267,7 @@ static long btrfs_ioctl_add_dev(struct btrfs_root *root, void __user *arg)
2263 if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running, 2267 if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running,
2264 1)) { 2268 1)) {
2265 pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n"); 2269 pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n");
2266 return -EINPROGRESS; 2270 return -EINVAL;
2267 } 2271 }
2268 2272
2269 mutex_lock(&root->fs_info->volume_mutex); 2273 mutex_lock(&root->fs_info->volume_mutex);
@@ -2300,7 +2304,7 @@ static long btrfs_ioctl_rm_dev(struct file *file, void __user *arg)
2300 1)) { 2304 1)) {
2301 pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n"); 2305 pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n");
2302 mnt_drop_write_file(file); 2306 mnt_drop_write_file(file);
2303 return -EINPROGRESS; 2307 return -EINVAL;
2304 } 2308 }
2305 2309
2306 mutex_lock(&root->fs_info->volume_mutex); 2310 mutex_lock(&root->fs_info->volume_mutex);
@@ -2316,8 +2320,8 @@ static long btrfs_ioctl_rm_dev(struct file *file, void __user *arg)
2316 kfree(vol_args); 2320 kfree(vol_args);
2317out: 2321out:
2318 mutex_unlock(&root->fs_info->volume_mutex); 2322 mutex_unlock(&root->fs_info->volume_mutex);
2319 mnt_drop_write_file(file);
2320 atomic_set(&root->fs_info->mutually_exclusive_operation_running, 0); 2323 atomic_set(&root->fs_info->mutually_exclusive_operation_running, 0);
2324 mnt_drop_write_file(file);
2321 return ret; 2325 return ret;
2322} 2326}
2323 2327
@@ -3437,8 +3441,8 @@ static long btrfs_ioctl_balance(struct file *file, void __user *arg)
3437 struct btrfs_fs_info *fs_info = root->fs_info; 3441 struct btrfs_fs_info *fs_info = root->fs_info;
3438 struct btrfs_ioctl_balance_args *bargs; 3442 struct btrfs_ioctl_balance_args *bargs;
3439 struct btrfs_balance_control *bctl; 3443 struct btrfs_balance_control *bctl;
3444 bool need_unlock; /* for mut. excl. ops lock */
3440 int ret; 3445 int ret;
3441 int need_to_clear_lock = 0;
3442 3446
3443 if (!capable(CAP_SYS_ADMIN)) 3447 if (!capable(CAP_SYS_ADMIN))
3444 return -EPERM; 3448 return -EPERM;
@@ -3447,14 +3451,61 @@ static long btrfs_ioctl_balance(struct file *file, void __user *arg)
3447 if (ret) 3451 if (ret)
3448 return ret; 3452 return ret;
3449 3453
3450 mutex_lock(&fs_info->volume_mutex); 3454again:
3455 if (!atomic_xchg(&fs_info->mutually_exclusive_operation_running, 1)) {
3456 mutex_lock(&fs_info->volume_mutex);
3457 mutex_lock(&fs_info->balance_mutex);
3458 need_unlock = true;
3459 goto locked;
3460 }
3461
3462 /*
3463 * mut. excl. ops lock is locked. Three possibilites:
3464 * (1) some other op is running
3465 * (2) balance is running
3466 * (3) balance is paused -- special case (think resume)
3467 */
3451 mutex_lock(&fs_info->balance_mutex); 3468 mutex_lock(&fs_info->balance_mutex);
3469 if (fs_info->balance_ctl) {
3470 /* this is either (2) or (3) */
3471 if (!atomic_read(&fs_info->balance_running)) {
3472 mutex_unlock(&fs_info->balance_mutex);
3473 if (!mutex_trylock(&fs_info->volume_mutex))
3474 goto again;
3475 mutex_lock(&fs_info->balance_mutex);
3476
3477 if (fs_info->balance_ctl &&
3478 !atomic_read(&fs_info->balance_running)) {
3479 /* this is (3) */
3480 need_unlock = false;
3481 goto locked;
3482 }
3483
3484 mutex_unlock(&fs_info->balance_mutex);
3485 mutex_unlock(&fs_info->volume_mutex);
3486 goto again;
3487 } else {
3488 /* this is (2) */
3489 mutex_unlock(&fs_info->balance_mutex);
3490 ret = -EINPROGRESS;
3491 goto out;
3492 }
3493 } else {
3494 /* this is (1) */
3495 mutex_unlock(&fs_info->balance_mutex);
3496 pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n");
3497 ret = -EINVAL;
3498 goto out;
3499 }
3500
3501locked:
3502 BUG_ON(!atomic_read(&fs_info->mutually_exclusive_operation_running));
3452 3503
3453 if (arg) { 3504 if (arg) {
3454 bargs = memdup_user(arg, sizeof(*bargs)); 3505 bargs = memdup_user(arg, sizeof(*bargs));
3455 if (IS_ERR(bargs)) { 3506 if (IS_ERR(bargs)) {
3456 ret = PTR_ERR(bargs); 3507 ret = PTR_ERR(bargs);
3457 goto out; 3508 goto out_unlock;
3458 } 3509 }
3459 3510
3460 if (bargs->flags & BTRFS_BALANCE_RESUME) { 3511 if (bargs->flags & BTRFS_BALANCE_RESUME) {
@@ -3474,13 +3525,10 @@ static long btrfs_ioctl_balance(struct file *file, void __user *arg)
3474 bargs = NULL; 3525 bargs = NULL;
3475 } 3526 }
3476 3527
3477 if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running, 3528 if (fs_info->balance_ctl) {
3478 1)) {
3479 pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n");
3480 ret = -EINPROGRESS; 3529 ret = -EINPROGRESS;
3481 goto out_bargs; 3530 goto out_bargs;
3482 } 3531 }
3483 need_to_clear_lock = 1;
3484 3532
3485 bctl = kzalloc(sizeof(*bctl), GFP_NOFS); 3533 bctl = kzalloc(sizeof(*bctl), GFP_NOFS);
3486 if (!bctl) { 3534 if (!bctl) {
@@ -3501,11 +3549,17 @@ static long btrfs_ioctl_balance(struct file *file, void __user *arg)
3501 } 3549 }
3502 3550
3503do_balance: 3551do_balance:
3504 ret = btrfs_balance(bctl, bargs);
3505 /* 3552 /*
3506 * bctl is freed in __cancel_balance or in free_fs_info if 3553 * Ownership of bctl and mutually_exclusive_operation_running
3507 * restriper was paused all the way until unmount 3554 * goes to to btrfs_balance. bctl is freed in __cancel_balance,
3555 * or, if restriper was paused all the way until unmount, in
3556 * free_fs_info. mutually_exclusive_operation_running is
3557 * cleared in __cancel_balance.
3508 */ 3558 */
3559 need_unlock = false;
3560
3561 ret = btrfs_balance(bctl, bargs);
3562
3509 if (arg) { 3563 if (arg) {
3510 if (copy_to_user(arg, bargs, sizeof(*bargs))) 3564 if (copy_to_user(arg, bargs, sizeof(*bargs)))
3511 ret = -EFAULT; 3565 ret = -EFAULT;
@@ -3513,12 +3567,12 @@ do_balance:
3513 3567
3514out_bargs: 3568out_bargs:
3515 kfree(bargs); 3569 kfree(bargs);
3516out: 3570out_unlock:
3517 if (need_to_clear_lock)
3518 atomic_set(&root->fs_info->mutually_exclusive_operation_running,
3519 0);
3520 mutex_unlock(&fs_info->balance_mutex); 3571 mutex_unlock(&fs_info->balance_mutex);
3521 mutex_unlock(&fs_info->volume_mutex); 3572 mutex_unlock(&fs_info->volume_mutex);
3573 if (need_unlock)
3574 atomic_set(&fs_info->mutually_exclusive_operation_running, 0);
3575out:
3522 mnt_drop_write_file(file); 3576 mnt_drop_write_file(file);
3523 return ret; 3577 return ret;
3524} 3578}
@@ -3698,6 +3752,11 @@ static long btrfs_ioctl_qgroup_create(struct file *file, void __user *arg)
3698 goto drop_write; 3752 goto drop_write;
3699 } 3753 }
3700 3754
3755 if (!sa->qgroupid) {
3756 ret = -EINVAL;
3757 goto out;
3758 }
3759
3701 trans = btrfs_join_transaction(root); 3760 trans = btrfs_join_transaction(root);
3702 if (IS_ERR(trans)) { 3761 if (IS_ERR(trans)) {
3703 ret = PTR_ERR(trans); 3762 ret = PTR_ERR(trans);
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index fe9d02c45f8e..a5c856234323 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -379,6 +379,13 @@ next1:
379 379
380 ret = add_relation_rb(fs_info, found_key.objectid, 380 ret = add_relation_rb(fs_info, found_key.objectid,
381 found_key.offset); 381 found_key.offset);
382 if (ret == -ENOENT) {
383 printk(KERN_WARNING
384 "btrfs: orphan qgroup relation 0x%llx->0x%llx\n",
385 (unsigned long long)found_key.objectid,
386 (unsigned long long)found_key.offset);
387 ret = 0; /* ignore the error */
388 }
382 if (ret) 389 if (ret)
383 goto out; 390 goto out;
384next2: 391next2:
@@ -956,17 +963,28 @@ int btrfs_remove_qgroup(struct btrfs_trans_handle *trans,
956 struct btrfs_fs_info *fs_info, u64 qgroupid) 963 struct btrfs_fs_info *fs_info, u64 qgroupid)
957{ 964{
958 struct btrfs_root *quota_root; 965 struct btrfs_root *quota_root;
966 struct btrfs_qgroup *qgroup;
959 int ret = 0; 967 int ret = 0;
960 968
961 quota_root = fs_info->quota_root; 969 quota_root = fs_info->quota_root;
962 if (!quota_root) 970 if (!quota_root)
963 return -EINVAL; 971 return -EINVAL;
964 972
973 /* check if there are no relations to this qgroup */
974 spin_lock(&fs_info->qgroup_lock);
975 qgroup = find_qgroup_rb(fs_info, qgroupid);
976 if (qgroup) {
977 if (!list_empty(&qgroup->groups) || !list_empty(&qgroup->members)) {
978 spin_unlock(&fs_info->qgroup_lock);
979 return -EBUSY;
980 }
981 }
982 spin_unlock(&fs_info->qgroup_lock);
983
965 ret = del_qgroup_item(trans, quota_root, qgroupid); 984 ret = del_qgroup_item(trans, quota_root, qgroupid);
966 985
967 spin_lock(&fs_info->qgroup_lock); 986 spin_lock(&fs_info->qgroup_lock);
968 del_qgroup_rb(quota_root->fs_info, qgroupid); 987 del_qgroup_rb(quota_root->fs_info, qgroupid);
969
970 spin_unlock(&fs_info->qgroup_lock); 988 spin_unlock(&fs_info->qgroup_lock);
971 989
972 return ret; 990 return ret;
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 54454542ad40..321b7fb4e441 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -1814,8 +1814,10 @@ static int name_cache_insert(struct send_ctx *sctx,
1814 (unsigned long)nce->ino); 1814 (unsigned long)nce->ino);
1815 if (!nce_head) { 1815 if (!nce_head) {
1816 nce_head = kmalloc(sizeof(*nce_head), GFP_NOFS); 1816 nce_head = kmalloc(sizeof(*nce_head), GFP_NOFS);
1817 if (!nce_head) 1817 if (!nce_head) {
1818 kfree(nce);
1818 return -ENOMEM; 1819 return -ENOMEM;
1820 }
1819 INIT_LIST_HEAD(nce_head); 1821 INIT_LIST_HEAD(nce_head);
1820 1822
1821 ret = radix_tree_insert(&sctx->name_cache, nce->ino, nce_head); 1823 ret = radix_tree_insert(&sctx->name_cache, nce->ino, nce_head);
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 99545df1b86c..d8982e9601d3 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -267,7 +267,7 @@ void __btrfs_abort_transaction(struct btrfs_trans_handle *trans,
267 function, line, errstr); 267 function, line, errstr);
268 return; 268 return;
269 } 269 }
270 trans->transaction->aborted = errno; 270 ACCESS_ONCE(trans->transaction->aborted) = errno;
271 __btrfs_std_error(root->fs_info, function, line, errno, NULL); 271 __btrfs_std_error(root->fs_info, function, line, errno, NULL);
272} 272}
273/* 273/*
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 87fac9a21ea5..f15494699f3b 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -1468,7 +1468,8 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
1468 goto cleanup_transaction; 1468 goto cleanup_transaction;
1469 } 1469 }
1470 1470
1471 if (cur_trans->aborted) { 1471 /* Stop the commit early if ->aborted is set */
1472 if (unlikely(ACCESS_ONCE(cur_trans->aborted))) {
1472 ret = cur_trans->aborted; 1473 ret = cur_trans->aborted;
1473 goto cleanup_transaction; 1474 goto cleanup_transaction;
1474 } 1475 }
@@ -1574,6 +1575,11 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
1574 wait_event(cur_trans->writer_wait, 1575 wait_event(cur_trans->writer_wait,
1575 atomic_read(&cur_trans->num_writers) == 1); 1576 atomic_read(&cur_trans->num_writers) == 1);
1576 1577
1578 /* ->aborted might be set after the previous check, so check it */
1579 if (unlikely(ACCESS_ONCE(cur_trans->aborted))) {
1580 ret = cur_trans->aborted;
1581 goto cleanup_transaction;
1582 }
1577 /* 1583 /*
1578 * the reloc mutex makes sure that we stop 1584 * the reloc mutex makes sure that we stop
1579 * the balancing code from coming in and moving 1585 * the balancing code from coming in and moving
@@ -1657,6 +1663,17 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
1657 goto cleanup_transaction; 1663 goto cleanup_transaction;
1658 } 1664 }
1659 1665
1666 /*
1667 * The tasks which save the space cache and inode cache may also
1668 * update ->aborted, check it.
1669 */
1670 if (unlikely(ACCESS_ONCE(cur_trans->aborted))) {
1671 ret = cur_trans->aborted;
1672 mutex_unlock(&root->fs_info->tree_log_mutex);
1673 mutex_unlock(&root->fs_info->reloc_mutex);
1674 goto cleanup_transaction;
1675 }
1676
1660 btrfs_prepare_extent_commit(trans, root); 1677 btrfs_prepare_extent_commit(trans, root);
1661 1678
1662 cur_trans = root->fs_info->running_transaction; 1679 cur_trans = root->fs_info->running_transaction;
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 83186c7e45d4..9027bb1e7466 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3357,6 +3357,11 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
3357 if (skip_csum) 3357 if (skip_csum)
3358 return 0; 3358 return 0;
3359 3359
3360 if (em->compress_type) {
3361 csum_offset = 0;
3362 csum_len = block_len;
3363 }
3364
3360 /* block start is already adjusted for the file extent offset. */ 3365 /* block start is already adjusted for the file extent offset. */
3361 ret = btrfs_lookup_csums_range(log->fs_info->csum_root, 3366 ret = btrfs_lookup_csums_range(log->fs_info->csum_root,
3362 em->block_start + csum_offset, 3367 em->block_start + csum_offset,
@@ -3410,13 +3415,13 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
3410 em = list_entry(extents.next, struct extent_map, list); 3415 em = list_entry(extents.next, struct extent_map, list);
3411 3416
3412 list_del_init(&em->list); 3417 list_del_init(&em->list);
3413 clear_bit(EXTENT_FLAG_LOGGING, &em->flags);
3414 3418
3415 /* 3419 /*
3416 * If we had an error we just need to delete everybody from our 3420 * If we had an error we just need to delete everybody from our
3417 * private list. 3421 * private list.
3418 */ 3422 */
3419 if (ret) { 3423 if (ret) {
3424 clear_em_logging(tree, em);
3420 free_extent_map(em); 3425 free_extent_map(em);
3421 continue; 3426 continue;
3422 } 3427 }
@@ -3424,8 +3429,9 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
3424 write_unlock(&tree->lock); 3429 write_unlock(&tree->lock);
3425 3430
3426 ret = log_one_extent(trans, inode, root, em, path); 3431 ret = log_one_extent(trans, inode, root, em, path);
3427 free_extent_map(em);
3428 write_lock(&tree->lock); 3432 write_lock(&tree->lock);
3433 clear_em_logging(tree, em);
3434 free_extent_map(em);
3429 } 3435 }
3430 WARN_ON(!list_empty(&extents)); 3436 WARN_ON(!list_empty(&extents));
3431 write_unlock(&tree->lock); 3437 write_unlock(&tree->lock);
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 5cce6aa74012..15f6efdf6463 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1431,7 +1431,7 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path)
1431 } 1431 }
1432 } else { 1432 } else {
1433 ret = btrfs_get_bdev_and_sb(device_path, 1433 ret = btrfs_get_bdev_and_sb(device_path,
1434 FMODE_READ | FMODE_EXCL, 1434 FMODE_WRITE | FMODE_EXCL,
1435 root->fs_info->bdev_holder, 0, 1435 root->fs_info->bdev_holder, 0,
1436 &bdev, &bh); 1436 &bdev, &bh);
1437 if (ret) 1437 if (ret)
@@ -2614,7 +2614,14 @@ static int chunk_usage_filter(struct btrfs_fs_info *fs_info, u64 chunk_offset,
2614 cache = btrfs_lookup_block_group(fs_info, chunk_offset); 2614 cache = btrfs_lookup_block_group(fs_info, chunk_offset);
2615 chunk_used = btrfs_block_group_used(&cache->item); 2615 chunk_used = btrfs_block_group_used(&cache->item);
2616 2616
2617 user_thresh = div_factor_fine(cache->key.offset, bargs->usage); 2617 if (bargs->usage == 0)
2618 user_thresh = 0;
2619 else if (bargs->usage > 100)
2620 user_thresh = cache->key.offset;
2621 else
2622 user_thresh = div_factor_fine(cache->key.offset,
2623 bargs->usage);
2624
2618 if (chunk_used < user_thresh) 2625 if (chunk_used < user_thresh)
2619 ret = 0; 2626 ret = 0;
2620 2627
@@ -2959,6 +2966,8 @@ static void __cancel_balance(struct btrfs_fs_info *fs_info)
2959 unset_balance_control(fs_info); 2966 unset_balance_control(fs_info);
2960 ret = del_balance_item(fs_info->tree_root); 2967 ret = del_balance_item(fs_info->tree_root);
2961 BUG_ON(ret); 2968 BUG_ON(ret);
2969
2970 atomic_set(&fs_info->mutually_exclusive_operation_running, 0);
2962} 2971}
2963 2972
2964void update_ioctl_balance_args(struct btrfs_fs_info *fs_info, int lock, 2973void update_ioctl_balance_args(struct btrfs_fs_info *fs_info, int lock,
@@ -3138,8 +3147,10 @@ int btrfs_balance(struct btrfs_balance_control *bctl,
3138out: 3147out:
3139 if (bctl->flags & BTRFS_BALANCE_RESUME) 3148 if (bctl->flags & BTRFS_BALANCE_RESUME)
3140 __cancel_balance(fs_info); 3149 __cancel_balance(fs_info);
3141 else 3150 else {
3142 kfree(bctl); 3151 kfree(bctl);
3152 atomic_set(&fs_info->mutually_exclusive_operation_running, 0);
3153 }
3143 return ret; 3154 return ret;
3144} 3155}
3145 3156
@@ -3156,7 +3167,6 @@ static int balance_kthread(void *data)
3156 ret = btrfs_balance(fs_info->balance_ctl, NULL); 3167 ret = btrfs_balance(fs_info->balance_ctl, NULL);
3157 } 3168 }
3158 3169
3159 atomic_set(&fs_info->mutually_exclusive_operation_running, 0);
3160 mutex_unlock(&fs_info->balance_mutex); 3170 mutex_unlock(&fs_info->balance_mutex);
3161 mutex_unlock(&fs_info->volume_mutex); 3171 mutex_unlock(&fs_info->volume_mutex);
3162 3172
@@ -3179,7 +3189,6 @@ int btrfs_resume_balance_async(struct btrfs_fs_info *fs_info)
3179 return 0; 3189 return 0;
3180 } 3190 }
3181 3191
3182 WARN_ON(atomic_xchg(&fs_info->mutually_exclusive_operation_running, 1));
3183 tsk = kthread_run(balance_kthread, fs_info, "btrfs-balance"); 3192 tsk = kthread_run(balance_kthread, fs_info, "btrfs-balance");
3184 if (IS_ERR(tsk)) 3193 if (IS_ERR(tsk))
3185 return PTR_ERR(tsk); 3194 return PTR_ERR(tsk);
@@ -3233,6 +3242,8 @@ int btrfs_recover_balance(struct btrfs_fs_info *fs_info)
3233 btrfs_balance_sys(leaf, item, &disk_bargs); 3242 btrfs_balance_sys(leaf, item, &disk_bargs);
3234 btrfs_disk_balance_args_to_cpu(&bctl->sys, &disk_bargs); 3243 btrfs_disk_balance_args_to_cpu(&bctl->sys, &disk_bargs);
3235 3244
3245 WARN_ON(atomic_xchg(&fs_info->mutually_exclusive_operation_running, 1));
3246
3236 mutex_lock(&fs_info->volume_mutex); 3247 mutex_lock(&fs_info->volume_mutex);
3237 mutex_lock(&fs_info->balance_mutex); 3248 mutex_lock(&fs_info->balance_mutex);
3238 3249
@@ -3496,7 +3507,7 @@ struct btrfs_raid_attr btrfs_raid_array[BTRFS_NR_RAID_TYPES] = {
3496 { 1, 1, 2, 2, 2, 2 /* raid1 */ }, 3507 { 1, 1, 2, 2, 2, 2 /* raid1 */ },
3497 { 1, 2, 1, 1, 1, 2 /* dup */ }, 3508 { 1, 2, 1, 1, 1, 2 /* dup */ },
3498 { 1, 1, 0, 2, 1, 1 /* raid0 */ }, 3509 { 1, 1, 0, 2, 1, 1 /* raid0 */ },
3499 { 1, 1, 0, 1, 1, 1 /* single */ }, 3510 { 1, 1, 1, 1, 1, 1 /* single */ },
3500}; 3511};
3501 3512
3502static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans, 3513static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
diff --git a/fs/buffer.c b/fs/buffer.c
index c017a2dfb909..7a75c3e0fd58 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -2935,6 +2935,7 @@ static void guard_bh_eod(int rw, struct bio *bio, struct buffer_head *bh)
2935 void *kaddr = kmap_atomic(bh->b_page); 2935 void *kaddr = kmap_atomic(bh->b_page);
2936 memset(kaddr + bh_offset(bh) + bytes, 0, bh->b_size - bytes); 2936 memset(kaddr + bh_offset(bh) + bytes, 0, bh->b_size - bytes);
2937 kunmap_atomic(kaddr); 2937 kunmap_atomic(kaddr);
2938 flush_dcache_page(bh->b_page);
2938 } 2939 }
2939} 2940}
2940 2941
diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c
index ce5cbd717bfc..210fce2df308 100644
--- a/fs/cifs/cifs_dfs_ref.c
+++ b/fs/cifs/cifs_dfs_ref.c
@@ -226,6 +226,8 @@ compose_mount_options_out:
226compose_mount_options_err: 226compose_mount_options_err:
227 kfree(mountdata); 227 kfree(mountdata);
228 mountdata = ERR_PTR(rc); 228 mountdata = ERR_PTR(rc);
229 kfree(*devname);
230 *devname = NULL;
229 goto compose_mount_options_out; 231 goto compose_mount_options_out;
230} 232}
231 233
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index f653835d067b..de7f9168a118 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -228,7 +228,6 @@ cifs_alloc_inode(struct super_block *sb)
228 cifs_set_oplock_level(cifs_inode, 0); 228 cifs_set_oplock_level(cifs_inode, 0);
229 cifs_inode->delete_pending = false; 229 cifs_inode->delete_pending = false;
230 cifs_inode->invalid_mapping = false; 230 cifs_inode->invalid_mapping = false;
231 cifs_inode->leave_pages_clean = false;
232 cifs_inode->vfs_inode.i_blkbits = 14; /* 2**14 = CIFS_MAX_MSGSIZE */ 231 cifs_inode->vfs_inode.i_blkbits = 14; /* 2**14 = CIFS_MAX_MSGSIZE */
233 cifs_inode->server_eof = 0; 232 cifs_inode->server_eof = 0;
234 cifs_inode->uniqueid = 0; 233 cifs_inode->uniqueid = 0;
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index aea1eec64911..e6899cea1c35 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -386,6 +386,7 @@ struct smb_version_values {
386 unsigned int cap_unix; 386 unsigned int cap_unix;
387 unsigned int cap_nt_find; 387 unsigned int cap_nt_find;
388 unsigned int cap_large_files; 388 unsigned int cap_large_files;
389 unsigned int oplock_read;
389}; 390};
390 391
391#define HEADER_SIZE(server) (server->vals->header_size) 392#define HEADER_SIZE(server) (server->vals->header_size)
@@ -1030,7 +1031,6 @@ struct cifsInodeInfo {
1030 bool clientCanCacheAll; /* read and writebehind oplock */ 1031 bool clientCanCacheAll; /* read and writebehind oplock */
1031 bool delete_pending; /* DELETE_ON_CLOSE is set */ 1032 bool delete_pending; /* DELETE_ON_CLOSE is set */
1032 bool invalid_mapping; /* pagecache is invalid */ 1033 bool invalid_mapping; /* pagecache is invalid */
1033 bool leave_pages_clean; /* protected by i_mutex, not set pages dirty */
1034 unsigned long time; /* jiffies of last update of inode */ 1034 unsigned long time; /* jiffies of last update of inode */
1035 u64 server_eof; /* current file size on server -- protected by i_lock */ 1035 u64 server_eof; /* current file size on server -- protected by i_lock */
1036 u64 uniqueid; /* server inode number */ 1036 u64 uniqueid; /* server inode number */
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 17c3643e5950..12b3da39733b 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1917,7 +1917,7 @@ srcip_matches(struct sockaddr *srcaddr, struct sockaddr *rhs)
1917 } 1917 }
1918 case AF_INET6: { 1918 case AF_INET6: {
1919 struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *)srcaddr; 1919 struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *)srcaddr;
1920 struct sockaddr_in6 *vaddr6 = (struct sockaddr_in6 *)&rhs; 1920 struct sockaddr_in6 *vaddr6 = (struct sockaddr_in6 *)rhs;
1921 return ipv6_addr_equal(&saddr6->sin6_addr, &vaddr6->sin6_addr); 1921 return ipv6_addr_equal(&saddr6->sin6_addr, &vaddr6->sin6_addr);
1922 } 1922 }
1923 default: 1923 default:
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 0a6677ba212b..8ea6ca50a665 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -238,6 +238,23 @@ out:
238 return rc; 238 return rc;
239} 239}
240 240
241static bool
242cifs_has_mand_locks(struct cifsInodeInfo *cinode)
243{
244 struct cifs_fid_locks *cur;
245 bool has_locks = false;
246
247 down_read(&cinode->lock_sem);
248 list_for_each_entry(cur, &cinode->llist, llist) {
249 if (!list_empty(&cur->locks)) {
250 has_locks = true;
251 break;
252 }
253 }
254 up_read(&cinode->lock_sem);
255 return has_locks;
256}
257
241struct cifsFileInfo * 258struct cifsFileInfo *
242cifs_new_fileinfo(struct cifs_fid *fid, struct file *file, 259cifs_new_fileinfo(struct cifs_fid *fid, struct file *file,
243 struct tcon_link *tlink, __u32 oplock) 260 struct tcon_link *tlink, __u32 oplock)
@@ -248,6 +265,7 @@ cifs_new_fileinfo(struct cifs_fid *fid, struct file *file,
248 struct cifsFileInfo *cfile; 265 struct cifsFileInfo *cfile;
249 struct cifs_fid_locks *fdlocks; 266 struct cifs_fid_locks *fdlocks;
250 struct cifs_tcon *tcon = tlink_tcon(tlink); 267 struct cifs_tcon *tcon = tlink_tcon(tlink);
268 struct TCP_Server_Info *server = tcon->ses->server;
251 269
252 cfile = kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); 270 cfile = kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL);
253 if (cfile == NULL) 271 if (cfile == NULL)
@@ -276,12 +294,22 @@ cifs_new_fileinfo(struct cifs_fid *fid, struct file *file,
276 INIT_WORK(&cfile->oplock_break, cifs_oplock_break); 294 INIT_WORK(&cfile->oplock_break, cifs_oplock_break);
277 mutex_init(&cfile->fh_mutex); 295 mutex_init(&cfile->fh_mutex);
278 296
297 /*
298 * If the server returned a read oplock and we have mandatory brlocks,
299 * set oplock level to None.
300 */
301 if (oplock == server->vals->oplock_read &&
302 cifs_has_mand_locks(cinode)) {
303 cFYI(1, "Reset oplock val from read to None due to mand locks");
304 oplock = 0;
305 }
306
279 spin_lock(&cifs_file_list_lock); 307 spin_lock(&cifs_file_list_lock);
280 if (fid->pending_open->oplock != CIFS_OPLOCK_NO_CHANGE) 308 if (fid->pending_open->oplock != CIFS_OPLOCK_NO_CHANGE && oplock)
281 oplock = fid->pending_open->oplock; 309 oplock = fid->pending_open->oplock;
282 list_del(&fid->pending_open->olist); 310 list_del(&fid->pending_open->olist);
283 311
284 tlink_tcon(tlink)->ses->server->ops->set_fid(cfile, fid, oplock); 312 server->ops->set_fid(cfile, fid, oplock);
285 313
286 list_add(&cfile->tlist, &tcon->openFileList); 314 list_add(&cfile->tlist, &tcon->openFileList);
287 /* if readable file instance put first in list*/ 315 /* if readable file instance put first in list*/
@@ -1422,6 +1450,7 @@ cifs_setlk(struct file *file, struct file_lock *flock, __u32 type,
1422 struct cifsFileInfo *cfile = (struct cifsFileInfo *)file->private_data; 1450 struct cifsFileInfo *cfile = (struct cifsFileInfo *)file->private_data;
1423 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); 1451 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
1424 struct TCP_Server_Info *server = tcon->ses->server; 1452 struct TCP_Server_Info *server = tcon->ses->server;
1453 struct inode *inode = cfile->dentry->d_inode;
1425 1454
1426 if (posix_lck) { 1455 if (posix_lck) {
1427 int posix_lock_type; 1456 int posix_lock_type;
@@ -1459,6 +1488,21 @@ cifs_setlk(struct file *file, struct file_lock *flock, __u32 type,
1459 if (!rc) 1488 if (!rc)
1460 goto out; 1489 goto out;
1461 1490
1491 /*
1492 * Windows 7 server can delay breaking lease from read to None
1493 * if we set a byte-range lock on a file - break it explicitly
1494 * before sending the lock to the server to be sure the next
1495 * read won't conflict with non-overlapted locks due to
1496 * pagereading.
1497 */
1498 if (!CIFS_I(inode)->clientCanCacheAll &&
1499 CIFS_I(inode)->clientCanCacheRead) {
1500 cifs_invalidate_mapping(inode);
1501 cFYI(1, "Set no oplock for inode=%p due to mand locks",
1502 inode);
1503 CIFS_I(inode)->clientCanCacheRead = false;
1504 }
1505
1462 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, 1506 rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length,
1463 type, 1, 0, wait_flag); 1507 type, 1, 0, wait_flag);
1464 if (rc) { 1508 if (rc) {
@@ -2103,15 +2147,7 @@ static int cifs_write_end(struct file *file, struct address_space *mapping,
2103 } else { 2147 } else {
2104 rc = copied; 2148 rc = copied;
2105 pos += copied; 2149 pos += copied;
2106 /* 2150 set_page_dirty(page);
2107 * When we use strict cache mode and cifs_strict_writev was run
2108 * with level II oplock (indicated by leave_pages_clean field of
2109 * CIFS_I(inode)), we can leave pages clean - cifs_strict_writev
2110 * sent the data to the server itself.
2111 */
2112 if (!CIFS_I(inode)->leave_pages_clean ||
2113 !(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_STRICT_IO))
2114 set_page_dirty(page);
2115 } 2151 }
2116 2152
2117 if (rc > 0) { 2153 if (rc > 0) {
@@ -2462,8 +2498,8 @@ ssize_t cifs_user_writev(struct kiocb *iocb, const struct iovec *iov,
2462} 2498}
2463 2499
2464static ssize_t 2500static ssize_t
2465cifs_pagecache_writev(struct kiocb *iocb, const struct iovec *iov, 2501cifs_writev(struct kiocb *iocb, const struct iovec *iov,
2466 unsigned long nr_segs, loff_t pos, bool cache_ex) 2502 unsigned long nr_segs, loff_t pos)
2467{ 2503{
2468 struct file *file = iocb->ki_filp; 2504 struct file *file = iocb->ki_filp;
2469 struct cifsFileInfo *cfile = (struct cifsFileInfo *)file->private_data; 2505 struct cifsFileInfo *cfile = (struct cifsFileInfo *)file->private_data;
@@ -2485,12 +2521,8 @@ cifs_pagecache_writev(struct kiocb *iocb, const struct iovec *iov,
2485 server->vals->exclusive_lock_type, NULL, 2521 server->vals->exclusive_lock_type, NULL,
2486 CIFS_WRITE_OP)) { 2522 CIFS_WRITE_OP)) {
2487 mutex_lock(&inode->i_mutex); 2523 mutex_lock(&inode->i_mutex);
2488 if (!cache_ex)
2489 cinode->leave_pages_clean = true;
2490 rc = __generic_file_aio_write(iocb, iov, nr_segs, 2524 rc = __generic_file_aio_write(iocb, iov, nr_segs,
2491 &iocb->ki_pos); 2525 &iocb->ki_pos);
2492 if (!cache_ex)
2493 cinode->leave_pages_clean = false;
2494 mutex_unlock(&inode->i_mutex); 2526 mutex_unlock(&inode->i_mutex);
2495 } 2527 }
2496 2528
@@ -2517,60 +2549,32 @@ cifs_strict_writev(struct kiocb *iocb, const struct iovec *iov,
2517 struct cifsFileInfo *cfile = (struct cifsFileInfo *) 2549 struct cifsFileInfo *cfile = (struct cifsFileInfo *)
2518 iocb->ki_filp->private_data; 2550 iocb->ki_filp->private_data;
2519 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); 2551 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
2520 ssize_t written, written2; 2552 ssize_t written;
2521 /*
2522 * We need to store clientCanCacheAll here to prevent race
2523 * conditions - this value can be changed during an execution
2524 * of generic_file_aio_write. For CIFS it can be changed from
2525 * true to false only, but for SMB2 it can be changed both from
2526 * true to false and vice versa. So, we can end up with a data
2527 * stored in the cache, not marked dirty and not sent to the
2528 * server if this value changes its state from false to true
2529 * after cifs_write_end.
2530 */
2531 bool cache_ex = cinode->clientCanCacheAll;
2532 bool cache_read = cinode->clientCanCacheRead;
2533 int rc;
2534 loff_t saved_pos;
2535 2553
2536 if (cache_ex) { 2554 if (cinode->clientCanCacheAll) {
2537 if (cap_unix(tcon->ses) && 2555 if (cap_unix(tcon->ses) &&
2538 ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL) == 0) && 2556 (CIFS_UNIX_FCNTL_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability))
2539 (CIFS_UNIX_FCNTL_CAP & le64_to_cpu( 2557 && ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL) == 0))
2540 tcon->fsUnixInfo.Capability)))
2541 return generic_file_aio_write(iocb, iov, nr_segs, pos); 2558 return generic_file_aio_write(iocb, iov, nr_segs, pos);
2542 return cifs_pagecache_writev(iocb, iov, nr_segs, pos, cache_ex); 2559 return cifs_writev(iocb, iov, nr_segs, pos);
2543 } 2560 }
2544
2545 /* 2561 /*
2546 * For files without exclusive oplock in strict cache mode we need to 2562 * For non-oplocked files in strict cache mode we need to write the data
2547 * write the data to the server exactly from the pos to pos+len-1 rather 2563 * to the server exactly from the pos to pos+len-1 rather than flush all
2548 * than flush all affected pages because it may cause a error with 2564 * affected pages because it may cause a error with mandatory locks on
2549 * mandatory locks on these pages but not on the region from pos to 2565 * these pages but not on the region from pos to ppos+len-1.
2550 * ppos+len-1.
2551 */ 2566 */
2552 written = cifs_user_writev(iocb, iov, nr_segs, pos); 2567 written = cifs_user_writev(iocb, iov, nr_segs, pos);
2553 if (!cache_read || written <= 0) 2568 if (written > 0 && cinode->clientCanCacheRead) {
2554 return written; 2569 /*
2555 2570 * Windows 7 server can delay breaking level2 oplock if a write
2556 saved_pos = iocb->ki_pos; 2571 * request comes - break it on the client to prevent reading
2557 iocb->ki_pos = pos; 2572 * an old data.
2558 /* we have a read oplock - need to store a data in the page cache */ 2573 */
2559 if (cap_unix(tcon->ses) && 2574 cifs_invalidate_mapping(inode);
2560 ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL) == 0) && 2575 cFYI(1, "Set no oplock for inode=%p after a write operation",
2561 (CIFS_UNIX_FCNTL_CAP & le64_to_cpu( 2576 inode);
2562 tcon->fsUnixInfo.Capability))) 2577 cinode->clientCanCacheRead = false;
2563 written2 = generic_file_aio_write(iocb, iov, nr_segs, pos);
2564 else
2565 written2 = cifs_pagecache_writev(iocb, iov, nr_segs, pos,
2566 cache_ex);
2567 /* errors occured during writing - invalidate the page cache */
2568 if (written2 < 0) {
2569 rc = cifs_invalidate_mapping(inode);
2570 if (rc)
2571 written = (ssize_t)rc;
2572 else
2573 iocb->ki_pos = saved_pos;
2574 } 2578 }
2575 return written; 2579 return written;
2576} 2580}
@@ -3577,6 +3581,13 @@ void cifs_oplock_break(struct work_struct *work)
3577 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); 3581 struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
3578 int rc = 0; 3582 int rc = 0;
3579 3583
3584 if (!cinode->clientCanCacheAll && cinode->clientCanCacheRead &&
3585 cifs_has_mand_locks(cinode)) {
3586 cFYI(1, "Reset oplock to None for inode=%p due to mand locks",
3587 inode);
3588 cinode->clientCanCacheRead = false;
3589 }
3590
3580 if (inode && S_ISREG(inode->i_mode)) { 3591 if (inode && S_ISREG(inode->i_mode)) {
3581 if (cinode->clientCanCacheRead) 3592 if (cinode->clientCanCacheRead)
3582 break_lease(inode, O_RDONLY); 3593 break_lease(inode, O_RDONLY);
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c
index a5d234c8d5d9..47bc5a87f94e 100644
--- a/fs/cifs/smb1ops.c
+++ b/fs/cifs/smb1ops.c
@@ -53,6 +53,13 @@ send_nt_cancel(struct TCP_Server_Info *server, void *buf,
53 mutex_unlock(&server->srv_mutex); 53 mutex_unlock(&server->srv_mutex);
54 return rc; 54 return rc;
55 } 55 }
56
57 /*
58 * The response to this call was already factored into the sequence
59 * number when the call went out, so we must adjust it back downward
60 * after signing here.
61 */
62 --server->sequence_number;
56 rc = smb_send(server, in_buf, be32_to_cpu(in_buf->smb_buf_length)); 63 rc = smb_send(server, in_buf, be32_to_cpu(in_buf->smb_buf_length));
57 mutex_unlock(&server->srv_mutex); 64 mutex_unlock(&server->srv_mutex);
58 65
@@ -952,4 +959,5 @@ struct smb_version_values smb1_values = {
952 .cap_unix = CAP_UNIX, 959 .cap_unix = CAP_UNIX,
953 .cap_nt_find = CAP_NT_SMBS | CAP_NT_FIND, 960 .cap_nt_find = CAP_NT_SMBS | CAP_NT_FIND,
954 .cap_large_files = CAP_LARGE_FILES, 961 .cap_large_files = CAP_LARGE_FILES,
962 .oplock_read = OPLOCK_READ,
955}; 963};
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index d79de7bc4435..c9c7aa7ed966 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -708,6 +708,7 @@ struct smb_version_values smb20_values = {
708 .cap_unix = 0, 708 .cap_unix = 0,
709 .cap_nt_find = SMB2_NT_FIND, 709 .cap_nt_find = SMB2_NT_FIND,
710 .cap_large_files = SMB2_LARGE_FILES, 710 .cap_large_files = SMB2_LARGE_FILES,
711 .oplock_read = SMB2_OPLOCK_LEVEL_II,
711}; 712};
712 713
713struct smb_version_values smb21_values = { 714struct smb_version_values smb21_values = {
@@ -725,6 +726,7 @@ struct smb_version_values smb21_values = {
725 .cap_unix = 0, 726 .cap_unix = 0,
726 .cap_nt_find = SMB2_NT_FIND, 727 .cap_nt_find = SMB2_NT_FIND,
727 .cap_large_files = SMB2_LARGE_FILES, 728 .cap_large_files = SMB2_LARGE_FILES,
729 .oplock_read = SMB2_OPLOCK_LEVEL_II,
728}; 730};
729 731
730struct smb_version_values smb30_values = { 732struct smb_version_values smb30_values = {
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 76d974c952fe..1a528680ec5a 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -144,9 +144,6 @@ smb_send_kvec(struct TCP_Server_Info *server, struct kvec *iov, size_t n_vec,
144 144
145 *sent = 0; 145 *sent = 0;
146 146
147 if (ssocket == NULL)
148 return -ENOTSOCK; /* BB eventually add reconnect code here */
149
150 smb_msg.msg_name = (struct sockaddr *) &server->dstaddr; 147 smb_msg.msg_name = (struct sockaddr *) &server->dstaddr;
151 smb_msg.msg_namelen = sizeof(struct sockaddr); 148 smb_msg.msg_namelen = sizeof(struct sockaddr);
152 smb_msg.msg_control = NULL; 149 smb_msg.msg_control = NULL;
@@ -291,6 +288,9 @@ smb_send_rqst(struct TCP_Server_Info *server, struct smb_rqst *rqst)
291 struct socket *ssocket = server->ssocket; 288 struct socket *ssocket = server->ssocket;
292 int val = 1; 289 int val = 1;
293 290
291 if (ssocket == NULL)
292 return -ENOTSOCK;
293
294 cFYI(1, "Sending smb: smb_len=%u", smb_buf_length); 294 cFYI(1, "Sending smb: smb_len=%u", smb_buf_length);
295 dump_smb(iov[0].iov_base, iov[0].iov_len); 295 dump_smb(iov[0].iov_base, iov[0].iov_len);
296 296
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 153bb1e42e63..a5f12b7e228d 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -176,7 +176,7 @@ static int debugfs_parse_options(char *data, struct debugfs_mount_opts *opts)
176 opts->uid = uid; 176 opts->uid = uid;
177 break; 177 break;
178 case Opt_gid: 178 case Opt_gid:
179 if (match_octal(&args[0], &option)) 179 if (match_int(&args[0], &option))
180 return -EINVAL; 180 return -EINVAL;
181 gid = make_kgid(current_user_ns(), option); 181 gid = make_kgid(current_user_ns(), option);
182 if (!gid_valid(gid)) 182 if (!gid_valid(gid))
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index ea9931281557..a7b0c2dfb3db 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -1935,7 +1935,7 @@ static const unsigned char filename_rev_map[256] = {
1935 * @src: Source location for the filename to encode 1935 * @src: Source location for the filename to encode
1936 * @src_size: Size of the source in bytes 1936 * @src_size: Size of the source in bytes
1937 */ 1937 */
1938void ecryptfs_encode_for_filename(unsigned char *dst, size_t *dst_size, 1938static void ecryptfs_encode_for_filename(unsigned char *dst, size_t *dst_size,
1939 unsigned char *src, size_t src_size) 1939 unsigned char *src, size_t src_size)
1940{ 1940{
1941 size_t num_blocks; 1941 size_t num_blocks;
diff --git a/fs/ecryptfs/kthread.c b/fs/ecryptfs/kthread.c
index 809e67d05ca3..f1ea610362c6 100644
--- a/fs/ecryptfs/kthread.c
+++ b/fs/ecryptfs/kthread.c
@@ -102,12 +102,12 @@ int __init ecryptfs_init_kthread(void)
102 102
103void ecryptfs_destroy_kthread(void) 103void ecryptfs_destroy_kthread(void)
104{ 104{
105 struct ecryptfs_open_req *req; 105 struct ecryptfs_open_req *req, *tmp;
106 106
107 mutex_lock(&ecryptfs_kthread_ctl.mux); 107 mutex_lock(&ecryptfs_kthread_ctl.mux);
108 ecryptfs_kthread_ctl.flags |= ECRYPTFS_KTHREAD_ZOMBIE; 108 ecryptfs_kthread_ctl.flags |= ECRYPTFS_KTHREAD_ZOMBIE;
109 list_for_each_entry(req, &ecryptfs_kthread_ctl.req_list, 109 list_for_each_entry_safe(req, tmp, &ecryptfs_kthread_ctl.req_list,
110 kthread_ctl_list) { 110 kthread_ctl_list) {
111 list_del(&req->kthread_ctl_list); 111 list_del(&req->kthread_ctl_list);
112 *req->lower_file = ERR_PTR(-EIO); 112 *req->lower_file = ERR_PTR(-EIO);
113 complete(&req->done); 113 complete(&req->done);
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c
index bd1d57f98f74..564a1fa34b99 100644
--- a/fs/ecryptfs/mmap.c
+++ b/fs/ecryptfs/mmap.c
@@ -338,7 +338,8 @@ static int ecryptfs_write_begin(struct file *file,
338 if (prev_page_end_size 338 if (prev_page_end_size
339 >= i_size_read(page->mapping->host)) { 339 >= i_size_read(page->mapping->host)) {
340 zero_user(page, 0, PAGE_CACHE_SIZE); 340 zero_user(page, 0, PAGE_CACHE_SIZE);
341 } else { 341 SetPageUptodate(page);
342 } else if (len < PAGE_CACHE_SIZE) {
342 rc = ecryptfs_decrypt_page(page); 343 rc = ecryptfs_decrypt_page(page);
343 if (rc) { 344 if (rc) {
344 printk(KERN_ERR "%s: Error decrypting " 345 printk(KERN_ERR "%s: Error decrypting "
@@ -348,8 +349,8 @@ static int ecryptfs_write_begin(struct file *file,
348 ClearPageUptodate(page); 349 ClearPageUptodate(page);
349 goto out; 350 goto out;
350 } 351 }
352 SetPageUptodate(page);
351 } 353 }
352 SetPageUptodate(page);
353 } 354 }
354 } 355 }
355 /* If creating a page or more of holes, zero them out via truncate. 356 /* If creating a page or more of holes, zero them out via truncate.
@@ -499,6 +500,13 @@ static int ecryptfs_write_end(struct file *file,
499 } 500 }
500 goto out; 501 goto out;
501 } 502 }
503 if (!PageUptodate(page)) {
504 if (copied < PAGE_CACHE_SIZE) {
505 rc = 0;
506 goto out;
507 }
508 SetPageUptodate(page);
509 }
502 /* Fills in zeros if 'to' goes beyond inode size */ 510 /* Fills in zeros if 'to' goes beyond inode size */
503 rc = fill_zeros_to_end_of_page(page, to); 511 rc = fill_zeros_to_end_of_page(page, to);
504 if (rc) { 512 if (rc) {
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index be56b21435f8..9fec1836057a 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1313,7 +1313,7 @@ static int ep_modify(struct eventpoll *ep, struct epitem *epi, struct epoll_even
1313 * otherwise we might miss an event that happens between the 1313 * otherwise we might miss an event that happens between the
1314 * f_op->poll() call and the new event set registering. 1314 * f_op->poll() call and the new event set registering.
1315 */ 1315 */
1316 epi->event.events = event->events; 1316 epi->event.events = event->events; /* need barrier below */
1317 pt._key = event->events; 1317 pt._key = event->events;
1318 epi->event.data = event->data; /* protected by mtx */ 1318 epi->event.data = event->data; /* protected by mtx */
1319 if (epi->event.events & EPOLLWAKEUP) { 1319 if (epi->event.events & EPOLLWAKEUP) {
@@ -1324,6 +1324,26 @@ static int ep_modify(struct eventpoll *ep, struct epitem *epi, struct epoll_even
1324 } 1324 }
1325 1325
1326 /* 1326 /*
1327 * The following barrier has two effects:
1328 *
1329 * 1) Flush epi changes above to other CPUs. This ensures
1330 * we do not miss events from ep_poll_callback if an
1331 * event occurs immediately after we call f_op->poll().
1332 * We need this because we did not take ep->lock while
1333 * changing epi above (but ep_poll_callback does take
1334 * ep->lock).
1335 *
1336 * 2) We also need to ensure we do not miss _past_ events
1337 * when calling f_op->poll(). This barrier also
1338 * pairs with the barrier in wq_has_sleeper (see
1339 * comments for wq_has_sleeper).
1340 *
1341 * This barrier will now guarantee ep_poll_callback or f_op->poll
1342 * (or both) will notice the readiness of an item.
1343 */
1344 smp_mb();
1345
1346 /*
1327 * Get current event bits. We can safely use the file* here because 1347 * Get current event bits. We can safely use the file* here because
1328 * its usage count has been increased by the caller of this function. 1348 * its usage count has been increased by the caller of this function.
1329 */ 1349 */
diff --git a/fs/exec.c b/fs/exec.c
index 18c45cac368f..20df02c1cc70 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -434,8 +434,9 @@ static int count(struct user_arg_ptr argv, int max)
434 if (IS_ERR(p)) 434 if (IS_ERR(p))
435 return -EFAULT; 435 return -EFAULT;
436 436
437 if (i++ >= max) 437 if (i >= max)
438 return -E2BIG; 438 return -E2BIG;
439 ++i;
439 440
440 if (fatal_signal_pending(current)) 441 if (fatal_signal_pending(current))
441 return -ERESTARTNOHAND; 442 return -ERESTARTNOHAND;
diff --git a/fs/ext4/Kconfig b/fs/ext4/Kconfig
index 0a475c881852..987358740cb9 100644
--- a/fs/ext4/Kconfig
+++ b/fs/ext4/Kconfig
@@ -41,6 +41,7 @@ config EXT4_USE_FOR_EXT23
41 41
42config EXT4_FS_POSIX_ACL 42config EXT4_FS_POSIX_ACL
43 bool "Ext4 POSIX Access Control Lists" 43 bool "Ext4 POSIX Access Control Lists"
44 depends on EXT4_FS
44 select FS_POSIX_ACL 45 select FS_POSIX_ACL
45 help 46 help
46 POSIX Access Control Lists (ACLs) support permissions for users and 47 POSIX Access Control Lists (ACLs) support permissions for users and
@@ -53,6 +54,7 @@ config EXT4_FS_POSIX_ACL
53 54
54config EXT4_FS_SECURITY 55config EXT4_FS_SECURITY
55 bool "Ext4 Security Labels" 56 bool "Ext4 Security Labels"
57 depends on EXT4_FS
56 help 58 help
57 Security labels support alternative access control models 59 Security labels support alternative access control models
58 implemented by security modules like SELinux. This option 60 implemented by security modules like SELinux. This option
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 26af22832a84..5ae1674ec12f 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -2226,13 +2226,14 @@ errout:
2226 * removes index from the index block. 2226 * removes index from the index block.
2227 */ 2227 */
2228static int ext4_ext_rm_idx(handle_t *handle, struct inode *inode, 2228static int ext4_ext_rm_idx(handle_t *handle, struct inode *inode,
2229 struct ext4_ext_path *path) 2229 struct ext4_ext_path *path, int depth)
2230{ 2230{
2231 int err; 2231 int err;
2232 ext4_fsblk_t leaf; 2232 ext4_fsblk_t leaf;
2233 2233
2234 /* free index block */ 2234 /* free index block */
2235 path--; 2235 depth--;
2236 path = path + depth;
2236 leaf = ext4_idx_pblock(path->p_idx); 2237 leaf = ext4_idx_pblock(path->p_idx);
2237 if (unlikely(path->p_hdr->eh_entries == 0)) { 2238 if (unlikely(path->p_hdr->eh_entries == 0)) {
2238 EXT4_ERROR_INODE(inode, "path->p_hdr->eh_entries == 0"); 2239 EXT4_ERROR_INODE(inode, "path->p_hdr->eh_entries == 0");
@@ -2257,6 +2258,19 @@ static int ext4_ext_rm_idx(handle_t *handle, struct inode *inode,
2257 2258
2258 ext4_free_blocks(handle, inode, NULL, leaf, 1, 2259 ext4_free_blocks(handle, inode, NULL, leaf, 1,
2259 EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_FORGET); 2260 EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_FORGET);
2261
2262 while (--depth >= 0) {
2263 if (path->p_idx != EXT_FIRST_INDEX(path->p_hdr))
2264 break;
2265 path--;
2266 err = ext4_ext_get_access(handle, inode, path);
2267 if (err)
2268 break;
2269 path->p_idx->ei_block = (path+1)->p_idx->ei_block;
2270 err = ext4_ext_dirty(handle, inode, path);
2271 if (err)
2272 break;
2273 }
2260 return err; 2274 return err;
2261} 2275}
2262 2276
@@ -2599,7 +2613,7 @@ ext4_ext_rm_leaf(handle_t *handle, struct inode *inode,
2599 /* if this leaf is free, then we should 2613 /* if this leaf is free, then we should
2600 * remove it from index block above */ 2614 * remove it from index block above */
2601 if (err == 0 && eh->eh_entries == 0 && path[depth].p_bh != NULL) 2615 if (err == 0 && eh->eh_entries == 0 && path[depth].p_bh != NULL)
2602 err = ext4_ext_rm_idx(handle, inode, path + depth); 2616 err = ext4_ext_rm_idx(handle, inode, path, depth);
2603 2617
2604out: 2618out:
2605 return err; 2619 return err;
@@ -2802,7 +2816,7 @@ again:
2802 /* index is empty, remove it; 2816 /* index is empty, remove it;
2803 * handle must be already prepared by the 2817 * handle must be already prepared by the
2804 * truncatei_leaf() */ 2818 * truncatei_leaf() */
2805 err = ext4_ext_rm_idx(handle, inode, path + i); 2819 err = ext4_ext_rm_idx(handle, inode, path, i);
2806 } 2820 }
2807 /* root level has p_bh == NULL, brelse() eats this */ 2821 /* root level has p_bh == NULL, brelse() eats this */
2808 brelse(path[i].p_bh); 2822 brelse(path[i].p_bh);
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index d07c27ca594a..405565a62277 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -108,14 +108,6 @@ ext4_file_dio_write(struct kiocb *iocb, const struct iovec *iov,
108 108
109 /* Unaligned direct AIO must be serialized; see comment above */ 109 /* Unaligned direct AIO must be serialized; see comment above */
110 if (unaligned_aio) { 110 if (unaligned_aio) {
111 static unsigned long unaligned_warn_time;
112
113 /* Warn about this once per day */
114 if (printk_timed_ratelimit(&unaligned_warn_time, 60*60*24*HZ))
115 ext4_msg(inode->i_sb, KERN_WARNING,
116 "Unaligned AIO/DIO on inode %ld by %s; "
117 "performance will be poor.",
118 inode->i_ino, current->comm);
119 mutex_lock(ext4_aio_mutex(inode)); 111 mutex_lock(ext4_aio_mutex(inode));
120 ext4_unwritten_wait(inode); 112 ext4_unwritten_wait(inode);
121 } 113 }
diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
index dfbc1fe96674..3278e64e57b6 100644
--- a/fs/ext4/fsync.c
+++ b/fs/ext4/fsync.c
@@ -109,8 +109,6 @@ static int __sync_inode(struct inode *inode, int datasync)
109 * 109 *
110 * What we do is just kick off a commit and wait on it. This will snapshot the 110 * What we do is just kick off a commit and wait on it. This will snapshot the
111 * inode to disk. 111 * inode to disk.
112 *
113 * i_mutex lock is held when entering and exiting this function
114 */ 112 */
115 113
116int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync) 114int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index cb1c1ab2720b..cbfe13bf5b2a 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2880,8 +2880,6 @@ static void ext4_invalidatepage_free_endio(struct page *page, unsigned long offs
2880 2880
2881static void ext4_invalidatepage(struct page *page, unsigned long offset) 2881static void ext4_invalidatepage(struct page *page, unsigned long offset)
2882{ 2882{
2883 journal_t *journal = EXT4_JOURNAL(page->mapping->host);
2884
2885 trace_ext4_invalidatepage(page, offset); 2883 trace_ext4_invalidatepage(page, offset);
2886 2884
2887 /* 2885 /*
@@ -2889,16 +2887,34 @@ static void ext4_invalidatepage(struct page *page, unsigned long offset)
2889 */ 2887 */
2890 if (ext4_should_dioread_nolock(page->mapping->host)) 2888 if (ext4_should_dioread_nolock(page->mapping->host))
2891 ext4_invalidatepage_free_endio(page, offset); 2889 ext4_invalidatepage_free_endio(page, offset);
2890
2891 /* No journalling happens on data buffers when this function is used */
2892 WARN_ON(page_has_buffers(page) && buffer_jbd(page_buffers(page)));
2893
2894 block_invalidatepage(page, offset);
2895}
2896
2897static int __ext4_journalled_invalidatepage(struct page *page,
2898 unsigned long offset)
2899{
2900 journal_t *journal = EXT4_JOURNAL(page->mapping->host);
2901
2902 trace_ext4_journalled_invalidatepage(page, offset);
2903
2892 /* 2904 /*
2893 * If it's a full truncate we just forget about the pending dirtying 2905 * If it's a full truncate we just forget about the pending dirtying
2894 */ 2906 */
2895 if (offset == 0) 2907 if (offset == 0)
2896 ClearPageChecked(page); 2908 ClearPageChecked(page);
2897 2909
2898 if (journal) 2910 return jbd2_journal_invalidatepage(journal, page, offset);
2899 jbd2_journal_invalidatepage(journal, page, offset); 2911}
2900 else 2912
2901 block_invalidatepage(page, offset); 2913/* Wrapper for aops... */
2914static void ext4_journalled_invalidatepage(struct page *page,
2915 unsigned long offset)
2916{
2917 WARN_ON(__ext4_journalled_invalidatepage(page, offset) < 0);
2902} 2918}
2903 2919
2904static int ext4_releasepage(struct page *page, gfp_t wait) 2920static int ext4_releasepage(struct page *page, gfp_t wait)
@@ -3264,7 +3280,7 @@ static const struct address_space_operations ext4_journalled_aops = {
3264 .write_end = ext4_journalled_write_end, 3280 .write_end = ext4_journalled_write_end,
3265 .set_page_dirty = ext4_journalled_set_page_dirty, 3281 .set_page_dirty = ext4_journalled_set_page_dirty,
3266 .bmap = ext4_bmap, 3282 .bmap = ext4_bmap,
3267 .invalidatepage = ext4_invalidatepage, 3283 .invalidatepage = ext4_journalled_invalidatepage,
3268 .releasepage = ext4_releasepage, 3284 .releasepage = ext4_releasepage,
3269 .direct_IO = ext4_direct_IO, 3285 .direct_IO = ext4_direct_IO,
3270 .is_partially_uptodate = block_is_partially_uptodate, 3286 .is_partially_uptodate = block_is_partially_uptodate,
@@ -4305,6 +4321,47 @@ int ext4_write_inode(struct inode *inode, struct writeback_control *wbc)
4305} 4321}
4306 4322
4307/* 4323/*
4324 * In data=journal mode ext4_journalled_invalidatepage() may fail to invalidate
4325 * buffers that are attached to a page stradding i_size and are undergoing
4326 * commit. In that case we have to wait for commit to finish and try again.
4327 */
4328static void ext4_wait_for_tail_page_commit(struct inode *inode)
4329{
4330 struct page *page;
4331 unsigned offset;
4332 journal_t *journal = EXT4_SB(inode->i_sb)->s_journal;
4333 tid_t commit_tid = 0;
4334 int ret;
4335
4336 offset = inode->i_size & (PAGE_CACHE_SIZE - 1);
4337 /*
4338 * All buffers in the last page remain valid? Then there's nothing to
4339 * do. We do the check mainly to optimize the common PAGE_CACHE_SIZE ==
4340 * blocksize case
4341 */
4342 if (offset > PAGE_CACHE_SIZE - (1 << inode->i_blkbits))
4343 return;
4344 while (1) {
4345 page = find_lock_page(inode->i_mapping,
4346 inode->i_size >> PAGE_CACHE_SHIFT);
4347 if (!page)
4348 return;
4349 ret = __ext4_journalled_invalidatepage(page, offset);
4350 unlock_page(page);
4351 page_cache_release(page);
4352 if (ret != -EBUSY)
4353 return;
4354 commit_tid = 0;
4355 read_lock(&journal->j_state_lock);
4356 if (journal->j_committing_transaction)
4357 commit_tid = journal->j_committing_transaction->t_tid;
4358 read_unlock(&journal->j_state_lock);
4359 if (commit_tid)
4360 jbd2_log_wait_commit(journal, commit_tid);
4361 }
4362}
4363
4364/*
4308 * ext4_setattr() 4365 * ext4_setattr()
4309 * 4366 *
4310 * Called from notify_change. 4367 * Called from notify_change.
@@ -4417,16 +4474,28 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
4417 } 4474 }
4418 4475
4419 if (attr->ia_valid & ATTR_SIZE) { 4476 if (attr->ia_valid & ATTR_SIZE) {
4420 if (attr->ia_size != i_size_read(inode)) { 4477 if (attr->ia_size != inode->i_size) {
4421 truncate_setsize(inode, attr->ia_size); 4478 loff_t oldsize = inode->i_size;
4422 /* Inode size will be reduced, wait for dio in flight. 4479
4423 * Temporarily disable dioread_nolock to prevent 4480 i_size_write(inode, attr->ia_size);
4424 * livelock. */ 4481 /*
4482 * Blocks are going to be removed from the inode. Wait
4483 * for dio in flight. Temporarily disable
4484 * dioread_nolock to prevent livelock.
4485 */
4425 if (orphan) { 4486 if (orphan) {
4426 ext4_inode_block_unlocked_dio(inode); 4487 if (!ext4_should_journal_data(inode)) {
4427 inode_dio_wait(inode); 4488 ext4_inode_block_unlocked_dio(inode);
4428 ext4_inode_resume_unlocked_dio(inode); 4489 inode_dio_wait(inode);
4490 ext4_inode_resume_unlocked_dio(inode);
4491 } else
4492 ext4_wait_for_tail_page_commit(inode);
4429 } 4493 }
4494 /*
4495 * Truncate pagecache after we've waited for commit
4496 * in data=journal mode to make pages freeable.
4497 */
4498 truncate_pagecache(inode, oldsize, inode->i_size);
4430 } 4499 }
4431 ext4_truncate(inode); 4500 ext4_truncate(inode);
4432 } 4501 }
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index cac448282331..f9ed946a448e 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -722,7 +722,7 @@ dx_probe(const struct qstr *d_name, struct inode *dir,
722 ext4_warning(dir->i_sb, "Node failed checksum"); 722 ext4_warning(dir->i_sb, "Node failed checksum");
723 brelse(bh); 723 brelse(bh);
724 *err = ERR_BAD_DX_DIR; 724 *err = ERR_BAD_DX_DIR;
725 goto fail; 725 goto fail2;
726 } 726 }
727 set_buffer_verified(bh); 727 set_buffer_verified(bh);
728 728
@@ -2368,7 +2368,6 @@ static int ext4_init_new_dir(handle_t *handle, struct inode *dir,
2368 } 2368 }
2369 2369
2370 inode->i_size = EXT4_I(inode)->i_disksize = blocksize; 2370 inode->i_size = EXT4_I(inode)->i_disksize = blocksize;
2371 dir_block = ext4_bread(handle, inode, 0, 1, &err);
2372 if (!(dir_block = ext4_bread(handle, inode, 0, 1, &err))) { 2371 if (!(dir_block = ext4_bread(handle, inode, 0, 1, &err))) {
2373 if (!err) { 2372 if (!err) {
2374 err = -EIO; 2373 err = -EIO;
@@ -2648,7 +2647,8 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode)
2648 struct ext4_iloc iloc; 2647 struct ext4_iloc iloc;
2649 int err = 0; 2648 int err = 0;
2650 2649
2651 if (!EXT4_SB(inode->i_sb)->s_journal) 2650 if ((!EXT4_SB(inode->i_sb)->s_journal) &&
2651 !(EXT4_SB(inode->i_sb)->s_mount_state & EXT4_ORPHAN_FS))
2652 return 0; 2652 return 0;
2653 2653
2654 mutex_lock(&EXT4_SB(inode->i_sb)->s_orphan_lock); 2654 mutex_lock(&EXT4_SB(inode->i_sb)->s_orphan_lock);
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 3cdb0a2fc648..3d4fb81bacd5 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1645,9 +1645,7 @@ static int parse_options(char *options, struct super_block *sb,
1645 unsigned int *journal_ioprio, 1645 unsigned int *journal_ioprio,
1646 int is_remount) 1646 int is_remount)
1647{ 1647{
1648#ifdef CONFIG_QUOTA
1649 struct ext4_sb_info *sbi = EXT4_SB(sb); 1648 struct ext4_sb_info *sbi = EXT4_SB(sb);
1650#endif
1651 char *p; 1649 char *p;
1652 substring_t args[MAX_OPT_ARGS]; 1650 substring_t args[MAX_OPT_ARGS];
1653 int token; 1651 int token;
@@ -1696,6 +1694,16 @@ static int parse_options(char *options, struct super_block *sb,
1696 } 1694 }
1697 } 1695 }
1698#endif 1696#endif
1697 if (test_opt(sb, DIOREAD_NOLOCK)) {
1698 int blocksize =
1699 BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size);
1700
1701 if (blocksize < PAGE_CACHE_SIZE) {
1702 ext4_msg(sb, KERN_ERR, "can't mount with "
1703 "dioread_nolock if block size != PAGE_SIZE");
1704 return 0;
1705 }
1706 }
1699 return 1; 1707 return 1;
1700} 1708}
1701 1709
@@ -2212,7 +2220,9 @@ static void ext4_orphan_cleanup(struct super_block *sb,
2212 __func__, inode->i_ino, inode->i_size); 2220 __func__, inode->i_ino, inode->i_size);
2213 jbd_debug(2, "truncating inode %lu to %lld bytes\n", 2221 jbd_debug(2, "truncating inode %lu to %lld bytes\n",
2214 inode->i_ino, inode->i_size); 2222 inode->i_ino, inode->i_size);
2223 mutex_lock(&inode->i_mutex);
2215 ext4_truncate(inode); 2224 ext4_truncate(inode);
2225 mutex_unlock(&inode->i_mutex);
2216 nr_truncates++; 2226 nr_truncates++;
2217 } else { 2227 } else {
2218 ext4_msg(sb, KERN_DEBUG, 2228 ext4_msg(sb, KERN_DEBUG,
@@ -3223,6 +3233,10 @@ int ext4_calculate_overhead(struct super_block *sb)
3223 memset(buf, 0, PAGE_SIZE); 3233 memset(buf, 0, PAGE_SIZE);
3224 cond_resched(); 3234 cond_resched();
3225 } 3235 }
3236 /* Add the journal blocks as well */
3237 if (sbi->s_journal)
3238 overhead += EXT4_B2C(sbi, sbi->s_journal->j_maxlen);
3239
3226 sbi->s_overhead = overhead; 3240 sbi->s_overhead = overhead;
3227 smp_wmb(); 3241 smp_wmb();
3228 free_page((unsigned long) buf); 3242 free_page((unsigned long) buf);
@@ -3436,15 +3450,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
3436 clear_opt(sb, DELALLOC); 3450 clear_opt(sb, DELALLOC);
3437 } 3451 }
3438 3452
3439 blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size);
3440 if (test_opt(sb, DIOREAD_NOLOCK)) {
3441 if (blocksize < PAGE_SIZE) {
3442 ext4_msg(sb, KERN_ERR, "can't mount with "
3443 "dioread_nolock if block size != PAGE_SIZE");
3444 goto failed_mount;
3445 }
3446 }
3447
3448 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | 3453 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
3449 (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0); 3454 (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0);
3450 3455
@@ -3486,6 +3491,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
3486 if (!ext4_feature_set_ok(sb, (sb->s_flags & MS_RDONLY))) 3491 if (!ext4_feature_set_ok(sb, (sb->s_flags & MS_RDONLY)))
3487 goto failed_mount; 3492 goto failed_mount;
3488 3493
3494 blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size);
3489 if (blocksize < EXT4_MIN_BLOCK_SIZE || 3495 if (blocksize < EXT4_MIN_BLOCK_SIZE ||
3490 blocksize > EXT4_MAX_BLOCK_SIZE) { 3496 blocksize > EXT4_MAX_BLOCK_SIZE) {
3491 ext4_msg(sb, KERN_ERR, 3497 ext4_msg(sb, KERN_ERR,
@@ -4725,7 +4731,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
4725 } 4731 }
4726 4732
4727 ext4_setup_system_zone(sb); 4733 ext4_setup_system_zone(sb);
4728 if (sbi->s_journal == NULL) 4734 if (sbi->s_journal == NULL && !(old_sb_flags & MS_RDONLY))
4729 ext4_commit_super(sb, 1); 4735 ext4_commit_super(sb, 1);
4730 4736
4731#ifdef CONFIG_QUOTA 4737#ifdef CONFIG_QUOTA
diff --git a/fs/f2fs/acl.c b/fs/f2fs/acl.c
index fed74d193ffb..137af4255da6 100644
--- a/fs/f2fs/acl.c
+++ b/fs/f2fs/acl.c
@@ -82,7 +82,6 @@ static struct posix_acl *f2fs_acl_from_disk(const char *value, size_t size)
82 case ACL_GROUP_OBJ: 82 case ACL_GROUP_OBJ:
83 case ACL_MASK: 83 case ACL_MASK:
84 case ACL_OTHER: 84 case ACL_OTHER:
85 acl->a_entries[i].e_id = ACL_UNDEFINED_ID;
86 entry = (struct f2fs_acl_entry *)((char *)entry + 85 entry = (struct f2fs_acl_entry *)((char *)entry +
87 sizeof(struct f2fs_acl_entry_short)); 86 sizeof(struct f2fs_acl_entry_short));
88 break; 87 break;
@@ -192,15 +191,14 @@ struct posix_acl *f2fs_get_acl(struct inode *inode, int type)
192 retval = f2fs_getxattr(inode, name_index, "", value, retval); 191 retval = f2fs_getxattr(inode, name_index, "", value, retval);
193 } 192 }
194 193
195 if (retval < 0) { 194 if (retval > 0)
196 if (retval == -ENODATA)
197 acl = NULL;
198 else
199 acl = ERR_PTR(retval);
200 } else {
201 acl = f2fs_acl_from_disk(value, retval); 195 acl = f2fs_acl_from_disk(value, retval);
202 } 196 else if (retval == -ENODATA)
197 acl = NULL;
198 else
199 acl = ERR_PTR(retval);
203 kfree(value); 200 kfree(value);
201
204 if (!IS_ERR(acl)) 202 if (!IS_ERR(acl))
205 set_cached_acl(inode, type, acl); 203 set_cached_acl(inode, type, acl);
206 204
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 6ef36c37e2be..ff3c8439af87 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -214,7 +214,6 @@ retry:
214 goto retry; 214 goto retry;
215 } 215 }
216 new->ino = ino; 216 new->ino = ino;
217 INIT_LIST_HEAD(&new->list);
218 217
219 /* add new_oentry into list which is sorted by inode number */ 218 /* add new_oentry into list which is sorted by inode number */
220 if (orphan) { 219 if (orphan) {
@@ -772,7 +771,7 @@ void init_orphan_info(struct f2fs_sb_info *sbi)
772 sbi->n_orphans = 0; 771 sbi->n_orphans = 0;
773} 772}
774 773
775int create_checkpoint_caches(void) 774int __init create_checkpoint_caches(void)
776{ 775{
777 orphan_entry_slab = f2fs_kmem_cache_create("f2fs_orphan_entry", 776 orphan_entry_slab = f2fs_kmem_cache_create("f2fs_orphan_entry",
778 sizeof(struct orphan_inode_entry), NULL); 777 sizeof(struct orphan_inode_entry), NULL);
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 655aeabc1dd4..7bd22a201125 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -16,6 +16,7 @@
16#include <linux/backing-dev.h> 16#include <linux/backing-dev.h>
17#include <linux/blkdev.h> 17#include <linux/blkdev.h>
18#include <linux/bio.h> 18#include <linux/bio.h>
19#include <linux/prefetch.h>
19 20
20#include "f2fs.h" 21#include "f2fs.h"
21#include "node.h" 22#include "node.h"
@@ -546,6 +547,15 @@ redirty_out:
546 547
547#define MAX_DESIRED_PAGES_WP 4096 548#define MAX_DESIRED_PAGES_WP 4096
548 549
550static int __f2fs_writepage(struct page *page, struct writeback_control *wbc,
551 void *data)
552{
553 struct address_space *mapping = data;
554 int ret = mapping->a_ops->writepage(page, wbc);
555 mapping_set_error(mapping, ret);
556 return ret;
557}
558
549static int f2fs_write_data_pages(struct address_space *mapping, 559static int f2fs_write_data_pages(struct address_space *mapping,
550 struct writeback_control *wbc) 560 struct writeback_control *wbc)
551{ 561{
@@ -562,7 +572,7 @@ static int f2fs_write_data_pages(struct address_space *mapping,
562 572
563 if (!S_ISDIR(inode->i_mode)) 573 if (!S_ISDIR(inode->i_mode))
564 mutex_lock(&sbi->writepages); 574 mutex_lock(&sbi->writepages);
565 ret = generic_writepages(mapping, wbc); 575 ret = write_cache_pages(mapping, wbc, __f2fs_writepage, mapping);
566 if (!S_ISDIR(inode->i_mode)) 576 if (!S_ISDIR(inode->i_mode))
567 mutex_unlock(&sbi->writepages); 577 mutex_unlock(&sbi->writepages);
568 f2fs_submit_bio(sbi, DATA, (wbc->sync_mode == WB_SYNC_ALL)); 578 f2fs_submit_bio(sbi, DATA, (wbc->sync_mode == WB_SYNC_ALL));
@@ -688,6 +698,11 @@ static int f2fs_set_data_page_dirty(struct page *page)
688 return 0; 698 return 0;
689} 699}
690 700
701static sector_t f2fs_bmap(struct address_space *mapping, sector_t block)
702{
703 return generic_block_bmap(mapping, block, get_data_block_ro);
704}
705
691const struct address_space_operations f2fs_dblock_aops = { 706const struct address_space_operations f2fs_dblock_aops = {
692 .readpage = f2fs_read_data_page, 707 .readpage = f2fs_read_data_page,
693 .readpages = f2fs_read_data_pages, 708 .readpages = f2fs_read_data_pages,
@@ -699,4 +714,5 @@ const struct address_space_operations f2fs_dblock_aops = {
699 .invalidatepage = f2fs_invalidate_data_page, 714 .invalidatepage = f2fs_invalidate_data_page,
700 .releasepage = f2fs_release_data_page, 715 .releasepage = f2fs_release_data_page,
701 .direct_IO = f2fs_direct_IO, 716 .direct_IO = f2fs_direct_IO,
717 .bmap = f2fs_bmap,
702}; 718};
diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
index 0e0380a588ad..c8c37307b326 100644
--- a/fs/f2fs/debug.c
+++ b/fs/f2fs/debug.c
@@ -26,6 +26,7 @@
26 26
27static LIST_HEAD(f2fs_stat_list); 27static LIST_HEAD(f2fs_stat_list);
28static struct dentry *debugfs_root; 28static struct dentry *debugfs_root;
29static DEFINE_MUTEX(f2fs_stat_mutex);
29 30
30static void update_general_status(struct f2fs_sb_info *sbi) 31static void update_general_status(struct f2fs_sb_info *sbi)
31{ 32{
@@ -180,18 +181,14 @@ static int stat_show(struct seq_file *s, void *v)
180 int i = 0; 181 int i = 0;
181 int j; 182 int j;
182 183
184 mutex_lock(&f2fs_stat_mutex);
183 list_for_each_entry_safe(si, next, &f2fs_stat_list, stat_list) { 185 list_for_each_entry_safe(si, next, &f2fs_stat_list, stat_list) {
184 186
185 mutex_lock(&si->stat_lock);
186 if (!si->sbi) {
187 mutex_unlock(&si->stat_lock);
188 continue;
189 }
190 update_general_status(si->sbi); 187 update_general_status(si->sbi);
191 188
192 seq_printf(s, "\n=====[ partition info. #%d ]=====\n", i++); 189 seq_printf(s, "\n=====[ partition info. #%d ]=====\n", i++);
193 seq_printf(s, "[SB: 1] [CP: 2] [NAT: %d] [SIT: %d] ", 190 seq_printf(s, "[SB: 1] [CP: 2] [SIT: %d] [NAT: %d] ",
194 si->nat_area_segs, si->sit_area_segs); 191 si->sit_area_segs, si->nat_area_segs);
195 seq_printf(s, "[SSA: %d] [MAIN: %d", 192 seq_printf(s, "[SSA: %d] [MAIN: %d",
196 si->ssa_area_segs, si->main_area_segs); 193 si->ssa_area_segs, si->main_area_segs);
197 seq_printf(s, "(OverProv:%d Resv:%d)]\n\n", 194 seq_printf(s, "(OverProv:%d Resv:%d)]\n\n",
@@ -286,8 +283,8 @@ static int stat_show(struct seq_file *s, void *v)
286 seq_printf(s, "\nMemory: %u KB = static: %u + cached: %u\n", 283 seq_printf(s, "\nMemory: %u KB = static: %u + cached: %u\n",
287 (si->base_mem + si->cache_mem) >> 10, 284 (si->base_mem + si->cache_mem) >> 10,
288 si->base_mem >> 10, si->cache_mem >> 10); 285 si->base_mem >> 10, si->cache_mem >> 10);
289 mutex_unlock(&si->stat_lock);
290 } 286 }
287 mutex_unlock(&f2fs_stat_mutex);
291 return 0; 288 return 0;
292} 289}
293 290
@@ -303,7 +300,7 @@ static const struct file_operations stat_fops = {
303 .release = single_release, 300 .release = single_release,
304}; 301};
305 302
306static int init_stats(struct f2fs_sb_info *sbi) 303int f2fs_build_stats(struct f2fs_sb_info *sbi)
307{ 304{
308 struct f2fs_super_block *raw_super = F2FS_RAW_SUPER(sbi); 305 struct f2fs_super_block *raw_super = F2FS_RAW_SUPER(sbi);
309 struct f2fs_stat_info *si; 306 struct f2fs_stat_info *si;
@@ -313,9 +310,6 @@ static int init_stats(struct f2fs_sb_info *sbi)
313 return -ENOMEM; 310 return -ENOMEM;
314 311
315 si = sbi->stat_info; 312 si = sbi->stat_info;
316 mutex_init(&si->stat_lock);
317 list_add_tail(&si->stat_list, &f2fs_stat_list);
318
319 si->all_area_segs = le32_to_cpu(raw_super->segment_count); 313 si->all_area_segs = le32_to_cpu(raw_super->segment_count);
320 si->sit_area_segs = le32_to_cpu(raw_super->segment_count_sit); 314 si->sit_area_segs = le32_to_cpu(raw_super->segment_count_sit);
321 si->nat_area_segs = le32_to_cpu(raw_super->segment_count_nat); 315 si->nat_area_segs = le32_to_cpu(raw_super->segment_count_nat);
@@ -325,21 +319,11 @@ static int init_stats(struct f2fs_sb_info *sbi)
325 si->main_area_zones = si->main_area_sections / 319 si->main_area_zones = si->main_area_sections /
326 le32_to_cpu(raw_super->secs_per_zone); 320 le32_to_cpu(raw_super->secs_per_zone);
327 si->sbi = sbi; 321 si->sbi = sbi;
328 return 0;
329}
330 322
331int f2fs_build_stats(struct f2fs_sb_info *sbi) 323 mutex_lock(&f2fs_stat_mutex);
332{ 324 list_add_tail(&si->stat_list, &f2fs_stat_list);
333 int retval; 325 mutex_unlock(&f2fs_stat_mutex);
334
335 retval = init_stats(sbi);
336 if (retval)
337 return retval;
338
339 if (!debugfs_root)
340 debugfs_root = debugfs_create_dir("f2fs", NULL);
341 326
342 debugfs_create_file("status", S_IRUGO, debugfs_root, NULL, &stat_fops);
343 return 0; 327 return 0;
344} 328}
345 329
@@ -347,14 +331,22 @@ void f2fs_destroy_stats(struct f2fs_sb_info *sbi)
347{ 331{
348 struct f2fs_stat_info *si = sbi->stat_info; 332 struct f2fs_stat_info *si = sbi->stat_info;
349 333
334 mutex_lock(&f2fs_stat_mutex);
350 list_del(&si->stat_list); 335 list_del(&si->stat_list);
351 mutex_lock(&si->stat_lock); 336 mutex_unlock(&f2fs_stat_mutex);
352 si->sbi = NULL; 337
353 mutex_unlock(&si->stat_lock);
354 kfree(sbi->stat_info); 338 kfree(sbi->stat_info);
355} 339}
356 340
357void destroy_root_stats(void) 341void __init f2fs_create_root_stats(void)
342{
343 debugfs_root = debugfs_create_dir("f2fs", NULL);
344 if (debugfs_root)
345 debugfs_create_file("status", S_IRUGO, debugfs_root,
346 NULL, &stat_fops);
347}
348
349void f2fs_destroy_root_stats(void)
358{ 350{
359 debugfs_remove_recursive(debugfs_root); 351 debugfs_remove_recursive(debugfs_root);
360 debugfs_root = NULL; 352 debugfs_root = NULL;
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
index b4e24f32b54e..989980e16d0b 100644
--- a/fs/f2fs/dir.c
+++ b/fs/f2fs/dir.c
@@ -11,6 +11,7 @@
11#include <linux/fs.h> 11#include <linux/fs.h>
12#include <linux/f2fs_fs.h> 12#include <linux/f2fs_fs.h>
13#include "f2fs.h" 13#include "f2fs.h"
14#include "node.h"
14#include "acl.h" 15#include "acl.h"
15 16
16static unsigned long dir_blocks(struct inode *inode) 17static unsigned long dir_blocks(struct inode *inode)
@@ -74,7 +75,7 @@ static unsigned long dir_block_index(unsigned int level, unsigned int idx)
74 return bidx; 75 return bidx;
75} 76}
76 77
77static bool early_match_name(const char *name, int namelen, 78static bool early_match_name(const char *name, size_t namelen,
78 f2fs_hash_t namehash, struct f2fs_dir_entry *de) 79 f2fs_hash_t namehash, struct f2fs_dir_entry *de)
79{ 80{
80 if (le16_to_cpu(de->name_len) != namelen) 81 if (le16_to_cpu(de->name_len) != namelen)
@@ -87,7 +88,7 @@ static bool early_match_name(const char *name, int namelen,
87} 88}
88 89
89static struct f2fs_dir_entry *find_in_block(struct page *dentry_page, 90static struct f2fs_dir_entry *find_in_block(struct page *dentry_page,
90 const char *name, int namelen, int *max_slots, 91 const char *name, size_t namelen, int *max_slots,
91 f2fs_hash_t namehash, struct page **res_page) 92 f2fs_hash_t namehash, struct page **res_page)
92{ 93{
93 struct f2fs_dir_entry *de; 94 struct f2fs_dir_entry *de;
@@ -126,7 +127,7 @@ found:
126} 127}
127 128
128static struct f2fs_dir_entry *find_in_level(struct inode *dir, 129static struct f2fs_dir_entry *find_in_level(struct inode *dir,
129 unsigned int level, const char *name, int namelen, 130 unsigned int level, const char *name, size_t namelen,
130 f2fs_hash_t namehash, struct page **res_page) 131 f2fs_hash_t namehash, struct page **res_page)
131{ 132{
132 int s = GET_DENTRY_SLOTS(namelen); 133 int s = GET_DENTRY_SLOTS(namelen);
@@ -181,7 +182,7 @@ struct f2fs_dir_entry *f2fs_find_entry(struct inode *dir,
181 struct qstr *child, struct page **res_page) 182 struct qstr *child, struct page **res_page)
182{ 183{
183 const char *name = child->name; 184 const char *name = child->name;
184 int namelen = child->len; 185 size_t namelen = child->len;
185 unsigned long npages = dir_blocks(dir); 186 unsigned long npages = dir_blocks(dir);
186 struct f2fs_dir_entry *de = NULL; 187 struct f2fs_dir_entry *de = NULL;
187 f2fs_hash_t name_hash; 188 f2fs_hash_t name_hash;
@@ -308,6 +309,7 @@ static int init_inode_metadata(struct inode *inode, struct dentry *dentry)
308 ipage = get_node_page(F2FS_SB(dir->i_sb), inode->i_ino); 309 ipage = get_node_page(F2FS_SB(dir->i_sb), inode->i_ino);
309 if (IS_ERR(ipage)) 310 if (IS_ERR(ipage))
310 return PTR_ERR(ipage); 311 return PTR_ERR(ipage);
312 set_cold_node(inode, ipage);
311 init_dent_inode(dentry, ipage); 313 init_dent_inode(dentry, ipage);
312 f2fs_put_page(ipage, 1); 314 f2fs_put_page(ipage, 1);
313 } 315 }
@@ -381,7 +383,7 @@ int f2fs_add_link(struct dentry *dentry, struct inode *inode)
381 struct inode *dir = dentry->d_parent->d_inode; 383 struct inode *dir = dentry->d_parent->d_inode;
382 struct f2fs_sb_info *sbi = F2FS_SB(dir->i_sb); 384 struct f2fs_sb_info *sbi = F2FS_SB(dir->i_sb);
383 const char *name = dentry->d_name.name; 385 const char *name = dentry->d_name.name;
384 int namelen = dentry->d_name.len; 386 size_t namelen = dentry->d_name.len;
385 struct page *dentry_page = NULL; 387 struct page *dentry_page = NULL;
386 struct f2fs_dentry_block *dentry_blk = NULL; 388 struct f2fs_dentry_block *dentry_blk = NULL;
387 int slots = GET_DENTRY_SLOTS(namelen); 389 int slots = GET_DENTRY_SLOTS(namelen);
@@ -501,7 +503,7 @@ void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page,
501 } 503 }
502 504
503 if (inode) { 505 if (inode) {
504 inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; 506 inode->i_ctime = CURRENT_TIME;
505 drop_nlink(inode); 507 drop_nlink(inode);
506 if (S_ISDIR(inode->i_mode)) { 508 if (S_ISDIR(inode->i_mode)) {
507 drop_nlink(inode); 509 drop_nlink(inode);
@@ -540,13 +542,13 @@ int f2fs_make_empty(struct inode *inode, struct inode *parent)
540 542
541 de = &dentry_blk->dentry[0]; 543 de = &dentry_blk->dentry[0];
542 de->name_len = cpu_to_le16(1); 544 de->name_len = cpu_to_le16(1);
543 de->hash_code = 0; 545 de->hash_code = f2fs_dentry_hash(".", 1);
544 de->ino = cpu_to_le32(inode->i_ino); 546 de->ino = cpu_to_le32(inode->i_ino);
545 memcpy(dentry_blk->filename[0], ".", 1); 547 memcpy(dentry_blk->filename[0], ".", 1);
546 set_de_type(de, inode); 548 set_de_type(de, inode);
547 549
548 de = &dentry_blk->dentry[1]; 550 de = &dentry_blk->dentry[1];
549 de->hash_code = 0; 551 de->hash_code = f2fs_dentry_hash("..", 2);
550 de->name_len = cpu_to_le16(2); 552 de->name_len = cpu_to_le16(2);
551 de->ino = cpu_to_le32(parent->i_ino); 553 de->ino = cpu_to_le32(parent->i_ino);
552 memcpy(dentry_blk->filename[1], "..", 2); 554 memcpy(dentry_blk->filename[1], "..", 2);
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index a18d63db2fb6..c8e2d751ef9c 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -211,11 +211,11 @@ struct dnode_of_data {
211static inline void set_new_dnode(struct dnode_of_data *dn, struct inode *inode, 211static inline void set_new_dnode(struct dnode_of_data *dn, struct inode *inode,
212 struct page *ipage, struct page *npage, nid_t nid) 212 struct page *ipage, struct page *npage, nid_t nid)
213{ 213{
214 memset(dn, 0, sizeof(*dn));
214 dn->inode = inode; 215 dn->inode = inode;
215 dn->inode_page = ipage; 216 dn->inode_page = ipage;
216 dn->node_page = npage; 217 dn->node_page = npage;
217 dn->nid = nid; 218 dn->nid = nid;
218 dn->inode_page_locked = 0;
219} 219}
220 220
221/* 221/*
@@ -877,11 +877,13 @@ bool f2fs_empty_dir(struct inode *);
877 * super.c 877 * super.c
878 */ 878 */
879int f2fs_sync_fs(struct super_block *, int); 879int f2fs_sync_fs(struct super_block *, int);
880extern __printf(3, 4)
881void f2fs_msg(struct super_block *, const char *, const char *, ...);
880 882
881/* 883/*
882 * hash.c 884 * hash.c
883 */ 885 */
884f2fs_hash_t f2fs_dentry_hash(const char *, int); 886f2fs_hash_t f2fs_dentry_hash(const char *, size_t);
885 887
886/* 888/*
887 * node.c 889 * node.c
@@ -912,7 +914,7 @@ int restore_node_summary(struct f2fs_sb_info *, unsigned int,
912void flush_nat_entries(struct f2fs_sb_info *); 914void flush_nat_entries(struct f2fs_sb_info *);
913int build_node_manager(struct f2fs_sb_info *); 915int build_node_manager(struct f2fs_sb_info *);
914void destroy_node_manager(struct f2fs_sb_info *); 916void destroy_node_manager(struct f2fs_sb_info *);
915int create_node_manager_caches(void); 917int __init create_node_manager_caches(void);
916void destroy_node_manager_caches(void); 918void destroy_node_manager_caches(void);
917 919
918/* 920/*
@@ -964,7 +966,7 @@ void sync_dirty_dir_inodes(struct f2fs_sb_info *);
964void block_operations(struct f2fs_sb_info *); 966void block_operations(struct f2fs_sb_info *);
965void write_checkpoint(struct f2fs_sb_info *, bool, bool); 967void write_checkpoint(struct f2fs_sb_info *, bool, bool);
966void init_orphan_info(struct f2fs_sb_info *); 968void init_orphan_info(struct f2fs_sb_info *);
967int create_checkpoint_caches(void); 969int __init create_checkpoint_caches(void);
968void destroy_checkpoint_caches(void); 970void destroy_checkpoint_caches(void);
969 971
970/* 972/*
@@ -984,9 +986,9 @@ int do_write_data_page(struct page *);
984int start_gc_thread(struct f2fs_sb_info *); 986int start_gc_thread(struct f2fs_sb_info *);
985void stop_gc_thread(struct f2fs_sb_info *); 987void stop_gc_thread(struct f2fs_sb_info *);
986block_t start_bidx_of_node(unsigned int); 988block_t start_bidx_of_node(unsigned int);
987int f2fs_gc(struct f2fs_sb_info *, int); 989int f2fs_gc(struct f2fs_sb_info *);
988void build_gc_manager(struct f2fs_sb_info *); 990void build_gc_manager(struct f2fs_sb_info *);
989int create_gc_caches(void); 991int __init create_gc_caches(void);
990void destroy_gc_caches(void); 992void destroy_gc_caches(void);
991 993
992/* 994/*
@@ -1058,7 +1060,8 @@ struct f2fs_stat_info {
1058 1060
1059int f2fs_build_stats(struct f2fs_sb_info *); 1061int f2fs_build_stats(struct f2fs_sb_info *);
1060void f2fs_destroy_stats(struct f2fs_sb_info *); 1062void f2fs_destroy_stats(struct f2fs_sb_info *);
1061void destroy_root_stats(void); 1063void __init f2fs_create_root_stats(void);
1064void f2fs_destroy_root_stats(void);
1062#else 1065#else
1063#define stat_inc_call_count(si) 1066#define stat_inc_call_count(si)
1064#define stat_inc_seg_count(si, type) 1067#define stat_inc_seg_count(si, type)
@@ -1068,7 +1071,8 @@ void destroy_root_stats(void);
1068 1071
1069static inline int f2fs_build_stats(struct f2fs_sb_info *sbi) { return 0; } 1072static inline int f2fs_build_stats(struct f2fs_sb_info *sbi) { return 0; }
1070static inline void f2fs_destroy_stats(struct f2fs_sb_info *sbi) { } 1073static inline void f2fs_destroy_stats(struct f2fs_sb_info *sbi) { }
1071static inline void destroy_root_stats(void) { } 1074static inline void __init f2fs_create_root_stats(void) { }
1075static inline void f2fs_destroy_root_stats(void) { }
1072#endif 1076#endif
1073 1077
1074extern const struct file_operations f2fs_dir_operations; 1078extern const struct file_operations f2fs_dir_operations;
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index f9e085dfb1f0..3191b52aafb0 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -96,8 +96,9 @@ out:
96} 96}
97 97
98static const struct vm_operations_struct f2fs_file_vm_ops = { 98static const struct vm_operations_struct f2fs_file_vm_ops = {
99 .fault = filemap_fault, 99 .fault = filemap_fault,
100 .page_mkwrite = f2fs_vm_page_mkwrite, 100 .page_mkwrite = f2fs_vm_page_mkwrite,
101 .remap_pages = generic_file_remap_pages,
101}; 102};
102 103
103static int need_to_sync_dir(struct f2fs_sb_info *sbi, struct inode *inode) 104static int need_to_sync_dir(struct f2fs_sb_info *sbi, struct inode *inode)
@@ -137,6 +138,9 @@ int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
137 if (ret) 138 if (ret)
138 return ret; 139 return ret;
139 140
141 /* guarantee free sections for fsync */
142 f2fs_balance_fs(sbi);
143
140 mutex_lock(&inode->i_mutex); 144 mutex_lock(&inode->i_mutex);
141 145
142 if (datasync && !(inode->i_state & I_DIRTY_DATASYNC)) 146 if (datasync && !(inode->i_state & I_DIRTY_DATASYNC))
@@ -160,15 +164,17 @@ int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
160 if (need_to_sync_dir(sbi, inode)) 164 if (need_to_sync_dir(sbi, inode))
161 need_cp = true; 165 need_cp = true;
162 166
163 f2fs_write_inode(inode, NULL);
164
165 if (need_cp) { 167 if (need_cp) {
166 /* all the dirty node pages should be flushed for POR */ 168 /* all the dirty node pages should be flushed for POR */
167 ret = f2fs_sync_fs(inode->i_sb, 1); 169 ret = f2fs_sync_fs(inode->i_sb, 1);
168 clear_inode_flag(F2FS_I(inode), FI_NEED_CP); 170 clear_inode_flag(F2FS_I(inode), FI_NEED_CP);
169 } else { 171 } else {
170 while (sync_node_pages(sbi, inode->i_ino, &wbc) == 0) 172 /* if there is no written node page, write its inode page */
171 f2fs_write_inode(inode, NULL); 173 while (!sync_node_pages(sbi, inode->i_ino, &wbc)) {
174 ret = f2fs_write_inode(inode, NULL);
175 if (ret)
176 goto out;
177 }
172 filemap_fdatawait_range(sbi->node_inode->i_mapping, 178 filemap_fdatawait_range(sbi->node_inode->i_mapping,
173 0, LONG_MAX); 179 0, LONG_MAX);
174 } 180 }
@@ -405,6 +411,8 @@ int truncate_hole(struct inode *inode, pgoff_t pg_start, pgoff_t pg_end)
405 struct dnode_of_data dn; 411 struct dnode_of_data dn;
406 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); 412 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
407 413
414 f2fs_balance_fs(sbi);
415
408 mutex_lock_op(sbi, DATA_TRUNC); 416 mutex_lock_op(sbi, DATA_TRUNC);
409 set_new_dnode(&dn, inode, NULL, NULL, 0); 417 set_new_dnode(&dn, inode, NULL, NULL, 0);
410 err = get_dnode_of_data(&dn, index, RDONLY_NODE); 418 err = get_dnode_of_data(&dn, index, RDONLY_NODE);
@@ -532,7 +540,6 @@ static long f2fs_fallocate(struct file *file, int mode,
532 loff_t offset, loff_t len) 540 loff_t offset, loff_t len)
533{ 541{
534 struct inode *inode = file->f_path.dentry->d_inode; 542 struct inode *inode = file->f_path.dentry->d_inode;
535 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
536 long ret; 543 long ret;
537 544
538 if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)) 545 if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE))
@@ -543,7 +550,10 @@ static long f2fs_fallocate(struct file *file, int mode,
543 else 550 else
544 ret = expand_inode_data(inode, offset, len, mode); 551 ret = expand_inode_data(inode, offset, len, mode);
545 552
546 f2fs_balance_fs(sbi); 553 if (!ret) {
554 inode->i_mtime = inode->i_ctime = CURRENT_TIME;
555 mark_inode_dirty(inode);
556 }
547 return ret; 557 return ret;
548} 558}
549 559
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 644aa3808273..c386910dacc5 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -78,7 +78,7 @@ static int gc_thread_func(void *data)
78 78
79 sbi->bg_gc++; 79 sbi->bg_gc++;
80 80
81 if (f2fs_gc(sbi, 1) == GC_NONE) 81 if (f2fs_gc(sbi) == GC_NONE)
82 wait_ms = GC_THREAD_NOGC_SLEEP_TIME; 82 wait_ms = GC_THREAD_NOGC_SLEEP_TIME;
83 else if (wait_ms == GC_THREAD_NOGC_SLEEP_TIME) 83 else if (wait_ms == GC_THREAD_NOGC_SLEEP_TIME)
84 wait_ms = GC_THREAD_MAX_SLEEP_TIME; 84 wait_ms = GC_THREAD_MAX_SLEEP_TIME;
@@ -390,9 +390,7 @@ next_step:
390 } 390 }
391 391
392 err = check_valid_map(sbi, segno, off); 392 err = check_valid_map(sbi, segno, off);
393 if (err == GC_ERROR) 393 if (err == GC_NEXT)
394 return err;
395 else if (err == GC_NEXT)
396 continue; 394 continue;
397 395
398 if (initial) { 396 if (initial) {
@@ -426,32 +424,30 @@ next_step:
426} 424}
427 425
428/* 426/*
429 * Calculate start block index that this node page contains 427 * Calculate start block index indicating the given node offset.
428 * Be careful, caller should give this node offset only indicating direct node
429 * blocks. If any node offsets, which point the other types of node blocks such
430 * as indirect or double indirect node blocks, are given, it must be a caller's
431 * bug.
430 */ 432 */
431block_t start_bidx_of_node(unsigned int node_ofs) 433block_t start_bidx_of_node(unsigned int node_ofs)
432{ 434{
433 block_t start_bidx; 435 unsigned int indirect_blks = 2 * NIDS_PER_BLOCK + 4;
434 unsigned int bidx, indirect_blks; 436 unsigned int bidx;
435 int dec;
436 437
437 indirect_blks = 2 * NIDS_PER_BLOCK + 4; 438 if (node_ofs == 0)
439 return 0;
438 440
439 start_bidx = 1; 441 if (node_ofs <= 2) {
440 if (node_ofs == 0) {
441 start_bidx = 0;
442 } else if (node_ofs <= 2) {
443 bidx = node_ofs - 1; 442 bidx = node_ofs - 1;
444 } else if (node_ofs <= indirect_blks) { 443 } else if (node_ofs <= indirect_blks) {
445 dec = (node_ofs - 4) / (NIDS_PER_BLOCK + 1); 444 int dec = (node_ofs - 4) / (NIDS_PER_BLOCK + 1);
446 bidx = node_ofs - 2 - dec; 445 bidx = node_ofs - 2 - dec;
447 } else { 446 } else {
448 dec = (node_ofs - indirect_blks - 3) / (NIDS_PER_BLOCK + 1); 447 int dec = (node_ofs - indirect_blks - 3) / (NIDS_PER_BLOCK + 1);
449 bidx = node_ofs - 5 - dec; 448 bidx = node_ofs - 5 - dec;
450 } 449 }
451 450 return bidx * ADDRS_PER_BLOCK + ADDRS_PER_INODE;
452 if (start_bidx)
453 start_bidx = bidx * ADDRS_PER_BLOCK + ADDRS_PER_INODE;
454 return start_bidx;
455} 451}
456 452
457static int check_dnode(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, 453static int check_dnode(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
@@ -556,9 +552,7 @@ next_step:
556 } 552 }
557 553
558 err = check_valid_map(sbi, segno, off); 554 err = check_valid_map(sbi, segno, off);
559 if (err == GC_ERROR) 555 if (err == GC_NEXT)
560 goto stop;
561 else if (err == GC_NEXT)
562 continue; 556 continue;
563 557
564 if (phase == 0) { 558 if (phase == 0) {
@@ -568,9 +562,7 @@ next_step:
568 562
569 /* Get an inode by ino with checking validity */ 563 /* Get an inode by ino with checking validity */
570 err = check_dnode(sbi, entry, &dni, start_addr + off, &nofs); 564 err = check_dnode(sbi, entry, &dni, start_addr + off, &nofs);
571 if (err == GC_ERROR) 565 if (err == GC_NEXT)
572 goto stop;
573 else if (err == GC_NEXT)
574 continue; 566 continue;
575 567
576 if (phase == 1) { 568 if (phase == 1) {
@@ -663,62 +655,44 @@ static int do_garbage_collect(struct f2fs_sb_info *sbi, unsigned int segno,
663 return ret; 655 return ret;
664} 656}
665 657
666int f2fs_gc(struct f2fs_sb_info *sbi, int nGC) 658int f2fs_gc(struct f2fs_sb_info *sbi)
667{ 659{
668 unsigned int segno;
669 int old_free_secs, cur_free_secs;
670 int gc_status, nfree;
671 struct list_head ilist; 660 struct list_head ilist;
661 unsigned int segno, i;
672 int gc_type = BG_GC; 662 int gc_type = BG_GC;
663 int gc_status = GC_NONE;
673 664
674 INIT_LIST_HEAD(&ilist); 665 INIT_LIST_HEAD(&ilist);
675gc_more: 666gc_more:
676 nfree = 0; 667 if (!(sbi->sb->s_flags & MS_ACTIVE))
677 gc_status = GC_NONE; 668 goto stop;
678 669
679 if (has_not_enough_free_secs(sbi)) 670 if (has_not_enough_free_secs(sbi))
680 old_free_secs = reserved_sections(sbi); 671 gc_type = FG_GC;
681 else
682 old_free_secs = free_sections(sbi);
683
684 while (sbi->sb->s_flags & MS_ACTIVE) {
685 int i;
686 if (has_not_enough_free_secs(sbi))
687 gc_type = FG_GC;
688 672
689 cur_free_secs = free_sections(sbi) + nfree; 673 if (!__get_victim(sbi, &segno, gc_type, NO_CHECK_TYPE))
674 goto stop;
690 675
691 /* We got free space successfully. */ 676 for (i = 0; i < sbi->segs_per_sec; i++) {
692 if (nGC < cur_free_secs - old_free_secs) 677 /*
693 break; 678 * do_garbage_collect will give us three gc_status:
694 679 * GC_ERROR, GC_DONE, and GC_BLOCKED.
695 if (!__get_victim(sbi, &segno, gc_type, NO_CHECK_TYPE)) 680 * If GC is finished uncleanly, we have to return
681 * the victim to dirty segment list.
682 */
683 gc_status = do_garbage_collect(sbi, segno + i, &ilist, gc_type);
684 if (gc_status != GC_DONE)
696 break; 685 break;
697
698 for (i = 0; i < sbi->segs_per_sec; i++) {
699 /*
700 * do_garbage_collect will give us three gc_status:
701 * GC_ERROR, GC_DONE, and GC_BLOCKED.
702 * If GC is finished uncleanly, we have to return
703 * the victim to dirty segment list.
704 */
705 gc_status = do_garbage_collect(sbi, segno + i,
706 &ilist, gc_type);
707 if (gc_status != GC_DONE)
708 goto stop;
709 nfree++;
710 }
711 } 686 }
712stop: 687 if (has_not_enough_free_secs(sbi)) {
713 if (has_not_enough_free_secs(sbi) || gc_status == GC_BLOCKED) {
714 write_checkpoint(sbi, (gc_status == GC_BLOCKED), false); 688 write_checkpoint(sbi, (gc_status == GC_BLOCKED), false);
715 if (nfree) 689 if (has_not_enough_free_secs(sbi))
716 goto gc_more; 690 goto gc_more;
717 } 691 }
692stop:
718 mutex_unlock(&sbi->gc_mutex); 693 mutex_unlock(&sbi->gc_mutex);
719 694
720 put_gc_inode(&ilist); 695 put_gc_inode(&ilist);
721 BUG_ON(!list_empty(&ilist));
722 return gc_status; 696 return gc_status;
723} 697}
724 698
@@ -727,7 +701,7 @@ void build_gc_manager(struct f2fs_sb_info *sbi)
727 DIRTY_I(sbi)->v_ops = &default_v_ops; 701 DIRTY_I(sbi)->v_ops = &default_v_ops;
728} 702}
729 703
730int create_gc_caches(void) 704int __init create_gc_caches(void)
731{ 705{
732 winode_slab = f2fs_kmem_cache_create("f2fs_gc_inodes", 706 winode_slab = f2fs_kmem_cache_create("f2fs_gc_inodes",
733 sizeof(struct inode_entry), NULL); 707 sizeof(struct inode_entry), NULL);
diff --git a/fs/f2fs/hash.c b/fs/f2fs/hash.c
index a60f04200f8b..6eb8d269b53b 100644
--- a/fs/f2fs/hash.c
+++ b/fs/f2fs/hash.c
@@ -42,7 +42,7 @@ static void TEA_transform(unsigned int buf[4], unsigned int const in[])
42 buf[1] += b1; 42 buf[1] += b1;
43} 43}
44 44
45static void str2hashbuf(const char *msg, int len, unsigned int *buf, int num) 45static void str2hashbuf(const char *msg, size_t len, unsigned int *buf, int num)
46{ 46{
47 unsigned pad, val; 47 unsigned pad, val;
48 int i; 48 int i;
@@ -69,13 +69,17 @@ static void str2hashbuf(const char *msg, int len, unsigned int *buf, int num)
69 *buf++ = pad; 69 *buf++ = pad;
70} 70}
71 71
72f2fs_hash_t f2fs_dentry_hash(const char *name, int len) 72f2fs_hash_t f2fs_dentry_hash(const char *name, size_t len)
73{ 73{
74 __u32 hash, minor_hash; 74 __u32 hash;
75 f2fs_hash_t f2fs_hash; 75 f2fs_hash_t f2fs_hash;
76 const char *p; 76 const char *p;
77 __u32 in[8], buf[4]; 77 __u32 in[8], buf[4];
78 78
79 if ((len <= 2) && (name[0] == '.') &&
80 (name[1] == '.' || name[1] == '\0'))
81 return 0;
82
79 /* Initialize the default seed for the hash checksum functions */ 83 /* Initialize the default seed for the hash checksum functions */
80 buf[0] = 0x67452301; 84 buf[0] = 0x67452301;
81 buf[1] = 0xefcdab89; 85 buf[1] = 0xefcdab89;
@@ -83,15 +87,15 @@ f2fs_hash_t f2fs_dentry_hash(const char *name, int len)
83 buf[3] = 0x10325476; 87 buf[3] = 0x10325476;
84 88
85 p = name; 89 p = name;
86 while (len > 0) { 90 while (1) {
87 str2hashbuf(p, len, in, 4); 91 str2hashbuf(p, len, in, 4);
88 TEA_transform(buf, in); 92 TEA_transform(buf, in);
89 len -= 16;
90 p += 16; 93 p += 16;
94 if (len <= 16)
95 break;
96 len -= 16;
91 } 97 }
92 hash = buf[0]; 98 hash = buf[0];
93 minor_hash = buf[1];
94
95 f2fs_hash = cpu_to_le32(hash & ~F2FS_HASH_COL_BIT); 99 f2fs_hash = cpu_to_le32(hash & ~F2FS_HASH_COL_BIT);
96 return f2fs_hash; 100 return f2fs_hash;
97} 101}
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index df5fb381ebf1..794241777322 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -203,6 +203,7 @@ void update_inode(struct inode *inode, struct page *node_page)
203 ri->i_flags = cpu_to_le32(F2FS_I(inode)->i_flags); 203 ri->i_flags = cpu_to_le32(F2FS_I(inode)->i_flags);
204 ri->i_pino = cpu_to_le32(F2FS_I(inode)->i_pino); 204 ri->i_pino = cpu_to_le32(F2FS_I(inode)->i_pino);
205 ri->i_generation = cpu_to_le32(inode->i_generation); 205 ri->i_generation = cpu_to_le32(inode->i_generation);
206 set_cold_node(inode, node_page);
206 set_page_dirty(node_page); 207 set_page_dirty(node_page);
207} 208}
208 209
@@ -216,6 +217,9 @@ int f2fs_write_inode(struct inode *inode, struct writeback_control *wbc)
216 inode->i_ino == F2FS_META_INO(sbi)) 217 inode->i_ino == F2FS_META_INO(sbi))
217 return 0; 218 return 0;
218 219
220 if (wbc)
221 f2fs_balance_fs(sbi);
222
219 node_page = get_node_page(sbi, inode->i_ino); 223 node_page = get_node_page(sbi, inode->i_ino);
220 if (IS_ERR(node_page)) 224 if (IS_ERR(node_page))
221 return PTR_ERR(node_page); 225 return PTR_ERR(node_page);
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 89b7675dc377..1a49b881bac0 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -77,8 +77,8 @@ fail:
77 77
78static int is_multimedia_file(const unsigned char *s, const char *sub) 78static int is_multimedia_file(const unsigned char *s, const char *sub)
79{ 79{
80 int slen = strlen(s); 80 size_t slen = strlen(s);
81 int sublen = strlen(sub); 81 size_t sublen = strlen(sub);
82 int ret; 82 int ret;
83 83
84 if (sublen > slen) 84 if (sublen > slen)
@@ -123,6 +123,8 @@ static int f2fs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
123 nid_t ino = 0; 123 nid_t ino = 0;
124 int err; 124 int err;
125 125
126 f2fs_balance_fs(sbi);
127
126 inode = f2fs_new_inode(dir, mode); 128 inode = f2fs_new_inode(dir, mode);
127 if (IS_ERR(inode)) 129 if (IS_ERR(inode))
128 return PTR_ERR(inode); 130 return PTR_ERR(inode);
@@ -144,8 +146,6 @@ static int f2fs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
144 if (!sbi->por_doing) 146 if (!sbi->por_doing)
145 d_instantiate(dentry, inode); 147 d_instantiate(dentry, inode);
146 unlock_new_inode(inode); 148 unlock_new_inode(inode);
147
148 f2fs_balance_fs(sbi);
149 return 0; 149 return 0;
150out: 150out:
151 clear_nlink(inode); 151 clear_nlink(inode);
@@ -163,6 +163,8 @@ static int f2fs_link(struct dentry *old_dentry, struct inode *dir,
163 struct f2fs_sb_info *sbi = F2FS_SB(sb); 163 struct f2fs_sb_info *sbi = F2FS_SB(sb);
164 int err; 164 int err;
165 165
166 f2fs_balance_fs(sbi);
167
166 inode->i_ctime = CURRENT_TIME; 168 inode->i_ctime = CURRENT_TIME;
167 atomic_inc(&inode->i_count); 169 atomic_inc(&inode->i_count);
168 170
@@ -172,8 +174,6 @@ static int f2fs_link(struct dentry *old_dentry, struct inode *dir,
172 goto out; 174 goto out;
173 175
174 d_instantiate(dentry, inode); 176 d_instantiate(dentry, inode);
175
176 f2fs_balance_fs(sbi);
177 return 0; 177 return 0;
178out: 178out:
179 clear_inode_flag(F2FS_I(inode), FI_INC_LINK); 179 clear_inode_flag(F2FS_I(inode), FI_INC_LINK);
@@ -223,6 +223,8 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
223 struct page *page; 223 struct page *page;
224 int err = -ENOENT; 224 int err = -ENOENT;
225 225
226 f2fs_balance_fs(sbi);
227
226 de = f2fs_find_entry(dir, &dentry->d_name, &page); 228 de = f2fs_find_entry(dir, &dentry->d_name, &page);
227 if (!de) 229 if (!de)
228 goto fail; 230 goto fail;
@@ -238,7 +240,6 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry)
238 240
239 /* In order to evict this inode, we set it dirty */ 241 /* In order to evict this inode, we set it dirty */
240 mark_inode_dirty(inode); 242 mark_inode_dirty(inode);
241 f2fs_balance_fs(sbi);
242fail: 243fail:
243 return err; 244 return err;
244} 245}
@@ -249,9 +250,11 @@ static int f2fs_symlink(struct inode *dir, struct dentry *dentry,
249 struct super_block *sb = dir->i_sb; 250 struct super_block *sb = dir->i_sb;
250 struct f2fs_sb_info *sbi = F2FS_SB(sb); 251 struct f2fs_sb_info *sbi = F2FS_SB(sb);
251 struct inode *inode; 252 struct inode *inode;
252 unsigned symlen = strlen(symname) + 1; 253 size_t symlen = strlen(symname) + 1;
253 int err; 254 int err;
254 255
256 f2fs_balance_fs(sbi);
257
255 inode = f2fs_new_inode(dir, S_IFLNK | S_IRWXUGO); 258 inode = f2fs_new_inode(dir, S_IFLNK | S_IRWXUGO);
256 if (IS_ERR(inode)) 259 if (IS_ERR(inode))
257 return PTR_ERR(inode); 260 return PTR_ERR(inode);
@@ -268,9 +271,6 @@ static int f2fs_symlink(struct inode *dir, struct dentry *dentry,
268 271
269 d_instantiate(dentry, inode); 272 d_instantiate(dentry, inode);
270 unlock_new_inode(inode); 273 unlock_new_inode(inode);
271
272 f2fs_balance_fs(sbi);
273
274 return err; 274 return err;
275out: 275out:
276 clear_nlink(inode); 276 clear_nlink(inode);
@@ -286,6 +286,8 @@ static int f2fs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
286 struct inode *inode; 286 struct inode *inode;
287 int err; 287 int err;
288 288
289 f2fs_balance_fs(sbi);
290
289 inode = f2fs_new_inode(dir, S_IFDIR | mode); 291 inode = f2fs_new_inode(dir, S_IFDIR | mode);
290 if (IS_ERR(inode)) 292 if (IS_ERR(inode))
291 return PTR_ERR(inode); 293 return PTR_ERR(inode);
@@ -305,7 +307,6 @@ static int f2fs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
305 d_instantiate(dentry, inode); 307 d_instantiate(dentry, inode);
306 unlock_new_inode(inode); 308 unlock_new_inode(inode);
307 309
308 f2fs_balance_fs(sbi);
309 return 0; 310 return 0;
310 311
311out_fail: 312out_fail:
@@ -336,6 +337,8 @@ static int f2fs_mknod(struct inode *dir, struct dentry *dentry,
336 if (!new_valid_dev(rdev)) 337 if (!new_valid_dev(rdev))
337 return -EINVAL; 338 return -EINVAL;
338 339
340 f2fs_balance_fs(sbi);
341
339 inode = f2fs_new_inode(dir, mode); 342 inode = f2fs_new_inode(dir, mode);
340 if (IS_ERR(inode)) 343 if (IS_ERR(inode))
341 return PTR_ERR(inode); 344 return PTR_ERR(inode);
@@ -350,9 +353,6 @@ static int f2fs_mknod(struct inode *dir, struct dentry *dentry,
350 alloc_nid_done(sbi, inode->i_ino); 353 alloc_nid_done(sbi, inode->i_ino);
351 d_instantiate(dentry, inode); 354 d_instantiate(dentry, inode);
352 unlock_new_inode(inode); 355 unlock_new_inode(inode);
353
354 f2fs_balance_fs(sbi);
355
356 return 0; 356 return 0;
357out: 357out:
358 clear_nlink(inode); 358 clear_nlink(inode);
@@ -376,6 +376,8 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry,
376 struct f2fs_dir_entry *new_entry; 376 struct f2fs_dir_entry *new_entry;
377 int err = -ENOENT; 377 int err = -ENOENT;
378 378
379 f2fs_balance_fs(sbi);
380
379 old_entry = f2fs_find_entry(old_dir, &old_dentry->d_name, &old_page); 381 old_entry = f2fs_find_entry(old_dir, &old_dentry->d_name, &old_page);
380 if (!old_entry) 382 if (!old_entry)
381 goto out; 383 goto out;
@@ -441,8 +443,6 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry,
441 } 443 }
442 444
443 mutex_unlock_op(sbi, RENAME); 445 mutex_unlock_op(sbi, RENAME);
444
445 f2fs_balance_fs(sbi);
446 return 0; 446 return 0;
447 447
448out_dir: 448out_dir:
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 19870361497e..9bda63c9c166 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -484,12 +484,14 @@ static void truncate_node(struct dnode_of_data *dn)
484 struct node_info ni; 484 struct node_info ni;
485 485
486 get_node_info(sbi, dn->nid, &ni); 486 get_node_info(sbi, dn->nid, &ni);
487 if (dn->inode->i_blocks == 0) {
488 BUG_ON(ni.blk_addr != NULL_ADDR);
489 goto invalidate;
490 }
487 BUG_ON(ni.blk_addr == NULL_ADDR); 491 BUG_ON(ni.blk_addr == NULL_ADDR);
488 492
489 if (ni.blk_addr != NULL_ADDR)
490 invalidate_blocks(sbi, ni.blk_addr);
491
492 /* Deallocate node address */ 493 /* Deallocate node address */
494 invalidate_blocks(sbi, ni.blk_addr);
493 dec_valid_node_count(sbi, dn->inode, 1); 495 dec_valid_node_count(sbi, dn->inode, 1);
494 set_node_addr(sbi, &ni, NULL_ADDR); 496 set_node_addr(sbi, &ni, NULL_ADDR);
495 497
@@ -499,7 +501,7 @@ static void truncate_node(struct dnode_of_data *dn)
499 } else { 501 } else {
500 sync_inode_page(dn); 502 sync_inode_page(dn);
501 } 503 }
502 504invalidate:
503 clear_node_page_dirty(dn->node_page); 505 clear_node_page_dirty(dn->node_page);
504 F2FS_SET_SB_DIRT(sbi); 506 F2FS_SET_SB_DIRT(sbi);
505 507
@@ -768,20 +770,12 @@ int remove_inode_page(struct inode *inode)
768 dn.inode_page_locked = 1; 770 dn.inode_page_locked = 1;
769 truncate_node(&dn); 771 truncate_node(&dn);
770 } 772 }
771 if (inode->i_blocks == 1) {
772 /* inernally call f2fs_put_page() */
773 set_new_dnode(&dn, inode, page, page, ino);
774 truncate_node(&dn);
775 } else if (inode->i_blocks == 0) {
776 struct node_info ni;
777 get_node_info(sbi, inode->i_ino, &ni);
778 773
779 /* called after f2fs_new_inode() is failed */ 774 /* 0 is possible, after f2fs_new_inode() is failed */
780 BUG_ON(ni.blk_addr != NULL_ADDR); 775 BUG_ON(inode->i_blocks != 0 && inode->i_blocks != 1);
781 f2fs_put_page(page, 1); 776 set_new_dnode(&dn, inode, page, page, ino);
782 } else { 777 truncate_node(&dn);
783 BUG(); 778
784 }
785 mutex_unlock_op(sbi, NODE_TRUNC); 779 mutex_unlock_op(sbi, NODE_TRUNC);
786 return 0; 780 return 0;
787} 781}
@@ -834,17 +828,18 @@ struct page *new_node_page(struct dnode_of_data *dn, unsigned int ofs)
834 goto fail; 828 goto fail;
835 } 829 }
836 set_node_addr(sbi, &new_ni, NEW_ADDR); 830 set_node_addr(sbi, &new_ni, NEW_ADDR);
831 set_cold_node(dn->inode, page);
837 832
838 dn->node_page = page; 833 dn->node_page = page;
839 sync_inode_page(dn); 834 sync_inode_page(dn);
840 set_page_dirty(page); 835 set_page_dirty(page);
841 set_cold_node(dn->inode, page);
842 if (ofs == 0) 836 if (ofs == 0)
843 inc_valid_inode_count(sbi); 837 inc_valid_inode_count(sbi);
844 838
845 return page; 839 return page;
846 840
847fail: 841fail:
842 clear_node_page_dirty(page);
848 f2fs_put_page(page, 1); 843 f2fs_put_page(page, 1);
849 return ERR_PTR(err); 844 return ERR_PTR(err);
850} 845}
@@ -1093,7 +1088,6 @@ static int f2fs_write_node_page(struct page *page,
1093{ 1088{
1094 struct f2fs_sb_info *sbi = F2FS_SB(page->mapping->host->i_sb); 1089 struct f2fs_sb_info *sbi = F2FS_SB(page->mapping->host->i_sb);
1095 nid_t nid; 1090 nid_t nid;
1096 unsigned int nofs;
1097 block_t new_addr; 1091 block_t new_addr;
1098 struct node_info ni; 1092 struct node_info ni;
1099 1093
@@ -1110,7 +1104,6 @@ static int f2fs_write_node_page(struct page *page,
1110 1104
1111 /* get old block addr of this node page */ 1105 /* get old block addr of this node page */
1112 nid = nid_of_node(page); 1106 nid = nid_of_node(page);
1113 nofs = ofs_of_node(page);
1114 BUG_ON(page->index != nid); 1107 BUG_ON(page->index != nid);
1115 1108
1116 get_node_info(sbi, nid, &ni); 1109 get_node_info(sbi, nid, &ni);
@@ -1131,6 +1124,12 @@ static int f2fs_write_node_page(struct page *page,
1131 return 0; 1124 return 0;
1132} 1125}
1133 1126
1127/*
1128 * It is very important to gather dirty pages and write at once, so that we can
1129 * submit a big bio without interfering other data writes.
1130 * Be default, 512 pages (2MB), a segment size, is quite reasonable.
1131 */
1132#define COLLECT_DIRTY_NODES 512
1134static int f2fs_write_node_pages(struct address_space *mapping, 1133static int f2fs_write_node_pages(struct address_space *mapping,
1135 struct writeback_control *wbc) 1134 struct writeback_control *wbc)
1136{ 1135{
@@ -1138,17 +1137,16 @@ static int f2fs_write_node_pages(struct address_space *mapping,
1138 struct block_device *bdev = sbi->sb->s_bdev; 1137 struct block_device *bdev = sbi->sb->s_bdev;
1139 long nr_to_write = wbc->nr_to_write; 1138 long nr_to_write = wbc->nr_to_write;
1140 1139
1141 if (wbc->for_kupdate) 1140 /* First check balancing cached NAT entries */
1142 return 0;
1143
1144 if (get_pages(sbi, F2FS_DIRTY_NODES) == 0)
1145 return 0;
1146
1147 if (try_to_free_nats(sbi, NAT_ENTRY_PER_BLOCK)) { 1141 if (try_to_free_nats(sbi, NAT_ENTRY_PER_BLOCK)) {
1148 write_checkpoint(sbi, false, false); 1142 write_checkpoint(sbi, false, false);
1149 return 0; 1143 return 0;
1150 } 1144 }
1151 1145
1146 /* collect a number of dirty node pages and write together */
1147 if (get_pages(sbi, F2FS_DIRTY_NODES) < COLLECT_DIRTY_NODES)
1148 return 0;
1149
1152 /* if mounting is failed, skip writing node pages */ 1150 /* if mounting is failed, skip writing node pages */
1153 wbc->nr_to_write = bio_get_nr_vecs(bdev); 1151 wbc->nr_to_write = bio_get_nr_vecs(bdev);
1154 sync_node_pages(sbi, 0, wbc); 1152 sync_node_pages(sbi, 0, wbc);
@@ -1571,7 +1569,7 @@ void flush_nat_entries(struct f2fs_sb_info *sbi)
1571 nid_t nid; 1569 nid_t nid;
1572 struct f2fs_nat_entry raw_ne; 1570 struct f2fs_nat_entry raw_ne;
1573 int offset = -1; 1571 int offset = -1;
1574 block_t old_blkaddr, new_blkaddr; 1572 block_t new_blkaddr;
1575 1573
1576 ne = list_entry(cur, struct nat_entry, list); 1574 ne = list_entry(cur, struct nat_entry, list);
1577 nid = nat_get_nid(ne); 1575 nid = nat_get_nid(ne);
@@ -1585,7 +1583,6 @@ void flush_nat_entries(struct f2fs_sb_info *sbi)
1585 offset = lookup_journal_in_cursum(sum, NAT_JOURNAL, nid, 1); 1583 offset = lookup_journal_in_cursum(sum, NAT_JOURNAL, nid, 1);
1586 if (offset >= 0) { 1584 if (offset >= 0) {
1587 raw_ne = nat_in_journal(sum, offset); 1585 raw_ne = nat_in_journal(sum, offset);
1588 old_blkaddr = le32_to_cpu(raw_ne.block_addr);
1589 goto flush_now; 1586 goto flush_now;
1590 } 1587 }
1591to_nat_page: 1588to_nat_page:
@@ -1607,7 +1604,6 @@ to_nat_page:
1607 1604
1608 BUG_ON(!nat_blk); 1605 BUG_ON(!nat_blk);
1609 raw_ne = nat_blk->entries[nid - start_nid]; 1606 raw_ne = nat_blk->entries[nid - start_nid];
1610 old_blkaddr = le32_to_cpu(raw_ne.block_addr);
1611flush_now: 1607flush_now:
1612 new_blkaddr = nat_get_blkaddr(ne); 1608 new_blkaddr = nat_get_blkaddr(ne);
1613 1609
@@ -1741,7 +1737,7 @@ void destroy_node_manager(struct f2fs_sb_info *sbi)
1741 kfree(nm_i); 1737 kfree(nm_i);
1742} 1738}
1743 1739
1744int create_node_manager_caches(void) 1740int __init create_node_manager_caches(void)
1745{ 1741{
1746 nat_entry_slab = f2fs_kmem_cache_create("nat_entry", 1742 nat_entry_slab = f2fs_kmem_cache_create("nat_entry",
1747 sizeof(struct nat_entry), NULL); 1743 sizeof(struct nat_entry), NULL);
diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c
index b07e9b6ef376..f42e4060b399 100644
--- a/fs/f2fs/recovery.c
+++ b/fs/f2fs/recovery.c
@@ -67,7 +67,7 @@ static int recover_dentry(struct page *ipage, struct inode *inode)
67 kunmap(page); 67 kunmap(page);
68 f2fs_put_page(page, 0); 68 f2fs_put_page(page, 0);
69 } else { 69 } else {
70 f2fs_add_link(&dent, inode); 70 err = f2fs_add_link(&dent, inode);
71 } 71 }
72 iput(dir); 72 iput(dir);
73out: 73out:
@@ -144,14 +144,14 @@ static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head)
144 goto out; 144 goto out;
145 } 145 }
146 146
147 INIT_LIST_HEAD(&entry->list);
148 list_add_tail(&entry->list, head);
149
150 entry->inode = f2fs_iget(sbi->sb, ino_of_node(page)); 147 entry->inode = f2fs_iget(sbi->sb, ino_of_node(page));
151 if (IS_ERR(entry->inode)) { 148 if (IS_ERR(entry->inode)) {
152 err = PTR_ERR(entry->inode); 149 err = PTR_ERR(entry->inode);
150 kmem_cache_free(fsync_entry_slab, entry);
153 goto out; 151 goto out;
154 } 152 }
153
154 list_add_tail(&entry->list, head);
155 entry->blkaddr = blkaddr; 155 entry->blkaddr = blkaddr;
156 } 156 }
157 if (IS_INODE(page)) { 157 if (IS_INODE(page)) {
@@ -173,10 +173,9 @@ out:
173static void destroy_fsync_dnodes(struct f2fs_sb_info *sbi, 173static void destroy_fsync_dnodes(struct f2fs_sb_info *sbi,
174 struct list_head *head) 174 struct list_head *head)
175{ 175{
176 struct list_head *this; 176 struct fsync_inode_entry *entry, *tmp;
177 struct fsync_inode_entry *entry; 177
178 list_for_each(this, head) { 178 list_for_each_entry_safe(entry, tmp, head, list) {
179 entry = list_entry(this, struct fsync_inode_entry, list);
180 iput(entry->inode); 179 iput(entry->inode);
181 list_del(&entry->list); 180 list_del(&entry->list);
182 kmem_cache_free(fsync_entry_slab, entry); 181 kmem_cache_free(fsync_entry_slab, entry);
@@ -228,6 +227,9 @@ static void check_index_in_prev_nodes(struct f2fs_sb_info *sbi,
228 227
229 /* Deallocate previous index in the node page */ 228 /* Deallocate previous index in the node page */
230 inode = f2fs_iget_nowait(sbi->sb, ino); 229 inode = f2fs_iget_nowait(sbi->sb, ino);
230 if (IS_ERR(inode))
231 return;
232
231 truncate_hole(inode, bidx, bidx + 1); 233 truncate_hole(inode, bidx, bidx + 1);
232 iput(inode); 234 iput(inode);
233} 235}
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 1b26e4ea1016..4b0099066582 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -12,57 +12,26 @@
12#include <linux/f2fs_fs.h> 12#include <linux/f2fs_fs.h>
13#include <linux/bio.h> 13#include <linux/bio.h>
14#include <linux/blkdev.h> 14#include <linux/blkdev.h>
15#include <linux/prefetch.h>
15#include <linux/vmalloc.h> 16#include <linux/vmalloc.h>
16 17
17#include "f2fs.h" 18#include "f2fs.h"
18#include "segment.h" 19#include "segment.h"
19#include "node.h" 20#include "node.h"
20 21
21static int need_to_flush(struct f2fs_sb_info *sbi)
22{
23 unsigned int pages_per_sec = (1 << sbi->log_blocks_per_seg) *
24 sbi->segs_per_sec;
25 int node_secs = ((get_pages(sbi, F2FS_DIRTY_NODES) + pages_per_sec - 1)
26 >> sbi->log_blocks_per_seg) / sbi->segs_per_sec;
27 int dent_secs = ((get_pages(sbi, F2FS_DIRTY_DENTS) + pages_per_sec - 1)
28 >> sbi->log_blocks_per_seg) / sbi->segs_per_sec;
29
30 if (sbi->por_doing)
31 return 0;
32
33 if (free_sections(sbi) <= (node_secs + 2 * dent_secs +
34 reserved_sections(sbi)))
35 return 1;
36 return 0;
37}
38
39/* 22/*
40 * This function balances dirty node and dentry pages. 23 * This function balances dirty node and dentry pages.
41 * In addition, it controls garbage collection. 24 * In addition, it controls garbage collection.
42 */ 25 */
43void f2fs_balance_fs(struct f2fs_sb_info *sbi) 26void f2fs_balance_fs(struct f2fs_sb_info *sbi)
44{ 27{
45 struct writeback_control wbc = {
46 .sync_mode = WB_SYNC_ALL,
47 .nr_to_write = LONG_MAX,
48 .for_reclaim = 0,
49 };
50
51 if (sbi->por_doing)
52 return;
53
54 /* 28 /*
55 * We should do checkpoint when there are so many dirty node pages 29 * We should do GC or end up with checkpoint, if there are so many dirty
56 * with enough free segments. After then, we should do GC. 30 * dir/node pages without enough free segments.
57 */ 31 */
58 if (need_to_flush(sbi)) {
59 sync_dirty_dir_inodes(sbi);
60 sync_node_pages(sbi, 0, &wbc);
61 }
62
63 if (has_not_enough_free_secs(sbi)) { 32 if (has_not_enough_free_secs(sbi)) {
64 mutex_lock(&sbi->gc_mutex); 33 mutex_lock(&sbi->gc_mutex);
65 f2fs_gc(sbi, 1); 34 f2fs_gc(sbi);
66 } 35 }
67} 36}
68 37
@@ -631,7 +600,6 @@ static void f2fs_end_io_write(struct bio *bio, int err)
631 if (page->mapping) 600 if (page->mapping)
632 set_bit(AS_EIO, &page->mapping->flags); 601 set_bit(AS_EIO, &page->mapping->flags);
633 set_ckpt_flags(p->sbi->ckpt, CP_ERROR_FLAG); 602 set_ckpt_flags(p->sbi->ckpt, CP_ERROR_FLAG);
634 set_page_dirty(page);
635 } 603 }
636 end_page_writeback(page); 604 end_page_writeback(page);
637 dec_page_count(p->sbi, F2FS_WRITEBACK); 605 dec_page_count(p->sbi, F2FS_WRITEBACK);
@@ -791,11 +759,10 @@ static int __get_segment_type(struct page *page, enum page_type p_type)
791 return __get_segment_type_2(page, p_type); 759 return __get_segment_type_2(page, p_type);
792 case 4: 760 case 4:
793 return __get_segment_type_4(page, p_type); 761 return __get_segment_type_4(page, p_type);
794 case 6:
795 return __get_segment_type_6(page, p_type);
796 default:
797 BUG();
798 } 762 }
763 /* NR_CURSEG_TYPE(6) logs by default */
764 BUG_ON(sbi->active_logs != NR_CURSEG_TYPE);
765 return __get_segment_type_6(page, p_type);
799} 766}
800 767
801static void do_write_page(struct f2fs_sb_info *sbi, struct page *page, 768static void do_write_page(struct f2fs_sb_info *sbi, struct page *page,
@@ -1608,7 +1575,6 @@ static int build_dirty_segmap(struct f2fs_sb_info *sbi)
1608 1575
1609 for (i = 0; i < NR_DIRTY_TYPE; i++) { 1576 for (i = 0; i < NR_DIRTY_TYPE; i++) {
1610 dirty_i->dirty_segmap[i] = kzalloc(bitmap_size, GFP_KERNEL); 1577 dirty_i->dirty_segmap[i] = kzalloc(bitmap_size, GFP_KERNEL);
1611 dirty_i->nr_dirty[i] = 0;
1612 if (!dirty_i->dirty_segmap[i]) 1578 if (!dirty_i->dirty_segmap[i])
1613 return -ENOMEM; 1579 return -ENOMEM;
1614 } 1580 }
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
index 0948405af6f5..66a288a52fd3 100644
--- a/fs/f2fs/segment.h
+++ b/fs/f2fs/segment.h
@@ -459,7 +459,20 @@ static inline int get_ssr_segment(struct f2fs_sb_info *sbi, int type)
459 459
460static inline bool has_not_enough_free_secs(struct f2fs_sb_info *sbi) 460static inline bool has_not_enough_free_secs(struct f2fs_sb_info *sbi)
461{ 461{
462 return free_sections(sbi) <= reserved_sections(sbi); 462 unsigned int pages_per_sec = (1 << sbi->log_blocks_per_seg) *
463 sbi->segs_per_sec;
464 int node_secs = ((get_pages(sbi, F2FS_DIRTY_NODES) + pages_per_sec - 1)
465 >> sbi->log_blocks_per_seg) / sbi->segs_per_sec;
466 int dent_secs = ((get_pages(sbi, F2FS_DIRTY_DENTS) + pages_per_sec - 1)
467 >> sbi->log_blocks_per_seg) / sbi->segs_per_sec;
468
469 if (sbi->por_doing)
470 return false;
471
472 if (free_sections(sbi) <= (node_secs + 2 * dent_secs +
473 reserved_sections(sbi)))
474 return true;
475 return false;
463} 476}
464 477
465static inline int utilization(struct f2fs_sb_info *sbi) 478static inline int utilization(struct f2fs_sb_info *sbi)
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 13867322cf5a..37fad04c8669 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -53,6 +53,18 @@ static match_table_t f2fs_tokens = {
53 {Opt_err, NULL}, 53 {Opt_err, NULL},
54}; 54};
55 55
56void f2fs_msg(struct super_block *sb, const char *level, const char *fmt, ...)
57{
58 struct va_format vaf;
59 va_list args;
60
61 va_start(args, fmt);
62 vaf.fmt = fmt;
63 vaf.va = &args;
64 printk("%sF2FS-fs (%s): %pV\n", level, sb->s_id, &vaf);
65 va_end(args);
66}
67
56static void init_once(void *foo) 68static void init_once(void *foo)
57{ 69{
58 struct f2fs_inode_info *fi = (struct f2fs_inode_info *) foo; 70 struct f2fs_inode_info *fi = (struct f2fs_inode_info *) foo;
@@ -119,15 +131,16 @@ static void f2fs_put_super(struct super_block *sb)
119int f2fs_sync_fs(struct super_block *sb, int sync) 131int f2fs_sync_fs(struct super_block *sb, int sync)
120{ 132{
121 struct f2fs_sb_info *sbi = F2FS_SB(sb); 133 struct f2fs_sb_info *sbi = F2FS_SB(sb);
122 int ret = 0;
123 134
124 if (!sbi->s_dirty && !get_pages(sbi, F2FS_DIRTY_NODES)) 135 if (!sbi->s_dirty && !get_pages(sbi, F2FS_DIRTY_NODES))
125 return 0; 136 return 0;
126 137
127 if (sync) 138 if (sync)
128 write_checkpoint(sbi, false, false); 139 write_checkpoint(sbi, false, false);
140 else
141 f2fs_balance_fs(sbi);
129 142
130 return ret; 143 return 0;
131} 144}
132 145
133static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf) 146static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf)
@@ -148,8 +161,8 @@ static int f2fs_statfs(struct dentry *dentry, struct kstatfs *buf)
148 buf->f_bfree = buf->f_blocks - valid_user_blocks(sbi) - ovp_count; 161 buf->f_bfree = buf->f_blocks - valid_user_blocks(sbi) - ovp_count;
149 buf->f_bavail = user_block_count - valid_user_blocks(sbi); 162 buf->f_bavail = user_block_count - valid_user_blocks(sbi);
150 163
151 buf->f_files = valid_inode_count(sbi); 164 buf->f_files = sbi->total_node_count;
152 buf->f_ffree = sbi->total_node_count - valid_node_count(sbi); 165 buf->f_ffree = sbi->total_node_count - valid_inode_count(sbi);
153 166
154 buf->f_namelen = F2FS_MAX_NAME_LEN; 167 buf->f_namelen = F2FS_MAX_NAME_LEN;
155 buf->f_fsid.val[0] = (u32)id; 168 buf->f_fsid.val[0] = (u32)id;
@@ -248,7 +261,8 @@ static const struct export_operations f2fs_export_ops = {
248 .get_parent = f2fs_get_parent, 261 .get_parent = f2fs_get_parent,
249}; 262};
250 263
251static int parse_options(struct f2fs_sb_info *sbi, char *options) 264static int parse_options(struct super_block *sb, struct f2fs_sb_info *sbi,
265 char *options)
252{ 266{
253 substring_t args[MAX_OPT_ARGS]; 267 substring_t args[MAX_OPT_ARGS];
254 char *p; 268 char *p;
@@ -287,7 +301,8 @@ static int parse_options(struct f2fs_sb_info *sbi, char *options)
287 break; 301 break;
288#else 302#else
289 case Opt_nouser_xattr: 303 case Opt_nouser_xattr:
290 pr_info("nouser_xattr options not supported\n"); 304 f2fs_msg(sb, KERN_INFO,
305 "nouser_xattr options not supported");
291 break; 306 break;
292#endif 307#endif
293#ifdef CONFIG_F2FS_FS_POSIX_ACL 308#ifdef CONFIG_F2FS_FS_POSIX_ACL
@@ -296,13 +311,13 @@ static int parse_options(struct f2fs_sb_info *sbi, char *options)
296 break; 311 break;
297#else 312#else
298 case Opt_noacl: 313 case Opt_noacl:
299 pr_info("noacl options not supported\n"); 314 f2fs_msg(sb, KERN_INFO, "noacl options not supported");
300 break; 315 break;
301#endif 316#endif
302 case Opt_active_logs: 317 case Opt_active_logs:
303 if (args->from && match_int(args, &arg)) 318 if (args->from && match_int(args, &arg))
304 return -EINVAL; 319 return -EINVAL;
305 if (arg != 2 && arg != 4 && arg != 6) 320 if (arg != 2 && arg != 4 && arg != NR_CURSEG_TYPE)
306 return -EINVAL; 321 return -EINVAL;
307 sbi->active_logs = arg; 322 sbi->active_logs = arg;
308 break; 323 break;
@@ -310,8 +325,9 @@ static int parse_options(struct f2fs_sb_info *sbi, char *options)
310 set_opt(sbi, DISABLE_EXT_IDENTIFY); 325 set_opt(sbi, DISABLE_EXT_IDENTIFY);
311 break; 326 break;
312 default: 327 default:
313 pr_err("Unrecognized mount option \"%s\" or missing value\n", 328 f2fs_msg(sb, KERN_ERR,
314 p); 329 "Unrecognized mount option \"%s\" or missing value",
330 p);
315 return -EINVAL; 331 return -EINVAL;
316 } 332 }
317 } 333 }
@@ -338,23 +354,36 @@ static loff_t max_file_size(unsigned bits)
338 return result; 354 return result;
339} 355}
340 356
341static int sanity_check_raw_super(struct f2fs_super_block *raw_super) 357static int sanity_check_raw_super(struct super_block *sb,
358 struct f2fs_super_block *raw_super)
342{ 359{
343 unsigned int blocksize; 360 unsigned int blocksize;
344 361
345 if (F2FS_SUPER_MAGIC != le32_to_cpu(raw_super->magic)) 362 if (F2FS_SUPER_MAGIC != le32_to_cpu(raw_super->magic)) {
363 f2fs_msg(sb, KERN_INFO,
364 "Magic Mismatch, valid(0x%x) - read(0x%x)",
365 F2FS_SUPER_MAGIC, le32_to_cpu(raw_super->magic));
346 return 1; 366 return 1;
367 }
347 368
348 /* Currently, support only 4KB block size */ 369 /* Currently, support only 4KB block size */
349 blocksize = 1 << le32_to_cpu(raw_super->log_blocksize); 370 blocksize = 1 << le32_to_cpu(raw_super->log_blocksize);
350 if (blocksize != PAGE_CACHE_SIZE) 371 if (blocksize != PAGE_CACHE_SIZE) {
372 f2fs_msg(sb, KERN_INFO,
373 "Invalid blocksize (%u), supports only 4KB\n",
374 blocksize);
351 return 1; 375 return 1;
376 }
352 if (le32_to_cpu(raw_super->log_sectorsize) != 377 if (le32_to_cpu(raw_super->log_sectorsize) !=
353 F2FS_LOG_SECTOR_SIZE) 378 F2FS_LOG_SECTOR_SIZE) {
379 f2fs_msg(sb, KERN_INFO, "Invalid log sectorsize");
354 return 1; 380 return 1;
381 }
355 if (le32_to_cpu(raw_super->log_sectors_per_block) != 382 if (le32_to_cpu(raw_super->log_sectors_per_block) !=
356 F2FS_LOG_SECTORS_PER_BLOCK) 383 F2FS_LOG_SECTORS_PER_BLOCK) {
384 f2fs_msg(sb, KERN_INFO, "Invalid log sectors per block");
357 return 1; 385 return 1;
386 }
358 return 0; 387 return 0;
359} 388}
360 389
@@ -414,14 +443,17 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
414 if (!sbi) 443 if (!sbi)
415 return -ENOMEM; 444 return -ENOMEM;
416 445
417 /* set a temporary block size */ 446 /* set a block size */
418 if (!sb_set_blocksize(sb, F2FS_BLKSIZE)) 447 if (!sb_set_blocksize(sb, F2FS_BLKSIZE)) {
448 f2fs_msg(sb, KERN_ERR, "unable to set blocksize");
419 goto free_sbi; 449 goto free_sbi;
450 }
420 451
421 /* read f2fs raw super block */ 452 /* read f2fs raw super block */
422 raw_super_buf = sb_bread(sb, 0); 453 raw_super_buf = sb_bread(sb, 0);
423 if (!raw_super_buf) { 454 if (!raw_super_buf) {
424 err = -EIO; 455 err = -EIO;
456 f2fs_msg(sb, KERN_ERR, "unable to read superblock");
425 goto free_sbi; 457 goto free_sbi;
426 } 458 }
427 raw_super = (struct f2fs_super_block *) 459 raw_super = (struct f2fs_super_block *)
@@ -439,12 +471,14 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
439 set_opt(sbi, POSIX_ACL); 471 set_opt(sbi, POSIX_ACL);
440#endif 472#endif
441 /* parse mount options */ 473 /* parse mount options */
442 if (parse_options(sbi, (char *)data)) 474 if (parse_options(sb, sbi, (char *)data))
443 goto free_sb_buf; 475 goto free_sb_buf;
444 476
445 /* sanity checking of raw super */ 477 /* sanity checking of raw super */
446 if (sanity_check_raw_super(raw_super)) 478 if (sanity_check_raw_super(sb, raw_super)) {
479 f2fs_msg(sb, KERN_ERR, "Can't find a valid F2FS filesystem");
447 goto free_sb_buf; 480 goto free_sb_buf;
481 }
448 482
449 sb->s_maxbytes = max_file_size(le32_to_cpu(raw_super->log_blocksize)); 483 sb->s_maxbytes = max_file_size(le32_to_cpu(raw_super->log_blocksize));
450 sb->s_max_links = F2FS_LINK_MAX; 484 sb->s_max_links = F2FS_LINK_MAX;
@@ -478,18 +512,23 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
478 /* get an inode for meta space */ 512 /* get an inode for meta space */
479 sbi->meta_inode = f2fs_iget(sb, F2FS_META_INO(sbi)); 513 sbi->meta_inode = f2fs_iget(sb, F2FS_META_INO(sbi));
480 if (IS_ERR(sbi->meta_inode)) { 514 if (IS_ERR(sbi->meta_inode)) {
515 f2fs_msg(sb, KERN_ERR, "Failed to read F2FS meta data inode");
481 err = PTR_ERR(sbi->meta_inode); 516 err = PTR_ERR(sbi->meta_inode);
482 goto free_sb_buf; 517 goto free_sb_buf;
483 } 518 }
484 519
485 err = get_valid_checkpoint(sbi); 520 err = get_valid_checkpoint(sbi);
486 if (err) 521 if (err) {
522 f2fs_msg(sb, KERN_ERR, "Failed to get valid F2FS checkpoint");
487 goto free_meta_inode; 523 goto free_meta_inode;
524 }
488 525
489 /* sanity checking of checkpoint */ 526 /* sanity checking of checkpoint */
490 err = -EINVAL; 527 err = -EINVAL;
491 if (sanity_check_ckpt(raw_super, sbi->ckpt)) 528 if (sanity_check_ckpt(raw_super, sbi->ckpt)) {
529 f2fs_msg(sb, KERN_ERR, "Invalid F2FS checkpoint");
492 goto free_cp; 530 goto free_cp;
531 }
493 532
494 sbi->total_valid_node_count = 533 sbi->total_valid_node_count =
495 le32_to_cpu(sbi->ckpt->valid_node_count); 534 le32_to_cpu(sbi->ckpt->valid_node_count);
@@ -503,38 +542,41 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
503 INIT_LIST_HEAD(&sbi->dir_inode_list); 542 INIT_LIST_HEAD(&sbi->dir_inode_list);
504 spin_lock_init(&sbi->dir_inode_lock); 543 spin_lock_init(&sbi->dir_inode_lock);
505 544
506 /* init super block */
507 if (!sb_set_blocksize(sb, sbi->blocksize))
508 goto free_cp;
509
510 init_orphan_info(sbi); 545 init_orphan_info(sbi);
511 546
512 /* setup f2fs internal modules */ 547 /* setup f2fs internal modules */
513 err = build_segment_manager(sbi); 548 err = build_segment_manager(sbi);
514 if (err) 549 if (err) {
550 f2fs_msg(sb, KERN_ERR,
551 "Failed to initialize F2FS segment manager");
515 goto free_sm; 552 goto free_sm;
553 }
516 err = build_node_manager(sbi); 554 err = build_node_manager(sbi);
517 if (err) 555 if (err) {
556 f2fs_msg(sb, KERN_ERR,
557 "Failed to initialize F2FS node manager");
518 goto free_nm; 558 goto free_nm;
559 }
519 560
520 build_gc_manager(sbi); 561 build_gc_manager(sbi);
521 562
522 /* get an inode for node space */ 563 /* get an inode for node space */
523 sbi->node_inode = f2fs_iget(sb, F2FS_NODE_INO(sbi)); 564 sbi->node_inode = f2fs_iget(sb, F2FS_NODE_INO(sbi));
524 if (IS_ERR(sbi->node_inode)) { 565 if (IS_ERR(sbi->node_inode)) {
566 f2fs_msg(sb, KERN_ERR, "Failed to read node inode");
525 err = PTR_ERR(sbi->node_inode); 567 err = PTR_ERR(sbi->node_inode);
526 goto free_nm; 568 goto free_nm;
527 } 569 }
528 570
529 /* if there are nt orphan nodes free them */ 571 /* if there are nt orphan nodes free them */
530 err = -EINVAL; 572 err = -EINVAL;
531 if (!is_set_ckpt_flags(F2FS_CKPT(sbi), CP_UMOUNT_FLAG) && 573 if (recover_orphan_inodes(sbi))
532 recover_orphan_inodes(sbi))
533 goto free_node_inode; 574 goto free_node_inode;
534 575
535 /* read root inode and dentry */ 576 /* read root inode and dentry */
536 root = f2fs_iget(sb, F2FS_ROOT_INO(sbi)); 577 root = f2fs_iget(sb, F2FS_ROOT_INO(sbi));
537 if (IS_ERR(root)) { 578 if (IS_ERR(root)) {
579 f2fs_msg(sb, KERN_ERR, "Failed to read root inode");
538 err = PTR_ERR(root); 580 err = PTR_ERR(root);
539 goto free_node_inode; 581 goto free_node_inode;
540 } 582 }
@@ -548,8 +590,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
548 } 590 }
549 591
550 /* recover fsynced data */ 592 /* recover fsynced data */
551 if (!is_set_ckpt_flags(F2FS_CKPT(sbi), CP_UMOUNT_FLAG) && 593 if (!test_opt(sbi, DISABLE_ROLL_FORWARD))
552 !test_opt(sbi, DISABLE_ROLL_FORWARD))
553 recover_fsync_data(sbi); 594 recover_fsync_data(sbi);
554 595
555 /* After POR, we can run background GC thread */ 596 /* After POR, we can run background GC thread */
@@ -599,7 +640,7 @@ static struct file_system_type f2fs_fs_type = {
599 .fs_flags = FS_REQUIRES_DEV, 640 .fs_flags = FS_REQUIRES_DEV,
600}; 641};
601 642
602static int init_inodecache(void) 643static int __init init_inodecache(void)
603{ 644{
604 f2fs_inode_cachep = f2fs_kmem_cache_create("f2fs_inode_cache", 645 f2fs_inode_cachep = f2fs_kmem_cache_create("f2fs_inode_cache",
605 sizeof(struct f2fs_inode_info), NULL); 646 sizeof(struct f2fs_inode_info), NULL);
@@ -634,14 +675,17 @@ static int __init init_f2fs_fs(void)
634 err = create_checkpoint_caches(); 675 err = create_checkpoint_caches();
635 if (err) 676 if (err)
636 goto fail; 677 goto fail;
637 return register_filesystem(&f2fs_fs_type); 678 err = register_filesystem(&f2fs_fs_type);
679 if (err)
680 goto fail;
681 f2fs_create_root_stats();
638fail: 682fail:
639 return err; 683 return err;
640} 684}
641 685
642static void __exit exit_f2fs_fs(void) 686static void __exit exit_f2fs_fs(void)
643{ 687{
644 destroy_root_stats(); 688 f2fs_destroy_root_stats();
645 unregister_filesystem(&f2fs_fs_type); 689 unregister_filesystem(&f2fs_fs_type);
646 destroy_checkpoint_caches(); 690 destroy_checkpoint_caches();
647 destroy_gc_caches(); 691 destroy_gc_caches();
diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
index 7d52e8dc0c59..8038c0496504 100644
--- a/fs/f2fs/xattr.c
+++ b/fs/f2fs/xattr.c
@@ -208,7 +208,7 @@ int f2fs_getxattr(struct inode *inode, int name_index, const char *name,
208 struct page *page; 208 struct page *page;
209 void *base_addr; 209 void *base_addr;
210 int error = 0, found = 0; 210 int error = 0, found = 0;
211 int value_len, name_len; 211 size_t value_len, name_len;
212 212
213 if (name == NULL) 213 if (name == NULL)
214 return -EINVAL; 214 return -EINVAL;
@@ -304,7 +304,8 @@ int f2fs_setxattr(struct inode *inode, int name_index, const char *name,
304 struct f2fs_xattr_entry *here, *last; 304 struct f2fs_xattr_entry *here, *last;
305 struct page *page; 305 struct page *page;
306 void *base_addr; 306 void *base_addr;
307 int error, found, free, name_len, newsize; 307 int error, found, free, newsize;
308 size_t name_len;
308 char *pval; 309 char *pval;
309 310
310 if (name == NULL) 311 if (name == NULL)
@@ -317,6 +318,8 @@ int f2fs_setxattr(struct inode *inode, int name_index, const char *name,
317 if (name_len > 255 || value_len > MAX_VALUE_LEN) 318 if (name_len > 255 || value_len > MAX_VALUE_LEN)
318 return -ERANGE; 319 return -ERANGE;
319 320
321 f2fs_balance_fs(sbi);
322
320 mutex_lock_op(sbi, NODE_NEW); 323 mutex_lock_op(sbi, NODE_NEW);
321 if (!fi->i_xattr_nid) { 324 if (!fi->i_xattr_nid) {
322 /* Allocate new attribute block */ 325 /* Allocate new attribute block */
diff --git a/fs/file.c b/fs/file.c
index 15cb8618e95d..2b3570b7caeb 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -490,7 +490,7 @@ void exit_files(struct task_struct *tsk)
490 } 490 }
491} 491}
492 492
493static void __devinit fdtable_defer_list_init(int cpu) 493static void fdtable_defer_list_init(int cpu)
494{ 494{
495 struct fdtable_defer *fddef = &per_cpu(fdtable_defer_list, cpu); 495 struct fdtable_defer *fddef = &per_cpu(fdtable_defer_list, cpu);
496 spin_lock_init(&fddef->lock); 496 spin_lock_init(&fddef->lock);
diff --git a/fs/fuse/Kconfig b/fs/fuse/Kconfig
index 0cf160a94eda..1b2f6c2c3aaf 100644
--- a/fs/fuse/Kconfig
+++ b/fs/fuse/Kconfig
@@ -4,12 +4,24 @@ config FUSE_FS
4 With FUSE it is possible to implement a fully functional filesystem 4 With FUSE it is possible to implement a fully functional filesystem
5 in a userspace program. 5 in a userspace program.
6 6
7 There's also companion library: libfuse. This library along with 7 There's also a companion library: libfuse2. This library is available
8 utilities is available from the FUSE homepage: 8 from the FUSE homepage:
9 <http://fuse.sourceforge.net/> 9 <http://fuse.sourceforge.net/>
10 although chances are your distribution already has that library
11 installed if you've installed the "fuse" package itself.
10 12
11 See <file:Documentation/filesystems/fuse.txt> for more information. 13 See <file:Documentation/filesystems/fuse.txt> for more information.
12 See <file:Documentation/Changes> for needed library/utility version. 14 See <file:Documentation/Changes> for needed library/utility version.
13 15
14 If you want to develop a userspace FS, or if you want to use 16 If you want to develop a userspace FS, or if you want to use
15 a filesystem based on FUSE, answer Y or M. 17 a filesystem based on FUSE, answer Y or M.
18
19config CUSE
20 tristate "Character device in Userspace support"
21 depends on FUSE_FS
22 help
23 This FUSE extension allows character devices to be
24 implemented in userspace.
25
26 If you want to develop or use a userspace character device
27 based on CUSE, answer Y or M.
diff --git a/fs/fuse/cuse.c b/fs/fuse/cuse.c
index ee8d55042298..e397b675b029 100644
--- a/fs/fuse/cuse.c
+++ b/fs/fuse/cuse.c
@@ -45,7 +45,6 @@
45#include <linux/miscdevice.h> 45#include <linux/miscdevice.h>
46#include <linux/mutex.h> 46#include <linux/mutex.h>
47#include <linux/slab.h> 47#include <linux/slab.h>
48#include <linux/spinlock.h>
49#include <linux/stat.h> 48#include <linux/stat.h>
50#include <linux/module.h> 49#include <linux/module.h>
51 50
@@ -63,7 +62,7 @@ struct cuse_conn {
63 bool unrestricted_ioctl; 62 bool unrestricted_ioctl;
64}; 63};
65 64
66static DEFINE_SPINLOCK(cuse_lock); /* protects cuse_conntbl */ 65static DEFINE_MUTEX(cuse_lock); /* protects registration */
67static struct list_head cuse_conntbl[CUSE_CONNTBL_LEN]; 66static struct list_head cuse_conntbl[CUSE_CONNTBL_LEN];
68static struct class *cuse_class; 67static struct class *cuse_class;
69 68
@@ -114,14 +113,14 @@ static int cuse_open(struct inode *inode, struct file *file)
114 int rc; 113 int rc;
115 114
116 /* look up and get the connection */ 115 /* look up and get the connection */
117 spin_lock(&cuse_lock); 116 mutex_lock(&cuse_lock);
118 list_for_each_entry(pos, cuse_conntbl_head(devt), list) 117 list_for_each_entry(pos, cuse_conntbl_head(devt), list)
119 if (pos->dev->devt == devt) { 118 if (pos->dev->devt == devt) {
120 fuse_conn_get(&pos->fc); 119 fuse_conn_get(&pos->fc);
121 cc = pos; 120 cc = pos;
122 break; 121 break;
123 } 122 }
124 spin_unlock(&cuse_lock); 123 mutex_unlock(&cuse_lock);
125 124
126 /* dead? */ 125 /* dead? */
127 if (!cc) 126 if (!cc)
@@ -267,7 +266,7 @@ static int cuse_parse_one(char **pp, char *end, char **keyp, char **valp)
267static int cuse_parse_devinfo(char *p, size_t len, struct cuse_devinfo *devinfo) 266static int cuse_parse_devinfo(char *p, size_t len, struct cuse_devinfo *devinfo)
268{ 267{
269 char *end = p + len; 268 char *end = p + len;
270 char *key, *val; 269 char *uninitialized_var(key), *uninitialized_var(val);
271 int rc; 270 int rc;
272 271
273 while (true) { 272 while (true) {
@@ -305,14 +304,14 @@ static void cuse_gendev_release(struct device *dev)
305 */ 304 */
306static void cuse_process_init_reply(struct fuse_conn *fc, struct fuse_req *req) 305static void cuse_process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
307{ 306{
308 struct cuse_conn *cc = fc_to_cc(fc); 307 struct cuse_conn *cc = fc_to_cc(fc), *pos;
309 struct cuse_init_out *arg = req->out.args[0].value; 308 struct cuse_init_out *arg = req->out.args[0].value;
310 struct page *page = req->pages[0]; 309 struct page *page = req->pages[0];
311 struct cuse_devinfo devinfo = { }; 310 struct cuse_devinfo devinfo = { };
312 struct device *dev; 311 struct device *dev;
313 struct cdev *cdev; 312 struct cdev *cdev;
314 dev_t devt; 313 dev_t devt;
315 int rc; 314 int rc, i;
316 315
317 if (req->out.h.error || 316 if (req->out.h.error ||
318 arg->major != FUSE_KERNEL_VERSION || arg->minor < 11) { 317 arg->major != FUSE_KERNEL_VERSION || arg->minor < 11) {
@@ -356,15 +355,24 @@ static void cuse_process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
356 dev_set_drvdata(dev, cc); 355 dev_set_drvdata(dev, cc);
357 dev_set_name(dev, "%s", devinfo.name); 356 dev_set_name(dev, "%s", devinfo.name);
358 357
358 mutex_lock(&cuse_lock);
359
360 /* make sure the device-name is unique */
361 for (i = 0; i < CUSE_CONNTBL_LEN; ++i) {
362 list_for_each_entry(pos, &cuse_conntbl[i], list)
363 if (!strcmp(dev_name(pos->dev), dev_name(dev)))
364 goto err_unlock;
365 }
366
359 rc = device_add(dev); 367 rc = device_add(dev);
360 if (rc) 368 if (rc)
361 goto err_device; 369 goto err_unlock;
362 370
363 /* register cdev */ 371 /* register cdev */
364 rc = -ENOMEM; 372 rc = -ENOMEM;
365 cdev = cdev_alloc(); 373 cdev = cdev_alloc();
366 if (!cdev) 374 if (!cdev)
367 goto err_device; 375 goto err_unlock;
368 376
369 cdev->owner = THIS_MODULE; 377 cdev->owner = THIS_MODULE;
370 cdev->ops = &cuse_frontend_fops; 378 cdev->ops = &cuse_frontend_fops;
@@ -377,9 +385,8 @@ static void cuse_process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
377 cc->cdev = cdev; 385 cc->cdev = cdev;
378 386
379 /* make the device available */ 387 /* make the device available */
380 spin_lock(&cuse_lock);
381 list_add(&cc->list, cuse_conntbl_head(devt)); 388 list_add(&cc->list, cuse_conntbl_head(devt));
382 spin_unlock(&cuse_lock); 389 mutex_unlock(&cuse_lock);
383 390
384 /* announce device availability */ 391 /* announce device availability */
385 dev_set_uevent_suppress(dev, 0); 392 dev_set_uevent_suppress(dev, 0);
@@ -391,7 +398,8 @@ out:
391 398
392err_cdev: 399err_cdev:
393 cdev_del(cdev); 400 cdev_del(cdev);
394err_device: 401err_unlock:
402 mutex_unlock(&cuse_lock);
395 put_device(dev); 403 put_device(dev);
396err_region: 404err_region:
397 unregister_chrdev_region(devt, 1); 405 unregister_chrdev_region(devt, 1);
@@ -520,9 +528,9 @@ static int cuse_channel_release(struct inode *inode, struct file *file)
520 int rc; 528 int rc;
521 529
522 /* remove from the conntbl, no more access from this point on */ 530 /* remove from the conntbl, no more access from this point on */
523 spin_lock(&cuse_lock); 531 mutex_lock(&cuse_lock);
524 list_del_init(&cc->list); 532 list_del_init(&cc->list);
525 spin_unlock(&cuse_lock); 533 mutex_unlock(&cuse_lock);
526 534
527 /* remove device */ 535 /* remove device */
528 if (cc->dev) 536 if (cc->dev)
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index c16335315e5d..e83351aa5bad 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -692,8 +692,6 @@ static int fuse_try_move_page(struct fuse_copy_state *cs, struct page **pagep)
692 struct page *oldpage = *pagep; 692 struct page *oldpage = *pagep;
693 struct page *newpage; 693 struct page *newpage;
694 struct pipe_buffer *buf = cs->pipebufs; 694 struct pipe_buffer *buf = cs->pipebufs;
695 struct address_space *mapping;
696 pgoff_t index;
697 695
698 unlock_request(cs->fc, cs->req); 696 unlock_request(cs->fc, cs->req);
699 fuse_copy_finish(cs); 697 fuse_copy_finish(cs);
@@ -724,9 +722,6 @@ static int fuse_try_move_page(struct fuse_copy_state *cs, struct page **pagep)
724 if (fuse_check_page(newpage) != 0) 722 if (fuse_check_page(newpage) != 0)
725 goto out_fallback_unlock; 723 goto out_fallback_unlock;
726 724
727 mapping = oldpage->mapping;
728 index = oldpage->index;
729
730 /* 725 /*
731 * This is a new and locked page, it shouldn't be mapped or 726 * This is a new and locked page, it shouldn't be mapped or
732 * have any special flags on it 727 * have any special flags on it
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index e21d4d8f87e3..f3ab824fa302 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -2177,8 +2177,8 @@ fuse_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
2177 return ret; 2177 return ret;
2178} 2178}
2179 2179
2180long fuse_file_fallocate(struct file *file, int mode, loff_t offset, 2180static long fuse_file_fallocate(struct file *file, int mode, loff_t offset,
2181 loff_t length) 2181 loff_t length)
2182{ 2182{
2183 struct fuse_file *ff = file->private_data; 2183 struct fuse_file *ff = file->private_data;
2184 struct fuse_conn *fc = ff->fc; 2184 struct fuse_conn *fc = ff->fc;
@@ -2213,7 +2213,6 @@ long fuse_file_fallocate(struct file *file, int mode, loff_t offset,
2213 2213
2214 return err; 2214 return err;
2215} 2215}
2216EXPORT_SYMBOL_GPL(fuse_file_fallocate);
2217 2216
2218static const struct file_operations fuse_file_operations = { 2217static const struct file_operations fuse_file_operations = {
2219 .llseek = fuse_file_llseek, 2218 .llseek = fuse_file_llseek,
diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c
index 8dad6b093716..9802de0f85e6 100644
--- a/fs/gfs2/lock_dlm.c
+++ b/fs/gfs2/lock_dlm.c
@@ -241,6 +241,7 @@ static u32 make_flags(struct gfs2_glock *gl, const unsigned int gfs_flags,
241 241
242static void gfs2_reverse_hex(char *c, u64 value) 242static void gfs2_reverse_hex(char *c, u64 value)
243{ 243{
244 *c = '0';
244 while (value) { 245 while (value) {
245 *c-- = hex_asc[value & 0x0f]; 246 *c-- = hex_asc[value & 0x0f];
246 value >>= 4; 247 value >>= 4;
@@ -280,6 +281,7 @@ static void gdlm_put_lock(struct gfs2_glock *gl)
280{ 281{
281 struct gfs2_sbd *sdp = gl->gl_sbd; 282 struct gfs2_sbd *sdp = gl->gl_sbd;
282 struct lm_lockstruct *ls = &sdp->sd_lockstruct; 283 struct lm_lockstruct *ls = &sdp->sd_lockstruct;
284 int lvb_needs_unlock = 0;
283 int error; 285 int error;
284 286
285 if (gl->gl_lksb.sb_lkid == 0) { 287 if (gl->gl_lksb.sb_lkid == 0) {
@@ -293,8 +295,12 @@ static void gdlm_put_lock(struct gfs2_glock *gl)
293 gfs2_update_request_times(gl); 295 gfs2_update_request_times(gl);
294 296
295 /* don't want to skip dlm_unlock writing the lvb when lock is ex */ 297 /* don't want to skip dlm_unlock writing the lvb when lock is ex */
298
299 if (gl->gl_lksb.sb_lvbptr && (gl->gl_state == LM_ST_EXCLUSIVE))
300 lvb_needs_unlock = 1;
301
296 if (test_bit(SDF_SKIP_DLM_UNLOCK, &sdp->sd_flags) && 302 if (test_bit(SDF_SKIP_DLM_UNLOCK, &sdp->sd_flags) &&
297 gl->gl_lksb.sb_lvbptr && (gl->gl_state != LM_ST_EXCLUSIVE)) { 303 !lvb_needs_unlock) {
298 gfs2_glock_free(gl); 304 gfs2_glock_free(gl);
299 return; 305 return;
300 } 306 }
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 37ee061d899e..b7eff078fe90 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -350,10 +350,14 @@ static u32 gfs2_free_extlen(const struct gfs2_rbm *rrbm, u32 len)
350 BUG_ON(len < chunk_size); 350 BUG_ON(len < chunk_size);
351 len -= chunk_size; 351 len -= chunk_size;
352 block = gfs2_rbm_to_block(&rbm); 352 block = gfs2_rbm_to_block(&rbm);
353 gfs2_rbm_from_block(&rbm, block + chunk_size); 353 if (gfs2_rbm_from_block(&rbm, block + chunk_size)) {
354 n_unaligned = 3; 354 n_unaligned = 0;
355 if (ptr)
356 break; 355 break;
356 }
357 if (ptr) {
358 n_unaligned = 3;
359 break;
360 }
357 n_unaligned = len & 3; 361 n_unaligned = len & 3;
358 } 362 }
359 363
@@ -557,22 +561,20 @@ void gfs2_free_clones(struct gfs2_rgrpd *rgd)
557 */ 561 */
558int gfs2_rs_alloc(struct gfs2_inode *ip) 562int gfs2_rs_alloc(struct gfs2_inode *ip)
559{ 563{
560 struct gfs2_blkreserv *res; 564 int error = 0;
561 565
566 down_write(&ip->i_rw_mutex);
562 if (ip->i_res) 567 if (ip->i_res)
563 return 0; 568 goto out;
564
565 res = kmem_cache_zalloc(gfs2_rsrv_cachep, GFP_NOFS);
566 if (!res)
567 return -ENOMEM;
568 569
569 RB_CLEAR_NODE(&res->rs_node); 570 ip->i_res = kmem_cache_zalloc(gfs2_rsrv_cachep, GFP_NOFS);
571 if (!ip->i_res) {
572 error = -ENOMEM;
573 goto out;
574 }
570 575
571 down_write(&ip->i_rw_mutex); 576 RB_CLEAR_NODE(&ip->i_res->rs_node);
572 if (ip->i_res) 577out:
573 kmem_cache_free(gfs2_rsrv_cachep, res);
574 else
575 ip->i_res = res;
576 up_write(&ip->i_rw_mutex); 578 up_write(&ip->i_rw_mutex);
577 return 0; 579 return 0;
578} 580}
@@ -1424,6 +1426,9 @@ static void rg_mblk_search(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip,
1424 rs->rs_free = extlen; 1426 rs->rs_free = extlen;
1425 rs->rs_inum = ip->i_no_addr; 1427 rs->rs_inum = ip->i_no_addr;
1426 rs_insert(ip); 1428 rs_insert(ip);
1429 } else {
1430 if (goal == rgd->rd_last_alloc + rgd->rd_data0)
1431 rgd->rd_last_alloc = 0;
1427 } 1432 }
1428} 1433}
1429 1434
diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
index a2862339323b..81cc7eaff863 100644
--- a/fs/jbd/journal.c
+++ b/fs/jbd/journal.c
@@ -446,7 +446,8 @@ int __log_start_commit(journal_t *journal, tid_t target)
446 * currently running transaction (if it exists). Otherwise, 446 * currently running transaction (if it exists). Otherwise,
447 * the target tid must be an old one. 447 * the target tid must be an old one.
448 */ 448 */
449 if (journal->j_running_transaction && 449 if (journal->j_commit_request != target &&
450 journal->j_running_transaction &&
450 journal->j_running_transaction->t_tid == target) { 451 journal->j_running_transaction->t_tid == target) {
451 /* 452 /*
452 * We want a new commit: OK, mark the request and wakeup the 453 * We want a new commit: OK, mark the request and wakeup the
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index 42f6615af0ac..df9f29760efa 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -209,7 +209,8 @@ repeat:
209 if (!new_transaction) 209 if (!new_transaction)
210 goto alloc_transaction; 210 goto alloc_transaction;
211 write_lock(&journal->j_state_lock); 211 write_lock(&journal->j_state_lock);
212 if (!journal->j_running_transaction) { 212 if (!journal->j_running_transaction &&
213 !journal->j_barrier_count) {
213 jbd2_get_transaction(journal, new_transaction); 214 jbd2_get_transaction(journal, new_transaction);
214 new_transaction = NULL; 215 new_transaction = NULL;
215 } 216 }
@@ -1839,7 +1840,6 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh,
1839 1840
1840 BUFFER_TRACE(bh, "entry"); 1841 BUFFER_TRACE(bh, "entry");
1841 1842
1842retry:
1843 /* 1843 /*
1844 * It is safe to proceed here without the j_list_lock because the 1844 * It is safe to proceed here without the j_list_lock because the
1845 * buffers cannot be stolen by try_to_free_buffers as long as we are 1845 * buffers cannot be stolen by try_to_free_buffers as long as we are
@@ -1934,14 +1934,11 @@ retry:
1934 * for commit and try again. 1934 * for commit and try again.
1935 */ 1935 */
1936 if (partial_page) { 1936 if (partial_page) {
1937 tid_t tid = journal->j_committing_transaction->t_tid;
1938
1939 jbd2_journal_put_journal_head(jh); 1937 jbd2_journal_put_journal_head(jh);
1940 spin_unlock(&journal->j_list_lock); 1938 spin_unlock(&journal->j_list_lock);
1941 jbd_unlock_bh_state(bh); 1939 jbd_unlock_bh_state(bh);
1942 write_unlock(&journal->j_state_lock); 1940 write_unlock(&journal->j_state_lock);
1943 jbd2_log_wait_commit(journal, tid); 1941 return -EBUSY;
1944 goto retry;
1945 } 1942 }
1946 /* 1943 /*
1947 * OK, buffer won't be reachable after truncate. We just set 1944 * OK, buffer won't be reachable after truncate. We just set
@@ -2002,21 +1999,23 @@ zap_buffer_unlocked:
2002 * @page: page to flush 1999 * @page: page to flush
2003 * @offset: length of page to invalidate. 2000 * @offset: length of page to invalidate.
2004 * 2001 *
2005 * Reap page buffers containing data after offset in page. 2002 * Reap page buffers containing data after offset in page. Can return -EBUSY
2006 * 2003 * if buffers are part of the committing transaction and the page is straddling
2004 * i_size. Caller then has to wait for current commit and try again.
2007 */ 2005 */
2008void jbd2_journal_invalidatepage(journal_t *journal, 2006int jbd2_journal_invalidatepage(journal_t *journal,
2009 struct page *page, 2007 struct page *page,
2010 unsigned long offset) 2008 unsigned long offset)
2011{ 2009{
2012 struct buffer_head *head, *bh, *next; 2010 struct buffer_head *head, *bh, *next;
2013 unsigned int curr_off = 0; 2011 unsigned int curr_off = 0;
2014 int may_free = 1; 2012 int may_free = 1;
2013 int ret = 0;
2015 2014
2016 if (!PageLocked(page)) 2015 if (!PageLocked(page))
2017 BUG(); 2016 BUG();
2018 if (!page_has_buffers(page)) 2017 if (!page_has_buffers(page))
2019 return; 2018 return 0;
2020 2019
2021 /* We will potentially be playing with lists other than just the 2020 /* We will potentially be playing with lists other than just the
2022 * data lists (especially for journaled data mode), so be 2021 * data lists (especially for journaled data mode), so be
@@ -2030,9 +2029,11 @@ void jbd2_journal_invalidatepage(journal_t *journal,
2030 if (offset <= curr_off) { 2029 if (offset <= curr_off) {
2031 /* This block is wholly outside the truncation point */ 2030 /* This block is wholly outside the truncation point */
2032 lock_buffer(bh); 2031 lock_buffer(bh);
2033 may_free &= journal_unmap_buffer(journal, bh, 2032 ret = journal_unmap_buffer(journal, bh, offset > 0);
2034 offset > 0);
2035 unlock_buffer(bh); 2033 unlock_buffer(bh);
2034 if (ret < 0)
2035 return ret;
2036 may_free &= ret;
2036 } 2037 }
2037 curr_off = next_off; 2038 curr_off = next_off;
2038 bh = next; 2039 bh = next;
@@ -2043,6 +2044,7 @@ void jbd2_journal_invalidatepage(journal_t *journal,
2043 if (may_free && try_to_free_buffers(page)) 2044 if (may_free && try_to_free_buffers(page))
2044 J_ASSERT(!page_has_buffers(page)); 2045 J_ASSERT(!page_has_buffers(page));
2045 } 2046 }
2047 return 0;
2046} 2048}
2047 2049
2048/* 2050/*
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
index c89b26bc9759..264d1aa935f2 100644
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -206,7 +206,7 @@ static u32 initiate_bulk_draining(struct nfs_client *clp,
206 206
207 list_for_each_entry(lo, &server->layouts, plh_layouts) { 207 list_for_each_entry(lo, &server->layouts, plh_layouts) {
208 ino = igrab(lo->plh_inode); 208 ino = igrab(lo->plh_inode);
209 if (ino) 209 if (!ino)
210 continue; 210 continue;
211 spin_lock(&ino->i_lock); 211 spin_lock(&ino->i_lock);
212 /* Is this layout in the process of being freed? */ 212 /* Is this layout in the process of being freed? */
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 32e6c53520e2..1b2d7eb93796 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -2153,12 +2153,16 @@ static int nfs_open_permission_mask(int openflags)
2153{ 2153{
2154 int mask = 0; 2154 int mask = 0;
2155 2155
2156 if ((openflags & O_ACCMODE) != O_WRONLY) 2156 if (openflags & __FMODE_EXEC) {
2157 mask |= MAY_READ; 2157 /* ONLY check exec rights */
2158 if ((openflags & O_ACCMODE) != O_RDONLY) 2158 mask = MAY_EXEC;
2159 mask |= MAY_WRITE; 2159 } else {
2160 if (openflags & __FMODE_EXEC) 2160 if ((openflags & O_ACCMODE) != O_WRONLY)
2161 mask |= MAY_EXEC; 2161 mask |= MAY_READ;
2162 if ((openflags & O_ACCMODE) != O_RDONLY)
2163 mask |= MAY_WRITE;
2164 }
2165
2162 return mask; 2166 return mask;
2163} 2167}
2164 2168
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c
index dd057bc6b65b..fc8dc20fdeb9 100644
--- a/fs/nfs/namespace.c
+++ b/fs/nfs/namespace.c
@@ -177,11 +177,31 @@ out_nofree:
177 return mnt; 177 return mnt;
178} 178}
179 179
180static int
181nfs_namespace_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
182{
183 if (NFS_FH(dentry->d_inode)->size != 0)
184 return nfs_getattr(mnt, dentry, stat);
185 generic_fillattr(dentry->d_inode, stat);
186 return 0;
187}
188
189static int
190nfs_namespace_setattr(struct dentry *dentry, struct iattr *attr)
191{
192 if (NFS_FH(dentry->d_inode)->size != 0)
193 return nfs_setattr(dentry, attr);
194 return -EACCES;
195}
196
180const struct inode_operations nfs_mountpoint_inode_operations = { 197const struct inode_operations nfs_mountpoint_inode_operations = {
181 .getattr = nfs_getattr, 198 .getattr = nfs_getattr,
199 .setattr = nfs_setattr,
182}; 200};
183 201
184const struct inode_operations nfs_referral_inode_operations = { 202const struct inode_operations nfs_referral_inode_operations = {
203 .getattr = nfs_namespace_getattr,
204 .setattr = nfs_namespace_setattr,
185}; 205};
186 206
187static void nfs_expire_automounts(struct work_struct *work) 207static void nfs_expire_automounts(struct work_struct *work)
diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
index acc347268124..2e9779b58b7a 100644
--- a/fs/nfs/nfs4client.c
+++ b/fs/nfs/nfs4client.c
@@ -236,11 +236,10 @@ struct nfs_client *nfs4_init_client(struct nfs_client *clp,
236 error = nfs4_discover_server_trunking(clp, &old); 236 error = nfs4_discover_server_trunking(clp, &old);
237 if (error < 0) 237 if (error < 0)
238 goto error; 238 goto error;
239 nfs_put_client(clp);
239 if (clp != old) { 240 if (clp != old) {
240 clp->cl_preserve_clid = true; 241 clp->cl_preserve_clid = true;
241 nfs_put_client(clp);
242 clp = old; 242 clp = old;
243 atomic_inc(&clp->cl_count);
244 } 243 }
245 244
246 return clp; 245 return clp;
@@ -306,7 +305,7 @@ int nfs40_walk_client_list(struct nfs_client *new,
306 .clientid = new->cl_clientid, 305 .clientid = new->cl_clientid,
307 .confirm = new->cl_confirm, 306 .confirm = new->cl_confirm,
308 }; 307 };
309 int status; 308 int status = -NFS4ERR_STALE_CLIENTID;
310 309
311 spin_lock(&nn->nfs_client_lock); 310 spin_lock(&nn->nfs_client_lock);
312 list_for_each_entry_safe(pos, n, &nn->nfs_client_list, cl_share_link) { 311 list_for_each_entry_safe(pos, n, &nn->nfs_client_list, cl_share_link) {
@@ -332,40 +331,33 @@ int nfs40_walk_client_list(struct nfs_client *new,
332 331
333 if (prev) 332 if (prev)
334 nfs_put_client(prev); 333 nfs_put_client(prev);
334 prev = pos;
335 335
336 status = nfs4_proc_setclientid_confirm(pos, &clid, cred); 336 status = nfs4_proc_setclientid_confirm(pos, &clid, cred);
337 if (status == 0) { 337 switch (status) {
338 case -NFS4ERR_STALE_CLIENTID:
339 break;
340 case 0:
338 nfs4_swap_callback_idents(pos, new); 341 nfs4_swap_callback_idents(pos, new);
339 342
340 nfs_put_client(pos); 343 prev = NULL;
341 *result = pos; 344 *result = pos;
342 dprintk("NFS: <-- %s using nfs_client = %p ({%d})\n", 345 dprintk("NFS: <-- %s using nfs_client = %p ({%d})\n",
343 __func__, pos, atomic_read(&pos->cl_count)); 346 __func__, pos, atomic_read(&pos->cl_count));
344 return 0; 347 default:
345 } 348 goto out;
346 if (status != -NFS4ERR_STALE_CLIENTID) {
347 nfs_put_client(pos);
348 dprintk("NFS: <-- %s status = %d, no result\n",
349 __func__, status);
350 return status;
351 } 349 }
352 350
353 spin_lock(&nn->nfs_client_lock); 351 spin_lock(&nn->nfs_client_lock);
354 prev = pos;
355 } 352 }
353 spin_unlock(&nn->nfs_client_lock);
356 354
357 /* 355 /* No match found. The server lost our clientid */
358 * No matching nfs_client found. This should be impossible, 356out:
359 * because the new nfs_client has already been added to
360 * nfs_client_list by nfs_get_client().
361 *
362 * Don't BUG(), since the caller is holding a mutex.
363 */
364 if (prev) 357 if (prev)
365 nfs_put_client(prev); 358 nfs_put_client(prev);
366 spin_unlock(&nn->nfs_client_lock); 359 dprintk("NFS: <-- %s status = %d\n", __func__, status);
367 pr_err("NFS: %s Error: no matching nfs_client found\n", __func__); 360 return status;
368 return -NFS4ERR_STALE_CLIENTID;
369} 361}
370 362
371#ifdef CONFIG_NFS_V4_1 363#ifdef CONFIG_NFS_V4_1
@@ -432,7 +424,7 @@ int nfs41_walk_client_list(struct nfs_client *new,
432{ 424{
433 struct nfs_net *nn = net_generic(new->cl_net, nfs_net_id); 425 struct nfs_net *nn = net_generic(new->cl_net, nfs_net_id);
434 struct nfs_client *pos, *n, *prev = NULL; 426 struct nfs_client *pos, *n, *prev = NULL;
435 int error; 427 int status = -NFS4ERR_STALE_CLIENTID;
436 428
437 spin_lock(&nn->nfs_client_lock); 429 spin_lock(&nn->nfs_client_lock);
438 list_for_each_entry_safe(pos, n, &nn->nfs_client_list, cl_share_link) { 430 list_for_each_entry_safe(pos, n, &nn->nfs_client_list, cl_share_link) {
@@ -448,14 +440,17 @@ int nfs41_walk_client_list(struct nfs_client *new,
448 nfs_put_client(prev); 440 nfs_put_client(prev);
449 prev = pos; 441 prev = pos;
450 442
451 error = nfs_wait_client_init_complete(pos); 443 nfs4_schedule_lease_recovery(pos);
452 if (error < 0) { 444 status = nfs_wait_client_init_complete(pos);
445 if (status < 0) {
453 nfs_put_client(pos); 446 nfs_put_client(pos);
454 spin_lock(&nn->nfs_client_lock); 447 spin_lock(&nn->nfs_client_lock);
455 continue; 448 continue;
456 } 449 }
457 450 status = pos->cl_cons_state;
458 spin_lock(&nn->nfs_client_lock); 451 spin_lock(&nn->nfs_client_lock);
452 if (status < 0)
453 continue;
459 } 454 }
460 455
461 if (pos->rpc_ops != new->rpc_ops) 456 if (pos->rpc_ops != new->rpc_ops)
@@ -473,6 +468,7 @@ int nfs41_walk_client_list(struct nfs_client *new,
473 if (!nfs4_match_serverowners(pos, new)) 468 if (!nfs4_match_serverowners(pos, new))
474 continue; 469 continue;
475 470
471 atomic_inc(&pos->cl_count);
476 spin_unlock(&nn->nfs_client_lock); 472 spin_unlock(&nn->nfs_client_lock);
477 dprintk("NFS: <-- %s using nfs_client = %p ({%d})\n", 473 dprintk("NFS: <-- %s using nfs_client = %p ({%d})\n",
478 __func__, pos, atomic_read(&pos->cl_count)); 474 __func__, pos, atomic_read(&pos->cl_count));
@@ -481,16 +477,10 @@ int nfs41_walk_client_list(struct nfs_client *new,
481 return 0; 477 return 0;
482 } 478 }
483 479
484 /* 480 /* No matching nfs_client found. */
485 * No matching nfs_client found. This should be impossible,
486 * because the new nfs_client has already been added to
487 * nfs_client_list by nfs_get_client().
488 *
489 * Don't BUG(), since the caller is holding a mutex.
490 */
491 spin_unlock(&nn->nfs_client_lock); 481 spin_unlock(&nn->nfs_client_lock);
492 pr_err("NFS: %s Error: no matching nfs_client found\n", __func__); 482 dprintk("NFS: <-- %s status = %d\n", __func__, status);
493 return -NFS4ERR_STALE_CLIENTID; 483 return status;
494} 484}
495#endif /* CONFIG_NFS_V4_1 */ 485#endif /* CONFIG_NFS_V4_1 */
496 486
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 5d864fb36578..cf747ef86650 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1626,7 +1626,8 @@ static int _nfs4_recover_proc_open(struct nfs4_opendata *data)
1626 1626
1627static int nfs4_opendata_access(struct rpc_cred *cred, 1627static int nfs4_opendata_access(struct rpc_cred *cred,
1628 struct nfs4_opendata *opendata, 1628 struct nfs4_opendata *opendata,
1629 struct nfs4_state *state, fmode_t fmode) 1629 struct nfs4_state *state, fmode_t fmode,
1630 int openflags)
1630{ 1631{
1631 struct nfs_access_entry cache; 1632 struct nfs_access_entry cache;
1632 u32 mask; 1633 u32 mask;
@@ -1638,11 +1639,14 @@ static int nfs4_opendata_access(struct rpc_cred *cred,
1638 1639
1639 mask = 0; 1640 mask = 0;
1640 /* don't check MAY_WRITE - a newly created file may not have 1641 /* don't check MAY_WRITE - a newly created file may not have
1641 * write mode bits, but POSIX allows the creating process to write */ 1642 * write mode bits, but POSIX allows the creating process to write.
1642 if (fmode & FMODE_READ) 1643 * use openflags to check for exec, because fmode won't
1643 mask |= MAY_READ; 1644 * always have FMODE_EXEC set when file open for exec. */
1644 if (fmode & FMODE_EXEC) 1645 if (openflags & __FMODE_EXEC) {
1645 mask |= MAY_EXEC; 1646 /* ONLY check for exec rights */
1647 mask = MAY_EXEC;
1648 } else if (fmode & FMODE_READ)
1649 mask = MAY_READ;
1646 1650
1647 cache.cred = cred; 1651 cache.cred = cred;
1648 cache.jiffies = jiffies; 1652 cache.jiffies = jiffies;
@@ -1896,7 +1900,7 @@ static int _nfs4_do_open(struct inode *dir,
1896 if (server->caps & NFS_CAP_POSIX_LOCK) 1900 if (server->caps & NFS_CAP_POSIX_LOCK)
1897 set_bit(NFS_STATE_POSIX_LOCKS, &state->flags); 1901 set_bit(NFS_STATE_POSIX_LOCKS, &state->flags);
1898 1902
1899 status = nfs4_opendata_access(cred, opendata, state, fmode); 1903 status = nfs4_opendata_access(cred, opendata, state, fmode, flags);
1900 if (status != 0) 1904 if (status != 0)
1901 goto err_opendata_put; 1905 goto err_opendata_put;
1902 1906
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 9448c579d41a..e61f68d5ef21 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -136,16 +136,11 @@ int nfs40_discover_server_trunking(struct nfs_client *clp,
136 clp->cl_confirm = clid.confirm; 136 clp->cl_confirm = clid.confirm;
137 137
138 status = nfs40_walk_client_list(clp, result, cred); 138 status = nfs40_walk_client_list(clp, result, cred);
139 switch (status) { 139 if (status == 0) {
140 case -NFS4ERR_STALE_CLIENTID:
141 set_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);
142 case 0:
143 /* Sustain the lease, even if it's empty. If the clientid4 140 /* Sustain the lease, even if it's empty. If the clientid4
144 * goes stale it's of no use for trunking discovery. */ 141 * goes stale it's of no use for trunking discovery. */
145 nfs4_schedule_state_renewal(*result); 142 nfs4_schedule_state_renewal(*result);
146 break;
147 } 143 }
148
149out: 144out:
150 return status; 145 return status;
151} 146}
@@ -1863,6 +1858,7 @@ again:
1863 case -ETIMEDOUT: 1858 case -ETIMEDOUT:
1864 case -EAGAIN: 1859 case -EAGAIN:
1865 ssleep(1); 1860 ssleep(1);
1861 case -NFS4ERR_STALE_CLIENTID:
1866 dprintk("NFS: %s after status %d, retrying\n", 1862 dprintk("NFS: %s after status %d, retrying\n",
1867 __func__, status); 1863 __func__, status);
1868 goto again; 1864 goto again;
@@ -2022,8 +2018,18 @@ static int nfs4_reset_session(struct nfs_client *clp)
2022 nfs4_begin_drain_session(clp); 2018 nfs4_begin_drain_session(clp);
2023 cred = nfs4_get_exchange_id_cred(clp); 2019 cred = nfs4_get_exchange_id_cred(clp);
2024 status = nfs4_proc_destroy_session(clp->cl_session, cred); 2020 status = nfs4_proc_destroy_session(clp->cl_session, cred);
2025 if (status && status != -NFS4ERR_BADSESSION && 2021 switch (status) {
2026 status != -NFS4ERR_DEADSESSION) { 2022 case 0:
2023 case -NFS4ERR_BADSESSION:
2024 case -NFS4ERR_DEADSESSION:
2025 break;
2026 case -NFS4ERR_BACK_CHAN_BUSY:
2027 case -NFS4ERR_DELAY:
2028 set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state);
2029 status = 0;
2030 ssleep(1);
2031 goto out;
2032 default:
2027 status = nfs4_recovery_handle_error(clp, status); 2033 status = nfs4_recovery_handle_error(clp, status);
2028 goto out; 2034 goto out;
2029 } 2035 }
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index e7165d915362..d00260b08103 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -254,7 +254,7 @@ static void
254pnfs_layout_set_fail_bit(struct pnfs_layout_hdr *lo, int fail_bit) 254pnfs_layout_set_fail_bit(struct pnfs_layout_hdr *lo, int fail_bit)
255{ 255{
256 lo->plh_retry_timestamp = jiffies; 256 lo->plh_retry_timestamp = jiffies;
257 if (test_and_set_bit(fail_bit, &lo->plh_flags)) 257 if (!test_and_set_bit(fail_bit, &lo->plh_flags))
258 atomic_inc(&lo->plh_refcount); 258 atomic_inc(&lo->plh_refcount);
259} 259}
260 260
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index b6bdb18e892c..a5e5d9899d56 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -91,12 +91,16 @@ void nfs_readdata_release(struct nfs_read_data *rdata)
91 put_nfs_open_context(rdata->args.context); 91 put_nfs_open_context(rdata->args.context);
92 if (rdata->pages.pagevec != rdata->pages.page_array) 92 if (rdata->pages.pagevec != rdata->pages.page_array)
93 kfree(rdata->pages.pagevec); 93 kfree(rdata->pages.pagevec);
94 if (rdata != &read_header->rpc_data) 94 if (rdata == &read_header->rpc_data) {
95 kfree(rdata);
96 else
97 rdata->header = NULL; 95 rdata->header = NULL;
96 rdata = NULL;
97 }
98 if (atomic_dec_and_test(&hdr->refcnt)) 98 if (atomic_dec_and_test(&hdr->refcnt))
99 hdr->completion_ops->completion(hdr); 99 hdr->completion_ops->completion(hdr);
100 /* Note: we only free the rpc_task after callbacks are done.
101 * See the comment in rpc_free_task() for why
102 */
103 kfree(rdata);
100} 104}
101EXPORT_SYMBOL_GPL(nfs_readdata_release); 105EXPORT_SYMBOL_GPL(nfs_readdata_release);
102 106
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index c25cadf8f8c4..b056b1628722 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1152,7 +1152,7 @@ static int nfs_get_option_str(substring_t args[], char **option)
1152{ 1152{
1153 kfree(*option); 1153 kfree(*option);
1154 *option = match_strdup(args); 1154 *option = match_strdup(args);
1155 return !option; 1155 return !*option;
1156} 1156}
1157 1157
1158static int nfs_get_option_ul(substring_t args[], unsigned long *option) 1158static int nfs_get_option_ul(substring_t args[], unsigned long *option)
@@ -2589,27 +2589,23 @@ nfs_xdev_mount(struct file_system_type *fs_type, int flags,
2589 struct nfs_server *server; 2589 struct nfs_server *server;
2590 struct dentry *mntroot = ERR_PTR(-ENOMEM); 2590 struct dentry *mntroot = ERR_PTR(-ENOMEM);
2591 struct nfs_subversion *nfs_mod = NFS_SB(data->sb)->nfs_client->cl_nfs_mod; 2591 struct nfs_subversion *nfs_mod = NFS_SB(data->sb)->nfs_client->cl_nfs_mod;
2592 int error;
2593 2592
2594 dprintk("--> nfs_xdev_mount_common()\n"); 2593 dprintk("--> nfs_xdev_mount()\n");
2595 2594
2596 mount_info.mntfh = mount_info.cloned->fh; 2595 mount_info.mntfh = mount_info.cloned->fh;
2597 2596
2598 /* create a new volume representation */ 2597 /* create a new volume representation */
2599 server = nfs_mod->rpc_ops->clone_server(NFS_SB(data->sb), data->fh, data->fattr, data->authflavor); 2598 server = nfs_mod->rpc_ops->clone_server(NFS_SB(data->sb), data->fh, data->fattr, data->authflavor);
2600 if (IS_ERR(server)) {
2601 error = PTR_ERR(server);
2602 goto out_err;
2603 }
2604 2599
2605 mntroot = nfs_fs_mount_common(server, flags, dev_name, &mount_info, nfs_mod); 2600 if (IS_ERR(server))
2606 dprintk("<-- nfs_xdev_mount_common() = 0\n"); 2601 mntroot = ERR_CAST(server);
2607out: 2602 else
2608 return mntroot; 2603 mntroot = nfs_fs_mount_common(server, flags,
2604 dev_name, &mount_info, nfs_mod);
2609 2605
2610out_err: 2606 dprintk("<-- nfs_xdev_mount() = %ld\n",
2611 dprintk("<-- nfs_xdev_mount_common() = %d [error]\n", error); 2607 IS_ERR(mntroot) ? PTR_ERR(mntroot) : 0L);
2612 goto out; 2608 return mntroot;
2613} 2609}
2614 2610
2615#if IS_ENABLED(CONFIG_NFS_V4) 2611#if IS_ENABLED(CONFIG_NFS_V4)
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index b673be31590e..c483cc50b82e 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -126,12 +126,16 @@ void nfs_writedata_release(struct nfs_write_data *wdata)
126 put_nfs_open_context(wdata->args.context); 126 put_nfs_open_context(wdata->args.context);
127 if (wdata->pages.pagevec != wdata->pages.page_array) 127 if (wdata->pages.pagevec != wdata->pages.page_array)
128 kfree(wdata->pages.pagevec); 128 kfree(wdata->pages.pagevec);
129 if (wdata != &write_header->rpc_data) 129 if (wdata == &write_header->rpc_data) {
130 kfree(wdata);
131 else
132 wdata->header = NULL; 130 wdata->header = NULL;
131 wdata = NULL;
132 }
133 if (atomic_dec_and_test(&hdr->refcnt)) 133 if (atomic_dec_and_test(&hdr->refcnt))
134 hdr->completion_ops->completion(hdr); 134 hdr->completion_ops->completion(hdr);
135 /* Note: we only free the rpc_task after callbacks are done.
136 * See the comment in rpc_free_task() for why
137 */
138 kfree(wdata);
135} 139}
136EXPORT_SYMBOL_GPL(nfs_writedata_release); 140EXPORT_SYMBOL_GPL(nfs_writedata_release);
137 141
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index e064f562b1f7..76ddae83daa5 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -352,18 +352,18 @@ retry:
352 if (!ida_pre_get(&proc_inum_ida, GFP_KERNEL)) 352 if (!ida_pre_get(&proc_inum_ida, GFP_KERNEL))
353 return -ENOMEM; 353 return -ENOMEM;
354 354
355 spin_lock_bh(&proc_inum_lock); 355 spin_lock_irq(&proc_inum_lock);
356 error = ida_get_new(&proc_inum_ida, &i); 356 error = ida_get_new(&proc_inum_ida, &i);
357 spin_unlock_bh(&proc_inum_lock); 357 spin_unlock_irq(&proc_inum_lock);
358 if (error == -EAGAIN) 358 if (error == -EAGAIN)
359 goto retry; 359 goto retry;
360 else if (error) 360 else if (error)
361 return error; 361 return error;
362 362
363 if (i > UINT_MAX - PROC_DYNAMIC_FIRST) { 363 if (i > UINT_MAX - PROC_DYNAMIC_FIRST) {
364 spin_lock_bh(&proc_inum_lock); 364 spin_lock_irq(&proc_inum_lock);
365 ida_remove(&proc_inum_ida, i); 365 ida_remove(&proc_inum_ida, i);
366 spin_unlock_bh(&proc_inum_lock); 366 spin_unlock_irq(&proc_inum_lock);
367 return -ENOSPC; 367 return -ENOSPC;
368 } 368 }
369 *inum = PROC_DYNAMIC_FIRST + i; 369 *inum = PROC_DYNAMIC_FIRST + i;
@@ -372,9 +372,10 @@ retry:
372 372
373void proc_free_inum(unsigned int inum) 373void proc_free_inum(unsigned int inum)
374{ 374{
375 spin_lock_bh(&proc_inum_lock); 375 unsigned long flags;
376 spin_lock_irqsave(&proc_inum_lock, flags);
376 ida_remove(&proc_inum_ida, inum - PROC_DYNAMIC_FIRST); 377 ida_remove(&proc_inum_ida, inum - PROC_DYNAMIC_FIRST);
377 spin_unlock_bh(&proc_inum_lock); 378 spin_unlock_irqrestore(&proc_inum_lock, flags);
378} 379}
379 380
380static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd) 381static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd)
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 448455b7fd91..ca5ce7f9f800 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -1278,7 +1278,7 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid)
1278 walk.mm = mm; 1278 walk.mm = mm;
1279 1279
1280 pol = get_vma_policy(task, vma, vma->vm_start); 1280 pol = get_vma_policy(task, vma, vma->vm_start);
1281 mpol_to_str(buffer, sizeof(buffer), pol, 0); 1281 mpol_to_str(buffer, sizeof(buffer), pol);
1282 mpol_cond_put(pol); 1282 mpol_cond_put(pol);
1283 1283
1284 seq_printf(m, "%08lx %s", vma->vm_start, buffer); 1284 seq_printf(m, "%08lx %s", vma->vm_start, buffer);
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index f883e7e74305..7003e5266f25 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -291,9 +291,8 @@ static void ramoops_free_przs(struct ramoops_context *cxt)
291 kfree(cxt->przs); 291 kfree(cxt->przs);
292} 292}
293 293
294static int __devinit ramoops_init_przs(struct device *dev, 294static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt,
295 struct ramoops_context *cxt, 295 phys_addr_t *paddr, size_t dump_mem_sz)
296 phys_addr_t *paddr, size_t dump_mem_sz)
297{ 296{
298 int err = -ENOMEM; 297 int err = -ENOMEM;
299 int i; 298 int i;
@@ -336,10 +335,9 @@ fail_prz:
336 return err; 335 return err;
337} 336}
338 337
339static int __devinit ramoops_init_prz(struct device *dev, 338static int ramoops_init_prz(struct device *dev, struct ramoops_context *cxt,
340 struct ramoops_context *cxt, 339 struct persistent_ram_zone **prz,
341 struct persistent_ram_zone **prz, 340 phys_addr_t *paddr, size_t sz, u32 sig)
342 phys_addr_t *paddr, size_t sz, u32 sig)
343{ 341{
344 if (!sz) 342 if (!sz)
345 return 0; 343 return 0;
@@ -367,7 +365,7 @@ static int __devinit ramoops_init_prz(struct device *dev,
367 return 0; 365 return 0;
368} 366}
369 367
370static int __devinit ramoops_probe(struct platform_device *pdev) 368static int ramoops_probe(struct platform_device *pdev)
371{ 369{
372 struct device *dev = &pdev->dev; 370 struct device *dev = &pdev->dev;
373 struct ramoops_platform_data *pdata = pdev->dev.platform_data; 371 struct ramoops_platform_data *pdata = pdev->dev.platform_data;
diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c
index eecd2a8a84dd..0306303be372 100644
--- a/fs/pstore/ram_core.c
+++ b/fs/pstore/ram_core.c
@@ -390,8 +390,8 @@ static int persistent_ram_buffer_map(phys_addr_t start, phys_addr_t size,
390 return 0; 390 return 0;
391} 391}
392 392
393static int __devinit persistent_ram_post_init(struct persistent_ram_zone *prz, 393static int persistent_ram_post_init(struct persistent_ram_zone *prz, u32 sig,
394 u32 sig, int ecc_size) 394 int ecc_size)
395{ 395{
396 int ret; 396 int ret;
397 397
@@ -443,9 +443,8 @@ void persistent_ram_free(struct persistent_ram_zone *prz)
443 kfree(prz); 443 kfree(prz);
444} 444}
445 445
446struct persistent_ram_zone * __devinit persistent_ram_new(phys_addr_t start, 446struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size,
447 size_t size, u32 sig, 447 u32 sig, int ecc_size)
448 int ecc_size)
449{ 448{
450 struct persistent_ram_zone *prz; 449 struct persistent_ram_zone *prz;
451 int ret = -ENOMEM; 450 int ret = -ENOMEM;
diff --git a/fs/seq_file.c b/fs/seq_file.c
index 9d863fb501f9..f2bc3dfd0b88 100644
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -296,7 +296,7 @@ EXPORT_SYMBOL(seq_read);
296 * seq_lseek - ->llseek() method for sequential files. 296 * seq_lseek - ->llseek() method for sequential files.
297 * @file: the file in question 297 * @file: the file in question
298 * @offset: new position 298 * @offset: new position
299 * @origin: 0 for absolute, 1 for relative position 299 * @whence: 0 for absolute, 1 for relative position
300 * 300 *
301 * Ready-made ->f_op->llseek() 301 * Ready-made ->f_op->llseek()
302 */ 302 */
diff --git a/fs/splice.c b/fs/splice.c
index 8890604e3fcd..6909d89d0da5 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -696,8 +696,10 @@ static int pipe_to_sendpage(struct pipe_inode_info *pipe,
696 return -EINVAL; 696 return -EINVAL;
697 697
698 more = (sd->flags & SPLICE_F_MORE) ? MSG_MORE : 0; 698 more = (sd->flags & SPLICE_F_MORE) ? MSG_MORE : 0;
699 if (sd->len < sd->total_len) 699
700 if (sd->len < sd->total_len && pipe->nrbufs > 1)
700 more |= MSG_SENDPAGE_NOTLAST; 701 more |= MSG_SENDPAGE_NOTLAST;
702
701 return file->f_op->sendpage(file, buf->page, buf->offset, 703 return file->f_op->sendpage(file, buf->page, buf->offset,
702 sd->len, &pos, more); 704 sd->len, &pos, more);
703} 705}
diff --git a/fs/udf/super.c b/fs/udf/super.c
index d44fb568abe1..e9be396a558d 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -307,7 +307,8 @@ static void udf_sb_free_partitions(struct super_block *sb)
307{ 307{
308 struct udf_sb_info *sbi = UDF_SB(sb); 308 struct udf_sb_info *sbi = UDF_SB(sb);
309 int i; 309 int i;
310 310 if (sbi->s_partmaps == NULL)
311 return;
311 for (i = 0; i < sbi->s_partitions; i++) 312 for (i = 0; i < sbi->s_partitions; i++)
312 udf_free_partition(&sbi->s_partmaps[i]); 313 udf_free_partition(&sbi->s_partmaps[i]);
313 kfree(sbi->s_partmaps); 314 kfree(sbi->s_partmaps);
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 4111a40ebe1a..5f707e537171 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -86,11 +86,11 @@ xfs_destroy_ioend(
86 } 86 }
87 87
88 if (ioend->io_iocb) { 88 if (ioend->io_iocb) {
89 inode_dio_done(ioend->io_inode);
89 if (ioend->io_isasync) { 90 if (ioend->io_isasync) {
90 aio_complete(ioend->io_iocb, ioend->io_error ? 91 aio_complete(ioend->io_iocb, ioend->io_error ?
91 ioend->io_error : ioend->io_result, 0); 92 ioend->io_error : ioend->io_result, 0);
92 } 93 }
93 inode_dio_done(ioend->io_inode);
94 } 94 }
95 95
96 mempool_free(ioend, xfs_ioend_pool); 96 mempool_free(ioend, xfs_ioend_pool);
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index 0e92d12765d2..cdb2d3348583 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -4680,9 +4680,6 @@ __xfs_bmapi_allocate(
4680 return error; 4680 return error;
4681 } 4681 }
4682 4682
4683 if (bma->flags & XFS_BMAPI_STACK_SWITCH)
4684 bma->stack_switch = 1;
4685
4686 error = xfs_bmap_alloc(bma); 4683 error = xfs_bmap_alloc(bma);
4687 if (error) 4684 if (error)
4688 return error; 4685 return error;
@@ -4956,6 +4953,9 @@ xfs_bmapi_write(
4956 bma.flist = flist; 4953 bma.flist = flist;
4957 bma.firstblock = firstblock; 4954 bma.firstblock = firstblock;
4958 4955
4956 if (flags & XFS_BMAPI_STACK_SWITCH)
4957 bma.stack_switch = 1;
4958
4959 while (bno < end && n < *nmap) { 4959 while (bno < end && n < *nmap) {
4960 inhole = eof || bma.got.br_startoff > bno; 4960 inhole = eof || bma.got.br_startoff > bno;
4961 wasdelay = !inhole && isnullstartblock(bma.got.br_startblock); 4961 wasdelay = !inhole && isnullstartblock(bma.got.br_startblock);
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index 26673a0b20e7..fbbb9eb92e32 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -175,7 +175,7 @@ xfs_buf_get_maps(
175 bp->b_map_count = map_count; 175 bp->b_map_count = map_count;
176 176
177 if (map_count == 1) { 177 if (map_count == 1) {
178 bp->b_maps = &bp->b_map; 178 bp->b_maps = &bp->__b_map;
179 return 0; 179 return 0;
180 } 180 }
181 181
@@ -193,7 +193,7 @@ static void
193xfs_buf_free_maps( 193xfs_buf_free_maps(
194 struct xfs_buf *bp) 194 struct xfs_buf *bp)
195{ 195{
196 if (bp->b_maps != &bp->b_map) { 196 if (bp->b_maps != &bp->__b_map) {
197 kmem_free(bp->b_maps); 197 kmem_free(bp->b_maps);
198 bp->b_maps = NULL; 198 bp->b_maps = NULL;
199 } 199 }
@@ -377,8 +377,8 @@ xfs_buf_allocate_memory(
377 } 377 }
378 378
379use_alloc_page: 379use_alloc_page:
380 start = BBTOB(bp->b_map.bm_bn) >> PAGE_SHIFT; 380 start = BBTOB(bp->b_maps[0].bm_bn) >> PAGE_SHIFT;
381 end = (BBTOB(bp->b_map.bm_bn + bp->b_length) + PAGE_SIZE - 1) 381 end = (BBTOB(bp->b_maps[0].bm_bn + bp->b_length) + PAGE_SIZE - 1)
382 >> PAGE_SHIFT; 382 >> PAGE_SHIFT;
383 page_count = end - start; 383 page_count = end - start;
384 error = _xfs_buf_get_pages(bp, page_count, flags); 384 error = _xfs_buf_get_pages(bp, page_count, flags);
@@ -487,6 +487,7 @@ _xfs_buf_find(
487 struct rb_node *parent; 487 struct rb_node *parent;
488 xfs_buf_t *bp; 488 xfs_buf_t *bp;
489 xfs_daddr_t blkno = map[0].bm_bn; 489 xfs_daddr_t blkno = map[0].bm_bn;
490 xfs_daddr_t eofs;
490 int numblks = 0; 491 int numblks = 0;
491 int i; 492 int i;
492 493
@@ -498,6 +499,23 @@ _xfs_buf_find(
498 ASSERT(!(numbytes < (1 << btp->bt_sshift))); 499 ASSERT(!(numbytes < (1 << btp->bt_sshift)));
499 ASSERT(!(BBTOB(blkno) & (xfs_off_t)btp->bt_smask)); 500 ASSERT(!(BBTOB(blkno) & (xfs_off_t)btp->bt_smask));
500 501
502 /*
503 * Corrupted block numbers can get through to here, unfortunately, so we
504 * have to check that the buffer falls within the filesystem bounds.
505 */
506 eofs = XFS_FSB_TO_BB(btp->bt_mount, btp->bt_mount->m_sb.sb_dblocks);
507 if (blkno >= eofs) {
508 /*
509 * XXX (dgc): we should really be returning EFSCORRUPTED here,
510 * but none of the higher level infrastructure supports
511 * returning a specific error on buffer lookup failures.
512 */
513 xfs_alert(btp->bt_mount,
514 "%s: Block out of range: block 0x%llx, EOFS 0x%llx ",
515 __func__, blkno, eofs);
516 return NULL;
517 }
518
501 /* get tree root */ 519 /* get tree root */
502 pag = xfs_perag_get(btp->bt_mount, 520 pag = xfs_perag_get(btp->bt_mount,
503 xfs_daddr_to_agno(btp->bt_mount, blkno)); 521 xfs_daddr_to_agno(btp->bt_mount, blkno));
@@ -640,7 +658,7 @@ _xfs_buf_read(
640 xfs_buf_flags_t flags) 658 xfs_buf_flags_t flags)
641{ 659{
642 ASSERT(!(flags & XBF_WRITE)); 660 ASSERT(!(flags & XBF_WRITE));
643 ASSERT(bp->b_map.bm_bn != XFS_BUF_DADDR_NULL); 661 ASSERT(bp->b_maps[0].bm_bn != XFS_BUF_DADDR_NULL);
644 662
645 bp->b_flags &= ~(XBF_WRITE | XBF_ASYNC | XBF_READ_AHEAD); 663 bp->b_flags &= ~(XBF_WRITE | XBF_ASYNC | XBF_READ_AHEAD);
646 bp->b_flags |= flags & (XBF_READ | XBF_ASYNC | XBF_READ_AHEAD); 664 bp->b_flags |= flags & (XBF_READ | XBF_ASYNC | XBF_READ_AHEAD);
@@ -1487,6 +1505,8 @@ restart:
1487 while (!list_empty(&btp->bt_lru)) { 1505 while (!list_empty(&btp->bt_lru)) {
1488 bp = list_first_entry(&btp->bt_lru, struct xfs_buf, b_lru); 1506 bp = list_first_entry(&btp->bt_lru, struct xfs_buf, b_lru);
1489 if (atomic_read(&bp->b_hold) > 1) { 1507 if (atomic_read(&bp->b_hold) > 1) {
1508 trace_xfs_buf_wait_buftarg(bp, _RET_IP_);
1509 list_move_tail(&bp->b_lru, &btp->bt_lru);
1490 spin_unlock(&btp->bt_lru_lock); 1510 spin_unlock(&btp->bt_lru_lock);
1491 delay(100); 1511 delay(100);
1492 goto restart; 1512 goto restart;
@@ -1709,7 +1729,7 @@ xfs_buf_cmp(
1709 struct xfs_buf *bp = container_of(b, struct xfs_buf, b_list); 1729 struct xfs_buf *bp = container_of(b, struct xfs_buf, b_list);
1710 xfs_daddr_t diff; 1730 xfs_daddr_t diff;
1711 1731
1712 diff = ap->b_map.bm_bn - bp->b_map.bm_bn; 1732 diff = ap->b_maps[0].bm_bn - bp->b_maps[0].bm_bn;
1713 if (diff < 0) 1733 if (diff < 0)
1714 return -1; 1734 return -1;
1715 if (diff > 0) 1735 if (diff > 0)
diff --git a/fs/xfs/xfs_buf.h b/fs/xfs/xfs_buf.h
index 23f5642480bb..433a12ed7b17 100644
--- a/fs/xfs/xfs_buf.h
+++ b/fs/xfs/xfs_buf.h
@@ -151,7 +151,7 @@ typedef struct xfs_buf {
151 struct page **b_pages; /* array of page pointers */ 151 struct page **b_pages; /* array of page pointers */
152 struct page *b_page_array[XB_PAGES]; /* inline pages */ 152 struct page *b_page_array[XB_PAGES]; /* inline pages */
153 struct xfs_buf_map *b_maps; /* compound buffer map */ 153 struct xfs_buf_map *b_maps; /* compound buffer map */
154 struct xfs_buf_map b_map; /* inline compound buffer map */ 154 struct xfs_buf_map __b_map; /* inline compound buffer map */
155 int b_map_count; 155 int b_map_count;
156 int b_io_length; /* IO size in BBs */ 156 int b_io_length; /* IO size in BBs */
157 atomic_t b_pin_count; /* pin count */ 157 atomic_t b_pin_count; /* pin count */
@@ -330,8 +330,8 @@ void xfs_buf_stale(struct xfs_buf *bp);
330 * In future, uncached buffers will pass the block number directly to the io 330 * In future, uncached buffers will pass the block number directly to the io
331 * request function and hence these macros will go away at that point. 331 * request function and hence these macros will go away at that point.
332 */ 332 */
333#define XFS_BUF_ADDR(bp) ((bp)->b_map.bm_bn) 333#define XFS_BUF_ADDR(bp) ((bp)->b_maps[0].bm_bn)
334#define XFS_BUF_SET_ADDR(bp, bno) ((bp)->b_map.bm_bn = (xfs_daddr_t)(bno)) 334#define XFS_BUF_SET_ADDR(bp, bno) ((bp)->b_maps[0].bm_bn = (xfs_daddr_t)(bno))
335 335
336static inline void xfs_buf_set_ref(struct xfs_buf *bp, int lru_ref) 336static inline void xfs_buf_set_ref(struct xfs_buf *bp, int lru_ref)
337{ 337{
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
index becf4a97efc6..3f9949fee391 100644
--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -71,7 +71,7 @@ xfs_buf_item_log_debug(
71 chunk_num = byte >> XFS_BLF_SHIFT; 71 chunk_num = byte >> XFS_BLF_SHIFT;
72 word_num = chunk_num >> BIT_TO_WORD_SHIFT; 72 word_num = chunk_num >> BIT_TO_WORD_SHIFT;
73 bit_num = chunk_num & (NBWORD - 1); 73 bit_num = chunk_num & (NBWORD - 1);
74 wordp = &(bip->bli_format.blf_data_map[word_num]); 74 wordp = &(bip->__bli_format.blf_data_map[word_num]);
75 bit_set = *wordp & (1 << bit_num); 75 bit_set = *wordp & (1 << bit_num);
76 ASSERT(bit_set); 76 ASSERT(bit_set);
77 byte++; 77 byte++;
@@ -237,7 +237,7 @@ xfs_buf_item_size(
237 * cancel flag in it. 237 * cancel flag in it.
238 */ 238 */
239 trace_xfs_buf_item_size_stale(bip); 239 trace_xfs_buf_item_size_stale(bip);
240 ASSERT(bip->bli_format.blf_flags & XFS_BLF_CANCEL); 240 ASSERT(bip->__bli_format.blf_flags & XFS_BLF_CANCEL);
241 return bip->bli_format_count; 241 return bip->bli_format_count;
242 } 242 }
243 243
@@ -278,7 +278,7 @@ xfs_buf_item_format_segment(
278 uint buffer_offset; 278 uint buffer_offset;
279 279
280 /* copy the flags across from the base format item */ 280 /* copy the flags across from the base format item */
281 blfp->blf_flags = bip->bli_format.blf_flags; 281 blfp->blf_flags = bip->__bli_format.blf_flags;
282 282
283 /* 283 /*
284 * Base size is the actual size of the ondisk structure - it reflects 284 * Base size is the actual size of the ondisk structure - it reflects
@@ -287,6 +287,17 @@ xfs_buf_item_format_segment(
287 */ 287 */
288 base_size = offsetof(struct xfs_buf_log_format, blf_data_map) + 288 base_size = offsetof(struct xfs_buf_log_format, blf_data_map) +
289 (blfp->blf_map_size * sizeof(blfp->blf_data_map[0])); 289 (blfp->blf_map_size * sizeof(blfp->blf_data_map[0]));
290
291 nvecs = 0;
292 first_bit = xfs_next_bit(blfp->blf_data_map, blfp->blf_map_size, 0);
293 if (!(bip->bli_flags & XFS_BLI_STALE) && first_bit == -1) {
294 /*
295 * If the map is not be dirty in the transaction, mark
296 * the size as zero and do not advance the vector pointer.
297 */
298 goto out;
299 }
300
290 vecp->i_addr = blfp; 301 vecp->i_addr = blfp;
291 vecp->i_len = base_size; 302 vecp->i_len = base_size;
292 vecp->i_type = XLOG_REG_TYPE_BFORMAT; 303 vecp->i_type = XLOG_REG_TYPE_BFORMAT;
@@ -301,15 +312,13 @@ xfs_buf_item_format_segment(
301 */ 312 */
302 trace_xfs_buf_item_format_stale(bip); 313 trace_xfs_buf_item_format_stale(bip);
303 ASSERT(blfp->blf_flags & XFS_BLF_CANCEL); 314 ASSERT(blfp->blf_flags & XFS_BLF_CANCEL);
304 blfp->blf_size = nvecs; 315 goto out;
305 return vecp;
306 } 316 }
307 317
308 /* 318 /*
309 * Fill in an iovec for each set of contiguous chunks. 319 * Fill in an iovec for each set of contiguous chunks.
310 */ 320 */
311 first_bit = xfs_next_bit(blfp->blf_data_map, blfp->blf_map_size, 0); 321
312 ASSERT(first_bit != -1);
313 last_bit = first_bit; 322 last_bit = first_bit;
314 nbits = 1; 323 nbits = 1;
315 for (;;) { 324 for (;;) {
@@ -371,7 +380,8 @@ xfs_buf_item_format_segment(
371 nbits++; 380 nbits++;
372 } 381 }
373 } 382 }
374 bip->bli_format.blf_size = nvecs; 383out:
384 blfp->blf_size = nvecs;
375 return vecp; 385 return vecp;
376} 386}
377 387
@@ -405,7 +415,7 @@ xfs_buf_item_format(
405 if (bip->bli_flags & XFS_BLI_INODE_BUF) { 415 if (bip->bli_flags & XFS_BLI_INODE_BUF) {
406 if (!((bip->bli_flags & XFS_BLI_INODE_ALLOC_BUF) && 416 if (!((bip->bli_flags & XFS_BLI_INODE_ALLOC_BUF) &&
407 xfs_log_item_in_current_chkpt(lip))) 417 xfs_log_item_in_current_chkpt(lip)))
408 bip->bli_format.blf_flags |= XFS_BLF_INODE_BUF; 418 bip->__bli_format.blf_flags |= XFS_BLF_INODE_BUF;
409 bip->bli_flags &= ~XFS_BLI_INODE_BUF; 419 bip->bli_flags &= ~XFS_BLI_INODE_BUF;
410 } 420 }
411 421
@@ -485,7 +495,7 @@ xfs_buf_item_unpin(
485 ASSERT(bip->bli_flags & XFS_BLI_STALE); 495 ASSERT(bip->bli_flags & XFS_BLI_STALE);
486 ASSERT(xfs_buf_islocked(bp)); 496 ASSERT(xfs_buf_islocked(bp));
487 ASSERT(XFS_BUF_ISSTALE(bp)); 497 ASSERT(XFS_BUF_ISSTALE(bp));
488 ASSERT(bip->bli_format.blf_flags & XFS_BLF_CANCEL); 498 ASSERT(bip->__bli_format.blf_flags & XFS_BLF_CANCEL);
489 499
490 trace_xfs_buf_item_unpin_stale(bip); 500 trace_xfs_buf_item_unpin_stale(bip);
491 501
@@ -601,7 +611,7 @@ xfs_buf_item_unlock(
601{ 611{
602 struct xfs_buf_log_item *bip = BUF_ITEM(lip); 612 struct xfs_buf_log_item *bip = BUF_ITEM(lip);
603 struct xfs_buf *bp = bip->bli_buf; 613 struct xfs_buf *bp = bip->bli_buf;
604 int aborted; 614 int aborted, clean, i;
605 uint hold; 615 uint hold;
606 616
607 /* Clear the buffer's association with this transaction. */ 617 /* Clear the buffer's association with this transaction. */
@@ -631,7 +641,7 @@ xfs_buf_item_unlock(
631 */ 641 */
632 if (bip->bli_flags & XFS_BLI_STALE) { 642 if (bip->bli_flags & XFS_BLI_STALE) {
633 trace_xfs_buf_item_unlock_stale(bip); 643 trace_xfs_buf_item_unlock_stale(bip);
634 ASSERT(bip->bli_format.blf_flags & XFS_BLF_CANCEL); 644 ASSERT(bip->__bli_format.blf_flags & XFS_BLF_CANCEL);
635 if (!aborted) { 645 if (!aborted) {
636 atomic_dec(&bip->bli_refcount); 646 atomic_dec(&bip->bli_refcount);
637 return; 647 return;
@@ -642,12 +652,27 @@ xfs_buf_item_unlock(
642 652
643 /* 653 /*
644 * If the buf item isn't tracking any data, free it, otherwise drop the 654 * If the buf item isn't tracking any data, free it, otherwise drop the
645 * reference we hold to it. 655 * reference we hold to it. If we are aborting the transaction, this may
656 * be the only reference to the buf item, so we free it anyway
657 * regardless of whether it is dirty or not. A dirty abort implies a
658 * shutdown, anyway.
646 */ 659 */
647 if (xfs_bitmap_empty(bip->bli_format.blf_data_map, 660 clean = 1;
648 bip->bli_format.blf_map_size)) 661 for (i = 0; i < bip->bli_format_count; i++) {
662 if (!xfs_bitmap_empty(bip->bli_formats[i].blf_data_map,
663 bip->bli_formats[i].blf_map_size)) {
664 clean = 0;
665 break;
666 }
667 }
668 if (clean)
649 xfs_buf_item_relse(bp); 669 xfs_buf_item_relse(bp);
650 else 670 else if (aborted) {
671 if (atomic_dec_and_test(&bip->bli_refcount)) {
672 ASSERT(XFS_FORCED_SHUTDOWN(lip->li_mountp));
673 xfs_buf_item_relse(bp);
674 }
675 } else
651 atomic_dec(&bip->bli_refcount); 676 atomic_dec(&bip->bli_refcount);
652 677
653 if (!hold) 678 if (!hold)
@@ -716,7 +741,7 @@ xfs_buf_item_get_format(
716 bip->bli_format_count = count; 741 bip->bli_format_count = count;
717 742
718 if (count == 1) { 743 if (count == 1) {
719 bip->bli_formats = &bip->bli_format; 744 bip->bli_formats = &bip->__bli_format;
720 return 0; 745 return 0;
721 } 746 }
722 747
@@ -731,7 +756,7 @@ STATIC void
731xfs_buf_item_free_format( 756xfs_buf_item_free_format(
732 struct xfs_buf_log_item *bip) 757 struct xfs_buf_log_item *bip)
733{ 758{
734 if (bip->bli_formats != &bip->bli_format) { 759 if (bip->bli_formats != &bip->__bli_format) {
735 kmem_free(bip->bli_formats); 760 kmem_free(bip->bli_formats);
736 bip->bli_formats = NULL; 761 bip->bli_formats = NULL;
737 } 762 }
diff --git a/fs/xfs/xfs_buf_item.h b/fs/xfs/xfs_buf_item.h
index 6850f49f4af3..16def435944a 100644
--- a/fs/xfs/xfs_buf_item.h
+++ b/fs/xfs/xfs_buf_item.h
@@ -104,7 +104,7 @@ typedef struct xfs_buf_log_item {
104#endif 104#endif
105 int bli_format_count; /* count of headers */ 105 int bli_format_count; /* count of headers */
106 struct xfs_buf_log_format *bli_formats; /* array of in-log header ptrs */ 106 struct xfs_buf_log_format *bli_formats; /* array of in-log header ptrs */
107 struct xfs_buf_log_format bli_format; /* embedded in-log header */ 107 struct xfs_buf_log_format __bli_format; /* embedded in-log header */
108} xfs_buf_log_item_t; 108} xfs_buf_log_item_t;
109 109
110void xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *); 110void xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *);
diff --git a/fs/xfs/xfs_dfrag.c b/fs/xfs/xfs_dfrag.c
index d0e9c74d3d96..a8bd26b82ecb 100644
--- a/fs/xfs/xfs_dfrag.c
+++ b/fs/xfs/xfs_dfrag.c
@@ -246,10 +246,10 @@ xfs_swap_extents(
246 goto out_unlock; 246 goto out_unlock;
247 } 247 }
248 248
249 error = -filemap_write_and_wait(VFS_I(ip)->i_mapping); 249 error = -filemap_write_and_wait(VFS_I(tip)->i_mapping);
250 if (error) 250 if (error)
251 goto out_unlock; 251 goto out_unlock;
252 truncate_pagecache_range(VFS_I(ip), 0, -1); 252 truncate_pagecache_range(VFS_I(tip), 0, -1);
253 253
254 /* Verify O_DIRECT for ftmp */ 254 /* Verify O_DIRECT for ftmp */
255 if (VN_CACHED(VFS_I(tip)) != 0) { 255 if (VN_CACHED(VFS_I(tip)) != 0) {
diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c
index 7536faaa61e7..12afe07a91d7 100644
--- a/fs/xfs/xfs_dir2_block.c
+++ b/fs/xfs/xfs_dir2_block.c
@@ -355,10 +355,12 @@ xfs_dir2_block_addname(
355 /* 355 /*
356 * If need to compact the leaf entries, do it now. 356 * If need to compact the leaf entries, do it now.
357 */ 357 */
358 if (compact) 358 if (compact) {
359 xfs_dir2_block_compact(tp, bp, hdr, btp, blp, &needlog, 359 xfs_dir2_block_compact(tp, bp, hdr, btp, blp, &needlog,
360 &lfloghigh, &lfloglow); 360 &lfloghigh, &lfloglow);
361 else if (btp->stale) { 361 /* recalculate blp post-compaction */
362 blp = xfs_dir2_block_leaf_p(btp);
363 } else if (btp->stale) {
362 /* 364 /*
363 * Set leaf logging boundaries to impossible state. 365 * Set leaf logging boundaries to impossible state.
364 * For the no-stale case they're set explicitly. 366 * For the no-stale case they're set explicitly.
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index add06b4e9a63..364818eef40e 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -351,6 +351,15 @@ xfs_iomap_prealloc_size(
351 } 351 }
352 if (shift) 352 if (shift)
353 alloc_blocks >>= shift; 353 alloc_blocks >>= shift;
354
355 /*
356 * If we are still trying to allocate more space than is
357 * available, squash the prealloc hard. This can happen if we
358 * have a large file on a small filesystem and the above
359 * lowspace thresholds are smaller than MAXEXTLEN.
360 */
361 while (alloc_blocks >= freesp)
362 alloc_blocks >>= 4;
354 } 363 }
355 364
356 if (alloc_blocks < mp->m_writeio_blocks) 365 if (alloc_blocks < mp->m_writeio_blocks)
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index da508463ff10..7d6df7c00c36 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -658,7 +658,7 @@ xfs_sb_quiet_read_verify(
658 return; 658 return;
659 } 659 }
660 /* quietly fail */ 660 /* quietly fail */
661 xfs_buf_ioerror(bp, EFSCORRUPTED); 661 xfs_buf_ioerror(bp, EWRONGFS);
662} 662}
663 663
664static void 664static void
diff --git a/fs/xfs/xfs_qm_syscalls.c b/fs/xfs/xfs_qm_syscalls.c
index 5f53e75409b8..8a59f8546552 100644
--- a/fs/xfs/xfs_qm_syscalls.c
+++ b/fs/xfs/xfs_qm_syscalls.c
@@ -784,11 +784,11 @@ xfs_qm_scall_getquota(
784 (XFS_IS_OQUOTA_ENFORCED(mp) && 784 (XFS_IS_OQUOTA_ENFORCED(mp) &&
785 (dst->d_flags & (FS_PROJ_QUOTA | FS_GROUP_QUOTA)))) && 785 (dst->d_flags & (FS_PROJ_QUOTA | FS_GROUP_QUOTA)))) &&
786 dst->d_id != 0) { 786 dst->d_id != 0) {
787 if (((int) dst->d_bcount > (int) dst->d_blk_softlimit) && 787 if ((dst->d_bcount > dst->d_blk_softlimit) &&
788 (dst->d_blk_softlimit > 0)) { 788 (dst->d_blk_softlimit > 0)) {
789 ASSERT(dst->d_btimer != 0); 789 ASSERT(dst->d_btimer != 0);
790 } 790 }
791 if (((int) dst->d_icount > (int) dst->d_ino_softlimit) && 791 if ((dst->d_icount > dst->d_ino_softlimit) &&
792 (dst->d_ino_softlimit > 0)) { 792 (dst->d_ino_softlimit > 0)) {
793 ASSERT(dst->d_itimer != 0); 793 ASSERT(dst->d_itimer != 0);
794 } 794 }
diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
index 2e137d4a85ae..16a812977eab 100644
--- a/fs/xfs/xfs_trace.h
+++ b/fs/xfs/xfs_trace.h
@@ -341,6 +341,7 @@ DEFINE_BUF_EVENT(xfs_buf_item_relse);
341DEFINE_BUF_EVENT(xfs_buf_item_iodone); 341DEFINE_BUF_EVENT(xfs_buf_item_iodone);
342DEFINE_BUF_EVENT(xfs_buf_item_iodone_async); 342DEFINE_BUF_EVENT(xfs_buf_item_iodone_async);
343DEFINE_BUF_EVENT(xfs_buf_error_relse); 343DEFINE_BUF_EVENT(xfs_buf_error_relse);
344DEFINE_BUF_EVENT(xfs_buf_wait_buftarg);
344DEFINE_BUF_EVENT(xfs_trans_read_buf_io); 345DEFINE_BUF_EVENT(xfs_trans_read_buf_io);
345DEFINE_BUF_EVENT(xfs_trans_read_buf_shut); 346DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);
346 347
diff --git a/fs/xfs/xfs_trans_buf.c b/fs/xfs/xfs_trans_buf.c
index 4fc17d479d42..3edf5dbee001 100644
--- a/fs/xfs/xfs_trans_buf.c
+++ b/fs/xfs/xfs_trans_buf.c
@@ -93,7 +93,7 @@ _xfs_trans_bjoin(
93 xfs_buf_item_init(bp, tp->t_mountp); 93 xfs_buf_item_init(bp, tp->t_mountp);
94 bip = bp->b_fspriv; 94 bip = bp->b_fspriv;
95 ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); 95 ASSERT(!(bip->bli_flags & XFS_BLI_STALE));
96 ASSERT(!(bip->bli_format.blf_flags & XFS_BLF_CANCEL)); 96 ASSERT(!(bip->__bli_format.blf_flags & XFS_BLF_CANCEL));
97 ASSERT(!(bip->bli_flags & XFS_BLI_LOGGED)); 97 ASSERT(!(bip->bli_flags & XFS_BLI_LOGGED));
98 if (reset_recur) 98 if (reset_recur)
99 bip->bli_recur = 0; 99 bip->bli_recur = 0;
@@ -432,7 +432,7 @@ xfs_trans_brelse(xfs_trans_t *tp,
432 bip = bp->b_fspriv; 432 bip = bp->b_fspriv;
433 ASSERT(bip->bli_item.li_type == XFS_LI_BUF); 433 ASSERT(bip->bli_item.li_type == XFS_LI_BUF);
434 ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); 434 ASSERT(!(bip->bli_flags & XFS_BLI_STALE));
435 ASSERT(!(bip->bli_format.blf_flags & XFS_BLF_CANCEL)); 435 ASSERT(!(bip->__bli_format.blf_flags & XFS_BLF_CANCEL));
436 ASSERT(atomic_read(&bip->bli_refcount) > 0); 436 ASSERT(atomic_read(&bip->bli_refcount) > 0);
437 437
438 trace_xfs_trans_brelse(bip); 438 trace_xfs_trans_brelse(bip);
@@ -519,7 +519,7 @@ xfs_trans_bhold(xfs_trans_t *tp,
519 ASSERT(bp->b_transp == tp); 519 ASSERT(bp->b_transp == tp);
520 ASSERT(bip != NULL); 520 ASSERT(bip != NULL);
521 ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); 521 ASSERT(!(bip->bli_flags & XFS_BLI_STALE));
522 ASSERT(!(bip->bli_format.blf_flags & XFS_BLF_CANCEL)); 522 ASSERT(!(bip->__bli_format.blf_flags & XFS_BLF_CANCEL));
523 ASSERT(atomic_read(&bip->bli_refcount) > 0); 523 ASSERT(atomic_read(&bip->bli_refcount) > 0);
524 524
525 bip->bli_flags |= XFS_BLI_HOLD; 525 bip->bli_flags |= XFS_BLI_HOLD;
@@ -539,7 +539,7 @@ xfs_trans_bhold_release(xfs_trans_t *tp,
539 ASSERT(bp->b_transp == tp); 539 ASSERT(bp->b_transp == tp);
540 ASSERT(bip != NULL); 540 ASSERT(bip != NULL);
541 ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); 541 ASSERT(!(bip->bli_flags & XFS_BLI_STALE));
542 ASSERT(!(bip->bli_format.blf_flags & XFS_BLF_CANCEL)); 542 ASSERT(!(bip->__bli_format.blf_flags & XFS_BLF_CANCEL));
543 ASSERT(atomic_read(&bip->bli_refcount) > 0); 543 ASSERT(atomic_read(&bip->bli_refcount) > 0);
544 ASSERT(bip->bli_flags & XFS_BLI_HOLD); 544 ASSERT(bip->bli_flags & XFS_BLI_HOLD);
545 545
@@ -598,7 +598,7 @@ xfs_trans_log_buf(xfs_trans_t *tp,
598 bip->bli_flags &= ~XFS_BLI_STALE; 598 bip->bli_flags &= ~XFS_BLI_STALE;
599 ASSERT(XFS_BUF_ISSTALE(bp)); 599 ASSERT(XFS_BUF_ISSTALE(bp));
600 XFS_BUF_UNSTALE(bp); 600 XFS_BUF_UNSTALE(bp);
601 bip->bli_format.blf_flags &= ~XFS_BLF_CANCEL; 601 bip->__bli_format.blf_flags &= ~XFS_BLF_CANCEL;
602 } 602 }
603 603
604 tp->t_flags |= XFS_TRANS_DIRTY; 604 tp->t_flags |= XFS_TRANS_DIRTY;
@@ -643,6 +643,7 @@ xfs_trans_binval(
643 xfs_buf_t *bp) 643 xfs_buf_t *bp)
644{ 644{
645 xfs_buf_log_item_t *bip = bp->b_fspriv; 645 xfs_buf_log_item_t *bip = bp->b_fspriv;
646 int i;
646 647
647 ASSERT(bp->b_transp == tp); 648 ASSERT(bp->b_transp == tp);
648 ASSERT(bip != NULL); 649 ASSERT(bip != NULL);
@@ -657,8 +658,8 @@ xfs_trans_binval(
657 */ 658 */
658 ASSERT(XFS_BUF_ISSTALE(bp)); 659 ASSERT(XFS_BUF_ISSTALE(bp));
659 ASSERT(!(bip->bli_flags & (XFS_BLI_LOGGED | XFS_BLI_DIRTY))); 660 ASSERT(!(bip->bli_flags & (XFS_BLI_LOGGED | XFS_BLI_DIRTY)));
660 ASSERT(!(bip->bli_format.blf_flags & XFS_BLF_INODE_BUF)); 661 ASSERT(!(bip->__bli_format.blf_flags & XFS_BLF_INODE_BUF));
661 ASSERT(bip->bli_format.blf_flags & XFS_BLF_CANCEL); 662 ASSERT(bip->__bli_format.blf_flags & XFS_BLF_CANCEL);
662 ASSERT(bip->bli_item.li_desc->lid_flags & XFS_LID_DIRTY); 663 ASSERT(bip->bli_item.li_desc->lid_flags & XFS_LID_DIRTY);
663 ASSERT(tp->t_flags & XFS_TRANS_DIRTY); 664 ASSERT(tp->t_flags & XFS_TRANS_DIRTY);
664 return; 665 return;
@@ -668,10 +669,12 @@ xfs_trans_binval(
668 669
669 bip->bli_flags |= XFS_BLI_STALE; 670 bip->bli_flags |= XFS_BLI_STALE;
670 bip->bli_flags &= ~(XFS_BLI_INODE_BUF | XFS_BLI_LOGGED | XFS_BLI_DIRTY); 671 bip->bli_flags &= ~(XFS_BLI_INODE_BUF | XFS_BLI_LOGGED | XFS_BLI_DIRTY);
671 bip->bli_format.blf_flags &= ~XFS_BLF_INODE_BUF; 672 bip->__bli_format.blf_flags &= ~XFS_BLF_INODE_BUF;
672 bip->bli_format.blf_flags |= XFS_BLF_CANCEL; 673 bip->__bli_format.blf_flags |= XFS_BLF_CANCEL;
673 memset((char *)(bip->bli_format.blf_data_map), 0, 674 for (i = 0; i < bip->bli_format_count; i++) {
674 (bip->bli_format.blf_map_size * sizeof(uint))); 675 memset(bip->bli_formats[i].blf_data_map, 0,
676 (bip->bli_formats[i].blf_map_size * sizeof(uint)));
677 }
675 bip->bli_item.li_desc->lid_flags |= XFS_LID_DIRTY; 678 bip->bli_item.li_desc->lid_flags |= XFS_LID_DIRTY;
676 tp->t_flags |= XFS_TRANS_DIRTY; 679 tp->t_flags |= XFS_TRANS_DIRTY;
677} 680}
@@ -775,5 +778,5 @@ xfs_trans_dquot_buf(
775 type == XFS_BLF_GDQUOT_BUF); 778 type == XFS_BLF_GDQUOT_BUF);
776 ASSERT(atomic_read(&bip->bli_refcount) > 0); 779 ASSERT(atomic_read(&bip->bli_refcount) > 0);
777 780
778 bip->bli_format.blf_flags |= type; 781 bip->__bli_format.blf_flags |= type;
779} 782}
diff --git a/include/Kbuild b/include/Kbuild
index 83256b64166a..1dfd33e8d43b 100644
--- a/include/Kbuild
+++ b/include/Kbuild
@@ -1,8 +1,5 @@
1# Top-level Makefile calls into asm-$(ARCH) 1# Top-level Makefile calls into asm-$(ARCH)
2# List only non-arch directories below 2# List only non-arch directories below
3 3
4header-y += linux/
5header-y += sound/
6header-y += rdma/
7header-y += video/ 4header-y += video/
8header-y += scsi/ 5header-y += scsi/
diff --git a/include/asm-generic/dma-mapping-broken.h b/include/asm-generic/dma-mapping-broken.h
index ccf7b4f34a3c..6c32af918c2f 100644
--- a/include/asm-generic/dma-mapping-broken.h
+++ b/include/asm-generic/dma-mapping-broken.h
@@ -16,6 +16,22 @@ extern void
16dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, 16dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
17 dma_addr_t dma_handle); 17 dma_addr_t dma_handle);
18 18
19static inline void *dma_alloc_attrs(struct device *dev, size_t size,
20 dma_addr_t *dma_handle, gfp_t flag,
21 struct dma_attrs *attrs)
22{
23 /* attrs is not supported and ignored */
24 return dma_alloc_coherent(dev, size, dma_handle, flag);
25}
26
27static inline void dma_free_attrs(struct device *dev, size_t size,
28 void *cpu_addr, dma_addr_t dma_handle,
29 struct dma_attrs *attrs)
30{
31 /* attrs is not supported and ignored */
32 dma_free_coherent(dev, size, cpu_addr, dma_handle);
33}
34
19#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) 35#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
20#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) 36#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
21 37
diff --git a/include/asm-generic/parport.h b/include/asm-generic/parport.h
index 40528cb977e8..2c9f9d4336ca 100644
--- a/include/asm-generic/parport.h
+++ b/include/asm-generic/parport.h
@@ -10,8 +10,8 @@
10 * to devices on the PCI bus. 10 * to devices on the PCI bus.
11 */ 11 */
12 12
13static int __devinit parport_pc_find_isa_ports(int autoirq, int autodma); 13static int parport_pc_find_isa_ports(int autoirq, int autodma);
14static int __devinit parport_pc_find_nonpci_ports(int autoirq, int autodma) 14static int parport_pc_find_nonpci_ports(int autoirq, int autodma)
15{ 15{
16#ifdef CONFIG_ISA 16#ifdef CONFIG_ISA
17 return parport_pc_find_isa_ports(autoirq, autodma); 17 return parport_pc_find_isa_ports(autoirq, autodma);
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 701beab27aab..5cf680a98f9b 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -461,10 +461,8 @@ static inline int is_zero_pfn(unsigned long pfn)
461 return offset_from_zero_pfn <= (zero_page_mask >> PAGE_SHIFT); 461 return offset_from_zero_pfn <= (zero_page_mask >> PAGE_SHIFT);
462} 462}
463 463
464static inline unsigned long my_zero_pfn(unsigned long addr) 464#define my_zero_pfn(addr) page_to_pfn(ZERO_PAGE(addr))
465{ 465
466 return page_to_pfn(ZERO_PAGE(addr));
467}
468#else 466#else
469static inline int is_zero_pfn(unsigned long pfn) 467static inline int is_zero_pfn(unsigned long pfn)
470{ 468{
diff --git a/include/asm-generic/syscalls.h b/include/asm-generic/syscalls.h
index 58f466ff00d3..1db51b8524e9 100644
--- a/include/asm-generic/syscalls.h
+++ b/include/asm-generic/syscalls.h
@@ -21,10 +21,12 @@ asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
21 unsigned long fd, off_t pgoff); 21 unsigned long fd, off_t pgoff);
22#endif 22#endif
23 23
24#ifndef CONFIG_GENERIC_SIGALTSTACK
24#ifndef sys_sigaltstack 25#ifndef sys_sigaltstack
25asmlinkage long sys_sigaltstack(const stack_t __user *, stack_t __user *, 26asmlinkage long sys_sigaltstack(const stack_t __user *, stack_t __user *,
26 struct pt_regs *); 27 struct pt_regs *);
27#endif 28#endif
29#endif
28 30
29#ifndef sys_rt_sigreturn 31#ifndef sys_rt_sigreturn
30asmlinkage long sys_rt_sigreturn(struct pt_regs *regs); 32asmlinkage long sys_rt_sigreturn(struct pt_regs *regs);
diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h
index ed6642ad03e0..25f01d0bc149 100644
--- a/include/asm-generic/tlb.h
+++ b/include/asm-generic/tlb.h
@@ -78,6 +78,14 @@ struct mmu_gather_batch {
78#define MAX_GATHER_BATCH \ 78#define MAX_GATHER_BATCH \
79 ((PAGE_SIZE - sizeof(struct mmu_gather_batch)) / sizeof(void *)) 79 ((PAGE_SIZE - sizeof(struct mmu_gather_batch)) / sizeof(void *))
80 80
81/*
82 * Limit the maximum number of mmu_gather batches to reduce a risk of soft
83 * lockups for non-preemptible kernels on huge machines when a lot of memory
84 * is zapped during unmapping.
85 * 10K pages freed at once should be safe even without a preemption point.
86 */
87#define MAX_GATHER_BATCH_COUNT (10000UL/MAX_GATHER_BATCH)
88
81/* struct mmu_gather is an opaque type used by the mm code for passing around 89/* struct mmu_gather is an opaque type used by the mm code for passing around
82 * any data needed by arch specific code for tlb_remove_page. 90 * any data needed by arch specific code for tlb_remove_page.
83 */ 91 */
@@ -96,6 +104,7 @@ struct mmu_gather {
96 struct mmu_gather_batch *active; 104 struct mmu_gather_batch *active;
97 struct mmu_gather_batch local; 105 struct mmu_gather_batch local;
98 struct page *__pages[MMU_GATHER_BUNDLE]; 106 struct page *__pages[MMU_GATHER_BUNDLE];
107 unsigned int batch_count;
99}; 108};
100 109
101#define HAVE_GENERIC_MMU_GATHER 110#define HAVE_GENERIC_MMU_GATHER
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h
index 06d7f798a08c..3527fb3f75bb 100644
--- a/include/drm/drm_mm.h
+++ b/include/drm/drm_mm.h
@@ -70,7 +70,7 @@ struct drm_mm {
70 unsigned long scan_color; 70 unsigned long scan_color;
71 unsigned long scan_size; 71 unsigned long scan_size;
72 unsigned long scan_hit_start; 72 unsigned long scan_hit_start;
73 unsigned scan_hit_size; 73 unsigned long scan_hit_end;
74 unsigned scanned_blocks; 74 unsigned scanned_blocks;
75 unsigned long scan_start; 75 unsigned long scan_start;
76 unsigned long scan_end; 76 unsigned long scan_end;
@@ -158,12 +158,29 @@ static inline struct drm_mm_node *drm_mm_get_block_atomic_range(
158 return drm_mm_get_block_range_generic(parent, size, alignment, 0, 158 return drm_mm_get_block_range_generic(parent, size, alignment, 0,
159 start, end, 1); 159 start, end, 1);
160} 160}
161extern int drm_mm_insert_node(struct drm_mm *mm, struct drm_mm_node *node, 161
162 unsigned long size, unsigned alignment); 162extern int drm_mm_insert_node(struct drm_mm *mm,
163 struct drm_mm_node *node,
164 unsigned long size,
165 unsigned alignment);
163extern int drm_mm_insert_node_in_range(struct drm_mm *mm, 166extern int drm_mm_insert_node_in_range(struct drm_mm *mm,
164 struct drm_mm_node *node, 167 struct drm_mm_node *node,
165 unsigned long size, unsigned alignment, 168 unsigned long size,
166 unsigned long start, unsigned long end); 169 unsigned alignment,
170 unsigned long start,
171 unsigned long end);
172extern int drm_mm_insert_node_generic(struct drm_mm *mm,
173 struct drm_mm_node *node,
174 unsigned long size,
175 unsigned alignment,
176 unsigned long color);
177extern int drm_mm_insert_node_in_range_generic(struct drm_mm *mm,
178 struct drm_mm_node *node,
179 unsigned long size,
180 unsigned alignment,
181 unsigned long color,
182 unsigned long start,
183 unsigned long end);
167extern void drm_mm_put_block(struct drm_mm_node *cur); 184extern void drm_mm_put_block(struct drm_mm_node *cur);
168extern void drm_mm_remove_node(struct drm_mm_node *node); 185extern void drm_mm_remove_node(struct drm_mm_node *node);
169extern void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new); 186extern void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new);
diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h
index 808dad29607a..d6aeaf3c6d6c 100644
--- a/include/drm/exynos_drm.h
+++ b/include/drm/exynos_drm.h
@@ -6,24 +6,10 @@
6 * Joonyoung Shim <jy0922.shim@samsung.com> 6 * Joonyoung Shim <jy0922.shim@samsung.com>
7 * Seung-Woo Kim <sw0312.kim@samsung.com> 7 * Seung-Woo Kim <sw0312.kim@samsung.com>
8 * 8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a 9 * This program is free software; you can redistribute it and/or modify it
10 * copy of this software and associated documentation files (the "Software"), 10 * under the terms of the GNU General Public License as published by the
11 * to deal in the Software without restriction, including without limitation 11 * Free Software Foundation; either version 2 of the License, or (at your
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 * option) any later version.
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice (including the next
17 * paragraph) shall be included in all copies or substantial portions of the
18 * Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 * OTHER DEALINGS IN THE SOFTWARE.
27 */ 13 */
28#ifndef _EXYNOS_DRM_H_ 14#ifndef _EXYNOS_DRM_H_
29#define _EXYNOS_DRM_H_ 15#define _EXYNOS_DRM_H_
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
deleted file mode 100644
index 7fe2dae251e5..000000000000
--- a/include/linux/Kbuild
+++ /dev/null
@@ -1,5 +0,0 @@
1header-y += dvb/
2header-y += hdlc/
3header-y += hsi/
4header-y += raid/
5header-y += usb/
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 408da9502177..8f7a3d68371a 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -297,10 +297,12 @@ enum {
297 ATA_LOG_SATA_NCQ = 0x10, 297 ATA_LOG_SATA_NCQ = 0x10,
298 ATA_LOG_SATA_ID_DEV_DATA = 0x30, 298 ATA_LOG_SATA_ID_DEV_DATA = 0x30,
299 ATA_LOG_SATA_SETTINGS = 0x08, 299 ATA_LOG_SATA_SETTINGS = 0x08,
300 ATA_LOG_DEVSLP_MDAT = 0x30, 300 ATA_LOG_DEVSLP_OFFSET = 0x30,
301 ATA_LOG_DEVSLP_SIZE = 0x08,
302 ATA_LOG_DEVSLP_MDAT = 0x00,
301 ATA_LOG_DEVSLP_MDAT_MASK = 0x1F, 303 ATA_LOG_DEVSLP_MDAT_MASK = 0x1F,
302 ATA_LOG_DEVSLP_DETO = 0x31, 304 ATA_LOG_DEVSLP_DETO = 0x01,
303 ATA_LOG_DEVSLP_VALID = 0x37, 305 ATA_LOG_DEVSLP_VALID = 0x07,
304 ATA_LOG_DEVSLP_VALID_MASK = 0x80, 306 ATA_LOG_DEVSLP_VALID_MASK = 0x80,
305 307
306 /* READ/WRITE LONG (obsolete) */ 308 /* READ/WRITE LONG (obsolete) */
diff --git a/include/linux/ata_platform.h b/include/linux/ata_platform.h
index fe9989636b62..b9fde17f767c 100644
--- a/include/linux/ata_platform.h
+++ b/include/linux/ata_platform.h
@@ -15,12 +15,12 @@ struct pata_platform_info {
15 unsigned int irq_flags; 15 unsigned int irq_flags;
16}; 16};
17 17
18extern int __devinit __pata_platform_probe(struct device *dev, 18extern int __pata_platform_probe(struct device *dev,
19 struct resource *io_res, 19 struct resource *io_res,
20 struct resource *ctl_res, 20 struct resource *ctl_res,
21 struct resource *irq_res, 21 struct resource *irq_res,
22 unsigned int ioport_shift, 22 unsigned int ioport_shift,
23 int __pio_mask); 23 int __pio_mask);
24 24
25/* 25/*
26 * Marvell SATA private data 26 * Marvell SATA private data
diff --git a/include/linux/audit.h b/include/linux/audit.h
index bce729afbcf9..5a6d718adf34 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -24,6 +24,7 @@
24#define _LINUX_AUDIT_H_ 24#define _LINUX_AUDIT_H_
25 25
26#include <linux/sched.h> 26#include <linux/sched.h>
27#include <linux/ptrace.h>
27#include <uapi/linux/audit.h> 28#include <uapi/linux/audit.h>
28 29
29struct audit_sig_info { 30struct audit_sig_info {
@@ -157,7 +158,8 @@ void audit_core_dumps(long signr);
157 158
158static inline void audit_seccomp(unsigned long syscall, long signr, int code) 159static inline void audit_seccomp(unsigned long syscall, long signr, int code)
159{ 160{
160 if (unlikely(!audit_dummy_context())) 161 /* Force a record to be reported if a signal was delivered. */
162 if (signr || unlikely(!audit_dummy_context()))
161 __audit_seccomp(syscall, signr, code); 163 __audit_seccomp(syscall, signr, code);
162} 164}
163 165
diff --git a/include/linux/bcma/bcma_driver_gmac_cmn.h b/include/linux/bcma/bcma_driver_gmac_cmn.h
index def894b83b0d..4dd1f33e36a2 100644
--- a/include/linux/bcma/bcma_driver_gmac_cmn.h
+++ b/include/linux/bcma/bcma_driver_gmac_cmn.h
@@ -92,7 +92,7 @@ struct bcma_drv_gmac_cmn {
92#define gmac_cmn_write32(gc, offset, val) bcma_write32((gc)->core, offset, val) 92#define gmac_cmn_write32(gc, offset, val) bcma_write32((gc)->core, offset, val)
93 93
94#ifdef CONFIG_BCMA_DRIVER_GMAC_CMN 94#ifdef CONFIG_BCMA_DRIVER_GMAC_CMN
95extern void __devinit bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc); 95extern void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc);
96#else 96#else
97static inline void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc) { } 97static inline void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc) { }
98#endif 98#endif
diff --git a/include/linux/bcma/bcma_driver_pci.h b/include/linux/bcma/bcma_driver_pci.h
index 41da581e1612..c48d98d27b77 100644
--- a/include/linux/bcma/bcma_driver_pci.h
+++ b/include/linux/bcma/bcma_driver_pci.h
@@ -214,7 +214,7 @@ struct bcma_drv_pci {
214#define pcicore_write16(pc, offset, val) bcma_write16((pc)->core, offset, val) 214#define pcicore_write16(pc, offset, val) bcma_write16((pc)->core, offset, val)
215#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val) 215#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val)
216 216
217extern void __devinit bcma_core_pci_init(struct bcma_drv_pci *pc); 217extern void bcma_core_pci_init(struct bcma_drv_pci *pc);
218extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, 218extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc,
219 struct bcma_device *core, bool enable); 219 struct bcma_device *core, bool enable);
220extern void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend); 220extern void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend);
diff --git a/include/linux/compaction.h b/include/linux/compaction.h
index 6ecb6dc2f303..cc7bddeaf553 100644
--- a/include/linux/compaction.h
+++ b/include/linux/compaction.h
@@ -22,7 +22,7 @@ extern int sysctl_extfrag_handler(struct ctl_table *table, int write,
22extern int fragmentation_index(struct zone *zone, unsigned int order); 22extern int fragmentation_index(struct zone *zone, unsigned int order);
23extern unsigned long try_to_compact_pages(struct zonelist *zonelist, 23extern unsigned long try_to_compact_pages(struct zonelist *zonelist,
24 int order, gfp_t gfp_mask, nodemask_t *mask, 24 int order, gfp_t gfp_mask, nodemask_t *mask,
25 bool sync, bool *contended, struct page **page); 25 bool sync, bool *contended);
26extern int compact_pgdat(pg_data_t *pgdat, int order); 26extern int compact_pgdat(pg_data_t *pgdat, int order);
27extern void reset_isolation_suitable(pg_data_t *pgdat); 27extern void reset_isolation_suitable(pg_data_t *pgdat);
28extern unsigned long compaction_suitable(struct zone *zone, int order); 28extern unsigned long compaction_suitable(struct zone *zone, int order);
@@ -75,7 +75,7 @@ static inline bool compaction_restarting(struct zone *zone, int order)
75#else 75#else
76static inline unsigned long try_to_compact_pages(struct zonelist *zonelist, 76static inline unsigned long try_to_compact_pages(struct zonelist *zonelist,
77 int order, gfp_t gfp_mask, nodemask_t *nodemask, 77 int order, gfp_t gfp_mask, nodemask_t *nodemask,
78 bool sync, bool *contended, struct page **page) 78 bool sync, bool *contended)
79{ 79{
80 return COMPACT_CONTINUE; 80 return COMPACT_CONTINUE;
81} 81}
diff --git a/include/linux/cpu_rmap.h b/include/linux/cpu_rmap.h
index ac3bbb5b9502..1739510d8994 100644
--- a/include/linux/cpu_rmap.h
+++ b/include/linux/cpu_rmap.h
@@ -13,9 +13,11 @@
13#include <linux/cpumask.h> 13#include <linux/cpumask.h>
14#include <linux/gfp.h> 14#include <linux/gfp.h>
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/kref.h>
16 17
17/** 18/**
18 * struct cpu_rmap - CPU affinity reverse-map 19 * struct cpu_rmap - CPU affinity reverse-map
20 * @refcount: kref for object
19 * @size: Number of objects to be reverse-mapped 21 * @size: Number of objects to be reverse-mapped
20 * @used: Number of objects added 22 * @used: Number of objects added
21 * @obj: Pointer to array of object pointers 23 * @obj: Pointer to array of object pointers
@@ -23,6 +25,7 @@
23 * based on affinity masks 25 * based on affinity masks
24 */ 26 */
25struct cpu_rmap { 27struct cpu_rmap {
28 struct kref refcount;
26 u16 size, used; 29 u16 size, used;
27 void **obj; 30 void **obj;
28 struct { 31 struct {
@@ -33,15 +36,7 @@ struct cpu_rmap {
33#define CPU_RMAP_DIST_INF 0xffff 36#define CPU_RMAP_DIST_INF 0xffff
34 37
35extern struct cpu_rmap *alloc_cpu_rmap(unsigned int size, gfp_t flags); 38extern struct cpu_rmap *alloc_cpu_rmap(unsigned int size, gfp_t flags);
36 39extern int cpu_rmap_put(struct cpu_rmap *rmap);
37/**
38 * free_cpu_rmap - free CPU affinity reverse-map
39 * @rmap: Reverse-map allocated with alloc_cpu_rmap(), or %NULL
40 */
41static inline void free_cpu_rmap(struct cpu_rmap *rmap)
42{
43 kfree(rmap);
44}
45 40
46extern int cpu_rmap_add(struct cpu_rmap *rmap, void *obj); 41extern int cpu_rmap_add(struct cpu_rmap *rmap, void *obj);
47extern int cpu_rmap_update(struct cpu_rmap *rmap, u16 index, 42extern int cpu_rmap_update(struct cpu_rmap *rmap, u16 index,
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 3711b34dc4f9..24cd1037b6d6 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -126,9 +126,9 @@ struct cpuidle_driver {
126 struct module *owner; 126 struct module *owner;
127 int refcnt; 127 int refcnt;
128 128
129 unsigned int power_specified:1;
130 /* set to 1 to use the core cpuidle time keeping (for all states). */ 129 /* set to 1 to use the core cpuidle time keeping (for all states). */
131 unsigned int en_core_tk_irqen:1; 130 unsigned int en_core_tk_irqen:1;
131 /* states array must be ordered in decreasing power consumption */
132 struct cpuidle_state states[CPUIDLE_STATE_MAX]; 132 struct cpuidle_state states[CPUIDLE_STATE_MAX];
133 int state_count; 133 int state_count;
134 int safe_state_index; 134 int safe_state_index;
diff --git a/include/linux/cred.h b/include/linux/cred.h
index abb2cd50f6b2..04421e825365 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -128,7 +128,6 @@ struct cred {
128 struct key *process_keyring; /* keyring private to this process */ 128 struct key *process_keyring; /* keyring private to this process */
129 struct key *thread_keyring; /* keyring private to this thread */ 129 struct key *thread_keyring; /* keyring private to this thread */
130 struct key *request_key_auth; /* assumed request_key authority */ 130 struct key *request_key_auth; /* assumed request_key authority */
131 struct thread_group_cred *tgcred; /* thread-group shared credentials */
132#endif 131#endif
133#ifdef CONFIG_SECURITY 132#ifdef CONFIG_SECURITY
134 void *security; /* subjective LSM security */ 133 void *security; /* subjective LSM security */
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 8b84916dc671..7a9498ab3c2d 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -618,18 +618,30 @@ extern int __init efi_setup_pcdp_console(char *);
618#endif 618#endif
619 619
620/* 620/*
621 * We play games with efi_enabled so that the compiler will, if possible, remove 621 * We play games with efi_enabled so that the compiler will, if
622 * EFI-related code altogether. 622 * possible, remove EFI-related code altogether.
623 */ 623 */
624#define EFI_BOOT 0 /* Were we booted from EFI? */
625#define EFI_SYSTEM_TABLES 1 /* Can we use EFI system tables? */
626#define EFI_CONFIG_TABLES 2 /* Can we use EFI config tables? */
627#define EFI_RUNTIME_SERVICES 3 /* Can we use runtime services? */
628#define EFI_MEMMAP 4 /* Can we use EFI memory map? */
629#define EFI_64BIT 5 /* Is the firmware 64-bit? */
630
624#ifdef CONFIG_EFI 631#ifdef CONFIG_EFI
625# ifdef CONFIG_X86 632# ifdef CONFIG_X86
626 extern int efi_enabled; 633extern int efi_enabled(int facility);
627 extern bool efi_64bit;
628# else 634# else
629# define efi_enabled 1 635static inline int efi_enabled(int facility)
636{
637 return 1;
638}
630# endif 639# endif
631#else 640#else
632# define efi_enabled 0 641static inline int efi_enabled(int facility)
642{
643 return 0;
644}
633#endif 645#endif
634 646
635/* 647/*
diff --git a/include/linux/hdlc/Kbuild b/include/linux/hdlc/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/linux/hdlc/Kbuild
+++ /dev/null
diff --git a/include/linux/hsi/Kbuild b/include/linux/hsi/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/linux/hsi/Kbuild
+++ /dev/null
diff --git a/include/linux/init.h b/include/linux/init.h
index a799273714ac..10ed4f436458 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -93,14 +93,6 @@
93 93
94#define __exit __section(.exit.text) __exitused __cold notrace 94#define __exit __section(.exit.text) __exitused __cold notrace
95 95
96/* Used for HOTPLUG, but that is always enabled now, so just make them noops */
97#define __devinit
98#define __devinitdata
99#define __devinitconst
100#define __devexit
101#define __devexitdata
102#define __devexitconst
103
104/* Used for HOTPLUG_CPU */ 96/* Used for HOTPLUG_CPU */
105#define __cpuinit __section(.cpuinit.text) __cold notrace 97#define __cpuinit __section(.cpuinit.text) __cold notrace
106#define __cpuinitdata __section(.cpuinit.data) 98#define __cpuinitdata __section(.cpuinit.data)
@@ -337,18 +329,6 @@ void __init parse_early_options(char *cmdline);
337#define __INITRODATA_OR_MODULE __INITRODATA 329#define __INITRODATA_OR_MODULE __INITRODATA
338#endif /*CONFIG_MODULES*/ 330#endif /*CONFIG_MODULES*/
339 331
340/* Functions marked as __devexit may be discarded at kernel link time, depending
341 on config options. Newer versions of binutils detect references from
342 retained sections to discarded sections and flag an error. Pointers to
343 __devexit functions must use __devexit_p(function_name), the wrapper will
344 insert either the function_name or NULL, depending on the config options.
345 */
346#if defined(MODULE) || defined(CONFIG_HOTPLUG)
347#define __devexit_p(x) x
348#else
349#define __devexit_p(x) NULL
350#endif
351
352#ifdef MODULE 332#ifdef MODULE
353#define __exit_p(x) x 333#define __exit_p(x) x
354#else 334#else
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 5e4e6170f43a..5fa5afeeb759 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -268,11 +268,6 @@ struct irq_affinity_notify {
268extern int 268extern int
269irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify); 269irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify);
270 270
271static inline void irq_run_affinity_notifiers(void)
272{
273 flush_scheduled_work();
274}
275
276#else /* CONFIG_SMP */ 271#else /* CONFIG_SMP */
277 272
278static inline int irq_set_affinity(unsigned int irq, const struct cpumask *m) 273static inline int irq_set_affinity(unsigned int irq, const struct cpumask *m)
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index fe771978e877..ae221a7b5092 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -24,6 +24,7 @@ struct ipc_ids {
24 unsigned short seq_max; 24 unsigned short seq_max;
25 struct rw_semaphore rw_mutex; 25 struct rw_semaphore rw_mutex;
26 struct idr ipcs_idr; 26 struct idr ipcs_idr;
27 int next_id;
27}; 28};
28 29
29struct ipc_namespace { 30struct ipc_namespace {
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 1be23d9fdacb..e30b66346942 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -1098,7 +1098,7 @@ void jbd2_journal_set_triggers(struct buffer_head *,
1098extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *); 1098extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *);
1099extern int jbd2_journal_forget (handle_t *, struct buffer_head *); 1099extern int jbd2_journal_forget (handle_t *, struct buffer_head *);
1100extern void journal_sync_buffer (struct buffer_head *); 1100extern void journal_sync_buffer (struct buffer_head *);
1101extern void jbd2_journal_invalidatepage(journal_t *, 1101extern int jbd2_journal_invalidatepage(journal_t *,
1102 struct page *, unsigned long); 1102 struct page *, unsigned long);
1103extern int jbd2_journal_try_to_free_buffers(journal_t *, struct page *, gfp_t); 1103extern int jbd2_journal_try_to_free_buffers(journal_t *, struct page *, gfp_t);
1104extern int jbd2_journal_stop(handle_t *); 1104extern int jbd2_journal_stop(handle_t *);
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 83ba0ab2c915..649e5f86b5f0 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -652,8 +652,8 @@ struct ata_device {
652 u32 gscr[SATA_PMP_GSCR_DWORDS]; /* PMP GSCR block */ 652 u32 gscr[SATA_PMP_GSCR_DWORDS]; /* PMP GSCR block */
653 }; 653 };
654 654
655 /* Identify Device Data Log (30h), SATA Settings (page 08h) */ 655 /* DEVSLP Timing Variables from Identify Device Data Log */
656 u8 sata_settings[ATA_SECT_SIZE]; 656 u8 devslp_timing[ATA_LOG_DEVSLP_SIZE];
657 657
658 /* error history */ 658 /* error history */
659 int spdn_cnt; 659 int spdn_cnt;
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 00e46376e28f..2bca44b0893c 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -524,14 +524,17 @@ static inline void print_irqtrace_events(struct task_struct *curr)
524#ifdef CONFIG_DEBUG_LOCK_ALLOC 524#ifdef CONFIG_DEBUG_LOCK_ALLOC
525# ifdef CONFIG_PROVE_LOCKING 525# ifdef CONFIG_PROVE_LOCKING
526# define rwsem_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, NULL, i) 526# define rwsem_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, NULL, i)
527# define rwsem_acquire_nest(l, s, t, n, i) lock_acquire(l, s, t, 0, 2, n, i)
527# define rwsem_acquire_read(l, s, t, i) lock_acquire(l, s, t, 1, 2, NULL, i) 528# define rwsem_acquire_read(l, s, t, i) lock_acquire(l, s, t, 1, 2, NULL, i)
528# else 529# else
529# define rwsem_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, NULL, i) 530# define rwsem_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, NULL, i)
531# define rwsem_acquire_nest(l, s, t, n, i) lock_acquire(l, s, t, 0, 1, n, i)
530# define rwsem_acquire_read(l, s, t, i) lock_acquire(l, s, t, 1, 1, NULL, i) 532# define rwsem_acquire_read(l, s, t, i) lock_acquire(l, s, t, 1, 1, NULL, i)
531# endif 533# endif
532# define rwsem_release(l, n, i) lock_release(l, n, i) 534# define rwsem_release(l, n, i) lock_release(l, n, i)
533#else 535#else
534# define rwsem_acquire(l, s, t, i) do { } while (0) 536# define rwsem_acquire(l, s, t, i) do { } while (0)
537# define rwsem_acquire_nest(l, s, t, n, i) do { } while (0)
535# define rwsem_acquire_read(l, s, t, i) do { } while (0) 538# define rwsem_acquire_read(l, s, t, i) do { } while (0)
536# define rwsem_release(l, n, i) do { } while (0) 539# define rwsem_release(l, n, i) do { } while (0)
537#endif 540#endif
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 9adc270de7ef..0d7df39a5885 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -123,7 +123,7 @@ struct sp_node {
123 123
124struct shared_policy { 124struct shared_policy {
125 struct rb_root root; 125 struct rb_root root;
126 struct mutex mutex; 126 spinlock_t lock;
127}; 127};
128 128
129void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol); 129void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol);
@@ -165,11 +165,10 @@ int do_migrate_pages(struct mm_struct *mm, const nodemask_t *from,
165 165
166 166
167#ifdef CONFIG_TMPFS 167#ifdef CONFIG_TMPFS
168extern int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context); 168extern int mpol_parse_str(char *str, struct mempolicy **mpol);
169#endif 169#endif
170 170
171extern int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, 171extern int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol);
172 int no_context);
173 172
174/* Check if a vma is migratable */ 173/* Check if a vma is migratable */
175static inline int vma_migratable(struct vm_area_struct *vma) 174static inline int vma_migratable(struct vm_area_struct *vma)
@@ -296,15 +295,13 @@ static inline void check_highest_zone(int k)
296} 295}
297 296
298#ifdef CONFIG_TMPFS 297#ifdef CONFIG_TMPFS
299static inline int mpol_parse_str(char *str, struct mempolicy **mpol, 298static inline int mpol_parse_str(char *str, struct mempolicy **mpol)
300 int no_context)
301{ 299{
302 return 1; /* error */ 300 return 1; /* error */
303} 301}
304#endif 302#endif
305 303
306static inline int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, 304static inline int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol)
307 int no_context)
308{ 305{
309 return 0; 306 return 0;
310} 307}
diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h
index 2138bd33021a..e53dcfeaee69 100644
--- a/include/linux/mfd/abx500.h
+++ b/include/linux/mfd/abx500.h
@@ -272,8 +272,6 @@ struct abx500_bm_data {
272 const struct abx500_fg_parameters *fg_params; 272 const struct abx500_fg_parameters *fg_params;
273}; 273};
274 274
275extern struct abx500_bm_data ab8500_bm_data;
276
277enum { 275enum {
278 NTC_EXTERNAL = 0, 276 NTC_EXTERNAL = 0,
279 NTC_INTERNAL, 277 NTC_INTERNAL,
diff --git a/include/linux/mfd/abx500/ab8500-bm.h b/include/linux/mfd/abx500/ab8500-bm.h
index 44310c98ee6e..9bd037df97d9 100644
--- a/include/linux/mfd/abx500/ab8500-bm.h
+++ b/include/linux/mfd/abx500/ab8500-bm.h
@@ -422,7 +422,10 @@ struct ab8500_chargalg_platform_data {
422struct ab8500_btemp; 422struct ab8500_btemp;
423struct ab8500_gpadc; 423struct ab8500_gpadc;
424struct ab8500_fg; 424struct ab8500_fg;
425
425#ifdef CONFIG_AB8500_BM 426#ifdef CONFIG_AB8500_BM
427extern struct abx500_bm_data ab8500_bm_data;
428
426void ab8500_fg_reinit(void); 429void ab8500_fg_reinit(void);
427void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA); 430void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA);
428struct ab8500_btemp *ab8500_btemp_get(void); 431struct ab8500_btemp *ab8500_btemp_get(void);
@@ -434,31 +437,7 @@ int ab8500_fg_inst_curr_finalize(struct ab8500_fg *di, int *res);
434int ab8500_fg_inst_curr_done(struct ab8500_fg *di); 437int ab8500_fg_inst_curr_done(struct ab8500_fg *di);
435 438
436#else 439#else
437int ab8500_fg_inst_curr_done(struct ab8500_fg *di) 440static struct abx500_bm_data ab8500_bm_data;
438{
439}
440static void ab8500_fg_reinit(void)
441{
442}
443static void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA)
444{
445}
446static struct ab8500_btemp *ab8500_btemp_get(void)
447{
448 return NULL;
449}
450static int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp)
451{
452 return 0;
453}
454struct ab8500_fg *ab8500_fg_get(void)
455{
456 return NULL;
457}
458static int ab8500_fg_inst_curr_blocking(struct ab8500_fg *dev)
459{
460 return -ENODEV;
461}
462 441
463static inline int ab8500_fg_inst_curr_start(struct ab8500_fg *di) 442static inline int ab8500_fg_inst_curr_start(struct ab8500_fg *di)
464{ 443{
diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
index 86dd93de6ff2..786d02eb79d2 100644
--- a/include/linux/mfd/da9052/da9052.h
+++ b/include/linux/mfd/da9052/da9052.h
@@ -99,6 +99,9 @@ struct da9052 {
99 u8 chip_id; 99 u8 chip_id;
100 100
101 int chip_irq; 101 int chip_irq;
102
103 /* SOC I/O transfer related fixes for DA9052/53 */
104 int (*fix_io) (struct da9052 *da9052, unsigned char reg);
102}; 105};
103 106
104/* ADC API */ 107/* ADC API */
@@ -113,32 +116,87 @@ static inline int da9052_reg_read(struct da9052 *da9052, unsigned char reg)
113 ret = regmap_read(da9052->regmap, reg, &val); 116 ret = regmap_read(da9052->regmap, reg, &val);
114 if (ret < 0) 117 if (ret < 0)
115 return ret; 118 return ret;
119
120 if (da9052->fix_io) {
121 ret = da9052->fix_io(da9052, reg);
122 if (ret < 0)
123 return ret;
124 }
125
116 return val; 126 return val;
117} 127}
118 128
119static inline int da9052_reg_write(struct da9052 *da9052, unsigned char reg, 129static inline int da9052_reg_write(struct da9052 *da9052, unsigned char reg,
120 unsigned char val) 130 unsigned char val)
121{ 131{
122 return regmap_write(da9052->regmap, reg, val); 132 int ret;
133
134 ret = regmap_write(da9052->regmap, reg, val);
135 if (ret < 0)
136 return ret;
137
138 if (da9052->fix_io) {
139 ret = da9052->fix_io(da9052, reg);
140 if (ret < 0)
141 return ret;
142 }
143
144 return ret;
123} 145}
124 146
125static inline int da9052_group_read(struct da9052 *da9052, unsigned char reg, 147static inline int da9052_group_read(struct da9052 *da9052, unsigned char reg,
126 unsigned reg_cnt, unsigned char *val) 148 unsigned reg_cnt, unsigned char *val)
127{ 149{
128 return regmap_bulk_read(da9052->regmap, reg, val, reg_cnt); 150 int ret;
151
152 ret = regmap_bulk_read(da9052->regmap, reg, val, reg_cnt);
153 if (ret < 0)
154 return ret;
155
156 if (da9052->fix_io) {
157 ret = da9052->fix_io(da9052, reg);
158 if (ret < 0)
159 return ret;
160 }
161
162 return ret;
129} 163}
130 164
131static inline int da9052_group_write(struct da9052 *da9052, unsigned char reg, 165static inline int da9052_group_write(struct da9052 *da9052, unsigned char reg,
132 unsigned reg_cnt, unsigned char *val) 166 unsigned reg_cnt, unsigned char *val)
133{ 167{
134 return regmap_raw_write(da9052->regmap, reg, val, reg_cnt); 168 int ret;
169
170 ret = regmap_raw_write(da9052->regmap, reg, val, reg_cnt);
171 if (ret < 0)
172 return ret;
173
174 if (da9052->fix_io) {
175 ret = da9052->fix_io(da9052, reg);
176 if (ret < 0)
177 return ret;
178 }
179
180 return ret;
135} 181}
136 182
137static inline int da9052_reg_update(struct da9052 *da9052, unsigned char reg, 183static inline int da9052_reg_update(struct da9052 *da9052, unsigned char reg,
138 unsigned char bit_mask, 184 unsigned char bit_mask,
139 unsigned char reg_val) 185 unsigned char reg_val)
140{ 186{
141 return regmap_update_bits(da9052->regmap, reg, bit_mask, reg_val); 187 int ret;
188
189 ret = regmap_update_bits(da9052->regmap, reg, bit_mask, reg_val);
190 if (ret < 0)
191 return ret;
192
193 if (da9052->fix_io) {
194 ret = da9052->fix_io(da9052, reg);
195 if (ret < 0)
196 return ret;
197 }
198
199 return ret;
142} 200}
143 201
144int da9052_device_init(struct da9052 *da9052, u8 chip_id); 202int da9052_device_init(struct da9052 *da9052, u8 chip_id);
diff --git a/include/linux/mfd/da9052/reg.h b/include/linux/mfd/da9052/reg.h
index b97f7309d7f6..c4dd3a8add21 100644
--- a/include/linux/mfd/da9052/reg.h
+++ b/include/linux/mfd/da9052/reg.h
@@ -34,6 +34,9 @@
34#define DA9052_STATUS_C_REG 3 34#define DA9052_STATUS_C_REG 3
35#define DA9052_STATUS_D_REG 4 35#define DA9052_STATUS_D_REG 4
36 36
37/* PARK REGISTER */
38#define DA9052_PARK_REGISTER DA9052_STATUS_D_REG
39
37/* EVENT REGISTERS */ 40/* EVENT REGISTERS */
38#define DA9052_EVENT_A_REG 5 41#define DA9052_EVENT_A_REG 5
39#define DA9052_EVENT_B_REG 6 42#define DA9052_EVENT_B_REG 6
diff --git a/include/linux/mfd/rtsx_common.h b/include/linux/mfd/rtsx_common.h
index a8d393e3066b..2b13970596f5 100644
--- a/include/linux/mfd/rtsx_common.h
+++ b/include/linux/mfd/rtsx_common.h
@@ -38,6 +38,9 @@
38#define RTSX_SD_CARD 0 38#define RTSX_SD_CARD 0
39#define RTSX_MS_CARD 1 39#define RTSX_MS_CARD 1
40 40
41#define CLK_TO_DIV_N 0
42#define DIV_N_TO_CLK 1
43
41struct platform_device; 44struct platform_device;
42 45
43struct rtsx_slot { 46struct rtsx_slot {
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index 060b721fcbfb..4b117a3f54d4 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -158,10 +158,9 @@
158#define SG_TRANS_DATA (0x02 << 4) 158#define SG_TRANS_DATA (0x02 << 4)
159#define SG_LINK_DESC (0x03 << 4) 159#define SG_LINK_DESC (0x03 << 4)
160 160
161/* SD bank voltage */ 161/* Output voltage */
162#define SD_IO_3V3 0 162#define OUTPUT_3V3 0
163#define SD_IO_1V8 1 163#define OUTPUT_1V8 1
164
165 164
166/* Card Clock Enable Register */ 165/* Card Clock Enable Register */
167#define SD_CLK_EN 0x04 166#define SD_CLK_EN 0x04
@@ -201,6 +200,20 @@
201#define CHANGE_CLK 0x01 200#define CHANGE_CLK 0x01
202 201
203/* LDO_CTL */ 202/* LDO_CTL */
203#define BPP_ASIC_1V7 0x00
204#define BPP_ASIC_1V8 0x01
205#define BPP_ASIC_1V9 0x02
206#define BPP_ASIC_2V0 0x03
207#define BPP_ASIC_2V7 0x04
208#define BPP_ASIC_2V8 0x05
209#define BPP_ASIC_3V2 0x06
210#define BPP_ASIC_3V3 0x07
211#define BPP_REG_TUNED18 0x07
212#define BPP_TUNED18_SHIFT_8402 5
213#define BPP_TUNED18_SHIFT_8411 4
214#define BPP_PAD_MASK 0x04
215#define BPP_PAD_3V3 0x04
216#define BPP_PAD_1V8 0x00
204#define BPP_LDO_POWB 0x03 217#define BPP_LDO_POWB 0x03
205#define BPP_LDO_ON 0x00 218#define BPP_LDO_ON 0x00
206#define BPP_LDO_SUSPEND 0x02 219#define BPP_LDO_SUSPEND 0x02
@@ -688,7 +701,10 @@ struct pcr_ops {
688 int (*disable_auto_blink)(struct rtsx_pcr *pcr); 701 int (*disable_auto_blink)(struct rtsx_pcr *pcr);
689 int (*card_power_on)(struct rtsx_pcr *pcr, int card); 702 int (*card_power_on)(struct rtsx_pcr *pcr, int card);
690 int (*card_power_off)(struct rtsx_pcr *pcr, int card); 703 int (*card_power_off)(struct rtsx_pcr *pcr, int card);
704 int (*switch_output_voltage)(struct rtsx_pcr *pcr,
705 u8 voltage);
691 unsigned int (*cd_deglitch)(struct rtsx_pcr *pcr); 706 unsigned int (*cd_deglitch)(struct rtsx_pcr *pcr);
707 int (*conv_clk_and_div_n)(int clk, int dir);
692}; 708};
693 709
694enum PDEV_STAT {PDEV_STAT_IDLE, PDEV_STAT_RUN}; 710enum PDEV_STAT {PDEV_STAT_IDLE, PDEV_STAT_RUN};
@@ -783,6 +799,7 @@ int rtsx_pci_switch_clock(struct rtsx_pcr *pcr, unsigned int card_clock,
783 u8 ssc_depth, bool initial_mode, bool double_clk, bool vpclk); 799 u8 ssc_depth, bool initial_mode, bool double_clk, bool vpclk);
784int rtsx_pci_card_power_on(struct rtsx_pcr *pcr, int card); 800int rtsx_pci_card_power_on(struct rtsx_pcr *pcr, int card);
785int rtsx_pci_card_power_off(struct rtsx_pcr *pcr, int card); 801int rtsx_pci_card_power_off(struct rtsx_pcr *pcr, int card);
802int rtsx_pci_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage);
786unsigned int rtsx_pci_card_exist(struct rtsx_pcr *pcr); 803unsigned int rtsx_pci_card_exist(struct rtsx_pcr *pcr);
787void rtsx_pci_complete_unfinished_transfer(struct rtsx_pcr *pcr); 804void rtsx_pci_complete_unfinished_transfer(struct rtsx_pcr *pcr);
788 805
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 63204078f72b..66e2f7c61e5c 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -455,7 +455,6 @@ void put_pages_list(struct list_head *pages);
455 455
456void split_page(struct page *page, unsigned int order); 456void split_page(struct page *page, unsigned int order);
457int split_free_page(struct page *page); 457int split_free_page(struct page *page);
458int capture_free_page(struct page *page, int alloc_order, int migratetype);
459 458
460/* 459/*
461 * Compound pages have a destructor function. Provide a 460 * Compound pages have a destructor function. Provide a
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 4bec5be82cab..73b64a38b984 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -503,14 +503,6 @@ struct zone {
503 * rarely used fields: 503 * rarely used fields:
504 */ 504 */
505 const char *name; 505 const char *name;
506#ifdef CONFIG_MEMORY_ISOLATION
507 /*
508 * the number of MIGRATE_ISOLATE *pageblock*.
509 * We need this for free page counting. Look at zone_watermark_ok_safe.
510 * It's protected by zone->lock
511 */
512 int nr_pageblock_isolate;
513#endif
514} ____cacheline_internodealigned_in_smp; 506} ____cacheline_internodealigned_in_smp;
515 507
516typedef enum { 508typedef enum {
diff --git a/include/linux/module.h b/include/linux/module.h
index 7760c6d344a3..1375ee3f03aa 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -199,11 +199,11 @@ struct module_use {
199 struct module *source, *target; 199 struct module *source, *target;
200}; 200};
201 201
202enum module_state 202enum module_state {
203{ 203 MODULE_STATE_LIVE, /* Normal state. */
204 MODULE_STATE_LIVE, 204 MODULE_STATE_COMING, /* Full formed, running module_init. */
205 MODULE_STATE_COMING, 205 MODULE_STATE_GOING, /* Going away. */
206 MODULE_STATE_GOING, 206 MODULE_STATE_UNFORMED, /* Still setting it up. */
207}; 207};
208 208
209/** 209/**
diff --git a/include/linux/msg.h b/include/linux/msg.h
index 7a4b9e97d29a..391af8d11cce 100644
--- a/include/linux/msg.h
+++ b/include/linux/msg.h
@@ -34,7 +34,9 @@ struct msg_queue {
34/* Helper routines for sys_msgsnd and sys_msgrcv */ 34/* Helper routines for sys_msgsnd and sys_msgrcv */
35extern long do_msgsnd(int msqid, long mtype, void __user *mtext, 35extern long do_msgsnd(int msqid, long mtype, void __user *mtext,
36 size_t msgsz, int msgflg); 36 size_t msgsz, int msgflg);
37extern long do_msgrcv(int msqid, long *pmtype, void __user *mtext, 37extern long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp,
38 size_t msgsz, long msgtyp, int msgflg); 38 int msgflg,
39 long (*msg_fill)(void __user *, struct msg_msg *,
40 size_t));
39 41
40#endif /* _LINUX_MSG_H */ 42#endif /* _LINUX_MSG_H */
diff --git a/include/linux/namei.h b/include/linux/namei.h
index e998c030061d..5a5ff57ceed4 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -2,6 +2,7 @@
2#define _LINUX_NAMEI_H 2#define _LINUX_NAMEI_H
3 3
4#include <linux/dcache.h> 4#include <linux/dcache.h>
5#include <linux/errno.h>
5#include <linux/linkage.h> 6#include <linux/linkage.h>
6#include <linux/path.h> 7#include <linux/path.h>
7 8
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 02e0f6b156c3..9ef07d0868b6 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -60,6 +60,9 @@ struct wireless_dev;
60#define SET_ETHTOOL_OPS(netdev,ops) \ 60#define SET_ETHTOOL_OPS(netdev,ops) \
61 ( (netdev)->ethtool_ops = (ops) ) 61 ( (netdev)->ethtool_ops = (ops) )
62 62
63extern void netdev_set_default_ethtool_ops(struct net_device *dev,
64 const struct ethtool_ops *ops);
65
63/* hardware address assignment types */ 66/* hardware address assignment types */
64#define NET_ADDR_PERM 0 /* address is permanent (default) */ 67#define NET_ADDR_PERM 0 /* address is permanent (default) */
65#define NET_ADDR_RANDOM 1 /* address is generated randomly */ 68#define NET_ADDR_RANDOM 1 /* address is generated randomly */
@@ -1576,7 +1579,7 @@ extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
1576 1579
1577extern rwlock_t dev_base_lock; /* Device list lock */ 1580extern rwlock_t dev_base_lock; /* Device list lock */
1578 1581
1579extern seqlock_t devnet_rename_seq; /* Device rename lock */ 1582extern seqcount_t devnet_rename_seq; /* Device rename seq */
1580 1583
1581 1584
1582#define for_each_netdev(net, d) \ 1585#define for_each_netdev(net, d) \
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index b5d13841604e..70473da47b3f 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -362,7 +362,7 @@ static inline void ClearPageCompound(struct page *page)
362 * pages on the LRU and/or pagecache. 362 * pages on the LRU and/or pagecache.
363 */ 363 */
364TESTPAGEFLAG(Compound, compound) 364TESTPAGEFLAG(Compound, compound)
365__PAGEFLAG(Head, compound) 365__SETPAGEFLAG(Head, compound) __CLEARPAGEFLAG(Head, compound)
366 366
367/* 367/*
368 * PG_reclaim is used in combination with PG_compound to mark the 368 * PG_reclaim is used in combination with PG_compound to mark the
@@ -374,8 +374,14 @@ __PAGEFLAG(Head, compound)
374 * PG_compound & PG_reclaim => Tail page 374 * PG_compound & PG_reclaim => Tail page
375 * PG_compound & ~PG_reclaim => Head page 375 * PG_compound & ~PG_reclaim => Head page
376 */ 376 */
377#define PG_head_mask ((1L << PG_compound))
377#define PG_head_tail_mask ((1L << PG_compound) | (1L << PG_reclaim)) 378#define PG_head_tail_mask ((1L << PG_compound) | (1L << PG_reclaim))
378 379
380static inline int PageHead(struct page *page)
381{
382 return ((page->flags & PG_head_tail_mask) == PG_head_mask);
383}
384
379static inline int PageTail(struct page *page) 385static inline int PageTail(struct page *page)
380{ 386{
381 return ((page->flags & PG_head_tail_mask) == PG_head_tail_mask); 387 return ((page->flags & PG_head_tail_mask) == PG_head_tail_mask);
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 0f8447376ddb..0eb65796bcb9 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1568,6 +1568,7 @@
1568#define PCI_DEVICE_ID_RICOH_RL5C476 0x0476 1568#define PCI_DEVICE_ID_RICOH_RL5C476 0x0476
1569#define PCI_DEVICE_ID_RICOH_RL5C478 0x0478 1569#define PCI_DEVICE_ID_RICOH_RL5C478 0x0478
1570#define PCI_DEVICE_ID_RICOH_R5C822 0x0822 1570#define PCI_DEVICE_ID_RICOH_R5C822 0x0822
1571#define PCI_DEVICE_ID_RICOH_R5CE822 0xe822
1571#define PCI_DEVICE_ID_RICOH_R5CE823 0xe823 1572#define PCI_DEVICE_ID_RICOH_R5CE823 0xe823
1572#define PCI_DEVICE_ID_RICOH_R5C832 0x0832 1573#define PCI_DEVICE_ID_RICOH_R5C832 0x0832
1573#define PCI_DEVICE_ID_RICOH_R5C843 0x0843 1574#define PCI_DEVICE_ID_RICOH_R5C843 0x0843
diff --git a/include/linux/pid.h b/include/linux/pid.h
index b152d44fb181..2381c973d897 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -121,6 +121,7 @@ int next_pidmap(struct pid_namespace *pid_ns, unsigned int last);
121 121
122extern struct pid *alloc_pid(struct pid_namespace *ns); 122extern struct pid *alloc_pid(struct pid_namespace *ns);
123extern void free_pid(struct pid *pid); 123extern void free_pid(struct pid *pid);
124extern void disable_pid_allocation(struct pid_namespace *ns);
124 125
125/* 126/*
126 * ns_of_pid() returns the pid namespace in which the specified pid was 127 * ns_of_pid() returns the pid namespace in which the specified pid was
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index bf285999273a..215e5e3dda10 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -21,7 +21,7 @@ struct pid_namespace {
21 struct kref kref; 21 struct kref kref;
22 struct pidmap pidmap[PIDMAP_ENTRIES]; 22 struct pidmap pidmap[PIDMAP_ENTRIES];
23 int last_pid; 23 int last_pid;
24 int nr_hashed; 24 unsigned int nr_hashed;
25 struct task_struct *child_reaper; 25 struct task_struct *child_reaper;
26 struct kmem_cache *pid_cachep; 26 struct kmem_cache *pid_cachep;
27 unsigned int level; 27 unsigned int level;
@@ -42,6 +42,8 @@ struct pid_namespace {
42 42
43extern struct pid_namespace init_pid_ns; 43extern struct pid_namespace init_pid_ns;
44 44
45#define PIDNS_HASH_ADDING (1U << 31)
46
45#ifdef CONFIG_PID_NS 47#ifdef CONFIG_PID_NS
46static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns) 48static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
47{ 49{
diff --git a/arch/arm/mach-imx/iram.h b/include/linux/platform_data/imx-iram.h
index 022690c33702..022690c33702 100644
--- a/arch/arm/mach-imx/iram.h
+++ b/include/linux/platform_data/imx-iram.h
diff --git a/include/linux/pstore_ram.h b/include/linux/pstore_ram.h
index 098d2a838296..cb6ab5feab67 100644
--- a/include/linux/pstore_ram.h
+++ b/include/linux/pstore_ram.h
@@ -46,9 +46,8 @@ struct persistent_ram_zone {
46 size_t old_log_size; 46 size_t old_log_size;
47}; 47};
48 48
49struct persistent_ram_zone * __devinit persistent_ram_new(phys_addr_t start, 49struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size,
50 size_t size, u32 sig, 50 u32 sig, int ecc_size);
51 int ecc_size);
52void persistent_ram_free(struct persistent_ram_zone *prz); 51void persistent_ram_free(struct persistent_ram_zone *prz);
53void persistent_ram_zap(struct persistent_ram_zone *prz); 52void persistent_ram_zap(struct persistent_ram_zone *prz);
54 53
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 1693775ecfe8..89573a33ab3c 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -45,7 +45,6 @@ extern long arch_ptrace(struct task_struct *child, long request,
45extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len); 45extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len);
46extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len); 46extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len);
47extern void ptrace_disable(struct task_struct *); 47extern void ptrace_disable(struct task_struct *);
48extern int ptrace_check_attach(struct task_struct *task, bool ignore_state);
49extern int ptrace_request(struct task_struct *child, long request, 48extern int ptrace_request(struct task_struct *child, long request,
50 unsigned long addr, unsigned long data); 49 unsigned long addr, unsigned long data);
51extern void ptrace_notify(int exit_code); 50extern void ptrace_notify(int exit_code);
diff --git a/include/linux/raid/Kbuild b/include/linux/raid/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/linux/raid/Kbuild
+++ /dev/null
diff --git a/include/linux/rbtree_augmented.h b/include/linux/rbtree_augmented.h
index 2ac60c9cf644..fea49b5da12a 100644
--- a/include/linux/rbtree_augmented.h
+++ b/include/linux/rbtree_augmented.h
@@ -123,9 +123,9 @@ __rb_change_child(struct rb_node *old, struct rb_node *new,
123extern void __rb_erase_color(struct rb_node *parent, struct rb_root *root, 123extern void __rb_erase_color(struct rb_node *parent, struct rb_root *root,
124 void (*augment_rotate)(struct rb_node *old, struct rb_node *new)); 124 void (*augment_rotate)(struct rb_node *old, struct rb_node *new));
125 125
126static __always_inline void 126static __always_inline struct rb_node *
127rb_erase_augmented(struct rb_node *node, struct rb_root *root, 127__rb_erase_augmented(struct rb_node *node, struct rb_root *root,
128 const struct rb_augment_callbacks *augment) 128 const struct rb_augment_callbacks *augment)
129{ 129{
130 struct rb_node *child = node->rb_right, *tmp = node->rb_left; 130 struct rb_node *child = node->rb_right, *tmp = node->rb_left;
131 struct rb_node *parent, *rebalance; 131 struct rb_node *parent, *rebalance;
@@ -217,6 +217,14 @@ rb_erase_augmented(struct rb_node *node, struct rb_root *root,
217 } 217 }
218 218
219 augment->propagate(tmp, NULL); 219 augment->propagate(tmp, NULL);
220 return rebalance;
221}
222
223static __always_inline void
224rb_erase_augmented(struct rb_node *node, struct rb_root *root,
225 const struct rb_augment_callbacks *augment)
226{
227 struct rb_node *rebalance = __rb_erase_augmented(node, root, augment);
220 if (rebalance) 228 if (rebalance)
221 __rb_erase_color(rebalance, root, augment->rotate); 229 __rb_erase_color(rebalance, root, augment->rotate);
222} 230}
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index 54bd7cd7ecbd..8da67d625e13 100644
--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -125,8 +125,17 @@ extern void downgrade_write(struct rw_semaphore *sem);
125 */ 125 */
126extern void down_read_nested(struct rw_semaphore *sem, int subclass); 126extern void down_read_nested(struct rw_semaphore *sem, int subclass);
127extern void down_write_nested(struct rw_semaphore *sem, int subclass); 127extern void down_write_nested(struct rw_semaphore *sem, int subclass);
128extern void _down_write_nest_lock(struct rw_semaphore *sem, struct lockdep_map *nest_lock);
129
130# define down_write_nest_lock(sem, nest_lock) \
131do { \
132 typecheck(struct lockdep_map *, &(nest_lock)->dep_map); \
133 _down_write_nest_lock(sem, &(nest_lock)->dep_map); \
134} while (0);
135
128#else 136#else
129# define down_read_nested(sem, subclass) down_read(sem) 137# define down_read_nested(sem, subclass) down_read(sem)
138# define down_write_nest_lock(sem, nest_lock) down_write(sem)
130# define down_write_nested(sem, subclass) down_write(sem) 139# define down_write_nested(sem, subclass) down_write(sem)
131#endif 140#endif
132 141
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 206bb089c06b..d2112477ff5e 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1810,6 +1810,7 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut,
1810#define PF_MEMALLOC 0x00000800 /* Allocating memory */ 1810#define PF_MEMALLOC 0x00000800 /* Allocating memory */
1811#define PF_NPROC_EXCEEDED 0x00001000 /* set_user noticed that RLIMIT_NPROC was exceeded */ 1811#define PF_NPROC_EXCEEDED 0x00001000 /* set_user noticed that RLIMIT_NPROC was exceeded */
1812#define PF_USED_MATH 0x00002000 /* if unset the fpu must be initialized before use */ 1812#define PF_USED_MATH 0x00002000 /* if unset the fpu must be initialized before use */
1813#define PF_USED_ASYNC 0x00004000 /* used async_schedule*(), used by module init */
1813#define PF_NOFREEZE 0x00008000 /* this thread should not be frozen */ 1814#define PF_NOFREEZE 0x00008000 /* this thread should not be frozen */
1814#define PF_FROZEN 0x00010000 /* frozen for system suspend */ 1815#define PF_FROZEN 0x00010000 /* frozen for system suspend */
1815#define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */ 1816#define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */
@@ -2713,7 +2714,16 @@ static inline void thread_group_cputime_init(struct signal_struct *sig)
2713extern void recalc_sigpending_and_wake(struct task_struct *t); 2714extern void recalc_sigpending_and_wake(struct task_struct *t);
2714extern void recalc_sigpending(void); 2715extern void recalc_sigpending(void);
2715 2716
2716extern void signal_wake_up(struct task_struct *t, int resume_stopped); 2717extern void signal_wake_up_state(struct task_struct *t, unsigned int state);
2718
2719static inline void signal_wake_up(struct task_struct *t, bool resume)
2720{
2721 signal_wake_up_state(t, resume ? TASK_WAKEKILL : 0);
2722}
2723static inline void ptrace_signal_wake_up(struct task_struct *t, bool resume)
2724{
2725 signal_wake_up_state(t, resume ? __TASK_TRACED : 0);
2726}
2717 2727
2718/* 2728/*
2719 * Wrappers for p->thread_info->cpu access. No-op on UP. 2729 * Wrappers for p->thread_info->cpu access. No-op on UP.
diff --git a/include/linux/security.h b/include/linux/security.h
index 0f6afc657f77..eee7478cda70 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -989,17 +989,29 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
989 * tells the LSM to decrement the number of secmark labeling rules loaded 989 * tells the LSM to decrement the number of secmark labeling rules loaded
990 * @req_classify_flow: 990 * @req_classify_flow:
991 * Sets the flow's sid to the openreq sid. 991 * Sets the flow's sid to the openreq sid.
992 * @tun_dev_alloc_security:
993 * This hook allows a module to allocate a security structure for a TUN
994 * device.
995 * @security pointer to a security structure pointer.
996 * Returns a zero on success, negative values on failure.
997 * @tun_dev_free_security:
998 * This hook allows a module to free the security structure for a TUN
999 * device.
1000 * @security pointer to the TUN device's security structure
992 * @tun_dev_create: 1001 * @tun_dev_create:
993 * Check permissions prior to creating a new TUN device. 1002 * Check permissions prior to creating a new TUN device.
994 * @tun_dev_post_create: 1003 * @tun_dev_attach_queue:
995 * This hook allows a module to update or allocate a per-socket security 1004 * Check permissions prior to attaching to a TUN device queue.
996 * structure. 1005 * @security pointer to the TUN device's security structure.
997 * @sk contains the newly created sock structure.
998 * @tun_dev_attach: 1006 * @tun_dev_attach:
999 * Check permissions prior to attaching to a persistent TUN device. This 1007 * This hook can be used by the module to update any security state
1000 * hook can also be used by the module to update any security state
1001 * associated with the TUN device's sock structure. 1008 * associated with the TUN device's sock structure.
1002 * @sk contains the existing sock structure. 1009 * @sk contains the existing sock structure.
1010 * @security pointer to the TUN device's security structure.
1011 * @tun_dev_open:
1012 * This hook can be used by the module to update any security state
1013 * associated with the TUN device's security structure.
1014 * @security pointer to the TUN devices's security structure.
1003 * 1015 *
1004 * Security hooks for XFRM operations. 1016 * Security hooks for XFRM operations.
1005 * 1017 *
@@ -1620,9 +1632,12 @@ struct security_operations {
1620 void (*secmark_refcount_inc) (void); 1632 void (*secmark_refcount_inc) (void);
1621 void (*secmark_refcount_dec) (void); 1633 void (*secmark_refcount_dec) (void);
1622 void (*req_classify_flow) (const struct request_sock *req, struct flowi *fl); 1634 void (*req_classify_flow) (const struct request_sock *req, struct flowi *fl);
1623 int (*tun_dev_create)(void); 1635 int (*tun_dev_alloc_security) (void **security);
1624 void (*tun_dev_post_create)(struct sock *sk); 1636 void (*tun_dev_free_security) (void *security);
1625 int (*tun_dev_attach)(struct sock *sk); 1637 int (*tun_dev_create) (void);
1638 int (*tun_dev_attach_queue) (void *security);
1639 int (*tun_dev_attach) (struct sock *sk, void *security);
1640 int (*tun_dev_open) (void *security);
1626#endif /* CONFIG_SECURITY_NETWORK */ 1641#endif /* CONFIG_SECURITY_NETWORK */
1627 1642
1628#ifdef CONFIG_SECURITY_NETWORK_XFRM 1643#ifdef CONFIG_SECURITY_NETWORK_XFRM
@@ -2566,9 +2581,12 @@ void security_inet_conn_established(struct sock *sk,
2566int security_secmark_relabel_packet(u32 secid); 2581int security_secmark_relabel_packet(u32 secid);
2567void security_secmark_refcount_inc(void); 2582void security_secmark_refcount_inc(void);
2568void security_secmark_refcount_dec(void); 2583void security_secmark_refcount_dec(void);
2584int security_tun_dev_alloc_security(void **security);
2585void security_tun_dev_free_security(void *security);
2569int security_tun_dev_create(void); 2586int security_tun_dev_create(void);
2570void security_tun_dev_post_create(struct sock *sk); 2587int security_tun_dev_attach_queue(void *security);
2571int security_tun_dev_attach(struct sock *sk); 2588int security_tun_dev_attach(struct sock *sk, void *security);
2589int security_tun_dev_open(void *security);
2572 2590
2573#else /* CONFIG_SECURITY_NETWORK */ 2591#else /* CONFIG_SECURITY_NETWORK */
2574static inline int security_unix_stream_connect(struct sock *sock, 2592static inline int security_unix_stream_connect(struct sock *sock,
@@ -2733,16 +2751,31 @@ static inline void security_secmark_refcount_dec(void)
2733{ 2751{
2734} 2752}
2735 2753
2754static inline int security_tun_dev_alloc_security(void **security)
2755{
2756 return 0;
2757}
2758
2759static inline void security_tun_dev_free_security(void *security)
2760{
2761}
2762
2736static inline int security_tun_dev_create(void) 2763static inline int security_tun_dev_create(void)
2737{ 2764{
2738 return 0; 2765 return 0;
2739} 2766}
2740 2767
2741static inline void security_tun_dev_post_create(struct sock *sk) 2768static inline int security_tun_dev_attach_queue(void *security)
2769{
2770 return 0;
2771}
2772
2773static inline int security_tun_dev_attach(struct sock *sk, void *security)
2742{ 2774{
2775 return 0;
2743} 2776}
2744 2777
2745static inline int security_tun_dev_attach(struct sock *sk) 2778static inline int security_tun_dev_open(void *security)
2746{ 2779{
2747 return 0; 2780 return 0;
2748} 2781}
diff --git a/include/linux/usb/Kbuild b/include/linux/usb/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/linux/usb/Kbuild
+++ /dev/null
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index bd45eb7bedc8..5de7a220e986 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -100,6 +100,7 @@ struct driver_info {
100#define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */ 100#define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */
101 101
102#define FLAG_POINTTOPOINT 0x1000 /* possibly use "usb%d" names */ 102#define FLAG_POINTTOPOINT 0x1000 /* possibly use "usb%d" names */
103#define FLAG_NOARP 0x2000 /* device can't do ARP */
103 104
104/* 105/*
105 * Indicates to usbnet, that USB driver accumulates multiple IP packets. 106 * Indicates to usbnet, that USB driver accumulates multiple IP packets.
diff --git a/include/net/ip.h b/include/net/ip.h
index 0707fb9551aa..a68f838a132c 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -143,6 +143,8 @@ static inline struct sk_buff *ip_finish_skb(struct sock *sk, struct flowi4 *fl4)
143extern int ip4_datagram_connect(struct sock *sk, 143extern int ip4_datagram_connect(struct sock *sk,
144 struct sockaddr *uaddr, int addr_len); 144 struct sockaddr *uaddr, int addr_len);
145 145
146extern void ip4_datagram_release_cb(struct sock *sk);
147
146struct ip_reply_arg { 148struct ip_reply_arg {
147 struct kvec iov[1]; 149 struct kvec iov[1];
148 int flags; 150 int flags;
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index d8f5b9f52169..e98aeb3da033 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -31,6 +31,8 @@ extern void nf_conntrack_cleanup(struct net *net);
31extern int nf_conntrack_proto_init(struct net *net); 31extern int nf_conntrack_proto_init(struct net *net);
32extern void nf_conntrack_proto_fini(struct net *net); 32extern void nf_conntrack_proto_fini(struct net *net);
33 33
34extern void nf_conntrack_cleanup_end(void);
35
34extern bool 36extern bool
35nf_ct_get_tuple(const struct sk_buff *skb, 37nf_ct_get_tuple(const struct sk_buff *skb,
36 unsigned int nhoff, 38 unsigned int nhoff,
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index a1d83cc8bf85..923cb20051ed 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -71,6 +71,7 @@ struct netns_ct {
71 struct hlist_head *expect_hash; 71 struct hlist_head *expect_hash;
72 struct hlist_nulls_head unconfirmed; 72 struct hlist_nulls_head unconfirmed;
73 struct hlist_nulls_head dying; 73 struct hlist_nulls_head dying;
74 struct hlist_nulls_head tmpl;
74 struct ip_conntrack_stat __percpu *stat; 75 struct ip_conntrack_stat __percpu *stat;
75 struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb; 76 struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb;
76 struct nf_exp_event_notifier __rcu *nf_expect_event_cb; 77 struct nf_exp_event_notifier __rcu *nf_expect_event_cb;
diff --git a/include/net/netns/x_tables.h b/include/net/netns/x_tables.h
index 591db7d657a3..c24060ee411e 100644
--- a/include/net/netns/x_tables.h
+++ b/include/net/netns/x_tables.h
@@ -8,6 +8,7 @@ struct ebt_table;
8 8
9struct netns_xt { 9struct netns_xt {
10 struct list_head tables[NFPROTO_NUMPROTO]; 10 struct list_head tables[NFPROTO_NUMPROTO];
11 bool notrack_deprecated_warning;
11#if defined(CONFIG_BRIDGE_NF_EBTABLES) || \ 12#if defined(CONFIG_BRIDGE_NF_EBTABLES) || \
12 defined(CONFIG_BRIDGE_NF_EBTABLES_MODULE) 13 defined(CONFIG_BRIDGE_NF_EBTABLES_MODULE)
13 struct ebt_table *broute_table; 14 struct ebt_table *broute_table;
diff --git a/include/net/sock.h b/include/net/sock.h
index 93a6745bfdb2..182ca99405ad 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -367,7 +367,7 @@ struct sock {
367 unsigned short sk_ack_backlog; 367 unsigned short sk_ack_backlog;
368 unsigned short sk_max_ack_backlog; 368 unsigned short sk_max_ack_backlog;
369 __u32 sk_priority; 369 __u32 sk_priority;
370#ifdef CONFIG_CGROUPS 370#if IS_ENABLED(CONFIG_NETPRIO_CGROUP)
371 __u32 sk_cgrp_prioidx; 371 __u32 sk_cgrp_prioidx;
372#endif 372#endif
373 struct pid *sk_peer_pid; 373 struct pid *sk_peer_pid;
diff --git a/include/rdma/Kbuild b/include/rdma/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/rdma/Kbuild
+++ /dev/null
diff --git a/include/sound/Kbuild b/include/sound/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/sound/Kbuild
+++ /dev/null
diff --git a/include/sound/cs4271.h b/include/sound/cs4271.h
index 6d9e15ed1dcf..dd8c48d14ed9 100644
--- a/include/sound/cs4271.h
+++ b/include/sound/cs4271.h
@@ -19,7 +19,7 @@
19 19
20struct cs4271_platform_data { 20struct cs4271_platform_data {
21 int gpio_nreset; /* GPIO driving Reset pin, if any */ 21 int gpio_nreset; /* GPIO driving Reset pin, if any */
22 int amutec_eq_bmutec:1; /* flag to enable AMUTEC=BMUTEC */ 22 bool amutec_eq_bmutec; /* flag to enable AMUTEC=BMUTEC */
23}; 23};
24 24
25#endif /* __CS4271_H */ 25#endif /* __CS4271_H */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 769e27c774a3..bc56738cb109 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -58,8 +58,9 @@
58 .info = snd_soc_info_volsw_range, .get = snd_soc_get_volsw_range, \ 58 .info = snd_soc_info_volsw_range, .get = snd_soc_get_volsw_range, \
59 .put = snd_soc_put_volsw_range, \ 59 .put = snd_soc_put_volsw_range, \
60 .private_value = (unsigned long)&(struct soc_mixer_control) \ 60 .private_value = (unsigned long)&(struct soc_mixer_control) \
61 {.reg = xreg, .shift = xshift, .min = xmin,\ 61 {.reg = xreg, .rreg = xreg, .shift = xshift, \
62 .max = xmax, .platform_max = xmax, .invert = xinvert} } 62 .rshift = xshift, .min = xmin, .max = xmax, \
63 .platform_max = xmax, .invert = xinvert} }
63#define SOC_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \ 64#define SOC_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \
64{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 65{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
65 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ 66 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
@@ -88,8 +89,9 @@
88 .info = snd_soc_info_volsw_range, \ 89 .info = snd_soc_info_volsw_range, \
89 .get = snd_soc_get_volsw_range, .put = snd_soc_put_volsw_range, \ 90 .get = snd_soc_get_volsw_range, .put = snd_soc_put_volsw_range, \
90 .private_value = (unsigned long)&(struct soc_mixer_control) \ 91 .private_value = (unsigned long)&(struct soc_mixer_control) \
91 {.reg = xreg, .shift = xshift, .min = xmin,\ 92 {.reg = xreg, .rreg = xreg, .shift = xshift, \
92 .max = xmax, .platform_max = xmax, .invert = xinvert} } 93 .rshift = xshift, .min = xmin, .max = xmax, \
94 .platform_max = xmax, .invert = xinvert} }
93#define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \ 95#define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \
94{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 96{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
95 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \ 97 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 7cae2360221e..663e34a5383f 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -174,6 +174,7 @@ typedef unsigned __bitwise__ sense_reason_t;
174 174
175enum tcm_sense_reason_table { 175enum tcm_sense_reason_table {
176#define R(x) (__force sense_reason_t )(x) 176#define R(x) (__force sense_reason_t )(x)
177 TCM_NO_SENSE = R(0x00),
177 TCM_NON_EXISTENT_LUN = R(0x01), 178 TCM_NON_EXISTENT_LUN = R(0x01),
178 TCM_UNSUPPORTED_SCSI_OPCODE = R(0x02), 179 TCM_UNSUPPORTED_SCSI_OPCODE = R(0x02),
179 TCM_INCORRECT_AMOUNT_OF_DATA = R(0x03), 180 TCM_INCORRECT_AMOUNT_OF_DATA = R(0x03),
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index f6372b011366..7e8c36bc7082 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -451,7 +451,7 @@ DEFINE_EVENT(ext4__page_op, ext4_releasepage,
451 TP_ARGS(page) 451 TP_ARGS(page)
452); 452);
453 453
454TRACE_EVENT(ext4_invalidatepage, 454DECLARE_EVENT_CLASS(ext4_invalidatepage_op,
455 TP_PROTO(struct page *page, unsigned long offset), 455 TP_PROTO(struct page *page, unsigned long offset),
456 456
457 TP_ARGS(page, offset), 457 TP_ARGS(page, offset),
@@ -477,6 +477,18 @@ TRACE_EVENT(ext4_invalidatepage,
477 (unsigned long) __entry->index, __entry->offset) 477 (unsigned long) __entry->index, __entry->offset)
478); 478);
479 479
480DEFINE_EVENT(ext4_invalidatepage_op, ext4_invalidatepage,
481 TP_PROTO(struct page *page, unsigned long offset),
482
483 TP_ARGS(page, offset)
484);
485
486DEFINE_EVENT(ext4_invalidatepage_op, ext4_journalled_invalidatepage,
487 TP_PROTO(struct page *page, unsigned long offset),
488
489 TP_ARGS(page, offset)
490);
491
480TRACE_EVENT(ext4_discard_blocks, 492TRACE_EVENT(ext4_discard_blocks,
481 TP_PROTO(struct super_block *sb, unsigned long long blk, 493 TP_PROTO(struct super_block *sb, unsigned long long blk,
482 unsigned long long count), 494 unsigned long long count),
diff --git a/include/uapi/drm/exynos_drm.h b/include/uapi/drm/exynos_drm.h
index e7f52c334005..d5844122ff32 100644
--- a/include/uapi/drm/exynos_drm.h
+++ b/include/uapi/drm/exynos_drm.h
@@ -6,24 +6,10 @@
6 * Joonyoung Shim <jy0922.shim@samsung.com> 6 * Joonyoung Shim <jy0922.shim@samsung.com>
7 * Seung-Woo Kim <sw0312.kim@samsung.com> 7 * Seung-Woo Kim <sw0312.kim@samsung.com>
8 * 8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a 9 * This program is free software; you can redistribute it and/or modify it
10 * copy of this software and associated documentation files (the "Software"), 10 * under the terms of the GNU General Public License as published by the
11 * to deal in the Software without restriction, including without limitation 11 * Free Software Foundation; either version 2 of the License, or (at your
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 * option) any later version.
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice (including the next
17 * paragraph) shall be included in all copies or substantial portions of the
18 * Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 * OTHER DEALINGS IN THE SOFTWARE.
27 */ 13 */
28 14
29#ifndef _UAPI_EXYNOS_DRM_H_ 15#ifndef _UAPI_EXYNOS_DRM_H_
@@ -185,6 +171,8 @@ enum drm_exynos_flip {
185 EXYNOS_DRM_FLIP_NONE = (0 << 0), 171 EXYNOS_DRM_FLIP_NONE = (0 << 0),
186 EXYNOS_DRM_FLIP_VERTICAL = (1 << 0), 172 EXYNOS_DRM_FLIP_VERTICAL = (1 << 0),
187 EXYNOS_DRM_FLIP_HORIZONTAL = (1 << 1), 173 EXYNOS_DRM_FLIP_HORIZONTAL = (1 << 1),
174 EXYNOS_DRM_FLIP_BOTH = EXYNOS_DRM_FLIP_VERTICAL |
175 EXYNOS_DRM_FLIP_HORIZONTAL,
188}; 176};
189 177
190enum drm_exynos_degree { 178enum drm_exynos_degree {
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index b746a3cf5fa9..c4d2e9c74002 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -307,6 +307,7 @@ typedef struct drm_i915_irq_wait {
307#define I915_PARAM_HAS_PRIME_VMAP_FLUSH 21 307#define I915_PARAM_HAS_PRIME_VMAP_FLUSH 21
308#define I915_PARAM_RSVD_FOR_FUTURE_USE 22 308#define I915_PARAM_RSVD_FOR_FUTURE_USE 22
309#define I915_PARAM_HAS_SECURE_BATCHES 23 309#define I915_PARAM_HAS_SECURE_BATCHES 23
310#define I915_PARAM_HAS_PINNED_BATCHES 24
310 311
311typedef struct drm_i915_getparam { 312typedef struct drm_i915_getparam {
312 int param; 313 int param;
@@ -677,6 +678,15 @@ struct drm_i915_gem_execbuffer2 {
677 */ 678 */
678#define I915_EXEC_SECURE (1<<9) 679#define I915_EXEC_SECURE (1<<9)
679 680
681/** Inform the kernel that the batch is and will always be pinned. This
682 * negates the requirement for a workaround to be performed to avoid
683 * an incoherent CS (such as can be found on 830/845). If this flag is
684 * not passed, the kernel will endeavour to make sure the batch is
685 * coherent with the CS before execution. If this flag is passed,
686 * userspace assumes the responsibility for ensuring the same.
687 */
688#define I915_EXEC_IS_PINNED (1<<10)
689
680#define I915_EXEC_CONTEXT_ID_MASK (0xffffffff) 690#define I915_EXEC_CONTEXT_ID_MASK (0xffffffff)
681#define i915_execbuffer2_set_context_id(eb2, context) \ 691#define i915_execbuffer2_set_context_id(eb2, context) \
682 (eb2).rsvd1 = context & I915_EXEC_CONTEXT_ID_MASK 692 (eb2).rsvd1 = context & I915_EXEC_CONTEXT_ID_MASK
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index 76352ac45f24..9f096f1c0907 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -26,7 +26,6 @@
26 26
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/elf-em.h> 28#include <linux/elf-em.h>
29#include <linux/ptrace.h>
30 29
31/* The netlink messages for the audit system is divided into blocks: 30/* The netlink messages for the audit system is divided into blocks:
32 * 1000 - 1099 are for commanding the audit system 31 * 1000 - 1099 are for commanding the audit system
@@ -106,6 +105,7 @@
106#define AUDIT_MMAP 1323 /* Record showing descriptor and flags in mmap */ 105#define AUDIT_MMAP 1323 /* Record showing descriptor and flags in mmap */
107#define AUDIT_NETFILTER_PKT 1324 /* Packets traversing netfilter chains */ 106#define AUDIT_NETFILTER_PKT 1324 /* Packets traversing netfilter chains */
108#define AUDIT_NETFILTER_CFG 1325 /* Netfilter chain modifications */ 107#define AUDIT_NETFILTER_CFG 1325 /* Netfilter chain modifications */
108#define AUDIT_SECCOMP 1326 /* Secure Computing event */
109 109
110#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */ 110#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */
111#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */ 111#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */
diff --git a/include/uapi/linux/msg.h b/include/uapi/linux/msg.h
index 78dbd2f996a3..22d95c6854e0 100644
--- a/include/uapi/linux/msg.h
+++ b/include/uapi/linux/msg.h
@@ -10,6 +10,7 @@
10/* msgrcv options */ 10/* msgrcv options */
11#define MSG_NOERROR 010000 /* no error if message is too big */ 11#define MSG_NOERROR 010000 /* no error if message is too big */
12#define MSG_EXCEPT 020000 /* recv any msg except of specified type.*/ 12#define MSG_EXCEPT 020000 /* recv any msg except of specified type.*/
13#define MSG_COPY 040000 /* copy (not remove) all queue messages */
13 14
14/* Obsolete, used only for backwards compatibility and libc5 compiles */ 15/* Obsolete, used only for backwards compatibility and libc5 compiles */
15struct msqid_ds { 16struct msqid_ds {
diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
index 6b7b6f1e2fd6..ebfadc56d1b4 100644
--- a/include/uapi/linux/pci_regs.h
+++ b/include/uapi/linux/pci_regs.h
@@ -458,6 +458,8 @@
458#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ 458#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */
459#define PCI_EXP_LNKCAP 12 /* Link Capabilities */ 459#define PCI_EXP_LNKCAP 12 /* Link Capabilities */
460#define PCI_EXP_LNKCAP_SLS 0x0000000f /* Supported Link Speeds */ 460#define PCI_EXP_LNKCAP_SLS 0x0000000f /* Supported Link Speeds */
461#define PCI_EXP_LNKCAP_SLS_2_5GB 0x1 /* LNKCAP2 SLS Vector bit 0 (2.5GT/s) */
462#define PCI_EXP_LNKCAP_SLS_5_0GB 0x2 /* LNKCAP2 SLS Vector bit 1 (5.0GT/s) */
461#define PCI_EXP_LNKCAP_MLW 0x000003f0 /* Maximum Link Width */ 463#define PCI_EXP_LNKCAP_MLW 0x000003f0 /* Maximum Link Width */
462#define PCI_EXP_LNKCAP_ASPMS 0x00000c00 /* ASPM Support */ 464#define PCI_EXP_LNKCAP_ASPMS 0x00000c00 /* ASPM Support */
463#define PCI_EXP_LNKCAP_L0SEL 0x00007000 /* L0s Exit Latency */ 465#define PCI_EXP_LNKCAP_L0SEL 0x00007000 /* L0s Exit Latency */
diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h
index 78f99d97475b..2c6c85f18ea0 100644
--- a/include/uapi/linux/serial_core.h
+++ b/include/uapi/linux/serial_core.h
@@ -50,7 +50,8 @@
50#define PORT_LPC3220 22 /* NXP LPC32xx SoC "Standard" UART */ 50#define PORT_LPC3220 22 /* NXP LPC32xx SoC "Standard" UART */
51#define PORT_8250_CIR 23 /* CIR infrared port, has its own driver */ 51#define PORT_8250_CIR 23 /* CIR infrared port, has its own driver */
52#define PORT_XR17V35X 24 /* Exar XR17V35x UARTs */ 52#define PORT_XR17V35X 24 /* Exar XR17V35x UARTs */
53#define PORT_MAX_8250 24 /* max port ID */ 53#define PORT_BRCM_TRUMANAGE 24
54#define PORT_MAX_8250 25 /* max port ID */
54 55
55/* 56/*
56 * ARM specific type numbers. These are not currently guaranteed 57 * ARM specific type numbers. These are not currently guaranteed
diff --git a/init/Kconfig b/init/Kconfig
index 7d30240e5bfe..be8b7f55312d 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1182,7 +1182,7 @@ config CC_OPTIMIZE_FOR_SIZE
1182 Enabling this option will pass "-Os" instead of "-O2" to gcc 1182 Enabling this option will pass "-Os" instead of "-O2" to gcc
1183 resulting in a smaller kernel. 1183 resulting in a smaller kernel.
1184 1184
1185 If unsure, say Y. 1185 If unsure, say N.
1186 1186
1187config SYSCTL 1187config SYSCTL
1188 bool 1188 bool
diff --git a/init/do_mounts_initrd.c b/init/do_mounts_initrd.c
index 5e4ded51788e..f9acf71b9810 100644
--- a/init/do_mounts_initrd.c
+++ b/init/do_mounts_initrd.c
@@ -36,6 +36,10 @@ __setup("noinitrd", no_initrd);
36static int init_linuxrc(struct subprocess_info *info, struct cred *new) 36static int init_linuxrc(struct subprocess_info *info, struct cred *new)
37{ 37{
38 sys_unshare(CLONE_FS | CLONE_FILES); 38 sys_unshare(CLONE_FS | CLONE_FILES);
39 /* stdin/stdout/stderr for /linuxrc */
40 sys_open("/dev/console", O_RDWR, 0);
41 sys_dup(0);
42 sys_dup(0);
39 /* move initrd over / and chdir/chroot in initrd root */ 43 /* move initrd over / and chdir/chroot in initrd root */
40 sys_chdir("/root"); 44 sys_chdir("/root");
41 sys_mount(".", "/", NULL, MS_MOVE, NULL); 45 sys_mount(".", "/", NULL, MS_MOVE, NULL);
diff --git a/init/main.c b/init/main.c
index 85d69dffe864..cee4b5c66d81 100644
--- a/init/main.c
+++ b/init/main.c
@@ -604,7 +604,7 @@ asmlinkage void __init start_kernel(void)
604 pidmap_init(); 604 pidmap_init();
605 anon_vma_init(); 605 anon_vma_init();
606#ifdef CONFIG_X86 606#ifdef CONFIG_X86
607 if (efi_enabled) 607 if (efi_enabled(EFI_RUNTIME_SERVICES))
608 efi_enter_virtual_mode(); 608 efi_enter_virtual_mode();
609#endif 609#endif
610 thread_info_cache_init(); 610 thread_info_cache_init();
@@ -632,7 +632,7 @@ asmlinkage void __init start_kernel(void)
632 acpi_early_init(); /* before LAPIC and SMP init */ 632 acpi_early_init(); /* before LAPIC and SMP init */
633 sfi_init_late(); 633 sfi_init_late();
634 634
635 if (efi_enabled) { 635 if (efi_enabled(EFI_RUNTIME_SERVICES)) {
636 efi_late_init(); 636 efi_late_init();
637 efi_free_boot_services(); 637 efi_free_boot_services();
638 } 638 }
@@ -802,7 +802,7 @@ static int run_init_process(const char *init_filename)
802 (const char __user *const __user *)envp_init); 802 (const char __user *const __user *)envp_init);
803} 803}
804 804
805static void __init kernel_init_freeable(void); 805static noinline void __init kernel_init_freeable(void);
806 806
807static int __ref kernel_init(void *unused) 807static int __ref kernel_init(void *unused)
808{ 808{
@@ -845,7 +845,7 @@ static int __ref kernel_init(void *unused)
845 "See Linux Documentation/init.txt for guidance."); 845 "See Linux Documentation/init.txt for guidance.");
846} 846}
847 847
848static void __init kernel_init_freeable(void) 848static noinline void __init kernel_init_freeable(void)
849{ 849{
850 /* 850 /*
851 * Wait until kthreadd is all set-up. 851 * Wait until kthreadd is all set-up.
diff --git a/ipc/compat.c b/ipc/compat.c
index ad9518eb26e0..2547f29dcd1b 100644
--- a/ipc/compat.c
+++ b/ipc/compat.c
@@ -306,6 +306,20 @@ static long do_compat_semctl(int first, int second, int third, u32 pad)
306 return err; 306 return err;
307} 307}
308 308
309long compat_do_msg_fill(void __user *dest, struct msg_msg *msg, size_t bufsz)
310{
311 struct compat_msgbuf __user *msgp = dest;
312 size_t msgsz;
313
314 if (put_user(msg->m_type, &msgp->mtype))
315 return -EFAULT;
316
317 msgsz = (bufsz > msg->m_ts) ? msg->m_ts : bufsz;
318 if (store_msg(msgp->mtext, msg, msgsz))
319 return -EFAULT;
320 return msgsz;
321}
322
309#ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC 323#ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC
310long compat_sys_semctl(int first, int second, int third, void __user *uptr) 324long compat_sys_semctl(int first, int second, int third, void __user *uptr)
311{ 325{
@@ -337,10 +351,6 @@ long compat_sys_msgsnd(int first, int second, int third, void __user *uptr)
337long compat_sys_msgrcv(int first, int second, int msgtyp, int third, 351long compat_sys_msgrcv(int first, int second, int msgtyp, int third,
338 int version, void __user *uptr) 352 int version, void __user *uptr)
339{ 353{
340 struct compat_msgbuf __user *up;
341 long type;
342 int err;
343
344 if (first < 0) 354 if (first < 0)
345 return -EINVAL; 355 return -EINVAL;
346 if (second < 0) 356 if (second < 0)
@@ -348,23 +358,15 @@ long compat_sys_msgrcv(int first, int second, int msgtyp, int third,
348 358
349 if (!version) { 359 if (!version) {
350 struct compat_ipc_kludge ipck; 360 struct compat_ipc_kludge ipck;
351 err = -EINVAL;
352 if (!uptr) 361 if (!uptr)
353 goto out; 362 return -EINVAL;
354 err = -EFAULT;
355 if (copy_from_user (&ipck, uptr, sizeof(ipck))) 363 if (copy_from_user (&ipck, uptr, sizeof(ipck)))
356 goto out; 364 return -EFAULT;
357 uptr = compat_ptr(ipck.msgp); 365 uptr = compat_ptr(ipck.msgp);
358 msgtyp = ipck.msgtyp; 366 msgtyp = ipck.msgtyp;
359 } 367 }
360 up = uptr; 368 return do_msgrcv(first, uptr, second, msgtyp, third,
361 err = do_msgrcv(first, &type, up->mtext, second, msgtyp, third); 369 compat_do_msg_fill);
362 if (err < 0)
363 goto out;
364 if (put_user(type, &up->mtype))
365 err = -EFAULT;
366out:
367 return err;
368} 370}
369#else 371#else
370long compat_sys_semctl(int semid, int semnum, int cmd, int arg) 372long compat_sys_semctl(int semid, int semnum, int cmd, int arg)
@@ -385,16 +387,8 @@ long compat_sys_msgsnd(int msqid, struct compat_msgbuf __user *msgp,
385long compat_sys_msgrcv(int msqid, struct compat_msgbuf __user *msgp, 387long compat_sys_msgrcv(int msqid, struct compat_msgbuf __user *msgp,
386 compat_ssize_t msgsz, long msgtyp, int msgflg) 388 compat_ssize_t msgsz, long msgtyp, int msgflg)
387{ 389{
388 long err, mtype; 390 return do_msgrcv(msqid, msgp, (ssize_t)msgsz, msgtyp, msgflg,
389 391 compat_do_msg_fill);
390 err = do_msgrcv(msqid, &mtype, msgp->mtext, (ssize_t)msgsz, msgtyp, msgflg);
391 if (err < 0)
392 goto out;
393
394 if (put_user(mtype, &msgp->mtype))
395 err = -EFAULT;
396 out:
397 return err;
398} 392}
399#endif 393#endif
400 394
diff --git a/ipc/ipc_sysctl.c b/ipc/ipc_sysctl.c
index 00fba2bab87d..130dfece27ac 100644
--- a/ipc/ipc_sysctl.c
+++ b/ipc/ipc_sysctl.c
@@ -158,6 +158,9 @@ static int proc_ipcauto_dointvec_minmax(ctl_table *table, int write,
158 158
159static int zero; 159static int zero;
160static int one = 1; 160static int one = 1;
161#ifdef CONFIG_CHECKPOINT_RESTORE
162static int int_max = INT_MAX;
163#endif
161 164
162static struct ctl_table ipc_kern_table[] = { 165static struct ctl_table ipc_kern_table[] = {
163 { 166 {
@@ -227,6 +230,35 @@ static struct ctl_table ipc_kern_table[] = {
227 .extra1 = &zero, 230 .extra1 = &zero,
228 .extra2 = &one, 231 .extra2 = &one,
229 }, 232 },
233#ifdef CONFIG_CHECKPOINT_RESTORE
234 {
235 .procname = "sem_next_id",
236 .data = &init_ipc_ns.ids[IPC_SEM_IDS].next_id,
237 .maxlen = sizeof(init_ipc_ns.ids[IPC_SEM_IDS].next_id),
238 .mode = 0644,
239 .proc_handler = proc_ipc_dointvec_minmax,
240 .extra1 = &zero,
241 .extra2 = &int_max,
242 },
243 {
244 .procname = "msg_next_id",
245 .data = &init_ipc_ns.ids[IPC_MSG_IDS].next_id,
246 .maxlen = sizeof(init_ipc_ns.ids[IPC_MSG_IDS].next_id),
247 .mode = 0644,
248 .proc_handler = proc_ipc_dointvec_minmax,
249 .extra1 = &zero,
250 .extra2 = &int_max,
251 },
252 {
253 .procname = "shm_next_id",
254 .data = &init_ipc_ns.ids[IPC_SHM_IDS].next_id,
255 .maxlen = sizeof(init_ipc_ns.ids[IPC_SHM_IDS].next_id),
256 .mode = 0644,
257 .proc_handler = proc_ipc_dointvec_minmax,
258 .extra1 = &zero,
259 .extra2 = &int_max,
260 },
261#endif
230 {} 262 {}
231}; 263};
232 264
diff --git a/ipc/msg.c b/ipc/msg.c
index a71af5a65abf..950572f9d796 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -755,26 +755,91 @@ static inline int convert_mode(long *msgtyp, int msgflg)
755 return SEARCH_EQUAL; 755 return SEARCH_EQUAL;
756} 756}
757 757
758long do_msgrcv(int msqid, long *pmtype, void __user *mtext, 758static long do_msg_fill(void __user *dest, struct msg_msg *msg, size_t bufsz)
759 size_t msgsz, long msgtyp, int msgflg) 759{
760 struct msgbuf __user *msgp = dest;
761 size_t msgsz;
762
763 if (put_user(msg->m_type, &msgp->mtype))
764 return -EFAULT;
765
766 msgsz = (bufsz > msg->m_ts) ? msg->m_ts : bufsz;
767 if (store_msg(msgp->mtext, msg, msgsz))
768 return -EFAULT;
769 return msgsz;
770}
771
772#ifdef CONFIG_CHECKPOINT_RESTORE
773/*
774 * This function creates new kernel message structure, large enough to store
775 * bufsz message bytes.
776 */
777static inline struct msg_msg *prepare_copy(void __user *buf, size_t bufsz,
778 int msgflg, long *msgtyp,
779 unsigned long *copy_number)
780{
781 struct msg_msg *copy;
782
783 *copy_number = *msgtyp;
784 *msgtyp = 0;
785 /*
786 * Create dummy message to copy real message to.
787 */
788 copy = load_msg(buf, bufsz);
789 if (!IS_ERR(copy))
790 copy->m_ts = bufsz;
791 return copy;
792}
793
794static inline void free_copy(struct msg_msg *copy)
795{
796 if (copy)
797 free_msg(copy);
798}
799#else
800static inline struct msg_msg *prepare_copy(void __user *buf, size_t bufsz,
801 int msgflg, long *msgtyp,
802 unsigned long *copy_number)
803{
804 return ERR_PTR(-ENOSYS);
805}
806
807static inline void free_copy(struct msg_msg *copy)
808{
809}
810#endif
811
812long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp,
813 int msgflg,
814 long (*msg_handler)(void __user *, struct msg_msg *, size_t))
760{ 815{
761 struct msg_queue *msq; 816 struct msg_queue *msq;
762 struct msg_msg *msg; 817 struct msg_msg *msg;
763 int mode; 818 int mode;
764 struct ipc_namespace *ns; 819 struct ipc_namespace *ns;
820 struct msg_msg *copy = NULL;
821 unsigned long copy_number = 0;
765 822
766 if (msqid < 0 || (long) msgsz < 0) 823 if (msqid < 0 || (long) bufsz < 0)
767 return -EINVAL; 824 return -EINVAL;
825 if (msgflg & MSG_COPY) {
826 copy = prepare_copy(buf, bufsz, msgflg, &msgtyp, &copy_number);
827 if (IS_ERR(copy))
828 return PTR_ERR(copy);
829 }
768 mode = convert_mode(&msgtyp, msgflg); 830 mode = convert_mode(&msgtyp, msgflg);
769 ns = current->nsproxy->ipc_ns; 831 ns = current->nsproxy->ipc_ns;
770 832
771 msq = msg_lock_check(ns, msqid); 833 msq = msg_lock_check(ns, msqid);
772 if (IS_ERR(msq)) 834 if (IS_ERR(msq)) {
835 free_copy(copy);
773 return PTR_ERR(msq); 836 return PTR_ERR(msq);
837 }
774 838
775 for (;;) { 839 for (;;) {
776 struct msg_receiver msr_d; 840 struct msg_receiver msr_d;
777 struct list_head *tmp; 841 struct list_head *tmp;
842 long msg_counter = 0;
778 843
779 msg = ERR_PTR(-EACCES); 844 msg = ERR_PTR(-EACCES);
780 if (ipcperms(ns, &msq->q_perm, S_IRUGO)) 845 if (ipcperms(ns, &msq->q_perm, S_IRUGO))
@@ -793,12 +858,21 @@ long do_msgrcv(int msqid, long *pmtype, void __user *mtext,
793 msg = walk_msg; 858 msg = walk_msg;
794 if (mode == SEARCH_LESSEQUAL && 859 if (mode == SEARCH_LESSEQUAL &&
795 walk_msg->m_type != 1) { 860 walk_msg->m_type != 1) {
796 msg = walk_msg;
797 msgtyp = walk_msg->m_type - 1; 861 msgtyp = walk_msg->m_type - 1;
798 } else { 862 } else if (msgflg & MSG_COPY) {
799 msg = walk_msg; 863 if (copy_number == msg_counter) {
864 /*
865 * Found requested message.
866 * Copy it.
867 */
868 msg = copy_msg(msg, copy);
869 if (IS_ERR(msg))
870 goto out_unlock;
871 break;
872 }
873 } else
800 break; 874 break;
801 } 875 msg_counter++;
802 } 876 }
803 tmp = tmp->next; 877 tmp = tmp->next;
804 } 878 }
@@ -807,10 +881,16 @@ long do_msgrcv(int msqid, long *pmtype, void __user *mtext,
807 * Found a suitable message. 881 * Found a suitable message.
808 * Unlink it from the queue. 882 * Unlink it from the queue.
809 */ 883 */
810 if ((msgsz < msg->m_ts) && !(msgflg & MSG_NOERROR)) { 884 if ((bufsz < msg->m_ts) && !(msgflg & MSG_NOERROR)) {
811 msg = ERR_PTR(-E2BIG); 885 msg = ERR_PTR(-E2BIG);
812 goto out_unlock; 886 goto out_unlock;
813 } 887 }
888 /*
889 * If we are copying, then do not unlink message and do
890 * not update queue parameters.
891 */
892 if (msgflg & MSG_COPY)
893 goto out_unlock;
814 list_del(&msg->m_list); 894 list_del(&msg->m_list);
815 msq->q_qnum--; 895 msq->q_qnum--;
816 msq->q_rtime = get_seconds(); 896 msq->q_rtime = get_seconds();
@@ -834,7 +914,7 @@ long do_msgrcv(int msqid, long *pmtype, void __user *mtext,
834 if (msgflg & MSG_NOERROR) 914 if (msgflg & MSG_NOERROR)
835 msr_d.r_maxsize = INT_MAX; 915 msr_d.r_maxsize = INT_MAX;
836 else 916 else
837 msr_d.r_maxsize = msgsz; 917 msr_d.r_maxsize = bufsz;
838 msr_d.r_msg = ERR_PTR(-EAGAIN); 918 msr_d.r_msg = ERR_PTR(-EAGAIN);
839 current->state = TASK_INTERRUPTIBLE; 919 current->state = TASK_INTERRUPTIBLE;
840 msg_unlock(msq); 920 msg_unlock(msq);
@@ -894,32 +974,21 @@ out_unlock:
894 break; 974 break;
895 } 975 }
896 } 976 }
897 if (IS_ERR(msg)) 977 if (IS_ERR(msg)) {
978 free_copy(copy);
898 return PTR_ERR(msg); 979 return PTR_ERR(msg);
980 }
899 981
900 msgsz = (msgsz > msg->m_ts) ? msg->m_ts : msgsz; 982 bufsz = msg_handler(buf, msg, bufsz);
901 *pmtype = msg->m_type;
902 if (store_msg(mtext, msg, msgsz))
903 msgsz = -EFAULT;
904
905 free_msg(msg); 983 free_msg(msg);
906 984
907 return msgsz; 985 return bufsz;
908} 986}
909 987
910SYSCALL_DEFINE5(msgrcv, int, msqid, struct msgbuf __user *, msgp, size_t, msgsz, 988SYSCALL_DEFINE5(msgrcv, int, msqid, struct msgbuf __user *, msgp, size_t, msgsz,
911 long, msgtyp, int, msgflg) 989 long, msgtyp, int, msgflg)
912{ 990{
913 long err, mtype; 991 return do_msgrcv(msqid, msgp, msgsz, msgtyp, msgflg, do_msg_fill);
914
915 err = do_msgrcv(msqid, &mtype, msgp->mtext, msgsz, msgtyp, msgflg);
916 if (err < 0)
917 goto out;
918
919 if (put_user(mtype, &msgp->mtype))
920 err = -EFAULT;
921out:
922 return err;
923} 992}
924 993
925#ifdef CONFIG_PROC_FS 994#ifdef CONFIG_PROC_FS
diff --git a/ipc/msgutil.c b/ipc/msgutil.c
index 6471f1bdae96..ebfcbfa8b7f2 100644
--- a/ipc/msgutil.c
+++ b/ipc/msgutil.c
@@ -102,7 +102,50 @@ out_err:
102 free_msg(msg); 102 free_msg(msg);
103 return ERR_PTR(err); 103 return ERR_PTR(err);
104} 104}
105#ifdef CONFIG_CHECKPOINT_RESTORE
106struct msg_msg *copy_msg(struct msg_msg *src, struct msg_msg *dst)
107{
108 struct msg_msgseg *dst_pseg, *src_pseg;
109 int len = src->m_ts;
110 int alen;
111
112 BUG_ON(dst == NULL);
113 if (src->m_ts > dst->m_ts)
114 return ERR_PTR(-EINVAL);
105 115
116 alen = len;
117 if (alen > DATALEN_MSG)
118 alen = DATALEN_MSG;
119
120 dst->next = NULL;
121 dst->security = NULL;
122
123 memcpy(dst + 1, src + 1, alen);
124
125 len -= alen;
126 dst_pseg = dst->next;
127 src_pseg = src->next;
128 while (len > 0) {
129 alen = len;
130 if (alen > DATALEN_SEG)
131 alen = DATALEN_SEG;
132 memcpy(dst_pseg + 1, src_pseg + 1, alen);
133 dst_pseg = dst_pseg->next;
134 len -= alen;
135 src_pseg = src_pseg->next;
136 }
137
138 dst->m_type = src->m_type;
139 dst->m_ts = src->m_ts;
140
141 return dst;
142}
143#else
144struct msg_msg *copy_msg(struct msg_msg *src, struct msg_msg *dst)
145{
146 return ERR_PTR(-ENOSYS);
147}
148#endif
106int store_msg(void __user *dest, struct msg_msg *msg, int len) 149int store_msg(void __user *dest, struct msg_msg *msg, int len)
107{ 150{
108 int alen; 151 int alen;
diff --git a/ipc/util.c b/ipc/util.c
index 72fd0785ac94..74e1d9c7a98a 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -122,6 +122,7 @@ void ipc_init_ids(struct ipc_ids *ids)
122 122
123 ids->in_use = 0; 123 ids->in_use = 0;
124 ids->seq = 0; 124 ids->seq = 0;
125 ids->next_id = -1;
125 { 126 {
126 int seq_limit = INT_MAX/SEQ_MULTIPLIER; 127 int seq_limit = INT_MAX/SEQ_MULTIPLIER;
127 if (seq_limit > USHRT_MAX) 128 if (seq_limit > USHRT_MAX)
@@ -252,6 +253,7 @@ int ipc_addid(struct ipc_ids* ids, struct kern_ipc_perm* new, int size)
252 kuid_t euid; 253 kuid_t euid;
253 kgid_t egid; 254 kgid_t egid;
254 int id, err; 255 int id, err;
256 int next_id = ids->next_id;
255 257
256 if (size > IPCMNI) 258 if (size > IPCMNI)
257 size = IPCMNI; 259 size = IPCMNI;
@@ -264,7 +266,8 @@ int ipc_addid(struct ipc_ids* ids, struct kern_ipc_perm* new, int size)
264 rcu_read_lock(); 266 rcu_read_lock();
265 spin_lock(&new->lock); 267 spin_lock(&new->lock);
266 268
267 err = idr_get_new(&ids->ipcs_idr, new, &id); 269 err = idr_get_new_above(&ids->ipcs_idr, new,
270 (next_id < 0) ? 0 : ipcid_to_idx(next_id), &id);
268 if (err) { 271 if (err) {
269 spin_unlock(&new->lock); 272 spin_unlock(&new->lock);
270 rcu_read_unlock(); 273 rcu_read_unlock();
@@ -277,9 +280,14 @@ int ipc_addid(struct ipc_ids* ids, struct kern_ipc_perm* new, int size)
277 new->cuid = new->uid = euid; 280 new->cuid = new->uid = euid;
278 new->gid = new->cgid = egid; 281 new->gid = new->cgid = egid;
279 282
280 new->seq = ids->seq++; 283 if (next_id < 0) {
281 if(ids->seq > ids->seq_max) 284 new->seq = ids->seq++;
282 ids->seq = 0; 285 if (ids->seq > ids->seq_max)
286 ids->seq = 0;
287 } else {
288 new->seq = ipcid_to_seqx(next_id);
289 ids->next_id = -1;
290 }
283 291
284 new->id = ipc_buildid(id, new->seq); 292 new->id = ipc_buildid(id, new->seq);
285 return id; 293 return id;
diff --git a/ipc/util.h b/ipc/util.h
index c8fe2f7631e9..eeb79a1fbd83 100644
--- a/ipc/util.h
+++ b/ipc/util.h
@@ -92,6 +92,7 @@ void __init ipc_init_proc_interface(const char *path, const char *header,
92#define IPC_SHM_IDS 2 92#define IPC_SHM_IDS 2
93 93
94#define ipcid_to_idx(id) ((id) % SEQ_MULTIPLIER) 94#define ipcid_to_idx(id) ((id) % SEQ_MULTIPLIER)
95#define ipcid_to_seqx(id) ((id) / SEQ_MULTIPLIER)
95 96
96/* must be called with ids->rw_mutex acquired for writing */ 97/* must be called with ids->rw_mutex acquired for writing */
97int ipc_addid(struct ipc_ids *, struct kern_ipc_perm *, int); 98int ipc_addid(struct ipc_ids *, struct kern_ipc_perm *, int);
@@ -139,6 +140,7 @@ int ipc_parse_version (int *cmd);
139 140
140extern void free_msg(struct msg_msg *msg); 141extern void free_msg(struct msg_msg *msg);
141extern struct msg_msg *load_msg(const void __user *src, int len); 142extern struct msg_msg *load_msg(const void __user *src, int len);
143extern struct msg_msg *copy_msg(struct msg_msg *src, struct msg_msg *dst);
142extern int store_msg(void __user *dest, struct msg_msg *msg, int len); 144extern int store_msg(void __user *dest, struct msg_msg *msg, int len);
143 145
144extern void recompute_msgmni(struct ipc_namespace *); 146extern void recompute_msgmni(struct ipc_namespace *);
diff --git a/kernel/async.c b/kernel/async.c
index 9d3118384858..6f34904a0b53 100644
--- a/kernel/async.c
+++ b/kernel/async.c
@@ -86,18 +86,27 @@ static atomic_t entry_count;
86 */ 86 */
87static async_cookie_t __lowest_in_progress(struct async_domain *running) 87static async_cookie_t __lowest_in_progress(struct async_domain *running)
88{ 88{
89 async_cookie_t first_running = next_cookie; /* infinity value */
90 async_cookie_t first_pending = next_cookie; /* ditto */
89 struct async_entry *entry; 91 struct async_entry *entry;
90 92
93 /*
94 * Both running and pending lists are sorted but not disjoint.
95 * Take the first cookies from both and return the min.
96 */
91 if (!list_empty(&running->domain)) { 97 if (!list_empty(&running->domain)) {
92 entry = list_first_entry(&running->domain, typeof(*entry), list); 98 entry = list_first_entry(&running->domain, typeof(*entry), list);
93 return entry->cookie; 99 first_running = entry->cookie;
94 } 100 }
95 101
96 list_for_each_entry(entry, &async_pending, list) 102 list_for_each_entry(entry, &async_pending, list) {
97 if (entry->running == running) 103 if (entry->running == running) {
98 return entry->cookie; 104 first_pending = entry->cookie;
105 break;
106 }
107 }
99 108
100 return next_cookie; /* "infinity" value */ 109 return min(first_running, first_pending);
101} 110}
102 111
103static async_cookie_t lowest_in_progress(struct async_domain *running) 112static async_cookie_t lowest_in_progress(struct async_domain *running)
@@ -118,13 +127,17 @@ static void async_run_entry_fn(struct work_struct *work)
118{ 127{
119 struct async_entry *entry = 128 struct async_entry *entry =
120 container_of(work, struct async_entry, work); 129 container_of(work, struct async_entry, work);
130 struct async_entry *pos;
121 unsigned long flags; 131 unsigned long flags;
122 ktime_t uninitialized_var(calltime), delta, rettime; 132 ktime_t uninitialized_var(calltime), delta, rettime;
123 struct async_domain *running = entry->running; 133 struct async_domain *running = entry->running;
124 134
125 /* 1) move self to the running queue */ 135 /* 1) move self to the running queue, make sure it stays sorted */
126 spin_lock_irqsave(&async_lock, flags); 136 spin_lock_irqsave(&async_lock, flags);
127 list_move_tail(&entry->list, &running->domain); 137 list_for_each_entry_reverse(pos, &running->domain, list)
138 if (entry->cookie < pos->cookie)
139 break;
140 list_move_tail(&entry->list, &pos->list);
128 spin_unlock_irqrestore(&async_lock, flags); 141 spin_unlock_irqrestore(&async_lock, flags);
129 142
130 /* 2) run (and print duration) */ 143 /* 2) run (and print duration) */
@@ -196,6 +209,9 @@ static async_cookie_t __async_schedule(async_func_ptr *ptr, void *data, struct a
196 atomic_inc(&entry_count); 209 atomic_inc(&entry_count);
197 spin_unlock_irqrestore(&async_lock, flags); 210 spin_unlock_irqrestore(&async_lock, flags);
198 211
212 /* mark that this task has queued an async job, used by module init */
213 current->flags |= PF_USED_ASYNC;
214
199 /* schedule for execution */ 215 /* schedule for execution */
200 queue_work(system_unbound_wq, &entry->work); 216 queue_work(system_unbound_wq, &entry->work);
201 217
diff --git a/kernel/audit.c b/kernel/audit.c
index 40414e9143db..d596e5355f15 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -272,6 +272,8 @@ static int audit_log_config_change(char *function_name, int new, int old,
272 int rc = 0; 272 int rc = 0;
273 273
274 ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE); 274 ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE);
275 if (unlikely(!ab))
276 return rc;
275 audit_log_format(ab, "%s=%d old=%d auid=%u ses=%u", function_name, new, 277 audit_log_format(ab, "%s=%d old=%d auid=%u ses=%u", function_name, new,
276 old, from_kuid(&init_user_ns, loginuid), sessionid); 278 old, from_kuid(&init_user_ns, loginuid), sessionid);
277 if (sid) { 279 if (sid) {
@@ -619,6 +621,8 @@ static int audit_log_common_recv_msg(struct audit_buffer **ab, u16 msg_type,
619 } 621 }
620 622
621 *ab = audit_log_start(NULL, GFP_KERNEL, msg_type); 623 *ab = audit_log_start(NULL, GFP_KERNEL, msg_type);
624 if (unlikely(!*ab))
625 return rc;
622 audit_log_format(*ab, "pid=%d uid=%u auid=%u ses=%u", 626 audit_log_format(*ab, "pid=%d uid=%u auid=%u ses=%u",
623 task_tgid_vnr(current), 627 task_tgid_vnr(current),
624 from_kuid(&init_user_ns, current_uid()), 628 from_kuid(&init_user_ns, current_uid()),
@@ -1097,6 +1101,23 @@ static inline void audit_get_stamp(struct audit_context *ctx,
1097 } 1101 }
1098} 1102}
1099 1103
1104/*
1105 * Wait for auditd to drain the queue a little
1106 */
1107static void wait_for_auditd(unsigned long sleep_time)
1108{
1109 DECLARE_WAITQUEUE(wait, current);
1110 set_current_state(TASK_INTERRUPTIBLE);
1111 add_wait_queue(&audit_backlog_wait, &wait);
1112
1113 if (audit_backlog_limit &&
1114 skb_queue_len(&audit_skb_queue) > audit_backlog_limit)
1115 schedule_timeout(sleep_time);
1116
1117 __set_current_state(TASK_RUNNING);
1118 remove_wait_queue(&audit_backlog_wait, &wait);
1119}
1120
1100/* Obtain an audit buffer. This routine does locking to obtain the 1121/* Obtain an audit buffer. This routine does locking to obtain the
1101 * audit buffer, but then no locking is required for calls to 1122 * audit buffer, but then no locking is required for calls to
1102 * audit_log_*format. If the tsk is a task that is currently in a 1123 * audit_log_*format. If the tsk is a task that is currently in a
@@ -1142,20 +1163,13 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask,
1142 1163
1143 while (audit_backlog_limit 1164 while (audit_backlog_limit
1144 && skb_queue_len(&audit_skb_queue) > audit_backlog_limit + reserve) { 1165 && skb_queue_len(&audit_skb_queue) > audit_backlog_limit + reserve) {
1145 if (gfp_mask & __GFP_WAIT && audit_backlog_wait_time 1166 if (gfp_mask & __GFP_WAIT && audit_backlog_wait_time) {
1146 && time_before(jiffies, timeout_start + audit_backlog_wait_time)) { 1167 unsigned long sleep_time;
1147 1168
1148 /* Wait for auditd to drain the queue a little */ 1169 sleep_time = timeout_start + audit_backlog_wait_time -
1149 DECLARE_WAITQUEUE(wait, current); 1170 jiffies;
1150 set_current_state(TASK_INTERRUPTIBLE); 1171 if ((long)sleep_time > 0)
1151 add_wait_queue(&audit_backlog_wait, &wait); 1172 wait_for_auditd(sleep_time);
1152
1153 if (audit_backlog_limit &&
1154 skb_queue_len(&audit_skb_queue) > audit_backlog_limit)
1155 schedule_timeout(timeout_start + audit_backlog_wait_time - jiffies);
1156
1157 __set_current_state(TASK_RUNNING);
1158 remove_wait_queue(&audit_backlog_wait, &wait);
1159 continue; 1173 continue;
1160 } 1174 }
1161 if (audit_rate_check() && printk_ratelimit()) 1175 if (audit_rate_check() && printk_ratelimit())
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c
index e81175ef25f8..642a89c4f3d6 100644
--- a/kernel/audit_tree.c
+++ b/kernel/audit_tree.c
@@ -449,11 +449,26 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
449 return 0; 449 return 0;
450} 450}
451 451
452static void audit_log_remove_rule(struct audit_krule *rule)
453{
454 struct audit_buffer *ab;
455
456 ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE);
457 if (unlikely(!ab))
458 return;
459 audit_log_format(ab, "op=");
460 audit_log_string(ab, "remove rule");
461 audit_log_format(ab, " dir=");
462 audit_log_untrustedstring(ab, rule->tree->pathname);
463 audit_log_key(ab, rule->filterkey);
464 audit_log_format(ab, " list=%d res=1", rule->listnr);
465 audit_log_end(ab);
466}
467
452static void kill_rules(struct audit_tree *tree) 468static void kill_rules(struct audit_tree *tree)
453{ 469{
454 struct audit_krule *rule, *next; 470 struct audit_krule *rule, *next;
455 struct audit_entry *entry; 471 struct audit_entry *entry;
456 struct audit_buffer *ab;
457 472
458 list_for_each_entry_safe(rule, next, &tree->rules, rlist) { 473 list_for_each_entry_safe(rule, next, &tree->rules, rlist) {
459 entry = container_of(rule, struct audit_entry, rule); 474 entry = container_of(rule, struct audit_entry, rule);
@@ -461,14 +476,7 @@ static void kill_rules(struct audit_tree *tree)
461 list_del_init(&rule->rlist); 476 list_del_init(&rule->rlist);
462 if (rule->tree) { 477 if (rule->tree) {
463 /* not a half-baked one */ 478 /* not a half-baked one */
464 ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE); 479 audit_log_remove_rule(rule);
465 audit_log_format(ab, "op=");
466 audit_log_string(ab, "remove rule");
467 audit_log_format(ab, " dir=");
468 audit_log_untrustedstring(ab, rule->tree->pathname);
469 audit_log_key(ab, rule->filterkey);
470 audit_log_format(ab, " list=%d res=1", rule->listnr);
471 audit_log_end(ab);
472 rule->tree = NULL; 480 rule->tree = NULL;
473 list_del_rcu(&entry->list); 481 list_del_rcu(&entry->list);
474 list_del(&entry->rule.list); 482 list_del(&entry->rule.list);
diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c
index 4a599f699adc..22831c4d369c 100644
--- a/kernel/audit_watch.c
+++ b/kernel/audit_watch.c
@@ -240,6 +240,8 @@ static void audit_watch_log_rule_change(struct audit_krule *r, struct audit_watc
240 if (audit_enabled) { 240 if (audit_enabled) {
241 struct audit_buffer *ab; 241 struct audit_buffer *ab;
242 ab = audit_log_start(NULL, GFP_NOFS, AUDIT_CONFIG_CHANGE); 242 ab = audit_log_start(NULL, GFP_NOFS, AUDIT_CONFIG_CHANGE);
243 if (unlikely(!ab))
244 return;
243 audit_log_format(ab, "auid=%u ses=%u op=", 245 audit_log_format(ab, "auid=%u ses=%u op=",
244 from_kuid(&init_user_ns, audit_get_loginuid(current)), 246 from_kuid(&init_user_ns, audit_get_loginuid(current)),
245 audit_get_sessionid(current)); 247 audit_get_sessionid(current));
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index 7f19f23d38a3..f9fc54bbe06f 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -1144,7 +1144,6 @@ static void audit_log_rule_change(kuid_t loginuid, u32 sessionid, u32 sid,
1144 * audit_receive_filter - apply all rules to the specified message type 1144 * audit_receive_filter - apply all rules to the specified message type
1145 * @type: audit message type 1145 * @type: audit message type
1146 * @pid: target pid for netlink audit messages 1146 * @pid: target pid for netlink audit messages
1147 * @uid: target uid for netlink audit messages
1148 * @seq: netlink audit message sequence (serial) number 1147 * @seq: netlink audit message sequence (serial) number
1149 * @data: payload data 1148 * @data: payload data
1150 * @datasz: size of payload data 1149 * @datasz: size of payload data
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index e37e6a12c5e3..a371f857a0a9 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1464,14 +1464,14 @@ static void show_special(struct audit_context *context, int *call_panic)
1464 audit_log_end(ab); 1464 audit_log_end(ab);
1465 ab = audit_log_start(context, GFP_KERNEL, 1465 ab = audit_log_start(context, GFP_KERNEL,
1466 AUDIT_IPC_SET_PERM); 1466 AUDIT_IPC_SET_PERM);
1467 if (unlikely(!ab))
1468 return;
1467 audit_log_format(ab, 1469 audit_log_format(ab,
1468 "qbytes=%lx ouid=%u ogid=%u mode=%#ho", 1470 "qbytes=%lx ouid=%u ogid=%u mode=%#ho",
1469 context->ipc.qbytes, 1471 context->ipc.qbytes,
1470 context->ipc.perm_uid, 1472 context->ipc.perm_uid,
1471 context->ipc.perm_gid, 1473 context->ipc.perm_gid,
1472 context->ipc.perm_mode); 1474 context->ipc.perm_mode);
1473 if (!ab)
1474 return;
1475 } 1475 }
1476 break; } 1476 break; }
1477 case AUDIT_MQ_OPEN: { 1477 case AUDIT_MQ_OPEN: {
@@ -2675,7 +2675,7 @@ void __audit_mmap_fd(int fd, int flags)
2675 context->type = AUDIT_MMAP; 2675 context->type = AUDIT_MMAP;
2676} 2676}
2677 2677
2678static void audit_log_abend(struct audit_buffer *ab, char *reason, long signr) 2678static void audit_log_task(struct audit_buffer *ab)
2679{ 2679{
2680 kuid_t auid, uid; 2680 kuid_t auid, uid;
2681 kgid_t gid; 2681 kgid_t gid;
@@ -2693,6 +2693,11 @@ static void audit_log_abend(struct audit_buffer *ab, char *reason, long signr)
2693 audit_log_task_context(ab); 2693 audit_log_task_context(ab);
2694 audit_log_format(ab, " pid=%d comm=", current->pid); 2694 audit_log_format(ab, " pid=%d comm=", current->pid);
2695 audit_log_untrustedstring(ab, current->comm); 2695 audit_log_untrustedstring(ab, current->comm);
2696}
2697
2698static void audit_log_abend(struct audit_buffer *ab, char *reason, long signr)
2699{
2700 audit_log_task(ab);
2696 audit_log_format(ab, " reason="); 2701 audit_log_format(ab, " reason=");
2697 audit_log_string(ab, reason); 2702 audit_log_string(ab, reason);
2698 audit_log_format(ab, " sig=%ld", signr); 2703 audit_log_format(ab, " sig=%ld", signr);
@@ -2715,6 +2720,8 @@ void audit_core_dumps(long signr)
2715 return; 2720 return;
2716 2721
2717 ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_ANOM_ABEND); 2722 ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_ANOM_ABEND);
2723 if (unlikely(!ab))
2724 return;
2718 audit_log_abend(ab, "memory violation", signr); 2725 audit_log_abend(ab, "memory violation", signr);
2719 audit_log_end(ab); 2726 audit_log_end(ab);
2720} 2727}
@@ -2723,8 +2730,11 @@ void __audit_seccomp(unsigned long syscall, long signr, int code)
2723{ 2730{
2724 struct audit_buffer *ab; 2731 struct audit_buffer *ab;
2725 2732
2726 ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_ANOM_ABEND); 2733 ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_SECCOMP);
2727 audit_log_abend(ab, "seccomp", signr); 2734 if (unlikely(!ab))
2735 return;
2736 audit_log_task(ab);
2737 audit_log_format(ab, " sig=%ld", signr);
2728 audit_log_format(ab, " syscall=%ld", syscall); 2738 audit_log_format(ab, " syscall=%ld", syscall);
2729 audit_log_format(ab, " compat=%d", is_compat_task()); 2739 audit_log_format(ab, " compat=%d", is_compat_task());
2730 audit_log_format(ab, " ip=0x%lx", KSTK_EIP(current)); 2740 audit_log_format(ab, " ip=0x%lx", KSTK_EIP(current));
diff --git a/kernel/compat.c b/kernel/compat.c
index f6150e92dfc9..36700e9e2be9 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -535,9 +535,11 @@ asmlinkage long compat_sys_getrusage(int who, struct compat_rusage __user *ru)
535 return 0; 535 return 0;
536} 536}
537 537
538asmlinkage long 538COMPAT_SYSCALL_DEFINE4(wait4,
539compat_sys_wait4(compat_pid_t pid, compat_uint_t __user *stat_addr, int options, 539 compat_pid_t, pid,
540 struct compat_rusage __user *ru) 540 compat_uint_t __user *, stat_addr,
541 int, options,
542 struct compat_rusage __user *, ru)
541{ 543{
542 if (!ru) { 544 if (!ru) {
543 return sys_wait4(pid, stat_addr, options, NULL); 545 return sys_wait4(pid, stat_addr, options, NULL);
@@ -564,9 +566,10 @@ compat_sys_wait4(compat_pid_t pid, compat_uint_t __user *stat_addr, int options,
564 } 566 }
565} 567}
566 568
567asmlinkage long compat_sys_waitid(int which, compat_pid_t pid, 569COMPAT_SYSCALL_DEFINE5(waitid,
568 struct compat_siginfo __user *uinfo, int options, 570 int, which, compat_pid_t, pid,
569 struct compat_rusage __user *uru) 571 struct compat_siginfo __user *, uinfo, int, options,
572 struct compat_rusage __user *, uru)
570{ 573{
571 siginfo_t info; 574 siginfo_t info;
572 struct rusage ru; 575 struct rusage ru;
@@ -584,7 +587,11 @@ asmlinkage long compat_sys_waitid(int which, compat_pid_t pid,
584 return ret; 587 return ret;
585 588
586 if (uru) { 589 if (uru) {
587 ret = put_compat_rusage(&ru, uru); 590 /* sys_waitid() overwrites everything in ru */
591 if (COMPAT_USE_64BIT_TIME)
592 ret = copy_to_user(uru, &ru, sizeof(ru));
593 else
594 ret = put_compat_rusage(&ru, uru);
588 if (ret) 595 if (ret)
589 return ret; 596 return ret;
590 } 597 }
@@ -994,7 +1001,7 @@ compat_sys_rt_sigtimedwait (compat_sigset_t __user *uthese,
994 sigset_from_compat(&s, &s32); 1001 sigset_from_compat(&s, &s32);
995 1002
996 if (uts) { 1003 if (uts) {
997 if (get_compat_timespec(&t, uts)) 1004 if (compat_get_timespec(&t, uts))
998 return -EFAULT; 1005 return -EFAULT;
999 } 1006 }
1000 1007
diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
index 4d5f8d5612f3..8875254120b6 100644
--- a/kernel/debug/kdb/kdb_main.c
+++ b/kernel/debug/kdb/kdb_main.c
@@ -1970,6 +1970,8 @@ static int kdb_lsmod(int argc, const char **argv)
1970 1970
1971 kdb_printf("Module Size modstruct Used by\n"); 1971 kdb_printf("Module Size modstruct Used by\n");
1972 list_for_each_entry(mod, kdb_modules, list) { 1972 list_for_each_entry(mod, kdb_modules, list) {
1973 if (mod->state == MODULE_STATE_UNFORMED)
1974 continue;
1973 1975
1974 kdb_printf("%-20s%8u 0x%p ", mod->name, 1976 kdb_printf("%-20s%8u 0x%p ", mod->name,
1975 mod->core_size, (void *)mod); 1977 mod->core_size, (void *)mod);
diff --git a/kernel/fork.c b/kernel/fork.c
index a31b823b3c2d..c535f33bbb9c 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1166,6 +1166,14 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1166 current->signal->flags & SIGNAL_UNKILLABLE) 1166 current->signal->flags & SIGNAL_UNKILLABLE)
1167 return ERR_PTR(-EINVAL); 1167 return ERR_PTR(-EINVAL);
1168 1168
1169 /*
1170 * If the new process will be in a different pid namespace
1171 * don't allow the creation of threads.
1172 */
1173 if ((clone_flags & (CLONE_VM|CLONE_NEWPID)) &&
1174 (task_active_pid_ns(current) != current->nsproxy->pid_ns))
1175 return ERR_PTR(-EINVAL);
1176
1169 retval = security_task_create(clone_flags); 1177 retval = security_task_create(clone_flags);
1170 if (retval) 1178 if (retval)
1171 goto fork_out; 1179 goto fork_out;
@@ -1660,8 +1668,10 @@ SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp,
1660 int, tls_val) 1668 int, tls_val)
1661#endif 1669#endif
1662{ 1670{
1663 return do_fork(clone_flags, newsp, 0, 1671 long ret = do_fork(clone_flags, newsp, 0, parent_tidptr, child_tidptr);
1664 parent_tidptr, child_tidptr); 1672 asmlinkage_protect(5, ret, clone_flags, newsp,
1673 parent_tidptr, child_tidptr, tls_val);
1674 return ret;
1665} 1675}
1666#endif 1676#endif
1667 1677
diff --git a/kernel/module.c b/kernel/module.c
index 250092c1d57d..eab08274ec9b 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -188,6 +188,7 @@ struct load_info {
188 ongoing or failed initialization etc. */ 188 ongoing or failed initialization etc. */
189static inline int strong_try_module_get(struct module *mod) 189static inline int strong_try_module_get(struct module *mod)
190{ 190{
191 BUG_ON(mod && mod->state == MODULE_STATE_UNFORMED);
191 if (mod && mod->state == MODULE_STATE_COMING) 192 if (mod && mod->state == MODULE_STATE_COMING)
192 return -EBUSY; 193 return -EBUSY;
193 if (try_module_get(mod)) 194 if (try_module_get(mod))
@@ -343,6 +344,9 @@ bool each_symbol_section(bool (*fn)(const struct symsearch *arr,
343#endif 344#endif
344 }; 345 };
345 346
347 if (mod->state == MODULE_STATE_UNFORMED)
348 continue;
349
346 if (each_symbol_in_section(arr, ARRAY_SIZE(arr), mod, fn, data)) 350 if (each_symbol_in_section(arr, ARRAY_SIZE(arr), mod, fn, data))
347 return true; 351 return true;
348 } 352 }
@@ -450,16 +454,24 @@ const struct kernel_symbol *find_symbol(const char *name,
450EXPORT_SYMBOL_GPL(find_symbol); 454EXPORT_SYMBOL_GPL(find_symbol);
451 455
452/* Search for module by name: must hold module_mutex. */ 456/* Search for module by name: must hold module_mutex. */
453struct module *find_module(const char *name) 457static struct module *find_module_all(const char *name,
458 bool even_unformed)
454{ 459{
455 struct module *mod; 460 struct module *mod;
456 461
457 list_for_each_entry(mod, &modules, list) { 462 list_for_each_entry(mod, &modules, list) {
463 if (!even_unformed && mod->state == MODULE_STATE_UNFORMED)
464 continue;
458 if (strcmp(mod->name, name) == 0) 465 if (strcmp(mod->name, name) == 0)
459 return mod; 466 return mod;
460 } 467 }
461 return NULL; 468 return NULL;
462} 469}
470
471struct module *find_module(const char *name)
472{
473 return find_module_all(name, false);
474}
463EXPORT_SYMBOL_GPL(find_module); 475EXPORT_SYMBOL_GPL(find_module);
464 476
465#ifdef CONFIG_SMP 477#ifdef CONFIG_SMP
@@ -525,6 +537,8 @@ bool is_module_percpu_address(unsigned long addr)
525 preempt_disable(); 537 preempt_disable();
526 538
527 list_for_each_entry_rcu(mod, &modules, list) { 539 list_for_each_entry_rcu(mod, &modules, list) {
540 if (mod->state == MODULE_STATE_UNFORMED)
541 continue;
528 if (!mod->percpu_size) 542 if (!mod->percpu_size)
529 continue; 543 continue;
530 for_each_possible_cpu(cpu) { 544 for_each_possible_cpu(cpu) {
@@ -1048,6 +1062,8 @@ static ssize_t show_initstate(struct module_attribute *mattr,
1048 case MODULE_STATE_GOING: 1062 case MODULE_STATE_GOING:
1049 state = "going"; 1063 state = "going";
1050 break; 1064 break;
1065 default:
1066 BUG();
1051 } 1067 }
1052 return sprintf(buffer, "%s\n", state); 1068 return sprintf(buffer, "%s\n", state);
1053} 1069}
@@ -1786,6 +1802,8 @@ void set_all_modules_text_rw(void)
1786 1802
1787 mutex_lock(&module_mutex); 1803 mutex_lock(&module_mutex);
1788 list_for_each_entry_rcu(mod, &modules, list) { 1804 list_for_each_entry_rcu(mod, &modules, list) {
1805 if (mod->state == MODULE_STATE_UNFORMED)
1806 continue;
1789 if ((mod->module_core) && (mod->core_text_size)) { 1807 if ((mod->module_core) && (mod->core_text_size)) {
1790 set_page_attributes(mod->module_core, 1808 set_page_attributes(mod->module_core,
1791 mod->module_core + mod->core_text_size, 1809 mod->module_core + mod->core_text_size,
@@ -1807,6 +1825,8 @@ void set_all_modules_text_ro(void)
1807 1825
1808 mutex_lock(&module_mutex); 1826 mutex_lock(&module_mutex);
1809 list_for_each_entry_rcu(mod, &modules, list) { 1827 list_for_each_entry_rcu(mod, &modules, list) {
1828 if (mod->state == MODULE_STATE_UNFORMED)
1829 continue;
1810 if ((mod->module_core) && (mod->core_text_size)) { 1830 if ((mod->module_core) && (mod->core_text_size)) {
1811 set_page_attributes(mod->module_core, 1831 set_page_attributes(mod->module_core,
1812 mod->module_core + mod->core_text_size, 1832 mod->module_core + mod->core_text_size,
@@ -2527,6 +2547,13 @@ static int copy_module_from_fd(int fd, struct load_info *info)
2527 err = -EFBIG; 2547 err = -EFBIG;
2528 goto out; 2548 goto out;
2529 } 2549 }
2550
2551 /* Don't hand 0 to vmalloc, it whines. */
2552 if (stat.size == 0) {
2553 err = -EINVAL;
2554 goto out;
2555 }
2556
2530 info->hdr = vmalloc(stat.size); 2557 info->hdr = vmalloc(stat.size);
2531 if (!info->hdr) { 2558 if (!info->hdr) {
2532 err = -ENOMEM; 2559 err = -ENOMEM;
@@ -2990,8 +3017,9 @@ static bool finished_loading(const char *name)
2990 bool ret; 3017 bool ret;
2991 3018
2992 mutex_lock(&module_mutex); 3019 mutex_lock(&module_mutex);
2993 mod = find_module(name); 3020 mod = find_module_all(name, true);
2994 ret = !mod || mod->state != MODULE_STATE_COMING; 3021 ret = !mod || mod->state == MODULE_STATE_LIVE
3022 || mod->state == MODULE_STATE_GOING;
2995 mutex_unlock(&module_mutex); 3023 mutex_unlock(&module_mutex);
2996 3024
2997 return ret; 3025 return ret;
@@ -3013,6 +3041,12 @@ static int do_init_module(struct module *mod)
3013{ 3041{
3014 int ret = 0; 3042 int ret = 0;
3015 3043
3044 /*
3045 * We want to find out whether @mod uses async during init. Clear
3046 * PF_USED_ASYNC. async_schedule*() will set it.
3047 */
3048 current->flags &= ~PF_USED_ASYNC;
3049
3016 blocking_notifier_call_chain(&module_notify_list, 3050 blocking_notifier_call_chain(&module_notify_list,
3017 MODULE_STATE_COMING, mod); 3051 MODULE_STATE_COMING, mod);
3018 3052
@@ -3058,8 +3092,25 @@ static int do_init_module(struct module *mod)
3058 blocking_notifier_call_chain(&module_notify_list, 3092 blocking_notifier_call_chain(&module_notify_list,
3059 MODULE_STATE_LIVE, mod); 3093 MODULE_STATE_LIVE, mod);
3060 3094
3061 /* We need to finish all async code before the module init sequence is done */ 3095 /*
3062 async_synchronize_full(); 3096 * We need to finish all async code before the module init sequence
3097 * is done. This has potential to deadlock. For example, a newly
3098 * detected block device can trigger request_module() of the
3099 * default iosched from async probing task. Once userland helper
3100 * reaches here, async_synchronize_full() will wait on the async
3101 * task waiting on request_module() and deadlock.
3102 *
3103 * This deadlock is avoided by perfomring async_synchronize_full()
3104 * iff module init queued any async jobs. This isn't a full
3105 * solution as it will deadlock the same if module loading from
3106 * async jobs nests more than once; however, due to the various
3107 * constraints, this hack seems to be the best option for now.
3108 * Please refer to the following thread for details.
3109 *
3110 * http://thread.gmane.org/gmane.linux.kernel/1420814
3111 */
3112 if (current->flags & PF_USED_ASYNC)
3113 async_synchronize_full();
3063 3114
3064 mutex_lock(&module_mutex); 3115 mutex_lock(&module_mutex);
3065 /* Drop initial reference. */ 3116 /* Drop initial reference. */
@@ -3113,6 +3164,32 @@ static int load_module(struct load_info *info, const char __user *uargs,
3113 goto free_copy; 3164 goto free_copy;
3114 } 3165 }
3115 3166
3167 /*
3168 * We try to place it in the list now to make sure it's unique
3169 * before we dedicate too many resources. In particular,
3170 * temporary percpu memory exhaustion.
3171 */
3172 mod->state = MODULE_STATE_UNFORMED;
3173again:
3174 mutex_lock(&module_mutex);
3175 if ((old = find_module_all(mod->name, true)) != NULL) {
3176 if (old->state == MODULE_STATE_COMING
3177 || old->state == MODULE_STATE_UNFORMED) {
3178 /* Wait in case it fails to load. */
3179 mutex_unlock(&module_mutex);
3180 err = wait_event_interruptible(module_wq,
3181 finished_loading(mod->name));
3182 if (err)
3183 goto free_module;
3184 goto again;
3185 }
3186 err = -EEXIST;
3187 mutex_unlock(&module_mutex);
3188 goto free_module;
3189 }
3190 list_add_rcu(&mod->list, &modules);
3191 mutex_unlock(&module_mutex);
3192
3116#ifdef CONFIG_MODULE_SIG 3193#ifdef CONFIG_MODULE_SIG
3117 mod->sig_ok = info->sig_ok; 3194 mod->sig_ok = info->sig_ok;
3118 if (!mod->sig_ok) 3195 if (!mod->sig_ok)
@@ -3122,7 +3199,7 @@ static int load_module(struct load_info *info, const char __user *uargs,
3122 /* Now module is in final location, initialize linked lists, etc. */ 3199 /* Now module is in final location, initialize linked lists, etc. */
3123 err = module_unload_init(mod); 3200 err = module_unload_init(mod);
3124 if (err) 3201 if (err)
3125 goto free_module; 3202 goto unlink_mod;
3126 3203
3127 /* Now we've got everything in the final locations, we can 3204 /* Now we've got everything in the final locations, we can
3128 * find optional sections. */ 3205 * find optional sections. */
@@ -3157,54 +3234,33 @@ static int load_module(struct load_info *info, const char __user *uargs,
3157 goto free_arch_cleanup; 3234 goto free_arch_cleanup;
3158 } 3235 }
3159 3236
3160 /* Mark state as coming so strong_try_module_get() ignores us. */
3161 mod->state = MODULE_STATE_COMING;
3162
3163 /* Now sew it into the lists so we can get lockdep and oops
3164 * info during argument parsing. No one should access us, since
3165 * strong_try_module_get() will fail.
3166 * lockdep/oops can run asynchronous, so use the RCU list insertion
3167 * function to insert in a way safe to concurrent readers.
3168 * The mutex protects against concurrent writers.
3169 */
3170again:
3171 mutex_lock(&module_mutex);
3172 if ((old = find_module(mod->name)) != NULL) {
3173 if (old->state == MODULE_STATE_COMING) {
3174 /* Wait in case it fails to load. */
3175 mutex_unlock(&module_mutex);
3176 err = wait_event_interruptible(module_wq,
3177 finished_loading(mod->name));
3178 if (err)
3179 goto free_arch_cleanup;
3180 goto again;
3181 }
3182 err = -EEXIST;
3183 goto unlock;
3184 }
3185
3186 /* This has to be done once we're sure module name is unique. */
3187 dynamic_debug_setup(info->debug, info->num_debug); 3237 dynamic_debug_setup(info->debug, info->num_debug);
3188 3238
3189 /* Find duplicate symbols */ 3239 mutex_lock(&module_mutex);
3240 /* Find duplicate symbols (must be called under lock). */
3190 err = verify_export_symbols(mod); 3241 err = verify_export_symbols(mod);
3191 if (err < 0) 3242 if (err < 0)
3192 goto ddebug; 3243 goto ddebug_cleanup;
3193 3244
3245 /* This relies on module_mutex for list integrity. */
3194 module_bug_finalize(info->hdr, info->sechdrs, mod); 3246 module_bug_finalize(info->hdr, info->sechdrs, mod);
3195 list_add_rcu(&mod->list, &modules); 3247
3248 /* Mark state as coming so strong_try_module_get() ignores us,
3249 * but kallsyms etc. can see us. */
3250 mod->state = MODULE_STATE_COMING;
3251
3196 mutex_unlock(&module_mutex); 3252 mutex_unlock(&module_mutex);
3197 3253
3198 /* Module is ready to execute: parsing args may do that. */ 3254 /* Module is ready to execute: parsing args may do that. */
3199 err = parse_args(mod->name, mod->args, mod->kp, mod->num_kp, 3255 err = parse_args(mod->name, mod->args, mod->kp, mod->num_kp,
3200 -32768, 32767, &ddebug_dyndbg_module_param_cb); 3256 -32768, 32767, &ddebug_dyndbg_module_param_cb);
3201 if (err < 0) 3257 if (err < 0)
3202 goto unlink; 3258 goto bug_cleanup;
3203 3259
3204 /* Link in to syfs. */ 3260 /* Link in to syfs. */
3205 err = mod_sysfs_setup(mod, info, mod->kp, mod->num_kp); 3261 err = mod_sysfs_setup(mod, info, mod->kp, mod->num_kp);
3206 if (err < 0) 3262 if (err < 0)
3207 goto unlink; 3263 goto bug_cleanup;
3208 3264
3209 /* Get rid of temporary copy. */ 3265 /* Get rid of temporary copy. */
3210 free_copy(info); 3266 free_copy(info);
@@ -3214,16 +3270,13 @@ again:
3214 3270
3215 return do_init_module(mod); 3271 return do_init_module(mod);
3216 3272
3217 unlink: 3273 bug_cleanup:
3274 /* module_bug_cleanup needs module_mutex protection */
3218 mutex_lock(&module_mutex); 3275 mutex_lock(&module_mutex);
3219 /* Unlink carefully: kallsyms could be walking list. */
3220 list_del_rcu(&mod->list);
3221 module_bug_cleanup(mod); 3276 module_bug_cleanup(mod);
3222 wake_up_all(&module_wq); 3277 ddebug_cleanup:
3223 ddebug:
3224 dynamic_debug_remove(info->debug);
3225 unlock:
3226 mutex_unlock(&module_mutex); 3278 mutex_unlock(&module_mutex);
3279 dynamic_debug_remove(info->debug);
3227 synchronize_sched(); 3280 synchronize_sched();
3228 kfree(mod->args); 3281 kfree(mod->args);
3229 free_arch_cleanup: 3282 free_arch_cleanup:
@@ -3232,6 +3285,12 @@ again:
3232 free_modinfo(mod); 3285 free_modinfo(mod);
3233 free_unload: 3286 free_unload:
3234 module_unload_free(mod); 3287 module_unload_free(mod);
3288 unlink_mod:
3289 mutex_lock(&module_mutex);
3290 /* Unlink carefully: kallsyms could be walking list. */
3291 list_del_rcu(&mod->list);
3292 wake_up_all(&module_wq);
3293 mutex_unlock(&module_mutex);
3235 free_module: 3294 free_module:
3236 module_deallocate(mod, info); 3295 module_deallocate(mod, info);
3237 free_copy: 3296 free_copy:
@@ -3354,6 +3413,8 @@ const char *module_address_lookup(unsigned long addr,
3354 3413
3355 preempt_disable(); 3414 preempt_disable();
3356 list_for_each_entry_rcu(mod, &modules, list) { 3415 list_for_each_entry_rcu(mod, &modules, list) {
3416 if (mod->state == MODULE_STATE_UNFORMED)
3417 continue;
3357 if (within_module_init(addr, mod) || 3418 if (within_module_init(addr, mod) ||
3358 within_module_core(addr, mod)) { 3419 within_module_core(addr, mod)) {
3359 if (modname) 3420 if (modname)
@@ -3377,6 +3438,8 @@ int lookup_module_symbol_name(unsigned long addr, char *symname)
3377 3438
3378 preempt_disable(); 3439 preempt_disable();
3379 list_for_each_entry_rcu(mod, &modules, list) { 3440 list_for_each_entry_rcu(mod, &modules, list) {
3441 if (mod->state == MODULE_STATE_UNFORMED)
3442 continue;
3380 if (within_module_init(addr, mod) || 3443 if (within_module_init(addr, mod) ||
3381 within_module_core(addr, mod)) { 3444 within_module_core(addr, mod)) {
3382 const char *sym; 3445 const char *sym;
@@ -3401,6 +3464,8 @@ int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size,
3401 3464
3402 preempt_disable(); 3465 preempt_disable();
3403 list_for_each_entry_rcu(mod, &modules, list) { 3466 list_for_each_entry_rcu(mod, &modules, list) {
3467 if (mod->state == MODULE_STATE_UNFORMED)
3468 continue;
3404 if (within_module_init(addr, mod) || 3469 if (within_module_init(addr, mod) ||
3405 within_module_core(addr, mod)) { 3470 within_module_core(addr, mod)) {
3406 const char *sym; 3471 const char *sym;
@@ -3428,6 +3493,8 @@ int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
3428 3493
3429 preempt_disable(); 3494 preempt_disable();
3430 list_for_each_entry_rcu(mod, &modules, list) { 3495 list_for_each_entry_rcu(mod, &modules, list) {
3496 if (mod->state == MODULE_STATE_UNFORMED)
3497 continue;
3431 if (symnum < mod->num_symtab) { 3498 if (symnum < mod->num_symtab) {
3432 *value = mod->symtab[symnum].st_value; 3499 *value = mod->symtab[symnum].st_value;
3433 *type = mod->symtab[symnum].st_info; 3500 *type = mod->symtab[symnum].st_info;
@@ -3470,9 +3537,12 @@ unsigned long module_kallsyms_lookup_name(const char *name)
3470 ret = mod_find_symname(mod, colon+1); 3537 ret = mod_find_symname(mod, colon+1);
3471 *colon = ':'; 3538 *colon = ':';
3472 } else { 3539 } else {
3473 list_for_each_entry_rcu(mod, &modules, list) 3540 list_for_each_entry_rcu(mod, &modules, list) {
3541 if (mod->state == MODULE_STATE_UNFORMED)
3542 continue;
3474 if ((ret = mod_find_symname(mod, name)) != 0) 3543 if ((ret = mod_find_symname(mod, name)) != 0)
3475 break; 3544 break;
3545 }
3476 } 3546 }
3477 preempt_enable(); 3547 preempt_enable();
3478 return ret; 3548 return ret;
@@ -3487,6 +3557,8 @@ int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
3487 int ret; 3557 int ret;
3488 3558
3489 list_for_each_entry(mod, &modules, list) { 3559 list_for_each_entry(mod, &modules, list) {
3560 if (mod->state == MODULE_STATE_UNFORMED)
3561 continue;
3490 for (i = 0; i < mod->num_symtab; i++) { 3562 for (i = 0; i < mod->num_symtab; i++) {
3491 ret = fn(data, mod->strtab + mod->symtab[i].st_name, 3563 ret = fn(data, mod->strtab + mod->symtab[i].st_name,
3492 mod, mod->symtab[i].st_value); 3564 mod, mod->symtab[i].st_value);
@@ -3502,6 +3574,7 @@ static char *module_flags(struct module *mod, char *buf)
3502{ 3574{
3503 int bx = 0; 3575 int bx = 0;
3504 3576
3577 BUG_ON(mod->state == MODULE_STATE_UNFORMED);
3505 if (mod->taints || 3578 if (mod->taints ||
3506 mod->state == MODULE_STATE_GOING || 3579 mod->state == MODULE_STATE_GOING ||
3507 mod->state == MODULE_STATE_COMING) { 3580 mod->state == MODULE_STATE_COMING) {
@@ -3543,6 +3616,10 @@ static int m_show(struct seq_file *m, void *p)
3543 struct module *mod = list_entry(p, struct module, list); 3616 struct module *mod = list_entry(p, struct module, list);
3544 char buf[8]; 3617 char buf[8];
3545 3618
3619 /* We always ignore unformed modules. */
3620 if (mod->state == MODULE_STATE_UNFORMED)
3621 return 0;
3622
3546 seq_printf(m, "%s %u", 3623 seq_printf(m, "%s %u",
3547 mod->name, mod->init_size + mod->core_size); 3624 mod->name, mod->init_size + mod->core_size);
3548 print_unload_info(m, mod); 3625 print_unload_info(m, mod);
@@ -3603,6 +3680,8 @@ const struct exception_table_entry *search_module_extables(unsigned long addr)
3603 3680
3604 preempt_disable(); 3681 preempt_disable();
3605 list_for_each_entry_rcu(mod, &modules, list) { 3682 list_for_each_entry_rcu(mod, &modules, list) {
3683 if (mod->state == MODULE_STATE_UNFORMED)
3684 continue;
3606 if (mod->num_exentries == 0) 3685 if (mod->num_exentries == 0)
3607 continue; 3686 continue;
3608 3687
@@ -3651,10 +3730,13 @@ struct module *__module_address(unsigned long addr)
3651 if (addr < module_addr_min || addr > module_addr_max) 3730 if (addr < module_addr_min || addr > module_addr_max)
3652 return NULL; 3731 return NULL;
3653 3732
3654 list_for_each_entry_rcu(mod, &modules, list) 3733 list_for_each_entry_rcu(mod, &modules, list) {
3734 if (mod->state == MODULE_STATE_UNFORMED)
3735 continue;
3655 if (within_module_core(addr, mod) 3736 if (within_module_core(addr, mod)
3656 || within_module_init(addr, mod)) 3737 || within_module_init(addr, mod))
3657 return mod; 3738 return mod;
3739 }
3658 return NULL; 3740 return NULL;
3659} 3741}
3660EXPORT_SYMBOL_GPL(__module_address); 3742EXPORT_SYMBOL_GPL(__module_address);
@@ -3707,8 +3789,11 @@ void print_modules(void)
3707 printk(KERN_DEFAULT "Modules linked in:"); 3789 printk(KERN_DEFAULT "Modules linked in:");
3708 /* Most callers should already have preempt disabled, but make sure */ 3790 /* Most callers should already have preempt disabled, but make sure */
3709 preempt_disable(); 3791 preempt_disable();
3710 list_for_each_entry_rcu(mod, &modules, list) 3792 list_for_each_entry_rcu(mod, &modules, list) {
3793 if (mod->state == MODULE_STATE_UNFORMED)
3794 continue;
3711 printk(" %s%s", mod->name, module_flags(mod, buf)); 3795 printk(" %s%s", mod->name, module_flags(mod, buf));
3796 }
3712 preempt_enable(); 3797 preempt_enable();
3713 if (last_unloaded_module[0]) 3798 if (last_unloaded_module[0])
3714 printk(" [last unloaded: %s]", last_unloaded_module); 3799 printk(" [last unloaded: %s]", last_unloaded_module);
diff --git a/kernel/pid.c b/kernel/pid.c
index 36aa02ff17d6..de9af600006f 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -270,7 +270,6 @@ void free_pid(struct pid *pid)
270 wake_up_process(ns->child_reaper); 270 wake_up_process(ns->child_reaper);
271 break; 271 break;
272 case 0: 272 case 0:
273 ns->nr_hashed = -1;
274 schedule_work(&ns->proc_work); 273 schedule_work(&ns->proc_work);
275 break; 274 break;
276 } 275 }
@@ -319,7 +318,7 @@ struct pid *alloc_pid(struct pid_namespace *ns)
319 318
320 upid = pid->numbers + ns->level; 319 upid = pid->numbers + ns->level;
321 spin_lock_irq(&pidmap_lock); 320 spin_lock_irq(&pidmap_lock);
322 if (ns->nr_hashed < 0) 321 if (!(ns->nr_hashed & PIDNS_HASH_ADDING))
323 goto out_unlock; 322 goto out_unlock;
324 for ( ; upid >= pid->numbers; --upid) { 323 for ( ; upid >= pid->numbers; --upid) {
325 hlist_add_head_rcu(&upid->pid_chain, 324 hlist_add_head_rcu(&upid->pid_chain,
@@ -342,6 +341,13 @@ out_free:
342 goto out; 341 goto out;
343} 342}
344 343
344void disable_pid_allocation(struct pid_namespace *ns)
345{
346 spin_lock_irq(&pidmap_lock);
347 ns->nr_hashed &= ~PIDNS_HASH_ADDING;
348 spin_unlock_irq(&pidmap_lock);
349}
350
345struct pid *find_pid_ns(int nr, struct pid_namespace *ns) 351struct pid *find_pid_ns(int nr, struct pid_namespace *ns)
346{ 352{
347 struct hlist_node *elem; 353 struct hlist_node *elem;
@@ -573,6 +579,9 @@ void __init pidhash_init(void)
573 579
574void __init pidmap_init(void) 580void __init pidmap_init(void)
575{ 581{
582 /* Veryify no one has done anything silly */
583 BUILD_BUG_ON(PID_MAX_LIMIT >= PIDNS_HASH_ADDING);
584
576 /* bump default and minimum pid_max based on number of cpus */ 585 /* bump default and minimum pid_max based on number of cpus */
577 pid_max = min(pid_max_max, max_t(int, pid_max, 586 pid_max = min(pid_max_max, max_t(int, pid_max,
578 PIDS_PER_CPU_DEFAULT * num_possible_cpus())); 587 PIDS_PER_CPU_DEFAULT * num_possible_cpus()));
@@ -584,7 +593,7 @@ void __init pidmap_init(void)
584 /* Reserve PID 0. We never call free_pidmap(0) */ 593 /* Reserve PID 0. We never call free_pidmap(0) */
585 set_bit(0, init_pid_ns.pidmap[0].page); 594 set_bit(0, init_pid_ns.pidmap[0].page);
586 atomic_dec(&init_pid_ns.pidmap[0].nr_free); 595 atomic_dec(&init_pid_ns.pidmap[0].nr_free);
587 init_pid_ns.nr_hashed = 1; 596 init_pid_ns.nr_hashed = PIDNS_HASH_ADDING;
588 597
589 init_pid_ns.pid_cachep = KMEM_CACHE(pid, 598 init_pid_ns.pid_cachep = KMEM_CACHE(pid,
590 SLAB_HWCACHE_ALIGN | SLAB_PANIC); 599 SLAB_HWCACHE_ALIGN | SLAB_PANIC);
diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c
index fdbd0cdf271a..c1c3dc1c6023 100644
--- a/kernel/pid_namespace.c
+++ b/kernel/pid_namespace.c
@@ -115,6 +115,7 @@ static struct pid_namespace *create_pid_namespace(struct user_namespace *user_ns
115 ns->level = level; 115 ns->level = level;
116 ns->parent = get_pid_ns(parent_pid_ns); 116 ns->parent = get_pid_ns(parent_pid_ns);
117 ns->user_ns = get_user_ns(user_ns); 117 ns->user_ns = get_user_ns(user_ns);
118 ns->nr_hashed = PIDNS_HASH_ADDING;
118 INIT_WORK(&ns->proc_work, proc_cleanup_work); 119 INIT_WORK(&ns->proc_work, proc_cleanup_work);
119 120
120 set_bit(0, ns->pidmap[0].page); 121 set_bit(0, ns->pidmap[0].page);
@@ -181,6 +182,9 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns)
181 int rc; 182 int rc;
182 struct task_struct *task, *me = current; 183 struct task_struct *task, *me = current;
183 184
185 /* Don't allow any more processes into the pid namespace */
186 disable_pid_allocation(pid_ns);
187
184 /* Ignore SIGCHLD causing any terminated children to autoreap */ 188 /* Ignore SIGCHLD causing any terminated children to autoreap */
185 spin_lock_irq(&me->sighand->siglock); 189 spin_lock_irq(&me->sighand->siglock);
186 me->sighand->action[SIGCHLD - 1].sa.sa_handler = SIG_IGN; 190 me->sighand->action[SIGCHLD - 1].sa.sa_handler = SIG_IGN;
diff --git a/kernel/printk.c b/kernel/printk.c
index 19c0d7bcf24a..267ce780abe8 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -87,12 +87,6 @@ static DEFINE_SEMAPHORE(console_sem);
87struct console *console_drivers; 87struct console *console_drivers;
88EXPORT_SYMBOL_GPL(console_drivers); 88EXPORT_SYMBOL_GPL(console_drivers);
89 89
90#ifdef CONFIG_LOCKDEP
91static struct lockdep_map console_lock_dep_map = {
92 .name = "console_lock"
93};
94#endif
95
96/* 90/*
97 * This is used for debugging the mess that is the VT code by 91 * This is used for debugging the mess that is the VT code by
98 * keeping track if we have the console semaphore held. It's 92 * keeping track if we have the console semaphore held. It's
@@ -870,10 +864,11 @@ static size_t print_time(u64 ts, char *buf)
870 if (!printk_time) 864 if (!printk_time)
871 return 0; 865 return 0;
872 866
867 rem_nsec = do_div(ts, 1000000000);
868
873 if (!buf) 869 if (!buf)
874 return 15; 870 return snprintf(NULL, 0, "[%5lu.000000] ", (unsigned long)ts);
875 871
876 rem_nsec = do_div(ts, 1000000000);
877 return sprintf(buf, "[%5lu.%06lu] ", 872 return sprintf(buf, "[%5lu.%06lu] ",
878 (unsigned long)ts, rem_nsec / 1000); 873 (unsigned long)ts, rem_nsec / 1000);
879} 874}
@@ -1923,7 +1918,6 @@ void console_lock(void)
1923 return; 1918 return;
1924 console_locked = 1; 1919 console_locked = 1;
1925 console_may_schedule = 1; 1920 console_may_schedule = 1;
1926 mutex_acquire(&console_lock_dep_map, 0, 0, _RET_IP_);
1927} 1921}
1928EXPORT_SYMBOL(console_lock); 1922EXPORT_SYMBOL(console_lock);
1929 1923
@@ -1945,7 +1939,6 @@ int console_trylock(void)
1945 } 1939 }
1946 console_locked = 1; 1940 console_locked = 1;
1947 console_may_schedule = 0; 1941 console_may_schedule = 0;
1948 mutex_acquire(&console_lock_dep_map, 0, 1, _RET_IP_);
1949 return 1; 1942 return 1;
1950} 1943}
1951EXPORT_SYMBOL(console_trylock); 1944EXPORT_SYMBOL(console_trylock);
@@ -2106,7 +2099,6 @@ skip:
2106 local_irq_restore(flags); 2099 local_irq_restore(flags);
2107 } 2100 }
2108 console_locked = 0; 2101 console_locked = 0;
2109 mutex_release(&console_lock_dep_map, 1, _RET_IP_);
2110 2102
2111 /* Release the exclusive_console once it is used */ 2103 /* Release the exclusive_console once it is used */
2112 if (unlikely(exclusive_console)) 2104 if (unlikely(exclusive_console))
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 1599157336a6..6cbeaae4406d 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -117,11 +117,45 @@ void __ptrace_unlink(struct task_struct *child)
117 * TASK_KILLABLE sleeps. 117 * TASK_KILLABLE sleeps.
118 */ 118 */
119 if (child->jobctl & JOBCTL_STOP_PENDING || task_is_traced(child)) 119 if (child->jobctl & JOBCTL_STOP_PENDING || task_is_traced(child))
120 signal_wake_up(child, task_is_traced(child)); 120 ptrace_signal_wake_up(child, true);
121 121
122 spin_unlock(&child->sighand->siglock); 122 spin_unlock(&child->sighand->siglock);
123} 123}
124 124
125/* Ensure that nothing can wake it up, even SIGKILL */
126static bool ptrace_freeze_traced(struct task_struct *task)
127{
128 bool ret = false;
129
130 /* Lockless, nobody but us can set this flag */
131 if (task->jobctl & JOBCTL_LISTENING)
132 return ret;
133
134 spin_lock_irq(&task->sighand->siglock);
135 if (task_is_traced(task) && !__fatal_signal_pending(task)) {
136 task->state = __TASK_TRACED;
137 ret = true;
138 }
139 spin_unlock_irq(&task->sighand->siglock);
140
141 return ret;
142}
143
144static void ptrace_unfreeze_traced(struct task_struct *task)
145{
146 if (task->state != __TASK_TRACED)
147 return;
148
149 WARN_ON(!task->ptrace || task->parent != current);
150
151 spin_lock_irq(&task->sighand->siglock);
152 if (__fatal_signal_pending(task))
153 wake_up_state(task, __TASK_TRACED);
154 else
155 task->state = TASK_TRACED;
156 spin_unlock_irq(&task->sighand->siglock);
157}
158
125/** 159/**
126 * ptrace_check_attach - check whether ptracee is ready for ptrace operation 160 * ptrace_check_attach - check whether ptracee is ready for ptrace operation
127 * @child: ptracee to check for 161 * @child: ptracee to check for
@@ -139,7 +173,7 @@ void __ptrace_unlink(struct task_struct *child)
139 * RETURNS: 173 * RETURNS:
140 * 0 on success, -ESRCH if %child is not ready. 174 * 0 on success, -ESRCH if %child is not ready.
141 */ 175 */
142int ptrace_check_attach(struct task_struct *child, bool ignore_state) 176static int ptrace_check_attach(struct task_struct *child, bool ignore_state)
143{ 177{
144 int ret = -ESRCH; 178 int ret = -ESRCH;
145 179
@@ -151,24 +185,29 @@ int ptrace_check_attach(struct task_struct *child, bool ignore_state)
151 * be changed by us so it's not changing right after this. 185 * be changed by us so it's not changing right after this.
152 */ 186 */
153 read_lock(&tasklist_lock); 187 read_lock(&tasklist_lock);
154 if ((child->ptrace & PT_PTRACED) && child->parent == current) { 188 if (child->ptrace && child->parent == current) {
189 WARN_ON(child->state == __TASK_TRACED);
155 /* 190 /*
156 * child->sighand can't be NULL, release_task() 191 * child->sighand can't be NULL, release_task()
157 * does ptrace_unlink() before __exit_signal(). 192 * does ptrace_unlink() before __exit_signal().
158 */ 193 */
159 spin_lock_irq(&child->sighand->siglock); 194 if (ignore_state || ptrace_freeze_traced(child))
160 WARN_ON_ONCE(task_is_stopped(child));
161 if (ignore_state || (task_is_traced(child) &&
162 !(child->jobctl & JOBCTL_LISTENING)))
163 ret = 0; 195 ret = 0;
164 spin_unlock_irq(&child->sighand->siglock);
165 } 196 }
166 read_unlock(&tasklist_lock); 197 read_unlock(&tasklist_lock);
167 198
168 if (!ret && !ignore_state) 199 if (!ret && !ignore_state) {
169 ret = wait_task_inactive(child, TASK_TRACED) ? 0 : -ESRCH; 200 if (!wait_task_inactive(child, __TASK_TRACED)) {
201 /*
202 * This can only happen if may_ptrace_stop() fails and
203 * ptrace_stop() changes ->state back to TASK_RUNNING,
204 * so we should not worry about leaking __TASK_TRACED.
205 */
206 WARN_ON(child->state == __TASK_TRACED);
207 ret = -ESRCH;
208 }
209 }
170 210
171 /* All systems go.. */
172 return ret; 211 return ret;
173} 212}
174 213
@@ -317,7 +356,7 @@ static int ptrace_attach(struct task_struct *task, long request,
317 */ 356 */
318 if (task_is_stopped(task) && 357 if (task_is_stopped(task) &&
319 task_set_jobctl_pending(task, JOBCTL_TRAP_STOP | JOBCTL_TRAPPING)) 358 task_set_jobctl_pending(task, JOBCTL_TRAP_STOP | JOBCTL_TRAPPING))
320 signal_wake_up(task, 1); 359 signal_wake_up_state(task, __TASK_STOPPED);
321 360
322 spin_unlock(&task->sighand->siglock); 361 spin_unlock(&task->sighand->siglock);
323 362
@@ -737,7 +776,7 @@ int ptrace_request(struct task_struct *child, long request,
737 * tracee into STOP. 776 * tracee into STOP.
738 */ 777 */
739 if (likely(task_set_jobctl_pending(child, JOBCTL_TRAP_STOP))) 778 if (likely(task_set_jobctl_pending(child, JOBCTL_TRAP_STOP)))
740 signal_wake_up(child, child->jobctl & JOBCTL_LISTENING); 779 ptrace_signal_wake_up(child, child->jobctl & JOBCTL_LISTENING);
741 780
742 unlock_task_sighand(child, &flags); 781 unlock_task_sighand(child, &flags);
743 ret = 0; 782 ret = 0;
@@ -763,7 +802,7 @@ int ptrace_request(struct task_struct *child, long request,
763 * start of this trap and now. Trigger re-trap. 802 * start of this trap and now. Trigger re-trap.
764 */ 803 */
765 if (child->jobctl & JOBCTL_TRAP_NOTIFY) 804 if (child->jobctl & JOBCTL_TRAP_NOTIFY)
766 signal_wake_up(child, true); 805 ptrace_signal_wake_up(child, true);
767 ret = 0; 806 ret = 0;
768 } 807 }
769 unlock_task_sighand(child, &flags); 808 unlock_task_sighand(child, &flags);
@@ -900,6 +939,8 @@ SYSCALL_DEFINE4(ptrace, long, request, long, pid, unsigned long, addr,
900 goto out_put_task_struct; 939 goto out_put_task_struct;
901 940
902 ret = arch_ptrace(child, request, addr, data); 941 ret = arch_ptrace(child, request, addr, data);
942 if (ret || request != PTRACE_DETACH)
943 ptrace_unfreeze_traced(child);
903 944
904 out_put_task_struct: 945 out_put_task_struct:
905 put_task_struct(child); 946 put_task_struct(child);
@@ -1039,8 +1080,11 @@ asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid,
1039 1080
1040 ret = ptrace_check_attach(child, request == PTRACE_KILL || 1081 ret = ptrace_check_attach(child, request == PTRACE_KILL ||
1041 request == PTRACE_INTERRUPT); 1082 request == PTRACE_INTERRUPT);
1042 if (!ret) 1083 if (!ret) {
1043 ret = compat_arch_ptrace(child, request, addr, data); 1084 ret = compat_arch_ptrace(child, request, addr, data);
1085 if (ret || request != PTRACE_DETACH)
1086 ptrace_unfreeze_traced(child);
1087 }
1044 1088
1045 out_put_task_struct: 1089 out_put_task_struct:
1046 put_task_struct(child); 1090 put_task_struct(child);
diff --git a/kernel/rwsem.c b/kernel/rwsem.c
index 6850f53e02d8..b3c6c3fcd847 100644
--- a/kernel/rwsem.c
+++ b/kernel/rwsem.c
@@ -116,6 +116,16 @@ void down_read_nested(struct rw_semaphore *sem, int subclass)
116 116
117EXPORT_SYMBOL(down_read_nested); 117EXPORT_SYMBOL(down_read_nested);
118 118
119void _down_write_nest_lock(struct rw_semaphore *sem, struct lockdep_map *nest)
120{
121 might_sleep();
122 rwsem_acquire_nest(&sem->dep_map, 0, 0, nest, _RET_IP_);
123
124 LOCK_CONTENDED(sem, __down_write_trylock, __down_write);
125}
126
127EXPORT_SYMBOL(_down_write_nest_lock);
128
119void down_write_nested(struct rw_semaphore *sem, int subclass) 129void down_write_nested(struct rw_semaphore *sem, int subclass)
120{ 130{
121 might_sleep(); 131 might_sleep();
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 257002c13bb0..26058d0bebba 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1523,7 +1523,8 @@ out:
1523 */ 1523 */
1524int wake_up_process(struct task_struct *p) 1524int wake_up_process(struct task_struct *p)
1525{ 1525{
1526 return try_to_wake_up(p, TASK_ALL, 0); 1526 WARN_ON(task_is_stopped_or_traced(p));
1527 return try_to_wake_up(p, TASK_NORMAL, 0);
1527} 1528}
1528EXPORT_SYMBOL(wake_up_process); 1529EXPORT_SYMBOL(wake_up_process);
1529 1530
diff --git a/kernel/signal.c b/kernel/signal.c
index 7aaa51d8e5b8..3d09cf6cde75 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -680,23 +680,17 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
680 * No need to set need_resched since signal event passing 680 * No need to set need_resched since signal event passing
681 * goes through ->blocked 681 * goes through ->blocked
682 */ 682 */
683void signal_wake_up(struct task_struct *t, int resume) 683void signal_wake_up_state(struct task_struct *t, unsigned int state)
684{ 684{
685 unsigned int mask;
686
687 set_tsk_thread_flag(t, TIF_SIGPENDING); 685 set_tsk_thread_flag(t, TIF_SIGPENDING);
688
689 /* 686 /*
690 * For SIGKILL, we want to wake it up in the stopped/traced/killable 687 * TASK_WAKEKILL also means wake it up in the stopped/traced/killable
691 * case. We don't check t->state here because there is a race with it 688 * case. We don't check t->state here because there is a race with it
692 * executing another processor and just now entering stopped state. 689 * executing another processor and just now entering stopped state.
693 * By using wake_up_state, we ensure the process will wake up and 690 * By using wake_up_state, we ensure the process will wake up and
694 * handle its death signal. 691 * handle its death signal.
695 */ 692 */
696 mask = TASK_INTERRUPTIBLE; 693 if (!wake_up_state(t, state | TASK_INTERRUPTIBLE))
697 if (resume)
698 mask |= TASK_WAKEKILL;
699 if (!wake_up_state(t, mask))
700 kick_process(t); 694 kick_process(t);
701} 695}
702 696
@@ -844,7 +838,7 @@ static void ptrace_trap_notify(struct task_struct *t)
844 assert_spin_locked(&t->sighand->siglock); 838 assert_spin_locked(&t->sighand->siglock);
845 839
846 task_set_jobctl_pending(t, JOBCTL_TRAP_NOTIFY); 840 task_set_jobctl_pending(t, JOBCTL_TRAP_NOTIFY);
847 signal_wake_up(t, t->jobctl & JOBCTL_LISTENING); 841 ptrace_signal_wake_up(t, t->jobctl & JOBCTL_LISTENING);
848} 842}
849 843
850/* 844/*
@@ -1800,6 +1794,10 @@ static inline int may_ptrace_stop(void)
1800 * If SIGKILL was already sent before the caller unlocked 1794 * If SIGKILL was already sent before the caller unlocked
1801 * ->siglock we must see ->core_state != NULL. Otherwise it 1795 * ->siglock we must see ->core_state != NULL. Otherwise it
1802 * is safe to enter schedule(). 1796 * is safe to enter schedule().
1797 *
1798 * This is almost outdated, a task with the pending SIGKILL can't
1799 * block in TASK_TRACED. But PTRACE_EVENT_EXIT can be reported
1800 * after SIGKILL was already dequeued.
1803 */ 1801 */
1804 if (unlikely(current->mm->core_state) && 1802 if (unlikely(current->mm->core_state) &&
1805 unlikely(current->mm == current->parent->mm)) 1803 unlikely(current->mm == current->parent->mm))
@@ -1925,6 +1923,7 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info)
1925 if (gstop_done) 1923 if (gstop_done)
1926 do_notify_parent_cldstop(current, false, why); 1924 do_notify_parent_cldstop(current, false, why);
1927 1925
1926 /* tasklist protects us from ptrace_freeze_traced() */
1928 __set_current_state(TASK_RUNNING); 1927 __set_current_state(TASK_RUNNING);
1929 if (clear_code) 1928 if (clear_code)
1930 current->exit_code = 0; 1929 current->exit_code = 0;
@@ -2528,11 +2527,8 @@ static void __set_task_blocked(struct task_struct *tsk, const sigset_t *newset)
2528 */ 2527 */
2529void set_current_blocked(sigset_t *newset) 2528void set_current_blocked(sigset_t *newset)
2530{ 2529{
2531 struct task_struct *tsk = current;
2532 sigdelsetmask(newset, sigmask(SIGKILL) | sigmask(SIGSTOP)); 2530 sigdelsetmask(newset, sigmask(SIGKILL) | sigmask(SIGSTOP));
2533 spin_lock_irq(&tsk->sighand->siglock); 2531 __set_current_blocked(newset);
2534 __set_task_blocked(tsk, newset);
2535 spin_unlock_irq(&tsk->sighand->siglock);
2536} 2532}
2537 2533
2538void __set_current_blocked(const sigset_t *newset) 2534void __set_current_blocked(const sigset_t *newset)
@@ -3119,8 +3115,9 @@ int __save_altstack(stack_t __user *uss, unsigned long sp)
3119 3115
3120#ifdef CONFIG_COMPAT 3116#ifdef CONFIG_COMPAT
3121#ifdef CONFIG_GENERIC_SIGALTSTACK 3117#ifdef CONFIG_GENERIC_SIGALTSTACK
3122asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr, 3118COMPAT_SYSCALL_DEFINE2(sigaltstack,
3123 compat_stack_t __user *uoss_ptr) 3119 const compat_stack_t __user *, uss_ptr,
3120 compat_stack_t __user *, uoss_ptr)
3124{ 3121{
3125 stack_t uss, uoss; 3122 stack_t uss, uoss;
3126 int ret; 3123 int ret;
@@ -3204,7 +3201,6 @@ SYSCALL_DEFINE3(sigprocmask, int, how, old_sigset_t __user *, nset,
3204 if (nset) { 3201 if (nset) {
3205 if (copy_from_user(&new_set, nset, sizeof(*nset))) 3202 if (copy_from_user(&new_set, nset, sizeof(*nset)))
3206 return -EFAULT; 3203 return -EFAULT;
3207 new_set &= ~(sigmask(SIGKILL) | sigmask(SIGSTOP));
3208 3204
3209 new_blocked = current->blocked; 3205 new_blocked = current->blocked;
3210 3206
@@ -3222,7 +3218,7 @@ SYSCALL_DEFINE3(sigprocmask, int, how, old_sigset_t __user *, nset,
3222 return -EINVAL; 3218 return -EINVAL;
3223 } 3219 }
3224 3220
3225 __set_current_blocked(&new_blocked); 3221 set_current_blocked(&new_blocked);
3226 } 3222 }
3227 3223
3228 if (oset) { 3224 if (oset) {
@@ -3286,6 +3282,7 @@ SYSCALL_DEFINE1(ssetmask, int, newmask)
3286 int old = current->blocked.sig[0]; 3282 int old = current->blocked.sig[0];
3287 sigset_t newset; 3283 sigset_t newset;
3288 3284
3285 siginitset(&newset, newmask);
3289 set_current_blocked(&newset); 3286 set_current_blocked(&newset);
3290 3287
3291 return old; 3288 return old;
diff --git a/kernel/smp.c b/kernel/smp.c
index 29dd40a9f2f4..69f38bd98b42 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -33,6 +33,7 @@ struct call_function_data {
33 struct call_single_data csd; 33 struct call_single_data csd;
34 atomic_t refs; 34 atomic_t refs;
35 cpumask_var_t cpumask; 35 cpumask_var_t cpumask;
36 cpumask_var_t cpumask_ipi;
36}; 37};
37 38
38static DEFINE_PER_CPU_SHARED_ALIGNED(struct call_function_data, cfd_data); 39static DEFINE_PER_CPU_SHARED_ALIGNED(struct call_function_data, cfd_data);
@@ -56,6 +57,9 @@ hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu)
56 if (!zalloc_cpumask_var_node(&cfd->cpumask, GFP_KERNEL, 57 if (!zalloc_cpumask_var_node(&cfd->cpumask, GFP_KERNEL,
57 cpu_to_node(cpu))) 58 cpu_to_node(cpu)))
58 return notifier_from_errno(-ENOMEM); 59 return notifier_from_errno(-ENOMEM);
60 if (!zalloc_cpumask_var_node(&cfd->cpumask_ipi, GFP_KERNEL,
61 cpu_to_node(cpu)))
62 return notifier_from_errno(-ENOMEM);
59 break; 63 break;
60 64
61#ifdef CONFIG_HOTPLUG_CPU 65#ifdef CONFIG_HOTPLUG_CPU
@@ -65,6 +69,7 @@ hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu)
65 case CPU_DEAD: 69 case CPU_DEAD:
66 case CPU_DEAD_FROZEN: 70 case CPU_DEAD_FROZEN:
67 free_cpumask_var(cfd->cpumask); 71 free_cpumask_var(cfd->cpumask);
72 free_cpumask_var(cfd->cpumask_ipi);
68 break; 73 break;
69#endif 74#endif
70 }; 75 };
@@ -526,6 +531,12 @@ void smp_call_function_many(const struct cpumask *mask,
526 return; 531 return;
527 } 532 }
528 533
534 /*
535 * After we put an entry into the list, data->cpumask
536 * may be cleared again when another CPU sends another IPI for
537 * a SMP function call, so data->cpumask will be zero.
538 */
539 cpumask_copy(data->cpumask_ipi, data->cpumask);
529 raw_spin_lock_irqsave(&call_function.lock, flags); 540 raw_spin_lock_irqsave(&call_function.lock, flags);
530 /* 541 /*
531 * Place entry at the _HEAD_ of the list, so that any cpu still 542 * Place entry at the _HEAD_ of the list, so that any cpu still
@@ -549,7 +560,7 @@ void smp_call_function_many(const struct cpumask *mask,
549 smp_mb(); 560 smp_mb();
550 561
551 /* Send a message to all CPUs in the map */ 562 /* Send a message to all CPUs in the map */
552 arch_send_call_function_ipi_mask(data->cpumask); 563 arch_send_call_function_ipi_mask(data->cpumask_ipi);
553 564
554 /* Optionally wait for the CPUs to complete */ 565 /* Optionally wait for the CPUs to complete */
555 if (wait) 566 if (wait)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 3ffe4c5ad3f3..41473b4ad7a4 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -3998,7 +3998,7 @@ static int ftrace_module_notify(struct notifier_block *self,
3998 3998
3999struct notifier_block ftrace_module_nb = { 3999struct notifier_block ftrace_module_nb = {
4000 .notifier_call = ftrace_module_notify, 4000 .notifier_call = ftrace_module_notify,
4001 .priority = 0, 4001 .priority = INT_MAX, /* Run before anything that can use kprobes */
4002}; 4002};
4003 4003
4004extern unsigned long __start_mcount_loc[]; 4004extern unsigned long __start_mcount_loc[];
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index e5125677efa0..3c13e46d7d24 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2899,6 +2899,8 @@ tracing_trace_options_write(struct file *filp, const char __user *ubuf,
2899 if (copy_from_user(&buf, ubuf, cnt)) 2899 if (copy_from_user(&buf, ubuf, cnt))
2900 return -EFAULT; 2900 return -EFAULT;
2901 2901
2902 buf[cnt] = 0;
2903
2902 trace_set_options(buf); 2904 trace_set_options(buf);
2903 2905
2904 *ppos += cnt; 2906 *ppos += cnt;
@@ -3452,7 +3454,7 @@ static int tracing_wait_pipe(struct file *filp)
3452 return -EINTR; 3454 return -EINTR;
3453 3455
3454 /* 3456 /*
3455 * We block until we read something and tracing is enabled. 3457 * We block until we read something and tracing is disabled.
3456 * We still block if tracing is disabled, but we have never 3458 * We still block if tracing is disabled, but we have never
3457 * read anything. This allows a user to cat this file, and 3459 * read anything. This allows a user to cat this file, and
3458 * then enable tracing. But after we have read something, 3460 * then enable tracing. But after we have read something,
@@ -3460,7 +3462,7 @@ static int tracing_wait_pipe(struct file *filp)
3460 * 3462 *
3461 * iter->pos will be 0 if we haven't read anything. 3463 * iter->pos will be 0 if we haven't read anything.
3462 */ 3464 */
3463 if (tracing_is_enabled() && iter->pos) 3465 if (!tracing_is_enabled() && iter->pos)
3464 break; 3466 break;
3465 } 3467 }
3466 3468
@@ -4815,10 +4817,17 @@ rb_simple_write(struct file *filp, const char __user *ubuf,
4815 return ret; 4817 return ret;
4816 4818
4817 if (buffer) { 4819 if (buffer) {
4818 if (val) 4820 mutex_lock(&trace_types_lock);
4821 if (val) {
4819 ring_buffer_record_on(buffer); 4822 ring_buffer_record_on(buffer);
4820 else 4823 if (current_trace->start)
4824 current_trace->start(tr);
4825 } else {
4821 ring_buffer_record_off(buffer); 4826 ring_buffer_record_off(buffer);
4827 if (current_trace->stop)
4828 current_trace->stop(tr);
4829 }
4830 mutex_unlock(&trace_types_lock);
4822 } 4831 }
4823 4832
4824 (*ppos)++; 4833 (*ppos)++;
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 3a353091a903..67604e599384 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -134,7 +134,7 @@ config DEBUG_SECTION_MISMATCH
134 any use of code/data previously in these sections would 134 any use of code/data previously in these sections would
135 most likely result in an oops. 135 most likely result in an oops.
136 In the code, functions and variables are annotated with 136 In the code, functions and variables are annotated with
137 __init, __devinit, etc. (see the full list in include/linux/init.h), 137 __init, __cpuinit, etc. (see the full list in include/linux/init.h),
138 which results in the code/data being placed in specific sections. 138 which results in the code/data being placed in specific sections.
139 The section mismatch analysis is always performed after a full 139 The section mismatch analysis is always performed after a full
140 kernel build, and enabling this option causes the following 140 kernel build, and enabling this option causes the following
diff --git a/lib/bug.c b/lib/bug.c
index a28c1415357c..d0cdf14c651a 100644
--- a/lib/bug.c
+++ b/lib/bug.c
@@ -55,6 +55,7 @@ static inline unsigned long bug_addr(const struct bug_entry *bug)
55} 55}
56 56
57#ifdef CONFIG_MODULES 57#ifdef CONFIG_MODULES
58/* Updates are protected by module mutex */
58static LIST_HEAD(module_bug_list); 59static LIST_HEAD(module_bug_list);
59 60
60static const struct bug_entry *module_find_bug(unsigned long bugaddr) 61static const struct bug_entry *module_find_bug(unsigned long bugaddr)
diff --git a/lib/cpu_rmap.c b/lib/cpu_rmap.c
index 145dec5267c9..5fbed5caba6e 100644
--- a/lib/cpu_rmap.c
+++ b/lib/cpu_rmap.c
@@ -45,6 +45,7 @@ struct cpu_rmap *alloc_cpu_rmap(unsigned int size, gfp_t flags)
45 if (!rmap) 45 if (!rmap)
46 return NULL; 46 return NULL;
47 47
48 kref_init(&rmap->refcount);
48 rmap->obj = (void **)((char *)rmap + obj_offset); 49 rmap->obj = (void **)((char *)rmap + obj_offset);
49 50
50 /* Initially assign CPUs to objects on a rota, since we have 51 /* Initially assign CPUs to objects on a rota, since we have
@@ -63,6 +64,35 @@ struct cpu_rmap *alloc_cpu_rmap(unsigned int size, gfp_t flags)
63} 64}
64EXPORT_SYMBOL(alloc_cpu_rmap); 65EXPORT_SYMBOL(alloc_cpu_rmap);
65 66
67/**
68 * cpu_rmap_release - internal reclaiming helper called from kref_put
69 * @ref: kref to struct cpu_rmap
70 */
71static void cpu_rmap_release(struct kref *ref)
72{
73 struct cpu_rmap *rmap = container_of(ref, struct cpu_rmap, refcount);
74 kfree(rmap);
75}
76
77/**
78 * cpu_rmap_get - internal helper to get new ref on a cpu_rmap
79 * @rmap: reverse-map allocated with alloc_cpu_rmap()
80 */
81static inline void cpu_rmap_get(struct cpu_rmap *rmap)
82{
83 kref_get(&rmap->refcount);
84}
85
86/**
87 * cpu_rmap_put - release ref on a cpu_rmap
88 * @rmap: reverse-map allocated with alloc_cpu_rmap()
89 */
90int cpu_rmap_put(struct cpu_rmap *rmap)
91{
92 return kref_put(&rmap->refcount, cpu_rmap_release);
93}
94EXPORT_SYMBOL(cpu_rmap_put);
95
66/* Reevaluate nearest object for given CPU, comparing with the given 96/* Reevaluate nearest object for given CPU, comparing with the given
67 * neighbours at the given distance. 97 * neighbours at the given distance.
68 */ 98 */
@@ -197,8 +227,7 @@ struct irq_glue {
197 * free_irq_cpu_rmap - free a CPU affinity reverse-map used for IRQs 227 * free_irq_cpu_rmap - free a CPU affinity reverse-map used for IRQs
198 * @rmap: Reverse-map allocated with alloc_irq_cpu_map(), or %NULL 228 * @rmap: Reverse-map allocated with alloc_irq_cpu_map(), or %NULL
199 * 229 *
200 * Must be called in process context, before freeing the IRQs, and 230 * Must be called in process context, before freeing the IRQs.
201 * without holding any locks required by global workqueue items.
202 */ 231 */
203void free_irq_cpu_rmap(struct cpu_rmap *rmap) 232void free_irq_cpu_rmap(struct cpu_rmap *rmap)
204{ 233{
@@ -212,12 +241,18 @@ void free_irq_cpu_rmap(struct cpu_rmap *rmap)
212 glue = rmap->obj[index]; 241 glue = rmap->obj[index];
213 irq_set_affinity_notifier(glue->notify.irq, NULL); 242 irq_set_affinity_notifier(glue->notify.irq, NULL);
214 } 243 }
215 irq_run_affinity_notifiers();
216 244
217 kfree(rmap); 245 cpu_rmap_put(rmap);
218} 246}
219EXPORT_SYMBOL(free_irq_cpu_rmap); 247EXPORT_SYMBOL(free_irq_cpu_rmap);
220 248
249/**
250 * irq_cpu_rmap_notify - callback for IRQ subsystem when IRQ affinity updated
251 * @notify: struct irq_affinity_notify passed by irq/manage.c
252 * @mask: cpu mask for new SMP affinity
253 *
254 * This is executed in workqueue context.
255 */
221static void 256static void
222irq_cpu_rmap_notify(struct irq_affinity_notify *notify, const cpumask_t *mask) 257irq_cpu_rmap_notify(struct irq_affinity_notify *notify, const cpumask_t *mask)
223{ 258{
@@ -230,10 +265,16 @@ irq_cpu_rmap_notify(struct irq_affinity_notify *notify, const cpumask_t *mask)
230 pr_warning("irq_cpu_rmap_notify: update failed: %d\n", rc); 265 pr_warning("irq_cpu_rmap_notify: update failed: %d\n", rc);
231} 266}
232 267
268/**
269 * irq_cpu_rmap_release - reclaiming callback for IRQ subsystem
270 * @ref: kref to struct irq_affinity_notify passed by irq/manage.c
271 */
233static void irq_cpu_rmap_release(struct kref *ref) 272static void irq_cpu_rmap_release(struct kref *ref)
234{ 273{
235 struct irq_glue *glue = 274 struct irq_glue *glue =
236 container_of(ref, struct irq_glue, notify.kref); 275 container_of(ref, struct irq_glue, notify.kref);
276
277 cpu_rmap_put(glue->rmap);
237 kfree(glue); 278 kfree(glue);
238} 279}
239 280
@@ -258,10 +299,13 @@ int irq_cpu_rmap_add(struct cpu_rmap *rmap, int irq)
258 glue->notify.notify = irq_cpu_rmap_notify; 299 glue->notify.notify = irq_cpu_rmap_notify;
259 glue->notify.release = irq_cpu_rmap_release; 300 glue->notify.release = irq_cpu_rmap_release;
260 glue->rmap = rmap; 301 glue->rmap = rmap;
302 cpu_rmap_get(rmap);
261 glue->index = cpu_rmap_add(rmap, glue); 303 glue->index = cpu_rmap_add(rmap, glue);
262 rc = irq_set_affinity_notifier(irq, &glue->notify); 304 rc = irq_set_affinity_notifier(irq, &glue->notify);
263 if (rc) 305 if (rc) {
306 cpu_rmap_put(glue->rmap);
264 kfree(glue); 307 kfree(glue);
308 }
265 return rc; 309 return rc;
266} 310}
267EXPORT_SYMBOL(irq_cpu_rmap_add); 311EXPORT_SYMBOL(irq_cpu_rmap_add);
diff --git a/lib/rbtree.c b/lib/rbtree.c
index 4f56a11d67fa..c0e31fe2fabf 100644
--- a/lib/rbtree.c
+++ b/lib/rbtree.c
@@ -194,8 +194,12 @@ __rb_insert(struct rb_node *node, struct rb_root *root,
194 } 194 }
195} 195}
196 196
197__always_inline void 197/*
198__rb_erase_color(struct rb_node *parent, struct rb_root *root, 198 * Inline version for rb_erase() use - we want to be able to inline
199 * and eliminate the dummy_rotate callback there
200 */
201static __always_inline void
202____rb_erase_color(struct rb_node *parent, struct rb_root *root,
199 void (*augment_rotate)(struct rb_node *old, struct rb_node *new)) 203 void (*augment_rotate)(struct rb_node *old, struct rb_node *new))
200{ 204{
201 struct rb_node *node = NULL, *sibling, *tmp1, *tmp2; 205 struct rb_node *node = NULL, *sibling, *tmp1, *tmp2;
@@ -355,6 +359,13 @@ __rb_erase_color(struct rb_node *parent, struct rb_root *root,
355 } 359 }
356 } 360 }
357} 361}
362
363/* Non-inline version for rb_erase_augmented() use */
364void __rb_erase_color(struct rb_node *parent, struct rb_root *root,
365 void (*augment_rotate)(struct rb_node *old, struct rb_node *new))
366{
367 ____rb_erase_color(parent, root, augment_rotate);
368}
358EXPORT_SYMBOL(__rb_erase_color); 369EXPORT_SYMBOL(__rb_erase_color);
359 370
360/* 371/*
@@ -380,7 +391,10 @@ EXPORT_SYMBOL(rb_insert_color);
380 391
381void rb_erase(struct rb_node *node, struct rb_root *root) 392void rb_erase(struct rb_node *node, struct rb_root *root)
382{ 393{
383 rb_erase_augmented(node, root, &dummy_callbacks); 394 struct rb_node *rebalance;
395 rebalance = __rb_erase_augmented(node, root, &dummy_callbacks);
396 if (rebalance)
397 ____rb_erase_color(rebalance, root, dummy_rotate);
384} 398}
385EXPORT_SYMBOL(rb_erase); 399EXPORT_SYMBOL(rb_erase);
386 400
diff --git a/mm/bootmem.c b/mm/bootmem.c
index 1324cd74faec..b93376c39b61 100644
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -185,10 +185,23 @@ static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata)
185 185
186 while (start < end) { 186 while (start < end) {
187 unsigned long *map, idx, vec; 187 unsigned long *map, idx, vec;
188 unsigned shift;
188 189
189 map = bdata->node_bootmem_map; 190 map = bdata->node_bootmem_map;
190 idx = start - bdata->node_min_pfn; 191 idx = start - bdata->node_min_pfn;
192 shift = idx & (BITS_PER_LONG - 1);
193 /*
194 * vec holds at most BITS_PER_LONG map bits,
195 * bit 0 corresponds to start.
196 */
191 vec = ~map[idx / BITS_PER_LONG]; 197 vec = ~map[idx / BITS_PER_LONG];
198
199 if (shift) {
200 vec >>= shift;
201 if (end - start >= BITS_PER_LONG)
202 vec |= ~map[idx / BITS_PER_LONG + 1] <<
203 (BITS_PER_LONG - shift);
204 }
192 /* 205 /*
193 * If we have a properly aligned and fully unreserved 206 * If we have a properly aligned and fully unreserved
194 * BITS_PER_LONG block of pages in front of us, free 207 * BITS_PER_LONG block of pages in front of us, free
@@ -201,19 +214,18 @@ static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata)
201 count += BITS_PER_LONG; 214 count += BITS_PER_LONG;
202 start += BITS_PER_LONG; 215 start += BITS_PER_LONG;
203 } else { 216 } else {
204 unsigned long off = 0; 217 unsigned long cur = start;
205 218
206 vec >>= start & (BITS_PER_LONG - 1); 219 start = ALIGN(start + 1, BITS_PER_LONG);
207 while (vec) { 220 while (vec && cur != start) {
208 if (vec & 1) { 221 if (vec & 1) {
209 page = pfn_to_page(start + off); 222 page = pfn_to_page(cur);
210 __free_pages_bootmem(page, 0); 223 __free_pages_bootmem(page, 0);
211 count++; 224 count++;
212 } 225 }
213 vec >>= 1; 226 vec >>= 1;
214 off++; 227 ++cur;
215 } 228 }
216 start = ALIGN(start + 1, BITS_PER_LONG);
217 } 229 }
218 } 230 }
219 231
diff --git a/mm/compaction.c b/mm/compaction.c
index 6b807e466497..c62bd063d766 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -816,6 +816,7 @@ static isolate_migrate_t isolate_migratepages(struct zone *zone,
816static int compact_finished(struct zone *zone, 816static int compact_finished(struct zone *zone,
817 struct compact_control *cc) 817 struct compact_control *cc)
818{ 818{
819 unsigned int order;
819 unsigned long watermark; 820 unsigned long watermark;
820 821
821 if (fatal_signal_pending(current)) 822 if (fatal_signal_pending(current))
@@ -850,22 +851,16 @@ static int compact_finished(struct zone *zone,
850 return COMPACT_CONTINUE; 851 return COMPACT_CONTINUE;
851 852
852 /* Direct compactor: Is a suitable page free? */ 853 /* Direct compactor: Is a suitable page free? */
853 if (cc->page) { 854 for (order = cc->order; order < MAX_ORDER; order++) {
854 /* Was a suitable page captured? */ 855 struct free_area *area = &zone->free_area[order];
855 if (*cc->page) 856
857 /* Job done if page is free of the right migratetype */
858 if (!list_empty(&area->free_list[cc->migratetype]))
859 return COMPACT_PARTIAL;
860
861 /* Job done if allocation would set block type */
862 if (cc->order >= pageblock_order && area->nr_free)
856 return COMPACT_PARTIAL; 863 return COMPACT_PARTIAL;
857 } else {
858 unsigned int order;
859 for (order = cc->order; order < MAX_ORDER; order++) {
860 struct free_area *area = &zone->free_area[cc->order];
861 /* Job done if page is free of the right migratetype */
862 if (!list_empty(&area->free_list[cc->migratetype]))
863 return COMPACT_PARTIAL;
864
865 /* Job done if allocation would set block type */
866 if (cc->order >= pageblock_order && area->nr_free)
867 return COMPACT_PARTIAL;
868 }
869 } 864 }
870 865
871 return COMPACT_CONTINUE; 866 return COMPACT_CONTINUE;
@@ -921,60 +916,6 @@ unsigned long compaction_suitable(struct zone *zone, int order)
921 return COMPACT_CONTINUE; 916 return COMPACT_CONTINUE;
922} 917}
923 918
924static void compact_capture_page(struct compact_control *cc)
925{
926 unsigned long flags;
927 int mtype, mtype_low, mtype_high;
928
929 if (!cc->page || *cc->page)
930 return;
931
932 /*
933 * For MIGRATE_MOVABLE allocations we capture a suitable page ASAP
934 * regardless of the migratetype of the freelist is is captured from.
935 * This is fine because the order for a high-order MIGRATE_MOVABLE
936 * allocation is typically at least a pageblock size and overall
937 * fragmentation is not impaired. Other allocation types must
938 * capture pages from their own migratelist because otherwise they
939 * could pollute other pageblocks like MIGRATE_MOVABLE with
940 * difficult to move pages and making fragmentation worse overall.
941 */
942 if (cc->migratetype == MIGRATE_MOVABLE) {
943 mtype_low = 0;
944 mtype_high = MIGRATE_PCPTYPES;
945 } else {
946 mtype_low = cc->migratetype;
947 mtype_high = cc->migratetype + 1;
948 }
949
950 /* Speculatively examine the free lists without zone lock */
951 for (mtype = mtype_low; mtype < mtype_high; mtype++) {
952 int order;
953 for (order = cc->order; order < MAX_ORDER; order++) {
954 struct page *page;
955 struct free_area *area;
956 area = &(cc->zone->free_area[order]);
957 if (list_empty(&area->free_list[mtype]))
958 continue;
959
960 /* Take the lock and attempt capture of the page */
961 if (!compact_trylock_irqsave(&cc->zone->lock, &flags, cc))
962 return;
963 if (!list_empty(&area->free_list[mtype])) {
964 page = list_entry(area->free_list[mtype].next,
965 struct page, lru);
966 if (capture_free_page(page, cc->order, mtype)) {
967 spin_unlock_irqrestore(&cc->zone->lock,
968 flags);
969 *cc->page = page;
970 return;
971 }
972 }
973 spin_unlock_irqrestore(&cc->zone->lock, flags);
974 }
975 }
976}
977
978static int compact_zone(struct zone *zone, struct compact_control *cc) 919static int compact_zone(struct zone *zone, struct compact_control *cc)
979{ 920{
980 int ret; 921 int ret;
@@ -1054,9 +995,6 @@ static int compact_zone(struct zone *zone, struct compact_control *cc)
1054 goto out; 995 goto out;
1055 } 996 }
1056 } 997 }
1057
1058 /* Capture a page now if it is a suitable size */
1059 compact_capture_page(cc);
1060 } 998 }
1061 999
1062out: 1000out:
@@ -1069,8 +1007,7 @@ out:
1069 1007
1070static unsigned long compact_zone_order(struct zone *zone, 1008static unsigned long compact_zone_order(struct zone *zone,
1071 int order, gfp_t gfp_mask, 1009 int order, gfp_t gfp_mask,
1072 bool sync, bool *contended, 1010 bool sync, bool *contended)
1073 struct page **page)
1074{ 1011{
1075 unsigned long ret; 1012 unsigned long ret;
1076 struct compact_control cc = { 1013 struct compact_control cc = {
@@ -1080,7 +1017,6 @@ static unsigned long compact_zone_order(struct zone *zone,
1080 .migratetype = allocflags_to_migratetype(gfp_mask), 1017 .migratetype = allocflags_to_migratetype(gfp_mask),
1081 .zone = zone, 1018 .zone = zone,
1082 .sync = sync, 1019 .sync = sync,
1083 .page = page,
1084 }; 1020 };
1085 INIT_LIST_HEAD(&cc.freepages); 1021 INIT_LIST_HEAD(&cc.freepages);
1086 INIT_LIST_HEAD(&cc.migratepages); 1022 INIT_LIST_HEAD(&cc.migratepages);
@@ -1110,7 +1046,7 @@ int sysctl_extfrag_threshold = 500;
1110 */ 1046 */
1111unsigned long try_to_compact_pages(struct zonelist *zonelist, 1047unsigned long try_to_compact_pages(struct zonelist *zonelist,
1112 int order, gfp_t gfp_mask, nodemask_t *nodemask, 1048 int order, gfp_t gfp_mask, nodemask_t *nodemask,
1113 bool sync, bool *contended, struct page **page) 1049 bool sync, bool *contended)
1114{ 1050{
1115 enum zone_type high_zoneidx = gfp_zone(gfp_mask); 1051 enum zone_type high_zoneidx = gfp_zone(gfp_mask);
1116 int may_enter_fs = gfp_mask & __GFP_FS; 1052 int may_enter_fs = gfp_mask & __GFP_FS;
@@ -1136,7 +1072,7 @@ unsigned long try_to_compact_pages(struct zonelist *zonelist,
1136 int status; 1072 int status;
1137 1073
1138 status = compact_zone_order(zone, order, gfp_mask, sync, 1074 status = compact_zone_order(zone, order, gfp_mask, sync,
1139 contended, page); 1075 contended);
1140 rc = max(status, rc); 1076 rc = max(status, rc);
1141 1077
1142 /* If a normal allocation would succeed, stop compacting */ 1078 /* If a normal allocation would succeed, stop compacting */
@@ -1192,7 +1128,6 @@ int compact_pgdat(pg_data_t *pgdat, int order)
1192 struct compact_control cc = { 1128 struct compact_control cc = {
1193 .order = order, 1129 .order = order,
1194 .sync = false, 1130 .sync = false,
1195 .page = NULL,
1196 }; 1131 };
1197 1132
1198 return __compact_pgdat(pgdat, &cc); 1133 return __compact_pgdat(pgdat, &cc);
@@ -1203,14 +1138,13 @@ static int compact_node(int nid)
1203 struct compact_control cc = { 1138 struct compact_control cc = {
1204 .order = -1, 1139 .order = -1,
1205 .sync = true, 1140 .sync = true,
1206 .page = NULL,
1207 }; 1141 };
1208 1142
1209 return __compact_pgdat(NODE_DATA(nid), &cc); 1143 return __compact_pgdat(NODE_DATA(nid), &cc);
1210} 1144}
1211 1145
1212/* Compact all nodes in the system */ 1146/* Compact all nodes in the system */
1213static int compact_nodes(void) 1147static void compact_nodes(void)
1214{ 1148{
1215 int nid; 1149 int nid;
1216 1150
@@ -1219,8 +1153,6 @@ static int compact_nodes(void)
1219 1153
1220 for_each_online_node(nid) 1154 for_each_online_node(nid)
1221 compact_node(nid); 1155 compact_node(nid);
1222
1223 return COMPACT_COMPLETE;
1224} 1156}
1225 1157
1226/* The written value is actually unused, all memory is compacted */ 1158/* The written value is actually unused, all memory is compacted */
@@ -1231,7 +1163,7 @@ int sysctl_compaction_handler(struct ctl_table *table, int write,
1231 void __user *buffer, size_t *length, loff_t *ppos) 1163 void __user *buffer, size_t *length, loff_t *ppos)
1232{ 1164{
1233 if (write) 1165 if (write)
1234 return compact_nodes(); 1166 compact_nodes();
1235 1167
1236 return 0; 1168 return 0;
1237} 1169}
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 9e894edc7811..6001ee6347a9 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -1819,9 +1819,19 @@ int split_huge_page(struct page *page)
1819 1819
1820 BUG_ON(is_huge_zero_pfn(page_to_pfn(page))); 1820 BUG_ON(is_huge_zero_pfn(page_to_pfn(page)));
1821 BUG_ON(!PageAnon(page)); 1821 BUG_ON(!PageAnon(page));
1822 anon_vma = page_lock_anon_vma_read(page); 1822
1823 /*
1824 * The caller does not necessarily hold an mmap_sem that would prevent
1825 * the anon_vma disappearing so we first we take a reference to it
1826 * and then lock the anon_vma for write. This is similar to
1827 * page_lock_anon_vma_read except the write lock is taken to serialise
1828 * against parallel split or collapse operations.
1829 */
1830 anon_vma = page_get_anon_vma(page);
1823 if (!anon_vma) 1831 if (!anon_vma)
1824 goto out; 1832 goto out;
1833 anon_vma_lock_write(anon_vma);
1834
1825 ret = 0; 1835 ret = 0;
1826 if (!PageCompound(page)) 1836 if (!PageCompound(page))
1827 goto out_unlock; 1837 goto out_unlock;
@@ -1832,7 +1842,8 @@ int split_huge_page(struct page *page)
1832 1842
1833 BUG_ON(PageCompound(page)); 1843 BUG_ON(PageCompound(page));
1834out_unlock: 1844out_unlock:
1835 page_unlock_anon_vma_read(anon_vma); 1845 anon_vma_unlock(anon_vma);
1846 put_anon_vma(anon_vma);
1836out: 1847out:
1837 return ret; 1848 return ret;
1838} 1849}
diff --git a/mm/internal.h b/mm/internal.h
index d597f94cc205..9ba21100ebf3 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -135,7 +135,6 @@ struct compact_control {
135 int migratetype; /* MOVABLE, RECLAIMABLE etc */ 135 int migratetype; /* MOVABLE, RECLAIMABLE etc */
136 struct zone *zone; 136 struct zone *zone;
137 bool contended; /* True if a lock was contended */ 137 bool contended; /* True if a lock was contended */
138 struct page **page; /* Page captured of requested size */
139}; 138};
140 139
141unsigned long 140unsigned long
diff --git a/mm/memblock.c b/mm/memblock.c
index 625905523c2a..88adc8afb610 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -314,7 +314,8 @@ static void __init_memblock memblock_merge_regions(struct memblock_type *type)
314 } 314 }
315 315
316 this->size += next->size; 316 this->size += next->size;
317 memmove(next, next + 1, (type->cnt - (i + 1)) * sizeof(*next)); 317 /* move forward from next + 1, index of which is i + 2 */
318 memmove(next, next + 1, (type->cnt - (i + 2)) * sizeof(*next));
318 type->cnt--; 319 type->cnt--;
319 } 320 }
320} 321}
diff --git a/mm/memory.c b/mm/memory.c
index e0a9b0ce4f10..bb1369f7b9b4 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -184,10 +184,14 @@ static int tlb_next_batch(struct mmu_gather *tlb)
184 return 1; 184 return 1;
185 } 185 }
186 186
187 if (tlb->batch_count == MAX_GATHER_BATCH_COUNT)
188 return 0;
189
187 batch = (void *)__get_free_pages(GFP_NOWAIT | __GFP_NOWARN, 0); 190 batch = (void *)__get_free_pages(GFP_NOWAIT | __GFP_NOWARN, 0);
188 if (!batch) 191 if (!batch)
189 return 0; 192 return 0;
190 193
194 tlb->batch_count++;
191 batch->next = NULL; 195 batch->next = NULL;
192 batch->nr = 0; 196 batch->nr = 0;
193 batch->max = MAX_GATHER_BATCH; 197 batch->max = MAX_GATHER_BATCH;
@@ -216,6 +220,7 @@ void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, bool fullmm)
216 tlb->local.nr = 0; 220 tlb->local.nr = 0;
217 tlb->local.max = ARRAY_SIZE(tlb->__pages); 221 tlb->local.max = ARRAY_SIZE(tlb->__pages);
218 tlb->active = &tlb->local; 222 tlb->active = &tlb->local;
223 tlb->batch_count = 0;
219 224
220#ifdef CONFIG_HAVE_RCU_TABLE_FREE 225#ifdef CONFIG_HAVE_RCU_TABLE_FREE
221 tlb->batch = NULL; 226 tlb->batch = NULL;
@@ -3706,6 +3711,14 @@ retry:
3706 if (pmd_trans_huge(orig_pmd)) { 3711 if (pmd_trans_huge(orig_pmd)) {
3707 unsigned int dirty = flags & FAULT_FLAG_WRITE; 3712 unsigned int dirty = flags & FAULT_FLAG_WRITE;
3708 3713
3714 /*
3715 * If the pmd is splitting, return and retry the
3716 * the fault. Alternative: wait until the split
3717 * is done, and goto retry.
3718 */
3719 if (pmd_trans_splitting(orig_pmd))
3720 return 0;
3721
3709 if (pmd_numa(orig_pmd)) 3722 if (pmd_numa(orig_pmd))
3710 return do_huge_pmd_numa_page(mm, vma, address, 3723 return do_huge_pmd_numa_page(mm, vma, address,
3711 orig_pmd, pmd); 3724 orig_pmd, pmd);
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index d1b315e98627..e2df1c1fb41f 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -2132,7 +2132,7 @@ bool __mpol_equal(struct mempolicy *a, struct mempolicy *b)
2132 */ 2132 */
2133 2133
2134/* lookup first element intersecting start-end */ 2134/* lookup first element intersecting start-end */
2135/* Caller holds sp->mutex */ 2135/* Caller holds sp->lock */
2136static struct sp_node * 2136static struct sp_node *
2137sp_lookup(struct shared_policy *sp, unsigned long start, unsigned long end) 2137sp_lookup(struct shared_policy *sp, unsigned long start, unsigned long end)
2138{ 2138{
@@ -2196,13 +2196,13 @@ mpol_shared_policy_lookup(struct shared_policy *sp, unsigned long idx)
2196 2196
2197 if (!sp->root.rb_node) 2197 if (!sp->root.rb_node)
2198 return NULL; 2198 return NULL;
2199 mutex_lock(&sp->mutex); 2199 spin_lock(&sp->lock);
2200 sn = sp_lookup(sp, idx, idx+1); 2200 sn = sp_lookup(sp, idx, idx+1);
2201 if (sn) { 2201 if (sn) {
2202 mpol_get(sn->policy); 2202 mpol_get(sn->policy);
2203 pol = sn->policy; 2203 pol = sn->policy;
2204 } 2204 }
2205 mutex_unlock(&sp->mutex); 2205 spin_unlock(&sp->lock);
2206 return pol; 2206 return pol;
2207} 2207}
2208 2208
@@ -2328,6 +2328,14 @@ static void sp_delete(struct shared_policy *sp, struct sp_node *n)
2328 sp_free(n); 2328 sp_free(n);
2329} 2329}
2330 2330
2331static void sp_node_init(struct sp_node *node, unsigned long start,
2332 unsigned long end, struct mempolicy *pol)
2333{
2334 node->start = start;
2335 node->end = end;
2336 node->policy = pol;
2337}
2338
2331static struct sp_node *sp_alloc(unsigned long start, unsigned long end, 2339static struct sp_node *sp_alloc(unsigned long start, unsigned long end,
2332 struct mempolicy *pol) 2340 struct mempolicy *pol)
2333{ 2341{
@@ -2344,10 +2352,7 @@ static struct sp_node *sp_alloc(unsigned long start, unsigned long end,
2344 return NULL; 2352 return NULL;
2345 } 2353 }
2346 newpol->flags |= MPOL_F_SHARED; 2354 newpol->flags |= MPOL_F_SHARED;
2347 2355 sp_node_init(n, start, end, newpol);
2348 n->start = start;
2349 n->end = end;
2350 n->policy = newpol;
2351 2356
2352 return n; 2357 return n;
2353} 2358}
@@ -2357,9 +2362,12 @@ static int shared_policy_replace(struct shared_policy *sp, unsigned long start,
2357 unsigned long end, struct sp_node *new) 2362 unsigned long end, struct sp_node *new)
2358{ 2363{
2359 struct sp_node *n; 2364 struct sp_node *n;
2365 struct sp_node *n_new = NULL;
2366 struct mempolicy *mpol_new = NULL;
2360 int ret = 0; 2367 int ret = 0;
2361 2368
2362 mutex_lock(&sp->mutex); 2369restart:
2370 spin_lock(&sp->lock);
2363 n = sp_lookup(sp, start, end); 2371 n = sp_lookup(sp, start, end);
2364 /* Take care of old policies in the same range. */ 2372 /* Take care of old policies in the same range. */
2365 while (n && n->start < end) { 2373 while (n && n->start < end) {
@@ -2372,14 +2380,16 @@ static int shared_policy_replace(struct shared_policy *sp, unsigned long start,
2372 } else { 2380 } else {
2373 /* Old policy spanning whole new range. */ 2381 /* Old policy spanning whole new range. */
2374 if (n->end > end) { 2382 if (n->end > end) {
2375 struct sp_node *new2; 2383 if (!n_new)
2376 new2 = sp_alloc(end, n->end, n->policy); 2384 goto alloc_new;
2377 if (!new2) { 2385
2378 ret = -ENOMEM; 2386 *mpol_new = *n->policy;
2379 goto out; 2387 atomic_set(&mpol_new->refcnt, 1);
2380 } 2388 sp_node_init(n_new, n->end, end, mpol_new);
2389 sp_insert(sp, n_new);
2381 n->end = start; 2390 n->end = start;
2382 sp_insert(sp, new2); 2391 n_new = NULL;
2392 mpol_new = NULL;
2383 break; 2393 break;
2384 } else 2394 } else
2385 n->end = start; 2395 n->end = start;
@@ -2390,9 +2400,27 @@ static int shared_policy_replace(struct shared_policy *sp, unsigned long start,
2390 } 2400 }
2391 if (new) 2401 if (new)
2392 sp_insert(sp, new); 2402 sp_insert(sp, new);
2393out: 2403 spin_unlock(&sp->lock);
2394 mutex_unlock(&sp->mutex); 2404 ret = 0;
2405
2406err_out:
2407 if (mpol_new)
2408 mpol_put(mpol_new);
2409 if (n_new)
2410 kmem_cache_free(sn_cache, n_new);
2411
2395 return ret; 2412 return ret;
2413
2414alloc_new:
2415 spin_unlock(&sp->lock);
2416 ret = -ENOMEM;
2417 n_new = kmem_cache_alloc(sn_cache, GFP_KERNEL);
2418 if (!n_new)
2419 goto err_out;
2420 mpol_new = kmem_cache_alloc(policy_cache, GFP_KERNEL);
2421 if (!mpol_new)
2422 goto err_out;
2423 goto restart;
2396} 2424}
2397 2425
2398/** 2426/**
@@ -2410,7 +2438,7 @@ void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol)
2410 int ret; 2438 int ret;
2411 2439
2412 sp->root = RB_ROOT; /* empty tree == default mempolicy */ 2440 sp->root = RB_ROOT; /* empty tree == default mempolicy */
2413 mutex_init(&sp->mutex); 2441 spin_lock_init(&sp->lock);
2414 2442
2415 if (mpol) { 2443 if (mpol) {
2416 struct vm_area_struct pvma; 2444 struct vm_area_struct pvma;
@@ -2476,14 +2504,14 @@ void mpol_free_shared_policy(struct shared_policy *p)
2476 2504
2477 if (!p->root.rb_node) 2505 if (!p->root.rb_node)
2478 return; 2506 return;
2479 mutex_lock(&p->mutex); 2507 spin_lock(&p->lock);
2480 next = rb_first(&p->root); 2508 next = rb_first(&p->root);
2481 while (next) { 2509 while (next) {
2482 n = rb_entry(next, struct sp_node, nd); 2510 n = rb_entry(next, struct sp_node, nd);
2483 next = rb_next(&n->nd); 2511 next = rb_next(&n->nd);
2484 sp_delete(p, n); 2512 sp_delete(p, n);
2485 } 2513 }
2486 mutex_unlock(&p->mutex); 2514 spin_unlock(&p->lock);
2487} 2515}
2488 2516
2489#ifdef CONFIG_NUMA_BALANCING 2517#ifdef CONFIG_NUMA_BALANCING
@@ -2595,8 +2623,7 @@ void numa_default_policy(void)
2595 */ 2623 */
2596 2624
2597/* 2625/*
2598 * "local" is pseudo-policy: MPOL_PREFERRED with MPOL_F_LOCAL flag 2626 * "local" is implemented internally by MPOL_PREFERRED with MPOL_F_LOCAL flag.
2599 * Used only for mpol_parse_str() and mpol_to_str()
2600 */ 2627 */
2601static const char * const policy_modes[] = 2628static const char * const policy_modes[] =
2602{ 2629{
@@ -2610,28 +2637,20 @@ static const char * const policy_modes[] =
2610 2637
2611#ifdef CONFIG_TMPFS 2638#ifdef CONFIG_TMPFS
2612/** 2639/**
2613 * mpol_parse_str - parse string to mempolicy 2640 * mpol_parse_str - parse string to mempolicy, for tmpfs mpol mount option.
2614 * @str: string containing mempolicy to parse 2641 * @str: string containing mempolicy to parse
2615 * @mpol: pointer to struct mempolicy pointer, returned on success. 2642 * @mpol: pointer to struct mempolicy pointer, returned on success.
2616 * @no_context: flag whether to "contextualize" the mempolicy
2617 * 2643 *
2618 * Format of input: 2644 * Format of input:
2619 * <mode>[=<flags>][:<nodelist>] 2645 * <mode>[=<flags>][:<nodelist>]
2620 * 2646 *
2621 * if @no_context is true, save the input nodemask in w.user_nodemask in
2622 * the returned mempolicy. This will be used to "clone" the mempolicy in
2623 * a specific context [cpuset] at a later time. Used to parse tmpfs mpol
2624 * mount option. Note that if 'static' or 'relative' mode flags were
2625 * specified, the input nodemask will already have been saved. Saving
2626 * it again is redundant, but safe.
2627 *
2628 * On success, returns 0, else 1 2647 * On success, returns 0, else 1
2629 */ 2648 */
2630int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context) 2649int mpol_parse_str(char *str, struct mempolicy **mpol)
2631{ 2650{
2632 struct mempolicy *new = NULL; 2651 struct mempolicy *new = NULL;
2633 unsigned short mode; 2652 unsigned short mode;
2634 unsigned short uninitialized_var(mode_flags); 2653 unsigned short mode_flags;
2635 nodemask_t nodes; 2654 nodemask_t nodes;
2636 char *nodelist = strchr(str, ':'); 2655 char *nodelist = strchr(str, ':');
2637 char *flags = strchr(str, '='); 2656 char *flags = strchr(str, '=');
@@ -2719,24 +2738,23 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context)
2719 if (IS_ERR(new)) 2738 if (IS_ERR(new))
2720 goto out; 2739 goto out;
2721 2740
2722 if (no_context) { 2741 /*
2723 /* save for contextualization */ 2742 * Save nodes for mpol_to_str() to show the tmpfs mount options
2724 new->w.user_nodemask = nodes; 2743 * for /proc/mounts, /proc/pid/mounts and /proc/pid/mountinfo.
2725 } else { 2744 */
2726 int ret; 2745 if (mode != MPOL_PREFERRED)
2727 NODEMASK_SCRATCH(scratch); 2746 new->v.nodes = nodes;
2728 if (scratch) { 2747 else if (nodelist)
2729 task_lock(current); 2748 new->v.preferred_node = first_node(nodes);
2730 ret = mpol_set_nodemask(new, &nodes, scratch); 2749 else
2731 task_unlock(current); 2750 new->flags |= MPOL_F_LOCAL;
2732 } else 2751
2733 ret = -ENOMEM; 2752 /*
2734 NODEMASK_SCRATCH_FREE(scratch); 2753 * Save nodes for contextualization: this will be used to "clone"
2735 if (ret) { 2754 * the mempolicy in a specific context [cpuset] at a later time.
2736 mpol_put(new); 2755 */
2737 goto out; 2756 new->w.user_nodemask = nodes;
2738 } 2757
2739 }
2740 err = 0; 2758 err = 0;
2741 2759
2742out: 2760out:
@@ -2756,13 +2774,12 @@ out:
2756 * @buffer: to contain formatted mempolicy string 2774 * @buffer: to contain formatted mempolicy string
2757 * @maxlen: length of @buffer 2775 * @maxlen: length of @buffer
2758 * @pol: pointer to mempolicy to be formatted 2776 * @pol: pointer to mempolicy to be formatted
2759 * @no_context: "context free" mempolicy - use nodemask in w.user_nodemask
2760 * 2777 *
2761 * Convert a mempolicy into a string. 2778 * Convert a mempolicy into a string.
2762 * Returns the number of characters in buffer (if positive) 2779 * Returns the number of characters in buffer (if positive)
2763 * or an error (negative) 2780 * or an error (negative)
2764 */ 2781 */
2765int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, int no_context) 2782int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol)
2766{ 2783{
2767 char *p = buffer; 2784 char *p = buffer;
2768 int l; 2785 int l;
@@ -2788,7 +2805,7 @@ int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, int no_context)
2788 case MPOL_PREFERRED: 2805 case MPOL_PREFERRED:
2789 nodes_clear(nodes); 2806 nodes_clear(nodes);
2790 if (flags & MPOL_F_LOCAL) 2807 if (flags & MPOL_F_LOCAL)
2791 mode = MPOL_LOCAL; /* pseudo-policy */ 2808 mode = MPOL_LOCAL;
2792 else 2809 else
2793 node_set(pol->v.preferred_node, nodes); 2810 node_set(pol->v.preferred_node, nodes);
2794 break; 2811 break;
@@ -2796,10 +2813,7 @@ int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, int no_context)
2796 case MPOL_BIND: 2813 case MPOL_BIND:
2797 /* Fall through */ 2814 /* Fall through */
2798 case MPOL_INTERLEAVE: 2815 case MPOL_INTERLEAVE:
2799 if (no_context) 2816 nodes = pol->v.nodes;
2800 nodes = pol->w.user_nodemask;
2801 else
2802 nodes = pol->v.nodes;
2803 break; 2817 break;
2804 2818
2805 default: 2819 default:
diff --git a/mm/migrate.c b/mm/migrate.c
index 3b676b0c5c3e..c38778610aa8 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1679,9 +1679,21 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm,
1679 page_xchg_last_nid(new_page, page_last_nid(page)); 1679 page_xchg_last_nid(new_page, page_last_nid(page));
1680 1680
1681 isolated = numamigrate_isolate_page(pgdat, page); 1681 isolated = numamigrate_isolate_page(pgdat, page);
1682 if (!isolated) { 1682
1683 /*
1684 * Failing to isolate or a GUP pin prevents migration. The expected
1685 * page count is 2. 1 for anonymous pages without a mapping and 1
1686 * for the callers pin. If the page was isolated, the page will
1687 * need to be put back on the LRU.
1688 */
1689 if (!isolated || page_count(page) != 2) {
1683 count_vm_events(PGMIGRATE_FAIL, HPAGE_PMD_NR); 1690 count_vm_events(PGMIGRATE_FAIL, HPAGE_PMD_NR);
1684 put_page(new_page); 1691 put_page(new_page);
1692 if (isolated) {
1693 putback_lru_page(page);
1694 isolated = 0;
1695 goto out;
1696 }
1685 goto out_keep_locked; 1697 goto out_keep_locked;
1686 } 1698 }
1687 1699
diff --git a/mm/mmap.c b/mm/mmap.c
index f54b235f29a9..35730ee9d515 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2886,7 +2886,7 @@ static void vm_lock_anon_vma(struct mm_struct *mm, struct anon_vma *anon_vma)
2886 * The LSB of head.next can't change from under us 2886 * The LSB of head.next can't change from under us
2887 * because we hold the mm_all_locks_mutex. 2887 * because we hold the mm_all_locks_mutex.
2888 */ 2888 */
2889 down_write(&anon_vma->root->rwsem); 2889 down_write_nest_lock(&anon_vma->root->rwsem, &mm->mmap_sem);
2890 /* 2890 /*
2891 * We can safely modify head.next after taking the 2891 * We can safely modify head.next after taking the
2892 * anon_vma->root->rwsem. If some other vma in this mm shares 2892 * anon_vma->root->rwsem. If some other vma in this mm shares
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 4ba5e37127fc..df2022ff0c8a 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -221,11 +221,6 @@ EXPORT_SYMBOL(nr_online_nodes);
221 221
222int page_group_by_mobility_disabled __read_mostly; 222int page_group_by_mobility_disabled __read_mostly;
223 223
224/*
225 * NOTE:
226 * Don't use set_pageblock_migratetype(page, MIGRATE_ISOLATE) directly.
227 * Instead, use {un}set_pageblock_isolate.
228 */
229void set_pageblock_migratetype(struct page *page, int migratetype) 224void set_pageblock_migratetype(struct page *page, int migratetype)
230{ 225{
231 226
@@ -1389,14 +1384,8 @@ void split_page(struct page *page, unsigned int order)
1389 set_page_refcounted(page + i); 1384 set_page_refcounted(page + i);
1390} 1385}
1391 1386
1392/* 1387static int __isolate_free_page(struct page *page, unsigned int order)
1393 * Similar to the split_page family of functions except that the page
1394 * required at the given order and being isolated now to prevent races
1395 * with parallel allocators
1396 */
1397int capture_free_page(struct page *page, int alloc_order, int migratetype)
1398{ 1388{
1399 unsigned int order;
1400 unsigned long watermark; 1389 unsigned long watermark;
1401 struct zone *zone; 1390 struct zone *zone;
1402 int mt; 1391 int mt;
@@ -1404,7 +1393,6 @@ int capture_free_page(struct page *page, int alloc_order, int migratetype)
1404 BUG_ON(!PageBuddy(page)); 1393 BUG_ON(!PageBuddy(page));
1405 1394
1406 zone = page_zone(page); 1395 zone = page_zone(page);
1407 order = page_order(page);
1408 mt = get_pageblock_migratetype(page); 1396 mt = get_pageblock_migratetype(page);
1409 1397
1410 if (mt != MIGRATE_ISOLATE) { 1398 if (mt != MIGRATE_ISOLATE) {
@@ -1413,7 +1401,7 @@ int capture_free_page(struct page *page, int alloc_order, int migratetype)
1413 if (!zone_watermark_ok(zone, 0, watermark, 0, 0)) 1401 if (!zone_watermark_ok(zone, 0, watermark, 0, 0))
1414 return 0; 1402 return 0;
1415 1403
1416 __mod_zone_freepage_state(zone, -(1UL << alloc_order), mt); 1404 __mod_zone_freepage_state(zone, -(1UL << order), mt);
1417 } 1405 }
1418 1406
1419 /* Remove page from free list */ 1407 /* Remove page from free list */
@@ -1421,11 +1409,7 @@ int capture_free_page(struct page *page, int alloc_order, int migratetype)
1421 zone->free_area[order].nr_free--; 1409 zone->free_area[order].nr_free--;
1422 rmv_page_order(page); 1410 rmv_page_order(page);
1423 1411
1424 if (alloc_order != order) 1412 /* Set the pageblock if the isolated page is at least a pageblock */
1425 expand(zone, page, alloc_order, order,
1426 &zone->free_area[order], migratetype);
1427
1428 /* Set the pageblock if the captured page is at least a pageblock */
1429 if (order >= pageblock_order - 1) { 1413 if (order >= pageblock_order - 1) {
1430 struct page *endpage = page + (1 << order) - 1; 1414 struct page *endpage = page + (1 << order) - 1;
1431 for (; page < endpage; page += pageblock_nr_pages) { 1415 for (; page < endpage; page += pageblock_nr_pages) {
@@ -1436,7 +1420,7 @@ int capture_free_page(struct page *page, int alloc_order, int migratetype)
1436 } 1420 }
1437 } 1421 }
1438 1422
1439 return 1UL << alloc_order; 1423 return 1UL << order;
1440} 1424}
1441 1425
1442/* 1426/*
@@ -1454,10 +1438,9 @@ int split_free_page(struct page *page)
1454 unsigned int order; 1438 unsigned int order;
1455 int nr_pages; 1439 int nr_pages;
1456 1440
1457 BUG_ON(!PageBuddy(page));
1458 order = page_order(page); 1441 order = page_order(page);
1459 1442
1460 nr_pages = capture_free_page(page, order, 0); 1443 nr_pages = __isolate_free_page(page, order);
1461 if (!nr_pages) 1444 if (!nr_pages)
1462 return 0; 1445 return 0;
1463 1446
@@ -1655,20 +1638,6 @@ static bool __zone_watermark_ok(struct zone *z, int order, unsigned long mark,
1655 return true; 1638 return true;
1656} 1639}
1657 1640
1658#ifdef CONFIG_MEMORY_ISOLATION
1659static inline unsigned long nr_zone_isolate_freepages(struct zone *zone)
1660{
1661 if (unlikely(zone->nr_pageblock_isolate))
1662 return zone->nr_pageblock_isolate * pageblock_nr_pages;
1663 return 0;
1664}
1665#else
1666static inline unsigned long nr_zone_isolate_freepages(struct zone *zone)
1667{
1668 return 0;
1669}
1670#endif
1671
1672bool zone_watermark_ok(struct zone *z, int order, unsigned long mark, 1641bool zone_watermark_ok(struct zone *z, int order, unsigned long mark,
1673 int classzone_idx, int alloc_flags) 1642 int classzone_idx, int alloc_flags)
1674{ 1643{
@@ -1684,14 +1653,6 @@ bool zone_watermark_ok_safe(struct zone *z, int order, unsigned long mark,
1684 if (z->percpu_drift_mark && free_pages < z->percpu_drift_mark) 1653 if (z->percpu_drift_mark && free_pages < z->percpu_drift_mark)
1685 free_pages = zone_page_state_snapshot(z, NR_FREE_PAGES); 1654 free_pages = zone_page_state_snapshot(z, NR_FREE_PAGES);
1686 1655
1687 /*
1688 * If the zone has MIGRATE_ISOLATE type free pages, we should consider
1689 * it. nr_zone_isolate_freepages is never accurate so kswapd might not
1690 * sleep although it could do so. But this is more desirable for memory
1691 * hotplug than sleeping which can cause a livelock in the direct
1692 * reclaim path.
1693 */
1694 free_pages -= nr_zone_isolate_freepages(z);
1695 return __zone_watermark_ok(z, order, mark, classzone_idx, alloc_flags, 1656 return __zone_watermark_ok(z, order, mark, classzone_idx, alloc_flags,
1696 free_pages); 1657 free_pages);
1697} 1658}
@@ -2163,8 +2124,6 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
2163 bool *contended_compaction, bool *deferred_compaction, 2124 bool *contended_compaction, bool *deferred_compaction,
2164 unsigned long *did_some_progress) 2125 unsigned long *did_some_progress)
2165{ 2126{
2166 struct page *page = NULL;
2167
2168 if (!order) 2127 if (!order)
2169 return NULL; 2128 return NULL;
2170 2129
@@ -2176,16 +2135,12 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
2176 current->flags |= PF_MEMALLOC; 2135 current->flags |= PF_MEMALLOC;
2177 *did_some_progress = try_to_compact_pages(zonelist, order, gfp_mask, 2136 *did_some_progress = try_to_compact_pages(zonelist, order, gfp_mask,
2178 nodemask, sync_migration, 2137 nodemask, sync_migration,
2179 contended_compaction, &page); 2138 contended_compaction);
2180 current->flags &= ~PF_MEMALLOC; 2139 current->flags &= ~PF_MEMALLOC;
2181 2140
2182 /* If compaction captured a page, prep and use it */
2183 if (page) {
2184 prep_new_page(page, order, gfp_mask);
2185 goto got_page;
2186 }
2187
2188 if (*did_some_progress != COMPACT_SKIPPED) { 2141 if (*did_some_progress != COMPACT_SKIPPED) {
2142 struct page *page;
2143
2189 /* Page migration frees to the PCP lists but we want merging */ 2144 /* Page migration frees to the PCP lists but we want merging */
2190 drain_pages(get_cpu()); 2145 drain_pages(get_cpu());
2191 put_cpu(); 2146 put_cpu();
@@ -2195,7 +2150,6 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
2195 alloc_flags & ~ALLOC_NO_WATERMARKS, 2150 alloc_flags & ~ALLOC_NO_WATERMARKS,
2196 preferred_zone, migratetype); 2151 preferred_zone, migratetype);
2197 if (page) { 2152 if (page) {
2198got_page:
2199 preferred_zone->compact_blockskip_flush = false; 2153 preferred_zone->compact_blockskip_flush = false;
2200 preferred_zone->compact_considered = 0; 2154 preferred_zone->compact_considered = 0;
2201 preferred_zone->compact_defer_shift = 0; 2155 preferred_zone->compact_defer_shift = 0;
@@ -5631,7 +5585,7 @@ static inline int pfn_to_bitidx(struct zone *zone, unsigned long pfn)
5631 pfn &= (PAGES_PER_SECTION-1); 5585 pfn &= (PAGES_PER_SECTION-1);
5632 return (pfn >> pageblock_order) * NR_PAGEBLOCK_BITS; 5586 return (pfn >> pageblock_order) * NR_PAGEBLOCK_BITS;
5633#else 5587#else
5634 pfn = pfn - zone->zone_start_pfn; 5588 pfn = pfn - round_down(zone->zone_start_pfn, pageblock_nr_pages);
5635 return (pfn >> pageblock_order) * NR_PAGEBLOCK_BITS; 5589 return (pfn >> pageblock_order) * NR_PAGEBLOCK_BITS;
5636#endif /* CONFIG_SPARSEMEM */ 5590#endif /* CONFIG_SPARSEMEM */
5637} 5591}
diff --git a/mm/page_isolation.c b/mm/page_isolation.c
index 9d2264ea4606..383bdbb98b04 100644
--- a/mm/page_isolation.c
+++ b/mm/page_isolation.c
@@ -8,28 +8,6 @@
8#include <linux/memory.h> 8#include <linux/memory.h>
9#include "internal.h" 9#include "internal.h"
10 10
11/* called while holding zone->lock */
12static void set_pageblock_isolate(struct page *page)
13{
14 if (get_pageblock_migratetype(page) == MIGRATE_ISOLATE)
15 return;
16
17 set_pageblock_migratetype(page, MIGRATE_ISOLATE);
18 page_zone(page)->nr_pageblock_isolate++;
19}
20
21/* called while holding zone->lock */
22static void restore_pageblock_isolate(struct page *page, int migratetype)
23{
24 struct zone *zone = page_zone(page);
25 if (WARN_ON(get_pageblock_migratetype(page) != MIGRATE_ISOLATE))
26 return;
27
28 BUG_ON(zone->nr_pageblock_isolate <= 0);
29 set_pageblock_migratetype(page, migratetype);
30 zone->nr_pageblock_isolate--;
31}
32
33int set_migratetype_isolate(struct page *page, bool skip_hwpoisoned_pages) 11int set_migratetype_isolate(struct page *page, bool skip_hwpoisoned_pages)
34{ 12{
35 struct zone *zone; 13 struct zone *zone;
@@ -80,7 +58,7 @@ out:
80 unsigned long nr_pages; 58 unsigned long nr_pages;
81 int migratetype = get_pageblock_migratetype(page); 59 int migratetype = get_pageblock_migratetype(page);
82 60
83 set_pageblock_isolate(page); 61 set_pageblock_migratetype(page, MIGRATE_ISOLATE);
84 nr_pages = move_freepages_block(zone, page, MIGRATE_ISOLATE); 62 nr_pages = move_freepages_block(zone, page, MIGRATE_ISOLATE);
85 63
86 __mod_zone_freepage_state(zone, -nr_pages, migratetype); 64 __mod_zone_freepage_state(zone, -nr_pages, migratetype);
@@ -103,7 +81,7 @@ void unset_migratetype_isolate(struct page *page, unsigned migratetype)
103 goto out; 81 goto out;
104 nr_pages = move_freepages_block(zone, page, migratetype); 82 nr_pages = move_freepages_block(zone, page, migratetype);
105 __mod_zone_freepage_state(zone, nr_pages, migratetype); 83 __mod_zone_freepage_state(zone, nr_pages, migratetype);
106 restore_pageblock_isolate(page, migratetype); 84 set_pageblock_migratetype(page, migratetype);
107out: 85out:
108 spin_unlock_irqrestore(&zone->lock, flags); 86 spin_unlock_irqrestore(&zone->lock, flags);
109} 87}
diff --git a/mm/shmem.c b/mm/shmem.c
index 5c90d84c2b02..5dd56f6efdbd 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -889,7 +889,7 @@ static void shmem_show_mpol(struct seq_file *seq, struct mempolicy *mpol)
889 if (!mpol || mpol->mode == MPOL_DEFAULT) 889 if (!mpol || mpol->mode == MPOL_DEFAULT)
890 return; /* show nothing */ 890 return; /* show nothing */
891 891
892 mpol_to_str(buffer, sizeof(buffer), mpol, 1); 892 mpol_to_str(buffer, sizeof(buffer), mpol);
893 893
894 seq_printf(seq, ",mpol=%s", buffer); 894 seq_printf(seq, ",mpol=%s", buffer);
895} 895}
@@ -2463,7 +2463,7 @@ static int shmem_parse_options(char *options, struct shmem_sb_info *sbinfo,
2463 if (!gid_valid(sbinfo->gid)) 2463 if (!gid_valid(sbinfo->gid))
2464 goto bad_val; 2464 goto bad_val;
2465 } else if (!strcmp(this_char,"mpol")) { 2465 } else if (!strcmp(this_char,"mpol")) {
2466 if (mpol_parse_str(value, &sbinfo->mpol, 1)) 2466 if (mpol_parse_str(value, &sbinfo->mpol))
2467 goto bad_val; 2467 goto bad_val;
2468 } else { 2468 } else {
2469 printk(KERN_ERR "tmpfs: Bad mount option %s\n", 2469 printk(KERN_ERR "tmpfs: Bad mount option %s\n",
diff --git a/mm/vmscan.c b/mm/vmscan.c
index adc7e9058181..196709f5ee58 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2452,12 +2452,16 @@ static bool zone_balanced(struct zone *zone, int order,
2452} 2452}
2453 2453
2454/* 2454/*
2455 * pgdat_balanced is used when checking if a node is balanced for high-order 2455 * pgdat_balanced() is used when checking if a node is balanced.
2456 * allocations. Only zones that meet watermarks and are in a zone allowed 2456 *
2457 * by the callers classzone_idx are added to balanced_pages. The total of 2457 * For order-0, all zones must be balanced!
2458 * balanced pages must be at least 25% of the zones allowed by classzone_idx 2458 *
2459 * for the node to be considered balanced. Forcing all zones to be balanced 2459 * For high-order allocations only zones that meet watermarks and are in a
2460 * for high orders can cause excessive reclaim when there are imbalanced zones. 2460 * zone allowed by the callers classzone_idx are added to balanced_pages. The
2461 * total of balanced pages must be at least 25% of the zones allowed by
2462 * classzone_idx for the node to be considered balanced. Forcing all zones to
2463 * be balanced for high orders can cause excessive reclaim when there are
2464 * imbalanced zones.
2461 * The choice of 25% is due to 2465 * The choice of 25% is due to
2462 * o a 16M DMA zone that is balanced will not balance a zone on any 2466 * o a 16M DMA zone that is balanced will not balance a zone on any
2463 * reasonable sized machine 2467 * reasonable sized machine
@@ -2467,17 +2471,43 @@ static bool zone_balanced(struct zone *zone, int order,
2467 * Similarly, on x86-64 the Normal zone would need to be at least 1G 2471 * Similarly, on x86-64 the Normal zone would need to be at least 1G
2468 * to balance a node on its own. These seemed like reasonable ratios. 2472 * to balance a node on its own. These seemed like reasonable ratios.
2469 */ 2473 */
2470static bool pgdat_balanced(pg_data_t *pgdat, unsigned long balanced_pages, 2474static bool pgdat_balanced(pg_data_t *pgdat, int order, int classzone_idx)
2471 int classzone_idx)
2472{ 2475{
2473 unsigned long present_pages = 0; 2476 unsigned long present_pages = 0;
2477 unsigned long balanced_pages = 0;
2474 int i; 2478 int i;
2475 2479
2476 for (i = 0; i <= classzone_idx; i++) 2480 /* Check the watermark levels */
2477 present_pages += pgdat->node_zones[i].present_pages; 2481 for (i = 0; i <= classzone_idx; i++) {
2482 struct zone *zone = pgdat->node_zones + i;
2478 2483
2479 /* A special case here: if zone has no page, we think it's balanced */ 2484 if (!populated_zone(zone))
2480 return balanced_pages >= (present_pages >> 2); 2485 continue;
2486
2487 present_pages += zone->present_pages;
2488
2489 /*
2490 * A special case here:
2491 *
2492 * balance_pgdat() skips over all_unreclaimable after
2493 * DEF_PRIORITY. Effectively, it considers them balanced so
2494 * they must be considered balanced here as well!
2495 */
2496 if (zone->all_unreclaimable) {
2497 balanced_pages += zone->present_pages;
2498 continue;
2499 }
2500
2501 if (zone_balanced(zone, order, 0, i))
2502 balanced_pages += zone->present_pages;
2503 else if (!order)
2504 return false;
2505 }
2506
2507 if (order)
2508 return balanced_pages >= (present_pages >> 2);
2509 else
2510 return true;
2481} 2511}
2482 2512
2483/* 2513/*
@@ -2489,10 +2519,6 @@ static bool pgdat_balanced(pg_data_t *pgdat, unsigned long balanced_pages,
2489static bool prepare_kswapd_sleep(pg_data_t *pgdat, int order, long remaining, 2519static bool prepare_kswapd_sleep(pg_data_t *pgdat, int order, long remaining,
2490 int classzone_idx) 2520 int classzone_idx)
2491{ 2521{
2492 int i;
2493 unsigned long balanced = 0;
2494 bool all_zones_ok = true;
2495
2496 /* If a direct reclaimer woke kswapd within HZ/10, it's premature */ 2522 /* If a direct reclaimer woke kswapd within HZ/10, it's premature */
2497 if (remaining) 2523 if (remaining)
2498 return false; 2524 return false;
@@ -2511,39 +2537,7 @@ static bool prepare_kswapd_sleep(pg_data_t *pgdat, int order, long remaining,
2511 return false; 2537 return false;
2512 } 2538 }
2513 2539
2514 /* Check the watermark levels */ 2540 return pgdat_balanced(pgdat, order, classzone_idx);
2515 for (i = 0; i <= classzone_idx; i++) {
2516 struct zone *zone = pgdat->node_zones + i;
2517
2518 if (!populated_zone(zone))
2519 continue;
2520
2521 /*
2522 * balance_pgdat() skips over all_unreclaimable after
2523 * DEF_PRIORITY. Effectively, it considers them balanced so
2524 * they must be considered balanced here as well if kswapd
2525 * is to sleep
2526 */
2527 if (zone->all_unreclaimable) {
2528 balanced += zone->present_pages;
2529 continue;
2530 }
2531
2532 if (!zone_balanced(zone, order, 0, i))
2533 all_zones_ok = false;
2534 else
2535 balanced += zone->present_pages;
2536 }
2537
2538 /*
2539 * For high-order requests, the balanced zones must contain at least
2540 * 25% of the nodes pages for kswapd to sleep. For order-0, all zones
2541 * must be balanced
2542 */
2543 if (order)
2544 return pgdat_balanced(pgdat, balanced, classzone_idx);
2545 else
2546 return all_zones_ok;
2547} 2541}
2548 2542
2549/* 2543/*
@@ -2571,7 +2565,6 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order,
2571 int *classzone_idx) 2565 int *classzone_idx)
2572{ 2566{
2573 struct zone *unbalanced_zone; 2567 struct zone *unbalanced_zone;
2574 unsigned long balanced;
2575 int i; 2568 int i;
2576 int end_zone = 0; /* Inclusive. 0 = ZONE_DMA */ 2569 int end_zone = 0; /* Inclusive. 0 = ZONE_DMA */
2577 unsigned long total_scanned; 2570 unsigned long total_scanned;
@@ -2605,7 +2598,6 @@ loop_again:
2605 int has_under_min_watermark_zone = 0; 2598 int has_under_min_watermark_zone = 0;
2606 2599
2607 unbalanced_zone = NULL; 2600 unbalanced_zone = NULL;
2608 balanced = 0;
2609 2601
2610 /* 2602 /*
2611 * Scan in the highmem->dma direction for the highest 2603 * Scan in the highmem->dma direction for the highest
@@ -2761,8 +2753,6 @@ loop_again:
2761 * speculatively avoid congestion waits 2753 * speculatively avoid congestion waits
2762 */ 2754 */
2763 zone_clear_flag(zone, ZONE_CONGESTED); 2755 zone_clear_flag(zone, ZONE_CONGESTED);
2764 if (i <= *classzone_idx)
2765 balanced += zone->present_pages;
2766 } 2756 }
2767 2757
2768 } 2758 }
@@ -2776,7 +2766,7 @@ loop_again:
2776 pfmemalloc_watermark_ok(pgdat)) 2766 pfmemalloc_watermark_ok(pgdat))
2777 wake_up(&pgdat->pfmemalloc_wait); 2767 wake_up(&pgdat->pfmemalloc_wait);
2778 2768
2779 if (!unbalanced_zone || (order && pgdat_balanced(pgdat, balanced, *classzone_idx))) 2769 if (pgdat_balanced(pgdat, order, *classzone_idx))
2780 break; /* kswapd: all done */ 2770 break; /* kswapd: all done */
2781 /* 2771 /*
2782 * OK, kswapd is getting into trouble. Take a nap, then take 2772 * OK, kswapd is getting into trouble. Take a nap, then take
@@ -2785,7 +2775,7 @@ loop_again:
2785 if (total_scanned && (sc.priority < DEF_PRIORITY - 2)) { 2775 if (total_scanned && (sc.priority < DEF_PRIORITY - 2)) {
2786 if (has_under_min_watermark_zone) 2776 if (has_under_min_watermark_zone)
2787 count_vm_event(KSWAPD_SKIP_CONGESTION_WAIT); 2777 count_vm_event(KSWAPD_SKIP_CONGESTION_WAIT);
2788 else 2778 else if (unbalanced_zone)
2789 wait_iff_congested(unbalanced_zone, BLK_RW_ASYNC, HZ/10); 2779 wait_iff_congested(unbalanced_zone, BLK_RW_ASYNC, HZ/10);
2790 } 2780 }
2791 2781
@@ -2800,12 +2790,7 @@ loop_again:
2800 } while (--sc.priority >= 0); 2790 } while (--sc.priority >= 0);
2801out: 2791out:
2802 2792
2803 /* 2793 if (!pgdat_balanced(pgdat, order, *classzone_idx)) {
2804 * order-0: All zones must meet high watermark for a balanced node
2805 * high-order: Balanced zones must make up at least 25% of the node
2806 * for the node to be balanced
2807 */
2808 if (unbalanced_zone && (!order || !pgdat_balanced(pgdat, balanced, *classzone_idx))) {
2809 cond_resched(); 2794 cond_resched();
2810 2795
2811 try_to_freeze(); 2796 try_to_freeze();
@@ -3137,8 +3122,8 @@ unsigned long shrink_all_memory(unsigned long nr_to_reclaim)
3137 not required for correctness. So if the last cpu in a node goes 3122 not required for correctness. So if the last cpu in a node goes
3138 away, we get changed to run anywhere: as the first one comes back, 3123 away, we get changed to run anywhere: as the first one comes back,
3139 restore their cpu bindings. */ 3124 restore their cpu bindings. */
3140static int __devinit cpu_callback(struct notifier_block *nfb, 3125static int cpu_callback(struct notifier_block *nfb, unsigned long action,
3141 unsigned long action, void *hcpu) 3126 void *hcpu)
3142{ 3127{
3143 int nid; 3128 int nid;
3144 3129
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 9f3925a85aab..7d02ebd11a7f 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -123,7 +123,7 @@ batadv_iv_ogm_emit_send_time(const struct batadv_priv *bat_priv)
123 unsigned int msecs; 123 unsigned int msecs;
124 124
125 msecs = atomic_read(&bat_priv->orig_interval) - BATADV_JITTER; 125 msecs = atomic_read(&bat_priv->orig_interval) - BATADV_JITTER;
126 msecs += (random32() % 2 * BATADV_JITTER); 126 msecs += random32() % (2 * BATADV_JITTER);
127 127
128 return jiffies + msecs_to_jiffies(msecs); 128 return jiffies + msecs_to_jiffies(msecs);
129} 129}
diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c
index 8e1d89d2b1c1..183f97a86bb2 100644
--- a/net/batman-adv/distributed-arp-table.c
+++ b/net/batman-adv/distributed-arp-table.c
@@ -738,6 +738,7 @@ static uint16_t batadv_arp_get_type(struct batadv_priv *bat_priv,
738 struct arphdr *arphdr; 738 struct arphdr *arphdr;
739 struct ethhdr *ethhdr; 739 struct ethhdr *ethhdr;
740 __be32 ip_src, ip_dst; 740 __be32 ip_src, ip_dst;
741 uint8_t *hw_src, *hw_dst;
741 uint16_t type = 0; 742 uint16_t type = 0;
742 743
743 /* pull the ethernet header */ 744 /* pull the ethernet header */
@@ -777,9 +778,23 @@ static uint16_t batadv_arp_get_type(struct batadv_priv *bat_priv,
777 ip_src = batadv_arp_ip_src(skb, hdr_size); 778 ip_src = batadv_arp_ip_src(skb, hdr_size);
778 ip_dst = batadv_arp_ip_dst(skb, hdr_size); 779 ip_dst = batadv_arp_ip_dst(skb, hdr_size);
779 if (ipv4_is_loopback(ip_src) || ipv4_is_multicast(ip_src) || 780 if (ipv4_is_loopback(ip_src) || ipv4_is_multicast(ip_src) ||
780 ipv4_is_loopback(ip_dst) || ipv4_is_multicast(ip_dst)) 781 ipv4_is_loopback(ip_dst) || ipv4_is_multicast(ip_dst) ||
782 ipv4_is_zeronet(ip_src) || ipv4_is_lbcast(ip_src) ||
783 ipv4_is_zeronet(ip_dst) || ipv4_is_lbcast(ip_dst))
781 goto out; 784 goto out;
782 785
786 hw_src = batadv_arp_hw_src(skb, hdr_size);
787 if (is_zero_ether_addr(hw_src) || is_multicast_ether_addr(hw_src))
788 goto out;
789
790 /* we don't care about the destination MAC address in ARP requests */
791 if (arphdr->ar_op != htons(ARPOP_REQUEST)) {
792 hw_dst = batadv_arp_hw_dst(skb, hdr_size);
793 if (is_zero_ether_addr(hw_dst) ||
794 is_multicast_ether_addr(hw_dst))
795 goto out;
796 }
797
783 type = ntohs(arphdr->ar_op); 798 type = ntohs(arphdr->ar_op);
784out: 799out:
785 return type; 800 return type;
@@ -1012,6 +1027,8 @@ bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv,
1012 */ 1027 */
1013 ret = !batadv_is_my_client(bat_priv, hw_dst); 1028 ret = !batadv_is_my_client(bat_priv, hw_dst);
1014out: 1029out:
1030 if (ret)
1031 kfree_skb(skb);
1015 /* if ret == false -> packet has to be delivered to the interface */ 1032 /* if ret == false -> packet has to be delivered to the interface */
1016 return ret; 1033 return ret;
1017} 1034}
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 596660d37c5e..0f78e34220c9 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2810,14 +2810,6 @@ static void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb)
2810 if (conn) { 2810 if (conn) {
2811 hci_conn_enter_active_mode(conn, BT_POWER_FORCE_ACTIVE_OFF); 2811 hci_conn_enter_active_mode(conn, BT_POWER_FORCE_ACTIVE_OFF);
2812 2812
2813 hci_dev_lock(hdev);
2814 if (test_bit(HCI_MGMT, &hdev->dev_flags) &&
2815 !test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags))
2816 mgmt_device_connected(hdev, &conn->dst, conn->type,
2817 conn->dst_type, 0, NULL, 0,
2818 conn->dev_class);
2819 hci_dev_unlock(hdev);
2820
2821 /* Send to upper protocol */ 2813 /* Send to upper protocol */
2822 l2cap_recv_acldata(conn, skb, flags); 2814 l2cap_recv_acldata(conn, skb, flags);
2823 return; 2815 return;
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 705078a0cc39..81b44481d0d9 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -2688,7 +2688,7 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
2688 if (ev->opcode != HCI_OP_NOP) 2688 if (ev->opcode != HCI_OP_NOP)
2689 del_timer(&hdev->cmd_timer); 2689 del_timer(&hdev->cmd_timer);
2690 2690
2691 if (ev->ncmd) { 2691 if (ev->ncmd && !test_bit(HCI_RESET, &hdev->flags)) {
2692 atomic_set(&hdev->cmd_cnt, 1); 2692 atomic_set(&hdev->cmd_cnt, 1);
2693 if (!skb_queue_empty(&hdev->cmd_q)) 2693 if (!skb_queue_empty(&hdev->cmd_q))
2694 queue_work(hdev->workqueue, &hdev->cmd_work); 2694 queue_work(hdev->workqueue, &hdev->cmd_work);
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index b2bcbe2dc328..a7352ff3fd1e 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -931,7 +931,7 @@ static int hidp_setup_hid(struct hidp_session *session,
931 hid->version = req->version; 931 hid->version = req->version;
932 hid->country = req->country; 932 hid->country = req->country;
933 933
934 strncpy(hid->name, req->name, 128); 934 strncpy(hid->name, req->name, sizeof(req->name) - 1);
935 935
936 snprintf(hid->phys, sizeof(hid->phys), "%pMR", 936 snprintf(hid->phys, sizeof(hid->phys), "%pMR",
937 &bt_sk(session->ctrl_sock->sk)->src); 937 &bt_sk(session->ctrl_sock->sk)->src);
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 2c78208d793e..22e658322845 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -3727,6 +3727,17 @@ sendresp:
3727static int l2cap_connect_req(struct l2cap_conn *conn, 3727static int l2cap_connect_req(struct l2cap_conn *conn,
3728 struct l2cap_cmd_hdr *cmd, u8 *data) 3728 struct l2cap_cmd_hdr *cmd, u8 *data)
3729{ 3729{
3730 struct hci_dev *hdev = conn->hcon->hdev;
3731 struct hci_conn *hcon = conn->hcon;
3732
3733 hci_dev_lock(hdev);
3734 if (test_bit(HCI_MGMT, &hdev->dev_flags) &&
3735 !test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &hcon->flags))
3736 mgmt_device_connected(hdev, &hcon->dst, hcon->type,
3737 hcon->dst_type, 0, NULL, 0,
3738 hcon->dev_class);
3739 hci_dev_unlock(hdev);
3740
3730 l2cap_connect(conn, cmd, data, L2CAP_CONN_RSP, 0); 3741 l2cap_connect(conn, cmd, data, L2CAP_CONN_RSP, 0);
3731 return 0; 3742 return 0;
3732} 3743}
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index 531a93d613d4..57f250c20e39 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -352,7 +352,7 @@ static void __sco_sock_close(struct sock *sk)
352 352
353 case BT_CONNECTED: 353 case BT_CONNECTED:
354 case BT_CONFIG: 354 case BT_CONFIG:
355 if (sco_pi(sk)->conn) { 355 if (sco_pi(sk)->conn->hcon) {
356 sk->sk_state = BT_DISCONN; 356 sk->sk_state = BT_DISCONN;
357 sco_sock_set_timer(sk, SCO_DISCONN_TIMEOUT); 357 sco_sock_set_timer(sk, SCO_DISCONN_TIMEOUT);
358 hci_conn_put(sco_pi(sk)->conn->hcon); 358 hci_conn_put(sco_pi(sk)->conn->hcon);
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 1c8fdc3558cd..37fe693471a8 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -366,11 +366,11 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
366 366
367 err = netdev_set_master(dev, br->dev); 367 err = netdev_set_master(dev, br->dev);
368 if (err) 368 if (err)
369 goto err3; 369 goto err4;
370 370
371 err = netdev_rx_handler_register(dev, br_handle_frame, p); 371 err = netdev_rx_handler_register(dev, br_handle_frame, p);
372 if (err) 372 if (err)
373 goto err4; 373 goto err5;
374 374
375 dev->priv_flags |= IFF_BRIDGE_PORT; 375 dev->priv_flags |= IFF_BRIDGE_PORT;
376 376
@@ -402,8 +402,10 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
402 402
403 return 0; 403 return 0;
404 404
405err4: 405err5:
406 netdev_set_master(dev, NULL); 406 netdev_set_master(dev, NULL);
407err4:
408 br_netpoll_disable(p);
407err3: 409err3:
408 sysfs_remove_link(br->ifobj, p->dev->name); 410 sysfs_remove_link(br->ifobj, p->dev->name);
409err2: 411err2:
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index 5391ca43336a..6d6f26531de2 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -1608,7 +1608,6 @@ void br_multicast_init(struct net_bridge *br)
1608 br_multicast_querier_expired, (unsigned long)br); 1608 br_multicast_querier_expired, (unsigned long)br);
1609 setup_timer(&br->multicast_query_timer, br_multicast_query_expired, 1609 setup_timer(&br->multicast_query_timer, br_multicast_query_expired,
1610 (unsigned long)br); 1610 (unsigned long)br);
1611 br_mdb_init();
1612} 1611}
1613 1612
1614void br_multicast_open(struct net_bridge *br) 1613void br_multicast_open(struct net_bridge *br)
@@ -1633,7 +1632,6 @@ void br_multicast_stop(struct net_bridge *br)
1633 del_timer_sync(&br->multicast_querier_timer); 1632 del_timer_sync(&br->multicast_querier_timer);
1634 del_timer_sync(&br->multicast_query_timer); 1633 del_timer_sync(&br->multicast_query_timer);
1635 1634
1636 br_mdb_uninit();
1637 spin_lock_bh(&br->multicast_lock); 1635 spin_lock_bh(&br->multicast_lock);
1638 mdb = mlock_dereference(br->mdb, br); 1636 mdb = mlock_dereference(br->mdb, br);
1639 if (!mdb) 1637 if (!mdb)
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 97ba0189c6f7..5dc66abcc9e2 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -299,10 +299,21 @@ struct rtnl_link_ops br_link_ops __read_mostly = {
299 299
300int __init br_netlink_init(void) 300int __init br_netlink_init(void)
301{ 301{
302 return rtnl_link_register(&br_link_ops); 302 int err;
303
304 br_mdb_init();
305 err = rtnl_link_register(&br_link_ops);
306 if (err)
307 goto out;
308
309 return 0;
310out:
311 br_mdb_uninit();
312 return err;
303} 313}
304 314
305void __exit br_netlink_fini(void) 315void __exit br_netlink_fini(void)
306{ 316{
317 br_mdb_uninit();
307 rtnl_link_unregister(&br_link_ops); 318 rtnl_link_unregister(&br_link_ops);
308} 319}
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 8d83be5ffedc..711094aed41a 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -526,6 +526,12 @@ static inline bool br_multicast_is_router(struct net_bridge *br)
526{ 526{
527 return 0; 527 return 0;
528} 528}
529static inline void br_mdb_init(void)
530{
531}
532static inline void br_mdb_uninit(void)
533{
534}
529#endif 535#endif
530 536
531/* br_netfilter.c */ 537/* br_netfilter.c */
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 4d111fd2b492..5ccf87ed8d68 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -506,6 +506,7 @@ static void reset_connection(struct ceph_connection *con)
506{ 506{
507 /* reset connection, out_queue, msg_ and connect_seq */ 507 /* reset connection, out_queue, msg_ and connect_seq */
508 /* discard existing out_queue and msg_seq */ 508 /* discard existing out_queue and msg_seq */
509 dout("reset_connection %p\n", con);
509 ceph_msg_remove_list(&con->out_queue); 510 ceph_msg_remove_list(&con->out_queue);
510 ceph_msg_remove_list(&con->out_sent); 511 ceph_msg_remove_list(&con->out_sent);
511 512
@@ -561,7 +562,7 @@ void ceph_con_open(struct ceph_connection *con,
561 mutex_lock(&con->mutex); 562 mutex_lock(&con->mutex);
562 dout("con_open %p %s\n", con, ceph_pr_addr(&addr->in_addr)); 563 dout("con_open %p %s\n", con, ceph_pr_addr(&addr->in_addr));
563 564
564 BUG_ON(con->state != CON_STATE_CLOSED); 565 WARN_ON(con->state != CON_STATE_CLOSED);
565 con->state = CON_STATE_PREOPEN; 566 con->state = CON_STATE_PREOPEN;
566 567
567 con->peer_name.type = (__u8) entity_type; 568 con->peer_name.type = (__u8) entity_type;
@@ -1506,13 +1507,6 @@ static int process_banner(struct ceph_connection *con)
1506 return 0; 1507 return 0;
1507} 1508}
1508 1509
1509static void fail_protocol(struct ceph_connection *con)
1510{
1511 reset_connection(con);
1512 BUG_ON(con->state != CON_STATE_NEGOTIATING);
1513 con->state = CON_STATE_CLOSED;
1514}
1515
1516static int process_connect(struct ceph_connection *con) 1510static int process_connect(struct ceph_connection *con)
1517{ 1511{
1518 u64 sup_feat = con->msgr->supported_features; 1512 u64 sup_feat = con->msgr->supported_features;
@@ -1530,7 +1524,7 @@ static int process_connect(struct ceph_connection *con)
1530 ceph_pr_addr(&con->peer_addr.in_addr), 1524 ceph_pr_addr(&con->peer_addr.in_addr),
1531 sup_feat, server_feat, server_feat & ~sup_feat); 1525 sup_feat, server_feat, server_feat & ~sup_feat);
1532 con->error_msg = "missing required protocol features"; 1526 con->error_msg = "missing required protocol features";
1533 fail_protocol(con); 1527 reset_connection(con);
1534 return -1; 1528 return -1;
1535 1529
1536 case CEPH_MSGR_TAG_BADPROTOVER: 1530 case CEPH_MSGR_TAG_BADPROTOVER:
@@ -1541,7 +1535,7 @@ static int process_connect(struct ceph_connection *con)
1541 le32_to_cpu(con->out_connect.protocol_version), 1535 le32_to_cpu(con->out_connect.protocol_version),
1542 le32_to_cpu(con->in_reply.protocol_version)); 1536 le32_to_cpu(con->in_reply.protocol_version));
1543 con->error_msg = "protocol version mismatch"; 1537 con->error_msg = "protocol version mismatch";
1544 fail_protocol(con); 1538 reset_connection(con);
1545 return -1; 1539 return -1;
1546 1540
1547 case CEPH_MSGR_TAG_BADAUTHORIZER: 1541 case CEPH_MSGR_TAG_BADAUTHORIZER:
@@ -1631,11 +1625,11 @@ static int process_connect(struct ceph_connection *con)
1631 ceph_pr_addr(&con->peer_addr.in_addr), 1625 ceph_pr_addr(&con->peer_addr.in_addr),
1632 req_feat, server_feat, req_feat & ~server_feat); 1626 req_feat, server_feat, req_feat & ~server_feat);
1633 con->error_msg = "missing required protocol features"; 1627 con->error_msg = "missing required protocol features";
1634 fail_protocol(con); 1628 reset_connection(con);
1635 return -1; 1629 return -1;
1636 } 1630 }
1637 1631
1638 BUG_ON(con->state != CON_STATE_NEGOTIATING); 1632 WARN_ON(con->state != CON_STATE_NEGOTIATING);
1639 con->state = CON_STATE_OPEN; 1633 con->state = CON_STATE_OPEN;
1640 1634
1641 con->peer_global_seq = le32_to_cpu(con->in_reply.global_seq); 1635 con->peer_global_seq = le32_to_cpu(con->in_reply.global_seq);
@@ -2132,7 +2126,6 @@ more:
2132 if (ret < 0) 2126 if (ret < 0)
2133 goto out; 2127 goto out;
2134 2128
2135 BUG_ON(con->state != CON_STATE_CONNECTING);
2136 con->state = CON_STATE_NEGOTIATING; 2129 con->state = CON_STATE_NEGOTIATING;
2137 2130
2138 /* 2131 /*
@@ -2160,7 +2153,7 @@ more:
2160 goto more; 2153 goto more;
2161 } 2154 }
2162 2155
2163 BUG_ON(con->state != CON_STATE_OPEN); 2156 WARN_ON(con->state != CON_STATE_OPEN);
2164 2157
2165 if (con->in_base_pos < 0) { 2158 if (con->in_base_pos < 0) {
2166 /* 2159 /*
@@ -2382,7 +2375,7 @@ static void ceph_fault(struct ceph_connection *con)
2382 dout("fault %p state %lu to peer %s\n", 2375 dout("fault %p state %lu to peer %s\n",
2383 con, con->state, ceph_pr_addr(&con->peer_addr.in_addr)); 2376 con, con->state, ceph_pr_addr(&con->peer_addr.in_addr));
2384 2377
2385 BUG_ON(con->state != CON_STATE_CONNECTING && 2378 WARN_ON(con->state != CON_STATE_CONNECTING &&
2386 con->state != CON_STATE_NEGOTIATING && 2379 con->state != CON_STATE_NEGOTIATING &&
2387 con->state != CON_STATE_OPEN); 2380 con->state != CON_STATE_OPEN);
2388 2381
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 780caf6b0491..eb9a44478764 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -1270,7 +1270,7 @@ static void reset_changed_osds(struct ceph_osd_client *osdc)
1270 * Requeue requests whose mapping to an OSD has changed. If requests map to 1270 * Requeue requests whose mapping to an OSD has changed. If requests map to
1271 * no osd, request a new map. 1271 * no osd, request a new map.
1272 * 1272 *
1273 * Caller should hold map_sem for read and request_mutex. 1273 * Caller should hold map_sem for read.
1274 */ 1274 */
1275static void kick_requests(struct ceph_osd_client *osdc, int force_resend) 1275static void kick_requests(struct ceph_osd_client *osdc, int force_resend)
1276{ 1276{
@@ -1284,6 +1284,24 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend)
1284 for (p = rb_first(&osdc->requests); p; ) { 1284 for (p = rb_first(&osdc->requests); p; ) {
1285 req = rb_entry(p, struct ceph_osd_request, r_node); 1285 req = rb_entry(p, struct ceph_osd_request, r_node);
1286 p = rb_next(p); 1286 p = rb_next(p);
1287
1288 /*
1289 * For linger requests that have not yet been
1290 * registered, move them to the linger list; they'll
1291 * be sent to the osd in the loop below. Unregister
1292 * the request before re-registering it as a linger
1293 * request to ensure the __map_request() below
1294 * will decide it needs to be sent.
1295 */
1296 if (req->r_linger && list_empty(&req->r_linger_item)) {
1297 dout("%p tid %llu restart on osd%d\n",
1298 req, req->r_tid,
1299 req->r_osd ? req->r_osd->o_osd : -1);
1300 __unregister_request(osdc, req);
1301 __register_linger_request(osdc, req);
1302 continue;
1303 }
1304
1287 err = __map_request(osdc, req, force_resend); 1305 err = __map_request(osdc, req, force_resend);
1288 if (err < 0) 1306 if (err < 0)
1289 continue; /* error */ 1307 continue; /* error */
@@ -1298,17 +1316,6 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend)
1298 req->r_flags |= CEPH_OSD_FLAG_RETRY; 1316 req->r_flags |= CEPH_OSD_FLAG_RETRY;
1299 } 1317 }
1300 } 1318 }
1301 if (req->r_linger && list_empty(&req->r_linger_item)) {
1302 /*
1303 * register as a linger so that we will
1304 * re-submit below and get a new tid
1305 */
1306 dout("%p tid %llu restart on osd%d\n",
1307 req, req->r_tid,
1308 req->r_osd ? req->r_osd->o_osd : -1);
1309 __register_linger_request(osdc, req);
1310 __unregister_request(osdc, req);
1311 }
1312 } 1319 }
1313 1320
1314 list_for_each_entry_safe(req, nreq, &osdc->req_linger, 1321 list_for_each_entry_safe(req, nreq, &osdc->req_linger,
@@ -1316,6 +1323,7 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend)
1316 dout("linger req=%p req->r_osd=%p\n", req, req->r_osd); 1323 dout("linger req=%p req->r_osd=%p\n", req, req->r_osd);
1317 1324
1318 err = __map_request(osdc, req, force_resend); 1325 err = __map_request(osdc, req, force_resend);
1326 dout("__map_request returned %d\n", err);
1319 if (err == 0) 1327 if (err == 0)
1320 continue; /* no change and no osd was specified */ 1328 continue; /* no change and no osd was specified */
1321 if (err < 0) 1329 if (err < 0)
@@ -1337,6 +1345,7 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend)
1337 dout("%d requests for down osds, need new map\n", needmap); 1345 dout("%d requests for down osds, need new map\n", needmap);
1338 ceph_monc_request_next_osdmap(&osdc->client->monc); 1346 ceph_monc_request_next_osdmap(&osdc->client->monc);
1339 } 1347 }
1348 reset_changed_osds(osdc);
1340} 1349}
1341 1350
1342 1351
@@ -1393,7 +1402,6 @@ void ceph_osdc_handle_map(struct ceph_osd_client *osdc, struct ceph_msg *msg)
1393 osdc->osdmap = newmap; 1402 osdc->osdmap = newmap;
1394 } 1403 }
1395 kick_requests(osdc, 0); 1404 kick_requests(osdc, 0);
1396 reset_changed_osds(osdc);
1397 } else { 1405 } else {
1398 dout("ignoring incremental map %u len %d\n", 1406 dout("ignoring incremental map %u len %d\n",
1399 epoch, maplen); 1407 epoch, maplen);
diff --git a/net/core/dev.c b/net/core/dev.c
index d0cbc93fcf32..f64e439b4a00 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -203,7 +203,7 @@ static struct list_head offload_base __read_mostly;
203DEFINE_RWLOCK(dev_base_lock); 203DEFINE_RWLOCK(dev_base_lock);
204EXPORT_SYMBOL(dev_base_lock); 204EXPORT_SYMBOL(dev_base_lock);
205 205
206DEFINE_SEQLOCK(devnet_rename_seq); 206seqcount_t devnet_rename_seq;
207 207
208static inline void dev_base_seq_inc(struct net *net) 208static inline void dev_base_seq_inc(struct net *net)
209{ 209{
@@ -1093,10 +1093,10 @@ int dev_change_name(struct net_device *dev, const char *newname)
1093 if (dev->flags & IFF_UP) 1093 if (dev->flags & IFF_UP)
1094 return -EBUSY; 1094 return -EBUSY;
1095 1095
1096 write_seqlock(&devnet_rename_seq); 1096 write_seqcount_begin(&devnet_rename_seq);
1097 1097
1098 if (strncmp(newname, dev->name, IFNAMSIZ) == 0) { 1098 if (strncmp(newname, dev->name, IFNAMSIZ) == 0) {
1099 write_sequnlock(&devnet_rename_seq); 1099 write_seqcount_end(&devnet_rename_seq);
1100 return 0; 1100 return 0;
1101 } 1101 }
1102 1102
@@ -1104,7 +1104,7 @@ int dev_change_name(struct net_device *dev, const char *newname)
1104 1104
1105 err = dev_get_valid_name(net, dev, newname); 1105 err = dev_get_valid_name(net, dev, newname);
1106 if (err < 0) { 1106 if (err < 0) {
1107 write_sequnlock(&devnet_rename_seq); 1107 write_seqcount_end(&devnet_rename_seq);
1108 return err; 1108 return err;
1109 } 1109 }
1110 1110
@@ -1112,11 +1112,11 @@ rollback:
1112 ret = device_rename(&dev->dev, dev->name); 1112 ret = device_rename(&dev->dev, dev->name);
1113 if (ret) { 1113 if (ret) {
1114 memcpy(dev->name, oldname, IFNAMSIZ); 1114 memcpy(dev->name, oldname, IFNAMSIZ);
1115 write_sequnlock(&devnet_rename_seq); 1115 write_seqcount_end(&devnet_rename_seq);
1116 return ret; 1116 return ret;
1117 } 1117 }
1118 1118
1119 write_sequnlock(&devnet_rename_seq); 1119 write_seqcount_end(&devnet_rename_seq);
1120 1120
1121 write_lock_bh(&dev_base_lock); 1121 write_lock_bh(&dev_base_lock);
1122 hlist_del_rcu(&dev->name_hlist); 1122 hlist_del_rcu(&dev->name_hlist);
@@ -1135,7 +1135,7 @@ rollback:
1135 /* err >= 0 after dev_alloc_name() or stores the first errno */ 1135 /* err >= 0 after dev_alloc_name() or stores the first errno */
1136 if (err >= 0) { 1136 if (err >= 0) {
1137 err = ret; 1137 err = ret;
1138 write_seqlock(&devnet_rename_seq); 1138 write_seqcount_begin(&devnet_rename_seq);
1139 memcpy(dev->name, oldname, IFNAMSIZ); 1139 memcpy(dev->name, oldname, IFNAMSIZ);
1140 goto rollback; 1140 goto rollback;
1141 } else { 1141 } else {
@@ -4180,7 +4180,7 @@ static int dev_ifname(struct net *net, struct ifreq __user *arg)
4180 return -EFAULT; 4180 return -EFAULT;
4181 4181
4182retry: 4182retry:
4183 seq = read_seqbegin(&devnet_rename_seq); 4183 seq = read_seqcount_begin(&devnet_rename_seq);
4184 rcu_read_lock(); 4184 rcu_read_lock();
4185 dev = dev_get_by_index_rcu(net, ifr.ifr_ifindex); 4185 dev = dev_get_by_index_rcu(net, ifr.ifr_ifindex);
4186 if (!dev) { 4186 if (!dev) {
@@ -4190,7 +4190,7 @@ retry:
4190 4190
4191 strcpy(ifr.ifr_name, dev->name); 4191 strcpy(ifr.ifr_name, dev->name);
4192 rcu_read_unlock(); 4192 rcu_read_unlock();
4193 if (read_seqretry(&devnet_rename_seq, seq)) 4193 if (read_seqcount_retry(&devnet_rename_seq, seq))
4194 goto retry; 4194 goto retry;
4195 4195
4196 if (copy_to_user(arg, &ifr, sizeof(struct ifreq))) 4196 if (copy_to_user(arg, &ifr, sizeof(struct ifreq)))
@@ -6121,6 +6121,14 @@ struct netdev_queue *dev_ingress_queue_create(struct net_device *dev)
6121 6121
6122static const struct ethtool_ops default_ethtool_ops; 6122static const struct ethtool_ops default_ethtool_ops;
6123 6123
6124void netdev_set_default_ethtool_ops(struct net_device *dev,
6125 const struct ethtool_ops *ops)
6126{
6127 if (dev->ethtool_ops == &default_ethtool_ops)
6128 dev->ethtool_ops = ops;
6129}
6130EXPORT_SYMBOL_GPL(netdev_set_default_ethtool_ops);
6131
6124/** 6132/**
6125 * alloc_netdev_mqs - allocate network device 6133 * alloc_netdev_mqs - allocate network device
6126 * @sizeof_priv: size of private data to allocate space for 6134 * @sizeof_priv: size of private data to allocate space for
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 334efd5d67a9..28c5f5aa7ca7 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -1334,7 +1334,6 @@ struct kobj_ns_type_operations net_ns_type_operations = {
1334}; 1334};
1335EXPORT_SYMBOL_GPL(net_ns_type_operations); 1335EXPORT_SYMBOL_GPL(net_ns_type_operations);
1336 1336
1337#ifdef CONFIG_HOTPLUG
1338static int netdev_uevent(struct device *d, struct kobj_uevent_env *env) 1337static int netdev_uevent(struct device *d, struct kobj_uevent_env *env)
1339{ 1338{
1340 struct net_device *dev = to_net_dev(d); 1339 struct net_device *dev = to_net_dev(d);
@@ -1353,7 +1352,6 @@ static int netdev_uevent(struct device *d, struct kobj_uevent_env *env)
1353exit: 1352exit:
1354 return retval; 1353 return retval;
1355} 1354}
1356#endif
1357 1355
1358/* 1356/*
1359 * netdev_release -- destroy and free a dead device. 1357 * netdev_release -- destroy and free a dead device.
@@ -1382,9 +1380,7 @@ static struct class net_class = {
1382#ifdef CONFIG_SYSFS 1380#ifdef CONFIG_SYSFS
1383 .dev_attrs = net_class_attributes, 1381 .dev_attrs = net_class_attributes,
1384#endif /* CONFIG_SYSFS */ 1382#endif /* CONFIG_SYSFS */
1385#ifdef CONFIG_HOTPLUG
1386 .dev_uevent = netdev_uevent, 1383 .dev_uevent = netdev_uevent,
1387#endif
1388 .ns_type = &net_ns_type_operations, 1384 .ns_type = &net_ns_type_operations,
1389 .namespace = net_namespace, 1385 .namespace = net_namespace,
1390}; 1386};
diff --git a/net/core/request_sock.c b/net/core/request_sock.c
index c31d9e8668c3..4425148d2b51 100644
--- a/net/core/request_sock.c
+++ b/net/core/request_sock.c
@@ -186,8 +186,6 @@ void reqsk_fastopen_remove(struct sock *sk, struct request_sock *req,
186 struct fastopen_queue *fastopenq = 186 struct fastopen_queue *fastopenq =
187 inet_csk(lsk)->icsk_accept_queue.fastopenq; 187 inet_csk(lsk)->icsk_accept_queue.fastopenq;
188 188
189 BUG_ON(!spin_is_locked(&sk->sk_lock.slock) && !sock_owned_by_user(sk));
190
191 tcp_sk(sk)->fastopen_rsk = NULL; 189 tcp_sk(sk)->fastopen_rsk = NULL;
192 spin_lock_bh(&fastopenq->lock); 190 spin_lock_bh(&fastopenq->lock);
193 fastopenq->qlen--; 191 fastopenq->qlen--;
diff --git a/net/core/scm.c b/net/core/scm.c
index 57fb1ee6649f..905dcc6ad1e3 100644
--- a/net/core/scm.c
+++ b/net/core/scm.c
@@ -35,6 +35,7 @@
35#include <net/sock.h> 35#include <net/sock.h>
36#include <net/compat.h> 36#include <net/compat.h>
37#include <net/scm.h> 37#include <net/scm.h>
38#include <net/cls_cgroup.h>
38 39
39 40
40/* 41/*
@@ -302,8 +303,10 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm)
302 } 303 }
303 /* Bump the usage count and install the file. */ 304 /* Bump the usage count and install the file. */
304 sock = sock_from_file(fp[i], &err); 305 sock = sock_from_file(fp[i], &err);
305 if (sock) 306 if (sock) {
306 sock_update_netprioidx(sock->sk, current); 307 sock_update_netprioidx(sock->sk, current);
308 sock_update_classid(sock->sk, current);
309 }
307 fd_install(new_fd, get_file(fp[i])); 310 fd_install(new_fd, get_file(fp[i]));
308 } 311 }
309 312
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 3ab989b0de42..a9a2ae3e2213 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1649,7 +1649,7 @@ static void sock_spd_release(struct splice_pipe_desc *spd, unsigned int i)
1649 1649
1650static struct page *linear_to_page(struct page *page, unsigned int *len, 1650static struct page *linear_to_page(struct page *page, unsigned int *len,
1651 unsigned int *offset, 1651 unsigned int *offset,
1652 struct sk_buff *skb, struct sock *sk) 1652 struct sock *sk)
1653{ 1653{
1654 struct page_frag *pfrag = sk_page_frag(sk); 1654 struct page_frag *pfrag = sk_page_frag(sk);
1655 1655
@@ -1682,14 +1682,14 @@ static bool spd_can_coalesce(const struct splice_pipe_desc *spd,
1682static bool spd_fill_page(struct splice_pipe_desc *spd, 1682static bool spd_fill_page(struct splice_pipe_desc *spd,
1683 struct pipe_inode_info *pipe, struct page *page, 1683 struct pipe_inode_info *pipe, struct page *page,
1684 unsigned int *len, unsigned int offset, 1684 unsigned int *len, unsigned int offset,
1685 struct sk_buff *skb, bool linear, 1685 bool linear,
1686 struct sock *sk) 1686 struct sock *sk)
1687{ 1687{
1688 if (unlikely(spd->nr_pages == MAX_SKB_FRAGS)) 1688 if (unlikely(spd->nr_pages == MAX_SKB_FRAGS))
1689 return true; 1689 return true;
1690 1690
1691 if (linear) { 1691 if (linear) {
1692 page = linear_to_page(page, len, &offset, skb, sk); 1692 page = linear_to_page(page, len, &offset, sk);
1693 if (!page) 1693 if (!page)
1694 return true; 1694 return true;
1695 } 1695 }
@@ -1706,23 +1706,9 @@ static bool spd_fill_page(struct splice_pipe_desc *spd,
1706 return false; 1706 return false;
1707} 1707}
1708 1708
1709static inline void __segment_seek(struct page **page, unsigned int *poff,
1710 unsigned int *plen, unsigned int off)
1711{
1712 unsigned long n;
1713
1714 *poff += off;
1715 n = *poff / PAGE_SIZE;
1716 if (n)
1717 *page = nth_page(*page, n);
1718
1719 *poff = *poff % PAGE_SIZE;
1720 *plen -= off;
1721}
1722
1723static bool __splice_segment(struct page *page, unsigned int poff, 1709static bool __splice_segment(struct page *page, unsigned int poff,
1724 unsigned int plen, unsigned int *off, 1710 unsigned int plen, unsigned int *off,
1725 unsigned int *len, struct sk_buff *skb, 1711 unsigned int *len,
1726 struct splice_pipe_desc *spd, bool linear, 1712 struct splice_pipe_desc *spd, bool linear,
1727 struct sock *sk, 1713 struct sock *sk,
1728 struct pipe_inode_info *pipe) 1714 struct pipe_inode_info *pipe)
@@ -1737,23 +1723,19 @@ static bool __splice_segment(struct page *page, unsigned int poff,
1737 } 1723 }
1738 1724
1739 /* ignore any bits we already processed */ 1725 /* ignore any bits we already processed */
1740 if (*off) { 1726 poff += *off;
1741 __segment_seek(&page, &poff, &plen, *off); 1727 plen -= *off;
1742 *off = 0; 1728 *off = 0;
1743 }
1744 1729
1745 do { 1730 do {
1746 unsigned int flen = min(*len, plen); 1731 unsigned int flen = min(*len, plen);
1747 1732
1748 /* the linear region may spread across several pages */ 1733 if (spd_fill_page(spd, pipe, page, &flen, poff,
1749 flen = min_t(unsigned int, flen, PAGE_SIZE - poff); 1734 linear, sk))
1750
1751 if (spd_fill_page(spd, pipe, page, &flen, poff, skb, linear, sk))
1752 return true; 1735 return true;
1753 1736 poff += flen;
1754 __segment_seek(&page, &poff, &plen, flen); 1737 plen -= flen;
1755 *len -= flen; 1738 *len -= flen;
1756
1757 } while (*len && plen); 1739 } while (*len && plen);
1758 1740
1759 return false; 1741 return false;
@@ -1777,7 +1759,7 @@ static bool __skb_splice_bits(struct sk_buff *skb, struct pipe_inode_info *pipe,
1777 if (__splice_segment(virt_to_page(skb->data), 1759 if (__splice_segment(virt_to_page(skb->data),
1778 (unsigned long) skb->data & (PAGE_SIZE - 1), 1760 (unsigned long) skb->data & (PAGE_SIZE - 1),
1779 skb_headlen(skb), 1761 skb_headlen(skb),
1780 offset, len, skb, spd, 1762 offset, len, spd,
1781 skb_head_is_locked(skb), 1763 skb_head_is_locked(skb),
1782 sk, pipe)) 1764 sk, pipe))
1783 return true; 1765 return true;
@@ -1790,7 +1772,7 @@ static bool __skb_splice_bits(struct sk_buff *skb, struct pipe_inode_info *pipe,
1790 1772
1791 if (__splice_segment(skb_frag_page(f), 1773 if (__splice_segment(skb_frag_page(f),
1792 f->page_offset, skb_frag_size(f), 1774 f->page_offset, skb_frag_size(f),
1793 offset, len, skb, spd, false, sk, pipe)) 1775 offset, len, spd, false, sk, pipe))
1794 return true; 1776 return true;
1795 } 1777 }
1796 1778
diff --git a/net/core/sock.c b/net/core/sock.c
index a692ef49c9bb..bc131d419683 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -583,7 +583,7 @@ static int sock_getbindtodevice(struct sock *sk, char __user *optval,
583 goto out; 583 goto out;
584 584
585retry: 585retry:
586 seq = read_seqbegin(&devnet_rename_seq); 586 seq = read_seqcount_begin(&devnet_rename_seq);
587 rcu_read_lock(); 587 rcu_read_lock();
588 dev = dev_get_by_index_rcu(net, sk->sk_bound_dev_if); 588 dev = dev_get_by_index_rcu(net, sk->sk_bound_dev_if);
589 ret = -ENODEV; 589 ret = -ENODEV;
@@ -594,7 +594,7 @@ retry:
594 594
595 strcpy(devname, dev->name); 595 strcpy(devname, dev->name);
596 rcu_read_unlock(); 596 rcu_read_unlock();
597 if (read_seqretry(&devnet_rename_seq, seq)) 597 if (read_seqcount_retry(&devnet_rename_seq, seq))
598 goto retry; 598 goto retry;
599 599
600 len = strlen(devname) + 1; 600 len = strlen(devname) + 1;
diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c
index a0d8392491c3..a69b4e4a02b5 100644
--- a/net/ipv4/ah4.c
+++ b/net/ipv4/ah4.c
@@ -269,7 +269,11 @@ static void ah_input_done(struct crypto_async_request *base, int err)
269 skb->network_header += ah_hlen; 269 skb->network_header += ah_hlen;
270 memcpy(skb_network_header(skb), work_iph, ihl); 270 memcpy(skb_network_header(skb), work_iph, ihl);
271 __skb_pull(skb, ah_hlen + ihl); 271 __skb_pull(skb, ah_hlen + ihl);
272 skb_set_transport_header(skb, -ihl); 272
273 if (x->props.mode == XFRM_MODE_TUNNEL)
274 skb_reset_transport_header(skb);
275 else
276 skb_set_transport_header(skb, -ihl);
273out: 277out:
274 kfree(AH_SKB_CB(skb)->tmp); 278 kfree(AH_SKB_CB(skb)->tmp);
275 xfrm_input_resume(skb, err); 279 xfrm_input_resume(skb, err);
@@ -381,7 +385,10 @@ static int ah_input(struct xfrm_state *x, struct sk_buff *skb)
381 skb->network_header += ah_hlen; 385 skb->network_header += ah_hlen;
382 memcpy(skb_network_header(skb), work_iph, ihl); 386 memcpy(skb_network_header(skb), work_iph, ihl);
383 __skb_pull(skb, ah_hlen + ihl); 387 __skb_pull(skb, ah_hlen + ihl);
384 skb_set_transport_header(skb, -ihl); 388 if (x->props.mode == XFRM_MODE_TUNNEL)
389 skb_reset_transport_header(skb);
390 else
391 skb_set_transport_header(skb, -ihl);
385 392
386 err = nexthdr; 393 err = nexthdr;
387 394
@@ -413,9 +420,12 @@ static void ah4_err(struct sk_buff *skb, u32 info)
413 if (!x) 420 if (!x)
414 return; 421 return;
415 422
416 if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) 423 if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) {
424 atomic_inc(&flow_cache_genid);
425 rt_genid_bump(net);
426
417 ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_AH, 0); 427 ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_AH, 0);
418 else 428 } else
419 ipv4_redirect(skb, net, 0, 0, IPPROTO_AH, 0); 429 ipv4_redirect(skb, net, 0, 0, IPPROTO_AH, 0);
420 xfrm_state_put(x); 430 xfrm_state_put(x);
421} 431}
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index ce6fbdfd40b8..9547a273b9e9 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -321,7 +321,7 @@ static void arp_error_report(struct neighbour *neigh, struct sk_buff *skb)
321static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb) 321static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
322{ 322{
323 __be32 saddr = 0; 323 __be32 saddr = 0;
324 u8 *dst_ha = NULL; 324 u8 dst_ha[MAX_ADDR_LEN], *dst_hw = NULL;
325 struct net_device *dev = neigh->dev; 325 struct net_device *dev = neigh->dev;
326 __be32 target = *(__be32 *)neigh->primary_key; 326 __be32 target = *(__be32 *)neigh->primary_key;
327 int probes = atomic_read(&neigh->probes); 327 int probes = atomic_read(&neigh->probes);
@@ -363,8 +363,8 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
363 if (probes < 0) { 363 if (probes < 0) {
364 if (!(neigh->nud_state & NUD_VALID)) 364 if (!(neigh->nud_state & NUD_VALID))
365 pr_debug("trying to ucast probe in NUD_INVALID\n"); 365 pr_debug("trying to ucast probe in NUD_INVALID\n");
366 dst_ha = neigh->ha; 366 neigh_ha_snapshot(dst_ha, neigh, dev);
367 read_lock_bh(&neigh->lock); 367 dst_hw = dst_ha;
368 } else { 368 } else {
369 probes -= neigh->parms->app_probes; 369 probes -= neigh->parms->app_probes;
370 if (probes < 0) { 370 if (probes < 0) {
@@ -376,9 +376,7 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
376 } 376 }
377 377
378 arp_send(ARPOP_REQUEST, ETH_P_ARP, target, dev, saddr, 378 arp_send(ARPOP_REQUEST, ETH_P_ARP, target, dev, saddr,
379 dst_ha, dev->dev_addr, NULL); 379 dst_hw, dev->dev_addr, NULL);
380 if (dst_ha)
381 read_unlock_bh(&neigh->lock);
382} 380}
383 381
384static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip) 382static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip)
diff --git a/net/ipv4/datagram.c b/net/ipv4/datagram.c
index 424fafbc8cb0..b28e863fe0a7 100644
--- a/net/ipv4/datagram.c
+++ b/net/ipv4/datagram.c
@@ -85,3 +85,28 @@ out:
85 return err; 85 return err;
86} 86}
87EXPORT_SYMBOL(ip4_datagram_connect); 87EXPORT_SYMBOL(ip4_datagram_connect);
88
89void ip4_datagram_release_cb(struct sock *sk)
90{
91 const struct inet_sock *inet = inet_sk(sk);
92 const struct ip_options_rcu *inet_opt;
93 __be32 daddr = inet->inet_daddr;
94 struct flowi4 fl4;
95 struct rtable *rt;
96
97 if (! __sk_dst_get(sk) || __sk_dst_check(sk, 0))
98 return;
99
100 rcu_read_lock();
101 inet_opt = rcu_dereference(inet->inet_opt);
102 if (inet_opt && inet_opt->opt.srr)
103 daddr = inet_opt->opt.faddr;
104 rt = ip_route_output_ports(sock_net(sk), &fl4, sk, daddr,
105 inet->inet_saddr, inet->inet_dport,
106 inet->inet_sport, sk->sk_protocol,
107 RT_CONN_FLAGS(sk), sk->sk_bound_dev_if);
108 if (!IS_ERR(rt))
109 __sk_dst_set(sk, &rt->dst);
110 rcu_read_unlock();
111}
112EXPORT_SYMBOL_GPL(ip4_datagram_release_cb);
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index cc06a47f1216..a8e4f2665d5e 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -823,9 +823,9 @@ int devinet_ioctl(struct net *net, unsigned int cmd, void __user *arg)
823 if (!ifa) { 823 if (!ifa) {
824 ret = -ENOBUFS; 824 ret = -ENOBUFS;
825 ifa = inet_alloc_ifa(); 825 ifa = inet_alloc_ifa();
826 INIT_HLIST_NODE(&ifa->hash);
827 if (!ifa) 826 if (!ifa)
828 break; 827 break;
828 INIT_HLIST_NODE(&ifa->hash);
829 if (colon) 829 if (colon)
830 memcpy(ifa->ifa_label, ifr.ifr_name, IFNAMSIZ); 830 memcpy(ifa->ifa_label, ifr.ifr_name, IFNAMSIZ);
831 else 831 else
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index b61e9deb7c7e..3b4f0cd2e63e 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -346,7 +346,10 @@ static int esp_input_done2(struct sk_buff *skb, int err)
346 346
347 pskb_trim(skb, skb->len - alen - padlen - 2); 347 pskb_trim(skb, skb->len - alen - padlen - 2);
348 __skb_pull(skb, hlen); 348 __skb_pull(skb, hlen);
349 skb_set_transport_header(skb, -ihl); 349 if (x->props.mode == XFRM_MODE_TUNNEL)
350 skb_reset_transport_header(skb);
351 else
352 skb_set_transport_header(skb, -ihl);
350 353
351 err = nexthdr[1]; 354 err = nexthdr[1];
352 355
@@ -499,9 +502,12 @@ static void esp4_err(struct sk_buff *skb, u32 info)
499 if (!x) 502 if (!x)
500 return; 503 return;
501 504
502 if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) 505 if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) {
506 atomic_inc(&flow_cache_genid);
507 rt_genid_bump(net);
508
503 ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_ESP, 0); 509 ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_ESP, 0);
504 else 510 } else
505 ipv4_redirect(skb, net, 0, 0, IPPROTO_ESP, 0); 511 ipv4_redirect(skb, net, 0, 0, IPPROTO_ESP, 0);
506 xfrm_state_put(x); 512 xfrm_state_put(x);
507} 513}
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index a85ae2f7a21c..e81b1caf2ea2 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -750,6 +750,7 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
750 int gre_hlen; 750 int gre_hlen;
751 __be32 dst; 751 __be32 dst;
752 int mtu; 752 int mtu;
753 u8 ttl;
753 754
754 if (skb->ip_summed == CHECKSUM_PARTIAL && 755 if (skb->ip_summed == CHECKSUM_PARTIAL &&
755 skb_checksum_help(skb)) 756 skb_checksum_help(skb))
@@ -760,7 +761,10 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
760 761
761 if (dev->header_ops && dev->type == ARPHRD_IPGRE) { 762 if (dev->header_ops && dev->type == ARPHRD_IPGRE) {
762 gre_hlen = 0; 763 gre_hlen = 0;
763 tiph = (const struct iphdr *)skb->data; 764 if (skb->protocol == htons(ETH_P_IP))
765 tiph = (const struct iphdr *)skb->data;
766 else
767 tiph = &tunnel->parms.iph;
764 } else { 768 } else {
765 gre_hlen = tunnel->hlen; 769 gre_hlen = tunnel->hlen;
766 tiph = &tunnel->parms.iph; 770 tiph = &tunnel->parms.iph;
@@ -812,6 +816,7 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
812 goto tx_error; 816 goto tx_error;
813 } 817 }
814 818
819 ttl = tiph->ttl;
815 tos = tiph->tos; 820 tos = tiph->tos;
816 if (tos == 1) { 821 if (tos == 1) {
817 tos = 0; 822 tos = 0;
@@ -904,11 +909,12 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
904 dev_kfree_skb(skb); 909 dev_kfree_skb(skb);
905 skb = new_skb; 910 skb = new_skb;
906 old_iph = ip_hdr(skb); 911 old_iph = ip_hdr(skb);
912 /* Warning : tiph value might point to freed memory */
907 } 913 }
908 914
909 skb_reset_transport_header(skb);
910 skb_push(skb, gre_hlen); 915 skb_push(skb, gre_hlen);
911 skb_reset_network_header(skb); 916 skb_reset_network_header(skb);
917 skb_set_transport_header(skb, sizeof(*iph));
912 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); 918 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
913 IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED | 919 IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED |
914 IPSKB_REROUTED); 920 IPSKB_REROUTED);
@@ -927,8 +933,9 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
927 iph->tos = ipgre_ecn_encapsulate(tos, old_iph, skb); 933 iph->tos = ipgre_ecn_encapsulate(tos, old_iph, skb);
928 iph->daddr = fl4.daddr; 934 iph->daddr = fl4.daddr;
929 iph->saddr = fl4.saddr; 935 iph->saddr = fl4.saddr;
936 iph->ttl = ttl;
930 937
931 if ((iph->ttl = tiph->ttl) == 0) { 938 if (ttl == 0) {
932 if (skb->protocol == htons(ETH_P_IP)) 939 if (skb->protocol == htons(ETH_P_IP))
933 iph->ttl = old_iph->ttl; 940 iph->ttl = old_iph->ttl;
934#if IS_ENABLED(CONFIG_IPV6) 941#if IS_ENABLED(CONFIG_IPV6)
@@ -956,8 +963,12 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
956 ptr--; 963 ptr--;
957 } 964 }
958 if (tunnel->parms.o_flags&GRE_CSUM) { 965 if (tunnel->parms.o_flags&GRE_CSUM) {
966 int offset = skb_transport_offset(skb);
967
959 *ptr = 0; 968 *ptr = 0;
960 *(__sum16 *)ptr = ip_compute_csum((void *)(iph+1), skb->len - sizeof(struct iphdr)); 969 *(__sum16 *)ptr = csum_fold(skb_checksum(skb, offset,
970 skb->len - offset,
971 0));
961 } 972 }
962 } 973 }
963 974
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 3c9d20880283..d9c4f113d709 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -590,7 +590,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
590 case IP_TTL: 590 case IP_TTL:
591 if (optlen < 1) 591 if (optlen < 1)
592 goto e_inval; 592 goto e_inval;
593 if (val != -1 && (val < 0 || val > 255)) 593 if (val != -1 && (val < 1 || val > 255))
594 goto e_inval; 594 goto e_inval;
595 inet->uc_ttl = val; 595 inet->uc_ttl = val;
596 break; 596 break;
diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c
index d3ab47e19a89..9a46daed2f3c 100644
--- a/net/ipv4/ipcomp.c
+++ b/net/ipv4/ipcomp.c
@@ -47,9 +47,12 @@ static void ipcomp4_err(struct sk_buff *skb, u32 info)
47 if (!x) 47 if (!x)
48 return; 48 return;
49 49
50 if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) 50 if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) {
51 atomic_inc(&flow_cache_genid);
52 rt_genid_bump(net);
53
51 ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_COMP, 0); 54 ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_COMP, 0);
52 else 55 } else
53 ipv4_redirect(skb, net, 0, 0, IPPROTO_COMP, 0); 56 ipv4_redirect(skb, net, 0, 0, IPPROTO_COMP, 0);
54 xfrm_state_put(x); 57 xfrm_state_put(x);
55} 58}
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index d763701cff1b..a2e50ae80b53 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -136,6 +136,8 @@ __be32 ic_myaddr = NONE; /* My IP address */
136static __be32 ic_netmask = NONE; /* Netmask for local subnet */ 136static __be32 ic_netmask = NONE; /* Netmask for local subnet */
137__be32 ic_gateway = NONE; /* Gateway IP address */ 137__be32 ic_gateway = NONE; /* Gateway IP address */
138 138
139__be32 ic_addrservaddr = NONE; /* IP Address of the IP addresses'server */
140
139__be32 ic_servaddr = NONE; /* Boot server IP address */ 141__be32 ic_servaddr = NONE; /* Boot server IP address */
140 142
141__be32 root_server_addr = NONE; /* Address of NFS server */ 143__be32 root_server_addr = NONE; /* Address of NFS server */
@@ -558,6 +560,7 @@ ic_rarp_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
558 if (ic_myaddr == NONE) 560 if (ic_myaddr == NONE)
559 ic_myaddr = tip; 561 ic_myaddr = tip;
560 ic_servaddr = sip; 562 ic_servaddr = sip;
563 ic_addrservaddr = sip;
561 ic_got_reply = IC_RARP; 564 ic_got_reply = IC_RARP;
562 565
563drop_unlock: 566drop_unlock:
@@ -1068,7 +1071,7 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str
1068 ic_servaddr = server_id; 1071 ic_servaddr = server_id;
1069#ifdef IPCONFIG_DEBUG 1072#ifdef IPCONFIG_DEBUG
1070 printk("DHCP: Offered address %pI4 by server %pI4\n", 1073 printk("DHCP: Offered address %pI4 by server %pI4\n",
1071 &ic_myaddr, &ic_servaddr); 1074 &ic_myaddr, &b->iph.saddr);
1072#endif 1075#endif
1073 /* The DHCP indicated server address takes 1076 /* The DHCP indicated server address takes
1074 * precedence over the bootp header one if 1077 * precedence over the bootp header one if
@@ -1113,6 +1116,7 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str
1113 ic_dev = dev; 1116 ic_dev = dev;
1114 ic_myaddr = b->your_ip; 1117 ic_myaddr = b->your_ip;
1115 ic_servaddr = b->server_ip; 1118 ic_servaddr = b->server_ip;
1119 ic_addrservaddr = b->iph.saddr;
1116 if (ic_gateway == NONE && b->relay_ip) 1120 if (ic_gateway == NONE && b->relay_ip)
1117 ic_gateway = b->relay_ip; 1121 ic_gateway = b->relay_ip;
1118 if (ic_nameservers[0] == NONE) 1122 if (ic_nameservers[0] == NONE)
@@ -1268,7 +1272,7 @@ static int __init ic_dynamic(void)
1268 printk("IP-Config: Got %s answer from %pI4, ", 1272 printk("IP-Config: Got %s answer from %pI4, ",
1269 ((ic_got_reply & IC_RARP) ? "RARP" 1273 ((ic_got_reply & IC_RARP) ? "RARP"
1270 : (ic_proto_enabled & IC_USE_DHCP) ? "DHCP" : "BOOTP"), 1274 : (ic_proto_enabled & IC_USE_DHCP) ? "DHCP" : "BOOTP"),
1271 &ic_servaddr); 1275 &ic_addrservaddr);
1272 pr_cont("my address is %pI4\n", &ic_myaddr); 1276 pr_cont("my address is %pI4\n", &ic_myaddr);
1273 1277
1274 return 0; 1278 return 0;
diff --git a/net/ipv4/netfilter/ipt_REJECT.c b/net/ipv4/netfilter/ipt_REJECT.c
index 51f13f8ec724..04b18c1ac345 100644
--- a/net/ipv4/netfilter/ipt_REJECT.c
+++ b/net/ipv4/netfilter/ipt_REJECT.c
@@ -81,6 +81,7 @@ static void send_reset(struct sk_buff *oldskb, int hook)
81 niph->saddr = oiph->daddr; 81 niph->saddr = oiph->daddr;
82 niph->daddr = oiph->saddr; 82 niph->daddr = oiph->saddr;
83 83
84 skb_reset_transport_header(nskb);
84 tcph = (struct tcphdr *)skb_put(nskb, sizeof(struct tcphdr)); 85 tcph = (struct tcphdr *)skb_put(nskb, sizeof(struct tcphdr));
85 memset(tcph, 0, sizeof(*tcph)); 86 memset(tcph, 0, sizeof(*tcph));
86 tcph->source = oth->dest; 87 tcph->source = oth->dest;
diff --git a/net/ipv4/netfilter/iptable_nat.c b/net/ipv4/netfilter/iptable_nat.c
index da2c8a368f68..eeaff7e4acb5 100644
--- a/net/ipv4/netfilter/iptable_nat.c
+++ b/net/ipv4/netfilter/iptable_nat.c
@@ -124,23 +124,28 @@ nf_nat_ipv4_fn(unsigned int hooknum,
124 ret = nf_nat_rule_find(skb, hooknum, in, out, ct); 124 ret = nf_nat_rule_find(skb, hooknum, in, out, ct);
125 if (ret != NF_ACCEPT) 125 if (ret != NF_ACCEPT)
126 return ret; 126 return ret;
127 } else 127 } else {
128 pr_debug("Already setup manip %s for ct %p\n", 128 pr_debug("Already setup manip %s for ct %p\n",
129 maniptype == NF_NAT_MANIP_SRC ? "SRC" : "DST", 129 maniptype == NF_NAT_MANIP_SRC ? "SRC" : "DST",
130 ct); 130 ct);
131 if (nf_nat_oif_changed(hooknum, ctinfo, nat, out))
132 goto oif_changed;
133 }
131 break; 134 break;
132 135
133 default: 136 default:
134 /* ESTABLISHED */ 137 /* ESTABLISHED */
135 NF_CT_ASSERT(ctinfo == IP_CT_ESTABLISHED || 138 NF_CT_ASSERT(ctinfo == IP_CT_ESTABLISHED ||
136 ctinfo == IP_CT_ESTABLISHED_REPLY); 139 ctinfo == IP_CT_ESTABLISHED_REPLY);
137 if (nf_nat_oif_changed(hooknum, ctinfo, nat, out)) { 140 if (nf_nat_oif_changed(hooknum, ctinfo, nat, out))
138 nf_ct_kill_acct(ct, ctinfo, skb); 141 goto oif_changed;
139 return NF_DROP;
140 }
141 } 142 }
142 143
143 return nf_nat_packet(ct, ctinfo, hooknum, skb); 144 return nf_nat_packet(ct, ctinfo, hooknum, skb);
145
146oif_changed:
147 nf_ct_kill_acct(ct, ctinfo, skb);
148 return NF_DROP;
144} 149}
145 150
146static unsigned int 151static unsigned int
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index 8f3d05424a3e..6f9c07268cf6 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -738,6 +738,7 @@ struct proto ping_prot = {
738 .recvmsg = ping_recvmsg, 738 .recvmsg = ping_recvmsg,
739 .bind = ping_bind, 739 .bind = ping_bind,
740 .backlog_rcv = ping_queue_rcv_skb, 740 .backlog_rcv = ping_queue_rcv_skb,
741 .release_cb = ip4_datagram_release_cb,
741 .hash = ping_v4_hash, 742 .hash = ping_v4_hash,
742 .unhash = ping_v4_unhash, 743 .unhash = ping_v4_unhash,
743 .get_port = ping_v4_get_port, 744 .get_port = ping_v4_get_port,
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 73d1e4df4bf6..6f08991409c3 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -894,6 +894,7 @@ struct proto raw_prot = {
894 .recvmsg = raw_recvmsg, 894 .recvmsg = raw_recvmsg,
895 .bind = raw_bind, 895 .bind = raw_bind,
896 .backlog_rcv = raw_rcv_skb, 896 .backlog_rcv = raw_rcv_skb,
897 .release_cb = ip4_datagram_release_cb,
897 .hash = raw_hash_sk, 898 .hash = raw_hash_sk,
898 .unhash = raw_unhash_sk, 899 .unhash = raw_unhash_sk,
899 .obj_size = sizeof(struct raw_sock), 900 .obj_size = sizeof(struct raw_sock),
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 844a9ef60dbd..a0fcc47fee73 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -912,6 +912,9 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)
912 struct dst_entry *dst = &rt->dst; 912 struct dst_entry *dst = &rt->dst;
913 struct fib_result res; 913 struct fib_result res;
914 914
915 if (dst_metric_locked(dst, RTAX_MTU))
916 return;
917
915 if (dst->dev->mtu < mtu) 918 if (dst->dev->mtu < mtu)
916 return; 919 return;
917 920
@@ -962,7 +965,7 @@ void ipv4_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu,
962} 965}
963EXPORT_SYMBOL_GPL(ipv4_update_pmtu); 966EXPORT_SYMBOL_GPL(ipv4_update_pmtu);
964 967
965void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu) 968static void __ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu)
966{ 969{
967 const struct iphdr *iph = (const struct iphdr *) skb->data; 970 const struct iphdr *iph = (const struct iphdr *) skb->data;
968 struct flowi4 fl4; 971 struct flowi4 fl4;
@@ -975,6 +978,53 @@ void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu)
975 ip_rt_put(rt); 978 ip_rt_put(rt);
976 } 979 }
977} 980}
981
982void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu)
983{
984 const struct iphdr *iph = (const struct iphdr *) skb->data;
985 struct flowi4 fl4;
986 struct rtable *rt;
987 struct dst_entry *dst;
988 bool new = false;
989
990 bh_lock_sock(sk);
991 rt = (struct rtable *) __sk_dst_get(sk);
992
993 if (sock_owned_by_user(sk) || !rt) {
994 __ipv4_sk_update_pmtu(skb, sk, mtu);
995 goto out;
996 }
997
998 __build_flow_key(&fl4, sk, iph, 0, 0, 0, 0, 0);
999
1000 if (!__sk_dst_check(sk, 0)) {
1001 rt = ip_route_output_flow(sock_net(sk), &fl4, sk);
1002 if (IS_ERR(rt))
1003 goto out;
1004
1005 new = true;
1006 }
1007
1008 __ip_rt_update_pmtu((struct rtable *) rt->dst.path, &fl4, mtu);
1009
1010 dst = dst_check(&rt->dst, 0);
1011 if (!dst) {
1012 if (new)
1013 dst_release(&rt->dst);
1014
1015 rt = ip_route_output_flow(sock_net(sk), &fl4, sk);
1016 if (IS_ERR(rt))
1017 goto out;
1018
1019 new = true;
1020 }
1021
1022 if (new)
1023 __sk_dst_set(sk, &rt->dst);
1024
1025out:
1026 bh_unlock_sock(sk);
1027}
978EXPORT_SYMBOL_GPL(ipv4_sk_update_pmtu); 1028EXPORT_SYMBOL_GPL(ipv4_sk_update_pmtu);
979 1029
980void ipv4_redirect(struct sk_buff *skb, struct net *net, 1030void ipv4_redirect(struct sk_buff *skb, struct net *net,
@@ -1120,7 +1170,7 @@ static unsigned int ipv4_mtu(const struct dst_entry *dst)
1120 if (!mtu || time_after_eq(jiffies, rt->dst.expires)) 1170 if (!mtu || time_after_eq(jiffies, rt->dst.expires))
1121 mtu = dst_metric_raw(dst, RTAX_MTU); 1171 mtu = dst_metric_raw(dst, RTAX_MTU);
1122 1172
1123 if (mtu && rt_is_output_route(rt)) 1173 if (mtu)
1124 return mtu; 1174 return mtu;
1125 1175
1126 mtu = dst->dev->mtu; 1176 mtu = dst->dev->mtu;
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 1ca253635f7a..2aa69c8ae60c 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1428,12 +1428,12 @@ static void tcp_service_net_dma(struct sock *sk, bool wait)
1428} 1428}
1429#endif 1429#endif
1430 1430
1431static inline struct sk_buff *tcp_recv_skb(struct sock *sk, u32 seq, u32 *off) 1431static struct sk_buff *tcp_recv_skb(struct sock *sk, u32 seq, u32 *off)
1432{ 1432{
1433 struct sk_buff *skb; 1433 struct sk_buff *skb;
1434 u32 offset; 1434 u32 offset;
1435 1435
1436 skb_queue_walk(&sk->sk_receive_queue, skb) { 1436 while ((skb = skb_peek(&sk->sk_receive_queue)) != NULL) {
1437 offset = seq - TCP_SKB_CB(skb)->seq; 1437 offset = seq - TCP_SKB_CB(skb)->seq;
1438 if (tcp_hdr(skb)->syn) 1438 if (tcp_hdr(skb)->syn)
1439 offset--; 1439 offset--;
@@ -1441,6 +1441,11 @@ static inline struct sk_buff *tcp_recv_skb(struct sock *sk, u32 seq, u32 *off)
1441 *off = offset; 1441 *off = offset;
1442 return skb; 1442 return skb;
1443 } 1443 }
1444 /* This looks weird, but this can happen if TCP collapsing
1445 * splitted a fat GRO packet, while we released socket lock
1446 * in skb_splice_bits()
1447 */
1448 sk_eat_skb(sk, skb, false);
1444 } 1449 }
1445 return NULL; 1450 return NULL;
1446} 1451}
@@ -1482,7 +1487,7 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
1482 break; 1487 break;
1483 } 1488 }
1484 used = recv_actor(desc, skb, offset, len); 1489 used = recv_actor(desc, skb, offset, len);
1485 if (used < 0) { 1490 if (used <= 0) {
1486 if (!copied) 1491 if (!copied)
1487 copied = used; 1492 copied = used;
1488 break; 1493 break;
@@ -1520,8 +1525,10 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
1520 tcp_rcv_space_adjust(sk); 1525 tcp_rcv_space_adjust(sk);
1521 1526
1522 /* Clean up data we have read: This will do ACK frames. */ 1527 /* Clean up data we have read: This will do ACK frames. */
1523 if (copied > 0) 1528 if (copied > 0) {
1529 tcp_recv_skb(sk, seq, &offset);
1524 tcp_cleanup_rbuf(sk, copied); 1530 tcp_cleanup_rbuf(sk, copied);
1531 }
1525 return copied; 1532 return copied;
1526} 1533}
1527EXPORT_SYMBOL(tcp_read_sock); 1534EXPORT_SYMBOL(tcp_read_sock);
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index a13692560e63..18f97ca76b00 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -5543,6 +5543,9 @@ slow_path:
5543 if (len < (th->doff << 2) || tcp_checksum_complete_user(sk, skb)) 5543 if (len < (th->doff << 2) || tcp_checksum_complete_user(sk, skb))
5544 goto csum_error; 5544 goto csum_error;
5545 5545
5546 if (!th->ack && !th->rst)
5547 goto discard;
5548
5546 /* 5549 /*
5547 * Standard slow path. 5550 * Standard slow path.
5548 */ 5551 */
@@ -5551,7 +5554,7 @@ slow_path:
5551 return 0; 5554 return 0;
5552 5555
5553step5: 5556step5:
5554 if (th->ack && tcp_ack(sk, skb, FLAG_SLOWPATH) < 0) 5557 if (tcp_ack(sk, skb, FLAG_SLOWPATH) < 0)
5555 goto discard; 5558 goto discard;
5556 5559
5557 /* ts_recent update must be made after we are sure that the packet 5560 /* ts_recent update must be made after we are sure that the packet
@@ -5984,11 +5987,15 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
5984 if (tcp_check_req(sk, skb, req, NULL, true) == NULL) 5987 if (tcp_check_req(sk, skb, req, NULL, true) == NULL)
5985 goto discard; 5988 goto discard;
5986 } 5989 }
5990
5991 if (!th->ack && !th->rst)
5992 goto discard;
5993
5987 if (!tcp_validate_incoming(sk, skb, th, 0)) 5994 if (!tcp_validate_incoming(sk, skb, th, 0))
5988 return 0; 5995 return 0;
5989 5996
5990 /* step 5: check the ACK field */ 5997 /* step 5: check the ACK field */
5991 if (th->ack) { 5998 if (true) {
5992 int acceptable = tcp_ack(sk, skb, FLAG_SLOWPATH) > 0; 5999 int acceptable = tcp_ack(sk, skb, FLAG_SLOWPATH) > 0;
5993 6000
5994 switch (sk->sk_state) { 6001 switch (sk->sk_state) {
@@ -6138,8 +6145,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
6138 } 6145 }
6139 break; 6146 break;
6140 } 6147 }
6141 } else 6148 }
6142 goto discard;
6143 6149
6144 /* ts_recent update must be made after we are sure that the packet 6150 /* ts_recent update must be made after we are sure that the packet
6145 * is in window. 6151 * is in window.
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 54139fa514e6..70b09ef2463b 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -369,11 +369,10 @@ void tcp_v4_err(struct sk_buff *icmp_skb, u32 info)
369 * We do take care of PMTU discovery (RFC1191) special case : 369 * We do take care of PMTU discovery (RFC1191) special case :
370 * we can receive locally generated ICMP messages while socket is held. 370 * we can receive locally generated ICMP messages while socket is held.
371 */ 371 */
372 if (sock_owned_by_user(sk) && 372 if (sock_owned_by_user(sk)) {
373 type != ICMP_DEST_UNREACH && 373 if (!(type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED))
374 code != ICMP_FRAG_NEEDED) 374 NET_INC_STATS_BH(net, LINUX_MIB_LOCKDROPPEDICMPS);
375 NET_INC_STATS_BH(net, LINUX_MIB_LOCKDROPPEDICMPS); 375 }
376
377 if (sk->sk_state == TCP_CLOSE) 376 if (sk->sk_state == TCP_CLOSE)
378 goto out; 377 goto out;
379 378
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 79c8dbe59b54..1f4d405eafba 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1952,6 +1952,7 @@ struct proto udp_prot = {
1952 .recvmsg = udp_recvmsg, 1952 .recvmsg = udp_recvmsg,
1953 .sendpage = udp_sendpage, 1953 .sendpage = udp_sendpage,
1954 .backlog_rcv = __udp_queue_rcv_skb, 1954 .backlog_rcv = __udp_queue_rcv_skb,
1955 .release_cb = ip4_datagram_release_cb,
1955 .hash = udp_lib_hash, 1956 .hash = udp_lib_hash,
1956 .unhash = udp_lib_unhash, 1957 .unhash = udp_lib_unhash,
1957 .rehash = udp_v4_rehash, 1958 .rehash = udp_v4_rehash,
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 408cac4ae00a..420e56326384 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -154,6 +154,11 @@ static void addrconf_type_change(struct net_device *dev,
154 unsigned long event); 154 unsigned long event);
155static int addrconf_ifdown(struct net_device *dev, int how); 155static int addrconf_ifdown(struct net_device *dev, int how);
156 156
157static struct rt6_info *addrconf_get_prefix_route(const struct in6_addr *pfx,
158 int plen,
159 const struct net_device *dev,
160 u32 flags, u32 noflags);
161
157static void addrconf_dad_start(struct inet6_ifaddr *ifp); 162static void addrconf_dad_start(struct inet6_ifaddr *ifp);
158static void addrconf_dad_timer(unsigned long data); 163static void addrconf_dad_timer(unsigned long data);
159static void addrconf_dad_completed(struct inet6_ifaddr *ifp); 164static void addrconf_dad_completed(struct inet6_ifaddr *ifp);
@@ -250,12 +255,6 @@ static inline bool addrconf_qdisc_ok(const struct net_device *dev)
250 return !qdisc_tx_is_noop(dev); 255 return !qdisc_tx_is_noop(dev);
251} 256}
252 257
253/* Check if a route is valid prefix route */
254static inline int addrconf_is_prefix_route(const struct rt6_info *rt)
255{
256 return (rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0;
257}
258
259static void addrconf_del_timer(struct inet6_ifaddr *ifp) 258static void addrconf_del_timer(struct inet6_ifaddr *ifp)
260{ 259{
261 if (del_timer(&ifp->timer)) 260 if (del_timer(&ifp->timer))
@@ -941,17 +940,15 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
941 if ((ifp->flags & IFA_F_PERMANENT) && onlink < 1) { 940 if ((ifp->flags & IFA_F_PERMANENT) && onlink < 1) {
942 struct in6_addr prefix; 941 struct in6_addr prefix;
943 struct rt6_info *rt; 942 struct rt6_info *rt;
944 struct net *net = dev_net(ifp->idev->dev);
945 struct flowi6 fl6 = {};
946 943
947 ipv6_addr_prefix(&prefix, &ifp->addr, ifp->prefix_len); 944 ipv6_addr_prefix(&prefix, &ifp->addr, ifp->prefix_len);
948 fl6.flowi6_oif = ifp->idev->dev->ifindex;
949 fl6.daddr = prefix;
950 rt = (struct rt6_info *)ip6_route_lookup(net, &fl6,
951 RT6_LOOKUP_F_IFACE);
952 945
953 if (rt != net->ipv6.ip6_null_entry && 946 rt = addrconf_get_prefix_route(&prefix,
954 addrconf_is_prefix_route(rt)) { 947 ifp->prefix_len,
948 ifp->idev->dev,
949 0, RTF_GATEWAY | RTF_DEFAULT);
950
951 if (rt) {
955 if (onlink == 0) { 952 if (onlink == 0) {
956 ip6_del_rt(rt); 953 ip6_del_rt(rt);
957 rt = NULL; 954 rt = NULL;
@@ -1877,7 +1874,7 @@ static struct rt6_info *addrconf_get_prefix_route(const struct in6_addr *pfx,
1877 continue; 1874 continue;
1878 if ((rt->rt6i_flags & flags) != flags) 1875 if ((rt->rt6i_flags & flags) != flags)
1879 continue; 1876 continue;
1880 if ((noflags != 0) && ((rt->rt6i_flags & flags) != 0)) 1877 if ((rt->rt6i_flags & noflags) != 0)
1881 continue; 1878 continue;
1882 dst_hold(&rt->dst); 1879 dst_hold(&rt->dst);
1883 break; 1880 break;
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
index ecc35b93314b..384233188ac1 100644
--- a/net/ipv6/ah6.c
+++ b/net/ipv6/ah6.c
@@ -472,7 +472,10 @@ static void ah6_input_done(struct crypto_async_request *base, int err)
472 skb->network_header += ah_hlen; 472 skb->network_header += ah_hlen;
473 memcpy(skb_network_header(skb), work_iph, hdr_len); 473 memcpy(skb_network_header(skb), work_iph, hdr_len);
474 __skb_pull(skb, ah_hlen + hdr_len); 474 __skb_pull(skb, ah_hlen + hdr_len);
475 skb_set_transport_header(skb, -hdr_len); 475 if (x->props.mode == XFRM_MODE_TUNNEL)
476 skb_reset_transport_header(skb);
477 else
478 skb_set_transport_header(skb, -hdr_len);
476out: 479out:
477 kfree(AH_SKB_CB(skb)->tmp); 480 kfree(AH_SKB_CB(skb)->tmp);
478 xfrm_input_resume(skb, err); 481 xfrm_input_resume(skb, err);
@@ -593,9 +596,13 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb)
593 596
594 skb->network_header += ah_hlen; 597 skb->network_header += ah_hlen;
595 memcpy(skb_network_header(skb), work_iph, hdr_len); 598 memcpy(skb_network_header(skb), work_iph, hdr_len);
596 skb->transport_header = skb->network_header;
597 __skb_pull(skb, ah_hlen + hdr_len); 599 __skb_pull(skb, ah_hlen + hdr_len);
598 600
601 if (x->props.mode == XFRM_MODE_TUNNEL)
602 skb_reset_transport_header(skb);
603 else
604 skb_set_transport_header(skb, -hdr_len);
605
599 err = nexthdr; 606 err = nexthdr;
600 607
601out_free: 608out_free:
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index 282f3723ee19..40ffd72243a4 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -300,7 +300,10 @@ static int esp_input_done2(struct sk_buff *skb, int err)
300 300
301 pskb_trim(skb, skb->len - alen - padlen - 2); 301 pskb_trim(skb, skb->len - alen - padlen - 2);
302 __skb_pull(skb, hlen); 302 __skb_pull(skb, hlen);
303 skb_set_transport_header(skb, -hdr_len); 303 if (x->props.mode == XFRM_MODE_TUNNEL)
304 skb_reset_transport_header(skb);
305 else
306 skb_set_transport_header(skb, -hdr_len);
304 307
305 err = nexthdr[1]; 308 err = nexthdr[1];
306 309
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index b4a9fd51dae7..fff5bdd8b680 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -81,10 +81,22 @@ static inline struct sock *icmpv6_sk(struct net *net)
81 return net->ipv6.icmp_sk[smp_processor_id()]; 81 return net->ipv6.icmp_sk[smp_processor_id()];
82} 82}
83 83
84static void icmpv6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
85 u8 type, u8 code, int offset, __be32 info)
86{
87 struct net *net = dev_net(skb->dev);
88
89 if (type == ICMPV6_PKT_TOOBIG)
90 ip6_update_pmtu(skb, net, info, 0, 0);
91 else if (type == NDISC_REDIRECT)
92 ip6_redirect(skb, net, 0, 0);
93}
94
84static int icmpv6_rcv(struct sk_buff *skb); 95static int icmpv6_rcv(struct sk_buff *skb);
85 96
86static const struct inet6_protocol icmpv6_protocol = { 97static const struct inet6_protocol icmpv6_protocol = {
87 .handler = icmpv6_rcv, 98 .handler = icmpv6_rcv,
99 .err_handler = icmpv6_err,
88 .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, 100 .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL,
89}; 101};
90 102
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 867466c96aac..c727e4712751 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -758,8 +758,6 @@ static netdev_tx_t ip6gre_xmit2(struct sk_buff *skb,
758 skb_dst_set_noref(skb, dst); 758 skb_dst_set_noref(skb, dst);
759 } 759 }
760 760
761 skb->transport_header = skb->network_header;
762
763 proto = NEXTHDR_GRE; 761 proto = NEXTHDR_GRE;
764 if (encap_limit >= 0) { 762 if (encap_limit >= 0) {
765 init_tel_txopt(&opt, encap_limit); 763 init_tel_txopt(&opt, encap_limit);
@@ -768,6 +766,7 @@ static netdev_tx_t ip6gre_xmit2(struct sk_buff *skb,
768 766
769 skb_push(skb, gre_hlen); 767 skb_push(skb, gre_hlen);
770 skb_reset_network_header(skb); 768 skb_reset_network_header(skb);
769 skb_set_transport_header(skb, sizeof(*ipv6h));
771 770
772 /* 771 /*
773 * Push down and install the IP header. 772 * Push down and install the IP header.
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 5552d13ae92f..0c7c03d50dc0 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1213,10 +1213,10 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
1213 if (dst_allfrag(rt->dst.path)) 1213 if (dst_allfrag(rt->dst.path))
1214 cork->flags |= IPCORK_ALLFRAG; 1214 cork->flags |= IPCORK_ALLFRAG;
1215 cork->length = 0; 1215 cork->length = 0;
1216 exthdrlen = (opt ? opt->opt_flen : 0) - rt->rt6i_nfheader_len; 1216 exthdrlen = (opt ? opt->opt_flen : 0);
1217 length += exthdrlen; 1217 length += exthdrlen;
1218 transhdrlen += exthdrlen; 1218 transhdrlen += exthdrlen;
1219 dst_exthdrlen = rt->dst.header_len; 1219 dst_exthdrlen = rt->dst.header_len - rt->rt6i_nfheader_len;
1220 } else { 1220 } else {
1221 rt = (struct rt6_info *)cork->dst; 1221 rt = (struct rt6_info *)cork->dst;
1222 fl6 = &inet->cork.fl.u.ip6; 1222 fl6 = &inet->cork.fl.u.ip6;
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 26dcdec9e3a5..8fd154e5f079 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -1710,6 +1710,9 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, uns
1710 return -EINVAL; 1710 return -EINVAL;
1711 if (get_user(v, (u32 __user *)optval)) 1711 if (get_user(v, (u32 __user *)optval))
1712 return -EFAULT; 1712 return -EFAULT;
1713 /* "pim6reg%u" should not exceed 16 bytes (IFNAMSIZ) */
1714 if (v != RT_TABLE_DEFAULT && v >= 100000000)
1715 return -EINVAL;
1713 if (sk == mrt->mroute6_sk) 1716 if (sk == mrt->mroute6_sk)
1714 return -EBUSY; 1717 return -EBUSY;
1715 1718
diff --git a/net/ipv6/netfilter/ip6t_NPT.c b/net/ipv6/netfilter/ip6t_NPT.c
index e9486915eff6..7302b0b7b642 100644
--- a/net/ipv6/netfilter/ip6t_NPT.c
+++ b/net/ipv6/netfilter/ip6t_NPT.c
@@ -14,42 +14,23 @@
14#include <linux/netfilter_ipv6/ip6t_NPT.h> 14#include <linux/netfilter_ipv6/ip6t_NPT.h>
15#include <linux/netfilter/x_tables.h> 15#include <linux/netfilter/x_tables.h>
16 16
17static __sum16 csum16_complement(__sum16 a)
18{
19 return (__force __sum16)(0xffff - (__force u16)a);
20}
21
22static __sum16 csum16_add(__sum16 a, __sum16 b)
23{
24 u16 sum;
25
26 sum = (__force u16)a + (__force u16)b;
27 sum += (__force u16)a < (__force u16)b;
28 return (__force __sum16)sum;
29}
30
31static __sum16 csum16_sub(__sum16 a, __sum16 b)
32{
33 return csum16_add(a, csum16_complement(b));
34}
35
36static int ip6t_npt_checkentry(const struct xt_tgchk_param *par) 17static int ip6t_npt_checkentry(const struct xt_tgchk_param *par)
37{ 18{
38 struct ip6t_npt_tginfo *npt = par->targinfo; 19 struct ip6t_npt_tginfo *npt = par->targinfo;
39 __sum16 src_sum = 0, dst_sum = 0; 20 __wsum src_sum = 0, dst_sum = 0;
40 unsigned int i; 21 unsigned int i;
41 22
42 if (npt->src_pfx_len > 64 || npt->dst_pfx_len > 64) 23 if (npt->src_pfx_len > 64 || npt->dst_pfx_len > 64)
43 return -EINVAL; 24 return -EINVAL;
44 25
45 for (i = 0; i < ARRAY_SIZE(npt->src_pfx.in6.s6_addr16); i++) { 26 for (i = 0; i < ARRAY_SIZE(npt->src_pfx.in6.s6_addr16); i++) {
46 src_sum = csum16_add(src_sum, 27 src_sum = csum_add(src_sum,
47 (__force __sum16)npt->src_pfx.in6.s6_addr16[i]); 28 (__force __wsum)npt->src_pfx.in6.s6_addr16[i]);
48 dst_sum = csum16_add(dst_sum, 29 dst_sum = csum_add(dst_sum,
49 (__force __sum16)npt->dst_pfx.in6.s6_addr16[i]); 30 (__force __wsum)npt->dst_pfx.in6.s6_addr16[i]);
50 } 31 }
51 32
52 npt->adjustment = csum16_sub(src_sum, dst_sum); 33 npt->adjustment = (__force __sum16) csum_sub(src_sum, dst_sum);
53 return 0; 34 return 0;
54} 35}
55 36
@@ -85,7 +66,7 @@ static bool ip6t_npt_map_pfx(const struct ip6t_npt_tginfo *npt,
85 return false; 66 return false;
86 } 67 }
87 68
88 sum = csum16_add((__force __sum16)addr->s6_addr16[idx], 69 sum = (__force __sum16) csum_add((__force __wsum)addr->s6_addr16[idx],
89 npt->adjustment); 70 npt->adjustment);
90 if (sum == CSUM_MANGLED_0) 71 if (sum == CSUM_MANGLED_0)
91 sum = 0; 72 sum = 0;
diff --git a/net/ipv6/netfilter/ip6t_REJECT.c b/net/ipv6/netfilter/ip6t_REJECT.c
index fd4fb34c51c7..029623dbd411 100644
--- a/net/ipv6/netfilter/ip6t_REJECT.c
+++ b/net/ipv6/netfilter/ip6t_REJECT.c
@@ -132,6 +132,7 @@ static void send_reset(struct net *net, struct sk_buff *oldskb)
132 ip6h->saddr = oip6h->daddr; 132 ip6h->saddr = oip6h->daddr;
133 ip6h->daddr = oip6h->saddr; 133 ip6h->daddr = oip6h->saddr;
134 134
135 skb_reset_transport_header(nskb);
135 tcph = (struct tcphdr *)skb_put(nskb, sizeof(struct tcphdr)); 136 tcph = (struct tcphdr *)skb_put(nskb, sizeof(struct tcphdr));
136 /* Truncate to length (no data) */ 137 /* Truncate to length (no data) */
137 tcph->doff = sizeof(struct tcphdr)/4; 138 tcph->doff = sizeof(struct tcphdr)/4;
diff --git a/net/ipv6/netfilter/ip6table_nat.c b/net/ipv6/netfilter/ip6table_nat.c
index 6c8ae24b85eb..e0e788d25b14 100644
--- a/net/ipv6/netfilter/ip6table_nat.c
+++ b/net/ipv6/netfilter/ip6table_nat.c
@@ -127,23 +127,28 @@ nf_nat_ipv6_fn(unsigned int hooknum,
127 ret = nf_nat_rule_find(skb, hooknum, in, out, ct); 127 ret = nf_nat_rule_find(skb, hooknum, in, out, ct);
128 if (ret != NF_ACCEPT) 128 if (ret != NF_ACCEPT)
129 return ret; 129 return ret;
130 } else 130 } else {
131 pr_debug("Already setup manip %s for ct %p\n", 131 pr_debug("Already setup manip %s for ct %p\n",
132 maniptype == NF_NAT_MANIP_SRC ? "SRC" : "DST", 132 maniptype == NF_NAT_MANIP_SRC ? "SRC" : "DST",
133 ct); 133 ct);
134 if (nf_nat_oif_changed(hooknum, ctinfo, nat, out))
135 goto oif_changed;
136 }
134 break; 137 break;
135 138
136 default: 139 default:
137 /* ESTABLISHED */ 140 /* ESTABLISHED */
138 NF_CT_ASSERT(ctinfo == IP_CT_ESTABLISHED || 141 NF_CT_ASSERT(ctinfo == IP_CT_ESTABLISHED ||
139 ctinfo == IP_CT_ESTABLISHED_REPLY); 142 ctinfo == IP_CT_ESTABLISHED_REPLY);
140 if (nf_nat_oif_changed(hooknum, ctinfo, nat, out)) { 143 if (nf_nat_oif_changed(hooknum, ctinfo, nat, out))
141 nf_ct_kill_acct(ct, ctinfo, skb); 144 goto oif_changed;
142 return NF_DROP;
143 }
144 } 145 }
145 146
146 return nf_nat_packet(ct, ctinfo, hooknum, skb); 147 return nf_nat_packet(ct, ctinfo, hooknum, skb);
148
149oif_changed:
150 nf_ct_kill_acct(ct, ctinfo, skb);
151 return NF_DROP;
147} 152}
148 153
149static unsigned int 154static unsigned int
diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
index 00ee17c3e893..137e245860ab 100644
--- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
@@ -81,8 +81,8 @@ static int ipv6_get_l4proto(const struct sk_buff *skb, unsigned int nhoff,
81 } 81 }
82 protoff = ipv6_skip_exthdr(skb, extoff, &nexthdr, &frag_off); 82 protoff = ipv6_skip_exthdr(skb, extoff, &nexthdr, &frag_off);
83 /* 83 /*
84 * (protoff == skb->len) mean that the packet doesn't have no data 84 * (protoff == skb->len) means the packet has not data, just
85 * except of IPv6 & ext headers. but it's tracked anyway. - YK 85 * IPv6 and possibly extensions headers, but it is tracked anyway
86 */ 86 */
87 if (protoff < 0 || (frag_off & htons(~0x7)) != 0) { 87 if (protoff < 0 || (frag_off & htons(~0x7)) != 0) {
88 pr_debug("ip6_conntrack_core: can't find proto in pkt\n"); 88 pr_debug("ip6_conntrack_core: can't find proto in pkt\n");
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index 22c8ea951185..3dacecc99065 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -311,7 +311,10 @@ found:
311 else 311 else
312 fq->q.fragments = skb; 312 fq->q.fragments = skb;
313 313
314 skb->dev = NULL; 314 if (skb->dev) {
315 fq->iif = skb->dev->ifindex;
316 skb->dev = NULL;
317 }
315 fq->q.stamp = skb->tstamp; 318 fq->q.stamp = skb->tstamp;
316 fq->q.meat += skb->len; 319 fq->q.meat += skb->len;
317 if (payload_len > fq->q.max_size) 320 if (payload_len > fq->q.max_size)
diff --git a/net/iucv/iucv.c b/net/iucv/iucv.c
index 3ad1f9db5f8b..df082508362d 100644
--- a/net/iucv/iucv.c
+++ b/net/iucv/iucv.c
@@ -1806,7 +1806,7 @@ static void iucv_external_interrupt(struct ext_code ext_code,
1806 struct iucv_irq_data *p; 1806 struct iucv_irq_data *p;
1807 struct iucv_irq_list *work; 1807 struct iucv_irq_list *work;
1808 1808
1809 kstat_cpu(smp_processor_id()).irqs[EXTINT_IUC]++; 1809 inc_irq_stat(IRQEXT_IUC);
1810 p = iucv_irq_data[smp_processor_id()]; 1810 p = iucv_irq_data[smp_processor_id()];
1811 if (p->ippathid >= iucv_max_pathid) { 1811 if (p->ippathid >= iucv_max_pathid) {
1812 WARN_ON(p->ippathid >= iucv_max_pathid); 1812 WARN_ON(p->ippathid >= iucv_max_pathid);
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 5c61677487cf..516fbc96feff 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -164,7 +164,17 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev,
164 sta = sta_info_get(sdata, mac_addr); 164 sta = sta_info_get(sdata, mac_addr);
165 else 165 else
166 sta = sta_info_get_bss(sdata, mac_addr); 166 sta = sta_info_get_bss(sdata, mac_addr);
167 if (!sta) { 167 /*
168 * The ASSOC test makes sure the driver is ready to
169 * receive the key. When wpa_supplicant has roamed
170 * using FT, it attempts to set the key before
171 * association has completed, this rejects that attempt
172 * so it will set the key again after assocation.
173 *
174 * TODO: accept the key if we have a station entry and
175 * add it to the device after the station.
176 */
177 if (!sta || !test_sta_flag(sta, WLAN_STA_ASSOC)) {
168 ieee80211_key_free(sdata->local, key); 178 ieee80211_key_free(sdata->local, key);
169 err = -ENOENT; 179 err = -ENOENT;
170 goto out_unlock; 180 goto out_unlock;
@@ -1009,6 +1019,8 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
1009 if (old_probe_resp) 1019 if (old_probe_resp)
1010 kfree_rcu(old_probe_resp, rcu_head); 1020 kfree_rcu(old_probe_resp, rcu_head);
1011 1021
1022 list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list)
1023 sta_info_flush(local, vlan);
1012 sta_info_flush(local, sdata); 1024 sta_info_flush(local, sdata);
1013 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED); 1025 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED);
1014 1026
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index 53f03120db55..80e55527504b 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -4,6 +4,7 @@
4 4
5#include <linux/nl80211.h> 5#include <linux/nl80211.h>
6#include <linux/export.h> 6#include <linux/export.h>
7#include <linux/rtnetlink.h>
7#include <net/cfg80211.h> 8#include <net/cfg80211.h>
8#include "ieee80211_i.h" 9#include "ieee80211_i.h"
9#include "driver-ops.h" 10#include "driver-ops.h"
@@ -197,6 +198,15 @@ static void __ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata)
197 198
198 ctx = container_of(conf, struct ieee80211_chanctx, conf); 199 ctx = container_of(conf, struct ieee80211_chanctx, conf);
199 200
201 if (sdata->vif.type == NL80211_IFTYPE_AP) {
202 struct ieee80211_sub_if_data *vlan;
203
204 /* for the VLAN list */
205 ASSERT_RTNL();
206 list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list)
207 rcu_assign_pointer(vlan->vif.chanctx_conf, NULL);
208 }
209
200 ieee80211_unassign_vif_chanctx(sdata, ctx); 210 ieee80211_unassign_vif_chanctx(sdata, ctx);
201 if (ctx->refcount == 0) 211 if (ctx->refcount == 0)
202 ieee80211_free_chanctx(local, ctx); 212 ieee80211_free_chanctx(local, ctx);
@@ -316,6 +326,15 @@ int ieee80211_vif_use_channel(struct ieee80211_sub_if_data *sdata,
316 goto out; 326 goto out;
317 } 327 }
318 328
329 if (sdata->vif.type == NL80211_IFTYPE_AP) {
330 struct ieee80211_sub_if_data *vlan;
331
332 /* for the VLAN list */
333 ASSERT_RTNL();
334 list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list)
335 rcu_assign_pointer(vlan->vif.chanctx_conf, &ctx->conf);
336 }
337
319 ieee80211_recalc_smps_chanctx(local, ctx); 338 ieee80211_recalc_smps_chanctx(local, ctx);
320 out: 339 out:
321 mutex_unlock(&local->chanctx_mtx); 340 mutex_unlock(&local->chanctx_mtx);
@@ -331,6 +350,25 @@ void ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata)
331 mutex_unlock(&sdata->local->chanctx_mtx); 350 mutex_unlock(&sdata->local->chanctx_mtx);
332} 351}
333 352
353void ieee80211_vif_vlan_copy_chanctx(struct ieee80211_sub_if_data *sdata)
354{
355 struct ieee80211_local *local = sdata->local;
356 struct ieee80211_sub_if_data *ap;
357 struct ieee80211_chanctx_conf *conf;
358
359 if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_AP_VLAN || !sdata->bss))
360 return;
361
362 ap = container_of(sdata->bss, struct ieee80211_sub_if_data, u.ap);
363
364 mutex_lock(&local->chanctx_mtx);
365
366 conf = rcu_dereference_protected(ap->vif.chanctx_conf,
367 lockdep_is_held(&local->chanctx_mtx));
368 rcu_assign_pointer(sdata->vif.chanctx_conf, conf);
369 mutex_unlock(&local->chanctx_mtx);
370}
371
334void ieee80211_iter_chan_contexts_atomic( 372void ieee80211_iter_chan_contexts_atomic(
335 struct ieee80211_hw *hw, 373 struct ieee80211_hw *hw,
336 void (*iter)(struct ieee80211_hw *hw, 374 void (*iter)(struct ieee80211_hw *hw,
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 8881fc77fb13..6b7644e818d8 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -703,8 +703,8 @@ static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata)
703 sdata_info(sdata, 703 sdata_info(sdata,
704 "No active IBSS STAs - trying to scan for other IBSS networks with same SSID (merge)\n"); 704 "No active IBSS STAs - trying to scan for other IBSS networks with same SSID (merge)\n");
705 705
706 ieee80211_request_internal_scan(sdata, 706 ieee80211_request_ibss_scan(sdata, ifibss->ssid, ifibss->ssid_len,
707 ifibss->ssid, ifibss->ssid_len, NULL); 707 NULL);
708} 708}
709 709
710static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata) 710static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata)
@@ -802,9 +802,8 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
802 IEEE80211_SCAN_INTERVAL)) { 802 IEEE80211_SCAN_INTERVAL)) {
803 sdata_info(sdata, "Trigger new scan to find an IBSS to join\n"); 803 sdata_info(sdata, "Trigger new scan to find an IBSS to join\n");
804 804
805 ieee80211_request_internal_scan(sdata, 805 ieee80211_request_ibss_scan(sdata, ifibss->ssid,
806 ifibss->ssid, ifibss->ssid_len, 806 ifibss->ssid_len, chan);
807 ifibss->fixed_channel ? ifibss->channel : NULL);
808 } else { 807 } else {
809 int interval = IEEE80211_SCAN_INTERVAL; 808 int interval = IEEE80211_SCAN_INTERVAL;
810 809
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 42d0d0267730..2ed065c09562 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -92,8 +92,6 @@ struct ieee80211_bss {
92 92
93 u32 device_ts; 93 u32 device_ts;
94 94
95 u8 dtim_period;
96
97 bool wmm_used; 95 bool wmm_used;
98 bool uapsd_supported; 96 bool uapsd_supported;
99 97
@@ -140,7 +138,6 @@ enum ieee80211_bss_corrupt_data_flags {
140 138
141/** 139/**
142 * enum ieee80211_valid_data_flags - BSS valid data flags 140 * enum ieee80211_valid_data_flags - BSS valid data flags
143 * @IEEE80211_BSS_VALID_DTIM: DTIM data was gathered from non-corrupt IE
144 * @IEEE80211_BSS_VALID_WMM: WMM/UAPSD data was gathered from non-corrupt IE 141 * @IEEE80211_BSS_VALID_WMM: WMM/UAPSD data was gathered from non-corrupt IE
145 * @IEEE80211_BSS_VALID_RATES: Supported rates were gathered from non-corrupt IE 142 * @IEEE80211_BSS_VALID_RATES: Supported rates were gathered from non-corrupt IE
146 * @IEEE80211_BSS_VALID_ERP: ERP flag was gathered from non-corrupt IE 143 * @IEEE80211_BSS_VALID_ERP: ERP flag was gathered from non-corrupt IE
@@ -151,7 +148,6 @@ enum ieee80211_bss_corrupt_data_flags {
151 * beacon/probe response. 148 * beacon/probe response.
152 */ 149 */
153enum ieee80211_bss_valid_data_flags { 150enum ieee80211_bss_valid_data_flags {
154 IEEE80211_BSS_VALID_DTIM = BIT(0),
155 IEEE80211_BSS_VALID_WMM = BIT(1), 151 IEEE80211_BSS_VALID_WMM = BIT(1),
156 IEEE80211_BSS_VALID_RATES = BIT(2), 152 IEEE80211_BSS_VALID_RATES = BIT(2),
157 IEEE80211_BSS_VALID_ERP = BIT(3) 153 IEEE80211_BSS_VALID_ERP = BIT(3)
@@ -440,6 +436,7 @@ struct ieee80211_if_managed {
440 unsigned long timers_running; /* used for quiesce/restart */ 436 unsigned long timers_running; /* used for quiesce/restart */
441 bool powersave; /* powersave requested for this iface */ 437 bool powersave; /* powersave requested for this iface */
442 bool broken_ap; /* AP is broken -- turn off powersave */ 438 bool broken_ap; /* AP is broken -- turn off powersave */
439 u8 dtim_period;
443 enum ieee80211_smps_mode req_smps, /* requested smps mode */ 440 enum ieee80211_smps_mode req_smps, /* requested smps mode */
444 driver_smps_mode; /* smps mode request */ 441 driver_smps_mode; /* smps mode request */
445 442
@@ -773,6 +770,10 @@ struct ieee80211_sub_if_data {
773 u32 mntr_flags; 770 u32 mntr_flags;
774 } u; 771 } u;
775 772
773 spinlock_t cleanup_stations_lock;
774 struct list_head cleanup_stations;
775 struct work_struct cleanup_stations_wk;
776
776#ifdef CONFIG_MAC80211_DEBUGFS 777#ifdef CONFIG_MAC80211_DEBUGFS
777 struct { 778 struct {
778 struct dentry *dir; 779 struct dentry *dir;
@@ -1329,9 +1330,9 @@ void ieee80211_mesh_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
1329 1330
1330/* scan/BSS handling */ 1331/* scan/BSS handling */
1331void ieee80211_scan_work(struct work_struct *work); 1332void ieee80211_scan_work(struct work_struct *work);
1332int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata, 1333int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata,
1333 const u8 *ssid, u8 ssid_len, 1334 const u8 *ssid, u8 ssid_len,
1334 struct ieee80211_channel *chan); 1335 struct ieee80211_channel *chan);
1335int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata, 1336int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata,
1336 struct cfg80211_scan_request *req); 1337 struct cfg80211_scan_request *req);
1337void ieee80211_scan_cancel(struct ieee80211_local *local); 1338void ieee80211_scan_cancel(struct ieee80211_local *local);
@@ -1357,10 +1358,8 @@ int ieee80211_request_sched_scan_stop(struct ieee80211_sub_if_data *sdata);
1357void ieee80211_sched_scan_stopped_work(struct work_struct *work); 1358void ieee80211_sched_scan_stopped_work(struct work_struct *work);
1358 1359
1359/* off-channel helpers */ 1360/* off-channel helpers */
1360void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local, 1361void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local);
1361 bool offchannel_ps_enable); 1362void ieee80211_offchannel_return(struct ieee80211_local *local);
1362void ieee80211_offchannel_return(struct ieee80211_local *local,
1363 bool offchannel_ps_disable);
1364void ieee80211_roc_setup(struct ieee80211_local *local); 1363void ieee80211_roc_setup(struct ieee80211_local *local);
1365void ieee80211_start_next_roc(struct ieee80211_local *local); 1364void ieee80211_start_next_roc(struct ieee80211_local *local);
1366void ieee80211_roc_purge(struct ieee80211_sub_if_data *sdata); 1365void ieee80211_roc_purge(struct ieee80211_sub_if_data *sdata);
@@ -1628,6 +1627,7 @@ ieee80211_vif_use_channel(struct ieee80211_sub_if_data *sdata,
1628 const struct cfg80211_chan_def *chandef, 1627 const struct cfg80211_chan_def *chandef,
1629 enum ieee80211_chanctx_mode mode); 1628 enum ieee80211_chanctx_mode mode);
1630void ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata); 1629void ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata);
1630void ieee80211_vif_vlan_copy_chanctx(struct ieee80211_sub_if_data *sdata);
1631 1631
1632void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local, 1632void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local,
1633 struct ieee80211_chanctx *chanctx); 1633 struct ieee80211_chanctx *chanctx);
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 09a80b55cf5a..8be854e86cd9 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -207,17 +207,8 @@ void ieee80211_recalc_idle(struct ieee80211_local *local)
207 207
208static int ieee80211_change_mtu(struct net_device *dev, int new_mtu) 208static int ieee80211_change_mtu(struct net_device *dev, int new_mtu)
209{ 209{
210 int meshhdrlen; 210 if (new_mtu < 256 || new_mtu > IEEE80211_MAX_DATA_LEN)
211 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
212
213 meshhdrlen = (sdata->vif.type == NL80211_IFTYPE_MESH_POINT) ? 5 : 0;
214
215 /* FIX: what would be proper limits for MTU?
216 * This interface uses 802.3 frames. */
217 if (new_mtu < 256 ||
218 new_mtu > IEEE80211_MAX_DATA_LEN - 24 - 6 - meshhdrlen) {
219 return -EINVAL; 211 return -EINVAL;
220 }
221 212
222 dev->mtu = new_mtu; 213 dev->mtu = new_mtu;
223 return 0; 214 return 0;
@@ -586,11 +577,13 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
586 577
587 switch (sdata->vif.type) { 578 switch (sdata->vif.type) {
588 case NL80211_IFTYPE_AP_VLAN: 579 case NL80211_IFTYPE_AP_VLAN:
589 /* no need to tell driver, but set carrier */ 580 /* no need to tell driver, but set carrier and chanctx */
590 if (rtnl_dereference(sdata->bss->beacon)) 581 if (rtnl_dereference(sdata->bss->beacon)) {
582 ieee80211_vif_vlan_copy_chanctx(sdata);
591 netif_carrier_on(dev); 583 netif_carrier_on(dev);
592 else 584 } else {
593 netif_carrier_off(dev); 585 netif_carrier_off(dev);
586 }
594 break; 587 break;
595 case NL80211_IFTYPE_MONITOR: 588 case NL80211_IFTYPE_MONITOR:
596 if (sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) { 589 if (sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) {
@@ -839,6 +832,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
839 switch (sdata->vif.type) { 832 switch (sdata->vif.type) {
840 case NL80211_IFTYPE_AP_VLAN: 833 case NL80211_IFTYPE_AP_VLAN:
841 list_del(&sdata->u.vlan.list); 834 list_del(&sdata->u.vlan.list);
835 rcu_assign_pointer(sdata->vif.chanctx_conf, NULL);
842 /* no need to tell driver */ 836 /* no need to tell driver */
843 break; 837 break;
844 case NL80211_IFTYPE_MONITOR: 838 case NL80211_IFTYPE_MONITOR:
@@ -865,20 +859,11 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
865 cancel_work_sync(&sdata->work); 859 cancel_work_sync(&sdata->work);
866 /* 860 /*
867 * When we get here, the interface is marked down. 861 * When we get here, the interface is marked down.
868 * Call rcu_barrier() to wait both for the RX path 862 * Call synchronize_rcu() to wait for the RX path
869 * should it be using the interface and enqueuing 863 * should it be using the interface and enqueuing
870 * frames at this very time on another CPU, and 864 * frames at this very time on another CPU.
871 * for the sta free call_rcu callbacks.
872 */
873 rcu_barrier();
874
875 /*
876 * free_sta_rcu() enqueues a work for the actual
877 * sta cleanup, so we need to flush it while
878 * sdata is still valid.
879 */ 865 */
880 flush_workqueue(local->workqueue); 866 synchronize_rcu();
881
882 skb_queue_purge(&sdata->skb_queue); 867 skb_queue_purge(&sdata->skb_queue);
883 868
884 /* 869 /*
@@ -1498,6 +1483,15 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local,
1498 mutex_unlock(&local->iflist_mtx); 1483 mutex_unlock(&local->iflist_mtx);
1499} 1484}
1500 1485
1486static void ieee80211_cleanup_sdata_stas_wk(struct work_struct *wk)
1487{
1488 struct ieee80211_sub_if_data *sdata;
1489
1490 sdata = container_of(wk, struct ieee80211_sub_if_data, cleanup_stations_wk);
1491
1492 ieee80211_cleanup_sdata_stas(sdata);
1493}
1494
1501int ieee80211_if_add(struct ieee80211_local *local, const char *name, 1495int ieee80211_if_add(struct ieee80211_local *local, const char *name,
1502 struct wireless_dev **new_wdev, enum nl80211_iftype type, 1496 struct wireless_dev **new_wdev, enum nl80211_iftype type,
1503 struct vif_params *params) 1497 struct vif_params *params)
@@ -1573,6 +1567,10 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
1573 1567
1574 INIT_LIST_HEAD(&sdata->key_list); 1568 INIT_LIST_HEAD(&sdata->key_list);
1575 1569
1570 spin_lock_init(&sdata->cleanup_stations_lock);
1571 INIT_LIST_HEAD(&sdata->cleanup_stations);
1572 INIT_WORK(&sdata->cleanup_stations_wk, ieee80211_cleanup_sdata_stas_wk);
1573
1576 for (i = 0; i < IEEE80211_NUM_BANDS; i++) { 1574 for (i = 0; i < IEEE80211_NUM_BANDS; i++) {
1577 struct ieee80211_supported_band *sband; 1575 struct ieee80211_supported_band *sband;
1578 sband = local->hw.wiphy->bands[i]; 1576 sband = local->hw.wiphy->bands[i];
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 1bf03f9ff3ba..649ad513547f 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -163,7 +163,7 @@ int mesh_rmc_init(struct ieee80211_sub_if_data *sdata)
163 return -ENOMEM; 163 return -ENOMEM;
164 sdata->u.mesh.rmc->idx_mask = RMC_BUCKETS - 1; 164 sdata->u.mesh.rmc->idx_mask = RMC_BUCKETS - 1;
165 for (i = 0; i < RMC_BUCKETS; i++) 165 for (i = 0; i < RMC_BUCKETS; i++)
166 INIT_LIST_HEAD(&sdata->u.mesh.rmc->bucket[i].list); 166 INIT_LIST_HEAD(&sdata->u.mesh.rmc->bucket[i]);
167 return 0; 167 return 0;
168} 168}
169 169
@@ -177,7 +177,7 @@ void mesh_rmc_free(struct ieee80211_sub_if_data *sdata)
177 return; 177 return;
178 178
179 for (i = 0; i < RMC_BUCKETS; i++) 179 for (i = 0; i < RMC_BUCKETS; i++)
180 list_for_each_entry_safe(p, n, &rmc->bucket[i].list, list) { 180 list_for_each_entry_safe(p, n, &rmc->bucket[i], list) {
181 list_del(&p->list); 181 list_del(&p->list);
182 kmem_cache_free(rm_cache, p); 182 kmem_cache_free(rm_cache, p);
183 } 183 }
@@ -210,7 +210,7 @@ int mesh_rmc_check(u8 *sa, struct ieee80211s_hdr *mesh_hdr,
210 /* Don't care about endianness since only match matters */ 210 /* Don't care about endianness since only match matters */
211 memcpy(&seqnum, &mesh_hdr->seqnum, sizeof(mesh_hdr->seqnum)); 211 memcpy(&seqnum, &mesh_hdr->seqnum, sizeof(mesh_hdr->seqnum));
212 idx = le32_to_cpu(mesh_hdr->seqnum) & rmc->idx_mask; 212 idx = le32_to_cpu(mesh_hdr->seqnum) & rmc->idx_mask;
213 list_for_each_entry_safe(p, n, &rmc->bucket[idx].list, list) { 213 list_for_each_entry_safe(p, n, &rmc->bucket[idx], list) {
214 ++entries; 214 ++entries;
215 if (time_after(jiffies, p->exp_time) || 215 if (time_after(jiffies, p->exp_time) ||
216 (entries == RMC_QUEUE_MAX_LEN)) { 216 (entries == RMC_QUEUE_MAX_LEN)) {
@@ -229,7 +229,7 @@ int mesh_rmc_check(u8 *sa, struct ieee80211s_hdr *mesh_hdr,
229 p->seqnum = seqnum; 229 p->seqnum = seqnum;
230 p->exp_time = jiffies + RMC_TIMEOUT; 230 p->exp_time = jiffies + RMC_TIMEOUT;
231 memcpy(p->sa, sa, ETH_ALEN); 231 memcpy(p->sa, sa, ETH_ALEN);
232 list_add(&p->list, &rmc->bucket[idx].list); 232 list_add(&p->list, &rmc->bucket[idx]);
233 return 0; 233 return 0;
234} 234}
235 235
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h
index 7c9215fb2ac8..84c28c6101cd 100644
--- a/net/mac80211/mesh.h
+++ b/net/mac80211/mesh.h
@@ -184,7 +184,7 @@ struct rmc_entry {
184}; 184};
185 185
186struct mesh_rmc { 186struct mesh_rmc {
187 struct rmc_entry bucket[RMC_BUCKETS]; 187 struct list_head bucket[RMC_BUCKETS];
188 u32 idx_mask; 188 u32 idx_mask;
189}; 189};
190 190
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index 47aeee2d8db1..2659e428b80c 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -215,6 +215,7 @@ static void prepare_frame_for_deferred_tx(struct ieee80211_sub_if_data *sdata,
215 skb->priority = 7; 215 skb->priority = 7;
216 216
217 info->control.vif = &sdata->vif; 217 info->control.vif = &sdata->vif;
218 info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;
218 ieee80211_set_qos_hdr(sdata, skb); 219 ieee80211_set_qos_hdr(sdata, skb);
219} 220}
220 221
@@ -246,11 +247,13 @@ int mesh_path_error_tx(u8 ttl, u8 *target, __le32 target_sn,
246 return -EAGAIN; 247 return -EAGAIN;
247 248
248 skb = dev_alloc_skb(local->tx_headroom + 249 skb = dev_alloc_skb(local->tx_headroom +
250 IEEE80211_ENCRYPT_HEADROOM +
251 IEEE80211_ENCRYPT_TAILROOM +
249 hdr_len + 252 hdr_len +
250 2 + 15 /* PERR IE */); 253 2 + 15 /* PERR IE */);
251 if (!skb) 254 if (!skb)
252 return -1; 255 return -1;
253 skb_reserve(skb, local->tx_headroom); 256 skb_reserve(skb, local->tx_headroom + IEEE80211_ENCRYPT_HEADROOM);
254 mgmt = (struct ieee80211_mgmt *) skb_put(skb, hdr_len); 257 mgmt = (struct ieee80211_mgmt *) skb_put(skb, hdr_len);
255 memset(mgmt, 0, hdr_len); 258 memset(mgmt, 0, hdr_len);
256 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | 259 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 7753a9ca98a6..a3552929a21d 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1074,12 +1074,8 @@ void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency)
1074 if (beaconint_us > latency) { 1074 if (beaconint_us > latency) {
1075 local->ps_sdata = NULL; 1075 local->ps_sdata = NULL;
1076 } else { 1076 } else {
1077 struct ieee80211_bss *bss;
1078 int maxslp = 1; 1077 int maxslp = 1;
1079 u8 dtimper; 1078 u8 dtimper = found->u.mgd.dtim_period;
1080
1081 bss = (void *)found->u.mgd.associated->priv;
1082 dtimper = bss->dtim_period;
1083 1079
1084 /* If the TIM IE is invalid, pretend the value is 1 */ 1080 /* If the TIM IE is invalid, pretend the value is 1 */
1085 if (!dtimper) 1081 if (!dtimper)
@@ -1410,10 +1406,17 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
1410 1406
1411 ieee80211_led_assoc(local, 1); 1407 ieee80211_led_assoc(local, 1);
1412 1408
1413 if (local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD) 1409 if (local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD) {
1414 bss_conf->dtim_period = bss->dtim_period; 1410 /*
1415 else 1411 * If the AP is buggy we may get here with no DTIM period
1412 * known, so assume it's 1 which is the only safe assumption
1413 * in that case, although if the TIM IE is broken powersave
1414 * probably just won't work at all.
1415 */
1416 bss_conf->dtim_period = sdata->u.mgd.dtim_period ?: 1;
1417 } else {
1416 bss_conf->dtim_period = 0; 1418 bss_conf->dtim_period = 0;
1419 }
1417 1420
1418 bss_conf->assoc = 1; 1421 bss_conf->assoc = 1;
1419 1422
@@ -1562,6 +1565,8 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
1562 1565
1563 sdata->u.mgd.timers_running = 0; 1566 sdata->u.mgd.timers_running = 0;
1564 1567
1568 sdata->vif.bss_conf.dtim_period = 0;
1569
1565 ifmgd->flags = 0; 1570 ifmgd->flags = 0;
1566 ieee80211_vif_release_channel(sdata); 1571 ieee80211_vif_release_channel(sdata);
1567} 1572}
@@ -2373,11 +2378,18 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
2373 struct ieee80211_channel *channel; 2378 struct ieee80211_channel *channel;
2374 bool need_ps = false; 2379 bool need_ps = false;
2375 2380
2376 if (sdata->u.mgd.associated && 2381 if ((sdata->u.mgd.associated &&
2377 ether_addr_equal(mgmt->bssid, sdata->u.mgd.associated->bssid)) { 2382 ether_addr_equal(mgmt->bssid, sdata->u.mgd.associated->bssid)) ||
2378 bss = (void *)sdata->u.mgd.associated->priv; 2383 (sdata->u.mgd.assoc_data &&
2384 ether_addr_equal(mgmt->bssid,
2385 sdata->u.mgd.assoc_data->bss->bssid))) {
2379 /* not previously set so we may need to recalc */ 2386 /* not previously set so we may need to recalc */
2380 need_ps = !bss->dtim_period; 2387 need_ps = sdata->u.mgd.associated && !sdata->u.mgd.dtim_period;
2388
2389 if (elems->tim && !elems->parse_error) {
2390 struct ieee80211_tim_ie *tim_ie = elems->tim;
2391 sdata->u.mgd.dtim_period = tim_ie->dtim_period;
2392 }
2381 } 2393 }
2382 2394
2383 if (elems->ds_params && elems->ds_params_len == 1) 2395 if (elems->ds_params && elems->ds_params_len == 1)
@@ -3896,20 +3908,41 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
3896 /* kick off associate process */ 3908 /* kick off associate process */
3897 3909
3898 ifmgd->assoc_data = assoc_data; 3910 ifmgd->assoc_data = assoc_data;
3911 ifmgd->dtim_period = 0;
3899 3912
3900 err = ieee80211_prep_connection(sdata, req->bss, true); 3913 err = ieee80211_prep_connection(sdata, req->bss, true);
3901 if (err) 3914 if (err)
3902 goto err_clear; 3915 goto err_clear;
3903 3916
3904 if (!bss->dtim_period && 3917 if (sdata->local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD) {
3905 sdata->local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD) { 3918 const struct cfg80211_bss_ies *beacon_ies;
3906 /* 3919
3907 * Wait up to one beacon interval ... 3920 rcu_read_lock();
3908 * should this be more if we miss one? 3921 beacon_ies = rcu_dereference(req->bss->beacon_ies);
3909 */ 3922 if (!beacon_ies) {
3910 sdata_info(sdata, "waiting for beacon from %pM\n", 3923 /*
3911 ifmgd->bssid); 3924 * Wait up to one beacon interval ...
3912 assoc_data->timeout = TU_TO_EXP_TIME(req->bss->beacon_interval); 3925 * should this be more if we miss one?
3926 */
3927 sdata_info(sdata, "waiting for beacon from %pM\n",
3928 ifmgd->bssid);
3929 assoc_data->timeout =
3930 TU_TO_EXP_TIME(req->bss->beacon_interval);
3931 } else {
3932 const u8 *tim_ie = cfg80211_find_ie(WLAN_EID_TIM,
3933 beacon_ies->data,
3934 beacon_ies->len);
3935 if (tim_ie && tim_ie[1] >=
3936 sizeof(struct ieee80211_tim_ie)) {
3937 const struct ieee80211_tim_ie *tim;
3938 tim = (void *)(tim_ie + 2);
3939 ifmgd->dtim_period = tim->dtim_period;
3940 }
3941 assoc_data->have_beacon = true;
3942 assoc_data->sent_assoc = false;
3943 assoc_data->timeout = jiffies;
3944 }
3945 rcu_read_unlock();
3913 } else { 3946 } else {
3914 assoc_data->have_beacon = true; 3947 assoc_data->have_beacon = true;
3915 assoc_data->sent_assoc = false; 3948 assoc_data->sent_assoc = false;
diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c
index a5379aea7d09..a3ad4c3c80a3 100644
--- a/net/mac80211/offchannel.c
+++ b/net/mac80211/offchannel.c
@@ -102,8 +102,7 @@ static void ieee80211_offchannel_ps_disable(struct ieee80211_sub_if_data *sdata)
102 ieee80211_sta_reset_conn_monitor(sdata); 102 ieee80211_sta_reset_conn_monitor(sdata);
103} 103}
104 104
105void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local, 105void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local)
106 bool offchannel_ps_enable)
107{ 106{
108 struct ieee80211_sub_if_data *sdata; 107 struct ieee80211_sub_if_data *sdata;
109 108
@@ -134,8 +133,7 @@ void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local,
134 133
135 if (sdata->vif.type != NL80211_IFTYPE_MONITOR) { 134 if (sdata->vif.type != NL80211_IFTYPE_MONITOR) {
136 netif_tx_stop_all_queues(sdata->dev); 135 netif_tx_stop_all_queues(sdata->dev);
137 if (offchannel_ps_enable && 136 if (sdata->vif.type == NL80211_IFTYPE_STATION &&
138 (sdata->vif.type == NL80211_IFTYPE_STATION) &&
139 sdata->u.mgd.associated) 137 sdata->u.mgd.associated)
140 ieee80211_offchannel_ps_enable(sdata); 138 ieee80211_offchannel_ps_enable(sdata);
141 } 139 }
@@ -143,8 +141,7 @@ void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local,
143 mutex_unlock(&local->iflist_mtx); 141 mutex_unlock(&local->iflist_mtx);
144} 142}
145 143
146void ieee80211_offchannel_return(struct ieee80211_local *local, 144void ieee80211_offchannel_return(struct ieee80211_local *local)
147 bool offchannel_ps_disable)
148{ 145{
149 struct ieee80211_sub_if_data *sdata; 146 struct ieee80211_sub_if_data *sdata;
150 147
@@ -163,11 +160,9 @@ void ieee80211_offchannel_return(struct ieee80211_local *local,
163 continue; 160 continue;
164 161
165 /* Tell AP we're back */ 162 /* Tell AP we're back */
166 if (offchannel_ps_disable && 163 if (sdata->vif.type == NL80211_IFTYPE_STATION &&
167 sdata->vif.type == NL80211_IFTYPE_STATION) { 164 sdata->u.mgd.associated)
168 if (sdata->u.mgd.associated) 165 ieee80211_offchannel_ps_disable(sdata);
169 ieee80211_offchannel_ps_disable(sdata);
170 }
171 166
172 if (sdata->vif.type != NL80211_IFTYPE_MONITOR) { 167 if (sdata->vif.type != NL80211_IFTYPE_MONITOR) {
173 /* 168 /*
@@ -385,7 +380,7 @@ void ieee80211_sw_roc_work(struct work_struct *work)
385 local->tmp_channel = NULL; 380 local->tmp_channel = NULL;
386 ieee80211_hw_config(local, 0); 381 ieee80211_hw_config(local, 0);
387 382
388 ieee80211_offchannel_return(local, true); 383 ieee80211_offchannel_return(local);
389 } 384 }
390 385
391 ieee80211_recalc_idle(local); 386 ieee80211_recalc_idle(local);
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 8ed83dcc149f..bf82e69d0601 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -113,18 +113,6 @@ ieee80211_bss_info_update(struct ieee80211_local *local,
113 bss->valid_data |= IEEE80211_BSS_VALID_ERP; 113 bss->valid_data |= IEEE80211_BSS_VALID_ERP;
114 } 114 }
115 115
116 if (elems->tim && (!elems->parse_error ||
117 !(bss->valid_data & IEEE80211_BSS_VALID_DTIM))) {
118 struct ieee80211_tim_ie *tim_ie = elems->tim;
119 bss->dtim_period = tim_ie->dtim_period;
120 if (!elems->parse_error)
121 bss->valid_data |= IEEE80211_BSS_VALID_DTIM;
122 }
123
124 /* If the beacon had no TIM IE, or it was invalid, use 1 */
125 if (beacon && !bss->dtim_period)
126 bss->dtim_period = 1;
127
128 /* replace old supported rates if we get new values */ 116 /* replace old supported rates if we get new values */
129 if (!elems->parse_error || 117 if (!elems->parse_error ||
130 !(bss->valid_data & IEEE80211_BSS_VALID_RATES)) { 118 !(bss->valid_data & IEEE80211_BSS_VALID_RATES)) {
@@ -304,7 +292,7 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted,
304 if (!was_hw_scan) { 292 if (!was_hw_scan) {
305 ieee80211_configure_filter(local); 293 ieee80211_configure_filter(local);
306 drv_sw_scan_complete(local); 294 drv_sw_scan_complete(local);
307 ieee80211_offchannel_return(local, true); 295 ieee80211_offchannel_return(local);
308 } 296 }
309 297
310 ieee80211_recalc_idle(local); 298 ieee80211_recalc_idle(local);
@@ -353,7 +341,7 @@ static int ieee80211_start_sw_scan(struct ieee80211_local *local)
353 local->next_scan_state = SCAN_DECISION; 341 local->next_scan_state = SCAN_DECISION;
354 local->scan_channel_idx = 0; 342 local->scan_channel_idx = 0;
355 343
356 ieee80211_offchannel_stop_vifs(local, true); 344 ieee80211_offchannel_stop_vifs(local);
357 345
358 ieee80211_configure_filter(local); 346 ieee80211_configure_filter(local);
359 347
@@ -690,12 +678,8 @@ static void ieee80211_scan_state_suspend(struct ieee80211_local *local,
690 local->scan_channel = NULL; 678 local->scan_channel = NULL;
691 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); 679 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);
692 680
693 /* 681 /* disable PS */
694 * Re-enable vifs and beaconing. Leave PS 682 ieee80211_offchannel_return(local);
695 * in off-channel state..will put that back
696 * on-channel at the end of scanning.
697 */
698 ieee80211_offchannel_return(local, false);
699 683
700 *next_delay = HZ / 5; 684 *next_delay = HZ / 5;
701 /* afterwards, resume scan & go to next channel */ 685 /* afterwards, resume scan & go to next channel */
@@ -705,8 +689,7 @@ static void ieee80211_scan_state_suspend(struct ieee80211_local *local,
705static void ieee80211_scan_state_resume(struct ieee80211_local *local, 689static void ieee80211_scan_state_resume(struct ieee80211_local *local,
706 unsigned long *next_delay) 690 unsigned long *next_delay)
707{ 691{
708 /* PS already is in off-channel mode */ 692 ieee80211_offchannel_stop_vifs(local);
709 ieee80211_offchannel_stop_vifs(local, false);
710 693
711 if (local->ops->flush) { 694 if (local->ops->flush) {
712 drv_flush(local, false); 695 drv_flush(local, false);
@@ -832,9 +815,9 @@ int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata,
832 return res; 815 return res;
833} 816}
834 817
835int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata, 818int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata,
836 const u8 *ssid, u8 ssid_len, 819 const u8 *ssid, u8 ssid_len,
837 struct ieee80211_channel *chan) 820 struct ieee80211_channel *chan)
838{ 821{
839 struct ieee80211_local *local = sdata->local; 822 struct ieee80211_local *local = sdata->local;
840 int ret = -EBUSY; 823 int ret = -EBUSY;
@@ -848,22 +831,36 @@ int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata,
848 831
849 /* fill internal scan request */ 832 /* fill internal scan request */
850 if (!chan) { 833 if (!chan) {
851 int i, nchan = 0; 834 int i, max_n;
835 int n_ch = 0;
852 836
853 for (band = 0; band < IEEE80211_NUM_BANDS; band++) { 837 for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
854 if (!local->hw.wiphy->bands[band]) 838 if (!local->hw.wiphy->bands[band])
855 continue; 839 continue;
856 for (i = 0; 840
857 i < local->hw.wiphy->bands[band]->n_channels; 841 max_n = local->hw.wiphy->bands[band]->n_channels;
858 i++) { 842 for (i = 0; i < max_n; i++) {
859 local->int_scan_req->channels[nchan] = 843 struct ieee80211_channel *tmp_ch =
860 &local->hw.wiphy->bands[band]->channels[i]; 844 &local->hw.wiphy->bands[band]->channels[i];
861 nchan++; 845
846 if (tmp_ch->flags & (IEEE80211_CHAN_NO_IBSS |
847 IEEE80211_CHAN_DISABLED))
848 continue;
849
850 local->int_scan_req->channels[n_ch] = tmp_ch;
851 n_ch++;
862 } 852 }
863 } 853 }
864 854
865 local->int_scan_req->n_channels = nchan; 855 if (WARN_ON_ONCE(n_ch == 0))
856 goto unlock;
857
858 local->int_scan_req->n_channels = n_ch;
866 } else { 859 } else {
860 if (WARN_ON_ONCE(chan->flags & (IEEE80211_CHAN_NO_IBSS |
861 IEEE80211_CHAN_DISABLED)))
862 goto unlock;
863
867 local->int_scan_req->channels[0] = chan; 864 local->int_scan_req->channels[0] = chan;
868 local->int_scan_req->n_channels = 1; 865 local->int_scan_req->n_channels = 1;
869 } 866 }
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index f3e502502fee..ca9fde198188 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -91,9 +91,8 @@ static int sta_info_hash_del(struct ieee80211_local *local,
91 return -ENOENT; 91 return -ENOENT;
92} 92}
93 93
94static void free_sta_work(struct work_struct *wk) 94static void cleanup_single_sta(struct sta_info *sta)
95{ 95{
96 struct sta_info *sta = container_of(wk, struct sta_info, free_sta_wk);
97 int ac, i; 96 int ac, i;
98 struct tid_ampdu_tx *tid_tx; 97 struct tid_ampdu_tx *tid_tx;
99 struct ieee80211_sub_if_data *sdata = sta->sdata; 98 struct ieee80211_sub_if_data *sdata = sta->sdata;
@@ -153,11 +152,35 @@ static void free_sta_work(struct work_struct *wk)
153 sta_info_free(local, sta); 152 sta_info_free(local, sta);
154} 153}
155 154
155void ieee80211_cleanup_sdata_stas(struct ieee80211_sub_if_data *sdata)
156{
157 struct sta_info *sta;
158
159 spin_lock_bh(&sdata->cleanup_stations_lock);
160 while (!list_empty(&sdata->cleanup_stations)) {
161 sta = list_first_entry(&sdata->cleanup_stations,
162 struct sta_info, list);
163 list_del(&sta->list);
164 spin_unlock_bh(&sdata->cleanup_stations_lock);
165
166 cleanup_single_sta(sta);
167
168 spin_lock_bh(&sdata->cleanup_stations_lock);
169 }
170
171 spin_unlock_bh(&sdata->cleanup_stations_lock);
172}
173
156static void free_sta_rcu(struct rcu_head *h) 174static void free_sta_rcu(struct rcu_head *h)
157{ 175{
158 struct sta_info *sta = container_of(h, struct sta_info, rcu_head); 176 struct sta_info *sta = container_of(h, struct sta_info, rcu_head);
177 struct ieee80211_sub_if_data *sdata = sta->sdata;
159 178
160 ieee80211_queue_work(&sta->local->hw, &sta->free_sta_wk); 179 spin_lock(&sdata->cleanup_stations_lock);
180 list_add_tail(&sta->list, &sdata->cleanup_stations);
181 spin_unlock(&sdata->cleanup_stations_lock);
182
183 ieee80211_queue_work(&sdata->local->hw, &sdata->cleanup_stations_wk);
161} 184}
162 185
163/* protected by RCU */ 186/* protected by RCU */
@@ -310,7 +333,6 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,
310 333
311 spin_lock_init(&sta->lock); 334 spin_lock_init(&sta->lock);
312 INIT_WORK(&sta->drv_unblock_wk, sta_unblock); 335 INIT_WORK(&sta->drv_unblock_wk, sta_unblock);
313 INIT_WORK(&sta->free_sta_wk, free_sta_work);
314 INIT_WORK(&sta->ampdu_mlme.work, ieee80211_ba_session_work); 336 INIT_WORK(&sta->ampdu_mlme.work, ieee80211_ba_session_work);
315 mutex_init(&sta->ampdu_mlme.mtx); 337 mutex_init(&sta->ampdu_mlme.mtx);
316 338
@@ -862,7 +884,7 @@ void sta_info_init(struct ieee80211_local *local)
862 884
863void sta_info_stop(struct ieee80211_local *local) 885void sta_info_stop(struct ieee80211_local *local)
864{ 886{
865 del_timer(&local->sta_cleanup); 887 del_timer_sync(&local->sta_cleanup);
866 sta_info_flush(local, NULL); 888 sta_info_flush(local, NULL);
867} 889}
868 890
@@ -891,6 +913,20 @@ int sta_info_flush(struct ieee80211_local *local,
891 } 913 }
892 mutex_unlock(&local->sta_mtx); 914 mutex_unlock(&local->sta_mtx);
893 915
916 rcu_barrier();
917
918 if (sdata) {
919 ieee80211_cleanup_sdata_stas(sdata);
920 cancel_work_sync(&sdata->cleanup_stations_wk);
921 } else {
922 mutex_lock(&local->iflist_mtx);
923 list_for_each_entry(sdata, &local->interfaces, list) {
924 ieee80211_cleanup_sdata_stas(sdata);
925 cancel_work_sync(&sdata->cleanup_stations_wk);
926 }
927 mutex_unlock(&local->iflist_mtx);
928 }
929
894 return ret; 930 return ret;
895} 931}
896 932
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 1489bca9ea97..37c1889afd3a 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -299,7 +299,6 @@ struct sta_info {
299 spinlock_t lock; 299 spinlock_t lock;
300 300
301 struct work_struct drv_unblock_wk; 301 struct work_struct drv_unblock_wk;
302 struct work_struct free_sta_wk;
303 302
304 u16 listen_interval; 303 u16 listen_interval;
305 304
@@ -563,4 +562,6 @@ void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta);
563void ieee80211_sta_ps_deliver_poll_response(struct sta_info *sta); 562void ieee80211_sta_ps_deliver_poll_response(struct sta_info *sta);
564void ieee80211_sta_ps_deliver_uapsd(struct sta_info *sta); 563void ieee80211_sta_ps_deliver_uapsd(struct sta_info *sta);
565 564
565void ieee80211_cleanup_sdata_stas(struct ieee80211_sub_if_data *sdata);
566
566#endif /* STA_INFO_H */ 567#endif /* STA_INFO_H */
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index e9eadc40c09c..467c1d1b66f2 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1673,10 +1673,13 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
1673 chanctx_conf = 1673 chanctx_conf =
1674 rcu_dereference(tmp_sdata->vif.chanctx_conf); 1674 rcu_dereference(tmp_sdata->vif.chanctx_conf);
1675 } 1675 }
1676 if (!chanctx_conf)
1677 goto fail_rcu;
1678 1676
1679 chan = chanctx_conf->def.chan; 1677 if (chanctx_conf)
1678 chan = chanctx_conf->def.chan;
1679 else if (!local->use_chanctx)
1680 chan = local->_oper_channel;
1681 else
1682 goto fail_rcu;
1680 1683
1681 /* 1684 /*
1682 * Frame injection is not allowed if beaconing is not allowed 1685 * Frame injection is not allowed if beaconing is not allowed
diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c
index 1191039c2b1b..199b92261e94 100644
--- a/net/mac802154/wpan.c
+++ b/net/mac802154/wpan.c
@@ -389,7 +389,7 @@ void mac802154_wpan_setup(struct net_device *dev)
389 389
390static int mac802154_process_data(struct net_device *dev, struct sk_buff *skb) 390static int mac802154_process_data(struct net_device *dev, struct sk_buff *skb)
391{ 391{
392 return netif_rx(skb); 392 return netif_rx_ni(skb);
393} 393}
394 394
395static int 395static int
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig
index fefa514b9917..49e96df5fbc4 100644
--- a/net/netfilter/Kconfig
+++ b/net/netfilter/Kconfig
@@ -680,6 +680,13 @@ config NETFILTER_XT_TARGET_NFQUEUE
680 680
681 To compile it as a module, choose M here. If unsure, say N. 681 To compile it as a module, choose M here. If unsure, say N.
682 682
683config NETFILTER_XT_TARGET_NOTRACK
684 tristate '"NOTRACK" target support (DEPRECATED)'
685 depends on NF_CONNTRACK
686 depends on IP_NF_RAW || IP6_NF_RAW
687 depends on NETFILTER_ADVANCED
688 select NETFILTER_XT_TARGET_CT
689
683config NETFILTER_XT_TARGET_RATEEST 690config NETFILTER_XT_TARGET_RATEEST
684 tristate '"RATEEST" target support' 691 tristate '"RATEEST" target support'
685 depends on NETFILTER_ADVANCED 692 depends on NETFILTER_ADVANCED
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 08cdc71d8e87..e4a0c4fb3a7c 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -1376,11 +1376,12 @@ void nf_conntrack_cleanup(struct net *net)
1376 synchronize_net(); 1376 synchronize_net();
1377 nf_conntrack_proto_fini(net); 1377 nf_conntrack_proto_fini(net);
1378 nf_conntrack_cleanup_net(net); 1378 nf_conntrack_cleanup_net(net);
1379}
1379 1380
1380 if (net_eq(net, &init_net)) { 1381void nf_conntrack_cleanup_end(void)
1381 RCU_INIT_POINTER(nf_ct_destroy, NULL); 1382{
1382 nf_conntrack_cleanup_init_net(); 1383 RCU_INIT_POINTER(nf_ct_destroy, NULL);
1383 } 1384 nf_conntrack_cleanup_init_net();
1384} 1385}
1385 1386
1386void *nf_ct_alloc_hashtable(unsigned int *sizep, int nulls) 1387void *nf_ct_alloc_hashtable(unsigned int *sizep, int nulls)
@@ -1526,6 +1527,7 @@ err_extend:
1526 */ 1527 */
1527#define UNCONFIRMED_NULLS_VAL ((1<<30)+0) 1528#define UNCONFIRMED_NULLS_VAL ((1<<30)+0)
1528#define DYING_NULLS_VAL ((1<<30)+1) 1529#define DYING_NULLS_VAL ((1<<30)+1)
1530#define TEMPLATE_NULLS_VAL ((1<<30)+2)
1529 1531
1530static int nf_conntrack_init_net(struct net *net) 1532static int nf_conntrack_init_net(struct net *net)
1531{ 1533{
@@ -1534,6 +1536,7 @@ static int nf_conntrack_init_net(struct net *net)
1534 atomic_set(&net->ct.count, 0); 1536 atomic_set(&net->ct.count, 0);
1535 INIT_HLIST_NULLS_HEAD(&net->ct.unconfirmed, UNCONFIRMED_NULLS_VAL); 1537 INIT_HLIST_NULLS_HEAD(&net->ct.unconfirmed, UNCONFIRMED_NULLS_VAL);
1536 INIT_HLIST_NULLS_HEAD(&net->ct.dying, DYING_NULLS_VAL); 1538 INIT_HLIST_NULLS_HEAD(&net->ct.dying, DYING_NULLS_VAL);
1539 INIT_HLIST_NULLS_HEAD(&net->ct.tmpl, TEMPLATE_NULLS_VAL);
1537 net->ct.stat = alloc_percpu(struct ip_conntrack_stat); 1540 net->ct.stat = alloc_percpu(struct ip_conntrack_stat);
1538 if (!net->ct.stat) { 1541 if (!net->ct.stat) {
1539 ret = -ENOMEM; 1542 ret = -ENOMEM;
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 4e078cd84d83..627b0e50b238 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -2624,7 +2624,7 @@ ctnetlink_create_expect(struct net *net, u16 zone,
2624 if (!help) { 2624 if (!help) {
2625 if (!cda[CTA_EXPECT_TIMEOUT]) { 2625 if (!cda[CTA_EXPECT_TIMEOUT]) {
2626 err = -EINVAL; 2626 err = -EINVAL;
2627 goto out; 2627 goto err_out;
2628 } 2628 }
2629 exp->timeout.expires = 2629 exp->timeout.expires =
2630 jiffies + ntohl(nla_get_be32(cda[CTA_EXPECT_TIMEOUT])) * HZ; 2630 jiffies + ntohl(nla_get_be32(cda[CTA_EXPECT_TIMEOUT])) * HZ;
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c
index 363285d544a1..e7185c684816 100644
--- a/net/netfilter/nf_conntrack_standalone.c
+++ b/net/netfilter/nf_conntrack_standalone.c
@@ -575,6 +575,7 @@ static int __init nf_conntrack_standalone_init(void)
575static void __exit nf_conntrack_standalone_fini(void) 575static void __exit nf_conntrack_standalone_fini(void)
576{ 576{
577 unregister_pernet_subsys(&nf_conntrack_net_ops); 577 unregister_pernet_subsys(&nf_conntrack_net_ops);
578 nf_conntrack_cleanup_end();
578} 579}
579 580
580module_init(nf_conntrack_standalone_init); 581module_init(nf_conntrack_standalone_init);
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index 9f199f2e31fa..92fd8eca0d31 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -13,6 +13,7 @@
13 */ 13 */
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/skbuff.h> 15#include <linux/skbuff.h>
16#include <linux/if_arp.h>
16#include <linux/init.h> 17#include <linux/init.h>
17#include <linux/ip.h> 18#include <linux/ip.h>
18#include <linux/ipv6.h> 19#include <linux/ipv6.h>
@@ -384,6 +385,7 @@ __build_packet_message(struct nfulnl_instance *inst,
384 struct nfgenmsg *nfmsg; 385 struct nfgenmsg *nfmsg;
385 sk_buff_data_t old_tail = inst->skb->tail; 386 sk_buff_data_t old_tail = inst->skb->tail;
386 struct sock *sk; 387 struct sock *sk;
388 const unsigned char *hwhdrp;
387 389
388 nlh = nlmsg_put(inst->skb, 0, 0, 390 nlh = nlmsg_put(inst->skb, 0, 0,
389 NFNL_SUBSYS_ULOG << 8 | NFULNL_MSG_PACKET, 391 NFNL_SUBSYS_ULOG << 8 | NFULNL_MSG_PACKET,
@@ -485,9 +487,17 @@ __build_packet_message(struct nfulnl_instance *inst,
485 if (indev && skb_mac_header_was_set(skb)) { 487 if (indev && skb_mac_header_was_set(skb)) {
486 if (nla_put_be16(inst->skb, NFULA_HWTYPE, htons(skb->dev->type)) || 488 if (nla_put_be16(inst->skb, NFULA_HWTYPE, htons(skb->dev->type)) ||
487 nla_put_be16(inst->skb, NFULA_HWLEN, 489 nla_put_be16(inst->skb, NFULA_HWLEN,
488 htons(skb->dev->hard_header_len)) || 490 htons(skb->dev->hard_header_len)))
489 nla_put(inst->skb, NFULA_HWHEADER, skb->dev->hard_header_len, 491 goto nla_put_failure;
490 skb_mac_header(skb))) 492
493 hwhdrp = skb_mac_header(skb);
494
495 if (skb->dev->type == ARPHRD_SIT)
496 hwhdrp -= ETH_HLEN;
497
498 if (hwhdrp >= skb->head &&
499 nla_put(inst->skb, NFULA_HWHEADER,
500 skb->dev->hard_header_len, hwhdrp))
491 goto nla_put_failure; 501 goto nla_put_failure;
492 } 502 }
493 503
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index 8d987c3573fd..7b3a9e5999c0 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -345,19 +345,27 @@ int xt_find_revision(u8 af, const char *name, u8 revision, int target,
345} 345}
346EXPORT_SYMBOL_GPL(xt_find_revision); 346EXPORT_SYMBOL_GPL(xt_find_revision);
347 347
348static char *textify_hooks(char *buf, size_t size, unsigned int mask) 348static char *
349textify_hooks(char *buf, size_t size, unsigned int mask, uint8_t nfproto)
349{ 350{
350 static const char *const names[] = { 351 static const char *const inetbr_names[] = {
351 "PREROUTING", "INPUT", "FORWARD", 352 "PREROUTING", "INPUT", "FORWARD",
352 "OUTPUT", "POSTROUTING", "BROUTING", 353 "OUTPUT", "POSTROUTING", "BROUTING",
353 }; 354 };
354 unsigned int i; 355 static const char *const arp_names[] = {
356 "INPUT", "FORWARD", "OUTPUT",
357 };
358 const char *const *names;
359 unsigned int i, max;
355 char *p = buf; 360 char *p = buf;
356 bool np = false; 361 bool np = false;
357 int res; 362 int res;
358 363
364 names = (nfproto == NFPROTO_ARP) ? arp_names : inetbr_names;
365 max = (nfproto == NFPROTO_ARP) ? ARRAY_SIZE(arp_names) :
366 ARRAY_SIZE(inetbr_names);
359 *p = '\0'; 367 *p = '\0';
360 for (i = 0; i < ARRAY_SIZE(names); ++i) { 368 for (i = 0; i < max; ++i) {
361 if (!(mask & (1 << i))) 369 if (!(mask & (1 << i)))
362 continue; 370 continue;
363 res = snprintf(p, size, "%s%s", np ? "/" : "", names[i]); 371 res = snprintf(p, size, "%s%s", np ? "/" : "", names[i]);
@@ -402,8 +410,10 @@ int xt_check_match(struct xt_mtchk_param *par,
402 pr_err("%s_tables: %s match: used from hooks %s, but only " 410 pr_err("%s_tables: %s match: used from hooks %s, but only "
403 "valid from %s\n", 411 "valid from %s\n",
404 xt_prefix[par->family], par->match->name, 412 xt_prefix[par->family], par->match->name,
405 textify_hooks(used, sizeof(used), par->hook_mask), 413 textify_hooks(used, sizeof(used), par->hook_mask,
406 textify_hooks(allow, sizeof(allow), par->match->hooks)); 414 par->family),
415 textify_hooks(allow, sizeof(allow), par->match->hooks,
416 par->family));
407 return -EINVAL; 417 return -EINVAL;
408 } 418 }
409 if (par->match->proto && (par->match->proto != proto || inv_proto)) { 419 if (par->match->proto && (par->match->proto != proto || inv_proto)) {
@@ -575,8 +585,10 @@ int xt_check_target(struct xt_tgchk_param *par,
575 pr_err("%s_tables: %s target: used from hooks %s, but only " 585 pr_err("%s_tables: %s target: used from hooks %s, but only "
576 "usable from %s\n", 586 "usable from %s\n",
577 xt_prefix[par->family], par->target->name, 587 xt_prefix[par->family], par->target->name,
578 textify_hooks(used, sizeof(used), par->hook_mask), 588 textify_hooks(used, sizeof(used), par->hook_mask,
579 textify_hooks(allow, sizeof(allow), par->target->hooks)); 589 par->family),
590 textify_hooks(allow, sizeof(allow), par->target->hooks,
591 par->family));
580 return -EINVAL; 592 return -EINVAL;
581 } 593 }
582 if (par->target->proto && (par->target->proto != proto || inv_proto)) { 594 if (par->target->proto && (par->target->proto != proto || inv_proto)) {
diff --git a/net/netfilter/xt_CT.c b/net/netfilter/xt_CT.c
index ae7f5daeee43..bde009ed8d3b 100644
--- a/net/netfilter/xt_CT.c
+++ b/net/netfilter/xt_CT.c
@@ -109,7 +109,7 @@ static int xt_ct_tg_check_v0(const struct xt_tgchk_param *par)
109 struct xt_ct_target_info *info = par->targinfo; 109 struct xt_ct_target_info *info = par->targinfo;
110 struct nf_conntrack_tuple t; 110 struct nf_conntrack_tuple t;
111 struct nf_conn *ct; 111 struct nf_conn *ct;
112 int ret; 112 int ret = -EOPNOTSUPP;
113 113
114 if (info->flags & ~XT_CT_NOTRACK) 114 if (info->flags & ~XT_CT_NOTRACK)
115 return -EINVAL; 115 return -EINVAL;
@@ -149,6 +149,10 @@ static int xt_ct_tg_check_v0(const struct xt_tgchk_param *par)
149 149
150 __set_bit(IPS_TEMPLATE_BIT, &ct->status); 150 __set_bit(IPS_TEMPLATE_BIT, &ct->status);
151 __set_bit(IPS_CONFIRMED_BIT, &ct->status); 151 __set_bit(IPS_CONFIRMED_BIT, &ct->status);
152
153 /* Overload tuple linked list to put us in template list. */
154 hlist_nulls_add_head_rcu(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnnode,
155 &par->net->ct.tmpl);
152out: 156out:
153 info->ct = ct; 157 info->ct = ct;
154 return 0; 158 return 0;
@@ -243,7 +247,7 @@ static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par)
243 struct xt_ct_target_info_v1 *info = par->targinfo; 247 struct xt_ct_target_info_v1 *info = par->targinfo;
244 struct nf_conntrack_tuple t; 248 struct nf_conntrack_tuple t;
245 struct nf_conn *ct; 249 struct nf_conn *ct;
246 int ret; 250 int ret = -EOPNOTSUPP;
247 251
248 if (info->flags & ~XT_CT_NOTRACK) 252 if (info->flags & ~XT_CT_NOTRACK)
249 return -EINVAL; 253 return -EINVAL;
@@ -289,6 +293,10 @@ static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par)
289 293
290 __set_bit(IPS_TEMPLATE_BIT, &ct->status); 294 __set_bit(IPS_TEMPLATE_BIT, &ct->status);
291 __set_bit(IPS_CONFIRMED_BIT, &ct->status); 295 __set_bit(IPS_CONFIRMED_BIT, &ct->status);
296
297 /* Overload tuple linked list to put us in template list. */
298 hlist_nulls_add_head_rcu(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnnode,
299 &par->net->ct.tmpl);
292out: 300out:
293 info->ct = ct; 301 info->ct = ct;
294 return 0; 302 return 0;
@@ -377,14 +385,60 @@ static struct xt_target xt_ct_tg_reg[] __read_mostly = {
377 }, 385 },
378}; 386};
379 387
388static unsigned int
389notrack_tg(struct sk_buff *skb, const struct xt_action_param *par)
390{
391 /* Previously seen (loopback)? Ignore. */
392 if (skb->nfct != NULL)
393 return XT_CONTINUE;
394
395 skb->nfct = &nf_ct_untracked_get()->ct_general;
396 skb->nfctinfo = IP_CT_NEW;
397 nf_conntrack_get(skb->nfct);
398
399 return XT_CONTINUE;
400}
401
402static int notrack_chk(const struct xt_tgchk_param *par)
403{
404 if (!par->net->xt.notrack_deprecated_warning) {
405 pr_info("netfilter: NOTRACK target is deprecated, "
406 "use CT instead or upgrade iptables\n");
407 par->net->xt.notrack_deprecated_warning = true;
408 }
409 return 0;
410}
411
412static struct xt_target notrack_tg_reg __read_mostly = {
413 .name = "NOTRACK",
414 .revision = 0,
415 .family = NFPROTO_UNSPEC,
416 .checkentry = notrack_chk,
417 .target = notrack_tg,
418 .table = "raw",
419 .me = THIS_MODULE,
420};
421
380static int __init xt_ct_tg_init(void) 422static int __init xt_ct_tg_init(void)
381{ 423{
382 return xt_register_targets(xt_ct_tg_reg, ARRAY_SIZE(xt_ct_tg_reg)); 424 int ret;
425
426 ret = xt_register_target(&notrack_tg_reg);
427 if (ret < 0)
428 return ret;
429
430 ret = xt_register_targets(xt_ct_tg_reg, ARRAY_SIZE(xt_ct_tg_reg));
431 if (ret < 0) {
432 xt_unregister_target(&notrack_tg_reg);
433 return ret;
434 }
435 return 0;
383} 436}
384 437
385static void __exit xt_ct_tg_exit(void) 438static void __exit xt_ct_tg_exit(void)
386{ 439{
387 xt_unregister_targets(xt_ct_tg_reg, ARRAY_SIZE(xt_ct_tg_reg)); 440 xt_unregister_targets(xt_ct_tg_reg, ARRAY_SIZE(xt_ct_tg_reg));
441 xt_unregister_target(&notrack_tg_reg);
388} 442}
389 443
390module_init(xt_ct_tg_init); 444module_init(xt_ct_tg_init);
@@ -394,3 +448,5 @@ MODULE_LICENSE("GPL");
394MODULE_DESCRIPTION("Xtables: connection tracking target"); 448MODULE_DESCRIPTION("Xtables: connection tracking target");
395MODULE_ALIAS("ipt_CT"); 449MODULE_ALIAS("ipt_CT");
396MODULE_ALIAS("ip6t_CT"); 450MODULE_ALIAS("ip6t_CT");
451MODULE_ALIAS("ipt_NOTRACK");
452MODULE_ALIAS("ip6t_NOTRACK");
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 26a668a84aa2..a9d7af953ceb 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -157,11 +157,22 @@ dsthash_find(const struct xt_hashlimit_htable *ht,
157/* allocate dsthash_ent, initialize dst, put in htable and lock it */ 157/* allocate dsthash_ent, initialize dst, put in htable and lock it */
158static struct dsthash_ent * 158static struct dsthash_ent *
159dsthash_alloc_init(struct xt_hashlimit_htable *ht, 159dsthash_alloc_init(struct xt_hashlimit_htable *ht,
160 const struct dsthash_dst *dst) 160 const struct dsthash_dst *dst, bool *race)
161{ 161{
162 struct dsthash_ent *ent; 162 struct dsthash_ent *ent;
163 163
164 spin_lock(&ht->lock); 164 spin_lock(&ht->lock);
165
166 /* Two or more packets may race to create the same entry in the
167 * hashtable, double check if this packet lost race.
168 */
169 ent = dsthash_find(ht, dst);
170 if (ent != NULL) {
171 spin_unlock(&ht->lock);
172 *race = true;
173 return ent;
174 }
175
165 /* initialize hash with random val at the time we allocate 176 /* initialize hash with random val at the time we allocate
166 * the first hashtable entry */ 177 * the first hashtable entry */
167 if (unlikely(!ht->rnd_initialized)) { 178 if (unlikely(!ht->rnd_initialized)) {
@@ -318,7 +329,10 @@ static void htable_destroy(struct xt_hashlimit_htable *hinfo)
318 parent = hashlimit_net->ipt_hashlimit; 329 parent = hashlimit_net->ipt_hashlimit;
319 else 330 else
320 parent = hashlimit_net->ip6t_hashlimit; 331 parent = hashlimit_net->ip6t_hashlimit;
321 remove_proc_entry(hinfo->pde->name, parent); 332
333 if(parent != NULL)
334 remove_proc_entry(hinfo->pde->name, parent);
335
322 htable_selective_cleanup(hinfo, select_all); 336 htable_selective_cleanup(hinfo, select_all);
323 vfree(hinfo); 337 vfree(hinfo);
324} 338}
@@ -585,6 +599,7 @@ hashlimit_mt(const struct sk_buff *skb, struct xt_action_param *par)
585 unsigned long now = jiffies; 599 unsigned long now = jiffies;
586 struct dsthash_ent *dh; 600 struct dsthash_ent *dh;
587 struct dsthash_dst dst; 601 struct dsthash_dst dst;
602 bool race = false;
588 u32 cost; 603 u32 cost;
589 604
590 if (hashlimit_init_dst(hinfo, &dst, skb, par->thoff) < 0) 605 if (hashlimit_init_dst(hinfo, &dst, skb, par->thoff) < 0)
@@ -593,13 +608,18 @@ hashlimit_mt(const struct sk_buff *skb, struct xt_action_param *par)
593 rcu_read_lock_bh(); 608 rcu_read_lock_bh();
594 dh = dsthash_find(hinfo, &dst); 609 dh = dsthash_find(hinfo, &dst);
595 if (dh == NULL) { 610 if (dh == NULL) {
596 dh = dsthash_alloc_init(hinfo, &dst); 611 dh = dsthash_alloc_init(hinfo, &dst, &race);
597 if (dh == NULL) { 612 if (dh == NULL) {
598 rcu_read_unlock_bh(); 613 rcu_read_unlock_bh();
599 goto hotdrop; 614 goto hotdrop;
615 } else if (race) {
616 /* Already got an entry, update expiration timeout */
617 dh->expires = now + msecs_to_jiffies(hinfo->cfg.expire);
618 rateinfo_recalc(dh, now, hinfo->cfg.mode);
619 } else {
620 dh->expires = jiffies + msecs_to_jiffies(hinfo->cfg.expire);
621 rateinfo_init(dh, hinfo);
600 } 622 }
601 dh->expires = jiffies + msecs_to_jiffies(hinfo->cfg.expire);
602 rateinfo_init(dh, hinfo);
603 } else { 623 } else {
604 /* update expiration timeout */ 624 /* update expiration timeout */
605 dh->expires = now + msecs_to_jiffies(hinfo->cfg.expire); 625 dh->expires = now + msecs_to_jiffies(hinfo->cfg.expire);
@@ -856,6 +876,27 @@ static int __net_init hashlimit_proc_net_init(struct net *net)
856 876
857static void __net_exit hashlimit_proc_net_exit(struct net *net) 877static void __net_exit hashlimit_proc_net_exit(struct net *net)
858{ 878{
879 struct xt_hashlimit_htable *hinfo;
880 struct hlist_node *pos;
881 struct proc_dir_entry *pde;
882 struct hashlimit_net *hashlimit_net = hashlimit_pernet(net);
883
884 /* recent_net_exit() is called before recent_mt_destroy(). Make sure
885 * that the parent xt_recent proc entry is is empty before trying to
886 * remove it.
887 */
888 mutex_lock(&hashlimit_mutex);
889 pde = hashlimit_net->ipt_hashlimit;
890 if (pde == NULL)
891 pde = hashlimit_net->ip6t_hashlimit;
892
893 hlist_for_each_entry(hinfo, pos, &hashlimit_net->htables, node)
894 remove_proc_entry(hinfo->pde->name, pde);
895
896 hashlimit_net->ipt_hashlimit = NULL;
897 hashlimit_net->ip6t_hashlimit = NULL;
898 mutex_unlock(&hashlimit_mutex);
899
859 proc_net_remove(net, "ipt_hashlimit"); 900 proc_net_remove(net, "ipt_hashlimit");
860#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) 901#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES)
861 proc_net_remove(net, "ip6t_hashlimit"); 902 proc_net_remove(net, "ip6t_hashlimit");
@@ -872,9 +913,6 @@ static int __net_init hashlimit_net_init(struct net *net)
872 913
873static void __net_exit hashlimit_net_exit(struct net *net) 914static void __net_exit hashlimit_net_exit(struct net *net)
874{ 915{
875 struct hashlimit_net *hashlimit_net = hashlimit_pernet(net);
876
877 BUG_ON(!hlist_empty(&hashlimit_net->htables));
878 hashlimit_proc_net_exit(net); 916 hashlimit_proc_net_exit(net);
879} 917}
880 918
diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c
index 4635c9b00459..978efc9b555a 100644
--- a/net/netfilter/xt_recent.c
+++ b/net/netfilter/xt_recent.c
@@ -29,6 +29,7 @@
29#include <linux/skbuff.h> 29#include <linux/skbuff.h>
30#include <linux/inet.h> 30#include <linux/inet.h>
31#include <linux/slab.h> 31#include <linux/slab.h>
32#include <linux/vmalloc.h>
32#include <net/net_namespace.h> 33#include <net/net_namespace.h>
33#include <net/netns/generic.h> 34#include <net/netns/generic.h>
34 35
@@ -310,6 +311,14 @@ out:
310 return ret; 311 return ret;
311} 312}
312 313
314static void recent_table_free(void *addr)
315{
316 if (is_vmalloc_addr(addr))
317 vfree(addr);
318 else
319 kfree(addr);
320}
321
313static int recent_mt_check(const struct xt_mtchk_param *par, 322static int recent_mt_check(const struct xt_mtchk_param *par,
314 const struct xt_recent_mtinfo_v1 *info) 323 const struct xt_recent_mtinfo_v1 *info)
315{ 324{
@@ -322,6 +331,7 @@ static int recent_mt_check(const struct xt_mtchk_param *par,
322#endif 331#endif
323 unsigned int i; 332 unsigned int i;
324 int ret = -EINVAL; 333 int ret = -EINVAL;
334 size_t sz;
325 335
326 if (unlikely(!hash_rnd_inited)) { 336 if (unlikely(!hash_rnd_inited)) {
327 get_random_bytes(&hash_rnd, sizeof(hash_rnd)); 337 get_random_bytes(&hash_rnd, sizeof(hash_rnd));
@@ -360,8 +370,11 @@ static int recent_mt_check(const struct xt_mtchk_param *par,
360 goto out; 370 goto out;
361 } 371 }
362 372
363 t = kzalloc(sizeof(*t) + sizeof(t->iphash[0]) * ip_list_hash_size, 373 sz = sizeof(*t) + sizeof(t->iphash[0]) * ip_list_hash_size;
364 GFP_KERNEL); 374 if (sz <= PAGE_SIZE)
375 t = kzalloc(sz, GFP_KERNEL);
376 else
377 t = vzalloc(sz);
365 if (t == NULL) { 378 if (t == NULL) {
366 ret = -ENOMEM; 379 ret = -ENOMEM;
367 goto out; 380 goto out;
@@ -377,14 +390,14 @@ static int recent_mt_check(const struct xt_mtchk_param *par,
377 uid = make_kuid(&init_user_ns, ip_list_uid); 390 uid = make_kuid(&init_user_ns, ip_list_uid);
378 gid = make_kgid(&init_user_ns, ip_list_gid); 391 gid = make_kgid(&init_user_ns, ip_list_gid);
379 if (!uid_valid(uid) || !gid_valid(gid)) { 392 if (!uid_valid(uid) || !gid_valid(gid)) {
380 kfree(t); 393 recent_table_free(t);
381 ret = -EINVAL; 394 ret = -EINVAL;
382 goto out; 395 goto out;
383 } 396 }
384 pde = proc_create_data(t->name, ip_list_perms, recent_net->xt_recent, 397 pde = proc_create_data(t->name, ip_list_perms, recent_net->xt_recent,
385 &recent_mt_fops, t); 398 &recent_mt_fops, t);
386 if (pde == NULL) { 399 if (pde == NULL) {
387 kfree(t); 400 recent_table_free(t);
388 ret = -ENOMEM; 401 ret = -ENOMEM;
389 goto out; 402 goto out;
390 } 403 }
@@ -431,10 +444,11 @@ static void recent_mt_destroy(const struct xt_mtdtor_param *par)
431 list_del(&t->list); 444 list_del(&t->list);
432 spin_unlock_bh(&recent_lock); 445 spin_unlock_bh(&recent_lock);
433#ifdef CONFIG_PROC_FS 446#ifdef CONFIG_PROC_FS
434 remove_proc_entry(t->name, recent_net->xt_recent); 447 if (recent_net->xt_recent != NULL)
448 remove_proc_entry(t->name, recent_net->xt_recent);
435#endif 449#endif
436 recent_table_flush(t); 450 recent_table_flush(t);
437 kfree(t); 451 recent_table_free(t);
438 } 452 }
439 mutex_unlock(&recent_mutex); 453 mutex_unlock(&recent_mutex);
440} 454}
@@ -615,6 +629,20 @@ static int __net_init recent_proc_net_init(struct net *net)
615 629
616static void __net_exit recent_proc_net_exit(struct net *net) 630static void __net_exit recent_proc_net_exit(struct net *net)
617{ 631{
632 struct recent_net *recent_net = recent_pernet(net);
633 struct recent_table *t;
634
635 /* recent_net_exit() is called before recent_mt_destroy(). Make sure
636 * that the parent xt_recent proc entry is is empty before trying to
637 * remove it.
638 */
639 spin_lock_bh(&recent_lock);
640 list_for_each_entry(t, &recent_net->tables, list)
641 remove_proc_entry(t->name, recent_net->xt_recent);
642
643 recent_net->xt_recent = NULL;
644 spin_unlock_bh(&recent_lock);
645
618 proc_net_remove(net, "xt_recent"); 646 proc_net_remove(net, "xt_recent");
619} 647}
620#else 648#else
@@ -638,9 +666,6 @@ static int __net_init recent_net_init(struct net *net)
638 666
639static void __net_exit recent_net_exit(struct net *net) 667static void __net_exit recent_net_exit(struct net *net)
640{ 668{
641 struct recent_net *recent_net = recent_pernet(net);
642
643 BUG_ON(!list_empty(&recent_net->tables));
644 recent_proc_net_exit(net); 669 recent_proc_net_exit(net);
645} 670}
646 671
diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
index a1e116277477..31b74f5e61ad 100644
--- a/net/rds/ib_cm.c
+++ b/net/rds/ib_cm.c
@@ -434,12 +434,11 @@ static u32 rds_ib_protocol_compatible(struct rdma_cm_event *event)
434 version = RDS_PROTOCOL_3_0; 434 version = RDS_PROTOCOL_3_0;
435 while ((common >>= 1) != 0) 435 while ((common >>= 1) != 0)
436 version++; 436 version++;
437 } 437 } else
438 printk_ratelimited(KERN_NOTICE "RDS: Connection from %pI4 using " 438 printk_ratelimited(KERN_NOTICE "RDS: Connection from %pI4 using incompatible protocol version %u.%u\n",
439 "incompatible protocol version %u.%u\n", 439 &dp->dp_saddr,
440 &dp->dp_saddr, 440 dp->dp_protocol_major,
441 dp->dp_protocol_major, 441 dp->dp_protocol_minor);
442 dp->dp_protocol_minor);
443 return version; 442 return version;
444} 443}
445 444
diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c
index 8c5bc857f04d..8eb9501e3d60 100644
--- a/net/rds/ib_recv.c
+++ b/net/rds/ib_recv.c
@@ -339,8 +339,8 @@ static int rds_ib_recv_refill_one(struct rds_connection *conn,
339 sge->length = sizeof(struct rds_header); 339 sge->length = sizeof(struct rds_header);
340 340
341 sge = &recv->r_sge[1]; 341 sge = &recv->r_sge[1];
342 sge->addr = sg_dma_address(&recv->r_frag->f_sg); 342 sge->addr = ib_sg_dma_address(ic->i_cm_id->device, &recv->r_frag->f_sg);
343 sge->length = sg_dma_len(&recv->r_frag->f_sg); 343 sge->length = ib_sg_dma_len(ic->i_cm_id->device, &recv->r_frag->f_sg);
344 344
345 ret = 0; 345 ret = 0;
346out: 346out:
@@ -381,7 +381,10 @@ void rds_ib_recv_refill(struct rds_connection *conn, int prefill)
381 ret = ib_post_recv(ic->i_cm_id->qp, &recv->r_wr, &failed_wr); 381 ret = ib_post_recv(ic->i_cm_id->qp, &recv->r_wr, &failed_wr);
382 rdsdebug("recv %p ibinc %p page %p addr %lu ret %d\n", recv, 382 rdsdebug("recv %p ibinc %p page %p addr %lu ret %d\n", recv,
383 recv->r_ibinc, sg_page(&recv->r_frag->f_sg), 383 recv->r_ibinc, sg_page(&recv->r_frag->f_sg),
384 (long) sg_dma_address(&recv->r_frag->f_sg), ret); 384 (long) ib_sg_dma_address(
385 ic->i_cm_id->device,
386 &recv->r_frag->f_sg),
387 ret);
385 if (ret) { 388 if (ret) {
386 rds_ib_conn_error(conn, "recv post on " 389 rds_ib_conn_error(conn, "recv post on "
387 "%pI4 returned %d, disconnecting and " 390 "%pI4 returned %d, disconnecting and "
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index d2922c0ef57a..51561eafcb72 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -919,7 +919,7 @@ ok:
919 q->now = ktime_to_ns(ktime_get()); 919 q->now = ktime_to_ns(ktime_get());
920 start_at = jiffies; 920 start_at = jiffies;
921 921
922 next_event = q->now + 5 * NSEC_PER_SEC; 922 next_event = q->now + 5LLU * NSEC_PER_SEC;
923 923
924 for (level = 0; level < TC_HTB_MAXDEPTH; level++) { 924 for (level = 0; level < TC_HTB_MAXDEPTH; level++) {
925 /* common case optimization - skip event handler quickly */ 925 /* common case optimization - skip event handler quickly */
diff --git a/net/sctp/Kconfig b/net/sctp/Kconfig
index c26210618e14..7521d944c0fb 100644
--- a/net/sctp/Kconfig
+++ b/net/sctp/Kconfig
@@ -68,7 +68,7 @@ config SCTP_DBG_OBJCNT
68 If unsure, say N 68 If unsure, say N
69choice 69choice
70 prompt "Default SCTP cookie HMAC encoding" 70 prompt "Default SCTP cookie HMAC encoding"
71 default SCTP_COOKIE_HMAC_MD5 71 default SCTP_DEFAULT_COOKIE_HMAC_MD5
72 help 72 help
73 This option sets the default sctp cookie hmac algorithm 73 This option sets the default sctp cookie hmac algorithm
74 when in doubt select 'md5' 74 when in doubt select 'md5'
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
index 379c81dee9d1..9bcdbd02d777 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -224,7 +224,7 @@ void sctp_outq_init(struct sctp_association *asoc, struct sctp_outq *q)
224 224
225/* Free the outqueue structure and any related pending chunks. 225/* Free the outqueue structure and any related pending chunks.
226 */ 226 */
227void sctp_outq_teardown(struct sctp_outq *q) 227static void __sctp_outq_teardown(struct sctp_outq *q)
228{ 228{
229 struct sctp_transport *transport; 229 struct sctp_transport *transport;
230 struct list_head *lchunk, *temp; 230 struct list_head *lchunk, *temp;
@@ -277,8 +277,6 @@ void sctp_outq_teardown(struct sctp_outq *q)
277 sctp_chunk_free(chunk); 277 sctp_chunk_free(chunk);
278 } 278 }
279 279
280 q->error = 0;
281
282 /* Throw away any leftover control chunks. */ 280 /* Throw away any leftover control chunks. */
283 list_for_each_entry_safe(chunk, tmp, &q->control_chunk_list, list) { 281 list_for_each_entry_safe(chunk, tmp, &q->control_chunk_list, list) {
284 list_del_init(&chunk->list); 282 list_del_init(&chunk->list);
@@ -286,11 +284,17 @@ void sctp_outq_teardown(struct sctp_outq *q)
286 } 284 }
287} 285}
288 286
287void sctp_outq_teardown(struct sctp_outq *q)
288{
289 __sctp_outq_teardown(q);
290 sctp_outq_init(q->asoc, q);
291}
292
289/* Free the outqueue structure and any related pending chunks. */ 293/* Free the outqueue structure and any related pending chunks. */
290void sctp_outq_free(struct sctp_outq *q) 294void sctp_outq_free(struct sctp_outq *q)
291{ 295{
292 /* Throw away leftover chunks. */ 296 /* Throw away leftover chunks. */
293 sctp_outq_teardown(q); 297 __sctp_outq_teardown(q);
294 298
295 /* If we were kmalloc()'d, free the memory. */ 299 /* If we were kmalloc()'d, free the memory. */
296 if (q->malloced) 300 if (q->malloced)
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 618ec7e216ca..5131fcfedb03 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -1779,8 +1779,10 @@ static sctp_disposition_t sctp_sf_do_dupcook_a(struct net *net,
1779 1779
1780 /* Update the content of current association. */ 1780 /* Update the content of current association. */
1781 sctp_add_cmd_sf(commands, SCTP_CMD_UPDATE_ASSOC, SCTP_ASOC(new_asoc)); 1781 sctp_add_cmd_sf(commands, SCTP_CMD_UPDATE_ASSOC, SCTP_ASOC(new_asoc));
1782 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl));
1783 sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, SCTP_ULPEVENT(ev)); 1782 sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, SCTP_ULPEVENT(ev));
1783 sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
1784 SCTP_STATE(SCTP_STATE_ESTABLISHED));
1785 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl));
1784 return SCTP_DISPOSITION_CONSUME; 1786 return SCTP_DISPOSITION_CONSUME;
1785 1787
1786nomem_ev: 1788nomem_ev:
diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c
index 043889ac86c0..bf3c6e8fc401 100644
--- a/net/sctp/sysctl.c
+++ b/net/sctp/sysctl.c
@@ -366,7 +366,11 @@ int sctp_sysctl_net_register(struct net *net)
366 366
367void sctp_sysctl_net_unregister(struct net *net) 367void sctp_sysctl_net_unregister(struct net *net)
368{ 368{
369 struct ctl_table *table;
370
371 table = net->sctp.sysctl_header->ctl_table_arg;
369 unregister_net_sysctl_table(net->sctp.sysctl_header); 372 unregister_net_sysctl_table(net->sctp.sysctl_header);
373 kfree(table);
370} 374}
371 375
372static struct ctl_table_header * sctp_sysctl_header; 376static struct ctl_table_header * sctp_sysctl_header;
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 822f020fa7f4..507b5e84fbdb 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -555,7 +555,7 @@ EXPORT_SYMBOL_GPL(rpc_clone_client);
555 * rpc_clone_client_set_auth - Clone an RPC client structure and set its auth 555 * rpc_clone_client_set_auth - Clone an RPC client structure and set its auth
556 * 556 *
557 * @clnt: RPC client whose parameters are copied 557 * @clnt: RPC client whose parameters are copied
558 * @auth: security flavor for new client 558 * @flavor: security flavor for new client
559 * 559 *
560 * Returns a fresh RPC client or an ERR_PTR. 560 * Returns a fresh RPC client or an ERR_PTR.
561 */ 561 */
@@ -610,11 +610,6 @@ EXPORT_SYMBOL_GPL(rpc_killall_tasks);
610 */ 610 */
611void rpc_shutdown_client(struct rpc_clnt *clnt) 611void rpc_shutdown_client(struct rpc_clnt *clnt)
612{ 612{
613 /*
614 * To avoid deadlock, never call rpc_shutdown_client from a
615 * workqueue context!
616 */
617 WARN_ON_ONCE(current->flags & PF_WQ_WORKER);
618 might_sleep(); 613 might_sleep();
619 614
620 dprintk_rcu("RPC: shutting down %s client for %s\n", 615 dprintk_rcu("RPC: shutting down %s client for %s\n",
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index d17a704aaf5f..fb20f25ddec9 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -98,9 +98,25 @@ __rpc_add_timer(struct rpc_wait_queue *queue, struct rpc_task *task)
98 list_add(&task->u.tk_wait.timer_list, &queue->timer_list.list); 98 list_add(&task->u.tk_wait.timer_list, &queue->timer_list.list);
99} 99}
100 100
101static void rpc_rotate_queue_owner(struct rpc_wait_queue *queue)
102{
103 struct list_head *q = &queue->tasks[queue->priority];
104 struct rpc_task *task;
105
106 if (!list_empty(q)) {
107 task = list_first_entry(q, struct rpc_task, u.tk_wait.list);
108 if (task->tk_owner == queue->owner)
109 list_move_tail(&task->u.tk_wait.list, q);
110 }
111}
112
101static void rpc_set_waitqueue_priority(struct rpc_wait_queue *queue, int priority) 113static void rpc_set_waitqueue_priority(struct rpc_wait_queue *queue, int priority)
102{ 114{
103 queue->priority = priority; 115 if (queue->priority != priority) {
116 /* Fairness: rotate the list when changing priority */
117 rpc_rotate_queue_owner(queue);
118 queue->priority = priority;
119 }
104} 120}
105 121
106static void rpc_set_waitqueue_owner(struct rpc_wait_queue *queue, pid_t pid) 122static void rpc_set_waitqueue_owner(struct rpc_wait_queue *queue, pid_t pid)
@@ -934,16 +950,35 @@ struct rpc_task *rpc_new_task(const struct rpc_task_setup *setup_data)
934 return task; 950 return task;
935} 951}
936 952
953/*
954 * rpc_free_task - release rpc task and perform cleanups
955 *
956 * Note that we free up the rpc_task _after_ rpc_release_calldata()
957 * in order to work around a workqueue dependency issue.
958 *
959 * Tejun Heo states:
960 * "Workqueue currently considers two work items to be the same if they're
961 * on the same address and won't execute them concurrently - ie. it
962 * makes a work item which is queued again while being executed wait
963 * for the previous execution to complete.
964 *
965 * If a work function frees the work item, and then waits for an event
966 * which should be performed by another work item and *that* work item
967 * recycles the freed work item, it can create a false dependency loop.
968 * There really is no reliable way to detect this short of verifying
969 * every memory free."
970 *
971 */
937static void rpc_free_task(struct rpc_task *task) 972static void rpc_free_task(struct rpc_task *task)
938{ 973{
939 const struct rpc_call_ops *tk_ops = task->tk_ops; 974 unsigned short tk_flags = task->tk_flags;
940 void *calldata = task->tk_calldata; 975
976 rpc_release_calldata(task->tk_ops, task->tk_calldata);
941 977
942 if (task->tk_flags & RPC_TASK_DYNAMIC) { 978 if (tk_flags & RPC_TASK_DYNAMIC) {
943 dprintk("RPC: %5u freeing task\n", task->tk_pid); 979 dprintk("RPC: %5u freeing task\n", task->tk_pid);
944 mempool_free(task, rpc_task_mempool); 980 mempool_free(task, rpc_task_mempool);
945 } 981 }
946 rpc_release_calldata(tk_ops, calldata);
947} 982}
948 983
949static void rpc_async_release(struct work_struct *work) 984static void rpc_async_release(struct work_struct *work)
@@ -953,8 +988,7 @@ static void rpc_async_release(struct work_struct *work)
953 988
954static void rpc_release_resources_task(struct rpc_task *task) 989static void rpc_release_resources_task(struct rpc_task *task)
955{ 990{
956 if (task->tk_rqstp) 991 xprt_release(task);
957 xprt_release(task);
958 if (task->tk_msg.rpc_cred) { 992 if (task->tk_msg.rpc_cred) {
959 put_rpccred(task->tk_msg.rpc_cred); 993 put_rpccred(task->tk_msg.rpc_cred);
960 task->tk_msg.rpc_cred = NULL; 994 task->tk_msg.rpc_cred = NULL;
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index bd462a532acf..33811db8788a 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -1136,10 +1136,18 @@ static void xprt_request_init(struct rpc_task *task, struct rpc_xprt *xprt)
1136void xprt_release(struct rpc_task *task) 1136void xprt_release(struct rpc_task *task)
1137{ 1137{
1138 struct rpc_xprt *xprt; 1138 struct rpc_xprt *xprt;
1139 struct rpc_rqst *req; 1139 struct rpc_rqst *req = task->tk_rqstp;
1140 1140
1141 if (!(req = task->tk_rqstp)) 1141 if (req == NULL) {
1142 if (task->tk_client) {
1143 rcu_read_lock();
1144 xprt = rcu_dereference(task->tk_client->cl_xprt);
1145 if (xprt->snd_task == task)
1146 xprt_release_write(xprt, task);
1147 rcu_read_unlock();
1148 }
1142 return; 1149 return;
1150 }
1143 1151
1144 xprt = req->rq_xprt; 1152 xprt = req->rq_xprt;
1145 if (task->tk_ops->rpc_count_stats != NULL) 1153 if (task->tk_ops->rpc_count_stats != NULL)
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 14d990400354..b677eab55b68 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -866,8 +866,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
866 /* allow mac80211 to determine the timeout */ 866 /* allow mac80211 to determine the timeout */
867 wdev->ps_timeout = -1; 867 wdev->ps_timeout = -1;
868 868
869 if (!dev->ethtool_ops) 869 netdev_set_default_ethtool_ops(dev, &cfg80211_ethtool_ops);
870 dev->ethtool_ops = &cfg80211_ethtool_ops;
871 870
872 if ((wdev->iftype == NL80211_IFTYPE_STATION || 871 if ((wdev->iftype == NL80211_IFTYPE_STATION ||
873 wdev->iftype == NL80211_IFTYPE_P2P_CLIENT || 872 wdev->iftype == NL80211_IFTYPE_P2P_CLIENT ||
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 6e5308998e30..82c4fc7c994c 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -2365,7 +2365,6 @@ int set_regdom(const struct ieee80211_regdomain *rd)
2365 return r; 2365 return r;
2366} 2366}
2367 2367
2368#ifdef CONFIG_HOTPLUG
2369int reg_device_uevent(struct device *dev, struct kobj_uevent_env *env) 2368int reg_device_uevent(struct device *dev, struct kobj_uevent_env *env)
2370{ 2369{
2371 if (last_request && !last_request->processed) { 2370 if (last_request && !last_request->processed) {
@@ -2377,12 +2376,6 @@ int reg_device_uevent(struct device *dev, struct kobj_uevent_env *env)
2377 2376
2378 return 0; 2377 return 0;
2379} 2378}
2380#else
2381int reg_device_uevent(struct device *dev, struct kobj_uevent_env *env)
2382{
2383 return -ENODEV;
2384}
2385#endif /* CONFIG_HOTPLUG */
2386 2379
2387void wiphy_regulatory_register(struct wiphy *wiphy) 2380void wiphy_regulatory_register(struct wiphy *wiphy)
2388{ 2381{
diff --git a/net/wireless/sysfs.c b/net/wireless/sysfs.c
index 9bf6d5e32166..1f6f01e2dc4c 100644
--- a/net/wireless/sysfs.c
+++ b/net/wireless/sysfs.c
@@ -77,13 +77,11 @@ static void wiphy_dev_release(struct device *dev)
77 cfg80211_dev_free(rdev); 77 cfg80211_dev_free(rdev);
78} 78}
79 79
80#ifdef CONFIG_HOTPLUG
81static int wiphy_uevent(struct device *dev, struct kobj_uevent_env *env) 80static int wiphy_uevent(struct device *dev, struct kobj_uevent_env *env)
82{ 81{
83 /* TODO, we probably need stuff here */ 82 /* TODO, we probably need stuff here */
84 return 0; 83 return 0;
85} 84}
86#endif
87 85
88static int wiphy_suspend(struct device *dev, pm_message_t state) 86static int wiphy_suspend(struct device *dev, pm_message_t state)
89{ 87{
@@ -134,9 +132,7 @@ struct class ieee80211_class = {
134 .owner = THIS_MODULE, 132 .owner = THIS_MODULE,
135 .dev_release = wiphy_dev_release, 133 .dev_release = wiphy_dev_release,
136 .dev_attrs = ieee80211_dev_attrs, 134 .dev_attrs = ieee80211_dev_attrs,
137#ifdef CONFIG_HOTPLUG
138 .dev_uevent = wiphy_uevent, 135 .dev_uevent = wiphy_uevent,
139#endif
140 .suspend = wiphy_suspend, 136 .suspend = wiphy_suspend,
141 .resume = wiphy_resume, 137 .resume = wiphy_resume,
142 .ns_type = &net_ns_type_operations, 138 .ns_type = &net_ns_type_operations,
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 41eabc46f110..07c585756d2a 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -2656,7 +2656,7 @@ static void xfrm_policy_fini(struct net *net)
2656 WARN_ON(!hlist_empty(&net->xfrm.policy_inexact[dir])); 2656 WARN_ON(!hlist_empty(&net->xfrm.policy_inexact[dir]));
2657 2657
2658 htab = &net->xfrm.policy_bydst[dir]; 2658 htab = &net->xfrm.policy_bydst[dir];
2659 sz = (htab->hmask + 1); 2659 sz = (htab->hmask + 1) * sizeof(struct hlist_head);
2660 WARN_ON(!hlist_empty(htab->table)); 2660 WARN_ON(!hlist_empty(htab->table));
2661 xfrm_hash_free(htab->table, sz); 2661 xfrm_hash_free(htab->table, sz);
2662 } 2662 }
diff --git a/net/xfrm/xfrm_replay.c b/net/xfrm/xfrm_replay.c
index 765f6fe951eb..35754cc8a9e5 100644
--- a/net/xfrm/xfrm_replay.c
+++ b/net/xfrm/xfrm_replay.c
@@ -242,11 +242,13 @@ static void xfrm_replay_advance_bmp(struct xfrm_state *x, __be32 net_seq)
242 u32 diff; 242 u32 diff;
243 struct xfrm_replay_state_esn *replay_esn = x->replay_esn; 243 struct xfrm_replay_state_esn *replay_esn = x->replay_esn;
244 u32 seq = ntohl(net_seq); 244 u32 seq = ntohl(net_seq);
245 u32 pos = (replay_esn->seq - 1) % replay_esn->replay_window; 245 u32 pos;
246 246
247 if (!replay_esn->replay_window) 247 if (!replay_esn->replay_window)
248 return; 248 return;
249 249
250 pos = (replay_esn->seq - 1) % replay_esn->replay_window;
251
250 if (seq > replay_esn->seq) { 252 if (seq > replay_esn->seq) {
251 diff = seq - replay_esn->seq; 253 diff = seq - replay_esn->seq;
252 254
diff --git a/samples/rpmsg/rpmsg_client_sample.c b/samples/rpmsg/rpmsg_client_sample.c
index 23ea9f2ae11d..59b13440813d 100644
--- a/samples/rpmsg/rpmsg_client_sample.c
+++ b/samples/rpmsg/rpmsg_client_sample.c
@@ -64,7 +64,7 @@ static int rpmsg_sample_probe(struct rpmsg_channel *rpdev)
64 return 0; 64 return 0;
65} 65}
66 66
67static void __devexit rpmsg_sample_remove(struct rpmsg_channel *rpdev) 67static void rpmsg_sample_remove(struct rpmsg_channel *rpdev)
68{ 68{
69 dev_info(&rpdev->dev, "rpmsg sample client driver is removed\n"); 69 dev_info(&rpdev->dev, "rpmsg sample client driver is removed\n");
70} 70}
@@ -81,7 +81,7 @@ static struct rpmsg_driver rpmsg_sample_client = {
81 .id_table = rpmsg_driver_sample_id_table, 81 .id_table = rpmsg_driver_sample_id_table,
82 .probe = rpmsg_sample_probe, 82 .probe = rpmsg_sample_probe,
83 .callback = rpmsg_sample_cb, 83 .callback = rpmsg_sample_cb,
84 .remove = __devexit_p(rpmsg_sample_remove), 84 .remove = rpmsg_sample_remove,
85}; 85};
86 86
87static int __init rpmsg_client_sample_init(void) 87static int __init rpmsg_client_sample_init(void)
diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl
index 6c353ae8a451..581ca99c96f2 100644
--- a/scripts/headers_install.pl
+++ b/scripts/headers_install.pl
@@ -42,9 +42,9 @@ foreach my $filename (@files) {
42 $line =~ s/(^|\s)(inline)\b/$1__$2__/g; 42 $line =~ s/(^|\s)(inline)\b/$1__$2__/g;
43 $line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g; 43 $line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g;
44 $line =~ s/(^|\s|[(])(volatile)\b(\s|[(]|$)/$1__$2__$3/g; 44 $line =~ s/(^|\s|[(])(volatile)\b(\s|[(]|$)/$1__$2__$3/g;
45 $line =~ s/#ifndef _UAPI/#ifndef /; 45 $line =~ s/#ifndef\s+_UAPI/#ifndef /;
46 $line =~ s/#define _UAPI/#define /; 46 $line =~ s/#define\s+_UAPI/#define /;
47 $line =~ s!#endif /[*] _UAPI!#endif /* !; 47 $line =~ s!#endif\s+/[*]\s*_UAPI!#endif /* !;
48 printf {$out} "%s", $line; 48 printf {$out} "%s", $line;
49 } 49 }
50 close $out; 50 close $out;
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 28b761567815..f565536a2bef 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -2079,7 +2079,6 @@ sub dump_function($$) {
2079 $prototype =~ s/^__inline +//; 2079 $prototype =~ s/^__inline +//;
2080 $prototype =~ s/^__always_inline +//; 2080 $prototype =~ s/^__always_inline +//;
2081 $prototype =~ s/^noinline +//; 2081 $prototype =~ s/^noinline +//;
2082 $prototype =~ s/__devinit +//;
2083 $prototype =~ s/__init +//; 2082 $prototype =~ s/__init +//;
2084 $prototype =~ s/__init_or_module +//; 2083 $prototype =~ s/__init_or_module +//;
2085 $prototype =~ s/__must_check +//; 2084 $prototype =~ s/__must_check +//;
diff --git a/security/capability.c b/security/capability.c
index 0fe5a026aef8..579775088967 100644
--- a/security/capability.c
+++ b/security/capability.c
@@ -709,16 +709,31 @@ static void cap_req_classify_flow(const struct request_sock *req,
709{ 709{
710} 710}
711 711
712static int cap_tun_dev_alloc_security(void **security)
713{
714 return 0;
715}
716
717static void cap_tun_dev_free_security(void *security)
718{
719}
720
712static int cap_tun_dev_create(void) 721static int cap_tun_dev_create(void)
713{ 722{
714 return 0; 723 return 0;
715} 724}
716 725
717static void cap_tun_dev_post_create(struct sock *sk) 726static int cap_tun_dev_attach_queue(void *security)
727{
728 return 0;
729}
730
731static int cap_tun_dev_attach(struct sock *sk, void *security)
718{ 732{
733 return 0;
719} 734}
720 735
721static int cap_tun_dev_attach(struct sock *sk) 736static int cap_tun_dev_open(void *security)
722{ 737{
723 return 0; 738 return 0;
724} 739}
@@ -1050,8 +1065,11 @@ void __init security_fixup_ops(struct security_operations *ops)
1050 set_to_cap_if_null(ops, secmark_refcount_inc); 1065 set_to_cap_if_null(ops, secmark_refcount_inc);
1051 set_to_cap_if_null(ops, secmark_refcount_dec); 1066 set_to_cap_if_null(ops, secmark_refcount_dec);
1052 set_to_cap_if_null(ops, req_classify_flow); 1067 set_to_cap_if_null(ops, req_classify_flow);
1068 set_to_cap_if_null(ops, tun_dev_alloc_security);
1069 set_to_cap_if_null(ops, tun_dev_free_security);
1053 set_to_cap_if_null(ops, tun_dev_create); 1070 set_to_cap_if_null(ops, tun_dev_create);
1054 set_to_cap_if_null(ops, tun_dev_post_create); 1071 set_to_cap_if_null(ops, tun_dev_open);
1072 set_to_cap_if_null(ops, tun_dev_attach_queue);
1055 set_to_cap_if_null(ops, tun_dev_attach); 1073 set_to_cap_if_null(ops, tun_dev_attach);
1056#endif /* CONFIG_SECURITY_NETWORK */ 1074#endif /* CONFIG_SECURITY_NETWORK */
1057#ifdef CONFIG_SECURITY_NETWORK_XFRM 1075#ifdef CONFIG_SECURITY_NETWORK_XFRM
diff --git a/security/device_cgroup.c b/security/device_cgroup.c
index 19ecc8de9e6b..d794abcc4b3b 100644
--- a/security/device_cgroup.c
+++ b/security/device_cgroup.c
@@ -215,7 +215,9 @@ static void devcgroup_css_free(struct cgroup *cgroup)
215 struct dev_cgroup *dev_cgroup; 215 struct dev_cgroup *dev_cgroup;
216 216
217 dev_cgroup = cgroup_to_devcgroup(cgroup); 217 dev_cgroup = cgroup_to_devcgroup(cgroup);
218 mutex_lock(&devcgroup_mutex);
218 dev_exception_clean(dev_cgroup); 219 dev_exception_clean(dev_cgroup);
220 mutex_unlock(&devcgroup_mutex);
219 kfree(dev_cgroup); 221 kfree(dev_cgroup);
220} 222}
221 223
diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c
index dfb26918699c..7dd538ef5b83 100644
--- a/security/integrity/evm/evm_crypto.c
+++ b/security/integrity/evm/evm_crypto.c
@@ -205,9 +205,9 @@ int evm_update_evmxattr(struct dentry *dentry, const char *xattr_name,
205 rc = __vfs_setxattr_noperm(dentry, XATTR_NAME_EVM, 205 rc = __vfs_setxattr_noperm(dentry, XATTR_NAME_EVM,
206 &xattr_data, 206 &xattr_data,
207 sizeof(xattr_data), 0); 207 sizeof(xattr_data), 0);
208 } 208 } else if (rc == -ENODATA && inode->i_op->removexattr) {
209 else if (rc == -ENODATA)
210 rc = inode->i_op->removexattr(dentry, XATTR_NAME_EVM); 209 rc = inode->i_op->removexattr(dentry, XATTR_NAME_EVM);
210 }
211 return rc; 211 return rc;
212} 212}
213 213
diff --git a/security/integrity/ima/ima.h b/security/integrity/ima/ima.h
index 3b2adb794f15..079a85dc37b2 100644
--- a/security/integrity/ima/ima.h
+++ b/security/integrity/ima/ima.h
@@ -139,6 +139,7 @@ void ima_delete_rules(void);
139/* Appraise integrity measurements */ 139/* Appraise integrity measurements */
140#define IMA_APPRAISE_ENFORCE 0x01 140#define IMA_APPRAISE_ENFORCE 0x01
141#define IMA_APPRAISE_FIX 0x02 141#define IMA_APPRAISE_FIX 0x02
142#define IMA_APPRAISE_MODULES 0x04
142 143
143#ifdef CONFIG_IMA_APPRAISE 144#ifdef CONFIG_IMA_APPRAISE
144int ima_appraise_measurement(struct integrity_iint_cache *iint, 145int ima_appraise_measurement(struct integrity_iint_cache *iint,
diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c
index 45de18e9a6f2..dba965de90d3 100644
--- a/security/integrity/ima/ima_main.c
+++ b/security/integrity/ima/ima_main.c
@@ -291,11 +291,15 @@ EXPORT_SYMBOL_GPL(ima_file_check);
291 */ 291 */
292int ima_module_check(struct file *file) 292int ima_module_check(struct file *file)
293{ 293{
294 int rc; 294 int rc = 0;
295 295
296 if (!file) 296 if (!file) {
297 rc = INTEGRITY_UNKNOWN; 297 if (ima_appraise & IMA_APPRAISE_MODULES) {
298 else 298#ifndef CONFIG_MODULE_SIG_FORCE
299 rc = -EACCES; /* INTEGRITY_UNKNOWN */
300#endif
301 }
302 } else
299 rc = process_measurement(file, file->f_dentry->d_name.name, 303 rc = process_measurement(file, file->f_dentry->d_name.name,
300 MAY_EXEC, MODULE_CHECK); 304 MAY_EXEC, MODULE_CHECK);
301 return (ima_appraise & IMA_APPRAISE_ENFORCE) ? rc : 0; 305 return (ima_appraise & IMA_APPRAISE_ENFORCE) ? rc : 0;
diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
index af7d182d5a46..479fca940bb5 100644
--- a/security/integrity/ima/ima_policy.c
+++ b/security/integrity/ima/ima_policy.c
@@ -523,7 +523,8 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)
523 } 523 }
524 if (!result && (entry->action == UNKNOWN)) 524 if (!result && (entry->action == UNKNOWN))
525 result = -EINVAL; 525 result = -EINVAL;
526 526 else if (entry->func == MODULE_CHECK)
527 ima_appraise |= IMA_APPRAISE_MODULES;
527 audit_log_format(ab, "res=%d", !result); 528 audit_log_format(ab, "res=%d", !result);
528 audit_log_end(ab); 529 audit_log_end(ab);
529 return result; 530 return result;
diff --git a/security/security.c b/security/security.c
index daa97f4ac9d1..7b88c6aeaed4 100644
--- a/security/security.c
+++ b/security/security.c
@@ -1254,24 +1254,42 @@ void security_secmark_refcount_dec(void)
1254} 1254}
1255EXPORT_SYMBOL(security_secmark_refcount_dec); 1255EXPORT_SYMBOL(security_secmark_refcount_dec);
1256 1256
1257int security_tun_dev_alloc_security(void **security)
1258{
1259 return security_ops->tun_dev_alloc_security(security);
1260}
1261EXPORT_SYMBOL(security_tun_dev_alloc_security);
1262
1263void security_tun_dev_free_security(void *security)
1264{
1265 security_ops->tun_dev_free_security(security);
1266}
1267EXPORT_SYMBOL(security_tun_dev_free_security);
1268
1257int security_tun_dev_create(void) 1269int security_tun_dev_create(void)
1258{ 1270{
1259 return security_ops->tun_dev_create(); 1271 return security_ops->tun_dev_create();
1260} 1272}
1261EXPORT_SYMBOL(security_tun_dev_create); 1273EXPORT_SYMBOL(security_tun_dev_create);
1262 1274
1263void security_tun_dev_post_create(struct sock *sk) 1275int security_tun_dev_attach_queue(void *security)
1264{ 1276{
1265 return security_ops->tun_dev_post_create(sk); 1277 return security_ops->tun_dev_attach_queue(security);
1266} 1278}
1267EXPORT_SYMBOL(security_tun_dev_post_create); 1279EXPORT_SYMBOL(security_tun_dev_attach_queue);
1268 1280
1269int security_tun_dev_attach(struct sock *sk) 1281int security_tun_dev_attach(struct sock *sk, void *security)
1270{ 1282{
1271 return security_ops->tun_dev_attach(sk); 1283 return security_ops->tun_dev_attach(sk, security);
1272} 1284}
1273EXPORT_SYMBOL(security_tun_dev_attach); 1285EXPORT_SYMBOL(security_tun_dev_attach);
1274 1286
1287int security_tun_dev_open(void *security)
1288{
1289 return security_ops->tun_dev_open(security);
1290}
1291EXPORT_SYMBOL(security_tun_dev_open);
1292
1275#endif /* CONFIG_SECURITY_NETWORK */ 1293#endif /* CONFIG_SECURITY_NETWORK */
1276 1294
1277#ifdef CONFIG_SECURITY_NETWORK_XFRM 1295#ifdef CONFIG_SECURITY_NETWORK_XFRM
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 61a53367d029..ef26e9611ffb 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -4399,6 +4399,24 @@ static void selinux_req_classify_flow(const struct request_sock *req,
4399 fl->flowi_secid = req->secid; 4399 fl->flowi_secid = req->secid;
4400} 4400}
4401 4401
4402static int selinux_tun_dev_alloc_security(void **security)
4403{
4404 struct tun_security_struct *tunsec;
4405
4406 tunsec = kzalloc(sizeof(*tunsec), GFP_KERNEL);
4407 if (!tunsec)
4408 return -ENOMEM;
4409 tunsec->sid = current_sid();
4410
4411 *security = tunsec;
4412 return 0;
4413}
4414
4415static void selinux_tun_dev_free_security(void *security)
4416{
4417 kfree(security);
4418}
4419
4402static int selinux_tun_dev_create(void) 4420static int selinux_tun_dev_create(void)
4403{ 4421{
4404 u32 sid = current_sid(); 4422 u32 sid = current_sid();
@@ -4414,8 +4432,17 @@ static int selinux_tun_dev_create(void)
4414 NULL); 4432 NULL);
4415} 4433}
4416 4434
4417static void selinux_tun_dev_post_create(struct sock *sk) 4435static int selinux_tun_dev_attach_queue(void *security)
4418{ 4436{
4437 struct tun_security_struct *tunsec = security;
4438
4439 return avc_has_perm(current_sid(), tunsec->sid, SECCLASS_TUN_SOCKET,
4440 TUN_SOCKET__ATTACH_QUEUE, NULL);
4441}
4442
4443static int selinux_tun_dev_attach(struct sock *sk, void *security)
4444{
4445 struct tun_security_struct *tunsec = security;
4419 struct sk_security_struct *sksec = sk->sk_security; 4446 struct sk_security_struct *sksec = sk->sk_security;
4420 4447
4421 /* we don't currently perform any NetLabel based labeling here and it 4448 /* we don't currently perform any NetLabel based labeling here and it
@@ -4425,20 +4452,19 @@ static void selinux_tun_dev_post_create(struct sock *sk)
4425 * cause confusion to the TUN user that had no idea network labeling 4452 * cause confusion to the TUN user that had no idea network labeling
4426 * protocols were being used */ 4453 * protocols were being used */
4427 4454
4428 /* see the comments in selinux_tun_dev_create() about why we don't use 4455 sksec->sid = tunsec->sid;
4429 * the sockcreate SID here */
4430
4431 sksec->sid = current_sid();
4432 sksec->sclass = SECCLASS_TUN_SOCKET; 4456 sksec->sclass = SECCLASS_TUN_SOCKET;
4457
4458 return 0;
4433} 4459}
4434 4460
4435static int selinux_tun_dev_attach(struct sock *sk) 4461static int selinux_tun_dev_open(void *security)
4436{ 4462{
4437 struct sk_security_struct *sksec = sk->sk_security; 4463 struct tun_security_struct *tunsec = security;
4438 u32 sid = current_sid(); 4464 u32 sid = current_sid();
4439 int err; 4465 int err;
4440 4466
4441 err = avc_has_perm(sid, sksec->sid, SECCLASS_TUN_SOCKET, 4467 err = avc_has_perm(sid, tunsec->sid, SECCLASS_TUN_SOCKET,
4442 TUN_SOCKET__RELABELFROM, NULL); 4468 TUN_SOCKET__RELABELFROM, NULL);
4443 if (err) 4469 if (err)
4444 return err; 4470 return err;
@@ -4446,8 +4472,7 @@ static int selinux_tun_dev_attach(struct sock *sk)
4446 TUN_SOCKET__RELABELTO, NULL); 4472 TUN_SOCKET__RELABELTO, NULL);
4447 if (err) 4473 if (err)
4448 return err; 4474 return err;
4449 4475 tunsec->sid = sid;
4450 sksec->sid = sid;
4451 4476
4452 return 0; 4477 return 0;
4453} 4478}
@@ -5642,9 +5667,12 @@ static struct security_operations selinux_ops = {
5642 .secmark_refcount_inc = selinux_secmark_refcount_inc, 5667 .secmark_refcount_inc = selinux_secmark_refcount_inc,
5643 .secmark_refcount_dec = selinux_secmark_refcount_dec, 5668 .secmark_refcount_dec = selinux_secmark_refcount_dec,
5644 .req_classify_flow = selinux_req_classify_flow, 5669 .req_classify_flow = selinux_req_classify_flow,
5670 .tun_dev_alloc_security = selinux_tun_dev_alloc_security,
5671 .tun_dev_free_security = selinux_tun_dev_free_security,
5645 .tun_dev_create = selinux_tun_dev_create, 5672 .tun_dev_create = selinux_tun_dev_create,
5646 .tun_dev_post_create = selinux_tun_dev_post_create, 5673 .tun_dev_attach_queue = selinux_tun_dev_attach_queue,
5647 .tun_dev_attach = selinux_tun_dev_attach, 5674 .tun_dev_attach = selinux_tun_dev_attach,
5675 .tun_dev_open = selinux_tun_dev_open,
5648 5676
5649#ifdef CONFIG_SECURITY_NETWORK_XFRM 5677#ifdef CONFIG_SECURITY_NETWORK_XFRM
5650 .xfrm_policy_alloc_security = selinux_xfrm_policy_alloc, 5678 .xfrm_policy_alloc_security = selinux_xfrm_policy_alloc,
diff --git a/security/selinux/include/classmap.h b/security/selinux/include/classmap.h
index df2de54a958d..14d04e63b1f0 100644
--- a/security/selinux/include/classmap.h
+++ b/security/selinux/include/classmap.h
@@ -150,6 +150,6 @@ struct security_class_mapping secclass_map[] = {
150 NULL } }, 150 NULL } },
151 { "kernel_service", { "use_as_override", "create_files_as", NULL } }, 151 { "kernel_service", { "use_as_override", "create_files_as", NULL } },
152 { "tun_socket", 152 { "tun_socket",
153 { COMMON_SOCK_PERMS, NULL } }, 153 { COMMON_SOCK_PERMS, "attach_queue", NULL } },
154 { NULL } 154 { NULL }
155 }; 155 };
diff --git a/security/selinux/include/objsec.h b/security/selinux/include/objsec.h
index 26c7eee1c309..aa47bcabb5f6 100644
--- a/security/selinux/include/objsec.h
+++ b/security/selinux/include/objsec.h
@@ -110,6 +110,10 @@ struct sk_security_struct {
110 u16 sclass; /* sock security class */ 110 u16 sclass; /* sock security class */
111}; 111};
112 112
113struct tun_security_struct {
114 u32 sid; /* SID for the tun device sockets */
115};
116
113struct key_security_struct { 117struct key_security_struct {
114 u32 sid; /* SID of key */ 118 u32 sid; /* SID of key */
115}; 119};
diff --git a/sound/arm/pxa2xx-ac97-lib.c b/sound/arm/pxa2xx-ac97-lib.c
index 6fc0ae90e5b1..fff7753e35c1 100644
--- a/sound/arm/pxa2xx-ac97-lib.c
+++ b/sound/arm/pxa2xx-ac97-lib.c
@@ -18,6 +18,7 @@
18#include <linux/delay.h> 18#include <linux/delay.h>
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/gpio.h>
21 22
22#include <sound/ac97_codec.h> 23#include <sound/ac97_codec.h>
23#include <sound/pxa2xx-lib.h> 24#include <sound/pxa2xx-lib.h>
@@ -148,6 +149,8 @@ static inline void pxa_ac97_warm_pxa27x(void)
148 149
149static inline void pxa_ac97_cold_pxa27x(void) 150static inline void pxa_ac97_cold_pxa27x(void)
150{ 151{
152 unsigned int timeout;
153
151 GCR &= GCR_COLD_RST; /* clear everything but nCRST */ 154 GCR &= GCR_COLD_RST; /* clear everything but nCRST */
152 GCR &= ~GCR_COLD_RST; /* then assert nCRST */ 155 GCR &= ~GCR_COLD_RST; /* then assert nCRST */
153 156
@@ -157,8 +160,10 @@ static inline void pxa_ac97_cold_pxa27x(void)
157 clk_enable(ac97conf_clk); 160 clk_enable(ac97conf_clk);
158 udelay(5); 161 udelay(5);
159 clk_disable(ac97conf_clk); 162 clk_disable(ac97conf_clk);
160 GCR = GCR_COLD_RST; 163 GCR = GCR_COLD_RST | GCR_WARM_RST;
161 udelay(50); 164 timeout = 100; /* wait for the codec-ready bit to be set */
165 while (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR)) && timeout--)
166 mdelay(1);
162} 167}
163#endif 168#endif
164 169
@@ -340,8 +345,21 @@ int pxa2xx_ac97_hw_probe(struct platform_device *dev)
340 } 345 }
341 346
342 if (cpu_is_pxa27x()) { 347 if (cpu_is_pxa27x()) {
343 /* Use GPIO 113 as AC97 Reset on Bulverde */ 348 /*
349 * This gpio is needed for a work-around to a bug in the ac97
350 * controller during warm reset. The direction and level is set
351 * here so that it is an output driven high when switching from
352 * AC97_nRESET alt function to generic gpio.
353 */
354 ret = gpio_request_one(reset_gpio, GPIOF_OUT_INIT_HIGH,
355 "pxa27x ac97 reset");
356 if (ret < 0) {
357 pr_err("%s: gpio_request_one() failed: %d\n",
358 __func__, ret);
359 goto err_conf;
360 }
344 pxa27x_assert_ac97reset(reset_gpio, 0); 361 pxa27x_assert_ac97reset(reset_gpio, 0);
362
345 ac97conf_clk = clk_get(&dev->dev, "AC97CONFCLK"); 363 ac97conf_clk = clk_get(&dev->dev, "AC97CONFCLK");
346 if (IS_ERR(ac97conf_clk)) { 364 if (IS_ERR(ac97conf_clk)) {
347 ret = PTR_ERR(ac97conf_clk); 365 ret = PTR_ERR(ac97conf_clk);
@@ -384,6 +402,8 @@ EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_probe);
384 402
385void pxa2xx_ac97_hw_remove(struct platform_device *dev) 403void pxa2xx_ac97_hw_remove(struct platform_device *dev)
386{ 404{
405 if (cpu_is_pxa27x())
406 gpio_free(reset_gpio);
387 GCR |= GCR_ACLINK_OFF; 407 GCR |= GCR_ACLINK_OFF;
388 free_irq(IRQ_AC97, NULL); 408 free_irq(IRQ_AC97, NULL);
389 if (ac97conf_clk) { 409 if (ac97conf_clk) {
diff --git a/sound/oss/pas2_card.c b/sound/oss/pas2_card.c
index dabf8a871dcc..7004e24d209f 100644
--- a/sound/oss/pas2_card.c
+++ b/sound/oss/pas2_card.c
@@ -333,6 +333,11 @@ static void __init attach_pas_card(struct address_info *hw_config)
333 { 333 {
334 char temp[100]; 334 char temp[100];
335 335
336 if (pas_model < 0 ||
337 pas_model >= ARRAY_SIZE(pas_model_names)) {
338 printk(KERN_ERR "pas2 unrecognized model.\n");
339 return;
340 }
336 sprintf(temp, 341 sprintf(temp,
337 "%s rev %d", pas_model_names[(int) pas_model], 342 "%s rev %d", pas_model_names[(int) pas_model],
338 pas_read(0x2789)); 343 pas_read(0x2789));
diff --git a/sound/pci/au88x0/au88x0_synth.c b/sound/pci/au88x0/au88x0_synth.c
index 2805e34bd41d..8bef47311e45 100644
--- a/sound/pci/au88x0/au88x0_synth.c
+++ b/sound/pci/au88x0/au88x0_synth.c
@@ -58,7 +58,7 @@ static void vortex_wt_setdsout(vortex_t * vortex, u32 wt, int en)
58 if (en) 58 if (en)
59 temp |= (1 << (wt & 0x1f)); 59 temp |= (1 << (wt & 0x1f));
60 else 60 else
61 temp &= (1 << ~(wt & 0x1f)); 61 temp &= ~(1 << (wt & 0x1f));
62 hwwrite(vortex->mmio, WT_DSREG((wt >= 0x20) ? 1 : 0), temp); 62 hwwrite(vortex->mmio, WT_DSREG((wt >= 0x20) ? 1 : 0), temp);
63} 63}
64 64
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 8353c77536ac..822df971972c 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -2531,7 +2531,7 @@ static int vmaster_mute_mode_info(struct snd_kcontrol *kcontrol,
2531 struct snd_ctl_elem_info *uinfo) 2531 struct snd_ctl_elem_info *uinfo)
2532{ 2532{
2533 static const char * const texts[] = { 2533 static const char * const texts[] = {
2534 "Off", "On", "Follow Master" 2534 "On", "Off", "Follow Master"
2535 }; 2535 };
2536 unsigned int index; 2536 unsigned int index;
2537 2537
@@ -3654,6 +3654,7 @@ static void hda_call_codec_resume(struct hda_codec *codec)
3654 hda_set_power_state(codec, AC_PWRST_D0); 3654 hda_set_power_state(codec, AC_PWRST_D0);
3655 restore_shutup_pins(codec); 3655 restore_shutup_pins(codec);
3656 hda_exec_init_verbs(codec); 3656 hda_exec_init_verbs(codec);
3657 snd_hda_jack_set_dirty_all(codec);
3657 if (codec->patch_ops.resume) 3658 if (codec->patch_ops.resume)
3658 codec->patch_ops.resume(codec); 3659 codec->patch_ops.resume(codec);
3659 else { 3660 else {
@@ -3665,10 +3666,8 @@ static void hda_call_codec_resume(struct hda_codec *codec)
3665 3666
3666 if (codec->jackpoll_interval) 3667 if (codec->jackpoll_interval)
3667 hda_jackpoll_work(&codec->jackpoll_work.work); 3668 hda_jackpoll_work(&codec->jackpoll_work.work);
3668 else { 3669 else
3669 snd_hda_jack_set_dirty_all(codec);
3670 snd_hda_jack_report_sync(codec); 3670 snd_hda_jack_report_sync(codec);
3671 }
3672 3671
3673 codec->in_pm = 0; 3672 codec->in_pm = 0;
3674 snd_hda_power_down(codec); /* flag down before returning */ 3673 snd_hda_power_down(codec); /* flag down before returning */
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index cca87277baf0..c78286f6e5d8 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -573,9 +573,12 @@ enum {
573#define AZX_DCAPS_PM_RUNTIME (1 << 26) /* runtime PM support */ 573#define AZX_DCAPS_PM_RUNTIME (1 << 26) /* runtime PM support */
574 574
575/* quirks for Intel PCH */ 575/* quirks for Intel PCH */
576#define AZX_DCAPS_INTEL_PCH \ 576#define AZX_DCAPS_INTEL_PCH_NOPM \
577 (AZX_DCAPS_SCH_SNOOP | AZX_DCAPS_BUFSIZE | \ 577 (AZX_DCAPS_SCH_SNOOP | AZX_DCAPS_BUFSIZE | \
578 AZX_DCAPS_COUNT_LPIB_DELAY | AZX_DCAPS_PM_RUNTIME) 578 AZX_DCAPS_COUNT_LPIB_DELAY)
579
580#define AZX_DCAPS_INTEL_PCH \
581 (AZX_DCAPS_INTEL_PCH_NOPM | AZX_DCAPS_PM_RUNTIME)
579 582
580/* quirks for ATI SB / AMD Hudson */ 583/* quirks for ATI SB / AMD Hudson */
581#define AZX_DCAPS_PRESET_ATI_SB \ 584#define AZX_DCAPS_PRESET_ATI_SB \
@@ -653,29 +656,43 @@ static char *driver_short_names[] = {
653#define get_azx_dev(substream) (substream->runtime->private_data) 656#define get_azx_dev(substream) (substream->runtime->private_data)
654 657
655#ifdef CONFIG_X86 658#ifdef CONFIG_X86
656static void __mark_pages_wc(struct azx *chip, void *addr, size_t size, bool on) 659static void __mark_pages_wc(struct azx *chip, struct snd_dma_buffer *dmab, bool on)
657{ 660{
661 int pages;
662
658 if (azx_snoop(chip)) 663 if (azx_snoop(chip))
659 return; 664 return;
660 if (addr && size) { 665 if (!dmab || !dmab->area || !dmab->bytes)
661 int pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; 666 return;
667
668#ifdef CONFIG_SND_DMA_SGBUF
669 if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_SG) {
670 struct snd_sg_buf *sgbuf = dmab->private_data;
662 if (on) 671 if (on)
663 set_memory_wc((unsigned long)addr, pages); 672 set_pages_array_wc(sgbuf->page_table, sgbuf->pages);
664 else 673 else
665 set_memory_wb((unsigned long)addr, pages); 674 set_pages_array_wb(sgbuf->page_table, sgbuf->pages);
675 return;
666 } 676 }
677#endif
678
679 pages = (dmab->bytes + PAGE_SIZE - 1) >> PAGE_SHIFT;
680 if (on)
681 set_memory_wc((unsigned long)dmab->area, pages);
682 else
683 set_memory_wb((unsigned long)dmab->area, pages);
667} 684}
668 685
669static inline void mark_pages_wc(struct azx *chip, struct snd_dma_buffer *buf, 686static inline void mark_pages_wc(struct azx *chip, struct snd_dma_buffer *buf,
670 bool on) 687 bool on)
671{ 688{
672 __mark_pages_wc(chip, buf->area, buf->bytes, on); 689 __mark_pages_wc(chip, buf, on);
673} 690}
674static inline void mark_runtime_wc(struct azx *chip, struct azx_dev *azx_dev, 691static inline void mark_runtime_wc(struct azx *chip, struct azx_dev *azx_dev,
675 struct snd_pcm_runtime *runtime, bool on) 692 struct snd_pcm_substream *substream, bool on)
676{ 693{
677 if (azx_dev->wc_marked != on) { 694 if (azx_dev->wc_marked != on) {
678 __mark_pages_wc(chip, runtime->dma_area, runtime->dma_bytes, on); 695 __mark_pages_wc(chip, snd_pcm_get_dma_buf(substream), on);
679 azx_dev->wc_marked = on; 696 azx_dev->wc_marked = on;
680 } 697 }
681} 698}
@@ -686,7 +703,7 @@ static inline void mark_pages_wc(struct azx *chip, struct snd_dma_buffer *buf,
686{ 703{
687} 704}
688static inline void mark_runtime_wc(struct azx *chip, struct azx_dev *azx_dev, 705static inline void mark_runtime_wc(struct azx *chip, struct azx_dev *azx_dev,
689 struct snd_pcm_runtime *runtime, bool on) 706 struct snd_pcm_substream *substream, bool on)
690{ 707{
691} 708}
692#endif 709#endif
@@ -1965,11 +1982,10 @@ static int azx_pcm_hw_params(struct snd_pcm_substream *substream,
1965{ 1982{
1966 struct azx_pcm *apcm = snd_pcm_substream_chip(substream); 1983 struct azx_pcm *apcm = snd_pcm_substream_chip(substream);
1967 struct azx *chip = apcm->chip; 1984 struct azx *chip = apcm->chip;
1968 struct snd_pcm_runtime *runtime = substream->runtime;
1969 struct azx_dev *azx_dev = get_azx_dev(substream); 1985 struct azx_dev *azx_dev = get_azx_dev(substream);
1970 int ret; 1986 int ret;
1971 1987
1972 mark_runtime_wc(chip, azx_dev, runtime, false); 1988 mark_runtime_wc(chip, azx_dev, substream, false);
1973 azx_dev->bufsize = 0; 1989 azx_dev->bufsize = 0;
1974 azx_dev->period_bytes = 0; 1990 azx_dev->period_bytes = 0;
1975 azx_dev->format_val = 0; 1991 azx_dev->format_val = 0;
@@ -1977,7 +1993,7 @@ static int azx_pcm_hw_params(struct snd_pcm_substream *substream,
1977 params_buffer_bytes(hw_params)); 1993 params_buffer_bytes(hw_params));
1978 if (ret < 0) 1994 if (ret < 0)
1979 return ret; 1995 return ret;
1980 mark_runtime_wc(chip, azx_dev, runtime, true); 1996 mark_runtime_wc(chip, azx_dev, substream, true);
1981 return ret; 1997 return ret;
1982} 1998}
1983 1999
@@ -1986,7 +2002,6 @@ static int azx_pcm_hw_free(struct snd_pcm_substream *substream)
1986 struct azx_pcm *apcm = snd_pcm_substream_chip(substream); 2002 struct azx_pcm *apcm = snd_pcm_substream_chip(substream);
1987 struct azx_dev *azx_dev = get_azx_dev(substream); 2003 struct azx_dev *azx_dev = get_azx_dev(substream);
1988 struct azx *chip = apcm->chip; 2004 struct azx *chip = apcm->chip;
1989 struct snd_pcm_runtime *runtime = substream->runtime;
1990 struct hda_pcm_stream *hinfo = apcm->hinfo[substream->stream]; 2005 struct hda_pcm_stream *hinfo = apcm->hinfo[substream->stream];
1991 2006
1992 /* reset BDL address */ 2007 /* reset BDL address */
@@ -1999,7 +2014,7 @@ static int azx_pcm_hw_free(struct snd_pcm_substream *substream)
1999 2014
2000 snd_hda_codec_cleanup(apcm->codec, hinfo, substream); 2015 snd_hda_codec_cleanup(apcm->codec, hinfo, substream);
2001 2016
2002 mark_runtime_wc(chip, azx_dev, runtime, false); 2017 mark_runtime_wc(chip, azx_dev, substream, false);
2003 return snd_pcm_lib_free_pages(substream); 2018 return snd_pcm_lib_free_pages(substream);
2004} 2019}
2005 2020
@@ -3586,13 +3601,13 @@ static void azx_remove(struct pci_dev *pci)
3586static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { 3601static DEFINE_PCI_DEVICE_TABLE(azx_ids) = {
3587 /* CPT */ 3602 /* CPT */
3588 { PCI_DEVICE(0x8086, 0x1c20), 3603 { PCI_DEVICE(0x8086, 0x1c20),
3589 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, 3604 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH_NOPM },
3590 /* PBG */ 3605 /* PBG */
3591 { PCI_DEVICE(0x8086, 0x1d20), 3606 { PCI_DEVICE(0x8086, 0x1d20),
3592 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, 3607 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH_NOPM },
3593 /* Panther Point */ 3608 /* Panther Point */
3594 { PCI_DEVICE(0x8086, 0x1e20), 3609 { PCI_DEVICE(0x8086, 0x1e20),
3595 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, 3610 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH_NOPM },
3596 /* Lynx Point */ 3611 /* Lynx Point */
3597 { PCI_DEVICE(0x8086, 0x8c20), 3612 { PCI_DEVICE(0x8086, 0x8c20),
3598 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, 3613 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH },
@@ -3610,13 +3625,12 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = {
3610 /* 5 Series/3400 */ 3625 /* 5 Series/3400 */
3611 { PCI_DEVICE(0x8086, 0x3b56), 3626 { PCI_DEVICE(0x8086, 0x3b56),
3612 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH }, 3627 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH },
3613 /* SCH */ 3628 /* Poulsbo */
3614 { PCI_DEVICE(0x8086, 0x811b), 3629 { PCI_DEVICE(0x8086, 0x811b),
3615 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | 3630 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM },
3616 AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_LPIB }, /* Poulsbo */ 3631 /* Oaktrail */
3617 { PCI_DEVICE(0x8086, 0x080a), 3632 { PCI_DEVICE(0x8086, 0x080a),
3618 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | 3633 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM },
3619 AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_LPIB }, /* Oaktrail */
3620 /* ICH */ 3634 /* ICH */
3621 { PCI_DEVICE(0x8086, 0x2668), 3635 { PCI_DEVICE(0x8086, 0x2668),
3622 .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC | 3636 .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 60890bfecc19..009b77a693cf 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -558,24 +558,12 @@ static int conexant_build_controls(struct hda_codec *codec)
558 return 0; 558 return 0;
559} 559}
560 560
561#ifdef CONFIG_PM
562static int conexant_suspend(struct hda_codec *codec)
563{
564 snd_hda_shutup_pins(codec);
565 return 0;
566}
567#endif
568
569static const struct hda_codec_ops conexant_patch_ops = { 561static const struct hda_codec_ops conexant_patch_ops = {
570 .build_controls = conexant_build_controls, 562 .build_controls = conexant_build_controls,
571 .build_pcms = conexant_build_pcms, 563 .build_pcms = conexant_build_pcms,
572 .init = conexant_init, 564 .init = conexant_init,
573 .free = conexant_free, 565 .free = conexant_free,
574 .set_power_state = conexant_set_power, 566 .set_power_state = conexant_set_power,
575#ifdef CONFIG_PM
576 .suspend = conexant_suspend,
577#endif
578 .reboot_notify = snd_hda_shutup_pins,
579}; 567};
580 568
581#ifdef CONFIG_SND_HDA_INPUT_BEEP 569#ifdef CONFIG_SND_HDA_INPUT_BEEP
@@ -4405,10 +4393,6 @@ static const struct hda_codec_ops cx_auto_patch_ops = {
4405 .init = cx_auto_init, 4393 .init = cx_auto_init,
4406 .free = conexant_free, 4394 .free = conexant_free,
4407 .unsol_event = snd_hda_jack_unsol_event, 4395 .unsol_event = snd_hda_jack_unsol_event,
4408#ifdef CONFIG_PM
4409 .suspend = conexant_suspend,
4410#endif
4411 .reboot_notify = snd_hda_shutup_pins,
4412}; 4396};
4413 4397
4414/* 4398/*
@@ -4652,6 +4636,12 @@ static const struct hda_codec_preset snd_hda_preset_conexant[] = {
4652 .patch = patch_conexant_auto }, 4636 .patch = patch_conexant_auto },
4653 { .id = 0x14f15111, .name = "CX20753/4", 4637 { .id = 0x14f15111, .name = "CX20753/4",
4654 .patch = patch_conexant_auto }, 4638 .patch = patch_conexant_auto },
4639 { .id = 0x14f15113, .name = "CX20755",
4640 .patch = patch_conexant_auto },
4641 { .id = 0x14f15114, .name = "CX20756",
4642 .patch = patch_conexant_auto },
4643 { .id = 0x14f15115, .name = "CX20757",
4644 .patch = patch_conexant_auto },
4655 {} /* terminator */ 4645 {} /* terminator */
4656}; 4646};
4657 4647
@@ -4675,6 +4665,9 @@ MODULE_ALIAS("snd-hda-codec-id:14f150b9");
4675MODULE_ALIAS("snd-hda-codec-id:14f1510f"); 4665MODULE_ALIAS("snd-hda-codec-id:14f1510f");
4676MODULE_ALIAS("snd-hda-codec-id:14f15110"); 4666MODULE_ALIAS("snd-hda-codec-id:14f15110");
4677MODULE_ALIAS("snd-hda-codec-id:14f15111"); 4667MODULE_ALIAS("snd-hda-codec-id:14f15111");
4668MODULE_ALIAS("snd-hda-codec-id:14f15113");
4669MODULE_ALIAS("snd-hda-codec-id:14f15114");
4670MODULE_ALIAS("snd-hda-codec-id:14f15115");
4678 4671
4679MODULE_LICENSE("GPL"); 4672MODULE_LICENSE("GPL");
4680MODULE_DESCRIPTION("Conexant HD-audio codec"); 4673MODULE_DESCRIPTION("Conexant HD-audio codec");
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index b6c21ea187ca..807a2aa1ff38 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -1502,7 +1502,7 @@ static int hdmi_chmap_ctl_put(struct snd_kcontrol *kcontrol,
1502 ctl_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 1502 ctl_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1503 substream = snd_pcm_chmap_substream(info, ctl_idx); 1503 substream = snd_pcm_chmap_substream(info, ctl_idx);
1504 if (!substream || !substream->runtime) 1504 if (!substream || !substream->runtime)
1505 return -EBADFD; 1505 return 0; /* just for avoiding error from alsactl restore */
1506 switch (substream->runtime->status->state) { 1506 switch (substream->runtime->status->state) {
1507 case SNDRV_PCM_STATE_OPEN: 1507 case SNDRV_PCM_STATE_OPEN:
1508 case SNDRV_PCM_STATE_SETUP: 1508 case SNDRV_PCM_STATE_SETUP:
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 6ee34593774a..5faaad219a7f 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4694,6 +4694,7 @@ static const struct snd_pci_quirk alc880_fixup_tbl[] = {
4694 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB), 4694 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
4695 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810), 4695 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
4696 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM), 4696 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
4697 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST),
4697 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_FIXUP_F1734), 4698 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_FIXUP_F1734),
4698 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU), 4699 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
4699 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734), 4700 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
@@ -5708,6 +5709,7 @@ static const struct alc_model_fixup alc268_fixup_models[] = {
5708}; 5709};
5709 5710
5710static const struct snd_pci_quirk alc268_fixup_tbl[] = { 5711static const struct snd_pci_quirk alc268_fixup_tbl[] = {
5712 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
5711 /* below is codec SSID since multiple Toshiba laptops have the 5713 /* below is codec SSID since multiple Toshiba laptops have the
5712 * same PCI SSID 1179:ff00 5714 * same PCI SSID 1179:ff00
5713 */ 5715 */
@@ -5817,6 +5819,9 @@ enum {
5817 ALC269_TYPE_ALC269VB, 5819 ALC269_TYPE_ALC269VB,
5818 ALC269_TYPE_ALC269VC, 5820 ALC269_TYPE_ALC269VC,
5819 ALC269_TYPE_ALC269VD, 5821 ALC269_TYPE_ALC269VD,
5822 ALC269_TYPE_ALC280,
5823 ALC269_TYPE_ALC282,
5824 ALC269_TYPE_ALC284,
5820}; 5825};
5821 5826
5822/* 5827/*
@@ -5833,10 +5838,13 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
5833 switch (spec->codec_variant) { 5838 switch (spec->codec_variant) {
5834 case ALC269_TYPE_ALC269VA: 5839 case ALC269_TYPE_ALC269VA:
5835 case ALC269_TYPE_ALC269VC: 5840 case ALC269_TYPE_ALC269VC:
5841 case ALC269_TYPE_ALC280:
5842 case ALC269_TYPE_ALC284:
5836 ssids = alc269va_ssids; 5843 ssids = alc269va_ssids;
5837 break; 5844 break;
5838 case ALC269_TYPE_ALC269VB: 5845 case ALC269_TYPE_ALC269VB:
5839 case ALC269_TYPE_ALC269VD: 5846 case ALC269_TYPE_ALC269VD:
5847 case ALC269_TYPE_ALC282:
5840 ssids = alc269_ssids; 5848 ssids = alc269_ssids;
5841 break; 5849 break;
5842 default: 5850 default:
@@ -5992,6 +6000,30 @@ static void alc269_fixup_quanta_mute(struct hda_codec *codec,
5992 spec->automute_hook = alc269_quanta_automute; 6000 spec->automute_hook = alc269_quanta_automute;
5993} 6001}
5994 6002
6003/* update mute-LED according to the speaker mute state via mic1 VREF pin */
6004static void alc269_fixup_mic1_mute_hook(void *private_data, int enabled)
6005{
6006 struct hda_codec *codec = private_data;
6007 unsigned int pinval = AC_PINCTL_IN_EN + (enabled ?
6008 AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80);
6009 snd_hda_set_pin_ctl_cache(codec, 0x18, pinval);
6010}
6011
6012static void alc269_fixup_mic1_mute(struct hda_codec *codec,
6013 const struct alc_fixup *fix, int action)
6014{
6015 struct alc_spec *spec = codec->spec;
6016 switch (action) {
6017 case ALC_FIXUP_ACT_BUILD:
6018 spec->vmaster_mute.hook = alc269_fixup_mic1_mute_hook;
6019 snd_hda_add_vmaster_hook(codec, &spec->vmaster_mute, true);
6020 /* fallthru */
6021 case ALC_FIXUP_ACT_INIT:
6022 snd_hda_sync_vmaster_hook(&spec->vmaster_mute);
6023 break;
6024 }
6025}
6026
5995/* update mute-LED according to the speaker mute state via mic2 VREF pin */ 6027/* update mute-LED according to the speaker mute state via mic2 VREF pin */
5996static void alc269_fixup_mic2_mute_hook(void *private_data, int enabled) 6028static void alc269_fixup_mic2_mute_hook(void *private_data, int enabled)
5997{ 6029{
@@ -6043,6 +6075,7 @@ enum {
6043 ALC269_FIXUP_DMIC, 6075 ALC269_FIXUP_DMIC,
6044 ALC269VB_FIXUP_AMIC, 6076 ALC269VB_FIXUP_AMIC,
6045 ALC269VB_FIXUP_DMIC, 6077 ALC269VB_FIXUP_DMIC,
6078 ALC269_FIXUP_MIC1_MUTE_LED,
6046 ALC269_FIXUP_MIC2_MUTE_LED, 6079 ALC269_FIXUP_MIC2_MUTE_LED,
6047 ALC269_FIXUP_INV_DMIC, 6080 ALC269_FIXUP_INV_DMIC,
6048 ALC269_FIXUP_LENOVO_DOCK, 6081 ALC269_FIXUP_LENOVO_DOCK,
@@ -6171,6 +6204,10 @@ static const struct alc_fixup alc269_fixups[] = {
6171 { } 6204 { }
6172 }, 6205 },
6173 }, 6206 },
6207 [ALC269_FIXUP_MIC1_MUTE_LED] = {
6208 .type = ALC_FIXUP_FUNC,
6209 .v.func = alc269_fixup_mic1_mute,
6210 },
6174 [ALC269_FIXUP_MIC2_MUTE_LED] = { 6211 [ALC269_FIXUP_MIC2_MUTE_LED] = {
6175 .type = ALC_FIXUP_FUNC, 6212 .type = ALC_FIXUP_FUNC,
6176 .v.func = alc269_fixup_mic2_mute, 6213 .v.func = alc269_fixup_mic2_mute,
@@ -6215,6 +6252,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
6215 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC), 6252 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
6216 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC), 6253 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
6217 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_MIC2_MUTE_LED), 6254 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_MIC2_MUTE_LED),
6255 SND_PCI_QUIRK(0x103c, 0x1972, "HP Pavilion 17", ALC269_FIXUP_MIC1_MUTE_LED),
6256 SND_PCI_QUIRK(0x103c, 0x1977, "HP Pavilion 14", ALC269_FIXUP_MIC1_MUTE_LED),
6218 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_DMIC), 6257 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_DMIC),
6219 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_DMIC), 6258 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_DMIC),
6220 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), 6259 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
@@ -6229,6 +6268,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
6229 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), 6268 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
6230 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), 6269 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
6231 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), 6270 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
6271 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
6232 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK), 6272 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
6233 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC), 6273 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
6234 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK), 6274 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
@@ -6370,7 +6410,8 @@ static int patch_alc269(struct hda_codec *codec)
6370 6410
6371 alc_auto_parse_customize_define(codec); 6411 alc_auto_parse_customize_define(codec);
6372 6412
6373 if (codec->vendor_id == 0x10ec0269) { 6413 switch (codec->vendor_id) {
6414 case 0x10ec0269:
6374 spec->codec_variant = ALC269_TYPE_ALC269VA; 6415 spec->codec_variant = ALC269_TYPE_ALC269VA;
6375 switch (alc_get_coef0(codec) & 0x00f0) { 6416 switch (alc_get_coef0(codec) & 0x00f0) {
6376 case 0x0010: 6417 case 0x0010:
@@ -6395,6 +6436,20 @@ static int patch_alc269(struct hda_codec *codec)
6395 goto error; 6436 goto error;
6396 spec->init_hook = alc269_fill_coef; 6437 spec->init_hook = alc269_fill_coef;
6397 alc269_fill_coef(codec); 6438 alc269_fill_coef(codec);
6439 break;
6440
6441 case 0x10ec0280:
6442 case 0x10ec0290:
6443 spec->codec_variant = ALC269_TYPE_ALC280;
6444 break;
6445 case 0x10ec0282:
6446 case 0x10ec0283:
6447 spec->codec_variant = ALC269_TYPE_ALC282;
6448 break;
6449 case 0x10ec0284:
6450 case 0x10ec0292:
6451 spec->codec_variant = ALC269_TYPE_ALC284;
6452 break;
6398 } 6453 }
6399 6454
6400 /* automatic parse from the BIOS config */ 6455 /* automatic parse from the BIOS config */
@@ -7099,6 +7154,7 @@ static const struct hda_codec_preset snd_hda_preset_realtek[] = {
7099 { .id = 0x10ec0280, .name = "ALC280", .patch = patch_alc269 }, 7154 { .id = 0x10ec0280, .name = "ALC280", .patch = patch_alc269 },
7100 { .id = 0x10ec0282, .name = "ALC282", .patch = patch_alc269 }, 7155 { .id = 0x10ec0282, .name = "ALC282", .patch = patch_alc269 },
7101 { .id = 0x10ec0283, .name = "ALC283", .patch = patch_alc269 }, 7156 { .id = 0x10ec0283, .name = "ALC283", .patch = patch_alc269 },
7157 { .id = 0x10ec0284, .name = "ALC284", .patch = patch_alc269 },
7102 { .id = 0x10ec0290, .name = "ALC290", .patch = patch_alc269 }, 7158 { .id = 0x10ec0290, .name = "ALC290", .patch = patch_alc269 },
7103 { .id = 0x10ec0292, .name = "ALC292", .patch = patch_alc269 }, 7159 { .id = 0x10ec0292, .name = "ALC292", .patch = patch_alc269 },
7104 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", 7160 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 6e02e064d7b4..223c3d9cc69e 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -441,6 +441,7 @@ MODULE_SUPPORTED_DEVICE("{{RME HDSPM-MADI}}");
441*/ 441*/
442/* status */ 442/* status */
443#define HDSPM_AES32_wcLock 0x0200000 443#define HDSPM_AES32_wcLock 0x0200000
444#define HDSPM_AES32_wcSync 0x0100000
444#define HDSPM_AES32_wcFreq_bit 22 445#define HDSPM_AES32_wcFreq_bit 22
445/* (status >> HDSPM_AES32_wcFreq_bit) & 0xF gives WC frequency (cf function 446/* (status >> HDSPM_AES32_wcFreq_bit) & 0xF gives WC frequency (cf function
446 HDSPM_bit2freq */ 447 HDSPM_bit2freq */
@@ -3467,10 +3468,12 @@ static int hdspm_wc_sync_check(struct hdspm *hdspm)
3467 switch (hdspm->io_type) { 3468 switch (hdspm->io_type) {
3468 case AES32: 3469 case AES32:
3469 status = hdspm_read(hdspm, HDSPM_statusRegister); 3470 status = hdspm_read(hdspm, HDSPM_statusRegister);
3470 if (status & HDSPM_wcSync) 3471 if (status & HDSPM_AES32_wcLock) {
3471 return 2; 3472 if (status & HDSPM_AES32_wcSync)
3472 else if (status & HDSPM_wcLock) 3473 return 2;
3473 return 1; 3474 else
3475 return 1;
3476 }
3474 return 0; 3477 return 0;
3475 break; 3478 break;
3476 3479
@@ -4658,6 +4661,7 @@ snd_hdspm_proc_read_aes32(struct snd_info_entry * entry,
4658 unsigned int status; 4661 unsigned int status;
4659 unsigned int status2; 4662 unsigned int status2;
4660 unsigned int timecode; 4663 unsigned int timecode;
4664 unsigned int wcLock, wcSync;
4661 int pref_syncref; 4665 int pref_syncref;
4662 char *autosync_ref; 4666 char *autosync_ref;
4663 int x; 4667 int x;
@@ -4751,8 +4755,11 @@ snd_hdspm_proc_read_aes32(struct snd_info_entry * entry,
4751 4755
4752 snd_iprintf(buffer, "--- Status:\n"); 4756 snd_iprintf(buffer, "--- Status:\n");
4753 4757
4758 wcLock = status & HDSPM_AES32_wcLock;
4759 wcSync = wcLock && (status & HDSPM_AES32_wcSync);
4760
4754 snd_iprintf(buffer, "Word: %s Frequency: %d\n", 4761 snd_iprintf(buffer, "Word: %s Frequency: %d\n",
4755 (status & HDSPM_AES32_wcLock) ? "Sync " : "No Lock", 4762 (wcLock) ? (wcSync ? "Sync " : "Lock ") : "No Lock",
4756 HDSPM_bit2freq((status >> HDSPM_AES32_wcFreq_bit) & 0xF)); 4763 HDSPM_bit2freq((status >> HDSPM_AES32_wcFreq_bit) & 0xF));
4757 4764
4758 for (x = 0; x < 8; x++) { 4765 for (x = 0; x < 8; x++) {
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index adf397b9d0e6..ef62c435848e 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -446,15 +446,9 @@ static int arizona_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
446 case SND_SOC_DAIFMT_DSP_A: 446 case SND_SOC_DAIFMT_DSP_A:
447 mode = 0; 447 mode = 0;
448 break; 448 break;
449 case SND_SOC_DAIFMT_DSP_B:
450 mode = 1;
451 break;
452 case SND_SOC_DAIFMT_I2S: 449 case SND_SOC_DAIFMT_I2S:
453 mode = 2; 450 mode = 2;
454 break; 451 break;
455 case SND_SOC_DAIFMT_LEFT_J:
456 mode = 3;
457 break;
458 default: 452 default:
459 arizona_aif_err(dai, "Unsupported DAI format %d\n", 453 arizona_aif_err(dai, "Unsupported DAI format %d\n",
460 fmt & SND_SOC_DAIFMT_FORMAT_MASK); 454 fmt & SND_SOC_DAIFMT_FORMAT_MASK);
@@ -691,7 +685,7 @@ static int arizona_hw_params(struct snd_pcm_substream *substream,
691 } 685 }
692 sr_val = i; 686 sr_val = i;
693 687
694 lrclk = snd_soc_params_to_bclk(params) / params_rate(params); 688 lrclk = rates[bclk] / params_rate(params);
695 689
696 arizona_aif_dbg(dai, "BCLK %dHz LRCLK %dHz\n", 690 arizona_aif_dbg(dai, "BCLK %dHz LRCLK %dHz\n",
697 rates[bclk], rates[bclk] / lrclk); 691 rates[bclk], rates[bclk] / lrclk);
@@ -714,7 +708,8 @@ static int arizona_hw_params(struct snd_pcm_substream *substream,
714 snd_soc_update_bits(codec, ARIZONA_ASYNC_SAMPLE_RATE_1, 708 snd_soc_update_bits(codec, ARIZONA_ASYNC_SAMPLE_RATE_1,
715 ARIZONA_ASYNC_SAMPLE_RATE_MASK, sr_val); 709 ARIZONA_ASYNC_SAMPLE_RATE_MASK, sr_val);
716 snd_soc_update_bits(codec, base + ARIZONA_AIF_RATE_CTRL, 710 snd_soc_update_bits(codec, base + ARIZONA_AIF_RATE_CTRL,
717 ARIZONA_AIF1_RATE_MASK, 8); 711 ARIZONA_AIF1_RATE_MASK,
712 8 << ARIZONA_AIF1_RATE_SHIFT);
718 break; 713 break;
719 default: 714 default:
720 arizona_aif_err(dai, "Invalid clock %d\n", dai_priv->clk); 715 arizona_aif_err(dai, "Invalid clock %d\n", dai_priv->clk);
@@ -1087,6 +1082,9 @@ int arizona_init_fll(struct arizona *arizona, int id, int base, int lock_irq,
1087 id, ret); 1082 id, ret);
1088 } 1083 }
1089 1084
1085 regmap_update_bits(arizona->regmap, fll->base + 1,
1086 ARIZONA_FLL1_FREERUN, 0);
1087
1090 return 0; 1088 return 0;
1091} 1089}
1092EXPORT_SYMBOL_GPL(arizona_init_fll); 1090EXPORT_SYMBOL_GPL(arizona_init_fll);
diff --git a/sound/soc/codecs/arizona.h b/sound/soc/codecs/arizona.h
index 41dae1ed3b71..4deebeb07177 100644
--- a/sound/soc/codecs/arizona.h
+++ b/sound/soc/codecs/arizona.h
@@ -34,15 +34,15 @@
34 34
35#define ARIZONA_FLL_SRC_MCLK1 0 35#define ARIZONA_FLL_SRC_MCLK1 0
36#define ARIZONA_FLL_SRC_MCLK2 1 36#define ARIZONA_FLL_SRC_MCLK2 1
37#define ARIZONA_FLL_SRC_SLIMCLK 2 37#define ARIZONA_FLL_SRC_SLIMCLK 3
38#define ARIZONA_FLL_SRC_FLL1 3 38#define ARIZONA_FLL_SRC_FLL1 4
39#define ARIZONA_FLL_SRC_FLL2 4 39#define ARIZONA_FLL_SRC_FLL2 5
40#define ARIZONA_FLL_SRC_AIF1BCLK 5 40#define ARIZONA_FLL_SRC_AIF1BCLK 8
41#define ARIZONA_FLL_SRC_AIF2BCLK 6 41#define ARIZONA_FLL_SRC_AIF2BCLK 9
42#define ARIZONA_FLL_SRC_AIF3BCLK 7 42#define ARIZONA_FLL_SRC_AIF3BCLK 10
43#define ARIZONA_FLL_SRC_AIF1LRCLK 8 43#define ARIZONA_FLL_SRC_AIF1LRCLK 12
44#define ARIZONA_FLL_SRC_AIF2LRCLK 9 44#define ARIZONA_FLL_SRC_AIF2LRCLK 13
45#define ARIZONA_FLL_SRC_AIF3LRCLK 10 45#define ARIZONA_FLL_SRC_AIF3LRCLK 14
46 46
47#define ARIZONA_MIXER_VOL_MASK 0x00FE 47#define ARIZONA_MIXER_VOL_MASK 0x00FE
48#define ARIZONA_MIXER_VOL_SHIFT 1 48#define ARIZONA_MIXER_VOL_SHIFT 1
diff --git a/sound/soc/codecs/cs4271.c b/sound/soc/codecs/cs4271.c
index 4f1127935fdf..ac8742a1f25a 100644
--- a/sound/soc/codecs/cs4271.c
+++ b/sound/soc/codecs/cs4271.c
@@ -474,16 +474,16 @@ static int cs4271_probe(struct snd_soc_codec *codec)
474 struct cs4271_platform_data *cs4271plat = codec->dev->platform_data; 474 struct cs4271_platform_data *cs4271plat = codec->dev->platform_data;
475 int ret; 475 int ret;
476 int gpio_nreset = -EINVAL; 476 int gpio_nreset = -EINVAL;
477 int amutec_eq_bmutec = 0; 477 bool amutec_eq_bmutec = false;
478 478
479#ifdef CONFIG_OF 479#ifdef CONFIG_OF
480 if (of_match_device(cs4271_dt_ids, codec->dev)) { 480 if (of_match_device(cs4271_dt_ids, codec->dev)) {
481 gpio_nreset = of_get_named_gpio(codec->dev->of_node, 481 gpio_nreset = of_get_named_gpio(codec->dev->of_node,
482 "reset-gpio", 0); 482 "reset-gpio", 0);
483 483
484 if (!of_get_property(codec->dev->of_node, 484 if (of_get_property(codec->dev->of_node,
485 "cirrus,amutec-eq-bmutec", NULL)) 485 "cirrus,amutec-eq-bmutec", NULL))
486 amutec_eq_bmutec = 1; 486 amutec_eq_bmutec = true;
487 } 487 }
488#endif 488#endif
489 489
diff --git a/sound/soc/codecs/cs42l52.c b/sound/soc/codecs/cs42l52.c
index 99bb1c69499e..9811a5478c87 100644
--- a/sound/soc/codecs/cs42l52.c
+++ b/sound/soc/codecs/cs42l52.c
@@ -737,7 +737,7 @@ static const struct cs42l52_clk_para clk_map_table[] = {
737 737
738static int cs42l52_get_clk(int mclk, int rate) 738static int cs42l52_get_clk(int mclk, int rate)
739{ 739{
740 int i, ret = 0; 740 int i, ret = -EINVAL;
741 u_int mclk1, mclk2 = 0; 741 u_int mclk1, mclk2 = 0;
742 742
743 for (i = 0; i < ARRAY_SIZE(clk_map_table); i++) { 743 for (i = 0; i < ARRAY_SIZE(clk_map_table); i++) {
@@ -749,8 +749,6 @@ static int cs42l52_get_clk(int mclk, int rate)
749 } 749 }
750 } 750 }
751 } 751 }
752 if (ret > ARRAY_SIZE(clk_map_table))
753 return -EINVAL;
754 return ret; 752 return ret;
755} 753}
756 754
diff --git a/sound/soc/codecs/lm49453.c b/sound/soc/codecs/lm49453.c
index d75257d40a49..e19490cfb3a8 100644
--- a/sound/soc/codecs/lm49453.c
+++ b/sound/soc/codecs/lm49453.c
@@ -111,9 +111,9 @@ static struct reg_default lm49453_reg_defs[] = {
111 { 101, 0x00 }, 111 { 101, 0x00 },
112 { 102, 0x00 }, 112 { 102, 0x00 },
113 { 103, 0x01 }, 113 { 103, 0x01 },
114 { 105, 0x01 }, 114 { 104, 0x01 },
115 { 106, 0x00 }, 115 { 105, 0x00 },
116 { 107, 0x01 }, 116 { 106, 0x01 },
117 { 107, 0x00 }, 117 { 107, 0x00 },
118 { 108, 0x00 }, 118 { 108, 0x00 },
119 { 109, 0x00 }, 119 { 109, 0x00 },
@@ -163,56 +163,25 @@ static struct reg_default lm49453_reg_defs[] = {
163 { 184, 0x00 }, 163 { 184, 0x00 },
164 { 185, 0x00 }, 164 { 185, 0x00 },
165 { 186, 0x00 }, 165 { 186, 0x00 },
166 { 189, 0x00 }, 166 { 187, 0x00 },
167 { 188, 0x00 }, 167 { 188, 0x00 },
168 { 194, 0x00 }, 168 { 189, 0x00 },
169 { 195, 0x00 }, 169 { 208, 0x06 },
170 { 196, 0x00 },
171 { 197, 0x00 },
172 { 200, 0x00 },
173 { 201, 0x00 },
174 { 202, 0x00 },
175 { 203, 0x00 },
176 { 204, 0x00 },
177 { 205, 0x00 },
178 { 208, 0x00 },
179 { 209, 0x00 }, 170 { 209, 0x00 },
180 { 210, 0x00 }, 171 { 210, 0x08 },
181 { 211, 0x00 }, 172 { 211, 0x54 },
182 { 213, 0x00 }, 173 { 212, 0x14 },
183 { 214, 0x00 }, 174 { 213, 0x0d },
184 { 215, 0x00 }, 175 { 214, 0x0d },
185 { 216, 0x00 }, 176 { 215, 0x14 },
186 { 217, 0x00 }, 177 { 216, 0x60 },
187 { 218, 0x00 },
188 { 219, 0x00 },
189 { 221, 0x00 }, 178 { 221, 0x00 },
190 { 222, 0x00 }, 179 { 222, 0x00 },
180 { 223, 0x00 },
191 { 224, 0x00 }, 181 { 224, 0x00 },
192 { 225, 0x00 },
193 { 226, 0x00 },
194 { 227, 0x00 },
195 { 228, 0x00 },
196 { 229, 0x00 },
197 { 230, 0x13 },
198 { 231, 0x00 },
199 { 232, 0x80 },
200 { 233, 0x0C },
201 { 234, 0xDD },
202 { 235, 0x00 },
203 { 236, 0x04 },
204 { 237, 0x00 },
205 { 238, 0x00 },
206 { 239, 0x00 },
207 { 240, 0x00 },
208 { 241, 0x00 },
209 { 242, 0x00 },
210 { 243, 0x00 },
211 { 244, 0x00 },
212 { 245, 0x00 },
213 { 248, 0x00 }, 182 { 248, 0x00 },
214 { 249, 0x00 }, 183 { 249, 0x00 },
215 { 254, 0x00 }, 184 { 250, 0x00 },
216 { 255, 0x00 }, 185 { 255, 0x00 },
217}; 186};
218 187
@@ -525,36 +494,41 @@ SOC_DAPM_SINGLE("Port2_2 Switch", LM49453_P0_PORT2_TX2_REG, 7, 1, 0),
525}; 494};
526 495
527/* TLV Declarations */ 496/* TLV Declarations */
528static const DECLARE_TLV_DB_SCALE(digital_tlv, -7650, 150, 1); 497static const DECLARE_TLV_DB_SCALE(adc_dac_tlv, -7650, 150, 1);
529static const DECLARE_TLV_DB_SCALE(port_tlv, 0, 600, 0); 498static const DECLARE_TLV_DB_SCALE(mic_tlv, 0, 200, 1);
499static const DECLARE_TLV_DB_SCALE(port_tlv, -1800, 600, 0);
500static const DECLARE_TLV_DB_SCALE(stn_tlv, -7200, 150, 0);
530 501
531static const struct snd_kcontrol_new lm49453_sidetone_mixer_controls[] = { 502static const struct snd_kcontrol_new lm49453_sidetone_mixer_controls[] = {
532/* Sidetone supports mono only */ 503/* Sidetone supports mono only */
533SOC_DAPM_SINGLE_TLV("Sidetone ADCL Volume", LM49453_P0_STN_VOL_ADCL_REG, 504SOC_DAPM_SINGLE_TLV("Sidetone ADCL Volume", LM49453_P0_STN_VOL_ADCL_REG,
534 0, 0x3F, 0, digital_tlv), 505 0, 0x3F, 0, stn_tlv),
535SOC_DAPM_SINGLE_TLV("Sidetone ADCR Volume", LM49453_P0_STN_VOL_ADCR_REG, 506SOC_DAPM_SINGLE_TLV("Sidetone ADCR Volume", LM49453_P0_STN_VOL_ADCR_REG,
536 0, 0x3F, 0, digital_tlv), 507 0, 0x3F, 0, stn_tlv),
537SOC_DAPM_SINGLE_TLV("Sidetone DMIC1L Volume", LM49453_P0_STN_VOL_DMIC1L_REG, 508SOC_DAPM_SINGLE_TLV("Sidetone DMIC1L Volume", LM49453_P0_STN_VOL_DMIC1L_REG,
538 0, 0x3F, 0, digital_tlv), 509 0, 0x3F, 0, stn_tlv),
539SOC_DAPM_SINGLE_TLV("Sidetone DMIC1R Volume", LM49453_P0_STN_VOL_DMIC1R_REG, 510SOC_DAPM_SINGLE_TLV("Sidetone DMIC1R Volume", LM49453_P0_STN_VOL_DMIC1R_REG,
540 0, 0x3F, 0, digital_tlv), 511 0, 0x3F, 0, stn_tlv),
541SOC_DAPM_SINGLE_TLV("Sidetone DMIC2L Volume", LM49453_P0_STN_VOL_DMIC2L_REG, 512SOC_DAPM_SINGLE_TLV("Sidetone DMIC2L Volume", LM49453_P0_STN_VOL_DMIC2L_REG,
542 0, 0x3F, 0, digital_tlv), 513 0, 0x3F, 0, stn_tlv),
543SOC_DAPM_SINGLE_TLV("Sidetone DMIC2R Volume", LM49453_P0_STN_VOL_DMIC2R_REG, 514SOC_DAPM_SINGLE_TLV("Sidetone DMIC2R Volume", LM49453_P0_STN_VOL_DMIC2R_REG,
544 0, 0x3F, 0, digital_tlv), 515 0, 0x3F, 0, stn_tlv),
545}; 516};
546 517
547static const struct snd_kcontrol_new lm49453_snd_controls[] = { 518static const struct snd_kcontrol_new lm49453_snd_controls[] = {
548 /* mic1 and mic2 supports mono only */ 519 /* mic1 and mic2 supports mono only */
549 SOC_SINGLE_TLV("Mic1 Volume", LM49453_P0_ADC_LEVELL_REG, 0, 6, 520 SOC_SINGLE_TLV("Mic1 Volume", LM49453_P0_MICL_REG, 0, 15, 0, mic_tlv),
550 0, digital_tlv), 521 SOC_SINGLE_TLV("Mic2 Volume", LM49453_P0_MICR_REG, 0, 15, 0, mic_tlv),
551 SOC_SINGLE_TLV("Mic2 Volume", LM49453_P0_ADC_LEVELR_REG, 0, 6, 522
552 0, digital_tlv), 523 SOC_SINGLE_TLV("ADCL Volume", LM49453_P0_ADC_LEVELL_REG, 0, 63,
524 0, adc_dac_tlv),
525 SOC_SINGLE_TLV("ADCR Volume", LM49453_P0_ADC_LEVELR_REG, 0, 63,
526 0, adc_dac_tlv),
553 527
554 SOC_DOUBLE_R_TLV("DMIC1 Volume", LM49453_P0_DMIC1_LEVELL_REG, 528 SOC_DOUBLE_R_TLV("DMIC1 Volume", LM49453_P0_DMIC1_LEVELL_REG,
555 LM49453_P0_DMIC1_LEVELR_REG, 0, 6, 0, digital_tlv), 529 LM49453_P0_DMIC1_LEVELR_REG, 0, 63, 0, adc_dac_tlv),
556 SOC_DOUBLE_R_TLV("DMIC2 Volume", LM49453_P0_DMIC2_LEVELL_REG, 530 SOC_DOUBLE_R_TLV("DMIC2 Volume", LM49453_P0_DMIC2_LEVELL_REG,
557 LM49453_P0_DMIC2_LEVELR_REG, 0, 6, 0, digital_tlv), 531 LM49453_P0_DMIC2_LEVELR_REG, 0, 63, 0, adc_dac_tlv),
558 532
559 SOC_DAPM_ENUM("Mic2Mode", lm49453_mic2mode_enum), 533 SOC_DAPM_ENUM("Mic2Mode", lm49453_mic2mode_enum),
560 SOC_DAPM_ENUM("DMIC12 SRC", lm49453_dmic12_cfg_enum), 534 SOC_DAPM_ENUM("DMIC12 SRC", lm49453_dmic12_cfg_enum),
@@ -569,16 +543,16 @@ static const struct snd_kcontrol_new lm49453_snd_controls[] = {
569 2, 1, 0), 543 2, 1, 0),
570 544
571 SOC_DOUBLE_R_TLV("DAC HP Volume", LM49453_P0_DAC_HP_LEVELL_REG, 545 SOC_DOUBLE_R_TLV("DAC HP Volume", LM49453_P0_DAC_HP_LEVELL_REG,
572 LM49453_P0_DAC_HP_LEVELR_REG, 0, 6, 0, digital_tlv), 546 LM49453_P0_DAC_HP_LEVELR_REG, 0, 63, 0, adc_dac_tlv),
573 SOC_DOUBLE_R_TLV("DAC LO Volume", LM49453_P0_DAC_LO_LEVELL_REG, 547 SOC_DOUBLE_R_TLV("DAC LO Volume", LM49453_P0_DAC_LO_LEVELL_REG,
574 LM49453_P0_DAC_LO_LEVELR_REG, 0, 6, 0, digital_tlv), 548 LM49453_P0_DAC_LO_LEVELR_REG, 0, 63, 0, adc_dac_tlv),
575 SOC_DOUBLE_R_TLV("DAC LS Volume", LM49453_P0_DAC_LS_LEVELL_REG, 549 SOC_DOUBLE_R_TLV("DAC LS Volume", LM49453_P0_DAC_LS_LEVELL_REG,
576 LM49453_P0_DAC_LS_LEVELR_REG, 0, 6, 0, digital_tlv), 550 LM49453_P0_DAC_LS_LEVELR_REG, 0, 63, 0, adc_dac_tlv),
577 SOC_DOUBLE_R_TLV("DAC HA Volume", LM49453_P0_DAC_HA_LEVELL_REG, 551 SOC_DOUBLE_R_TLV("DAC HA Volume", LM49453_P0_DAC_HA_LEVELL_REG,
578 LM49453_P0_DAC_HA_LEVELR_REG, 0, 6, 0, digital_tlv), 552 LM49453_P0_DAC_HA_LEVELR_REG, 0, 63, 0, adc_dac_tlv),
579 553
580 SOC_SINGLE_TLV("EP Volume", LM49453_P0_DAC_LS_LEVELL_REG, 554 SOC_SINGLE_TLV("EP Volume", LM49453_P0_DAC_LS_LEVELL_REG,
581 0, 6, 0, digital_tlv), 555 0, 63, 0, adc_dac_tlv),
582 556
583 SOC_SINGLE_TLV("PORT1_1_RX_LVL Volume", LM49453_P0_PORT1_RX_LVL1_REG, 557 SOC_SINGLE_TLV("PORT1_1_RX_LVL Volume", LM49453_P0_PORT1_RX_LVL1_REG,
584 0, 3, 0, port_tlv), 558 0, 3, 0, port_tlv),
@@ -1218,7 +1192,7 @@ static int lm49453_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
1218 } 1192 }
1219 1193
1220 snd_soc_update_bits(codec, LM49453_P0_AUDIO_PORT1_BASIC_REG, 1194 snd_soc_update_bits(codec, LM49453_P0_AUDIO_PORT1_BASIC_REG,
1221 LM49453_AUDIO_PORT1_BASIC_FMT_MASK|BIT(1)|BIT(5), 1195 LM49453_AUDIO_PORT1_BASIC_FMT_MASK|BIT(0)|BIT(5),
1222 (aif_val | mode | clk_phase)); 1196 (aif_val | mode | clk_phase));
1223 1197
1224 snd_soc_write(codec, LM49453_P0_AUDIO_PORT1_RX_MSB_REG, clk_shift); 1198 snd_soc_write(codec, LM49453_P0_AUDIO_PORT1_RX_MSB_REG, clk_shift);
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index cb1675cd8e1c..92bbfec9b107 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -401,7 +401,7 @@ static const struct snd_kcontrol_new sgtl5000_snd_controls[] = {
401 5, 1, 0), 401 5, 1, 0),
402 402
403 SOC_SINGLE_TLV("Mic Volume", SGTL5000_CHIP_MIC_CTRL, 403 SOC_SINGLE_TLV("Mic Volume", SGTL5000_CHIP_MIC_CTRL,
404 0, 4, 0, mic_gain_tlv), 404 0, 3, 0, mic_gain_tlv),
405}; 405};
406 406
407/* mute the codec used by alsa core */ 407/* mute the codec used by alsa core */
@@ -1344,7 +1344,7 @@ static int sgtl5000_probe(struct snd_soc_codec *codec)
1344 SGTL5000_HP_ZCD_EN | 1344 SGTL5000_HP_ZCD_EN |
1345 SGTL5000_ADC_ZCD_EN); 1345 SGTL5000_ADC_ZCD_EN);
1346 1346
1347 snd_soc_write(codec, SGTL5000_CHIP_MIC_CTRL, 0); 1347 snd_soc_write(codec, SGTL5000_CHIP_MIC_CTRL, 2);
1348 1348
1349 /* 1349 /*
1350 * disable DAP 1350 * disable DAP
diff --git a/sound/soc/codecs/sta529.c b/sound/soc/codecs/sta529.c
index ab355c4f0b2d..40c07be9b581 100644
--- a/sound/soc/codecs/sta529.c
+++ b/sound/soc/codecs/sta529.c
@@ -74,9 +74,10 @@
74 SNDRV_PCM_FMTBIT_S32_LE) 74 SNDRV_PCM_FMTBIT_S32_LE)
75#define S2PC_VALUE 0x98 75#define S2PC_VALUE 0x98
76#define CLOCK_OUT 0x60 76#define CLOCK_OUT 0x60
77#define LEFT_J_DATA_FORMAT 0x10 77#define DATA_FORMAT_MSK 0x0E
78#define I2S_DATA_FORMAT 0x12 78#define LEFT_J_DATA_FORMAT 0x00
79#define RIGHT_J_DATA_FORMAT 0x14 79#define I2S_DATA_FORMAT 0x02
80#define RIGHT_J_DATA_FORMAT 0x04
80#define CODEC_MUTE_VAL 0x80 81#define CODEC_MUTE_VAL 0x80
81 82
82#define POWER_CNTLMSAK 0x40 83#define POWER_CNTLMSAK 0x40
@@ -289,7 +290,7 @@ static int sta529_set_dai_fmt(struct snd_soc_dai *codec_dai, u32 fmt)
289 return -EINVAL; 290 return -EINVAL;
290 } 291 }
291 292
292 snd_soc_update_bits(codec, STA529_S2PCFG0, 0x0D, mode); 293 snd_soc_update_bits(codec, STA529_S2PCFG0, DATA_FORMAT_MSK, mode);
293 294
294 return 0; 295 return 0;
295} 296}
diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c
index 1cbe88f01d63..12bcae63a7f0 100644
--- a/sound/soc/codecs/wm2000.c
+++ b/sound/soc/codecs/wm2000.c
@@ -209,9 +209,9 @@ static int wm2000_power_up(struct i2c_client *i2c, int analogue)
209 209
210 ret = wm2000_read(i2c, WM2000_REG_SPEECH_CLARITY); 210 ret = wm2000_read(i2c, WM2000_REG_SPEECH_CLARITY);
211 if (wm2000->speech_clarity) 211 if (wm2000->speech_clarity)
212 ret &= ~WM2000_SPEECH_CLARITY;
213 else
214 ret |= WM2000_SPEECH_CLARITY; 212 ret |= WM2000_SPEECH_CLARITY;
213 else
214 ret &= ~WM2000_SPEECH_CLARITY;
215 wm2000_write(i2c, WM2000_REG_SPEECH_CLARITY, ret); 215 wm2000_write(i2c, WM2000_REG_SPEECH_CLARITY, ret);
216 216
217 wm2000_write(i2c, WM2000_REG_SYS_START0, 0x33); 217 wm2000_write(i2c, WM2000_REG_SYS_START0, 0x33);
diff --git a/sound/soc/codecs/wm2200.c b/sound/soc/codecs/wm2200.c
index afcf31df77e0..d8c65f574658 100644
--- a/sound/soc/codecs/wm2200.c
+++ b/sound/soc/codecs/wm2200.c
@@ -1019,8 +1019,6 @@ static const char *wm2200_mixer_texts[] = {
1019 "EQR", 1019 "EQR",
1020 "LHPF1", 1020 "LHPF1",
1021 "LHPF2", 1021 "LHPF2",
1022 "LHPF3",
1023 "LHPF4",
1024 "DSP1.1", 1022 "DSP1.1",
1025 "DSP1.2", 1023 "DSP1.2",
1026 "DSP1.3", 1024 "DSP1.3",
@@ -1053,7 +1051,6 @@ static int wm2200_mixer_values[] = {
1053 0x25, 1051 0x25,
1054 0x50, /* EQ */ 1052 0x50, /* EQ */
1055 0x51, 1053 0x51,
1056 0x52,
1057 0x60, /* LHPF1 */ 1054 0x60, /* LHPF1 */
1058 0x61, /* LHPF2 */ 1055 0x61, /* LHPF2 */
1059 0x68, /* DSP1 */ 1056 0x68, /* DSP1 */
@@ -1566,15 +1563,9 @@ static int wm2200_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
1566 case SND_SOC_DAIFMT_DSP_A: 1563 case SND_SOC_DAIFMT_DSP_A:
1567 fmt_val = 0; 1564 fmt_val = 0;
1568 break; 1565 break;
1569 case SND_SOC_DAIFMT_DSP_B:
1570 fmt_val = 1;
1571 break;
1572 case SND_SOC_DAIFMT_I2S: 1566 case SND_SOC_DAIFMT_I2S:
1573 fmt_val = 2; 1567 fmt_val = 2;
1574 break; 1568 break;
1575 case SND_SOC_DAIFMT_LEFT_J:
1576 fmt_val = 3;
1577 break;
1578 default: 1569 default:
1579 dev_err(codec->dev, "Unsupported DAI format %d\n", 1570 dev_err(codec->dev, "Unsupported DAI format %d\n",
1580 fmt & SND_SOC_DAIFMT_FORMAT_MASK); 1571 fmt & SND_SOC_DAIFMT_FORMAT_MASK);
@@ -1626,7 +1617,7 @@ static int wm2200_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
1626 WM2200_AIF1TX_LRCLK_MSTR | WM2200_AIF1TX_LRCLK_INV, 1617 WM2200_AIF1TX_LRCLK_MSTR | WM2200_AIF1TX_LRCLK_INV,
1627 lrclk); 1618 lrclk);
1628 snd_soc_update_bits(codec, WM2200_AUDIO_IF_1_5, 1619 snd_soc_update_bits(codec, WM2200_AUDIO_IF_1_5,
1629 WM2200_AIF1_FMT_MASK << 1, fmt_val << 1); 1620 WM2200_AIF1_FMT_MASK, fmt_val);
1630 1621
1631 return 0; 1622 return 0;
1632} 1623}
diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c
index 5a5f36936235..54397a508073 100644
--- a/sound/soc/codecs/wm5100.c
+++ b/sound/soc/codecs/wm5100.c
@@ -1279,15 +1279,9 @@ static int wm5100_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
1279 case SND_SOC_DAIFMT_DSP_A: 1279 case SND_SOC_DAIFMT_DSP_A:
1280 mask = 0; 1280 mask = 0;
1281 break; 1281 break;
1282 case SND_SOC_DAIFMT_DSP_B:
1283 mask = 1;
1284 break;
1285 case SND_SOC_DAIFMT_I2S: 1282 case SND_SOC_DAIFMT_I2S:
1286 mask = 2; 1283 mask = 2;
1287 break; 1284 break;
1288 case SND_SOC_DAIFMT_LEFT_J:
1289 mask = 3;
1290 break;
1291 default: 1285 default:
1292 dev_err(codec->dev, "Unsupported DAI format %d\n", 1286 dev_err(codec->dev, "Unsupported DAI format %d\n",
1293 fmt & SND_SOC_DAIFMT_FORMAT_MASK); 1287 fmt & SND_SOC_DAIFMT_FORMAT_MASK);
diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c
index 688ade080589..1440b3f9b7bb 100644
--- a/sound/soc/codecs/wm5102.c
+++ b/sound/soc/codecs/wm5102.c
@@ -36,6 +36,9 @@
36struct wm5102_priv { 36struct wm5102_priv {
37 struct arizona_priv core; 37 struct arizona_priv core;
38 struct arizona_fll fll[2]; 38 struct arizona_fll fll[2];
39
40 unsigned int spk_ena:2;
41 unsigned int spk_ena_pending:1;
39}; 42};
40 43
41static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0); 44static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0);
@@ -787,6 +790,47 @@ ARIZONA_MIXER_CONTROLS("AIF3TX1", ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE),
787ARIZONA_MIXER_CONTROLS("AIF3TX2", ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE), 790ARIZONA_MIXER_CONTROLS("AIF3TX2", ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE),
788}; 791};
789 792
793static int wm5102_spk_ev(struct snd_soc_dapm_widget *w,
794 struct snd_kcontrol *kcontrol,
795 int event)
796{
797 struct snd_soc_codec *codec = w->codec;
798 struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
799 struct wm5102_priv *wm5102 = snd_soc_codec_get_drvdata(codec);
800
801 if (arizona->rev < 1)
802 return 0;
803
804 switch (event) {
805 case SND_SOC_DAPM_PRE_PMU:
806 if (!wm5102->spk_ena) {
807 snd_soc_write(codec, 0x4f5, 0x25a);
808 wm5102->spk_ena_pending = true;
809 }
810 break;
811 case SND_SOC_DAPM_POST_PMU:
812 if (wm5102->spk_ena_pending) {
813 msleep(75);
814 snd_soc_write(codec, 0x4f5, 0xda);
815 wm5102->spk_ena_pending = false;
816 wm5102->spk_ena++;
817 }
818 break;
819 case SND_SOC_DAPM_PRE_PMD:
820 wm5102->spk_ena--;
821 if (!wm5102->spk_ena)
822 snd_soc_write(codec, 0x4f5, 0x25a);
823 break;
824 case SND_SOC_DAPM_POST_PMD:
825 if (!wm5102->spk_ena)
826 snd_soc_write(codec, 0x4f5, 0x0da);
827 break;
828 }
829
830 return 0;
831}
832
833
790ARIZONA_MIXER_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE); 834ARIZONA_MIXER_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE);
791ARIZONA_MIXER_ENUMS(EQ2, ARIZONA_EQ2MIX_INPUT_1_SOURCE); 835ARIZONA_MIXER_ENUMS(EQ2, ARIZONA_EQ2MIX_INPUT_1_SOURCE);
792ARIZONA_MIXER_ENUMS(EQ3, ARIZONA_EQ3MIX_INPUT_1_SOURCE); 836ARIZONA_MIXER_ENUMS(EQ3, ARIZONA_EQ3MIX_INPUT_1_SOURCE);
@@ -852,8 +896,7 @@ static const unsigned int wm5102_aec_loopback_values[] = {
852 896
853static const struct soc_enum wm5102_aec_loopback = 897static const struct soc_enum wm5102_aec_loopback =
854 SOC_VALUE_ENUM_SINGLE(ARIZONA_DAC_AEC_CONTROL_1, 898 SOC_VALUE_ENUM_SINGLE(ARIZONA_DAC_AEC_CONTROL_1,
855 ARIZONA_AEC_LOOPBACK_SRC_SHIFT, 899 ARIZONA_AEC_LOOPBACK_SRC_SHIFT, 0xf,
856 ARIZONA_AEC_LOOPBACK_SRC_MASK,
857 ARRAY_SIZE(wm5102_aec_loopback_texts), 900 ARRAY_SIZE(wm5102_aec_loopback_texts),
858 wm5102_aec_loopback_texts, 901 wm5102_aec_loopback_texts,
859 wm5102_aec_loopback_values); 902 wm5102_aec_loopback_values);
@@ -1034,10 +1077,10 @@ SND_SOC_DAPM_PGA_E("OUT3L", ARIZONA_OUTPUT_ENABLES_1,
1034 ARIZONA_OUT3L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, 1077 ARIZONA_OUT3L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
1035 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), 1078 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
1036SND_SOC_DAPM_PGA_E("OUT4L", ARIZONA_OUTPUT_ENABLES_1, 1079SND_SOC_DAPM_PGA_E("OUT4L", ARIZONA_OUTPUT_ENABLES_1,
1037 ARIZONA_OUT4L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, 1080 ARIZONA_OUT4L_ENA_SHIFT, 0, NULL, 0, wm5102_spk_ev,
1038 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), 1081 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
1039SND_SOC_DAPM_PGA_E("OUT4R", ARIZONA_OUTPUT_ENABLES_1, 1082SND_SOC_DAPM_PGA_E("OUT4R", ARIZONA_OUTPUT_ENABLES_1,
1040 ARIZONA_OUT4R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, 1083 ARIZONA_OUT4R_ENA_SHIFT, 0, NULL, 0, wm5102_spk_ev,
1041 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), 1084 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
1042SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1, 1085SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1,
1043 ARIZONA_OUT5L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, 1086 ARIZONA_OUT5L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c
index ae80c8c28536..7a090968c4f7 100644
--- a/sound/soc/codecs/wm5110.c
+++ b/sound/soc/codecs/wm5110.c
@@ -344,8 +344,7 @@ static const unsigned int wm5110_aec_loopback_values[] = {
344 344
345static const struct soc_enum wm5110_aec_loopback = 345static const struct soc_enum wm5110_aec_loopback =
346 SOC_VALUE_ENUM_SINGLE(ARIZONA_DAC_AEC_CONTROL_1, 346 SOC_VALUE_ENUM_SINGLE(ARIZONA_DAC_AEC_CONTROL_1,
347 ARIZONA_AEC_LOOPBACK_SRC_SHIFT, 347 ARIZONA_AEC_LOOPBACK_SRC_SHIFT, 0xf,
348 ARIZONA_AEC_LOOPBACK_SRC_MASK,
349 ARRAY_SIZE(wm5110_aec_loopback_texts), 348 ARRAY_SIZE(wm5110_aec_loopback_texts),
350 wm5110_aec_loopback_texts, 349 wm5110_aec_loopback_texts,
351 wm5110_aec_loopback_values); 350 wm5110_aec_loopback_values);
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index ffc89fab96fb..b6b654837585 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -169,6 +169,7 @@ static int wm_adsp_load(struct wm_adsp *dsp)
169 const struct wm_adsp_region *mem; 169 const struct wm_adsp_region *mem;
170 const char *region_name; 170 const char *region_name;
171 char *file, *text; 171 char *file, *text;
172 void *buf;
172 unsigned int reg; 173 unsigned int reg;
173 int regions = 0; 174 int regions = 0;
174 int ret, offset, type, sizes; 175 int ret, offset, type, sizes;
@@ -322,8 +323,18 @@ static int wm_adsp_load(struct wm_adsp *dsp)
322 } 323 }
323 324
324 if (reg) { 325 if (reg) {
325 ret = regmap_raw_write(regmap, reg, region->data, 326 buf = kmemdup(region->data, le32_to_cpu(region->len),
327 GFP_KERNEL | GFP_DMA);
328 if (!buf) {
329 adsp_err(dsp, "Out of memory\n");
330 return -ENOMEM;
331 }
332
333 ret = regmap_raw_write(regmap, reg, buf,
326 le32_to_cpu(region->len)); 334 le32_to_cpu(region->len));
335
336 kfree(buf);
337
327 if (ret != 0) { 338 if (ret != 0) {
328 adsp_err(dsp, 339 adsp_err(dsp,
329 "%s.%d: Failed to write %d bytes at %d in %s: %d\n", 340 "%s.%d: Failed to write %d bytes at %d in %s: %d\n",
@@ -359,6 +370,7 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
359 const char *region_name; 370 const char *region_name;
360 int ret, pos, blocks, type, offset, reg; 371 int ret, pos, blocks, type, offset, reg;
361 char *file; 372 char *file;
373 void *buf;
362 374
363 file = kzalloc(PAGE_SIZE, GFP_KERNEL); 375 file = kzalloc(PAGE_SIZE, GFP_KERNEL);
364 if (file == NULL) 376 if (file == NULL)
@@ -384,7 +396,7 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
384 hdr = (void*)&firmware->data[0]; 396 hdr = (void*)&firmware->data[0];
385 if (memcmp(hdr->magic, "WMDR", 4) != 0) { 397 if (memcmp(hdr->magic, "WMDR", 4) != 0) {
386 adsp_err(dsp, "%s: invalid magic\n", file); 398 adsp_err(dsp, "%s: invalid magic\n", file);
387 return -EINVAL; 399 goto out_fw;
388 } 400 }
389 401
390 adsp_dbg(dsp, "%s: v%d.%d.%d\n", file, 402 adsp_dbg(dsp, "%s: v%d.%d.%d\n", file,
@@ -426,6 +438,13 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
426 } 438 }
427 439
428 if (reg) { 440 if (reg) {
441 buf = kmemdup(blk->data, le32_to_cpu(blk->len),
442 GFP_KERNEL | GFP_DMA);
443 if (!buf) {
444 adsp_err(dsp, "Out of memory\n");
445 return -ENOMEM;
446 }
447
429 ret = regmap_raw_write(regmap, reg, blk->data, 448 ret = regmap_raw_write(regmap, reg, blk->data,
430 le32_to_cpu(blk->len)); 449 le32_to_cpu(blk->len));
431 if (ret != 0) { 450 if (ret != 0) {
@@ -433,6 +452,8 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
433 "%s.%d: Failed to write to %x in %s\n", 452 "%s.%d: Failed to write to %x in %s\n",
434 file, blocks, reg, region_name); 453 file, blocks, reg, region_name);
435 } 454 }
455
456 kfree(buf);
436 } 457 }
437 458
438 pos += le32_to_cpu(blk->len) + sizeof(*blk); 459 pos += le32_to_cpu(blk->len) + sizeof(*blk);
diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index 3b98159d9645..a210c8d7b4bc 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -108,18 +108,13 @@ if SND_IMX_SOC
108config SND_SOC_IMX_SSI 108config SND_SOC_IMX_SSI
109 tristate 109 tristate
110 110
111config SND_SOC_IMX_PCM
112 tristate
113
114config SND_SOC_IMX_PCM_FIQ 111config SND_SOC_IMX_PCM_FIQ
115 bool 112 tristate
116 select FIQ 113 select FIQ
117 select SND_SOC_IMX_PCM
118 114
119config SND_SOC_IMX_PCM_DMA 115config SND_SOC_IMX_PCM_DMA
120 bool 116 tristate
121 select SND_SOC_DMAENGINE_PCM 117 select SND_SOC_DMAENGINE_PCM
122 select SND_SOC_IMX_PCM
123 118
124config SND_SOC_IMX_AUDMUX 119config SND_SOC_IMX_AUDMUX
125 tristate 120 tristate
diff --git a/sound/soc/fsl/Makefile b/sound/soc/fsl/Makefile
index afd34794db53..ec1457915d7c 100644
--- a/sound/soc/fsl/Makefile
+++ b/sound/soc/fsl/Makefile
@@ -41,7 +41,10 @@ endif
41obj-$(CONFIG_SND_SOC_IMX_SSI) += snd-soc-imx-ssi.o 41obj-$(CONFIG_SND_SOC_IMX_SSI) += snd-soc-imx-ssi.o
42obj-$(CONFIG_SND_SOC_IMX_AUDMUX) += snd-soc-imx-audmux.o 42obj-$(CONFIG_SND_SOC_IMX_AUDMUX) += snd-soc-imx-audmux.o
43 43
44obj-$(CONFIG_SND_SOC_IMX_PCM) += snd-soc-imx-pcm.o 44obj-$(CONFIG_SND_SOC_IMX_PCM_FIQ) += snd-soc-imx-pcm-fiq.o
45snd-soc-imx-pcm-fiq-y := imx-pcm-fiq.o imx-pcm.o
46obj-$(CONFIG_SND_SOC_IMX_PCM_DMA) += snd-soc-imx-pcm-dma.o
47snd-soc-imx-pcm-dma-y := imx-pcm-dma.o imx-pcm.o
45 48
46# i.MX Machine Support 49# i.MX Machine Support
47snd-soc-eukrea-tlv320-objs := eukrea-tlv320.o 50snd-soc-eukrea-tlv320-objs := eukrea-tlv320.o
diff --git a/sound/soc/fsl/imx-pcm.c b/sound/soc/fsl/imx-pcm.c
index d5cd9eff3b48..0c9f188ddc68 100644
--- a/sound/soc/fsl/imx-pcm.c
+++ b/sound/soc/fsl/imx-pcm.c
@@ -31,7 +31,6 @@ int snd_imx_pcm_mmap(struct snd_pcm_substream *substream,
31 runtime->dma_bytes); 31 runtime->dma_bytes);
32 return ret; 32 return ret;
33} 33}
34EXPORT_SYMBOL_GPL(snd_imx_pcm_mmap);
35 34
36static int imx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream) 35static int imx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream)
37{ 36{
@@ -80,7 +79,6 @@ int imx_pcm_new(struct snd_soc_pcm_runtime *rtd)
80out: 79out:
81 return ret; 80 return ret;
82} 81}
83EXPORT_SYMBOL_GPL(imx_pcm_new);
84 82
85void imx_pcm_free(struct snd_pcm *pcm) 83void imx_pcm_free(struct snd_pcm *pcm)
86{ 84{
@@ -102,7 +100,6 @@ void imx_pcm_free(struct snd_pcm *pcm)
102 buf->area = NULL; 100 buf->area = NULL;
103 } 101 }
104} 102}
105EXPORT_SYMBOL_GPL(imx_pcm_free);
106 103
107MODULE_DESCRIPTION("Freescale i.MX PCM driver"); 104MODULE_DESCRIPTION("Freescale i.MX PCM driver");
108MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>"); 105MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>");
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 91d592ff67b7..2370063b5824 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1255,6 +1255,8 @@ static int soc_post_component_init(struct snd_soc_card *card,
1255 INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_CAPTURE].fe_clients); 1255 INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_CAPTURE].fe_clients);
1256 ret = device_add(rtd->dev); 1256 ret = device_add(rtd->dev);
1257 if (ret < 0) { 1257 if (ret < 0) {
1258 /* calling put_device() here to free the rtd->dev */
1259 put_device(rtd->dev);
1258 dev_err(card->dev, 1260 dev_err(card->dev,
1259 "ASoC: failed to register runtime device: %d\n", ret); 1261 "ASoC: failed to register runtime device: %d\n", ret);
1260 return ret; 1262 return ret;
@@ -1554,7 +1556,7 @@ static void soc_remove_aux_dev(struct snd_soc_card *card, int num)
1554 /* unregister the rtd device */ 1556 /* unregister the rtd device */
1555 if (rtd->dev_registered) { 1557 if (rtd->dev_registered) {
1556 device_remove_file(rtd->dev, &dev_attr_codec_reg); 1558 device_remove_file(rtd->dev, &dev_attr_codec_reg);
1557 device_del(rtd->dev); 1559 device_unregister(rtd->dev);
1558 rtd->dev_registered = 0; 1560 rtd->dev_registered = 0;
1559 } 1561 }
1560 1562
@@ -2917,7 +2919,7 @@ int snd_soc_info_volsw_range(struct snd_kcontrol *kcontrol,
2917 platform_max = mc->platform_max; 2919 platform_max = mc->platform_max;
2918 2920
2919 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 2921 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
2920 uinfo->count = 1; 2922 uinfo->count = snd_soc_volsw_is_stereo(mc) ? 2 : 1;
2921 uinfo->value.integer.min = 0; 2923 uinfo->value.integer.min = 0;
2922 uinfo->value.integer.max = platform_max - min; 2924 uinfo->value.integer.max = platform_max - min;
2923 2925
@@ -2941,12 +2943,14 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
2941 (struct soc_mixer_control *)kcontrol->private_value; 2943 (struct soc_mixer_control *)kcontrol->private_value;
2942 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 2944 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
2943 unsigned int reg = mc->reg; 2945 unsigned int reg = mc->reg;
2946 unsigned int rreg = mc->rreg;
2944 unsigned int shift = mc->shift; 2947 unsigned int shift = mc->shift;
2945 int min = mc->min; 2948 int min = mc->min;
2946 int max = mc->max; 2949 int max = mc->max;
2947 unsigned int mask = (1 << fls(max)) - 1; 2950 unsigned int mask = (1 << fls(max)) - 1;
2948 unsigned int invert = mc->invert; 2951 unsigned int invert = mc->invert;
2949 unsigned int val, val_mask; 2952 unsigned int val, val_mask;
2953 int ret;
2950 2954
2951 val = ((ucontrol->value.integer.value[0] + min) & mask); 2955 val = ((ucontrol->value.integer.value[0] + min) & mask);
2952 if (invert) 2956 if (invert)
@@ -2954,7 +2958,21 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
2954 val_mask = mask << shift; 2958 val_mask = mask << shift;
2955 val = val << shift; 2959 val = val << shift;
2956 2960
2957 return snd_soc_update_bits_locked(codec, reg, val_mask, val); 2961 ret = snd_soc_update_bits_locked(codec, reg, val_mask, val);
2962 if (ret != 0)
2963 return ret;
2964
2965 if (snd_soc_volsw_is_stereo(mc)) {
2966 val = ((ucontrol->value.integer.value[1] + min) & mask);
2967 if (invert)
2968 val = max - val;
2969 val_mask = mask << shift;
2970 val = val << shift;
2971
2972 ret = snd_soc_update_bits_locked(codec, rreg, val_mask, val);
2973 }
2974
2975 return ret;
2958} 2976}
2959EXPORT_SYMBOL_GPL(snd_soc_put_volsw_range); 2977EXPORT_SYMBOL_GPL(snd_soc_put_volsw_range);
2960 2978
@@ -2974,6 +2992,7 @@ int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol,
2974 (struct soc_mixer_control *)kcontrol->private_value; 2992 (struct soc_mixer_control *)kcontrol->private_value;
2975 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 2993 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
2976 unsigned int reg = mc->reg; 2994 unsigned int reg = mc->reg;
2995 unsigned int rreg = mc->rreg;
2977 unsigned int shift = mc->shift; 2996 unsigned int shift = mc->shift;
2978 int min = mc->min; 2997 int min = mc->min;
2979 int max = mc->max; 2998 int max = mc->max;
@@ -2988,6 +3007,16 @@ int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol,
2988 ucontrol->value.integer.value[0] = 3007 ucontrol->value.integer.value[0] =
2989 ucontrol->value.integer.value[0] - min; 3008 ucontrol->value.integer.value[0] - min;
2990 3009
3010 if (snd_soc_volsw_is_stereo(mc)) {
3011 ucontrol->value.integer.value[1] =
3012 (snd_soc_read(codec, rreg) >> shift) & mask;
3013 if (invert)
3014 ucontrol->value.integer.value[1] =
3015 max - ucontrol->value.integer.value[1];
3016 ucontrol->value.integer.value[1] =
3017 ucontrol->value.integer.value[1] - min;
3018 }
3019
2991 return 0; 3020 return 0;
2992} 3021}
2993EXPORT_SYMBOL_GPL(snd_soc_get_volsw_range); 3022EXPORT_SYMBOL_GPL(snd_soc_get_volsw_range);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 1e36bc81e5af..258acadb9e7d 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1023,7 +1023,7 @@ int dapm_regulator_event(struct snd_soc_dapm_widget *w,
1023 1023
1024 if (SND_SOC_DAPM_EVENT_ON(event)) { 1024 if (SND_SOC_DAPM_EVENT_ON(event)) {
1025 if (w->invert & SND_SOC_DAPM_REGULATOR_BYPASS) { 1025 if (w->invert & SND_SOC_DAPM_REGULATOR_BYPASS) {
1026 ret = regulator_allow_bypass(w->regulator, true); 1026 ret = regulator_allow_bypass(w->regulator, false);
1027 if (ret != 0) 1027 if (ret != 0)
1028 dev_warn(w->dapm->dev, 1028 dev_warn(w->dapm->dev,
1029 "ASoC: Failed to bypass %s: %d\n", 1029 "ASoC: Failed to bypass %s: %d\n",
@@ -1033,7 +1033,7 @@ int dapm_regulator_event(struct snd_soc_dapm_widget *w,
1033 return regulator_enable(w->regulator); 1033 return regulator_enable(w->regulator);
1034 } else { 1034 } else {
1035 if (w->invert & SND_SOC_DAPM_REGULATOR_BYPASS) { 1035 if (w->invert & SND_SOC_DAPM_REGULATOR_BYPASS) {
1036 ret = regulator_allow_bypass(w->regulator, false); 1036 ret = regulator_allow_bypass(w->regulator, true);
1037 if (ret != 0) 1037 if (ret != 0)
1038 dev_warn(w->dapm->dev, 1038 dev_warn(w->dapm->dev,
1039 "ASoC: Failed to unbypass %s: %d\n", 1039 "ASoC: Failed to unbypass %s: %d\n",
@@ -3039,6 +3039,14 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
3039 w->name, ret); 3039 w->name, ret);
3040 return NULL; 3040 return NULL;
3041 } 3041 }
3042
3043 if (w->invert & SND_SOC_DAPM_REGULATOR_BYPASS) {
3044 ret = regulator_allow_bypass(w->regulator, true);
3045 if (ret != 0)
3046 dev_warn(w->dapm->dev,
3047 "ASoC: Failed to unbypass %s: %d\n",
3048 w->name, ret);
3049 }
3042 break; 3050 break;
3043 case snd_soc_dapm_clock_supply: 3051 case snd_soc_dapm_clock_supply:
3044#ifdef CONFIG_CLKDEV_LOOKUP 3052#ifdef CONFIG_CLKDEV_LOOKUP
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index d7711fce119b..cf191e6aebbe 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -1243,6 +1243,7 @@ static int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream)
1243 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && 1243 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) &&
1244 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && 1244 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) &&
1245 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && 1245 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) &&
1246 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED) &&
1246 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) 1247 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP))
1247 continue; 1248 continue;
1248 1249
diff --git a/sound/usb/midi.c b/sound/usb/midi.c
index c183d34842ac..34b9bb7fe87c 100644
--- a/sound/usb/midi.c
+++ b/sound/usb/midi.c
@@ -2181,10 +2181,6 @@ int snd_usbmidi_create(struct snd_card *card,
2181 umidi->usb_protocol_ops = &snd_usbmidi_novation_ops; 2181 umidi->usb_protocol_ops = &snd_usbmidi_novation_ops;
2182 err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); 2182 err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints);
2183 break; 2183 break;
2184 case QUIRK_MIDI_MBOX2:
2185 umidi->usb_protocol_ops = &snd_usbmidi_midiman_ops;
2186 err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints);
2187 break;
2188 case QUIRK_MIDI_RAW_BYTES: 2184 case QUIRK_MIDI_RAW_BYTES:
2189 umidi->usb_protocol_ops = &snd_usbmidi_raw_ops; 2185 umidi->usb_protocol_ops = &snd_usbmidi_raw_ops;
2190 /* 2186 /*
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index ed4d89c8b52a..e90daf8cdaa8 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -1331,16 +1331,23 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void
1331 } 1331 }
1332 channels = (hdr->bLength - 7) / csize - 1; 1332 channels = (hdr->bLength - 7) / csize - 1;
1333 bmaControls = hdr->bmaControls; 1333 bmaControls = hdr->bmaControls;
1334 if (hdr->bLength < 7 + csize) {
1335 snd_printk(KERN_ERR "usbaudio: unit %u: "
1336 "invalid UAC_FEATURE_UNIT descriptor\n",
1337 unitid);
1338 return -EINVAL;
1339 }
1334 } else { 1340 } else {
1335 struct uac2_feature_unit_descriptor *ftr = _ftr; 1341 struct uac2_feature_unit_descriptor *ftr = _ftr;
1336 csize = 4; 1342 csize = 4;
1337 channels = (hdr->bLength - 6) / 4 - 1; 1343 channels = (hdr->bLength - 6) / 4 - 1;
1338 bmaControls = ftr->bmaControls; 1344 bmaControls = ftr->bmaControls;
1339 } 1345 if (hdr->bLength < 6 + csize) {
1340 1346 snd_printk(KERN_ERR "usbaudio: unit %u: "
1341 if (hdr->bLength < 7 || !csize || hdr->bLength < 7 + csize) { 1347 "invalid UAC_FEATURE_UNIT descriptor\n",
1342 snd_printk(KERN_ERR "usbaudio: unit %u: invalid UAC_FEATURE_UNIT descriptor\n", unitid); 1348 unitid);
1343 return -EINVAL; 1349 return -EINVAL;
1350 }
1344 } 1351 }
1345 1352
1346 /* parse the source unit */ 1353 /* parse the source unit */
diff --git a/sound/usb/mixer_maps.c b/sound/usb/mixer_maps.c
index e71fe55cebef..0e2ed3d05c45 100644
--- a/sound/usb/mixer_maps.c
+++ b/sound/usb/mixer_maps.c
@@ -179,6 +179,15 @@ static struct usbmix_name_map audigy2nx_map[] = {
179 { 0 } /* terminator */ 179 { 0 } /* terminator */
180}; 180};
181 181
182static struct usbmix_selector_map c400_selectors[] = {
183 {
184 .id = 0x80,
185 .count = 2,
186 .names = (const char*[]) {"Internal", "SPDIF"}
187 },
188 { 0 } /* terminator */
189};
190
182static struct usbmix_selector_map audigy2nx_selectors[] = { 191static struct usbmix_selector_map audigy2nx_selectors[] = {
183 { 192 {
184 .id = 14, /* Capture Source */ 193 .id = 14, /* Capture Source */
@@ -367,6 +376,10 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = {
367 .map = hercules_usb51_map, 376 .map = hercules_usb51_map,
368 }, 377 },
369 { 378 {
379 .id = USB_ID(0x0763, 0x2030),
380 .selector_map = c400_selectors,
381 },
382 {
370 .id = USB_ID(0x08bb, 0x2702), 383 .id = USB_ID(0x08bb, 0x2702),
371 .map = linex_map, 384 .map = linex_map,
372 .ignore_ctl_error = 1, 385 .ignore_ctl_error = 1,
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index 0422b1360af3..15520de1df56 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -1206,7 +1206,7 @@ static int snd_c400_create_mixer(struct usb_mixer_interface *mixer)
1206 * are valid they presents mono controls as L and R channels of 1206 * are valid they presents mono controls as L and R channels of
1207 * stereo. So we provide a good mixer here. 1207 * stereo. So we provide a good mixer here.
1208 */ 1208 */
1209struct std_mono_table ebox44_table[] = { 1209static struct std_mono_table ebox44_table[] = {
1210 { 1210 {
1211 .unitid = 4, 1211 .unitid = 4,
1212 .control = 1, 1212 .control = 1,
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index c6593101c049..d82e378d37cb 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -511,6 +511,16 @@ static int configure_sync_endpoint(struct snd_usb_substream *subs)
511 struct snd_usb_substream *sync_subs = 511 struct snd_usb_substream *sync_subs =
512 &subs->stream->substream[subs->direction ^ 1]; 512 &subs->stream->substream[subs->direction ^ 1];
513 513
514 if (subs->sync_endpoint->type != SND_USB_ENDPOINT_TYPE_DATA ||
515 !subs->stream)
516 return snd_usb_endpoint_set_params(subs->sync_endpoint,
517 subs->pcm_format,
518 subs->channels,
519 subs->period_bytes,
520 subs->cur_rate,
521 subs->cur_audiofmt,
522 NULL);
523
514 /* Try to find the best matching audioformat. */ 524 /* Try to find the best matching audioformat. */
515 list_for_each_entry(fp, &sync_subs->fmt_list, list) { 525 list_for_each_entry(fp, &sync_subs->fmt_list, list) {
516 int score = match_endpoint_audioformats(fp, subs->cur_audiofmt, 526 int score = match_endpoint_audioformats(fp, subs->cur_audiofmt,
diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
index cdcf6b45e8a8..64d25a7a4d59 100644
--- a/sound/usb/quirks-table.h
+++ b/sound/usb/quirks-table.h
@@ -50,6 +50,28 @@
50 } 50 }
51}, 51},
52 52
53{
54 /* Creative BT-D1 */
55 USB_DEVICE(0x041e, 0x0005),
56 .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
57 .ifnum = 1,
58 .type = QUIRK_AUDIO_FIXED_ENDPOINT,
59 .data = &(const struct audioformat) {
60 .formats = SNDRV_PCM_FMTBIT_S16_LE,
61 .channels = 2,
62 .iface = 1,
63 .altsetting = 1,
64 .altset_idx = 1,
65 .endpoint = 0x03,
66 .ep_attr = USB_ENDPOINT_XFER_ISOC,
67 .attributes = 0,
68 .rates = SNDRV_PCM_RATE_CONTINUOUS,
69 .rate_min = 48000,
70 .rate_max = 48000,
71 }
72 }
73},
74
53/* Creative/Toshiba Multimedia Center SB-0500 */ 75/* Creative/Toshiba Multimedia Center SB-0500 */
54{ 76{
55 USB_DEVICE(0x041e, 0x3048), 77 USB_DEVICE(0x041e, 0x3048),
@@ -2267,7 +2289,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
2267 .rate_table = (unsigned int[]) { 2289 .rate_table = (unsigned int[]) {
2268 44100, 48000, 88200, 96000 2290 44100, 48000, 88200, 96000
2269 }, 2291 },
2270 .clock = 0x81, 2292 .clock = 0x80,
2271 } 2293 }
2272 }, 2294 },
2273 /* Capture */ 2295 /* Capture */
@@ -2293,7 +2315,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
2293 .rate_table = (unsigned int[]) { 2315 .rate_table = (unsigned int[]) {
2294 44100, 48000, 88200, 96000 2316 44100, 48000, 88200, 96000
2295 }, 2317 },
2296 .clock = 0x81, 2318 .clock = 0x80,
2297 } 2319 }
2298 }, 2320 },
2299 /* MIDI */ 2321 /* MIDI */
@@ -2993,7 +3015,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
2993 }, 3015 },
2994 { 3016 {
2995 .ifnum = 6, 3017 .ifnum = 6,
2996 .type = QUIRK_MIDI_MBOX2, 3018 .type = QUIRK_MIDI_MIDIMAN,
2997 .data = &(const struct snd_usb_midi_endpoint_info) { 3019 .data = &(const struct snd_usb_midi_endpoint_info) {
2998 .out_ep = 0x02, 3020 .out_ep = 0x02,
2999 .out_cables = 0x0001, 3021 .out_cables = 0x0001,
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index f104c68fe1e0..2c971858d6b7 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -306,7 +306,6 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip,
306 [QUIRK_MIDI_YAMAHA] = create_any_midi_quirk, 306 [QUIRK_MIDI_YAMAHA] = create_any_midi_quirk,
307 [QUIRK_MIDI_MIDIMAN] = create_any_midi_quirk, 307 [QUIRK_MIDI_MIDIMAN] = create_any_midi_quirk,
308 [QUIRK_MIDI_NOVATION] = create_any_midi_quirk, 308 [QUIRK_MIDI_NOVATION] = create_any_midi_quirk,
309 [QUIRK_MIDI_MBOX2] = create_any_midi_quirk,
310 [QUIRK_MIDI_RAW_BYTES] = create_any_midi_quirk, 309 [QUIRK_MIDI_RAW_BYTES] = create_any_midi_quirk,
311 [QUIRK_MIDI_EMAGIC] = create_any_midi_quirk, 310 [QUIRK_MIDI_EMAGIC] = create_any_midi_quirk,
312 [QUIRK_MIDI_CME] = create_any_midi_quirk, 311 [QUIRK_MIDI_CME] = create_any_midi_quirk,
@@ -388,11 +387,13 @@ static int snd_usb_fasttrackpro_boot_quirk(struct usb_device *dev)
388 * rules 387 * rules
389 */ 388 */
390 err = usb_driver_set_configuration(dev, 2); 389 err = usb_driver_set_configuration(dev, 2);
391 if (err < 0) { 390 if (err < 0)
392 snd_printdd("error usb_driver_set_configuration: %d\n", 391 snd_printdd("error usb_driver_set_configuration: %d\n",
393 err); 392 err);
394 return -ENODEV; 393 /* Always return an error, so that we stop creating a device
395 } 394 that will just be destroyed and recreated with a new
395 configuration */
396 return -ENODEV;
396 } else 397 } else
397 snd_printk(KERN_INFO "usb-audio: Fast Track Pro config OK\n"); 398 snd_printk(KERN_INFO "usb-audio: Fast Track Pro config OK\n");
398 399
@@ -528,11 +529,11 @@ static void mbox2_setup_48_24_magic(struct usb_device *dev)
528#define MBOX2_BOOT_LOADING 0x01 /* Hard coded into the device */ 529#define MBOX2_BOOT_LOADING 0x01 /* Hard coded into the device */
529#define MBOX2_BOOT_READY 0x02 /* Hard coded into the device */ 530#define MBOX2_BOOT_READY 0x02 /* Hard coded into the device */
530 531
531int snd_usb_mbox2_boot_quirk(struct usb_device *dev) 532static int snd_usb_mbox2_boot_quirk(struct usb_device *dev)
532{ 533{
533 struct usb_host_config *config = dev->actconfig; 534 struct usb_host_config *config = dev->actconfig;
534 int err; 535 int err;
535 u8 bootresponse; 536 u8 bootresponse[12];
536 int fwsize; 537 int fwsize;
537 int count; 538 int count;
538 539
@@ -546,20 +547,20 @@ int snd_usb_mbox2_boot_quirk(struct usb_device *dev)
546 snd_printd("usb-audio: Sending Digidesign Mbox 2 boot sequence...\n"); 547 snd_printd("usb-audio: Sending Digidesign Mbox 2 boot sequence...\n");
547 548
548 count = 0; 549 count = 0;
549 bootresponse = MBOX2_BOOT_LOADING; 550 bootresponse[0] = MBOX2_BOOT_LOADING;
550 while ((bootresponse == MBOX2_BOOT_LOADING) && (count < 10)) { 551 while ((bootresponse[0] == MBOX2_BOOT_LOADING) && (count < 10)) {
551 msleep(500); /* 0.5 second delay */ 552 msleep(500); /* 0.5 second delay */
552 snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), 553 snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0),
553 /* Control magic - load onboard firmware */ 554 /* Control magic - load onboard firmware */
554 0x85, 0xc0, 0x0001, 0x0000, &bootresponse, 0x0012); 555 0x85, 0xc0, 0x0001, 0x0000, &bootresponse, 0x0012);
555 if (bootresponse == MBOX2_BOOT_READY) 556 if (bootresponse[0] == MBOX2_BOOT_READY)
556 break; 557 break;
557 snd_printd("usb-audio: device not ready, resending boot sequence...\n"); 558 snd_printd("usb-audio: device not ready, resending boot sequence...\n");
558 count++; 559 count++;
559 } 560 }
560 561
561 if (bootresponse != MBOX2_BOOT_READY) { 562 if (bootresponse[0] != MBOX2_BOOT_READY) {
562 snd_printk(KERN_ERR "usb-audio: Unknown bootresponse=%d, or timed out, ignoring device.\n", bootresponse); 563 snd_printk(KERN_ERR "usb-audio: Unknown bootresponse=%d, or timed out, ignoring device.\n", bootresponse[0]);
563 return -ENODEV; 564 return -ENODEV;
564 } 565 }
565 566
@@ -660,7 +661,6 @@ static int audiophile_skip_setting_quirk(struct snd_usb_audio *chip,
660 return 0; /* keep this altsetting */ 661 return 0; /* keep this altsetting */
661} 662}
662 663
663
664static int fasttrackpro_skip_setting_quirk(struct snd_usb_audio *chip, 664static int fasttrackpro_skip_setting_quirk(struct snd_usb_audio *chip,
665 int iface, int altno) 665 int iface, int altno)
666{ 666{
@@ -861,6 +861,17 @@ void snd_usb_endpoint_start_quirk(struct snd_usb_endpoint *ep)
861 if ((le16_to_cpu(ep->chip->dev->descriptor.idVendor) == 0x23ba) && 861 if ((le16_to_cpu(ep->chip->dev->descriptor.idVendor) == 0x23ba) &&
862 ep->type == SND_USB_ENDPOINT_TYPE_SYNC) 862 ep->type == SND_USB_ENDPOINT_TYPE_SYNC)
863 ep->skip_packets = 4; 863 ep->skip_packets = 4;
864
865 /*
866 * M-Audio Fast Track C400 - when packets are not skipped, real world
867 * latency varies by approx. +/- 50 frames (at 96KHz) each time the
868 * stream is (re)started. When skipping packets 16 at endpoint start
869 * up, the real world latency is stable within +/- 1 frame (also
870 * across power cycles).
871 */
872 if (ep->chip->usb_id == USB_ID(0x0763, 0x2030) &&
873 ep->type == SND_USB_ENDPOINT_TYPE_DATA)
874 ep->skip_packets = 16;
864} 875}
865 876
866void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe, 877void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe,
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
index a8172c119796..1ac3fd9cc5a6 100644
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -76,7 +76,6 @@ enum quirk_type {
76 QUIRK_MIDI_YAMAHA, 76 QUIRK_MIDI_YAMAHA,
77 QUIRK_MIDI_MIDIMAN, 77 QUIRK_MIDI_MIDIMAN,
78 QUIRK_MIDI_NOVATION, 78 QUIRK_MIDI_NOVATION,
79 QUIRK_MIDI_MBOX2,
80 QUIRK_MIDI_RAW_BYTES, 79 QUIRK_MIDI_RAW_BYTES,
81 QUIRK_MIDI_EMAGIC, 80 QUIRK_MIDI_EMAGIC,
82 QUIRK_MIDI_CME, 81 QUIRK_MIDI_CME,
diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
index 80db3f4bcf7a..39d41068484f 100644
--- a/tools/perf/MANIFEST
+++ b/tools/perf/MANIFEST
@@ -11,11 +11,21 @@ lib/rbtree.c
11include/linux/swab.h 11include/linux/swab.h
12arch/*/include/asm/unistd*.h 12arch/*/include/asm/unistd*.h
13arch/*/include/asm/perf_regs.h 13arch/*/include/asm/perf_regs.h
14arch/*/include/uapi/asm/unistd*.h
15arch/*/include/uapi/asm/perf_regs.h
14arch/*/lib/memcpy*.S 16arch/*/lib/memcpy*.S
15arch/*/lib/memset*.S 17arch/*/lib/memset*.S
16include/linux/poison.h 18include/linux/poison.h
17include/linux/magic.h 19include/linux/magic.h
18include/linux/hw_breakpoint.h 20include/linux/hw_breakpoint.h
21include/linux/rbtree_augmented.h
22include/uapi/linux/perf_event.h
23include/uapi/linux/const.h
24include/uapi/linux/swab.h
25include/uapi/linux/hw_breakpoint.h
19arch/x86/include/asm/svm.h 26arch/x86/include/asm/svm.h
20arch/x86/include/asm/vmx.h 27arch/x86/include/asm/vmx.h
21arch/x86/include/asm/kvm_host.h 28arch/x86/include/asm/kvm_host.h
29arch/x86/include/uapi/asm/svm.h
30arch/x86/include/uapi/asm/vmx.h
31arch/x86/include/uapi/asm/kvm.h
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 891bc77bdb2c..8ab05e543ef4 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -58,7 +58,7 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
58 -e s/arm.*/arm/ -e s/sa110/arm/ \ 58 -e s/arm.*/arm/ -e s/sa110/arm/ \
59 -e s/s390x/s390/ -e s/parisc64/parisc/ \ 59 -e s/s390x/s390/ -e s/parisc64/parisc/ \
60 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ 60 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
61 -e s/sh[234].*/sh/ ) 61 -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ )
62NO_PERF_REGS := 1 62NO_PERF_REGS := 1
63 63
64CC = $(CROSS_COMPILE)gcc 64CC = $(CROSS_COMPILE)gcc
diff --git a/tools/testing/selftests/ipc/Makefile b/tools/testing/selftests/ipc/Makefile
new file mode 100644
index 000000000000..5386fd7c43ae
--- /dev/null
+++ b/tools/testing/selftests/ipc/Makefile
@@ -0,0 +1,25 @@
1uname_M := $(shell uname -m 2>/dev/null || echo not)
2ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/)
3ifeq ($(ARCH),i386)
4 ARCH := X86
5 CFLAGS := -DCONFIG_X86_32 -D__i386__
6endif
7ifeq ($(ARCH),x86_64)
8 ARCH := X86
9 CFLAGS := -DCONFIG_X86_64 -D__x86_64__
10endif
11
12CFLAGS += -I../../../../usr/include/
13
14all:
15ifeq ($(ARCH),X86)
16 gcc $(CFLAGS) msgque.c -o msgque_test
17else
18 echo "Not an x86 target, can't build msgque selftest"
19endif
20
21run_tests: all
22 ./msgque_test
23
24clean:
25 rm -fr ./msgque_test
diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c
new file mode 100644
index 000000000000..d66418237d21
--- /dev/null
+++ b/tools/testing/selftests/ipc/msgque.c
@@ -0,0 +1,246 @@
1#include <stdlib.h>
2#include <stdio.h>
3#include <string.h>
4#include <errno.h>
5#include <linux/msg.h>
6#include <fcntl.h>
7
8#define MAX_MSG_SIZE 32
9
10struct msg1 {
11 int msize;
12 long mtype;
13 char mtext[MAX_MSG_SIZE];
14};
15
16#define TEST_STRING "Test sysv5 msg"
17#define MSG_TYPE 1
18
19#define ANOTHER_TEST_STRING "Yet another test sysv5 msg"
20#define ANOTHER_MSG_TYPE 26538
21
22struct msgque_data {
23 key_t key;
24 int msq_id;
25 int qbytes;
26 int qnum;
27 int mode;
28 struct msg1 *messages;
29};
30
31int restore_queue(struct msgque_data *msgque)
32{
33 int fd, ret, id, i;
34 char buf[32];
35
36 fd = open("/proc/sys/kernel/msg_next_id", O_WRONLY);
37 if (fd == -1) {
38 printf("Failed to open /proc/sys/kernel/msg_next_id\n");
39 return -errno;
40 }
41 sprintf(buf, "%d", msgque->msq_id);
42
43 ret = write(fd, buf, strlen(buf));
44 if (ret != strlen(buf)) {
45 printf("Failed to write to /proc/sys/kernel/msg_next_id\n");
46 return -errno;
47 }
48
49 id = msgget(msgque->key, msgque->mode | IPC_CREAT | IPC_EXCL);
50 if (id == -1) {
51 printf("Failed to create queue\n");
52 return -errno;
53 }
54
55 if (id != msgque->msq_id) {
56 printf("Restored queue has wrong id (%d instead of %d)\n",
57 id, msgque->msq_id);
58 ret = -EFAULT;
59 goto destroy;
60 }
61
62 for (i = 0; i < msgque->qnum; i++) {
63 if (msgsnd(msgque->msq_id, &msgque->messages[i].mtype,
64 msgque->messages[i].msize, IPC_NOWAIT) != 0) {
65 printf("msgsnd failed (%m)\n");
66 ret = -errno;
67 goto destroy;
68 };
69 }
70 return 0;
71
72destroy:
73 if (msgctl(id, IPC_RMID, 0))
74 printf("Failed to destroy queue: %d\n", -errno);
75 return ret;
76}
77
78int check_and_destroy_queue(struct msgque_data *msgque)
79{
80 struct msg1 message;
81 int cnt = 0, ret;
82
83 while (1) {
84 ret = msgrcv(msgque->msq_id, &message.mtype, MAX_MSG_SIZE,
85 0, IPC_NOWAIT);
86 if (ret < 0) {
87 if (errno == ENOMSG)
88 break;
89 printf("Failed to read IPC message: %m\n");
90 ret = -errno;
91 goto err;
92 }
93 if (ret != msgque->messages[cnt].msize) {
94 printf("Wrong message size: %d (expected %d)\n", ret,
95 msgque->messages[cnt].msize);
96 ret = -EINVAL;
97 goto err;
98 }
99 if (message.mtype != msgque->messages[cnt].mtype) {
100 printf("Wrong message type\n");
101 ret = -EINVAL;
102 goto err;
103 }
104 if (memcmp(message.mtext, msgque->messages[cnt].mtext, ret)) {
105 printf("Wrong message content\n");
106 ret = -EINVAL;
107 goto err;
108 }
109 cnt++;
110 }
111
112 if (cnt != msgque->qnum) {
113 printf("Wrong message number\n");
114 ret = -EINVAL;
115 goto err;
116 }
117
118 ret = 0;
119err:
120 if (msgctl(msgque->msq_id, IPC_RMID, 0)) {
121 printf("Failed to destroy queue: %d\n", -errno);
122 return -errno;
123 }
124 return ret;
125}
126
127int dump_queue(struct msgque_data *msgque)
128{
129 struct msqid64_ds ds;
130 int kern_id;
131 int i, ret;
132
133 for (kern_id = 0; kern_id < 256; kern_id++) {
134 ret = msgctl(kern_id, MSG_STAT, &ds);
135 if (ret < 0) {
136 if (errno == -EINVAL)
137 continue;
138 printf("Failed to get stats for IPC queue with id %d\n",
139 kern_id);
140 return -errno;
141 }
142
143 if (ret == msgque->msq_id)
144 break;
145 }
146
147 msgque->messages = malloc(sizeof(struct msg1) * ds.msg_qnum);
148 if (msgque->messages == NULL) {
149 printf("Failed to get stats for IPC queue\n");
150 return -ENOMEM;
151 }
152
153 msgque->qnum = ds.msg_qnum;
154 msgque->mode = ds.msg_perm.mode;
155 msgque->qbytes = ds.msg_qbytes;
156
157 for (i = 0; i < msgque->qnum; i++) {
158 ret = msgrcv(msgque->msq_id, &msgque->messages[i].mtype,
159 MAX_MSG_SIZE, i, IPC_NOWAIT | MSG_COPY);
160 if (ret < 0) {
161 printf("Failed to copy IPC message: %m (%d)\n", errno);
162 return -errno;
163 }
164 msgque->messages[i].msize = ret;
165 }
166 return 0;
167}
168
169int fill_msgque(struct msgque_data *msgque)
170{
171 struct msg1 msgbuf;
172
173 msgbuf.mtype = MSG_TYPE;
174 memcpy(msgbuf.mtext, TEST_STRING, sizeof(TEST_STRING));
175 if (msgsnd(msgque->msq_id, &msgbuf.mtype, sizeof(TEST_STRING),
176 IPC_NOWAIT) != 0) {
177 printf("First message send failed (%m)\n");
178 return -errno;
179 };
180
181 msgbuf.mtype = ANOTHER_MSG_TYPE;
182 memcpy(msgbuf.mtext, ANOTHER_TEST_STRING, sizeof(ANOTHER_TEST_STRING));
183 if (msgsnd(msgque->msq_id, &msgbuf.mtype, sizeof(ANOTHER_TEST_STRING),
184 IPC_NOWAIT) != 0) {
185 printf("Second message send failed (%m)\n");
186 return -errno;
187 };
188 return 0;
189}
190
191int main(int argc, char **argv)
192{
193 int msg, pid, err;
194 struct msgque_data msgque;
195
196 msgque.key = ftok(argv[0], 822155650);
197 if (msgque.key == -1) {
198 printf("Can't make key\n");
199 return -errno;
200 }
201
202 msgque.msq_id = msgget(msgque.key, IPC_CREAT | IPC_EXCL | 0666);
203 if (msgque.msq_id == -1) {
204 printf("Can't create queue\n");
205 goto err_out;
206 }
207
208 err = fill_msgque(&msgque);
209 if (err) {
210 printf("Failed to fill queue\n");
211 goto err_destroy;
212 }
213
214 err = dump_queue(&msgque);
215 if (err) {
216 printf("Failed to dump queue\n");
217 goto err_destroy;
218 }
219
220 err = check_and_destroy_queue(&msgque);
221 if (err) {
222 printf("Failed to check and destroy queue\n");
223 goto err_out;
224 }
225
226 err = restore_queue(&msgque);
227 if (err) {
228 printf("Failed to restore queue\n");
229 goto err_destroy;
230 }
231
232 err = check_and_destroy_queue(&msgque);
233 if (err) {
234 printf("Failed to test queue\n");
235 goto err_out;
236 }
237 return 0;
238
239err_destroy:
240 if (msgctl(msgque.msq_id, IPC_RMID, 0)) {
241 printf("Failed to destroy queue: %d\n", -errno);
242 return -errno;
243 }
244err_out:
245 return err;
246}