From 57ca649d3ee5564375bc64685a8fd2ad04808bf1 Mon Sep 17 00:00:00 2001 From: Jonathan Brassow Date: Tue, 22 Jan 2013 21:42:18 -0600 Subject: [PATCH] --- yaml --- r: 349320 b: refs/heads/master c: 55ebbb59c1c6eb1b040f62b8c4ae0b724de6e55a h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/Documentation/device-mapper/dm-raid.txt | 1 + .../devicetree/bindings/clock/imx23-clock.txt | 5 + .../devicetree/bindings/clock/imx25-clock.txt | 4 + .../devicetree/bindings/clock/imx28-clock.txt | 5 + .../devicetree/bindings/clock/imx6q-clock.txt | 4 + .../bindings/gpio/gpio-poweroff.txt | 20 +- .../bindings/pinctrl/atmel,at91-pinctrl.txt | 5 +- trunk/Documentation/filesystems/f2fs.txt | 18 +- trunk/Documentation/networking/ip-sysctl.txt | 16 +- trunk/Documentation/power/runtime_pm.txt | 9 +- trunk/Documentation/sysctl/kernel.txt | 32 - trunk/MAINTAINERS | 247 ++-- trunk/Makefile | 4 +- trunk/arch/arm/Kconfig | 7 +- trunk/arch/arm/boot/dts/Makefile | 1 - trunk/arch/arm/boot/dts/armada-370-db.dts | 2 +- trunk/arch/arm/boot/dts/armada-370-xp.dtsi | 6 +- .../arch/arm/boot/dts/armada-xp-mv78230.dtsi | 23 +- .../arch/arm/boot/dts/armada-xp-mv78260.dtsi | 29 +- .../arch/arm/boot/dts/armada-xp-mv78460.dtsi | 29 +- trunk/arch/arm/boot/dts/armada-xp.dtsi | 14 +- trunk/arch/arm/boot/dts/at91rm9200.dtsi | 4 +- trunk/arch/arm/boot/dts/at91sam9260.dtsi | 18 - trunk/arch/arm/boot/dts/at91sam9263.dtsi | 36 - trunk/arch/arm/boot/dts/at91sam9g45.dtsi | 36 - trunk/arch/arm/boot/dts/at91sam9n12.dtsi | 26 - trunk/arch/arm/boot/dts/at91sam9x5.dtsi | 92 +- trunk/arch/arm/boot/dts/cros5250-common.dtsi | 12 +- trunk/arch/arm/boot/dts/dove-cubox.dts | 14 +- trunk/arch/arm/boot/dts/dove.dtsi | 1 - trunk/arch/arm/boot/dts/ecx-2000.dts | 4 - .../arch/arm/boot/dts/exynos4210-smdkv310.dts | 2 +- .../arch/arm/boot/dts/exynos5250-smdk5250.dts | 8 +- trunk/arch/arm/boot/dts/exynos5250.dtsi | 2 +- .../arch/arm/boot/dts/exynos5440-ssdk5440.dts | 2 +- trunk/arch/arm/boot/dts/highbank.dts | 20 +- trunk/arch/arm/boot/dts/imx23-olinuxino.dts | 8 +- trunk/arch/arm/boot/dts/imx31-bug.dts | 2 +- trunk/arch/arm/boot/dts/imx53.dtsi | 2 +- trunk/arch/arm/boot/dts/kirkwood-6282.dtsi | 1 - .../arm/boot/dts/kirkwood-ns2-common.dtsi | 16 - trunk/arch/arm/boot/dts/kirkwood-topkick.dts | 17 - trunk/arch/arm/boot/dts/kirkwood.dtsi | 3 - trunk/arch/arm/boot/dts/kizbox.dts | 2 - trunk/arch/arm/boot/dts/sunxi.dtsi | 6 +- .../arm/boot/dts/vexpress-v2p-ca15_a7.dts | 2 + trunk/arch/arm/common/vic.c | 9 +- trunk/arch/arm/configs/at91_dt_defconfig | 3 +- trunk/arch/arm/configs/mvebu_defconfig | 4 +- trunk/arch/arm/kernel/debug.S | 2 - trunk/arch/arm/kernel/head.S | 5 +- trunk/arch/arm/kernel/hyp-stub.S | 18 +- trunk/arch/arm/mach-at91/setup.c | 2 - trunk/arch/arm/mach-exynos/Kconfig | 2 - trunk/arch/arm/mach-exynos/common.c | 7 - trunk/arch/arm/mach-highbank/highbank.c | 2 +- trunk/arch/arm/mach-highbank/hotplug.c | 2 +- trunk/arch/arm/mach-highbank/platsmp.c | 12 +- trunk/arch/arm/mach-highbank/pm.c | 19 +- trunk/arch/arm/mach-highbank/sysregs.h | 23 +- trunk/arch/arm/mach-highbank/system.c | 4 +- trunk/arch/arm/mach-imx/Kconfig | 3 +- trunk/arch/arm/mach-imx/clk-imx25.c | 6 +- trunk/arch/arm/mach-imx/clk-imx27.c | 6 +- trunk/arch/arm/mach-imx/clk-imx31.c | 6 +- trunk/arch/arm/mach-imx/clk-imx35.c | 6 +- trunk/arch/arm/mach-imx/clk-imx51-imx53.c | 6 +- trunk/arch/arm/mach-imx/clk-imx6q.c | 3 - trunk/arch/arm/mach-imx/common.h | 1 - .../arm/mach-imx/devices/devices-common.h | 1 - .../mach-imx/devices/platform-fsl-usb2-udc.c | 15 +- .../arm/mach-imx/devices/platform-imx-fb.c | 2 +- trunk/arch/arm/mach-imx/hotplug.c | 10 +- .../imx-iram.h => arch/arm/mach-imx/iram.h} | 0 trunk/arch/arm/mach-imx/iram_alloc.c | 3 +- trunk/arch/arm/mach-imx/platsmp.c | 1 - trunk/arch/arm/mach-imx/pm-imx6q.c | 1 - trunk/arch/arm/mach-integrator/pci_v3.c | 14 +- trunk/arch/arm/mach-kirkwood/board-dt.c | 4 - trunk/arch/arm/mach-kirkwood/board-ns2.c | 38 + .../arm/mach-kirkwood/board-usi_topkick.c | 4 + trunk/arch/arm/mach-mvebu/Makefile | 2 - trunk/arch/arm/mach-nomadik/board-nhk8815.c | 1 + .../arch/arm/mach-nomadik/include/mach/irqs.h | 78 +- trunk/arch/arm/mach-omap1/board-ams-delta.c | 2 +- trunk/arch/arm/mach-omap1/usb.c | 8 +- trunk/arch/arm/mach-omap2/board-omap4panda.c | 6 - trunk/arch/arm/mach-omap2/cclock2420_data.c | 2 - trunk/arch/arm/mach-omap2/cclock2430_data.c | 2 - trunk/arch/arm/mach-omap2/cclock3xxx_data.c | 2 - trunk/arch/arm/mach-omap2/cclock44xx_data.c | 13 +- trunk/arch/arm/mach-omap2/devices.c | 2 +- trunk/arch/arm/mach-omap2/drm.c | 3 +- .../arm/mach-omap2/omap_hwmod_33xx_data.c | 6 +- .../arm/mach-omap2/omap_hwmod_44xx_data.c | 6 +- trunk/arch/arm/mach-omap2/prm2xxx.c | 88 +- trunk/arch/arm/mach-omap2/prm2xxx_3xxx.c | 22 + trunk/arch/arm/mach-omap2/prm3xxx.c | 28 +- trunk/arch/arm/mach-omap2/prm44xx.c | 6 +- trunk/arch/arm/mach-omap2/prm44xx.h | 4 +- trunk/arch/arm/mach-omap2/timer.c | 8 +- .../arm/mach-pxa/include/mach/mfp-pxa27x.h | 3 - trunk/arch/arm/mach-pxa/pxa27x.c | 4 +- .../arm/mach-s3c64xx/mach-crag6410-module.c | 2 +- trunk/arch/arm/mach-s3c64xx/pm.c | 2 - .../arm/mach-versatile/include/mach/irqs.h | 6 +- trunk/arch/arm/mach-vexpress/Kconfig | 1 + trunk/arch/arm/mm/cache-l2x0.c | 34 +- trunk/arch/arm/mm/dma-mapping.c | 18 +- trunk/arch/arm/mm/mmu.c | 2 +- trunk/arch/arm/mm/proc-v7.S | 4 +- trunk/arch/arm/plat-omap/counter_32k.c | 2 - trunk/arch/arm/plat-omap/sram.c | 2 - .../arch/arm/plat-samsung/include/plat/cpu.h | 2 +- trunk/arch/arm/plat-versatile/headsmp.S | 2 +- trunk/arch/arm/vfp/entry.S | 6 +- trunk/arch/arm/vfp/vfphw.S | 4 +- trunk/arch/arm64/boot/dts/Makefile | 1 - trunk/arch/arm64/include/asm/elf.h | 5 +- trunk/arch/arm64/include/asm/pgtable.h | 36 +- trunk/arch/arm64/include/asm/unistd32.h | 7 +- trunk/arch/arm64/kernel/vdso.c | 4 + trunk/arch/arm64/kernel/vdso/gettimeofday.S | 2 + trunk/arch/ia64/kernel/ptrace.c | 27 + trunk/arch/m68k/include/asm/dma-mapping.h | 16 - trunk/arch/m68k/include/asm/pgtable_no.h | 2 - trunk/arch/m68k/include/asm/unistd.h | 2 +- trunk/arch/m68k/include/uapi/asm/unistd.h | 1 - trunk/arch/m68k/kernel/syscalltable.S | 1 - trunk/arch/m68k/mm/init.c | 8 +- trunk/arch/microblaze/configs/mmu_defconfig | 52 +- trunk/arch/microblaze/configs/nommu_defconfig | 73 +- trunk/arch/microblaze/include/asm/highmem.h | 2 +- trunk/arch/microblaze/include/asm/uaccess.h | 2 +- trunk/arch/microblaze/include/asm/unistd.h | 2 + .../arch/microblaze/include/uapi/asm/unistd.h | 3 +- trunk/arch/microblaze/kernel/syscall_table.S | 1 - trunk/arch/microblaze/pci/pci-common.c | 11 +- trunk/arch/mips/Kconfig | 4 +- trunk/arch/mips/alchemy/common/time.c | 25 +- trunk/arch/mips/include/asm/page.h | 9 +- trunk/arch/mips/include/asm/thread_info.h | 9 +- trunk/arch/mips/include/uapi/asm/unistd.h | 15 +- trunk/arch/mips/kernel/asm-offsets.c | 3 - trunk/arch/mips/kernel/genex.S | 5 +- trunk/arch/mips/kernel/head.S | 1 + trunk/arch/mips/kernel/octeon_switch.S | 1 + trunk/arch/mips/kernel/perf_event_mipsxx.c | 38 + trunk/arch/mips/kernel/r2300_switch.S | 1 + trunk/arch/mips/kernel/r4k_switch.S | 1 + trunk/arch/mips/kernel/relocate_kernel.S | 3 +- trunk/arch/mips/kernel/scall32-o32.S | 1 - trunk/arch/mips/kernel/scall64-64.S | 1 - trunk/arch/mips/kernel/scall64-n32.S | 1 - trunk/arch/mips/kernel/scall64-o32.S | 1 - trunk/arch/mips/kernel/vmlinux.lds.S | 3 +- trunk/arch/mips/mm/ioremap.c | 6 - trunk/arch/mips/mm/tlbex-fault.S | 1 + trunk/arch/mips/mm/tlbex.c | 16 + trunk/arch/mips/power/hibernate.S | 3 +- trunk/arch/mn10300/Kconfig | 1 - trunk/arch/parisc/kernel/entry.S | 18 +- trunk/arch/parisc/kernel/irq.c | 6 +- trunk/arch/parisc/kernel/ptrace.c | 2 +- trunk/arch/parisc/kernel/signal.c | 4 +- trunk/arch/parisc/math-emu/cnv_float.h | 11 +- .../arch/powerpc/include/uapi/asm/kvm_para.h | 2 +- trunk/arch/powerpc/kvm/book3s_hv_ras.c | 4 - trunk/arch/powerpc/kvm/emulate.c | 2 - trunk/arch/s390/Makefile | 4 +- trunk/arch/s390/include/asm/dma.h | 6 - trunk/arch/s390/include/asm/io.h | 5 - trunk/arch/s390/include/asm/irq.h | 78 +- trunk/arch/s390/include/asm/pgtable.h | 5 +- trunk/arch/s390/include/asm/timex.h | 28 - trunk/arch/s390/include/uapi/asm/unistd.h | 3 +- trunk/arch/s390/kernel/compat_wrapper.S | 6 - trunk/arch/s390/kernel/debug.c | 11 +- trunk/arch/s390/kernel/irq.c | 124 +- trunk/arch/s390/kernel/nmi.c | 2 +- trunk/arch/s390/kernel/perf_cpum_cf.c | 2 +- trunk/arch/s390/kernel/runtime_instr.c | 2 +- trunk/arch/s390/kernel/setup.c | 3 +- trunk/arch/s390/kernel/smp.c | 12 +- trunk/arch/s390/kernel/syscalls.S | 1 - trunk/arch/s390/kernel/time.c | 6 +- trunk/arch/s390/kernel/topology.c | 2 - trunk/arch/s390/kvm/interrupt.c | 2 +- trunk/arch/s390/kvm/kvm-s390.c | 2 - trunk/arch/s390/mm/fault.c | 2 +- trunk/arch/s390/oprofile/hwsampler.c | 2 +- trunk/arch/s390/pci/pci.c | 33 +- trunk/arch/s390/pci/pci_dma.c | 2 + trunk/arch/sh/boards/mach-ecovec24/setup.c | 10 - trunk/arch/sh/include/asm/elf.h | 4 +- trunk/arch/sh/include/asm/processor_32.h | 2 +- trunk/arch/sh/include/asm/processor_64.h | 2 +- trunk/arch/sh/include/uapi/asm/unistd_32.h | 3 +- trunk/arch/sh/include/uapi/asm/unistd_64.h | 3 +- trunk/arch/sh/kernel/syscalls_32.S | 1 - trunk/arch/sh/kernel/syscalls_64.S | 1 - trunk/arch/sh/lib/mcount.S | 2 - trunk/arch/sparc/include/uapi/asm/unistd.h | 3 +- trunk/arch/sparc/kernel/pci.c | 12 +- trunk/arch/sparc/kernel/pci_psycho.c | 3 +- trunk/arch/sparc/kernel/pci_sabre.c | 3 +- trunk/arch/sparc/kernel/pci_schizo.c | 5 +- trunk/arch/sparc/kernel/systbls_32.S | 2 +- trunk/arch/sparc/kernel/systbls_64.S | 4 +- trunk/arch/x86/boot/compressed/eboot.c | 2 +- trunk/arch/x86/kernel/cpu/perf_event.c | 6 + trunk/arch/x86/kernel/entry_32.S | 1 + trunk/arch/x86/kernel/kvm.c | 12 +- trunk/arch/x86/kernel/setup.c | 80 -- trunk/arch/x86/kernel/step.c | 9 +- trunk/arch/x86/kvm/x86.c | 24 +- trunk/arch/x86/xen/smp.c | 7 + trunk/drivers/acpi/acpi_memhotplug.c | 18 + trunk/drivers/acpi/acpica/Makefile | 2 +- trunk/drivers/acpi/acpica/utclib.c | 749 +++++++++++ trunk/drivers/acpi/apei/apei-base.c | 3 - trunk/drivers/acpi/apei/erst-dbg.c | 11 +- trunk/drivers/acpi/device_pm.c | 3 +- trunk/drivers/acpi/glue.c | 11 +- trunk/drivers/acpi/power.c | 11 +- trunk/drivers/acpi/processor_idle.c | 4 - trunk/drivers/acpi/processor_perflib.c | 7 - trunk/drivers/acpi/scan.c | 2 +- trunk/drivers/ata/ahci.c | 8 +- trunk/drivers/ata/libahci.c | 6 +- trunk/drivers/ata/libata-core.c | 22 +- trunk/drivers/ata/libata-eh.c | 2 +- trunk/drivers/base/cpu.c | 2 +- trunk/drivers/base/firmware_class.c | 2 +- trunk/drivers/base/power/main.c | 9 +- trunk/drivers/base/power/qos.c | 10 +- trunk/drivers/base/regmap/regmap-debugfs.c | 51 +- trunk/drivers/base/regmap/regmap.c | 2 +- trunk/drivers/bcma/Kconfig | 3 +- trunk/drivers/bcma/driver_chipcommon_sflash.c | 2 +- trunk/drivers/block/virtio_blk.c | 7 +- trunk/drivers/bluetooth/ath3k.c | 10 - trunk/drivers/bluetooth/btusb.c | 5 - trunk/drivers/clk/mvebu/clk-cpu.c | 9 +- trunk/drivers/clk/mvebu/clk-gating-ctrl.c | 2 +- trunk/drivers/cpufreq/Kconfig | 5 - trunk/drivers/cpufreq/Kconfig.x86 | 2 +- trunk/drivers/cpufreq/Makefile | 5 +- trunk/drivers/cpufreq/acpi-cpufreq.c | 7 - trunk/drivers/cpufreq/cpufreq-cpu0.c | 5 - trunk/drivers/cpufreq/cpufreq_stats.c | 11 +- trunk/drivers/cpufreq/longhaul.c | 10 +- trunk/drivers/cpufreq/omap-cpufreq.c | 3 - trunk/drivers/cpuidle/coupled.c | 2 +- trunk/drivers/cpuidle/cpuidle.c | 17 +- trunk/drivers/cpuidle/driver.c | 33 +- trunk/drivers/cpuidle/governors/menu.c | 8 +- trunk/drivers/cpuidle/sysfs.c | 2 +- trunk/drivers/devfreq/devfreq.c | 5 - trunk/drivers/devfreq/exynos4_bus.c | 94 +- trunk/drivers/dma/imx-dma.c | 5 +- trunk/drivers/dma/ioat/dma_v3.c | 2 +- trunk/drivers/dma/mv_xor.c | 9 +- trunk/drivers/dma/tegra20-apb-dma.c | 8 +- trunk/drivers/edac/Kconfig | 8 +- trunk/drivers/edac/edac_mc_sysfs.c | 19 +- trunk/drivers/gpio/gpio-mvebu.c | 6 + trunk/drivers/gpio/gpio-samsung.c | 14 +- trunk/drivers/gpu/drm/drm_mm.c | 45 +- trunk/drivers/gpu/drm/exynos/exynos_drm_buf.c | 79 +- trunk/drivers/gpu/drm/exynos/exynos_drm_buf.h | 22 +- .../gpu/drm/exynos/exynos_drm_connector.c | 22 +- .../gpu/drm/exynos/exynos_drm_connector.h | 22 +- .../drivers/gpu/drm/exynos/exynos_drm_core.c | 22 +- .../drivers/gpu/drm/exynos/exynos_drm_crtc.c | 52 +- .../drivers/gpu/drm/exynos/exynos_drm_crtc.h | 23 +- .../gpu/drm/exynos/exynos_drm_dmabuf.c | 29 +- .../gpu/drm/exynos/exynos_drm_dmabuf.h | 22 +- trunk/drivers/gpu/drm/exynos/exynos_drm_drv.c | 22 +- trunk/drivers/gpu/drm/exynos/exynos_drm_drv.h | 22 +- .../gpu/drm/exynos/exynos_drm_encoder.c | 22 +- .../gpu/drm/exynos/exynos_drm_encoder.h | 22 +- trunk/drivers/gpu/drm/exynos/exynos_drm_fb.c | 22 +- trunk/drivers/gpu/drm/exynos/exynos_drm_fb.h | 22 +- .../drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 44 +- .../drivers/gpu/drm/exynos/exynos_drm_fbdev.h | 22 +- .../drivers/gpu/drm/exynos/exynos_drm_fimc.c | 124 +- .../drivers/gpu/drm/exynos/exynos_drm_fimc.h | 22 +- .../drivers/gpu/drm/exynos/exynos_drm_fimd.c | 32 +- trunk/drivers/gpu/drm/exynos/exynos_drm_gem.c | 22 +- trunk/drivers/gpu/drm/exynos/exynos_drm_gem.h | 22 +- trunk/drivers/gpu/drm/exynos/exynos_drm_gsc.c | 56 +- trunk/drivers/gpu/drm/exynos/exynos_drm_gsc.h | 22 +- .../drivers/gpu/drm/exynos/exynos_drm_hdmi.h | 22 +- .../drivers/gpu/drm/exynos/exynos_drm_iommu.c | 22 +- .../drivers/gpu/drm/exynos/exynos_drm_iommu.h | 22 +- trunk/drivers/gpu/drm/exynos/exynos_drm_ipp.c | 22 +- trunk/drivers/gpu/drm/exynos/exynos_drm_ipp.h | 26 +- .../gpu/drm/exynos/exynos_drm_rotator.c | 28 +- .../gpu/drm/exynos/exynos_drm_rotator.h | 22 +- .../drivers/gpu/drm/exynos/exynos_drm_vidi.c | 30 +- .../drivers/gpu/drm/exynos/exynos_drm_vidi.h | 22 +- trunk/drivers/gpu/drm/exynos/exynos_hdmi.h | 22 +- trunk/drivers/gpu/drm/exynos/exynos_mixer.c | 33 +- trunk/drivers/gpu/drm/i915/i915_debugfs.c | 3 - trunk/drivers/gpu/drm/i915/i915_drv.h | 3 - trunk/drivers/gpu/drm/i915/i915_gem.c | 25 +- trunk/drivers/gpu/drm/i915/i915_gem_dmabuf.c | 5 - .../gpu/drm/i915/i915_gem_execbuffer.c | 21 - trunk/drivers/gpu/drm/i915/i915_irq.c | 11 - trunk/drivers/gpu/drm/i915/i915_reg.h | 2 - trunk/drivers/gpu/drm/i915/intel_display.c | 33 +- trunk/drivers/gpu/drm/i915/intel_dp.c | 47 +- trunk/drivers/gpu/drm/i915/intel_lvds.c | 8 + trunk/drivers/gpu/drm/i915/intel_pm.c | 42 +- trunk/drivers/gpu/drm/i915/intel_sprite.c | 10 +- .../gpu/drm/nouveau/core/core/client.c | 4 +- .../gpu/drm/nouveau/core/core/handle.c | 5 +- .../gpu/drm/nouveau/core/engine/disp/nv50.c | 46 +- .../drm/nouveau/core/include/core/client.h | 3 - .../nouveau/core/include/subdev/bios/pll.h | 2 - .../gpu/drm/nouveau/core/subdev/bios/init.c | 1 + .../gpu/drm/nouveau/core/subdev/clock/nvc0.c | 2 - .../gpu/drm/nouveau/core/subdev/fb/nvc0.c | 6 +- .../drm/nouveau/core/subdev/instmem/base.c | 35 +- .../gpu/drm/nouveau/core/subdev/vm/base.c | 4 +- .../gpu/drm/nouveau/nouveau_connector.c | 30 +- .../drivers/gpu/drm/nouveau/nouveau_display.c | 9 + trunk/drivers/gpu/drm/nouveau/nouveau_drm.c | 7 +- trunk/drivers/gpu/drm/nouveau/nouveau_fence.h | 1 - trunk/drivers/gpu/drm/nouveau/nouveau_prime.c | 1 - trunk/drivers/gpu/drm/nouveau/nv04_dfp.c | 2 +- trunk/drivers/gpu/drm/nouveau/nv10_fence.c | 8 - trunk/drivers/gpu/drm/nouveau/nv50_fence.c | 1 - trunk/drivers/gpu/drm/radeon/evergreen.c | 6 - trunk/drivers/gpu/drm/radeon/ni.c | 6 - trunk/drivers/gpu/drm/radeon/r600.c | 16 +- trunk/drivers/gpu/drm/radeon/r600_cs.c | 43 +- trunk/drivers/gpu/drm/radeon/radeon.h | 3 +- trunk/drivers/gpu/drm/radeon/radeon_asic.c | 4 +- trunk/drivers/gpu/drm/radeon/radeon_asic.h | 4 - trunk/drivers/gpu/drm/radeon/radeon_cs.c | 9 +- trunk/drivers/gpu/drm/radeon/radeon_device.c | 28 - trunk/drivers/gpu/drm/radeon/radeon_drv.c | 3 +- .../gpu/drm/radeon/radeon_legacy_encoders.c | 8 - trunk/drivers/gpu/drm/radeon/radeon_object.c | 18 +- trunk/drivers/gpu/drm/radeon/radeon_prime.c | 1 - trunk/drivers/gpu/drm/radeon/radeon_ring.c | 2 - .../drivers/gpu/drm/radeon/radeon_semaphore.c | 4 - trunk/drivers/gpu/drm/radeon/reg_srcs/rv515 | 2 - trunk/drivers/gpu/drm/radeon/rv770.c | 74 -- trunk/drivers/gpu/drm/radeon/si.c | 6 - trunk/drivers/gpu/drm/ttm/ttm_bo.c | 1 - trunk/drivers/gpu/drm/ttm/ttm_bo_util.c | 15 +- trunk/drivers/gpu/drm/udl/udl_connector.c | 17 +- trunk/drivers/hv/hv_balloon.c | 35 +- trunk/drivers/hwmon/vexpress.c | 1 - .../drivers/i2c/busses/i2c-designware-core.c | 4 - trunk/drivers/i2c/busses/i2c-mxs.c | 6 +- trunk/drivers/i2c/busses/i2c-omap.c | 6 +- trunk/drivers/i2c/busses/i2c-sirf.c | 4 - trunk/drivers/i2c/muxes/i2c-mux-pinctrl.c | 2 +- trunk/drivers/idle/intel_idle.c | 5 +- trunk/drivers/iio/accel/Kconfig | 1 - trunk/drivers/iio/adc/ad7266.c | 6 +- trunk/drivers/iio/adc/at91_adc.c | 2 +- trunk/drivers/iio/adc/max1363.c | 13 +- trunk/drivers/iio/common/hid-sensors/Kconfig | 13 +- trunk/drivers/iio/common/hid-sensors/Makefile | 3 +- trunk/drivers/iio/dac/ad5380.c | 6 +- trunk/drivers/iio/dac/ad5446.c | 6 +- trunk/drivers/iio/dac/ad5504.c | 6 +- trunk/drivers/iio/dac/ad5624r_spi.c | 6 +- trunk/drivers/iio/dac/ad5686.c | 6 +- trunk/drivers/iio/dac/ad5791.c | 13 +- trunk/drivers/iio/frequency/adf4350.c | 2 +- trunk/drivers/iio/gyro/Kconfig | 1 - trunk/drivers/iio/light/Kconfig | 1 - trunk/drivers/iio/magnetometer/Kconfig | 1 - trunk/drivers/iommu/amd_iommu_init.c | 34 - trunk/drivers/isdn/gigaset/capi.c | 2 - trunk/drivers/md/dm-raid.c | 101 +- trunk/drivers/media/i2c/m5mols/m5mols_core.c | 2 +- trunk/drivers/media/platform/coda.c | 2 +- .../media/platform/omap3isp/ispvideo.c | 3 + .../media/platform/s5p-fimc/fimc-mdevice.c | 2 +- .../drivers/media/platform/s5p-mfc/s5p_mfc.c | 88 +- trunk/drivers/media/usb/gspca/kinect.c | 1 - trunk/drivers/media/usb/gspca/sonixb.c | 13 +- trunk/drivers/media/usb/gspca/sonixj.c | 1 - trunk/drivers/media/usb/uvc/uvc_ctrl.c | 4 +- trunk/drivers/media/usb/uvc/uvc_v4l2.c | 6 +- .../drivers/media/v4l2-core/videobuf2-core.c | 4 +- trunk/drivers/mfd/Kconfig | 2 - trunk/drivers/mfd/ab8500-core.c | 1 - trunk/drivers/mfd/arizona-core.c | 7 +- trunk/drivers/mfd/arizona-irq.c | 18 +- trunk/drivers/mfd/da9052-i2c.c | 61 - trunk/drivers/mfd/db8500-prcmu.c | 13 +- trunk/drivers/mfd/max77686.c | 18 +- trunk/drivers/mfd/max77693.c | 34 +- trunk/drivers/mfd/pcf50633-core.c | 5 +- trunk/drivers/mfd/rtl8411.c | 29 - trunk/drivers/mfd/rts5209.c | 21 - trunk/drivers/mfd/rts5229.c | 21 - trunk/drivers/mfd/rtsx_pcr.c | 27 +- trunk/drivers/mfd/tc3589x.c | 17 +- trunk/drivers/mfd/twl4030-power.c | 2 +- trunk/drivers/mfd/vexpress-config.c | 8 +- trunk/drivers/mfd/vexpress-sysreg.c | 32 +- trunk/drivers/mfd/wm5102-tables.c | 2 +- trunk/drivers/misc/atmel-ssc.c | 8 - trunk/drivers/misc/mei/amthif.c | 6 +- trunk/drivers/misc/ti-st/st_kim.c | 37 +- trunk/drivers/mmc/host/mvsdio.c | 92 +- trunk/drivers/mmc/host/rtsx_pci_sdmmc.c | 30 +- trunk/drivers/net/can/c_can/c_can.c | 4 +- trunk/drivers/net/can/pch_can.c | 2 +- trunk/drivers/net/can/ti_hecc.c | 4 +- trunk/drivers/net/ethernet/3com/3c574_cs.c | 2 +- trunk/drivers/net/ethernet/adi/Kconfig | 1 - .../net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 30 +- .../ethernet/broadcom/bnx2x/bnx2x_ethtool.c | 2 +- .../net/ethernet/broadcom/bnx2x/bnx2x_main.c | 60 +- trunk/drivers/net/ethernet/broadcom/tg3.c | 62 +- trunk/drivers/net/ethernet/calxeda/xgmac.c | 4 - .../net/ethernet/chelsio/cxgb4/cxgb4_main.c | 17 +- trunk/drivers/net/ethernet/emulex/benet/be.h | 1 - .../net/ethernet/emulex/benet/be_main.c | 29 +- .../drivers/net/ethernet/intel/ixgbe/Makefile | 3 +- .../net/ethernet/intel/ixgbe/ixgbe_debugfs.c | 5 + .../net/ethernet/intel/ixgbe/ixgbe_ptp.c | 4 +- .../net/ethernet/mellanox/mlx4/en_tx.c | 13 +- .../drivers/net/ethernet/mellanox/mlx4/main.c | 11 +- trunk/drivers/net/ethernet/nvidia/forcedeth.c | 35 - .../ethernet/qlogic/netxen/netxen_nic_init.c | 2 +- .../ethernet/qlogic/netxen/netxen_nic_main.c | 2 - .../net/ethernet/qlogic/qlge/qlge_main.c | 2 +- trunk/drivers/net/ethernet/realtek/r8169.c | 21 +- trunk/drivers/net/ethernet/xilinx/Kconfig | 2 +- .../net/ethernet/xilinx/xilinx_axienet_main.c | 2 +- trunk/drivers/net/hyperv/hyperv_net.h | 2 +- trunk/drivers/net/hyperv/netvsc_drv.c | 2 +- trunk/drivers/net/loopback.c | 5 - trunk/drivers/net/macvlan.c | 5 +- trunk/drivers/net/phy/icplus.c | 29 +- trunk/drivers/net/phy/marvell.c | 9 + trunk/drivers/net/tun.c | 89 +- trunk/drivers/net/usb/cdc_mbim.c | 19 - trunk/drivers/net/usb/cdc_ncm.c | 31 +- trunk/drivers/net/usb/dm9601.c | 52 +- trunk/drivers/net/usb/qmi_wwan.c | 3 - trunk/drivers/net/usb/usbnet.c | 4 - trunk/drivers/net/virtio_net.c | 118 +- trunk/drivers/net/vxlan.c | 1 - trunk/drivers/net/wireless/ath/Kconfig | 1 - trunk/drivers/net/wireless/ath/Makefile | 1 - trunk/drivers/net/wireless/ath/ath9k/Kconfig | 5 +- .../net/wireless/ath/ath9k/ar9003_calib.c | 2 - .../net/wireless/ath/ath9k/ar9003_hw.c | 2 +- .../net/wireless/ath/ath9k/ar9003_phy.c | 27 +- trunk/drivers/net/wireless/ath/ath9k/ath9k.h | 3 + trunk/drivers/net/wireless/ath/ath9k/beacon.c | 2 +- trunk/drivers/net/wireless/ath/ath9k/debug.c | 1 + trunk/drivers/net/wireless/ath/ath9k/debug.h | 2 + .../drivers/net/wireless/ath/ath9k/htc_hst.c | 2 - trunk/drivers/net/wireless/ath/ath9k/hw.h | 1 - trunk/drivers/net/wireless/ath/ath9k/main.c | 22 +- trunk/drivers/net/wireless/ath/ath9k/recv.c | 54 +- trunk/drivers/net/wireless/ath/carl9170/fw.c | 6 +- .../drivers/net/wireless/ath/wil6210/Kconfig | 29 - .../drivers/net/wireless/ath/wil6210/Makefile | 13 - .../net/wireless/ath/wil6210/cfg80211.c | 573 --------- .../net/wireless/ath/wil6210/dbg_hexdump.h | 30 - .../net/wireless/ath/wil6210/debugfs.c | 603 --------- .../net/wireless/ath/wil6210/interrupt.c | 471 ------- trunk/drivers/net/wireless/ath/wil6210/main.c | 407 ------ .../drivers/net/wireless/ath/wil6210/netdev.c | 157 --- .../net/wireless/ath/wil6210/pcie_bus.c | 223 ---- trunk/drivers/net/wireless/ath/wil6210/txrx.c | 871 ------------- trunk/drivers/net/wireless/ath/wil6210/txrx.h | 362 ------ .../net/wireless/ath/wil6210/wil6210.h | 363 ------ trunk/drivers/net/wireless/ath/wil6210/wmi.c | 975 -------------- trunk/drivers/net/wireless/ath/wil6210/wmi.h | 1116 ----------------- trunk/drivers/net/wireless/b43/b43.h | 5 - trunk/drivers/net/wireless/b43/main.c | 54 +- trunk/drivers/net/wireless/b43/main.h | 5 +- .../wireless/brcm80211/brcmfmac/wl_cfg80211.c | 5 +- .../net/wireless/brcm80211/brcmsmac/debug.h | 1 - .../wireless/brcm80211/brcmsmac/mac80211_if.c | 7 +- .../wireless/brcm80211/brcmsmac/phy/phy_lcn.c | 4 +- .../drivers/net/wireless/iwlegacy/3945-mac.c | 2 +- trunk/drivers/net/wireless/iwlegacy/common.c | 35 +- trunk/drivers/net/wireless/iwlwifi/dvm/tx.c | 26 +- trunk/drivers/net/wireless/iwlwifi/pcie/rx.c | 1 - trunk/drivers/net/wireless/mwifiex/cfg80211.c | 19 +- trunk/drivers/net/wireless/mwifiex/pcie.c | 2 +- .../drivers/net/wireless/mwifiex/sta_ioctl.c | 35 +- trunk/drivers/net/wireless/mwl8k.c | 4 +- trunk/drivers/net/wireless/p54/p54usb.c | 4 - trunk/drivers/net/wireless/rtlwifi/Kconfig | 4 +- trunk/drivers/net/wireless/rtlwifi/pci.c | 6 - .../wireless/rtlwifi/rtl8192c/phy_common.c | 2 +- .../net/wireless/rtlwifi/rtl8192ce/trx.c | 11 - .../net/wireless/rtlwifi/rtl8192de/trx.c | 10 - .../net/wireless/rtlwifi/rtl8192se/trx.c | 13 +- .../net/wireless/rtlwifi/rtl8723ae/phy.c | 2 +- .../net/wireless/rtlwifi/rtl8723ae/trx.c | 10 - trunk/drivers/net/wireless/rtlwifi/usb.c | 8 +- trunk/drivers/net/xen-netfront.c | 27 +- trunk/drivers/pci/hotplug/pciehp.h | 2 +- trunk/drivers/pci/hotplug/pciehp_core.c | 11 +- trunk/drivers/pci/hotplug/pciehp_ctrl.c | 8 +- trunk/drivers/pci/hotplug/pciehp_hpc.c | 11 +- trunk/drivers/pci/hotplug/shpchp.h | 3 +- trunk/drivers/pci/hotplug/shpchp_core.c | 36 +- trunk/drivers/pci/hotplug/shpchp_ctrl.c | 6 +- trunk/drivers/pci/iov.c | 2 +- trunk/drivers/pci/pcie/Kconfig | 2 +- trunk/drivers/pci/pcie/aer/aerdrv_core.c | 1 - trunk/drivers/pci/pcie/aspm.c | 3 - trunk/drivers/pinctrl/mvebu/pinctrl-dove.c | 7 +- trunk/drivers/platform/x86/acer-wmi.c | 60 +- trunk/drivers/platform/x86/asus-laptop.c | 19 +- trunk/drivers/platform/x86/samsung-laptop.c | 10 - trunk/drivers/platform/x86/sony-laptop.c | 15 +- trunk/drivers/pnp/interface.c | 105 +- trunk/drivers/pnp/manager.c | 25 +- trunk/drivers/power/reset/gpio-poweroff.c | 33 +- trunk/drivers/regulator/core.c | 15 +- trunk/drivers/regulator/max8997.c | 36 +- trunk/drivers/regulator/max8998.c | 44 +- trunk/drivers/regulator/s5m8767.c | 4 +- trunk/drivers/rtc/Kconfig | 8 - trunk/drivers/rtc/Makefile | 1 - trunk/drivers/rtc/rtc-da9055.c | 2 +- trunk/drivers/rtc/rtc-tegra.c | 7 - trunk/drivers/rtc/rtc-tps6586x.c | 356 ------ trunk/drivers/rtc/rtc-vt8500.c | 11 +- trunk/drivers/s390/block/dasd_diag.c | 2 +- trunk/drivers/s390/block/dasd_eckd.c | 2 +- trunk/drivers/s390/block/dasd_fba.c | 2 +- trunk/drivers/s390/char/con3215.c | 8 +- trunk/drivers/s390/char/raw3270.c | 2 +- trunk/drivers/s390/char/sclp.c | 4 +- trunk/drivers/s390/char/tape_34xx.c | 2 +- trunk/drivers/s390/char/tape_3590.c | 2 +- trunk/drivers/s390/char/vmur.c | 2 +- trunk/drivers/s390/cio/chsc.c | 31 +- trunk/drivers/s390/cio/chsc_sch.c | 2 +- trunk/drivers/s390/cio/cio.c | 10 +- trunk/drivers/s390/cio/device.c | 12 +- trunk/drivers/s390/cio/device.h | 5 +- trunk/drivers/s390/cio/eadm_sch.c | 2 +- trunk/drivers/s390/cio/qdio_thinint.c | 2 +- trunk/drivers/s390/crypto/ap_bus.c | 2 +- trunk/drivers/s390/kvm/kvm_virtio.c | 2 +- trunk/drivers/s390/net/claw.c | 2 +- trunk/drivers/s390/net/ctcm_main.c | 2 +- trunk/drivers/s390/net/lcs.c | 2 +- trunk/drivers/sh/clk/cpg.c | 6 - trunk/drivers/ssb/Kconfig | 3 +- trunk/drivers/staging/comedi/Kconfig | 1 - trunk/drivers/staging/comedi/comedi_fops.c | 3 - .../staging/comedi/drivers/comedi_test.c | 2 +- .../staging/comedi/drivers/ni_pcimio.c | 16 +- trunk/drivers/staging/fwserial/Kconfig | 4 +- trunk/drivers/staging/fwserial/TODO | 14 +- trunk/drivers/staging/fwserial/fwserial.c | 2 +- trunk/drivers/staging/fwserial/fwserial.h | 6 +- trunk/drivers/staging/iio/adc/mxs-lradc.c | 2 +- trunk/drivers/staging/iio/gyro/Kconfig | 4 +- .../drivers/staging/iio/gyro/adis16080_core.c | 2 +- trunk/drivers/staging/imx-drm/imx-drm-core.c | 1 + .../staging/imx-drm/ipu-v3/ipu-common.c | 5 +- trunk/drivers/staging/imx-drm/ipuv3-crtc.c | 6 +- trunk/drivers/staging/omapdrm/Makefile | 1 - trunk/drivers/staging/omapdrm/TODO | 3 + .../drivers/staging/omapdrm/omap_connector.c | 111 +- trunk/drivers/staging/omapdrm/omap_crtc.c | 507 +------- trunk/drivers/staging/omapdrm/omap_drv.c | 439 +++++-- trunk/drivers/staging/omapdrm/omap_drv.h | 140 +-- trunk/drivers/staging/omapdrm/omap_encoder.c | 132 +- .../drivers/staging/omapdrm/omap_gem_dmabuf.c | 7 +- trunk/drivers/staging/omapdrm/omap_irq.c | 322 ----- trunk/drivers/staging/omapdrm/omap_plane.c | 452 ++++--- trunk/drivers/staging/rtl8187se/r8180_core.c | 3 +- .../staging/rtl8192e/rtl8192e/r8192E_dev.c | 4 - .../staging/rtl8192e/rtl8192e/rtl_core.c | 11 +- trunk/drivers/staging/rtl8712/usb_intf.c | 2 - trunk/drivers/staging/sb105x/Kconfig | 1 - trunk/drivers/staging/sb105x/sb_pci_mp.c | 2 - trunk/drivers/staging/speakup/synth.c | 4 +- .../staging/tidspbridge/core/_tiomap.h | 2 +- .../staging/tidspbridge/core/dsp-clock.c | 13 +- trunk/drivers/staging/tidspbridge/core/wdt.c | 12 +- .../staging/vme/devices/vme_pio2_core.c | 14 +- trunk/drivers/staging/vt6656/bssdb.h | 1 + trunk/drivers/staging/vt6656/int.h | 1 + trunk/drivers/staging/vt6656/iocmd.h | 33 +- trunk/drivers/staging/vt6656/iowpa.h | 8 +- trunk/drivers/staging/wlan-ng/cfg80211.c | 7 +- trunk/drivers/staging/wlan-ng/prism2mgmt.c | 2 +- trunk/drivers/staging/zram/zram_drv.c | 39 +- .../drivers/target/iscsi/iscsi_target_erl2.c | 2 +- trunk/drivers/target/target_core_alua.c | 2 +- trunk/drivers/target/target_core_pr.c | 2 +- trunk/drivers/target/target_core_transport.c | 20 +- trunk/drivers/target/tcm_fc/tfc_sess.c | 12 +- trunk/drivers/tty/pty.c | 2 - trunk/drivers/tty/serial/8250/8250.c | 11 - trunk/drivers/tty/serial/8250/8250.h | 1 - trunk/drivers/tty/serial/8250/8250_dw.c | 2 +- trunk/drivers/tty/serial/8250/8250_pci.c | 42 +- trunk/drivers/tty/serial/ifx6x60.c | 4 +- trunk/drivers/tty/serial/mxs-auart.c | 6 +- trunk/drivers/tty/serial/samsung.c | 1 + trunk/drivers/tty/serial/vt8500_serial.c | 2 +- trunk/drivers/usb/Kconfig | 1 - trunk/drivers/usb/chipidea/host.c | 3 - trunk/drivers/usb/class/cdc-acm.c | 3 - trunk/drivers/usb/core/hub.c | 120 +- trunk/drivers/usb/core/quirks.c | 3 - trunk/drivers/usb/dwc3/debugfs.c | 2 +- trunk/drivers/usb/dwc3/gadget.c | 1 - trunk/drivers/usb/gadget/amd5536udc.c | 4 +- trunk/drivers/usb/gadget/dummy_hcd.c | 9 +- trunk/drivers/usb/gadget/f_fs.c | 6 +- trunk/drivers/usb/gadget/fsl_mxc_udc.c | 40 +- trunk/drivers/usb/gadget/fsl_udc_core.c | 42 +- trunk/drivers/usb/gadget/fsl_usb2_udc.h | 5 +- trunk/drivers/usb/gadget/mv_udc_core.c | 4 +- trunk/drivers/usb/gadget/s3c-hsotg.c | 5 +- trunk/drivers/usb/gadget/tcm_usb_gadget.c | 3 +- trunk/drivers/usb/gadget/u_serial.c | 2 +- trunk/drivers/usb/host/Kconfig | 2 +- trunk/drivers/usb/host/Makefile | 1 - trunk/drivers/usb/host/ehci-fsl.c | 9 +- trunk/drivers/usb/host/ehci-hcd.c | 12 +- trunk/drivers/usb/host/ehci-mv.c | 4 +- trunk/drivers/usb/host/ehci-mxc.c | 120 +- trunk/drivers/usb/host/ehci-pci.c | 39 +- trunk/drivers/usb/host/ehci.h | 7 - trunk/drivers/usb/host/fsl-mph-dr-of.c | 3 - trunk/drivers/usb/host/imx21-hcd.c | 1 - trunk/drivers/usb/host/ohci-tmio.c | 3 +- trunk/drivers/usb/host/uhci-hcd.c | 15 +- trunk/drivers/usb/host/xhci-hub.c | 38 +- trunk/drivers/usb/host/xhci-mem.c | 2 - trunk/drivers/usb/host/xhci-ring.c | 9 - trunk/drivers/usb/host/xhci.c | 10 - trunk/drivers/usb/misc/usbtest.c | 2 +- trunk/drivers/usb/musb/cppi_dma.c | 4 +- trunk/drivers/usb/musb/musb_core.c | 5 +- trunk/drivers/usb/musb/musb_dsps.c | 5 - trunk/drivers/usb/otg/Kconfig | 2 +- trunk/drivers/usb/otg/mv_otg.c | 4 +- trunk/drivers/usb/renesas_usbhs/mod_gadget.c | 22 +- trunk/drivers/usb/renesas_usbhs/mod_host.c | 3 +- trunk/drivers/usb/serial/ftdi_sio.c | 2 - trunk/drivers/usb/serial/ftdi_sio_ids.h | 6 - trunk/drivers/usb/serial/io_ti.c | 3 - trunk/drivers/usb/serial/option.c | 27 +- trunk/drivers/vfio/pci/vfio_pci_rdwr.c | 4 +- trunk/drivers/video/imxfb.c | 13 +- trunk/drivers/video/mxsfb.c | 3 +- trunk/drivers/video/ssd1307fb.c | 4 +- trunk/drivers/xen/cpu_hotplug.c | 4 +- trunk/drivers/xen/gntdev.c | 130 +- trunk/drivers/xen/grant-table.c | 48 +- trunk/drivers/xen/privcmd.c | 89 +- trunk/drivers/xen/xen-pciback/pciback.h | 2 +- trunk/fs/Kconfig | 10 + trunk/fs/btrfs/extent-tree.c | 6 +- trunk/fs/btrfs/extent_map.c | 13 +- trunk/fs/btrfs/extent_map.h | 1 - trunk/fs/btrfs/file-item.c | 4 +- trunk/fs/btrfs/file.c | 10 +- trunk/fs/btrfs/free-space-cache.c | 20 +- trunk/fs/btrfs/inode.c | 137 +- trunk/fs/btrfs/ioctl.c | 129 +- trunk/fs/btrfs/qgroup.c | 20 +- trunk/fs/btrfs/send.c | 4 +- trunk/fs/btrfs/super.c | 2 +- trunk/fs/btrfs/transaction.c | 19 +- trunk/fs/btrfs/tree-log.c | 10 +- trunk/fs/btrfs/volumes.c | 23 +- trunk/fs/buffer.c | 1 - trunk/fs/cifs/cifs_dfs_ref.c | 2 - trunk/fs/cifs/cifsfs.c | 1 + trunk/fs/cifs/cifsglob.h | 2 +- trunk/fs/cifs/connect.c | 2 +- trunk/fs/cifs/file.c | 141 +-- trunk/fs/cifs/smb1ops.c | 8 - trunk/fs/cifs/smb2ops.c | 2 - trunk/fs/cifs/transport.c | 6 +- trunk/fs/debugfs/inode.c | 2 +- trunk/fs/exec.c | 3 +- trunk/fs/ext4/Kconfig | 2 - trunk/fs/ext4/namei.c | 3 +- trunk/fs/f2fs/acl.c | 13 +- trunk/fs/f2fs/checkpoint.c | 3 +- trunk/fs/f2fs/data.c | 17 +- trunk/fs/f2fs/debug.c | 50 +- trunk/fs/f2fs/dir.c | 2 +- trunk/fs/f2fs/f2fs.h | 18 +- trunk/fs/f2fs/file.c | 16 +- trunk/fs/f2fs/gc.c | 68 +- trunk/fs/f2fs/inode.c | 3 - trunk/fs/f2fs/node.c | 19 +- trunk/fs/f2fs/recovery.c | 10 +- trunk/fs/f2fs/segment.c | 2 +- trunk/fs/f2fs/super.c | 97 +- trunk/fs/f2fs/xattr.c | 2 - trunk/fs/fuse/Kconfig | 16 +- trunk/fs/fuse/cuse.c | 36 +- trunk/fs/fuse/dev.c | 5 + trunk/fs/fuse/file.c | 5 +- trunk/fs/gfs2/lock_dlm.c | 7 +- trunk/fs/jbd/journal.c | 3 +- trunk/fs/nfs/callback_proc.c | 2 +- trunk/fs/nfs/dir.c | 16 +- trunk/fs/nfs/nfs4proc.c | 18 +- trunk/fs/nfs/pnfs.c | 2 +- trunk/fs/nfs/read.c | 10 +- trunk/fs/nfs/super.c | 2 +- trunk/fs/nfs/write.c | 10 +- trunk/fs/seq_file.c | 2 +- trunk/fs/splice.c | 4 +- trunk/fs/udf/super.c | 3 +- trunk/fs/xfs/xfs_buf.c | 12 +- trunk/fs/xfs/xfs_buf.h | 6 +- trunk/fs/xfs/xfs_buf_item.c | 49 +- trunk/fs/xfs/xfs_buf_item.h | 2 +- trunk/fs/xfs/xfs_dir2_block.c | 6 +- trunk/fs/xfs/xfs_qm_syscalls.c | 4 +- trunk/fs/xfs/xfs_trans_buf.c | 27 +- .../include/asm-generic/dma-mapping-broken.h | 16 - trunk/include/asm-generic/pgtable.h | 6 +- trunk/include/asm-generic/syscalls.h | 2 - trunk/include/asm-generic/tlb.h | 9 - trunk/include/drm/drm_mm.h | 2 +- trunk/include/drm/exynos_drm.h | 22 +- trunk/include/linux/ata.h | 8 +- trunk/include/linux/audit.h | 4 +- trunk/include/linux/compaction.h | 4 +- trunk/include/linux/cpu_rmap.h | 13 +- trunk/include/linux/cpuidle.h | 2 +- trunk/include/linux/cred.h | 1 + trunk/include/linux/init.h | 20 + trunk/include/linux/interrupt.h | 5 + trunk/include/linux/ipc_namespace.h | 1 - trunk/include/linux/libata.h | 4 +- trunk/include/linux/lockdep.h | 3 - trunk/include/linux/mfd/abx500.h | 2 + trunk/include/linux/mfd/abx500/ab8500-bm.h | 29 +- trunk/include/linux/mfd/da9052/da9052.h | 66 +- trunk/include/linux/mfd/da9052/reg.h | 3 - trunk/include/linux/mfd/rtsx_common.h | 3 - trunk/include/linux/mfd/rtsx_pci.h | 25 +- trunk/include/linux/mm.h | 1 + trunk/include/linux/mmzone.h | 8 + trunk/include/linux/module.h | 10 +- trunk/include/linux/msg.h | 6 +- trunk/include/linux/namei.h | 1 - trunk/include/linux/netdevice.h | 3 - trunk/include/linux/ptrace.h | 1 + trunk/include/linux/rbtree_augmented.h | 14 +- trunk/include/linux/rwsem.h | 9 - trunk/include/linux/sched.h | 12 +- trunk/include/linux/security.h | 59 +- trunk/include/linux/usb/usbnet.h | 1 - trunk/include/net/ip.h | 2 - .../include/net/netfilter/nf_conntrack_core.h | 2 - trunk/include/net/netns/conntrack.h | 1 - trunk/include/net/netns/x_tables.h | 1 - trunk/include/sound/cs4271.h | 2 +- trunk/include/sound/soc.h | 10 +- trunk/include/target/target_core_base.h | 1 - trunk/include/uapi/drm/exynos_drm.h | 24 +- trunk/include/uapi/linux/audit.h | 2 +- trunk/include/uapi/linux/msg.h | 1 - trunk/include/uapi/linux/serial_core.h | 3 +- trunk/init/Kconfig | 2 +- trunk/init/do_mounts_initrd.c | 4 - trunk/init/main.c | 4 +- trunk/ipc/compat.c | 46 +- trunk/ipc/ipc_sysctl.c | 32 - trunk/ipc/msg.c | 123 +- trunk/ipc/msgutil.c | 43 - trunk/ipc/util.c | 16 +- trunk/ipc/util.h | 2 - trunk/kernel/async.c | 30 +- trunk/kernel/audit.c | 40 +- trunk/kernel/audit_tree.c | 26 +- trunk/kernel/audit_watch.c | 2 - trunk/kernel/auditfilter.c | 1 + trunk/kernel/auditsc.c | 20 +- trunk/kernel/compat.c | 23 +- trunk/kernel/debug/kdb/kdb_main.c | 2 - trunk/kernel/fork.c | 6 +- trunk/kernel/module.c | 181 +-- trunk/kernel/printk.c | 5 +- trunk/kernel/ptrace.c | 74 +- trunk/kernel/rwsem.c | 10 - trunk/kernel/sched/core.c | 3 +- trunk/kernel/signal.c | 33 +- trunk/kernel/trace/ftrace.c | 2 +- trunk/kernel/trace/trace.c | 17 +- trunk/lib/bug.c | 1 - trunk/lib/cpu_rmap.c | 54 +- trunk/lib/rbtree.c | 20 +- trunk/mm/bootmem.c | 24 +- trunk/mm/compaction.c | 98 +- trunk/mm/huge_memory.c | 15 +- trunk/mm/internal.h | 1 + trunk/mm/memblock.c | 3 +- trunk/mm/memory.c | 13 - trunk/mm/migrate.c | 14 +- trunk/mm/mmap.c | 2 +- trunk/mm/page_alloc.c | 64 +- trunk/mm/page_isolation.c | 26 +- trunk/net/batman-adv/distributed-arp-table.c | 19 +- trunk/net/bluetooth/hci_core.c | 8 + trunk/net/bluetooth/hci_event.c | 2 +- trunk/net/bluetooth/hidp/core.c | 2 +- trunk/net/bluetooth/l2cap_core.c | 11 - trunk/net/bluetooth/sco.c | 2 +- trunk/net/bridge/br_multicast.c | 2 + trunk/net/bridge/br_netlink.c | 13 +- trunk/net/bridge/br_private.h | 6 - trunk/net/core/dev.c | 8 - trunk/net/core/request_sock.c | 2 + trunk/net/core/scm.c | 5 +- trunk/net/core/skbuff.c | 44 +- trunk/net/ipv4/ah4.c | 18 +- trunk/net/ipv4/datagram.c | 25 - trunk/net/ipv4/devinet.c | 2 +- trunk/net/ipv4/esp4.c | 12 +- trunk/net/ipv4/ip_gre.c | 6 +- trunk/net/ipv4/ip_sockglue.c | 2 +- trunk/net/ipv4/ipcomp.c | 7 +- trunk/net/ipv4/ipconfig.c | 8 +- trunk/net/ipv4/netfilter/ipt_REJECT.c | 1 - trunk/net/ipv4/netfilter/iptable_nat.c | 15 +- trunk/net/ipv4/ping.c | 1 - trunk/net/ipv4/raw.c | 1 - trunk/net/ipv4/route.c | 54 +- trunk/net/ipv4/tcp.c | 15 +- trunk/net/ipv4/tcp_input.c | 4 +- trunk/net/ipv4/tcp_ipv4.c | 9 +- trunk/net/ipv4/udp.c | 1 - trunk/net/ipv6/addrconf.c | 27 +- trunk/net/ipv6/ah6.c | 11 +- trunk/net/ipv6/esp6.c | 5 +- trunk/net/ipv6/icmp.c | 12 - trunk/net/ipv6/ip6_output.c | 4 +- trunk/net/ipv6/ip6mr.c | 3 - trunk/net/ipv6/netfilter/ip6t_NPT.c | 33 +- trunk/net/ipv6/netfilter/ip6t_REJECT.c | 1 - trunk/net/ipv6/netfilter/ip6table_nat.c | 15 +- .../netfilter/nf_conntrack_l3proto_ipv6.c | 4 +- trunk/net/ipv6/netfilter/nf_conntrack_reasm.c | 5 +- trunk/net/iucv/iucv.c | 2 +- trunk/net/mac80211/cfg.c | 14 +- trunk/net/mac80211/chan.c | 38 - trunk/net/mac80211/ibss.c | 9 +- trunk/net/mac80211/ieee80211_i.h | 22 +- trunk/net/mac80211/iface.c | 48 +- trunk/net/mac80211/mesh.c | 8 +- trunk/net/mac80211/mesh.h | 2 +- trunk/net/mac80211/mesh_hwmp.c | 5 +- trunk/net/mac80211/mlme.c | 75 +- trunk/net/mac80211/offchannel.c | 19 +- trunk/net/mac80211/scan.c | 61 +- trunk/net/mac80211/sta_info.c | 46 +- trunk/net/mac80211/sta_info.h | 3 +- trunk/net/mac80211/tx.c | 9 +- trunk/net/mac802154/wpan.c | 2 +- trunk/net/netfilter/Kconfig | 7 - trunk/net/netfilter/nf_conntrack_core.c | 11 +- trunk/net/netfilter/nf_conntrack_netlink.c | 2 +- trunk/net/netfilter/nf_conntrack_standalone.c | 1 - trunk/net/netfilter/nfnetlink_log.c | 16 +- trunk/net/netfilter/x_tables.c | 28 +- trunk/net/netfilter/xt_CT.c | 62 +- trunk/net/netfilter/xt_hashlimit.c | 54 +- trunk/net/netfilter/xt_recent.c | 43 +- trunk/net/sctp/Kconfig | 2 +- trunk/net/sctp/outqueue.c | 12 +- trunk/net/sctp/sm_statefuns.c | 4 +- trunk/net/sctp/sysctl.c | 4 - trunk/net/sunrpc/clnt.c | 7 +- trunk/net/sunrpc/sched.c | 30 +- trunk/net/sunrpc/xprt.c | 12 +- trunk/net/wireless/core.c | 3 +- trunk/net/xfrm/xfrm_policy.c | 2 +- trunk/net/xfrm/xfrm_replay.c | 4 +- trunk/security/capability.c | 24 +- trunk/security/device_cgroup.c | 2 - trunk/security/integrity/evm/evm_crypto.c | 4 +- trunk/security/integrity/ima/ima.h | 1 - trunk/security/integrity/ima/ima_main.c | 12 +- trunk/security/integrity/ima/ima_policy.c | 3 +- trunk/security/security.c | 28 +- trunk/security/selinux/hooks.c | 50 +- trunk/security/selinux/include/classmap.h | 2 +- trunk/security/selinux/include/objsec.h | 4 - trunk/sound/arm/pxa2xx-ac97-lib.c | 26 +- trunk/sound/oss/pas2_card.c | 5 - trunk/sound/pci/au88x0/au88x0_synth.c | 2 +- trunk/sound/pci/hda/hda_codec.c | 7 +- trunk/sound/pci/hda/hda_intel.c | 13 +- trunk/sound/pci/hda/patch_conexant.c | 25 +- trunk/sound/pci/hda/patch_hdmi.c | 2 +- trunk/sound/pci/hda/patch_realtek.c | 56 +- trunk/sound/pci/rme9652/hdspm.c | 17 +- trunk/sound/soc/codecs/arizona.c | 9 +- trunk/sound/soc/codecs/arizona.h | 18 +- trunk/sound/soc/codecs/cs4271.c | 6 +- trunk/sound/soc/codecs/cs42l52.c | 4 +- trunk/sound/soc/codecs/lm49453.c | 106 +- trunk/sound/soc/codecs/sgtl5000.c | 4 +- trunk/sound/soc/codecs/sta529.c | 9 +- trunk/sound/soc/codecs/wm2000.c | 4 +- trunk/sound/soc/codecs/wm2200.c | 8 +- trunk/sound/soc/codecs/wm5100.c | 6 + trunk/sound/soc/codecs/wm5102.c | 48 +- trunk/sound/soc/codecs/wm_adsp.c | 23 +- trunk/sound/soc/soc-core.c | 35 +- trunk/sound/soc/soc-pcm.c | 1 - trunk/sound/usb/midi.c | 4 + trunk/sound/usb/mixer_maps.c | 13 - trunk/sound/usb/mixer_quirks.c | 2 +- trunk/sound/usb/pcm.c | 10 - trunk/sound/usb/quirks-table.h | 28 +- trunk/sound/usb/quirks.c | 35 +- trunk/sound/usb/usbaudio.h | 1 + trunk/tools/perf/MANIFEST | 10 - trunk/tools/perf/Makefile | 2 +- trunk/tools/testing/selftests/ipc/Makefile | 25 - trunk/tools/testing/selftests/ipc/msgque.c | 246 ---- 943 files changed, 6581 insertions(+), 16090 deletions(-) rename trunk/{include/linux/platform_data/imx-iram.h => arch/arm/mach-imx/iram.h} (100%) create mode 100644 trunk/drivers/acpi/acpica/utclib.c delete mode 100644 trunk/drivers/net/wireless/ath/wil6210/Kconfig delete mode 100644 trunk/drivers/net/wireless/ath/wil6210/Makefile delete mode 100644 trunk/drivers/net/wireless/ath/wil6210/cfg80211.c delete mode 100644 trunk/drivers/net/wireless/ath/wil6210/dbg_hexdump.h delete mode 100644 trunk/drivers/net/wireless/ath/wil6210/debugfs.c delete mode 100644 trunk/drivers/net/wireless/ath/wil6210/interrupt.c delete mode 100644 trunk/drivers/net/wireless/ath/wil6210/main.c delete mode 100644 trunk/drivers/net/wireless/ath/wil6210/netdev.c delete mode 100644 trunk/drivers/net/wireless/ath/wil6210/pcie_bus.c delete mode 100644 trunk/drivers/net/wireless/ath/wil6210/txrx.c delete mode 100644 trunk/drivers/net/wireless/ath/wil6210/txrx.h delete mode 100644 trunk/drivers/net/wireless/ath/wil6210/wil6210.h delete mode 100644 trunk/drivers/net/wireless/ath/wil6210/wmi.c delete mode 100644 trunk/drivers/net/wireless/ath/wil6210/wmi.h delete mode 100644 trunk/drivers/rtc/rtc-tps6586x.c delete mode 100644 trunk/drivers/staging/omapdrm/omap_irq.c delete mode 100644 trunk/tools/testing/selftests/ipc/Makefile delete mode 100644 trunk/tools/testing/selftests/ipc/msgque.c diff --git a/[refs] b/[refs] index 3c1021193d4f..8f847530f4e3 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 45e72af09faa7dad5d8539ebac0fe317ae88318b +refs/heads/master: 55ebbb59c1c6eb1b040f62b8c4ae0b724de6e55a diff --git a/trunk/Documentation/device-mapper/dm-raid.txt b/trunk/Documentation/device-mapper/dm-raid.txt index 728c38c242d6..56fb62b09fc5 100644 --- a/trunk/Documentation/device-mapper/dm-raid.txt +++ b/trunk/Documentation/device-mapper/dm-raid.txt @@ -141,3 +141,4 @@ Version History 1.2.0 Handle creation of arrays that contain failed devices. 1.3.0 Added support for RAID 10 1.3.1 Allow device replacement/rebuild for RAID 10 +1.3.2 Fix/improve redundancy checking for RAID10 diff --git a/trunk/Documentation/devicetree/bindings/clock/imx23-clock.txt b/trunk/Documentation/devicetree/bindings/clock/imx23-clock.txt index 5083c0b834b2..baadbb11fe98 100644 --- a/trunk/Documentation/devicetree/bindings/clock/imx23-clock.txt +++ b/trunk/Documentation/devicetree/bindings/clock/imx23-clock.txt @@ -60,6 +60,11 @@ clks: clkctrl@80040000 { compatible = "fsl,imx23-clkctrl"; reg = <0x80040000 0x2000>; #clock-cells = <1>; + clock-output-names = + ... + "uart", /* 32 */ + ... + "end_of_list"; }; auart0: serial@8006c000 { diff --git a/trunk/Documentation/devicetree/bindings/clock/imx25-clock.txt b/trunk/Documentation/devicetree/bindings/clock/imx25-clock.txt index db4f2f05c4d0..c2a3525ecb4e 100644 --- a/trunk/Documentation/devicetree/bindings/clock/imx25-clock.txt +++ b/trunk/Documentation/devicetree/bindings/clock/imx25-clock.txt @@ -146,6 +146,10 @@ clks: ccm@53f80000 { compatible = "fsl,imx25-ccm"; reg = <0x53f80000 0x4000>; interrupts = <31>; + clock-output-names = ... + "uart_ipg", + "uart_serial", + ...; }; uart1: serial@43f90000 { diff --git a/trunk/Documentation/devicetree/bindings/clock/imx28-clock.txt b/trunk/Documentation/devicetree/bindings/clock/imx28-clock.txt index e6587af62ff0..52a49a4a50b3 100644 --- a/trunk/Documentation/devicetree/bindings/clock/imx28-clock.txt +++ b/trunk/Documentation/devicetree/bindings/clock/imx28-clock.txt @@ -83,6 +83,11 @@ clks: clkctrl@80040000 { compatible = "fsl,imx28-clkctrl"; reg = <0x80040000 0x2000>; #clock-cells = <1>; + clock-output-names = + ... + "uart", /* 45 */ + ... + "end_of_list"; }; auart0: serial@8006a000 { diff --git a/trunk/Documentation/devicetree/bindings/clock/imx6q-clock.txt b/trunk/Documentation/devicetree/bindings/clock/imx6q-clock.txt index f73fdf595568..d77b4e68dc42 100644 --- a/trunk/Documentation/devicetree/bindings/clock/imx6q-clock.txt +++ b/trunk/Documentation/devicetree/bindings/clock/imx6q-clock.txt @@ -211,6 +211,10 @@ clks: ccm@020c4000 { reg = <0x020c4000 0x4000>; interrupts = <0 87 0x04 0 88 0x04>; #clock-cells = <1>; + clock-output-names = ... + "uart_ipg", + "uart_serial", + ...; }; uart1: serial@02020000 { diff --git a/trunk/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt b/trunk/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt index d4eab9227ea4..558cdf3c9abc 100644 --- a/trunk/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt +++ b/trunk/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt @@ -1,19 +1,4 @@ -Driver a GPIO line that can be used to turn the power off. - -The driver supports both level triggered and edge triggered power off. -At driver load time, the driver will request the given gpio line and -install a pm_power_off handler. If the optional properties 'input' is -not found, the GPIO line will be driven in the inactive -state. Otherwise its configured as an input. - -When the pm_power_off is called, the gpio is configured as an output, -and drive active, so triggering a level triggered power off -condition. This will also cause an inactive->active edge condition, so -triggering positive edge triggered power off. After a delay of 100ms, -the GPIO is set to inactive, thus causing an active->inactive edge, -triggering negative edge triggered power off. After another 100ms -delay the GPIO is driver active again. If the power is still on and -the CPU still running after a 3000ms delay, a WARN_ON(1) is emitted. +GPIO line that should be set high/low to power off a device Required properties: - compatible : should be "gpio-poweroff". @@ -28,9 +13,10 @@ Optional properties: property is not specified, the GPIO is initialized as an output in its inactive state. + Examples: gpio-poweroff { compatible = "gpio-poweroff"; - gpios = <&gpio 4 0>; + gpios = <&gpio 4 0>; /* GPIO 4 Active Low */ }; diff --git a/trunk/Documentation/devicetree/bindings/pinctrl/atmel,at91-pinctrl.txt b/trunk/Documentation/devicetree/bindings/pinctrl/atmel,at91-pinctrl.txt index bc50899e0c81..3a268127b054 100644 --- a/trunk/Documentation/devicetree/bindings/pinctrl/atmel,at91-pinctrl.txt +++ b/trunk/Documentation/devicetree/bindings/pinctrl/atmel,at91-pinctrl.txt @@ -81,8 +81,7 @@ PA31 TXD4 Required properties for pin configuration node: - atmel,pins: 4 integers array, represents a group of pins mux and config setting. The format is atmel,pins = . - The PERIPH 0 means gpio, PERIPH 1 is periph A, PERIPH 2 is periph B... - PIN_BANK 0 is pioA, PIN_BANK 1 is pioB... + The PERIPH 0 means gpio. Bits used for CONFIG: PULL_UP (1 << 0): indicate this pin need a pull up. @@ -127,7 +126,7 @@ pinctrl@fffff400 { pinctrl_dbgu: dbgu-0 { atmel,pins = <1 14 0x1 0x0 /* PB14 periph A */ - 1 15 0x1 0x1>; /* PB15 periph A with pullup */ + 1 15 0x1 0x1>; /* PB15 periph with pullup */ }; }; }; diff --git a/trunk/Documentation/filesystems/f2fs.txt b/trunk/Documentation/filesystems/f2fs.txt index dcf338e62b71..8fbd8b46ee34 100644 --- a/trunk/Documentation/filesystems/f2fs.txt +++ b/trunk/Documentation/filesystems/f2fs.txt @@ -175,9 +175,9 @@ consists of multiple segments as described below. align with the zone size <-| |-> align with the segment size _________________________________________________________________________ - | | | Segment | Node | Segment | | - | Superblock | Checkpoint | Info. | Address | Summary | Main | - | (SB) | (CP) | Table (SIT) | Table (NAT) | Area (SSA) | | + | | | Node | Segment | Segment | | + | Superblock | Checkpoint | Address | Info. | Summary | Main | + | (SB) | (CP) | Table (NAT) | Table (SIT) | Area (SSA) | | |____________|_____2______|______N______|______N______|______N_____|__N___| . . . . @@ -200,14 +200,14 @@ consists of multiple segments as described below. : It contains file system information, bitmaps for valid NAT/SIT sets, orphan inode lists, and summary entries of current active segments. -- Segment Information Table (SIT) - : It contains segment information such as valid block count and bitmap for the - validity of all the blocks. - - Node Address Table (NAT) : It is composed of a block address table for all the node blocks stored in Main area. +- Segment Information Table (SIT) + : It contains segment information such as valid block count and bitmap for the + validity of all the blocks. + - Segment Summary Area (SSA) : It contains summary entries which contains the owner information of all the 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 valid, as shown as below. +--------+----------+---------+ - | CP | SIT | NAT | + | CP | NAT | SIT | +--------+----------+---------+ . . . . . . . . . . . . +-------+-------+--------+--------+--------+--------+ - | CP #0 | CP #1 | SIT #0 | SIT #1 | NAT #0 | NAT #1 | + | CP #0 | CP #1 | NAT #0 | NAT #1 | SIT #0 | SIT #1 | +-------+-------+--------+--------+--------+--------+ | ^ ^ | | | diff --git a/trunk/Documentation/networking/ip-sysctl.txt b/trunk/Documentation/networking/ip-sysctl.txt index dbca66182089..dd52d516cb89 100644 --- a/trunk/Documentation/networking/ip-sysctl.txt +++ b/trunk/Documentation/networking/ip-sysctl.txt @@ -36,7 +36,7 @@ neigh/default/unres_qlen_bytes - INTEGER The maximum number of bytes which may be used by packets queued for each unresolved address by other network layers. (added in linux 3.3) - Setting negative value is meaningless and will return error. + Seting negative value is meaningless and will retrun error. Default: 65536 Bytes(64KB) neigh/default/unres_qlen - INTEGER @@ -215,7 +215,7 @@ tcp_ecn - INTEGER Possible values are: 0 Disable ECN. Neither initiate nor accept ECN. 1 Always request ECN on outgoing connection attempts. - 2 Enable ECN when requested by incoming connections + 2 Enable ECN when requested by incomming connections but do not request ECN on outgoing connections. Default: 2 @@ -503,7 +503,7 @@ tcp_fastopen - INTEGER tcp_syn_retries - INTEGER Number of times initial SYNs for an active TCP connection attempt will be retransmitted. Should not be higher than 255. Default value - is 6, which corresponds to 63seconds till the last retransmission + is 6, which corresponds to 63seconds till the last restransmission with the current initial RTO of 1second. With this the final timeout for an active TCP connection attempt will happen after 127seconds. @@ -1331,12 +1331,6 @@ force_tllao - BOOLEAN race condition where the sender deletes the cached link-layer address prior to receiving a response to a previous solicitation." -ndisc_notify - BOOLEAN - Define mode for notification of address and device changes. - 0 - (default): do nothing - 1 - Generate unsolicited neighbour advertisements when device is brought - up or hardware address changes. - icmp/*: ratelimit - INTEGER Limit the maximal rates for sending ICMPv6 packets. @@ -1536,7 +1530,7 @@ cookie_hmac_alg - STRING * sha1 * none Ability to assign md5 or sha1 as the selected alg is predicated on the - configuration of those algorithms at build time (CONFIG_CRYPTO_MD5 and + configuarion of those algorithms at build time (CONFIG_CRYPTO_MD5 and CONFIG_CRYPTO_SHA1). Default: Dependent on configuration. MD5 if available, else SHA1 if @@ -1554,7 +1548,7 @@ rcvbuf_policy - INTEGER blocking. 1: rcvbuf space is per association - 0: rcvbuf space is per socket + 0: recbuf space is per socket Default: 0 diff --git a/trunk/Documentation/power/runtime_pm.txt b/trunk/Documentation/power/runtime_pm.txt index 03591a750f99..4abe83e1045a 100644 --- a/trunk/Documentation/power/runtime_pm.txt +++ b/trunk/Documentation/power/runtime_pm.txt @@ -642,13 +642,12 @@ out the following operations: * During system suspend it calls pm_runtime_get_noresume() and pm_runtime_barrier() for every device right before executing the subsystem-level .suspend() callback for it. In addition to that it calls - __pm_runtime_disable() with 'false' as the second argument for every device - right before executing the subsystem-level .suspend_late() callback for it. + pm_runtime_disable() for every device right after executing the + subsystem-level .suspend() callback for it. * During system resume it calls pm_runtime_enable() and pm_runtime_put_sync() - for every device right after executing the subsystem-level .resume_early() - callback and right after executing the subsystem-level .resume() callback - for it, respectively. + for every device right before and right after executing the subsystem-level + .resume() callback for it, respectively. 7. Generic subsystem callbacks diff --git a/trunk/Documentation/sysctl/kernel.txt b/trunk/Documentation/sysctl/kernel.txt index ccd42589e124..2907ba6c3607 100644 --- a/trunk/Documentation/sysctl/kernel.txt +++ b/trunk/Documentation/sysctl/kernel.txt @@ -38,7 +38,6 @@ show up in /proc/sys/kernel: - l2cr [ PPC only ] - modprobe ==> Documentation/debugging-modules.txt - modules_disabled -- msg_next_id [ sysv ipc ] - msgmax - msgmnb - msgmni @@ -63,9 +62,7 @@ show up in /proc/sys/kernel: - rtsig-max - rtsig-nr - sem -- sem_next_id [ sysv ipc ] - sg-big-buff [ generic SCSI device (sg) ] -- shm_next_id [ sysv ipc ] - shm_rmid_forced - shmall - shmmax [ sysv ipc ] @@ -323,22 +320,6 @@ to false. ============================================================== -msg_next_id, sem_next_id, and shm_next_id: - -These three toggles allows to specify desired id for next allocated IPC -object: message, semaphore or shared memory respectively. - -By default they are equal to -1, which means generic allocation logic. -Possible values to set are in range {0..INT_MAX}. - -Notes: -1) kernel doesn't guarantee, that new object will have desired id. So, -it's up to userspace, how to handle an object with "wrong" id. -2) Toggle with non-default value will be set back to -1 by kernel after -successful IPC object allocation. - -============================================================== - nmi_watchdog: Enables/Disables the NMI watchdog on x86 systems. When the value is @@ -561,19 +542,6 @@ are doing anyway :) ============================================================== -shmall: - -This parameter sets the total amount of shared memory pages that -can be used system wide. Hence, SHMALL should always be at least -ceil(shmmax/PAGE_SIZE). - -If you are not sure what the default PAGE_SIZE is on your Linux -system, you can run the following command: - -# getconf PAGE_SIZE - -============================================================== - shmmax: This value can be used to query and set the run time limit diff --git a/trunk/MAINTAINERS b/trunk/MAINTAINERS index 76ae4aa15129..7a58a25a6e7c 100644 --- a/trunk/MAINTAINERS +++ b/trunk/MAINTAINERS @@ -228,7 +228,7 @@ S: Maintained F: drivers/platform/x86/acerhdf.c ACER WMI LAPTOP EXTRAS -M: "Lee, Chun-Yi" +M: Joey Lee L: platform-driver-x86@vger.kernel.org S: Maintained F: drivers/platform/x86/acer-wmi.c @@ -449,7 +449,6 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6.git S: Maintained F: drivers/char/agp/ F: include/linux/agp* -F: include/uapi/linux/agp* AHA152X SCSI DRIVER M: "Juergen E. Fischer" @@ -590,7 +589,6 @@ M: Jiri Kosina S: Odd fixes F: arch/x86/kernel/apm_32.c F: include/linux/apm_bios.h -F: include/uapi/linux/apm_bios.h F: drivers/char/apm-emulation.c APPLE BCM5974 MULTITOUCH DRIVER @@ -648,7 +646,7 @@ F: arch/arm/ ARM SUB-ARCHITECTURES L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained +S: MAINTAINED F: arch/arm/mach-*/ F: arch/arm/plat-*/ T: git git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git @@ -1007,6 +1005,7 @@ F: drivers/mmc/host/msm_sdcc.c F: drivers/mmc/host/msm_sdcc.h F: drivers/tty/serial/msm_serial.h F: drivers/tty/serial/msm_serial.c +F: drivers/platform/msm/ F: drivers/*/pm8???-* F: include/linux/mfd/pm8xxx/ T: git git://git.kernel.org/pub/scm/linux/kernel/git/davidb/linux-msm.git @@ -1070,6 +1069,7 @@ M: Russell King L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) W: http://www.arm.linux.org.uk/ S: Maintained +F: arch/arm/common/time-acorn.c F: arch/arm/include/asm/hardware/entry-macro-iomd.S F: arch/arm/include/asm/hardware/ioc.h F: arch/arm/include/asm/hardware/iomd.h @@ -1094,6 +1094,7 @@ W: http://www.fluff.org/ben/linux/ S: Maintained F: arch/arm/plat-samsung/ F: arch/arm/plat-s3c24xx/ +F: arch/arm/plat-s5p/ F: arch/arm/mach-s3c24*/ F: arch/arm/mach-s3c64xx/ F: drivers/*/*s3c2410* @@ -1124,6 +1125,7 @@ M: Sylwester Nawrocki L: linux-arm-kernel@lists.infradead.org L: linux-media@vger.kernel.org S: Maintained +F: arch/arm/plat-s5p/dev-fimc* F: arch/arm/plat-samsung/include/plat/*fimc* F: drivers/media/platform/s5p-fimc/ @@ -1134,7 +1136,7 @@ M: Jeongtae Park L: linux-arm-kernel@lists.infradead.org L: linux-media@vger.kernel.org S: Maintained -F: arch/arm/plat-samsung/s5p-dev-mfc.c +F: arch/arm/plat-s5p/dev-mfc.c F: drivers/media/platform/s5p-mfc/ ARM/SAMSUNG S5P SERIES TV SUBSYSTEM SUPPORT @@ -1252,7 +1254,7 @@ F: drivers/video/vt8500lcdfb.* F: drivers/video/wm8505fb* F: drivers/video/wmt_ge_rops.* F: drivers/tty/serial/vt8500_serial.c -F: drivers/rtc/rtc-vt8500.c +F: drivers/rtc/rtc-vt8500-c F: drivers/mmc/host/wmt-sdmmc.c ARM/ZIPIT Z2 SUPPORT @@ -1351,14 +1353,6 @@ W: http://wireless.kernel.org/en/users/Drivers/ath9k S: Supported F: drivers/net/wireless/ath/ath9k/ -WILOCITY WIL6210 WIRELESS DRIVER -M: Vladimir Kondratiev -L: linux-wireless@vger.kernel.org -L: wil6210@qca.qualcomm.com -S: Supported -W: http://wireless.kernel.org/en/users/Drivers/wil6210 -F: drivers/net/wireless/ath/wil6210/ - CARL9170 LINUX COMMUNITY WIRELESS DRIVER M: Christian Lamparter L: linux-wireless@vger.kernel.org @@ -1394,7 +1388,6 @@ W: http://linux-atm.sourceforge.net S: Maintained F: drivers/atm/ F: include/linux/atm* -F: include/uapi/linux/atm* ATMEL AT91 / AT32 MCI DRIVER M: Ludovic Desroches @@ -1413,13 +1406,13 @@ L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) S: Supported F: drivers/dma/at_hdmac.c F: drivers/dma/at_hdmac_regs.h -F: include/linux/platform_data/dma-atmel.h +F: arch/arm/mach-at91/include/mach/at_hdmac.h ATMEL ISI DRIVER M: Josh Wu L: linux-media@vger.kernel.org S: Supported -F: drivers/media/platform/soc_camera/atmel-isi.c +F: drivers/media/platform/atmel-isi.c F: include/media/atmel-isi.h ATMEL LCDFB DRIVER @@ -1474,7 +1467,6 @@ W: http://people.redhat.com/sgrubb/audit/ T: git git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current.git S: Maintained F: include/linux/audit.h -F: include/uapi/linux/audit.h F: kernel/audit* AUXILIARY DISPLAY DRIVERS @@ -1505,7 +1497,7 @@ M: Ralf Baechle L: linux-hams@vger.kernel.org W: http://www.linux-ax25.org/ S: Maintained -F: include/uapi/linux/ax25.h +F: include/linux/ax25.h F: include/net/ax25.h F: net/ax25/ @@ -1566,7 +1558,7 @@ M: "Tigran A. Aivazian" S: Maintained F: Documentation/filesystems/bfs.txt F: fs/bfs/ -F: include/uapi/linux/bfs_fs.h +F: include/linux/bfs_fs.h BLACKFIN ARCHITECTURE M: Mike Frysinger @@ -1663,7 +1655,7 @@ L: netdev@vger.kernel.org W: http://sourceforge.net/projects/bonding/ S: Supported F: drivers/net/bonding/ -F: include/uapi/linux/if_bonding.h +F: include/linux/if_bonding.h BROADCOM B44 10/100 ETHERNET DRIVER M: Gary Zambrano @@ -1742,7 +1734,6 @@ L: linux-scsi@vger.kernel.org S: Supported F: block/bsg.c F: include/linux/bsg.h -F: include/uapi/linux/bsg.h BT87X AUDIO DRIVER M: Clemens Ladisch @@ -1813,7 +1804,7 @@ L: netdev@vger.kernel.org S: Supported F: Documentation/networking/caif/ F: drivers/net/caif/ -F: include/uapi/linux/caif/ +F: include/linux/caif/ F: include/net/caif/ F: net/caif/ @@ -1834,11 +1825,11 @@ W: http://gitorious.org/linux-can T: git git://gitorious.org/linux-can/linux-can-next.git S: Maintained F: net/can/ +F: include/linux/can.h F: include/linux/can/core.h -F: include/uapi/linux/can.h -F: include/uapi/linux/can/bcm.h -F: include/uapi/linux/can/raw.h -F: include/uapi/linux/can/gw.h +F: include/linux/can/bcm.h +F: include/linux/can/raw.h +F: include/linux/can/gw.h CAN NETWORK DRIVERS M: Wolfgang Grandegger @@ -1849,16 +1840,15 @@ T: git git://gitorious.org/linux-can/linux-can-next.git S: Maintained F: drivers/net/can/ F: include/linux/can/dev.h +F: include/linux/can/error.h +F: include/linux/can/netlink.h F: include/linux/can/platform/ -F: include/uapi/linux/can/error.h -F: include/uapi/linux/can/netlink.h CAPABILITIES M: Serge Hallyn L: linux-security-module@vger.kernel.org S: Supported F: include/linux/capability.h -F: include/uapi/linux/capability.h F: security/capability.c F: security/commoncap.c F: kernel/capability.c @@ -1871,7 +1861,6 @@ W: http://www.ibm.com/developerworks/power/cell/ S: Supported F: arch/powerpc/include/asm/cell*.h F: arch/powerpc/include/asm/spu*.h -F: arch/powerpc/include/uapi/asm/spu*.h F: arch/powerpc/oprofile/*cell* F: arch/powerpc/platforms/cell/ @@ -1920,7 +1909,7 @@ W: http://wireless.kernel.org/ T: git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git T: git git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git S: Maintained -F: include/uapi/linux/nl80211.h +F: include/linux/nl80211.h F: include/net/cfg80211.h F: net/wireless/* X: net/wireless/wext* @@ -1972,9 +1961,9 @@ S: Maintained F: drivers/usb/host/ohci-ep93xx.c CIRRUS LOGIC CS4270 SOUND DRIVER -M: Timur Tabi +M: Timur Tabi L: alsa-devel@alsa-project.org (moderated for non-subscribers) -S: Odd Fixes +S: Supported F: sound/soc/codecs/cs4270* CLEANCACHE API @@ -2023,7 +2012,6 @@ S: Maintained F: Documentation/filesystems/coda.txt F: fs/coda/ F: include/linux/coda*.h -F: include/uapi/linux/coda*.h COMMON CLK FRAMEWORK M: Mike Turquette @@ -2278,7 +2266,6 @@ W: http://www.cyclades.com/ S: Orphan F: drivers/tty/cyclades.c F: include/linux/cyclades.h -F: include/uapi/linux/cyclades.h CYCLADES PC300 DRIVER W: http://www.cyclades.com/ @@ -2336,7 +2323,6 @@ L: dccp@vger.kernel.org W: http://www.linuxfoundation.org/collaborate/workgroups/networking/dccp S: Maintained F: include/linux/dccp.h -F: include/uapi/linux/dccp.h F: include/linux/tfrc.h F: net/dccp/ @@ -2363,7 +2349,7 @@ M: Massimo Dal Zotto W: http://www.debian.org/~dz/i8k/ S: Maintained F: drivers/char/i8k.c -F: include/uapi/linux/i8k.h +F: include/linux/i8k.h DELL SYSTEMS MANAGEMENT BASE DRIVER (dcdbas) M: Doug Warzecha @@ -2436,7 +2422,6 @@ S: Maintained F: Documentation/filesystems/quota.txt F: fs/quota/ F: include/linux/quota*.h -F: include/uapi/linux/quota*.h DISPLAYLINK USB 2.0 FRAMEBUFFER DRIVER (UDLFB) M: Bernie Thompson @@ -2543,7 +2528,6 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6.git S: Maintained F: drivers/gpu/drm/ F: include/drm/ -F: include/uapi/drm/ INTEL DRM DRIVERS (excluding Poulsbo, Moorestown and derivative chipsets) M: Daniel Vetter @@ -2553,7 +2537,6 @@ T: git git://people.freedesktop.org/~danvet/drm-intel S: Supported F: drivers/gpu/drm/i915 F: include/drm/i915* -F: include/uapi/drm/i915* DRM DRIVERS FOR EXYNOS M: Inki Dae @@ -2565,7 +2548,6 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git S: Supported F: drivers/gpu/drm/exynos F: include/drm/exynos* -F: include/uapi/drm/exynos* DRM DRIVERS FOR NVIDIA TEGRA M: Thierry Reding @@ -2640,7 +2622,7 @@ W: http://github.com/mkrufky Q: http://patchwork.linuxtv.org/project/linux-media/list/ T: git git://linuxtv.org/media_tree.git S: Maintained -F: drivers/media/usb/dvb-usb/cxusb* +F: drivers/media/usb/dvb-usb-v2/cxusb* DVB_USB_CYPRESS_FIRMWARE MEDIA DRIVER M: Antti Palosaari @@ -2740,7 +2722,6 @@ L: netfilter-devel@vger.kernel.org W: http://ebtables.sourceforge.net/ S: Maintained F: include/linux/netfilter_bridge/ebt_*.h -F: include/uapi/linux/netfilter_bridge/ebt_*.h F: net/bridge/netfilter/ebt*.c EC100 MEDIA DRIVER @@ -2952,6 +2933,12 @@ M: Maxim Levitsky S: Maintained F: drivers/media/rc/ene_ir.* +EPSON 1355 FRAMEBUFFER DRIVER +M: Christopher Hoover +M: Christopher Hoover +S: Maintained +F: drivers/video/epson1355fb.c + EPSON S1D13XXX FRAMEBUFFER DRIVER M: Kristoffer Ericson S: Maintained @@ -2966,7 +2953,7 @@ S: Maintained F: drivers/net/ethernet/i825xx/eexpress.* ETHERNET BRIDGE -M: Stephen Hemminger +M: Stephen Hemminger L: bridge@lists.linux-foundation.org L: netdev@vger.kernel.org W: http://www.linuxfoundation.org/en/Net:Bridge @@ -3064,7 +3051,6 @@ M: Eric Paris S: Maintained F: fs/notify/fanotify/ F: include/linux/fanotify.h -F: include/uapi/linux/fanotify.h FARSYNC SYNCHRONOUS DRIVER M: Kevin Curtis @@ -3088,7 +3074,6 @@ F: drivers/scsi/fcoe/ F: include/scsi/fc/ F: include/scsi/libfc.h F: include/scsi/libfcoe.h -F: include/uapi/scsi/fc/ FILE LOCKING (flock() and fcntl()/lockf()) M: Matthew Wilcox @@ -3096,8 +3081,6 @@ L: linux-fsdevel@vger.kernel.org S: Maintained F: include/linux/fcntl.h F: include/linux/fs.h -F: include/uapi/linux/fcntl.h -F: include/uapi/linux/fs.h F: fs/fcntl.c F: fs/locks.c @@ -3187,13 +3170,11 @@ F: Documentation/devicetree/bindings/fb/ F: drivers/video/ F: include/video/ F: include/linux/fb.h -F: include/uapi/video/ -F: include/uapi/linux/fb.h FREESCALE DIU FRAMEBUFFER DRIVER -M: Timur Tabi +M: Timur Tabi L: linux-fbdev@vger.kernel.org -S: Maintained +S: Supported F: drivers/video/fsl-diu-fb.* FREESCALE DMA DRIVER @@ -3215,7 +3196,7 @@ M: Sascha Hauer L: linux-fbdev@vger.kernel.org L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) S: Maintained -F: include/linux/platform_data/video-imxfb.h +F: arch/arm/plat-mxc/include/mach/imxfb.h F: drivers/video/imxfb.c FREESCALE SOC FS_ENET DRIVER @@ -3228,8 +3209,9 @@ F: drivers/net/ethernet/freescale/fs_enet/ F: include/linux/fs_enet_pd.h FREESCALE QUICC ENGINE LIBRARY +M: Timur Tabi L: linuxppc-dev@lists.ozlabs.org -S: Orphan +S: Supported F: arch/powerpc/sysdev/qe_lib/ F: arch/powerpc/include/asm/*qe.h @@ -3248,16 +3230,16 @@ S: Maintained F: drivers/net/ethernet/freescale/ucc_geth* FREESCALE QUICC ENGINE UCC UART DRIVER -M: Timur Tabi +M: Timur Tabi L: linuxppc-dev@lists.ozlabs.org -S: Maintained +S: Supported F: drivers/tty/serial/ucc_uart.c FREESCALE SOC SOUND DRIVERS -M: Timur Tabi +M: Timur Tabi L: alsa-devel@alsa-project.org (moderated for non-subscribers) L: linuxppc-dev@lists.ozlabs.org -S: Maintained +S: Supported F: sound/soc/fsl/fsl* F: sound/soc/fsl/mpc8610_hpcd.c @@ -3332,7 +3314,7 @@ L: fuse-devel@lists.sourceforge.net W: http://fuse.sourceforge.net/ S: Maintained F: fs/fuse/ -F: include/uapi/linux/fuse.h +F: include/linux/fuse.h FUTURE DOMAIN TMC-16x0 SCSI DRIVER (16-bit) M: Rik Faith @@ -3379,7 +3361,6 @@ L: linux-arch@vger.kernel.org T: git git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic.git S: Maintained F: include/asm-generic -F: include/uapi/asm-generic GENERIC UIO DRIVER FOR PCI DEVICES M: "Michael S. Tsirkin" @@ -3396,7 +3377,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-nmw.git S: Supported F: Documentation/filesystems/gfs2*.txt F: fs/gfs2/ -F: include/uapi/linux/gfs2_ondisk.h +F: include/linux/gfs2_ondisk.h GIGASET ISDN DRIVERS M: Hansjoerg Lipp @@ -3406,7 +3387,7 @@ W: http://gigaset307x.sourceforge.net/ S: Maintained F: Documentation/isdn/README.gigaset F: drivers/isdn/gigaset/ -F: include/uapi/linux/gigaset_dev.h +F: include/linux/gigaset_dev.h GPIO SUBSYSTEM M: Grant Likely @@ -3563,7 +3544,6 @@ S: Supported F: Documentation/scsi/hpsa.txt F: drivers/scsi/hpsa*.[ch] F: include/linux/cciss*.h -F: include/uapi/linux/cciss*.h HEWLETT-PACKARD SMART CISS RAID DRIVER (cciss) M: Mike Miller @@ -3572,7 +3552,6 @@ S: Supported F: Documentation/blockdev/cciss.txt F: drivers/block/cciss* F: include/linux/cciss_ioctl.h -F: include/uapi/linux/cciss_ioctl.h HFS FILESYSTEM L: linux-fsdevel@vger.kernel.org @@ -3607,7 +3586,6 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid.git S: Maintained F: drivers/hid/ F: include/linux/hid* -F: include/uapi/linux/hid* HIGH-RESOLUTION TIMERS, CLOCKEVENTS, DYNTICKS M: Thomas Gleixner @@ -3639,7 +3617,7 @@ M: Jes Sorensen L: linux-hippi@sunsite.dk S: Maintained F: include/linux/hippidevice.h -F: include/uapi/linux/if_hippi.h +F: include/linux/if_hippi.h F: net/802/hippi.c F: drivers/net/hippi/ @@ -3667,7 +3645,6 @@ S: Maintained F: Documentation/timers/hpet.txt F: drivers/char/hpet.c F: include/linux/hpet.h -F: include/uapi/linux/hpet.h HPET: x86 M: "Venkatesh Pallipadi (Venki)" @@ -3768,8 +3745,6 @@ F: Documentation/i2c/ F: drivers/i2c/ F: include/linux/i2c.h F: include/linux/i2c-*.h -F: include/uapi/linux/i2c.h -F: include/uapi/linux/i2c-*.h I2C-TAOS-EVM DRIVER M: Jean Delvare @@ -3885,7 +3860,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/lowpan/lowpan.git S: Maintained F: net/ieee802154/ F: net/mac802154/ -F: drivers/net/ieee802154/ +F: drivers/ieee802154/ IGUANAWORKS USB IR TRANSCEIVER M: Sean Young @@ -3936,7 +3911,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband.git S: Supported F: Documentation/infiniband/ F: drivers/infiniband/ -F: include/uapi/linux/if_infiniband.h +F: include/linux/if_infiniband.h INOTIFY M: John McCutchan @@ -3946,7 +3921,6 @@ S: Maintained F: Documentation/filesystems/inotify.txt F: fs/notify/inotify/ F: include/linux/inotify.h -F: include/uapi/linux/inotify.h INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN) DRIVERS M: Dmitry Torokhov @@ -3957,7 +3931,6 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git S: Maintained F: drivers/input/ F: include/linux/input.h -F: include/uapi/linux/input.h F: include/linux/input/ INPUT MULTITOUCH (MT) PROTOCOL @@ -3978,6 +3951,7 @@ L: linux-scsi@vger.kernel.org T: git git://git.code.sf.net/p/intel-sas/isci S: Supported F: drivers/scsi/isci/ +F: firmware/isci/ INTEL IDLE DRIVER M: Len Brown @@ -4072,6 +4046,12 @@ F: Documentation/networking/ixgbe.txt F: Documentation/networking/ixgbevf.txt F: drivers/net/ethernet/intel/ +INTEL MRST PMU DRIVER +M: Len Brown +L: linux-pm@vger.kernel.org +S: Supported +F: arch/x86/platform/mrst/pmu.* + INTEL PRO/WIRELESS 2100, 2200BG, 2915ABG NETWORK CONNECTION SUPPORT M: Stanislav Yakovlev L: linux-wireless@vger.kernel.org @@ -4100,7 +4080,7 @@ S: Supported W: http://linuxwimax.org F: Documentation/wimax/README.i2400m F: drivers/net/wimax/i2400m/ -F: include/uapi/linux/wimax/i2400m.h +F: include/linux/wimax/i2400m.h INTEL WIRELESS 3945ABG/BG, 4965AGN (iwlegacy) M: Stanislaw Gruszka @@ -4122,9 +4102,9 @@ INTEL MANAGEMENT ENGINE (mei) M: Tomas Winkler L: linux-kernel@vger.kernel.org S: Supported -F: include/uapi/linux/mei.h +F: include/linux/mei.h F: drivers/misc/mei/* -F: Documentation/misc-devices/mei/* +F: Documentation/mei/* IOC3 ETHERNET DRIVER M: Ralf Baechle @@ -4164,7 +4144,6 @@ S: Supported F: Documentation/IPMI.txt F: drivers/char/ipmi/ F: include/linux/ipmi* -F: include/uapi/linux/ipmi* IPS SCSI RAID DRIVER M: Adaptec OEM Raid Solutions @@ -4182,7 +4161,7 @@ L: lvs-devel@vger.kernel.org S: Maintained F: Documentation/networking/ipvs-sysctl.txt F: include/net/ip_vs.h -F: include/uapi/linux/ip_vs.h +F: include/linux/ip_vs.h F: net/netfilter/ipvs/ IPWIRELESS DRIVER @@ -4195,8 +4174,8 @@ IPX NETWORK LAYER M: Arnaldo Carvalho de Melo L: netdev@vger.kernel.org S: Maintained +F: include/linux/ipx.h F: include/net/ipx.h -F: include/uapi/linux/ipx.h F: net/ipx/ IRDA SUBSYSTEM @@ -4259,8 +4238,6 @@ F: Documentation/isdn/ F: drivers/isdn/ F: include/linux/isdn.h F: include/linux/isdn/ -F: include/uapi/linux/isdn.h -F: include/uapi/linux/isdn/ ISDN SUBSYSTEM (Eicon active card driver) M: Armin Schindler @@ -4301,7 +4278,7 @@ W: http://www.ivtvdriver.org S: Maintained F: Documentation/video4linux/*.ivtv F: drivers/media/pci/ivtv/ -F: include/uapi/linux/ivtv* +F: include/linux/ivtv* IX2505V MEDIA DRIVER M: Malcolm Priestley @@ -4339,7 +4316,7 @@ L: linux-mtd@lists.infradead.org W: http://www.linux-mtd.infradead.org/doc/jffs2.html S: Maintained F: fs/jffs2/ -F: include/uapi/linux/jffs2.h +F: include/linux/jffs2.h JOURNALLING LAYER FOR BLOCK DEVICES (JBD) M: Andrew Morton @@ -4422,13 +4399,11 @@ W: http://nfs.sourceforge.net/ S: Supported F: fs/nfsd/ F: include/linux/nfsd/ -F: include/uapi/linux/nfsd/ F: fs/lockd/ F: fs/nfs_common/ F: net/sunrpc/ F: include/linux/lockd/ F: include/linux/sunrpc/ -F: include/uapi/linux/sunrpc/ KERNEL VIRTUAL MACHINE (KVM) M: Marcelo Tosatti @@ -4440,7 +4415,6 @@ F: Documentation/*/kvm.txt F: arch/*/kvm/ F: arch/*/include/asm/kvm* F: include/linux/kvm* -F: include/uapi/linux/kvm* F: virt/kvm/ KERNEL VIRTUAL MACHINE (KVM) FOR AMD-V @@ -4487,7 +4461,6 @@ W: http://kernel.org/pub/linux/utils/kernel/kexec/ L: kexec@lists.infradead.org S: Maintained F: include/linux/kexec.h -F: include/uapi/linux/kexec.h F: kernel/kexec.c KEYS/KEYRINGS: @@ -4729,7 +4702,6 @@ LLC (802.2) M: Arnaldo Carvalho de Melo S: Maintained F: include/linux/llc.h -F: include/uapi/linux/llc.h F: include/net/llc* F: net/llc/ @@ -4905,7 +4877,7 @@ S: Maintained MARVELL GIGABIT ETHERNET DRIVERS (skge/sky2) M: Mirko Lindner -M: Stephen Hemminger +M: Stephen Hemminger L: netdev@vger.kernel.org S: Maintained F: drivers/net/ethernet/marvell/sk* @@ -4950,7 +4922,7 @@ MATROX FRAMEBUFFER DRIVER L: linux-fbdev@vger.kernel.org S: Orphan F: drivers/video/matrox/matroxfb_* -F: include/uapi/linux/matroxfb.h +F: include/linux/matroxfb.h MAX16065 HARDWARE MONITOR DRIVER M: Guenter Roeck @@ -5032,7 +5004,7 @@ T: git git://git.infradead.org/mtd-2.6.git S: Maintained F: drivers/mtd/ F: include/linux/mtd/ -F: include/uapi/mtd/ +F: include/mtd/ MICROBLAZE ARCHITECTURE M: Michal Simek @@ -5070,6 +5042,12 @@ F: Documentation/video4linux/meye.txt F: drivers/media/pci/meye/ F: include/uapi/linux/meye.h +MOTOROLA IMX MMC/SD HOST CONTROLLER INTERFACE DRIVER +M: Pavel Pisa +L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) +S: Maintained +F: drivers/mmc/host/imxmmc.* + MOXA SMARTIO/INDUSTIO/INTELLIO SERIAL CARD M: Jiri Slaby S: Maintained @@ -5084,7 +5062,7 @@ S: Maintained F: drivers/media/radio/radio-mr800.c MSI LAPTOP SUPPORT -M: "Lee, Chun-Yi" +M: "Lee, Chun-Yi" L: platform-driver-x86@vger.kernel.org S: Maintained F: drivers/platform/x86/msi-laptop.c @@ -5108,7 +5086,6 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc.git S: Maintained F: drivers/mmc/ F: include/linux/mmc/ -F: include/uapi/linux/mmc/ MULTIMEDIA CARD (MMC) ETC. OVER SPI S: Orphan @@ -5180,7 +5157,7 @@ S: Supported F: drivers/infiniband/hw/nes/ NETEM NETWORK EMULATOR -M: Stephen Hemminger +M: Stephen Hemminger L: netem@lists.linux-foundation.org S: Maintained F: net/sched/sch_netem.c @@ -5209,8 +5186,6 @@ S: Supported F: include/linux/netfilter* F: include/linux/netfilter/ F: include/net/netfilter/ -F: include/uapi/linux/netfilter* -F: include/uapi/linux/netfilter/ F: net/*/netfilter.c F: net/*/netfilter/ F: net/netfilter/ @@ -5229,8 +5204,8 @@ M: Ralf Baechle L: linux-hams@vger.kernel.org W: http://www.linux-ax25.org/ S: Maintained +F: include/linux/netrom.h F: include/net/netrom.h -F: include/uapi/linux/netrom.h F: net/netrom/ NETWORK BLOCK DEVICE (NBD) @@ -5239,7 +5214,6 @@ S: Maintained F: Documentation/blockdev/nbd.txt F: drivers/block/nbd.c F: include/linux/nbd.h -F: include/uapi/linux/nbd.h NETWORK DROP MONITOR M: Neil Horman @@ -5261,9 +5235,6 @@ F: include/net/ F: include/linux/in.h F: include/linux/net.h F: include/linux/netdevice.h -F: include/uapi/linux/in.h -F: include/uapi/linux/net.h -F: include/uapi/linux/netdevice.h NETWORKING [IPv4/IPv6] M: "David S. Miller" @@ -5309,7 +5280,6 @@ F: net/rfkill/ F: net/wireless/ F: include/net/ieee80211* F: include/linux/wireless.h -F: include/uapi/linux/wireless.h F: include/net/iw_handler.h F: drivers/net/wireless/ @@ -5329,8 +5299,6 @@ F: include/linux/fcdevice.h F: include/linux/fddidevice.h F: include/linux/hippidevice.h F: include/linux/inetdevice.h -F: include/uapi/linux/if_* -F: include/uapi/linux/netdevice.h NETXEN (1/10) GbE SUPPORT M: Sony Chacko @@ -5348,8 +5316,8 @@ L: linux-wireless@vger.kernel.org L: linux-nfc@lists.01.org (moderated for non-subscribers) S: Maintained F: net/nfc/ +F: include/linux/nfc.h F: include/net/nfc/ -F: include/uapi/linux/nfc.h F: drivers/nfc/ F: include/linux/platform_data/pn544.h @@ -5366,8 +5334,6 @@ F: net/sunrpc/ F: include/linux/lockd/ F: include/linux/nfs* F: include/linux/sunrpc/ -F: include/uapi/linux/nfs* -F: include/uapi/linux/sunrpc/ NI5010 NETWORK DRIVER M: Jan-Pascal van Best @@ -5514,7 +5480,8 @@ M: Benoît Cousson M: Paul Walmsley L: linux-omap@vger.kernel.org S: Maintained -F: arch/arm/mach-omap2/omap_hwmod.* +F: arch/arm/mach-omap2/omap_hwmod.c +F: arch/arm/plat-omap/include/plat/omap_hwmod.h OMAP HWMOD DATA FOR OMAP4-BASED DEVICES M: Benoît Cousson @@ -5556,7 +5523,6 @@ M: Harald Welte S: Maintained F: drivers/char/pcmcia/cm4000_cs.c F: include/linux/cm4000_cs.h -F: include/uapi/linux/cm4000_cs.h OMNIKEY CARDMAN 4040 DRIVER M: Harald Welte @@ -5715,7 +5681,7 @@ S: Orphan F: drivers/parport/ F: include/linux/parport*.h F: drivers/char/ppdev.c -F: include/uapi/linux/ppdev.h +F: include/linux/ppdev.h PARAVIRT_OPS INTERFACE M: Jeremy Fitzhardinge @@ -5856,11 +5822,11 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core S: Supported F: kernel/events/* F: include/linux/perf_event.h -F: include/uapi/linux/perf_event.h F: arch/*/kernel/perf_event*.c F: arch/*/kernel/*/perf_event*.c F: arch/*/kernel/*/*/perf_event*.c F: arch/*/include/asm/perf_event.h +F: arch/*/lib/perf_event*.c F: arch/*/kernel/perf_callchain.c F: tools/perf/ @@ -5869,7 +5835,6 @@ M: Christoph Hellwig L: linux-abi-devel@lists.sourceforge.net S: Maintained F: include/linux/personality.h -F: include/uapi/linux/personality.h PHONET PROTOCOL M: Remi Denis-Courmont @@ -5877,7 +5842,6 @@ S: Supported F: Documentation/networking/phonet.txt F: include/linux/phonet.h F: include/net/phonet/ -F: include/uapi/linux/phonet.h F: net/phonet/ PHRAM MTD DRIVER @@ -5926,7 +5890,6 @@ M: Jiri Kosina S: Maintained F: drivers/block/pktcdvd.c F: include/linux/pktcdvd.h -F: include/uapi/linux/pktcdvd.h PKUNITY SOC DRIVERS M: Guan Xuetao @@ -6001,7 +5964,7 @@ PPP OVER ATM (RFC 2364) M: Mitchell Blank Jr S: Maintained F: net/atm/pppoatm.c -F: include/uapi/linux/atmppp.h +F: include/linux/atmppp.h PPP OVER ETHERNET M: Michal Ostrowski @@ -6014,7 +5977,6 @@ M: James Chapman S: Maintained F: net/l2tp/l2tp_ppp.c F: include/linux/if_pppol2tp.h -F: include/uapi/linux/if_pppol2tp.h PPS SUPPORT M: Rodolfo Giometti @@ -6112,7 +6074,6 @@ F: include/asm-generic/syscall.h F: include/linux/ptrace.h F: include/linux/regset.h F: include/linux/tracehook.h -F: include/uapi/linux/ptrace.h F: kernel/ptrace.c PVRUSB2 VIDEO4LINUX DRIVER @@ -6141,6 +6102,7 @@ T: git git://gitorious.org/linux-pwm/linux-pwm.git F: Documentation/pwm.txt F: Documentation/devicetree/bindings/pwm/ F: include/linux/pwm.h +F: include/linux/of_pwm.h F: drivers/pwm/ F: drivers/video/backlight/pwm_bl.c F: include/linux/pwm_backlight.h @@ -6236,8 +6198,8 @@ M: Anders Larsen W: http://www.alarsen.net/linux/qnx4fs/ S: Maintained F: fs/qnx4/ -F: include/uapi/linux/qnx4_fs.h -F: include/uapi/linux/qnxtypes.h +F: include/linux/qnx4_fs.h +F: include/linux/qnxtypes.h QT1010 MEDIA DRIVER M: Antti Palosaari @@ -6271,7 +6233,7 @@ M: Benjamin Herrenschmidt L: linux-fbdev@vger.kernel.org S: Maintained F: drivers/video/aty/radeon* -F: include/uapi/linux/radeonfb.h +F: include/linux/radeonfb.h RADIOSHARK RADIO DRIVER M: Hans de Goede @@ -6372,7 +6334,6 @@ S: Maintained F: Documentation/rtc.txt F: drivers/rtc/ F: include/linux/rtc.h -F: include/uapi/linux/rtc.h REISERFS FILE SYSTEM L: reiserfs-devel@vger.kernel.org @@ -6427,8 +6388,8 @@ M: Ralf Baechle L: linux-hams@vger.kernel.org W: http://www.linux-ax25.org/ S: Maintained +F: include/linux/rose.h F: include/net/rose.h -F: include/uapi/linux/rose.h F: net/rose/ RTL2830 MEDIA DRIVER @@ -6585,7 +6546,7 @@ F: drivers/media/platform/s3c-camif/ F: include/media/s3c_camif.h SERIAL DRIVERS -M: Greg Kroah-Hartman +M: Alan Cox L: linux-serial@vger.kernel.org S: Maintained F: drivers/tty/serial @@ -6605,8 +6566,6 @@ S: Supported F: include/linux/clocksource.h F: include/linux/time.h F: include/linux/timex.h -F: include/uapi/linux/time.h -F: include/uapi/linux/timex.h F: kernel/time/clocksource.c F: kernel/time/time*.c F: kernel/time/ntp.c @@ -6631,7 +6590,6 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core S: Maintained F: kernel/sched/ F: include/linux/sched.h -F: include/uapi/linux/sched.h SCORE ARCHITECTURE M: Chen Liqin @@ -6785,7 +6743,7 @@ SENSABLE PHANTOM M: Jiri Slaby S: Maintained F: drivers/misc/phantom.c -F: include/uapi/linux/phantom.h +F: include/linux/phantom.h SERIAL ATA (SATA) SUBSYSTEM M: Jeff Garzik @@ -7043,7 +7001,6 @@ L: linux-raid@vger.kernel.org S: Supported F: drivers/md/ F: include/linux/raid/ -F: include/uapi/linux/raid/ SONIC NETWORK DRIVER M: Thomas Bogendoerfer @@ -7084,7 +7041,6 @@ T: git git://git.alsa-project.org/alsa-kernel.git S: Maintained F: Documentation/sound/ F: include/sound/ -F: include/uapi/sound/ F: sound/ SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEMENT (ASoC) @@ -7185,7 +7141,6 @@ S: Maintained F: Documentation/spi/ F: drivers/spi/ F: include/linux/spi/ -F: include/uapi/linux/spi/ SPIDERNET NETWORK DRIVER for CELL M: Ishizaki Kou @@ -7322,7 +7277,7 @@ F: drivers/staging/rtl8712/ STAGING - SILICON MOTION SM7XX FRAME BUFFER DRIVER M: Teddy Wang S: Odd Fixes -F: drivers/staging/sm7xxfb/ +F: drivers/staging/sm7xx/ STAGING - SOFTLOGIC 6x10 MPEG CODEC M: Ben Collins @@ -7340,7 +7295,7 @@ S: Odd Fixes F: drivers/staging/speakup/ STAGING - TI DSP BRIDGE DRIVERS -M: Omar Ramirez Luna +M: Omar Ramirez Luna S: Odd Fixes F: drivers/staging/tidspbridge/ @@ -7448,8 +7403,8 @@ TC CLASSIFIER M: Jamal Hadi Salim L: netdev@vger.kernel.org S: Maintained +F: include/linux/pkt_cls.h F: include/net/pkt_cls.h -F: include/uapi/linux/pkt_cls.h F: net/sched/ TCP LOW PRIORITY MODULE @@ -7541,7 +7496,6 @@ L: netdev@vger.kernel.org S: Supported F: drivers/net/team/ F: include/linux/if_team.h -F: include/uapi/linux/if_team.h TECHNOTREND USB IR RECEIVER M: Sean Young @@ -7640,7 +7594,7 @@ L: netdev@vger.kernel.org (core kernel code) L: tipc-discussion@lists.sourceforge.net (user apps, general discussion) W: http://tipc.sourceforge.net/ S: Maintained -F: include/uapi/linux/tipc*.h +F: include/linux/tipc*.h F: net/tipc/ TILE ARCHITECTURE @@ -7690,7 +7644,6 @@ W: http://www.buzzard.org.uk/toshiba/ S: Maintained F: drivers/char/toshiba.c F: include/linux/toshiba.h -F: include/uapi/linux/toshiba.h TMIO MMC DRIVER M: Guennadi Liakhovetski @@ -7758,9 +7711,6 @@ F: drivers/tty/serial/serial_core.c F: include/linux/serial_core.h F: include/linux/serial.h F: include/linux/tty.h -F: include/uapi/linux/serial_core.h -F: include/uapi/linux/serial.h -F: include/uapi/linux/tty.h TUA9001 MEDIA DRIVER M: Antti Palosaari @@ -7840,7 +7790,7 @@ M: David Herrmann L: linux-input@vger.kernel.org S: Maintained F: drivers/hid/uhid.c -F: include/uapi/linux/uhid.h +F: include/linux/uhid.h ULTRA-WIDEBAND (UWB) SUBSYSTEM: L: linux-usb@vger.kernel.org @@ -7869,7 +7819,6 @@ S: Maintained F: Documentation/cdrom/ F: drivers/cdrom/cdrom.c F: include/linux/cdrom.h -F: include/uapi/linux/cdrom.h UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER M: Vinayak Holikatti @@ -7887,7 +7836,7 @@ T: git git://git.infradead.org/ubi-2.6.git S: Maintained F: drivers/mtd/ubi/ F: include/linux/mtd/ubi.h -F: include/uapi/mtd/ubi-user.h +F: include/mtd/ubi-user.h UNSORTED BLOCK IMAGES (UBI) Fastmap M: Richard Weinberger @@ -7921,7 +7870,7 @@ M: Oliver Neukum L: linux-usb@vger.kernel.org S: Maintained F: drivers/net/usb/cdc_*.c -F: include/uapi/linux/usb/cdc.h +F: include/linux/usb/cdc.h USB CYPRESS C67X00 DRIVER M: Peter Korsgaard @@ -8242,7 +8191,6 @@ S: Maintained F: Documentation/vfio.txt F: drivers/vfio/ F: include/linux/vfio.h -F: include/uapi/linux/vfio.h VIDEOBUF2 FRAMEWORK M: Pawel Osciak @@ -8259,7 +8207,6 @@ L: virtualization@lists.linux-foundation.org S: Maintained F: drivers/char/virtio_console.c F: include/linux/virtio_console.h -F: include/uapi/linux/virtio_console.h VIRTIO CORE, NET AND BLOCK DRIVERS M: Rusty Russell @@ -8278,7 +8225,7 @@ L: virtualization@lists.linux-foundation.org L: netdev@vger.kernel.org S: Maintained F: drivers/vhost/ -F: include/uapi/linux/vhost.h +F: include/linux/vhost.h VIA RHINE NETWORK DRIVER M: Roger Luethi @@ -8418,7 +8365,6 @@ S: Maintained F: Documentation/watchdog/ F: drivers/watchdog/ F: include/linux/watchdog.h -F: include/uapi/linux/watchdog.h WD7000 SCSI DRIVER M: Miroslav Zagorac @@ -8444,9 +8390,9 @@ L: wimax@linuxwimax.org S: Supported W: http://linuxwimax.org F: Documentation/wimax/README.wimax +F: include/linux/wimax.h F: include/linux/wimax/debug.h F: include/net/wimax.h -F: include/uapi/linux/wimax.h F: net/wimax/ WISTRON LAPTOP BUTTON DRIVER @@ -8532,7 +8478,7 @@ F: Documentation/x86/ F: arch/x86/ X86 PLATFORM DRIVERS -M: Matthew Garrett +M: Matthew Garrett L: platform-driver-x86@vger.kernel.org T: git git://git.kernel.org/pub/scm/linux/kernel/git/mjg59/platform-drivers-x86.git S: Maintained @@ -8564,7 +8510,6 @@ F: drivers/*/xen-*front.c F: drivers/xen/ F: arch/x86/include/asm/xen/ F: include/xen/ -F: include/uapi/xen/ XEN HYPERVISOR ARM M: Stefano Stabellini diff --git a/trunk/Makefile b/trunk/Makefile index 2d3c92c774fb..80c5694b29fd 100644 --- a/trunk/Makefile +++ b/trunk/Makefile @@ -1,7 +1,7 @@ VERSION = 3 PATCHLEVEL = 8 SUBLEVEL = 0 -EXTRAVERSION = -rc5 +EXTRAVERSION = -rc2 NAME = Terrified Chipmunk # *DOCUMENTATION* @@ -169,7 +169,7 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ -e s/arm.*/arm/ -e s/sa110/arm/ \ -e s/s390x/s390/ -e s/parisc64/parisc/ \ -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ - -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ ) + -e s/sh[234].*/sh/ ) # Cross compiling and selecting different set of gcc/bin-utils # --------------------------------------------------------------------------- diff --git a/trunk/arch/arm/Kconfig b/trunk/arch/arm/Kconfig index 67874b82a4ed..f95ba14ae3d0 100644 --- a/trunk/arch/arm/Kconfig +++ b/trunk/arch/arm/Kconfig @@ -371,6 +371,7 @@ config ARCH_CNS3XXX config ARCH_CLPS711X bool "Cirrus Logic CLPS711x/EP721x/EP731x-based" select ARCH_REQUIRE_GPIOLIB + select ARCH_USES_GETTIMEOFFSET select AUTO_ZRELADDR select CLKDEV_LOOKUP select COMMON_CLK @@ -1229,7 +1230,6 @@ config ARM_ERRATA_430973 config ARM_ERRATA_458693 bool "ARM errata: Processor deadlock when a false hazard is created" depends on CPU_V7 - depends on !ARCH_MULTIPLATFORM help This option enables the workaround for the 458693 Cortex-A8 (r2p0) erratum. For very specific sequences of memory operations, it is @@ -1243,7 +1243,6 @@ config ARM_ERRATA_458693 config ARM_ERRATA_460075 bool "ARM errata: Data written to the L2 cache can be overwritten with stale data" depends on CPU_V7 - depends on !ARCH_MULTIPLATFORM help This option enables the workaround for the 460075 Cortex-A8 (r2p0) erratum. Any asynchronous access to the L2 cache may encounter a @@ -1256,7 +1255,6 @@ config ARM_ERRATA_460075 config ARM_ERRATA_742230 bool "ARM errata: DMB operation may be faulty" depends on CPU_V7 && SMP - depends on !ARCH_MULTIPLATFORM help This option enables the workaround for the 742230 Cortex-A9 (r1p0..r2p2) erratum. Under rare circumstances, a DMB instruction @@ -1269,7 +1267,6 @@ config ARM_ERRATA_742230 config ARM_ERRATA_742231 bool "ARM errata: Incorrect hazard handling in the SCU may lead to data corruption" depends on CPU_V7 && SMP - depends on !ARCH_MULTIPLATFORM help This option enables the workaround for the 742231 Cortex-A9 (r2p0..r2p2) erratum. Under certain conditions, specific to the @@ -1320,7 +1317,6 @@ config PL310_ERRATA_727915 config ARM_ERRATA_743622 bool "ARM errata: Faulty hazard checking in the Store Buffer may lead to data corruption" depends on CPU_V7 - depends on !ARCH_MULTIPLATFORM help This option enables the workaround for the 743622 Cortex-A9 (r2p*) erratum. Under very rare conditions, a faulty @@ -1334,7 +1330,6 @@ config ARM_ERRATA_743622 config ARM_ERRATA_751472 bool "ARM errata: Interrupted ICIALLUIS may prevent completion of broadcasted operation" depends on CPU_V7 - depends on !ARCH_MULTIPLATFORM help This option enables the workaround for the 751472 Cortex-A9 (prior to r3p0) erratum. An interrupted ICIALLUIS operation may prevent the diff --git a/trunk/arch/arm/boot/dts/Makefile b/trunk/arch/arm/boot/dts/Makefile index 5ebb44fe826a..e44da40d984f 100644 --- a/trunk/arch/arm/boot/dts/Makefile +++ b/trunk/arch/arm/boot/dts/Makefile @@ -155,7 +155,6 @@ dtb-$(CONFIG_ARCH_VT8500) += vt8500-bv07.dtb \ dtb-$(CONFIG_ARCH_ZYNQ) += zynq-zc702.dtb targets += dtbs -targets += $(dtb-y) endif # *.dtb used to be generated in the directory above. Clean out the diff --git a/trunk/arch/arm/boot/dts/armada-370-db.dts b/trunk/arch/arm/boot/dts/armada-370-db.dts index 9b82facb2561..00044026ef1f 100644 --- a/trunk/arch/arm/boot/dts/armada-370-db.dts +++ b/trunk/arch/arm/boot/dts/armada-370-db.dts @@ -26,7 +26,7 @@ memory { device_type = "memory"; - reg = <0x00000000 0x40000000>; /* 1 GB */ + reg = <0x00000000 0x20000000>; /* 512 MB */ }; soc { diff --git a/trunk/arch/arm/boot/dts/armada-370-xp.dtsi b/trunk/arch/arm/boot/dts/armada-370-xp.dtsi index 4c0abe85405f..cf6c48a09eac 100644 --- a/trunk/arch/arm/boot/dts/armada-370-xp.dtsi +++ b/trunk/arch/arm/boot/dts/armada-370-xp.dtsi @@ -50,19 +50,17 @@ ranges; serial@d0012000 { - compatible = "snps,dw-apb-uart"; + compatible = "ns16550"; reg = <0xd0012000 0x100>; reg-shift = <2>; interrupts = <41>; - reg-io-width = <4>; status = "disabled"; }; serial@d0012100 { - compatible = "snps,dw-apb-uart"; + compatible = "ns16550"; reg = <0xd0012100 0x100>; reg-shift = <2>; interrupts = <42>; - reg-io-width = <4>; status = "disabled"; }; diff --git a/trunk/arch/arm/boot/dts/armada-xp-mv78230.dtsi b/trunk/arch/arm/boot/dts/armada-xp-mv78230.dtsi index e041f42ed711..c45c7b4dc352 100644 --- a/trunk/arch/arm/boot/dts/armada-xp-mv78230.dtsi +++ b/trunk/arch/arm/boot/dts/armada-xp-mv78230.dtsi @@ -34,14 +34,7 @@ reg = <0>; clocks = <&cpuclk 0>; }; - - cpu@1 { - device_type = "cpu"; - compatible = "marvell,sheeva-v7"; - reg = <1>; - clocks = <&cpuclk 1>; - }; - }; + } soc { pinctrl { @@ -50,25 +43,27 @@ }; gpio0: gpio@d0018100 { - compatible = "marvell,orion-gpio"; - reg = <0xd0018100 0x40>; + compatible = "marvell,armadaxp-gpio"; + reg = <0xd0018100 0x40>, + <0xd0018800 0x30>; ngpios = <32>; gpio-controller; #gpio-cells = <2>; interrupt-controller; #interrupts-cells = <2>; - interrupts = <82>, <83>, <84>, <85>; + interrupts = <16>, <17>, <18>, <19>; }; gpio1: gpio@d0018140 { - compatible = "marvell,orion-gpio"; - reg = <0xd0018140 0x40>; + compatible = "marvell,armadaxp-gpio"; + reg = <0xd0018140 0x40>, + <0xd0018840 0x30>; ngpios = <17>; gpio-controller; #gpio-cells = <2>; interrupt-controller; #interrupts-cells = <2>; - interrupts = <87>, <88>, <89>; + interrupts = <20>, <21>, <22>; }; }; }; diff --git a/trunk/arch/arm/boot/dts/armada-xp-mv78260.dtsi b/trunk/arch/arm/boot/dts/armada-xp-mv78260.dtsi index 9e23bd8c9536..a2aee5707377 100644 --- a/trunk/arch/arm/boot/dts/armada-xp-mv78260.dtsi +++ b/trunk/arch/arm/boot/dts/armada-xp-mv78260.dtsi @@ -51,44 +51,39 @@ }; gpio0: gpio@d0018100 { - compatible = "marvell,orion-gpio"; - reg = <0xd0018100 0x40>; + compatible = "marvell,armadaxp-gpio"; + reg = <0xd0018100 0x40>, + <0xd0018800 0x30>; ngpios = <32>; gpio-controller; #gpio-cells = <2>; interrupt-controller; #interrupts-cells = <2>; - interrupts = <82>, <83>, <84>, <85>; + interrupts = <16>, <17>, <18>, <19>; }; gpio1: gpio@d0018140 { - compatible = "marvell,orion-gpio"; - reg = <0xd0018140 0x40>; + compatible = "marvell,armadaxp-gpio"; + reg = <0xd0018140 0x40>, + <0xd0018840 0x30>; ngpios = <32>; gpio-controller; #gpio-cells = <2>; interrupt-controller; #interrupts-cells = <2>; - interrupts = <87>, <88>, <89>, <90>; + interrupts = <20>, <21>, <22>, <23>; }; gpio2: gpio@d0018180 { - compatible = "marvell,orion-gpio"; - reg = <0xd0018180 0x40>; + compatible = "marvell,armadaxp-gpio"; + reg = <0xd0018180 0x40>, + <0xd0018870 0x30>; ngpios = <3>; gpio-controller; #gpio-cells = <2>; interrupt-controller; #interrupts-cells = <2>; - interrupts = <91>; - }; - - ethernet@d0034000 { - compatible = "marvell,armada-370-neta"; - reg = <0xd0034000 0x2500>; - interrupts = <14>; - clocks = <&gateclk 1>; - status = "disabled"; + interrupts = <24>; }; }; }; diff --git a/trunk/arch/arm/boot/dts/armada-xp-mv78460.dtsi b/trunk/arch/arm/boot/dts/armada-xp-mv78460.dtsi index 965966110e38..da03a129243a 100644 --- a/trunk/arch/arm/boot/dts/armada-xp-mv78460.dtsi +++ b/trunk/arch/arm/boot/dts/armada-xp-mv78460.dtsi @@ -66,44 +66,39 @@ }; gpio0: gpio@d0018100 { - compatible = "marvell,orion-gpio"; - reg = <0xd0018100 0x40>; + compatible = "marvell,armadaxp-gpio"; + reg = <0xd0018100 0x40>, + <0xd0018800 0x30>; ngpios = <32>; gpio-controller; #gpio-cells = <2>; interrupt-controller; #interrupts-cells = <2>; - interrupts = <82>, <83>, <84>, <85>; + interrupts = <16>, <17>, <18>, <19>; }; gpio1: gpio@d0018140 { - compatible = "marvell,orion-gpio"; - reg = <0xd0018140 0x40>; + compatible = "marvell,armadaxp-gpio"; + reg = <0xd0018140 0x40>, + <0xd0018840 0x30>; ngpios = <32>; gpio-controller; #gpio-cells = <2>; interrupt-controller; #interrupts-cells = <2>; - interrupts = <87>, <88>, <89>, <90>; + interrupts = <20>, <21>, <22>, <23>; }; gpio2: gpio@d0018180 { - compatible = "marvell,orion-gpio"; - reg = <0xd0018180 0x40>; + compatible = "marvell,armadaxp-gpio"; + reg = <0xd0018180 0x40>, + <0xd0018870 0x30>; ngpios = <3>; gpio-controller; #gpio-cells = <2>; interrupt-controller; #interrupts-cells = <2>; - interrupts = <91>; - }; - - ethernet@d0034000 { - compatible = "marvell,armada-370-neta"; - reg = <0xd0034000 0x2500>; - interrupts = <14>; - clocks = <&gateclk 1>; - status = "disabled"; + interrupts = <24>; }; }; }; diff --git a/trunk/arch/arm/boot/dts/armada-xp.dtsi b/trunk/arch/arm/boot/dts/armada-xp.dtsi index 2e37ef101c90..367aa3f94912 100644 --- a/trunk/arch/arm/boot/dts/armada-xp.dtsi +++ b/trunk/arch/arm/boot/dts/armada-xp.dtsi @@ -42,19 +42,17 @@ soc { serial@d0012200 { - compatible = "snps,dw-apb-uart"; + compatible = "ns16550"; reg = <0xd0012200 0x100>; reg-shift = <2>; interrupts = <43>; - reg-io-width = <4>; status = "disabled"; }; serial@d0012300 { - compatible = "snps,dw-apb-uart"; + compatible = "ns16550"; reg = <0xd0012300 0x100>; reg-shift = <2>; interrupts = <44>; - reg-io-width = <4>; status = "disabled"; }; @@ -95,6 +93,14 @@ status = "disabled"; }; + ethernet@d0034000 { + compatible = "marvell,armada-370-neta"; + reg = <0xd0034000 0x2500>; + interrupts = <14>; + clocks = <&gateclk 1>; + status = "disabled"; + }; + xor@d0060900 { compatible = "marvell,orion-xor"; reg = <0xd0060900 0x100 diff --git a/trunk/arch/arm/boot/dts/at91rm9200.dtsi b/trunk/arch/arm/boot/dts/at91rm9200.dtsi index 222047f1ece9..e154f242c680 100644 --- a/trunk/arch/arm/boot/dts/at91rm9200.dtsi +++ b/trunk/arch/arm/boot/dts/at91rm9200.dtsi @@ -336,8 +336,8 @@ i2c@0 { compatible = "i2c-gpio"; - gpios = <&pioA 25 0 /* sda */ - &pioA 26 0 /* scl */ + gpios = <&pioA 23 0 /* sda */ + &pioA 24 0 /* scl */ >; i2c-gpio,sda-open-drain; i2c-gpio,scl-open-drain; diff --git a/trunk/arch/arm/boot/dts/at91sam9260.dtsi b/trunk/arch/arm/boot/dts/at91sam9260.dtsi index cb7bcc51608d..68bccf41a2c6 100644 --- a/trunk/arch/arm/boot/dts/at91sam9260.dtsi +++ b/trunk/arch/arm/boot/dts/at91sam9260.dtsi @@ -306,22 +306,6 @@ }; }; - ssc0 { - pinctrl_ssc0_tx: ssc0_tx-0 { - atmel,pins = - <1 16 0x1 0x0 /* PB16 periph A */ - 1 17 0x1 0x0 /* PB17 periph A */ - 1 18 0x1 0x0>; /* PB18 periph A */ - }; - - pinctrl_ssc0_rx: ssc0_rx-0 { - atmel,pins = - <1 19 0x1 0x0 /* PB19 periph A */ - 1 20 0x1 0x0 /* PB20 periph A */ - 1 21 0x1 0x0>; /* PB21 periph A */ - }; - }; - pioA: gpio@fffff400 { compatible = "atmel,at91rm9200-gpio"; reg = <0xfffff400 0x200>; @@ -466,8 +450,6 @@ compatible = "atmel,at91rm9200-ssc"; reg = <0xfffbc000 0x4000>; interrupts = <14 4 5>; - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>; status = "disabled"; }; diff --git a/trunk/arch/arm/boot/dts/at91sam9263.dtsi b/trunk/arch/arm/boot/dts/at91sam9263.dtsi index 271d4de026e9..32ec62cf5385 100644 --- a/trunk/arch/arm/boot/dts/at91sam9263.dtsi +++ b/trunk/arch/arm/boot/dts/at91sam9263.dtsi @@ -271,38 +271,6 @@ }; }; - ssc0 { - pinctrl_ssc0_tx: ssc0_tx-0 { - atmel,pins = - <1 0 0x2 0x0 /* PB0 periph B */ - 1 1 0x2 0x0 /* PB1 periph B */ - 1 2 0x2 0x0>; /* PB2 periph B */ - }; - - pinctrl_ssc0_rx: ssc0_rx-0 { - atmel,pins = - <1 3 0x2 0x0 /* PB3 periph B */ - 1 4 0x2 0x0 /* PB4 periph B */ - 1 5 0x2 0x0>; /* PB5 periph B */ - }; - }; - - ssc1 { - pinctrl_ssc1_tx: ssc1_tx-0 { - atmel,pins = - <1 6 0x1 0x0 /* PB6 periph A */ - 1 7 0x1 0x0 /* PB7 periph A */ - 1 8 0x1 0x0>; /* PB8 periph A */ - }; - - pinctrl_ssc1_rx: ssc1_rx-0 { - atmel,pins = - <1 9 0x1 0x0 /* PB9 periph A */ - 1 10 0x1 0x0 /* PB10 periph A */ - 1 11 0x1 0x0>; /* PB11 periph A */ - }; - }; - pioA: gpio@fffff200 { compatible = "atmel,at91rm9200-gpio"; reg = <0xfffff200 0x200>; @@ -400,8 +368,6 @@ compatible = "atmel,at91rm9200-ssc"; reg = <0xfff98000 0x4000>; interrupts = <16 4 5>; - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>; status = "disabled"; }; @@ -409,8 +375,6 @@ compatible = "atmel,at91rm9200-ssc"; reg = <0xfff9c000 0x4000>; interrupts = <17 4 5>; - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_ssc1_tx &pinctrl_ssc1_rx>; status = "disabled"; }; diff --git a/trunk/arch/arm/boot/dts/at91sam9g45.dtsi b/trunk/arch/arm/boot/dts/at91sam9g45.dtsi index 6b1d4cab24c2..231858ffd850 100644 --- a/trunk/arch/arm/boot/dts/at91sam9g45.dtsi +++ b/trunk/arch/arm/boot/dts/at91sam9g45.dtsi @@ -290,38 +290,6 @@ }; }; - ssc0 { - pinctrl_ssc0_tx: ssc0_tx-0 { - atmel,pins = - <3 0 0x1 0x0 /* PD0 periph A */ - 3 1 0x1 0x0 /* PD1 periph A */ - 3 2 0x1 0x0>; /* PD2 periph A */ - }; - - pinctrl_ssc0_rx: ssc0_rx-0 { - atmel,pins = - <3 3 0x1 0x0 /* PD3 periph A */ - 3 4 0x1 0x0 /* PD4 periph A */ - 3 5 0x1 0x0>; /* PD5 periph A */ - }; - }; - - ssc1 { - pinctrl_ssc1_tx: ssc1_tx-0 { - atmel,pins = - <3 10 0x1 0x0 /* PD10 periph A */ - 3 11 0x1 0x0 /* PD11 periph A */ - 3 12 0x1 0x0>; /* PD12 periph A */ - }; - - pinctrl_ssc1_rx: ssc1_rx-0 { - atmel,pins = - <3 13 0x1 0x0 /* PD13 periph A */ - 3 14 0x1 0x0 /* PD14 periph A */ - 3 15 0x1 0x0>; /* PD15 periph A */ - }; - }; - pioA: gpio@fffff200 { compatible = "atmel,at91rm9200-gpio"; reg = <0xfffff200 0x200>; @@ -457,8 +425,6 @@ compatible = "atmel,at91sam9g45-ssc"; reg = <0xfff9c000 0x4000>; interrupts = <16 4 5>; - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>; status = "disabled"; }; @@ -466,8 +432,6 @@ compatible = "atmel,at91sam9g45-ssc"; reg = <0xfffa0000 0x4000>; interrupts = <17 4 5>; - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_ssc1_tx &pinctrl_ssc1_rx>; status = "disabled"; }; diff --git a/trunk/arch/arm/boot/dts/at91sam9n12.dtsi b/trunk/arch/arm/boot/dts/at91sam9n12.dtsi index 80e29c605d4e..e9efb34f4379 100644 --- a/trunk/arch/arm/boot/dts/at91sam9n12.dtsi +++ b/trunk/arch/arm/boot/dts/at91sam9n12.dtsi @@ -28,7 +28,6 @@ tcb1 = &tcb1; i2c0 = &i2c0; i2c1 = &i2c1; - ssc0 = &ssc0; }; cpus { cpu@0 { @@ -245,22 +244,6 @@ }; }; - ssc0 { - pinctrl_ssc0_tx: ssc0_tx-0 { - atmel,pins = - <0 24 0x2 0x0 /* PA24 periph B */ - 0 25 0x2 0x0 /* PA25 periph B */ - 0 26 0x2 0x0>; /* PA26 periph B */ - }; - - pinctrl_ssc0_rx: ssc0_rx-0 { - atmel,pins = - <0 27 0x2 0x0 /* PA27 periph B */ - 0 28 0x2 0x0 /* PA28 periph B */ - 0 29 0x2 0x0>; /* PA29 periph B */ - }; - }; - pioA: gpio@fffff400 { compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; reg = <0xfffff400 0x200>; @@ -311,15 +294,6 @@ status = "disabled"; }; - ssc0: ssc@f0010000 { - compatible = "atmel,at91sam9g45-ssc"; - reg = <0xf0010000 0x4000>; - interrupts = <28 4 5>; - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>; - status = "disabled"; - }; - usart0: serial@f801c000 { compatible = "atmel,at91sam9260-usart"; reg = <0xf801c000 0x4000>; diff --git a/trunk/arch/arm/boot/dts/at91sam9x5.dtsi b/trunk/arch/arm/boot/dts/at91sam9x5.dtsi index 8ecca6948d81..40ac3a4eb1ab 100644 --- a/trunk/arch/arm/boot/dts/at91sam9x5.dtsi +++ b/trunk/arch/arm/boot/dts/at91sam9x5.dtsi @@ -88,6 +88,13 @@ interrupts = <1 4 7>; }; + ssc0: ssc@f0010000 { + compatible = "atmel,at91sam9g45-ssc"; + reg = <0xf0010000 0x4000>; + interrupts = <28 4 5>; + status = "disabled"; + }; + tcb0: timer@f8008000 { compatible = "atmel,at91sam9x5-tcb"; reg = <0xf8008000 0x100>; @@ -143,11 +150,6 @@ atmel,pins = <0 3 0x1 0x0>; /* PA3 periph A */ }; - - pinctrl_usart0_sck: usart0_sck-0 { - atmel,pins = - <0 4 0x1 0x0>; /* PA4 periph A */ - }; }; usart1 { @@ -159,17 +161,12 @@ pinctrl_usart1_rts: usart1_rts-0 { atmel,pins = - <2 27 0x3 0x0>; /* PC27 periph C */ + <3 27 0x3 0x0>; /* PC27 periph C */ }; pinctrl_usart1_cts: usart1_cts-0 { atmel,pins = - <2 28 0x3 0x0>; /* PC28 periph C */ - }; - - pinctrl_usart1_sck: usart1_sck-0 { - atmel,pins = - <2 28 0x3 0x0>; /* PC29 periph C */ + <3 28 0x3 0x0>; /* PC28 periph C */ }; }; @@ -182,56 +179,46 @@ pinctrl_uart2_rts: uart2_rts-0 { atmel,pins = - <1 0 0x2 0x0>; /* PB0 periph B */ + <0 0 0x2 0x0>; /* PB0 periph B */ }; pinctrl_uart2_cts: uart2_cts-0 { atmel,pins = - <1 1 0x2 0x0>; /* PB1 periph B */ - }; - - pinctrl_usart2_sck: usart2_sck-0 { - atmel,pins = - <1 2 0x2 0x0>; /* PB2 periph B */ + <0 1 0x2 0x0>; /* PB1 periph B */ }; }; usart3 { pinctrl_uart3: usart3-0 { atmel,pins = - <2 23 0x2 0x1 /* PC22 periph B with pullup */ - 2 23 0x2 0x0>; /* PC23 periph B */ + <3 23 0x2 0x1 /* PC22 periph B with pullup */ + 3 23 0x2 0x0>; /* PC23 periph B */ }; pinctrl_usart3_rts: usart3_rts-0 { atmel,pins = - <2 24 0x2 0x0>; /* PC24 periph B */ + <3 24 0x2 0x0>; /* PC24 periph B */ }; pinctrl_usart3_cts: usart3_cts-0 { atmel,pins = - <2 25 0x2 0x0>; /* PC25 periph B */ - }; - - pinctrl_usart3_sck: usart3_sck-0 { - atmel,pins = - <2 26 0x2 0x0>; /* PC26 periph B */ + <3 25 0x2 0x0>; /* PC25 periph B */ }; }; uart0 { pinctrl_uart0: uart0-0 { atmel,pins = - <2 8 0x3 0x0 /* PC8 periph C */ - 2 9 0x3 0x1>; /* PC9 periph C with pullup */ + <3 8 0x3 0x0 /* PC8 periph C */ + 3 9 0x3 0x1>; /* PC9 periph C with pullup */ }; }; uart1 { pinctrl_uart1: uart1-0 { atmel,pins = - <2 16 0x3 0x0 /* PC16 periph C */ - 2 17 0x3 0x1>; /* PC17 periph C with pullup */ + <3 16 0x3 0x0 /* PC16 periph C */ + 3 17 0x3 0x1>; /* PC17 periph C with pullup */ }; }; @@ -260,14 +247,14 @@ pinctrl_macb0_rmii_mii: macb0_rmii_mii-0 { atmel,pins = - <1 8 0x1 0x0 /* PB8 periph A */ - 1 11 0x1 0x0 /* PB11 periph A */ - 1 12 0x1 0x0 /* PB12 periph A */ - 1 13 0x1 0x0 /* PB13 periph A */ - 1 14 0x1 0x0 /* PB14 periph A */ - 1 15 0x1 0x0 /* PB15 periph A */ - 1 16 0x1 0x0 /* PB16 periph A */ - 1 17 0x1 0x0>; /* PB17 periph A */ + <1 8 0x1 0x0 /* PA8 periph A */ + 1 11 0x1 0x0 /* PA11 periph A */ + 1 12 0x1 0x0 /* PA12 periph A */ + 1 13 0x1 0x0 /* PA13 periph A */ + 1 14 0x1 0x0 /* PA14 periph A */ + 1 15 0x1 0x0 /* PA15 periph A */ + 1 16 0x1 0x0 /* PA16 periph A */ + 1 17 0x1 0x0>; /* PA17 periph A */ }; }; @@ -303,22 +290,6 @@ }; }; - ssc0 { - pinctrl_ssc0_tx: ssc0_tx-0 { - atmel,pins = - <0 24 0x2 0x0 /* PA24 periph B */ - 0 25 0x2 0x0 /* PA25 periph B */ - 0 26 0x2 0x0>; /* PA26 periph B */ - }; - - pinctrl_ssc0_rx: ssc0_rx-0 { - atmel,pins = - <0 27 0x2 0x0 /* PA27 periph B */ - 0 28 0x2 0x0 /* PA28 periph B */ - 0 29 0x2 0x0>; /* PA29 periph B */ - }; - }; - pioA: gpio@fffff400 { compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; reg = <0xfffff400 0x200>; @@ -362,15 +333,6 @@ }; }; - ssc0: ssc@f0010000 { - compatible = "atmel,at91sam9g45-ssc"; - reg = <0xf0010000 0x4000>; - interrupts = <28 4 5>; - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>; - status = "disabled"; - }; - mmc0: mmc@f0008000 { compatible = "atmel,hsmci"; reg = <0xf0008000 0x600>; diff --git a/trunk/arch/arm/boot/dts/cros5250-common.dtsi b/trunk/arch/arm/boot/dts/cros5250-common.dtsi index 46c098017036..fddd17417433 100644 --- a/trunk/arch/arm/boot/dts/cros5250-common.dtsi +++ b/trunk/arch/arm/boot/dts/cros5250-common.dtsi @@ -96,8 +96,8 @@ fifo-depth = <0x80>; card-detect-delay = <200>; samsung,dw-mshc-ciu-div = <3>; - samsung,dw-mshc-sdr-timing = <2 3>; - samsung,dw-mshc-ddr-timing = <1 2>; + samsung,dw-mshc-sdr-timing = <2 3 3>; + samsung,dw-mshc-ddr-timing = <1 2 3>; slot@0 { reg = <0>; @@ -120,8 +120,8 @@ fifo-depth = <0x80>; card-detect-delay = <200>; samsung,dw-mshc-ciu-div = <3>; - samsung,dw-mshc-sdr-timing = <2 3>; - samsung,dw-mshc-ddr-timing = <1 2>; + samsung,dw-mshc-sdr-timing = <2 3 3>; + samsung,dw-mshc-ddr-timing = <1 2 3>; slot@0 { reg = <0>; @@ -141,8 +141,8 @@ fifo-depth = <0x80>; card-detect-delay = <200>; samsung,dw-mshc-ciu-div = <3>; - samsung,dw-mshc-sdr-timing = <2 3>; - samsung,dw-mshc-ddr-timing = <1 2>; + samsung,dw-mshc-sdr-timing = <2 3 3>; + samsung,dw-mshc-ddr-timing = <1 2 3>; slot@0 { reg = <0>; diff --git a/trunk/arch/arm/boot/dts/dove-cubox.dts b/trunk/arch/arm/boot/dts/dove-cubox.dts index cdee96fca6e2..fed7d3f9f431 100644 --- a/trunk/arch/arm/boot/dts/dove-cubox.dts +++ b/trunk/arch/arm/boot/dts/dove-cubox.dts @@ -26,15 +26,10 @@ }; &uart0 { status = "okay"; }; +&sdio0 { status = "okay"; }; &sata0 { status = "okay"; }; &i2c0 { status = "okay"; }; -&sdio0 { - status = "okay"; - /* sdio0 card detect is connected to wrong pin on CuBox */ - cd-gpios = <&gpio0 12 1>; -}; - &spi0 { status = "okay"; @@ -47,14 +42,9 @@ }; &pinctrl { - pinctrl-0 = <&pmx_gpio_12 &pmx_gpio_18>; + pinctrl-0 = <&pmx_gpio_18>; pinctrl-names = "default"; - pmx_gpio_12: pmx-gpio-12 { - marvell,pins = "mpp12"; - marvell,function = "gpio"; - }; - pmx_gpio_18: pmx-gpio-18 { marvell,pins = "mpp18"; marvell,function = "gpio"; diff --git a/trunk/arch/arm/boot/dts/dove.dtsi b/trunk/arch/arm/boot/dts/dove.dtsi index 42eac1ff3cc8..f3f7e9d8adca 100644 --- a/trunk/arch/arm/boot/dts/dove.dtsi +++ b/trunk/arch/arm/boot/dts/dove.dtsi @@ -117,7 +117,6 @@ pinctrl: pinctrl@d0200 { compatible = "marvell,dove-pinctrl"; reg = <0xd0200 0x10>; - clocks = <&gate_clk 22>; }; spi0: spi@10600 { diff --git a/trunk/arch/arm/boot/dts/ecx-2000.dts b/trunk/arch/arm/boot/dts/ecx-2000.dts index 139b40cc3a23..46477ac1de99 100644 --- a/trunk/arch/arm/boot/dts/ecx-2000.dts +++ b/trunk/arch/arm/boot/dts/ecx-2000.dts @@ -32,7 +32,6 @@ cpu@0 { compatible = "arm,cortex-a15"; - device_type = "cpu"; reg = <0>; clocks = <&a9pll>; clock-names = "cpu"; @@ -40,7 +39,6 @@ cpu@1 { compatible = "arm,cortex-a15"; - device_type = "cpu"; reg = <1>; clocks = <&a9pll>; clock-names = "cpu"; @@ -48,7 +46,6 @@ cpu@2 { compatible = "arm,cortex-a15"; - device_type = "cpu"; reg = <2>; clocks = <&a9pll>; clock-names = "cpu"; @@ -56,7 +53,6 @@ cpu@3 { compatible = "arm,cortex-a15"; - device_type = "cpu"; reg = <3>; clocks = <&a9pll>; clock-names = "cpu"; diff --git a/trunk/arch/arm/boot/dts/exynos4210-smdkv310.dts b/trunk/arch/arm/boot/dts/exynos4210-smdkv310.dts index f63490707f3a..9b23a8255e39 100644 --- a/trunk/arch/arm/boot/dts/exynos4210-smdkv310.dts +++ b/trunk/arch/arm/boot/dts/exynos4210-smdkv310.dts @@ -26,7 +26,7 @@ }; chosen { - bootargs = "root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC1,115200 init=/linuxrc"; + bootargs = "root=/dev/ram0 rw ramdisk=8192 initrd=0x41000000,8M console=ttySAC2,115200 init=/linuxrc"; }; sdhci@12530000 { diff --git a/trunk/arch/arm/boot/dts/exynos5250-smdk5250.dts b/trunk/arch/arm/boot/dts/exynos5250-smdk5250.dts index e05b18f3c33d..942d5761ca97 100644 --- a/trunk/arch/arm/boot/dts/exynos5250-smdk5250.dts +++ b/trunk/arch/arm/boot/dts/exynos5250-smdk5250.dts @@ -115,8 +115,8 @@ fifo-depth = <0x80>; card-detect-delay = <200>; samsung,dw-mshc-ciu-div = <3>; - samsung,dw-mshc-sdr-timing = <2 3>; - samsung,dw-mshc-ddr-timing = <1 2>; + samsung,dw-mshc-sdr-timing = <2 3 3>; + samsung,dw-mshc-ddr-timing = <1 2 3>; slot@0 { reg = <0>; @@ -139,8 +139,8 @@ fifo-depth = <0x80>; card-detect-delay = <200>; samsung,dw-mshc-ciu-div = <3>; - samsung,dw-mshc-sdr-timing = <2 3>; - samsung,dw-mshc-ddr-timing = <1 2>; + samsung,dw-mshc-sdr-timing = <2 3 3>; + samsung,dw-mshc-ddr-timing = <1 2 3>; slot@0 { reg = <0>; diff --git a/trunk/arch/arm/boot/dts/exynos5250.dtsi b/trunk/arch/arm/boot/dts/exynos5250.dtsi index 3acf594ea60b..2e3b6efaf1a2 100644 --- a/trunk/arch/arm/boot/dts/exynos5250.dtsi +++ b/trunk/arch/arm/boot/dts/exynos5250.dtsi @@ -574,7 +574,7 @@ hdmi { compatible = "samsung,exynos5-hdmi"; - reg = <0x14530000 0x70000>; + reg = <0x14530000 0x100000>; interrupts = <0 95 0>; }; diff --git a/trunk/arch/arm/boot/dts/exynos5440-ssdk5440.dts b/trunk/arch/arm/boot/dts/exynos5440-ssdk5440.dts index 81e2c964a900..921c83cf694f 100644 --- a/trunk/arch/arm/boot/dts/exynos5440-ssdk5440.dts +++ b/trunk/arch/arm/boot/dts/exynos5440-ssdk5440.dts @@ -21,7 +21,7 @@ }; chosen { - bootargs = "root=/dev/ram0 rw ramdisk=8192 initrd=0x81000000,8M console=ttySAC0,115200 init=/linuxrc"; + bootargs = "root=/dev/ram0 rw ramdisk=8192 initrd=0x81000000,8M console=ttySAC2,115200 init=/linuxrc"; }; spi { diff --git a/trunk/arch/arm/boot/dts/highbank.dts b/trunk/arch/arm/boot/dts/highbank.dts index 5927a8df5625..a9ae5d32e80d 100644 --- a/trunk/arch/arm/boot/dts/highbank.dts +++ b/trunk/arch/arm/boot/dts/highbank.dts @@ -30,37 +30,33 @@ #address-cells = <1>; #size-cells = <0>; - cpu@900 { + cpu@0 { compatible = "arm,cortex-a9"; - device_type = "cpu"; - reg = <0x900>; + reg = <0>; next-level-cache = <&L2>; clocks = <&a9pll>; clock-names = "cpu"; }; - cpu@901 { + cpu@1 { compatible = "arm,cortex-a9"; - device_type = "cpu"; - reg = <0x901>; + reg = <1>; next-level-cache = <&L2>; clocks = <&a9pll>; clock-names = "cpu"; }; - cpu@902 { + cpu@2 { compatible = "arm,cortex-a9"; - device_type = "cpu"; - reg = <0x902>; + reg = <2>; next-level-cache = <&L2>; clocks = <&a9pll>; clock-names = "cpu"; }; - cpu@903 { + cpu@3 { compatible = "arm,cortex-a9"; - device_type = "cpu"; - reg = <0x903>; + reg = <3>; next-level-cache = <&L2>; clocks = <&a9pll>; clock-names = "cpu"; diff --git a/trunk/arch/arm/boot/dts/imx23-olinuxino.dts b/trunk/arch/arm/boot/dts/imx23-olinuxino.dts index e7484e4ea659..7c43b8e70b9f 100644 --- a/trunk/arch/arm/boot/dts/imx23-olinuxino.dts +++ b/trunk/arch/arm/boot/dts/imx23-olinuxino.dts @@ -39,17 +39,17 @@ hog_pins_a: hog@0 { reg = <0>; fsl,pinmux-ids = < - 0x0113 /* MX23_PAD_GPMI_ALE__GPIO_0_17 */ + 0x2013 /* MX23_PAD_SSP1_DETECT__GPIO_2_1 */ >; fsl,drive-strength = <0>; fsl,voltage = <1>; fsl,pull-up = <0>; }; - led_pin_gpio2_1: led_gpio2_1@0 { + led_pin_gpio0_17: led_gpio0_17@0 { reg = <0>; fsl,pinmux-ids = < - 0x2013 /* MX23_PAD_SSP1_DETECT__GPIO_2_1 */ + 0x0113 /* MX23_PAD_GPMI_ALE__GPIO_0_17 */ >; fsl,drive-strength = <0>; fsl,voltage = <1>; @@ -110,7 +110,7 @@ leds { compatible = "gpio-leds"; pinctrl-names = "default"; - pinctrl-0 = <&led_pin_gpio2_1>; + pinctrl-0 = <&led_pin_gpio0_17>; user { label = "green"; diff --git a/trunk/arch/arm/boot/dts/imx31-bug.dts b/trunk/arch/arm/boot/dts/imx31-bug.dts index 7f67402328d3..24731cb78e8e 100644 --- a/trunk/arch/arm/boot/dts/imx31-bug.dts +++ b/trunk/arch/arm/boot/dts/imx31-bug.dts @@ -14,7 +14,7 @@ / { model = "Buglabs i.MX31 Bug 1.x"; - compatible = "buglabs,imx31-bug", "fsl,imx31"; + compatible = "fsl,imx31-bug", "fsl,imx31"; memory { reg = <0x80000000 0x8000000>; /* 128M */ diff --git a/trunk/arch/arm/boot/dts/imx53.dtsi b/trunk/arch/arm/boot/dts/imx53.dtsi index edc3f1eb6699..552aed4ff982 100644 --- a/trunk/arch/arm/boot/dts/imx53.dtsi +++ b/trunk/arch/arm/boot/dts/imx53.dtsi @@ -492,7 +492,7 @@ compatible = "fsl,imx53-flexcan", "fsl,p1010-flexcan"; reg = <0x53fcc000 0x4000>; interrupts = <83>; - clocks = <&clks 87>, <&clks 86>; + clocks = <&clks 158>, <&clks 157>; clock-names = "ipg", "per"; status = "disabled"; }; diff --git a/trunk/arch/arm/boot/dts/kirkwood-6282.dtsi b/trunk/arch/arm/boot/dts/kirkwood-6282.dtsi index 4ccea2130a6c..9ae2004d5675 100644 --- a/trunk/arch/arm/boot/dts/kirkwood-6282.dtsi +++ b/trunk/arch/arm/boot/dts/kirkwood-6282.dtsi @@ -39,7 +39,6 @@ #size-cells = <0>; interrupts = <32>; clock-frequency = <100000>; - clocks = <&gate_clk 7>; status = "disabled"; }; }; diff --git a/trunk/arch/arm/boot/dts/kirkwood-ns2-common.dtsi b/trunk/arch/arm/boot/dts/kirkwood-ns2-common.dtsi index 77d21abfcdf7..9bc6785ad228 100644 --- a/trunk/arch/arm/boot/dts/kirkwood-ns2-common.dtsi +++ b/trunk/arch/arm/boot/dts/kirkwood-ns2-common.dtsi @@ -1,5 +1,4 @@ /include/ "kirkwood.dtsi" -/include/ "kirkwood-6281.dtsi" / { chosen { @@ -7,21 +6,6 @@ }; ocp@f1000000 { - pinctrl: pinctrl@10000 { - pinctrl-0 = < &pmx_spi &pmx_twsi0 &pmx_uart0 - &pmx_ns2_sata0 &pmx_ns2_sata1>; - pinctrl-names = "default"; - - pmx_ns2_sata0: pmx-ns2-sata0 { - marvell,pins = "mpp21"; - marvell,function = "sata0"; - }; - pmx_ns2_sata1: pmx-ns2-sata1 { - marvell,pins = "mpp20"; - marvell,function = "sata1"; - }; - }; - serial@12000 { clock-frequency = <166666667>; status = "okay"; diff --git a/trunk/arch/arm/boot/dts/kirkwood-topkick.dts b/trunk/arch/arm/boot/dts/kirkwood-topkick.dts index cd15452a52a6..c0de5a7f660d 100644 --- a/trunk/arch/arm/boot/dts/kirkwood-topkick.dts +++ b/trunk/arch/arm/boot/dts/kirkwood-topkick.dts @@ -82,21 +82,4 @@ gpios = <&gpio1 16 1>; }; }; - regulators { - compatible = "simple-bus"; - #address-cells = <1>; - #size-cells = <0>; - - sata0_power: regulator@1 { - compatible = "regulator-fixed"; - reg = <1>; - regulator-name = "SATA0 Power"; - regulator-min-microvolt = <5000000>; - regulator-max-microvolt = <5000000>; - enable-active-high; - regulator-always-on; - regulator-boot-on; - gpio = <&gpio1 4 0>; - }; - }; }; diff --git a/trunk/arch/arm/boot/dts/kirkwood.dtsi b/trunk/arch/arm/boot/dts/kirkwood.dtsi index d6ab442b7011..7735cee4a9c6 100644 --- a/trunk/arch/arm/boot/dts/kirkwood.dtsi +++ b/trunk/arch/arm/boot/dts/kirkwood.dtsi @@ -36,7 +36,6 @@ reg = <0x10100 0x40>; ngpios = <32>; interrupt-controller; - #interrupt-cells = <2>; interrupts = <35>, <36>, <37>, <38>; }; @@ -47,7 +46,6 @@ reg = <0x10140 0x40>; ngpios = <18>; interrupt-controller; - #interrupt-cells = <2>; interrupts = <39>, <40>, <41>; }; @@ -146,7 +144,6 @@ compatible = "marvell,orion-ehci"; reg = <0x50000 0x1000>; interrupts = <19>; - clocks = <&gate_clk 3>; status = "okay"; }; diff --git a/trunk/arch/arm/boot/dts/kizbox.dts b/trunk/arch/arm/boot/dts/kizbox.dts index b4dc3ed9a3ec..e8814fe0e277 100644 --- a/trunk/arch/arm/boot/dts/kizbox.dts +++ b/trunk/arch/arm/boot/dts/kizbox.dts @@ -48,8 +48,6 @@ macb0: ethernet@fffc4000 { phy-mode = "mii"; - pinctrl-0 = <&pinctrl_macb_rmii - &pinctrl_macb_rmii_mii_alt>; status = "okay"; }; diff --git a/trunk/arch/arm/boot/dts/sunxi.dtsi b/trunk/arch/arm/boot/dts/sunxi.dtsi index 8b36abea9f2e..8bbc2bfef221 100644 --- a/trunk/arch/arm/boot/dts/sunxi.dtsi +++ b/trunk/arch/arm/boot/dts/sunxi.dtsi @@ -60,21 +60,19 @@ }; uart0: uart@01c28000 { - compatible = "snps,dw-apb-uart"; + compatible = "ns8250"; reg = <0x01c28000 0x400>; interrupts = <1>; reg-shift = <2>; - reg-io-width = <4>; clock-frequency = <24000000>; status = "disabled"; }; uart1: uart@01c28400 { - compatible = "snps,dw-apb-uart"; + compatible = "ns8250"; reg = <0x01c28400 0x400>; interrupts = <2>; reg-shift = <2>; - reg-io-width = <4>; clock-frequency = <24000000>; status = "disabled"; }; diff --git a/trunk/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts b/trunk/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts index cf8071ad22d5..1fc405a9ecfb 100644 --- a/trunk/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts +++ b/trunk/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts @@ -45,6 +45,7 @@ reg = <1>; }; +/* A7s disabled till big.LITTLE patches are available... cpu2: cpu@2 { device_type = "cpu"; compatible = "arm,cortex-a7"; @@ -62,6 +63,7 @@ compatible = "arm,cortex-a7"; reg = <0x102>; }; +*/ }; memory@80000000 { diff --git a/trunk/arch/arm/common/vic.c b/trunk/arch/arm/common/vic.c index 8f324b99416e..e4df17ca90c7 100644 --- a/trunk/arch/arm/common/vic.c +++ b/trunk/arch/arm/common/vic.c @@ -206,7 +206,6 @@ static void __init vic_register(void __iomem *base, unsigned int irq, struct device_node *node) { struct vic_device *v; - int i; if (vic_id >= ARRAY_SIZE(vic_devices)) { printk(KERN_ERR "%s: too few VICs, increase CONFIG_ARM_VIC_NR\n", __func__); @@ -221,10 +220,6 @@ static void __init vic_register(void __iomem *base, unsigned int irq, vic_id++; v->domain = irq_domain_add_simple(node, fls(valid_sources), irq, &vic_irqdomain_ops, v); - /* create an IRQ mapping for each valid IRQ */ - for (i = 0; i < fls(valid_sources); i++) - if (valid_sources & (1 << i)) - irq_create_mapping(v->domain, i); } static void vic_ack_irq(struct irq_data *d) @@ -421,9 +416,9 @@ int __init vic_of_init(struct device_node *node, struct device_node *parent) return -EIO; /* - * Passing 0 as first IRQ makes the simple domain allocate descriptors + * Passing -1 as first IRQ makes the simple domain allocate descriptors */ - __vic_init(regs, 0, ~0, ~0, node); + __vic_init(regs, -1, ~0, ~0, node); return 0; } diff --git a/trunk/arch/arm/configs/at91_dt_defconfig b/trunk/arch/arm/configs/at91_dt_defconfig index 1ea959019fcd..b175577d7abb 100644 --- a/trunk/arch/arm/configs/at91_dt_defconfig +++ b/trunk/arch/arm/configs/at91_dt_defconfig @@ -19,7 +19,6 @@ CONFIG_SOC_AT91SAM9260=y CONFIG_SOC_AT91SAM9263=y CONFIG_SOC_AT91SAM9G45=y CONFIG_SOC_AT91SAM9X5=y -CONFIG_SOC_AT91SAM9N12=y CONFIG_MACH_AT91SAM_DT=y CONFIG_AT91_PROGRAMMABLE_CLOCKS=y CONFIG_AT91_TIMER_HZ=128 @@ -32,7 +31,7 @@ CONFIG_ZBOOT_ROM_TEXT=0x0 CONFIG_ZBOOT_ROM_BSS=0x0 CONFIG_ARM_APPENDED_DTB=y CONFIG_ARM_ATAG_DTB_COMPAT=y -CONFIG_CMDLINE="console=ttyS0,115200 initrd=0x21100000,25165824 root=/dev/ram0 rw" +CONFIG_CMDLINE="mem=128M console=ttyS0,115200 initrd=0x21100000,25165824 root=/dev/ram0 rw" CONFIG_KEXEC=y CONFIG_AUTO_ZRELADDR=y # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set diff --git a/trunk/arch/arm/configs/mvebu_defconfig b/trunk/arch/arm/configs/mvebu_defconfig index b5bc96cb65a7..a702fb345c01 100644 --- a/trunk/arch/arm/configs/mvebu_defconfig +++ b/trunk/arch/arm/configs/mvebu_defconfig @@ -33,7 +33,9 @@ CONFIG_MVNETA=y CONFIG_MARVELL_PHY=y CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_CONSOLE=y -CONFIG_SERIAL_8250_DW=y +CONFIG_SERIAL_OF_PLATFORM=y +CONFIG_I2C=y +CONFIG_I2C_MV64XXX=y CONFIG_GPIOLIB=y CONFIG_GPIO_SYSFS=y # CONFIG_USB_SUPPORT is not set diff --git a/trunk/arch/arm/kernel/debug.S b/trunk/arch/arm/kernel/debug.S index 14f7c3b14632..6809200c31fb 100644 --- a/trunk/arch/arm/kernel/debug.S +++ b/trunk/arch/arm/kernel/debug.S @@ -100,14 +100,12 @@ ENTRY(printch) b 1b ENDPROC(printch) -#ifdef CONFIG_MMU ENTRY(debug_ll_addr) addruart r2, r3, ip str r2, [r0] str r3, [r1] mov pc, lr ENDPROC(debug_ll_addr) -#endif #else diff --git a/trunk/arch/arm/kernel/head.S b/trunk/arch/arm/kernel/head.S index 486a15ae9011..4eee351f4668 100644 --- a/trunk/arch/arm/kernel/head.S +++ b/trunk/arch/arm/kernel/head.S @@ -246,7 +246,6 @@ __create_page_tables: /* * Then map boot params address in r2 if specified. - * We map 2 sections in case the ATAGs/DTB crosses a section boundary. */ mov r0, r2, lsr #SECTION_SHIFT movs r0, r0, lsl #SECTION_SHIFT @@ -254,8 +253,6 @@ __create_page_tables: addne r3, r3, #PAGE_OFFSET addne r3, r4, r3, lsr #(SECTION_SHIFT - PMD_ORDER) orrne r6, r7, r0 - strne r6, [r3], #1 << PMD_ORDER - addne r6, r6, #1 << SECTION_SHIFT strne r6, [r3] #ifdef CONFIG_DEBUG_LL @@ -334,7 +331,7 @@ ENTRY(secondary_startup) * as it has already been validated by the primary processor. */ #ifdef CONFIG_ARM_VIRT_EXT - bl __hyp_stub_install_secondary + bl __hyp_stub_install #endif safe_svcmode_maskall r9 diff --git a/trunk/arch/arm/kernel/hyp-stub.S b/trunk/arch/arm/kernel/hyp-stub.S index 1315c4ccfa56..65b2417aebce 100644 --- a/trunk/arch/arm/kernel/hyp-stub.S +++ b/trunk/arch/arm/kernel/hyp-stub.S @@ -99,7 +99,7 @@ ENTRY(__hyp_stub_install_secondary) * immediately. */ compare_cpu_mode_with_primary r4, r5, r6, r7 - movne pc, lr + bxne lr /* * Once we have given up on one CPU, we do not try to install the @@ -111,7 +111,7 @@ ENTRY(__hyp_stub_install_secondary) */ cmp r4, #HYP_MODE - movne pc, lr @ give up if the CPU is not in HYP mode + bxne lr @ give up if the CPU is not in HYP mode /* * Configure HSCTLR to set correct exception endianness/instruction set @@ -120,8 +120,7 @@ ENTRY(__hyp_stub_install_secondary) * Eventually, CPU-specific code might be needed -- assume not for now * * This code relies on the "eret" instruction to synchronize the - * various coprocessor accesses. This is done when we switch to SVC - * (see safe_svcmode_maskall). + * various coprocessor accesses. */ @ Now install the hypervisor stub: adr r7, __hyp_stub_vectors @@ -156,7 +155,14 @@ THUMB( orr r7, #(1 << 30) ) @ HSCTLR.TE 1: #endif - bx lr @ The boot CPU mode is left in r4. + bic r7, r4, #MODE_MASK + orr r7, r7, #SVC_MODE +THUMB( orr r7, r7, #PSR_T_BIT ) + msr spsr_cxsf, r7 @ This is SPSR_hyp. + + __MSR_ELR_HYP(14) @ msr elr_hyp, lr + __ERET @ return, switching to SVC mode + @ The boot CPU mode is left in r4. ENDPROC(__hyp_stub_install_secondary) __hyp_stub_do_trap: @@ -194,7 +200,7 @@ ENDPROC(__hyp_get_vectors) @ fall through ENTRY(__hyp_set_vectors) __HVC(0) - mov pc, lr + bx lr ENDPROC(__hyp_set_vectors) #ifndef ZIMAGE diff --git a/trunk/arch/arm/mach-at91/setup.c b/trunk/arch/arm/mach-at91/setup.c index 4b678478cf95..9ee866ce0478 100644 --- a/trunk/arch/arm/mach-at91/setup.c +++ b/trunk/arch/arm/mach-at91/setup.c @@ -105,8 +105,6 @@ static void __init soc_detect(u32 dbgu_base) switch (socid) { case ARCH_ID_AT91RM9200: at91_soc_initdata.type = AT91_SOC_RM9200; - if (at91_soc_initdata.subtype == AT91_SOC_SUBTYPE_NONE) - at91_soc_initdata.subtype = AT91_SOC_RM9200_BGA; at91_boot_soc = at91rm9200_soc; break; diff --git a/trunk/arch/arm/mach-exynos/Kconfig b/trunk/arch/arm/mach-exynos/Kconfig index e103c290bc9e..91d5b6f1d5af 100644 --- a/trunk/arch/arm/mach-exynos/Kconfig +++ b/trunk/arch/arm/mach-exynos/Kconfig @@ -74,8 +74,6 @@ config SOC_EXYNOS5440 depends on ARCH_EXYNOS5 select ARM_ARCH_TIMER select AUTO_ZRELADDR - select PINCTRL - select PINCTRL_EXYNOS5440 help Enable EXYNOS5440 SoC support diff --git a/trunk/arch/arm/mach-exynos/common.c b/trunk/arch/arm/mach-exynos/common.c index 1a89824a5f78..d6d0dc651089 100644 --- a/trunk/arch/arm/mach-exynos/common.c +++ b/trunk/arch/arm/mach-exynos/common.c @@ -424,18 +424,11 @@ static void __init exynos5_init_clocks(int xtal) { printk(KERN_DEBUG "%s: initializing clocks\n", __func__); - /* EXYNOS5440 can support only common clock framework */ - - if (soc_is_exynos5440()) - return; - -#ifdef CONFIG_SOC_EXYNOS5250 s3c24xx_register_baseclocks(xtal); s5p_register_clocks(xtal); exynos5_register_clocks(); exynos5_setup_clocks(); -#endif } #define COMBINER_ENABLE_SET 0x0 diff --git a/trunk/arch/arm/mach-highbank/highbank.c b/trunk/arch/arm/mach-highbank/highbank.c index 981dc1e1da51..dc248167d206 100644 --- a/trunk/arch/arm/mach-highbank/highbank.c +++ b/trunk/arch/arm/mach-highbank/highbank.c @@ -135,7 +135,7 @@ static struct sys_timer highbank_timer = { static void highbank_power_off(void) { - highbank_set_pwr_shutdown(); + hignbank_set_pwr_shutdown(); while (1) cpu_do_idle(); diff --git a/trunk/arch/arm/mach-highbank/hotplug.c b/trunk/arch/arm/mach-highbank/hotplug.c index f30c52843396..7b60faccd551 100644 --- a/trunk/arch/arm/mach-highbank/hotplug.c +++ b/trunk/arch/arm/mach-highbank/hotplug.c @@ -30,7 +30,7 @@ void __ref highbank_cpu_die(unsigned int cpu) { flush_cache_all(); - highbank_set_cpu_jump(cpu, phys_to_virt(0)); + highbank_set_cpu_jump(cpu, secondary_startup); highbank_set_core_pwr(); cpu_do_idle(); diff --git a/trunk/arch/arm/mach-highbank/platsmp.c b/trunk/arch/arm/mach-highbank/platsmp.c index 4ecc864ac8b9..1129957f6c1d 100644 --- a/trunk/arch/arm/mach-highbank/platsmp.c +++ b/trunk/arch/arm/mach-highbank/platsmp.c @@ -32,7 +32,6 @@ static void __cpuinit highbank_secondary_init(unsigned int cpu) static int __cpuinit highbank_boot_secondary(unsigned int cpu, struct task_struct *idle) { - highbank_set_cpu_jump(cpu, secondary_startup); gic_raise_softirq(cpumask_of(cpu), 0); return 0; } @@ -62,8 +61,19 @@ static void __init highbank_smp_init_cpus(void) static void __init highbank_smp_prepare_cpus(unsigned int max_cpus) { + int i; + if (scu_base_addr) scu_enable(scu_base_addr); + + /* + * Write the address of secondary startup into the jump table + * The cores are in wfi and wait until they receive a soft interrupt + * and a non-zero value to jump to. Then the secondary CPU branches + * to this address. + */ + for (i = 1; i < max_cpus; i++) + highbank_set_cpu_jump(i, secondary_startup); } struct smp_operations highbank_smp_ops __initdata = { diff --git a/trunk/arch/arm/mach-highbank/pm.c b/trunk/arch/arm/mach-highbank/pm.c index 04eddb4f4380..74aa135966f0 100644 --- a/trunk/arch/arm/mach-highbank/pm.c +++ b/trunk/arch/arm/mach-highbank/pm.c @@ -14,12 +14,10 @@ * this program. If not, see . */ -#include #include #include #include -#include #include #include @@ -28,31 +26,16 @@ static int highbank_suspend_finish(unsigned long val) { - outer_flush_all(); - outer_disable(); - - highbank_set_pwr_suspend(); - cpu_do_idle(); - - highbank_clear_pwr_request(); return 0; } static int highbank_pm_enter(suspend_state_t state) { - cpu_pm_enter(); - cpu_cluster_pm_enter(); - + hignbank_set_pwr_suspend(); highbank_set_cpu_jump(0, cpu_resume); cpu_suspend(0, highbank_suspend_finish); - cpu_cluster_pm_exit(); - cpu_pm_exit(); - - highbank_smc1(0x102, 0x1); - if (scu_base_addr) - scu_enable(scu_base_addr); return 0; } diff --git a/trunk/arch/arm/mach-highbank/sysregs.h b/trunk/arch/arm/mach-highbank/sysregs.h index 70af9d13fcef..e13e8ea7c6cb 100644 --- a/trunk/arch/arm/mach-highbank/sysregs.h +++ b/trunk/arch/arm/mach-highbank/sysregs.h @@ -44,43 +44,28 @@ static inline void highbank_set_core_pwr(void) writel_relaxed(1, sregs_base + SREG_CPU_PWR_CTRL(cpu)); } -static inline void highbank_clear_core_pwr(void) -{ - int cpu = cpu_logical_map(smp_processor_id()); - if (scu_base_addr) - scu_power_mode(scu_base_addr, SCU_PM_NORMAL); - else - writel_relaxed(0, sregs_base + SREG_CPU_PWR_CTRL(cpu)); -} - -static inline void highbank_set_pwr_suspend(void) +static inline void hignbank_set_pwr_suspend(void) { writel(HB_PWR_SUSPEND, sregs_base + HB_SREG_A9_PWR_REQ); highbank_set_core_pwr(); } -static inline void highbank_set_pwr_shutdown(void) +static inline void hignbank_set_pwr_shutdown(void) { writel(HB_PWR_SHUTDOWN, sregs_base + HB_SREG_A9_PWR_REQ); highbank_set_core_pwr(); } -static inline void highbank_set_pwr_soft_reset(void) +static inline void hignbank_set_pwr_soft_reset(void) { writel(HB_PWR_SOFT_RESET, sregs_base + HB_SREG_A9_PWR_REQ); highbank_set_core_pwr(); } -static inline void highbank_set_pwr_hard_reset(void) +static inline void hignbank_set_pwr_hard_reset(void) { writel(HB_PWR_HARD_RESET, sregs_base + HB_SREG_A9_PWR_REQ); highbank_set_core_pwr(); } -static inline void highbank_clear_pwr_request(void) -{ - writel(~0UL, sregs_base + HB_SREG_A9_PWR_REQ); - highbank_clear_core_pwr(); -} - #endif diff --git a/trunk/arch/arm/mach-highbank/system.c b/trunk/arch/arm/mach-highbank/system.c index 37d8384dcf19..aed96ad9bd4a 100644 --- a/trunk/arch/arm/mach-highbank/system.c +++ b/trunk/arch/arm/mach-highbank/system.c @@ -22,9 +22,9 @@ void highbank_restart(char mode, const char *cmd) { if (mode == 'h') - highbank_set_pwr_hard_reset(); + hignbank_set_pwr_hard_reset(); else - highbank_set_pwr_soft_reset(); + hignbank_set_pwr_soft_reset(); while (1) cpu_do_idle(); diff --git a/trunk/arch/arm/mach-imx/Kconfig b/trunk/arch/arm/mach-imx/Kconfig index 0a2349dc7018..1ad0d76de8c7 100644 --- a/trunk/arch/arm/mach-imx/Kconfig +++ b/trunk/arch/arm/mach-imx/Kconfig @@ -841,6 +841,8 @@ config SOC_IMX6Q select ARCH_HAS_CPUFREQ select ARCH_HAS_OPP select ARM_CPU_SUSPEND if PM + select ARM_ERRATA_743622 + select ARM_ERRATA_751472 select ARM_ERRATA_754322 select ARM_ERRATA_764369 if SMP select ARM_ERRATA_775420 @@ -851,7 +853,6 @@ config SOC_IMX6Q select HAVE_CAN_FLEXCAN if CAN select HAVE_IMX_GPC select HAVE_IMX_MMDC - select HAVE_IMX_SRC select HAVE_SMP select MFD_SYSCON select PINCTRL diff --git a/trunk/arch/arm/mach-imx/clk-imx25.c b/trunk/arch/arm/mach-imx/clk-imx25.c index 2c570cdaae7b..b197aa73dc4b 100644 --- a/trunk/arch/arm/mach-imx/clk-imx25.c +++ b/trunk/arch/arm/mach-imx/clk-imx25.c @@ -254,9 +254,9 @@ int __init mx25_clocks_init(void) clk_register_clkdev(clk[ipg], "ipg", "mxc-ehci.2"); clk_register_clkdev(clk[usbotg_ahb], "ahb", "mxc-ehci.2"); clk_register_clkdev(clk[usb_div], "per", "mxc-ehci.2"); - clk_register_clkdev(clk[ipg], "ipg", "imx-udc-mx27"); - clk_register_clkdev(clk[usbotg_ahb], "ahb", "imx-udc-mx27"); - clk_register_clkdev(clk[usb_div], "per", "imx-udc-mx27"); + clk_register_clkdev(clk[ipg], "ipg", "fsl-usb2-udc"); + clk_register_clkdev(clk[usbotg_ahb], "ahb", "fsl-usb2-udc"); + clk_register_clkdev(clk[usb_div], "per", "fsl-usb2-udc"); clk_register_clkdev(clk[nfc_ipg_per], NULL, "imx25-nand.0"); /* i.mx25 has the i.mx35 type cspi */ clk_register_clkdev(clk[cspi1_ipg], NULL, "imx35-cspi.0"); diff --git a/trunk/arch/arm/mach-imx/clk-imx27.c b/trunk/arch/arm/mach-imx/clk-imx27.c index 1ffe3b534e51..4c1d1e4efc74 100644 --- a/trunk/arch/arm/mach-imx/clk-imx27.c +++ b/trunk/arch/arm/mach-imx/clk-imx27.c @@ -236,9 +236,9 @@ int __init mx27_clocks_init(unsigned long fref) clk_register_clkdev(clk[lcdc_ahb_gate], "ahb", "imx21-fb.0"); clk_register_clkdev(clk[csi_ahb_gate], "ahb", "imx27-camera.0"); clk_register_clkdev(clk[per4_gate], "per", "imx27-camera.0"); - clk_register_clkdev(clk[usb_div], "per", "imx-udc-mx27"); - clk_register_clkdev(clk[usb_ipg_gate], "ipg", "imx-udc-mx27"); - clk_register_clkdev(clk[usb_ahb_gate], "ahb", "imx-udc-mx27"); + clk_register_clkdev(clk[usb_div], "per", "fsl-usb2-udc"); + clk_register_clkdev(clk[usb_ipg_gate], "ipg", "fsl-usb2-udc"); + clk_register_clkdev(clk[usb_ahb_gate], "ahb", "fsl-usb2-udc"); clk_register_clkdev(clk[usb_div], "per", "mxc-ehci.0"); clk_register_clkdev(clk[usb_ipg_gate], "ipg", "mxc-ehci.0"); clk_register_clkdev(clk[usb_ahb_gate], "ahb", "mxc-ehci.0"); diff --git a/trunk/arch/arm/mach-imx/clk-imx31.c b/trunk/arch/arm/mach-imx/clk-imx31.c index 16ccbd41dea9..8be64e0a4ace 100644 --- a/trunk/arch/arm/mach-imx/clk-imx31.c +++ b/trunk/arch/arm/mach-imx/clk-imx31.c @@ -139,9 +139,9 @@ int __init mx31_clocks_init(unsigned long fref) clk_register_clkdev(clk[usb_div_post], "per", "mxc-ehci.2"); clk_register_clkdev(clk[usb_gate], "ahb", "mxc-ehci.2"); clk_register_clkdev(clk[ipg], "ipg", "mxc-ehci.2"); - clk_register_clkdev(clk[usb_div_post], "per", "imx-udc-mx27"); - clk_register_clkdev(clk[usb_gate], "ahb", "imx-udc-mx27"); - clk_register_clkdev(clk[ipg], "ipg", "imx-udc-mx27"); + clk_register_clkdev(clk[usb_div_post], "per", "fsl-usb2-udc"); + clk_register_clkdev(clk[usb_gate], "ahb", "fsl-usb2-udc"); + clk_register_clkdev(clk[ipg], "ipg", "fsl-usb2-udc"); clk_register_clkdev(clk[csi_gate], NULL, "mx3-camera.0"); /* i.mx31 has the i.mx21 type uart */ clk_register_clkdev(clk[uart1_gate], "per", "imx21-uart.0"); diff --git a/trunk/arch/arm/mach-imx/clk-imx35.c b/trunk/arch/arm/mach-imx/clk-imx35.c index f0727e80815d..66f3d65ea275 100644 --- a/trunk/arch/arm/mach-imx/clk-imx35.c +++ b/trunk/arch/arm/mach-imx/clk-imx35.c @@ -251,9 +251,9 @@ int __init mx35_clocks_init() clk_register_clkdev(clk[usb_div], "per", "mxc-ehci.2"); clk_register_clkdev(clk[ipg], "ipg", "mxc-ehci.2"); clk_register_clkdev(clk[usbotg_gate], "ahb", "mxc-ehci.2"); - clk_register_clkdev(clk[usb_div], "per", "imx-udc-mx27"); - clk_register_clkdev(clk[ipg], "ipg", "imx-udc-mx27"); - clk_register_clkdev(clk[usbotg_gate], "ahb", "imx-udc-mx27"); + clk_register_clkdev(clk[usb_div], "per", "fsl-usb2-udc"); + clk_register_clkdev(clk[ipg], "ipg", "fsl-usb2-udc"); + clk_register_clkdev(clk[usbotg_gate], "ahb", "fsl-usb2-udc"); clk_register_clkdev(clk[wdog_gate], NULL, "imx2-wdt.0"); clk_register_clkdev(clk[nfc_div], NULL, "imx25-nand.0"); clk_register_clkdev(clk[csi_gate], NULL, "mx3-camera.0"); diff --git a/trunk/arch/arm/mach-imx/clk-imx51-imx53.c b/trunk/arch/arm/mach-imx/clk-imx51-imx53.c index fb7cb841b64c..579023f59dc1 100644 --- a/trunk/arch/arm/mach-imx/clk-imx51-imx53.c +++ b/trunk/arch/arm/mach-imx/clk-imx51-imx53.c @@ -269,9 +269,9 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil, clk_register_clkdev(clk[usboh3_per_gate], "per", "mxc-ehci.2"); clk_register_clkdev(clk[usboh3_gate], "ipg", "mxc-ehci.2"); clk_register_clkdev(clk[usboh3_gate], "ahb", "mxc-ehci.2"); - clk_register_clkdev(clk[usboh3_per_gate], "per", "imx-udc-mx51"); - clk_register_clkdev(clk[usboh3_gate], "ipg", "imx-udc-mx51"); - clk_register_clkdev(clk[usboh3_gate], "ahb", "imx-udc-mx51"); + clk_register_clkdev(clk[usboh3_per_gate], "per", "fsl-usb2-udc"); + clk_register_clkdev(clk[usboh3_gate], "ipg", "fsl-usb2-udc"); + clk_register_clkdev(clk[usboh3_gate], "ahb", "fsl-usb2-udc"); clk_register_clkdev(clk[nfc_gate], NULL, "imx51-nand"); clk_register_clkdev(clk[ssi1_ipg_gate], NULL, "imx-ssi.0"); clk_register_clkdev(clk[ssi2_ipg_gate], NULL, "imx-ssi.1"); diff --git a/trunk/arch/arm/mach-imx/clk-imx6q.c b/trunk/arch/arm/mach-imx/clk-imx6q.c index c0c4e723b7f5..7f2c10c7413a 100644 --- a/trunk/arch/arm/mach-imx/clk-imx6q.c +++ b/trunk/arch/arm/mach-imx/clk-imx6q.c @@ -436,9 +436,6 @@ int __init mx6q_clocks_init(void) for (i = 0; i < ARRAY_SIZE(clks_init_on); i++) clk_prepare_enable(clk[clks_init_on[i]]); - /* Set initial power mode */ - imx6q_set_lpm(WAIT_CLOCKED); - np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-gpt"); base = of_iomap(np, 0); WARN_ON(!base); diff --git a/trunk/arch/arm/mach-imx/common.h b/trunk/arch/arm/mach-imx/common.h index fa36fb84ab19..7191ab4434e5 100644 --- a/trunk/arch/arm/mach-imx/common.h +++ b/trunk/arch/arm/mach-imx/common.h @@ -142,7 +142,6 @@ extern int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode); extern void imx6q_clock_map_io(void); extern void imx_cpu_die(unsigned int cpu); -extern int imx_cpu_kill(unsigned int cpu); #ifdef CONFIG_PM extern void imx6q_pm_init(void); diff --git a/trunk/arch/arm/mach-imx/devices/devices-common.h b/trunk/arch/arm/mach-imx/devices/devices-common.h index 9bd5777ff0e7..6277baf1b7be 100644 --- a/trunk/arch/arm/mach-imx/devices/devices-common.h +++ b/trunk/arch/arm/mach-imx/devices/devices-common.h @@ -63,7 +63,6 @@ struct platform_device *__init imx_add_flexcan( #include struct imx_fsl_usb2_udc_data { - const char *devid; resource_size_t iobase; resource_size_t irq; }; diff --git a/trunk/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c b/trunk/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c index 3c06bd96e9cc..37e44398197b 100644 --- a/trunk/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c +++ b/trunk/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c @@ -11,36 +11,35 @@ #include "../hardware.h" #include "devices-common.h" -#define imx_fsl_usb2_udc_data_entry_single(soc, _devid) \ +#define imx_fsl_usb2_udc_data_entry_single(soc) \ { \ - .devid = _devid, \ .iobase = soc ## _USB_OTG_BASE_ADDR, \ .irq = soc ## _INT_USB_OTG, \ } #ifdef CONFIG_SOC_IMX25 const struct imx_fsl_usb2_udc_data imx25_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX25, "imx-udc-mx27"); + imx_fsl_usb2_udc_data_entry_single(MX25); #endif /* ifdef CONFIG_SOC_IMX25 */ #ifdef CONFIG_SOC_IMX27 const struct imx_fsl_usb2_udc_data imx27_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX27, "imx-udc-mx27"); + imx_fsl_usb2_udc_data_entry_single(MX27); #endif /* ifdef CONFIG_SOC_IMX27 */ #ifdef CONFIG_SOC_IMX31 const struct imx_fsl_usb2_udc_data imx31_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX31, "imx-udc-mx27"); + imx_fsl_usb2_udc_data_entry_single(MX31); #endif /* ifdef CONFIG_SOC_IMX31 */ #ifdef CONFIG_SOC_IMX35 const struct imx_fsl_usb2_udc_data imx35_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX35, "imx-udc-mx27"); + imx_fsl_usb2_udc_data_entry_single(MX35); #endif /* ifdef CONFIG_SOC_IMX35 */ #ifdef CONFIG_SOC_IMX51 const struct imx_fsl_usb2_udc_data imx51_fsl_usb2_udc_data __initconst = - imx_fsl_usb2_udc_data_entry_single(MX51, "imx-udc-mx51"); + imx_fsl_usb2_udc_data_entry_single(MX51); #endif struct platform_device *__init imx_add_fsl_usb2_udc( @@ -58,7 +57,7 @@ struct platform_device *__init imx_add_fsl_usb2_udc( .flags = IORESOURCE_IRQ, }, }; - return imx_add_platform_device_dmamask(data->devid, -1, + return imx_add_platform_device_dmamask("fsl-usb2-udc", -1, res, ARRAY_SIZE(res), pdata, sizeof(*pdata), DMA_BIT_MASK(32)); } diff --git a/trunk/arch/arm/mach-imx/devices/platform-imx-fb.c b/trunk/arch/arm/mach-imx/devices/platform-imx-fb.c index 25a47c616b2d..10b0ed39f07f 100644 --- a/trunk/arch/arm/mach-imx/devices/platform-imx-fb.c +++ b/trunk/arch/arm/mach-imx/devices/platform-imx-fb.c @@ -54,7 +54,7 @@ struct platform_device *__init imx_add_imx_fb( .flags = IORESOURCE_IRQ, }, }; - return imx_add_platform_device_dmamask(data->devid, 0, + return imx_add_platform_device_dmamask("imx-fb", 0, res, ARRAY_SIZE(res), pdata, sizeof(*pdata), DMA_BIT_MASK(32)); } diff --git a/trunk/arch/arm/mach-imx/hotplug.c b/trunk/arch/arm/mach-imx/hotplug.c index 7bc5fe15dda2..3dec962b0770 100644 --- a/trunk/arch/arm/mach-imx/hotplug.c +++ b/trunk/arch/arm/mach-imx/hotplug.c @@ -46,11 +46,9 @@ static inline void cpu_enter_lowpower(void) void imx_cpu_die(unsigned int cpu) { cpu_enter_lowpower(); - cpu_do_idle(); -} - -int imx_cpu_kill(unsigned int cpu) -{ imx_enable_cpu(cpu, false); - return 1; + + /* spin here until hardware takes it down */ + while (1) + ; } diff --git a/trunk/include/linux/platform_data/imx-iram.h b/trunk/arch/arm/mach-imx/iram.h similarity index 100% rename from trunk/include/linux/platform_data/imx-iram.h rename to trunk/arch/arm/mach-imx/iram.h diff --git a/trunk/arch/arm/mach-imx/iram_alloc.c b/trunk/arch/arm/mach-imx/iram_alloc.c index e05cf407db65..6c80424f678e 100644 --- a/trunk/arch/arm/mach-imx/iram_alloc.c +++ b/trunk/arch/arm/mach-imx/iram_alloc.c @@ -22,7 +22,8 @@ #include #include #include -#include "linux/platform_data/imx-iram.h" + +#include "iram.h" static unsigned long iram_phys_base; static void __iomem *iram_virt_base; diff --git a/trunk/arch/arm/mach-imx/platsmp.c b/trunk/arch/arm/mach-imx/platsmp.c index 66fae885c842..3777b805b76b 100644 --- a/trunk/arch/arm/mach-imx/platsmp.c +++ b/trunk/arch/arm/mach-imx/platsmp.c @@ -92,6 +92,5 @@ struct smp_operations imx_smp_ops __initdata = { .smp_boot_secondary = imx_boot_secondary, #ifdef CONFIG_HOTPLUG_CPU .cpu_die = imx_cpu_die, - .cpu_kill = imx_cpu_kill, #endif }; diff --git a/trunk/arch/arm/mach-imx/pm-imx6q.c b/trunk/arch/arm/mach-imx/pm-imx6q.c index ee42d20cba19..a17543da602d 100644 --- a/trunk/arch/arm/mach-imx/pm-imx6q.c +++ b/trunk/arch/arm/mach-imx/pm-imx6q.c @@ -41,7 +41,6 @@ static int imx6q_pm_enter(suspend_state_t state) cpu_suspend(0, imx6q_suspend_finish); imx_smp_prepare(); imx_gpc_post_resume(); - imx6q_set_lpm(WAIT_CLOCKED); break; default: return -EINVAL; diff --git a/trunk/arch/arm/mach-integrator/pci_v3.c b/trunk/arch/arm/mach-integrator/pci_v3.c index e7fcea7f3300..be50e795536d 100644 --- a/trunk/arch/arm/mach-integrator/pci_v3.c +++ b/trunk/arch/arm/mach-integrator/pci_v3.c @@ -475,12 +475,13 @@ int __init pci_v3_setup(int nr, struct pci_sys_data *sys) { int ret = 0; - if (!ap_syscon_base) - return -EINVAL; - if (nr == 0) { sys->mem_offset = PHYS_PCI_MEM_BASE; ret = pci_v3_setup_resources(sys); + /* Remap the Integrator system controller */ + ap_syscon_base = ioremap(INTEGRATOR_SC_BASE, 0x100); + if (!ap_syscon_base) + return -EINVAL; } return ret; @@ -496,13 +497,6 @@ void __init pci_v3_preinit(void) unsigned int temp; int ret; - /* Remap the Integrator system controller */ - ap_syscon_base = ioremap(INTEGRATOR_SC_BASE, 0x100); - if (!ap_syscon_base) { - pr_err("unable to remap the AP syscon for PCIv3\n"); - return; - } - pcibios_min_mem = 0x00100000; /* diff --git a/trunk/arch/arm/mach-kirkwood/board-dt.c b/trunk/arch/arm/mach-kirkwood/board-dt.c index de4fd2bb1e27..ff4150a2ad05 100644 --- a/trunk/arch/arm/mach-kirkwood/board-dt.c +++ b/trunk/arch/arm/mach-kirkwood/board-dt.c @@ -67,10 +67,6 @@ static void __init kirkwood_legacy_clk_init(void) orion_clkdev_add(NULL, "mv643xx_eth_port.1", of_clk_get_from_provider(&clkspec)); - clkspec.args[0] = CGC_BIT_SDIO; - orion_clkdev_add(NULL, "mvsdio", - of_clk_get_from_provider(&clkspec)); - } static void __init kirkwood_of_clk_init(void) diff --git a/trunk/arch/arm/mach-kirkwood/board-ns2.c b/trunk/arch/arm/mach-kirkwood/board-ns2.c index f4632a809f68..8821720ab5a4 100644 --- a/trunk/arch/arm/mach-kirkwood/board-ns2.c +++ b/trunk/arch/arm/mach-kirkwood/board-ns2.c @@ -18,11 +18,47 @@ #include #include #include "common.h" +#include "mpp.h" static struct mv643xx_eth_platform_data ns2_ge00_data = { .phy_addr = MV643XX_ETH_PHY_ADDR(8), }; +static unsigned int ns2_mpp_config[] __initdata = { + MPP0_SPI_SCn, + MPP1_SPI_MOSI, + MPP2_SPI_SCK, + MPP3_SPI_MISO, + MPP4_NF_IO6, + MPP5_NF_IO7, + MPP6_SYSRST_OUTn, + MPP7_GPO, /* Fan speed (bit 1) */ + MPP8_TW0_SDA, + MPP9_TW0_SCK, + MPP10_UART0_TXD, + MPP11_UART0_RXD, + MPP12_GPO, /* Red led */ + MPP14_GPIO, /* USB fuse */ + MPP16_GPIO, /* SATA 0 power */ + MPP17_GPIO, /* SATA 1 power */ + MPP18_NF_IO0, + MPP19_NF_IO1, + MPP20_SATA1_ACTn, + MPP21_SATA0_ACTn, + MPP22_GPIO, /* Fan speed (bit 0) */ + MPP23_GPIO, /* Fan power */ + MPP24_GPIO, /* USB mode select */ + MPP25_GPIO, /* Fan rotation fail */ + MPP26_GPIO, /* USB device vbus */ + MPP28_GPIO, /* USB enable host vbus */ + MPP29_GPIO, /* Blue led (slow register) */ + MPP30_GPIO, /* Blue led (command register) */ + MPP31_GPIO, /* Board power off */ + MPP32_GPIO, /* Power button (0 = Released, 1 = Pushed) */ + MPP33_GPO, /* Fan speed (bit 2) */ + 0 +}; + #define NS2_GPIO_POWER_OFF 31 static void ns2_power_off(void) @@ -35,6 +71,8 @@ void __init ns2_init(void) /* * Basic setup. Needs to be called early. */ + kirkwood_mpp_conf(ns2_mpp_config); + if (of_machine_is_compatible("lacie,netspace_lite_v2") || of_machine_is_compatible("lacie,netspace_mini_v2")) ns2_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0); diff --git a/trunk/arch/arm/mach-kirkwood/board-usi_topkick.c b/trunk/arch/arm/mach-kirkwood/board-usi_topkick.c index 23d2dd1b1b1e..15e69fcde9f4 100644 --- a/trunk/arch/arm/mach-kirkwood/board-usi_topkick.c +++ b/trunk/arch/arm/mach-kirkwood/board-usi_topkick.c @@ -64,6 +64,8 @@ static unsigned int topkick_mpp_config[] __initdata = { 0 }; +#define TOPKICK_SATA0_PWR_ENABLE 36 + void __init usi_topkick_init(void) { /* @@ -71,6 +73,8 @@ void __init usi_topkick_init(void) */ kirkwood_mpp_conf(topkick_mpp_config); + /* SATA0 power enable */ + gpio_set_value(TOPKICK_SATA0_PWR_ENABLE, 1); kirkwood_ge00_init(&topkick_ge00_data); kirkwood_sdio_init(&topkick_mvsdio_data); diff --git a/trunk/arch/arm/mach-mvebu/Makefile b/trunk/arch/arm/mach-mvebu/Makefile index 99df4df680fd..5dcb369b58aa 100644 --- a/trunk/arch/arm/mach-mvebu/Makefile +++ b/trunk/arch/arm/mach-mvebu/Makefile @@ -1,8 +1,6 @@ ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include \ -I$(srctree)/arch/arm/plat-orion/include -AFLAGS_coherency_ll.o := -Wa,-march=armv7-a - obj-y += system-controller.o obj-$(CONFIG_MACH_ARMADA_370_XP) += armada-370-xp.o irq-armada-370-xp.o addr-map.o coherency.o coherency_ll.o pmsu.o obj-$(CONFIG_SMP) += platsmp.o headsmp.o diff --git a/trunk/arch/arm/mach-nomadik/board-nhk8815.c b/trunk/arch/arm/mach-nomadik/board-nhk8815.c index 9f19069248da..98167a4319f7 100644 --- a/trunk/arch/arm/mach-nomadik/board-nhk8815.c +++ b/trunk/arch/arm/mach-nomadik/board-nhk8815.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/arm/mach-nomadik/include/mach/irqs.h b/trunk/arch/arm/mach-nomadik/include/mach/irqs.h index 215f8cdb4004..b549d0571548 100644 --- a/trunk/arch/arm/mach-nomadik/include/mach/irqs.h +++ b/trunk/arch/arm/mach-nomadik/include/mach/irqs.h @@ -22,49 +22,49 @@ #include -#define IRQ_VIC_START 32 /* first VIC interrupt is 1 */ +#define IRQ_VIC_START 1 /* first VIC interrupt is 1 */ /* * Interrupt numbers generic for all Nomadik Chip cuts */ -#define IRQ_WATCHDOG (IRQ_VIC_START+0) -#define IRQ_SOFTINT (IRQ_VIC_START+1) -#define IRQ_CRYPTO (IRQ_VIC_START+2) -#define IRQ_OWM (IRQ_VIC_START+3) -#define IRQ_MTU0 (IRQ_VIC_START+4) -#define IRQ_MTU1 (IRQ_VIC_START+5) -#define IRQ_GPIO0 (IRQ_VIC_START+6) -#define IRQ_GPIO1 (IRQ_VIC_START+7) -#define IRQ_GPIO2 (IRQ_VIC_START+8) -#define IRQ_GPIO3 (IRQ_VIC_START+9) -#define IRQ_RTC_RTT (IRQ_VIC_START+10) -#define IRQ_SSP (IRQ_VIC_START+11) -#define IRQ_UART0 (IRQ_VIC_START+12) -#define IRQ_DMA1 (IRQ_VIC_START+13) -#define IRQ_CLCD_MDIF (IRQ_VIC_START+14) -#define IRQ_DMA0 (IRQ_VIC_START+15) -#define IRQ_PWRFAIL (IRQ_VIC_START+16) -#define IRQ_UART1 (IRQ_VIC_START+17) -#define IRQ_FIRDA (IRQ_VIC_START+18) -#define IRQ_MSP0 (IRQ_VIC_START+19) -#define IRQ_I2C0 (IRQ_VIC_START+20) -#define IRQ_I2C1 (IRQ_VIC_START+21) -#define IRQ_SDMMC (IRQ_VIC_START+22) -#define IRQ_USBOTG (IRQ_VIC_START+23) -#define IRQ_SVA_IT0 (IRQ_VIC_START+24) -#define IRQ_SVA_IT1 (IRQ_VIC_START+25) -#define IRQ_SAA_IT0 (IRQ_VIC_START+26) -#define IRQ_SAA_IT1 (IRQ_VIC_START+27) -#define IRQ_UART2 (IRQ_VIC_START+28) -#define IRQ_MSP2 (IRQ_VIC_START+29) -#define IRQ_L2CC (IRQ_VIC_START+30) -#define IRQ_HPI (IRQ_VIC_START+31) -#define IRQ_SKE (IRQ_VIC_START+32) -#define IRQ_KP (IRQ_VIC_START+33) -#define IRQ_MEMST (IRQ_VIC_START+34) -#define IRQ_SGA_IT (IRQ_VIC_START+35) -#define IRQ_USBM (IRQ_VIC_START+36) -#define IRQ_MSP1 (IRQ_VIC_START+37) +#define IRQ_WATCHDOG 1 +#define IRQ_SOFTINT 2 +#define IRQ_CRYPTO 3 +#define IRQ_OWM 4 +#define IRQ_MTU0 5 +#define IRQ_MTU1 6 +#define IRQ_GPIO0 7 +#define IRQ_GPIO1 8 +#define IRQ_GPIO2 9 +#define IRQ_GPIO3 10 +#define IRQ_RTC_RTT 11 +#define IRQ_SSP 12 +#define IRQ_UART0 13 +#define IRQ_DMA1 14 +#define IRQ_CLCD_MDIF 15 +#define IRQ_DMA0 16 +#define IRQ_PWRFAIL 17 +#define IRQ_UART1 18 +#define IRQ_FIRDA 19 +#define IRQ_MSP0 20 +#define IRQ_I2C0 21 +#define IRQ_I2C1 22 +#define IRQ_SDMMC 23 +#define IRQ_USBOTG 24 +#define IRQ_SVA_IT0 25 +#define IRQ_SVA_IT1 26 +#define IRQ_SAA_IT0 27 +#define IRQ_SAA_IT1 28 +#define IRQ_UART2 29 +#define IRQ_MSP2 30 +#define IRQ_L2CC 49 +#define IRQ_HPI 50 +#define IRQ_SKE 51 +#define IRQ_KP 52 +#define IRQ_MEMST 55 +#define IRQ_SGA_IT 59 +#define IRQ_USBM 61 +#define IRQ_MSP1 63 #define NOMADIK_GPIO_OFFSET (IRQ_VIC_START+64) diff --git a/trunk/arch/arm/mach-omap1/board-ams-delta.c b/trunk/arch/arm/mach-omap1/board-ams-delta.c index 2e98a3ac7c5e..a8fce3ccc707 100644 --- a/trunk/arch/arm/mach-omap1/board-ams-delta.c +++ b/trunk/arch/arm/mach-omap1/board-ams-delta.c @@ -160,7 +160,7 @@ static struct omap_lcd_config ams_delta_lcd_config __initdata = { .ctrl_name = "internal", }; -static struct omap_usb_config ams_delta_usb_config __initdata = { +static struct omap_usb_config ams_delta_usb_config = { .register_host = 1, .hmc_mode = 16, .pins[0] = 2, diff --git a/trunk/arch/arm/mach-omap1/usb.c b/trunk/arch/arm/mach-omap1/usb.c index 1a1db5971cd9..104fed366b8f 100644 --- a/trunk/arch/arm/mach-omap1/usb.c +++ b/trunk/arch/arm/mach-omap1/usb.c @@ -629,14 +629,8 @@ static void __init omap_1510_usb_init(struct omap_usb_config *config) static inline void omap_1510_usb_init(struct omap_usb_config *config) {} #endif -void __init omap1_usb_init(struct omap_usb_config *_pdata) +void __init omap1_usb_init(struct omap_usb_config *pdata) { - struct omap_usb_config *pdata; - - pdata = kmemdup(_pdata, sizeof(*pdata), GFP_KERNEL); - if (!pdata) - return; - pdata->usb0_init = omap1_usb0_init; pdata->usb1_init = omap1_usb1_init; pdata->usb2_init = omap1_usb2_init; diff --git a/trunk/arch/arm/mach-omap2/board-omap4panda.c b/trunk/arch/arm/mach-omap2/board-omap4panda.c index 769c1feee1c4..5c8e9cee2c2e 100644 --- a/trunk/arch/arm/mach-omap2/board-omap4panda.c +++ b/trunk/arch/arm/mach-omap2/board-omap4panda.c @@ -397,12 +397,6 @@ static struct omap_board_mux board_mux[] __initdata = { OMAP_PULL_ENA), OMAP4_MUX(ABE_MCBSP1_FSX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), - /* UART2 - BT/FM/GPS shared transport */ - OMAP4_MUX(UART2_CTS, OMAP_PIN_INPUT | OMAP_MUX_MODE0), - OMAP4_MUX(UART2_RTS, OMAP_PIN_OUTPUT | OMAP_MUX_MODE0), - OMAP4_MUX(UART2_RX, OMAP_PIN_INPUT | OMAP_MUX_MODE0), - OMAP4_MUX(UART2_TX, OMAP_PIN_OUTPUT | OMAP_MUX_MODE0), - { .reg_offset = OMAP_MUX_TERMINATOR }, }; diff --git a/trunk/arch/arm/mach-omap2/cclock2420_data.c b/trunk/arch/arm/mach-omap2/cclock2420_data.c index ab7e952d2070..7e5febe456d9 100644 --- a/trunk/arch/arm/mach-omap2/cclock2420_data.c +++ b/trunk/arch/arm/mach-omap2/cclock2420_data.c @@ -1935,8 +1935,6 @@ int __init omap2420_clk_init(void) omap2_init_clk_hw_omap_clocks(c->lk.clk); } - omap2xxx_clkt_vps_late_init(); - omap2_clk_disable_autoidle_all(); omap2_clk_enable_init_clocks(enable_init_clks, diff --git a/trunk/arch/arm/mach-omap2/cclock2430_data.c b/trunk/arch/arm/mach-omap2/cclock2430_data.c index eb3dab68d536..eda079b96c6a 100644 --- a/trunk/arch/arm/mach-omap2/cclock2430_data.c +++ b/trunk/arch/arm/mach-omap2/cclock2430_data.c @@ -2050,8 +2050,6 @@ int __init omap2430_clk_init(void) omap2_init_clk_hw_omap_clocks(c->lk.clk); } - omap2xxx_clkt_vps_late_init(); - omap2_clk_disable_autoidle_all(); omap2_clk_enable_init_clocks(enable_init_clks, diff --git a/trunk/arch/arm/mach-omap2/cclock3xxx_data.c b/trunk/arch/arm/mach-omap2/cclock3xxx_data.c index 6ef87580c33f..bdf39481fbd6 100644 --- a/trunk/arch/arm/mach-omap2/cclock3xxx_data.c +++ b/trunk/arch/arm/mach-omap2/cclock3xxx_data.c @@ -1167,8 +1167,6 @@ static const struct clk_ops emu_src_ck_ops = { .recalc_rate = &omap2_clksel_recalc, .get_parent = &omap2_clksel_find_parent_index, .set_parent = &omap2_clksel_set_parent, - .enable = &omap2_clkops_enable_clkdm, - .disable = &omap2_clkops_disable_clkdm, }; static struct clk emu_src_ck; diff --git a/trunk/arch/arm/mach-omap2/cclock44xx_data.c b/trunk/arch/arm/mach-omap2/cclock44xx_data.c index a2cc046b47f4..5789a5e25563 100644 --- a/trunk/arch/arm/mach-omap2/cclock44xx_data.c +++ b/trunk/arch/arm/mach-omap2/cclock44xx_data.c @@ -2026,13 +2026,14 @@ int __init omap4xxx_clk_init(void) * On OMAP4460 the ABE DPLL fails to turn on if in idle low-power * state when turning the ABE clock domain. Workaround this by * locking the ABE DPLL on boot. - * Lock the ABE DPLL in any case to avoid issues with audio. */ - rc = clk_set_parent(&abe_dpll_refclk_mux_ck, &sys_32k_ck); - if (!rc) - rc = clk_set_rate(&dpll_abe_ck, OMAP4_DPLL_ABE_DEFFREQ); - if (rc) - pr_err("%s: failed to configure ABE DPLL!\n", __func__); + if (cpu_is_omap446x()) { + rc = clk_set_parent(&abe_dpll_refclk_mux_ck, &sys_32k_ck); + if (!rc) + rc = clk_set_rate(&dpll_abe_ck, OMAP4_DPLL_ABE_DEFFREQ); + if (rc) + pr_err("%s: failed to configure ABE DPLL!\n", __func__); + } return 0; } diff --git a/trunk/arch/arm/mach-omap2/devices.c b/trunk/arch/arm/mach-omap2/devices.c index 626f3ea3142f..5e304d0719a2 100644 --- a/trunk/arch/arm/mach-omap2/devices.c +++ b/trunk/arch/arm/mach-omap2/devices.c @@ -639,7 +639,7 @@ static int count_ocp2scp_devices(struct omap_ocp2scp_dev *ocp2scp_dev) return cnt; } -static void __init omap_init_ocp2scp(void) +static void omap_init_ocp2scp(void) { struct omap_hwmod *oh; struct platform_device *pdev; diff --git a/trunk/arch/arm/mach-omap2/drm.c b/trunk/arch/arm/mach-omap2/drm.c index 2a2cfa88ddbf..4c7566c7e24a 100644 --- a/trunk/arch/arm/mach-omap2/drm.c +++ b/trunk/arch/arm/mach-omap2/drm.c @@ -25,7 +25,6 @@ #include #include -#include "soc.h" #include "omap_device.h" #include "omap_hwmod.h" @@ -57,7 +56,7 @@ static int __init omap_init_drm(void) oh->name); } - platform_data.omaprev = GET_OMAP_TYPE; + platform_data.omaprev = GET_OMAP_REVISION(); return platform_device_register(&omap_drm_device); diff --git a/trunk/arch/arm/mach-omap2/omap_hwmod_33xx_data.c b/trunk/arch/arm/mach-omap2/omap_hwmod_33xx_data.c index 646c14d9fdb9..081c71edddf4 100644 --- a/trunk/arch/arm/mach-omap2/omap_hwmod_33xx_data.c +++ b/trunk/arch/arm/mach-omap2/omap_hwmod_33xx_data.c @@ -2070,7 +2070,7 @@ static struct omap_hwmod_irq_info am33xx_usbss_mpu_irqs[] = { { .name = "usbss-irq", .irq = 17 + OMAP_INTC_START, }, { .name = "musb0-irq", .irq = 18 + OMAP_INTC_START, }, { .name = "musb1-irq", .irq = 19 + OMAP_INTC_START, }, - { .irq = -1, }, + { .irq = -1 + OMAP_INTC_START, }, }; static struct omap_hwmod am33xx_usbss_hwmod = { @@ -2515,7 +2515,7 @@ static struct omap_hwmod_ocp_if am33xx_l4_hs__cpgmac0 = { .user = OCP_USER_MPU, }; -static struct omap_hwmod_addr_space am33xx_mdio_addr_space[] = { +struct omap_hwmod_addr_space am33xx_mdio_addr_space[] = { { .pa_start = 0x4A101000, .pa_end = 0x4A101000 + SZ_256 - 1, @@ -2523,7 +2523,7 @@ static struct omap_hwmod_addr_space am33xx_mdio_addr_space[] = { { } }; -static struct omap_hwmod_ocp_if am33xx_cpgmac0__mdio = { +struct omap_hwmod_ocp_if am33xx_cpgmac0__mdio = { .master = &am33xx_cpgmac0_hwmod, .slave = &am33xx_mdio_hwmod, .addr = am33xx_mdio_addr_space, diff --git a/trunk/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/trunk/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index 793f54ac7d14..129d5081ed15 100644 --- a/trunk/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/trunk/arch/arm/mach-omap2/omap_hwmod_44xx_data.c @@ -2132,12 +2132,8 @@ static struct omap_hwmod omap44xx_mcpdm_hwmod = { * currently reset very early during boot, before I2C is * available, so it doesn't seem that we have any choice in * the kernel other than to avoid resetting it. - * - * Also, McPDM needs to be configured to NO_IDLE mode when it - * is in used otherwise vital clocks will be gated which - * results 'slow motion' audio playback. */ - .flags = HWMOD_EXT_OPT_MAIN_CLK | HWMOD_SWSUP_SIDLE, + .flags = HWMOD_EXT_OPT_MAIN_CLK, .mpu_irqs = omap44xx_mcpdm_irqs, .sdma_reqs = omap44xx_mcpdm_sdma_reqs, .main_clk = "mcpdm_fck", diff --git a/trunk/arch/arm/mach-omap2/prm2xxx.c b/trunk/arch/arm/mach-omap2/prm2xxx.c index 418de9c3b319..cc0e71430af1 100644 --- a/trunk/arch/arm/mach-omap2/prm2xxx.c +++ b/trunk/arch/arm/mach-omap2/prm2xxx.c @@ -27,14 +27,6 @@ #include "cm2xxx_3xxx.h" #include "prm-regbits-24xx.h" -/* - * OMAP24xx PM_PWSTCTRL_*.POWERSTATE and PM_PWSTST_*.LASTSTATEENTERED bits - - * these are reversed from the bits used on OMAP3+ - */ -#define OMAP24XX_PWRDM_POWER_ON 0x0 -#define OMAP24XX_PWRDM_POWER_RET 0x1 -#define OMAP24XX_PWRDM_POWER_OFF 0x3 - /* * omap2xxx_prm_reset_src_map - map from bits in the PRM_RSTST_WKUP * hardware register (which are specific to the OMAP2xxx SoCs) to @@ -75,34 +67,6 @@ static u32 omap2xxx_prm_read_reset_sources(void) return r; } -/** - * omap2xxx_pwrst_to_common_pwrst - convert OMAP2xxx pwrst to common pwrst - * @omap2xxx_pwrst: OMAP2xxx hardware power state to convert - * - * Return the common power state bits corresponding to the OMAP2xxx - * hardware power state bits @omap2xxx_pwrst, or -EINVAL upon error. - */ -static int omap2xxx_pwrst_to_common_pwrst(u8 omap2xxx_pwrst) -{ - u8 pwrst; - - switch (omap2xxx_pwrst) { - case OMAP24XX_PWRDM_POWER_OFF: - pwrst = PWRDM_POWER_OFF; - break; - case OMAP24XX_PWRDM_POWER_RET: - pwrst = PWRDM_POWER_RET; - break; - case OMAP24XX_PWRDM_POWER_ON: - pwrst = PWRDM_POWER_ON; - break; - default: - return -EINVAL; - } - - return pwrst; -} - /** * omap2xxx_prm_dpll_reset - use DPLL reset to reboot the OMAP SoC * @@ -133,56 +97,10 @@ int omap2xxx_clkdm_wakeup(struct clockdomain *clkdm) return 0; } -static int omap2xxx_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst) -{ - u8 omap24xx_pwrst; - - switch (pwrst) { - case PWRDM_POWER_OFF: - omap24xx_pwrst = OMAP24XX_PWRDM_POWER_OFF; - break; - case PWRDM_POWER_RET: - omap24xx_pwrst = OMAP24XX_PWRDM_POWER_RET; - break; - case PWRDM_POWER_ON: - omap24xx_pwrst = OMAP24XX_PWRDM_POWER_ON; - break; - default: - return -EINVAL; - } - - omap2_prm_rmw_mod_reg_bits(OMAP_POWERSTATE_MASK, - (omap24xx_pwrst << OMAP_POWERSTATE_SHIFT), - pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL); - return 0; -} - -static int omap2xxx_pwrdm_read_next_pwrst(struct powerdomain *pwrdm) -{ - u8 omap2xxx_pwrst; - - omap2xxx_pwrst = omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, - OMAP2_PM_PWSTCTRL, - OMAP_POWERSTATE_MASK); - - return omap2xxx_pwrst_to_common_pwrst(omap2xxx_pwrst); -} - -static int omap2xxx_pwrdm_read_pwrst(struct powerdomain *pwrdm) -{ - u8 omap2xxx_pwrst; - - omap2xxx_pwrst = omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, - OMAP2_PM_PWSTST, - OMAP_POWERSTATEST_MASK); - - return omap2xxx_pwrst_to_common_pwrst(omap2xxx_pwrst); -} - struct pwrdm_ops omap2_pwrdm_operations = { - .pwrdm_set_next_pwrst = omap2xxx_pwrdm_set_next_pwrst, - .pwrdm_read_next_pwrst = omap2xxx_pwrdm_read_next_pwrst, - .pwrdm_read_pwrst = omap2xxx_pwrdm_read_pwrst, + .pwrdm_set_next_pwrst = omap2_pwrdm_set_next_pwrst, + .pwrdm_read_next_pwrst = omap2_pwrdm_read_next_pwrst, + .pwrdm_read_pwrst = omap2_pwrdm_read_pwrst, .pwrdm_set_logic_retst = omap2_pwrdm_set_logic_retst, .pwrdm_set_mem_onst = omap2_pwrdm_set_mem_onst, .pwrdm_set_mem_retst = omap2_pwrdm_set_mem_retst, diff --git a/trunk/arch/arm/mach-omap2/prm2xxx_3xxx.c b/trunk/arch/arm/mach-omap2/prm2xxx_3xxx.c index a3e121f94a86..30517f5af707 100644 --- a/trunk/arch/arm/mach-omap2/prm2xxx_3xxx.c +++ b/trunk/arch/arm/mach-omap2/prm2xxx_3xxx.c @@ -103,6 +103,28 @@ int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift) /* Powerdomain low-level functions */ /* Common functions across OMAP2 and OMAP3 */ +int omap2_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst) +{ + omap2_prm_rmw_mod_reg_bits(OMAP_POWERSTATE_MASK, + (pwrst << OMAP_POWERSTATE_SHIFT), + pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL); + return 0; +} + +int omap2_pwrdm_read_next_pwrst(struct powerdomain *pwrdm) +{ + return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, + OMAP2_PM_PWSTCTRL, + OMAP_POWERSTATE_MASK); +} + +int omap2_pwrdm_read_pwrst(struct powerdomain *pwrdm) +{ + return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, + OMAP2_PM_PWSTST, + OMAP_POWERSTATEST_MASK); +} + int omap2_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank, u8 pwrst) { diff --git a/trunk/arch/arm/mach-omap2/prm3xxx.c b/trunk/arch/arm/mach-omap2/prm3xxx.c index e648bd55b072..39822aabcff3 100644 --- a/trunk/arch/arm/mach-omap2/prm3xxx.c +++ b/trunk/arch/arm/mach-omap2/prm3xxx.c @@ -277,28 +277,6 @@ static u32 omap3xxx_prm_read_reset_sources(void) /* Powerdomain low-level functions */ -static int omap3_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst) -{ - omap2_prm_rmw_mod_reg_bits(OMAP_POWERSTATE_MASK, - (pwrst << OMAP_POWERSTATE_SHIFT), - pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL); - return 0; -} - -static int omap3_pwrdm_read_next_pwrst(struct powerdomain *pwrdm) -{ - return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, - OMAP2_PM_PWSTCTRL, - OMAP_POWERSTATE_MASK); -} - -static int omap3_pwrdm_read_pwrst(struct powerdomain *pwrdm) -{ - return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, - OMAP2_PM_PWSTST, - OMAP_POWERSTATEST_MASK); -} - /* Applicable only for OMAP3. Not supported on OMAP2 */ static int omap3_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm) { @@ -377,9 +355,9 @@ static int omap3_pwrdm_disable_hdwr_sar(struct powerdomain *pwrdm) } struct pwrdm_ops omap3_pwrdm_operations = { - .pwrdm_set_next_pwrst = omap3_pwrdm_set_next_pwrst, - .pwrdm_read_next_pwrst = omap3_pwrdm_read_next_pwrst, - .pwrdm_read_pwrst = omap3_pwrdm_read_pwrst, + .pwrdm_set_next_pwrst = omap2_pwrdm_set_next_pwrst, + .pwrdm_read_next_pwrst = omap2_pwrdm_read_next_pwrst, + .pwrdm_read_pwrst = omap2_pwrdm_read_pwrst, .pwrdm_read_prev_pwrst = omap3_pwrdm_read_prev_pwrst, .pwrdm_set_logic_retst = omap2_pwrdm_set_logic_retst, .pwrdm_read_logic_pwrst = omap3_pwrdm_read_logic_pwrst, diff --git a/trunk/arch/arm/mach-omap2/prm44xx.c b/trunk/arch/arm/mach-omap2/prm44xx.c index c05a343d465d..7498bc77fe8b 100644 --- a/trunk/arch/arm/mach-omap2/prm44xx.c +++ b/trunk/arch/arm/mach-omap2/prm44xx.c @@ -56,9 +56,9 @@ static struct omap_prcm_irq_setup omap4_prcm_irq_setup = { * enumeration) */ static struct prm_reset_src_map omap44xx_prm_reset_src_map[] = { - { OMAP4430_GLOBAL_WARM_SW_RST_SHIFT, + { OMAP4430_RST_GLOBAL_WARM_SW_SHIFT, OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT }, - { OMAP4430_GLOBAL_COLD_RST_SHIFT, + { OMAP4430_RST_GLOBAL_COLD_SW_SHIFT, OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT }, { OMAP4430_MPU_SECURITY_VIOL_RST_SHIFT, OMAP_SECU_VIOL_RST_SRC_ID_SHIFT }, @@ -333,7 +333,7 @@ static u32 omap44xx_prm_read_reset_sources(void) u32 r = 0; u32 v; - v = omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST, + v = omap4_prm_read_inst_reg(OMAP4430_PRM_OCP_SOCKET_INST, OMAP4_RM_RSTST); p = omap44xx_prm_reset_src_map; diff --git a/trunk/arch/arm/mach-omap2/prm44xx.h b/trunk/arch/arm/mach-omap2/prm44xx.h index 8ee1fbdec561..22b0979206ca 100644 --- a/trunk/arch/arm/mach-omap2/prm44xx.h +++ b/trunk/arch/arm/mach-omap2/prm44xx.h @@ -62,8 +62,8 @@ /* OMAP4 specific register offsets */ #define OMAP4_RM_RSTCTRL 0x0000 -#define OMAP4_RM_RSTST 0x0004 -#define OMAP4_RM_RSTTIME 0x0008 +#define OMAP4_RM_RSTTIME 0x0004 +#define OMAP4_RM_RSTST 0x0008 #define OMAP4_PM_PWSTCTRL 0x0000 #define OMAP4_PM_PWSTST 0x0004 diff --git a/trunk/arch/arm/mach-omap2/timer.c b/trunk/arch/arm/mach-omap2/timer.c index b8ad6e632bb8..691aa674665a 100644 --- a/trunk/arch/arm/mach-omap2/timer.c +++ b/trunk/arch/arm/mach-omap2/timer.c @@ -165,11 +165,15 @@ static struct device_node * __init omap_get_timer_dt(struct of_device_id *match, struct device_node *np; for_each_matching_node(np, match) { - if (!of_device_is_available(np)) + if (!of_device_is_available(np)) { + of_node_put(np); continue; + } - if (property && !of_get_property(np, property, NULL)) + if (property && !of_get_property(np, property, NULL)) { + of_node_put(np); continue; + } of_add_property(np, &device_disabled); return np; diff --git a/trunk/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h b/trunk/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h index b6132aa95dc0..a611ad3153c7 100644 --- a/trunk/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h +++ b/trunk/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h @@ -463,9 +463,6 @@ GPIO76_LCD_PCLK, \ GPIO77_LCD_BIAS -/* these enable a work-around for a hw bug in pxa27x during ac97 warm reset */ -#define GPIO113_AC97_nRESET_GPIO_HIGH MFP_CFG_OUT(GPIO113, AF0, DEFAULT) -#define GPIO95_AC97_nRESET_GPIO_HIGH MFP_CFG_OUT(GPIO95, AF0, DEFAULT) extern int keypad_set_wake(unsigned int on); #endif /* __ASM_ARCH_MFP_PXA27X_H */ diff --git a/trunk/arch/arm/mach-pxa/pxa27x.c b/trunk/arch/arm/mach-pxa/pxa27x.c index 616cb87b6179..8047ee0effc5 100644 --- a/trunk/arch/arm/mach-pxa/pxa27x.c +++ b/trunk/arch/arm/mach-pxa/pxa27x.c @@ -47,9 +47,9 @@ void pxa27x_clear_otgph(void) EXPORT_SYMBOL(pxa27x_clear_otgph); static unsigned long ac97_reset_config[] = { - GPIO113_AC97_nRESET_GPIO_HIGH, + GPIO113_GPIO, GPIO113_AC97_nRESET, - GPIO95_AC97_nRESET_GPIO_HIGH, + GPIO95_GPIO, GPIO95_AC97_nRESET, }; diff --git a/trunk/arch/arm/mach-s3c64xx/mach-crag6410-module.c b/trunk/arch/arm/mach-s3c64xx/mach-crag6410-module.c index 755c0bb119f4..553059f51841 100644 --- a/trunk/arch/arm/mach-s3c64xx/mach-crag6410-module.c +++ b/trunk/arch/arm/mach-s3c64xx/mach-crag6410-module.c @@ -47,7 +47,7 @@ static struct spi_board_info wm1253_devs[] = { .bus_num = 0, .chip_select = 0, .mode = SPI_MODE_0, - .irq = S3C_EINT(4), + .irq = S3C_EINT(5), .controller_data = &wm0010_spi_csinfo, .platform_data = &wm0010_pdata, }, diff --git a/trunk/arch/arm/mach-s3c64xx/pm.c b/trunk/arch/arm/mach-s3c64xx/pm.c index d2e1a16690bd..7feb426fc202 100644 --- a/trunk/arch/arm/mach-s3c64xx/pm.c +++ b/trunk/arch/arm/mach-s3c64xx/pm.c @@ -338,10 +338,8 @@ int __init s3c64xx_pm_init(void) for (i = 0; i < ARRAY_SIZE(s3c64xx_pm_domains); i++) pm_genpd_init(&s3c64xx_pm_domains[i]->pd, NULL, false); -#ifdef CONFIG_S3C_DEV_FB if (dev_get_platdata(&s3c_device_fb.dev)) pm_genpd_add_device(&s3c64xx_pm_f.pd, &s3c_device_fb.dev); -#endif return 0; } diff --git a/trunk/arch/arm/mach-versatile/include/mach/irqs.h b/trunk/arch/arm/mach-versatile/include/mach/irqs.h index 0fd771ca617b..bf44c61bd1f6 100644 --- a/trunk/arch/arm/mach-versatile/include/mach/irqs.h +++ b/trunk/arch/arm/mach-versatile/include/mach/irqs.h @@ -25,7 +25,7 @@ * IRQ interrupts definitions are the same as the INT definitions * held within platform.h */ -#define IRQ_VIC_START 32 +#define IRQ_VIC_START 0 #define IRQ_WDOGINT (IRQ_VIC_START + INT_WDOGINT) #define IRQ_SOFTINT (IRQ_VIC_START + INT_SOFTINT) #define IRQ_COMMRx (IRQ_VIC_START + INT_COMMRx) @@ -100,7 +100,7 @@ /* * Secondary interrupt controller */ -#define IRQ_SIC_START 64 +#define IRQ_SIC_START 32 #define IRQ_SIC_MMCI0B (IRQ_SIC_START + SIC_INT_MMCI0B) #define IRQ_SIC_MMCI1B (IRQ_SIC_START + SIC_INT_MMCI1B) #define IRQ_SIC_KMI0 (IRQ_SIC_START + SIC_INT_KMI0) @@ -120,7 +120,7 @@ #define IRQ_SIC_PCI1 (IRQ_SIC_START + SIC_INT_PCI1) #define IRQ_SIC_PCI2 (IRQ_SIC_START + SIC_INT_PCI2) #define IRQ_SIC_PCI3 (IRQ_SIC_START + SIC_INT_PCI3) -#define IRQ_SIC_END 95 +#define IRQ_SIC_END 63 #define IRQ_GPIO0_START (IRQ_SIC_END + 1) #define IRQ_GPIO0_END (IRQ_GPIO0_START + 31) diff --git a/trunk/arch/arm/mach-vexpress/Kconfig b/trunk/arch/arm/mach-vexpress/Kconfig index 52d315b792c8..99e63f5f99d1 100644 --- a/trunk/arch/arm/mach-vexpress/Kconfig +++ b/trunk/arch/arm/mach-vexpress/Kconfig @@ -42,6 +42,7 @@ config ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA bool "Enable A5 and A9 only errata work-arounds" default y select ARM_ERRATA_720789 + select ARM_ERRATA_751472 select PL310_ERRATA_753970 if CACHE_PL310 help Provides common dependencies for Versatile Express platforms diff --git a/trunk/arch/arm/mm/cache-l2x0.c b/trunk/arch/arm/mm/cache-l2x0.c index c2f37390308a..6911b8b2745c 100644 --- a/trunk/arch/arm/mm/cache-l2x0.c +++ b/trunk/arch/arm/mm/cache-l2x0.c @@ -352,8 +352,7 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask) /* Unmapped register. */ sync_reg_offset = L2X0_DUMMY_REG; #endif - if ((cache_id & L2X0_CACHE_ID_RTL_MASK) <= L2X0_CACHE_ID_RTL_R3P0) - outer_cache.set_debug = pl310_set_debug; + outer_cache.set_debug = pl310_set_debug; break; case L2X0_CACHE_ID_PART_L210: ways = (aux >> 13) & 0xf; @@ -460,8 +459,8 @@ static void aurora_pa_range(unsigned long start, unsigned long end, unsigned long flags; raw_spin_lock_irqsave(&l2x0_lock, flags); - writel_relaxed(start, l2x0_base + AURORA_RANGE_BASE_ADDR_REG); - writel_relaxed(end, l2x0_base + offset); + writel(start, l2x0_base + AURORA_RANGE_BASE_ADDR_REG); + writel(end, l2x0_base + offset); raw_spin_unlock_irqrestore(&l2x0_lock, flags); cache_sync(); @@ -506,21 +505,15 @@ static void aurora_clean_range(unsigned long start, unsigned long end) static void aurora_flush_range(unsigned long start, unsigned long end) { - start &= ~(CACHE_LINE_SIZE - 1); - end = ALIGN(end, CACHE_LINE_SIZE); - while (start != end) { - unsigned long range_end = calc_range_end(start, end); - /* - * If L2 is forced to WT, the L2 will always be clean and we - * just need to invalidate. - */ - if (l2_wt_override) - aurora_pa_range(start, range_end - CACHE_LINE_SIZE, - AURORA_INVAL_RANGE_REG); - else + if (!l2_wt_override) { + start &= ~(CACHE_LINE_SIZE - 1); + end = ALIGN(end, CACHE_LINE_SIZE); + while (start != end) { + unsigned long range_end = calc_range_end(start, end); aurora_pa_range(start, range_end - CACHE_LINE_SIZE, - AURORA_FLUSH_RANGE_REG); - start = range_end; + AURORA_FLUSH_RANGE_REG); + start = range_end; + } } } @@ -675,9 +668,8 @@ static void pl310_resume(void) static void aurora_resume(void) { if (!(readl(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN)) { - writel_relaxed(l2x0_saved_regs.aux_ctrl, - l2x0_base + L2X0_AUX_CTRL); - writel_relaxed(l2x0_saved_regs.ctrl, l2x0_base + L2X0_CTRL); + writel(l2x0_saved_regs.aux_ctrl, l2x0_base + L2X0_AUX_CTRL); + writel(l2x0_saved_regs.ctrl, l2x0_base + L2X0_CTRL); } } diff --git a/trunk/arch/arm/mm/dma-mapping.c b/trunk/arch/arm/mm/dma-mapping.c index 076c26d43864..6b2fb87c8698 100644 --- a/trunk/arch/arm/mm/dma-mapping.c +++ b/trunk/arch/arm/mm/dma-mapping.c @@ -774,27 +774,25 @@ static void dma_cache_maint_page(struct page *page, unsigned long offset, size_t size, enum dma_data_direction dir, void (*op)(const void *, size_t, int)) { - unsigned long pfn; - size_t left = size; - - pfn = page_to_pfn(page) + offset / PAGE_SIZE; - offset %= PAGE_SIZE; - /* * A single sg entry may refer to multiple physically contiguous * pages. But we still need to process highmem pages individually. * If highmem is not configured then the bulk of this loop gets * optimized out. */ + size_t left = size; do { size_t len = left; void *vaddr; - page = pfn_to_page(pfn); - if (PageHighMem(page)) { - if (len + offset > PAGE_SIZE) + if (len + offset > PAGE_SIZE) { + if (offset >= PAGE_SIZE) { + page += offset / PAGE_SIZE; + offset %= PAGE_SIZE; + } len = PAGE_SIZE - offset; + } vaddr = kmap_high_get(page); if (vaddr) { vaddr += offset; @@ -811,7 +809,7 @@ static void dma_cache_maint_page(struct page *page, unsigned long offset, op(vaddr, len, dir); } offset = 0; - pfn++; + page++; left -= len; } while (left); } diff --git a/trunk/arch/arm/mm/mmu.c b/trunk/arch/arm/mm/mmu.c index ce328c7f5c94..9f0610243bd6 100644 --- a/trunk/arch/arm/mm/mmu.c +++ b/trunk/arch/arm/mm/mmu.c @@ -283,7 +283,7 @@ static struct mem_type mem_types[] = { }, [MT_MEMORY_SO] = { .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY | - L_PTE_MT_UNCACHED | L_PTE_XN, + L_PTE_MT_UNCACHED, .prot_l1 = PMD_TYPE_TABLE, .prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_SECT_S | PMD_SECT_UNCACHED | PMD_SECT_XN, diff --git a/trunk/arch/arm/mm/proc-v7.S b/trunk/arch/arm/mm/proc-v7.S index 3a3c015f8d5c..350f6a74992b 100644 --- a/trunk/arch/arm/mm/proc-v7.S +++ b/trunk/arch/arm/mm/proc-v7.S @@ -169,7 +169,6 @@ __v7_ca15mp_setup: orreq r0, r0, r10 @ Enable CPU-specific SMP bits mcreq p15, 0, r0, c1, c0, 1 #endif - b __v7_setup __v7_pj4b_setup: #ifdef CONFIG_CPU_PJ4B @@ -246,8 +245,7 @@ __v7_setup: ldr r10, =0x00000c08 @ Cortex-A8 primary part number teq r0, r10 bne 2f -#if defined(CONFIG_ARM_ERRATA_430973) && !defined(CONFIG_ARCH_MULTIPLATFORM) - +#ifdef CONFIG_ARM_ERRATA_430973 teq r5, #0x00100000 @ only present in r1p* mrceq p15, 0, r10, c1, c0, 1 @ read aux control register orreq r10, r10, #(1 << 6) @ set IBE to 1 diff --git a/trunk/arch/arm/plat-omap/counter_32k.c b/trunk/arch/arm/plat-omap/counter_32k.c index 5b0b86bb34bb..f3771cdb9838 100644 --- a/trunk/arch/arm/plat-omap/counter_32k.c +++ b/trunk/arch/arm/plat-omap/counter_32k.c @@ -22,8 +22,6 @@ #include #include -#include - /* OMAP2_32KSYNCNT_CR_OFF: offset of 32ksync counter register */ #define OMAP2_32KSYNCNT_REV_OFF 0x0 #define OMAP2_32KSYNCNT_REV_SCHEME (0x3 << 30) diff --git a/trunk/arch/arm/plat-omap/sram.c b/trunk/arch/arm/plat-omap/sram.c index a5bc92d7e476..743fc2836f7a 100644 --- a/trunk/arch/arm/plat-omap/sram.c +++ b/trunk/arch/arm/plat-omap/sram.c @@ -26,8 +26,6 @@ #include -#include - #define ROUND_DOWN(value,boundary) ((value) & (~((boundary)-1))) static void __iomem *omap_sram_base; diff --git a/trunk/arch/arm/plat-samsung/include/plat/cpu.h b/trunk/arch/arm/plat-samsung/include/plat/cpu.h index b69e11dc679d..e0072ce8d6e9 100644 --- a/trunk/arch/arm/plat-samsung/include/plat/cpu.h +++ b/trunk/arch/arm/plat-samsung/include/plat/cpu.h @@ -43,7 +43,7 @@ extern unsigned long samsung_cpu_id; #define EXYNOS4_CPU_MASK 0xFFFE0000 #define EXYNOS5250_SOC_ID 0x43520000 -#define EXYNOS5440_SOC_ID 0xE5440000 +#define EXYNOS5440_SOC_ID 0x54400000 #define EXYNOS5_SOC_MASK 0xFFFFF000 #define IS_SAMSUNG_CPU(name, id, mask) \ diff --git a/trunk/arch/arm/plat-versatile/headsmp.S b/trunk/arch/arm/plat-versatile/headsmp.S index b178d44e9eaa..dd703ef09b8d 100644 --- a/trunk/arch/arm/plat-versatile/headsmp.S +++ b/trunk/arch/arm/plat-versatile/headsmp.S @@ -20,7 +20,7 @@ */ ENTRY(versatile_secondary_startup) mrc p15, 0, r0, c0, c0, 5 - bic r0, #0xff000000 + and r0, r0, #15 adr r4, 1f ldmia r4, {r5, r6} sub r4, r4, r5 diff --git a/trunk/arch/arm/vfp/entry.S b/trunk/arch/arm/vfp/entry.S index 323ce1a62bbf..cc926c985981 100644 --- a/trunk/arch/arm/vfp/entry.S +++ b/trunk/arch/arm/vfp/entry.S @@ -22,7 +22,7 @@ @ IRQs disabled. @ ENTRY(do_vfp) -#ifdef CONFIG_PREEMPT_COUNT +#ifdef CONFIG_PREEMPT ldr r4, [r10, #TI_PREEMPT] @ get preempt count add r11, r4, #1 @ increment it str r11, [r10, #TI_PREEMPT] @@ -35,7 +35,7 @@ ENTRY(do_vfp) ENDPROC(do_vfp) ENTRY(vfp_null_entry) -#ifdef CONFIG_PREEMPT_COUNT +#ifdef CONFIG_PREEMPT get_thread_info r10 ldr r4, [r10, #TI_PREEMPT] @ get preempt count sub r11, r4, #1 @ decrement it @@ -53,7 +53,7 @@ ENDPROC(vfp_null_entry) __INIT ENTRY(vfp_testing_entry) -#ifdef CONFIG_PREEMPT_COUNT +#ifdef CONFIG_PREEMPT get_thread_info r10 ldr r4, [r10, #TI_PREEMPT] @ get preempt count sub r11, r4, #1 @ decrement it diff --git a/trunk/arch/arm/vfp/vfphw.S b/trunk/arch/arm/vfp/vfphw.S index dd5e56f95f3f..ea0349f63586 100644 --- a/trunk/arch/arm/vfp/vfphw.S +++ b/trunk/arch/arm/vfp/vfphw.S @@ -168,7 +168,7 @@ vfp_hw_state_valid: @ else it's one 32-bit instruction, so @ always subtract 4 from the following @ instruction address. -#ifdef CONFIG_PREEMPT_COUNT +#ifdef CONFIG_PREEMPT get_thread_info r10 ldr r4, [r10, #TI_PREEMPT] @ get preempt count sub r11, r4, #1 @ decrement it @@ -192,7 +192,7 @@ look_for_VFP_exceptions: @ not recognised by VFP DBGSTR "not VFP" -#ifdef CONFIG_PREEMPT_COUNT +#ifdef CONFIG_PREEMPT get_thread_info r10 ldr r4, [r10, #TI_PREEMPT] @ get preempt count sub r11, r4, #1 @ decrement it diff --git a/trunk/arch/arm64/boot/dts/Makefile b/trunk/arch/arm64/boot/dts/Makefile index 32ac0aef0068..801e2d7fcbc6 100644 --- a/trunk/arch/arm64/boot/dts/Makefile +++ b/trunk/arch/arm64/boot/dts/Makefile @@ -1,5 +1,4 @@ targets += dtbs -targets += $(dtb-y) dtbs: $(addprefix $(obj)/, $(dtb-y)) diff --git a/trunk/arch/arm64/include/asm/elf.h b/trunk/arch/arm64/include/asm/elf.h index fe32c0e4ac01..07fea290d7c1 100644 --- a/trunk/arch/arm64/include/asm/elf.h +++ b/trunk/arch/arm64/include/asm/elf.h @@ -26,10 +26,7 @@ typedef unsigned long elf_greg_t; -#define ELF_NGREG (sizeof(struct user_pt_regs) / sizeof(elf_greg_t)) -#define ELF_CORE_COPY_REGS(dest, regs) \ - *(struct user_pt_regs *)&(dest) = (regs)->user_regs; - +#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) typedef elf_greg_t elf_gregset_t[ELF_NGREG]; typedef struct user_fpsimd_state elf_fpregset_t; diff --git a/trunk/arch/arm64/include/asm/pgtable.h b/trunk/arch/arm64/include/asm/pgtable.h index e333a243bfcc..64b133949502 100644 --- a/trunk/arch/arm64/include/asm/pgtable.h +++ b/trunk/arch/arm64/include/asm/pgtable.h @@ -24,8 +24,7 @@ /* * Software defined PTE bits definition. */ -#define PTE_VALID (_AT(pteval_t, 1) << 0) -#define PTE_PROT_NONE (_AT(pteval_t, 1) << 1) /* only when !PTE_VALID */ +#define PTE_VALID (_AT(pteval_t, 1) << 0) /* pte_present() check */ #define PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !pte_present() */ #define PTE_DIRTY (_AT(pteval_t, 1) << 55) #define PTE_SPECIAL (_AT(pteval_t, 1) << 56) @@ -61,12 +60,9 @@ extern void __pgd_error(const char *file, int line, unsigned long val); extern pgprot_t pgprot_default; -#define __pgprot_modify(prot,mask,bits) \ - __pgprot((pgprot_val(prot) & ~(mask)) | (bits)) - -#define _MOD_PROT(p, b) __pgprot_modify(p, 0, b) +#define _MOD_PROT(p, b) __pgprot(pgprot_val(p) | (b)) -#define PAGE_NONE __pgprot_modify(pgprot_default, PTE_TYPE_MASK, PTE_PROT_NONE) +#define PAGE_NONE _MOD_PROT(pgprot_default, PTE_NG | PTE_PXN | PTE_UXN | PTE_RDONLY) #define PAGE_SHARED _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN | PTE_UXN) #define PAGE_SHARED_EXEC _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN) #define PAGE_COPY _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_RDONLY) @@ -76,7 +72,7 @@ extern pgprot_t pgprot_default; #define PAGE_KERNEL _MOD_PROT(pgprot_default, PTE_PXN | PTE_UXN | PTE_DIRTY) #define PAGE_KERNEL_EXEC _MOD_PROT(pgprot_default, PTE_UXN | PTE_DIRTY) -#define __PAGE_NONE __pgprot(((_PAGE_DEFAULT) & ~PTE_TYPE_MASK) | PTE_PROT_NONE) +#define __PAGE_NONE __pgprot(_PAGE_DEFAULT | PTE_NG | PTE_PXN | PTE_UXN | PTE_RDONLY) #define __PAGE_SHARED __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN) #define __PAGE_SHARED_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN) #define __PAGE_COPY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_RDONLY) @@ -129,15 +125,16 @@ extern struct page *empty_zero_page; /* * The following only work if pte_present(). Undefined behaviour otherwise. */ -#define pte_present(pte) (pte_val(pte) & (PTE_VALID | PTE_PROT_NONE)) +#define pte_present(pte) (pte_val(pte) & PTE_VALID) #define pte_dirty(pte) (pte_val(pte) & PTE_DIRTY) #define pte_young(pte) (pte_val(pte) & PTE_AF) #define pte_special(pte) (pte_val(pte) & PTE_SPECIAL) #define pte_write(pte) (!(pte_val(pte) & PTE_RDONLY)) #define pte_exec(pte) (!(pte_val(pte) & PTE_UXN)) -#define pte_valid_user(pte) \ - ((pte_val(pte) & (PTE_VALID | PTE_USER)) == (PTE_VALID | PTE_USER)) +#define pte_present_exec_user(pte) \ + ((pte_val(pte) & (PTE_VALID | PTE_USER | PTE_UXN)) == \ + (PTE_VALID | PTE_USER)) #define PTE_BIT_FUNC(fn,op) \ static inline pte_t pte_##fn(pte_t pte) { pte_val(pte) op; return pte; } @@ -160,13 +157,10 @@ extern void __sync_icache_dcache(pte_t pteval, unsigned long addr); static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte) { - if (pte_valid_user(pte)) { - if (pte_exec(pte)) - __sync_icache_dcache(pte, addr); - if (!pte_dirty(pte)) - pte = pte_wrprotect(pte); - } - + if (pte_present_exec_user(pte)) + __sync_icache_dcache(pte, addr); + if (!pte_dirty(pte)) + pte = pte_wrprotect(pte); set_pte(ptep, pte); } @@ -176,6 +170,9 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, #define pte_huge(pte) ((pte_val(pte) & PTE_TYPE_MASK) == PTE_TYPE_HUGEPAGE) #define pte_mkhuge(pte) (__pte((pte_val(pte) & ~PTE_TYPE_MASK) | PTE_TYPE_HUGEPAGE)) +#define __pgprot_modify(prot,mask,bits) \ + __pgprot((pgprot_val(prot) & ~(mask)) | (bits)) + #define __HAVE_ARCH_PTE_SPECIAL /* @@ -267,8 +264,7 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr) static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) { - const pteval_t mask = PTE_USER | PTE_PXN | PTE_UXN | PTE_RDONLY | - PTE_PROT_NONE | PTE_VALID; + const pteval_t mask = PTE_USER | PTE_PXN | PTE_UXN | PTE_RDONLY; pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask); return pte; } diff --git a/trunk/arch/arm64/include/asm/unistd32.h b/trunk/arch/arm64/include/asm/unistd32.h index 5ef47ba3ed45..58432625fdb3 100644 --- a/trunk/arch/arm64/include/asm/unistd32.h +++ b/trunk/arch/arm64/include/asm/unistd32.h @@ -395,13 +395,8 @@ __SYSCALL(370, sys_name_to_handle_at) __SYSCALL(371, compat_sys_open_by_handle_at) __SYSCALL(372, compat_sys_clock_adjtime) __SYSCALL(373, sys_syncfs) -__SYSCALL(374, compat_sys_sendmmsg) -__SYSCALL(375, sys_setns) -__SYSCALL(376, compat_sys_process_vm_readv) -__SYSCALL(377, compat_sys_process_vm_writev) -__SYSCALL(378, sys_ni_syscall) /* 378 for kcmp */ -#define __NR_compat_syscalls 379 +#define __NR_compat_syscalls 374 /* * Compat syscall numbers used by the AArch64 kernel. diff --git a/trunk/arch/arm64/kernel/vdso.c b/trunk/arch/arm64/kernel/vdso.c index 6a389dc1bd49..c958cb84d75f 100644 --- a/trunk/arch/arm64/kernel/vdso.c +++ b/trunk/arch/arm64/kernel/vdso.c @@ -252,6 +252,10 @@ void update_vsyscall(struct timekeeper *tk) void update_vsyscall_tz(void) { + ++vdso_data->tb_seq_count; + smp_wmb(); vdso_data->tz_minuteswest = sys_tz.tz_minuteswest; vdso_data->tz_dsttime = sys_tz.tz_dsttime; + smp_wmb(); + ++vdso_data->tb_seq_count; } diff --git a/trunk/arch/arm64/kernel/vdso/gettimeofday.S b/trunk/arch/arm64/kernel/vdso/gettimeofday.S index f0a6d10b5211..8bf658d974f9 100644 --- a/trunk/arch/arm64/kernel/vdso/gettimeofday.S +++ b/trunk/arch/arm64/kernel/vdso/gettimeofday.S @@ -73,6 +73,8 @@ ENTRY(__kernel_gettimeofday) /* If tz is NULL, return 0. */ cbz x1, 3f ldp w4, w5, [vdso_data, #VDSO_TZ_MINWEST] + seqcnt_read w9 + seqcnt_check w9, 1b stp w4, w5, [x1, #TZ_MINWEST] 3: mov x0, xzr diff --git a/trunk/arch/ia64/kernel/ptrace.c b/trunk/arch/ia64/kernel/ptrace.c index b7a5fffe0924..4265ff64219b 100644 --- a/trunk/arch/ia64/kernel/ptrace.c +++ b/trunk/arch/ia64/kernel/ptrace.c @@ -672,6 +672,33 @@ ptrace_attach_sync_user_rbs (struct task_struct *child) read_unlock(&tasklist_lock); } +static inline int +thread_matches (struct task_struct *thread, unsigned long addr) +{ + unsigned long thread_rbs_end; + struct pt_regs *thread_regs; + + if (ptrace_check_attach(thread, 0) < 0) + /* + * If the thread is not in an attachable state, we'll + * ignore it. The net effect is that if ADDR happens + * to overlap with the portion of the thread's + * register backing store that is currently residing + * on the thread's kernel stack, then ptrace() may end + * up accessing a stale value. But if the thread + * isn't stopped, that's a problem anyhow, so we're + * doing as well as we can... + */ + return 0; + + thread_regs = task_pt_regs(thread); + thread_rbs_end = ia64_get_user_rbs_end(thread, thread_regs, NULL); + if (!on_kernel_rbs(addr, thread_regs->ar_bspstore, thread_rbs_end)) + return 0; + + return 1; /* looks like we've got a winner */ +} + /* * Write f32-f127 back to task->thread.fph if it has been modified. */ diff --git a/trunk/arch/m68k/include/asm/dma-mapping.h b/trunk/arch/m68k/include/asm/dma-mapping.h index 3e6b8445af6a..17f7a45948ea 100644 --- a/trunk/arch/m68k/include/asm/dma-mapping.h +++ b/trunk/arch/m68k/include/asm/dma-mapping.h @@ -21,22 +21,6 @@ extern void *dma_alloc_coherent(struct device *, size_t, extern void dma_free_coherent(struct device *, size_t, void *, dma_addr_t); -static inline void *dma_alloc_attrs(struct device *dev, size_t size, - dma_addr_t *dma_handle, gfp_t flag, - struct dma_attrs *attrs) -{ - /* attrs is not supported and ignored */ - return dma_alloc_coherent(dev, size, dma_handle, flag); -} - -static inline void dma_free_attrs(struct device *dev, size_t size, - void *cpu_addr, dma_addr_t dma_handle, - struct dma_attrs *attrs) -{ - /* attrs is not supported and ignored */ - dma_free_coherent(dev, size, cpu_addr, dma_handle); -} - static inline void *dma_alloc_noncoherent(struct device *dev, size_t size, dma_addr_t *handle, gfp_t flag) { diff --git a/trunk/arch/m68k/include/asm/pgtable_no.h b/trunk/arch/m68k/include/asm/pgtable_no.h index 037028f4ab70..bf86b29fe64a 100644 --- a/trunk/arch/m68k/include/asm/pgtable_no.h +++ b/trunk/arch/m68k/include/asm/pgtable_no.h @@ -64,8 +64,6 @@ extern unsigned int kobjsize(const void *objp); */ #define VMALLOC_START 0 #define VMALLOC_END 0xffffffff -#define KMAP_START 0 -#define KMAP_END 0xffffffff #include diff --git a/trunk/arch/m68k/include/asm/unistd.h b/trunk/arch/m68k/include/asm/unistd.h index f9337f614660..847994ce6804 100644 --- a/trunk/arch/m68k/include/asm/unistd.h +++ b/trunk/arch/m68k/include/asm/unistd.h @@ -4,7 +4,7 @@ #include -#define NR_syscalls 349 +#define NR_syscalls 348 #define __ARCH_WANT_OLD_READDIR #define __ARCH_WANT_OLD_STAT diff --git a/trunk/arch/m68k/include/uapi/asm/unistd.h b/trunk/arch/m68k/include/uapi/asm/unistd.h index 625f321001dc..b94bfbf90705 100644 --- a/trunk/arch/m68k/include/uapi/asm/unistd.h +++ b/trunk/arch/m68k/include/uapi/asm/unistd.h @@ -353,6 +353,5 @@ #define __NR_process_vm_readv 345 #define __NR_process_vm_writev 346 #define __NR_kcmp 347 -#define __NR_finit_module 348 #endif /* _UAPI_ASM_M68K_UNISTD_H_ */ diff --git a/trunk/arch/m68k/kernel/syscalltable.S b/trunk/arch/m68k/kernel/syscalltable.S index 3f04ea0ab802..c30da5b3f2db 100644 --- a/trunk/arch/m68k/kernel/syscalltable.S +++ b/trunk/arch/m68k/kernel/syscalltable.S @@ -368,5 +368,4 @@ ENTRY(sys_call_table) .long sys_process_vm_readv /* 345 */ .long sys_process_vm_writev .long sys_kcmp - .long sys_finit_module diff --git a/trunk/arch/m68k/mm/init.c b/trunk/arch/m68k/mm/init.c index afd8106fd83b..f0e05bce92f2 100644 --- a/trunk/arch/m68k/mm/init.c +++ b/trunk/arch/m68k/mm/init.c @@ -39,11 +39,6 @@ void *empty_zero_page; EXPORT_SYMBOL(empty_zero_page); -#if !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE) -extern void init_pointer_table(unsigned long ptable); -extern pmd_t *zero_pgtable; -#endif - #ifdef CONFIG_MMU pg_data_t pg_data_map[MAX_NUMNODES]; @@ -74,6 +69,9 @@ void __init m68k_setup_node(int node) node_set_online(node); } +extern void init_pointer_table(unsigned long ptable); +extern pmd_t *zero_pgtable; + #else /* CONFIG_MMU */ /* diff --git a/trunk/arch/microblaze/configs/mmu_defconfig b/trunk/arch/microblaze/configs/mmu_defconfig index d2b097a652d9..b3f5eecff2a7 100644 --- a/trunk/arch/microblaze/configs/mmu_defconfig +++ b/trunk/arch/microblaze/configs/mmu_defconfig @@ -1,22 +1,25 @@ CONFIG_EXPERIMENTAL=y CONFIG_SYSVIPC=y -CONFIG_POSIX_MQUEUE=y -CONFIG_FHANDLE=y -CONFIG_AUDIT=y -CONFIG_AUDIT_LOGINUID_IMMUTABLE=y CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y -CONFIG_SYSFS_DEPRECATED=y CONFIG_SYSFS_DEPRECATED_V2=y +CONFIG_BLK_DEV_INITRD=y +CONFIG_INITRAMFS_SOURCE="rootfs.cpio" +CONFIG_INITRAMFS_COMPRESSION_GZIP=y +# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set +CONFIG_EXPERT=y CONFIG_KALLSYMS_ALL=y +CONFIG_KALLSYMS_EXTRA_PASS=y +# CONFIG_HOTPLUG is not set # CONFIG_BASE_FULL is not set -CONFIG_EMBEDDED=y +# CONFIG_FUTEX is not set +# CONFIG_EPOLL is not set +# CONFIG_SIGNALFD is not set +# CONFIG_SHMEM is not set CONFIG_SLAB=y CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y # CONFIG_BLK_DEV_BSG is not set -CONFIG_PARTITION_ADVANCED=y -# CONFIG_EFI_PARTITION is not set CONFIG_OPT_LIB_ASM=y CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR=1 CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR=1 @@ -28,62 +31,39 @@ CONFIG_HZ_100=y CONFIG_MMU=y CONFIG_CMDLINE_BOOL=y CONFIG_CMDLINE_FORCE=y -CONFIG_HIGHMEM=y -CONFIG_PCI=y -CONFIG_PCI_XILINX=y CONFIG_NET=y CONFIG_PACKET=y CONFIG_UNIX=y CONFIG_INET=y # CONFIG_INET_LRO is not set # CONFIG_IPV6 is not set -CONFIG_MTD=y CONFIG_PROC_DEVICETREE=y CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_SIZE=8192 CONFIG_NETDEVICES=y +CONFIG_NET_ETHERNET=y CONFIG_XILINX_EMACLITE=y -CONFIG_XILINX_LL_TEMAC=y # CONFIG_INPUT is not set # CONFIG_SERIO is not set # CONFIG_VT is not set -CONFIG_SERIAL_8250=y -CONFIG_SERIAL_8250_CONSOLE=y CONFIG_SERIAL_UARTLITE=y CONFIG_SERIAL_UARTLITE_CONSOLE=y # CONFIG_HW_RANDOM is not set -CONFIG_XILINX_HWICAP=y -CONFIG_I2C=y -CONFIG_I2C_XILINX=y -CONFIG_SPI=y -CONFIG_SPI_XILINX=y -CONFIG_GPIOLIB=y -CONFIG_GPIO_SYSFS=y -CONFIG_GPIO_XILINX=y # CONFIG_HWMON is not set -CONFIG_WATCHDOG=y -CONFIG_XILINX_WATCHDOG=y -CONFIG_FB=y -CONFIG_FB_XILINX=y # CONFIG_USB_SUPPORT is not set -CONFIG_UIO=y -CONFIG_UIO_PDRV=y -CONFIG_UIO_PDRV_GENIRQ=y -CONFIG_UIO_DMEM_GENIRQ=y CONFIG_EXT2_FS=y # CONFIG_DNOTIFY is not set -CONFIG_CRAMFS=y -CONFIG_ROMFS_FS=y CONFIG_NFS_FS=y +CONFIG_NFS_V3=y CONFIG_CIFS=y CONFIG_CIFS_STATS=y CONFIG_CIFS_STATS2=y +CONFIG_PARTITION_ADVANCED=y +CONFIG_DEBUG_KERNEL=y CONFIG_DETECT_HUNG_TASK=y CONFIG_DEBUG_SLAB=y CONFIG_DEBUG_SPINLOCK=y CONFIG_DEBUG_INFO=y +# CONFIG_RCU_CPU_STALL_DETECTOR is not set CONFIG_EARLY_PRINTK=y -CONFIG_KEYS=y -CONFIG_ENCRYPTED_KEYS=y -CONFIG_KEYS_DEBUG_PROC_KEYS=y # CONFIG_CRYPTO_ANSI_CPRNG is not set diff --git a/trunk/arch/microblaze/configs/nommu_defconfig b/trunk/arch/microblaze/configs/nommu_defconfig index 10b5172283d7..0249e4b7e1d3 100644 --- a/trunk/arch/microblaze/configs/nommu_defconfig +++ b/trunk/arch/microblaze/configs/nommu_defconfig @@ -1,42 +1,41 @@ CONFIG_EXPERIMENTAL=y CONFIG_SYSVIPC=y CONFIG_POSIX_MQUEUE=y -CONFIG_FHANDLE=y -CONFIG_AUDIT=y -CONFIG_AUDIT_LOGINUID_IMMUTABLE=y CONFIG_BSD_PROCESS_ACCT=y CONFIG_BSD_PROCESS_ACCT_V3=y CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y -CONFIG_SYSFS_DEPRECATED=y CONFIG_SYSFS_DEPRECATED_V2=y +CONFIG_EXPERT=y CONFIG_KALLSYMS_ALL=y +CONFIG_KALLSYMS_EXTRA_PASS=y +# CONFIG_HOTPLUG is not set # CONFIG_BASE_FULL is not set -CONFIG_EMBEDDED=y CONFIG_SLAB=y CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y # CONFIG_BLK_DEV_BSG is not set -CONFIG_PARTITION_ADVANCED=y -# CONFIG_EFI_PARTITION is not set +# CONFIG_OPT_LIB_FUNCTION is not set CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR=1 CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR=1 CONFIG_XILINX_MICROBLAZE0_USE_BARREL=1 CONFIG_XILINX_MICROBLAZE0_USE_DIV=1 CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL=2 CONFIG_XILINX_MICROBLAZE0_USE_FPU=2 +CONFIG_HIGH_RES_TIMERS=y CONFIG_HZ_100=y CONFIG_CMDLINE_BOOL=y -CONFIG_CMDLINE_FORCE=y -CONFIG_PCI=y -CONFIG_PCI_XILINX=y +CONFIG_BINFMT_FLAT=y CONFIG_NET=y CONFIG_PACKET=y CONFIG_UNIX=y CONFIG_INET=y # CONFIG_INET_LRO is not set # CONFIG_IPV6 is not set +# CONFIG_PREVENT_FIRMWARE_BUILD is not set CONFIG_MTD=y +CONFIG_MTD_CONCAT=y +CONFIG_MTD_PARTITIONS=y CONFIG_MTD_CMDLINE_PARTS=y CONFIG_MTD_CHAR=y CONFIG_MTD_BLOCK=y @@ -46,55 +45,41 @@ CONFIG_MTD_CFI_AMDSTD=y CONFIG_MTD_RAM=y CONFIG_MTD_UCLINUX=y CONFIG_PROC_DEVICETREE=y +CONFIG_BLK_DEV_NBD=y CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_SIZE=8192 CONFIG_NETDEVICES=y -CONFIG_XILINX_EMACLITE=y -CONFIG_XILINX_LL_TEMAC=y +CONFIG_NET_ETHERNET=y # CONFIG_INPUT is not set # CONFIG_SERIO is not set # CONFIG_VT is not set -CONFIG_SERIAL_8250=y -CONFIG_SERIAL_8250_CONSOLE=y CONFIG_SERIAL_UARTLITE=y CONFIG_SERIAL_UARTLITE_CONSOLE=y -# CONFIG_HW_RANDOM is not set -CONFIG_XILINX_HWICAP=y -CONFIG_I2C=y -CONFIG_I2C_XILINX=y -CONFIG_SPI=y -CONFIG_SPI_XILINX=y -CONFIG_GPIOLIB=y -CONFIG_GPIO_SYSFS=y -CONFIG_GPIO_XILINX=y +CONFIG_HW_RANDOM=y # CONFIG_HWMON is not set -CONFIG_WATCHDOG=y -CONFIG_XILINX_WATCHDOG=y -CONFIG_FB=y -CONFIG_FB_XILINX=y -# CONFIG_USB_SUPPORT is not set -CONFIG_UIO=y -CONFIG_UIO_PDRV=y -CONFIG_UIO_PDRV_GENIRQ=y -CONFIG_UIO_DMEM_GENIRQ=y +CONFIG_VIDEO_OUTPUT_CONTROL=y CONFIG_EXT2_FS=y # CONFIG_DNOTIFY is not set CONFIG_CRAMFS=y CONFIG_ROMFS_FS=y CONFIG_NFS_FS=y +CONFIG_NFS_V3=y CONFIG_NFS_V3_ACL=y -CONFIG_NLS=y +CONFIG_UNUSED_SYMBOLS=y +CONFIG_DEBUG_FS=y +CONFIG_DEBUG_KERNEL=y +CONFIG_DEBUG_SHIRQ=y CONFIG_DETECT_HUNG_TASK=y -CONFIG_DEBUG_SLAB=y -CONFIG_DEBUG_SPINLOCK=y +CONFIG_SCHEDSTATS=y +CONFIG_TIMER_STATS=y +CONFIG_DEBUG_OBJECTS=y +CONFIG_DEBUG_OBJECTS_SELFTEST=y +CONFIG_DEBUG_OBJECTS_FREE=y +CONFIG_DEBUG_OBJECTS_TIMERS=y CONFIG_DEBUG_INFO=y +CONFIG_DEBUG_LIST=y +CONFIG_DEBUG_SG=y +# CONFIG_RCU_CPU_STALL_DETECTOR is not set +CONFIG_SYSCTL_SYSCALL_CHECK=y CONFIG_EARLY_PRINTK=y -CONFIG_KEYS=y -CONFIG_ENCRYPTED_KEYS=y -CONFIG_KEYS_DEBUG_PROC_KEYS=y -CONFIG_CRYPTO_ECB=y -CONFIG_CRYPTO_MD4=y -CONFIG_CRYPTO_MD5=y -CONFIG_CRYPTO_ARC4=y -CONFIG_CRYPTO_DES=y # CONFIG_CRYPTO_ANSI_CPRNG is not set +# CONFIG_CRC32 is not set diff --git a/trunk/arch/microblaze/include/asm/highmem.h b/trunk/arch/microblaze/include/asm/highmem.h index d04638932438..2446a73140ac 100644 --- a/trunk/arch/microblaze/include/asm/highmem.h +++ b/trunk/arch/microblaze/include/asm/highmem.h @@ -71,7 +71,7 @@ static inline void kunmap(struct page *page) kunmap_high(page); } -static inline void *kmap_atomic(struct page *page) +static inline void *__kmap_atomic(struct page *page) { return kmap_atomic_prot(page, kmap_prot); } diff --git a/trunk/arch/microblaze/include/asm/uaccess.h b/trunk/arch/microblaze/include/asm/uaccess.h index a1ab5f0009ef..927540d3cb7d 100644 --- a/trunk/arch/microblaze/include/asm/uaccess.h +++ b/trunk/arch/microblaze/include/asm/uaccess.h @@ -108,7 +108,7 @@ static inline int ___range_ok(unsigned long addr, unsigned long size) # define __EX_TABLE_SECTION ".section __ex_table,\"a\"\n" #else # define __FIXUP_SECTION ".section .discard,\"ax\"\n" -# define __EX_TABLE_SECTION ".section .discard,\"ax\"\n" +# define __EX_TABLE_SECTION ".section .discard,\"a\"\n" #endif extern unsigned long __copy_tofrom_user(void __user *to, diff --git a/trunk/arch/microblaze/include/asm/unistd.h b/trunk/arch/microblaze/include/asm/unistd.h index 10f8ac186855..a5f06ac97113 100644 --- a/trunk/arch/microblaze/include/asm/unistd.h +++ b/trunk/arch/microblaze/include/asm/unistd.h @@ -37,7 +37,9 @@ #define __ARCH_WANT_SYS_RT_SIGSUSPEND #define __ARCH_WANT_SYS_CLONE #define __ARCH_WANT_SYS_VFORK +#ifdef CONFIG_MMU #define __ARCH_WANT_SYS_FORK +#endif /* * "Conditional" syscalls diff --git a/trunk/arch/microblaze/include/uapi/asm/unistd.h b/trunk/arch/microblaze/include/uapi/asm/unistd.h index 5f7fe7582f3a..ccb6920f3b33 100644 --- a/trunk/arch/microblaze/include/uapi/asm/unistd.h +++ b/trunk/arch/microblaze/include/uapi/asm/unistd.h @@ -395,8 +395,7 @@ #define __NR_process_vm_readv 377 #define __NR_process_vm_writev 378 #define __NR_kcmp 379 -#define __NR_finit_module 380 -#define __NR_syscalls 381 +#define __NR_syscalls 380 #endif /* _UAPI_ASM_MICROBLAZE_UNISTD_H */ diff --git a/trunk/arch/microblaze/kernel/syscall_table.S b/trunk/arch/microblaze/kernel/syscall_table.S index 4fca56cf02f6..1cbace29b5e2 100644 --- a/trunk/arch/microblaze/kernel/syscall_table.S +++ b/trunk/arch/microblaze/kernel/syscall_table.S @@ -380,4 +380,3 @@ ENTRY(sys_call_table) .long sys_process_vm_readv .long sys_process_vm_writev .long sys_kcmp - .long sys_finit_module diff --git a/trunk/arch/microblaze/pci/pci-common.c b/trunk/arch/microblaze/pci/pci-common.c index 96416553cb36..2a20f1ff4c59 100644 --- a/trunk/arch/microblaze/pci/pci-common.c +++ b/trunk/arch/microblaze/pci/pci-common.c @@ -287,7 +287,7 @@ static struct resource *__pci_mmap_make_offset(struct pci_dev *dev, unsigned long io_offset = 0; int i, res_bit; - if (!hose) + if (hose == 0) return NULL; /* should never happen */ /* If memory, add on the PCI bridge address offset */ @@ -821,6 +821,8 @@ void pci_process_bridge_OF_ranges(struct pci_controller *hose, /* Decide whether to display the domain number in /proc */ int pci_proc_domain(struct pci_bus *bus) { + struct pci_controller *hose = pci_bus_to_host(bus); + return 0; } @@ -1121,7 +1123,7 @@ static int __init reparent_resources(struct resource *parent, * as well. */ -static void pcibios_allocate_bus_resources(struct pci_bus *bus) +void pcibios_allocate_bus_resources(struct pci_bus *bus) { struct pci_bus *b; int i; @@ -1176,7 +1178,7 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus) } printk(KERN_WARNING "PCI: Cannot allocate resource region " "%d of PCI bridge %d, will remap\n", i, bus->number); - +clear_resource: res->start = res->end = 0; res->flags = 0; } @@ -1431,8 +1433,7 @@ static void pcibios_setup_phb_resources(struct pci_controller *hose, res->end = res->start + IO_SPACE_LIMIT; res->flags = IORESOURCE_IO; } - pci_add_resource_offset(resources, res, - (__force resource_size_t)(hose->io_base_virt - _IO_BASE)); + pci_add_resource_offset(resources, res, hose->io_base_virt - _IO_BASE); pr_debug("PCI: PHB IO resource = %016llx-%016llx [%lx]\n", (unsigned long long)res->start, diff --git a/trunk/arch/mips/Kconfig b/trunk/arch/mips/Kconfig index 2ac626ab9d43..b7dc39c6c849 100644 --- a/trunk/arch/mips/Kconfig +++ b/trunk/arch/mips/Kconfig @@ -39,8 +39,8 @@ config MIPS select GENERIC_CLOCKEVENTS select GENERIC_CMOS_UPDATE select HAVE_MOD_ARCH_SPECIFIC - select MODULES_USE_ELF_REL if MODULES - select MODULES_USE_ELF_RELA if MODULES && 64BIT + select MODULES_USE_ELF_REL + select MODULES_USE_ELF_RELA if 64BIT menu "Machine selection" diff --git a/trunk/arch/mips/alchemy/common/time.c b/trunk/arch/mips/alchemy/common/time.c index b67930d19325..a7193ae13a5d 100644 --- a/trunk/arch/mips/alchemy/common/time.c +++ b/trunk/arch/mips/alchemy/common/time.c @@ -53,7 +53,7 @@ static struct clocksource au1x_counter1_clocksource = { .read = au1x_counter1_read, .mask = CLOCKSOURCE_MASK(32), .flags = CLOCK_SOURCE_IS_CONTINUOUS, - .rating = 1500, + .rating = 100, }; static int au1x_rtcmatch2_set_next_event(unsigned long delta, @@ -84,7 +84,7 @@ static irqreturn_t au1x_rtcmatch2_irq(int irq, void *dev_id) static struct clock_event_device au1x_rtcmatch2_clockdev = { .name = "rtcmatch2", .features = CLOCK_EVT_FEAT_ONESHOT, - .rating = 1500, + .rating = 100, .set_next_event = au1x_rtcmatch2_set_next_event, .set_mode = au1x_rtcmatch2_set_mode, .cpumask = cpu_all_mask, @@ -158,6 +158,20 @@ static int __init alchemy_time_init(unsigned int m2int) return -1; } +static void __init alchemy_setup_c0timer(void) +{ + /* + * MIPS kernel assigns 'au1k_wait' to 'cpu_wait' before this + * function is called. Because the Alchemy counters are unusable + * the C0 timekeeping code is installed and use of the 'wait' + * instruction must be prohibited, which is done most easily by + * assigning NULL to cpu_wait. + */ + cpu_wait = NULL; + r4k_clockevent_init(); + init_r4k_clocksource(); +} + static int alchemy_m2inttab[] __initdata = { AU1000_RTC_MATCH2_INT, AU1500_RTC_MATCH2_INT, @@ -172,7 +186,8 @@ void __init plat_time_init(void) int t; t = alchemy_get_cputype(); - if (t == ALCHEMY_CPU_UNKNOWN || - alchemy_time_init(alchemy_m2inttab[t])) - cpu_wait = NULL; /* wait doesn't work with r4k timer */ + if (t == ALCHEMY_CPU_UNKNOWN) + alchemy_setup_c0timer(); + else if (alchemy_time_init(alchemy_m2inttab[t])) + alchemy_setup_c0timer(); } diff --git a/trunk/arch/mips/include/asm/page.h b/trunk/arch/mips/include/asm/page.h index dbaec94046da..31ab10f02bad 100644 --- a/trunk/arch/mips/include/asm/page.h +++ b/trunk/arch/mips/include/asm/page.h @@ -45,6 +45,8 @@ #define HUGETLB_PAGE_ORDER ({BUILD_BUG(); 0; }) #endif /* CONFIG_MIPS_HUGE_TLB_SUPPORT */ +#ifndef __ASSEMBLY__ + #include #include @@ -137,6 +139,8 @@ typedef struct { unsigned long pgprot; } pgprot_t; */ #define ptep_buddy(x) ((pte_t *)((unsigned long)(x) ^ sizeof(pte_t))) +#endif /* !__ASSEMBLY__ */ + /* * __pa()/__va() should be used only during mem init. */ @@ -198,10 +202,7 @@ typedef struct { unsigned long pgprot; } pgprot_t; #endif #define virt_to_page(kaddr) pfn_to_page(PFN_DOWN(virt_to_phys(kaddr))) - -extern int __virt_addr_valid(const volatile void *kaddr); -#define virt_addr_valid(kaddr) \ - __virt_addr_valid((const volatile void *) (kaddr)) +#define virt_addr_valid(kaddr) pfn_valid(PFN_DOWN(virt_to_phys(kaddr))) #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) diff --git a/trunk/arch/mips/include/asm/thread_info.h b/trunk/arch/mips/include/asm/thread_info.h index b2050b9e64b1..18806a52061c 100644 --- a/trunk/arch/mips/include/asm/thread_info.h +++ b/trunk/arch/mips/include/asm/thread_info.h @@ -29,11 +29,10 @@ struct thread_info { __u32 cpu; /* current CPU */ int preempt_count; /* 0 => preemptable, <0 => BUG */ - mm_segment_t addr_limit; /* - * thread address space limit: - * 0x7fffffff for user-thead - * 0xffffffff for kernel-thread - */ + mm_segment_t addr_limit; /* thread address space: + 0-0xBFFFFFFF for user-thead + 0-0xFFFFFFFF for kernel-thread + */ struct restart_block restart_block; struct pt_regs *regs; }; diff --git a/trunk/arch/mips/include/uapi/asm/unistd.h b/trunk/arch/mips/include/uapi/asm/unistd.h index 0eebf3c3e03c..cc98a9dcb01b 100644 --- a/trunk/arch/mips/include/uapi/asm/unistd.h +++ b/trunk/arch/mips/include/uapi/asm/unistd.h @@ -368,17 +368,16 @@ #define __NR_process_vm_readv (__NR_Linux + 345) #define __NR_process_vm_writev (__NR_Linux + 346) #define __NR_kcmp (__NR_Linux + 347) -#define __NR_finit_module (__NR_Linux + 348) /* * Offset of the last Linux o32 flavoured syscall */ -#define __NR_Linux_syscalls 348 +#define __NR_Linux_syscalls 347 #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ #define __NR_O32_Linux 4000 -#define __NR_O32_Linux_syscalls 348 +#define __NR_O32_Linux_syscalls 347 #if _MIPS_SIM == _MIPS_SIM_ABI64 @@ -693,17 +692,16 @@ #define __NR_process_vm_readv (__NR_Linux + 304) #define __NR_process_vm_writev (__NR_Linux + 305) #define __NR_kcmp (__NR_Linux + 306) -#define __NR_finit_module (__NR_Linux + 307) /* * Offset of the last Linux 64-bit flavoured syscall */ -#define __NR_Linux_syscalls 307 +#define __NR_Linux_syscalls 306 #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ #define __NR_64_Linux 5000 -#define __NR_64_Linux_syscalls 307 +#define __NR_64_Linux_syscalls 306 #if _MIPS_SIM == _MIPS_SIM_NABI32 @@ -1023,16 +1021,15 @@ #define __NR_process_vm_readv (__NR_Linux + 309) #define __NR_process_vm_writev (__NR_Linux + 310) #define __NR_kcmp (__NR_Linux + 311) -#define __NR_finit_module (__NR_Linux + 312) /* * Offset of the last N32 flavoured syscall */ -#define __NR_Linux_syscalls 312 +#define __NR_Linux_syscalls 311 #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ #define __NR_N32_Linux 6000 -#define __NR_N32_Linux_syscalls 312 +#define __NR_N32_Linux_syscalls 311 #endif /* _UAPI_ASM_UNISTD_H */ diff --git a/trunk/arch/mips/kernel/asm-offsets.c b/trunk/arch/mips/kernel/asm-offsets.c index 50285b2c7ffe..9690998d4ef3 100644 --- a/trunk/arch/mips/kernel/asm-offsets.c +++ b/trunk/arch/mips/kernel/asm-offsets.c @@ -200,9 +200,6 @@ void output_mm_defines(void) DEFINE(_PTRS_PER_PMD, PTRS_PER_PMD); DEFINE(_PTRS_PER_PTE, PTRS_PER_PTE); BLANK(); - DEFINE(_PAGE_SHIFT, PAGE_SHIFT); - DEFINE(_PAGE_SIZE, PAGE_SIZE); - BLANK(); } #ifdef CONFIG_32BIT diff --git a/trunk/arch/mips/kernel/genex.S b/trunk/arch/mips/kernel/genex.S index 8a0096d62812..8882e5766f27 100644 --- a/trunk/arch/mips/kernel/genex.S +++ b/trunk/arch/mips/kernel/genex.S @@ -19,6 +19,7 @@ #include #include #include +#include #include #define PANIC_PIC(msg) \ @@ -482,8 +483,8 @@ NESTED(nmi_handler, PT_SIZE, sp) MFC0 k1, CP0_ENTRYHI andi k1, 0xff /* ASID_MASK */ MFC0 k0, CP0_EPC - PTR_SRL k0, _PAGE_SHIFT + 1 - PTR_SLL k0, _PAGE_SHIFT + 1 + PTR_SRL k0, PAGE_SHIFT + 1 + PTR_SLL k0, PAGE_SHIFT + 1 or k1, k0 MTC0 k1, CP0_ENTRYHI mtc0_tlbw_hazard diff --git a/trunk/arch/mips/kernel/head.S b/trunk/arch/mips/kernel/head.S index fcf97312f328..ea695d9605e9 100644 --- a/trunk/arch/mips/kernel/head.S +++ b/trunk/arch/mips/kernel/head.S @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/mips/kernel/octeon_switch.S b/trunk/arch/mips/kernel/octeon_switch.S index 207f1341578b..0441f54b2a6a 100644 --- a/trunk/arch/mips/kernel/octeon_switch.S +++ b/trunk/arch/mips/kernel/octeon_switch.S @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/mips/kernel/perf_event_mipsxx.c b/trunk/arch/mips/kernel/perf_event_mipsxx.c index d9c81c5a6c90..b14c14d90fc2 100644 --- a/trunk/arch/mips/kernel/perf_event_mipsxx.c +++ b/trunk/arch/mips/kernel/perf_event_mipsxx.c @@ -847,6 +847,7 @@ static const struct mips_perf_event xlp_event_map[PERF_COUNT_HW_MAX] = { [PERF_COUNT_HW_CACHE_MISSES] = { 0x07, CNTR_ALL }, /* PAPI_L1_ICM */ [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = { 0x1b, CNTR_ALL }, /* PAPI_BR_CN */ [PERF_COUNT_HW_BRANCH_MISSES] = { 0x1c, CNTR_ALL }, /* PAPI_BR_MSP */ + [PERF_COUNT_HW_BUS_CYCLES] = { UNSUPPORTED_PERF_EVENT_ID }, }; /* 24K/34K/1004K cores can share the same cache event map. */ @@ -1114,12 +1115,24 @@ static const struct mips_perf_event xlp_cache_map [C(RESULT_ACCESS)] = { 0x2f, CNTR_ALL }, /* PAPI_L1_DCW */ [C(RESULT_MISS)] = { 0x2e, CNTR_ALL }, /* PAPI_L1_STM */ }, + [C(OP_PREFETCH)] = { + [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID }, + [C(RESULT_MISS)] = { UNSUPPORTED_PERF_EVENT_ID }, + }, }, [C(L1I)] = { [C(OP_READ)] = { [C(RESULT_ACCESS)] = { 0x04, CNTR_ALL }, /* PAPI_L1_ICA */ [C(RESULT_MISS)] = { 0x07, CNTR_ALL }, /* PAPI_L1_ICM */ }, + [C(OP_WRITE)] = { + [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID }, + [C(RESULT_MISS)] = { UNSUPPORTED_PERF_EVENT_ID }, + }, + [C(OP_PREFETCH)] = { + [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID }, + [C(RESULT_MISS)] = { UNSUPPORTED_PERF_EVENT_ID }, + }, }, [C(LL)] = { [C(OP_READ)] = { @@ -1130,6 +1143,10 @@ static const struct mips_perf_event xlp_cache_map [C(RESULT_ACCESS)] = { 0x34, CNTR_ALL }, /* PAPI_L2_DCA */ [C(RESULT_MISS)] = { 0x36, CNTR_ALL }, /* PAPI_L2_DCM */ }, + [C(OP_PREFETCH)] = { + [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID }, + [C(RESULT_MISS)] = { UNSUPPORTED_PERF_EVENT_ID }, + }, }, [C(DTLB)] = { /* @@ -1137,24 +1154,45 @@ static const struct mips_perf_event xlp_cache_map * read and write. */ [C(OP_READ)] = { + [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID }, [C(RESULT_MISS)] = { 0x2d, CNTR_ALL }, /* PAPI_TLB_DM */ }, [C(OP_WRITE)] = { + [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID }, [C(RESULT_MISS)] = { 0x2d, CNTR_ALL }, /* PAPI_TLB_DM */ }, + [C(OP_PREFETCH)] = { + [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID }, + [C(RESULT_MISS)] = { UNSUPPORTED_PERF_EVENT_ID }, + }, }, [C(ITLB)] = { [C(OP_READ)] = { + [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID }, [C(RESULT_MISS)] = { 0x08, CNTR_ALL }, /* PAPI_TLB_IM */ }, [C(OP_WRITE)] = { + [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID }, [C(RESULT_MISS)] = { 0x08, CNTR_ALL }, /* PAPI_TLB_IM */ }, + [C(OP_PREFETCH)] = { + [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID }, + [C(RESULT_MISS)] = { UNSUPPORTED_PERF_EVENT_ID }, + }, }, [C(BPU)] = { [C(OP_READ)] = { + [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID }, [C(RESULT_MISS)] = { 0x25, CNTR_ALL }, }, + [C(OP_WRITE)] = { + [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID }, + [C(RESULT_MISS)] = { UNSUPPORTED_PERF_EVENT_ID }, + }, + [C(OP_PREFETCH)] = { + [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID }, + [C(RESULT_MISS)] = { UNSUPPORTED_PERF_EVENT_ID }, + }, }, }; diff --git a/trunk/arch/mips/kernel/r2300_switch.S b/trunk/arch/mips/kernel/r2300_switch.S index 8d32d5a6b460..9c51be5a163a 100644 --- a/trunk/arch/mips/kernel/r2300_switch.S +++ b/trunk/arch/mips/kernel/r2300_switch.S @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/mips/kernel/r4k_switch.S b/trunk/arch/mips/kernel/r4k_switch.S index 8decdfacb448..42d2a3938420 100644 --- a/trunk/arch/mips/kernel/r4k_switch.S +++ b/trunk/arch/mips/kernel/r4k_switch.S @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include diff --git a/trunk/arch/mips/kernel/relocate_kernel.S b/trunk/arch/mips/kernel/relocate_kernel.S index 804ebb2c34a6..e4142c5f7c2b 100644 --- a/trunk/arch/mips/kernel/relocate_kernel.S +++ b/trunk/arch/mips/kernel/relocate_kernel.S @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -49,7 +50,7 @@ process_entry: and s3, s2, 0x8 beq s3, zero, process_entry and s2, s2, ~0x8 - li s6, (1 << _PAGE_SHIFT) / SZREG + li s6, (1 << PAGE_SHIFT) / SZREG copy_word: /* copy page word by word */ diff --git a/trunk/arch/mips/kernel/scall32-o32.S b/trunk/arch/mips/kernel/scall32-o32.S index d20a4bc9ed05..374f66e05f3d 100644 --- a/trunk/arch/mips/kernel/scall32-o32.S +++ b/trunk/arch/mips/kernel/scall32-o32.S @@ -583,7 +583,6 @@ einval: li v0, -ENOSYS sys sys_process_vm_readv 6 /* 4345 */ sys sys_process_vm_writev 6 sys sys_kcmp 5 - sys sys_finit_module 3 .endm /* We pre-compute the number of _instruction_ bytes needed to diff --git a/trunk/arch/mips/kernel/scall64-64.S b/trunk/arch/mips/kernel/scall64-64.S index b64f642da073..169de6a6d916 100644 --- a/trunk/arch/mips/kernel/scall64-64.S +++ b/trunk/arch/mips/kernel/scall64-64.S @@ -422,5 +422,4 @@ sys_call_table: PTR sys_process_vm_readv PTR sys_process_vm_writev /* 5305 */ PTR sys_kcmp - PTR sys_finit_module .size sys_call_table,.-sys_call_table diff --git a/trunk/arch/mips/kernel/scall64-n32.S b/trunk/arch/mips/kernel/scall64-n32.S index c29ac197f446..ad3de9668da9 100644 --- a/trunk/arch/mips/kernel/scall64-n32.S +++ b/trunk/arch/mips/kernel/scall64-n32.S @@ -416,5 +416,4 @@ EXPORT(sysn32_call_table) PTR compat_sys_process_vm_readv PTR compat_sys_process_vm_writev /* 6310 */ PTR sys_kcmp - PTR sys_finit_module .size sysn32_call_table,.-sysn32_call_table diff --git a/trunk/arch/mips/kernel/scall64-o32.S b/trunk/arch/mips/kernel/scall64-o32.S index cf3e75e46650..9601be6afa3d 100644 --- a/trunk/arch/mips/kernel/scall64-o32.S +++ b/trunk/arch/mips/kernel/scall64-o32.S @@ -540,5 +540,4 @@ sys_call_table: PTR compat_sys_process_vm_readv /* 4345 */ PTR compat_sys_process_vm_writev PTR sys_kcmp - PTR sys_finit_module .size sys_call_table,.-sys_call_table diff --git a/trunk/arch/mips/kernel/vmlinux.lds.S b/trunk/arch/mips/kernel/vmlinux.lds.S index 0a4336b803e9..007ccbe1e264 100644 --- a/trunk/arch/mips/kernel/vmlinux.lds.S +++ b/trunk/arch/mips/kernel/vmlinux.lds.S @@ -1,8 +1,7 @@ #include +#include #include -#define PAGE_SIZE _PAGE_SIZE - /* * Put .bss..swapper_pg_dir as the first thing in .bss. This will * ensure that it has .bss alignment (64K). diff --git a/trunk/arch/mips/mm/ioremap.c b/trunk/arch/mips/mm/ioremap.c index 7657fd21cd3f..cacfd31e8ec9 100644 --- a/trunk/arch/mips/mm/ioremap.c +++ b/trunk/arch/mips/mm/ioremap.c @@ -190,9 +190,3 @@ void __iounmap(const volatile void __iomem *addr) EXPORT_SYMBOL(__ioremap); EXPORT_SYMBOL(__iounmap); - -int __virt_addr_valid(const volatile void *kaddr) -{ - return pfn_valid(PFN_DOWN(virt_to_phys(kaddr))); -} -EXPORT_SYMBOL_GPL(__virt_addr_valid); diff --git a/trunk/arch/mips/mm/tlbex-fault.S b/trunk/arch/mips/mm/tlbex-fault.S index 318855eb5f80..e99eaa1fbedc 100644 --- a/trunk/arch/mips/mm/tlbex-fault.S +++ b/trunk/arch/mips/mm/tlbex-fault.S @@ -7,6 +7,7 @@ * Copyright (C) 1999 Silicon Graphics, Inc. */ #include +#include #include #include diff --git a/trunk/arch/mips/mm/tlbex.c b/trunk/arch/mips/mm/tlbex.c index 1c8ac49ec72c..05613355627b 100644 --- a/trunk/arch/mips/mm/tlbex.c +++ b/trunk/arch/mips/mm/tlbex.c @@ -976,6 +976,13 @@ build_get_pgde32(u32 **p, unsigned int tmp, unsigned int ptr) #endif uasm_i_mfc0(p, tmp, C0_BADVADDR); /* get faulting address */ uasm_i_lw(p, ptr, uasm_rel_lo(pgdc), ptr); + + if (cpu_has_mips_r2) { + uasm_i_ext(p, tmp, tmp, PGDIR_SHIFT, (32 - PGDIR_SHIFT)); + uasm_i_ins(p, ptr, tmp, PGD_T_LOG2, (32 - PGDIR_SHIFT)); + return; + } + uasm_i_srl(p, tmp, tmp, PGDIR_SHIFT); /* get pgd only bits */ uasm_i_sll(p, tmp, tmp, PGD_T_LOG2); uasm_i_addu(p, ptr, ptr, tmp); /* add in pgd offset */ @@ -1011,6 +1018,15 @@ static void __cpuinit build_adjust_context(u32 **p, unsigned int ctx) static void __cpuinit build_get_ptep(u32 **p, unsigned int tmp, unsigned int ptr) { + if (cpu_has_mips_r2) { + /* PTE ptr offset is obtained from BadVAddr */ + UASM_i_MFC0(p, tmp, C0_BADVADDR); + UASM_i_LW(p, ptr, 0, ptr); + uasm_i_ext(p, tmp, tmp, PAGE_SHIFT+1, PGDIR_SHIFT-PAGE_SHIFT-1); + uasm_i_ins(p, ptr, tmp, PTE_T_LOG2+1, PGDIR_SHIFT-PAGE_SHIFT-1); + return; + } + /* * Bug workaround for the Nevada. It seems as if under certain * circumstances the move from cp0_context might produce a diff --git a/trunk/arch/mips/power/hibernate.S b/trunk/arch/mips/power/hibernate.S index 61e2558a2dcb..f8a751c03282 100644 --- a/trunk/arch/mips/power/hibernate.S +++ b/trunk/arch/mips/power/hibernate.S @@ -8,6 +8,7 @@ * Wu Zhangjin */ #include +#include #include #include @@ -34,7 +35,7 @@ LEAF(swsusp_arch_resume) 0: PTR_L t1, PBE_ADDRESS(t0) /* source */ PTR_L t2, PBE_ORIG_ADDRESS(t0) /* destination */ - PTR_ADDU t3, t1, _PAGE_SIZE + PTR_ADDU t3, t1, PAGE_SIZE 1: REG_L t8, (t1) REG_S t8, (t2) diff --git a/trunk/arch/mn10300/Kconfig b/trunk/arch/mn10300/Kconfig index e70001cfa05b..aa03f2e13385 100644 --- a/trunk/arch/mn10300/Kconfig +++ b/trunk/arch/mn10300/Kconfig @@ -6,7 +6,6 @@ config MN10300 select ARCH_WANT_IPC_PARSE_VERSION select HAVE_ARCH_TRACEHOOK select HAVE_ARCH_KGDB - select GENERIC_ATOMIC64 select HAVE_NMI_WATCHDOG if MN10300_WD_TIMER select GENERIC_CLOCKEVENTS select MODULES_USE_ELF_RELA diff --git a/trunk/arch/parisc/kernel/entry.S b/trunk/arch/parisc/kernel/entry.S index eb7850b46c25..bfb44247d7a7 100644 --- a/trunk/arch/parisc/kernel/entry.S +++ b/trunk/arch/parisc/kernel/entry.S @@ -1865,7 +1865,7 @@ syscall_restore: /* Are we being ptraced? */ ldw TASK_FLAGS(%r1),%r19 - ldi _TIF_SYSCALL_TRACE_MASK,%r2 + ldi (_TIF_SINGLESTEP|_TIF_BLOCKSTEP),%r2 and,COND(=) %r19,%r2,%r0 b,n syscall_restore_rfi @@ -1978,23 +1978,15 @@ syscall_restore_rfi: /* sr2 should be set to zero for userspace syscalls */ STREG %r0,TASK_PT_SR2(%r1) +pt_regs_ok: LDREG TASK_PT_GR31(%r1),%r2 - depi 3,31,2,%r2 /* ensure return to user mode. */ - STREG %r2,TASK_PT_IAOQ0(%r1) + depi 3,31,2,%r2 /* ensure return to user mode. */ + STREG %r2,TASK_PT_IAOQ0(%r1) ldo 4(%r2),%r2 STREG %r2,TASK_PT_IAOQ1(%r1) - b intr_restore copy %r25,%r16 - -pt_regs_ok: - LDREG TASK_PT_IAOQ0(%r1),%r2 - depi 3,31,2,%r2 /* ensure return to user mode. */ - STREG %r2,TASK_PT_IAOQ0(%r1) - LDREG TASK_PT_IAOQ1(%r1),%r2 - depi 3,31,2,%r2 - STREG %r2,TASK_PT_IAOQ1(%r1) b intr_restore - copy %r25,%r16 + nop .import schedule,code syscall_do_resched: diff --git a/trunk/arch/parisc/kernel/irq.c b/trunk/arch/parisc/kernel/irq.c index 0299d63cd112..c0b1affc06a8 100644 --- a/trunk/arch/parisc/kernel/irq.c +++ b/trunk/arch/parisc/kernel/irq.c @@ -410,13 +410,11 @@ void __init init_IRQ(void) { local_irq_disable(); /* PARANOID - should already be disabled */ mtctl(~0UL, 23); /* EIRR : clear all pending external intr */ + claim_cpu_irqs(); #ifdef CONFIG_SMP - if (!cpu_eiem) { - claim_cpu_irqs(); + if (!cpu_eiem) cpu_eiem = EIEM_MASK(IPI_IRQ) | EIEM_MASK(TIMER_IRQ); - } #else - claim_cpu_irqs(); cpu_eiem = EIEM_MASK(TIMER_IRQ); #endif set_eiem(cpu_eiem); /* EIEM : enable all external intr */ diff --git a/trunk/arch/parisc/kernel/ptrace.c b/trunk/arch/parisc/kernel/ptrace.c index 534abd4936e1..857c2f545470 100644 --- a/trunk/arch/parisc/kernel/ptrace.c +++ b/trunk/arch/parisc/kernel/ptrace.c @@ -26,7 +26,7 @@ #include /* PSW bits we allow the debugger to modify */ -#define USER_PSW_BITS (PSW_N | PSW_B | PSW_V | PSW_CB) +#define USER_PSW_BITS (PSW_N | PSW_V | PSW_CB) /* * Called by kernel/ptrace.c when detaching.. diff --git a/trunk/arch/parisc/kernel/signal.c b/trunk/arch/parisc/kernel/signal.c index fd051705a407..537996955998 100644 --- a/trunk/arch/parisc/kernel/signal.c +++ b/trunk/arch/parisc/kernel/signal.c @@ -190,10 +190,8 @@ get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size) DBG(1,"get_sigframe: ka = %#lx, sp = %#lx, frame_size = %#lx\n", (unsigned long)ka, sp, frame_size); - /* Align alternate stack and reserve 64 bytes for the signal - handler's frame marker. */ if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! sas_ss_flags(sp)) - sp = (current->sas_ss_sp + 0x7f) & ~0x3f; /* Stacks grow up! */ + sp = current->sas_ss_sp; /* Stacks grow up! */ DBG(1,"get_sigframe: Returning sp = %#lx\n", (unsigned long)sp); return (void __user *) sp; /* Stacks grow up. Fun. */ diff --git a/trunk/arch/parisc/math-emu/cnv_float.h b/trunk/arch/parisc/math-emu/cnv_float.h index 933423fa5144..9071e093164a 100644 --- a/trunk/arch/parisc/math-emu/cnv_float.h +++ b/trunk/arch/parisc/math-emu/cnv_float.h @@ -347,15 +347,16 @@ Sgl_isinexact_to_fix(sgl_value,exponent) #define Duint_from_sgl_mantissa(sgl_value,exponent,dresultA,dresultB) \ - {unsigned int val = Sall(sgl_value) << SGL_EXP_LENGTH; \ + {Sall(sgl_value) <<= SGL_EXP_LENGTH; /* left-justify */ \ if (exponent <= 31) { \ - Dintp1(dresultA) = 0; \ - Dintp2(dresultB) = val >> (31 - exponent); \ + Dintp1(dresultA) = 0; \ + Dintp2(dresultB) = (unsigned)Sall(sgl_value) >> (31 - exponent); \ } \ else { \ - Dintp1(dresultA) = val >> (63 - exponent); \ - Dintp2(dresultB) = exponent <= 62 ? val << (exponent - 31) : 0; \ + Dintp1(dresultA) = Sall(sgl_value) >> (63 - exponent); \ + Dintp2(dresultB) = Sall(sgl_value) << (exponent - 31); \ } \ + Sall(sgl_value) >>= SGL_EXP_LENGTH; /* return to original */ \ } #define Duint_setzero(dresultA,dresultB) \ diff --git a/trunk/arch/powerpc/include/uapi/asm/kvm_para.h b/trunk/arch/powerpc/include/uapi/asm/kvm_para.h index e3af3286a068..ed0e0254b47f 100644 --- a/trunk/arch/powerpc/include/uapi/asm/kvm_para.h +++ b/trunk/arch/powerpc/include/uapi/asm/kvm_para.h @@ -78,7 +78,7 @@ struct kvm_vcpu_arch_shared { #define KVM_HCALL_TOKEN(num) _EV_HCALL_TOKEN(EV_KVM_VENDOR_ID, num) -#include +#include #define KVM_FEATURE_MAGIC_PAGE 1 diff --git a/trunk/arch/powerpc/kvm/book3s_hv_ras.c b/trunk/arch/powerpc/kvm/book3s_hv_ras.c index a353c485808c..35f3cf0269b3 100644 --- a/trunk/arch/powerpc/kvm/book3s_hv_ras.c +++ b/trunk/arch/powerpc/kvm/book3s_hv_ras.c @@ -79,9 +79,7 @@ static void flush_tlb_power7(struct kvm_vcpu *vcpu) static long kvmppc_realmode_mc_power7(struct kvm_vcpu *vcpu) { unsigned long srr1 = vcpu->arch.shregs.msr; -#ifdef CONFIG_PPC_POWERNV struct opal_machine_check_event *opal_evt; -#endif long handled = 1; if (srr1 & SRR1_MC_LDSTERR) { @@ -119,7 +117,6 @@ static long kvmppc_realmode_mc_power7(struct kvm_vcpu *vcpu) handled = 0; } -#ifdef CONFIG_PPC_POWERNV /* * See if OPAL has already handled the condition. * We assume that if the condition is recovered then OPAL @@ -134,7 +131,6 @@ static long kvmppc_realmode_mc_power7(struct kvm_vcpu *vcpu) if (handled) opal_evt->in_use = 0; -#endif return handled; } diff --git a/trunk/arch/powerpc/kvm/emulate.c b/trunk/arch/powerpc/kvm/emulate.c index 9d9cddc5b346..b0855e5d8905 100644 --- a/trunk/arch/powerpc/kvm/emulate.c +++ b/trunk/arch/powerpc/kvm/emulate.c @@ -39,7 +39,6 @@ #define OP_31_XOP_TRAP 4 #define OP_31_XOP_LWZX 23 #define OP_31_XOP_TRAP_64 68 -#define OP_31_XOP_DCBF 86 #define OP_31_XOP_LBZX 87 #define OP_31_XOP_STWX 151 #define OP_31_XOP_STBX 215 @@ -375,7 +374,6 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu) emulated = kvmppc_emulate_mtspr(vcpu, sprn, rs); break; - case OP_31_XOP_DCBF: case OP_31_XOP_DCBI: /* Do nothing. The guest is performing dcbi because * hardware DMA is not snooped by the dcache, but diff --git a/trunk/arch/s390/Makefile b/trunk/arch/s390/Makefile index 7e3ce78d4290..4b8e08b56f49 100644 --- a/trunk/arch/s390/Makefile +++ b/trunk/arch/s390/Makefile @@ -24,8 +24,8 @@ CHECKFLAGS += -D__s390__ -msize-long else LD_BFD := elf64-s390 LDFLAGS := -m elf64_s390 -KBUILD_AFLAGS_MODULE += -fPIC -KBUILD_CFLAGS_MODULE += -fPIC +KBUILD_AFLAGS_MODULE += -fpic -D__PIC__ +KBUILD_CFLAGS_MODULE += -fpic -D__PIC__ KBUILD_CFLAGS += -m64 KBUILD_AFLAGS += -m64 UTS_MACHINE := s390x diff --git a/trunk/arch/s390/include/asm/dma.h b/trunk/arch/s390/include/asm/dma.h index bb9bdcd20864..de015d85e3e5 100644 --- a/trunk/arch/s390/include/asm/dma.h +++ b/trunk/arch/s390/include/asm/dma.h @@ -10,10 +10,4 @@ */ #define MAX_DMA_ADDRESS 0x80000000 -#ifdef CONFIG_PCI -extern int isa_dma_bridge_buggy; -#else -#define isa_dma_bridge_buggy (0) -#endif - #endif /* _ASM_S390_DMA_H */ diff --git a/trunk/arch/s390/include/asm/io.h b/trunk/arch/s390/include/asm/io.h index 27cb32185ce1..16c3eb164f4f 100644 --- a/trunk/arch/s390/include/asm/io.h +++ b/trunk/arch/s390/include/asm/io.h @@ -85,11 +85,6 @@ static inline void iounmap(volatile void __iomem *addr) #define __raw_writel zpci_write_u32 #define __raw_writeq zpci_write_u64 -#define readb_relaxed readb -#define readw_relaxed readw -#define readl_relaxed readl -#define readq_relaxed readq - #endif /* CONFIG_PCI */ #include diff --git a/trunk/arch/s390/include/asm/irq.h b/trunk/arch/s390/include/asm/irq.h index 7def77302d63..e6972f85d2b0 100644 --- a/trunk/arch/s390/include/asm/irq.h +++ b/trunk/arch/s390/include/asm/irq.h @@ -2,61 +2,43 @@ #define _ASM_IRQ_H #include -#include -#include #include -enum interruption_main_class { +enum interruption_class { EXTERNAL_INTERRUPT, IO_INTERRUPT, - NR_IRQS -}; - -enum interruption_class { - IRQEXT_CLK, - IRQEXT_EXC, - IRQEXT_EMS, - IRQEXT_TMR, - IRQEXT_TLA, - IRQEXT_PFL, - IRQEXT_DSD, - IRQEXT_VRT, - IRQEXT_SCP, - IRQEXT_IUC, - IRQEXT_CMS, - IRQEXT_CMC, - IRQEXT_CMR, - IRQIO_CIO, - IRQIO_QAI, - IRQIO_DAS, - IRQIO_C15, - IRQIO_C70, - IRQIO_TAP, - IRQIO_VMR, - IRQIO_LCS, - IRQIO_CLW, - IRQIO_CTC, - IRQIO_APB, - IRQIO_ADM, - IRQIO_CSC, - IRQIO_PCI, - IRQIO_MSI, + EXTINT_CLK, + EXTINT_EXC, + EXTINT_EMS, + EXTINT_TMR, + EXTINT_TLA, + EXTINT_PFL, + EXTINT_DSD, + EXTINT_VRT, + EXTINT_SCP, + EXTINT_IUC, + EXTINT_CMS, + EXTINT_CMC, + EXTINT_CMR, + IOINT_CIO, + IOINT_QAI, + IOINT_DAS, + IOINT_C15, + IOINT_C70, + IOINT_TAP, + IOINT_VMR, + IOINT_LCS, + IOINT_CLW, + IOINT_CTC, + IOINT_APB, + IOINT_ADM, + IOINT_CSC, + IOINT_PCI, + IOINT_MSI, NMI_NMI, - CPU_RST, - NR_ARCH_IRQS + NR_IRQS, }; -struct irq_stat { - unsigned int irqs[NR_ARCH_IRQS]; -}; - -DECLARE_PER_CPU_SHARED_ALIGNED(struct irq_stat, irq_stat); - -static __always_inline void inc_irq_stat(enum interruption_class irq) -{ - __get_cpu_var(irq_stat).irqs[irq]++; -} - struct ext_code { unsigned short subcode; unsigned short code; diff --git a/trunk/arch/s390/include/asm/pgtable.h b/trunk/arch/s390/include/asm/pgtable.h index c1d7930a82f4..c928dc1938f2 100644 --- a/trunk/arch/s390/include/asm/pgtable.h +++ b/trunk/arch/s390/include/asm/pgtable.h @@ -1387,7 +1387,10 @@ static inline int has_transparent_hugepage(void) static inline unsigned long pmd_pfn(pmd_t pmd) { - return pmd_val(pmd) >> PAGE_SHIFT; + if (pmd_trans_huge(pmd)) + return pmd_val(pmd) >> HPAGE_SHIFT; + else + return pmd_val(pmd) >> PAGE_SHIFT; } #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ diff --git a/trunk/arch/s390/include/asm/timex.h b/trunk/arch/s390/include/asm/timex.h index 4c060bb5b8ea..fba4d66788a2 100644 --- a/trunk/arch/s390/include/asm/timex.h +++ b/trunk/arch/s390/include/asm/timex.h @@ -128,32 +128,4 @@ static inline unsigned long long get_clock_monotonic(void) return get_clock_xt() - sched_clock_base_cc; } -/** - * tod_to_ns - convert a TOD format value to nanoseconds - * @todval: to be converted TOD format value - * Returns: number of nanoseconds that correspond to the TOD format value - * - * Converting a 64 Bit TOD format value to nanoseconds means that the value - * must be divided by 4.096. In order to achieve that we multiply with 125 - * and divide by 512: - * - * ns = (todval * 125) >> 9; - * - * In order to avoid an overflow with the multiplication we can rewrite this. - * With a split todval == 2^32 * th + tl (th upper 32 bits, tl lower 32 bits) - * we end up with - * - * ns = ((2^32 * th + tl) * 125 ) >> 9; - * -> ns = (2^23 * th * 125) + ((tl * 125) >> 9); - * - */ -static inline unsigned long long tod_to_ns(unsigned long long todval) -{ - unsigned long long ns; - - ns = ((todval >> 32) << 23) * 125; - ns += ((todval & 0xffffffff) * 125) >> 9; - return ns; -} - #endif diff --git a/trunk/arch/s390/include/uapi/asm/unistd.h b/trunk/arch/s390/include/uapi/asm/unistd.h index 864f693c237f..63e6078699f1 100644 --- a/trunk/arch/s390/include/uapi/asm/unistd.h +++ b/trunk/arch/s390/include/uapi/asm/unistd.h @@ -279,8 +279,7 @@ #define __NR_process_vm_writev 341 #define __NR_s390_runtime_instr 342 #define __NR_kcmp 343 -#define __NR_finit_module 344 -#define NR_syscalls 345 +#define NR_syscalls 344 /* * There are some system calls that are not present on 64 bit, some diff --git a/trunk/arch/s390/kernel/compat_wrapper.S b/trunk/arch/s390/kernel/compat_wrapper.S index 9b9a805656b5..827e094a2f49 100644 --- a/trunk/arch/s390/kernel/compat_wrapper.S +++ b/trunk/arch/s390/kernel/compat_wrapper.S @@ -1659,9 +1659,3 @@ ENTRY(sys_kcmp_wrapper) llgfr %r5,%r5 # unsigned long llgfr %r6,%r6 # unsigned long jg sys_kcmp - -ENTRY(sys_finit_module_wrapper) - lgfr %r2,%r2 # int - llgtr %r3,%r3 # const char __user * - lgfr %r4,%r4 # int - jg sys_finit_module diff --git a/trunk/arch/s390/kernel/debug.c b/trunk/arch/s390/kernel/debug.c index 4e8215e0d4b6..ba500d8dc392 100644 --- a/trunk/arch/s390/kernel/debug.c +++ b/trunk/arch/s390/kernel/debug.c @@ -1127,14 +1127,13 @@ debug_register_view(debug_info_t * id, struct debug_view *view) if (i == DEBUG_MAX_VIEWS) { pr_err("Registering view %s/%s would exceed the maximum " "number of views %i\n", id->name, view->name, i); + debugfs_remove(pde); rc = -1; } else { id->views[i] = view; id->debugfs_entries[i] = pde; } spin_unlock_irqrestore(&id->lock, flags); - if (rc) - debugfs_remove(pde); out: return rc; } @@ -1147,9 +1146,9 @@ EXPORT_SYMBOL(debug_register_view); int debug_unregister_view(debug_info_t * id, struct debug_view *view) { - struct dentry *dentry = NULL; + int rc = 0; + int i; unsigned long flags; - int i, rc = 0; if (!id) goto out; @@ -1161,12 +1160,10 @@ debug_unregister_view(debug_info_t * id, struct debug_view *view) if (i == DEBUG_MAX_VIEWS) rc = -1; else { - dentry = id->debugfs_entries[i]; + debugfs_remove(id->debugfs_entries[i]); id->views[i] = NULL; - id->debugfs_entries[i] = NULL; } spin_unlock_irqrestore(&id->lock, flags); - debugfs_remove(dentry); out: return rc; } diff --git a/trunk/arch/s390/kernel/irq.c b/trunk/arch/s390/kernel/irq.c index 9df824ea1667..bf24293970ce 100644 --- a/trunk/arch/s390/kernel/irq.c +++ b/trunk/arch/s390/kernel/irq.c @@ -24,65 +24,43 @@ #include #include "entry.h" -DEFINE_PER_CPU_SHARED_ALIGNED(struct irq_stat, irq_stat); -EXPORT_PER_CPU_SYMBOL_GPL(irq_stat); - struct irq_class { char *name; char *desc; }; -/* - * The list of "main" irq classes on s390. This is the list of interrrupts - * that appear both in /proc/stat ("intr" line) and /proc/interrupts. - * Historically only external and I/O interrupts have been part of /proc/stat. - * We can't add the split external and I/O sub classes since the first field - * in the "intr" line in /proc/stat is supposed to be the sum of all other - * fields. - * Since the external and I/O interrupt fields are already sums we would end - * up with having a sum which accounts each interrupt twice. - */ -static const struct irq_class irqclass_main_desc[NR_IRQS] = { +static const struct irq_class intrclass_names[] = { [EXTERNAL_INTERRUPT] = {.name = "EXT"}, - [IO_INTERRUPT] = {.name = "I/O"} -}; - -/* - * The list of split external and I/O interrupts that appear only in - * /proc/interrupts. - * In addition this list contains non external / I/O events like NMIs. - */ -static const struct irq_class irqclass_sub_desc[NR_ARCH_IRQS] = { - [IRQEXT_CLK] = {.name = "CLK", .desc = "[EXT] Clock Comparator"}, - [IRQEXT_EXC] = {.name = "EXC", .desc = "[EXT] External Call"}, - [IRQEXT_EMS] = {.name = "EMS", .desc = "[EXT] Emergency Signal"}, - [IRQEXT_TMR] = {.name = "TMR", .desc = "[EXT] CPU Timer"}, - [IRQEXT_TLA] = {.name = "TAL", .desc = "[EXT] Timing Alert"}, - [IRQEXT_PFL] = {.name = "PFL", .desc = "[EXT] Pseudo Page Fault"}, - [IRQEXT_DSD] = {.name = "DSD", .desc = "[EXT] DASD Diag"}, - [IRQEXT_VRT] = {.name = "VRT", .desc = "[EXT] Virtio"}, - [IRQEXT_SCP] = {.name = "SCP", .desc = "[EXT] Service Call"}, - [IRQEXT_IUC] = {.name = "IUC", .desc = "[EXT] IUCV"}, - [IRQEXT_CMS] = {.name = "CMS", .desc = "[EXT] CPU-Measurement: Sampling"}, - [IRQEXT_CMC] = {.name = "CMC", .desc = "[EXT] CPU-Measurement: Counter"}, - [IRQEXT_CMR] = {.name = "CMR", .desc = "[EXT] CPU-Measurement: RI"}, - [IRQIO_CIO] = {.name = "CIO", .desc = "[I/O] Common I/O Layer Interrupt"}, - [IRQIO_QAI] = {.name = "QAI", .desc = "[I/O] QDIO Adapter Interrupt"}, - [IRQIO_DAS] = {.name = "DAS", .desc = "[I/O] DASD"}, - [IRQIO_C15] = {.name = "C15", .desc = "[I/O] 3215"}, - [IRQIO_C70] = {.name = "C70", .desc = "[I/O] 3270"}, - [IRQIO_TAP] = {.name = "TAP", .desc = "[I/O] Tape"}, - [IRQIO_VMR] = {.name = "VMR", .desc = "[I/O] Unit Record Devices"}, - [IRQIO_LCS] = {.name = "LCS", .desc = "[I/O] LCS"}, - [IRQIO_CLW] = {.name = "CLW", .desc = "[I/O] CLAW"}, - [IRQIO_CTC] = {.name = "CTC", .desc = "[I/O] CTC"}, - [IRQIO_APB] = {.name = "APB", .desc = "[I/O] AP Bus"}, - [IRQIO_ADM] = {.name = "ADM", .desc = "[I/O] EADM Subchannel"}, - [IRQIO_CSC] = {.name = "CSC", .desc = "[I/O] CHSC Subchannel"}, - [IRQIO_PCI] = {.name = "PCI", .desc = "[I/O] PCI Interrupt" }, - [IRQIO_MSI] = {.name = "MSI", .desc = "[I/O] MSI Interrupt" }, + [IO_INTERRUPT] = {.name = "I/O"}, + [EXTINT_CLK] = {.name = "CLK", .desc = "[EXT] Clock Comparator"}, + [EXTINT_EXC] = {.name = "EXC", .desc = "[EXT] External Call"}, + [EXTINT_EMS] = {.name = "EMS", .desc = "[EXT] Emergency Signal"}, + [EXTINT_TMR] = {.name = "TMR", .desc = "[EXT] CPU Timer"}, + [EXTINT_TLA] = {.name = "TAL", .desc = "[EXT] Timing Alert"}, + [EXTINT_PFL] = {.name = "PFL", .desc = "[EXT] Pseudo Page Fault"}, + [EXTINT_DSD] = {.name = "DSD", .desc = "[EXT] DASD Diag"}, + [EXTINT_VRT] = {.name = "VRT", .desc = "[EXT] Virtio"}, + [EXTINT_SCP] = {.name = "SCP", .desc = "[EXT] Service Call"}, + [EXTINT_IUC] = {.name = "IUC", .desc = "[EXT] IUCV"}, + [EXTINT_CMS] = {.name = "CMS", .desc = "[EXT] CPU-Measurement: Sampling"}, + [EXTINT_CMC] = {.name = "CMC", .desc = "[EXT] CPU-Measurement: Counter"}, + [EXTINT_CMR] = {.name = "CMR", .desc = "[EXT] CPU-Measurement: RI"}, + [IOINT_CIO] = {.name = "CIO", .desc = "[I/O] Common I/O Layer Interrupt"}, + [IOINT_QAI] = {.name = "QAI", .desc = "[I/O] QDIO Adapter Interrupt"}, + [IOINT_DAS] = {.name = "DAS", .desc = "[I/O] DASD"}, + [IOINT_C15] = {.name = "C15", .desc = "[I/O] 3215"}, + [IOINT_C70] = {.name = "C70", .desc = "[I/O] 3270"}, + [IOINT_TAP] = {.name = "TAP", .desc = "[I/O] Tape"}, + [IOINT_VMR] = {.name = "VMR", .desc = "[I/O] Unit Record Devices"}, + [IOINT_LCS] = {.name = "LCS", .desc = "[I/O] LCS"}, + [IOINT_CLW] = {.name = "CLW", .desc = "[I/O] CLAW"}, + [IOINT_CTC] = {.name = "CTC", .desc = "[I/O] CTC"}, + [IOINT_APB] = {.name = "APB", .desc = "[I/O] AP Bus"}, + [IOINT_ADM] = {.name = "ADM", .desc = "[I/O] EADM Subchannel"}, + [IOINT_CSC] = {.name = "CSC", .desc = "[I/O] CHSC Subchannel"}, + [IOINT_PCI] = {.name = "PCI", .desc = "[I/O] PCI Interrupt" }, + [IOINT_MSI] = {.name = "MSI", .desc = "[I/O] MSI Interrupt" }, [NMI_NMI] = {.name = "NMI", .desc = "[NMI] Machine Check"}, - [CPU_RST] = {.name = "RST", .desc = "[CPU] CPU Restart"}, }; /* @@ -90,34 +68,30 @@ static const struct irq_class irqclass_sub_desc[NR_ARCH_IRQS] = { */ int show_interrupts(struct seq_file *p, void *v) { - int irq = *(loff_t *) v; - int cpu; + int i = *(loff_t *) v, j; get_online_cpus(); - if (irq == 0) { + if (i == 0) { seq_puts(p, " "); - for_each_online_cpu(cpu) - seq_printf(p, "CPU%d ", cpu); + for_each_online_cpu(j) + seq_printf(p, "CPU%d ",j); seq_putc(p, '\n'); } - if (irq < NR_IRQS) { - seq_printf(p, "%s: ", irqclass_main_desc[irq].name); - for_each_online_cpu(cpu) - seq_printf(p, "%10u ", kstat_cpu(cpu).irqs[irq]); - seq_putc(p, '\n'); - goto skip_arch_irqs; - } - for (irq = 0; irq < NR_ARCH_IRQS; irq++) { - seq_printf(p, "%s: ", irqclass_sub_desc[irq].name); - for_each_online_cpu(cpu) - seq_printf(p, "%10u ", per_cpu(irq_stat, cpu).irqs[irq]); - if (irqclass_sub_desc[irq].desc) - seq_printf(p, " %s", irqclass_sub_desc[irq].desc); - seq_putc(p, '\n'); - } -skip_arch_irqs: + + if (i < NR_IRQS) { + seq_printf(p, "%s: ", intrclass_names[i].name); +#ifndef CONFIG_SMP + seq_printf(p, "%10u ", kstat_irqs(i)); +#else + for_each_online_cpu(j) + seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]); +#endif + if (intrclass_names[i].desc) + seq_printf(p, " %s", intrclass_names[i].desc); + seq_putc(p, '\n'); + } put_online_cpus(); - return 0; + return 0; } /* @@ -248,7 +222,7 @@ void __irq_entry do_extint(struct pt_regs *regs, struct ext_code ext_code, /* Serve timer interrupts first. */ clock_comparator_work(); } - kstat_incr_irqs_this_cpu(EXTERNAL_INTERRUPT, NULL); + kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++; if (ext_code.code != 0x1004) __get_cpu_var(s390_idle).nohz_delay = 1; diff --git a/trunk/arch/s390/kernel/nmi.c b/trunk/arch/s390/kernel/nmi.c index 7918fbea36bb..a6daa5c5cdb0 100644 --- a/trunk/arch/s390/kernel/nmi.c +++ b/trunk/arch/s390/kernel/nmi.c @@ -254,7 +254,7 @@ void notrace s390_do_machine_check(struct pt_regs *regs) int umode; nmi_enter(); - inc_irq_stat(NMI_NMI); + kstat_cpu(smp_processor_id()).irqs[NMI_NMI]++; mci = (struct mci *) &S390_lowcore.mcck_interruption_code; mcck = &__get_cpu_var(cpu_mcck); umode = user_mode(regs); diff --git a/trunk/arch/s390/kernel/perf_cpum_cf.c b/trunk/arch/s390/kernel/perf_cpum_cf.c index 86ec7447e1f5..c4e7269d4a09 100644 --- a/trunk/arch/s390/kernel/perf_cpum_cf.c +++ b/trunk/arch/s390/kernel/perf_cpum_cf.c @@ -229,7 +229,7 @@ static void cpumf_measurement_alert(struct ext_code ext_code, if (!(alert & CPU_MF_INT_CF_MASK)) return; - inc_irq_stat(IRQEXT_CMC); + kstat_cpu(smp_processor_id()).irqs[EXTINT_CMC]++; cpuhw = &__get_cpu_var(cpu_hw_events); /* Measurement alerts are shared and might happen when the PMU diff --git a/trunk/arch/s390/kernel/runtime_instr.c b/trunk/arch/s390/kernel/runtime_instr.c index 077a99389b07..61066f6f71a5 100644 --- a/trunk/arch/s390/kernel/runtime_instr.c +++ b/trunk/arch/s390/kernel/runtime_instr.c @@ -71,7 +71,7 @@ static void runtime_instr_int_handler(struct ext_code ext_code, if (!(param32 & CPU_MF_INT_RI_MASK)) return; - inc_irq_stat(IRQEXT_CMR); + kstat_cpu(smp_processor_id()).irqs[EXTINT_CMR]++; if (!current->thread.ri_cb) return; diff --git a/trunk/arch/s390/kernel/setup.c b/trunk/arch/s390/kernel/setup.c index a5360de85ec7..2568590973ad 100644 --- a/trunk/arch/s390/kernel/setup.c +++ b/trunk/arch/s390/kernel/setup.c @@ -16,7 +16,7 @@ #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt #include -#include +#include #include #include #include @@ -289,7 +289,6 @@ void machine_power_off(void) * Dummy power off function. */ void (*pm_power_off)(void) = machine_power_off; -EXPORT_SYMBOL_GPL(pm_power_off); static int __init early_parse_mem(char *p) { diff --git a/trunk/arch/s390/kernel/smp.c b/trunk/arch/s390/kernel/smp.c index 7433a2f9e5cc..0b45baa55438 100644 --- a/trunk/arch/s390/kernel/smp.c +++ b/trunk/arch/s390/kernel/smp.c @@ -433,9 +433,9 @@ static void do_ext_call_interrupt(struct ext_code ext_code, cpu = smp_processor_id(); if (ext_code.code == 0x1202) - inc_irq_stat(IRQEXT_EXC); + kstat_cpu(cpu).irqs[EXTINT_EXC]++; else - inc_irq_stat(IRQEXT_EMS); + kstat_cpu(cpu).irqs[EXTINT_EMS]++; /* * handle bit signal external calls */ @@ -623,10 +623,9 @@ static struct sclp_cpu_info *smp_get_cpu_info(void) return info; } -static int __cpuinit smp_add_present_cpu(int cpu); +static int smp_add_present_cpu(int cpu); -static int __cpuinit __smp_rescan_cpus(struct sclp_cpu_info *info, - int sysfs_add) +static int __smp_rescan_cpus(struct sclp_cpu_info *info, int sysfs_add) { struct pcpu *pcpu; cpumask_t avail; @@ -709,7 +708,6 @@ static void __cpuinit smp_start_secondary(void *cpuvoid) pfault_init(); notify_cpu_starting(smp_processor_id()); set_cpu_online(smp_processor_id(), true); - inc_irq_stat(CPU_RST); local_irq_enable(); /* cpu_idle will call schedule for us */ cpu_idle(); @@ -987,7 +985,7 @@ static int __cpuinit smp_cpu_notify(struct notifier_block *self, return notifier_from_errno(err); } -static int __cpuinit smp_add_present_cpu(int cpu) +static int smp_add_present_cpu(int cpu) { struct cpu *c = &pcpu_devices[cpu].cpu; struct device *s = &c->dev; diff --git a/trunk/arch/s390/kernel/syscalls.S b/trunk/arch/s390/kernel/syscalls.S index 6a6c61f94dd3..48174850f3b0 100644 --- a/trunk/arch/s390/kernel/syscalls.S +++ b/trunk/arch/s390/kernel/syscalls.S @@ -352,4 +352,3 @@ SYSCALL(sys_process_vm_readv,sys_process_vm_readv,compat_sys_process_vm_readv_wr SYSCALL(sys_process_vm_writev,sys_process_vm_writev,compat_sys_process_vm_writev_wrapper) SYSCALL(sys_ni_syscall,sys_s390_runtime_instr,sys_s390_runtime_instr_wrapper) SYSCALL(sys_kcmp,sys_kcmp,sys_kcmp_wrapper) -SYSCALL(sys_finit_module,sys_finit_module,sys_finit_module_wrapper) diff --git a/trunk/arch/s390/kernel/time.c b/trunk/arch/s390/kernel/time.c index a5f4f5a1d24b..7fcd690d42c7 100644 --- a/trunk/arch/s390/kernel/time.c +++ b/trunk/arch/s390/kernel/time.c @@ -63,7 +63,7 @@ static DEFINE_PER_CPU(struct clock_event_device, comparators); */ unsigned long long notrace __kprobes sched_clock(void) { - return tod_to_ns(get_clock_monotonic()); + return (get_clock_monotonic() * 125) >> 9; } /* @@ -168,7 +168,7 @@ static void clock_comparator_interrupt(struct ext_code ext_code, unsigned int param32, unsigned long param64) { - inc_irq_stat(IRQEXT_CLK); + kstat_cpu(smp_processor_id()).irqs[EXTINT_CLK]++; if (S390_lowcore.clock_comparator == -1ULL) set_clock_comparator(S390_lowcore.clock_comparator); } @@ -179,7 +179,7 @@ static void stp_timing_alert(struct stp_irq_parm *); static void timing_alert_interrupt(struct ext_code ext_code, unsigned int param32, unsigned long param64) { - inc_irq_stat(IRQEXT_TLA); + kstat_cpu(smp_processor_id()).irqs[EXTINT_TLA]++; if (param32 & 0x00c40000) etr_timing_alert((struct etr_irq_parm *) ¶m32); if (param32 & 0x00038000) diff --git a/trunk/arch/s390/kernel/topology.c b/trunk/arch/s390/kernel/topology.c index 4b2e3e317004..f1aba87cceb8 100644 --- a/trunk/arch/s390/kernel/topology.c +++ b/trunk/arch/s390/kernel/topology.c @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -43,7 +42,6 @@ static struct mask_info socket_info; static struct mask_info book_info; struct cpu_topology_s390 cpu_topology[NR_CPUS]; -EXPORT_SYMBOL_GPL(cpu_topology); static cpumask_t cpu_group_map(struct mask_info *info, unsigned int cpu) { diff --git a/trunk/arch/s390/kvm/interrupt.c b/trunk/arch/s390/kvm/interrupt.c index 82c481ddef76..c30615e605ac 100644 --- a/trunk/arch/s390/kvm/interrupt.c +++ b/trunk/arch/s390/kvm/interrupt.c @@ -408,7 +408,7 @@ int kvm_s390_handle_wait(struct kvm_vcpu *vcpu) return 0; } - sltime = tod_to_ns(vcpu->arch.sie_block->ckc - now); + sltime = ((vcpu->arch.sie_block->ckc - now)*125)>>9; hrtimer_start(&vcpu->arch.ckc_timer, ktime_set (0, sltime) , HRTIMER_MODE_REL); VCPU_EVENT(vcpu, 5, "enabled wait via clock comparator: %llx ns", sltime); diff --git a/trunk/arch/s390/kvm/kvm-s390.c b/trunk/arch/s390/kvm/kvm-s390.c index f090e819bf71..c9011bfaabbe 100644 --- a/trunk/arch/s390/kvm/kvm-s390.c +++ b/trunk/arch/s390/kvm/kvm-s390.c @@ -613,9 +613,7 @@ static int __vcpu_run(struct kvm_vcpu *vcpu) kvm_s390_deliver_pending_interrupts(vcpu); vcpu->arch.sie_block->icptcode = 0; - preempt_disable(); kvm_guest_enter(); - preempt_enable(); VCPU_EVENT(vcpu, 6, "entering sie flags %x", atomic_read(&vcpu->arch.sie_block->cpuflags)); trace_kvm_s390_sie_enter(vcpu, diff --git a/trunk/arch/s390/mm/fault.c b/trunk/arch/s390/mm/fault.c index 2fb9e63b8fc4..42601d6e166f 100644 --- a/trunk/arch/s390/mm/fault.c +++ b/trunk/arch/s390/mm/fault.c @@ -569,7 +569,7 @@ static void pfault_interrupt(struct ext_code ext_code, subcode = ext_code.subcode; if ((subcode & 0xff00) != __SUBCODE_MASK) return; - inc_irq_stat(IRQEXT_PFL); + kstat_cpu(smp_processor_id()).irqs[EXTINT_PFL]++; /* Get the token (= pid of the affected task). */ pid = sizeof(void *) == 4 ? param32 : param64; rcu_read_lock(); diff --git a/trunk/arch/s390/oprofile/hwsampler.c b/trunk/arch/s390/oprofile/hwsampler.c index b5b2916895e0..0cb385da202c 100644 --- a/trunk/arch/s390/oprofile/hwsampler.c +++ b/trunk/arch/s390/oprofile/hwsampler.c @@ -233,7 +233,7 @@ static void hws_ext_handler(struct ext_code ext_code, if (!(param32 & CPU_MF_INT_SF_MASK)) return; - inc_irq_stat(IRQEXT_CMS); + kstat_cpu(smp_processor_id()).irqs[EXTINT_CMS]++; atomic_xchg(&cb->ext_params, atomic_read(&cb->ext_params) | param32); if (hws_wq) diff --git a/trunk/arch/s390/pci/pci.c b/trunk/arch/s390/pci/pci.c index 60e0372545d2..ff49427e9941 100644 --- a/trunk/arch/s390/pci/pci.c +++ b/trunk/arch/s390/pci/pci.c @@ -160,6 +160,35 @@ int pci_proc_domain(struct pci_bus *bus) } EXPORT_SYMBOL_GPL(pci_proc_domain); +/* Store PCI function information block */ +static int zpci_store_fib(struct zpci_dev *zdev, u8 *fc) +{ + struct zpci_fib *fib; + u8 status, cc; + + fib = (void *) get_zeroed_page(GFP_KERNEL); + if (!fib) + return -ENOMEM; + + do { + cc = __stpcifc(zdev->fh, 0, fib, &status); + if (cc == 2) { + msleep(ZPCI_INSN_BUSY_DELAY); + memset(fib, 0, PAGE_SIZE); + } + } while (cc == 2); + + if (cc) + pr_err_once("%s: cc: %u status: %u\n", + __func__, cc, status); + + /* Return PCI function controls */ + *fc = fib->fc; + + free_page((unsigned long) fib); + return (cc) ? -EIO : 0; +} + /* Modify PCI: Register adapter interruptions */ static int zpci_register_airq(struct zpci_dev *zdev, unsigned int aisb, u64 aibv) @@ -440,7 +469,7 @@ static void zpci_irq_handler(void *dont, void *need) int rescan = 0, max = aisb_max; struct zdev_irq_map *imap; - inc_irq_stat(IRQIO_PCI); + kstat_cpu(smp_processor_id()).irqs[IOINT_PCI]++; sbit = start; scan: @@ -452,7 +481,7 @@ static void zpci_irq_handler(void *dont, void *need) /* find vector bit */ imap = bucket->imap[sbit]; for_each_set_bit_left(mbit, &imap->aibv, imap->msi_vecs) { - inc_irq_stat(IRQIO_MSI); + kstat_cpu(smp_processor_id()).irqs[IOINT_MSI]++; clear_bit(63 - mbit, &imap->aibv); spin_lock(&imap->lock); diff --git a/trunk/arch/s390/pci/pci_dma.c b/trunk/arch/s390/pci/pci_dma.c index a547419907c3..6138468b420f 100644 --- a/trunk/arch/s390/pci/pci_dma.c +++ b/trunk/arch/s390/pci/pci_dma.c @@ -13,6 +13,8 @@ #include #include +static enum zpci_ioat_dtype zpci_ioat_dt = ZPCI_IOTA_RTTO; + static struct kmem_cache *dma_region_table_cache; static struct kmem_cache *dma_page_table_cache; diff --git a/trunk/arch/sh/boards/mach-ecovec24/setup.c b/trunk/arch/sh/boards/mach-ecovec24/setup.c index a0fa5791cd44..3fede4556c91 100644 --- a/trunk/arch/sh/boards/mach-ecovec24/setup.c +++ b/trunk/arch/sh/boards/mach-ecovec24/setup.c @@ -70,16 +70,6 @@ * OFF-ON : MMC */ -/* - * FSI - DA7210 - * - * it needs amixer settings for playing - * - * amixer set 'HeadPhone' 80 - * amixer set 'Out Mixer Left DAC Left' on - * amixer set 'Out Mixer Right DAC Right' on - */ - /* Heartbeat */ static unsigned char led_pos[] = { 0, 1, 2, 3 }; diff --git a/trunk/arch/sh/include/asm/elf.h b/trunk/arch/sh/include/asm/elf.h index bf9f44f17c29..37924afa8d8a 100644 --- a/trunk/arch/sh/include/asm/elf.h +++ b/trunk/arch/sh/include/asm/elf.h @@ -203,9 +203,9 @@ extern void __kernel_vsyscall; if (vdso_enabled) \ NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_BASE); \ else \ - NEW_AUX_ENT(AT_IGNORE, 0) + NEW_AUX_ENT(AT_IGNORE, 0); #else -#define VSYSCALL_AUX_ENT NEW_AUX_ENT(AT_IGNORE, 0) +#define VSYSCALL_AUX_ENT #endif /* CONFIG_VSYSCALL */ #ifdef CONFIG_SH_FPU diff --git a/trunk/arch/sh/include/asm/processor_32.h b/trunk/arch/sh/include/asm/processor_32.h index e699a12cdcca..b1320d55ca30 100644 --- a/trunk/arch/sh/include/asm/processor_32.h +++ b/trunk/arch/sh/include/asm/processor_32.h @@ -39,7 +39,7 @@ /* This decides where the kernel will search for a free chunk of vm * space during mmap's. */ -#define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE / 3) +#define TASK_UNMAPPED_BASE (TASK_SIZE / 3) /* * Bit of SR register diff --git a/trunk/arch/sh/include/asm/processor_64.h b/trunk/arch/sh/include/asm/processor_64.h index 1cc7d3197143..1ee8946f0952 100644 --- a/trunk/arch/sh/include/asm/processor_64.h +++ b/trunk/arch/sh/include/asm/processor_64.h @@ -47,7 +47,7 @@ pc; }) /* This decides where the kernel will search for a free chunk of vm * space during mmap's. */ -#define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE / 3) +#define TASK_UNMAPPED_BASE (TASK_SIZE / 3) /* * Bit of SR register diff --git a/trunk/arch/sh/include/uapi/asm/unistd_32.h b/trunk/arch/sh/include/uapi/asm/unistd_32.h index d13a1d623736..9e465f246dc1 100644 --- a/trunk/arch/sh/include/uapi/asm/unistd_32.h +++ b/trunk/arch/sh/include/uapi/asm/unistd_32.h @@ -379,8 +379,7 @@ #define __NR_process_vm_readv 365 #define __NR_process_vm_writev 366 #define __NR_kcmp 367 -#define __NR_finit_module 368 -#define NR_syscalls 369 +#define NR_syscalls 368 #endif /* __ASM_SH_UNISTD_32_H */ diff --git a/trunk/arch/sh/include/uapi/asm/unistd_64.h b/trunk/arch/sh/include/uapi/asm/unistd_64.h index e6820c86e8c7..8e3a2edd284e 100644 --- a/trunk/arch/sh/include/uapi/asm/unistd_64.h +++ b/trunk/arch/sh/include/uapi/asm/unistd_64.h @@ -399,8 +399,7 @@ #define __NR_process_vm_readv 376 #define __NR_process_vm_writev 377 #define __NR_kcmp 378 -#define __NR_finit_module 379 -#define NR_syscalls 380 +#define NR_syscalls 379 #endif /* __ASM_SH_UNISTD_64_H */ diff --git a/trunk/arch/sh/kernel/syscalls_32.S b/trunk/arch/sh/kernel/syscalls_32.S index 734234be2f01..fe97ae5e56f1 100644 --- a/trunk/arch/sh/kernel/syscalls_32.S +++ b/trunk/arch/sh/kernel/syscalls_32.S @@ -385,4 +385,3 @@ ENTRY(sys_call_table) .long sys_process_vm_readv /* 365 */ .long sys_process_vm_writev .long sys_kcmp - .long sys_finit_module diff --git a/trunk/arch/sh/kernel/syscalls_64.S b/trunk/arch/sh/kernel/syscalls_64.S index 579fcb9a896b..5c7b1c67bdc1 100644 --- a/trunk/arch/sh/kernel/syscalls_64.S +++ b/trunk/arch/sh/kernel/syscalls_64.S @@ -405,4 +405,3 @@ sys_call_table: .long sys_process_vm_readv .long sys_process_vm_writev .long sys_kcmp - .long sys_finit_module diff --git a/trunk/arch/sh/lib/mcount.S b/trunk/arch/sh/lib/mcount.S index 52aa2011d753..60164e65d665 100644 --- a/trunk/arch/sh/lib/mcount.S +++ b/trunk/arch/sh/lib/mcount.S @@ -294,8 +294,6 @@ stack_panic: .align 2 .L_init_thread_union: .long init_thread_union -.L_ebss: - .long __bss_stop .Lpanic: .long panic .Lpanic_s: diff --git a/trunk/arch/sparc/include/uapi/asm/unistd.h b/trunk/arch/sparc/include/uapi/asm/unistd.h index 62ced589bcf7..cac719d1bc5c 100644 --- a/trunk/arch/sparc/include/uapi/asm/unistd.h +++ b/trunk/arch/sparc/include/uapi/asm/unistd.h @@ -407,9 +407,8 @@ #define __NR_process_vm_writev 339 #define __NR_kern_features 340 #define __NR_kcmp 341 -#define __NR_finit_module 342 -#define NR_syscalls 343 +#define NR_syscalls 342 /* Bitmask values returned from kern_features system call. */ #define KERN_FEATURE_MIXED_MODE_STACK 0x00000001 diff --git a/trunk/arch/sparc/kernel/pci.c b/trunk/arch/sparc/kernel/pci.c index baf4366e2d6a..04bacce76fe6 100644 --- a/trunk/arch/sparc/kernel/pci.c +++ b/trunk/arch/sparc/kernel/pci.c @@ -378,8 +378,7 @@ static void apb_calc_first_last(u8 map, u32 *first_p, u32 *last_p) /* Cook up fake bus resources for SUNW,simba PCI bridges which lack * a proper 'ranges' property. */ -static void apb_fake_ranges(struct pci_dev *dev, - struct pci_bus *bus, +static void apb_fake_ranges(struct pci_dev *dev, struct pci_bus *bus, struct pci_pbm_info *pbm) { struct pci_bus_region region; @@ -404,15 +403,13 @@ static void apb_fake_ranges(struct pci_dev *dev, pcibios_bus_to_resource(dev, res, ®ion); } -static void pci_of_scan_bus(struct pci_pbm_info *pbm, - struct device_node *node, +static void pci_of_scan_bus(struct pci_pbm_info *pbm, struct device_node *node, struct pci_bus *bus); #define GET_64BIT(prop, i) ((((u64) (prop)[(i)]) << 32) | (prop)[(i)+1]) static void of_scan_pci_bridge(struct pci_pbm_info *pbm, - struct device_node *node, - struct pci_dev *dev) + struct device_node *node, struct pci_dev *dev) { struct pci_bus *bus; const u32 *busrange, *ranges; @@ -503,8 +500,7 @@ static void of_scan_pci_bridge(struct pci_pbm_info *pbm, pci_of_scan_bus(pbm, node, bus); } -static void pci_of_scan_bus(struct pci_pbm_info *pbm, - struct device_node *node, +static void pci_of_scan_bus(struct pci_pbm_info *pbm, struct device_node *node, struct pci_bus *bus) { struct device_node *child; diff --git a/trunk/arch/sparc/kernel/pci_psycho.c b/trunk/arch/sparc/kernel/pci_psycho.c index c647634ead2b..b85238289717 100644 --- a/trunk/arch/sparc/kernel/pci_psycho.c +++ b/trunk/arch/sparc/kernel/pci_psycho.c @@ -366,8 +366,7 @@ static void pbm_config_busmastering(struct pci_pbm_info *pbm) pci_config_write8(addr, 64); } -static void psycho_scan_bus(struct pci_pbm_info *pbm, - struct device *parent) +static void psycho_scan_bus(struct pci_pbm_info *pbm, struct device *parent) { pbm_config_busmastering(pbm); pbm->is_66mhz_capable = 0; diff --git a/trunk/arch/sparc/kernel/pci_sabre.c b/trunk/arch/sparc/kernel/pci_sabre.c index 6f00d27e8dac..531186d7c9ab 100644 --- a/trunk/arch/sparc/kernel/pci_sabre.c +++ b/trunk/arch/sparc/kernel/pci_sabre.c @@ -442,8 +442,7 @@ static void sabre_scan_bus(struct pci_pbm_info *pbm, struct device *parent) sabre_register_error_handlers(pbm); } -static void sabre_pbm_init(struct pci_pbm_info *pbm, - struct platform_device *op) +static void sabre_pbm_init(struct pci_pbm_info *pbm, struct platform_device *op) { psycho_pbm_init_common(pbm, op, "SABRE", PBM_CHIP_TYPE_SABRE); pbm->pci_afsr = pbm->controller_regs + SABRE_PIOAFSR; diff --git a/trunk/arch/sparc/kernel/pci_schizo.c b/trunk/arch/sparc/kernel/pci_schizo.c index 8f76f23dac38..29e888158ae6 100644 --- a/trunk/arch/sparc/kernel/pci_schizo.c +++ b/trunk/arch/sparc/kernel/pci_schizo.c @@ -1306,9 +1306,8 @@ static void schizo_pbm_hw_init(struct pci_pbm_info *pbm) } } -static int schizo_pbm_init(struct pci_pbm_info *pbm, - struct platform_device *op, u32 portid, - int chip_type) +static int schizo_pbm_init(struct pci_pbm_info *pbm, struct platform_device *op, + u32 portid, int chip_type) { const struct linux_prom64_registers *regs; struct device_node *dp = op->dev.of_node; diff --git a/trunk/arch/sparc/kernel/systbls_32.S b/trunk/arch/sparc/kernel/systbls_32.S index 6ac43c36bbbf..5147f574f125 100644 --- a/trunk/arch/sparc/kernel/systbls_32.S +++ b/trunk/arch/sparc/kernel/systbls_32.S @@ -85,4 +85,4 @@ sys_call_table: /*325*/ .long sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init /*330*/ .long sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime /*335*/ .long sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev -/*340*/ .long sys_ni_syscall, sys_kcmp, sys_finit_module +/*340*/ .long sys_ni_syscall, sys_kcmp diff --git a/trunk/arch/sparc/kernel/systbls_64.S b/trunk/arch/sparc/kernel/systbls_64.S index 1009ecb92678..cdbd9b817751 100644 --- a/trunk/arch/sparc/kernel/systbls_64.S +++ b/trunk/arch/sparc/kernel/systbls_64.S @@ -86,7 +86,7 @@ sys_call_table32: .word compat_sys_pwritev, compat_sys_rt_tgsigqueueinfo, sys_perf_event_open, compat_sys_recvmmsg, sys_fanotify_init /*330*/ .word sys32_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, compat_sys_open_by_handle_at, compat_sys_clock_adjtime .word sys_syncfs, compat_sys_sendmmsg, sys_setns, compat_sys_process_vm_readv, compat_sys_process_vm_writev -/*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module +/*340*/ .word sys_kern_features, sys_kcmp #endif /* CONFIG_COMPAT */ @@ -164,4 +164,4 @@ sys_call_table: .word sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init /*330*/ .word sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime .word sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev -/*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module +/*340*/ .word sys_kern_features, sys_kcmp diff --git a/trunk/arch/x86/boot/compressed/eboot.c b/trunk/arch/x86/boot/compressed/eboot.c index 18e329ca108e..b1942e222768 100644 --- a/trunk/arch/x86/boot/compressed/eboot.c +++ b/trunk/arch/x86/boot/compressed/eboot.c @@ -302,7 +302,7 @@ static efi_status_t setup_efi_pci(struct boot_params *params) if (status != EFI_SUCCESS) continue; - if (!(attributes & EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM)) + if (!attributes & EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM) continue; if (!pci->romimage || !pci->romsize) diff --git a/trunk/arch/x86/kernel/cpu/perf_event.c b/trunk/arch/x86/kernel/cpu/perf_event.c index 6774c17a5576..4428fd178bce 100644 --- a/trunk/arch/x86/kernel/cpu/perf_event.c +++ b/trunk/arch/x86/kernel/cpu/perf_event.c @@ -340,6 +340,9 @@ int x86_setup_perfctr(struct perf_event *event) /* BTS is currently only allowed for user-mode. */ if (!attr->exclude_kernel) return -EOPNOTSUPP; + + if (!attr->exclude_guest) + return -EOPNOTSUPP; } hwc->config |= config; @@ -382,6 +385,9 @@ int x86_pmu_hw_config(struct perf_event *event) if (event->attr.precise_ip) { int precise = 0; + if (!event->attr.exclude_guest) + return -EOPNOTSUPP; + /* Support for constant skid */ if (x86_pmu.pebs_active && !x86_pmu.pebs_broken) { precise++; diff --git a/trunk/arch/x86/kernel/entry_32.S b/trunk/arch/x86/kernel/entry_32.S index 6ed91d9980e2..ff84d5469d77 100644 --- a/trunk/arch/x86/kernel/entry_32.S +++ b/trunk/arch/x86/kernel/entry_32.S @@ -1065,6 +1065,7 @@ ENTRY(xen_failsafe_callback) lea 16(%esp),%esp CFI_ADJUST_CFA_OFFSET -16 jz 5f + addl $16,%esp jmp iret_exc 5: pushl_cfi $-1 /* orig_ax = -1 => not a system call */ SAVE_ALL diff --git a/trunk/arch/x86/kernel/kvm.c b/trunk/arch/x86/kernel/kvm.c index 9c2bd8bd4b4c..08b973f64032 100644 --- a/trunk/arch/x86/kernel/kvm.c +++ b/trunk/arch/x86/kernel/kvm.c @@ -43,7 +43,6 @@ #include #include #include -#include static int kvmapf = 1; @@ -122,8 +121,6 @@ void kvm_async_pf_task_wait(u32 token) struct kvm_task_sleep_node n, *e; DEFINE_WAIT(wait); - rcu_irq_enter(); - spin_lock(&b->lock); e = _find_apf_task(b, token); if (e) { @@ -131,8 +128,6 @@ void kvm_async_pf_task_wait(u32 token) hlist_del(&e->link); kfree(e); spin_unlock(&b->lock); - - rcu_irq_exit(); return; } @@ -157,16 +152,13 @@ void kvm_async_pf_task_wait(u32 token) /* * We cannot reschedule. So halt. */ - rcu_irq_exit(); native_safe_halt(); - rcu_irq_enter(); local_irq_disable(); } } if (!n.halted) finish_wait(&n.wq, &wait); - rcu_irq_exit(); return; } EXPORT_SYMBOL_GPL(kvm_async_pf_task_wait); @@ -260,10 +252,10 @@ do_async_page_fault(struct pt_regs *regs, unsigned long error_code) break; case KVM_PV_REASON_PAGE_NOT_PRESENT: /* page is swapped out by the host. */ - exception_enter(regs); + rcu_irq_enter(); exit_idle(); kvm_async_pf_task_wait((u32)read_cr2()); - exception_exit(regs); + rcu_irq_exit(); break; case KVM_PV_REASON_PAGE_READY: rcu_irq_enter(); diff --git a/trunk/arch/x86/kernel/setup.c b/trunk/arch/x86/kernel/setup.c index 00f6c1472b85..23ddd558fbd5 100644 --- a/trunk/arch/x86/kernel/setup.c +++ b/trunk/arch/x86/kernel/setup.c @@ -610,83 +610,6 @@ static __init void reserve_ibft_region(void) static unsigned reserve_low = CONFIG_X86_RESERVE_LOW << 10; -static bool __init snb_gfx_workaround_needed(void) -{ -#ifdef CONFIG_PCI - int i; - u16 vendor, devid; - static const __initconst u16 snb_ids[] = { - 0x0102, - 0x0112, - 0x0122, - 0x0106, - 0x0116, - 0x0126, - 0x010a, - }; - - /* Assume no if something weird is going on with PCI */ - if (!early_pci_allowed()) - return false; - - vendor = read_pci_config_16(0, 2, 0, PCI_VENDOR_ID); - if (vendor != 0x8086) - return false; - - devid = read_pci_config_16(0, 2, 0, PCI_DEVICE_ID); - for (i = 0; i < ARRAY_SIZE(snb_ids); i++) - if (devid == snb_ids[i]) - return true; -#endif - - return false; -} - -/* - * Sandy Bridge graphics has trouble with certain ranges, exclude - * them from allocation. - */ -static void __init trim_snb_memory(void) -{ - static const __initconst unsigned long bad_pages[] = { - 0x20050000, - 0x20110000, - 0x20130000, - 0x20138000, - 0x40004000, - }; - int i; - - if (!snb_gfx_workaround_needed()) - return; - - printk(KERN_DEBUG "reserving inaccessible SNB gfx pages\n"); - - /* - * Reserve all memory below the 1 MB mark that has not - * already been reserved. - */ - memblock_reserve(0, 1<<20); - - for (i = 0; i < ARRAY_SIZE(bad_pages); i++) { - if (memblock_reserve(bad_pages[i], PAGE_SIZE)) - printk(KERN_WARNING "failed to reserve 0x%08lx\n", - bad_pages[i]); - } -} - -/* - * Here we put platform-specific memory range workarounds, i.e. - * memory known to be corrupt or otherwise in need to be reserved on - * specific platforms. - * - * If this gets used more widely it could use a real dispatch mechanism. - */ -static void __init trim_platform_memory_ranges(void) -{ - trim_snb_memory(); -} - static void __init trim_bios_range(void) { /* @@ -707,7 +630,6 @@ static void __init trim_bios_range(void) * take them out. */ e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1); - sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); } @@ -986,8 +908,6 @@ void __init setup_arch(char **cmdline_p) setup_real_mode(); - trim_platform_memory_ranges(); - init_gbpages(); /* max_pfn_mapped is updated here */ diff --git a/trunk/arch/x86/kernel/step.c b/trunk/arch/x86/kernel/step.c index 9b4d51d0c0d0..cd3b2438a980 100644 --- a/trunk/arch/x86/kernel/step.c +++ b/trunk/arch/x86/kernel/step.c @@ -165,11 +165,10 @@ void set_task_blockstep(struct task_struct *task, bool on) * Ensure irq/preemption can't change debugctl in between. * Note also that both TIF_BLOCKSTEP and debugctl should * be changed atomically wrt preemption. - * - * NOTE: this means that set/clear TIF_BLOCKSTEP is only safe if - * task is current or it can't be running, otherwise we can race - * with __switch_to_xtra(). We rely on ptrace_freeze_traced() but - * PTRACE_KILL is not safe. + * FIXME: this means that set/clear TIF_BLOCKSTEP is simply + * wrong if task != current, SIGKILL can wakeup the stopped + * tracee and set/clear can play with the running task, this + * can confuse the next __switch_to_xtra(). */ local_irq_disable(); debugctl = get_debugctlmsr(); diff --git a/trunk/arch/x86/kvm/x86.c b/trunk/arch/x86/kvm/x86.c index c243b81e3c74..76f54461f7cb 100644 --- a/trunk/arch/x86/kvm/x86.c +++ b/trunk/arch/x86/kvm/x86.c @@ -120,7 +120,7 @@ struct kvm_shared_msrs { }; static struct kvm_shared_msrs_global __read_mostly shared_msrs_global; -static struct kvm_shared_msrs __percpu *shared_msrs; +static DEFINE_PER_CPU(struct kvm_shared_msrs, shared_msrs); struct kvm_stats_debugfs_item debugfs_entries[] = { { "pf_fixed", VCPU_STAT(pf_fixed) }, @@ -191,10 +191,10 @@ static void kvm_on_user_return(struct user_return_notifier *urn) static void shared_msr_update(unsigned slot, u32 msr) { + struct kvm_shared_msrs *smsr; u64 value; - unsigned int cpu = smp_processor_id(); - struct kvm_shared_msrs *smsr = per_cpu_ptr(shared_msrs, cpu); + smsr = &__get_cpu_var(shared_msrs); /* only read, and nobody should modify it at this time, * so don't need lock */ if (slot >= shared_msrs_global.nr) { @@ -226,8 +226,7 @@ static void kvm_shared_msr_cpu_online(void) void kvm_set_shared_msr(unsigned slot, u64 value, u64 mask) { - unsigned int cpu = smp_processor_id(); - struct kvm_shared_msrs *smsr = per_cpu_ptr(shared_msrs, cpu); + struct kvm_shared_msrs *smsr = &__get_cpu_var(shared_msrs); if (((value ^ smsr->values[slot].curr) & mask) == 0) return; @@ -243,8 +242,7 @@ EXPORT_SYMBOL_GPL(kvm_set_shared_msr); static void drop_user_return_notifiers(void *ignore) { - unsigned int cpu = smp_processor_id(); - struct kvm_shared_msrs *smsr = per_cpu_ptr(shared_msrs, cpu); + struct kvm_shared_msrs *smsr = &__get_cpu_var(shared_msrs); if (smsr->registered) kvm_on_user_return(&smsr->urn); @@ -5235,16 +5233,9 @@ int kvm_arch_init(void *opaque) goto out; } - r = -ENOMEM; - shared_msrs = alloc_percpu(struct kvm_shared_msrs); - if (!shared_msrs) { - printk(KERN_ERR "kvm: failed to allocate percpu kvm_shared_msrs\n"); - goto out; - } - r = kvm_mmu_module_init(); if (r) - goto out_free_percpu; + goto out; kvm_set_mmio_spte_mask(); kvm_init_msr_list(); @@ -5267,8 +5258,6 @@ int kvm_arch_init(void *opaque) return 0; -out_free_percpu: - free_percpu(shared_msrs); out: return r; } @@ -5286,7 +5275,6 @@ void kvm_arch_exit(void) #endif kvm_x86_ops = NULL; kvm_mmu_module_exit(); - free_percpu(shared_msrs); } int kvm_emulate_halt(struct kvm_vcpu *vcpu) diff --git a/trunk/arch/x86/xen/smp.c b/trunk/arch/x86/xen/smp.c index 34bc4cee8887..4f7d2599b484 100644 --- a/trunk/arch/x86/xen/smp.c +++ b/trunk/arch/x86/xen/smp.c @@ -432,6 +432,13 @@ static void __cpuinit xen_play_dead(void) /* used only with HOTPLUG_CPU */ play_dead_common(); HYPERVISOR_vcpu_op(VCPUOP_down, smp_processor_id(), NULL); cpu_bringup(); + /* + * Balance out the preempt calls - as we are running in cpu_idle + * loop which has been called at bootup from cpu_bringup_and_idle. + * The cpucpu_bringup_and_idle called cpu_bringup which made a + * preempt_disable() So this preempt_enable will balance it out. + */ + preempt_enable(); } #else /* !CONFIG_HOTPLUG_CPU */ diff --git a/trunk/drivers/acpi/acpi_memhotplug.c b/trunk/drivers/acpi/acpi_memhotplug.c index b679bf8478f7..eb30e5ab4cab 100644 --- a/trunk/drivers/acpi/acpi_memhotplug.c +++ b/trunk/drivers/acpi/acpi_memhotplug.c @@ -226,6 +226,16 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) struct acpi_memory_info *info; int node; + + /* Get the range from the _CRS */ + result = acpi_memory_get_device_resources(mem_device); + if (result) { + dev_err(&mem_device->device->dev, + "get_device_resources failed\n"); + mem_device->state = MEMORY_INVALID_STATE; + return result; + } + node = acpi_get_node(mem_device->device->handle); /* * Tell the VM there is more memory here... @@ -332,6 +342,14 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) break; } + if (acpi_memory_check_device(mem_device)) + break; + + if (acpi_memory_enable_device(mem_device)) { + acpi_handle_err(handle,"Cannot enable memory device\n"); + break; + } + ost_code = ACPI_OST_SC_SUCCESS; break; diff --git a/trunk/drivers/acpi/acpica/Makefile b/trunk/drivers/acpi/acpica/Makefile index bc7a03ded064..c8bc24bd1f72 100644 --- a/trunk/drivers/acpi/acpica/Makefile +++ b/trunk/drivers/acpi/acpica/Makefile @@ -162,5 +162,5 @@ acpi-y += \ utxferror.o \ utxfmutex.o -acpi-$(ACPI_FUTURE_USAGE) += uttrack.o utcache.o +acpi-$(ACPI_FUTURE_USAGE) += uttrack.o utcache.o utclib.o diff --git a/trunk/drivers/acpi/acpica/utclib.c b/trunk/drivers/acpi/acpica/utclib.c new file mode 100644 index 000000000000..19ea4755aa73 --- /dev/null +++ b/trunk/drivers/acpi/acpica/utclib.c @@ -0,0 +1,749 @@ +/****************************************************************************** + * + * Module Name: cmclib - Local implementation of C library functions + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2012, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#include +#include "accommon.h" + +/* + * These implementations of standard C Library routines can optionally be + * used if a C library is not available. In general, they are less efficient + * than an inline or assembly implementation + */ + +#define _COMPONENT ACPI_UTILITIES +ACPI_MODULE_NAME("cmclib") + +#ifndef ACPI_USE_SYSTEM_CLIBRARY +#define NEGATIVE 1 +#define POSITIVE 0 +/******************************************************************************* + * + * FUNCTION: acpi_ut_memcmp (memcmp) + * + * PARAMETERS: buffer1 - First Buffer + * buffer2 - Second Buffer + * count - Maximum # of bytes to compare + * + * RETURN: Index where Buffers mismatched, or 0 if Buffers matched + * + * DESCRIPTION: Compare two Buffers, with a maximum length + * + ******************************************************************************/ +int acpi_ut_memcmp(const char *buffer1, const char *buffer2, acpi_size count) +{ + + return ((count == ACPI_SIZE_MAX) ? 0 : ((unsigned char)*buffer1 - + (unsigned char)*buffer2)); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_memcpy (memcpy) + * + * PARAMETERS: dest - Target of the copy + * src - Source buffer to copy + * count - Number of bytes to copy + * + * RETURN: Dest + * + * DESCRIPTION: Copy arbitrary bytes of memory + * + ******************************************************************************/ + +void *acpi_ut_memcpy(void *dest, const void *src, acpi_size count) +{ + char *new = (char *)dest; + char *old = (char *)src; + + while (count) { + *new = *old; + new++; + old++; + count--; + } + + return (dest); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_memset (memset) + * + * PARAMETERS: dest - Buffer to set + * value - Value to set each byte of memory + * count - Number of bytes to set + * + * RETURN: Dest + * + * DESCRIPTION: Initialize a buffer to a known value. + * + ******************************************************************************/ + +void *acpi_ut_memset(void *dest, u8 value, acpi_size count) +{ + char *new = (char *)dest; + + while (count) { + *new = (char)value; + new++; + count--; + } + + return (dest); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_strlen (strlen) + * + * PARAMETERS: string - Null terminated string + * + * RETURN: Length + * + * DESCRIPTION: Returns the length of the input string + * + ******************************************************************************/ + +acpi_size acpi_ut_strlen(const char *string) +{ + u32 length = 0; + + /* Count the string until a null is encountered */ + + while (*string) { + length++; + string++; + } + + return (length); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_strcpy (strcpy) + * + * PARAMETERS: dst_string - Target of the copy + * src_string - The source string to copy + * + * RETURN: dst_string + * + * DESCRIPTION: Copy a null terminated string + * + ******************************************************************************/ + +char *acpi_ut_strcpy(char *dst_string, const char *src_string) +{ + char *string = dst_string; + + /* Move bytes brute force */ + + while (*src_string) { + *string = *src_string; + + string++; + src_string++; + } + + /* Null terminate */ + + *string = 0; + return (dst_string); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_strncpy (strncpy) + * + * PARAMETERS: dst_string - Target of the copy + * src_string - The source string to copy + * count - Maximum # of bytes to copy + * + * RETURN: dst_string + * + * DESCRIPTION: Copy a null terminated string, with a maximum length + * + ******************************************************************************/ + +char *acpi_ut_strncpy(char *dst_string, const char *src_string, acpi_size count) +{ + char *string = dst_string; + + /* Copy the string */ + + for (string = dst_string; + count && (count--, (*string++ = *src_string++));) {; + } + + /* Pad with nulls if necessary */ + + while (count--) { + *string = 0; + string++; + } + + /* Return original pointer */ + + return (dst_string); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_strcmp (strcmp) + * + * PARAMETERS: string1 - First string + * string2 - Second string + * + * RETURN: Index where strings mismatched, or 0 if strings matched + * + * DESCRIPTION: Compare two null terminated strings + * + ******************************************************************************/ + +int acpi_ut_strcmp(const char *string1, const char *string2) +{ + + for (; (*string1 == *string2); string2++) { + if (!*string1++) { + return (0); + } + } + + return ((unsigned char)*string1 - (unsigned char)*string2); +} + +#ifdef ACPI_FUTURE_IMPLEMENTATION +/* Not used at this time */ +/******************************************************************************* + * + * FUNCTION: acpi_ut_strchr (strchr) + * + * PARAMETERS: string - Search string + * ch - character to search for + * + * RETURN: Ptr to char or NULL if not found + * + * DESCRIPTION: Search a string for a character + * + ******************************************************************************/ + +char *acpi_ut_strchr(const char *string, int ch) +{ + + for (; (*string); string++) { + if ((*string) == (char)ch) { + return ((char *)string); + } + } + + return (NULL); +} +#endif + +/******************************************************************************* + * + * FUNCTION: acpi_ut_strncmp (strncmp) + * + * PARAMETERS: string1 - First string + * string2 - Second string + * count - Maximum # of bytes to compare + * + * RETURN: Index where strings mismatched, or 0 if strings matched + * + * DESCRIPTION: Compare two null terminated strings, with a maximum length + * + ******************************************************************************/ + +int acpi_ut_strncmp(const char *string1, const char *string2, acpi_size count) +{ + + for (; count-- && (*string1 == *string2); string2++) { + if (!*string1++) { + return (0); + } + } + + return ((count == ACPI_SIZE_MAX) ? 0 : ((unsigned char)*string1 - + (unsigned char)*string2)); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_strcat (Strcat) + * + * PARAMETERS: dst_string - Target of the copy + * src_string - The source string to copy + * + * RETURN: dst_string + * + * DESCRIPTION: Append a null terminated string to a null terminated string + * + ******************************************************************************/ + +char *acpi_ut_strcat(char *dst_string, const char *src_string) +{ + char *string; + + /* Find end of the destination string */ + + for (string = dst_string; *string++;) {; + } + + /* Concatenate the string */ + + for (--string; (*string++ = *src_string++);) {; + } + + return (dst_string); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_strncat (strncat) + * + * PARAMETERS: dst_string - Target of the copy + * src_string - The source string to copy + * count - Maximum # of bytes to copy + * + * RETURN: dst_string + * + * DESCRIPTION: Append a null terminated string to a null terminated string, + * with a maximum count. + * + ******************************************************************************/ + +char *acpi_ut_strncat(char *dst_string, const char *src_string, acpi_size count) +{ + char *string; + + if (count) { + + /* Find end of the destination string */ + + for (string = dst_string; *string++;) {; + } + + /* Concatenate the string */ + + for (--string; (*string++ = *src_string++) && --count;) {; + } + + /* Null terminate if necessary */ + + if (!count) { + *string = 0; + } + } + + return (dst_string); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_strstr (strstr) + * + * PARAMETERS: string1 - Target string + * string2 - Substring to search for + * + * RETURN: Where substring match starts, Null if no match found + * + * DESCRIPTION: Checks if String2 occurs in String1. This is not really a + * full implementation of strstr, only sufficient for command + * matching + * + ******************************************************************************/ + +char *acpi_ut_strstr(char *string1, char *string2) +{ + char *string; + + if (acpi_ut_strlen(string2) > acpi_ut_strlen(string1)) { + return (NULL); + } + + /* Walk entire string, comparing the letters */ + + for (string = string1; *string2;) { + if (*string2 != *string) { + return (NULL); + } + + string2++; + string++; + } + + return (string1); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_strtoul (strtoul) + * + * PARAMETERS: string - Null terminated string + * terminater - Where a pointer to the terminating byte is + * returned + * base - Radix of the string + * + * RETURN: Converted value + * + * DESCRIPTION: Convert a string into a 32-bit unsigned value. + * Note: use acpi_ut_strtoul64 for 64-bit integers. + * + ******************************************************************************/ + +u32 acpi_ut_strtoul(const char *string, char **terminator, u32 base) +{ + u32 converted = 0; + u32 index; + u32 sign; + const char *string_start; + u32 return_value = 0; + acpi_status status = AE_OK; + + /* + * Save the value of the pointer to the buffer's first + * character, save the current errno value, and then + * skip over any white space in the buffer: + */ + string_start = string; + while (ACPI_IS_SPACE(*string) || *string == '\t') { + ++string; + } + + /* + * The buffer may contain an optional plus or minus sign. + * If it does, then skip over it but remember what is was: + */ + if (*string == '-') { + sign = NEGATIVE; + ++string; + } else if (*string == '+') { + ++string; + sign = POSITIVE; + } else { + sign = POSITIVE; + } + + /* + * If the input parameter Base is zero, then we need to + * determine if it is octal, decimal, or hexadecimal: + */ + if (base == 0) { + if (*string == '0') { + if (acpi_ut_to_lower(*(++string)) == 'x') { + base = 16; + ++string; + } else { + base = 8; + } + } else { + base = 10; + } + } else if (base < 2 || base > 36) { + /* + * The specified Base parameter is not in the domain of + * this function: + */ + goto done; + } + + /* + * For octal and hexadecimal bases, skip over the leading + * 0 or 0x, if they are present. + */ + if (base == 8 && *string == '0') { + string++; + } + + if (base == 16 && + *string == '0' && acpi_ut_to_lower(*(++string)) == 'x') { + string++; + } + + /* + * Main loop: convert the string to an unsigned long: + */ + while (*string) { + if (ACPI_IS_DIGIT(*string)) { + index = (u32)((u8)*string - '0'); + } else { + index = (u32)acpi_ut_to_upper(*string); + if (ACPI_IS_UPPER(index)) { + index = index - 'A' + 10; + } else { + goto done; + } + } + + if (index >= base) { + goto done; + } + + /* + * Check to see if value is out of range: + */ + + if (return_value > ((ACPI_UINT32_MAX - (u32)index) / (u32)base)) { + status = AE_ERROR; + return_value = 0; /* reset */ + } else { + return_value *= base; + return_value += index; + converted = 1; + } + + ++string; + } + + done: + /* + * If appropriate, update the caller's pointer to the next + * unconverted character in the buffer. + */ + if (terminator) { + if (converted == 0 && return_value == 0 && string != NULL) { + *terminator = (char *)string_start; + } else { + *terminator = (char *)string; + } + } + + if (status == AE_ERROR) { + return_value = ACPI_UINT32_MAX; + } + + /* + * If a minus sign was present, then "the conversion is negated": + */ + if (sign == NEGATIVE) { + return_value = (ACPI_UINT32_MAX - return_value) + 1; + } + + return (return_value); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_to_upper (TOUPPER) + * + * PARAMETERS: c - Character to convert + * + * RETURN: Converted character as an int + * + * DESCRIPTION: Convert character to uppercase + * + ******************************************************************************/ + +int acpi_ut_to_upper(int c) +{ + + return (ACPI_IS_LOWER(c) ? ((c) - 0x20) : (c)); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_to_lower (TOLOWER) + * + * PARAMETERS: c - Character to convert + * + * RETURN: Converted character as an int + * + * DESCRIPTION: Convert character to lowercase + * + ******************************************************************************/ + +int acpi_ut_to_lower(int c) +{ + + return (ACPI_IS_UPPER(c) ? ((c) + 0x20) : (c)); +} + +/******************************************************************************* + * + * FUNCTION: is* functions + * + * DESCRIPTION: is* functions use the ctype table below + * + ******************************************************************************/ + +const u8 _acpi_ctype[257] = { + _ACPI_CN, /* 0x00 0 NUL */ + _ACPI_CN, /* 0x01 1 SOH */ + _ACPI_CN, /* 0x02 2 STX */ + _ACPI_CN, /* 0x03 3 ETX */ + _ACPI_CN, /* 0x04 4 EOT */ + _ACPI_CN, /* 0x05 5 ENQ */ + _ACPI_CN, /* 0x06 6 ACK */ + _ACPI_CN, /* 0x07 7 BEL */ + _ACPI_CN, /* 0x08 8 BS */ + _ACPI_CN | _ACPI_SP, /* 0x09 9 TAB */ + _ACPI_CN | _ACPI_SP, /* 0x0A 10 LF */ + _ACPI_CN | _ACPI_SP, /* 0x0B 11 VT */ + _ACPI_CN | _ACPI_SP, /* 0x0C 12 FF */ + _ACPI_CN | _ACPI_SP, /* 0x0D 13 CR */ + _ACPI_CN, /* 0x0E 14 SO */ + _ACPI_CN, /* 0x0F 15 SI */ + _ACPI_CN, /* 0x10 16 DLE */ + _ACPI_CN, /* 0x11 17 DC1 */ + _ACPI_CN, /* 0x12 18 DC2 */ + _ACPI_CN, /* 0x13 19 DC3 */ + _ACPI_CN, /* 0x14 20 DC4 */ + _ACPI_CN, /* 0x15 21 NAK */ + _ACPI_CN, /* 0x16 22 SYN */ + _ACPI_CN, /* 0x17 23 ETB */ + _ACPI_CN, /* 0x18 24 CAN */ + _ACPI_CN, /* 0x19 25 EM */ + _ACPI_CN, /* 0x1A 26 SUB */ + _ACPI_CN, /* 0x1B 27 ESC */ + _ACPI_CN, /* 0x1C 28 FS */ + _ACPI_CN, /* 0x1D 29 GS */ + _ACPI_CN, /* 0x1E 30 RS */ + _ACPI_CN, /* 0x1F 31 US */ + _ACPI_XS | _ACPI_SP, /* 0x20 32 ' ' */ + _ACPI_PU, /* 0x21 33 '!' */ + _ACPI_PU, /* 0x22 34 '"' */ + _ACPI_PU, /* 0x23 35 '#' */ + _ACPI_PU, /* 0x24 36 '$' */ + _ACPI_PU, /* 0x25 37 '%' */ + _ACPI_PU, /* 0x26 38 '&' */ + _ACPI_PU, /* 0x27 39 ''' */ + _ACPI_PU, /* 0x28 40 '(' */ + _ACPI_PU, /* 0x29 41 ')' */ + _ACPI_PU, /* 0x2A 42 '*' */ + _ACPI_PU, /* 0x2B 43 '+' */ + _ACPI_PU, /* 0x2C 44 ',' */ + _ACPI_PU, /* 0x2D 45 '-' */ + _ACPI_PU, /* 0x2E 46 '.' */ + _ACPI_PU, /* 0x2F 47 '/' */ + _ACPI_XD | _ACPI_DI, /* 0x30 48 '0' */ + _ACPI_XD | _ACPI_DI, /* 0x31 49 '1' */ + _ACPI_XD | _ACPI_DI, /* 0x32 50 '2' */ + _ACPI_XD | _ACPI_DI, /* 0x33 51 '3' */ + _ACPI_XD | _ACPI_DI, /* 0x34 52 '4' */ + _ACPI_XD | _ACPI_DI, /* 0x35 53 '5' */ + _ACPI_XD | _ACPI_DI, /* 0x36 54 '6' */ + _ACPI_XD | _ACPI_DI, /* 0x37 55 '7' */ + _ACPI_XD | _ACPI_DI, /* 0x38 56 '8' */ + _ACPI_XD | _ACPI_DI, /* 0x39 57 '9' */ + _ACPI_PU, /* 0x3A 58 ':' */ + _ACPI_PU, /* 0x3B 59 ';' */ + _ACPI_PU, /* 0x3C 60 '<' */ + _ACPI_PU, /* 0x3D 61 '=' */ + _ACPI_PU, /* 0x3E 62 '>' */ + _ACPI_PU, /* 0x3F 63 '?' */ + _ACPI_PU, /* 0x40 64 '@' */ + _ACPI_XD | _ACPI_UP, /* 0x41 65 'A' */ + _ACPI_XD | _ACPI_UP, /* 0x42 66 'B' */ + _ACPI_XD | _ACPI_UP, /* 0x43 67 'C' */ + _ACPI_XD | _ACPI_UP, /* 0x44 68 'D' */ + _ACPI_XD | _ACPI_UP, /* 0x45 69 'E' */ + _ACPI_XD | _ACPI_UP, /* 0x46 70 'F' */ + _ACPI_UP, /* 0x47 71 'G' */ + _ACPI_UP, /* 0x48 72 'H' */ + _ACPI_UP, /* 0x49 73 'I' */ + _ACPI_UP, /* 0x4A 74 'J' */ + _ACPI_UP, /* 0x4B 75 'K' */ + _ACPI_UP, /* 0x4C 76 'L' */ + _ACPI_UP, /* 0x4D 77 'M' */ + _ACPI_UP, /* 0x4E 78 'N' */ + _ACPI_UP, /* 0x4F 79 'O' */ + _ACPI_UP, /* 0x50 80 'P' */ + _ACPI_UP, /* 0x51 81 'Q' */ + _ACPI_UP, /* 0x52 82 'R' */ + _ACPI_UP, /* 0x53 83 'S' */ + _ACPI_UP, /* 0x54 84 'T' */ + _ACPI_UP, /* 0x55 85 'U' */ + _ACPI_UP, /* 0x56 86 'V' */ + _ACPI_UP, /* 0x57 87 'W' */ + _ACPI_UP, /* 0x58 88 'X' */ + _ACPI_UP, /* 0x59 89 'Y' */ + _ACPI_UP, /* 0x5A 90 'Z' */ + _ACPI_PU, /* 0x5B 91 '[' */ + _ACPI_PU, /* 0x5C 92 '\' */ + _ACPI_PU, /* 0x5D 93 ']' */ + _ACPI_PU, /* 0x5E 94 '^' */ + _ACPI_PU, /* 0x5F 95 '_' */ + _ACPI_PU, /* 0x60 96 '`' */ + _ACPI_XD | _ACPI_LO, /* 0x61 97 'a' */ + _ACPI_XD | _ACPI_LO, /* 0x62 98 'b' */ + _ACPI_XD | _ACPI_LO, /* 0x63 99 'c' */ + _ACPI_XD | _ACPI_LO, /* 0x64 100 'd' */ + _ACPI_XD | _ACPI_LO, /* 0x65 101 'e' */ + _ACPI_XD | _ACPI_LO, /* 0x66 102 'f' */ + _ACPI_LO, /* 0x67 103 'g' */ + _ACPI_LO, /* 0x68 104 'h' */ + _ACPI_LO, /* 0x69 105 'i' */ + _ACPI_LO, /* 0x6A 106 'j' */ + _ACPI_LO, /* 0x6B 107 'k' */ + _ACPI_LO, /* 0x6C 108 'l' */ + _ACPI_LO, /* 0x6D 109 'm' */ + _ACPI_LO, /* 0x6E 110 'n' */ + _ACPI_LO, /* 0x6F 111 'o' */ + _ACPI_LO, /* 0x70 112 'p' */ + _ACPI_LO, /* 0x71 113 'q' */ + _ACPI_LO, /* 0x72 114 'r' */ + _ACPI_LO, /* 0x73 115 's' */ + _ACPI_LO, /* 0x74 116 't' */ + _ACPI_LO, /* 0x75 117 'u' */ + _ACPI_LO, /* 0x76 118 'v' */ + _ACPI_LO, /* 0x77 119 'w' */ + _ACPI_LO, /* 0x78 120 'x' */ + _ACPI_LO, /* 0x79 121 'y' */ + _ACPI_LO, /* 0x7A 122 'z' */ + _ACPI_PU, /* 0x7B 123 '{' */ + _ACPI_PU, /* 0x7C 124 '|' */ + _ACPI_PU, /* 0x7D 125 '}' */ + _ACPI_PU, /* 0x7E 126 '~' */ + _ACPI_CN, /* 0x7F 127 DEL */ + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 to 0x8F */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 to 0x9F */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xA0 to 0xAF */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xB0 to 0xBF */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xC0 to 0xCF */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xD0 to 0xDF */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xE0 to 0xEF */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xF0 to 0xFF */ + 0 /* 0x100 */ +}; + +#endif /* ACPI_USE_SYSTEM_CLIBRARY */ diff --git a/trunk/drivers/acpi/apei/apei-base.c b/trunk/drivers/acpi/apei/apei-base.c index 46f80e2c92f7..00a783661d0b 100644 --- a/trunk/drivers/acpi/apei/apei-base.c +++ b/trunk/drivers/acpi/apei/apei-base.c @@ -590,9 +590,6 @@ static int apei_check_gar(struct acpi_generic_address *reg, u64 *paddr, if (bit_width == 32 && bit_offset == 0 && (*paddr & 0x03) == 0 && *access_bit_width < 32) *access_bit_width = 32; - else if (bit_width == 64 && bit_offset == 0 && (*paddr & 0x07) == 0 && - *access_bit_width < 64) - *access_bit_width = 64; if ((bit_width + bit_offset) > *access_bit_width) { pr_warning(FW_BUG APEI_PFX diff --git a/trunk/drivers/acpi/apei/erst-dbg.c b/trunk/drivers/acpi/apei/erst-dbg.c index 04ab5c9d3ced..903549df809b 100644 --- a/trunk/drivers/acpi/apei/erst-dbg.c +++ b/trunk/drivers/acpi/apei/erst-dbg.c @@ -111,17 +111,8 @@ static ssize_t erst_dbg_read(struct file *filp, char __user *ubuf, if (rc) goto out; /* no more record */ - if (id == APEI_ERST_INVALID_RECORD_ID) { - /* - * If the persistent store is empty initially, the function - * 'erst_read' below will return "-ENOENT" value. This causes - * 'retry_next' label is entered again. The returned value - * should be zero indicating the read operation is EOF. - */ - len = 0; - + if (id == APEI_ERST_INVALID_RECORD_ID) goto out; - } retry: rc = len = erst_read(id, erst_dbg_buf, erst_dbg_buf_len); /* The record may be cleared by others, try read next record */ diff --git a/trunk/drivers/acpi/device_pm.c b/trunk/drivers/acpi/device_pm.c index c6ff606c6d5b..f09dc987cf17 100644 --- a/trunk/drivers/acpi/device_pm.c +++ b/trunk/drivers/acpi/device_pm.c @@ -358,7 +358,8 @@ static struct acpi_device *acpi_dev_pm_get_node(struct device *dev) acpi_handle handle = DEVICE_ACPI_HANDLE(dev); struct acpi_device *adev; - return handle && !acpi_bus_get_device(handle, &adev) ? adev : NULL; + return handle && ACPI_SUCCESS(acpi_bus_get_device(handle, &adev)) ? + adev : NULL; } /** diff --git a/trunk/drivers/acpi/glue.c b/trunk/drivers/acpi/glue.c index 35da18113216..01551840d236 100644 --- a/trunk/drivers/acpi/glue.c +++ b/trunk/drivers/acpi/glue.c @@ -18,14 +18,9 @@ #define ACPI_GLUE_DEBUG 0 #if ACPI_GLUE_DEBUG -#define DBG(fmt, ...) \ - printk(KERN_DEBUG PREFIX fmt, ##__VA_ARGS__) +#define DBG(x...) printk(PREFIX x) #else -#define DBG(fmt, ...) \ -do { \ - if (0) \ - printk(KERN_DEBUG PREFIX fmt, ##__VA_ARGS__); \ -} while (0) +#define DBG(x...) do { } while(0) #endif static LIST_HEAD(bus_type_list); static DECLARE_RWSEM(bus_type_sem); @@ -297,7 +292,7 @@ static int acpi_platform_notify(struct device *dev) if (!ret) { struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; - acpi_get_name(ACPI_HANDLE(dev), ACPI_FULL_PATHNAME, &buffer); + acpi_get_name(dev->acpi_handle, ACPI_FULL_PATHNAME, &buffer); DBG("Device %s -> %s\n", dev_name(dev), (char *)buffer.pointer); kfree(buffer.pointer); } else diff --git a/trunk/drivers/acpi/power.c b/trunk/drivers/acpi/power.c index 6e7b9d523812..7db61b8fa11f 100644 --- a/trunk/drivers/acpi/power.c +++ b/trunk/drivers/acpi/power.c @@ -445,8 +445,11 @@ int acpi_power_resource_register_device(struct device *dev, acpi_handle handle) return -ENODEV; ret = acpi_bus_get_device(handle, &acpi_dev); - if (ret || !acpi_dev->power.flags.power_resources) - return -ENODEV; + if (ret) + goto no_power_resource; + + if (!acpi_dev->power.flags.power_resources) + goto no_power_resource; powered_device = kzalloc(sizeof(*powered_device), GFP_KERNEL); if (!powered_device) @@ -468,6 +471,10 @@ int acpi_power_resource_register_device(struct device *dev, acpi_handle handle) } return ret; + +no_power_resource: + printk(KERN_DEBUG PREFIX "Invalid Power Resource to register!\n"); + return -ENODEV; } EXPORT_SYMBOL_GPL(acpi_power_resource_register_device); diff --git a/trunk/drivers/acpi/processor_idle.c b/trunk/drivers/acpi/processor_idle.c index ed9a1cc690be..f1a5da44591d 100644 --- a/trunk/drivers/acpi/processor_idle.c +++ b/trunk/drivers/acpi/processor_idle.c @@ -958,9 +958,6 @@ static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr) return -EINVAL; } - if (!dev) - return -EINVAL; - dev->cpu = pr->id; if (max_cstate == 0) @@ -1152,7 +1149,6 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) } /* Populate Updated C-state information */ - acpi_processor_get_power_info(pr); acpi_processor_setup_cpuidle_states(pr); /* Enable all cpuidle devices */ diff --git a/trunk/drivers/acpi/processor_perflib.c b/trunk/drivers/acpi/processor_perflib.c index 53e7ac9403a7..836bfe069042 100644 --- a/trunk/drivers/acpi/processor_perflib.c +++ b/trunk/drivers/acpi/processor_perflib.c @@ -340,13 +340,6 @@ static void amd_fixup_frequency(struct acpi_processor_px *px, int i) if ((boot_cpu_data.x86 == 0x10 && boot_cpu_data.x86_model < 10) || boot_cpu_data.x86 == 0x11) { rdmsr(MSR_AMD_PSTATE_DEF_BASE + index, lo, hi); - /* - * MSR C001_0064+: - * Bit 63: PstateEn. Read-write. If set, the P-state is valid. - */ - if (!(hi & BIT(31))) - return; - fid = lo & 0x3f; did = (lo >> 6) & 7; if (boot_cpu_data.x86 == 0x10) diff --git a/trunk/drivers/acpi/scan.c b/trunk/drivers/acpi/scan.c index c88be6c37c30..53502d1bbf26 100644 --- a/trunk/drivers/acpi/scan.c +++ b/trunk/drivers/acpi/scan.c @@ -1346,7 +1346,7 @@ static void acpi_device_set_id(struct acpi_device *device) acpi_add_id(device, ACPI_DOCK_HID); else if (!acpi_ibm_smbus_match(device)) acpi_add_id(device, ACPI_SMBUS_IBM_HID); - else if (list_empty(&device->pnp.ids) && + else if (!acpi_device_hid(device) && ACPI_IS_ROOT_DEVICE(device->parent)) { acpi_add_id(device, ACPI_BUS_HID); /* \_SB, LNXSYBUS */ strcpy(device->pnp.device_name, ACPI_BUS_DEVICE_NAME); diff --git a/trunk/drivers/ata/ahci.c b/trunk/drivers/ata/ahci.c index 497912732566..7862d17976b7 100644 --- a/trunk/drivers/ata/ahci.c +++ b/trunk/drivers/ata/ahci.c @@ -53,7 +53,6 @@ enum { AHCI_PCI_BAR_STA2X11 = 0, - AHCI_PCI_BAR_ENMOTUS = 2, AHCI_PCI_BAR_STANDARD = 5, }; @@ -411,9 +410,6 @@ static const struct pci_device_id ahci_pci_tbl[] = { { PCI_VDEVICE(ASMEDIA, 0x0611), board_ahci }, /* ASM1061 */ { PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci }, /* ASM1062 */ - /* Enmotus */ - { PCI_DEVICE(0x1c44, 0x8000), board_ahci }, - /* Generic, PCI class code for AHCI */ { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci }, @@ -1102,11 +1098,9 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) dev_info(&pdev->dev, "PDC42819 can only drive SATA devices with this driver\n"); - /* Both Connext and Enmotus devices use non-standard BARs */ + /* The Connext uses non-standard BAR */ if (pdev->vendor == PCI_VENDOR_ID_STMICRO && pdev->device == 0xCC06) ahci_pci_bar = AHCI_PCI_BAR_STA2X11; - else if (pdev->vendor == 0x1c44 && pdev->device == 0x8000) - ahci_pci_bar = AHCI_PCI_BAR_ENMOTUS; /* acquire resources */ rc = pcim_enable_device(pdev); diff --git a/trunk/drivers/ata/libahci.c b/trunk/drivers/ata/libahci.c index 6cd7805e47ca..320712a7b9ea 100644 --- a/trunk/drivers/ata/libahci.c +++ b/trunk/drivers/ata/libahci.c @@ -1951,13 +1951,13 @@ static void ahci_set_aggressive_devslp(struct ata_port *ap, bool sleep) /* Use the nominal value 10 ms if the read MDAT is zero, * the nominal value of DETO is 20 ms. */ - if (dev->devslp_timing[ATA_LOG_DEVSLP_VALID] & + if (dev->sata_settings[ATA_LOG_DEVSLP_VALID] & ATA_LOG_DEVSLP_VALID_MASK) { - mdat = dev->devslp_timing[ATA_LOG_DEVSLP_MDAT] & + mdat = dev->sata_settings[ATA_LOG_DEVSLP_MDAT] & ATA_LOG_DEVSLP_MDAT_MASK; if (!mdat) mdat = 10; - deto = dev->devslp_timing[ATA_LOG_DEVSLP_DETO]; + deto = dev->sata_settings[ATA_LOG_DEVSLP_DETO]; if (!deto) deto = 20; } else { diff --git a/trunk/drivers/ata/libata-core.c b/trunk/drivers/ata/libata-core.c index 46cd3f4c6aaa..9e8b99af400d 100644 --- a/trunk/drivers/ata/libata-core.c +++ b/trunk/drivers/ata/libata-core.c @@ -2325,28 +2325,24 @@ int ata_dev_configure(struct ata_device *dev) } } - /* Check and mark DevSlp capability. Get DevSlp timing variables - * from SATA Settings page of Identify Device Data Log. - */ - if (ata_id_has_devslp(dev->id)) { - u8 sata_setting[ATA_SECT_SIZE]; - int i, j; - + /* check and mark DevSlp capability */ + if (ata_id_has_devslp(dev->id)) dev->flags |= ATA_DFLAG_DEVSLP; + + /* Obtain SATA Settings page from Identify Device Data Log, + * which contains DevSlp timing variables etc. + * Exclude old devices with ata_id_has_ncq() + */ + if (ata_id_has_ncq(dev->id)) { err_mask = ata_read_log_page(dev, ATA_LOG_SATA_ID_DEV_DATA, ATA_LOG_SATA_SETTINGS, - sata_setting, + dev->sata_settings, 1); if (err_mask) ata_dev_dbg(dev, "failed to get Identify Device Data, Emask 0x%x\n", err_mask); - else - for (i = 0; i < ATA_LOG_DEVSLP_SIZE; i++) { - j = ATA_LOG_DEVSLP_OFFSET + i; - dev->devslp_timing[i] = sata_setting[j]; - } } dev->cdb_len = 16; diff --git a/trunk/drivers/ata/libata-eh.c b/trunk/drivers/ata/libata-eh.c index bcf4437214f5..bf039b0e97b7 100644 --- a/trunk/drivers/ata/libata-eh.c +++ b/trunk/drivers/ata/libata-eh.c @@ -2094,7 +2094,7 @@ static unsigned int ata_eh_speed_down(struct ata_device *dev, */ static inline int ata_eh_worth_retry(struct ata_queued_cmd *qc) { - if (qc->err_mask & AC_ERR_MEDIA) + if (qc->flags & AC_ERR_MEDIA) return 0; /* don't retry media errors */ if (qc->flags & ATA_QCFLAG_IO) return 1; /* otherwise retry anything from fs stack */ diff --git a/trunk/drivers/base/cpu.c b/trunk/drivers/base/cpu.c index fb10728f6372..63452943abd1 100644 --- a/trunk/drivers/base/cpu.c +++ b/trunk/drivers/base/cpu.c @@ -224,7 +224,7 @@ static void cpu_device_release(struct device *dev) * by the cpu device. * * Never copy this way of doing things, or you too will be made fun of - * on the linux-kernel list, you have been warned. + * on the linux-kerenl list, you have been warned. */ } diff --git a/trunk/drivers/base/firmware_class.c b/trunk/drivers/base/firmware_class.c index b392b353be39..d81460309182 100644 --- a/trunk/drivers/base/firmware_class.c +++ b/trunk/drivers/base/firmware_class.c @@ -305,7 +305,7 @@ static bool fw_read_file_contents(struct file *file, struct firmware_buf *fw_buf char *buf; size = fw_file_size(file); - if (size <= 0) + if (size < 0) return false; buf = vmalloc(size); if (!buf) diff --git a/trunk/drivers/base/power/main.c b/trunk/drivers/base/power/main.c index 2b7f77d3fcb0..a3c1404c7933 100644 --- a/trunk/drivers/base/power/main.c +++ b/trunk/drivers/base/power/main.c @@ -513,8 +513,6 @@ static int device_resume_early(struct device *dev, pm_message_t state) Out: TRACE_RESUME(error); - - pm_runtime_enable(dev); return error; } @@ -591,6 +589,8 @@ static int device_resume(struct device *dev, pm_message_t state, bool async) if (!dev->power.is_suspended) goto Unlock; + pm_runtime_enable(dev); + if (dev->pm_domain) { info = "power domain "; callback = pm_op(&dev->pm_domain->ops, state); @@ -930,8 +930,6 @@ static int device_suspend_late(struct device *dev, pm_message_t state) pm_callback_t callback = NULL; char *info = NULL; - __pm_runtime_disable(dev, false); - if (dev->power.syscore) return 0; @@ -1135,8 +1133,11 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) Complete: complete_all(&dev->power.completion); + if (error) async_error = error; + else if (dev->power.is_suspended) + __pm_runtime_disable(dev, false); return error; } diff --git a/trunk/drivers/base/power/qos.c b/trunk/drivers/base/power/qos.c index d21349544ce5..ff46387f5308 100644 --- a/trunk/drivers/base/power/qos.c +++ b/trunk/drivers/base/power/qos.c @@ -542,19 +542,19 @@ int dev_pm_qos_add_ancestor_request(struct device *dev, struct dev_pm_qos_request *req, s32 value) { struct device *ancestor = dev->parent; - int ret = -ENODEV; + int error = -ENODEV; while (ancestor && !ancestor->power.ignore_children) ancestor = ancestor->parent; if (ancestor) - ret = dev_pm_qos_add_request(ancestor, req, - DEV_PM_QOS_LATENCY, value); + error = dev_pm_qos_add_request(ancestor, req, + DEV_PM_QOS_LATENCY, value); - if (ret < 0) + if (error < 0) req->dev = NULL; - return ret; + return error; } EXPORT_SYMBOL_GPL(dev_pm_qos_add_ancestor_request); diff --git a/trunk/drivers/base/regmap/regmap-debugfs.c b/trunk/drivers/base/regmap/regmap-debugfs.c index d9a6c94ce423..07aad786f817 100644 --- a/trunk/drivers/base/regmap/regmap-debugfs.c +++ b/trunk/drivers/base/regmap/regmap-debugfs.c @@ -56,19 +56,6 @@ static const struct file_operations regmap_name_fops = { .llseek = default_llseek, }; -static void regmap_debugfs_free_dump_cache(struct regmap *map) -{ - struct regmap_debugfs_off_cache *c; - - while (!list_empty(&map->debugfs_off_cache)) { - c = list_first_entry(&map->debugfs_off_cache, - struct regmap_debugfs_off_cache, - list); - list_del(&c->list); - kfree(c); - } -} - /* * Work out where the start offset maps into register numbers, bearing * in mind that we suppress hidden registers. @@ -104,10 +91,8 @@ static unsigned int regmap_debugfs_get_dump_start(struct regmap *map, /* No cache entry? Start a new one */ if (!c) { c = kzalloc(sizeof(*c), GFP_KERNEL); - if (!c) { - regmap_debugfs_free_dump_cache(map); - return base; - } + if (!c) + break; c->min = p; c->base_reg = i; } @@ -116,32 +101,14 @@ static unsigned int regmap_debugfs_get_dump_start(struct regmap *map, } } - /* Close the last entry off if we didn't scan beyond it */ - if (c) { - c->max = p - 1; - list_add_tail(&c->list, - &map->debugfs_off_cache); - } - - /* - * This should never happen; we return above if we fail to - * allocate and we should never be in this code if there are - * no registers at all. - */ - if (list_empty(&map->debugfs_off_cache)) { - WARN_ON(list_empty(&map->debugfs_off_cache)); - return base; - } - /* Find the relevant block */ list_for_each_entry(c, &map->debugfs_off_cache, list) { - if (from >= c->min && from <= c->max) { + if (*pos >= c->min && *pos <= c->max) { *pos = c->min; return c->base_reg; } - *pos = c->min; - ret = c->base_reg; + ret = c->max; } return ret; @@ -420,8 +387,16 @@ void regmap_debugfs_init(struct regmap *map, const char *name) void regmap_debugfs_exit(struct regmap *map) { + struct regmap_debugfs_off_cache *c; + debugfs_remove_recursive(map->debugfs); - regmap_debugfs_free_dump_cache(map); + while (!list_empty(&map->debugfs_off_cache)) { + c = list_first_entry(&map->debugfs_off_cache, + struct regmap_debugfs_off_cache, + list); + list_del(&c->list); + kfree(c); + } kfree(map->debugfs_name); } diff --git a/trunk/drivers/base/regmap/regmap.c b/trunk/drivers/base/regmap/regmap.c index f00b059c057a..42d5cb0f503f 100644 --- a/trunk/drivers/base/regmap/regmap.c +++ b/trunk/drivers/base/regmap/regmap.c @@ -1106,7 +1106,7 @@ EXPORT_SYMBOL_GPL(regmap_raw_write); * @val_count: Number of registers to write * * This function is intended to be used for writing a large block of - * data to the device either in single transfer or multiple transfer. + * data to be device either in single transfer or multiple transfer. * * A value of zero will be returned on success, a negative errno will * be returned in error cases. diff --git a/trunk/drivers/bcma/Kconfig b/trunk/drivers/bcma/Kconfig index 8b4221cfd118..d7b56a88c9f4 100644 --- a/trunk/drivers/bcma/Kconfig +++ b/trunk/drivers/bcma/Kconfig @@ -67,7 +67,8 @@ config BCMA_DRIVER_GMAC_CMN config BCMA_DRIVER_GPIO bool "BCMA GPIO driver" - depends on BCMA && GPIOLIB + depends on BCMA + select GPIOLIB help Driver to provide access to the GPIO pins of the bcma bus. diff --git a/trunk/drivers/bcma/driver_chipcommon_sflash.c b/trunk/drivers/bcma/driver_chipcommon_sflash.c index 1e694db4532d..63e688393825 100644 --- a/trunk/drivers/bcma/driver_chipcommon_sflash.c +++ b/trunk/drivers/bcma/driver_chipcommon_sflash.c @@ -35,7 +35,7 @@ static struct bcma_sflash_tbl_e bcma_sflash_st_tbl[] = { { "M25P40", 0x12, 0x10000, 8, }, { "M25P16", 0x14, 0x10000, 32, }, - { "M25P32", 0x15, 0x10000, 64, }, + { "M25P32", 0x14, 0x10000, 64, }, { "M25P64", 0x16, 0x10000, 128, }, { "M25FL128", 0x17, 0x10000, 256, }, { 0 }, diff --git a/trunk/drivers/block/virtio_blk.c b/trunk/drivers/block/virtio_blk.c index 8ad21a25bc0d..9d8409c02082 100644 --- a/trunk/drivers/block/virtio_blk.c +++ b/trunk/drivers/block/virtio_blk.c @@ -889,7 +889,6 @@ static void virtblk_remove(struct virtio_device *vdev) { struct virtio_blk *vblk = vdev->priv; int index = vblk->index; - int refc; /* Prevent config work handler from accessing the device. */ mutex_lock(&vblk->config_lock); @@ -904,15 +903,11 @@ static void virtblk_remove(struct virtio_device *vdev) flush_work(&vblk->config_work); - refc = atomic_read(&disk_to_dev(vblk->disk)->kobj.kref.refcount); put_disk(vblk->disk); mempool_destroy(vblk->pool); vdev->config->del_vqs(vdev); kfree(vblk); - - /* Only free device id if we don't have any users */ - if (refc == 1) - ida_simple_remove(&vd_index_ida, index); + ida_simple_remove(&vd_index_ida, index); } #ifdef CONFIG_PM diff --git a/trunk/drivers/bluetooth/ath3k.c b/trunk/drivers/bluetooth/ath3k.c index 33c9a44a9678..b00000e8aef6 100644 --- a/trunk/drivers/bluetooth/ath3k.c +++ b/trunk/drivers/bluetooth/ath3k.c @@ -77,15 +77,10 @@ static struct usb_device_id ath3k_table[] = { { USB_DEVICE(0x0CF3, 0x311D) }, { USB_DEVICE(0x13d3, 0x3375) }, { USB_DEVICE(0x04CA, 0x3005) }, - { USB_DEVICE(0x04CA, 0x3006) }, - { USB_DEVICE(0x04CA, 0x3008) }, { USB_DEVICE(0x13d3, 0x3362) }, { USB_DEVICE(0x0CF3, 0xE004) }, { USB_DEVICE(0x0930, 0x0219) }, { USB_DEVICE(0x0489, 0xe057) }, - { USB_DEVICE(0x13d3, 0x3393) }, - { USB_DEVICE(0x0489, 0xe04e) }, - { USB_DEVICE(0x0489, 0xe056) }, /* Atheros AR5BBU12 with sflash firmware */ { USB_DEVICE(0x0489, 0xE02C) }, @@ -109,15 +104,10 @@ static struct usb_device_id ath3k_blist_tbl[] = { { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, - { USB_DEVICE(0x04ca, 0x3006), .driver_info = BTUSB_ATH3012 }, - { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xe057), .driver_info = BTUSB_ATH3012 }, - { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 }, - { USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 }, - { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 }, /* Atheros AR5BBU22 with sflash firmware */ { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 }, diff --git a/trunk/drivers/bluetooth/btusb.c b/trunk/drivers/bluetooth/btusb.c index 7e351e345476..a1d4ede5b892 100644 --- a/trunk/drivers/bluetooth/btusb.c +++ b/trunk/drivers/bluetooth/btusb.c @@ -135,15 +135,10 @@ static struct usb_device_id blacklist_table[] = { { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, - { USB_DEVICE(0x04ca, 0x3006), .driver_info = BTUSB_ATH3012 }, - { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0489, 0xe057), .driver_info = BTUSB_ATH3012 }, - { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 }, - { USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 }, - { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 }, /* Atheros AR5BBU12 with sflash firmware */ { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, diff --git a/trunk/drivers/clk/mvebu/clk-cpu.c b/trunk/drivers/clk/mvebu/clk-cpu.c index 9dd2551a0a41..ff004578a119 100644 --- a/trunk/drivers/clk/mvebu/clk-cpu.c +++ b/trunk/drivers/clk/mvebu/clk-cpu.c @@ -124,7 +124,7 @@ void __init of_cpu_clk_setup(struct device_node *node) clks = kzalloc(ncpus * sizeof(*clks), GFP_KERNEL); if (WARN_ON(!clks)) - goto clks_out; + return; for_each_node_by_type(dn, "cpu") { struct clk_init_data init; @@ -134,11 +134,11 @@ void __init of_cpu_clk_setup(struct device_node *node) int cpu, err; if (WARN_ON(!clk_name)) - goto bail_out; + return; err = of_property_read_u32(dn, "reg", &cpu); if (WARN_ON(err)) - goto bail_out; + return; sprintf(clk_name, "cpu%d", cpu); parent_clk = of_clk_get(node, 0); @@ -167,9 +167,6 @@ void __init of_cpu_clk_setup(struct device_node *node) return; bail_out: kfree(clks); - while(ncpus--) - kfree(cpuclk[ncpus].clk_name); -clks_out: kfree(cpuclk); } diff --git a/trunk/drivers/clk/mvebu/clk-gating-ctrl.c b/trunk/drivers/clk/mvebu/clk-gating-ctrl.c index 8fa5408b6c7d..c6d3c263b070 100644 --- a/trunk/drivers/clk/mvebu/clk-gating-ctrl.c +++ b/trunk/drivers/clk/mvebu/clk-gating-ctrl.c @@ -32,7 +32,7 @@ struct mvebu_soc_descr { #define to_clk_gate(_hw) container_of(_hw, struct clk_gate, hw) -static struct clk *mvebu_clk_gating_get_src( +static struct clk __init *mvebu_clk_gating_get_src( struct of_phandle_args *clkspec, void *data) { struct mvebu_gating_ctrl *ctrl = (struct mvebu_gating_ctrl *)data; diff --git a/trunk/drivers/cpufreq/Kconfig b/trunk/drivers/cpufreq/Kconfig index e0a899f25e37..ea512f47b789 100644 --- a/trunk/drivers/cpufreq/Kconfig +++ b/trunk/drivers/cpufreq/Kconfig @@ -20,9 +20,6 @@ if CPU_FREQ config CPU_FREQ_TABLE tristate -config CPU_FREQ_GOV_COMMON - bool - config CPU_FREQ_STAT tristate "CPU frequency translation statistics" select CPU_FREQ_TABLE @@ -144,7 +141,6 @@ config CPU_FREQ_GOV_USERSPACE config CPU_FREQ_GOV_ONDEMAND tristate "'ondemand' cpufreq policy governor" select CPU_FREQ_TABLE - select CPU_FREQ_GOV_COMMON help 'ondemand' - This driver adds a dynamic cpufreq policy governor. The governor does a periodic polling and @@ -163,7 +159,6 @@ config CPU_FREQ_GOV_ONDEMAND config CPU_FREQ_GOV_CONSERVATIVE tristate "'conservative' cpufreq governor" depends on CPU_FREQ - select CPU_FREQ_GOV_COMMON help 'conservative' - this driver is rather similar to the 'ondemand' governor both in its source code and its purpose, the difference is diff --git a/trunk/drivers/cpufreq/Kconfig.x86 b/trunk/drivers/cpufreq/Kconfig.x86 index 7227cd734042..934854ae5eb4 100644 --- a/trunk/drivers/cpufreq/Kconfig.x86 +++ b/trunk/drivers/cpufreq/Kconfig.x86 @@ -106,7 +106,7 @@ config X86_POWERNOW_K7_ACPI config X86_POWERNOW_K8 tristate "AMD Opteron/Athlon64 PowerNow!" select CPU_FREQ_TABLE - depends on ACPI && ACPI_PROCESSOR && X86_ACPI_CPUFREQ + depends on ACPI && ACPI_PROCESSOR help This adds the CPUFreq driver for K8/early Opteron/Athlon64 processors. Support for K10 and newer processors is now in acpi-cpufreq. diff --git a/trunk/drivers/cpufreq/Makefile b/trunk/drivers/cpufreq/Makefile index fadc4d496e2f..1f254ec087c1 100644 --- a/trunk/drivers/cpufreq/Makefile +++ b/trunk/drivers/cpufreq/Makefile @@ -7,9 +7,8 @@ obj-$(CONFIG_CPU_FREQ_STAT) += cpufreq_stats.o obj-$(CONFIG_CPU_FREQ_GOV_PERFORMANCE) += cpufreq_performance.o obj-$(CONFIG_CPU_FREQ_GOV_POWERSAVE) += cpufreq_powersave.o obj-$(CONFIG_CPU_FREQ_GOV_USERSPACE) += cpufreq_userspace.o -obj-$(CONFIG_CPU_FREQ_GOV_ONDEMAND) += cpufreq_ondemand.o -obj-$(CONFIG_CPU_FREQ_GOV_CONSERVATIVE) += cpufreq_conservative.o -obj-$(CONFIG_CPU_FREQ_GOV_COMMON) += cpufreq_governor.o +obj-$(CONFIG_CPU_FREQ_GOV_ONDEMAND) += cpufreq_ondemand.o cpufreq_governor.o +obj-$(CONFIG_CPU_FREQ_GOV_CONSERVATIVE) += cpufreq_conservative.o cpufreq_governor.o # CPUfreq cross-arch helpers obj-$(CONFIG_CPU_FREQ_TABLE) += freq_table.o diff --git a/trunk/drivers/cpufreq/acpi-cpufreq.c b/trunk/drivers/cpufreq/acpi-cpufreq.c index 7b0d49d78c61..0d048f6a2b23 100644 --- a/trunk/drivers/cpufreq/acpi-cpufreq.c +++ b/trunk/drivers/cpufreq/acpi-cpufreq.c @@ -1030,11 +1030,4 @@ MODULE_PARM_DESC(acpi_pstate_strict, late_initcall(acpi_cpufreq_init); module_exit(acpi_cpufreq_exit); -static const struct x86_cpu_id acpi_cpufreq_ids[] = { - X86_FEATURE_MATCH(X86_FEATURE_ACPI), - X86_FEATURE_MATCH(X86_FEATURE_HW_PSTATE), - {} -}; -MODULE_DEVICE_TABLE(x86cpu, acpi_cpufreq_ids); - MODULE_ALIAS("acpi"); diff --git a/trunk/drivers/cpufreq/cpufreq-cpu0.c b/trunk/drivers/cpufreq/cpufreq-cpu0.c index debc5a7c8db6..52bf36d599f5 100644 --- a/trunk/drivers/cpufreq/cpufreq-cpu0.c +++ b/trunk/drivers/cpufreq/cpufreq-cpu0.c @@ -71,15 +71,12 @@ static int cpu0_set_target(struct cpufreq_policy *policy, } if (cpu_reg) { - rcu_read_lock(); opp = opp_find_freq_ceil(cpu_dev, &freq_Hz); if (IS_ERR(opp)) { - rcu_read_unlock(); pr_err("failed to find OPP for %ld\n", freq_Hz); return PTR_ERR(opp); } volt = opp_get_voltage(opp); - rcu_read_unlock(); tol = volt * voltage_tolerance / 100; volt_old = regulator_get_voltage(cpu_reg); } @@ -239,14 +236,12 @@ static int cpu0_cpufreq_driver_init(void) */ for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++) ; - rcu_read_lock(); opp = opp_find_freq_exact(cpu_dev, freq_table[0].frequency * 1000, true); min_uV = opp_get_voltage(opp); opp = opp_find_freq_exact(cpu_dev, freq_table[i-1].frequency * 1000, true); max_uV = opp_get_voltage(opp); - rcu_read_unlock(); ret = regulator_set_voltage_time(cpu_reg, min_uV, max_uV); if (ret > 0) transition_latency += ret * 1000; diff --git a/trunk/drivers/cpufreq/cpufreq_stats.c b/trunk/drivers/cpufreq/cpufreq_stats.c index 9d7732b81044..e40e50809644 100644 --- a/trunk/drivers/cpufreq/cpufreq_stats.c +++ b/trunk/drivers/cpufreq/cpufreq_stats.c @@ -364,21 +364,18 @@ static int __init cpufreq_stats_init(void) if (ret) return ret; - register_hotcpu_notifier(&cpufreq_stat_cpu_notifier); - for_each_online_cpu(cpu) - cpufreq_update_policy(cpu); - ret = cpufreq_register_notifier(¬ifier_trans_block, CPUFREQ_TRANSITION_NOTIFIER); if (ret) { cpufreq_unregister_notifier(¬ifier_policy_block, CPUFREQ_POLICY_NOTIFIER); - unregister_hotcpu_notifier(&cpufreq_stat_cpu_notifier); - for_each_online_cpu(cpu) - cpufreq_stats_free_table(cpu); return ret; } + register_hotcpu_notifier(&cpufreq_stat_cpu_notifier); + for_each_online_cpu(cpu) { + cpufreq_update_policy(cpu); + } return 0; } static void __exit cpufreq_stats_exit(void) diff --git a/trunk/drivers/cpufreq/longhaul.c b/trunk/drivers/cpufreq/longhaul.c index 1180d536d1eb..f1fa500ac105 100644 --- a/trunk/drivers/cpufreq/longhaul.c +++ b/trunk/drivers/cpufreq/longhaul.c @@ -77,7 +77,7 @@ static unsigned int longhaul_index; static int scale_voltage; static int disable_acpi_c3; static int revid_errata; -static int enable; + /* Clock ratios multiplied by 10 */ static int mults[32]; @@ -965,10 +965,6 @@ static int __init longhaul_init(void) if (!x86_match_cpu(longhaul_id)) return -ENODEV; - if (!enable) { - printk(KERN_ERR PFX "Option \"enable\" not set. Aborting.\n"); - return -ENODEV; - } #ifdef CONFIG_SMP if (num_online_cpus() > 1) { printk(KERN_ERR PFX "More than 1 CPU detected, " @@ -1025,10 +1021,6 @@ MODULE_PARM_DESC(scale_voltage, "Scale voltage of processor"); * such. */ module_param(revid_errata, int, 0644); MODULE_PARM_DESC(revid_errata, "Ignore CPU Revision ID"); -/* By default driver is disabled to prevent incompatible - * system freeze. */ -module_param(enable, int, 0644); -MODULE_PARM_DESC(enable, "Enable driver"); MODULE_AUTHOR("Dave Jones "); MODULE_DESCRIPTION("Longhaul driver for VIA Cyrix processors."); diff --git a/trunk/drivers/cpufreq/omap-cpufreq.c b/trunk/drivers/cpufreq/omap-cpufreq.c index 97102b05843f..1f3417a8322d 100644 --- a/trunk/drivers/cpufreq/omap-cpufreq.c +++ b/trunk/drivers/cpufreq/omap-cpufreq.c @@ -110,16 +110,13 @@ static int omap_target(struct cpufreq_policy *policy, freq = ret; if (mpu_reg) { - rcu_read_lock(); opp = opp_find_freq_ceil(mpu_dev, &freq); if (IS_ERR(opp)) { - rcu_read_unlock(); dev_err(mpu_dev, "%s: unable to find MPU OPP for %d\n", __func__, freqs.new); return -EINVAL; } volt = opp_get_voltage(opp); - rcu_read_unlock(); tol = volt * OPP_TOLERANCE / 100; volt_old = regulator_get_voltage(mpu_reg); } diff --git a/trunk/drivers/cpuidle/coupled.c b/trunk/drivers/cpuidle/coupled.c index 2a297f86dbad..3265844839bf 100644 --- a/trunk/drivers/cpuidle/coupled.c +++ b/trunk/drivers/cpuidle/coupled.c @@ -209,7 +209,7 @@ inline int cpuidle_coupled_set_not_ready(struct cpuidle_coupled *coupled) int all; int ret; - all = coupled->online_count | (coupled->online_count << WAITING_BITS); + all = coupled->online_count || (coupled->online_count << WAITING_BITS); ret = atomic_add_unless(&coupled->ready_waiting_counts, -MAX_WAITING_CPUS, all); diff --git a/trunk/drivers/cpuidle/cpuidle.c b/trunk/drivers/cpuidle/cpuidle.c index e1f6860e069c..8df53dd8dbe1 100644 --- a/trunk/drivers/cpuidle/cpuidle.c +++ b/trunk/drivers/cpuidle/cpuidle.c @@ -69,15 +69,24 @@ int cpuidle_play_dead(void) { struct cpuidle_device *dev = __this_cpu_read(cpuidle_devices); struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev); - int i; + int i, dead_state = -1; + int power_usage = -1; if (!drv) return -ENODEV; /* Find lowest-power state that supports long-term idle */ - for (i = drv->state_count - 1; i >= CPUIDLE_DRIVER_STATE_START; i--) - if (drv->states[i].enter_dead) - return drv->states[i].enter_dead(dev, i); + for (i = CPUIDLE_DRIVER_STATE_START; i < drv->state_count; i++) { + struct cpuidle_state *s = &drv->states[i]; + + if (s->power_usage < power_usage && s->enter_dead) { + power_usage = s->power_usage; + dead_state = i; + } + } + + if (dead_state != -1) + return drv->states[dead_state].enter_dead(dev, dead_state); return -ENODEV; } diff --git a/trunk/drivers/cpuidle/driver.c b/trunk/drivers/cpuidle/driver.c index 422c7b69ba7c..3af841fb397a 100644 --- a/trunk/drivers/cpuidle/driver.c +++ b/trunk/drivers/cpuidle/driver.c @@ -19,9 +19,34 @@ DEFINE_SPINLOCK(cpuidle_driver_lock); static void __cpuidle_set_cpu_driver(struct cpuidle_driver *drv, int cpu); static struct cpuidle_driver * __cpuidle_get_cpu_driver(int cpu); +static void set_power_states(struct cpuidle_driver *drv) +{ + int i; + + /* + * cpuidle driver should set the drv->power_specified bit + * before registering if the driver provides + * power_usage numbers. + * + * If power_specified is not set, + * we fill in power_usage with decreasing values as the + * cpuidle code has an implicit assumption that state Cn + * uses less power than C(n-1). + * + * With CONFIG_ARCH_HAS_CPU_RELAX, C0 is already assigned + * an power value of -1. So we use -2, -3, etc, for other + * c-states. + */ + for (i = CPUIDLE_DRIVER_STATE_START; i < drv->state_count; i++) + drv->states[i].power_usage = -1 - i; +} + static void __cpuidle_driver_init(struct cpuidle_driver *drv) { drv->refcnt = 0; + + if (!drv->power_specified) + set_power_states(drv); } static int __cpuidle_register_driver(struct cpuidle_driver *drv, int cpu) @@ -210,10 +235,16 @@ EXPORT_SYMBOL_GPL(cpuidle_get_driver); */ struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev) { + struct cpuidle_driver *drv; + if (!dev) return NULL; - return __cpuidle_get_cpu_driver(dev->cpu); + spin_lock(&cpuidle_driver_lock); + drv = __cpuidle_get_cpu_driver(dev->cpu); + spin_unlock(&cpuidle_driver_lock); + + return drv; } EXPORT_SYMBOL_GPL(cpuidle_get_cpu_driver); diff --git a/trunk/drivers/cpuidle/governors/menu.c b/trunk/drivers/cpuidle/governors/menu.c index fe343a06b7da..bd40b943b6db 100644 --- a/trunk/drivers/cpuidle/governors/menu.c +++ b/trunk/drivers/cpuidle/governors/menu.c @@ -312,6 +312,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) { struct menu_device *data = &__get_cpu_var(menu_devices); int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY); + int power_usage = -1; int i; int multiplier; struct timespec t; @@ -382,8 +383,11 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) if (s->exit_latency * multiplier > data->predicted_us) continue; - data->last_state_idx = i; - data->exit_us = s->exit_latency; + if (s->power_usage < power_usage) { + power_usage = s->power_usage; + data->last_state_idx = i; + data->exit_us = s->exit_latency; + } } /* not deepest C-state chosen for low predicted residency */ diff --git a/trunk/drivers/cpuidle/sysfs.c b/trunk/drivers/cpuidle/sysfs.c index 428754af6236..340942946106 100644 --- a/trunk/drivers/cpuidle/sysfs.c +++ b/trunk/drivers/cpuidle/sysfs.c @@ -374,7 +374,7 @@ static int cpuidle_add_state_sysfs(struct cpuidle_device *device) struct cpuidle_driver *drv = cpuidle_get_cpu_driver(device); /* state statistics */ - for (i = 0; i < device->state_count; i++) { + for (i = 0; i < drv->state_count; i++) { kobj = kzalloc(sizeof(struct cpuidle_state_kobj), GFP_KERNEL); if (!kobj) goto error_state; diff --git a/trunk/drivers/devfreq/devfreq.c b/trunk/drivers/devfreq/devfreq.c index 3b367973a802..53766f39aadd 100644 --- a/trunk/drivers/devfreq/devfreq.c +++ b/trunk/drivers/devfreq/devfreq.c @@ -994,11 +994,6 @@ module_exit(devfreq_exit); * @freq: The frequency given to target function * @flags: Flags handed from devfreq framework. * - * Locking: This function must be called under rcu_read_lock(). opp is a rcu - * protected pointer. The reason for the same is that the opp pointer which is - * returned will remain valid for use with opp_get_{voltage, freq} only while - * under the locked area. The pointer returned must be used prior to unlocking - * with rcu_read_unlock() to maintain the integrity of the pointer. */ struct opp *devfreq_recommended_opp(struct device *dev, unsigned long *freq, u32 flags) diff --git a/trunk/drivers/devfreq/exynos4_bus.c b/trunk/drivers/devfreq/exynos4_bus.c index 46d94e9e95b5..80c745e83082 100644 --- a/trunk/drivers/devfreq/exynos4_bus.c +++ b/trunk/drivers/devfreq/exynos4_bus.c @@ -73,16 +73,6 @@ enum busclk_level_idx { #define EX4210_LV_NUM (LV_2 + 1) #define EX4x12_LV_NUM (LV_4 + 1) -/** - * struct busfreq_opp_info - opp information for bus - * @rate: Frequency in hertz - * @volt: Voltage in microvolts corresponding to this OPP - */ -struct busfreq_opp_info { - unsigned long rate; - unsigned long volt; -}; - struct busfreq_data { enum exynos4_busf_type type; struct device *dev; @@ -90,7 +80,7 @@ struct busfreq_data { bool disabled; struct regulator *vdd_int; struct regulator *vdd_mif; /* Exynos4412/4212 only */ - struct busfreq_opp_info curr_oppinfo; + struct opp *curr_opp; struct exynos4_ppmu dmc[2]; struct notifier_block pm_notifier; @@ -306,14 +296,13 @@ static unsigned int exynos4x12_clkdiv_sclkip[][3] = { }; -static int exynos4210_set_busclk(struct busfreq_data *data, - struct busfreq_opp_info *oppi) +static int exynos4210_set_busclk(struct busfreq_data *data, struct opp *opp) { unsigned int index; unsigned int tmp; for (index = LV_0; index < EX4210_LV_NUM; index++) - if (oppi->rate == exynos4210_busclk_table[index].clk) + if (opp_get_freq(opp) == exynos4210_busclk_table[index].clk) break; if (index == EX4210_LV_NUM) @@ -372,14 +361,13 @@ static int exynos4210_set_busclk(struct busfreq_data *data, return 0; } -static int exynos4x12_set_busclk(struct busfreq_data *data, - struct busfreq_opp_info *oppi) +static int exynos4x12_set_busclk(struct busfreq_data *data, struct opp *opp) { unsigned int index; unsigned int tmp; for (index = LV_0; index < EX4x12_LV_NUM; index++) - if (oppi->rate == exynos4x12_mifclk_table[index].clk) + if (opp_get_freq(opp) == exynos4x12_mifclk_table[index].clk) break; if (index == EX4x12_LV_NUM) @@ -588,12 +576,11 @@ static int exynos4x12_get_intspec(unsigned long mifclk) return -EINVAL; } -static int exynos4_bus_setvolt(struct busfreq_data *data, - struct busfreq_opp_info *oppi, - struct busfreq_opp_info *oldoppi) +static int exynos4_bus_setvolt(struct busfreq_data *data, struct opp *opp, + struct opp *oldopp) { int err = 0, tmp; - unsigned long volt = oppi->volt; + unsigned long volt = opp_get_voltage(opp); switch (data->type) { case TYPE_BUSF_EXYNOS4210: @@ -608,11 +595,11 @@ static int exynos4_bus_setvolt(struct busfreq_data *data, if (err) break; - tmp = exynos4x12_get_intspec(oppi->rate); + tmp = exynos4x12_get_intspec(opp_get_freq(opp)); if (tmp < 0) { err = tmp; regulator_set_voltage(data->vdd_mif, - oldoppi->volt, + opp_get_voltage(oldopp), MAX_SAFEVOLT); break; } @@ -622,7 +609,7 @@ static int exynos4_bus_setvolt(struct busfreq_data *data, /* Try to recover */ if (err) regulator_set_voltage(data->vdd_mif, - oldoppi->volt, + opp_get_voltage(oldopp), MAX_SAFEVOLT); break; default: @@ -639,26 +626,17 @@ static int exynos4_bus_target(struct device *dev, unsigned long *_freq, struct platform_device *pdev = container_of(dev, struct platform_device, dev); struct busfreq_data *data = platform_get_drvdata(pdev); - struct opp *opp; - unsigned long freq; - unsigned long old_freq = data->curr_oppinfo.rate; - struct busfreq_opp_info new_oppinfo; + struct opp *opp = devfreq_recommended_opp(dev, _freq, flags); + unsigned long freq = opp_get_freq(opp); + unsigned long old_freq = opp_get_freq(data->curr_opp); - rcu_read_lock(); - opp = devfreq_recommended_opp(dev, _freq, flags); - if (IS_ERR(opp)) { - rcu_read_unlock(); + if (IS_ERR(opp)) return PTR_ERR(opp); - } - new_oppinfo.rate = opp_get_freq(opp); - new_oppinfo.volt = opp_get_voltage(opp); - rcu_read_unlock(); - freq = new_oppinfo.rate; if (old_freq == freq) return 0; - dev_dbg(dev, "targetting %lukHz %luuV\n", freq, new_oppinfo.volt); + dev_dbg(dev, "targetting %lukHz %luuV\n", freq, opp_get_voltage(opp)); mutex_lock(&data->lock); @@ -666,18 +644,17 @@ static int exynos4_bus_target(struct device *dev, unsigned long *_freq, goto out; if (old_freq < freq) - err = exynos4_bus_setvolt(data, &new_oppinfo, - &data->curr_oppinfo); + err = exynos4_bus_setvolt(data, opp, data->curr_opp); if (err) goto out; if (old_freq != freq) { switch (data->type) { case TYPE_BUSF_EXYNOS4210: - err = exynos4210_set_busclk(data, &new_oppinfo); + err = exynos4210_set_busclk(data, opp); break; case TYPE_BUSF_EXYNOS4x12: - err = exynos4x12_set_busclk(data, &new_oppinfo); + err = exynos4x12_set_busclk(data, opp); break; default: err = -EINVAL; @@ -687,12 +664,11 @@ static int exynos4_bus_target(struct device *dev, unsigned long *_freq, goto out; if (old_freq > freq) - err = exynos4_bus_setvolt(data, &new_oppinfo, - &data->curr_oppinfo); + err = exynos4_bus_setvolt(data, opp, data->curr_opp); if (err) goto out; - data->curr_oppinfo = new_oppinfo; + data->curr_opp = opp; out: mutex_unlock(&data->lock); return err; @@ -726,7 +702,7 @@ static int exynos4_bus_get_dev_status(struct device *dev, exynos4_read_ppmu(data); busier_dmc = exynos4_get_busier_dmc(data); - stat->current_frequency = data->curr_oppinfo.rate; + stat->current_frequency = opp_get_freq(data->curr_opp); if (busier_dmc) addr = S5P_VA_DMC1; @@ -957,7 +933,6 @@ static int exynos4_busfreq_pm_notifier_event(struct notifier_block *this, struct busfreq_data *data = container_of(this, struct busfreq_data, pm_notifier); struct opp *opp; - struct busfreq_opp_info new_oppinfo; unsigned long maxfreq = ULONG_MAX; int err = 0; @@ -968,29 +943,18 @@ static int exynos4_busfreq_pm_notifier_event(struct notifier_block *this, data->disabled = true; - rcu_read_lock(); opp = opp_find_freq_floor(data->dev, &maxfreq); - if (IS_ERR(opp)) { - rcu_read_unlock(); - dev_err(data->dev, "%s: unable to find a min freq\n", - __func__); - return PTR_ERR(opp); - } - new_oppinfo.rate = opp_get_freq(opp); - new_oppinfo.volt = opp_get_voltage(opp); - rcu_read_unlock(); - err = exynos4_bus_setvolt(data, &new_oppinfo, - &data->curr_oppinfo); + err = exynos4_bus_setvolt(data, opp, data->curr_opp); if (err) goto unlock; switch (data->type) { case TYPE_BUSF_EXYNOS4210: - err = exynos4210_set_busclk(data, &new_oppinfo); + err = exynos4210_set_busclk(data, opp); break; case TYPE_BUSF_EXYNOS4x12: - err = exynos4x12_set_busclk(data, &new_oppinfo); + err = exynos4x12_set_busclk(data, opp); break; default: err = -EINVAL; @@ -998,7 +962,7 @@ static int exynos4_busfreq_pm_notifier_event(struct notifier_block *this, if (err) goto unlock; - data->curr_oppinfo = new_oppinfo; + data->curr_opp = opp; unlock: mutex_unlock(&data->lock); if (err) @@ -1063,17 +1027,13 @@ static int exynos4_busfreq_probe(struct platform_device *pdev) } } - rcu_read_lock(); opp = opp_find_freq_floor(dev, &exynos4_devfreq_profile.initial_freq); if (IS_ERR(opp)) { - rcu_read_unlock(); dev_err(dev, "Invalid initial frequency %lu kHz.\n", exynos4_devfreq_profile.initial_freq); return PTR_ERR(opp); } - data->curr_oppinfo.rate = opp_get_freq(opp); - data->curr_oppinfo.volt = opp_get_voltage(opp); - rcu_read_unlock(); + data->curr_opp = opp; platform_set_drvdata(pdev, data); diff --git a/trunk/drivers/dma/imx-dma.c b/trunk/drivers/dma/imx-dma.c index a7dcf78b1ff8..dbf0e6f8de8a 100644 --- a/trunk/drivers/dma/imx-dma.c +++ b/trunk/drivers/dma/imx-dma.c @@ -684,8 +684,9 @@ static int imxdma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, break; } - imxdmac->hw_chaining = 0; - + imxdmac->hw_chaining = 1; + if (!imxdma_hw_chain(imxdmac)) + return -EINVAL; imxdmac->ccr_from_device = (mode | IMX_DMA_TYPE_FIFO) | ((IMX_DMA_MEMSIZE_32 | IMX_DMA_TYPE_LINEAR) << 2) | CCR_REN; diff --git a/trunk/drivers/dma/ioat/dma_v3.c b/trunk/drivers/dma/ioat/dma_v3.c index 3e9d66920eb3..e5fc944de1f0 100644 --- a/trunk/drivers/dma/ioat/dma_v3.c +++ b/trunk/drivers/dma/ioat/dma_v3.c @@ -951,7 +951,7 @@ static int ioat_xor_val_self_test(struct ioatdma_device *device) goto free_resources; } } - dma_sync_single_for_device(dev, dest_dma, PAGE_SIZE, DMA_FROM_DEVICE); + dma_sync_single_for_device(dev, dest_dma, PAGE_SIZE, DMA_TO_DEVICE); /* skip validate if the capability is not present */ if (!dma_has_cap(DMA_XOR_VAL, dma_chan->device->cap_mask)) diff --git a/trunk/drivers/dma/mv_xor.c b/trunk/drivers/dma/mv_xor.c index e17fad03cb80..ac71f555dd72 100644 --- a/trunk/drivers/dma/mv_xor.c +++ b/trunk/drivers/dma/mv_xor.c @@ -1361,16 +1361,13 @@ static int mv_xor_probe(struct platform_device *pdev) err_channel_add: for (i = 0; i < MV_XOR_MAX_CHANNELS; i++) if (xordev->channels[i]) { - mv_xor_channel_remove(xordev->channels[i]); if (pdev->dev.of_node) irq_dispose_mapping(xordev->channels[i]->irq); + mv_xor_channel_remove(xordev->channels[i]); } - if (!IS_ERR(xordev->clk)) { - clk_disable_unprepare(xordev->clk); - clk_put(xordev->clk); - } - + clk_disable_unprepare(xordev->clk); + clk_put(xordev->clk); return ret; } diff --git a/trunk/drivers/dma/tegra20-apb-dma.c b/trunk/drivers/dma/tegra20-apb-dma.c index 3cad856fe67f..c39e61bc8172 100644 --- a/trunk/drivers/dma/tegra20-apb-dma.c +++ b/trunk/drivers/dma/tegra20-apb-dma.c @@ -266,7 +266,6 @@ static struct tegra_dma_desc *tegra_dma_desc_get( if (async_tx_test_ack(&dma_desc->txd)) { list_del(&dma_desc->node); spin_unlock_irqrestore(&tdc->lock, flags); - dma_desc->txd.flags = 0; return dma_desc; } } @@ -1051,9 +1050,7 @@ struct dma_async_tx_descriptor *tegra_dma_prep_dma_cyclic( TEGRA_APBDMA_AHBSEQ_WRAP_SHIFT; ahb_seq |= TEGRA_APBDMA_AHBSEQ_BUS_WIDTH_32; - csr |= TEGRA_APBDMA_CSR_FLOW; - if (flags & DMA_PREP_INTERRUPT) - csr |= TEGRA_APBDMA_CSR_IE_EOC; + csr |= TEGRA_APBDMA_CSR_FLOW | TEGRA_APBDMA_CSR_IE_EOC; csr |= tdc->dma_sconfig.slave_id << TEGRA_APBDMA_CSR_REQ_SEL_SHIFT; apb_seq |= TEGRA_APBDMA_APBSEQ_WRAP_WORD_1; @@ -1098,8 +1095,7 @@ struct dma_async_tx_descriptor *tegra_dma_prep_dma_cyclic( mem += len; } sg_req->last_sg = true; - if (flags & DMA_CTRL_ACK) - dma_desc->txd.flags = DMA_CTRL_ACK; + dma_desc->txd.flags = 0; /* * Make sure that mode should not be conflicting with currently diff --git a/trunk/drivers/edac/Kconfig b/trunk/drivers/edac/Kconfig index 66719925970f..4c6c876d9dc3 100644 --- a/trunk/drivers/edac/Kconfig +++ b/trunk/drivers/edac/Kconfig @@ -4,9 +4,6 @@ # Licensed and distributed under the GPL # -config EDAC_SUPPORT - bool - menuconfig EDAC bool "EDAC (Error Detection And Correction) reporting" depends on HAS_IOMEM @@ -30,8 +27,13 @@ menuconfig EDAC There is also a mailing list for the EDAC project, which can be found via the sourceforge page. +config EDAC_SUPPORT + bool + if EDAC +comment "Reporting subsystems" + config EDAC_LEGACY_SYSFS bool "EDAC legacy sysfs" default y diff --git a/trunk/drivers/edac/edac_mc_sysfs.c b/trunk/drivers/edac/edac_mc_sysfs.c index 0ca1ca71157f..de2df92f9c77 100644 --- a/trunk/drivers/edac/edac_mc_sysfs.c +++ b/trunk/drivers/edac/edac_mc_sysfs.c @@ -472,7 +472,8 @@ static void edac_delete_csrow_objects(struct mem_ctl_info *mci) device_remove_file(&csrow->dev, dynamic_csrow_ce_count_attr[chan]); } - device_unregister(&mci->csrows[i]->dev); + put_device(&mci->csrows[i]->dev); + device_del(&mci->csrows[i]->dev); } } #endif @@ -1054,9 +1055,11 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci) struct dimm_info *dimm = mci->dimms[i]; if (dimm->nr_pages == 0) continue; - device_unregister(&dimm->dev); + put_device(&dimm->dev); + device_del(&dimm->dev); } - device_unregister(&mci->dev); + put_device(&mci->dev); + device_del(&mci->dev); bus_unregister(&mci->bus); kfree(mci->bus.name); return err; @@ -1083,14 +1086,16 @@ void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci) if (dimm->nr_pages == 0) continue; edac_dbg(0, "removing device %s\n", dev_name(&dimm->dev)); - device_unregister(&dimm->dev); + put_device(&dimm->dev); + device_del(&dimm->dev); } } void edac_unregister_sysfs(struct mem_ctl_info *mci) { edac_dbg(1, "Unregistering device %s\n", dev_name(&mci->dev)); - device_unregister(&mci->dev); + put_device(&mci->dev); + device_del(&mci->dev); bus_unregister(&mci->bus); kfree(mci->bus.name); } @@ -1154,6 +1159,8 @@ int __init edac_mc_sysfs_init(void) void __exit edac_mc_sysfs_exit(void) { - device_unregister(mci_pdev); + put_device(mci_pdev); + device_del(mci_pdev); edac_put_sysfs_subsys(); + kfree(mci_pdev); } diff --git a/trunk/drivers/gpio/gpio-mvebu.c b/trunk/drivers/gpio/gpio-mvebu.c index 6819d63cb167..7d9bd94be8d2 100644 --- a/trunk/drivers/gpio/gpio-mvebu.c +++ b/trunk/drivers/gpio/gpio-mvebu.c @@ -547,6 +547,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev) mvchip->membase = devm_request_and_ioremap(&pdev->dev, res); if (! mvchip->membase) { dev_err(&pdev->dev, "Cannot ioremap\n"); + kfree(mvchip->chip.label); return -ENOMEM; } @@ -556,12 +557,14 @@ static int mvebu_gpio_probe(struct platform_device *pdev) res = platform_get_resource(pdev, IORESOURCE_MEM, 1); if (! res) { dev_err(&pdev->dev, "Cannot get memory resource\n"); + kfree(mvchip->chip.label); return -ENODEV; } mvchip->percpu_membase = devm_request_and_ioremap(&pdev->dev, res); if (! mvchip->percpu_membase) { dev_err(&pdev->dev, "Cannot ioremap\n"); + kfree(mvchip->chip.label); return -ENOMEM; } } @@ -622,6 +625,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev) mvchip->irqbase = irq_alloc_descs(-1, 0, ngpios, -1); if (mvchip->irqbase < 0) { dev_err(&pdev->dev, "no irqs\n"); + kfree(mvchip->chip.label); return -ENOMEM; } @@ -629,6 +633,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev) mvchip->membase, handle_level_irq); if (! gc) { dev_err(&pdev->dev, "Cannot allocate generic irq_chip\n"); + kfree(mvchip->chip.label); return -ENOMEM; } @@ -663,6 +668,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev) irq_remove_generic_chip(gc, IRQ_MSK(ngpios), IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE); kfree(gc); + kfree(mvchip->chip.label); return -ENODEV; } diff --git a/trunk/drivers/gpio/gpio-samsung.c b/trunk/drivers/gpio/gpio-samsung.c index 76be7eed79de..01f7fe955590 100644 --- a/trunk/drivers/gpio/gpio-samsung.c +++ b/trunk/drivers/gpio/gpio-samsung.c @@ -32,6 +32,7 @@ #include #include +#include #include #include @@ -445,7 +446,7 @@ static struct samsung_gpio_cfg s3c24xx_gpiocfg_banka = { }; #endif -#if defined(CONFIG_ARCH_EXYNOS4) || defined(CONFIG_SOC_EXYNOS5250) +#if defined(CONFIG_ARCH_EXYNOS4) || defined(CONFIG_ARCH_EXYNOS5) static struct samsung_gpio_cfg exynos_gpio_cfg = { .set_pull = exynos_gpio_setpull, .get_pull = exynos_gpio_getpull, @@ -2445,7 +2446,7 @@ static struct samsung_gpio_chip exynos4_gpios_3[] = { }; #endif -#ifdef CONFIG_SOC_EXYNOS5250 +#ifdef CONFIG_ARCH_EXYNOS5 static struct samsung_gpio_chip exynos5_gpios_1[] = { { .chip = { @@ -2613,7 +2614,7 @@ static struct samsung_gpio_chip exynos5_gpios_1[] = { }; #endif -#ifdef CONFIG_SOC_EXYNOS5250 +#ifdef CONFIG_ARCH_EXYNOS5 static struct samsung_gpio_chip exynos5_gpios_2[] = { { .chip = { @@ -2674,7 +2675,7 @@ static struct samsung_gpio_chip exynos5_gpios_2[] = { }; #endif -#ifdef CONFIG_SOC_EXYNOS5250 +#ifdef CONFIG_ARCH_EXYNOS5 static struct samsung_gpio_chip exynos5_gpios_3[] = { { .chip = { @@ -2710,7 +2711,7 @@ static struct samsung_gpio_chip exynos5_gpios_3[] = { }; #endif -#ifdef CONFIG_SOC_EXYNOS5250 +#ifdef CONFIG_ARCH_EXYNOS5 static struct samsung_gpio_chip exynos5_gpios_4[] = { { .chip = { @@ -3009,7 +3010,7 @@ static __init int samsung_gpiolib_init(void) int i, nr_chips; int group = 0; -#if defined(CONFIG_PINCTRL_EXYNOS) || defined(CONFIG_PINCTRL_EXYNOS5440) +#ifdef CONFIG_PINCTRL_SAMSUNG /* * This gpio driver includes support for device tree support and there * are platforms using it. In order to maintain compatibility with those @@ -3025,7 +3026,6 @@ static __init int samsung_gpiolib_init(void) static const struct of_device_id exynos_pinctrl_ids[] = { { .compatible = "samsung,pinctrl-exynos4210", }, { .compatible = "samsung,pinctrl-exynos4x12", }, - { .compatible = "samsung,pinctrl-exynos5440", }, }; for_each_matching_node(pctrl_np, exynos_pinctrl_ids) if (pctrl_np && of_device_is_available(pctrl_np)) diff --git a/trunk/drivers/gpu/drm/drm_mm.c b/trunk/drivers/gpu/drm/drm_mm.c index 2aa331499f81..2bf9670ba29b 100644 --- a/trunk/drivers/gpu/drm/drm_mm.c +++ b/trunk/drivers/gpu/drm/drm_mm.c @@ -221,14 +221,12 @@ static void drm_mm_insert_helper_range(struct drm_mm_node *hole_node, BUG_ON(!hole_node->hole_follows || node->allocated); - if (adj_start < start) - adj_start = start; - if (adj_end > end) - adj_end = end; - if (mm->color_adjust) mm->color_adjust(hole_node, color, &adj_start, &adj_end); + if (adj_start < start) + adj_start = start; + if (alignment) { unsigned tmp = adj_start % alignment; if (tmp) @@ -508,7 +506,7 @@ void drm_mm_init_scan(struct drm_mm *mm, mm->scan_size = size; mm->scanned_blocks = 0; mm->scan_hit_start = 0; - mm->scan_hit_end = 0; + mm->scan_hit_size = 0; mm->scan_check_range = 0; mm->prev_scanned_node = NULL; } @@ -535,7 +533,7 @@ void drm_mm_init_scan_with_range(struct drm_mm *mm, mm->scan_size = size; mm->scanned_blocks = 0; mm->scan_hit_start = 0; - mm->scan_hit_end = 0; + mm->scan_hit_size = 0; mm->scan_start = start; mm->scan_end = end; mm->scan_check_range = 1; @@ -554,7 +552,8 @@ int drm_mm_scan_add_block(struct drm_mm_node *node) struct drm_mm *mm = node->mm; struct drm_mm_node *prev_node; unsigned long hole_start, hole_end; - unsigned long adj_start, adj_end; + unsigned long adj_start; + unsigned long adj_end; mm->scanned_blocks++; @@ -571,8 +570,14 @@ int drm_mm_scan_add_block(struct drm_mm_node *node) node->node_list.next = &mm->prev_scanned_node->node_list; mm->prev_scanned_node = node; - adj_start = hole_start = drm_mm_hole_node_start(prev_node); - adj_end = hole_end = drm_mm_hole_node_end(prev_node); + hole_start = drm_mm_hole_node_start(prev_node); + hole_end = drm_mm_hole_node_end(prev_node); + + adj_start = hole_start; + adj_end = hole_end; + + if (mm->color_adjust) + mm->color_adjust(prev_node, mm->scan_color, &adj_start, &adj_end); if (mm->scan_check_range) { if (adj_start < mm->scan_start) @@ -581,14 +586,11 @@ int drm_mm_scan_add_block(struct drm_mm_node *node) adj_end = mm->scan_end; } - if (mm->color_adjust) - mm->color_adjust(prev_node, mm->scan_color, - &adj_start, &adj_end); - if (check_free_hole(adj_start, adj_end, mm->scan_size, mm->scan_alignment)) { mm->scan_hit_start = hole_start; - mm->scan_hit_end = hole_end; + mm->scan_hit_size = hole_end; + return 1; } @@ -624,10 +626,19 @@ int drm_mm_scan_remove_block(struct drm_mm_node *node) node_list); prev_node->hole_follows = node->scanned_preceeds_hole; + INIT_LIST_HEAD(&node->node_list); list_add(&node->node_list, &prev_node->node_list); - return (drm_mm_hole_node_end(node) > mm->scan_hit_start && - node->start < mm->scan_hit_end); + /* Only need to check for containement because start&size for the + * complete resulting free block (not just the desired part) is + * stored. */ + if (node->start >= mm->scan_hit_start && + node->start + node->size + <= mm->scan_hit_start + mm->scan_hit_size) { + return 1; + } + + return 0; } EXPORT_SYMBOL(drm_mm_scan_remove_block); diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_buf.c b/trunk/drivers/gpu/drm/exynos/exynos_drm_buf.c index 57affae9568b..9601bad47a2e 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_buf.c +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_buf.c @@ -3,10 +3,24 @@ * Copyright (c) 2011 Samsung Electronics Co., Ltd. * Author: Inki Dae * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #include @@ -15,7 +29,6 @@ #include "exynos_drm_drv.h" #include "exynos_drm_gem.h" #include "exynos_drm_buf.h" -#include "exynos_drm_iommu.h" static int lowlevel_buffer_allocate(struct drm_device *dev, unsigned int flags, struct exynos_drm_gem_buf *buf) @@ -38,7 +51,7 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, * region will be allocated else physically contiguous * as possible. */ - if (!(flags & EXYNOS_BO_NONCONTIG)) + if (flags & EXYNOS_BO_CONTIG) dma_set_attr(DMA_ATTR_FORCE_CONTIGUOUS, &buf->dma_attrs); /* @@ -53,45 +66,14 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, dma_set_attr(attr, &buf->dma_attrs); dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, &buf->dma_attrs); - nr_pages = buf->size >> PAGE_SHIFT; - - if (!is_drm_iommu_supported(dev)) { - dma_addr_t start_addr; - unsigned int i = 0; - - buf->pages = kzalloc(sizeof(struct page) * nr_pages, - GFP_KERNEL); - if (!buf->pages) { - DRM_ERROR("failed to allocate pages.\n"); - return -ENOMEM; - } - - buf->kvaddr = dma_alloc_attrs(dev->dev, buf->size, - &buf->dma_addr, GFP_KERNEL, - &buf->dma_attrs); - if (!buf->kvaddr) { - DRM_ERROR("failed to allocate buffer.\n"); - kfree(buf->pages); - return -ENOMEM; - } - - start_addr = buf->dma_addr; - while (i < nr_pages) { - buf->pages[i] = phys_to_page(start_addr); - start_addr += PAGE_SIZE; - i++; - } - } else { - - buf->pages = dma_alloc_attrs(dev->dev, buf->size, - &buf->dma_addr, GFP_KERNEL, - &buf->dma_attrs); - if (!buf->pages) { - DRM_ERROR("failed to allocate buffer.\n"); - return -ENOMEM; - } + buf->pages = dma_alloc_attrs(dev->dev, buf->size, + &buf->dma_addr, GFP_KERNEL, &buf->dma_attrs); + if (!buf->pages) { + DRM_ERROR("failed to allocate buffer.\n"); + return -ENOMEM; } + nr_pages = buf->size >> PAGE_SHIFT; buf->sgt = drm_prime_pages_to_sg(buf->pages, nr_pages); if (!buf->sgt) { DRM_ERROR("failed to get sg table.\n"); @@ -110,9 +92,6 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, (dma_addr_t)buf->dma_addr, &buf->dma_attrs); buf->dma_addr = (dma_addr_t)NULL; - if (!is_drm_iommu_supported(dev)) - kfree(buf->pages); - return ret; } @@ -135,14 +114,8 @@ static void lowlevel_buffer_deallocate(struct drm_device *dev, kfree(buf->sgt); buf->sgt = NULL; - if (!is_drm_iommu_supported(dev)) { - dma_free_attrs(dev->dev, buf->size, buf->kvaddr, - (dma_addr_t)buf->dma_addr, &buf->dma_attrs); - kfree(buf->pages); - } else - dma_free_attrs(dev->dev, buf->size, buf->pages, + dma_free_attrs(dev->dev, buf->size, buf->pages, (dma_addr_t)buf->dma_addr, &buf->dma_attrs); - buf->dma_addr = (dma_addr_t)NULL; } diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_buf.h b/trunk/drivers/gpu/drm/exynos/exynos_drm_buf.h index a6412f19673c..25cf16285033 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_buf.h +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_buf.h @@ -3,10 +3,24 @@ * Copyright (c) 2011 Samsung Electronics Co., Ltd. * Author: Inki Dae * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _EXYNOS_DRM_BUF_H_ diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_connector.c b/trunk/drivers/gpu/drm/exynos/exynos_drm_connector.c index ab37437bad8a..0f68a2872673 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_connector.c +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_connector.c @@ -5,10 +5,24 @@ * Joonyoung Shim * Seung-Woo Kim * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #include diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_connector.h b/trunk/drivers/gpu/drm/exynos/exynos_drm_connector.h index 547c6b590357..22f6cc442c3d 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_connector.h +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_connector.h @@ -5,10 +5,24 @@ * Joonyoung Shim * Seung-Woo Kim * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _EXYNOS_DRM_CONNECTOR_H_ diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_core.c b/trunk/drivers/gpu/drm/exynos/exynos_drm_core.c index 4667c9f67acd..94026ad76a77 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_core.c +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_core.c @@ -6,10 +6,24 @@ * Joonyoung Shim * Seung-Woo Kim * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #include diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/trunk/drivers/gpu/drm/exynos/exynos_drm_crtc.c index e8894bc9e6d5..2efa4b031d73 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_crtc.c +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_crtc.c @@ -6,10 +6,24 @@ * Joonyoung Shim * Seung-Woo Kim * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #include @@ -393,33 +407,3 @@ void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int crtc) exynos_drm_fn_encoder(private->crtc[crtc], &crtc, exynos_drm_disable_vblank); } - -void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int crtc) -{ - struct exynos_drm_private *dev_priv = dev->dev_private; - struct drm_pending_vblank_event *e, *t; - struct timeval now; - unsigned long flags; - - DRM_DEBUG_KMS("%s\n", __FILE__); - - spin_lock_irqsave(&dev->event_lock, flags); - - list_for_each_entry_safe(e, t, &dev_priv->pageflip_event_list, - base.link) { - /* if event's pipe isn't same as crtc then ignore it. */ - if (crtc != e->pipe) - continue; - - do_gettimeofday(&now); - e->event.sequence = 0; - e->event.tv_sec = now.tv_sec; - e->event.tv_usec = now.tv_usec; - - list_move_tail(&e->base.link, &e->base.file_priv->event_list); - wake_up_interruptible(&e->base.file_priv->event_wait); - drm_vblank_put(dev, crtc); - } - - spin_unlock_irqrestore(&dev->event_lock, flags); -} diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_crtc.h b/trunk/drivers/gpu/drm/exynos/exynos_drm_crtc.h index 3e197e6ae7d9..6bae8d8c250e 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_crtc.h +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_crtc.h @@ -6,10 +6,24 @@ * Joonyoung Shim * Seung-Woo Kim * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _EXYNOS_DRM_CRTC_H_ @@ -18,6 +32,5 @@ int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr); int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int crtc); void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int crtc); -void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int crtc); #endif diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c b/trunk/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c index 9df97714b6c0..61d5a8402eb8 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c @@ -3,10 +3,24 @@ * Copyright (c) 2012 Samsung Electronics Co., Ltd. * Author: Inki Dae * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #include @@ -208,7 +222,7 @@ struct dma_buf *exynos_dmabuf_prime_export(struct drm_device *drm_dev, struct exynos_drm_gem_obj *exynos_gem_obj = to_exynos_gem_obj(obj); return dma_buf_export(exynos_gem_obj, &exynos_dmabuf_ops, - exynos_gem_obj->base.size, flags); + exynos_gem_obj->base.size, 0600); } struct drm_gem_object *exynos_dmabuf_prime_import(struct drm_device *drm_dev, @@ -232,12 +246,7 @@ struct drm_gem_object *exynos_dmabuf_prime_import(struct drm_device *drm_dev, /* is it from our device? */ if (obj->dev == drm_dev) { - /* - * Importing dmabuf exported from out own gem increases - * refcount on gem itself instead of f_count of dmabuf. - */ drm_gem_object_reference(obj); - dma_buf_put(dma_buf); return obj; } } diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_dmabuf.h b/trunk/drivers/gpu/drm/exynos/exynos_drm_dmabuf.h index 49acfafb4fdb..662a8f98ccdb 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_dmabuf.h +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_dmabuf.h @@ -3,10 +3,24 @@ * Copyright (c) 2012 Samsung Electronics Co., Ltd. * Author: Inki Dae * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _EXYNOS_DRM_DMABUF_H_ diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_drv.c b/trunk/drivers/gpu/drm/exynos/exynos_drm_drv.c index 3da5c2d214d8..1713e53d4751 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -5,10 +5,24 @@ * Joonyoung Shim * Seung-Woo Kim * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #include diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_drv.h b/trunk/drivers/gpu/drm/exynos/exynos_drm_drv.h index b9e51bc09e81..f5a97745bf93 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -6,10 +6,24 @@ * Joonyoung Shim * Seung-Woo Kim * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _EXYNOS_DRM_DRV_H_ diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/trunk/drivers/gpu/drm/exynos/exynos_drm_encoder.c index c63721f64aec..301485215a70 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_encoder.c +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_encoder.c @@ -6,10 +6,24 @@ * Joonyoung Shim * Seung-Woo Kim * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #include diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_encoder.h b/trunk/drivers/gpu/drm/exynos/exynos_drm_encoder.h index 89e2fb0770af..88bb25a2a917 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_encoder.h +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_encoder.h @@ -5,10 +5,24 @@ * Joonyoung Shim * Seung-Woo Kim * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _EXYNOS_DRM_ENCODER_H_ diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_fb.c b/trunk/drivers/gpu/drm/exynos/exynos_drm_fb.c index 294c0513f587..5426cc5a5e8d 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_fb.c +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_fb.c @@ -6,10 +6,24 @@ * Joonyoung Shim * Seung-Woo Kim * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #include diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_fb.h b/trunk/drivers/gpu/drm/exynos/exynos_drm_fb.h index 517471b37566..96262e54f76d 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_fb.h +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_fb.h @@ -5,10 +5,24 @@ * Joonyoung Shim * Seung-Woo Kim * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _EXYNOS_DRM_FB_H_ diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/trunk/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index 71f867340a88..f433eb7533a9 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_fbdev.c @@ -6,10 +6,24 @@ * Joonyoung Shim * Seung-Woo Kim * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #include @@ -20,7 +34,6 @@ #include "exynos_drm_drv.h" #include "exynos_drm_fb.h" #include "exynos_drm_gem.h" -#include "exynos_drm_iommu.h" #define MAX_CONNECTOR 4 #define PREFERRED_BPP 32 @@ -98,18 +111,9 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, /* map pages with kernel virtual space. */ if (!buffer->kvaddr) { - if (is_drm_iommu_supported(dev)) { - unsigned int nr_pages = buffer->size >> PAGE_SHIFT; - - buffer->kvaddr = vmap(buffer->pages, nr_pages, VM_MAP, + unsigned int nr_pages = buffer->size >> PAGE_SHIFT; + buffer->kvaddr = vmap(buffer->pages, nr_pages, VM_MAP, pgprot_writecombine(PAGE_KERNEL)); - } else { - phys_addr_t dma_addr = buffer->dma_addr; - if (dma_addr) - buffer->kvaddr = phys_to_virt(dma_addr); - else - buffer->kvaddr = (void __iomem *)NULL; - } if (!buffer->kvaddr) { DRM_ERROR("failed to map pages to kernel space.\n"); return -EIO; @@ -124,12 +128,8 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, dev->mode_config.fb_base = (resource_size_t)buffer->dma_addr; fbi->screen_base = buffer->kvaddr + offset; - if (is_drm_iommu_supported(dev)) - fbi->fix.smem_start = (unsigned long) + fbi->fix.smem_start = (unsigned long) (page_to_phys(sg_page(buffer->sgt->sgl)) + offset); - else - fbi->fix.smem_start = (unsigned long)buffer->dma_addr; - fbi->screen_size = size; fbi->fix.smem_len = size; @@ -320,7 +320,7 @@ static void exynos_drm_fbdev_destroy(struct drm_device *dev, struct exynos_drm_gem_obj *exynos_gem_obj = exynos_fbd->exynos_gem_obj; struct drm_framebuffer *fb; - if (is_drm_iommu_supported(dev) && exynos_gem_obj->buffer->kvaddr) + if (exynos_gem_obj->buffer->kvaddr) vunmap(exynos_gem_obj->buffer->kvaddr); /* release drm framebuffer and real buffer */ diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_fbdev.h b/trunk/drivers/gpu/drm/exynos/exynos_drm_fbdev.h index e16d7f0ae192..ccfce8a1a451 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_fbdev.h +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_fbdev.h @@ -6,10 +6,24 @@ * Joonyoung Shim * Seung-Woo Kim * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _EXYNOS_DRM_FBDEV_H_ diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/trunk/drivers/gpu/drm/exynos/exynos_drm_fimc.c index 67a83e69544b..d9963171fd0b 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_fimc.c +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_fimc.c @@ -25,7 +25,7 @@ #include "exynos_drm_fimc.h" /* - * FIMC stands for Fully Interactive Mobile Camera and + * FIMC is stand for Fully Interactive Mobile Camera and * supports image scaler/rotator and input/output DMA operations. * input DMA reads image data from the memory. * output DMA writes image data to memory. @@ -163,28 +163,18 @@ struct fimc_context { bool suspended; }; -static void fimc_sw_reset(struct fimc_context *ctx) +static void fimc_sw_reset(struct fimc_context *ctx, bool pattern) { u32 cfg; - DRM_DEBUG_KMS("%s\n", __func__); - - /* stop dma operation */ - cfg = fimc_read(EXYNOS_CISTATUS); - if (EXYNOS_CISTATUS_GET_ENVID_STATUS(cfg)) { - cfg = fimc_read(EXYNOS_MSCTRL); - cfg &= ~EXYNOS_MSCTRL_ENVID; - fimc_write(cfg, EXYNOS_MSCTRL); - } + DRM_DEBUG_KMS("%s:pattern[%d]\n", __func__, pattern); cfg = fimc_read(EXYNOS_CISRCFMT); cfg |= EXYNOS_CISRCFMT_ITU601_8BIT; - fimc_write(cfg, EXYNOS_CISRCFMT); + if (pattern) + cfg |= EXYNOS_CIGCTRL_TESTPATTERN_COLOR_BAR; - /* disable image capture */ - cfg = fimc_read(EXYNOS_CIIMGCPT); - cfg &= ~(EXYNOS_CIIMGCPT_IMGCPTEN_SC | EXYNOS_CIIMGCPT_IMGCPTEN); - fimc_write(cfg, EXYNOS_CIIMGCPT); + fimc_write(cfg, EXYNOS_CISRCFMT); /* s/w reset */ cfg = fimc_read(EXYNOS_CIGCTRL); @@ -705,7 +695,7 @@ static int fimc_src_set_addr(struct device *dev, { struct fimc_context *ctx = get_fimc_context(dev); struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; - struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node; + struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; struct drm_exynos_ipp_property *property; struct drm_exynos_ipp_config *config; @@ -715,6 +705,10 @@ static int fimc_src_set_addr(struct device *dev, } property = &c_node->property; + if (!property) { + DRM_ERROR("failed to get property.\n"); + return -EINVAL; + } DRM_DEBUG_KMS("%s:prop_id[%d]buf_id[%d]buf_type[%d]\n", __func__, property->prop_id, buf_id, buf_type); @@ -1212,7 +1206,7 @@ static int fimc_dst_set_buf_seq(struct fimc_context *ctx, u32 buf_id, } /* sequence id */ - cfg &= ~mask; + cfg &= (~mask); cfg |= (enable << buf_id); fimc_write(cfg, EXYNOS_CIFCNTSEQ); @@ -1237,7 +1231,7 @@ static int fimc_dst_set_addr(struct device *dev, { struct fimc_context *ctx = get_fimc_context(dev); struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; - struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node; + struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; struct drm_exynos_ipp_property *property; struct drm_exynos_ipp_config *config; @@ -1247,6 +1241,10 @@ static int fimc_dst_set_addr(struct device *dev, } property = &c_node->property; + if (!property) { + DRM_ERROR("failed to get property.\n"); + return -EINVAL; + } DRM_DEBUG_KMS("%s:prop_id[%d]buf_id[%d]buf_type[%d]\n", __func__, property->prop_id, buf_id, buf_type); @@ -1319,7 +1317,7 @@ static irqreturn_t fimc_irq_handler(int irq, void *dev_id) { struct fimc_context *ctx = dev_id; struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; - struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node; + struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; struct drm_exynos_ipp_event_work *event_work = c_node->event_work; int buf_id; @@ -1397,7 +1395,6 @@ static inline bool fimc_check_drm_flip(enum drm_exynos_flip flip) case EXYNOS_DRM_FLIP_NONE: case EXYNOS_DRM_FLIP_VERTICAL: case EXYNOS_DRM_FLIP_HORIZONTAL: - case EXYNOS_DRM_FLIP_BOTH: return true; default: DRM_DEBUG_KMS("%s:invalid flip\n", __func__); @@ -1546,7 +1543,7 @@ static int fimc_ippdrv_reset(struct device *dev) DRM_DEBUG_KMS("%s\n", __func__); /* reset h/w block */ - fimc_sw_reset(ctx); + fimc_sw_reset(ctx, false); /* reset scaler capability */ memset(&ctx->sc, 0x0, sizeof(ctx->sc)); @@ -1560,7 +1557,7 @@ static int fimc_ippdrv_start(struct device *dev, enum drm_exynos_ipp_cmd cmd) { struct fimc_context *ctx = get_fimc_context(dev); struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; - struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node; + struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; struct drm_exynos_ipp_property *property; struct drm_exynos_ipp_config *config; struct drm_exynos_pos img_pos[EXYNOS_DRM_OPS_MAX]; @@ -1576,6 +1573,10 @@ static int fimc_ippdrv_start(struct device *dev, enum drm_exynos_ipp_cmd cmd) } property = &c_node->property; + if (!property) { + DRM_ERROR("failed to get property.\n"); + return -EINVAL; + } fimc_handle_irq(ctx, true, false, true); @@ -1738,64 +1739,93 @@ static int fimc_probe(struct platform_device *pdev) platform_get_device_id(pdev)->driver_data; /* clock control */ - ctx->sclk_fimc_clk = devm_clk_get(dev, "sclk_fimc"); + ctx->sclk_fimc_clk = clk_get(dev, "sclk_fimc"); if (IS_ERR(ctx->sclk_fimc_clk)) { dev_err(dev, "failed to get src fimc clock.\n"); - return PTR_ERR(ctx->sclk_fimc_clk); + ret = PTR_ERR(ctx->sclk_fimc_clk); + goto err_ctx; } clk_enable(ctx->sclk_fimc_clk); - ctx->fimc_clk = devm_clk_get(dev, "fimc"); + ctx->fimc_clk = clk_get(dev, "fimc"); if (IS_ERR(ctx->fimc_clk)) { dev_err(dev, "failed to get fimc clock.\n"); + ret = PTR_ERR(ctx->fimc_clk); clk_disable(ctx->sclk_fimc_clk); - return PTR_ERR(ctx->fimc_clk); + clk_put(ctx->sclk_fimc_clk); + goto err_ctx; } - ctx->wb_clk = devm_clk_get(dev, "pxl_async0"); + ctx->wb_clk = clk_get(dev, "pxl_async0"); if (IS_ERR(ctx->wb_clk)) { dev_err(dev, "failed to get writeback a clock.\n"); + ret = PTR_ERR(ctx->wb_clk); clk_disable(ctx->sclk_fimc_clk); - return PTR_ERR(ctx->wb_clk); + clk_put(ctx->sclk_fimc_clk); + clk_put(ctx->fimc_clk); + goto err_ctx; } - ctx->wb_b_clk = devm_clk_get(dev, "pxl_async1"); + ctx->wb_b_clk = clk_get(dev, "pxl_async1"); if (IS_ERR(ctx->wb_b_clk)) { dev_err(dev, "failed to get writeback b clock.\n"); + ret = PTR_ERR(ctx->wb_b_clk); clk_disable(ctx->sclk_fimc_clk); - return PTR_ERR(ctx->wb_b_clk); + clk_put(ctx->sclk_fimc_clk); + clk_put(ctx->fimc_clk); + clk_put(ctx->wb_clk); + goto err_ctx; } - parent_clk = devm_clk_get(dev, ddata->parent_clk); + parent_clk = clk_get(dev, ddata->parent_clk); if (IS_ERR(parent_clk)) { dev_err(dev, "failed to get parent clock.\n"); + ret = PTR_ERR(parent_clk); clk_disable(ctx->sclk_fimc_clk); - return PTR_ERR(parent_clk); + clk_put(ctx->sclk_fimc_clk); + clk_put(ctx->fimc_clk); + clk_put(ctx->wb_clk); + clk_put(ctx->wb_b_clk); + goto err_ctx; } if (clk_set_parent(ctx->sclk_fimc_clk, parent_clk)) { dev_err(dev, "failed to set parent.\n"); + ret = -EINVAL; + clk_put(parent_clk); clk_disable(ctx->sclk_fimc_clk); - return -EINVAL; + clk_put(ctx->sclk_fimc_clk); + clk_put(ctx->fimc_clk); + clk_put(ctx->wb_clk); + clk_put(ctx->wb_b_clk); + goto err_ctx; } - devm_clk_put(dev, parent_clk); + clk_put(parent_clk); clk_set_rate(ctx->sclk_fimc_clk, pdata->clk_rate); /* resource memory */ ctx->regs_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!ctx->regs_res) { + dev_err(dev, "failed to find registers.\n"); + ret = -ENOENT; + goto err_clk; + } + ctx->regs = devm_request_and_ioremap(dev, ctx->regs_res); if (!ctx->regs) { dev_err(dev, "failed to map registers.\n"); - return -ENXIO; + ret = -ENXIO; + goto err_clk; } /* resource irq */ res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (!res) { dev_err(dev, "failed to request irq resource.\n"); - return -ENOENT; + ret = -ENOENT; + goto err_get_regs; } ctx->irq = res->start; @@ -1803,7 +1833,7 @@ static int fimc_probe(struct platform_device *pdev) IRQF_ONESHOT, "drm_fimc", ctx); if (ret < 0) { dev_err(dev, "failed to request irq.\n"); - return ret; + goto err_get_regs; } /* context initailization */ @@ -1849,7 +1879,15 @@ static int fimc_probe(struct platform_device *pdev) pm_runtime_disable(dev); err_get_irq: free_irq(ctx->irq, ctx); - +err_get_regs: + devm_iounmap(dev, ctx->regs); +err_clk: + clk_put(ctx->sclk_fimc_clk); + clk_put(ctx->fimc_clk); + clk_put(ctx->wb_clk); + clk_put(ctx->wb_b_clk); +err_ctx: + devm_kfree(dev, ctx); return ret; } @@ -1867,6 +1905,14 @@ static int fimc_remove(struct platform_device *pdev) pm_runtime_disable(dev); free_irq(ctx->irq, ctx); + devm_iounmap(dev, ctx->regs); + + clk_put(ctx->sclk_fimc_clk); + clk_put(ctx->fimc_clk); + clk_put(ctx->wb_clk); + clk_put(ctx->wb_b_clk); + + devm_kfree(dev, ctx); return 0; } diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_fimc.h b/trunk/drivers/gpu/drm/exynos/exynos_drm_fimc.h index 127a424c5fdf..dc970fa0d888 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_fimc.h +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_fimc.h @@ -6,10 +6,24 @@ * Jinyoung Jeon * Sangmin Lee * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _EXYNOS_DRM_FIMC_H_ diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/trunk/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 9537761931ee..3ac911894dc7 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -663,6 +663,34 @@ static struct exynos_drm_manager fimd_manager = { .display_ops = &fimd_display_ops, }; +static void fimd_finish_pageflip(struct drm_device *drm_dev, int crtc) +{ + struct exynos_drm_private *dev_priv = drm_dev->dev_private; + struct drm_pending_vblank_event *e, *t; + struct timeval now; + unsigned long flags; + + spin_lock_irqsave(&drm_dev->event_lock, flags); + + list_for_each_entry_safe(e, t, &dev_priv->pageflip_event_list, + base.link) { + /* if event's pipe isn't same as crtc then ignore it. */ + if (crtc != e->pipe) + continue; + + do_gettimeofday(&now); + e->event.sequence = 0; + e->event.tv_sec = now.tv_sec; + e->event.tv_usec = now.tv_usec; + + list_move_tail(&e->base.link, &e->base.file_priv->event_list); + wake_up_interruptible(&e->base.file_priv->event_wait); + drm_vblank_put(drm_dev, crtc); + } + + spin_unlock_irqrestore(&drm_dev->event_lock, flags); +} + static irqreturn_t fimd_irq_handler(int irq, void *dev_id) { struct fimd_context *ctx = (struct fimd_context *)dev_id; @@ -682,7 +710,7 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id) goto out; drm_handle_vblank(drm_dev, manager->pipe); - exynos_drm_crtc_finish_pageflip(drm_dev, manager->pipe); + fimd_finish_pageflip(drm_dev, manager->pipe); /* set wait vsync event to zero and wake up queue. */ if (atomic_read(&ctx->wait_vsync_event)) { @@ -1018,7 +1046,7 @@ static int fimd_resume(struct device *dev) * of pm runtime would still be 1 so in this case, fimd driver * should be on directly not drawing on pm runtime interface. */ - if (!pm_runtime_suspended(dev)) { + if (pm_runtime_suspended(dev)) { int ret; ret = fimd_activate(ctx, true); diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_gem.c b/trunk/drivers/gpu/drm/exynos/exynos_drm_gem.c index 473180776528..d48183e7e056 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_gem.c @@ -3,10 +3,24 @@ * Copyright (c) 2011 Samsung Electronics Co., Ltd. * Author: Inki Dae * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #include diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_gem.h b/trunk/drivers/gpu/drm/exynos/exynos_drm_gem.h index 35ebac47dc2b..f11f2afd5bfc 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_gem.h +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_gem.h @@ -3,10 +3,24 @@ * Copyright (c) 2011 Samsung Electronics Co., Ltd. * Authoer: Inki Dae * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _EXYNOS_DRM_GEM_H_ diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/trunk/drivers/gpu/drm/exynos/exynos_drm_gsc.c index 8140753ec9c8..4b0e8589bd19 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_gsc.c +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_gsc.c @@ -25,7 +25,7 @@ #include "exynos_drm_gsc.h" /* - * GSC stands for General SCaler and + * GSC is stand for General SCaler and * supports image scaler/rotator and input/output DMA operations. * input DMA reads image data from the memory. * output DMA writes image data to memory. @@ -711,7 +711,7 @@ static int gsc_src_set_addr(struct device *dev, { struct gsc_context *ctx = get_gsc_context(dev); struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; - struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node; + struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; struct drm_exynos_ipp_property *property; if (!c_node) { @@ -720,6 +720,10 @@ static int gsc_src_set_addr(struct device *dev, } property = &c_node->property; + if (!property) { + DRM_ERROR("failed to get property.\n"); + return -EFAULT; + } DRM_DEBUG_KMS("%s:prop_id[%d]buf_id[%d]buf_type[%d]\n", __func__, property->prop_id, buf_id, buf_type); @@ -1167,7 +1171,7 @@ static int gsc_dst_set_addr(struct device *dev, { struct gsc_context *ctx = get_gsc_context(dev); struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; - struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node; + struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; struct drm_exynos_ipp_property *property; if (!c_node) { @@ -1176,6 +1180,10 @@ static int gsc_dst_set_addr(struct device *dev, } property = &c_node->property; + if (!property) { + DRM_ERROR("failed to get property.\n"); + return -EFAULT; + } DRM_DEBUG_KMS("%s:prop_id[%d]buf_id[%d]buf_type[%d]\n", __func__, property->prop_id, buf_id, buf_type); @@ -1304,7 +1312,7 @@ static irqreturn_t gsc_irq_handler(int irq, void *dev_id) { struct gsc_context *ctx = dev_id; struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; - struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node; + struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; struct drm_exynos_ipp_event_work *event_work = c_node->event_work; u32 status; @@ -1391,7 +1399,7 @@ static inline bool gsc_check_drm_flip(enum drm_exynos_flip flip) case EXYNOS_DRM_FLIP_NONE: case EXYNOS_DRM_FLIP_VERTICAL: case EXYNOS_DRM_FLIP_HORIZONTAL: - case EXYNOS_DRM_FLIP_BOTH: + case EXYNOS_DRM_FLIP_VERTICAL | EXYNOS_DRM_FLIP_HORIZONTAL: return true; default: DRM_DEBUG_KMS("%s:invalid flip\n", __func__); @@ -1541,7 +1549,7 @@ static int gsc_ippdrv_start(struct device *dev, enum drm_exynos_ipp_cmd cmd) { struct gsc_context *ctx = get_gsc_context(dev); struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; - struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node; + struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; struct drm_exynos_ipp_property *property; struct drm_exynos_ipp_config *config; struct drm_exynos_pos img_pos[EXYNOS_DRM_OPS_MAX]; @@ -1557,6 +1565,10 @@ static int gsc_ippdrv_start(struct device *dev, enum drm_exynos_ipp_cmd cmd) } property = &c_node->property; + if (!property) { + DRM_ERROR("failed to get property.\n"); + return -EINVAL; + } gsc_handle_irq(ctx, true, false, true); @@ -1592,7 +1604,7 @@ static int gsc_ippdrv_start(struct device *dev, enum drm_exynos_ipp_cmd cmd) exynos_drm_ippnb_send_event(IPP_SET_WRITEBACK, (void *)&set_wb); /* src local path */ - cfg = gsc_read(GSC_IN_CON); + cfg = readl(GSC_IN_CON); cfg &= ~(GSC_IN_PATH_MASK | GSC_IN_LOCAL_SEL_MASK); cfg |= (GSC_IN_PATH_LOCAL | GSC_IN_LOCAL_FIMD_WB); gsc_write(cfg, GSC_IN_CON); @@ -1684,25 +1696,34 @@ static int gsc_probe(struct platform_device *pdev) return -ENOMEM; /* clock control */ - ctx->gsc_clk = devm_clk_get(dev, "gscl"); + ctx->gsc_clk = clk_get(dev, "gscl"); if (IS_ERR(ctx->gsc_clk)) { dev_err(dev, "failed to get gsc clock.\n"); - return PTR_ERR(ctx->gsc_clk); + ret = PTR_ERR(ctx->gsc_clk); + goto err_ctx; } /* resource memory */ ctx->regs_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!ctx->regs_res) { + dev_err(dev, "failed to find registers.\n"); + ret = -ENOENT; + goto err_clk; + } + ctx->regs = devm_request_and_ioremap(dev, ctx->regs_res); if (!ctx->regs) { dev_err(dev, "failed to map registers.\n"); - return -ENXIO; + ret = -ENXIO; + goto err_clk; } /* resource irq */ res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (!res) { dev_err(dev, "failed to request irq resource.\n"); - return -ENOENT; + ret = -ENOENT; + goto err_get_regs; } ctx->irq = res->start; @@ -1710,7 +1731,7 @@ static int gsc_probe(struct platform_device *pdev) IRQF_ONESHOT, "drm_gsc", ctx); if (ret < 0) { dev_err(dev, "failed to request irq.\n"); - return ret; + goto err_get_regs; } /* context initailization */ @@ -1754,6 +1775,12 @@ static int gsc_probe(struct platform_device *pdev) pm_runtime_disable(dev); err_get_irq: free_irq(ctx->irq, ctx); +err_get_regs: + devm_iounmap(dev, ctx->regs); +err_clk: + clk_put(ctx->gsc_clk); +err_ctx: + devm_kfree(dev, ctx); return ret; } @@ -1771,6 +1798,11 @@ static int gsc_remove(struct platform_device *pdev) pm_runtime_disable(dev); free_irq(ctx->irq, ctx); + devm_iounmap(dev, ctx->regs); + + clk_put(ctx->gsc_clk); + + devm_kfree(dev, ctx); return 0; } diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_gsc.h b/trunk/drivers/gpu/drm/exynos/exynos_drm_gsc.h index 29ec1c5efcf2..b3c3bc618c0f 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_gsc.h +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_gsc.h @@ -6,10 +6,24 @@ * Jinyoung Jeon * Sangmin Lee * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _EXYNOS_DRM_GSC_H_ diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_hdmi.h b/trunk/drivers/gpu/drm/exynos/exynos_drm_hdmi.h index 784a7e9a766c..fcc3093ec8fe 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_hdmi.h +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_hdmi.h @@ -3,10 +3,24 @@ * Copyright (c) 2011 Samsung Electronics Co., Ltd. * Authoer: Inki Dae * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _EXYNOS_DRM_HDMI_H_ diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_iommu.c b/trunk/drivers/gpu/drm/exynos/exynos_drm_iommu.c index 3799d5c2b5df..2482b7f96341 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_iommu.c +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_iommu.c @@ -3,10 +3,24 @@ * Copyright (c) 2012 Samsung Electronics Co., Ltd. * Author: Inki Dae * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #include diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_iommu.h b/trunk/drivers/gpu/drm/exynos/exynos_drm_iommu.h index 53b7deea8ab7..18a0ca190b98 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_iommu.h +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_iommu.h @@ -3,10 +3,24 @@ * Copyright (c) 2012 Samsung Electronics Co., Ltd. * Authoer: Inki Dae * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _EXYNOS_DRM_IOMMU_H_ diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_ipp.c b/trunk/drivers/gpu/drm/exynos/exynos_drm_ipp.c index 0bda96454a02..c1f12301224c 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_ipp.c +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_ipp.c @@ -27,7 +27,7 @@ #include "exynos_drm_iommu.h" /* - * IPP stands for Image Post Processing and + * IPP is stand for Image Post Processing and * supports image scaler/rotator and input/output DMA operations. * using FIMC, GSC, Rotator, so on. * IPP is integration device driver of same attribute h/w @@ -1292,7 +1292,7 @@ static int ipp_start_property(struct exynos_drm_ippdrv *ippdrv, DRM_DEBUG_KMS("%s:prop_id[%d]\n", __func__, property->prop_id); /* store command info in ippdrv */ - ippdrv->c_node = c_node; + ippdrv->cmd = c_node; if (!ipp_check_mem_list(c_node)) { DRM_DEBUG_KMS("%s:empty memory.\n", __func__); @@ -1303,7 +1303,7 @@ static int ipp_start_property(struct exynos_drm_ippdrv *ippdrv, ret = ipp_set_property(ippdrv, property); if (ret) { DRM_ERROR("failed to set property.\n"); - ippdrv->c_node = NULL; + ippdrv->cmd = NULL; return ret; } @@ -1487,6 +1487,11 @@ void ipp_sched_cmd(struct work_struct *work) mutex_lock(&c_node->cmd_lock); property = &c_node->property; + if (!property) { + DRM_ERROR("failed to get property:prop_id[%d]\n", + c_node->property.prop_id); + goto err_unlock; + } switch (cmd_work->ctrl) { case IPP_CTRL_PLAY: @@ -1699,7 +1704,7 @@ void ipp_sched_event(struct work_struct *work) return; } - c_node = ippdrv->c_node; + c_node = ippdrv->cmd; if (!c_node) { DRM_ERROR("failed to get command node.\n"); return; @@ -1890,7 +1895,7 @@ static int ipp_probe(struct platform_device *pdev) struct exynos_drm_subdrv *subdrv; int ret; - ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); if (!ctx) return -ENOMEM; @@ -1911,7 +1916,8 @@ static int ipp_probe(struct platform_device *pdev) ctx->event_workq = create_singlethread_workqueue("ipp_event"); if (!ctx->event_workq) { dev_err(dev, "failed to create event workqueue\n"); - return -EINVAL; + ret = -EINVAL; + goto err_clear; } /* @@ -1952,6 +1958,8 @@ static int ipp_probe(struct platform_device *pdev) destroy_workqueue(ctx->cmd_workq); err_event_workq: destroy_workqueue(ctx->event_workq); +err_clear: + kfree(ctx); return ret; } @@ -1977,6 +1985,8 @@ static int ipp_remove(struct platform_device *pdev) destroy_workqueue(ctx->cmd_workq); destroy_workqueue(ctx->event_workq); + kfree(ctx); + return 0; } diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_ipp.h b/trunk/drivers/gpu/drm/exynos/exynos_drm_ipp.h index 4cadbea7dbde..28ffac95386c 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_ipp.h +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_ipp.h @@ -6,10 +6,24 @@ * Jinyoung Jeon * Sangmin Lee * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _EXYNOS_DRM_IPP_H_ @@ -146,7 +160,7 @@ struct exynos_drm_ipp_ops { * @dedicated: dedicated ipp device. * @ops: source, destination operations. * @event_workq: event work queue. - * @c_node: current command information. + * @cmd: current command information. * @cmd_list: list head for command information. * @prop_list: property informations of current ipp driver. * @check_property: check property about format, size, buffer. @@ -164,7 +178,7 @@ struct exynos_drm_ippdrv { bool dedicated; struct exynos_drm_ipp_ops *ops[EXYNOS_DRM_OPS_MAX]; struct workqueue_struct *event_workq; - struct drm_exynos_ipp_cmd_node *c_node; + struct drm_exynos_ipp_cmd_node *cmd; struct list_head cmd_list; struct drm_exynos_ipp_prop_list *prop_list; diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_rotator.c b/trunk/drivers/gpu/drm/exynos/exynos_drm_rotator.c index e9e83ef688f0..c748850737a1 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_rotator.c +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_rotator.c @@ -139,7 +139,7 @@ static irqreturn_t rotator_irq_handler(int irq, void *arg) { struct rot_context *rot = arg; struct exynos_drm_ippdrv *ippdrv = &rot->ippdrv; - struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node; + struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; struct drm_exynos_ipp_event_work *event_work = c_node->event_work; enum rot_irq_status irq_status; u32 val; @@ -513,7 +513,6 @@ static inline bool rotator_check_drm_flip(enum drm_exynos_flip flip) case EXYNOS_DRM_FLIP_NONE: case EXYNOS_DRM_FLIP_VERTICAL: case EXYNOS_DRM_FLIP_HORIZONTAL: - case EXYNOS_DRM_FLIP_BOTH: return true; default: DRM_DEBUG_KMS("%s:invalid flip\n", __func__); @@ -656,26 +655,34 @@ static int rotator_probe(struct platform_device *pdev) platform_get_device_id(pdev)->driver_data; rot->regs_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!rot->regs_res) { + dev_err(dev, "failed to find registers\n"); + ret = -ENOENT; + goto err_get_resource; + } + rot->regs = devm_request_and_ioremap(dev, rot->regs_res); if (!rot->regs) { dev_err(dev, "failed to map register\n"); - return -ENXIO; + ret = -ENXIO; + goto err_get_resource; } rot->irq = platform_get_irq(pdev, 0); if (rot->irq < 0) { dev_err(dev, "failed to get irq\n"); - return rot->irq; + ret = rot->irq; + goto err_get_irq; } ret = request_threaded_irq(rot->irq, NULL, rotator_irq_handler, IRQF_ONESHOT, "drm_rotator", rot); if (ret < 0) { dev_err(dev, "failed to request irq\n"); - return ret; + goto err_get_irq; } - rot->clock = devm_clk_get(dev, "rotator"); + rot->clock = clk_get(dev, "rotator"); if (IS_ERR_OR_NULL(rot->clock)) { dev_err(dev, "failed to get clock\n"); ret = PTR_ERR(rot->clock); @@ -713,8 +720,13 @@ static int rotator_probe(struct platform_device *pdev) err_ippdrv_register: devm_kfree(dev, ippdrv->prop_list); pm_runtime_disable(dev); + clk_put(rot->clock); err_clk_get: free_irq(rot->irq, rot); +err_get_irq: + devm_iounmap(dev, rot->regs); +err_get_resource: + devm_kfree(dev, rot); return ret; } @@ -728,8 +740,12 @@ static int rotator_remove(struct platform_device *pdev) exynos_drm_ippdrv_unregister(ippdrv); pm_runtime_disable(dev); + clk_put(rot->clock); free_irq(rot->irq, rot); + devm_iounmap(dev, rot->regs); + + devm_kfree(dev, rot); return 0; } diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_rotator.h b/trunk/drivers/gpu/drm/exynos/exynos_drm_rotator.h index 71a0b4c0c1e8..a2d7a14a52b6 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_rotator.h +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_rotator.h @@ -5,10 +5,24 @@ * YoungJun Cho * Eunchul Kim * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _EXYNOS_DRM_ROTATOR_H_ diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/trunk/drivers/gpu/drm/exynos/exynos_drm_vidi.c index d0ca3c4e06c6..a5c5a179e3b6 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_vidi.c @@ -372,6 +372,34 @@ static struct exynos_drm_manager vidi_manager = { .display_ops = &vidi_display_ops, }; +static void vidi_finish_pageflip(struct drm_device *drm_dev, int crtc) +{ + struct exynos_drm_private *dev_priv = drm_dev->dev_private; + struct drm_pending_vblank_event *e, *t; + struct timeval now; + unsigned long flags; + + spin_lock_irqsave(&drm_dev->event_lock, flags); + + list_for_each_entry_safe(e, t, &dev_priv->pageflip_event_list, + base.link) { + /* if event's pipe isn't same as crtc then ignore it. */ + if (crtc != e->pipe) + continue; + + do_gettimeofday(&now); + e->event.sequence = 0; + e->event.tv_sec = now.tv_sec; + e->event.tv_usec = now.tv_usec; + + list_move_tail(&e->base.link, &e->base.file_priv->event_list); + wake_up_interruptible(&e->base.file_priv->event_wait); + drm_vblank_put(drm_dev, crtc); + } + + spin_unlock_irqrestore(&drm_dev->event_lock, flags); +} + static void vidi_fake_vblank_handler(struct work_struct *work) { struct vidi_context *ctx = container_of(work, struct vidi_context, @@ -396,7 +424,7 @@ static void vidi_fake_vblank_handler(struct work_struct *work) mutex_unlock(&ctx->lock); - exynos_drm_crtc_finish_pageflip(subdrv->drm_dev, manager->pipe); + vidi_finish_pageflip(subdrv->drm_dev, manager->pipe); } static int vidi_subdrv_probe(struct drm_device *drm_dev, struct device *dev) diff --git a/trunk/drivers/gpu/drm/exynos/exynos_drm_vidi.h b/trunk/drivers/gpu/drm/exynos/exynos_drm_vidi.h index 1e5fdaa36ccc..a4babe4e65d7 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_drm_vidi.h +++ b/trunk/drivers/gpu/drm/exynos/exynos_drm_vidi.h @@ -3,10 +3,24 @@ * Copyright (c) 2012 Samsung Electronics Co., Ltd. * Author: Inki Dae * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _EXYNOS_DRM_VIDI_H_ diff --git a/trunk/drivers/gpu/drm/exynos/exynos_hdmi.h b/trunk/drivers/gpu/drm/exynos/exynos_hdmi.h index 0ddf3957de15..1c3b6d8f1fe7 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_hdmi.h +++ b/trunk/drivers/gpu/drm/exynos/exynos_hdmi.h @@ -5,10 +5,24 @@ * Inki Dae * Seung-Woo Kim * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _EXYNOS_HDMI_H_ diff --git a/trunk/drivers/gpu/drm/exynos/exynos_mixer.c b/trunk/drivers/gpu/drm/exynos/exynos_mixer.c index c187ea33b748..3f68b34fa127 100644 --- a/trunk/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/trunk/drivers/gpu/drm/exynos/exynos_mixer.c @@ -35,7 +35,6 @@ #include #include "exynos_drm_drv.h" -#include "exynos_drm_crtc.h" #include "exynos_drm_hdmi.h" #include "exynos_drm_iommu.h" @@ -950,6 +949,35 @@ static struct exynos_mixer_ops mixer_ops = { .win_disable = mixer_win_disable, }; +/* for pageflip event */ +static void mixer_finish_pageflip(struct drm_device *drm_dev, int crtc) +{ + struct exynos_drm_private *dev_priv = drm_dev->dev_private; + struct drm_pending_vblank_event *e, *t; + struct timeval now; + unsigned long flags; + + spin_lock_irqsave(&drm_dev->event_lock, flags); + + list_for_each_entry_safe(e, t, &dev_priv->pageflip_event_list, + base.link) { + /* if event's pipe isn't same as crtc then ignore it. */ + if (crtc != e->pipe) + continue; + + do_gettimeofday(&now); + e->event.sequence = 0; + e->event.tv_sec = now.tv_sec; + e->event.tv_usec = now.tv_usec; + + list_move_tail(&e->base.link, &e->base.file_priv->event_list); + wake_up_interruptible(&e->base.file_priv->event_wait); + drm_vblank_put(drm_dev, crtc); + } + + spin_unlock_irqrestore(&drm_dev->event_lock, flags); +} + static irqreturn_t mixer_irq_handler(int irq, void *arg) { struct exynos_drm_hdmi_context *drm_hdmi_ctx = arg; @@ -978,8 +1006,7 @@ static irqreturn_t mixer_irq_handler(int irq, void *arg) } drm_handle_vblank(drm_hdmi_ctx->drm_dev, ctx->pipe); - exynos_drm_crtc_finish_pageflip(drm_hdmi_ctx->drm_dev, - ctx->pipe); + mixer_finish_pageflip(drm_hdmi_ctx->drm_dev, ctx->pipe); /* set wait vsync event to zero and wake up queue. */ if (atomic_read(&ctx->wait_vsync_event)) { diff --git a/trunk/drivers/gpu/drm/i915/i915_debugfs.c b/trunk/drivers/gpu/drm/i915/i915_debugfs.c index 7944d301518a..e6a11ca85eaf 100644 --- a/trunk/drivers/gpu/drm/i915/i915_debugfs.c +++ b/trunk/drivers/gpu/drm/i915/i915_debugfs.c @@ -641,7 +641,6 @@ static void i915_ring_error_state(struct seq_file *m, seq_printf(m, "%s command stream:\n", ring_str(ring)); seq_printf(m, " HEAD: 0x%08x\n", error->head[ring]); seq_printf(m, " TAIL: 0x%08x\n", error->tail[ring]); - seq_printf(m, " CTL: 0x%08x\n", error->ctl[ring]); seq_printf(m, " ACTHD: 0x%08x\n", error->acthd[ring]); seq_printf(m, " IPEIR: 0x%08x\n", error->ipeir[ring]); seq_printf(m, " IPEHR: 0x%08x\n", error->ipehr[ring]); @@ -694,8 +693,6 @@ static int i915_error_state(struct seq_file *m, void *unused) seq_printf(m, "EIR: 0x%08x\n", error->eir); seq_printf(m, "IER: 0x%08x\n", error->ier); seq_printf(m, "PGTBL_ER: 0x%08x\n", error->pgtbl_er); - seq_printf(m, "FORCEWAKE: 0x%08x\n", error->forcewake); - seq_printf(m, "DERRMR: 0x%08x\n", error->derrmr); seq_printf(m, "CCID: 0x%08x\n", error->ccid); for (i = 0; i < dev_priv->num_fence_regs; i++) diff --git a/trunk/drivers/gpu/drm/i915/i915_drv.h b/trunk/drivers/gpu/drm/i915/i915_drv.h index 12ab3bdea54d..ed3059575576 100644 --- a/trunk/drivers/gpu/drm/i915/i915_drv.h +++ b/trunk/drivers/gpu/drm/i915/i915_drv.h @@ -188,13 +188,10 @@ struct drm_i915_error_state { u32 pgtbl_er; u32 ier; u32 ccid; - u32 derrmr; - u32 forcewake; bool waiting[I915_NUM_RINGS]; u32 pipestat[I915_MAX_PIPES]; u32 tail[I915_NUM_RINGS]; u32 head[I915_NUM_RINGS]; - u32 ctl[I915_NUM_RINGS]; u32 ipeir[I915_NUM_RINGS]; u32 ipehr[I915_NUM_RINGS]; u32 instdone[I915_NUM_RINGS]; diff --git a/trunk/drivers/gpu/drm/i915/i915_gem.c b/trunk/drivers/gpu/drm/i915/i915_gem.c index 8febea6daa08..da3c82e301b1 100644 --- a/trunk/drivers/gpu/drm/i915/i915_gem.c +++ b/trunk/drivers/gpu/drm/i915/i915_gem.c @@ -1717,8 +1717,7 @@ i915_gem_object_put_pages(struct drm_i915_gem_object *obj) } static long -__i915_gem_shrink(struct drm_i915_private *dev_priv, long target, - bool purgeable_only) +i915_gem_purge(struct drm_i915_private *dev_priv, long target) { struct drm_i915_gem_object *obj, *next; long count = 0; @@ -1726,7 +1725,7 @@ __i915_gem_shrink(struct drm_i915_private *dev_priv, long target, list_for_each_entry_safe(obj, next, &dev_priv->mm.unbound_list, gtt_list) { - if ((i915_gem_object_is_purgeable(obj) || !purgeable_only) && + if (i915_gem_object_is_purgeable(obj) && i915_gem_object_put_pages(obj) == 0) { count += obj->base.size >> PAGE_SHIFT; if (count >= target) @@ -1737,7 +1736,7 @@ __i915_gem_shrink(struct drm_i915_private *dev_priv, long target, list_for_each_entry_safe(obj, next, &dev_priv->mm.inactive_list, mm_list) { - if ((i915_gem_object_is_purgeable(obj) || !purgeable_only) && + if (i915_gem_object_is_purgeable(obj) && i915_gem_object_unbind(obj) == 0 && i915_gem_object_put_pages(obj) == 0) { count += obj->base.size >> PAGE_SHIFT; @@ -1749,12 +1748,6 @@ __i915_gem_shrink(struct drm_i915_private *dev_priv, long target, return count; } -static long -i915_gem_purge(struct drm_i915_private *dev_priv, long target) -{ - return __i915_gem_shrink(dev_priv, target, true); -} - static void i915_gem_shrink_all(struct drm_i915_private *dev_priv) { @@ -3529,15 +3522,14 @@ i915_gem_pin_ioctl(struct drm_device *dev, void *data, goto out; } - if (obj->user_pin_count == 0) { + obj->user_pin_count++; + obj->pin_filp = file; + if (obj->user_pin_count == 1) { ret = i915_gem_object_pin(obj, args->alignment, true, false); if (ret) goto out; } - obj->user_pin_count++; - obj->pin_filp = file; - /* XXX - flush the CPU caches for pinned objects * as the X server doesn't manage domains yet */ @@ -4402,9 +4394,6 @@ i915_gem_inactive_shrink(struct shrinker *shrinker, struct shrink_control *sc) if (nr_to_scan) { nr_to_scan -= i915_gem_purge(dev_priv, nr_to_scan); - if (nr_to_scan > 0) - nr_to_scan -= __i915_gem_shrink(dev_priv, nr_to_scan, - false); if (nr_to_scan > 0) i915_gem_shrink_all(dev_priv); } @@ -4413,7 +4402,7 @@ i915_gem_inactive_shrink(struct shrinker *shrinker, struct shrink_control *sc) list_for_each_entry(obj, &dev_priv->mm.unbound_list, gtt_list) if (obj->pages_pin_count == 0) cnt += obj->base.size >> PAGE_SHIFT; - list_for_each_entry(obj, &dev_priv->mm.inactive_list, gtt_list) + list_for_each_entry(obj, &dev_priv->mm.bound_list, gtt_list) if (obj->pin_count == 0 && obj->pages_pin_count == 0) cnt += obj->base.size >> PAGE_SHIFT; diff --git a/trunk/drivers/gpu/drm/i915/i915_gem_dmabuf.c b/trunk/drivers/gpu/drm/i915/i915_gem_dmabuf.c index abeaafef6d7e..7be4241e8242 100644 --- a/trunk/drivers/gpu/drm/i915/i915_gem_dmabuf.c +++ b/trunk/drivers/gpu/drm/i915/i915_gem_dmabuf.c @@ -266,12 +266,7 @@ struct drm_gem_object *i915_gem_prime_import(struct drm_device *dev, obj = dma_buf->priv; /* is it from our device? */ if (obj->base.dev == dev) { - /* - * Importing dmabuf exported from out own gem increases - * refcount on gem itself instead of f_count of dmabuf. - */ drm_gem_object_reference(&obj->base); - dma_buf_put(dma_buf); return &obj->base; } } diff --git a/trunk/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/trunk/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 26d08bb58218..d6a994a07393 100644 --- a/trunk/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/trunk/drivers/gpu/drm/i915/i915_gem_execbuffer.c @@ -539,8 +539,6 @@ i915_gem_execbuffer_relocate_slow(struct drm_device *dev, total = 0; for (i = 0; i < count; i++) { struct drm_i915_gem_relocation_entry __user *user_relocs; - u64 invalid_offset = (u64)-1; - int j; user_relocs = (void __user *)(uintptr_t)exec[i].relocs_ptr; @@ -551,25 +549,6 @@ i915_gem_execbuffer_relocate_slow(struct drm_device *dev, goto err; } - /* As we do not update the known relocation offsets after - * relocating (due to the complexities in lock handling), - * we need to mark them as invalid now so that we force the - * relocation processing next time. Just in case the target - * object is evicted and then rebound into its old - * presumed_offset before the next execbuffer - if that - * happened we would make the mistake of assuming that the - * relocations were valid. - */ - for (j = 0; j < exec[i].relocation_count; j++) { - if (copy_to_user(&user_relocs[j].presumed_offset, - &invalid_offset, - sizeof(invalid_offset))) { - ret = -EFAULT; - mutex_lock(&dev->struct_mutex); - goto err; - } - } - reloc_offset[i] = total; total += exec[i].relocation_count; } diff --git a/trunk/drivers/gpu/drm/i915/i915_irq.c b/trunk/drivers/gpu/drm/i915/i915_irq.c index fe843389c7b4..2220dec3e5d9 100644 --- a/trunk/drivers/gpu/drm/i915/i915_irq.c +++ b/trunk/drivers/gpu/drm/i915/i915_irq.c @@ -1157,7 +1157,6 @@ static void i915_record_ring_state(struct drm_device *dev, error->acthd[ring->id] = intel_ring_get_active_head(ring); error->head[ring->id] = I915_READ_HEAD(ring); error->tail[ring->id] = I915_READ_TAIL(ring); - error->ctl[ring->id] = I915_READ_CTL(ring); error->cpu_ring_head[ring->id] = ring->head; error->cpu_ring_tail[ring->id] = ring->tail; @@ -1252,16 +1251,6 @@ static void i915_capture_error_state(struct drm_device *dev) else error->ier = I915_READ(IER); - if (INTEL_INFO(dev)->gen >= 6) - error->derrmr = I915_READ(DERRMR); - - if (IS_VALLEYVIEW(dev)) - error->forcewake = I915_READ(FORCEWAKE_VLV); - else if (INTEL_INFO(dev)->gen >= 7) - error->forcewake = I915_READ(FORCEWAKE_MT); - else if (INTEL_INFO(dev)->gen == 6) - error->forcewake = I915_READ(FORCEWAKE); - for_each_pipe(pipe) error->pipestat[pipe] = I915_READ(PIPESTAT(pipe)); diff --git a/trunk/drivers/gpu/drm/i915/i915_reg.h b/trunk/drivers/gpu/drm/i915/i915_reg.h index b401788e1791..186ee5c85b51 100644 --- a/trunk/drivers/gpu/drm/i915/i915_reg.h +++ b/trunk/drivers/gpu/drm/i915/i915_reg.h @@ -512,8 +512,6 @@ #define GEN7_ERR_INT 0x44040 #define ERR_INT_MMIO_UNCLAIMED (1<<13) -#define DERRMR 0x44050 - /* GM45+ chicken bits -- debug workaround bits that may be required * for various sorts of correct behavior. The top 16 bits of each are * the enables for writing to the corresponding low bit. diff --git a/trunk/drivers/gpu/drm/i915/intel_display.c b/trunk/drivers/gpu/drm/i915/intel_display.c index da1ad9c80bb5..a9fb046b94a1 100644 --- a/trunk/drivers/gpu/drm/i915/intel_display.c +++ b/trunk/drivers/gpu/drm/i915/intel_display.c @@ -8598,30 +8598,19 @@ int intel_framebuffer_init(struct drm_device *dev, { int ret; - if (obj->tiling_mode == I915_TILING_Y) { - DRM_DEBUG("hardware does not support tiling Y\n"); + if (obj->tiling_mode == I915_TILING_Y) return -EINVAL; - } - if (mode_cmd->pitches[0] & 63) { - DRM_DEBUG("pitch (%d) must be at least 64 byte aligned\n", - mode_cmd->pitches[0]); + if (mode_cmd->pitches[0] & 63) return -EINVAL; - } /* FIXME <= Gen4 stride limits are bit unclear */ - if (mode_cmd->pitches[0] > 32768) { - DRM_DEBUG("pitch (%d) must be at less than 32768\n", - mode_cmd->pitches[0]); + if (mode_cmd->pitches[0] > 32768) return -EINVAL; - } if (obj->tiling_mode != I915_TILING_NONE && - mode_cmd->pitches[0] != obj->stride) { - DRM_DEBUG("pitch (%d) must match tiling stride (%d)\n", - mode_cmd->pitches[0], obj->stride); + mode_cmd->pitches[0] != obj->stride) return -EINVAL; - } /* Reject formats not supported by any plane early. */ switch (mode_cmd->pixel_format) { @@ -8632,10 +8621,8 @@ int intel_framebuffer_init(struct drm_device *dev, break; case DRM_FORMAT_XRGB1555: case DRM_FORMAT_ARGB1555: - if (INTEL_INFO(dev)->gen > 3) { - DRM_DEBUG("invalid format: 0x%08x\n", mode_cmd->pixel_format); + if (INTEL_INFO(dev)->gen > 3) return -EINVAL; - } break; case DRM_FORMAT_XBGR8888: case DRM_FORMAT_ABGR8888: @@ -8643,22 +8630,18 @@ int intel_framebuffer_init(struct drm_device *dev, case DRM_FORMAT_ARGB2101010: case DRM_FORMAT_XBGR2101010: case DRM_FORMAT_ABGR2101010: - if (INTEL_INFO(dev)->gen < 4) { - DRM_DEBUG("invalid format: 0x%08x\n", mode_cmd->pixel_format); + if (INTEL_INFO(dev)->gen < 4) return -EINVAL; - } break; case DRM_FORMAT_YUYV: case DRM_FORMAT_UYVY: case DRM_FORMAT_YVYU: case DRM_FORMAT_VYUY: - if (INTEL_INFO(dev)->gen < 5) { - DRM_DEBUG("invalid format: 0x%08x\n", mode_cmd->pixel_format); + if (INTEL_INFO(dev)->gen < 6) return -EINVAL; - } break; default: - DRM_DEBUG("unsupported pixel format 0x%08x\n", mode_cmd->pixel_format); + DRM_DEBUG_KMS("unsupported pixel format 0x%08x\n", mode_cmd->pixel_format); return -EINVAL; } diff --git a/trunk/drivers/gpu/drm/i915/intel_dp.c b/trunk/drivers/gpu/drm/i915/intel_dp.c index fb3715b4b09d..1b63d55318a0 100644 --- a/trunk/drivers/gpu/drm/i915/intel_dp.c +++ b/trunk/drivers/gpu/drm/i915/intel_dp.c @@ -2579,8 +2579,7 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect static void intel_dp_init_panel_power_sequencer(struct drm_device *dev, - struct intel_dp *intel_dp, - struct edp_power_seq *out) + struct intel_dp *intel_dp) { struct drm_i915_private *dev_priv = dev->dev_private; struct edp_power_seq cur, vbt, spec, final; @@ -2651,35 +2650,16 @@ intel_dp_init_panel_power_sequencer(struct drm_device *dev, intel_dp->panel_power_cycle_delay = get_delay(t11_t12); #undef get_delay - DRM_DEBUG_KMS("panel power up delay %d, power down delay %d, power cycle delay %d\n", - intel_dp->panel_power_up_delay, intel_dp->panel_power_down_delay, - intel_dp->panel_power_cycle_delay); - - DRM_DEBUG_KMS("backlight on delay %d, off delay %d\n", - intel_dp->backlight_on_delay, intel_dp->backlight_off_delay); - - if (out) - *out = final; -} - -static void -intel_dp_init_panel_power_sequencer_registers(struct drm_device *dev, - struct intel_dp *intel_dp, - struct edp_power_seq *seq) -{ - struct drm_i915_private *dev_priv = dev->dev_private; - u32 pp_on, pp_off, pp_div; - /* And finally store the new values in the power sequencer. */ - pp_on = (seq->t1_t3 << PANEL_POWER_UP_DELAY_SHIFT) | - (seq->t8 << PANEL_LIGHT_ON_DELAY_SHIFT); - pp_off = (seq->t9 << PANEL_LIGHT_OFF_DELAY_SHIFT) | - (seq->t10 << PANEL_POWER_DOWN_DELAY_SHIFT); + pp_on = (final.t1_t3 << PANEL_POWER_UP_DELAY_SHIFT) | + (final.t8 << PANEL_LIGHT_ON_DELAY_SHIFT); + pp_off = (final.t9 << PANEL_LIGHT_OFF_DELAY_SHIFT) | + (final.t10 << PANEL_POWER_DOWN_DELAY_SHIFT); /* Compute the divisor for the pp clock, simply match the Bspec * formula. */ pp_div = ((100 * intel_pch_rawclk(dev))/2 - 1) << PP_REFERENCE_DIVIDER_SHIFT; - pp_div |= (DIV_ROUND_UP(seq->t11_t12, 1000) + pp_div |= (DIV_ROUND_UP(final.t11_t12, 1000) << PANEL_POWER_CYCLE_DELAY_SHIFT); /* Haswell doesn't have any port selection bits for the panel @@ -2695,6 +2675,14 @@ intel_dp_init_panel_power_sequencer_registers(struct drm_device *dev, I915_WRITE(PCH_PP_OFF_DELAYS, pp_off); I915_WRITE(PCH_PP_DIVISOR, pp_div); + + DRM_DEBUG_KMS("panel power up delay %d, power down delay %d, power cycle delay %d\n", + intel_dp->panel_power_up_delay, intel_dp->panel_power_down_delay, + intel_dp->panel_power_cycle_delay); + + DRM_DEBUG_KMS("backlight on delay %d, off delay %d\n", + intel_dp->backlight_on_delay, intel_dp->backlight_off_delay); + DRM_DEBUG_KMS("panel power sequencer register settings: PP_ON %#x, PP_OFF %#x, PP_DIV %#x\n", I915_READ(PCH_PP_ON_DELAYS), I915_READ(PCH_PP_OFF_DELAYS), @@ -2711,7 +2699,6 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, struct drm_device *dev = intel_encoder->base.dev; struct drm_i915_private *dev_priv = dev->dev_private; struct drm_display_mode *fixed_mode = NULL; - struct edp_power_seq power_seq = { 0 }; enum port port = intel_dig_port->port; const char *name = NULL; int type; @@ -2784,7 +2771,7 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, } if (is_edp(intel_dp)) - intel_dp_init_panel_power_sequencer(dev, intel_dp, &power_seq); + intel_dp_init_panel_power_sequencer(dev, intel_dp); intel_dp_i2c_init(intel_dp, intel_connector, name); @@ -2811,10 +2798,6 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port, return; } - /* We now know it's not a ghost, init power sequence regs. */ - intel_dp_init_panel_power_sequencer_registers(dev, intel_dp, - &power_seq); - ironlake_edp_panel_vdd_on(intel_dp); edid = drm_get_edid(connector, &intel_dp->adapter); if (edid) { diff --git a/trunk/drivers/gpu/drm/i915/intel_lvds.c b/trunk/drivers/gpu/drm/i915/intel_lvds.c index 17aee74258ad..b9a660a53677 100644 --- a/trunk/drivers/gpu/drm/i915/intel_lvds.c +++ b/trunk/drivers/gpu/drm/i915/intel_lvds.c @@ -774,6 +774,14 @@ static const struct dmi_system_id intel_no_lvds[] = { DMI_MATCH(DMI_BOARD_NAME, "MS-7469"), }, }, + { + .callback = intel_no_lvds_dmi_callback, + .ident = "ZOTAC ZBOXSD-ID12/ID13", + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "ZOTAC"), + DMI_MATCH(DMI_BOARD_NAME, "ZBOXSD-ID12/ID13"), + }, + }, { .callback = intel_no_lvds_dmi_callback, .ident = "Gigabyte GA-D525TUD", diff --git a/trunk/drivers/gpu/drm/i915/intel_pm.c b/trunk/drivers/gpu/drm/i915/intel_pm.c index 3280cffe50f4..e6f54ffab3ba 100644 --- a/trunk/drivers/gpu/drm/i915/intel_pm.c +++ b/trunk/drivers/gpu/drm/i915/intel_pm.c @@ -44,14 +44,6 @@ * i915.i915_enable_fbc parameter */ -static bool intel_crtc_active(struct drm_crtc *crtc) -{ - /* Be paranoid as we can arrive here with only partial - * state retrieved from the hardware during setup. - */ - return to_intel_crtc(crtc)->active && crtc->fb && crtc->mode.clock; -} - static void i8xx_disable_fbc(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; @@ -413,8 +405,9 @@ void intel_update_fbc(struct drm_device *dev) * - going to an unsupported config (interlace, pixel multiply, etc.) */ list_for_each_entry(tmp_crtc, &dev->mode_config.crtc_list, head) { - if (intel_crtc_active(tmp_crtc) && - !to_intel_crtc(tmp_crtc)->primary_disabled) { + if (to_intel_crtc(tmp_crtc)->active && + !to_intel_crtc(tmp_crtc)->primary_disabled && + tmp_crtc->fb) { if (crtc) { DRM_DEBUG_KMS("more than one pipe active, disabling compression\n"); dev_priv->no_fbc_reason = FBC_MULTIPLE_PIPES; @@ -999,7 +992,7 @@ static struct drm_crtc *single_enabled_crtc(struct drm_device *dev) struct drm_crtc *crtc, *enabled = NULL; list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { - if (intel_crtc_active(crtc)) { + if (to_intel_crtc(crtc)->active && crtc->fb) { if (enabled) return NULL; enabled = crtc; @@ -1093,7 +1086,7 @@ static bool g4x_compute_wm0(struct drm_device *dev, int entries, tlb_miss; crtc = intel_get_crtc_for_plane(dev, plane); - if (!intel_crtc_active(crtc)) { + if (crtc->fb == NULL || !to_intel_crtc(crtc)->active) { *cursor_wm = cursor->guard_size; *plane_wm = display->guard_size; return false; @@ -1222,7 +1215,7 @@ static bool vlv_compute_drain_latency(struct drm_device *dev, int entries; crtc = intel_get_crtc_for_plane(dev, plane); - if (!intel_crtc_active(crtc)) + if (crtc->fb == NULL || !to_intel_crtc(crtc)->active) return false; clock = crtc->mode.clock; /* VESA DOT Clock */ @@ -1483,7 +1476,7 @@ static void i9xx_update_wm(struct drm_device *dev) fifo_size = dev_priv->display.get_fifo_size(dev, 0); crtc = intel_get_crtc_for_plane(dev, 0); - if (intel_crtc_active(crtc)) { + if (to_intel_crtc(crtc)->active && crtc->fb) { int cpp = crtc->fb->bits_per_pixel / 8; if (IS_GEN2(dev)) cpp = 4; @@ -1497,7 +1490,7 @@ static void i9xx_update_wm(struct drm_device *dev) fifo_size = dev_priv->display.get_fifo_size(dev, 1); crtc = intel_get_crtc_for_plane(dev, 1); - if (intel_crtc_active(crtc)) { + if (to_intel_crtc(crtc)->active && crtc->fb) { int cpp = crtc->fb->bits_per_pixel / 8; if (IS_GEN2(dev)) cpp = 4; @@ -2051,7 +2044,7 @@ sandybridge_compute_sprite_wm(struct drm_device *dev, int plane, int entries, tlb_miss; crtc = intel_get_crtc_for_plane(dev, plane); - if (!intel_crtc_active(crtc)) { + if (crtc->fb == NULL || !to_intel_crtc(crtc)->active) { *sprite_wm = display->guard_size; return false; } @@ -4250,8 +4243,7 @@ static void __gen6_gt_force_wake_get(struct drm_i915_private *dev_priv) static void __gen6_gt_force_wake_mt_reset(struct drm_i915_private *dev_priv) { I915_WRITE_NOTRACE(FORCEWAKE_MT, _MASKED_BIT_DISABLE(0xffff)); - /* something from same cacheline, but !FORCEWAKE_MT */ - POSTING_READ(ECOBUS); + POSTING_READ(ECOBUS); /* something from same cacheline, but !FORCEWAKE */ } static void __gen6_gt_force_wake_mt_get(struct drm_i915_private *dev_priv) @@ -4268,8 +4260,7 @@ static void __gen6_gt_force_wake_mt_get(struct drm_i915_private *dev_priv) DRM_ERROR("Timed out waiting for forcewake old ack to clear.\n"); I915_WRITE_NOTRACE(FORCEWAKE_MT, _MASKED_BIT_ENABLE(FORCEWAKE_KERNEL)); - /* something from same cacheline, but !FORCEWAKE_MT */ - POSTING_READ(ECOBUS); + POSTING_READ(ECOBUS); /* something from same cacheline, but !FORCEWAKE */ if (wait_for_atomic((I915_READ_NOTRACE(forcewake_ack) & 1), FORCEWAKE_ACK_TIMEOUT_MS)) @@ -4306,16 +4297,14 @@ void gen6_gt_check_fifodbg(struct drm_i915_private *dev_priv) static void __gen6_gt_force_wake_put(struct drm_i915_private *dev_priv) { I915_WRITE_NOTRACE(FORCEWAKE, 0); - /* something from same cacheline, but !FORCEWAKE */ - POSTING_READ(ECOBUS); + /* gen6_gt_check_fifodbg doubles as the POSTING_READ */ gen6_gt_check_fifodbg(dev_priv); } static void __gen6_gt_force_wake_mt_put(struct drm_i915_private *dev_priv) { I915_WRITE_NOTRACE(FORCEWAKE_MT, _MASKED_BIT_DISABLE(FORCEWAKE_KERNEL)); - /* something from same cacheline, but !FORCEWAKE_MT */ - POSTING_READ(ECOBUS); + /* gen6_gt_check_fifodbg doubles as the POSTING_READ */ gen6_gt_check_fifodbg(dev_priv); } @@ -4355,8 +4344,6 @@ int __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv) static void vlv_force_wake_reset(struct drm_i915_private *dev_priv) { I915_WRITE_NOTRACE(FORCEWAKE_VLV, _MASKED_BIT_DISABLE(0xffff)); - /* something from same cacheline, but !FORCEWAKE_VLV */ - POSTING_READ(FORCEWAKE_ACK_VLV); } static void vlv_force_wake_get(struct drm_i915_private *dev_priv) @@ -4377,8 +4364,7 @@ static void vlv_force_wake_get(struct drm_i915_private *dev_priv) static void vlv_force_wake_put(struct drm_i915_private *dev_priv) { I915_WRITE_NOTRACE(FORCEWAKE_VLV, _MASKED_BIT_DISABLE(FORCEWAKE_KERNEL)); - /* something from same cacheline, but !FORCEWAKE_VLV */ - POSTING_READ(FORCEWAKE_ACK_VLV); + /* The below doubles as a POSTING_READ */ gen6_gt_check_fifodbg(dev_priv); } diff --git a/trunk/drivers/gpu/drm/i915/intel_sprite.c b/trunk/drivers/gpu/drm/i915/intel_sprite.c index d7b060e0a231..827dcd4edf1c 100644 --- a/trunk/drivers/gpu/drm/i915/intel_sprite.c +++ b/trunk/drivers/gpu/drm/i915/intel_sprite.c @@ -120,10 +120,11 @@ ivb_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb, I915_WRITE(SPRSTRIDE(pipe), fb->pitches[0]); I915_WRITE(SPRPOS(pipe), (crtc_y << 16) | crtc_x); - linear_offset = y * fb->pitches[0] + x * pixel_size; + linear_offset = y * fb->pitches[0] + x * (fb->bits_per_pixel / 8); sprsurf_offset = intel_gen4_compute_offset_xtiled(&x, &y, - pixel_size, fb->pitches[0]); + fb->bits_per_pixel / 8, + fb->pitches[0]); linear_offset -= sprsurf_offset; /* HSW consolidates SPRTILEOFF and SPRLINOFF into a single SPROFFSET @@ -285,10 +286,11 @@ ilk_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb, I915_WRITE(DVSSTRIDE(pipe), fb->pitches[0]); I915_WRITE(DVSPOS(pipe), (crtc_y << 16) | crtc_x); - linear_offset = y * fb->pitches[0] + x * pixel_size; + linear_offset = y * fb->pitches[0] + x * (fb->bits_per_pixel / 8); dvssurf_offset = intel_gen4_compute_offset_xtiled(&x, &y, - pixel_size, fb->pitches[0]); + fb->bits_per_pixel / 8, + fb->pitches[0]); linear_offset -= dvssurf_offset; if (obj->tiling_mode != I915_TILING_NONE) diff --git a/trunk/drivers/gpu/drm/nouveau/core/core/client.c b/trunk/drivers/gpu/drm/nouveau/core/core/client.c index 8bbb58f94a19..c617f0480071 100644 --- a/trunk/drivers/gpu/drm/nouveau/core/core/client.c +++ b/trunk/drivers/gpu/drm/nouveau/core/core/client.c @@ -66,8 +66,10 @@ nouveau_client_create_(const char *name, u64 devname, const char *cfg, ret = nouveau_handle_create(nv_object(client), ~0, ~0, nv_object(client), &client->root); - if (ret) + if (ret) { + nouveau_namedb_destroy(&client->base); return ret; + } /* prevent init/fini being called, os in in charge of this */ atomic_set(&nv_object(client)->usecount, 2); diff --git a/trunk/drivers/gpu/drm/nouveau/core/core/handle.c b/trunk/drivers/gpu/drm/nouveau/core/core/handle.c index 264c2b338ac3..b8d2cbf8a7a7 100644 --- a/trunk/drivers/gpu/drm/nouveau/core/core/handle.c +++ b/trunk/drivers/gpu/drm/nouveau/core/core/handle.c @@ -109,7 +109,7 @@ nouveau_handle_create(struct nouveau_object *parent, u32 _parent, u32 _handle, while (!nv_iclass(namedb, NV_NAMEDB_CLASS)) namedb = namedb->parent; - handle = kzalloc(sizeof(*handle), GFP_KERNEL); + handle = *phandle = kzalloc(sizeof(*handle), GFP_KERNEL); if (!handle) return -ENOMEM; @@ -146,9 +146,6 @@ nouveau_handle_create(struct nouveau_object *parent, u32 _parent, u32 _handle, } hprintk(handle, TRACE, "created\n"); - - *phandle = handle; - return 0; } diff --git a/trunk/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c b/trunk/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c index ca1a7d76a95b..0f09af135415 100644 --- a/trunk/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c +++ b/trunk/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c @@ -851,23 +851,20 @@ exec_script(struct nv50_disp_priv *priv, int head, int id) for (i = 0; !(ctrl & (1 << head)) && i < 3; i++) ctrl = nv_rd32(priv, 0x610b5c + (i * 8)); - if (!(ctrl & (1 << head))) { - if (nv_device(priv)->chipset < 0x90 || - nv_device(priv)->chipset == 0x92 || - nv_device(priv)->chipset == 0xa0) { - for (i = 0; !(ctrl & (1 << head)) && i < 2; i++) - ctrl = nv_rd32(priv, 0x610b74 + (i * 8)); - i += 4; - } else { - for (i = 0; !(ctrl & (1 << head)) && i < 4; i++) - ctrl = nv_rd32(priv, 0x610798 + (i * 8)); - i += 4; - } + if (nv_device(priv)->chipset < 0x90 || + nv_device(priv)->chipset == 0x92 || + nv_device(priv)->chipset == 0xa0) { + for (i = 0; !(ctrl & (1 << head)) && i < 2; i++) + ctrl = nv_rd32(priv, 0x610b74 + (i * 8)); + i += 3; + } else { + for (i = 0; !(ctrl & (1 << head)) && i < 4; i++) + ctrl = nv_rd32(priv, 0x610798 + (i * 8)); + i += 3; } if (!(ctrl & (1 << head))) return false; - i--; data = exec_lookup(priv, head, i, ctrl, &dcb, &ver, &hdr, &cnt, &len, &info); if (data) { @@ -901,23 +898,20 @@ exec_clkcmp(struct nv50_disp_priv *priv, int head, int id, u32 pclk, for (i = 0; !(ctrl & (1 << head)) && i < 3; i++) ctrl = nv_rd32(priv, 0x610b58 + (i * 8)); - if (!(ctrl & (1 << head))) { - if (nv_device(priv)->chipset < 0x90 || - nv_device(priv)->chipset == 0x92 || - nv_device(priv)->chipset == 0xa0) { - for (i = 0; !(ctrl & (1 << head)) && i < 2; i++) - ctrl = nv_rd32(priv, 0x610b70 + (i * 8)); - i += 4; - } else { - for (i = 0; !(ctrl & (1 << head)) && i < 4; i++) - ctrl = nv_rd32(priv, 0x610794 + (i * 8)); - i += 4; - } + if (nv_device(priv)->chipset < 0x90 || + nv_device(priv)->chipset == 0x92 || + nv_device(priv)->chipset == 0xa0) { + for (i = 0; !(ctrl & (1 << head)) && i < 2; i++) + ctrl = nv_rd32(priv, 0x610b70 + (i * 8)); + i += 3; + } else { + for (i = 0; !(ctrl & (1 << head)) && i < 4; i++) + ctrl = nv_rd32(priv, 0x610794 + (i * 8)); + i += 3; } if (!(ctrl & (1 << head))) return 0x0000; - i--; data = exec_lookup(priv, head, i, ctrl, outp, &ver, &hdr, &cnt, &len, &info1); if (!data) diff --git a/trunk/drivers/gpu/drm/nouveau/core/include/core/client.h b/trunk/drivers/gpu/drm/nouveau/core/include/core/client.h index 63acc0346ff2..0193532ceac9 100644 --- a/trunk/drivers/gpu/drm/nouveau/core/include/core/client.h +++ b/trunk/drivers/gpu/drm/nouveau/core/include/core/client.h @@ -36,9 +36,6 @@ nouveau_client(void *obj) int nouveau_client_create_(const char *name, u64 device, const char *cfg, const char *dbg, int, void **); -#define nouveau_client_destroy(p) \ - nouveau_namedb_destroy(&(p)->base) - int nouveau_client_init(struct nouveau_client *); int nouveau_client_fini(struct nouveau_client *, bool suspend); diff --git a/trunk/drivers/gpu/drm/nouveau/core/include/subdev/bios/pll.h b/trunk/drivers/gpu/drm/nouveau/core/include/subdev/bios/pll.h index b2f3d4d0aa49..c345097592f2 100644 --- a/trunk/drivers/gpu/drm/nouveau/core/include/subdev/bios/pll.h +++ b/trunk/drivers/gpu/drm/nouveau/core/include/subdev/bios/pll.h @@ -38,8 +38,6 @@ enum nvbios_pll_type { PLL_UNK42 = 0x42, PLL_VPLL0 = 0x80, PLL_VPLL1 = 0x81, - PLL_VPLL2 = 0x82, - PLL_VPLL3 = 0x83, PLL_MAX = 0xff }; diff --git a/trunk/drivers/gpu/drm/nouveau/core/subdev/bios/init.c b/trunk/drivers/gpu/drm/nouveau/core/subdev/bios/init.c index 690ed438b2ad..2917d552689b 100644 --- a/trunk/drivers/gpu/drm/nouveau/core/subdev/bios/init.c +++ b/trunk/drivers/gpu/drm/nouveau/core/subdev/bios/init.c @@ -1534,6 +1534,7 @@ init_io(struct nvbios_init *init) mdelay(10); init_wr32(init, 0x614100, 0x10000018); init_wr32(init, 0x614900, 0x10000018); + return; } value = init_rdport(init, port) & mask; diff --git a/trunk/drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c b/trunk/drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c index 7c9626258a46..f6962c9b6c36 100644 --- a/trunk/drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c +++ b/trunk/drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c @@ -52,8 +52,6 @@ nvc0_clock_pll_set(struct nouveau_clock *clk, u32 type, u32 freq) switch (info.type) { case PLL_VPLL0: case PLL_VPLL1: - case PLL_VPLL2: - case PLL_VPLL3: nv_mask(priv, info.reg + 0x0c, 0x00000000, 0x00000100); nv_wr32(priv, info.reg + 0x04, (P << 16) | (N << 8) | M); nv_wr32(priv, info.reg + 0x10, fN << 16); diff --git a/trunk/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c b/trunk/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c index 7606ed15b6fa..306bdf121452 100644 --- a/trunk/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c +++ b/trunk/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, mem->memtype = type; mem->size = size; - mutex_lock(&pfb->base.mutex); + mutex_lock(&mm->mutex); do { if (back) ret = nouveau_mm_tail(mm, 1, size, ncmin, align, &r); else ret = nouveau_mm_head(mm, 1, size, ncmin, align, &r); if (ret) { - mutex_unlock(&pfb->base.mutex); + mutex_unlock(&mm->mutex); pfb->ram.put(pfb, &mem); return ret; } @@ -160,7 +160,7 @@ nvc0_fb_vram_new(struct nouveau_fb *pfb, u64 size, u32 align, u32 ncmin, list_add_tail(&r->rl_entry, &mem->regions); size -= r->length; } while (size); - mutex_unlock(&pfb->base.mutex); + mutex_unlock(&mm->mutex); r = list_first_entry(&mem->regions, struct nouveau_mm_node, rl_entry); mem->offset = (u64)r->offset << 12; diff --git a/trunk/drivers/gpu/drm/nouveau/core/subdev/instmem/base.c b/trunk/drivers/gpu/drm/nouveau/core/subdev/instmem/base.c index 6565f3dbbe04..1188227ca6aa 100644 --- a/trunk/drivers/gpu/drm/nouveau/core/subdev/instmem/base.c +++ b/trunk/drivers/gpu/drm/nouveau/core/subdev/instmem/base.c @@ -40,21 +40,15 @@ nouveau_instobj_create_(struct nouveau_object *parent, if (ret) return ret; - mutex_lock(&imem->base.mutex); list_add(&iobj->head, &imem->list); - mutex_unlock(&imem->base.mutex); return 0; } void nouveau_instobj_destroy(struct nouveau_instobj *iobj) { - struct nouveau_subdev *subdev = nv_subdev(iobj->base.engine); - - mutex_lock(&subdev->mutex); - list_del(&iobj->head); - mutex_unlock(&subdev->mutex); - + if (iobj->head.prev) + list_del(&iobj->head); return nouveau_object_destroy(&iobj->base); } @@ -94,8 +88,6 @@ nouveau_instmem_init(struct nouveau_instmem *imem) if (ret) return ret; - mutex_lock(&imem->base.mutex); - list_for_each_entry(iobj, &imem->list, head) { if (iobj->suspend) { for (i = 0; i < iobj->size; i += 4) @@ -105,8 +97,6 @@ nouveau_instmem_init(struct nouveau_instmem *imem) } } - mutex_unlock(&imem->base.mutex); - return 0; } @@ -114,26 +104,17 @@ int nouveau_instmem_fini(struct nouveau_instmem *imem, bool suspend) { struct nouveau_instobj *iobj; - int i, ret = 0; + int i; if (suspend) { - mutex_lock(&imem->base.mutex); - list_for_each_entry(iobj, &imem->list, head) { iobj->suspend = vmalloc(iobj->size); - if (!iobj->suspend) { - ret = -ENOMEM; - break; - } - - for (i = 0; i < iobj->size; i += 4) - iobj->suspend[i / 4] = nv_ro32(iobj, i); + if (iobj->suspend) { + for (i = 0; i < iobj->size; i += 4) + iobj->suspend[i / 4] = nv_ro32(iobj, i); + } else + return -ENOMEM; } - - mutex_unlock(&imem->base.mutex); - - if (ret) - return ret; } return nouveau_subdev_fini(&imem->base, suspend); diff --git a/trunk/drivers/gpu/drm/nouveau/core/subdev/vm/base.c b/trunk/drivers/gpu/drm/nouveau/core/subdev/vm/base.c index 77c67fc970e6..082c11b75acb 100644 --- a/trunk/drivers/gpu/drm/nouveau/core/subdev/vm/base.c +++ b/trunk/drivers/gpu/drm/nouveau/core/subdev/vm/base.c @@ -352,7 +352,7 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length, u64 mm_length = (offset + length) - mm_offset; int ret; - vm = kzalloc(sizeof(*vm), GFP_KERNEL); + vm = *pvm = kzalloc(sizeof(*vm), GFP_KERNEL); if (!vm) return -ENOMEM; @@ -376,8 +376,6 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length, return ret; } - *pvm = vm; - return 0; } diff --git a/trunk/drivers/gpu/drm/nouveau/nouveau_connector.c b/trunk/drivers/gpu/drm/nouveau/nouveau_connector.c index e620ba8271b4..ac340ba32017 100644 --- a/trunk/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/trunk/drivers/gpu/drm/nouveau/nouveau_connector.c @@ -127,26 +127,12 @@ nouveau_connector_ddc_detect(struct drm_connector *connector, struct nouveau_encoder **pnv_encoder) { struct drm_device *dev = connector->dev; - struct nouveau_connector *nv_connector = nouveau_connector(connector); struct nouveau_drm *drm = nouveau_drm(dev); - struct nouveau_gpio *gpio = nouveau_gpio(drm->device); struct nouveau_i2c *i2c = nouveau_i2c(drm->device); - struct nouveau_i2c_port *port = NULL; - int i, panel = -ENODEV; - - /* eDP panels need powering on by us (if the VBIOS doesn't default it - * to on) before doing any AUX channel transactions. LVDS panel power - * is handled by the SOR itself, and not required for LVDS DDC. - */ - if (nv_connector->type == DCB_CONNECTOR_eDP) { - panel = gpio->get(gpio, 0, DCB_GPIO_PANEL_POWER, 0xff); - if (panel == 0) { - gpio->set(gpio, 0, DCB_GPIO_PANEL_POWER, 0xff, 1); - msleep(300); - } - } + int i; for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) { + struct nouveau_i2c_port *port = NULL; struct nouveau_encoder *nv_encoder; struct drm_mode_object *obj; int id; @@ -164,19 +150,11 @@ nouveau_connector_ddc_detect(struct drm_connector *connector, port = i2c->find(i2c, nv_encoder->dcb->i2c_index); if (port && nv_probe_i2c(port, 0x50)) { *pnv_encoder = nv_encoder; - break; + return port; } - - port = NULL; } - /* eDP panel not detected, restore panel power GPIO to previous - * state to avoid confusing the SOR for other output types. - */ - if (!port && panel == 0) - gpio->set(gpio, 0, DCB_GPIO_PANEL_POWER, 0xff, panel); - - return port; + return NULL; } static struct nouveau_encoder * diff --git a/trunk/drivers/gpu/drm/nouveau/nouveau_display.c b/trunk/drivers/gpu/drm/nouveau/nouveau_display.c index 508b00a2ce0d..e4188f24fc75 100644 --- a/trunk/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/trunk/drivers/gpu/drm/nouveau/nouveau_display.c @@ -225,6 +225,15 @@ nouveau_display_init(struct drm_device *dev) if (ret) return ret; + /* power on internal panel if it's not already. the init tables of + * some vbios default this to off for some reason, causing the + * panel to not work after resume + */ + if (gpio && gpio->get(gpio, 0, DCB_GPIO_PANEL_POWER, 0xff) == 0) { + gpio->set(gpio, 0, DCB_GPIO_PANEL_POWER, 0xff, 1); + msleep(300); + } + /* enable polling for external displays */ drm_kms_helper_poll_enable(dev); diff --git a/trunk/drivers/gpu/drm/nouveau/nouveau_drm.c b/trunk/drivers/gpu/drm/nouveau/nouveau_drm.c index 8b090f1eb51d..180a45e3b525 100644 --- a/trunk/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/trunk/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -84,16 +84,11 @@ nouveau_cli_create(struct pci_dev *pdev, const char *name, struct nouveau_cli *cli; int ret; - *pcli = NULL; ret = nouveau_client_create_(name, nouveau_name(pdev), nouveau_config, nouveau_debug, size, pcli); cli = *pcli; - if (ret) { - if (cli) - nouveau_client_destroy(&cli->base); - *pcli = NULL; + if (ret) return ret; - } mutex_init(&cli->mutex); return 0; diff --git a/trunk/drivers/gpu/drm/nouveau/nouveau_fence.h b/trunk/drivers/gpu/drm/nouveau/nouveau_fence.h index cdb83acdffe2..bedafd1c9539 100644 --- a/trunk/drivers/gpu/drm/nouveau/nouveau_fence.h +++ b/trunk/drivers/gpu/drm/nouveau/nouveau_fence.h @@ -60,7 +60,6 @@ u32 nv10_fence_read(struct nouveau_channel *); void nv10_fence_context_del(struct nouveau_channel *); void nv10_fence_destroy(struct nouveau_drm *); int nv10_fence_create(struct nouveau_drm *); -void nv17_fence_resume(struct nouveau_drm *drm); int nv50_fence_create(struct nouveau_drm *); int nv84_fence_create(struct nouveau_drm *); diff --git a/trunk/drivers/gpu/drm/nouveau/nouveau_prime.c b/trunk/drivers/gpu/drm/nouveau/nouveau_prime.c index b8e05ae38212..3543fec2355e 100644 --- a/trunk/drivers/gpu/drm/nouveau/nouveau_prime.c +++ b/trunk/drivers/gpu/drm/nouveau/nouveau_prime.c @@ -193,7 +193,6 @@ struct drm_gem_object *nouveau_gem_prime_import(struct drm_device *dev, if (nvbo->gem) { if (nvbo->gem->dev == dev) { drm_gem_object_reference(nvbo->gem); - dma_buf_put(dma_buf); return nvbo->gem; } } diff --git a/trunk/drivers/gpu/drm/nouveau/nv04_dfp.c b/trunk/drivers/gpu/drm/nouveau/nv04_dfp.c index 39ffc07f906b..184cdf806761 100644 --- a/trunk/drivers/gpu/drm/nouveau/nv04_dfp.c +++ b/trunk/drivers/gpu/drm/nouveau/nv04_dfp.c @@ -505,7 +505,7 @@ static void nv04_dfp_update_backlight(struct drm_encoder *encoder, int mode) static inline bool is_powersaving_dpms(int mode) { - return mode != DRM_MODE_DPMS_ON && mode != NV_DPMS_CLEARED; + return (mode != DRM_MODE_DPMS_ON); } static void nv04_lvds_dpms(struct drm_encoder *encoder, int mode) diff --git a/trunk/drivers/gpu/drm/nouveau/nv10_fence.c b/trunk/drivers/gpu/drm/nouveau/nv10_fence.c index 03017f24d593..7ae7f97a6d4d 100644 --- a/trunk/drivers/gpu/drm/nouveau/nv10_fence.c +++ b/trunk/drivers/gpu/drm/nouveau/nv10_fence.c @@ -162,13 +162,6 @@ nv10_fence_destroy(struct nouveau_drm *drm) kfree(priv); } -void nv17_fence_resume(struct nouveau_drm *drm) -{ - struct nv10_fence_priv *priv = drm->fence; - - nouveau_bo_wr32(priv->bo, 0, priv->sequence); -} - int nv10_fence_create(struct nouveau_drm *drm) { @@ -204,7 +197,6 @@ nv10_fence_create(struct nouveau_drm *drm) if (ret == 0) { nouveau_bo_wr32(priv->bo, 0x000, 0x00000000); priv->base.sync = nv17_fence_sync; - priv->base.resume = nv17_fence_resume; } } diff --git a/trunk/drivers/gpu/drm/nouveau/nv50_fence.c b/trunk/drivers/gpu/drm/nouveau/nv50_fence.c index d889f3ac0d41..c20f2727ea0b 100644 --- a/trunk/drivers/gpu/drm/nouveau/nv50_fence.c +++ b/trunk/drivers/gpu/drm/nouveau/nv50_fence.c @@ -122,7 +122,6 @@ nv50_fence_create(struct nouveau_drm *drm) if (ret == 0) { nouveau_bo_wr32(priv->bo, 0x000, 0x00000000); priv->base.sync = nv17_fence_sync; - priv->base.resume = nv17_fence_resume; } if (ret) diff --git a/trunk/drivers/gpu/drm/radeon/evergreen.c b/trunk/drivers/gpu/drm/radeon/evergreen.c index 4d0e60adbc6d..061fa0a28900 100644 --- a/trunk/drivers/gpu/drm/radeon/evergreen.c +++ b/trunk/drivers/gpu/drm/radeon/evergreen.c @@ -2401,12 +2401,6 @@ static int evergreen_gpu_soft_reset(struct radeon_device *rdev, u32 reset_mask) { struct evergreen_mc_save save; - if (!(RREG32(GRBM_STATUS) & GUI_ACTIVE)) - reset_mask &= ~(RADEON_RESET_GFX | RADEON_RESET_COMPUTE); - - if (RREG32(DMA_STATUS_REG) & DMA_IDLE) - reset_mask &= ~RADEON_RESET_DMA; - if (reset_mask == 0) return 0; diff --git a/trunk/drivers/gpu/drm/radeon/ni.c b/trunk/drivers/gpu/drm/radeon/ni.c index 59acabb45c9b..896f1cbc58a5 100644 --- a/trunk/drivers/gpu/drm/radeon/ni.c +++ b/trunk/drivers/gpu/drm/radeon/ni.c @@ -1409,12 +1409,6 @@ static int cayman_gpu_soft_reset(struct radeon_device *rdev, u32 reset_mask) { struct evergreen_mc_save save; - if (!(RREG32(GRBM_STATUS) & GUI_ACTIVE)) - reset_mask &= ~(RADEON_RESET_GFX | RADEON_RESET_COMPUTE); - - if (RREG32(DMA_STATUS_REG) & DMA_IDLE) - reset_mask &= ~RADEON_RESET_DMA; - if (reset_mask == 0) return 0; diff --git a/trunk/drivers/gpu/drm/radeon/r600.c b/trunk/drivers/gpu/drm/radeon/r600.c index 3cb9d6089373..923f93647042 100644 --- a/trunk/drivers/gpu/drm/radeon/r600.c +++ b/trunk/drivers/gpu/drm/radeon/r600.c @@ -1378,12 +1378,6 @@ static int r600_gpu_soft_reset(struct radeon_device *rdev, u32 reset_mask) { struct rv515_mc_save save; - if (!(RREG32(GRBM_STATUS) & GUI_ACTIVE)) - reset_mask &= ~(RADEON_RESET_GFX | RADEON_RESET_COMPUTE); - - if (RREG32(DMA_STATUS_REG) & DMA_IDLE) - reset_mask &= ~RADEON_RESET_DMA; - if (reset_mask == 0) return 0; @@ -2652,7 +2646,7 @@ int r600_copy_blit(struct radeon_device *rdev, * @num_gpu_pages: number of GPU pages to xfer * @fence: radeon fence object * - * Copy GPU paging using the DMA engine (r6xx). + * Copy GPU paging using the DMA engine (r6xx-r7xx). * Used by the radeon ttm implementation to move pages if * registered as the asic copy callback. */ @@ -2675,8 +2669,8 @@ int r600_copy_dma(struct radeon_device *rdev, } size_in_dw = (num_gpu_pages << RADEON_GPU_PAGE_SHIFT) / 4; - num_loops = DIV_ROUND_UP(size_in_dw, 0xFFFE); - r = radeon_ring_lock(rdev, ring, num_loops * 4 + 8); + num_loops = DIV_ROUND_UP(size_in_dw, 0xffff); + r = radeon_ring_lock(rdev, ring, num_loops * 5 + 8); if (r) { DRM_ERROR("radeon: moving bo (%d).\n", r); radeon_semaphore_free(rdev, &sem, NULL); @@ -2699,8 +2693,8 @@ int r600_copy_dma(struct radeon_device *rdev, radeon_ring_write(ring, DMA_PACKET(DMA_PACKET_COPY, 0, 0, cur_size_in_dw)); radeon_ring_write(ring, dst_offset & 0xfffffffc); radeon_ring_write(ring, src_offset & 0xfffffffc); - radeon_ring_write(ring, (((upper_32_bits(dst_offset) & 0xff) << 16) | - (upper_32_bits(src_offset) & 0xff))); + radeon_ring_write(ring, upper_32_bits(dst_offset) & 0xff); + radeon_ring_write(ring, upper_32_bits(src_offset) & 0xff); src_offset += cur_size_in_dw * 4; dst_offset += cur_size_in_dw * 4; } diff --git a/trunk/drivers/gpu/drm/radeon/r600_cs.c b/trunk/drivers/gpu/drm/radeon/r600_cs.c index 69ec24ab8d63..9ea13d07cc55 100644 --- a/trunk/drivers/gpu/drm/radeon/r600_cs.c +++ b/trunk/drivers/gpu/drm/radeon/r600_cs.c @@ -2476,10 +2476,8 @@ static void r600_cs_parser_fini(struct radeon_cs_parser *parser, int error) kfree(parser->relocs); for (i = 0; i < parser->nchunks; i++) { kfree(parser->chunks[i].kdata); - if (parser->rdev && (parser->rdev->flags & RADEON_IS_AGP)) { - kfree(parser->chunks[i].kpage[0]); - kfree(parser->chunks[i].kpage[1]); - } + kfree(parser->chunks[i].kpage[0]); + kfree(parser->chunks[i].kpage[1]); } kfree(parser->chunks); kfree(parser->chunks_array); @@ -2563,16 +2561,16 @@ int r600_dma_cs_next_reloc(struct radeon_cs_parser *p, struct radeon_cs_chunk *relocs_chunk; unsigned idx; - *cs_reloc = NULL; if (p->chunk_relocs_idx == -1) { DRM_ERROR("No relocation chunk !\n"); return -EINVAL; } + *cs_reloc = NULL; relocs_chunk = &p->chunks[p->chunk_relocs_idx]; idx = p->dma_reloc_idx; - if (idx >= p->nrelocs) { + if (idx >= relocs_chunk->length_dw) { DRM_ERROR("Relocs at %d after relocations chunk end %d !\n", - idx, p->nrelocs); + idx, relocs_chunk->length_dw); return -EINVAL; } *cs_reloc = p->relocs_ptr[idx]; @@ -2679,29 +2677,16 @@ int r600_dma_cs_parse(struct radeon_cs_parser *p) } p->idx += 7; } else { - if (p->family >= CHIP_RV770) { - src_offset = ib[idx+2]; - src_offset |= ((u64)(ib[idx+4] & 0xff)) << 32; - dst_offset = ib[idx+1]; - dst_offset |= ((u64)(ib[idx+3] & 0xff)) << 32; - - ib[idx+1] += (u32)(dst_reloc->lobj.gpu_offset & 0xfffffffc); - ib[idx+2] += (u32)(src_reloc->lobj.gpu_offset & 0xfffffffc); - ib[idx+3] += upper_32_bits(dst_reloc->lobj.gpu_offset) & 0xff; - ib[idx+4] += upper_32_bits(src_reloc->lobj.gpu_offset) & 0xff; - p->idx += 5; - } else { - src_offset = ib[idx+2]; - src_offset |= ((u64)(ib[idx+3] & 0xff)) << 32; - dst_offset = ib[idx+1]; - dst_offset |= ((u64)(ib[idx+3] & 0xff0000)) << 16; + src_offset = ib[idx+2]; + src_offset |= ((u64)(ib[idx+4] & 0xff)) << 32; + dst_offset = ib[idx+1]; + dst_offset |= ((u64)(ib[idx+3] & 0xff)) << 32; - ib[idx+1] += (u32)(dst_reloc->lobj.gpu_offset & 0xfffffffc); - ib[idx+2] += (u32)(src_reloc->lobj.gpu_offset & 0xfffffffc); - ib[idx+3] += upper_32_bits(src_reloc->lobj.gpu_offset) & 0xff; - ib[idx+3] += (upper_32_bits(dst_reloc->lobj.gpu_offset) & 0xff) << 16; - p->idx += 4; - } + ib[idx+1] += (u32)(dst_reloc->lobj.gpu_offset & 0xfffffffc); + ib[idx+2] += (u32)(src_reloc->lobj.gpu_offset & 0xfffffffc); + ib[idx+3] += upper_32_bits(dst_reloc->lobj.gpu_offset) & 0xff; + ib[idx+4] += upper_32_bits(src_reloc->lobj.gpu_offset) & 0xff; + p->idx += 5; } if ((src_offset + (count * 4)) > radeon_bo_size(src_reloc->robj)) { dev_warn(p->dev, "DMA copy src buffer too small (%llu %lu)\n", diff --git a/trunk/drivers/gpu/drm/radeon/radeon.h b/trunk/drivers/gpu/drm/radeon/radeon.h index a08f657329a0..34e52304a525 100644 --- a/trunk/drivers/gpu/drm/radeon/radeon.h +++ b/trunk/drivers/gpu/drm/radeon/radeon.h @@ -324,6 +324,7 @@ struct radeon_bo { struct list_head list; /* Protected by tbo.reserved */ u32 placements[3]; + u32 busy_placements[3]; struct ttm_placement placement; struct ttm_buffer_object tbo; struct ttm_bo_kmap_obj kmap; @@ -653,8 +654,6 @@ struct radeon_ring { u32 ptr_reg_mask; u32 nop; u32 idx; - u64 last_semaphore_signal_addr; - u64 last_semaphore_wait_addr; }; /* diff --git a/trunk/drivers/gpu/drm/radeon/radeon_asic.c b/trunk/drivers/gpu/drm/radeon/radeon_asic.c index 9056fafb00ea..596bcbe80ed0 100644 --- a/trunk/drivers/gpu/drm/radeon/radeon_asic.c +++ b/trunk/drivers/gpu/drm/radeon/radeon_asic.c @@ -1140,9 +1140,9 @@ static struct radeon_asic rv770_asic = { .copy = { .blit = &r600_copy_blit, .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX, - .dma = &rv770_copy_dma, + .dma = &r600_copy_dma, .dma_ring_index = R600_RING_TYPE_DMA_INDEX, - .copy = &rv770_copy_dma, + .copy = &r600_copy_dma, .copy_ring_index = R600_RING_TYPE_DMA_INDEX, }, .surface = { diff --git a/trunk/drivers/gpu/drm/radeon/radeon_asic.h b/trunk/drivers/gpu/drm/radeon/radeon_asic.h index 15d70e613076..5f4882cc2152 100644 --- a/trunk/drivers/gpu/drm/radeon/radeon_asic.h +++ b/trunk/drivers/gpu/drm/radeon/radeon_asic.h @@ -403,10 +403,6 @@ u32 rv770_page_flip(struct radeon_device *rdev, int crtc, u64 crtc_base); void r700_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc); void r700_cp_stop(struct radeon_device *rdev); void r700_cp_fini(struct radeon_device *rdev); -int rv770_copy_dma(struct radeon_device *rdev, - uint64_t src_offset, uint64_t dst_offset, - unsigned num_gpu_pages, - struct radeon_fence **fence); /* * evergreen diff --git a/trunk/drivers/gpu/drm/radeon/radeon_cs.c b/trunk/drivers/gpu/drm/radeon/radeon_cs.c index 469661fd1903..396baba0141a 100644 --- a/trunk/drivers/gpu/drm/radeon/radeon_cs.c +++ b/trunk/drivers/gpu/drm/radeon/radeon_cs.c @@ -279,13 +279,13 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data) p->chunks[p->chunk_ib_idx].length_dw); return -EINVAL; } - if (p->rdev && (p->rdev->flags & RADEON_IS_AGP)) { + if ((p->rdev->flags & RADEON_IS_AGP)) { p->chunks[p->chunk_ib_idx].kpage[0] = kmalloc(PAGE_SIZE, GFP_KERNEL); p->chunks[p->chunk_ib_idx].kpage[1] = kmalloc(PAGE_SIZE, GFP_KERNEL); if (p->chunks[p->chunk_ib_idx].kpage[0] == NULL || p->chunks[p->chunk_ib_idx].kpage[1] == NULL) { - kfree(p->chunks[p->chunk_ib_idx].kpage[0]); - kfree(p->chunks[p->chunk_ib_idx].kpage[1]); + kfree(p->chunks[i].kpage[0]); + kfree(p->chunks[i].kpage[1]); return -ENOMEM; } } @@ -583,8 +583,7 @@ static int radeon_cs_update_pages(struct radeon_cs_parser *p, int pg_idx) struct radeon_cs_chunk *ibc = &p->chunks[p->chunk_ib_idx]; int i; int size = PAGE_SIZE; - bool copy1 = (p->rdev && (p->rdev->flags & RADEON_IS_AGP)) ? - false : true; + bool copy1 = (p->rdev->flags & RADEON_IS_AGP) ? false : true; for (i = ibc->last_copied_page + 1; i < pg_idx; i++) { if (DRM_COPY_FROM_USER(p->ib.ptr + (i * (PAGE_SIZE/4)), diff --git a/trunk/drivers/gpu/drm/radeon/radeon_device.c b/trunk/drivers/gpu/drm/radeon/radeon_device.c index edfc54e41842..cd756262924d 100644 --- a/trunk/drivers/gpu/drm/radeon/radeon_device.c +++ b/trunk/drivers/gpu/drm/radeon/radeon_device.c @@ -896,25 +896,6 @@ static void radeon_check_arguments(struct radeon_device *rdev) } } -/** - * radeon_switcheroo_quirk_long_wakeup - return true if longer d3 delay is - * needed for waking up. - * - * @pdev: pci dev pointer - */ -static bool radeon_switcheroo_quirk_long_wakeup(struct pci_dev *pdev) -{ - - /* 6600m in a macbook pro */ - if (pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE && - pdev->subsystem_device == 0x00e2) { - printk(KERN_INFO "radeon: quirking longer d3 wakeup delay\n"); - return true; - } - - return false; -} - /** * radeon_switcheroo_set_state - set switcheroo state * @@ -929,19 +910,10 @@ static void radeon_switcheroo_set_state(struct pci_dev *pdev, enum vga_switchero struct drm_device *dev = pci_get_drvdata(pdev); pm_message_t pmm = { .event = PM_EVENT_SUSPEND }; if (state == VGA_SWITCHEROO_ON) { - unsigned d3_delay = dev->pdev->d3_delay; - printk(KERN_INFO "radeon: switched on\n"); /* don't suspend or resume card normally */ dev->switch_power_state = DRM_SWITCH_POWER_CHANGING; - - if (d3_delay < 20 && radeon_switcheroo_quirk_long_wakeup(pdev)) - dev->pdev->d3_delay = 20; - radeon_resume_kms(dev); - - dev->pdev->d3_delay = d3_delay; - dev->switch_power_state = DRM_SWITCH_POWER_ON; drm_kms_helper_poll_enable(dev); } else { diff --git a/trunk/drivers/gpu/drm/radeon/radeon_drv.c b/trunk/drivers/gpu/drm/radeon/radeon_drv.c index d9bf96ee299a..dff6cf77f953 100644 --- a/trunk/drivers/gpu/drm/radeon/radeon_drv.c +++ b/trunk/drivers/gpu/drm/radeon/radeon_drv.c @@ -69,10 +69,9 @@ * 2.26.0 - r600-eg: fix htile size computation * 2.27.0 - r600-SI: Add CS ioctl support for async DMA * 2.28.0 - r600-eg: Add MEM_WRITE packet support - * 2.29.0 - R500 FP16 color clear registers */ #define KMS_DRIVER_MAJOR 2 -#define KMS_DRIVER_MINOR 29 +#define KMS_DRIVER_MINOR 28 #define KMS_DRIVER_PATCHLEVEL 0 int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); int radeon_driver_unload_kms(struct drm_device *dev); diff --git a/trunk/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/trunk/drivers/gpu/drm/radeon/radeon_legacy_encoders.c index 62cd512f5c8d..f5ba2241dacc 100644 --- a/trunk/drivers/gpu/drm/radeon/radeon_legacy_encoders.c +++ b/trunk/drivers/gpu/drm/radeon/radeon_legacy_encoders.c @@ -640,14 +640,6 @@ static enum drm_connector_status radeon_legacy_primary_dac_detect(struct drm_enc enum drm_connector_status found = connector_status_disconnected; bool color = true; - /* just don't bother on RN50 those chip are often connected to remoting - * console hw and often we get failure to load detect those. So to make - * everyone happy report the encoder as always connected. - */ - if (ASIC_IS_RN50(rdev)) { - return connector_status_connected; - } - /* save the regs we need */ vclk_ecp_cntl = RREG32_PLL(RADEON_VCLK_ECP_CNTL); crtc_ext_cntl = RREG32(RADEON_CRTC_EXT_CNTL); diff --git a/trunk/drivers/gpu/drm/radeon/radeon_object.c b/trunk/drivers/gpu/drm/radeon/radeon_object.c index d3aface2d12d..883c95d8d90f 100644 --- a/trunk/drivers/gpu/drm/radeon/radeon_object.c +++ b/trunk/drivers/gpu/drm/radeon/radeon_object.c @@ -84,7 +84,6 @@ void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 domain) rbo->placement.fpfn = 0; rbo->placement.lpfn = 0; rbo->placement.placement = rbo->placements; - rbo->placement.busy_placement = rbo->placements; if (domain & RADEON_GEM_DOMAIN_VRAM) rbo->placements[c++] = TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_VRAM; @@ -105,6 +104,14 @@ void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 domain) if (!c) rbo->placements[c++] = TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM; rbo->placement.num_placement = c; + + c = 0; + rbo->placement.busy_placement = rbo->busy_placements; + if (rbo->rdev->flags & RADEON_IS_AGP) { + rbo->busy_placements[c++] = TTM_PL_FLAG_WC | TTM_PL_FLAG_TT; + } else { + rbo->busy_placements[c++] = TTM_PL_FLAG_CACHED | TTM_PL_FLAG_TT; + } rbo->placement.num_busy_placement = c; } @@ -350,7 +357,6 @@ int radeon_bo_list_validate(struct list_head *head) { struct radeon_bo_list *lobj; struct radeon_bo *bo; - u32 domain; int r; r = ttm_eu_reserve_buffers(head); @@ -360,17 +366,9 @@ int radeon_bo_list_validate(struct list_head *head) list_for_each_entry(lobj, head, tv.head) { bo = lobj->bo; if (!bo->pin_count) { - domain = lobj->wdomain ? lobj->wdomain : lobj->rdomain; - - retry: - radeon_ttm_placement_from_domain(bo, domain); r = ttm_bo_validate(&bo->tbo, &bo->placement, true, false); if (unlikely(r)) { - if (r != -ERESTARTSYS && domain == RADEON_GEM_DOMAIN_VRAM) { - domain |= RADEON_GEM_DOMAIN_GTT; - goto retry; - } return r; } } diff --git a/trunk/drivers/gpu/drm/radeon/radeon_prime.c b/trunk/drivers/gpu/drm/radeon/radeon_prime.c index 26c23bb651c6..e09521858f64 100644 --- a/trunk/drivers/gpu/drm/radeon/radeon_prime.c +++ b/trunk/drivers/gpu/drm/radeon/radeon_prime.c @@ -194,7 +194,6 @@ struct drm_gem_object *radeon_gem_prime_import(struct drm_device *dev, bo = dma_buf->priv; if (bo->gem_base.dev == dev) { drm_gem_object_reference(&bo->gem_base); - dma_buf_put(dma_buf); return &bo->gem_base; } } diff --git a/trunk/drivers/gpu/drm/radeon/radeon_ring.c b/trunk/drivers/gpu/drm/radeon/radeon_ring.c index 2430d80b1871..141f2b6a9cf2 100644 --- a/trunk/drivers/gpu/drm/radeon/radeon_ring.c +++ b/trunk/drivers/gpu/drm/radeon/radeon_ring.c @@ -784,8 +784,6 @@ static int radeon_debugfs_ring_info(struct seq_file *m, void *data) } seq_printf(m, "driver's copy of the wptr: 0x%08x [%5d]\n", ring->wptr, ring->wptr); seq_printf(m, "driver's copy of the rptr: 0x%08x [%5d]\n", ring->rptr, ring->rptr); - seq_printf(m, "last semaphore signal addr : 0x%016llx\n", ring->last_semaphore_signal_addr); - seq_printf(m, "last semaphore wait addr : 0x%016llx\n", ring->last_semaphore_wait_addr); seq_printf(m, "%u free dwords in ring\n", ring->ring_free_dw); seq_printf(m, "%u dwords in ring\n", count); /* print 8 dw before current rptr as often it's the last executed diff --git a/trunk/drivers/gpu/drm/radeon/radeon_semaphore.c b/trunk/drivers/gpu/drm/radeon/radeon_semaphore.c index 8dcc20f53d73..97f3ece81cd2 100644 --- a/trunk/drivers/gpu/drm/radeon/radeon_semaphore.c +++ b/trunk/drivers/gpu/drm/radeon/radeon_semaphore.c @@ -95,10 +95,6 @@ int radeon_semaphore_sync_rings(struct radeon_device *rdev, /* we assume caller has already allocated space on waiters ring */ radeon_semaphore_emit_wait(rdev, waiter, semaphore); - /* for debugging lockup only, used by sysfs debug files */ - rdev->ring[signaler].last_semaphore_signal_addr = semaphore->gpu_addr; - rdev->ring[waiter].last_semaphore_wait_addr = semaphore->gpu_addr; - return 0; } diff --git a/trunk/drivers/gpu/drm/radeon/reg_srcs/rv515 b/trunk/drivers/gpu/drm/radeon/reg_srcs/rv515 index 78d5e99d759d..911a8fbd32bb 100644 --- a/trunk/drivers/gpu/drm/radeon/reg_srcs/rv515 +++ b/trunk/drivers/gpu/drm/radeon/reg_srcs/rv515 @@ -324,8 +324,6 @@ rv515 0x6d40 0x46AC US_OUT_FMT_2 0x46B0 US_OUT_FMT_3 0x46B4 US_W_FMT -0x46C0 RB3D_COLOR_CLEAR_VALUE_AR -0x46C4 RB3D_COLOR_CLEAR_VALUE_GB 0x4BC0 FG_FOG_BLEND 0x4BC4 FG_FOG_FACTOR 0x4BC8 FG_FOG_COLOR_R diff --git a/trunk/drivers/gpu/drm/radeon/rv770.c b/trunk/drivers/gpu/drm/radeon/rv770.c index 1b2444f4d8f4..87c979c4f721 100644 --- a/trunk/drivers/gpu/drm/radeon/rv770.c +++ b/trunk/drivers/gpu/drm/radeon/rv770.c @@ -887,80 +887,6 @@ static int rv770_mc_init(struct radeon_device *rdev) return 0; } -/** - * rv770_copy_dma - copy pages using the DMA engine - * - * @rdev: radeon_device pointer - * @src_offset: src GPU address - * @dst_offset: dst GPU address - * @num_gpu_pages: number of GPU pages to xfer - * @fence: radeon fence object - * - * Copy GPU paging using the DMA engine (r7xx). - * Used by the radeon ttm implementation to move pages if - * registered as the asic copy callback. - */ -int rv770_copy_dma(struct radeon_device *rdev, - uint64_t src_offset, uint64_t dst_offset, - unsigned num_gpu_pages, - struct radeon_fence **fence) -{ - struct radeon_semaphore *sem = NULL; - int ring_index = rdev->asic->copy.dma_ring_index; - struct radeon_ring *ring = &rdev->ring[ring_index]; - u32 size_in_dw, cur_size_in_dw; - int i, num_loops; - int r = 0; - - r = radeon_semaphore_create(rdev, &sem); - if (r) { - DRM_ERROR("radeon: moving bo (%d).\n", r); - return r; - } - - size_in_dw = (num_gpu_pages << RADEON_GPU_PAGE_SHIFT) / 4; - num_loops = DIV_ROUND_UP(size_in_dw, 0xFFFF); - r = radeon_ring_lock(rdev, ring, num_loops * 5 + 8); - if (r) { - DRM_ERROR("radeon: moving bo (%d).\n", r); - radeon_semaphore_free(rdev, &sem, NULL); - return r; - } - - if (radeon_fence_need_sync(*fence, ring->idx)) { - radeon_semaphore_sync_rings(rdev, sem, (*fence)->ring, - ring->idx); - radeon_fence_note_sync(*fence, ring->idx); - } else { - radeon_semaphore_free(rdev, &sem, NULL); - } - - for (i = 0; i < num_loops; i++) { - cur_size_in_dw = size_in_dw; - if (cur_size_in_dw > 0xFFFF) - cur_size_in_dw = 0xFFFF; - size_in_dw -= cur_size_in_dw; - radeon_ring_write(ring, DMA_PACKET(DMA_PACKET_COPY, 0, 0, cur_size_in_dw)); - radeon_ring_write(ring, dst_offset & 0xfffffffc); - radeon_ring_write(ring, src_offset & 0xfffffffc); - radeon_ring_write(ring, upper_32_bits(dst_offset) & 0xff); - radeon_ring_write(ring, upper_32_bits(src_offset) & 0xff); - src_offset += cur_size_in_dw * 4; - dst_offset += cur_size_in_dw * 4; - } - - r = radeon_fence_emit(rdev, fence, ring->idx); - if (r) { - radeon_ring_unlock_undo(rdev, ring); - return r; - } - - radeon_ring_unlock_commit(rdev, ring); - radeon_semaphore_free(rdev, &sem, *fence); - - return r; -} - static int rv770_startup(struct radeon_device *rdev) { struct radeon_ring *ring; diff --git a/trunk/drivers/gpu/drm/radeon/si.c b/trunk/drivers/gpu/drm/radeon/si.c index ae8b48205a6c..3240a3d64f30 100644 --- a/trunk/drivers/gpu/drm/radeon/si.c +++ b/trunk/drivers/gpu/drm/radeon/si.c @@ -2215,12 +2215,6 @@ static int si_gpu_soft_reset(struct radeon_device *rdev, u32 reset_mask) { struct evergreen_mc_save save; - if (!(RREG32(GRBM_STATUS) & GUI_ACTIVE)) - reset_mask &= ~(RADEON_RESET_GFX | RADEON_RESET_COMPUTE); - - if (RREG32(DMA_STATUS_REG) & DMA_IDLE) - reset_mask &= ~RADEON_RESET_DMA; - if (reset_mask == 0) return 0; diff --git a/trunk/drivers/gpu/drm/ttm/ttm_bo.c b/trunk/drivers/gpu/drm/ttm/ttm_bo.c index 52b20b12c83a..33d20be87db5 100644 --- a/trunk/drivers/gpu/drm/ttm/ttm_bo.c +++ b/trunk/drivers/gpu/drm/ttm/ttm_bo.c @@ -434,7 +434,6 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, bo->mem = tmp_mem; bdev->driver->move_notify(bo, mem); bo->mem = *mem; - *mem = tmp_mem; } goto out_err; diff --git a/trunk/drivers/gpu/drm/ttm/ttm_bo_util.c b/trunk/drivers/gpu/drm/ttm/ttm_bo_util.c index 44420fca7dfa..9e9c5d2a5c74 100644 --- a/trunk/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/trunk/drivers/gpu/drm/ttm/ttm_bo_util.c @@ -344,12 +344,8 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, if (ttm->state == tt_unpopulated) { ret = ttm->bdev->driver->ttm_tt_populate(ttm); - if (ret) { - /* if we fail here don't nuke the mm node - * as the bo still owns it */ - old_copy.mm_node = NULL; + if (ret) goto out1; - } } add = 0; @@ -375,11 +371,8 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, prot); } else ret = ttm_copy_io_page(new_iomap, old_iomap, page); - if (ret) { - /* failing here, means keep old copy as-is */ - old_copy.mm_node = NULL; + if (ret) goto out1; - } } mb(); out2: @@ -661,13 +654,11 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, */ set_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags); - - /* ttm_buffer_object_transfer accesses bo->sync_obj */ - ret = ttm_buffer_object_transfer(bo, &ghost_obj); spin_unlock(&bdev->fence_lock); if (tmp_obj) driver->sync_obj_unref(&tmp_obj); + ret = ttm_buffer_object_transfer(bo, &ghost_obj); if (ret) return ret; diff --git a/trunk/drivers/gpu/drm/udl/udl_connector.c b/trunk/drivers/gpu/drm/udl/udl_connector.c index fe5cdbcf2636..512f44add89f 100644 --- a/trunk/drivers/gpu/drm/udl/udl_connector.c +++ b/trunk/drivers/gpu/drm/udl/udl_connector.c @@ -22,17 +22,13 @@ static u8 *udl_get_edid(struct udl_device *udl) { u8 *block; - char *rbuf; + char rbuf[3]; int ret, i; block = kmalloc(EDID_LENGTH, GFP_KERNEL); if (block == NULL) return NULL; - rbuf = kmalloc(2, GFP_KERNEL); - if (rbuf == NULL) - goto error; - for (i = 0; i < EDID_LENGTH; i++) { ret = usb_control_msg(udl->ddev->usbdev, usb_rcvctrlpipe(udl->ddev->usbdev, 0), (0x02), @@ -40,17 +36,16 @@ static u8 *udl_get_edid(struct udl_device *udl) HZ); if (ret < 1) { DRM_ERROR("Read EDID byte %d failed err %x\n", i, ret); + i--; goto error; } block[i] = rbuf[1]; } - kfree(rbuf); return block; error: kfree(block); - kfree(rbuf); return NULL; } @@ -62,14 +57,6 @@ static int udl_get_modes(struct drm_connector *connector) edid = (struct edid *)udl_get_edid(udl); - /* - * We only read the main block, but if the monitor reports extension - * blocks then the drm edid code expects them to be present, so patch - * the extension count to 0. - */ - edid->checksum += edid->extensions; - edid->extensions = 0; - drm_mode_connector_update_edid_property(connector, edid); ret = drm_add_edid_modes(connector, edid); kfree(edid); diff --git a/trunk/drivers/hv/hv_balloon.c b/trunk/drivers/hv/hv_balloon.c index dd289fd179ca..f6c0011a0337 100644 --- a/trunk/drivers/hv/hv_balloon.c +++ b/trunk/drivers/hv/hv_balloon.c @@ -403,7 +403,7 @@ struct dm_info_header { */ struct dm_info_msg { - struct dm_header hdr; + struct dm_info_header header; __u32 reserved; __u32 info_size; __u8 info[]; @@ -503,17 +503,13 @@ static void hot_add_req(struct hv_dynmem_device *dm, struct dm_hot_add *msg) static void process_info(struct hv_dynmem_device *dm, struct dm_info_msg *msg) { - struct dm_info_header *info_hdr; - - info_hdr = (struct dm_info_header *)msg->info; - - switch (info_hdr->type) { + switch (msg->header.type) { case INFO_TYPE_MAX_PAGE_CNT: pr_info("Received INFO_TYPE_MAX_PAGE_CNT\n"); - pr_info("Data Size is %d\n", info_hdr->data_size); + pr_info("Data Size is %d\n", msg->header.data_size); break; default: - pr_info("Received Unknown type: %d\n", info_hdr->type); + pr_info("Received Unknown type: %d\n", msg->header.type); } } @@ -883,7 +879,7 @@ static int balloon_probe(struct hv_device *dev, balloon_onchannelcallback, dev); if (ret) - goto probe_error0; + return ret; dm_device.dev = dev; dm_device.state = DM_INITIALIZING; @@ -895,7 +891,7 @@ static int balloon_probe(struct hv_device *dev, kthread_run(dm_thread_func, &dm_device, "hv_balloon"); if (IS_ERR(dm_device.thread)) { ret = PTR_ERR(dm_device.thread); - goto probe_error1; + goto probe_error0; } hv_set_drvdata(dev, &dm_device); @@ -918,12 +914,12 @@ static int balloon_probe(struct hv_device *dev, VM_PKT_DATA_INBAND, VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); if (ret) - goto probe_error2; + goto probe_error1; t = wait_for_completion_timeout(&dm_device.host_event, 5*HZ); if (t == 0) { ret = -ETIMEDOUT; - goto probe_error2; + goto probe_error1; } /* @@ -932,7 +928,7 @@ static int balloon_probe(struct hv_device *dev, */ if (dm_device.state == DM_INIT_ERROR) { ret = -ETIMEDOUT; - goto probe_error2; + goto probe_error1; } /* * Now submit our capabilities to the host. @@ -965,12 +961,12 @@ static int balloon_probe(struct hv_device *dev, VM_PKT_DATA_INBAND, VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); if (ret) - goto probe_error2; + goto probe_error1; t = wait_for_completion_timeout(&dm_device.host_event, 5*HZ); if (t == 0) { ret = -ETIMEDOUT; - goto probe_error2; + goto probe_error1; } /* @@ -979,20 +975,18 @@ static int balloon_probe(struct hv_device *dev, */ if (dm_device.state == DM_INIT_ERROR) { ret = -ETIMEDOUT; - goto probe_error2; + goto probe_error1; } dm_device.state = DM_INITIALIZED; return 0; -probe_error2: +probe_error1: kthread_stop(dm_device.thread); -probe_error1: - vmbus_close(dev->channel); probe_error0: - kfree(send_buffer); + vmbus_close(dev->channel); return ret; } @@ -1005,7 +999,6 @@ static int balloon_remove(struct hv_device *dev) vmbus_close(dev->channel); kthread_stop(dm->thread); - kfree(send_buffer); return 0; } diff --git a/trunk/drivers/hwmon/vexpress.c b/trunk/drivers/hwmon/vexpress.c index d867e6bb2be1..86d7f6d858b1 100644 --- a/trunk/drivers/hwmon/vexpress.c +++ b/trunk/drivers/hwmon/vexpress.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include diff --git a/trunk/drivers/i2c/busses/i2c-designware-core.c b/trunk/drivers/i2c/busses/i2c-designware-core.c index f5258c205de5..cbba7db9ad59 100644 --- a/trunk/drivers/i2c/busses/i2c-designware-core.c +++ b/trunk/drivers/i2c/busses/i2c-designware-core.c @@ -34,7 +34,6 @@ #include #include #include -#include #include "i2c-designware-core.h" /* @@ -726,6 +725,3 @@ u32 i2c_dw_read_comp_param(struct dw_i2c_dev *dev) return dw_readl(dev, DW_IC_COMP_PARAM_1); } EXPORT_SYMBOL_GPL(i2c_dw_read_comp_param); - -MODULE_DESCRIPTION("Synopsys DesignWare I2C bus adapter core"); -MODULE_LICENSE("GPL"); diff --git a/trunk/drivers/i2c/busses/i2c-mxs.c b/trunk/drivers/i2c/busses/i2c-mxs.c index d6abaf2cf2e3..1b1a936eccc9 100644 --- a/trunk/drivers/i2c/busses/i2c-mxs.c +++ b/trunk/drivers/i2c/busses/i2c-mxs.c @@ -127,7 +127,7 @@ struct mxs_i2c_dev { struct device *dev; void __iomem *regs; struct completion cmd_complete; - int cmd_err; + u32 cmd_err; struct i2c_adapter adapter; const struct mxs_i2c_speed_config *speed; @@ -316,7 +316,7 @@ static int mxs_i2c_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, if (msg->len == 0) return -EINVAL; - INIT_COMPLETION(i2c->cmd_complete); + init_completion(&i2c->cmd_complete); i2c->cmd_err = 0; ret = mxs_i2c_dma_setup_xfer(adap, msg, flags); @@ -473,8 +473,6 @@ static int mxs_i2c_probe(struct platform_device *pdev) i2c->dev = dev; i2c->speed = &mxs_i2c_95kHz_config; - init_completion(&i2c->cmd_complete); - if (dev->of_node) { err = mxs_i2c_get_ofdata(i2c); if (err) diff --git a/trunk/drivers/i2c/busses/i2c-omap.c b/trunk/drivers/i2c/busses/i2c-omap.c index 4cc2f0528c88..20d41bfa7c19 100644 --- a/trunk/drivers/i2c/busses/i2c-omap.c +++ b/trunk/drivers/i2c/busses/i2c-omap.c @@ -803,7 +803,7 @@ static int errata_omap3_i462(struct omap_i2c_dev *dev) if (stat & OMAP_I2C_STAT_AL) { dev_err(dev->dev, "Arbitration lost\n"); dev->cmd_err |= OMAP_I2C_STAT_AL; - omap_i2c_ack_stat(dev, OMAP_I2C_STAT_AL); + omap_i2c_ack_stat(dev, OMAP_I2C_STAT_NACK); } return -EIO; @@ -963,7 +963,7 @@ omap_i2c_isr_thread(int this_irq, void *dev_id) i2c_omap_errata_i207(dev, stat); omap_i2c_ack_stat(dev, OMAP_I2C_STAT_RDR); - continue; + break; } if (stat & OMAP_I2C_STAT_RRDY) { @@ -989,7 +989,7 @@ omap_i2c_isr_thread(int this_irq, void *dev_id) break; omap_i2c_ack_stat(dev, OMAP_I2C_STAT_XDR); - continue; + break; } if (stat & OMAP_I2C_STAT_XRDY) { diff --git a/trunk/drivers/i2c/busses/i2c-sirf.c b/trunk/drivers/i2c/busses/i2c-sirf.c index e03381aee34f..3f1818b87974 100644 --- a/trunk/drivers/i2c/busses/i2c-sirf.c +++ b/trunk/drivers/i2c/busses/i2c-sirf.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include @@ -329,7 +328,6 @@ static int i2c_sirfsoc_probe(struct platform_device *pdev) adap->algo = &i2c_sirfsoc_algo; adap->algo_data = siic; - adap->dev.of_node = pdev->dev.of_node; adap->dev.parent = &pdev->dev; adap->nr = pdev->id; @@ -373,8 +371,6 @@ static int i2c_sirfsoc_probe(struct platform_device *pdev) clk_disable(clk); - of_i2c_register_devices(adap); - dev_info(&pdev->dev, " I2C adapter ready to operate\n"); return 0; diff --git a/trunk/drivers/i2c/muxes/i2c-mux-pinctrl.c b/trunk/drivers/i2c/muxes/i2c-mux-pinctrl.c index a43c0ce5e3d8..1e44d04d1b22 100644 --- a/trunk/drivers/i2c/muxes/i2c-mux-pinctrl.c +++ b/trunk/drivers/i2c/muxes/i2c-mux-pinctrl.c @@ -167,7 +167,7 @@ static int i2c_mux_pinctrl_probe(struct platform_device *pdev) } mux->busses = devm_kzalloc(&pdev->dev, - sizeof(*mux->busses) * mux->pdata->bus_count, + sizeof(mux->busses) * mux->pdata->bus_count, GFP_KERNEL); if (!mux->busses) { dev_err(&pdev->dev, "Cannot allocate busses\n"); diff --git a/trunk/drivers/idle/intel_idle.c b/trunk/drivers/idle/intel_idle.c index 2df9414a72f7..c49c04d9c2b0 100644 --- a/trunk/drivers/idle/intel_idle.c +++ b/trunk/drivers/idle/intel_idle.c @@ -448,6 +448,8 @@ static int intel_idle_probe(void) else on_each_cpu(__setup_broadcast_timer, (void *)true, 1); + register_cpu_notifier(&cpu_hotplug_notifier); + pr_debug(PREFIX "v" INTEL_IDLE_VERSION " model 0x%X\n", boot_cpu_data.x86_model); @@ -504,7 +506,7 @@ static int intel_idle_cpuidle_driver_init(void) if (*cpuidle_state_table[cstate].name == '\0') pr_debug(PREFIX "unaware of model 0x%x" " MWAIT %d please" - " contact lenb@kernel.org\n", + " contact lenb@kernel.org", boot_cpu_data.x86_model, cstate); continue; } @@ -610,7 +612,6 @@ static int __init intel_idle_init(void) return retval; } } - register_cpu_notifier(&cpu_hotplug_notifier); return 0; } diff --git a/trunk/drivers/iio/accel/Kconfig b/trunk/drivers/iio/accel/Kconfig index 05e996fafc9d..fe4bcd7c5b12 100644 --- a/trunk/drivers/iio/accel/Kconfig +++ b/trunk/drivers/iio/accel/Kconfig @@ -8,7 +8,6 @@ config HID_SENSOR_ACCEL_3D select IIO_BUFFER select IIO_TRIGGERED_BUFFER select HID_SENSOR_IIO_COMMON - select HID_SENSOR_IIO_TRIGGER tristate "HID Accelerometers 3D" help Say yes here to build support for the HID SENSOR diff --git a/trunk/drivers/iio/adc/ad7266.c b/trunk/drivers/iio/adc/ad7266.c index bbad9b94cd75..4a5f639bc684 100644 --- a/trunk/drivers/iio/adc/ad7266.c +++ b/trunk/drivers/iio/adc/ad7266.c @@ -411,11 +411,7 @@ static int ad7266_probe(struct spi_device *spi) if (ret) goto error_put_reg; - ret = regulator_get_voltage(st->reg); - if (ret < 0) - goto error_disable_reg; - - st->vref_uv = ret; + st->vref_uv = regulator_get_voltage(st->reg); } else { /* Use internal reference */ st->vref_uv = 2500000; diff --git a/trunk/drivers/iio/adc/at91_adc.c b/trunk/drivers/iio/adc/at91_adc.c index a526c0e3aaa8..04b013561f0f 100644 --- a/trunk/drivers/iio/adc/at91_adc.c +++ b/trunk/drivers/iio/adc/at91_adc.c @@ -80,7 +80,7 @@ static irqreturn_t at91_adc_trigger_handler(int irq, void *p) *timestamp = pf->timestamp; } - iio_push_to_buffers(idev, (u8 *)st->buffer); + iio_push_to_buffers(indio_dev, (u8 *)st->buffer); iio_trigger_notify_done(idev->trig); diff --git a/trunk/drivers/iio/adc/max1363.c b/trunk/drivers/iio/adc/max1363.c index 03b25b3dc71e..b5669be6f396 100644 --- a/trunk/drivers/iio/adc/max1363.c +++ b/trunk/drivers/iio/adc/max1363.c @@ -1605,20 +1605,19 @@ static int max1363_probe(struct i2c_client *client, return 0; error_free_irq: - if (client->irq) - free_irq(st->client->irq, indio_dev); + free_irq(st->client->irq, indio_dev); error_uninit_buffer: iio_buffer_unregister(indio_dev); error_cleanup_buffer: max1363_buffer_cleanup(indio_dev); error_free_available_scan_masks: kfree(indio_dev->available_scan_masks); +error_unregister_map: + iio_map_array_unregister(indio_dev, client->dev.platform_data); error_disable_reg: regulator_disable(st->reg); error_put_reg: regulator_put(st->reg); -error_unregister_map: - iio_map_array_unregister(indio_dev, client->dev.platform_data); error_free_device: iio_device_free(indio_dev); error_out: @@ -1636,8 +1635,10 @@ static int max1363_remove(struct i2c_client *client) iio_buffer_unregister(indio_dev); max1363_buffer_cleanup(indio_dev); kfree(indio_dev->available_scan_masks); - regulator_disable(st->reg); - regulator_put(st->reg); + if (!IS_ERR(st->reg)) { + regulator_disable(st->reg); + regulator_put(st->reg); + } iio_map_array_unregister(indio_dev, client->dev.platform_data); iio_device_free(indio_dev); diff --git a/trunk/drivers/iio/common/hid-sensors/Kconfig b/trunk/drivers/iio/common/hid-sensors/Kconfig index 1178121b55b0..ae10778da7aa 100644 --- a/trunk/drivers/iio/common/hid-sensors/Kconfig +++ b/trunk/drivers/iio/common/hid-sensors/Kconfig @@ -6,7 +6,7 @@ menu "Hid Sensor IIO Common" config HID_SENSOR_IIO_COMMON tristate "Common modules for all HID Sensor IIO drivers" depends on HID_SENSOR_HUB - select HID_SENSOR_IIO_TRIGGER if IIO_BUFFER + select IIO_TRIGGER if IIO_BUFFER help Say yes here to build support for HID sensor to use HID sensor common processing for attributes and IIO triggers. @@ -14,17 +14,6 @@ config HID_SENSOR_IIO_COMMON HID sensor drivers, this module contains processing for those attributes. -config HID_SENSOR_IIO_TRIGGER - tristate "Common module (trigger) for all HID Sensor IIO drivers" - depends on HID_SENSOR_HUB && HID_SENSOR_IIO_COMMON - select IIO_TRIGGER - help - Say yes here to build trigger support for HID sensors. - Triggers will be send if all requested attributes were read. - - If this driver is compiled as a module, it will be named - hid-sensor-trigger. - config HID_SENSOR_ENUM_BASE_QUIRKS bool "ENUM base quirks for HID Sensor IIO drivers" depends on HID_SENSOR_IIO_COMMON diff --git a/trunk/drivers/iio/common/hid-sensors/Makefile b/trunk/drivers/iio/common/hid-sensors/Makefile index 22e7c5a82325..1f463e00c242 100644 --- a/trunk/drivers/iio/common/hid-sensors/Makefile +++ b/trunk/drivers/iio/common/hid-sensors/Makefile @@ -3,5 +3,4 @@ # obj-$(CONFIG_HID_SENSOR_IIO_COMMON) += hid-sensor-iio-common.o -obj-$(CONFIG_HID_SENSOR_IIO_TRIGGER) += hid-sensor-trigger.o -hid-sensor-iio-common-y := hid-sensor-attributes.o +hid-sensor-iio-common-y := hid-sensor-attributes.o hid-sensor-trigger.o diff --git a/trunk/drivers/iio/dac/ad5380.c b/trunk/drivers/iio/dac/ad5380.c index 483fc379a2da..6c7898c765d9 100644 --- a/trunk/drivers/iio/dac/ad5380.c +++ b/trunk/drivers/iio/dac/ad5380.c @@ -406,11 +406,7 @@ static int ad5380_probe(struct device *dev, struct regmap *regmap, goto error_free_reg; } - ret = regulator_get_voltage(st->vref_reg); - if (ret < 0) - goto error_disable_reg; - - st->vref = ret; + st->vref = regulator_get_voltage(st->vref_reg); } else { st->vref = st->chip_info->int_vref; ctrl |= AD5380_CTRL_INT_VREF_EN; diff --git a/trunk/drivers/iio/dac/ad5446.c b/trunk/drivers/iio/dac/ad5446.c index f5583aedfb59..29f653dab2f7 100644 --- a/trunk/drivers/iio/dac/ad5446.c +++ b/trunk/drivers/iio/dac/ad5446.c @@ -226,11 +226,7 @@ static int ad5446_probe(struct device *dev, const char *name, if (ret) goto error_put_reg; - ret = regulator_get_voltage(reg); - if (ret < 0) - goto error_disable_reg; - - voltage_uv = ret; + voltage_uv = regulator_get_voltage(reg); } indio_dev = iio_device_alloc(sizeof(*st)); diff --git a/trunk/drivers/iio/dac/ad5504.c b/trunk/drivers/iio/dac/ad5504.c index 0661829f2773..b2a31a0468ed 100644 --- a/trunk/drivers/iio/dac/ad5504.c +++ b/trunk/drivers/iio/dac/ad5504.c @@ -296,11 +296,7 @@ static int ad5504_probe(struct spi_device *spi) if (ret) goto error_put_reg; - ret = regulator_get_voltage(reg); - if (ret < 0) - goto error_disable_reg; - - voltage_uv = ret; + voltage_uv = regulator_get_voltage(reg); } spi_set_drvdata(spi, indio_dev); diff --git a/trunk/drivers/iio/dac/ad5624r_spi.c b/trunk/drivers/iio/dac/ad5624r_spi.c index f6e116627b71..e9947969f9fe 100644 --- a/trunk/drivers/iio/dac/ad5624r_spi.c +++ b/trunk/drivers/iio/dac/ad5624r_spi.c @@ -238,11 +238,7 @@ static int ad5624r_probe(struct spi_device *spi) if (ret) goto error_put_reg; - ret = regulator_get_voltage(st->reg); - if (ret < 0) - goto error_disable_reg; - - voltage_uv = ret; + voltage_uv = regulator_get_voltage(st->reg); } spi_set_drvdata(spi, indio_dev); diff --git a/trunk/drivers/iio/dac/ad5686.c b/trunk/drivers/iio/dac/ad5686.c index ca9609d7a15c..36e51382ae52 100644 --- a/trunk/drivers/iio/dac/ad5686.c +++ b/trunk/drivers/iio/dac/ad5686.c @@ -332,11 +332,7 @@ static int ad5686_probe(struct spi_device *spi) if (ret) goto error_put_reg; - ret = regulator_get_voltage(st->reg); - if (ret < 0) - goto error_disable_reg; - - voltage_uv = ret; + voltage_uv = regulator_get_voltage(st->reg); } st->chip_info = diff --git a/trunk/drivers/iio/dac/ad5791.c b/trunk/drivers/iio/dac/ad5791.c index 6407b5407ddd..c84180f23139 100644 --- a/trunk/drivers/iio/dac/ad5791.c +++ b/trunk/drivers/iio/dac/ad5791.c @@ -365,11 +365,7 @@ static int ad5791_probe(struct spi_device *spi) if (ret) goto error_put_reg_pos; - ret = regulator_get_voltage(st->reg_vdd); - if (ret < 0) - goto error_disable_reg_pos; - - pos_voltage_uv = ret; + pos_voltage_uv = regulator_get_voltage(st->reg_vdd); } st->reg_vss = regulator_get(&spi->dev, "vss"); @@ -378,11 +374,7 @@ static int ad5791_probe(struct spi_device *spi) if (ret) goto error_put_reg_neg; - ret = regulator_get_voltage(st->reg_vss); - if (ret < 0) - goto error_disable_reg_neg; - - neg_voltage_uv = ret; + neg_voltage_uv = regulator_get_voltage(st->reg_vss); } st->pwr_down = true; @@ -436,7 +428,6 @@ static int ad5791_probe(struct spi_device *spi) if (!IS_ERR(st->reg_vss)) regulator_put(st->reg_vss); -error_disable_reg_pos: if (!IS_ERR(st->reg_vdd)) regulator_disable(st->reg_vdd); error_put_reg_pos: diff --git a/trunk/drivers/iio/frequency/adf4350.c b/trunk/drivers/iio/frequency/adf4350.c index a884252ac66b..e5033b4cfba0 100644 --- a/trunk/drivers/iio/frequency/adf4350.c +++ b/trunk/drivers/iio/frequency/adf4350.c @@ -173,7 +173,7 @@ static int adf4350_set_freq(struct adf4350_state *st, unsigned long long freq) } while ((st->r1_mod > ADF4350_MAX_MODULUS) && r_cnt); } while (r_cnt == 0); - tmp = freq * (u64)st->r1_mod + (st->fpfd >> 1); + tmp = freq * (u64)st->r1_mod + (st->fpfd > 1); do_div(tmp, st->fpfd); /* Div round closest (n + d/2)/d */ st->r0_fract = do_div(tmp, st->r1_mod); st->r0_int = tmp; diff --git a/trunk/drivers/iio/gyro/Kconfig b/trunk/drivers/iio/gyro/Kconfig index 96b68f63a902..48ed1483ff27 100644 --- a/trunk/drivers/iio/gyro/Kconfig +++ b/trunk/drivers/iio/gyro/Kconfig @@ -17,7 +17,6 @@ config HID_SENSOR_GYRO_3D select IIO_BUFFER select IIO_TRIGGERED_BUFFER select HID_SENSOR_IIO_COMMON - select HID_SENSOR_IIO_TRIGGER tristate "HID Gyroscope 3D" help Say yes here to build support for the HID SENSOR diff --git a/trunk/drivers/iio/light/Kconfig b/trunk/drivers/iio/light/Kconfig index dbf80abc834f..1763c9bcb98a 100644 --- a/trunk/drivers/iio/light/Kconfig +++ b/trunk/drivers/iio/light/Kconfig @@ -47,7 +47,6 @@ config HID_SENSOR_ALS select IIO_BUFFER select IIO_TRIGGERED_BUFFER select HID_SENSOR_IIO_COMMON - select HID_SENSOR_IIO_TRIGGER tristate "HID ALS" help Say yes here to build support for the HID SENSOR diff --git a/trunk/drivers/iio/magnetometer/Kconfig b/trunk/drivers/iio/magnetometer/Kconfig index ff11d68225cf..c1f0cdd57037 100644 --- a/trunk/drivers/iio/magnetometer/Kconfig +++ b/trunk/drivers/iio/magnetometer/Kconfig @@ -8,7 +8,6 @@ config HID_SENSOR_MAGNETOMETER_3D select IIO_BUFFER select IIO_TRIGGERED_BUFFER select HID_SENSOR_IIO_COMMON - select HID_SENSOR_IIO_TRIGGER tristate "HID Magenetometer 3D" help Say yes here to build support for the HID SENSOR diff --git a/trunk/drivers/iommu/amd_iommu_init.c b/trunk/drivers/iommu/amd_iommu_init.c index faf10ba1ed9a..81837b0710a9 100644 --- a/trunk/drivers/iommu/amd_iommu_init.c +++ b/trunk/drivers/iommu/amd_iommu_init.c @@ -974,38 +974,6 @@ static void __init free_iommu_all(void) } } -/* - * Family15h Model 10h-1fh erratum 746 (IOMMU Logging May Stall Translations) - * Workaround: - * BIOS should disable L2B micellaneous clock gating by setting - * L2_L2B_CK_GATE_CONTROL[CKGateL2BMiscDisable](D0F2xF4_x90[2]) = 1b - */ -static void __init amd_iommu_erratum_746_workaround(struct amd_iommu *iommu) -{ - u32 value; - - if ((boot_cpu_data.x86 != 0x15) || - (boot_cpu_data.x86_model < 0x10) || - (boot_cpu_data.x86_model > 0x1f)) - return; - - pci_write_config_dword(iommu->dev, 0xf0, 0x90); - pci_read_config_dword(iommu->dev, 0xf4, &value); - - if (value & BIT(2)) - return; - - /* Select NB indirect register 0x90 and enable writing */ - pci_write_config_dword(iommu->dev, 0xf0, 0x90 | (1 << 8)); - - pci_write_config_dword(iommu->dev, 0xf4, value | 0x4); - pr_info("AMD-Vi: Applying erratum 746 workaround for IOMMU at %s\n", - dev_name(&iommu->dev->dev)); - - /* Clear the enable writing bit */ - pci_write_config_dword(iommu->dev, 0xf0, 0x90); -} - /* * This function clues the initialization function for one IOMMU * together and also allocates the command buffer and programs the @@ -1204,8 +1172,6 @@ static int iommu_init_pci(struct amd_iommu *iommu) iommu->stored_l2[i] = iommu_read_l2(iommu, i); } - amd_iommu_erratum_746_workaround(iommu); - return pci_enable_device(iommu->dev); } diff --git a/trunk/drivers/isdn/gigaset/capi.c b/trunk/drivers/isdn/gigaset/capi.c index 03a0a01a4054..68452b768da2 100644 --- a/trunk/drivers/isdn/gigaset/capi.c +++ b/trunk/drivers/isdn/gigaset/capi.c @@ -248,8 +248,6 @@ static inline void dump_rawmsg(enum debuglevel level, const char *tag, CAPIMSG_APPID(data), CAPIMSG_MSGID(data), l, CAPIMSG_CONTROL(data)); l -= 12; - if (l <= 0) - return; dbgline = kmalloc(3 * l, GFP_ATOMIC); if (!dbgline) return; diff --git a/trunk/drivers/md/dm-raid.c b/trunk/drivers/md/dm-raid.c index 3d8984edeff7..9e58dbd8d8cb 100644 --- a/trunk/drivers/md/dm-raid.c +++ b/trunk/drivers/md/dm-raid.c @@ -340,24 +340,22 @@ static int validate_region_size(struct raid_set *rs, unsigned long region_size) } /* - * validate_rebuild_devices + * validate_raid_redundancy * @rs * - * Determine if the devices specified for rebuild can result in a valid - * usable array that is capable of rebuilding the given devices. + * Determine if there are enough devices in the array that haven't + * failed (or are being rebuilt) to form a usable array. * * Returns: 0 on success, -EINVAL on failure. */ -static int validate_rebuild_devices(struct raid_set *rs) +static int validate_raid_redundancy(struct raid_set *rs) { unsigned i, rebuild_cnt = 0; unsigned rebuilds_per_group, copies, d; - if (!(rs->print_flags & DMPF_REBUILD)) - return 0; - for (i = 0; i < rs->md.raid_disks; i++) - if (!test_bit(In_sync, &rs->dev[i].rdev.flags)) + if (!test_bit(In_sync, &rs->dev[i].rdev.flags) || + !rs->dev[i].rdev.sb_page) rebuild_cnt++; switch (rs->raid_type->level) { @@ -393,27 +391,24 @@ static int validate_rebuild_devices(struct raid_set *rs) * A A B B C * C D D E E */ - rebuilds_per_group = 0; for (i = 0; i < rs->md.raid_disks * copies; i++) { + if (!(i % copies)) + rebuilds_per_group = 0; d = i % rs->md.raid_disks; - if (!test_bit(In_sync, &rs->dev[d].rdev.flags) && + if ((!rs->dev[d].rdev.sb_page || + !test_bit(In_sync, &rs->dev[d].rdev.flags)) && (++rebuilds_per_group >= copies)) goto too_many; - if (!((i + 1) % copies)) - rebuilds_per_group = 0; } break; default: - DMERR("The rebuild parameter is not supported for %s", - rs->raid_type->name); - rs->ti->error = "Rebuild not supported for this RAID type"; - return -EINVAL; + if (rebuild_cnt) + return -EINVAL; } return 0; too_many: - rs->ti->error = "Too many rebuild devices specified"; return -EINVAL; } @@ -664,9 +659,6 @@ static int parse_raid_params(struct raid_set *rs, char **argv, } rs->md.dev_sectors = sectors_per_dev; - if (validate_rebuild_devices(rs)) - return -EINVAL; - /* Assume there are no metadata devices until the drives are parsed */ rs->md.persistent = 0; rs->md.external = 1; @@ -995,28 +987,10 @@ static int super_validate(struct mddev *mddev, struct md_rdev *rdev) static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs) { int ret; - unsigned redundancy = 0; struct raid_dev *dev; struct md_rdev *rdev, *tmp, *freshest; struct mddev *mddev = &rs->md; - switch (rs->raid_type->level) { - case 1: - redundancy = rs->md.raid_disks - 1; - break; - case 4: - case 5: - case 6: - redundancy = rs->raid_type->parity_devs; - break; - case 10: - redundancy = raid10_md_layout_to_copies(mddev->layout) - 1; - break; - default: - ti->error = "Unknown RAID type"; - return -EINVAL; - } - freshest = NULL; rdev_for_each_safe(rdev, tmp, mddev) { /* @@ -1045,44 +1019,43 @@ static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs) break; default: dev = container_of(rdev, struct raid_dev, rdev); - if (redundancy--) { - if (dev->meta_dev) - dm_put_device(ti, dev->meta_dev); - - dev->meta_dev = NULL; - rdev->meta_bdev = NULL; + if (dev->meta_dev) + dm_put_device(ti, dev->meta_dev); - if (rdev->sb_page) - put_page(rdev->sb_page); + dev->meta_dev = NULL; + rdev->meta_bdev = NULL; - rdev->sb_page = NULL; + if (rdev->sb_page) + put_page(rdev->sb_page); - rdev->sb_loaded = 0; + rdev->sb_page = NULL; - /* - * We might be able to salvage the data device - * even though the meta device has failed. For - * now, we behave as though '- -' had been - * set for this device in the table. - */ - if (dev->data_dev) - dm_put_device(ti, dev->data_dev); + rdev->sb_loaded = 0; - dev->data_dev = NULL; - rdev->bdev = NULL; + /* + * We might be able to salvage the data device + * even though the meta device has failed. For + * now, we behave as though '- -' had been + * set for this device in the table. + */ + if (dev->data_dev) + dm_put_device(ti, dev->data_dev); - list_del(&rdev->same_set); + dev->data_dev = NULL; + rdev->bdev = NULL; - continue; - } - ti->error = "Failed to load superblock"; - return ret; + list_del(&rdev->same_set); } } if (!freshest) return 0; + if (validate_raid_redundancy(rs)) { + rs->ti->error = "Insufficient redundancy to activate array"; + return -EINVAL; + } + /* * Validation of the freshest device provides the source of * validation for the remaining devices. @@ -1432,7 +1405,7 @@ static void raid_resume(struct dm_target *ti) static struct target_type raid_target = { .name = "raid", - .version = {1, 4, 0}, + .version = {1, 4, 1}, .module = THIS_MODULE, .ctr = raid_ctr, .dtr = raid_dtr, diff --git a/trunk/drivers/media/i2c/m5mols/m5mols_core.c b/trunk/drivers/media/i2c/m5mols/m5mols_core.c index d4e7567b367c..8a8d42fe2633 100644 --- a/trunk/drivers/media/i2c/m5mols/m5mols_core.c +++ b/trunk/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, mutex_lock(&info->lock); format = __find_format(info, fh, fmt->which, info->res_type); - if (format) + if (!format) fmt->format = *format; else ret = -EINVAL; diff --git a/trunk/drivers/media/platform/coda.c b/trunk/drivers/media/platform/coda.c index 4a980e029ca7..1cf8293c0fb0 100644 --- a/trunk/drivers/media/platform/coda.c +++ b/trunk/drivers/media/platform/coda.c @@ -23,8 +23,8 @@ #include #include #include -#include +#include #include #include #include diff --git a/trunk/drivers/media/platform/omap3isp/ispvideo.c b/trunk/drivers/media/platform/omap3isp/ispvideo.c index 8dac17511e61..e0d73a642186 100644 --- a/trunk/drivers/media/platform/omap3isp/ispvideo.c +++ b/trunk/drivers/media/platform/omap3isp/ispvideo.c @@ -35,6 +35,9 @@ #include #include #include +#include +#include +#include #include "ispvideo.h" #include "isp.h" diff --git a/trunk/drivers/media/platform/s5p-fimc/fimc-mdevice.c b/trunk/drivers/media/platform/s5p-fimc/fimc-mdevice.c index b4a68ecf0ca7..4ab99f3a7b09 100644 --- a/trunk/drivers/media/platform/s5p-fimc/fimc-mdevice.c +++ b/trunk/drivers/media/platform/s5p-fimc/fimc-mdevice.c @@ -593,7 +593,7 @@ static int __fimc_md_create_flite_source_links(struct fimc_md *fmd) { struct media_entity *source, *sink; unsigned int flags = MEDIA_LNK_FL_ENABLED; - int i, ret = 0; + int i, ret; for (i = 0; i < FIMC_LITE_MAX_DEVS; i++) { struct fimc_lite *fimc = fmd->fimc_lite[i]; diff --git a/trunk/drivers/media/platform/s5p-mfc/s5p_mfc.c b/trunk/drivers/media/platform/s5p-mfc/s5p_mfc.c index 681bc6ba149d..379f57433711 100644 --- a/trunk/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/trunk/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -412,48 +412,62 @@ static void s5p_mfc_handle_frame(struct s5p_mfc_ctx *ctx, } /* Error handling for interrupt */ -static void s5p_mfc_handle_error(struct s5p_mfc_dev *dev, - struct s5p_mfc_ctx *ctx, unsigned int reason, unsigned int err) +static void s5p_mfc_handle_error(struct s5p_mfc_ctx *ctx, + unsigned int reason, unsigned int err) { + struct s5p_mfc_dev *dev; unsigned long flags; - mfc_err("Interrupt Error: %08x\n", err); + /* If no context is available then all necessary + * processing has been done. */ + if (ctx == NULL) + return; - if (ctx != NULL) { - /* Error recovery is dependent on the state of context */ - switch (ctx->state) { - case MFCINST_RES_CHANGE_INIT: - case MFCINST_RES_CHANGE_FLUSH: - case MFCINST_RES_CHANGE_END: - case MFCINST_FINISHING: - case MFCINST_FINISHED: - case MFCINST_RUNNING: - /* It is higly probable that an error occured - * while decoding a frame */ - clear_work_bit(ctx); - ctx->state = MFCINST_ERROR; - /* Mark all dst buffers as having an error */ - spin_lock_irqsave(&dev->irqlock, flags); - s5p_mfc_hw_call(dev->mfc_ops, cleanup_queue, - &ctx->dst_queue, &ctx->vq_dst); - /* Mark all src buffers as having an error */ - s5p_mfc_hw_call(dev->mfc_ops, cleanup_queue, - &ctx->src_queue, &ctx->vq_src); - spin_unlock_irqrestore(&dev->irqlock, flags); - wake_up_ctx(ctx, reason, err); - break; - default: - clear_work_bit(ctx); - ctx->state = MFCINST_ERROR; - wake_up_ctx(ctx, reason, err); - break; - } - } - if (test_and_clear_bit(0, &dev->hw_lock) == 0) - BUG(); + dev = ctx->dev; + mfc_err("Interrupt Error: %08x\n", err); s5p_mfc_hw_call(dev->mfc_ops, clear_int_flags, dev); - s5p_mfc_clock_off(); wake_up_dev(dev, reason, err); + + /* Error recovery is dependent on the state of context */ + switch (ctx->state) { + case MFCINST_INIT: + /* This error had to happen while acquireing instance */ + case MFCINST_GOT_INST: + /* This error had to happen while parsing the header */ + case MFCINST_HEAD_PARSED: + /* This error had to happen while setting dst buffers */ + case MFCINST_RETURN_INST: + /* This error had to happen while releasing instance */ + clear_work_bit(ctx); + wake_up_ctx(ctx, reason, err); + if (test_and_clear_bit(0, &dev->hw_lock) == 0) + BUG(); + s5p_mfc_clock_off(); + ctx->state = MFCINST_ERROR; + break; + case MFCINST_FINISHING: + case MFCINST_FINISHED: + case MFCINST_RUNNING: + /* It is higly probable that an error occured + * while decoding a frame */ + clear_work_bit(ctx); + ctx->state = MFCINST_ERROR; + /* Mark all dst buffers as having an error */ + spin_lock_irqsave(&dev->irqlock, flags); + s5p_mfc_hw_call(dev->mfc_ops, cleanup_queue, &ctx->dst_queue, + &ctx->vq_dst); + /* Mark all src buffers as having an error */ + s5p_mfc_hw_call(dev->mfc_ops, cleanup_queue, &ctx->src_queue, + &ctx->vq_src); + spin_unlock_irqrestore(&dev->irqlock, flags); + if (test_and_clear_bit(0, &dev->hw_lock) == 0) + BUG(); + s5p_mfc_clock_off(); + break; + default: + mfc_err("Encountered an error interrupt which had not been handled\n"); + break; + } return; } @@ -618,7 +632,7 @@ static irqreturn_t s5p_mfc_irq(int irq, void *priv) dev->warn_start) s5p_mfc_handle_frame(ctx, reason, err); else - s5p_mfc_handle_error(dev, ctx, reason, err); + s5p_mfc_handle_error(ctx, reason, err); clear_bit(0, &dev->enter_suspend); break; diff --git a/trunk/drivers/media/usb/gspca/kinect.c b/trunk/drivers/media/usb/gspca/kinect.c index 3773a8a745df..40ad6687ee5d 100644 --- a/trunk/drivers/media/usb/gspca/kinect.c +++ b/trunk/drivers/media/usb/gspca/kinect.c @@ -381,7 +381,6 @@ static const struct sd_desc sd_desc = { /* -- module initialisation -- */ static const struct usb_device_id device_table[] = { {USB_DEVICE(0x045e, 0x02ae)}, - {USB_DEVICE(0x045e, 0x02bf)}, {} }; diff --git a/trunk/drivers/media/usb/gspca/sonixb.c b/trunk/drivers/media/usb/gspca/sonixb.c index 1220340e7602..70511d5f9538 100644 --- a/trunk/drivers/media/usb/gspca/sonixb.c +++ b/trunk/drivers/media/usb/gspca/sonixb.c @@ -496,7 +496,7 @@ static void reg_w(struct gspca_dev *gspca_dev, } } -static void i2c_w(struct gspca_dev *gspca_dev, const u8 *buf) +static void i2c_w(struct gspca_dev *gspca_dev, const __u8 *buffer) { int retry = 60; @@ -504,19 +504,16 @@ static void i2c_w(struct gspca_dev *gspca_dev, const u8 *buf) return; /* is i2c ready */ - reg_w(gspca_dev, 0x08, buf, 8); + reg_w(gspca_dev, 0x08, buffer, 8); while (retry--) { if (gspca_dev->usb_err < 0) return; - msleep(1); + msleep(10); reg_r(gspca_dev, 0x08); if (gspca_dev->usb_buf[0] & 0x04) { if (gspca_dev->usb_buf[0] & 0x08) { dev_err(gspca_dev->v4l2_dev.dev, - "i2c error writing %02x %02x %02x %02x" - " %02x %02x %02x %02x\n", - buf[0], buf[1], buf[2], buf[3], - buf[4], buf[5], buf[6], buf[7]); + "i2c write error\n"); gspca_dev->usb_err = -EIO; } return; @@ -533,7 +530,7 @@ static void i2c_w_vector(struct gspca_dev *gspca_dev, for (;;) { if (gspca_dev->usb_err < 0) return; - i2c_w(gspca_dev, *buffer); + reg_w(gspca_dev, 0x08, *buffer, 8); len -= 8; if (len <= 0) break; diff --git a/trunk/drivers/media/usb/gspca/sonixj.c b/trunk/drivers/media/usb/gspca/sonixj.c index 36307a9028a9..5a86047b846f 100644 --- a/trunk/drivers/media/usb/gspca/sonixj.c +++ b/trunk/drivers/media/usb/gspca/sonixj.c @@ -1550,7 +1550,6 @@ static void i2c_w1(struct gspca_dev *gspca_dev, u8 reg, u8 val) 0, gspca_dev->usb_buf, 8, 500); - msleep(2); if (ret < 0) { pr_err("i2c_w1 err %d\n", ret); gspca_dev->usb_err = ret; diff --git a/trunk/drivers/media/usb/uvc/uvc_ctrl.c b/trunk/drivers/media/usb/uvc/uvc_ctrl.c index d5baab17a5ef..2bb7613ddebb 100644 --- a/trunk/drivers/media/usb/uvc/uvc_ctrl.c +++ b/trunk/drivers/media/usb/uvc/uvc_ctrl.c @@ -1431,10 +1431,8 @@ int uvc_ctrl_set(struct uvc_video_chain *chain, int ret; ctrl = uvc_find_control(chain, xctrl->id, &mapping); - if (ctrl == NULL) + if (ctrl == NULL || (ctrl->info.flags & UVC_CTRL_FLAG_SET_CUR) == 0) return -EINVAL; - if (!(ctrl->info.flags & UVC_CTRL_FLAG_SET_CUR)) - return -EACCES; /* Clamp out of range values. */ switch (mapping->v4l2_type) { diff --git a/trunk/drivers/media/usb/uvc/uvc_v4l2.c b/trunk/drivers/media/usb/uvc/uvc_v4l2.c index 68d59b527492..f2ee8c6b0d8d 100644 --- a/trunk/drivers/media/usb/uvc/uvc_v4l2.c +++ b/trunk/drivers/media/usb/uvc/uvc_v4l2.c @@ -657,7 +657,8 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) ret = uvc_ctrl_get(chain, ctrl); if (ret < 0) { uvc_ctrl_rollback(handle); - ctrls->error_idx = i; + ctrls->error_idx = ret == -ENOENT + ? ctrls->count : i; return ret; } } @@ -685,7 +686,8 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) ret = uvc_ctrl_set(chain, ctrl); if (ret < 0) { uvc_ctrl_rollback(handle); - ctrls->error_idx = cmd == VIDIOC_S_EXT_CTRLS + ctrls->error_idx = (ret == -ENOENT && + cmd == VIDIOC_S_EXT_CTRLS) ? ctrls->count : i; return ret; } diff --git a/trunk/drivers/media/v4l2-core/videobuf2-core.c b/trunk/drivers/media/v4l2-core/videobuf2-core.c index e02c4797b1c6..9f81be23a81f 100644 --- a/trunk/drivers/media/v4l2-core/videobuf2-core.c +++ b/trunk/drivers/media/v4l2-core/videobuf2-core.c @@ -921,10 +921,8 @@ static void __fill_vb2_buffer(struct vb2_buffer *vb, const struct v4l2_buffer *b * In videobuf we use our internal V4l2_planes struct for * single-planar buffers as well, for simplicity. */ - if (V4L2_TYPE_IS_OUTPUT(b->type)) { + if (V4L2_TYPE_IS_OUTPUT(b->type)) v4l2_planes[0].bytesused = b->bytesused; - v4l2_planes[0].data_offset = 0; - } if (b->memory == V4L2_MEMORY_USERPTR) { v4l2_planes[0].m.userptr = b->m.userptr; diff --git a/trunk/drivers/mfd/Kconfig b/trunk/drivers/mfd/Kconfig index ff553babf455..1c0abd4dfc43 100644 --- a/trunk/drivers/mfd/Kconfig +++ b/trunk/drivers/mfd/Kconfig @@ -237,7 +237,6 @@ config MFD_TPS65910 depends on I2C=y && GPIOLIB select MFD_CORE select REGMAP_I2C - select REGMAP_IRQ select IRQ_DOMAIN help if you say yes here you get support for the TPS65910 series of @@ -293,7 +292,6 @@ config TWL4030_CORE bool "Texas Instruments TWL4030/TWL5030/TWL6030/TPS659x0 Support" depends on I2C=y && GENERIC_HARDIRQS select IRQ_DOMAIN - select REGMAP_I2C help Say yes here if you have TWL4030 / TWL6030 family chip on your board. This core driver provides register access and IRQ handling diff --git a/trunk/drivers/mfd/ab8500-core.c b/trunk/drivers/mfd/ab8500-core.c index 4778bb124efe..e1650badd106 100644 --- a/trunk/drivers/mfd/ab8500-core.c +++ b/trunk/drivers/mfd/ab8500-core.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include diff --git a/trunk/drivers/mfd/arizona-core.c b/trunk/drivers/mfd/arizona-core.c index 222c03a5ddc0..bc8a3edb6bbf 100644 --- a/trunk/drivers/mfd/arizona-core.c +++ b/trunk/drivers/mfd/arizona-core.c @@ -239,12 +239,7 @@ static int arizona_runtime_resume(struct device *dev) return ret; } - ret = regcache_sync(arizona->regmap); - if (ret != 0) { - dev_err(arizona->dev, "Failed to restore register cache\n"); - regulator_disable(arizona->dcvdd); - return ret; - } + regcache_sync(arizona->regmap); return 0; } diff --git a/trunk/drivers/mfd/arizona-irq.c b/trunk/drivers/mfd/arizona-irq.c index 2bec5f0db3ee..74713bf5371f 100644 --- a/trunk/drivers/mfd/arizona-irq.c +++ b/trunk/drivers/mfd/arizona-irq.c @@ -176,7 +176,14 @@ int arizona_irq_init(struct arizona *arizona) aod = &wm5102_aod; irq = &wm5102_irq; - ctrlif_error = false; + switch (arizona->rev) { + case 0: + case 1: + ctrlif_error = false; + break; + default: + break; + } break; #endif #ifdef CONFIG_MFD_WM5110 @@ -184,7 +191,14 @@ int arizona_irq_init(struct arizona *arizona) aod = &wm5110_aod; irq = &wm5110_irq; - ctrlif_error = false; + switch (arizona->rev) { + case 0: + case 1: + ctrlif_error = false; + break; + default: + break; + } break; #endif default: diff --git a/trunk/drivers/mfd/da9052-i2c.c b/trunk/drivers/mfd/da9052-i2c.c index 885e56780358..ac74a4d1daea 100644 --- a/trunk/drivers/mfd/da9052-i2c.c +++ b/trunk/drivers/mfd/da9052-i2c.c @@ -27,66 +27,6 @@ #include #endif -/* I2C safe register check */ -static inline bool i2c_safe_reg(unsigned char reg) -{ - switch (reg) { - case DA9052_STATUS_A_REG: - case DA9052_STATUS_B_REG: - case DA9052_STATUS_C_REG: - case DA9052_STATUS_D_REG: - case DA9052_ADC_RES_L_REG: - case DA9052_ADC_RES_H_REG: - case DA9052_VDD_RES_REG: - case DA9052_ICHG_AV_REG: - case DA9052_TBAT_RES_REG: - case DA9052_ADCIN4_RES_REG: - case DA9052_ADCIN5_RES_REG: - case DA9052_ADCIN6_RES_REG: - case DA9052_TJUNC_RES_REG: - case DA9052_TSI_X_MSB_REG: - case DA9052_TSI_Y_MSB_REG: - case DA9052_TSI_LSB_REG: - case DA9052_TSI_Z_MSB_REG: - return true; - default: - return false; - } -} - -/* - * There is an issue with DA9052 and DA9053_AA/BA/BB PMIC where the PMIC - * gets lockup up or fails to respond following a system reset. - * This fix is to follow any read or write with a dummy read to a safe - * register. - */ -int da9052_i2c_fix(struct da9052 *da9052, unsigned char reg) -{ - int val; - - switch (da9052->chip_id) { - case DA9052: - case DA9053_AA: - case DA9053_BA: - case DA9053_BB: - /* A dummy read to a safe register address. */ - if (!i2c_safe_reg(reg)) - return regmap_read(da9052->regmap, - DA9052_PARK_REGISTER, - &val); - break; - default: - /* - * For other chips parking of I2C register - * to a safe place is not required. - */ - break; - } - - return 0; -} -EXPORT_SYMBOL(da9052_i2c_fix); - static int da9052_i2c_enable_multiwrite(struct da9052 *da9052) { int reg_val, ret; @@ -143,7 +83,6 @@ static int da9052_i2c_probe(struct i2c_client *client, da9052->dev = &client->dev; da9052->chip_irq = client->irq; - da9052->fix_io = da9052_i2c_fix; i2c_set_clientdata(client, da9052); diff --git a/trunk/drivers/mfd/db8500-prcmu.c b/trunk/drivers/mfd/db8500-prcmu.c index 268f45d42394..dc8826d8d69d 100644 --- a/trunk/drivers/mfd/db8500-prcmu.c +++ b/trunk/drivers/mfd/db8500-prcmu.c @@ -2524,7 +2524,7 @@ static bool read_mailbox_0(void) for (n = 0; n < NUM_PRCMU_WAKEUPS; n++) { if (ev & prcmu_irq_bit[n]) - generic_handle_irq(irq_find_mapping(db8500_irq_domain, n)); + generic_handle_irq(IRQ_PRCMU_BASE + n); } r = true; break; @@ -2737,14 +2737,13 @@ static int db8500_irq_map(struct irq_domain *d, unsigned int virq, } static struct irq_domain_ops db8500_irq_ops = { - .map = db8500_irq_map, - .xlate = irq_domain_xlate_twocell, + .map = db8500_irq_map, + .xlate = irq_domain_xlate_twocell, }; static int db8500_irq_init(struct device_node *np) { - int irq_base = 0; - int i; + int irq_base = -1; /* In the device tree case, just take some IRQs */ if (!np) @@ -2759,10 +2758,6 @@ static int db8500_irq_init(struct device_node *np) return -ENOSYS; } - /* All wakeups will be used, so create mappings for all */ - for (i = 0; i < NUM_PRCMU_WAKEUPS; i++) - irq_create_mapping(db8500_irq_domain, i); - return 0; } diff --git a/trunk/drivers/mfd/max77686.c b/trunk/drivers/mfd/max77686.c index 4d73963cd8f0..f6878f8db57d 100644 --- a/trunk/drivers/mfd/max77686.c +++ b/trunk/drivers/mfd/max77686.c @@ -93,15 +93,6 @@ static int max77686_i2c_probe(struct i2c_client *i2c, if (max77686 == NULL) return -ENOMEM; - i2c_set_clientdata(i2c, max77686); - max77686->dev = &i2c->dev; - max77686->i2c = i2c; - max77686->type = id->driver_data; - - max77686->wakeup = pdata->wakeup; - max77686->irq_gpio = pdata->irq_gpio; - max77686->irq = i2c->irq; - max77686->regmap = regmap_init_i2c(i2c, &max77686_regmap_config); if (IS_ERR(max77686->regmap)) { ret = PTR_ERR(max77686->regmap); @@ -111,6 +102,15 @@ static int max77686_i2c_probe(struct i2c_client *i2c, return ret; } + i2c_set_clientdata(i2c, max77686); + max77686->dev = &i2c->dev; + max77686->i2c = i2c; + max77686->type = id->driver_data; + + max77686->wakeup = pdata->wakeup; + max77686->irq_gpio = pdata->irq_gpio; + max77686->irq = i2c->irq; + if (regmap_read(max77686->regmap, MAX77686_REG_DEVICE_ID, &data) < 0) { dev_err(max77686->dev, diff --git a/trunk/drivers/mfd/max77693.c b/trunk/drivers/mfd/max77693.c index 9e60fed5ff82..cc5155e20494 100644 --- a/trunk/drivers/mfd/max77693.c +++ b/trunk/drivers/mfd/max77693.c @@ -114,37 +114,35 @@ static int max77693_i2c_probe(struct i2c_client *i2c, u8 reg_data; int ret = 0; - if (!pdata) { - dev_err(&i2c->dev, "No platform data found.\n"); - return -EINVAL; - } - max77693 = devm_kzalloc(&i2c->dev, sizeof(struct max77693_dev), GFP_KERNEL); if (max77693 == NULL) return -ENOMEM; + max77693->regmap = devm_regmap_init_i2c(i2c, &max77693_regmap_config); + if (IS_ERR(max77693->regmap)) { + ret = PTR_ERR(max77693->regmap); + dev_err(max77693->dev,"failed to allocate register map: %d\n", + ret); + goto err_regmap; + } + i2c_set_clientdata(i2c, max77693); max77693->dev = &i2c->dev; max77693->i2c = i2c; max77693->irq = i2c->irq; max77693->type = id->driver_data; - max77693->regmap = devm_regmap_init_i2c(i2c, &max77693_regmap_config); - if (IS_ERR(max77693->regmap)) { - ret = PTR_ERR(max77693->regmap); - dev_err(max77693->dev, "failed to allocate register map: %d\n", - ret); - return ret; - } + if (!pdata) + goto err_regmap; max77693->wakeup = pdata->wakeup; - ret = max77693_read_reg(max77693->regmap, MAX77693_PMIC_REG_PMIC_ID2, - ®_data); - if (ret < 0) { + if (max77693_read_reg(max77693->regmap, + MAX77693_PMIC_REG_PMIC_ID2, ®_data) < 0) { dev_err(max77693->dev, "device not found on this channel\n"); - return ret; + ret = -ENODEV; + goto err_regmap; } else dev_info(max77693->dev, "device ID: 0x%x\n", reg_data); @@ -165,7 +163,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c, ret = PTR_ERR(max77693->regmap_muic); dev_err(max77693->dev, "failed to allocate register map: %d\n", ret); - goto err_regmap_muic; + goto err_regmap; } ret = max77693_irq_init(max77693); @@ -186,9 +184,9 @@ static int max77693_i2c_probe(struct i2c_client *i2c, err_mfd: max77693_irq_exit(max77693); err_irq: -err_regmap_muic: i2c_unregister_device(max77693->muic); i2c_unregister_device(max77693->haptic); +err_regmap: return ret; } diff --git a/trunk/drivers/mfd/pcf50633-core.c b/trunk/drivers/mfd/pcf50633-core.c index d11567307fbe..64803f13bcec 100644 --- a/trunk/drivers/mfd/pcf50633-core.c +++ b/trunk/drivers/mfd/pcf50633-core.c @@ -208,8 +208,6 @@ static int pcf50633_probe(struct i2c_client *client, if (!pcf) return -ENOMEM; - i2c_set_clientdata(client, pcf); - pcf->dev = &client->dev; pcf->pdata = pdata; mutex_init(&pcf->lock); @@ -221,6 +219,9 @@ static int pcf50633_probe(struct i2c_client *client, return ret; } + i2c_set_clientdata(client, pcf); + pcf->dev = &client->dev; + version = pcf50633_reg_read(pcf, 0); variant = pcf50633_reg_read(pcf, 1); if (version < 0 || variant < 0) { diff --git a/trunk/drivers/mfd/rtl8411.c b/trunk/drivers/mfd/rtl8411.c index 3d3b4addf81a..89f046ca9e41 100644 --- a/trunk/drivers/mfd/rtl8411.c +++ b/trunk/drivers/mfd/rtl8411.c @@ -112,21 +112,6 @@ static int rtl8411_card_power_off(struct rtsx_pcr *pcr, int card) BPP_LDO_POWB, BPP_LDO_SUSPEND); } -static int rtl8411_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage) -{ - u8 mask, val; - - mask = (BPP_REG_TUNED18 << BPP_TUNED18_SHIFT_8411) | BPP_PAD_MASK; - if (voltage == OUTPUT_3V3) - val = (BPP_ASIC_3V3 << BPP_TUNED18_SHIFT_8411) | BPP_PAD_3V3; - else if (voltage == OUTPUT_1V8) - val = (BPP_ASIC_1V8 << BPP_TUNED18_SHIFT_8411) | BPP_PAD_1V8; - else - return -EINVAL; - - return rtsx_pci_write_register(pcr, LDO_CTL, mask, val); -} - static unsigned int rtl8411_cd_deglitch(struct rtsx_pcr *pcr) { unsigned int card_exist; @@ -178,18 +163,6 @@ static unsigned int rtl8411_cd_deglitch(struct rtsx_pcr *pcr) return card_exist; } -static int rtl8411_conv_clk_and_div_n(int input, int dir) -{ - int output; - - if (dir == CLK_TO_DIV_N) - output = input * 4 / 5 - 2; - else - output = (input + 2) * 5 / 4; - - return output; -} - static const struct pcr_ops rtl8411_pcr_ops = { .extra_init_hw = rtl8411_extra_init_hw, .optimize_phy = NULL, @@ -199,9 +172,7 @@ static const struct pcr_ops rtl8411_pcr_ops = { .disable_auto_blink = rtl8411_disable_auto_blink, .card_power_on = rtl8411_card_power_on, .card_power_off = rtl8411_card_power_off, - .switch_output_voltage = rtl8411_switch_output_voltage, .cd_deglitch = rtl8411_cd_deglitch, - .conv_clk_and_div_n = rtl8411_conv_clk_and_div_n, }; /* SD Pull Control Enable: diff --git a/trunk/drivers/mfd/rts5209.c b/trunk/drivers/mfd/rts5209.c index 98fe0f39463e..283a4f148084 100644 --- a/trunk/drivers/mfd/rts5209.c +++ b/trunk/drivers/mfd/rts5209.c @@ -144,25 +144,6 @@ static int rts5209_card_power_off(struct rtsx_pcr *pcr, int card) return rtsx_pci_send_cmd(pcr, 100); } -static int rts5209_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage) -{ - int err; - - if (voltage == OUTPUT_3V3) { - err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4FC0 | 0x24); - if (err < 0) - return err; - } else if (voltage == OUTPUT_1V8) { - err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4C40 | 0x24); - if (err < 0) - return err; - } else { - return -EINVAL; - } - - return 0; -} - static const struct pcr_ops rts5209_pcr_ops = { .extra_init_hw = rts5209_extra_init_hw, .optimize_phy = rts5209_optimize_phy, @@ -172,9 +153,7 @@ static const struct pcr_ops rts5209_pcr_ops = { .disable_auto_blink = rts5209_disable_auto_blink, .card_power_on = rts5209_card_power_on, .card_power_off = rts5209_card_power_off, - .switch_output_voltage = rts5209_switch_output_voltage, .cd_deglitch = NULL, - .conv_clk_and_div_n = NULL, }; /* SD Pull Control Enable: diff --git a/trunk/drivers/mfd/rts5229.c b/trunk/drivers/mfd/rts5229.c index 29d889cbb9c5..b9dbab266fda 100644 --- a/trunk/drivers/mfd/rts5229.c +++ b/trunk/drivers/mfd/rts5229.c @@ -114,25 +114,6 @@ static int rts5229_card_power_off(struct rtsx_pcr *pcr, int card) return rtsx_pci_send_cmd(pcr, 100); } -static int rts5229_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage) -{ - int err; - - if (voltage == OUTPUT_3V3) { - err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4FC0 | 0x24); - if (err < 0) - return err; - } else if (voltage == OUTPUT_1V8) { - err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4C40 | 0x24); - if (err < 0) - return err; - } else { - return -EINVAL; - } - - return 0; -} - static const struct pcr_ops rts5229_pcr_ops = { .extra_init_hw = rts5229_extra_init_hw, .optimize_phy = rts5229_optimize_phy, @@ -142,9 +123,7 @@ static const struct pcr_ops rts5229_pcr_ops = { .disable_auto_blink = rts5229_disable_auto_blink, .card_power_on = rts5229_card_power_on, .card_power_off = rts5229_card_power_off, - .switch_output_voltage = rts5229_switch_output_voltage, .cd_deglitch = NULL, - .conv_clk_and_div_n = NULL, }; /* SD Pull Control Enable: diff --git a/trunk/drivers/mfd/rtsx_pcr.c b/trunk/drivers/mfd/rtsx_pcr.c index 9fc57009e228..7a7b0bda4618 100644 --- a/trunk/drivers/mfd/rtsx_pcr.c +++ b/trunk/drivers/mfd/rtsx_pcr.c @@ -630,10 +630,7 @@ int rtsx_pci_switch_clock(struct rtsx_pcr *pcr, unsigned int card_clock, if (clk == pcr->cur_clock) return 0; - if (pcr->ops->conv_clk_and_div_n) - N = (u8)pcr->ops->conv_clk_and_div_n(clk, CLK_TO_DIV_N); - else - N = (u8)(clk - 2); + N = (u8)(clk - 2); if ((clk <= 2) || (N > max_N)) return -EINVAL; @@ -644,14 +641,7 @@ int rtsx_pci_switch_clock(struct rtsx_pcr *pcr, unsigned int card_clock, /* Make sure that the SSC clock div_n is equal or greater than min_N */ div = CLK_DIV_1; while ((N < min_N) && (div < max_div)) { - if (pcr->ops->conv_clk_and_div_n) { - int dbl_clk = pcr->ops->conv_clk_and_div_n(N, - DIV_N_TO_CLK) * 2; - N = (u8)pcr->ops->conv_clk_and_div_n(dbl_clk, - CLK_TO_DIV_N); - } else { - N = (N + 2) * 2 - 2; - } + N = (N + 2) * 2 - 2; div++; } dev_dbg(&(pcr->pci->dev), "N = %d, div = %d\n", N, div); @@ -713,15 +703,6 @@ int rtsx_pci_card_power_off(struct rtsx_pcr *pcr, int card) } EXPORT_SYMBOL_GPL(rtsx_pci_card_power_off); -int rtsx_pci_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage) -{ - if (pcr->ops->switch_output_voltage) - return pcr->ops->switch_output_voltage(pcr, voltage); - - return 0; -} -EXPORT_SYMBOL_GPL(rtsx_pci_switch_output_voltage); - unsigned int rtsx_pci_card_exist(struct rtsx_pcr *pcr) { unsigned int val; @@ -786,10 +767,10 @@ static void rtsx_pci_card_detect(struct work_struct *work) spin_unlock_irqrestore(&pcr->lock, flags); - if ((card_detect & SD_EXIST) && pcr->slots[RTSX_SD_CARD].card_event) + if (card_detect & SD_EXIST) pcr->slots[RTSX_SD_CARD].card_event( pcr->slots[RTSX_SD_CARD].p_dev); - if ((card_detect & MS_EXIST) && pcr->slots[RTSX_MS_CARD].card_event) + if (card_detect & MS_EXIST) pcr->slots[RTSX_MS_CARD].card_event( pcr->slots[RTSX_MS_CARD].p_dev); } diff --git a/trunk/drivers/mfd/tc3589x.c b/trunk/drivers/mfd/tc3589x.c index ecc092c7f745..a06d66b929b1 100644 --- a/trunk/drivers/mfd/tc3589x.c +++ b/trunk/drivers/mfd/tc3589x.c @@ -219,18 +219,25 @@ static void tc3589x_irq_unmap(struct irq_domain *d, unsigned int virq) } static struct irq_domain_ops tc3589x_irq_ops = { - .map = tc3589x_irq_map, + .map = tc3589x_irq_map, .unmap = tc3589x_irq_unmap, - .xlate = irq_domain_xlate_twocell, + .xlate = irq_domain_xlate_twocell, }; static int tc3589x_irq_init(struct tc3589x *tc3589x, struct device_node *np) { int base = tc3589x->irq_base; - tc3589x->domain = irq_domain_add_simple( - np, TC3589x_NR_INTERNAL_IRQS, base, - &tc3589x_irq_ops, tc3589x); + if (base) { + tc3589x->domain = irq_domain_add_legacy( + NULL, TC3589x_NR_INTERNAL_IRQS, base, + 0, &tc3589x_irq_ops, tc3589x); + } + else { + tc3589x->domain = irq_domain_add_linear( + np, TC3589x_NR_INTERNAL_IRQS, + &tc3589x_irq_ops, tc3589x); + } if (!tc3589x->domain) { dev_err(tc3589x->dev, "Failed to create irqdomain\n"); diff --git a/trunk/drivers/mfd/twl4030-power.c b/trunk/drivers/mfd/twl4030-power.c index dd362c1078e1..4dae241e5017 100644 --- a/trunk/drivers/mfd/twl4030-power.c +++ b/trunk/drivers/mfd/twl4030-power.c @@ -159,7 +159,7 @@ static int twl4030_write_script_ins(u8 address, u16 pmb_message, static int twl4030_write_script(u8 address, struct twl4030_ins *script, int len) { - int err = -EINVAL; + int err; for (; len; len--, address++, script++) { if (len == 1) { diff --git a/trunk/drivers/mfd/vexpress-config.c b/trunk/drivers/mfd/vexpress-config.c index 3c1723aa6225..fae15d880758 100644 --- a/trunk/drivers/mfd/vexpress-config.c +++ b/trunk/drivers/mfd/vexpress-config.c @@ -67,7 +67,6 @@ struct vexpress_config_bridge *vexpress_config_bridge_register( return bridge; } -EXPORT_SYMBOL(vexpress_config_bridge_register); void vexpress_config_bridge_unregister(struct vexpress_config_bridge *bridge) { @@ -84,7 +83,6 @@ void vexpress_config_bridge_unregister(struct vexpress_config_bridge *bridge) while (!list_empty(&__bridge.transactions)) cpu_relax(); } -EXPORT_SYMBOL(vexpress_config_bridge_unregister); struct vexpress_config_func { @@ -144,7 +142,6 @@ struct vexpress_config_func *__vexpress_config_func_get(struct device *dev, return func; } -EXPORT_SYMBOL(__vexpress_config_func_get); void vexpress_config_func_put(struct vexpress_config_func *func) { @@ -152,7 +149,7 @@ void vexpress_config_func_put(struct vexpress_config_func *func) of_node_put(func->bridge->node); kfree(func); } -EXPORT_SYMBOL(vexpress_config_func_put); + struct vexpress_config_trans { struct vexpress_config_func *func; @@ -232,7 +229,6 @@ void vexpress_config_complete(struct vexpress_config_bridge *bridge, complete(&trans->completion); } -EXPORT_SYMBOL(vexpress_config_complete); int vexpress_config_wait(struct vexpress_config_trans *trans) { @@ -240,7 +236,7 @@ int vexpress_config_wait(struct vexpress_config_trans *trans) return trans->status; } -EXPORT_SYMBOL(vexpress_config_wait); + int vexpress_config_read(struct vexpress_config_func *func, int offset, u32 *data) diff --git a/trunk/drivers/mfd/vexpress-sysreg.c b/trunk/drivers/mfd/vexpress-sysreg.c index 77048b18439e..e5d8f63b252a 100644 --- a/trunk/drivers/mfd/vexpress-sysreg.c +++ b/trunk/drivers/mfd/vexpress-sysreg.c @@ -313,11 +313,19 @@ static void vexpress_sysreg_config_complete(unsigned long data) } -void __init vexpress_sysreg_setup(struct device_node *node) +void __init vexpress_sysreg_early_init(void __iomem *base) { - if (WARN_ON(!vexpress_sysreg_base)) + struct device_node *node = of_find_compatible_node(NULL, NULL, + "arm,vexpress-sysreg"); + + if (node) + base = of_iomap(node, 0); + + if (WARN_ON(!base)) return; + vexpress_sysreg_base = base; + if (readl(vexpress_sysreg_base + SYS_MISC) & SYS_MISC_MASTERSITE) vexpress_master_site = VEXPRESS_SITE_DB2; else @@ -328,23 +336,9 @@ void __init vexpress_sysreg_setup(struct device_node *node) WARN_ON(!vexpress_sysreg_config_bridge); } -void __init vexpress_sysreg_early_init(void __iomem *base) -{ - vexpress_sysreg_base = base; - vexpress_sysreg_setup(NULL); -} - void __init vexpress_sysreg_of_early_init(void) { - struct device_node *node = of_find_compatible_node(NULL, NULL, - "arm,vexpress-sysreg"); - - if (node) { - vexpress_sysreg_base = of_iomap(node, 0); - vexpress_sysreg_setup(node); - } else { - pr_info("vexpress-sysreg: No Device Tree node found."); - } + vexpress_sysreg_early_init(NULL); } @@ -432,11 +426,9 @@ static int vexpress_sysreg_probe(struct platform_device *pdev) return -EBUSY; } - if (!vexpress_sysreg_base) { + if (!vexpress_sysreg_base) vexpress_sysreg_base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); - vexpress_sysreg_setup(pdev->dev.of_node); - } if (!vexpress_sysreg_base) { dev_err(&pdev->dev, "Failed to obtain base address!\n"); diff --git a/trunk/drivers/mfd/wm5102-tables.c b/trunk/drivers/mfd/wm5102-tables.c index 1133a64c2dc9..088872ab6338 100644 --- a/trunk/drivers/mfd/wm5102-tables.c +++ b/trunk/drivers/mfd/wm5102-tables.c @@ -1882,7 +1882,7 @@ static bool wm5102_volatile_register(struct device *dev, unsigned int reg) } } -#define WM5102_MAX_REGISTER 0x1a9800 +#define WM5102_MAX_REGISTER 0x1a8fff const struct regmap_config wm5102_spi_regmap = { .reg_bits = 32, diff --git a/trunk/drivers/misc/atmel-ssc.c b/trunk/drivers/misc/atmel-ssc.c index 3c09cbb70b1d..158da5a81a66 100644 --- a/trunk/drivers/misc/atmel-ssc.c +++ b/trunk/drivers/misc/atmel-ssc.c @@ -19,7 +19,6 @@ #include #include -#include /* Serialize access to ssc_list and user count */ static DEFINE_SPINLOCK(user_lock); @@ -132,13 +131,6 @@ static int ssc_probe(struct platform_device *pdev) struct resource *regs; struct ssc_device *ssc; const struct atmel_ssc_platform_data *plat_dat; - struct pinctrl *pinctrl; - - pinctrl = devm_pinctrl_get_select_default(&pdev->dev); - if (IS_ERR(pinctrl)) { - dev_err(&pdev->dev, "Failed to request pinctrl\n"); - return PTR_ERR(pinctrl); - } ssc = devm_kzalloc(&pdev->dev, sizeof(struct ssc_device), GFP_KERNEL); if (!ssc) { diff --git a/trunk/drivers/misc/mei/amthif.c b/trunk/drivers/misc/mei/amthif.c index e40ffd9502d1..18794aea6062 100644 --- a/trunk/drivers/misc/mei/amthif.c +++ b/trunk/drivers/misc/mei/amthif.c @@ -187,13 +187,13 @@ int mei_amthif_read(struct mei_device *dev, struct file *file, wait_ret = wait_event_interruptible(dev->iamthif_cl.wait, (cb = mei_amthif_find_read_list_entry(dev, file))); - /* Locking again the Mutex */ - mutex_lock(&dev->device_lock); - if (wait_ret) return -ERESTARTSYS; dev_dbg(&dev->pdev->dev, "woke up from sleep\n"); + + /* Locking again the Mutex */ + mutex_lock(&dev->device_lock); } diff --git a/trunk/drivers/misc/ti-st/st_kim.c b/trunk/drivers/misc/ti-st/st_kim.c index 83269f1d16e3..9ff942a346ed 100644 --- a/trunk/drivers/misc/ti-st/st_kim.c +++ b/trunk/drivers/misc/ti-st/st_kim.c @@ -468,11 +468,6 @@ long st_kim_start(void *kim_data) if (pdata->chip_enable) pdata->chip_enable(kim_gdata); - /* Configure BT nShutdown to HIGH state */ - gpio_set_value(kim_gdata->nshutdown, GPIO_LOW); - mdelay(5); /* FIXME: a proper toggle */ - gpio_set_value(kim_gdata->nshutdown, GPIO_HIGH); - mdelay(100); /* re-initialize the completion */ INIT_COMPLETION(kim_gdata->ldisc_installed); /* send notification to UIM */ @@ -514,8 +509,7 @@ long st_kim_start(void *kim_data) * (b) upon failure to either install ldisc or download firmware. * The function is responsible to (a) notify UIM about un-installation, * (b) flush UART if the ldisc was installed. - * (c) reset BT_EN - pull down nshutdown at the end. - * (d) invoke platform's chip disabling routine. + * (c) invoke platform's chip disabling routine. */ long st_kim_stop(void *kim_data) { @@ -547,13 +541,6 @@ long st_kim_stop(void *kim_data) err = -ETIMEDOUT; } - /* By default configure BT nShutdown to LOW state */ - gpio_set_value(kim_gdata->nshutdown, GPIO_LOW); - mdelay(1); - gpio_set_value(kim_gdata->nshutdown, GPIO_HIGH); - mdelay(1); - gpio_set_value(kim_gdata->nshutdown, GPIO_LOW); - /* platform specific disable */ if (pdata->chip_disable) pdata->chip_disable(kim_gdata); @@ -746,20 +733,6 @@ static int kim_probe(struct platform_device *pdev) /* refer to itself */ kim_gdata->core_data->kim_data = kim_gdata; - /* Claim the chip enable nShutdown gpio from the system */ - kim_gdata->nshutdown = pdata->nshutdown_gpio; - err = gpio_request(kim_gdata->nshutdown, "kim"); - if (unlikely(err)) { - pr_err(" gpio %ld request failed ", kim_gdata->nshutdown); - return err; - } - - /* Configure nShutdown GPIO as output=0 */ - err = gpio_direction_output(kim_gdata->nshutdown, 0); - if (unlikely(err)) { - pr_err(" unable to configure gpio %ld", kim_gdata->nshutdown); - return err; - } /* get reference of pdev for request_firmware */ kim_gdata->kim_pdev = pdev; @@ -806,18 +779,10 @@ static int kim_probe(struct platform_device *pdev) static int kim_remove(struct platform_device *pdev) { - /* free the GPIOs requested */ - struct ti_st_plat_data *pdata = pdev->dev.platform_data; struct kim_data_s *kim_gdata; kim_gdata = dev_get_drvdata(&pdev->dev); - /* Free the Bluetooth/FM/GPIO - * nShutdown gpio from the system - */ - gpio_free(pdata->nshutdown_gpio); - pr_info("nshutdown GPIO Freed"); - debugfs_remove_recursive(kim_debugfs_dir); sysfs_remove_group(&pdev->dev.kobj, &uim_attr_grp); pr_info("sysfs entries removed"); diff --git a/trunk/drivers/mmc/host/mvsdio.c b/trunk/drivers/mmc/host/mvsdio.c index f8dd36102949..de4c20b3936c 100644 --- a/trunk/drivers/mmc/host/mvsdio.c +++ b/trunk/drivers/mmc/host/mvsdio.c @@ -50,6 +50,8 @@ struct mvsd_host { struct timer_list timer; struct mmc_host *mmc; struct device *dev; + struct resource *res; + int irq; struct clk *clk; int gpio_card_detect; int gpio_write_protect; @@ -716,6 +718,10 @@ static int __init mvsd_probe(struct platform_device *pdev) if (!r || irq < 0 || !mvsd_data) return -ENXIO; + r = request_mem_region(r->start, SZ_1K, DRIVER_NAME); + if (!r) + return -EBUSY; + mmc = mmc_alloc_host(sizeof(struct mvsd_host), &pdev->dev); if (!mmc) { ret = -ENOMEM; @@ -725,8 +731,8 @@ static int __init mvsd_probe(struct platform_device *pdev) host = mmc_priv(mmc); host->mmc = mmc; host->dev = &pdev->dev; + host->res = r; host->base_clock = mvsd_data->clock / 2; - host->clk = ERR_PTR(-EINVAL); mmc->ops = &mvsd_ops; @@ -746,7 +752,7 @@ static int __init mvsd_probe(struct platform_device *pdev) spin_lock_init(&host->lock); - host->base = devm_request_and_ioremap(&pdev->dev, r); + host->base = ioremap(r->start, SZ_4K); if (!host->base) { ret = -ENOMEM; goto out; @@ -759,45 +765,44 @@ static int __init mvsd_probe(struct platform_device *pdev) mvsd_power_down(host); - ret = devm_request_irq(&pdev->dev, irq, mvsd_irq, 0, DRIVER_NAME, host); + ret = request_irq(irq, mvsd_irq, 0, DRIVER_NAME, host); if (ret) { pr_err("%s: cannot assign irq %d\n", DRIVER_NAME, irq); goto out; - } + } else + host->irq = irq; /* Not all platforms can gate the clock, so it is not an error if the clock does not exists. */ - host->clk = devm_clk_get(&pdev->dev, NULL); - if (!IS_ERR(host->clk)) + host->clk = clk_get(&pdev->dev, NULL); + if (!IS_ERR(host->clk)) { clk_prepare_enable(host->clk); + } if (mvsd_data->gpio_card_detect) { - ret = devm_gpio_request_one(&pdev->dev, - mvsd_data->gpio_card_detect, - GPIOF_IN, DRIVER_NAME " cd"); + ret = gpio_request(mvsd_data->gpio_card_detect, + DRIVER_NAME " cd"); if (ret == 0) { + gpio_direction_input(mvsd_data->gpio_card_detect); irq = gpio_to_irq(mvsd_data->gpio_card_detect); - ret = devm_request_irq(&pdev->dev, irq, - mvsd_card_detect_irq, - IRQ_TYPE_EDGE_RISING | - IRQ_TYPE_EDGE_FALLING, - DRIVER_NAME " cd", host); + ret = request_irq(irq, mvsd_card_detect_irq, + IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING, + DRIVER_NAME " cd", host); if (ret == 0) host->gpio_card_detect = mvsd_data->gpio_card_detect; else - devm_gpio_free(&pdev->dev, - mvsd_data->gpio_card_detect); + gpio_free(mvsd_data->gpio_card_detect); } } if (!host->gpio_card_detect) mmc->caps |= MMC_CAP_NEEDS_POLL; if (mvsd_data->gpio_write_protect) { - ret = devm_gpio_request_one(&pdev->dev, - mvsd_data->gpio_write_protect, - GPIOF_IN, DRIVER_NAME " wp"); + ret = gpio_request(mvsd_data->gpio_write_protect, + DRIVER_NAME " wp"); if (ret == 0) { + gpio_direction_input(mvsd_data->gpio_write_protect); host->gpio_write_protect = mvsd_data->gpio_write_protect; } @@ -819,11 +824,26 @@ static int __init mvsd_probe(struct platform_device *pdev) return 0; out: - if (mmc) { - if (!IS_ERR(host->clk)) + if (host) { + if (host->irq) + free_irq(host->irq, host); + if (host->gpio_card_detect) { + free_irq(gpio_to_irq(host->gpio_card_detect), host); + gpio_free(host->gpio_card_detect); + } + if (host->gpio_write_protect) + gpio_free(host->gpio_write_protect); + if (host->base) + iounmap(host->base); + } + if (r) + release_resource(r); + if (mmc) + if (!IS_ERR_OR_NULL(host->clk)) { clk_disable_unprepare(host->clk); + clk_put(host->clk); + } mmc_free_host(mmc); - } return ret; } @@ -832,16 +852,28 @@ static int __exit mvsd_remove(struct platform_device *pdev) { struct mmc_host *mmc = platform_get_drvdata(pdev); - struct mvsd_host *host = mmc_priv(mmc); - - mmc_remove_host(mmc); - del_timer_sync(&host->timer); - mvsd_power_down(host); + if (mmc) { + struct mvsd_host *host = mmc_priv(mmc); - if (!IS_ERR(host->clk)) - clk_disable_unprepare(host->clk); - mmc_free_host(mmc); + if (host->gpio_card_detect) { + free_irq(gpio_to_irq(host->gpio_card_detect), host); + gpio_free(host->gpio_card_detect); + } + mmc_remove_host(mmc); + free_irq(host->irq, host); + if (host->gpio_write_protect) + gpio_free(host->gpio_write_protect); + del_timer_sync(&host->timer); + mvsd_power_down(host); + iounmap(host->base); + release_resource(host->res); + if (!IS_ERR(host->clk)) { + clk_disable_unprepare(host->clk); + clk_put(host->clk); + } + mmc_free_host(mmc); + } platform_set_drvdata(pdev, NULL); return 0; } diff --git a/trunk/drivers/mmc/host/rtsx_pci_sdmmc.c b/trunk/drivers/mmc/host/rtsx_pci_sdmmc.c index f74b5adca642..571915dfb218 100644 --- a/trunk/drivers/mmc/host/rtsx_pci_sdmmc.c +++ b/trunk/drivers/mmc/host/rtsx_pci_sdmmc.c @@ -1060,6 +1060,26 @@ static int sd_wait_voltage_stable_2(struct realtek_pci_sdmmc *host) return 0; } +static int sd_change_bank_voltage(struct realtek_pci_sdmmc *host, u8 voltage) +{ + struct rtsx_pcr *pcr = host->pcr; + int err; + + if (voltage == SD_IO_3V3) { + err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4FC0 | 0x24); + if (err < 0) + return err; + } else if (voltage == SD_IO_1V8) { + err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4C40 | 0x24); + if (err < 0) + return err; + } else { + return -EINVAL; + } + + return 0; +} + static int sdmmc_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios) { struct realtek_pci_sdmmc *host = mmc_priv(mmc); @@ -1078,11 +1098,11 @@ static int sdmmc_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios) rtsx_pci_start_run(pcr); if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330) - voltage = OUTPUT_3V3; + voltage = SD_IO_3V3; else - voltage = OUTPUT_1V8; + voltage = SD_IO_1V8; - if (voltage == OUTPUT_1V8) { + if (voltage == SD_IO_1V8) { err = rtsx_pci_write_register(pcr, SD30_DRIVE_SEL, 0x07, DRIVER_TYPE_B); if (err < 0) @@ -1093,11 +1113,11 @@ static int sdmmc_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios) goto out; } - err = rtsx_pci_switch_output_voltage(pcr, voltage); + err = sd_change_bank_voltage(host, voltage); if (err < 0) goto out; - if (voltage == OUTPUT_1V8) { + if (voltage == SD_IO_1V8) { err = sd_wait_voltage_stable_2(host); if (err < 0) goto out; diff --git a/trunk/drivers/net/can/c_can/c_can.c b/trunk/drivers/net/can/c_can/c_can.c index 58607f196c9e..5233b8f58d77 100644 --- a/trunk/drivers/net/can/c_can/c_can.c +++ b/trunk/drivers/net/can/c_can/c_can.c @@ -960,7 +960,7 @@ static int c_can_handle_bus_err(struct net_device *dev, break; case LEC_ACK_ERROR: netdev_dbg(dev, "ack error\n"); - cf->data[3] |= (CAN_ERR_PROT_LOC_ACK | + cf->data[2] |= (CAN_ERR_PROT_LOC_ACK | CAN_ERR_PROT_LOC_ACK_DEL); break; case LEC_BIT1_ERROR: @@ -973,7 +973,7 @@ static int c_can_handle_bus_err(struct net_device *dev, break; case LEC_CRC_ERROR: netdev_dbg(dev, "CRC error\n"); - cf->data[3] |= (CAN_ERR_PROT_LOC_CRC_SEQ | + cf->data[2] |= (CAN_ERR_PROT_LOC_CRC_SEQ | CAN_ERR_PROT_LOC_CRC_DEL); break; default: diff --git a/trunk/drivers/net/can/pch_can.c b/trunk/drivers/net/can/pch_can.c index 5c314a961970..7d1748575b1f 100644 --- a/trunk/drivers/net/can/pch_can.c +++ b/trunk/drivers/net/can/pch_can.c @@ -560,7 +560,7 @@ static void pch_can_error(struct net_device *ndev, u32 status) stats->rx_errors++; break; case PCH_CRC_ERR: - cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ | + cf->data[2] |= CAN_ERR_PROT_LOC_CRC_SEQ | CAN_ERR_PROT_LOC_CRC_DEL; priv->can.can_stats.bus_error++; stats->rx_errors++; diff --git a/trunk/drivers/net/can/ti_hecc.c b/trunk/drivers/net/can/ti_hecc.c index 300581b24ff3..f898c6363729 100644 --- a/trunk/drivers/net/can/ti_hecc.c +++ b/trunk/drivers/net/can/ti_hecc.c @@ -746,12 +746,12 @@ static int ti_hecc_error(struct net_device *ndev, int int_status, } if (err_status & HECC_CANES_CRCE) { hecc_set_bit(priv, HECC_CANES, HECC_CANES_CRCE); - cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ | + cf->data[2] |= CAN_ERR_PROT_LOC_CRC_SEQ | CAN_ERR_PROT_LOC_CRC_DEL; } if (err_status & HECC_CANES_ACKE) { hecc_set_bit(priv, HECC_CANES, HECC_CANES_ACKE); - cf->data[3] |= CAN_ERR_PROT_LOC_ACK | + cf->data[2] |= CAN_ERR_PROT_LOC_ACK | CAN_ERR_PROT_LOC_ACK_DEL; } } diff --git a/trunk/drivers/net/ethernet/3com/3c574_cs.c b/trunk/drivers/net/ethernet/3com/3c574_cs.c index ffd8de28a76a..66df93638085 100644 --- a/trunk/drivers/net/ethernet/3com/3c574_cs.c +++ b/trunk/drivers/net/ethernet/3com/3c574_cs.c @@ -432,7 +432,7 @@ static int tc574_config(struct pcmcia_device *link) netdev_info(dev, "%s at io %#3lx, irq %d, hw_addr %pM\n", cardname, dev->base_addr, dev->irq, dev->dev_addr); netdev_info(dev, " %dK FIFO split %s Rx:Tx, %sMII interface.\n", - 8 << (config & Ram_size), + 8 << config & Ram_size, ram_split[(config & Ram_split) >> Ram_split_shift], config & Autoselect ? "autoselect " : ""); diff --git a/trunk/drivers/net/ethernet/adi/Kconfig b/trunk/drivers/net/ethernet/adi/Kconfig index a9481606bbcd..e49c0eff040b 100644 --- a/trunk/drivers/net/ethernet/adi/Kconfig +++ b/trunk/drivers/net/ethernet/adi/Kconfig @@ -61,7 +61,6 @@ config BFIN_RX_DESC_NUM config BFIN_MAC_USE_HWSTAMP bool "Use IEEE 1588 hwstamp" - depends on BFIN_MAC && BF518 select PTP_1588_CLOCK default y ---help--- diff --git a/trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index f771ddfba646..01588b66a38c 100644 --- a/trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c @@ -80,37 +80,12 @@ static inline void bnx2x_move_fp(struct bnx2x *bp, int from, int to) new_txdata_index = new_max_eth_txqs + FCOE_TXQ_IDX_OFFSET; } - memcpy(&bp->bnx2x_txq[new_txdata_index], - &bp->bnx2x_txq[old_txdata_index], + memcpy(&bp->bnx2x_txq[old_txdata_index], + &bp->bnx2x_txq[new_txdata_index], sizeof(struct bnx2x_fp_txdata)); to_fp->txdata_ptr[0] = &bp->bnx2x_txq[new_txdata_index]; } -/** - * bnx2x_shrink_eth_fp - guarantees fastpath structures stay intact - * - * @bp: driver handle - * @delta: number of eth queues which were not allocated - */ -static void bnx2x_shrink_eth_fp(struct bnx2x *bp, int delta) -{ - int i, cos, old_eth_num = BNX2X_NUM_ETH_QUEUES(bp); - - /* Queue pointer cannot be re-set on an fp-basis, as moving pointer - * backward along the array could cause memory to be overriden - */ - for (cos = 1; cos < bp->max_cos; cos++) { - for (i = 0; i < old_eth_num - delta; i++) { - struct bnx2x_fastpath *fp = &bp->fp[i]; - int new_idx = cos * (old_eth_num - delta) + i; - - memcpy(&bp->bnx2x_txq[new_idx], fp->txdata_ptr[cos], - sizeof(struct bnx2x_fp_txdata)); - fp->txdata_ptr[cos] = &bp->bnx2x_txq[new_idx]; - } - } -} - int load_count[2][3] = { {0} }; /* per-path: 0-common, 1-port0, 2-port1 */ /* free skb in the packet ring at pos idx @@ -3888,7 +3863,6 @@ int bnx2x_alloc_fp_mem(struct bnx2x *bp) int delta = BNX2X_NUM_ETH_QUEUES(bp) - i; WARN_ON(delta < 0); - bnx2x_shrink_eth_fp(bp, delta); if (CNIC_SUPPORT(bp)) /* move non eth FPs next to last eth FP * must be done in that order diff --git a/trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c index a427b49a886c..277f17e3c8f8 100644 --- a/trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +++ b/trunk/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) } else if ((info->flow_type == UDP_V6_FLOW) && (bp->rss_conf_obj.udp_rss_v6 != udp_rss_requested)) { bp->rss_conf_obj.udp_rss_v6 = udp_rss_requested; + return bnx2x_config_rss_pf(bp, &bp->rss_conf_obj, 0); DP(BNX2X_MSG_ETHTOOL, "rss re-configured, UDP 4-tupple %s\n", udp_rss_requested ? "enabled" : "disabled"); - return bnx2x_config_rss_pf(bp, &bp->rss_conf_obj, 0); } else { return 0; } diff --git a/trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 5523da3afcdc..940ef859dc60 100644 --- a/trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c @@ -127,17 +127,6 @@ MODULE_PARM_DESC(debug, " Default debug msglevel"); struct workqueue_struct *bnx2x_wq; -struct bnx2x_mac_vals { - u32 xmac_addr; - u32 xmac_val; - u32 emac_addr; - u32 emac_val; - u32 umac_addr; - u32 umac_val; - u32 bmac_addr; - u32 bmac_val[2]; -}; - enum bnx2x_board_type { BCM57710 = 0, BCM57711, @@ -9431,19 +9420,12 @@ static inline void bnx2x_undi_int_disable(struct bnx2x *bp) bnx2x_undi_int_disable_e1h(bp); } -static void bnx2x_prev_unload_close_mac(struct bnx2x *bp, - struct bnx2x_mac_vals *vals) +static void bnx2x_prev_unload_close_mac(struct bnx2x *bp) { u32 val, base_addr, offset, mask, reset_reg; bool mac_stopped = false; u8 port = BP_PORT(bp); - /* reset addresses as they also mark which values were changed */ - vals->bmac_addr = 0; - vals->umac_addr = 0; - vals->xmac_addr = 0; - vals->emac_addr = 0; - reset_reg = REG_RD(bp, MISC_REG_RESET_REG_2); if (!CHIP_IS_E3(bp)) { @@ -9465,18 +9447,14 @@ static void bnx2x_prev_unload_close_mac(struct bnx2x *bp, */ wb_data[0] = REG_RD(bp, base_addr + offset); wb_data[1] = REG_RD(bp, base_addr + offset + 0x4); - vals->bmac_addr = base_addr + offset; - vals->bmac_val[0] = wb_data[0]; - vals->bmac_val[1] = wb_data[1]; wb_data[0] &= ~BMAC_CONTROL_RX_ENABLE; - REG_WR(bp, vals->bmac_addr, wb_data[0]); - REG_WR(bp, vals->bmac_addr + 0x4, wb_data[1]); + REG_WR(bp, base_addr + offset, wb_data[0]); + REG_WR(bp, base_addr + offset + 0x4, wb_data[1]); } BNX2X_DEV_INFO("Disable emac Rx\n"); - vals->emac_addr = NIG_REG_NIG_EMAC0_EN + BP_PORT(bp)*4; - vals->emac_val = REG_RD(bp, vals->emac_addr); - REG_WR(bp, vals->emac_addr, 0); + REG_WR(bp, NIG_REG_NIG_EMAC0_EN + BP_PORT(bp)*4, 0); + mac_stopped = true; } else { if (reset_reg & MISC_REGISTERS_RESET_REG_2_XMAC) { @@ -9487,18 +9465,14 @@ static void bnx2x_prev_unload_close_mac(struct bnx2x *bp, val & ~(1 << 1)); REG_WR(bp, base_addr + XMAC_REG_PFC_CTRL_HI, val | (1 << 1)); - vals->xmac_addr = base_addr + XMAC_REG_CTRL; - vals->xmac_val = REG_RD(bp, vals->xmac_addr); - REG_WR(bp, vals->xmac_addr, 0); + REG_WR(bp, base_addr + XMAC_REG_CTRL, 0); mac_stopped = true; } mask = MISC_REGISTERS_RESET_REG_2_UMAC0 << port; if (mask & reset_reg) { BNX2X_DEV_INFO("Disable umac Rx\n"); base_addr = BP_PORT(bp) ? GRCBASE_UMAC1 : GRCBASE_UMAC0; - vals->umac_addr = base_addr + UMAC_REG_COMMAND_CONFIG; - vals->umac_val = REG_RD(bp, vals->umac_addr); - REG_WR(bp, vals->umac_addr, 0); + REG_WR(bp, base_addr + UMAC_REG_COMMAND_CONFIG, 0); mac_stopped = true; } } @@ -9690,16 +9664,12 @@ static int bnx2x_prev_unload_common(struct bnx2x *bp) { u32 reset_reg, tmp_reg = 0, rc; bool prev_undi = false; - struct bnx2x_mac_vals mac_vals; - /* It is possible a previous function received 'common' answer, * but hasn't loaded yet, therefore creating a scenario of * multiple functions receiving 'common' on the same path. */ BNX2X_DEV_INFO("Common unload Flow\n"); - memset(&mac_vals, 0, sizeof(mac_vals)); - if (bnx2x_prev_is_path_marked(bp)) return bnx2x_prev_mcp_done(bp); @@ -9710,10 +9680,7 @@ static int bnx2x_prev_unload_common(struct bnx2x *bp) u32 timer_count = 1000; /* Close the MAC Rx to prevent BRB from filling up */ - bnx2x_prev_unload_close_mac(bp, &mac_vals); - - /* close LLH filters towards the BRB */ - bnx2x_set_rx_filter(&bp->link_params, 0); + bnx2x_prev_unload_close_mac(bp); /* Check if the UNDI driver was previously loaded * UNDI driver initializes CID offset for normal bell to 0x7 @@ -9760,17 +9727,6 @@ static int bnx2x_prev_unload_common(struct bnx2x *bp) /* No packets are in the pipeline, path is ready for reset */ bnx2x_reset_common(bp); - if (mac_vals.xmac_addr) - REG_WR(bp, mac_vals.xmac_addr, mac_vals.xmac_val); - if (mac_vals.umac_addr) - REG_WR(bp, mac_vals.umac_addr, mac_vals.umac_val); - if (mac_vals.emac_addr) - REG_WR(bp, mac_vals.emac_addr, mac_vals.emac_val); - if (mac_vals.bmac_addr) { - REG_WR(bp, mac_vals.bmac_addr, mac_vals.bmac_val[0]); - REG_WR(bp, mac_vals.bmac_addr + 4, mac_vals.bmac_val[1]); - } - rc = bnx2x_prev_mark_path(bp, prev_undi); if (rc) { bnx2x_prev_mcp_done(bp); diff --git a/trunk/drivers/net/ethernet/broadcom/tg3.c b/trunk/drivers/net/ethernet/broadcom/tg3.c index bdb086934cd9..78ea90c40e19 100644 --- a/trunk/drivers/net/ethernet/broadcom/tg3.c +++ b/trunk/drivers/net/ethernet/broadcom/tg3.c @@ -1283,26 +1283,14 @@ static int tg3_phy_auxctl_write(struct tg3 *tp, int reg, u32 set) return tg3_writephy(tp, MII_TG3_AUX_CTRL, set | reg); } -static int tg3_phy_toggle_auxctl_smdsp(struct tg3 *tp, bool enable) -{ - u32 val; - int err; +#define TG3_PHY_AUXCTL_SMDSP_ENABLE(tp) \ + tg3_phy_auxctl_write((tp), MII_TG3_AUXCTL_SHDWSEL_AUXCTL, \ + MII_TG3_AUXCTL_ACTL_SMDSP_ENA | \ + MII_TG3_AUXCTL_ACTL_TX_6DB) - err = tg3_phy_auxctl_read(tp, MII_TG3_AUXCTL_SHDWSEL_AUXCTL, &val); - - if (err) - return err; - if (enable) - - val |= MII_TG3_AUXCTL_ACTL_SMDSP_ENA; - else - val &= ~MII_TG3_AUXCTL_ACTL_SMDSP_ENA; - - err = tg3_phy_auxctl_write((tp), MII_TG3_AUXCTL_SHDWSEL_AUXCTL, - val | MII_TG3_AUXCTL_ACTL_TX_6DB); - - return err; -} +#define TG3_PHY_AUXCTL_SMDSP_DISABLE(tp) \ + tg3_phy_auxctl_write((tp), MII_TG3_AUXCTL_SHDWSEL_AUXCTL, \ + MII_TG3_AUXCTL_ACTL_TX_6DB); static int tg3_bmcr_reset(struct tg3 *tp) { @@ -2235,7 +2223,7 @@ static void tg3_phy_apply_otp(struct tg3 *tp) otp = tp->phy_otp; - if (tg3_phy_toggle_auxctl_smdsp(tp, true)) + if (TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) return; phy = ((otp & TG3_OTP_AGCTGT_MASK) >> TG3_OTP_AGCTGT_SHIFT); @@ -2260,7 +2248,7 @@ static void tg3_phy_apply_otp(struct tg3 *tp) ((otp & TG3_OTP_RCOFF_MASK) >> TG3_OTP_RCOFF_SHIFT); tg3_phydsp_write(tp, MII_TG3_DSP_EXP97, phy); - tg3_phy_toggle_auxctl_smdsp(tp, false); + TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); } static void tg3_phy_eee_adjust(struct tg3 *tp, u32 current_link_up) @@ -2296,9 +2284,9 @@ static void tg3_phy_eee_adjust(struct tg3 *tp, u32 current_link_up) if (!tp->setlpicnt) { if (current_link_up == 1 && - !tg3_phy_toggle_auxctl_smdsp(tp, true)) { + !TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) { tg3_phydsp_write(tp, MII_TG3_DSP_TAP26, 0x0000); - tg3_phy_toggle_auxctl_smdsp(tp, false); + TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); } val = tr32(TG3_CPMU_EEE_MODE); @@ -2314,11 +2302,11 @@ static void tg3_phy_eee_enable(struct tg3 *tp) (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 || GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 || tg3_flag(tp, 57765_CLASS)) && - !tg3_phy_toggle_auxctl_smdsp(tp, true)) { + !TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) { val = MII_TG3_DSP_TAP26_ALNOKO | MII_TG3_DSP_TAP26_RMRXSTO; tg3_phydsp_write(tp, MII_TG3_DSP_TAP26, val); - tg3_phy_toggle_auxctl_smdsp(tp, false); + TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); } val = tr32(TG3_CPMU_EEE_MODE); @@ -2462,7 +2450,7 @@ static int tg3_phy_reset_5703_4_5(struct tg3 *tp) tg3_writephy(tp, MII_CTRL1000, CTL1000_AS_MASTER | CTL1000_ENABLE_MASTER); - err = tg3_phy_toggle_auxctl_smdsp(tp, true); + err = TG3_PHY_AUXCTL_SMDSP_ENABLE(tp); if (err) return err; @@ -2483,7 +2471,7 @@ static int tg3_phy_reset_5703_4_5(struct tg3 *tp) tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x8200); tg3_writephy(tp, MII_TG3_DSP_CONTROL, 0x0000); - tg3_phy_toggle_auxctl_smdsp(tp, false); + TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); tg3_writephy(tp, MII_CTRL1000, phy9_orig); @@ -2584,10 +2572,10 @@ static int tg3_phy_reset(struct tg3 *tp) out: if ((tp->phy_flags & TG3_PHYFLG_ADC_BUG) && - !tg3_phy_toggle_auxctl_smdsp(tp, true)) { + !TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) { tg3_phydsp_write(tp, 0x201f, 0x2aaa); tg3_phydsp_write(tp, 0x000a, 0x0323); - tg3_phy_toggle_auxctl_smdsp(tp, false); + TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); } if (tp->phy_flags & TG3_PHYFLG_5704_A0_BUG) { @@ -2596,14 +2584,14 @@ static int tg3_phy_reset(struct tg3 *tp) } if (tp->phy_flags & TG3_PHYFLG_BER_BUG) { - if (!tg3_phy_toggle_auxctl_smdsp(tp, true)) { + if (!TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) { tg3_phydsp_write(tp, 0x000a, 0x310b); tg3_phydsp_write(tp, 0x201f, 0x9506); tg3_phydsp_write(tp, 0x401f, 0x14e2); - tg3_phy_toggle_auxctl_smdsp(tp, false); + TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); } } else if (tp->phy_flags & TG3_PHYFLG_JITTER_BUG) { - if (!tg3_phy_toggle_auxctl_smdsp(tp, true)) { + if (!TG3_PHY_AUXCTL_SMDSP_ENABLE(tp)) { tg3_writephy(tp, MII_TG3_DSP_ADDRESS, 0x000a); if (tp->phy_flags & TG3_PHYFLG_ADJUST_TRIM) { tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x110b); @@ -2612,7 +2600,7 @@ static int tg3_phy_reset(struct tg3 *tp) } else tg3_writephy(tp, MII_TG3_DSP_RW_PORT, 0x010b); - tg3_phy_toggle_auxctl_smdsp(tp, false); + TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); } } @@ -4021,7 +4009,7 @@ static int tg3_phy_autoneg_cfg(struct tg3 *tp, u32 advertise, u32 flowctrl) tw32(TG3_CPMU_EEE_MODE, tr32(TG3_CPMU_EEE_MODE) & ~TG3_CPMU_EEEMD_LPI_ENABLE); - err = tg3_phy_toggle_auxctl_smdsp(tp, true); + err = TG3_PHY_AUXCTL_SMDSP_ENABLE(tp); if (!err) { u32 err2; @@ -4054,7 +4042,7 @@ static int tg3_phy_autoneg_cfg(struct tg3 *tp, u32 advertise, u32 flowctrl) MII_TG3_DSP_CH34TP2_HIBW01); } - err2 = tg3_phy_toggle_auxctl_smdsp(tp, false); + err2 = TG3_PHY_AUXCTL_SMDSP_DISABLE(tp); if (!err) err = err2; } @@ -6962,9 +6950,6 @@ static void tg3_poll_controller(struct net_device *dev) int i; struct tg3 *tp = netdev_priv(dev); - if (tg3_irq_sync(tp)) - return; - for (i = 0; i < tp->irq_cnt; i++) tg3_interrupt(tp->napi[i].irq_vec, &tp->napi[i]); } @@ -16382,7 +16367,6 @@ static int tg3_init_one(struct pci_dev *pdev, tp->pm_cap = pm_cap; tp->rx_mode = TG3_DEF_RX_MODE; tp->tx_mode = TG3_DEF_TX_MODE; - tp->irq_sync = 1; if (tg3_debug > 0) tp->msg_enable = tg3_debug; diff --git a/trunk/drivers/net/ethernet/calxeda/xgmac.c b/trunk/drivers/net/ethernet/calxeda/xgmac.c index f7f02900f650..b407043ce9b0 100644 --- a/trunk/drivers/net/ethernet/calxeda/xgmac.c +++ b/trunk/drivers/net/ethernet/calxeda/xgmac.c @@ -548,10 +548,6 @@ static int desc_get_rx_status(struct xgmac_priv *priv, struct xgmac_dma_desc *p) return -1; } - /* All frames should fit into a single buffer */ - if (!(status & RXDESC_FIRST_SEG) || !(status & RXDESC_LAST_SEG)) - return -1; - /* Check if packet has checksum already */ if ((status & RXDESC_FRAME_TYPE) && (status & RXDESC_EXT_STATUS) && !(ext_status & RXDESC_IP_PAYLOAD_MASK)) diff --git a/trunk/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/trunk/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index c306df7d4568..f0718e1a8369 100644 --- a/trunk/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/trunk/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c @@ -1994,20 +1994,9 @@ static int set_coalesce(struct net_device *dev, struct ethtool_coalesce *c) { const struct port_info *pi = netdev_priv(dev); struct adapter *adap = pi->adapter; - struct sge_rspq *q; - int i; - int r = 0; - - for (i = pi->first_qset; i < pi->first_qset + pi->nqsets; i++) { - q = &adap->sge.ethrxq[i].rspq; - r = set_rxq_intr_params(adap, q, c->rx_coalesce_usecs, - c->rx_max_coalesced_frames); - if (r) { - dev_err(&dev->dev, "failed to set coalesce %d\n", r); - break; - } - } - return r; + + return set_rxq_intr_params(adap, &adap->sge.ethrxq[pi->first_qset].rspq, + c->rx_coalesce_usecs, c->rx_max_coalesced_frames); } static int get_coalesce(struct net_device *dev, struct ethtool_coalesce *c) diff --git a/trunk/drivers/net/ethernet/emulex/benet/be.h b/trunk/drivers/net/ethernet/emulex/benet/be.h index 4eba17b83ba8..3bc1912afba9 100644 --- a/trunk/drivers/net/ethernet/emulex/benet/be.h +++ b/trunk/drivers/net/ethernet/emulex/benet/be.h @@ -190,7 +190,6 @@ struct be_eq_obj { u8 idx; /* array index */ u16 tx_budget; - u16 spurious_intr; struct napi_struct napi; struct be_adapter *adapter; } ____cacheline_aligned_in_smp; diff --git a/trunk/drivers/net/ethernet/emulex/benet/be_main.c b/trunk/drivers/net/ethernet/emulex/benet/be_main.c index 5c995700e534..9dca22be8125 100644 --- a/trunk/drivers/net/ethernet/emulex/benet/be_main.c +++ b/trunk/drivers/net/ethernet/emulex/benet/be_main.c @@ -2026,30 +2026,19 @@ static irqreturn_t be_intx(int irq, void *dev) struct be_adapter *adapter = eqo->adapter; int num_evts = 0; - /* IRQ is not expected when NAPI is scheduled as the EQ - * will not be armed. - * But, this can happen on Lancer INTx where it takes - * a while to de-assert INTx or in BE2 where occasionaly - * an interrupt may be raised even when EQ is unarmed. - * If NAPI is already scheduled, then counting & notifying - * events will orphan them. + /* On Lancer, clear-intr bit of the EQ DB does not work. + * INTx is de-asserted only on notifying num evts. */ - if (napi_schedule_prep(&eqo->napi)) { + if (lancer_chip(adapter)) num_evts = events_get(eqo); - __napi_schedule(&eqo->napi); - if (num_evts) - eqo->spurious_intr = 0; - } - be_eq_notify(adapter, eqo->q.id, false, true, num_evts); - /* Return IRQ_HANDLED only for the the first spurious intr - * after a valid intr to stop the kernel from branding - * this irq as a bad one! + /* The EQ-notify may not de-assert INTx rightaway, causing + * the ISR to be invoked again. So, return HANDLED even when + * num_evts is zero. */ - if (num_evts || eqo->spurious_intr++ == 0) - return IRQ_HANDLED; - else - return IRQ_NONE; + be_eq_notify(adapter, eqo->q.id, false, true, num_evts); + napi_schedule(&eqo->napi); + return IRQ_HANDLED; } static irqreturn_t be_msix(int irq, void *dev) diff --git a/trunk/drivers/net/ethernet/intel/ixgbe/Makefile b/trunk/drivers/net/ethernet/intel/ixgbe/Makefile index 687c83d1bdab..f3a632bf8d96 100644 --- a/trunk/drivers/net/ethernet/intel/ixgbe/Makefile +++ b/trunk/drivers/net/ethernet/intel/ixgbe/Makefile @@ -32,7 +32,7 @@ obj-$(CONFIG_IXGBE) += ixgbe.o -ixgbe-objs := ixgbe_main.o ixgbe_common.o ixgbe_ethtool.o \ +ixgbe-objs := ixgbe_main.o ixgbe_common.o ixgbe_ethtool.o ixgbe_debugfs.o\ ixgbe_82599.o ixgbe_82598.o ixgbe_phy.o ixgbe_sriov.o \ ixgbe_mbx.o ixgbe_x540.o ixgbe_lib.o ixgbe_ptp.o @@ -40,5 +40,4 @@ ixgbe-$(CONFIG_IXGBE_DCB) += ixgbe_dcb.o ixgbe_dcb_82598.o \ ixgbe_dcb_82599.o ixgbe_dcb_nl.o ixgbe-$(CONFIG_IXGBE_HWMON) += ixgbe_sysfs.o -ixgbe-$(CONFIG_DEBUG_FS) += ixgbe_debugfs.o ixgbe-$(CONFIG_FCOE:m=y) += ixgbe_fcoe.o diff --git a/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_debugfs.c b/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_debugfs.c index 3504686d3af5..50aa546b8c7a 100644 --- a/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_debugfs.c +++ b/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_debugfs.c @@ -24,6 +24,9 @@ Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 *******************************************************************************/ + +#ifdef CONFIG_DEBUG_FS + #include #include @@ -274,3 +277,5 @@ void ixgbe_dbg_exit(void) { debugfs_remove_recursive(ixgbe_dbg_root); } + +#endif /* CONFIG_DEBUG_FS */ diff --git a/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c b/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c index bb9256a1b0a9..1a751c9d09c4 100644 --- a/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c +++ b/trunk/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c @@ -660,11 +660,11 @@ int ixgbe_ptp_hwtstamp_ioctl(struct ixgbe_adapter *adapter, break; case HWTSTAMP_FILTER_PTP_V1_L4_SYNC: tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_L4_V1; - tsync_rx_mtrl |= IXGBE_RXMTRL_V1_SYNC_MSG; + tsync_rx_mtrl = IXGBE_RXMTRL_V1_SYNC_MSG; break; case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ: tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_L4_V1; - tsync_rx_mtrl |= IXGBE_RXMTRL_V1_DELAY_REQ_MSG; + tsync_rx_mtrl = IXGBE_RXMTRL_V1_DELAY_REQ_MSG; break; case HWTSTAMP_FILTER_PTP_V2_EVENT: case HWTSTAMP_FILTER_PTP_V2_L2_EVENT: diff --git a/trunk/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/trunk/drivers/net/ethernet/mellanox/mlx4/en_tx.c index 6771b69f40d5..2b799f4f1c37 100644 --- a/trunk/drivers/net/ethernet/mellanox/mlx4/en_tx.c +++ b/trunk/drivers/net/ethernet/mellanox/mlx4/en_tx.c @@ -630,15 +630,10 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) ring->tx_csum++; } - if (mlx4_is_mfunc(mdev->dev) || priv->validate_loopback) { - /* Copy dst mac address to wqe. This allows loopback in eSwitch, - * so that VFs and PF can communicate with each other - */ - ethh = (struct ethhdr *)skb->data; - tx_desc->ctrl.srcrb_flags16[0] = get_unaligned((__be16 *)ethh->h_dest); - tx_desc->ctrl.imm = get_unaligned((__be32 *)(ethh->h_dest + 2)); - } - + /* Copy dst mac address to wqe */ + ethh = (struct ethhdr *)skb->data; + tx_desc->ctrl.srcrb_flags16[0] = get_unaligned((__be16 *)ethh->h_dest); + tx_desc->ctrl.imm = get_unaligned((__be32 *)(ethh->h_dest + 2)); /* Handle LSO (TSO) packets */ if (lso_header_size) { /* Mark opcode as LSO */ diff --git a/trunk/drivers/net/ethernet/mellanox/mlx4/main.c b/trunk/drivers/net/ethernet/mellanox/mlx4/main.c index a6542d75374c..e1bafffbc3b1 100644 --- a/trunk/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/trunk/drivers/net/ethernet/mellanox/mlx4/main.c @@ -1790,8 +1790,15 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev) int i; if (msi_x) { - nreq = min_t(int, dev->caps.num_eqs - dev->caps.reserved_eqs, - nreq); + /* In multifunction mode each function gets 2 msi-X vectors + * one for data path completions anf the other for asynch events + * or command completions */ + if (mlx4_is_mfunc(dev)) { + nreq = 2; + } else { + nreq = min_t(int, dev->caps.num_eqs - + dev->caps.reserved_eqs, nreq); + } entries = kcalloc(nreq, sizeof *entries, GFP_KERNEL); if (!entries) diff --git a/trunk/drivers/net/ethernet/nvidia/forcedeth.c b/trunk/drivers/net/ethernet/nvidia/forcedeth.c index 87fa5919c455..653487dc7b52 100644 --- a/trunk/drivers/net/ethernet/nvidia/forcedeth.c +++ b/trunk/drivers/net/ethernet/nvidia/forcedeth.c @@ -1821,11 +1821,6 @@ static int nv_alloc_rx(struct net_device *dev) skb->data, skb_tailroom(skb), PCI_DMA_FROMDEVICE); - if (pci_dma_mapping_error(np->pci_dev, - np->put_rx_ctx->dma)) { - kfree_skb(skb); - goto packet_dropped; - } np->put_rx_ctx->dma_len = skb_tailroom(skb); np->put_rx.orig->buf = cpu_to_le32(np->put_rx_ctx->dma); wmb(); @@ -1835,7 +1830,6 @@ static int nv_alloc_rx(struct net_device *dev) if (unlikely(np->put_rx_ctx++ == np->last_rx_ctx)) np->put_rx_ctx = np->first_rx_ctx; } else { -packet_dropped: u64_stats_update_begin(&np->swstats_rx_syncp); np->stat_rx_dropped++; u64_stats_update_end(&np->swstats_rx_syncp); @@ -1862,11 +1856,6 @@ static int nv_alloc_rx_optimized(struct net_device *dev) skb->data, skb_tailroom(skb), PCI_DMA_FROMDEVICE); - if (pci_dma_mapping_error(np->pci_dev, - np->put_rx_ctx->dma)) { - kfree_skb(skb); - goto packet_dropped; - } np->put_rx_ctx->dma_len = skb_tailroom(skb); np->put_rx.ex->bufhigh = cpu_to_le32(dma_high(np->put_rx_ctx->dma)); np->put_rx.ex->buflow = cpu_to_le32(dma_low(np->put_rx_ctx->dma)); @@ -1877,7 +1866,6 @@ static int nv_alloc_rx_optimized(struct net_device *dev) if (unlikely(np->put_rx_ctx++ == np->last_rx_ctx)) np->put_rx_ctx = np->first_rx_ctx; } else { -packet_dropped: u64_stats_update_begin(&np->swstats_rx_syncp); np->stat_rx_dropped++; u64_stats_update_end(&np->swstats_rx_syncp); @@ -2229,15 +2217,6 @@ static netdev_tx_t nv_start_xmit(struct sk_buff *skb, struct net_device *dev) bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size; np->put_tx_ctx->dma = pci_map_single(np->pci_dev, skb->data + offset, bcnt, PCI_DMA_TODEVICE); - if (pci_dma_mapping_error(np->pci_dev, - np->put_tx_ctx->dma)) { - /* on DMA mapping error - drop the packet */ - kfree_skb(skb); - u64_stats_update_begin(&np->swstats_tx_syncp); - np->stat_tx_dropped++; - u64_stats_update_end(&np->swstats_tx_syncp); - return NETDEV_TX_OK; - } np->put_tx_ctx->dma_len = bcnt; np->put_tx_ctx->dma_single = 1; put_tx->buf = cpu_to_le32(np->put_tx_ctx->dma); @@ -2358,15 +2337,6 @@ static netdev_tx_t nv_start_xmit_optimized(struct sk_buff *skb, bcnt = (size > NV_TX2_TSO_MAX_SIZE) ? NV_TX2_TSO_MAX_SIZE : size; np->put_tx_ctx->dma = pci_map_single(np->pci_dev, skb->data + offset, bcnt, PCI_DMA_TODEVICE); - if (pci_dma_mapping_error(np->pci_dev, - np->put_tx_ctx->dma)) { - /* on DMA mapping error - drop the packet */ - kfree_skb(skb); - u64_stats_update_begin(&np->swstats_tx_syncp); - np->stat_tx_dropped++; - u64_stats_update_end(&np->swstats_tx_syncp); - return NETDEV_TX_OK; - } np->put_tx_ctx->dma_len = bcnt; np->put_tx_ctx->dma_single = 1; put_tx->bufhigh = cpu_to_le32(dma_high(np->put_tx_ctx->dma)); @@ -5033,11 +5003,6 @@ static int nv_loopback_test(struct net_device *dev) test_dma_addr = pci_map_single(np->pci_dev, tx_skb->data, skb_tailroom(tx_skb), PCI_DMA_FROMDEVICE); - if (pci_dma_mapping_error(np->pci_dev, - test_dma_addr)) { - dev_kfree_skb_any(tx_skb); - goto out; - } pkt_data = skb_put(tx_skb, pkt_len); for (i = 0; i < pkt_len; i++) pkt_data[i] = (u8)(i & 0xff); diff --git a/trunk/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c b/trunk/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c index 695667d471a1..bc165f4d0f65 100644 --- a/trunk/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c +++ b/trunk/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c @@ -144,7 +144,7 @@ void netxen_release_tx_buffers(struct netxen_adapter *adapter) buffrag->length, PCI_DMA_TODEVICE); buffrag->dma = 0ULL; } - for (j = 1; j < cmd_buf->frag_count; j++) { + for (j = 0; j < cmd_buf->frag_count; j++) { buffrag++; if (buffrag->dma) { pci_unmap_page(adapter->pdev, buffrag->dma, diff --git a/trunk/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/trunk/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c index 69e321a65077..6098fd4adfeb 100644 --- a/trunk/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +++ b/trunk/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c @@ -1963,12 +1963,10 @@ netxen_map_tx_skb(struct pci_dev *pdev, while (--i >= 0) { nf = &pbuf->frag_array[i+1]; pci_unmap_page(pdev, nf->dma, nf->length, PCI_DMA_TODEVICE); - nf->dma = 0ULL; } nf = &pbuf->frag_array[0]; pci_unmap_single(pdev, nf->dma, skb_headlen(skb), PCI_DMA_TODEVICE); - nf->dma = 0ULL; out_err: return -ENOMEM; diff --git a/trunk/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/trunk/drivers/net/ethernet/qlogic/qlge/qlge_main.c index 3e73742024b0..f80cd975daed 100644 --- a/trunk/drivers/net/ethernet/qlogic/qlge/qlge_main.c +++ b/trunk/drivers/net/ethernet/qlogic/qlge/qlge_main.c @@ -4678,7 +4678,7 @@ static int qlge_probe(struct pci_dev *pdev, qdev = netdev_priv(ndev); SET_NETDEV_DEV(ndev, &pdev->dev); ndev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | - NETIF_F_TSO | NETIF_F_TSO_ECN | + NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN | NETIF_F_HW_VLAN_TX | NETIF_F_RXCSUM; ndev->features = ndev->hw_features | NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER; diff --git a/trunk/drivers/net/ethernet/realtek/r8169.c b/trunk/drivers/net/ethernet/realtek/r8169.c index 11702324a071..ed96f309bca8 100644 --- a/trunk/drivers/net/ethernet/realtek/r8169.c +++ b/trunk/drivers/net/ethernet/realtek/r8169.c @@ -1826,6 +1826,8 @@ static void rtl8169_rx_vlan_tag(struct RxDesc *desc, struct sk_buff *skb) if (opts2 & RxVlanTag) __vlan_hwaccel_put_tag(skb, swab16(opts2 & 0xffff)); + + desc->opts2 = 0; } static int rtl8169_gset_tbi(struct net_device *dev, struct ethtool_cmd *cmd) @@ -6062,6 +6064,8 @@ static int rtl_rx(struct net_device *dev, struct rtl8169_private *tp, u32 budget !(status & (RxRWT | RxFOVF)) && (dev->features & NETIF_F_RXALL)) goto process_pkt; + + rtl8169_mark_to_asic(desc, rx_buf_sz); } else { struct sk_buff *skb; dma_addr_t addr; @@ -6082,14 +6086,16 @@ static int rtl_rx(struct net_device *dev, struct rtl8169_private *tp, u32 budget if (unlikely(rtl8169_fragmented_frame(status))) { dev->stats.rx_dropped++; dev->stats.rx_length_errors++; - goto release_descriptor; + rtl8169_mark_to_asic(desc, rx_buf_sz); + continue; } skb = rtl8169_try_rx_copy(tp->Rx_databuff[entry], tp, pkt_size, addr); + rtl8169_mark_to_asic(desc, rx_buf_sz); if (!skb) { dev->stats.rx_dropped++; - goto release_descriptor; + continue; } rtl8169_rx_csum(skb, status); @@ -6105,10 +6111,13 @@ static int rtl_rx(struct net_device *dev, struct rtl8169_private *tp, u32 budget tp->rx_stats.bytes += pkt_size; u64_stats_update_end(&tp->rx_stats.syncp); } -release_descriptor: - desc->opts2 = 0; - wmb(); - rtl8169_mark_to_asic(desc, rx_buf_sz); + + /* Work around for AMD plateform. */ + if ((desc->opts2 & cpu_to_le32(0xfffe000)) && + (tp->mac_version == RTL_GIGA_MAC_VER_05)) { + desc->opts2 = 0; + cur_rx++; + } } count = cur_rx - tp->cur_rx; diff --git a/trunk/drivers/net/ethernet/xilinx/Kconfig b/trunk/drivers/net/ethernet/xilinx/Kconfig index 122d60c0481b..5778a4ae1164 100644 --- a/trunk/drivers/net/ethernet/xilinx/Kconfig +++ b/trunk/drivers/net/ethernet/xilinx/Kconfig @@ -27,7 +27,7 @@ config XILINX_EMACLITE config XILINX_AXI_EMAC tristate "Xilinx 10/100/1000 AXI Ethernet support" - depends on MICROBLAZE + depends on (PPC32 || MICROBLAZE) select PHYLIB ---help--- This driver supports the 10/100/1000 Ethernet from Xilinx for the diff --git a/trunk/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/trunk/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index 6f47100e58d7..d9f69b82cc4f 100644 --- a/trunk/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/trunk/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -1590,7 +1590,7 @@ static int axienet_of_probe(struct platform_device *op) lp->rx_irq = irq_of_parse_and_map(np, 1); lp->tx_irq = irq_of_parse_and_map(np, 0); of_node_put(np); - if ((lp->rx_irq <= 0) || (lp->tx_irq <= 0)) { + if ((lp->rx_irq == NO_IRQ) || (lp->tx_irq == NO_IRQ)) { dev_err(&op->dev, "could not determine irqs\n"); ret = -ENOMEM; goto err_iounmap_2; diff --git a/trunk/drivers/net/hyperv/hyperv_net.h b/trunk/drivers/net/hyperv/hyperv_net.h index e6fe0d80d612..5fd6f4674326 100644 --- a/trunk/drivers/net/hyperv/hyperv_net.h +++ b/trunk/drivers/net/hyperv/hyperv_net.h @@ -84,7 +84,7 @@ struct hv_netvsc_packet { }; struct netvsc_device_info { - unsigned char mac_adr[ETH_ALEN]; + unsigned char mac_adr[6]; bool link_state; /* 0 - link up, 1 - link down */ int ring_size; }; diff --git a/trunk/drivers/net/hyperv/netvsc_drv.c b/trunk/drivers/net/hyperv/netvsc_drv.c index 8264f0ef7692..f825a629a699 100644 --- a/trunk/drivers/net/hyperv/netvsc_drv.c +++ b/trunk/drivers/net/hyperv/netvsc_drv.c @@ -349,7 +349,7 @@ static int netvsc_set_mac_addr(struct net_device *ndev, void *p) struct net_device_context *ndevctx = netdev_priv(ndev); struct hv_device *hdev = ndevctx->device_ctx; struct sockaddr *addr = p; - char save_adr[ETH_ALEN]; + char save_adr[14]; unsigned char save_aatype; int err; diff --git a/trunk/drivers/net/loopback.c b/trunk/drivers/net/loopback.c index fcbf680c3e62..81f8f9e31db5 100644 --- a/trunk/drivers/net/loopback.c +++ b/trunk/drivers/net/loopback.c @@ -77,11 +77,6 @@ static netdev_tx_t loopback_xmit(struct sk_buff *skb, skb_orphan(skb); - /* Before queueing this packet to netif_rx(), - * make sure dst is refcounted. - */ - skb_dst_force(skb); - skb->protocol = eth_type_trans(skb, dev); /* it's OK to use per_cpu_ptr() because BHs are off */ diff --git a/trunk/drivers/net/macvlan.c b/trunk/drivers/net/macvlan.c index d3fb97d97cbc..68a43fe602e7 100644 --- a/trunk/drivers/net/macvlan.c +++ b/trunk/drivers/net/macvlan.c @@ -822,10 +822,7 @@ static int macvlan_changelink(struct net_device *dev, static size_t macvlan_get_size(const struct net_device *dev) { - return (0 - + nla_total_size(4) /* IFLA_MACVLAN_MODE */ - + nla_total_size(2) /* IFLA_MACVLAN_FLAGS */ - ); + return nla_total_size(4); } static int macvlan_fill_info(struct sk_buff *skb, diff --git a/trunk/drivers/net/phy/icplus.c b/trunk/drivers/net/phy/icplus.c index b5ddd5077a80..d5199cb4caec 100644 --- a/trunk/drivers/net/phy/icplus.c +++ b/trunk/drivers/net/phy/icplus.c @@ -36,9 +36,8 @@ MODULE_LICENSE("GPL"); /* IP101A/G - IP1001 */ #define IP10XX_SPEC_CTRL_STATUS 16 /* Spec. Control Register */ -#define IP1001_RXPHASE_SEL (1<<0) /* Add delay on RX_CLK */ -#define IP1001_TXPHASE_SEL (1<<1) /* Add delay on TX_CLK */ #define IP1001_SPEC_CTRL_STATUS_2 20 /* IP1001 Spec. Control Reg 2 */ +#define IP1001_PHASE_SEL_MASK 3 /* IP1001 RX/TXPHASE_SEL */ #define IP1001_APS_ON 11 /* IP1001 APS Mode bit */ #define IP101A_G_APS_ON 2 /* IP101A/G APS Mode bit */ #define IP101A_G_IRQ_CONF_STATUS 0x11 /* Conf Info IRQ & Status Reg */ @@ -139,24 +138,19 @@ static int ip1001_config_init(struct phy_device *phydev) if (c < 0) return c; - if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) || - (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) || - (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) || - (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)) { + /* INTR pin used: speed/link/duplex will cause an interrupt */ + c = phy_write(phydev, IP101A_G_IRQ_CONF_STATUS, IP101A_G_IRQ_DEFAULT); + if (c < 0) + return c; + if (phydev->interface == PHY_INTERFACE_MODE_RGMII) { + /* Additional delay (2ns) used to adjust RX clock phase + * at RGMII interface */ c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS); if (c < 0) return c; - c &= ~(IP1001_RXPHASE_SEL | IP1001_TXPHASE_SEL); - - if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) - c |= (IP1001_RXPHASE_SEL | IP1001_TXPHASE_SEL); - else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) - c |= IP1001_RXPHASE_SEL; - else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) - c |= IP1001_TXPHASE_SEL; - + c |= IP1001_PHASE_SEL_MASK; c = phy_write(phydev, IP10XX_SPEC_CTRL_STATUS, c); if (c < 0) return c; @@ -173,11 +167,6 @@ static int ip101a_g_config_init(struct phy_device *phydev) if (c < 0) return c; - /* INTR pin used: speed/link/duplex will cause an interrupt */ - c = phy_write(phydev, IP101A_G_IRQ_CONF_STATUS, IP101A_G_IRQ_DEFAULT); - if (c < 0) - return c; - /* Enable Auto Power Saving mode */ c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS); c |= IP101A_G_APS_ON; diff --git a/trunk/drivers/net/phy/marvell.c b/trunk/drivers/net/phy/marvell.c index 22dec9c7ef05..5d2a3f215887 100644 --- a/trunk/drivers/net/phy/marvell.c +++ b/trunk/drivers/net/phy/marvell.c @@ -353,6 +353,15 @@ static int m88e1111_config_init(struct phy_device *phydev) int err; int temp; + /* Enable Fiber/Copper auto selection */ + temp = phy_read(phydev, MII_M1111_PHY_EXT_SR); + temp &= ~MII_M1111_HWCFG_FIBER_COPPER_AUTO; + phy_write(phydev, MII_M1111_PHY_EXT_SR, temp); + + temp = phy_read(phydev, MII_BMCR); + temp |= BMCR_RESET; + phy_write(phydev, MII_BMCR, temp); + if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) || (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) || (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) || diff --git a/trunk/drivers/net/tun.c b/trunk/drivers/net/tun.c index cc09b67c23bc..fbd106edbe59 100644 --- a/trunk/drivers/net/tun.c +++ b/trunk/drivers/net/tun.c @@ -109,11 +109,11 @@ struct tap_filter { unsigned char addr[FLT_EXACT_COUNT][ETH_ALEN]; }; -/* DEFAULT_MAX_NUM_RSS_QUEUES were choosed to let the rx/tx queues allocated for - * the netdevice to be fit in one page. So we can make sure the success of - * memory allocation. TODO: increase the limit. */ -#define MAX_TAP_QUEUES DEFAULT_MAX_NUM_RSS_QUEUES -#define MAX_TAP_FLOWS 4096 +/* 1024 is probably a high enough limit: modern hypervisors seem to support on + * the order of 100-200 CPUs so this leaves us some breathing space if we want + * to match a queue per guest CPU. + */ +#define MAX_TAP_QUEUES 1024 #define TUN_FLOW_EXPIRE (3 * HZ) @@ -185,8 +185,6 @@ struct tun_struct { unsigned long ageing_time; unsigned int numdisabled; struct list_head disabled; - void *security; - u32 flow_count; }; static inline u32 tun_hashfn(u32 rxhash) @@ -220,7 +218,6 @@ static struct tun_flow_entry *tun_flow_create(struct tun_struct *tun, e->queue_index = queue_index; e->tun = tun; hlist_add_head_rcu(&e->hash_link, head); - ++tun->flow_count; } return e; } @@ -231,7 +228,6 @@ static void tun_flow_delete(struct tun_struct *tun, struct tun_flow_entry *e) e->rxhash, e->queue_index); hlist_del_rcu(&e->hash_link); kfree_rcu(e, rcu); - --tun->flow_count; } static void tun_flow_flush(struct tun_struct *tun) @@ -321,8 +317,7 @@ static void tun_flow_update(struct tun_struct *tun, u32 rxhash, e->updated = jiffies; } else { spin_lock_bh(&tun->lock); - if (!tun_flow_find(head, rxhash) && - tun->flow_count < MAX_TAP_FLOWS) + if (!tun_flow_find(head, rxhash)) tun_flow_create(tun, head, rxhash, queue_index); if (!timer_pending(&tun->flow_gc_timer)) @@ -409,8 +404,8 @@ static void __tun_detach(struct tun_file *tfile, bool clean) struct tun_struct *tun; struct net_device *dev; - tun = rtnl_dereference(tfile->tun); - + tun = rcu_dereference_protected(tfile->tun, + lockdep_rtnl_is_held()); if (tun) { u16 index = tfile->queue_index; BUG_ON(index >= tun->numqueues); @@ -419,7 +414,8 @@ static void __tun_detach(struct tun_file *tfile, bool clean) rcu_assign_pointer(tun->tfiles[index], tun->tfiles[tun->numqueues - 1]); rcu_assign_pointer(tfile->tun, NULL); - ntfile = rtnl_dereference(tun->tfiles[index]); + ntfile = rcu_dereference_protected(tun->tfiles[index], + lockdep_rtnl_is_held()); ntfile->queue_index = index; --tun->numqueues; @@ -433,10 +429,8 @@ static void __tun_detach(struct tun_file *tfile, bool clean) /* Drop read queue */ skb_queue_purge(&tfile->sk.sk_receive_queue); tun_set_real_num_queues(tun); - } else if (tfile->detached && clean) { + } else if (tfile->detached && clean) tun = tun_enable_queue(tfile); - sock_put(&tfile->sk); - } if (clean) { if (tun && tun->numqueues == 0 && tun->numdisabled == 0 && @@ -464,7 +458,8 @@ static void tun_detach_all(struct net_device *dev) int i, n = tun->numqueues; for (i = 0; i < n; i++) { - tfile = rtnl_dereference(tun->tfiles[i]); + tfile = rcu_dereference_protected(tun->tfiles[i], + lockdep_rtnl_is_held()); BUG_ON(!tfile); wake_up_all(&tfile->wq.wait); rcu_assign_pointer(tfile->tun, NULL); @@ -474,7 +469,8 @@ static void tun_detach_all(struct net_device *dev) synchronize_net(); for (i = 0; i < n; i++) { - tfile = rtnl_dereference(tun->tfiles[i]); + tfile = rcu_dereference_protected(tun->tfiles[i], + lockdep_rtnl_is_held()); /* Drop read queue */ skb_queue_purge(&tfile->sk.sk_receive_queue); sock_put(&tfile->sk); @@ -485,9 +481,6 @@ static void tun_detach_all(struct net_device *dev) sock_put(&tfile->sk); } BUG_ON(tun->numdisabled != 0); - - if (tun->flags & TUN_PERSIST) - module_put(THIS_MODULE); } static int tun_attach(struct tun_struct *tun, struct file *file) @@ -495,12 +488,8 @@ static int tun_attach(struct tun_struct *tun, struct file *file) struct tun_file *tfile = file->private_data; int err; - err = security_tun_dev_attach(tfile->socket.sk, tun->security); - if (err < 0) - goto out; - err = -EINVAL; - if (rtnl_dereference(tfile->tun)) + if (rcu_dereference_protected(tfile->tun, lockdep_rtnl_is_held())) goto out; err = -EBUSY; @@ -1382,7 +1371,6 @@ static void tun_free_netdev(struct net_device *dev) BUG_ON(!(list_empty(&tun->disabled))); tun_flow_uninit(tun); - security_tun_dev_free_security(tun->security); free_netdev(dev); } @@ -1556,9 +1544,6 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) struct net_device *dev; int err; - if (tfile->detached) - return -EINVAL; - dev = __dev_get_by_name(net, ifr->ifr_name); if (dev) { if (ifr->ifr_flags & IFF_TUN_EXCL) @@ -1572,7 +1557,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) if (tun_not_capable(tun)) return -EPERM; - err = security_tun_dev_open(tun->security); + err = security_tun_dev_attach(tfile->socket.sk); if (err < 0) return err; @@ -1587,8 +1572,6 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) else { char *name; unsigned long flags = 0; - int queues = ifr->ifr_flags & IFF_MULTI_QUEUE ? - MAX_TAP_QUEUES : 1; if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) return -EPERM; @@ -1612,8 +1595,8 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) name = ifr->ifr_name; dev = alloc_netdev_mqs(sizeof(struct tun_struct), name, - tun_setup, queues, queues); - + tun_setup, + MAX_TAP_QUEUES, MAX_TAP_QUEUES); if (!dev) return -ENOMEM; @@ -1631,9 +1614,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) spin_lock_init(&tun->lock); - err = security_tun_dev_alloc_security(&tun->security); - if (err < 0) - goto err_free_dev; + security_tun_dev_post_create(&tfile->sk); tun_net_init(dev); @@ -1757,7 +1738,8 @@ static void tun_detach_filter(struct tun_struct *tun, int n) struct tun_file *tfile; for (i = 0; i < n; i++) { - tfile = rtnl_dereference(tun->tfiles[i]); + tfile = rcu_dereference_protected(tun->tfiles[i], + lockdep_rtnl_is_held()); sk_detach_filter(tfile->socket.sk); } @@ -1770,7 +1752,8 @@ static int tun_attach_filter(struct tun_struct *tun) struct tun_file *tfile; for (i = 0; i < tun->numqueues; i++) { - tfile = rtnl_dereference(tun->tfiles[i]); + tfile = rcu_dereference_protected(tun->tfiles[i], + lockdep_rtnl_is_held()); ret = sk_attach_filter(&tun->fprog, tfile->socket.sk); if (ret) { tun_detach_filter(tun, i); @@ -1788,7 +1771,8 @@ static void tun_set_sndbuf(struct tun_struct *tun) int i; for (i = 0; i < tun->numqueues; i++) { - tfile = rtnl_dereference(tun->tfiles[i]); + tfile = rcu_dereference_protected(tun->tfiles[i], + lockdep_rtnl_is_held()); tfile->socket.sk->sk_sndbuf = tun->sndbuf; } } @@ -1803,16 +1787,15 @@ static int tun_set_queue(struct file *file, struct ifreq *ifr) if (ifr->ifr_flags & IFF_ATTACH_QUEUE) { tun = tfile->detached; - if (!tun) { + if (!tun) ret = -EINVAL; - goto unlock; - } - ret = security_tun_dev_attach_queue(tun->security); - if (ret < 0) - goto unlock; - ret = tun_attach(tun, file); + else if (tun_not_capable(tun)) + ret = -EPERM; + else + ret = tun_attach(tun, file); } else if (ifr->ifr_flags & IFF_DETACH_QUEUE) { - tun = rtnl_dereference(tfile->tun); + tun = rcu_dereference_protected(tfile->tun, + lockdep_rtnl_is_held()); if (!tun || !(tun->flags & TUN_TAP_MQ)) ret = -EINVAL; else @@ -1820,7 +1803,6 @@ static int tun_set_queue(struct file *file, struct ifreq *ifr) } else ret = -EINVAL; -unlock: rtnl_unlock(); return ret; } @@ -1898,11 +1880,10 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, /* Disable/Enable persist mode. Keep an extra reference to the * module to prevent the module being unprobed. */ - if (arg && !(tun->flags & TUN_PERSIST)) { + if (arg) { tun->flags |= TUN_PERSIST; __module_get(THIS_MODULE); - } - if (!arg && (tun->flags & TUN_PERSIST)) { + } else { tun->flags &= ~TUN_PERSIST; module_put(THIS_MODULE); } diff --git a/trunk/drivers/net/usb/cdc_mbim.c b/trunk/drivers/net/usb/cdc_mbim.c index 248d2dc765a5..42f51c71ec1f 100644 --- a/trunk/drivers/net/usb/cdc_mbim.c +++ b/trunk/drivers/net/usb/cdc_mbim.c @@ -374,21 +374,6 @@ static const struct driver_info cdc_mbim_info = { .tx_fixup = cdc_mbim_tx_fixup, }; -/* MBIM and NCM devices should not need a ZLP after NTBs with - * dwNtbOutMaxSize length. This driver_info is for the exceptional - * devices requiring it anyway, allowing them to be supported without - * forcing the performance penalty on all the sane devices. - */ -static const struct driver_info cdc_mbim_info_zlp = { - .description = "CDC MBIM", - .flags = FLAG_NO_SETINT | FLAG_MULTI_PACKET | FLAG_WWAN | FLAG_SEND_ZLP, - .bind = cdc_mbim_bind, - .unbind = cdc_mbim_unbind, - .manage_power = cdc_mbim_manage_power, - .rx_fixup = cdc_mbim_rx_fixup, - .tx_fixup = cdc_mbim_tx_fixup, -}; - static const struct usb_device_id mbim_devs[] = { /* This duplicate NCM entry is intentional. MBIM devices can * be disguised as NCM by default, and this is necessary to @@ -400,10 +385,6 @@ static const struct usb_device_id mbim_devs[] = { { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE), .driver_info = (unsigned long)&cdc_mbim_info, }, - /* Sierra Wireless MC7710 need ZLPs */ - { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x68a2, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE), - .driver_info = (unsigned long)&cdc_mbim_info_zlp, - }, { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE), .driver_info = (unsigned long)&cdc_mbim_info, }, diff --git a/trunk/drivers/net/usb/cdc_ncm.c b/trunk/drivers/net/usb/cdc_ncm.c index 9197b2c72ca3..71b6e92b8e9b 100644 --- a/trunk/drivers/net/usb/cdc_ncm.c +++ b/trunk/drivers/net/usb/cdc_ncm.c @@ -435,13 +435,6 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_ len -= temp; } - /* some buggy devices have an IAD but no CDC Union */ - if (!ctx->union_desc && intf->intf_assoc && intf->intf_assoc->bInterfaceCount == 2) { - ctx->control = intf; - ctx->data = usb_ifnum_to_if(dev->udev, intf->cur_altsetting->desc.bInterfaceNumber + 1); - dev_dbg(&intf->dev, "CDC Union missing - got slave from IAD\n"); - } - /* check if we got everything */ if ((ctx->control == NULL) || (ctx->data == NULL) || ((!ctx->mbim_desc) && ((ctx->ether_desc == NULL) || (ctx->control != intf)))) @@ -504,8 +497,7 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_ error2: usb_set_intfdata(ctx->control, NULL); usb_set_intfdata(ctx->data, NULL); - if (ctx->data != ctx->control) - usb_driver_release_interface(driver, ctx->data); + usb_driver_release_interface(driver, ctx->data); error: cdc_ncm_free((struct cdc_ncm_ctx *)dev->data[0]); dev->data[0] = 0; @@ -1163,20 +1155,6 @@ static const struct driver_info wwan_info = { .tx_fixup = cdc_ncm_tx_fixup, }; -/* Same as wwan_info, but with FLAG_NOARP */ -static const struct driver_info wwan_noarp_info = { - .description = "Mobile Broadband Network Device (NO ARP)", - .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET - | FLAG_WWAN | FLAG_NOARP, - .bind = cdc_ncm_bind, - .unbind = cdc_ncm_unbind, - .check_connect = cdc_ncm_check_connect, - .manage_power = usbnet_manage_power, - .status = cdc_ncm_status, - .rx_fixup = cdc_ncm_rx_fixup, - .tx_fixup = cdc_ncm_tx_fixup, -}; - static const struct usb_device_id cdc_devs[] = { /* Ericsson MBM devices like F5521gw */ { .match_flags = USB_DEVICE_ID_MATCH_INT_INFO @@ -1216,13 +1194,6 @@ static const struct usb_device_id cdc_devs[] = { .driver_info = (unsigned long)&wwan_info, }, - /* Infineon(now Intel) HSPA Modem platform */ - { USB_DEVICE_AND_INTERFACE_INFO(0x1519, 0x0443, - USB_CLASS_COMM, - USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE), - .driver_info = (unsigned long)&wwan_noarp_info, - }, - /* Generic CDC-NCM devices */ { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE), diff --git a/trunk/drivers/net/usb/dm9601.c b/trunk/drivers/net/usb/dm9601.c index d7e99445518e..3f554c1149f3 100644 --- a/trunk/drivers/net/usb/dm9601.c +++ b/trunk/drivers/net/usb/dm9601.c @@ -45,12 +45,6 @@ #define DM_MCAST_ADDR 0x16 /* 8 bytes */ #define DM_GPR_CTRL 0x1e #define DM_GPR_DATA 0x1f -#define DM_CHIP_ID 0x2c -#define DM_MODE_CTRL 0x91 /* only on dm9620 */ - -/* chip id values */ -#define ID_DM9601 0 -#define ID_DM9620 1 #define DM_MAX_MCAST 64 #define DM_MCAST_SIZE 8 @@ -59,6 +53,7 @@ #define DM_RX_OVERHEAD 7 /* 3 byte header + 4 byte crc tail */ #define DM_TIMEOUT 1000 + static int dm_read(struct usbnet *dev, u8 reg, u16 length, void *data) { int err; @@ -89,23 +84,32 @@ static int dm_write(struct usbnet *dev, u8 reg, u16 length, void *data) static int dm_write_reg(struct usbnet *dev, u8 reg, u8 value) { - return usbnet_write_cmd(dev, DM_WRITE_REG, + return usbnet_write_cmd(dev, DM_WRITE_REGS, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, value, reg, NULL, 0); } -static void dm_write_async(struct usbnet *dev, u8 reg, u16 length, void *data) +static void dm_write_async_helper(struct usbnet *dev, u8 reg, u8 value, + u16 length, void *data) { usbnet_write_cmd_async(dev, DM_WRITE_REGS, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - 0, reg, data, length); + value, reg, data, length); +} + +static void dm_write_async(struct usbnet *dev, u8 reg, u16 length, void *data) +{ + netdev_dbg(dev->net, "dm_write_async() reg=0x%02x length=%d\n", reg, length); + + dm_write_async_helper(dev, reg, 0, length, data); } static void dm_write_reg_async(struct usbnet *dev, u8 reg, u8 value) { - usbnet_write_cmd_async(dev, DM_WRITE_REG, - USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - value, reg, NULL, 0); + netdev_dbg(dev->net, "dm_write_reg_async() reg=0x%02x value=0x%02x\n", + reg, value); + + dm_write_async_helper(dev, reg, value, 0, NULL); } static int dm_read_shared_word(struct usbnet *dev, int phy, u8 reg, __le16 *value) @@ -354,7 +358,7 @@ static const struct net_device_ops dm9601_netdev_ops = { static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf) { int ret; - u8 mac[ETH_ALEN], id; + u8 mac[ETH_ALEN]; ret = usbnet_get_endpoints(dev, intf); if (ret) @@ -395,24 +399,6 @@ static int dm9601_bind(struct usbnet *dev, struct usb_interface *intf) __dm9601_set_mac_address(dev); } - if (dm_read_reg(dev, DM_CHIP_ID, &id) < 0) { - netdev_err(dev->net, "Error reading chip ID\n"); - ret = -ENODEV; - goto out; - } - - /* put dm9620 devices in dm9601 mode */ - if (id == ID_DM9620) { - u8 mode; - - if (dm_read_reg(dev, DM_MODE_CTRL, &mode) < 0) { - netdev_err(dev->net, "Error reading MODE_CTRL\n"); - ret = -ENODEV; - goto out; - } - dm_write_reg(dev, DM_MODE_CTRL, mode & 0x7f); - } - /* power up phy */ dm_write_reg(dev, DM_GPR_CTRL, 1); dm_write_reg(dev, DM_GPR_DATA, 0); @@ -595,10 +581,6 @@ static const struct usb_device_id products[] = { USB_DEVICE(0x0a46, 0x9000), /* DM9000E */ .driver_info = (unsigned long)&dm9601_info, }, - { - USB_DEVICE(0x0a46, 0x9620), /* DM9620 USB to Fast Ethernet Adapter */ - .driver_info = (unsigned long)&dm9601_info, - }, {}, // END }; diff --git a/trunk/drivers/net/usb/qmi_wwan.c b/trunk/drivers/net/usb/qmi_wwan.c index 575a5839ee34..91d7cb9728eb 100644 --- a/trunk/drivers/net/usb/qmi_wwan.c +++ b/trunk/drivers/net/usb/qmi_wwan.c @@ -433,7 +433,6 @@ static const struct usb_device_id products[] = { {QMI_FIXED_INTF(0x19d2, 0x0199, 1)}, /* ZTE MF820S */ {QMI_FIXED_INTF(0x19d2, 0x0200, 1)}, {QMI_FIXED_INTF(0x19d2, 0x0257, 3)}, /* ZTE MF821 */ - {QMI_FIXED_INTF(0x19d2, 0x0265, 4)}, /* ONDA MT8205 4G LTE */ {QMI_FIXED_INTF(0x19d2, 0x0284, 4)}, /* ZTE MF880 */ {QMI_FIXED_INTF(0x19d2, 0x0326, 4)}, /* ZTE MF821D */ {QMI_FIXED_INTF(0x19d2, 0x1008, 4)}, /* ZTE (Vodafone) K3570-Z */ @@ -459,8 +458,6 @@ static const struct usb_device_id products[] = { {QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */ {QMI_FIXED_INTF(0x1199, 0x68a2, 19)}, /* Sierra Wireless MC7710 in QMI mode */ {QMI_FIXED_INTF(0x1199, 0x901c, 8)}, /* Sierra Wireless EM7700 */ - {QMI_FIXED_INTF(0x1bbb, 0x011e, 4)}, /* Telekom Speedstick LTE II (Alcatel One Touch L100V LTE) */ - {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ /* 4. Gobi 1000 devices */ {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ diff --git a/trunk/drivers/net/usb/usbnet.c b/trunk/drivers/net/usb/usbnet.c index f34b2ebee815..3d4bf01641b4 100644 --- a/trunk/drivers/net/usb/usbnet.c +++ b/trunk/drivers/net/usb/usbnet.c @@ -1448,10 +1448,6 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) if ((dev->driver_info->flags & FLAG_WWAN) != 0) strcpy(net->name, "wwan%d"); - /* devices that cannot do ARP */ - if ((dev->driver_info->flags & FLAG_NOARP) != 0) - net->flags |= IFF_NOARP; - /* maybe the remote can't receive an Ethernet MTU */ if (net->mtu > (dev->hard_mtu - net->hard_header_len)) net->mtu = dev->hard_mtu - net->hard_header_len; diff --git a/trunk/drivers/net/virtio_net.c b/trunk/drivers/net/virtio_net.c index 35c00c5ea02a..a6fcf15adc4f 100644 --- a/trunk/drivers/net/virtio_net.c +++ b/trunk/drivers/net/virtio_net.c @@ -26,7 +26,6 @@ #include #include #include -#include static int napi_weight = 128; module_param(napi_weight, int, 0444); @@ -124,12 +123,6 @@ struct virtnet_info { /* Does the affinity hint is set for virtqueues? */ bool affinity_hint_set; - - /* Per-cpu variable to show the mapping from CPU to virtqueue */ - int __percpu *vq_index; - - /* CPU hot plug notifier */ - struct notifier_block nb; }; struct skb_vnet_hdr { @@ -1020,75 +1013,32 @@ static int virtnet_vlan_rx_kill_vid(struct net_device *dev, u16 vid) return 0; } -static void virtnet_clean_affinity(struct virtnet_info *vi, long hcpu) +static void virtnet_set_affinity(struct virtnet_info *vi, bool set) { int i; - int cpu; - - if (vi->affinity_hint_set) { - for (i = 0; i < vi->max_queue_pairs; i++) { - virtqueue_set_affinity(vi->rq[i].vq, -1); - virtqueue_set_affinity(vi->sq[i].vq, -1); - } - - vi->affinity_hint_set = false; - } - - i = 0; - for_each_online_cpu(cpu) { - if (cpu == hcpu) { - *per_cpu_ptr(vi->vq_index, cpu) = -1; - } else { - *per_cpu_ptr(vi->vq_index, cpu) = - ++i % vi->curr_queue_pairs; - } - } -} - -static void virtnet_set_affinity(struct virtnet_info *vi) -{ - int i; - int cpu; /* In multiqueue mode, when the number of cpu is equal to the number of * queue pairs, we let the queue pairs to be private to one cpu by * setting the affinity hint to eliminate the contention. */ - if (vi->curr_queue_pairs == 1 || - vi->max_queue_pairs != num_online_cpus()) { - virtnet_clean_affinity(vi, -1); - return; + if ((vi->curr_queue_pairs == 1 || + vi->max_queue_pairs != num_online_cpus()) && set) { + if (vi->affinity_hint_set) + set = false; + else + return; } - i = 0; - for_each_online_cpu(cpu) { + for (i = 0; i < vi->max_queue_pairs; i++) { + int cpu = set ? i : -1; virtqueue_set_affinity(vi->rq[i].vq, cpu); virtqueue_set_affinity(vi->sq[i].vq, cpu); - *per_cpu_ptr(vi->vq_index, cpu) = i; - i++; } - vi->affinity_hint_set = true; -} - -static int virtnet_cpu_callback(struct notifier_block *nfb, - unsigned long action, void *hcpu) -{ - struct virtnet_info *vi = container_of(nfb, struct virtnet_info, nb); - - switch(action & ~CPU_TASKS_FROZEN) { - case CPU_ONLINE: - case CPU_DOWN_FAILED: - case CPU_DEAD: - virtnet_set_affinity(vi); - break; - case CPU_DOWN_PREPARE: - virtnet_clean_affinity(vi, (long)hcpu); - break; - default: - break; - } - return NOTIFY_OK; + if (set) + vi->affinity_hint_set = true; + else + vi->affinity_hint_set = false; } static void virtnet_get_ringparam(struct net_device *dev, @@ -1132,15 +1082,13 @@ static int virtnet_set_channels(struct net_device *dev, if (queue_pairs > vi->max_queue_pairs) return -EINVAL; - get_online_cpus(); err = virtnet_set_queues(vi, queue_pairs); if (!err) { netif_set_real_num_tx_queues(dev, queue_pairs); netif_set_real_num_rx_queues(dev, queue_pairs); - virtnet_set_affinity(vi); + virtnet_set_affinity(vi, true); } - put_online_cpus(); return err; } @@ -1179,19 +1127,12 @@ static int virtnet_change_mtu(struct net_device *dev, int new_mtu) /* To avoid contending a lock hold by a vcpu who would exit to host, select the * txq based on the processor id. + * TODO: handle cpu hotplug. */ static u16 virtnet_select_queue(struct net_device *dev, struct sk_buff *skb) { - int txq; - struct virtnet_info *vi = netdev_priv(dev); - - if (skb_rx_queue_recorded(skb)) { - txq = skb_get_rx_queue(skb); - } else { - txq = *__this_cpu_ptr(vi->vq_index); - if (txq == -1) - txq = 0; - } + int txq = skb_rx_queue_recorded(skb) ? skb_get_rx_queue(skb) : + smp_processor_id(); while (unlikely(txq >= dev->real_num_tx_queues)) txq -= dev->real_num_tx_queues; @@ -1307,7 +1248,7 @@ static void virtnet_del_vqs(struct virtnet_info *vi) { struct virtio_device *vdev = vi->vdev; - virtnet_clean_affinity(vi, -1); + virtnet_set_affinity(vi, false); vdev->config->del_vqs(vdev); @@ -1430,10 +1371,7 @@ static int init_vqs(struct virtnet_info *vi) if (ret) goto err_free; - get_online_cpus(); - virtnet_set_affinity(vi); - put_online_cpus(); - + virtnet_set_affinity(vi, true); return 0; err_free: @@ -1515,10 +1453,6 @@ static int virtnet_probe(struct virtio_device *vdev) if (vi->stats == NULL) goto free; - vi->vq_index = alloc_percpu(int); - if (vi->vq_index == NULL) - goto free_stats; - mutex_init(&vi->config_lock); vi->config_enable = true; INIT_WORK(&vi->config_work, virtnet_config_changed_work); @@ -1542,7 +1476,7 @@ static int virtnet_probe(struct virtio_device *vdev) /* Allocate/initialize the rx/tx queues, and invoke find_vqs */ err = init_vqs(vi); if (err) - goto free_index; + goto free_stats; netif_set_real_num_tx_queues(dev, 1); netif_set_real_num_rx_queues(dev, 1); @@ -1565,13 +1499,6 @@ static int virtnet_probe(struct virtio_device *vdev) } } - vi->nb.notifier_call = &virtnet_cpu_callback; - err = register_hotcpu_notifier(&vi->nb); - if (err) { - pr_debug("virtio_net: registering cpu notifier failed\n"); - goto free_recv_bufs; - } - /* Assume link up if device can't report link status, otherwise get link status from config. */ if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_STATUS)) { @@ -1593,8 +1520,6 @@ static int virtnet_probe(struct virtio_device *vdev) free_vqs: cancel_delayed_work_sync(&vi->refill); virtnet_del_vqs(vi); -free_index: - free_percpu(vi->vq_index); free_stats: free_percpu(vi->stats); free: @@ -1618,8 +1543,6 @@ static void virtnet_remove(struct virtio_device *vdev) { struct virtnet_info *vi = vdev->priv; - unregister_hotcpu_notifier(&vi->nb); - /* Prevent config work handler from accessing the device. */ mutex_lock(&vi->config_lock); vi->config_enable = false; @@ -1631,7 +1554,6 @@ static void virtnet_remove(struct virtio_device *vdev) flush_work(&vi->config_work); - free_percpu(vi->vq_index); free_percpu(vi->stats); free_netdev(vi->dev); } diff --git a/trunk/drivers/net/vxlan.c b/trunk/drivers/net/vxlan.c index 656230e0d18c..40f2cc135a49 100644 --- a/trunk/drivers/net/vxlan.c +++ b/trunk/drivers/net/vxlan.c @@ -1191,7 +1191,6 @@ static void vxlan_setup(struct net_device *dev) dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM; dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; - dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; spin_lock_init(&vxlan->hash_lock); diff --git a/trunk/drivers/net/wireless/ath/Kconfig b/trunk/drivers/net/wireless/ath/Kconfig index 2c02b4e84094..1a67a4f829fe 100644 --- a/trunk/drivers/net/wireless/ath/Kconfig +++ b/trunk/drivers/net/wireless/ath/Kconfig @@ -30,6 +30,5 @@ source "drivers/net/wireless/ath/ath9k/Kconfig" source "drivers/net/wireless/ath/carl9170/Kconfig" source "drivers/net/wireless/ath/ath6kl/Kconfig" source "drivers/net/wireless/ath/ar5523/Kconfig" -source "drivers/net/wireless/ath/wil6210/Kconfig" endif diff --git a/trunk/drivers/net/wireless/ath/Makefile b/trunk/drivers/net/wireless/ath/Makefile index 97b964ded2be..1e18621326dc 100644 --- a/trunk/drivers/net/wireless/ath/Makefile +++ b/trunk/drivers/net/wireless/ath/Makefile @@ -3,7 +3,6 @@ obj-$(CONFIG_ATH9K_HW) += ath9k/ obj-$(CONFIG_CARL9170) += carl9170/ obj-$(CONFIG_ATH6KL) += ath6kl/ obj-$(CONFIG_AR5523) += ar5523/ -obj-$(CONFIG_WIL6210) += wil6210/ obj-$(CONFIG_ATH_COMMON) += ath.o diff --git a/trunk/drivers/net/wireless/ath/ath9k/Kconfig b/trunk/drivers/net/wireless/ath/ath9k/Kconfig index 7647ed6b73d7..5fc15bf8be09 100644 --- a/trunk/drivers/net/wireless/ath/ath9k/Kconfig +++ b/trunk/drivers/net/wireless/ath/ath9k/Kconfig @@ -2,7 +2,6 @@ config ATH9K_HW tristate config ATH9K_COMMON tristate - select ATH_COMMON config ATH9K_DFS_DEBUGFS def_bool y depends on ATH9K_DEBUGFS && ATH9K_DFS_CERTIFIED @@ -18,6 +17,7 @@ config ATH9K_BTCOEX_SUPPORT config ATH9K tristate "Atheros 802.11n wireless cards support" depends on MAC80211 + select ATH_COMMON select ATH9K_HW select MAC80211_LEDS select LEDS_CLASS @@ -56,8 +56,7 @@ config ATH9K_AHB config ATH9K_DEBUGFS bool "Atheros ath9k debugging" - depends on ATH9K - select MAC80211_DEBUGFS + depends on ATH9K && DEBUG_FS ---help--- Say Y, if you need access to ath9k's statistics for interrupts, rate control, etc. diff --git a/trunk/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/trunk/drivers/net/wireless/ath/ath9k/ar9003_calib.c index 56317b0fb6b6..8b0d8dcd7625 100644 --- a/trunk/drivers/net/wireless/ath/ath9k/ar9003_calib.c +++ b/trunk/drivers/net/wireless/ath/ath9k/ar9003_calib.c @@ -976,8 +976,6 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah, AR_PHY_CL_TAB_1, AR_PHY_CL_TAB_2 }; - ar9003_hw_set_chain_masks(ah, ah->caps.rx_chainmask, ah->caps.tx_chainmask); - if (rtt) { if (!ar9003_hw_rtt_restore(ah, chan)) run_rtt_cal = true; diff --git a/trunk/drivers/net/wireless/ath/ath9k/ar9003_hw.c b/trunk/drivers/net/wireless/ath/ath9k/ar9003_hw.c index 59bf5f31e212..74fd3977feeb 100644 --- a/trunk/drivers/net/wireless/ath/ath9k/ar9003_hw.c +++ b/trunk/drivers/net/wireless/ath/ath9k/ar9003_hw.c @@ -544,7 +544,7 @@ static void ar9003_rx_gain_table_mode0(struct ath_hw *ah) ar9340Common_rx_gain_table_1p0); else if (AR_SREV_9485_11(ah)) INIT_INI_ARRAY(&ah->iniModesRxGain, - ar9485_common_rx_gain_1_1); + ar9485Common_wo_xlna_rx_gain_1_1); else if (AR_SREV_9550(ah)) { INIT_INI_ARRAY(&ah->iniModesRxGain, ar955x_1p0_common_rx_gain_table); diff --git a/trunk/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/trunk/drivers/net/wireless/ath/ath9k/ar9003_phy.c index 3afc24bde6d6..ce19c09fa8e8 100644 --- a/trunk/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/trunk/drivers/net/wireless/ath/ath9k/ar9003_phy.c @@ -586,19 +586,32 @@ static void ar9003_hw_init_bb(struct ath_hw *ah, ath9k_hw_synth_delay(ah, chan, synthDelay); } -void ar9003_hw_set_chain_masks(struct ath_hw *ah, u8 rx, u8 tx) +static void ar9003_hw_set_chain_masks(struct ath_hw *ah, u8 rx, u8 tx) { - if (ah->caps.tx_chainmask == 5 || ah->caps.rx_chainmask == 5) + switch (rx) { + case 0x5: REG_SET_BIT(ah, AR_PHY_ANALOG_SWAP, AR_PHY_SWAP_ALT_CHAIN); - - REG_WRITE(ah, AR_PHY_RX_CHAINMASK, rx); - REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, rx); + case 0x3: + case 0x1: + case 0x2: + case 0x7: + REG_WRITE(ah, AR_PHY_RX_CHAINMASK, rx); + REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, rx); + break; + default: + break; + } if ((ah->caps.hw_caps & ATH9K_HW_CAP_APM) && (tx == 0x7)) - tx = 3; + REG_WRITE(ah, AR_SELFGEN_MASK, 0x3); + else + REG_WRITE(ah, AR_SELFGEN_MASK, tx); - REG_WRITE(ah, AR_SELFGEN_MASK, tx); + if (tx == 0x5) { + REG_SET_BIT(ah, AR_PHY_ANALOG_SWAP, + AR_PHY_SWAP_ALT_CHAIN); + } } /* diff --git a/trunk/drivers/net/wireless/ath/ath9k/ath9k.h b/trunk/drivers/net/wireless/ath/ath9k/ath9k.h index 42794c546a40..86e26a19efda 100644 --- a/trunk/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/trunk/drivers/net/wireless/ath/ath9k/ath9k.h @@ -317,6 +317,7 @@ struct ath_rx { u32 *rxlink; u32 num_pkts; unsigned int rxfilter; + spinlock_t rxbuflock; struct list_head rxbuf; struct ath_descdma rxdma; struct ath_buf *rx_bufptr; @@ -327,6 +328,7 @@ struct ath_rx { int ath_startrecv(struct ath_softc *sc); bool ath_stoprecv(struct ath_softc *sc); +void ath_flushrecv(struct ath_softc *sc); u32 ath_calcrxfilter(struct ath_softc *sc); int ath_rx_init(struct ath_softc *sc, int nbufs); void ath_rx_cleanup(struct ath_softc *sc); @@ -644,6 +646,7 @@ void ath_ant_comb_update(struct ath_softc *sc); enum sc_op_flags { SC_OP_INVALID, SC_OP_BEACONS, + SC_OP_RXFLUSH, SC_OP_ANI_RUN, SC_OP_PRIM_STA_VIF, SC_OP_HW_RESET, diff --git a/trunk/drivers/net/wireless/ath/ath9k/beacon.c b/trunk/drivers/net/wireless/ath/ath9k/beacon.c index 2ca355e94da6..531fffd801a3 100644 --- a/trunk/drivers/net/wireless/ath/ath9k/beacon.c +++ b/trunk/drivers/net/wireless/ath/ath9k/beacon.c @@ -147,7 +147,6 @@ static struct ath_buf *ath9k_beacon_generate(struct ieee80211_hw *hw, skb->len, DMA_TO_DEVICE); dev_kfree_skb_any(skb); bf->bf_buf_addr = 0; - bf->bf_mpdu = NULL; } skb = ieee80211_beacon_get(hw, vif); @@ -360,6 +359,7 @@ void ath9k_beacon_tasklet(unsigned long data) return; bf = ath9k_beacon_generate(sc->hw, vif); + WARN_ON(!bf); if (sc->beacon.bmisscnt != 0) { ath_dbg(common, BSTUCK, "resume beacon xmit after %u misses\n", diff --git a/trunk/drivers/net/wireless/ath/ath9k/debug.c b/trunk/drivers/net/wireless/ath/ath9k/debug.c index e585fc827c50..13ff9edc2401 100644 --- a/trunk/drivers/net/wireless/ath/ath9k/debug.c +++ b/trunk/drivers/net/wireless/ath/ath9k/debug.c @@ -861,6 +861,7 @@ static ssize_t read_file_recv(struct file *file, char __user *user_buf, RXS_ERR("RX-LENGTH-ERR", rx_len_err); RXS_ERR("RX-OOM-ERR", rx_oom_err); RXS_ERR("RX-RATE-ERR", rx_rate_err); + RXS_ERR("RX-DROP-RXFLUSH", rx_drop_rxflush); RXS_ERR("RX-TOO-MANY-FRAGS", rx_too_many_frags_err); PHY_ERR("UNDERRUN ERR", ATH9K_PHYERR_UNDERRUN); diff --git a/trunk/drivers/net/wireless/ath/ath9k/debug.h b/trunk/drivers/net/wireless/ath/ath9k/debug.h index 6df2ab62dcb7..375c3b46411e 100644 --- a/trunk/drivers/net/wireless/ath/ath9k/debug.h +++ b/trunk/drivers/net/wireless/ath/ath9k/debug.h @@ -216,6 +216,7 @@ struct ath_tx_stats { * @rx_oom_err: No. of frames dropped due to OOM issues. * @rx_rate_err: No. of frames dropped due to rate errors. * @rx_too_many_frags_err: Frames dropped due to too-many-frags received. + * @rx_drop_rxflush: No. of frames dropped due to RX-FLUSH. * @rx_beacons: No. of beacons received. * @rx_frags: No. of rx-fragements received. */ @@ -234,6 +235,7 @@ struct ath_rx_stats { u32 rx_oom_err; u32 rx_rate_err; u32 rx_too_many_frags_err; + u32 rx_drop_rxflush; u32 rx_beacons; u32 rx_frags; }; diff --git a/trunk/drivers/net/wireless/ath/ath9k/htc_hst.c b/trunk/drivers/net/wireless/ath/ath9k/htc_hst.c index aac4a406a513..4a9570dfba72 100644 --- a/trunk/drivers/net/wireless/ath/ath9k/htc_hst.c +++ b/trunk/drivers/net/wireless/ath/ath9k/htc_hst.c @@ -344,8 +344,6 @@ void ath9k_htc_txcompletion_cb(struct htc_target *htc_handle, endpoint->ep_callbacks.tx(endpoint->ep_callbacks.priv, skb, htc_hdr->endpoint_id, txok); - } else { - kfree_skb(skb); } } diff --git a/trunk/drivers/net/wireless/ath/ath9k/hw.h b/trunk/drivers/net/wireless/ath/ath9k/hw.h index 9d26fc56ca56..7f1a8e91c908 100644 --- a/trunk/drivers/net/wireless/ath/ath9k/hw.h +++ b/trunk/drivers/net/wireless/ath/ath9k/hw.h @@ -1066,7 +1066,6 @@ void ar9003_paprd_setup_gain_table(struct ath_hw *ah, int chain); int ar9003_paprd_init_table(struct ath_hw *ah); bool ar9003_paprd_is_done(struct ath_hw *ah); bool ar9003_is_paprd_enabled(struct ath_hw *ah); -void ar9003_hw_set_chain_masks(struct ath_hw *ah, u8 rx, u8 tx); /* Hardware family op attach helpers */ void ar5008_hw_attach_phy_ops(struct ath_hw *ah); diff --git a/trunk/drivers/net/wireless/ath/ath9k/main.c b/trunk/drivers/net/wireless/ath/ath9k/main.c index dd91f8fdc01c..be30a9af1528 100644 --- a/trunk/drivers/net/wireless/ath/ath9k/main.c +++ b/trunk/drivers/net/wireless/ath/ath9k/main.c @@ -182,7 +182,7 @@ static void ath_restart_work(struct ath_softc *sc) ath_start_ani(sc); } -static bool ath_prepare_reset(struct ath_softc *sc, bool retry_tx) +static bool ath_prepare_reset(struct ath_softc *sc, bool retry_tx, bool flush) { struct ath_hw *ah = sc->sc_ah; bool ret = true; @@ -202,6 +202,14 @@ static bool ath_prepare_reset(struct ath_softc *sc, bool retry_tx) if (!ath_drain_all_txq(sc, retry_tx)) ret = false; + if (!flush) { + if (ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) + ath_rx_tasklet(sc, 1, true); + ath_rx_tasklet(sc, 1, false); + } else { + ath_flushrecv(sc); + } + return ret; } @@ -254,11 +262,11 @@ static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan, struct ath_common *common = ath9k_hw_common(ah); struct ath9k_hw_cal_data *caldata = NULL; bool fastcc = true; + bool flush = false; int r; __ath_cancel_work(sc); - tasklet_disable(&sc->intr_tq); spin_lock_bh(&sc->sc_pcu_lock); if (!(sc->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)) { @@ -268,10 +276,11 @@ static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan, if (!hchan) { fastcc = false; + flush = true; hchan = ah->curchan; } - if (!ath_prepare_reset(sc, retry_tx)) + if (!ath_prepare_reset(sc, retry_tx, flush)) fastcc = false; ath_dbg(common, CONFIG, "Reset to %u MHz, HT40: %d fastcc: %d\n", @@ -293,8 +302,6 @@ static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan, out: spin_unlock_bh(&sc->sc_pcu_lock); - tasklet_enable(&sc->intr_tq); - return r; } @@ -797,7 +804,7 @@ static void ath9k_stop(struct ieee80211_hw *hw) ath9k_hw_cfg_gpio_input(ah, ah->led_pin); } - ath_prepare_reset(sc, false); + ath_prepare_reset(sc, false, true); if (sc->rx.frag) { dev_kfree_skb_any(sc->rx.frag); @@ -1826,9 +1833,6 @@ static u32 fill_chainmask(u32 cap, u32 new) static bool validate_antenna_mask(struct ath_hw *ah, u32 val) { - if (AR_SREV_9300_20_OR_LATER(ah)) - return true; - switch (val & 0x7) { case 0x1: case 0x3: diff --git a/trunk/drivers/net/wireless/ath/ath9k/recv.c b/trunk/drivers/net/wireless/ath/ath9k/recv.c index 90752f246970..d4df98a938bf 100644 --- a/trunk/drivers/net/wireless/ath/ath9k/recv.c +++ b/trunk/drivers/net/wireless/ath/ath9k/recv.c @@ -254,6 +254,8 @@ static int ath_rx_edma_init(struct ath_softc *sc, int nbufs) static void ath_edma_start_recv(struct ath_softc *sc) { + spin_lock_bh(&sc->rx.rxbuflock); + ath9k_hw_rxena(sc->sc_ah); ath_rx_addbuffer_edma(sc, ATH9K_RX_QUEUE_HP, @@ -265,6 +267,8 @@ static void ath_edma_start_recv(struct ath_softc *sc) ath_opmode_init(sc); ath9k_hw_startpcureceive(sc->sc_ah, !!(sc->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)); + + spin_unlock_bh(&sc->rx.rxbuflock); } static void ath_edma_stop_recv(struct ath_softc *sc) @@ -281,6 +285,8 @@ int ath_rx_init(struct ath_softc *sc, int nbufs) int error = 0; spin_lock_init(&sc->sc_pcu_lock); + spin_lock_init(&sc->rx.rxbuflock); + clear_bit(SC_OP_RXFLUSH, &sc->sc_flags); common->rx_bufsize = IEEE80211_MAX_MPDU_LEN / 2 + sc->sc_ah->caps.rx_status_len; @@ -441,6 +447,7 @@ int ath_startrecv(struct ath_softc *sc) return 0; } + spin_lock_bh(&sc->rx.rxbuflock); if (list_empty(&sc->rx.rxbuf)) goto start_recv; @@ -461,14 +468,9 @@ int ath_startrecv(struct ath_softc *sc) ath_opmode_init(sc); ath9k_hw_startpcureceive(ah, !!(sc->hw->conf.flags & IEEE80211_CONF_OFFCHANNEL)); - return 0; -} + spin_unlock_bh(&sc->rx.rxbuflock); -static void ath_flushrecv(struct ath_softc *sc) -{ - if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) - ath_rx_tasklet(sc, 1, true); - ath_rx_tasklet(sc, 1, false); + return 0; } bool ath_stoprecv(struct ath_softc *sc) @@ -476,16 +478,16 @@ bool ath_stoprecv(struct ath_softc *sc) struct ath_hw *ah = sc->sc_ah; bool stopped, reset = false; + spin_lock_bh(&sc->rx.rxbuflock); ath9k_hw_abortpcurecv(ah); ath9k_hw_setrxfilter(ah, 0); stopped = ath9k_hw_stopdmarecv(ah, &reset); - ath_flushrecv(sc); - if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) ath_edma_stop_recv(sc); else sc->rx.rxlink = NULL; + spin_unlock_bh(&sc->rx.rxbuflock); if (!(ah->ah_flags & AH_UNPLUGGED) && unlikely(!stopped)) { @@ -497,6 +499,15 @@ bool ath_stoprecv(struct ath_softc *sc) return stopped && !reset; } +void ath_flushrecv(struct ath_softc *sc) +{ + set_bit(SC_OP_RXFLUSH, &sc->sc_flags); + if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) + ath_rx_tasklet(sc, 1, true); + ath_rx_tasklet(sc, 1, false); + clear_bit(SC_OP_RXFLUSH, &sc->sc_flags); +} + static bool ath_beacon_dtim_pending_cab(struct sk_buff *skb) { /* Check whether the Beacon frame has DTIM indicating buffered bc/mc */ @@ -733,7 +744,6 @@ static struct ath_buf *ath_get_next_rx_buf(struct ath_softc *sc, return NULL; } - list_del(&bf->list); if (!bf->bf_mpdu) return bf; @@ -1049,12 +1059,16 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) dma_type = DMA_FROM_DEVICE; qtype = hp ? ATH9K_RX_QUEUE_HP : ATH9K_RX_QUEUE_LP; + spin_lock_bh(&sc->rx.rxbuflock); tsf = ath9k_hw_gettsf64(ah); tsf_lower = tsf & 0xffffffff; do { bool decrypt_error = false; + /* If handling rx interrupt and flush is in progress => exit */ + if (test_bit(SC_OP_RXFLUSH, &sc->sc_flags) && (flush == 0)) + break; memset(&rs, 0, sizeof(rs)); if (edma) @@ -1097,6 +1111,15 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) ath_debug_stat_rx(sc, &rs); + /* + * If we're asked to flush receive queue, directly + * chain it back at the queue without processing it. + */ + if (test_bit(SC_OP_RXFLUSH, &sc->sc_flags)) { + RX_STAT_INC(rx_drop_rxflush); + goto requeue_drop_frag; + } + memset(rxs, 0, sizeof(struct ieee80211_rx_status)); rxs->mactime = (tsf & ~0xffffffffULL) | rs.rs_tstamp; @@ -1231,18 +1254,19 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) sc->rx.frag = NULL; } requeue: - list_add_tail(&bf->list, &sc->rx.rxbuf); - if (flush) - continue; - if (edma) { + list_add_tail(&bf->list, &sc->rx.rxbuf); ath_rx_edma_buf_link(sc, qtype); } else { + list_move_tail(&bf->list, &sc->rx.rxbuf); ath_rx_buf_link(sc, bf); - ath9k_hw_rxena(ah); + if (!flush) + ath9k_hw_rxena(ah); } } while (1); + spin_unlock_bh(&sc->rx.rxbuflock); + if (!(ah->imask & ATH9K_INT_RXEOL)) { ah->imask |= (ATH9K_INT_RXEOL | ATH9K_INT_RXORN); ath9k_hw_set_interrupts(ah); diff --git a/trunk/drivers/net/wireless/ath/carl9170/fw.c b/trunk/drivers/net/wireless/ath/carl9170/fw.c index 63fd9af3fd39..aaebecd19e59 100644 --- a/trunk/drivers/net/wireless/ath/carl9170/fw.c +++ b/trunk/drivers/net/wireless/ath/carl9170/fw.c @@ -336,12 +336,8 @@ static int carl9170_fw(struct ar9170 *ar, const __u8 *data, size_t len) if (SUPP(CARL9170FW_WLANTX_CAB)) { if_comb_types |= BIT(NL80211_IFTYPE_AP) | + BIT(NL80211_IFTYPE_MESH_POINT) | BIT(NL80211_IFTYPE_P2P_GO); - -#ifdef CONFIG_MAC80211_MESH - if_comb_types |= - BIT(NL80211_IFTYPE_MESH_POINT); -#endif /* CONFIG_MAC80211_MESH */ } } diff --git a/trunk/drivers/net/wireless/ath/wil6210/Kconfig b/trunk/drivers/net/wireless/ath/wil6210/Kconfig deleted file mode 100644 index bac3d98a0cfb..000000000000 --- a/trunk/drivers/net/wireless/ath/wil6210/Kconfig +++ /dev/null @@ -1,29 +0,0 @@ -config WIL6210 - tristate "Wilocity 60g WiFi card wil6210 support" - depends on CFG80211 - depends on PCI - default n - ---help--- - This module adds support for wireless adapter based on - wil6210 chip by Wilocity. It supports operation on the - 60 GHz band, covered by the IEEE802.11ad standard. - - http://wireless.kernel.org/en/users/Drivers/wil6210 - - If you choose to build it as a module, it will be called - wil6210 - -config WIL6210_ISR_COR - bool "Use Clear-On-Read mode for ISR registers for wil6210" - depends on WIL6210 - default y - ---help--- - ISR registers on wil6210 chip may operate in either - COR (Clear-On-Read) or W1C (Write-1-to-Clear) mode. - For production code, use COR (say y); is default since - it saves extra target transaction; - For ISR debug, use W1C (say n); is allows to monitor ISR - registers with debugfs. If COR were used, ISR would - self-clear when accessed for debug purposes, it makes - such monitoring impossible. - Say y unless you debug interrupts diff --git a/trunk/drivers/net/wireless/ath/wil6210/Makefile b/trunk/drivers/net/wireless/ath/wil6210/Makefile deleted file mode 100644 index 9396dc9fe3c5..000000000000 --- a/trunk/drivers/net/wireless/ath/wil6210/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -obj-$(CONFIG_WIL6210) += wil6210.o - -wil6210-objs := main.o -wil6210-objs += netdev.o -wil6210-objs += cfg80211.o -wil6210-objs += pcie_bus.o -wil6210-objs += debugfs.o -wil6210-objs += wmi.o -wil6210-objs += interrupt.o -wil6210-objs += txrx.o - -subdir-ccflags-y += -Werror -subdir-ccflags-y += -D__CHECK_ENDIAN__ diff --git a/trunk/drivers/net/wireless/ath/wil6210/cfg80211.c b/trunk/drivers/net/wireless/ath/wil6210/cfg80211.c deleted file mode 100644 index 116f4e807ae1..000000000000 --- a/trunk/drivers/net/wireless/ath/wil6210/cfg80211.c +++ /dev/null @@ -1,573 +0,0 @@ -/* - * Copyright (c) 2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "wil6210.h" -#include "wmi.h" - -#define CHAN60G(_channel, _flags) { \ - .band = IEEE80211_BAND_60GHZ, \ - .center_freq = 56160 + (2160 * (_channel)), \ - .hw_value = (_channel), \ - .flags = (_flags), \ - .max_antenna_gain = 0, \ - .max_power = 40, \ -} - -static struct ieee80211_channel wil_60ghz_channels[] = { - CHAN60G(1, 0), - CHAN60G(2, 0), - CHAN60G(3, 0), -/* channel 4 not supported yet */ -}; - -static struct ieee80211_supported_band wil_band_60ghz = { - .channels = wil_60ghz_channels, - .n_channels = ARRAY_SIZE(wil_60ghz_channels), - .ht_cap = { - .ht_supported = true, - .cap = 0, /* TODO */ - .ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, /* TODO */ - .ampdu_density = IEEE80211_HT_MPDU_DENSITY_8, /* TODO */ - .mcs = { - /* MCS 1..12 - SC PHY */ - .rx_mask = {0xfe, 0x1f}, /* 1..12 */ - .tx_params = IEEE80211_HT_MCS_TX_DEFINED, /* TODO */ - }, - }, -}; - -static const struct ieee80211_txrx_stypes -wil_mgmt_stypes[NUM_NL80211_IFTYPES] = { - [NL80211_IFTYPE_STATION] = { - .tx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_RESP >> 4), - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) - }, - [NL80211_IFTYPE_AP] = { - .tx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_RESP >> 4), - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) - }, - [NL80211_IFTYPE_P2P_CLIENT] = { - .tx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_RESP >> 4), - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) - }, - [NL80211_IFTYPE_P2P_GO] = { - .tx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_RESP >> 4), - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) - }, -}; - -static const u32 wil_cipher_suites[] = { - WLAN_CIPHER_SUITE_GCMP, -}; - -int wil_iftype_nl2wmi(enum nl80211_iftype type) -{ - static const struct { - enum nl80211_iftype nl; - enum wmi_network_type wmi; - } __nl2wmi[] = { - {NL80211_IFTYPE_ADHOC, WMI_NETTYPE_ADHOC}, - {NL80211_IFTYPE_STATION, WMI_NETTYPE_INFRA}, - {NL80211_IFTYPE_AP, WMI_NETTYPE_AP}, - {NL80211_IFTYPE_P2P_CLIENT, WMI_NETTYPE_P2P}, - {NL80211_IFTYPE_P2P_GO, WMI_NETTYPE_P2P}, - {NL80211_IFTYPE_MONITOR, WMI_NETTYPE_ADHOC}, /* FIXME */ - }; - uint i; - - for (i = 0; i < ARRAY_SIZE(__nl2wmi); i++) { - if (__nl2wmi[i].nl == type) - return __nl2wmi[i].wmi; - } - - return -EOPNOTSUPP; -} - -static int wil_cfg80211_get_station(struct wiphy *wiphy, - struct net_device *ndev, - u8 *mac, struct station_info *sinfo) -{ - struct wil6210_priv *wil = wiphy_to_wil(wiphy); - int rc; - struct wmi_notify_req_cmd cmd = { - .cid = 0, - .interval_usec = 0, - }; - - if (memcmp(mac, wil->dst_addr[0], ETH_ALEN)) - return -ENOENT; - - /* WMI_NOTIFY_REQ_DONE_EVENTID handler fills wil->stats.bf_mcs */ - rc = wmi_call(wil, WMI_NOTIFY_REQ_CMDID, &cmd, sizeof(cmd), - WMI_NOTIFY_REQ_DONE_EVENTID, NULL, 0, 20); - if (rc) - return rc; - - sinfo->generation = wil->sinfo_gen; - - sinfo->filled |= STATION_INFO_TX_BITRATE; - sinfo->txrate.flags = RATE_INFO_FLAGS_MCS | RATE_INFO_FLAGS_60G; - sinfo->txrate.mcs = wil->stats.bf_mcs; - sinfo->filled |= STATION_INFO_RX_BITRATE; - sinfo->rxrate.flags = RATE_INFO_FLAGS_MCS | RATE_INFO_FLAGS_60G; - sinfo->rxrate.mcs = wil->stats.last_mcs_rx; - - if (test_bit(wil_status_fwconnected, &wil->status)) { - sinfo->filled |= STATION_INFO_SIGNAL; - sinfo->signal = 12; /* TODO: provide real value */ - } - - return 0; -} - -static int wil_cfg80211_change_iface(struct wiphy *wiphy, - struct net_device *ndev, - enum nl80211_iftype type, u32 *flags, - struct vif_params *params) -{ - struct wil6210_priv *wil = wiphy_to_wil(wiphy); - struct wireless_dev *wdev = wil->wdev; - - switch (type) { - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_P2P_CLIENT: - case NL80211_IFTYPE_P2P_GO: - break; - case NL80211_IFTYPE_MONITOR: - if (flags) - wil->monitor_flags = *flags; - else - wil->monitor_flags = 0; - - break; - default: - return -EOPNOTSUPP; - } - - wdev->iftype = type; - - return 0; -} - -static int wil_cfg80211_scan(struct wiphy *wiphy, - struct cfg80211_scan_request *request) -{ - struct wil6210_priv *wil = wiphy_to_wil(wiphy); - struct wireless_dev *wdev = wil->wdev; - struct { - struct wmi_start_scan_cmd cmd; - u16 chnl[4]; - } __packed cmd; - uint i, n; - - if (wil->scan_request) { - wil_err(wil, "Already scanning\n"); - return -EAGAIN; - } - - /* check we are client side */ - switch (wdev->iftype) { - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_P2P_CLIENT: - break; - default: - return -EOPNOTSUPP; - - } - - /* FW don't support scan after connection attempt */ - if (test_bit(wil_status_dontscan, &wil->status)) { - wil_err(wil, "Scan after connect attempt not supported\n"); - return -EBUSY; - } - - wil->scan_request = request; - - memset(&cmd, 0, sizeof(cmd)); - cmd.cmd.num_channels = 0; - n = min(request->n_channels, 4U); - for (i = 0; i < n; i++) { - int ch = request->channels[i]->hw_value; - if (ch == 0) { - wil_err(wil, - "Scan requested for unknown frequency %dMhz\n", - request->channels[i]->center_freq); - continue; - } - /* 0-based channel indexes */ - cmd.cmd.channel_list[cmd.cmd.num_channels++].channel = ch - 1; - wil_dbg(wil, "Scan for ch %d : %d MHz\n", ch, - request->channels[i]->center_freq); - } - - return wmi_send(wil, WMI_START_SCAN_CMDID, &cmd, sizeof(cmd.cmd) + - cmd.cmd.num_channels * sizeof(cmd.cmd.channel_list[0])); -} - -static int wil_cfg80211_connect(struct wiphy *wiphy, - struct net_device *ndev, - struct cfg80211_connect_params *sme) -{ - struct wil6210_priv *wil = wiphy_to_wil(wiphy); - struct cfg80211_bss *bss; - struct wmi_connect_cmd conn; - const u8 *ssid_eid; - const u8 *rsn_eid; - int ch; - int rc = 0; - - bss = cfg80211_get_bss(wiphy, sme->channel, sme->bssid, - sme->ssid, sme->ssid_len, - WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS); - if (!bss) { - wil_err(wil, "Unable to find BSS\n"); - return -ENOENT; - } - - ssid_eid = ieee80211_bss_get_ie(bss, WLAN_EID_SSID); - if (!ssid_eid) { - wil_err(wil, "No SSID\n"); - rc = -ENOENT; - goto out; - } - - rsn_eid = sme->ie ? - cfg80211_find_ie(WLAN_EID_RSN, sme->ie, sme->ie_len) : - NULL; - if (rsn_eid) { - if (sme->ie_len > WMI_MAX_IE_LEN) { - rc = -ERANGE; - wil_err(wil, "IE too large (%td bytes)\n", - sme->ie_len); - goto out; - } - /* - * For secure assoc, send: - * (1) WMI_DELETE_CIPHER_KEY_CMD - * (2) WMI_SET_APPIE_CMD - */ - rc = wmi_del_cipher_key(wil, 0, bss->bssid); - if (rc) { - wil_err(wil, "WMI_DELETE_CIPHER_KEY_CMD failed\n"); - goto out; - } - /* WMI_SET_APPIE_CMD */ - rc = wmi_set_ie(wil, WMI_FRAME_ASSOC_REQ, sme->ie_len, sme->ie); - if (rc) { - wil_err(wil, "WMI_SET_APPIE_CMD failed\n"); - goto out; - } - } - - /* WMI_CONNECT_CMD */ - memset(&conn, 0, sizeof(conn)); - switch (bss->capability & 0x03) { - case WLAN_CAPABILITY_DMG_TYPE_AP: - conn.network_type = WMI_NETTYPE_INFRA; - break; - case WLAN_CAPABILITY_DMG_TYPE_PBSS: - conn.network_type = WMI_NETTYPE_P2P; - break; - default: - wil_err(wil, "Unsupported BSS type, capability= 0x%04x\n", - bss->capability); - goto out; - } - if (rsn_eid) { - conn.dot11_auth_mode = WMI_AUTH11_SHARED; - conn.auth_mode = WMI_AUTH_WPA2_PSK; - conn.pairwise_crypto_type = WMI_CRYPT_AES_GCMP; - conn.pairwise_crypto_len = 16; - } else { - conn.dot11_auth_mode = WMI_AUTH11_OPEN; - conn.auth_mode = WMI_AUTH_NONE; - } - - conn.ssid_len = min_t(u8, ssid_eid[1], 32); - memcpy(conn.ssid, ssid_eid+2, conn.ssid_len); - - ch = bss->channel->hw_value; - if (ch == 0) { - wil_err(wil, "BSS at unknown frequency %dMhz\n", - bss->channel->center_freq); - rc = -EOPNOTSUPP; - goto out; - } - conn.channel = ch - 1; - - memcpy(conn.bssid, bss->bssid, 6); - memcpy(conn.dst_mac, bss->bssid, 6); - /* - * FW don't support scan after connection attempt - */ - set_bit(wil_status_dontscan, &wil->status); - - rc = wmi_send(wil, WMI_CONNECT_CMDID, &conn, sizeof(conn)); - if (rc == 0) { - /* Connect can take lots of time */ - mod_timer(&wil->connect_timer, - jiffies + msecs_to_jiffies(2000)); - } - - out: - cfg80211_put_bss(bss); - - return rc; -} - -static int wil_cfg80211_disconnect(struct wiphy *wiphy, - struct net_device *ndev, - u16 reason_code) -{ - int rc; - struct wil6210_priv *wil = wiphy_to_wil(wiphy); - - rc = wmi_send(wil, WMI_DISCONNECT_CMDID, NULL, 0); - - return rc; -} - -static int wil_cfg80211_set_channel(struct wiphy *wiphy, - struct cfg80211_chan_def *chandef) -{ - struct wil6210_priv *wil = wiphy_to_wil(wiphy); - struct wireless_dev *wdev = wil->wdev; - - wdev->preset_chandef = *chandef; - - return 0; -} - -static int wil_cfg80211_add_key(struct wiphy *wiphy, - struct net_device *ndev, - u8 key_index, bool pairwise, - const u8 *mac_addr, - struct key_params *params) -{ - struct wil6210_priv *wil = wiphy_to_wil(wiphy); - - /* group key is not used */ - if (!pairwise) - return 0; - - return wmi_add_cipher_key(wil, key_index, mac_addr, - params->key_len, params->key); -} - -static int wil_cfg80211_del_key(struct wiphy *wiphy, - struct net_device *ndev, - u8 key_index, bool pairwise, - const u8 *mac_addr) -{ - struct wil6210_priv *wil = wiphy_to_wil(wiphy); - - /* group key is not used */ - if (!pairwise) - return 0; - - return wmi_del_cipher_key(wil, key_index, mac_addr); -} - -/* Need to be present or wiphy_new() will WARN */ -static int wil_cfg80211_set_default_key(struct wiphy *wiphy, - struct net_device *ndev, - u8 key_index, bool unicast, - bool multicast) -{ - return 0; -} - -static int wil_cfg80211_start_ap(struct wiphy *wiphy, - struct net_device *ndev, - struct cfg80211_ap_settings *info) -{ - int rc = 0; - struct wil6210_priv *wil = wiphy_to_wil(wiphy); - struct wireless_dev *wdev = ndev->ieee80211_ptr; - struct ieee80211_channel *channel = info->chandef.chan; - struct cfg80211_beacon_data *bcon = &info->beacon; - u8 wmi_nettype = wil_iftype_nl2wmi(wdev->iftype); - - if (!channel) { - wil_err(wil, "AP: No channel???\n"); - return -EINVAL; - } - - wil_dbg(wil, "AP on Channel %d %d MHz, %s\n", channel->hw_value, - channel->center_freq, info->privacy ? "secure" : "open"); - print_hex_dump_bytes("SSID ", DUMP_PREFIX_OFFSET, - info->ssid, info->ssid_len); - - rc = wil_reset(wil); - if (rc) - return rc; - - rc = wmi_set_ssid(wil, info->ssid_len, info->ssid); - if (rc) - return rc; - - rc = wmi_set_channel(wil, channel->hw_value); - if (rc) - return rc; - - /* MAC address - pre-requisite for other commands */ - wmi_set_mac_address(wil, ndev->dev_addr); - - /* IE's */ - /* bcon 'head IE's are not relevant for 60g band */ - wmi_set_ie(wil, WMI_FRAME_BEACON, bcon->beacon_ies_len, - bcon->beacon_ies); - wmi_set_ie(wil, WMI_FRAME_PROBE_RESP, bcon->proberesp_ies_len, - bcon->proberesp_ies); - wmi_set_ie(wil, WMI_FRAME_ASSOC_RESP, bcon->assocresp_ies_len, - bcon->assocresp_ies); - - wil->secure_pcp = info->privacy; - - rc = wmi_set_bcon(wil, info->beacon_interval, wmi_nettype); - if (rc) - return rc; - - /* Rx VRING. After MAC and beacon */ - rc = wil_rx_init(wil); - - netif_carrier_on(ndev); - - return rc; -} - -static int wil_cfg80211_stop_ap(struct wiphy *wiphy, - struct net_device *ndev) -{ - int rc = 0; - struct wil6210_priv *wil = wiphy_to_wil(wiphy); - struct wireless_dev *wdev = ndev->ieee80211_ptr; - u8 wmi_nettype = wil_iftype_nl2wmi(wdev->iftype); - - /* To stop beaconing, set BI to 0 */ - rc = wmi_set_bcon(wil, 0, wmi_nettype); - - return rc; -} - -static struct cfg80211_ops wil_cfg80211_ops = { - .scan = wil_cfg80211_scan, - .connect = wil_cfg80211_connect, - .disconnect = wil_cfg80211_disconnect, - .change_virtual_intf = wil_cfg80211_change_iface, - .get_station = wil_cfg80211_get_station, - .set_monitor_channel = wil_cfg80211_set_channel, - .add_key = wil_cfg80211_add_key, - .del_key = wil_cfg80211_del_key, - .set_default_key = wil_cfg80211_set_default_key, - /* AP mode */ - .start_ap = wil_cfg80211_start_ap, - .stop_ap = wil_cfg80211_stop_ap, -}; - -static void wil_wiphy_init(struct wiphy *wiphy) -{ - /* TODO: set real value */ - wiphy->max_scan_ssids = 10; - wiphy->max_num_pmkids = 0 /* TODO: */; - wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_AP) | - BIT(NL80211_IFTYPE_MONITOR); - /* TODO: enable P2P when integrated with supplicant: - * BIT(NL80211_IFTYPE_P2P_CLIENT) | BIT(NL80211_IFTYPE_P2P_GO) - */ - wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME | - WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD; - dev_warn(wiphy_dev(wiphy), "%s : flags = 0x%08x\n", - __func__, wiphy->flags); - wiphy->probe_resp_offload = - NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS | - NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 | - NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P; - - wiphy->bands[IEEE80211_BAND_60GHZ] = &wil_band_60ghz; - - /* TODO: figure this out */ - wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; - - wiphy->cipher_suites = wil_cipher_suites; - wiphy->n_cipher_suites = ARRAY_SIZE(wil_cipher_suites); - wiphy->mgmt_stypes = wil_mgmt_stypes; -} - -struct wireless_dev *wil_cfg80211_init(struct device *dev) -{ - int rc = 0; - struct wireless_dev *wdev; - - wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); - if (!wdev) - return ERR_PTR(-ENOMEM); - - wdev->wiphy = wiphy_new(&wil_cfg80211_ops, - sizeof(struct wil6210_priv)); - if (!wdev->wiphy) { - rc = -ENOMEM; - goto out; - } - - set_wiphy_dev(wdev->wiphy, dev); - wil_wiphy_init(wdev->wiphy); - - rc = wiphy_register(wdev->wiphy); - if (rc < 0) - goto out_failed_reg; - - return wdev; - -out_failed_reg: - wiphy_free(wdev->wiphy); -out: - kfree(wdev); - - return ERR_PTR(rc); -} - -void wil_wdev_free(struct wil6210_priv *wil) -{ - struct wireless_dev *wdev = wil_to_wdev(wil); - - if (!wdev) - return; - - wiphy_unregister(wdev->wiphy); - wiphy_free(wdev->wiphy); - kfree(wdev); -} diff --git a/trunk/drivers/net/wireless/ath/wil6210/dbg_hexdump.h b/trunk/drivers/net/wireless/ath/wil6210/dbg_hexdump.h deleted file mode 100644 index 6a315ba5aa7d..000000000000 --- a/trunk/drivers/net/wireless/ath/wil6210/dbg_hexdump.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef WIL_DBG_HEXDUMP_H_ -#define WIL_DBG_HEXDUMP_H_ - -#if defined(CONFIG_DYNAMIC_DEBUG) -#define wil_dynamic_hex_dump(prefix_str, prefix_type, rowsize, \ - groupsize, buf, len, ascii) \ -do { \ - DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, \ - __builtin_constant_p(prefix_str) ? prefix_str : "hexdump");\ - if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \ - print_hex_dump(KERN_DEBUG, prefix_str, \ - prefix_type, rowsize, groupsize, \ - buf, len, ascii); \ -} while (0) - -#define wil_print_hex_dump_debug(prefix_str, prefix_type, rowsize, \ - groupsize, buf, len, ascii) \ - wil_dynamic_hex_dump(prefix_str, prefix_type, rowsize, \ - groupsize, buf, len, ascii) - -#define print_hex_dump_bytes(prefix_str, prefix_type, buf, len) \ - wil_dynamic_hex_dump(prefix_str, prefix_type, 16, 1, buf, len, true) -#else /* defined(CONFIG_DYNAMIC_DEBUG) */ -#define wil_print_hex_dump_debug(prefix_str, prefix_type, rowsize, \ - groupsize, buf, len, ascii) \ - print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, rowsize, \ - groupsize, buf, len, ascii) -#endif /* defined(CONFIG_DYNAMIC_DEBUG) */ - -#endif /* WIL_DBG_HEXDUMP_H_ */ diff --git a/trunk/drivers/net/wireless/ath/wil6210/debugfs.c b/trunk/drivers/net/wireless/ath/wil6210/debugfs.c deleted file mode 100644 index 65fc9683bfd8..000000000000 --- a/trunk/drivers/net/wireless/ath/wil6210/debugfs.c +++ /dev/null @@ -1,603 +0,0 @@ -/* - * Copyright (c) 2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include -#include - -#include "wil6210.h" -#include "txrx.h" - -/* Nasty hack. Better have per device instances */ -static u32 mem_addr; -static u32 dbg_txdesc_index; - -static void wil_print_vring(struct seq_file *s, struct wil6210_priv *wil, - const char *name, struct vring *vring) -{ - void __iomem *x = wmi_addr(wil, vring->hwtail); - - seq_printf(s, "VRING %s = {\n", name); - seq_printf(s, " pa = 0x%016llx\n", (unsigned long long)vring->pa); - seq_printf(s, " va = 0x%p\n", vring->va); - seq_printf(s, " size = %d\n", vring->size); - seq_printf(s, " swtail = %d\n", vring->swtail); - seq_printf(s, " swhead = %d\n", vring->swhead); - seq_printf(s, " hwtail = [0x%08x] -> ", vring->hwtail); - if (x) - seq_printf(s, "0x%08x\n", ioread32(x)); - else - seq_printf(s, "???\n"); - - if (vring->va && (vring->size < 1025)) { - uint i; - for (i = 0; i < vring->size; i++) { - volatile struct vring_tx_desc *d = &vring->va[i].tx; - if ((i % 64) == 0 && (i != 0)) - seq_printf(s, "\n"); - seq_printf(s, "%s", (d->dma.status & BIT(0)) ? - "S" : (vring->ctx[i] ? "H" : "h")); - } - seq_printf(s, "\n"); - } - seq_printf(s, "}\n"); -} - -static int wil_vring_debugfs_show(struct seq_file *s, void *data) -{ - uint i; - struct wil6210_priv *wil = s->private; - - wil_print_vring(s, wil, "rx", &wil->vring_rx); - - for (i = 0; i < ARRAY_SIZE(wil->vring_tx); i++) { - struct vring *vring = &(wil->vring_tx[i]); - if (vring->va) { - char name[10]; - snprintf(name, sizeof(name), "tx_%2d", i); - wil_print_vring(s, wil, name, vring); - } - } - - return 0; -} - -static int wil_vring_seq_open(struct inode *inode, struct file *file) -{ - return single_open(file, wil_vring_debugfs_show, inode->i_private); -} - -static const struct file_operations fops_vring = { - .open = wil_vring_seq_open, - .release = single_release, - .read = seq_read, - .llseek = seq_lseek, -}; - -static void wil_print_ring(struct seq_file *s, const char *prefix, - void __iomem *off) -{ - struct wil6210_priv *wil = s->private; - struct wil6210_mbox_ring r; - int rsize; - uint i; - - wil_memcpy_fromio_32(&r, off, sizeof(r)); - wil_mbox_ring_le2cpus(&r); - /* - * we just read memory block from NIC. This memory may be - * garbage. Check validity before using it. - */ - rsize = r.size / sizeof(struct wil6210_mbox_ring_desc); - - seq_printf(s, "ring %s = {\n", prefix); - seq_printf(s, " base = 0x%08x\n", r.base); - seq_printf(s, " size = 0x%04x bytes -> %d entries\n", r.size, rsize); - seq_printf(s, " tail = 0x%08x\n", r.tail); - seq_printf(s, " head = 0x%08x\n", r.head); - seq_printf(s, " entry size = %d\n", r.entry_size); - - if (r.size % sizeof(struct wil6210_mbox_ring_desc)) { - seq_printf(s, " ??? size is not multiple of %zd, garbage?\n", - sizeof(struct wil6210_mbox_ring_desc)); - goto out; - } - - if (!wmi_addr(wil, r.base) || - !wmi_addr(wil, r.tail) || - !wmi_addr(wil, r.head)) { - seq_printf(s, " ??? pointers are garbage?\n"); - goto out; - } - - for (i = 0; i < rsize; i++) { - struct wil6210_mbox_ring_desc d; - struct wil6210_mbox_hdr hdr; - size_t delta = i * sizeof(d); - void __iomem *x = wil->csr + HOSTADDR(r.base) + delta; - - wil_memcpy_fromio_32(&d, x, sizeof(d)); - - seq_printf(s, " [%2x] %s %s%s 0x%08x", i, - d.sync ? "F" : "E", - (r.tail - r.base == delta) ? "t" : " ", - (r.head - r.base == delta) ? "h" : " ", - le32_to_cpu(d.addr)); - if (0 == wmi_read_hdr(wil, d.addr, &hdr)) { - u16 len = le16_to_cpu(hdr.len); - seq_printf(s, " -> %04x %04x %04x %02x\n", - le16_to_cpu(hdr.seq), len, - le16_to_cpu(hdr.type), hdr.flags); - if (len <= MAX_MBOXITEM_SIZE) { - int n = 0; - unsigned char printbuf[16 * 3 + 2]; - unsigned char databuf[MAX_MBOXITEM_SIZE]; - void __iomem *src = wmi_buffer(wil, d.addr) + - sizeof(struct wil6210_mbox_hdr); - /* - * No need to check @src for validity - - * we already validated @d.addr while - * reading header - */ - wil_memcpy_fromio_32(databuf, src, len); - while (n < len) { - int l = min(len - n, 16); - hex_dump_to_buffer(databuf + n, l, - 16, 1, printbuf, - sizeof(printbuf), - false); - seq_printf(s, " : %s\n", printbuf); - n += l; - } - } - } else { - seq_printf(s, "\n"); - } - } - out: - seq_printf(s, "}\n"); -} - -static int wil_mbox_debugfs_show(struct seq_file *s, void *data) -{ - struct wil6210_priv *wil = s->private; - - wil_print_ring(s, "tx", wil->csr + HOST_MBOX + - offsetof(struct wil6210_mbox_ctl, tx)); - wil_print_ring(s, "rx", wil->csr + HOST_MBOX + - offsetof(struct wil6210_mbox_ctl, rx)); - - return 0; -} - -static int wil_mbox_seq_open(struct inode *inode, struct file *file) -{ - return single_open(file, wil_mbox_debugfs_show, inode->i_private); -} - -static const struct file_operations fops_mbox = { - .open = wil_mbox_seq_open, - .release = single_release, - .read = seq_read, - .llseek = seq_lseek, -}; - -static int wil_debugfs_iomem_x32_set(void *data, u64 val) -{ - iowrite32(val, (void __iomem *)data); - wmb(); /* make sure write propagated to HW */ - - return 0; -} - -static int wil_debugfs_iomem_x32_get(void *data, u64 *val) -{ - *val = ioread32((void __iomem *)data); - - return 0; -} - -DEFINE_SIMPLE_ATTRIBUTE(fops_iomem_x32, wil_debugfs_iomem_x32_get, - wil_debugfs_iomem_x32_set, "0x%08llx\n"); - -static struct dentry *wil_debugfs_create_iomem_x32(const char *name, - mode_t mode, - struct dentry *parent, - void __iomem *value) -{ - return debugfs_create_file(name, mode, parent, (void * __force)value, - &fops_iomem_x32); -} - -static int wil6210_debugfs_create_ISR(struct wil6210_priv *wil, - const char *name, - struct dentry *parent, u32 off) -{ - struct dentry *d = debugfs_create_dir(name, parent); - - if (IS_ERR_OR_NULL(d)) - return -ENODEV; - - wil_debugfs_create_iomem_x32("ICC", S_IRUGO | S_IWUSR, d, - wil->csr + off); - wil_debugfs_create_iomem_x32("ICR", S_IRUGO | S_IWUSR, d, - wil->csr + off + 4); - wil_debugfs_create_iomem_x32("ICM", S_IRUGO | S_IWUSR, d, - wil->csr + off + 8); - wil_debugfs_create_iomem_x32("ICS", S_IWUSR, d, - wil->csr + off + 12); - wil_debugfs_create_iomem_x32("IMV", S_IRUGO | S_IWUSR, d, - wil->csr + off + 16); - wil_debugfs_create_iomem_x32("IMS", S_IWUSR, d, - wil->csr + off + 20); - wil_debugfs_create_iomem_x32("IMC", S_IWUSR, d, - wil->csr + off + 24); - - return 0; -} - -static int wil6210_debugfs_create_pseudo_ISR(struct wil6210_priv *wil, - struct dentry *parent) -{ - struct dentry *d = debugfs_create_dir("PSEUDO_ISR", parent); - - if (IS_ERR_OR_NULL(d)) - return -ENODEV; - - wil_debugfs_create_iomem_x32("CAUSE", S_IRUGO, d, wil->csr + - HOSTADDR(RGF_DMA_PSEUDO_CAUSE)); - wil_debugfs_create_iomem_x32("MASK_SW", S_IRUGO, d, wil->csr + - HOSTADDR(RGF_DMA_PSEUDO_CAUSE_MASK_SW)); - wil_debugfs_create_iomem_x32("MASK_FW", S_IRUGO, d, wil->csr + - HOSTADDR(RGF_DMA_PSEUDO_CAUSE_MASK_FW)); - - return 0; -} - -static int wil6210_debugfs_create_ITR_CNT(struct wil6210_priv *wil, - struct dentry *parent) -{ - struct dentry *d = debugfs_create_dir("ITR_CNT", parent); - - if (IS_ERR_OR_NULL(d)) - return -ENODEV; - - wil_debugfs_create_iomem_x32("TRSH", S_IRUGO, d, wil->csr + - HOSTADDR(RGF_DMA_ITR_CNT_TRSH)); - wil_debugfs_create_iomem_x32("DATA", S_IRUGO, d, wil->csr + - HOSTADDR(RGF_DMA_ITR_CNT_DATA)); - wil_debugfs_create_iomem_x32("CTL", S_IRUGO, d, wil->csr + - HOSTADDR(RGF_DMA_ITR_CNT_CRL)); - - return 0; -} - -static int wil_memread_debugfs_show(struct seq_file *s, void *data) -{ - struct wil6210_priv *wil = s->private; - void __iomem *a = wmi_buffer(wil, cpu_to_le32(mem_addr)); - - if (a) - seq_printf(s, "[0x%08x] = 0x%08x\n", mem_addr, ioread32(a)); - else - seq_printf(s, "[0x%08x] = INVALID\n", mem_addr); - - return 0; -} - -static int wil_memread_seq_open(struct inode *inode, struct file *file) -{ - return single_open(file, wil_memread_debugfs_show, inode->i_private); -} - -static const struct file_operations fops_memread = { - .open = wil_memread_seq_open, - .release = single_release, - .read = seq_read, - .llseek = seq_lseek, -}; - -static int wil_default_open(struct inode *inode, struct file *file) -{ - if (inode->i_private) - file->private_data = inode->i_private; - - return 0; -} - -static ssize_t wil_read_file_ioblob(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - enum { max_count = 4096 }; - struct debugfs_blob_wrapper *blob = file->private_data; - loff_t pos = *ppos; - size_t available = blob->size; - void *buf; - size_t ret; - - if (pos < 0) - return -EINVAL; - - if (pos >= available || !count) - return 0; - - if (count > available - pos) - count = available - pos; - if (count > max_count) - count = max_count; - - buf = kmalloc(count, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - wil_memcpy_fromio_32(buf, (const volatile void __iomem *)blob->data + - pos, count); - - ret = copy_to_user(user_buf, buf, count); - kfree(buf); - if (ret == count) - return -EFAULT; - - count -= ret; - *ppos = pos + count; - - return count; -} - -static const struct file_operations fops_ioblob = { - .read = wil_read_file_ioblob, - .open = wil_default_open, - .llseek = default_llseek, -}; - -static -struct dentry *wil_debugfs_create_ioblob(const char *name, - mode_t mode, - struct dentry *parent, - struct debugfs_blob_wrapper *blob) -{ - return debugfs_create_file(name, mode, parent, blob, &fops_ioblob); -} -/*---reset---*/ -static ssize_t wil_write_file_reset(struct file *file, const char __user *buf, - size_t len, loff_t *ppos) -{ - struct wil6210_priv *wil = file->private_data; - struct net_device *ndev = wil_to_ndev(wil); - - /** - * BUG: - * this code does NOT sync device state with the rest of system - * use with care, debug only!!! - */ - rtnl_lock(); - dev_close(ndev); - ndev->flags &= ~IFF_UP; - rtnl_unlock(); - wil_reset(wil); - - return len; -} - -static const struct file_operations fops_reset = { - .write = wil_write_file_reset, - .open = wil_default_open, -}; -/*---------Tx descriptor------------*/ - -static int wil_txdesc_debugfs_show(struct seq_file *s, void *data) -{ - struct wil6210_priv *wil = s->private; - struct vring *vring = &(wil->vring_tx[0]); - - if (!vring->va) { - seq_printf(s, "No Tx VRING\n"); - return 0; - } - - if (dbg_txdesc_index < vring->size) { - volatile struct vring_tx_desc *d = - &(vring->va[dbg_txdesc_index].tx); - volatile u32 *u = (volatile u32 *)d; - struct sk_buff *skb = vring->ctx[dbg_txdesc_index]; - - seq_printf(s, "Tx[%3d] = {\n", dbg_txdesc_index); - seq_printf(s, " MAC = 0x%08x 0x%08x 0x%08x 0x%08x\n", - u[0], u[1], u[2], u[3]); - seq_printf(s, " DMA = 0x%08x 0x%08x 0x%08x 0x%08x\n", - u[4], u[5], u[6], u[7]); - seq_printf(s, " SKB = %p\n", skb); - - if (skb) { - unsigned char printbuf[16 * 3 + 2]; - int i = 0; - int len = skb_headlen(skb); - void *p = skb->data; - - seq_printf(s, " len = %d\n", len); - - while (i < len) { - int l = min(len - i, 16); - hex_dump_to_buffer(p + i, l, 16, 1, printbuf, - sizeof(printbuf), false); - seq_printf(s, " : %s\n", printbuf); - i += l; - } - } - seq_printf(s, "}\n"); - } else { - seq_printf(s, "TxDesc index (%d) >= size (%d)\n", - dbg_txdesc_index, vring->size); - } - - return 0; -} - -static int wil_txdesc_seq_open(struct inode *inode, struct file *file) -{ - return single_open(file, wil_txdesc_debugfs_show, inode->i_private); -} - -static const struct file_operations fops_txdesc = { - .open = wil_txdesc_seq_open, - .release = single_release, - .read = seq_read, - .llseek = seq_lseek, -}; - -/*---------beamforming------------*/ -static int wil_bf_debugfs_show(struct seq_file *s, void *data) -{ - struct wil6210_priv *wil = s->private; - seq_printf(s, - "TSF : 0x%016llx\n" - "TxMCS : %d\n" - "Sectors(rx:tx) my %2d:%2d peer %2d:%2d\n", - wil->stats.tsf, wil->stats.bf_mcs, - wil->stats.my_rx_sector, wil->stats.my_tx_sector, - wil->stats.peer_rx_sector, wil->stats.peer_tx_sector); - return 0; -} - -static int wil_bf_seq_open(struct inode *inode, struct file *file) -{ - return single_open(file, wil_bf_debugfs_show, inode->i_private); -} - -static const struct file_operations fops_bf = { - .open = wil_bf_seq_open, - .release = single_release, - .read = seq_read, - .llseek = seq_lseek, -}; -/*---------SSID------------*/ -static ssize_t wil_read_file_ssid(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct wil6210_priv *wil = file->private_data; - struct wireless_dev *wdev = wil_to_wdev(wil); - - return simple_read_from_buffer(user_buf, count, ppos, - wdev->ssid, wdev->ssid_len); -} - -static ssize_t wil_write_file_ssid(struct file *file, const char __user *buf, - size_t count, loff_t *ppos) -{ - struct wil6210_priv *wil = file->private_data; - struct wireless_dev *wdev = wil_to_wdev(wil); - struct net_device *ndev = wil_to_ndev(wil); - - if (*ppos != 0) { - wil_err(wil, "Unable to set SSID substring from [%d]\n", - (int)*ppos); - return -EINVAL; - } - - if (count > sizeof(wdev->ssid)) { - wil_err(wil, "SSID too long, len = %d\n", (int)count); - return -EINVAL; - } - if (netif_running(ndev)) { - wil_err(wil, "Unable to change SSID on running interface\n"); - return -EINVAL; - } - - wdev->ssid_len = count; - return simple_write_to_buffer(wdev->ssid, wdev->ssid_len, ppos, - buf, count); -} - -static const struct file_operations fops_ssid = { - .read = wil_read_file_ssid, - .write = wil_write_file_ssid, - .open = wil_default_open, -}; - -/*----------------*/ -int wil6210_debugfs_init(struct wil6210_priv *wil) -{ - struct dentry *dbg = wil->debug = debugfs_create_dir(WIL_NAME, - wil_to_wiphy(wil)->debugfsdir); - - if (IS_ERR_OR_NULL(dbg)) - return -ENODEV; - - debugfs_create_file("mbox", S_IRUGO, dbg, wil, &fops_mbox); - debugfs_create_file("vrings", S_IRUGO, dbg, wil, &fops_vring); - debugfs_create_file("txdesc", S_IRUGO, dbg, wil, &fops_txdesc); - debugfs_create_u32("txdesc_index", S_IRUGO | S_IWUSR, dbg, - &dbg_txdesc_index); - debugfs_create_file("bf", S_IRUGO, dbg, wil, &fops_bf); - debugfs_create_file("ssid", S_IRUGO | S_IWUSR, dbg, wil, &fops_ssid); - debugfs_create_u32("secure_pcp", S_IRUGO | S_IWUSR, dbg, - &wil->secure_pcp); - - wil6210_debugfs_create_ISR(wil, "USER_ICR", dbg, - HOSTADDR(RGF_USER_USER_ICR)); - wil6210_debugfs_create_ISR(wil, "DMA_EP_TX_ICR", dbg, - HOSTADDR(RGF_DMA_EP_TX_ICR)); - wil6210_debugfs_create_ISR(wil, "DMA_EP_RX_ICR", dbg, - HOSTADDR(RGF_DMA_EP_RX_ICR)); - wil6210_debugfs_create_ISR(wil, "DMA_EP_MISC_ICR", dbg, - HOSTADDR(RGF_DMA_EP_MISC_ICR)); - wil6210_debugfs_create_pseudo_ISR(wil, dbg); - wil6210_debugfs_create_ITR_CNT(wil, dbg); - - debugfs_create_u32("mem_addr", S_IRUGO | S_IWUSR, dbg, &mem_addr); - debugfs_create_file("mem_val", S_IRUGO, dbg, wil, &fops_memread); - - debugfs_create_file("reset", S_IWUSR, dbg, wil, &fops_reset); - - wil->rgf_blob.data = (void * __force)wil->csr + 0; - wil->rgf_blob.size = 0xa000; - wil_debugfs_create_ioblob("blob_rgf", S_IRUGO, dbg, &wil->rgf_blob); - - wil->fw_code_blob.data = (void * __force)wil->csr + 0x40000; - wil->fw_code_blob.size = 0x40000; - wil_debugfs_create_ioblob("blob_fw_code", S_IRUGO, dbg, - &wil->fw_code_blob); - - wil->fw_data_blob.data = (void * __force)wil->csr + 0x80000; - wil->fw_data_blob.size = 0x8000; - wil_debugfs_create_ioblob("blob_fw_data", S_IRUGO, dbg, - &wil->fw_data_blob); - - wil->fw_peri_blob.data = (void * __force)wil->csr + 0x88000; - wil->fw_peri_blob.size = 0x18000; - wil_debugfs_create_ioblob("blob_fw_peri", S_IRUGO, dbg, - &wil->fw_peri_blob); - - wil->uc_code_blob.data = (void * __force)wil->csr + 0xa0000; - wil->uc_code_blob.size = 0x10000; - wil_debugfs_create_ioblob("blob_uc_code", S_IRUGO, dbg, - &wil->uc_code_blob); - - wil->uc_data_blob.data = (void * __force)wil->csr + 0xb0000; - wil->uc_data_blob.size = 0x4000; - wil_debugfs_create_ioblob("blob_uc_data", S_IRUGO, dbg, - &wil->uc_data_blob); - - return 0; -} - -void wil6210_debugfs_remove(struct wil6210_priv *wil) -{ - debugfs_remove_recursive(wil->debug); - wil->debug = NULL; -} diff --git a/trunk/drivers/net/wireless/ath/wil6210/interrupt.c b/trunk/drivers/net/wireless/ath/wil6210/interrupt.c deleted file mode 100644 index 38049da71049..000000000000 --- a/trunk/drivers/net/wireless/ath/wil6210/interrupt.c +++ /dev/null @@ -1,471 +0,0 @@ -/* - * Copyright (c) 2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include - -#include "wil6210.h" - -/** - * Theory of operation: - * - * There is ISR pseudo-cause register, - * dma_rgf->DMA_RGF.PSEUDO_CAUSE.PSEUDO_CAUSE - * Its bits represents OR'ed bits from 3 real ISR registers: - * TX, RX, and MISC. - * - * Registers may be configured to either "write 1 to clear" or - * "clear on read" mode - * - * When handling interrupt, one have to mask/unmask interrupts for the - * real ISR registers, or hardware may malfunction. - * - */ - -#define WIL6210_IRQ_DISABLE (0xFFFFFFFFUL) -#define WIL6210_IMC_RX BIT_DMA_EP_RX_ICR_RX_DONE -#define WIL6210_IMC_TX (BIT_DMA_EP_TX_ICR_TX_DONE | \ - BIT_DMA_EP_TX_ICR_TX_DONE_N(0)) -#define WIL6210_IMC_MISC (ISR_MISC_FW_READY | ISR_MISC_MBOX_EVT) - -#define WIL6210_IRQ_PSEUDO_MASK (u32)(~(BIT_DMA_PSEUDO_CAUSE_RX | \ - BIT_DMA_PSEUDO_CAUSE_TX | \ - BIT_DMA_PSEUDO_CAUSE_MISC)) - -#if defined(CONFIG_WIL6210_ISR_COR) -/* configure to Clear-On-Read mode */ -#define WIL_ICR_ICC_VALUE (0xFFFFFFFFUL) - -static inline void wil_icr_clear(u32 x, void __iomem *addr) -{ - -} -#else /* defined(CONFIG_WIL6210_ISR_COR) */ -/* configure to Write-1-to-Clear mode */ -#define WIL_ICR_ICC_VALUE (0UL) - -static inline void wil_icr_clear(u32 x, void __iomem *addr) -{ - iowrite32(x, addr); -} -#endif /* defined(CONFIG_WIL6210_ISR_COR) */ - -static inline u32 wil_ioread32_and_clear(void __iomem *addr) -{ - u32 x = ioread32(addr); - - wil_icr_clear(x, addr); - - return x; -} - -static void wil6210_mask_irq_tx(struct wil6210_priv *wil) -{ - iowrite32(WIL6210_IRQ_DISABLE, wil->csr + - HOSTADDR(RGF_DMA_EP_TX_ICR) + - offsetof(struct RGF_ICR, IMS)); -} - -static void wil6210_mask_irq_rx(struct wil6210_priv *wil) -{ - iowrite32(WIL6210_IRQ_DISABLE, wil->csr + - HOSTADDR(RGF_DMA_EP_RX_ICR) + - offsetof(struct RGF_ICR, IMS)); -} - -static void wil6210_mask_irq_misc(struct wil6210_priv *wil) -{ - iowrite32(WIL6210_IRQ_DISABLE, wil->csr + - HOSTADDR(RGF_DMA_EP_MISC_ICR) + - offsetof(struct RGF_ICR, IMS)); -} - -static void wil6210_mask_irq_pseudo(struct wil6210_priv *wil) -{ - wil_dbg_IRQ(wil, "%s()\n", __func__); - - iowrite32(WIL6210_IRQ_DISABLE, wil->csr + - HOSTADDR(RGF_DMA_PSEUDO_CAUSE_MASK_SW)); - - clear_bit(wil_status_irqen, &wil->status); -} - -static void wil6210_unmask_irq_tx(struct wil6210_priv *wil) -{ - iowrite32(WIL6210_IMC_TX, wil->csr + - HOSTADDR(RGF_DMA_EP_TX_ICR) + - offsetof(struct RGF_ICR, IMC)); -} - -static void wil6210_unmask_irq_rx(struct wil6210_priv *wil) -{ - iowrite32(WIL6210_IMC_RX, wil->csr + - HOSTADDR(RGF_DMA_EP_RX_ICR) + - offsetof(struct RGF_ICR, IMC)); -} - -static void wil6210_unmask_irq_misc(struct wil6210_priv *wil) -{ - iowrite32(WIL6210_IMC_MISC, wil->csr + - HOSTADDR(RGF_DMA_EP_MISC_ICR) + - offsetof(struct RGF_ICR, IMC)); -} - -static void wil6210_unmask_irq_pseudo(struct wil6210_priv *wil) -{ - wil_dbg_IRQ(wil, "%s()\n", __func__); - - set_bit(wil_status_irqen, &wil->status); - - iowrite32(WIL6210_IRQ_PSEUDO_MASK, wil->csr + - HOSTADDR(RGF_DMA_PSEUDO_CAUSE_MASK_SW)); -} - -void wil6210_disable_irq(struct wil6210_priv *wil) -{ - wil_dbg_IRQ(wil, "%s()\n", __func__); - - wil6210_mask_irq_tx(wil); - wil6210_mask_irq_rx(wil); - wil6210_mask_irq_misc(wil); - wil6210_mask_irq_pseudo(wil); -} - -void wil6210_enable_irq(struct wil6210_priv *wil) -{ - wil_dbg_IRQ(wil, "%s()\n", __func__); - - iowrite32(WIL_ICR_ICC_VALUE, wil->csr + HOSTADDR(RGF_DMA_EP_RX_ICR) + - offsetof(struct RGF_ICR, ICC)); - iowrite32(WIL_ICR_ICC_VALUE, wil->csr + HOSTADDR(RGF_DMA_EP_TX_ICR) + - offsetof(struct RGF_ICR, ICC)); - iowrite32(WIL_ICR_ICC_VALUE, wil->csr + HOSTADDR(RGF_DMA_EP_MISC_ICR) + - offsetof(struct RGF_ICR, ICC)); - - wil6210_unmask_irq_pseudo(wil); - wil6210_unmask_irq_tx(wil); - wil6210_unmask_irq_rx(wil); - wil6210_unmask_irq_misc(wil); -} - -static irqreturn_t wil6210_irq_rx(int irq, void *cookie) -{ - struct wil6210_priv *wil = cookie; - u32 isr = wil_ioread32_and_clear(wil->csr + - HOSTADDR(RGF_DMA_EP_RX_ICR) + - offsetof(struct RGF_ICR, ICR)); - - wil_dbg_IRQ(wil, "ISR RX 0x%08x\n", isr); - - if (!isr) { - wil_err(wil, "spurious IRQ: RX\n"); - return IRQ_NONE; - } - - wil6210_mask_irq_rx(wil); - - if (isr & BIT_DMA_EP_RX_ICR_RX_DONE) { - wil_dbg_IRQ(wil, "RX done\n"); - isr &= ~BIT_DMA_EP_RX_ICR_RX_DONE; - wil_rx_handle(wil); - } - - if (isr) - wil_err(wil, "un-handled RX ISR bits 0x%08x\n", isr); - - wil6210_unmask_irq_rx(wil); - - return IRQ_HANDLED; -} - -static irqreturn_t wil6210_irq_tx(int irq, void *cookie) -{ - struct wil6210_priv *wil = cookie; - u32 isr = wil_ioread32_and_clear(wil->csr + - HOSTADDR(RGF_DMA_EP_TX_ICR) + - offsetof(struct RGF_ICR, ICR)); - - wil_dbg_IRQ(wil, "ISR TX 0x%08x\n", isr); - - if (!isr) { - wil_err(wil, "spurious IRQ: TX\n"); - return IRQ_NONE; - } - - wil6210_mask_irq_tx(wil); - - if (isr & BIT_DMA_EP_TX_ICR_TX_DONE) { - uint i; - wil_dbg_IRQ(wil, "TX done\n"); - isr &= ~BIT_DMA_EP_TX_ICR_TX_DONE; - for (i = 0; i < 24; i++) { - u32 mask = BIT_DMA_EP_TX_ICR_TX_DONE_N(i); - if (isr & mask) { - isr &= ~mask; - wil_dbg_IRQ(wil, "TX done(%i)\n", i); - wil_tx_complete(wil, i); - } - } - } - - if (isr) - wil_err(wil, "un-handled TX ISR bits 0x%08x\n", isr); - - wil6210_unmask_irq_tx(wil); - - return IRQ_HANDLED; -} - -static irqreturn_t wil6210_irq_misc(int irq, void *cookie) -{ - struct wil6210_priv *wil = cookie; - u32 isr = wil_ioread32_and_clear(wil->csr + - HOSTADDR(RGF_DMA_EP_MISC_ICR) + - offsetof(struct RGF_ICR, ICR)); - - wil_dbg_IRQ(wil, "ISR MISC 0x%08x\n", isr); - - if (!isr) { - wil_err(wil, "spurious IRQ: MISC\n"); - return IRQ_NONE; - } - - wil6210_mask_irq_misc(wil); - - if (isr & ISR_MISC_FW_READY) { - wil_dbg_IRQ(wil, "IRQ: FW ready\n"); - /** - * Actual FW ready indicated by the - * WMI_FW_READY_EVENTID - */ - isr &= ~ISR_MISC_FW_READY; - } - - wil->isr_misc = isr; - - if (isr) { - return IRQ_WAKE_THREAD; - } else { - wil6210_unmask_irq_misc(wil); - return IRQ_HANDLED; - } -} - -static irqreturn_t wil6210_irq_misc_thread(int irq, void *cookie) -{ - struct wil6210_priv *wil = cookie; - u32 isr = wil->isr_misc; - - wil_dbg_IRQ(wil, "Thread ISR MISC 0x%08x\n", isr); - - if (isr & ISR_MISC_MBOX_EVT) { - wil_dbg_IRQ(wil, "MBOX event\n"); - wmi_recv_cmd(wil); - isr &= ~ISR_MISC_MBOX_EVT; - } - - if (isr) - wil_err(wil, "un-handled MISC ISR bits 0x%08x\n", isr); - - wil->isr_misc = 0; - - wil6210_unmask_irq_misc(wil); - - return IRQ_HANDLED; -} - -/** - * thread IRQ handler - */ -static irqreturn_t wil6210_thread_irq(int irq, void *cookie) -{ - struct wil6210_priv *wil = cookie; - - wil_dbg_IRQ(wil, "Thread IRQ\n"); - /* Discover real IRQ cause */ - if (wil->isr_misc) - wil6210_irq_misc_thread(irq, cookie); - - wil6210_unmask_irq_pseudo(wil); - - return IRQ_HANDLED; -} - -/* DEBUG - * There is subtle bug in hardware that causes IRQ to raise when it should be - * masked. It is quite rare and hard to debug. - * - * Catch irq issue if it happens and print all I can. - */ -static int wil6210_debug_irq_mask(struct wil6210_priv *wil, u32 pseudo_cause) -{ - if (!test_bit(wil_status_irqen, &wil->status)) { - u32 icm_rx = wil_ioread32_and_clear(wil->csr + - HOSTADDR(RGF_DMA_EP_RX_ICR) + - offsetof(struct RGF_ICR, ICM)); - u32 icr_rx = wil_ioread32_and_clear(wil->csr + - HOSTADDR(RGF_DMA_EP_RX_ICR) + - offsetof(struct RGF_ICR, ICR)); - u32 imv_rx = ioread32(wil->csr + - HOSTADDR(RGF_DMA_EP_RX_ICR) + - offsetof(struct RGF_ICR, IMV)); - u32 icm_tx = wil_ioread32_and_clear(wil->csr + - HOSTADDR(RGF_DMA_EP_TX_ICR) + - offsetof(struct RGF_ICR, ICM)); - u32 icr_tx = wil_ioread32_and_clear(wil->csr + - HOSTADDR(RGF_DMA_EP_TX_ICR) + - offsetof(struct RGF_ICR, ICR)); - u32 imv_tx = ioread32(wil->csr + - HOSTADDR(RGF_DMA_EP_TX_ICR) + - offsetof(struct RGF_ICR, IMV)); - u32 icm_misc = wil_ioread32_and_clear(wil->csr + - HOSTADDR(RGF_DMA_EP_MISC_ICR) + - offsetof(struct RGF_ICR, ICM)); - u32 icr_misc = wil_ioread32_and_clear(wil->csr + - HOSTADDR(RGF_DMA_EP_MISC_ICR) + - offsetof(struct RGF_ICR, ICR)); - u32 imv_misc = ioread32(wil->csr + - HOSTADDR(RGF_DMA_EP_MISC_ICR) + - offsetof(struct RGF_ICR, IMV)); - wil_err(wil, "IRQ when it should be masked: pseudo 0x%08x\n" - "Rx icm:icr:imv 0x%08x 0x%08x 0x%08x\n" - "Tx icm:icr:imv 0x%08x 0x%08x 0x%08x\n" - "Misc icm:icr:imv 0x%08x 0x%08x 0x%08x\n", - pseudo_cause, - icm_rx, icr_rx, imv_rx, - icm_tx, icr_tx, imv_tx, - icm_misc, icr_misc, imv_misc); - - return -EINVAL; - } - - return 0; -} - -static irqreturn_t wil6210_hardirq(int irq, void *cookie) -{ - irqreturn_t rc = IRQ_HANDLED; - struct wil6210_priv *wil = cookie; - u32 pseudo_cause = ioread32(wil->csr + HOSTADDR(RGF_DMA_PSEUDO_CAUSE)); - - /** - * pseudo_cause is Clear-On-Read, no need to ACK - */ - if ((pseudo_cause == 0) || ((pseudo_cause & 0xff) == 0xff)) - return IRQ_NONE; - - /* FIXME: IRQ mask debug */ - if (wil6210_debug_irq_mask(wil, pseudo_cause)) - return IRQ_NONE; - - wil6210_mask_irq_pseudo(wil); - - /* Discover real IRQ cause - * There are 2 possible phases for every IRQ: - * - hard IRQ handler called right here - * - threaded handler called later - * - * Hard IRQ handler reads and clears ISR. - * - * If threaded handler requested, hard IRQ handler - * returns IRQ_WAKE_THREAD and saves ISR register value - * for the threaded handler use. - * - * voting for wake thread - need at least 1 vote - */ - if ((pseudo_cause & BIT_DMA_PSEUDO_CAUSE_RX) && - (wil6210_irq_rx(irq, cookie) == IRQ_WAKE_THREAD)) - rc = IRQ_WAKE_THREAD; - - if ((pseudo_cause & BIT_DMA_PSEUDO_CAUSE_TX) && - (wil6210_irq_tx(irq, cookie) == IRQ_WAKE_THREAD)) - rc = IRQ_WAKE_THREAD; - - if ((pseudo_cause & BIT_DMA_PSEUDO_CAUSE_MISC) && - (wil6210_irq_misc(irq, cookie) == IRQ_WAKE_THREAD)) - rc = IRQ_WAKE_THREAD; - - /* if thread is requested, it will unmask IRQ */ - if (rc != IRQ_WAKE_THREAD) - wil6210_unmask_irq_pseudo(wil); - - wil_dbg_IRQ(wil, "Hard IRQ 0x%08x\n", pseudo_cause); - - return rc; -} - -static int wil6210_request_3msi(struct wil6210_priv *wil, int irq) -{ - int rc; - /* - * IRQ's are in the following order: - * - Tx - * - Rx - * - Misc - */ - - rc = request_irq(irq, wil6210_irq_tx, IRQF_SHARED, - WIL_NAME"_tx", wil); - if (rc) - return rc; - - rc = request_irq(irq + 1, wil6210_irq_rx, IRQF_SHARED, - WIL_NAME"_rx", wil); - if (rc) - goto free0; - - rc = request_threaded_irq(irq + 2, wil6210_irq_misc, - wil6210_irq_misc_thread, - IRQF_SHARED, WIL_NAME"_misc", wil); - if (rc) - goto free1; - - return 0; - /* error branch */ -free1: - free_irq(irq + 1, wil); -free0: - free_irq(irq, wil); - - return rc; -} - -int wil6210_init_irq(struct wil6210_priv *wil, int irq) -{ - int rc; - if (wil->n_msi == 3) - rc = wil6210_request_3msi(wil, irq); - else - rc = request_threaded_irq(irq, wil6210_hardirq, - wil6210_thread_irq, - wil->n_msi ? 0 : IRQF_SHARED, - WIL_NAME, wil); - if (rc) - return rc; - - wil6210_enable_irq(wil); - - return 0; -} - -void wil6210_fini_irq(struct wil6210_priv *wil, int irq) -{ - wil6210_disable_irq(wil); - free_irq(irq, wil); - if (wil->n_msi == 3) { - free_irq(irq + 1, wil); - free_irq(irq + 2, wil); - } -} diff --git a/trunk/drivers/net/wireless/ath/wil6210/main.c b/trunk/drivers/net/wireless/ath/wil6210/main.c deleted file mode 100644 index 95fcd361322b..000000000000 --- a/trunk/drivers/net/wireless/ath/wil6210/main.c +++ /dev/null @@ -1,407 +0,0 @@ -/* - * Copyright (c) 2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "wil6210.h" - -/* - * Due to a hardware issue, - * one has to read/write to/from NIC in 32-bit chunks; - * regular memcpy_fromio and siblings will - * not work on 64-bit platform - it uses 64-bit transactions - * - * Force 32-bit transactions to enable NIC on 64-bit platforms - * - * To avoid byte swap on big endian host, __raw_{read|write}l - * should be used - {read|write}l would swap bytes to provide - * little endian on PCI value in host endianness. - */ -void wil_memcpy_fromio_32(void *dst, const volatile void __iomem *src, - size_t count) -{ - u32 *d = dst; - const volatile u32 __iomem *s = src; - - /* size_t is unsigned, if (count%4 != 0) it will wrap */ - for (count += 4; count > 4; count -= 4) - *d++ = __raw_readl(s++); -} - -void wil_memcpy_toio_32(volatile void __iomem *dst, const void *src, - size_t count) -{ - volatile u32 __iomem *d = dst; - const u32 *s = src; - - for (count += 4; count > 4; count -= 4) - __raw_writel(*s++, d++); -} - -static void _wil6210_disconnect(struct wil6210_priv *wil, void *bssid) -{ - uint i; - struct net_device *ndev = wil_to_ndev(wil); - struct wireless_dev *wdev = wil->wdev; - - wil_dbg(wil, "%s()\n", __func__); - - wil_link_off(wil); - clear_bit(wil_status_fwconnected, &wil->status); - - switch (wdev->sme_state) { - case CFG80211_SME_CONNECTED: - cfg80211_disconnected(ndev, WLAN_STATUS_UNSPECIFIED_FAILURE, - NULL, 0, GFP_KERNEL); - break; - case CFG80211_SME_CONNECTING: - cfg80211_connect_result(ndev, bssid, NULL, 0, NULL, 0, - WLAN_STATUS_UNSPECIFIED_FAILURE, - GFP_KERNEL); - break; - default: - ; - } - - for (i = 0; i < ARRAY_SIZE(wil->vring_tx); i++) - wil_vring_fini_tx(wil, i); -} - -static void wil_disconnect_worker(struct work_struct *work) -{ - struct wil6210_priv *wil = container_of(work, - struct wil6210_priv, disconnect_worker); - - _wil6210_disconnect(wil, NULL); -} - -static void wil_connect_timer_fn(ulong x) -{ - struct wil6210_priv *wil = (void *)x; - - wil_dbg(wil, "Connect timeout\n"); - - /* reschedule to thread context - disconnect won't - * run from atomic context - */ - schedule_work(&wil->disconnect_worker); -} - -int wil_priv_init(struct wil6210_priv *wil) -{ - wil_dbg(wil, "%s()\n", __func__); - - mutex_init(&wil->mutex); - mutex_init(&wil->wmi_mutex); - - init_completion(&wil->wmi_ready); - - wil->pending_connect_cid = -1; - setup_timer(&wil->connect_timer, wil_connect_timer_fn, (ulong)wil); - - INIT_WORK(&wil->wmi_connect_worker, wmi_connect_worker); - INIT_WORK(&wil->disconnect_worker, wil_disconnect_worker); - INIT_WORK(&wil->wmi_event_worker, wmi_event_worker); - - INIT_LIST_HEAD(&wil->pending_wmi_ev); - spin_lock_init(&wil->wmi_ev_lock); - - wil->wmi_wq = create_singlethread_workqueue(WIL_NAME"_wmi"); - if (!wil->wmi_wq) - return -EAGAIN; - - wil->wmi_wq_conn = create_singlethread_workqueue(WIL_NAME"_connect"); - if (!wil->wmi_wq_conn) { - destroy_workqueue(wil->wmi_wq); - return -EAGAIN; - } - - /* make shadow copy of registers that should not change on run time */ - wil_memcpy_fromio_32(&wil->mbox_ctl, wil->csr + HOST_MBOX, - sizeof(struct wil6210_mbox_ctl)); - wil_mbox_ring_le2cpus(&wil->mbox_ctl.rx); - wil_mbox_ring_le2cpus(&wil->mbox_ctl.tx); - - return 0; -} - -void wil6210_disconnect(struct wil6210_priv *wil, void *bssid) -{ - del_timer_sync(&wil->connect_timer); - _wil6210_disconnect(wil, bssid); -} - -void wil_priv_deinit(struct wil6210_priv *wil) -{ - cancel_work_sync(&wil->disconnect_worker); - wil6210_disconnect(wil, NULL); - wmi_event_flush(wil); - destroy_workqueue(wil->wmi_wq_conn); - destroy_workqueue(wil->wmi_wq); -} - -static void wil_target_reset(struct wil6210_priv *wil) -{ - wil_dbg(wil, "Resetting...\n"); - - /* register write */ -#define W(a, v) iowrite32(v, wil->csr + HOSTADDR(a)) - /* register set = read, OR, write */ -#define S(a, v) iowrite32(ioread32(wil->csr + HOSTADDR(a)) | v, \ - wil->csr + HOSTADDR(a)) - - /* hpal_perst_from_pad_src_n_mask */ - S(RGF_USER_CLKS_CTL_SW_RST_MASK_0, BIT(6)); - /* car_perst_rst_src_n_mask */ - S(RGF_USER_CLKS_CTL_SW_RST_MASK_0, BIT(7)); - - W(RGF_USER_MAC_CPU_0, BIT(1)); /* mac_cpu_man_rst */ - W(RGF_USER_USER_CPU_0, BIT(1)); /* user_cpu_man_rst */ - - msleep(100); - - W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0xFE000000); - W(RGF_USER_CLKS_CTL_SW_RST_VEC_1, 0x0000003F); - W(RGF_USER_CLKS_CTL_SW_RST_VEC_3, 0x00000170); - W(RGF_USER_CLKS_CTL_SW_RST_VEC_0, 0xFFE7FC00); - - msleep(100); - - W(RGF_USER_CLKS_CTL_SW_RST_VEC_3, 0); - W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0); - W(RGF_USER_CLKS_CTL_SW_RST_VEC_1, 0); - W(RGF_USER_CLKS_CTL_SW_RST_VEC_0, 0); - - W(RGF_USER_CLKS_CTL_SW_RST_VEC_3, 0x00000001); - W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0x00000080); - W(RGF_USER_CLKS_CTL_SW_RST_VEC_0, 0); - - msleep(2000); - - W(RGF_USER_USER_CPU_0, BIT(0)); /* user_cpu_man_de_rst */ - - msleep(2000); - - wil_dbg(wil, "Reset completed\n"); - -#undef W -#undef S -} - -void wil_mbox_ring_le2cpus(struct wil6210_mbox_ring *r) -{ - le32_to_cpus(&r->base); - le16_to_cpus(&r->entry_size); - le16_to_cpus(&r->size); - le32_to_cpus(&r->tail); - le32_to_cpus(&r->head); -} - -static int wil_wait_for_fw_ready(struct wil6210_priv *wil) -{ - ulong to = msecs_to_jiffies(1000); - ulong left = wait_for_completion_timeout(&wil->wmi_ready, to); - if (0 == left) { - wil_err(wil, "Firmware not ready\n"); - return -ETIME; - } else { - wil_dbg(wil, "FW ready after %d ms\n", - jiffies_to_msecs(to-left)); - } - return 0; -} - -/* - * We reset all the structures, and we reset the UMAC. - * After calling this routine, you're expected to reload - * the firmware. - */ -int wil_reset(struct wil6210_priv *wil) -{ - int rc; - - cancel_work_sync(&wil->disconnect_worker); - wil6210_disconnect(wil, NULL); - - wmi_event_flush(wil); - - flush_workqueue(wil->wmi_wq); - flush_workqueue(wil->wmi_wq_conn); - - wil6210_disable_irq(wil); - wil->status = 0; - - /* TODO: put MAC in reset */ - wil_target_reset(wil); - - /* init after reset */ - wil->pending_connect_cid = -1; - INIT_COMPLETION(wil->wmi_ready); - - /* make shadow copy of registers that should not change on run time */ - wil_memcpy_fromio_32(&wil->mbox_ctl, wil->csr + HOST_MBOX, - sizeof(struct wil6210_mbox_ctl)); - wil_mbox_ring_le2cpus(&wil->mbox_ctl.rx); - wil_mbox_ring_le2cpus(&wil->mbox_ctl.tx); - - /* TODO: release MAC reset */ - wil6210_enable_irq(wil); - - /* we just started MAC, wait for FW ready */ - rc = wil_wait_for_fw_ready(wil); - - return rc; -} - - -void wil_link_on(struct wil6210_priv *wil) -{ - struct net_device *ndev = wil_to_ndev(wil); - - wil_dbg(wil, "%s()\n", __func__); - - netif_carrier_on(ndev); - netif_tx_wake_all_queues(ndev); -} - -void wil_link_off(struct wil6210_priv *wil) -{ - struct net_device *ndev = wil_to_ndev(wil); - - wil_dbg(wil, "%s()\n", __func__); - - netif_tx_stop_all_queues(ndev); - netif_carrier_off(ndev); -} - -static int __wil_up(struct wil6210_priv *wil) -{ - struct net_device *ndev = wil_to_ndev(wil); - struct wireless_dev *wdev = wil->wdev; - struct ieee80211_channel *channel = wdev->preset_chandef.chan; - int rc; - int bi; - u16 wmi_nettype = wil_iftype_nl2wmi(wdev->iftype); - - rc = wil_reset(wil); - if (rc) - return rc; - - /* FIXME Firmware works now in PBSS mode(ToDS=0, FromDS=0) */ - wmi_nettype = wil_iftype_nl2wmi(NL80211_IFTYPE_ADHOC); - switch (wdev->iftype) { - case NL80211_IFTYPE_STATION: - wil_dbg(wil, "type: STATION\n"); - bi = 0; - ndev->type = ARPHRD_ETHER; - break; - case NL80211_IFTYPE_AP: - wil_dbg(wil, "type: AP\n"); - bi = 100; - ndev->type = ARPHRD_ETHER; - break; - case NL80211_IFTYPE_P2P_CLIENT: - wil_dbg(wil, "type: P2P_CLIENT\n"); - bi = 0; - ndev->type = ARPHRD_ETHER; - break; - case NL80211_IFTYPE_P2P_GO: - wil_dbg(wil, "type: P2P_GO\n"); - bi = 100; - ndev->type = ARPHRD_ETHER; - break; - case NL80211_IFTYPE_MONITOR: - wil_dbg(wil, "type: Monitor\n"); - bi = 0; - ndev->type = ARPHRD_IEEE80211_RADIOTAP; - /* ARPHRD_IEEE80211 or ARPHRD_IEEE80211_RADIOTAP ? */ - break; - default: - return -EOPNOTSUPP; - } - - /* Apply profile in the following order: */ - /* SSID and channel for the AP */ - switch (wdev->iftype) { - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_P2P_GO: - if (wdev->ssid_len == 0) { - wil_err(wil, "SSID not set\n"); - return -EINVAL; - } - wmi_set_ssid(wil, wdev->ssid_len, wdev->ssid); - if (channel) - wmi_set_channel(wil, channel->hw_value); - break; - default: - ; - } - - /* MAC address - pre-requisite for other commands */ - wmi_set_mac_address(wil, ndev->dev_addr); - - /* Set up beaconing if required. */ - rc = wmi_set_bcon(wil, bi, wmi_nettype); - if (rc) - return rc; - - /* Rx VRING. After MAC and beacon */ - wil_rx_init(wil); - - return 0; -} - -int wil_up(struct wil6210_priv *wil) -{ - int rc; - - mutex_lock(&wil->mutex); - rc = __wil_up(wil); - mutex_unlock(&wil->mutex); - - return rc; -} - -static int __wil_down(struct wil6210_priv *wil) -{ - if (wil->scan_request) { - cfg80211_scan_done(wil->scan_request, true); - wil->scan_request = NULL; - } - - wil6210_disconnect(wil, NULL); - wil_rx_fini(wil); - - return 0; -} - -int wil_down(struct wil6210_priv *wil) -{ - int rc; - - mutex_lock(&wil->mutex); - rc = __wil_down(wil); - mutex_unlock(&wil->mutex); - - return rc; -} diff --git a/trunk/drivers/net/wireless/ath/wil6210/netdev.c b/trunk/drivers/net/wireless/ath/wil6210/netdev.c deleted file mode 100644 index 3068b5cb53a7..000000000000 --- a/trunk/drivers/net/wireless/ath/wil6210/netdev.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - -#include "wil6210.h" - -static int wil_open(struct net_device *ndev) -{ - struct wil6210_priv *wil = ndev_to_wil(ndev); - - return wil_up(wil); -} - -static int wil_stop(struct net_device *ndev) -{ - struct wil6210_priv *wil = ndev_to_wil(ndev); - - return wil_down(wil); -} - -/* - * AC to queue mapping - * - * AC_VO -> queue 3 - * AC_VI -> queue 2 - * AC_BE -> queue 1 - * AC_BK -> queue 0 - */ -static u16 wil_select_queue(struct net_device *ndev, struct sk_buff *skb) -{ - static const u16 wil_1d_to_queue[8] = { 1, 0, 0, 1, 2, 2, 3, 3 }; - struct wil6210_priv *wil = ndev_to_wil(ndev); - u16 rc; - - skb->priority = cfg80211_classify8021d(skb); - - rc = wil_1d_to_queue[skb->priority]; - - wil_dbg_TXRX(wil, "%s() %d -> %d\n", __func__, (int)skb->priority, - (int)rc); - - return rc; -} - -static const struct net_device_ops wil_netdev_ops = { - .ndo_open = wil_open, - .ndo_stop = wil_stop, - .ndo_start_xmit = wil_start_xmit, - .ndo_select_queue = wil_select_queue, - .ndo_set_mac_address = eth_mac_addr, - .ndo_validate_addr = eth_validate_addr, -}; - -void *wil_if_alloc(struct device *dev, void __iomem *csr) -{ - struct net_device *ndev; - struct wireless_dev *wdev; - struct wil6210_priv *wil; - struct ieee80211_channel *ch; - int rc = 0; - - wdev = wil_cfg80211_init(dev); - if (IS_ERR(wdev)) { - dev_err(dev, "wil_cfg80211_init failed\n"); - return wdev; - } - - wil = wdev_to_wil(wdev); - wil->csr = csr; - wil->wdev = wdev; - - rc = wil_priv_init(wil); - if (rc) { - dev_err(dev, "wil_priv_init failed\n"); - goto out_wdev; - } - - wdev->iftype = NL80211_IFTYPE_STATION; /* TODO */ - /* default monitor channel */ - ch = wdev->wiphy->bands[IEEE80211_BAND_60GHZ]->channels; - cfg80211_chandef_create(&wdev->preset_chandef, ch, NL80211_CHAN_NO_HT); - - ndev = alloc_netdev_mqs(0, "wlan%d", ether_setup, WIL6210_TX_QUEUES, 1); - if (!ndev) { - dev_err(dev, "alloc_netdev_mqs failed\n"); - rc = -ENOMEM; - goto out_priv; - } - - ndev->netdev_ops = &wil_netdev_ops; - ndev->ieee80211_ptr = wdev; - SET_NETDEV_DEV(ndev, wiphy_dev(wdev->wiphy)); - wdev->netdev = ndev; - - wil_link_off(wil); - - return wil; - - out_priv: - wil_priv_deinit(wil); - - out_wdev: - wil_wdev_free(wil); - - return ERR_PTR(rc); -} - -void wil_if_free(struct wil6210_priv *wil) -{ - struct net_device *ndev = wil_to_ndev(wil); - if (!ndev) - return; - - free_netdev(ndev); - wil_priv_deinit(wil); - wil_wdev_free(wil); -} - -int wil_if_add(struct wil6210_priv *wil) -{ - struct net_device *ndev = wil_to_ndev(wil); - int rc; - - rc = register_netdev(ndev); - if (rc < 0) { - dev_err(&ndev->dev, "Failed to register netdev: %d\n", rc); - return rc; - } - - wil_link_off(wil); - - return 0; -} - -void wil_if_remove(struct wil6210_priv *wil) -{ - struct net_device *ndev = wil_to_ndev(wil); - - unregister_netdev(ndev); -} diff --git a/trunk/drivers/net/wireless/ath/wil6210/pcie_bus.c b/trunk/drivers/net/wireless/ath/wil6210/pcie_bus.c deleted file mode 100644 index 0fc83edd6bad..000000000000 --- a/trunk/drivers/net/wireless/ath/wil6210/pcie_bus.c +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright (c) 2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "wil6210.h" - -static int use_msi = 1; -module_param(use_msi, int, S_IRUGO); -MODULE_PARM_DESC(use_msi, - " Use MSI interrupt: " - "0 - don't, 1 - (default) - single, or 3"); - -/* Bus ops */ -static int wil_if_pcie_enable(struct wil6210_priv *wil) -{ - struct pci_dev *pdev = wil->pdev; - int rc; - - pci_set_master(pdev); - - /* - * how many MSI interrupts to request? - */ - switch (use_msi) { - case 3: - case 1: - case 0: - break; - default: - wil_err(wil, "Invalid use_msi=%d, default to 1\n", - use_msi); - use_msi = 1; - } - wil->n_msi = use_msi; - if (wil->n_msi) { - wil_dbg(wil, "Setup %d MSI interrupts\n", use_msi); - rc = pci_enable_msi_block(pdev, wil->n_msi); - if (rc && (wil->n_msi == 3)) { - wil_err(wil, "3 MSI mode failed, try 1 MSI\n"); - wil->n_msi = 1; - rc = pci_enable_msi_block(pdev, wil->n_msi); - } - if (rc) { - wil_err(wil, "pci_enable_msi failed, use INTx\n"); - wil->n_msi = 0; - } - } else { - wil_dbg(wil, "MSI interrupts disabled, use INTx\n"); - } - - rc = wil6210_init_irq(wil, pdev->irq); - if (rc) - goto stop_master; - - /* need reset here to obtain MAC */ - rc = wil_reset(wil); - if (rc) - goto release_irq; - - return 0; - - release_irq: - wil6210_fini_irq(wil, pdev->irq); - /* safe to call if no MSI */ - pci_disable_msi(pdev); - stop_master: - pci_clear_master(pdev); - return rc; -} - -static int wil_if_pcie_disable(struct wil6210_priv *wil) -{ - struct pci_dev *pdev = wil->pdev; - - pci_clear_master(pdev); - /* disable and release IRQ */ - wil6210_fini_irq(wil, pdev->irq); - /* safe to call if no MSI */ - pci_disable_msi(pdev); - /* TODO: disable HW */ - - return 0; -} - -static int wil_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) -{ - struct wil6210_priv *wil; - struct device *dev = &pdev->dev; - void __iomem *csr; - int rc; - - /* check HW */ - dev_info(&pdev->dev, WIL_NAME " device found [%04x:%04x] (rev %x)\n", - (int)pdev->vendor, (int)pdev->device, (int)pdev->revision); - - if (pci_resource_len(pdev, 0) != WIL6210_MEM_SIZE) { - dev_err(&pdev->dev, "Not " WIL_NAME "? " - "BAR0 size is %lu while expecting %lu\n", - (ulong)pci_resource_len(pdev, 0), WIL6210_MEM_SIZE); - return -ENODEV; - } - - rc = pci_enable_device(pdev); - if (rc) { - dev_err(&pdev->dev, "pci_enable_device failed\n"); - return -ENODEV; - } - /* rollback to err_disable_pdev */ - - rc = pci_request_region(pdev, 0, WIL_NAME); - if (rc) { - dev_err(&pdev->dev, "pci_request_region failed\n"); - goto err_disable_pdev; - } - /* rollback to err_release_reg */ - - csr = pci_ioremap_bar(pdev, 0); - if (!csr) { - dev_err(&pdev->dev, "pci_ioremap_bar failed\n"); - rc = -ENODEV; - goto err_release_reg; - } - /* rollback to err_iounmap */ - dev_info(&pdev->dev, "CSR at %pR -> %p\n", &pdev->resource[0], csr); - - wil = wil_if_alloc(dev, csr); - if (IS_ERR(wil)) { - rc = (int)PTR_ERR(wil); - dev_err(dev, "wil_if_alloc failed: %d\n", rc); - goto err_iounmap; - } - /* rollback to if_free */ - - pci_set_drvdata(pdev, wil); - wil->pdev = pdev; - - /* FW should raise IRQ when ready */ - rc = wil_if_pcie_enable(wil); - if (rc) { - wil_err(wil, "Enable device failed\n"); - goto if_free; - } - /* rollback to bus_disable */ - - rc = wil_if_add(wil); - if (rc) { - wil_err(wil, "wil_if_add failed: %d\n", rc); - goto bus_disable; - } - - wil6210_debugfs_init(wil); - - /* check FW is alive */ - wmi_echo(wil); - - return 0; - - bus_disable: - wil_if_pcie_disable(wil); - if_free: - wil_if_free(wil); - err_iounmap: - pci_iounmap(pdev, csr); - err_release_reg: - pci_release_region(pdev, 0); - err_disable_pdev: - pci_disable_device(pdev); - - return rc; -} - -static void wil_pcie_remove(struct pci_dev *pdev) -{ - struct wil6210_priv *wil = pci_get_drvdata(pdev); - - wil6210_debugfs_remove(wil); - wil_if_pcie_disable(wil); - wil_if_remove(wil); - wil_if_free(wil); - pci_iounmap(pdev, wil->csr); - pci_release_region(pdev, 0); - pci_disable_device(pdev); - pci_set_drvdata(pdev, NULL); -} - -static DEFINE_PCI_DEVICE_TABLE(wil6210_pcie_ids) = { - { PCI_DEVICE(0x1ae9, 0x0301) }, - { /* end: all zeroes */ }, -}; -MODULE_DEVICE_TABLE(pci, wil6210_pcie_ids); - -static struct pci_driver wil6210_driver = { - .probe = wil_pcie_probe, - .remove = wil_pcie_remove, - .id_table = wil6210_pcie_ids, - .name = WIL_NAME, -}; - -module_pci_driver(wil6210_driver); - -MODULE_LICENSE("Dual BSD/GPL"); -MODULE_AUTHOR("Qualcomm Atheros "); -MODULE_DESCRIPTION("Driver for 60g WiFi WIL6210 card"); diff --git a/trunk/drivers/net/wireless/ath/wil6210/txrx.c b/trunk/drivers/net/wireless/ath/wil6210/txrx.c deleted file mode 100644 index f29c294413cf..000000000000 --- a/trunk/drivers/net/wireless/ath/wil6210/txrx.c +++ /dev/null @@ -1,871 +0,0 @@ -/* - * Copyright (c) 2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "wil6210.h" -#include "wmi.h" -#include "txrx.h" - -static bool rtap_include_phy_info; -module_param(rtap_include_phy_info, bool, S_IRUGO); -MODULE_PARM_DESC(rtap_include_phy_info, - " Include PHY info in the radiotap header, default - no"); - -static inline int wil_vring_is_empty(struct vring *vring) -{ - return vring->swhead == vring->swtail; -} - -static inline u32 wil_vring_next_tail(struct vring *vring) -{ - return (vring->swtail + 1) % vring->size; -} - -static inline void wil_vring_advance_head(struct vring *vring, int n) -{ - vring->swhead = (vring->swhead + n) % vring->size; -} - -static inline int wil_vring_is_full(struct vring *vring) -{ - return wil_vring_next_tail(vring) == vring->swhead; -} -/* - * Available space in Tx Vring - */ -static inline int wil_vring_avail_tx(struct vring *vring) -{ - u32 swhead = vring->swhead; - u32 swtail = vring->swtail; - int used = (vring->size + swhead - swtail) % vring->size; - - return vring->size - used - 1; -} - -static int wil_vring_alloc(struct wil6210_priv *wil, struct vring *vring) -{ - struct device *dev = wil_to_dev(wil); - size_t sz = vring->size * sizeof(vring->va[0]); - uint i; - - BUILD_BUG_ON(sizeof(vring->va[0]) != 32); - - vring->swhead = 0; - vring->swtail = 0; - vring->ctx = kzalloc(vring->size * sizeof(vring->ctx[0]), GFP_KERNEL); - if (!vring->ctx) { - wil_err(wil, "vring_alloc [%d] failed to alloc ctx mem\n", - vring->size); - vring->va = NULL; - return -ENOMEM; - } - /* - * vring->va should be aligned on its size rounded up to power of 2 - * This is granted by the dma_alloc_coherent - */ - vring->va = dma_alloc_coherent(dev, sz, &vring->pa, GFP_KERNEL); - if (!vring->va) { - wil_err(wil, "vring_alloc [%d] failed to alloc DMA mem\n", - vring->size); - kfree(vring->ctx); - vring->ctx = NULL; - return -ENOMEM; - } - /* initially, all descriptors are SW owned - * For Tx and Rx, ownership bit is at the same location, thus - * we can use any - */ - for (i = 0; i < vring->size; i++) { - volatile struct vring_tx_desc *d = &(vring->va[i].tx); - d->dma.status = TX_DMA_STATUS_DU; - } - - wil_dbg(wil, "vring[%d] 0x%p:0x%016llx 0x%p\n", vring->size, - vring->va, (unsigned long long)vring->pa, vring->ctx); - - return 0; -} - -static void wil_vring_free(struct wil6210_priv *wil, struct vring *vring, - int tx) -{ - struct device *dev = wil_to_dev(wil); - size_t sz = vring->size * sizeof(vring->va[0]); - - while (!wil_vring_is_empty(vring)) { - if (tx) { - volatile struct vring_tx_desc *d = - &vring->va[vring->swtail].tx; - dma_addr_t pa = d->dma.addr_low | - ((u64)d->dma.addr_high << 32); - struct sk_buff *skb = vring->ctx[vring->swtail]; - if (skb) { - dma_unmap_single(dev, pa, d->dma.length, - DMA_TO_DEVICE); - dev_kfree_skb_any(skb); - vring->ctx[vring->swtail] = NULL; - } else { - dma_unmap_page(dev, pa, d->dma.length, - DMA_TO_DEVICE); - } - vring->swtail = wil_vring_next_tail(vring); - } else { /* rx */ - volatile struct vring_rx_desc *d = - &vring->va[vring->swtail].rx; - dma_addr_t pa = d->dma.addr_low | - ((u64)d->dma.addr_high << 32); - struct sk_buff *skb = vring->ctx[vring->swhead]; - dma_unmap_single(dev, pa, d->dma.length, - DMA_FROM_DEVICE); - kfree_skb(skb); - wil_vring_advance_head(vring, 1); - } - } - dma_free_coherent(dev, sz, (void *)vring->va, vring->pa); - kfree(vring->ctx); - vring->pa = 0; - vring->va = NULL; - vring->ctx = NULL; -} - -/** - * Allocate one skb for Rx VRING - * - * Safe to call from IRQ - */ -static int wil_vring_alloc_skb(struct wil6210_priv *wil, struct vring *vring, - u32 i, int headroom) -{ - struct device *dev = wil_to_dev(wil); - unsigned int sz = RX_BUF_LEN; - volatile struct vring_rx_desc *d = &(vring->va[i].rx); - dma_addr_t pa; - - /* TODO align */ - struct sk_buff *skb = dev_alloc_skb(sz + headroom); - if (unlikely(!skb)) - return -ENOMEM; - - skb_reserve(skb, headroom); - skb_put(skb, sz); - - pa = dma_map_single(dev, skb->data, skb->len, DMA_FROM_DEVICE); - if (unlikely(dma_mapping_error(dev, pa))) { - kfree_skb(skb); - return -ENOMEM; - } - - d->dma.d0 = BIT(9) | RX_DMA_D0_CMD_DMA_IT; - d->dma.addr_low = lower_32_bits(pa); - d->dma.addr_high = (u16)upper_32_bits(pa); - /* ip_length don't care */ - /* b11 don't care */ - /* error don't care */ - d->dma.status = 0; /* BIT(0) should be 0 for HW_OWNED */ - d->dma.length = sz; - vring->ctx[i] = skb; - - return 0; -} - -/** - * Adds radiotap header - * - * Any error indicated as "Bad FCS" - * - * Vendor data for 04:ce:14-1 (Wilocity-1) consists of: - * - Rx descriptor: 32 bytes - * - Phy info - */ -static void wil_rx_add_radiotap_header(struct wil6210_priv *wil, - struct sk_buff *skb, - volatile struct vring_rx_desc *d) -{ - struct wireless_dev *wdev = wil->wdev; - struct wil6210_rtap { - struct ieee80211_radiotap_header rthdr; - /* fields should be in the order of bits in rthdr.it_present */ - /* flags */ - u8 flags; - /* channel */ - __le16 chnl_freq __aligned(2); - __le16 chnl_flags; - /* MCS */ - u8 mcs_present; - u8 mcs_flags; - u8 mcs_index; - } __packed; - struct wil6210_rtap_vendor { - struct wil6210_rtap rtap; - /* vendor */ - u8 vendor_oui[3] __aligned(2); - u8 vendor_ns; - __le16 vendor_skip; - u8 vendor_data[0]; - } __packed; - struct wil6210_rtap_vendor *rtap_vendor; - int rtap_len = sizeof(struct wil6210_rtap); - int phy_length = 0; /* phy info header size, bytes */ - static char phy_data[128]; - struct ieee80211_channel *ch = wdev->preset_chandef.chan; - - if (rtap_include_phy_info) { - rtap_len = sizeof(*rtap_vendor) + sizeof(*d); - /* calculate additional length */ - if (d->dma.status & RX_DMA_STATUS_PHY_INFO) { - /** - * PHY info starts from 8-byte boundary - * there are 8-byte lines, last line may be partially - * written (HW bug), thus FW configures for last line - * to be excessive. Driver skips this last line. - */ - int len = min_t(int, 8 + sizeof(phy_data), - wil_rxdesc_phy_length(d)); - if (len > 8) { - void *p = skb_tail_pointer(skb); - void *pa = PTR_ALIGN(p, 8); - if (skb_tailroom(skb) >= len + (pa - p)) { - phy_length = len - 8; - memcpy(phy_data, pa, phy_length); - } - } - } - rtap_len += phy_length; - } - - if (skb_headroom(skb) < rtap_len && - pskb_expand_head(skb, rtap_len, 0, GFP_ATOMIC)) { - wil_err(wil, "Unable to expand headrom to %d\n", rtap_len); - return; - } - - rtap_vendor = (void *)skb_push(skb, rtap_len); - memset(rtap_vendor, 0, rtap_len); - - rtap_vendor->rtap.rthdr.it_version = PKTHDR_RADIOTAP_VERSION; - rtap_vendor->rtap.rthdr.it_len = cpu_to_le16(rtap_len); - rtap_vendor->rtap.rthdr.it_present = cpu_to_le32( - (1 << IEEE80211_RADIOTAP_FLAGS) | - (1 << IEEE80211_RADIOTAP_CHANNEL) | - (1 << IEEE80211_RADIOTAP_MCS)); - if (d->dma.status & RX_DMA_STATUS_ERROR) - rtap_vendor->rtap.flags |= IEEE80211_RADIOTAP_F_BADFCS; - - rtap_vendor->rtap.chnl_freq = cpu_to_le16(ch ? ch->center_freq : 58320); - rtap_vendor->rtap.chnl_flags = cpu_to_le16(0); - - rtap_vendor->rtap.mcs_present = IEEE80211_RADIOTAP_MCS_HAVE_MCS; - rtap_vendor->rtap.mcs_flags = 0; - rtap_vendor->rtap.mcs_index = wil_rxdesc_mcs(d); - - if (rtap_include_phy_info) { - rtap_vendor->rtap.rthdr.it_present |= cpu_to_le32(1 << - IEEE80211_RADIOTAP_VENDOR_NAMESPACE); - /* OUI for Wilocity 04:ce:14 */ - rtap_vendor->vendor_oui[0] = 0x04; - rtap_vendor->vendor_oui[1] = 0xce; - rtap_vendor->vendor_oui[2] = 0x14; - rtap_vendor->vendor_ns = 1; - /* Rx descriptor + PHY data */ - rtap_vendor->vendor_skip = cpu_to_le16(sizeof(*d) + - phy_length); - memcpy(rtap_vendor->vendor_data, (void *)d, sizeof(*d)); - memcpy(rtap_vendor->vendor_data + sizeof(*d), phy_data, - phy_length); - } -} - -/* - * Fast swap in place between 2 registers - */ -static void wil_swap_u16(u16 *a, u16 *b) -{ - *a ^= *b; - *b ^= *a; - *a ^= *b; -} - -static void wil_swap_ethaddr(void *data) -{ - struct ethhdr *eth = data; - u16 *s = (u16 *)eth->h_source; - u16 *d = (u16 *)eth->h_dest; - - wil_swap_u16(s++, d++); - wil_swap_u16(s++, d++); - wil_swap_u16(s, d); -} - -/** - * reap 1 frame from @swhead - * - * Safe to call from IRQ - */ -static struct sk_buff *wil_vring_reap_rx(struct wil6210_priv *wil, - struct vring *vring) -{ - struct device *dev = wil_to_dev(wil); - struct net_device *ndev = wil_to_ndev(wil); - volatile struct vring_rx_desc *d; - struct sk_buff *skb; - dma_addr_t pa; - unsigned int sz = RX_BUF_LEN; - u8 ftype; - u8 ds_bits; - - if (wil_vring_is_empty(vring)) - return NULL; - - d = &(vring->va[vring->swhead].rx); - if (!(d->dma.status & RX_DMA_STATUS_DU)) { - /* it is not error, we just reached end of Rx done area */ - return NULL; - } - - pa = d->dma.addr_low | ((u64)d->dma.addr_high << 32); - skb = vring->ctx[vring->swhead]; - dma_unmap_single(dev, pa, sz, DMA_FROM_DEVICE); - skb_trim(skb, d->dma.length); - - wil->stats.last_mcs_rx = wil_rxdesc_mcs(d); - - /* use radiotap header only if required */ - if (ndev->type == ARPHRD_IEEE80211_RADIOTAP) - wil_rx_add_radiotap_header(wil, skb, d); - - wil_dbg_TXRX(wil, "Rx[%3d] : %d bytes\n", vring->swhead, d->dma.length); - wil_hex_dump_TXRX("Rx ", DUMP_PREFIX_NONE, 32, 4, - (const void *)d, sizeof(*d), false); - - wil_vring_advance_head(vring, 1); - - /* no extra checks if in sniffer mode */ - if (ndev->type != ARPHRD_ETHER) - return skb; - /* - * Non-data frames may be delivered through Rx DMA channel (ex: BAR) - * Driver should recognize it by frame type, that is found - * in Rx descriptor. If type is not data, it is 802.11 frame as is - */ - ftype = wil_rxdesc_ftype(d) << 2; - if (ftype != IEEE80211_FTYPE_DATA) { - wil_dbg_TXRX(wil, "Non-data frame ftype 0x%08x\n", ftype); - /* TODO: process it */ - kfree_skb(skb); - return NULL; - } - - if (skb->len < ETH_HLEN) { - wil_err(wil, "Short frame, len = %d\n", skb->len); - /* TODO: process it (i.e. BAR) */ - kfree_skb(skb); - return NULL; - } - - ds_bits = wil_rxdesc_ds_bits(d); - if (ds_bits == 1) { - /* - * HW bug - in ToDS mode, i.e. Rx on AP side, - * addresses get swapped - */ - wil_swap_ethaddr(skb->data); - } - - return skb; -} - -/** - * allocate and fill up to @count buffers in rx ring - * buffers posted at @swtail - */ -static int wil_rx_refill(struct wil6210_priv *wil, int count) -{ - struct net_device *ndev = wil_to_ndev(wil); - struct vring *v = &wil->vring_rx; - u32 next_tail; - int rc = 0; - int headroom = ndev->type == ARPHRD_IEEE80211_RADIOTAP ? - WIL6210_RTAP_SIZE : 0; - - for (; next_tail = wil_vring_next_tail(v), - (next_tail != v->swhead) && (count-- > 0); - v->swtail = next_tail) { - rc = wil_vring_alloc_skb(wil, v, v->swtail, headroom); - if (rc) { - wil_err(wil, "Error %d in wil_rx_refill[%d]\n", - rc, v->swtail); - break; - } - } - iowrite32(v->swtail, wil->csr + HOSTADDR(v->hwtail)); - - return rc; -} - -/* - * Pass Rx packet to the netif. Update statistics. - */ -static void wil_netif_rx_any(struct sk_buff *skb, struct net_device *ndev) -{ - int rc; - unsigned int len = skb->len; - - if (in_interrupt()) - rc = netif_rx(skb); - else - rc = netif_rx_ni(skb); - - if (likely(rc == NET_RX_SUCCESS)) { - ndev->stats.rx_packets++; - ndev->stats.rx_bytes += len; - - } else { - ndev->stats.rx_dropped++; - } -} - -/** - * Proceed all completed skb's from Rx VRING - * - * Safe to call from IRQ - */ -void wil_rx_handle(struct wil6210_priv *wil) -{ - struct net_device *ndev = wil_to_ndev(wil); - struct vring *v = &wil->vring_rx; - struct sk_buff *skb; - - if (!v->va) { - wil_err(wil, "Rx IRQ while Rx not yet initialized\n"); - return; - } - wil_dbg_TXRX(wil, "%s()\n", __func__); - while (NULL != (skb = wil_vring_reap_rx(wil, v))) { - wil_hex_dump_TXRX("Rx ", DUMP_PREFIX_OFFSET, 16, 1, - skb->data, skb_headlen(skb), false); - - skb_orphan(skb); - - if (wil->wdev->iftype == NL80211_IFTYPE_MONITOR) { - skb->dev = ndev; - skb_reset_mac_header(skb); - skb->ip_summed = CHECKSUM_UNNECESSARY; - skb->pkt_type = PACKET_OTHERHOST; - skb->protocol = htons(ETH_P_802_2); - - } else { - skb->protocol = eth_type_trans(skb, ndev); - } - - wil_netif_rx_any(skb, ndev); - } - wil_rx_refill(wil, v->size); -} - -int wil_rx_init(struct wil6210_priv *wil) -{ - struct net_device *ndev = wil_to_ndev(wil); - struct wireless_dev *wdev = wil->wdev; - struct vring *vring = &wil->vring_rx; - int rc; - struct wmi_cfg_rx_chain_cmd cmd = { - .action = WMI_RX_CHAIN_ADD, - .rx_sw_ring = { - .max_mpdu_size = cpu_to_le16(RX_BUF_LEN), - }, - .mid = 0, /* TODO - what is it? */ - .decap_trans_type = WMI_DECAP_TYPE_802_3, - }; - struct { - struct wil6210_mbox_hdr_wmi wmi; - struct wmi_cfg_rx_chain_done_event evt; - } __packed evt; - - vring->size = WIL6210_RX_RING_SIZE; - rc = wil_vring_alloc(wil, vring); - if (rc) - return rc; - - cmd.rx_sw_ring.ring_mem_base = cpu_to_le64(vring->pa); - cmd.rx_sw_ring.ring_size = cpu_to_le16(vring->size); - if (wdev->iftype == NL80211_IFTYPE_MONITOR) { - struct ieee80211_channel *ch = wdev->preset_chandef.chan; - - cmd.sniffer_cfg.mode = cpu_to_le32(WMI_SNIFFER_ON); - if (ch) - cmd.sniffer_cfg.channel = ch->hw_value - 1; - cmd.sniffer_cfg.phy_info_mode = - cpu_to_le32(ndev->type == ARPHRD_IEEE80211_RADIOTAP); - cmd.sniffer_cfg.phy_support = - cpu_to_le32((wil->monitor_flags & MONITOR_FLAG_CONTROL) - ? WMI_SNIFFER_CP : WMI_SNIFFER_DP); - } - /* typical time for secure PCP is 840ms */ - rc = wmi_call(wil, WMI_CFG_RX_CHAIN_CMDID, &cmd, sizeof(cmd), - WMI_CFG_RX_CHAIN_DONE_EVENTID, &evt, sizeof(evt), 2000); - if (rc) - goto err_free; - - vring->hwtail = le32_to_cpu(evt.evt.rx_ring_tail_ptr); - - wil_dbg(wil, "Rx init: status %d tail 0x%08x\n", - le32_to_cpu(evt.evt.status), vring->hwtail); - - rc = wil_rx_refill(wil, vring->size); - if (rc) - goto err_free; - - return 0; - err_free: - wil_vring_free(wil, vring, 0); - - return rc; -} - -void wil_rx_fini(struct wil6210_priv *wil) -{ - struct vring *vring = &wil->vring_rx; - - if (vring->va) { - int rc; - struct wmi_cfg_rx_chain_cmd cmd = { - .action = cpu_to_le32(WMI_RX_CHAIN_DEL), - .rx_sw_ring = { - .max_mpdu_size = cpu_to_le16(RX_BUF_LEN), - }, - }; - struct { - struct wil6210_mbox_hdr_wmi wmi; - struct wmi_cfg_rx_chain_done_event cfg; - } __packed wmi_rx_cfg_reply; - - rc = wmi_call(wil, WMI_CFG_RX_CHAIN_CMDID, &cmd, sizeof(cmd), - WMI_CFG_RX_CHAIN_DONE_EVENTID, - &wmi_rx_cfg_reply, sizeof(wmi_rx_cfg_reply), - 100); - wil_vring_free(wil, vring, 0); - } -} - -int wil_vring_init_tx(struct wil6210_priv *wil, int id, int size, - int cid, int tid) -{ - int rc; - struct wmi_vring_cfg_cmd cmd = { - .action = cpu_to_le32(WMI_VRING_CMD_ADD), - .vring_cfg = { - .tx_sw_ring = { - .max_mpdu_size = cpu_to_le16(TX_BUF_LEN), - }, - .ringid = id, - .cidxtid = (cid & 0xf) | ((tid & 0xf) << 4), - .encap_trans_type = WMI_VRING_ENC_TYPE_802_3, - .mac_ctrl = 0, - .to_resolution = 0, - .agg_max_wsize = 16, - .schd_params = { - .priority = cpu_to_le16(0), - .timeslot_us = cpu_to_le16(0xfff), - }, - }, - }; - struct { - struct wil6210_mbox_hdr_wmi wmi; - struct wmi_vring_cfg_done_event cmd; - } __packed reply; - struct vring *vring = &wil->vring_tx[id]; - - if (vring->va) { - wil_err(wil, "Tx ring [%d] already allocated\n", id); - rc = -EINVAL; - goto out; - } - - vring->size = size; - rc = wil_vring_alloc(wil, vring); - if (rc) - goto out; - - cmd.vring_cfg.tx_sw_ring.ring_mem_base = cpu_to_le64(vring->pa); - cmd.vring_cfg.tx_sw_ring.ring_size = cpu_to_le16(vring->size); - - rc = wmi_call(wil, WMI_VRING_CFG_CMDID, &cmd, sizeof(cmd), - WMI_VRING_CFG_DONE_EVENTID, &reply, sizeof(reply), 100); - if (rc) - goto out_free; - - if (reply.cmd.status != WMI_VRING_CFG_SUCCESS) { - wil_err(wil, "Tx config failed, status 0x%02x\n", - reply.cmd.status); - goto out_free; - } - vring->hwtail = le32_to_cpu(reply.cmd.tx_vring_tail_ptr); - - return 0; - out_free: - wil_vring_free(wil, vring, 1); - out: - - return rc; -} - -void wil_vring_fini_tx(struct wil6210_priv *wil, int id) -{ - struct vring *vring = &wil->vring_tx[id]; - - if (!vring->va) - return; - - wil_vring_free(wil, vring, 1); -} - -static struct vring *wil_find_tx_vring(struct wil6210_priv *wil, - struct sk_buff *skb) -{ - struct vring *v = &wil->vring_tx[0]; - - if (v->va) - return v; - - return NULL; -} - -static int wil_tx_desc_map(volatile struct vring_tx_desc *d, - dma_addr_t pa, u32 len) -{ - d->dma.addr_low = lower_32_bits(pa); - d->dma.addr_high = (u16)upper_32_bits(pa); - d->dma.ip_length = 0; - /* 0..6: mac_length; 7:ip_version 0-IP6 1-IP4*/ - d->dma.b11 = 0/*14 | BIT(7)*/; - d->dma.error = 0; - d->dma.status = 0; /* BIT(0) should be 0 for HW_OWNED */ - d->dma.length = len; - d->dma.d0 = 0; - d->mac.d[0] = 0; - d->mac.d[1] = 0; - d->mac.d[2] = 0; - d->mac.ucode_cmd = 0; - /* use dst index 0 */ - d->mac.d[1] |= BIT(MAC_CFG_DESC_TX_1_DST_INDEX_EN_POS) | - (0 << MAC_CFG_DESC_TX_1_DST_INDEX_POS); - /* translation type: 0 - bypass; 1 - 802.3; 2 - native wifi */ - d->mac.d[2] = BIT(MAC_CFG_DESC_TX_2_SNAP_HDR_INSERTION_EN_POS) | - (1 << MAC_CFG_DESC_TX_2_L2_TRANSLATION_TYPE_POS); - - return 0; -} - -static int wil_tx_vring(struct wil6210_priv *wil, struct vring *vring, - struct sk_buff *skb) -{ - struct device *dev = wil_to_dev(wil); - volatile struct vring_tx_desc *d; - u32 swhead = vring->swhead; - int avail = wil_vring_avail_tx(vring); - int nr_frags = skb_shinfo(skb)->nr_frags; - uint f; - int vring_index = vring - wil->vring_tx; - uint i = swhead; - dma_addr_t pa; - - wil_dbg_TXRX(wil, "%s()\n", __func__); - - if (avail < vring->size/8) - netif_tx_stop_all_queues(wil_to_ndev(wil)); - if (avail < 1 + nr_frags) { - wil_err(wil, "Tx ring full. No space for %d fragments\n", - 1 + nr_frags); - return -ENOMEM; - } - d = &(vring->va[i].tx); - - /* FIXME FW can accept only unicast frames for the peer */ - memcpy(skb->data, wil->dst_addr[vring_index], ETH_ALEN); - - pa = dma_map_single(dev, skb->data, - skb_headlen(skb), DMA_TO_DEVICE); - - wil_dbg_TXRX(wil, "Tx skb %d bytes %p -> %#08llx\n", skb_headlen(skb), - skb->data, (unsigned long long)pa); - wil_hex_dump_TXRX("Tx ", DUMP_PREFIX_OFFSET, 16, 1, - skb->data, skb_headlen(skb), false); - - if (unlikely(dma_mapping_error(dev, pa))) - return -EINVAL; - /* 1-st segment */ - wil_tx_desc_map(d, pa, skb_headlen(skb)); - d->mac.d[2] |= ((nr_frags + 1) << - MAC_CFG_DESC_TX_2_NUM_OF_DESCRIPTORS_POS); - /* middle segments */ - for (f = 0; f < nr_frags; f++) { - const struct skb_frag_struct *frag = - &skb_shinfo(skb)->frags[f]; - int len = skb_frag_size(frag); - i = (swhead + f + 1) % vring->size; - d = &(vring->va[i].tx); - pa = skb_frag_dma_map(dev, frag, 0, skb_frag_size(frag), - DMA_TO_DEVICE); - if (unlikely(dma_mapping_error(dev, pa))) - goto dma_error; - wil_tx_desc_map(d, pa, len); - vring->ctx[i] = NULL; - } - /* for the last seg only */ - d->dma.d0 |= BIT(DMA_CFG_DESC_TX_0_CMD_EOP_POS); - d->dma.d0 |= BIT(9); /* BUG: undocumented bit */ - d->dma.d0 |= BIT(DMA_CFG_DESC_TX_0_CMD_DMA_IT_POS); - d->dma.d0 |= (vring_index << DMA_CFG_DESC_TX_0_QID_POS); - - wil_hex_dump_TXRX("Tx ", DUMP_PREFIX_NONE, 32, 4, - (const void *)d, sizeof(*d), false); - - /* advance swhead */ - wil_vring_advance_head(vring, nr_frags + 1); - wil_dbg_TXRX(wil, "Tx swhead %d -> %d\n", swhead, vring->swhead); - iowrite32(vring->swhead, wil->csr + HOSTADDR(vring->hwtail)); - /* hold reference to skb - * to prevent skb release before accounting - * in case of immediate "tx done" - */ - vring->ctx[i] = skb_get(skb); - - return 0; - dma_error: - /* unmap what we have mapped */ - /* Note: increment @f to operate with positive index */ - for (f++; f > 0; f--) { - i = (swhead + f) % vring->size; - d = &(vring->va[i].tx); - d->dma.status = TX_DMA_STATUS_DU; - pa = d->dma.addr_low | ((u64)d->dma.addr_high << 32); - if (vring->ctx[i]) - dma_unmap_single(dev, pa, d->dma.length, DMA_TO_DEVICE); - else - dma_unmap_page(dev, pa, d->dma.length, DMA_TO_DEVICE); - } - - return -EINVAL; -} - - -netdev_tx_t wil_start_xmit(struct sk_buff *skb, struct net_device *ndev) -{ - struct wil6210_priv *wil = ndev_to_wil(ndev); - struct vring *vring; - int rc; - - wil_dbg_TXRX(wil, "%s()\n", __func__); - if (!test_bit(wil_status_fwready, &wil->status)) { - wil_err(wil, "FW not ready\n"); - goto drop; - } - if (!test_bit(wil_status_fwconnected, &wil->status)) { - wil_err(wil, "FW not connected\n"); - goto drop; - } - if (wil->wdev->iftype == NL80211_IFTYPE_MONITOR) { - wil_err(wil, "Xmit in monitor mode not supported\n"); - goto drop; - } - if (skb->protocol == cpu_to_be16(ETH_P_PAE)) { - rc = wmi_tx_eapol(wil, skb); - } else { - /* find vring */ - vring = wil_find_tx_vring(wil, skb); - if (!vring) { - wil_err(wil, "No Tx VRING available\n"); - goto drop; - } - /* set up vring entry */ - rc = wil_tx_vring(wil, vring, skb); - } - switch (rc) { - case 0: - ndev->stats.tx_packets++; - ndev->stats.tx_bytes += skb->len; - dev_kfree_skb_any(skb); - return NETDEV_TX_OK; - case -ENOMEM: - return NETDEV_TX_BUSY; - default: - ; /* goto drop; */ - break; - } - drop: - netif_tx_stop_all_queues(ndev); - ndev->stats.tx_dropped++; - dev_kfree_skb_any(skb); - - return NET_XMIT_DROP; -} - -/** - * Clean up transmitted skb's from the Tx VRING - * - * Safe to call from IRQ - */ -void wil_tx_complete(struct wil6210_priv *wil, int ringid) -{ - struct device *dev = wil_to_dev(wil); - struct vring *vring = &wil->vring_tx[ringid]; - - if (!vring->va) { - wil_err(wil, "Tx irq[%d]: vring not initialized\n", ringid); - return; - } - - wil_dbg_TXRX(wil, "%s(%d)\n", __func__, ringid); - - while (!wil_vring_is_empty(vring)) { - volatile struct vring_tx_desc *d = &vring->va[vring->swtail].tx; - dma_addr_t pa; - struct sk_buff *skb; - if (!(d->dma.status & TX_DMA_STATUS_DU)) - break; - - wil_dbg_TXRX(wil, - "Tx[%3d] : %d bytes, status 0x%02x err 0x%02x\n", - vring->swtail, d->dma.length, d->dma.status, - d->dma.error); - wil_hex_dump_TXRX("TxC ", DUMP_PREFIX_NONE, 32, 4, - (const void *)d, sizeof(*d), false); - - pa = d->dma.addr_low | ((u64)d->dma.addr_high << 32); - skb = vring->ctx[vring->swtail]; - if (skb) { - dma_unmap_single(dev, pa, d->dma.length, DMA_TO_DEVICE); - dev_kfree_skb_any(skb); - vring->ctx[vring->swtail] = NULL; - } else { - dma_unmap_page(dev, pa, d->dma.length, DMA_TO_DEVICE); - } - d->dma.addr_low = 0; - d->dma.addr_high = 0; - d->dma.length = 0; - d->dma.status = TX_DMA_STATUS_DU; - vring->swtail = wil_vring_next_tail(vring); - } - if (wil_vring_avail_tx(vring) > vring->size/4) - netif_tx_wake_all_queues(wil_to_ndev(wil)); -} diff --git a/trunk/drivers/net/wireless/ath/wil6210/txrx.h b/trunk/drivers/net/wireless/ath/wil6210/txrx.h deleted file mode 100644 index 45a61f597c5c..000000000000 --- a/trunk/drivers/net/wireless/ath/wil6210/txrx.h +++ /dev/null @@ -1,362 +0,0 @@ -/* - * Copyright (c) 2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef WIL6210_TXRX_H -#define WIL6210_TXRX_H - -#define BUF_SW_OWNED (1) -#define BUF_HW_OWNED (0) - -/* size of max. Rx packet */ -#define RX_BUF_LEN (2048) -#define TX_BUF_LEN (2048) -/* how many bytes to reserve for rtap header? */ -#define WIL6210_RTAP_SIZE (128) - -/* Tx/Rx path */ -/* - * Tx descriptor - MAC part - * [dword 0] - * bit 0.. 9 : lifetime_expiry_value:10 - * bit 10 : interrup_en:1 - * bit 11 : status_en:1 - * bit 12..13 : txss_override:2 - * bit 14 : timestamp_insertion:1 - * bit 15 : duration_preserve:1 - * bit 16..21 : reserved0:6 - * bit 22..26 : mcs_index:5 - * bit 27 : mcs_en:1 - * bit 28..29 : reserved1:2 - * bit 30 : reserved2:1 - * bit 31 : sn_preserved:1 - * [dword 1] - * bit 0.. 3 : pkt_mode:4 - * bit 4 : pkt_mode_en:1 - * bit 5.. 7 : reserved0:3 - * bit 8..13 : reserved1:6 - * bit 14 : reserved2:1 - * bit 15 : ack_policy_en:1 - * bit 16..19 : dst_index:4 - * bit 20 : dst_index_en:1 - * bit 21..22 : ack_policy:2 - * bit 23 : lifetime_en:1 - * bit 24..30 : max_retry:7 - * bit 31 : max_retry_en:1 - * [dword 2] - * bit 0.. 7 : num_of_descriptors:8 - * bit 8..17 : reserved:10 - * bit 18..19 : l2_translation_type:2 - * bit 20 : snap_hdr_insertion_en:1 - * bit 21 : vlan_removal_en:1 - * bit 22..31 : reserved0:10 - * [dword 3] - * bit 0.. 31: ucode_cmd:32 - */ -struct vring_tx_mac { - u32 d[3]; - u32 ucode_cmd; -} __packed; - -/* TX MAC Dword 0 */ -#define MAC_CFG_DESC_TX_0_LIFETIME_EXPIRY_VALUE_POS 0 -#define MAC_CFG_DESC_TX_0_LIFETIME_EXPIRY_VALUE_LEN 10 -#define MAC_CFG_DESC_TX_0_LIFETIME_EXPIRY_VALUE_MSK 0x3FF - -#define MAC_CFG_DESC_TX_0_INTERRUP_EN_POS 10 -#define MAC_CFG_DESC_TX_0_INTERRUP_EN_LEN 1 -#define MAC_CFG_DESC_TX_0_INTERRUP_EN_MSK 0x400 - -#define MAC_CFG_DESC_TX_0_STATUS_EN_POS 11 -#define MAC_CFG_DESC_TX_0_STATUS_EN_LEN 1 -#define MAC_CFG_DESC_TX_0_STATUS_EN_MSK 0x800 - -#define MAC_CFG_DESC_TX_0_TXSS_OVERRIDE_POS 12 -#define MAC_CFG_DESC_TX_0_TXSS_OVERRIDE_LEN 2 -#define MAC_CFG_DESC_TX_0_TXSS_OVERRIDE_MSK 0x3000 - -#define MAC_CFG_DESC_TX_0_TIMESTAMP_INSERTION_POS 14 -#define MAC_CFG_DESC_TX_0_TIMESTAMP_INSERTION_LEN 1 -#define MAC_CFG_DESC_TX_0_TIMESTAMP_INSERTION_MSK 0x4000 - -#define MAC_CFG_DESC_TX_0_DURATION_PRESERVE_POS 15 -#define MAC_CFG_DESC_TX_0_DURATION_PRESERVE_LEN 1 -#define MAC_CFG_DESC_TX_0_DURATION_PRESERVE_MSK 0x8000 - -#define MAC_CFG_DESC_TX_0_MCS_INDEX_POS 22 -#define MAC_CFG_DESC_TX_0_MCS_INDEX_LEN 5 -#define MAC_CFG_DESC_TX_0_MCS_INDEX_MSK 0x7C00000 - -#define MAC_CFG_DESC_TX_0_MCS_EN_POS 27 -#define MAC_CFG_DESC_TX_0_MCS_EN_LEN 1 -#define MAC_CFG_DESC_TX_0_MCS_EN_MSK 0x8000000 - -#define MAC_CFG_DESC_TX_0_SN_PRESERVED_POS 31 -#define MAC_CFG_DESC_TX_0_SN_PRESERVED_LEN 1 -#define MAC_CFG_DESC_TX_0_SN_PRESERVED_MSK 0x80000000 - -/* TX MAC Dword 1 */ -#define MAC_CFG_DESC_TX_1_PKT_MODE_POS 0 -#define MAC_CFG_DESC_TX_1_PKT_MODE_LEN 4 -#define MAC_CFG_DESC_TX_1_PKT_MODE_MSK 0xF - -#define MAC_CFG_DESC_TX_1_PKT_MODE_EN_POS 4 -#define MAC_CFG_DESC_TX_1_PKT_MODE_EN_LEN 1 -#define MAC_CFG_DESC_TX_1_PKT_MODE_EN_MSK 0x10 - -#define MAC_CFG_DESC_TX_1_ACK_POLICY_EN_POS 15 -#define MAC_CFG_DESC_TX_1_ACK_POLICY_EN_LEN 1 -#define MAC_CFG_DESC_TX_1_ACK_POLICY_EN_MSK 0x8000 - -#define MAC_CFG_DESC_TX_1_DST_INDEX_POS 16 -#define MAC_CFG_DESC_TX_1_DST_INDEX_LEN 4 -#define MAC_CFG_DESC_TX_1_DST_INDEX_MSK 0xF0000 - -#define MAC_CFG_DESC_TX_1_DST_INDEX_EN_POS 20 -#define MAC_CFG_DESC_TX_1_DST_INDEX_EN_LEN 1 -#define MAC_CFG_DESC_TX_1_DST_INDEX_EN_MSK 0x100000 - -#define MAC_CFG_DESC_TX_1_ACK_POLICY_POS 21 -#define MAC_CFG_DESC_TX_1_ACK_POLICY_LEN 2 -#define MAC_CFG_DESC_TX_1_ACK_POLICY_MSK 0x600000 - -#define MAC_CFG_DESC_TX_1_LIFETIME_EN_POS 23 -#define MAC_CFG_DESC_TX_1_LIFETIME_EN_LEN 1 -#define MAC_CFG_DESC_TX_1_LIFETIME_EN_MSK 0x800000 - -#define MAC_CFG_DESC_TX_1_MAX_RETRY_POS 24 -#define MAC_CFG_DESC_TX_1_MAX_RETRY_LEN 7 -#define MAC_CFG_DESC_TX_1_MAX_RETRY_MSK 0x7F000000 - -#define MAC_CFG_DESC_TX_1_MAX_RETRY_EN_POS 31 -#define MAC_CFG_DESC_TX_1_MAX_RETRY_EN_LEN 1 -#define MAC_CFG_DESC_TX_1_MAX_RETRY_EN_MSK 0x80000000 - -/* TX MAC Dword 2 */ -#define MAC_CFG_DESC_TX_2_NUM_OF_DESCRIPTORS_POS 0 -#define MAC_CFG_DESC_TX_2_NUM_OF_DESCRIPTORS_LEN 8 -#define MAC_CFG_DESC_TX_2_NUM_OF_DESCRIPTORS_MSK 0xFF - -#define MAC_CFG_DESC_TX_2_RESERVED_POS 8 -#define MAC_CFG_DESC_TX_2_RESERVED_LEN 10 -#define MAC_CFG_DESC_TX_2_RESERVED_MSK 0x3FF00 - -#define MAC_CFG_DESC_TX_2_L2_TRANSLATION_TYPE_POS 18 -#define MAC_CFG_DESC_TX_2_L2_TRANSLATION_TYPE_LEN 2 -#define MAC_CFG_DESC_TX_2_L2_TRANSLATION_TYPE_MSK 0xC0000 - -#define MAC_CFG_DESC_TX_2_SNAP_HDR_INSERTION_EN_POS 20 -#define MAC_CFG_DESC_TX_2_SNAP_HDR_INSERTION_EN_LEN 1 -#define MAC_CFG_DESC_TX_2_SNAP_HDR_INSERTION_EN_MSK 0x100000 - -#define MAC_CFG_DESC_TX_2_VLAN_REMOVAL_EN_POS 21 -#define MAC_CFG_DESC_TX_2_VLAN_REMOVAL_EN_LEN 1 -#define MAC_CFG_DESC_TX_2_VLAN_REMOVAL_EN_MSK 0x200000 - -/* TX MAC Dword 3 */ -#define MAC_CFG_DESC_TX_3_UCODE_CMD_POS 0 -#define MAC_CFG_DESC_TX_3_UCODE_CMD_LEN 32 -#define MAC_CFG_DESC_TX_3_UCODE_CMD_MSK 0xFFFFFFFF - -/* TX DMA Dword 0 */ -#define DMA_CFG_DESC_TX_0_L4_LENGTH_POS 0 -#define DMA_CFG_DESC_TX_0_L4_LENGTH_LEN 8 -#define DMA_CFG_DESC_TX_0_L4_LENGTH_MSK 0xFF - -#define DMA_CFG_DESC_TX_0_CMD_EOP_POS 8 -#define DMA_CFG_DESC_TX_0_CMD_EOP_LEN 1 -#define DMA_CFG_DESC_TX_0_CMD_EOP_MSK 0x100 - -#define DMA_CFG_DESC_TX_0_CMD_DMA_IT_POS 10 -#define DMA_CFG_DESC_TX_0_CMD_DMA_IT_LEN 1 -#define DMA_CFG_DESC_TX_0_CMD_DMA_IT_MSK 0x400 - -#define DMA_CFG_DESC_TX_0_SEGMENT_BUF_DETAILS_POS 11 -#define DMA_CFG_DESC_TX_0_SEGMENT_BUF_DETAILS_LEN 2 -#define DMA_CFG_DESC_TX_0_SEGMENT_BUF_DETAILS_MSK 0x1800 - -#define DMA_CFG_DESC_TX_0_TCP_SEG_EN_POS 13 -#define DMA_CFG_DESC_TX_0_TCP_SEG_EN_LEN 1 -#define DMA_CFG_DESC_TX_0_TCP_SEG_EN_MSK 0x2000 - -#define DMA_CFG_DESC_TX_0_IPV4_CHECKSUM_EN_POS 14 -#define DMA_CFG_DESC_TX_0_IPV4_CHECKSUM_EN_LEN 1 -#define DMA_CFG_DESC_TX_0_IPV4_CHECKSUM_EN_MSK 0x4000 - -#define DMA_CFG_DESC_TX_0_TCP_UDP_CHECKSUM_EN_POS 15 -#define DMA_CFG_DESC_TX_0_TCP_UDP_CHECKSUM_EN_LEN 1 -#define DMA_CFG_DESC_TX_0_TCP_UDP_CHECKSUM_EN_MSK 0x8000 - -#define DMA_CFG_DESC_TX_0_QID_POS 16 -#define DMA_CFG_DESC_TX_0_QID_LEN 5 -#define DMA_CFG_DESC_TX_0_QID_MSK 0x1F0000 - -#define DMA_CFG_DESC_TX_0_PSEUDO_HEADER_CALC_EN_POS 21 -#define DMA_CFG_DESC_TX_0_PSEUDO_HEADER_CALC_EN_LEN 1 -#define DMA_CFG_DESC_TX_0_PSEUDO_HEADER_CALC_EN_MSK 0x200000 - -#define DMA_CFG_DESC_TX_0_L4_TYPE_POS 30 -#define DMA_CFG_DESC_TX_0_L4_TYPE_LEN 2 -#define DMA_CFG_DESC_TX_0_L4_TYPE_MSK 0xC0000000 - - -#define TX_DMA_STATUS_DU BIT(0) - -struct vring_tx_dma { - u32 d0; - u32 addr_low; - u16 addr_high; - u8 ip_length; - u8 b11; /* 0..6: mac_length; 7:ip_version */ - u8 error; /* 0..2: err; 3..7: reserved; */ - u8 status; /* 0: used; 1..7; reserved */ - u16 length; -} __packed; - -/* - * Rx descriptor - MAC part - * [dword 0] - * bit 0.. 3 : tid:4 The QoS (b3-0) TID Field - * bit 4.. 6 : connection_id:3 :The Source index that was found during - * Parsing the TA. This field is used to define the source of the packet - * bit 7 : reserved:1 - * bit 8.. 9 : mac_id:2 : The MAC virtual Ring number (always zero) - * bit 10..11 : frame_type:2 : The FC Control (b3-2) - MPDU Type - * (management, data, control and extension) - * bit 12..15 : frame_subtype:4 : The FC Control (b7-4) - Frame Subtype - * bit 16..27 : seq_number:12 The received Sequence number field - * bit 28..31 : extended:4 extended subtype - * [dword 1] - * bit 0.. 3 : reserved - * bit 4.. 5 : key_id:2 - * bit 6 : decrypt_bypass:1 - * bit 7 : security:1 - * bit 8.. 9 : ds_bits:2 - * bit 10 : a_msdu_present:1 from qos header - * bit 11 : a_msdu_type:1 from qos header - * bit 12 : a_mpdu:1 part of AMPDU aggregation - * bit 13 : broadcast:1 - * bit 14 : mutlicast:1 - * bit 15 : reserved:1 - * bit 16..20 : rx_mac_qid:5 The Queue Identifier that the packet - * is received from - * bit 21..24 : mcs:4 - * bit 25..28 : mic_icr:4 - * bit 29..31 : reserved:3 - * [dword 2] - * bit 0.. 2 : time_slot:3 The timeslot that the MPDU is received - * bit 3 : fc_protocol_ver:1 The FC Control (b0) - Protocol Version - * bit 4 : fc_order:1 The FC Control (b15) -Order - * bit 5.. 7 : qos_ack_policy:3 The QoS (b6-5) ack policy Field - * bit 8 : esop:1 The QoS (b4) ESOP field - * bit 9 : qos_rdg_more_ppdu:1 The QoS (b9) RDG field - * bit 10..14 : qos_reserved:5 The QoS (b14-10) Reserved field - * bit 15 : qos_ac_constraint:1 - * bit 16..31 : pn_15_0:16 low 2 bytes of PN - * [dword 3] - * bit 0..31 : pn_47_16:32 high 4 bytes of PN - */ -struct vring_rx_mac { - u32 d0; - u32 d1; - u16 w4; - u16 pn_15_0; - u32 pn_47_16; -} __packed; - -/* - * Rx descriptor - DMA part - * [dword 0] - * bit 0.. 7 : l4_length:8 layer 4 length - * bit 8.. 9 : reserved:2 - * bit 10 : cmd_dma_it:1 - * bit 11..15 : reserved:5 - * bit 16..29 : phy_info_length:14 - * bit 30..31 : l4_type:2 valid if the L4I bit is set in the status field - * [dword 1] - * bit 0..31 : addr_low:32 The payload buffer low address - * [dword 2] - * bit 0..15 : addr_high:16 The payload buffer high address - * bit 16..23 : ip_length:8 - * bit 24..30 : mac_length:7 - * bit 31 : ip_version:1 - * [dword 3] - * [byte 12] error - * [byte 13] status - * bit 0 : du:1 - * bit 1 : eop:1 - * bit 2 : error:1 - * bit 3 : mi:1 - * bit 4 : l3_identified:1 - * bit 5 : l4_identified:1 - * bit 6 : phy_info_included:1 - * bit 7 : reserved:1 - * [word 7] length - * - */ - -#define RX_DMA_D0_CMD_DMA_IT BIT(10) - -#define RX_DMA_STATUS_DU BIT(0) -#define RX_DMA_STATUS_ERROR BIT(2) -#define RX_DMA_STATUS_PHY_INFO BIT(6) - -struct vring_rx_dma { - u32 d0; - u32 addr_low; - u16 addr_high; - u8 ip_length; - u8 b11; - u8 error; - u8 status; - u16 length; -} __packed; - -struct vring_tx_desc { - struct vring_tx_mac mac; - struct vring_tx_dma dma; -} __packed; - -struct vring_rx_desc { - struct vring_rx_mac mac; - struct vring_rx_dma dma; -} __packed; - -union vring_desc { - struct vring_tx_desc tx; - struct vring_rx_desc rx; -} __packed; - -static inline int wil_rxdesc_phy_length(volatile struct vring_rx_desc *d) -{ - return WIL_GET_BITS(d->dma.d0, 16, 29); -} - -static inline int wil_rxdesc_mcs(volatile struct vring_rx_desc *d) -{ - return WIL_GET_BITS(d->mac.d1, 21, 24); -} - -static inline int wil_rxdesc_ds_bits(volatile struct vring_rx_desc *d) -{ - return WIL_GET_BITS(d->mac.d1, 8, 9); -} - -static inline int wil_rxdesc_ftype(volatile struct vring_rx_desc *d) -{ - return WIL_GET_BITS(d->mac.d0, 10, 11); -} - -#endif /* WIL6210_TXRX_H */ diff --git a/trunk/drivers/net/wireless/ath/wil6210/wil6210.h b/trunk/drivers/net/wireless/ath/wil6210/wil6210.h deleted file mode 100644 index 9bcfffa4006c..000000000000 --- a/trunk/drivers/net/wireless/ath/wil6210/wil6210.h +++ /dev/null @@ -1,363 +0,0 @@ -/* - * Copyright (c) 2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef __WIL6210_H__ -#define __WIL6210_H__ - -#include -#include -#include - -#include "dbg_hexdump.h" - -#define WIL_NAME "wil6210" - -/** - * extract bits [@b0:@b1] (inclusive) from the value @x - * it should be @b0 <= @b1, or result is incorrect - */ -static inline u32 WIL_GET_BITS(u32 x, int b0, int b1) -{ - return (x >> b0) & ((1 << (b1 - b0 + 1)) - 1); -} - -#define WIL6210_MEM_SIZE (2*1024*1024UL) - -#define WIL6210_TX_QUEUES (4) - -#define WIL6210_RX_RING_SIZE (128) -#define WIL6210_TX_RING_SIZE (128) -#define WIL6210_MAX_TX_RINGS (24) - -/* Hardware definitions begin */ - -/* - * Mapping - * RGF File | Host addr | FW addr - * | | - * user_rgf | 0x000000 | 0x880000 - * dma_rgf | 0x001000 | 0x881000 - * pcie_rgf | 0x002000 | 0x882000 - * | | - */ - -/* Where various structures placed in host address space */ -#define WIL6210_FW_HOST_OFF (0x880000UL) - -#define HOSTADDR(fwaddr) (fwaddr - WIL6210_FW_HOST_OFF) - -/* - * Interrupt control registers block - * - * each interrupt controlled by the same bit in all registers - */ -struct RGF_ICR { - u32 ICC; /* Cause Control, RW: 0 - W1C, 1 - COR */ - u32 ICR; /* Cause, W1C/COR depending on ICC */ - u32 ICM; /* Cause masked (ICR & ~IMV), W1C/COR depending on ICC */ - u32 ICS; /* Cause Set, WO */ - u32 IMV; /* Mask, RW+S/C */ - u32 IMS; /* Mask Set, write 1 to set */ - u32 IMC; /* Mask Clear, write 1 to clear */ -} __packed; - -/* registers - FW addresses */ -#define RGF_USER_USER_SCRATCH_PAD (0x8802bc) -#define RGF_USER_USER_ICR (0x880b4c) /* struct RGF_ICR */ - #define BIT_USER_USER_ICR_SW_INT_2 BIT(18) -#define RGF_USER_CLKS_CTL_SW_RST_MASK_0 (0x880b14) -#define RGF_USER_MAC_CPU_0 (0x8801fc) -#define RGF_USER_USER_CPU_0 (0x8801e0) -#define RGF_USER_CLKS_CTL_SW_RST_VEC_0 (0x880b04) -#define RGF_USER_CLKS_CTL_SW_RST_VEC_1 (0x880b08) -#define RGF_USER_CLKS_CTL_SW_RST_VEC_2 (0x880b0c) -#define RGF_USER_CLKS_CTL_SW_RST_VEC_3 (0x880b10) - -#define RGF_DMA_PSEUDO_CAUSE (0x881c68) -#define RGF_DMA_PSEUDO_CAUSE_MASK_SW (0x881c6c) -#define RGF_DMA_PSEUDO_CAUSE_MASK_FW (0x881c70) - #define BIT_DMA_PSEUDO_CAUSE_RX BIT(0) - #define BIT_DMA_PSEUDO_CAUSE_TX BIT(1) - #define BIT_DMA_PSEUDO_CAUSE_MISC BIT(2) - -#define RGF_DMA_EP_TX_ICR (0x881bb4) /* struct RGF_ICR */ - #define BIT_DMA_EP_TX_ICR_TX_DONE BIT(0) - #define BIT_DMA_EP_TX_ICR_TX_DONE_N(n) BIT(n+1) /* n = [0..23] */ -#define RGF_DMA_EP_RX_ICR (0x881bd0) /* struct RGF_ICR */ - #define BIT_DMA_EP_RX_ICR_RX_DONE BIT(0) -#define RGF_DMA_EP_MISC_ICR (0x881bec) /* struct RGF_ICR */ - #define BIT_DMA_EP_MISC_ICR_RX_HTRSH BIT(0) - #define BIT_DMA_EP_MISC_ICR_TX_NO_ACT BIT(1) - #define BIT_DMA_EP_MISC_ICR_FW_INT0 BIT(28) - #define BIT_DMA_EP_MISC_ICR_FW_INT1 BIT(29) - -/* Interrupt moderation control */ -#define RGF_DMA_ITR_CNT_TRSH (0x881c5c) -#define RGF_DMA_ITR_CNT_DATA (0x881c60) -#define RGF_DMA_ITR_CNT_CRL (0x881C64) - #define BIT_DMA_ITR_CNT_CRL_EN BIT(0) - #define BIT_DMA_ITR_CNT_CRL_EXT_TICK BIT(1) - #define BIT_DMA_ITR_CNT_CRL_FOREVER BIT(2) - #define BIT_DMA_ITR_CNT_CRL_CLR BIT(3) - #define BIT_DMA_ITR_CNT_CRL_REACH_TRSH BIT(4) - -/* popular locations */ -#define HOST_MBOX HOSTADDR(RGF_USER_USER_SCRATCH_PAD) -#define HOST_SW_INT (HOSTADDR(RGF_USER_USER_ICR) + \ - offsetof(struct RGF_ICR, ICS)) -#define SW_INT_MBOX BIT_USER_USER_ICR_SW_INT_2 - -/* ISR register bits */ -#define ISR_MISC_FW_READY BIT_DMA_EP_MISC_ICR_FW_INT0 -#define ISR_MISC_MBOX_EVT BIT_DMA_EP_MISC_ICR_FW_INT1 - -/* Hardware definitions end */ - -struct wil6210_mbox_ring { - u32 base; - u16 entry_size; /* max. size of mbox entry, incl. all headers */ - u16 size; - u32 tail; - u32 head; -} __packed; - -struct wil6210_mbox_ring_desc { - __le32 sync; - __le32 addr; -} __packed; - -/* at HOST_OFF_WIL6210_MBOX_CTL */ -struct wil6210_mbox_ctl { - struct wil6210_mbox_ring tx; - struct wil6210_mbox_ring rx; -} __packed; - -struct wil6210_mbox_hdr { - __le16 seq; - __le16 len; /* payload, bytes after this header */ - __le16 type; - u8 flags; - u8 reserved; -} __packed; - -#define WIL_MBOX_HDR_TYPE_WMI (0) - -/* max. value for wil6210_mbox_hdr.len */ -#define MAX_MBOXITEM_SIZE (240) - -struct wil6210_mbox_hdr_wmi { - u8 reserved0[2]; - __le16 id; - __le16 info1; /* bits [0..3] - device_id, rest - unused */ - u8 reserved1[2]; -} __packed; - -struct pending_wmi_event { - struct list_head list; - struct { - struct wil6210_mbox_hdr hdr; - struct wil6210_mbox_hdr_wmi wmi; - u8 data[0]; - } __packed event; -}; - -union vring_desc; - -struct vring { - dma_addr_t pa; - volatile union vring_desc *va; /* vring_desc[size], WriteBack by DMA */ - u16 size; /* number of vring_desc elements */ - u32 swtail; - u32 swhead; - u32 hwtail; /* write here to inform hw */ - void **ctx; /* void *ctx[size] - software context */ -}; - -enum { /* for wil6210_priv.status */ - wil_status_fwready = 0, - wil_status_fwconnected, - wil_status_dontscan, - wil_status_irqen, /* FIXME: interrupts enabled - for debug */ -}; - -struct pci_dev; - -struct wil6210_stats { - u64 tsf; - u32 snr; - u16 last_mcs_rx; - u16 bf_mcs; /* last BF, used for Tx */ - u16 my_rx_sector; - u16 my_tx_sector; - u16 peer_rx_sector; - u16 peer_tx_sector; -}; - -struct wil6210_priv { - struct pci_dev *pdev; - int n_msi; - struct wireless_dev *wdev; - void __iomem *csr; - ulong status; - /* profile */ - u32 monitor_flags; - u32 secure_pcp; /* create secure PCP? */ - int sinfo_gen; - /* cached ISR registers */ - u32 isr_misc; - /* mailbox related */ - struct mutex wmi_mutex; - struct wil6210_mbox_ctl mbox_ctl; - struct completion wmi_ready; - u16 wmi_seq; - u16 reply_id; /**< wait for this WMI event */ - void *reply_buf; - u16 reply_size; - struct workqueue_struct *wmi_wq; /* for deferred calls */ - struct work_struct wmi_event_worker; - struct workqueue_struct *wmi_wq_conn; /* for connect worker */ - struct work_struct wmi_connect_worker; - struct work_struct disconnect_worker; - struct timer_list connect_timer; - int pending_connect_cid; - struct list_head pending_wmi_ev; - /* - * protect pending_wmi_ev - * - fill in IRQ from wil6210_irq_misc, - * - consumed in thread by wmi_event_worker - */ - spinlock_t wmi_ev_lock; - /* DMA related */ - struct vring vring_rx; - struct vring vring_tx[WIL6210_MAX_TX_RINGS]; - u8 dst_addr[WIL6210_MAX_TX_RINGS][ETH_ALEN]; - /* scan */ - struct cfg80211_scan_request *scan_request; - - struct mutex mutex; /* for wil6210_priv access in wil_{up|down} */ - /* statistics */ - struct wil6210_stats stats; - /* debugfs */ - struct dentry *debug; - struct debugfs_blob_wrapper fw_code_blob; - struct debugfs_blob_wrapper fw_data_blob; - struct debugfs_blob_wrapper fw_peri_blob; - struct debugfs_blob_wrapper uc_code_blob; - struct debugfs_blob_wrapper uc_data_blob; - struct debugfs_blob_wrapper rgf_blob; -}; - -#define wil_to_wiphy(i) (i->wdev->wiphy) -#define wil_to_dev(i) (wiphy_dev(wil_to_wiphy(i))) -#define wiphy_to_wil(w) (struct wil6210_priv *)(wiphy_priv(w)) -#define wil_to_wdev(i) (i->wdev) -#define wdev_to_wil(w) (struct wil6210_priv *)(wdev_priv(w)) -#define wil_to_ndev(i) (wil_to_wdev(i)->netdev) -#define ndev_to_wil(n) (wdev_to_wil(n->ieee80211_ptr)) - -#define wil_dbg(wil, fmt, arg...) netdev_dbg(wil_to_ndev(wil), fmt, ##arg) -#define wil_info(wil, fmt, arg...) netdev_info(wil_to_ndev(wil), fmt, ##arg) -#define wil_err(wil, fmt, arg...) netdev_err(wil_to_ndev(wil), fmt, ##arg) - -#define wil_dbg_IRQ(wil, fmt, arg...) wil_dbg(wil, "DBG[ IRQ]" fmt, ##arg) -#define wil_dbg_TXRX(wil, fmt, arg...) wil_dbg(wil, "DBG[TXRX]" fmt, ##arg) -#define wil_dbg_WMI(wil, fmt, arg...) wil_dbg(wil, "DBG[ WMI]" fmt, ##arg) - -#define wil_hex_dump_TXRX(prefix_str, prefix_type, rowsize, \ - groupsize, buf, len, ascii) \ - wil_print_hex_dump_debug("DBG[TXRX]" prefix_str,\ - prefix_type, rowsize, \ - groupsize, buf, len, ascii) - -#define wil_hex_dump_WMI(prefix_str, prefix_type, rowsize, \ - groupsize, buf, len, ascii) \ - wil_print_hex_dump_debug("DBG[ WMI]" prefix_str,\ - prefix_type, rowsize, \ - groupsize, buf, len, ascii) - -void wil_memcpy_fromio_32(void *dst, const volatile void __iomem *src, - size_t count); -void wil_memcpy_toio_32(volatile void __iomem *dst, const void *src, - size_t count); - -void *wil_if_alloc(struct device *dev, void __iomem *csr); -void wil_if_free(struct wil6210_priv *wil); -int wil_if_add(struct wil6210_priv *wil); -void wil_if_remove(struct wil6210_priv *wil); -int wil_priv_init(struct wil6210_priv *wil); -void wil_priv_deinit(struct wil6210_priv *wil); -int wil_reset(struct wil6210_priv *wil); -void wil_link_on(struct wil6210_priv *wil); -void wil_link_off(struct wil6210_priv *wil); -int wil_up(struct wil6210_priv *wil); -int wil_down(struct wil6210_priv *wil); -void wil_mbox_ring_le2cpus(struct wil6210_mbox_ring *r); - -void __iomem *wmi_buffer(struct wil6210_priv *wil, __le32 ptr); -void __iomem *wmi_addr(struct wil6210_priv *wil, u32 ptr); -int wmi_read_hdr(struct wil6210_priv *wil, __le32 ptr, - struct wil6210_mbox_hdr *hdr); -int wmi_send(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len); -void wmi_recv_cmd(struct wil6210_priv *wil); -int wmi_call(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len, - u16 reply_id, void *reply, u8 reply_size, int to_msec); -void wmi_connect_worker(struct work_struct *work); -void wmi_event_worker(struct work_struct *work); -void wmi_event_flush(struct wil6210_priv *wil); -int wmi_set_ssid(struct wil6210_priv *wil, u8 ssid_len, const void *ssid); -int wmi_get_ssid(struct wil6210_priv *wil, u8 *ssid_len, void *ssid); -int wmi_set_channel(struct wil6210_priv *wil, int channel); -int wmi_get_channel(struct wil6210_priv *wil, int *channel); -int wmi_tx_eapol(struct wil6210_priv *wil, struct sk_buff *skb); -int wmi_del_cipher_key(struct wil6210_priv *wil, u8 key_index, - const void *mac_addr); -int wmi_add_cipher_key(struct wil6210_priv *wil, u8 key_index, - const void *mac_addr, int key_len, const void *key); -int wmi_echo(struct wil6210_priv *wil); -int wmi_set_ie(struct wil6210_priv *wil, u8 type, u16 ie_len, const void *ie); - -int wil6210_init_irq(struct wil6210_priv *wil, int irq); -void wil6210_fini_irq(struct wil6210_priv *wil, int irq); -void wil6210_disable_irq(struct wil6210_priv *wil); -void wil6210_enable_irq(struct wil6210_priv *wil); - -int wil6210_debugfs_init(struct wil6210_priv *wil); -void wil6210_debugfs_remove(struct wil6210_priv *wil); - -struct wireless_dev *wil_cfg80211_init(struct device *dev); -void wil_wdev_free(struct wil6210_priv *wil); - -int wmi_set_mac_address(struct wil6210_priv *wil, void *addr); -int wmi_set_bcon(struct wil6210_priv *wil, int bi, u8 wmi_nettype); -void wil6210_disconnect(struct wil6210_priv *wil, void *bssid); - -int wil_rx_init(struct wil6210_priv *wil); -void wil_rx_fini(struct wil6210_priv *wil); - -/* TX API */ -int wil_vring_init_tx(struct wil6210_priv *wil, int id, int size, - int cid, int tid); -void wil_vring_fini_tx(struct wil6210_priv *wil, int id); - -netdev_tx_t wil_start_xmit(struct sk_buff *skb, struct net_device *ndev); -void wil_tx_complete(struct wil6210_priv *wil, int ringid); - -/* RX API */ -void wil_rx_handle(struct wil6210_priv *wil); - -int wil_iftype_nl2wmi(enum nl80211_iftype type); - -#endif /* __WIL6210_H__ */ diff --git a/trunk/drivers/net/wireless/ath/wil6210/wmi.c b/trunk/drivers/net/wireless/ath/wil6210/wmi.c deleted file mode 100644 index 12915f6e7617..000000000000 --- a/trunk/drivers/net/wireless/ath/wil6210/wmi.c +++ /dev/null @@ -1,975 +0,0 @@ -/* - * Copyright (c) 2012 Qualcomm Atheros, Inc. - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - -#include "wil6210.h" -#include "wmi.h" - -/** - * WMI event receiving - theory of operations - * - * When firmware about to report WMI event, it fills memory area - * in the mailbox and raises misc. IRQ. Thread interrupt handler invoked for - * the misc IRQ, function @wmi_recv_cmd called by thread IRQ handler. - * - * @wmi_recv_cmd reads event, allocates memory chunk and attaches it to the - * event list @wil->pending_wmi_ev. Then, work queue @wil->wmi_wq wakes up - * and handles events within the @wmi_event_worker. Every event get detached - * from list, processed and deleted. - * - * Purpose for this mechanism is to release IRQ thread; otherwise, - * if WMI event handling involves another WMI command flow, this 2-nd flow - * won't be completed because of blocked IRQ thread. - */ - -/** - * Addressing - theory of operations - * - * There are several buses present on the WIL6210 card. - * Same memory areas are visible at different address on - * the different busses. There are 3 main bus masters: - * - MAC CPU (ucode) - * - User CPU (firmware) - * - AHB (host) - * - * On the PCI bus, there is one BAR (BAR0) of 2Mb size, exposing - * AHB addresses starting from 0x880000 - * - * Internally, firmware uses addresses that allows faster access but - * are invisible from the host. To read from these addresses, alternative - * AHB address must be used. - * - * Memory mapping - * Linker address PCI/Host address - * 0x880000 .. 0xa80000 2Mb BAR0 - * 0x800000 .. 0x807000 0x900000 .. 0x907000 28k DCCM - * 0x840000 .. 0x857000 0x908000 .. 0x91f000 92k PERIPH - */ - -/** - * @fw_mapping provides memory remapping table - */ -static const struct { - u32 from; /* linker address - from, inclusive */ - u32 to; /* linker address - to, exclusive */ - u32 host; /* PCI/Host address - BAR0 + 0x880000 */ -} fw_mapping[] = { - {0x000000, 0x040000, 0x8c0000}, /* FW code RAM 256k */ - {0x800000, 0x808000, 0x900000}, /* FW data RAM 32k */ - {0x840000, 0x860000, 0x908000}, /* peripheral data RAM 128k/96k used */ - {0x880000, 0x88a000, 0x880000}, /* various RGF */ - {0x8c0000, 0x932000, 0x8c0000}, /* trivial mapping for upper area */ - /* - * 920000..930000 ucode code RAM - * 930000..932000 ucode data RAM - */ -}; - -/** - * return AHB address for given firmware/ucode internal (linker) address - * @x - internal address - * If address have no valid AHB mapping, return 0 - */ -static u32 wmi_addr_remap(u32 x) -{ - uint i; - - for (i = 0; i < ARRAY_SIZE(fw_mapping); i++) { - if ((x >= fw_mapping[i].from) && (x < fw_mapping[i].to)) - return x + fw_mapping[i].host - fw_mapping[i].from; - } - - return 0; -} - -/** - * Check address validity for WMI buffer; remap if needed - * @ptr - internal (linker) fw/ucode address - * - * Valid buffer should be DWORD aligned - * - * return address for accessing buffer from the host; - * if buffer is not valid, return NULL. - */ -void __iomem *wmi_buffer(struct wil6210_priv *wil, __le32 ptr_) -{ - u32 off; - u32 ptr = le32_to_cpu(ptr_); - - if (ptr % 4) - return NULL; - - ptr = wmi_addr_remap(ptr); - if (ptr < WIL6210_FW_HOST_OFF) - return NULL; - - off = HOSTADDR(ptr); - if (off > WIL6210_MEM_SIZE - 4) - return NULL; - - return wil->csr + off; -} - -/** - * Check address validity - */ -void __iomem *wmi_addr(struct wil6210_priv *wil, u32 ptr) -{ - u32 off; - - if (ptr % 4) - return NULL; - - if (ptr < WIL6210_FW_HOST_OFF) - return NULL; - - off = HOSTADDR(ptr); - if (off > WIL6210_MEM_SIZE - 4) - return NULL; - - return wil->csr + off; -} - -int wmi_read_hdr(struct wil6210_priv *wil, __le32 ptr, - struct wil6210_mbox_hdr *hdr) -{ - void __iomem *src = wmi_buffer(wil, ptr); - if (!src) - return -EINVAL; - - wil_memcpy_fromio_32(hdr, src, sizeof(*hdr)); - - return 0; -} - -static int __wmi_send(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len) -{ - struct { - struct wil6210_mbox_hdr hdr; - struct wil6210_mbox_hdr_wmi wmi; - } __packed cmd = { - .hdr = { - .type = WIL_MBOX_HDR_TYPE_WMI, - .flags = 0, - .len = cpu_to_le16(sizeof(cmd.wmi) + len), - }, - .wmi = { - .id = cpu_to_le16(cmdid), - .info1 = 0, - }, - }; - struct wil6210_mbox_ring *r = &wil->mbox_ctl.tx; - struct wil6210_mbox_ring_desc d_head; - u32 next_head; - void __iomem *dst; - void __iomem *head = wmi_addr(wil, r->head); - uint retry; - - if (sizeof(cmd) + len > r->entry_size) { - wil_err(wil, "WMI size too large: %d bytes, max is %d\n", - (int)(sizeof(cmd) + len), r->entry_size); - return -ERANGE; - - } - - might_sleep(); - - if (!test_bit(wil_status_fwready, &wil->status)) { - wil_err(wil, "FW not ready\n"); - return -EAGAIN; - } - - if (!head) { - wil_err(wil, "WMI head is garbage: 0x%08x\n", r->head); - return -EINVAL; - } - /* read Tx head till it is not busy */ - for (retry = 5; retry > 0; retry--) { - wil_memcpy_fromio_32(&d_head, head, sizeof(d_head)); - if (d_head.sync == 0) - break; - msleep(20); - } - if (d_head.sync != 0) { - wil_err(wil, "WMI head busy\n"); - return -EBUSY; - } - /* next head */ - next_head = r->base + ((r->head - r->base + sizeof(d_head)) % r->size); - wil_dbg_WMI(wil, "Head 0x%08x -> 0x%08x\n", r->head, next_head); - /* wait till FW finish with previous command */ - for (retry = 5; retry > 0; retry--) { - r->tail = ioread32(wil->csr + HOST_MBOX + - offsetof(struct wil6210_mbox_ctl, tx.tail)); - if (next_head != r->tail) - break; - msleep(20); - } - if (next_head == r->tail) { - wil_err(wil, "WMI ring full\n"); - return -EBUSY; - } - dst = wmi_buffer(wil, d_head.addr); - if (!dst) { - wil_err(wil, "invalid WMI buffer: 0x%08x\n", - le32_to_cpu(d_head.addr)); - return -EINVAL; - } - cmd.hdr.seq = cpu_to_le16(++wil->wmi_seq); - /* set command */ - wil_dbg_WMI(wil, "WMI command 0x%04x [%d]\n", cmdid, len); - wil_hex_dump_WMI("Cmd ", DUMP_PREFIX_OFFSET, 16, 1, &cmd, - sizeof(cmd), true); - wil_hex_dump_WMI("cmd ", DUMP_PREFIX_OFFSET, 16, 1, buf, - len, true); - wil_memcpy_toio_32(dst, &cmd, sizeof(cmd)); - wil_memcpy_toio_32(dst + sizeof(cmd), buf, len); - /* mark entry as full */ - iowrite32(1, wil->csr + HOSTADDR(r->head) + - offsetof(struct wil6210_mbox_ring_desc, sync)); - /* advance next ptr */ - iowrite32(r->head = next_head, wil->csr + HOST_MBOX + - offsetof(struct wil6210_mbox_ctl, tx.head)); - - /* interrupt to FW */ - iowrite32(SW_INT_MBOX, wil->csr + HOST_SW_INT); - - return 0; -} - -int wmi_send(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len) -{ - int rc; - - mutex_lock(&wil->wmi_mutex); - rc = __wmi_send(wil, cmdid, buf, len); - mutex_unlock(&wil->wmi_mutex); - - return rc; -} - -/*=== Event handlers ===*/ -static void wmi_evt_ready(struct wil6210_priv *wil, int id, void *d, int len) -{ - struct net_device *ndev = wil_to_ndev(wil); - struct wireless_dev *wdev = wil->wdev; - struct wmi_ready_event *evt = d; - u32 ver = le32_to_cpu(evt->sw_version); - - wil_dbg_WMI(wil, "FW ver. %d; MAC %pM\n", ver, evt->mac); - - if (!is_valid_ether_addr(ndev->dev_addr)) { - memcpy(ndev->dev_addr, evt->mac, ETH_ALEN); - memcpy(ndev->perm_addr, evt->mac, ETH_ALEN); - } - snprintf(wdev->wiphy->fw_version, sizeof(wdev->wiphy->fw_version), - "%d", ver); -} - -static void wmi_evt_fw_ready(struct wil6210_priv *wil, int id, void *d, - int len) -{ - wil_dbg_WMI(wil, "WMI: FW ready\n"); - - set_bit(wil_status_fwready, &wil->status); - /* reuse wmi_ready for the firmware ready indication */ - complete(&wil->wmi_ready); -} - -static void wmi_evt_rx_mgmt(struct wil6210_priv *wil, int id, void *d, int len) -{ - struct wmi_rx_mgmt_packet_event *data = d; - struct wiphy *wiphy = wil_to_wiphy(wil); - struct ieee80211_mgmt *rx_mgmt_frame = - (struct ieee80211_mgmt *)data->payload; - int ch_no = data->info.channel+1; - u32 freq = ieee80211_channel_to_frequency(ch_no, - IEEE80211_BAND_60GHZ); - struct ieee80211_channel *channel = ieee80211_get_channel(wiphy, freq); - /* TODO convert LE to CPU */ - s32 signal = 0; /* TODO */ - __le16 fc = rx_mgmt_frame->frame_control; - u32 d_len = le32_to_cpu(data->info.len); - u16 d_status = le16_to_cpu(data->info.status); - - wil_dbg_WMI(wil, "MGMT: channel %d MCS %d SNR %d\n", - data->info.channel, data->info.mcs, data->info.snr); - wil_dbg_WMI(wil, "status 0x%04x len %d stype %04x\n", d_status, d_len, - le16_to_cpu(data->info.stype)); - wil_dbg_WMI(wil, "qid %d mid %d cid %d\n", - data->info.qid, data->info.mid, data->info.cid); - - if (!channel) { - wil_err(wil, "Frame on unsupported channel\n"); - return; - } - - if (ieee80211_is_beacon(fc) || ieee80211_is_probe_resp(fc)) { - struct cfg80211_bss *bss; - u64 tsf = le64_to_cpu(rx_mgmt_frame->u.beacon.timestamp); - u16 cap = le16_to_cpu(rx_mgmt_frame->u.beacon.capab_info); - u16 bi = le16_to_cpu(rx_mgmt_frame->u.beacon.beacon_int); - const u8 *ie_buf = rx_mgmt_frame->u.beacon.variable; - size_t ie_len = d_len - offsetof(struct ieee80211_mgmt, - u.beacon.variable); - wil_dbg_WMI(wil, "Capability info : 0x%04x\n", cap); - - bss = cfg80211_inform_bss(wiphy, channel, rx_mgmt_frame->bssid, - tsf, cap, bi, ie_buf, ie_len, - signal, GFP_KERNEL); - if (bss) { - wil_dbg_WMI(wil, "Added BSS %pM\n", - rx_mgmt_frame->bssid); - cfg80211_put_bss(bss); - } else { - wil_err(wil, "cfg80211_inform_bss() failed\n"); - } - } -} - -static void wmi_evt_scan_complete(struct wil6210_priv *wil, int id, - void *d, int len) -{ - if (wil->scan_request) { - struct wmi_scan_complete_event *data = d; - bool aborted = (data->status != 0); - - wil_dbg_WMI(wil, "SCAN_COMPLETE(0x%08x)\n", data->status); - cfg80211_scan_done(wil->scan_request, aborted); - wil->scan_request = NULL; - } else { - wil_err(wil, "SCAN_COMPLETE while not scanning\n"); - } -} - -static void wmi_evt_connect(struct wil6210_priv *wil, int id, void *d, int len) -{ - struct net_device *ndev = wil_to_ndev(wil); - struct wireless_dev *wdev = wil->wdev; - struct wmi_connect_event *evt = d; - int ch; /* channel number */ - struct station_info sinfo; - u8 *assoc_req_ie, *assoc_resp_ie; - size_t assoc_req_ielen, assoc_resp_ielen; - /* capinfo(u16) + listen_interval(u16) + IEs */ - const size_t assoc_req_ie_offset = sizeof(u16) * 2; - /* capinfo(u16) + status_code(u16) + associd(u16) + IEs */ - const size_t assoc_resp_ie_offset = sizeof(u16) * 3; - - if (len < sizeof(*evt)) { - wil_err(wil, "Connect event too short : %d bytes\n", len); - return; - } - if (len != sizeof(*evt) + evt->beacon_ie_len + evt->assoc_req_len + - evt->assoc_resp_len) { - wil_err(wil, - "Connect event corrupted : %d != %d + %d + %d + %d\n", - len, (int)sizeof(*evt), evt->beacon_ie_len, - evt->assoc_req_len, evt->assoc_resp_len); - return; - } - ch = evt->channel + 1; - wil_dbg_WMI(wil, "Connect %pM channel [%d] cid %d\n", - evt->bssid, ch, evt->cid); - wil_hex_dump_WMI("connect AI : ", DUMP_PREFIX_OFFSET, 16, 1, - evt->assoc_info, len - sizeof(*evt), true); - - /* figure out IE's */ - assoc_req_ie = &evt->assoc_info[evt->beacon_ie_len + - assoc_req_ie_offset]; - assoc_req_ielen = evt->assoc_req_len - assoc_req_ie_offset; - if (evt->assoc_req_len <= assoc_req_ie_offset) { - assoc_req_ie = NULL; - assoc_req_ielen = 0; - } - - assoc_resp_ie = &evt->assoc_info[evt->beacon_ie_len + - evt->assoc_req_len + - assoc_resp_ie_offset]; - assoc_resp_ielen = evt->assoc_resp_len - assoc_resp_ie_offset; - if (evt->assoc_resp_len <= assoc_resp_ie_offset) { - assoc_resp_ie = NULL; - assoc_resp_ielen = 0; - } - - if ((wdev->iftype == NL80211_IFTYPE_STATION) || - (wdev->iftype == NL80211_IFTYPE_P2P_CLIENT)) { - if (wdev->sme_state != CFG80211_SME_CONNECTING) { - wil_err(wil, "Not in connecting state\n"); - return; - } - del_timer_sync(&wil->connect_timer); - cfg80211_connect_result(ndev, evt->bssid, - assoc_req_ie, assoc_req_ielen, - assoc_resp_ie, assoc_resp_ielen, - WLAN_STATUS_SUCCESS, GFP_KERNEL); - - } else if ((wdev->iftype == NL80211_IFTYPE_AP) || - (wdev->iftype == NL80211_IFTYPE_P2P_GO)) { - memset(&sinfo, 0, sizeof(sinfo)); - - sinfo.generation = wil->sinfo_gen++; - - if (assoc_req_ie) { - sinfo.assoc_req_ies = assoc_req_ie; - sinfo.assoc_req_ies_len = assoc_req_ielen; - sinfo.filled |= STATION_INFO_ASSOC_REQ_IES; - } - - cfg80211_new_sta(ndev, evt->bssid, &sinfo, GFP_KERNEL); - } - set_bit(wil_status_fwconnected, &wil->status); - - /* FIXME FW can transmit only ucast frames to peer */ - /* FIXME real ring_id instead of hard coded 0 */ - memcpy(wil->dst_addr[0], evt->bssid, ETH_ALEN); - - wil->pending_connect_cid = evt->cid; - queue_work(wil->wmi_wq_conn, &wil->wmi_connect_worker); -} - -static void wmi_evt_disconnect(struct wil6210_priv *wil, int id, - void *d, int len) -{ - struct wmi_disconnect_event *evt = d; - - wil_dbg_WMI(wil, "Disconnect %pM reason %d proto %d wmi\n", - evt->bssid, - evt->protocol_reason_status, evt->disconnect_reason); - - wil->sinfo_gen++; - - wil6210_disconnect(wil, evt->bssid); - clear_bit(wil_status_dontscan, &wil->status); -} - -static void wmi_evt_notify(struct wil6210_priv *wil, int id, void *d, int len) -{ - struct wmi_notify_req_done_event *evt = d; - - if (len < sizeof(*evt)) { - wil_err(wil, "Short NOTIFY event\n"); - return; - } - - wil->stats.tsf = le64_to_cpu(evt->tsf); - wil->stats.snr = le32_to_cpu(evt->snr_val); - wil->stats.bf_mcs = le16_to_cpu(evt->bf_mcs); - wil->stats.my_rx_sector = le16_to_cpu(evt->my_rx_sector); - wil->stats.my_tx_sector = le16_to_cpu(evt->my_tx_sector); - wil->stats.peer_rx_sector = le16_to_cpu(evt->other_rx_sector); - wil->stats.peer_tx_sector = le16_to_cpu(evt->other_tx_sector); - wil_dbg_WMI(wil, "Link status, MCS %d TSF 0x%016llx\n" - "BF status 0x%08x SNR 0x%08x\n" - "Tx Tpt %d goodput %d Rx goodput %d\n" - "Sectors(rx:tx) my %d:%d peer %d:%d\n", - wil->stats.bf_mcs, wil->stats.tsf, evt->status, - wil->stats.snr, le32_to_cpu(evt->tx_tpt), - le32_to_cpu(evt->tx_goodput), le32_to_cpu(evt->rx_goodput), - wil->stats.my_rx_sector, wil->stats.my_tx_sector, - wil->stats.peer_rx_sector, wil->stats.peer_tx_sector); -} - -/* - * Firmware reports EAPOL frame using WME event. - * Reconstruct Ethernet frame and deliver it via normal Rx - */ -static void wmi_evt_eapol_rx(struct wil6210_priv *wil, int id, - void *d, int len) -{ - struct net_device *ndev = wil_to_ndev(wil); - struct wmi_eapol_rx_event *evt = d; - u16 eapol_len = le16_to_cpu(evt->eapol_len); - int sz = eapol_len + ETH_HLEN; - struct sk_buff *skb; - struct ethhdr *eth; - - wil_dbg_WMI(wil, "EAPOL len %d from %pM\n", eapol_len, - evt->src_mac); - - if (eapol_len > 196) { /* TODO: revisit size limit */ - wil_err(wil, "EAPOL too large\n"); - return; - } - - skb = alloc_skb(sz, GFP_KERNEL); - if (!skb) { - wil_err(wil, "Failed to allocate skb\n"); - return; - } - eth = (struct ethhdr *)skb_put(skb, ETH_HLEN); - memcpy(eth->h_dest, ndev->dev_addr, ETH_ALEN); - memcpy(eth->h_source, evt->src_mac, ETH_ALEN); - eth->h_proto = cpu_to_be16(ETH_P_PAE); - memcpy(skb_put(skb, eapol_len), evt->eapol, eapol_len); - skb->protocol = eth_type_trans(skb, ndev); - if (likely(netif_rx_ni(skb) == NET_RX_SUCCESS)) { - ndev->stats.rx_packets++; - ndev->stats.rx_bytes += skb->len; - } else { - ndev->stats.rx_dropped++; - } -} - -static const struct { - int eventid; - void (*handler)(struct wil6210_priv *wil, int eventid, - void *data, int data_len); -} wmi_evt_handlers[] = { - {WMI_READY_EVENTID, wmi_evt_ready}, - {WMI_FW_READY_EVENTID, wmi_evt_fw_ready}, - {WMI_RX_MGMT_PACKET_EVENTID, wmi_evt_rx_mgmt}, - {WMI_SCAN_COMPLETE_EVENTID, wmi_evt_scan_complete}, - {WMI_CONNECT_EVENTID, wmi_evt_connect}, - {WMI_DISCONNECT_EVENTID, wmi_evt_disconnect}, - {WMI_NOTIFY_REQ_DONE_EVENTID, wmi_evt_notify}, - {WMI_EAPOL_RX_EVENTID, wmi_evt_eapol_rx}, -}; - -/* - * Run in IRQ context - * Extract WMI command from mailbox. Queue it to the @wil->pending_wmi_ev - * that will be eventually handled by the @wmi_event_worker in the thread - * context of thread "wil6210_wmi" - */ -void wmi_recv_cmd(struct wil6210_priv *wil) -{ - struct wil6210_mbox_ring_desc d_tail; - struct wil6210_mbox_hdr hdr; - struct wil6210_mbox_ring *r = &wil->mbox_ctl.rx; - struct pending_wmi_event *evt; - u8 *cmd; - void __iomem *src; - ulong flags; - - for (;;) { - u16 len; - - r->head = ioread32(wil->csr + HOST_MBOX + - offsetof(struct wil6210_mbox_ctl, rx.head)); - if (r->tail == r->head) - return; - - /* read cmd from tail */ - wil_memcpy_fromio_32(&d_tail, wil->csr + HOSTADDR(r->tail), - sizeof(struct wil6210_mbox_ring_desc)); - if (d_tail.sync == 0) { - wil_err(wil, "Mbox evt not owned by FW?\n"); - return; - } - - if (0 != wmi_read_hdr(wil, d_tail.addr, &hdr)) { - wil_err(wil, "Mbox evt at 0x%08x?\n", - le32_to_cpu(d_tail.addr)); - return; - } - - len = le16_to_cpu(hdr.len); - src = wmi_buffer(wil, d_tail.addr) + - sizeof(struct wil6210_mbox_hdr); - evt = kmalloc(ALIGN(offsetof(struct pending_wmi_event, - event.wmi) + len, 4), - GFP_KERNEL); - if (!evt) { - wil_err(wil, "kmalloc for WMI event (%d) failed\n", - len); - return; - } - evt->event.hdr = hdr; - cmd = (void *)&evt->event.wmi; - wil_memcpy_fromio_32(cmd, src, len); - /* mark entry as empty */ - iowrite32(0, wil->csr + HOSTADDR(r->tail) + - offsetof(struct wil6210_mbox_ring_desc, sync)); - /* indicate */ - wil_dbg_WMI(wil, "Mbox evt %04x %04x %04x %02x\n", - le16_to_cpu(hdr.seq), len, le16_to_cpu(hdr.type), - hdr.flags); - if ((hdr.type == WIL_MBOX_HDR_TYPE_WMI) && - (len >= sizeof(struct wil6210_mbox_hdr_wmi))) { - wil_dbg_WMI(wil, "WMI event 0x%04x\n", - evt->event.wmi.id); - } - wil_hex_dump_WMI("evt ", DUMP_PREFIX_OFFSET, 16, 1, - &evt->event.hdr, sizeof(hdr) + len, true); - - /* advance tail */ - r->tail = r->base + ((r->tail - r->base + - sizeof(struct wil6210_mbox_ring_desc)) % r->size); - iowrite32(r->tail, wil->csr + HOST_MBOX + - offsetof(struct wil6210_mbox_ctl, rx.tail)); - - /* add to the pending list */ - spin_lock_irqsave(&wil->wmi_ev_lock, flags); - list_add_tail(&evt->list, &wil->pending_wmi_ev); - spin_unlock_irqrestore(&wil->wmi_ev_lock, flags); - { - int q = queue_work(wil->wmi_wq, - &wil->wmi_event_worker); - wil_dbg_WMI(wil, "queue_work -> %d\n", q); - } - } -} - -int wmi_call(struct wil6210_priv *wil, u16 cmdid, void *buf, u16 len, - u16 reply_id, void *reply, u8 reply_size, int to_msec) -{ - int rc; - int remain; - - mutex_lock(&wil->wmi_mutex); - - rc = __wmi_send(wil, cmdid, buf, len); - if (rc) - goto out; - - wil->reply_id = reply_id; - wil->reply_buf = reply; - wil->reply_size = reply_size; - remain = wait_for_completion_timeout(&wil->wmi_ready, - msecs_to_jiffies(to_msec)); - if (0 == remain) { - wil_err(wil, "wmi_call(0x%04x->0x%04x) timeout %d msec\n", - cmdid, reply_id, to_msec); - rc = -ETIME; - } else { - wil_dbg_WMI(wil, - "wmi_call(0x%04x->0x%04x) completed in %d msec\n", - cmdid, reply_id, - to_msec - jiffies_to_msecs(remain)); - } - wil->reply_id = 0; - wil->reply_buf = NULL; - wil->reply_size = 0; - out: - mutex_unlock(&wil->wmi_mutex); - - return rc; -} - -int wmi_echo(struct wil6210_priv *wil) -{ - struct wmi_echo_cmd cmd = { - .value = cpu_to_le32(0x12345678), - }; - - return wmi_call(wil, WMI_ECHO_CMDID, &cmd, sizeof(cmd), - WMI_ECHO_RSP_EVENTID, NULL, 0, 20); -} - -int wmi_set_mac_address(struct wil6210_priv *wil, void *addr) -{ - struct wmi_set_mac_address_cmd cmd; - - memcpy(cmd.mac, addr, ETH_ALEN); - - wil_dbg_WMI(wil, "Set MAC %pM\n", addr); - - return wmi_send(wil, WMI_SET_MAC_ADDRESS_CMDID, &cmd, sizeof(cmd)); -} - -int wmi_set_bcon(struct wil6210_priv *wil, int bi, u8 wmi_nettype) -{ - struct wmi_bcon_ctrl_cmd cmd = { - .bcon_interval = cpu_to_le16(bi), - .network_type = wmi_nettype, - .disable_sec_offload = 1, - }; - - if (!wil->secure_pcp) - cmd.disable_sec = 1; - - return wmi_send(wil, WMI_BCON_CTRL_CMDID, &cmd, sizeof(cmd)); -} - -int wmi_set_ssid(struct wil6210_priv *wil, u8 ssid_len, const void *ssid) -{ - struct wmi_set_ssid_cmd cmd = { - .ssid_len = cpu_to_le32(ssid_len), - }; - - if (ssid_len > sizeof(cmd.ssid)) - return -EINVAL; - - memcpy(cmd.ssid, ssid, ssid_len); - - return wmi_send(wil, WMI_SET_SSID_CMDID, &cmd, sizeof(cmd)); -} - -int wmi_get_ssid(struct wil6210_priv *wil, u8 *ssid_len, void *ssid) -{ - int rc; - struct { - struct wil6210_mbox_hdr_wmi wmi; - struct wmi_set_ssid_cmd cmd; - } __packed reply; - int len; /* reply.cmd.ssid_len in CPU order */ - - rc = wmi_call(wil, WMI_GET_SSID_CMDID, NULL, 0, WMI_GET_SSID_EVENTID, - &reply, sizeof(reply), 20); - if (rc) - return rc; - - len = le32_to_cpu(reply.cmd.ssid_len); - if (len > sizeof(reply.cmd.ssid)) - return -EINVAL; - - *ssid_len = len; - memcpy(ssid, reply.cmd.ssid, len); - - return 0; -} - -int wmi_set_channel(struct wil6210_priv *wil, int channel) -{ - struct wmi_set_pcp_channel_cmd cmd = { - .channel = channel - 1, - }; - - return wmi_send(wil, WMI_SET_PCP_CHANNEL_CMDID, &cmd, sizeof(cmd)); -} - -int wmi_get_channel(struct wil6210_priv *wil, int *channel) -{ - int rc; - struct { - struct wil6210_mbox_hdr_wmi wmi; - struct wmi_set_pcp_channel_cmd cmd; - } __packed reply; - - rc = wmi_call(wil, WMI_GET_PCP_CHANNEL_CMDID, NULL, 0, - WMI_GET_PCP_CHANNEL_EVENTID, &reply, sizeof(reply), 20); - if (rc) - return rc; - - if (reply.cmd.channel > 3) - return -EINVAL; - - *channel = reply.cmd.channel + 1; - - return 0; -} - -int wmi_tx_eapol(struct wil6210_priv *wil, struct sk_buff *skb) -{ - struct wmi_eapol_tx_cmd *cmd; - struct ethhdr *eth; - u16 eapol_len = skb->len - ETH_HLEN; - void *eapol = skb->data + ETH_HLEN; - uint i; - int rc; - - skb_set_mac_header(skb, 0); - eth = eth_hdr(skb); - wil_dbg_WMI(wil, "EAPOL %d bytes to %pM\n", eapol_len, eth->h_dest); - for (i = 0; i < ARRAY_SIZE(wil->vring_tx); i++) { - if (memcmp(wil->dst_addr[i], eth->h_dest, ETH_ALEN) == 0) - goto found_dest; - } - - return -EINVAL; - - found_dest: - /* find out eapol data & len */ - cmd = kzalloc(sizeof(*cmd) + eapol_len, GFP_KERNEL); - if (!cmd) - return -EINVAL; - - memcpy(cmd->dst_mac, eth->h_dest, ETH_ALEN); - cmd->eapol_len = cpu_to_le16(eapol_len); - memcpy(cmd->eapol, eapol, eapol_len); - rc = wmi_send(wil, WMI_EAPOL_TX_CMDID, cmd, sizeof(*cmd) + eapol_len); - kfree(cmd); - - return rc; -} - -int wmi_del_cipher_key(struct wil6210_priv *wil, u8 key_index, - const void *mac_addr) -{ - struct wmi_delete_cipher_key_cmd cmd = { - .key_index = key_index, - }; - - if (mac_addr) - memcpy(cmd.mac, mac_addr, WMI_MAC_LEN); - - return wmi_send(wil, WMI_DELETE_CIPHER_KEY_CMDID, &cmd, sizeof(cmd)); -} - -int wmi_add_cipher_key(struct wil6210_priv *wil, u8 key_index, - const void *mac_addr, int key_len, const void *key) -{ - struct wmi_add_cipher_key_cmd cmd = { - .key_index = key_index, - .key_usage = WMI_KEY_USE_PAIRWISE, - .key_len = key_len, - }; - - if (!key || (key_len > sizeof(cmd.key))) - return -EINVAL; - - memcpy(cmd.key, key, key_len); - if (mac_addr) - memcpy(cmd.mac, mac_addr, WMI_MAC_LEN); - - return wmi_send(wil, WMI_ADD_CIPHER_KEY_CMDID, &cmd, sizeof(cmd)); -} - -int wmi_set_ie(struct wil6210_priv *wil, u8 type, u16 ie_len, const void *ie) -{ - int rc; - u16 len = sizeof(struct wmi_set_appie_cmd) + ie_len; - struct wmi_set_appie_cmd *cmd = kzalloc(len, GFP_KERNEL); - if (!cmd) { - wil_err(wil, "kmalloc(%d) failed\n", len); - return -ENOMEM; - } - - cmd->mgmt_frm_type = type; - /* BUG: FW API define ieLen as u8. Will fix FW */ - cmd->ie_len = cpu_to_le16(ie_len); - memcpy(cmd->ie_info, ie, ie_len); - rc = wmi_send(wil, WMI_SET_APPIE_CMDID, &cmd, len); - kfree(cmd); - - return rc; -} - -void wmi_event_flush(struct wil6210_priv *wil) -{ - struct pending_wmi_event *evt, *t; - - wil_dbg_WMI(wil, "%s()\n", __func__); - - list_for_each_entry_safe(evt, t, &wil->pending_wmi_ev, list) { - list_del(&evt->list); - kfree(evt); - } -} - -static bool wmi_evt_call_handler(struct wil6210_priv *wil, int id, - void *d, int len) -{ - uint i; - - for (i = 0; i < ARRAY_SIZE(wmi_evt_handlers); i++) { - if (wmi_evt_handlers[i].eventid == id) { - wmi_evt_handlers[i].handler(wil, id, d, len); - return true; - } - } - - return false; -} - -static void wmi_event_handle(struct wil6210_priv *wil, - struct wil6210_mbox_hdr *hdr) -{ - u16 len = le16_to_cpu(hdr->len); - - if ((hdr->type == WIL_MBOX_HDR_TYPE_WMI) && - (len >= sizeof(struct wil6210_mbox_hdr_wmi))) { - struct wil6210_mbox_hdr_wmi *wmi = (void *)(&hdr[1]); - void *evt_data = (void *)(&wmi[1]); - u16 id = le16_to_cpu(wmi->id); - /* check if someone waits for this event */ - if (wil->reply_id && wil->reply_id == id) { - if (wil->reply_buf) { - memcpy(wil->reply_buf, wmi, - min(len, wil->reply_size)); - } else { - wmi_evt_call_handler(wil, id, evt_data, - len - sizeof(*wmi)); - } - wil_dbg_WMI(wil, "Complete WMI 0x%04x\n", id); - complete(&wil->wmi_ready); - return; - } - /* unsolicited event */ - /* search for handler */ - if (!wmi_evt_call_handler(wil, id, evt_data, - len - sizeof(*wmi))) { - wil_err(wil, "Unhandled event 0x%04x\n", id); - } - } else { - wil_err(wil, "Unknown event type\n"); - print_hex_dump(KERN_ERR, "evt?? ", DUMP_PREFIX_OFFSET, 16, 1, - hdr, sizeof(*hdr) + len, true); - } -} - -/* - * Retrieve next WMI event from the pending list - */ -static struct list_head *next_wmi_ev(struct wil6210_priv *wil) -{ - ulong flags; - struct list_head *ret = NULL; - - spin_lock_irqsave(&wil->wmi_ev_lock, flags); - - if (!list_empty(&wil->pending_wmi_ev)) { - ret = wil->pending_wmi_ev.next; - list_del(ret); - } - - spin_unlock_irqrestore(&wil->wmi_ev_lock, flags); - - return ret; -} - -/* - * Handler for the WMI events - */ -void wmi_event_worker(struct work_struct *work) -{ - struct wil6210_priv *wil = container_of(work, struct wil6210_priv, - wmi_event_worker); - struct pending_wmi_event *evt; - struct list_head *lh; - - while ((lh = next_wmi_ev(wil)) != NULL) { - evt = list_entry(lh, struct pending_wmi_event, list); - wmi_event_handle(wil, &evt->event.hdr); - kfree(evt); - } -} - -void wmi_connect_worker(struct work_struct *work) -{ - int rc; - struct wil6210_priv *wil = container_of(work, struct wil6210_priv, - wmi_connect_worker); - - if (wil->pending_connect_cid < 0) { - wil_err(wil, "No connection pending\n"); - return; - } - - wil_dbg_WMI(wil, "Configure for connection CID %d\n", - wil->pending_connect_cid); - - rc = wil_vring_init_tx(wil, 0, WIL6210_TX_RING_SIZE, - wil->pending_connect_cid, 0); - wil->pending_connect_cid = -1; - if (rc == 0) - wil_link_on(wil); -} diff --git a/trunk/drivers/net/wireless/ath/wil6210/wmi.h b/trunk/drivers/net/wireless/ath/wil6210/wmi.h deleted file mode 100644 index 3bbf87572b07..000000000000 --- a/trunk/drivers/net/wireless/ath/wil6210/wmi.h +++ /dev/null @@ -1,1116 +0,0 @@ -/* - * Copyright (c) 2012 Qualcomm Atheros, Inc. - * Copyright (c) 2006-2012 Wilocity . - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* - * This file contains the definitions of the WMI protocol specified in the - * Wireless Module Interface (WMI) for the Wilocity - * MARLON 60 Gigabit wireless solution. - * It includes definitions of all the commands and events. - * Commands are messages from the host to the WM. - * Events are messages from the WM to the host. - */ - -#ifndef __WILOCITY_WMI_H__ -#define __WILOCITY_WMI_H__ - -/* General */ - -#define WMI_MAC_LEN (6) -#define WMI_PROX_RANGE_NUM (3) - -/* List of Commands */ -enum wmi_command_id { - WMI_CONNECT_CMDID = 0x0001, - WMI_DISCONNECT_CMDID = 0x0003, - WMI_START_SCAN_CMDID = 0x0007, - WMI_SET_BSS_FILTER_CMDID = 0x0009, - WMI_SET_PROBED_SSID_CMDID = 0x000a, - WMI_SET_LISTEN_INT_CMDID = 0x000b, - WMI_BCON_CTRL_CMDID = 0x000f, - WMI_ADD_CIPHER_KEY_CMDID = 0x0016, - WMI_DELETE_CIPHER_KEY_CMDID = 0x0017, - WMI_SET_APPIE_CMDID = 0x003f, - WMI_GET_APPIE_CMDID = 0x0040, - WMI_SET_WSC_STATUS_CMDID = 0x0041, - WMI_PXMT_RANGE_CFG_CMDID = 0x0042, - WMI_PXMT_SNR2_RANGE_CFG_CMDID = 0x0043, - WMI_FAST_MEM_ACC_MODE_CMDID = 0x0300, - WMI_MEM_READ_CMDID = 0x0800, - WMI_MEM_WR_CMDID = 0x0801, - WMI_ECHO_CMDID = 0x0803, - WMI_DEEP_ECHO_CMDID = 0x0804, - WMI_CONFIG_MAC_CMDID = 0x0805, - WMI_CONFIG_PHY_DEBUG_CMDID = 0x0806, - WMI_ADD_STATION_CMDID = 0x0807, - WMI_ADD_DEBUG_TX_PCKT_CMDID = 0x0808, - WMI_PHY_GET_STATISTICS_CMDID = 0x0809, - WMI_FS_TUNE_CMDID = 0x080a, - WMI_CORR_MEASURE_CMDID = 0x080b, - WMI_TEMP_SENSE_CMDID = 0x080e, - WMI_DC_CALIB_CMDID = 0x080f, - WMI_SEND_TONE_CMDID = 0x0810, - WMI_IQ_TX_CALIB_CMDID = 0x0811, - WMI_IQ_RX_CALIB_CMDID = 0x0812, - WMI_SET_UCODE_IDLE_CMDID = 0x0813, - WMI_SET_WORK_MODE_CMDID = 0x0815, - WMI_LO_LEAKAGE_CALIB_CMDID = 0x0816, - WMI_MARLON_R_ACTIVATE_CMDID = 0x0817, - WMI_MARLON_R_READ_CMDID = 0x0818, - WMI_MARLON_R_WRITE_CMDID = 0x0819, - WMI_MARLON_R_TXRX_SEL_CMDID = 0x081a, - MAC_IO_STATIC_PARAMS_CMDID = 0x081b, - MAC_IO_DYNAMIC_PARAMS_CMDID = 0x081c, - WMI_SILENT_RSSI_CALIB_CMDID = 0x081d, - WMI_CFG_RX_CHAIN_CMDID = 0x0820, - WMI_VRING_CFG_CMDID = 0x0821, - WMI_RX_ON_CMDID = 0x0822, - WMI_VRING_BA_EN_CMDID = 0x0823, - WMI_VRING_BA_DIS_CMDID = 0x0824, - WMI_RCP_ADDBA_RESP_CMDID = 0x0825, - WMI_RCP_DELBA_CMDID = 0x0826, - WMI_SET_SSID_CMDID = 0x0827, - WMI_GET_SSID_CMDID = 0x0828, - WMI_SET_PCP_CHANNEL_CMDID = 0x0829, - WMI_GET_PCP_CHANNEL_CMDID = 0x082a, - WMI_SW_TX_REQ_CMDID = 0x082b, - WMI_RX_OFF_CMDID = 0x082c, - WMI_READ_MAC_RXQ_CMDID = 0x0830, - WMI_READ_MAC_TXQ_CMDID = 0x0831, - WMI_WRITE_MAC_RXQ_CMDID = 0x0832, - WMI_WRITE_MAC_TXQ_CMDID = 0x0833, - WMI_WRITE_MAC_XQ_FIELD_CMDID = 0x0834, - WMI_MLME_PUSH_CMDID = 0x0835, - WMI_BEAMFORMING_MGMT_CMDID = 0x0836, - WMI_BF_TXSS_MGMT_CMDID = 0x0837, - WMI_BF_SM_MGMT_CMDID = 0x0838, - WMI_BF_RXSS_MGMT_CMDID = 0x0839, - WMI_SET_SECTORS_CMDID = 0x0849, - WMI_MAINTAIN_PAUSE_CMDID = 0x0850, - WMI_MAINTAIN_RESUME_CMDID = 0x0851, - WMI_RS_MGMT_CMDID = 0x0852, - WMI_RF_MGMT_CMDID = 0x0853, - /* Performance monitoring commands */ - WMI_BF_CTRL_CMDID = 0x0862, - WMI_NOTIFY_REQ_CMDID = 0x0863, - WMI_GET_STATUS_CMDID = 0x0864, - WMI_UNIT_TEST_CMDID = 0x0900, - WMI_HICCUP_CMDID = 0x0901, - WMI_FLASH_READ_CMDID = 0x0902, - WMI_FLASH_WRITE_CMDID = 0x0903, - WMI_SECURITY_UNIT_TEST_CMDID = 0x0904, - - WMI_SET_MAC_ADDRESS_CMDID = 0xf003, - WMI_ABORT_SCAN_CMDID = 0xf007, - WMI_SET_PMK_CMDID = 0xf028, - - WMI_SET_PROMISCUOUS_MODE_CMDID = 0xf041, - WMI_GET_PMK_CMDID = 0xf048, - WMI_SET_PASSPHRASE_CMDID = 0xf049, - WMI_SEND_ASSOC_RES_CMDID = 0xf04a, - WMI_SET_ASSOC_REQ_RELAY_CMDID = 0xf04b, - WMI_EAPOL_TX_CMDID = 0xf04c, - WMI_MAC_ADDR_REQ_CMDID = 0xf04d, - WMI_FW_VER_CMDID = 0xf04e, -}; - -/* - * Commands data structures - */ - -/* - * Frame Types - */ -enum wmi_mgmt_frame_type { - WMI_FRAME_BEACON = 0, - WMI_FRAME_PROBE_REQ = 1, - WMI_FRAME_PROBE_RESP = 2, - WMI_FRAME_ASSOC_REQ = 3, - WMI_FRAME_ASSOC_RESP = 4, - WMI_NUM_MGMT_FRAME, -}; - -/* - * WMI_CONNECT_CMDID - */ -enum wmi_network_type { - WMI_NETTYPE_INFRA = 0x01, - WMI_NETTYPE_ADHOC = 0x02, - WMI_NETTYPE_ADHOC_CREATOR = 0x04, - WMI_NETTYPE_AP = 0x10, - WMI_NETTYPE_P2P = 0x20, - WMI_NETTYPE_WBE = 0x40, /* PCIE over 60g */ -}; - -enum wmi_dot11_auth_mode { - WMI_AUTH11_OPEN = 0x01, - WMI_AUTH11_SHARED = 0x02, - WMI_AUTH11_LEAP = 0x04, - WMI_AUTH11_WSC = 0x08, -}; - -enum wmi_auth_mode { - WMI_AUTH_NONE = 0x01, - WMI_AUTH_WPA = 0x02, - WMI_AUTH_WPA2 = 0x04, - WMI_AUTH_WPA_PSK = 0x08, - WMI_AUTH_WPA2_PSK = 0x10, - WMI_AUTH_WPA_CCKM = 0x20, - WMI_AUTH_WPA2_CCKM = 0x40, -}; - -enum wmi_crypto_type { - WMI_CRYPT_NONE = 0x01, - WMI_CRYPT_WEP = 0x02, - WMI_CRYPT_TKIP = 0x04, - WMI_CRYPT_AES = 0x08, - WMI_CRYPT_AES_GCMP = 0x20, -}; - - -enum wmi_connect_ctrl_flag_bits { - WMI_CONNECT_ASSOC_POLICY_USER = 0x0001, - WMI_CONNECT_SEND_REASSOC = 0x0002, - WMI_CONNECT_IGNORE_WPAx_GROUP_CIPHER = 0x0004, - WMI_CONNECT_PROFILE_MATCH_DONE = 0x0008, - WMI_CONNECT_IGNORE_AAC_BEACON = 0x0010, - WMI_CONNECT_CSA_FOLLOW_BSS = 0x0020, - WMI_CONNECT_DO_WPA_OFFLOAD = 0x0040, - WMI_CONNECT_DO_NOT_DEAUTH = 0x0080, -}; - -#define WMI_MAX_SSID_LEN (32) - -struct wmi_connect_cmd { - u8 network_type; - u8 dot11_auth_mode; - u8 auth_mode; - u8 pairwise_crypto_type; - u8 pairwise_crypto_len; - u8 group_crypto_type; - u8 group_crypto_len; - u8 ssid_len; - u8 ssid[WMI_MAX_SSID_LEN]; - u8 channel; - u8 reserved0; - u8 bssid[WMI_MAC_LEN]; - __le32 ctrl_flags; - u8 dst_mac[WMI_MAC_LEN]; - u8 reserved1[2]; -} __packed; - - -/* - * WMI_RECONNECT_CMDID - */ -struct wmi_reconnect_cmd { - u8 channel; /* hint */ - u8 reserved; - u8 bssid[WMI_MAC_LEN]; /* mandatory if set */ -} __packed; - - -/* - * WMI_SET_PMK_CMDID - */ - -#define WMI_MIN_KEY_INDEX (0) -#define WMI_MAX_KEY_INDEX (3) -#define WMI_MAX_KEY_LEN (32) -#define WMI_PASSPHRASE_LEN (64) -#define WMI_PMK_LEN (32) - -struct wmi_set_pmk_cmd { - u8 pmk[WMI_PMK_LEN]; -} __packed; - - -/* - * WMI_SET_PASSPHRASE_CMDID - */ -struct wmi_set_passphrase_cmd { - u8 ssid[WMI_MAX_SSID_LEN]; - u8 passphrase[WMI_PASSPHRASE_LEN]; - u8 ssid_len; - u8 passphrase_len; -} __packed; - -/* - * WMI_ADD_CIPHER_KEY_CMDID - */ -enum wmi_key_usage { - WMI_KEY_USE_PAIRWISE = 0, - WMI_KEY_USE_GROUP = 1, - WMI_KEY_USE_TX = 2, /* default Tx Key - Static WEP only */ -}; - -struct wmi_add_cipher_key_cmd { - u8 key_index; - u8 key_type; - u8 key_usage; /* enum wmi_key_usage */ - u8 key_len; - u8 key_rsc[8]; /* key replay sequence counter */ - u8 key[WMI_MAX_KEY_LEN]; - u8 key_op_ctrl; /* Additional Key Control information */ - u8 mac[WMI_MAC_LEN]; -} __packed; - -/* - * WMI_DELETE_CIPHER_KEY_CMDID - */ -struct wmi_delete_cipher_key_cmd { - u8 key_index; - u8 mac[WMI_MAC_LEN]; -} __packed; - - -/* - * WMI_START_SCAN_CMDID - * - * Start L1 scan operation - * - * Returned events: - * - WMI_RX_MGMT_PACKET_EVENTID - for every probe resp. - * - WMI_SCAN_COMPLETE_EVENTID - */ -enum wmi_scan_type { - WMI_LONG_SCAN = 0, - WMI_SHORT_SCAN = 1, -}; - -struct wmi_start_scan_cmd { - u8 reserved[8]; - __le32 home_dwell_time; /* Max duration in the home channel(ms) */ - __le32 force_scan_interval; /* Time interval between scans (ms)*/ - u8 scan_type; /* wmi_scan_type */ - u8 num_channels; /* how many channels follow */ - struct { - u8 channel; - u8 reserved; - } channel_list[0]; /* channels ID's */ - /* 0 - 58320 MHz */ - /* 1 - 60480 MHz */ - /* 2 - 62640 MHz */ -} __packed; - -/* - * WMI_SET_PROBED_SSID_CMDID - */ -#define MAX_PROBED_SSID_INDEX (15) - -enum wmi_ssid_flag { - WMI_SSID_FLAG_DISABLE = 0, /* disables entry */ - WMI_SSID_FLAG_SPECIFIC = 1, /* probes specified ssid */ - WMI_SSID_FLAG_ANY = 2, /* probes for any ssid */ -}; - -struct wmi_probed_ssid_cmd { - u8 entry_index; /* 0 to MAX_PROBED_SSID_INDEX */ - u8 flag; /* enum wmi_ssid_flag */ - u8 ssid_len; - u8 ssid[WMI_MAX_SSID_LEN]; -} __packed; - -/* - * WMI_SET_APPIE_CMDID - * Add Application specified IE to a management frame - */ -struct wmi_set_appie_cmd { - u8 mgmt_frm_type; /* enum wmi_mgmt_frame_type */ - u8 reserved; - __le16 ie_len; /* Length of the IE to be added to MGMT frame */ - u8 ie_info[0]; -} __packed; - -#define WMI_MAX_IE_LEN (1024) - -struct wmi_pxmt_range_cfg_cmd { - u8 dst_mac[WMI_MAC_LEN]; - __le16 range; -} __packed; - -struct wmi_pxmt_snr2_range_cfg_cmd { - s8 snr2range_arr[WMI_PROX_RANGE_NUM-1]; -} __packed; - -/* - * WMI_RF_MGMT_CMDID - */ -enum wmi_rf_mgmt_type { - WMI_RF_MGMT_W_DISABLE = 0, - WMI_RF_MGMT_W_ENABLE = 1, - WMI_RF_MGMT_GET_STATUS = 2, -}; - -struct wmi_rf_mgmt_cmd { - __le32 rf_mgmt_type; -} __packed; - -/* - * WMI_SET_SSID_CMDID - */ -struct wmi_set_ssid_cmd { - __le32 ssid_len; - u8 ssid[WMI_MAX_SSID_LEN]; -} __packed; - -/* - * WMI_SET_PCP_CHANNEL_CMDID - */ -struct wmi_set_pcp_channel_cmd { - u8 channel; - u8 reserved[3]; -} __packed; - -/* - * WMI_BCON_CTRL_CMDID - */ -struct wmi_bcon_ctrl_cmd { - __le16 bcon_interval; - __le16 frag_num; - __le64 ss_mask; - u8 network_type; - u8 reserved; - u8 disable_sec_offload; - u8 disable_sec; -} __packed; - -/* - * WMI_SW_TX_REQ_CMDID - */ -struct wmi_sw_tx_req_cmd { - u8 dst_mac[WMI_MAC_LEN]; - __le16 len; - u8 payload[0]; -} __packed; - -/* - * WMI_VRING_CFG_CMDID - */ - -struct wmi_sw_ring_cfg { - __le64 ring_mem_base; - __le16 ring_size; - __le16 max_mpdu_size; -} __packed; - -struct wmi_vring_cfg_schd { - __le16 priority; - __le16 timeslot_us; -} __packed; - -enum wmi_vring_cfg_encap_trans_type { - WMI_VRING_ENC_TYPE_802_3 = 0, - WMI_VRING_ENC_TYPE_NATIVE_WIFI = 1, -}; - -enum wmi_vring_cfg_ds_cfg { - WMI_VRING_DS_PBSS = 0, - WMI_VRING_DS_STATION = 1, - WMI_VRING_DS_AP = 2, - WMI_VRING_DS_ADDR4 = 3, -}; - -enum wmi_vring_cfg_nwifi_ds_trans_type { - WMI_NWIFI_TX_TRANS_MODE_NO = 0, - WMI_NWIFI_TX_TRANS_MODE_AP2PBSS = 1, - WMI_NWIFI_TX_TRANS_MODE_STA2PBSS = 2, -}; - -enum wmi_vring_cfg_schd_params_priority { - WMI_SCH_PRIO_REGULAR = 0, - WMI_SCH_PRIO_HIGH = 1, -}; - -struct wmi_vring_cfg { - struct wmi_sw_ring_cfg tx_sw_ring; - u8 ringid; /* 0-23 vrings */ - - #define CIDXTID_CID_POS (0) - #define CIDXTID_CID_LEN (4) - #define CIDXTID_CID_MSK (0xF) - #define CIDXTID_TID_POS (4) - #define CIDXTID_TID_LEN (4) - #define CIDXTID_TID_MSK (0xF0) - u8 cidxtid; - - u8 encap_trans_type; - u8 ds_cfg; /* 802.3 DS cfg */ - u8 nwifi_ds_trans_type; - - #define VRING_CFG_MAC_CTRL_LIFETIME_EN_POS (0) - #define VRING_CFG_MAC_CTRL_LIFETIME_EN_LEN (1) - #define VRING_CFG_MAC_CTRL_LIFETIME_EN_MSK (0x1) - #define VRING_CFG_MAC_CTRL_AGGR_EN_POS (1) - #define VRING_CFG_MAC_CTRL_AGGR_EN_LEN (1) - #define VRING_CFG_MAC_CTRL_AGGR_EN_MSK (0x2) - u8 mac_ctrl; - - #define VRING_CFG_TO_RESOLUTION_VALUE_POS (0) - #define VRING_CFG_TO_RESOLUTION_VALUE_LEN (6) - #define VRING_CFG_TO_RESOLUTION_VALUE_MSK (0x3F) - u8 to_resolution; - u8 agg_max_wsize; - struct wmi_vring_cfg_schd schd_params; -} __packed; - -enum wmi_vring_cfg_cmd_action { - WMI_VRING_CMD_ADD = 0, - WMI_VRING_CMD_MODIFY = 1, - WMI_VRING_CMD_DELETE = 2, -}; - -struct wmi_vring_cfg_cmd { - __le32 action; - struct wmi_vring_cfg vring_cfg; -} __packed; - -/* - * WMI_VRING_BA_EN_CMDID - */ -struct wmi_vring_ba_en_cmd { - u8 ringid; - u8 agg_max_wsize; - __le16 ba_timeout; -} __packed; - -/* - * WMI_VRING_BA_DIS_CMDID - */ -struct wmi_vring_ba_dis_cmd { - u8 ringid; - u8 reserved; - __le16 reason; -} __packed; - -/* - * WMI_NOTIFY_REQ_CMDID - */ -struct wmi_notify_req_cmd { - u8 cid; - u8 reserved[3]; - __le32 interval_usec; -} __packed; - -/* - * WMI_CFG_RX_CHAIN_CMDID - */ -enum wmi_sniffer_cfg_mode { - WMI_SNIFFER_OFF = 0, - WMI_SNIFFER_ON = 1, -}; - -enum wmi_sniffer_cfg_phy_info_mode { - WMI_SNIFFER_PHY_INFO_DISABLED = 0, - WMI_SNIFFER_PHY_INFO_ENABLED = 1, -}; - -enum wmi_sniffer_cfg_phy_support { - WMI_SNIFFER_CP = 0, - WMI_SNIFFER_DP = 1, - WMI_SNIFFER_BOTH_PHYS = 2, -}; - -struct wmi_sniffer_cfg { - __le32 mode; /* enum wmi_sniffer_cfg_mode */ - __le32 phy_info_mode; /* enum wmi_sniffer_cfg_phy_info_mode */ - __le32 phy_support; /* enum wmi_sniffer_cfg_phy_support */ - u8 channel; - u8 reserved[3]; -} __packed; - -enum wmi_cfg_rx_chain_cmd_action { - WMI_RX_CHAIN_ADD = 0, - WMI_RX_CHAIN_DEL = 1, -}; - -enum wmi_cfg_rx_chain_cmd_decap_trans_type { - WMI_DECAP_TYPE_802_3 = 0, - WMI_DECAP_TYPE_NATIVE_WIFI = 1, -}; - -enum wmi_cfg_rx_chain_cmd_nwifi_ds_trans_type { - WMI_NWIFI_RX_TRANS_MODE_NO = 0, - WMI_NWIFI_RX_TRANS_MODE_PBSS2AP = 1, - WMI_NWIFI_RX_TRANS_MODE_PBSS2STA = 2, -}; - -struct wmi_cfg_rx_chain_cmd { - __le32 action; - struct wmi_sw_ring_cfg rx_sw_ring; - u8 mid; - u8 decap_trans_type; - - #define L2_802_3_OFFLOAD_CTRL_VLAN_TAG_INSERTION_POS (0) - #define L2_802_3_OFFLOAD_CTRL_VLAN_TAG_INSERTION_LEN (1) - #define L2_802_3_OFFLOAD_CTRL_VLAN_TAG_INSERTION_MSK (0x1) - u8 l2_802_3_offload_ctrl; - - #define L2_NWIFI_OFFLOAD_CTRL_REMOVE_QOS_POS (0) - #define L2_NWIFI_OFFLOAD_CTRL_REMOVE_QOS_LEN (1) - #define L2_NWIFI_OFFLOAD_CTRL_REMOVE_QOS_MSK (0x1) - #define L2_NWIFI_OFFLOAD_CTRL_REMOVE_PN_POS (1) - #define L2_NWIFI_OFFLOAD_CTRL_REMOVE_PN_LEN (1) - #define L2_NWIFI_OFFLOAD_CTRL_REMOVE_PN_MSK (0x2) - u8 l2_nwifi_offload_ctrl; - - u8 vlan_id; - u8 nwifi_ds_trans_type; - - #define L3_L4_CTRL_IPV4_CHECKSUM_EN_POS (0) - #define L3_L4_CTRL_IPV4_CHECKSUM_EN_LEN (1) - #define L3_L4_CTRL_IPV4_CHECKSUM_EN_MSK (0x1) - #define L3_L4_CTRL_TCPIP_CHECKSUM_EN_POS (1) - #define L3_L4_CTRL_TCPIP_CHECKSUM_EN_LEN (1) - #define L3_L4_CTRL_TCPIP_CHECKSUM_EN_MSK (0x2) - u8 l3_l4_ctrl; - - #define RING_CTRL_OVERRIDE_PREFETCH_THRSH_POS (0) - #define RING_CTRL_OVERRIDE_PREFETCH_THRSH_LEN (1) - #define RING_CTRL_OVERRIDE_PREFETCH_THRSH_MSK (0x1) - #define RING_CTRL_OVERRIDE_WB_THRSH_POS (1) - #define RING_CTRL_OVERRIDE_WB_THRSH_LEN (1) - #define RING_CTRL_OVERRIDE_WB_THRSH_MSK (0x2) - #define RING_CTRL_OVERRIDE_ITR_THRSH_POS (2) - #define RING_CTRL_OVERRIDE_ITR_THRSH_LEN (1) - #define RING_CTRL_OVERRIDE_ITR_THRSH_MSK (0x4) - #define RING_CTRL_OVERRIDE_HOST_THRSH_POS (3) - #define RING_CTRL_OVERRIDE_HOST_THRSH_LEN (1) - #define RING_CTRL_OVERRIDE_HOST_THRSH_MSK (0x8) - u8 ring_ctrl; - - __le16 prefetch_thrsh; - __le16 wb_thrsh; - __le32 itr_value; - __le16 host_thrsh; - u8 reserved[2]; - struct wmi_sniffer_cfg sniffer_cfg; -} __packed; - -/* - * WMI_RCP_ADDBA_RESP_CMDID - */ -struct wmi_rcp_addba_resp_cmd { - - #define CIDXTID_CID_POS (0) - #define CIDXTID_CID_LEN (4) - #define CIDXTID_CID_MSK (0xF) - #define CIDXTID_TID_POS (4) - #define CIDXTID_TID_LEN (4) - #define CIDXTID_TID_MSK (0xF0) - u8 cidxtid; - - u8 dialog_token; - __le16 status_code; - __le16 ba_param_set; /* ieee80211_ba_parameterset field to send */ - __le16 ba_timeout; -} __packed; - -/* - * WMI_RCP_DELBA_CMDID - */ -struct wmi_rcp_delba_cmd { - - #define CIDXTID_CID_POS (0) - #define CIDXTID_CID_LEN (4) - #define CIDXTID_CID_MSK (0xF) - #define CIDXTID_TID_POS (4) - #define CIDXTID_TID_LEN (4) - #define CIDXTID_TID_MSK (0xF0) - u8 cidxtid; - - u8 reserved; - __le16 reason; -} __packed; - -/* - * WMI_RCP_ADDBA_REQ_CMDID - */ -struct wmi_rcp_addba_req_cmd { - - #define CIDXTID_CID_POS (0) - #define CIDXTID_CID_LEN (4) - #define CIDXTID_CID_MSK (0xF) - #define CIDXTID_TID_POS (4) - #define CIDXTID_TID_LEN (4) - #define CIDXTID_TID_MSK (0xF0) - u8 cidxtid; - - u8 dialog_token; - /* ieee80211_ba_parameterset field as it received */ - __le16 ba_param_set; - __le16 ba_timeout; - /* ieee80211_ba_seqstrl field as it received */ - __le16 ba_seq_ctrl; -} __packed; - -/* - * WMI_SET_MAC_ADDRESS_CMDID - */ -struct wmi_set_mac_address_cmd { - u8 mac[WMI_MAC_LEN]; - u8 reserved[2]; -} __packed; - - -/* -* WMI_EAPOL_TX_CMDID -*/ -struct wmi_eapol_tx_cmd { - u8 dst_mac[WMI_MAC_LEN]; - __le16 eapol_len; - u8 eapol[0]; -} __packed; - -/* - * WMI_ECHO_CMDID - * - * Check FW is alive - * - * WMI_DEEP_ECHO_CMDID - * - * Check FW and ucode are alive - * - * Returned event: WMI_ECHO_RSP_EVENTID - * same event for both commands - */ -struct wmi_echo_cmd { - __le32 value; -} __packed; - -/* - * WMI Events - */ - -/* - * List of Events (target to host) - */ -enum wmi_event_id { - WMI_IMM_RSP_EVENTID = 0x0000, - WMI_READY_EVENTID = 0x1001, - WMI_CONNECT_EVENTID = 0x1002, - WMI_DISCONNECT_EVENTID = 0x1003, - WMI_SCAN_COMPLETE_EVENTID = 0x100a, - WMI_REPORT_STATISTICS_EVENTID = 0x100b, - WMI_RD_MEM_RSP_EVENTID = 0x1800, - WMI_FW_READY_EVENTID = 0x1801, - WMI_EXIT_FAST_MEM_ACC_MODE_EVENTID = 0x0200, - WMI_ECHO_RSP_EVENTID = 0x1803, - WMI_CONFIG_MAC_DONE_EVENTID = 0x1805, - WMI_CONFIG_PHY_DEBUG_DONE_EVENTID = 0x1806, - WMI_ADD_STATION_DONE_EVENTID = 0x1807, - WMI_ADD_DEBUG_TX_PCKT_DONE_EVENTID = 0x1808, - WMI_PHY_GET_STATISTICS_EVENTID = 0x1809, - WMI_FS_TUNE_DONE_EVENTID = 0x180a, - WMI_CORR_MEASURE_DONE_EVENTID = 0x180b, - WMI_TEMP_SENSE_DONE_EVENTID = 0x180e, - WMI_DC_CALIB_DONE_EVENTID = 0x180f, - WMI_IQ_TX_CALIB_DONE_EVENTID = 0x1811, - WMI_IQ_RX_CALIB_DONE_EVENTID = 0x1812, - WMI_SET_WORK_MODE_DONE_EVENTID = 0x1815, - WMI_LO_LEAKAGE_CALIB_DONE_EVENTID = 0x1816, - WMI_MARLON_R_ACTIVATE_DONE_EVENTID = 0x1817, - WMI_MARLON_R_READ_DONE_EVENTID = 0x1818, - WMI_MARLON_R_WRITE_DONE_EVENTID = 0x1819, - WMI_MARLON_R_TXRX_SEL_DONE_EVENTID = 0x181a, - WMI_SILENT_RSSI_CALIB_DONE_EVENTID = 0x181d, - - WMI_CFG_RX_CHAIN_DONE_EVENTID = 0x1820, - WMI_VRING_CFG_DONE_EVENTID = 0x1821, - WMI_RX_ON_DONE_EVENTID = 0x1822, - WMI_BA_STATUS_EVENTID = 0x1823, - WMI_RCP_ADDBA_REQ_EVENTID = 0x1824, - WMI_ADDBA_RESP_SENT_EVENTID = 0x1825, - WMI_DELBA_EVENTID = 0x1826, - WMI_GET_SSID_EVENTID = 0x1828, - WMI_GET_PCP_CHANNEL_EVENTID = 0x182a, - WMI_SW_TX_COMPLETE_EVENTID = 0x182b, - WMI_RX_OFF_DONE_EVENTID = 0x182c, - - WMI_READ_MAC_RXQ_EVENTID = 0x1830, - WMI_READ_MAC_TXQ_EVENTID = 0x1831, - WMI_WRITE_MAC_RXQ_EVENTID = 0x1832, - WMI_WRITE_MAC_TXQ_EVENTID = 0x1833, - WMI_WRITE_MAC_XQ_FIELD_EVENTID = 0x1834, - - WMI_BEAFORMING_MGMT_DONE_EVENTID = 0x1836, - WMI_BF_TXSS_MGMT_DONE_EVENTID = 0x1837, - WMI_BF_RXSS_MGMT_DONE_EVENTID = 0x1839, - WMI_RS_MGMT_DONE_EVENTID = 0x1852, - WMI_RF_MGMT_STATUS_EVENTID = 0x1853, - WMI_BF_SM_MGMT_DONE_EVENTID = 0x1838, - WMI_RX_MGMT_PACKET_EVENTID = 0x1840, - - /* Performance monitoring events */ - WMI_DATA_PORT_OPEN_EVENTID = 0x1860, - WMI_WBE_LINKDOWN_EVENTID = 0x1861, - - WMI_BF_CTRL_DONE_EVENTID = 0x1862, - WMI_NOTIFY_REQ_DONE_EVENTID = 0x1863, - WMI_GET_STATUS_DONE_EVENTID = 0x1864, - - WMI_UNIT_TEST_EVENTID = 0x1900, - WMI_FLASH_READ_DONE_EVENTID = 0x1902, - WMI_FLASH_WRITE_DONE_EVENTID = 0x1903, - - WMI_SET_CHANNEL_EVENTID = 0x9000, - WMI_ASSOC_REQ_EVENTID = 0x9001, - WMI_EAPOL_RX_EVENTID = 0x9002, - WMI_MAC_ADDR_RESP_EVENTID = 0x9003, - WMI_FW_VER_EVENTID = 0x9004, -}; - -/* - * Events data structures - */ - -/* - * WMI_RF_MGMT_STATUS_EVENTID - */ -enum wmi_rf_status { - WMI_RF_ENABLED = 0, - WMI_RF_DISABLED_HW = 1, - WMI_RF_DISABLED_SW = 2, - WMI_RF_DISABLED_HW_SW = 3, -}; - -struct wmi_rf_mgmt_status_event { - __le32 rf_status; -} __packed; - -/* - * WMI_GET_STATUS_DONE_EVENTID - */ -struct wmi_get_status_done_event { - __le32 is_associated; - u8 cid; - u8 reserved0[3]; - u8 bssid[WMI_MAC_LEN]; - u8 channel; - u8 reserved1; - u8 network_type; - u8 reserved2[3]; - __le32 ssid_len; - u8 ssid[WMI_MAX_SSID_LEN]; - __le32 rf_status; - __le32 is_secured; -} __packed; - -/* - * WMI_FW_VER_EVENTID - */ -struct wmi_fw_ver_event { - u8 major; - u8 minor; - __le16 subminor; - __le16 build; -} __packed; - -/* -* WMI_MAC_ADDR_RESP_EVENTID -*/ -struct wmi_mac_addr_resp_event { - u8 mac[WMI_MAC_LEN]; - u8 auth_mode; - u8 crypt_mode; - __le32 offload_mode; -} __packed; - -/* -* WMI_EAPOL_RX_EVENTID -*/ -struct wmi_eapol_rx_event { - u8 src_mac[WMI_MAC_LEN]; - __le16 eapol_len; - u8 eapol[0]; -} __packed; - -/* -* WMI_READY_EVENTID -*/ -enum wmi_phy_capability { - WMI_11A_CAPABILITY = 1, - WMI_11G_CAPABILITY = 2, - WMI_11AG_CAPABILITY = 3, - WMI_11NA_CAPABILITY = 4, - WMI_11NG_CAPABILITY = 5, - WMI_11NAG_CAPABILITY = 6, - WMI_11AD_CAPABILITY = 7, - WMI_11N_CAPABILITY_OFFSET = WMI_11NA_CAPABILITY - WMI_11A_CAPABILITY, -}; - -struct wmi_ready_event { - __le32 sw_version; - __le32 abi_version; - u8 mac[WMI_MAC_LEN]; - u8 phy_capability; /* enum wmi_phy_capability */ - u8 reserved; -} __packed; - -/* - * WMI_NOTIFY_REQ_DONE_EVENTID - */ -struct wmi_notify_req_done_event { - __le32 status; - __le64 tsf; - __le32 snr_val; - __le32 tx_tpt; - __le32 tx_goodput; - __le32 rx_goodput; - __le16 bf_mcs; - __le16 my_rx_sector; - __le16 my_tx_sector; - __le16 other_rx_sector; - __le16 other_tx_sector; - __le16 range; -} __packed; - -/* - * WMI_CONNECT_EVENTID - */ -struct wmi_connect_event { - u8 channel; - u8 reserved0; - u8 bssid[WMI_MAC_LEN]; - __le16 listen_interval; - __le16 beacon_interval; - u8 network_type; - u8 reserved1[3]; - u8 beacon_ie_len; - u8 assoc_req_len; - u8 assoc_resp_len; - u8 cid; - u8 reserved2[3]; - u8 assoc_info[0]; -} __packed; - -/* - * WMI_DISCONNECT_EVENTID - */ -enum wmi_disconnect_reason { - WMI_DIS_REASON_NO_NETWORK_AVAIL = 1, - WMI_DIS_REASON_LOST_LINK = 2, /* bmiss */ - WMI_DIS_REASON_DISCONNECT_CMD = 3, - WMI_DIS_REASON_BSS_DISCONNECTED = 4, - WMI_DIS_REASON_AUTH_FAILED = 5, - WMI_DIS_REASON_ASSOC_FAILED = 6, - WMI_DIS_REASON_NO_RESOURCES_AVAIL = 7, - WMI_DIS_REASON_CSERV_DISCONNECT = 8, - WMI_DIS_REASON_INVALID_PROFILE = 10, - WMI_DIS_REASON_DOT11H_CHANNEL_SWITCH = 11, - WMI_DIS_REASON_PROFILE_MISMATCH = 12, - WMI_DIS_REASON_CONNECTION_EVICTED = 13, - WMI_DIS_REASON_IBSS_MERGE = 14, -}; - -struct wmi_disconnect_event { - __le16 protocol_reason_status; /* reason code, see 802.11 spec. */ - u8 bssid[WMI_MAC_LEN]; /* set if known */ - u8 disconnect_reason; /* see wmi_disconnect_reason_e */ - u8 assoc_resp_len; - u8 assoc_info[0]; -} __packed; - -/* - * WMI_SCAN_COMPLETE_EVENTID - */ -struct wmi_scan_complete_event { - __le32 status; -} __packed; - -/* - * WMI_BA_STATUS_EVENTID - */ -enum wmi_vring_ba_status { - WMI_BA_AGREED = 0, - WMI_BA_NON_AGREED = 1, -}; - -struct wmi_vring_ba_status_event { - __le16 status; - u8 reserved[2]; - u8 ringid; - u8 agg_wsize; - __le16 ba_timeout; -} __packed; - -/* - * WMI_DELBA_EVENTID - */ -struct wmi_delba_event { - - #define CIDXTID_CID_POS (0) - #define CIDXTID_CID_LEN (4) - #define CIDXTID_CID_MSK (0xF) - #define CIDXTID_TID_POS (4) - #define CIDXTID_TID_LEN (4) - #define CIDXTID_TID_MSK (0xF0) - u8 cidxtid; - - u8 from_initiator; - __le16 reason; -} __packed; - -/* - * WMI_VRING_CFG_DONE_EVENTID - */ -enum wmi_vring_cfg_done_event_status { - WMI_VRING_CFG_SUCCESS = 0, - WMI_VRING_CFG_FAILURE = 1, -}; - -struct wmi_vring_cfg_done_event { - u8 ringid; - u8 status; - u8 reserved[2]; - __le32 tx_vring_tail_ptr; -} __packed; - -/* - * WMI_ADDBA_RESP_SENT_EVENTID - */ -enum wmi_rcp_addba_resp_sent_event_status { - WMI_ADDBA_SUCCESS = 0, - WMI_ADDBA_FAIL = 1, -}; - -struct wmi_rcp_addba_resp_sent_event { - - #define CIDXTID_CID_POS (0) - #define CIDXTID_CID_LEN (4) - #define CIDXTID_CID_MSK (0xF) - #define CIDXTID_TID_POS (4) - #define CIDXTID_TID_LEN (4) - #define CIDXTID_TID_MSK (0xF0) - u8 cidxtid; - - u8 reserved; - __le16 status; -} __packed; - -/* - * WMI_RCP_ADDBA_REQ_EVENTID - */ -struct wmi_rcp_addba_req_event { - - #define CIDXTID_CID_POS (0) - #define CIDXTID_CID_LEN (4) - #define CIDXTID_CID_MSK (0xF) - #define CIDXTID_TID_POS (4) - #define CIDXTID_TID_LEN (4) - #define CIDXTID_TID_MSK (0xF0) - u8 cidxtid; - - u8 dialog_token; - __le16 ba_param_set; /* ieee80211_ba_parameterset as it received */ - __le16 ba_timeout; - __le16 ba_seq_ctrl; /* ieee80211_ba_seqstrl field as it received */ -} __packed; - -/* - * WMI_CFG_RX_CHAIN_DONE_EVENTID - */ -enum wmi_cfg_rx_chain_done_event_status { - WMI_CFG_RX_CHAIN_SUCCESS = 1, -}; - -struct wmi_cfg_rx_chain_done_event { - __le32 rx_ring_tail_ptr; /* Rx V-Ring Tail pointer */ - __le32 status; -} __packed; - -/* - * WMI_WBE_LINKDOWN_EVENTID - */ -enum wmi_wbe_link_down_event_reason { - WMI_WBE_REASON_USER_REQUEST = 0, - WMI_WBE_REASON_RX_DISASSOC = 1, - WMI_WBE_REASON_BAD_PHY_LINK = 2, -}; - -struct wmi_wbe_link_down_event { - u8 cid; - u8 reserved[3]; - __le32 reason; -} __packed; - -/* - * WMI_DATA_PORT_OPEN_EVENTID - */ -struct wmi_data_port_open_event { - u8 cid; - u8 reserved[3]; -} __packed; - -/* - * WMI_GET_PCP_CHANNEL_EVENTID - */ -struct wmi_get_pcp_channel_event { - u8 channel; - u8 reserved[3]; -} __packed; - -/* - * WMI_SW_TX_COMPLETE_EVENTID - */ -enum wmi_sw_tx_status { - WMI_TX_SW_STATUS_SUCCESS = 0, - WMI_TX_SW_STATUS_FAILED_NO_RESOURCES = 1, - WMI_TX_SW_STATUS_FAILED_TX = 2, -}; - -struct wmi_sw_tx_complete_event { - u8 status; /* enum wmi_sw_tx_status */ - u8 reserved[3]; -} __packed; - -/* - * WMI_GET_SSID_EVENTID - */ -struct wmi_get_ssid_event { - __le32 ssid_len; - u8 ssid[WMI_MAX_SSID_LEN]; -} __packed; - -/* - * WMI_RX_MGMT_PACKET_EVENTID - */ -struct wmi_rx_mgmt_info { - u8 mcs; - s8 snr; - __le16 range; - __le16 stype; - __le16 status; - __le32 len; - u8 qid; - u8 mid; - u8 cid; - u8 channel; /* From Radio MNGR */ -} __packed; - -struct wmi_rx_mgmt_packet_event { - struct wmi_rx_mgmt_info info; - u8 payload[0]; -} __packed; - -/* - * WMI_ECHO_RSP_EVENTID - */ -struct wmi_echo_event { - __le32 echoed_value; -} __packed; - -#endif /* __WILOCITY_WMI_H__ */ diff --git a/trunk/drivers/net/wireless/b43/b43.h b/trunk/drivers/net/wireless/b43/b43.h index 10e288d470e7..b298e5d68be2 100644 --- a/trunk/drivers/net/wireless/b43/b43.h +++ b/trunk/drivers/net/wireless/b43/b43.h @@ -7,7 +7,6 @@ #include #include #include -#include #include #include "debugfs.h" @@ -723,10 +722,6 @@ enum b43_firmware_file_type { struct b43_request_fw_context { /* The device we are requesting the fw for. */ struct b43_wldev *dev; - /* a completion event structure needed if this call is asynchronous */ - struct completion fw_load_complete; - /* a pointer to the firmware object */ - const struct firmware *blob; /* The type of firmware to request. */ enum b43_firmware_file_type req_type; /* Error messages for each firmware type. */ diff --git a/trunk/drivers/net/wireless/b43/main.c b/trunk/drivers/net/wireless/b43/main.c index 806e34c19281..16ab280359bd 100644 --- a/trunk/drivers/net/wireless/b43/main.c +++ b/trunk/drivers/net/wireless/b43/main.c @@ -2088,18 +2088,11 @@ static void b43_print_fw_helptext(struct b43_wl *wl, bool error) b43warn(wl, text); } -static void b43_fw_cb(const struct firmware *firmware, void *context) -{ - struct b43_request_fw_context *ctx = context; - - ctx->blob = firmware; - complete(&ctx->fw_load_complete); -} - int b43_do_request_fw(struct b43_request_fw_context *ctx, const char *name, - struct b43_firmware_file *fw, bool async) + struct b43_firmware_file *fw) { + const struct firmware *blob; struct b43_fw_header *hdr; u32 size; int err; @@ -2138,31 +2131,11 @@ int b43_do_request_fw(struct b43_request_fw_context *ctx, B43_WARN_ON(1); return -ENOSYS; } - if (async) { - /* do this part asynchronously */ - init_completion(&ctx->fw_load_complete); - err = request_firmware_nowait(THIS_MODULE, 1, ctx->fwname, - ctx->dev->dev->dev, GFP_KERNEL, - ctx, b43_fw_cb); - if (err < 0) { - pr_err("Unable to load firmware\n"); - return err; - } - /* stall here until fw ready */ - wait_for_completion(&ctx->fw_load_complete); - if (ctx->blob) - goto fw_ready; - /* On some ARM systems, the async request will fail, but the next sync - * request works. For this reason, we dall through here - */ - } - err = request_firmware(&ctx->blob, ctx->fwname, - ctx->dev->dev->dev); + err = request_firmware(&blob, ctx->fwname, ctx->dev->dev->dev); if (err == -ENOENT) { snprintf(ctx->errors[ctx->req_type], sizeof(ctx->errors[ctx->req_type]), - "Firmware file \"%s\" not found\n", - ctx->fwname); + "Firmware file \"%s\" not found\n", ctx->fwname); return err; } else if (err) { snprintf(ctx->errors[ctx->req_type], @@ -2171,15 +2144,14 @@ int b43_do_request_fw(struct b43_request_fw_context *ctx, ctx->fwname, err); return err; } -fw_ready: - if (ctx->blob->size < sizeof(struct b43_fw_header)) + if (blob->size < sizeof(struct b43_fw_header)) goto err_format; - hdr = (struct b43_fw_header *)(ctx->blob->data); + hdr = (struct b43_fw_header *)(blob->data); switch (hdr->type) { case B43_FW_TYPE_UCODE: case B43_FW_TYPE_PCM: size = be32_to_cpu(hdr->size); - if (size != ctx->blob->size - sizeof(struct b43_fw_header)) + if (size != blob->size - sizeof(struct b43_fw_header)) goto err_format; /* fallthrough */ case B43_FW_TYPE_IV: @@ -2190,7 +2162,7 @@ int b43_do_request_fw(struct b43_request_fw_context *ctx, goto err_format; } - fw->data = ctx->blob; + fw->data = blob; fw->filename = name; fw->type = ctx->req_type; @@ -2200,7 +2172,7 @@ int b43_do_request_fw(struct b43_request_fw_context *ctx, snprintf(ctx->errors[ctx->req_type], sizeof(ctx->errors[ctx->req_type]), "Firmware file \"%s\" format error.\n", ctx->fwname); - release_firmware(ctx->blob); + release_firmware(blob); return -EPROTO; } @@ -2251,7 +2223,7 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx) goto err_no_ucode; } } - err = b43_do_request_fw(ctx, filename, &fw->ucode, true); + err = b43_do_request_fw(ctx, filename, &fw->ucode); if (err) goto err_load; @@ -2263,7 +2235,7 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx) else goto err_no_pcm; fw->pcm_request_failed = false; - err = b43_do_request_fw(ctx, filename, &fw->pcm, false); + err = b43_do_request_fw(ctx, filename, &fw->pcm); if (err == -ENOENT) { /* We did not find a PCM file? Not fatal, but * core rev <= 10 must do without hwcrypto then. */ @@ -2324,7 +2296,7 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx) default: goto err_no_initvals; } - err = b43_do_request_fw(ctx, filename, &fw->initvals, false); + err = b43_do_request_fw(ctx, filename, &fw->initvals); if (err) goto err_load; @@ -2383,7 +2355,7 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx) default: goto err_no_initvals; } - err = b43_do_request_fw(ctx, filename, &fw->initvals_band, false); + err = b43_do_request_fw(ctx, filename, &fw->initvals_band); if (err) goto err_load; diff --git a/trunk/drivers/net/wireless/b43/main.h b/trunk/drivers/net/wireless/b43/main.h index abac25ee958d..8c684cd33529 100644 --- a/trunk/drivers/net/wireless/b43/main.h +++ b/trunk/drivers/net/wireless/b43/main.h @@ -137,8 +137,9 @@ void b43_mac_phy_clock_set(struct b43_wldev *dev, bool on); struct b43_request_fw_context; -int b43_do_request_fw(struct b43_request_fw_context *ctx, const char *name, - struct b43_firmware_file *fw, bool async); +int b43_do_request_fw(struct b43_request_fw_context *ctx, + const char *name, + struct b43_firmware_file *fw); void b43_do_release_fw(struct b43_firmware_file *fw); #endif /* B43_MAIN_H_ */ diff --git a/trunk/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/trunk/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index 75464ad4fbd1..1261a9b84e04 100644 --- a/trunk/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/trunk/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c @@ -3091,11 +3091,10 @@ brcmf_configure_wpaie(struct net_device *ndev, struct brcmf_vs_tlv *wpa_ie, len = wpa_ie->len + TLV_HDR_LEN; data = (u8 *)wpa_ie; - offset = TLV_HDR_LEN; + offset = 0; if (!is_rsn_ie) offset += VS_IE_FIXED_HDR_LEN; - else - offset += WPA_IE_VERSION_LEN; + offset += WPA_IE_VERSION_LEN; /* check for multicast cipher suite */ if (offset + WPA_IE_MIN_OUI_LEN > len) { diff --git a/trunk/drivers/net/wireless/brcm80211/brcmsmac/debug.h b/trunk/drivers/net/wireless/brcm80211/brcmsmac/debug.h index 822781cf15d4..796836b0f469 100644 --- a/trunk/drivers/net/wireless/brcm80211/brcmsmac/debug.h +++ b/trunk/drivers/net/wireless/brcm80211/brcmsmac/debug.h @@ -1,6 +1,5 @@ /* * Copyright (c) 2012 Broadcom Corporation - * Copyright (c) 2012 Canonical Ltd. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/trunk/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/trunk/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c index 0f71d1d4339d..1fbd8ecbe2ea 100644 --- a/trunk/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c +++ b/trunk/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c @@ -1407,10 +1407,9 @@ void brcms_add_timer(struct brcms_timer *t, uint ms, int periodic) #endif t->ms = ms; t->periodic = (bool) periodic; - if (!t->set) { - t->set = true; - atomic_inc(&t->wl->callbacks); - } + t->set = true; + + atomic_inc(&t->wl->callbacks); ieee80211_queue_delayed_work(hw, &t->dly_wrk, msecs_to_jiffies(ms)); } diff --git a/trunk/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c b/trunk/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c index 21a824232478..606b534347bc 100644 --- a/trunk/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c +++ b/trunk/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, wlc_lcnphy_rx_gain_override_enable(pi, true); wlc_lcnphy_start_tx_tone(pi, 2000, (40 >> 1), 0); - udelay(500); + usleep_range(500, 500); write_radio_reg(pi, RADIO_2064_REG112, 0); if (!wlc_lcnphy_rx_iq_est(pi, 1024, 32, &iq_est_l)) return false; wlc_lcnphy_start_tx_tone(pi, 2000, 40, 0); - udelay(500); + usleep_range(500, 500); write_radio_reg(pi, RADIO_2064_REG112, 0); if (!wlc_lcnphy_rx_iq_est(pi, 1024, 32, &iq_est_h)) return false; diff --git a/trunk/drivers/net/wireless/iwlegacy/3945-mac.c b/trunk/drivers/net/wireless/iwlegacy/3945-mac.c index 3726cd6fcd75..d604b4036a76 100644 --- a/trunk/drivers/net/wireless/iwlegacy/3945-mac.c +++ b/trunk/drivers/net/wireless/iwlegacy/3945-mac.c @@ -3273,7 +3273,7 @@ il3945_store_measurement(struct device *d, struct device_attribute *attr, if (count) { char *p = buffer; - strlcpy(buffer, buf, sizeof(buffer)); + strncpy(buffer, buf, min(sizeof(buffer), count)); channel = simple_strtoul(p, NULL, 0); if (channel) params.channel = channel; diff --git a/trunk/drivers/net/wireless/iwlegacy/common.c b/trunk/drivers/net/wireless/iwlegacy/common.c index 90b8970eadf0..7e16d10a7f14 100644 --- a/trunk/drivers/net/wireless/iwlegacy/common.c +++ b/trunk/drivers/net/wireless/iwlegacy/common.c @@ -3958,21 +3958,17 @@ il_connection_init_rx_config(struct il_priv *il) memset(&il->staging, 0, sizeof(il->staging)); - switch (il->iw_mode) { - case NL80211_IFTYPE_UNSPECIFIED: + if (!il->vif) { il->staging.dev_type = RXON_DEV_TYPE_ESS; - break; - case NL80211_IFTYPE_STATION: + } else if (il->vif->type == NL80211_IFTYPE_STATION) { il->staging.dev_type = RXON_DEV_TYPE_ESS; il->staging.filter_flags = RXON_FILTER_ACCEPT_GRP_MSK; - break; - case NL80211_IFTYPE_ADHOC: + } else if (il->vif->type == NL80211_IFTYPE_ADHOC) { il->staging.dev_type = RXON_DEV_TYPE_IBSS; il->staging.flags = RXON_FLG_SHORT_PREAMBLE_MSK; il->staging.filter_flags = RXON_FILTER_BCON_AWARE_MSK | RXON_FILTER_ACCEPT_GRP_MSK; - break; - default: + } else { IL_ERR("Unsupported interface type %d\n", il->vif->type); return; } @@ -4554,7 +4550,8 @@ il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) EXPORT_SYMBOL(il_mac_add_interface); static void -il_teardown_interface(struct il_priv *il, struct ieee80211_vif *vif) +il_teardown_interface(struct il_priv *il, struct ieee80211_vif *vif, + bool mode_change) { lockdep_assert_held(&il->mutex); @@ -4563,7 +4560,9 @@ il_teardown_interface(struct il_priv *il, struct ieee80211_vif *vif) il_force_scan_end(il); } - il_set_mode(il); + if (!mode_change) + il_set_mode(il); + } void @@ -4576,8 +4575,8 @@ il_mac_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) WARN_ON(il->vif != vif); il->vif = NULL; - il->iw_mode = NL80211_IFTYPE_UNSPECIFIED; - il_teardown_interface(il, vif); + + il_teardown_interface(il, vif, false); memset(il->bssid, 0, ETH_ALEN); D_MAC80211("leave\n"); @@ -4686,10 +4685,18 @@ il_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif, } /* success */ + il_teardown_interface(il, vif, true); vif->type = newtype; vif->p2p = false; - il->iw_mode = newtype; - il_teardown_interface(il, vif); + err = il_set_mode(il); + WARN_ON(err); + /* + * We've switched internally, but submitting to the + * device may have failed for some reason. Mask this + * error, because otherwise mac80211 will not switch + * (and set the interface type back) and we'll be + * out of sync with it. + */ err = 0; out: diff --git a/trunk/drivers/net/wireless/iwlwifi/dvm/tx.c b/trunk/drivers/net/wireless/iwlwifi/dvm/tx.c index 31534f7c0548..da21328ca8ed 100644 --- a/trunk/drivers/net/wireless/iwlwifi/dvm/tx.c +++ b/trunk/drivers/net/wireless/iwlwifi/dvm/tx.c @@ -1079,8 +1079,6 @@ static void iwlagn_set_tx_status(struct iwl_priv *priv, { u16 status = le16_to_cpu(tx_resp->status.status); - info->flags &= ~IEEE80211_TX_CTL_AMPDU; - info->status.rates[0].count = tx_resp->failure_frame + 1; info->flags |= iwl_tx_status_to_mac80211(status); iwlagn_hwrate_to_tx_control(priv, le32_to_cpu(tx_resp->rate_n_flags), @@ -1153,6 +1151,13 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb, next_reclaimed = ssn; } + if (tid != IWL_TID_NON_QOS) { + priv->tid_data[sta_id][tid].next_reclaimed = + next_reclaimed; + IWL_DEBUG_TX_REPLY(priv, "Next reclaimed packet:%d\n", + next_reclaimed); + } + iwl_trans_reclaim(priv->trans, txq_id, ssn, &skbs); iwlagn_check_ratid_empty(priv, sta_id, tid); @@ -1203,28 +1208,11 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb, if (!is_agg) iwlagn_non_agg_tx_status(priv, ctx, hdr->addr1); - /* - * W/A for FW bug - the seq_ctl isn't updated when the - * queues are flushed. Fetch it from the packet itself - */ - if (!is_agg && status == TX_STATUS_FAIL_FIFO_FLUSHED) { - next_reclaimed = le16_to_cpu(hdr->seq_ctrl); - next_reclaimed = - SEQ_TO_SN(next_reclaimed + 0x10); - } - is_offchannel_skb = (info->flags & IEEE80211_TX_CTL_TX_OFFCHAN); freed++; } - if (tid != IWL_TID_NON_QOS) { - priv->tid_data[sta_id][tid].next_reclaimed = - next_reclaimed; - IWL_DEBUG_TX_REPLY(priv, "Next reclaimed packet:%d\n", - next_reclaimed); - } - WARN_ON(!is_agg && freed != 1); /* diff --git a/trunk/drivers/net/wireless/iwlwifi/pcie/rx.c b/trunk/drivers/net/wireless/iwlwifi/pcie/rx.c index 8389cd38338b..dad4c4aad91f 100644 --- a/trunk/drivers/net/wireless/iwlwifi/pcie/rx.c +++ b/trunk/drivers/net/wireless/iwlwifi/pcie/rx.c @@ -1166,7 +1166,6 @@ static irqreturn_t iwl_pcie_isr(int irq, void *data) else if (test_bit(STATUS_INT_ENABLED, &trans_pcie->status) && !trans_pcie->inta) iwl_enable_interrupts(trans); - return IRQ_HANDLED; none: /* re-enable interrupts here since we don't have anything to service. */ diff --git a/trunk/drivers/net/wireless/mwifiex/cfg80211.c b/trunk/drivers/net/wireless/mwifiex/cfg80211.c index cdb11b3964e2..a875499f8945 100644 --- a/trunk/drivers/net/wireless/mwifiex/cfg80211.c +++ b/trunk/drivers/net/wireless/mwifiex/cfg80211.c @@ -1459,7 +1459,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid, struct cfg80211_ssid req_ssid; int ret, auth_type = 0; struct cfg80211_bss *bss = NULL; - u8 is_scanning_required = 0; + u8 is_scanning_required = 0, config_bands = 0; memset(&req_ssid, 0, sizeof(struct cfg80211_ssid)); @@ -1478,6 +1478,19 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid, /* disconnect before try to associate */ mwifiex_deauthenticate(priv, NULL); + if (channel) { + if (mode == NL80211_IFTYPE_STATION) { + if (channel->band == IEEE80211_BAND_2GHZ) + config_bands = BAND_B | BAND_G | BAND_GN; + else + config_bands = BAND_A | BAND_AN; + + if (!((config_bands | priv->adapter->fw_bands) & + ~priv->adapter->fw_bands)) + priv->adapter->config_bands = config_bands; + } + } + /* As this is new association, clear locally stored * keys and security related flags */ priv->sec_info.wpa_enabled = false; @@ -1694,9 +1707,9 @@ static int mwifiex_set_ibss_params(struct mwifiex_private *priv, if (cfg80211_get_chandef_type(¶ms->chandef) != NL80211_CHAN_NO_HT) - config_bands |= BAND_G | BAND_GN; + config_bands |= BAND_GN; } else { - if (cfg80211_get_chandef_type(¶ms->chandef) == + if (cfg80211_get_chandef_type(¶ms->chandef) != NL80211_CHAN_NO_HT) config_bands = BAND_A; else diff --git a/trunk/drivers/net/wireless/mwifiex/pcie.c b/trunk/drivers/net/wireless/mwifiex/pcie.c index b879e1338a54..13fbc4eb1595 100644 --- a/trunk/drivers/net/wireless/mwifiex/pcie.c +++ b/trunk/drivers/net/wireless/mwifiex/pcie.c @@ -161,7 +161,7 @@ static int mwifiex_pcie_suspend(struct pci_dev *pdev, pm_message_t state) if (pdev) { card = (struct pcie_service_card *) pci_get_drvdata(pdev); - if (!card || !card->adapter) { + if (!card || card->adapter) { pr_err("Card or adapter structure is not valid\n"); return 0; } diff --git a/trunk/drivers/net/wireless/mwifiex/sta_ioctl.c b/trunk/drivers/net/wireless/mwifiex/sta_ioctl.c index f542bb8ccbc8..cb682561c438 100644 --- a/trunk/drivers/net/wireless/mwifiex/sta_ioctl.c +++ b/trunk/drivers/net/wireless/mwifiex/sta_ioctl.c @@ -56,6 +56,7 @@ int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list *mlist, */ int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter) { + bool cancel_flag = false; int status; struct cmd_ctrl_node *cmd_queued; @@ -69,11 +70,14 @@ int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter) atomic_inc(&adapter->cmd_pending); /* Wait for completion */ - status = wait_event_interruptible(adapter->cmd_wait_q.wait, - *(cmd_queued->condition)); - if (status) { - dev_err(adapter->dev, "cmd_wait_q terminated: %d\n", status); - return status; + wait_event_interruptible(adapter->cmd_wait_q.wait, + *(cmd_queued->condition)); + if (!*(cmd_queued->condition)) + cancel_flag = true; + + if (cancel_flag) { + mwifiex_cancel_pending_ioctl(adapter); + dev_dbg(adapter->dev, "cmd cancel\n"); } status = adapter->cmd_wait_q.status; @@ -283,20 +287,6 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, if (ret) goto done; - if (bss_desc) { - u8 config_bands = 0; - - if (mwifiex_band_to_radio_type((u8) bss_desc->bss_band) - == HostCmd_SCAN_RADIO_TYPE_BG) - config_bands = BAND_B | BAND_G | BAND_GN; - else - config_bands = BAND_A | BAND_AN; - - if (!((config_bands | adapter->fw_bands) & - ~adapter->fw_bands)) - adapter->config_bands = config_bands; - } - ret = mwifiex_check_network_compatibility(priv, bss_desc); if (ret) goto done; @@ -506,11 +496,8 @@ int mwifiex_enable_hs(struct mwifiex_adapter *adapter) return false; } - if (wait_event_interruptible(adapter->hs_activate_wait_q, - adapter->hs_activate_wait_q_woken)) { - dev_err(adapter->dev, "hs_activate_wait_q terminated\n"); - return false; - } + wait_event_interruptible(adapter->hs_activate_wait_q, + adapter->hs_activate_wait_q_woken); return true; } diff --git a/trunk/drivers/net/wireless/mwl8k.c b/trunk/drivers/net/wireless/mwl8k.c index 83564d36e801..f221b95b90b3 100644 --- a/trunk/drivers/net/wireless/mwl8k.c +++ b/trunk/drivers/net/wireless/mwl8k.c @@ -4250,11 +4250,9 @@ static int mwl8k_cmd_update_stadb_add(struct ieee80211_hw *hw, p->amsdu_enabled = 0; rc = mwl8k_post_cmd(hw, &cmd->header); - if (!rc) - rc = p->station_id; kfree(cmd); - return rc; + return rc ? rc : p->station_id; } static int mwl8k_cmd_update_stadb_del(struct ieee80211_hw *hw, diff --git a/trunk/drivers/net/wireless/p54/p54usb.c b/trunk/drivers/net/wireless/p54/p54usb.c index 800a16526c8e..e71c702e2eb1 100644 --- a/trunk/drivers/net/wireless/p54/p54usb.c +++ b/trunk/drivers/net/wireless/p54/p54usb.c @@ -47,7 +47,6 @@ static struct usb_device_id p54u_table[] = { {USB_DEVICE(0x0411, 0x0050)}, /* Buffalo WLI2-USB2-G54 */ {USB_DEVICE(0x045e, 0x00c2)}, /* Microsoft MN-710 */ {USB_DEVICE(0x0506, 0x0a11)}, /* 3COM 3CRWE254G72 */ - {USB_DEVICE(0x0675, 0x0530)}, /* DrayTek Vigor 530 */ {USB_DEVICE(0x06b9, 0x0120)}, /* Thomson SpeedTouch 120g */ {USB_DEVICE(0x0707, 0xee06)}, /* SMC 2862W-G */ {USB_DEVICE(0x07aa, 0x001c)}, /* Corega CG-WLUSB2GT */ @@ -83,8 +82,6 @@ static struct usb_device_id p54u_table[] = { {USB_DEVICE(0x06a9, 0x000e)}, /* Westell 802.11g USB (A90-211WG-01) */ {USB_DEVICE(0x06b9, 0x0121)}, /* Thomson SpeedTouch 121g */ {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */ - {USB_DEVICE(0x0803, 0x4310)}, /* Zoom 4410a */ - {USB_DEVICE(0x083a, 0x4503)}, /* T-Com Sinus 154 data II */ {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */ {USB_DEVICE(0x083a, 0xc501)}, /* Zoom Wireless-G 4410 */ {USB_DEVICE(0x083a, 0xf503)}, /* Accton FD7050E ver 1010ec */ @@ -104,7 +101,6 @@ static struct usb_device_id p54u_table[] = { {USB_DEVICE(0x13B1, 0x000C)}, /* Linksys WUSB54AG */ {USB_DEVICE(0x1413, 0x5400)}, /* Telsey 802.11g USB2.0 Adapter */ {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */ - /* {USB_DEVICE(0x15a9, 0x0002)}, * Also SparkLAN WL-682 with 3887 */ {USB_DEVICE(0x1668, 0x1050)}, /* Actiontec 802UIG-1 */ {USB_DEVICE(0x1740, 0x1000)}, /* Senao NUB-350 */ {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */ diff --git a/trunk/drivers/net/wireless/rtlwifi/Kconfig b/trunk/drivers/net/wireless/rtlwifi/Kconfig index b80bc4612581..21b1bbb93a7e 100644 --- a/trunk/drivers/net/wireless/rtlwifi/Kconfig +++ b/trunk/drivers/net/wireless/rtlwifi/Kconfig @@ -57,12 +57,12 @@ config RTL8192CU config RTLWIFI tristate - depends on RTL8192CE || RTL8192CU || RTL8192SE || RTL8192DE || RTL8723AE + depends on RTL8192CE || RTL8192CU || RTL8192SE || RTL8192DE default m config RTLWIFI_DEBUG bool "Additional debugging output" - depends on RTL8192CE || RTL8192CU || RTL8192SE || RTL8192DE || RTL8723AE + depends on RTL8192CE || RTL8192CU || RTL8192SE || RTL8192DE default y config RTL8192C_COMMON diff --git a/trunk/drivers/net/wireless/rtlwifi/pci.c b/trunk/drivers/net/wireless/rtlwifi/pci.c index 4261e8ecc4c3..3deacafdcd5e 100644 --- a/trunk/drivers/net/wireless/rtlwifi/pci.c +++ b/trunk/drivers/net/wireless/rtlwifi/pci.c @@ -743,8 +743,6 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) done: bufferaddress = (*((dma_addr_t *)skb->cb)); - if (pci_dma_mapping_error(rtlpci->pdev, bufferaddress)) - return; tmp_one = 1; rtlpriv->cfg->ops->set_desc((u8 *) pdesc, false, HW_DESC_RXBUFF_ADDR, @@ -1117,10 +1115,6 @@ static int _rtl_pci_init_rx_ring(struct ieee80211_hw *hw) PCI_DMA_FROMDEVICE); bufferaddress = (*((dma_addr_t *)skb->cb)); - if (pci_dma_mapping_error(rtlpci->pdev, bufferaddress)) { - dev_kfree_skb_any(skb); - return 1; - } rtlpriv->cfg->ops->set_desc((u8 *)entry, false, HW_DESC_RXBUFF_ADDR, (u8 *)&bufferaddress); diff --git a/trunk/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c b/trunk/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c index 246e5352f2e1..1d5d3604e3e0 100644 --- a/trunk/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c +++ b/trunk/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c @@ -692,7 +692,7 @@ u8 rtl92c_phy_sw_chnl(struct ieee80211_hw *hw) if (!(is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) { rtl92c_phy_sw_chnl_callback(hw); RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, - "sw_chnl_inprogress false schedule workitem\n"); + "sw_chnl_inprogress false schdule workitem\n"); rtlphy->sw_chnl_inprogress = false; } else { RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, diff --git a/trunk/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c b/trunk/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c index c31795e379f7..173424756149 100644 --- a/trunk/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c +++ b/trunk/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c @@ -611,14 +611,8 @@ void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw, dma_addr_t mapping = pci_map_single(rtlpci->pdev, skb->data, skb->len, PCI_DMA_TODEVICE); - u8 bw_40 = 0; - if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, - "DMA mapping error"); - return; - } rcu_read_lock(); sta = get_sta(hw, mac->vif, mac->bssid); if (mac->opmode == NL80211_IFTYPE_STATION) { @@ -780,11 +774,6 @@ void rtl92ce_tx_fill_cmddesc(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data); __le16 fc = hdr->frame_control; - if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, - "DMA mapping error"); - return; - } CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); if (firstseg) diff --git a/trunk/drivers/net/wireless/rtlwifi/rtl8192de/trx.c b/trunk/drivers/net/wireless/rtlwifi/rtl8192de/trx.c index a0fbf284420e..f9f3861046c1 100644 --- a/trunk/drivers/net/wireless/rtlwifi/rtl8192de/trx.c +++ b/trunk/drivers/net/wireless/rtlwifi/rtl8192de/trx.c @@ -587,11 +587,6 @@ void rtl92de_tx_fill_desc(struct ieee80211_hw *hw, buf_len = skb->len; mapping = pci_map_single(rtlpci->pdev, skb->data, skb->len, PCI_DMA_TODEVICE); - if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, - "DMA mapping error"); - return; - } CLEAR_PCI_TX_DESC_CONTENT(pdesc, sizeof(struct tx_desc_92d)); if (ieee80211_is_nullfunc(fc) || ieee80211_is_ctl(fc)) { firstseg = true; @@ -745,11 +740,6 @@ void rtl92de_tx_fill_cmddesc(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)(skb->data); __le16 fc = hdr->frame_control; - if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, - "DMA mapping error"); - return; - } CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); if (firstseg) SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN); diff --git a/trunk/drivers/net/wireless/rtlwifi/rtl8192se/trx.c b/trunk/drivers/net/wireless/rtlwifi/rtl8192se/trx.c index 206561d7282f..0e9f6ebf078a 100644 --- a/trunk/drivers/net/wireless/rtlwifi/rtl8192se/trx.c +++ b/trunk/drivers/net/wireless/rtlwifi/rtl8192se/trx.c @@ -611,11 +611,6 @@ void rtl92se_tx_fill_desc(struct ieee80211_hw *hw, PCI_DMA_TODEVICE); u8 bw_40 = 0; - if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, - "DMA mapping error"); - return; - } if (mac->opmode == NL80211_IFTYPE_STATION) { bw_40 = mac->bw_40; } else if (mac->opmode == NL80211_IFTYPE_AP || @@ -768,7 +763,6 @@ void rtl92se_tx_fill_desc(struct ieee80211_hw *hw, void rtl92se_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc, bool firstseg, bool lastseg, struct sk_buff *skb) { - struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); struct rtl_tcb_desc *tcb_desc = (struct rtl_tcb_desc *)(skb->cb); @@ -776,12 +770,7 @@ void rtl92se_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc, dma_addr_t mapping = pci_map_single(rtlpci->pdev, skb->data, skb->len, PCI_DMA_TODEVICE); - if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, - "DMA mapping error"); - return; - } - /* Clear all status */ + /* Clear all status */ CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_CMDDESC_SIZE_RTL8192S); /* This bit indicate this packet is used for FW download. */ diff --git a/trunk/drivers/net/wireless/rtlwifi/rtl8723ae/phy.c b/trunk/drivers/net/wireless/rtlwifi/rtl8723ae/phy.c index 3d8536bb0d2b..39cc7938eedf 100644 --- a/trunk/drivers/net/wireless/rtlwifi/rtl8723ae/phy.c +++ b/trunk/drivers/net/wireless/rtlwifi/rtl8723ae/phy.c @@ -1106,7 +1106,7 @@ u8 rtl8723ae_phy_sw_chnl(struct ieee80211_hw *hw) if (!(is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) { rtl8723ae_phy_sw_chnl_callback(hw); RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, - "sw_chnl_inprogress false schedule workitem\n"); + "sw_chnl_inprogress false schdule workitem\n"); rtlphy->sw_chnl_inprogress = false; } else { RT_TRACE(rtlpriv, COMP_CHAN, DBG_LOUD, diff --git a/trunk/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c b/trunk/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c index a313be8c21d2..87331d826d73 100644 --- a/trunk/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c +++ b/trunk/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c @@ -387,11 +387,6 @@ void rtl8723ae_tx_fill_desc(struct ieee80211_hw *hw, PCI_DMA_TODEVICE); u8 bw_40 = 0; - if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, - "DMA mapping error"); - return; - } if (mac->opmode == NL80211_IFTYPE_STATION) { bw_40 = mac->bw_40; } else if (mac->opmode == NL80211_IFTYPE_AP || @@ -547,11 +542,6 @@ void rtl8723ae_tx_fill_cmddesc(struct ieee80211_hw *hw, PCI_DMA_TODEVICE); __le16 fc = hdr->frame_control; - if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { - RT_TRACE(rtlpriv, COMP_SEND, DBG_TRACE, - "DMA mapping error"); - return; - } CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); if (firstseg) diff --git a/trunk/drivers/net/wireless/rtlwifi/usb.c b/trunk/drivers/net/wireless/rtlwifi/usb.c index f2ecdeb3a90d..29f0969e4ba0 100644 --- a/trunk/drivers/net/wireless/rtlwifi/usb.c +++ b/trunk/drivers/net/wireless/rtlwifi/usb.c @@ -210,16 +210,17 @@ static void _usb_writeN_sync(struct rtl_priv *rtlpriv, u32 addr, void *data, u16 index = REALTEK_USB_VENQT_CMD_IDX; int pipe = usb_sndctrlpipe(udev, 0); /* write_out */ u8 *buffer; + dma_addr_t dma_addr; - wvalue = (u16)(addr & 0x0000ffff); - buffer = kmalloc(len, GFP_ATOMIC); + wvalue = (u16)(addr&0x0000ffff); + buffer = usb_alloc_coherent(udev, (size_t)len, GFP_ATOMIC, &dma_addr); if (!buffer) return; memcpy(buffer, data, len); usb_control_msg(udev, pipe, request, reqtype, wvalue, index, buffer, len, 50); - kfree(buffer); + usb_free_coherent(udev, (size_t)len, buffer, dma_addr); } static void _rtl_usb_io_handler_init(struct device *dev, @@ -639,7 +640,6 @@ static int _rtl_usb_receive(struct ieee80211_hw *hw) RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG, "Failed to prep_rx_urb!!\n"); err = PTR_ERR(skb); - usb_free_urb(urb); goto err_out; } diff --git a/trunk/drivers/net/xen-netfront.c b/trunk/drivers/net/xen-netfront.c index 7ffa43bd7cf9..c26e28b4bd9f 100644 --- a/trunk/drivers/net/xen-netfront.c +++ b/trunk/drivers/net/xen-netfront.c @@ -1015,10 +1015,29 @@ static int xennet_poll(struct napi_struct *napi, int budget) i = xennet_fill_frags(np, skb, &tmpq); /* - * Truesize is the actual allocation size, even if the - * allocation is only partially used. - */ - skb->truesize += PAGE_SIZE * skb_shinfo(skb)->nr_frags; + * Truesize approximates the size of true data plus + * any supervisor overheads. Adding hypervisor + * overheads has been shown to significantly reduce + * achievable bandwidth with the default receive + * buffer size. It is therefore not wise to account + * for it here. + * + * After alloc_skb(RX_COPY_THRESHOLD), truesize is set + * to RX_COPY_THRESHOLD + the supervisor + * overheads. Here, we add the size of the data pulled + * in xennet_fill_frags(). + * + * We also adjust for any unused space in the main + * data area by subtracting (RX_COPY_THRESHOLD - + * len). This is especially important with drivers + * which split incoming packets into header and data, + * using only 66 bytes of the main data area (see the + * e1000 driver for example.) On such systems, + * without this last adjustement, our achievable + * receive throughout using the standard receive + * buffer size was cut by 25%(!!!). + */ + skb->truesize += skb->data_len - RX_COPY_THRESHOLD; skb->len += skb->data_len; if (rx->flags & XEN_NETRXF_csum_blank) diff --git a/trunk/drivers/pci/hotplug/pciehp.h b/trunk/drivers/pci/hotplug/pciehp.h index 2c113de94323..26ffd3e3fb74 100644 --- a/trunk/drivers/pci/hotplug/pciehp.h +++ b/trunk/drivers/pci/hotplug/pciehp.h @@ -44,6 +44,7 @@ extern bool pciehp_poll_mode; extern int pciehp_poll_time; extern bool pciehp_debug; extern bool pciehp_force; +extern struct workqueue_struct *pciehp_wq; #define dbg(format, arg...) \ do { \ @@ -77,7 +78,6 @@ struct slot { struct hotplug_slot *hotplug_slot; struct delayed_work work; /* work for button event */ struct mutex lock; - struct workqueue_struct *wq; }; struct event_info { diff --git a/trunk/drivers/pci/hotplug/pciehp_core.c b/trunk/drivers/pci/hotplug/pciehp_core.c index 939bd1d4b5b1..916bf4f53aba 100644 --- a/trunk/drivers/pci/hotplug/pciehp_core.c +++ b/trunk/drivers/pci/hotplug/pciehp_core.c @@ -42,6 +42,7 @@ bool pciehp_debug; bool pciehp_poll_mode; int pciehp_poll_time; bool pciehp_force; +struct workqueue_struct *pciehp_wq; #define DRIVER_VERSION "0.4" #define DRIVER_AUTHOR "Dan Zink , Greg Kroah-Hartman , Dely Sy " @@ -339,13 +340,18 @@ static int __init pcied_init(void) { int retval = 0; + pciehp_wq = alloc_workqueue("pciehp", 0, 0); + if (!pciehp_wq) + return -ENOMEM; + pciehp_firmware_init(); retval = pcie_port_service_register(&hpdriver_portdrv); dbg("pcie_port_service_register = %d\n", retval); info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); - if (retval) + if (retval) { + destroy_workqueue(pciehp_wq); dbg("Failure to register service\n"); - + } return retval; } @@ -353,6 +359,7 @@ static void __exit pcied_cleanup(void) { dbg("unload_pciehpd()\n"); pcie_port_service_unregister(&hpdriver_portdrv); + destroy_workqueue(pciehp_wq); info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n"); } diff --git a/trunk/drivers/pci/hotplug/pciehp_ctrl.c b/trunk/drivers/pci/hotplug/pciehp_ctrl.c index 38f018679175..27f44295a657 100644 --- a/trunk/drivers/pci/hotplug/pciehp_ctrl.c +++ b/trunk/drivers/pci/hotplug/pciehp_ctrl.c @@ -49,7 +49,7 @@ static int queue_interrupt_event(struct slot *p_slot, u32 event_type) info->p_slot = p_slot; INIT_WORK(&info->work, interrupt_event_handler); - queue_work(p_slot->wq, &info->work); + queue_work(pciehp_wq, &info->work); return 0; } @@ -344,7 +344,7 @@ void pciehp_queue_pushbutton_work(struct work_struct *work) kfree(info); goto out; } - queue_work(p_slot->wq, &info->work); + queue_work(pciehp_wq, &info->work); out: mutex_unlock(&p_slot->lock); } @@ -377,7 +377,7 @@ static void handle_button_press_event(struct slot *p_slot) if (ATTN_LED(ctrl)) pciehp_set_attention_status(p_slot, 0); - queue_delayed_work(p_slot->wq, &p_slot->work, 5*HZ); + queue_delayed_work(pciehp_wq, &p_slot->work, 5*HZ); break; case BLINKINGOFF_STATE: case BLINKINGON_STATE: @@ -439,7 +439,7 @@ static void handle_surprise_event(struct slot *p_slot) else p_slot->state = POWERON_STATE; - queue_work(p_slot->wq, &info->work); + queue_work(pciehp_wq, &info->work); } static void interrupt_event_handler(struct work_struct *work) diff --git a/trunk/drivers/pci/hotplug/pciehp_hpc.c b/trunk/drivers/pci/hotplug/pciehp_hpc.c index 5127f3f41821..13b2eaf7ba43 100644 --- a/trunk/drivers/pci/hotplug/pciehp_hpc.c +++ b/trunk/drivers/pci/hotplug/pciehp_hpc.c @@ -773,32 +773,23 @@ static void pcie_shutdown_notification(struct controller *ctrl) static int pcie_init_slot(struct controller *ctrl) { struct slot *slot; - char name[32]; slot = kzalloc(sizeof(*slot), GFP_KERNEL); if (!slot) return -ENOMEM; - snprintf(name, sizeof(name), "pciehp-%u", PSN(ctrl)); - slot->wq = alloc_workqueue(name, 0, 0); - if (!slot->wq) - goto abort; - slot->ctrl = ctrl; mutex_init(&slot->lock); INIT_DELAYED_WORK(&slot->work, pciehp_queue_pushbutton_work); ctrl->slot = slot; return 0; -abort: - kfree(slot); - return -ENOMEM; } static void pcie_cleanup_slot(struct controller *ctrl) { struct slot *slot = ctrl->slot; cancel_delayed_work(&slot->work); - destroy_workqueue(slot->wq); + flush_workqueue(pciehp_wq); kfree(slot); } diff --git a/trunk/drivers/pci/hotplug/shpchp.h b/trunk/drivers/pci/hotplug/shpchp.h index b849f995075a..ca64932e658b 100644 --- a/trunk/drivers/pci/hotplug/shpchp.h +++ b/trunk/drivers/pci/hotplug/shpchp.h @@ -46,6 +46,8 @@ extern bool shpchp_poll_mode; extern int shpchp_poll_time; extern bool shpchp_debug; +extern struct workqueue_struct *shpchp_wq; +extern struct workqueue_struct *shpchp_ordered_wq; #define dbg(format, arg...) \ do { \ @@ -89,7 +91,6 @@ struct slot { struct list_head slot_list; struct delayed_work work; /* work for button event */ struct mutex lock; - struct workqueue_struct *wq; u8 hp_slot; }; diff --git a/trunk/drivers/pci/hotplug/shpchp_core.c b/trunk/drivers/pci/hotplug/shpchp_core.c index 3100c52c837c..b6de307248e4 100644 --- a/trunk/drivers/pci/hotplug/shpchp_core.c +++ b/trunk/drivers/pci/hotplug/shpchp_core.c @@ -39,6 +39,8 @@ bool shpchp_debug; bool shpchp_poll_mode; int shpchp_poll_time; +struct workqueue_struct *shpchp_wq; +struct workqueue_struct *shpchp_ordered_wq; #define DRIVER_VERSION "0.4" #define DRIVER_AUTHOR "Dan Zink , Greg Kroah-Hartman , Dely Sy " @@ -127,14 +129,6 @@ static int init_slots(struct controller *ctrl) slot->device = ctrl->slot_device_offset + i; slot->hpc_ops = ctrl->hpc_ops; slot->number = ctrl->first_slot + (ctrl->slot_num_inc * i); - - snprintf(name, sizeof(name), "shpchp-%d", slot->number); - slot->wq = alloc_workqueue(name, 0, 0); - if (!slot->wq) { - retval = -ENOMEM; - goto error_info; - } - mutex_init(&slot->lock); INIT_DELAYED_WORK(&slot->work, shpchp_queue_pushbutton_work); @@ -154,7 +148,7 @@ static int init_slots(struct controller *ctrl) if (retval) { ctrl_err(ctrl, "pci_hp_register failed with error %d\n", retval); - goto error_slotwq; + goto error_info; } get_power_status(hotplug_slot, &info->power_status); @@ -166,8 +160,6 @@ static int init_slots(struct controller *ctrl) } return 0; -error_slotwq: - destroy_workqueue(slot->wq); error_info: kfree(info); error_hpslot: @@ -188,7 +180,8 @@ void cleanup_slots(struct controller *ctrl) slot = list_entry(tmp, struct slot, slot_list); list_del(&slot->slot_list); cancel_delayed_work(&slot->work); - destroy_workqueue(slot->wq); + flush_workqueue(shpchp_wq); + flush_workqueue(shpchp_ordered_wq); pci_hp_deregister(slot->hotplug_slot); } } @@ -371,12 +364,25 @@ static struct pci_driver shpc_driver = { static int __init shpcd_init(void) { - int retval; + int retval = 0; + + shpchp_wq = alloc_ordered_workqueue("shpchp", 0); + if (!shpchp_wq) + return -ENOMEM; + + shpchp_ordered_wq = alloc_ordered_workqueue("shpchp_ordered", 0); + if (!shpchp_ordered_wq) { + destroy_workqueue(shpchp_wq); + return -ENOMEM; + } retval = pci_register_driver(&shpc_driver); dbg("%s: pci_register_driver = %d\n", __func__, retval); info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); - + if (retval) { + destroy_workqueue(shpchp_ordered_wq); + destroy_workqueue(shpchp_wq); + } return retval; } @@ -384,6 +390,8 @@ static void __exit shpcd_cleanup(void) { dbg("unload_shpchpd()\n"); pci_unregister_driver(&shpc_driver); + destroy_workqueue(shpchp_ordered_wq); + destroy_workqueue(shpchp_wq); info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n"); } diff --git a/trunk/drivers/pci/hotplug/shpchp_ctrl.c b/trunk/drivers/pci/hotplug/shpchp_ctrl.c index 58499277903a..f9b5a52e4115 100644 --- a/trunk/drivers/pci/hotplug/shpchp_ctrl.c +++ b/trunk/drivers/pci/hotplug/shpchp_ctrl.c @@ -51,7 +51,7 @@ static int queue_interrupt_event(struct slot *p_slot, u32 event_type) info->p_slot = p_slot; INIT_WORK(&info->work, interrupt_event_handler); - queue_work(p_slot->wq, &info->work); + queue_work(shpchp_wq, &info->work); return 0; } @@ -453,7 +453,7 @@ void shpchp_queue_pushbutton_work(struct work_struct *work) kfree(info); goto out; } - queue_work(p_slot->wq, &info->work); + queue_work(shpchp_ordered_wq, &info->work); out: mutex_unlock(&p_slot->lock); } @@ -501,7 +501,7 @@ static void handle_button_press_event(struct slot *p_slot) p_slot->hpc_ops->green_led_blink(p_slot); p_slot->hpc_ops->set_attention_status(p_slot, 0); - queue_delayed_work(p_slot->wq, &p_slot->work, 5*HZ); + queue_delayed_work(shpchp_wq, &p_slot->work, 5*HZ); break; case BLINKINGOFF_STATE: case BLINKINGON_STATE: diff --git a/trunk/drivers/pci/iov.c b/trunk/drivers/pci/iov.c index c18e5bf444fa..bafd2bbcaf65 100644 --- a/trunk/drivers/pci/iov.c +++ b/trunk/drivers/pci/iov.c @@ -739,7 +739,7 @@ EXPORT_SYMBOL_GPL(pci_num_vf); /** * pci_sriov_set_totalvfs -- reduce the TotalVFs available * @dev: the PCI PF device - * @numvfs: number that should be used for TotalVFs supported + * numvfs: number that should be used for TotalVFs supported * * Should be called from PF driver's probe routine with * device's mutex held. diff --git a/trunk/drivers/pci/pcie/Kconfig b/trunk/drivers/pci/pcie/Kconfig index fde4a32a0295..6c8bc5809787 100644 --- a/trunk/drivers/pci/pcie/Kconfig +++ b/trunk/drivers/pci/pcie/Kconfig @@ -82,4 +82,4 @@ endchoice config PCIE_PME def_bool y - depends on PCIEPORTBUS && PM_RUNTIME && ACPI + depends on PCIEPORTBUS && PM_RUNTIME && EXPERIMENTAL && ACPI diff --git a/trunk/drivers/pci/pcie/aer/aerdrv_core.c b/trunk/drivers/pci/pcie/aer/aerdrv_core.c index 564d97f94b6c..421bbc5fee32 100644 --- a/trunk/drivers/pci/pcie/aer/aerdrv_core.c +++ b/trunk/drivers/pci/pcie/aer/aerdrv_core.c @@ -630,7 +630,6 @@ static void aer_recover_work_func(struct work_struct *work) continue; } do_recovery(pdev, entry.severity); - pci_dev_put(pdev); } } #endif diff --git a/trunk/drivers/pci/pcie/aspm.c b/trunk/drivers/pci/pcie/aspm.c index 8474b6a4fc9b..b52630b8eada 100644 --- a/trunk/drivers/pci/pcie/aspm.c +++ b/trunk/drivers/pci/pcie/aspm.c @@ -771,9 +771,6 @@ void pcie_clear_aspm(struct pci_bus *bus) { struct pci_dev *child; - if (aspm_force) - return; - /* * Clear any ASPM setup that the firmware has carried out on this bus */ diff --git a/trunk/drivers/pinctrl/mvebu/pinctrl-dove.c b/trunk/drivers/pinctrl/mvebu/pinctrl-dove.c index 69aba3697287..750dea78f53a 100644 --- a/trunk/drivers/pinctrl/mvebu/pinctrl-dove.c +++ b/trunk/drivers/pinctrl/mvebu/pinctrl-dove.c @@ -595,11 +595,8 @@ static int dove_pinctrl_probe(struct platform_device *pdev) * grab clk to make sure it is ticking. */ clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(clk)) { - dev_err(&pdev->dev, "Unable to get pdma clock"); - return PTR_RET(clk); - } - clk_prepare_enable(clk); + if (!IS_ERR(clk)) + clk_prepare_enable(clk); return mvebu_pinctrl_probe(pdev); } diff --git a/trunk/drivers/platform/x86/acer-wmi.c b/trunk/drivers/platform/x86/acer-wmi.c index afed7018a2b5..06f4eb7ab87e 100644 --- a/trunk/drivers/platform/x86/acer-wmi.c +++ b/trunk/drivers/platform/x86/acer-wmi.c @@ -125,11 +125,8 @@ static const struct key_entry acer_wmi_keymap[] = { {KE_IGNORE, 0x63, {KEY_BRIGHTNESSDOWN} }, {KE_KEY, 0x64, {KEY_SWITCHVIDEOMODE} }, /* Display Switch */ {KE_IGNORE, 0x81, {KEY_SLEEP} }, - {KE_KEY, 0x82, {KEY_TOUCHPAD_TOGGLE} }, /* Touch Pad Toggle */ - {KE_KEY, KEY_TOUCHPAD_ON, {KEY_TOUCHPAD_ON} }, - {KE_KEY, KEY_TOUCHPAD_OFF, {KEY_TOUCHPAD_OFF} }, + {KE_KEY, 0x82, {KEY_TOUCHPAD_TOGGLE} }, /* Touch Pad On/Off */ {KE_IGNORE, 0x83, {KEY_TOUCHPAD_TOGGLE} }, - {KE_KEY, 0x85, {KEY_TOUCHPAD_TOGGLE} }, {KE_END, 0} }; @@ -150,7 +147,6 @@ struct event_return_value { #define ACER_WMID3_GDS_THREEG (1<<6) /* 3G */ #define ACER_WMID3_GDS_WIMAX (1<<7) /* WiMAX */ #define ACER_WMID3_GDS_BLUETOOTH (1<<11) /* BT */ -#define ACER_WMID3_GDS_TOUCHPAD (1<<1) /* Touchpad */ struct lm_input_params { u8 function_num; /* Function Number */ @@ -879,7 +875,7 @@ WMI_execute_u32(u32 method_id, u32 in, u32 *out) struct acpi_buffer input = { (acpi_size) sizeof(u32), (void *)(&in) }; struct acpi_buffer result = { ACPI_ALLOCATE_BUFFER, NULL }; union acpi_object *obj; - u32 tmp = 0; + u32 tmp; acpi_status status; status = wmi_evaluate_method(WMID_GUID1, 1, method_id, &input, &result); @@ -888,14 +884,14 @@ WMI_execute_u32(u32 method_id, u32 in, u32 *out) return status; obj = (union acpi_object *) result.pointer; - if (obj) { - if (obj->type == ACPI_TYPE_BUFFER && - (obj->buffer.length == sizeof(u32) || - obj->buffer.length == sizeof(u64))) { - tmp = *((u32 *) obj->buffer.pointer); - } else if (obj->type == ACPI_TYPE_INTEGER) { - tmp = (u32) obj->integer.value; - } + if (obj && obj->type == ACPI_TYPE_BUFFER && + (obj->buffer.length == sizeof(u32) || + obj->buffer.length == sizeof(u64))) { + tmp = *((u32 *) obj->buffer.pointer); + } else if (obj->type == ACPI_TYPE_INTEGER) { + tmp = (u32) obj->integer.value; + } else { + tmp = 0; } if (out) @@ -1197,14 +1193,12 @@ static acpi_status WMID_set_capabilities(void) return status; obj = (union acpi_object *) out.pointer; - if (obj) { - if (obj->type == ACPI_TYPE_BUFFER && - (obj->buffer.length == sizeof(u32) || - obj->buffer.length == sizeof(u64))) { - devices = *((u32 *) obj->buffer.pointer); - } else if (obj->type == ACPI_TYPE_INTEGER) { - devices = (u32) obj->integer.value; - } + if (obj && obj->type == ACPI_TYPE_BUFFER && + (obj->buffer.length == sizeof(u32) || + obj->buffer.length == sizeof(u64))) { + devices = *((u32 *) obj->buffer.pointer); + } else if (obj->type == ACPI_TYPE_INTEGER) { + devices = (u32) obj->integer.value; } else { kfree(out.pointer); return AE_ERROR; @@ -1682,7 +1676,6 @@ static void acer_wmi_notify(u32 value, void *context) acpi_status status; u16 device_state; const struct key_entry *key; - u32 scancode; status = wmi_get_event_data(value, &response); if (status != AE_OK) { @@ -1719,7 +1712,6 @@ static void acer_wmi_notify(u32 value, void *context) pr_warn("Unknown key number - 0x%x\n", return_value.key_num); } else { - scancode = return_value.key_num; switch (key->keycode) { case KEY_WLAN: case KEY_BLUETOOTH: @@ -1733,11 +1725,9 @@ static void acer_wmi_notify(u32 value, void *context) rfkill_set_sw_state(bluetooth_rfkill, !(device_state & ACER_WMID3_GDS_BLUETOOTH)); break; - case KEY_TOUCHPAD_TOGGLE: - scancode = (device_state & ACER_WMID3_GDS_TOUCHPAD) ? - KEY_TOUCHPAD_ON : KEY_TOUCHPAD_OFF; } - sparse_keymap_report_event(acer_wmi_input_dev, scancode, 1, true); + sparse_keymap_report_entry(acer_wmi_input_dev, key, + 1, true); } break; case WMID_ACCEL_EVENT: @@ -1956,14 +1946,12 @@ static u32 get_wmid_devices(void) return 0; obj = (union acpi_object *) out.pointer; - if (obj) { - if (obj->type == ACPI_TYPE_BUFFER && - (obj->buffer.length == sizeof(u32) || - obj->buffer.length == sizeof(u64))) { - devices = *((u32 *) obj->buffer.pointer); - } else if (obj->type == ACPI_TYPE_INTEGER) { - devices = (u32) obj->integer.value; - } + if (obj && obj->type == ACPI_TYPE_BUFFER && + (obj->buffer.length == sizeof(u32) || + obj->buffer.length == sizeof(u64))) { + devices = *((u32 *) obj->buffer.pointer); + } else if (obj->type == ACPI_TYPE_INTEGER) { + devices = (u32) obj->integer.value; } kfree(out.pointer); diff --git a/trunk/drivers/platform/x86/asus-laptop.c b/trunk/drivers/platform/x86/asus-laptop.c index fcde4e528819..ec1d3bc2dbe2 100644 --- a/trunk/drivers/platform/x86/asus-laptop.c +++ b/trunk/drivers/platform/x86/asus-laptop.c @@ -860,10 +860,8 @@ static ssize_t show_infos(struct device *dev, /* * The HWRS method return informations about the hardware. * 0x80 bit is for WLAN, 0x100 for Bluetooth. - * 0x40 for WWAN, 0x10 for WIMAX. * The significance of others is yet to be found. - * We don't currently use this for device detection, and it - * takes several seconds to run on some systems. + * If we don't find the method, we assume the device are present. */ rv = acpi_evaluate_integer(asus->handle, "HWRS", NULL, &temp); if (!ACPI_FAILURE(rv)) @@ -1684,7 +1682,7 @@ static int asus_laptop_get_info(struct asus_laptop *asus) { struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; union acpi_object *model = NULL; - unsigned long long bsts_result; + unsigned long long bsts_result, hwrs_result; char *string = NULL; acpi_status status; @@ -1743,9 +1741,20 @@ static int asus_laptop_get_info(struct asus_laptop *asus) return -ENOMEM; } - if (string) + if (*string) pr_notice(" %s model detected\n", string); + /* + * The HWRS method return informations about the hardware. + * 0x80 bit is for WLAN, 0x100 for Bluetooth, + * 0x40 for WWAN, 0x10 for WIMAX. + * The significance of others is yet to be found. + */ + status = + acpi_evaluate_integer(asus->handle, "HWRS", NULL, &hwrs_result); + if (!ACPI_FAILURE(status)) + pr_notice(" HWRS returned %x", (int)hwrs_result); + if (!acpi_check_handle(asus->handle, METHOD_WL_STATUS, NULL)) asus->have_rsts = true; diff --git a/trunk/drivers/platform/x86/samsung-laptop.c b/trunk/drivers/platform/x86/samsung-laptop.c index 71623a2ff3e8..dd90d15f5210 100644 --- a/trunk/drivers/platform/x86/samsung-laptop.c +++ b/trunk/drivers/platform/x86/samsung-laptop.c @@ -1523,16 +1523,6 @@ static struct dmi_system_id __initdata samsung_dmi_table[] = { }, .driver_data = &samsung_broken_acpi_video, }, - { - .callback = samsung_dmi_matched, - .ident = "N250P", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), - DMI_MATCH(DMI_PRODUCT_NAME, "N250P"), - DMI_MATCH(DMI_BOARD_NAME, "N250P"), - }, - .driver_data = &samsung_broken_acpi_video, - }, { }, }; MODULE_DEVICE_TABLE(dmi, samsung_dmi_table); diff --git a/trunk/drivers/platform/x86/sony-laptop.c b/trunk/drivers/platform/x86/sony-laptop.c index b8ad71f7863f..daaddec68def 100644 --- a/trunk/drivers/platform/x86/sony-laptop.c +++ b/trunk/drivers/platform/x86/sony-laptop.c @@ -786,29 +786,28 @@ static int sony_nc_int_call(acpi_handle handle, char *name, int *value, static int sony_nc_buffer_call(acpi_handle handle, char *name, u64 *value, void *buffer, size_t buflen) { - int ret = 0; size_t len = len; union acpi_object *object = __call_snc_method(handle, name, value); if (!object) return -EINVAL; - if (object->type == ACPI_TYPE_BUFFER) { + if (object->type == ACPI_TYPE_BUFFER) len = MIN(buflen, object->buffer.length); - memcpy(buffer, object->buffer.pointer, len); - } else if (object->type == ACPI_TYPE_INTEGER) { + else if (object->type == ACPI_TYPE_INTEGER) len = MIN(buflen, sizeof(object->integer.value)); - memcpy(buffer, &object->integer.value, len); - } else { + else { pr_warn("Invalid acpi_object: expected 0x%x got 0x%x\n", ACPI_TYPE_BUFFER, object->type); - ret = -EINVAL; + kfree(object); + return -EINVAL; } + memcpy(buffer, object->buffer.pointer, len); kfree(object); - return ret; + return 0; } struct sony_nc_handles { diff --git a/trunk/drivers/pnp/interface.c b/trunk/drivers/pnp/interface.c index 0c201317284b..cfaf5b73540b 100644 --- a/trunk/drivers/pnp/interface.c +++ b/trunk/drivers/pnp/interface.c @@ -298,39 +298,6 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, return ret; } -static char *pnp_get_resource_value(char *buf, - unsigned long type, - resource_size_t *start, - resource_size_t *end, - unsigned long *flags) -{ - if (start) - *start = 0; - if (end) - *end = 0; - if (flags) - *flags = 0; - - /* TBD: allow for disabled resources */ - - buf = skip_spaces(buf); - if (start) { - *start = simple_strtoull(buf, &buf, 0); - if (end) { - buf = skip_spaces(buf); - if (*buf == '-') { - buf = skip_spaces(buf + 1); - *end = simple_strtoull(buf, &buf, 0); - } else - *end = *start; - } - } - - /* TBD: allow for additional flags, e.g., IORESOURCE_WINDOW */ - - return buf; -} - static ssize_t pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr, const char *ubuf, size_t count) @@ -338,6 +305,7 @@ static ssize_t pnp_set_current_resources(struct device *dmdev, struct pnp_dev *dev = to_pnp_dev(dmdev); char *buf = (void *)ubuf; int retval = 0; + resource_size_t start, end; if (dev->status & PNP_ATTACHED) { retval = -EBUSY; @@ -381,10 +349,6 @@ static ssize_t pnp_set_current_resources(struct device *dmdev, goto done; } if (!strnicmp(buf, "set", 3)) { - resource_size_t start; - resource_size_t end; - unsigned long flags; - if (dev->active) goto done; buf += 3; @@ -393,37 +357,42 @@ static ssize_t pnp_set_current_resources(struct device *dmdev, while (1) { buf = skip_spaces(buf); if (!strnicmp(buf, "io", 2)) { - buf = pnp_get_resource_value(buf + 2, - IORESOURCE_IO, - &start, &end, - &flags); - pnp_add_io_resource(dev, start, end, flags); - } else if (!strnicmp(buf, "mem", 3)) { - buf = pnp_get_resource_value(buf + 3, - IORESOURCE_MEM, - &start, &end, - &flags); - pnp_add_mem_resource(dev, start, end, flags); - } else if (!strnicmp(buf, "irq", 3)) { - buf = pnp_get_resource_value(buf + 3, - IORESOURCE_IRQ, - &start, NULL, - &flags); - pnp_add_irq_resource(dev, start, flags); - } else if (!strnicmp(buf, "dma", 3)) { - buf = pnp_get_resource_value(buf + 3, - IORESOURCE_DMA, - &start, NULL, - &flags); - pnp_add_dma_resource(dev, start, flags); - } else if (!strnicmp(buf, "bus", 3)) { - buf = pnp_get_resource_value(buf + 3, - IORESOURCE_BUS, - &start, &end, - NULL); - pnp_add_bus_resource(dev, start, end); - } else - break; + buf = skip_spaces(buf + 2); + start = simple_strtoul(buf, &buf, 0); + buf = skip_spaces(buf); + if (*buf == '-') { + buf = skip_spaces(buf + 1); + end = simple_strtoul(buf, &buf, 0); + } else + end = start; + pnp_add_io_resource(dev, start, end, 0); + continue; + } + if (!strnicmp(buf, "mem", 3)) { + buf = skip_spaces(buf + 3); + start = simple_strtoul(buf, &buf, 0); + buf = skip_spaces(buf); + if (*buf == '-') { + buf = skip_spaces(buf + 1); + end = simple_strtoul(buf, &buf, 0); + } else + end = start; + pnp_add_mem_resource(dev, start, end, 0); + continue; + } + if (!strnicmp(buf, "irq", 3)) { + buf = skip_spaces(buf + 3); + start = simple_strtoul(buf, &buf, 0); + pnp_add_irq_resource(dev, start, 0); + continue; + } + if (!strnicmp(buf, "dma", 3)) { + buf = skip_spaces(buf + 3); + start = simple_strtoul(buf, &buf, 0); + pnp_add_dma_resource(dev, start, 0); + continue; + } + break; } mutex_unlock(&pnp_res_mutex); goto done; diff --git a/trunk/drivers/pnp/manager.c b/trunk/drivers/pnp/manager.c index 95cebf0185de..ed9ce507149a 100644 --- a/trunk/drivers/pnp/manager.c +++ b/trunk/drivers/pnp/manager.c @@ -18,27 +18,11 @@ DEFINE_MUTEX(pnp_res_mutex); -static struct resource *pnp_find_resource(struct pnp_dev *dev, - unsigned char rule, - unsigned long type, - unsigned int bar) -{ - struct resource *res = pnp_get_resource(dev, type, bar); - - /* when the resource already exists, set its resource bits from rule */ - if (res) { - res->flags &= ~IORESOURCE_BITS; - res->flags |= rule & IORESOURCE_BITS; - } - - return res; -} - static int pnp_assign_port(struct pnp_dev *dev, struct pnp_port *rule, int idx) { struct resource *res, local_res; - res = pnp_find_resource(dev, rule->flags, IORESOURCE_IO, idx); + res = pnp_get_resource(dev, IORESOURCE_IO, idx); if (res) { pnp_dbg(&dev->dev, " io %d already set to %#llx-%#llx " "flags %#lx\n", idx, (unsigned long long) res->start, @@ -81,7 +65,7 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx) { struct resource *res, local_res; - res = pnp_find_resource(dev, rule->flags, IORESOURCE_MEM, idx); + res = pnp_get_resource(dev, IORESOURCE_MEM, idx); if (res) { pnp_dbg(&dev->dev, " mem %d already set to %#llx-%#llx " "flags %#lx\n", idx, (unsigned long long) res->start, @@ -94,7 +78,6 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx) res->start = 0; res->end = 0; - /* ??? rule->flags restricted to 8 bits, all tests bogus ??? */ if (!(rule->flags & IORESOURCE_MEM_WRITEABLE)) res->flags |= IORESOURCE_READONLY; if (rule->flags & IORESOURCE_MEM_CACHEABLE) @@ -140,7 +123,7 @@ static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx) 5, 10, 11, 12, 9, 14, 15, 7, 3, 4, 13, 0, 1, 6, 8, 2 }; - res = pnp_find_resource(dev, rule->flags, IORESOURCE_IRQ, idx); + res = pnp_get_resource(dev, IORESOURCE_IRQ, idx); if (res) { pnp_dbg(&dev->dev, " irq %d already set to %d flags %#lx\n", idx, (int) res->start, res->flags); @@ -199,7 +182,7 @@ static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx) 1, 3, 5, 6, 7, 0, 2, 4 }; - res = pnp_find_resource(dev, rule->flags, IORESOURCE_DMA, idx); + res = pnp_get_resource(dev, IORESOURCE_DMA, idx); if (res) { pnp_dbg(&dev->dev, " dma %d already set to %d flags %#lx\n", idx, (int) res->start, res->flags); diff --git a/trunk/drivers/power/reset/gpio-poweroff.c b/trunk/drivers/power/reset/gpio-poweroff.c index e290d48ddd99..06074248ba7a 100644 --- a/trunk/drivers/power/reset/gpio-poweroff.c +++ b/trunk/drivers/power/reset/gpio-poweroff.c @@ -29,16 +29,15 @@ static int gpio_active_low; static void gpio_poweroff_do_poweroff(void) { - BUG_ON(!gpio_is_valid(gpio_num)); + BUG_ON(gpio_num == -1); - /* drive it active, also inactive->active edge */ + /* drive it active */ gpio_direction_output(gpio_num, !gpio_active_low); mdelay(100); - /* drive inactive, also active->inactive edge */ + /* rising edge or drive inactive */ gpio_set_value(gpio_num, gpio_active_low); mdelay(100); - - /* drive it active, also inactive->active edge */ + /* falling edge */ gpio_set_value(gpio_num, !gpio_active_low); /* give it some time */ @@ -61,12 +60,15 @@ static int gpio_poweroff_probe(struct platform_device *pdev) } gpio_num = of_get_gpio_flags(pdev->dev.of_node, 0, &flags); - if (!gpio_is_valid(gpio_num)) - return gpio_num; - + if (gpio_num < 0) { + pr_err("%s: Could not get GPIO configuration: %d", + __func__, gpio_num); + return -ENODEV; + } gpio_active_low = flags & OF_GPIO_ACTIVE_LOW; - input = of_property_read_bool(pdev->dev.of_node, "input"); + if (of_get_property(pdev->dev.of_node, "input", NULL)) + input = true; ret = gpio_request(gpio_num, "poweroff-gpio"); if (ret) { @@ -96,7 +98,8 @@ static int gpio_poweroff_probe(struct platform_device *pdev) static int gpio_poweroff_remove(struct platform_device *pdev) { - gpio_free(gpio_num); + if (gpio_num != -1) + gpio_free(gpio_num); if (pm_power_off == &gpio_poweroff_do_poweroff) pm_power_off = NULL; @@ -112,15 +115,15 @@ static struct platform_driver gpio_poweroff_driver = { .probe = gpio_poweroff_probe, .remove = gpio_poweroff_remove, .driver = { - .name = "poweroff-gpio", - .owner = THIS_MODULE, - .of_match_table = of_gpio_poweroff_match, - }, + .name = "poweroff-gpio", + .owner = THIS_MODULE, + .of_match_table = of_gpio_poweroff_match, + }, }; module_platform_driver(gpio_poweroff_driver); MODULE_AUTHOR("Jamie Lentin "); MODULE_DESCRIPTION("GPIO poweroff driver"); -MODULE_LICENSE("GPL v2"); +MODULE_LICENSE("GPL"); MODULE_ALIAS("platform:poweroff-gpio"); diff --git a/trunk/drivers/regulator/core.c b/trunk/drivers/regulator/core.c index 278584302f2d..0f65b246cc0c 100644 --- a/trunk/drivers/regulator/core.c +++ b/trunk/drivers/regulator/core.c @@ -1885,15 +1885,9 @@ int regulator_can_change_voltage(struct regulator *regulator) struct regulator_dev *rdev = regulator->rdev; if (rdev->constraints && - (rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) { - if (rdev->desc->n_voltages - rdev->desc->linear_min_sel > 1) - return 1; - - if (rdev->desc->continuous_voltage_range && - rdev->constraints->min_uV && rdev->constraints->max_uV && - rdev->constraints->min_uV != rdev->constraints->max_uV) - return 1; - } + rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE && + (rdev->desc->n_voltages - rdev->desc->linear_min_sel) > 1) + return 1; return 0; } @@ -3321,8 +3315,7 @@ static void rdev_init_debugfs(struct regulator_dev *rdev) * @config: runtime configuration for regulator * * Called by regulator drivers to register a regulator. - * Returns a valid pointer to struct regulator_dev on success - * or an ERR_PTR() on error. + * Returns 0 on success. */ struct regulator_dev * regulator_register(const struct regulator_desc *regulator_desc, diff --git a/trunk/drivers/regulator/max8997.c b/trunk/drivers/regulator/max8997.c index 02be7fcae32f..df0eafb0dc7e 100644 --- a/trunk/drivers/regulator/max8997.c +++ b/trunk/drivers/regulator/max8997.c @@ -71,26 +71,26 @@ struct voltage_map_desc { int step; }; -/* Voltage maps in uV */ +/* Voltage maps in mV */ static const struct voltage_map_desc ldo_voltage_map_desc = { - .min = 800000, .max = 3950000, .step = 50000, + .min = 800, .max = 3950, .step = 50, }; /* LDO1 ~ 18, 21 all */ static const struct voltage_map_desc buck1245_voltage_map_desc = { - .min = 650000, .max = 2225000, .step = 25000, + .min = 650, .max = 2225, .step = 25, }; /* Buck1, 2, 4, 5 */ static const struct voltage_map_desc buck37_voltage_map_desc = { - .min = 750000, .max = 3900000, .step = 50000, + .min = 750, .max = 3900, .step = 50, }; /* Buck3, 7 */ -/* current map in uA */ +/* current map in mA */ static const struct voltage_map_desc charger_current_map_desc = { - .min = 200000, .max = 950000, .step = 50000, + .min = 200, .max = 950, .step = 50, }; static const struct voltage_map_desc topoff_current_map_desc = { - .min = 50000, .max = 200000, .step = 10000, + .min = 50, .max = 200, .step = 10, }; static const struct voltage_map_desc *reg_voltage_map[] = { @@ -194,7 +194,7 @@ static int max8997_list_voltage(struct regulator_dev *rdev, if (val > desc->max) return -EINVAL; - return val; + return val * 1000; } static int max8997_get_enable_register(struct regulator_dev *rdev, @@ -485,6 +485,7 @@ static int max8997_set_voltage_ldobuck(struct regulator_dev *rdev, { struct max8997_data *max8997 = rdev_get_drvdata(rdev); struct i2c_client *i2c = max8997->iodev->i2c; + int min_vol = min_uV / 1000, max_vol = max_uV / 1000; const struct voltage_map_desc *desc; int rid = rdev_get_id(rdev); int i, reg, shift, mask, ret; @@ -508,7 +509,7 @@ static int max8997_set_voltage_ldobuck(struct regulator_dev *rdev, desc = reg_voltage_map[rid]; - i = max8997_get_voltage_proper_val(desc, min_uV, max_uV); + i = max8997_get_voltage_proper_val(desc, min_vol, max_vol); if (i < 0) return i; @@ -556,7 +557,7 @@ static int max8997_set_voltage_ldobuck_time_sel(struct regulator_dev *rdev, case MAX8997_BUCK4: case MAX8997_BUCK5: return DIV_ROUND_UP(desc->step * (new_selector - old_selector), - max8997->ramp_delay * 1000); + max8997->ramp_delay); } return 0; @@ -655,6 +656,7 @@ static int max8997_set_voltage_buck(struct regulator_dev *rdev, const struct voltage_map_desc *desc; int new_val, new_idx, damage, tmp_val, tmp_idx, tmp_dmg; bool gpio_dvs_mode = false; + int min_vol = min_uV / 1000, max_vol = max_uV / 1000; if (rid < MAX8997_BUCK1 || rid > MAX8997_BUCK7) return -EINVAL; @@ -679,7 +681,7 @@ static int max8997_set_voltage_buck(struct regulator_dev *rdev, selector); desc = reg_voltage_map[rid]; - new_val = max8997_get_voltage_proper_val(desc, min_uV, max_uV); + new_val = max8997_get_voltage_proper_val(desc, min_vol, max_vol); if (new_val < 0) return new_val; @@ -1121,8 +1123,8 @@ static int max8997_pmic_probe(struct platform_device *pdev) max8997->buck1_vol[i] = ret = max8997_get_voltage_proper_val( &buck1245_voltage_map_desc, - pdata->buck1_voltage[i], - pdata->buck1_voltage[i] + + pdata->buck1_voltage[i] / 1000, + pdata->buck1_voltage[i] / 1000 + buck1245_voltage_map_desc.step); if (ret < 0) goto err_out; @@ -1130,8 +1132,8 @@ static int max8997_pmic_probe(struct platform_device *pdev) max8997->buck2_vol[i] = ret = max8997_get_voltage_proper_val( &buck1245_voltage_map_desc, - pdata->buck2_voltage[i], - pdata->buck2_voltage[i] + + pdata->buck2_voltage[i] / 1000, + pdata->buck2_voltage[i] / 1000 + buck1245_voltage_map_desc.step); if (ret < 0) goto err_out; @@ -1139,8 +1141,8 @@ static int max8997_pmic_probe(struct platform_device *pdev) max8997->buck5_vol[i] = ret = max8997_get_voltage_proper_val( &buck1245_voltage_map_desc, - pdata->buck5_voltage[i], - pdata->buck5_voltage[i] + + pdata->buck5_voltage[i] / 1000, + pdata->buck5_voltage[i] / 1000 + buck1245_voltage_map_desc.step); if (ret < 0) goto err_out; diff --git a/trunk/drivers/regulator/max8998.c b/trunk/drivers/regulator/max8998.c index 1f0df4046b86..b821d08eb64a 100644 --- a/trunk/drivers/regulator/max8998.c +++ b/trunk/drivers/regulator/max8998.c @@ -51,39 +51,39 @@ struct voltage_map_desc { int step; }; -/* Voltage maps in uV*/ +/* Voltage maps */ static const struct voltage_map_desc ldo23_voltage_map_desc = { - .min = 800000, .step = 50000, .max = 1300000, + .min = 800, .step = 50, .max = 1300, }; static const struct voltage_map_desc ldo456711_voltage_map_desc = { - .min = 1600000, .step = 100000, .max = 3600000, + .min = 1600, .step = 100, .max = 3600, }; static const struct voltage_map_desc ldo8_voltage_map_desc = { - .min = 3000000, .step = 100000, .max = 3600000, + .min = 3000, .step = 100, .max = 3600, }; static const struct voltage_map_desc ldo9_voltage_map_desc = { - .min = 2800000, .step = 100000, .max = 3100000, + .min = 2800, .step = 100, .max = 3100, }; static const struct voltage_map_desc ldo10_voltage_map_desc = { - .min = 95000, .step = 50000, .max = 1300000, + .min = 950, .step = 50, .max = 1300, }; static const struct voltage_map_desc ldo1213_voltage_map_desc = { - .min = 800000, .step = 100000, .max = 3300000, + .min = 800, .step = 100, .max = 3300, }; static const struct voltage_map_desc ldo1415_voltage_map_desc = { - .min = 1200000, .step = 100000, .max = 3300000, + .min = 1200, .step = 100, .max = 3300, }; static const struct voltage_map_desc ldo1617_voltage_map_desc = { - .min = 1600000, .step = 100000, .max = 3600000, + .min = 1600, .step = 100, .max = 3600, }; static const struct voltage_map_desc buck12_voltage_map_desc = { - .min = 750000, .step = 25000, .max = 1525000, + .min = 750, .step = 25, .max = 1525, }; static const struct voltage_map_desc buck3_voltage_map_desc = { - .min = 1600000, .step = 100000, .max = 3600000, + .min = 1600, .step = 100, .max = 3600, }; static const struct voltage_map_desc buck4_voltage_map_desc = { - .min = 800000, .step = 100000, .max = 2300000, + .min = 800, .step = 100, .max = 2300, }; static const struct voltage_map_desc *ldo_voltage_map[] = { @@ -445,9 +445,9 @@ static int max8998_set_voltage_buck_time_sel(struct regulator_dev *rdev, if (max8998->iodev->type == TYPE_MAX8998 && !(val & MAX8998_ENRAMP)) return 0; - difference = (new_selector - old_selector) * desc->step / 1000; + difference = (new_selector - old_selector) * desc->step; if (difference > 0) - return DIV_ROUND_UP(difference, (val & 0x0f) + 1); + return difference / ((val & 0x0f) + 1); return 0; } @@ -702,7 +702,7 @@ static int max8998_pmic_probe(struct platform_device *pdev) i = 0; while (buck12_voltage_map_desc.min + buck12_voltage_map_desc.step*i - < pdata->buck1_voltage1) + < (pdata->buck1_voltage1 / 1000)) i++; max8998->buck1_vol[0] = i; ret = max8998_write_reg(i2c, MAX8998_REG_BUCK1_VOLTAGE1, i); @@ -713,7 +713,7 @@ static int max8998_pmic_probe(struct platform_device *pdev) i = 0; while (buck12_voltage_map_desc.min + buck12_voltage_map_desc.step*i - < pdata->buck1_voltage2) + < (pdata->buck1_voltage2 / 1000)) i++; max8998->buck1_vol[1] = i; @@ -725,7 +725,7 @@ static int max8998_pmic_probe(struct platform_device *pdev) i = 0; while (buck12_voltage_map_desc.min + buck12_voltage_map_desc.step*i - < pdata->buck1_voltage3) + < (pdata->buck1_voltage3 / 1000)) i++; max8998->buck1_vol[2] = i; @@ -737,7 +737,7 @@ static int max8998_pmic_probe(struct platform_device *pdev) i = 0; while (buck12_voltage_map_desc.min + buck12_voltage_map_desc.step*i - < pdata->buck1_voltage4) + < (pdata->buck1_voltage4 / 1000)) i++; max8998->buck1_vol[3] = i; @@ -763,7 +763,7 @@ static int max8998_pmic_probe(struct platform_device *pdev) i = 0; while (buck12_voltage_map_desc.min + buck12_voltage_map_desc.step*i - < pdata->buck2_voltage1) + < (pdata->buck2_voltage1 / 1000)) i++; max8998->buck2_vol[0] = i; ret = max8998_write_reg(i2c, MAX8998_REG_BUCK2_VOLTAGE1, i); @@ -774,7 +774,7 @@ static int max8998_pmic_probe(struct platform_device *pdev) i = 0; while (buck12_voltage_map_desc.min + buck12_voltage_map_desc.step*i - < pdata->buck2_voltage2) + < (pdata->buck2_voltage2 / 1000)) i++; max8998->buck2_vol[1] = i; ret = max8998_write_reg(i2c, MAX8998_REG_BUCK2_VOLTAGE2, i); @@ -792,8 +792,8 @@ static int max8998_pmic_probe(struct platform_device *pdev) int count = (desc->max - desc->min) / desc->step + 1; regulators[index].n_voltages = count; - regulators[index].min_uV = desc->min; - regulators[index].uV_step = desc->step; + regulators[index].min_uV = desc->min * 1000; + regulators[index].uV_step = desc->step * 1000; } config.dev = max8998->dev; diff --git a/trunk/drivers/regulator/s5m8767.c b/trunk/drivers/regulator/s5m8767.c index 33b65c9ad5d5..9f991f2c525a 100644 --- a/trunk/drivers/regulator/s5m8767.c +++ b/trunk/drivers/regulator/s5m8767.c @@ -214,7 +214,7 @@ static int s5m8767_reg_is_enabled(struct regulator_dev *rdev) struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev); int ret, reg; int mask = 0xc0, enable_ctrl; - unsigned int val; + u8 val; ret = s5m8767_get_register(rdev, ®, &enable_ctrl); if (ret == -EINVAL) @@ -306,7 +306,7 @@ static int s5m8767_get_voltage_sel(struct regulator_dev *rdev) struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev); int reg, mask, ret; int reg_id = rdev_get_id(rdev); - unsigned int val; + u8 val; ret = s5m8767_get_voltage_register(rdev, ®); if (ret) diff --git a/trunk/drivers/rtc/Kconfig b/trunk/drivers/rtc/Kconfig index 923a9da9c829..d0cea02b5dfc 100644 --- a/trunk/drivers/rtc/Kconfig +++ b/trunk/drivers/rtc/Kconfig @@ -352,14 +352,6 @@ config RTC_DRV_TWL4030 This driver can also be built as a module. If so, the module will be called rtc-twl. -config RTC_DRV_TPS6586X - tristate "TI TPS6586X RTC driver" - depends on MFD_TPS6586X - help - TI Power Managment IC TPS6586X supports RTC functionality - along with alarm. This driver supports the RTC driver for - the TPS6586X RTC module. - config RTC_DRV_TPS65910 tristate "TI TPS65910 RTC driver" depends on RTC_CLASS && MFD_TPS65910 diff --git a/trunk/drivers/rtc/Makefile b/trunk/drivers/rtc/Makefile index 4418ef3f9ecc..c3f62c80dc06 100644 --- a/trunk/drivers/rtc/Makefile +++ b/trunk/drivers/rtc/Makefile @@ -111,7 +111,6 @@ obj-$(CONFIG_RTC_DRV_TEGRA) += rtc-tegra.o obj-$(CONFIG_RTC_DRV_TEST) += rtc-test.o obj-$(CONFIG_RTC_DRV_TILE) += rtc-tile.o obj-$(CONFIG_RTC_DRV_TWL4030) += rtc-twl.o -obj-$(CONFIG_RTC_DRV_TPS6586X) += rtc-tps6586x.o obj-$(CONFIG_RTC_DRV_TPS65910) += rtc-tps65910.o obj-$(CONFIG_RTC_DRV_TX4939) += rtc-tx4939.o obj-$(CONFIG_RTC_DRV_V3020) += rtc-v3020.o diff --git a/trunk/drivers/rtc/rtc-da9055.c b/trunk/drivers/rtc/rtc-da9055.c index 8f0dcfedb83c..96bafc5c3bf8 100644 --- a/trunk/drivers/rtc/rtc-da9055.c +++ b/trunk/drivers/rtc/rtc-da9055.c @@ -227,7 +227,7 @@ static const struct rtc_class_ops da9055_rtc_ops = { .alarm_irq_enable = da9055_rtc_alarm_irq_enable, }; -static int da9055_rtc_device_init(struct da9055 *da9055, +static int __init da9055_rtc_device_init(struct da9055 *da9055, struct da9055_pdata *pdata) { int ret; diff --git a/trunk/drivers/rtc/rtc-tegra.c b/trunk/drivers/rtc/rtc-tegra.c index c84ea6659f49..5ba2f756a524 100644 --- a/trunk/drivers/rtc/rtc-tegra.c +++ b/trunk/drivers/rtc/rtc-tegra.c @@ -303,12 +303,6 @@ static struct rtc_class_ops tegra_rtc_ops = { .alarm_irq_enable = tegra_rtc_alarm_irq_enable, }; -static const struct of_device_id tegra_rtc_dt_match[] = { - { .compatible = "nvidia,tegra20-rtc", }, - {} -}; -MODULE_DEVICE_TABLE(of, tegra_rtc_dt_match); - static int tegra_rtc_probe(struct platform_device *pdev) { struct tegra_rtc_info *info; @@ -446,7 +440,6 @@ static struct platform_driver tegra_rtc_driver = { .driver = { .name = "tegra_rtc", .owner = THIS_MODULE, - .of_match_table = tegra_rtc_dt_match, }, #ifdef CONFIG_PM .suspend = tegra_rtc_suspend, diff --git a/trunk/drivers/rtc/rtc-tps6586x.c b/trunk/drivers/rtc/rtc-tps6586x.c deleted file mode 100644 index 70f61b8e9e6f..000000000000 --- a/trunk/drivers/rtc/rtc-tps6586x.c +++ /dev/null @@ -1,356 +0,0 @@ -/* - * rtc-tps6586x.c: RTC driver for TI PMIC TPS6586X - * - * Copyright (c) 2012, NVIDIA Corporation. - * - * Author: Laxman Dewangan - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation version 2. - * - * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind, - * whether express or implied; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define RTC_CTRL 0xc0 -#define POR_RESET_N BIT(7) -#define OSC_SRC_SEL BIT(6) -#define RTC_ENABLE BIT(5) /* enables alarm */ -#define RTC_BUF_ENABLE BIT(4) /* 32 KHz buffer enable */ -#define PRE_BYPASS BIT(3) /* 0=1KHz or 1=32KHz updates */ -#define CL_SEL_MASK (BIT(2)|BIT(1)) -#define CL_SEL_POS 1 -#define RTC_ALARM1_HI 0xc1 -#define RTC_COUNT4 0xc6 - -/* start a PMU RTC access by reading the register prior to the RTC_COUNT4 */ -#define RTC_COUNT4_DUMMYREAD 0xc5 - -/*only 14-bits width in second*/ -#define ALM1_VALID_RANGE_IN_SEC 0x3FFF - -#define TPS6586X_RTC_CL_SEL_1_5PF 0x0 -#define TPS6586X_RTC_CL_SEL_6_5PF 0x1 -#define TPS6586X_RTC_CL_SEL_7_5PF 0x2 -#define TPS6586X_RTC_CL_SEL_12_5PF 0x3 - -struct tps6586x_rtc { - struct device *dev; - struct rtc_device *rtc; - int irq; - bool irq_en; - unsigned long long epoch_start; -}; - -static inline struct device *to_tps6586x_dev(struct device *dev) -{ - return dev->parent; -} - -static int tps6586x_rtc_read_time(struct device *dev, struct rtc_time *tm) -{ - struct tps6586x_rtc *rtc = dev_get_drvdata(dev); - struct device *tps_dev = to_tps6586x_dev(dev); - unsigned long long ticks = 0; - unsigned long seconds; - u8 buff[6]; - int ret; - int i; - - ret = tps6586x_reads(tps_dev, RTC_COUNT4_DUMMYREAD, sizeof(buff), buff); - if (ret < 0) { - dev_err(dev, "read counter failed with err %d\n", ret); - return ret; - } - - for (i = 1; i < sizeof(buff); i++) { - ticks <<= 8; - ticks |= buff[i]; - } - - seconds = ticks >> 10; - seconds += rtc->epoch_start; - rtc_time_to_tm(seconds, tm); - return rtc_valid_tm(tm); -} - -static int tps6586x_rtc_set_time(struct device *dev, struct rtc_time *tm) -{ - struct tps6586x_rtc *rtc = dev_get_drvdata(dev); - struct device *tps_dev = to_tps6586x_dev(dev); - unsigned long long ticks; - unsigned long seconds; - u8 buff[5]; - int ret; - - rtc_tm_to_time(tm, &seconds); - if (seconds < rtc->epoch_start) { - dev_err(dev, "requested time unsupported\n"); - return -EINVAL; - } - seconds -= rtc->epoch_start; - - ticks = (unsigned long long)seconds << 10; - buff[0] = (ticks >> 32) & 0xff; - buff[1] = (ticks >> 24) & 0xff; - buff[2] = (ticks >> 16) & 0xff; - buff[3] = (ticks >> 8) & 0xff; - buff[4] = ticks & 0xff; - - /* Disable RTC before changing time */ - ret = tps6586x_clr_bits(tps_dev, RTC_CTRL, RTC_ENABLE); - if (ret < 0) { - dev_err(dev, "failed to clear RTC_ENABLE\n"); - return ret; - } - - ret = tps6586x_writes(tps_dev, RTC_COUNT4, sizeof(buff), buff); - if (ret < 0) { - dev_err(dev, "failed to program new time\n"); - return ret; - } - - /* Enable RTC */ - ret = tps6586x_set_bits(tps_dev, RTC_CTRL, RTC_ENABLE); - if (ret < 0) { - dev_err(dev, "failed to set RTC_ENABLE\n"); - return ret; - } - return 0; -} - -static int tps6586x_rtc_alarm_irq_enable(struct device *dev, - unsigned int enabled) -{ - struct tps6586x_rtc *rtc = dev_get_drvdata(dev); - - if (enabled && !rtc->irq_en) { - enable_irq(rtc->irq); - rtc->irq_en = true; - } else if (!enabled && rtc->irq_en) { - disable_irq(rtc->irq); - rtc->irq_en = false; - } - return 0; -} - -static int tps6586x_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) -{ - struct tps6586x_rtc *rtc = dev_get_drvdata(dev); - struct device *tps_dev = to_tps6586x_dev(dev); - unsigned long seconds; - unsigned long ticks; - unsigned long rtc_current_time; - unsigned long long rticks = 0; - u8 buff[3]; - u8 rbuff[6]; - int ret; - int i; - - rtc_tm_to_time(&alrm->time, &seconds); - - if (alrm->enabled && (seconds < rtc->epoch_start)) { - dev_err(dev, "can't set alarm to requested time\n"); - return -EINVAL; - } - - ret = tps6586x_rtc_alarm_irq_enable(dev, alrm->enabled); - if (ret < 0) { - dev_err(dev, "can't set alarm irq, err %d\n", ret); - return ret; - } - - seconds -= rtc->epoch_start; - ret = tps6586x_reads(tps_dev, RTC_COUNT4_DUMMYREAD, - sizeof(rbuff), rbuff); - if (ret < 0) { - dev_err(dev, "read counter failed with err %d\n", ret); - return ret; - } - - for (i = 1; i < sizeof(rbuff); i++) { - rticks <<= 8; - rticks |= rbuff[i]; - } - - rtc_current_time = rticks >> 10; - if ((seconds - rtc_current_time) > ALM1_VALID_RANGE_IN_SEC) - seconds = rtc_current_time - 1; - - ticks = (unsigned long long)seconds << 10; - buff[0] = (ticks >> 16) & 0xff; - buff[1] = (ticks >> 8) & 0xff; - buff[2] = ticks & 0xff; - - ret = tps6586x_writes(tps_dev, RTC_ALARM1_HI, sizeof(buff), buff); - if (ret) - dev_err(dev, "programming alarm failed with err %d\n", ret); - - return ret; -} - -static int tps6586x_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) -{ - struct tps6586x_rtc *rtc = dev_get_drvdata(dev); - struct device *tps_dev = to_tps6586x_dev(dev); - unsigned long ticks; - unsigned long seconds; - u8 buff[3]; - int ret; - - ret = tps6586x_reads(tps_dev, RTC_ALARM1_HI, sizeof(buff), buff); - if (ret) { - dev_err(dev, "read RTC_ALARM1_HI failed with err %d\n", ret); - return ret; - } - - ticks = (buff[0] << 16) | (buff[1] << 8) | buff[2]; - seconds = ticks >> 10; - seconds += rtc->epoch_start; - - rtc_time_to_tm(seconds, &alrm->time); - return 0; -} - -static const struct rtc_class_ops tps6586x_rtc_ops = { - .read_time = tps6586x_rtc_read_time, - .set_time = tps6586x_rtc_set_time, - .set_alarm = tps6586x_rtc_set_alarm, - .read_alarm = tps6586x_rtc_read_alarm, - .alarm_irq_enable = tps6586x_rtc_alarm_irq_enable, -}; - -static irqreturn_t tps6586x_rtc_irq(int irq, void *data) -{ - struct tps6586x_rtc *rtc = data; - - rtc_update_irq(rtc->rtc, 1, RTC_IRQF | RTC_AF); - return IRQ_HANDLED; -} - -static int tps6586x_rtc_probe(struct platform_device *pdev) -{ - struct device *tps_dev = to_tps6586x_dev(&pdev->dev); - struct tps6586x_rtc *rtc; - int ret; - - rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); - if (!rtc) - return -ENOMEM; - - rtc->dev = &pdev->dev; - rtc->irq = platform_get_irq(pdev, 0); - - /* Set epoch start as 00:00:00:01:01:2009 */ - rtc->epoch_start = mktime(2009, 1, 1, 0, 0, 0); - - /* 1 kHz tick mode, enable tick counting */ - ret = tps6586x_update(tps_dev, RTC_CTRL, - RTC_ENABLE | OSC_SRC_SEL | - ((TPS6586X_RTC_CL_SEL_1_5PF << CL_SEL_POS) & CL_SEL_MASK), - RTC_ENABLE | OSC_SRC_SEL | PRE_BYPASS | CL_SEL_MASK); - if (ret < 0) { - dev_err(&pdev->dev, "unable to start counter\n"); - return ret; - } - - platform_set_drvdata(pdev, rtc); - rtc->rtc = rtc_device_register(dev_name(&pdev->dev), &pdev->dev, - &tps6586x_rtc_ops, THIS_MODULE); - if (IS_ERR(rtc->rtc)) { - ret = PTR_ERR(rtc->rtc); - dev_err(&pdev->dev, "RTC device register: ret %d\n", ret); - goto fail_rtc_register; - } - - ret = request_threaded_irq(rtc->irq, NULL, tps6586x_rtc_irq, - IRQF_ONESHOT | IRQF_EARLY_RESUME, - dev_name(&pdev->dev), rtc); - if (ret < 0) { - dev_err(&pdev->dev, "request IRQ(%d) failed with ret %d\n", - rtc->irq, ret); - goto fail_req_irq; - } - disable_irq(rtc->irq); - device_set_wakeup_capable(&pdev->dev, 1); - return 0; - -fail_req_irq: - rtc_device_unregister(rtc->rtc); - -fail_rtc_register: - tps6586x_update(tps_dev, RTC_CTRL, 0, - RTC_ENABLE | OSC_SRC_SEL | PRE_BYPASS | CL_SEL_MASK); - return ret; -}; - -static int tps6586x_rtc_remove(struct platform_device *pdev) -{ - struct tps6586x_rtc *rtc = platform_get_drvdata(pdev); - struct device *tps_dev = to_tps6586x_dev(&pdev->dev); - - tps6586x_update(tps_dev, RTC_CTRL, 0, - RTC_ENABLE | OSC_SRC_SEL | PRE_BYPASS | CL_SEL_MASK); - rtc_device_unregister(rtc->rtc); - free_irq(rtc->irq, rtc); - return 0; -} - -#ifdef CONFIG_PM_SLEEP -static int tps6586x_rtc_suspend(struct device *dev) -{ - struct tps6586x_rtc *rtc = dev_get_drvdata(dev); - - if (device_may_wakeup(dev)) - enable_irq_wake(rtc->irq); - return 0; -} - -static int tps6586x_rtc_resume(struct device *dev) -{ - struct tps6586x_rtc *rtc = dev_get_drvdata(dev); - - if (device_may_wakeup(dev)) - disable_irq_wake(rtc->irq); - return 0; -} -#endif - -static const struct dev_pm_ops tps6586x_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(tps6586x_rtc_suspend, tps6586x_rtc_resume) -}; - -static struct platform_driver tps6586x_rtc_driver = { - .driver = { - .name = "tps6586x-rtc", - .owner = THIS_MODULE, - .pm = &tps6586x_pm_ops, - }, - .probe = tps6586x_rtc_probe, - .remove = tps6586x_rtc_remove, -}; -module_platform_driver(tps6586x_rtc_driver); - -MODULE_ALIAS("platform:rtc-tps6586x"); -MODULE_DESCRIPTION("TI TPS6586x RTC driver"); -MODULE_AUTHOR("Laxman dewangan "); -MODULE_LICENSE("GPL v2"); diff --git a/trunk/drivers/rtc/rtc-vt8500.c b/trunk/drivers/rtc/rtc-vt8500.c index 00c930f4b6f3..fd1418750ac8 100644 --- a/trunk/drivers/rtc/rtc-vt8500.c +++ b/trunk/drivers/rtc/rtc-vt8500.c @@ -70,7 +70,7 @@ | ALARM_SEC_BIT) #define VT8500_RTC_CR_ENABLE (1 << 0) /* Enable RTC */ -#define VT8500_RTC_CR_12H (1 << 1) /* 12h time format */ +#define VT8500_RTC_CR_24H (1 << 1) /* 24h time format */ #define VT8500_RTC_CR_SM_ENABLE (1 << 2) /* Enable periodic irqs */ #define VT8500_RTC_CR_SM_SEC (1 << 3) /* 0: 1Hz/60, 1: 1Hz */ #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) tm->tm_min = bcd2bin((time & TIME_MIN_MASK) >> TIME_MIN_S); tm->tm_hour = bcd2bin((time & TIME_HOUR_MASK) >> TIME_HOUR_S); tm->tm_mday = bcd2bin(date & DATE_DAY_MASK); - tm->tm_mon = bcd2bin((date & DATE_MONTH_MASK) >> DATE_MONTH_S) - 1; + tm->tm_mon = bcd2bin((date & DATE_MONTH_MASK) >> DATE_MONTH_S); tm->tm_year = bcd2bin((date & DATE_YEAR_MASK) >> DATE_YEAR_S) + ((date >> DATE_CENTURY_S) & 1 ? 200 : 100); tm->tm_wday = (time & TIME_DOW_MASK) >> TIME_DOW_S; @@ -138,9 +138,8 @@ static int vt8500_rtc_set_time(struct device *dev, struct rtc_time *tm) } writel((bin2bcd(tm->tm_year - 100) << DATE_YEAR_S) - | (bin2bcd(tm->tm_mon + 1) << DATE_MONTH_S) - | (bin2bcd(tm->tm_mday)) - | ((tm->tm_year >= 200) << DATE_CENTURY_S), + | (bin2bcd(tm->tm_mon) << DATE_MONTH_S) + | (bin2bcd(tm->tm_mday)), vt8500_rtc->regbase + VT8500_RTC_DS); writel((bin2bcd(tm->tm_wday) << TIME_DOW_S) | (bin2bcd(tm->tm_hour) << TIME_HOUR_S) @@ -248,7 +247,7 @@ static int vt8500_rtc_probe(struct platform_device *pdev) } /* Enable RTC and set it to 24-hour mode */ - writel(VT8500_RTC_CR_ENABLE, + writel(VT8500_RTC_CR_ENABLE | VT8500_RTC_CR_24H, vt8500_rtc->regbase + VT8500_RTC_CR); vt8500_rtc->rtc = rtc_device_register("vt8500-rtc", &pdev->dev, diff --git a/trunk/drivers/s390/block/dasd_diag.c b/trunk/drivers/s390/block/dasd_diag.c index 704488d0f819..9bd5da36f99e 100644 --- a/trunk/drivers/s390/block/dasd_diag.c +++ b/trunk/drivers/s390/block/dasd_diag.c @@ -248,7 +248,7 @@ static void dasd_ext_handler(struct ext_code ext_code, default: return; } - inc_irq_stat(IRQEXT_DSD); + kstat_cpu(smp_processor_id()).irqs[EXTINT_DSD]++; if (!ip) { /* no intparm: unsolicited interrupt */ DBF_EVENT(DBF_NOTICE, "%s", "caught unsolicited " "interrupt"); diff --git a/trunk/drivers/s390/block/dasd_eckd.c b/trunk/drivers/s390/block/dasd_eckd.c index e37bc1620d14..806fe912d6e7 100644 --- a/trunk/drivers/s390/block/dasd_eckd.c +++ b/trunk/drivers/s390/block/dasd_eckd.c @@ -4274,7 +4274,7 @@ static struct ccw_driver dasd_eckd_driver = { .thaw = dasd_generic_restore_device, .restore = dasd_generic_restore_device, .uc_handler = dasd_generic_uc_handler, - .int_class = IRQIO_DAS, + .int_class = IOINT_DAS, }; /* diff --git a/trunk/drivers/s390/block/dasd_fba.c b/trunk/drivers/s390/block/dasd_fba.c index 414698584344..eb748507c7fa 100644 --- a/trunk/drivers/s390/block/dasd_fba.c +++ b/trunk/drivers/s390/block/dasd_fba.c @@ -78,7 +78,7 @@ static struct ccw_driver dasd_fba_driver = { .freeze = dasd_generic_pm_freeze, .thaw = dasd_generic_restore_device, .restore = dasd_generic_restore_device, - .int_class = IRQIO_DAS, + .int_class = IOINT_DAS, }; static void diff --git a/trunk/drivers/s390/char/con3215.c b/trunk/drivers/s390/char/con3215.c index 33b7141a182f..40084501c31b 100644 --- a/trunk/drivers/s390/char/con3215.c +++ b/trunk/drivers/s390/char/con3215.c @@ -44,7 +44,6 @@ #define RAW3215_NR_CCWS 3 #define RAW3215_TIMEOUT HZ/10 /* time for delayed output */ -#define RAW3215_FIXED 1 /* 3215 console device is not be freed */ #define RAW3215_WORKING 4 /* set if a request is being worked on */ #define RAW3215_THROTTLED 8 /* set if reading is disabled */ #define RAW3215_STOPPED 16 /* set if writing is disabled */ @@ -631,8 +630,7 @@ static void raw3215_shutdown(struct raw3215_info *raw) DECLARE_WAITQUEUE(wait, current); unsigned long flags; - if (!(raw->port.flags & ASYNC_INITIALIZED) || - (raw->flags & RAW3215_FIXED)) + if (!(raw->port.flags & ASYNC_INITIALIZED)) return; /* Wait for outstanding requests, then free irq */ spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); @@ -807,7 +805,7 @@ static struct ccw_driver raw3215_ccw_driver = { .freeze = &raw3215_pm_stop, .thaw = &raw3215_pm_start, .restore = &raw3215_pm_start, - .int_class = IRQIO_C15, + .int_class = IOINT_C15, }; #ifdef CONFIG_TN3215_CONSOLE @@ -929,8 +927,6 @@ static int __init con3215_init(void) dev_set_drvdata(&cdev->dev, raw); cdev->handler = raw3215_irq; - raw->flags |= RAW3215_FIXED; - /* Request the console irq */ if (raw3215_startup(raw) != 0) { raw3215_free_info(raw); diff --git a/trunk/drivers/s390/char/raw3270.c b/trunk/drivers/s390/char/raw3270.c index 9a6c140c5f07..f3b8bb84faf2 100644 --- a/trunk/drivers/s390/char/raw3270.c +++ b/trunk/drivers/s390/char/raw3270.c @@ -1396,7 +1396,7 @@ static struct ccw_driver raw3270_ccw_driver = { .freeze = &raw3270_pm_stop, .thaw = &raw3270_pm_start, .restore = &raw3270_pm_start, - .int_class = IRQIO_C70, + .int_class = IOINT_C70, }; static int diff --git a/trunk/drivers/s390/char/sclp.c b/trunk/drivers/s390/char/sclp.c index 12c16a65dd25..4fa21f7e2308 100644 --- a/trunk/drivers/s390/char/sclp.c +++ b/trunk/drivers/s390/char/sclp.c @@ -400,7 +400,7 @@ static void sclp_interrupt_handler(struct ext_code ext_code, u32 finished_sccb; u32 evbuf_pending; - inc_irq_stat(IRQEXT_SCP); + kstat_cpu(smp_processor_id()).irqs[EXTINT_SCP]++; spin_lock(&sclp_lock); finished_sccb = param32 & 0xfffffff8; evbuf_pending = param32 & 0x3; @@ -813,7 +813,7 @@ static void sclp_check_handler(struct ext_code ext_code, { u32 finished_sccb; - inc_irq_stat(IRQEXT_SCP); + kstat_cpu(smp_processor_id()).irqs[EXTINT_SCP]++; finished_sccb = param32 & 0xfffffff8; /* Is this the interrupt we are waiting for? */ if (finished_sccb == 0) diff --git a/trunk/drivers/s390/char/tape_34xx.c b/trunk/drivers/s390/char/tape_34xx.c index 9aa79702b370..6ae929c024ae 100644 --- a/trunk/drivers/s390/char/tape_34xx.c +++ b/trunk/drivers/s390/char/tape_34xx.c @@ -1193,7 +1193,7 @@ static struct ccw_driver tape_34xx_driver = { .set_online = tape_34xx_online, .set_offline = tape_generic_offline, .freeze = tape_generic_pm_suspend, - .int_class = IRQIO_TAP, + .int_class = IOINT_TAP, }; static int diff --git a/trunk/drivers/s390/char/tape_3590.c b/trunk/drivers/s390/char/tape_3590.c index 327cb19ad0b0..1b0eb49f739c 100644 --- a/trunk/drivers/s390/char/tape_3590.c +++ b/trunk/drivers/s390/char/tape_3590.c @@ -1656,7 +1656,7 @@ static struct ccw_driver tape_3590_driver = { .set_offline = tape_generic_offline, .set_online = tape_3590_online, .freeze = tape_generic_pm_suspend, - .int_class = IRQIO_TAP, + .int_class = IOINT_TAP, }; /* diff --git a/trunk/drivers/s390/char/vmur.c b/trunk/drivers/s390/char/vmur.c index 483f72ba030d..73bef0bd394c 100644 --- a/trunk/drivers/s390/char/vmur.c +++ b/trunk/drivers/s390/char/vmur.c @@ -74,7 +74,7 @@ static struct ccw_driver ur_driver = { .set_online = ur_set_online, .set_offline = ur_set_offline, .freeze = ur_pm_suspend, - .int_class = IRQIO_VMR, + .int_class = IOINT_VMR, }; static DEFINE_MUTEX(vmur_mutex); diff --git a/trunk/drivers/s390/cio/chsc.c b/trunk/drivers/s390/cio/chsc.c index 10729bbceced..68e80e2734a4 100644 --- a/trunk/drivers/s390/cio/chsc.c +++ b/trunk/drivers/s390/cio/chsc.c @@ -283,7 +283,7 @@ struct chsc_sei_nt2_area { u8 ccdf[PAGE_SIZE - 24 - 56]; /* content-code dependent field */ } __packed; -#define CHSC_SEI_NT0 (1ULL << 63) +#define CHSC_SEI_NT0 0ULL #define CHSC_SEI_NT2 (1ULL << 61) struct chsc_sei { @@ -291,8 +291,7 @@ struct chsc_sei { u32 reserved1; u64 ntsm; /* notification type mask */ struct chsc_header response; - u32 :24; - u8 nt; + u32 reserved2; union { struct chsc_sei_nt0_area nt0_area; struct chsc_sei_nt2_area nt2_area; @@ -497,17 +496,17 @@ static int __chsc_process_crw(struct chsc_sei *sei, u64 ntsm) css_schedule_eval_all(); } - switch (sei->nt) { - case 0: + switch (sei->ntsm) { + case CHSC_SEI_NT0: chsc_process_sei_nt0(&sei->u.nt0_area); - break; - case 2: + return 1; + case CHSC_SEI_NT2: chsc_process_sei_nt2(&sei->u.nt2_area); - break; + return 1; default: - CIO_CRW_EVENT(2, "chsc: unhandled nt=%d\n", - sei->nt); - break; + CIO_CRW_EVENT(2, "chsc: unhandled nt (nt=%08Lx)\n", + sei->ntsm); + return 0; } } else { CIO_CRW_EVENT(2, "chsc: sei failed (rc=%04x)\n", @@ -538,7 +537,15 @@ static void chsc_process_crw(struct crw *crw0, struct crw *crw1, int overflow) sei = sei_page; CIO_TRACE_EVENT(2, "prcss"); - __chsc_process_crw(sei, CHSC_SEI_NT0 | CHSC_SEI_NT2); + + /* + * The ntsm does not allow to select NT0 and NT2 together. We need to + * first check for NT2, than additionally for NT0... + */ +#ifdef CONFIG_PCI + if (!__chsc_process_crw(sei, CHSC_SEI_NT2)) +#endif + __chsc_process_crw(sei, CHSC_SEI_NT0); } void chsc_chp_online(struct chp_id chpid) diff --git a/trunk/drivers/s390/cio/chsc_sch.c b/trunk/drivers/s390/cio/chsc_sch.c index facdf809113f..8f9a1a384496 100644 --- a/trunk/drivers/s390/cio/chsc_sch.c +++ b/trunk/drivers/s390/cio/chsc_sch.c @@ -58,7 +58,7 @@ static void chsc_subchannel_irq(struct subchannel *sch) CHSC_LOG(4, "irb"); CHSC_LOG_HEX(4, irb, sizeof(*irb)); - inc_irq_stat(IRQIO_CSC); + kstat_cpu(smp_processor_id()).irqs[IOINT_CSC]++; /* Copy irb to provided request and set done. */ if (!request) { diff --git a/trunk/drivers/s390/cio/cio.c b/trunk/drivers/s390/cio/cio.c index c8faf6230b0f..8e927b9f285f 100644 --- a/trunk/drivers/s390/cio/cio.c +++ b/trunk/drivers/s390/cio/cio.c @@ -611,7 +611,7 @@ void __irq_entry do_IRQ(struct pt_regs *regs) tpi_info = (struct tpi_info *)&S390_lowcore.subchannel_id; irb = (struct irb *)&S390_lowcore.irb; do { - kstat_incr_irqs_this_cpu(IO_INTERRUPT, NULL); + kstat_cpu(smp_processor_id()).irqs[IO_INTERRUPT]++; if (tpi_info->adapter_IO) { do_adapter_IO(tpi_info->isc); continue; @@ -619,7 +619,7 @@ void __irq_entry do_IRQ(struct pt_regs *regs) sch = (struct subchannel *)(unsigned long)tpi_info->intparm; if (!sch) { /* Clear pending interrupt condition. */ - inc_irq_stat(IRQIO_CIO); + kstat_cpu(smp_processor_id()).irqs[IOINT_CIO]++; tsch(tpi_info->schid, irb); continue; } @@ -633,9 +633,9 @@ void __irq_entry do_IRQ(struct pt_regs *regs) if (sch->driver && sch->driver->irq) sch->driver->irq(sch); else - inc_irq_stat(IRQIO_CIO); + kstat_cpu(smp_processor_id()).irqs[IOINT_CIO]++; } else - inc_irq_stat(IRQIO_CIO); + kstat_cpu(smp_processor_id()).irqs[IOINT_CIO]++; spin_unlock(sch->lock); /* * Are more interrupts pending? @@ -678,7 +678,7 @@ static void cio_tsch(struct subchannel *sch) if (sch->driver && sch->driver->irq) sch->driver->irq(sch); else - inc_irq_stat(IRQIO_CIO); + kstat_cpu(smp_processor_id()).irqs[IOINT_CIO]++; if (!irq_context) { irq_exit(); _local_bh_enable(); diff --git a/trunk/drivers/s390/cio/device.c b/trunk/drivers/s390/cio/device.c index 7cd5c6812ac7..6995cff44636 100644 --- a/trunk/drivers/s390/cio/device.c +++ b/trunk/drivers/s390/cio/device.c @@ -758,7 +758,7 @@ static int io_subchannel_initialize_dev(struct subchannel *sch, struct ccw_device *cdev) { cdev->private->cdev = cdev; - cdev->private->int_class = IRQIO_CIO; + cdev->private->int_class = IOINT_CIO; atomic_set(&cdev->private->onoff, 0); cdev->dev.parent = &sch->dev; cdev->dev.release = ccw_device_release; @@ -1023,7 +1023,7 @@ static void io_subchannel_irq(struct subchannel *sch) if (cdev) dev_fsm_event(cdev, DEV_EVENT_INTERRUPT); else - inc_irq_stat(IRQIO_CIO); + kstat_cpu(smp_processor_id()).irqs[IOINT_CIO]++; } void io_subchannel_init_config(struct subchannel *sch) @@ -1634,7 +1634,7 @@ ccw_device_probe_console(void) memset(&console_private, 0, sizeof(struct ccw_device_private)); console_cdev.private = &console_private; console_private.cdev = &console_cdev; - console_private.int_class = IRQIO_CIO; + console_private.int_class = IOINT_CIO; ret = ccw_device_console_enable(&console_cdev, sch); if (ret) { cio_release_console(); @@ -1715,13 +1715,13 @@ ccw_device_probe (struct device *dev) if (cdrv->int_class != 0) cdev->private->int_class = cdrv->int_class; else - cdev->private->int_class = IRQIO_CIO; + cdev->private->int_class = IOINT_CIO; ret = cdrv->probe ? cdrv->probe(cdev) : -ENODEV; if (ret) { cdev->drv = NULL; - cdev->private->int_class = IRQIO_CIO; + cdev->private->int_class = IOINT_CIO; return ret; } @@ -1755,7 +1755,7 @@ ccw_device_remove (struct device *dev) } ccw_device_set_timeout(cdev, 0); cdev->drv = NULL; - cdev->private->int_class = IRQIO_CIO; + cdev->private->int_class = IOINT_CIO; return 0; } diff --git a/trunk/drivers/s390/cio/device.h b/trunk/drivers/s390/cio/device.h index 7d4ecb65db00..2e575cff9845 100644 --- a/trunk/drivers/s390/cio/device.h +++ b/trunk/drivers/s390/cio/device.h @@ -61,10 +61,11 @@ dev_fsm_event(struct ccw_device *cdev, enum dev_event dev_event) if (dev_event == DEV_EVENT_INTERRUPT) { if (state == DEV_STATE_ONLINE) - inc_irq_stat(cdev->private->int_class); + kstat_cpu(smp_processor_id()). + irqs[cdev->private->int_class]++; else if (state != DEV_STATE_CMFCHANGE && state != DEV_STATE_CMFUPDATE) - inc_irq_stat(IRQIO_CIO); + kstat_cpu(smp_processor_id()).irqs[IOINT_CIO]++; } dev_jumptable[state][dev_event](cdev, dev_event); } diff --git a/trunk/drivers/s390/cio/eadm_sch.c b/trunk/drivers/s390/cio/eadm_sch.c index d9eddcba7e88..6c9673400464 100644 --- a/trunk/drivers/s390/cio/eadm_sch.c +++ b/trunk/drivers/s390/cio/eadm_sch.c @@ -139,7 +139,7 @@ static void eadm_subchannel_irq(struct subchannel *sch) EADM_LOG(6, "irq"); EADM_LOG_HEX(6, irb, sizeof(*irb)); - inc_irq_stat(IRQIO_ADM); + kstat_cpu(smp_processor_id()).irqs[IOINT_ADM]++; if ((scsw->stctl & (SCSW_STCTL_ALERT_STATUS | SCSW_STCTL_STATUS_PEND)) && scsw->eswf == 1 && irb->esw.eadm.erw.r) diff --git a/trunk/drivers/s390/cio/qdio_thinint.c b/trunk/drivers/s390/cio/qdio_thinint.c index bde5255200dc..bdb394b066fc 100644 --- a/trunk/drivers/s390/cio/qdio_thinint.c +++ b/trunk/drivers/s390/cio/qdio_thinint.c @@ -182,7 +182,7 @@ static void tiqdio_thinint_handler(void *alsi, void *data) struct qdio_q *q; last_ai_time = S390_lowcore.int_clock; - inc_irq_stat(IRQIO_QAI); + kstat_cpu(smp_processor_id()).irqs[IOINT_QAI]++; /* protect tiq_list entries, only changed in activate or shutdown */ rcu_read_lock(); diff --git a/trunk/drivers/s390/crypto/ap_bus.c b/trunk/drivers/s390/crypto/ap_bus.c index b8b340ac5332..7b865a7300e6 100644 --- a/trunk/drivers/s390/crypto/ap_bus.c +++ b/trunk/drivers/s390/crypto/ap_bus.c @@ -1272,7 +1272,7 @@ static int ap_probe_device_type(struct ap_device *ap_dev) static void ap_interrupt_handler(void *unused1, void *unused2) { - inc_irq_stat(IRQIO_APB); + kstat_cpu(smp_processor_id()).irqs[IOINT_APB]++; tasklet_schedule(&ap_tasklet); } diff --git a/trunk/drivers/s390/kvm/kvm_virtio.c b/trunk/drivers/s390/kvm/kvm_virtio.c index 8491111aec12..7dabef624da3 100644 --- a/trunk/drivers/s390/kvm/kvm_virtio.c +++ b/trunk/drivers/s390/kvm/kvm_virtio.c @@ -392,7 +392,7 @@ static void kvm_extint_handler(struct ext_code ext_code, if ((ext_code.subcode & 0xff00) != VIRTIO_SUBCODE_64) return; - inc_irq_stat(IRQEXT_VRT); + kstat_cpu(smp_processor_id()).irqs[EXTINT_VRT]++; /* The LSB might be overloaded, we have to mask it */ vq = (struct virtqueue *)(param64 & ~1UL); diff --git a/trunk/drivers/s390/net/claw.c b/trunk/drivers/s390/net/claw.c index 83bc9c5fa0c1..5c70a6599578 100644 --- a/trunk/drivers/s390/net/claw.c +++ b/trunk/drivers/s390/net/claw.c @@ -282,7 +282,7 @@ static struct ccw_driver claw_ccw_driver = { .ids = claw_ids, .probe = ccwgroup_probe_ccwdev, .remove = ccwgroup_remove_ccwdev, - .int_class = IRQIO_CLW, + .int_class = IOINT_CLW, }; static ssize_t claw_driver_group_store(struct device_driver *ddrv, diff --git a/trunk/drivers/s390/net/ctcm_main.c b/trunk/drivers/s390/net/ctcm_main.c index 676f12049a36..817b68925ddd 100644 --- a/trunk/drivers/s390/net/ctcm_main.c +++ b/trunk/drivers/s390/net/ctcm_main.c @@ -1755,7 +1755,7 @@ static struct ccw_driver ctcm_ccw_driver = { .ids = ctcm_ids, .probe = ccwgroup_probe_ccwdev, .remove = ccwgroup_remove_ccwdev, - .int_class = IRQIO_CTC, + .int_class = IOINT_CTC, }; static struct ccwgroup_driver ctcm_group_driver = { diff --git a/trunk/drivers/s390/net/lcs.c b/trunk/drivers/s390/net/lcs.c index c645dc9e98af..2ca0f1dd7a00 100644 --- a/trunk/drivers/s390/net/lcs.c +++ b/trunk/drivers/s390/net/lcs.c @@ -2384,7 +2384,7 @@ static struct ccw_driver lcs_ccw_driver = { .ids = lcs_ids, .probe = ccwgroup_probe_ccwdev, .remove = ccwgroup_remove_ccwdev, - .int_class = IRQIO_LCS, + .int_class = IOINT_LCS, }; /** diff --git a/trunk/drivers/sh/clk/cpg.c b/trunk/drivers/sh/clk/cpg.c index 1ebe67cd1833..5aedcdf4ac5c 100644 --- a/trunk/drivers/sh/clk/cpg.c +++ b/trunk/drivers/sh/clk/cpg.c @@ -126,12 +126,6 @@ static int sh_clk_div_set_rate(struct clk *clk, unsigned long rate) static int sh_clk_div_enable(struct clk *clk) { - if (clk->div_mask == SH_CLK_DIV6_MSK) { - int ret = sh_clk_div_set_rate(clk, clk->rate); - if (ret < 0) - return ret; - } - sh_clk_write(sh_clk_read(clk) & ~CPG_CKSTP_BIT, clk); return 0; } diff --git a/trunk/drivers/ssb/Kconfig b/trunk/drivers/ssb/Kconfig index 5d6f2ec1c705..ff3c8a21f10d 100644 --- a/trunk/drivers/ssb/Kconfig +++ b/trunk/drivers/ssb/Kconfig @@ -162,7 +162,8 @@ config SSB_DRIVER_GIGE config SSB_DRIVER_GPIO bool "SSB GPIO driver" - depends on SSB && GPIOLIB + depends on SSB + select GPIOLIB help Driver to provide access to the GPIO pins on the bus. diff --git a/trunk/drivers/staging/comedi/Kconfig b/trunk/drivers/staging/comedi/Kconfig index 36eec320569c..7de2a10213bd 100644 --- a/trunk/drivers/staging/comedi/Kconfig +++ b/trunk/drivers/staging/comedi/Kconfig @@ -444,7 +444,6 @@ config COMEDI_ADQ12B config COMEDI_NI_AT_A2150 tristate "NI AT-A2150 ISA card support" - select COMEDI_FC depends on VIRT_TO_BUS ---help--- Enable support for National Instruments AT-A2150 cards diff --git a/trunk/drivers/staging/comedi/comedi_fops.c b/trunk/drivers/staging/comedi/comedi_fops.c index 9b038e4a7e71..b7bba1790a20 100644 --- a/trunk/drivers/staging/comedi/comedi_fops.c +++ b/trunk/drivers/staging/comedi/comedi_fops.c @@ -1549,9 +1549,6 @@ static long comedi_unlocked_ioctl(struct file *file, unsigned int cmd, if (cmd == COMEDI_DEVCONFIG) { rc = do_devconfig_ioctl(dev, (struct comedi_devconfig __user *)arg); - if (rc == 0) - /* Evade comedi_auto_unconfig(). */ - dev_file_info->hardware_device = NULL; goto done; } diff --git a/trunk/drivers/staging/comedi/drivers/comedi_test.c b/trunk/drivers/staging/comedi/drivers/comedi_test.c index 01de996239f1..fb3d09323ba1 100644 --- a/trunk/drivers/staging/comedi/drivers/comedi_test.c +++ b/trunk/drivers/staging/comedi/drivers/comedi_test.c @@ -345,7 +345,7 @@ static int waveform_ai_cancel(struct comedi_device *dev, struct waveform_private *devpriv = dev->private; devpriv->timer_running = 0; - del_timer_sync(&devpriv->timer); + del_timer(&devpriv->timer); return 0; } diff --git a/trunk/drivers/staging/comedi/drivers/ni_pcimio.c b/trunk/drivers/staging/comedi/drivers/ni_pcimio.c index fd1662b4175d..aaac0b2cc9eb 100644 --- a/trunk/drivers/staging/comedi/drivers/ni_pcimio.c +++ b/trunk/drivers/staging/comedi/drivers/ni_pcimio.c @@ -963,7 +963,7 @@ static const struct ni_board_struct ni_boards[] = { .ao_range_table = &range_ni_M_625x_ao, .reg_type = ni_reg_625x, .ao_unipolar = 0, - .ao_speed = 350, + .ao_speed = 357, .num_p0_dio_channels = 8, .caldac = {caldac_none}, .has_8255 = 0, @@ -982,7 +982,7 @@ static const struct ni_board_struct ni_boards[] = { .ao_range_table = &range_ni_M_625x_ao, .reg_type = ni_reg_625x, .ao_unipolar = 0, - .ao_speed = 350, + .ao_speed = 357, .num_p0_dio_channels = 8, .caldac = {caldac_none}, .has_8255 = 0, @@ -1001,7 +1001,7 @@ static const struct ni_board_struct ni_boards[] = { .ao_range_table = &range_ni_M_625x_ao, .reg_type = ni_reg_625x, .ao_unipolar = 0, - .ao_speed = 350, + .ao_speed = 357, .num_p0_dio_channels = 8, .caldac = {caldac_none}, .has_8255 = 0, @@ -1037,7 +1037,7 @@ static const struct ni_board_struct ni_boards[] = { .ao_range_table = &range_ni_M_625x_ao, .reg_type = ni_reg_625x, .ao_unipolar = 0, - .ao_speed = 350, + .ao_speed = 357, .num_p0_dio_channels = 32, .caldac = {caldac_none}, .has_8255 = 0, @@ -1056,7 +1056,7 @@ static const struct ni_board_struct ni_boards[] = { .ao_range_table = &range_ni_M_625x_ao, .reg_type = ni_reg_625x, .ao_unipolar = 0, - .ao_speed = 350, + .ao_speed = 357, .num_p0_dio_channels = 32, .caldac = {caldac_none}, .has_8255 = 0, @@ -1092,7 +1092,7 @@ static const struct ni_board_struct ni_boards[] = { .ao_range_table = &range_ni_M_628x_ao, .reg_type = ni_reg_628x, .ao_unipolar = 1, - .ao_speed = 350, + .ao_speed = 357, .num_p0_dio_channels = 8, .caldac = {caldac_none}, .has_8255 = 0, @@ -1111,7 +1111,7 @@ static const struct ni_board_struct ni_boards[] = { .ao_range_table = &range_ni_M_628x_ao, .reg_type = ni_reg_628x, .ao_unipolar = 1, - .ao_speed = 350, + .ao_speed = 357, .num_p0_dio_channels = 8, .caldac = {caldac_none}, .has_8255 = 0, @@ -1147,7 +1147,7 @@ static const struct ni_board_struct ni_boards[] = { .ao_range_table = &range_ni_M_628x_ao, .reg_type = ni_reg_628x, .ao_unipolar = 1, - .ao_speed = 350, + .ao_speed = 357, .num_p0_dio_channels = 32, .caldac = {caldac_none}, .has_8255 = 0, diff --git a/trunk/drivers/staging/fwserial/Kconfig b/trunk/drivers/staging/fwserial/Kconfig index b2f8331e4acf..580406cb1808 100644 --- a/trunk/drivers/staging/fwserial/Kconfig +++ b/trunk/drivers/staging/fwserial/Kconfig @@ -3,9 +3,7 @@ config FIREWIRE_SERIAL depends on FIREWIRE help This enables TTY over IEEE 1394, providing high-speed serial - connectivity to cabled peers. This driver implements a - ad-hoc transport protocol and is currently limited to - Linux-to-Linux communication. + connectivity to cabled peers. To compile this driver as a module, say M here: the module will be called firewire-serial. diff --git a/trunk/drivers/staging/fwserial/TODO b/trunk/drivers/staging/fwserial/TODO index 8dae8fb25223..726900548eae 100644 --- a/trunk/drivers/staging/fwserial/TODO +++ b/trunk/drivers/staging/fwserial/TODO @@ -1,5 +1,5 @@ -TODOs prior to this driver moving out of staging ------------------------------------------------- +TODOs +----- 1. Implement retries for RCODE_BUSY, RCODE_NO_ACK and RCODE_SEND_ERROR - I/O is handled asynchronously which presents some issues when error conditions occur. @@ -11,9 +11,17 @@ TODOs prior to this driver moving out of staging -- Issues with firewire stack -- 1. This driver uses the same unregistered vendor id that the firewire core does (0xd00d1e). Perhaps this could be exposed as a define in - firewire.h? + firewire-constants.h? +2. MAX_ASYNC_PAYLOAD needs to be publicly exposed by core/ohci + - otherwise how will this driver know the max size of address window to + open for one packet write? 3. Maybe device_max_receive() and link_speed_to_max_payload() should be taken up by the firewire core? +4. To avoid dropping rx data while still limiting the maximum buffering, + the size of the AR context must be known. How to expose this to drivers? +5. Explore if bigger AR context will reduce RCODE_BUSY responses + (or auto-grow to certain max size -- but this would require major surgery + as the current AR is contiguously mapped) -- Issues with TTY core -- 1. Hack for alternate device name scheme diff --git a/trunk/drivers/staging/fwserial/fwserial.c b/trunk/drivers/staging/fwserial/fwserial.c index d03a7f57e8d4..61ee29083b26 100644 --- a/trunk/drivers/staging/fwserial/fwserial.c +++ b/trunk/drivers/staging/fwserial/fwserial.c @@ -179,7 +179,7 @@ static void dump_profile(struct seq_file *m, struct stats *stats) /* Returns the max receive packet size for the given card */ static inline int device_max_receive(struct fw_device *fw_device) { - return 1 << (clamp_t(int, fw_device->max_rec, 8U, 11U) + 1); + return 1 << (clamp_t(int, fw_device->max_rec, 8U, 13U) + 1); } static void fwtty_log_tx_error(struct fwtty_port *port, int rcode) diff --git a/trunk/drivers/staging/fwserial/fwserial.h b/trunk/drivers/staging/fwserial/fwserial.h index caa1c1ea82d5..8b572edf9563 100644 --- a/trunk/drivers/staging/fwserial/fwserial.h +++ b/trunk/drivers/staging/fwserial/fwserial.h @@ -374,10 +374,10 @@ static inline void fwtty_bind_console(struct fwtty_port *port, */ static inline int link_speed_to_max_payload(unsigned speed) { - static const int max_async[] = { 307, 614, 1229, 2458, }; - BUILD_BUG_ON(ARRAY_SIZE(max_async) - 1 != SCODE_800); + static const int max_async[] = { 307, 614, 1229, 2458, 4916, 9832, }; + BUILD_BUG_ON(ARRAY_SIZE(max_async) - 1 != SCODE_3200); - speed = clamp(speed, (unsigned) SCODE_100, (unsigned) SCODE_800); + speed = clamp(speed, (unsigned) SCODE_100, (unsigned) SCODE_3200); if (limit_bw) return max_async[speed]; else diff --git a/trunk/drivers/staging/iio/adc/mxs-lradc.c b/trunk/drivers/staging/iio/adc/mxs-lradc.c index c5ceb9d90ea8..fb31b457a56a 100644 --- a/trunk/drivers/staging/iio/adc/mxs-lradc.c +++ b/trunk/drivers/staging/iio/adc/mxs-lradc.c @@ -239,7 +239,7 @@ static irqreturn_t mxs_lradc_trigger_handler(int irq, void *p) struct mxs_lradc *lradc = iio_priv(iio); const uint32_t chan_value = LRADC_CH_ACCUMULATE | ((LRADC_DELAY_TIMER_LOOP - 1) << LRADC_CH_NUM_SAMPLES_OFFSET); - unsigned int i, j = 0; + int i, j = 0; for_each_set_bit(i, iio->active_scan_mask, iio->masklength) { lradc->buffer[j] = readl(lradc->base + LRADC_CH(j)); diff --git a/trunk/drivers/staging/iio/gyro/Kconfig b/trunk/drivers/staging/iio/gyro/Kconfig index 87979a0d03a9..ea295b25308c 100644 --- a/trunk/drivers/staging/iio/gyro/Kconfig +++ b/trunk/drivers/staging/iio/gyro/Kconfig @@ -27,8 +27,8 @@ config ADIS16130 config ADIS16260 tristate "Analog Devices ADIS16260 Digital Gyroscope Sensor SPI driver" depends on SPI - select IIO_ADIS_LIB - select IIO_ADIS_LIB_BUFFER if IIO_BUFFER + select IIO_TRIGGER if IIO_BUFFER + select IIO_SW_RING if IIO_BUFFER help Say yes here to build support for Analog Devices ADIS16260 ADIS16265 ADIS16250 ADIS16255 and ADIS16251 programmable digital gyroscope sensors. diff --git a/trunk/drivers/staging/iio/gyro/adis16080_core.c b/trunk/drivers/staging/iio/gyro/adis16080_core.c index 41d7350d030f..3525a68d6a75 100644 --- a/trunk/drivers/staging/iio/gyro/adis16080_core.c +++ b/trunk/drivers/staging/iio/gyro/adis16080_core.c @@ -69,7 +69,7 @@ static int adis16080_spi_read(struct iio_dev *indio_dev, ret = spi_read(st->us, st->buf, 2); if (ret == 0) - *val = sign_extend32(((st->buf[0] & 0xF) << 8) | st->buf[1], 11); + *val = ((st->buf[0] & 0xF) << 8) | st->buf[1]; mutex_unlock(&st->buf_lock); return ret; diff --git a/trunk/drivers/staging/imx-drm/imx-drm-core.c b/trunk/drivers/staging/imx-drm/imx-drm-core.c index cec19f1cf56c..ecf0f44bc70e 100644 --- a/trunk/drivers/staging/imx-drm/imx-drm-core.c +++ b/trunk/drivers/staging/imx-drm/imx-drm-core.c @@ -584,6 +584,7 @@ int imx_drm_add_encoder(struct drm_encoder *encoder, ret = imx_drm_encoder_register(imx_drm_encoder); if (ret) { + kfree(imx_drm_encoder); ret = -ENOMEM; goto err_register; } diff --git a/trunk/drivers/staging/imx-drm/ipu-v3/ipu-common.c b/trunk/drivers/staging/imx-drm/ipu-v3/ipu-common.c index f7059cddd7fd..677e665ca86d 100644 --- a/trunk/drivers/staging/imx-drm/ipu-v3/ipu-common.c +++ b/trunk/drivers/staging/imx-drm/ipu-v3/ipu-common.c @@ -1104,9 +1104,7 @@ static int ipu_probe(struct platform_device *pdev) if (ret) goto out_failed_irq; - ret = ipu_reset(ipu); - if (ret) - goto out_failed_reset; + ipu_reset(ipu); /* Set MCU_T to divide MCU access window into 2 */ ipu_cm_write(ipu, 0x00400000L | (IPU_MCU_T_DEFAULT << 18), @@ -1131,7 +1129,6 @@ static int ipu_probe(struct platform_device *pdev) ipu_submodules_exit(ipu); failed_submodules_init: ipu_irq_exit(ipu); -out_failed_reset: out_failed_irq: clk_disable_unprepare(ipu->clk); failed_clk_get: diff --git a/trunk/drivers/staging/imx-drm/ipuv3-crtc.c b/trunk/drivers/staging/imx-drm/ipuv3-crtc.c index 4b3a019409b5..1892006526b5 100644 --- a/trunk/drivers/staging/imx-drm/ipuv3-crtc.c +++ b/trunk/drivers/staging/imx-drm/ipuv3-crtc.c @@ -452,7 +452,7 @@ static int ipu_get_resources(struct ipu_crtc *ipu_crtc, int ret; ipu_crtc->ipu_ch = ipu_idmac_get(ipu, pdata->dma[0]); - if (IS_ERR(ipu_crtc->ipu_ch)) { + if (IS_ERR_OR_NULL(ipu_crtc->ipu_ch)) { ret = PTR_ERR(ipu_crtc->ipu_ch); goto err_out; } @@ -472,7 +472,7 @@ static int ipu_get_resources(struct ipu_crtc *ipu_crtc, if (pdata->dp >= 0) { ipu_crtc->dp = ipu_dp_get(ipu, pdata->dp); if (IS_ERR(ipu_crtc->dp)) { - ret = PTR_ERR(ipu_crtc->dp); + ret = PTR_ERR(ipu_crtc->ipu_ch); goto err_out; } } @@ -548,8 +548,6 @@ static int ipu_drm_probe(struct platform_device *pdev) ipu_crtc->dev = &pdev->dev; ret = ipu_crtc_init(ipu_crtc, pdata); - if (ret) - return ret; platform_set_drvdata(pdev, ipu_crtc); diff --git a/trunk/drivers/staging/omapdrm/Makefile b/trunk/drivers/staging/omapdrm/Makefile index d85e058f2845..1ca0e0016de4 100644 --- a/trunk/drivers/staging/omapdrm/Makefile +++ b/trunk/drivers/staging/omapdrm/Makefile @@ -5,7 +5,6 @@ ccflags-y := -Iinclude/drm -Werror omapdrm-y := omap_drv.o \ - omap_irq.o \ omap_debugfs.o \ omap_crtc.o \ omap_plane.o \ diff --git a/trunk/drivers/staging/omapdrm/TODO b/trunk/drivers/staging/omapdrm/TODO index abeeb00aaa12..938c7888ca31 100644 --- a/trunk/drivers/staging/omapdrm/TODO +++ b/trunk/drivers/staging/omapdrm/TODO @@ -17,6 +17,9 @@ TODO . Revisit GEM sync object infrastructure.. TTM has some framework for this already. Possibly this could be refactored out and made more common? There should be some way to do this with less wheel-reinvention. +. Review DSS vs KMS mismatches. The omap_dss_device is sort of part encoder, + part connector. Which results in a bit of duct tape to fwd calls from + encoder to connector. Possibly this could be done a bit better. . Solve PM sequencing on resume. DMM/TILER must be reloaded before any access is made from any component in the system. Which means on suspend CRTC's should be disabled, and on resume the LUT should be reprogrammed diff --git a/trunk/drivers/staging/omapdrm/omap_connector.c b/trunk/drivers/staging/omapdrm/omap_connector.c index 4cc9ee733c5f..91edb3f96972 100644 --- a/trunk/drivers/staging/omapdrm/omap_connector.c +++ b/trunk/drivers/staging/omapdrm/omap_connector.c @@ -31,10 +31,9 @@ struct omap_connector { struct drm_connector base; struct omap_dss_device *dssdev; - struct drm_encoder *encoder; }; -void copy_timings_omap_to_drm(struct drm_display_mode *mode, +static inline void copy_timings_omap_to_drm(struct drm_display_mode *mode, struct omap_video_timings *timings) { mode->clock = timings->pixel_clock; @@ -65,7 +64,7 @@ void copy_timings_omap_to_drm(struct drm_display_mode *mode, mode->flags |= DRM_MODE_FLAG_NVSYNC; } -void copy_timings_drm_to_omap(struct omap_video_timings *timings, +static inline void copy_timings_drm_to_omap(struct omap_video_timings *timings, struct drm_display_mode *mode) { timings->pixel_clock = mode->clock; @@ -97,7 +96,48 @@ void copy_timings_drm_to_omap(struct omap_video_timings *timings, timings->sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES; } -static enum drm_connector_status omap_connector_detect( +static void omap_connector_dpms(struct drm_connector *connector, int mode) +{ + struct omap_connector *omap_connector = to_omap_connector(connector); + struct omap_dss_device *dssdev = omap_connector->dssdev; + int old_dpms; + + DBG("%s: %d", dssdev->name, mode); + + old_dpms = connector->dpms; + + /* from off to on, do from crtc to connector */ + if (mode < old_dpms) + drm_helper_connector_dpms(connector, mode); + + if (mode == DRM_MODE_DPMS_ON) { + /* store resume info for suspended displays */ + switch (dssdev->state) { + case OMAP_DSS_DISPLAY_SUSPENDED: + dssdev->activate_after_resume = true; + break; + case OMAP_DSS_DISPLAY_DISABLED: { + int ret = dssdev->driver->enable(dssdev); + if (ret) { + DBG("%s: failed to enable: %d", + dssdev->name, ret); + dssdev->driver->disable(dssdev); + } + break; + } + default: + break; + } + } else { + /* TODO */ + } + + /* from on to off, do from connector to crtc */ + if (mode > old_dpms) + drm_helper_connector_dpms(connector, mode); +} + +enum drm_connector_status omap_connector_detect( struct drm_connector *connector, bool force) { struct omap_connector *omap_connector = to_omap_connector(connector); @@ -124,6 +164,8 @@ static void omap_connector_destroy(struct drm_connector *connector) struct omap_connector *omap_connector = to_omap_connector(connector); struct omap_dss_device *dssdev = omap_connector->dssdev; + dssdev->driver->disable(dssdev); + DBG("%s", omap_connector->dssdev->name); drm_sysfs_connector_remove(connector); drm_connector_cleanup(connector); @@ -219,12 +261,36 @@ static int omap_connector_mode_valid(struct drm_connector *connector, struct drm_encoder *omap_connector_attached_encoder( struct drm_connector *connector) { + int i; struct omap_connector *omap_connector = to_omap_connector(connector); - return omap_connector->encoder; + + for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) { + struct drm_mode_object *obj; + + if (connector->encoder_ids[i] == 0) + break; + + obj = drm_mode_object_find(connector->dev, + connector->encoder_ids[i], + DRM_MODE_OBJECT_ENCODER); + + if (obj) { + struct drm_encoder *encoder = obj_to_encoder(obj); + struct omap_overlay_manager *mgr = + omap_encoder_get_manager(encoder); + DBG("%s: found %s", omap_connector->dssdev->name, + mgr->name); + return encoder; + } + } + + DBG("%s: no encoder", omap_connector->dssdev->name); + + return NULL; } static const struct drm_connector_funcs omap_connector_funcs = { - .dpms = drm_helper_connector_dpms, + .dpms = omap_connector_dpms, .detect = omap_connector_detect, .fill_modes = drm_helper_probe_single_connector_modes, .destroy = omap_connector_destroy, @@ -236,6 +302,34 @@ static const struct drm_connector_helper_funcs omap_connector_helper_funcs = { .best_encoder = omap_connector_attached_encoder, }; +/* called from encoder when mode is set, to propagate settings to the dssdev */ +void omap_connector_mode_set(struct drm_connector *connector, + struct drm_display_mode *mode) +{ + struct drm_device *dev = connector->dev; + struct omap_connector *omap_connector = to_omap_connector(connector); + struct omap_dss_device *dssdev = omap_connector->dssdev; + struct omap_dss_driver *dssdrv = dssdev->driver; + struct omap_video_timings timings = {0}; + + copy_timings_drm_to_omap(&timings, mode); + + DBG("%s: set mode: %d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x", + omap_connector->dssdev->name, + mode->base.id, mode->name, mode->vrefresh, mode->clock, + mode->hdisplay, mode->hsync_start, + mode->hsync_end, mode->htotal, + mode->vdisplay, mode->vsync_start, + mode->vsync_end, mode->vtotal, mode->type, mode->flags); + + if (dssdrv->check_timings(dssdev, &timings)) { + dev_err(dev->dev, "could not set timings\n"); + return; + } + + dssdrv->set_timings(dssdev, &timings); +} + /* flush an area of the framebuffer (in case of manual update display that * is not automatically flushed) */ @@ -250,8 +344,7 @@ void omap_connector_flush(struct drm_connector *connector, /* initialize connector */ struct drm_connector *omap_connector_init(struct drm_device *dev, - int connector_type, struct omap_dss_device *dssdev, - struct drm_encoder *encoder) + int connector_type, struct omap_dss_device *dssdev) { struct drm_connector *connector = NULL; struct omap_connector *omap_connector; @@ -267,8 +360,6 @@ struct drm_connector *omap_connector_init(struct drm_device *dev, } omap_connector->dssdev = dssdev; - omap_connector->encoder = encoder; - connector = &omap_connector->base; drm_connector_init(dev, connector, &omap_connector_funcs, diff --git a/trunk/drivers/staging/omapdrm/omap_crtc.c b/trunk/drivers/staging/omapdrm/omap_crtc.c index 5c6ed6040eff..d87bd84257bd 100644 --- a/trunk/drivers/staging/omapdrm/omap_crtc.c +++ b/trunk/drivers/staging/omapdrm/omap_crtc.c @@ -28,131 +28,19 @@ struct omap_crtc { struct drm_crtc base; struct drm_plane *plane; - const char *name; - int pipe; - enum omap_channel channel; - struct omap_overlay_manager_info info; - - /* - * Temporary: eventually this will go away, but it is needed - * for now to keep the output's happy. (They only need - * mgr->id.) Eventually this will be replaced w/ something - * more common-panel-framework-y - */ - struct omap_overlay_manager mgr; - - struct omap_video_timings timings; - bool enabled; - bool full_update; - - struct omap_drm_apply apply; - - struct omap_drm_irq apply_irq; - struct omap_drm_irq error_irq; - - /* list of in-progress apply's: */ - struct list_head pending_applies; - - /* list of queued apply's: */ - struct list_head queued_applies; - - /* for handling queued and in-progress applies: */ - struct work_struct apply_work; + int id; /* if there is a pending flip, these will be non-null: */ struct drm_pending_vblank_event *event; struct drm_framebuffer *old_fb; - - /* for handling page flips without caring about what - * the callback is called from. Possibly we should just - * make omap_gem always call the cb from the worker so - * we don't have to care about this.. - * - * XXX maybe fold into apply_work?? - */ - struct work_struct page_flip_work; -}; - -/* - * Manager-ops, callbacks from output when they need to configure - * the upstream part of the video pipe. - * - * Most of these we can ignore until we add support for command-mode - * panels.. for video-mode the crtc-helpers already do an adequate - * job of sequencing the setup of the video pipe in the proper order - */ - -/* we can probably ignore these until we support command-mode panels: */ -static void omap_crtc_start_update(struct omap_overlay_manager *mgr) -{ -} - -static int omap_crtc_enable(struct omap_overlay_manager *mgr) -{ - return 0; -} - -static void omap_crtc_disable(struct omap_overlay_manager *mgr) -{ -} - -static void omap_crtc_set_timings(struct omap_overlay_manager *mgr, - const struct omap_video_timings *timings) -{ - struct omap_crtc *omap_crtc = container_of(mgr, struct omap_crtc, mgr); - DBG("%s", omap_crtc->name); - omap_crtc->timings = *timings; - omap_crtc->full_update = true; -} - -static void omap_crtc_set_lcd_config(struct omap_overlay_manager *mgr, - const struct dss_lcd_mgr_config *config) -{ - struct omap_crtc *omap_crtc = container_of(mgr, struct omap_crtc, mgr); - DBG("%s", omap_crtc->name); - dispc_mgr_set_lcd_config(omap_crtc->channel, config); -} - -static int omap_crtc_register_framedone_handler( - struct omap_overlay_manager *mgr, - void (*handler)(void *), void *data) -{ - return 0; -} - -static void omap_crtc_unregister_framedone_handler( - struct omap_overlay_manager *mgr, - void (*handler)(void *), void *data) -{ -} - -static const struct dss_mgr_ops mgr_ops = { - .start_update = omap_crtc_start_update, - .enable = omap_crtc_enable, - .disable = omap_crtc_disable, - .set_timings = omap_crtc_set_timings, - .set_lcd_config = omap_crtc_set_lcd_config, - .register_framedone_handler = omap_crtc_register_framedone_handler, - .unregister_framedone_handler = omap_crtc_unregister_framedone_handler, }; -/* - * CRTC funcs: - */ - static void omap_crtc_destroy(struct drm_crtc *crtc) { struct omap_crtc *omap_crtc = to_omap_crtc(crtc); - - DBG("%s", omap_crtc->name); - - WARN_ON(omap_crtc->apply_irq.registered); - omap_irq_unregister(crtc->dev, &omap_crtc->error_irq); - omap_crtc->plane->funcs->destroy(omap_crtc->plane); drm_crtc_cleanup(crtc); - kfree(omap_crtc); } @@ -160,25 +48,14 @@ static void omap_crtc_dpms(struct drm_crtc *crtc, int mode) { struct omap_drm_private *priv = crtc->dev->dev_private; struct omap_crtc *omap_crtc = to_omap_crtc(crtc); - bool enabled = (mode == DRM_MODE_DPMS_ON); int i; - DBG("%s: %d", omap_crtc->name, mode); - - if (enabled != omap_crtc->enabled) { - omap_crtc->enabled = enabled; - omap_crtc->full_update = true; - omap_crtc_apply(crtc, &omap_crtc->apply); + WARN_ON(omap_plane_dpms(omap_crtc->plane, mode)); - /* also enable our private plane: */ - WARN_ON(omap_plane_dpms(omap_crtc->plane, mode)); - - /* and any attached overlay planes: */ - for (i = 0; i < priv->num_planes; i++) { - struct drm_plane *plane = priv->planes[i]; - if (plane->crtc == crtc) - WARN_ON(omap_plane_dpms(plane, mode)); - } + for (i = 0; i < priv->num_planes; i++) { + struct drm_plane *plane = priv->planes[i]; + if (plane->crtc == crtc) + WARN_ON(omap_plane_dpms(plane, mode)); } } @@ -196,26 +73,12 @@ static int omap_crtc_mode_set(struct drm_crtc *crtc, struct drm_framebuffer *old_fb) { struct omap_crtc *omap_crtc = to_omap_crtc(crtc); + struct drm_plane *plane = omap_crtc->plane; - mode = adjusted_mode; - - DBG("%s: set mode: %d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x", - omap_crtc->name, mode->base.id, mode->name, - mode->vrefresh, mode->clock, - mode->hdisplay, mode->hsync_start, - mode->hsync_end, mode->htotal, - mode->vdisplay, mode->vsync_start, - mode->vsync_end, mode->vtotal, - mode->type, mode->flags); - - copy_timings_drm_to_omap(&omap_crtc->timings, mode); - omap_crtc->full_update = true; - - return omap_plane_mode_set(omap_crtc->plane, crtc, crtc->fb, + return omap_plane_mode_set(plane, crtc, crtc->fb, 0, 0, mode->hdisplay, mode->vdisplay, x << 16, y << 16, - mode->hdisplay << 16, mode->vdisplay << 16, - NULL, NULL); + mode->hdisplay << 16, mode->vdisplay << 16); } static void omap_crtc_prepare(struct drm_crtc *crtc) @@ -239,11 +102,10 @@ static int omap_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, struct drm_plane *plane = omap_crtc->plane; struct drm_display_mode *mode = &crtc->mode; - return omap_plane_mode_set(plane, crtc, crtc->fb, + return plane->funcs->update_plane(plane, crtc, crtc->fb, 0, 0, mode->hdisplay, mode->vdisplay, x << 16, y << 16, - mode->hdisplay << 16, mode->vdisplay << 16, - NULL, NULL); + mode->hdisplay << 16, mode->vdisplay << 16); } static void omap_crtc_load_lut(struct drm_crtc *crtc) @@ -252,52 +114,61 @@ static void omap_crtc_load_lut(struct drm_crtc *crtc) static void vblank_cb(void *arg) { + static uint32_t sequence; struct drm_crtc *crtc = arg; struct drm_device *dev = crtc->dev; struct omap_crtc *omap_crtc = to_omap_crtc(crtc); + struct drm_pending_vblank_event *event = omap_crtc->event; unsigned long flags; + struct timeval now; - spin_lock_irqsave(&dev->event_lock, flags); - - /* wakeup userspace */ - if (omap_crtc->event) - drm_send_vblank_event(dev, omap_crtc->pipe, omap_crtc->event); + WARN_ON(!event); omap_crtc->event = NULL; - omap_crtc->old_fb = NULL; - spin_unlock_irqrestore(&dev->event_lock, flags); + /* wakeup userspace */ + if (event) { + do_gettimeofday(&now); + + spin_lock_irqsave(&dev->event_lock, flags); + /* TODO: we can't yet use the vblank time accounting, + * because omapdss lower layer is the one that knows + * the irq # and registers the handler, which more or + * less defeats how drm_irq works.. for now just fake + * the sequence number and use gettimeofday.. + * + event->event.sequence = drm_vblank_count_and_time( + dev, omap_crtc->id, &now); + */ + event->event.sequence = sequence++; + event->event.tv_sec = now.tv_sec; + event->event.tv_usec = now.tv_usec; + list_add_tail(&event->base.link, + &event->base.file_priv->event_list); + wake_up_interruptible(&event->base.file_priv->event_wait); + spin_unlock_irqrestore(&dev->event_lock, flags); + } } -static void page_flip_worker(struct work_struct *work) +static void page_flip_cb(void *arg) { - struct omap_crtc *omap_crtc = - container_of(work, struct omap_crtc, page_flip_work); - struct drm_crtc *crtc = &omap_crtc->base; - struct drm_device *dev = crtc->dev; - struct drm_display_mode *mode = &crtc->mode; + struct drm_crtc *crtc = arg; + struct omap_crtc *omap_crtc = to_omap_crtc(crtc); + struct drm_framebuffer *old_fb = omap_crtc->old_fb; struct drm_gem_object *bo; - mutex_lock(&dev->mode_config.mutex); - omap_plane_mode_set(omap_crtc->plane, crtc, crtc->fb, - 0, 0, mode->hdisplay, mode->vdisplay, - crtc->x << 16, crtc->y << 16, - mode->hdisplay << 16, mode->vdisplay << 16, - vblank_cb, crtc); - mutex_unlock(&dev->mode_config.mutex); + omap_crtc->old_fb = NULL; - bo = omap_framebuffer_bo(crtc->fb, 0); - drm_gem_object_unreference_unlocked(bo); -} + omap_crtc_mode_set_base(crtc, crtc->x, crtc->y, old_fb); -static void page_flip_cb(void *arg) -{ - struct drm_crtc *crtc = arg; - struct omap_crtc *omap_crtc = to_omap_crtc(crtc); - struct omap_drm_private *priv = crtc->dev->dev_private; + /* really we'd like to setup the callback atomically w/ setting the + * new scanout buffer to avoid getting stuck waiting an extra vblank + * cycle.. for now go for correctness and later figure out speed.. + */ + omap_plane_on_endwin(omap_crtc->plane, vblank_cb, crtc); - /* avoid assumptions about what ctxt we are called from: */ - queue_work(priv->wq, &omap_crtc->page_flip_work); + bo = omap_framebuffer_bo(crtc->fb, 0); + drm_gem_object_unreference_unlocked(bo); } static int omap_crtc_page_flip_locked(struct drm_crtc *crtc, @@ -308,14 +179,14 @@ static int omap_crtc_page_flip_locked(struct drm_crtc *crtc, struct omap_crtc *omap_crtc = to_omap_crtc(crtc); struct drm_gem_object *bo; - DBG("%d -> %d (event=%p)", crtc->fb ? crtc->fb->base.id : -1, - fb->base.id, event); + DBG("%d -> %d", crtc->fb ? crtc->fb->base.id : -1, fb->base.id); - if (omap_crtc->old_fb) { + if (omap_crtc->event) { dev_err(dev->dev, "already a pending flip\n"); return -EINVAL; } + omap_crtc->old_fb = crtc->fb; omap_crtc->event = event; crtc->fb = fb; @@ -363,244 +234,14 @@ static const struct drm_crtc_helper_funcs omap_crtc_helper_funcs = { .load_lut = omap_crtc_load_lut, }; -const struct omap_video_timings *omap_crtc_timings(struct drm_crtc *crtc) -{ - struct omap_crtc *omap_crtc = to_omap_crtc(crtc); - return &omap_crtc->timings; -} - -enum omap_channel omap_crtc_channel(struct drm_crtc *crtc) -{ - struct omap_crtc *omap_crtc = to_omap_crtc(crtc); - return omap_crtc->channel; -} - -static void omap_crtc_error_irq(struct omap_drm_irq *irq, uint32_t irqstatus) -{ - struct omap_crtc *omap_crtc = - container_of(irq, struct omap_crtc, error_irq); - struct drm_crtc *crtc = &omap_crtc->base; - DRM_ERROR("%s: errors: %08x\n", omap_crtc->name, irqstatus); - /* avoid getting in a flood, unregister the irq until next vblank */ - omap_irq_unregister(crtc->dev, &omap_crtc->error_irq); -} - -static void omap_crtc_apply_irq(struct omap_drm_irq *irq, uint32_t irqstatus) -{ - struct omap_crtc *omap_crtc = - container_of(irq, struct omap_crtc, apply_irq); - struct drm_crtc *crtc = &omap_crtc->base; - - if (!omap_crtc->error_irq.registered) - omap_irq_register(crtc->dev, &omap_crtc->error_irq); - - if (!dispc_mgr_go_busy(omap_crtc->channel)) { - struct omap_drm_private *priv = - crtc->dev->dev_private; - DBG("%s: apply done", omap_crtc->name); - omap_irq_unregister(crtc->dev, &omap_crtc->apply_irq); - queue_work(priv->wq, &omap_crtc->apply_work); - } -} - -static void apply_worker(struct work_struct *work) -{ - struct omap_crtc *omap_crtc = - container_of(work, struct omap_crtc, apply_work); - struct drm_crtc *crtc = &omap_crtc->base; - struct drm_device *dev = crtc->dev; - struct omap_drm_apply *apply, *n; - bool need_apply; - - /* - * Synchronize everything on mode_config.mutex, to keep - * the callbacks and list modification all serialized - * with respect to modesetting ioctls from userspace. - */ - mutex_lock(&dev->mode_config.mutex); - dispc_runtime_get(); - - /* - * If we are still pending a previous update, wait.. when the - * pending update completes, we get kicked again. - */ - if (omap_crtc->apply_irq.registered) - goto out; - - /* finish up previous apply's: */ - list_for_each_entry_safe(apply, n, - &omap_crtc->pending_applies, pending_node) { - apply->post_apply(apply); - list_del(&apply->pending_node); - } - - need_apply = !list_empty(&omap_crtc->queued_applies); - - /* then handle the next round of of queued apply's: */ - list_for_each_entry_safe(apply, n, - &omap_crtc->queued_applies, queued_node) { - apply->pre_apply(apply); - list_del(&apply->queued_node); - apply->queued = false; - list_add_tail(&apply->pending_node, - &omap_crtc->pending_applies); - } - - if (need_apply) { - enum omap_channel channel = omap_crtc->channel; - - DBG("%s: GO", omap_crtc->name); - - if (dispc_mgr_is_enabled(channel)) { - omap_irq_register(dev, &omap_crtc->apply_irq); - dispc_mgr_go(channel); - } else { - struct omap_drm_private *priv = dev->dev_private; - queue_work(priv->wq, &omap_crtc->apply_work); - } - } - -out: - dispc_runtime_put(); - mutex_unlock(&dev->mode_config.mutex); -} - -int omap_crtc_apply(struct drm_crtc *crtc, - struct omap_drm_apply *apply) -{ - struct omap_crtc *omap_crtc = to_omap_crtc(crtc); - struct drm_device *dev = crtc->dev; - - WARN_ON(!mutex_is_locked(&dev->mode_config.mutex)); - - /* no need to queue it again if it is already queued: */ - if (apply->queued) - return 0; - - apply->queued = true; - list_add_tail(&apply->queued_node, &omap_crtc->queued_applies); - - /* - * If there are no currently pending updates, then go ahead and - * kick the worker immediately, otherwise it will run again when - * the current update finishes. - */ - if (list_empty(&omap_crtc->pending_applies)) { - struct omap_drm_private *priv = crtc->dev->dev_private; - queue_work(priv->wq, &omap_crtc->apply_work); - } - - return 0; -} - -/* called only from apply */ -static void set_enabled(struct drm_crtc *crtc, bool enable) -{ - struct drm_device *dev = crtc->dev; - struct omap_crtc *omap_crtc = to_omap_crtc(crtc); - enum omap_channel channel = omap_crtc->channel; - struct omap_irq_wait *wait = NULL; - - if (dispc_mgr_is_enabled(channel) == enable) - return; - - /* ignore sync-lost irqs during enable/disable */ - omap_irq_unregister(crtc->dev, &omap_crtc->error_irq); - - if (dispc_mgr_get_framedone_irq(channel)) { - if (!enable) { - wait = omap_irq_wait_init(dev, - dispc_mgr_get_framedone_irq(channel), 1); - } - } else { - /* - * When we disable digit output, we need to wait until fields - * are done. Otherwise the DSS is still working, and turning - * off the clocks prevents DSS from going to OFF mode. And when - * enabling, we need to wait for the extra sync losts - */ - wait = omap_irq_wait_init(dev, - dispc_mgr_get_vsync_irq(channel), 2); - } - - dispc_mgr_enable(channel, enable); - - if (wait) { - int ret = omap_irq_wait(dev, wait, msecs_to_jiffies(100)); - if (ret) { - dev_err(dev->dev, "%s: timeout waiting for %s\n", - omap_crtc->name, enable ? "enable" : "disable"); - } - } - - omap_irq_register(crtc->dev, &omap_crtc->error_irq); -} - -static void omap_crtc_pre_apply(struct omap_drm_apply *apply) -{ - struct omap_crtc *omap_crtc = - container_of(apply, struct omap_crtc, apply); - struct drm_crtc *crtc = &omap_crtc->base; - struct drm_encoder *encoder = NULL; - - DBG("%s: enabled=%d, full=%d", omap_crtc->name, - omap_crtc->enabled, omap_crtc->full_update); - - if (omap_crtc->full_update) { - struct omap_drm_private *priv = crtc->dev->dev_private; - int i; - for (i = 0; i < priv->num_encoders; i++) { - if (priv->encoders[i]->crtc == crtc) { - encoder = priv->encoders[i]; - break; - } - } - } - - if (!omap_crtc->enabled) { - set_enabled(&omap_crtc->base, false); - if (encoder) - omap_encoder_set_enabled(encoder, false); - } else { - if (encoder) { - omap_encoder_set_enabled(encoder, false); - omap_encoder_update(encoder, &omap_crtc->mgr, - &omap_crtc->timings); - omap_encoder_set_enabled(encoder, true); - omap_crtc->full_update = false; - } - - dispc_mgr_setup(omap_crtc->channel, &omap_crtc->info); - dispc_mgr_set_timings(omap_crtc->channel, - &omap_crtc->timings); - set_enabled(&omap_crtc->base, true); - } - - omap_crtc->full_update = false; -} - -static void omap_crtc_post_apply(struct omap_drm_apply *apply) -{ - /* nothing needed for post-apply */ -} - -static const char *channel_names[] = { - [OMAP_DSS_CHANNEL_LCD] = "lcd", - [OMAP_DSS_CHANNEL_DIGIT] = "tv", - [OMAP_DSS_CHANNEL_LCD2] = "lcd2", -}; - /* initialize crtc */ struct drm_crtc *omap_crtc_init(struct drm_device *dev, - struct drm_plane *plane, enum omap_channel channel, int id) + struct omap_overlay *ovl, int id) { struct drm_crtc *crtc = NULL; - struct omap_crtc *omap_crtc; - struct omap_overlay_manager_info *info; - - DBG("%s", channel_names[channel]); + struct omap_crtc *omap_crtc = kzalloc(sizeof(*omap_crtc), GFP_KERNEL); - omap_crtc = kzalloc(sizeof(*omap_crtc), GFP_KERNEL); + DBG("%s", ovl->name); if (!omap_crtc) { dev_err(dev->dev, "could not allocate CRTC\n"); @@ -609,40 +250,10 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev, crtc = &omap_crtc->base; - INIT_WORK(&omap_crtc->page_flip_work, page_flip_worker); - INIT_WORK(&omap_crtc->apply_work, apply_worker); - - INIT_LIST_HEAD(&omap_crtc->pending_applies); - INIT_LIST_HEAD(&omap_crtc->queued_applies); - - omap_crtc->apply.pre_apply = omap_crtc_pre_apply; - omap_crtc->apply.post_apply = omap_crtc_post_apply; - - omap_crtc->apply_irq.irqmask = pipe2vbl(id); - omap_crtc->apply_irq.irq = omap_crtc_apply_irq; - - omap_crtc->error_irq.irqmask = - dispc_mgr_get_sync_lost_irq(channel); - omap_crtc->error_irq.irq = omap_crtc_error_irq; - omap_irq_register(dev, &omap_crtc->error_irq); - - omap_crtc->channel = channel; - omap_crtc->plane = plane; + omap_crtc->plane = omap_plane_init(dev, ovl, (1 << id), true); omap_crtc->plane->crtc = crtc; - omap_crtc->name = channel_names[channel]; - omap_crtc->pipe = id; - - /* temporary: */ - omap_crtc->mgr.id = channel; - - dss_install_mgr_ops(&mgr_ops); - - /* TODO: fix hard-coded setup.. add properties! */ - info = &omap_crtc->info; - info->default_color = 0x00000000; - info->trans_key = 0x00000000; - info->trans_key_type = OMAP_DSS_COLOR_KEY_GFX_DST; - info->trans_enabled = false; + omap_crtc->name = ovl->name; + omap_crtc->id = id; drm_crtc_init(dev, crtc, &omap_crtc_funcs); drm_crtc_helper_add(crtc, &omap_crtc_helper_funcs); diff --git a/trunk/drivers/staging/omapdrm/omap_drv.c b/trunk/drivers/staging/omapdrm/omap_drv.c index ae5ecc2efbc7..84943e5ba1d6 100644 --- a/trunk/drivers/staging/omapdrm/omap_drv.c +++ b/trunk/drivers/staging/omapdrm/omap_drv.c @@ -74,99 +74,320 @@ static int get_connector_type(struct omap_dss_device *dssdev) } } -static int omap_modeset_init(struct drm_device *dev) +#if 0 /* enable when dss2 supports hotplug */ +static int omap_drm_notifier(struct notifier_block *nb, + unsigned long evt, void *arg) +{ + switch (evt) { + case OMAP_DSS_SIZE_CHANGE: + case OMAP_DSS_HOTPLUG_CONNECT: + case OMAP_DSS_HOTPLUG_DISCONNECT: { + struct drm_device *dev = drm_device; + DBG("hotplug event: evt=%d, dev=%p", evt, dev); + if (dev) + drm_sysfs_hotplug_event(dev); + + return NOTIFY_OK; + } + default: /* don't care about other events for now */ + return NOTIFY_DONE; + } +} +#endif + +static void dump_video_chains(void) +{ + int i; + + DBG("dumping video chains: "); + for (i = 0; i < omap_dss_get_num_overlays(); i++) { + struct omap_overlay *ovl = omap_dss_get_overlay(i); + struct omap_overlay_manager *mgr = ovl->manager; + struct omap_dss_device *dssdev = mgr ? + mgr->get_device(mgr) : NULL; + if (dssdev) { + DBG("%d: %s -> %s -> %s", i, ovl->name, mgr->name, + dssdev->name); + } else if (mgr) { + DBG("%d: %s -> %s", i, ovl->name, mgr->name); + } else { + DBG("%d: %s", i, ovl->name); + } + } +} + +/* create encoders for each manager */ +static int create_encoder(struct drm_device *dev, + struct omap_overlay_manager *mgr) { struct omap_drm_private *priv = dev->dev_private; - struct omap_dss_device *dssdev = NULL; - int num_ovls = dss_feat_get_num_ovls(); - int id; + struct drm_encoder *encoder = omap_encoder_init(dev, mgr); - drm_mode_config_init(dev); + if (!encoder) { + dev_err(dev->dev, "could not create encoder: %s\n", + mgr->name); + return -ENOMEM; + } - omap_drm_irq_install(dev); + BUG_ON(priv->num_encoders >= ARRAY_SIZE(priv->encoders)); - /* - * Create private planes and CRTCs for the last NUM_CRTCs overlay - * plus manager: - */ - for (id = 0; id < min(num_crtc, num_ovls); id++) { - struct drm_plane *plane; - struct drm_crtc *crtc; + priv->encoders[priv->num_encoders++] = encoder; - plane = omap_plane_init(dev, id, true); - crtc = omap_crtc_init(dev, plane, pipe2chan(id), id); + return 0; +} + +/* create connectors for each display device */ +static int create_connector(struct drm_device *dev, + struct omap_dss_device *dssdev) +{ + struct omap_drm_private *priv = dev->dev_private; + static struct notifier_block *notifier; + struct drm_connector *connector; + int j; + + if (!dssdev->driver) { + dev_warn(dev->dev, "%s has no driver.. skipping it\n", + dssdev->name); + return 0; + } + + if (!(dssdev->driver->get_timings || + dssdev->driver->read_edid)) { + dev_warn(dev->dev, "%s driver does not support " + "get_timings or read_edid.. skipping it!\n", + dssdev->name); + return 0; + } + + connector = omap_connector_init(dev, + get_connector_type(dssdev), dssdev); - BUG_ON(priv->num_crtcs >= ARRAY_SIZE(priv->crtcs)); - priv->crtcs[id] = crtc; - priv->num_crtcs++; + if (!connector) { + dev_err(dev->dev, "could not create connector: %s\n", + dssdev->name); + return -ENOMEM; + } + + BUG_ON(priv->num_connectors >= ARRAY_SIZE(priv->connectors)); + + priv->connectors[priv->num_connectors++] = connector; + +#if 0 /* enable when dss2 supports hotplug */ + notifier = kzalloc(sizeof(struct notifier_block), GFP_KERNEL); + notifier->notifier_call = omap_drm_notifier; + omap_dss_add_notify(dssdev, notifier); +#else + notifier = NULL; +#endif - priv->planes[id] = plane; - priv->num_planes++; + for (j = 0; j < priv->num_encoders; j++) { + struct omap_overlay_manager *mgr = + omap_encoder_get_manager(priv->encoders[j]); + if (mgr->get_device(mgr) == dssdev) { + drm_mode_connector_attach_encoder(connector, + priv->encoders[j]); + } } - /* - * Create normal planes for the remaining overlays: + return 0; +} + +/* create up to max_overlays CRTCs mapping to overlays.. by default, + * connect the overlays to different managers/encoders, giving priority + * to encoders connected to connectors with a detected connection + */ +static int create_crtc(struct drm_device *dev, struct omap_overlay *ovl, + int *j, unsigned int connected_connectors) +{ + struct omap_drm_private *priv = dev->dev_private; + struct omap_overlay_manager *mgr = NULL; + struct drm_crtc *crtc; + + /* find next best connector, ones with detected connection first */ - for (; id < num_ovls; id++) { - struct drm_plane *plane = omap_plane_init(dev, id, false); + while (*j < priv->num_connectors && !mgr) { + if (connected_connectors & (1 << *j)) { + struct drm_encoder *encoder = + omap_connector_attached_encoder( + priv->connectors[*j]); + if (encoder) + mgr = omap_encoder_get_manager(encoder); - BUG_ON(priv->num_planes >= ARRAY_SIZE(priv->planes)); - priv->planes[priv->num_planes++] = plane; + } + (*j)++; } - for_each_dss_dev(dssdev) { - struct drm_connector *connector; - struct drm_encoder *encoder; + /* if we couldn't find another connected connector, lets start + * looking at the unconnected connectors: + * + * note: it might not be immediately apparent, but thanks to + * the !mgr check in both this loop and the one above, the only + * way to enter this loop is with *j == priv->num_connectors, + * so idx can never go negative. + */ + while (*j < 2 * priv->num_connectors && !mgr) { + int idx = *j - priv->num_connectors; + if (!(connected_connectors & (1 << idx))) { + struct drm_encoder *encoder = + omap_connector_attached_encoder( + priv->connectors[idx]); + if (encoder) + mgr = omap_encoder_get_manager(encoder); - if (!dssdev->driver) { - dev_warn(dev->dev, "%s has no driver.. skipping it\n", - dssdev->name); - return 0; } + (*j)++; + } - if (!(dssdev->driver->get_timings || - dssdev->driver->read_edid)) { - dev_warn(dev->dev, "%s driver does not support " - "get_timings or read_edid.. skipping it!\n", - dssdev->name); - return 0; + crtc = omap_crtc_init(dev, ovl, priv->num_crtcs); + + if (!crtc) { + dev_err(dev->dev, "could not create CRTC: %s\n", + ovl->name); + return -ENOMEM; + } + + BUG_ON(priv->num_crtcs >= ARRAY_SIZE(priv->crtcs)); + + priv->crtcs[priv->num_crtcs++] = crtc; + + return 0; +} + +static int create_plane(struct drm_device *dev, struct omap_overlay *ovl, + unsigned int possible_crtcs) +{ + struct omap_drm_private *priv = dev->dev_private; + struct drm_plane *plane = + omap_plane_init(dev, ovl, possible_crtcs, false); + + if (!plane) { + dev_err(dev->dev, "could not create plane: %s\n", + ovl->name); + return -ENOMEM; + } + + BUG_ON(priv->num_planes >= ARRAY_SIZE(priv->planes)); + + priv->planes[priv->num_planes++] = plane; + + return 0; +} + +static int match_dev_name(struct omap_dss_device *dssdev, void *data) +{ + return !strcmp(dssdev->name, data); +} + +static unsigned int detect_connectors(struct drm_device *dev) +{ + struct omap_drm_private *priv = dev->dev_private; + unsigned int connected_connectors = 0; + int i; + + for (i = 0; i < priv->num_connectors; i++) { + struct drm_connector *connector = priv->connectors[i]; + if (omap_connector_detect(connector, true) == + connector_status_connected) { + connected_connectors |= (1 << i); } + } + + return connected_connectors; +} - encoder = omap_encoder_init(dev, dssdev); +static int omap_modeset_init(struct drm_device *dev) +{ + const struct omap_drm_platform_data *pdata = dev->dev->platform_data; + struct omap_kms_platform_data *kms_pdata = NULL; + struct omap_drm_private *priv = dev->dev_private; + struct omap_dss_device *dssdev = NULL; + int i, j; + unsigned int connected_connectors = 0; - if (!encoder) { - dev_err(dev->dev, "could not create encoder: %s\n", - dssdev->name); - return -ENOMEM; + drm_mode_config_init(dev); + + if (pdata && pdata->kms_pdata) { + kms_pdata = pdata->kms_pdata; + + /* if platform data is provided by the board file, use it to + * control which overlays, managers, and devices we own. + */ + for (i = 0; i < kms_pdata->mgr_cnt; i++) { + struct omap_overlay_manager *mgr = + omap_dss_get_overlay_manager( + kms_pdata->mgr_ids[i]); + create_encoder(dev, mgr); + } + + for (i = 0; i < kms_pdata->dev_cnt; i++) { + struct omap_dss_device *dssdev = + omap_dss_find_device( + (void *)kms_pdata->dev_names[i], + match_dev_name); + if (!dssdev) { + dev_warn(dev->dev, "no such dssdev: %s\n", + kms_pdata->dev_names[i]); + continue; + } + create_connector(dev, dssdev); } - connector = omap_connector_init(dev, - get_connector_type(dssdev), dssdev, encoder); + connected_connectors = detect_connectors(dev); - if (!connector) { - dev_err(dev->dev, "could not create connector: %s\n", - dssdev->name); - return -ENOMEM; + j = 0; + for (i = 0; i < kms_pdata->ovl_cnt; i++) { + struct omap_overlay *ovl = + omap_dss_get_overlay(kms_pdata->ovl_ids[i]); + create_crtc(dev, ovl, &j, connected_connectors); } - BUG_ON(priv->num_encoders >= ARRAY_SIZE(priv->encoders)); - BUG_ON(priv->num_connectors >= ARRAY_SIZE(priv->connectors)); + for (i = 0; i < kms_pdata->pln_cnt; i++) { + struct omap_overlay *ovl = + omap_dss_get_overlay(kms_pdata->pln_ids[i]); + create_plane(dev, ovl, (1 << priv->num_crtcs) - 1); + } + } else { + /* otherwise just grab up to CONFIG_DRM_OMAP_NUM_CRTCS and try + * to make educated guesses about everything else + */ + int max_overlays = min(omap_dss_get_num_overlays(), num_crtc); - priv->encoders[priv->num_encoders++] = encoder; - priv->connectors[priv->num_connectors++] = connector; + for (i = 0; i < omap_dss_get_num_overlay_managers(); i++) + create_encoder(dev, omap_dss_get_overlay_manager(i)); + + for_each_dss_dev(dssdev) { + create_connector(dev, dssdev); + } - drm_mode_connector_attach_encoder(connector, encoder); + connected_connectors = detect_connectors(dev); - /* figure out which crtc's we can connect the encoder to: */ - encoder->possible_crtcs = 0; - for (id = 0; id < priv->num_crtcs; id++) { - enum omap_dss_output_id supported_outputs = - dss_feat_get_supported_outputs(pipe2chan(id)); - if (supported_outputs & dssdev->output->id) - encoder->possible_crtcs |= (1 << id); + j = 0; + for (i = 0; i < max_overlays; i++) { + create_crtc(dev, omap_dss_get_overlay(i), + &j, connected_connectors); + } + + /* use any remaining overlays as drm planes */ + for (; i < omap_dss_get_num_overlays(); i++) { + struct omap_overlay *ovl = omap_dss_get_overlay(i); + create_plane(dev, ovl, (1 << priv->num_crtcs) - 1); } } + /* for now keep the mapping of CRTCs and encoders static.. */ + for (i = 0; i < priv->num_encoders; i++) { + struct drm_encoder *encoder = priv->encoders[i]; + struct omap_overlay_manager *mgr = + omap_encoder_get_manager(encoder); + + encoder->possible_crtcs = (1 << priv->num_crtcs) - 1; + + DBG("%s: possible_crtcs=%08x", mgr->name, + encoder->possible_crtcs); + } + + dump_video_chains(); + dev->mode_config.min_width = 32; dev->mode_config.min_height = 32; @@ -229,7 +450,7 @@ static int ioctl_gem_new(struct drm_device *dev, void *data, struct drm_file *file_priv) { struct drm_omap_gem_new *args = data; - VERB("%p:%p: size=0x%08x, flags=%08x", dev, file_priv, + DBG("%p:%p: size=0x%08x, flags=%08x", dev, file_priv, args->size.bytes, args->flags); return omap_gem_new_handle(dev, file_priv, args->size, args->flags, &args->handle); @@ -289,7 +510,7 @@ static int ioctl_gem_info(struct drm_device *dev, void *data, struct drm_gem_object *obj; int ret = 0; - VERB("%p:%p: handle=%d", dev, file_priv, args->handle); + DBG("%p:%p: handle=%d", dev, file_priv, args->handle); obj = drm_gem_object_lookup(dev, file_priv, args->handle); if (!obj) @@ -344,6 +565,14 @@ static int dev_load(struct drm_device *dev, unsigned long flags) dev->dev_private = priv; + ret = omapdss_compat_init(); + if (ret) { + dev_err(dev->dev, "coult not init omapdss\n"); + dev->dev_private = NULL; + kfree(priv); + return ret; + } + priv->wq = alloc_ordered_workqueue("omapdrm", 0); INIT_LIST_HEAD(&priv->obj_list); @@ -355,13 +584,10 @@ static int dev_load(struct drm_device *dev, unsigned long flags) dev_err(dev->dev, "omap_modeset_init failed: ret=%d\n", ret); dev->dev_private = NULL; kfree(priv); + omapdss_compat_uninit(); return ret; } - ret = drm_vblank_init(dev, priv->num_crtcs); - if (ret) - dev_warn(dev->dev, "could not init vblank\n"); - priv->fbdev = omap_fbdev_init(dev); if (!priv->fbdev) { dev_warn(dev->dev, "omap_fbdev_init failed\n"); @@ -370,6 +596,10 @@ static int dev_load(struct drm_device *dev, unsigned long flags) drm_kms_helper_poll_init(dev); + ret = drm_vblank_init(dev, priv->num_crtcs); + if (ret) + dev_warn(dev->dev, "could not init vblank\n"); + return 0; } @@ -379,9 +609,8 @@ static int dev_unload(struct drm_device *dev) DBG("unload: dev=%p", dev); - drm_kms_helper_poll_fini(dev); drm_vblank_cleanup(dev); - omap_drm_irq_uninstall(dev); + drm_kms_helper_poll_fini(dev); omap_fbdev_free(dev); omap_modeset_free(dev); @@ -390,6 +619,8 @@ static int dev_unload(struct drm_device *dev) flush_workqueue(priv->wq); destroy_workqueue(priv->wq); + omapdss_compat_uninit(); + kfree(dev->dev_private); dev->dev_private = NULL; @@ -449,9 +680,7 @@ static void dev_lastclose(struct drm_device *dev) } } - mutex_lock(&dev->mode_config.mutex); ret = drm_fb_helper_restore_fbdev_mode(priv->fbdev); - mutex_unlock(&dev->mode_config.mutex); if (ret) DBG("failed to restore crtc mode"); } @@ -466,6 +695,60 @@ static void dev_postclose(struct drm_device *dev, struct drm_file *file) DBG("postclose: dev=%p, file=%p", dev, file); } +/** + * enable_vblank - enable vblank interrupt events + * @dev: DRM device + * @crtc: which irq to enable + * + * Enable vblank interrupts for @crtc. If the device doesn't have + * a hardware vblank counter, this routine should be a no-op, since + * interrupts will have to stay on to keep the count accurate. + * + * RETURNS + * Zero on success, appropriate errno if the given @crtc's vblank + * interrupt cannot be enabled. + */ +static int dev_enable_vblank(struct drm_device *dev, int crtc) +{ + DBG("enable_vblank: dev=%p, crtc=%d", dev, crtc); + return 0; +} + +/** + * disable_vblank - disable vblank interrupt events + * @dev: DRM device + * @crtc: which irq to enable + * + * Disable vblank interrupts for @crtc. If the device doesn't have + * a hardware vblank counter, this routine should be a no-op, since + * interrupts will have to stay on to keep the count accurate. + */ +static void dev_disable_vblank(struct drm_device *dev, int crtc) +{ + DBG("disable_vblank: dev=%p, crtc=%d", dev, crtc); +} + +static irqreturn_t dev_irq_handler(DRM_IRQ_ARGS) +{ + return IRQ_HANDLED; +} + +static void dev_irq_preinstall(struct drm_device *dev) +{ + DBG("irq_preinstall: dev=%p", dev); +} + +static int dev_irq_postinstall(struct drm_device *dev) +{ + DBG("irq_postinstall: dev=%p", dev); + return 0; +} + +static void dev_irq_uninstall(struct drm_device *dev) +{ + DBG("irq_uninstall: dev=%p", dev); +} + static const struct vm_operations_struct omap_gem_vm_ops = { .fault = omap_gem_fault, .open = drm_gem_vm_open, @@ -495,12 +778,12 @@ static struct drm_driver omap_drm_driver = { .preclose = dev_preclose, .postclose = dev_postclose, .get_vblank_counter = drm_vblank_count, - .enable_vblank = omap_irq_enable_vblank, - .disable_vblank = omap_irq_disable_vblank, - .irq_preinstall = omap_irq_preinstall, - .irq_postinstall = omap_irq_postinstall, - .irq_uninstall = omap_irq_uninstall, - .irq_handler = omap_irq_handler, + .enable_vblank = dev_enable_vblank, + .disable_vblank = dev_disable_vblank, + .irq_preinstall = dev_irq_preinstall, + .irq_postinstall = dev_irq_postinstall, + .irq_uninstall = dev_irq_uninstall, + .irq_handler = dev_irq_handler, #ifdef CONFIG_DEBUG_FS .debugfs_init = omap_debugfs_init, .debugfs_cleanup = omap_debugfs_cleanup, diff --git a/trunk/drivers/staging/omapdrm/omap_drv.h b/trunk/drivers/staging/omapdrm/omap_drv.h index cd1f22b0b124..1d4aea53b75d 100644 --- a/trunk/drivers/staging/omapdrm/omap_drv.h +++ b/trunk/drivers/staging/omapdrm/omap_drv.h @@ -28,7 +28,6 @@ #include #include "omap_drm.h" - #define DBG(fmt, ...) DRM_DEBUG(fmt"\n", ##__VA_ARGS__) #define VERB(fmt, ...) if (0) DRM_DEBUG(fmt, ##__VA_ARGS__) /* verbose debug */ @@ -40,51 +39,6 @@ */ #define MAX_MAPPERS 2 -/* parameters which describe (unrotated) coordinates of scanout within a fb: */ -struct omap_drm_window { - uint32_t rotation; - int32_t crtc_x, crtc_y; /* signed because can be offscreen */ - uint32_t crtc_w, crtc_h; - uint32_t src_x, src_y; - uint32_t src_w, src_h; -}; - -/* Once GO bit is set, we can't make further updates to shadowed registers - * until the GO bit is cleared. So various parts in the kms code that need - * to update shadowed registers queue up a pair of callbacks, pre_apply - * which is called before setting GO bit, and post_apply that is called - * after GO bit is cleared. The crtc manages the queuing, and everyone - * else goes thru omap_crtc_apply() using these callbacks so that the - * code which has to deal w/ GO bit state is centralized. - */ -struct omap_drm_apply { - struct list_head pending_node, queued_node; - bool queued; - void (*pre_apply)(struct omap_drm_apply *apply); - void (*post_apply)(struct omap_drm_apply *apply); -}; - -/* For transiently registering for different DSS irqs that various parts - * of the KMS code need during setup/configuration. We these are not - * necessarily the same as what drm_vblank_get/put() are requesting, and - * the hysteresis in drm_vblank_put() is not necessarily desirable for - * internal housekeeping related irq usage. - */ -struct omap_drm_irq { - struct list_head node; - uint32_t irqmask; - bool registered; - void (*irq)(struct omap_drm_irq *irq, uint32_t irqstatus); -}; - -/* For KMS code that needs to wait for a certain # of IRQs: - */ -struct omap_irq_wait; -struct omap_irq_wait * omap_irq_wait_init(struct drm_device *dev, - uint32_t irqmask, int count); -int omap_irq_wait(struct drm_device *dev, struct omap_irq_wait *wait, - unsigned long timeout); - struct omap_drm_private { uint32_t omaprev; @@ -104,7 +58,6 @@ struct omap_drm_private { struct workqueue_struct *wq; - /* list of GEM objects: */ struct list_head obj_list; bool has_dmm; @@ -112,11 +65,6 @@ struct omap_drm_private { /* properties: */ struct drm_property *rotation_prop; struct drm_property *zorder_prop; - - /* irq handling: */ - struct list_head irq_list; /* list of omap_drm_irq */ - uint32_t vblank_mask; /* irq bits set for userspace vblank */ - struct omap_drm_irq error_handler; }; /* this should probably be in drm-core to standardize amongst drivers */ @@ -127,6 +75,15 @@ struct omap_drm_private { #define DRM_REFLECT_X 4 #define DRM_REFLECT_Y 5 +/* parameters which describe (unrotated) coordinates of scanout within a fb: */ +struct omap_drm_window { + uint32_t rotation; + int32_t crtc_x, crtc_y; /* signed because can be offscreen */ + uint32_t crtc_w, crtc_h; + uint32_t src_x, src_y; + uint32_t src_w, src_h; +}; + #ifdef CONFIG_DEBUG_FS int omap_debugfs_init(struct drm_minor *minor); void omap_debugfs_cleanup(struct drm_minor *minor); @@ -135,36 +92,23 @@ void omap_gem_describe(struct drm_gem_object *obj, struct seq_file *m); void omap_gem_describe_objects(struct list_head *list, struct seq_file *m); #endif -int omap_irq_enable_vblank(struct drm_device *dev, int crtc); -void omap_irq_disable_vblank(struct drm_device *dev, int crtc); -irqreturn_t omap_irq_handler(DRM_IRQ_ARGS); -void omap_irq_preinstall(struct drm_device *dev); -int omap_irq_postinstall(struct drm_device *dev); -void omap_irq_uninstall(struct drm_device *dev); -void omap_irq_register(struct drm_device *dev, struct omap_drm_irq *irq); -void omap_irq_unregister(struct drm_device *dev, struct omap_drm_irq *irq); -int omap_drm_irq_uninstall(struct drm_device *dev); -int omap_drm_irq_install(struct drm_device *dev); - struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev); void omap_fbdev_free(struct drm_device *dev); -const struct omap_video_timings *omap_crtc_timings(struct drm_crtc *crtc); -enum omap_channel omap_crtc_channel(struct drm_crtc *crtc); -int omap_crtc_apply(struct drm_crtc *crtc, - struct omap_drm_apply *apply); struct drm_crtc *omap_crtc_init(struct drm_device *dev, - struct drm_plane *plane, enum omap_channel channel, int id); + struct omap_overlay *ovl, int id); struct drm_plane *omap_plane_init(struct drm_device *dev, - int plane_id, bool private_plane); + struct omap_overlay *ovl, unsigned int possible_crtcs, + bool priv); int omap_plane_dpms(struct drm_plane *plane, int mode); int omap_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc, struct drm_framebuffer *fb, int crtc_x, int crtc_y, unsigned int crtc_w, unsigned int crtc_h, uint32_t src_x, uint32_t src_y, - uint32_t src_w, uint32_t src_h, + uint32_t src_w, uint32_t src_h); +void omap_plane_on_endwin(struct drm_plane *plane, void (*fxn)(void *), void *arg); void omap_plane_install_properties(struct drm_plane *plane, struct drm_mode_object *obj); @@ -172,24 +116,20 @@ int omap_plane_set_property(struct drm_plane *plane, struct drm_property *property, uint64_t val); struct drm_encoder *omap_encoder_init(struct drm_device *dev, - struct omap_dss_device *dssdev); -int omap_encoder_set_enabled(struct drm_encoder *encoder, bool enabled); -int omap_encoder_update(struct drm_encoder *encoder, - struct omap_overlay_manager *mgr, - struct omap_video_timings *timings); - -struct drm_connector *omap_connector_init(struct drm_device *dev, - int connector_type, struct omap_dss_device *dssdev, + struct omap_overlay_manager *mgr); +struct omap_overlay_manager *omap_encoder_get_manager( struct drm_encoder *encoder); struct drm_encoder *omap_connector_attached_encoder( struct drm_connector *connector); -void omap_connector_flush(struct drm_connector *connector, - int x, int y, int w, int h); +enum drm_connector_status omap_connector_detect( + struct drm_connector *connector, bool force); -void copy_timings_omap_to_drm(struct drm_display_mode *mode, - struct omap_video_timings *timings); -void copy_timings_drm_to_omap(struct omap_video_timings *timings, +struct drm_connector *omap_connector_init(struct drm_device *dev, + int connector_type, struct omap_dss_device *dssdev); +void omap_connector_mode_set(struct drm_connector *connector, struct drm_display_mode *mode); +void omap_connector_flush(struct drm_connector *connector, + int x, int y, int w, int h); uint32_t omap_framebuffer_get_formats(uint32_t *pixel_formats, uint32_t max_formats, enum omap_color_mode supported_modes); @@ -267,40 +207,6 @@ static inline int align_pitch(int pitch, int width, int bpp) return ALIGN(pitch, 8 * bytespp); } -static inline enum omap_channel pipe2chan(int pipe) -{ - int num_mgrs = dss_feat_get_num_mgrs(); - - /* - * We usually don't want to create a CRTC for each manager, - * at least not until we have a way to expose private planes - * to userspace. Otherwise there would not be enough video - * pipes left for drm planes. The higher #'d managers tend - * to have more features so start in reverse order. - */ - return num_mgrs - pipe - 1; -} - -/* map crtc to vblank mask */ -static inline uint32_t pipe2vbl(int crtc) -{ - enum omap_channel channel = pipe2chan(crtc); - return dispc_mgr_get_vsync_irq(channel); -} - -static inline int crtc2pipe(struct drm_device *dev, struct drm_crtc *crtc) -{ - struct omap_drm_private *priv = dev->dev_private; - int i; - - for (i = 0; i < ARRAY_SIZE(priv->crtcs); i++) - if (priv->crtcs[i] == crtc) - return i; - - BUG(); /* bogus CRTC ptr */ - return -1; -} - /* should these be made into common util helpers? */ diff --git a/trunk/drivers/staging/omapdrm/omap_encoder.c b/trunk/drivers/staging/omapdrm/omap_encoder.c index e053160d2db3..5341d5e3e317 100644 --- a/trunk/drivers/staging/omapdrm/omap_encoder.c +++ b/trunk/drivers/staging/omapdrm/omap_encoder.c @@ -22,56 +22,37 @@ #include "drm_crtc.h" #include "drm_crtc_helper.h" -#include - - /* * encoder funcs */ #define to_omap_encoder(x) container_of(x, struct omap_encoder, base) -/* The encoder and connector both map to same dssdev.. the encoder - * handles the 'active' parts, ie. anything the modifies the state - * of the hw, and the connector handles the 'read-only' parts, like - * detecting connection and reading edid. - */ struct omap_encoder { struct drm_encoder base; - struct omap_dss_device *dssdev; + struct omap_overlay_manager *mgr; }; static void omap_encoder_destroy(struct drm_encoder *encoder) { struct omap_encoder *omap_encoder = to_omap_encoder(encoder); + DBG("%s", omap_encoder->mgr->name); drm_encoder_cleanup(encoder); kfree(omap_encoder); } -static const struct drm_encoder_funcs omap_encoder_funcs = { - .destroy = omap_encoder_destroy, -}; - -/* - * The CRTC drm_crtc_helper_set_mode() doesn't really give us the right - * order.. the easiest way to work around this for now is to make all - * the encoder-helper's no-op's and have the omap_crtc code take care - * of the sequencing and call us in the right points. - * - * Eventually to handle connecting CRTCs to different encoders properly, - * either the CRTC helpers need to change or we need to replace - * drm_crtc_helper_set_mode(), but lets wait until atomic-modeset for - * that. - */ - static void omap_encoder_dpms(struct drm_encoder *encoder, int mode) { + struct omap_encoder *omap_encoder = to_omap_encoder(encoder); + DBG("%s: %d", omap_encoder->mgr->name, mode); } static bool omap_encoder_mode_fixup(struct drm_encoder *encoder, const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) { + struct omap_encoder *omap_encoder = to_omap_encoder(encoder); + DBG("%s", omap_encoder->mgr->name); return true; } @@ -79,16 +60,47 @@ static void omap_encoder_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) { + struct omap_encoder *omap_encoder = to_omap_encoder(encoder); + struct drm_device *dev = encoder->dev; + struct omap_drm_private *priv = dev->dev_private; + int i; + + mode = adjusted_mode; + + DBG("%s: set mode: %dx%d", omap_encoder->mgr->name, + mode->hdisplay, mode->vdisplay); + + for (i = 0; i < priv->num_connectors; i++) { + struct drm_connector *connector = priv->connectors[i]; + if (connector->encoder == encoder) + omap_connector_mode_set(connector, mode); + + } } static void omap_encoder_prepare(struct drm_encoder *encoder) { + struct omap_encoder *omap_encoder = to_omap_encoder(encoder); + struct drm_encoder_helper_funcs *encoder_funcs = + encoder->helper_private; + DBG("%s", omap_encoder->mgr->name); + encoder_funcs->dpms(encoder, DRM_MODE_DPMS_OFF); } static void omap_encoder_commit(struct drm_encoder *encoder) { + struct omap_encoder *omap_encoder = to_omap_encoder(encoder); + struct drm_encoder_helper_funcs *encoder_funcs = + encoder->helper_private; + DBG("%s", omap_encoder->mgr->name); + omap_encoder->mgr->apply(omap_encoder->mgr); + encoder_funcs->dpms(encoder, DRM_MODE_DPMS_ON); } +static const struct drm_encoder_funcs omap_encoder_funcs = { + .destroy = omap_encoder_destroy, +}; + static const struct drm_encoder_helper_funcs omap_encoder_helper_funcs = { .dpms = omap_encoder_dpms, .mode_fixup = omap_encoder_mode_fixup, @@ -97,54 +109,23 @@ static const struct drm_encoder_helper_funcs omap_encoder_helper_funcs = { .commit = omap_encoder_commit, }; -/* - * Instead of relying on the helpers for modeset, the omap_crtc code - * calls these functions in the proper sequence. - */ - -int omap_encoder_set_enabled(struct drm_encoder *encoder, bool enabled) +struct omap_overlay_manager *omap_encoder_get_manager( + struct drm_encoder *encoder) { struct omap_encoder *omap_encoder = to_omap_encoder(encoder); - struct omap_dss_device *dssdev = omap_encoder->dssdev; - struct omap_dss_driver *dssdrv = dssdev->driver; - - if (enabled) { - return dssdrv->enable(dssdev); - } else { - dssdrv->disable(dssdev); - return 0; - } -} - -int omap_encoder_update(struct drm_encoder *encoder, - struct omap_overlay_manager *mgr, - struct omap_video_timings *timings) -{ - struct drm_device *dev = encoder->dev; - struct omap_encoder *omap_encoder = to_omap_encoder(encoder); - struct omap_dss_device *dssdev = omap_encoder->dssdev; - struct omap_dss_driver *dssdrv = dssdev->driver; - int ret; - - dssdev->output->manager = mgr; - - ret = dssdrv->check_timings(dssdev, timings); - if (ret) { - dev_err(dev->dev, "could not set timings: %d\n", ret); - return ret; - } - - dssdrv->set_timings(dssdev, timings); - - return 0; + return omap_encoder->mgr; } /* initialize encoder */ struct drm_encoder *omap_encoder_init(struct drm_device *dev, - struct omap_dss_device *dssdev) + struct omap_overlay_manager *mgr) { struct drm_encoder *encoder = NULL; struct omap_encoder *omap_encoder; + struct omap_overlay_manager_info info; + int ret; + + DBG("%s", mgr->name); omap_encoder = kzalloc(sizeof(*omap_encoder), GFP_KERNEL); if (!omap_encoder) { @@ -152,14 +133,33 @@ struct drm_encoder *omap_encoder_init(struct drm_device *dev, goto fail; } - omap_encoder->dssdev = dssdev; - + omap_encoder->mgr = mgr; encoder = &omap_encoder->base; drm_encoder_init(dev, encoder, &omap_encoder_funcs, DRM_MODE_ENCODER_TMDS); drm_encoder_helper_add(encoder, &omap_encoder_helper_funcs); + mgr->get_manager_info(mgr, &info); + + /* TODO: fix hard-coded setup.. */ + info.default_color = 0x00000000; + info.trans_key = 0x00000000; + info.trans_key_type = OMAP_DSS_COLOR_KEY_GFX_DST; + info.trans_enabled = false; + + ret = mgr->set_manager_info(mgr, &info); + if (ret) { + dev_err(dev->dev, "could not set manager info\n"); + goto fail; + } + + ret = mgr->apply(mgr); + if (ret) { + dev_err(dev->dev, "could not apply\n"); + goto fail; + } + return encoder; fail: diff --git a/trunk/drivers/staging/omapdrm/omap_gem_dmabuf.c b/trunk/drivers/staging/omapdrm/omap_gem_dmabuf.c index b6c5b5c6c8c5..9a302062b031 100644 --- a/trunk/drivers/staging/omapdrm/omap_gem_dmabuf.c +++ b/trunk/drivers/staging/omapdrm/omap_gem_dmabuf.c @@ -194,7 +194,7 @@ struct dma_buf_ops omap_dmabuf_ops = { struct dma_buf *omap_gem_prime_export(struct drm_device *dev, struct drm_gem_object *obj, int flags) { - return dma_buf_export(obj, &omap_dmabuf_ops, obj->size, flags); + return dma_buf_export(obj, &omap_dmabuf_ops, obj->size, 0600); } struct drm_gem_object *omap_gem_prime_import(struct drm_device *dev, @@ -207,12 +207,7 @@ struct drm_gem_object *omap_gem_prime_import(struct drm_device *dev, obj = buffer->priv; /* is it from our device? */ if (obj->dev == dev) { - /* - * Importing dmabuf exported from out own gem increases - * refcount on gem itself instead of f_count of dmabuf. - */ drm_gem_object_reference(obj); - dma_buf_put(buffer); return obj; } } diff --git a/trunk/drivers/staging/omapdrm/omap_irq.c b/trunk/drivers/staging/omapdrm/omap_irq.c deleted file mode 100644 index 2629ba7be6c8..000000000000 --- a/trunk/drivers/staging/omapdrm/omap_irq.c +++ /dev/null @@ -1,322 +0,0 @@ -/* - * drivers/staging/omapdrm/omap_irq.c - * - * Copyright (C) 2012 Texas Instruments - * Author: Rob Clark - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -#include "omap_drv.h" - -static DEFINE_SPINLOCK(list_lock); - -static void omap_irq_error_handler(struct omap_drm_irq *irq, - uint32_t irqstatus) -{ - DRM_ERROR("errors: %08x\n", irqstatus); -} - -/* call with list_lock and dispc runtime held */ -static void omap_irq_update(struct drm_device *dev) -{ - struct omap_drm_private *priv = dev->dev_private; - struct omap_drm_irq *irq; - uint32_t irqmask = priv->vblank_mask; - - BUG_ON(!spin_is_locked(&list_lock)); - - list_for_each_entry(irq, &priv->irq_list, node) - irqmask |= irq->irqmask; - - DBG("irqmask=%08x", irqmask); - - dispc_write_irqenable(irqmask); - dispc_read_irqenable(); /* flush posted write */ -} - -void omap_irq_register(struct drm_device *dev, struct omap_drm_irq *irq) -{ - struct omap_drm_private *priv = dev->dev_private; - unsigned long flags; - - dispc_runtime_get(); - spin_lock_irqsave(&list_lock, flags); - - if (!WARN_ON(irq->registered)) { - irq->registered = true; - list_add(&irq->node, &priv->irq_list); - omap_irq_update(dev); - } - - spin_unlock_irqrestore(&list_lock, flags); - dispc_runtime_put(); -} - -void omap_irq_unregister(struct drm_device *dev, struct omap_drm_irq *irq) -{ - unsigned long flags; - - dispc_runtime_get(); - spin_lock_irqsave(&list_lock, flags); - - if (!WARN_ON(!irq->registered)) { - irq->registered = false; - list_del(&irq->node); - omap_irq_update(dev); - } - - spin_unlock_irqrestore(&list_lock, flags); - dispc_runtime_put(); -} - -struct omap_irq_wait { - struct omap_drm_irq irq; - int count; -}; - -static DECLARE_WAIT_QUEUE_HEAD(wait_event); - -static void wait_irq(struct omap_drm_irq *irq, uint32_t irqstatus) -{ - struct omap_irq_wait *wait = - container_of(irq, struct omap_irq_wait, irq); - wait->count--; - wake_up_all(&wait_event); -} - -struct omap_irq_wait * omap_irq_wait_init(struct drm_device *dev, - uint32_t irqmask, int count) -{ - struct omap_irq_wait *wait = kzalloc(sizeof(*wait), GFP_KERNEL); - wait->irq.irq = wait_irq; - wait->irq.irqmask = irqmask; - wait->count = count; - omap_irq_register(dev, &wait->irq); - return wait; -} - -int omap_irq_wait(struct drm_device *dev, struct omap_irq_wait *wait, - unsigned long timeout) -{ - int ret = wait_event_timeout(wait_event, (wait->count <= 0), timeout); - omap_irq_unregister(dev, &wait->irq); - kfree(wait); - if (ret == 0) - return -1; - return 0; -} - -/** - * enable_vblank - enable vblank interrupt events - * @dev: DRM device - * @crtc: which irq to enable - * - * Enable vblank interrupts for @crtc. If the device doesn't have - * a hardware vblank counter, this routine should be a no-op, since - * interrupts will have to stay on to keep the count accurate. - * - * RETURNS - * Zero on success, appropriate errno if the given @crtc's vblank - * interrupt cannot be enabled. - */ -int omap_irq_enable_vblank(struct drm_device *dev, int crtc) -{ - struct omap_drm_private *priv = dev->dev_private; - unsigned long flags; - - DBG("dev=%p, crtc=%d", dev, crtc); - - dispc_runtime_get(); - spin_lock_irqsave(&list_lock, flags); - priv->vblank_mask |= pipe2vbl(crtc); - omap_irq_update(dev); - spin_unlock_irqrestore(&list_lock, flags); - dispc_runtime_put(); - - return 0; -} - -/** - * disable_vblank - disable vblank interrupt events - * @dev: DRM device - * @crtc: which irq to enable - * - * Disable vblank interrupts for @crtc. If the device doesn't have - * a hardware vblank counter, this routine should be a no-op, since - * interrupts will have to stay on to keep the count accurate. - */ -void omap_irq_disable_vblank(struct drm_device *dev, int crtc) -{ - struct omap_drm_private *priv = dev->dev_private; - unsigned long flags; - - DBG("dev=%p, crtc=%d", dev, crtc); - - dispc_runtime_get(); - spin_lock_irqsave(&list_lock, flags); - priv->vblank_mask &= ~pipe2vbl(crtc); - omap_irq_update(dev); - spin_unlock_irqrestore(&list_lock, flags); - dispc_runtime_put(); -} - -irqreturn_t omap_irq_handler(DRM_IRQ_ARGS) -{ - struct drm_device *dev = (struct drm_device *) arg; - struct omap_drm_private *priv = dev->dev_private; - struct omap_drm_irq *handler, *n; - unsigned long flags; - unsigned int id; - u32 irqstatus; - - irqstatus = dispc_read_irqstatus(); - dispc_clear_irqstatus(irqstatus); - dispc_read_irqstatus(); /* flush posted write */ - - VERB("irqs: %08x", irqstatus); - - for (id = 0; id < priv->num_crtcs; id++) - if (irqstatus & pipe2vbl(id)) - drm_handle_vblank(dev, id); - - spin_lock_irqsave(&list_lock, flags); - list_for_each_entry_safe(handler, n, &priv->irq_list, node) { - if (handler->irqmask & irqstatus) { - spin_unlock_irqrestore(&list_lock, flags); - handler->irq(handler, handler->irqmask & irqstatus); - spin_lock_irqsave(&list_lock, flags); - } - } - spin_unlock_irqrestore(&list_lock, flags); - - return IRQ_HANDLED; -} - -void omap_irq_preinstall(struct drm_device *dev) -{ - DBG("dev=%p", dev); - dispc_runtime_get(); - dispc_clear_irqstatus(0xffffffff); - dispc_runtime_put(); -} - -int omap_irq_postinstall(struct drm_device *dev) -{ - struct omap_drm_private *priv = dev->dev_private; - struct omap_drm_irq *error_handler = &priv->error_handler; - - DBG("dev=%p", dev); - - INIT_LIST_HEAD(&priv->irq_list); - - error_handler->irq = omap_irq_error_handler; - error_handler->irqmask = DISPC_IRQ_OCP_ERR; - - /* for now ignore DISPC_IRQ_SYNC_LOST_DIGIT.. really I think - * we just need to ignore it while enabling tv-out - */ - error_handler->irqmask &= ~DISPC_IRQ_SYNC_LOST_DIGIT; - - omap_irq_register(dev, error_handler); - - return 0; -} - -void omap_irq_uninstall(struct drm_device *dev) -{ - DBG("dev=%p", dev); - // TODO prolly need to call drm_irq_uninstall() somewhere too -} - -/* - * We need a special version, instead of just using drm_irq_install(), - * because we need to register the irq via omapdss. Once omapdss and - * omapdrm are merged together we can assign the dispc hwmod data to - * ourselves and drop these and just use drm_irq_{install,uninstall}() - */ - -int omap_drm_irq_install(struct drm_device *dev) -{ - int ret; - - mutex_lock(&dev->struct_mutex); - - if (dev->irq_enabled) { - mutex_unlock(&dev->struct_mutex); - return -EBUSY; - } - dev->irq_enabled = 1; - mutex_unlock(&dev->struct_mutex); - - /* Before installing handler */ - if (dev->driver->irq_preinstall) - dev->driver->irq_preinstall(dev); - - ret = dispc_request_irq(dev->driver->irq_handler, dev); - - if (ret < 0) { - mutex_lock(&dev->struct_mutex); - dev->irq_enabled = 0; - mutex_unlock(&dev->struct_mutex); - return ret; - } - - /* After installing handler */ - if (dev->driver->irq_postinstall) - ret = dev->driver->irq_postinstall(dev); - - if (ret < 0) { - mutex_lock(&dev->struct_mutex); - dev->irq_enabled = 0; - mutex_unlock(&dev->struct_mutex); - dispc_free_irq(dev); - } - - return ret; -} - -int omap_drm_irq_uninstall(struct drm_device *dev) -{ - unsigned long irqflags; - int irq_enabled, i; - - mutex_lock(&dev->struct_mutex); - irq_enabled = dev->irq_enabled; - dev->irq_enabled = 0; - mutex_unlock(&dev->struct_mutex); - - /* - * Wake up any waiters so they don't hang. - */ - if (dev->num_crtcs) { - spin_lock_irqsave(&dev->vbl_lock, irqflags); - for (i = 0; i < dev->num_crtcs; i++) { - DRM_WAKEUP(&dev->vbl_queue[i]); - dev->vblank_enabled[i] = 0; - dev->last_vblank[i] = - dev->driver->get_vblank_counter(dev, i); - } - spin_unlock_irqrestore(&dev->vbl_lock, irqflags); - } - - if (!irq_enabled) - return -EINVAL; - - if (dev->driver->irq_uninstall) - dev->driver->irq_uninstall(dev); - - dispc_free_irq(dev); - - return 0; -} diff --git a/trunk/drivers/staging/omapdrm/omap_plane.c b/trunk/drivers/staging/omapdrm/omap_plane.c index bb989d7f026d..2a8e5bab49c9 100644 --- a/trunk/drivers/staging/omapdrm/omap_plane.c +++ b/trunk/drivers/staging/omapdrm/omap_plane.c @@ -41,14 +41,12 @@ struct callback { struct omap_plane { struct drm_plane base; - int id; /* TODO rename omap_plane -> omap_plane_id in omapdss so I can use the enum */ - const char *name; + struct omap_overlay *ovl; struct omap_overlay_info info; - struct omap_drm_apply apply; /* position/orientation of scanout within the fb: */ struct omap_drm_window win; - bool enabled; + /* last fb that we pinned: */ struct drm_framebuffer *pinned_fb; @@ -56,15 +54,189 @@ struct omap_plane { uint32_t nformats; uint32_t formats[32]; - struct omap_drm_irq error_irq; + /* for synchronizing access to unpins fifo */ + struct mutex unpin_mutex; - /* set of bo's pending unpin until next post_apply() */ + /* set of bo's pending unpin until next END_WIN irq */ DECLARE_KFIFO_PTR(unpin_fifo, struct drm_gem_object *); + int num_unpins, pending_num_unpins; + + /* for deferred unpin when we need to wait for scanout complete irq */ + struct work_struct work; + + /* callback on next endwin irq */ + struct callback endwin; +}; - // XXX maybe get rid of this and handle vblank in crtc too? - struct callback apply_done_cb; +/* map from ovl->id to the irq we are interested in for scanout-done */ +static const uint32_t id2irq[] = { + [OMAP_DSS_GFX] = DISPC_IRQ_GFX_END_WIN, + [OMAP_DSS_VIDEO1] = DISPC_IRQ_VID1_END_WIN, + [OMAP_DSS_VIDEO2] = DISPC_IRQ_VID2_END_WIN, + [OMAP_DSS_VIDEO3] = DISPC_IRQ_VID3_END_WIN, }; +static void dispc_isr(void *arg, uint32_t mask) +{ + struct drm_plane *plane = arg; + struct omap_plane *omap_plane = to_omap_plane(plane); + struct omap_drm_private *priv = plane->dev->dev_private; + + omap_dispc_unregister_isr(dispc_isr, plane, + id2irq[omap_plane->ovl->id]); + + queue_work(priv->wq, &omap_plane->work); +} + +static void unpin_worker(struct work_struct *work) +{ + struct omap_plane *omap_plane = + container_of(work, struct omap_plane, work); + struct callback endwin; + + mutex_lock(&omap_plane->unpin_mutex); + DBG("unpinning %d of %d", omap_plane->num_unpins, + omap_plane->num_unpins + omap_plane->pending_num_unpins); + while (omap_plane->num_unpins > 0) { + struct drm_gem_object *bo = NULL; + int ret = kfifo_get(&omap_plane->unpin_fifo, &bo); + WARN_ON(!ret); + omap_gem_put_paddr(bo); + drm_gem_object_unreference_unlocked(bo); + omap_plane->num_unpins--; + } + endwin = omap_plane->endwin; + omap_plane->endwin.fxn = NULL; + mutex_unlock(&omap_plane->unpin_mutex); + + if (endwin.fxn) + endwin.fxn(endwin.arg); +} + +static void install_irq(struct drm_plane *plane) +{ + struct omap_plane *omap_plane = to_omap_plane(plane); + struct omap_overlay *ovl = omap_plane->ovl; + int ret; + + ret = omap_dispc_register_isr(dispc_isr, plane, id2irq[ovl->id]); + + /* + * omapdss has upper limit on # of registered irq handlers, + * which we shouldn't hit.. but if we do the limit should + * be raised or bad things happen: + */ + WARN_ON(ret == -EBUSY); +} + +/* push changes down to dss2 */ +static int commit(struct drm_plane *plane) +{ + struct drm_device *dev = plane->dev; + struct omap_plane *omap_plane = to_omap_plane(plane); + struct omap_overlay *ovl = omap_plane->ovl; + struct omap_overlay_info *info = &omap_plane->info; + int ret; + + DBG("%s", ovl->name); + DBG("%dx%d -> %dx%d (%d)", info->width, info->height, info->out_width, + info->out_height, info->screen_width); + DBG("%d,%d %08x %08x", info->pos_x, info->pos_y, + info->paddr, info->p_uv_addr); + + /* NOTE: do we want to do this at all here, or just wait + * for dpms(ON) since other CRTC's may not have their mode + * set yet, so fb dimensions may still change.. + */ + ret = ovl->set_overlay_info(ovl, info); + if (ret) { + dev_err(dev->dev, "could not set overlay info\n"); + return ret; + } + + mutex_lock(&omap_plane->unpin_mutex); + omap_plane->num_unpins += omap_plane->pending_num_unpins; + omap_plane->pending_num_unpins = 0; + mutex_unlock(&omap_plane->unpin_mutex); + + /* our encoder doesn't necessarily get a commit() after this, in + * particular in the dpms() and mode_set_base() cases, so force the + * manager to update: + * + * could this be in the encoder somehow? + */ + if (ovl->manager) { + ret = ovl->manager->apply(ovl->manager); + if (ret) { + dev_err(dev->dev, "could not apply settings\n"); + return ret; + } + + /* + * NOTE: really this should be atomic w/ mgr->apply() but + * omapdss does not expose such an API + */ + if (omap_plane->num_unpins > 0) + install_irq(plane); + + } else { + struct omap_drm_private *priv = dev->dev_private; + queue_work(priv->wq, &omap_plane->work); + } + + + if (ovl->is_enabled(ovl)) { + omap_framebuffer_flush(plane->fb, info->pos_x, info->pos_y, + info->out_width, info->out_height); + } + + return 0; +} + +/* when CRTC that we are attached to has potentially changed, this checks + * if we are attached to proper manager, and if necessary updates. + */ +static void update_manager(struct drm_plane *plane) +{ + struct omap_drm_private *priv = plane->dev->dev_private; + struct omap_plane *omap_plane = to_omap_plane(plane); + struct omap_overlay *ovl = omap_plane->ovl; + struct omap_overlay_manager *mgr = NULL; + int i; + + if (plane->crtc) { + for (i = 0; i < priv->num_encoders; i++) { + struct drm_encoder *encoder = priv->encoders[i]; + if (encoder->crtc == plane->crtc) { + mgr = omap_encoder_get_manager(encoder); + break; + } + } + } + + if (ovl->manager != mgr) { + bool enabled = ovl->is_enabled(ovl); + + /* don't switch things around with enabled overlays: */ + if (enabled) + omap_plane_dpms(plane, DRM_MODE_DPMS_OFF); + + if (ovl->manager) { + DBG("disconnecting %s from %s", ovl->name, + ovl->manager->name); + ovl->unset_manager(ovl); + } + + if (mgr) { + DBG("connecting %s to %s", ovl->name, mgr->name); + ovl->set_manager(ovl, mgr); + } + + if (enabled && mgr) + omap_plane_dpms(plane, DRM_MODE_DPMS_ON); + } +} + static void unpin(void *arg, struct drm_gem_object *bo) { struct drm_plane *plane = arg; @@ -72,6 +244,7 @@ static void unpin(void *arg, struct drm_gem_object *bo) if (kfifo_put(&omap_plane->unpin_fifo, (const struct drm_gem_object **)&bo)) { + omap_plane->pending_num_unpins++; /* also hold a ref so it isn't free'd while pinned */ drm_gem_object_reference(bo); } else { @@ -91,19 +264,13 @@ static int update_pin(struct drm_plane *plane, struct drm_framebuffer *fb) DBG("%p -> %p", pinned_fb, fb); - if (fb) - drm_framebuffer_reference(fb); - + mutex_lock(&omap_plane->unpin_mutex); ret = omap_framebuffer_replace(pinned_fb, fb, plane, unpin); - - if (pinned_fb) - drm_framebuffer_unreference(pinned_fb); + mutex_unlock(&omap_plane->unpin_mutex); if (ret) { dev_err(plane->dev->dev, "could not swap %p -> %p\n", omap_plane->pinned_fb, fb); - if (fb) - drm_framebuffer_unreference(fb); omap_plane->pinned_fb = NULL; return ret; } @@ -114,90 +281,31 @@ static int update_pin(struct drm_plane *plane, struct drm_framebuffer *fb) return 0; } -static void omap_plane_pre_apply(struct omap_drm_apply *apply) +/* update parameters that are dependent on the framebuffer dimensions and + * position within the fb that this plane scans out from. This is called + * when framebuffer or x,y base may have changed. + */ +static void update_scanout(struct drm_plane *plane) { - struct omap_plane *omap_plane = - container_of(apply, struct omap_plane, apply); - struct omap_drm_window *win = &omap_plane->win; - struct drm_plane *plane = &omap_plane->base; - struct drm_device *dev = plane->dev; + struct omap_plane *omap_plane = to_omap_plane(plane); struct omap_overlay_info *info = &omap_plane->info; - struct drm_crtc *crtc = plane->crtc; - enum omap_channel channel; - bool enabled = omap_plane->enabled && crtc; - bool ilace, replication; + struct omap_drm_window *win = &omap_plane->win; int ret; - DBG("%s, enabled=%d", omap_plane->name, enabled); - - /* if fb has changed, pin new fb: */ - update_pin(plane, enabled ? plane->fb : NULL); - - if (!enabled) { - dispc_ovl_enable(omap_plane->id, false); + ret = update_pin(plane, plane->fb); + if (ret) { + dev_err(plane->dev->dev, + "could not pin fb: %d\n", ret); + omap_plane_dpms(plane, DRM_MODE_DPMS_OFF); return; } - channel = omap_crtc_channel(crtc); - - /* update scanout: */ omap_framebuffer_update_scanout(plane->fb, win, info); - DBG("%dx%d -> %dx%d (%d)", info->width, info->height, - info->out_width, info->out_height, + DBG("%s: %d,%d: %08x %08x (%d)", omap_plane->ovl->name, + win->src_x, win->src_y, + (u32)info->paddr, (u32)info->p_uv_addr, info->screen_width); - DBG("%d,%d %08x %08x", info->pos_x, info->pos_y, - info->paddr, info->p_uv_addr); - - /* TODO: */ - ilace = false; - replication = false; - - /* and finally, update omapdss: */ - ret = dispc_ovl_setup(omap_plane->id, info, - replication, omap_crtc_timings(crtc), false); - if (ret) { - dev_err(dev->dev, "dispc_ovl_setup failed: %d\n", ret); - return; - } - - dispc_ovl_enable(omap_plane->id, true); - dispc_ovl_set_channel_out(omap_plane->id, channel); -} - -static void omap_plane_post_apply(struct omap_drm_apply *apply) -{ - struct omap_plane *omap_plane = - container_of(apply, struct omap_plane, apply); - struct drm_plane *plane = &omap_plane->base; - struct omap_overlay_info *info = &omap_plane->info; - struct drm_gem_object *bo = NULL; - struct callback cb; - - cb = omap_plane->apply_done_cb; - omap_plane->apply_done_cb.fxn = NULL; - - while (kfifo_get(&omap_plane->unpin_fifo, &bo)) { - omap_gem_put_paddr(bo); - drm_gem_object_unreference_unlocked(bo); - } - - if (cb.fxn) - cb.fxn(cb.arg); - - if (omap_plane->enabled) { - omap_framebuffer_flush(plane->fb, info->pos_x, info->pos_y, - info->out_width, info->out_height); - } -} - -static int apply(struct drm_plane *plane) -{ - if (plane->crtc) { - struct omap_plane *omap_plane = to_omap_plane(plane); - return omap_crtc_apply(plane->crtc, &omap_plane->apply); - } - return 0; } int omap_plane_mode_set(struct drm_plane *plane, @@ -205,8 +313,7 @@ int omap_plane_mode_set(struct drm_plane *plane, int crtc_x, int crtc_y, unsigned int crtc_w, unsigned int crtc_h, uint32_t src_x, uint32_t src_y, - uint32_t src_w, uint32_t src_h, - void (*fxn)(void *), void *arg) + uint32_t src_w, uint32_t src_h) { struct omap_plane *omap_plane = to_omap_plane(plane); struct omap_drm_window *win = &omap_plane->win; @@ -222,20 +329,17 @@ int omap_plane_mode_set(struct drm_plane *plane, win->src_w = src_w >> 16; win->src_h = src_h >> 16; - if (fxn) { - /* omap_crtc should ensure that a new page flip - * isn't permitted while there is one pending: - */ - BUG_ON(omap_plane->apply_done_cb.fxn); - - omap_plane->apply_done_cb.fxn = fxn; - omap_plane->apply_done_cb.arg = arg; - } - + /* note: this is done after this fxn returns.. but if we need + * to do a commit/update_scanout, etc before this returns we + * need the current value. + */ plane->fb = fb; plane->crtc = crtc; - return apply(plane); + update_scanout(plane); + update_manager(plane); + + return 0; } static int omap_plane_update(struct drm_plane *plane, @@ -245,12 +349,9 @@ static int omap_plane_update(struct drm_plane *plane, uint32_t src_x, uint32_t src_y, uint32_t src_w, uint32_t src_h) { - struct omap_plane *omap_plane = to_omap_plane(plane); - omap_plane->enabled = true; - return omap_plane_mode_set(plane, crtc, fb, - crtc_x, crtc_y, crtc_w, crtc_h, - src_x, src_y, src_w, src_h, - NULL, NULL); + omap_plane_mode_set(plane, crtc, fb, crtc_x, crtc_y, crtc_w, crtc_h, + src_x, src_y, src_w, src_h); + return omap_plane_dpms(plane, DRM_MODE_DPMS_ON); } static int omap_plane_disable(struct drm_plane *plane) @@ -263,32 +364,48 @@ static int omap_plane_disable(struct drm_plane *plane) static void omap_plane_destroy(struct drm_plane *plane) { struct omap_plane *omap_plane = to_omap_plane(plane); - - DBG("%s", omap_plane->name); - - omap_irq_unregister(plane->dev, &omap_plane->error_irq); - + DBG("%s", omap_plane->ovl->name); omap_plane_disable(plane); drm_plane_cleanup(plane); - - WARN_ON(!kfifo_is_empty(&omap_plane->unpin_fifo)); + WARN_ON(omap_plane->pending_num_unpins + omap_plane->num_unpins > 0); kfifo_free(&omap_plane->unpin_fifo); - kfree(omap_plane); } int omap_plane_dpms(struct drm_plane *plane, int mode) { struct omap_plane *omap_plane = to_omap_plane(plane); - bool enabled = (mode == DRM_MODE_DPMS_ON); - int ret = 0; + struct omap_overlay *ovl = omap_plane->ovl; + int r; - if (enabled != omap_plane->enabled) { - omap_plane->enabled = enabled; - ret = apply(plane); + DBG("%s: %d", omap_plane->ovl->name, mode); + + if (mode == DRM_MODE_DPMS_ON) { + update_scanout(plane); + r = commit(plane); + if (!r) + r = ovl->enable(ovl); + } else { + struct omap_drm_private *priv = plane->dev->dev_private; + r = ovl->disable(ovl); + update_pin(plane, NULL); + queue_work(priv->wq, &omap_plane->work); } - return ret; + return r; +} + +void omap_plane_on_endwin(struct drm_plane *plane, + void (*fxn)(void *), void *arg) +{ + struct omap_plane *omap_plane = to_omap_plane(plane); + + mutex_lock(&omap_plane->unpin_mutex); + omap_plane->endwin.fxn = fxn; + omap_plane->endwin.arg = arg; + mutex_unlock(&omap_plane->unpin_mutex); + + install_irq(plane); } /* helper to install properties which are common to planes and crtcs */ @@ -337,13 +454,25 @@ int omap_plane_set_property(struct drm_plane *plane, int ret = -EINVAL; if (property == priv->rotation_prop) { - DBG("%s: rotation: %02x", omap_plane->name, (uint32_t)val); + struct omap_overlay *ovl = omap_plane->ovl; + + DBG("%s: rotation: %02x", ovl->name, (uint32_t)val); omap_plane->win.rotation = val; - ret = apply(plane); + + if (ovl->is_enabled(ovl)) + ret = omap_plane_dpms(plane, DRM_MODE_DPMS_ON); + else + ret = 0; } else if (property == priv->zorder_prop) { - DBG("%s: zorder: %02x", omap_plane->name, (uint32_t)val); + struct omap_overlay *ovl = omap_plane->ovl; + + DBG("%s: zorder: %d", ovl->name, (uint32_t)val); omap_plane->info.zorder = val; - ret = apply(plane); + + if (ovl->is_enabled(ovl)) + ret = omap_plane_dpms(plane, DRM_MODE_DPMS_ON); + else + ret = 0; } return ret; @@ -356,38 +485,20 @@ static const struct drm_plane_funcs omap_plane_funcs = { .set_property = omap_plane_set_property, }; -static void omap_plane_error_irq(struct omap_drm_irq *irq, uint32_t irqstatus) -{ - struct omap_plane *omap_plane = - container_of(irq, struct omap_plane, error_irq); - DRM_ERROR("%s: errors: %08x\n", omap_plane->name, irqstatus); -} - -static const char *plane_names[] = { - [OMAP_DSS_GFX] = "gfx", - [OMAP_DSS_VIDEO1] = "vid1", - [OMAP_DSS_VIDEO2] = "vid2", - [OMAP_DSS_VIDEO3] = "vid3", -}; - -static const uint32_t error_irqs[] = { - [OMAP_DSS_GFX] = DISPC_IRQ_GFX_FIFO_UNDERFLOW, - [OMAP_DSS_VIDEO1] = DISPC_IRQ_VID1_FIFO_UNDERFLOW, - [OMAP_DSS_VIDEO2] = DISPC_IRQ_VID2_FIFO_UNDERFLOW, - [OMAP_DSS_VIDEO3] = DISPC_IRQ_VID3_FIFO_UNDERFLOW, -}; - /* initialize plane */ struct drm_plane *omap_plane_init(struct drm_device *dev, - int id, bool private_plane) + struct omap_overlay *ovl, unsigned int possible_crtcs, + bool priv) { - struct omap_drm_private *priv = dev->dev_private; struct drm_plane *plane = NULL; struct omap_plane *omap_plane; - struct omap_overlay_info *info; int ret; - DBG("%s: priv=%d", plane_names[id], private_plane); + DBG("%s: possible_crtcs=%08x, priv=%d", ovl->name, + possible_crtcs, priv); + + /* friendly reminder to update table for future hw: */ + WARN_ON(ovl->id >= ARRAY_SIZE(id2irq)); omap_plane = kzalloc(sizeof(*omap_plane), GFP_KERNEL); if (!omap_plane) { @@ -395,50 +506,47 @@ struct drm_plane *omap_plane_init(struct drm_device *dev, goto fail; } + mutex_init(&omap_plane->unpin_mutex); + ret = kfifo_alloc(&omap_plane->unpin_fifo, 16, GFP_KERNEL); if (ret) { dev_err(dev->dev, "could not allocate unpin FIFO\n"); goto fail; } + INIT_WORK(&omap_plane->work, unpin_worker); + omap_plane->nformats = omap_framebuffer_get_formats( omap_plane->formats, ARRAY_SIZE(omap_plane->formats), - dss_feat_get_supported_color_modes(id)); - omap_plane->id = id; - omap_plane->name = plane_names[id]; - + ovl->supported_modes); + omap_plane->ovl = ovl; plane = &omap_plane->base; - omap_plane->apply.pre_apply = omap_plane_pre_apply; - omap_plane->apply.post_apply = omap_plane_post_apply; - - omap_plane->error_irq.irqmask = error_irqs[id]; - omap_plane->error_irq.irq = omap_plane_error_irq; - omap_irq_register(dev, &omap_plane->error_irq); - - drm_plane_init(dev, plane, (1 << priv->num_crtcs) - 1, &omap_plane_funcs, - omap_plane->formats, omap_plane->nformats, private_plane); + drm_plane_init(dev, plane, possible_crtcs, &omap_plane_funcs, + omap_plane->formats, omap_plane->nformats, priv); omap_plane_install_properties(plane, &plane->base); /* get our starting configuration, set defaults for parameters * we don't currently use, etc: */ - info = &omap_plane->info; - info->rotation_type = OMAP_DSS_ROT_DMA; - info->rotation = OMAP_DSS_ROT_0; - info->global_alpha = 0xff; - info->mirror = 0; + ovl->get_overlay_info(ovl, &omap_plane->info); + omap_plane->info.rotation_type = OMAP_DSS_ROT_DMA; + omap_plane->info.rotation = OMAP_DSS_ROT_0; + omap_plane->info.global_alpha = 0xff; + omap_plane->info.mirror = 0; /* Set defaults depending on whether we are a CRTC or overlay * layer. * TODO add ioctl to give userspace an API to change this.. this * will come in a subsequent patch. */ - if (private_plane) + if (priv) omap_plane->info.zorder = 0; else - omap_plane->info.zorder = id; + omap_plane->info.zorder = ovl->id; + + update_manager(plane); return plane; diff --git a/trunk/drivers/staging/rtl8187se/r8180_core.c b/trunk/drivers/staging/rtl8187se/r8180_core.c index d10d75e8a33f..ae38475854b5 100644 --- a/trunk/drivers/staging/rtl8187se/r8180_core.c +++ b/trunk/drivers/staging/rtl8187se/r8180_core.c @@ -937,8 +937,7 @@ short alloc_rx_desc_ring(struct net_device *dev, u16 bufsize, int count) dma_tmp = pci_map_single(pdev, buf, bufsize * sizeof(u8), PCI_DMA_FROMDEVICE); - if (pci_dma_mapping_error(pdev, dma_tmp)) - return -1; + if (-1 == buffer_add(&(priv->rxbuffer), buf, dma_tmp, &(priv->rxbufferhead))) { DMESGE("Unable to allocate mem RX buf"); diff --git a/trunk/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/trunk/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index a9d78e9651c6..808aab6fa5ef 100644 --- a/trunk/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/trunk/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -1183,8 +1183,6 @@ void rtl8192_tx_fill_desc(struct net_device *dev, struct tx_desc *pdesc, pTxFwInfo->TxRate, cb_desc); - if (pci_dma_mapping_error(priv->pdev, mapping)) - RT_TRACE(COMP_ERR, "DMA Mapping error\n");; if (cb_desc->bAMPDUEnable) { pTxFwInfo->AllowAggregation = 1; pTxFwInfo->RxMF = cb_desc->ampdu_factor; @@ -1282,8 +1280,6 @@ void rtl8192_tx_fill_cmd_desc(struct net_device *dev, dma_addr_t mapping = pci_map_single(priv->pdev, skb->data, skb->len, PCI_DMA_TODEVICE); - if (pci_dma_mapping_error(priv->pdev, mapping)) - RT_TRACE(COMP_ERR, "DMA Mapping error\n");; memset(entry, 0, 12); entry->LINIP = cb_desc->bLastIniPkt; entry->FirstSeg = 1; diff --git a/trunk/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/trunk/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 4ebf99b30975..1a70f324552f 100644 --- a/trunk/drivers/staging/rtl8192e/rtl8192e/rtl_core.c +++ b/trunk/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -2104,10 +2104,7 @@ static short rtl8192_alloc_rx_desc_ring(struct net_device *dev) skb_tail_pointer_rsl(skb), priv->rxbuffersize, PCI_DMA_FROMDEVICE); - if (pci_dma_mapping_error(priv->pdev, *mapping)) { - dev_kfree_skb_any(skb); - return -1; - } + entry->BufferAddress = cpu_to_le32(*mapping); entry->Length = priv->rxbuffersize; @@ -2400,11 +2397,7 @@ static void rtl8192_rx_normal(struct net_device *dev) skb_tail_pointer_rsl(skb), priv->rxbuffersize, PCI_DMA_FROMDEVICE); - if (pci_dma_mapping_error(priv->pdev, - *((dma_addr_t *)skb->cb))) { - dev_kfree_skb_any(skb); - return; - } + } done: pdesc->BufferAddress = cpu_to_le32(*((dma_addr_t *)skb->cb)); diff --git a/trunk/drivers/staging/rtl8712/usb_intf.c b/trunk/drivers/staging/rtl8712/usb_intf.c index a96cd06d69dd..6b73843e580a 100644 --- a/trunk/drivers/staging/rtl8712/usb_intf.c +++ b/trunk/drivers/staging/rtl8712/usb_intf.c @@ -63,8 +63,6 @@ static struct usb_device_id rtl871x_usb_id_tbl[] = { {USB_DEVICE(0x0B05, 0x1791)}, /* 11n mode disable */ /* Belkin */ {USB_DEVICE(0x050D, 0x945A)}, - /* ISY IWL - Belkin clone */ - {USB_DEVICE(0x050D, 0x11F1)}, /* Corega */ {USB_DEVICE(0x07AA, 0x0047)}, /* D-Link */ diff --git a/trunk/drivers/staging/sb105x/Kconfig b/trunk/drivers/staging/sb105x/Kconfig index 1facad625554..ac87c5e38dee 100644 --- a/trunk/drivers/staging/sb105x/Kconfig +++ b/trunk/drivers/staging/sb105x/Kconfig @@ -2,7 +2,6 @@ config SB105X tristate "SystemBase PCI Multiport UART" select SERIAL_CORE depends on PCI - depends on X86 help A driver for the SystemBase Multi-2/PCI serial card diff --git a/trunk/drivers/staging/sb105x/sb_pci_mp.c b/trunk/drivers/staging/sb105x/sb_pci_mp.c index 9464f3874346..edb2a85b9d52 100644 --- a/trunk/drivers/staging/sb105x/sb_pci_mp.c +++ b/trunk/drivers/staging/sb105x/sb_pci_mp.c @@ -3054,7 +3054,6 @@ static int init_mp_dev(struct pci_dev *pcidev, mppcibrd_t brd) sbdev->nr_ports = ((portnum_hex/16)*10) + (portnum_hex % 16); } break; -#ifdef CONFIG_PARPORT_PC case PCI_DEVICE_ID_MP2S1P : sbdev->nr_ports = 2; @@ -3074,7 +3073,6 @@ static int init_mp_dev(struct pci_dev *pcidev, mppcibrd_t brd) /* add PC compatible parallel port */ parport_pc_probe_port(pcidev->resource[2].start, pcidev->resource[3].start, PARPORT_IRQ_NONE, PARPORT_DMA_NONE, &pcidev->dev, 0); break; -#endif } ret = request_region(sbdev->uart_access_addr, (8*sbdev->nr_ports), sbdev->name); diff --git a/trunk/drivers/staging/speakup/synth.c b/trunk/drivers/staging/speakup/synth.c index 7616f058a00b..df9533798095 100644 --- a/trunk/drivers/staging/speakup/synth.c +++ b/trunk/drivers/staging/speakup/synth.c @@ -342,7 +342,7 @@ int synth_init(char *synth_name) mutex_lock(&spk_mutex); /* First, check if we already have it loaded. */ - for (i = 0; i < MAXSYNTHS && synths[i] != NULL; i++) + for (i = 0; synths[i] != NULL && i < MAXSYNTHS; i++) if (strcmp(synths[i]->name, synth_name) == 0) synth = synths[i]; @@ -423,7 +423,7 @@ int synth_add(struct spk_synth *in_synth) int i; int status = 0; mutex_lock(&spk_mutex); - for (i = 0; i < MAXSYNTHS && synths[i] != NULL; i++) + for (i = 0; synths[i] != NULL && i < MAXSYNTHS; i++) /* synth_remove() is responsible for rotating the array down */ if (in_synth == synths[i]) { mutex_unlock(&spk_mutex); diff --git a/trunk/drivers/staging/tidspbridge/core/_tiomap.h b/trunk/drivers/staging/tidspbridge/core/_tiomap.h index b783bfa59b1c..543a127c7d4d 100644 --- a/trunk/drivers/staging/tidspbridge/core/_tiomap.h +++ b/trunk/drivers/staging/tidspbridge/core/_tiomap.h @@ -31,7 +31,7 @@ * driver should read or write to PRM/CM registers directly; they * should rely on OMAP core code to do this. */ -#include +#include #include #include #include diff --git a/trunk/drivers/staging/tidspbridge/core/dsp-clock.c b/trunk/drivers/staging/tidspbridge/core/dsp-clock.c index 2f084e181d39..b647207928b1 100644 --- a/trunk/drivers/staging/tidspbridge/core/dsp-clock.c +++ b/trunk/drivers/staging/tidspbridge/core/dsp-clock.c @@ -121,13 +121,9 @@ void dsp_clk_exit(void) for (i = 0; i < DM_TIMER_CLOCKS; i++) omap_dm_timer_free(timer[i]); - clk_unprepare(iva2_clk); clk_put(iva2_clk); - clk_unprepare(ssi.sst_fck); clk_put(ssi.sst_fck); - clk_unprepare(ssi.ssr_fck); clk_put(ssi.ssr_fck); - clk_unprepare(ssi.ick); clk_put(ssi.ick); } @@ -149,21 +145,14 @@ void dsp_clk_init(void) iva2_clk = clk_get(&dspbridge_device.dev, "iva2_ck"); if (IS_ERR(iva2_clk)) dev_err(bridge, "failed to get iva2 clock %p\n", iva2_clk); - else - clk_prepare(iva2_clk); ssi.sst_fck = clk_get(&dspbridge_device.dev, "ssi_sst_fck"); ssi.ssr_fck = clk_get(&dspbridge_device.dev, "ssi_ssr_fck"); ssi.ick = clk_get(&dspbridge_device.dev, "ssi_ick"); - if (IS_ERR(ssi.sst_fck) || IS_ERR(ssi.ssr_fck) || IS_ERR(ssi.ick)) { + if (IS_ERR(ssi.sst_fck) || IS_ERR(ssi.ssr_fck) || IS_ERR(ssi.ick)) dev_err(bridge, "failed to get ssi: sst %p, ssr %p, ick %p\n", ssi.sst_fck, ssi.ssr_fck, ssi.ick); - } else { - clk_prepare(ssi.sst_fck); - clk_prepare(ssi.ssr_fck); - clk_prepare(ssi.ick); - } } /** diff --git a/trunk/drivers/staging/tidspbridge/core/wdt.c b/trunk/drivers/staging/tidspbridge/core/wdt.c index 7ff0e6c98039..1dce36fb828f 100644 --- a/trunk/drivers/staging/tidspbridge/core/wdt.c +++ b/trunk/drivers/staging/tidspbridge/core/wdt.c @@ -63,15 +63,11 @@ int dsp_wdt_init(void) dsp_wdt.fclk = clk_get(NULL, "wdt3_fck"); if (!IS_ERR(dsp_wdt.fclk)) { - clk_prepare(dsp_wdt.fclk); - dsp_wdt.iclk = clk_get(NULL, "wdt3_ick"); if (IS_ERR(dsp_wdt.iclk)) { clk_put(dsp_wdt.fclk); dsp_wdt.fclk = NULL; ret = -EFAULT; - } else { - clk_prepare(dsp_wdt.iclk); } } else ret = -EFAULT; @@ -99,14 +95,10 @@ void dsp_wdt_exit(void) free_irq(INT_34XX_WDT3_IRQ, &dsp_wdt); tasklet_kill(&dsp_wdt.wdt3_tasklet); - if (dsp_wdt.fclk) { - clk_unprepare(dsp_wdt.fclk); + if (dsp_wdt.fclk) clk_put(dsp_wdt.fclk); - } - if (dsp_wdt.iclk) { - clk_unprepare(dsp_wdt.iclk); + if (dsp_wdt.iclk) clk_put(dsp_wdt.iclk); - } dsp_wdt.fclk = NULL; dsp_wdt.iclk = NULL; diff --git a/trunk/drivers/staging/vme/devices/vme_pio2_core.c b/trunk/drivers/staging/vme/devices/vme_pio2_core.c index bf73ba26e88a..0331178ca3b3 100644 --- a/trunk/drivers/staging/vme/devices/vme_pio2_core.c +++ b/trunk/drivers/staging/vme/devices/vme_pio2_core.c @@ -162,9 +162,11 @@ static struct vme_driver pio2_driver = { static int __init pio2_init(void) { + int retval = 0; + if (bus_num == 0) { pr_err("No cards, skipping registration\n"); - return -ENODEV; + goto err_nocard; } if (bus_num > PIO2_CARDS_MAX) { @@ -174,7 +176,15 @@ static int __init pio2_init(void) } /* Register the PIO2 driver */ - return vme_register_driver(&pio2_driver, bus_num); + retval = vme_register_driver(&pio2_driver, bus_num); + if (retval != 0) + goto err_reg; + + return retval; + +err_reg: +err_nocard: + return retval; } static int pio2_match(struct vme_dev *vdev) diff --git a/trunk/drivers/staging/vt6656/bssdb.h b/trunk/drivers/staging/vt6656/bssdb.h index 806cbf72fb59..6b2ec390e775 100644 --- a/trunk/drivers/staging/vt6656/bssdb.h +++ b/trunk/drivers/staging/vt6656/bssdb.h @@ -90,6 +90,7 @@ typedef struct tagSRSNCapObject { } SRSNCapObject, *PSRSNCapObject; // BSS info(AP) +#pragma pack(1) typedef struct tagKnownBSS { // BSS info BOOL bActive; diff --git a/trunk/drivers/staging/vt6656/int.h b/trunk/drivers/staging/vt6656/int.h index e0d2b07ba608..5d8faf9f96ec 100644 --- a/trunk/drivers/staging/vt6656/int.h +++ b/trunk/drivers/staging/vt6656/int.h @@ -34,6 +34,7 @@ #include "device.h" /*--------------------- Export Definitions -------------------------*/ +#pragma pack(1) typedef struct tagSINTData { BYTE byTSR0; BYTE byPkt0; diff --git a/trunk/drivers/staging/vt6656/iocmd.h b/trunk/drivers/staging/vt6656/iocmd.h index ae6e2d237b20..22710cef751d 100644 --- a/trunk/drivers/staging/vt6656/iocmd.h +++ b/trunk/drivers/staging/vt6656/iocmd.h @@ -95,12 +95,13 @@ typedef enum tagWZONETYPE { // Ioctl interface structure // Command structure // +#pragma pack(1) typedef struct tagSCmdRequest { u8 name[16]; void *data; u16 wResult; u16 wCmdCode; -} __packed SCmdRequest, *PSCmdRequest; +} SCmdRequest, *PSCmdRequest; // // Scan @@ -110,7 +111,7 @@ typedef struct tagSCmdScan { u8 ssid[SSID_MAXLEN + 2]; -} __packed SCmdScan, *PSCmdScan; +} SCmdScan, *PSCmdScan; // // BSS Join @@ -125,7 +126,7 @@ typedef struct tagSCmdBSSJoin { BOOL bPSEnable; BOOL bShareKeyAuth; -} __packed SCmdBSSJoin, *PSCmdBSSJoin; +} SCmdBSSJoin, *PSCmdBSSJoin; // // Zonetype Setting @@ -136,7 +137,7 @@ typedef struct tagSCmdZoneTypeSet { BOOL bWrite; WZONETYPE ZoneType; -} __packed SCmdZoneTypeSet, *PSCmdZoneTypeSet; +} SCmdZoneTypeSet, *PSCmdZoneTypeSet; typedef struct tagSWPAResult { char ifname[100]; @@ -144,7 +145,7 @@ typedef struct tagSWPAResult { u8 key_mgmt; u8 eap_type; BOOL authenticated; -} __packed SWPAResult, *PSWPAResult; +} SWPAResult, *PSWPAResult; typedef struct tagSCmdStartAP { @@ -156,7 +157,7 @@ typedef struct tagSCmdStartAP { BOOL bShareKeyAuth; u8 byBasicRate; -} __packed SCmdStartAP, *PSCmdStartAP; +} SCmdStartAP, *PSCmdStartAP; typedef struct tagSCmdSetWEP { @@ -166,7 +167,7 @@ typedef struct tagSCmdSetWEP { BOOL bWepKeyAvailable[WEP_NKEYS]; u32 auWepKeyLength[WEP_NKEYS]; -} __packed SCmdSetWEP, *PSCmdSetWEP; +} SCmdSetWEP, *PSCmdSetWEP; typedef struct tagSBSSIDItem { @@ -179,14 +180,14 @@ typedef struct tagSBSSIDItem { BOOL bWEPOn; u32 uRSSI; -} __packed SBSSIDItem; +} SBSSIDItem; typedef struct tagSBSSIDList { u32 uItem; SBSSIDItem sBSSIDList[0]; -} __packed SBSSIDList, *PSBSSIDList; +} SBSSIDList, *PSBSSIDList; typedef struct tagSNodeItem { @@ -207,7 +208,7 @@ typedef struct tagSNodeItem { u32 uTxAttempts; u16 wFailureRatio; -} __packed SNodeItem; +} SNodeItem; typedef struct tagSNodeList { @@ -215,7 +216,7 @@ typedef struct tagSNodeList { u32 uItem; SNodeItem sNodeList[0]; -} __packed SNodeList, *PSNodeList; +} SNodeList, *PSNodeList; typedef struct tagSCmdLinkStatus { @@ -228,7 +229,7 @@ typedef struct tagSCmdLinkStatus { u32 uChannel; u32 uLinkRate; -} __packed SCmdLinkStatus, *PSCmdLinkStatus; +} SCmdLinkStatus, *PSCmdLinkStatus; // // 802.11 counter @@ -246,7 +247,7 @@ typedef struct tagSDot11MIBCount { u32 ReceivedFragmentCount; u32 MulticastReceivedFrameCount; u32 FCSErrorCount; -} __packed SDot11MIBCount, *PSDot11MIBCount; +} SDot11MIBCount, *PSDot11MIBCount; @@ -354,13 +355,13 @@ typedef struct tagSStatMIBCount { u32 ullTxBroadcastBytes[2]; u32 ullTxMulticastBytes[2]; u32 ullTxDirectedBytes[2]; -} __packed SStatMIBCount, *PSStatMIBCount; +} SStatMIBCount, *PSStatMIBCount; typedef struct tagSCmdValue { u32 dwValue; -} __packed SCmdValue, *PSCmdValue; +} SCmdValue, *PSCmdValue; // // hostapd & viawget ioctl related @@ -430,7 +431,7 @@ struct viawget_hostapd_param { u8 ssid[32]; } scan_req; } u; -} __packed; +}; /*--------------------- Export Classes ----------------------------*/ diff --git a/trunk/drivers/staging/vt6656/iowpa.h b/trunk/drivers/staging/vt6656/iowpa.h index 2522ddec718d..959c8868f6e2 100644 --- a/trunk/drivers/staging/vt6656/iowpa.h +++ b/trunk/drivers/staging/vt6656/iowpa.h @@ -67,11 +67,12 @@ enum { +#pragma pack(1) typedef struct viawget_wpa_header { u8 type; u16 req_ie_len; u16 resp_ie_len; -} __packed viawget_wpa_header; +} viawget_wpa_header; struct viawget_wpa_param { u32 cmd; @@ -112,8 +113,9 @@ struct viawget_wpa_param { u8 *buf; } scan_results; } u; -} __packed; +}; +#pragma pack(1) struct viawget_scan_result { u8 bssid[6]; u8 ssid[32]; @@ -128,7 +130,7 @@ struct viawget_scan_result { int noise; int level; int maxrate; -} __packed; +}; /*--------------------- Export Classes ----------------------------*/ diff --git a/trunk/drivers/staging/wlan-ng/cfg80211.c b/trunk/drivers/staging/wlan-ng/cfg80211.c index 1d31eab19d16..18c06a59c091 100644 --- a/trunk/drivers/staging/wlan-ng/cfg80211.c +++ b/trunk/drivers/staging/wlan-ng/cfg80211.c @@ -638,8 +638,8 @@ int prism2_leave_ibss(struct wiphy *wiphy, struct net_device *dev) } -int prism2_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, - enum nl80211_tx_power_setting type, int mbm) +int prism2_set_tx_power(struct wiphy *wiphy, enum nl80211_tx_power_setting type, + int mbm) { struct prism2_wiphy_private *priv = wiphy_priv(wiphy); wlandevice_t *wlandev = priv->wlandev; @@ -665,8 +665,7 @@ int prism2_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, return err; } -int prism2_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, - int *dbm) +int prism2_get_tx_power(struct wiphy *wiphy, int *dbm) { struct prism2_wiphy_private *priv = wiphy_priv(wiphy); wlandevice_t *wlandev = priv->wlandev; diff --git a/trunk/drivers/staging/wlan-ng/prism2mgmt.c b/trunk/drivers/staging/wlan-ng/prism2mgmt.c index 89bfd858bb28..4efa9bc0fcf0 100644 --- a/trunk/drivers/staging/wlan-ng/prism2mgmt.c +++ b/trunk/drivers/staging/wlan-ng/prism2mgmt.c @@ -406,7 +406,7 @@ int prism2mgmt_scan_results(wlandevice_t *wlandev, void *msgp) /* SSID */ req->ssid.status = P80211ENUM_msgitem_status_data_ok; req->ssid.data.len = le16_to_cpu(item->ssid.len); - req->ssid.data.len = min_t(u16, req->ssid.data.len, WLAN_SSID_MAXLEN); + req->ssid.data.len = min_t(u16, req->ssid.data.len, WLAN_BSSID_LEN); memcpy(req->ssid.data.data, item->ssid.data, req->ssid.data.len); /* supported rates */ diff --git a/trunk/drivers/staging/zram/zram_drv.c b/trunk/drivers/staging/zram/zram_drv.c index f2a73bd739fb..fb4a7c94aed3 100644 --- a/trunk/drivers/staging/zram/zram_drv.c +++ b/trunk/drivers/staging/zram/zram_drv.c @@ -265,7 +265,7 @@ static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec, static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, int offset) { - int ret = 0; + int ret; size_t clen; unsigned long handle; struct page *page; @@ -286,8 +286,10 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, goto out; } ret = zram_decompress_page(zram, uncmem, index); - if (ret) + if (ret) { + kfree(uncmem); goto out; + } } /* @@ -300,18 +302,16 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, user_mem = kmap_atomic(page); - if (is_partial_io(bvec)) { + if (is_partial_io(bvec)) memcpy(uncmem + offset, user_mem + bvec->bv_offset, bvec->bv_len); - kunmap_atomic(user_mem); - user_mem = NULL; - } else { + else uncmem = user_mem; - } if (page_zero_filled(uncmem)) { - if (!is_partial_io(bvec)) - kunmap_atomic(user_mem); + kunmap_atomic(user_mem); + if (is_partial_io(bvec)) + kfree(uncmem); zram_stat_inc(&zram->stats.pages_zero); zram_set_flag(zram, index, ZRAM_ZERO); ret = 0; @@ -321,11 +321,9 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, ret = lzo1x_1_compress(uncmem, PAGE_SIZE, src, &clen, zram->compress_workmem); - if (!is_partial_io(bvec)) { - kunmap_atomic(user_mem); - user_mem = NULL; - uncmem = NULL; - } + kunmap_atomic(user_mem); + if (is_partial_io(bvec)) + kfree(uncmem); if (unlikely(ret != LZO_E_OK)) { pr_err("Compression failed! err=%d\n", ret); @@ -334,10 +332,8 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, if (unlikely(clen > max_zpage_size)) { zram_stat_inc(&zram->stats.bad_compress); + src = uncmem; clen = PAGE_SIZE; - src = NULL; - if (is_partial_io(bvec)) - src = uncmem; } handle = zs_malloc(zram->mem_pool, clen); @@ -349,11 +345,7 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, } cmem = zs_map_object(zram->mem_pool, handle, ZS_MM_WO); - if ((clen == PAGE_SIZE) && !is_partial_io(bvec)) - src = kmap_atomic(page); memcpy(cmem, src, clen); - if ((clen == PAGE_SIZE) && !is_partial_io(bvec)) - kunmap_atomic(src); zs_unmap_object(zram->mem_pool, handle); @@ -366,10 +358,9 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, if (clen <= PAGE_SIZE / 2) zram_stat_inc(&zram->stats.good_compress); -out: - if (is_partial_io(bvec)) - kfree(uncmem); + return 0; +out: if (ret) zram_stat64_inc(zram, &zram->stats.failed_writes); return ret; diff --git a/trunk/drivers/target/iscsi/iscsi_target_erl2.c b/trunk/drivers/target/iscsi/iscsi_target_erl2.c index ba6091bf93fc..9ac4c151eae4 100644 --- a/trunk/drivers/target/iscsi/iscsi_target_erl2.c +++ b/trunk/drivers/target/iscsi/iscsi_target_erl2.c @@ -372,7 +372,7 @@ int iscsit_prepare_cmds_for_realligance(struct iscsi_conn *conn) * made generic here. */ if (!(cmd->cmd_flags & ICF_OOO_CMDSN) && !cmd->immediate_cmd && - iscsi_sna_gte(cmd->cmd_sn, conn->sess->exp_cmd_sn)) { + iscsi_sna_gte(cmd->stat_sn, conn->sess->exp_cmd_sn)) { list_del(&cmd->i_conn_node); spin_unlock_bh(&conn->cmd_lock); iscsit_free_cmd(cmd); diff --git a/trunk/drivers/target/target_core_alua.c b/trunk/drivers/target/target_core_alua.c index 7d4ec02e29a9..85140f7dde1e 100644 --- a/trunk/drivers/target/target_core_alua.c +++ b/trunk/drivers/target/target_core_alua.c @@ -212,7 +212,7 @@ target_emulate_set_target_port_groups(struct se_cmd *cmd) struct t10_alua_tg_pt_gp_member *tg_pt_gp_mem, *l_tg_pt_gp_mem; unsigned char *buf; unsigned char *ptr; - sense_reason_t rc = TCM_NO_SENSE; + sense_reason_t rc; u32 len = 4; /* Skip over RESERVED area in header */ int alua_access_state, primary = 0; u16 tg_pt_id, rtpi; diff --git a/trunk/drivers/target/target_core_pr.c b/trunk/drivers/target/target_core_pr.c index 8e0290b38e43..e35dbf85841f 100644 --- a/trunk/drivers/target/target_core_pr.c +++ b/trunk/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, /* Used for APTPL metadata w/ UNREGISTER */ unsigned char *pr_aptpl_buf = NULL; unsigned char isid_buf[PR_REG_ISID_LEN], *isid_ptr = NULL; - sense_reason_t ret = TCM_NO_SENSE; + sense_reason_t ret; int pr_holder = 0, type; if (!se_sess || !se_lun) { diff --git a/trunk/drivers/target/target_core_transport.c b/trunk/drivers/target/target_core_transport.c index bd587b70661a..c23c76ccef65 100644 --- a/trunk/drivers/target/target_core_transport.c +++ b/trunk/drivers/target/target_core_transport.c @@ -541,6 +541,9 @@ static void transport_lun_remove_cmd(struct se_cmd *cmd) void transport_cmd_finish_abort(struct se_cmd *cmd, int remove) { + if (!(cmd->se_cmd_flags & SCF_SCSI_TMR_CDB)) + transport_lun_remove_cmd(cmd); + if (transport_cmd_check_stop_to_fabric(cmd)) return; if (remove) @@ -1393,8 +1396,6 @@ static void target_complete_tmr_failure(struct work_struct *work) se_cmd->se_tmr_req->response = TMR_LUN_DOES_NOT_EXIST; se_cmd->se_tfo->queue_tm_rsp(se_cmd); - - transport_cmd_check_stop_to_fabric(se_cmd); } /** @@ -1687,7 +1688,6 @@ void target_execute_cmd(struct se_cmd *cmd) } cmd->t_state = TRANSPORT_PROCESSING; - cmd->transport_state |= CMD_T_ACTIVE; spin_unlock_irq(&cmd->t_state_lock); if (!target_handle_task_attr(cmd)) @@ -2597,16 +2597,6 @@ transport_send_check_condition_and_sense(struct se_cmd *cmd, * SENSE KEY values from include/scsi/scsi.h */ switch (reason) { - case TCM_NO_SENSE: - /* CURRENT ERROR */ - buffer[0] = 0x70; - buffer[SPC_ADD_SENSE_LEN_OFFSET] = 10; - /* Not Ready */ - buffer[SPC_SENSE_KEY_OFFSET] = NOT_READY; - /* NO ADDITIONAL SENSE INFORMATION */ - buffer[SPC_ASC_KEY_OFFSET] = 0; - buffer[SPC_ASCQ_KEY_OFFSET] = 0; - break; case TCM_NON_EXISTENT_LUN: /* CURRENT ERROR */ buffer[0] = 0x70; @@ -2753,7 +2743,7 @@ transport_send_check_condition_and_sense(struct se_cmd *cmd, /* ILLEGAL REQUEST */ buffer[SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST; /* LOGICAL UNIT COMMUNICATION FAILURE */ - buffer[SPC_ASC_KEY_OFFSET] = 0x08; + buffer[SPC_ASC_KEY_OFFSET] = 0x80; break; } /* @@ -2814,8 +2804,6 @@ void transport_send_task_abort(struct se_cmd *cmd) } cmd->scsi_status = SAM_STAT_TASK_ABORTED; - transport_lun_remove_cmd(cmd); - pr_debug("Setting SAM_STAT_TASK_ABORTED status for CDB: 0x%02x," " ITT: 0x%08x\n", cmd->t_task_cdb[0], cmd->se_tfo->get_task_tag(cmd)); diff --git a/trunk/drivers/target/tcm_fc/tfc_sess.c b/trunk/drivers/target/tcm_fc/tfc_sess.c index 6659dd36e806..12d6fa21e5e1 100644 --- a/trunk/drivers/target/tcm_fc/tfc_sess.c +++ b/trunk/drivers/target/tcm_fc/tfc_sess.c @@ -355,11 +355,11 @@ static int ft_prli_locked(struct fc_rport_priv *rdata, u32 spp_len, tport = ft_tport_create(rdata->local_port); if (!tport) - goto not_target; /* not a target for this local port */ + return 0; /* not a target for this local port */ acl = ft_acl_get(tport->tpg, rdata); if (!acl) - goto not_target; /* no target for this remote */ + return 0; if (!rspp) goto fill; @@ -396,18 +396,12 @@ static int ft_prli_locked(struct fc_rport_priv *rdata, u32 spp_len, /* * OR in our service parameters with other provider (initiator), if any. + * TBD XXX - indicate RETRY capability? */ fill: fcp_parm = ntohl(spp->spp_params); - fcp_parm &= ~FCP_SPPF_RETRY; spp->spp_params = htonl(fcp_parm | FCP_SPPF_TARG_FCN); return FC_SPP_RESP_ACK; - -not_target: - fcp_parm = ntohl(spp->spp_params); - fcp_parm &= ~FCP_SPPF_TARG_FCN; - spp->spp_params = htonl(fcp_parm); - return 0; } /** diff --git a/trunk/drivers/tty/pty.c b/trunk/drivers/tty/pty.c index 79ff3a5e925d..be6a373601b7 100644 --- a/trunk/drivers/tty/pty.c +++ b/trunk/drivers/tty/pty.c @@ -441,8 +441,6 @@ static int pty_bsd_ioctl(struct tty_struct *tty, return pty_get_pktmode(tty, (int __user *)arg); case TIOCSIG: /* Send signal to other side of pty */ return pty_signal(tty, (int) arg); - case TIOCGPTN: /* TTY returns ENOTTY, but glibc expects EINVAL here */ - return -EINVAL; } return -ENOIOCTLCMD; } diff --git a/trunk/drivers/tty/serial/8250/8250.c b/trunk/drivers/tty/serial/8250/8250.c index f9320437a649..d085e3a8ec06 100644 --- a/trunk/drivers/tty/serial/8250/8250.c +++ b/trunk/drivers/tty/serial/8250/8250.c @@ -300,12 +300,6 @@ static const struct serial8250_config uart_config[] = { UART_FCR_R_TRIG_00 | UART_FCR_T_TRIG_00, .flags = UART_CAP_FIFO, }, - [PORT_BRCM_TRUMANAGE] = { - .name = "TruManage", - .fifo_size = 1, - .tx_loadsz = 1024, - .flags = UART_CAP_HFIFO, - }, [PORT_8250_CIR] = { .name = "CIR port" } @@ -1496,11 +1490,6 @@ void serial8250_tx_chars(struct uart_8250_port *up) port->icount.tx++; if (uart_circ_empty(xmit)) break; - if (up->capabilities & UART_CAP_HFIFO) { - if ((serial_port_in(port, UART_LSR) & BOTH_EMPTY) != - BOTH_EMPTY) - break; - } } while (--count > 0); if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) diff --git a/trunk/drivers/tty/serial/8250/8250.h b/trunk/drivers/tty/serial/8250/8250.h index 12caa1292b75..3b4ea84898c2 100644 --- a/trunk/drivers/tty/serial/8250/8250.h +++ b/trunk/drivers/tty/serial/8250/8250.h @@ -40,7 +40,6 @@ struct serial8250_config { #define UART_CAP_AFE (1 << 11) /* MCR-based hw flow control */ #define UART_CAP_UUE (1 << 12) /* UART needs IER bit 6 set (Xscale) */ #define UART_CAP_RTOIE (1 << 13) /* UART needs IER bit 4 set (Xscale, Tegra) */ -#define UART_CAP_HFIFO (1 << 14) /* UART has a "hidden" FIFO */ #define UART_BUG_QUOT (1 << 0) /* UART has buggy quot LSB */ #define UART_BUG_TXEN (1 << 1) /* UART has buggy TX IIR status */ diff --git a/trunk/drivers/tty/serial/8250/8250_dw.c b/trunk/drivers/tty/serial/8250/8250_dw.c index 096d2ef48b32..1d0dba2d562d 100644 --- a/trunk/drivers/tty/serial/8250/8250_dw.c +++ b/trunk/drivers/tty/serial/8250/8250_dw.c @@ -79,7 +79,7 @@ static int dw8250_handle_irq(struct uart_port *p) } else if ((iir & UART_IIR_BUSY) == UART_IIR_BUSY) { /* Clear the USR and write the LCR again. */ (void)p->serial_in(p, UART_USR); - p->serial_out(p, UART_LCR, d->last_lcr); + p->serial_out(p, d->last_lcr, UART_LCR); return 1; } diff --git a/trunk/drivers/tty/serial/8250/8250_pci.c b/trunk/drivers/tty/serial/8250/8250_pci.c index a27a98e1b066..26b9dc012ed0 100644 --- a/trunk/drivers/tty/serial/8250/8250_pci.c +++ b/trunk/drivers/tty/serial/8250/8250_pci.c @@ -1085,18 +1085,6 @@ pci_omegapci_setup(struct serial_private *priv, return setup_port(priv, port, 2, idx * 8, 0); } -static int -pci_brcm_trumanage_setup(struct serial_private *priv, - const struct pciserial_board *board, - struct uart_8250_port *port, int idx) -{ - int ret = pci_default_setup(priv, board, port, idx); - - port->port.type = PORT_BRCM_TRUMANAGE; - port->port.flags = (port->port.flags | UPF_FIXED_PORT | UPF_FIXED_TYPE); - return ret; -} - static int skip_tx_en_setup(struct serial_private *priv, const struct pciserial_board *board, struct uart_8250_port *port, int idx) @@ -1313,10 +1301,9 @@ pci_wch_ch353_setup(struct serial_private *priv, #define PCI_VENDOR_ID_AGESTAR 0x5372 #define PCI_DEVICE_ID_AGESTAR_9375 0x6872 #define PCI_VENDOR_ID_ASIX 0x9710 +#define PCI_DEVICE_ID_COMMTECH_4222PCIE 0x0019 #define PCI_DEVICE_ID_COMMTECH_4224PCIE 0x0020 #define PCI_DEVICE_ID_COMMTECH_4228PCIE 0x0021 -#define PCI_DEVICE_ID_COMMTECH_4222PCIE 0x0022 -#define PCI_DEVICE_ID_BROADCOM_TRUMANAGE 0x160a /* Unknown vendors/cards - this should not be in linux/pci_ids.h */ @@ -1966,17 +1953,6 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = { .subdevice = PCI_ANY_ID, .setup = pci_xr17v35x_setup, }, - /* - * Broadcom TruManage (NetXtreme) - */ - { - .vendor = PCI_VENDOR_ID_BROADCOM, - .device = PCI_DEVICE_ID_BROADCOM_TRUMANAGE, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, - .setup = pci_brcm_trumanage_setup, - }, - /* * Default "match everything" terminator entry */ @@ -2172,7 +2148,6 @@ enum pci_board_num_t { pbn_ce4100_1_115200, pbn_omegapci, pbn_NETMOS9900_2s_115200, - pbn_brcm_trumanage, }; /* @@ -2271,7 +2246,7 @@ static struct pciserial_board pci_boards[] = { [pbn_b0_8_1152000_200] = { .flags = FL_BASE0, - .num_ports = 8, + .num_ports = 2, .base_baud = 1152000, .uart_offset = 0x200, }, @@ -2917,12 +2892,6 @@ static struct pciserial_board pci_boards[] = { .num_ports = 2, .base_baud = 115200, }, - [pbn_brcm_trumanage] = { - .flags = FL_BASE0, - .num_ports = 1, - .reg_shift = 2, - .base_baud = 115200, - }, }; static const struct pci_device_id blacklist[] = { @@ -4501,13 +4470,6 @@ static struct pci_device_id serial_pci_tbl[] = { PCI_ANY_ID, PCI_ANY_ID, 0, 0, pbn_omegapci }, - /* - * Broadcom TruManage - */ - { PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_BROADCOM_TRUMANAGE, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_brcm_trumanage }, - /* * AgeStar as-prs2-009 */ diff --git a/trunk/drivers/tty/serial/ifx6x60.c b/trunk/drivers/tty/serial/ifx6x60.c index 8cb6d8d66a13..675d94ab0aff 100644 --- a/trunk/drivers/tty/serial/ifx6x60.c +++ b/trunk/drivers/tty/serial/ifx6x60.c @@ -637,7 +637,6 @@ static void ifx_port_shutdown(struct tty_port *port) clear_bit(IFX_SPI_STATE_IO_AVAILABLE, &ifx_dev->flags); mrdy_set_low(ifx_dev); - del_timer(&ifx_dev->spi_timer); clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags); tasklet_kill(&ifx_dev->io_work_tasklet); } @@ -811,8 +810,7 @@ static void ifx_spi_io(unsigned long data) ifx_dev->spi_xfer.cs_change = 0; ifx_dev->spi_xfer.speed_hz = ifx_dev->spi_dev->max_speed_hz; /* ifx_dev->spi_xfer.speed_hz = 390625; */ - ifx_dev->spi_xfer.bits_per_word = - ifx_dev->spi_dev->bits_per_word; + ifx_dev->spi_xfer.bits_per_word = spi_bpw; ifx_dev->spi_xfer.tx_buf = ifx_dev->tx_buffer; ifx_dev->spi_xfer.rx_buf = ifx_dev->rx_buffer; diff --git a/trunk/drivers/tty/serial/mxs-auart.c b/trunk/drivers/tty/serial/mxs-auart.c index e55615eb34ad..6db23b035efe 100644 --- a/trunk/drivers/tty/serial/mxs-auart.c +++ b/trunk/drivers/tty/serial/mxs-auart.c @@ -253,7 +253,7 @@ static void mxs_auart_tx_chars(struct mxs_auart_port *s) struct circ_buf *xmit = &s->port.state->xmit; if (auart_dma_enabled(s)) { - u32 i = 0; + int i = 0; int size; void *buffer = s->tx_dma_buf; @@ -412,12 +412,10 @@ static void mxs_auart_set_mctrl(struct uart_port *u, unsigned mctrl) u32 ctrl = readl(u->membase + AUART_CTRL2); - ctrl &= ~(AUART_CTRL2_RTSEN | AUART_CTRL2_RTS); + ctrl &= ~AUART_CTRL2_RTSEN; if (mctrl & TIOCM_RTS) { if (tty_port_cts_enabled(&u->state->port)) ctrl |= AUART_CTRL2_RTSEN; - else - ctrl |= AUART_CTRL2_RTS; } s->ctrl = mctrl; diff --git a/trunk/drivers/tty/serial/samsung.c b/trunk/drivers/tty/serial/samsung.c index e514b3a4dc57..12e5249d053e 100644 --- a/trunk/drivers/tty/serial/samsung.c +++ b/trunk/drivers/tty/serial/samsung.c @@ -1006,6 +1006,7 @@ static void s3c24xx_serial_resetport(struct uart_port *port, ucon &= ucon_mask; wr_regl(port, S3C2410_UCON, ucon | cfg->ucon); + wr_regl(port, S3C2410_ULCON, cfg->ulcon); /* reset both fifos */ wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH); diff --git a/trunk/drivers/tty/serial/vt8500_serial.c b/trunk/drivers/tty/serial/vt8500_serial.c index d5ed9f613005..8fd181436a6b 100644 --- a/trunk/drivers/tty/serial/vt8500_serial.c +++ b/trunk/drivers/tty/serial/vt8500_serial.c @@ -604,7 +604,7 @@ static int vt8500_serial_probe(struct platform_device *pdev) vt8500_port->uart.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF; vt8500_port->clk = of_clk_get(pdev->dev.of_node, 0); - if (!IS_ERR(vt8500_port->clk)) { + if (vt8500_port->clk) { vt8500_port->uart.uartclk = clk_get_rate(vt8500_port->clk); } else { /* use the default of 24Mhz if not specified and warn */ diff --git a/trunk/drivers/usb/Kconfig b/trunk/drivers/usb/Kconfig index 640ae6c6d2d2..4c90b510d016 100644 --- a/trunk/drivers/usb/Kconfig +++ b/trunk/drivers/usb/Kconfig @@ -37,7 +37,6 @@ config USB_ARCH_HAS_EHCI default y if ARCH_W90X900 default y if ARCH_AT91 default y if ARCH_MXC - default y if ARCH_MXS default y if ARCH_OMAP3 default y if ARCH_CNS3XXX default y if ARCH_VT8500 diff --git a/trunk/drivers/usb/chipidea/host.c b/trunk/drivers/usb/chipidea/host.c index 8e9d31277c43..caecad9213f5 100644 --- a/trunk/drivers/usb/chipidea/host.c +++ b/trunk/drivers/usb/chipidea/host.c @@ -70,9 +70,6 @@ static int host_start(struct ci13xxx *ci) else ci->hcd = hcd; - if (ci->platdata->flags & CI13XXX_DISABLE_STREAMING) - hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS); - return ret; } diff --git a/trunk/drivers/usb/class/cdc-acm.c b/trunk/drivers/usb/class/cdc-acm.c index 2d92cce260d7..8d809a811e16 100644 --- a/trunk/drivers/usb/class/cdc-acm.c +++ b/trunk/drivers/usb/class/cdc-acm.c @@ -1602,9 +1602,6 @@ static const struct usb_device_id acm_ids[] = { { USB_DEVICE(0x0572, 0x1340), /* Conexant CX93010-2x UCMxx */ .driver_info = NO_UNION_NORMAL, }, - { USB_DEVICE(0x05f9, 0x4002), /* PSC Scanning, Magellan 800i */ - .driver_info = NO_UNION_NORMAL, - }, { USB_DEVICE(0x1bbb, 0x0003), /* Alcatel OT-I650 */ .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */ }, diff --git a/trunk/drivers/usb/core/hub.c b/trunk/drivers/usb/core/hub.c index 957ed2c41482..a815fd2cc5e7 100644 --- a/trunk/drivers/usb/core/hub.c +++ b/trunk/drivers/usb/core/hub.c @@ -877,60 +877,6 @@ static int hub_hub_status(struct usb_hub *hub, return ret; } -static int hub_set_port_link_state(struct usb_hub *hub, int port1, - unsigned int link_status) -{ - return set_port_feature(hub->hdev, - port1 | (link_status << 3), - USB_PORT_FEAT_LINK_STATE); -} - -/* - * If USB 3.0 ports are placed into the Disabled state, they will no longer - * detect any device connects or disconnects. This is generally not what the - * USB core wants, since it expects a disabled port to produce a port status - * change event when a new device connects. - * - * Instead, set the link state to Disabled, wait for the link to settle into - * that state, clear any change bits, and then put the port into the RxDetect - * state. - */ -static int hub_usb3_port_disable(struct usb_hub *hub, int port1) -{ - int ret; - int total_time; - u16 portchange, portstatus; - - if (!hub_is_superspeed(hub->hdev)) - return -EINVAL; - - ret = hub_set_port_link_state(hub, port1, USB_SS_PORT_LS_SS_DISABLED); - if (ret) { - dev_err(hub->intfdev, "cannot disable port %d (err = %d)\n", - port1, ret); - return ret; - } - - /* Wait for the link to enter the disabled state. */ - for (total_time = 0; ; total_time += HUB_DEBOUNCE_STEP) { - ret = hub_port_status(hub, port1, &portstatus, &portchange); - if (ret < 0) - return ret; - - if ((portstatus & USB_PORT_STAT_LINK_STATE) == - USB_SS_PORT_LS_SS_DISABLED) - break; - if (total_time >= HUB_DEBOUNCE_TIMEOUT) - break; - msleep(HUB_DEBOUNCE_STEP); - } - if (total_time >= HUB_DEBOUNCE_TIMEOUT) - dev_warn(hub->intfdev, "Could not disable port %d after %d ms\n", - port1, total_time); - - return hub_set_port_link_state(hub, port1, USB_SS_PORT_LS_RX_DETECT); -} - static int hub_port_disable(struct usb_hub *hub, int port1, int set_state) { struct usb_device *hdev = hub->hdev; @@ -939,13 +885,8 @@ static int hub_port_disable(struct usb_hub *hub, int port1, int set_state) if (hub->ports[port1 - 1]->child && set_state) usb_set_device_state(hub->ports[port1 - 1]->child, USB_STATE_NOTATTACHED); - if (!hub->error) { - if (hub_is_superspeed(hub->hdev)) - ret = hub_usb3_port_disable(hub, port1); - else - ret = clear_port_feature(hdev, port1, - USB_PORT_FEAT_ENABLE); - } + if (!hub->error && !hub_is_superspeed(hub->hdev)) + ret = clear_port_feature(hdev, port1, USB_PORT_FEAT_ENABLE); if (ret) dev_err(hub->intfdev, "cannot disable port %d (err = %d)\n", port1, ret); @@ -2499,7 +2440,7 @@ static unsigned hub_is_wusb(struct usb_hub *hub) #define HUB_SHORT_RESET_TIME 10 #define HUB_BH_RESET_TIME 50 #define HUB_LONG_RESET_TIME 200 -#define HUB_RESET_TIMEOUT 800 +#define HUB_RESET_TIMEOUT 500 static int hub_port_reset(struct usb_hub *hub, int port1, struct usb_device *udev, unsigned int delay, bool warm); @@ -2534,10 +2475,6 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1, if (ret < 0) return ret; - /* The port state is unknown until the reset completes. */ - if ((portstatus & USB_PORT_STAT_RESET)) - goto delay; - /* * Some buggy devices require a warm reset to be issued even * when the port appears not to be connected. @@ -2583,7 +2520,11 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1, if ((portchange & USB_PORT_STAT_C_CONNECTION)) return -ENOTCONN; - if ((portstatus & USB_PORT_STAT_ENABLE)) { + /* if we`ve finished resetting, then break out of + * the loop + */ + if (!(portstatus & USB_PORT_STAT_RESET) && + (portstatus & USB_PORT_STAT_ENABLE)) { if (hub_is_wusb(hub)) udev->speed = USB_SPEED_WIRELESS; else if (hub_is_superspeed(hub->hdev)) @@ -2597,15 +2538,10 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1, return 0; } } else { - if (!(portstatus & USB_PORT_STAT_CONNECTION) || - hub_port_warm_reset_required(hub, - portstatus)) - return -ENOTCONN; - - return 0; + if (portchange & USB_PORT_STAT_C_BH_RESET) + return 0; } -delay: /* switch to the long delay after two short delay failures */ if (delay_time >= 2 * HUB_SHORT_RESET_TIME) delay = HUB_LONG_RESET_TIME; @@ -2629,11 +2565,14 @@ static void hub_port_finish_reset(struct usb_hub *hub, int port1, msleep(10 + 40); update_devnum(udev, 0); hcd = bus_to_hcd(udev->bus); - /* The xHC may think the device is already reset, - * so ignore the status. - */ - if (hcd->driver->reset_device) - hcd->driver->reset_device(hcd, udev); + if (hcd->driver->reset_device) { + *status = hcd->driver->reset_device(hcd, udev); + if (*status < 0) { + dev_err(&udev->dev, "Cannot reset " + "HCD device state\n"); + break; + } + } } /* FALL THROUGH */ case -ENOTCONN: @@ -2641,16 +2580,16 @@ static void hub_port_finish_reset(struct usb_hub *hub, int port1, clear_port_feature(hub->hdev, port1, USB_PORT_FEAT_C_RESET); /* FIXME need disconnect() for NOTATTACHED device */ - if (hub_is_superspeed(hub->hdev)) { + if (warm) { clear_port_feature(hub->hdev, port1, USB_PORT_FEAT_C_BH_PORT_RESET); clear_port_feature(hub->hdev, port1, USB_PORT_FEAT_C_PORT_LINK_STATE); - } - if (!warm) + } else { usb_set_device_state(udev, *status ? USB_STATE_NOTATTACHED : USB_STATE_DEFAULT); + } break; } } @@ -3000,7 +2939,7 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg) static int finish_port_resume(struct usb_device *udev) { int status = 0; - u16 devstatus = 0; + u16 devstatus; /* caller owns the udev device lock */ dev_dbg(&udev->dev, "%s\n", @@ -3045,13 +2984,7 @@ static int finish_port_resume(struct usb_device *udev) if (status) { dev_dbg(&udev->dev, "gone after usb resume? status %d\n", status); - /* - * There are a few quirky devices which violate the standard - * by claiming to have remote wakeup enabled after a reset, - * which crash if the feature is cleared, hence check for - * udev->reset_resume - */ - } else if (udev->actconfig && !udev->reset_resume) { + } else if (udev->actconfig) { le16_to_cpus(&devstatus); if (devstatus & (1 << USB_DEVICE_REMOTE_WAKEUP)) { status = usb_control_msg(udev, @@ -4705,14 +4638,9 @@ static void hub_events(void) * SS.Inactive state. */ if (hub_port_warm_reset_required(hub, portstatus)) { - int status; - dev_dbg(hub_dev, "warm reset port %d\n", i); - status = hub_port_reset(hub, i, NULL, + hub_port_reset(hub, i, NULL, HUB_BH_RESET_TIME, true); - if (status < 0) - hub_port_disable(hub, i, 1); - connect_change = 0; } if (connect_change) diff --git a/trunk/drivers/usb/core/quirks.c b/trunk/drivers/usb/core/quirks.c index 3113c1d71442..fdefd9c7f7af 100644 --- a/trunk/drivers/usb/core/quirks.c +++ b/trunk/drivers/usb/core/quirks.c @@ -43,9 +43,6 @@ static const struct usb_device_id usb_quirk_list[] = { /* Creative SB Audigy 2 NX */ { USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME }, - /* Microsoft LifeCam-VX700 v2.0 */ - { USB_DEVICE(0x045e, 0x0770), .driver_info = USB_QUIRK_RESET_RESUME }, - /* Logitech Quickcam Fusion */ { USB_DEVICE(0x046d, 0x08c1), .driver_info = USB_QUIRK_RESET_RESUME }, diff --git a/trunk/drivers/usb/dwc3/debugfs.c b/trunk/drivers/usb/dwc3/debugfs.c index 5945aadaa1c9..92604b4f9712 100644 --- a/trunk/drivers/usb/dwc3/debugfs.c +++ b/trunk/drivers/usb/dwc3/debugfs.c @@ -56,7 +56,7 @@ #define dump_register(nm) \ { \ .name = __stringify(nm), \ - .offset = DWC3_ ##nm - DWC3_GLOBALS_REGS_START, \ + .offset = DWC3_ ##nm, \ } static const struct debugfs_reg32 dwc3_regs[] = { diff --git a/trunk/drivers/usb/dwc3/gadget.c b/trunk/drivers/usb/dwc3/gadget.c index 2fdd767f8fe8..2e43b332aae8 100644 --- a/trunk/drivers/usb/dwc3/gadget.c +++ b/trunk/drivers/usb/dwc3/gadget.c @@ -1605,7 +1605,6 @@ static int dwc3_gadget_init_endpoints(struct dwc3 *dwc) if (epnum == 0 || epnum == 1) { dep->endpoint.maxpacket = 512; - dep->endpoint.maxburst = 1; dep->endpoint.ops = &dwc3_gadget_ep0_ops; if (!epnum) dwc->gadget.ep0 = &dep->endpoint; diff --git a/trunk/drivers/usb/gadget/amd5536udc.c b/trunk/drivers/usb/gadget/amd5536udc.c index d9f6b9372491..fc0ec5e0d58e 100644 --- a/trunk/drivers/usb/gadget/amd5536udc.c +++ b/trunk/drivers/usb/gadget/amd5536udc.c @@ -3231,7 +3231,7 @@ static int udc_pci_probe( } if (!pdev->irq) { - dev_err(&pdev->dev, "irq not set\n"); + dev_err(&dev->pdev->dev, "irq not set\n"); kfree(dev); dev = NULL; retval = -ENODEV; @@ -3250,7 +3250,7 @@ static int udc_pci_probe( dev->txfifo = (u32 __iomem *)(dev->virt_addr + UDC_TXFIFO_ADDR); if (request_irq(pdev->irq, udc_irq, IRQF_SHARED, name, dev) != 0) { - dev_dbg(&pdev->dev, "request_irq(%d) fail\n", pdev->irq); + dev_dbg(&dev->pdev->dev, "request_irq(%d) fail\n", pdev->irq); kfree(dev); dev = NULL; retval = -EBUSY; diff --git a/trunk/drivers/usb/gadget/dummy_hcd.c b/trunk/drivers/usb/gadget/dummy_hcd.c index 8cf0c0f6fa1f..95d584dbed13 100644 --- a/trunk/drivers/usb/gadget/dummy_hcd.c +++ b/trunk/drivers/usb/gadget/dummy_hcd.c @@ -130,7 +130,10 @@ static const char ep0name[] = "ep0"; static const char *const ep_name[] = { ep0name, /* everyone has ep0 */ - /* act like a pxa250: fifteen fixed function endpoints */ + /* act like a net2280: high speed, six configurable endpoints */ + "ep-a", "ep-b", "ep-c", "ep-d", "ep-e", "ep-f", + + /* or like pxa250: fifteen fixed function endpoints */ "ep1in-bulk", "ep2out-bulk", "ep3in-iso", "ep4out-iso", "ep5in-int", "ep6in-bulk", "ep7out-bulk", "ep8in-iso", "ep9out-iso", "ep10in-int", "ep11in-bulk", "ep12out-bulk", "ep13in-iso", "ep14out-iso", @@ -138,10 +141,6 @@ static const char *const ep_name[] = { /* or like sa1100: two fixed function endpoints */ "ep1out-bulk", "ep2in-bulk", - - /* and now some generic EPs so we have enough in multi config */ - "ep3out", "ep4in", "ep5out", "ep6out", "ep7in", "ep8out", "ep9in", - "ep10out", "ep11out", "ep12in", "ep13out", "ep14in", "ep15out", }; #define DUMMY_ENDPOINTS ARRAY_SIZE(ep_name) diff --git a/trunk/drivers/usb/gadget/f_fs.c b/trunk/drivers/usb/gadget/f_fs.c index 8c2f25121149..4a6961c517f2 100644 --- a/trunk/drivers/usb/gadget/f_fs.c +++ b/trunk/drivers/usb/gadget/f_fs.c @@ -1153,15 +1153,15 @@ static int ffs_fs_parse_opts(struct ffs_sb_fill_data *data, char *opts) pr_err("%s: unmapped value: %lu\n", opts, value); return -EINVAL; } - } else if (!memcmp(opts, "gid", 3)) { + } + else if (!memcmp(opts, "gid", 3)) data->perms.gid = make_kgid(current_user_ns(), value); if (!gid_valid(data->perms.gid)) { pr_err("%s: unmapped value: %lu\n", opts, value); return -EINVAL; } - } else { + else goto invalid; - } break; default: diff --git a/trunk/drivers/usb/gadget/fsl_mxc_udc.c b/trunk/drivers/usb/gadget/fsl_mxc_udc.c index d3bd7b095ba3..1b0f086426bd 100644 --- a/trunk/drivers/usb/gadget/fsl_mxc_udc.c +++ b/trunk/drivers/usb/gadget/fsl_mxc_udc.c @@ -18,13 +18,14 @@ #include #include +#include + static struct clk *mxc_ahb_clk; static struct clk *mxc_per_clk; static struct clk *mxc_ipg_clk; /* workaround ENGcm09152 for i.MX35 */ -#define MX35_USBPHYCTRL_OFFSET 0x600 -#define USBPHYCTRL_OTGBASE_OFFSET 0x8 +#define USBPHYCTRL_OTGBASE_OFFSET 0x608 #define USBPHYCTRL_EVDO (1 << 23) int fsl_udc_clk_init(struct platform_device *pdev) @@ -58,7 +59,7 @@ int fsl_udc_clk_init(struct platform_device *pdev) clk_prepare_enable(mxc_per_clk); /* make sure USB_CLK is running at 60 MHz +/- 1000 Hz */ - if (!strcmp(pdev->id_entry->name, "imx-udc-mx27")) { + if (!cpu_is_mx51()) { freq = clk_get_rate(mxc_per_clk); if (pdata->phy_mode != FSL_USB2_PHY_ULPI && (freq < 59999000 || freq > 60001000)) { @@ -78,40 +79,27 @@ int fsl_udc_clk_init(struct platform_device *pdev) return ret; } -int fsl_udc_clk_finalize(struct platform_device *pdev) +void fsl_udc_clk_finalize(struct platform_device *pdev) { struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data; - int ret = 0; - - /* workaround ENGcm09152 for i.MX35 */ - if (pdata->workaround & FLS_USB2_WORKAROUND_ENGCM09152) { + if (cpu_is_mx35()) { unsigned int v; - struct resource *res = platform_get_resource - (pdev, IORESOURCE_MEM, 0); - void __iomem *phy_regs = ioremap(res->start + - MX35_USBPHYCTRL_OFFSET, 512); - if (!phy_regs) { - dev_err(&pdev->dev, "ioremap for phy address fails\n"); - ret = -EINVAL; - goto ioremap_err; - } - - v = readl(phy_regs + USBPHYCTRL_OTGBASE_OFFSET); - writel(v | USBPHYCTRL_EVDO, - phy_regs + USBPHYCTRL_OTGBASE_OFFSET); - iounmap(phy_regs); + /* workaround ENGcm09152 for i.MX35 */ + if (pdata->workaround & FLS_USB2_WORKAROUND_ENGCM09152) { + v = readl(MX35_IO_ADDRESS(MX35_USB_BASE_ADDR + + USBPHYCTRL_OTGBASE_OFFSET)); + writel(v | USBPHYCTRL_EVDO, + MX35_IO_ADDRESS(MX35_USB_BASE_ADDR + + USBPHYCTRL_OTGBASE_OFFSET)); + } } - -ioremap_err: /* ULPI transceivers don't need usbpll */ if (pdata->phy_mode == FSL_USB2_PHY_ULPI) { clk_disable_unprepare(mxc_per_clk); mxc_per_clk = NULL; } - - return ret; } void fsl_udc_clk_release(void) diff --git a/trunk/drivers/usb/gadget/fsl_udc_core.c b/trunk/drivers/usb/gadget/fsl_udc_core.c index 667275cb7bad..c19f7f13790b 100644 --- a/trunk/drivers/usb/gadget/fsl_udc_core.c +++ b/trunk/drivers/usb/gadget/fsl_udc_core.c @@ -41,7 +41,6 @@ #include #include #include -#include #include #include @@ -2439,6 +2438,11 @@ static int __init fsl_udc_probe(struct platform_device *pdev) unsigned int i; u32 dccparams; + if (strcmp(pdev->name, driver_name)) { + VDBG("Wrong device"); + return -ENODEV; + } + udc_controller = kzalloc(sizeof(struct fsl_udc), GFP_KERNEL); if (udc_controller == NULL) { ERR("malloc udc failed\n"); @@ -2543,9 +2547,7 @@ static int __init fsl_udc_probe(struct platform_device *pdev) dr_controller_setup(udc_controller); } - ret = fsl_udc_clk_finalize(pdev); - if (ret) - goto err_free_irq; + fsl_udc_clk_finalize(pdev); /* Setup gadget structure */ udc_controller->gadget.ops = &fsl_gadget_ops; @@ -2754,32 +2756,22 @@ static int fsl_udc_otg_resume(struct device *dev) return fsl_udc_resume(NULL); } + /*------------------------------------------------------------------------- Register entry point for the peripheral controller driver --------------------------------------------------------------------------*/ -static const struct platform_device_id fsl_udc_devtype[] = { - { - .name = "imx-udc-mx27", - }, { - .name = "imx-udc-mx51", - }, { - /* sentinel */ - } -}; -MODULE_DEVICE_TABLE(platform, fsl_udc_devtype); + static struct platform_driver udc_driver = { - .remove = __exit_p(fsl_udc_remove), - /* Just for FSL i.mx SoC currently */ - .id_table = fsl_udc_devtype, + .remove = __exit_p(fsl_udc_remove), /* these suspend and resume are not usb suspend and resume */ - .suspend = fsl_udc_suspend, - .resume = fsl_udc_resume, - .driver = { - .name = (char *)driver_name, - .owner = THIS_MODULE, - /* udc suspend/resume called from OTG driver */ - .suspend = fsl_udc_otg_suspend, - .resume = fsl_udc_otg_resume, + .suspend = fsl_udc_suspend, + .resume = fsl_udc_resume, + .driver = { + .name = (char *)driver_name, + .owner = THIS_MODULE, + /* udc suspend/resume called from OTG driver */ + .suspend = fsl_udc_otg_suspend, + .resume = fsl_udc_otg_resume, }, }; diff --git a/trunk/drivers/usb/gadget/fsl_usb2_udc.h b/trunk/drivers/usb/gadget/fsl_usb2_udc.h index c6703bb07b23..f61a967f7082 100644 --- a/trunk/drivers/usb/gadget/fsl_usb2_udc.h +++ b/trunk/drivers/usb/gadget/fsl_usb2_udc.h @@ -592,16 +592,15 @@ static inline struct ep_queue_head *get_qh_by_ep(struct fsl_ep *ep) struct platform_device; #ifdef CONFIG_ARCH_MXC int fsl_udc_clk_init(struct platform_device *pdev); -int fsl_udc_clk_finalize(struct platform_device *pdev); +void fsl_udc_clk_finalize(struct platform_device *pdev); void fsl_udc_clk_release(void); #else static inline int fsl_udc_clk_init(struct platform_device *pdev) { return 0; } -static inline int fsl_udc_clk_finalize(struct platform_device *pdev) +static inline void fsl_udc_clk_finalize(struct platform_device *pdev) { - return 0; } static inline void fsl_udc_clk_release(void) { diff --git a/trunk/drivers/usb/gadget/mv_udc_core.c b/trunk/drivers/usb/gadget/mv_udc_core.c index 6e8b1272ebce..379aac7b82fc 100644 --- a/trunk/drivers/usb/gadget/mv_udc_core.c +++ b/trunk/drivers/usb/gadget/mv_udc_core.c @@ -1012,7 +1012,7 @@ static void udc_clock_enable(struct mv_udc *udc) unsigned int i; for (i = 0; i < udc->clknum; i++) - clk_prepare_enable(udc->clk[i]); + clk_enable(udc->clk[i]); } static void udc_clock_disable(struct mv_udc *udc) @@ -1020,7 +1020,7 @@ static void udc_clock_disable(struct mv_udc *udc) unsigned int i; for (i = 0; i < udc->clknum; i++) - clk_disable_unprepare(udc->clk[i]); + clk_disable(udc->clk[i]); } static void udc_stop(struct mv_udc *udc) diff --git a/trunk/drivers/usb/gadget/s3c-hsotg.c b/trunk/drivers/usb/gadget/s3c-hsotg.c index 439c3f972f8c..141971d9051e 100644 --- a/trunk/drivers/usb/gadget/s3c-hsotg.c +++ b/trunk/drivers/usb/gadget/s3c-hsotg.c @@ -3477,11 +3477,12 @@ static void s3c_hsotg_delete_debug(struct s3c_hsotg *hsotg) /** * s3c_hsotg_release - release callback for hsotg device * @dev: Device to for which release is called - * - * Nothing to do as the resource is allocated using devm_ API. */ static void s3c_hsotg_release(struct device *dev) { + struct s3c_hsotg *hsotg = dev_get_drvdata(dev); + + kfree(hsotg); } /** diff --git a/trunk/drivers/usb/gadget/tcm_usb_gadget.c b/trunk/drivers/usb/gadget/tcm_usb_gadget.c index 7cacd6ae818e..4f7f76f00c74 100644 --- a/trunk/drivers/usb/gadget/tcm_usb_gadget.c +++ b/trunk/drivers/usb/gadget/tcm_usb_gadget.c @@ -1794,10 +1794,9 @@ static int tcm_usbg_drop_nexus(struct usbg_tpg *tpg) tpg->tpg_nexus = NULL; kfree(tv_nexus); - ret = 0; out: mutex_unlock(&tpg->tpg_mutex); - return ret; + return 0; } static ssize_t tcm_usbg_tpg_store_nexus( diff --git a/trunk/drivers/usb/gadget/u_serial.c b/trunk/drivers/usb/gadget/u_serial.c index 598dcc1212f0..d0f95482f40e 100644 --- a/trunk/drivers/usb/gadget/u_serial.c +++ b/trunk/drivers/usb/gadget/u_serial.c @@ -887,7 +887,7 @@ static void gs_close(struct tty_struct *tty, struct file *file) pr_debug("gs_close: ttyGS%d (%p,%p) done!\n", port->port_num, tty, file); - wake_up(&port->port.close_wait); + wake_up_interruptible(&port->port.close_wait); exit: spin_unlock_irq(&port->port_lock); } diff --git a/trunk/drivers/usb/host/Kconfig b/trunk/drivers/usb/host/Kconfig index 3a21c5d683c0..d6bb128ce21e 100644 --- a/trunk/drivers/usb/host/Kconfig +++ b/trunk/drivers/usb/host/Kconfig @@ -148,7 +148,7 @@ config USB_EHCI_FSL Variation of ARC USB block used in some Freescale chips. config USB_EHCI_MXC - tristate "Support for Freescale i.MX on-chip EHCI USB controller" + bool "Support for Freescale i.MX on-chip EHCI USB controller" depends on USB_EHCI_HCD && ARCH_MXC select USB_EHCI_ROOT_HUB_TT ---help--- diff --git a/trunk/drivers/usb/host/Makefile b/trunk/drivers/usb/host/Makefile index 001fbff2fdef..1eb4c3006e9e 100644 --- a/trunk/drivers/usb/host/Makefile +++ b/trunk/drivers/usb/host/Makefile @@ -26,7 +26,6 @@ obj-$(CONFIG_PCI) += pci-quirks.o obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o obj-$(CONFIG_USB_EHCI_HCD_PLATFORM) += ehci-platform.o -obj-$(CONFIG_USB_EHCI_MXC) += ehci-mxc.o obj-$(CONFIG_USB_OXU210HP_HCD) += oxu210hp-hcd.o obj-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o diff --git a/trunk/drivers/usb/host/ehci-fsl.c b/trunk/drivers/usb/host/ehci-fsl.c index d81d2fcbff18..fd9b5424b860 100644 --- a/trunk/drivers/usb/host/ehci-fsl.c +++ b/trunk/drivers/usb/host/ehci-fsl.c @@ -230,7 +230,7 @@ static int ehci_fsl_setup_phy(struct usb_hcd *hcd, switch (phy_mode) { case FSL_USB2_PHY_ULPI: - if (pdata->have_sysif_regs && pdata->controller_ver) { + if (pdata->controller_ver) { /* controller version 1.6 or above */ setbits32(non_ehci + FSL_SOC_USB_CTRL, ULPI_PHY_CLK_SEL); @@ -251,7 +251,7 @@ static int ehci_fsl_setup_phy(struct usb_hcd *hcd, portsc |= PORT_PTS_PTW; /* fall through */ case FSL_USB2_PHY_UTMI: - if (pdata->have_sysif_regs && pdata->controller_ver) { + if (pdata->controller_ver) { /* controller version 1.6 or above */ setbits32(non_ehci + FSL_SOC_USB_CTRL, UTMI_PHY_EN); mdelay(FSL_UTMI_PHY_DLY); /* Delay for UTMI PHY CLK to @@ -267,8 +267,7 @@ static int ehci_fsl_setup_phy(struct usb_hcd *hcd, break; } - if (pdata->have_sysif_regs && pdata->controller_ver && - (phy_mode == FSL_USB2_PHY_ULPI)) { + if (pdata->controller_ver && (phy_mode == FSL_USB2_PHY_ULPI)) { /* check PHY_CLK_VALID to get phy clk valid */ if (!spin_event_timeout(in_be32(non_ehci + FSL_SOC_USB_CTRL) & PHY_CLK_VALID, FSL_USB_PHY_CLK_TIMEOUT, 0)) { @@ -279,7 +278,7 @@ static int ehci_fsl_setup_phy(struct usb_hcd *hcd, ehci_writel(ehci, portsc, &ehci->regs->port_status[port_offset]); - if (phy_mode != FSL_USB2_PHY_ULPI && pdata->have_sysif_regs) + if (phy_mode != FSL_USB2_PHY_ULPI) setbits32(non_ehci + FSL_SOC_USB_CTRL, USB_CTRL_USB_EN); return 0; diff --git a/trunk/drivers/usb/host/ehci-hcd.c b/trunk/drivers/usb/host/ehci-hcd.c index 09537b2f1002..c97503bb0b0e 100644 --- a/trunk/drivers/usb/host/ehci-hcd.c +++ b/trunk/drivers/usb/host/ehci-hcd.c @@ -74,6 +74,10 @@ static const char hcd_name [] = "ehci_hcd"; #undef VERBOSE_DEBUG #undef EHCI_URB_TRACE +#ifdef DEBUG +#define EHCI_STATS +#endif + /* magic numbers that can affect system performance */ #define EHCI_TUNE_CERR 3 /* 0-3 qtd retries; 0 == don't stop */ #define EHCI_TUNE_RL_HS 4 /* nak throttle; see 4.9 */ @@ -1246,6 +1250,11 @@ MODULE_LICENSE ("GPL"); #define PLATFORM_DRIVER ehci_fsl_driver #endif +#ifdef CONFIG_USB_EHCI_MXC +#include "ehci-mxc.c" +#define PLATFORM_DRIVER ehci_mxc_driver +#endif + #ifdef CONFIG_USB_EHCI_SH #include "ehci-sh.c" #define PLATFORM_DRIVER ehci_hcd_sh_driver @@ -1343,8 +1352,7 @@ MODULE_LICENSE ("GPL"); #if !IS_ENABLED(CONFIG_USB_EHCI_PCI) && \ !IS_ENABLED(CONFIG_USB_EHCI_HCD_PLATFORM) && \ - !IS_ENABLED(CONFIG_USB_CHIPIDEA_HOST) && \ - !IS_ENABLED(CONFIG_USB_EHCI_MXC) && \ + !defined(CONFIG_USB_CHIPIDEA_HOST) && \ !defined(PLATFORM_DRIVER) && \ !defined(PS3_SYSTEM_BUS_DRIVER) && \ !defined(OF_PLATFORM_DRIVER) && \ diff --git a/trunk/drivers/usb/host/ehci-mv.c b/trunk/drivers/usb/host/ehci-mv.c index 6c56297ea16b..f7bfc0b898b9 100644 --- a/trunk/drivers/usb/host/ehci-mv.c +++ b/trunk/drivers/usb/host/ehci-mv.c @@ -43,7 +43,7 @@ static void ehci_clock_enable(struct ehci_hcd_mv *ehci_mv) unsigned int i; for (i = 0; i < ehci_mv->clknum; i++) - clk_prepare_enable(ehci_mv->clk[i]); + clk_enable(ehci_mv->clk[i]); } static 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) unsigned int i; for (i = 0; i < ehci_mv->clknum; i++) - clk_disable_unprepare(ehci_mv->clk[i]); + clk_disable(ehci_mv->clk[i]); } static int mv_ehci_enable(struct ehci_hcd_mv *ehci_mv) diff --git a/trunk/drivers/usb/host/ehci-mxc.c b/trunk/drivers/usb/host/ehci-mxc.c index dedb80bb8d40..ec7f5d2c90de 100644 --- a/trunk/drivers/usb/host/ehci-mxc.c +++ b/trunk/drivers/usb/host/ehci-mxc.c @@ -17,38 +17,75 @@ * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include #include #include #include #include #include #include -#include -#include #include #include -#include "ehci.h" - -#define DRIVER_DESC "Freescale On-Chip EHCI Host driver" - -static const char hcd_name[] = "ehci-mxc"; - #define ULPI_VIEWPORT_OFFSET 0x170 struct ehci_mxc_priv { struct clk *usbclk, *ahbclk, *phyclk; + struct usb_hcd *hcd; }; -static struct hc_driver __read_mostly ehci_mxc_hc_driver; +/* called during probe() after chip reset completes */ +static int ehci_mxc_setup(struct usb_hcd *hcd) +{ + hcd->has_tt = 1; + + return ehci_setup(hcd); +} -static const struct ehci_driver_overrides ehci_mxc_overrides __initdata = { - .extra_priv_size = sizeof(struct ehci_mxc_priv), +static const struct hc_driver ehci_mxc_hc_driver = { + .description = hcd_name, + .product_desc = "Freescale On-Chip EHCI Host Controller", + .hcd_priv_size = sizeof(struct ehci_hcd), + + /* + * generic hardware linkage + */ + .irq = ehci_irq, + .flags = HCD_USB2 | HCD_MEMORY, + + /* + * basic lifecycle operations + */ + .reset = ehci_mxc_setup, + .start = ehci_run, + .stop = ehci_stop, + .shutdown = ehci_shutdown, + + /* + * managing i/o requests and associated device resources + */ + .urb_enqueue = ehci_urb_enqueue, + .urb_dequeue = ehci_urb_dequeue, + .endpoint_disable = ehci_endpoint_disable, + .endpoint_reset = ehci_endpoint_reset, + + /* + * scheduling support + */ + .get_frame_number = ehci_get_frame, + + /* + * root hub support + */ + .hub_status_data = ehci_hub_status_data, + .hub_control = ehci_hub_control, + .bus_suspend = ehci_bus_suspend, + .bus_resume = ehci_bus_resume, + .relinquish_port = ehci_relinquish_port, + .port_handed_over = ehci_port_handed_over, + + .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, }; static int ehci_mxc_drv_probe(struct platform_device *pdev) @@ -75,6 +112,12 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) if (!hcd) return -ENOMEM; + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) { + ret = -ENOMEM; + goto err_alloc; + } + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { dev_err(dev, "Found HC with no register addr. Check setup!\n"); @@ -92,10 +135,6 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) goto err_alloc; } - hcd->has_tt = 1; - ehci = hcd_to_ehci(hcd); - priv = (struct ehci_mxc_priv *) ehci->priv; - /* enable clocks */ priv->usbclk = devm_clk_get(&pdev->dev, "ipg"); if (IS_ERR(priv->usbclk)) { @@ -130,6 +169,8 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) mdelay(10); } + ehci = hcd_to_ehci(hcd); + /* EHCI registers start at offset 0x100 */ ehci->caps = hcd->regs + 0x100; ehci->regs = hcd->regs + 0x100 + @@ -157,7 +198,8 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) } } - platform_set_drvdata(pdev, hcd); + priv->hcd = hcd; + platform_set_drvdata(pdev, priv); ret = usb_add_hcd(hcd, irq, IRQF_SHARED); if (ret) @@ -202,11 +244,8 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) static int __exit ehci_mxc_drv_remove(struct platform_device *pdev) { struct mxc_usbh_platform_data *pdata = pdev->dev.platform_data; - struct usb_hcd *hcd = platform_get_drvdata(pdev); - struct ehci_hcd *ehci = hcd_to_ehci(hcd); - struct ehci_mxc_priv *priv = (struct ehci_mxc_priv *) ehci->priv; - - usb_remove_hcd(hcd); + struct ehci_mxc_priv *priv = platform_get_drvdata(pdev); + struct usb_hcd *hcd = priv->hcd; if (pdata && pdata->exit) pdata->exit(pdev); @@ -214,20 +253,23 @@ static int __exit ehci_mxc_drv_remove(struct platform_device *pdev) if (pdata->otg) usb_phy_shutdown(pdata->otg); + usb_remove_hcd(hcd); + usb_put_hcd(hcd); + platform_set_drvdata(pdev, NULL); + clk_disable_unprepare(priv->usbclk); clk_disable_unprepare(priv->ahbclk); if (priv->phyclk) clk_disable_unprepare(priv->phyclk); - usb_put_hcd(hcd); - platform_set_drvdata(pdev, NULL); return 0; } static void ehci_mxc_drv_shutdown(struct platform_device *pdev) { - struct usb_hcd *hcd = platform_get_drvdata(pdev); + struct ehci_mxc_priv *priv = platform_get_drvdata(pdev); + struct usb_hcd *hcd = priv->hcd; if (hcd->driver->shutdown) hcd->driver->shutdown(hcd); @@ -237,31 +279,9 @@ MODULE_ALIAS("platform:mxc-ehci"); static struct platform_driver ehci_mxc_driver = { .probe = ehci_mxc_drv_probe, - .remove = ehci_mxc_drv_remove, + .remove = __exit_p(ehci_mxc_drv_remove), .shutdown = ehci_mxc_drv_shutdown, .driver = { .name = "mxc-ehci", }, }; - -static int __init ehci_mxc_init(void) -{ - if (usb_disabled()) - return -ENODEV; - - pr_info("%s: " DRIVER_DESC "\n", hcd_name); - - ehci_init_driver(&ehci_mxc_hc_driver, &ehci_mxc_overrides); - return platform_driver_register(&ehci_mxc_driver); -} -module_init(ehci_mxc_init); - -static void __exit ehci_mxc_cleanup(void) -{ - platform_driver_unregister(&ehci_mxc_driver); -} -module_exit(ehci_mxc_cleanup); - -MODULE_DESCRIPTION(DRIVER_DESC); -MODULE_AUTHOR("Sascha Hauer"); -MODULE_LICENSE("GPL"); diff --git a/trunk/drivers/usb/host/ehci-pci.c b/trunk/drivers/usb/host/ehci-pci.c index 170b9399e09f..dabb20494826 100644 --- a/trunk/drivers/usb/host/ehci-pci.c +++ b/trunk/drivers/usb/host/ehci-pci.c @@ -200,26 +200,6 @@ static int ehci_pci_setup(struct usb_hcd *hcd) break; } - /* optional debug port, normally in the first BAR */ - temp = pci_find_capability(pdev, PCI_CAP_ID_DBG); - if (temp) { - pci_read_config_dword(pdev, temp, &temp); - temp >>= 16; - if (((temp >> 13) & 7) == 1) { - u32 hcs_params = ehci_readl(ehci, - &ehci->caps->hcs_params); - - temp &= 0x1fff; - ehci->debug = hcd->regs + temp; - temp = ehci_readl(ehci, &ehci->debug->control); - ehci_info(ehci, "debug port %d%s\n", - HCS_DEBUG_PORT(hcs_params), - (temp & DBGP_ENABLED) ? " IN USE" : ""); - if (!(temp & DBGP_ENABLED)) - ehci->debug = NULL; - } - } - retval = ehci_setup(hcd); if (retval) return retval; @@ -248,6 +228,25 @@ static int ehci_pci_setup(struct usb_hcd *hcd) break; } + /* optional debug port, normally in the first BAR */ + temp = pci_find_capability(pdev, 0x0a); + if (temp) { + pci_read_config_dword(pdev, temp, &temp); + temp >>= 16; + if ((temp & (3 << 13)) == (1 << 13)) { + temp &= 0x1fff; + ehci->debug = hcd->regs + temp; + temp = ehci_readl(ehci, &ehci->debug->control); + ehci_info(ehci, "debug port %d%s\n", + HCS_DEBUG_PORT(ehci->hcs_params), + (temp & DBGP_ENABLED) + ? " IN USE" + : ""); + if (!(temp & DBGP_ENABLED)) + ehci->debug = NULL; + } + } + /* at least the Genesys GL880S needs fixup here */ temp = HCS_N_CC(ehci->hcs_params) * HCS_N_PCC(ehci->hcs_params); temp &= 0x0f; diff --git a/trunk/drivers/usb/host/ehci.h b/trunk/drivers/usb/host/ehci.h index 36c3a8210595..9dadc7118d68 100644 --- a/trunk/drivers/usb/host/ehci.h +++ b/trunk/drivers/usb/host/ehci.h @@ -38,10 +38,6 @@ typedef __u16 __bitwise __hc16; #endif /* statistics can be kept for tuning/monitoring */ -#ifdef DEBUG -#define EHCI_STATS -#endif - struct ehci_stats { /* irq usage */ unsigned long normal; @@ -225,9 +221,6 @@ struct ehci_hcd { /* one per controller */ #ifdef DEBUG struct dentry *debug_dir; #endif - - /* platform-specific data -- must come last */ - unsigned long priv[0] __aligned(sizeof(s64)); }; /* convert between an HCD pointer and the corresponding EHCI_HCD */ diff --git a/trunk/drivers/usb/host/fsl-mph-dr-of.c b/trunk/drivers/usb/host/fsl-mph-dr-of.c index 11e0b79ff9d5..5105127c1d4b 100644 --- a/trunk/drivers/usb/host/fsl-mph-dr-of.c +++ b/trunk/drivers/usb/host/fsl-mph-dr-of.c @@ -142,9 +142,6 @@ static int usb_get_ver_info(struct device_node *np) return ver; } - if (of_device_is_compatible(np, "fsl,mpc5121-usb2-dr")) - return FSL_USB_VER_OLD; - if (of_device_is_compatible(np, "fsl-usb2-mph")) { if (of_device_is_compatible(np, "fsl-usb2-mph-v1.6")) ver = FSL_USB_VER_1_6; diff --git a/trunk/drivers/usb/host/imx21-hcd.c b/trunk/drivers/usb/host/imx21-hcd.c index f0ebe8e7c58b..bd6a7447ccc9 100644 --- a/trunk/drivers/usb/host/imx21-hcd.c +++ b/trunk/drivers/usb/host/imx21-hcd.c @@ -58,7 +58,6 @@ #include #include #include -#include #include "imx21-hcd.h" diff --git a/trunk/drivers/usb/host/ohci-tmio.c b/trunk/drivers/usb/host/ohci-tmio.c index 5e3a6deb62b1..d370245a4ee2 100644 --- a/trunk/drivers/usb/host/ohci-tmio.c +++ b/trunk/drivers/usb/host/ohci-tmio.c @@ -128,8 +128,7 @@ static void tmio_start_hc(struct platform_device *dev) tmio_iowrite8(2, tmio->ccr + CCR_INTC); dev_info(&dev->dev, "revision %d @ 0x%08llx, irq %d\n", - tmio_ioread8(tmio->ccr + CCR_REVID), - (u64) hcd->rsrc_start, hcd->irq); + tmio_ioread8(tmio->ccr + CCR_REVID), hcd->rsrc_start, hcd->irq); } static int ohci_tmio_start(struct usb_hcd *hcd) diff --git a/trunk/drivers/usb/host/uhci-hcd.c b/trunk/drivers/usb/host/uhci-hcd.c index 4f64d24eebc8..4b9e9aba2665 100644 --- a/trunk/drivers/usb/host/uhci-hcd.c +++ b/trunk/drivers/usb/host/uhci-hcd.c @@ -447,10 +447,6 @@ static irqreturn_t uhci_irq(struct usb_hcd *hcd) return IRQ_NONE; uhci_writew(uhci, status, USBSTS); /* Clear it */ - spin_lock(&uhci->lock); - if (unlikely(!uhci->is_initialized)) /* not yet configured */ - goto done; - if (status & ~(USBSTS_USBINT | USBSTS_ERROR | USBSTS_RD)) { if (status & USBSTS_HSE) dev_err(uhci_dev(uhci), "host system error, " @@ -459,6 +455,7 @@ static irqreturn_t uhci_irq(struct usb_hcd *hcd) dev_err(uhci_dev(uhci), "host controller process " "error, something bad happened!\n"); if (status & USBSTS_HCH) { + spin_lock(&uhci->lock); if (uhci->rh_state >= UHCI_RH_RUNNING) { dev_err(uhci_dev(uhci), "host controller halted, " @@ -476,15 +473,15 @@ static irqreturn_t uhci_irq(struct usb_hcd *hcd) * pending unlinks */ mod_timer(&hcd->rh_timer, jiffies); } + spin_unlock(&uhci->lock); } } - if (status & USBSTS_RD) { - spin_unlock(&uhci->lock); + if (status & USBSTS_RD) usb_hcd_poll_rh_status(hcd); - } else { + else { + spin_lock(&uhci->lock); uhci_scan_schedule(uhci); - done: spin_unlock(&uhci->lock); } @@ -665,9 +662,9 @@ static int uhci_start(struct usb_hcd *hcd) */ mb(); - spin_lock_irq(&uhci->lock); configure_hc(uhci); uhci->is_initialized = 1; + spin_lock_irq(&uhci->lock); start_rh(uhci); spin_unlock_irq(&uhci->lock); return 0; diff --git a/trunk/drivers/usb/host/xhci-hub.c b/trunk/drivers/usb/host/xhci-hub.c index 68914429482f..a686cf4905bb 100644 --- a/trunk/drivers/usb/host/xhci-hub.c +++ b/trunk/drivers/usb/host/xhci-hub.c @@ -761,39 +761,12 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, break; case USB_PORT_FEAT_LINK_STATE: temp = xhci_readl(xhci, port_array[wIndex]); - - /* Disable port */ - if (link_state == USB_SS_PORT_LS_SS_DISABLED) { - xhci_dbg(xhci, "Disable port %d\n", wIndex); - temp = xhci_port_state_to_neutral(temp); - /* - * Clear all change bits, so that we get a new - * connection event. - */ - temp |= PORT_CSC | PORT_PEC | PORT_WRC | - PORT_OCC | PORT_RC | PORT_PLC | - PORT_CEC; - xhci_writel(xhci, temp | PORT_PE, - port_array[wIndex]); - temp = xhci_readl(xhci, port_array[wIndex]); - break; - } - - /* Put link in RxDetect (enable port) */ - if (link_state == USB_SS_PORT_LS_RX_DETECT) { - xhci_dbg(xhci, "Enable port %d\n", wIndex); - xhci_set_link_state(xhci, port_array, wIndex, - link_state); - temp = xhci_readl(xhci, port_array[wIndex]); - break; - } - /* Software should not attempt to set - * port link state above '3' (U3) and the port + * port link state above '5' (Rx.Detect) and the port * must be enabled. */ if ((temp & PORT_PE) == 0 || - (link_state > USB_SS_PORT_LS_U3)) { + (link_state > USB_SS_PORT_LS_RX_DETECT)) { xhci_warn(xhci, "Cannot set link state.\n"); goto error; } @@ -984,7 +957,6 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf) int max_ports; __le32 __iomem **port_array; struct xhci_bus_state *bus_state; - bool reset_change = false; max_ports = xhci_get_ports(hcd, &port_array); bus_state = &xhci->bus_state[hcd_index(hcd)]; @@ -1016,12 +988,6 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf) buf[(i + 1) / 8] |= 1 << (i + 1) % 8; status = 1; } - if ((temp & PORT_RC)) - reset_change = true; - } - if (!status && !reset_change) { - xhci_dbg(xhci, "%s: stopping port polling.\n", __func__); - clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); } spin_unlock_irqrestore(&xhci->lock, flags); return status ? retval : 0; diff --git a/trunk/drivers/usb/host/xhci-mem.c b/trunk/drivers/usb/host/xhci-mem.c index 35616ffbe3ae..fb51c7085ad0 100644 --- a/trunk/drivers/usb/host/xhci-mem.c +++ b/trunk/drivers/usb/host/xhci-mem.c @@ -1250,8 +1250,6 @@ static unsigned int xhci_microframes_to_exponent(struct usb_device *udev, static unsigned int xhci_parse_microframe_interval(struct usb_device *udev, struct usb_host_endpoint *ep) { - if (ep->desc.bInterval == 0) - return 0; return xhci_microframes_to_exponent(udev, ep, ep->desc.bInterval, 0, 15); } diff --git a/trunk/drivers/usb/host/xhci-ring.c b/trunk/drivers/usb/host/xhci-ring.c index 59fb5c677dbe..cbb44b7b9d65 100644 --- a/trunk/drivers/usb/host/xhci-ring.c +++ b/trunk/drivers/usb/host/xhci-ring.c @@ -1725,15 +1725,6 @@ static void handle_port_status(struct xhci_hcd *xhci, if (bogus_port_status) return; - /* - * xHCI port-status-change events occur when the "or" of all the - * status-change bits in the portsc register changes from 0 to 1. - * New status changes won't cause an event if any other change - * bits are still set. When an event occurs, switch over to - * polling to avoid losing status changes. - */ - xhci_dbg(xhci, "%s: starting port polling.\n", __func__); - set_bit(HCD_FLAG_POLL_RH, &hcd->flags); spin_unlock(&xhci->lock); /* Pass this up to the core */ usb_hcd_poll_rh_status(hcd); diff --git a/trunk/drivers/usb/host/xhci.c b/trunk/drivers/usb/host/xhci.c index f1f01a834ba7..5c72c431bab1 100644 --- a/trunk/drivers/usb/host/xhci.c +++ b/trunk/drivers/usb/host/xhci.c @@ -884,11 +884,6 @@ int xhci_suspend(struct xhci_hcd *xhci) xhci->shared_hcd->state != HC_STATE_SUSPENDED) return -EINVAL; - /* Don't poll the roothubs on bus suspend. */ - xhci_dbg(xhci, "%s: stopping port polling.\n", __func__); - clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); - del_timer_sync(&hcd->rh_timer); - spin_lock_irq(&xhci->lock); clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); clear_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags); @@ -1074,11 +1069,6 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) if (xhci->quirks & XHCI_COMP_MODE_QUIRK) compliance_mode_recovery_timer_init(xhci); - /* Re-enable port polling. */ - xhci_dbg(xhci, "%s: starting port polling.\n", __func__); - set_bit(HCD_FLAG_POLL_RH, &hcd->flags); - usb_hcd_poll_rh_status(hcd); - return retval; } #endif /* CONFIG_PM */ diff --git a/trunk/drivers/usb/misc/usbtest.c b/trunk/drivers/usb/misc/usbtest.c index 268148de9714..7667b12f2ff5 100644 --- a/trunk/drivers/usb/misc/usbtest.c +++ b/trunk/drivers/usb/misc/usbtest.c @@ -2179,7 +2179,7 @@ usbtest_ioctl(struct usb_interface *intf, unsigned int code, void *buf) if (dev->out_pipe == 0 || !param->length || param->sglen < 4) break; retval = 0; - dev_info(&intf->dev, "TEST 24: unlink from %d queues of " + dev_info(&intf->dev, "TEST 17: unlink from %d queues of " "%d %d-byte writes\n", param->iterations, param->sglen, param->length); for (i = param->iterations; retval == 0 && i > 0; --i) { diff --git a/trunk/drivers/usb/musb/cppi_dma.c b/trunk/drivers/usb/musb/cppi_dma.c index f522000e8f06..0968dd7a859d 100644 --- a/trunk/drivers/usb/musb/cppi_dma.c +++ b/trunk/drivers/usb/musb/cppi_dma.c @@ -105,7 +105,7 @@ static void cppi_reset_tx(struct cppi_tx_stateram __iomem *tx, u32 ptr) musb_writel(&tx->tx_complete, 0, ptr); } -static void cppi_pool_init(struct cppi *cppi, struct cppi_channel *c) +static void __init cppi_pool_init(struct cppi *cppi, struct cppi_channel *c) { int j; @@ -150,7 +150,7 @@ static void cppi_pool_free(struct cppi_channel *c) c->last_processed = NULL; } -static int cppi_controller_start(struct dma_controller *c) +static int __init cppi_controller_start(struct dma_controller *c) { struct cppi *controller; void __iomem *tibase; diff --git a/trunk/drivers/usb/musb/musb_core.c b/trunk/drivers/usb/musb/musb_core.c index fd3486745e64..f1c6c5470b92 100644 --- a/trunk/drivers/usb/musb/musb_core.c +++ b/trunk/drivers/usb/musb/musb_core.c @@ -2298,7 +2298,10 @@ static int __init musb_init(void) if (usb_disabled()) return 0; - pr_info("%s: version " MUSB_VERSION ", ?dma?, otg (peripheral+host)\n", + pr_info("%s: version " MUSB_VERSION ", " + "?dma?" + ", " + "otg (peripheral+host)", musb_driver_name); return platform_driver_register(&musb_driver); } diff --git a/trunk/drivers/usb/musb/musb_dsps.c b/trunk/drivers/usb/musb/musb_dsps.c index f7d764de6fda..e6f2ae8368bb 100644 --- a/trunk/drivers/usb/musb/musb_dsps.c +++ b/trunk/drivers/usb/musb/musb_dsps.c @@ -134,11 +134,6 @@ static const resource_size_t dsps_control_module_phys[] = { DSPS_AM33XX_CONTROL_MODULE_PHYS_1, }; -#define USBPHY_CM_PWRDN (1 << 0) -#define USBPHY_OTG_PWRDN (1 << 1) -#define USBPHY_OTGVDET_EN (1 << 19) -#define USBPHY_OTGSESSEND_EN (1 << 20) - /** * musb_dsps_phy_control - phy on/off * @glue: struct dsps_glue * diff --git a/trunk/drivers/usb/otg/Kconfig b/trunk/drivers/usb/otg/Kconfig index 37962c99ff1e..6223062d5d1b 100644 --- a/trunk/drivers/usb/otg/Kconfig +++ b/trunk/drivers/usb/otg/Kconfig @@ -110,7 +110,7 @@ config AB8500_USB config FSL_USB2_OTG bool "Freescale USB OTG Transceiver Driver" - depends on USB_EHCI_FSL && USB_FSL_USB2 && USB_SUSPEND + depends on USB_EHCI_FSL && USB_GADGET_FSL_USB2 && USB_SUSPEND select USB_OTG select USB_OTG_UTILS help diff --git a/trunk/drivers/usb/otg/mv_otg.c b/trunk/drivers/usb/otg/mv_otg.c index eace975991a8..1dd57504186d 100644 --- a/trunk/drivers/usb/otg/mv_otg.c +++ b/trunk/drivers/usb/otg/mv_otg.c @@ -240,7 +240,7 @@ static void otg_clock_enable(struct mv_otg *mvotg) unsigned int i; for (i = 0; i < mvotg->clknum; i++) - clk_prepare_enable(mvotg->clk[i]); + clk_enable(mvotg->clk[i]); } static void otg_clock_disable(struct mv_otg *mvotg) @@ -248,7 +248,7 @@ static void otg_clock_disable(struct mv_otg *mvotg) unsigned int i; for (i = 0; i < mvotg->clknum; i++) - clk_disable_unprepare(mvotg->clk[i]); + clk_disable(mvotg->clk[i]); } static int mv_otg_enable_internal(struct mv_otg *mvotg) diff --git a/trunk/drivers/usb/renesas_usbhs/mod_gadget.c b/trunk/drivers/usb/renesas_usbhs/mod_gadget.c index f2985cd88021..dd41f61893ef 100644 --- a/trunk/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/trunk/drivers/usb/renesas_usbhs/mod_gadget.c @@ -545,6 +545,15 @@ static int usbhsg_pipe_disable(struct usbhsg_uep *uep) return 0; } +static void usbhsg_uep_init(struct usbhsg_gpriv *gpriv) +{ + int i; + struct usbhsg_uep *uep; + + usbhsg_for_each_uep_with_dcp(uep, gpriv, i) + uep->pipe = NULL; +} + /* * * usb_ep_ops @@ -601,12 +610,7 @@ static int usbhsg_ep_disable(struct usb_ep *ep) { struct usbhsg_uep *uep = usbhsg_ep_to_uep(ep); - usbhsg_pipe_disable(uep); - - uep->pipe->mod_private = NULL; - uep->pipe = NULL; - - return 0; + return usbhsg_pipe_disable(uep); } static struct usb_request *usbhsg_ep_alloc_request(struct usb_ep *ep, @@ -757,8 +761,9 @@ static int usbhsg_try_start(struct usbhs_priv *priv, u32 status) usbhs_pipe_init(priv, usbhsg_dma_map_ctrl); usbhs_fifo_init(priv); + usbhsg_uep_init(gpriv); - /* dcp init instead of usbhsg_ep_enable() */ + /* dcp init */ dcp->pipe = usbhs_dcp_malloc(priv); dcp->pipe->mod_private = dcp; usbhs_pipe_config_update(dcp->pipe, 0, 0, 64); @@ -820,7 +825,7 @@ static int usbhsg_try_stop(struct usbhs_priv *priv, u32 status) usbhs_sys_set_test_mode(priv, 0); usbhs_sys_function_ctrl(priv, 0); - usbhsg_ep_disable(&dcp->ep); + usbhsg_pipe_disable(dcp); dev_dbg(dev, "stop gadget\n"); @@ -993,7 +998,6 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv) */ usbhsg_for_each_uep_with_dcp(uep, gpriv, i) { uep->gpriv = gpriv; - uep->pipe = NULL; snprintf(uep->ep_name, EP_NAME_SIZE, "ep%d", i); uep->ep.name = uep->ep_name; diff --git a/trunk/drivers/usb/renesas_usbhs/mod_host.c b/trunk/drivers/usb/renesas_usbhs/mod_host.c index b86815421c8d..3d3cd6ca2689 100644 --- a/trunk/drivers/usb/renesas_usbhs/mod_host.c +++ b/trunk/drivers/usb/renesas_usbhs/mod_host.c @@ -661,10 +661,9 @@ static void usbhsh_queue_done(struct usbhs_priv *priv, struct usbhs_pkt *pkt) status = -ESHUTDOWN; urb->actual_length = pkt->actual; - - usbhsh_endpoint_sequence_save(hpriv, urb, pkt); usbhsh_ureq_free(hpriv, ureq); + usbhsh_endpoint_sequence_save(hpriv, urb, pkt); usbhsh_pipe_detach(hpriv, usbhsh_ep_to_uep(urb->ep)); usb_hcd_unlink_urb_from_ep(hcd, urb); diff --git a/trunk/drivers/usb/serial/ftdi_sio.c b/trunk/drivers/usb/serial/ftdi_sio.c index ba68835d06a6..0a373b3ae96a 100644 --- a/trunk/drivers/usb/serial/ftdi_sio.c +++ b/trunk/drivers/usb/serial/ftdi_sio.c @@ -875,8 +875,6 @@ static struct usb_device_id id_table_combined [] = { { USB_DEVICE(FTDI_VID, FTDI_DISTORTEC_JTAG_LOCK_PICK_PID), .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, { USB_DEVICE(FTDI_VID, FTDI_LUMEL_PD12_PID) }, - /* Crucible Devices */ - { USB_DEVICE(FTDI_VID, FTDI_CT_COMET_PID) }, { }, /* Optional parameter entry */ { } /* Terminating entry */ }; diff --git a/trunk/drivers/usb/serial/ftdi_sio_ids.h b/trunk/drivers/usb/serial/ftdi_sio_ids.h index fa5d56038276..049b6e715fa4 100644 --- a/trunk/drivers/usb/serial/ftdi_sio_ids.h +++ b/trunk/drivers/usb/serial/ftdi_sio_ids.h @@ -1259,9 +1259,3 @@ * ATI command output: Cinterion MC55i */ #define FTDI_CINTERION_MC55I_PID 0xA951 - -/* - * Product: Comet Caller ID decoder - * Manufacturer: Crucible Technologies - */ -#define FTDI_CT_COMET_PID 0x8e08 diff --git a/trunk/drivers/usb/serial/io_ti.c b/trunk/drivers/usb/serial/io_ti.c index 82afc4d6a327..58184f3de686 100644 --- a/trunk/drivers/usb/serial/io_ti.c +++ b/trunk/drivers/usb/serial/io_ti.c @@ -530,9 +530,6 @@ static void chase_port(struct edgeport_port *port, unsigned long timeout, wait_queue_t wait; unsigned long flags; - if (!tty) - return; - if (!timeout) timeout = (HZ * EDGE_CLOSING_WAIT)/100; diff --git a/trunk/drivers/usb/serial/option.c b/trunk/drivers/usb/serial/option.c index 0d9dac9e7f93..e6f87b76c715 100644 --- a/trunk/drivers/usb/serial/option.c +++ b/trunk/drivers/usb/serial/option.c @@ -288,7 +288,6 @@ static void option_instat_callback(struct urb *urb); #define ALCATEL_VENDOR_ID 0x1bbb #define ALCATEL_PRODUCT_X060S_X200 0x0000 #define ALCATEL_PRODUCT_X220_X500D 0x0017 -#define ALCATEL_PRODUCT_L100V 0x011e #define PIRELLI_VENDOR_ID 0x1266 #define PIRELLI_PRODUCT_C100_1 0x1002 @@ -430,12 +429,9 @@ static void option_instat_callback(struct urb *urb); #define MEDIATEK_VENDOR_ID 0x0e8d #define MEDIATEK_PRODUCT_DC_1COM 0x00a0 #define MEDIATEK_PRODUCT_DC_4COM 0x00a5 -#define MEDIATEK_PRODUCT_DC_4COM2 0x00a7 #define MEDIATEK_PRODUCT_DC_5COM 0x00a4 #define MEDIATEK_PRODUCT_7208_1COM 0x7101 #define MEDIATEK_PRODUCT_7208_2COM 0x7102 -#define MEDIATEK_PRODUCT_7103_2COM 0x7103 -#define MEDIATEK_PRODUCT_7106_2COM 0x7106 #define MEDIATEK_PRODUCT_FP_1COM 0x0003 #define MEDIATEK_PRODUCT_FP_2COM 0x0023 #define MEDIATEK_PRODUCT_FPDC_1COM 0x0043 @@ -445,14 +441,6 @@ static void option_instat_callback(struct urb *urb); #define CELLIENT_VENDOR_ID 0x2692 #define CELLIENT_PRODUCT_MEN200 0x9005 -/* Hyundai Petatel Inc. products */ -#define PETATEL_VENDOR_ID 0x1ff4 -#define PETATEL_PRODUCT_NP10T 0x600e - -/* TP-LINK Incorporated products */ -#define TPLINK_VENDOR_ID 0x2357 -#define TPLINK_PRODUCT_MA180 0x0201 - /* some devices interfaces need special handling due to a number of reasons */ enum option_blacklist_reason { OPTION_BLACKLIST_NONE = 0, @@ -934,10 +922,8 @@ static const struct usb_device_id option_ids[] = { { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0254, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0257, 0xff, 0xff, 0xff), /* ZTE MF821 */ .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0265, 0xff, 0xff, 0xff), /* ONDA MT8205 */ - .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0284, 0xff, 0xff, 0xff), /* ZTE MF880 */ - .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0265, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0284, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0317, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0326, 0xff, 0xff, 0xff), .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, @@ -1204,8 +1190,6 @@ static const struct usb_device_id option_ids[] = { .driver_info = (kernel_ulong_t)&alcatel_x200_blacklist }, { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X220_X500D) }, - { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_L100V), - .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) }, { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) }, { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14), @@ -1310,14 +1294,7 @@ static const struct usb_device_id option_ids[] = { { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FP_2COM, 0x0a, 0x00, 0x00) }, { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FPDC_1COM, 0x0a, 0x00, 0x00) }, { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FPDC_2COM, 0x0a, 0x00, 0x00) }, - { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_7103_2COM, 0xff, 0x00, 0x00) }, - { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_7106_2COM, 0x02, 0x02, 0x01) }, - { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM2, 0xff, 0x02, 0x01) }, - { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM2, 0xff, 0x00, 0x00) }, { USB_DEVICE(CELLIENT_VENDOR_ID, CELLIENT_PRODUCT_MEN200) }, - { USB_DEVICE(PETATEL_VENDOR_ID, PETATEL_PRODUCT_NP10T) }, - { USB_DEVICE(TPLINK_VENDOR_ID, TPLINK_PRODUCT_MA180), - .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, { } /* Terminating entry */ }; MODULE_DEVICE_TABLE(usb, option_ids); diff --git a/trunk/drivers/vfio/pci/vfio_pci_rdwr.c b/trunk/drivers/vfio/pci/vfio_pci_rdwr.c index f72323ef618f..4362d9e7baa3 100644 --- a/trunk/drivers/vfio/pci/vfio_pci_rdwr.c +++ b/trunk/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, filled = 1; } else { /* Drop writes, fill reads with FF */ - filled = min((size_t)(x_end - pos), count); if (!iswrite) { char val = 0xFF; size_t i; - for (i = 0; i < filled; i++) { + for (i = 0; i < x_end - pos; i++) { if (put_user(val, buf + i)) goto out; } } + filled = x_end - pos; } count -= filled; diff --git a/trunk/drivers/video/imxfb.c b/trunk/drivers/video/imxfb.c index 0abf2bf20836..12526787a7c7 100644 --- a/trunk/drivers/video/imxfb.c +++ b/trunk/drivers/video/imxfb.c @@ -139,7 +139,6 @@ struct imxfb_info { struct clk *clk_ahb; struct clk *clk_per; enum imxfb_type devtype; - bool enabled; /* * These are the addresses we mapped @@ -537,10 +536,6 @@ static void imxfb_exit_backlight(struct imxfb_info *fbi) static void imxfb_enable_controller(struct imxfb_info *fbi) { - - if (fbi->enabled) - return; - pr_debug("Enabling LCD controller\n"); writel(fbi->screen_dma, fbi->regs + LCDC_SSA); @@ -561,7 +556,6 @@ static void imxfb_enable_controller(struct imxfb_info *fbi) clk_prepare_enable(fbi->clk_ipg); clk_prepare_enable(fbi->clk_ahb); clk_prepare_enable(fbi->clk_per); - fbi->enabled = true; if (fbi->backlight_power) fbi->backlight_power(1); @@ -571,9 +565,6 @@ static void imxfb_enable_controller(struct imxfb_info *fbi) static void imxfb_disable_controller(struct imxfb_info *fbi) { - if (!fbi->enabled) - return; - pr_debug("Disabling LCD controller\n"); if (fbi->backlight_power) @@ -584,7 +575,6 @@ static void imxfb_disable_controller(struct imxfb_info *fbi) clk_disable_unprepare(fbi->clk_per); clk_disable_unprepare(fbi->clk_ipg); clk_disable_unprepare(fbi->clk_ahb); - fbi->enabled = false; writel(0, fbi->regs + LCDC_RMCR); } @@ -739,8 +729,6 @@ static int __init imxfb_init_fbinfo(struct platform_device *pdev) memset(fbi, 0, sizeof(struct imxfb_info)); - fbi->devtype = pdev->id_entry->driver_data; - strlcpy(info->fix.id, IMX_NAME, sizeof(info->fix.id)); info->fix.type = FB_TYPE_PACKED_PIXELS; @@ -801,6 +789,7 @@ static int __init imxfb_probe(struct platform_device *pdev) return -ENOMEM; fbi = info->par; + fbi->devtype = pdev->id_entry->driver_data; if (!fb_mode) fb_mode = pdata->mode[0].mode.name; diff --git a/trunk/drivers/video/mxsfb.c b/trunk/drivers/video/mxsfb.c index 755556ca5b2d..a45b37c2e88e 100644 --- a/trunk/drivers/video/mxsfb.c +++ b/trunk/drivers/video/mxsfb.c @@ -369,8 +369,7 @@ static void mxsfb_disable_controller(struct fb_info *fb_info) loop--; } - reg = readl(host->base + LCDC_VDCTRL4); - writel(reg & ~VDCTRL4_SYNC_SIGNALS_ON, host->base + LCDC_VDCTRL4); + writel(VDCTRL4_SYNC_SIGNALS_ON, host->base + LCDC_VDCTRL4 + REG_CLR); clk_disable_unprepare(host->clk); diff --git a/trunk/drivers/video/ssd1307fb.c b/trunk/drivers/video/ssd1307fb.c index 395cb6a8d8f3..4d99dd7a6831 100644 --- a/trunk/drivers/video/ssd1307fb.c +++ b/trunk/drivers/video/ssd1307fb.c @@ -145,8 +145,8 @@ static void ssd1307fb_update_display(struct ssd1307fb_par *par) u32 page_length = SSD1307FB_WIDTH * i; u32 index = page_length + (SSD1307FB_WIDTH * k + j) / 8; u8 byte = *(vmem + index); - u8 bit = byte & (1 << (j % 8)); - bit = bit >> (j % 8); + u8 bit = byte & (1 << (7 - (j % 8))); + bit = bit >> (7 - (j % 8)); buf |= bit << k; } ssd1307fb_write_data(par->client, buf); diff --git a/trunk/drivers/xen/cpu_hotplug.c b/trunk/drivers/xen/cpu_hotplug.c index 084041d42c9a..4dcfced107f5 100644 --- a/trunk/drivers/xen/cpu_hotplug.c +++ b/trunk/drivers/xen/cpu_hotplug.c @@ -25,10 +25,10 @@ static void disable_hotplug_cpu(int cpu) static int vcpu_online(unsigned int cpu) { int err; - char dir[16], state[16]; + char dir[32], state[32]; sprintf(dir, "cpu/%u", cpu); - err = xenbus_scanf(XBT_NIL, dir, "availability", "%15s", state); + err = xenbus_scanf(XBT_NIL, dir, "availability", "%s", state); if (err != 1) { if (!xen_initial_domain()) printk(KERN_ERR "XENBUS: Unable to read cpu state\n"); diff --git a/trunk/drivers/xen/gntdev.c b/trunk/drivers/xen/gntdev.c index 3c8803feba26..2e22df2f7a3f 100644 --- a/trunk/drivers/xen/gntdev.c +++ b/trunk/drivers/xen/gntdev.c @@ -56,15 +56,10 @@ MODULE_PARM_DESC(limit, "Maximum number of grants that may be mapped by " static atomic_t pages_mapped = ATOMIC_INIT(0); static int use_ptemod; -#define populate_freeable_maps use_ptemod struct gntdev_priv { - /* maps with visible offsets in the file descriptor */ struct list_head maps; - /* maps that are not visible; will be freed on munmap. - * Only populated if populate_freeable_maps == 1 */ - struct list_head freeable_maps; - /* lock protects maps and freeable_maps */ + /* lock protects maps from concurrent changes */ spinlock_t lock; struct mm_struct *mm; struct mmu_notifier mn; @@ -198,7 +193,7 @@ static struct grant_map *gntdev_find_map_index(struct gntdev_priv *priv, return NULL; } -static void gntdev_put_map(struct gntdev_priv *priv, struct grant_map *map) +static void gntdev_put_map(struct grant_map *map) { if (!map) return; @@ -213,12 +208,6 @@ static void gntdev_put_map(struct gntdev_priv *priv, struct grant_map *map) evtchn_put(map->notify.event); } - if (populate_freeable_maps && priv) { - spin_lock(&priv->lock); - list_del(&map->next); - spin_unlock(&priv->lock); - } - if (map->pages && !use_ptemod) unmap_grant_pages(map, 0, map->count); gntdev_free_map(map); @@ -312,10 +301,17 @@ static int __unmap_grant_pages(struct grant_map *map, int offset, int pages) if (map->notify.flags & UNMAP_NOTIFY_CLEAR_BYTE) { int pgno = (map->notify.addr >> PAGE_SHIFT); - if (pgno >= offset && pgno < offset + pages) { - /* No need for kmap, pages are in lowmem */ - uint8_t *tmp = pfn_to_kaddr(page_to_pfn(map->pages[pgno])); + if (pgno >= offset && pgno < offset + pages && use_ptemod) { + void __user *tmp = (void __user *) + map->vma->vm_start + map->notify.addr; + err = copy_to_user(tmp, &err, 1); + if (err) + return -EFAULT; + map->notify.flags &= ~UNMAP_NOTIFY_CLEAR_BYTE; + } else if (pgno >= offset && pgno < offset + pages) { + uint8_t *tmp = kmap(map->pages[pgno]); tmp[map->notify.addr & (PAGE_SIZE-1)] = 0; + kunmap(map->pages[pgno]); map->notify.flags &= ~UNMAP_NOTIFY_CLEAR_BYTE; } } @@ -380,24 +376,11 @@ static void gntdev_vma_open(struct vm_area_struct *vma) static void gntdev_vma_close(struct vm_area_struct *vma) { struct grant_map *map = vma->vm_private_data; - struct file *file = vma->vm_file; - struct gntdev_priv *priv = file->private_data; pr_debug("gntdev_vma_close %p\n", vma); - if (use_ptemod) { - /* It is possible that an mmu notifier could be running - * concurrently, so take priv->lock to ensure that the vma won't - * vanishing during the unmap_grant_pages call, since we will - * spin here until that completes. Such a concurrent call will - * not do any unmapping, since that has been done prior to - * closing the vma, but it may still iterate the unmap_ops list. - */ - spin_lock(&priv->lock); - map->vma = NULL; - spin_unlock(&priv->lock); - } + map->vma = NULL; vma->vm_private_data = NULL; - gntdev_put_map(priv, map); + gntdev_put_map(map); } static struct vm_operations_struct gntdev_vmops = { @@ -407,43 +390,33 @@ static struct vm_operations_struct gntdev_vmops = { /* ------------------------------------------------------------------ */ -static void unmap_if_in_range(struct grant_map *map, - unsigned long start, unsigned long end) -{ - unsigned long mstart, mend; - int err; - - if (!map->vma) - return; - if (map->vma->vm_start >= end) - return; - if (map->vma->vm_end <= start) - return; - mstart = max(start, map->vma->vm_start); - mend = min(end, map->vma->vm_end); - pr_debug("map %d+%d (%lx %lx), range %lx %lx, mrange %lx %lx\n", - map->index, map->count, - map->vma->vm_start, map->vma->vm_end, - start, end, mstart, mend); - err = unmap_grant_pages(map, - (mstart - map->vma->vm_start) >> PAGE_SHIFT, - (mend - mstart) >> PAGE_SHIFT); - WARN_ON(err); -} - static void mn_invl_range_start(struct mmu_notifier *mn, struct mm_struct *mm, unsigned long start, unsigned long end) { struct gntdev_priv *priv = container_of(mn, struct gntdev_priv, mn); struct grant_map *map; + unsigned long mstart, mend; + int err; spin_lock(&priv->lock); list_for_each_entry(map, &priv->maps, next) { - unmap_if_in_range(map, start, end); - } - list_for_each_entry(map, &priv->freeable_maps, next) { - unmap_if_in_range(map, start, end); + if (!map->vma) + continue; + if (map->vma->vm_start >= end) + continue; + if (map->vma->vm_end <= start) + continue; + mstart = max(start, map->vma->vm_start); + mend = min(end, map->vma->vm_end); + pr_debug("map %d+%d (%lx %lx), range %lx %lx, mrange %lx %lx\n", + map->index, map->count, + map->vma->vm_start, map->vma->vm_end, + start, end, mstart, mend); + err = unmap_grant_pages(map, + (mstart - map->vma->vm_start) >> PAGE_SHIFT, + (mend - mstart) >> PAGE_SHIFT); + WARN_ON(err); } spin_unlock(&priv->lock); } @@ -472,15 +445,6 @@ static void mn_release(struct mmu_notifier *mn, err = unmap_grant_pages(map, /* offset */ 0, map->count); WARN_ON(err); } - list_for_each_entry(map, &priv->freeable_maps, next) { - if (!map->vma) - continue; - pr_debug("map %d+%d (%lx %lx)\n", - map->index, map->count, - map->vma->vm_start, map->vma->vm_end); - err = unmap_grant_pages(map, /* offset */ 0, map->count); - WARN_ON(err); - } spin_unlock(&priv->lock); } @@ -502,7 +466,6 @@ static int gntdev_open(struct inode *inode, struct file *flip) return -ENOMEM; INIT_LIST_HEAD(&priv->maps); - INIT_LIST_HEAD(&priv->freeable_maps); spin_lock_init(&priv->lock); if (use_ptemod) { @@ -537,9 +500,8 @@ static int gntdev_release(struct inode *inode, struct file *flip) while (!list_empty(&priv->maps)) { map = list_entry(priv->maps.next, struct grant_map, next); list_del(&map->next); - gntdev_put_map(NULL /* already removed */, map); + gntdev_put_map(map); } - WARN_ON(!list_empty(&priv->freeable_maps)); if (use_ptemod) mmu_notifier_unregister(&priv->mn, priv->mm); @@ -567,14 +529,14 @@ static long gntdev_ioctl_map_grant_ref(struct gntdev_priv *priv, if (unlikely(atomic_add_return(op.count, &pages_mapped) > limit)) { pr_debug("can't map: over limit\n"); - gntdev_put_map(NULL, map); + gntdev_put_map(map); return err; } if (copy_from_user(map->grants, &u->refs, sizeof(map->grants[0]) * op.count) != 0) { - gntdev_put_map(NULL, map); - return -EFAULT; + gntdev_put_map(map); + return err; } spin_lock(&priv->lock); @@ -603,13 +565,11 @@ static long gntdev_ioctl_unmap_grant_ref(struct gntdev_priv *priv, map = gntdev_find_map_index(priv, op.index >> PAGE_SHIFT, op.count); if (map) { list_del(&map->next); - if (populate_freeable_maps) - list_add_tail(&map->next, &priv->freeable_maps); err = 0; } spin_unlock(&priv->lock); if (map) - gntdev_put_map(priv, map); + gntdev_put_map(map); return err; } @@ -619,31 +579,25 @@ static long gntdev_ioctl_get_offset_for_vaddr(struct gntdev_priv *priv, struct ioctl_gntdev_get_offset_for_vaddr op; struct vm_area_struct *vma; struct grant_map *map; - int rv = -EINVAL; if (copy_from_user(&op, u, sizeof(op)) != 0) return -EFAULT; pr_debug("priv %p, offset for vaddr %lx\n", priv, (unsigned long)op.vaddr); - down_read(¤t->mm->mmap_sem); vma = find_vma(current->mm, op.vaddr); if (!vma || vma->vm_ops != &gntdev_vmops) - goto out_unlock; + return -EINVAL; map = vma->vm_private_data; if (!map) - goto out_unlock; + return -EINVAL; op.offset = map->index << PAGE_SHIFT; op.count = map->count; - rv = 0; - - out_unlock: - up_read(¤t->mm->mmap_sem); - if (rv == 0 && copy_to_user(u, &op, sizeof(op)) != 0) + if (copy_to_user(u, &op, sizeof(op)) != 0) return -EFAULT; - return rv; + return 0; } static long gntdev_ioctl_notify(struct gntdev_priv *priv, void __user *u) @@ -824,7 +778,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma) out_put_map: if (use_ptemod) map->vma = NULL; - gntdev_put_map(priv, map); + gntdev_put_map(map); return err; } diff --git a/trunk/drivers/xen/grant-table.c b/trunk/drivers/xen/grant-table.c index 157c0ccda3ef..7038de53652b 100644 --- a/trunk/drivers/xen/grant-table.c +++ b/trunk/drivers/xen/grant-table.c @@ -56,6 +56,10 @@ /* External tools reserve first few grant table entries. */ #define NR_RESERVED_ENTRIES 8 #define GNTTAB_LIST_END 0xffffffff +#define GREFS_PER_GRANT_FRAME \ +(grant_table_version == 1 ? \ +(PAGE_SIZE / sizeof(struct grant_entry_v1)) : \ +(PAGE_SIZE / sizeof(union grant_entry_v2))) static grant_ref_t **gnttab_list; static unsigned int nr_grant_frames; @@ -150,7 +154,6 @@ static struct gnttab_ops *gnttab_interface; static grant_status_t *grstatus; static int grant_table_version; -static int grefs_per_grant_frame; static struct gnttab_free_callback *gnttab_free_callback_list; @@ -764,14 +767,12 @@ static int grow_gnttab_list(unsigned int more_frames) unsigned int new_nr_grant_frames, extra_entries, i; unsigned int nr_glist_frames, new_nr_glist_frames; - BUG_ON(grefs_per_grant_frame == 0); - new_nr_grant_frames = nr_grant_frames + more_frames; - extra_entries = more_frames * grefs_per_grant_frame; + extra_entries = more_frames * GREFS_PER_GRANT_FRAME; - nr_glist_frames = (nr_grant_frames * grefs_per_grant_frame + RPP - 1) / RPP; + nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP; new_nr_glist_frames = - (new_nr_grant_frames * grefs_per_grant_frame + RPP - 1) / RPP; + (new_nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP; for (i = nr_glist_frames; i < new_nr_glist_frames; i++) { gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_ATOMIC); if (!gnttab_list[i]) @@ -779,12 +780,12 @@ static int grow_gnttab_list(unsigned int more_frames) } - for (i = grefs_per_grant_frame * nr_grant_frames; - i < grefs_per_grant_frame * new_nr_grant_frames - 1; i++) + for (i = GREFS_PER_GRANT_FRAME * nr_grant_frames; + i < GREFS_PER_GRANT_FRAME * new_nr_grant_frames - 1; i++) gnttab_entry(i) = i + 1; gnttab_entry(i) = gnttab_free_head; - gnttab_free_head = grefs_per_grant_frame * nr_grant_frames; + gnttab_free_head = GREFS_PER_GRANT_FRAME * nr_grant_frames; gnttab_free_count += extra_entries; nr_grant_frames = new_nr_grant_frames; @@ -956,8 +957,7 @@ EXPORT_SYMBOL_GPL(gnttab_unmap_refs); static unsigned nr_status_frames(unsigned nr_grant_frames) { - BUG_ON(grefs_per_grant_frame == 0); - return (nr_grant_frames * grefs_per_grant_frame + SPP - 1) / SPP; + return (nr_grant_frames * GREFS_PER_GRANT_FRAME + SPP - 1) / SPP; } static int gnttab_map_frames_v1(xen_pfn_t *frames, unsigned int nr_gframes) @@ -1115,7 +1115,6 @@ static void gnttab_request_version(void) rc = HYPERVISOR_grant_table_op(GNTTABOP_set_version, &gsv, 1); if (rc == 0 && gsv.version == 2) { grant_table_version = 2; - grefs_per_grant_frame = PAGE_SIZE / sizeof(union grant_entry_v2); gnttab_interface = &gnttab_v2_ops; } else if (grant_table_version == 2) { /* @@ -1128,17 +1127,17 @@ static void gnttab_request_version(void) panic("we need grant tables version 2, but only version 1 is available"); } else { grant_table_version = 1; - grefs_per_grant_frame = PAGE_SIZE / sizeof(struct grant_entry_v1); gnttab_interface = &gnttab_v1_ops; } printk(KERN_INFO "Grant tables using version %d layout.\n", grant_table_version); } -static int gnttab_setup(void) +int gnttab_resume(void) { unsigned int max_nr_gframes; + gnttab_request_version(); max_nr_gframes = gnttab_max_grant_frames(); if (max_nr_gframes < nr_grant_frames) return -ENOSYS; @@ -1161,12 +1160,6 @@ static int gnttab_setup(void) return 0; } -int gnttab_resume(void) -{ - gnttab_request_version(); - return gnttab_setup(); -} - int gnttab_suspend(void) { gnttab_interface->unmap_frames(); @@ -1178,10 +1171,9 @@ static int gnttab_expand(unsigned int req_entries) int rc; unsigned int cur, extra; - BUG_ON(grefs_per_grant_frame == 0); cur = nr_grant_frames; - extra = ((req_entries + (grefs_per_grant_frame-1)) / - grefs_per_grant_frame); + extra = ((req_entries + (GREFS_PER_GRANT_FRAME-1)) / + GREFS_PER_GRANT_FRAME); if (cur + extra > gnttab_max_grant_frames()) return -ENOSPC; @@ -1199,23 +1191,21 @@ int gnttab_init(void) unsigned int nr_init_grefs; int ret; - gnttab_request_version(); nr_grant_frames = 1; boot_max_nr_grant_frames = __max_nr_grant_frames(); /* Determine the maximum number of frames required for the * grant reference free list on the current hypervisor. */ - BUG_ON(grefs_per_grant_frame == 0); max_nr_glist_frames = (boot_max_nr_grant_frames * - grefs_per_grant_frame / RPP); + GREFS_PER_GRANT_FRAME / RPP); gnttab_list = kmalloc(max_nr_glist_frames * sizeof(grant_ref_t *), GFP_KERNEL); if (gnttab_list == NULL) return -ENOMEM; - nr_glist_frames = (nr_grant_frames * grefs_per_grant_frame + RPP - 1) / RPP; + nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP; for (i = 0; i < nr_glist_frames; i++) { gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_KERNEL); if (gnttab_list[i] == NULL) { @@ -1224,12 +1214,12 @@ int gnttab_init(void) } } - if (gnttab_setup() < 0) { + if (gnttab_resume() < 0) { ret = -ENODEV; goto ini_nomem; } - nr_init_grefs = nr_grant_frames * grefs_per_grant_frame; + nr_init_grefs = nr_grant_frames * GREFS_PER_GRANT_FRAME; for (i = NR_RESERVED_ENTRIES; i < nr_init_grefs - 1; i++) gnttab_entry(i) = i + 1; diff --git a/trunk/drivers/xen/privcmd.c b/trunk/drivers/xen/privcmd.c index ca2b00e9d558..0bbbccbb1f12 100644 --- a/trunk/drivers/xen/privcmd.c +++ b/trunk/drivers/xen/privcmd.c @@ -199,6 +199,9 @@ static long privcmd_ioctl_mmap(void __user *udata) LIST_HEAD(pagelist); struct mmap_mfn_state state; + if (!xen_initial_domain()) + return -EPERM; + /* We only support privcmd_ioctl_mmap_batch for auto translated. */ if (xen_feature(XENFEAT_auto_translated_physmap)) return -ENOSYS; @@ -258,12 +261,11 @@ struct mmap_batch_state { * -ENOENT if at least 1 -ENOENT has happened. */ int global_error; - int version; + /* An array for individual errors */ + int *err; /* User-space mfn array to store errors in the second pass for V1. */ xen_pfn_t __user *user_mfn; - /* User-space int array to store errors in the second pass for V2. */ - int __user *user_err; }; /* auto translated dom0 note: if domU being created is PV, then mfn is @@ -286,19 +288,7 @@ static int mmap_batch_fn(void *data, void *state) &cur_page); /* Store error code for second pass. */ - if (st->version == 1) { - if (ret < 0) { - /* - * V1 encodes the error codes in the 32bit top nibble of the - * mfn (with its known limitations vis-a-vis 64 bit callers). - */ - *mfnp |= (ret == -ENOENT) ? - PRIVCMD_MMAPBATCH_PAGED_ERROR : - PRIVCMD_MMAPBATCH_MFN_ERROR; - } - } else { /* st->version == 2 */ - *((int *) mfnp) = ret; - } + *(st->err++) = ret; /* And see if it affects the global_error. */ if (ret < 0) { @@ -315,25 +305,20 @@ static int mmap_batch_fn(void *data, void *state) return 0; } -static int mmap_return_errors(void *data, void *state) +static int mmap_return_errors_v1(void *data, void *state) { + xen_pfn_t *mfnp = data; struct mmap_batch_state *st = state; + int err = *(st->err++); - if (st->version == 1) { - xen_pfn_t mfnp = *((xen_pfn_t *) data); - if (mfnp & PRIVCMD_MMAPBATCH_MFN_ERROR) - return __put_user(mfnp, st->user_mfn++); - else - st->user_mfn++; - } else { /* st->version == 2 */ - int err = *((int *) data); - if (err) - return __put_user(err, st->user_err++); - else - st->user_err++; - } - - return 0; + /* + * V1 encodes the error codes in the 32bit top nibble of the + * mfn (with its known limitations vis-a-vis 64 bit callers). + */ + *mfnp |= (err == -ENOENT) ? + PRIVCMD_MMAPBATCH_PAGED_ERROR : + PRIVCMD_MMAPBATCH_MFN_ERROR; + return __put_user(*mfnp, st->user_mfn++); } /* Allocate pfns that are then mapped with gmfns from foreign domid. Update @@ -372,8 +357,12 @@ static long privcmd_ioctl_mmap_batch(void __user *udata, int version) struct vm_area_struct *vma; unsigned long nr_pages; LIST_HEAD(pagelist); + int *err_array = NULL; struct mmap_batch_state state; + if (!xen_initial_domain()) + return -EPERM; + switch (version) { case 1: if (copy_from_user(&m, udata, sizeof(struct privcmd_mmapbatch))) @@ -407,12 +396,10 @@ static long privcmd_ioctl_mmap_batch(void __user *udata, int version) goto out; } - if (version == 2) { - /* Zero error array now to only copy back actual errors. */ - if (clear_user(m.err, sizeof(int) * m.num)) { - ret = -EFAULT; - goto out; - } + err_array = kcalloc(m.num, sizeof(int), GFP_KERNEL); + if (err_array == NULL) { + ret = -ENOMEM; + goto out; } down_write(&mm->mmap_sem); @@ -440,7 +427,7 @@ static long privcmd_ioctl_mmap_batch(void __user *udata, int version) state.va = m.addr; state.index = 0; state.global_error = 0; - state.version = version; + state.err = err_array; /* mmap_batch_fn guarantees ret == 0 */ BUG_ON(traverse_pages(m.num, sizeof(xen_pfn_t), @@ -448,14 +435,21 @@ static long privcmd_ioctl_mmap_batch(void __user *udata, int version) up_write(&mm->mmap_sem); - if (state.global_error) { - /* Write back errors in second pass. */ - state.user_mfn = (xen_pfn_t *)m.arr; - state.user_err = m.err; - ret = traverse_pages(m.num, sizeof(xen_pfn_t), - &pagelist, mmap_return_errors, &state); - } else - ret = 0; + if (version == 1) { + if (state.global_error) { + /* Write back errors in second pass. */ + state.user_mfn = (xen_pfn_t *)m.arr; + state.err = err_array; + ret = traverse_pages(m.num, sizeof(xen_pfn_t), + &pagelist, mmap_return_errors_v1, &state); + } else + ret = 0; + + } else if (version == 2) { + ret = __copy_to_user(m.err, err_array, m.num * sizeof(int)); + if (ret) + ret = -EFAULT; + } /* If we have not had any EFAULT-like global errors then set the global * error to -ENOENT if necessary. */ @@ -463,6 +457,7 @@ static long privcmd_ioctl_mmap_batch(void __user *udata, int version) ret = -ENOENT; out: + kfree(err_array); free_page_list(&pagelist); return ret; diff --git a/trunk/drivers/xen/xen-pciback/pciback.h b/trunk/drivers/xen/xen-pciback/pciback.h index f72af87640e0..a7def010eba3 100644 --- a/trunk/drivers/xen/xen-pciback/pciback.h +++ b/trunk/drivers/xen/xen-pciback/pciback.h @@ -124,7 +124,7 @@ static inline int xen_pcibk_add_pci_dev(struct xen_pcibk_device *pdev, static inline void xen_pcibk_release_pci_dev(struct xen_pcibk_device *pdev, struct pci_dev *dev) { - if (xen_pcibk_backend && xen_pcibk_backend->release) + if (xen_pcibk_backend && xen_pcibk_backend->free) return xen_pcibk_backend->release(pdev, dev); } diff --git a/trunk/fs/Kconfig b/trunk/fs/Kconfig index 780725a463b1..cfe512fd1caf 100644 --- a/trunk/fs/Kconfig +++ b/trunk/fs/Kconfig @@ -68,6 +68,16 @@ source "fs/quota/Kconfig" source "fs/autofs4/Kconfig" source "fs/fuse/Kconfig" +config CUSE + tristate "Character device in Userspace support" + depends on FUSE_FS + help + This FUSE extension allows character devices to be + implemented in userspace. + + If you want to develop or use userspace character device + based on CUSE, answer Y or M. + config GENERIC_ACL bool select FS_POSIX_ACL diff --git a/trunk/fs/btrfs/extent-tree.c b/trunk/fs/btrfs/extent-tree.c index a8b8adc05070..521e9d4424f6 100644 --- a/trunk/fs/btrfs/extent-tree.c +++ b/trunk/fs/btrfs/extent-tree.c @@ -3997,7 +3997,7 @@ static int reserve_metadata_bytes(struct btrfs_root *root, * We make the other tasks wait for the flush only when we can flush * all things. */ - if (ret && flush != BTRFS_RESERVE_NO_FLUSH) { + if (ret && flush == BTRFS_RESERVE_FLUSH_ALL) { flushing = true; space_info->flush = 1; } @@ -5560,7 +5560,7 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans, int empty_cluster = 2 * 1024 * 1024; struct btrfs_space_info *space_info; int loop = 0; - int index = __get_raid_index(data); + int index = 0; int alloc_type = (data & BTRFS_BLOCK_GROUP_DATA) ? RESERVE_ALLOC_NO_ACCOUNT : RESERVE_ALLOC; bool found_uncached_bg = false; @@ -6788,13 +6788,11 @@ static noinline int walk_up_proc(struct btrfs_trans_handle *trans, &wc->flags[level]); if (ret < 0) { btrfs_tree_unlock_rw(eb, path->locks[level]); - path->locks[level] = 0; return ret; } BUG_ON(wc->refs[level] == 0); if (wc->refs[level] == 1) { btrfs_tree_unlock_rw(eb, path->locks[level]); - path->locks[level] = 0; return 1; } } diff --git a/trunk/fs/btrfs/extent_map.c b/trunk/fs/btrfs/extent_map.c index 2e8cae63d247..f169d6b11d7f 100644 --- a/trunk/fs/btrfs/extent_map.c +++ b/trunk/fs/btrfs/extent_map.c @@ -171,10 +171,6 @@ static int mergable_maps(struct extent_map *prev, struct extent_map *next) if (test_bit(EXTENT_FLAG_COMPRESSED, &prev->flags)) return 0; - if (test_bit(EXTENT_FLAG_LOGGING, &prev->flags) || - test_bit(EXTENT_FLAG_LOGGING, &next->flags)) - return 0; - if (extent_map_end(prev) == next->start && prev->flags == next->flags && prev->bdev == next->bdev && @@ -259,8 +255,7 @@ int unpin_extent_cache(struct extent_map_tree *tree, u64 start, u64 len, if (!em) goto out; - if (!test_bit(EXTENT_FLAG_LOGGING, &em->flags)) - list_move(&em->list, &tree->modified_extents); + list_move(&em->list, &tree->modified_extents); em->generation = gen; clear_bit(EXTENT_FLAG_PINNED, &em->flags); em->mod_start = em->start; @@ -285,12 +280,6 @@ int unpin_extent_cache(struct extent_map_tree *tree, u64 start, u64 len, } -void clear_em_logging(struct extent_map_tree *tree, struct extent_map *em) -{ - clear_bit(EXTENT_FLAG_LOGGING, &em->flags); - try_merge_map(tree, em); -} - /** * add_extent_mapping - add new extent map to the extent tree * @tree: tree to insert new map in diff --git a/trunk/fs/btrfs/extent_map.h b/trunk/fs/btrfs/extent_map.h index c6598c89cff8..922943ce29e8 100644 --- a/trunk/fs/btrfs/extent_map.h +++ b/trunk/fs/btrfs/extent_map.h @@ -69,7 +69,6 @@ void free_extent_map(struct extent_map *em); int __init extent_map_init(void); void extent_map_exit(void); int unpin_extent_cache(struct extent_map_tree *tree, u64 start, u64 len, u64 gen); -void clear_em_logging(struct extent_map_tree *tree, struct extent_map *em); struct extent_map *search_extent_mapping(struct extent_map_tree *tree, u64 start, u64 len); #endif diff --git a/trunk/fs/btrfs/file-item.c b/trunk/fs/btrfs/file-item.c index 94aa53b38721..bd38cef42358 100644 --- a/trunk/fs/btrfs/file-item.c +++ b/trunk/fs/btrfs/file-item.c @@ -460,8 +460,8 @@ int btrfs_csum_one_bio(struct btrfs_root *root, struct inode *inode, if (!contig) offset = page_offset(bvec->bv_page) + bvec->bv_offset; - if (offset >= ordered->file_offset + ordered->len || - offset < ordered->file_offset) { + if (!contig && (offset >= ordered->file_offset + ordered->len || + offset < ordered->file_offset)) { unsigned long bytes_left; sums->len = this_sum_bytes; this_sum_bytes = 0; diff --git a/trunk/fs/btrfs/file.c b/trunk/fs/btrfs/file.c index f76b1fd160d4..77061bf43edb 100644 --- a/trunk/fs/btrfs/file.c +++ b/trunk/fs/btrfs/file.c @@ -2241,7 +2241,6 @@ static int find_desired_extent(struct inode *inode, loff_t *offset, int whence) if (lockend <= lockstart) lockend = lockstart + root->sectorsize; - lockend--; len = lockend - lockstart + 1; len = max_t(u64, len, root->sectorsize); @@ -2308,12 +2307,9 @@ static int find_desired_extent(struct inode *inode, loff_t *offset, int whence) } } - if (!test_bit(EXTENT_FLAG_PREALLOC, - &em->flags)) { - *offset = start; - free_extent_map(em); - break; - } + *offset = start; + free_extent_map(em); + break; } } diff --git a/trunk/fs/btrfs/free-space-cache.c b/trunk/fs/btrfs/free-space-cache.c index 0be7a8742a43..59ea2e4349c9 100644 --- a/trunk/fs/btrfs/free-space-cache.c +++ b/trunk/fs/btrfs/free-space-cache.c @@ -1862,13 +1862,11 @@ int btrfs_remove_free_space(struct btrfs_block_group_cache *block_group, { struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl; struct btrfs_free_space *info; - int ret; - bool re_search = false; + int ret = 0; spin_lock(&ctl->tree_lock); again: - ret = 0; if (!bytes) goto out_lock; @@ -1881,17 +1879,17 @@ int btrfs_remove_free_space(struct btrfs_block_group_cache *block_group, info = tree_search_offset(ctl, offset_to_bitmap(ctl, offset), 1, 0); if (!info) { - /* - * If we found a partial bit of our free space in a - * bitmap but then couldn't find the other part this may - * be a problem, so WARN about it. + /* the tree logging code might be calling us before we + * have fully loaded the free space rbtree for this + * block group. So it is possible the entry won't + * be in the rbtree yet at all. The caching code + * will make sure not to put it in the rbtree if + * the logging code has pinned it. */ - WARN_ON(re_search); goto out_lock; } } - re_search = false; if (!info->bitmap) { unlink_free_space(ctl, info); if (offset == info->offset) { @@ -1937,10 +1935,8 @@ int btrfs_remove_free_space(struct btrfs_block_group_cache *block_group, } ret = remove_from_bitmap(ctl, info, &offset, &bytes); - if (ret == -EAGAIN) { - re_search = true; + if (ret == -EAGAIN) goto again; - } BUG_ON(ret); /* logic error */ out_lock: spin_unlock(&ctl->tree_lock); diff --git a/trunk/fs/btrfs/inode.c b/trunk/fs/btrfs/inode.c index cc93b23ca352..16d9e8e191e6 100644 --- a/trunk/fs/btrfs/inode.c +++ b/trunk/fs/btrfs/inode.c @@ -88,7 +88,7 @@ static unsigned char btrfs_type_by_mode[S_IFMT >> S_SHIFT] = { [S_IFLNK >> S_SHIFT] = BTRFS_FT_SYMLINK, }; -static int btrfs_setsize(struct inode *inode, struct iattr *attr); +static int btrfs_setsize(struct inode *inode, loff_t newsize); static int btrfs_truncate(struct inode *inode); static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent); static noinline int cow_file_range(struct inode *inode, @@ -2478,18 +2478,6 @@ int btrfs_orphan_cleanup(struct btrfs_root *root) continue; } nr_truncate++; - - /* 1 for the orphan item deletion. */ - trans = btrfs_start_transaction(root, 1); - if (IS_ERR(trans)) { - ret = PTR_ERR(trans); - goto out; - } - ret = btrfs_orphan_add(trans, inode); - btrfs_end_transaction(trans, root); - if (ret) - goto out; - ret = btrfs_truncate(inode); } else { nr_unlink++; @@ -3677,7 +3665,6 @@ int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size) block_end - cur_offset, 0); if (IS_ERR(em)) { err = PTR_ERR(em); - em = NULL; break; } last_byte = min(extent_map_end(em), block_end); @@ -3761,27 +3748,16 @@ int btrfs_cont_expand(struct inode *inode, loff_t oldsize, loff_t size) return err; } -static int btrfs_setsize(struct inode *inode, struct iattr *attr) +static int btrfs_setsize(struct inode *inode, loff_t newsize) { struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_trans_handle *trans; loff_t oldsize = i_size_read(inode); - loff_t newsize = attr->ia_size; - int mask = attr->ia_valid; int ret; if (newsize == oldsize) return 0; - /* - * The regular truncate() case without ATTR_CTIME and ATTR_MTIME is a - * special case where we need to update the times despite not having - * these flags set. For all other operations the VFS set these flags - * explicitly if it wants a timestamp update. - */ - if (newsize != oldsize && (!(mask & (ATTR_CTIME | ATTR_MTIME)))) - inode->i_ctime = inode->i_mtime = current_fs_time(inode->i_sb); - if (newsize > oldsize) { truncate_pagecache(inode, oldsize, newsize); ret = btrfs_cont_expand(inode, oldsize, newsize); @@ -3807,34 +3783,9 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr) set_bit(BTRFS_INODE_ORDERED_DATA_CLOSE, &BTRFS_I(inode)->runtime_flags); - /* - * 1 for the orphan item we're going to add - * 1 for the orphan item deletion. - */ - trans = btrfs_start_transaction(root, 2); - if (IS_ERR(trans)) - return PTR_ERR(trans); - - /* - * We need to do this in case we fail at _any_ point during the - * actual truncate. Once we do the truncate_setsize we could - * invalidate pages which forces any outstanding ordered io to - * be instantly completed which will give us extents that need - * to be truncated. If we fail to get an orphan inode down we - * could have left over extents that were never meant to live, - * so we need to garuntee from this point on that everything - * will be consistent. - */ - ret = btrfs_orphan_add(trans, inode); - btrfs_end_transaction(trans, root); - if (ret) - return ret; - /* we don't support swapfiles, so vmtruncate shouldn't fail */ truncate_setsize(inode, newsize); ret = btrfs_truncate(inode); - if (ret && inode->i_nlink) - btrfs_orphan_del(NULL, inode); } return ret; @@ -3854,7 +3805,7 @@ static int btrfs_setattr(struct dentry *dentry, struct iattr *attr) return err; if (S_ISREG(inode->i_mode) && (attr->ia_valid & ATTR_SIZE)) { - err = btrfs_setsize(inode, attr); + err = btrfs_setsize(inode, attr->ia_size); if (err) return err; } @@ -5621,13 +5572,10 @@ struct extent_map *btrfs_get_extent_fiemap(struct inode *inode, struct page *pag return em; if (em) { /* - * if our em maps to - * - a hole or - * - a pre-alloc extent, - * there might actually be delalloc bytes behind it. + * if our em maps to a hole, there might + * actually be delalloc bytes behind it */ - if (em->block_start != EXTENT_MAP_HOLE && - !test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) + if (em->block_start != EXTENT_MAP_HOLE) return em; else hole_em = em; @@ -5709,8 +5657,6 @@ struct extent_map *btrfs_get_extent_fiemap(struct inode *inode, struct page *pag */ em->block_start = hole_em->block_start; em->block_len = hole_len; - if (test_bit(EXTENT_FLAG_PREALLOC, &hole_em->flags)) - set_bit(EXTENT_FLAG_PREALLOC, &em->flags); } else { em->start = range_start; em->len = found; @@ -6969,9 +6915,11 @@ static int btrfs_truncate(struct inode *inode) /* * 1 for the truncate slack space + * 1 for the orphan item we're going to add + * 1 for the orphan item deletion * 1 for updating the inode. */ - trans = btrfs_start_transaction(root, 2); + trans = btrfs_start_transaction(root, 4); if (IS_ERR(trans)) { err = PTR_ERR(trans); goto out; @@ -6982,6 +6930,12 @@ static int btrfs_truncate(struct inode *inode) min_size); BUG_ON(ret); + ret = btrfs_orphan_add(trans, inode); + if (ret) { + btrfs_end_transaction(trans, root); + goto out; + } + /* * setattr is responsible for setting the ordered_data_close flag, * but that is only tested during the last file release. That @@ -7050,6 +7004,12 @@ static int btrfs_truncate(struct inode *inode) ret = btrfs_orphan_del(trans, inode); if (ret) err = ret; + } else if (ret && inode->i_nlink > 0) { + /* + * Failed to do the truncate, remove us from the in memory + * orphan list. + */ + ret = btrfs_orphan_del(NULL, inode); } if (trans) { @@ -7571,61 +7531,41 @@ void btrfs_wait_and_free_delalloc_work(struct btrfs_delalloc_work *work) */ int btrfs_start_delalloc_inodes(struct btrfs_root *root, int delay_iput) { + struct list_head *head = &root->fs_info->delalloc_inodes; struct btrfs_inode *binode; struct inode *inode; struct btrfs_delalloc_work *work, *next; struct list_head works; - struct list_head splice; int ret = 0; if (root->fs_info->sb->s_flags & MS_RDONLY) return -EROFS; INIT_LIST_HEAD(&works); - INIT_LIST_HEAD(&splice); -again: + spin_lock(&root->fs_info->delalloc_lock); - list_splice_init(&root->fs_info->delalloc_inodes, &splice); - while (!list_empty(&splice)) { - binode = list_entry(splice.next, struct btrfs_inode, + while (!list_empty(head)) { + binode = list_entry(head->next, struct btrfs_inode, delalloc_inodes); - - list_del_init(&binode->delalloc_inodes); - inode = igrab(&binode->vfs_inode); if (!inode) - continue; - - list_add_tail(&binode->delalloc_inodes, - &root->fs_info->delalloc_inodes); + list_del_init(&binode->delalloc_inodes); spin_unlock(&root->fs_info->delalloc_lock); - - work = btrfs_alloc_delalloc_work(inode, 0, delay_iput); - if (unlikely(!work)) { - ret = -ENOMEM; - goto out; + if (inode) { + work = btrfs_alloc_delalloc_work(inode, 0, delay_iput); + if (!work) { + ret = -ENOMEM; + goto out; + } + list_add_tail(&work->list, &works); + btrfs_queue_worker(&root->fs_info->flush_workers, + &work->work); } - list_add_tail(&work->list, &works); - btrfs_queue_worker(&root->fs_info->flush_workers, - &work->work); - cond_resched(); spin_lock(&root->fs_info->delalloc_lock); } spin_unlock(&root->fs_info->delalloc_lock); - list_for_each_entry_safe(work, next, &works, list) { - list_del_init(&work->list); - btrfs_wait_and_free_delalloc_work(work); - } - - spin_lock(&root->fs_info->delalloc_lock); - if (!list_empty(&root->fs_info->delalloc_inodes)) { - spin_unlock(&root->fs_info->delalloc_lock); - goto again; - } - spin_unlock(&root->fs_info->delalloc_lock); - /* the filemap_flush will queue IO into the worker threads, but * we have to make sure the IO is actually started and that * ordered extents get created before we return @@ -7638,18 +7578,11 @@ int btrfs_start_delalloc_inodes(struct btrfs_root *root, int delay_iput) atomic_read(&root->fs_info->async_delalloc_pages) == 0)); } atomic_dec(&root->fs_info->async_submit_draining); - return 0; out: list_for_each_entry_safe(work, next, &works, list) { list_del_init(&work->list); btrfs_wait_and_free_delalloc_work(work); } - - if (!list_empty_careful(&splice)) { - spin_lock(&root->fs_info->delalloc_lock); - list_splice_tail(&splice, &root->fs_info->delalloc_inodes); - spin_unlock(&root->fs_info->delalloc_lock); - } return ret; } diff --git a/trunk/fs/btrfs/ioctl.c b/trunk/fs/btrfs/ioctl.c index 5b22d45d3c6a..4b4516770f05 100644 --- a/trunk/fs/btrfs/ioctl.c +++ b/trunk/fs/btrfs/ioctl.c @@ -1339,8 +1339,7 @@ static noinline int btrfs_ioctl_resize(struct file *file, if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running, 1)) { pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n"); - mnt_drop_write_file(file); - return -EINVAL; + return -EINPROGRESS; } mutex_lock(&root->fs_info->volume_mutex); @@ -1363,7 +1362,6 @@ static noinline int btrfs_ioctl_resize(struct file *file, printk(KERN_INFO "btrfs: resizing devid %llu\n", (unsigned long long)devid); } - device = btrfs_find_device(root->fs_info, devid, NULL, NULL); if (!device) { printk(KERN_INFO "btrfs: resizer unable to find device %llu\n", @@ -1371,10 +1369,9 @@ static noinline int btrfs_ioctl_resize(struct file *file, ret = -EINVAL; goto out_free; } - - if (!device->writeable) { + if (device->fs_devices && device->fs_devices->seeding) { printk(KERN_INFO "btrfs: resizer unable to apply on " - "readonly device %llu\n", + "seeding device %llu\n", (unsigned long long)devid); ret = -EINVAL; goto out_free; @@ -1446,8 +1443,8 @@ static noinline int btrfs_ioctl_resize(struct file *file, kfree(vol_args); out: mutex_unlock(&root->fs_info->volume_mutex); - atomic_set(&root->fs_info->mutually_exclusive_operation_running, 0); mnt_drop_write_file(file); + atomic_set(&root->fs_info->mutually_exclusive_operation_running, 0); return ret; } @@ -2098,12 +2095,12 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, err = inode_permission(inode, MAY_WRITE | MAY_EXEC); if (err) goto out_dput; - } - /* check if subvolume may be deleted by a user */ - err = btrfs_may_delete(dir, dentry, 1); - if (err) - goto out_dput; + /* check if subvolume may be deleted by a non-root user */ + err = btrfs_may_delete(dir, dentry, 1); + if (err) + goto out_dput; + } if (btrfs_ino(inode) != BTRFS_FIRST_FREE_OBJECTID) { err = -EINVAL; @@ -2186,20 +2183,19 @@ static int btrfs_ioctl_defrag(struct file *file, void __user *argp) struct btrfs_ioctl_defrag_range_args *range; int ret; - ret = mnt_want_write_file(file); - if (ret) - return ret; + if (btrfs_root_readonly(root)) + return -EROFS; if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running, 1)) { pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n"); - mnt_drop_write_file(file); - return -EINVAL; + return -EINPROGRESS; } - - if (btrfs_root_readonly(root)) { - ret = -EROFS; - goto out; + ret = mnt_want_write_file(file); + if (ret) { + atomic_set(&root->fs_info->mutually_exclusive_operation_running, + 0); + return ret; } switch (inode->i_mode & S_IFMT) { @@ -2251,8 +2247,8 @@ static int btrfs_ioctl_defrag(struct file *file, void __user *argp) ret = -EINVAL; } out: - atomic_set(&root->fs_info->mutually_exclusive_operation_running, 0); mnt_drop_write_file(file); + atomic_set(&root->fs_info->mutually_exclusive_operation_running, 0); return ret; } @@ -2267,7 +2263,7 @@ static long btrfs_ioctl_add_dev(struct btrfs_root *root, void __user *arg) if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running, 1)) { pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n"); - return -EINVAL; + return -EINPROGRESS; } mutex_lock(&root->fs_info->volume_mutex); @@ -2304,7 +2300,7 @@ static long btrfs_ioctl_rm_dev(struct file *file, void __user *arg) 1)) { pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n"); mnt_drop_write_file(file); - return -EINVAL; + return -EINPROGRESS; } mutex_lock(&root->fs_info->volume_mutex); @@ -2320,8 +2316,8 @@ static long btrfs_ioctl_rm_dev(struct file *file, void __user *arg) kfree(vol_args); out: mutex_unlock(&root->fs_info->volume_mutex); - atomic_set(&root->fs_info->mutually_exclusive_operation_running, 0); mnt_drop_write_file(file); + atomic_set(&root->fs_info->mutually_exclusive_operation_running, 0); return ret; } @@ -3441,8 +3437,8 @@ static long btrfs_ioctl_balance(struct file *file, void __user *arg) struct btrfs_fs_info *fs_info = root->fs_info; struct btrfs_ioctl_balance_args *bargs; struct btrfs_balance_control *bctl; - bool need_unlock; /* for mut. excl. ops lock */ int ret; + int need_to_clear_lock = 0; if (!capable(CAP_SYS_ADMIN)) return -EPERM; @@ -3451,61 +3447,14 @@ static long btrfs_ioctl_balance(struct file *file, void __user *arg) if (ret) return ret; -again: - if (!atomic_xchg(&fs_info->mutually_exclusive_operation_running, 1)) { - mutex_lock(&fs_info->volume_mutex); - mutex_lock(&fs_info->balance_mutex); - need_unlock = true; - goto locked; - } - - /* - * mut. excl. ops lock is locked. Three possibilites: - * (1) some other op is running - * (2) balance is running - * (3) balance is paused -- special case (think resume) - */ + mutex_lock(&fs_info->volume_mutex); mutex_lock(&fs_info->balance_mutex); - if (fs_info->balance_ctl) { - /* this is either (2) or (3) */ - if (!atomic_read(&fs_info->balance_running)) { - mutex_unlock(&fs_info->balance_mutex); - if (!mutex_trylock(&fs_info->volume_mutex)) - goto again; - mutex_lock(&fs_info->balance_mutex); - - if (fs_info->balance_ctl && - !atomic_read(&fs_info->balance_running)) { - /* this is (3) */ - need_unlock = false; - goto locked; - } - - mutex_unlock(&fs_info->balance_mutex); - mutex_unlock(&fs_info->volume_mutex); - goto again; - } else { - /* this is (2) */ - mutex_unlock(&fs_info->balance_mutex); - ret = -EINPROGRESS; - goto out; - } - } else { - /* this is (1) */ - mutex_unlock(&fs_info->balance_mutex); - pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n"); - ret = -EINVAL; - goto out; - } - -locked: - BUG_ON(!atomic_read(&fs_info->mutually_exclusive_operation_running)); if (arg) { bargs = memdup_user(arg, sizeof(*bargs)); if (IS_ERR(bargs)) { ret = PTR_ERR(bargs); - goto out_unlock; + goto out; } if (bargs->flags & BTRFS_BALANCE_RESUME) { @@ -3525,10 +3474,13 @@ static long btrfs_ioctl_balance(struct file *file, void __user *arg) bargs = NULL; } - if (fs_info->balance_ctl) { + if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running, + 1)) { + pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n"); ret = -EINPROGRESS; goto out_bargs; } + need_to_clear_lock = 1; bctl = kzalloc(sizeof(*bctl), GFP_NOFS); if (!bctl) { @@ -3549,17 +3501,11 @@ static long btrfs_ioctl_balance(struct file *file, void __user *arg) } do_balance: + ret = btrfs_balance(bctl, bargs); /* - * Ownership of bctl and mutually_exclusive_operation_running - * goes to to btrfs_balance. bctl is freed in __cancel_balance, - * or, if restriper was paused all the way until unmount, in - * free_fs_info. mutually_exclusive_operation_running is - * cleared in __cancel_balance. + * bctl is freed in __cancel_balance or in free_fs_info if + * restriper was paused all the way until unmount */ - need_unlock = false; - - ret = btrfs_balance(bctl, bargs); - if (arg) { if (copy_to_user(arg, bargs, sizeof(*bargs))) ret = -EFAULT; @@ -3567,12 +3513,12 @@ static long btrfs_ioctl_balance(struct file *file, void __user *arg) out_bargs: kfree(bargs); -out_unlock: +out: + if (need_to_clear_lock) + atomic_set(&root->fs_info->mutually_exclusive_operation_running, + 0); mutex_unlock(&fs_info->balance_mutex); mutex_unlock(&fs_info->volume_mutex); - if (need_unlock) - atomic_set(&fs_info->mutually_exclusive_operation_running, 0); -out: mnt_drop_write_file(file); return ret; } @@ -3752,11 +3698,6 @@ static long btrfs_ioctl_qgroup_create(struct file *file, void __user *arg) goto drop_write; } - if (!sa->qgroupid) { - ret = -EINVAL; - goto out; - } - trans = btrfs_join_transaction(root); if (IS_ERR(trans)) { ret = PTR_ERR(trans); diff --git a/trunk/fs/btrfs/qgroup.c b/trunk/fs/btrfs/qgroup.c index a5c856234323..fe9d02c45f8e 100644 --- a/trunk/fs/btrfs/qgroup.c +++ b/trunk/fs/btrfs/qgroup.c @@ -379,13 +379,6 @@ int btrfs_read_qgroup_config(struct btrfs_fs_info *fs_info) ret = add_relation_rb(fs_info, found_key.objectid, found_key.offset); - if (ret == -ENOENT) { - printk(KERN_WARNING - "btrfs: orphan qgroup relation 0x%llx->0x%llx\n", - (unsigned long long)found_key.objectid, - (unsigned long long)found_key.offset); - ret = 0; /* ignore the error */ - } if (ret) goto out; next2: @@ -963,28 +956,17 @@ int btrfs_remove_qgroup(struct btrfs_trans_handle *trans, struct btrfs_fs_info *fs_info, u64 qgroupid) { struct btrfs_root *quota_root; - struct btrfs_qgroup *qgroup; int ret = 0; quota_root = fs_info->quota_root; if (!quota_root) return -EINVAL; - /* check if there are no relations to this qgroup */ - spin_lock(&fs_info->qgroup_lock); - qgroup = find_qgroup_rb(fs_info, qgroupid); - if (qgroup) { - if (!list_empty(&qgroup->groups) || !list_empty(&qgroup->members)) { - spin_unlock(&fs_info->qgroup_lock); - return -EBUSY; - } - } - spin_unlock(&fs_info->qgroup_lock); - ret = del_qgroup_item(trans, quota_root, qgroupid); spin_lock(&fs_info->qgroup_lock); del_qgroup_rb(quota_root->fs_info, qgroupid); + spin_unlock(&fs_info->qgroup_lock); return ret; diff --git a/trunk/fs/btrfs/send.c b/trunk/fs/btrfs/send.c index 321b7fb4e441..54454542ad40 100644 --- a/trunk/fs/btrfs/send.c +++ b/trunk/fs/btrfs/send.c @@ -1814,10 +1814,8 @@ static int name_cache_insert(struct send_ctx *sctx, (unsigned long)nce->ino); if (!nce_head) { nce_head = kmalloc(sizeof(*nce_head), GFP_NOFS); - if (!nce_head) { - kfree(nce); + if (!nce_head) return -ENOMEM; - } INIT_LIST_HEAD(nce_head); ret = radix_tree_insert(&sctx->name_cache, nce->ino, nce_head); diff --git a/trunk/fs/btrfs/super.c b/trunk/fs/btrfs/super.c index d8982e9601d3..99545df1b86c 100644 --- a/trunk/fs/btrfs/super.c +++ b/trunk/fs/btrfs/super.c @@ -267,7 +267,7 @@ void __btrfs_abort_transaction(struct btrfs_trans_handle *trans, function, line, errstr); return; } - ACCESS_ONCE(trans->transaction->aborted) = errno; + trans->transaction->aborted = errno; __btrfs_std_error(root->fs_info, function, line, errno, NULL); } /* diff --git a/trunk/fs/btrfs/transaction.c b/trunk/fs/btrfs/transaction.c index f15494699f3b..87fac9a21ea5 100644 --- a/trunk/fs/btrfs/transaction.c +++ b/trunk/fs/btrfs/transaction.c @@ -1468,8 +1468,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, goto cleanup_transaction; } - /* Stop the commit early if ->aborted is set */ - if (unlikely(ACCESS_ONCE(cur_trans->aborted))) { + if (cur_trans->aborted) { ret = cur_trans->aborted; goto cleanup_transaction; } @@ -1575,11 +1574,6 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, wait_event(cur_trans->writer_wait, atomic_read(&cur_trans->num_writers) == 1); - /* ->aborted might be set after the previous check, so check it */ - if (unlikely(ACCESS_ONCE(cur_trans->aborted))) { - ret = cur_trans->aborted; - goto cleanup_transaction; - } /* * the reloc mutex makes sure that we stop * the balancing code from coming in and moving @@ -1663,17 +1657,6 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, goto cleanup_transaction; } - /* - * The tasks which save the space cache and inode cache may also - * update ->aborted, check it. - */ - if (unlikely(ACCESS_ONCE(cur_trans->aborted))) { - ret = cur_trans->aborted; - mutex_unlock(&root->fs_info->tree_log_mutex); - mutex_unlock(&root->fs_info->reloc_mutex); - goto cleanup_transaction; - } - btrfs_prepare_extent_commit(trans, root); cur_trans = root->fs_info->running_transaction; diff --git a/trunk/fs/btrfs/tree-log.c b/trunk/fs/btrfs/tree-log.c index 9027bb1e7466..83186c7e45d4 100644 --- a/trunk/fs/btrfs/tree-log.c +++ b/trunk/fs/btrfs/tree-log.c @@ -3357,11 +3357,6 @@ static int log_one_extent(struct btrfs_trans_handle *trans, if (skip_csum) return 0; - if (em->compress_type) { - csum_offset = 0; - csum_len = block_len; - } - /* block start is already adjusted for the file extent offset. */ ret = btrfs_lookup_csums_range(log->fs_info->csum_root, em->block_start + csum_offset, @@ -3415,13 +3410,13 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans, em = list_entry(extents.next, struct extent_map, list); list_del_init(&em->list); + clear_bit(EXTENT_FLAG_LOGGING, &em->flags); /* * If we had an error we just need to delete everybody from our * private list. */ if (ret) { - clear_em_logging(tree, em); free_extent_map(em); continue; } @@ -3429,9 +3424,8 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans, write_unlock(&tree->lock); ret = log_one_extent(trans, inode, root, em, path); - write_lock(&tree->lock); - clear_em_logging(tree, em); free_extent_map(em); + write_lock(&tree->lock); } WARN_ON(!list_empty(&extents)); write_unlock(&tree->lock); diff --git a/trunk/fs/btrfs/volumes.c b/trunk/fs/btrfs/volumes.c index 15f6efdf6463..5cce6aa74012 100644 --- a/trunk/fs/btrfs/volumes.c +++ b/trunk/fs/btrfs/volumes.c @@ -1431,7 +1431,7 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) } } else { ret = btrfs_get_bdev_and_sb(device_path, - FMODE_WRITE | FMODE_EXCL, + FMODE_READ | FMODE_EXCL, root->fs_info->bdev_holder, 0, &bdev, &bh); if (ret) @@ -2614,14 +2614,7 @@ static int chunk_usage_filter(struct btrfs_fs_info *fs_info, u64 chunk_offset, cache = btrfs_lookup_block_group(fs_info, chunk_offset); chunk_used = btrfs_block_group_used(&cache->item); - if (bargs->usage == 0) - user_thresh = 0; - else if (bargs->usage > 100) - user_thresh = cache->key.offset; - else - user_thresh = div_factor_fine(cache->key.offset, - bargs->usage); - + user_thresh = div_factor_fine(cache->key.offset, bargs->usage); if (chunk_used < user_thresh) ret = 0; @@ -2966,8 +2959,6 @@ static void __cancel_balance(struct btrfs_fs_info *fs_info) unset_balance_control(fs_info); ret = del_balance_item(fs_info->tree_root); BUG_ON(ret); - - atomic_set(&fs_info->mutually_exclusive_operation_running, 0); } void update_ioctl_balance_args(struct btrfs_fs_info *fs_info, int lock, @@ -3147,10 +3138,8 @@ int btrfs_balance(struct btrfs_balance_control *bctl, out: if (bctl->flags & BTRFS_BALANCE_RESUME) __cancel_balance(fs_info); - else { + else kfree(bctl); - atomic_set(&fs_info->mutually_exclusive_operation_running, 0); - } return ret; } @@ -3167,6 +3156,7 @@ static int balance_kthread(void *data) ret = btrfs_balance(fs_info->balance_ctl, NULL); } + atomic_set(&fs_info->mutually_exclusive_operation_running, 0); mutex_unlock(&fs_info->balance_mutex); mutex_unlock(&fs_info->volume_mutex); @@ -3189,6 +3179,7 @@ int btrfs_resume_balance_async(struct btrfs_fs_info *fs_info) return 0; } + WARN_ON(atomic_xchg(&fs_info->mutually_exclusive_operation_running, 1)); tsk = kthread_run(balance_kthread, fs_info, "btrfs-balance"); if (IS_ERR(tsk)) return PTR_ERR(tsk); @@ -3242,8 +3233,6 @@ int btrfs_recover_balance(struct btrfs_fs_info *fs_info) btrfs_balance_sys(leaf, item, &disk_bargs); btrfs_disk_balance_args_to_cpu(&bctl->sys, &disk_bargs); - WARN_ON(atomic_xchg(&fs_info->mutually_exclusive_operation_running, 1)); - mutex_lock(&fs_info->volume_mutex); mutex_lock(&fs_info->balance_mutex); @@ -3507,7 +3496,7 @@ struct btrfs_raid_attr btrfs_raid_array[BTRFS_NR_RAID_TYPES] = { { 1, 1, 2, 2, 2, 2 /* raid1 */ }, { 1, 2, 1, 1, 1, 2 /* dup */ }, { 1, 1, 0, 2, 1, 1 /* raid0 */ }, - { 1, 1, 1, 1, 1, 1 /* single */ }, + { 1, 1, 0, 1, 1, 1 /* single */ }, }; static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans, diff --git a/trunk/fs/buffer.c b/trunk/fs/buffer.c index 7a75c3e0fd58..c017a2dfb909 100644 --- a/trunk/fs/buffer.c +++ b/trunk/fs/buffer.c @@ -2935,7 +2935,6 @@ static void guard_bh_eod(int rw, struct bio *bio, struct buffer_head *bh) void *kaddr = kmap_atomic(bh->b_page); memset(kaddr + bh_offset(bh) + bytes, 0, bh->b_size - bytes); kunmap_atomic(kaddr); - flush_dcache_page(bh->b_page); } } diff --git a/trunk/fs/cifs/cifs_dfs_ref.c b/trunk/fs/cifs/cifs_dfs_ref.c index 210fce2df308..ce5cbd717bfc 100644 --- a/trunk/fs/cifs/cifs_dfs_ref.c +++ b/trunk/fs/cifs/cifs_dfs_ref.c @@ -226,8 +226,6 @@ char *cifs_compose_mount_options(const char *sb_mountdata, compose_mount_options_err: kfree(mountdata); mountdata = ERR_PTR(rc); - kfree(*devname); - *devname = NULL; goto compose_mount_options_out; } diff --git a/trunk/fs/cifs/cifsfs.c b/trunk/fs/cifs/cifsfs.c index de7f9168a118..f653835d067b 100644 --- a/trunk/fs/cifs/cifsfs.c +++ b/trunk/fs/cifs/cifsfs.c @@ -228,6 +228,7 @@ cifs_alloc_inode(struct super_block *sb) cifs_set_oplock_level(cifs_inode, 0); cifs_inode->delete_pending = false; cifs_inode->invalid_mapping = false; + cifs_inode->leave_pages_clean = false; cifs_inode->vfs_inode.i_blkbits = 14; /* 2**14 = CIFS_MAX_MSGSIZE */ cifs_inode->server_eof = 0; cifs_inode->uniqueid = 0; diff --git a/trunk/fs/cifs/cifsglob.h b/trunk/fs/cifs/cifsglob.h index e6899cea1c35..aea1eec64911 100644 --- a/trunk/fs/cifs/cifsglob.h +++ b/trunk/fs/cifs/cifsglob.h @@ -386,7 +386,6 @@ struct smb_version_values { unsigned int cap_unix; unsigned int cap_nt_find; unsigned int cap_large_files; - unsigned int oplock_read; }; #define HEADER_SIZE(server) (server->vals->header_size) @@ -1031,6 +1030,7 @@ struct cifsInodeInfo { bool clientCanCacheAll; /* read and writebehind oplock */ bool delete_pending; /* DELETE_ON_CLOSE is set */ bool invalid_mapping; /* pagecache is invalid */ + bool leave_pages_clean; /* protected by i_mutex, not set pages dirty */ unsigned long time; /* jiffies of last update of inode */ u64 server_eof; /* current file size on server -- protected by i_lock */ u64 uniqueid; /* server inode number */ diff --git a/trunk/fs/cifs/connect.c b/trunk/fs/cifs/connect.c index 12b3da39733b..17c3643e5950 100644 --- a/trunk/fs/cifs/connect.c +++ b/trunk/fs/cifs/connect.c @@ -1917,7 +1917,7 @@ srcip_matches(struct sockaddr *srcaddr, struct sockaddr *rhs) } case AF_INET6: { struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *)srcaddr; - struct sockaddr_in6 *vaddr6 = (struct sockaddr_in6 *)rhs; + struct sockaddr_in6 *vaddr6 = (struct sockaddr_in6 *)&rhs; return ipv6_addr_equal(&saddr6->sin6_addr, &vaddr6->sin6_addr); } default: diff --git a/trunk/fs/cifs/file.c b/trunk/fs/cifs/file.c index 8ea6ca50a665..0a6677ba212b 100644 --- a/trunk/fs/cifs/file.c +++ b/trunk/fs/cifs/file.c @@ -238,23 +238,6 @@ cifs_nt_open(char *full_path, struct inode *inode, struct cifs_sb_info *cifs_sb, return rc; } -static bool -cifs_has_mand_locks(struct cifsInodeInfo *cinode) -{ - struct cifs_fid_locks *cur; - bool has_locks = false; - - down_read(&cinode->lock_sem); - list_for_each_entry(cur, &cinode->llist, llist) { - if (!list_empty(&cur->locks)) { - has_locks = true; - break; - } - } - up_read(&cinode->lock_sem); - return has_locks; -} - struct cifsFileInfo * cifs_new_fileinfo(struct cifs_fid *fid, struct file *file, struct tcon_link *tlink, __u32 oplock) @@ -265,7 +248,6 @@ cifs_new_fileinfo(struct cifs_fid *fid, struct file *file, struct cifsFileInfo *cfile; struct cifs_fid_locks *fdlocks; struct cifs_tcon *tcon = tlink_tcon(tlink); - struct TCP_Server_Info *server = tcon->ses->server; cfile = kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); if (cfile == NULL) @@ -294,22 +276,12 @@ cifs_new_fileinfo(struct cifs_fid *fid, struct file *file, INIT_WORK(&cfile->oplock_break, cifs_oplock_break); mutex_init(&cfile->fh_mutex); - /* - * If the server returned a read oplock and we have mandatory brlocks, - * set oplock level to None. - */ - if (oplock == server->vals->oplock_read && - cifs_has_mand_locks(cinode)) { - cFYI(1, "Reset oplock val from read to None due to mand locks"); - oplock = 0; - } - spin_lock(&cifs_file_list_lock); - if (fid->pending_open->oplock != CIFS_OPLOCK_NO_CHANGE && oplock) + if (fid->pending_open->oplock != CIFS_OPLOCK_NO_CHANGE) oplock = fid->pending_open->oplock; list_del(&fid->pending_open->olist); - server->ops->set_fid(cfile, fid, oplock); + tlink_tcon(tlink)->ses->server->ops->set_fid(cfile, fid, oplock); list_add(&cfile->tlist, &tcon->openFileList); /* if readable file instance put first in list*/ @@ -1450,7 +1422,6 @@ cifs_setlk(struct file *file, struct file_lock *flock, __u32 type, struct cifsFileInfo *cfile = (struct cifsFileInfo *)file->private_data; struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); struct TCP_Server_Info *server = tcon->ses->server; - struct inode *inode = cfile->dentry->d_inode; if (posix_lck) { int posix_lock_type; @@ -1488,21 +1459,6 @@ cifs_setlk(struct file *file, struct file_lock *flock, __u32 type, if (!rc) goto out; - /* - * Windows 7 server can delay breaking lease from read to None - * if we set a byte-range lock on a file - break it explicitly - * before sending the lock to the server to be sure the next - * read won't conflict with non-overlapted locks due to - * pagereading. - */ - if (!CIFS_I(inode)->clientCanCacheAll && - CIFS_I(inode)->clientCanCacheRead) { - cifs_invalidate_mapping(inode); - cFYI(1, "Set no oplock for inode=%p due to mand locks", - inode); - CIFS_I(inode)->clientCanCacheRead = false; - } - rc = server->ops->mand_lock(xid, cfile, flock->fl_start, length, type, 1, 0, wait_flag); if (rc) { @@ -2147,7 +2103,15 @@ static int cifs_write_end(struct file *file, struct address_space *mapping, } else { rc = copied; pos += copied; - set_page_dirty(page); + /* + * When we use strict cache mode and cifs_strict_writev was run + * with level II oplock (indicated by leave_pages_clean field of + * CIFS_I(inode)), we can leave pages clean - cifs_strict_writev + * sent the data to the server itself. + */ + if (!CIFS_I(inode)->leave_pages_clean || + !(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_STRICT_IO)) + set_page_dirty(page); } if (rc > 0) { @@ -2498,8 +2462,8 @@ ssize_t cifs_user_writev(struct kiocb *iocb, const struct iovec *iov, } static ssize_t -cifs_writev(struct kiocb *iocb, const struct iovec *iov, - unsigned long nr_segs, loff_t pos) +cifs_pagecache_writev(struct kiocb *iocb, const struct iovec *iov, + unsigned long nr_segs, loff_t pos, bool cache_ex) { struct file *file = iocb->ki_filp; struct cifsFileInfo *cfile = (struct cifsFileInfo *)file->private_data; @@ -2521,8 +2485,12 @@ cifs_writev(struct kiocb *iocb, const struct iovec *iov, server->vals->exclusive_lock_type, NULL, CIFS_WRITE_OP)) { mutex_lock(&inode->i_mutex); + if (!cache_ex) + cinode->leave_pages_clean = true; rc = __generic_file_aio_write(iocb, iov, nr_segs, - &iocb->ki_pos); + &iocb->ki_pos); + if (!cache_ex) + cinode->leave_pages_clean = false; mutex_unlock(&inode->i_mutex); } @@ -2549,32 +2517,60 @@ cifs_strict_writev(struct kiocb *iocb, const struct iovec *iov, struct cifsFileInfo *cfile = (struct cifsFileInfo *) iocb->ki_filp->private_data; struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); - ssize_t written; + ssize_t written, written2; + /* + * We need to store clientCanCacheAll here to prevent race + * conditions - this value can be changed during an execution + * of generic_file_aio_write. For CIFS it can be changed from + * true to false only, but for SMB2 it can be changed both from + * true to false and vice versa. So, we can end up with a data + * stored in the cache, not marked dirty and not sent to the + * server if this value changes its state from false to true + * after cifs_write_end. + */ + bool cache_ex = cinode->clientCanCacheAll; + bool cache_read = cinode->clientCanCacheRead; + int rc; + loff_t saved_pos; - if (cinode->clientCanCacheAll) { + if (cache_ex) { if (cap_unix(tcon->ses) && - (CIFS_UNIX_FCNTL_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability)) - && ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL) == 0)) + ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL) == 0) && + (CIFS_UNIX_FCNTL_CAP & le64_to_cpu( + tcon->fsUnixInfo.Capability))) return generic_file_aio_write(iocb, iov, nr_segs, pos); - return cifs_writev(iocb, iov, nr_segs, pos); + return cifs_pagecache_writev(iocb, iov, nr_segs, pos, cache_ex); } + /* - * For non-oplocked files in strict cache mode we need to write the data - * to the server exactly from the pos to pos+len-1 rather than flush all - * affected pages because it may cause a error with mandatory locks on - * these pages but not on the region from pos to ppos+len-1. + * For files without exclusive oplock in strict cache mode we need to + * write the data to the server exactly from the pos to pos+len-1 rather + * than flush all affected pages because it may cause a error with + * mandatory locks on these pages but not on the region from pos to + * ppos+len-1. */ written = cifs_user_writev(iocb, iov, nr_segs, pos); - if (written > 0 && cinode->clientCanCacheRead) { - /* - * Windows 7 server can delay breaking level2 oplock if a write - * request comes - break it on the client to prevent reading - * an old data. - */ - cifs_invalidate_mapping(inode); - cFYI(1, "Set no oplock for inode=%p after a write operation", - inode); - cinode->clientCanCacheRead = false; + if (!cache_read || written <= 0) + return written; + + saved_pos = iocb->ki_pos; + iocb->ki_pos = pos; + /* we have a read oplock - need to store a data in the page cache */ + if (cap_unix(tcon->ses) && + ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL) == 0) && + (CIFS_UNIX_FCNTL_CAP & le64_to_cpu( + tcon->fsUnixInfo.Capability))) + written2 = generic_file_aio_write(iocb, iov, nr_segs, pos); + else + written2 = cifs_pagecache_writev(iocb, iov, nr_segs, pos, + cache_ex); + /* errors occured during writing - invalidate the page cache */ + if (written2 < 0) { + rc = cifs_invalidate_mapping(inode); + if (rc) + written = (ssize_t)rc; + else + iocb->ki_pos = saved_pos; } return written; } @@ -3581,13 +3577,6 @@ void cifs_oplock_break(struct work_struct *work) struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); int rc = 0; - if (!cinode->clientCanCacheAll && cinode->clientCanCacheRead && - cifs_has_mand_locks(cinode)) { - cFYI(1, "Reset oplock to None for inode=%p due to mand locks", - inode); - cinode->clientCanCacheRead = false; - } - if (inode && S_ISREG(inode->i_mode)) { if (cinode->clientCanCacheRead) break_lease(inode, O_RDONLY); diff --git a/trunk/fs/cifs/smb1ops.c b/trunk/fs/cifs/smb1ops.c index 47bc5a87f94e..a5d234c8d5d9 100644 --- a/trunk/fs/cifs/smb1ops.c +++ b/trunk/fs/cifs/smb1ops.c @@ -53,13 +53,6 @@ send_nt_cancel(struct TCP_Server_Info *server, void *buf, mutex_unlock(&server->srv_mutex); return rc; } - - /* - * The response to this call was already factored into the sequence - * number when the call went out, so we must adjust it back downward - * after signing here. - */ - --server->sequence_number; rc = smb_send(server, in_buf, be32_to_cpu(in_buf->smb_buf_length)); mutex_unlock(&server->srv_mutex); @@ -959,5 +952,4 @@ struct smb_version_values smb1_values = { .cap_unix = CAP_UNIX, .cap_nt_find = CAP_NT_SMBS | CAP_NT_FIND, .cap_large_files = CAP_LARGE_FILES, - .oplock_read = OPLOCK_READ, }; diff --git a/trunk/fs/cifs/smb2ops.c b/trunk/fs/cifs/smb2ops.c index c9c7aa7ed966..d79de7bc4435 100644 --- a/trunk/fs/cifs/smb2ops.c +++ b/trunk/fs/cifs/smb2ops.c @@ -708,7 +708,6 @@ struct smb_version_values smb20_values = { .cap_unix = 0, .cap_nt_find = SMB2_NT_FIND, .cap_large_files = SMB2_LARGE_FILES, - .oplock_read = SMB2_OPLOCK_LEVEL_II, }; struct smb_version_values smb21_values = { @@ -726,7 +725,6 @@ struct smb_version_values smb21_values = { .cap_unix = 0, .cap_nt_find = SMB2_NT_FIND, .cap_large_files = SMB2_LARGE_FILES, - .oplock_read = SMB2_OPLOCK_LEVEL_II, }; struct smb_version_values smb30_values = { diff --git a/trunk/fs/cifs/transport.c b/trunk/fs/cifs/transport.c index 1a528680ec5a..76d974c952fe 100644 --- a/trunk/fs/cifs/transport.c +++ b/trunk/fs/cifs/transport.c @@ -144,6 +144,9 @@ smb_send_kvec(struct TCP_Server_Info *server, struct kvec *iov, size_t n_vec, *sent = 0; + if (ssocket == NULL) + return -ENOTSOCK; /* BB eventually add reconnect code here */ + smb_msg.msg_name = (struct sockaddr *) &server->dstaddr; smb_msg.msg_namelen = sizeof(struct sockaddr); smb_msg.msg_control = NULL; @@ -288,9 +291,6 @@ smb_send_rqst(struct TCP_Server_Info *server, struct smb_rqst *rqst) struct socket *ssocket = server->ssocket; int val = 1; - if (ssocket == NULL) - return -ENOTSOCK; - cFYI(1, "Sending smb: smb_len=%u", smb_buf_length); dump_smb(iov[0].iov_base, iov[0].iov_len); diff --git a/trunk/fs/debugfs/inode.c b/trunk/fs/debugfs/inode.c index a5f12b7e228d..153bb1e42e63 100644 --- a/trunk/fs/debugfs/inode.c +++ b/trunk/fs/debugfs/inode.c @@ -176,7 +176,7 @@ static int debugfs_parse_options(char *data, struct debugfs_mount_opts *opts) opts->uid = uid; break; case Opt_gid: - if (match_int(&args[0], &option)) + if (match_octal(&args[0], &option)) return -EINVAL; gid = make_kgid(current_user_ns(), option); if (!gid_valid(gid)) diff --git a/trunk/fs/exec.c b/trunk/fs/exec.c index 20df02c1cc70..18c45cac368f 100644 --- a/trunk/fs/exec.c +++ b/trunk/fs/exec.c @@ -434,9 +434,8 @@ static int count(struct user_arg_ptr argv, int max) if (IS_ERR(p)) return -EFAULT; - if (i >= max) + if (i++ >= max) return -E2BIG; - ++i; if (fatal_signal_pending(current)) return -ERESTARTNOHAND; diff --git a/trunk/fs/ext4/Kconfig b/trunk/fs/ext4/Kconfig index 987358740cb9..0a475c881852 100644 --- a/trunk/fs/ext4/Kconfig +++ b/trunk/fs/ext4/Kconfig @@ -41,7 +41,6 @@ config EXT4_USE_FOR_EXT23 config EXT4_FS_POSIX_ACL bool "Ext4 POSIX Access Control Lists" - depends on EXT4_FS select FS_POSIX_ACL help POSIX Access Control Lists (ACLs) support permissions for users and @@ -54,7 +53,6 @@ config EXT4_FS_POSIX_ACL config EXT4_FS_SECURITY bool "Ext4 Security Labels" - depends on EXT4_FS help Security labels support alternative access control models implemented by security modules like SELinux. This option diff --git a/trunk/fs/ext4/namei.c b/trunk/fs/ext4/namei.c index f9ed946a448e..8990165346ee 100644 --- a/trunk/fs/ext4/namei.c +++ b/trunk/fs/ext4/namei.c @@ -722,7 +722,7 @@ dx_probe(const struct qstr *d_name, struct inode *dir, ext4_warning(dir->i_sb, "Node failed checksum"); brelse(bh); *err = ERR_BAD_DX_DIR; - goto fail2; + goto fail; } set_buffer_verified(bh); @@ -2368,6 +2368,7 @@ static int ext4_init_new_dir(handle_t *handle, struct inode *dir, } inode->i_size = EXT4_I(inode)->i_disksize = blocksize; + dir_block = ext4_bread(handle, inode, 0, 1, &err); if (!(dir_block = ext4_bread(handle, inode, 0, 1, &err))) { if (!err) { err = -EIO; diff --git a/trunk/fs/f2fs/acl.c b/trunk/fs/f2fs/acl.c index 137af4255da6..e95b94945d5f 100644 --- a/trunk/fs/f2fs/acl.c +++ b/trunk/fs/f2fs/acl.c @@ -191,14 +191,15 @@ struct posix_acl *f2fs_get_acl(struct inode *inode, int type) retval = f2fs_getxattr(inode, name_index, "", value, retval); } - if (retval > 0) + if (retval < 0) { + if (retval == -ENODATA) + acl = NULL; + else + acl = ERR_PTR(retval); + } else { acl = f2fs_acl_from_disk(value, retval); - else if (retval == -ENODATA) - acl = NULL; - else - acl = ERR_PTR(retval); + } kfree(value); - if (!IS_ERR(acl)) set_cached_acl(inode, type, acl); diff --git a/trunk/fs/f2fs/checkpoint.c b/trunk/fs/f2fs/checkpoint.c index ff3c8439af87..6ef36c37e2be 100644 --- a/trunk/fs/f2fs/checkpoint.c +++ b/trunk/fs/f2fs/checkpoint.c @@ -214,6 +214,7 @@ void add_orphan_inode(struct f2fs_sb_info *sbi, nid_t ino) goto retry; } new->ino = ino; + INIT_LIST_HEAD(&new->list); /* add new_oentry into list which is sorted by inode number */ if (orphan) { @@ -771,7 +772,7 @@ void init_orphan_info(struct f2fs_sb_info *sbi) sbi->n_orphans = 0; } -int __init create_checkpoint_caches(void) +int create_checkpoint_caches(void) { orphan_entry_slab = f2fs_kmem_cache_create("f2fs_orphan_entry", sizeof(struct orphan_inode_entry), NULL); diff --git a/trunk/fs/f2fs/data.c b/trunk/fs/f2fs/data.c index 7bd22a201125..3aa5ce7cab83 100644 --- a/trunk/fs/f2fs/data.c +++ b/trunk/fs/f2fs/data.c @@ -547,15 +547,6 @@ static int f2fs_write_data_page(struct page *page, #define MAX_DESIRED_PAGES_WP 4096 -static int __f2fs_writepage(struct page *page, struct writeback_control *wbc, - void *data) -{ - struct address_space *mapping = data; - int ret = mapping->a_ops->writepage(page, wbc); - mapping_set_error(mapping, ret); - return ret; -} - static int f2fs_write_data_pages(struct address_space *mapping, struct writeback_control *wbc) { @@ -572,7 +563,7 @@ static int f2fs_write_data_pages(struct address_space *mapping, if (!S_ISDIR(inode->i_mode)) mutex_lock(&sbi->writepages); - ret = write_cache_pages(mapping, wbc, __f2fs_writepage, mapping); + ret = generic_writepages(mapping, wbc); if (!S_ISDIR(inode->i_mode)) mutex_unlock(&sbi->writepages); f2fs_submit_bio(sbi, DATA, (wbc->sync_mode == WB_SYNC_ALL)); @@ -698,11 +689,6 @@ static int f2fs_set_data_page_dirty(struct page *page) return 0; } -static sector_t f2fs_bmap(struct address_space *mapping, sector_t block) -{ - return generic_block_bmap(mapping, block, get_data_block_ro); -} - const struct address_space_operations f2fs_dblock_aops = { .readpage = f2fs_read_data_page, .readpages = f2fs_read_data_pages, @@ -714,5 +700,4 @@ const struct address_space_operations f2fs_dblock_aops = { .invalidatepage = f2fs_invalidate_data_page, .releasepage = f2fs_release_data_page, .direct_IO = f2fs_direct_IO, - .bmap = f2fs_bmap, }; diff --git a/trunk/fs/f2fs/debug.c b/trunk/fs/f2fs/debug.c index c8c37307b326..0e0380a588ad 100644 --- a/trunk/fs/f2fs/debug.c +++ b/trunk/fs/f2fs/debug.c @@ -26,7 +26,6 @@ static LIST_HEAD(f2fs_stat_list); static struct dentry *debugfs_root; -static DEFINE_MUTEX(f2fs_stat_mutex); static void update_general_status(struct f2fs_sb_info *sbi) { @@ -181,14 +180,18 @@ static int stat_show(struct seq_file *s, void *v) int i = 0; int j; - mutex_lock(&f2fs_stat_mutex); list_for_each_entry_safe(si, next, &f2fs_stat_list, stat_list) { + mutex_lock(&si->stat_lock); + if (!si->sbi) { + mutex_unlock(&si->stat_lock); + continue; + } update_general_status(si->sbi); seq_printf(s, "\n=====[ partition info. #%d ]=====\n", i++); - seq_printf(s, "[SB: 1] [CP: 2] [SIT: %d] [NAT: %d] ", - si->sit_area_segs, si->nat_area_segs); + seq_printf(s, "[SB: 1] [CP: 2] [NAT: %d] [SIT: %d] ", + si->nat_area_segs, si->sit_area_segs); seq_printf(s, "[SSA: %d] [MAIN: %d", si->ssa_area_segs, si->main_area_segs); seq_printf(s, "(OverProv:%d Resv:%d)]\n\n", @@ -283,8 +286,8 @@ static int stat_show(struct seq_file *s, void *v) seq_printf(s, "\nMemory: %u KB = static: %u + cached: %u\n", (si->base_mem + si->cache_mem) >> 10, si->base_mem >> 10, si->cache_mem >> 10); + mutex_unlock(&si->stat_lock); } - mutex_unlock(&f2fs_stat_mutex); return 0; } @@ -300,7 +303,7 @@ static const struct file_operations stat_fops = { .release = single_release, }; -int f2fs_build_stats(struct f2fs_sb_info *sbi) +static int init_stats(struct f2fs_sb_info *sbi) { struct f2fs_super_block *raw_super = F2FS_RAW_SUPER(sbi); struct f2fs_stat_info *si; @@ -310,6 +313,9 @@ int f2fs_build_stats(struct f2fs_sb_info *sbi) return -ENOMEM; si = sbi->stat_info; + mutex_init(&si->stat_lock); + list_add_tail(&si->stat_list, &f2fs_stat_list); + si->all_area_segs = le32_to_cpu(raw_super->segment_count); si->sit_area_segs = le32_to_cpu(raw_super->segment_count_sit); si->nat_area_segs = le32_to_cpu(raw_super->segment_count_nat); @@ -319,11 +325,21 @@ int f2fs_build_stats(struct f2fs_sb_info *sbi) si->main_area_zones = si->main_area_sections / le32_to_cpu(raw_super->secs_per_zone); si->sbi = sbi; + return 0; +} - mutex_lock(&f2fs_stat_mutex); - list_add_tail(&si->stat_list, &f2fs_stat_list); - mutex_unlock(&f2fs_stat_mutex); +int f2fs_build_stats(struct f2fs_sb_info *sbi) +{ + int retval; + + retval = init_stats(sbi); + if (retval) + return retval; + if (!debugfs_root) + debugfs_root = debugfs_create_dir("f2fs", NULL); + + debugfs_create_file("status", S_IRUGO, debugfs_root, NULL, &stat_fops); return 0; } @@ -331,22 +347,14 @@ void f2fs_destroy_stats(struct f2fs_sb_info *sbi) { struct f2fs_stat_info *si = sbi->stat_info; - mutex_lock(&f2fs_stat_mutex); list_del(&si->stat_list); - mutex_unlock(&f2fs_stat_mutex); - + mutex_lock(&si->stat_lock); + si->sbi = NULL; + mutex_unlock(&si->stat_lock); kfree(sbi->stat_info); } -void __init f2fs_create_root_stats(void) -{ - debugfs_root = debugfs_create_dir("f2fs", NULL); - if (debugfs_root) - debugfs_create_file("status", S_IRUGO, debugfs_root, - NULL, &stat_fops); -} - -void f2fs_destroy_root_stats(void) +void destroy_root_stats(void) { debugfs_remove_recursive(debugfs_root); debugfs_root = NULL; diff --git a/trunk/fs/f2fs/dir.c b/trunk/fs/f2fs/dir.c index 989980e16d0b..951ed52748f6 100644 --- a/trunk/fs/f2fs/dir.c +++ b/trunk/fs/f2fs/dir.c @@ -503,7 +503,7 @@ void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page, } if (inode) { - inode->i_ctime = CURRENT_TIME; + inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; drop_nlink(inode); if (S_ISDIR(inode->i_mode)) { drop_nlink(inode); diff --git a/trunk/fs/f2fs/f2fs.h b/trunk/fs/f2fs/f2fs.h index c8e2d751ef9c..13c6dfbb7183 100644 --- a/trunk/fs/f2fs/f2fs.h +++ b/trunk/fs/f2fs/f2fs.h @@ -211,11 +211,11 @@ struct dnode_of_data { static inline void set_new_dnode(struct dnode_of_data *dn, struct inode *inode, struct page *ipage, struct page *npage, nid_t nid) { - memset(dn, 0, sizeof(*dn)); dn->inode = inode; dn->inode_page = ipage; dn->node_page = npage; dn->nid = nid; + dn->inode_page_locked = 0; } /* @@ -877,8 +877,6 @@ bool f2fs_empty_dir(struct inode *); * super.c */ int f2fs_sync_fs(struct super_block *, int); -extern __printf(3, 4) -void f2fs_msg(struct super_block *, const char *, const char *, ...); /* * hash.c @@ -914,7 +912,7 @@ int restore_node_summary(struct f2fs_sb_info *, unsigned int, void flush_nat_entries(struct f2fs_sb_info *); int build_node_manager(struct f2fs_sb_info *); void destroy_node_manager(struct f2fs_sb_info *); -int __init create_node_manager_caches(void); +int create_node_manager_caches(void); void destroy_node_manager_caches(void); /* @@ -966,7 +964,7 @@ void sync_dirty_dir_inodes(struct f2fs_sb_info *); void block_operations(struct f2fs_sb_info *); void write_checkpoint(struct f2fs_sb_info *, bool, bool); void init_orphan_info(struct f2fs_sb_info *); -int __init create_checkpoint_caches(void); +int create_checkpoint_caches(void); void destroy_checkpoint_caches(void); /* @@ -986,9 +984,9 @@ int do_write_data_page(struct page *); int start_gc_thread(struct f2fs_sb_info *); void stop_gc_thread(struct f2fs_sb_info *); block_t start_bidx_of_node(unsigned int); -int f2fs_gc(struct f2fs_sb_info *); +int f2fs_gc(struct f2fs_sb_info *, int); void build_gc_manager(struct f2fs_sb_info *); -int __init create_gc_caches(void); +int create_gc_caches(void); void destroy_gc_caches(void); /* @@ -1060,8 +1058,7 @@ struct f2fs_stat_info { int f2fs_build_stats(struct f2fs_sb_info *); void f2fs_destroy_stats(struct f2fs_sb_info *); -void __init f2fs_create_root_stats(void); -void f2fs_destroy_root_stats(void); +void destroy_root_stats(void); #else #define stat_inc_call_count(si) #define stat_inc_seg_count(si, type) @@ -1071,8 +1068,7 @@ void f2fs_destroy_root_stats(void); static inline int f2fs_build_stats(struct f2fs_sb_info *sbi) { return 0; } static inline void f2fs_destroy_stats(struct f2fs_sb_info *sbi) { } -static inline void __init f2fs_create_root_stats(void) { } -static inline void f2fs_destroy_root_stats(void) { } +static inline void destroy_root_stats(void) { } #endif extern const struct file_operations f2fs_dir_operations; diff --git a/trunk/fs/f2fs/file.c b/trunk/fs/f2fs/file.c index 3191b52aafb0..7f9ea9271ebe 100644 --- a/trunk/fs/f2fs/file.c +++ b/trunk/fs/f2fs/file.c @@ -96,9 +96,8 @@ static int f2fs_vm_page_mkwrite(struct vm_area_struct *vma, } static const struct vm_operations_struct f2fs_file_vm_ops = { - .fault = filemap_fault, - .page_mkwrite = f2fs_vm_page_mkwrite, - .remap_pages = generic_file_remap_pages, + .fault = filemap_fault, + .page_mkwrite = f2fs_vm_page_mkwrite, }; static int need_to_sync_dir(struct f2fs_sb_info *sbi, struct inode *inode) @@ -138,9 +137,6 @@ int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) if (ret) return ret; - /* guarantee free sections for fsync */ - f2fs_balance_fs(sbi); - mutex_lock(&inode->i_mutex); if (datasync && !(inode->i_state & I_DIRTY_DATASYNC)) @@ -411,8 +407,6 @@ int truncate_hole(struct inode *inode, pgoff_t pg_start, pgoff_t pg_end) struct dnode_of_data dn; struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); - f2fs_balance_fs(sbi); - mutex_lock_op(sbi, DATA_TRUNC); set_new_dnode(&dn, inode, NULL, NULL, 0); err = get_dnode_of_data(&dn, index, RDONLY_NODE); @@ -540,6 +534,7 @@ static long f2fs_fallocate(struct file *file, int mode, loff_t offset, loff_t len) { struct inode *inode = file->f_path.dentry->d_inode; + struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); long ret; if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)) @@ -550,10 +545,7 @@ static long f2fs_fallocate(struct file *file, int mode, else ret = expand_inode_data(inode, offset, len, mode); - if (!ret) { - inode->i_mtime = inode->i_ctime = CURRENT_TIME; - mark_inode_dirty(inode); - } + f2fs_balance_fs(sbi); return ret; } diff --git a/trunk/fs/f2fs/gc.c b/trunk/fs/f2fs/gc.c index c386910dacc5..b0ec721e984a 100644 --- a/trunk/fs/f2fs/gc.c +++ b/trunk/fs/f2fs/gc.c @@ -78,7 +78,7 @@ static int gc_thread_func(void *data) sbi->bg_gc++; - if (f2fs_gc(sbi) == GC_NONE) + if (f2fs_gc(sbi, 1) == GC_NONE) wait_ms = GC_THREAD_NOGC_SLEEP_TIME; else if (wait_ms == GC_THREAD_NOGC_SLEEP_TIME) wait_ms = GC_THREAD_MAX_SLEEP_TIME; @@ -424,11 +424,7 @@ static int gc_node_segment(struct f2fs_sb_info *sbi, } /* - * Calculate start block index indicating the given node offset. - * Be careful, caller should give this node offset only indicating direct node - * blocks. If any node offsets, which point the other types of node blocks such - * as indirect or double indirect node blocks, are given, it must be a caller's - * bug. + * Calculate start block index that this node page contains */ block_t start_bidx_of_node(unsigned int node_ofs) { @@ -655,44 +651,62 @@ static int do_garbage_collect(struct f2fs_sb_info *sbi, unsigned int segno, return ret; } -int f2fs_gc(struct f2fs_sb_info *sbi) +int f2fs_gc(struct f2fs_sb_info *sbi, int nGC) { + unsigned int segno; + int old_free_secs, cur_free_secs; + int gc_status, nfree; struct list_head ilist; - unsigned int segno, i; int gc_type = BG_GC; - int gc_status = GC_NONE; INIT_LIST_HEAD(&ilist); gc_more: - if (!(sbi->sb->s_flags & MS_ACTIVE)) - goto stop; + nfree = 0; + gc_status = GC_NONE; if (has_not_enough_free_secs(sbi)) - gc_type = FG_GC; + old_free_secs = reserved_sections(sbi); + else + old_free_secs = free_sections(sbi); - if (!__get_victim(sbi, &segno, gc_type, NO_CHECK_TYPE)) - goto stop; + while (sbi->sb->s_flags & MS_ACTIVE) { + int i; + if (has_not_enough_free_secs(sbi)) + gc_type = FG_GC; - for (i = 0; i < sbi->segs_per_sec; i++) { - /* - * do_garbage_collect will give us three gc_status: - * GC_ERROR, GC_DONE, and GC_BLOCKED. - * If GC is finished uncleanly, we have to return - * the victim to dirty segment list. - */ - gc_status = do_garbage_collect(sbi, segno + i, &ilist, gc_type); - if (gc_status != GC_DONE) + cur_free_secs = free_sections(sbi) + nfree; + + /* We got free space successfully. */ + if (nGC < cur_free_secs - old_free_secs) break; + + if (!__get_victim(sbi, &segno, gc_type, NO_CHECK_TYPE)) + break; + + for (i = 0; i < sbi->segs_per_sec; i++) { + /* + * do_garbage_collect will give us three gc_status: + * GC_ERROR, GC_DONE, and GC_BLOCKED. + * If GC is finished uncleanly, we have to return + * the victim to dirty segment list. + */ + gc_status = do_garbage_collect(sbi, segno + i, + &ilist, gc_type); + if (gc_status != GC_DONE) + goto stop; + nfree++; + } } - if (has_not_enough_free_secs(sbi)) { +stop: + if (has_not_enough_free_secs(sbi) || gc_status == GC_BLOCKED) { write_checkpoint(sbi, (gc_status == GC_BLOCKED), false); - if (has_not_enough_free_secs(sbi)) + if (nfree) goto gc_more; } -stop: mutex_unlock(&sbi->gc_mutex); put_gc_inode(&ilist); + BUG_ON(!list_empty(&ilist)); return gc_status; } @@ -701,7 +715,7 @@ void build_gc_manager(struct f2fs_sb_info *sbi) DIRTY_I(sbi)->v_ops = &default_v_ops; } -int __init create_gc_caches(void) +int create_gc_caches(void) { winode_slab = f2fs_kmem_cache_create("f2fs_gc_inodes", sizeof(struct inode_entry), NULL); diff --git a/trunk/fs/f2fs/inode.c b/trunk/fs/f2fs/inode.c index 794241777322..bf20b4d03214 100644 --- a/trunk/fs/f2fs/inode.c +++ b/trunk/fs/f2fs/inode.c @@ -217,9 +217,6 @@ int f2fs_write_inode(struct inode *inode, struct writeback_control *wbc) inode->i_ino == F2FS_META_INO(sbi)) return 0; - if (wbc) - f2fs_balance_fs(sbi); - node_page = get_node_page(sbi, inode->i_ino); if (IS_ERR(node_page)) return PTR_ERR(node_page); diff --git a/trunk/fs/f2fs/node.c b/trunk/fs/f2fs/node.c index 9bda63c9c166..5066bfd256c9 100644 --- a/trunk/fs/f2fs/node.c +++ b/trunk/fs/f2fs/node.c @@ -1124,12 +1124,6 @@ static int f2fs_write_node_page(struct page *page, return 0; } -/* - * It is very important to gather dirty pages and write at once, so that we can - * submit a big bio without interfering other data writes. - * Be default, 512 pages (2MB), a segment size, is quite reasonable. - */ -#define COLLECT_DIRTY_NODES 512 static int f2fs_write_node_pages(struct address_space *mapping, struct writeback_control *wbc) { @@ -1137,16 +1131,17 @@ static int f2fs_write_node_pages(struct address_space *mapping, struct block_device *bdev = sbi->sb->s_bdev; long nr_to_write = wbc->nr_to_write; - /* First check balancing cached NAT entries */ + if (wbc->for_kupdate) + return 0; + + if (get_pages(sbi, F2FS_DIRTY_NODES) == 0) + return 0; + if (try_to_free_nats(sbi, NAT_ENTRY_PER_BLOCK)) { write_checkpoint(sbi, false, false); return 0; } - /* collect a number of dirty node pages and write together */ - if (get_pages(sbi, F2FS_DIRTY_NODES) < COLLECT_DIRTY_NODES) - return 0; - /* if mounting is failed, skip writing node pages */ wbc->nr_to_write = bio_get_nr_vecs(bdev); sync_node_pages(sbi, 0, wbc); @@ -1737,7 +1732,7 @@ void destroy_node_manager(struct f2fs_sb_info *sbi) kfree(nm_i); } -int __init create_node_manager_caches(void) +int create_node_manager_caches(void) { nat_entry_slab = f2fs_kmem_cache_create("nat_entry", sizeof(struct nat_entry), NULL); diff --git a/trunk/fs/f2fs/recovery.c b/trunk/fs/f2fs/recovery.c index f42e4060b399..b571fee677d5 100644 --- a/trunk/fs/f2fs/recovery.c +++ b/trunk/fs/f2fs/recovery.c @@ -67,7 +67,7 @@ static int recover_dentry(struct page *ipage, struct inode *inode) kunmap(page); f2fs_put_page(page, 0); } else { - err = f2fs_add_link(&dent, inode); + f2fs_add_link(&dent, inode); } iput(dir); out: @@ -151,6 +151,7 @@ static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head) goto out; } + INIT_LIST_HEAD(&entry->list); list_add_tail(&entry->list, head); entry->blkaddr = blkaddr; } @@ -173,9 +174,10 @@ static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head) static void destroy_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head) { - struct fsync_inode_entry *entry, *tmp; - - list_for_each_entry_safe(entry, tmp, head, list) { + struct list_head *this; + struct fsync_inode_entry *entry; + list_for_each(this, head) { + entry = list_entry(this, struct fsync_inode_entry, list); iput(entry->inode); list_del(&entry->list); kmem_cache_free(fsync_entry_slab, entry); diff --git a/trunk/fs/f2fs/segment.c b/trunk/fs/f2fs/segment.c index 4b0099066582..de6240922b0a 100644 --- a/trunk/fs/f2fs/segment.c +++ b/trunk/fs/f2fs/segment.c @@ -31,7 +31,7 @@ void f2fs_balance_fs(struct f2fs_sb_info *sbi) */ if (has_not_enough_free_secs(sbi)) { mutex_lock(&sbi->gc_mutex); - f2fs_gc(sbi); + f2fs_gc(sbi, 1); } } diff --git a/trunk/fs/f2fs/super.c b/trunk/fs/f2fs/super.c index 37fad04c8669..08a94c814bdc 100644 --- a/trunk/fs/f2fs/super.c +++ b/trunk/fs/f2fs/super.c @@ -53,18 +53,6 @@ static match_table_t f2fs_tokens = { {Opt_err, NULL}, }; -void f2fs_msg(struct super_block *sb, const char *level, const char *fmt, ...) -{ - struct va_format vaf; - va_list args; - - va_start(args, fmt); - vaf.fmt = fmt; - vaf.va = &args; - printk("%sF2FS-fs (%s): %pV\n", level, sb->s_id, &vaf); - va_end(args); -} - static void init_once(void *foo) { struct f2fs_inode_info *fi = (struct f2fs_inode_info *) foo; @@ -137,8 +125,6 @@ int f2fs_sync_fs(struct super_block *sb, int sync) if (sync) write_checkpoint(sbi, false, false); - else - f2fs_balance_fs(sbi); return 0; } @@ -261,8 +247,7 @@ static const struct export_operations f2fs_export_ops = { .get_parent = f2fs_get_parent, }; -static int parse_options(struct super_block *sb, struct f2fs_sb_info *sbi, - char *options) +static int parse_options(struct f2fs_sb_info *sbi, char *options) { substring_t args[MAX_OPT_ARGS]; char *p; @@ -301,8 +286,7 @@ static int parse_options(struct super_block *sb, struct f2fs_sb_info *sbi, break; #else case Opt_nouser_xattr: - f2fs_msg(sb, KERN_INFO, - "nouser_xattr options not supported"); + pr_info("nouser_xattr options not supported\n"); break; #endif #ifdef CONFIG_F2FS_FS_POSIX_ACL @@ -311,7 +295,7 @@ static int parse_options(struct super_block *sb, struct f2fs_sb_info *sbi, break; #else case Opt_noacl: - f2fs_msg(sb, KERN_INFO, "noacl options not supported"); + pr_info("noacl options not supported\n"); break; #endif case Opt_active_logs: @@ -325,9 +309,8 @@ static int parse_options(struct super_block *sb, struct f2fs_sb_info *sbi, set_opt(sbi, DISABLE_EXT_IDENTIFY); break; default: - f2fs_msg(sb, KERN_ERR, - "Unrecognized mount option \"%s\" or missing value", - p); + pr_err("Unrecognized mount option \"%s\" or missing value\n", + p); return -EINVAL; } } @@ -354,36 +337,23 @@ static loff_t max_file_size(unsigned bits) return result; } -static int sanity_check_raw_super(struct super_block *sb, - struct f2fs_super_block *raw_super) +static int sanity_check_raw_super(struct f2fs_super_block *raw_super) { unsigned int blocksize; - if (F2FS_SUPER_MAGIC != le32_to_cpu(raw_super->magic)) { - f2fs_msg(sb, KERN_INFO, - "Magic Mismatch, valid(0x%x) - read(0x%x)", - F2FS_SUPER_MAGIC, le32_to_cpu(raw_super->magic)); + if (F2FS_SUPER_MAGIC != le32_to_cpu(raw_super->magic)) return 1; - } /* Currently, support only 4KB block size */ blocksize = 1 << le32_to_cpu(raw_super->log_blocksize); - if (blocksize != PAGE_CACHE_SIZE) { - f2fs_msg(sb, KERN_INFO, - "Invalid blocksize (%u), supports only 4KB\n", - blocksize); + if (blocksize != PAGE_CACHE_SIZE) return 1; - } if (le32_to_cpu(raw_super->log_sectorsize) != - F2FS_LOG_SECTOR_SIZE) { - f2fs_msg(sb, KERN_INFO, "Invalid log sectorsize"); + F2FS_LOG_SECTOR_SIZE) return 1; - } if (le32_to_cpu(raw_super->log_sectors_per_block) != - F2FS_LOG_SECTORS_PER_BLOCK) { - f2fs_msg(sb, KERN_INFO, "Invalid log sectors per block"); + F2FS_LOG_SECTORS_PER_BLOCK) return 1; - } return 0; } @@ -443,17 +413,14 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) if (!sbi) return -ENOMEM; - /* set a block size */ - if (!sb_set_blocksize(sb, F2FS_BLKSIZE)) { - f2fs_msg(sb, KERN_ERR, "unable to set blocksize"); + /* set a temporary block size */ + if (!sb_set_blocksize(sb, F2FS_BLKSIZE)) goto free_sbi; - } /* read f2fs raw super block */ raw_super_buf = sb_bread(sb, 0); if (!raw_super_buf) { err = -EIO; - f2fs_msg(sb, KERN_ERR, "unable to read superblock"); goto free_sbi; } raw_super = (struct f2fs_super_block *) @@ -471,14 +438,12 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) set_opt(sbi, POSIX_ACL); #endif /* parse mount options */ - if (parse_options(sb, sbi, (char *)data)) + if (parse_options(sbi, (char *)data)) goto free_sb_buf; /* sanity checking of raw super */ - if (sanity_check_raw_super(sb, raw_super)) { - f2fs_msg(sb, KERN_ERR, "Can't find a valid F2FS filesystem"); + if (sanity_check_raw_super(raw_super)) goto free_sb_buf; - } sb->s_maxbytes = max_file_size(le32_to_cpu(raw_super->log_blocksize)); sb->s_max_links = F2FS_LINK_MAX; @@ -512,23 +477,18 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) /* get an inode for meta space */ sbi->meta_inode = f2fs_iget(sb, F2FS_META_INO(sbi)); if (IS_ERR(sbi->meta_inode)) { - f2fs_msg(sb, KERN_ERR, "Failed to read F2FS meta data inode"); err = PTR_ERR(sbi->meta_inode); goto free_sb_buf; } err = get_valid_checkpoint(sbi); - if (err) { - f2fs_msg(sb, KERN_ERR, "Failed to get valid F2FS checkpoint"); + if (err) goto free_meta_inode; - } /* sanity checking of checkpoint */ err = -EINVAL; - if (sanity_check_ckpt(raw_super, sbi->ckpt)) { - f2fs_msg(sb, KERN_ERR, "Invalid F2FS checkpoint"); + if (sanity_check_ckpt(raw_super, sbi->ckpt)) goto free_cp; - } sbi->total_valid_node_count = le32_to_cpu(sbi->ckpt->valid_node_count); @@ -542,28 +502,25 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) INIT_LIST_HEAD(&sbi->dir_inode_list); spin_lock_init(&sbi->dir_inode_lock); + /* init super block */ + if (!sb_set_blocksize(sb, sbi->blocksize)) + goto free_cp; + init_orphan_info(sbi); /* setup f2fs internal modules */ err = build_segment_manager(sbi); - if (err) { - f2fs_msg(sb, KERN_ERR, - "Failed to initialize F2FS segment manager"); + if (err) goto free_sm; - } err = build_node_manager(sbi); - if (err) { - f2fs_msg(sb, KERN_ERR, - "Failed to initialize F2FS node manager"); + if (err) goto free_nm; - } build_gc_manager(sbi); /* get an inode for node space */ sbi->node_inode = f2fs_iget(sb, F2FS_NODE_INO(sbi)); if (IS_ERR(sbi->node_inode)) { - f2fs_msg(sb, KERN_ERR, "Failed to read node inode"); err = PTR_ERR(sbi->node_inode); goto free_nm; } @@ -576,7 +533,6 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) /* read root inode and dentry */ root = f2fs_iget(sb, F2FS_ROOT_INO(sbi)); if (IS_ERR(root)) { - f2fs_msg(sb, KERN_ERR, "Failed to read root inode"); err = PTR_ERR(root); goto free_node_inode; } @@ -640,7 +596,7 @@ static struct file_system_type f2fs_fs_type = { .fs_flags = FS_REQUIRES_DEV, }; -static int __init init_inodecache(void) +static int init_inodecache(void) { f2fs_inode_cachep = f2fs_kmem_cache_create("f2fs_inode_cache", sizeof(struct f2fs_inode_info), NULL); @@ -675,17 +631,14 @@ static int __init init_f2fs_fs(void) err = create_checkpoint_caches(); if (err) goto fail; - err = register_filesystem(&f2fs_fs_type); - if (err) - goto fail; - f2fs_create_root_stats(); + return register_filesystem(&f2fs_fs_type); fail: return err; } static void __exit exit_f2fs_fs(void) { - f2fs_destroy_root_stats(); + destroy_root_stats(); unregister_filesystem(&f2fs_fs_type); destroy_checkpoint_caches(); destroy_gc_caches(); diff --git a/trunk/fs/f2fs/xattr.c b/trunk/fs/f2fs/xattr.c index 8038c0496504..940136a3d3a6 100644 --- a/trunk/fs/f2fs/xattr.c +++ b/trunk/fs/f2fs/xattr.c @@ -318,8 +318,6 @@ int f2fs_setxattr(struct inode *inode, int name_index, const char *name, if (name_len > 255 || value_len > MAX_VALUE_LEN) return -ERANGE; - f2fs_balance_fs(sbi); - mutex_lock_op(sbi, NODE_NEW); if (!fi->i_xattr_nid) { /* Allocate new attribute block */ diff --git a/trunk/fs/fuse/Kconfig b/trunk/fs/fuse/Kconfig index 1b2f6c2c3aaf..0cf160a94eda 100644 --- a/trunk/fs/fuse/Kconfig +++ b/trunk/fs/fuse/Kconfig @@ -4,24 +4,12 @@ config FUSE_FS With FUSE it is possible to implement a fully functional filesystem in a userspace program. - There's also a companion library: libfuse2. This library is available - from the FUSE homepage: + There's also companion library: libfuse. This library along with + utilities is available from the FUSE homepage: - although chances are your distribution already has that library - installed if you've installed the "fuse" package itself. See for more information. See for needed library/utility version. If you want to develop a userspace FS, or if you want to use a filesystem based on FUSE, answer Y or M. - -config CUSE - tristate "Character device in Userspace support" - depends on FUSE_FS - help - This FUSE extension allows character devices to be - implemented in userspace. - - If you want to develop or use a userspace character device - based on CUSE, answer Y or M. diff --git a/trunk/fs/fuse/cuse.c b/trunk/fs/fuse/cuse.c index e397b675b029..ee8d55042298 100644 --- a/trunk/fs/fuse/cuse.c +++ b/trunk/fs/fuse/cuse.c @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -62,7 +63,7 @@ struct cuse_conn { bool unrestricted_ioctl; }; -static DEFINE_MUTEX(cuse_lock); /* protects registration */ +static DEFINE_SPINLOCK(cuse_lock); /* protects cuse_conntbl */ static struct list_head cuse_conntbl[CUSE_CONNTBL_LEN]; static struct class *cuse_class; @@ -113,14 +114,14 @@ static int cuse_open(struct inode *inode, struct file *file) int rc; /* look up and get the connection */ - mutex_lock(&cuse_lock); + spin_lock(&cuse_lock); list_for_each_entry(pos, cuse_conntbl_head(devt), list) if (pos->dev->devt == devt) { fuse_conn_get(&pos->fc); cc = pos; break; } - mutex_unlock(&cuse_lock); + spin_unlock(&cuse_lock); /* dead? */ if (!cc) @@ -266,7 +267,7 @@ static int cuse_parse_one(char **pp, char *end, char **keyp, char **valp) static int cuse_parse_devinfo(char *p, size_t len, struct cuse_devinfo *devinfo) { char *end = p + len; - char *uninitialized_var(key), *uninitialized_var(val); + char *key, *val; int rc; while (true) { @@ -304,14 +305,14 @@ static void cuse_gendev_release(struct device *dev) */ static void cuse_process_init_reply(struct fuse_conn *fc, struct fuse_req *req) { - struct cuse_conn *cc = fc_to_cc(fc), *pos; + struct cuse_conn *cc = fc_to_cc(fc); struct cuse_init_out *arg = req->out.args[0].value; struct page *page = req->pages[0]; struct cuse_devinfo devinfo = { }; struct device *dev; struct cdev *cdev; dev_t devt; - int rc, i; + int rc; if (req->out.h.error || arg->major != FUSE_KERNEL_VERSION || arg->minor < 11) { @@ -355,24 +356,15 @@ static void cuse_process_init_reply(struct fuse_conn *fc, struct fuse_req *req) dev_set_drvdata(dev, cc); dev_set_name(dev, "%s", devinfo.name); - mutex_lock(&cuse_lock); - - /* make sure the device-name is unique */ - for (i = 0; i < CUSE_CONNTBL_LEN; ++i) { - list_for_each_entry(pos, &cuse_conntbl[i], list) - if (!strcmp(dev_name(pos->dev), dev_name(dev))) - goto err_unlock; - } - rc = device_add(dev); if (rc) - goto err_unlock; + goto err_device; /* register cdev */ rc = -ENOMEM; cdev = cdev_alloc(); if (!cdev) - goto err_unlock; + goto err_device; cdev->owner = THIS_MODULE; cdev->ops = &cuse_frontend_fops; @@ -385,8 +377,9 @@ static void cuse_process_init_reply(struct fuse_conn *fc, struct fuse_req *req) cc->cdev = cdev; /* make the device available */ + spin_lock(&cuse_lock); list_add(&cc->list, cuse_conntbl_head(devt)); - mutex_unlock(&cuse_lock); + spin_unlock(&cuse_lock); /* announce device availability */ dev_set_uevent_suppress(dev, 0); @@ -398,8 +391,7 @@ static void cuse_process_init_reply(struct fuse_conn *fc, struct fuse_req *req) err_cdev: cdev_del(cdev); -err_unlock: - mutex_unlock(&cuse_lock); +err_device: put_device(dev); err_region: unregister_chrdev_region(devt, 1); @@ -528,9 +520,9 @@ static int cuse_channel_release(struct inode *inode, struct file *file) int rc; /* remove from the conntbl, no more access from this point on */ - mutex_lock(&cuse_lock); + spin_lock(&cuse_lock); list_del_init(&cc->list); - mutex_unlock(&cuse_lock); + spin_unlock(&cuse_lock); /* remove device */ if (cc->dev) diff --git a/trunk/fs/fuse/dev.c b/trunk/fs/fuse/dev.c index e83351aa5bad..c16335315e5d 100644 --- a/trunk/fs/fuse/dev.c +++ b/trunk/fs/fuse/dev.c @@ -692,6 +692,8 @@ static int fuse_try_move_page(struct fuse_copy_state *cs, struct page **pagep) struct page *oldpage = *pagep; struct page *newpage; struct pipe_buffer *buf = cs->pipebufs; + struct address_space *mapping; + pgoff_t index; unlock_request(cs->fc, cs->req); fuse_copy_finish(cs); @@ -722,6 +724,9 @@ static int fuse_try_move_page(struct fuse_copy_state *cs, struct page **pagep) if (fuse_check_page(newpage) != 0) goto out_fallback_unlock; + mapping = oldpage->mapping; + index = oldpage->index; + /* * This is a new and locked page, it shouldn't be mapped or * have any special flags on it diff --git a/trunk/fs/fuse/file.c b/trunk/fs/fuse/file.c index f3ab824fa302..e21d4d8f87e3 100644 --- a/trunk/fs/fuse/file.c +++ b/trunk/fs/fuse/file.c @@ -2177,8 +2177,8 @@ fuse_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, return ret; } -static long fuse_file_fallocate(struct file *file, int mode, loff_t offset, - loff_t length) +long fuse_file_fallocate(struct file *file, int mode, loff_t offset, + loff_t length) { struct fuse_file *ff = file->private_data; struct fuse_conn *fc = ff->fc; @@ -2213,6 +2213,7 @@ static long fuse_file_fallocate(struct file *file, int mode, loff_t offset, return err; } +EXPORT_SYMBOL_GPL(fuse_file_fallocate); static const struct file_operations fuse_file_operations = { .llseek = fuse_file_llseek, diff --git a/trunk/fs/gfs2/lock_dlm.c b/trunk/fs/gfs2/lock_dlm.c index 9802de0f85e6..b906ed17a839 100644 --- a/trunk/fs/gfs2/lock_dlm.c +++ b/trunk/fs/gfs2/lock_dlm.c @@ -281,7 +281,6 @@ static void gdlm_put_lock(struct gfs2_glock *gl) { struct gfs2_sbd *sdp = gl->gl_sbd; struct lm_lockstruct *ls = &sdp->sd_lockstruct; - int lvb_needs_unlock = 0; int error; if (gl->gl_lksb.sb_lkid == 0) { @@ -295,12 +294,8 @@ static void gdlm_put_lock(struct gfs2_glock *gl) gfs2_update_request_times(gl); /* don't want to skip dlm_unlock writing the lvb when lock is ex */ - - if (gl->gl_lksb.sb_lvbptr && (gl->gl_state == LM_ST_EXCLUSIVE)) - lvb_needs_unlock = 1; - if (test_bit(SDF_SKIP_DLM_UNLOCK, &sdp->sd_flags) && - !lvb_needs_unlock) { + gl->gl_lksb.sb_lvbptr && (gl->gl_state != LM_ST_EXCLUSIVE)) { gfs2_glock_free(gl); return; } diff --git a/trunk/fs/jbd/journal.c b/trunk/fs/jbd/journal.c index 81cc7eaff863..a2862339323b 100644 --- a/trunk/fs/jbd/journal.c +++ b/trunk/fs/jbd/journal.c @@ -446,8 +446,7 @@ int __log_start_commit(journal_t *journal, tid_t target) * currently running transaction (if it exists). Otherwise, * the target tid must be an old one. */ - if (journal->j_commit_request != target && - journal->j_running_transaction && + if (journal->j_running_transaction && journal->j_running_transaction->t_tid == target) { /* * We want a new commit: OK, mark the request and wakeup the diff --git a/trunk/fs/nfs/callback_proc.c b/trunk/fs/nfs/callback_proc.c index 264d1aa935f2..c89b26bc9759 100644 --- a/trunk/fs/nfs/callback_proc.c +++ b/trunk/fs/nfs/callback_proc.c @@ -206,7 +206,7 @@ static u32 initiate_bulk_draining(struct nfs_client *clp, list_for_each_entry(lo, &server->layouts, plh_layouts) { ino = igrab(lo->plh_inode); - if (!ino) + if (ino) continue; spin_lock(&ino->i_lock); /* Is this layout in the process of being freed? */ diff --git a/trunk/fs/nfs/dir.c b/trunk/fs/nfs/dir.c index 1b2d7eb93796..32e6c53520e2 100644 --- a/trunk/fs/nfs/dir.c +++ b/trunk/fs/nfs/dir.c @@ -2153,16 +2153,12 @@ static int nfs_open_permission_mask(int openflags) { int mask = 0; - if (openflags & __FMODE_EXEC) { - /* ONLY check exec rights */ - mask = MAY_EXEC; - } else { - if ((openflags & O_ACCMODE) != O_WRONLY) - mask |= MAY_READ; - if ((openflags & O_ACCMODE) != O_RDONLY) - mask |= MAY_WRITE; - } - + if ((openflags & O_ACCMODE) != O_WRONLY) + mask |= MAY_READ; + if ((openflags & O_ACCMODE) != O_RDONLY) + mask |= MAY_WRITE; + if (openflags & __FMODE_EXEC) + mask |= MAY_EXEC; return mask; } diff --git a/trunk/fs/nfs/nfs4proc.c b/trunk/fs/nfs/nfs4proc.c index cf747ef86650..5d864fb36578 100644 --- a/trunk/fs/nfs/nfs4proc.c +++ b/trunk/fs/nfs/nfs4proc.c @@ -1626,8 +1626,7 @@ static int _nfs4_recover_proc_open(struct nfs4_opendata *data) static int nfs4_opendata_access(struct rpc_cred *cred, struct nfs4_opendata *opendata, - struct nfs4_state *state, fmode_t fmode, - int openflags) + struct nfs4_state *state, fmode_t fmode) { struct nfs_access_entry cache; u32 mask; @@ -1639,14 +1638,11 @@ static int nfs4_opendata_access(struct rpc_cred *cred, mask = 0; /* don't check MAY_WRITE - a newly created file may not have - * write mode bits, but POSIX allows the creating process to write. - * use openflags to check for exec, because fmode won't - * always have FMODE_EXEC set when file open for exec. */ - if (openflags & __FMODE_EXEC) { - /* ONLY check for exec rights */ - mask = MAY_EXEC; - } else if (fmode & FMODE_READ) - mask = MAY_READ; + * write mode bits, but POSIX allows the creating process to write */ + if (fmode & FMODE_READ) + mask |= MAY_READ; + if (fmode & FMODE_EXEC) + mask |= MAY_EXEC; cache.cred = cred; cache.jiffies = jiffies; @@ -1900,7 +1896,7 @@ static int _nfs4_do_open(struct inode *dir, if (server->caps & NFS_CAP_POSIX_LOCK) set_bit(NFS_STATE_POSIX_LOCKS, &state->flags); - status = nfs4_opendata_access(cred, opendata, state, fmode, flags); + status = nfs4_opendata_access(cred, opendata, state, fmode); if (status != 0) goto err_opendata_put; diff --git a/trunk/fs/nfs/pnfs.c b/trunk/fs/nfs/pnfs.c index d00260b08103..e7165d915362 100644 --- a/trunk/fs/nfs/pnfs.c +++ b/trunk/fs/nfs/pnfs.c @@ -254,7 +254,7 @@ static void pnfs_layout_set_fail_bit(struct pnfs_layout_hdr *lo, int fail_bit) { lo->plh_retry_timestamp = jiffies; - if (!test_and_set_bit(fail_bit, &lo->plh_flags)) + if (test_and_set_bit(fail_bit, &lo->plh_flags)) atomic_inc(&lo->plh_refcount); } diff --git a/trunk/fs/nfs/read.c b/trunk/fs/nfs/read.c index a5e5d9899d56..b6bdb18e892c 100644 --- a/trunk/fs/nfs/read.c +++ b/trunk/fs/nfs/read.c @@ -91,16 +91,12 @@ void nfs_readdata_release(struct nfs_read_data *rdata) put_nfs_open_context(rdata->args.context); if (rdata->pages.pagevec != rdata->pages.page_array) kfree(rdata->pages.pagevec); - if (rdata == &read_header->rpc_data) { + if (rdata != &read_header->rpc_data) + kfree(rdata); + else rdata->header = NULL; - rdata = NULL; - } if (atomic_dec_and_test(&hdr->refcnt)) hdr->completion_ops->completion(hdr); - /* Note: we only free the rpc_task after callbacks are done. - * See the comment in rpc_free_task() for why - */ - kfree(rdata); } EXPORT_SYMBOL_GPL(nfs_readdata_release); diff --git a/trunk/fs/nfs/super.c b/trunk/fs/nfs/super.c index 2e7e8c878e5d..c25cadf8f8c4 100644 --- a/trunk/fs/nfs/super.c +++ b/trunk/fs/nfs/super.c @@ -1152,7 +1152,7 @@ static int nfs_get_option_str(substring_t args[], char **option) { kfree(*option); *option = match_strdup(args); - return !*option; + return !option; } static int nfs_get_option_ul(substring_t args[], unsigned long *option) diff --git a/trunk/fs/nfs/write.c b/trunk/fs/nfs/write.c index c483cc50b82e..b673be31590e 100644 --- a/trunk/fs/nfs/write.c +++ b/trunk/fs/nfs/write.c @@ -126,16 +126,12 @@ void nfs_writedata_release(struct nfs_write_data *wdata) put_nfs_open_context(wdata->args.context); if (wdata->pages.pagevec != wdata->pages.page_array) kfree(wdata->pages.pagevec); - if (wdata == &write_header->rpc_data) { + if (wdata != &write_header->rpc_data) + kfree(wdata); + else wdata->header = NULL; - wdata = NULL; - } if (atomic_dec_and_test(&hdr->refcnt)) hdr->completion_ops->completion(hdr); - /* Note: we only free the rpc_task after callbacks are done. - * See the comment in rpc_free_task() for why - */ - kfree(wdata); } EXPORT_SYMBOL_GPL(nfs_writedata_release); diff --git a/trunk/fs/seq_file.c b/trunk/fs/seq_file.c index f2bc3dfd0b88..9d863fb501f9 100644 --- a/trunk/fs/seq_file.c +++ b/trunk/fs/seq_file.c @@ -296,7 +296,7 @@ EXPORT_SYMBOL(seq_read); * seq_lseek - ->llseek() method for sequential files. * @file: the file in question * @offset: new position - * @whence: 0 for absolute, 1 for relative position + * @origin: 0 for absolute, 1 for relative position * * Ready-made ->f_op->llseek() */ diff --git a/trunk/fs/splice.c b/trunk/fs/splice.c index 6909d89d0da5..8890604e3fcd 100644 --- a/trunk/fs/splice.c +++ b/trunk/fs/splice.c @@ -696,10 +696,8 @@ static int pipe_to_sendpage(struct pipe_inode_info *pipe, return -EINVAL; more = (sd->flags & SPLICE_F_MORE) ? MSG_MORE : 0; - - if (sd->len < sd->total_len && pipe->nrbufs > 1) + if (sd->len < sd->total_len) more |= MSG_SENDPAGE_NOTLAST; - return file->f_op->sendpage(file, buf->page, buf->offset, sd->len, &pos, more); } diff --git a/trunk/fs/udf/super.c b/trunk/fs/udf/super.c index e9be396a558d..d44fb568abe1 100644 --- a/trunk/fs/udf/super.c +++ b/trunk/fs/udf/super.c @@ -307,8 +307,7 @@ static void udf_sb_free_partitions(struct super_block *sb) { struct udf_sb_info *sbi = UDF_SB(sb); int i; - if (sbi->s_partmaps == NULL) - return; + for (i = 0; i < sbi->s_partitions; i++) udf_free_partition(&sbi->s_partmaps[i]); kfree(sbi->s_partmaps); diff --git a/trunk/fs/xfs/xfs_buf.c b/trunk/fs/xfs/xfs_buf.c index 56d1614760cf..26673a0b20e7 100644 --- a/trunk/fs/xfs/xfs_buf.c +++ b/trunk/fs/xfs/xfs_buf.c @@ -175,7 +175,7 @@ xfs_buf_get_maps( bp->b_map_count = map_count; if (map_count == 1) { - bp->b_maps = &bp->__b_map; + bp->b_maps = &bp->b_map; return 0; } @@ -193,7 +193,7 @@ static void xfs_buf_free_maps( struct xfs_buf *bp) { - if (bp->b_maps != &bp->__b_map) { + if (bp->b_maps != &bp->b_map) { kmem_free(bp->b_maps); bp->b_maps = NULL; } @@ -377,8 +377,8 @@ xfs_buf_allocate_memory( } use_alloc_page: - start = BBTOB(bp->b_maps[0].bm_bn) >> PAGE_SHIFT; - end = (BBTOB(bp->b_maps[0].bm_bn + bp->b_length) + PAGE_SIZE - 1) + start = BBTOB(bp->b_map.bm_bn) >> PAGE_SHIFT; + end = (BBTOB(bp->b_map.bm_bn + bp->b_length) + PAGE_SIZE - 1) >> PAGE_SHIFT; page_count = end - start; error = _xfs_buf_get_pages(bp, page_count, flags); @@ -640,7 +640,7 @@ _xfs_buf_read( xfs_buf_flags_t flags) { ASSERT(!(flags & XBF_WRITE)); - ASSERT(bp->b_maps[0].bm_bn != XFS_BUF_DADDR_NULL); + ASSERT(bp->b_map.bm_bn != XFS_BUF_DADDR_NULL); bp->b_flags &= ~(XBF_WRITE | XBF_ASYNC | XBF_READ_AHEAD); bp->b_flags |= flags & (XBF_READ | XBF_ASYNC | XBF_READ_AHEAD); @@ -1709,7 +1709,7 @@ xfs_buf_cmp( struct xfs_buf *bp = container_of(b, struct xfs_buf, b_list); xfs_daddr_t diff; - diff = ap->b_maps[0].bm_bn - bp->b_maps[0].bm_bn; + diff = ap->b_map.bm_bn - bp->b_map.bm_bn; if (diff < 0) return -1; if (diff > 0) diff --git a/trunk/fs/xfs/xfs_buf.h b/trunk/fs/xfs/xfs_buf.h index 433a12ed7b17..23f5642480bb 100644 --- a/trunk/fs/xfs/xfs_buf.h +++ b/trunk/fs/xfs/xfs_buf.h @@ -151,7 +151,7 @@ typedef struct xfs_buf { struct page **b_pages; /* array of page pointers */ struct page *b_page_array[XB_PAGES]; /* inline pages */ struct xfs_buf_map *b_maps; /* compound buffer map */ - struct xfs_buf_map __b_map; /* inline compound buffer map */ + struct xfs_buf_map b_map; /* inline compound buffer map */ int b_map_count; int b_io_length; /* IO size in BBs */ atomic_t b_pin_count; /* pin count */ @@ -330,8 +330,8 @@ void xfs_buf_stale(struct xfs_buf *bp); * In future, uncached buffers will pass the block number directly to the io * request function and hence these macros will go away at that point. */ -#define XFS_BUF_ADDR(bp) ((bp)->b_maps[0].bm_bn) -#define XFS_BUF_SET_ADDR(bp, bno) ((bp)->b_maps[0].bm_bn = (xfs_daddr_t)(bno)) +#define XFS_BUF_ADDR(bp) ((bp)->b_map.bm_bn) +#define XFS_BUF_SET_ADDR(bp, bno) ((bp)->b_map.bm_bn = (xfs_daddr_t)(bno)) static inline void xfs_buf_set_ref(struct xfs_buf *bp, int lru_ref) { diff --git a/trunk/fs/xfs/xfs_buf_item.c b/trunk/fs/xfs/xfs_buf_item.c index 77b09750e92c..becf4a97efc6 100644 --- a/trunk/fs/xfs/xfs_buf_item.c +++ b/trunk/fs/xfs/xfs_buf_item.c @@ -71,7 +71,7 @@ xfs_buf_item_log_debug( chunk_num = byte >> XFS_BLF_SHIFT; word_num = chunk_num >> BIT_TO_WORD_SHIFT; bit_num = chunk_num & (NBWORD - 1); - wordp = &(bip->__bli_format.blf_data_map[word_num]); + wordp = &(bip->bli_format.blf_data_map[word_num]); bit_set = *wordp & (1 << bit_num); ASSERT(bit_set); byte++; @@ -237,7 +237,7 @@ xfs_buf_item_size( * cancel flag in it. */ trace_xfs_buf_item_size_stale(bip); - ASSERT(bip->__bli_format.blf_flags & XFS_BLF_CANCEL); + ASSERT(bip->bli_format.blf_flags & XFS_BLF_CANCEL); return bip->bli_format_count; } @@ -278,7 +278,7 @@ xfs_buf_item_format_segment( uint buffer_offset; /* copy the flags across from the base format item */ - blfp->blf_flags = bip->__bli_format.blf_flags; + blfp->blf_flags = bip->bli_format.blf_flags; /* * Base size is the actual size of the ondisk structure - it reflects @@ -287,17 +287,6 @@ xfs_buf_item_format_segment( */ base_size = offsetof(struct xfs_buf_log_format, blf_data_map) + (blfp->blf_map_size * sizeof(blfp->blf_data_map[0])); - - nvecs = 0; - first_bit = xfs_next_bit(blfp->blf_data_map, blfp->blf_map_size, 0); - if (!(bip->bli_flags & XFS_BLI_STALE) && first_bit == -1) { - /* - * If the map is not be dirty in the transaction, mark - * the size as zero and do not advance the vector pointer. - */ - goto out; - } - vecp->i_addr = blfp; vecp->i_len = base_size; vecp->i_type = XLOG_REG_TYPE_BFORMAT; @@ -312,13 +301,15 @@ xfs_buf_item_format_segment( */ trace_xfs_buf_item_format_stale(bip); ASSERT(blfp->blf_flags & XFS_BLF_CANCEL); - goto out; + blfp->blf_size = nvecs; + return vecp; } /* * Fill in an iovec for each set of contiguous chunks. */ - + first_bit = xfs_next_bit(blfp->blf_data_map, blfp->blf_map_size, 0); + ASSERT(first_bit != -1); last_bit = first_bit; nbits = 1; for (;;) { @@ -380,8 +371,7 @@ xfs_buf_item_format_segment( nbits++; } } -out: - blfp->blf_size = nvecs; + bip->bli_format.blf_size = nvecs; return vecp; } @@ -415,7 +405,7 @@ xfs_buf_item_format( if (bip->bli_flags & XFS_BLI_INODE_BUF) { if (!((bip->bli_flags & XFS_BLI_INODE_ALLOC_BUF) && xfs_log_item_in_current_chkpt(lip))) - bip->__bli_format.blf_flags |= XFS_BLF_INODE_BUF; + bip->bli_format.blf_flags |= XFS_BLF_INODE_BUF; bip->bli_flags &= ~XFS_BLI_INODE_BUF; } @@ -495,7 +485,7 @@ xfs_buf_item_unpin( ASSERT(bip->bli_flags & XFS_BLI_STALE); ASSERT(xfs_buf_islocked(bp)); ASSERT(XFS_BUF_ISSTALE(bp)); - ASSERT(bip->__bli_format.blf_flags & XFS_BLF_CANCEL); + ASSERT(bip->bli_format.blf_flags & XFS_BLF_CANCEL); trace_xfs_buf_item_unpin_stale(bip); @@ -611,7 +601,7 @@ xfs_buf_item_unlock( { struct xfs_buf_log_item *bip = BUF_ITEM(lip); struct xfs_buf *bp = bip->bli_buf; - int aborted, clean, i; + int aborted; uint hold; /* Clear the buffer's association with this transaction. */ @@ -641,7 +631,7 @@ xfs_buf_item_unlock( */ if (bip->bli_flags & XFS_BLI_STALE) { trace_xfs_buf_item_unlock_stale(bip); - ASSERT(bip->__bli_format.blf_flags & XFS_BLF_CANCEL); + ASSERT(bip->bli_format.blf_flags & XFS_BLF_CANCEL); if (!aborted) { atomic_dec(&bip->bli_refcount); return; @@ -654,15 +644,8 @@ xfs_buf_item_unlock( * If the buf item isn't tracking any data, free it, otherwise drop the * reference we hold to it. */ - clean = 1; - for (i = 0; i < bip->bli_format_count; i++) { - if (!xfs_bitmap_empty(bip->bli_formats[i].blf_data_map, - bip->bli_formats[i].blf_map_size)) { - clean = 0; - break; - } - } - if (clean) + if (xfs_bitmap_empty(bip->bli_format.blf_data_map, + bip->bli_format.blf_map_size)) xfs_buf_item_relse(bp); else atomic_dec(&bip->bli_refcount); @@ -733,7 +716,7 @@ xfs_buf_item_get_format( bip->bli_format_count = count; if (count == 1) { - bip->bli_formats = &bip->__bli_format; + bip->bli_formats = &bip->bli_format; return 0; } @@ -748,7 +731,7 @@ STATIC void xfs_buf_item_free_format( struct xfs_buf_log_item *bip) { - if (bip->bli_formats != &bip->__bli_format) { + if (bip->bli_formats != &bip->bli_format) { kmem_free(bip->bli_formats); bip->bli_formats = NULL; } diff --git a/trunk/fs/xfs/xfs_buf_item.h b/trunk/fs/xfs/xfs_buf_item.h index 16def435944a..6850f49f4af3 100644 --- a/trunk/fs/xfs/xfs_buf_item.h +++ b/trunk/fs/xfs/xfs_buf_item.h @@ -104,7 +104,7 @@ typedef struct xfs_buf_log_item { #endif int bli_format_count; /* count of headers */ struct xfs_buf_log_format *bli_formats; /* array of in-log header ptrs */ - struct xfs_buf_log_format __bli_format; /* embedded in-log header */ + struct xfs_buf_log_format bli_format; /* embedded in-log header */ } xfs_buf_log_item_t; void xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *); diff --git a/trunk/fs/xfs/xfs_dir2_block.c b/trunk/fs/xfs/xfs_dir2_block.c index 12afe07a91d7..7536faaa61e7 100644 --- a/trunk/fs/xfs/xfs_dir2_block.c +++ b/trunk/fs/xfs/xfs_dir2_block.c @@ -355,12 +355,10 @@ xfs_dir2_block_addname( /* * If need to compact the leaf entries, do it now. */ - if (compact) { + if (compact) xfs_dir2_block_compact(tp, bp, hdr, btp, blp, &needlog, &lfloghigh, &lfloglow); - /* recalculate blp post-compaction */ - blp = xfs_dir2_block_leaf_p(btp); - } else if (btp->stale) { + else if (btp->stale) { /* * Set leaf logging boundaries to impossible state. * For the no-stale case they're set explicitly. diff --git a/trunk/fs/xfs/xfs_qm_syscalls.c b/trunk/fs/xfs/xfs_qm_syscalls.c index 8a59f8546552..5f53e75409b8 100644 --- a/trunk/fs/xfs/xfs_qm_syscalls.c +++ b/trunk/fs/xfs/xfs_qm_syscalls.c @@ -784,11 +784,11 @@ xfs_qm_scall_getquota( (XFS_IS_OQUOTA_ENFORCED(mp) && (dst->d_flags & (FS_PROJ_QUOTA | FS_GROUP_QUOTA)))) && dst->d_id != 0) { - if ((dst->d_bcount > dst->d_blk_softlimit) && + if (((int) dst->d_bcount > (int) dst->d_blk_softlimit) && (dst->d_blk_softlimit > 0)) { ASSERT(dst->d_btimer != 0); } - if ((dst->d_icount > dst->d_ino_softlimit) && + if (((int) dst->d_icount > (int) dst->d_ino_softlimit) && (dst->d_ino_softlimit > 0)) { ASSERT(dst->d_itimer != 0); } diff --git a/trunk/fs/xfs/xfs_trans_buf.c b/trunk/fs/xfs/xfs_trans_buf.c index 3edf5dbee001..4fc17d479d42 100644 --- a/trunk/fs/xfs/xfs_trans_buf.c +++ b/trunk/fs/xfs/xfs_trans_buf.c @@ -93,7 +93,7 @@ _xfs_trans_bjoin( xfs_buf_item_init(bp, tp->t_mountp); bip = bp->b_fspriv; ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); - ASSERT(!(bip->__bli_format.blf_flags & XFS_BLF_CANCEL)); + ASSERT(!(bip->bli_format.blf_flags & XFS_BLF_CANCEL)); ASSERT(!(bip->bli_flags & XFS_BLI_LOGGED)); if (reset_recur) bip->bli_recur = 0; @@ -432,7 +432,7 @@ xfs_trans_brelse(xfs_trans_t *tp, bip = bp->b_fspriv; ASSERT(bip->bli_item.li_type == XFS_LI_BUF); ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); - ASSERT(!(bip->__bli_format.blf_flags & XFS_BLF_CANCEL)); + ASSERT(!(bip->bli_format.blf_flags & XFS_BLF_CANCEL)); ASSERT(atomic_read(&bip->bli_refcount) > 0); trace_xfs_trans_brelse(bip); @@ -519,7 +519,7 @@ xfs_trans_bhold(xfs_trans_t *tp, ASSERT(bp->b_transp == tp); ASSERT(bip != NULL); ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); - ASSERT(!(bip->__bli_format.blf_flags & XFS_BLF_CANCEL)); + ASSERT(!(bip->bli_format.blf_flags & XFS_BLF_CANCEL)); ASSERT(atomic_read(&bip->bli_refcount) > 0); bip->bli_flags |= XFS_BLI_HOLD; @@ -539,7 +539,7 @@ xfs_trans_bhold_release(xfs_trans_t *tp, ASSERT(bp->b_transp == tp); ASSERT(bip != NULL); ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); - ASSERT(!(bip->__bli_format.blf_flags & XFS_BLF_CANCEL)); + ASSERT(!(bip->bli_format.blf_flags & XFS_BLF_CANCEL)); ASSERT(atomic_read(&bip->bli_refcount) > 0); ASSERT(bip->bli_flags & XFS_BLI_HOLD); @@ -598,7 +598,7 @@ xfs_trans_log_buf(xfs_trans_t *tp, bip->bli_flags &= ~XFS_BLI_STALE; ASSERT(XFS_BUF_ISSTALE(bp)); XFS_BUF_UNSTALE(bp); - bip->__bli_format.blf_flags &= ~XFS_BLF_CANCEL; + bip->bli_format.blf_flags &= ~XFS_BLF_CANCEL; } tp->t_flags |= XFS_TRANS_DIRTY; @@ -643,7 +643,6 @@ xfs_trans_binval( xfs_buf_t *bp) { xfs_buf_log_item_t *bip = bp->b_fspriv; - int i; ASSERT(bp->b_transp == tp); ASSERT(bip != NULL); @@ -658,8 +657,8 @@ xfs_trans_binval( */ ASSERT(XFS_BUF_ISSTALE(bp)); ASSERT(!(bip->bli_flags & (XFS_BLI_LOGGED | XFS_BLI_DIRTY))); - ASSERT(!(bip->__bli_format.blf_flags & XFS_BLF_INODE_BUF)); - ASSERT(bip->__bli_format.blf_flags & XFS_BLF_CANCEL); + ASSERT(!(bip->bli_format.blf_flags & XFS_BLF_INODE_BUF)); + ASSERT(bip->bli_format.blf_flags & XFS_BLF_CANCEL); ASSERT(bip->bli_item.li_desc->lid_flags & XFS_LID_DIRTY); ASSERT(tp->t_flags & XFS_TRANS_DIRTY); return; @@ -669,12 +668,10 @@ xfs_trans_binval( bip->bli_flags |= XFS_BLI_STALE; bip->bli_flags &= ~(XFS_BLI_INODE_BUF | XFS_BLI_LOGGED | XFS_BLI_DIRTY); - bip->__bli_format.blf_flags &= ~XFS_BLF_INODE_BUF; - bip->__bli_format.blf_flags |= XFS_BLF_CANCEL; - for (i = 0; i < bip->bli_format_count; i++) { - memset(bip->bli_formats[i].blf_data_map, 0, - (bip->bli_formats[i].blf_map_size * sizeof(uint))); - } + bip->bli_format.blf_flags &= ~XFS_BLF_INODE_BUF; + bip->bli_format.blf_flags |= XFS_BLF_CANCEL; + memset((char *)(bip->bli_format.blf_data_map), 0, + (bip->bli_format.blf_map_size * sizeof(uint))); bip->bli_item.li_desc->lid_flags |= XFS_LID_DIRTY; tp->t_flags |= XFS_TRANS_DIRTY; } @@ -778,5 +775,5 @@ xfs_trans_dquot_buf( type == XFS_BLF_GDQUOT_BUF); ASSERT(atomic_read(&bip->bli_refcount) > 0); - bip->__bli_format.blf_flags |= type; + bip->bli_format.blf_flags |= type; } diff --git a/trunk/include/asm-generic/dma-mapping-broken.h b/trunk/include/asm-generic/dma-mapping-broken.h index 6c32af918c2f..ccf7b4f34a3c 100644 --- a/trunk/include/asm-generic/dma-mapping-broken.h +++ b/trunk/include/asm-generic/dma-mapping-broken.h @@ -16,22 +16,6 @@ extern void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, dma_addr_t dma_handle); -static inline void *dma_alloc_attrs(struct device *dev, size_t size, - dma_addr_t *dma_handle, gfp_t flag, - struct dma_attrs *attrs) -{ - /* attrs is not supported and ignored */ - return dma_alloc_coherent(dev, size, dma_handle, flag); -} - -static inline void dma_free_attrs(struct device *dev, size_t size, - void *cpu_addr, dma_addr_t dma_handle, - struct dma_attrs *attrs) -{ - /* attrs is not supported and ignored */ - dma_free_coherent(dev, size, cpu_addr, dma_handle); -} - #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) diff --git a/trunk/include/asm-generic/pgtable.h b/trunk/include/asm-generic/pgtable.h index 5cf680a98f9b..701beab27aab 100644 --- a/trunk/include/asm-generic/pgtable.h +++ b/trunk/include/asm-generic/pgtable.h @@ -461,8 +461,10 @@ static inline int is_zero_pfn(unsigned long pfn) return offset_from_zero_pfn <= (zero_page_mask >> PAGE_SHIFT); } -#define my_zero_pfn(addr) page_to_pfn(ZERO_PAGE(addr)) - +static inline unsigned long my_zero_pfn(unsigned long addr) +{ + return page_to_pfn(ZERO_PAGE(addr)); +} #else static inline int is_zero_pfn(unsigned long pfn) { diff --git a/trunk/include/asm-generic/syscalls.h b/trunk/include/asm-generic/syscalls.h index 1db51b8524e9..58f466ff00d3 100644 --- a/trunk/include/asm-generic/syscalls.h +++ b/trunk/include/asm-generic/syscalls.h @@ -21,12 +21,10 @@ asmlinkage long sys_mmap(unsigned long addr, unsigned long len, unsigned long fd, off_t pgoff); #endif -#ifndef CONFIG_GENERIC_SIGALTSTACK #ifndef sys_sigaltstack asmlinkage long sys_sigaltstack(const stack_t __user *, stack_t __user *, struct pt_regs *); #endif -#endif #ifndef sys_rt_sigreturn asmlinkage long sys_rt_sigreturn(struct pt_regs *regs); diff --git a/trunk/include/asm-generic/tlb.h b/trunk/include/asm-generic/tlb.h index 25f01d0bc149..ed6642ad03e0 100644 --- a/trunk/include/asm-generic/tlb.h +++ b/trunk/include/asm-generic/tlb.h @@ -78,14 +78,6 @@ struct mmu_gather_batch { #define MAX_GATHER_BATCH \ ((PAGE_SIZE - sizeof(struct mmu_gather_batch)) / sizeof(void *)) -/* - * Limit the maximum number of mmu_gather batches to reduce a risk of soft - * lockups for non-preemptible kernels on huge machines when a lot of memory - * is zapped during unmapping. - * 10K pages freed at once should be safe even without a preemption point. - */ -#define MAX_GATHER_BATCH_COUNT (10000UL/MAX_GATHER_BATCH) - /* struct mmu_gather is an opaque type used by the mm code for passing around * any data needed by arch specific code for tlb_remove_page. */ @@ -104,7 +96,6 @@ struct mmu_gather { struct mmu_gather_batch *active; struct mmu_gather_batch local; struct page *__pages[MMU_GATHER_BUNDLE]; - unsigned int batch_count; }; #define HAVE_GENERIC_MMU_GATHER diff --git a/trunk/include/drm/drm_mm.h b/trunk/include/drm/drm_mm.h index 3527fb3f75bb..0f4a366f6fa6 100644 --- a/trunk/include/drm/drm_mm.h +++ b/trunk/include/drm/drm_mm.h @@ -70,7 +70,7 @@ struct drm_mm { unsigned long scan_color; unsigned long scan_size; unsigned long scan_hit_start; - unsigned long scan_hit_end; + unsigned scan_hit_size; unsigned scanned_blocks; unsigned long scan_start; unsigned long scan_end; diff --git a/trunk/include/drm/exynos_drm.h b/trunk/include/drm/exynos_drm.h index d6aeaf3c6d6c..808dad29607a 100644 --- a/trunk/include/drm/exynos_drm.h +++ b/trunk/include/drm/exynos_drm.h @@ -6,10 +6,24 @@ * Joonyoung Shim * Seung-Woo Kim * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _EXYNOS_DRM_H_ #define _EXYNOS_DRM_H_ diff --git a/trunk/include/linux/ata.h b/trunk/include/linux/ata.h index 8f7a3d68371a..408da9502177 100644 --- a/trunk/include/linux/ata.h +++ b/trunk/include/linux/ata.h @@ -297,12 +297,10 @@ enum { ATA_LOG_SATA_NCQ = 0x10, ATA_LOG_SATA_ID_DEV_DATA = 0x30, ATA_LOG_SATA_SETTINGS = 0x08, - ATA_LOG_DEVSLP_OFFSET = 0x30, - ATA_LOG_DEVSLP_SIZE = 0x08, - ATA_LOG_DEVSLP_MDAT = 0x00, + ATA_LOG_DEVSLP_MDAT = 0x30, ATA_LOG_DEVSLP_MDAT_MASK = 0x1F, - ATA_LOG_DEVSLP_DETO = 0x01, - ATA_LOG_DEVSLP_VALID = 0x07, + ATA_LOG_DEVSLP_DETO = 0x31, + ATA_LOG_DEVSLP_VALID = 0x37, ATA_LOG_DEVSLP_VALID_MASK = 0x80, /* READ/WRITE LONG (obsolete) */ diff --git a/trunk/include/linux/audit.h b/trunk/include/linux/audit.h index 5a6d718adf34..bce729afbcf9 100644 --- a/trunk/include/linux/audit.h +++ b/trunk/include/linux/audit.h @@ -24,7 +24,6 @@ #define _LINUX_AUDIT_H_ #include -#include #include struct audit_sig_info { @@ -158,8 +157,7 @@ void audit_core_dumps(long signr); static inline void audit_seccomp(unsigned long syscall, long signr, int code) { - /* Force a record to be reported if a signal was delivered. */ - if (signr || unlikely(!audit_dummy_context())) + if (unlikely(!audit_dummy_context())) __audit_seccomp(syscall, signr, code); } diff --git a/trunk/include/linux/compaction.h b/trunk/include/linux/compaction.h index cc7bddeaf553..6ecb6dc2f303 100644 --- a/trunk/include/linux/compaction.h +++ b/trunk/include/linux/compaction.h @@ -22,7 +22,7 @@ extern int sysctl_extfrag_handler(struct ctl_table *table, int write, extern int fragmentation_index(struct zone *zone, unsigned int order); extern unsigned long try_to_compact_pages(struct zonelist *zonelist, int order, gfp_t gfp_mask, nodemask_t *mask, - bool sync, bool *contended); + bool sync, bool *contended, struct page **page); extern int compact_pgdat(pg_data_t *pgdat, int order); extern void reset_isolation_suitable(pg_data_t *pgdat); extern unsigned long compaction_suitable(struct zone *zone, int order); @@ -75,7 +75,7 @@ static inline bool compaction_restarting(struct zone *zone, int order) #else static inline unsigned long try_to_compact_pages(struct zonelist *zonelist, int order, gfp_t gfp_mask, nodemask_t *nodemask, - bool sync, bool *contended) + bool sync, bool *contended, struct page **page) { return COMPACT_CONTINUE; } diff --git a/trunk/include/linux/cpu_rmap.h b/trunk/include/linux/cpu_rmap.h index 1739510d8994..ac3bbb5b9502 100644 --- a/trunk/include/linux/cpu_rmap.h +++ b/trunk/include/linux/cpu_rmap.h @@ -13,11 +13,9 @@ #include #include #include -#include /** * struct cpu_rmap - CPU affinity reverse-map - * @refcount: kref for object * @size: Number of objects to be reverse-mapped * @used: Number of objects added * @obj: Pointer to array of object pointers @@ -25,7 +23,6 @@ * based on affinity masks */ struct cpu_rmap { - struct kref refcount; u16 size, used; void **obj; struct { @@ -36,7 +33,15 @@ struct cpu_rmap { #define CPU_RMAP_DIST_INF 0xffff extern struct cpu_rmap *alloc_cpu_rmap(unsigned int size, gfp_t flags); -extern int cpu_rmap_put(struct cpu_rmap *rmap); + +/** + * free_cpu_rmap - free CPU affinity reverse-map + * @rmap: Reverse-map allocated with alloc_cpu_rmap(), or %NULL + */ +static inline void free_cpu_rmap(struct cpu_rmap *rmap) +{ + kfree(rmap); +} extern int cpu_rmap_add(struct cpu_rmap *rmap, void *obj); extern int cpu_rmap_update(struct cpu_rmap *rmap, u16 index, diff --git a/trunk/include/linux/cpuidle.h b/trunk/include/linux/cpuidle.h index 24cd1037b6d6..3711b34dc4f9 100644 --- a/trunk/include/linux/cpuidle.h +++ b/trunk/include/linux/cpuidle.h @@ -126,9 +126,9 @@ struct cpuidle_driver { struct module *owner; int refcnt; + unsigned int power_specified:1; /* set to 1 to use the core cpuidle time keeping (for all states). */ unsigned int en_core_tk_irqen:1; - /* states array must be ordered in decreasing power consumption */ struct cpuidle_state states[CPUIDLE_STATE_MAX]; int state_count; int safe_state_index; diff --git a/trunk/include/linux/cred.h b/trunk/include/linux/cred.h index 04421e825365..abb2cd50f6b2 100644 --- a/trunk/include/linux/cred.h +++ b/trunk/include/linux/cred.h @@ -128,6 +128,7 @@ struct cred { struct key *process_keyring; /* keyring private to this process */ struct key *thread_keyring; /* keyring private to this thread */ struct key *request_key_auth; /* assumed request_key authority */ + struct thread_group_cred *tgcred; /* thread-group shared credentials */ #endif #ifdef CONFIG_SECURITY void *security; /* subjective LSM security */ diff --git a/trunk/include/linux/init.h b/trunk/include/linux/init.h index 10ed4f436458..a799273714ac 100644 --- a/trunk/include/linux/init.h +++ b/trunk/include/linux/init.h @@ -93,6 +93,14 @@ #define __exit __section(.exit.text) __exitused __cold notrace +/* Used for HOTPLUG, but that is always enabled now, so just make them noops */ +#define __devinit +#define __devinitdata +#define __devinitconst +#define __devexit +#define __devexitdata +#define __devexitconst + /* Used for HOTPLUG_CPU */ #define __cpuinit __section(.cpuinit.text) __cold notrace #define __cpuinitdata __section(.cpuinit.data) @@ -329,6 +337,18 @@ void __init parse_early_options(char *cmdline); #define __INITRODATA_OR_MODULE __INITRODATA #endif /*CONFIG_MODULES*/ +/* Functions marked as __devexit may be discarded at kernel link time, depending + on config options. Newer versions of binutils detect references from + retained sections to discarded sections and flag an error. Pointers to + __devexit functions must use __devexit_p(function_name), the wrapper will + insert either the function_name or NULL, depending on the config options. + */ +#if defined(MODULE) || defined(CONFIG_HOTPLUG) +#define __devexit_p(x) x +#else +#define __devexit_p(x) NULL +#endif + #ifdef MODULE #define __exit_p(x) x #else diff --git a/trunk/include/linux/interrupt.h b/trunk/include/linux/interrupt.h index 5fa5afeeb759..5e4e6170f43a 100644 --- a/trunk/include/linux/interrupt.h +++ b/trunk/include/linux/interrupt.h @@ -268,6 +268,11 @@ struct irq_affinity_notify { extern int irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify); +static inline void irq_run_affinity_notifiers(void) +{ + flush_scheduled_work(); +} + #else /* CONFIG_SMP */ static inline int irq_set_affinity(unsigned int irq, const struct cpumask *m) diff --git a/trunk/include/linux/ipc_namespace.h b/trunk/include/linux/ipc_namespace.h index ae221a7b5092..fe771978e877 100644 --- a/trunk/include/linux/ipc_namespace.h +++ b/trunk/include/linux/ipc_namespace.h @@ -24,7 +24,6 @@ struct ipc_ids { unsigned short seq_max; struct rw_semaphore rw_mutex; struct idr ipcs_idr; - int next_id; }; struct ipc_namespace { diff --git a/trunk/include/linux/libata.h b/trunk/include/linux/libata.h index 649e5f86b5f0..83ba0ab2c915 100644 --- a/trunk/include/linux/libata.h +++ b/trunk/include/linux/libata.h @@ -652,8 +652,8 @@ struct ata_device { u32 gscr[SATA_PMP_GSCR_DWORDS]; /* PMP GSCR block */ }; - /* DEVSLP Timing Variables from Identify Device Data Log */ - u8 devslp_timing[ATA_LOG_DEVSLP_SIZE]; + /* Identify Device Data Log (30h), SATA Settings (page 08h) */ + u8 sata_settings[ATA_SECT_SIZE]; /* error history */ int spdn_cnt; diff --git a/trunk/include/linux/lockdep.h b/trunk/include/linux/lockdep.h index 2bca44b0893c..00e46376e28f 100644 --- a/trunk/include/linux/lockdep.h +++ b/trunk/include/linux/lockdep.h @@ -524,17 +524,14 @@ static inline void print_irqtrace_events(struct task_struct *curr) #ifdef CONFIG_DEBUG_LOCK_ALLOC # ifdef CONFIG_PROVE_LOCKING # define rwsem_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, NULL, i) -# define rwsem_acquire_nest(l, s, t, n, i) lock_acquire(l, s, t, 0, 2, n, i) # define rwsem_acquire_read(l, s, t, i) lock_acquire(l, s, t, 1, 2, NULL, i) # else # define rwsem_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, NULL, i) -# define rwsem_acquire_nest(l, s, t, n, i) lock_acquire(l, s, t, 0, 1, n, i) # define rwsem_acquire_read(l, s, t, i) lock_acquire(l, s, t, 1, 1, NULL, i) # endif # define rwsem_release(l, n, i) lock_release(l, n, i) #else # define rwsem_acquire(l, s, t, i) do { } while (0) -# define rwsem_acquire_nest(l, s, t, n, i) do { } while (0) # define rwsem_acquire_read(l, s, t, i) do { } while (0) # define rwsem_release(l, n, i) do { } while (0) #endif diff --git a/trunk/include/linux/mfd/abx500.h b/trunk/include/linux/mfd/abx500.h index e53dcfeaee69..2138bd33021a 100644 --- a/trunk/include/linux/mfd/abx500.h +++ b/trunk/include/linux/mfd/abx500.h @@ -272,6 +272,8 @@ struct abx500_bm_data { const struct abx500_fg_parameters *fg_params; }; +extern struct abx500_bm_data ab8500_bm_data; + enum { NTC_EXTERNAL = 0, NTC_INTERNAL, diff --git a/trunk/include/linux/mfd/abx500/ab8500-bm.h b/trunk/include/linux/mfd/abx500/ab8500-bm.h index 9bd037df97d9..44310c98ee6e 100644 --- a/trunk/include/linux/mfd/abx500/ab8500-bm.h +++ b/trunk/include/linux/mfd/abx500/ab8500-bm.h @@ -422,10 +422,7 @@ struct ab8500_chargalg_platform_data { struct ab8500_btemp; struct ab8500_gpadc; struct ab8500_fg; - #ifdef CONFIG_AB8500_BM -extern struct abx500_bm_data ab8500_bm_data; - void ab8500_fg_reinit(void); void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA); struct ab8500_btemp *ab8500_btemp_get(void); @@ -437,7 +434,31 @@ int ab8500_fg_inst_curr_finalize(struct ab8500_fg *di, int *res); int ab8500_fg_inst_curr_done(struct ab8500_fg *di); #else -static struct abx500_bm_data ab8500_bm_data; +int ab8500_fg_inst_curr_done(struct ab8500_fg *di) +{ +} +static void ab8500_fg_reinit(void) +{ +} +static void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA) +{ +} +static struct ab8500_btemp *ab8500_btemp_get(void) +{ + return NULL; +} +static int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp) +{ + return 0; +} +struct ab8500_fg *ab8500_fg_get(void) +{ + return NULL; +} +static int ab8500_fg_inst_curr_blocking(struct ab8500_fg *dev) +{ + return -ENODEV; +} static inline int ab8500_fg_inst_curr_start(struct ab8500_fg *di) { diff --git a/trunk/include/linux/mfd/da9052/da9052.h b/trunk/include/linux/mfd/da9052/da9052.h index 786d02eb79d2..86dd93de6ff2 100644 --- a/trunk/include/linux/mfd/da9052/da9052.h +++ b/trunk/include/linux/mfd/da9052/da9052.h @@ -99,9 +99,6 @@ struct da9052 { u8 chip_id; int chip_irq; - - /* SOC I/O transfer related fixes for DA9052/53 */ - int (*fix_io) (struct da9052 *da9052, unsigned char reg); }; /* ADC API */ @@ -116,87 +113,32 @@ static inline int da9052_reg_read(struct da9052 *da9052, unsigned char reg) ret = regmap_read(da9052->regmap, reg, &val); if (ret < 0) return ret; - - if (da9052->fix_io) { - ret = da9052->fix_io(da9052, reg); - if (ret < 0) - return ret; - } - return val; } static inline int da9052_reg_write(struct da9052 *da9052, unsigned char reg, unsigned char val) { - int ret; - - ret = regmap_write(da9052->regmap, reg, val); - if (ret < 0) - return ret; - - if (da9052->fix_io) { - ret = da9052->fix_io(da9052, reg); - if (ret < 0) - return ret; - } - - return ret; + return regmap_write(da9052->regmap, reg, val); } static inline int da9052_group_read(struct da9052 *da9052, unsigned char reg, unsigned reg_cnt, unsigned char *val) { - int ret; - - ret = regmap_bulk_read(da9052->regmap, reg, val, reg_cnt); - if (ret < 0) - return ret; - - if (da9052->fix_io) { - ret = da9052->fix_io(da9052, reg); - if (ret < 0) - return ret; - } - - return ret; + return regmap_bulk_read(da9052->regmap, reg, val, reg_cnt); } static inline int da9052_group_write(struct da9052 *da9052, unsigned char reg, unsigned reg_cnt, unsigned char *val) { - int ret; - - ret = regmap_raw_write(da9052->regmap, reg, val, reg_cnt); - if (ret < 0) - return ret; - - if (da9052->fix_io) { - ret = da9052->fix_io(da9052, reg); - if (ret < 0) - return ret; - } - - return ret; + return regmap_raw_write(da9052->regmap, reg, val, reg_cnt); } static inline int da9052_reg_update(struct da9052 *da9052, unsigned char reg, unsigned char bit_mask, unsigned char reg_val) { - int ret; - - ret = regmap_update_bits(da9052->regmap, reg, bit_mask, reg_val); - if (ret < 0) - return ret; - - if (da9052->fix_io) { - ret = da9052->fix_io(da9052, reg); - if (ret < 0) - return ret; - } - - return ret; + return regmap_update_bits(da9052->regmap, reg, bit_mask, reg_val); } int da9052_device_init(struct da9052 *da9052, u8 chip_id); diff --git a/trunk/include/linux/mfd/da9052/reg.h b/trunk/include/linux/mfd/da9052/reg.h index c4dd3a8add21..b97f7309d7f6 100644 --- a/trunk/include/linux/mfd/da9052/reg.h +++ b/trunk/include/linux/mfd/da9052/reg.h @@ -34,9 +34,6 @@ #define DA9052_STATUS_C_REG 3 #define DA9052_STATUS_D_REG 4 -/* PARK REGISTER */ -#define DA9052_PARK_REGISTER DA9052_STATUS_D_REG - /* EVENT REGISTERS */ #define DA9052_EVENT_A_REG 5 #define DA9052_EVENT_B_REG 6 diff --git a/trunk/include/linux/mfd/rtsx_common.h b/trunk/include/linux/mfd/rtsx_common.h index 2b13970596f5..a8d393e3066b 100644 --- a/trunk/include/linux/mfd/rtsx_common.h +++ b/trunk/include/linux/mfd/rtsx_common.h @@ -38,9 +38,6 @@ #define RTSX_SD_CARD 0 #define RTSX_MS_CARD 1 -#define CLK_TO_DIV_N 0 -#define DIV_N_TO_CLK 1 - struct platform_device; struct rtsx_slot { diff --git a/trunk/include/linux/mfd/rtsx_pci.h b/trunk/include/linux/mfd/rtsx_pci.h index 4b117a3f54d4..060b721fcbfb 100644 --- a/trunk/include/linux/mfd/rtsx_pci.h +++ b/trunk/include/linux/mfd/rtsx_pci.h @@ -158,9 +158,10 @@ #define SG_TRANS_DATA (0x02 << 4) #define SG_LINK_DESC (0x03 << 4) -/* Output voltage */ -#define OUTPUT_3V3 0 -#define OUTPUT_1V8 1 +/* SD bank voltage */ +#define SD_IO_3V3 0 +#define SD_IO_1V8 1 + /* Card Clock Enable Register */ #define SD_CLK_EN 0x04 @@ -200,20 +201,6 @@ #define CHANGE_CLK 0x01 /* LDO_CTL */ -#define BPP_ASIC_1V7 0x00 -#define BPP_ASIC_1V8 0x01 -#define BPP_ASIC_1V9 0x02 -#define BPP_ASIC_2V0 0x03 -#define BPP_ASIC_2V7 0x04 -#define BPP_ASIC_2V8 0x05 -#define BPP_ASIC_3V2 0x06 -#define BPP_ASIC_3V3 0x07 -#define BPP_REG_TUNED18 0x07 -#define BPP_TUNED18_SHIFT_8402 5 -#define BPP_TUNED18_SHIFT_8411 4 -#define BPP_PAD_MASK 0x04 -#define BPP_PAD_3V3 0x04 -#define BPP_PAD_1V8 0x00 #define BPP_LDO_POWB 0x03 #define BPP_LDO_ON 0x00 #define BPP_LDO_SUSPEND 0x02 @@ -701,10 +688,7 @@ struct pcr_ops { int (*disable_auto_blink)(struct rtsx_pcr *pcr); int (*card_power_on)(struct rtsx_pcr *pcr, int card); int (*card_power_off)(struct rtsx_pcr *pcr, int card); - int (*switch_output_voltage)(struct rtsx_pcr *pcr, - u8 voltage); unsigned int (*cd_deglitch)(struct rtsx_pcr *pcr); - int (*conv_clk_and_div_n)(int clk, int dir); }; enum PDEV_STAT {PDEV_STAT_IDLE, PDEV_STAT_RUN}; @@ -799,7 +783,6 @@ int rtsx_pci_switch_clock(struct rtsx_pcr *pcr, unsigned int card_clock, u8 ssc_depth, bool initial_mode, bool double_clk, bool vpclk); int rtsx_pci_card_power_on(struct rtsx_pcr *pcr, int card); int rtsx_pci_card_power_off(struct rtsx_pcr *pcr, int card); -int rtsx_pci_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage); unsigned int rtsx_pci_card_exist(struct rtsx_pcr *pcr); void rtsx_pci_complete_unfinished_transfer(struct rtsx_pcr *pcr); diff --git a/trunk/include/linux/mm.h b/trunk/include/linux/mm.h index 66e2f7c61e5c..63204078f72b 100644 --- a/trunk/include/linux/mm.h +++ b/trunk/include/linux/mm.h @@ -455,6 +455,7 @@ void put_pages_list(struct list_head *pages); void split_page(struct page *page, unsigned int order); int split_free_page(struct page *page); +int capture_free_page(struct page *page, int alloc_order, int migratetype); /* * Compound pages have a destructor function. Provide a diff --git a/trunk/include/linux/mmzone.h b/trunk/include/linux/mmzone.h index 73b64a38b984..4bec5be82cab 100644 --- a/trunk/include/linux/mmzone.h +++ b/trunk/include/linux/mmzone.h @@ -503,6 +503,14 @@ struct zone { * rarely used fields: */ const char *name; +#ifdef CONFIG_MEMORY_ISOLATION + /* + * the number of MIGRATE_ISOLATE *pageblock*. + * We need this for free page counting. Look at zone_watermark_ok_safe. + * It's protected by zone->lock + */ + int nr_pageblock_isolate; +#endif } ____cacheline_internodealigned_in_smp; typedef enum { diff --git a/trunk/include/linux/module.h b/trunk/include/linux/module.h index 1375ee3f03aa..7760c6d344a3 100644 --- a/trunk/include/linux/module.h +++ b/trunk/include/linux/module.h @@ -199,11 +199,11 @@ struct module_use { struct module *source, *target; }; -enum module_state { - MODULE_STATE_LIVE, /* Normal state. */ - MODULE_STATE_COMING, /* Full formed, running module_init. */ - MODULE_STATE_GOING, /* Going away. */ - MODULE_STATE_UNFORMED, /* Still setting it up. */ +enum module_state +{ + MODULE_STATE_LIVE, + MODULE_STATE_COMING, + MODULE_STATE_GOING, }; /** diff --git a/trunk/include/linux/msg.h b/trunk/include/linux/msg.h index 391af8d11cce..7a4b9e97d29a 100644 --- a/trunk/include/linux/msg.h +++ b/trunk/include/linux/msg.h @@ -34,9 +34,7 @@ struct msg_queue { /* Helper routines for sys_msgsnd and sys_msgrcv */ extern long do_msgsnd(int msqid, long mtype, void __user *mtext, size_t msgsz, int msgflg); -extern long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp, - int msgflg, - long (*msg_fill)(void __user *, struct msg_msg *, - size_t)); +extern long do_msgrcv(int msqid, long *pmtype, void __user *mtext, + size_t msgsz, long msgtyp, int msgflg); #endif /* _LINUX_MSG_H */ diff --git a/trunk/include/linux/namei.h b/trunk/include/linux/namei.h index 5a5ff57ceed4..e998c030061d 100644 --- a/trunk/include/linux/namei.h +++ b/trunk/include/linux/namei.h @@ -2,7 +2,6 @@ #define _LINUX_NAMEI_H #include -#include #include #include diff --git a/trunk/include/linux/netdevice.h b/trunk/include/linux/netdevice.h index 9ef07d0868b6..c599e4782d45 100644 --- a/trunk/include/linux/netdevice.h +++ b/trunk/include/linux/netdevice.h @@ -60,9 +60,6 @@ struct wireless_dev; #define SET_ETHTOOL_OPS(netdev,ops) \ ( (netdev)->ethtool_ops = (ops) ) -extern void netdev_set_default_ethtool_ops(struct net_device *dev, - const struct ethtool_ops *ops); - /* hardware address assignment types */ #define NET_ADDR_PERM 0 /* address is permanent (default) */ #define NET_ADDR_RANDOM 1 /* address is generated randomly */ diff --git a/trunk/include/linux/ptrace.h b/trunk/include/linux/ptrace.h index 89573a33ab3c..1693775ecfe8 100644 --- a/trunk/include/linux/ptrace.h +++ b/trunk/include/linux/ptrace.h @@ -45,6 +45,7 @@ extern long arch_ptrace(struct task_struct *child, long request, extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len); extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len); extern void ptrace_disable(struct task_struct *); +extern int ptrace_check_attach(struct task_struct *task, bool ignore_state); extern int ptrace_request(struct task_struct *child, long request, unsigned long addr, unsigned long data); extern void ptrace_notify(int exit_code); diff --git a/trunk/include/linux/rbtree_augmented.h b/trunk/include/linux/rbtree_augmented.h index fea49b5da12a..2ac60c9cf644 100644 --- a/trunk/include/linux/rbtree_augmented.h +++ b/trunk/include/linux/rbtree_augmented.h @@ -123,9 +123,9 @@ __rb_change_child(struct rb_node *old, struct rb_node *new, extern void __rb_erase_color(struct rb_node *parent, struct rb_root *root, void (*augment_rotate)(struct rb_node *old, struct rb_node *new)); -static __always_inline struct rb_node * -__rb_erase_augmented(struct rb_node *node, struct rb_root *root, - const struct rb_augment_callbacks *augment) +static __always_inline void +rb_erase_augmented(struct rb_node *node, struct rb_root *root, + const struct rb_augment_callbacks *augment) { struct rb_node *child = node->rb_right, *tmp = node->rb_left; struct rb_node *parent, *rebalance; @@ -217,14 +217,6 @@ __rb_erase_augmented(struct rb_node *node, struct rb_root *root, } augment->propagate(tmp, NULL); - return rebalance; -} - -static __always_inline void -rb_erase_augmented(struct rb_node *node, struct rb_root *root, - const struct rb_augment_callbacks *augment) -{ - struct rb_node *rebalance = __rb_erase_augmented(node, root, augment); if (rebalance) __rb_erase_color(rebalance, root, augment->rotate); } diff --git a/trunk/include/linux/rwsem.h b/trunk/include/linux/rwsem.h index 8da67d625e13..54bd7cd7ecbd 100644 --- a/trunk/include/linux/rwsem.h +++ b/trunk/include/linux/rwsem.h @@ -125,17 +125,8 @@ extern void downgrade_write(struct rw_semaphore *sem); */ extern void down_read_nested(struct rw_semaphore *sem, int subclass); extern void down_write_nested(struct rw_semaphore *sem, int subclass); -extern void _down_write_nest_lock(struct rw_semaphore *sem, struct lockdep_map *nest_lock); - -# define down_write_nest_lock(sem, nest_lock) \ -do { \ - typecheck(struct lockdep_map *, &(nest_lock)->dep_map); \ - _down_write_nest_lock(sem, &(nest_lock)->dep_map); \ -} while (0); - #else # define down_read_nested(sem, subclass) down_read(sem) -# define down_write_nest_lock(sem, nest_lock) down_write(sem) # define down_write_nested(sem, subclass) down_write(sem) #endif diff --git a/trunk/include/linux/sched.h b/trunk/include/linux/sched.h index d2112477ff5e..206bb089c06b 100644 --- a/trunk/include/linux/sched.h +++ b/trunk/include/linux/sched.h @@ -1810,7 +1810,6 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut, #define PF_MEMALLOC 0x00000800 /* Allocating memory */ #define PF_NPROC_EXCEEDED 0x00001000 /* set_user noticed that RLIMIT_NPROC was exceeded */ #define PF_USED_MATH 0x00002000 /* if unset the fpu must be initialized before use */ -#define PF_USED_ASYNC 0x00004000 /* used async_schedule*(), used by module init */ #define PF_NOFREEZE 0x00008000 /* this thread should not be frozen */ #define PF_FROZEN 0x00010000 /* frozen for system suspend */ #define PF_FSTRANS 0x00020000 /* inside a filesystem transaction */ @@ -2714,16 +2713,7 @@ static inline void thread_group_cputime_init(struct signal_struct *sig) extern void recalc_sigpending_and_wake(struct task_struct *t); extern void recalc_sigpending(void); -extern void signal_wake_up_state(struct task_struct *t, unsigned int state); - -static inline void signal_wake_up(struct task_struct *t, bool resume) -{ - signal_wake_up_state(t, resume ? TASK_WAKEKILL : 0); -} -static inline void ptrace_signal_wake_up(struct task_struct *t, bool resume) -{ - signal_wake_up_state(t, resume ? __TASK_TRACED : 0); -} +extern void signal_wake_up(struct task_struct *t, int resume_stopped); /* * Wrappers for p->thread_info->cpu access. No-op on UP. diff --git a/trunk/include/linux/security.h b/trunk/include/linux/security.h index eee7478cda70..0f6afc657f77 100644 --- a/trunk/include/linux/security.h +++ b/trunk/include/linux/security.h @@ -989,29 +989,17 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) * tells the LSM to decrement the number of secmark labeling rules loaded * @req_classify_flow: * Sets the flow's sid to the openreq sid. - * @tun_dev_alloc_security: - * This hook allows a module to allocate a security structure for a TUN - * device. - * @security pointer to a security structure pointer. - * Returns a zero on success, negative values on failure. - * @tun_dev_free_security: - * This hook allows a module to free the security structure for a TUN - * device. - * @security pointer to the TUN device's security structure * @tun_dev_create: * Check permissions prior to creating a new TUN device. - * @tun_dev_attach_queue: - * Check permissions prior to attaching to a TUN device queue. - * @security pointer to the TUN device's security structure. + * @tun_dev_post_create: + * This hook allows a module to update or allocate a per-socket security + * structure. + * @sk contains the newly created sock structure. * @tun_dev_attach: - * This hook can be used by the module to update any security state + * Check permissions prior to attaching to a persistent TUN device. This + * hook can also be used by the module to update any security state * associated with the TUN device's sock structure. * @sk contains the existing sock structure. - * @security pointer to the TUN device's security structure. - * @tun_dev_open: - * This hook can be used by the module to update any security state - * associated with the TUN device's security structure. - * @security pointer to the TUN devices's security structure. * * Security hooks for XFRM operations. * @@ -1632,12 +1620,9 @@ struct security_operations { void (*secmark_refcount_inc) (void); void (*secmark_refcount_dec) (void); void (*req_classify_flow) (const struct request_sock *req, struct flowi *fl); - int (*tun_dev_alloc_security) (void **security); - void (*tun_dev_free_security) (void *security); - int (*tun_dev_create) (void); - int (*tun_dev_attach_queue) (void *security); - int (*tun_dev_attach) (struct sock *sk, void *security); - int (*tun_dev_open) (void *security); + int (*tun_dev_create)(void); + void (*tun_dev_post_create)(struct sock *sk); + int (*tun_dev_attach)(struct sock *sk); #endif /* CONFIG_SECURITY_NETWORK */ #ifdef CONFIG_SECURITY_NETWORK_XFRM @@ -2581,12 +2566,9 @@ void security_inet_conn_established(struct sock *sk, int security_secmark_relabel_packet(u32 secid); void security_secmark_refcount_inc(void); void security_secmark_refcount_dec(void); -int security_tun_dev_alloc_security(void **security); -void security_tun_dev_free_security(void *security); int security_tun_dev_create(void); -int security_tun_dev_attach_queue(void *security); -int security_tun_dev_attach(struct sock *sk, void *security); -int security_tun_dev_open(void *security); +void security_tun_dev_post_create(struct sock *sk); +int security_tun_dev_attach(struct sock *sk); #else /* CONFIG_SECURITY_NETWORK */ static inline int security_unix_stream_connect(struct sock *sock, @@ -2751,31 +2733,16 @@ static inline void security_secmark_refcount_dec(void) { } -static inline int security_tun_dev_alloc_security(void **security) -{ - return 0; -} - -static inline void security_tun_dev_free_security(void *security) -{ -} - static inline int security_tun_dev_create(void) { return 0; } -static inline int security_tun_dev_attach_queue(void *security) -{ - return 0; -} - -static inline int security_tun_dev_attach(struct sock *sk, void *security) +static inline void security_tun_dev_post_create(struct sock *sk) { - return 0; } -static inline int security_tun_dev_open(void *security) +static inline int security_tun_dev_attach(struct sock *sk) { return 0; } diff --git a/trunk/include/linux/usb/usbnet.h b/trunk/include/linux/usb/usbnet.h index 5de7a220e986..bd45eb7bedc8 100644 --- a/trunk/include/linux/usb/usbnet.h +++ b/trunk/include/linux/usb/usbnet.h @@ -100,7 +100,6 @@ struct driver_info { #define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */ #define FLAG_POINTTOPOINT 0x1000 /* possibly use "usb%d" names */ -#define FLAG_NOARP 0x2000 /* device can't do ARP */ /* * Indicates to usbnet, that USB driver accumulates multiple IP packets. diff --git a/trunk/include/net/ip.h b/trunk/include/net/ip.h index a68f838a132c..0707fb9551aa 100644 --- a/trunk/include/net/ip.h +++ b/trunk/include/net/ip.h @@ -143,8 +143,6 @@ static inline struct sk_buff *ip_finish_skb(struct sock *sk, struct flowi4 *fl4) extern int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len); -extern void ip4_datagram_release_cb(struct sock *sk); - struct ip_reply_arg { struct kvec iov[1]; int flags; diff --git a/trunk/include/net/netfilter/nf_conntrack_core.h b/trunk/include/net/netfilter/nf_conntrack_core.h index e98aeb3da033..d8f5b9f52169 100644 --- a/trunk/include/net/netfilter/nf_conntrack_core.h +++ b/trunk/include/net/netfilter/nf_conntrack_core.h @@ -31,8 +31,6 @@ extern void nf_conntrack_cleanup(struct net *net); extern int nf_conntrack_proto_init(struct net *net); extern void nf_conntrack_proto_fini(struct net *net); -extern void nf_conntrack_cleanup_end(void); - extern bool nf_ct_get_tuple(const struct sk_buff *skb, unsigned int nhoff, diff --git a/trunk/include/net/netns/conntrack.h b/trunk/include/net/netns/conntrack.h index 923cb20051ed..a1d83cc8bf85 100644 --- a/trunk/include/net/netns/conntrack.h +++ b/trunk/include/net/netns/conntrack.h @@ -71,7 +71,6 @@ struct netns_ct { struct hlist_head *expect_hash; struct hlist_nulls_head unconfirmed; struct hlist_nulls_head dying; - struct hlist_nulls_head tmpl; struct ip_conntrack_stat __percpu *stat; struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb; struct nf_exp_event_notifier __rcu *nf_expect_event_cb; diff --git a/trunk/include/net/netns/x_tables.h b/trunk/include/net/netns/x_tables.h index c24060ee411e..591db7d657a3 100644 --- a/trunk/include/net/netns/x_tables.h +++ b/trunk/include/net/netns/x_tables.h @@ -8,7 +8,6 @@ struct ebt_table; struct netns_xt { struct list_head tables[NFPROTO_NUMPROTO]; - bool notrack_deprecated_warning; #if defined(CONFIG_BRIDGE_NF_EBTABLES) || \ defined(CONFIG_BRIDGE_NF_EBTABLES_MODULE) struct ebt_table *broute_table; diff --git a/trunk/include/sound/cs4271.h b/trunk/include/sound/cs4271.h index dd8c48d14ed9..6d9e15ed1dcf 100644 --- a/trunk/include/sound/cs4271.h +++ b/trunk/include/sound/cs4271.h @@ -19,7 +19,7 @@ struct cs4271_platform_data { int gpio_nreset; /* GPIO driving Reset pin, if any */ - bool amutec_eq_bmutec; /* flag to enable AMUTEC=BMUTEC */ + int amutec_eq_bmutec:1; /* flag to enable AMUTEC=BMUTEC */ }; #endif /* __CS4271_H */ diff --git a/trunk/include/sound/soc.h b/trunk/include/sound/soc.h index bc56738cb109..769e27c774a3 100644 --- a/trunk/include/sound/soc.h +++ b/trunk/include/sound/soc.h @@ -58,9 +58,8 @@ .info = snd_soc_info_volsw_range, .get = snd_soc_get_volsw_range, \ .put = snd_soc_put_volsw_range, \ .private_value = (unsigned long)&(struct soc_mixer_control) \ - {.reg = xreg, .rreg = xreg, .shift = xshift, \ - .rshift = xshift, .min = xmin, .max = xmax, \ - .platform_max = xmax, .invert = xinvert} } + {.reg = xreg, .shift = xshift, .min = xmin,\ + .max = xmax, .platform_max = xmax, .invert = xinvert} } #define SOC_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ @@ -89,9 +88,8 @@ .info = snd_soc_info_volsw_range, \ .get = snd_soc_get_volsw_range, .put = snd_soc_put_volsw_range, \ .private_value = (unsigned long)&(struct soc_mixer_control) \ - {.reg = xreg, .rreg = xreg, .shift = xshift, \ - .rshift = xshift, .min = xmin, .max = xmax, \ - .platform_max = xmax, .invert = xinvert} } + {.reg = xreg, .shift = xshift, .min = xmin,\ + .max = xmax, .platform_max = xmax, .invert = xinvert} } #define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \ diff --git a/trunk/include/target/target_core_base.h b/trunk/include/target/target_core_base.h index 663e34a5383f..7cae2360221e 100644 --- a/trunk/include/target/target_core_base.h +++ b/trunk/include/target/target_core_base.h @@ -174,7 +174,6 @@ typedef unsigned __bitwise__ sense_reason_t; enum tcm_sense_reason_table { #define R(x) (__force sense_reason_t )(x) - TCM_NO_SENSE = R(0x00), TCM_NON_EXISTENT_LUN = R(0x01), TCM_UNSUPPORTED_SCSI_OPCODE = R(0x02), TCM_INCORRECT_AMOUNT_OF_DATA = R(0x03), diff --git a/trunk/include/uapi/drm/exynos_drm.h b/trunk/include/uapi/drm/exynos_drm.h index d5844122ff32..e7f52c334005 100644 --- a/trunk/include/uapi/drm/exynos_drm.h +++ b/trunk/include/uapi/drm/exynos_drm.h @@ -6,10 +6,24 @@ * Joonyoung Shim * Seung-Woo Kim * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _UAPI_EXYNOS_DRM_H_ @@ -171,8 +185,6 @@ enum drm_exynos_flip { EXYNOS_DRM_FLIP_NONE = (0 << 0), EXYNOS_DRM_FLIP_VERTICAL = (1 << 0), EXYNOS_DRM_FLIP_HORIZONTAL = (1 << 1), - EXYNOS_DRM_FLIP_BOTH = EXYNOS_DRM_FLIP_VERTICAL | - EXYNOS_DRM_FLIP_HORIZONTAL, }; enum drm_exynos_degree { diff --git a/trunk/include/uapi/linux/audit.h b/trunk/include/uapi/linux/audit.h index 9f096f1c0907..76352ac45f24 100644 --- a/trunk/include/uapi/linux/audit.h +++ b/trunk/include/uapi/linux/audit.h @@ -26,6 +26,7 @@ #include #include +#include /* The netlink messages for the audit system is divided into blocks: * 1000 - 1099 are for commanding the audit system @@ -105,7 +106,6 @@ #define AUDIT_MMAP 1323 /* Record showing descriptor and flags in mmap */ #define AUDIT_NETFILTER_PKT 1324 /* Packets traversing netfilter chains */ #define AUDIT_NETFILTER_CFG 1325 /* Netfilter chain modifications */ -#define AUDIT_SECCOMP 1326 /* Secure Computing event */ #define AUDIT_AVC 1400 /* SE Linux avc denial or grant */ #define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */ diff --git a/trunk/include/uapi/linux/msg.h b/trunk/include/uapi/linux/msg.h index 22d95c6854e0..78dbd2f996a3 100644 --- a/trunk/include/uapi/linux/msg.h +++ b/trunk/include/uapi/linux/msg.h @@ -10,7 +10,6 @@ /* msgrcv options */ #define MSG_NOERROR 010000 /* no error if message is too big */ #define MSG_EXCEPT 020000 /* recv any msg except of specified type.*/ -#define MSG_COPY 040000 /* copy (not remove) all queue messages */ /* Obsolete, used only for backwards compatibility and libc5 compiles */ struct msqid_ds { diff --git a/trunk/include/uapi/linux/serial_core.h b/trunk/include/uapi/linux/serial_core.h index 2c6c85f18ea0..78f99d97475b 100644 --- a/trunk/include/uapi/linux/serial_core.h +++ b/trunk/include/uapi/linux/serial_core.h @@ -50,8 +50,7 @@ #define PORT_LPC3220 22 /* NXP LPC32xx SoC "Standard" UART */ #define PORT_8250_CIR 23 /* CIR infrared port, has its own driver */ #define PORT_XR17V35X 24 /* Exar XR17V35x UARTs */ -#define PORT_BRCM_TRUMANAGE 24 -#define PORT_MAX_8250 25 /* max port ID */ +#define PORT_MAX_8250 24 /* max port ID */ /* * ARM specific type numbers. These are not currently guaranteed diff --git a/trunk/init/Kconfig b/trunk/init/Kconfig index be8b7f55312d..7d30240e5bfe 100644 --- a/trunk/init/Kconfig +++ b/trunk/init/Kconfig @@ -1182,7 +1182,7 @@ config CC_OPTIMIZE_FOR_SIZE Enabling this option will pass "-Os" instead of "-O2" to gcc resulting in a smaller kernel. - If unsure, say N. + If unsure, say Y. config SYSCTL bool diff --git a/trunk/init/do_mounts_initrd.c b/trunk/init/do_mounts_initrd.c index f9acf71b9810..5e4ded51788e 100644 --- a/trunk/init/do_mounts_initrd.c +++ b/trunk/init/do_mounts_initrd.c @@ -36,10 +36,6 @@ __setup("noinitrd", no_initrd); static int init_linuxrc(struct subprocess_info *info, struct cred *new) { sys_unshare(CLONE_FS | CLONE_FILES); - /* stdin/stdout/stderr for /linuxrc */ - sys_open("/dev/console", O_RDWR, 0); - sys_dup(0); - sys_dup(0); /* move initrd over / and chdir/chroot in initrd root */ sys_chdir("/root"); sys_mount(".", "/", NULL, MS_MOVE, NULL); diff --git a/trunk/init/main.c b/trunk/init/main.c index 92d728a32d51..85d69dffe864 100644 --- a/trunk/init/main.c +++ b/trunk/init/main.c @@ -802,7 +802,7 @@ static int run_init_process(const char *init_filename) (const char __user *const __user *)envp_init); } -static noinline void __init kernel_init_freeable(void); +static void __init kernel_init_freeable(void); static int __ref kernel_init(void *unused) { @@ -845,7 +845,7 @@ static int __ref kernel_init(void *unused) "See Linux Documentation/init.txt for guidance."); } -static noinline void __init kernel_init_freeable(void) +static void __init kernel_init_freeable(void) { /* * Wait until kthreadd is all set-up. diff --git a/trunk/ipc/compat.c b/trunk/ipc/compat.c index 2547f29dcd1b..ad9518eb26e0 100644 --- a/trunk/ipc/compat.c +++ b/trunk/ipc/compat.c @@ -306,20 +306,6 @@ static long do_compat_semctl(int first, int second, int third, u32 pad) return err; } -long compat_do_msg_fill(void __user *dest, struct msg_msg *msg, size_t bufsz) -{ - struct compat_msgbuf __user *msgp = dest; - size_t msgsz; - - if (put_user(msg->m_type, &msgp->mtype)) - return -EFAULT; - - msgsz = (bufsz > msg->m_ts) ? msg->m_ts : bufsz; - if (store_msg(msgp->mtext, msg, msgsz)) - return -EFAULT; - return msgsz; -} - #ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC long compat_sys_semctl(int first, int second, int third, void __user *uptr) { @@ -351,6 +337,10 @@ long compat_sys_msgsnd(int first, int second, int third, void __user *uptr) long compat_sys_msgrcv(int first, int second, int msgtyp, int third, int version, void __user *uptr) { + struct compat_msgbuf __user *up; + long type; + int err; + if (first < 0) return -EINVAL; if (second < 0) @@ -358,15 +348,23 @@ long compat_sys_msgrcv(int first, int second, int msgtyp, int third, if (!version) { struct compat_ipc_kludge ipck; + err = -EINVAL; if (!uptr) - return -EINVAL; + goto out; + err = -EFAULT; if (copy_from_user (&ipck, uptr, sizeof(ipck))) - return -EFAULT; + goto out; uptr = compat_ptr(ipck.msgp); msgtyp = ipck.msgtyp; } - return do_msgrcv(first, uptr, second, msgtyp, third, - compat_do_msg_fill); + up = uptr; + err = do_msgrcv(first, &type, up->mtext, second, msgtyp, third); + if (err < 0) + goto out; + if (put_user(type, &up->mtype)) + err = -EFAULT; +out: + return err; } #else long compat_sys_semctl(int semid, int semnum, int cmd, int arg) @@ -387,8 +385,16 @@ long compat_sys_msgsnd(int msqid, struct compat_msgbuf __user *msgp, long compat_sys_msgrcv(int msqid, struct compat_msgbuf __user *msgp, compat_ssize_t msgsz, long msgtyp, int msgflg) { - return do_msgrcv(msqid, msgp, (ssize_t)msgsz, msgtyp, msgflg, - compat_do_msg_fill); + long err, mtype; + + err = do_msgrcv(msqid, &mtype, msgp->mtext, (ssize_t)msgsz, msgtyp, msgflg); + if (err < 0) + goto out; + + if (put_user(mtype, &msgp->mtype)) + err = -EFAULT; + out: + return err; } #endif diff --git a/trunk/ipc/ipc_sysctl.c b/trunk/ipc/ipc_sysctl.c index 130dfece27ac..00fba2bab87d 100644 --- a/trunk/ipc/ipc_sysctl.c +++ b/trunk/ipc/ipc_sysctl.c @@ -158,9 +158,6 @@ static int proc_ipcauto_dointvec_minmax(ctl_table *table, int write, static int zero; static int one = 1; -#ifdef CONFIG_CHECKPOINT_RESTORE -static int int_max = INT_MAX; -#endif static struct ctl_table ipc_kern_table[] = { { @@ -230,35 +227,6 @@ static struct ctl_table ipc_kern_table[] = { .extra1 = &zero, .extra2 = &one, }, -#ifdef CONFIG_CHECKPOINT_RESTORE - { - .procname = "sem_next_id", - .data = &init_ipc_ns.ids[IPC_SEM_IDS].next_id, - .maxlen = sizeof(init_ipc_ns.ids[IPC_SEM_IDS].next_id), - .mode = 0644, - .proc_handler = proc_ipc_dointvec_minmax, - .extra1 = &zero, - .extra2 = &int_max, - }, - { - .procname = "msg_next_id", - .data = &init_ipc_ns.ids[IPC_MSG_IDS].next_id, - .maxlen = sizeof(init_ipc_ns.ids[IPC_MSG_IDS].next_id), - .mode = 0644, - .proc_handler = proc_ipc_dointvec_minmax, - .extra1 = &zero, - .extra2 = &int_max, - }, - { - .procname = "shm_next_id", - .data = &init_ipc_ns.ids[IPC_SHM_IDS].next_id, - .maxlen = sizeof(init_ipc_ns.ids[IPC_SHM_IDS].next_id), - .mode = 0644, - .proc_handler = proc_ipc_dointvec_minmax, - .extra1 = &zero, - .extra2 = &int_max, - }, -#endif {} }; diff --git a/trunk/ipc/msg.c b/trunk/ipc/msg.c index 950572f9d796..a71af5a65abf 100644 --- a/trunk/ipc/msg.c +++ b/trunk/ipc/msg.c @@ -755,91 +755,26 @@ static inline int convert_mode(long *msgtyp, int msgflg) return SEARCH_EQUAL; } -static long do_msg_fill(void __user *dest, struct msg_msg *msg, size_t bufsz) -{ - struct msgbuf __user *msgp = dest; - size_t msgsz; - - if (put_user(msg->m_type, &msgp->mtype)) - return -EFAULT; - - msgsz = (bufsz > msg->m_ts) ? msg->m_ts : bufsz; - if (store_msg(msgp->mtext, msg, msgsz)) - return -EFAULT; - return msgsz; -} - -#ifdef CONFIG_CHECKPOINT_RESTORE -/* - * This function creates new kernel message structure, large enough to store - * bufsz message bytes. - */ -static inline struct msg_msg *prepare_copy(void __user *buf, size_t bufsz, - int msgflg, long *msgtyp, - unsigned long *copy_number) -{ - struct msg_msg *copy; - - *copy_number = *msgtyp; - *msgtyp = 0; - /* - * Create dummy message to copy real message to. - */ - copy = load_msg(buf, bufsz); - if (!IS_ERR(copy)) - copy->m_ts = bufsz; - return copy; -} - -static inline void free_copy(struct msg_msg *copy) -{ - if (copy) - free_msg(copy); -} -#else -static inline struct msg_msg *prepare_copy(void __user *buf, size_t bufsz, - int msgflg, long *msgtyp, - unsigned long *copy_number) -{ - return ERR_PTR(-ENOSYS); -} - -static inline void free_copy(struct msg_msg *copy) -{ -} -#endif - -long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp, - int msgflg, - long (*msg_handler)(void __user *, struct msg_msg *, size_t)) +long do_msgrcv(int msqid, long *pmtype, void __user *mtext, + size_t msgsz, long msgtyp, int msgflg) { struct msg_queue *msq; struct msg_msg *msg; int mode; struct ipc_namespace *ns; - struct msg_msg *copy = NULL; - unsigned long copy_number = 0; - if (msqid < 0 || (long) bufsz < 0) + if (msqid < 0 || (long) msgsz < 0) return -EINVAL; - if (msgflg & MSG_COPY) { - copy = prepare_copy(buf, bufsz, msgflg, &msgtyp, ©_number); - if (IS_ERR(copy)) - return PTR_ERR(copy); - } mode = convert_mode(&msgtyp, msgflg); ns = current->nsproxy->ipc_ns; msq = msg_lock_check(ns, msqid); - if (IS_ERR(msq)) { - free_copy(copy); + if (IS_ERR(msq)) return PTR_ERR(msq); - } for (;;) { struct msg_receiver msr_d; struct list_head *tmp; - long msg_counter = 0; msg = ERR_PTR(-EACCES); if (ipcperms(ns, &msq->q_perm, S_IRUGO)) @@ -858,21 +793,12 @@ long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp, msg = walk_msg; if (mode == SEARCH_LESSEQUAL && walk_msg->m_type != 1) { + msg = walk_msg; msgtyp = walk_msg->m_type - 1; - } else if (msgflg & MSG_COPY) { - if (copy_number == msg_counter) { - /* - * Found requested message. - * Copy it. - */ - msg = copy_msg(msg, copy); - if (IS_ERR(msg)) - goto out_unlock; - break; - } - } else + } else { + msg = walk_msg; break; - msg_counter++; + } } tmp = tmp->next; } @@ -881,16 +807,10 @@ long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp, * Found a suitable message. * Unlink it from the queue. */ - if ((bufsz < msg->m_ts) && !(msgflg & MSG_NOERROR)) { + if ((msgsz < msg->m_ts) && !(msgflg & MSG_NOERROR)) { msg = ERR_PTR(-E2BIG); goto out_unlock; } - /* - * If we are copying, then do not unlink message and do - * not update queue parameters. - */ - if (msgflg & MSG_COPY) - goto out_unlock; list_del(&msg->m_list); msq->q_qnum--; msq->q_rtime = get_seconds(); @@ -914,7 +834,7 @@ long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp, if (msgflg & MSG_NOERROR) msr_d.r_maxsize = INT_MAX; else - msr_d.r_maxsize = bufsz; + msr_d.r_maxsize = msgsz; msr_d.r_msg = ERR_PTR(-EAGAIN); current->state = TASK_INTERRUPTIBLE; msg_unlock(msq); @@ -974,21 +894,32 @@ long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp, break; } } - if (IS_ERR(msg)) { - free_copy(copy); + if (IS_ERR(msg)) return PTR_ERR(msg); - } - bufsz = msg_handler(buf, msg, bufsz); + msgsz = (msgsz > msg->m_ts) ? msg->m_ts : msgsz; + *pmtype = msg->m_type; + if (store_msg(mtext, msg, msgsz)) + msgsz = -EFAULT; + free_msg(msg); - return bufsz; + return msgsz; } SYSCALL_DEFINE5(msgrcv, int, msqid, struct msgbuf __user *, msgp, size_t, msgsz, long, msgtyp, int, msgflg) { - return do_msgrcv(msqid, msgp, msgsz, msgtyp, msgflg, do_msg_fill); + long err, mtype; + + err = do_msgrcv(msqid, &mtype, msgp->mtext, msgsz, msgtyp, msgflg); + if (err < 0) + goto out; + + if (put_user(mtype, &msgp->mtype)) + err = -EFAULT; +out: + return err; } #ifdef CONFIG_PROC_FS diff --git a/trunk/ipc/msgutil.c b/trunk/ipc/msgutil.c index ebfcbfa8b7f2..6471f1bdae96 100644 --- a/trunk/ipc/msgutil.c +++ b/trunk/ipc/msgutil.c @@ -102,50 +102,7 @@ struct msg_msg *load_msg(const void __user *src, int len) free_msg(msg); return ERR_PTR(err); } -#ifdef CONFIG_CHECKPOINT_RESTORE -struct msg_msg *copy_msg(struct msg_msg *src, struct msg_msg *dst) -{ - struct msg_msgseg *dst_pseg, *src_pseg; - int len = src->m_ts; - int alen; - - BUG_ON(dst == NULL); - if (src->m_ts > dst->m_ts) - return ERR_PTR(-EINVAL); - alen = len; - if (alen > DATALEN_MSG) - alen = DATALEN_MSG; - - dst->next = NULL; - dst->security = NULL; - - memcpy(dst + 1, src + 1, alen); - - len -= alen; - dst_pseg = dst->next; - src_pseg = src->next; - while (len > 0) { - alen = len; - if (alen > DATALEN_SEG) - alen = DATALEN_SEG; - memcpy(dst_pseg + 1, src_pseg + 1, alen); - dst_pseg = dst_pseg->next; - len -= alen; - src_pseg = src_pseg->next; - } - - dst->m_type = src->m_type; - dst->m_ts = src->m_ts; - - return dst; -} -#else -struct msg_msg *copy_msg(struct msg_msg *src, struct msg_msg *dst) -{ - return ERR_PTR(-ENOSYS); -} -#endif int store_msg(void __user *dest, struct msg_msg *msg, int len) { int alen; diff --git a/trunk/ipc/util.c b/trunk/ipc/util.c index 74e1d9c7a98a..72fd0785ac94 100644 --- a/trunk/ipc/util.c +++ b/trunk/ipc/util.c @@ -122,7 +122,6 @@ void ipc_init_ids(struct ipc_ids *ids) ids->in_use = 0; ids->seq = 0; - ids->next_id = -1; { int seq_limit = INT_MAX/SEQ_MULTIPLIER; if (seq_limit > USHRT_MAX) @@ -253,7 +252,6 @@ int ipc_addid(struct ipc_ids* ids, struct kern_ipc_perm* new, int size) kuid_t euid; kgid_t egid; int id, err; - int next_id = ids->next_id; if (size > IPCMNI) size = IPCMNI; @@ -266,8 +264,7 @@ int ipc_addid(struct ipc_ids* ids, struct kern_ipc_perm* new, int size) rcu_read_lock(); spin_lock(&new->lock); - err = idr_get_new_above(&ids->ipcs_idr, new, - (next_id < 0) ? 0 : ipcid_to_idx(next_id), &id); + err = idr_get_new(&ids->ipcs_idr, new, &id); if (err) { spin_unlock(&new->lock); rcu_read_unlock(); @@ -280,14 +277,9 @@ int ipc_addid(struct ipc_ids* ids, struct kern_ipc_perm* new, int size) new->cuid = new->uid = euid; new->gid = new->cgid = egid; - if (next_id < 0) { - new->seq = ids->seq++; - if (ids->seq > ids->seq_max) - ids->seq = 0; - } else { - new->seq = ipcid_to_seqx(next_id); - ids->next_id = -1; - } + new->seq = ids->seq++; + if(ids->seq > ids->seq_max) + ids->seq = 0; new->id = ipc_buildid(id, new->seq); return id; diff --git a/trunk/ipc/util.h b/trunk/ipc/util.h index eeb79a1fbd83..c8fe2f7631e9 100644 --- a/trunk/ipc/util.h +++ b/trunk/ipc/util.h @@ -92,7 +92,6 @@ void __init ipc_init_proc_interface(const char *path, const char *header, #define IPC_SHM_IDS 2 #define ipcid_to_idx(id) ((id) % SEQ_MULTIPLIER) -#define ipcid_to_seqx(id) ((id) / SEQ_MULTIPLIER) /* must be called with ids->rw_mutex acquired for writing */ int ipc_addid(struct ipc_ids *, struct kern_ipc_perm *, int); @@ -140,7 +139,6 @@ int ipc_parse_version (int *cmd); extern void free_msg(struct msg_msg *msg); extern struct msg_msg *load_msg(const void __user *src, int len); -extern struct msg_msg *copy_msg(struct msg_msg *src, struct msg_msg *dst); extern int store_msg(void __user *dest, struct msg_msg *msg, int len); extern void recompute_msgmni(struct ipc_namespace *); diff --git a/trunk/kernel/async.c b/trunk/kernel/async.c index 6f34904a0b53..9d3118384858 100644 --- a/trunk/kernel/async.c +++ b/trunk/kernel/async.c @@ -86,27 +86,18 @@ static atomic_t entry_count; */ static async_cookie_t __lowest_in_progress(struct async_domain *running) { - async_cookie_t first_running = next_cookie; /* infinity value */ - async_cookie_t first_pending = next_cookie; /* ditto */ struct async_entry *entry; - /* - * Both running and pending lists are sorted but not disjoint. - * Take the first cookies from both and return the min. - */ if (!list_empty(&running->domain)) { entry = list_first_entry(&running->domain, typeof(*entry), list); - first_running = entry->cookie; + return entry->cookie; } - list_for_each_entry(entry, &async_pending, list) { - if (entry->running == running) { - first_pending = entry->cookie; - break; - } - } + list_for_each_entry(entry, &async_pending, list) + if (entry->running == running) + return entry->cookie; - return min(first_running, first_pending); + return next_cookie; /* "infinity" value */ } static async_cookie_t lowest_in_progress(struct async_domain *running) @@ -127,17 +118,13 @@ static void async_run_entry_fn(struct work_struct *work) { struct async_entry *entry = container_of(work, struct async_entry, work); - struct async_entry *pos; unsigned long flags; ktime_t uninitialized_var(calltime), delta, rettime; struct async_domain *running = entry->running; - /* 1) move self to the running queue, make sure it stays sorted */ + /* 1) move self to the running queue */ spin_lock_irqsave(&async_lock, flags); - list_for_each_entry_reverse(pos, &running->domain, list) - if (entry->cookie < pos->cookie) - break; - list_move_tail(&entry->list, &pos->list); + list_move_tail(&entry->list, &running->domain); spin_unlock_irqrestore(&async_lock, flags); /* 2) run (and print duration) */ @@ -209,9 +196,6 @@ static async_cookie_t __async_schedule(async_func_ptr *ptr, void *data, struct a atomic_inc(&entry_count); spin_unlock_irqrestore(&async_lock, flags); - /* mark that this task has queued an async job, used by module init */ - current->flags |= PF_USED_ASYNC; - /* schedule for execution */ queue_work(system_unbound_wq, &entry->work); diff --git a/trunk/kernel/audit.c b/trunk/kernel/audit.c index d596e5355f15..40414e9143db 100644 --- a/trunk/kernel/audit.c +++ b/trunk/kernel/audit.c @@ -272,8 +272,6 @@ static int audit_log_config_change(char *function_name, int new, int old, int rc = 0; ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE); - if (unlikely(!ab)) - return rc; audit_log_format(ab, "%s=%d old=%d auid=%u ses=%u", function_name, new, old, from_kuid(&init_user_ns, loginuid), sessionid); if (sid) { @@ -621,8 +619,6 @@ static int audit_log_common_recv_msg(struct audit_buffer **ab, u16 msg_type, } *ab = audit_log_start(NULL, GFP_KERNEL, msg_type); - if (unlikely(!*ab)) - return rc; audit_log_format(*ab, "pid=%d uid=%u auid=%u ses=%u", task_tgid_vnr(current), from_kuid(&init_user_ns, current_uid()), @@ -1101,23 +1097,6 @@ static inline void audit_get_stamp(struct audit_context *ctx, } } -/* - * Wait for auditd to drain the queue a little - */ -static void wait_for_auditd(unsigned long sleep_time) -{ - DECLARE_WAITQUEUE(wait, current); - set_current_state(TASK_INTERRUPTIBLE); - add_wait_queue(&audit_backlog_wait, &wait); - - if (audit_backlog_limit && - skb_queue_len(&audit_skb_queue) > audit_backlog_limit) - schedule_timeout(sleep_time); - - __set_current_state(TASK_RUNNING); - remove_wait_queue(&audit_backlog_wait, &wait); -} - /* Obtain an audit buffer. This routine does locking to obtain the * audit buffer, but then no locking is required for calls to * audit_log_*format. If the tsk is a task that is currently in a @@ -1163,13 +1142,20 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask, while (audit_backlog_limit && skb_queue_len(&audit_skb_queue) > audit_backlog_limit + reserve) { - if (gfp_mask & __GFP_WAIT && audit_backlog_wait_time) { - unsigned long sleep_time; + if (gfp_mask & __GFP_WAIT && audit_backlog_wait_time + && time_before(jiffies, timeout_start + audit_backlog_wait_time)) { - sleep_time = timeout_start + audit_backlog_wait_time - - jiffies; - if ((long)sleep_time > 0) - wait_for_auditd(sleep_time); + /* Wait for auditd to drain the queue a little */ + DECLARE_WAITQUEUE(wait, current); + set_current_state(TASK_INTERRUPTIBLE); + add_wait_queue(&audit_backlog_wait, &wait); + + if (audit_backlog_limit && + skb_queue_len(&audit_skb_queue) > audit_backlog_limit) + schedule_timeout(timeout_start + audit_backlog_wait_time - jiffies); + + __set_current_state(TASK_RUNNING); + remove_wait_queue(&audit_backlog_wait, &wait); continue; } if (audit_rate_check() && printk_ratelimit()) diff --git a/trunk/kernel/audit_tree.c b/trunk/kernel/audit_tree.c index 642a89c4f3d6..e81175ef25f8 100644 --- a/trunk/kernel/audit_tree.c +++ b/trunk/kernel/audit_tree.c @@ -449,26 +449,11 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree) return 0; } -static void audit_log_remove_rule(struct audit_krule *rule) -{ - struct audit_buffer *ab; - - ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE); - if (unlikely(!ab)) - return; - audit_log_format(ab, "op="); - audit_log_string(ab, "remove rule"); - audit_log_format(ab, " dir="); - audit_log_untrustedstring(ab, rule->tree->pathname); - audit_log_key(ab, rule->filterkey); - audit_log_format(ab, " list=%d res=1", rule->listnr); - audit_log_end(ab); -} - static void kill_rules(struct audit_tree *tree) { struct audit_krule *rule, *next; struct audit_entry *entry; + struct audit_buffer *ab; list_for_each_entry_safe(rule, next, &tree->rules, rlist) { entry = container_of(rule, struct audit_entry, rule); @@ -476,7 +461,14 @@ static void kill_rules(struct audit_tree *tree) list_del_init(&rule->rlist); if (rule->tree) { /* not a half-baked one */ - audit_log_remove_rule(rule); + ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE); + audit_log_format(ab, "op="); + audit_log_string(ab, "remove rule"); + audit_log_format(ab, " dir="); + audit_log_untrustedstring(ab, rule->tree->pathname); + audit_log_key(ab, rule->filterkey); + audit_log_format(ab, " list=%d res=1", rule->listnr); + audit_log_end(ab); rule->tree = NULL; list_del_rcu(&entry->list); list_del(&entry->rule.list); diff --git a/trunk/kernel/audit_watch.c b/trunk/kernel/audit_watch.c index 22831c4d369c..4a599f699adc 100644 --- a/trunk/kernel/audit_watch.c +++ b/trunk/kernel/audit_watch.c @@ -240,8 +240,6 @@ static void audit_watch_log_rule_change(struct audit_krule *r, struct audit_watc if (audit_enabled) { struct audit_buffer *ab; ab = audit_log_start(NULL, GFP_NOFS, AUDIT_CONFIG_CHANGE); - if (unlikely(!ab)) - return; audit_log_format(ab, "auid=%u ses=%u op=", from_kuid(&init_user_ns, audit_get_loginuid(current)), audit_get_sessionid(current)); diff --git a/trunk/kernel/auditfilter.c b/trunk/kernel/auditfilter.c index f9fc54bbe06f..7f19f23d38a3 100644 --- a/trunk/kernel/auditfilter.c +++ b/trunk/kernel/auditfilter.c @@ -1144,6 +1144,7 @@ static void audit_log_rule_change(kuid_t loginuid, u32 sessionid, u32 sid, * audit_receive_filter - apply all rules to the specified message type * @type: audit message type * @pid: target pid for netlink audit messages + * @uid: target uid for netlink audit messages * @seq: netlink audit message sequence (serial) number * @data: payload data * @datasz: size of payload data diff --git a/trunk/kernel/auditsc.c b/trunk/kernel/auditsc.c index a371f857a0a9..e37e6a12c5e3 100644 --- a/trunk/kernel/auditsc.c +++ b/trunk/kernel/auditsc.c @@ -1464,14 +1464,14 @@ static void show_special(struct audit_context *context, int *call_panic) audit_log_end(ab); ab = audit_log_start(context, GFP_KERNEL, AUDIT_IPC_SET_PERM); - if (unlikely(!ab)) - return; audit_log_format(ab, "qbytes=%lx ouid=%u ogid=%u mode=%#ho", context->ipc.qbytes, context->ipc.perm_uid, context->ipc.perm_gid, context->ipc.perm_mode); + if (!ab) + return; } break; } case AUDIT_MQ_OPEN: { @@ -2675,7 +2675,7 @@ void __audit_mmap_fd(int fd, int flags) context->type = AUDIT_MMAP; } -static void audit_log_task(struct audit_buffer *ab) +static void audit_log_abend(struct audit_buffer *ab, char *reason, long signr) { kuid_t auid, uid; kgid_t gid; @@ -2693,11 +2693,6 @@ static void audit_log_task(struct audit_buffer *ab) audit_log_task_context(ab); audit_log_format(ab, " pid=%d comm=", current->pid); audit_log_untrustedstring(ab, current->comm); -} - -static void audit_log_abend(struct audit_buffer *ab, char *reason, long signr) -{ - audit_log_task(ab); audit_log_format(ab, " reason="); audit_log_string(ab, reason); audit_log_format(ab, " sig=%ld", signr); @@ -2720,8 +2715,6 @@ void audit_core_dumps(long signr) return; ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_ANOM_ABEND); - if (unlikely(!ab)) - return; audit_log_abend(ab, "memory violation", signr); audit_log_end(ab); } @@ -2730,11 +2723,8 @@ void __audit_seccomp(unsigned long syscall, long signr, int code) { struct audit_buffer *ab; - ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_SECCOMP); - if (unlikely(!ab)) - return; - audit_log_task(ab); - audit_log_format(ab, " sig=%ld", signr); + ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_ANOM_ABEND); + audit_log_abend(ab, "seccomp", signr); audit_log_format(ab, " syscall=%ld", syscall); audit_log_format(ab, " compat=%d", is_compat_task()); audit_log_format(ab, " ip=0x%lx", KSTK_EIP(current)); diff --git a/trunk/kernel/compat.c b/trunk/kernel/compat.c index 36700e9e2be9..f6150e92dfc9 100644 --- a/trunk/kernel/compat.c +++ b/trunk/kernel/compat.c @@ -535,11 +535,9 @@ asmlinkage long compat_sys_getrusage(int who, struct compat_rusage __user *ru) return 0; } -COMPAT_SYSCALL_DEFINE4(wait4, - compat_pid_t, pid, - compat_uint_t __user *, stat_addr, - int, options, - struct compat_rusage __user *, ru) +asmlinkage long +compat_sys_wait4(compat_pid_t pid, compat_uint_t __user *stat_addr, int options, + struct compat_rusage __user *ru) { if (!ru) { return sys_wait4(pid, stat_addr, options, NULL); @@ -566,10 +564,9 @@ COMPAT_SYSCALL_DEFINE4(wait4, } } -COMPAT_SYSCALL_DEFINE5(waitid, - int, which, compat_pid_t, pid, - struct compat_siginfo __user *, uinfo, int, options, - struct compat_rusage __user *, uru) +asmlinkage long compat_sys_waitid(int which, compat_pid_t pid, + struct compat_siginfo __user *uinfo, int options, + struct compat_rusage __user *uru) { siginfo_t info; struct rusage ru; @@ -587,11 +584,7 @@ COMPAT_SYSCALL_DEFINE5(waitid, return ret; if (uru) { - /* sys_waitid() overwrites everything in ru */ - if (COMPAT_USE_64BIT_TIME) - ret = copy_to_user(uru, &ru, sizeof(ru)); - else - ret = put_compat_rusage(&ru, uru); + ret = put_compat_rusage(&ru, uru); if (ret) return ret; } @@ -1001,7 +994,7 @@ compat_sys_rt_sigtimedwait (compat_sigset_t __user *uthese, sigset_from_compat(&s, &s32); if (uts) { - if (compat_get_timespec(&t, uts)) + if (get_compat_timespec(&t, uts)) return -EFAULT; } diff --git a/trunk/kernel/debug/kdb/kdb_main.c b/trunk/kernel/debug/kdb/kdb_main.c index 8875254120b6..4d5f8d5612f3 100644 --- a/trunk/kernel/debug/kdb/kdb_main.c +++ b/trunk/kernel/debug/kdb/kdb_main.c @@ -1970,8 +1970,6 @@ static int kdb_lsmod(int argc, const char **argv) kdb_printf("Module Size modstruct Used by\n"); list_for_each_entry(mod, kdb_modules, list) { - if (mod->state == MODULE_STATE_UNFORMED) - continue; kdb_printf("%-20s%8u 0x%p ", mod->name, mod->core_size, (void *)mod); diff --git a/trunk/kernel/fork.c b/trunk/kernel/fork.c index c535f33bbb9c..65ca6d27f24e 100644 --- a/trunk/kernel/fork.c +++ b/trunk/kernel/fork.c @@ -1668,10 +1668,8 @@ SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp, int, tls_val) #endif { - long ret = do_fork(clone_flags, newsp, 0, parent_tidptr, child_tidptr); - asmlinkage_protect(5, ret, clone_flags, newsp, - parent_tidptr, child_tidptr, tls_val); - return ret; + return do_fork(clone_flags, newsp, 0, + parent_tidptr, child_tidptr); } #endif diff --git a/trunk/kernel/module.c b/trunk/kernel/module.c index eab08274ec9b..250092c1d57d 100644 --- a/trunk/kernel/module.c +++ b/trunk/kernel/module.c @@ -188,7 +188,6 @@ struct load_info { ongoing or failed initialization etc. */ static inline int strong_try_module_get(struct module *mod) { - BUG_ON(mod && mod->state == MODULE_STATE_UNFORMED); if (mod && mod->state == MODULE_STATE_COMING) return -EBUSY; if (try_module_get(mod)) @@ -344,9 +343,6 @@ bool each_symbol_section(bool (*fn)(const struct symsearch *arr, #endif }; - if (mod->state == MODULE_STATE_UNFORMED) - continue; - if (each_symbol_in_section(arr, ARRAY_SIZE(arr), mod, fn, data)) return true; } @@ -454,24 +450,16 @@ const struct kernel_symbol *find_symbol(const char *name, EXPORT_SYMBOL_GPL(find_symbol); /* Search for module by name: must hold module_mutex. */ -static struct module *find_module_all(const char *name, - bool even_unformed) +struct module *find_module(const char *name) { struct module *mod; list_for_each_entry(mod, &modules, list) { - if (!even_unformed && mod->state == MODULE_STATE_UNFORMED) - continue; if (strcmp(mod->name, name) == 0) return mod; } return NULL; } - -struct module *find_module(const char *name) -{ - return find_module_all(name, false); -} EXPORT_SYMBOL_GPL(find_module); #ifdef CONFIG_SMP @@ -537,8 +525,6 @@ bool is_module_percpu_address(unsigned long addr) preempt_disable(); list_for_each_entry_rcu(mod, &modules, list) { - if (mod->state == MODULE_STATE_UNFORMED) - continue; if (!mod->percpu_size) continue; for_each_possible_cpu(cpu) { @@ -1062,8 +1048,6 @@ static ssize_t show_initstate(struct module_attribute *mattr, case MODULE_STATE_GOING: state = "going"; break; - default: - BUG(); } return sprintf(buffer, "%s\n", state); } @@ -1802,8 +1786,6 @@ void set_all_modules_text_rw(void) mutex_lock(&module_mutex); list_for_each_entry_rcu(mod, &modules, list) { - if (mod->state == MODULE_STATE_UNFORMED) - continue; if ((mod->module_core) && (mod->core_text_size)) { set_page_attributes(mod->module_core, mod->module_core + mod->core_text_size, @@ -1825,8 +1807,6 @@ void set_all_modules_text_ro(void) mutex_lock(&module_mutex); list_for_each_entry_rcu(mod, &modules, list) { - if (mod->state == MODULE_STATE_UNFORMED) - continue; if ((mod->module_core) && (mod->core_text_size)) { set_page_attributes(mod->module_core, mod->module_core + mod->core_text_size, @@ -2547,13 +2527,6 @@ static int copy_module_from_fd(int fd, struct load_info *info) err = -EFBIG; goto out; } - - /* Don't hand 0 to vmalloc, it whines. */ - if (stat.size == 0) { - err = -EINVAL; - goto out; - } - info->hdr = vmalloc(stat.size); if (!info->hdr) { err = -ENOMEM; @@ -3017,9 +2990,8 @@ static bool finished_loading(const char *name) bool ret; mutex_lock(&module_mutex); - mod = find_module_all(name, true); - ret = !mod || mod->state == MODULE_STATE_LIVE - || mod->state == MODULE_STATE_GOING; + mod = find_module(name); + ret = !mod || mod->state != MODULE_STATE_COMING; mutex_unlock(&module_mutex); return ret; @@ -3041,12 +3013,6 @@ static int do_init_module(struct module *mod) { int ret = 0; - /* - * We want to find out whether @mod uses async during init. Clear - * PF_USED_ASYNC. async_schedule*() will set it. - */ - current->flags &= ~PF_USED_ASYNC; - blocking_notifier_call_chain(&module_notify_list, MODULE_STATE_COMING, mod); @@ -3092,25 +3058,8 @@ static int do_init_module(struct module *mod) blocking_notifier_call_chain(&module_notify_list, MODULE_STATE_LIVE, mod); - /* - * We need to finish all async code before the module init sequence - * is done. This has potential to deadlock. For example, a newly - * detected block device can trigger request_module() of the - * default iosched from async probing task. Once userland helper - * reaches here, async_synchronize_full() will wait on the async - * task waiting on request_module() and deadlock. - * - * This deadlock is avoided by perfomring async_synchronize_full() - * iff module init queued any async jobs. This isn't a full - * solution as it will deadlock the same if module loading from - * async jobs nests more than once; however, due to the various - * constraints, this hack seems to be the best option for now. - * Please refer to the following thread for details. - * - * http://thread.gmane.org/gmane.linux.kernel/1420814 - */ - if (current->flags & PF_USED_ASYNC) - async_synchronize_full(); + /* We need to finish all async code before the module init sequence is done */ + async_synchronize_full(); mutex_lock(&module_mutex); /* Drop initial reference. */ @@ -3164,32 +3113,6 @@ static int load_module(struct load_info *info, const char __user *uargs, goto free_copy; } - /* - * We try to place it in the list now to make sure it's unique - * before we dedicate too many resources. In particular, - * temporary percpu memory exhaustion. - */ - mod->state = MODULE_STATE_UNFORMED; -again: - mutex_lock(&module_mutex); - if ((old = find_module_all(mod->name, true)) != NULL) { - if (old->state == MODULE_STATE_COMING - || old->state == MODULE_STATE_UNFORMED) { - /* Wait in case it fails to load. */ - mutex_unlock(&module_mutex); - err = wait_event_interruptible(module_wq, - finished_loading(mod->name)); - if (err) - goto free_module; - goto again; - } - err = -EEXIST; - mutex_unlock(&module_mutex); - goto free_module; - } - list_add_rcu(&mod->list, &modules); - mutex_unlock(&module_mutex); - #ifdef CONFIG_MODULE_SIG mod->sig_ok = info->sig_ok; if (!mod->sig_ok) @@ -3199,7 +3122,7 @@ static int load_module(struct load_info *info, const char __user *uargs, /* Now module is in final location, initialize linked lists, etc. */ err = module_unload_init(mod); if (err) - goto unlink_mod; + goto free_module; /* Now we've got everything in the final locations, we can * find optional sections. */ @@ -3234,33 +3157,54 @@ static int load_module(struct load_info *info, const char __user *uargs, goto free_arch_cleanup; } - dynamic_debug_setup(info->debug, info->num_debug); + /* Mark state as coming so strong_try_module_get() ignores us. */ + mod->state = MODULE_STATE_COMING; + /* Now sew it into the lists so we can get lockdep and oops + * info during argument parsing. No one should access us, since + * strong_try_module_get() will fail. + * lockdep/oops can run asynchronous, so use the RCU list insertion + * function to insert in a way safe to concurrent readers. + * The mutex protects against concurrent writers. + */ +again: mutex_lock(&module_mutex); - /* Find duplicate symbols (must be called under lock). */ + if ((old = find_module(mod->name)) != NULL) { + if (old->state == MODULE_STATE_COMING) { + /* Wait in case it fails to load. */ + mutex_unlock(&module_mutex); + err = wait_event_interruptible(module_wq, + finished_loading(mod->name)); + if (err) + goto free_arch_cleanup; + goto again; + } + err = -EEXIST; + goto unlock; + } + + /* This has to be done once we're sure module name is unique. */ + dynamic_debug_setup(info->debug, info->num_debug); + + /* Find duplicate symbols */ err = verify_export_symbols(mod); if (err < 0) - goto ddebug_cleanup; + goto ddebug; - /* This relies on module_mutex for list integrity. */ module_bug_finalize(info->hdr, info->sechdrs, mod); - - /* Mark state as coming so strong_try_module_get() ignores us, - * but kallsyms etc. can see us. */ - mod->state = MODULE_STATE_COMING; - + list_add_rcu(&mod->list, &modules); mutex_unlock(&module_mutex); /* Module is ready to execute: parsing args may do that. */ err = parse_args(mod->name, mod->args, mod->kp, mod->num_kp, -32768, 32767, &ddebug_dyndbg_module_param_cb); if (err < 0) - goto bug_cleanup; + goto unlink; /* Link in to syfs. */ err = mod_sysfs_setup(mod, info, mod->kp, mod->num_kp); if (err < 0) - goto bug_cleanup; + goto unlink; /* Get rid of temporary copy. */ free_copy(info); @@ -3270,13 +3214,16 @@ static int load_module(struct load_info *info, const char __user *uargs, return do_init_module(mod); - bug_cleanup: - /* module_bug_cleanup needs module_mutex protection */ + unlink: mutex_lock(&module_mutex); + /* Unlink carefully: kallsyms could be walking list. */ + list_del_rcu(&mod->list); module_bug_cleanup(mod); - ddebug_cleanup: - mutex_unlock(&module_mutex); + wake_up_all(&module_wq); + ddebug: dynamic_debug_remove(info->debug); + unlock: + mutex_unlock(&module_mutex); synchronize_sched(); kfree(mod->args); free_arch_cleanup: @@ -3285,12 +3232,6 @@ static int load_module(struct load_info *info, const char __user *uargs, free_modinfo(mod); free_unload: module_unload_free(mod); - unlink_mod: - mutex_lock(&module_mutex); - /* Unlink carefully: kallsyms could be walking list. */ - list_del_rcu(&mod->list); - wake_up_all(&module_wq); - mutex_unlock(&module_mutex); free_module: module_deallocate(mod, info); free_copy: @@ -3413,8 +3354,6 @@ const char *module_address_lookup(unsigned long addr, preempt_disable(); list_for_each_entry_rcu(mod, &modules, list) { - if (mod->state == MODULE_STATE_UNFORMED) - continue; if (within_module_init(addr, mod) || within_module_core(addr, mod)) { if (modname) @@ -3438,8 +3377,6 @@ int lookup_module_symbol_name(unsigned long addr, char *symname) preempt_disable(); list_for_each_entry_rcu(mod, &modules, list) { - if (mod->state == MODULE_STATE_UNFORMED) - continue; if (within_module_init(addr, mod) || within_module_core(addr, mod)) { const char *sym; @@ -3464,8 +3401,6 @@ int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size, preempt_disable(); list_for_each_entry_rcu(mod, &modules, list) { - if (mod->state == MODULE_STATE_UNFORMED) - continue; if (within_module_init(addr, mod) || within_module_core(addr, mod)) { const char *sym; @@ -3493,8 +3428,6 @@ int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type, preempt_disable(); list_for_each_entry_rcu(mod, &modules, list) { - if (mod->state == MODULE_STATE_UNFORMED) - continue; if (symnum < mod->num_symtab) { *value = mod->symtab[symnum].st_value; *type = mod->symtab[symnum].st_info; @@ -3537,12 +3470,9 @@ unsigned long module_kallsyms_lookup_name(const char *name) ret = mod_find_symname(mod, colon+1); *colon = ':'; } else { - list_for_each_entry_rcu(mod, &modules, list) { - if (mod->state == MODULE_STATE_UNFORMED) - continue; + list_for_each_entry_rcu(mod, &modules, list) if ((ret = mod_find_symname(mod, name)) != 0) break; - } } preempt_enable(); return ret; @@ -3557,8 +3487,6 @@ int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, int ret; list_for_each_entry(mod, &modules, list) { - if (mod->state == MODULE_STATE_UNFORMED) - continue; for (i = 0; i < mod->num_symtab; i++) { ret = fn(data, mod->strtab + mod->symtab[i].st_name, mod, mod->symtab[i].st_value); @@ -3574,7 +3502,6 @@ static char *module_flags(struct module *mod, char *buf) { int bx = 0; - BUG_ON(mod->state == MODULE_STATE_UNFORMED); if (mod->taints || mod->state == MODULE_STATE_GOING || mod->state == MODULE_STATE_COMING) { @@ -3616,10 +3543,6 @@ static int m_show(struct seq_file *m, void *p) struct module *mod = list_entry(p, struct module, list); char buf[8]; - /* We always ignore unformed modules. */ - if (mod->state == MODULE_STATE_UNFORMED) - return 0; - seq_printf(m, "%s %u", mod->name, mod->init_size + mod->core_size); print_unload_info(m, mod); @@ -3680,8 +3603,6 @@ const struct exception_table_entry *search_module_extables(unsigned long addr) preempt_disable(); list_for_each_entry_rcu(mod, &modules, list) { - if (mod->state == MODULE_STATE_UNFORMED) - continue; if (mod->num_exentries == 0) continue; @@ -3730,13 +3651,10 @@ struct module *__module_address(unsigned long addr) if (addr < module_addr_min || addr > module_addr_max) return NULL; - list_for_each_entry_rcu(mod, &modules, list) { - if (mod->state == MODULE_STATE_UNFORMED) - continue; + list_for_each_entry_rcu(mod, &modules, list) if (within_module_core(addr, mod) || within_module_init(addr, mod)) return mod; - } return NULL; } EXPORT_SYMBOL_GPL(__module_address); @@ -3789,11 +3707,8 @@ void print_modules(void) printk(KERN_DEFAULT "Modules linked in:"); /* Most callers should already have preempt disabled, but make sure */ preempt_disable(); - list_for_each_entry_rcu(mod, &modules, list) { - if (mod->state == MODULE_STATE_UNFORMED) - continue; + list_for_each_entry_rcu(mod, &modules, list) printk(" %s%s", mod->name, module_flags(mod, buf)); - } preempt_enable(); if (last_unloaded_module[0]) printk(" [last unloaded: %s]", last_unloaded_module); diff --git a/trunk/kernel/printk.c b/trunk/kernel/printk.c index 357f714ddd49..19c0d7bcf24a 100644 --- a/trunk/kernel/printk.c +++ b/trunk/kernel/printk.c @@ -870,11 +870,10 @@ static size_t print_time(u64 ts, char *buf) if (!printk_time) return 0; - rem_nsec = do_div(ts, 1000000000); - if (!buf) - return snprintf(NULL, 0, "[%5lu.000000] ", (unsigned long)ts); + return 15; + rem_nsec = do_div(ts, 1000000000); return sprintf(buf, "[%5lu.%06lu] ", (unsigned long)ts, rem_nsec / 1000); } diff --git a/trunk/kernel/ptrace.c b/trunk/kernel/ptrace.c index 6cbeaae4406d..1599157336a6 100644 --- a/trunk/kernel/ptrace.c +++ b/trunk/kernel/ptrace.c @@ -117,45 +117,11 @@ void __ptrace_unlink(struct task_struct *child) * TASK_KILLABLE sleeps. */ if (child->jobctl & JOBCTL_STOP_PENDING || task_is_traced(child)) - ptrace_signal_wake_up(child, true); + signal_wake_up(child, task_is_traced(child)); spin_unlock(&child->sighand->siglock); } -/* Ensure that nothing can wake it up, even SIGKILL */ -static bool ptrace_freeze_traced(struct task_struct *task) -{ - bool ret = false; - - /* Lockless, nobody but us can set this flag */ - if (task->jobctl & JOBCTL_LISTENING) - return ret; - - spin_lock_irq(&task->sighand->siglock); - if (task_is_traced(task) && !__fatal_signal_pending(task)) { - task->state = __TASK_TRACED; - ret = true; - } - spin_unlock_irq(&task->sighand->siglock); - - return ret; -} - -static void ptrace_unfreeze_traced(struct task_struct *task) -{ - if (task->state != __TASK_TRACED) - return; - - WARN_ON(!task->ptrace || task->parent != current); - - spin_lock_irq(&task->sighand->siglock); - if (__fatal_signal_pending(task)) - wake_up_state(task, __TASK_TRACED); - else - task->state = TASK_TRACED; - spin_unlock_irq(&task->sighand->siglock); -} - /** * ptrace_check_attach - check whether ptracee is ready for ptrace operation * @child: ptracee to check for @@ -173,7 +139,7 @@ static void ptrace_unfreeze_traced(struct task_struct *task) * RETURNS: * 0 on success, -ESRCH if %child is not ready. */ -static int ptrace_check_attach(struct task_struct *child, bool ignore_state) +int ptrace_check_attach(struct task_struct *child, bool ignore_state) { int ret = -ESRCH; @@ -185,29 +151,24 @@ static int ptrace_check_attach(struct task_struct *child, bool ignore_state) * be changed by us so it's not changing right after this. */ read_lock(&tasklist_lock); - if (child->ptrace && child->parent == current) { - WARN_ON(child->state == __TASK_TRACED); + if ((child->ptrace & PT_PTRACED) && child->parent == current) { /* * child->sighand can't be NULL, release_task() * does ptrace_unlink() before __exit_signal(). */ - if (ignore_state || ptrace_freeze_traced(child)) + spin_lock_irq(&child->sighand->siglock); + WARN_ON_ONCE(task_is_stopped(child)); + if (ignore_state || (task_is_traced(child) && + !(child->jobctl & JOBCTL_LISTENING))) ret = 0; + spin_unlock_irq(&child->sighand->siglock); } read_unlock(&tasklist_lock); - if (!ret && !ignore_state) { - if (!wait_task_inactive(child, __TASK_TRACED)) { - /* - * This can only happen if may_ptrace_stop() fails and - * ptrace_stop() changes ->state back to TASK_RUNNING, - * so we should not worry about leaking __TASK_TRACED. - */ - WARN_ON(child->state == __TASK_TRACED); - ret = -ESRCH; - } - } + if (!ret && !ignore_state) + ret = wait_task_inactive(child, TASK_TRACED) ? 0 : -ESRCH; + /* All systems go.. */ return ret; } @@ -356,7 +317,7 @@ static int ptrace_attach(struct task_struct *task, long request, */ if (task_is_stopped(task) && task_set_jobctl_pending(task, JOBCTL_TRAP_STOP | JOBCTL_TRAPPING)) - signal_wake_up_state(task, __TASK_STOPPED); + signal_wake_up(task, 1); spin_unlock(&task->sighand->siglock); @@ -776,7 +737,7 @@ int ptrace_request(struct task_struct *child, long request, * tracee into STOP. */ if (likely(task_set_jobctl_pending(child, JOBCTL_TRAP_STOP))) - ptrace_signal_wake_up(child, child->jobctl & JOBCTL_LISTENING); + signal_wake_up(child, child->jobctl & JOBCTL_LISTENING); unlock_task_sighand(child, &flags); ret = 0; @@ -802,7 +763,7 @@ int ptrace_request(struct task_struct *child, long request, * start of this trap and now. Trigger re-trap. */ if (child->jobctl & JOBCTL_TRAP_NOTIFY) - ptrace_signal_wake_up(child, true); + signal_wake_up(child, true); ret = 0; } unlock_task_sighand(child, &flags); @@ -939,8 +900,6 @@ SYSCALL_DEFINE4(ptrace, long, request, long, pid, unsigned long, addr, goto out_put_task_struct; ret = arch_ptrace(child, request, addr, data); - if (ret || request != PTRACE_DETACH) - ptrace_unfreeze_traced(child); out_put_task_struct: put_task_struct(child); @@ -1080,11 +1039,8 @@ asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid, ret = ptrace_check_attach(child, request == PTRACE_KILL || request == PTRACE_INTERRUPT); - if (!ret) { + if (!ret) ret = compat_arch_ptrace(child, request, addr, data); - if (ret || request != PTRACE_DETACH) - ptrace_unfreeze_traced(child); - } out_put_task_struct: put_task_struct(child); diff --git a/trunk/kernel/rwsem.c b/trunk/kernel/rwsem.c index b3c6c3fcd847..6850f53e02d8 100644 --- a/trunk/kernel/rwsem.c +++ b/trunk/kernel/rwsem.c @@ -116,16 +116,6 @@ void down_read_nested(struct rw_semaphore *sem, int subclass) EXPORT_SYMBOL(down_read_nested); -void _down_write_nest_lock(struct rw_semaphore *sem, struct lockdep_map *nest) -{ - might_sleep(); - rwsem_acquire_nest(&sem->dep_map, 0, 0, nest, _RET_IP_); - - LOCK_CONTENDED(sem, __down_write_trylock, __down_write); -} - -EXPORT_SYMBOL(_down_write_nest_lock); - void down_write_nested(struct rw_semaphore *sem, int subclass) { might_sleep(); diff --git a/trunk/kernel/sched/core.c b/trunk/kernel/sched/core.c index 26058d0bebba..257002c13bb0 100644 --- a/trunk/kernel/sched/core.c +++ b/trunk/kernel/sched/core.c @@ -1523,8 +1523,7 @@ static void try_to_wake_up_local(struct task_struct *p) */ int wake_up_process(struct task_struct *p) { - WARN_ON(task_is_stopped_or_traced(p)); - return try_to_wake_up(p, TASK_NORMAL, 0); + return try_to_wake_up(p, TASK_ALL, 0); } EXPORT_SYMBOL(wake_up_process); diff --git a/trunk/kernel/signal.c b/trunk/kernel/signal.c index 3d09cf6cde75..7aaa51d8e5b8 100644 --- a/trunk/kernel/signal.c +++ b/trunk/kernel/signal.c @@ -680,17 +680,23 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info) * No need to set need_resched since signal event passing * goes through ->blocked */ -void signal_wake_up_state(struct task_struct *t, unsigned int state) +void signal_wake_up(struct task_struct *t, int resume) { + unsigned int mask; + set_tsk_thread_flag(t, TIF_SIGPENDING); + /* - * TASK_WAKEKILL also means wake it up in the stopped/traced/killable + * For SIGKILL, we want to wake it up in the stopped/traced/killable * case. We don't check t->state here because there is a race with it * executing another processor and just now entering stopped state. * By using wake_up_state, we ensure the process will wake up and * handle its death signal. */ - if (!wake_up_state(t, state | TASK_INTERRUPTIBLE)) + mask = TASK_INTERRUPTIBLE; + if (resume) + mask |= TASK_WAKEKILL; + if (!wake_up_state(t, mask)) kick_process(t); } @@ -838,7 +844,7 @@ static void ptrace_trap_notify(struct task_struct *t) assert_spin_locked(&t->sighand->siglock); task_set_jobctl_pending(t, JOBCTL_TRAP_NOTIFY); - ptrace_signal_wake_up(t, t->jobctl & JOBCTL_LISTENING); + signal_wake_up(t, t->jobctl & JOBCTL_LISTENING); } /* @@ -1794,10 +1800,6 @@ static inline int may_ptrace_stop(void) * If SIGKILL was already sent before the caller unlocked * ->siglock we must see ->core_state != NULL. Otherwise it * is safe to enter schedule(). - * - * This is almost outdated, a task with the pending SIGKILL can't - * block in TASK_TRACED. But PTRACE_EVENT_EXIT can be reported - * after SIGKILL was already dequeued. */ if (unlikely(current->mm->core_state) && unlikely(current->mm == current->parent->mm)) @@ -1923,7 +1925,6 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info) if (gstop_done) do_notify_parent_cldstop(current, false, why); - /* tasklist protects us from ptrace_freeze_traced() */ __set_current_state(TASK_RUNNING); if (clear_code) current->exit_code = 0; @@ -2527,8 +2528,11 @@ static void __set_task_blocked(struct task_struct *tsk, const sigset_t *newset) */ void set_current_blocked(sigset_t *newset) { + struct task_struct *tsk = current; sigdelsetmask(newset, sigmask(SIGKILL) | sigmask(SIGSTOP)); - __set_current_blocked(newset); + spin_lock_irq(&tsk->sighand->siglock); + __set_task_blocked(tsk, newset); + spin_unlock_irq(&tsk->sighand->siglock); } void __set_current_blocked(const sigset_t *newset) @@ -3115,9 +3119,8 @@ int __save_altstack(stack_t __user *uss, unsigned long sp) #ifdef CONFIG_COMPAT #ifdef CONFIG_GENERIC_SIGALTSTACK -COMPAT_SYSCALL_DEFINE2(sigaltstack, - const compat_stack_t __user *, uss_ptr, - compat_stack_t __user *, uoss_ptr) +asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr, + compat_stack_t __user *uoss_ptr) { stack_t uss, uoss; int ret; @@ -3201,6 +3204,7 @@ SYSCALL_DEFINE3(sigprocmask, int, how, old_sigset_t __user *, nset, if (nset) { if (copy_from_user(&new_set, nset, sizeof(*nset))) return -EFAULT; + new_set &= ~(sigmask(SIGKILL) | sigmask(SIGSTOP)); new_blocked = current->blocked; @@ -3218,7 +3222,7 @@ SYSCALL_DEFINE3(sigprocmask, int, how, old_sigset_t __user *, nset, return -EINVAL; } - set_current_blocked(&new_blocked); + __set_current_blocked(&new_blocked); } if (oset) { @@ -3282,7 +3286,6 @@ SYSCALL_DEFINE1(ssetmask, int, newmask) int old = current->blocked.sig[0]; sigset_t newset; - siginitset(&newset, newmask); set_current_blocked(&newset); return old; diff --git a/trunk/kernel/trace/ftrace.c b/trunk/kernel/trace/ftrace.c index 41473b4ad7a4..3ffe4c5ad3f3 100644 --- a/trunk/kernel/trace/ftrace.c +++ b/trunk/kernel/trace/ftrace.c @@ -3998,7 +3998,7 @@ static int ftrace_module_notify(struct notifier_block *self, struct notifier_block ftrace_module_nb = { .notifier_call = ftrace_module_notify, - .priority = INT_MAX, /* Run before anything that can use kprobes */ + .priority = 0, }; extern unsigned long __start_mcount_loc[]; diff --git a/trunk/kernel/trace/trace.c b/trunk/kernel/trace/trace.c index 3c13e46d7d24..e5125677efa0 100644 --- a/trunk/kernel/trace/trace.c +++ b/trunk/kernel/trace/trace.c @@ -2899,8 +2899,6 @@ tracing_trace_options_write(struct file *filp, const char __user *ubuf, if (copy_from_user(&buf, ubuf, cnt)) return -EFAULT; - buf[cnt] = 0; - trace_set_options(buf); *ppos += cnt; @@ -3454,7 +3452,7 @@ static int tracing_wait_pipe(struct file *filp) return -EINTR; /* - * We block until we read something and tracing is disabled. + * We block until we read something and tracing is enabled. * We still block if tracing is disabled, but we have never * read anything. This allows a user to cat this file, and * then enable tracing. But after we have read something, @@ -3462,7 +3460,7 @@ static int tracing_wait_pipe(struct file *filp) * * iter->pos will be 0 if we haven't read anything. */ - if (!tracing_is_enabled() && iter->pos) + if (tracing_is_enabled() && iter->pos) break; } @@ -4817,17 +4815,10 @@ rb_simple_write(struct file *filp, const char __user *ubuf, return ret; if (buffer) { - mutex_lock(&trace_types_lock); - if (val) { + if (val) ring_buffer_record_on(buffer); - if (current_trace->start) - current_trace->start(tr); - } else { + else ring_buffer_record_off(buffer); - if (current_trace->stop) - current_trace->stop(tr); - } - mutex_unlock(&trace_types_lock); } (*ppos)++; diff --git a/trunk/lib/bug.c b/trunk/lib/bug.c index d0cdf14c651a..a28c1415357c 100644 --- a/trunk/lib/bug.c +++ b/trunk/lib/bug.c @@ -55,7 +55,6 @@ static inline unsigned long bug_addr(const struct bug_entry *bug) } #ifdef CONFIG_MODULES -/* Updates are protected by module mutex */ static LIST_HEAD(module_bug_list); static const struct bug_entry *module_find_bug(unsigned long bugaddr) diff --git a/trunk/lib/cpu_rmap.c b/trunk/lib/cpu_rmap.c index 5fbed5caba6e..145dec5267c9 100644 --- a/trunk/lib/cpu_rmap.c +++ b/trunk/lib/cpu_rmap.c @@ -45,7 +45,6 @@ struct cpu_rmap *alloc_cpu_rmap(unsigned int size, gfp_t flags) if (!rmap) return NULL; - kref_init(&rmap->refcount); rmap->obj = (void **)((char *)rmap + obj_offset); /* Initially assign CPUs to objects on a rota, since we have @@ -64,35 +63,6 @@ struct cpu_rmap *alloc_cpu_rmap(unsigned int size, gfp_t flags) } EXPORT_SYMBOL(alloc_cpu_rmap); -/** - * cpu_rmap_release - internal reclaiming helper called from kref_put - * @ref: kref to struct cpu_rmap - */ -static void cpu_rmap_release(struct kref *ref) -{ - struct cpu_rmap *rmap = container_of(ref, struct cpu_rmap, refcount); - kfree(rmap); -} - -/** - * cpu_rmap_get - internal helper to get new ref on a cpu_rmap - * @rmap: reverse-map allocated with alloc_cpu_rmap() - */ -static inline void cpu_rmap_get(struct cpu_rmap *rmap) -{ - kref_get(&rmap->refcount); -} - -/** - * cpu_rmap_put - release ref on a cpu_rmap - * @rmap: reverse-map allocated with alloc_cpu_rmap() - */ -int cpu_rmap_put(struct cpu_rmap *rmap) -{ - return kref_put(&rmap->refcount, cpu_rmap_release); -} -EXPORT_SYMBOL(cpu_rmap_put); - /* Reevaluate nearest object for given CPU, comparing with the given * neighbours at the given distance. */ @@ -227,7 +197,8 @@ struct irq_glue { * free_irq_cpu_rmap - free a CPU affinity reverse-map used for IRQs * @rmap: Reverse-map allocated with alloc_irq_cpu_map(), or %NULL * - * Must be called in process context, before freeing the IRQs. + * Must be called in process context, before freeing the IRQs, and + * without holding any locks required by global workqueue items. */ void free_irq_cpu_rmap(struct cpu_rmap *rmap) { @@ -241,18 +212,12 @@ void free_irq_cpu_rmap(struct cpu_rmap *rmap) glue = rmap->obj[index]; irq_set_affinity_notifier(glue->notify.irq, NULL); } + irq_run_affinity_notifiers(); - cpu_rmap_put(rmap); + kfree(rmap); } EXPORT_SYMBOL(free_irq_cpu_rmap); -/** - * irq_cpu_rmap_notify - callback for IRQ subsystem when IRQ affinity updated - * @notify: struct irq_affinity_notify passed by irq/manage.c - * @mask: cpu mask for new SMP affinity - * - * This is executed in workqueue context. - */ static void irq_cpu_rmap_notify(struct irq_affinity_notify *notify, const cpumask_t *mask) { @@ -265,16 +230,10 @@ irq_cpu_rmap_notify(struct irq_affinity_notify *notify, const cpumask_t *mask) pr_warning("irq_cpu_rmap_notify: update failed: %d\n", rc); } -/** - * irq_cpu_rmap_release - reclaiming callback for IRQ subsystem - * @ref: kref to struct irq_affinity_notify passed by irq/manage.c - */ static void irq_cpu_rmap_release(struct kref *ref) { struct irq_glue *glue = container_of(ref, struct irq_glue, notify.kref); - - cpu_rmap_put(glue->rmap); kfree(glue); } @@ -299,13 +258,10 @@ int irq_cpu_rmap_add(struct cpu_rmap *rmap, int irq) glue->notify.notify = irq_cpu_rmap_notify; glue->notify.release = irq_cpu_rmap_release; glue->rmap = rmap; - cpu_rmap_get(rmap); glue->index = cpu_rmap_add(rmap, glue); rc = irq_set_affinity_notifier(irq, &glue->notify); - if (rc) { - cpu_rmap_put(glue->rmap); + if (rc) kfree(glue); - } return rc; } EXPORT_SYMBOL(irq_cpu_rmap_add); diff --git a/trunk/lib/rbtree.c b/trunk/lib/rbtree.c index c0e31fe2fabf..4f56a11d67fa 100644 --- a/trunk/lib/rbtree.c +++ b/trunk/lib/rbtree.c @@ -194,12 +194,8 @@ __rb_insert(struct rb_node *node, struct rb_root *root, } } -/* - * Inline version for rb_erase() use - we want to be able to inline - * and eliminate the dummy_rotate callback there - */ -static __always_inline void -____rb_erase_color(struct rb_node *parent, struct rb_root *root, +__always_inline void +__rb_erase_color(struct rb_node *parent, struct rb_root *root, void (*augment_rotate)(struct rb_node *old, struct rb_node *new)) { struct rb_node *node = NULL, *sibling, *tmp1, *tmp2; @@ -359,13 +355,6 @@ ____rb_erase_color(struct rb_node *parent, struct rb_root *root, } } } - -/* Non-inline version for rb_erase_augmented() use */ -void __rb_erase_color(struct rb_node *parent, struct rb_root *root, - void (*augment_rotate)(struct rb_node *old, struct rb_node *new)) -{ - ____rb_erase_color(parent, root, augment_rotate); -} EXPORT_SYMBOL(__rb_erase_color); /* @@ -391,10 +380,7 @@ EXPORT_SYMBOL(rb_insert_color); void rb_erase(struct rb_node *node, struct rb_root *root) { - struct rb_node *rebalance; - rebalance = __rb_erase_augmented(node, root, &dummy_callbacks); - if (rebalance) - ____rb_erase_color(rebalance, root, dummy_rotate); + rb_erase_augmented(node, root, &dummy_callbacks); } EXPORT_SYMBOL(rb_erase); diff --git a/trunk/mm/bootmem.c b/trunk/mm/bootmem.c index b93376c39b61..1324cd74faec 100644 --- a/trunk/mm/bootmem.c +++ b/trunk/mm/bootmem.c @@ -185,23 +185,10 @@ static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata) while (start < end) { unsigned long *map, idx, vec; - unsigned shift; map = bdata->node_bootmem_map; idx = start - bdata->node_min_pfn; - shift = idx & (BITS_PER_LONG - 1); - /* - * vec holds at most BITS_PER_LONG map bits, - * bit 0 corresponds to start. - */ vec = ~map[idx / BITS_PER_LONG]; - - if (shift) { - vec >>= shift; - if (end - start >= BITS_PER_LONG) - vec |= ~map[idx / BITS_PER_LONG + 1] << - (BITS_PER_LONG - shift); - } /* * If we have a properly aligned and fully unreserved * BITS_PER_LONG block of pages in front of us, free @@ -214,18 +201,19 @@ static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata) count += BITS_PER_LONG; start += BITS_PER_LONG; } else { - unsigned long cur = start; + unsigned long off = 0; - start = ALIGN(start + 1, BITS_PER_LONG); - while (vec && cur != start) { + vec >>= start & (BITS_PER_LONG - 1); + while (vec) { if (vec & 1) { - page = pfn_to_page(cur); + page = pfn_to_page(start + off); __free_pages_bootmem(page, 0); count++; } vec >>= 1; - ++cur; + off++; } + start = ALIGN(start + 1, BITS_PER_LONG); } } diff --git a/trunk/mm/compaction.c b/trunk/mm/compaction.c index c62bd063d766..6b807e466497 100644 --- a/trunk/mm/compaction.c +++ b/trunk/mm/compaction.c @@ -816,7 +816,6 @@ static isolate_migrate_t isolate_migratepages(struct zone *zone, static int compact_finished(struct zone *zone, struct compact_control *cc) { - unsigned int order; unsigned long watermark; if (fatal_signal_pending(current)) @@ -851,16 +850,22 @@ static int compact_finished(struct zone *zone, return COMPACT_CONTINUE; /* Direct compactor: Is a suitable page free? */ - for (order = cc->order; order < MAX_ORDER; order++) { - struct free_area *area = &zone->free_area[order]; - - /* Job done if page is free of the right migratetype */ - if (!list_empty(&area->free_list[cc->migratetype])) - return COMPACT_PARTIAL; - - /* Job done if allocation would set block type */ - if (cc->order >= pageblock_order && area->nr_free) + if (cc->page) { + /* Was a suitable page captured? */ + if (*cc->page) return COMPACT_PARTIAL; + } else { + unsigned int order; + for (order = cc->order; order < MAX_ORDER; order++) { + struct free_area *area = &zone->free_area[cc->order]; + /* Job done if page is free of the right migratetype */ + if (!list_empty(&area->free_list[cc->migratetype])) + return COMPACT_PARTIAL; + + /* Job done if allocation would set block type */ + if (cc->order >= pageblock_order && area->nr_free) + return COMPACT_PARTIAL; + } } return COMPACT_CONTINUE; @@ -916,6 +921,60 @@ unsigned long compaction_suitable(struct zone *zone, int order) return COMPACT_CONTINUE; } +static void compact_capture_page(struct compact_control *cc) +{ + unsigned long flags; + int mtype, mtype_low, mtype_high; + + if (!cc->page || *cc->page) + return; + + /* + * For MIGRATE_MOVABLE allocations we capture a suitable page ASAP + * regardless of the migratetype of the freelist is is captured from. + * This is fine because the order for a high-order MIGRATE_MOVABLE + * allocation is typically at least a pageblock size and overall + * fragmentation is not impaired. Other allocation types must + * capture pages from their own migratelist because otherwise they + * could pollute other pageblocks like MIGRATE_MOVABLE with + * difficult to move pages and making fragmentation worse overall. + */ + if (cc->migratetype == MIGRATE_MOVABLE) { + mtype_low = 0; + mtype_high = MIGRATE_PCPTYPES; + } else { + mtype_low = cc->migratetype; + mtype_high = cc->migratetype + 1; + } + + /* Speculatively examine the free lists without zone lock */ + for (mtype = mtype_low; mtype < mtype_high; mtype++) { + int order; + for (order = cc->order; order < MAX_ORDER; order++) { + struct page *page; + struct free_area *area; + area = &(cc->zone->free_area[order]); + if (list_empty(&area->free_list[mtype])) + continue; + + /* Take the lock and attempt capture of the page */ + if (!compact_trylock_irqsave(&cc->zone->lock, &flags, cc)) + return; + if (!list_empty(&area->free_list[mtype])) { + page = list_entry(area->free_list[mtype].next, + struct page, lru); + if (capture_free_page(page, cc->order, mtype)) { + spin_unlock_irqrestore(&cc->zone->lock, + flags); + *cc->page = page; + return; + } + } + spin_unlock_irqrestore(&cc->zone->lock, flags); + } + } +} + static int compact_zone(struct zone *zone, struct compact_control *cc) { int ret; @@ -995,6 +1054,9 @@ static int compact_zone(struct zone *zone, struct compact_control *cc) goto out; } } + + /* Capture a page now if it is a suitable size */ + compact_capture_page(cc); } out: @@ -1007,7 +1069,8 @@ static int compact_zone(struct zone *zone, struct compact_control *cc) static unsigned long compact_zone_order(struct zone *zone, int order, gfp_t gfp_mask, - bool sync, bool *contended) + bool sync, bool *contended, + struct page **page) { unsigned long ret; struct compact_control cc = { @@ -1017,6 +1080,7 @@ static unsigned long compact_zone_order(struct zone *zone, .migratetype = allocflags_to_migratetype(gfp_mask), .zone = zone, .sync = sync, + .page = page, }; INIT_LIST_HEAD(&cc.freepages); INIT_LIST_HEAD(&cc.migratepages); @@ -1046,7 +1110,7 @@ int sysctl_extfrag_threshold = 500; */ unsigned long try_to_compact_pages(struct zonelist *zonelist, int order, gfp_t gfp_mask, nodemask_t *nodemask, - bool sync, bool *contended) + bool sync, bool *contended, struct page **page) { enum zone_type high_zoneidx = gfp_zone(gfp_mask); int may_enter_fs = gfp_mask & __GFP_FS; @@ -1072,7 +1136,7 @@ unsigned long try_to_compact_pages(struct zonelist *zonelist, int status; status = compact_zone_order(zone, order, gfp_mask, sync, - contended); + contended, page); rc = max(status, rc); /* If a normal allocation would succeed, stop compacting */ @@ -1128,6 +1192,7 @@ int compact_pgdat(pg_data_t *pgdat, int order) struct compact_control cc = { .order = order, .sync = false, + .page = NULL, }; return __compact_pgdat(pgdat, &cc); @@ -1138,13 +1203,14 @@ static int compact_node(int nid) struct compact_control cc = { .order = -1, .sync = true, + .page = NULL, }; return __compact_pgdat(NODE_DATA(nid), &cc); } /* Compact all nodes in the system */ -static void compact_nodes(void) +static int compact_nodes(void) { int nid; @@ -1153,6 +1219,8 @@ static void compact_nodes(void) for_each_online_node(nid) compact_node(nid); + + return COMPACT_COMPLETE; } /* The written value is actually unused, all memory is compacted */ @@ -1163,7 +1231,7 @@ int sysctl_compaction_handler(struct ctl_table *table, int write, void __user *buffer, size_t *length, loff_t *ppos) { if (write) - compact_nodes(); + return compact_nodes(); return 0; } diff --git a/trunk/mm/huge_memory.c b/trunk/mm/huge_memory.c index 6001ee6347a9..9e894edc7811 100644 --- a/trunk/mm/huge_memory.c +++ b/trunk/mm/huge_memory.c @@ -1819,19 +1819,9 @@ int split_huge_page(struct page *page) BUG_ON(is_huge_zero_pfn(page_to_pfn(page))); BUG_ON(!PageAnon(page)); - - /* - * The caller does not necessarily hold an mmap_sem that would prevent - * the anon_vma disappearing so we first we take a reference to it - * and then lock the anon_vma for write. This is similar to - * page_lock_anon_vma_read except the write lock is taken to serialise - * against parallel split or collapse operations. - */ - anon_vma = page_get_anon_vma(page); + anon_vma = page_lock_anon_vma_read(page); if (!anon_vma) goto out; - anon_vma_lock_write(anon_vma); - ret = 0; if (!PageCompound(page)) goto out_unlock; @@ -1842,8 +1832,7 @@ int split_huge_page(struct page *page) BUG_ON(PageCompound(page)); out_unlock: - anon_vma_unlock(anon_vma); - put_anon_vma(anon_vma); + page_unlock_anon_vma_read(anon_vma); out: return ret; } diff --git a/trunk/mm/internal.h b/trunk/mm/internal.h index 9ba21100ebf3..d597f94cc205 100644 --- a/trunk/mm/internal.h +++ b/trunk/mm/internal.h @@ -135,6 +135,7 @@ struct compact_control { int migratetype; /* MOVABLE, RECLAIMABLE etc */ struct zone *zone; bool contended; /* True if a lock was contended */ + struct page **page; /* Page captured of requested size */ }; unsigned long diff --git a/trunk/mm/memblock.c b/trunk/mm/memblock.c index 88adc8afb610..625905523c2a 100644 --- a/trunk/mm/memblock.c +++ b/trunk/mm/memblock.c @@ -314,8 +314,7 @@ static void __init_memblock memblock_merge_regions(struct memblock_type *type) } this->size += next->size; - /* move forward from next + 1, index of which is i + 2 */ - memmove(next, next + 1, (type->cnt - (i + 2)) * sizeof(*next)); + memmove(next, next + 1, (type->cnt - (i + 1)) * sizeof(*next)); type->cnt--; } } diff --git a/trunk/mm/memory.c b/trunk/mm/memory.c index bb1369f7b9b4..e0a9b0ce4f10 100644 --- a/trunk/mm/memory.c +++ b/trunk/mm/memory.c @@ -184,14 +184,10 @@ static int tlb_next_batch(struct mmu_gather *tlb) return 1; } - if (tlb->batch_count == MAX_GATHER_BATCH_COUNT) - return 0; - batch = (void *)__get_free_pages(GFP_NOWAIT | __GFP_NOWARN, 0); if (!batch) return 0; - tlb->batch_count++; batch->next = NULL; batch->nr = 0; batch->max = MAX_GATHER_BATCH; @@ -220,7 +216,6 @@ void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, bool fullmm) tlb->local.nr = 0; tlb->local.max = ARRAY_SIZE(tlb->__pages); tlb->active = &tlb->local; - tlb->batch_count = 0; #ifdef CONFIG_HAVE_RCU_TABLE_FREE tlb->batch = NULL; @@ -3711,14 +3706,6 @@ int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, if (pmd_trans_huge(orig_pmd)) { unsigned int dirty = flags & FAULT_FLAG_WRITE; - /* - * If the pmd is splitting, return and retry the - * the fault. Alternative: wait until the split - * is done, and goto retry. - */ - if (pmd_trans_splitting(orig_pmd)) - return 0; - if (pmd_numa(orig_pmd)) return do_huge_pmd_numa_page(mm, vma, address, orig_pmd, pmd); diff --git a/trunk/mm/migrate.c b/trunk/mm/migrate.c index c38778610aa8..3b676b0c5c3e 100644 --- a/trunk/mm/migrate.c +++ b/trunk/mm/migrate.c @@ -1679,21 +1679,9 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm, page_xchg_last_nid(new_page, page_last_nid(page)); isolated = numamigrate_isolate_page(pgdat, page); - - /* - * Failing to isolate or a GUP pin prevents migration. The expected - * page count is 2. 1 for anonymous pages without a mapping and 1 - * for the callers pin. If the page was isolated, the page will - * need to be put back on the LRU. - */ - if (!isolated || page_count(page) != 2) { + if (!isolated) { count_vm_events(PGMIGRATE_FAIL, HPAGE_PMD_NR); put_page(new_page); - if (isolated) { - putback_lru_page(page); - isolated = 0; - goto out; - } goto out_keep_locked; } diff --git a/trunk/mm/mmap.c b/trunk/mm/mmap.c index 35730ee9d515..f54b235f29a9 100644 --- a/trunk/mm/mmap.c +++ b/trunk/mm/mmap.c @@ -2886,7 +2886,7 @@ static void vm_lock_anon_vma(struct mm_struct *mm, struct anon_vma *anon_vma) * The LSB of head.next can't change from under us * because we hold the mm_all_locks_mutex. */ - down_write_nest_lock(&anon_vma->root->rwsem, &mm->mmap_sem); + down_write(&anon_vma->root->rwsem); /* * We can safely modify head.next after taking the * anon_vma->root->rwsem. If some other vma in this mm shares diff --git a/trunk/mm/page_alloc.c b/trunk/mm/page_alloc.c index df2022ff0c8a..4ba5e37127fc 100644 --- a/trunk/mm/page_alloc.c +++ b/trunk/mm/page_alloc.c @@ -221,6 +221,11 @@ EXPORT_SYMBOL(nr_online_nodes); int page_group_by_mobility_disabled __read_mostly; +/* + * NOTE: + * Don't use set_pageblock_migratetype(page, MIGRATE_ISOLATE) directly. + * Instead, use {un}set_pageblock_isolate. + */ void set_pageblock_migratetype(struct page *page, int migratetype) { @@ -1384,8 +1389,14 @@ void split_page(struct page *page, unsigned int order) set_page_refcounted(page + i); } -static int __isolate_free_page(struct page *page, unsigned int order) +/* + * Similar to the split_page family of functions except that the page + * required at the given order and being isolated now to prevent races + * with parallel allocators + */ +int capture_free_page(struct page *page, int alloc_order, int migratetype) { + unsigned int order; unsigned long watermark; struct zone *zone; int mt; @@ -1393,6 +1404,7 @@ static int __isolate_free_page(struct page *page, unsigned int order) BUG_ON(!PageBuddy(page)); zone = page_zone(page); + order = page_order(page); mt = get_pageblock_migratetype(page); if (mt != MIGRATE_ISOLATE) { @@ -1401,7 +1413,7 @@ static int __isolate_free_page(struct page *page, unsigned int order) if (!zone_watermark_ok(zone, 0, watermark, 0, 0)) return 0; - __mod_zone_freepage_state(zone, -(1UL << order), mt); + __mod_zone_freepage_state(zone, -(1UL << alloc_order), mt); } /* Remove page from free list */ @@ -1409,7 +1421,11 @@ static int __isolate_free_page(struct page *page, unsigned int order) zone->free_area[order].nr_free--; rmv_page_order(page); - /* Set the pageblock if the isolated page is at least a pageblock */ + if (alloc_order != order) + expand(zone, page, alloc_order, order, + &zone->free_area[order], migratetype); + + /* Set the pageblock if the captured page is at least a pageblock */ if (order >= pageblock_order - 1) { struct page *endpage = page + (1 << order) - 1; for (; page < endpage; page += pageblock_nr_pages) { @@ -1420,7 +1436,7 @@ static int __isolate_free_page(struct page *page, unsigned int order) } } - return 1UL << order; + return 1UL << alloc_order; } /* @@ -1438,9 +1454,10 @@ int split_free_page(struct page *page) unsigned int order; int nr_pages; + BUG_ON(!PageBuddy(page)); order = page_order(page); - nr_pages = __isolate_free_page(page, order); + nr_pages = capture_free_page(page, order, 0); if (!nr_pages) return 0; @@ -1638,6 +1655,20 @@ static bool __zone_watermark_ok(struct zone *z, int order, unsigned long mark, return true; } +#ifdef CONFIG_MEMORY_ISOLATION +static inline unsigned long nr_zone_isolate_freepages(struct zone *zone) +{ + if (unlikely(zone->nr_pageblock_isolate)) + return zone->nr_pageblock_isolate * pageblock_nr_pages; + return 0; +} +#else +static inline unsigned long nr_zone_isolate_freepages(struct zone *zone) +{ + return 0; +} +#endif + bool zone_watermark_ok(struct zone *z, int order, unsigned long mark, int classzone_idx, int alloc_flags) { @@ -1653,6 +1684,14 @@ bool zone_watermark_ok_safe(struct zone *z, int order, unsigned long mark, if (z->percpu_drift_mark && free_pages < z->percpu_drift_mark) free_pages = zone_page_state_snapshot(z, NR_FREE_PAGES); + /* + * If the zone has MIGRATE_ISOLATE type free pages, we should consider + * it. nr_zone_isolate_freepages is never accurate so kswapd might not + * sleep although it could do so. But this is more desirable for memory + * hotplug than sleeping which can cause a livelock in the direct + * reclaim path. + */ + free_pages -= nr_zone_isolate_freepages(z); return __zone_watermark_ok(z, order, mark, classzone_idx, alloc_flags, free_pages); } @@ -2124,6 +2163,8 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, bool *contended_compaction, bool *deferred_compaction, unsigned long *did_some_progress) { + struct page *page = NULL; + if (!order) return NULL; @@ -2135,12 +2176,16 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, current->flags |= PF_MEMALLOC; *did_some_progress = try_to_compact_pages(zonelist, order, gfp_mask, nodemask, sync_migration, - contended_compaction); + contended_compaction, &page); current->flags &= ~PF_MEMALLOC; - if (*did_some_progress != COMPACT_SKIPPED) { - struct page *page; + /* If compaction captured a page, prep and use it */ + if (page) { + prep_new_page(page, order, gfp_mask); + goto got_page; + } + if (*did_some_progress != COMPACT_SKIPPED) { /* Page migration frees to the PCP lists but we want merging */ drain_pages(get_cpu()); put_cpu(); @@ -2150,6 +2195,7 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order, alloc_flags & ~ALLOC_NO_WATERMARKS, preferred_zone, migratetype); if (page) { +got_page: preferred_zone->compact_blockskip_flush = false; preferred_zone->compact_considered = 0; preferred_zone->compact_defer_shift = 0; @@ -5585,7 +5631,7 @@ static inline int pfn_to_bitidx(struct zone *zone, unsigned long pfn) pfn &= (PAGES_PER_SECTION-1); return (pfn >> pageblock_order) * NR_PAGEBLOCK_BITS; #else - pfn = pfn - round_down(zone->zone_start_pfn, pageblock_nr_pages); + pfn = pfn - zone->zone_start_pfn; return (pfn >> pageblock_order) * NR_PAGEBLOCK_BITS; #endif /* CONFIG_SPARSEMEM */ } diff --git a/trunk/mm/page_isolation.c b/trunk/mm/page_isolation.c index 383bdbb98b04..9d2264ea4606 100644 --- a/trunk/mm/page_isolation.c +++ b/trunk/mm/page_isolation.c @@ -8,6 +8,28 @@ #include #include "internal.h" +/* called while holding zone->lock */ +static void set_pageblock_isolate(struct page *page) +{ + if (get_pageblock_migratetype(page) == MIGRATE_ISOLATE) + return; + + set_pageblock_migratetype(page, MIGRATE_ISOLATE); + page_zone(page)->nr_pageblock_isolate++; +} + +/* called while holding zone->lock */ +static void restore_pageblock_isolate(struct page *page, int migratetype) +{ + struct zone *zone = page_zone(page); + if (WARN_ON(get_pageblock_migratetype(page) != MIGRATE_ISOLATE)) + return; + + BUG_ON(zone->nr_pageblock_isolate <= 0); + set_pageblock_migratetype(page, migratetype); + zone->nr_pageblock_isolate--; +} + int set_migratetype_isolate(struct page *page, bool skip_hwpoisoned_pages) { struct zone *zone; @@ -58,7 +80,7 @@ int set_migratetype_isolate(struct page *page, bool skip_hwpoisoned_pages) unsigned long nr_pages; int migratetype = get_pageblock_migratetype(page); - set_pageblock_migratetype(page, MIGRATE_ISOLATE); + set_pageblock_isolate(page); nr_pages = move_freepages_block(zone, page, MIGRATE_ISOLATE); __mod_zone_freepage_state(zone, -nr_pages, migratetype); @@ -81,7 +103,7 @@ void unset_migratetype_isolate(struct page *page, unsigned migratetype) goto out; nr_pages = move_freepages_block(zone, page, migratetype); __mod_zone_freepage_state(zone, nr_pages, migratetype); - set_pageblock_migratetype(page, migratetype); + restore_pageblock_isolate(page, migratetype); out: spin_unlock_irqrestore(&zone->lock, flags); } diff --git a/trunk/net/batman-adv/distributed-arp-table.c b/trunk/net/batman-adv/distributed-arp-table.c index 183f97a86bb2..8e1d89d2b1c1 100644 --- a/trunk/net/batman-adv/distributed-arp-table.c +++ b/trunk/net/batman-adv/distributed-arp-table.c @@ -738,7 +738,6 @@ static uint16_t batadv_arp_get_type(struct batadv_priv *bat_priv, struct arphdr *arphdr; struct ethhdr *ethhdr; __be32 ip_src, ip_dst; - uint8_t *hw_src, *hw_dst; uint16_t type = 0; /* pull the ethernet header */ @@ -778,23 +777,9 @@ static uint16_t batadv_arp_get_type(struct batadv_priv *bat_priv, ip_src = batadv_arp_ip_src(skb, hdr_size); ip_dst = batadv_arp_ip_dst(skb, hdr_size); if (ipv4_is_loopback(ip_src) || ipv4_is_multicast(ip_src) || - ipv4_is_loopback(ip_dst) || ipv4_is_multicast(ip_dst) || - ipv4_is_zeronet(ip_src) || ipv4_is_lbcast(ip_src) || - ipv4_is_zeronet(ip_dst) || ipv4_is_lbcast(ip_dst)) + ipv4_is_loopback(ip_dst) || ipv4_is_multicast(ip_dst)) goto out; - hw_src = batadv_arp_hw_src(skb, hdr_size); - if (is_zero_ether_addr(hw_src) || is_multicast_ether_addr(hw_src)) - goto out; - - /* we don't care about the destination MAC address in ARP requests */ - if (arphdr->ar_op != htons(ARPOP_REQUEST)) { - hw_dst = batadv_arp_hw_dst(skb, hdr_size); - if (is_zero_ether_addr(hw_dst) || - is_multicast_ether_addr(hw_dst)) - goto out; - } - type = ntohs(arphdr->ar_op); out: return type; @@ -1027,8 +1012,6 @@ bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv, */ ret = !batadv_is_my_client(bat_priv, hw_dst); out: - if (ret) - kfree_skb(skb); /* if ret == false -> packet has to be delivered to the interface */ return ret; } diff --git a/trunk/net/bluetooth/hci_core.c b/trunk/net/bluetooth/hci_core.c index 0f78e34220c9..596660d37c5e 100644 --- a/trunk/net/bluetooth/hci_core.c +++ b/trunk/net/bluetooth/hci_core.c @@ -2810,6 +2810,14 @@ static void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb) if (conn) { hci_conn_enter_active_mode(conn, BT_POWER_FORCE_ACTIVE_OFF); + hci_dev_lock(hdev); + if (test_bit(HCI_MGMT, &hdev->dev_flags) && + !test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) + mgmt_device_connected(hdev, &conn->dst, conn->type, + conn->dst_type, 0, NULL, 0, + conn->dev_class); + hci_dev_unlock(hdev); + /* Send to upper protocol */ l2cap_recv_acldata(conn, skb, flags); return; diff --git a/trunk/net/bluetooth/hci_event.c b/trunk/net/bluetooth/hci_event.c index 81b44481d0d9..705078a0cc39 100644 --- a/trunk/net/bluetooth/hci_event.c +++ b/trunk/net/bluetooth/hci_event.c @@ -2688,7 +2688,7 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) if (ev->opcode != HCI_OP_NOP) del_timer(&hdev->cmd_timer); - if (ev->ncmd && !test_bit(HCI_RESET, &hdev->flags)) { + if (ev->ncmd) { atomic_set(&hdev->cmd_cnt, 1); if (!skb_queue_empty(&hdev->cmd_q)) queue_work(hdev->workqueue, &hdev->cmd_work); diff --git a/trunk/net/bluetooth/hidp/core.c b/trunk/net/bluetooth/hidp/core.c index a7352ff3fd1e..b2bcbe2dc328 100644 --- a/trunk/net/bluetooth/hidp/core.c +++ b/trunk/net/bluetooth/hidp/core.c @@ -931,7 +931,7 @@ static int hidp_setup_hid(struct hidp_session *session, hid->version = req->version; hid->country = req->country; - strncpy(hid->name, req->name, sizeof(req->name) - 1); + strncpy(hid->name, req->name, 128); snprintf(hid->phys, sizeof(hid->phys), "%pMR", &bt_sk(session->ctrl_sock->sk)->src); diff --git a/trunk/net/bluetooth/l2cap_core.c b/trunk/net/bluetooth/l2cap_core.c index 22e658322845..2c78208d793e 100644 --- a/trunk/net/bluetooth/l2cap_core.c +++ b/trunk/net/bluetooth/l2cap_core.c @@ -3727,17 +3727,6 @@ static struct l2cap_chan *l2cap_connect(struct l2cap_conn *conn, static int l2cap_connect_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data) { - struct hci_dev *hdev = conn->hcon->hdev; - struct hci_conn *hcon = conn->hcon; - - hci_dev_lock(hdev); - if (test_bit(HCI_MGMT, &hdev->dev_flags) && - !test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &hcon->flags)) - mgmt_device_connected(hdev, &hcon->dst, hcon->type, - hcon->dst_type, 0, NULL, 0, - hcon->dev_class); - hci_dev_unlock(hdev); - l2cap_connect(conn, cmd, data, L2CAP_CONN_RSP, 0); return 0; } diff --git a/trunk/net/bluetooth/sco.c b/trunk/net/bluetooth/sco.c index 57f250c20e39..531a93d613d4 100644 --- a/trunk/net/bluetooth/sco.c +++ b/trunk/net/bluetooth/sco.c @@ -352,7 +352,7 @@ static void __sco_sock_close(struct sock *sk) case BT_CONNECTED: case BT_CONFIG: - if (sco_pi(sk)->conn->hcon) { + if (sco_pi(sk)->conn) { sk->sk_state = BT_DISCONN; sco_sock_set_timer(sk, SCO_DISCONN_TIMEOUT); hci_conn_put(sco_pi(sk)->conn->hcon); diff --git a/trunk/net/bridge/br_multicast.c b/trunk/net/bridge/br_multicast.c index 6d6f26531de2..5391ca43336a 100644 --- a/trunk/net/bridge/br_multicast.c +++ b/trunk/net/bridge/br_multicast.c @@ -1608,6 +1608,7 @@ void br_multicast_init(struct net_bridge *br) br_multicast_querier_expired, (unsigned long)br); setup_timer(&br->multicast_query_timer, br_multicast_query_expired, (unsigned long)br); + br_mdb_init(); } void br_multicast_open(struct net_bridge *br) @@ -1632,6 +1633,7 @@ void br_multicast_stop(struct net_bridge *br) del_timer_sync(&br->multicast_querier_timer); del_timer_sync(&br->multicast_query_timer); + br_mdb_uninit(); spin_lock_bh(&br->multicast_lock); mdb = mlock_dereference(br->mdb, br); if (!mdb) diff --git a/trunk/net/bridge/br_netlink.c b/trunk/net/bridge/br_netlink.c index 5dc66abcc9e2..97ba0189c6f7 100644 --- a/trunk/net/bridge/br_netlink.c +++ b/trunk/net/bridge/br_netlink.c @@ -299,21 +299,10 @@ struct rtnl_link_ops br_link_ops __read_mostly = { int __init br_netlink_init(void) { - int err; - - br_mdb_init(); - err = rtnl_link_register(&br_link_ops); - if (err) - goto out; - - return 0; -out: - br_mdb_uninit(); - return err; + return rtnl_link_register(&br_link_ops); } void __exit br_netlink_fini(void) { - br_mdb_uninit(); rtnl_link_unregister(&br_link_ops); } diff --git a/trunk/net/bridge/br_private.h b/trunk/net/bridge/br_private.h index 711094aed41a..8d83be5ffedc 100644 --- a/trunk/net/bridge/br_private.h +++ b/trunk/net/bridge/br_private.h @@ -526,12 +526,6 @@ static inline bool br_multicast_is_router(struct net_bridge *br) { return 0; } -static inline void br_mdb_init(void) -{ -} -static inline void br_mdb_uninit(void) -{ -} #endif /* br_netfilter.c */ diff --git a/trunk/net/core/dev.c b/trunk/net/core/dev.c index f64e439b4a00..515473ee52cb 100644 --- a/trunk/net/core/dev.c +++ b/trunk/net/core/dev.c @@ -6121,14 +6121,6 @@ struct netdev_queue *dev_ingress_queue_create(struct net_device *dev) static const struct ethtool_ops default_ethtool_ops; -void netdev_set_default_ethtool_ops(struct net_device *dev, - const struct ethtool_ops *ops) -{ - if (dev->ethtool_ops == &default_ethtool_ops) - dev->ethtool_ops = ops; -} -EXPORT_SYMBOL_GPL(netdev_set_default_ethtool_ops); - /** * alloc_netdev_mqs - allocate network device * @sizeof_priv: size of private data to allocate space for diff --git a/trunk/net/core/request_sock.c b/trunk/net/core/request_sock.c index 4425148d2b51..c31d9e8668c3 100644 --- a/trunk/net/core/request_sock.c +++ b/trunk/net/core/request_sock.c @@ -186,6 +186,8 @@ void reqsk_fastopen_remove(struct sock *sk, struct request_sock *req, struct fastopen_queue *fastopenq = inet_csk(lsk)->icsk_accept_queue.fastopenq; + BUG_ON(!spin_is_locked(&sk->sk_lock.slock) && !sock_owned_by_user(sk)); + tcp_sk(sk)->fastopen_rsk = NULL; spin_lock_bh(&fastopenq->lock); fastopenq->qlen--; diff --git a/trunk/net/core/scm.c b/trunk/net/core/scm.c index 905dcc6ad1e3..57fb1ee6649f 100644 --- a/trunk/net/core/scm.c +++ b/trunk/net/core/scm.c @@ -35,7 +35,6 @@ #include #include #include -#include /* @@ -303,10 +302,8 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm) } /* Bump the usage count and install the file. */ sock = sock_from_file(fp[i], &err); - if (sock) { + if (sock) sock_update_netprioidx(sock->sk, current); - sock_update_classid(sock->sk, current); - } fd_install(new_fd, get_file(fp[i])); } diff --git a/trunk/net/core/skbuff.c b/trunk/net/core/skbuff.c index a9a2ae3e2213..3ab989b0de42 100644 --- a/trunk/net/core/skbuff.c +++ b/trunk/net/core/skbuff.c @@ -1649,7 +1649,7 @@ static void sock_spd_release(struct splice_pipe_desc *spd, unsigned int i) static struct page *linear_to_page(struct page *page, unsigned int *len, unsigned int *offset, - struct sock *sk) + struct sk_buff *skb, struct sock *sk) { struct page_frag *pfrag = sk_page_frag(sk); @@ -1682,14 +1682,14 @@ static bool spd_can_coalesce(const struct splice_pipe_desc *spd, static bool spd_fill_page(struct splice_pipe_desc *spd, struct pipe_inode_info *pipe, struct page *page, unsigned int *len, unsigned int offset, - bool linear, + struct sk_buff *skb, bool linear, struct sock *sk) { if (unlikely(spd->nr_pages == MAX_SKB_FRAGS)) return true; if (linear) { - page = linear_to_page(page, len, &offset, sk); + page = linear_to_page(page, len, &offset, skb, sk); if (!page) return true; } @@ -1706,9 +1706,23 @@ static bool spd_fill_page(struct splice_pipe_desc *spd, return false; } +static inline void __segment_seek(struct page **page, unsigned int *poff, + unsigned int *plen, unsigned int off) +{ + unsigned long n; + + *poff += off; + n = *poff / PAGE_SIZE; + if (n) + *page = nth_page(*page, n); + + *poff = *poff % PAGE_SIZE; + *plen -= off; +} + static bool __splice_segment(struct page *page, unsigned int poff, unsigned int plen, unsigned int *off, - unsigned int *len, + unsigned int *len, struct sk_buff *skb, struct splice_pipe_desc *spd, bool linear, struct sock *sk, struct pipe_inode_info *pipe) @@ -1723,19 +1737,23 @@ static bool __splice_segment(struct page *page, unsigned int poff, } /* ignore any bits we already processed */ - poff += *off; - plen -= *off; - *off = 0; + if (*off) { + __segment_seek(&page, &poff, &plen, *off); + *off = 0; + } do { unsigned int flen = min(*len, plen); - if (spd_fill_page(spd, pipe, page, &flen, poff, - linear, sk)) + /* the linear region may spread across several pages */ + flen = min_t(unsigned int, flen, PAGE_SIZE - poff); + + if (spd_fill_page(spd, pipe, page, &flen, poff, skb, linear, sk)) return true; - poff += flen; - plen -= flen; + + __segment_seek(&page, &poff, &plen, flen); *len -= flen; + } while (*len && plen); return false; @@ -1759,7 +1777,7 @@ static bool __skb_splice_bits(struct sk_buff *skb, struct pipe_inode_info *pipe, if (__splice_segment(virt_to_page(skb->data), (unsigned long) skb->data & (PAGE_SIZE - 1), skb_headlen(skb), - offset, len, spd, + offset, len, skb, spd, skb_head_is_locked(skb), sk, pipe)) return true; @@ -1772,7 +1790,7 @@ static bool __skb_splice_bits(struct sk_buff *skb, struct pipe_inode_info *pipe, if (__splice_segment(skb_frag_page(f), f->page_offset, skb_frag_size(f), - offset, len, spd, false, sk, pipe)) + offset, len, skb, spd, false, sk, pipe)) return true; } diff --git a/trunk/net/ipv4/ah4.c b/trunk/net/ipv4/ah4.c index a69b4e4a02b5..a0d8392491c3 100644 --- a/trunk/net/ipv4/ah4.c +++ b/trunk/net/ipv4/ah4.c @@ -269,11 +269,7 @@ static void ah_input_done(struct crypto_async_request *base, int err) skb->network_header += ah_hlen; memcpy(skb_network_header(skb), work_iph, ihl); __skb_pull(skb, ah_hlen + ihl); - - if (x->props.mode == XFRM_MODE_TUNNEL) - skb_reset_transport_header(skb); - else - skb_set_transport_header(skb, -ihl); + skb_set_transport_header(skb, -ihl); out: kfree(AH_SKB_CB(skb)->tmp); xfrm_input_resume(skb, err); @@ -385,10 +381,7 @@ static int ah_input(struct xfrm_state *x, struct sk_buff *skb) skb->network_header += ah_hlen; memcpy(skb_network_header(skb), work_iph, ihl); __skb_pull(skb, ah_hlen + ihl); - if (x->props.mode == XFRM_MODE_TUNNEL) - skb_reset_transport_header(skb); - else - skb_set_transport_header(skb, -ihl); + skb_set_transport_header(skb, -ihl); err = nexthdr; @@ -420,12 +413,9 @@ static void ah4_err(struct sk_buff *skb, u32 info) if (!x) return; - if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) { - atomic_inc(&flow_cache_genid); - rt_genid_bump(net); - + if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_AH, 0); - } else + else ipv4_redirect(skb, net, 0, 0, IPPROTO_AH, 0); xfrm_state_put(x); } diff --git a/trunk/net/ipv4/datagram.c b/trunk/net/ipv4/datagram.c index b28e863fe0a7..424fafbc8cb0 100644 --- a/trunk/net/ipv4/datagram.c +++ b/trunk/net/ipv4/datagram.c @@ -85,28 +85,3 @@ int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) return err; } EXPORT_SYMBOL(ip4_datagram_connect); - -void ip4_datagram_release_cb(struct sock *sk) -{ - const struct inet_sock *inet = inet_sk(sk); - const struct ip_options_rcu *inet_opt; - __be32 daddr = inet->inet_daddr; - struct flowi4 fl4; - struct rtable *rt; - - if (! __sk_dst_get(sk) || __sk_dst_check(sk, 0)) - return; - - rcu_read_lock(); - inet_opt = rcu_dereference(inet->inet_opt); - if (inet_opt && inet_opt->opt.srr) - daddr = inet_opt->opt.faddr; - rt = ip_route_output_ports(sock_net(sk), &fl4, sk, daddr, - inet->inet_saddr, inet->inet_dport, - inet->inet_sport, sk->sk_protocol, - RT_CONN_FLAGS(sk), sk->sk_bound_dev_if); - if (!IS_ERR(rt)) - __sk_dst_set(sk, &rt->dst); - rcu_read_unlock(); -} -EXPORT_SYMBOL_GPL(ip4_datagram_release_cb); diff --git a/trunk/net/ipv4/devinet.c b/trunk/net/ipv4/devinet.c index a8e4f2665d5e..cc06a47f1216 100644 --- a/trunk/net/ipv4/devinet.c +++ b/trunk/net/ipv4/devinet.c @@ -823,9 +823,9 @@ int devinet_ioctl(struct net *net, unsigned int cmd, void __user *arg) if (!ifa) { ret = -ENOBUFS; ifa = inet_alloc_ifa(); + INIT_HLIST_NODE(&ifa->hash); if (!ifa) break; - INIT_HLIST_NODE(&ifa->hash); if (colon) memcpy(ifa->ifa_label, ifr.ifr_name, IFNAMSIZ); else diff --git a/trunk/net/ipv4/esp4.c b/trunk/net/ipv4/esp4.c index 3b4f0cd2e63e..b61e9deb7c7e 100644 --- a/trunk/net/ipv4/esp4.c +++ b/trunk/net/ipv4/esp4.c @@ -346,10 +346,7 @@ static int esp_input_done2(struct sk_buff *skb, int err) pskb_trim(skb, skb->len - alen - padlen - 2); __skb_pull(skb, hlen); - if (x->props.mode == XFRM_MODE_TUNNEL) - skb_reset_transport_header(skb); - else - skb_set_transport_header(skb, -ihl); + skb_set_transport_header(skb, -ihl); err = nexthdr[1]; @@ -502,12 +499,9 @@ static void esp4_err(struct sk_buff *skb, u32 info) if (!x) return; - if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) { - atomic_inc(&flow_cache_genid); - rt_genid_bump(net); - + if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_ESP, 0); - } else + else ipv4_redirect(skb, net, 0, 0, IPPROTO_ESP, 0); xfrm_state_put(x); } diff --git a/trunk/net/ipv4/ip_gre.c b/trunk/net/ipv4/ip_gre.c index e81b1caf2ea2..303012adf9e6 100644 --- a/trunk/net/ipv4/ip_gre.c +++ b/trunk/net/ipv4/ip_gre.c @@ -963,12 +963,8 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev ptr--; } if (tunnel->parms.o_flags&GRE_CSUM) { - int offset = skb_transport_offset(skb); - *ptr = 0; - *(__sum16 *)ptr = csum_fold(skb_checksum(skb, offset, - skb->len - offset, - 0)); + *(__sum16 *)ptr = ip_compute_csum((void *)(iph+1), skb->len - sizeof(struct iphdr)); } } diff --git a/trunk/net/ipv4/ip_sockglue.c b/trunk/net/ipv4/ip_sockglue.c index d9c4f113d709..3c9d20880283 100644 --- a/trunk/net/ipv4/ip_sockglue.c +++ b/trunk/net/ipv4/ip_sockglue.c @@ -590,7 +590,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, case IP_TTL: if (optlen < 1) goto e_inval; - if (val != -1 && (val < 1 || val > 255)) + if (val != -1 && (val < 0 || val > 255)) goto e_inval; inet->uc_ttl = val; break; diff --git a/trunk/net/ipv4/ipcomp.c b/trunk/net/ipv4/ipcomp.c index 9a46daed2f3c..d3ab47e19a89 100644 --- a/trunk/net/ipv4/ipcomp.c +++ b/trunk/net/ipv4/ipcomp.c @@ -47,12 +47,9 @@ static void ipcomp4_err(struct sk_buff *skb, u32 info) if (!x) return; - if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) { - atomic_inc(&flow_cache_genid); - rt_genid_bump(net); - + if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_COMP, 0); - } else + else ipv4_redirect(skb, net, 0, 0, IPPROTO_COMP, 0); xfrm_state_put(x); } diff --git a/trunk/net/ipv4/ipconfig.c b/trunk/net/ipv4/ipconfig.c index a2e50ae80b53..d763701cff1b 100644 --- a/trunk/net/ipv4/ipconfig.c +++ b/trunk/net/ipv4/ipconfig.c @@ -136,8 +136,6 @@ __be32 ic_myaddr = NONE; /* My IP address */ static __be32 ic_netmask = NONE; /* Netmask for local subnet */ __be32 ic_gateway = NONE; /* Gateway IP address */ -__be32 ic_addrservaddr = NONE; /* IP Address of the IP addresses'server */ - __be32 ic_servaddr = NONE; /* Boot server IP address */ __be32 root_server_addr = NONE; /* Address of NFS server */ @@ -560,7 +558,6 @@ ic_rarp_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt if (ic_myaddr == NONE) ic_myaddr = tip; ic_servaddr = sip; - ic_addrservaddr = sip; ic_got_reply = IC_RARP; drop_unlock: @@ -1071,7 +1068,7 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str ic_servaddr = server_id; #ifdef IPCONFIG_DEBUG printk("DHCP: Offered address %pI4 by server %pI4\n", - &ic_myaddr, &b->iph.saddr); + &ic_myaddr, &ic_servaddr); #endif /* The DHCP indicated server address takes * precedence over the bootp header one if @@ -1116,7 +1113,6 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str ic_dev = dev; ic_myaddr = b->your_ip; ic_servaddr = b->server_ip; - ic_addrservaddr = b->iph.saddr; if (ic_gateway == NONE && b->relay_ip) ic_gateway = b->relay_ip; if (ic_nameservers[0] == NONE) @@ -1272,7 +1268,7 @@ static int __init ic_dynamic(void) printk("IP-Config: Got %s answer from %pI4, ", ((ic_got_reply & IC_RARP) ? "RARP" : (ic_proto_enabled & IC_USE_DHCP) ? "DHCP" : "BOOTP"), - &ic_addrservaddr); + &ic_servaddr); pr_cont("my address is %pI4\n", &ic_myaddr); return 0; diff --git a/trunk/net/ipv4/netfilter/ipt_REJECT.c b/trunk/net/ipv4/netfilter/ipt_REJECT.c index 04b18c1ac345..51f13f8ec724 100644 --- a/trunk/net/ipv4/netfilter/ipt_REJECT.c +++ b/trunk/net/ipv4/netfilter/ipt_REJECT.c @@ -81,7 +81,6 @@ static void send_reset(struct sk_buff *oldskb, int hook) niph->saddr = oiph->daddr; niph->daddr = oiph->saddr; - skb_reset_transport_header(nskb); tcph = (struct tcphdr *)skb_put(nskb, sizeof(struct tcphdr)); memset(tcph, 0, sizeof(*tcph)); tcph->source = oth->dest; diff --git a/trunk/net/ipv4/netfilter/iptable_nat.c b/trunk/net/ipv4/netfilter/iptable_nat.c index eeaff7e4acb5..da2c8a368f68 100644 --- a/trunk/net/ipv4/netfilter/iptable_nat.c +++ b/trunk/net/ipv4/netfilter/iptable_nat.c @@ -124,28 +124,23 @@ nf_nat_ipv4_fn(unsigned int hooknum, ret = nf_nat_rule_find(skb, hooknum, in, out, ct); if (ret != NF_ACCEPT) return ret; - } else { + } else pr_debug("Already setup manip %s for ct %p\n", maniptype == NF_NAT_MANIP_SRC ? "SRC" : "DST", ct); - if (nf_nat_oif_changed(hooknum, ctinfo, nat, out)) - goto oif_changed; - } break; default: /* ESTABLISHED */ NF_CT_ASSERT(ctinfo == IP_CT_ESTABLISHED || ctinfo == IP_CT_ESTABLISHED_REPLY); - if (nf_nat_oif_changed(hooknum, ctinfo, nat, out)) - goto oif_changed; + if (nf_nat_oif_changed(hooknum, ctinfo, nat, out)) { + nf_ct_kill_acct(ct, ctinfo, skb); + return NF_DROP; + } } return nf_nat_packet(ct, ctinfo, hooknum, skb); - -oif_changed: - nf_ct_kill_acct(ct, ctinfo, skb); - return NF_DROP; } static unsigned int diff --git a/trunk/net/ipv4/ping.c b/trunk/net/ipv4/ping.c index 6f9c07268cf6..8f3d05424a3e 100644 --- a/trunk/net/ipv4/ping.c +++ b/trunk/net/ipv4/ping.c @@ -738,7 +738,6 @@ struct proto ping_prot = { .recvmsg = ping_recvmsg, .bind = ping_bind, .backlog_rcv = ping_queue_rcv_skb, - .release_cb = ip4_datagram_release_cb, .hash = ping_v4_hash, .unhash = ping_v4_unhash, .get_port = ping_v4_get_port, diff --git a/trunk/net/ipv4/raw.c b/trunk/net/ipv4/raw.c index 6f08991409c3..73d1e4df4bf6 100644 --- a/trunk/net/ipv4/raw.c +++ b/trunk/net/ipv4/raw.c @@ -894,7 +894,6 @@ struct proto raw_prot = { .recvmsg = raw_recvmsg, .bind = raw_bind, .backlog_rcv = raw_rcv_skb, - .release_cb = ip4_datagram_release_cb, .hash = raw_hash_sk, .unhash = raw_unhash_sk, .obj_size = sizeof(struct raw_sock), diff --git a/trunk/net/ipv4/route.c b/trunk/net/ipv4/route.c index a0fcc47fee73..844a9ef60dbd 100644 --- a/trunk/net/ipv4/route.c +++ b/trunk/net/ipv4/route.c @@ -912,9 +912,6 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu) struct dst_entry *dst = &rt->dst; struct fib_result res; - if (dst_metric_locked(dst, RTAX_MTU)) - return; - if (dst->dev->mtu < mtu) return; @@ -965,7 +962,7 @@ void ipv4_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu, } EXPORT_SYMBOL_GPL(ipv4_update_pmtu); -static void __ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu) +void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu) { const struct iphdr *iph = (const struct iphdr *) skb->data; struct flowi4 fl4; @@ -978,53 +975,6 @@ static void __ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu) ip_rt_put(rt); } } - -void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu) -{ - const struct iphdr *iph = (const struct iphdr *) skb->data; - struct flowi4 fl4; - struct rtable *rt; - struct dst_entry *dst; - bool new = false; - - bh_lock_sock(sk); - rt = (struct rtable *) __sk_dst_get(sk); - - if (sock_owned_by_user(sk) || !rt) { - __ipv4_sk_update_pmtu(skb, sk, mtu); - goto out; - } - - __build_flow_key(&fl4, sk, iph, 0, 0, 0, 0, 0); - - if (!__sk_dst_check(sk, 0)) { - rt = ip_route_output_flow(sock_net(sk), &fl4, sk); - if (IS_ERR(rt)) - goto out; - - new = true; - } - - __ip_rt_update_pmtu((struct rtable *) rt->dst.path, &fl4, mtu); - - dst = dst_check(&rt->dst, 0); - if (!dst) { - if (new) - dst_release(&rt->dst); - - rt = ip_route_output_flow(sock_net(sk), &fl4, sk); - if (IS_ERR(rt)) - goto out; - - new = true; - } - - if (new) - __sk_dst_set(sk, &rt->dst); - -out: - bh_unlock_sock(sk); -} EXPORT_SYMBOL_GPL(ipv4_sk_update_pmtu); void ipv4_redirect(struct sk_buff *skb, struct net *net, @@ -1170,7 +1120,7 @@ static unsigned int ipv4_mtu(const struct dst_entry *dst) if (!mtu || time_after_eq(jiffies, rt->dst.expires)) mtu = dst_metric_raw(dst, RTAX_MTU); - if (mtu) + if (mtu && rt_is_output_route(rt)) return mtu; mtu = dst->dev->mtu; diff --git a/trunk/net/ipv4/tcp.c b/trunk/net/ipv4/tcp.c index 2aa69c8ae60c..1ca253635f7a 100644 --- a/trunk/net/ipv4/tcp.c +++ b/trunk/net/ipv4/tcp.c @@ -1428,12 +1428,12 @@ static void tcp_service_net_dma(struct sock *sk, bool wait) } #endif -static struct sk_buff *tcp_recv_skb(struct sock *sk, u32 seq, u32 *off) +static inline struct sk_buff *tcp_recv_skb(struct sock *sk, u32 seq, u32 *off) { struct sk_buff *skb; u32 offset; - while ((skb = skb_peek(&sk->sk_receive_queue)) != NULL) { + skb_queue_walk(&sk->sk_receive_queue, skb) { offset = seq - TCP_SKB_CB(skb)->seq; if (tcp_hdr(skb)->syn) offset--; @@ -1441,11 +1441,6 @@ static struct sk_buff *tcp_recv_skb(struct sock *sk, u32 seq, u32 *off) *off = offset; return skb; } - /* This looks weird, but this can happen if TCP collapsing - * splitted a fat GRO packet, while we released socket lock - * in skb_splice_bits() - */ - sk_eat_skb(sk, skb, false); } return NULL; } @@ -1487,7 +1482,7 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc, break; } used = recv_actor(desc, skb, offset, len); - if (used <= 0) { + if (used < 0) { if (!copied) copied = used; break; @@ -1525,10 +1520,8 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc, tcp_rcv_space_adjust(sk); /* Clean up data we have read: This will do ACK frames. */ - if (copied > 0) { - tcp_recv_skb(sk, seq, &offset); + if (copied > 0) tcp_cleanup_rbuf(sk, copied); - } return copied; } EXPORT_SYMBOL(tcp_read_sock); diff --git a/trunk/net/ipv4/tcp_input.c b/trunk/net/ipv4/tcp_input.c index 18f97ca76b00..a28e4db8a952 100644 --- a/trunk/net/ipv4/tcp_input.c +++ b/trunk/net/ipv4/tcp_input.c @@ -5543,7 +5543,7 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb, if (len < (th->doff << 2) || tcp_checksum_complete_user(sk, skb)) goto csum_error; - if (!th->ack && !th->rst) + if (!th->ack) goto discard; /* @@ -5988,7 +5988,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, goto discard; } - if (!th->ack && !th->rst) + if (!th->ack) goto discard; if (!tcp_validate_incoming(sk, skb, th, 0)) diff --git a/trunk/net/ipv4/tcp_ipv4.c b/trunk/net/ipv4/tcp_ipv4.c index 70b09ef2463b..54139fa514e6 100644 --- a/trunk/net/ipv4/tcp_ipv4.c +++ b/trunk/net/ipv4/tcp_ipv4.c @@ -369,10 +369,11 @@ void tcp_v4_err(struct sk_buff *icmp_skb, u32 info) * We do take care of PMTU discovery (RFC1191) special case : * we can receive locally generated ICMP messages while socket is held. */ - if (sock_owned_by_user(sk)) { - if (!(type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED)) - NET_INC_STATS_BH(net, LINUX_MIB_LOCKDROPPEDICMPS); - } + if (sock_owned_by_user(sk) && + type != ICMP_DEST_UNREACH && + code != ICMP_FRAG_NEEDED) + NET_INC_STATS_BH(net, LINUX_MIB_LOCKDROPPEDICMPS); + if (sk->sk_state == TCP_CLOSE) goto out; diff --git a/trunk/net/ipv4/udp.c b/trunk/net/ipv4/udp.c index 1f4d405eafba..79c8dbe59b54 100644 --- a/trunk/net/ipv4/udp.c +++ b/trunk/net/ipv4/udp.c @@ -1952,7 +1952,6 @@ struct proto udp_prot = { .recvmsg = udp_recvmsg, .sendpage = udp_sendpage, .backlog_rcv = __udp_queue_rcv_skb, - .release_cb = ip4_datagram_release_cb, .hash = udp_lib_hash, .unhash = udp_lib_unhash, .rehash = udp_v4_rehash, diff --git a/trunk/net/ipv6/addrconf.c b/trunk/net/ipv6/addrconf.c index 420e56326384..408cac4ae00a 100644 --- a/trunk/net/ipv6/addrconf.c +++ b/trunk/net/ipv6/addrconf.c @@ -154,11 +154,6 @@ static void addrconf_type_change(struct net_device *dev, unsigned long event); static int addrconf_ifdown(struct net_device *dev, int how); -static struct rt6_info *addrconf_get_prefix_route(const struct in6_addr *pfx, - int plen, - const struct net_device *dev, - u32 flags, u32 noflags); - static void addrconf_dad_start(struct inet6_ifaddr *ifp); static void addrconf_dad_timer(unsigned long data); static void addrconf_dad_completed(struct inet6_ifaddr *ifp); @@ -255,6 +250,12 @@ static inline bool addrconf_qdisc_ok(const struct net_device *dev) return !qdisc_tx_is_noop(dev); } +/* Check if a route is valid prefix route */ +static inline int addrconf_is_prefix_route(const struct rt6_info *rt) +{ + return (rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0; +} + static void addrconf_del_timer(struct inet6_ifaddr *ifp) { if (del_timer(&ifp->timer)) @@ -940,15 +941,17 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp) if ((ifp->flags & IFA_F_PERMANENT) && onlink < 1) { struct in6_addr prefix; struct rt6_info *rt; + struct net *net = dev_net(ifp->idev->dev); + struct flowi6 fl6 = {}; ipv6_addr_prefix(&prefix, &ifp->addr, ifp->prefix_len); + fl6.flowi6_oif = ifp->idev->dev->ifindex; + fl6.daddr = prefix; + rt = (struct rt6_info *)ip6_route_lookup(net, &fl6, + RT6_LOOKUP_F_IFACE); - rt = addrconf_get_prefix_route(&prefix, - ifp->prefix_len, - ifp->idev->dev, - 0, RTF_GATEWAY | RTF_DEFAULT); - - if (rt) { + if (rt != net->ipv6.ip6_null_entry && + addrconf_is_prefix_route(rt)) { if (onlink == 0) { ip6_del_rt(rt); rt = NULL; @@ -1874,7 +1877,7 @@ static struct rt6_info *addrconf_get_prefix_route(const struct in6_addr *pfx, continue; if ((rt->rt6i_flags & flags) != flags) continue; - if ((rt->rt6i_flags & noflags) != 0) + if ((noflags != 0) && ((rt->rt6i_flags & flags) != 0)) continue; dst_hold(&rt->dst); break; diff --git a/trunk/net/ipv6/ah6.c b/trunk/net/ipv6/ah6.c index 384233188ac1..ecc35b93314b 100644 --- a/trunk/net/ipv6/ah6.c +++ b/trunk/net/ipv6/ah6.c @@ -472,10 +472,7 @@ static void ah6_input_done(struct crypto_async_request *base, int err) skb->network_header += ah_hlen; memcpy(skb_network_header(skb), work_iph, hdr_len); __skb_pull(skb, ah_hlen + hdr_len); - if (x->props.mode == XFRM_MODE_TUNNEL) - skb_reset_transport_header(skb); - else - skb_set_transport_header(skb, -hdr_len); + skb_set_transport_header(skb, -hdr_len); out: kfree(AH_SKB_CB(skb)->tmp); xfrm_input_resume(skb, err); @@ -596,13 +593,9 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb) skb->network_header += ah_hlen; memcpy(skb_network_header(skb), work_iph, hdr_len); + skb->transport_header = skb->network_header; __skb_pull(skb, ah_hlen + hdr_len); - if (x->props.mode == XFRM_MODE_TUNNEL) - skb_reset_transport_header(skb); - else - skb_set_transport_header(skb, -hdr_len); - err = nexthdr; out_free: diff --git a/trunk/net/ipv6/esp6.c b/trunk/net/ipv6/esp6.c index 40ffd72243a4..282f3723ee19 100644 --- a/trunk/net/ipv6/esp6.c +++ b/trunk/net/ipv6/esp6.c @@ -300,10 +300,7 @@ static int esp_input_done2(struct sk_buff *skb, int err) pskb_trim(skb, skb->len - alen - padlen - 2); __skb_pull(skb, hlen); - if (x->props.mode == XFRM_MODE_TUNNEL) - skb_reset_transport_header(skb); - else - skb_set_transport_header(skb, -hdr_len); + skb_set_transport_header(skb, -hdr_len); err = nexthdr[1]; diff --git a/trunk/net/ipv6/icmp.c b/trunk/net/ipv6/icmp.c index fff5bdd8b680..b4a9fd51dae7 100644 --- a/trunk/net/ipv6/icmp.c +++ b/trunk/net/ipv6/icmp.c @@ -81,22 +81,10 @@ static inline struct sock *icmpv6_sk(struct net *net) return net->ipv6.icmp_sk[smp_processor_id()]; } -static void icmpv6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, - u8 type, u8 code, int offset, __be32 info) -{ - struct net *net = dev_net(skb->dev); - - if (type == ICMPV6_PKT_TOOBIG) - ip6_update_pmtu(skb, net, info, 0, 0); - else if (type == NDISC_REDIRECT) - ip6_redirect(skb, net, 0, 0); -} - static int icmpv6_rcv(struct sk_buff *skb); static const struct inet6_protocol icmpv6_protocol = { .handler = icmpv6_rcv, - .err_handler = icmpv6_err, .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, }; diff --git a/trunk/net/ipv6/ip6_output.c b/trunk/net/ipv6/ip6_output.c index 0c7c03d50dc0..5552d13ae92f 100644 --- a/trunk/net/ipv6/ip6_output.c +++ b/trunk/net/ipv6/ip6_output.c @@ -1213,10 +1213,10 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, if (dst_allfrag(rt->dst.path)) cork->flags |= IPCORK_ALLFRAG; cork->length = 0; - exthdrlen = (opt ? opt->opt_flen : 0); + exthdrlen = (opt ? opt->opt_flen : 0) - rt->rt6i_nfheader_len; length += exthdrlen; transhdrlen += exthdrlen; - dst_exthdrlen = rt->dst.header_len - rt->rt6i_nfheader_len; + dst_exthdrlen = rt->dst.header_len; } else { rt = (struct rt6_info *)cork->dst; fl6 = &inet->cork.fl.u.ip6; diff --git a/trunk/net/ipv6/ip6mr.c b/trunk/net/ipv6/ip6mr.c index 8fd154e5f079..26dcdec9e3a5 100644 --- a/trunk/net/ipv6/ip6mr.c +++ b/trunk/net/ipv6/ip6mr.c @@ -1710,9 +1710,6 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, uns return -EINVAL; if (get_user(v, (u32 __user *)optval)) return -EFAULT; - /* "pim6reg%u" should not exceed 16 bytes (IFNAMSIZ) */ - if (v != RT_TABLE_DEFAULT && v >= 100000000) - return -EINVAL; if (sk == mrt->mroute6_sk) return -EBUSY; diff --git a/trunk/net/ipv6/netfilter/ip6t_NPT.c b/trunk/net/ipv6/netfilter/ip6t_NPT.c index 7302b0b7b642..e9486915eff6 100644 --- a/trunk/net/ipv6/netfilter/ip6t_NPT.c +++ b/trunk/net/ipv6/netfilter/ip6t_NPT.c @@ -14,23 +14,42 @@ #include #include +static __sum16 csum16_complement(__sum16 a) +{ + return (__force __sum16)(0xffff - (__force u16)a); +} + +static __sum16 csum16_add(__sum16 a, __sum16 b) +{ + u16 sum; + + sum = (__force u16)a + (__force u16)b; + sum += (__force u16)a < (__force u16)b; + return (__force __sum16)sum; +} + +static __sum16 csum16_sub(__sum16 a, __sum16 b) +{ + return csum16_add(a, csum16_complement(b)); +} + static int ip6t_npt_checkentry(const struct xt_tgchk_param *par) { struct ip6t_npt_tginfo *npt = par->targinfo; - __wsum src_sum = 0, dst_sum = 0; + __sum16 src_sum = 0, dst_sum = 0; unsigned int i; if (npt->src_pfx_len > 64 || npt->dst_pfx_len > 64) return -EINVAL; for (i = 0; i < ARRAY_SIZE(npt->src_pfx.in6.s6_addr16); i++) { - src_sum = csum_add(src_sum, - (__force __wsum)npt->src_pfx.in6.s6_addr16[i]); - dst_sum = csum_add(dst_sum, - (__force __wsum)npt->dst_pfx.in6.s6_addr16[i]); + src_sum = csum16_add(src_sum, + (__force __sum16)npt->src_pfx.in6.s6_addr16[i]); + dst_sum = csum16_add(dst_sum, + (__force __sum16)npt->dst_pfx.in6.s6_addr16[i]); } - npt->adjustment = (__force __sum16) csum_sub(src_sum, dst_sum); + npt->adjustment = csum16_sub(src_sum, dst_sum); return 0; } @@ -66,7 +85,7 @@ static bool ip6t_npt_map_pfx(const struct ip6t_npt_tginfo *npt, return false; } - sum = (__force __sum16) csum_add((__force __wsum)addr->s6_addr16[idx], + sum = csum16_add((__force __sum16)addr->s6_addr16[idx], npt->adjustment); if (sum == CSUM_MANGLED_0) sum = 0; diff --git a/trunk/net/ipv6/netfilter/ip6t_REJECT.c b/trunk/net/ipv6/netfilter/ip6t_REJECT.c index 029623dbd411..fd4fb34c51c7 100644 --- a/trunk/net/ipv6/netfilter/ip6t_REJECT.c +++ b/trunk/net/ipv6/netfilter/ip6t_REJECT.c @@ -132,7 +132,6 @@ static void send_reset(struct net *net, struct sk_buff *oldskb) ip6h->saddr = oip6h->daddr; ip6h->daddr = oip6h->saddr; - skb_reset_transport_header(nskb); tcph = (struct tcphdr *)skb_put(nskb, sizeof(struct tcphdr)); /* Truncate to length (no data) */ tcph->doff = sizeof(struct tcphdr)/4; diff --git a/trunk/net/ipv6/netfilter/ip6table_nat.c b/trunk/net/ipv6/netfilter/ip6table_nat.c index e0e788d25b14..6c8ae24b85eb 100644 --- a/trunk/net/ipv6/netfilter/ip6table_nat.c +++ b/trunk/net/ipv6/netfilter/ip6table_nat.c @@ -127,28 +127,23 @@ nf_nat_ipv6_fn(unsigned int hooknum, ret = nf_nat_rule_find(skb, hooknum, in, out, ct); if (ret != NF_ACCEPT) return ret; - } else { + } else pr_debug("Already setup manip %s for ct %p\n", maniptype == NF_NAT_MANIP_SRC ? "SRC" : "DST", ct); - if (nf_nat_oif_changed(hooknum, ctinfo, nat, out)) - goto oif_changed; - } break; default: /* ESTABLISHED */ NF_CT_ASSERT(ctinfo == IP_CT_ESTABLISHED || ctinfo == IP_CT_ESTABLISHED_REPLY); - if (nf_nat_oif_changed(hooknum, ctinfo, nat, out)) - goto oif_changed; + if (nf_nat_oif_changed(hooknum, ctinfo, nat, out)) { + nf_ct_kill_acct(ct, ctinfo, skb); + return NF_DROP; + } } return nf_nat_packet(ct, ctinfo, hooknum, skb); - -oif_changed: - nf_ct_kill_acct(ct, ctinfo, skb); - return NF_DROP; } static unsigned int diff --git a/trunk/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/trunk/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c index 137e245860ab..00ee17c3e893 100644 --- a/trunk/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c +++ b/trunk/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, } protoff = ipv6_skip_exthdr(skb, extoff, &nexthdr, &frag_off); /* - * (protoff == skb->len) means the packet has not data, just - * IPv6 and possibly extensions headers, but it is tracked anyway + * (protoff == skb->len) mean that the packet doesn't have no data + * except of IPv6 & ext headers. but it's tracked anyway. - YK */ if (protoff < 0 || (frag_off & htons(~0x7)) != 0) { pr_debug("ip6_conntrack_core: can't find proto in pkt\n"); diff --git a/trunk/net/ipv6/netfilter/nf_conntrack_reasm.c b/trunk/net/ipv6/netfilter/nf_conntrack_reasm.c index 3dacecc99065..22c8ea951185 100644 --- a/trunk/net/ipv6/netfilter/nf_conntrack_reasm.c +++ b/trunk/net/ipv6/netfilter/nf_conntrack_reasm.c @@ -311,10 +311,7 @@ static int nf_ct_frag6_queue(struct frag_queue *fq, struct sk_buff *skb, else fq->q.fragments = skb; - if (skb->dev) { - fq->iif = skb->dev->ifindex; - skb->dev = NULL; - } + skb->dev = NULL; fq->q.stamp = skb->tstamp; fq->q.meat += skb->len; if (payload_len > fq->q.max_size) diff --git a/trunk/net/iucv/iucv.c b/trunk/net/iucv/iucv.c index df082508362d..3ad1f9db5f8b 100644 --- a/trunk/net/iucv/iucv.c +++ b/trunk/net/iucv/iucv.c @@ -1806,7 +1806,7 @@ static void iucv_external_interrupt(struct ext_code ext_code, struct iucv_irq_data *p; struct iucv_irq_list *work; - inc_irq_stat(IRQEXT_IUC); + kstat_cpu(smp_processor_id()).irqs[EXTINT_IUC]++; p = iucv_irq_data[smp_processor_id()]; if (p->ippathid >= iucv_max_pathid) { WARN_ON(p->ippathid >= iucv_max_pathid); diff --git a/trunk/net/mac80211/cfg.c b/trunk/net/mac80211/cfg.c index 516fbc96feff..5c61677487cf 100644 --- a/trunk/net/mac80211/cfg.c +++ b/trunk/net/mac80211/cfg.c @@ -164,17 +164,7 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev, sta = sta_info_get(sdata, mac_addr); else sta = sta_info_get_bss(sdata, mac_addr); - /* - * The ASSOC test makes sure the driver is ready to - * receive the key. When wpa_supplicant has roamed - * using FT, it attempts to set the key before - * association has completed, this rejects that attempt - * so it will set the key again after assocation. - * - * TODO: accept the key if we have a station entry and - * add it to the device after the station. - */ - if (!sta || !test_sta_flag(sta, WLAN_STA_ASSOC)) { + if (!sta) { ieee80211_key_free(sdata->local, key); err = -ENOENT; goto out_unlock; @@ -1019,8 +1009,6 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev) if (old_probe_resp) kfree_rcu(old_probe_resp, rcu_head); - list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) - sta_info_flush(local, vlan); sta_info_flush(local, sdata); ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED); diff --git a/trunk/net/mac80211/chan.c b/trunk/net/mac80211/chan.c index 80e55527504b..53f03120db55 100644 --- a/trunk/net/mac80211/chan.c +++ b/trunk/net/mac80211/chan.c @@ -4,7 +4,6 @@ #include #include -#include #include #include "ieee80211_i.h" #include "driver-ops.h" @@ -198,15 +197,6 @@ static void __ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata) ctx = container_of(conf, struct ieee80211_chanctx, conf); - if (sdata->vif.type == NL80211_IFTYPE_AP) { - struct ieee80211_sub_if_data *vlan; - - /* for the VLAN list */ - ASSERT_RTNL(); - list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) - rcu_assign_pointer(vlan->vif.chanctx_conf, NULL); - } - ieee80211_unassign_vif_chanctx(sdata, ctx); if (ctx->refcount == 0) ieee80211_free_chanctx(local, ctx); @@ -326,15 +316,6 @@ int ieee80211_vif_use_channel(struct ieee80211_sub_if_data *sdata, goto out; } - if (sdata->vif.type == NL80211_IFTYPE_AP) { - struct ieee80211_sub_if_data *vlan; - - /* for the VLAN list */ - ASSERT_RTNL(); - list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) - rcu_assign_pointer(vlan->vif.chanctx_conf, &ctx->conf); - } - ieee80211_recalc_smps_chanctx(local, ctx); out: mutex_unlock(&local->chanctx_mtx); @@ -350,25 +331,6 @@ void ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata) mutex_unlock(&sdata->local->chanctx_mtx); } -void ieee80211_vif_vlan_copy_chanctx(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_local *local = sdata->local; - struct ieee80211_sub_if_data *ap; - struct ieee80211_chanctx_conf *conf; - - if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_AP_VLAN || !sdata->bss)) - return; - - ap = container_of(sdata->bss, struct ieee80211_sub_if_data, u.ap); - - mutex_lock(&local->chanctx_mtx); - - conf = rcu_dereference_protected(ap->vif.chanctx_conf, - lockdep_is_held(&local->chanctx_mtx)); - rcu_assign_pointer(sdata->vif.chanctx_conf, conf); - mutex_unlock(&local->chanctx_mtx); -} - void ieee80211_iter_chan_contexts_atomic( struct ieee80211_hw *hw, void (*iter)(struct ieee80211_hw *hw, diff --git a/trunk/net/mac80211/ibss.c b/trunk/net/mac80211/ibss.c index 6b7644e818d8..8881fc77fb13 100644 --- a/trunk/net/mac80211/ibss.c +++ b/trunk/net/mac80211/ibss.c @@ -703,8 +703,8 @@ static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata) sdata_info(sdata, "No active IBSS STAs - trying to scan for other IBSS networks with same SSID (merge)\n"); - ieee80211_request_ibss_scan(sdata, ifibss->ssid, ifibss->ssid_len, - NULL); + ieee80211_request_internal_scan(sdata, + ifibss->ssid, ifibss->ssid_len, NULL); } static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata) @@ -802,8 +802,9 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) IEEE80211_SCAN_INTERVAL)) { sdata_info(sdata, "Trigger new scan to find an IBSS to join\n"); - ieee80211_request_ibss_scan(sdata, ifibss->ssid, - ifibss->ssid_len, chan); + ieee80211_request_internal_scan(sdata, + ifibss->ssid, ifibss->ssid_len, + ifibss->fixed_channel ? ifibss->channel : NULL); } else { int interval = IEEE80211_SCAN_INTERVAL; diff --git a/trunk/net/mac80211/ieee80211_i.h b/trunk/net/mac80211/ieee80211_i.h index 2ed065c09562..42d0d0267730 100644 --- a/trunk/net/mac80211/ieee80211_i.h +++ b/trunk/net/mac80211/ieee80211_i.h @@ -92,6 +92,8 @@ struct ieee80211_bss { u32 device_ts; + u8 dtim_period; + bool wmm_used; bool uapsd_supported; @@ -138,6 +140,7 @@ enum ieee80211_bss_corrupt_data_flags { /** * enum ieee80211_valid_data_flags - BSS valid data flags + * @IEEE80211_BSS_VALID_DTIM: DTIM data was gathered from non-corrupt IE * @IEEE80211_BSS_VALID_WMM: WMM/UAPSD data was gathered from non-corrupt IE * @IEEE80211_BSS_VALID_RATES: Supported rates were gathered from non-corrupt IE * @IEEE80211_BSS_VALID_ERP: ERP flag was gathered from non-corrupt IE @@ -148,6 +151,7 @@ enum ieee80211_bss_corrupt_data_flags { * beacon/probe response. */ enum ieee80211_bss_valid_data_flags { + IEEE80211_BSS_VALID_DTIM = BIT(0), IEEE80211_BSS_VALID_WMM = BIT(1), IEEE80211_BSS_VALID_RATES = BIT(2), IEEE80211_BSS_VALID_ERP = BIT(3) @@ -436,7 +440,6 @@ struct ieee80211_if_managed { unsigned long timers_running; /* used for quiesce/restart */ bool powersave; /* powersave requested for this iface */ bool broken_ap; /* AP is broken -- turn off powersave */ - u8 dtim_period; enum ieee80211_smps_mode req_smps, /* requested smps mode */ driver_smps_mode; /* smps mode request */ @@ -770,10 +773,6 @@ struct ieee80211_sub_if_data { u32 mntr_flags; } u; - spinlock_t cleanup_stations_lock; - struct list_head cleanup_stations; - struct work_struct cleanup_stations_wk; - #ifdef CONFIG_MAC80211_DEBUGFS struct { struct dentry *dir; @@ -1330,9 +1329,9 @@ void ieee80211_mesh_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, /* scan/BSS handling */ void ieee80211_scan_work(struct work_struct *work); -int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata, - const u8 *ssid, u8 ssid_len, - struct ieee80211_channel *chan); +int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata, + const u8 *ssid, u8 ssid_len, + struct ieee80211_channel *chan); int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata, struct cfg80211_scan_request *req); void ieee80211_scan_cancel(struct ieee80211_local *local); @@ -1358,8 +1357,10 @@ int ieee80211_request_sched_scan_stop(struct ieee80211_sub_if_data *sdata); void ieee80211_sched_scan_stopped_work(struct work_struct *work); /* off-channel helpers */ -void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local); -void ieee80211_offchannel_return(struct ieee80211_local *local); +void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local, + bool offchannel_ps_enable); +void ieee80211_offchannel_return(struct ieee80211_local *local, + bool offchannel_ps_disable); void ieee80211_roc_setup(struct ieee80211_local *local); void ieee80211_start_next_roc(struct ieee80211_local *local); void ieee80211_roc_purge(struct ieee80211_sub_if_data *sdata); @@ -1627,7 +1628,6 @@ ieee80211_vif_use_channel(struct ieee80211_sub_if_data *sdata, const struct cfg80211_chan_def *chandef, enum ieee80211_chanctx_mode mode); void ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata); -void ieee80211_vif_vlan_copy_chanctx(struct ieee80211_sub_if_data *sdata); void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local, struct ieee80211_chanctx *chanctx); diff --git a/trunk/net/mac80211/iface.c b/trunk/net/mac80211/iface.c index 8be854e86cd9..09a80b55cf5a 100644 --- a/trunk/net/mac80211/iface.c +++ b/trunk/net/mac80211/iface.c @@ -207,8 +207,17 @@ void ieee80211_recalc_idle(struct ieee80211_local *local) static int ieee80211_change_mtu(struct net_device *dev, int new_mtu) { - if (new_mtu < 256 || new_mtu > IEEE80211_MAX_DATA_LEN) + int meshhdrlen; + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); + + meshhdrlen = (sdata->vif.type == NL80211_IFTYPE_MESH_POINT) ? 5 : 0; + + /* FIX: what would be proper limits for MTU? + * This interface uses 802.3 frames. */ + if (new_mtu < 256 || + new_mtu > IEEE80211_MAX_DATA_LEN - 24 - 6 - meshhdrlen) { return -EINVAL; + } dev->mtu = new_mtu; return 0; @@ -577,13 +586,11 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up) switch (sdata->vif.type) { case NL80211_IFTYPE_AP_VLAN: - /* no need to tell driver, but set carrier and chanctx */ - if (rtnl_dereference(sdata->bss->beacon)) { - ieee80211_vif_vlan_copy_chanctx(sdata); + /* no need to tell driver, but set carrier */ + if (rtnl_dereference(sdata->bss->beacon)) netif_carrier_on(dev); - } else { + else netif_carrier_off(dev); - } break; case NL80211_IFTYPE_MONITOR: if (sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) { @@ -832,7 +839,6 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, switch (sdata->vif.type) { case NL80211_IFTYPE_AP_VLAN: list_del(&sdata->u.vlan.list); - rcu_assign_pointer(sdata->vif.chanctx_conf, NULL); /* no need to tell driver */ break; case NL80211_IFTYPE_MONITOR: @@ -859,11 +865,20 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, cancel_work_sync(&sdata->work); /* * When we get here, the interface is marked down. - * Call synchronize_rcu() to wait for the RX path + * Call rcu_barrier() to wait both for the RX path * should it be using the interface and enqueuing - * frames at this very time on another CPU. + * frames at this very time on another CPU, and + * for the sta free call_rcu callbacks. + */ + rcu_barrier(); + + /* + * free_sta_rcu() enqueues a work for the actual + * sta cleanup, so we need to flush it while + * sdata is still valid. */ - synchronize_rcu(); + flush_workqueue(local->workqueue); + skb_queue_purge(&sdata->skb_queue); /* @@ -1483,15 +1498,6 @@ static void ieee80211_assign_perm_addr(struct ieee80211_local *local, mutex_unlock(&local->iflist_mtx); } -static void ieee80211_cleanup_sdata_stas_wk(struct work_struct *wk) -{ - struct ieee80211_sub_if_data *sdata; - - sdata = container_of(wk, struct ieee80211_sub_if_data, cleanup_stations_wk); - - ieee80211_cleanup_sdata_stas(sdata); -} - int ieee80211_if_add(struct ieee80211_local *local, const char *name, struct wireless_dev **new_wdev, enum nl80211_iftype type, struct vif_params *params) @@ -1567,10 +1573,6 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, INIT_LIST_HEAD(&sdata->key_list); - spin_lock_init(&sdata->cleanup_stations_lock); - INIT_LIST_HEAD(&sdata->cleanup_stations); - INIT_WORK(&sdata->cleanup_stations_wk, ieee80211_cleanup_sdata_stas_wk); - for (i = 0; i < IEEE80211_NUM_BANDS; i++) { struct ieee80211_supported_band *sband; sband = local->hw.wiphy->bands[i]; diff --git a/trunk/net/mac80211/mesh.c b/trunk/net/mac80211/mesh.c index 649ad513547f..1bf03f9ff3ba 100644 --- a/trunk/net/mac80211/mesh.c +++ b/trunk/net/mac80211/mesh.c @@ -163,7 +163,7 @@ int mesh_rmc_init(struct ieee80211_sub_if_data *sdata) return -ENOMEM; sdata->u.mesh.rmc->idx_mask = RMC_BUCKETS - 1; for (i = 0; i < RMC_BUCKETS; i++) - INIT_LIST_HEAD(&sdata->u.mesh.rmc->bucket[i]); + INIT_LIST_HEAD(&sdata->u.mesh.rmc->bucket[i].list); return 0; } @@ -177,7 +177,7 @@ void mesh_rmc_free(struct ieee80211_sub_if_data *sdata) return; for (i = 0; i < RMC_BUCKETS; i++) - list_for_each_entry_safe(p, n, &rmc->bucket[i], list) { + list_for_each_entry_safe(p, n, &rmc->bucket[i].list, list) { list_del(&p->list); kmem_cache_free(rm_cache, p); } @@ -210,7 +210,7 @@ int mesh_rmc_check(u8 *sa, struct ieee80211s_hdr *mesh_hdr, /* Don't care about endianness since only match matters */ memcpy(&seqnum, &mesh_hdr->seqnum, sizeof(mesh_hdr->seqnum)); idx = le32_to_cpu(mesh_hdr->seqnum) & rmc->idx_mask; - list_for_each_entry_safe(p, n, &rmc->bucket[idx], list) { + list_for_each_entry_safe(p, n, &rmc->bucket[idx].list, list) { ++entries; if (time_after(jiffies, p->exp_time) || (entries == RMC_QUEUE_MAX_LEN)) { @@ -229,7 +229,7 @@ int mesh_rmc_check(u8 *sa, struct ieee80211s_hdr *mesh_hdr, p->seqnum = seqnum; p->exp_time = jiffies + RMC_TIMEOUT; memcpy(p->sa, sa, ETH_ALEN); - list_add(&p->list, &rmc->bucket[idx]); + list_add(&p->list, &rmc->bucket[idx].list); return 0; } diff --git a/trunk/net/mac80211/mesh.h b/trunk/net/mac80211/mesh.h index 84c28c6101cd..7c9215fb2ac8 100644 --- a/trunk/net/mac80211/mesh.h +++ b/trunk/net/mac80211/mesh.h @@ -184,7 +184,7 @@ struct rmc_entry { }; struct mesh_rmc { - struct list_head bucket[RMC_BUCKETS]; + struct rmc_entry bucket[RMC_BUCKETS]; u32 idx_mask; }; diff --git a/trunk/net/mac80211/mesh_hwmp.c b/trunk/net/mac80211/mesh_hwmp.c index 2659e428b80c..47aeee2d8db1 100644 --- a/trunk/net/mac80211/mesh_hwmp.c +++ b/trunk/net/mac80211/mesh_hwmp.c @@ -215,7 +215,6 @@ static void prepare_frame_for_deferred_tx(struct ieee80211_sub_if_data *sdata, skb->priority = 7; info->control.vif = &sdata->vif; - info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING; ieee80211_set_qos_hdr(sdata, skb); } @@ -247,13 +246,11 @@ int mesh_path_error_tx(u8 ttl, u8 *target, __le32 target_sn, return -EAGAIN; skb = dev_alloc_skb(local->tx_headroom + - IEEE80211_ENCRYPT_HEADROOM + - IEEE80211_ENCRYPT_TAILROOM + hdr_len + 2 + 15 /* PERR IE */); if (!skb) return -1; - skb_reserve(skb, local->tx_headroom + IEEE80211_ENCRYPT_HEADROOM); + skb_reserve(skb, local->tx_headroom); mgmt = (struct ieee80211_mgmt *) skb_put(skb, hdr_len); memset(mgmt, 0, hdr_len); mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | diff --git a/trunk/net/mac80211/mlme.c b/trunk/net/mac80211/mlme.c index a3552929a21d..7753a9ca98a6 100644 --- a/trunk/net/mac80211/mlme.c +++ b/trunk/net/mac80211/mlme.c @@ -1074,8 +1074,12 @@ void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency) if (beaconint_us > latency) { local->ps_sdata = NULL; } else { + struct ieee80211_bss *bss; int maxslp = 1; - u8 dtimper = found->u.mgd.dtim_period; + u8 dtimper; + + bss = (void *)found->u.mgd.associated->priv; + dtimper = bss->dtim_period; /* If the TIM IE is invalid, pretend the value is 1 */ if (!dtimper) @@ -1406,17 +1410,10 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, ieee80211_led_assoc(local, 1); - if (local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD) { - /* - * If the AP is buggy we may get here with no DTIM period - * known, so assume it's 1 which is the only safe assumption - * in that case, although if the TIM IE is broken powersave - * probably just won't work at all. - */ - bss_conf->dtim_period = sdata->u.mgd.dtim_period ?: 1; - } else { + if (local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD) + bss_conf->dtim_period = bss->dtim_period; + else bss_conf->dtim_period = 0; - } bss_conf->assoc = 1; @@ -1565,8 +1562,6 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, sdata->u.mgd.timers_running = 0; - sdata->vif.bss_conf.dtim_period = 0; - ifmgd->flags = 0; ieee80211_vif_release_channel(sdata); } @@ -2378,18 +2373,11 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, struct ieee80211_channel *channel; bool need_ps = false; - if ((sdata->u.mgd.associated && - ether_addr_equal(mgmt->bssid, sdata->u.mgd.associated->bssid)) || - (sdata->u.mgd.assoc_data && - ether_addr_equal(mgmt->bssid, - sdata->u.mgd.assoc_data->bss->bssid))) { + if (sdata->u.mgd.associated && + ether_addr_equal(mgmt->bssid, sdata->u.mgd.associated->bssid)) { + bss = (void *)sdata->u.mgd.associated->priv; /* not previously set so we may need to recalc */ - need_ps = sdata->u.mgd.associated && !sdata->u.mgd.dtim_period; - - if (elems->tim && !elems->parse_error) { - struct ieee80211_tim_ie *tim_ie = elems->tim; - sdata->u.mgd.dtim_period = tim_ie->dtim_period; - } + need_ps = !bss->dtim_period; } if (elems->ds_params && elems->ds_params_len == 1) @@ -3908,41 +3896,20 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, /* kick off associate process */ ifmgd->assoc_data = assoc_data; - ifmgd->dtim_period = 0; err = ieee80211_prep_connection(sdata, req->bss, true); if (err) goto err_clear; - if (sdata->local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD) { - const struct cfg80211_bss_ies *beacon_ies; - - rcu_read_lock(); - beacon_ies = rcu_dereference(req->bss->beacon_ies); - if (!beacon_ies) { - /* - * Wait up to one beacon interval ... - * should this be more if we miss one? - */ - sdata_info(sdata, "waiting for beacon from %pM\n", - ifmgd->bssid); - assoc_data->timeout = - TU_TO_EXP_TIME(req->bss->beacon_interval); - } else { - const u8 *tim_ie = cfg80211_find_ie(WLAN_EID_TIM, - beacon_ies->data, - beacon_ies->len); - if (tim_ie && tim_ie[1] >= - sizeof(struct ieee80211_tim_ie)) { - const struct ieee80211_tim_ie *tim; - tim = (void *)(tim_ie + 2); - ifmgd->dtim_period = tim->dtim_period; - } - assoc_data->have_beacon = true; - assoc_data->sent_assoc = false; - assoc_data->timeout = jiffies; - } - rcu_read_unlock(); + if (!bss->dtim_period && + sdata->local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD) { + /* + * Wait up to one beacon interval ... + * should this be more if we miss one? + */ + sdata_info(sdata, "waiting for beacon from %pM\n", + ifmgd->bssid); + assoc_data->timeout = TU_TO_EXP_TIME(req->bss->beacon_interval); } else { assoc_data->have_beacon = true; assoc_data->sent_assoc = false; diff --git a/trunk/net/mac80211/offchannel.c b/trunk/net/mac80211/offchannel.c index a3ad4c3c80a3..a5379aea7d09 100644 --- a/trunk/net/mac80211/offchannel.c +++ b/trunk/net/mac80211/offchannel.c @@ -102,7 +102,8 @@ static void ieee80211_offchannel_ps_disable(struct ieee80211_sub_if_data *sdata) ieee80211_sta_reset_conn_monitor(sdata); } -void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local) +void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local, + bool offchannel_ps_enable) { struct ieee80211_sub_if_data *sdata; @@ -133,7 +134,8 @@ void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local) if (sdata->vif.type != NL80211_IFTYPE_MONITOR) { netif_tx_stop_all_queues(sdata->dev); - if (sdata->vif.type == NL80211_IFTYPE_STATION && + if (offchannel_ps_enable && + (sdata->vif.type == NL80211_IFTYPE_STATION) && sdata->u.mgd.associated) ieee80211_offchannel_ps_enable(sdata); } @@ -141,7 +143,8 @@ void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local) mutex_unlock(&local->iflist_mtx); } -void ieee80211_offchannel_return(struct ieee80211_local *local) +void ieee80211_offchannel_return(struct ieee80211_local *local, + bool offchannel_ps_disable) { struct ieee80211_sub_if_data *sdata; @@ -160,9 +163,11 @@ void ieee80211_offchannel_return(struct ieee80211_local *local) continue; /* Tell AP we're back */ - if (sdata->vif.type == NL80211_IFTYPE_STATION && - sdata->u.mgd.associated) - ieee80211_offchannel_ps_disable(sdata); + if (offchannel_ps_disable && + sdata->vif.type == NL80211_IFTYPE_STATION) { + if (sdata->u.mgd.associated) + ieee80211_offchannel_ps_disable(sdata); + } if (sdata->vif.type != NL80211_IFTYPE_MONITOR) { /* @@ -380,7 +385,7 @@ void ieee80211_sw_roc_work(struct work_struct *work) local->tmp_channel = NULL; ieee80211_hw_config(local, 0); - ieee80211_offchannel_return(local); + ieee80211_offchannel_return(local, true); } ieee80211_recalc_idle(local); diff --git a/trunk/net/mac80211/scan.c b/trunk/net/mac80211/scan.c index bf82e69d0601..8ed83dcc149f 100644 --- a/trunk/net/mac80211/scan.c +++ b/trunk/net/mac80211/scan.c @@ -113,6 +113,18 @@ ieee80211_bss_info_update(struct ieee80211_local *local, bss->valid_data |= IEEE80211_BSS_VALID_ERP; } + if (elems->tim && (!elems->parse_error || + !(bss->valid_data & IEEE80211_BSS_VALID_DTIM))) { + struct ieee80211_tim_ie *tim_ie = elems->tim; + bss->dtim_period = tim_ie->dtim_period; + if (!elems->parse_error) + bss->valid_data |= IEEE80211_BSS_VALID_DTIM; + } + + /* If the beacon had no TIM IE, or it was invalid, use 1 */ + if (beacon && !bss->dtim_period) + bss->dtim_period = 1; + /* replace old supported rates if we get new values */ if (!elems->parse_error || !(bss->valid_data & IEEE80211_BSS_VALID_RATES)) { @@ -292,7 +304,7 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted, if (!was_hw_scan) { ieee80211_configure_filter(local); drv_sw_scan_complete(local); - ieee80211_offchannel_return(local); + ieee80211_offchannel_return(local, true); } ieee80211_recalc_idle(local); @@ -341,7 +353,7 @@ static int ieee80211_start_sw_scan(struct ieee80211_local *local) local->next_scan_state = SCAN_DECISION; local->scan_channel_idx = 0; - ieee80211_offchannel_stop_vifs(local); + ieee80211_offchannel_stop_vifs(local, true); ieee80211_configure_filter(local); @@ -678,8 +690,12 @@ static void ieee80211_scan_state_suspend(struct ieee80211_local *local, local->scan_channel = NULL; ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); - /* disable PS */ - ieee80211_offchannel_return(local); + /* + * Re-enable vifs and beaconing. Leave PS + * in off-channel state..will put that back + * on-channel at the end of scanning. + */ + ieee80211_offchannel_return(local, false); *next_delay = HZ / 5; /* afterwards, resume scan & go to next channel */ @@ -689,7 +705,8 @@ static void ieee80211_scan_state_suspend(struct ieee80211_local *local, static void ieee80211_scan_state_resume(struct ieee80211_local *local, unsigned long *next_delay) { - ieee80211_offchannel_stop_vifs(local); + /* PS already is in off-channel mode */ + ieee80211_offchannel_stop_vifs(local, false); if (local->ops->flush) { drv_flush(local, false); @@ -815,9 +832,9 @@ int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata, return res; } -int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata, - const u8 *ssid, u8 ssid_len, - struct ieee80211_channel *chan) +int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata, + const u8 *ssid, u8 ssid_len, + struct ieee80211_channel *chan) { struct ieee80211_local *local = sdata->local; int ret = -EBUSY; @@ -831,36 +848,22 @@ int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata, /* fill internal scan request */ if (!chan) { - int i, max_n; - int n_ch = 0; + int i, nchan = 0; for (band = 0; band < IEEE80211_NUM_BANDS; band++) { if (!local->hw.wiphy->bands[band]) continue; - - max_n = local->hw.wiphy->bands[band]->n_channels; - for (i = 0; i < max_n; i++) { - struct ieee80211_channel *tmp_ch = + for (i = 0; + i < local->hw.wiphy->bands[band]->n_channels; + i++) { + local->int_scan_req->channels[nchan] = &local->hw.wiphy->bands[band]->channels[i]; - - if (tmp_ch->flags & (IEEE80211_CHAN_NO_IBSS | - IEEE80211_CHAN_DISABLED)) - continue; - - local->int_scan_req->channels[n_ch] = tmp_ch; - n_ch++; + nchan++; } } - if (WARN_ON_ONCE(n_ch == 0)) - goto unlock; - - local->int_scan_req->n_channels = n_ch; + local->int_scan_req->n_channels = nchan; } else { - if (WARN_ON_ONCE(chan->flags & (IEEE80211_CHAN_NO_IBSS | - IEEE80211_CHAN_DISABLED))) - goto unlock; - local->int_scan_req->channels[0] = chan; local->int_scan_req->n_channels = 1; } diff --git a/trunk/net/mac80211/sta_info.c b/trunk/net/mac80211/sta_info.c index ca9fde198188..f3e502502fee 100644 --- a/trunk/net/mac80211/sta_info.c +++ b/trunk/net/mac80211/sta_info.c @@ -91,8 +91,9 @@ static int sta_info_hash_del(struct ieee80211_local *local, return -ENOENT; } -static void cleanup_single_sta(struct sta_info *sta) +static void free_sta_work(struct work_struct *wk) { + struct sta_info *sta = container_of(wk, struct sta_info, free_sta_wk); int ac, i; struct tid_ampdu_tx *tid_tx; struct ieee80211_sub_if_data *sdata = sta->sdata; @@ -152,35 +153,11 @@ static void cleanup_single_sta(struct sta_info *sta) sta_info_free(local, sta); } -void ieee80211_cleanup_sdata_stas(struct ieee80211_sub_if_data *sdata) -{ - struct sta_info *sta; - - spin_lock_bh(&sdata->cleanup_stations_lock); - while (!list_empty(&sdata->cleanup_stations)) { - sta = list_first_entry(&sdata->cleanup_stations, - struct sta_info, list); - list_del(&sta->list); - spin_unlock_bh(&sdata->cleanup_stations_lock); - - cleanup_single_sta(sta); - - spin_lock_bh(&sdata->cleanup_stations_lock); - } - - spin_unlock_bh(&sdata->cleanup_stations_lock); -} - static void free_sta_rcu(struct rcu_head *h) { struct sta_info *sta = container_of(h, struct sta_info, rcu_head); - struct ieee80211_sub_if_data *sdata = sta->sdata; - spin_lock(&sdata->cleanup_stations_lock); - list_add_tail(&sta->list, &sdata->cleanup_stations); - spin_unlock(&sdata->cleanup_stations_lock); - - ieee80211_queue_work(&sdata->local->hw, &sdata->cleanup_stations_wk); + ieee80211_queue_work(&sta->local->hw, &sta->free_sta_wk); } /* protected by RCU */ @@ -333,6 +310,7 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, spin_lock_init(&sta->lock); INIT_WORK(&sta->drv_unblock_wk, sta_unblock); + INIT_WORK(&sta->free_sta_wk, free_sta_work); INIT_WORK(&sta->ampdu_mlme.work, ieee80211_ba_session_work); mutex_init(&sta->ampdu_mlme.mtx); @@ -884,7 +862,7 @@ void sta_info_init(struct ieee80211_local *local) void sta_info_stop(struct ieee80211_local *local) { - del_timer_sync(&local->sta_cleanup); + del_timer(&local->sta_cleanup); sta_info_flush(local, NULL); } @@ -913,20 +891,6 @@ int sta_info_flush(struct ieee80211_local *local, } mutex_unlock(&local->sta_mtx); - rcu_barrier(); - - if (sdata) { - ieee80211_cleanup_sdata_stas(sdata); - cancel_work_sync(&sdata->cleanup_stations_wk); - } else { - mutex_lock(&local->iflist_mtx); - list_for_each_entry(sdata, &local->interfaces, list) { - ieee80211_cleanup_sdata_stas(sdata); - cancel_work_sync(&sdata->cleanup_stations_wk); - } - mutex_unlock(&local->iflist_mtx); - } - return ret; } diff --git a/trunk/net/mac80211/sta_info.h b/trunk/net/mac80211/sta_info.h index 37c1889afd3a..1489bca9ea97 100644 --- a/trunk/net/mac80211/sta_info.h +++ b/trunk/net/mac80211/sta_info.h @@ -299,6 +299,7 @@ struct sta_info { spinlock_t lock; struct work_struct drv_unblock_wk; + struct work_struct free_sta_wk; u16 listen_interval; @@ -562,6 +563,4 @@ void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta); void ieee80211_sta_ps_deliver_poll_response(struct sta_info *sta); void ieee80211_sta_ps_deliver_uapsd(struct sta_info *sta); -void ieee80211_cleanup_sdata_stas(struct ieee80211_sub_if_data *sdata); - #endif /* STA_INFO_H */ diff --git a/trunk/net/mac80211/tx.c b/trunk/net/mac80211/tx.c index 467c1d1b66f2..e9eadc40c09c 100644 --- a/trunk/net/mac80211/tx.c +++ b/trunk/net/mac80211/tx.c @@ -1673,14 +1673,11 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb, chanctx_conf = rcu_dereference(tmp_sdata->vif.chanctx_conf); } - - if (chanctx_conf) - chan = chanctx_conf->def.chan; - else if (!local->use_chanctx) - chan = local->_oper_channel; - else + if (!chanctx_conf) goto fail_rcu; + chan = chanctx_conf->def.chan; + /* * Frame injection is not allowed if beaconing is not allowed * or if we need radar detection. Beaconing is usually not allowed when diff --git a/trunk/net/mac802154/wpan.c b/trunk/net/mac802154/wpan.c index 199b92261e94..1191039c2b1b 100644 --- a/trunk/net/mac802154/wpan.c +++ b/trunk/net/mac802154/wpan.c @@ -389,7 +389,7 @@ void mac802154_wpan_setup(struct net_device *dev) static int mac802154_process_data(struct net_device *dev, struct sk_buff *skb) { - return netif_rx_ni(skb); + return netif_rx(skb); } static int diff --git a/trunk/net/netfilter/Kconfig b/trunk/net/netfilter/Kconfig index 49e96df5fbc4..fefa514b9917 100644 --- a/trunk/net/netfilter/Kconfig +++ b/trunk/net/netfilter/Kconfig @@ -680,13 +680,6 @@ config NETFILTER_XT_TARGET_NFQUEUE To compile it as a module, choose M here. If unsure, say N. -config NETFILTER_XT_TARGET_NOTRACK - tristate '"NOTRACK" target support (DEPRECATED)' - depends on NF_CONNTRACK - depends on IP_NF_RAW || IP6_NF_RAW - depends on NETFILTER_ADVANCED - select NETFILTER_XT_TARGET_CT - config NETFILTER_XT_TARGET_RATEEST tristate '"RATEEST" target support' depends on NETFILTER_ADVANCED diff --git a/trunk/net/netfilter/nf_conntrack_core.c b/trunk/net/netfilter/nf_conntrack_core.c index e4a0c4fb3a7c..08cdc71d8e87 100644 --- a/trunk/net/netfilter/nf_conntrack_core.c +++ b/trunk/net/netfilter/nf_conntrack_core.c @@ -1376,12 +1376,11 @@ void nf_conntrack_cleanup(struct net *net) synchronize_net(); nf_conntrack_proto_fini(net); nf_conntrack_cleanup_net(net); -} -void nf_conntrack_cleanup_end(void) -{ - RCU_INIT_POINTER(nf_ct_destroy, NULL); - nf_conntrack_cleanup_init_net(); + if (net_eq(net, &init_net)) { + RCU_INIT_POINTER(nf_ct_destroy, NULL); + nf_conntrack_cleanup_init_net(); + } } void *nf_ct_alloc_hashtable(unsigned int *sizep, int nulls) @@ -1527,7 +1526,6 @@ static int nf_conntrack_init_init_net(void) */ #define UNCONFIRMED_NULLS_VAL ((1<<30)+0) #define DYING_NULLS_VAL ((1<<30)+1) -#define TEMPLATE_NULLS_VAL ((1<<30)+2) static int nf_conntrack_init_net(struct net *net) { @@ -1536,7 +1534,6 @@ static int nf_conntrack_init_net(struct net *net) atomic_set(&net->ct.count, 0); INIT_HLIST_NULLS_HEAD(&net->ct.unconfirmed, UNCONFIRMED_NULLS_VAL); INIT_HLIST_NULLS_HEAD(&net->ct.dying, DYING_NULLS_VAL); - INIT_HLIST_NULLS_HEAD(&net->ct.tmpl, TEMPLATE_NULLS_VAL); net->ct.stat = alloc_percpu(struct ip_conntrack_stat); if (!net->ct.stat) { ret = -ENOMEM; diff --git a/trunk/net/netfilter/nf_conntrack_netlink.c b/trunk/net/netfilter/nf_conntrack_netlink.c index 627b0e50b238..4e078cd84d83 100644 --- a/trunk/net/netfilter/nf_conntrack_netlink.c +++ b/trunk/net/netfilter/nf_conntrack_netlink.c @@ -2624,7 +2624,7 @@ ctnetlink_create_expect(struct net *net, u16 zone, if (!help) { if (!cda[CTA_EXPECT_TIMEOUT]) { err = -EINVAL; - goto err_out; + goto out; } exp->timeout.expires = jiffies + ntohl(nla_get_be32(cda[CTA_EXPECT_TIMEOUT])) * HZ; diff --git a/trunk/net/netfilter/nf_conntrack_standalone.c b/trunk/net/netfilter/nf_conntrack_standalone.c index e7185c684816..363285d544a1 100644 --- a/trunk/net/netfilter/nf_conntrack_standalone.c +++ b/trunk/net/netfilter/nf_conntrack_standalone.c @@ -575,7 +575,6 @@ static int __init nf_conntrack_standalone_init(void) static void __exit nf_conntrack_standalone_fini(void) { unregister_pernet_subsys(&nf_conntrack_net_ops); - nf_conntrack_cleanup_end(); } module_init(nf_conntrack_standalone_init); diff --git a/trunk/net/netfilter/nfnetlink_log.c b/trunk/net/netfilter/nfnetlink_log.c index 92fd8eca0d31..9f199f2e31fa 100644 --- a/trunk/net/netfilter/nfnetlink_log.c +++ b/trunk/net/netfilter/nfnetlink_log.c @@ -13,7 +13,6 @@ */ #include #include -#include #include #include #include @@ -385,7 +384,6 @@ __build_packet_message(struct nfulnl_instance *inst, struct nfgenmsg *nfmsg; sk_buff_data_t old_tail = inst->skb->tail; struct sock *sk; - const unsigned char *hwhdrp; nlh = nlmsg_put(inst->skb, 0, 0, NFNL_SUBSYS_ULOG << 8 | NFULNL_MSG_PACKET, @@ -487,17 +485,9 @@ __build_packet_message(struct nfulnl_instance *inst, if (indev && skb_mac_header_was_set(skb)) { if (nla_put_be16(inst->skb, NFULA_HWTYPE, htons(skb->dev->type)) || nla_put_be16(inst->skb, NFULA_HWLEN, - htons(skb->dev->hard_header_len))) - goto nla_put_failure; - - hwhdrp = skb_mac_header(skb); - - if (skb->dev->type == ARPHRD_SIT) - hwhdrp -= ETH_HLEN; - - if (hwhdrp >= skb->head && - nla_put(inst->skb, NFULA_HWHEADER, - skb->dev->hard_header_len, hwhdrp)) + htons(skb->dev->hard_header_len)) || + nla_put(inst->skb, NFULA_HWHEADER, skb->dev->hard_header_len, + skb_mac_header(skb))) goto nla_put_failure; } diff --git a/trunk/net/netfilter/x_tables.c b/trunk/net/netfilter/x_tables.c index 7b3a9e5999c0..8d987c3573fd 100644 --- a/trunk/net/netfilter/x_tables.c +++ b/trunk/net/netfilter/x_tables.c @@ -345,27 +345,19 @@ int xt_find_revision(u8 af, const char *name, u8 revision, int target, } EXPORT_SYMBOL_GPL(xt_find_revision); -static char * -textify_hooks(char *buf, size_t size, unsigned int mask, uint8_t nfproto) +static char *textify_hooks(char *buf, size_t size, unsigned int mask) { - static const char *const inetbr_names[] = { + static const char *const names[] = { "PREROUTING", "INPUT", "FORWARD", "OUTPUT", "POSTROUTING", "BROUTING", }; - static const char *const arp_names[] = { - "INPUT", "FORWARD", "OUTPUT", - }; - const char *const *names; - unsigned int i, max; + unsigned int i; char *p = buf; bool np = false; int res; - names = (nfproto == NFPROTO_ARP) ? arp_names : inetbr_names; - max = (nfproto == NFPROTO_ARP) ? ARRAY_SIZE(arp_names) : - ARRAY_SIZE(inetbr_names); *p = '\0'; - for (i = 0; i < max; ++i) { + for (i = 0; i < ARRAY_SIZE(names); ++i) { if (!(mask & (1 << i))) continue; res = snprintf(p, size, "%s%s", np ? "/" : "", names[i]); @@ -410,10 +402,8 @@ int xt_check_match(struct xt_mtchk_param *par, pr_err("%s_tables: %s match: used from hooks %s, but only " "valid from %s\n", xt_prefix[par->family], par->match->name, - textify_hooks(used, sizeof(used), par->hook_mask, - par->family), - textify_hooks(allow, sizeof(allow), par->match->hooks, - par->family)); + textify_hooks(used, sizeof(used), par->hook_mask), + textify_hooks(allow, sizeof(allow), par->match->hooks)); return -EINVAL; } if (par->match->proto && (par->match->proto != proto || inv_proto)) { @@ -585,10 +575,8 @@ int xt_check_target(struct xt_tgchk_param *par, pr_err("%s_tables: %s target: used from hooks %s, but only " "usable from %s\n", xt_prefix[par->family], par->target->name, - textify_hooks(used, sizeof(used), par->hook_mask, - par->family), - textify_hooks(allow, sizeof(allow), par->target->hooks, - par->family)); + textify_hooks(used, sizeof(used), par->hook_mask), + textify_hooks(allow, sizeof(allow), par->target->hooks)); return -EINVAL; } if (par->target->proto && (par->target->proto != proto || inv_proto)) { diff --git a/trunk/net/netfilter/xt_CT.c b/trunk/net/netfilter/xt_CT.c index bde009ed8d3b..ae7f5daeee43 100644 --- a/trunk/net/netfilter/xt_CT.c +++ b/trunk/net/netfilter/xt_CT.c @@ -109,7 +109,7 @@ static int xt_ct_tg_check_v0(const struct xt_tgchk_param *par) struct xt_ct_target_info *info = par->targinfo; struct nf_conntrack_tuple t; struct nf_conn *ct; - int ret = -EOPNOTSUPP; + int ret; if (info->flags & ~XT_CT_NOTRACK) return -EINVAL; @@ -149,10 +149,6 @@ static int xt_ct_tg_check_v0(const struct xt_tgchk_param *par) __set_bit(IPS_TEMPLATE_BIT, &ct->status); __set_bit(IPS_CONFIRMED_BIT, &ct->status); - - /* Overload tuple linked list to put us in template list. */ - hlist_nulls_add_head_rcu(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnnode, - &par->net->ct.tmpl); out: info->ct = ct; return 0; @@ -247,7 +243,7 @@ static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par) struct xt_ct_target_info_v1 *info = par->targinfo; struct nf_conntrack_tuple t; struct nf_conn *ct; - int ret = -EOPNOTSUPP; + int ret; if (info->flags & ~XT_CT_NOTRACK) return -EINVAL; @@ -293,10 +289,6 @@ static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par) __set_bit(IPS_TEMPLATE_BIT, &ct->status); __set_bit(IPS_CONFIRMED_BIT, &ct->status); - - /* Overload tuple linked list to put us in template list. */ - hlist_nulls_add_head_rcu(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnnode, - &par->net->ct.tmpl); out: info->ct = ct; return 0; @@ -385,60 +377,14 @@ static struct xt_target xt_ct_tg_reg[] __read_mostly = { }, }; -static unsigned int -notrack_tg(struct sk_buff *skb, const struct xt_action_param *par) -{ - /* Previously seen (loopback)? Ignore. */ - if (skb->nfct != NULL) - return XT_CONTINUE; - - skb->nfct = &nf_ct_untracked_get()->ct_general; - skb->nfctinfo = IP_CT_NEW; - nf_conntrack_get(skb->nfct); - - return XT_CONTINUE; -} - -static int notrack_chk(const struct xt_tgchk_param *par) -{ - if (!par->net->xt.notrack_deprecated_warning) { - pr_info("netfilter: NOTRACK target is deprecated, " - "use CT instead or upgrade iptables\n"); - par->net->xt.notrack_deprecated_warning = true; - } - return 0; -} - -static struct xt_target notrack_tg_reg __read_mostly = { - .name = "NOTRACK", - .revision = 0, - .family = NFPROTO_UNSPEC, - .checkentry = notrack_chk, - .target = notrack_tg, - .table = "raw", - .me = THIS_MODULE, -}; - static int __init xt_ct_tg_init(void) { - int ret; - - ret = xt_register_target(¬rack_tg_reg); - if (ret < 0) - return ret; - - ret = xt_register_targets(xt_ct_tg_reg, ARRAY_SIZE(xt_ct_tg_reg)); - if (ret < 0) { - xt_unregister_target(¬rack_tg_reg); - return ret; - } - return 0; + return xt_register_targets(xt_ct_tg_reg, ARRAY_SIZE(xt_ct_tg_reg)); } static void __exit xt_ct_tg_exit(void) { xt_unregister_targets(xt_ct_tg_reg, ARRAY_SIZE(xt_ct_tg_reg)); - xt_unregister_target(¬rack_tg_reg); } module_init(xt_ct_tg_init); @@ -448,5 +394,3 @@ MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Xtables: connection tracking target"); MODULE_ALIAS("ipt_CT"); MODULE_ALIAS("ip6t_CT"); -MODULE_ALIAS("ipt_NOTRACK"); -MODULE_ALIAS("ip6t_NOTRACK"); diff --git a/trunk/net/netfilter/xt_hashlimit.c b/trunk/net/netfilter/xt_hashlimit.c index a9d7af953ceb..26a668a84aa2 100644 --- a/trunk/net/netfilter/xt_hashlimit.c +++ b/trunk/net/netfilter/xt_hashlimit.c @@ -157,22 +157,11 @@ dsthash_find(const struct xt_hashlimit_htable *ht, /* allocate dsthash_ent, initialize dst, put in htable and lock it */ static struct dsthash_ent * dsthash_alloc_init(struct xt_hashlimit_htable *ht, - const struct dsthash_dst *dst, bool *race) + const struct dsthash_dst *dst) { struct dsthash_ent *ent; spin_lock(&ht->lock); - - /* Two or more packets may race to create the same entry in the - * hashtable, double check if this packet lost race. - */ - ent = dsthash_find(ht, dst); - if (ent != NULL) { - spin_unlock(&ht->lock); - *race = true; - return ent; - } - /* initialize hash with random val at the time we allocate * the first hashtable entry */ if (unlikely(!ht->rnd_initialized)) { @@ -329,10 +318,7 @@ static void htable_destroy(struct xt_hashlimit_htable *hinfo) parent = hashlimit_net->ipt_hashlimit; else parent = hashlimit_net->ip6t_hashlimit; - - if(parent != NULL) - remove_proc_entry(hinfo->pde->name, parent); - + remove_proc_entry(hinfo->pde->name, parent); htable_selective_cleanup(hinfo, select_all); vfree(hinfo); } @@ -599,7 +585,6 @@ hashlimit_mt(const struct sk_buff *skb, struct xt_action_param *par) unsigned long now = jiffies; struct dsthash_ent *dh; struct dsthash_dst dst; - bool race = false; u32 cost; if (hashlimit_init_dst(hinfo, &dst, skb, par->thoff) < 0) @@ -608,18 +593,13 @@ hashlimit_mt(const struct sk_buff *skb, struct xt_action_param *par) rcu_read_lock_bh(); dh = dsthash_find(hinfo, &dst); if (dh == NULL) { - dh = dsthash_alloc_init(hinfo, &dst, &race); + dh = dsthash_alloc_init(hinfo, &dst); if (dh == NULL) { rcu_read_unlock_bh(); goto hotdrop; - } else if (race) { - /* Already got an entry, update expiration timeout */ - dh->expires = now + msecs_to_jiffies(hinfo->cfg.expire); - rateinfo_recalc(dh, now, hinfo->cfg.mode); - } else { - dh->expires = jiffies + msecs_to_jiffies(hinfo->cfg.expire); - rateinfo_init(dh, hinfo); } + dh->expires = jiffies + msecs_to_jiffies(hinfo->cfg.expire); + rateinfo_init(dh, hinfo); } else { /* update expiration timeout */ dh->expires = now + msecs_to_jiffies(hinfo->cfg.expire); @@ -876,27 +856,6 @@ static int __net_init hashlimit_proc_net_init(struct net *net) static void __net_exit hashlimit_proc_net_exit(struct net *net) { - struct xt_hashlimit_htable *hinfo; - struct hlist_node *pos; - struct proc_dir_entry *pde; - struct hashlimit_net *hashlimit_net = hashlimit_pernet(net); - - /* recent_net_exit() is called before recent_mt_destroy(). Make sure - * that the parent xt_recent proc entry is is empty before trying to - * remove it. - */ - mutex_lock(&hashlimit_mutex); - pde = hashlimit_net->ipt_hashlimit; - if (pde == NULL) - pde = hashlimit_net->ip6t_hashlimit; - - hlist_for_each_entry(hinfo, pos, &hashlimit_net->htables, node) - remove_proc_entry(hinfo->pde->name, pde); - - hashlimit_net->ipt_hashlimit = NULL; - hashlimit_net->ip6t_hashlimit = NULL; - mutex_unlock(&hashlimit_mutex); - proc_net_remove(net, "ipt_hashlimit"); #if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) proc_net_remove(net, "ip6t_hashlimit"); @@ -913,6 +872,9 @@ static int __net_init hashlimit_net_init(struct net *net) static void __net_exit hashlimit_net_exit(struct net *net) { + struct hashlimit_net *hashlimit_net = hashlimit_pernet(net); + + BUG_ON(!hlist_empty(&hashlimit_net->htables)); hashlimit_proc_net_exit(net); } diff --git a/trunk/net/netfilter/xt_recent.c b/trunk/net/netfilter/xt_recent.c index 978efc9b555a..4635c9b00459 100644 --- a/trunk/net/netfilter/xt_recent.c +++ b/trunk/net/netfilter/xt_recent.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include @@ -311,14 +310,6 @@ recent_mt(const struct sk_buff *skb, struct xt_action_param *par) return ret; } -static void recent_table_free(void *addr) -{ - if (is_vmalloc_addr(addr)) - vfree(addr); - else - kfree(addr); -} - static int recent_mt_check(const struct xt_mtchk_param *par, const struct xt_recent_mtinfo_v1 *info) { @@ -331,7 +322,6 @@ static int recent_mt_check(const struct xt_mtchk_param *par, #endif unsigned int i; int ret = -EINVAL; - size_t sz; if (unlikely(!hash_rnd_inited)) { get_random_bytes(&hash_rnd, sizeof(hash_rnd)); @@ -370,11 +360,8 @@ static int recent_mt_check(const struct xt_mtchk_param *par, goto out; } - sz = sizeof(*t) + sizeof(t->iphash[0]) * ip_list_hash_size; - if (sz <= PAGE_SIZE) - t = kzalloc(sz, GFP_KERNEL); - else - t = vzalloc(sz); + t = kzalloc(sizeof(*t) + sizeof(t->iphash[0]) * ip_list_hash_size, + GFP_KERNEL); if (t == NULL) { ret = -ENOMEM; goto out; @@ -390,14 +377,14 @@ static int recent_mt_check(const struct xt_mtchk_param *par, uid = make_kuid(&init_user_ns, ip_list_uid); gid = make_kgid(&init_user_ns, ip_list_gid); if (!uid_valid(uid) || !gid_valid(gid)) { - recent_table_free(t); + kfree(t); ret = -EINVAL; goto out; } pde = proc_create_data(t->name, ip_list_perms, recent_net->xt_recent, &recent_mt_fops, t); if (pde == NULL) { - recent_table_free(t); + kfree(t); ret = -ENOMEM; goto out; } @@ -444,11 +431,10 @@ static void recent_mt_destroy(const struct xt_mtdtor_param *par) list_del(&t->list); spin_unlock_bh(&recent_lock); #ifdef CONFIG_PROC_FS - if (recent_net->xt_recent != NULL) - remove_proc_entry(t->name, recent_net->xt_recent); + remove_proc_entry(t->name, recent_net->xt_recent); #endif recent_table_flush(t); - recent_table_free(t); + kfree(t); } mutex_unlock(&recent_mutex); } @@ -629,20 +615,6 @@ static int __net_init recent_proc_net_init(struct net *net) static void __net_exit recent_proc_net_exit(struct net *net) { - struct recent_net *recent_net = recent_pernet(net); - struct recent_table *t; - - /* recent_net_exit() is called before recent_mt_destroy(). Make sure - * that the parent xt_recent proc entry is is empty before trying to - * remove it. - */ - spin_lock_bh(&recent_lock); - list_for_each_entry(t, &recent_net->tables, list) - remove_proc_entry(t->name, recent_net->xt_recent); - - recent_net->xt_recent = NULL; - spin_unlock_bh(&recent_lock); - proc_net_remove(net, "xt_recent"); } #else @@ -666,6 +638,9 @@ static int __net_init recent_net_init(struct net *net) static void __net_exit recent_net_exit(struct net *net) { + struct recent_net *recent_net = recent_pernet(net); + + BUG_ON(!list_empty(&recent_net->tables)); recent_proc_net_exit(net); } diff --git a/trunk/net/sctp/Kconfig b/trunk/net/sctp/Kconfig index 7521d944c0fb..c26210618e14 100644 --- a/trunk/net/sctp/Kconfig +++ b/trunk/net/sctp/Kconfig @@ -68,7 +68,7 @@ config SCTP_DBG_OBJCNT If unsure, say N choice prompt "Default SCTP cookie HMAC encoding" - default SCTP_DEFAULT_COOKIE_HMAC_MD5 + default SCTP_COOKIE_HMAC_MD5 help This option sets the default sctp cookie hmac algorithm when in doubt select 'md5' diff --git a/trunk/net/sctp/outqueue.c b/trunk/net/sctp/outqueue.c index 9bcdbd02d777..379c81dee9d1 100644 --- a/trunk/net/sctp/outqueue.c +++ b/trunk/net/sctp/outqueue.c @@ -224,7 +224,7 @@ void sctp_outq_init(struct sctp_association *asoc, struct sctp_outq *q) /* Free the outqueue structure and any related pending chunks. */ -static void __sctp_outq_teardown(struct sctp_outq *q) +void sctp_outq_teardown(struct sctp_outq *q) { struct sctp_transport *transport; struct list_head *lchunk, *temp; @@ -277,6 +277,8 @@ static void __sctp_outq_teardown(struct sctp_outq *q) sctp_chunk_free(chunk); } + q->error = 0; + /* Throw away any leftover control chunks. */ list_for_each_entry_safe(chunk, tmp, &q->control_chunk_list, list) { list_del_init(&chunk->list); @@ -284,17 +286,11 @@ static void __sctp_outq_teardown(struct sctp_outq *q) } } -void sctp_outq_teardown(struct sctp_outq *q) -{ - __sctp_outq_teardown(q); - sctp_outq_init(q->asoc, q); -} - /* Free the outqueue structure and any related pending chunks. */ void sctp_outq_free(struct sctp_outq *q) { /* Throw away leftover chunks. */ - __sctp_outq_teardown(q); + sctp_outq_teardown(q); /* If we were kmalloc()'d, free the memory. */ if (q->malloced) diff --git a/trunk/net/sctp/sm_statefuns.c b/trunk/net/sctp/sm_statefuns.c index 5131fcfedb03..618ec7e216ca 100644 --- a/trunk/net/sctp/sm_statefuns.c +++ b/trunk/net/sctp/sm_statefuns.c @@ -1779,10 +1779,8 @@ static sctp_disposition_t sctp_sf_do_dupcook_a(struct net *net, /* Update the content of current association. */ sctp_add_cmd_sf(commands, SCTP_CMD_UPDATE_ASSOC, SCTP_ASOC(new_asoc)); - sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, SCTP_ULPEVENT(ev)); - sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, - SCTP_STATE(SCTP_STATE_ESTABLISHED)); sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl)); + sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, SCTP_ULPEVENT(ev)); return SCTP_DISPOSITION_CONSUME; nomem_ev: diff --git a/trunk/net/sctp/sysctl.c b/trunk/net/sctp/sysctl.c index bf3c6e8fc401..043889ac86c0 100644 --- a/trunk/net/sctp/sysctl.c +++ b/trunk/net/sctp/sysctl.c @@ -366,11 +366,7 @@ int sctp_sysctl_net_register(struct net *net) void sctp_sysctl_net_unregister(struct net *net) { - struct ctl_table *table; - - table = net->sctp.sysctl_header->ctl_table_arg; unregister_net_sysctl_table(net->sctp.sysctl_header); - kfree(table); } static struct ctl_table_header * sctp_sysctl_header; diff --git a/trunk/net/sunrpc/clnt.c b/trunk/net/sunrpc/clnt.c index 507b5e84fbdb..822f020fa7f4 100644 --- a/trunk/net/sunrpc/clnt.c +++ b/trunk/net/sunrpc/clnt.c @@ -555,7 +555,7 @@ EXPORT_SYMBOL_GPL(rpc_clone_client); * rpc_clone_client_set_auth - Clone an RPC client structure and set its auth * * @clnt: RPC client whose parameters are copied - * @flavor: security flavor for new client + * @auth: security flavor for new client * * Returns a fresh RPC client or an ERR_PTR. */ @@ -610,6 +610,11 @@ EXPORT_SYMBOL_GPL(rpc_killall_tasks); */ void rpc_shutdown_client(struct rpc_clnt *clnt) { + /* + * To avoid deadlock, never call rpc_shutdown_client from a + * workqueue context! + */ + WARN_ON_ONCE(current->flags & PF_WQ_WORKER); might_sleep(); dprintk_rcu("RPC: shutting down %s client for %s\n", diff --git a/trunk/net/sunrpc/sched.c b/trunk/net/sunrpc/sched.c index bfa31714581f..d17a704aaf5f 100644 --- a/trunk/net/sunrpc/sched.c +++ b/trunk/net/sunrpc/sched.c @@ -934,35 +934,16 @@ struct rpc_task *rpc_new_task(const struct rpc_task_setup *setup_data) return task; } -/* - * rpc_free_task - release rpc task and perform cleanups - * - * Note that we free up the rpc_task _after_ rpc_release_calldata() - * in order to work around a workqueue dependency issue. - * - * Tejun Heo states: - * "Workqueue currently considers two work items to be the same if they're - * on the same address and won't execute them concurrently - ie. it - * makes a work item which is queued again while being executed wait - * for the previous execution to complete. - * - * If a work function frees the work item, and then waits for an event - * which should be performed by another work item and *that* work item - * recycles the freed work item, it can create a false dependency loop. - * There really is no reliable way to detect this short of verifying - * every memory free." - * - */ static void rpc_free_task(struct rpc_task *task) { - unsigned short tk_flags = task->tk_flags; - - rpc_release_calldata(task->tk_ops, task->tk_calldata); + const struct rpc_call_ops *tk_ops = task->tk_ops; + void *calldata = task->tk_calldata; - if (tk_flags & RPC_TASK_DYNAMIC) { + if (task->tk_flags & RPC_TASK_DYNAMIC) { dprintk("RPC: %5u freeing task\n", task->tk_pid); mempool_free(task, rpc_task_mempool); } + rpc_release_calldata(tk_ops, calldata); } static void rpc_async_release(struct work_struct *work) @@ -972,7 +953,8 @@ static void rpc_async_release(struct work_struct *work) static void rpc_release_resources_task(struct rpc_task *task) { - xprt_release(task); + if (task->tk_rqstp) + xprt_release(task); if (task->tk_msg.rpc_cred) { put_rpccred(task->tk_msg.rpc_cred); task->tk_msg.rpc_cred = NULL; diff --git a/trunk/net/sunrpc/xprt.c b/trunk/net/sunrpc/xprt.c index 33811db8788a..bd462a532acf 100644 --- a/trunk/net/sunrpc/xprt.c +++ b/trunk/net/sunrpc/xprt.c @@ -1136,18 +1136,10 @@ static void xprt_request_init(struct rpc_task *task, struct rpc_xprt *xprt) void xprt_release(struct rpc_task *task) { struct rpc_xprt *xprt; - struct rpc_rqst *req = task->tk_rqstp; + struct rpc_rqst *req; - if (req == NULL) { - if (task->tk_client) { - rcu_read_lock(); - xprt = rcu_dereference(task->tk_client->cl_xprt); - if (xprt->snd_task == task) - xprt_release_write(xprt, task); - rcu_read_unlock(); - } + if (!(req = task->tk_rqstp)) return; - } xprt = req->rq_xprt; if (task->tk_ops->rpc_count_stats != NULL) diff --git a/trunk/net/wireless/core.c b/trunk/net/wireless/core.c index b677eab55b68..14d990400354 100644 --- a/trunk/net/wireless/core.c +++ b/trunk/net/wireless/core.c @@ -866,7 +866,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb, /* allow mac80211 to determine the timeout */ wdev->ps_timeout = -1; - netdev_set_default_ethtool_ops(dev, &cfg80211_ethtool_ops); + if (!dev->ethtool_ops) + dev->ethtool_ops = &cfg80211_ethtool_ops; if ((wdev->iftype == NL80211_IFTYPE_STATION || wdev->iftype == NL80211_IFTYPE_P2P_CLIENT || diff --git a/trunk/net/xfrm/xfrm_policy.c b/trunk/net/xfrm/xfrm_policy.c index 07c585756d2a..41eabc46f110 100644 --- a/trunk/net/xfrm/xfrm_policy.c +++ b/trunk/net/xfrm/xfrm_policy.c @@ -2656,7 +2656,7 @@ static void xfrm_policy_fini(struct net *net) WARN_ON(!hlist_empty(&net->xfrm.policy_inexact[dir])); htab = &net->xfrm.policy_bydst[dir]; - sz = (htab->hmask + 1) * sizeof(struct hlist_head); + sz = (htab->hmask + 1); WARN_ON(!hlist_empty(htab->table)); xfrm_hash_free(htab->table, sz); } diff --git a/trunk/net/xfrm/xfrm_replay.c b/trunk/net/xfrm/xfrm_replay.c index 35754cc8a9e5..765f6fe951eb 100644 --- a/trunk/net/xfrm/xfrm_replay.c +++ b/trunk/net/xfrm/xfrm_replay.c @@ -242,13 +242,11 @@ static void xfrm_replay_advance_bmp(struct xfrm_state *x, __be32 net_seq) u32 diff; struct xfrm_replay_state_esn *replay_esn = x->replay_esn; u32 seq = ntohl(net_seq); - u32 pos; + u32 pos = (replay_esn->seq - 1) % replay_esn->replay_window; if (!replay_esn->replay_window) return; - pos = (replay_esn->seq - 1) % replay_esn->replay_window; - if (seq > replay_esn->seq) { diff = seq - replay_esn->seq; diff --git a/trunk/security/capability.c b/trunk/security/capability.c index 579775088967..0fe5a026aef8 100644 --- a/trunk/security/capability.c +++ b/trunk/security/capability.c @@ -709,31 +709,16 @@ static void cap_req_classify_flow(const struct request_sock *req, { } -static int cap_tun_dev_alloc_security(void **security) -{ - return 0; -} - -static void cap_tun_dev_free_security(void *security) -{ -} - static int cap_tun_dev_create(void) { return 0; } -static int cap_tun_dev_attach_queue(void *security) -{ - return 0; -} - -static int cap_tun_dev_attach(struct sock *sk, void *security) +static void cap_tun_dev_post_create(struct sock *sk) { - return 0; } -static int cap_tun_dev_open(void *security) +static int cap_tun_dev_attach(struct sock *sk) { return 0; } @@ -1065,11 +1050,8 @@ void __init security_fixup_ops(struct security_operations *ops) set_to_cap_if_null(ops, secmark_refcount_inc); set_to_cap_if_null(ops, secmark_refcount_dec); set_to_cap_if_null(ops, req_classify_flow); - set_to_cap_if_null(ops, tun_dev_alloc_security); - set_to_cap_if_null(ops, tun_dev_free_security); set_to_cap_if_null(ops, tun_dev_create); - set_to_cap_if_null(ops, tun_dev_open); - set_to_cap_if_null(ops, tun_dev_attach_queue); + set_to_cap_if_null(ops, tun_dev_post_create); set_to_cap_if_null(ops, tun_dev_attach); #endif /* CONFIG_SECURITY_NETWORK */ #ifdef CONFIG_SECURITY_NETWORK_XFRM diff --git a/trunk/security/device_cgroup.c b/trunk/security/device_cgroup.c index d794abcc4b3b..19ecc8de9e6b 100644 --- a/trunk/security/device_cgroup.c +++ b/trunk/security/device_cgroup.c @@ -215,9 +215,7 @@ static void devcgroup_css_free(struct cgroup *cgroup) struct dev_cgroup *dev_cgroup; dev_cgroup = cgroup_to_devcgroup(cgroup); - mutex_lock(&devcgroup_mutex); dev_exception_clean(dev_cgroup); - mutex_unlock(&devcgroup_mutex); kfree(dev_cgroup); } diff --git a/trunk/security/integrity/evm/evm_crypto.c b/trunk/security/integrity/evm/evm_crypto.c index 7dd538ef5b83..dfb26918699c 100644 --- a/trunk/security/integrity/evm/evm_crypto.c +++ b/trunk/security/integrity/evm/evm_crypto.c @@ -205,9 +205,9 @@ int evm_update_evmxattr(struct dentry *dentry, const char *xattr_name, rc = __vfs_setxattr_noperm(dentry, XATTR_NAME_EVM, &xattr_data, sizeof(xattr_data), 0); - } else if (rc == -ENODATA && inode->i_op->removexattr) { - rc = inode->i_op->removexattr(dentry, XATTR_NAME_EVM); } + else if (rc == -ENODATA) + rc = inode->i_op->removexattr(dentry, XATTR_NAME_EVM); return rc; } diff --git a/trunk/security/integrity/ima/ima.h b/trunk/security/integrity/ima/ima.h index 079a85dc37b2..3b2adb794f15 100644 --- a/trunk/security/integrity/ima/ima.h +++ b/trunk/security/integrity/ima/ima.h @@ -139,7 +139,6 @@ void ima_delete_rules(void); /* Appraise integrity measurements */ #define IMA_APPRAISE_ENFORCE 0x01 #define IMA_APPRAISE_FIX 0x02 -#define IMA_APPRAISE_MODULES 0x04 #ifdef CONFIG_IMA_APPRAISE int ima_appraise_measurement(struct integrity_iint_cache *iint, diff --git a/trunk/security/integrity/ima/ima_main.c b/trunk/security/integrity/ima/ima_main.c index dba965de90d3..45de18e9a6f2 100644 --- a/trunk/security/integrity/ima/ima_main.c +++ b/trunk/security/integrity/ima/ima_main.c @@ -291,15 +291,11 @@ EXPORT_SYMBOL_GPL(ima_file_check); */ int ima_module_check(struct file *file) { - int rc = 0; + int rc; - if (!file) { - if (ima_appraise & IMA_APPRAISE_MODULES) { -#ifndef CONFIG_MODULE_SIG_FORCE - rc = -EACCES; /* INTEGRITY_UNKNOWN */ -#endif - } - } else + if (!file) + rc = INTEGRITY_UNKNOWN; + else rc = process_measurement(file, file->f_dentry->d_name.name, MAY_EXEC, MODULE_CHECK); return (ima_appraise & IMA_APPRAISE_ENFORCE) ? rc : 0; diff --git a/trunk/security/integrity/ima/ima_policy.c b/trunk/security/integrity/ima/ima_policy.c index 479fca940bb5..af7d182d5a46 100644 --- a/trunk/security/integrity/ima/ima_policy.c +++ b/trunk/security/integrity/ima/ima_policy.c @@ -523,8 +523,7 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry) } if (!result && (entry->action == UNKNOWN)) result = -EINVAL; - else if (entry->func == MODULE_CHECK) - ima_appraise |= IMA_APPRAISE_MODULES; + audit_log_format(ab, "res=%d", !result); audit_log_end(ab); return result; diff --git a/trunk/security/security.c b/trunk/security/security.c index 7b88c6aeaed4..daa97f4ac9d1 100644 --- a/trunk/security/security.c +++ b/trunk/security/security.c @@ -1254,42 +1254,24 @@ void security_secmark_refcount_dec(void) } EXPORT_SYMBOL(security_secmark_refcount_dec); -int security_tun_dev_alloc_security(void **security) -{ - return security_ops->tun_dev_alloc_security(security); -} -EXPORT_SYMBOL(security_tun_dev_alloc_security); - -void security_tun_dev_free_security(void *security) -{ - security_ops->tun_dev_free_security(security); -} -EXPORT_SYMBOL(security_tun_dev_free_security); - int security_tun_dev_create(void) { return security_ops->tun_dev_create(); } EXPORT_SYMBOL(security_tun_dev_create); -int security_tun_dev_attach_queue(void *security) +void security_tun_dev_post_create(struct sock *sk) { - return security_ops->tun_dev_attach_queue(security); + return security_ops->tun_dev_post_create(sk); } -EXPORT_SYMBOL(security_tun_dev_attach_queue); +EXPORT_SYMBOL(security_tun_dev_post_create); -int security_tun_dev_attach(struct sock *sk, void *security) +int security_tun_dev_attach(struct sock *sk) { - return security_ops->tun_dev_attach(sk, security); + return security_ops->tun_dev_attach(sk); } EXPORT_SYMBOL(security_tun_dev_attach); -int security_tun_dev_open(void *security) -{ - return security_ops->tun_dev_open(security); -} -EXPORT_SYMBOL(security_tun_dev_open); - #endif /* CONFIG_SECURITY_NETWORK */ #ifdef CONFIG_SECURITY_NETWORK_XFRM diff --git a/trunk/security/selinux/hooks.c b/trunk/security/selinux/hooks.c index ef26e9611ffb..61a53367d029 100644 --- a/trunk/security/selinux/hooks.c +++ b/trunk/security/selinux/hooks.c @@ -4399,24 +4399,6 @@ static void selinux_req_classify_flow(const struct request_sock *req, fl->flowi_secid = req->secid; } -static int selinux_tun_dev_alloc_security(void **security) -{ - struct tun_security_struct *tunsec; - - tunsec = kzalloc(sizeof(*tunsec), GFP_KERNEL); - if (!tunsec) - return -ENOMEM; - tunsec->sid = current_sid(); - - *security = tunsec; - return 0; -} - -static void selinux_tun_dev_free_security(void *security) -{ - kfree(security); -} - static int selinux_tun_dev_create(void) { u32 sid = current_sid(); @@ -4432,17 +4414,8 @@ static int selinux_tun_dev_create(void) NULL); } -static int selinux_tun_dev_attach_queue(void *security) +static void selinux_tun_dev_post_create(struct sock *sk) { - struct tun_security_struct *tunsec = security; - - return avc_has_perm(current_sid(), tunsec->sid, SECCLASS_TUN_SOCKET, - TUN_SOCKET__ATTACH_QUEUE, NULL); -} - -static int selinux_tun_dev_attach(struct sock *sk, void *security) -{ - struct tun_security_struct *tunsec = security; struct sk_security_struct *sksec = sk->sk_security; /* we don't currently perform any NetLabel based labeling here and it @@ -4452,19 +4425,20 @@ static int selinux_tun_dev_attach(struct sock *sk, void *security) * cause confusion to the TUN user that had no idea network labeling * protocols were being used */ - sksec->sid = tunsec->sid; - sksec->sclass = SECCLASS_TUN_SOCKET; + /* see the comments in selinux_tun_dev_create() about why we don't use + * the sockcreate SID here */ - return 0; + sksec->sid = current_sid(); + sksec->sclass = SECCLASS_TUN_SOCKET; } -static int selinux_tun_dev_open(void *security) +static int selinux_tun_dev_attach(struct sock *sk) { - struct tun_security_struct *tunsec = security; + struct sk_security_struct *sksec = sk->sk_security; u32 sid = current_sid(); int err; - err = avc_has_perm(sid, tunsec->sid, SECCLASS_TUN_SOCKET, + err = avc_has_perm(sid, sksec->sid, SECCLASS_TUN_SOCKET, TUN_SOCKET__RELABELFROM, NULL); if (err) return err; @@ -4472,7 +4446,8 @@ static int selinux_tun_dev_open(void *security) TUN_SOCKET__RELABELTO, NULL); if (err) return err; - tunsec->sid = sid; + + sksec->sid = sid; return 0; } @@ -5667,12 +5642,9 @@ static struct security_operations selinux_ops = { .secmark_refcount_inc = selinux_secmark_refcount_inc, .secmark_refcount_dec = selinux_secmark_refcount_dec, .req_classify_flow = selinux_req_classify_flow, - .tun_dev_alloc_security = selinux_tun_dev_alloc_security, - .tun_dev_free_security = selinux_tun_dev_free_security, .tun_dev_create = selinux_tun_dev_create, - .tun_dev_attach_queue = selinux_tun_dev_attach_queue, + .tun_dev_post_create = selinux_tun_dev_post_create, .tun_dev_attach = selinux_tun_dev_attach, - .tun_dev_open = selinux_tun_dev_open, #ifdef CONFIG_SECURITY_NETWORK_XFRM .xfrm_policy_alloc_security = selinux_xfrm_policy_alloc, diff --git a/trunk/security/selinux/include/classmap.h b/trunk/security/selinux/include/classmap.h index 14d04e63b1f0..df2de54a958d 100644 --- a/trunk/security/selinux/include/classmap.h +++ b/trunk/security/selinux/include/classmap.h @@ -150,6 +150,6 @@ struct security_class_mapping secclass_map[] = { NULL } }, { "kernel_service", { "use_as_override", "create_files_as", NULL } }, { "tun_socket", - { COMMON_SOCK_PERMS, "attach_queue", NULL } }, + { COMMON_SOCK_PERMS, NULL } }, { NULL } }; diff --git a/trunk/security/selinux/include/objsec.h b/trunk/security/selinux/include/objsec.h index aa47bcabb5f6..26c7eee1c309 100644 --- a/trunk/security/selinux/include/objsec.h +++ b/trunk/security/selinux/include/objsec.h @@ -110,10 +110,6 @@ struct sk_security_struct { u16 sclass; /* sock security class */ }; -struct tun_security_struct { - u32 sid; /* SID for the tun device sockets */ -}; - struct key_security_struct { u32 sid; /* SID of key */ }; diff --git a/trunk/sound/arm/pxa2xx-ac97-lib.c b/trunk/sound/arm/pxa2xx-ac97-lib.c index fff7753e35c1..6fc0ae90e5b1 100644 --- a/trunk/sound/arm/pxa2xx-ac97-lib.c +++ b/trunk/sound/arm/pxa2xx-ac97-lib.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include @@ -149,8 +148,6 @@ static inline void pxa_ac97_warm_pxa27x(void) static inline void pxa_ac97_cold_pxa27x(void) { - unsigned int timeout; - GCR &= GCR_COLD_RST; /* clear everything but nCRST */ GCR &= ~GCR_COLD_RST; /* then assert nCRST */ @@ -160,10 +157,8 @@ static inline void pxa_ac97_cold_pxa27x(void) clk_enable(ac97conf_clk); udelay(5); clk_disable(ac97conf_clk); - GCR = GCR_COLD_RST | GCR_WARM_RST; - timeout = 100; /* wait for the codec-ready bit to be set */ - while (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR)) && timeout--) - mdelay(1); + GCR = GCR_COLD_RST; + udelay(50); } #endif @@ -345,21 +340,8 @@ int pxa2xx_ac97_hw_probe(struct platform_device *dev) } if (cpu_is_pxa27x()) { - /* - * This gpio is needed for a work-around to a bug in the ac97 - * controller during warm reset. The direction and level is set - * here so that it is an output driven high when switching from - * AC97_nRESET alt function to generic gpio. - */ - ret = gpio_request_one(reset_gpio, GPIOF_OUT_INIT_HIGH, - "pxa27x ac97 reset"); - if (ret < 0) { - pr_err("%s: gpio_request_one() failed: %d\n", - __func__, ret); - goto err_conf; - } + /* Use GPIO 113 as AC97 Reset on Bulverde */ pxa27x_assert_ac97reset(reset_gpio, 0); - ac97conf_clk = clk_get(&dev->dev, "AC97CONFCLK"); if (IS_ERR(ac97conf_clk)) { ret = PTR_ERR(ac97conf_clk); @@ -402,8 +384,6 @@ EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_probe); void pxa2xx_ac97_hw_remove(struct platform_device *dev) { - if (cpu_is_pxa27x()) - gpio_free(reset_gpio); GCR |= GCR_ACLINK_OFF; free_irq(IRQ_AC97, NULL); if (ac97conf_clk) { diff --git a/trunk/sound/oss/pas2_card.c b/trunk/sound/oss/pas2_card.c index 7004e24d209f..dabf8a871dcc 100644 --- a/trunk/sound/oss/pas2_card.c +++ b/trunk/sound/oss/pas2_card.c @@ -333,11 +333,6 @@ static void __init attach_pas_card(struct address_info *hw_config) { char temp[100]; - if (pas_model < 0 || - pas_model >= ARRAY_SIZE(pas_model_names)) { - printk(KERN_ERR "pas2 unrecognized model.\n"); - return; - } sprintf(temp, "%s rev %d", pas_model_names[(int) pas_model], pas_read(0x2789)); diff --git a/trunk/sound/pci/au88x0/au88x0_synth.c b/trunk/sound/pci/au88x0/au88x0_synth.c index 8bef47311e45..2805e34bd41d 100644 --- a/trunk/sound/pci/au88x0/au88x0_synth.c +++ b/trunk/sound/pci/au88x0/au88x0_synth.c @@ -58,7 +58,7 @@ static void vortex_wt_setdsout(vortex_t * vortex, u32 wt, int en) if (en) temp |= (1 << (wt & 0x1f)); else - temp &= ~(1 << (wt & 0x1f)); + temp &= (1 << ~(wt & 0x1f)); hwwrite(vortex->mmio, WT_DSREG((wt >= 0x20) ? 1 : 0), temp); } diff --git a/trunk/sound/pci/hda/hda_codec.c b/trunk/sound/pci/hda/hda_codec.c index 822df971972c..8353c77536ac 100644 --- a/trunk/sound/pci/hda/hda_codec.c +++ b/trunk/sound/pci/hda/hda_codec.c @@ -2531,7 +2531,7 @@ static int vmaster_mute_mode_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { static const char * const texts[] = { - "On", "Off", "Follow Master" + "Off", "On", "Follow Master" }; unsigned int index; @@ -3654,7 +3654,6 @@ static void hda_call_codec_resume(struct hda_codec *codec) hda_set_power_state(codec, AC_PWRST_D0); restore_shutup_pins(codec); hda_exec_init_verbs(codec); - snd_hda_jack_set_dirty_all(codec); if (codec->patch_ops.resume) codec->patch_ops.resume(codec); else { @@ -3666,8 +3665,10 @@ static void hda_call_codec_resume(struct hda_codec *codec) if (codec->jackpoll_interval) hda_jackpoll_work(&codec->jackpoll_work.work); - else + else { + snd_hda_jack_set_dirty_all(codec); snd_hda_jack_report_sync(codec); + } codec->in_pm = 0; snd_hda_power_down(codec); /* flag down before returning */ diff --git a/trunk/sound/pci/hda/hda_intel.c b/trunk/sound/pci/hda/hda_intel.c index 0b6aebacc56b..cca87277baf0 100644 --- a/trunk/sound/pci/hda/hda_intel.c +++ b/trunk/sound/pci/hda/hda_intel.c @@ -573,12 +573,9 @@ enum { #define AZX_DCAPS_PM_RUNTIME (1 << 26) /* runtime PM support */ /* quirks for Intel PCH */ -#define AZX_DCAPS_INTEL_PCH_NOPM \ - (AZX_DCAPS_SCH_SNOOP | AZX_DCAPS_BUFSIZE | \ - AZX_DCAPS_COUNT_LPIB_DELAY) - #define AZX_DCAPS_INTEL_PCH \ - (AZX_DCAPS_INTEL_PCH_NOPM | AZX_DCAPS_PM_RUNTIME) + (AZX_DCAPS_SCH_SNOOP | AZX_DCAPS_BUFSIZE | \ + AZX_DCAPS_COUNT_LPIB_DELAY | AZX_DCAPS_PM_RUNTIME) /* quirks for ATI SB / AMD Hudson */ #define AZX_DCAPS_PRESET_ATI_SB \ @@ -3589,13 +3586,13 @@ static void azx_remove(struct pci_dev *pci) static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { /* CPT */ { PCI_DEVICE(0x8086, 0x1c20), - .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH_NOPM }, + .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, /* PBG */ { PCI_DEVICE(0x8086, 0x1d20), - .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH_NOPM }, + .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, /* Panther Point */ { PCI_DEVICE(0x8086, 0x1e20), - .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH_NOPM }, + .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, /* Lynx Point */ { PCI_DEVICE(0x8086, 0x8c20), .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, diff --git a/trunk/sound/pci/hda/patch_conexant.c b/trunk/sound/pci/hda/patch_conexant.c index 009b77a693cf..60890bfecc19 100644 --- a/trunk/sound/pci/hda/patch_conexant.c +++ b/trunk/sound/pci/hda/patch_conexant.c @@ -558,12 +558,24 @@ static int conexant_build_controls(struct hda_codec *codec) return 0; } +#ifdef CONFIG_PM +static int conexant_suspend(struct hda_codec *codec) +{ + snd_hda_shutup_pins(codec); + return 0; +} +#endif + static const struct hda_codec_ops conexant_patch_ops = { .build_controls = conexant_build_controls, .build_pcms = conexant_build_pcms, .init = conexant_init, .free = conexant_free, .set_power_state = conexant_set_power, +#ifdef CONFIG_PM + .suspend = conexant_suspend, +#endif + .reboot_notify = snd_hda_shutup_pins, }; #ifdef CONFIG_SND_HDA_INPUT_BEEP @@ -4393,6 +4405,10 @@ static const struct hda_codec_ops cx_auto_patch_ops = { .init = cx_auto_init, .free = conexant_free, .unsol_event = snd_hda_jack_unsol_event, +#ifdef CONFIG_PM + .suspend = conexant_suspend, +#endif + .reboot_notify = snd_hda_shutup_pins, }; /* @@ -4636,12 +4652,6 @@ static const struct hda_codec_preset snd_hda_preset_conexant[] = { .patch = patch_conexant_auto }, { .id = 0x14f15111, .name = "CX20753/4", .patch = patch_conexant_auto }, - { .id = 0x14f15113, .name = "CX20755", - .patch = patch_conexant_auto }, - { .id = 0x14f15114, .name = "CX20756", - .patch = patch_conexant_auto }, - { .id = 0x14f15115, .name = "CX20757", - .patch = patch_conexant_auto }, {} /* terminator */ }; @@ -4665,9 +4675,6 @@ MODULE_ALIAS("snd-hda-codec-id:14f150b9"); MODULE_ALIAS("snd-hda-codec-id:14f1510f"); MODULE_ALIAS("snd-hda-codec-id:14f15110"); MODULE_ALIAS("snd-hda-codec-id:14f15111"); -MODULE_ALIAS("snd-hda-codec-id:14f15113"); -MODULE_ALIAS("snd-hda-codec-id:14f15114"); -MODULE_ALIAS("snd-hda-codec-id:14f15115"); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Conexant HD-audio codec"); diff --git a/trunk/sound/pci/hda/patch_hdmi.c b/trunk/sound/pci/hda/patch_hdmi.c index 807a2aa1ff38..b6c21ea187ca 100644 --- a/trunk/sound/pci/hda/patch_hdmi.c +++ b/trunk/sound/pci/hda/patch_hdmi.c @@ -1502,7 +1502,7 @@ static int hdmi_chmap_ctl_put(struct snd_kcontrol *kcontrol, ctl_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); substream = snd_pcm_chmap_substream(info, ctl_idx); if (!substream || !substream->runtime) - return 0; /* just for avoiding error from alsactl restore */ + return -EBADFD; switch (substream->runtime->status->state) { case SNDRV_PCM_STATE_OPEN: case SNDRV_PCM_STATE_SETUP: diff --git a/trunk/sound/pci/hda/patch_realtek.c b/trunk/sound/pci/hda/patch_realtek.c index cf3886171109..6ee34593774a 100644 --- a/trunk/sound/pci/hda/patch_realtek.c +++ b/trunk/sound/pci/hda/patch_realtek.c @@ -5817,9 +5817,6 @@ enum { ALC269_TYPE_ALC269VB, ALC269_TYPE_ALC269VC, ALC269_TYPE_ALC269VD, - ALC269_TYPE_ALC280, - ALC269_TYPE_ALC282, - ALC269_TYPE_ALC284, }; /* @@ -5836,13 +5833,10 @@ static int alc269_parse_auto_config(struct hda_codec *codec) switch (spec->codec_variant) { case ALC269_TYPE_ALC269VA: case ALC269_TYPE_ALC269VC: - case ALC269_TYPE_ALC280: - case ALC269_TYPE_ALC284: ssids = alc269va_ssids; break; case ALC269_TYPE_ALC269VB: case ALC269_TYPE_ALC269VD: - case ALC269_TYPE_ALC282: ssids = alc269_ssids; break; default: @@ -5998,30 +5992,6 @@ static void alc269_fixup_quanta_mute(struct hda_codec *codec, spec->automute_hook = alc269_quanta_automute; } -/* update mute-LED according to the speaker mute state via mic1 VREF pin */ -static void alc269_fixup_mic1_mute_hook(void *private_data, int enabled) -{ - struct hda_codec *codec = private_data; - unsigned int pinval = AC_PINCTL_IN_EN + (enabled ? - AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80); - snd_hda_set_pin_ctl_cache(codec, 0x18, pinval); -} - -static void alc269_fixup_mic1_mute(struct hda_codec *codec, - const struct alc_fixup *fix, int action) -{ - struct alc_spec *spec = codec->spec; - switch (action) { - case ALC_FIXUP_ACT_BUILD: - spec->vmaster_mute.hook = alc269_fixup_mic1_mute_hook; - snd_hda_add_vmaster_hook(codec, &spec->vmaster_mute, true); - /* fallthru */ - case ALC_FIXUP_ACT_INIT: - snd_hda_sync_vmaster_hook(&spec->vmaster_mute); - break; - } -} - /* update mute-LED according to the speaker mute state via mic2 VREF pin */ static void alc269_fixup_mic2_mute_hook(void *private_data, int enabled) { @@ -6073,7 +6043,6 @@ enum { ALC269_FIXUP_DMIC, ALC269VB_FIXUP_AMIC, ALC269VB_FIXUP_DMIC, - ALC269_FIXUP_MIC1_MUTE_LED, ALC269_FIXUP_MIC2_MUTE_LED, ALC269_FIXUP_INV_DMIC, ALC269_FIXUP_LENOVO_DOCK, @@ -6202,10 +6171,6 @@ static const struct alc_fixup alc269_fixups[] = { { } }, }, - [ALC269_FIXUP_MIC1_MUTE_LED] = { - .type = ALC_FIXUP_FUNC, - .v.func = alc269_fixup_mic1_mute, - }, [ALC269_FIXUP_MIC2_MUTE_LED] = { .type = ALC_FIXUP_FUNC, .v.func = alc269_fixup_mic2_mute, @@ -6250,8 +6215,6 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC), SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC), SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_MIC2_MUTE_LED), - SND_PCI_QUIRK(0x103c, 0x1972, "HP Pavilion 17", ALC269_FIXUP_MIC1_MUTE_LED), - SND_PCI_QUIRK(0x103c, 0x1977, "HP Pavilion 14", ALC269_FIXUP_MIC1_MUTE_LED), SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_DMIC), SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_DMIC), SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), @@ -6266,7 +6229,6 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), - SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK), SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK), SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC), SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK), @@ -6408,8 +6370,7 @@ static int patch_alc269(struct hda_codec *codec) alc_auto_parse_customize_define(codec); - switch (codec->vendor_id) { - case 0x10ec0269: + if (codec->vendor_id == 0x10ec0269) { spec->codec_variant = ALC269_TYPE_ALC269VA; switch (alc_get_coef0(codec) & 0x00f0) { case 0x0010: @@ -6434,20 +6395,6 @@ static int patch_alc269(struct hda_codec *codec) goto error; spec->init_hook = alc269_fill_coef; alc269_fill_coef(codec); - break; - - case 0x10ec0280: - case 0x10ec0290: - spec->codec_variant = ALC269_TYPE_ALC280; - break; - case 0x10ec0282: - case 0x10ec0283: - spec->codec_variant = ALC269_TYPE_ALC282; - break; - case 0x10ec0284: - case 0x10ec0292: - spec->codec_variant = ALC269_TYPE_ALC284; - break; } /* automatic parse from the BIOS config */ @@ -7152,7 +7099,6 @@ static const struct hda_codec_preset snd_hda_preset_realtek[] = { { .id = 0x10ec0280, .name = "ALC280", .patch = patch_alc269 }, { .id = 0x10ec0282, .name = "ALC282", .patch = patch_alc269 }, { .id = 0x10ec0283, .name = "ALC283", .patch = patch_alc269 }, - { .id = 0x10ec0284, .name = "ALC284", .patch = patch_alc269 }, { .id = 0x10ec0290, .name = "ALC290", .patch = patch_alc269 }, { .id = 0x10ec0292, .name = "ALC292", .patch = patch_alc269 }, { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", diff --git a/trunk/sound/pci/rme9652/hdspm.c b/trunk/sound/pci/rme9652/hdspm.c index 223c3d9cc69e..6e02e064d7b4 100644 --- a/trunk/sound/pci/rme9652/hdspm.c +++ b/trunk/sound/pci/rme9652/hdspm.c @@ -441,7 +441,6 @@ MODULE_SUPPORTED_DEVICE("{{RME HDSPM-MADI}}"); */ /* status */ #define HDSPM_AES32_wcLock 0x0200000 -#define HDSPM_AES32_wcSync 0x0100000 #define HDSPM_AES32_wcFreq_bit 22 /* (status >> HDSPM_AES32_wcFreq_bit) & 0xF gives WC frequency (cf function HDSPM_bit2freq */ @@ -3468,12 +3467,10 @@ static int hdspm_wc_sync_check(struct hdspm *hdspm) switch (hdspm->io_type) { case AES32: status = hdspm_read(hdspm, HDSPM_statusRegister); - if (status & HDSPM_AES32_wcLock) { - if (status & HDSPM_AES32_wcSync) - return 2; - else - return 1; - } + if (status & HDSPM_wcSync) + return 2; + else if (status & HDSPM_wcLock) + return 1; return 0; break; @@ -4661,7 +4658,6 @@ snd_hdspm_proc_read_aes32(struct snd_info_entry * entry, unsigned int status; unsigned int status2; unsigned int timecode; - unsigned int wcLock, wcSync; int pref_syncref; char *autosync_ref; int x; @@ -4755,11 +4751,8 @@ snd_hdspm_proc_read_aes32(struct snd_info_entry * entry, snd_iprintf(buffer, "--- Status:\n"); - wcLock = status & HDSPM_AES32_wcLock; - wcSync = wcLock && (status & HDSPM_AES32_wcSync); - snd_iprintf(buffer, "Word: %s Frequency: %d\n", - (wcLock) ? (wcSync ? "Sync " : "Lock ") : "No Lock", + (status & HDSPM_AES32_wcLock) ? "Sync " : "No Lock", HDSPM_bit2freq((status >> HDSPM_AES32_wcFreq_bit) & 0xF)); for (x = 0; x < 8; x++) { diff --git a/trunk/sound/soc/codecs/arizona.c b/trunk/sound/soc/codecs/arizona.c index 1d8bb5917594..adf397b9d0e6 100644 --- a/trunk/sound/soc/codecs/arizona.c +++ b/trunk/sound/soc/codecs/arizona.c @@ -446,9 +446,15 @@ static int arizona_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) case SND_SOC_DAIFMT_DSP_A: mode = 0; break; + case SND_SOC_DAIFMT_DSP_B: + mode = 1; + break; case SND_SOC_DAIFMT_I2S: mode = 2; break; + case SND_SOC_DAIFMT_LEFT_J: + mode = 3; + break; default: arizona_aif_err(dai, "Unsupported DAI format %d\n", fmt & SND_SOC_DAIFMT_FORMAT_MASK); @@ -708,8 +714,7 @@ static int arizona_hw_params(struct snd_pcm_substream *substream, snd_soc_update_bits(codec, ARIZONA_ASYNC_SAMPLE_RATE_1, ARIZONA_ASYNC_SAMPLE_RATE_MASK, sr_val); snd_soc_update_bits(codec, base + ARIZONA_AIF_RATE_CTRL, - ARIZONA_AIF1_RATE_MASK, - 8 << ARIZONA_AIF1_RATE_SHIFT); + ARIZONA_AIF1_RATE_MASK, 8); break; default: arizona_aif_err(dai, "Invalid clock %d\n", dai_priv->clk); diff --git a/trunk/sound/soc/codecs/arizona.h b/trunk/sound/soc/codecs/arizona.h index 4deebeb07177..41dae1ed3b71 100644 --- a/trunk/sound/soc/codecs/arizona.h +++ b/trunk/sound/soc/codecs/arizona.h @@ -34,15 +34,15 @@ #define ARIZONA_FLL_SRC_MCLK1 0 #define ARIZONA_FLL_SRC_MCLK2 1 -#define ARIZONA_FLL_SRC_SLIMCLK 3 -#define ARIZONA_FLL_SRC_FLL1 4 -#define ARIZONA_FLL_SRC_FLL2 5 -#define ARIZONA_FLL_SRC_AIF1BCLK 8 -#define ARIZONA_FLL_SRC_AIF2BCLK 9 -#define ARIZONA_FLL_SRC_AIF3BCLK 10 -#define ARIZONA_FLL_SRC_AIF1LRCLK 12 -#define ARIZONA_FLL_SRC_AIF2LRCLK 13 -#define ARIZONA_FLL_SRC_AIF3LRCLK 14 +#define ARIZONA_FLL_SRC_SLIMCLK 2 +#define ARIZONA_FLL_SRC_FLL1 3 +#define ARIZONA_FLL_SRC_FLL2 4 +#define ARIZONA_FLL_SRC_AIF1BCLK 5 +#define ARIZONA_FLL_SRC_AIF2BCLK 6 +#define ARIZONA_FLL_SRC_AIF3BCLK 7 +#define ARIZONA_FLL_SRC_AIF1LRCLK 8 +#define ARIZONA_FLL_SRC_AIF2LRCLK 9 +#define ARIZONA_FLL_SRC_AIF3LRCLK 10 #define ARIZONA_MIXER_VOL_MASK 0x00FE #define ARIZONA_MIXER_VOL_SHIFT 1 diff --git a/trunk/sound/soc/codecs/cs4271.c b/trunk/sound/soc/codecs/cs4271.c index ac8742a1f25a..4f1127935fdf 100644 --- a/trunk/sound/soc/codecs/cs4271.c +++ b/trunk/sound/soc/codecs/cs4271.c @@ -474,16 +474,16 @@ static int cs4271_probe(struct snd_soc_codec *codec) struct cs4271_platform_data *cs4271plat = codec->dev->platform_data; int ret; int gpio_nreset = -EINVAL; - bool amutec_eq_bmutec = false; + int amutec_eq_bmutec = 0; #ifdef CONFIG_OF if (of_match_device(cs4271_dt_ids, codec->dev)) { gpio_nreset = of_get_named_gpio(codec->dev->of_node, "reset-gpio", 0); - if (of_get_property(codec->dev->of_node, + if (!of_get_property(codec->dev->of_node, "cirrus,amutec-eq-bmutec", NULL)) - amutec_eq_bmutec = true; + amutec_eq_bmutec = 1; } #endif diff --git a/trunk/sound/soc/codecs/cs42l52.c b/trunk/sound/soc/codecs/cs42l52.c index 9811a5478c87..99bb1c69499e 100644 --- a/trunk/sound/soc/codecs/cs42l52.c +++ b/trunk/sound/soc/codecs/cs42l52.c @@ -737,7 +737,7 @@ static const struct cs42l52_clk_para clk_map_table[] = { static int cs42l52_get_clk(int mclk, int rate) { - int i, ret = -EINVAL; + int i, ret = 0; u_int mclk1, mclk2 = 0; for (i = 0; i < ARRAY_SIZE(clk_map_table); i++) { @@ -749,6 +749,8 @@ static int cs42l52_get_clk(int mclk, int rate) } } } + if (ret > ARRAY_SIZE(clk_map_table)) + return -EINVAL; return ret; } diff --git a/trunk/sound/soc/codecs/lm49453.c b/trunk/sound/soc/codecs/lm49453.c index e19490cfb3a8..d75257d40a49 100644 --- a/trunk/sound/soc/codecs/lm49453.c +++ b/trunk/sound/soc/codecs/lm49453.c @@ -111,9 +111,9 @@ static struct reg_default lm49453_reg_defs[] = { { 101, 0x00 }, { 102, 0x00 }, { 103, 0x01 }, - { 104, 0x01 }, - { 105, 0x00 }, - { 106, 0x01 }, + { 105, 0x01 }, + { 106, 0x00 }, + { 107, 0x01 }, { 107, 0x00 }, { 108, 0x00 }, { 109, 0x00 }, @@ -163,25 +163,56 @@ static struct reg_default lm49453_reg_defs[] = { { 184, 0x00 }, { 185, 0x00 }, { 186, 0x00 }, - { 187, 0x00 }, - { 188, 0x00 }, { 189, 0x00 }, - { 208, 0x06 }, + { 188, 0x00 }, + { 194, 0x00 }, + { 195, 0x00 }, + { 196, 0x00 }, + { 197, 0x00 }, + { 200, 0x00 }, + { 201, 0x00 }, + { 202, 0x00 }, + { 203, 0x00 }, + { 204, 0x00 }, + { 205, 0x00 }, + { 208, 0x00 }, { 209, 0x00 }, - { 210, 0x08 }, - { 211, 0x54 }, - { 212, 0x14 }, - { 213, 0x0d }, - { 214, 0x0d }, - { 215, 0x14 }, - { 216, 0x60 }, + { 210, 0x00 }, + { 211, 0x00 }, + { 213, 0x00 }, + { 214, 0x00 }, + { 215, 0x00 }, + { 216, 0x00 }, + { 217, 0x00 }, + { 218, 0x00 }, + { 219, 0x00 }, { 221, 0x00 }, { 222, 0x00 }, - { 223, 0x00 }, { 224, 0x00 }, + { 225, 0x00 }, + { 226, 0x00 }, + { 227, 0x00 }, + { 228, 0x00 }, + { 229, 0x00 }, + { 230, 0x13 }, + { 231, 0x00 }, + { 232, 0x80 }, + { 233, 0x0C }, + { 234, 0xDD }, + { 235, 0x00 }, + { 236, 0x04 }, + { 237, 0x00 }, + { 238, 0x00 }, + { 239, 0x00 }, + { 240, 0x00 }, + { 241, 0x00 }, + { 242, 0x00 }, + { 243, 0x00 }, + { 244, 0x00 }, + { 245, 0x00 }, { 248, 0x00 }, { 249, 0x00 }, - { 250, 0x00 }, + { 254, 0x00 }, { 255, 0x00 }, }; @@ -494,41 +525,36 @@ SOC_DAPM_SINGLE("Port2_2 Switch", LM49453_P0_PORT2_TX2_REG, 7, 1, 0), }; /* TLV Declarations */ -static const DECLARE_TLV_DB_SCALE(adc_dac_tlv, -7650, 150, 1); -static const DECLARE_TLV_DB_SCALE(mic_tlv, 0, 200, 1); -static const DECLARE_TLV_DB_SCALE(port_tlv, -1800, 600, 0); -static const DECLARE_TLV_DB_SCALE(stn_tlv, -7200, 150, 0); +static const DECLARE_TLV_DB_SCALE(digital_tlv, -7650, 150, 1); +static const DECLARE_TLV_DB_SCALE(port_tlv, 0, 600, 0); static const struct snd_kcontrol_new lm49453_sidetone_mixer_controls[] = { /* Sidetone supports mono only */ SOC_DAPM_SINGLE_TLV("Sidetone ADCL Volume", LM49453_P0_STN_VOL_ADCL_REG, - 0, 0x3F, 0, stn_tlv), + 0, 0x3F, 0, digital_tlv), SOC_DAPM_SINGLE_TLV("Sidetone ADCR Volume", LM49453_P0_STN_VOL_ADCR_REG, - 0, 0x3F, 0, stn_tlv), + 0, 0x3F, 0, digital_tlv), SOC_DAPM_SINGLE_TLV("Sidetone DMIC1L Volume", LM49453_P0_STN_VOL_DMIC1L_REG, - 0, 0x3F, 0, stn_tlv), + 0, 0x3F, 0, digital_tlv), SOC_DAPM_SINGLE_TLV("Sidetone DMIC1R Volume", LM49453_P0_STN_VOL_DMIC1R_REG, - 0, 0x3F, 0, stn_tlv), + 0, 0x3F, 0, digital_tlv), SOC_DAPM_SINGLE_TLV("Sidetone DMIC2L Volume", LM49453_P0_STN_VOL_DMIC2L_REG, - 0, 0x3F, 0, stn_tlv), + 0, 0x3F, 0, digital_tlv), SOC_DAPM_SINGLE_TLV("Sidetone DMIC2R Volume", LM49453_P0_STN_VOL_DMIC2R_REG, - 0, 0x3F, 0, stn_tlv), + 0, 0x3F, 0, digital_tlv), }; static const struct snd_kcontrol_new lm49453_snd_controls[] = { /* mic1 and mic2 supports mono only */ - SOC_SINGLE_TLV("Mic1 Volume", LM49453_P0_MICL_REG, 0, 15, 0, mic_tlv), - SOC_SINGLE_TLV("Mic2 Volume", LM49453_P0_MICR_REG, 0, 15, 0, mic_tlv), - - SOC_SINGLE_TLV("ADCL Volume", LM49453_P0_ADC_LEVELL_REG, 0, 63, - 0, adc_dac_tlv), - SOC_SINGLE_TLV("ADCR Volume", LM49453_P0_ADC_LEVELR_REG, 0, 63, - 0, adc_dac_tlv), + SOC_SINGLE_TLV("Mic1 Volume", LM49453_P0_ADC_LEVELL_REG, 0, 6, + 0, digital_tlv), + SOC_SINGLE_TLV("Mic2 Volume", LM49453_P0_ADC_LEVELR_REG, 0, 6, + 0, digital_tlv), SOC_DOUBLE_R_TLV("DMIC1 Volume", LM49453_P0_DMIC1_LEVELL_REG, - LM49453_P0_DMIC1_LEVELR_REG, 0, 63, 0, adc_dac_tlv), + LM49453_P0_DMIC1_LEVELR_REG, 0, 6, 0, digital_tlv), SOC_DOUBLE_R_TLV("DMIC2 Volume", LM49453_P0_DMIC2_LEVELL_REG, - LM49453_P0_DMIC2_LEVELR_REG, 0, 63, 0, adc_dac_tlv), + LM49453_P0_DMIC2_LEVELR_REG, 0, 6, 0, digital_tlv), SOC_DAPM_ENUM("Mic2Mode", lm49453_mic2mode_enum), SOC_DAPM_ENUM("DMIC12 SRC", lm49453_dmic12_cfg_enum), @@ -543,16 +569,16 @@ static const struct snd_kcontrol_new lm49453_snd_controls[] = { 2, 1, 0), SOC_DOUBLE_R_TLV("DAC HP Volume", LM49453_P0_DAC_HP_LEVELL_REG, - LM49453_P0_DAC_HP_LEVELR_REG, 0, 63, 0, adc_dac_tlv), + LM49453_P0_DAC_HP_LEVELR_REG, 0, 6, 0, digital_tlv), SOC_DOUBLE_R_TLV("DAC LO Volume", LM49453_P0_DAC_LO_LEVELL_REG, - LM49453_P0_DAC_LO_LEVELR_REG, 0, 63, 0, adc_dac_tlv), + LM49453_P0_DAC_LO_LEVELR_REG, 0, 6, 0, digital_tlv), SOC_DOUBLE_R_TLV("DAC LS Volume", LM49453_P0_DAC_LS_LEVELL_REG, - LM49453_P0_DAC_LS_LEVELR_REG, 0, 63, 0, adc_dac_tlv), + LM49453_P0_DAC_LS_LEVELR_REG, 0, 6, 0, digital_tlv), SOC_DOUBLE_R_TLV("DAC HA Volume", LM49453_P0_DAC_HA_LEVELL_REG, - LM49453_P0_DAC_HA_LEVELR_REG, 0, 63, 0, adc_dac_tlv), + LM49453_P0_DAC_HA_LEVELR_REG, 0, 6, 0, digital_tlv), SOC_SINGLE_TLV("EP Volume", LM49453_P0_DAC_LS_LEVELL_REG, - 0, 63, 0, adc_dac_tlv), + 0, 6, 0, digital_tlv), SOC_SINGLE_TLV("PORT1_1_RX_LVL Volume", LM49453_P0_PORT1_RX_LVL1_REG, 0, 3, 0, port_tlv), @@ -1192,7 +1218,7 @@ static int lm49453_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) } snd_soc_update_bits(codec, LM49453_P0_AUDIO_PORT1_BASIC_REG, - LM49453_AUDIO_PORT1_BASIC_FMT_MASK|BIT(0)|BIT(5), + LM49453_AUDIO_PORT1_BASIC_FMT_MASK|BIT(1)|BIT(5), (aif_val | mode | clk_phase)); snd_soc_write(codec, LM49453_P0_AUDIO_PORT1_RX_MSB_REG, clk_shift); diff --git a/trunk/sound/soc/codecs/sgtl5000.c b/trunk/sound/soc/codecs/sgtl5000.c index 92bbfec9b107..cb1675cd8e1c 100644 --- a/trunk/sound/soc/codecs/sgtl5000.c +++ b/trunk/sound/soc/codecs/sgtl5000.c @@ -401,7 +401,7 @@ static const struct snd_kcontrol_new sgtl5000_snd_controls[] = { 5, 1, 0), SOC_SINGLE_TLV("Mic Volume", SGTL5000_CHIP_MIC_CTRL, - 0, 3, 0, mic_gain_tlv), + 0, 4, 0, mic_gain_tlv), }; /* mute the codec used by alsa core */ @@ -1344,7 +1344,7 @@ static int sgtl5000_probe(struct snd_soc_codec *codec) SGTL5000_HP_ZCD_EN | SGTL5000_ADC_ZCD_EN); - snd_soc_write(codec, SGTL5000_CHIP_MIC_CTRL, 2); + snd_soc_write(codec, SGTL5000_CHIP_MIC_CTRL, 0); /* * disable DAP diff --git a/trunk/sound/soc/codecs/sta529.c b/trunk/sound/soc/codecs/sta529.c index 40c07be9b581..ab355c4f0b2d 100644 --- a/trunk/sound/soc/codecs/sta529.c +++ b/trunk/sound/soc/codecs/sta529.c @@ -74,10 +74,9 @@ SNDRV_PCM_FMTBIT_S32_LE) #define S2PC_VALUE 0x98 #define CLOCK_OUT 0x60 -#define DATA_FORMAT_MSK 0x0E -#define LEFT_J_DATA_FORMAT 0x00 -#define I2S_DATA_FORMAT 0x02 -#define RIGHT_J_DATA_FORMAT 0x04 +#define LEFT_J_DATA_FORMAT 0x10 +#define I2S_DATA_FORMAT 0x12 +#define RIGHT_J_DATA_FORMAT 0x14 #define CODEC_MUTE_VAL 0x80 #define POWER_CNTLMSAK 0x40 @@ -290,7 +289,7 @@ static int sta529_set_dai_fmt(struct snd_soc_dai *codec_dai, u32 fmt) return -EINVAL; } - snd_soc_update_bits(codec, STA529_S2PCFG0, DATA_FORMAT_MSK, mode); + snd_soc_update_bits(codec, STA529_S2PCFG0, 0x0D, mode); return 0; } diff --git a/trunk/sound/soc/codecs/wm2000.c b/trunk/sound/soc/codecs/wm2000.c index 12bcae63a7f0..1cbe88f01d63 100644 --- a/trunk/sound/soc/codecs/wm2000.c +++ b/trunk/sound/soc/codecs/wm2000.c @@ -209,9 +209,9 @@ static int wm2000_power_up(struct i2c_client *i2c, int analogue) ret = wm2000_read(i2c, WM2000_REG_SPEECH_CLARITY); if (wm2000->speech_clarity) - ret |= WM2000_SPEECH_CLARITY; - else ret &= ~WM2000_SPEECH_CLARITY; + else + ret |= WM2000_SPEECH_CLARITY; wm2000_write(i2c, WM2000_REG_SPEECH_CLARITY, ret); wm2000_write(i2c, WM2000_REG_SYS_START0, 0x33); diff --git a/trunk/sound/soc/codecs/wm2200.c b/trunk/sound/soc/codecs/wm2200.c index e6cefe1ac677..afcf31df77e0 100644 --- a/trunk/sound/soc/codecs/wm2200.c +++ b/trunk/sound/soc/codecs/wm2200.c @@ -1566,9 +1566,15 @@ static int wm2200_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) case SND_SOC_DAIFMT_DSP_A: fmt_val = 0; break; + case SND_SOC_DAIFMT_DSP_B: + fmt_val = 1; + break; case SND_SOC_DAIFMT_I2S: fmt_val = 2; break; + case SND_SOC_DAIFMT_LEFT_J: + fmt_val = 3; + break; default: dev_err(codec->dev, "Unsupported DAI format %d\n", fmt & SND_SOC_DAIFMT_FORMAT_MASK); @@ -1620,7 +1626,7 @@ static int wm2200_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) WM2200_AIF1TX_LRCLK_MSTR | WM2200_AIF1TX_LRCLK_INV, lrclk); snd_soc_update_bits(codec, WM2200_AUDIO_IF_1_5, - WM2200_AIF1_FMT_MASK, fmt_val); + WM2200_AIF1_FMT_MASK << 1, fmt_val << 1); return 0; } diff --git a/trunk/sound/soc/codecs/wm5100.c b/trunk/sound/soc/codecs/wm5100.c index 54397a508073..5a5f36936235 100644 --- a/trunk/sound/soc/codecs/wm5100.c +++ b/trunk/sound/soc/codecs/wm5100.c @@ -1279,9 +1279,15 @@ static int wm5100_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) case SND_SOC_DAIFMT_DSP_A: mask = 0; break; + case SND_SOC_DAIFMT_DSP_B: + mask = 1; + break; case SND_SOC_DAIFMT_I2S: mask = 2; break; + case SND_SOC_DAIFMT_LEFT_J: + mask = 3; + break; default: dev_err(codec->dev, "Unsupported DAI format %d\n", fmt & SND_SOC_DAIFMT_FORMAT_MASK); diff --git a/trunk/sound/soc/codecs/wm5102.c b/trunk/sound/soc/codecs/wm5102.c index 7a9048dad1cd..688ade080589 100644 --- a/trunk/sound/soc/codecs/wm5102.c +++ b/trunk/sound/soc/codecs/wm5102.c @@ -36,9 +36,6 @@ struct wm5102_priv { struct arizona_priv core; struct arizona_fll fll[2]; - - unsigned int spk_ena:2; - unsigned int spk_ena_pending:1; }; static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0); @@ -790,47 +787,6 @@ ARIZONA_MIXER_CONTROLS("AIF3TX1", ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE), ARIZONA_MIXER_CONTROLS("AIF3TX2", ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE), }; -static int wm5102_spk_ev(struct snd_soc_dapm_widget *w, - struct snd_kcontrol *kcontrol, - int event) -{ - struct snd_soc_codec *codec = w->codec; - struct arizona *arizona = dev_get_drvdata(codec->dev->parent); - struct wm5102_priv *wm5102 = snd_soc_codec_get_drvdata(codec); - - if (arizona->rev < 1) - return 0; - - switch (event) { - case SND_SOC_DAPM_PRE_PMU: - if (!wm5102->spk_ena) { - snd_soc_write(codec, 0x4f5, 0x25a); - wm5102->spk_ena_pending = true; - } - break; - case SND_SOC_DAPM_POST_PMU: - if (wm5102->spk_ena_pending) { - msleep(75); - snd_soc_write(codec, 0x4f5, 0xda); - wm5102->spk_ena_pending = false; - wm5102->spk_ena++; - } - break; - case SND_SOC_DAPM_PRE_PMD: - wm5102->spk_ena--; - if (!wm5102->spk_ena) - snd_soc_write(codec, 0x4f5, 0x25a); - break; - case SND_SOC_DAPM_POST_PMD: - if (!wm5102->spk_ena) - snd_soc_write(codec, 0x4f5, 0x0da); - break; - } - - return 0; -} - - ARIZONA_MIXER_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE); ARIZONA_MIXER_ENUMS(EQ2, ARIZONA_EQ2MIX_INPUT_1_SOURCE); ARIZONA_MIXER_ENUMS(EQ3, ARIZONA_EQ3MIX_INPUT_1_SOURCE); @@ -1078,10 +1034,10 @@ SND_SOC_DAPM_PGA_E("OUT3L", ARIZONA_OUTPUT_ENABLES_1, ARIZONA_OUT3L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), SND_SOC_DAPM_PGA_E("OUT4L", ARIZONA_OUTPUT_ENABLES_1, - ARIZONA_OUT4L_ENA_SHIFT, 0, NULL, 0, wm5102_spk_ev, + ARIZONA_OUT4L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), SND_SOC_DAPM_PGA_E("OUT4R", ARIZONA_OUTPUT_ENABLES_1, - ARIZONA_OUT4R_ENA_SHIFT, 0, NULL, 0, wm5102_spk_ev, + ARIZONA_OUT4R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1, ARIZONA_OUT5L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, diff --git a/trunk/sound/soc/codecs/wm_adsp.c b/trunk/sound/soc/codecs/wm_adsp.c index 7b198c38f3ef..ffc89fab96fb 100644 --- a/trunk/sound/soc/codecs/wm_adsp.c +++ b/trunk/sound/soc/codecs/wm_adsp.c @@ -169,7 +169,6 @@ static int wm_adsp_load(struct wm_adsp *dsp) const struct wm_adsp_region *mem; const char *region_name; char *file, *text; - void *buf; unsigned int reg; int regions = 0; int ret, offset, type, sizes; @@ -323,18 +322,8 @@ static int wm_adsp_load(struct wm_adsp *dsp) } if (reg) { - buf = kmemdup(region->data, le32_to_cpu(region->len), - GFP_KERNEL); - if (!buf) { - adsp_err(dsp, "Out of memory\n"); - return -ENOMEM; - } - - ret = regmap_raw_write(regmap, reg, buf, + ret = regmap_raw_write(regmap, reg, region->data, le32_to_cpu(region->len)); - - kfree(buf); - if (ret != 0) { adsp_err(dsp, "%s.%d: Failed to write %d bytes at %d in %s: %d\n", @@ -370,7 +359,6 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp) const char *region_name; int ret, pos, blocks, type, offset, reg; char *file; - void *buf; file = kzalloc(PAGE_SIZE, GFP_KERNEL); if (file == NULL) @@ -438,13 +426,6 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp) } if (reg) { - buf = kmemdup(blk->data, le32_to_cpu(blk->len), - GFP_KERNEL); - if (!buf) { - adsp_err(dsp, "Out of memory\n"); - return -ENOMEM; - } - ret = regmap_raw_write(regmap, reg, blk->data, le32_to_cpu(blk->len)); if (ret != 0) { @@ -452,8 +433,6 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp) "%s.%d: Failed to write to %x in %s\n", file, blocks, reg, region_name); } - - kfree(buf); } pos += le32_to_cpu(blk->len) + sizeof(*blk); diff --git a/trunk/sound/soc/soc-core.c b/trunk/sound/soc/soc-core.c index 2370063b5824..91d592ff67b7 100644 --- a/trunk/sound/soc/soc-core.c +++ b/trunk/sound/soc/soc-core.c @@ -1255,8 +1255,6 @@ static int soc_post_component_init(struct snd_soc_card *card, INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_CAPTURE].fe_clients); ret = device_add(rtd->dev); if (ret < 0) { - /* calling put_device() here to free the rtd->dev */ - put_device(rtd->dev); dev_err(card->dev, "ASoC: failed to register runtime device: %d\n", ret); return ret; @@ -1556,7 +1554,7 @@ static void soc_remove_aux_dev(struct snd_soc_card *card, int num) /* unregister the rtd device */ if (rtd->dev_registered) { device_remove_file(rtd->dev, &dev_attr_codec_reg); - device_unregister(rtd->dev); + device_del(rtd->dev); rtd->dev_registered = 0; } @@ -2919,7 +2917,7 @@ int snd_soc_info_volsw_range(struct snd_kcontrol *kcontrol, platform_max = mc->platform_max; uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; - uinfo->count = snd_soc_volsw_is_stereo(mc) ? 2 : 1; + uinfo->count = 1; uinfo->value.integer.min = 0; uinfo->value.integer.max = platform_max - min; @@ -2943,14 +2941,12 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol, (struct soc_mixer_control *)kcontrol->private_value; struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); unsigned int reg = mc->reg; - unsigned int rreg = mc->rreg; unsigned int shift = mc->shift; int min = mc->min; int max = mc->max; unsigned int mask = (1 << fls(max)) - 1; unsigned int invert = mc->invert; unsigned int val, val_mask; - int ret; val = ((ucontrol->value.integer.value[0] + min) & mask); if (invert) @@ -2958,21 +2954,7 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol, val_mask = mask << shift; val = val << shift; - ret = snd_soc_update_bits_locked(codec, reg, val_mask, val); - if (ret != 0) - return ret; - - if (snd_soc_volsw_is_stereo(mc)) { - val = ((ucontrol->value.integer.value[1] + min) & mask); - if (invert) - val = max - val; - val_mask = mask << shift; - val = val << shift; - - ret = snd_soc_update_bits_locked(codec, rreg, val_mask, val); - } - - return ret; + return snd_soc_update_bits_locked(codec, reg, val_mask, val); } EXPORT_SYMBOL_GPL(snd_soc_put_volsw_range); @@ -2992,7 +2974,6 @@ int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol, (struct soc_mixer_control *)kcontrol->private_value; struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); unsigned int reg = mc->reg; - unsigned int rreg = mc->rreg; unsigned int shift = mc->shift; int min = mc->min; int max = mc->max; @@ -3007,16 +2988,6 @@ int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol, ucontrol->value.integer.value[0] = ucontrol->value.integer.value[0] - min; - if (snd_soc_volsw_is_stereo(mc)) { - ucontrol->value.integer.value[1] = - (snd_soc_read(codec, rreg) >> shift) & mask; - if (invert) - ucontrol->value.integer.value[1] = - max - ucontrol->value.integer.value[1]; - ucontrol->value.integer.value[1] = - ucontrol->value.integer.value[1] - min; - } - return 0; } EXPORT_SYMBOL_GPL(snd_soc_get_volsw_range); diff --git a/trunk/sound/soc/soc-pcm.c b/trunk/sound/soc/soc-pcm.c index cf191e6aebbe..d7711fce119b 100644 --- a/trunk/sound/soc/soc-pcm.c +++ b/trunk/sound/soc/soc-pcm.c @@ -1243,7 +1243,6 @@ static int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream) if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && - (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED) && (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) continue; diff --git a/trunk/sound/usb/midi.c b/trunk/sound/usb/midi.c index 34b9bb7fe87c..c183d34842ac 100644 --- a/trunk/sound/usb/midi.c +++ b/trunk/sound/usb/midi.c @@ -2181,6 +2181,10 @@ int snd_usbmidi_create(struct snd_card *card, umidi->usb_protocol_ops = &snd_usbmidi_novation_ops; err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); break; + case QUIRK_MIDI_MBOX2: + umidi->usb_protocol_ops = &snd_usbmidi_midiman_ops; + err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); + break; case QUIRK_MIDI_RAW_BYTES: umidi->usb_protocol_ops = &snd_usbmidi_raw_ops; /* diff --git a/trunk/sound/usb/mixer_maps.c b/trunk/sound/usb/mixer_maps.c index 0e2ed3d05c45..e71fe55cebef 100644 --- a/trunk/sound/usb/mixer_maps.c +++ b/trunk/sound/usb/mixer_maps.c @@ -179,15 +179,6 @@ static struct usbmix_name_map audigy2nx_map[] = { { 0 } /* terminator */ }; -static struct usbmix_selector_map c400_selectors[] = { - { - .id = 0x80, - .count = 2, - .names = (const char*[]) {"Internal", "SPDIF"} - }, - { 0 } /* terminator */ -}; - static struct usbmix_selector_map audigy2nx_selectors[] = { { .id = 14, /* Capture Source */ @@ -375,10 +366,6 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = { .id = USB_ID(0x06f8, 0xc000), .map = hercules_usb51_map, }, - { - .id = USB_ID(0x0763, 0x2030), - .selector_map = c400_selectors, - }, { .id = USB_ID(0x08bb, 0x2702), .map = linex_map, diff --git a/trunk/sound/usb/mixer_quirks.c b/trunk/sound/usb/mixer_quirks.c index 15520de1df56..0422b1360af3 100644 --- a/trunk/sound/usb/mixer_quirks.c +++ b/trunk/sound/usb/mixer_quirks.c @@ -1206,7 +1206,7 @@ static int snd_c400_create_mixer(struct usb_mixer_interface *mixer) * are valid they presents mono controls as L and R channels of * stereo. So we provide a good mixer here. */ -static struct std_mono_table ebox44_table[] = { +struct std_mono_table ebox44_table[] = { { .unitid = 4, .control = 1, diff --git a/trunk/sound/usb/pcm.c b/trunk/sound/usb/pcm.c index d82e378d37cb..c6593101c049 100644 --- a/trunk/sound/usb/pcm.c +++ b/trunk/sound/usb/pcm.c @@ -511,16 +511,6 @@ static int configure_sync_endpoint(struct snd_usb_substream *subs) struct snd_usb_substream *sync_subs = &subs->stream->substream[subs->direction ^ 1]; - if (subs->sync_endpoint->type != SND_USB_ENDPOINT_TYPE_DATA || - !subs->stream) - return snd_usb_endpoint_set_params(subs->sync_endpoint, - subs->pcm_format, - subs->channels, - subs->period_bytes, - subs->cur_rate, - subs->cur_audiofmt, - NULL); - /* Try to find the best matching audioformat. */ list_for_each_entry(fp, &sync_subs->fmt_list, list) { int score = match_endpoint_audioformats(fp, subs->cur_audiofmt, diff --git a/trunk/sound/usb/quirks-table.h b/trunk/sound/usb/quirks-table.h index 64d25a7a4d59..cdcf6b45e8a8 100644 --- a/trunk/sound/usb/quirks-table.h +++ b/trunk/sound/usb/quirks-table.h @@ -50,28 +50,6 @@ } }, -{ - /* Creative BT-D1 */ - USB_DEVICE(0x041e, 0x0005), - .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { - .ifnum = 1, - .type = QUIRK_AUDIO_FIXED_ENDPOINT, - .data = &(const struct audioformat) { - .formats = SNDRV_PCM_FMTBIT_S16_LE, - .channels = 2, - .iface = 1, - .altsetting = 1, - .altset_idx = 1, - .endpoint = 0x03, - .ep_attr = USB_ENDPOINT_XFER_ISOC, - .attributes = 0, - .rates = SNDRV_PCM_RATE_CONTINUOUS, - .rate_min = 48000, - .rate_max = 48000, - } - } -}, - /* Creative/Toshiba Multimedia Center SB-0500 */ { USB_DEVICE(0x041e, 0x3048), @@ -2289,7 +2267,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), .rate_table = (unsigned int[]) { 44100, 48000, 88200, 96000 }, - .clock = 0x80, + .clock = 0x81, } }, /* Capture */ @@ -2315,7 +2293,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), .rate_table = (unsigned int[]) { 44100, 48000, 88200, 96000 }, - .clock = 0x80, + .clock = 0x81, } }, /* MIDI */ @@ -3015,7 +2993,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), }, { .ifnum = 6, - .type = QUIRK_MIDI_MIDIMAN, + .type = QUIRK_MIDI_MBOX2, .data = &(const struct snd_usb_midi_endpoint_info) { .out_ep = 0x02, .out_cables = 0x0001, diff --git a/trunk/sound/usb/quirks.c b/trunk/sound/usb/quirks.c index 2c971858d6b7..f104c68fe1e0 100644 --- a/trunk/sound/usb/quirks.c +++ b/trunk/sound/usb/quirks.c @@ -306,6 +306,7 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip, [QUIRK_MIDI_YAMAHA] = create_any_midi_quirk, [QUIRK_MIDI_MIDIMAN] = create_any_midi_quirk, [QUIRK_MIDI_NOVATION] = create_any_midi_quirk, + [QUIRK_MIDI_MBOX2] = create_any_midi_quirk, [QUIRK_MIDI_RAW_BYTES] = create_any_midi_quirk, [QUIRK_MIDI_EMAGIC] = create_any_midi_quirk, [QUIRK_MIDI_CME] = create_any_midi_quirk, @@ -387,13 +388,11 @@ static int snd_usb_fasttrackpro_boot_quirk(struct usb_device *dev) * rules */ err = usb_driver_set_configuration(dev, 2); - if (err < 0) + if (err < 0) { snd_printdd("error usb_driver_set_configuration: %d\n", err); - /* Always return an error, so that we stop creating a device - that will just be destroyed and recreated with a new - configuration */ - return -ENODEV; + return -ENODEV; + } } else snd_printk(KERN_INFO "usb-audio: Fast Track Pro config OK\n"); @@ -529,11 +528,11 @@ static void mbox2_setup_48_24_magic(struct usb_device *dev) #define MBOX2_BOOT_LOADING 0x01 /* Hard coded into the device */ #define MBOX2_BOOT_READY 0x02 /* Hard coded into the device */ -static int snd_usb_mbox2_boot_quirk(struct usb_device *dev) +int snd_usb_mbox2_boot_quirk(struct usb_device *dev) { struct usb_host_config *config = dev->actconfig; int err; - u8 bootresponse[12]; + u8 bootresponse; int fwsize; int count; @@ -547,20 +546,20 @@ static int snd_usb_mbox2_boot_quirk(struct usb_device *dev) snd_printd("usb-audio: Sending Digidesign Mbox 2 boot sequence...\n"); count = 0; - bootresponse[0] = MBOX2_BOOT_LOADING; - while ((bootresponse[0] == MBOX2_BOOT_LOADING) && (count < 10)) { + bootresponse = MBOX2_BOOT_LOADING; + while ((bootresponse == MBOX2_BOOT_LOADING) && (count < 10)) { msleep(500); /* 0.5 second delay */ snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), /* Control magic - load onboard firmware */ 0x85, 0xc0, 0x0001, 0x0000, &bootresponse, 0x0012); - if (bootresponse[0] == MBOX2_BOOT_READY) + if (bootresponse == MBOX2_BOOT_READY) break; snd_printd("usb-audio: device not ready, resending boot sequence...\n"); count++; } - if (bootresponse[0] != MBOX2_BOOT_READY) { - snd_printk(KERN_ERR "usb-audio: Unknown bootresponse=%d, or timed out, ignoring device.\n", bootresponse[0]); + if (bootresponse != MBOX2_BOOT_READY) { + snd_printk(KERN_ERR "usb-audio: Unknown bootresponse=%d, or timed out, ignoring device.\n", bootresponse); return -ENODEV; } @@ -661,6 +660,7 @@ static int audiophile_skip_setting_quirk(struct snd_usb_audio *chip, return 0; /* keep this altsetting */ } + static int fasttrackpro_skip_setting_quirk(struct snd_usb_audio *chip, int iface, int altno) { @@ -861,17 +861,6 @@ void snd_usb_endpoint_start_quirk(struct snd_usb_endpoint *ep) if ((le16_to_cpu(ep->chip->dev->descriptor.idVendor) == 0x23ba) && ep->type == SND_USB_ENDPOINT_TYPE_SYNC) ep->skip_packets = 4; - - /* - * M-Audio Fast Track C400 - when packets are not skipped, real world - * latency varies by approx. +/- 50 frames (at 96KHz) each time the - * stream is (re)started. When skipping packets 16 at endpoint start - * up, the real world latency is stable within +/- 1 frame (also - * across power cycles). - */ - if (ep->chip->usb_id == USB_ID(0x0763, 0x2030) && - ep->type == SND_USB_ENDPOINT_TYPE_DATA) - ep->skip_packets = 16; } void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe, diff --git a/trunk/sound/usb/usbaudio.h b/trunk/sound/usb/usbaudio.h index 1ac3fd9cc5a6..a8172c119796 100644 --- a/trunk/sound/usb/usbaudio.h +++ b/trunk/sound/usb/usbaudio.h @@ -76,6 +76,7 @@ enum quirk_type { QUIRK_MIDI_YAMAHA, QUIRK_MIDI_MIDIMAN, QUIRK_MIDI_NOVATION, + QUIRK_MIDI_MBOX2, QUIRK_MIDI_RAW_BYTES, QUIRK_MIDI_EMAGIC, QUIRK_MIDI_CME, diff --git a/trunk/tools/perf/MANIFEST b/trunk/tools/perf/MANIFEST index 39d41068484f..80db3f4bcf7a 100644 --- a/trunk/tools/perf/MANIFEST +++ b/trunk/tools/perf/MANIFEST @@ -11,21 +11,11 @@ lib/rbtree.c include/linux/swab.h arch/*/include/asm/unistd*.h arch/*/include/asm/perf_regs.h -arch/*/include/uapi/asm/unistd*.h -arch/*/include/uapi/asm/perf_regs.h arch/*/lib/memcpy*.S arch/*/lib/memset*.S include/linux/poison.h include/linux/magic.h include/linux/hw_breakpoint.h -include/linux/rbtree_augmented.h -include/uapi/linux/perf_event.h -include/uapi/linux/const.h -include/uapi/linux/swab.h -include/uapi/linux/hw_breakpoint.h arch/x86/include/asm/svm.h arch/x86/include/asm/vmx.h arch/x86/include/asm/kvm_host.h -arch/x86/include/uapi/asm/svm.h -arch/x86/include/uapi/asm/vmx.h -arch/x86/include/uapi/asm/kvm.h diff --git a/trunk/tools/perf/Makefile b/trunk/tools/perf/Makefile index 8ab05e543ef4..891bc77bdb2c 100644 --- a/trunk/tools/perf/Makefile +++ b/trunk/tools/perf/Makefile @@ -58,7 +58,7 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ -e s/arm.*/arm/ -e s/sa110/arm/ \ -e s/s390x/s390/ -e s/parisc64/parisc/ \ -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ - -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ ) + -e s/sh[234].*/sh/ ) NO_PERF_REGS := 1 CC = $(CROSS_COMPILE)gcc diff --git a/trunk/tools/testing/selftests/ipc/Makefile b/trunk/tools/testing/selftests/ipc/Makefile deleted file mode 100644 index 5386fd7c43ae..000000000000 --- a/trunk/tools/testing/selftests/ipc/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -uname_M := $(shell uname -m 2>/dev/null || echo not) -ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/) -ifeq ($(ARCH),i386) - ARCH := X86 - CFLAGS := -DCONFIG_X86_32 -D__i386__ -endif -ifeq ($(ARCH),x86_64) - ARCH := X86 - CFLAGS := -DCONFIG_X86_64 -D__x86_64__ -endif - -CFLAGS += -I../../../../usr/include/ - -all: -ifeq ($(ARCH),X86) - gcc $(CFLAGS) msgque.c -o msgque_test -else - echo "Not an x86 target, can't build msgque selftest" -endif - -run_tests: all - ./msgque_test - -clean: - rm -fr ./msgque_test diff --git a/trunk/tools/testing/selftests/ipc/msgque.c b/trunk/tools/testing/selftests/ipc/msgque.c deleted file mode 100644 index d66418237d21..000000000000 --- a/trunk/tools/testing/selftests/ipc/msgque.c +++ /dev/null @@ -1,246 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#define MAX_MSG_SIZE 32 - -struct msg1 { - int msize; - long mtype; - char mtext[MAX_MSG_SIZE]; -}; - -#define TEST_STRING "Test sysv5 msg" -#define MSG_TYPE 1 - -#define ANOTHER_TEST_STRING "Yet another test sysv5 msg" -#define ANOTHER_MSG_TYPE 26538 - -struct msgque_data { - key_t key; - int msq_id; - int qbytes; - int qnum; - int mode; - struct msg1 *messages; -}; - -int restore_queue(struct msgque_data *msgque) -{ - int fd, ret, id, i; - char buf[32]; - - fd = open("/proc/sys/kernel/msg_next_id", O_WRONLY); - if (fd == -1) { - printf("Failed to open /proc/sys/kernel/msg_next_id\n"); - return -errno; - } - sprintf(buf, "%d", msgque->msq_id); - - ret = write(fd, buf, strlen(buf)); - if (ret != strlen(buf)) { - printf("Failed to write to /proc/sys/kernel/msg_next_id\n"); - return -errno; - } - - id = msgget(msgque->key, msgque->mode | IPC_CREAT | IPC_EXCL); - if (id == -1) { - printf("Failed to create queue\n"); - return -errno; - } - - if (id != msgque->msq_id) { - printf("Restored queue has wrong id (%d instead of %d)\n", - id, msgque->msq_id); - ret = -EFAULT; - goto destroy; - } - - for (i = 0; i < msgque->qnum; i++) { - if (msgsnd(msgque->msq_id, &msgque->messages[i].mtype, - msgque->messages[i].msize, IPC_NOWAIT) != 0) { - printf("msgsnd failed (%m)\n"); - ret = -errno; - goto destroy; - }; - } - return 0; - -destroy: - if (msgctl(id, IPC_RMID, 0)) - printf("Failed to destroy queue: %d\n", -errno); - return ret; -} - -int check_and_destroy_queue(struct msgque_data *msgque) -{ - struct msg1 message; - int cnt = 0, ret; - - while (1) { - ret = msgrcv(msgque->msq_id, &message.mtype, MAX_MSG_SIZE, - 0, IPC_NOWAIT); - if (ret < 0) { - if (errno == ENOMSG) - break; - printf("Failed to read IPC message: %m\n"); - ret = -errno; - goto err; - } - if (ret != msgque->messages[cnt].msize) { - printf("Wrong message size: %d (expected %d)\n", ret, - msgque->messages[cnt].msize); - ret = -EINVAL; - goto err; - } - if (message.mtype != msgque->messages[cnt].mtype) { - printf("Wrong message type\n"); - ret = -EINVAL; - goto err; - } - if (memcmp(message.mtext, msgque->messages[cnt].mtext, ret)) { - printf("Wrong message content\n"); - ret = -EINVAL; - goto err; - } - cnt++; - } - - if (cnt != msgque->qnum) { - printf("Wrong message number\n"); - ret = -EINVAL; - goto err; - } - - ret = 0; -err: - if (msgctl(msgque->msq_id, IPC_RMID, 0)) { - printf("Failed to destroy queue: %d\n", -errno); - return -errno; - } - return ret; -} - -int dump_queue(struct msgque_data *msgque) -{ - struct msqid64_ds ds; - int kern_id; - int i, ret; - - for (kern_id = 0; kern_id < 256; kern_id++) { - ret = msgctl(kern_id, MSG_STAT, &ds); - if (ret < 0) { - if (errno == -EINVAL) - continue; - printf("Failed to get stats for IPC queue with id %d\n", - kern_id); - return -errno; - } - - if (ret == msgque->msq_id) - break; - } - - msgque->messages = malloc(sizeof(struct msg1) * ds.msg_qnum); - if (msgque->messages == NULL) { - printf("Failed to get stats for IPC queue\n"); - return -ENOMEM; - } - - msgque->qnum = ds.msg_qnum; - msgque->mode = ds.msg_perm.mode; - msgque->qbytes = ds.msg_qbytes; - - for (i = 0; i < msgque->qnum; i++) { - ret = msgrcv(msgque->msq_id, &msgque->messages[i].mtype, - MAX_MSG_SIZE, i, IPC_NOWAIT | MSG_COPY); - if (ret < 0) { - printf("Failed to copy IPC message: %m (%d)\n", errno); - return -errno; - } - msgque->messages[i].msize = ret; - } - return 0; -} - -int fill_msgque(struct msgque_data *msgque) -{ - struct msg1 msgbuf; - - msgbuf.mtype = MSG_TYPE; - memcpy(msgbuf.mtext, TEST_STRING, sizeof(TEST_STRING)); - if (msgsnd(msgque->msq_id, &msgbuf.mtype, sizeof(TEST_STRING), - IPC_NOWAIT) != 0) { - printf("First message send failed (%m)\n"); - return -errno; - }; - - msgbuf.mtype = ANOTHER_MSG_TYPE; - memcpy(msgbuf.mtext, ANOTHER_TEST_STRING, sizeof(ANOTHER_TEST_STRING)); - if (msgsnd(msgque->msq_id, &msgbuf.mtype, sizeof(ANOTHER_TEST_STRING), - IPC_NOWAIT) != 0) { - printf("Second message send failed (%m)\n"); - return -errno; - }; - return 0; -} - -int main(int argc, char **argv) -{ - int msg, pid, err; - struct msgque_data msgque; - - msgque.key = ftok(argv[0], 822155650); - if (msgque.key == -1) { - printf("Can't make key\n"); - return -errno; - } - - msgque.msq_id = msgget(msgque.key, IPC_CREAT | IPC_EXCL | 0666); - if (msgque.msq_id == -1) { - printf("Can't create queue\n"); - goto err_out; - } - - err = fill_msgque(&msgque); - if (err) { - printf("Failed to fill queue\n"); - goto err_destroy; - } - - err = dump_queue(&msgque); - if (err) { - printf("Failed to dump queue\n"); - goto err_destroy; - } - - err = check_and_destroy_queue(&msgque); - if (err) { - printf("Failed to check and destroy queue\n"); - goto err_out; - } - - err = restore_queue(&msgque); - if (err) { - printf("Failed to restore queue\n"); - goto err_destroy; - } - - err = check_and_destroy_queue(&msgque); - if (err) { - printf("Failed to test queue\n"); - goto err_out; - } - return 0; - -err_destroy: - if (msgctl(msgque.msq_id, IPC_RMID, 0)) { - printf("Failed to destroy queue: %d\n", -errno); - return -errno; - } -err_out: - return err; -}