aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/00-INDEX6
-rw-r--r--Documentation/bus-virt-phys-mapping.txt (renamed from Documentation/IO-mapping.txt)0
-rw-r--r--Documentation/feature-removal-schedule.txt7
-rw-r--r--Documentation/kernel-parameters.txt4
-rw-r--r--MAINTAINERS1
-rw-r--r--Makefile2
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/mach-clps711x/include/mach/debug-macro.S1
-rw-r--r--arch/arm/mach-davinci/board-da850-evm.c8
-rw-r--r--arch/arm/mach-footbridge/common.c2
-rw-r--r--arch/arm/mach-h720x/include/mach/debug-macro.S6
-rw-r--r--arch/arm/mach-kirkwood/tsx1x-common.c2
-rw-r--r--arch/arm/mach-kirkwood/tsx1x-common.h2
-rw-r--r--arch/arm/mach-ns9xxx/include/mach/debug-macro.S1
-rw-r--r--arch/arm/mach-ns9xxx/include/mach/uncompress.h30
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c17
-rw-r--r--arch/arm/mach-pxa/colibri-pxa300.c3
-rw-r--r--arch/arm/mach-pxa/corgi.c2
-rw-r--r--arch/arm/mach-pxa/cpufreq-pxa2xx.c8
-rw-r--r--arch/arm/mach-pxa/pxa27x.c6
-rw-r--r--arch/arm/mach-shark/include/mach/debug-macro.S3
-rw-r--r--arch/arm/mach-shmobile/Kconfig12
-rw-r--r--arch/arm/mach-shmobile/include/mach/irqs.h1
-rw-r--r--arch/arm/mach-w90x900/cpu.c2
-rw-r--r--arch/arm/plat-spear/include/plat/debug-macro.S4
-rw-r--r--arch/avr32/include/asm/ioctls.h3
-rw-r--r--arch/avr32/mach-at32ap/include/mach/board.h2
-rw-r--r--arch/mips/alchemy/common/platform.c9
-rw-r--r--arch/mips/alchemy/mtx-1/board_setup.c8
-rw-r--r--arch/mips/bcm63xx/dev-enet.c3
-rw-r--r--arch/mips/include/asm/atomic.h24
-rw-r--r--arch/mips/include/asm/unistd.h5
-rw-r--r--arch/mips/kernel/scall64-n32.S1
-rw-r--r--arch/mips/kernel/vdso.c4
-rw-r--r--arch/mips/mti-malta/malta-pci.c2
-rw-r--r--arch/mips/nxp/pnx8550/common/pci.c1
-rw-r--r--arch/mips/nxp/pnx8550/common/setup.c2
-rw-r--r--arch/mips/pci/ops-pmcmsp.c1
-rw-r--r--arch/mips/pci/pci-yosemite.c1
-rw-r--r--arch/mips/powertv/asic/asic_devices.c5
-rw-r--r--arch/powerpc/include/asm/kexec.h6
-rw-r--r--arch/powerpc/include/asm/mmu-hash64.h4
-rw-r--r--arch/powerpc/kernel/perf_event_fsl_emb.c6
-rw-r--r--arch/powerpc/kernel/prom.c2
-rw-r--r--arch/powerpc/mm/hash_low_64.S9
-rw-r--r--arch/powerpc/mm/hash_utils_64.c53
-rw-r--r--arch/powerpc/mm/hugetlbpage-hash64.c40
-rw-r--r--arch/powerpc/mm/numa.c24
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-memory.c22
-rw-r--r--arch/sparc/configs/sparc64_defconfig49
-rw-r--r--arch/sparc/include/asm/cache.h1
-rw-r--r--arch/sparc/include/asm/pgtable_32.h5
-rw-r--r--arch/sparc/kernel/perf_event.c1
-rw-r--r--arch/sparc/kernel/sun4d_irq.c2
-rw-r--r--arch/sparc/kernel/ttable.S2
-rw-r--r--arch/sparc/mm/srmmu.c2
-rw-r--r--arch/sparc/mm/sun4c.c3
-rw-r--r--arch/x86/kernel/acpi/cstate.c9
-rw-r--r--arch/x86/kernel/acpi/sleep.c9
-rw-r--r--arch/x86/kernel/apic/apic.c2
-rw-r--r--arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c41
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k8.c11
-rw-r--r--arch/x86/kernel/early-quirks.c18
-rw-r--r--arch/x86/kernel/entry_64.S4
-rw-r--r--arch/x86/kernel/hpet.c2
-rw-r--r--arch/x86/kernel/i8259.c25
-rw-r--r--arch/x86/kernel/kgdb.c9
-rw-r--r--arch/x86/kernel/kprobes.c2
-rw-r--r--arch/x86/kernel/quirks.c5
-rw-r--r--arch/x86/kernel/setup_percpu.c17
-rw-r--r--arch/x86/kvm/mmu.c2
-rw-r--r--arch/x86/kvm/paging_tmpl.h1
-rw-r--r--arch/x86/kvm/x86.c4
-rw-r--r--arch/x86/pci/i386.c1
-rw-r--r--arch/x86/pci/mrst.c7
-rw-r--r--crypto/ablkcipher.c2
-rw-r--r--drivers/acpi/acpica/evxfevnt.c19
-rw-r--r--drivers/acpi/battery.c8
-rw-r--r--drivers/acpi/blacklist.c2
-rw-r--r--drivers/acpi/processor_core.c2
-rw-r--r--drivers/acpi/processor_idle.c10
-rw-r--r--drivers/acpi/sleep.c35
-rw-r--r--drivers/base/core.c2
-rw-r--r--drivers/char/agp/intel-gtt.c13
-rw-r--r--drivers/char/sysrq.c2
-rw-r--r--drivers/char/tpm/tpm_tis.c9
-rw-r--r--drivers/clocksource/cs5535-clockevt.c2
-rw-r--r--drivers/cpufreq/cpufreq.c12
-rw-r--r--drivers/crypto/talitos.c6
-rw-r--r--drivers/edac/Kconfig2
-rw-r--r--drivers/edac/i7core_edac.c2
-rw-r--r--drivers/edac/mpc85xx_edac.c4
-rw-r--r--drivers/gpio/cs5535-gpio.c2
-rw-r--r--drivers/gpio/gpiolib.c7
-rw-r--r--drivers/gpu/drm/i915/i915_debugfs.c3
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c2
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h5
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c16
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h65
-rw-r--r--drivers/gpu/drm/i915/intel_display.c109
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c53
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h3
-rw-r--r--drivers/gpu/drm/i915/intel_fb.c4
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c23
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bios.c33
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_fbcon.c3
-rw-r--r--drivers/gpu/drm/radeon/evergreen_cs.c2
-rw-r--r--drivers/gpu/drm/radeon/r100.c3
-rw-r--r--drivers/gpu/drm/radeon/r300.c3
-rw-r--r--drivers/gpu/drm/radeon/r520.c1
-rw-r--r--drivers/gpu/drm/radeon/r600.c1
-rw-r--r--drivers/gpu/drm/radeon/r600_blit.c5
-rw-r--r--drivers/gpu/drm/radeon/r600_cs.c3
-rw-r--r--drivers/gpu/drm/radeon/radeon.h1
-rw-r--r--drivers/gpu/drm/radeon/radeon_atombios.c20
-rw-r--r--drivers/gpu/drm/radeon/radeon_combios.c8
-rw-r--r--drivers/gpu/drm/radeon/radeon_connectors.c23
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c8
-rw-r--r--drivers/gpu/drm/radeon/radeon_kms.c3
-rw-r--r--drivers/gpu/drm/radeon/radeon_legacy_encoders.c1
-rw-r--r--drivers/gpu/drm/radeon/radeon_legacy_tv.c4
-rw-r--r--drivers/gpu/drm/radeon/rs400.c5
-rw-r--r--drivers/gpu/drm/radeon/rs600.c1
-rw-r--r--drivers/gpu/drm/radeon/rs690.c1
-rw-r--r--drivers/gpu/drm/radeon/rv515.c1
-rw-r--r--drivers/gpu/drm/ttm/ttm_page_alloc.c6
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_kms.c1
-rw-r--r--drivers/input/joystick/gamecon.c5
-rw-r--r--drivers/input/keyboard/Kconfig2
-rw-r--r--drivers/input/keyboard/twl4030_keypad.c17
-rw-r--r--drivers/input/keyboard/w90p910_keypad.c2
-rw-r--r--drivers/input/mouse/synaptics.c8
-rw-r--r--drivers/input/mouse/synaptics.h3
-rw-r--r--drivers/input/serio/i8042-x86ia64io.h7
-rw-r--r--drivers/input/touchscreen/w90p910_ts.c2
-rw-r--r--drivers/misc/cs5535-mfgpt.c2
-rw-r--r--drivers/mmc/host/sdhci-s3c.c20
-rw-r--r--drivers/net/bnx2x.h4
-rw-r--r--drivers/net/bnx2x_main.c42
-rw-r--r--drivers/net/bonding/bond_alb.c2
-rw-r--r--drivers/net/declance.c6
-rw-r--r--drivers/net/ibmveth.c4
-rw-r--r--drivers/net/igb/igb_main.c9
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c9
-rw-r--r--drivers/net/macvlan.c10
-rw-r--r--drivers/net/macvtap.c18
-rw-r--r--drivers/net/pcmcia/axnet_cs.c7
-rw-r--r--drivers/net/r8169.c2
-rw-r--r--drivers/net/s2io.h2
-rw-r--r--drivers/net/tun.c14
-rw-r--r--drivers/net/wimax/i2400m/i2400m-usb.h1
-rw-r--r--drivers/net/wimax/i2400m/usb.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/hif_usb.c8
-rw-r--r--drivers/net/wireless/ath/ath9k/recv.c4
-rw-r--r--drivers/net/wireless/hostap/hostap_pci.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.h11
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c10
-rw-r--r--drivers/pci/setup-res.c32
-rw-r--r--drivers/pcmcia/pcmcia_resource.c4
-rw-r--r--drivers/pcmcia/pxa2xx_base.c5
-rw-r--r--drivers/platform/x86/intel_scu_ipc.c12
-rw-r--r--drivers/power/ds2782_battery.c31
-rw-r--r--drivers/regulator/ab3100.c4
-rw-r--r--drivers/regulator/tps6507x-regulator.c36
-rw-r--r--drivers/regulator/wm8350-regulator.c2
-rw-r--r--drivers/rtc/rtc-rx8581.c20
-rw-r--r--drivers/s390/block/dasd_devmap.c4
-rw-r--r--drivers/s390/cio/chsc.c2
-rw-r--r--drivers/s390/scsi/zfcp_erp.c8
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c10
-rw-r--r--drivers/s390/scsi/zfcp_qdio.c10
-rw-r--r--drivers/sbus/char/openprom.c4
-rw-r--r--drivers/scsi/ibmvscsi/rpa_vscsi.c13
-rw-r--r--drivers/scsi/ipr.c51
-rw-r--r--drivers/scsi/ipr.h5
-rw-r--r--drivers/serial/atmel_serial.c1
-rw-r--r--drivers/serial/suncore.c4
-rw-r--r--drivers/serial/sunsu.c13
-rw-r--r--drivers/usb/class/cdc-acm.c1
-rw-r--r--drivers/usb/core/hub.c2
-rw-r--r--drivers/usb/core/quirks.c7
-rw-r--r--drivers/usb/gadget/f_fs.c2
-rw-r--r--drivers/usb/gadget/pxa27x_udc.c2
-rw-r--r--drivers/usb/gadget/s3c2410_udc.c4
-rw-r--r--drivers/usb/host/ohci-pxa27x.c2
-rw-r--r--drivers/usb/host/xhci-mem.c26
-rw-r--r--drivers/usb/host/xhci-ring.c11
-rw-r--r--drivers/usb/host/xhci.c2
-rw-r--r--drivers/usb/host/xhci.h2
-rw-r--r--drivers/usb/misc/sisusbvga/sisusb.c5
-rw-r--r--drivers/usb/musb/tusb6010.c13
-rw-r--r--drivers/usb/serial/ftdi_sio.c9
-rw-r--r--drivers/usb/serial/ftdi_sio_ids.h15
-rw-r--r--drivers/usb/serial/option.c4
-rw-r--r--drivers/usb/serial/qcserial.c2
-rw-r--r--drivers/usb/serial/sierra.c1
-rw-r--r--drivers/usb/storage/transport.c4
-rw-r--r--drivers/vhost/net.c13
-rw-r--r--drivers/video/aty/radeon_pm.c2
-rw-r--r--drivers/video/au1100fb.c6
-rw-r--r--drivers/video/gbefb.c16
-rw-r--r--drivers/video/pmag-ba-fb.c6
-rw-r--r--drivers/video/pmagb-b-fb.c12
-rw-r--r--drivers/virtio/virtio_ring.c5
-rw-r--r--fs/9p/vfs_dir.c2
-rw-r--r--fs/btrfs/ctree.c129
-rw-r--r--fs/btrfs/ioctl.c20
-rw-r--r--fs/ceph/Kconfig2
-rw-r--r--fs/ceph/auth_x.c3
-rw-r--r--fs/ceph/caps.c15
-rw-r--r--fs/ceph/dir.c13
-rw-r--r--fs/ceph/file.c2
-rw-r--r--fs/ceph/inode.c6
-rw-r--r--fs/ceph/mds_client.c45
-rw-r--r--fs/ceph/mds_client.h1
-rw-r--r--fs/ceph/messenger.c71
-rw-r--r--fs/ceph/mon_client.c6
-rw-r--r--fs/ceph/osd_client.c6
-rw-r--r--fs/ceph/osdmap.c27
-rw-r--r--fs/cifs/cifsfs.c6
-rw-r--r--fs/cifs/dns_resolve.c69
-rw-r--r--fs/cifs/dns_resolve.h4
-rw-r--r--fs/dcache.c2
-rw-r--r--fs/ecryptfs/messaging.c17
-rw-r--r--fs/gfs2/bmap.c1
-rw-r--r--fs/gfs2/dir.c33
-rw-r--r--fs/gfs2/glock.c12
-rw-r--r--fs/gfs2/inode.c12
-rw-r--r--fs/gfs2/quota.c10
-rw-r--r--fs/gfs2/quota.h2
-rw-r--r--fs/inode.c2
-rw-r--r--fs/jbd2/journal.c15
-rw-r--r--fs/jbd2/transaction.c9
-rw-r--r--fs/jffs2/xattr.c2
-rw-r--r--fs/mbcache.c5
-rw-r--r--fs/nfs/dir.c2
-rw-r--r--fs/nfs/internal.h3
-rw-r--r--fs/ocfs2/aops.c94
-rw-r--r--fs/ocfs2/dlm/dlmdomain.c3
-rw-r--r--fs/ocfs2/dlm/dlmmaster.c22
-rw-r--r--fs/ocfs2/dlm/dlmrecovery.c2
-rw-r--r--fs/ocfs2/file.c309
-rw-r--r--fs/ocfs2/file.h6
-rw-r--r--fs/ocfs2/journal.c30
-rw-r--r--fs/ocfs2/localalloc.c7
-rw-r--r--fs/ocfs2/quota_global.c2
-rw-r--r--fs/ocfs2/quota_local.c4
-rw-r--r--fs/ocfs2/refcounttree.c12
-rw-r--r--fs/ocfs2/suballoc.c2
-rw-r--r--fs/ocfs2/xattr.c200
-rw-r--r--fs/partitions/ibm.c14
-rw-r--r--fs/quota/dquot.c2
-rw-r--r--fs/sysfs/symlink.c26
-rw-r--r--fs/ubifs/shrinker.c2
-rw-r--r--fs/ubifs/ubifs.h2
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.c5
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c2
-rw-r--r--fs/xfs/linux-2.6/xfs_sync.c130
-rw-r--r--fs/xfs/linux-2.6/xfs_sync.h2
-rw-r--r--fs/xfs/linux-2.6/xfs_trace.h3
-rw-r--r--fs/xfs/quota/xfs_qm.c7
-rw-r--r--fs/xfs/xfs_mount.h2
-rw-r--r--include/acpi/processor.h3
-rw-r--r--include/asm-generic/vmlinux.lds.h12
-rw-r--r--include/linux/acpi.h2
-rw-r--r--include/linux/fb.h2
-rw-r--r--include/linux/fdtable.h3
-rw-r--r--include/linux/i8042.h12
-rw-r--r--include/linux/if_macvlan.h2
-rw-r--r--include/linux/jbd2.h11
-rw-r--r--include/linux/mm.h2
-rw-r--r--include/linux/pci.h1
-rw-r--r--include/linux/regulator/tps6507x.h32
-rw-r--r--include/linux/syscalls.h6
-rw-r--r--include/linux/sysrq.h1
-rw-r--r--include/linux/vgaarb.h1
-rw-r--r--include/math-emu/op-common.h2
-rw-r--r--include/net/sock.h7
-rw-r--r--include/net/tc_act/tc_mirred.h1
-rw-r--r--ipc/sem.c46
-rw-r--r--kernel/debug/debug_core.c2
-rw-r--r--kernel/debug/gdbstub.c9
-rw-r--r--kernel/debug/kdb/kdb_main.c7
-rw-r--r--kernel/early_res.c6
-rw-r--r--kernel/module.c4
-rw-r--r--mm/bootmem.c24
-rw-r--r--mm/page_alloc.c8
-rw-r--r--mm/page_cgroup.c7
-rw-r--r--mm/vmscan.c10
-rw-r--r--net/bluetooth/hci_conn.c5
-rw-r--r--net/bluetooth/hci_event.c2
-rw-r--r--net/bluetooth/l2cap.c14
-rw-r--r--net/bridge/br_device.c9
-rw-r--r--net/bridge/br_forward.c23
-rw-r--r--net/core/dev.c21
-rw-r--r--net/core/neighbour.c5
-rw-r--r--net/core/skbuff.c7
-rw-r--r--net/dsa/Kconfig2
-rw-r--r--net/ipv4/ipmr.c8
-rw-r--r--net/ipv4/tcp.c1
-rw-r--r--net/ipv4/tcp_output.c3
-rw-r--r--net/ipv6/addrconf.c14
-rw-r--r--net/ipv6/mip6.c3
-rw-r--r--net/mac80211/cfg.c2
-rw-r--r--net/phonet/pep.c1
-rw-r--r--net/sched/act_mirred.c43
-rw-r--r--net/sched/act_nat.c5
-rw-r--r--net/sunrpc/auth.c2
-rw-r--r--net/xfrm/xfrm_policy.c15
-rw-r--r--scripts/kconfig/nconf.gui.c2
-rw-r--r--scripts/package/Makefile2
-rwxr-xr-xscripts/setlocalversion16
-rw-r--r--sound/soc/au1x/psc-i2s.c2
-rw-r--r--sound/soc/codecs/Kconfig4
-rw-r--r--sound/soc/codecs/wm8727.c2
-rw-r--r--sound/soc/codecs/wm8776.c1
-rw-r--r--sound/soc/codecs/wm8988.c1
-rw-r--r--sound/soc/sh/fsi.c27
-rw-r--r--tools/perf/Makefile40
-rw-r--r--tools/perf/arch/sparc/Makefile4
-rw-r--r--tools/perf/arch/sparc/util/dwarf-regs.c43
-rw-r--r--tools/perf/builtin-report.c2
-rwxr-xr-xtools/perf/util/PERF-VERSION-GEN17
-rw-r--r--tools/perf/util/callchain.c35
-rw-r--r--tools/perf/util/callchain.h5
-rw-r--r--tools/perf/util/hist.c29
-rw-r--r--tools/perf/util/symbol.c17
327 files changed, 2758 insertions, 1185 deletions
diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX
index dd10b51b4e65..5405f7aecefc 100644
--- a/Documentation/00-INDEX
+++ b/Documentation/00-INDEX
@@ -32,8 +32,6 @@ DocBook/
32 - directory with DocBook templates etc. for kernel documentation. 32 - directory with DocBook templates etc. for kernel documentation.
33HOWTO 33HOWTO
34 - the process and procedures of how to do Linux kernel development. 34 - the process and procedures of how to do Linux kernel development.
35IO-mapping.txt
36 - how to access I/O mapped memory from within device drivers.
37IPMI.txt 35IPMI.txt
38 - info on Linux Intelligent Platform Management Interface (IPMI) Driver. 36 - info on Linux Intelligent Platform Management Interface (IPMI) Driver.
39IRQ-affinity.txt 37IRQ-affinity.txt
@@ -84,6 +82,8 @@ blockdev/
84 - info on block devices & drivers 82 - info on block devices & drivers
85btmrvl.txt 83btmrvl.txt
86 - info on Marvell Bluetooth driver usage. 84 - info on Marvell Bluetooth driver usage.
85bus-virt-phys-mapping.txt
86 - how to access I/O mapped memory from within device drivers.
87cachetlb.txt 87cachetlb.txt
88 - describes the cache/TLB flushing interfaces Linux uses. 88 - describes the cache/TLB flushing interfaces Linux uses.
89cdrom/ 89cdrom/
@@ -168,6 +168,8 @@ initrd.txt
168 - how to use the RAM disk as an initial/temporary root filesystem. 168 - how to use the RAM disk as an initial/temporary root filesystem.
169input/ 169input/
170 - info on Linux input device support. 170 - info on Linux input device support.
171io-mapping.txt
172 - description of io_mapping functions in linux/io-mapping.h
171io_ordering.txt 173io_ordering.txt
172 - info on ordering I/O writes to memory-mapped addresses. 174 - info on ordering I/O writes to memory-mapped addresses.
173ioctl/ 175ioctl/
diff --git a/Documentation/IO-mapping.txt b/Documentation/bus-virt-phys-mapping.txt
index 1b5aa10df845..1b5aa10df845 100644
--- a/Documentation/IO-mapping.txt
+++ b/Documentation/bus-virt-phys-mapping.txt
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index c268783bc4e7..1571c0c83dba 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -647,3 +647,10 @@ Who: Stefan Richter <stefanr@s5r6.in-berlin.de>
647 647
648---------------------------- 648----------------------------
649 649
650What: The acpi_sleep=s4_nonvs command line option
651When: 2.6.37
652Files: arch/x86/kernel/acpi/sleep.c
653Why: superseded by acpi_sleep=nonvs
654Who: Rafael J. Wysocki <rjw@sisk.pl>
655
656----------------------------
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 4ddb58df081e..2b2407d9a6d0 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -254,8 +254,8 @@ and is between 256 and 4096 characters. It is defined in the file
254 control method, with respect to putting devices into 254 control method, with respect to putting devices into
255 low power states, to be enforced (the ACPI 2.0 ordering 255 low power states, to be enforced (the ACPI 2.0 ordering
256 of _PTS is used by default). 256 of _PTS is used by default).
257 s4_nonvs prevents the kernel from saving/restoring the 257 nonvs prevents the kernel from saving/restoring the
258 ACPI NVS memory during hibernation. 258 ACPI NVS memory during suspend/hibernation and resume.
259 sci_force_enable causes the kernel to set SCI_EN directly 259 sci_force_enable causes the kernel to set SCI_EN directly
260 on resume from S1/S3 (which is against the ACPI spec, 260 on resume from S1/S3 (which is against the ACPI spec,
261 but some broken systems don't work without it). 261 but some broken systems don't work without it).
diff --git a/MAINTAINERS b/MAINTAINERS
index 58848125b8bf..db3d0f5061f9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5336,6 +5336,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6.git
5336T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next-2.6.git 5336T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next-2.6.git
5337S: Maintained 5337S: Maintained
5338F: arch/sparc/ 5338F: arch/sparc/
5339F: drivers/sbus
5339 5340
5340SPARC SERIAL DRIVERS 5341SPARC SERIAL DRIVERS
5341M: "David S. Miller" <davem@davemloft.net> 5342M: "David S. Miller" <davem@davemloft.net>
diff --git a/Makefile b/Makefile
index 037ff4e62ca0..886bf04931d4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 35 3SUBLEVEL = 35
4EXTRAVERSION = -rc5 4EXTRAVERSION = -rc6
5NAME = Sheep on Meth 5NAME = Sheep on Meth
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 78589a1b0d03..34cef2546e42 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1173,6 +1173,7 @@ config HZ
1173 default 200 if ARCH_EBSA110 || ARCH_S3C2410 || ARCH_S5P6440 || ARCH_S5P6442 || ARCH_S5PV210 1173 default 200 if ARCH_EBSA110 || ARCH_S3C2410 || ARCH_S5P6440 || ARCH_S5P6442 || ARCH_S5PV210
1174 default OMAP_32K_TIMER_HZ if ARCH_OMAP && OMAP_32K_TIMER 1174 default OMAP_32K_TIMER_HZ if ARCH_OMAP && OMAP_32K_TIMER
1175 default AT91_TIMER_HZ if ARCH_AT91 1175 default AT91_TIMER_HZ if ARCH_AT91
1176 default SHMOBILE_TIMER_HZ if ARCH_SHMOBILE
1176 default 100 1177 default 100
1177 1178
1178config THUMB2_KERNEL 1179config THUMB2_KERNEL
diff --git a/arch/arm/mach-clps711x/include/mach/debug-macro.S b/arch/arm/mach-clps711x/include/mach/debug-macro.S
index fedd8076a689..072cc6b61ba3 100644
--- a/arch/arm/mach-clps711x/include/mach/debug-macro.S
+++ b/arch/arm/mach-clps711x/include/mach/debug-macro.S
@@ -11,6 +11,7 @@
11 * 11 *
12*/ 12*/
13 13
14#include <mach/hardware.h>
14#include <asm/hardware/clps7111.h> 15#include <asm/hardware/clps7111.h>
15 16
16 .macro addruart, rx, tmp 17 .macro addruart, rx, tmp
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 2ec3095ffb7b..b280efb1fa12 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -25,6 +25,7 @@
25#include <linux/mtd/partitions.h> 25#include <linux/mtd/partitions.h>
26#include <linux/mtd/physmap.h> 26#include <linux/mtd/physmap.h>
27#include <linux/regulator/machine.h> 27#include <linux/regulator/machine.h>
28#include <linux/regulator/tps6507x.h>
28#include <linux/mfd/tps6507x.h> 29#include <linux/mfd/tps6507x.h>
29#include <linux/input/tps6507x-ts.h> 30#include <linux/input/tps6507x-ts.h>
30 31
@@ -469,6 +470,11 @@ struct regulator_consumer_supply tps65070_ldo2_consumers[] = {
469 }, 470 },
470}; 471};
471 472
473/* We take advantage of the fact that both defdcdc{2,3} are tied high */
474static struct tps6507x_reg_platform_data tps6507x_platform_data = {
475 .defdcdc_default = true,
476};
477
472struct regulator_init_data tps65070_regulator_data[] = { 478struct regulator_init_data tps65070_regulator_data[] = {
473 /* dcdc1 */ 479 /* dcdc1 */
474 { 480 {
@@ -494,6 +500,7 @@ struct regulator_init_data tps65070_regulator_data[] = {
494 }, 500 },
495 .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc2_consumers), 501 .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc2_consumers),
496 .consumer_supplies = tps65070_dcdc2_consumers, 502 .consumer_supplies = tps65070_dcdc2_consumers,
503 .driver_data = &tps6507x_platform_data,
497 }, 504 },
498 505
499 /* dcdc3 */ 506 /* dcdc3 */
@@ -507,6 +514,7 @@ struct regulator_init_data tps65070_regulator_data[] = {
507 }, 514 },
508 .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc3_consumers), 515 .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc3_consumers),
509 .consumer_supplies = tps65070_dcdc3_consumers, 516 .consumer_supplies = tps65070_dcdc3_consumers,
517 .driver_data = &tps6507x_platform_data,
510 }, 518 },
511 519
512 /* ldo1 */ 520 /* ldo1 */
diff --git a/arch/arm/mach-footbridge/common.c b/arch/arm/mach-footbridge/common.c
index e3bc3f6f6b10..88b3dd89be89 100644
--- a/arch/arm/mach-footbridge/common.c
+++ b/arch/arm/mach-footbridge/common.c
@@ -232,7 +232,7 @@ EXPORT_SYMBOL(__bus_to_virt);
232 232
233unsigned long __pfn_to_bus(unsigned long pfn) 233unsigned long __pfn_to_bus(unsigned long pfn)
234{ 234{
235 return __pfn_to_phys(pfn) + (fb_bus_sdram_offset() - PHYS_OFFSET)); 235 return __pfn_to_phys(pfn) + (fb_bus_sdram_offset() - PHYS_OFFSET);
236} 236}
237EXPORT_SYMBOL(__pfn_to_bus); 237EXPORT_SYMBOL(__pfn_to_bus);
238 238
diff --git a/arch/arm/mach-h720x/include/mach/debug-macro.S b/arch/arm/mach-h720x/include/mach/debug-macro.S
index a9ee8f0d48b7..27cafd12f033 100644
--- a/arch/arm/mach-h720x/include/mach/debug-macro.S
+++ b/arch/arm/mach-h720x/include/mach/debug-macro.S
@@ -11,8 +11,10 @@
11 * 11 *
12*/ 12*/
13 13
14 .equ io_virt, IO_BASE 14#include <mach/hardware.h>
15 .equ io_phys, IO_START 15
16 .equ io_virt, IO_VIRT
17 .equ io_phys, IO_PHYS
16 18
17 .macro addruart, rx, tmp 19 .macro addruart, rx, tmp
18 mrc p15, 0, \rx, c1, c0 20 mrc p15, 0, \rx, c1, c0
diff --git a/arch/arm/mach-kirkwood/tsx1x-common.c b/arch/arm/mach-kirkwood/tsx1x-common.c
index 7221c20b2afa..f781164e623f 100644
--- a/arch/arm/mach-kirkwood/tsx1x-common.c
+++ b/arch/arm/mach-kirkwood/tsx1x-common.c
@@ -77,7 +77,7 @@ struct spi_board_info __initdata qnap_tsx1x_spi_slave_info[] = {
77 }, 77 },
78}; 78};
79 79
80void qnap_tsx1x_register_flash(void) 80void __init qnap_tsx1x_register_flash(void)
81{ 81{
82 spi_register_board_info(qnap_tsx1x_spi_slave_info, 82 spi_register_board_info(qnap_tsx1x_spi_slave_info,
83 ARRAY_SIZE(qnap_tsx1x_spi_slave_info)); 83 ARRAY_SIZE(qnap_tsx1x_spi_slave_info));
diff --git a/arch/arm/mach-kirkwood/tsx1x-common.h b/arch/arm/mach-kirkwood/tsx1x-common.h
index 9a592962a6ea..7fa037361b55 100644
--- a/arch/arm/mach-kirkwood/tsx1x-common.h
+++ b/arch/arm/mach-kirkwood/tsx1x-common.h
@@ -1,7 +1,7 @@
1#ifndef __ARCH_KIRKWOOD_TSX1X_COMMON_H 1#ifndef __ARCH_KIRKWOOD_TSX1X_COMMON_H
2#define __ARCH_KIRKWOOD_TSX1X_COMMON_H 2#define __ARCH_KIRKWOOD_TSX1X_COMMON_H
3 3
4extern void qnap_tsx1x_register_flash(void); 4extern void __init qnap_tsx1x_register_flash(void);
5extern void qnap_tsx1x_power_off(void); 5extern void qnap_tsx1x_power_off(void);
6 6
7#endif 7#endif
diff --git a/arch/arm/mach-ns9xxx/include/mach/debug-macro.S b/arch/arm/mach-ns9xxx/include/mach/debug-macro.S
index 0859336a8e6d..5c934bdb7158 100644
--- a/arch/arm/mach-ns9xxx/include/mach/debug-macro.S
+++ b/arch/arm/mach-ns9xxx/include/mach/debug-macro.S
@@ -8,6 +8,7 @@
8 * the Free Software Foundation. 8 * the Free Software Foundation.
9 */ 9 */
10#include <mach/hardware.h> 10#include <mach/hardware.h>
11#include <asm/memory.h>
11 12
12#include <mach/regs-board-a9m9750dev.h> 13#include <mach/regs-board-a9m9750dev.h>
13 14
diff --git a/arch/arm/mach-ns9xxx/include/mach/uncompress.h b/arch/arm/mach-ns9xxx/include/mach/uncompress.h
index 1b12d324b087..770a68c46e81 100644
--- a/arch/arm/mach-ns9xxx/include/mach/uncompress.h
+++ b/arch/arm/mach-ns9xxx/include/mach/uncompress.h
@@ -20,50 +20,49 @@ static void putc_dummy(char c, void __iomem *base)
20 /* nothing */ 20 /* nothing */
21} 21}
22 22
23static int timeout;
24
23static void putc_ns9360(char c, void __iomem *base) 25static void putc_ns9360(char c, void __iomem *base)
24{ 26{
25 static int t = 0x10000;
26 do { 27 do {
27 if (t) 28 if (timeout)
28 --t; 29 --timeout;
29 30
30 if (__raw_readl(base + 8) & (1 << 3)) { 31 if (__raw_readl(base + 8) & (1 << 3)) {
31 __raw_writeb(c, base + 16); 32 __raw_writeb(c, base + 16);
32 t = 0x10000; 33 timeout = 0x10000;
33 break; 34 break;
34 } 35 }
35 } while (t); 36 } while (timeout);
36} 37}
37 38
38static void putc_a9m9750dev(char c, void __iomem *base) 39static void putc_a9m9750dev(char c, void __iomem *base)
39{ 40{
40 static int t = 0x10000;
41 do { 41 do {
42 if (t) 42 if (timeout)
43 --t; 43 --timeout;
44 44
45 if (__raw_readb(base + 5) & (1 << 5)) { 45 if (__raw_readb(base + 5) & (1 << 5)) {
46 __raw_writeb(c, base); 46 __raw_writeb(c, base);
47 t = 0x10000; 47 timeout = 0x10000;
48 break; 48 break;
49 } 49 }
50 } while (t); 50 } while (timeout);
51 51
52} 52}
53 53
54static void putc_ns921x(char c, void __iomem *base) 54static void putc_ns921x(char c, void __iomem *base)
55{ 55{
56 static int t = 0x10000;
57 do { 56 do {
58 if (t) 57 if (timeout)
59 --t; 58 --timeout;
60 59
61 if (!(__raw_readl(base) & (1 << 11))) { 60 if (!(__raw_readl(base) & (1 << 11))) {
62 __raw_writeb(c, base + 0x0028); 61 __raw_writeb(c, base + 0x0028);
63 t = 0x10000; 62 timeout = 0x10000;
64 break; 63 break;
65 } 64 }
66 } while (t); 65 } while (timeout);
67} 66}
68 67
69#define MSCS __REG(0xA0900184) 68#define MSCS __REG(0xA0900184)
@@ -89,6 +88,7 @@ static void putc_ns921x(char c, void __iomem *base)
89 88
90static void autodetect(void (**putc)(char, void __iomem *), void __iomem **base) 89static void autodetect(void (**putc)(char, void __iomem *), void __iomem **base)
91{ 90{
91 timeout = 0x10000;
92 if (((__raw_readl(MSCS) >> 16) & 0xfe) == 0x00) { 92 if (((__raw_readl(MSCS) >> 16) & 0xfe) == 0x00) {
93 /* ns9360 or ns9750 */ 93 /* ns9360 or ns9750 */
94 if (NS9360_UART_ENABLED(NS9360_UARTA)) { 94 if (NS9360_UART_ENABLED(NS9360_UARTA)) {
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index abdf321c2d41..03483920ed6e 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -175,6 +175,10 @@ static void __init rx51_add_gpio_keys(void)
175#endif /* CONFIG_KEYBOARD_GPIO || CONFIG_KEYBOARD_GPIO_MODULE */ 175#endif /* CONFIG_KEYBOARD_GPIO || CONFIG_KEYBOARD_GPIO_MODULE */
176 176
177static int board_keymap[] = { 177static int board_keymap[] = {
178 /*
179 * Note that KEY(x, 8, KEY_XXX) entries represent "entrire row
180 * connected to the ground" matrix state.
181 */
178 KEY(0, 0, KEY_Q), 182 KEY(0, 0, KEY_Q),
179 KEY(0, 1, KEY_O), 183 KEY(0, 1, KEY_O),
180 KEY(0, 2, KEY_P), 184 KEY(0, 2, KEY_P),
@@ -182,6 +186,7 @@ static int board_keymap[] = {
182 KEY(0, 4, KEY_BACKSPACE), 186 KEY(0, 4, KEY_BACKSPACE),
183 KEY(0, 6, KEY_A), 187 KEY(0, 6, KEY_A),
184 KEY(0, 7, KEY_S), 188 KEY(0, 7, KEY_S),
189
185 KEY(1, 0, KEY_W), 190 KEY(1, 0, KEY_W),
186 KEY(1, 1, KEY_D), 191 KEY(1, 1, KEY_D),
187 KEY(1, 2, KEY_F), 192 KEY(1, 2, KEY_F),
@@ -190,6 +195,7 @@ static int board_keymap[] = {
190 KEY(1, 5, KEY_J), 195 KEY(1, 5, KEY_J),
191 KEY(1, 6, KEY_K), 196 KEY(1, 6, KEY_K),
192 KEY(1, 7, KEY_L), 197 KEY(1, 7, KEY_L),
198
193 KEY(2, 0, KEY_E), 199 KEY(2, 0, KEY_E),
194 KEY(2, 1, KEY_DOT), 200 KEY(2, 1, KEY_DOT),
195 KEY(2, 2, KEY_UP), 201 KEY(2, 2, KEY_UP),
@@ -197,6 +203,8 @@ static int board_keymap[] = {
197 KEY(2, 5, KEY_Z), 203 KEY(2, 5, KEY_Z),
198 KEY(2, 6, KEY_X), 204 KEY(2, 6, KEY_X),
199 KEY(2, 7, KEY_C), 205 KEY(2, 7, KEY_C),
206 KEY(2, 8, KEY_F9),
207
200 KEY(3, 0, KEY_R), 208 KEY(3, 0, KEY_R),
201 KEY(3, 1, KEY_V), 209 KEY(3, 1, KEY_V),
202 KEY(3, 2, KEY_B), 210 KEY(3, 2, KEY_B),
@@ -205,20 +213,23 @@ static int board_keymap[] = {
205 KEY(3, 5, KEY_SPACE), 213 KEY(3, 5, KEY_SPACE),
206 KEY(3, 6, KEY_SPACE), 214 KEY(3, 6, KEY_SPACE),
207 KEY(3, 7, KEY_LEFT), 215 KEY(3, 7, KEY_LEFT),
216
208 KEY(4, 0, KEY_T), 217 KEY(4, 0, KEY_T),
209 KEY(4, 1, KEY_DOWN), 218 KEY(4, 1, KEY_DOWN),
210 KEY(4, 2, KEY_RIGHT), 219 KEY(4, 2, KEY_RIGHT),
211 KEY(4, 4, KEY_LEFTCTRL), 220 KEY(4, 4, KEY_LEFTCTRL),
212 KEY(4, 5, KEY_RIGHTALT), 221 KEY(4, 5, KEY_RIGHTALT),
213 KEY(4, 6, KEY_LEFTSHIFT), 222 KEY(4, 6, KEY_LEFTSHIFT),
223 KEY(4, 8, KEY_F10),
224
214 KEY(5, 0, KEY_Y), 225 KEY(5, 0, KEY_Y),
226 KEY(5, 8, KEY_F11),
227
215 KEY(6, 0, KEY_U), 228 KEY(6, 0, KEY_U),
229
216 KEY(7, 0, KEY_I), 230 KEY(7, 0, KEY_I),
217 KEY(7, 1, KEY_F7), 231 KEY(7, 1, KEY_F7),
218 KEY(7, 2, KEY_F8), 232 KEY(7, 2, KEY_F8),
219 KEY(0xff, 2, KEY_F9),
220 KEY(0xff, 4, KEY_F10),
221 KEY(0xff, 5, KEY_F11),
222}; 233};
223 234
224static struct matrix_keymap_data board_map_data = { 235static struct matrix_keymap_data board_map_data = {
diff --git a/arch/arm/mach-pxa/colibri-pxa300.c b/arch/arm/mach-pxa/colibri-pxa300.c
index 45c23fd6df31..40b6ac2de876 100644
--- a/arch/arm/mach-pxa/colibri-pxa300.c
+++ b/arch/arm/mach-pxa/colibri-pxa300.c
@@ -26,6 +26,7 @@
26#include <mach/colibri.h> 26#include <mach/colibri.h>
27#include <mach/ohci.h> 27#include <mach/ohci.h>
28#include <mach/pxafb.h> 28#include <mach/pxafb.h>
29#include <mach/audio.h>
29 30
30#include "generic.h" 31#include "generic.h"
31#include "devices.h" 32#include "devices.h"
@@ -145,7 +146,7 @@ static void __init colibri_pxa300_init_lcd(void)
145static inline void colibri_pxa300_init_lcd(void) {} 146static inline void colibri_pxa300_init_lcd(void) {}
146#endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */ 147#endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */
147 148
148#if defined(SND_AC97_CODEC) || defined(SND_AC97_CODEC_MODULE) 149#if defined(CONFIG_SND_AC97_CODEC) || defined(CONFIG_SND_AC97_CODEC_MODULE)
149static mfp_cfg_t colibri_pxa310_ac97_pin_config[] __initdata = { 150static mfp_cfg_t colibri_pxa310_ac97_pin_config[] __initdata = {
150 GPIO24_AC97_SYSCLK, 151 GPIO24_AC97_SYSCLK,
151 GPIO23_AC97_nACRESET, 152 GPIO23_AC97_nACRESET,
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index 3d1dcb9ac08f..51ffa6afb675 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -446,7 +446,7 @@ static struct platform_device corgiled_device = {
446static struct pxamci_platform_data corgi_mci_platform_data = { 446static struct pxamci_platform_data corgi_mci_platform_data = {
447 .detect_delay_ms = 250, 447 .detect_delay_ms = 250,
448 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 448 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
449 .gpio_card_detect = -1, 449 .gpio_card_detect = CORGI_GPIO_nSD_DETECT,
450 .gpio_card_ro = CORGI_GPIO_nSD_WP, 450 .gpio_card_ro = CORGI_GPIO_nSD_WP,
451 .gpio_power = CORGI_GPIO_SD_PWR, 451 .gpio_power = CORGI_GPIO_SD_PWR,
452}; 452};
diff --git a/arch/arm/mach-pxa/cpufreq-pxa2xx.c b/arch/arm/mach-pxa/cpufreq-pxa2xx.c
index 9e4d9816726a..268a9bc6be8a 100644
--- a/arch/arm/mach-pxa/cpufreq-pxa2xx.c
+++ b/arch/arm/mach-pxa/cpufreq-pxa2xx.c
@@ -256,13 +256,9 @@ static void init_sdram_rows(void)
256 256
257static u32 mdrefr_dri(unsigned int freq) 257static u32 mdrefr_dri(unsigned int freq)
258{ 258{
259 u32 dri = 0; 259 u32 interval = freq * SDRAM_TREF / sdram_rows;
260 260
261 if (cpu_is_pxa25x()) 261 return (interval - (cpu_is_pxa27x() ? 31 : 0)) / 32;
262 dri = ((freq * SDRAM_TREF) / (sdram_rows * 32));
263 if (cpu_is_pxa27x())
264 dri = ((freq * SDRAM_TREF) / (sdram_rows - 31)) / 32;
265 return dri;
266} 262}
267 263
268/* find a valid frequency point */ 264/* find a valid frequency point */
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 0af36177ff08..c059dac02b61 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -41,10 +41,10 @@ void pxa27x_clear_otgph(void)
41EXPORT_SYMBOL(pxa27x_clear_otgph); 41EXPORT_SYMBOL(pxa27x_clear_otgph);
42 42
43static unsigned long ac97_reset_config[] = { 43static unsigned long ac97_reset_config[] = {
44 GPIO95_AC97_nRESET,
45 GPIO95_GPIO,
46 GPIO113_AC97_nRESET,
47 GPIO113_GPIO, 44 GPIO113_GPIO,
45 GPIO113_AC97_nRESET,
46 GPIO95_GPIO,
47 GPIO95_AC97_nRESET,
48}; 48};
49 49
50void pxa27x_assert_ac97reset(int reset_gpio, int on) 50void pxa27x_assert_ac97reset(int reset_gpio, int on)
diff --git a/arch/arm/mach-shark/include/mach/debug-macro.S b/arch/arm/mach-shark/include/mach/debug-macro.S
index 50f071c5bf4d..5ea24d4d1ba6 100644
--- a/arch/arm/mach-shark/include/mach/debug-macro.S
+++ b/arch/arm/mach-shark/include/mach/debug-macro.S
@@ -20,6 +20,9 @@
20 strb \rd, [\rx] 20 strb \rd, [\rx]
21 .endm 21 .endm
22 22
23 .macro waituart,rd,rx
24 .endm
25
23 .macro busyuart,rd,rx 26 .macro busyuart,rd,rx
24 mov \rd, #0 27 mov \rd, #0
251001: add \rd, \rd, #1 281001: add \rd, \rd, #1
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index f2b88c5fe142..4c704b4e8b34 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -70,6 +70,18 @@ endmenu
70 70
71menu "Timer and clock configuration" 71menu "Timer and clock configuration"
72 72
73config SHMOBILE_TIMER_HZ
74 int "Kernel HZ (jiffies per second)"
75 range 32 1024
76 default "128"
77 help
78 Allows the configuration of the timer frequency. It is customary
79 to have the timer interrupt run at 1000 Hz or 100 Hz, but in the
80 case of low timer frequencies other values may be more suitable.
81 SH-Mobile systems using a 32768 Hz RCLK for clock events may want
82 to select a HZ value such as 128 that can evenly divide RCLK.
83 A HZ value that does not divide evenly may cause timer drift.
84
73config SH_TIMER_CMT 85config SH_TIMER_CMT
74 bool "CMT timer driver" 86 bool "CMT timer driver"
75 default y 87 default y
diff --git a/arch/arm/mach-shmobile/include/mach/irqs.h b/arch/arm/mach-shmobile/include/mach/irqs.h
index 5179b72e1ee3..132256bb8c81 100644
--- a/arch/arm/mach-shmobile/include/mach/irqs.h
+++ b/arch/arm/mach-shmobile/include/mach/irqs.h
@@ -2,7 +2,6 @@
2#define __ASM_MACH_IRQS_H 2#define __ASM_MACH_IRQS_H
3 3
4#define NR_IRQS 512 4#define NR_IRQS 512
5#define NR_IRQS_LEGACY 8
6 5
7#define evt2irq(evt) (((evt) >> 5) - 16) 6#define evt2irq(evt) (((evt) >> 5) - 16)
8#define irq2evt(irq) (((irq) + 16) << 5) 7#define irq2evt(irq) (((irq) + 16) << 5)
diff --git a/arch/arm/mach-w90x900/cpu.c b/arch/arm/mach-w90x900/cpu.c
index 642207e18198..83c56324a472 100644
--- a/arch/arm/mach-w90x900/cpu.c
+++ b/arch/arm/mach-w90x900/cpu.c
@@ -93,7 +93,7 @@ static struct clk_lookup nuc900_clkregs[] = {
93 DEF_CLKLOOK(&clk_kpi, "nuc900-kpi", NULL), 93 DEF_CLKLOOK(&clk_kpi, "nuc900-kpi", NULL),
94 DEF_CLKLOOK(&clk_wdt, "nuc900-wdt", NULL), 94 DEF_CLKLOOK(&clk_wdt, "nuc900-wdt", NULL),
95 DEF_CLKLOOK(&clk_gdma, "nuc900-gdma", NULL), 95 DEF_CLKLOOK(&clk_gdma, "nuc900-gdma", NULL),
96 DEF_CLKLOOK(&clk_adc, "nuc900-adc", NULL), 96 DEF_CLKLOOK(&clk_adc, "nuc900-ts", NULL),
97 DEF_CLKLOOK(&clk_usi, "nuc900-spi", NULL), 97 DEF_CLKLOOK(&clk_usi, "nuc900-spi", NULL),
98 DEF_CLKLOOK(&clk_ext, NULL, "ext"), 98 DEF_CLKLOOK(&clk_ext, NULL, "ext"),
99 DEF_CLKLOOK(&clk_timer0, NULL, "timer0"), 99 DEF_CLKLOOK(&clk_timer0, NULL, "timer0"),
diff --git a/arch/arm/plat-spear/include/plat/debug-macro.S b/arch/arm/plat-spear/include/plat/debug-macro.S
index 1670734b7e51..37fa593884ee 100644
--- a/arch/arm/plat-spear/include/plat/debug-macro.S
+++ b/arch/arm/plat-spear/include/plat/debug-macro.S
@@ -17,8 +17,8 @@
17 .macro addruart, rx 17 .macro addruart, rx
18 mrc p15, 0, \rx, c1, c0 18 mrc p15, 0, \rx, c1, c0
19 tst \rx, #1 @ MMU enabled? 19 tst \rx, #1 @ MMU enabled?
20 moveq \rx, =SPEAR_DBG_UART_BASE @ Physical base 20 moveq \rx, #SPEAR_DBG_UART_BASE @ Physical base
21 movne \rx, =VA_SPEAR_DBG_UART_BASE @ Virtual base 21 movne \rx, #VA_SPEAR_DBG_UART_BASE @ Virtual base
22 .endm 22 .endm
23 23
24 .macro senduart, rd, rx 24 .macro senduart, rd, rx
diff --git a/arch/avr32/include/asm/ioctls.h b/arch/avr32/include/asm/ioctls.h
index 0cf2c0a4502b..e6ac0b661076 100644
--- a/arch/avr32/include/asm/ioctls.h
+++ b/arch/avr32/include/asm/ioctls.h
@@ -54,6 +54,9 @@
54#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ 54#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
55#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ 55#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
56 56
57#define TIOCGRS485 0x542E
58#define TIOCSRS485 0x542F
59
57#define FIONCLEX 0x5450 60#define FIONCLEX 0x5450
58#define FIOCLEX 0x5451 61#define FIOCLEX 0x5451
59#define FIOASYNC 0x5452 62#define FIOASYNC 0x5452
diff --git a/arch/avr32/mach-at32ap/include/mach/board.h b/arch/avr32/mach-at32ap/include/mach/board.h
index c7f25bb1d068..61740201b311 100644
--- a/arch/avr32/mach-at32ap/include/mach/board.h
+++ b/arch/avr32/mach-at32ap/include/mach/board.h
@@ -5,6 +5,7 @@
5#define __ASM_ARCH_BOARD_H 5#define __ASM_ARCH_BOARD_H
6 6
7#include <linux/types.h> 7#include <linux/types.h>
8#include <linux/serial.h>
8 9
9#define GPIO_PIN_NONE (-1) 10#define GPIO_PIN_NONE (-1)
10 11
@@ -35,6 +36,7 @@ struct atmel_uart_data {
35 short use_dma_tx; /* use transmit DMA? */ 36 short use_dma_tx; /* use transmit DMA? */
36 short use_dma_rx; /* use receive DMA? */ 37 short use_dma_rx; /* use receive DMA? */
37 void __iomem *regs; /* virtual base address, if any */ 38 void __iomem *regs; /* virtual base address, if any */
39 struct serial_rs485 rs485; /* rs485 settings */
38}; 40};
39void at32_map_usart(unsigned int hw_id, unsigned int line, int flags); 41void at32_map_usart(unsigned int hw_id, unsigned int line, int flags);
40struct platform_device *at32_add_device_usart(unsigned int id); 42struct platform_device *at32_add_device_usart(unsigned int id);
diff --git a/arch/mips/alchemy/common/platform.c b/arch/mips/alchemy/common/platform.c
index 2580e77624d2..f9e5622ebc95 100644
--- a/arch/mips/alchemy/common/platform.c
+++ b/arch/mips/alchemy/common/platform.c
@@ -435,20 +435,21 @@ static struct platform_device *au1xxx_platform_devices[] __initdata = {
435static int __init au1xxx_platform_init(void) 435static int __init au1xxx_platform_init(void)
436{ 436{
437 unsigned int uartclk = get_au1x00_uart_baud_base() * 16; 437 unsigned int uartclk = get_au1x00_uart_baud_base() * 16;
438 int i; 438 int err, i;
439 439
440 /* Fill up uartclk. */ 440 /* Fill up uartclk. */
441 for (i = 0; au1x00_uart_data[i].flags; i++) 441 for (i = 0; au1x00_uart_data[i].flags; i++)
442 au1x00_uart_data[i].uartclk = uartclk; 442 au1x00_uart_data[i].uartclk = uartclk;
443 443
444 err = platform_add_devices(au1xxx_platform_devices,
445 ARRAY_SIZE(au1xxx_platform_devices));
444#ifndef CONFIG_SOC_AU1100 446#ifndef CONFIG_SOC_AU1100
445 /* Register second MAC if enabled in pinfunc */ 447 /* Register second MAC if enabled in pinfunc */
446 if (!(au_readl(SYS_PINFUNC) & (u32)SYS_PF_NI2)) 448 if (!err && !(au_readl(SYS_PINFUNC) & (u32)SYS_PF_NI2))
447 platform_device_register(&au1xxx_eth1_device); 449 platform_device_register(&au1xxx_eth1_device);
448#endif 450#endif
449 451
450 return platform_add_devices(au1xxx_platform_devices, 452 return err;
451 ARRAY_SIZE(au1xxx_platform_devices));
452} 453}
453 454
454arch_initcall(au1xxx_platform_init); 455arch_initcall(au1xxx_platform_init);
diff --git a/arch/mips/alchemy/mtx-1/board_setup.c b/arch/mips/alchemy/mtx-1/board_setup.c
index a9f0336e1f1f..52d883d37dd7 100644
--- a/arch/mips/alchemy/mtx-1/board_setup.c
+++ b/arch/mips/alchemy/mtx-1/board_setup.c
@@ -67,8 +67,6 @@ static void mtx1_power_off(void)
67 67
68void __init board_setup(void) 68void __init board_setup(void)
69{ 69{
70 alchemy_gpio2_enable();
71
72#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 70#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
73 /* Enable USB power switch */ 71 /* Enable USB power switch */
74 alchemy_gpio_direction_output(204, 0); 72 alchemy_gpio_direction_output(204, 0);
@@ -117,11 +115,11 @@ mtx1_pci_idsel(unsigned int devsel, int assert)
117 115
118 if (assert && devsel != 0) 116 if (assert && devsel != 0)
119 /* Suppress signal to Cardbus */ 117 /* Suppress signal to Cardbus */
120 gpio_set_value(1, 0); /* set EXT_IO3 OFF */ 118 alchemy_gpio_set_value(1, 0); /* set EXT_IO3 OFF */
121 else 119 else
122 gpio_set_value(1, 1); /* set EXT_IO3 ON */ 120 alchemy_gpio_set_value(1, 1); /* set EXT_IO3 ON */
123 121
124 au_sync_udelay(1); 122 udelay(1);
125 return 1; 123 return 1;
126} 124}
127 125
diff --git a/arch/mips/bcm63xx/dev-enet.c b/arch/mips/bcm63xx/dev-enet.c
index 9f544badd0b4..39c23366c5c7 100644
--- a/arch/mips/bcm63xx/dev-enet.c
+++ b/arch/mips/bcm63xx/dev-enet.c
@@ -104,6 +104,9 @@ int __init bcm63xx_enet_register(int unit,
104 if (unit > 1) 104 if (unit > 1)
105 return -ENODEV; 105 return -ENODEV;
106 106
107 if (unit == 1 && BCMCPU_IS_6338())
108 return -ENODEV;
109
107 if (!shared_device_registered) { 110 if (!shared_device_registered) {
108 shared_res[0].start = bcm63xx_regset_address(RSET_ENETDMA); 111 shared_res[0].start = bcm63xx_regset_address(RSET_ENETDMA);
109 shared_res[0].end = shared_res[0].start; 112 shared_res[0].end = shared_res[0].start;
diff --git a/arch/mips/include/asm/atomic.h b/arch/mips/include/asm/atomic.h
index 59dc0c7ef733..c63c56bfd184 100644
--- a/arch/mips/include/asm/atomic.h
+++ b/arch/mips/include/asm/atomic.h
@@ -434,7 +434,7 @@ static __inline__ void atomic64_add(long i, atomic64_t * v)
434 __asm__ __volatile__( 434 __asm__ __volatile__(
435 " .set mips3 \n" 435 " .set mips3 \n"
436 "1: lld %0, %1 # atomic64_add \n" 436 "1: lld %0, %1 # atomic64_add \n"
437 " addu %0, %2 \n" 437 " daddu %0, %2 \n"
438 " scd %0, %1 \n" 438 " scd %0, %1 \n"
439 " beqzl %0, 1b \n" 439 " beqzl %0, 1b \n"
440 " .set mips0 \n" 440 " .set mips0 \n"
@@ -446,7 +446,7 @@ static __inline__ void atomic64_add(long i, atomic64_t * v)
446 __asm__ __volatile__( 446 __asm__ __volatile__(
447 " .set mips3 \n" 447 " .set mips3 \n"
448 "1: lld %0, %1 # atomic64_add \n" 448 "1: lld %0, %1 # atomic64_add \n"
449 " addu %0, %2 \n" 449 " daddu %0, %2 \n"
450 " scd %0, %1 \n" 450 " scd %0, %1 \n"
451 " beqz %0, 2f \n" 451 " beqz %0, 2f \n"
452 " .subsection 2 \n" 452 " .subsection 2 \n"
@@ -479,7 +479,7 @@ static __inline__ void atomic64_sub(long i, atomic64_t * v)
479 __asm__ __volatile__( 479 __asm__ __volatile__(
480 " .set mips3 \n" 480 " .set mips3 \n"
481 "1: lld %0, %1 # atomic64_sub \n" 481 "1: lld %0, %1 # atomic64_sub \n"
482 " subu %0, %2 \n" 482 " dsubu %0, %2 \n"
483 " scd %0, %1 \n" 483 " scd %0, %1 \n"
484 " beqzl %0, 1b \n" 484 " beqzl %0, 1b \n"
485 " .set mips0 \n" 485 " .set mips0 \n"
@@ -491,7 +491,7 @@ static __inline__ void atomic64_sub(long i, atomic64_t * v)
491 __asm__ __volatile__( 491 __asm__ __volatile__(
492 " .set mips3 \n" 492 " .set mips3 \n"
493 "1: lld %0, %1 # atomic64_sub \n" 493 "1: lld %0, %1 # atomic64_sub \n"
494 " subu %0, %2 \n" 494 " dsubu %0, %2 \n"
495 " scd %0, %1 \n" 495 " scd %0, %1 \n"
496 " beqz %0, 2f \n" 496 " beqz %0, 2f \n"
497 " .subsection 2 \n" 497 " .subsection 2 \n"
@@ -524,10 +524,10 @@ static __inline__ long atomic64_add_return(long i, atomic64_t * v)
524 __asm__ __volatile__( 524 __asm__ __volatile__(
525 " .set mips3 \n" 525 " .set mips3 \n"
526 "1: lld %1, %2 # atomic64_add_return \n" 526 "1: lld %1, %2 # atomic64_add_return \n"
527 " addu %0, %1, %3 \n" 527 " daddu %0, %1, %3 \n"
528 " scd %0, %2 \n" 528 " scd %0, %2 \n"
529 " beqzl %0, 1b \n" 529 " beqzl %0, 1b \n"
530 " addu %0, %1, %3 \n" 530 " daddu %0, %1, %3 \n"
531 " .set mips0 \n" 531 " .set mips0 \n"
532 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 532 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
533 : "Ir" (i), "m" (v->counter) 533 : "Ir" (i), "m" (v->counter)
@@ -538,10 +538,10 @@ static __inline__ long atomic64_add_return(long i, atomic64_t * v)
538 __asm__ __volatile__( 538 __asm__ __volatile__(
539 " .set mips3 \n" 539 " .set mips3 \n"
540 "1: lld %1, %2 # atomic64_add_return \n" 540 "1: lld %1, %2 # atomic64_add_return \n"
541 " addu %0, %1, %3 \n" 541 " daddu %0, %1, %3 \n"
542 " scd %0, %2 \n" 542 " scd %0, %2 \n"
543 " beqz %0, 2f \n" 543 " beqz %0, 2f \n"
544 " addu %0, %1, %3 \n" 544 " daddu %0, %1, %3 \n"
545 " .subsection 2 \n" 545 " .subsection 2 \n"
546 "2: b 1b \n" 546 "2: b 1b \n"
547 " .previous \n" 547 " .previous \n"
@@ -576,10 +576,10 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
576 __asm__ __volatile__( 576 __asm__ __volatile__(
577 " .set mips3 \n" 577 " .set mips3 \n"
578 "1: lld %1, %2 # atomic64_sub_return \n" 578 "1: lld %1, %2 # atomic64_sub_return \n"
579 " subu %0, %1, %3 \n" 579 " dsubu %0, %1, %3 \n"
580 " scd %0, %2 \n" 580 " scd %0, %2 \n"
581 " beqzl %0, 1b \n" 581 " beqzl %0, 1b \n"
582 " subu %0, %1, %3 \n" 582 " dsubu %0, %1, %3 \n"
583 " .set mips0 \n" 583 " .set mips0 \n"
584 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 584 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
585 : "Ir" (i), "m" (v->counter) 585 : "Ir" (i), "m" (v->counter)
@@ -590,10 +590,10 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
590 __asm__ __volatile__( 590 __asm__ __volatile__(
591 " .set mips3 \n" 591 " .set mips3 \n"
592 "1: lld %1, %2 # atomic64_sub_return \n" 592 "1: lld %1, %2 # atomic64_sub_return \n"
593 " subu %0, %1, %3 \n" 593 " dsubu %0, %1, %3 \n"
594 " scd %0, %2 \n" 594 " scd %0, %2 \n"
595 " beqz %0, 2f \n" 595 " beqz %0, 2f \n"
596 " subu %0, %1, %3 \n" 596 " dsubu %0, %1, %3 \n"
597 " .subsection 2 \n" 597 " .subsection 2 \n"
598 "2: b 1b \n" 598 "2: b 1b \n"
599 " .previous \n" 599 " .previous \n"
diff --git a/arch/mips/include/asm/unistd.h b/arch/mips/include/asm/unistd.h
index 1b5a6648eb86..baa318a59c97 100644
--- a/arch/mips/include/asm/unistd.h
+++ b/arch/mips/include/asm/unistd.h
@@ -984,16 +984,17 @@
984#define __NR_perf_event_open (__NR_Linux + 296) 984#define __NR_perf_event_open (__NR_Linux + 296)
985#define __NR_accept4 (__NR_Linux + 297) 985#define __NR_accept4 (__NR_Linux + 297)
986#define __NR_recvmmsg (__NR_Linux + 298) 986#define __NR_recvmmsg (__NR_Linux + 298)
987#define __NR_getdents64 (__NR_Linux + 299)
987 988
988/* 989/*
989 * Offset of the last N32 flavoured syscall 990 * Offset of the last N32 flavoured syscall
990 */ 991 */
991#define __NR_Linux_syscalls 298 992#define __NR_Linux_syscalls 299
992 993
993#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ 994#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
994 995
995#define __NR_N32_Linux 6000 996#define __NR_N32_Linux 6000
996#define __NR_N32_Linux_syscalls 298 997#define __NR_N32_Linux_syscalls 299
997 998
998#ifdef __KERNEL__ 999#ifdef __KERNEL__
999 1000
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index a5297e2a353a..a4faceea9d88 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -419,4 +419,5 @@ EXPORT(sysn32_call_table)
419 PTR sys_perf_event_open 419 PTR sys_perf_event_open
420 PTR sys_accept4 420 PTR sys_accept4
421 PTR compat_sys_recvmmsg 421 PTR compat_sys_recvmmsg
422 PTR sys_getdents
422 .size sysn32_call_table,.-sysn32_call_table 423 .size sysn32_call_table,.-sysn32_call_table
diff --git a/arch/mips/kernel/vdso.c b/arch/mips/kernel/vdso.c
index b773c1112b14..e5cdfd603f8f 100644
--- a/arch/mips/kernel/vdso.c
+++ b/arch/mips/kernel/vdso.c
@@ -61,11 +61,9 @@ static int __init init_vdso(void)
61 61
62 vunmap(vdso); 62 vunmap(vdso);
63 63
64 pr_notice("init_vdso successfull\n");
65
66 return 0; 64 return 0;
67} 65}
68device_initcall(init_vdso); 66subsys_initcall(init_vdso);
69 67
70static unsigned long vdso_addr(unsigned long start) 68static unsigned long vdso_addr(unsigned long start)
71{ 69{
diff --git a/arch/mips/mti-malta/malta-pci.c b/arch/mips/mti-malta/malta-pci.c
index 2fbfa1a8c3a9..bf80921f2f56 100644
--- a/arch/mips/mti-malta/malta-pci.c
+++ b/arch/mips/mti-malta/malta-pci.c
@@ -247,6 +247,8 @@ void __init mips_pcibios_init(void)
247 iomem_resource.end &= 0xfffffffffULL; /* 64 GB */ 247 iomem_resource.end &= 0xfffffffffULL; /* 64 GB */
248 ioport_resource.end = controller->io_resource->end; 248 ioport_resource.end = controller->io_resource->end;
249 249
250 controller->io_map_base = mips_io_port_base;
251
250 register_pci_controller(controller); 252 register_pci_controller(controller);
251} 253}
252 254
diff --git a/arch/mips/nxp/pnx8550/common/pci.c b/arch/mips/nxp/pnx8550/common/pci.c
index eee4f3dfc410..98e86ddb86cc 100644
--- a/arch/mips/nxp/pnx8550/common/pci.c
+++ b/arch/mips/nxp/pnx8550/common/pci.c
@@ -44,6 +44,7 @@ extern struct pci_ops pnx8550_pci_ops;
44 44
45static struct pci_controller pnx8550_controller = { 45static struct pci_controller pnx8550_controller = {
46 .pci_ops = &pnx8550_pci_ops, 46 .pci_ops = &pnx8550_pci_ops,
47 .io_map_base = PNX8550_PORT_BASE,
47 .io_resource = &pci_io_resource, 48 .io_resource = &pci_io_resource,
48 .mem_resource = &pci_mem_resource, 49 .mem_resource = &pci_mem_resource,
49}; 50};
diff --git a/arch/mips/nxp/pnx8550/common/setup.c b/arch/mips/nxp/pnx8550/common/setup.c
index 2aed50fef10f..64246c9c875c 100644
--- a/arch/mips/nxp/pnx8550/common/setup.c
+++ b/arch/mips/nxp/pnx8550/common/setup.c
@@ -113,7 +113,7 @@ void __init plat_mem_setup(void)
113 PNX8550_GLB2_ENAB_INTA_O = 0; 113 PNX8550_GLB2_ENAB_INTA_O = 0;
114 114
115 /* IO/MEM resources. */ 115 /* IO/MEM resources. */
116 set_io_port_base(KSEG1); 116 set_io_port_base(PNX8550_PORT_BASE);
117 ioport_resource.start = 0; 117 ioport_resource.start = 0;
118 ioport_resource.end = ~0; 118 ioport_resource.end = ~0;
119 iomem_resource.start = 0; 119 iomem_resource.start = 0;
diff --git a/arch/mips/pci/ops-pmcmsp.c b/arch/mips/pci/ops-pmcmsp.c
index 04b31478a6d7..b7c03d80c88c 100644
--- a/arch/mips/pci/ops-pmcmsp.c
+++ b/arch/mips/pci/ops-pmcmsp.c
@@ -944,6 +944,7 @@ static struct pci_controller msp_pci_controller = {
944 .pci_ops = &msp_pci_ops, 944 .pci_ops = &msp_pci_ops,
945 .mem_resource = &pci_mem_resource, 945 .mem_resource = &pci_mem_resource,
946 .mem_offset = 0, 946 .mem_offset = 0,
947 .io_map_base = MSP_PCI_IOSPACE_BASE,
947 .io_resource = &pci_io_resource, 948 .io_resource = &pci_io_resource,
948 .io_offset = 0 949 .io_offset = 0
949}; 950};
diff --git a/arch/mips/pci/pci-yosemite.c b/arch/mips/pci/pci-yosemite.c
index 0357946f30e6..cf5e1a25cb7d 100644
--- a/arch/mips/pci/pci-yosemite.c
+++ b/arch/mips/pci/pci-yosemite.c
@@ -54,6 +54,7 @@ static int __init pmc_yosemite_setup(void)
54 panic(ioremap_failed); 54 panic(ioremap_failed);
55 55
56 set_io_port_base(io_v_base); 56 set_io_port_base(io_v_base);
57 py_controller.io_map_base = io_v_base;
57 TITAN_WRITE(RM9000x2_OCD_LKM7, TITAN_READ(RM9000x2_OCD_LKM7) | 1); 58 TITAN_WRITE(RM9000x2_OCD_LKM7, TITAN_READ(RM9000x2_OCD_LKM7) | 1);
58 59
59 ioport_resource.end = TITAN_IO_SIZE - 1; 60 ioport_resource.end = TITAN_IO_SIZE - 1;
diff --git a/arch/mips/powertv/asic/asic_devices.c b/arch/mips/powertv/asic/asic_devices.c
index 8ee77887306a..9ec523e4dd06 100644
--- a/arch/mips/powertv/asic/asic_devices.c
+++ b/arch/mips/powertv/asic/asic_devices.c
@@ -472,6 +472,9 @@ void __init configure_platform(void)
472 * it*/ 472 * it*/
473 platform_features = FFS_CAPABLE | DISPLAY_CAPABLE; 473 platform_features = FFS_CAPABLE | DISPLAY_CAPABLE;
474 474
475 /* Cronus and Cronus Lite have the same register map */
476 set_register_map(CRONUS_IO_BASE, &cronus_register_map);
477
475 /* ASIC version will determine if this is a real CronusLite or 478 /* ASIC version will determine if this is a real CronusLite or
476 * Castrati(Cronus) */ 479 * Castrati(Cronus) */
477 chipversion = asic_read(chipver3) << 24; 480 chipversion = asic_read(chipver3) << 24;
@@ -484,8 +487,6 @@ void __init configure_platform(void)
484 else 487 else
485 asic = ASIC_CRONUSLITE; 488 asic = ASIC_CRONUSLITE;
486 489
487 /* Cronus and Cronus Lite have the same register map */
488 set_register_map(CRONUS_IO_BASE, &cronus_register_map);
489 gp_resources = non_dvr_cronuslite_resources; 490 gp_resources = non_dvr_cronuslite_resources;
490 pr_info("Platform: 4600 - %s, NON_DVR_CAPABLE, " 491 pr_info("Platform: 4600 - %s, NON_DVR_CAPABLE, "
491 "chipversion=0x%08X\n", 492 "chipversion=0x%08X\n",
diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/kexec.h
index 2a9cd74a841e..076327f2eff7 100644
--- a/arch/powerpc/include/asm/kexec.h
+++ b/arch/powerpc/include/asm/kexec.h
@@ -8,9 +8,9 @@
8 * On FSL-BookE we setup a 1:1 mapping which covers the first 2GiB of memory 8 * On FSL-BookE we setup a 1:1 mapping which covers the first 2GiB of memory
9 * and therefore we can only deal with memory within this range 9 * and therefore we can only deal with memory within this range
10 */ 10 */
11#define KEXEC_SOURCE_MEMORY_LIMIT (2 * 1024 * 1024 * 1024UL) 11#define KEXEC_SOURCE_MEMORY_LIMIT (2 * 1024 * 1024 * 1024UL - 1)
12#define KEXEC_DESTINATION_MEMORY_LIMIT (2 * 1024 * 1024 * 1024UL) 12#define KEXEC_DESTINATION_MEMORY_LIMIT (2 * 1024 * 1024 * 1024UL - 1)
13#define KEXEC_CONTROL_MEMORY_LIMIT (2 * 1024 * 1024 * 1024UL) 13#define KEXEC_CONTROL_MEMORY_LIMIT (2 * 1024 * 1024 * 1024UL - 1)
14 14
15#else 15#else
16 16
diff --git a/arch/powerpc/include/asm/mmu-hash64.h b/arch/powerpc/include/asm/mmu-hash64.h
index 2102b214a87c..0e398cfee2c8 100644
--- a/arch/powerpc/include/asm/mmu-hash64.h
+++ b/arch/powerpc/include/asm/mmu-hash64.h
@@ -250,7 +250,9 @@ extern int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
250int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid, 250int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,
251 pte_t *ptep, unsigned long trap, int local, int ssize, 251 pte_t *ptep, unsigned long trap, int local, int ssize,
252 unsigned int shift, unsigned int mmu_psize); 252 unsigned int shift, unsigned int mmu_psize);
253 253extern void hash_failure_debug(unsigned long ea, unsigned long access,
254 unsigned long vsid, unsigned long trap,
255 int ssize, int psize, unsigned long pte);
254extern int htab_bolt_mapping(unsigned long vstart, unsigned long vend, 256extern int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
255 unsigned long pstart, unsigned long prot, 257 unsigned long pstart, unsigned long prot,
256 int psize, int ssize); 258 int psize, int ssize);
diff --git a/arch/powerpc/kernel/perf_event_fsl_emb.c b/arch/powerpc/kernel/perf_event_fsl_emb.c
index 369872f6cf78..babcceecd2ea 100644
--- a/arch/powerpc/kernel/perf_event_fsl_emb.c
+++ b/arch/powerpc/kernel/perf_event_fsl_emb.c
@@ -566,9 +566,9 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
566 * Finally record data if requested. 566 * Finally record data if requested.
567 */ 567 */
568 if (record) { 568 if (record) {
569 struct perf_sample_data data = { 569 struct perf_sample_data data;
570 .period = event->hw.last_period, 570
571 }; 571 perf_sample_data_init(&data, 0);
572 572
573 if (perf_event_overflow(event, nmi, &data, regs)) { 573 if (perf_event_overflow(event, nmi, &data, regs)) {
574 /* 574 /*
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 9d3953983fb7..fed9bf6187d1 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -414,7 +414,7 @@ static int __init early_init_dt_scan_drconf_memory(unsigned long node)
414 u64 base, size, memblock_size; 414 u64 base, size, memblock_size;
415 unsigned int is_kexec_kdump = 0, rngs; 415 unsigned int is_kexec_kdump = 0, rngs;
416 416
417 ls = of_get_flat_dt_prop(node, "ibm,memblock-size", &l); 417 ls = of_get_flat_dt_prop(node, "ibm,lmb-size", &l);
418 if (ls == NULL || l < dt_root_size_cells * sizeof(__be32)) 418 if (ls == NULL || l < dt_root_size_cells * sizeof(__be32))
419 return 0; 419 return 0;
420 memblock_size = dt_mem_next_cell(dt_root_size_cells, &ls); 420 memblock_size = dt_mem_next_cell(dt_root_size_cells, &ls);
diff --git a/arch/powerpc/mm/hash_low_64.S b/arch/powerpc/mm/hash_low_64.S
index a719f53921a5..3079f6b44cf5 100644
--- a/arch/powerpc/mm/hash_low_64.S
+++ b/arch/powerpc/mm/hash_low_64.S
@@ -68,9 +68,6 @@ _GLOBAL(__hash_page_4K)
68 std r8,STK_PARM(r8)(r1) 68 std r8,STK_PARM(r8)(r1)
69 std r9,STK_PARM(r9)(r1) 69 std r9,STK_PARM(r9)(r1)
70 70
71 /* Add _PAGE_PRESENT to access */
72 ori r4,r4,_PAGE_PRESENT
73
74 /* Save non-volatile registers. 71 /* Save non-volatile registers.
75 * r31 will hold "old PTE" 72 * r31 will hold "old PTE"
76 * r30 is "new PTE" 73 * r30 is "new PTE"
@@ -347,9 +344,6 @@ _GLOBAL(__hash_page_4K)
347 std r8,STK_PARM(r8)(r1) 344 std r8,STK_PARM(r8)(r1)
348 std r9,STK_PARM(r9)(r1) 345 std r9,STK_PARM(r9)(r1)
349 346
350 /* Add _PAGE_PRESENT to access */
351 ori r4,r4,_PAGE_PRESENT
352
353 /* Save non-volatile registers. 347 /* Save non-volatile registers.
354 * r31 will hold "old PTE" 348 * r31 will hold "old PTE"
355 * r30 is "new PTE" 349 * r30 is "new PTE"
@@ -687,9 +681,6 @@ _GLOBAL(__hash_page_64K)
687 std r8,STK_PARM(r8)(r1) 681 std r8,STK_PARM(r8)(r1)
688 std r9,STK_PARM(r9)(r1) 682 std r9,STK_PARM(r9)(r1)
689 683
690 /* Add _PAGE_PRESENT to access */
691 ori r4,r4,_PAGE_PRESENT
692
693 /* Save non-volatile registers. 684 /* Save non-volatile registers.
694 * r31 will hold "old PTE" 685 * r31 will hold "old PTE"
695 * r30 is "new PTE" 686 * r30 is "new PTE"
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 98f262de5585..09dffe6efa46 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -871,6 +871,18 @@ static inline int subpage_protection(struct mm_struct *mm, unsigned long ea)
871} 871}
872#endif 872#endif
873 873
874void hash_failure_debug(unsigned long ea, unsigned long access,
875 unsigned long vsid, unsigned long trap,
876 int ssize, int psize, unsigned long pte)
877{
878 if (!printk_ratelimit())
879 return;
880 pr_info("mm: Hashing failure ! EA=0x%lx access=0x%lx current=%s\n",
881 ea, access, current->comm);
882 pr_info(" trap=0x%lx vsid=0x%lx ssize=%d psize=%d pte=0x%lx\n",
883 trap, vsid, ssize, psize, pte);
884}
885
874/* Result code is: 886/* Result code is:
875 * 0 - handled 887 * 0 - handled
876 * 1 - normal page fault 888 * 1 - normal page fault
@@ -955,6 +967,17 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
955 return 1; 967 return 1;
956 } 968 }
957 969
970 /* Add _PAGE_PRESENT to the required access perm */
971 access |= _PAGE_PRESENT;
972
973 /* Pre-check access permissions (will be re-checked atomically
974 * in __hash_page_XX but this pre-check is a fast path
975 */
976 if (access & ~pte_val(*ptep)) {
977 DBG_LOW(" no access !\n");
978 return 1;
979 }
980
958#ifdef CONFIG_HUGETLB_PAGE 981#ifdef CONFIG_HUGETLB_PAGE
959 if (hugeshift) 982 if (hugeshift)
960 return __hash_page_huge(ea, access, vsid, ptep, trap, local, 983 return __hash_page_huge(ea, access, vsid, ptep, trap, local,
@@ -967,14 +990,6 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
967 DBG_LOW(" i-pte: %016lx %016lx\n", pte_val(*ptep), 990 DBG_LOW(" i-pte: %016lx %016lx\n", pte_val(*ptep),
968 pte_val(*(ptep + PTRS_PER_PTE))); 991 pte_val(*(ptep + PTRS_PER_PTE)));
969#endif 992#endif
970 /* Pre-check access permissions (will be re-checked atomically
971 * in __hash_page_XX but this pre-check is a fast path
972 */
973 if (access & ~pte_val(*ptep)) {
974 DBG_LOW(" no access !\n");
975 return 1;
976 }
977
978 /* Do actual hashing */ 993 /* Do actual hashing */
979#ifdef CONFIG_PPC_64K_PAGES 994#ifdef CONFIG_PPC_64K_PAGES
980 /* If _PAGE_4K_PFN is set, make sure this is a 4k segment */ 995 /* If _PAGE_4K_PFN is set, make sure this is a 4k segment */
@@ -1033,6 +1048,12 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
1033 local, ssize, spp); 1048 local, ssize, spp);
1034 } 1049 }
1035 1050
1051 /* Dump some info in case of hash insertion failure, they should
1052 * never happen so it is really useful to know if/when they do
1053 */
1054 if (rc == -1)
1055 hash_failure_debug(ea, access, vsid, trap, ssize, psize,
1056 pte_val(*ptep));
1036#ifndef CONFIG_PPC_64K_PAGES 1057#ifndef CONFIG_PPC_64K_PAGES
1037 DBG_LOW(" o-pte: %016lx\n", pte_val(*ptep)); 1058 DBG_LOW(" o-pte: %016lx\n", pte_val(*ptep));
1038#else 1059#else
@@ -1051,8 +1072,7 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
1051 void *pgdir; 1072 void *pgdir;
1052 pte_t *ptep; 1073 pte_t *ptep;
1053 unsigned long flags; 1074 unsigned long flags;
1054 int local = 0; 1075 int rc, ssize, local = 0;
1055 int ssize;
1056 1076
1057 BUG_ON(REGION_ID(ea) != USER_REGION_ID); 1077 BUG_ON(REGION_ID(ea) != USER_REGION_ID);
1058 1078
@@ -1098,11 +1118,18 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
1098 /* Hash it in */ 1118 /* Hash it in */
1099#ifdef CONFIG_PPC_HAS_HASH_64K 1119#ifdef CONFIG_PPC_HAS_HASH_64K
1100 if (mm->context.user_psize == MMU_PAGE_64K) 1120 if (mm->context.user_psize == MMU_PAGE_64K)
1101 __hash_page_64K(ea, access, vsid, ptep, trap, local, ssize); 1121 rc = __hash_page_64K(ea, access, vsid, ptep, trap, local, ssize);
1102 else 1122 else
1103#endif /* CONFIG_PPC_HAS_HASH_64K */ 1123#endif /* CONFIG_PPC_HAS_HASH_64K */
1104 __hash_page_4K(ea, access, vsid, ptep, trap, local, ssize, 1124 rc = __hash_page_4K(ea, access, vsid, ptep, trap, local, ssize,
1105 subpage_protection(pgdir, ea)); 1125 subpage_protection(pgdir, ea));
1126
1127 /* Dump some info in case of hash insertion failure, they should
1128 * never happen so it is really useful to know if/when they do
1129 */
1130 if (rc == -1)
1131 hash_failure_debug(ea, access, vsid, trap, ssize,
1132 mm->context.user_psize, pte_val(*ptep));
1106 1133
1107 local_irq_restore(flags); 1134 local_irq_restore(flags);
1108} 1135}
diff --git a/arch/powerpc/mm/hugetlbpage-hash64.c b/arch/powerpc/mm/hugetlbpage-hash64.c
index 199539882f92..cc5c273086cf 100644
--- a/arch/powerpc/mm/hugetlbpage-hash64.c
+++ b/arch/powerpc/mm/hugetlbpage-hash64.c
@@ -21,21 +21,13 @@ int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,
21 unsigned long old_pte, new_pte; 21 unsigned long old_pte, new_pte;
22 unsigned long va, rflags, pa, sz; 22 unsigned long va, rflags, pa, sz;
23 long slot; 23 long slot;
24 int err = 1;
25 24
26 BUG_ON(shift != mmu_psize_defs[mmu_psize].shift); 25 BUG_ON(shift != mmu_psize_defs[mmu_psize].shift);
27 26
28 /* Search the Linux page table for a match with va */ 27 /* Search the Linux page table for a match with va */
29 va = hpt_va(ea, vsid, ssize); 28 va = hpt_va(ea, vsid, ssize);
30 29
31 /* 30 /* At this point, we have a pte (old_pte) which can be used to build
32 * Check the user's access rights to the page. If access should be
33 * prevented then send the problem up to do_page_fault.
34 */
35 if (unlikely(access & ~pte_val(*ptep)))
36 goto out;
37 /*
38 * At this point, we have a pte (old_pte) which can be used to build
39 * or update an HPTE. There are 2 cases: 31 * or update an HPTE. There are 2 cases:
40 * 32 *
41 * 1. There is a valid (present) pte with no associated HPTE (this is 33 * 1. There is a valid (present) pte with no associated HPTE (this is
@@ -49,9 +41,17 @@ int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,
49 41
50 do { 42 do {
51 old_pte = pte_val(*ptep); 43 old_pte = pte_val(*ptep);
52 if (old_pte & _PAGE_BUSY) 44 /* If PTE busy, retry the access */
53 goto out; 45 if (unlikely(old_pte & _PAGE_BUSY))
46 return 0;
47 /* If PTE permissions don't match, take page fault */
48 if (unlikely(access & ~old_pte))
49 return 1;
50 /* Try to lock the PTE, add ACCESSED and DIRTY if it was
51 * a write access */
54 new_pte = old_pte | _PAGE_BUSY | _PAGE_ACCESSED; 52 new_pte = old_pte | _PAGE_BUSY | _PAGE_ACCESSED;
53 if (access & _PAGE_RW)
54 new_pte |= _PAGE_DIRTY;
55 } while(old_pte != __cmpxchg_u64((unsigned long *)ptep, 55 } while(old_pte != __cmpxchg_u64((unsigned long *)ptep,
56 old_pte, new_pte)); 56 old_pte, new_pte));
57 57
@@ -121,8 +121,16 @@ repeat:
121 } 121 }
122 } 122 }
123 123
124 if (unlikely(slot == -2)) 124 /*
125 panic("hash_huge_page: pte_insert failed\n"); 125 * Hypervisor failure. Restore old pte and return -1
126 * similar to __hash_page_*
127 */
128 if (unlikely(slot == -2)) {
129 *ptep = __pte(old_pte);
130 hash_failure_debug(ea, access, vsid, trap, ssize,
131 mmu_psize, old_pte);
132 return -1;
133 }
126 134
127 new_pte |= (slot << 12) & (_PAGE_F_SECOND | _PAGE_F_GIX); 135 new_pte |= (slot << 12) & (_PAGE_F_SECOND | _PAGE_F_GIX);
128 } 136 }
@@ -131,9 +139,5 @@ repeat:
131 * No need to use ldarx/stdcx here 139 * No need to use ldarx/stdcx here
132 */ 140 */
133 *ptep = __pte(new_pte & ~_PAGE_BUSY); 141 *ptep = __pte(new_pte & ~_PAGE_BUSY);
134 142 return 0;
135 err = 0;
136
137 out:
138 return err;
139} 143}
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index f47364585ecd..aa731af720c0 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -398,15 +398,15 @@ static int of_get_drconf_memory(struct device_node *memory, const u32 **dm)
398} 398}
399 399
400/* 400/*
401 * Retreive and validate the ibm,memblock-size property for drconf memory 401 * Retreive and validate the ibm,lmb-size property for drconf memory
402 * from the device tree. 402 * from the device tree.
403 */ 403 */
404static u64 of_get_memblock_size(struct device_node *memory) 404static u64 of_get_lmb_size(struct device_node *memory)
405{ 405{
406 const u32 *prop; 406 const u32 *prop;
407 u32 len; 407 u32 len;
408 408
409 prop = of_get_property(memory, "ibm,memblock-size", &len); 409 prop = of_get_property(memory, "ibm,lmb-size", &len);
410 if (!prop || len < sizeof(unsigned int)) 410 if (!prop || len < sizeof(unsigned int))
411 return 0; 411 return 0;
412 412
@@ -562,7 +562,7 @@ static unsigned long __init numa_enforce_memory_limit(unsigned long start,
562static inline int __init read_usm_ranges(const u32 **usm) 562static inline int __init read_usm_ranges(const u32 **usm)
563{ 563{
564 /* 564 /*
565 * For each memblock in ibm,dynamic-memory a corresponding 565 * For each lmb in ibm,dynamic-memory a corresponding
566 * entry in linux,drconf-usable-memory property contains 566 * entry in linux,drconf-usable-memory property contains
567 * a counter followed by that many (base, size) duple. 567 * a counter followed by that many (base, size) duple.
568 * read the counter from linux,drconf-usable-memory 568 * read the counter from linux,drconf-usable-memory
@@ -578,7 +578,7 @@ static void __init parse_drconf_memory(struct device_node *memory)
578{ 578{
579 const u32 *dm, *usm; 579 const u32 *dm, *usm;
580 unsigned int n, rc, ranges, is_kexec_kdump = 0; 580 unsigned int n, rc, ranges, is_kexec_kdump = 0;
581 unsigned long memblock_size, base, size, sz; 581 unsigned long lmb_size, base, size, sz;
582 int nid; 582 int nid;
583 struct assoc_arrays aa; 583 struct assoc_arrays aa;
584 584
@@ -586,8 +586,8 @@ static void __init parse_drconf_memory(struct device_node *memory)
586 if (!n) 586 if (!n)
587 return; 587 return;
588 588
589 memblock_size = of_get_memblock_size(memory); 589 lmb_size = of_get_lmb_size(memory);
590 if (!memblock_size) 590 if (!lmb_size)
591 return; 591 return;
592 592
593 rc = of_get_assoc_arrays(memory, &aa); 593 rc = of_get_assoc_arrays(memory, &aa);
@@ -611,7 +611,7 @@ static void __init parse_drconf_memory(struct device_node *memory)
611 continue; 611 continue;
612 612
613 base = drmem.base_addr; 613 base = drmem.base_addr;
614 size = memblock_size; 614 size = lmb_size;
615 ranges = 1; 615 ranges = 1;
616 616
617 if (is_kexec_kdump) { 617 if (is_kexec_kdump) {
@@ -1072,7 +1072,7 @@ static int hot_add_drconf_scn_to_nid(struct device_node *memory,
1072{ 1072{
1073 const u32 *dm; 1073 const u32 *dm;
1074 unsigned int drconf_cell_cnt, rc; 1074 unsigned int drconf_cell_cnt, rc;
1075 unsigned long memblock_size; 1075 unsigned long lmb_size;
1076 struct assoc_arrays aa; 1076 struct assoc_arrays aa;
1077 int nid = -1; 1077 int nid = -1;
1078 1078
@@ -1080,8 +1080,8 @@ static int hot_add_drconf_scn_to_nid(struct device_node *memory,
1080 if (!drconf_cell_cnt) 1080 if (!drconf_cell_cnt)
1081 return -1; 1081 return -1;
1082 1082
1083 memblock_size = of_get_memblock_size(memory); 1083 lmb_size = of_get_lmb_size(memory);
1084 if (!memblock_size) 1084 if (!lmb_size)
1085 return -1; 1085 return -1;
1086 1086
1087 rc = of_get_assoc_arrays(memory, &aa); 1087 rc = of_get_assoc_arrays(memory, &aa);
@@ -1100,7 +1100,7 @@ static int hot_add_drconf_scn_to_nid(struct device_node *memory,
1100 continue; 1100 continue;
1101 1101
1102 if ((scn_addr < drmem.base_addr) 1102 if ((scn_addr < drmem.base_addr)
1103 || (scn_addr >= (drmem.base_addr + memblock_size))) 1103 || (scn_addr >= (drmem.base_addr + lmb_size)))
1104 continue; 1104 continue;
1105 1105
1106 nid = of_drconf_to_nid_single(&drmem, &aa); 1106 nid = of_drconf_to_nid_single(&drmem, &aa);
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index deab5f946090..bc8803664140 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -69,7 +69,7 @@ static int pseries_remove_memory(struct device_node *np)
69 const char *type; 69 const char *type;
70 const unsigned int *regs; 70 const unsigned int *regs;
71 unsigned long base; 71 unsigned long base;
72 unsigned int memblock_size; 72 unsigned int lmb_size;
73 int ret = -EINVAL; 73 int ret = -EINVAL;
74 74
75 /* 75 /*
@@ -87,9 +87,9 @@ static int pseries_remove_memory(struct device_node *np)
87 return ret; 87 return ret;
88 88
89 base = *(unsigned long *)regs; 89 base = *(unsigned long *)regs;
90 memblock_size = regs[3]; 90 lmb_size = regs[3];
91 91
92 ret = pseries_remove_memblock(base, memblock_size); 92 ret = pseries_remove_memblock(base, lmb_size);
93 return ret; 93 return ret;
94} 94}
95 95
@@ -98,7 +98,7 @@ static int pseries_add_memory(struct device_node *np)
98 const char *type; 98 const char *type;
99 const unsigned int *regs; 99 const unsigned int *regs;
100 unsigned long base; 100 unsigned long base;
101 unsigned int memblock_size; 101 unsigned int lmb_size;
102 int ret = -EINVAL; 102 int ret = -EINVAL;
103 103
104 /* 104 /*
@@ -116,36 +116,36 @@ static int pseries_add_memory(struct device_node *np)
116 return ret; 116 return ret;
117 117
118 base = *(unsigned long *)regs; 118 base = *(unsigned long *)regs;
119 memblock_size = regs[3]; 119 lmb_size = regs[3];
120 120
121 /* 121 /*
122 * Update memory region to represent the memory add 122 * Update memory region to represent the memory add
123 */ 123 */
124 ret = memblock_add(base, memblock_size); 124 ret = memblock_add(base, lmb_size);
125 return (ret < 0) ? -EINVAL : 0; 125 return (ret < 0) ? -EINVAL : 0;
126} 126}
127 127
128static int pseries_drconf_memory(unsigned long *base, unsigned int action) 128static int pseries_drconf_memory(unsigned long *base, unsigned int action)
129{ 129{
130 struct device_node *np; 130 struct device_node *np;
131 const unsigned long *memblock_size; 131 const unsigned long *lmb_size;
132 int rc; 132 int rc;
133 133
134 np = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory"); 134 np = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory");
135 if (!np) 135 if (!np)
136 return -EINVAL; 136 return -EINVAL;
137 137
138 memblock_size = of_get_property(np, "ibm,memblock-size", NULL); 138 lmb_size = of_get_property(np, "ibm,lmb-size", NULL);
139 if (!memblock_size) { 139 if (!lmb_size) {
140 of_node_put(np); 140 of_node_put(np);
141 return -EINVAL; 141 return -EINVAL;
142 } 142 }
143 143
144 if (action == PSERIES_DRCONF_MEM_ADD) { 144 if (action == PSERIES_DRCONF_MEM_ADD) {
145 rc = memblock_add(*base, *memblock_size); 145 rc = memblock_add(*base, *lmb_size);
146 rc = (rc < 0) ? -EINVAL : 0; 146 rc = (rc < 0) ? -EINVAL : 0;
147 } else if (action == PSERIES_DRCONF_MEM_REMOVE) { 147 } else if (action == PSERIES_DRCONF_MEM_REMOVE) {
148 rc = pseries_remove_memblock(*base, *memblock_size); 148 rc = pseries_remove_memblock(*base, *lmb_size);
149 } else { 149 } else {
150 rc = -EINVAL; 150 rc = -EINVAL;
151 } 151 }
diff --git a/arch/sparc/configs/sparc64_defconfig b/arch/sparc/configs/sparc64_defconfig
index 259e3fd50993..1dc07a0014c1 100644
--- a/arch/sparc/configs/sparc64_defconfig
+++ b/arch/sparc/configs/sparc64_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.34-rc3 3# Linux kernel version: 2.6.34
4# Sat Apr 3 15:49:56 2010 4# Wed May 26 21:14:01 2010
5# 5#
6CONFIG_64BIT=y 6CONFIG_64BIT=y
7CONFIG_SPARC=y 7CONFIG_SPARC=y
@@ -107,10 +107,9 @@ CONFIG_PERF_COUNTERS=y
107# CONFIG_DEBUG_PERF_USE_VMALLOC is not set 107# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
108CONFIG_VM_EVENT_COUNTERS=y 108CONFIG_VM_EVENT_COUNTERS=y
109CONFIG_PCI_QUIRKS=y 109CONFIG_PCI_QUIRKS=y
110CONFIG_SLUB_DEBUG=y
111# CONFIG_COMPAT_BRK is not set 110# CONFIG_COMPAT_BRK is not set
112# CONFIG_SLAB is not set 111CONFIG_SLAB=y
113CONFIG_SLUB=y 112# CONFIG_SLUB is not set
114# CONFIG_SLOB is not set 113# CONFIG_SLOB is not set
115CONFIG_PROFILING=y 114CONFIG_PROFILING=y
116CONFIG_TRACEPOINTS=y 115CONFIG_TRACEPOINTS=y
@@ -239,6 +238,7 @@ CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
239CONFIG_SPARSEMEM_VMEMMAP=y 238CONFIG_SPARSEMEM_VMEMMAP=y
240CONFIG_PAGEFLAGS_EXTENDED=y 239CONFIG_PAGEFLAGS_EXTENDED=y
241CONFIG_SPLIT_PTLOCK_CPUS=4 240CONFIG_SPLIT_PTLOCK_CPUS=4
241# CONFIG_COMPACTION is not set
242CONFIG_MIGRATION=y 242CONFIG_MIGRATION=y
243CONFIG_PHYS_ADDR_T_64BIT=y 243CONFIG_PHYS_ADDR_T_64BIT=y
244CONFIG_ZONE_DMA_FLAG=0 244CONFIG_ZONE_DMA_FLAG=0
@@ -351,6 +351,7 @@ CONFIG_IPV6_TUNNEL=m
351# CONFIG_RDS is not set 351# CONFIG_RDS is not set
352# CONFIG_TIPC is not set 352# CONFIG_TIPC is not set
353# CONFIG_ATM is not set 353# CONFIG_ATM is not set
354# CONFIG_L2TP is not set
354# CONFIG_BRIDGE is not set 355# CONFIG_BRIDGE is not set
355# CONFIG_NET_DSA is not set 356# CONFIG_NET_DSA is not set
356CONFIG_VLAN_8021Q=m 357CONFIG_VLAN_8021Q=m
@@ -367,6 +368,7 @@ CONFIG_VLAN_8021Q=m
367# CONFIG_IEEE802154 is not set 368# CONFIG_IEEE802154 is not set
368# CONFIG_NET_SCHED is not set 369# CONFIG_NET_SCHED is not set
369# CONFIG_DCB is not set 370# CONFIG_DCB is not set
371CONFIG_RPS=y
370 372
371# 373#
372# Network testing 374# Network testing
@@ -386,9 +388,14 @@ CONFIG_WIRELESS=y
386# 388#
387# CFG80211 needs to be enabled for MAC80211 389# CFG80211 needs to be enabled for MAC80211
388# 390#
391
392#
393# Some wireless drivers require a rate control algorithm
394#
389# CONFIG_WIMAX is not set 395# CONFIG_WIMAX is not set
390# CONFIG_RFKILL is not set 396# CONFIG_RFKILL is not set
391# CONFIG_NET_9P is not set 397# CONFIG_NET_9P is not set
398# CONFIG_CAIF is not set
392 399
393# 400#
394# Device Drivers 401# Device Drivers
@@ -658,6 +665,7 @@ CONFIG_PHYLIB=m
658# CONFIG_NATIONAL_PHY is not set 665# CONFIG_NATIONAL_PHY is not set
659# CONFIG_STE10XP is not set 666# CONFIG_STE10XP is not set
660# CONFIG_LSI_ET1011C_PHY is not set 667# CONFIG_LSI_ET1011C_PHY is not set
668# CONFIG_MICREL_PHY is not set
661# CONFIG_MDIO_BITBANG is not set 669# CONFIG_MDIO_BITBANG is not set
662CONFIG_NET_ETHERNET=y 670CONFIG_NET_ETHERNET=y
663CONFIG_MII=m 671CONFIG_MII=m
@@ -734,6 +742,8 @@ CONFIG_NETDEV_10000=y
734# CONFIG_CHELSIO_T1 is not set 742# CONFIG_CHELSIO_T1 is not set
735CONFIG_CHELSIO_T3_DEPENDS=y 743CONFIG_CHELSIO_T3_DEPENDS=y
736# CONFIG_CHELSIO_T3 is not set 744# CONFIG_CHELSIO_T3 is not set
745CONFIG_CHELSIO_T4_DEPENDS=y
746# CONFIG_CHELSIO_T4 is not set
737# CONFIG_ENIC is not set 747# CONFIG_ENIC is not set
738# CONFIG_IXGBE is not set 748# CONFIG_IXGBE is not set
739# CONFIG_IXGBEVF is not set 749# CONFIG_IXGBEVF is not set
@@ -766,6 +776,7 @@ CONFIG_NIU=m
766# CONFIG_USB_PEGASUS is not set 776# CONFIG_USB_PEGASUS is not set
767# CONFIG_USB_RTL8150 is not set 777# CONFIG_USB_RTL8150 is not set
768# CONFIG_USB_USBNET is not set 778# CONFIG_USB_USBNET is not set
779# CONFIG_USB_IPHETH is not set
769# CONFIG_WAN is not set 780# CONFIG_WAN is not set
770# CONFIG_FDDI is not set 781# CONFIG_FDDI is not set
771# CONFIG_HIPPI is not set 782# CONFIG_HIPPI is not set
@@ -778,7 +789,6 @@ CONFIG_PPP_DEFLATE=m
778CONFIG_PPP_BSDCOMP=m 789CONFIG_PPP_BSDCOMP=m
779CONFIG_PPP_MPPE=m 790CONFIG_PPP_MPPE=m
780CONFIG_PPPOE=m 791CONFIG_PPPOE=m
781# CONFIG_PPPOL2TP is not set
782# CONFIG_SLIP is not set 792# CONFIG_SLIP is not set
783CONFIG_SLHC=m 793CONFIG_SLHC=m
784# CONFIG_NET_FC is not set 794# CONFIG_NET_FC is not set
@@ -816,6 +826,7 @@ CONFIG_INPUT_KEYBOARD=y
816CONFIG_KEYBOARD_ATKBD=y 826CONFIG_KEYBOARD_ATKBD=y
817# CONFIG_QT2160 is not set 827# CONFIG_QT2160 is not set
818CONFIG_KEYBOARD_LKKBD=m 828CONFIG_KEYBOARD_LKKBD=m
829# CONFIG_KEYBOARD_TCA6416 is not set
819# CONFIG_KEYBOARD_MAX7359 is not set 830# CONFIG_KEYBOARD_MAX7359 is not set
820# CONFIG_KEYBOARD_NEWTON is not set 831# CONFIG_KEYBOARD_NEWTON is not set
821# CONFIG_KEYBOARD_OPENCORES is not set 832# CONFIG_KEYBOARD_OPENCORES is not set
@@ -840,6 +851,7 @@ CONFIG_MOUSE_SERIAL=y
840# CONFIG_INPUT_TABLET is not set 851# CONFIG_INPUT_TABLET is not set
841# CONFIG_INPUT_TOUCHSCREEN is not set 852# CONFIG_INPUT_TOUCHSCREEN is not set
842CONFIG_INPUT_MISC=y 853CONFIG_INPUT_MISC=y
854# CONFIG_INPUT_AD714X is not set
843CONFIG_INPUT_SPARCSPKR=y 855CONFIG_INPUT_SPARCSPKR=y
844# CONFIG_INPUT_ATI_REMOTE is not set 856# CONFIG_INPUT_ATI_REMOTE is not set
845# CONFIG_INPUT_ATI_REMOTE2 is not set 857# CONFIG_INPUT_ATI_REMOTE2 is not set
@@ -848,6 +860,7 @@ CONFIG_INPUT_SPARCSPKR=y
848# CONFIG_INPUT_YEALINK is not set 860# CONFIG_INPUT_YEALINK is not set
849# CONFIG_INPUT_CM109 is not set 861# CONFIG_INPUT_CM109 is not set
850# CONFIG_INPUT_UINPUT is not set 862# CONFIG_INPUT_UINPUT is not set
863# CONFIG_INPUT_PCF8574 is not set
851 864
852# 865#
853# Hardware I/O ports 866# Hardware I/O ports
@@ -871,6 +884,7 @@ CONFIG_HW_CONSOLE=y
871# CONFIG_VT_HW_CONSOLE_BINDING is not set 884# CONFIG_VT_HW_CONSOLE_BINDING is not set
872# CONFIG_DEVKMEM is not set 885# CONFIG_DEVKMEM is not set
873# CONFIG_SERIAL_NONSTANDARD is not set 886# CONFIG_SERIAL_NONSTANDARD is not set
887# CONFIG_N_GSM is not set
874# CONFIG_NOZOMI is not set 888# CONFIG_NOZOMI is not set
875 889
876# 890#
@@ -893,6 +907,8 @@ CONFIG_SERIAL_CORE_CONSOLE=y
893# CONFIG_SERIAL_JSM is not set 907# CONFIG_SERIAL_JSM is not set
894# CONFIG_SERIAL_TIMBERDALE is not set 908# CONFIG_SERIAL_TIMBERDALE is not set
895# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set 909# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
910# CONFIG_SERIAL_ALTERA_JTAGUART is not set
911# CONFIG_SERIAL_ALTERA_UART is not set
896CONFIG_UNIX98_PTYS=y 912CONFIG_UNIX98_PTYS=y
897# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set 913# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
898# CONFIG_LEGACY_PTYS is not set 914# CONFIG_LEGACY_PTYS is not set
@@ -1306,11 +1322,14 @@ CONFIG_USB_HIDDEV=y
1306CONFIG_HID_A4TECH=y 1322CONFIG_HID_A4TECH=y
1307CONFIG_HID_APPLE=y 1323CONFIG_HID_APPLE=y
1308CONFIG_HID_BELKIN=y 1324CONFIG_HID_BELKIN=y
1325# CONFIG_HID_CANDO is not set
1309CONFIG_HID_CHERRY=y 1326CONFIG_HID_CHERRY=y
1310CONFIG_HID_CHICONY=y 1327CONFIG_HID_CHICONY=y
1328# CONFIG_HID_PRODIKEYS is not set
1311CONFIG_HID_CYPRESS=y 1329CONFIG_HID_CYPRESS=y
1312CONFIG_HID_DRAGONRISE=y 1330CONFIG_HID_DRAGONRISE=y
1313# CONFIG_DRAGONRISE_FF is not set 1331# CONFIG_DRAGONRISE_FF is not set
1332# CONFIG_HID_EGALAX is not set
1314CONFIG_HID_EZKEY=y 1333CONFIG_HID_EZKEY=y
1315CONFIG_HID_KYE=y 1334CONFIG_HID_KYE=y
1316CONFIG_HID_GYRATION=y 1335CONFIG_HID_GYRATION=y
@@ -1328,7 +1347,9 @@ CONFIG_HID_ORTEK=y
1328CONFIG_HID_PANTHERLORD=y 1347CONFIG_HID_PANTHERLORD=y
1329# CONFIG_PANTHERLORD_FF is not set 1348# CONFIG_PANTHERLORD_FF is not set
1330CONFIG_HID_PETALYNX=y 1349CONFIG_HID_PETALYNX=y
1350# CONFIG_HID_PICOLCD is not set
1331# CONFIG_HID_QUANTA is not set 1351# CONFIG_HID_QUANTA is not set
1352# CONFIG_HID_ROCCAT_KONE is not set
1332CONFIG_HID_SAMSUNG=y 1353CONFIG_HID_SAMSUNG=y
1333CONFIG_HID_SONY=y 1354CONFIG_HID_SONY=y
1334# CONFIG_HID_STANTUM is not set 1355# CONFIG_HID_STANTUM is not set
@@ -1342,6 +1363,7 @@ CONFIG_HID_THRUSTMASTER=y
1342# CONFIG_THRUSTMASTER_FF is not set 1363# CONFIG_THRUSTMASTER_FF is not set
1343CONFIG_HID_ZEROPLUS=y 1364CONFIG_HID_ZEROPLUS=y
1344# CONFIG_ZEROPLUS_FF is not set 1365# CONFIG_ZEROPLUS_FF is not set
1366# CONFIG_HID_ZYDACRON is not set
1345CONFIG_USB_SUPPORT=y 1367CONFIG_USB_SUPPORT=y
1346CONFIG_USB_ARCH_HAS_HCD=y 1368CONFIG_USB_ARCH_HAS_HCD=y
1347CONFIG_USB_ARCH_HAS_OHCI=y 1369CONFIG_USB_ARCH_HAS_OHCI=y
@@ -1356,7 +1378,6 @@ CONFIG_USB=y
1356# CONFIG_USB_DEVICEFS is not set 1378# CONFIG_USB_DEVICEFS is not set
1357# CONFIG_USB_DEVICE_CLASS is not set 1379# CONFIG_USB_DEVICE_CLASS is not set
1358# CONFIG_USB_DYNAMIC_MINORS is not set 1380# CONFIG_USB_DYNAMIC_MINORS is not set
1359# CONFIG_USB_OTG is not set
1360# CONFIG_USB_MON is not set 1381# CONFIG_USB_MON is not set
1361# CONFIG_USB_WUSB is not set 1382# CONFIG_USB_WUSB is not set
1362# CONFIG_USB_WUSB_CBAF is not set 1383# CONFIG_USB_WUSB_CBAF is not set
@@ -1521,10 +1542,6 @@ CONFIG_RTC_DRV_STARFIRE=y
1521# CONFIG_DMADEVICES is not set 1542# CONFIG_DMADEVICES is not set
1522# CONFIG_AUXDISPLAY is not set 1543# CONFIG_AUXDISPLAY is not set
1523# CONFIG_UIO is not set 1544# CONFIG_UIO is not set
1524
1525#
1526# TI VLYNQ
1527#
1528# CONFIG_STAGING is not set 1545# CONFIG_STAGING is not set
1529 1546
1530# 1547#
@@ -1706,8 +1723,8 @@ CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
1706CONFIG_SCHEDSTATS=y 1723CONFIG_SCHEDSTATS=y
1707# CONFIG_TIMER_STATS is not set 1724# CONFIG_TIMER_STATS is not set
1708# CONFIG_DEBUG_OBJECTS is not set 1725# CONFIG_DEBUG_OBJECTS is not set
1709# CONFIG_SLUB_DEBUG_ON is not set 1726# CONFIG_DEBUG_SLAB is not set
1710# CONFIG_SLUB_STATS is not set 1727# CONFIG_DEBUG_KMEMLEAK is not set
1711# CONFIG_DEBUG_RT_MUTEXES is not set 1728# CONFIG_DEBUG_RT_MUTEXES is not set
1712# CONFIG_RT_MUTEX_TESTER is not set 1729# CONFIG_RT_MUTEX_TESTER is not set
1713# CONFIG_DEBUG_SPINLOCK is not set 1730# CONFIG_DEBUG_SPINLOCK is not set
@@ -1742,6 +1759,9 @@ CONFIG_SYSCTL_SYSCALL_CHECK=y
1742# CONFIG_DEBUG_PAGEALLOC is not set 1759# CONFIG_DEBUG_PAGEALLOC is not set
1743CONFIG_NOP_TRACER=y 1760CONFIG_NOP_TRACER=y
1744CONFIG_HAVE_FUNCTION_TRACER=y 1761CONFIG_HAVE_FUNCTION_TRACER=y
1762CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
1763CONFIG_HAVE_FUNCTION_GRAPH_FP_TEST=y
1764CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
1745CONFIG_HAVE_DYNAMIC_FTRACE=y 1765CONFIG_HAVE_DYNAMIC_FTRACE=y
1746CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y 1766CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
1747CONFIG_HAVE_SYSCALL_TRACEPOINTS=y 1767CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
@@ -1769,12 +1789,12 @@ CONFIG_BLK_DEV_IO_TRACE=y
1769# CONFIG_RING_BUFFER_BENCHMARK is not set 1789# CONFIG_RING_BUFFER_BENCHMARK is not set
1770# CONFIG_DYNAMIC_DEBUG is not set 1790# CONFIG_DYNAMIC_DEBUG is not set
1771# CONFIG_DMA_API_DEBUG is not set 1791# CONFIG_DMA_API_DEBUG is not set
1792# CONFIG_ATOMIC64_SELFTEST is not set
1772# CONFIG_SAMPLES is not set 1793# CONFIG_SAMPLES is not set
1773CONFIG_HAVE_ARCH_KGDB=y 1794CONFIG_HAVE_ARCH_KGDB=y
1774# CONFIG_KGDB is not set 1795# CONFIG_KGDB is not set
1775# CONFIG_DEBUG_STACK_USAGE is not set 1796# CONFIG_DEBUG_STACK_USAGE is not set
1776# CONFIG_DEBUG_DCFLUSH is not set 1797# CONFIG_DEBUG_DCFLUSH is not set
1777# CONFIG_STACK_DEBUG is not set
1778# CONFIG_DEBUG_STRICT_USER_COPY_CHECKS is not set 1798# CONFIG_DEBUG_STRICT_USER_COPY_CHECKS is not set
1779 1799
1780# 1800#
@@ -1895,6 +1915,7 @@ CONFIG_CRYPTO_DEFLATE=y
1895# 1915#
1896# CONFIG_CRYPTO_ANSI_CPRNG is not set 1916# CONFIG_CRYPTO_ANSI_CPRNG is not set
1897CONFIG_CRYPTO_HW=y 1917CONFIG_CRYPTO_HW=y
1918# CONFIG_CRYPTO_DEV_NIAGARA2 is not set
1898# CONFIG_CRYPTO_DEV_HIFN_795X is not set 1919# CONFIG_CRYPTO_DEV_HIFN_795X is not set
1899CONFIG_BINARY_PRINTF=y 1920CONFIG_BINARY_PRINTF=y
1900 1921
diff --git a/arch/sparc/include/asm/cache.h b/arch/sparc/include/asm/cache.h
index 0588b8c7faa2..69358b590c91 100644
--- a/arch/sparc/include/asm/cache.h
+++ b/arch/sparc/include/asm/cache.h
@@ -11,7 +11,6 @@
11 11
12#define L1_CACHE_SHIFT 5 12#define L1_CACHE_SHIFT 5
13#define L1_CACHE_BYTES 32 13#define L1_CACHE_BYTES 32
14#define L1_CACHE_ALIGN(x) ((((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1)))
15 14
16#ifdef CONFIG_SPARC32 15#ifdef CONFIG_SPARC32
17#define SMP_CACHE_BYTES_SHIFT 5 16#define SMP_CACHE_BYTES_SHIFT 5
diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h
index 77f906d8cc21..0ece77f47753 100644
--- a/arch/sparc/include/asm/pgtable_32.h
+++ b/arch/sparc/include/asm/pgtable_32.h
@@ -142,13 +142,12 @@ BTFIXUPDEF_CALL_CONST(unsigned long, pgd_page_vaddr, pgd_t)
142#define pmd_page(pmd) BTFIXUP_CALL(pmd_page)(pmd) 142#define pmd_page(pmd) BTFIXUP_CALL(pmd_page)(pmd)
143#define pgd_page_vaddr(pgd) BTFIXUP_CALL(pgd_page_vaddr)(pgd) 143#define pgd_page_vaddr(pgd) BTFIXUP_CALL(pgd_page_vaddr)(pgd)
144 144
145BTFIXUPDEF_SETHI(none_mask)
146BTFIXUPDEF_CALL_CONST(int, pte_present, pte_t) 145BTFIXUPDEF_CALL_CONST(int, pte_present, pte_t)
147BTFIXUPDEF_CALL(void, pte_clear, pte_t *) 146BTFIXUPDEF_CALL(void, pte_clear, pte_t *)
148 147
149static inline int pte_none(pte_t pte) 148static inline int pte_none(pte_t pte)
150{ 149{
151 return !(pte_val(pte) & ~BTFIXUP_SETHI(none_mask)); 150 return !pte_val(pte);
152} 151}
153 152
154#define pte_present(pte) BTFIXUP_CALL(pte_present)(pte) 153#define pte_present(pte) BTFIXUP_CALL(pte_present)(pte)
@@ -160,7 +159,7 @@ BTFIXUPDEF_CALL(void, pmd_clear, pmd_t *)
160 159
161static inline int pmd_none(pmd_t pmd) 160static inline int pmd_none(pmd_t pmd)
162{ 161{
163 return !(pmd_val(pmd) & ~BTFIXUP_SETHI(none_mask)); 162 return !pmd_val(pmd);
164} 163}
165 164
166#define pmd_bad(pmd) BTFIXUP_CALL(pmd_bad)(pmd) 165#define pmd_bad(pmd) BTFIXUP_CALL(pmd_bad)(pmd)
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index 0ec92c8861dd..44faabc3c02c 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -657,6 +657,7 @@ static u64 maybe_change_configuration(struct cpu_hw_events *cpuc, u64 pcr)
657 cpuc->current_idx[i] = idx; 657 cpuc->current_idx[i] = idx;
658 658
659 enc = perf_event_get_enc(cpuc->events[i]); 659 enc = perf_event_get_enc(cpuc->events[i]);
660 pcr &= ~mask_for_index(idx);
660 pcr |= event_encoding(enc, idx); 661 pcr |= event_encoding(enc, idx);
661 } 662 }
662out: 663out:
diff --git a/arch/sparc/kernel/sun4d_irq.c b/arch/sparc/kernel/sun4d_irq.c
index ab036a72de5a..e11b4612dabb 100644
--- a/arch/sparc/kernel/sun4d_irq.c
+++ b/arch/sparc/kernel/sun4d_irq.c
@@ -183,7 +183,7 @@ void sun4d_free_irq(unsigned int irq, void *dev_id)
183 goto out_unlock; 183 goto out_unlock;
184 } 184 }
185 185
186 if (action && tmp) 186 if (tmp)
187 tmp->next = action->next; 187 tmp->next = action->next;
188 else 188 else
189 *actionp = action->next; 189 *actionp = action->next;
diff --git a/arch/sparc/kernel/ttable.S b/arch/sparc/kernel/ttable.S
index 76d837fc47d3..c6dfdaa29e20 100644
--- a/arch/sparc/kernel/ttable.S
+++ b/arch/sparc/kernel/ttable.S
@@ -64,7 +64,7 @@ tl0_irq6: TRAP_IRQ(smp_call_function_single_client, 6)
64tl0_irq6: BTRAP(0x46) 64tl0_irq6: BTRAP(0x46)
65#endif 65#endif
66tl0_irq7: TRAP_IRQ(deferred_pcr_work_irq, 7) 66tl0_irq7: TRAP_IRQ(deferred_pcr_work_irq, 7)
67#ifdef CONFIG_KGDB 67#if defined(CONFIG_KGDB) && defined(CONFIG_SMP)
68tl0_irq8: TRAP_IRQ(smp_kgdb_capture_client, 8) 68tl0_irq8: TRAP_IRQ(smp_kgdb_capture_client, 8)
69#else 69#else
70tl0_irq8: BTRAP(0x48) 70tl0_irq8: BTRAP(0x48)
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index f5f75a58e0b3..b0b43aa5e45a 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -2215,8 +2215,6 @@ void __init ld_mmu_srmmu(void)
2215 BTFIXUPSET_CALL(pmd_page, srmmu_pmd_page, BTFIXUPCALL_NORM); 2215 BTFIXUPSET_CALL(pmd_page, srmmu_pmd_page, BTFIXUPCALL_NORM);
2216 BTFIXUPSET_CALL(pgd_page_vaddr, srmmu_pgd_page, BTFIXUPCALL_NORM); 2216 BTFIXUPSET_CALL(pgd_page_vaddr, srmmu_pgd_page, BTFIXUPCALL_NORM);
2217 2217
2218 BTFIXUPSET_SETHI(none_mask, 0xF0000000);
2219
2220 BTFIXUPSET_CALL(pte_present, srmmu_pte_present, BTFIXUPCALL_NORM); 2218 BTFIXUPSET_CALL(pte_present, srmmu_pte_present, BTFIXUPCALL_NORM);
2221 BTFIXUPSET_CALL(pte_clear, srmmu_pte_clear, BTFIXUPCALL_SWAPO0G0); 2219 BTFIXUPSET_CALL(pte_clear, srmmu_pte_clear, BTFIXUPCALL_SWAPO0G0);
2222 2220
diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c
index cf38846753dd..4289f90f8697 100644
--- a/arch/sparc/mm/sun4c.c
+++ b/arch/sparc/mm/sun4c.c
@@ -2087,9 +2087,6 @@ void __init ld_mmu_sun4c(void)
2087 2087
2088 BTFIXUPSET_CALL(set_pte, sun4c_set_pte, BTFIXUPCALL_STO1O0); 2088 BTFIXUPSET_CALL(set_pte, sun4c_set_pte, BTFIXUPCALL_STO1O0);
2089 2089
2090 /* The 2.4.18 code does not set this on sun4c, how does it work? XXX */
2091 /* BTFIXUPSET_SETHI(none_mask, 0x00000000); */ /* Defaults to zero? */
2092
2093 BTFIXUPSET_CALL(pte_pfn, sun4c_pte_pfn, BTFIXUPCALL_NORM); 2090 BTFIXUPSET_CALL(pte_pfn, sun4c_pte_pfn, BTFIXUPCALL_NORM);
2094#if 0 /* PAGE_SHIFT <= 12 */ /* Eek. Investigate. XXX */ 2091#if 0 /* PAGE_SHIFT <= 12 */ /* Eek. Investigate. XXX */
2095 BTFIXUPSET_CALL(pmd_page, sun4c_pmd_page, BTFIXUPCALL_ANDNINT(PAGE_SIZE - 1)); 2092 BTFIXUPSET_CALL(pmd_page, sun4c_pmd_page, BTFIXUPCALL_ANDNINT(PAGE_SIZE - 1));
diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
index 2e837f5080fe..fb7a5f052e2b 100644
--- a/arch/x86/kernel/acpi/cstate.c
+++ b/arch/x86/kernel/acpi/cstate.c
@@ -145,6 +145,15 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu,
145 percpu_entry->states[cx->index].eax = cx->address; 145 percpu_entry->states[cx->index].eax = cx->address;
146 percpu_entry->states[cx->index].ecx = MWAIT_ECX_INTERRUPT_BREAK; 146 percpu_entry->states[cx->index].ecx = MWAIT_ECX_INTERRUPT_BREAK;
147 } 147 }
148
149 /*
150 * For _CST FFH on Intel, if GAS.access_size bit 1 is cleared,
151 * then we should skip checking BM_STS for this C-state.
152 * ref: "Intel Processor Vendor-Specific ACPI Interface Specification"
153 */
154 if ((c->x86_vendor == X86_VENDOR_INTEL) && !(reg->access_size & 0x2))
155 cx->bm_sts_skip = 1;
156
148 return retval; 157 return retval;
149} 158}
150EXPORT_SYMBOL_GPL(acpi_processor_ffh_cstate_probe); 159EXPORT_SYMBOL_GPL(acpi_processor_ffh_cstate_probe);
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
index 82e508677b91..fcc3c61fdecc 100644
--- a/arch/x86/kernel/acpi/sleep.c
+++ b/arch/x86/kernel/acpi/sleep.c
@@ -157,9 +157,14 @@ static int __init acpi_sleep_setup(char *str)
157#ifdef CONFIG_HIBERNATION 157#ifdef CONFIG_HIBERNATION
158 if (strncmp(str, "s4_nohwsig", 10) == 0) 158 if (strncmp(str, "s4_nohwsig", 10) == 0)
159 acpi_no_s4_hw_signature(); 159 acpi_no_s4_hw_signature();
160 if (strncmp(str, "s4_nonvs", 8) == 0) 160 if (strncmp(str, "s4_nonvs", 8) == 0) {
161 acpi_s4_no_nvs(); 161 pr_warning("ACPI: acpi_sleep=s4_nonvs is deprecated, "
162 "please use acpi_sleep=nonvs instead");
163 acpi_nvs_nosave();
164 }
162#endif 165#endif
166 if (strncmp(str, "nonvs", 5) == 0)
167 acpi_nvs_nosave();
163 if (strncmp(str, "old_ordering", 12) == 0) 168 if (strncmp(str, "old_ordering", 12) == 0)
164 acpi_old_suspend_ordering(); 169 acpi_old_suspend_ordering();
165 str = strchr(str, ','); 170 str = strchr(str, ',');
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index c02cc692985c..a96489ee6cab 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -921,7 +921,7 @@ void disable_local_APIC(void)
921 unsigned int value; 921 unsigned int value;
922 922
923 /* APIC hasn't been mapped yet */ 923 /* APIC hasn't been mapped yet */
924 if (!apic_phys) 924 if (!x2apic_mode && !apic_phys)
925 return; 925 return;
926 926
927 clear_local_APIC(); 927 clear_local_APIC();
diff --git a/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c
index ce7cde713e71..a36de5bbb622 100644
--- a/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c
+++ b/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c
@@ -368,22 +368,16 @@ static int __init pcc_cpufreq_do_osc(acpi_handle *handle)
368 return -ENODEV; 368 return -ENODEV;
369 369
370 out_obj = output.pointer; 370 out_obj = output.pointer;
371 if (out_obj->type != ACPI_TYPE_BUFFER) { 371 if (out_obj->type != ACPI_TYPE_BUFFER)
372 ret = -ENODEV; 372 return -ENODEV;
373 goto out_free;
374 }
375 373
376 errors = *((u32 *)out_obj->buffer.pointer) & ~(1 << 0); 374 errors = *((u32 *)out_obj->buffer.pointer) & ~(1 << 0);
377 if (errors) { 375 if (errors)
378 ret = -ENODEV; 376 return -ENODEV;
379 goto out_free;
380 }
381 377
382 supported = *((u32 *)(out_obj->buffer.pointer + 4)); 378 supported = *((u32 *)(out_obj->buffer.pointer + 4));
383 if (!(supported & 0x1)) { 379 if (!(supported & 0x1))
384 ret = -ENODEV; 380 return -ENODEV;
385 goto out_free;
386 }
387 381
388out_free: 382out_free:
389 kfree(output.pointer); 383 kfree(output.pointer);
@@ -397,13 +391,17 @@ static int __init pcc_cpufreq_probe(void)
397 struct pcc_memory_resource *mem_resource; 391 struct pcc_memory_resource *mem_resource;
398 struct pcc_register_resource *reg_resource; 392 struct pcc_register_resource *reg_resource;
399 union acpi_object *out_obj, *member; 393 union acpi_object *out_obj, *member;
400 acpi_handle handle, osc_handle; 394 acpi_handle handle, osc_handle, pcch_handle;
401 int ret = 0; 395 int ret = 0;
402 396
403 status = acpi_get_handle(NULL, "\\_SB", &handle); 397 status = acpi_get_handle(NULL, "\\_SB", &handle);
404 if (ACPI_FAILURE(status)) 398 if (ACPI_FAILURE(status))
405 return -ENODEV; 399 return -ENODEV;
406 400
401 status = acpi_get_handle(handle, "PCCH", &pcch_handle);
402 if (ACPI_FAILURE(status))
403 return -ENODEV;
404
407 status = acpi_get_handle(handle, "_OSC", &osc_handle); 405 status = acpi_get_handle(handle, "_OSC", &osc_handle);
408 if (ACPI_SUCCESS(status)) { 406 if (ACPI_SUCCESS(status)) {
409 ret = pcc_cpufreq_do_osc(&osc_handle); 407 ret = pcc_cpufreq_do_osc(&osc_handle);
@@ -543,13 +541,13 @@ static int pcc_cpufreq_cpu_init(struct cpufreq_policy *policy)
543 541
544 if (!pcch_virt_addr) { 542 if (!pcch_virt_addr) {
545 result = -1; 543 result = -1;
546 goto pcch_null; 544 goto out;
547 } 545 }
548 546
549 result = pcc_get_offset(cpu); 547 result = pcc_get_offset(cpu);
550 if (result) { 548 if (result) {
551 dprintk("init: PCCP evaluation failed\n"); 549 dprintk("init: PCCP evaluation failed\n");
552 goto free; 550 goto out;
553 } 551 }
554 552
555 policy->max = policy->cpuinfo.max_freq = 553 policy->max = policy->cpuinfo.max_freq =
@@ -558,14 +556,15 @@ static int pcc_cpufreq_cpu_init(struct cpufreq_policy *policy)
558 ioread32(&pcch_hdr->minimum_frequency) * 1000; 556 ioread32(&pcch_hdr->minimum_frequency) * 1000;
559 policy->cur = pcc_get_freq(cpu); 557 policy->cur = pcc_get_freq(cpu);
560 558
559 if (!policy->cur) {
560 dprintk("init: Unable to get current CPU frequency\n");
561 result = -EINVAL;
562 goto out;
563 }
564
561 dprintk("init: policy->max is %d, policy->min is %d\n", 565 dprintk("init: policy->max is %d, policy->min is %d\n",
562 policy->max, policy->min); 566 policy->max, policy->min);
563 567out:
564 return 0;
565free:
566 pcc_clear_mapping();
567 free_percpu(pcc_cpu_info);
568pcch_null:
569 return result; 568 return result;
570} 569}
571 570
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
index 7ec2123838e6..3e90cce3dc8b 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
@@ -1023,13 +1023,12 @@ static int get_transition_latency(struct powernow_k8_data *data)
1023 } 1023 }
1024 if (max_latency == 0) { 1024 if (max_latency == 0) {
1025 /* 1025 /*
1026 * Fam 11h always returns 0 as transition latency. 1026 * Fam 11h and later may return 0 as transition latency. This
1027 * This is intended and means "very fast". While cpufreq core 1027 * is intended and means "very fast". While cpufreq core and
1028 * and governors currently can handle that gracefully, better 1028 * governors currently can handle that gracefully, better set it
1029 * set it to 1 to avoid problems in the future. 1029 * to 1 to avoid problems in the future.
1030 * For all others it's a BIOS bug.
1031 */ 1030 */
1032 if (boot_cpu_data.x86 != 0x11) 1031 if (boot_cpu_data.x86 < 0x11)
1033 printk(KERN_ERR FW_WARN PFX "Invalid zero transition " 1032 printk(KERN_ERR FW_WARN PFX "Invalid zero transition "
1034 "latency\n"); 1033 "latency\n");
1035 max_latency = 1; 1034 max_latency = 1;
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
index ebdb85cf2686..e5cc7e82e60d 100644
--- a/arch/x86/kernel/early-quirks.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -18,6 +18,7 @@
18#include <asm/apic.h> 18#include <asm/apic.h>
19#include <asm/iommu.h> 19#include <asm/iommu.h>
20#include <asm/gart.h> 20#include <asm/gart.h>
21#include <asm/hpet.h>
21 22
22static void __init fix_hypertransport_config(int num, int slot, int func) 23static void __init fix_hypertransport_config(int num, int slot, int func)
23{ 24{
@@ -191,6 +192,21 @@ static void __init ati_bugs_contd(int num, int slot, int func)
191} 192}
192#endif 193#endif
193 194
195/*
196 * Force the read back of the CMP register in hpet_next_event()
197 * to work around the problem that the CMP register write seems to be
198 * delayed. See hpet_next_event() for details.
199 *
200 * We do this on all SMBUS incarnations for now until we have more
201 * information about the affected chipsets.
202 */
203static void __init ati_hpet_bugs(int num, int slot, int func)
204{
205#ifdef CONFIG_HPET_TIMER
206 hpet_readback_cmp = 1;
207#endif
208}
209
194#define QFLAG_APPLY_ONCE 0x1 210#define QFLAG_APPLY_ONCE 0x1
195#define QFLAG_APPLIED 0x2 211#define QFLAG_APPLIED 0x2
196#define QFLAG_DONE (QFLAG_APPLY_ONCE|QFLAG_APPLIED) 212#define QFLAG_DONE (QFLAG_APPLY_ONCE|QFLAG_APPLIED)
@@ -220,6 +236,8 @@ static struct chipset early_qrk[] __initdata = {
220 PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs }, 236 PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs },
221 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS, 237 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS,
222 PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs_contd }, 238 PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs_contd },
239 { PCI_VENDOR_ID_ATI, PCI_ANY_ID,
240 PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_hpet_bugs },
223 {} 241 {}
224}; 242};
225 243
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 0697ff139837..4db7c4d12ffa 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -571,8 +571,8 @@ auditsys:
571 * masked off. 571 * masked off.
572 */ 572 */
573sysret_audit: 573sysret_audit:
574 movq %rax,%rsi /* second arg, syscall return value */ 574 movq RAX-ARGOFFSET(%rsp),%rsi /* second arg, syscall return value */
575 cmpq $0,%rax /* is it < 0? */ 575 cmpq $0,%rsi /* is it < 0? */
576 setl %al /* 1 if so, 0 if not */ 576 setl %al /* 1 if so, 0 if not */
577 movzbl %al,%edi /* zero-extend that into %edi */ 577 movzbl %al,%edi /* zero-extend that into %edi */
578 inc %edi /* first arg, 0->1(AUDITSC_SUCCESS), 1->2(AUDITSC_FAILURE) */ 578 inc %edi /* first arg, 0->1(AUDITSC_SUCCESS), 1->2(AUDITSC_FAILURE) */
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index a198b7c87a12..ba390d731175 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -964,7 +964,7 @@ fs_initcall(hpet_late_init);
964 964
965void hpet_disable(void) 965void hpet_disable(void)
966{ 966{
967 if (is_hpet_capable()) { 967 if (is_hpet_capable() && hpet_virt_address) {
968 unsigned int cfg = hpet_readl(HPET_CFG); 968 unsigned int cfg = hpet_readl(HPET_CFG);
969 969
970 if (hpet_legacy_int_enabled) { 970 if (hpet_legacy_int_enabled) {
diff --git a/arch/x86/kernel/i8259.c b/arch/x86/kernel/i8259.c
index 7c9f02c130f3..cafa7c80ac95 100644
--- a/arch/x86/kernel/i8259.c
+++ b/arch/x86/kernel/i8259.c
@@ -276,16 +276,6 @@ static struct sys_device device_i8259A = {
276 .cls = &i8259_sysdev_class, 276 .cls = &i8259_sysdev_class,
277}; 277};
278 278
279static int __init i8259A_init_sysfs(void)
280{
281 int error = sysdev_class_register(&i8259_sysdev_class);
282 if (!error)
283 error = sysdev_register(&device_i8259A);
284 return error;
285}
286
287device_initcall(i8259A_init_sysfs);
288
289static void mask_8259A(void) 279static void mask_8259A(void)
290{ 280{
291 unsigned long flags; 281 unsigned long flags;
@@ -407,3 +397,18 @@ struct legacy_pic default_legacy_pic = {
407}; 397};
408 398
409struct legacy_pic *legacy_pic = &default_legacy_pic; 399struct legacy_pic *legacy_pic = &default_legacy_pic;
400
401static int __init i8259A_init_sysfs(void)
402{
403 int error;
404
405 if (legacy_pic != &default_legacy_pic)
406 return 0;
407
408 error = sysdev_class_register(&i8259_sysdev_class);
409 if (!error)
410 error = sysdev_register(&device_i8259A);
411 return error;
412}
413
414device_initcall(i8259A_init_sysfs);
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c
index 4f4af75b9482..01ab17ae2ae7 100644
--- a/arch/x86/kernel/kgdb.c
+++ b/arch/x86/kernel/kgdb.c
@@ -572,7 +572,6 @@ static int __kgdb_notify(struct die_args *args, unsigned long cmd)
572 return NOTIFY_STOP; 572 return NOTIFY_STOP;
573} 573}
574 574
575#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP
576int kgdb_ll_trap(int cmd, const char *str, 575int kgdb_ll_trap(int cmd, const char *str,
577 struct pt_regs *regs, long err, int trap, int sig) 576 struct pt_regs *regs, long err, int trap, int sig)
578{ 577{
@@ -590,7 +589,6 @@ int kgdb_ll_trap(int cmd, const char *str,
590 589
591 return __kgdb_notify(&args, cmd); 590 return __kgdb_notify(&args, cmd);
592} 591}
593#endif /* CONFIG_KGDB_LOW_LEVEL_TRAP */
594 592
595static int 593static int
596kgdb_notify(struct notifier_block *self, unsigned long cmd, void *ptr) 594kgdb_notify(struct notifier_block *self, unsigned long cmd, void *ptr)
@@ -625,6 +623,12 @@ int kgdb_arch_init(void)
625 return register_die_notifier(&kgdb_notifier); 623 return register_die_notifier(&kgdb_notifier);
626} 624}
627 625
626static void kgdb_hw_overflow_handler(struct perf_event *event, int nmi,
627 struct perf_sample_data *data, struct pt_regs *regs)
628{
629 kgdb_ll_trap(DIE_DEBUG, "debug", regs, 0, 0, SIGTRAP);
630}
631
628void kgdb_arch_late(void) 632void kgdb_arch_late(void)
629{ 633{
630 int i, cpu; 634 int i, cpu;
@@ -655,6 +659,7 @@ void kgdb_arch_late(void)
655 for_each_online_cpu(cpu) { 659 for_each_online_cpu(cpu) {
656 pevent = per_cpu_ptr(breakinfo[i].pev, cpu); 660 pevent = per_cpu_ptr(breakinfo[i].pev, cpu);
657 pevent[0]->hw.sample_period = 1; 661 pevent[0]->hw.sample_period = 1;
662 pevent[0]->overflow_handler = kgdb_hw_overflow_handler;
658 if (pevent[0]->destroy != NULL) { 663 if (pevent[0]->destroy != NULL) {
659 pevent[0]->destroy = NULL; 664 pevent[0]->destroy = NULL;
660 release_bp_slot(*pevent); 665 release_bp_slot(*pevent);
diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c
index 345a4b1fe144..675879b65ce6 100644
--- a/arch/x86/kernel/kprobes.c
+++ b/arch/x86/kernel/kprobes.c
@@ -640,8 +640,8 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
640 /* Skip cs, ip, orig_ax and gs. */ \ 640 /* Skip cs, ip, orig_ax and gs. */ \
641 " subl $16, %esp\n" \ 641 " subl $16, %esp\n" \
642 " pushl %fs\n" \ 642 " pushl %fs\n" \
643 " pushl %ds\n" \
644 " pushl %es\n" \ 643 " pushl %es\n" \
644 " pushl %ds\n" \
645 " pushl %eax\n" \ 645 " pushl %eax\n" \
646 " pushl %ebp\n" \ 646 " pushl %ebp\n" \
647 " pushl %edi\n" \ 647 " pushl %edi\n" \
diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c
index e72d3fc6547d..939b9e98245f 100644
--- a/arch/x86/kernel/quirks.c
+++ b/arch/x86/kernel/quirks.c
@@ -498,15 +498,10 @@ void force_hpet_resume(void)
498 * See erratum #27 (Misinterpreted MSI Requests May Result in 498 * See erratum #27 (Misinterpreted MSI Requests May Result in
499 * Corrupted LPC DMA Data) in AMD Publication #46837, 499 * Corrupted LPC DMA Data) in AMD Publication #46837,
500 * "SB700 Family Product Errata", Rev. 1.0, March 2010. 500 * "SB700 Family Product Errata", Rev. 1.0, March 2010.
501 *
502 * Also force the read back of the CMP register in hpet_next_event()
503 * to work around the problem that the CMP register write seems to be
504 * delayed. See hpet_next_event() for details.
505 */ 501 */
506static void force_disable_hpet_msi(struct pci_dev *unused) 502static void force_disable_hpet_msi(struct pci_dev *unused)
507{ 503{
508 hpet_msi_disable = 1; 504 hpet_msi_disable = 1;
509 hpet_readback_cmp = 1;
510} 505}
511 506
512DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS, 507DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS,
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
index de3b63ae3da2..a60df9ae6454 100644
--- a/arch/x86/kernel/setup_percpu.c
+++ b/arch/x86/kernel/setup_percpu.c
@@ -238,6 +238,15 @@ void __init setup_per_cpu_areas(void)
238#ifdef CONFIG_NUMA 238#ifdef CONFIG_NUMA
239 per_cpu(x86_cpu_to_node_map, cpu) = 239 per_cpu(x86_cpu_to_node_map, cpu) =
240 early_per_cpu_map(x86_cpu_to_node_map, cpu); 240 early_per_cpu_map(x86_cpu_to_node_map, cpu);
241 /*
242 * Ensure that the boot cpu numa_node is correct when the boot
243 * cpu is on a node that doesn't have memory installed.
244 * Also cpu_up() will call cpu_to_node() for APs when
245 * MEMORY_HOTPLUG is defined, before per_cpu(numa_node) is set
246 * up later with c_init aka intel_init/amd_init.
247 * So set them all (boot cpu and all APs).
248 */
249 set_cpu_numa_node(cpu, early_cpu_to_node(cpu));
241#endif 250#endif
242#endif 251#endif
243 /* 252 /*
@@ -257,14 +266,6 @@ void __init setup_per_cpu_areas(void)
257 early_per_cpu_ptr(x86_cpu_to_node_map) = NULL; 266 early_per_cpu_ptr(x86_cpu_to_node_map) = NULL;
258#endif 267#endif
259 268
260#if defined(CONFIG_X86_64) && defined(CONFIG_NUMA)
261 /*
262 * make sure boot cpu numa_node is right, when boot cpu is on the
263 * node that doesn't have mem installed
264 */
265 set_cpu_numa_node(boot_cpu_id, early_cpu_to_node(boot_cpu_id));
266#endif
267
268 /* Setup node to cpumask map */ 269 /* Setup node to cpumask map */
269 setup_node_to_cpumask_map(); 270 setup_node_to_cpumask_map();
270 271
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 3699613e8830..b1ed0a1a5913 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -2926,7 +2926,7 @@ static int kvm_mmu_remove_some_alloc_mmu_pages(struct kvm *kvm)
2926 return kvm_mmu_zap_page(kvm, page) + 1; 2926 return kvm_mmu_zap_page(kvm, page) + 1;
2927} 2927}
2928 2928
2929static int mmu_shrink(int nr_to_scan, gfp_t gfp_mask) 2929static int mmu_shrink(struct shrinker *shrink, int nr_to_scan, gfp_t gfp_mask)
2930{ 2930{
2931 struct kvm *kvm; 2931 struct kvm *kvm;
2932 struct kvm *kvm_freed = NULL; 2932 struct kvm *kvm_freed = NULL;
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index 89d66ca4d87c..2331bdc2b549 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -342,6 +342,7 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr,
342 /* advance table_gfn when emulating 1gb pages with 4k */ 342 /* advance table_gfn when emulating 1gb pages with 4k */
343 if (delta == 0) 343 if (delta == 0)
344 table_gfn += PT_INDEX(addr, level); 344 table_gfn += PT_INDEX(addr, level);
345 access &= gw->pte_access;
345 } else { 346 } else {
346 direct = 0; 347 direct = 0;
347 table_gfn = gw->table_gfn[level - 2]; 348 table_gfn = gw->table_gfn[level - 2];
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 05d571f6f196..7fa89c39c64f 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1562,7 +1562,7 @@ static int msr_io(struct kvm_vcpu *vcpu, struct kvm_msrs __user *user_msrs,
1562 1562
1563 r = -ENOMEM; 1563 r = -ENOMEM;
1564 size = sizeof(struct kvm_msr_entry) * msrs.nmsrs; 1564 size = sizeof(struct kvm_msr_entry) * msrs.nmsrs;
1565 entries = vmalloc(size); 1565 entries = kmalloc(size, GFP_KERNEL);
1566 if (!entries) 1566 if (!entries)
1567 goto out; 1567 goto out;
1568 1568
@@ -1581,7 +1581,7 @@ static int msr_io(struct kvm_vcpu *vcpu, struct kvm_msrs __user *user_msrs,
1581 r = n; 1581 r = n;
1582 1582
1583out_free: 1583out_free:
1584 vfree(entries); 1584 kfree(entries);
1585out: 1585out:
1586 return r; 1586 return r;
1587} 1587}
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index 6fdb3ec30c31..55253095be84 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -184,6 +184,7 @@ static void __init pcibios_allocate_resources(int pass)
184 idx, r, disabled, pass); 184 idx, r, disabled, pass);
185 if (pci_claim_resource(dev, idx) < 0) { 185 if (pci_claim_resource(dev, idx) < 0) {
186 /* We'll assign a new address later */ 186 /* We'll assign a new address later */
187 dev->fw_addr[idx] = r->start;
187 r->end -= r->start; 188 r->end -= r->start;
188 r->start = 0; 189 r->start = 0;
189 } 190 }
diff --git a/arch/x86/pci/mrst.c b/arch/x86/pci/mrst.c
index 7ef3a2735df3..cb29191cee58 100644
--- a/arch/x86/pci/mrst.c
+++ b/arch/x86/pci/mrst.c
@@ -66,8 +66,9 @@ static int fixed_bar_cap(struct pci_bus *bus, unsigned int devfn)
66 devfn, pos, 4, &pcie_cap)) 66 devfn, pos, 4, &pcie_cap))
67 return 0; 67 return 0;
68 68
69 if (pcie_cap == 0xffffffff) 69 if (PCI_EXT_CAP_ID(pcie_cap) == 0x0000 ||
70 return 0; 70 PCI_EXT_CAP_ID(pcie_cap) == 0xffff)
71 break;
71 72
72 if (PCI_EXT_CAP_ID(pcie_cap) == PCI_EXT_CAP_ID_VNDR) { 73 if (PCI_EXT_CAP_ID(pcie_cap) == PCI_EXT_CAP_ID_VNDR) {
73 raw_pci_ext_ops->read(pci_domain_nr(bus), bus->number, 74 raw_pci_ext_ops->read(pci_domain_nr(bus), bus->number,
@@ -76,7 +77,7 @@ static int fixed_bar_cap(struct pci_bus *bus, unsigned int devfn)
76 return pos; 77 return pos;
77 } 78 }
78 79
79 pos = pcie_cap >> 20; 80 pos = PCI_EXT_CAP_NEXT(pcie_cap);
80 } 81 }
81 82
82 return 0; 83 return 0;
diff --git a/crypto/ablkcipher.c b/crypto/ablkcipher.c
index 98a66103f4f2..a854df2a5a4b 100644
--- a/crypto/ablkcipher.c
+++ b/crypto/ablkcipher.c
@@ -165,7 +165,7 @@ static inline int ablkcipher_next_slow(struct ablkcipher_request *req,
165 165
166 p = kmalloc(n, GFP_ATOMIC); 166 p = kmalloc(n, GFP_ATOMIC);
167 if (!p) 167 if (!p)
168 ablkcipher_walk_done(req, walk, -ENOMEM); 168 return ablkcipher_walk_done(req, walk, -ENOMEM);
169 169
170 base = p + 1; 170 base = p + 1;
171 171
diff --git a/drivers/acpi/acpica/evxfevnt.c b/drivers/acpi/acpica/evxfevnt.c
index d97b8dce1668..18b3f1468b7d 100644
--- a/drivers/acpi/acpica/evxfevnt.c
+++ b/drivers/acpi/acpica/evxfevnt.c
@@ -70,6 +70,7 @@ acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
70acpi_status acpi_enable(void) 70acpi_status acpi_enable(void)
71{ 71{
72 acpi_status status; 72 acpi_status status;
73 int retry;
73 74
74 ACPI_FUNCTION_TRACE(acpi_enable); 75 ACPI_FUNCTION_TRACE(acpi_enable);
75 76
@@ -98,16 +99,18 @@ acpi_status acpi_enable(void)
98 99
99 /* Sanity check that transition succeeded */ 100 /* Sanity check that transition succeeded */
100 101
101 if (acpi_hw_get_mode() != ACPI_SYS_MODE_ACPI) { 102 for (retry = 0; retry < 30000; ++retry) {
102 ACPI_ERROR((AE_INFO, 103 if (acpi_hw_get_mode() == ACPI_SYS_MODE_ACPI) {
103 "Hardware did not enter ACPI mode")); 104 if (retry != 0)
104 return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE); 105 ACPI_WARNING((AE_INFO,
106 "Platform took > %d00 usec to enter ACPI mode", retry));
107 return_ACPI_STATUS(AE_OK);
108 }
109 acpi_os_stall(100); /* 100 usec */
105 } 110 }
106 111
107 ACPI_DEBUG_PRINT((ACPI_DB_INIT, 112 ACPI_ERROR((AE_INFO, "Hardware did not enter ACPI mode"));
108 "Transition to ACPI mode successful\n")); 113 return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
109
110 return_ACPI_STATUS(AE_OK);
111} 114}
112 115
113ACPI_EXPORT_SYMBOL(acpi_enable) 116ACPI_EXPORT_SYMBOL(acpi_enable)
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 3026e3fa83ef..dc58402b0a17 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -868,9 +868,15 @@ static void acpi_battery_remove_fs(struct acpi_device *device)
868static void acpi_battery_notify(struct acpi_device *device, u32 event) 868static void acpi_battery_notify(struct acpi_device *device, u32 event)
869{ 869{
870 struct acpi_battery *battery = acpi_driver_data(device); 870 struct acpi_battery *battery = acpi_driver_data(device);
871#ifdef CONFIG_ACPI_SYSFS_POWER
872 struct device *old;
873#endif
871 874
872 if (!battery) 875 if (!battery)
873 return; 876 return;
877#ifdef CONFIG_ACPI_SYSFS_POWER
878 old = battery->bat.dev;
879#endif
874 acpi_battery_update(battery); 880 acpi_battery_update(battery);
875 acpi_bus_generate_proc_event(device, event, 881 acpi_bus_generate_proc_event(device, event,
876 acpi_battery_present(battery)); 882 acpi_battery_present(battery));
@@ -879,7 +885,7 @@ static void acpi_battery_notify(struct acpi_device *device, u32 event)
879 acpi_battery_present(battery)); 885 acpi_battery_present(battery));
880#ifdef CONFIG_ACPI_SYSFS_POWER 886#ifdef CONFIG_ACPI_SYSFS_POWER
881 /* acpi_battery_update could remove power_supply object */ 887 /* acpi_battery_update could remove power_supply object */
882 if (battery->bat.dev) 888 if (old && battery->bat.dev)
883 power_supply_changed(&battery->bat); 889 power_supply_changed(&battery->bat);
884#endif 890#endif
885} 891}
diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c
index 01381be05e96..2bb28b9d91c4 100644
--- a/drivers/acpi/blacklist.c
+++ b/drivers/acpi/blacklist.c
@@ -214,7 +214,7 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
214 .ident = "Sony VGN-SR290J", 214 .ident = "Sony VGN-SR290J",
215 .matches = { 215 .matches = {
216 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), 216 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
217 DMI_MATCH(DMI_PRODUCT_NAME, "Sony VGN-SR290J"), 217 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-SR290J"),
218 }, 218 },
219 }, 219 },
220 { 220 {
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 51284351418f..e9699aaed109 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -223,7 +223,7 @@ static bool processor_physically_present(acpi_handle handle)
223 type = (acpi_type == ACPI_TYPE_DEVICE) ? 1 : 0; 223 type = (acpi_type == ACPI_TYPE_DEVICE) ? 1 : 0;
224 cpuid = acpi_get_cpuid(handle, type, acpi_id); 224 cpuid = acpi_get_cpuid(handle, type, acpi_id);
225 225
226 if (cpuid == -1) 226 if ((cpuid == -1) && (num_possible_cpus() > 1))
227 return false; 227 return false;
228 228
229 return true; 229 return true;
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index b1b385692f46..e9a8026d39f0 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -76,14 +76,19 @@ static unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER;
76module_param(max_cstate, uint, 0000); 76module_param(max_cstate, uint, 0000);
77static unsigned int nocst __read_mostly; 77static unsigned int nocst __read_mostly;
78module_param(nocst, uint, 0000); 78module_param(nocst, uint, 0000);
79static int bm_check_disable __read_mostly;
80module_param(bm_check_disable, uint, 0000);
79 81
80static unsigned int latency_factor __read_mostly = 2; 82static unsigned int latency_factor __read_mostly = 2;
81module_param(latency_factor, uint, 0644); 83module_param(latency_factor, uint, 0644);
82 84
85#ifdef CONFIG_ACPI_PROCFS
83static u64 us_to_pm_timer_ticks(s64 t) 86static u64 us_to_pm_timer_ticks(s64 t)
84{ 87{
85 return div64_u64(t * PM_TIMER_FREQUENCY, 1000000); 88 return div64_u64(t * PM_TIMER_FREQUENCY, 1000000);
86} 89}
90#endif
91
87/* 92/*
88 * IBM ThinkPad R40e crashes mysteriously when going into C2 or C3. 93 * IBM ThinkPad R40e crashes mysteriously when going into C2 or C3.
89 * For now disable this. Probably a bug somewhere else. 94 * For now disable this. Probably a bug somewhere else.
@@ -763,6 +768,9 @@ static int acpi_idle_bm_check(void)
763{ 768{
764 u32 bm_status = 0; 769 u32 bm_status = 0;
765 770
771 if (bm_check_disable)
772 return 0;
773
766 acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_STATUS, &bm_status); 774 acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_STATUS, &bm_status);
767 if (bm_status) 775 if (bm_status)
768 acpi_write_bit_register(ACPI_BITREG_BUS_MASTER_STATUS, 1); 776 acpi_write_bit_register(ACPI_BITREG_BUS_MASTER_STATUS, 1);
@@ -947,7 +955,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
947 if (acpi_idle_suspend) 955 if (acpi_idle_suspend)
948 return(acpi_idle_enter_c1(dev, state)); 956 return(acpi_idle_enter_c1(dev, state));
949 957
950 if (acpi_idle_bm_check()) { 958 if (!cx->bm_sts_skip && acpi_idle_bm_check()) {
951 if (dev->safe_state) { 959 if (dev->safe_state) {
952 dev->last_state = dev->safe_state; 960 dev->last_state = dev->safe_state;
953 return dev->safe_state->enter(dev, dev->safe_state); 961 return dev->safe_state->enter(dev, dev->safe_state);
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 5b7c52e4a00f..2862c781b372 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -82,6 +82,20 @@ static int acpi_sleep_prepare(u32 acpi_state)
82static u32 acpi_target_sleep_state = ACPI_STATE_S0; 82static u32 acpi_target_sleep_state = ACPI_STATE_S0;
83 83
84/* 84/*
85 * The ACPI specification wants us to save NVS memory regions during hibernation
86 * and to restore them during the subsequent resume. Windows does that also for
87 * suspend to RAM. However, it is known that this mechanism does not work on
88 * all machines, so we allow the user to disable it with the help of the
89 * 'acpi_sleep=nonvs' kernel command line option.
90 */
91static bool nvs_nosave;
92
93void __init acpi_nvs_nosave(void)
94{
95 nvs_nosave = true;
96}
97
98/*
85 * ACPI 1.0 wants us to execute _PTS before suspending devices, so we allow the 99 * ACPI 1.0 wants us to execute _PTS before suspending devices, so we allow the
86 * user to request that behavior by using the 'acpi_old_suspend_ordering' 100 * user to request that behavior by using the 'acpi_old_suspend_ordering'
87 * kernel command line option that causes the following variable to be set. 101 * kernel command line option that causes the following variable to be set.
@@ -197,8 +211,7 @@ static int acpi_suspend_begin(suspend_state_t pm_state)
197 u32 acpi_state = acpi_suspend_states[pm_state]; 211 u32 acpi_state = acpi_suspend_states[pm_state];
198 int error = 0; 212 int error = 0;
199 213
200 error = suspend_nvs_alloc(); 214 error = nvs_nosave ? 0 : suspend_nvs_alloc();
201
202 if (error) 215 if (error)
203 return error; 216 return error;
204 217
@@ -388,20 +401,6 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
388#endif /* CONFIG_SUSPEND */ 401#endif /* CONFIG_SUSPEND */
389 402
390#ifdef CONFIG_HIBERNATION 403#ifdef CONFIG_HIBERNATION
391/*
392 * The ACPI specification wants us to save NVS memory regions during hibernation
393 * and to restore them during the subsequent resume. However, it is not certain
394 * if this mechanism is going to work on all machines, so we allow the user to
395 * disable this mechanism using the 'acpi_sleep=s4_nonvs' kernel command line
396 * option.
397 */
398static bool s4_no_nvs;
399
400void __init acpi_s4_no_nvs(void)
401{
402 s4_no_nvs = true;
403}
404
405static unsigned long s4_hardware_signature; 404static unsigned long s4_hardware_signature;
406static struct acpi_table_facs *facs; 405static struct acpi_table_facs *facs;
407static bool nosigcheck; 406static bool nosigcheck;
@@ -415,7 +414,7 @@ static int acpi_hibernation_begin(void)
415{ 414{
416 int error; 415 int error;
417 416
418 error = s4_no_nvs ? 0 : suspend_nvs_alloc(); 417 error = nvs_nosave ? 0 : suspend_nvs_alloc();
419 if (!error) { 418 if (!error) {
420 acpi_target_sleep_state = ACPI_STATE_S4; 419 acpi_target_sleep_state = ACPI_STATE_S4;
421 acpi_sleep_tts_switch(acpi_target_sleep_state); 420 acpi_sleep_tts_switch(acpi_target_sleep_state);
@@ -510,7 +509,7 @@ static int acpi_hibernation_begin_old(void)
510 error = acpi_sleep_prepare(ACPI_STATE_S4); 509 error = acpi_sleep_prepare(ACPI_STATE_S4);
511 510
512 if (!error) { 511 if (!error) {
513 if (!s4_no_nvs) 512 if (!nvs_nosave)
514 error = suspend_nvs_alloc(); 513 error = suspend_nvs_alloc();
515 if (!error) 514 if (!error)
516 acpi_target_sleep_state = ACPI_STATE_S4; 515 acpi_target_sleep_state = ACPI_STATE_S4;
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 9630fbdf4e6c..9b9d3bd54e3a 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -673,7 +673,7 @@ static struct kobject *get_device_parent(struct device *dev,
673 */ 673 */
674 if (parent == NULL) 674 if (parent == NULL)
675 parent_kobj = virtual_device_parent(dev); 675 parent_kobj = virtual_device_parent(dev);
676 else if (parent->class) 676 else if (parent->class && !dev->class->ns_type)
677 return &parent->kobj; 677 return &parent->kobj;
678 else 678 else
679 parent_kobj = &parent->kobj; 679 parent_kobj = &parent->kobj;
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
index 9344216183a4..a7547150a705 100644
--- a/drivers/char/agp/intel-gtt.c
+++ b/drivers/char/agp/intel-gtt.c
@@ -1216,17 +1216,20 @@ static int intel_i915_get_gtt_size(void)
1216 1216
1217 /* G33's GTT size defined in gmch_ctrl */ 1217 /* G33's GTT size defined in gmch_ctrl */
1218 pci_read_config_word(agp_bridge->dev, I830_GMCH_CTRL, &gmch_ctrl); 1218 pci_read_config_word(agp_bridge->dev, I830_GMCH_CTRL, &gmch_ctrl);
1219 switch (gmch_ctrl & G33_PGETBL_SIZE_MASK) { 1219 switch (gmch_ctrl & I830_GMCH_GMS_MASK) {
1220 case G33_PGETBL_SIZE_1M: 1220 case I830_GMCH_GMS_STOLEN_512:
1221 size = 512;
1222 break;
1223 case I830_GMCH_GMS_STOLEN_1024:
1221 size = 1024; 1224 size = 1024;
1222 break; 1225 break;
1223 case G33_PGETBL_SIZE_2M: 1226 case I830_GMCH_GMS_STOLEN_8192:
1224 size = 2048; 1227 size = 8*1024;
1225 break; 1228 break;
1226 default: 1229 default:
1227 dev_info(&agp_bridge->dev->dev, 1230 dev_info(&agp_bridge->dev->dev,
1228 "unknown page table size 0x%x, assuming 512KB\n", 1231 "unknown page table size 0x%x, assuming 512KB\n",
1229 (gmch_ctrl & G33_PGETBL_SIZE_MASK)); 1232 (gmch_ctrl & I830_GMCH_GMS_MASK));
1230 size = 512; 1233 size = 512;
1231 } 1234 }
1232 } else { 1235 } else {
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c
index 5d64e3acb000..878ac0c2cc68 100644
--- a/drivers/char/sysrq.c
+++ b/drivers/char/sysrq.c
@@ -493,7 +493,7 @@ static void __sysrq_put_key_op(int key, struct sysrq_key_op *op_p)
493 sysrq_key_table[i] = op_p; 493 sysrq_key_table[i] = op_p;
494} 494}
495 495
496static void __handle_sysrq(int key, struct tty_struct *tty, int check_mask) 496void __handle_sysrq(int key, struct tty_struct *tty, int check_mask)
497{ 497{
498 struct sysrq_key_op *op_p; 498 struct sysrq_key_op *op_p;
499 int orig_log_level; 499 int orig_log_level;
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 24314a9cffe8..1030f8420137 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -623,7 +623,14 @@ static int tpm_tis_pnp_suspend(struct pnp_dev *dev, pm_message_t msg)
623 623
624static int tpm_tis_pnp_resume(struct pnp_dev *dev) 624static int tpm_tis_pnp_resume(struct pnp_dev *dev)
625{ 625{
626 return tpm_pm_resume(&dev->dev); 626 struct tpm_chip *chip = pnp_get_drvdata(dev);
627 int ret;
628
629 ret = tpm_pm_resume(&dev->dev);
630 if (!ret)
631 tpm_continue_selftest(chip);
632
633 return ret;
627} 634}
628 635
629static struct pnp_device_id tpm_pnp_tbl[] __devinitdata = { 636static struct pnp_device_id tpm_pnp_tbl[] __devinitdata = {
diff --git a/drivers/clocksource/cs5535-clockevt.c b/drivers/clocksource/cs5535-clockevt.c
index d7be69f13154..b7dab32ce63c 100644
--- a/drivers/clocksource/cs5535-clockevt.c
+++ b/drivers/clocksource/cs5535-clockevt.c
@@ -194,6 +194,6 @@ err_timer:
194 194
195module_init(cs5535_mfgpt_init); 195module_init(cs5535_mfgpt_init);
196 196
197MODULE_AUTHOR("Andres Salomon <dilinger@collabora.co.uk>"); 197MODULE_AUTHOR("Andres Salomon <dilinger@queued.net>");
198MODULE_DESCRIPTION("CS5535/CS5536 MFGPT clock event driver"); 198MODULE_DESCRIPTION("CS5535/CS5536 MFGPT clock event driver");
199MODULE_LICENSE("GPL"); 199MODULE_LICENSE("GPL");
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 063b2184caf5..938b74ea9ffb 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1077,6 +1077,7 @@ err_out_unregister:
1077 1077
1078err_unlock_policy: 1078err_unlock_policy:
1079 unlock_policy_rwsem_write(cpu); 1079 unlock_policy_rwsem_write(cpu);
1080 free_cpumask_var(policy->related_cpus);
1080err_free_cpumask: 1081err_free_cpumask:
1081 free_cpumask_var(policy->cpus); 1082 free_cpumask_var(policy->cpus);
1082err_free_policy: 1083err_free_policy:
@@ -1762,17 +1763,8 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data,
1762 dprintk("governor switch\n"); 1763 dprintk("governor switch\n");
1763 1764
1764 /* end old governor */ 1765 /* end old governor */
1765 if (data->governor) { 1766 if (data->governor)
1766 /*
1767 * Need to release the rwsem around governor
1768 * stop due to lock dependency between
1769 * cancel_delayed_work_sync and the read lock
1770 * taken in the delayed work handler.
1771 */
1772 unlock_policy_rwsem_write(data->cpu);
1773 __cpufreq_governor(data, CPUFREQ_GOV_STOP); 1767 __cpufreq_governor(data, CPUFREQ_GOV_STOP);
1774 lock_policy_rwsem_write(data->cpu);
1775 }
1776 1768
1777 /* start new governor */ 1769 /* start new governor */
1778 data->governor = policy->governor; 1770 data->governor = policy->governor;
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index 637c105f53d2..bd78acf3c365 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -1183,10 +1183,14 @@ static size_t sg_copy_end_to_buffer(struct scatterlist *sgl, unsigned int nents,
1183 /* Copy part of this segment */ 1183 /* Copy part of this segment */
1184 ignore = skip - offset; 1184 ignore = skip - offset;
1185 len = miter.length - ignore; 1185 len = miter.length - ignore;
1186 if (boffset + len > buflen)
1187 len = buflen - boffset;
1186 memcpy(buf + boffset, miter.addr + ignore, len); 1188 memcpy(buf + boffset, miter.addr + ignore, len);
1187 } else { 1189 } else {
1188 /* Copy all of this segment */ 1190 /* Copy all of this segment (up to buflen) */
1189 len = miter.length; 1191 len = miter.length;
1192 if (boffset + len > buflen)
1193 len = buflen - boffset;
1190 memcpy(buf + boffset, miter.addr, len); 1194 memcpy(buf + boffset, miter.addr, len);
1191 } 1195 }
1192 boffset += len; 1196 boffset += len;
diff --git a/drivers/edac/Kconfig b/drivers/edac/Kconfig
index aedef7941b22..0d2f9dbb47e4 100644
--- a/drivers/edac/Kconfig
+++ b/drivers/edac/Kconfig
@@ -209,7 +209,7 @@ config EDAC_I5100
209 209
210config EDAC_MPC85XX 210config EDAC_MPC85XX
211 tristate "Freescale MPC83xx / MPC85xx" 211 tristate "Freescale MPC83xx / MPC85xx"
212 depends on EDAC_MM_EDAC && FSL_SOC && (PPC_83xx || MPC85xx) 212 depends on EDAC_MM_EDAC && FSL_SOC && (PPC_83xx || PPC_85xx)
213 help 213 help
214 Support for error detection and correction on the Freescale 214 Support for error detection and correction on the Freescale
215 MPC8349, MPC8560, MPC8540, MPC8548 215 MPC8349, MPC8560, MPC8540, MPC8548
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c
index cc9357da0e34..e0187d16dd7c 100644
--- a/drivers/edac/i7core_edac.c
+++ b/drivers/edac/i7core_edac.c
@@ -1300,7 +1300,7 @@ int i7core_get_onedevice(struct pci_dev **prev, int devno,
1300 if (devno == 0) 1300 if (devno == 0)
1301 return -ENODEV; 1301 return -ENODEV;
1302 1302
1303 i7core_printk(KERN_ERR, 1303 i7core_printk(KERN_INFO,
1304 "Device not found: dev %02x.%d PCI ID %04x:%04x\n", 1304 "Device not found: dev %02x.%d PCI ID %04x:%04x\n",
1305 dev_descr->dev, dev_descr->func, 1305 dev_descr->dev, dev_descr->func,
1306 PCI_VENDOR_ID_INTEL, dev_descr->dev_id); 1306 PCI_VENDOR_ID_INTEL, dev_descr->dev_id);
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c
index 52ca09bf4726..1052340e6802 100644
--- a/drivers/edac/mpc85xx_edac.c
+++ b/drivers/edac/mpc85xx_edac.c
@@ -336,6 +336,7 @@ static struct of_device_id mpc85xx_pci_err_of_match[] = {
336 }, 336 },
337 {}, 337 {},
338}; 338};
339MODULE_DEVICE_TABLE(of, mpc85xx_pci_err_of_match);
339 340
340static struct of_platform_driver mpc85xx_pci_err_driver = { 341static struct of_platform_driver mpc85xx_pci_err_driver = {
341 .probe = mpc85xx_pci_err_probe, 342 .probe = mpc85xx_pci_err_probe,
@@ -650,6 +651,7 @@ static struct of_device_id mpc85xx_l2_err_of_match[] = {
650 { .compatible = "fsl,p2020-l2-cache-controller", }, 651 { .compatible = "fsl,p2020-l2-cache-controller", },
651 {}, 652 {},
652}; 653};
654MODULE_DEVICE_TABLE(of, mpc85xx_l2_err_of_match);
653 655
654static struct of_platform_driver mpc85xx_l2_err_driver = { 656static struct of_platform_driver mpc85xx_l2_err_driver = {
655 .probe = mpc85xx_l2_err_probe, 657 .probe = mpc85xx_l2_err_probe,
@@ -1120,11 +1122,13 @@ static struct of_device_id mpc85xx_mc_err_of_match[] = {
1120 { .compatible = "fsl,mpc8555-memory-controller", }, 1122 { .compatible = "fsl,mpc8555-memory-controller", },
1121 { .compatible = "fsl,mpc8560-memory-controller", }, 1123 { .compatible = "fsl,mpc8560-memory-controller", },
1122 { .compatible = "fsl,mpc8568-memory-controller", }, 1124 { .compatible = "fsl,mpc8568-memory-controller", },
1125 { .compatible = "fsl,mpc8569-memory-controller", },
1123 { .compatible = "fsl,mpc8572-memory-controller", }, 1126 { .compatible = "fsl,mpc8572-memory-controller", },
1124 { .compatible = "fsl,mpc8349-memory-controller", }, 1127 { .compatible = "fsl,mpc8349-memory-controller", },
1125 { .compatible = "fsl,p2020-memory-controller", }, 1128 { .compatible = "fsl,p2020-memory-controller", },
1126 {}, 1129 {},
1127}; 1130};
1131MODULE_DEVICE_TABLE(of, mpc85xx_mc_err_of_match);
1128 1132
1129static struct of_platform_driver mpc85xx_mc_err_driver = { 1133static struct of_platform_driver mpc85xx_mc_err_driver = {
1130 .probe = mpc85xx_mc_err_probe, 1134 .probe = mpc85xx_mc_err_probe,
diff --git a/drivers/gpio/cs5535-gpio.c b/drivers/gpio/cs5535-gpio.c
index f73a1555e49d..e23c06893d19 100644
--- a/drivers/gpio/cs5535-gpio.c
+++ b/drivers/gpio/cs5535-gpio.c
@@ -352,6 +352,6 @@ static void __exit cs5535_gpio_exit(void)
352module_init(cs5535_gpio_init); 352module_init(cs5535_gpio_init);
353module_exit(cs5535_gpio_exit); 353module_exit(cs5535_gpio_exit);
354 354
355MODULE_AUTHOR("Andres Salomon <dilinger@collabora.co.uk>"); 355MODULE_AUTHOR("Andres Salomon <dilinger@queued.net>");
356MODULE_DESCRIPTION("AMD CS5535/CS5536 GPIO driver"); 356MODULE_DESCRIPTION("AMD CS5535/CS5536 GPIO driver");
357MODULE_LICENSE("GPL"); 357MODULE_LICENSE("GPL");
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 3ca36542e338..4e51fe3c1fc4 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -893,10 +893,12 @@ EXPORT_SYMBOL_GPL(gpio_sysfs_set_active_low);
893void gpio_unexport(unsigned gpio) 893void gpio_unexport(unsigned gpio)
894{ 894{
895 struct gpio_desc *desc; 895 struct gpio_desc *desc;
896 int status = -EINVAL; 896 int status = 0;
897 897
898 if (!gpio_is_valid(gpio)) 898 if (!gpio_is_valid(gpio)) {
899 status = -EINVAL;
899 goto done; 900 goto done;
901 }
900 902
901 mutex_lock(&sysfs_lock); 903 mutex_lock(&sysfs_lock);
902 904
@@ -911,7 +913,6 @@ void gpio_unexport(unsigned gpio)
911 clear_bit(FLAG_EXPORT, &desc->flags); 913 clear_bit(FLAG_EXPORT, &desc->flags);
912 put_device(dev); 914 put_device(dev);
913 device_unregister(dev); 915 device_unregister(dev);
914 status = 0;
915 } else 916 } else
916 status = -ENODEV; 917 status = -ENODEV;
917 } 918 }
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index aee83fa178f6..9214119c0154 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -605,6 +605,9 @@ static int i915_fbc_status(struct seq_file *m, void *unused)
605 case FBC_NOT_TILED: 605 case FBC_NOT_TILED:
606 seq_printf(m, "scanout buffer not tiled"); 606 seq_printf(m, "scanout buffer not tiled");
607 break; 607 break;
608 case FBC_MULTIPLE_PIPES:
609 seq_printf(m, "multiple pipes are enabled");
610 break;
608 default: 611 default:
609 seq_printf(m, "unknown reason"); 612 seq_printf(m, "unknown reason");
610 } 613 }
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index f00c5ae9556c..2305a1234f1e 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1300,7 +1300,7 @@ static void i915_cleanup_compression(struct drm_device *dev)
1300 struct drm_i915_private *dev_priv = dev->dev_private; 1300 struct drm_i915_private *dev_priv = dev->dev_private;
1301 1301
1302 drm_mm_put_block(dev_priv->compressed_fb); 1302 drm_mm_put_block(dev_priv->compressed_fb);
1303 if (!IS_GM45(dev)) 1303 if (dev_priv->compressed_llb)
1304 drm_mm_put_block(dev_priv->compressed_llb); 1304 drm_mm_put_block(dev_priv->compressed_llb);
1305} 1305}
1306 1306
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index d147ab2f5bfc..2e1744d37ad5 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -215,6 +215,7 @@ enum no_fbc_reason {
215 FBC_MODE_TOO_LARGE, /* mode too large for compression */ 215 FBC_MODE_TOO_LARGE, /* mode too large for compression */
216 FBC_BAD_PLANE, /* fbc not supported on plane */ 216 FBC_BAD_PLANE, /* fbc not supported on plane */
217 FBC_NOT_TILED, /* buffer not tiled */ 217 FBC_NOT_TILED, /* buffer not tiled */
218 FBC_MULTIPLE_PIPES, /* more than one pipe active */
218}; 219};
219 220
220enum intel_pch { 221enum intel_pch {
@@ -222,6 +223,8 @@ enum intel_pch {
222 PCH_CPT, /* Cougarpoint PCH */ 223 PCH_CPT, /* Cougarpoint PCH */
223}; 224};
224 225
226#define QUIRK_PIPEA_FORCE (1<<0)
227
225struct intel_fbdev; 228struct intel_fbdev;
226 229
227typedef struct drm_i915_private { 230typedef struct drm_i915_private {
@@ -337,6 +340,8 @@ typedef struct drm_i915_private {
337 /* PCH chipset type */ 340 /* PCH chipset type */
338 enum intel_pch pch_type; 341 enum intel_pch pch_type;
339 342
343 unsigned long quirks;
344
340 /* Register state */ 345 /* Register state */
341 bool modeset_on_lid; 346 bool modeset_on_lid;
342 u8 saveLBB; 347 u8 saveLBB;
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 074385882ccf..5aa747fc25a9 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2241,6 +2241,7 @@ i915_gem_object_get_pages(struct drm_gem_object *obj,
2241 page = read_cache_page_gfp(mapping, i, 2241 page = read_cache_page_gfp(mapping, i,
2242 GFP_HIGHUSER | 2242 GFP_HIGHUSER |
2243 __GFP_COLD | 2243 __GFP_COLD |
2244 __GFP_RECLAIMABLE |
2244 gfpmask); 2245 gfpmask);
2245 if (IS_ERR(page)) 2246 if (IS_ERR(page))
2246 goto err_pages; 2247 goto err_pages;
@@ -3646,6 +3647,7 @@ i915_gem_wait_for_pending_flip(struct drm_device *dev,
3646 return ret; 3647 return ret;
3647} 3648}
3648 3649
3650
3649int 3651int
3650i915_gem_do_execbuffer(struct drm_device *dev, void *data, 3652i915_gem_do_execbuffer(struct drm_device *dev, void *data,
3651 struct drm_file *file_priv, 3653 struct drm_file *file_priv,
@@ -3793,7 +3795,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
3793 unsigned long long total_size = 0; 3795 unsigned long long total_size = 0;
3794 int num_fences = 0; 3796 int num_fences = 0;
3795 for (i = 0; i < args->buffer_count; i++) { 3797 for (i = 0; i < args->buffer_count; i++) {
3796 obj_priv = object_list[i]->driver_private; 3798 obj_priv = to_intel_bo(object_list[i]);
3797 3799
3798 total_size += object_list[i]->size; 3800 total_size += object_list[i]->size;
3799 num_fences += 3801 num_fences +=
@@ -4741,6 +4743,16 @@ i915_gem_load(struct drm_device *dev)
4741 list_add(&dev_priv->mm.shrink_list, &shrink_list); 4743 list_add(&dev_priv->mm.shrink_list, &shrink_list);
4742 spin_unlock(&shrink_list_lock); 4744 spin_unlock(&shrink_list_lock);
4743 4745
4746 /* On GEN3 we really need to make sure the ARB C3 LP bit is set */
4747 if (IS_GEN3(dev)) {
4748 u32 tmp = I915_READ(MI_ARB_STATE);
4749 if (!(tmp & MI_ARB_C3_LP_WRITE_ENABLE)) {
4750 /* arb state is a masked write, so set bit + bit in mask */
4751 tmp = MI_ARB_C3_LP_WRITE_ENABLE | (MI_ARB_C3_LP_WRITE_ENABLE << MI_ARB_MASK_SHIFT);
4752 I915_WRITE(MI_ARB_STATE, tmp);
4753 }
4754 }
4755
4744 /* Old X drivers will take 0-2 for front, back, depth buffers */ 4756 /* Old X drivers will take 0-2 for front, back, depth buffers */
4745 if (!drm_core_check_feature(dev, DRIVER_MODESET)) 4757 if (!drm_core_check_feature(dev, DRIVER_MODESET))
4746 dev_priv->fence_reg_start = 3; 4758 dev_priv->fence_reg_start = 3;
@@ -4977,7 +4989,7 @@ i915_gpu_is_active(struct drm_device *dev)
4977} 4989}
4978 4990
4979static int 4991static int
4980i915_gem_shrink(int nr_to_scan, gfp_t gfp_mask) 4992i915_gem_shrink(struct shrinker *shrink, int nr_to_scan, gfp_t gfp_mask)
4981{ 4993{
4982 drm_i915_private_t *dev_priv, *next_dev; 4994 drm_i915_private_t *dev_priv, *next_dev;
4983 struct drm_i915_gem_object *obj_priv, *next_obj; 4995 struct drm_i915_gem_object *obj_priv, *next_obj;
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 150400f40534..cf41c672defe 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -359,6 +359,70 @@
359#define LM_BURST_LENGTH 0x00000700 359#define LM_BURST_LENGTH 0x00000700
360#define LM_FIFO_WATERMARK 0x0000001F 360#define LM_FIFO_WATERMARK 0x0000001F
361#define MI_ARB_STATE 0x020e4 /* 915+ only */ 361#define MI_ARB_STATE 0x020e4 /* 915+ only */
362#define MI_ARB_MASK_SHIFT 16 /* shift for enable bits */
363
364/* Make render/texture TLB fetches lower priorty than associated data
365 * fetches. This is not turned on by default
366 */
367#define MI_ARB_RENDER_TLB_LOW_PRIORITY (1 << 15)
368
369/* Isoch request wait on GTT enable (Display A/B/C streams).
370 * Make isoch requests stall on the TLB update. May cause
371 * display underruns (test mode only)
372 */
373#define MI_ARB_ISOCH_WAIT_GTT (1 << 14)
374
375/* Block grant count for isoch requests when block count is
376 * set to a finite value.
377 */
378#define MI_ARB_BLOCK_GRANT_MASK (3 << 12)
379#define MI_ARB_BLOCK_GRANT_8 (0 << 12) /* for 3 display planes */
380#define MI_ARB_BLOCK_GRANT_4 (1 << 12) /* for 2 display planes */
381#define MI_ARB_BLOCK_GRANT_2 (2 << 12) /* for 1 display plane */
382#define MI_ARB_BLOCK_GRANT_0 (3 << 12) /* don't use */
383
384/* Enable render writes to complete in C2/C3/C4 power states.
385 * If this isn't enabled, render writes are prevented in low
386 * power states. That seems bad to me.
387 */
388#define MI_ARB_C3_LP_WRITE_ENABLE (1 << 11)
389
390/* This acknowledges an async flip immediately instead
391 * of waiting for 2TLB fetches.
392 */
393#define MI_ARB_ASYNC_FLIP_ACK_IMMEDIATE (1 << 10)
394
395/* Enables non-sequential data reads through arbiter
396 */
397#define MI_ARB_DUAL_DATA_PHASE_DISABLE (1 << 9)
398
399/* Disable FSB snooping of cacheable write cycles from binner/render
400 * command stream
401 */
402#define MI_ARB_CACHE_SNOOP_DISABLE (1 << 8)
403
404/* Arbiter time slice for non-isoch streams */
405#define MI_ARB_TIME_SLICE_MASK (7 << 5)
406#define MI_ARB_TIME_SLICE_1 (0 << 5)
407#define MI_ARB_TIME_SLICE_2 (1 << 5)
408#define MI_ARB_TIME_SLICE_4 (2 << 5)
409#define MI_ARB_TIME_SLICE_6 (3 << 5)
410#define MI_ARB_TIME_SLICE_8 (4 << 5)
411#define MI_ARB_TIME_SLICE_10 (5 << 5)
412#define MI_ARB_TIME_SLICE_14 (6 << 5)
413#define MI_ARB_TIME_SLICE_16 (7 << 5)
414
415/* Low priority grace period page size */
416#define MI_ARB_LOW_PRIORITY_GRACE_4KB (0 << 4) /* default */
417#define MI_ARB_LOW_PRIORITY_GRACE_8KB (1 << 4)
418
419/* Disable display A/B trickle feed */
420#define MI_ARB_DISPLAY_TRICKLE_FEED_DISABLE (1 << 2)
421
422/* Set display plane priority */
423#define MI_ARB_DISPLAY_PRIORITY_A_B (0 << 0) /* display A > display B */
424#define MI_ARB_DISPLAY_PRIORITY_B_A (1 << 0) /* display B > display A */
425
362#define CACHE_MODE_0 0x02120 /* 915+ only */ 426#define CACHE_MODE_0 0x02120 /* 915+ only */
363#define CM0_MASK_SHIFT 16 427#define CM0_MASK_SHIFT 16
364#define CM0_IZ_OPT_DISABLE (1<<6) 428#define CM0_IZ_OPT_DISABLE (1<<6)
@@ -2805,6 +2869,7 @@
2805 2869
2806#define PCH_PP_STATUS 0xc7200 2870#define PCH_PP_STATUS 0xc7200
2807#define PCH_PP_CONTROL 0xc7204 2871#define PCH_PP_CONTROL 0xc7204
2872#define PANEL_UNLOCK_REGS (0xabcd << 16)
2808#define EDP_FORCE_VDD (1 << 3) 2873#define EDP_FORCE_VDD (1 << 3)
2809#define EDP_BLC_ENABLE (1 << 2) 2874#define EDP_BLC_ENABLE (1 << 2)
2810#define PANEL_POWER_RESET (1 << 1) 2875#define PANEL_POWER_RESET (1 << 1)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 68dcf36e2793..5e21b3119824 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -862,8 +862,8 @@ intel_g4x_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc,
862 intel_clock_t clock; 862 intel_clock_t clock;
863 int max_n; 863 int max_n;
864 bool found; 864 bool found;
865 /* approximately equals target * 0.00488 */ 865 /* approximately equals target * 0.00585 */
866 int err_most = (target >> 8) + (target >> 10); 866 int err_most = (target >> 8) + (target >> 9);
867 found = false; 867 found = false;
868 868
869 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) { 869 if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
@@ -1180,8 +1180,12 @@ static void intel_update_fbc(struct drm_crtc *crtc,
1180 struct drm_framebuffer *fb = crtc->fb; 1180 struct drm_framebuffer *fb = crtc->fb;
1181 struct intel_framebuffer *intel_fb; 1181 struct intel_framebuffer *intel_fb;
1182 struct drm_i915_gem_object *obj_priv; 1182 struct drm_i915_gem_object *obj_priv;
1183 struct drm_crtc *tmp_crtc;
1183 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 1184 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
1184 int plane = intel_crtc->plane; 1185 int plane = intel_crtc->plane;
1186 int crtcs_enabled = 0;
1187
1188 DRM_DEBUG_KMS("\n");
1185 1189
1186 if (!i915_powersave) 1190 if (!i915_powersave)
1187 return; 1191 return;
@@ -1199,10 +1203,21 @@ static void intel_update_fbc(struct drm_crtc *crtc,
1199 * If FBC is already on, we just have to verify that we can 1203 * If FBC is already on, we just have to verify that we can
1200 * keep it that way... 1204 * keep it that way...
1201 * Need to disable if: 1205 * Need to disable if:
1206 * - more than one pipe is active
1202 * - changing FBC params (stride, fence, mode) 1207 * - changing FBC params (stride, fence, mode)
1203 * - new fb is too large to fit in compressed buffer 1208 * - new fb is too large to fit in compressed buffer
1204 * - going to an unsupported config (interlace, pixel multiply, etc.) 1209 * - going to an unsupported config (interlace, pixel multiply, etc.)
1205 */ 1210 */
1211 list_for_each_entry(tmp_crtc, &dev->mode_config.crtc_list, head) {
1212 if (tmp_crtc->enabled)
1213 crtcs_enabled++;
1214 }
1215 DRM_DEBUG_KMS("%d pipes active\n", crtcs_enabled);
1216 if (crtcs_enabled > 1) {
1217 DRM_DEBUG_KMS("more than one pipe active, disabling compression\n");
1218 dev_priv->no_fbc_reason = FBC_MULTIPLE_PIPES;
1219 goto out_disable;
1220 }
1206 if (intel_fb->obj->size > dev_priv->cfb_size) { 1221 if (intel_fb->obj->size > dev_priv->cfb_size) {
1207 DRM_DEBUG_KMS("framebuffer too large, disabling " 1222 DRM_DEBUG_KMS("framebuffer too large, disabling "
1208 "compression\n"); 1223 "compression\n");
@@ -1255,7 +1270,7 @@ out_disable:
1255 } 1270 }
1256} 1271}
1257 1272
1258static int 1273int
1259intel_pin_and_fence_fb_obj(struct drm_device *dev, struct drm_gem_object *obj) 1274intel_pin_and_fence_fb_obj(struct drm_device *dev, struct drm_gem_object *obj)
1260{ 1275{
1261 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj); 1276 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
@@ -2255,6 +2270,11 @@ static void i9xx_crtc_dpms(struct drm_crtc *crtc, int mode)
2255 intel_wait_for_vblank(dev); 2270 intel_wait_for_vblank(dev);
2256 } 2271 }
2257 2272
2273 /* Don't disable pipe A or pipe A PLLs if needed */
2274 if (pipeconf_reg == PIPEACONF &&
2275 (dev_priv->quirks & QUIRK_PIPEA_FORCE))
2276 goto skip_pipe_off;
2277
2258 /* Next, disable display pipes */ 2278 /* Next, disable display pipes */
2259 temp = I915_READ(pipeconf_reg); 2279 temp = I915_READ(pipeconf_reg);
2260 if ((temp & PIPEACONF_ENABLE) != 0) { 2280 if ((temp & PIPEACONF_ENABLE) != 0) {
@@ -2270,7 +2290,7 @@ static void i9xx_crtc_dpms(struct drm_crtc *crtc, int mode)
2270 I915_WRITE(dpll_reg, temp & ~DPLL_VCO_ENABLE); 2290 I915_WRITE(dpll_reg, temp & ~DPLL_VCO_ENABLE);
2271 I915_READ(dpll_reg); 2291 I915_READ(dpll_reg);
2272 } 2292 }
2273 2293 skip_pipe_off:
2274 /* Wait for the clocks to turn off. */ 2294 /* Wait for the clocks to turn off. */
2275 udelay(150); 2295 udelay(150);
2276 break; 2296 break;
@@ -2356,8 +2376,6 @@ static bool intel_crtc_mode_fixup(struct drm_crtc *crtc,
2356 if (mode->clock * 3 > 27000 * 4) 2376 if (mode->clock * 3 > 27000 * 4)
2357 return MODE_CLOCK_HIGH; 2377 return MODE_CLOCK_HIGH;
2358 } 2378 }
2359
2360 drm_mode_set_crtcinfo(adjusted_mode, 0);
2361 return true; 2379 return true;
2362} 2380}
2363 2381
@@ -3736,6 +3754,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
3736 if (dev_priv->lvds_dither) { 3754 if (dev_priv->lvds_dither) {
3737 if (HAS_PCH_SPLIT(dev)) { 3755 if (HAS_PCH_SPLIT(dev)) {
3738 pipeconf |= PIPE_ENABLE_DITHER; 3756 pipeconf |= PIPE_ENABLE_DITHER;
3757 pipeconf &= ~PIPE_DITHER_TYPE_MASK;
3739 pipeconf |= PIPE_DITHER_TYPE_ST01; 3758 pipeconf |= PIPE_DITHER_TYPE_ST01;
3740 } else 3759 } else
3741 lvds |= LVDS_ENABLE_DITHER; 3760 lvds |= LVDS_ENABLE_DITHER;
@@ -4412,7 +4431,8 @@ static void intel_increase_pllclock(struct drm_crtc *crtc, bool schedule)
4412 DRM_DEBUG_DRIVER("upclocking LVDS\n"); 4431 DRM_DEBUG_DRIVER("upclocking LVDS\n");
4413 4432
4414 /* Unlock panel regs */ 4433 /* Unlock panel regs */
4415 I915_WRITE(PP_CONTROL, I915_READ(PP_CONTROL) | (0xabcd << 16)); 4434 I915_WRITE(PP_CONTROL, I915_READ(PP_CONTROL) |
4435 PANEL_UNLOCK_REGS);
4416 4436
4417 dpll &= ~DISPLAY_RATE_SELECT_FPA1; 4437 dpll &= ~DISPLAY_RATE_SELECT_FPA1;
4418 I915_WRITE(dpll_reg, dpll); 4438 I915_WRITE(dpll_reg, dpll);
@@ -4455,7 +4475,8 @@ static void intel_decrease_pllclock(struct drm_crtc *crtc)
4455 DRM_DEBUG_DRIVER("downclocking LVDS\n"); 4475 DRM_DEBUG_DRIVER("downclocking LVDS\n");
4456 4476
4457 /* Unlock panel regs */ 4477 /* Unlock panel regs */
4458 I915_WRITE(PP_CONTROL, I915_READ(PP_CONTROL) | (0xabcd << 16)); 4478 I915_WRITE(PP_CONTROL, I915_READ(PP_CONTROL) |
4479 PANEL_UNLOCK_REGS);
4459 4480
4460 dpll |= DISPLAY_RATE_SELECT_FPA1; 4481 dpll |= DISPLAY_RATE_SELECT_FPA1;
4461 I915_WRITE(dpll_reg, dpll); 4482 I915_WRITE(dpll_reg, dpll);
@@ -4695,7 +4716,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
4695 struct drm_gem_object *obj; 4716 struct drm_gem_object *obj;
4696 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 4717 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
4697 struct intel_unpin_work *work; 4718 struct intel_unpin_work *work;
4698 unsigned long flags; 4719 unsigned long flags, offset;
4699 int pipesrc_reg = (intel_crtc->pipe == 0) ? PIPEASRC : PIPEBSRC; 4720 int pipesrc_reg = (intel_crtc->pipe == 0) ? PIPEASRC : PIPEBSRC;
4700 int ret, pipesrc; 4721 int ret, pipesrc;
4701 u32 flip_mask; 4722 u32 flip_mask;
@@ -4762,19 +4783,23 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
4762 while (I915_READ(ISR) & flip_mask) 4783 while (I915_READ(ISR) & flip_mask)
4763 ; 4784 ;
4764 4785
4786 /* Offset into the new buffer for cases of shared fbs between CRTCs */
4787 offset = obj_priv->gtt_offset;
4788 offset += (crtc->y * fb->pitch) + (crtc->x * (fb->bits_per_pixel) / 8);
4789
4765 BEGIN_LP_RING(4); 4790 BEGIN_LP_RING(4);
4766 if (IS_I965G(dev)) { 4791 if (IS_I965G(dev)) {
4767 OUT_RING(MI_DISPLAY_FLIP | 4792 OUT_RING(MI_DISPLAY_FLIP |
4768 MI_DISPLAY_FLIP_PLANE(intel_crtc->plane)); 4793 MI_DISPLAY_FLIP_PLANE(intel_crtc->plane));
4769 OUT_RING(fb->pitch); 4794 OUT_RING(fb->pitch);
4770 OUT_RING(obj_priv->gtt_offset | obj_priv->tiling_mode); 4795 OUT_RING(offset | obj_priv->tiling_mode);
4771 pipesrc = I915_READ(pipesrc_reg); 4796 pipesrc = I915_READ(pipesrc_reg);
4772 OUT_RING(pipesrc & 0x0fff0fff); 4797 OUT_RING(pipesrc & 0x0fff0fff);
4773 } else { 4798 } else {
4774 OUT_RING(MI_DISPLAY_FLIP_I915 | 4799 OUT_RING(MI_DISPLAY_FLIP_I915 |
4775 MI_DISPLAY_FLIP_PLANE(intel_crtc->plane)); 4800 MI_DISPLAY_FLIP_PLANE(intel_crtc->plane));
4776 OUT_RING(fb->pitch); 4801 OUT_RING(fb->pitch);
4777 OUT_RING(obj_priv->gtt_offset); 4802 OUT_RING(offset);
4778 OUT_RING(MI_NOOP); 4803 OUT_RING(MI_NOOP);
4779 } 4804 }
4780 ADVANCE_LP_RING(); 4805 ADVANCE_LP_RING();
@@ -5506,6 +5531,66 @@ static void intel_init_display(struct drm_device *dev)
5506 } 5531 }
5507} 5532}
5508 5533
5534/*
5535 * Some BIOSes insist on assuming the GPU's pipe A is enabled at suspend,
5536 * resume, or other times. This quirk makes sure that's the case for
5537 * affected systems.
5538 */
5539static void quirk_pipea_force (struct drm_device *dev)
5540{
5541 struct drm_i915_private *dev_priv = dev->dev_private;
5542
5543 dev_priv->quirks |= QUIRK_PIPEA_FORCE;
5544 DRM_DEBUG_DRIVER("applying pipe a force quirk\n");
5545}
5546
5547struct intel_quirk {
5548 int device;
5549 int subsystem_vendor;
5550 int subsystem_device;
5551 void (*hook)(struct drm_device *dev);
5552};
5553
5554struct intel_quirk intel_quirks[] = {
5555 /* HP Compaq 2730p needs pipe A force quirk (LP: #291555) */
5556 { 0x2a42, 0x103c, 0x30eb, quirk_pipea_force },
5557 /* HP Mini needs pipe A force quirk (LP: #322104) */
5558 { 0x27ae,0x103c, 0x361a, quirk_pipea_force },
5559
5560 /* Thinkpad R31 needs pipe A force quirk */
5561 { 0x3577, 0x1014, 0x0505, quirk_pipea_force },
5562 /* Toshiba Protege R-205, S-209 needs pipe A force quirk */
5563 { 0x2592, 0x1179, 0x0001, quirk_pipea_force },
5564
5565 /* ThinkPad X30 needs pipe A force quirk (LP: #304614) */
5566 { 0x3577, 0x1014, 0x0513, quirk_pipea_force },
5567 /* ThinkPad X40 needs pipe A force quirk */
5568
5569 /* ThinkPad T60 needs pipe A force quirk (bug #16494) */
5570 { 0x2782, 0x17aa, 0x201a, quirk_pipea_force },
5571
5572 /* 855 & before need to leave pipe A & dpll A up */
5573 { 0x3582, PCI_ANY_ID, PCI_ANY_ID, quirk_pipea_force },
5574 { 0x2562, PCI_ANY_ID, PCI_ANY_ID, quirk_pipea_force },
5575};
5576
5577static void intel_init_quirks(struct drm_device *dev)
5578{
5579 struct pci_dev *d = dev->pdev;
5580 int i;
5581
5582 for (i = 0; i < ARRAY_SIZE(intel_quirks); i++) {
5583 struct intel_quirk *q = &intel_quirks[i];
5584
5585 if (d->device == q->device &&
5586 (d->subsystem_vendor == q->subsystem_vendor ||
5587 q->subsystem_vendor == PCI_ANY_ID) &&
5588 (d->subsystem_device == q->subsystem_device ||
5589 q->subsystem_device == PCI_ANY_ID))
5590 q->hook(dev);
5591 }
5592}
5593
5509void intel_modeset_init(struct drm_device *dev) 5594void intel_modeset_init(struct drm_device *dev)
5510{ 5595{
5511 struct drm_i915_private *dev_priv = dev->dev_private; 5596 struct drm_i915_private *dev_priv = dev->dev_private;
@@ -5518,6 +5603,8 @@ void intel_modeset_init(struct drm_device *dev)
5518 5603
5519 dev->mode_config.funcs = (void *)&intel_mode_funcs; 5604 dev->mode_config.funcs = (void *)&intel_mode_funcs;
5520 5605
5606 intel_init_quirks(dev);
5607
5521 intel_init_display(dev); 5608 intel_init_display(dev);
5522 5609
5523 if (IS_I965G(dev)) { 5610 if (IS_I965G(dev)) {
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 1aac59e83bff..5dde80f9e652 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -717,6 +717,51 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
717 } 717 }
718} 718}
719 719
720static void ironlake_edp_panel_on (struct drm_device *dev)
721{
722 struct drm_i915_private *dev_priv = dev->dev_private;
723 unsigned long timeout = jiffies + msecs_to_jiffies(5000);
724 u32 pp, pp_status;
725
726 pp_status = I915_READ(PCH_PP_STATUS);
727 if (pp_status & PP_ON)
728 return;
729
730 pp = I915_READ(PCH_PP_CONTROL);
731 pp |= PANEL_UNLOCK_REGS | POWER_TARGET_ON;
732 I915_WRITE(PCH_PP_CONTROL, pp);
733 do {
734 pp_status = I915_READ(PCH_PP_STATUS);
735 } while (((pp_status & PP_ON) == 0) && !time_after(jiffies, timeout));
736
737 if (time_after(jiffies, timeout))
738 DRM_DEBUG_KMS("panel on wait timed out: 0x%08x\n", pp_status);
739
740 pp &= ~(PANEL_UNLOCK_REGS | EDP_FORCE_VDD);
741 I915_WRITE(PCH_PP_CONTROL, pp);
742}
743
744static void ironlake_edp_panel_off (struct drm_device *dev)
745{
746 struct drm_i915_private *dev_priv = dev->dev_private;
747 unsigned long timeout = jiffies + msecs_to_jiffies(5000);
748 u32 pp, pp_status;
749
750 pp = I915_READ(PCH_PP_CONTROL);
751 pp &= ~POWER_TARGET_ON;
752 I915_WRITE(PCH_PP_CONTROL, pp);
753 do {
754 pp_status = I915_READ(PCH_PP_STATUS);
755 } while ((pp_status & PP_ON) && !time_after(jiffies, timeout));
756
757 if (time_after(jiffies, timeout))
758 DRM_DEBUG_KMS("panel off wait timed out\n");
759
760 /* Make sure VDD is enabled so DP AUX will work */
761 pp |= EDP_FORCE_VDD;
762 I915_WRITE(PCH_PP_CONTROL, pp);
763}
764
720static void ironlake_edp_backlight_on (struct drm_device *dev) 765static void ironlake_edp_backlight_on (struct drm_device *dev)
721{ 766{
722 struct drm_i915_private *dev_priv = dev->dev_private; 767 struct drm_i915_private *dev_priv = dev->dev_private;
@@ -751,14 +796,18 @@ intel_dp_dpms(struct drm_encoder *encoder, int mode)
751 if (mode != DRM_MODE_DPMS_ON) { 796 if (mode != DRM_MODE_DPMS_ON) {
752 if (dp_reg & DP_PORT_EN) { 797 if (dp_reg & DP_PORT_EN) {
753 intel_dp_link_down(intel_encoder, dp_priv->DP); 798 intel_dp_link_down(intel_encoder, dp_priv->DP);
754 if (IS_eDP(intel_encoder)) 799 if (IS_eDP(intel_encoder)) {
755 ironlake_edp_backlight_off(dev); 800 ironlake_edp_backlight_off(dev);
801 ironlake_edp_panel_off(dev);
802 }
756 } 803 }
757 } else { 804 } else {
758 if (!(dp_reg & DP_PORT_EN)) { 805 if (!(dp_reg & DP_PORT_EN)) {
759 intel_dp_link_train(intel_encoder, dp_priv->DP, dp_priv->link_configuration); 806 intel_dp_link_train(intel_encoder, dp_priv->DP, dp_priv->link_configuration);
760 if (IS_eDP(intel_encoder)) 807 if (IS_eDP(intel_encoder)) {
808 ironlake_edp_panel_on(dev);
761 ironlake_edp_backlight_on(dev); 809 ironlake_edp_backlight_on(dev);
810 }
762 } 811 }
763 } 812 }
764 dp_priv->dpms_mode = mode; 813 dp_priv->dpms_mode = mode;
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 72206f37c4fb..2f7970be9051 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -215,6 +215,9 @@ extern void intel_init_clock_gating(struct drm_device *dev);
215extern void ironlake_enable_drps(struct drm_device *dev); 215extern void ironlake_enable_drps(struct drm_device *dev);
216extern void ironlake_disable_drps(struct drm_device *dev); 216extern void ironlake_disable_drps(struct drm_device *dev);
217 217
218extern int intel_pin_and_fence_fb_obj(struct drm_device *dev,
219 struct drm_gem_object *obj);
220
218extern int intel_framebuffer_init(struct drm_device *dev, 221extern int intel_framebuffer_init(struct drm_device *dev,
219 struct intel_framebuffer *ifb, 222 struct intel_framebuffer *ifb,
220 struct drm_mode_fb_cmd *mode_cmd, 223 struct drm_mode_fb_cmd *mode_cmd,
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index c3c505244e07..3e18c9e7729b 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -98,7 +98,7 @@ static int intelfb_create(struct intel_fbdev *ifbdev,
98 98
99 mutex_lock(&dev->struct_mutex); 99 mutex_lock(&dev->struct_mutex);
100 100
101 ret = i915_gem_object_pin(fbo, 64*1024); 101 ret = intel_pin_and_fence_fb_obj(dev, fbo);
102 if (ret) { 102 if (ret) {
103 DRM_ERROR("failed to pin fb: %d\n", ret); 103 DRM_ERROR("failed to pin fb: %d\n", ret);
104 goto out_unref; 104 goto out_unref;
@@ -236,7 +236,7 @@ int intel_fbdev_destroy(struct drm_device *dev,
236 236
237 drm_framebuffer_cleanup(&ifb->base); 237 drm_framebuffer_cleanup(&ifb->base);
238 if (ifb->obj) 238 if (ifb->obj)
239 drm_gem_object_unreference_unlocked(ifb->obj); 239 drm_gem_object_unreference(ifb->obj);
240 240
241 return 0; 241 return 0;
242} 242}
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 31df55f0a0a7..0eab8df5bf7e 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -599,6 +599,26 @@ static int intel_lvds_get_modes(struct drm_connector *connector)
599 return 0; 599 return 0;
600} 600}
601 601
602static int intel_no_modeset_on_lid_dmi_callback(const struct dmi_system_id *id)
603{
604 DRM_DEBUG_KMS("Skipping forced modeset for %s\n", id->ident);
605 return 1;
606}
607
608/* The GPU hangs up on these systems if modeset is performed on LID open */
609static const struct dmi_system_id intel_no_modeset_on_lid[] = {
610 {
611 .callback = intel_no_modeset_on_lid_dmi_callback,
612 .ident = "Toshiba Tecra A11",
613 .matches = {
614 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
615 DMI_MATCH(DMI_PRODUCT_NAME, "TECRA A11"),
616 },
617 },
618
619 { } /* terminating entry */
620};
621
602/* 622/*
603 * Lid events. Note the use of 'modeset_on_lid': 623 * Lid events. Note the use of 'modeset_on_lid':
604 * - we set it on lid close, and reset it on open 624 * - we set it on lid close, and reset it on open
@@ -622,6 +642,9 @@ static int intel_lid_notify(struct notifier_block *nb, unsigned long val,
622 */ 642 */
623 if (connector) 643 if (connector)
624 connector->status = connector->funcs->detect(connector); 644 connector->status = connector->funcs->detect(connector);
645 /* Don't force modeset on machines where it causes a GPU lockup */
646 if (dmi_check_system(intel_no_modeset_on_lid))
647 return NOTIFY_OK;
625 if (!acpi_lid_open()) { 648 if (!acpi_lid_open()) {
626 dev_priv->modeset_on_lid = 1; 649 dev_priv->modeset_on_lid = 1;
627 return NOTIFY_OK; 650 return NOTIFY_OK;
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c
index fc924b649195..e492919faf44 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bios.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bios.c
@@ -203,36 +203,26 @@ struct methods {
203 const bool rw; 203 const bool rw;
204}; 204};
205 205
206static struct methods nv04_methods[] = { 206static struct methods shadow_methods[] = {
207 { "PROM", load_vbios_prom, false },
208 { "PRAMIN", load_vbios_pramin, true },
209 { "PCIROM", load_vbios_pci, true },
210};
211
212static struct methods nv50_methods[] = {
213 { "ACPI", load_vbios_acpi, true },
214 { "PRAMIN", load_vbios_pramin, true }, 207 { "PRAMIN", load_vbios_pramin, true },
215 { "PROM", load_vbios_prom, false }, 208 { "PROM", load_vbios_prom, false },
216 { "PCIROM", load_vbios_pci, true }, 209 { "PCIROM", load_vbios_pci, true },
210 { "ACPI", load_vbios_acpi, true },
217}; 211};
218 212
219#define METHODCNT 3
220
221static bool NVShadowVBIOS(struct drm_device *dev, uint8_t *data) 213static bool NVShadowVBIOS(struct drm_device *dev, uint8_t *data)
222{ 214{
223 struct drm_nouveau_private *dev_priv = dev->dev_private; 215 const int nr_methods = ARRAY_SIZE(shadow_methods);
224 struct methods *methods; 216 struct methods *methods = shadow_methods;
225 int i;
226 int testscore = 3; 217 int testscore = 3;
227 int scores[METHODCNT]; 218 int scores[nr_methods], i;
228 219
229 if (nouveau_vbios) { 220 if (nouveau_vbios) {
230 methods = nv04_methods; 221 for (i = 0; i < nr_methods; i++)
231 for (i = 0; i < METHODCNT; i++)
232 if (!strcasecmp(nouveau_vbios, methods[i].desc)) 222 if (!strcasecmp(nouveau_vbios, methods[i].desc))
233 break; 223 break;
234 224
235 if (i < METHODCNT) { 225 if (i < nr_methods) {
236 NV_INFO(dev, "Attempting to use BIOS image from %s\n", 226 NV_INFO(dev, "Attempting to use BIOS image from %s\n",
237 methods[i].desc); 227 methods[i].desc);
238 228
@@ -244,12 +234,7 @@ static bool NVShadowVBIOS(struct drm_device *dev, uint8_t *data)
244 NV_ERROR(dev, "VBIOS source \'%s\' invalid\n", nouveau_vbios); 234 NV_ERROR(dev, "VBIOS source \'%s\' invalid\n", nouveau_vbios);
245 } 235 }
246 236
247 if (dev_priv->card_type < NV_50) 237 for (i = 0; i < nr_methods; i++) {
248 methods = nv04_methods;
249 else
250 methods = nv50_methods;
251
252 for (i = 0; i < METHODCNT; i++) {
253 NV_TRACE(dev, "Attempting to load BIOS image from %s\n", 238 NV_TRACE(dev, "Attempting to load BIOS image from %s\n",
254 methods[i].desc); 239 methods[i].desc);
255 data[0] = data[1] = 0; /* avoid reuse of previous image */ 240 data[0] = data[1] = 0; /* avoid reuse of previous image */
@@ -260,7 +245,7 @@ static bool NVShadowVBIOS(struct drm_device *dev, uint8_t *data)
260 } 245 }
261 246
262 while (--testscore > 0) { 247 while (--testscore > 0) {
263 for (i = 0; i < METHODCNT; i++) { 248 for (i = 0; i < nr_methods; i++) {
264 if (scores[i] == testscore) { 249 if (scores[i] == testscore) {
265 NV_TRACE(dev, "Using BIOS image from %s\n", 250 NV_TRACE(dev, "Using BIOS image from %s\n",
266 methods[i].desc); 251 methods[i].desc);
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
index c9a4a0d2a115..257ea130ae13 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
@@ -387,7 +387,8 @@ int nouveau_fbcon_init(struct drm_device *dev)
387 dev_priv->nfbdev = nfbdev; 387 dev_priv->nfbdev = nfbdev;
388 nfbdev->helper.funcs = &nouveau_fbcon_helper_funcs; 388 nfbdev->helper.funcs = &nouveau_fbcon_helper_funcs;
389 389
390 ret = drm_fb_helper_init(dev, &nfbdev->helper, 2, 4); 390 ret = drm_fb_helper_init(dev, &nfbdev->helper,
391 nv_two_heads(dev) ? 2 : 1, 4);
391 if (ret) { 392 if (ret) {
392 kfree(nfbdev); 393 kfree(nfbdev);
393 return ret; 394 return ret;
diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c
index 010963d4570f..345a75a03c96 100644
--- a/drivers/gpu/drm/radeon/evergreen_cs.c
+++ b/drivers/gpu/drm/radeon/evergreen_cs.c
@@ -333,7 +333,6 @@ static int evergreen_cs_packet_parse_vline(struct radeon_cs_parser *p)
333 header = radeon_get_ib_value(p, h_idx); 333 header = radeon_get_ib_value(p, h_idx);
334 crtc_id = radeon_get_ib_value(p, h_idx + 2 + 7 + 1); 334 crtc_id = radeon_get_ib_value(p, h_idx + 2 + 7 + 1);
335 reg = CP_PACKET0_GET_REG(header); 335 reg = CP_PACKET0_GET_REG(header);
336 mutex_lock(&p->rdev->ddev->mode_config.mutex);
337 obj = drm_mode_object_find(p->rdev->ddev, crtc_id, DRM_MODE_OBJECT_CRTC); 336 obj = drm_mode_object_find(p->rdev->ddev, crtc_id, DRM_MODE_OBJECT_CRTC);
338 if (!obj) { 337 if (!obj) {
339 DRM_ERROR("cannot find crtc %d\n", crtc_id); 338 DRM_ERROR("cannot find crtc %d\n", crtc_id);
@@ -368,7 +367,6 @@ static int evergreen_cs_packet_parse_vline(struct radeon_cs_parser *p)
368 } 367 }
369 } 368 }
370out: 369out:
371 mutex_unlock(&p->rdev->ddev->mode_config.mutex);
372 return r; 370 return r;
373} 371}
374 372
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index 3970e62eaab8..a89a15ab524d 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -1230,7 +1230,6 @@ int r100_cs_packet_parse_vline(struct radeon_cs_parser *p)
1230 header = radeon_get_ib_value(p, h_idx); 1230 header = radeon_get_ib_value(p, h_idx);
1231 crtc_id = radeon_get_ib_value(p, h_idx + 5); 1231 crtc_id = radeon_get_ib_value(p, h_idx + 5);
1232 reg = CP_PACKET0_GET_REG(header); 1232 reg = CP_PACKET0_GET_REG(header);
1233 mutex_lock(&p->rdev->ddev->mode_config.mutex);
1234 obj = drm_mode_object_find(p->rdev->ddev, crtc_id, DRM_MODE_OBJECT_CRTC); 1233 obj = drm_mode_object_find(p->rdev->ddev, crtc_id, DRM_MODE_OBJECT_CRTC);
1235 if (!obj) { 1234 if (!obj) {
1236 DRM_ERROR("cannot find crtc %d\n", crtc_id); 1235 DRM_ERROR("cannot find crtc %d\n", crtc_id);
@@ -1264,7 +1263,6 @@ int r100_cs_packet_parse_vline(struct radeon_cs_parser *p)
1264 ib[h_idx + 3] |= RADEON_ENG_DISPLAY_SELECT_CRTC1; 1263 ib[h_idx + 3] |= RADEON_ENG_DISPLAY_SELECT_CRTC1;
1265 } 1264 }
1266out: 1265out:
1267 mutex_unlock(&p->rdev->ddev->mode_config.mutex);
1268 return r; 1266 return r;
1269} 1267}
1270 1268
@@ -2354,6 +2352,7 @@ void r100_mc_init(struct radeon_device *rdev)
2354 if (rdev->flags & RADEON_IS_IGP) 2352 if (rdev->flags & RADEON_IS_IGP)
2355 base = (RREG32(RADEON_NB_TOM) & 0xffff) << 16; 2353 base = (RREG32(RADEON_NB_TOM) & 0xffff) << 16;
2356 radeon_vram_location(rdev, &rdev->mc, base); 2354 radeon_vram_location(rdev, &rdev->mc, base);
2355 rdev->mc.gtt_base_align = 0;
2357 if (!(rdev->flags & RADEON_IS_AGP)) 2356 if (!(rdev->flags & RADEON_IS_AGP))
2358 radeon_gtt_location(rdev, &rdev->mc); 2357 radeon_gtt_location(rdev, &rdev->mc);
2359 radeon_update_bandwidth_info(rdev); 2358 radeon_update_bandwidth_info(rdev);
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c
index 7e81db5eb804..19a7ef7ee344 100644
--- a/drivers/gpu/drm/radeon/r300.c
+++ b/drivers/gpu/drm/radeon/r300.c
@@ -481,6 +481,7 @@ void r300_mc_init(struct radeon_device *rdev)
481 if (rdev->flags & RADEON_IS_IGP) 481 if (rdev->flags & RADEON_IS_IGP)
482 base = (RREG32(RADEON_NB_TOM) & 0xffff) << 16; 482 base = (RREG32(RADEON_NB_TOM) & 0xffff) << 16;
483 radeon_vram_location(rdev, &rdev->mc, base); 483 radeon_vram_location(rdev, &rdev->mc, base);
484 rdev->mc.gtt_base_align = 0;
484 if (!(rdev->flags & RADEON_IS_AGP)) 485 if (!(rdev->flags & RADEON_IS_AGP))
485 radeon_gtt_location(rdev, &rdev->mc); 486 radeon_gtt_location(rdev, &rdev->mc);
486 radeon_update_bandwidth_info(rdev); 487 radeon_update_bandwidth_info(rdev);
@@ -1176,6 +1177,8 @@ int r300_cs_parse(struct radeon_cs_parser *p)
1176 int r; 1177 int r;
1177 1178
1178 track = kzalloc(sizeof(*track), GFP_KERNEL); 1179 track = kzalloc(sizeof(*track), GFP_KERNEL);
1180 if (track == NULL)
1181 return -ENOMEM;
1179 r100_cs_track_clear(p->rdev, track); 1182 r100_cs_track_clear(p->rdev, track);
1180 p->track = track; 1183 p->track = track;
1181 do { 1184 do {
diff --git a/drivers/gpu/drm/radeon/r520.c b/drivers/gpu/drm/radeon/r520.c
index 34330df28483..694af7cc23ac 100644
--- a/drivers/gpu/drm/radeon/r520.c
+++ b/drivers/gpu/drm/radeon/r520.c
@@ -125,6 +125,7 @@ void r520_mc_init(struct radeon_device *rdev)
125 r520_vram_get_type(rdev); 125 r520_vram_get_type(rdev);
126 r100_vram_init_sizes(rdev); 126 r100_vram_init_sizes(rdev);
127 radeon_vram_location(rdev, &rdev->mc, 0); 127 radeon_vram_location(rdev, &rdev->mc, 0);
128 rdev->mc.gtt_base_align = 0;
128 if (!(rdev->flags & RADEON_IS_AGP)) 129 if (!(rdev->flags & RADEON_IS_AGP))
129 radeon_gtt_location(rdev, &rdev->mc); 130 radeon_gtt_location(rdev, &rdev->mc);
130 radeon_update_bandwidth_info(rdev); 131 radeon_update_bandwidth_info(rdev);
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 3d6645ce2151..e100f69faeec 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -1179,6 +1179,7 @@ void r600_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc)
1179 if (rdev->flags & RADEON_IS_IGP) 1179 if (rdev->flags & RADEON_IS_IGP)
1180 base = (RREG32(MC_VM_FB_LOCATION) & 0xFFFF) << 24; 1180 base = (RREG32(MC_VM_FB_LOCATION) & 0xFFFF) << 24;
1181 radeon_vram_location(rdev, &rdev->mc, base); 1181 radeon_vram_location(rdev, &rdev->mc, base);
1182 rdev->mc.gtt_base_align = 0;
1182 radeon_gtt_location(rdev, mc); 1183 radeon_gtt_location(rdev, mc);
1183 } 1184 }
1184} 1185}
diff --git a/drivers/gpu/drm/radeon/r600_blit.c b/drivers/gpu/drm/radeon/r600_blit.c
index f4fb88ece2bb..ca5c29f70779 100644
--- a/drivers/gpu/drm/radeon/r600_blit.c
+++ b/drivers/gpu/drm/radeon/r600_blit.c
@@ -538,9 +538,12 @@ int
538r600_prepare_blit_copy(struct drm_device *dev, struct drm_file *file_priv) 538r600_prepare_blit_copy(struct drm_device *dev, struct drm_file *file_priv)
539{ 539{
540 drm_radeon_private_t *dev_priv = dev->dev_private; 540 drm_radeon_private_t *dev_priv = dev->dev_private;
541 int ret;
541 DRM_DEBUG("\n"); 542 DRM_DEBUG("\n");
542 543
543 r600_nomm_get_vb(dev); 544 ret = r600_nomm_get_vb(dev);
545 if (ret)
546 return ret;
544 547
545 dev_priv->blit_vb->file_priv = file_priv; 548 dev_priv->blit_vb->file_priv = file_priv;
546 549
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
index c39c1bc13016..144c32d37136 100644
--- a/drivers/gpu/drm/radeon/r600_cs.c
+++ b/drivers/gpu/drm/radeon/r600_cs.c
@@ -585,7 +585,7 @@ static int r600_cs_packet_parse_vline(struct radeon_cs_parser *p)
585 header = radeon_get_ib_value(p, h_idx); 585 header = radeon_get_ib_value(p, h_idx);
586 crtc_id = radeon_get_ib_value(p, h_idx + 2 + 7 + 1); 586 crtc_id = radeon_get_ib_value(p, h_idx + 2 + 7 + 1);
587 reg = CP_PACKET0_GET_REG(header); 587 reg = CP_PACKET0_GET_REG(header);
588 mutex_lock(&p->rdev->ddev->mode_config.mutex); 588
589 obj = drm_mode_object_find(p->rdev->ddev, crtc_id, DRM_MODE_OBJECT_CRTC); 589 obj = drm_mode_object_find(p->rdev->ddev, crtc_id, DRM_MODE_OBJECT_CRTC);
590 if (!obj) { 590 if (!obj) {
591 DRM_ERROR("cannot find crtc %d\n", crtc_id); 591 DRM_ERROR("cannot find crtc %d\n", crtc_id);
@@ -620,7 +620,6 @@ static int r600_cs_packet_parse_vline(struct radeon_cs_parser *p)
620 ib[h_idx + 4] = AVIVO_D2MODE_VLINE_STATUS >> 2; 620 ib[h_idx + 4] = AVIVO_D2MODE_VLINE_STATUS >> 2;
621 } 621 }
622out: 622out:
623 mutex_unlock(&p->rdev->ddev->mode_config.mutex);
624 return r; 623 return r;
625} 624}
626 625
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index ab61aaa887bb..2f94dc66c183 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -351,6 +351,7 @@ struct radeon_mc {
351 int vram_mtrr; 351 int vram_mtrr;
352 bool vram_is_ddr; 352 bool vram_is_ddr;
353 bool igp_sideport_enabled; 353 bool igp_sideport_enabled;
354 u64 gtt_base_align;
354}; 355};
355 356
356bool radeon_combios_sideport_present(struct radeon_device *rdev); 357bool radeon_combios_sideport_present(struct radeon_device *rdev);
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index 99bd8a9c56b3..10673ae59cfa 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -280,6 +280,15 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev,
280 } 280 }
281 } 281 }
282 282
283 /* ASUS HD 3600 board lists the DVI port as HDMI */
284 if ((dev->pdev->device == 0x9598) &&
285 (dev->pdev->subsystem_vendor == 0x1043) &&
286 (dev->pdev->subsystem_device == 0x01e4)) {
287 if (*connector_type == DRM_MODE_CONNECTOR_HDMIA) {
288 *connector_type = DRM_MODE_CONNECTOR_DVII;
289 }
290 }
291
283 /* ASUS HD 3450 board lists the DVI port as HDMI */ 292 /* ASUS HD 3450 board lists the DVI port as HDMI */
284 if ((dev->pdev->device == 0x95C5) && 293 if ((dev->pdev->device == 0x95C5) &&
285 (dev->pdev->subsystem_vendor == 0x1043) && 294 (dev->pdev->subsystem_vendor == 0x1043) &&
@@ -1029,8 +1038,15 @@ bool radeon_atombios_sideport_present(struct radeon_device *rdev)
1029 data_offset); 1038 data_offset);
1030 switch (crev) { 1039 switch (crev) {
1031 case 1: 1040 case 1:
1032 if (igp_info->info.ucMemoryType & 0xf0) 1041 /* AMD IGPS */
1033 return true; 1042 if ((rdev->family == CHIP_RS690) ||
1043 (rdev->family == CHIP_RS740)) {
1044 if (igp_info->info.ulBootUpMemoryClock)
1045 return true;
1046 } else {
1047 if (igp_info->info.ucMemoryType & 0xf0)
1048 return true;
1049 }
1034 break; 1050 break;
1035 case 2: 1051 case 2:
1036 if (igp_info->info_2.ucMemoryType & 0x0f) 1052 if (igp_info->info_2.ucMemoryType & 0x0f)
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c
index d1c1d8dd93ce..2417d7b06fdb 100644
--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -3050,6 +3050,14 @@ void radeon_combios_asic_init(struct drm_device *dev)
3050 rdev->pdev->subsystem_device == 0x308b) 3050 rdev->pdev->subsystem_device == 0x308b)
3051 return; 3051 return;
3052 3052
3053 /* quirk for rs4xx HP dv5000 laptop to make it resume
3054 * - it hangs on resume inside the dynclk 1 table.
3055 */
3056 if (rdev->family == CHIP_RS480 &&
3057 rdev->pdev->subsystem_vendor == 0x103c &&
3058 rdev->pdev->subsystem_device == 0x30a4)
3059 return;
3060
3053 /* DYN CLK 1 */ 3061 /* DYN CLK 1 */
3054 table = combios_get_table_offset(dev, COMBIOS_DYN_CLK_1_TABLE); 3062 table = combios_get_table_offset(dev, COMBIOS_DYN_CLK_1_TABLE);
3055 if (table) 3063 if (table)
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index f58f8bd8f77b..adccbc2c202c 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -771,14 +771,14 @@ static enum drm_connector_status radeon_dvi_detect(struct drm_connector *connect
771 } else 771 } else
772 ret = connector_status_connected; 772 ret = connector_status_connected;
773 773
774 /* multiple connectors on the same encoder with the same ddc line 774 /* This gets complicated. We have boards with VGA + HDMI with a
775 * This tends to be HDMI and DVI on the same encoder with the 775 * shared DDC line and we have boards with DVI-D + HDMI with a shared
776 * same ddc line. If the edid says HDMI, consider the HDMI port 776 * DDC line. The latter is more complex because with DVI<->HDMI adapters
777 * connected and the DVI port disconnected. If the edid doesn't 777 * you don't really know what's connected to which port as both are digital.
778 * say HDMI, vice versa.
779 */ 778 */
780 if (radeon_connector->shared_ddc && (ret == connector_status_connected)) { 779 if (radeon_connector->shared_ddc && (ret == connector_status_connected)) {
781 struct drm_device *dev = connector->dev; 780 struct drm_device *dev = connector->dev;
781 struct radeon_device *rdev = dev->dev_private;
782 struct drm_connector *list_connector; 782 struct drm_connector *list_connector;
783 struct radeon_connector *list_radeon_connector; 783 struct radeon_connector *list_radeon_connector;
784 list_for_each_entry(list_connector, &dev->mode_config.connector_list, head) { 784 list_for_each_entry(list_connector, &dev->mode_config.connector_list, head) {
@@ -788,15 +788,10 @@ static enum drm_connector_status radeon_dvi_detect(struct drm_connector *connect
788 if (list_radeon_connector->shared_ddc && 788 if (list_radeon_connector->shared_ddc &&
789 (list_radeon_connector->ddc_bus->rec.i2c_id == 789 (list_radeon_connector->ddc_bus->rec.i2c_id ==
790 radeon_connector->ddc_bus->rec.i2c_id)) { 790 radeon_connector->ddc_bus->rec.i2c_id)) {
791 if (drm_detect_hdmi_monitor(radeon_connector->edid)) { 791 /* cases where both connectors are digital */
792 if (connector->connector_type == DRM_MODE_CONNECTOR_DVID) { 792 if (list_connector->connector_type != DRM_MODE_CONNECTOR_VGA) {
793 kfree(radeon_connector->edid); 793 /* hpd is our only option in this case */
794 radeon_connector->edid = NULL; 794 if (!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) {
795 ret = connector_status_disconnected;
796 }
797 } else {
798 if ((connector->connector_type == DRM_MODE_CONNECTOR_HDMIA) ||
799 (connector->connector_type == DRM_MODE_CONNECTOR_HDMIB)) {
800 kfree(radeon_connector->edid); 795 kfree(radeon_connector->edid);
801 radeon_connector->edid = NULL; 796 radeon_connector->edid = NULL;
802 ret = connector_status_disconnected; 797 ret = connector_status_disconnected;
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 5f317317aba2..dd279da90546 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -226,20 +226,20 @@ void radeon_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc)
226{ 226{
227 u64 size_af, size_bf; 227 u64 size_af, size_bf;
228 228
229 size_af = 0xFFFFFFFF - mc->vram_end; 229 size_af = ((0xFFFFFFFF - mc->vram_end) + mc->gtt_base_align) & ~mc->gtt_base_align;
230 size_bf = mc->vram_start; 230 size_bf = mc->vram_start & ~mc->gtt_base_align;
231 if (size_bf > size_af) { 231 if (size_bf > size_af) {
232 if (mc->gtt_size > size_bf) { 232 if (mc->gtt_size > size_bf) {
233 dev_warn(rdev->dev, "limiting GTT\n"); 233 dev_warn(rdev->dev, "limiting GTT\n");
234 mc->gtt_size = size_bf; 234 mc->gtt_size = size_bf;
235 } 235 }
236 mc->gtt_start = mc->vram_start - mc->gtt_size; 236 mc->gtt_start = (mc->vram_start & ~mc->gtt_base_align) - mc->gtt_size;
237 } else { 237 } else {
238 if (mc->gtt_size > size_af) { 238 if (mc->gtt_size > size_af) {
239 dev_warn(rdev->dev, "limiting GTT\n"); 239 dev_warn(rdev->dev, "limiting GTT\n");
240 mc->gtt_size = size_af; 240 mc->gtt_size = size_af;
241 } 241 }
242 mc->gtt_start = mc->vram_end + 1; 242 mc->gtt_start = (mc->vram_end + 1 + mc->gtt_base_align) & ~mc->gtt_base_align;
243 } 243 }
244 mc->gtt_end = mc->gtt_start + mc->gtt_size - 1; 244 mc->gtt_end = mc->gtt_start + mc->gtt_size - 1;
245 dev_info(rdev->dev, "GTT: %lluM 0x%08llX - 0x%08llX\n", 245 dev_info(rdev->dev, "GTT: %lluM 0x%08llX - 0x%08llX\n",
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
index 6a70c0dc7f92..ab389f89fa8d 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -128,7 +128,8 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
128 for (i = 0, found = 0; i < rdev->num_crtc; i++) { 128 for (i = 0, found = 0; i < rdev->num_crtc; i++) {
129 crtc = (struct drm_crtc *)minfo->crtcs[i]; 129 crtc = (struct drm_crtc *)minfo->crtcs[i];
130 if (crtc && crtc->base.id == value) { 130 if (crtc && crtc->base.id == value) {
131 value = i; 131 struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
132 value = radeon_crtc->crtc_id;
132 found = 1; 133 found = 1;
133 break; 134 break;
134 } 135 }
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
index bad77f40a9da..5688a0cf6bbe 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
@@ -108,6 +108,7 @@ static void radeon_legacy_lvds_dpms(struct drm_encoder *encoder, int mode)
108 udelay(panel_pwr_delay * 1000); 108 udelay(panel_pwr_delay * 1000);
109 WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl); 109 WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl);
110 WREG32_PLL(RADEON_PIXCLKS_CNTL, pixclks_cntl); 110 WREG32_PLL(RADEON_PIXCLKS_CNTL, pixclks_cntl);
111 udelay(panel_pwr_delay * 1000);
111 break; 112 break;
112 } 113 }
113 114
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_tv.c b/drivers/gpu/drm/radeon/radeon_legacy_tv.c
index f2ed27c8055b..032040397743 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_tv.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_tv.c
@@ -642,8 +642,8 @@ void radeon_legacy_tv_mode_set(struct drm_encoder *encoder,
642 } 642 }
643 flicker_removal = (tmp + 500) / 1000; 643 flicker_removal = (tmp + 500) / 1000;
644 644
645 if (flicker_removal < 2) 645 if (flicker_removal < 3)
646 flicker_removal = 2; 646 flicker_removal = 3;
647 for (i = 0; i < ARRAY_SIZE(SLOPE_limit); ++i) { 647 for (i = 0; i < ARRAY_SIZE(SLOPE_limit); ++i) {
648 if (flicker_removal == SLOPE_limit[i]) 648 if (flicker_removal == SLOPE_limit[i])
649 break; 649 break;
diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c
index 9e4240b3bf0b..f454c9a5e7f2 100644
--- a/drivers/gpu/drm/radeon/rs400.c
+++ b/drivers/gpu/drm/radeon/rs400.c
@@ -57,7 +57,9 @@ void rs400_gart_adjust_size(struct radeon_device *rdev)
57 } 57 }
58 if (rdev->family == CHIP_RS400 || rdev->family == CHIP_RS480) { 58 if (rdev->family == CHIP_RS400 || rdev->family == CHIP_RS480) {
59 /* FIXME: RS400 & RS480 seems to have issue with GART size 59 /* FIXME: RS400 & RS480 seems to have issue with GART size
60 * if 4G of system memory (needs more testing) */ 60 * if 4G of system memory (needs more testing)
61 */
62 /* XXX is this still an issue with proper alignment? */
61 rdev->mc.gtt_size = 32 * 1024 * 1024; 63 rdev->mc.gtt_size = 32 * 1024 * 1024;
62 DRM_ERROR("Forcing to 32M GART size (because of ASIC bug ?)\n"); 64 DRM_ERROR("Forcing to 32M GART size (because of ASIC bug ?)\n");
63 } 65 }
@@ -263,6 +265,7 @@ void rs400_mc_init(struct radeon_device *rdev)
263 r100_vram_init_sizes(rdev); 265 r100_vram_init_sizes(rdev);
264 base = (RREG32(RADEON_NB_TOM) & 0xffff) << 16; 266 base = (RREG32(RADEON_NB_TOM) & 0xffff) << 16;
265 radeon_vram_location(rdev, &rdev->mc, base); 267 radeon_vram_location(rdev, &rdev->mc, base);
268 rdev->mc.gtt_base_align = rdev->mc.gtt_size - 1;
266 radeon_gtt_location(rdev, &rdev->mc); 269 radeon_gtt_location(rdev, &rdev->mc);
267 radeon_update_bandwidth_info(rdev); 270 radeon_update_bandwidth_info(rdev);
268} 271}
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
index 7bb4c3e52f3b..6dc15ea8ba33 100644
--- a/drivers/gpu/drm/radeon/rs600.c
+++ b/drivers/gpu/drm/radeon/rs600.c
@@ -698,6 +698,7 @@ void rs600_mc_init(struct radeon_device *rdev)
698 base = G_000004_MC_FB_START(base) << 16; 698 base = G_000004_MC_FB_START(base) << 16;
699 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); 699 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev);
700 radeon_vram_location(rdev, &rdev->mc, base); 700 radeon_vram_location(rdev, &rdev->mc, base);
701 rdev->mc.gtt_base_align = 0;
701 radeon_gtt_location(rdev, &rdev->mc); 702 radeon_gtt_location(rdev, &rdev->mc);
702 radeon_update_bandwidth_info(rdev); 703 radeon_update_bandwidth_info(rdev);
703} 704}
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c
index f4f0a61bcdce..ce4ecbe10816 100644
--- a/drivers/gpu/drm/radeon/rs690.c
+++ b/drivers/gpu/drm/radeon/rs690.c
@@ -162,6 +162,7 @@ void rs690_mc_init(struct radeon_device *rdev)
162 rs690_pm_info(rdev); 162 rs690_pm_info(rdev);
163 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); 163 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev);
164 radeon_vram_location(rdev, &rdev->mc, base); 164 radeon_vram_location(rdev, &rdev->mc, base);
165 rdev->mc.gtt_base_align = rdev->mc.gtt_size - 1;
165 radeon_gtt_location(rdev, &rdev->mc); 166 radeon_gtt_location(rdev, &rdev->mc);
166 radeon_update_bandwidth_info(rdev); 167 radeon_update_bandwidth_info(rdev);
167} 168}
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c
index 7d9a7b0a180a..0c9c169a6852 100644
--- a/drivers/gpu/drm/radeon/rv515.c
+++ b/drivers/gpu/drm/radeon/rv515.c
@@ -195,6 +195,7 @@ void rv515_mc_init(struct radeon_device *rdev)
195 rv515_vram_get_type(rdev); 195 rv515_vram_get_type(rdev);
196 r100_vram_init_sizes(rdev); 196 r100_vram_init_sizes(rdev);
197 radeon_vram_location(rdev, &rdev->mc, 0); 197 radeon_vram_location(rdev, &rdev->mc, 0);
198 rdev->mc.gtt_base_align = 0;
198 if (!(rdev->flags & RADEON_IS_AGP)) 199 if (!(rdev->flags & RADEON_IS_AGP))
199 radeon_gtt_location(rdev, &rdev->mc); 200 radeon_gtt_location(rdev, &rdev->mc);
200 radeon_update_bandwidth_info(rdev); 201 radeon_update_bandwidth_info(rdev);
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c
index b1d67dc973dc..ca904799f018 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
@@ -40,11 +40,13 @@
40#include <linux/slab.h> 40#include <linux/slab.h>
41 41
42#include <asm/atomic.h> 42#include <asm/atomic.h>
43#include <asm/agp.h>
44 43
45#include "ttm/ttm_bo_driver.h" 44#include "ttm/ttm_bo_driver.h"
46#include "ttm/ttm_page_alloc.h" 45#include "ttm/ttm_page_alloc.h"
47 46
47#ifdef TTM_HAS_AGP
48#include <asm/agp.h>
49#endif
48 50
49#define NUM_PAGES_TO_ALLOC (PAGE_SIZE/sizeof(struct page *)) 51#define NUM_PAGES_TO_ALLOC (PAGE_SIZE/sizeof(struct page *))
50#define SMALL_ALLOCATION 16 52#define SMALL_ALLOCATION 16
@@ -392,7 +394,7 @@ static int ttm_pool_get_num_unused_pages(void)
392/** 394/**
393 * Callback for mm to request pool to reduce number of page held. 395 * Callback for mm to request pool to reduce number of page held.
394 */ 396 */
395static int ttm_pool_mm_shrink(int shrink_pages, gfp_t gfp_mask) 397static int ttm_pool_mm_shrink(struct shrinker *shrink, int shrink_pages, gfp_t gfp_mask)
396{ 398{
397 static atomic_t start_pool = ATOMIC_INIT(0); 399 static atomic_t start_pool = ATOMIC_INIT(0);
398 unsigned i; 400 unsigned i;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index f1d626112415..437ac786277a 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -972,6 +972,7 @@ int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data,
972 ret = copy_from_user(rects, user_rects, rects_size); 972 ret = copy_from_user(rects, user_rects, rects_size);
973 if (unlikely(ret != 0)) { 973 if (unlikely(ret != 0)) {
974 DRM_ERROR("Failed to get rects.\n"); 974 DRM_ERROR("Failed to get rects.\n");
975 ret = -EFAULT;
975 goto out_free; 976 goto out_free;
976 } 977 }
977 978
diff --git a/drivers/input/joystick/gamecon.c b/drivers/input/joystick/gamecon.c
index fbd62abb66f9..0ffaf2c77a19 100644
--- a/drivers/input/joystick/gamecon.c
+++ b/drivers/input/joystick/gamecon.c
@@ -89,7 +89,6 @@ struct gc_pad {
89struct gc { 89struct gc {
90 struct pardevice *pd; 90 struct pardevice *pd;
91 struct gc_pad pads[GC_MAX_DEVICES]; 91 struct gc_pad pads[GC_MAX_DEVICES];
92 struct input_dev *dev[GC_MAX_DEVICES];
93 struct timer_list timer; 92 struct timer_list timer;
94 int pad_count[GC_MAX]; 93 int pad_count[GC_MAX];
95 int used; 94 int used;
@@ -387,7 +386,7 @@ static void gc_nes_process_packet(struct gc *gc)
387 for (i = 0; i < GC_MAX_DEVICES; i++) { 386 for (i = 0; i < GC_MAX_DEVICES; i++) {
388 387
389 pad = &gc->pads[i]; 388 pad = &gc->pads[i];
390 dev = gc->dev[i]; 389 dev = pad->dev;
391 s = gc_status_bit[i]; 390 s = gc_status_bit[i];
392 391
393 switch (pad->type) { 392 switch (pad->type) {
@@ -579,7 +578,7 @@ static void gc_psx_command(struct gc *gc, int b, unsigned char *data)
579 read = parport_read_status(port) ^ 0x80; 578 read = parport_read_status(port) ^ 0x80;
580 579
581 for (j = 0; j < GC_MAX_DEVICES; j++) { 580 for (j = 0; j < GC_MAX_DEVICES; j++) {
582 struct gc_pad *pad = &gc->pads[i]; 581 struct gc_pad *pad = &gc->pads[j];
583 582
584 if (pad->type == GC_PSX || pad->type == GC_DDR) 583 if (pad->type == GC_PSX || pad->type == GC_DDR)
585 data[j] |= (read & gc_status_bit[j]) ? (1 << i) : 0; 584 data[j] |= (read & gc_status_bit[j]) ? (1 << i) : 0;
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 3525f533e186..1ba25145b333 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -124,7 +124,7 @@ config KEYBOARD_ATKBD_RDI_KEYCODES
124 right-hand column will be interpreted as the key shown in the 124 right-hand column will be interpreted as the key shown in the
125 left-hand column. 125 left-hand column.
126 126
127config QT2160 127config KEYBOARD_QT2160
128 tristate "Atmel AT42QT2160 Touch Sensor Chip" 128 tristate "Atmel AT42QT2160 Touch Sensor Chip"
129 depends on I2C && EXPERIMENTAL 129 depends on I2C && EXPERIMENTAL
130 help 130 help
diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c
index 7aa59e07b689..fb16b5e5ea13 100644
--- a/drivers/input/keyboard/twl4030_keypad.c
+++ b/drivers/input/keyboard/twl4030_keypad.c
@@ -51,8 +51,12 @@
51 */ 51 */
52#define TWL4030_MAX_ROWS 8 /* TWL4030 hard limit */ 52#define TWL4030_MAX_ROWS 8 /* TWL4030 hard limit */
53#define TWL4030_MAX_COLS 8 53#define TWL4030_MAX_COLS 8
54#define TWL4030_ROW_SHIFT 3 54/*
55#define TWL4030_KEYMAP_SIZE (TWL4030_MAX_ROWS * TWL4030_MAX_COLS) 55 * Note that we add space for an extra column so that we can handle
56 * row lines connected to the gnd (see twl4030_col_xlate()).
57 */
58#define TWL4030_ROW_SHIFT 4
59#define TWL4030_KEYMAP_SIZE (TWL4030_MAX_ROWS << TWL4030_ROW_SHIFT)
56 60
57struct twl4030_keypad { 61struct twl4030_keypad {
58 unsigned short keymap[TWL4030_KEYMAP_SIZE]; 62 unsigned short keymap[TWL4030_KEYMAP_SIZE];
@@ -182,7 +186,7 @@ static int twl4030_read_kp_matrix_state(struct twl4030_keypad *kp, u16 *state)
182 return ret; 186 return ret;
183} 187}
184 188
185static int twl4030_is_in_ghost_state(struct twl4030_keypad *kp, u16 *key_state) 189static bool twl4030_is_in_ghost_state(struct twl4030_keypad *kp, u16 *key_state)
186{ 190{
187 int i; 191 int i;
188 u16 check = 0; 192 u16 check = 0;
@@ -191,12 +195,12 @@ static int twl4030_is_in_ghost_state(struct twl4030_keypad *kp, u16 *key_state)
191 u16 col = key_state[i]; 195 u16 col = key_state[i];
192 196
193 if ((col & check) && hweight16(col) > 1) 197 if ((col & check) && hweight16(col) > 1)
194 return 1; 198 return true;
195 199
196 check |= col; 200 check |= col;
197 } 201 }
198 202
199 return 0; 203 return false;
200} 204}
201 205
202static void twl4030_kp_scan(struct twl4030_keypad *kp, bool release_all) 206static void twl4030_kp_scan(struct twl4030_keypad *kp, bool release_all)
@@ -225,7 +229,8 @@ static void twl4030_kp_scan(struct twl4030_keypad *kp, bool release_all)
225 if (!changed) 229 if (!changed)
226 continue; 230 continue;
227 231
228 for (col = 0; col < kp->n_cols; col++) { 232 /* Extra column handles "all gnd" rows */
233 for (col = 0; col < kp->n_cols + 1; col++) {
229 int code; 234 int code;
230 235
231 if (!(changed & (1 << col))) 236 if (!(changed & (1 << col)))
diff --git a/drivers/input/keyboard/w90p910_keypad.c b/drivers/input/keyboard/w90p910_keypad.c
index 4ef764cc493c..ee2bf6bcf291 100644
--- a/drivers/input/keyboard/w90p910_keypad.c
+++ b/drivers/input/keyboard/w90p910_keypad.c
@@ -258,7 +258,7 @@ static struct platform_driver w90p910_keypad_driver = {
258 .probe = w90p910_keypad_probe, 258 .probe = w90p910_keypad_probe,
259 .remove = __devexit_p(w90p910_keypad_remove), 259 .remove = __devexit_p(w90p910_keypad_remove),
260 .driver = { 260 .driver = {
261 .name = "nuc900-keypad", 261 .name = "nuc900-kpi",
262 .owner = THIS_MODULE, 262 .owner = THIS_MODULE,
263 }, 263 },
264}; 264};
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 40cea334ad13..705589dc9ac5 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -141,8 +141,13 @@ static int synaptics_capability(struct psmouse *psmouse)
141 priv->capabilities = (cap[0] << 16) | (cap[1] << 8) | cap[2]; 141 priv->capabilities = (cap[0] << 16) | (cap[1] << 8) | cap[2];
142 priv->ext_cap = priv->ext_cap_0c = 0; 142 priv->ext_cap = priv->ext_cap_0c = 0;
143 143
144 if (!SYN_CAP_VALID(priv->capabilities)) 144 /*
145 * Older firmwares had submodel ID fixed to 0x47
146 */
147 if (SYN_ID_FULL(priv->identity) < 0x705 &&
148 SYN_CAP_SUBMODEL_ID(priv->capabilities) != 0x47) {
145 return -1; 149 return -1;
150 }
146 151
147 /* 152 /*
148 * Unless capExtended is set the rest of the flags should be ignored 153 * Unless capExtended is set the rest of the flags should be ignored
@@ -206,6 +211,7 @@ static int synaptics_resolution(struct psmouse *psmouse)
206 unsigned char max[3]; 211 unsigned char max[3];
207 212
208 if (SYN_ID_MAJOR(priv->identity) < 4) 213 if (SYN_ID_MAJOR(priv->identity) < 4)
214 return 0;
209 215
210 if (synaptics_send_cmd(psmouse, SYN_QUE_RESOLUTION, res) == 0) { 216 if (synaptics_send_cmd(psmouse, SYN_QUE_RESOLUTION, res) == 0) {
211 if (res[0] != 0 && (res[1] & 0x80) && res[2] != 0) { 217 if (res[0] != 0 && (res[1] & 0x80) && res[2] != 0) {
diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h
index 7d4d5e12c0df..b6aa7d20d8a3 100644
--- a/drivers/input/mouse/synaptics.h
+++ b/drivers/input/mouse/synaptics.h
@@ -47,7 +47,7 @@
47#define SYN_CAP_FOUR_BUTTON(c) ((c) & (1 << 3)) 47#define SYN_CAP_FOUR_BUTTON(c) ((c) & (1 << 3))
48#define SYN_CAP_MULTIFINGER(c) ((c) & (1 << 1)) 48#define SYN_CAP_MULTIFINGER(c) ((c) & (1 << 1))
49#define SYN_CAP_PALMDETECT(c) ((c) & (1 << 0)) 49#define SYN_CAP_PALMDETECT(c) ((c) & (1 << 0))
50#define SYN_CAP_VALID(c) ((((c) & 0x00ff00) >> 8) == 0x47) 50#define SYN_CAP_SUBMODEL_ID(c) (((c) & 0x00ff00) >> 8)
51#define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) >> 20) 51#define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) >> 20)
52#define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12) 52#define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12)
53#define SYN_CAP_PRODUCT_ID(ec) (((ec) & 0xff0000) >> 16) 53#define SYN_CAP_PRODUCT_ID(ec) (((ec) & 0xff0000) >> 16)
@@ -66,6 +66,7 @@
66#define SYN_ID_MODEL(i) (((i) >> 4) & 0x0f) 66#define SYN_ID_MODEL(i) (((i) >> 4) & 0x0f)
67#define SYN_ID_MAJOR(i) ((i) & 0x0f) 67#define SYN_ID_MAJOR(i) ((i) & 0x0f)
68#define SYN_ID_MINOR(i) (((i) >> 16) & 0xff) 68#define SYN_ID_MINOR(i) (((i) >> 16) & 0xff)
69#define SYN_ID_FULL(i) ((SYN_ID_MAJOR(i) << 8) | SYN_ID_MINOR(i))
69#define SYN_ID_IS_SYNAPTICS(i) ((((i) >> 8) & 0xff) == 0x47) 70#define SYN_ID_IS_SYNAPTICS(i) ((((i) >> 8) & 0xff) == 0x47)
70 71
71/* synaptics special commands */ 72/* synaptics special commands */
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
index 81003c4739f4..ed7ad7416b24 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -170,6 +170,13 @@ static const struct dmi_system_id __initconst i8042_dmi_noloop_table[] = {
170 }, 170 },
171 }, 171 },
172 { 172 {
173 /* Gigabyte Spring Peak - defines wrong chassis type */
174 .matches = {
175 DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
176 DMI_MATCH(DMI_PRODUCT_NAME, "Spring Peak"),
177 },
178 },
179 {
173 .matches = { 180 .matches = {
174 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), 181 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
175 DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv9700"), 182 DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv9700"),
diff --git a/drivers/input/touchscreen/w90p910_ts.c b/drivers/input/touchscreen/w90p910_ts.c
index cc18265be1a8..7a45d68c3516 100644
--- a/drivers/input/touchscreen/w90p910_ts.c
+++ b/drivers/input/touchscreen/w90p910_ts.c
@@ -233,7 +233,7 @@ static int __devinit w90x900ts_probe(struct platform_device *pdev)
233 w90p910_ts->state = TS_IDLE; 233 w90p910_ts->state = TS_IDLE;
234 spin_lock_init(&w90p910_ts->lock); 234 spin_lock_init(&w90p910_ts->lock);
235 setup_timer(&w90p910_ts->timer, w90p910_check_pen_up, 235 setup_timer(&w90p910_ts->timer, w90p910_check_pen_up,
236 (unsigned long)&w90p910_ts); 236 (unsigned long)w90p910_ts);
237 237
238 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 238 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
239 if (!res) { 239 if (!res) {
diff --git a/drivers/misc/cs5535-mfgpt.c b/drivers/misc/cs5535-mfgpt.c
index 9bec24db4d41..2d44b3300104 100644
--- a/drivers/misc/cs5535-mfgpt.c
+++ b/drivers/misc/cs5535-mfgpt.c
@@ -366,6 +366,6 @@ static int __init cs5535_mfgpt_init(void)
366 366
367module_init(cs5535_mfgpt_init); 367module_init(cs5535_mfgpt_init);
368 368
369MODULE_AUTHOR("Andres Salomon <dilinger@collabora.co.uk>"); 369MODULE_AUTHOR("Andres Salomon <dilinger@queued.net>");
370MODULE_DESCRIPTION("CS5535/CS5536 MFGPT timer driver"); 370MODULE_DESCRIPTION("CS5535/CS5536 MFGPT timer driver");
371MODULE_LICENSE("GPL"); 371MODULE_LICENSE("GPL");
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
index af217924a76e..ad30f074ee15 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -365,6 +365,26 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
365 365
366static int __devexit sdhci_s3c_remove(struct platform_device *pdev) 366static int __devexit sdhci_s3c_remove(struct platform_device *pdev)
367{ 367{
368 struct sdhci_host *host = platform_get_drvdata(pdev);
369 struct sdhci_s3c *sc = sdhci_priv(host);
370 int ptr;
371
372 sdhci_remove_host(host, 1);
373
374 for (ptr = 0; ptr < 3; ptr++) {
375 clk_disable(sc->clk_bus[ptr]);
376 clk_put(sc->clk_bus[ptr]);
377 }
378 clk_disable(sc->clk_io);
379 clk_put(sc->clk_io);
380
381 iounmap(host->ioaddr);
382 release_resource(sc->ioarea);
383 kfree(sc->ioarea);
384
385 sdhci_free_host(host);
386 platform_set_drvdata(pdev, NULL);
387
368 return 0; 388 return 0;
369} 389}
370 390
diff --git a/drivers/net/bnx2x.h b/drivers/net/bnx2x.h
index 8bd23687c530..bb0872a63315 100644
--- a/drivers/net/bnx2x.h
+++ b/drivers/net/bnx2x.h
@@ -1062,6 +1062,10 @@ struct bnx2x {
1062 1062
1063 /* used to synchronize stats collecting */ 1063 /* used to synchronize stats collecting */
1064 int stats_state; 1064 int stats_state;
1065
1066 /* used for synchronization of concurrent threads statistics handling */
1067 spinlock_t stats_lock;
1068
1065 /* used by dmae command loader */ 1069 /* used by dmae command loader */
1066 struct dmae_command stats_dmae; 1070 struct dmae_command stats_dmae;
1067 int executer_idx; 1071 int executer_idx;
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
index 57ff5b3bcce6..46167c081727 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -57,8 +57,8 @@
57#include "bnx2x_init_ops.h" 57#include "bnx2x_init_ops.h"
58#include "bnx2x_dump.h" 58#include "bnx2x_dump.h"
59 59
60#define DRV_MODULE_VERSION "1.52.53-1" 60#define DRV_MODULE_VERSION "1.52.53-2"
61#define DRV_MODULE_RELDATE "2010/18/04" 61#define DRV_MODULE_RELDATE "2010/21/07"
62#define BNX2X_BC_VER 0x040200 62#define BNX2X_BC_VER 0x040200
63 63
64#include <linux/firmware.h> 64#include <linux/firmware.h>
@@ -3789,6 +3789,8 @@ static void bnx2x_storm_stats_post(struct bnx2x *bp)
3789 struct eth_query_ramrod_data ramrod_data = {0}; 3789 struct eth_query_ramrod_data ramrod_data = {0};
3790 int i, rc; 3790 int i, rc;
3791 3791
3792 spin_lock_bh(&bp->stats_lock);
3793
3792 ramrod_data.drv_counter = bp->stats_counter++; 3794 ramrod_data.drv_counter = bp->stats_counter++;
3793 ramrod_data.collect_port = bp->port.pmf ? 1 : 0; 3795 ramrod_data.collect_port = bp->port.pmf ? 1 : 0;
3794 for_each_queue(bp, i) 3796 for_each_queue(bp, i)
@@ -3802,6 +3804,8 @@ static void bnx2x_storm_stats_post(struct bnx2x *bp)
3802 bp->spq_left++; 3804 bp->spq_left++;
3803 bp->stats_pending = 1; 3805 bp->stats_pending = 1;
3804 } 3806 }
3807
3808 spin_unlock_bh(&bp->stats_lock);
3805 } 3809 }
3806} 3810}
3807 3811
@@ -4367,6 +4371,14 @@ static int bnx2x_storm_stats_update(struct bnx2x *bp)
4367 struct host_func_stats *fstats = bnx2x_sp(bp, func_stats); 4371 struct host_func_stats *fstats = bnx2x_sp(bp, func_stats);
4368 struct bnx2x_eth_stats *estats = &bp->eth_stats; 4372 struct bnx2x_eth_stats *estats = &bp->eth_stats;
4369 int i; 4373 int i;
4374 u16 cur_stats_counter;
4375
4376 /* Make sure we use the value of the counter
4377 * used for sending the last stats ramrod.
4378 */
4379 spin_lock_bh(&bp->stats_lock);
4380 cur_stats_counter = bp->stats_counter - 1;
4381 spin_unlock_bh(&bp->stats_lock);
4370 4382
4371 memcpy(&(fstats->total_bytes_received_hi), 4383 memcpy(&(fstats->total_bytes_received_hi),
4372 &(bnx2x_sp(bp, func_stats_base)->total_bytes_received_hi), 4384 &(bnx2x_sp(bp, func_stats_base)->total_bytes_received_hi),
@@ -4394,25 +4406,22 @@ static int bnx2x_storm_stats_update(struct bnx2x *bp)
4394 u32 diff; 4406 u32 diff;
4395 4407
4396 /* are storm stats valid? */ 4408 /* are storm stats valid? */
4397 if ((u16)(le16_to_cpu(xclient->stats_counter) + 1) != 4409 if (le16_to_cpu(xclient->stats_counter) != cur_stats_counter) {
4398 bp->stats_counter) {
4399 DP(BNX2X_MSG_STATS, "[%d] stats not updated by xstorm" 4410 DP(BNX2X_MSG_STATS, "[%d] stats not updated by xstorm"
4400 " xstorm counter (0x%x) != stats_counter (0x%x)\n", 4411 " xstorm counter (0x%x) != stats_counter (0x%x)\n",
4401 i, xclient->stats_counter, bp->stats_counter); 4412 i, xclient->stats_counter, cur_stats_counter + 1);
4402 return -1; 4413 return -1;
4403 } 4414 }
4404 if ((u16)(le16_to_cpu(tclient->stats_counter) + 1) != 4415 if (le16_to_cpu(tclient->stats_counter) != cur_stats_counter) {
4405 bp->stats_counter) {
4406 DP(BNX2X_MSG_STATS, "[%d] stats not updated by tstorm" 4416 DP(BNX2X_MSG_STATS, "[%d] stats not updated by tstorm"
4407 " tstorm counter (0x%x) != stats_counter (0x%x)\n", 4417 " tstorm counter (0x%x) != stats_counter (0x%x)\n",
4408 i, tclient->stats_counter, bp->stats_counter); 4418 i, tclient->stats_counter, cur_stats_counter + 1);
4409 return -2; 4419 return -2;
4410 } 4420 }
4411 if ((u16)(le16_to_cpu(uclient->stats_counter) + 1) != 4421 if (le16_to_cpu(uclient->stats_counter) != cur_stats_counter) {
4412 bp->stats_counter) {
4413 DP(BNX2X_MSG_STATS, "[%d] stats not updated by ustorm" 4422 DP(BNX2X_MSG_STATS, "[%d] stats not updated by ustorm"
4414 " ustorm counter (0x%x) != stats_counter (0x%x)\n", 4423 " ustorm counter (0x%x) != stats_counter (0x%x)\n",
4415 i, uclient->stats_counter, bp->stats_counter); 4424 i, uclient->stats_counter, cur_stats_counter + 1);
4416 return -4; 4425 return -4;
4417 } 4426 }
4418 4427
@@ -4849,16 +4858,18 @@ static const struct {
4849 4858
4850static void bnx2x_stats_handle(struct bnx2x *bp, enum bnx2x_stats_event event) 4859static void bnx2x_stats_handle(struct bnx2x *bp, enum bnx2x_stats_event event)
4851{ 4860{
4852 enum bnx2x_stats_state state = bp->stats_state; 4861 enum bnx2x_stats_state state;
4853 4862
4854 if (unlikely(bp->panic)) 4863 if (unlikely(bp->panic))
4855 return; 4864 return;
4856 4865
4857 bnx2x_stats_stm[state][event].action(bp); 4866 /* Protect a state change flow */
4867 spin_lock_bh(&bp->stats_lock);
4868 state = bp->stats_state;
4858 bp->stats_state = bnx2x_stats_stm[state][event].next_state; 4869 bp->stats_state = bnx2x_stats_stm[state][event].next_state;
4870 spin_unlock_bh(&bp->stats_lock);
4859 4871
4860 /* Make sure the state has been "changed" */ 4872 bnx2x_stats_stm[state][event].action(bp);
4861 smp_wmb();
4862 4873
4863 if ((event != STATS_EVENT_UPDATE) || netif_msg_timer(bp)) 4874 if ((event != STATS_EVENT_UPDATE) || netif_msg_timer(bp))
4864 DP(BNX2X_MSG_STATS, "state %d -> event %d -> state %d\n", 4875 DP(BNX2X_MSG_STATS, "state %d -> event %d -> state %d\n",
@@ -9908,6 +9919,7 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp)
9908 9919
9909 mutex_init(&bp->port.phy_mutex); 9920 mutex_init(&bp->port.phy_mutex);
9910 mutex_init(&bp->fw_mb_mutex); 9921 mutex_init(&bp->fw_mb_mutex);
9922 spin_lock_init(&bp->stats_lock);
9911#ifdef BCM_CNIC 9923#ifdef BCM_CNIC
9912 mutex_init(&bp->cnic_mutex); 9924 mutex_init(&bp->cnic_mutex);
9913#endif 9925#endif
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index df483076eda6..8d7dfd2f1e90 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -822,7 +822,7 @@ static int rlb_initialize(struct bonding *bond)
822 822
823 /*initialize packet type*/ 823 /*initialize packet type*/
824 pk_type->type = cpu_to_be16(ETH_P_ARP); 824 pk_type->type = cpu_to_be16(ETH_P_ARP);
825 pk_type->dev = NULL; 825 pk_type->dev = bond->dev;
826 pk_type->func = rlb_arp_recv; 826 pk_type->func = rlb_arp_recv;
827 827
828 /* register to receive ARPs */ 828 /* register to receive ARPs */
diff --git a/drivers/net/declance.c b/drivers/net/declance.c
index 1d973db27c32..d7de376d7178 100644
--- a/drivers/net/declance.c
+++ b/drivers/net/declance.c
@@ -1022,7 +1022,7 @@ static const struct net_device_ops lance_netdev_ops = {
1022 .ndo_set_mac_address = eth_mac_addr, 1022 .ndo_set_mac_address = eth_mac_addr,
1023}; 1023};
1024 1024
1025static int __init dec_lance_probe(struct device *bdev, const int type) 1025static int __devinit dec_lance_probe(struct device *bdev, const int type)
1026{ 1026{
1027 static unsigned version_printed; 1027 static unsigned version_printed;
1028 static const char fmt[] = "declance%d"; 1028 static const char fmt[] = "declance%d";
@@ -1326,7 +1326,7 @@ static void __exit dec_lance_platform_remove(void)
1326} 1326}
1327 1327
1328#ifdef CONFIG_TC 1328#ifdef CONFIG_TC
1329static int __init dec_lance_tc_probe(struct device *dev); 1329static int __devinit dec_lance_tc_probe(struct device *dev);
1330static int __exit dec_lance_tc_remove(struct device *dev); 1330static int __exit dec_lance_tc_remove(struct device *dev);
1331 1331
1332static const struct tc_device_id dec_lance_tc_table[] = { 1332static const struct tc_device_id dec_lance_tc_table[] = {
@@ -1345,7 +1345,7 @@ static struct tc_driver dec_lance_tc_driver = {
1345 }, 1345 },
1346}; 1346};
1347 1347
1348static int __init dec_lance_tc_probe(struct device *dev) 1348static int __devinit dec_lance_tc_probe(struct device *dev)
1349{ 1349{
1350 int status = dec_lance_probe(dev, PMAD_LANCE); 1350 int status = dec_lance_probe(dev, PMAD_LANCE);
1351 if (!status) 1351 if (!status)
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
index 7acb3edc47ef..2602852cc55a 100644
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -677,7 +677,7 @@ static int ibmveth_close(struct net_device *netdev)
677 if (!adapter->pool_config) 677 if (!adapter->pool_config)
678 netif_stop_queue(netdev); 678 netif_stop_queue(netdev);
679 679
680 free_irq(netdev->irq, netdev); 680 h_vio_signal(adapter->vdev->unit_address, VIO_IRQ_DISABLE);
681 681
682 do { 682 do {
683 lpar_rc = h_free_logical_lan(adapter->vdev->unit_address); 683 lpar_rc = h_free_logical_lan(adapter->vdev->unit_address);
@@ -689,6 +689,8 @@ static int ibmveth_close(struct net_device *netdev)
689 lpar_rc); 689 lpar_rc);
690 } 690 }
691 691
692 free_irq(netdev->irq, netdev);
693
692 adapter->rx_no_buffer = *(u64*)(((char*)adapter->buffer_list_addr) + 4096 - 8); 694 adapter->rx_no_buffer = *(u64*)(((char*)adapter->buffer_list_addr) + 4096 - 8);
693 695
694 ibmveth_cleanup(adapter); 696 ibmveth_cleanup(adapter);
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 3881918f5382..cea37e0837ff 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -1722,6 +1722,15 @@ static int __devinit igb_probe(struct pci_dev *pdev,
1722 u16 eeprom_apme_mask = IGB_EEPROM_APME; 1722 u16 eeprom_apme_mask = IGB_EEPROM_APME;
1723 u32 part_num; 1723 u32 part_num;
1724 1724
1725 /* Catch broken hardware that put the wrong VF device ID in
1726 * the PCIe SR-IOV capability.
1727 */
1728 if (pdev->is_virtfn) {
1729 WARN(1, KERN_ERR "%s (%hx:%hx) should not be a VF!\n",
1730 pci_name(pdev), pdev->vendor, pdev->device);
1731 return -EINVAL;
1732 }
1733
1725 err = pci_enable_device_mem(pdev); 1734 err = pci_enable_device_mem(pdev);
1726 if (err) 1735 if (err)
1727 return err; 1736 return err;
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 7b5d9764f317..74d9b6df3029 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -6492,6 +6492,15 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
6492#endif 6492#endif
6493 u32 part_num, eec; 6493 u32 part_num, eec;
6494 6494
6495 /* Catch broken hardware that put the wrong VF device ID in
6496 * the PCIe SR-IOV capability.
6497 */
6498 if (pdev->is_virtfn) {
6499 WARN(1, KERN_ERR "%s (%hx:%hx) should not be a VF!\n",
6500 pci_name(pdev), pdev->vendor, pdev->device);
6501 return -EINVAL;
6502 }
6503
6495 err = pci_enable_device_mem(pdev); 6504 err = pci_enable_device_mem(pdev);
6496 if (err) 6505 if (err)
6497 return err; 6506 return err;
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 87e8d4cb4057..f15fe2cf72ae 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -499,7 +499,7 @@ static const struct net_device_ops macvlan_netdev_ops = {
499 .ndo_validate_addr = eth_validate_addr, 499 .ndo_validate_addr = eth_validate_addr,
500}; 500};
501 501
502static void macvlan_setup(struct net_device *dev) 502void macvlan_common_setup(struct net_device *dev)
503{ 503{
504 ether_setup(dev); 504 ether_setup(dev);
505 505
@@ -508,6 +508,12 @@ static void macvlan_setup(struct net_device *dev)
508 dev->destructor = free_netdev; 508 dev->destructor = free_netdev;
509 dev->header_ops = &macvlan_hard_header_ops, 509 dev->header_ops = &macvlan_hard_header_ops,
510 dev->ethtool_ops = &macvlan_ethtool_ops; 510 dev->ethtool_ops = &macvlan_ethtool_ops;
511}
512EXPORT_SYMBOL_GPL(macvlan_common_setup);
513
514static void macvlan_setup(struct net_device *dev)
515{
516 macvlan_common_setup(dev);
511 dev->tx_queue_len = 0; 517 dev->tx_queue_len = 0;
512} 518}
513 519
@@ -705,7 +711,6 @@ int macvlan_link_register(struct rtnl_link_ops *ops)
705 /* common fields */ 711 /* common fields */
706 ops->priv_size = sizeof(struct macvlan_dev); 712 ops->priv_size = sizeof(struct macvlan_dev);
707 ops->get_tx_queues = macvlan_get_tx_queues; 713 ops->get_tx_queues = macvlan_get_tx_queues;
708 ops->setup = macvlan_setup;
709 ops->validate = macvlan_validate; 714 ops->validate = macvlan_validate;
710 ops->maxtype = IFLA_MACVLAN_MAX; 715 ops->maxtype = IFLA_MACVLAN_MAX;
711 ops->policy = macvlan_policy; 716 ops->policy = macvlan_policy;
@@ -719,6 +724,7 @@ EXPORT_SYMBOL_GPL(macvlan_link_register);
719 724
720static struct rtnl_link_ops macvlan_link_ops = { 725static struct rtnl_link_ops macvlan_link_ops = {
721 .kind = "macvlan", 726 .kind = "macvlan",
727 .setup = macvlan_setup,
722 .newlink = macvlan_newlink, 728 .newlink = macvlan_newlink,
723 .dellink = macvlan_dellink, 729 .dellink = macvlan_dellink,
724}; 730};
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index a8a94e2f6ddc..ff02b836c3c4 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -180,11 +180,18 @@ static int macvtap_forward(struct net_device *dev, struct sk_buff *skb)
180{ 180{
181 struct macvtap_queue *q = macvtap_get_queue(dev, skb); 181 struct macvtap_queue *q = macvtap_get_queue(dev, skb);
182 if (!q) 182 if (!q)
183 return -ENOLINK; 183 goto drop;
184
185 if (skb_queue_len(&q->sk.sk_receive_queue) >= dev->tx_queue_len)
186 goto drop;
184 187
185 skb_queue_tail(&q->sk.sk_receive_queue, skb); 188 skb_queue_tail(&q->sk.sk_receive_queue, skb);
186 wake_up_interruptible_poll(sk_sleep(&q->sk), POLLIN | POLLRDNORM | POLLRDBAND); 189 wake_up_interruptible_poll(sk_sleep(&q->sk), POLLIN | POLLRDNORM | POLLRDBAND);
187 return 0; 190 return NET_RX_SUCCESS;
191
192drop:
193 kfree_skb(skb);
194 return NET_RX_DROP;
188} 195}
189 196
190/* 197/*
@@ -235,8 +242,15 @@ static void macvtap_dellink(struct net_device *dev,
235 macvlan_dellink(dev, head); 242 macvlan_dellink(dev, head);
236} 243}
237 244
245static void macvtap_setup(struct net_device *dev)
246{
247 macvlan_common_setup(dev);
248 dev->tx_queue_len = TUN_READQ_SIZE;
249}
250
238static struct rtnl_link_ops macvtap_link_ops __read_mostly = { 251static struct rtnl_link_ops macvtap_link_ops __read_mostly = {
239 .kind = "macvtap", 252 .kind = "macvtap",
253 .setup = macvtap_setup,
240 .newlink = macvtap_newlink, 254 .newlink = macvtap_newlink,
241 .dellink = macvtap_dellink, 255 .dellink = macvtap_dellink,
242}; 256};
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 5b3dfb4ab279..33525bf2a3d3 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -1168,6 +1168,7 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id)
1168 int interrupts, nr_serviced = 0, i; 1168 int interrupts, nr_serviced = 0, i;
1169 struct ei_device *ei_local; 1169 struct ei_device *ei_local;
1170 int handled = 0; 1170 int handled = 0;
1171 unsigned long flags;
1171 1172
1172 e8390_base = dev->base_addr; 1173 e8390_base = dev->base_addr;
1173 ei_local = netdev_priv(dev); 1174 ei_local = netdev_priv(dev);
@@ -1176,7 +1177,7 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id)
1176 * Protect the irq test too. 1177 * Protect the irq test too.
1177 */ 1178 */
1178 1179
1179 spin_lock(&ei_local->page_lock); 1180 spin_lock_irqsave(&ei_local->page_lock, flags);
1180 1181
1181 if (ei_local->irqlock) 1182 if (ei_local->irqlock)
1182 { 1183 {
@@ -1188,7 +1189,7 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id)
1188 dev->name, inb_p(e8390_base + EN0_ISR), 1189 dev->name, inb_p(e8390_base + EN0_ISR),
1189 inb_p(e8390_base + EN0_IMR)); 1190 inb_p(e8390_base + EN0_IMR));
1190#endif 1191#endif
1191 spin_unlock(&ei_local->page_lock); 1192 spin_unlock_irqrestore(&ei_local->page_lock, flags);
1192 return IRQ_NONE; 1193 return IRQ_NONE;
1193 } 1194 }
1194 1195
@@ -1261,7 +1262,7 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id)
1261 ei_local->irqlock = 0; 1262 ei_local->irqlock = 0;
1262 outb_p(ENISR_ALL, e8390_base + EN0_IMR); 1263 outb_p(ENISR_ALL, e8390_base + EN0_IMR);
1263 1264
1264 spin_unlock(&ei_local->page_lock); 1265 spin_unlock_irqrestore(&ei_local->page_lock, flags);
1265 return IRQ_RETVAL(handled); 1266 return IRQ_RETVAL(handled);
1266} 1267}
1267 1268
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 96b6cfbf0a3a..cdc6a5c2e70d 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -1316,7 +1316,7 @@ static void rtl8169_get_mac_version(struct rtl8169_private *tp,
1316 { 0x7c800000, 0x28000000, RTL_GIGA_MAC_VER_26 }, 1316 { 0x7c800000, 0x28000000, RTL_GIGA_MAC_VER_26 },
1317 1317
1318 /* 8168C family. */ 1318 /* 8168C family. */
1319 { 0x7cf00000, 0x3ca00000, RTL_GIGA_MAC_VER_24 }, 1319 { 0x7cf00000, 0x3cb00000, RTL_GIGA_MAC_VER_24 },
1320 { 0x7cf00000, 0x3c900000, RTL_GIGA_MAC_VER_23 }, 1320 { 0x7cf00000, 0x3c900000, RTL_GIGA_MAC_VER_23 },
1321 { 0x7cf00000, 0x3c800000, RTL_GIGA_MAC_VER_18 }, 1321 { 0x7cf00000, 0x3c800000, RTL_GIGA_MAC_VER_18 },
1322 { 0x7c800000, 0x3c800000, RTL_GIGA_MAC_VER_24 }, 1322 { 0x7c800000, 0x3c800000, RTL_GIGA_MAC_VER_24 },
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h
index 5e52c75892df..7f3a53dcc6ef 100644
--- a/drivers/net/s2io.h
+++ b/drivers/net/s2io.h
@@ -65,7 +65,7 @@ static int debug_level = ERR_DBG;
65 65
66/* DEBUG message print. */ 66/* DEBUG message print. */
67#define DBG_PRINT(dbg_level, fmt, args...) do { \ 67#define DBG_PRINT(dbg_level, fmt, args...) do { \
68 if (dbg_level >= debug_level) \ 68 if (dbg_level <= debug_level) \
69 pr_info(fmt, ##args); \ 69 pr_info(fmt, ##args); \
70 } while (0) 70 } while (0)
71 71
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 6ad6fe706312..63042596f0cf 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -736,8 +736,18 @@ static __inline__ ssize_t tun_put_user(struct tun_struct *tun,
736 gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV6; 736 gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV6;
737 else if (sinfo->gso_type & SKB_GSO_UDP) 737 else if (sinfo->gso_type & SKB_GSO_UDP)
738 gso.gso_type = VIRTIO_NET_HDR_GSO_UDP; 738 gso.gso_type = VIRTIO_NET_HDR_GSO_UDP;
739 else 739 else {
740 BUG(); 740 printk(KERN_ERR "tun: unexpected GSO type: "
741 "0x%x, gso_size %d, hdr_len %d\n",
742 sinfo->gso_type, gso.gso_size,
743 gso.hdr_len);
744 print_hex_dump(KERN_ERR, "tun: ",
745 DUMP_PREFIX_NONE,
746 16, 1, skb->head,
747 min((int)gso.hdr_len, 64), true);
748 WARN_ON_ONCE(1);
749 return -EINVAL;
750 }
741 if (sinfo->gso_type & SKB_GSO_TCP_ECN) 751 if (sinfo->gso_type & SKB_GSO_TCP_ECN)
742 gso.gso_type |= VIRTIO_NET_HDR_GSO_ECN; 752 gso.gso_type |= VIRTIO_NET_HDR_GSO_ECN;
743 } else 753 } else
diff --git a/drivers/net/wimax/i2400m/i2400m-usb.h b/drivers/net/wimax/i2400m/i2400m-usb.h
index 2d7c96d7e865..eb80243e22df 100644
--- a/drivers/net/wimax/i2400m/i2400m-usb.h
+++ b/drivers/net/wimax/i2400m/i2400m-usb.h
@@ -152,6 +152,7 @@ enum {
152 /* Device IDs */ 152 /* Device IDs */
153 USB_DEVICE_ID_I6050 = 0x0186, 153 USB_DEVICE_ID_I6050 = 0x0186,
154 USB_DEVICE_ID_I6050_2 = 0x0188, 154 USB_DEVICE_ID_I6050_2 = 0x0188,
155 USB_DEVICE_ID_I6250 = 0x0187,
155}; 156};
156 157
157 158
diff --git a/drivers/net/wimax/i2400m/usb.c b/drivers/net/wimax/i2400m/usb.c
index 0d5081d77dc0..d3365ac85dde 100644
--- a/drivers/net/wimax/i2400m/usb.c
+++ b/drivers/net/wimax/i2400m/usb.c
@@ -491,6 +491,7 @@ int i2400mu_probe(struct usb_interface *iface,
491 switch (id->idProduct) { 491 switch (id->idProduct) {
492 case USB_DEVICE_ID_I6050: 492 case USB_DEVICE_ID_I6050:
493 case USB_DEVICE_ID_I6050_2: 493 case USB_DEVICE_ID_I6050_2:
494 case USB_DEVICE_ID_I6250:
494 i2400mu->i6050 = 1; 495 i2400mu->i6050 = 1;
495 break; 496 break;
496 default: 497 default:
@@ -739,6 +740,7 @@ static
739struct usb_device_id i2400mu_id_table[] = { 740struct usb_device_id i2400mu_id_table[] = {
740 { USB_DEVICE(0x8086, USB_DEVICE_ID_I6050) }, 741 { USB_DEVICE(0x8086, USB_DEVICE_ID_I6050) },
741 { USB_DEVICE(0x8086, USB_DEVICE_ID_I6050_2) }, 742 { USB_DEVICE(0x8086, USB_DEVICE_ID_I6050_2) },
743 { USB_DEVICE(0x8086, USB_DEVICE_ID_I6250) },
742 { USB_DEVICE(0x8086, 0x0181) }, 744 { USB_DEVICE(0x8086, 0x0181) },
743 { USB_DEVICE(0x8086, 0x1403) }, 745 { USB_DEVICE(0x8086, 0x1403) },
744 { USB_DEVICE(0x8086, 0x1405) }, 746 { USB_DEVICE(0x8086, 0x1405) },
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
index 77b359162d6c..23c15aa9fbd5 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -730,13 +730,17 @@ static int ath9k_hif_usb_alloc_urbs(struct hif_device_usb *hif_dev)
730 730
731 /* RX */ 731 /* RX */
732 if (ath9k_hif_usb_alloc_rx_urbs(hif_dev) < 0) 732 if (ath9k_hif_usb_alloc_rx_urbs(hif_dev) < 0)
733 goto err; 733 goto err_rx;
734 734
735 /* Register Read */ 735 /* Register Read */
736 if (ath9k_hif_usb_alloc_reg_in_urb(hif_dev) < 0) 736 if (ath9k_hif_usb_alloc_reg_in_urb(hif_dev) < 0)
737 goto err; 737 goto err_reg;
738 738
739 return 0; 739 return 0;
740err_reg:
741 ath9k_hif_usb_dealloc_rx_urbs(hif_dev);
742err_rx:
743 ath9k_hif_usb_dealloc_tx_urbs(hif_dev);
740err: 744err:
741 return -ENOMEM; 745 return -ENOMEM;
742} 746}
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index ca6065b71b46..e3e52913d83a 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -844,9 +844,9 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)
844 int dma_type; 844 int dma_type;
845 845
846 if (edma) 846 if (edma)
847 dma_type = DMA_FROM_DEVICE;
848 else
849 dma_type = DMA_BIDIRECTIONAL; 847 dma_type = DMA_BIDIRECTIONAL;
848 else
849 dma_type = DMA_FROM_DEVICE;
850 850
851 qtype = hp ? ATH9K_RX_QUEUE_HP : ATH9K_RX_QUEUE_LP; 851 qtype = hp ? ATH9K_RX_QUEUE_HP : ATH9K_RX_QUEUE_LP;
852 spin_lock_bh(&sc->rx.rxbuflock); 852 spin_lock_bh(&sc->rx.rxbuflock);
diff --git a/drivers/net/wireless/hostap/hostap_pci.c b/drivers/net/wireless/hostap/hostap_pci.c
index d24dc7dc0723..972a9c3af39e 100644
--- a/drivers/net/wireless/hostap/hostap_pci.c
+++ b/drivers/net/wireless/hostap/hostap_pci.c
@@ -330,6 +330,7 @@ static int prism2_pci_probe(struct pci_dev *pdev,
330 330
331 dev->irq = pdev->irq; 331 dev->irq = pdev->irq;
332 hw_priv->mem_start = mem; 332 hw_priv->mem_start = mem;
333 dev->base_addr = (unsigned long) mem;
333 334
334 prism2_pci_cor_sreset(local); 335 prism2_pci_cor_sreset(local);
335 336
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.h b/drivers/net/wireless/iwlwifi/iwl-sta.h
index c2a453a1a991..dc43ebd1f1fd 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.h
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.h
@@ -97,6 +97,17 @@ static inline void iwl_clear_driver_stations(struct iwl_priv *priv)
97 spin_lock_irqsave(&priv->sta_lock, flags); 97 spin_lock_irqsave(&priv->sta_lock, flags);
98 memset(priv->stations, 0, sizeof(priv->stations)); 98 memset(priv->stations, 0, sizeof(priv->stations));
99 priv->num_stations = 0; 99 priv->num_stations = 0;
100
101 /*
102 * Remove all key information that is not stored as part of station
103 * information since mac80211 may not have had a
104 * chance to remove all the keys. When device is reconfigured by
105 * mac80211 after an error all keys will be reconfigured.
106 */
107 priv->ucode_key_table = 0;
108 priv->key_mapping_key = 0;
109 memset(priv->wep_keys, 0, sizeof(priv->wep_keys));
110
100 spin_unlock_irqrestore(&priv->sta_lock, flags); 111 spin_unlock_irqrestore(&priv->sta_lock, flags);
101} 112}
102 113
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 3ae468c4d760..f20d3eeeea7f 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -854,6 +854,11 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
854 BIT(NL80211_IFTYPE_WDS); 854 BIT(NL80211_IFTYPE_WDS);
855 855
856 /* 856 /*
857 * Initialize configuration work.
858 */
859 INIT_WORK(&rt2x00dev->intf_work, rt2x00lib_intf_scheduled);
860
861 /*
857 * Let the driver probe the device to detect the capabilities. 862 * Let the driver probe the device to detect the capabilities.
858 */ 863 */
859 retval = rt2x00dev->ops->lib->probe_hw(rt2x00dev); 864 retval = rt2x00dev->ops->lib->probe_hw(rt2x00dev);
@@ -863,11 +868,6 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
863 } 868 }
864 869
865 /* 870 /*
866 * Initialize configuration work.
867 */
868 INIT_WORK(&rt2x00dev->intf_work, rt2x00lib_intf_scheduled);
869
870 /*
871 * Allocate queue array. 871 * Allocate queue array.
872 */ 872 */
873 retval = rt2x00queue_allocate(rt2x00dev); 873 retval = rt2x00queue_allocate(rt2x00dev);
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index 92379e2d37e7..2aaa13150de3 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -156,6 +156,38 @@ static int __pci_assign_resource(struct pci_bus *bus, struct pci_dev *dev,
156 pcibios_align_resource, dev); 156 pcibios_align_resource, dev);
157 } 157 }
158 158
159 if (ret < 0 && dev->fw_addr[resno]) {
160 struct resource *root, *conflict;
161 resource_size_t start, end;
162
163 /*
164 * If we failed to assign anything, let's try the address
165 * where firmware left it. That at least has a chance of
166 * working, which is better than just leaving it disabled.
167 */
168
169 if (res->flags & IORESOURCE_IO)
170 root = &ioport_resource;
171 else
172 root = &iomem_resource;
173
174 start = res->start;
175 end = res->end;
176 res->start = dev->fw_addr[resno];
177 res->end = res->start + size - 1;
178 dev_info(&dev->dev, "BAR %d: trying firmware assignment %pR\n",
179 resno, res);
180 conflict = request_resource_conflict(root, res);
181 if (conflict) {
182 dev_info(&dev->dev,
183 "BAR %d: %pR conflicts with %s %pR\n", resno,
184 res, conflict->name, conflict);
185 res->start = start;
186 res->end = end;
187 } else
188 ret = 0;
189 }
190
159 if (!ret) { 191 if (!ret) {
160 res->flags &= ~IORESOURCE_STARTALIGN; 192 res->flags &= ~IORESOURCE_STARTALIGN;
161 dev_info(&dev->dev, "BAR %d: assigned %pR\n", resno, res); 193 dev_info(&dev->dev, "BAR %d: assigned %pR\n", resno, res);
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index 29f91fac1dff..a4cd9adfcbc0 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -857,8 +857,10 @@ void pcmcia_disable_device(struct pcmcia_device *p_dev)
857{ 857{
858 pcmcia_release_configuration(p_dev); 858 pcmcia_release_configuration(p_dev);
859 pcmcia_release_io(p_dev, &p_dev->io); 859 pcmcia_release_io(p_dev, &p_dev->io);
860 if (p_dev->_irq) 860 if (p_dev->_irq) {
861 free_irq(p_dev->irq, p_dev->priv); 861 free_irq(p_dev->irq, p_dev->priv);
862 p_dev->_irq = 0;
863 }
862 if (p_dev->win) 864 if (p_dev->win)
863 pcmcia_release_window(p_dev, p_dev->win); 865 pcmcia_release_window(p_dev, p_dev->win);
864} 866}
diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c
index df4532e91b1a..f370476d5417 100644
--- a/drivers/pcmcia/pxa2xx_base.c
+++ b/drivers/pcmcia/pxa2xx_base.c
@@ -178,7 +178,6 @@ pxa2xx_pcmcia_frequency_change(struct soc_pcmcia_socket *skt,
178 unsigned long val, 178 unsigned long val,
179 struct cpufreq_freqs *freqs) 179 struct cpufreq_freqs *freqs)
180{ 180{
181#warning "it's not clear if this is right since the core CPU (N) clock has no effect on the memory (L) clock"
182 switch (val) { 181 switch (val) {
183 case CPUFREQ_PRECHANGE: 182 case CPUFREQ_PRECHANGE:
184 if (freqs->new > freqs->old) { 183 if (freqs->new > freqs->old) {
@@ -186,7 +185,7 @@ pxa2xx_pcmcia_frequency_change(struct soc_pcmcia_socket *skt,
186 "pre-updating\n", 185 "pre-updating\n",
187 freqs->new / 1000, (freqs->new / 100) % 10, 186 freqs->new / 1000, (freqs->new / 100) % 10,
188 freqs->old / 1000, (freqs->old / 100) % 10); 187 freqs->old / 1000, (freqs->old / 100) % 10);
189 pxa2xx_pcmcia_set_mcxx(skt, freqs->new); 188 pxa2xx_pcmcia_set_timing(skt);
190 } 189 }
191 break; 190 break;
192 191
@@ -196,7 +195,7 @@ pxa2xx_pcmcia_frequency_change(struct soc_pcmcia_socket *skt,
196 "post-updating\n", 195 "post-updating\n",
197 freqs->new / 1000, (freqs->new / 100) % 10, 196 freqs->new / 1000, (freqs->new / 100) % 10,
198 freqs->old / 1000, (freqs->old / 100) % 10); 197 freqs->old / 1000, (freqs->old / 100) % 10);
199 pxa2xx_pcmcia_set_mcxx(skt, freqs->new); 198 pxa2xx_pcmcia_set_timing(skt);
200 } 199 }
201 break; 200 break;
202 } 201 }
diff --git a/drivers/platform/x86/intel_scu_ipc.c b/drivers/platform/x86/intel_scu_ipc.c
index 40658e3385b4..bb2f1fba637b 100644
--- a/drivers/platform/x86/intel_scu_ipc.c
+++ b/drivers/platform/x86/intel_scu_ipc.c
@@ -489,7 +489,7 @@ int intel_scu_ipc_simple_command(int cmd, int sub)
489 mutex_unlock(&ipclock); 489 mutex_unlock(&ipclock);
490 return -ENODEV; 490 return -ENODEV;
491 } 491 }
492 ipc_command(cmd << 12 | sub); 492 ipc_command(sub << 12 | cmd);
493 err = busy_loop(); 493 err = busy_loop();
494 mutex_unlock(&ipclock); 494 mutex_unlock(&ipclock);
495 return err; 495 return err;
@@ -501,9 +501,9 @@ EXPORT_SYMBOL(intel_scu_ipc_simple_command);
501 * @cmd: command 501 * @cmd: command
502 * @sub: sub type 502 * @sub: sub type
503 * @in: input data 503 * @in: input data
504 * @inlen: input length 504 * @inlen: input length in dwords
505 * @out: output data 505 * @out: output data
506 * @outlein: output length 506 * @outlein: output length in dwords
507 * 507 *
508 * Issue a command to the SCU which involves data transfers. Do the 508 * Issue a command to the SCU which involves data transfers. Do the
509 * data copies under the lock but leave it for the caller to interpret 509 * data copies under the lock but leave it for the caller to interpret
@@ -524,7 +524,7 @@ int intel_scu_ipc_command(int cmd, int sub, u32 *in, int inlen,
524 for (i = 0; i < inlen; i++) 524 for (i = 0; i < inlen; i++)
525 ipc_data_writel(*in++, 4 * i); 525 ipc_data_writel(*in++, 4 * i);
526 526
527 ipc_command((cmd << 12) | sub | (inlen << 18)); 527 ipc_command((sub << 12) | cmd | (inlen << 18));
528 err = busy_loop(); 528 err = busy_loop();
529 529
530 for (i = 0; i < outlen; i++) 530 for (i = 0; i < outlen; i++)
@@ -556,6 +556,10 @@ int intel_scu_ipc_i2c_cntrl(u32 addr, u32 *data)
556 u32 cmd = 0; 556 u32 cmd = 0;
557 557
558 mutex_lock(&ipclock); 558 mutex_lock(&ipclock);
559 if (ipcdev.pdev == NULL) {
560 mutex_unlock(&ipclock);
561 return -ENODEV;
562 }
559 cmd = (addr >> 24) & 0xFF; 563 cmd = (addr >> 24) & 0xFF;
560 if (cmd == IPC_I2C_READ) { 564 if (cmd == IPC_I2C_READ) {
561 writel(addr, ipcdev.i2c_base + IPC_I2C_CNTRL_ADDR); 565 writel(addr, ipcdev.i2c_base + IPC_I2C_CNTRL_ADDR);
diff --git a/drivers/power/ds2782_battery.c b/drivers/power/ds2782_battery.c
index d762a0cbc6af..84d3c43cf2bc 100644
--- a/drivers/power/ds2782_battery.c
+++ b/drivers/power/ds2782_battery.c
@@ -43,10 +43,9 @@
43struct ds278x_info; 43struct ds278x_info;
44 44
45struct ds278x_battery_ops { 45struct ds278x_battery_ops {
46 int (*get_current)(struct ds278x_info *info, int *current_uA); 46 int (*get_battery_current)(struct ds278x_info *info, int *current_uA);
47 int (*get_voltage)(struct ds278x_info *info, int *voltage_uA); 47 int (*get_battery_voltage)(struct ds278x_info *info, int *voltage_uA);
48 int (*get_capacity)(struct ds278x_info *info, int *capacity_uA); 48 int (*get_battery_capacity)(struct ds278x_info *info, int *capacity_uA);
49
50}; 49};
51 50
52#define to_ds278x_info(x) container_of(x, struct ds278x_info, battery) 51#define to_ds278x_info(x) container_of(x, struct ds278x_info, battery)
@@ -163,7 +162,7 @@ static int ds2782_get_capacity(struct ds278x_info *info, int *capacity)
163 if (err) 162 if (err)
164 return err; 163 return err;
165 *capacity = raw; 164 *capacity = raw;
166 return raw; 165 return 0;
167} 166}
168 167
169static int ds2786_get_current(struct ds278x_info *info, int *current_uA) 168static int ds2786_get_current(struct ds278x_info *info, int *current_uA)
@@ -213,11 +212,11 @@ static int ds278x_get_status(struct ds278x_info *info, int *status)
213 int current_uA; 212 int current_uA;
214 int capacity; 213 int capacity;
215 214
216 err = info->ops->get_current(info, &current_uA); 215 err = info->ops->get_battery_current(info, &current_uA);
217 if (err) 216 if (err)
218 return err; 217 return err;
219 218
220 err = info->ops->get_capacity(info, &capacity); 219 err = info->ops->get_battery_capacity(info, &capacity);
221 if (err) 220 if (err)
222 return err; 221 return err;
223 222
@@ -246,15 +245,15 @@ static int ds278x_battery_get_property(struct power_supply *psy,
246 break; 245 break;
247 246
248 case POWER_SUPPLY_PROP_CAPACITY: 247 case POWER_SUPPLY_PROP_CAPACITY:
249 ret = info->ops->get_capacity(info, &val->intval); 248 ret = info->ops->get_battery_capacity(info, &val->intval);
250 break; 249 break;
251 250
252 case POWER_SUPPLY_PROP_VOLTAGE_NOW: 251 case POWER_SUPPLY_PROP_VOLTAGE_NOW:
253 ret = info->ops->get_voltage(info, &val->intval); 252 ret = info->ops->get_battery_voltage(info, &val->intval);
254 break; 253 break;
255 254
256 case POWER_SUPPLY_PROP_CURRENT_NOW: 255 case POWER_SUPPLY_PROP_CURRENT_NOW:
257 ret = info->ops->get_current(info, &val->intval); 256 ret = info->ops->get_battery_current(info, &val->intval);
258 break; 257 break;
259 258
260 case POWER_SUPPLY_PROP_TEMP: 259 case POWER_SUPPLY_PROP_TEMP:
@@ -307,14 +306,14 @@ enum ds278x_num_id {
307 306
308static struct ds278x_battery_ops ds278x_ops[] = { 307static struct ds278x_battery_ops ds278x_ops[] = {
309 [DS2782] = { 308 [DS2782] = {
310 .get_current = ds2782_get_current, 309 .get_battery_current = ds2782_get_current,
311 .get_voltage = ds2782_get_voltage, 310 .get_battery_voltage = ds2782_get_voltage,
312 .get_capacity = ds2782_get_capacity, 311 .get_battery_capacity = ds2782_get_capacity,
313 }, 312 },
314 [DS2786] = { 313 [DS2786] = {
315 .get_current = ds2786_get_current, 314 .get_battery_current = ds2786_get_current,
316 .get_voltage = ds2786_get_voltage, 315 .get_battery_voltage = ds2786_get_voltage,
317 .get_capacity = ds2786_get_capacity, 316 .get_battery_capacity = ds2786_get_capacity,
318 } 317 }
319}; 318};
320 319
diff --git a/drivers/regulator/ab3100.c b/drivers/regulator/ab3100.c
index 7b14a67bdca2..11790990277a 100644
--- a/drivers/regulator/ab3100.c
+++ b/drivers/regulator/ab3100.c
@@ -286,7 +286,7 @@ static int ab3100_list_voltage_regulator(struct regulator_dev *reg,
286{ 286{
287 struct ab3100_regulator *abreg = reg->reg_data; 287 struct ab3100_regulator *abreg = reg->reg_data;
288 288
289 if (selector > abreg->voltages_len) 289 if (selector >= abreg->voltages_len)
290 return -EINVAL; 290 return -EINVAL;
291 return abreg->typ_voltages[selector]; 291 return abreg->typ_voltages[selector];
292} 292}
@@ -318,7 +318,7 @@ static int ab3100_get_voltage_regulator(struct regulator_dev *reg)
318 regval &= 0xE0; 318 regval &= 0xE0;
319 regval >>= 5; 319 regval >>= 5;
320 320
321 if (regval > abreg->voltages_len) { 321 if (regval >= abreg->voltages_len) {
322 dev_err(&reg->dev, 322 dev_err(&reg->dev,
323 "regulator register %02x contains an illegal voltage setting\n", 323 "regulator register %02x contains an illegal voltage setting\n",
324 abreg->regreg); 324 abreg->regreg);
diff --git a/drivers/regulator/tps6507x-regulator.c b/drivers/regulator/tps6507x-regulator.c
index 14b4576281c5..8152d65220f5 100644
--- a/drivers/regulator/tps6507x-regulator.c
+++ b/drivers/regulator/tps6507x-regulator.c
@@ -22,6 +22,7 @@
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/regulator/driver.h> 23#include <linux/regulator/driver.h>
24#include <linux/regulator/machine.h> 24#include <linux/regulator/machine.h>
25#include <linux/regulator/tps6507x.h>
25#include <linux/delay.h> 26#include <linux/delay.h>
26#include <linux/slab.h> 27#include <linux/slab.h>
27#include <linux/mfd/tps6507x.h> 28#include <linux/mfd/tps6507x.h>
@@ -101,9 +102,12 @@ struct tps_info {
101 unsigned max_uV; 102 unsigned max_uV;
102 u8 table_len; 103 u8 table_len;
103 const u16 *table; 104 const u16 *table;
105
106 /* Does DCDC high or the low register defines output voltage? */
107 bool defdcdc_default;
104}; 108};
105 109
106static const struct tps_info tps6507x_pmic_regs[] = { 110static struct tps_info tps6507x_pmic_regs[] = {
107 { 111 {
108 .name = "VDCDC1", 112 .name = "VDCDC1",
109 .min_uV = 725000, 113 .min_uV = 725000,
@@ -145,7 +149,7 @@ struct tps6507x_pmic {
145 struct regulator_desc desc[TPS6507X_NUM_REGULATOR]; 149 struct regulator_desc desc[TPS6507X_NUM_REGULATOR];
146 struct tps6507x_dev *mfd; 150 struct tps6507x_dev *mfd;
147 struct regulator_dev *rdev[TPS6507X_NUM_REGULATOR]; 151 struct regulator_dev *rdev[TPS6507X_NUM_REGULATOR];
148 const struct tps_info *info[TPS6507X_NUM_REGULATOR]; 152 struct tps_info *info[TPS6507X_NUM_REGULATOR];
149 struct mutex io_lock; 153 struct mutex io_lock;
150}; 154};
151static inline int tps6507x_pmic_read(struct tps6507x_pmic *tps, u8 reg) 155static inline int tps6507x_pmic_read(struct tps6507x_pmic *tps, u8 reg)
@@ -341,10 +345,16 @@ static int tps6507x_pmic_dcdc_get_voltage(struct regulator_dev *dev)
341 reg = TPS6507X_REG_DEFDCDC1; 345 reg = TPS6507X_REG_DEFDCDC1;
342 break; 346 break;
343 case TPS6507X_DCDC_2: 347 case TPS6507X_DCDC_2:
344 reg = TPS6507X_REG_DEFDCDC2_LOW; 348 if (tps->info[dcdc]->defdcdc_default)
349 reg = TPS6507X_REG_DEFDCDC2_HIGH;
350 else
351 reg = TPS6507X_REG_DEFDCDC2_LOW;
345 break; 352 break;
346 case TPS6507X_DCDC_3: 353 case TPS6507X_DCDC_3:
347 reg = TPS6507X_REG_DEFDCDC3_LOW; 354 if (tps->info[dcdc]->defdcdc_default)
355 reg = TPS6507X_REG_DEFDCDC3_HIGH;
356 else
357 reg = TPS6507X_REG_DEFDCDC3_LOW;
348 break; 358 break;
349 default: 359 default:
350 return -EINVAL; 360 return -EINVAL;
@@ -370,10 +380,16 @@ static int tps6507x_pmic_dcdc_set_voltage(struct regulator_dev *dev,
370 reg = TPS6507X_REG_DEFDCDC1; 380 reg = TPS6507X_REG_DEFDCDC1;
371 break; 381 break;
372 case TPS6507X_DCDC_2: 382 case TPS6507X_DCDC_2:
373 reg = TPS6507X_REG_DEFDCDC2_LOW; 383 if (tps->info[dcdc]->defdcdc_default)
384 reg = TPS6507X_REG_DEFDCDC2_HIGH;
385 else
386 reg = TPS6507X_REG_DEFDCDC2_LOW;
374 break; 387 break;
375 case TPS6507X_DCDC_3: 388 case TPS6507X_DCDC_3:
376 reg = TPS6507X_REG_DEFDCDC3_LOW; 389 if (tps->info[dcdc]->defdcdc_default)
390 reg = TPS6507X_REG_DEFDCDC3_HIGH;
391 else
392 reg = TPS6507X_REG_DEFDCDC3_LOW;
377 break; 393 break;
378 default: 394 default:
379 return -EINVAL; 395 return -EINVAL;
@@ -532,7 +548,7 @@ int tps6507x_pmic_probe(struct platform_device *pdev)
532{ 548{
533 struct tps6507x_dev *tps6507x_dev = dev_get_drvdata(pdev->dev.parent); 549 struct tps6507x_dev *tps6507x_dev = dev_get_drvdata(pdev->dev.parent);
534 static int desc_id; 550 static int desc_id;
535 const struct tps_info *info = &tps6507x_pmic_regs[0]; 551 struct tps_info *info = &tps6507x_pmic_regs[0];
536 struct regulator_init_data *init_data; 552 struct regulator_init_data *init_data;
537 struct regulator_dev *rdev; 553 struct regulator_dev *rdev;
538 struct tps6507x_pmic *tps; 554 struct tps6507x_pmic *tps;
@@ -569,6 +585,12 @@ int tps6507x_pmic_probe(struct platform_device *pdev)
569 for (i = 0; i < TPS6507X_NUM_REGULATOR; i++, info++, init_data++) { 585 for (i = 0; i < TPS6507X_NUM_REGULATOR; i++, info++, init_data++) {
570 /* Register the regulators */ 586 /* Register the regulators */
571 tps->info[i] = info; 587 tps->info[i] = info;
588 if (init_data->driver_data) {
589 struct tps6507x_reg_platform_data *data =
590 init_data->driver_data;
591 tps->info[i]->defdcdc_default = data->defdcdc_default;
592 }
593
572 tps->desc[i].name = info->name; 594 tps->desc[i].name = info->name;
573 tps->desc[i].id = desc_id++; 595 tps->desc[i].id = desc_id++;
574 tps->desc[i].n_voltages = num_voltages[i]; 596 tps->desc[i].n_voltages = num_voltages[i];
diff --git a/drivers/regulator/wm8350-regulator.c b/drivers/regulator/wm8350-regulator.c
index 723cd1fb4867..0e6ed7db9364 100644
--- a/drivers/regulator/wm8350-regulator.c
+++ b/drivers/regulator/wm8350-regulator.c
@@ -1495,7 +1495,7 @@ int wm8350_register_regulator(struct wm8350 *wm8350, int reg,
1495 if (ret != 0) { 1495 if (ret != 0) {
1496 dev_err(wm8350->dev, "Failed to register regulator %d: %d\n", 1496 dev_err(wm8350->dev, "Failed to register regulator %d: %d\n",
1497 reg, ret); 1497 reg, ret);
1498 platform_device_del(pdev); 1498 platform_device_put(pdev);
1499 wm8350->pmic.pdev[reg] = NULL; 1499 wm8350->pmic.pdev[reg] = NULL;
1500 } 1500 }
1501 1501
diff --git a/drivers/rtc/rtc-rx8581.c b/drivers/rtc/rtc-rx8581.c
index 9718aaaa8215..600b890a3c15 100644
--- a/drivers/rtc/rtc-rx8581.c
+++ b/drivers/rtc/rtc-rx8581.c
@@ -168,7 +168,7 @@ static int rx8581_set_datetime(struct i2c_client *client, struct rtc_time *tm)
168 return -EIO; 168 return -EIO;
169 } 169 }
170 170
171 err = i2c_smbus_write_byte_data(client, RX8581_REG_FLAG, 171 err = i2c_smbus_write_byte_data(client, RX8581_REG_CTRL,
172 (data | RX8581_CTRL_STOP)); 172 (data | RX8581_CTRL_STOP));
173 if (err < 0) { 173 if (err < 0) {
174 dev_err(&client->dev, "Unable to write control register\n"); 174 dev_err(&client->dev, "Unable to write control register\n");
@@ -182,6 +182,20 @@ static int rx8581_set_datetime(struct i2c_client *client, struct rtc_time *tm)
182 return -EIO; 182 return -EIO;
183 } 183 }
184 184
185 /* get VLF and clear it */
186 data = i2c_smbus_read_byte_data(client, RX8581_REG_FLAG);
187 if (data < 0) {
188 dev_err(&client->dev, "Unable to read flag register\n");
189 return -EIO;
190 }
191
192 err = i2c_smbus_write_byte_data(client, RX8581_REG_FLAG,
193 (data & ~(RX8581_FLAG_VLF)));
194 if (err != 0) {
195 dev_err(&client->dev, "Unable to write flag register\n");
196 return -EIO;
197 }
198
185 /* Restart the clock */ 199 /* Restart the clock */
186 data = i2c_smbus_read_byte_data(client, RX8581_REG_CTRL); 200 data = i2c_smbus_read_byte_data(client, RX8581_REG_CTRL);
187 if (data < 0) { 201 if (data < 0) {
@@ -189,8 +203,8 @@ static int rx8581_set_datetime(struct i2c_client *client, struct rtc_time *tm)
189 return -EIO; 203 return -EIO;
190 } 204 }
191 205
192 err = i2c_smbus_write_byte_data(client, RX8581_REG_FLAG, 206 err = i2c_smbus_write_byte_data(client, RX8581_REG_CTRL,
193 (data | ~(RX8581_CTRL_STOP))); 207 (data & ~(RX8581_CTRL_STOP)));
194 if (err != 0) { 208 if (err != 0) {
195 dev_err(&client->dev, "Unable to write control register\n"); 209 dev_err(&client->dev, "Unable to write control register\n");
196 return -EIO; 210 return -EIO;
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c
index 34d51dd4c539..bed7b4634ccd 100644
--- a/drivers/s390/block/dasd_devmap.c
+++ b/drivers/s390/block/dasd_devmap.c
@@ -948,8 +948,10 @@ static ssize_t dasd_alias_show(struct device *dev,
948 if (device->discipline && device->discipline->get_uid && 948 if (device->discipline && device->discipline->get_uid &&
949 !device->discipline->get_uid(device, &uid)) { 949 !device->discipline->get_uid(device, &uid)) {
950 if (uid.type == UA_BASE_PAV_ALIAS || 950 if (uid.type == UA_BASE_PAV_ALIAS ||
951 uid.type == UA_HYPER_PAV_ALIAS) 951 uid.type == UA_HYPER_PAV_ALIAS) {
952 dasd_put_device(device);
952 return sprintf(buf, "1\n"); 953 return sprintf(buf, "1\n");
954 }
953 } 955 }
954 dasd_put_device(device); 956 dasd_put_device(device);
955 957
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c
index ce7cb87479fe..407d0e9adfaf 100644
--- a/drivers/s390/cio/chsc.c
+++ b/drivers/s390/cio/chsc.c
@@ -713,7 +713,7 @@ int chsc_determine_base_channel_path_desc(struct chp_id chpid,
713 ret = chsc_determine_channel_path_desc(chpid, 0, 0, 0, 0, chsc_resp); 713 ret = chsc_determine_channel_path_desc(chpid, 0, 0, 0, 0, chsc_resp);
714 if (ret) 714 if (ret)
715 goto out_free; 715 goto out_free;
716 memcpy(desc, &chsc_resp->data, chsc_resp->length); 716 memcpy(desc, &chsc_resp->data, sizeof(*desc));
717out_free: 717out_free:
718 kfree(chsc_resp); 718 kfree(chsc_resp);
719 return ret; 719 return ret;
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index e3dbeda97179..fd068bc1bd0a 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -714,6 +714,14 @@ static int zfcp_erp_adapter_strategy_open_fsf(struct zfcp_erp_action *act)
714 if (zfcp_erp_adapter_strategy_open_fsf_xport(act) == ZFCP_ERP_FAILED) 714 if (zfcp_erp_adapter_strategy_open_fsf_xport(act) == ZFCP_ERP_FAILED)
715 return ZFCP_ERP_FAILED; 715 return ZFCP_ERP_FAILED;
716 716
717 if (mempool_resize(act->adapter->pool.status_read_data,
718 act->adapter->stat_read_buf_num, GFP_KERNEL))
719 return ZFCP_ERP_FAILED;
720
721 if (mempool_resize(act->adapter->pool.status_read_req,
722 act->adapter->stat_read_buf_num, GFP_KERNEL))
723 return ZFCP_ERP_FAILED;
724
717 atomic_set(&act->adapter->stat_miss, act->adapter->stat_read_buf_num); 725 atomic_set(&act->adapter->stat_miss, act->adapter->stat_read_buf_num);
718 if (zfcp_status_read_refill(act->adapter)) 726 if (zfcp_status_read_refill(act->adapter))
719 return ZFCP_ERP_FAILED; 727 return ZFCP_ERP_FAILED;
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 9ac6a6e4a604..71663fb77310 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -496,7 +496,8 @@ static int zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *req)
496 496
497 adapter->hydra_version = bottom->adapter_type; 497 adapter->hydra_version = bottom->adapter_type;
498 adapter->timer_ticks = bottom->timer_interval; 498 adapter->timer_ticks = bottom->timer_interval;
499 adapter->stat_read_buf_num = max(bottom->status_read_buf_num, (u16)16); 499 adapter->stat_read_buf_num = max(bottom->status_read_buf_num,
500 (u16)FSF_STATUS_READS_RECOM);
500 501
501 if (fc_host_permanent_port_name(shost) == -1) 502 if (fc_host_permanent_port_name(shost) == -1)
502 fc_host_permanent_port_name(shost) = fc_host_port_name(shost); 503 fc_host_permanent_port_name(shost) = fc_host_port_name(shost);
@@ -719,11 +720,6 @@ static struct zfcp_fsf_req *zfcp_fsf_req_create(struct zfcp_qdio *qdio,
719 zfcp_qdio_req_init(adapter->qdio, &req->qdio_req, req->req_id, sbtype, 720 zfcp_qdio_req_init(adapter->qdio, &req->qdio_req, req->req_id, sbtype,
720 req->qtcb, sizeof(struct fsf_qtcb)); 721 req->qtcb, sizeof(struct fsf_qtcb));
721 722
722 if (!(atomic_read(&adapter->status) & ZFCP_STATUS_ADAPTER_QDIOUP)) {
723 zfcp_fsf_req_free(req);
724 return ERR_PTR(-EIO);
725 }
726
727 return req; 723 return req;
728} 724}
729 725
@@ -981,7 +977,7 @@ static int zfcp_fsf_setup_ct_els_sbals(struct zfcp_fsf_req *req,
981 } 977 }
982 978
983 /* use single, unchained SBAL if it can hold the request */ 979 /* use single, unchained SBAL if it can hold the request */
984 if (zfcp_qdio_sg_one_sbale(sg_req) || zfcp_qdio_sg_one_sbale(sg_resp)) { 980 if (zfcp_qdio_sg_one_sbale(sg_req) && zfcp_qdio_sg_one_sbale(sg_resp)) {
985 zfcp_fsf_setup_ct_els_unchained(adapter->qdio, &req->qdio_req, 981 zfcp_fsf_setup_ct_els_unchained(adapter->qdio, &req->qdio_req,
986 sg_req, sg_resp); 982 sg_req, sg_resp);
987 return 0; 983 return 0;
diff --git a/drivers/s390/scsi/zfcp_qdio.c b/drivers/s390/scsi/zfcp_qdio.c
index 28117e130e2c..6fa5e0453176 100644
--- a/drivers/s390/scsi/zfcp_qdio.c
+++ b/drivers/s390/scsi/zfcp_qdio.c
@@ -251,7 +251,8 @@ static int zfcp_qdio_sbal_check(struct zfcp_qdio *qdio)
251 struct zfcp_qdio_queue *req_q = &qdio->req_q; 251 struct zfcp_qdio_queue *req_q = &qdio->req_q;
252 252
253 spin_lock_bh(&qdio->req_q_lock); 253 spin_lock_bh(&qdio->req_q_lock);
254 if (atomic_read(&req_q->count)) 254 if (atomic_read(&req_q->count) ||
255 !(atomic_read(&qdio->adapter->status) & ZFCP_STATUS_ADAPTER_QDIOUP))
255 return 1; 256 return 1;
256 spin_unlock_bh(&qdio->req_q_lock); 257 spin_unlock_bh(&qdio->req_q_lock);
257 return 0; 258 return 0;
@@ -274,8 +275,13 @@ int zfcp_qdio_sbal_get(struct zfcp_qdio *qdio)
274 spin_unlock_bh(&qdio->req_q_lock); 275 spin_unlock_bh(&qdio->req_q_lock);
275 ret = wait_event_interruptible_timeout(qdio->req_q_wq, 276 ret = wait_event_interruptible_timeout(qdio->req_q_wq,
276 zfcp_qdio_sbal_check(qdio), 5 * HZ); 277 zfcp_qdio_sbal_check(qdio), 5 * HZ);
278
279 if (!(atomic_read(&qdio->adapter->status) & ZFCP_STATUS_ADAPTER_QDIOUP))
280 return -EIO;
281
277 if (ret > 0) 282 if (ret > 0)
278 return 0; 283 return 0;
284
279 if (!ret) { 285 if (!ret) {
280 atomic_inc(&qdio->req_q_full); 286 atomic_inc(&qdio->req_q_full);
281 /* assume hanging outbound queue, try queue recovery */ 287 /* assume hanging outbound queue, try queue recovery */
@@ -375,6 +381,8 @@ void zfcp_qdio_close(struct zfcp_qdio *qdio)
375 atomic_clear_mask(ZFCP_STATUS_ADAPTER_QDIOUP, &qdio->adapter->status); 381 atomic_clear_mask(ZFCP_STATUS_ADAPTER_QDIOUP, &qdio->adapter->status);
376 spin_unlock_bh(&qdio->req_q_lock); 382 spin_unlock_bh(&qdio->req_q_lock);
377 383
384 wake_up(&qdio->req_q_wq);
385
378 qdio_shutdown(qdio->adapter->ccw_device, 386 qdio_shutdown(qdio->adapter->ccw_device,
379 QDIO_FLAG_CLEANUP_USING_CLEAR); 387 QDIO_FLAG_CLEANUP_USING_CLEAR);
380 388
diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c
index d53e62ab09da..aacbe14e2e7a 100644
--- a/drivers/sbus/char/openprom.c
+++ b/drivers/sbus/char/openprom.c
@@ -554,7 +554,7 @@ static int opiocgetnext(unsigned int cmd, void __user *argp)
554static int openprom_bsd_ioctl(struct file * file, 554static int openprom_bsd_ioctl(struct file * file,
555 unsigned int cmd, unsigned long arg) 555 unsigned int cmd, unsigned long arg)
556{ 556{
557 DATA *data = (DATA *) file->private_data; 557 DATA *data = file->private_data;
558 void __user *argp = (void __user *)arg; 558 void __user *argp = (void __user *)arg;
559 int err; 559 int err;
560 560
@@ -601,7 +601,7 @@ static int openprom_bsd_ioctl(struct file * file,
601static long openprom_ioctl(struct file * file, 601static long openprom_ioctl(struct file * file,
602 unsigned int cmd, unsigned long arg) 602 unsigned int cmd, unsigned long arg)
603{ 603{
604 DATA *data = (DATA *) file->private_data; 604 DATA *data = file->private_data;
605 605
606 switch (cmd) { 606 switch (cmd) {
607 case OPROMGETOPT: 607 case OPROMGETOPT:
diff --git a/drivers/scsi/ibmvscsi/rpa_vscsi.c b/drivers/scsi/ibmvscsi/rpa_vscsi.c
index a864ccc0a342..989b9a8ba72d 100644
--- a/drivers/scsi/ibmvscsi/rpa_vscsi.c
+++ b/drivers/scsi/ibmvscsi/rpa_vscsi.c
@@ -277,6 +277,12 @@ static int rpavscsi_init_crq_queue(struct crq_queue *queue,
277 goto reg_crq_failed; 277 goto reg_crq_failed;
278 } 278 }
279 279
280 queue->cur = 0;
281 spin_lock_init(&queue->lock);
282
283 tasklet_init(&hostdata->srp_task, (void *)rpavscsi_task,
284 (unsigned long)hostdata);
285
280 if (request_irq(vdev->irq, 286 if (request_irq(vdev->irq,
281 rpavscsi_handle_event, 287 rpavscsi_handle_event,
282 0, "ibmvscsi", (void *)hostdata) != 0) { 288 0, "ibmvscsi", (void *)hostdata) != 0) {
@@ -291,15 +297,10 @@ static int rpavscsi_init_crq_queue(struct crq_queue *queue,
291 goto req_irq_failed; 297 goto req_irq_failed;
292 } 298 }
293 299
294 queue->cur = 0;
295 spin_lock_init(&queue->lock);
296
297 tasklet_init(&hostdata->srp_task, (void *)rpavscsi_task,
298 (unsigned long)hostdata);
299
300 return retrc; 300 return retrc;
301 301
302 req_irq_failed: 302 req_irq_failed:
303 tasklet_kill(&hostdata->srp_task);
303 do { 304 do {
304 rc = plpar_hcall_norets(H_FREE_CRQ, vdev->unit_address); 305 rc = plpar_hcall_norets(H_FREE_CRQ, vdev->unit_address);
305 } while ((rc == H_BUSY) || (H_IS_LONG_BUSY(rc))); 306 } while ((rc == H_BUSY) || (H_IS_LONG_BUSY(rc)));
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 82ea4a8226b0..f820cffb7f00 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -1129,20 +1129,22 @@ static int ipr_is_same_device(struct ipr_resource_entry *res,
1129} 1129}
1130 1130
1131/** 1131/**
1132 * ipr_format_resource_path - Format the resource path for printing. 1132 * ipr_format_res_path - Format the resource path for printing.
1133 * @res_path: resource path 1133 * @res_path: resource path
1134 * @buf: buffer 1134 * @buf: buffer
1135 * 1135 *
1136 * Return value: 1136 * Return value:
1137 * pointer to buffer 1137 * pointer to buffer
1138 **/ 1138 **/
1139static char *ipr_format_resource_path(u8 *res_path, char *buffer) 1139static char *ipr_format_res_path(u8 *res_path, char *buffer, int len)
1140{ 1140{
1141 int i; 1141 int i;
1142 char *p = buffer;
1142 1143
1143 sprintf(buffer, "%02X", res_path[0]); 1144 res_path[0] = '\0';
1144 for (i=1; res_path[i] != 0xff; i++) 1145 p += snprintf(p, buffer + len - p, "%02X", res_path[0]);
1145 sprintf(buffer, "%s-%02X", buffer, res_path[i]); 1146 for (i = 1; res_path[i] != 0xff && ((i * 3) < len); i++)
1147 p += snprintf(p, buffer + len - p, "-%02X", res_path[i]);
1146 1148
1147 return buffer; 1149 return buffer;
1148} 1150}
@@ -1187,7 +1189,8 @@ static void ipr_update_res_entry(struct ipr_resource_entry *res,
1187 1189
1188 if (res->sdev && new_path) 1190 if (res->sdev && new_path)
1189 sdev_printk(KERN_INFO, res->sdev, "Resource path: %s\n", 1191 sdev_printk(KERN_INFO, res->sdev, "Resource path: %s\n",
1190 ipr_format_resource_path(&res->res_path[0], &buffer[0])); 1192 ipr_format_res_path(res->res_path, buffer,
1193 sizeof(buffer)));
1191 } else { 1194 } else {
1192 res->flags = cfgtew->u.cfgte->flags; 1195 res->flags = cfgtew->u.cfgte->flags;
1193 if (res->flags & IPR_IS_IOA_RESOURCE) 1196 if (res->flags & IPR_IS_IOA_RESOURCE)
@@ -1573,7 +1576,8 @@ static void ipr_log_sis64_config_error(struct ipr_ioa_cfg *ioa_cfg,
1573 ipr_err_separator; 1576 ipr_err_separator;
1574 1577
1575 ipr_err("Device %d : %s", i + 1, 1578 ipr_err("Device %d : %s", i + 1,
1576 ipr_format_resource_path(&dev_entry->res_path[0], &buffer[0])); 1579 ipr_format_res_path(dev_entry->res_path, buffer,
1580 sizeof(buffer)));
1577 ipr_log_ext_vpd(&dev_entry->vpd); 1581 ipr_log_ext_vpd(&dev_entry->vpd);
1578 1582
1579 ipr_err("-----New Device Information-----\n"); 1583 ipr_err("-----New Device Information-----\n");
@@ -1919,13 +1923,14 @@ static void ipr_log64_fabric_path(struct ipr_hostrcb *hostrcb,
1919 1923
1920 ipr_hcam_err(hostrcb, "%s %s: Resource Path=%s\n", 1924 ipr_hcam_err(hostrcb, "%s %s: Resource Path=%s\n",
1921 path_active_desc[i].desc, path_state_desc[j].desc, 1925 path_active_desc[i].desc, path_state_desc[j].desc,
1922 ipr_format_resource_path(&fabric->res_path[0], &buffer[0])); 1926 ipr_format_res_path(fabric->res_path, buffer,
1927 sizeof(buffer)));
1923 return; 1928 return;
1924 } 1929 }
1925 } 1930 }
1926 1931
1927 ipr_err("Path state=%02X Resource Path=%s\n", path_state, 1932 ipr_err("Path state=%02X Resource Path=%s\n", path_state,
1928 ipr_format_resource_path(&fabric->res_path[0], &buffer[0])); 1933 ipr_format_res_path(fabric->res_path, buffer, sizeof(buffer)));
1929} 1934}
1930 1935
1931static const struct { 1936static const struct {
@@ -2066,7 +2071,8 @@ static void ipr_log64_path_elem(struct ipr_hostrcb *hostrcb,
2066 2071
2067 ipr_hcam_err(hostrcb, "%s %s: Resource Path=%s, Link rate=%s, WWN=%08X%08X\n", 2072 ipr_hcam_err(hostrcb, "%s %s: Resource Path=%s, Link rate=%s, WWN=%08X%08X\n",
2068 path_status_desc[j].desc, path_type_desc[i].desc, 2073 path_status_desc[j].desc, path_type_desc[i].desc,
2069 ipr_format_resource_path(&cfg->res_path[0], &buffer[0]), 2074 ipr_format_res_path(cfg->res_path, buffer,
2075 sizeof(buffer)),
2070 link_rate[cfg->link_rate & IPR_PHY_LINK_RATE_MASK], 2076 link_rate[cfg->link_rate & IPR_PHY_LINK_RATE_MASK],
2071 be32_to_cpu(cfg->wwid[0]), be32_to_cpu(cfg->wwid[1])); 2077 be32_to_cpu(cfg->wwid[0]), be32_to_cpu(cfg->wwid[1]));
2072 return; 2078 return;
@@ -2074,7 +2080,7 @@ static void ipr_log64_path_elem(struct ipr_hostrcb *hostrcb,
2074 } 2080 }
2075 ipr_hcam_err(hostrcb, "Path element=%02X: Resource Path=%s, Link rate=%s " 2081 ipr_hcam_err(hostrcb, "Path element=%02X: Resource Path=%s, Link rate=%s "
2076 "WWN=%08X%08X\n", cfg->type_status, 2082 "WWN=%08X%08X\n", cfg->type_status,
2077 ipr_format_resource_path(&cfg->res_path[0], &buffer[0]), 2083 ipr_format_res_path(cfg->res_path, buffer, sizeof(buffer)),
2078 link_rate[cfg->link_rate & IPR_PHY_LINK_RATE_MASK], 2084 link_rate[cfg->link_rate & IPR_PHY_LINK_RATE_MASK],
2079 be32_to_cpu(cfg->wwid[0]), be32_to_cpu(cfg->wwid[1])); 2085 be32_to_cpu(cfg->wwid[0]), be32_to_cpu(cfg->wwid[1]));
2080} 2086}
@@ -2139,7 +2145,7 @@ static void ipr_log_sis64_array_error(struct ipr_ioa_cfg *ioa_cfg,
2139 2145
2140 ipr_err("RAID %s Array Configuration: %s\n", 2146 ipr_err("RAID %s Array Configuration: %s\n",
2141 error->protection_level, 2147 error->protection_level,
2142 ipr_format_resource_path(&error->last_res_path[0], &buffer[0])); 2148 ipr_format_res_path(error->last_res_path, buffer, sizeof(buffer)));
2143 2149
2144 ipr_err_separator; 2150 ipr_err_separator;
2145 2151
@@ -2160,9 +2166,11 @@ static void ipr_log_sis64_array_error(struct ipr_ioa_cfg *ioa_cfg,
2160 ipr_err("Array Member %d:\n", i); 2166 ipr_err("Array Member %d:\n", i);
2161 ipr_log_ext_vpd(&array_entry->vpd); 2167 ipr_log_ext_vpd(&array_entry->vpd);
2162 ipr_err("Current Location: %s", 2168 ipr_err("Current Location: %s",
2163 ipr_format_resource_path(&array_entry->res_path[0], &buffer[0])); 2169 ipr_format_res_path(array_entry->res_path, buffer,
2170 sizeof(buffer)));
2164 ipr_err("Expected Location: %s", 2171 ipr_err("Expected Location: %s",
2165 ipr_format_resource_path(&array_entry->expected_res_path[0], &buffer[0])); 2172 ipr_format_res_path(array_entry->expected_res_path,
2173 buffer, sizeof(buffer)));
2166 2174
2167 ipr_err_separator; 2175 ipr_err_separator;
2168 } 2176 }
@@ -4079,7 +4087,8 @@ static struct device_attribute ipr_adapter_handle_attr = {
4079}; 4087};
4080 4088
4081/** 4089/**
4082 * ipr_show_resource_path - Show the resource path for this device. 4090 * ipr_show_resource_path - Show the resource path or the resource address for
4091 * this device.
4083 * @dev: device struct 4092 * @dev: device struct
4084 * @buf: buffer 4093 * @buf: buffer
4085 * 4094 *
@@ -4097,9 +4106,14 @@ static ssize_t ipr_show_resource_path(struct device *dev, struct device_attribut
4097 4106
4098 spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); 4107 spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
4099 res = (struct ipr_resource_entry *)sdev->hostdata; 4108 res = (struct ipr_resource_entry *)sdev->hostdata;
4100 if (res) 4109 if (res && ioa_cfg->sis64)
4101 len = snprintf(buf, PAGE_SIZE, "%s\n", 4110 len = snprintf(buf, PAGE_SIZE, "%s\n",
4102 ipr_format_resource_path(&res->res_path[0], &buffer[0])); 4111 ipr_format_res_path(res->res_path, buffer,
4112 sizeof(buffer)));
4113 else if (res)
4114 len = snprintf(buf, PAGE_SIZE, "%d:%d:%d:%d\n", ioa_cfg->host->host_no,
4115 res->bus, res->target, res->lun);
4116
4103 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); 4117 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
4104 return len; 4118 return len;
4105} 4119}
@@ -4351,7 +4365,8 @@ static int ipr_slave_configure(struct scsi_device *sdev)
4351 scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun); 4365 scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
4352 if (ioa_cfg->sis64) 4366 if (ioa_cfg->sis64)
4353 sdev_printk(KERN_INFO, sdev, "Resource path: %s\n", 4367 sdev_printk(KERN_INFO, sdev, "Resource path: %s\n",
4354 ipr_format_resource_path(&res->res_path[0], &buffer[0])); 4368 ipr_format_res_path(res->res_path, buffer,
4369 sizeof(buffer)));
4355 return 0; 4370 return 0;
4356 } 4371 }
4357 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); 4372 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h
index 9ecd2259eb39..b965f3587c9d 100644
--- a/drivers/scsi/ipr.h
+++ b/drivers/scsi/ipr.h
@@ -1684,8 +1684,9 @@ struct ipr_ucode_image_header {
1684 if (ipr_is_device(hostrcb)) { \ 1684 if (ipr_is_device(hostrcb)) { \
1685 if ((hostrcb)->ioa_cfg->sis64) { \ 1685 if ((hostrcb)->ioa_cfg->sis64) { \
1686 printk(KERN_ERR IPR_NAME ": %s: " fmt, \ 1686 printk(KERN_ERR IPR_NAME ": %s: " fmt, \
1687 ipr_format_resource_path(&hostrcb->hcam.u.error64.fd_res_path[0], \ 1687 ipr_format_res_path(hostrcb->hcam.u.error64.fd_res_path, \
1688 &hostrcb->rp_buffer[0]), \ 1688 hostrcb->rp_buffer, \
1689 sizeof(hostrcb->rp_buffer)), \
1689 __VA_ARGS__); \ 1690 __VA_ARGS__); \
1690 } else { \ 1691 } else { \
1691 ipr_ra_err((hostrcb)->ioa_cfg, \ 1692 ipr_ra_err((hostrcb)->ioa_cfg, \
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index eed3c2d8dd1c..a182def7007d 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -41,6 +41,7 @@
41#include <linux/uaccess.h> 41#include <linux/uaccess.h>
42 42
43#include <asm/io.h> 43#include <asm/io.h>
44#include <asm/ioctls.h>
44 45
45#include <asm/mach/serial_at91.h> 46#include <asm/mach/serial_at91.h>
46#include <mach/board.h> 47#include <mach/board.h>
diff --git a/drivers/serial/suncore.c b/drivers/serial/suncore.c
index ed7d958b0a01..544f2e25d0e5 100644
--- a/drivers/serial/suncore.c
+++ b/drivers/serial/suncore.c
@@ -71,7 +71,9 @@ int sunserial_console_match(struct console *con, struct device_node *dp,
71 71
72 con->index = line; 72 con->index = line;
73 drv->cons = con; 73 drv->cons = con;
74 add_preferred_console(con->name, line, NULL); 74
75 if (!console_set_on_cmdline)
76 add_preferred_console(con->name, line, NULL);
75 77
76 return 1; 78 return 1;
77} 79}
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c
index 234459c2f012..ffbf4553f665 100644
--- a/drivers/serial/sunsu.c
+++ b/drivers/serial/sunsu.c
@@ -1500,20 +1500,25 @@ out_unmap:
1500static int __devexit su_remove(struct of_device *op) 1500static int __devexit su_remove(struct of_device *op)
1501{ 1501{
1502 struct uart_sunsu_port *up = dev_get_drvdata(&op->dev); 1502 struct uart_sunsu_port *up = dev_get_drvdata(&op->dev);
1503 bool kbdms = false;
1503 1504
1504 if (up->su_type == SU_PORT_MS || 1505 if (up->su_type == SU_PORT_MS ||
1505 up->su_type == SU_PORT_KBD) { 1506 up->su_type == SU_PORT_KBD)
1507 kbdms = true;
1508
1509 if (kbdms) {
1506#ifdef CONFIG_SERIO 1510#ifdef CONFIG_SERIO
1507 serio_unregister_port(&up->serio); 1511 serio_unregister_port(&up->serio);
1508#endif 1512#endif
1509 kfree(up); 1513 } else if (up->port.type != PORT_UNKNOWN)
1510 } else if (up->port.type != PORT_UNKNOWN) {
1511 uart_remove_one_port(&sunsu_reg, &up->port); 1514 uart_remove_one_port(&sunsu_reg, &up->port);
1512 }
1513 1515
1514 if (up->port.membase) 1516 if (up->port.membase)
1515 of_iounmap(&op->resource[0], up->port.membase, up->reg_size); 1517 of_iounmap(&op->resource[0], up->port.membase, up->reg_size);
1516 1518
1519 if (kbdms)
1520 kfree(up);
1521
1517 dev_set_drvdata(&op->dev, NULL); 1522 dev_set_drvdata(&op->dev, NULL);
1518 1523
1519 return 0; 1524 return 0;
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 61d75507d5d0..162c95a088ed 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1596,6 +1596,7 @@ static const struct usb_device_id acm_ids[] = {
1596 { NOKIA_PCSUITE_ACM_INFO(0x00e9), }, /* Nokia 5320 XpressMusic */ 1596 { NOKIA_PCSUITE_ACM_INFO(0x00e9), }, /* Nokia 5320 XpressMusic */
1597 { NOKIA_PCSUITE_ACM_INFO(0x0108), }, /* Nokia 5320 XpressMusic 2G */ 1597 { NOKIA_PCSUITE_ACM_INFO(0x0108), }, /* Nokia 5320 XpressMusic 2G */
1598 { NOKIA_PCSUITE_ACM_INFO(0x01f5), }, /* Nokia N97, RM-505 */ 1598 { NOKIA_PCSUITE_ACM_INFO(0x01f5), }, /* Nokia N97, RM-505 */
1599 { NOKIA_PCSUITE_ACM_INFO(0x02e3), }, /* Nokia 5230, RM-588 */
1599 1600
1600 /* NOTE: non-Nokia COMM/ACM/0xff is likely MSFT RNDIS... NOT a modem! */ 1601 /* NOTE: non-Nokia COMM/ACM/0xff is likely MSFT RNDIS... NOT a modem! */
1601 1602
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 83e7bbbe97fa..70cccc75a362 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1982,6 +1982,8 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1,
1982 (portstatus & USB_PORT_STAT_ENABLE)) { 1982 (portstatus & USB_PORT_STAT_ENABLE)) {
1983 if (hub_is_wusb(hub)) 1983 if (hub_is_wusb(hub))
1984 udev->speed = USB_SPEED_WIRELESS; 1984 udev->speed = USB_SPEED_WIRELESS;
1985 else if (portstatus & USB_PORT_STAT_SUPER_SPEED)
1986 udev->speed = USB_SPEED_SUPER;
1985 else if (portstatus & USB_PORT_STAT_HIGH_SPEED) 1987 else if (portstatus & USB_PORT_STAT_HIGH_SPEED)
1986 udev->speed = USB_SPEED_HIGH; 1988 udev->speed = USB_SPEED_HIGH;
1987 else if (portstatus & USB_PORT_STAT_LOW_SPEED) 1989 else if (portstatus & USB_PORT_STAT_LOW_SPEED)
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index f22d03df8b17..db99c084df92 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -41,6 +41,10 @@ static const struct usb_device_id usb_quirk_list[] = {
41 /* Philips PSC805 audio device */ 41 /* Philips PSC805 audio device */
42 { USB_DEVICE(0x0471, 0x0155), .driver_info = USB_QUIRK_RESET_RESUME }, 42 { USB_DEVICE(0x0471, 0x0155), .driver_info = USB_QUIRK_RESET_RESUME },
43 43
44 /* Artisman Watchdog Dongle */
45 { USB_DEVICE(0x04b4, 0x0526), .driver_info =
46 USB_QUIRK_CONFIG_INTF_STRINGS },
47
44 /* Roland SC-8820 */ 48 /* Roland SC-8820 */
45 { USB_DEVICE(0x0582, 0x0007), .driver_info = USB_QUIRK_RESET_RESUME }, 49 { USB_DEVICE(0x0582, 0x0007), .driver_info = USB_QUIRK_RESET_RESUME },
46 50
@@ -64,6 +68,9 @@ static const struct usb_device_id usb_quirk_list[] = {
64 /* X-Rite/Gretag-Macbeth Eye-One Pro display colorimeter */ 68 /* X-Rite/Gretag-Macbeth Eye-One Pro display colorimeter */
65 { USB_DEVICE(0x0971, 0x2000), .driver_info = USB_QUIRK_NO_SET_INTF }, 69 { USB_DEVICE(0x0971, 0x2000), .driver_info = USB_QUIRK_NO_SET_INTF },
66 70
71 /* Broadcom BCM92035DGROM BT dongle */
72 { USB_DEVICE(0x0a5c, 0x2021), .driver_info = USB_QUIRK_RESET_RESUME },
73
67 /* Action Semiconductor flash disk */ 74 /* Action Semiconductor flash disk */
68 { USB_DEVICE(0x10d6, 0x2200), .driver_info = 75 { USB_DEVICE(0x10d6, 0x2200), .driver_info =
69 USB_QUIRK_STRING_FETCH_255 }, 76 USB_QUIRK_STRING_FETCH_255 },
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
index d69eccf5f197..2aaa0f75c6cf 100644
--- a/drivers/usb/gadget/f_fs.c
+++ b/drivers/usb/gadget/f_fs.c
@@ -136,7 +136,7 @@ struct ffs_data {
136 * handling setup requests immidiatelly user space may be so 136 * handling setup requests immidiatelly user space may be so
137 * slow that another setup will be sent to the gadget but this 137 * slow that another setup will be sent to the gadget but this
138 * time not to us but another function and then there could be 138 * time not to us but another function and then there could be
139 * a race. Is taht the case? Or maybe we can use cdev->req 139 * a race. Is that the case? Or maybe we can use cdev->req
140 * after all, maybe we just need some spinlock for that? */ 140 * after all, maybe we just need some spinlock for that? */
141 struct usb_request *ep0req; /* P: mutex */ 141 struct usb_request *ep0req; /* P: mutex */
142 struct completion ep0req_completion; /* P: mutex */ 142 struct completion ep0req_completion; /* P: mutex */
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c
index 85b0d8921eae..980762453a9c 100644
--- a/drivers/usb/gadget/pxa27x_udc.c
+++ b/drivers/usb/gadget/pxa27x_udc.c
@@ -2561,7 +2561,7 @@ static void pxa_udc_shutdown(struct platform_device *_dev)
2561 udc_disable(udc); 2561 udc_disable(udc);
2562} 2562}
2563 2563
2564#ifdef CONFIG_CPU_PXA27x 2564#ifdef CONFIG_PXA27x
2565extern void pxa27x_clear_otgph(void); 2565extern void pxa27x_clear_otgph(void);
2566#else 2566#else
2567#define pxa27x_clear_otgph() do {} while (0) 2567#define pxa27x_clear_otgph() do {} while (0)
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c
index e724a051bfdd..ea2b3c7ebee5 100644
--- a/drivers/usb/gadget/s3c2410_udc.c
+++ b/drivers/usb/gadget/s3c2410_udc.c
@@ -735,6 +735,10 @@ static void s3c2410_udc_handle_ep0_idle(struct s3c2410_udc *dev,
735 else 735 else
736 dev->ep0state = EP0_OUT_DATA_PHASE; 736 dev->ep0state = EP0_OUT_DATA_PHASE;
737 737
738 if (!dev->driver)
739 return;
740
741 /* deliver the request to the gadget driver */
738 ret = dev->driver->setup(&dev->gadget, crq); 742 ret = dev->driver->setup(&dev->gadget, crq);
739 if (ret < 0) { 743 if (ret < 0) {
740 if (dev->req_config) { 744 if (dev->req_config) {
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index a18debdd79b8..418163894775 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -203,7 +203,7 @@ static inline void pxa27x_reset_hc(struct pxa27x_ohci *ohci)
203 __raw_writel(uhchr & ~UHCHR_FHR, ohci->mmio_base + UHCHR); 203 __raw_writel(uhchr & ~UHCHR_FHR, ohci->mmio_base + UHCHR);
204} 204}
205 205
206#ifdef CONFIG_CPU_PXA27x 206#ifdef CONFIG_PXA27x
207extern void pxa27x_clear_otgph(void); 207extern void pxa27x_clear_otgph(void);
208#else 208#else
209#define pxa27x_clear_otgph() do {} while (0) 209#define pxa27x_clear_otgph() do {} while (0)
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index fd9e03afd91c..2eb658d26394 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -835,6 +835,27 @@ fail:
835 return 0; 835 return 0;
836} 836}
837 837
838void xhci_copy_ep0_dequeue_into_input_ctx(struct xhci_hcd *xhci,
839 struct usb_device *udev)
840{
841 struct xhci_virt_device *virt_dev;
842 struct xhci_ep_ctx *ep0_ctx;
843 struct xhci_ring *ep_ring;
844
845 virt_dev = xhci->devs[udev->slot_id];
846 ep0_ctx = xhci_get_ep_ctx(xhci, virt_dev->in_ctx, 0);
847 ep_ring = virt_dev->eps[0].ring;
848 /*
849 * FIXME we don't keep track of the dequeue pointer very well after a
850 * Set TR dequeue pointer, so we're setting the dequeue pointer of the
851 * host to our enqueue pointer. This should only be called after a
852 * configured device has reset, so all control transfers should have
853 * been completed or cancelled before the reset.
854 */
855 ep0_ctx->deq = xhci_trb_virt_to_dma(ep_ring->enq_seg, ep_ring->enqueue);
856 ep0_ctx->deq |= ep_ring->cycle_state;
857}
858
838/* Setup an xHCI virtual device for a Set Address command */ 859/* Setup an xHCI virtual device for a Set Address command */
839int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *udev) 860int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *udev)
840{ 861{
@@ -1002,7 +1023,7 @@ static inline unsigned int xhci_get_endpoint_interval(struct usb_device *udev,
1002 return EP_INTERVAL(interval); 1023 return EP_INTERVAL(interval);
1003} 1024}
1004 1025
1005/* The "Mult" field in the endpoint context is only set for SuperSpeed devices. 1026/* The "Mult" field in the endpoint context is only set for SuperSpeed isoc eps.
1006 * High speed endpoint descriptors can define "the number of additional 1027 * High speed endpoint descriptors can define "the number of additional
1007 * transaction opportunities per microframe", but that goes in the Max Burst 1028 * transaction opportunities per microframe", but that goes in the Max Burst
1008 * endpoint context field. 1029 * endpoint context field.
@@ -1010,7 +1031,8 @@ static inline unsigned int xhci_get_endpoint_interval(struct usb_device *udev,
1010static inline u32 xhci_get_endpoint_mult(struct usb_device *udev, 1031static inline u32 xhci_get_endpoint_mult(struct usb_device *udev,
1011 struct usb_host_endpoint *ep) 1032 struct usb_host_endpoint *ep)
1012{ 1033{
1013 if (udev->speed != USB_SPEED_SUPER) 1034 if (udev->speed != USB_SPEED_SUPER ||
1035 !usb_endpoint_xfer_isoc(&ep->desc))
1014 return 0; 1036 return 0;
1015 return ep->ss_ep_comp.bmAttributes; 1037 return ep->ss_ep_comp.bmAttributes;
1016} 1038}
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 94e6934edb09..bfc99a939455 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -2380,16 +2380,19 @@ static int queue_command(struct xhci_hcd *xhci, u32 field1, u32 field2,
2380 u32 field3, u32 field4, bool command_must_succeed) 2380 u32 field3, u32 field4, bool command_must_succeed)
2381{ 2381{
2382 int reserved_trbs = xhci->cmd_ring_reserved_trbs; 2382 int reserved_trbs = xhci->cmd_ring_reserved_trbs;
2383 int ret;
2384
2383 if (!command_must_succeed) 2385 if (!command_must_succeed)
2384 reserved_trbs++; 2386 reserved_trbs++;
2385 2387
2386 if (!room_on_ring(xhci, xhci->cmd_ring, reserved_trbs)) { 2388 ret = prepare_ring(xhci, xhci->cmd_ring, EP_STATE_RUNNING,
2387 if (!in_interrupt()) 2389 reserved_trbs, GFP_ATOMIC);
2388 xhci_err(xhci, "ERR: No room for command on command ring\n"); 2390 if (ret < 0) {
2391 xhci_err(xhci, "ERR: No room for command on command ring\n");
2389 if (command_must_succeed) 2392 if (command_must_succeed)
2390 xhci_err(xhci, "ERR: Reserved TRB counting for " 2393 xhci_err(xhci, "ERR: Reserved TRB counting for "
2391 "unfailable commands failed.\n"); 2394 "unfailable commands failed.\n");
2392 return -ENOMEM; 2395 return ret;
2393 } 2396 }
2394 queue_trb(xhci, xhci->cmd_ring, false, false, field1, field2, field3, 2397 queue_trb(xhci, xhci->cmd_ring, false, false, field1, field2, field3,
2395 field4 | xhci->cmd_ring->cycle_state); 2398 field4 | xhci->cmd_ring->cycle_state);
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 27345cd04da0..3998f72cd0c4 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -2134,6 +2134,8 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev)
2134 /* If this is a Set Address to an unconfigured device, setup ep 0 */ 2134 /* If this is a Set Address to an unconfigured device, setup ep 0 */
2135 if (!udev->config) 2135 if (!udev->config)
2136 xhci_setup_addressable_virt_dev(xhci, udev); 2136 xhci_setup_addressable_virt_dev(xhci, udev);
2137 else
2138 xhci_copy_ep0_dequeue_into_input_ctx(xhci, udev);
2137 /* Otherwise, assume the core has the device configured how it wants */ 2139 /* Otherwise, assume the core has the device configured how it wants */
2138 xhci_dbg(xhci, "Slot ID %d Input Context:\n", udev->slot_id); 2140 xhci_dbg(xhci, "Slot ID %d Input Context:\n", udev->slot_id);
2139 xhci_dbg_ctx(xhci, virt_dev->in_ctx, 2); 2141 xhci_dbg_ctx(xhci, virt_dev->in_ctx, 2);
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 8b4b7d39f79c..6c7e3430ec93 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1292,6 +1292,8 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags);
1292void xhci_free_virt_device(struct xhci_hcd *xhci, int slot_id); 1292void xhci_free_virt_device(struct xhci_hcd *xhci, int slot_id);
1293int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id, struct usb_device *udev, gfp_t flags); 1293int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id, struct usb_device *udev, gfp_t flags);
1294int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *udev); 1294int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *udev);
1295void xhci_copy_ep0_dequeue_into_input_ctx(struct xhci_hcd *xhci,
1296 struct usb_device *udev);
1295unsigned int xhci_get_endpoint_index(struct usb_endpoint_descriptor *desc); 1297unsigned int xhci_get_endpoint_index(struct usb_endpoint_descriptor *desc);
1296unsigned int xhci_get_endpoint_flag(struct usb_endpoint_descriptor *desc); 1298unsigned int xhci_get_endpoint_flag(struct usb_endpoint_descriptor *desc);
1297unsigned int xhci_get_endpoint_flag_from_index(unsigned int ep_index); 1299unsigned int xhci_get_endpoint_flag_from_index(unsigned int ep_index);
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c
index 30d930386b65..d25814c172b2 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.c
+++ b/drivers/usb/misc/sisusbvga/sisusb.c
@@ -2436,7 +2436,8 @@ sisusb_open(struct inode *inode, struct file *file)
2436 } 2436 }
2437 2437
2438 if (!sisusb->devinit) { 2438 if (!sisusb->devinit) {
2439 if (sisusb->sisusb_dev->speed == USB_SPEED_HIGH) { 2439 if (sisusb->sisusb_dev->speed == USB_SPEED_HIGH ||
2440 sisusb->sisusb_dev->speed == USB_SPEED_SUPER) {
2440 if (sisusb_init_gfxdevice(sisusb, 0)) { 2441 if (sisusb_init_gfxdevice(sisusb, 0)) {
2441 mutex_unlock(&sisusb->lock); 2442 mutex_unlock(&sisusb->lock);
2442 dev_err(&sisusb->sisusb_dev->dev, "Failed to initialize device\n"); 2443 dev_err(&sisusb->sisusb_dev->dev, "Failed to initialize device\n");
@@ -3166,7 +3167,7 @@ static int sisusb_probe(struct usb_interface *intf,
3166 3167
3167 sisusb->present = 1; 3168 sisusb->present = 1;
3168 3169
3169 if (dev->speed == USB_SPEED_HIGH) { 3170 if (dev->speed == USB_SPEED_HIGH || dev->speed == USB_SPEED_SUPER) {
3170 int initscreen = 1; 3171 int initscreen = 1;
3171#ifdef INCL_SISUSB_CON 3172#ifdef INCL_SISUSB_CON
3172 if (sisusb_first_vc > 0 && 3173 if (sisusb_first_vc > 0 &&
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index 05c077f8f9ac..3c48e77a0aa2 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -29,19 +29,6 @@ static void tusb_source_power(struct musb *musb, int is_on);
29#define TUSB_REV_MAJOR(reg_val) ((reg_val >> 4) & 0xf) 29#define TUSB_REV_MAJOR(reg_val) ((reg_val >> 4) & 0xf)
30#define TUSB_REV_MINOR(reg_val) (reg_val & 0xf) 30#define TUSB_REV_MINOR(reg_val) (reg_val & 0xf)
31 31
32#ifdef CONFIG_PM
33/* REVISIT: These should be only needed if somebody implements off idle */
34void musb_platform_save_context(struct musb *musb,
35 struct musb_context_registers *musb_context)
36{
37}
38
39void musb_platform_restore_context(struct musb *musb,
40 struct musb_context_registers *musb_context)
41{
42}
43#endif
44
45/* 32/*
46 * Checks the revision. We need to use the DMA register as 3.0 does not 33 * Checks the revision. We need to use the DMA register as 3.0 does not
47 * have correct versions for TUSB_PRCM_REV or TUSB_INT_CTRL_REV. 34 * have correct versions for TUSB_PRCM_REV or TUSB_INT_CTRL_REV.
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index da7e334b0407..e298dc4baed7 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -691,6 +691,7 @@ static struct usb_device_id id_table_combined [] = {
691 { USB_DEVICE(FTDI_VID, FTDI_NDI_AURORA_SCU_PID), 691 { USB_DEVICE(FTDI_VID, FTDI_NDI_AURORA_SCU_PID),
692 .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, 692 .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk },
693 { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, 693 { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) },
694 { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_SERIAL_VX7_PID) },
694 { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, 695 { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) },
695 { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) }, 696 { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) },
696 { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) }, 697 { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) },
@@ -737,6 +738,14 @@ static struct usb_device_id id_table_combined [] = {
737 { USB_DEVICE(FTDI_VID, MJSG_SR_RADIO_PID) }, 738 { USB_DEVICE(FTDI_VID, MJSG_SR_RADIO_PID) },
738 { USB_DEVICE(FTDI_VID, MJSG_HD_RADIO_PID) }, 739 { USB_DEVICE(FTDI_VID, MJSG_HD_RADIO_PID) },
739 { USB_DEVICE(FTDI_VID, MJSG_XM_RADIO_PID) }, 740 { USB_DEVICE(FTDI_VID, MJSG_XM_RADIO_PID) },
741 { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_ST_PID),
742 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
743 { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SLITE_PID),
744 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
745 { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SH2_PID),
746 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
747 { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SH4_PID),
748 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
740 { }, /* Optional parameter entry */ 749 { }, /* Optional parameter entry */
741 { } /* Terminating entry */ 750 { } /* Terminating entry */
742}; 751};
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index bbc159a1df45..d01946db8fac 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -696,6 +696,12 @@
696#define TELLDUS_TELLSTICK_PID 0x0C30 /* RF control dongle 433 MHz using FT232RL */ 696#define TELLDUS_TELLSTICK_PID 0x0C30 /* RF control dongle 433 MHz using FT232RL */
697 697
698/* 698/*
699 * RT Systems programming cables for various ham radios
700 */
701#define RTSYSTEMS_VID 0x2100 /* Vendor ID */
702#define RTSYSTEMS_SERIAL_VX7_PID 0x9e52 /* Serial converter for VX-7 Radios using FT232RL */
703
704/*
699 * Bayer Ascensia Contour blood glucose meter USB-converter cable. 705 * Bayer Ascensia Contour blood glucose meter USB-converter cable.
700 * http://winglucofacts.com/cables/ 706 * http://winglucofacts.com/cables/
701 */ 707 */
@@ -1017,3 +1023,12 @@
1017#define MJSG_SR_RADIO_PID 0x9379 1023#define MJSG_SR_RADIO_PID 0x9379
1018#define MJSG_XM_RADIO_PID 0x937A 1024#define MJSG_XM_RADIO_PID 0x937A
1019#define MJSG_HD_RADIO_PID 0x937C 1025#define MJSG_HD_RADIO_PID 0x937C
1026
1027/*
1028 * Xverve Signalyzer tools (http://www.signalyzer.com/)
1029 */
1030#define XVERVE_SIGNALYZER_ST_PID 0xBCA0
1031#define XVERVE_SIGNALYZER_SLITE_PID 0xBCA1
1032#define XVERVE_SIGNALYZER_SH2_PID 0xBCA2
1033#define XVERVE_SIGNALYZER_SH4_PID 0xBCA4
1034
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index e280ad8e12f7..5cd30e4345c6 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -206,6 +206,7 @@ static void option_instat_callback(struct urb *urb);
206#define AMOI_PRODUCT_H01 0x0800 206#define AMOI_PRODUCT_H01 0x0800
207#define AMOI_PRODUCT_H01A 0x7002 207#define AMOI_PRODUCT_H01A 0x7002
208#define AMOI_PRODUCT_H02 0x0802 208#define AMOI_PRODUCT_H02 0x0802
209#define AMOI_PRODUCT_SKYPEPHONE_S2 0x0407
209 210
210#define DELL_VENDOR_ID 0x413C 211#define DELL_VENDOR_ID 0x413C
211 212
@@ -302,6 +303,7 @@ static void option_instat_callback(struct urb *urb);
302#define QISDA_PRODUCT_H21_4512 0x4512 303#define QISDA_PRODUCT_H21_4512 0x4512
303#define QISDA_PRODUCT_H21_4523 0x4523 304#define QISDA_PRODUCT_H21_4523 0x4523
304#define QISDA_PRODUCT_H20_4515 0x4515 305#define QISDA_PRODUCT_H20_4515 0x4515
306#define QISDA_PRODUCT_H20_4518 0x4518
305#define QISDA_PRODUCT_H20_4519 0x4519 307#define QISDA_PRODUCT_H20_4519 0x4519
306 308
307/* TLAYTECH PRODUCTS */ 309/* TLAYTECH PRODUCTS */
@@ -516,6 +518,7 @@ static const struct usb_device_id option_ids[] = {
516 { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01) }, 518 { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01) },
517 { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01A) }, 519 { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01A) },
518 { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H02) }, 520 { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H02) },
521 { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_SKYPEPHONE_S2) },
519 522
520 { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5700_MINICARD) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite EV620 CDMA/EV-DO */ 523 { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5700_MINICARD) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite EV620 CDMA/EV-DO */
521 { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5500_MINICARD) }, /* Dell Wireless 5500 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */ 524 { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5500_MINICARD) }, /* Dell Wireless 5500 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */
@@ -852,6 +855,7 @@ static const struct usb_device_id option_ids[] = {
852 { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4512) }, 855 { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4512) },
853 { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4523) }, 856 { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4523) },
854 { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4515) }, 857 { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4515) },
858 { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4518) },
855 { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4519) }, 859 { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4519) },
856 { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_G450) }, 860 { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_G450) },
857 { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_HSDPA_MINICARD ) }, /* Toshiba 3G HSDPA == Novatel Expedite EU870D MiniCard */ 861 { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_HSDPA_MINICARD ) }, /* Toshiba 3G HSDPA == Novatel Expedite EU870D MiniCard */
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
index 93d72eb8cafc..cde67cacb2c3 100644
--- a/drivers/usb/serial/qcserial.c
+++ b/drivers/usb/serial/qcserial.c
@@ -51,6 +51,8 @@ static const struct usb_device_id id_table[] = {
51 {USB_DEVICE(0x1f45, 0x0001)}, /* Unknown Gobi QDL device */ 51 {USB_DEVICE(0x1f45, 0x0001)}, /* Unknown Gobi QDL device */
52 {USB_DEVICE(0x413c, 0x8185)}, /* Dell Gobi 2000 QDL device (N0218, VU936) */ 52 {USB_DEVICE(0x413c, 0x8185)}, /* Dell Gobi 2000 QDL device (N0218, VU936) */
53 {USB_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */ 53 {USB_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */
54 {USB_DEVICE(0x05c6, 0x9208)}, /* Generic Gobi 2000 QDL device */
55 {USB_DEVICE(0x05c6, 0x920b)}, /* Generic Gobi 2000 Modem device */
54 {USB_DEVICE(0x05c6, 0x9224)}, /* Sony Gobi 2000 QDL device (N0279, VU730) */ 56 {USB_DEVICE(0x05c6, 0x9224)}, /* Sony Gobi 2000 QDL device (N0279, VU730) */
55 {USB_DEVICE(0x05c6, 0x9225)}, /* Sony Gobi 2000 Modem device (N0279, VU730) */ 57 {USB_DEVICE(0x05c6, 0x9225)}, /* Sony Gobi 2000 Modem device (N0279, VU730) */
56 {USB_DEVICE(0x05c6, 0x9244)}, /* Samsung Gobi 2000 QDL device (VL176) */ 58 {USB_DEVICE(0x05c6, 0x9244)}, /* Samsung Gobi 2000 QDL device (VL176) */
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index ef0bdb08d788..d47b56e9e8ce 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -245,6 +245,7 @@ static const struct usb_device_id id_table[] = {
245 { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */ 245 { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */
246 { USB_DEVICE(0x1199, 0x0112) }, /* Sierra Wireless AirCard 580 */ 246 { USB_DEVICE(0x1199, 0x0112) }, /* Sierra Wireless AirCard 580 */
247 { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless USB Dongle 595U */ 247 { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless USB Dongle 595U */
248 { USB_DEVICE(0x1199, 0x0301) }, /* Sierra Wireless USB Dongle 250U */
248 /* Sierra Wireless C597 */ 249 /* Sierra Wireless C597 */
249 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x0023, 0xFF, 0xFF, 0xFF) }, 250 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x0023, 0xFF, 0xFF, 0xFF) },
250 /* Sierra Wireless T598 */ 251 /* Sierra Wireless T598 */
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
index 44716427c51c..64ec073e89de 100644
--- a/drivers/usb/storage/transport.c
+++ b/drivers/usb/storage/transport.c
@@ -139,9 +139,7 @@ static int usb_stor_msg_common(struct us_data *us, int timeout)
139 139
140 /* fill the common fields in the URB */ 140 /* fill the common fields in the URB */
141 us->current_urb->context = &urb_done; 141 us->current_urb->context = &urb_done;
142 us->current_urb->actual_length = 0; 142 us->current_urb->transfer_flags = 0;
143 us->current_urb->error_count = 0;
144 us->current_urb->status = 0;
145 143
146 /* we assume that if transfer_buffer isn't us->iobuf then it 144 /* we assume that if transfer_buffer isn't us->iobuf then it
147 * hasn't been mapped for DMA. Yes, this is clunky, but it's 145 * hasn't been mapped for DMA. Yes, this is clunky, but it's
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 57a593c58cf4..d219070fed3d 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -177,8 +177,8 @@ static void handle_tx(struct vhost_net *net)
177 break; 177 break;
178 } 178 }
179 if (err != len) 179 if (err != len)
180 pr_err("Truncated TX packet: " 180 pr_debug("Truncated TX packet: "
181 " len %d != %zd\n", err, len); 181 " len %d != %zd\n", err, len);
182 vhost_add_used_and_signal(&net->dev, vq, head, 0); 182 vhost_add_used_and_signal(&net->dev, vq, head, 0);
183 total_len += len; 183 total_len += len;
184 if (unlikely(total_len >= VHOST_NET_WEIGHT)) { 184 if (unlikely(total_len >= VHOST_NET_WEIGHT)) {
@@ -275,8 +275,8 @@ static void handle_rx(struct vhost_net *net)
275 } 275 }
276 /* TODO: Should check and handle checksum. */ 276 /* TODO: Should check and handle checksum. */
277 if (err > len) { 277 if (err > len) {
278 pr_err("Discarded truncated rx packet: " 278 pr_debug("Discarded truncated rx packet: "
279 " len %d > %zd\n", err, len); 279 " len %d > %zd\n", err, len);
280 vhost_discard_vq_desc(vq); 280 vhost_discard_vq_desc(vq);
281 continue; 281 continue;
282 } 282 }
@@ -534,11 +534,16 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
534 rcu_assign_pointer(vq->private_data, sock); 534 rcu_assign_pointer(vq->private_data, sock);
535 vhost_net_enable_vq(n, vq); 535 vhost_net_enable_vq(n, vq);
536done: 536done:
537 mutex_unlock(&vq->mutex);
538
537 if (oldsock) { 539 if (oldsock) {
538 vhost_net_flush_vq(n, index); 540 vhost_net_flush_vq(n, index);
539 fput(oldsock->file); 541 fput(oldsock->file);
540 } 542 }
541 543
544 mutex_unlock(&n->dev.mutex);
545 return 0;
546
542err_vq: 547err_vq:
543 mutex_unlock(&vq->mutex); 548 mutex_unlock(&vq->mutex);
544err: 549err:
diff --git a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c
index 515cf1978d19..c4e17642d9c5 100644
--- a/drivers/video/aty/radeon_pm.c
+++ b/drivers/video/aty/radeon_pm.c
@@ -2872,7 +2872,7 @@ void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk, int ignore_devlis
2872 } 2872 }
2873 2873
2874#if 0 2874#if 0
2875 /* Power down TV DAC, taht saves a significant amount of power, 2875 /* Power down TV DAC, that saves a significant amount of power,
2876 * we'll have something better once we actually have some TVOut 2876 * we'll have something better once we actually have some TVOut
2877 * support 2877 * support
2878 */ 2878 */
diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c
index 40f61320ce16..34b2fc472fe8 100644
--- a/drivers/video/au1100fb.c
+++ b/drivers/video/au1100fb.c
@@ -95,7 +95,7 @@ struct fb_bitfield rgb_bitfields[][4] =
95 { { 8, 4, 0 }, { 4, 4, 0 }, { 0, 4, 0 }, { 0, 0, 0 } }, 95 { { 8, 4, 0 }, { 4, 4, 0 }, { 0, 4, 0 }, { 0, 0, 0 } },
96}; 96};
97 97
98static struct fb_fix_screeninfo au1100fb_fix __initdata = { 98static struct fb_fix_screeninfo au1100fb_fix __devinitdata = {
99 .id = "AU1100 FB", 99 .id = "AU1100 FB",
100 .xpanstep = 1, 100 .xpanstep = 1,
101 .ypanstep = 1, 101 .ypanstep = 1,
@@ -103,7 +103,7 @@ static struct fb_fix_screeninfo au1100fb_fix __initdata = {
103 .accel = FB_ACCEL_NONE, 103 .accel = FB_ACCEL_NONE,
104}; 104};
105 105
106static struct fb_var_screeninfo au1100fb_var __initdata = { 106static struct fb_var_screeninfo au1100fb_var __devinitdata = {
107 .activate = FB_ACTIVATE_NOW, 107 .activate = FB_ACTIVATE_NOW,
108 .height = -1, 108 .height = -1,
109 .width = -1, 109 .width = -1,
@@ -458,7 +458,7 @@ static struct fb_ops au1100fb_ops =
458 458
459/* AU1100 LCD controller device driver */ 459/* AU1100 LCD controller device driver */
460 460
461static int __init au1100fb_drv_probe(struct platform_device *dev) 461static int __devinit au1100fb_drv_probe(struct platform_device *dev)
462{ 462{
463 struct au1100fb_device *fbdev = NULL; 463 struct au1100fb_device *fbdev = NULL;
464 struct resource *regs_res; 464 struct resource *regs_res;
diff --git a/drivers/video/gbefb.c b/drivers/video/gbefb.c
index 7d8c55d7fd28..ca3355e430bf 100644
--- a/drivers/video/gbefb.c
+++ b/drivers/video/gbefb.c
@@ -91,10 +91,10 @@ static uint32_t pseudo_palette[16];
91static uint32_t gbe_cmap[256]; 91static uint32_t gbe_cmap[256];
92static int gbe_turned_on; /* 0 turned off, 1 turned on */ 92static int gbe_turned_on; /* 0 turned off, 1 turned on */
93 93
94static char *mode_option __initdata = NULL; 94static char *mode_option __devinitdata = NULL;
95 95
96/* default CRT mode */ 96/* default CRT mode */
97static struct fb_var_screeninfo default_var_CRT __initdata = { 97static struct fb_var_screeninfo default_var_CRT __devinitdata = {
98 /* 640x480, 60 Hz, Non-Interlaced (25.175 MHz dotclock) */ 98 /* 640x480, 60 Hz, Non-Interlaced (25.175 MHz dotclock) */
99 .xres = 640, 99 .xres = 640,
100 .yres = 480, 100 .yres = 480,
@@ -125,7 +125,7 @@ static struct fb_var_screeninfo default_var_CRT __initdata = {
125}; 125};
126 126
127/* default LCD mode */ 127/* default LCD mode */
128static struct fb_var_screeninfo default_var_LCD __initdata = { 128static struct fb_var_screeninfo default_var_LCD __devinitdata = {
129 /* 1600x1024, 8 bpp */ 129 /* 1600x1024, 8 bpp */
130 .xres = 1600, 130 .xres = 1600,
131 .yres = 1024, 131 .yres = 1024,
@@ -157,7 +157,7 @@ static struct fb_var_screeninfo default_var_LCD __initdata = {
157 157
158/* default modedb mode */ 158/* default modedb mode */
159/* 640x480, 60 Hz, Non-Interlaced (25.172 MHz dotclock) */ 159/* 640x480, 60 Hz, Non-Interlaced (25.172 MHz dotclock) */
160static struct fb_videomode default_mode_CRT __initdata = { 160static struct fb_videomode default_mode_CRT __devinitdata = {
161 .refresh = 60, 161 .refresh = 60,
162 .xres = 640, 162 .xres = 640,
163 .yres = 480, 163 .yres = 480,
@@ -172,7 +172,7 @@ static struct fb_videomode default_mode_CRT __initdata = {
172 .vmode = FB_VMODE_NONINTERLACED, 172 .vmode = FB_VMODE_NONINTERLACED,
173}; 173};
174/* 1600x1024 SGI flatpanel 1600sw */ 174/* 1600x1024 SGI flatpanel 1600sw */
175static struct fb_videomode default_mode_LCD __initdata = { 175static struct fb_videomode default_mode_LCD __devinitdata = {
176 /* 1600x1024, 8 bpp */ 176 /* 1600x1024, 8 bpp */
177 .xres = 1600, 177 .xres = 1600,
178 .yres = 1024, 178 .yres = 1024,
@@ -186,8 +186,8 @@ static struct fb_videomode default_mode_LCD __initdata = {
186 .vmode = FB_VMODE_NONINTERLACED, 186 .vmode = FB_VMODE_NONINTERLACED,
187}; 187};
188 188
189static struct fb_videomode *default_mode __initdata = &default_mode_CRT; 189static struct fb_videomode *default_mode __devinitdata = &default_mode_CRT;
190static struct fb_var_screeninfo *default_var __initdata = &default_var_CRT; 190static struct fb_var_screeninfo *default_var __devinitdata = &default_var_CRT;
191 191
192static int flat_panel_enabled = 0; 192static int flat_panel_enabled = 0;
193 193
@@ -1098,7 +1098,7 @@ static void gbefb_create_sysfs(struct device *dev)
1098 * Initialization 1098 * Initialization
1099 */ 1099 */
1100 1100
1101static int __init gbefb_setup(char *options) 1101static int __devinit gbefb_setup(char *options)
1102{ 1102{
1103 char *this_opt; 1103 char *this_opt;
1104 1104
diff --git a/drivers/video/pmag-ba-fb.c b/drivers/video/pmag-ba-fb.c
index 0f361b6100d2..0c69fa20251b 100644
--- a/drivers/video/pmag-ba-fb.c
+++ b/drivers/video/pmag-ba-fb.c
@@ -44,7 +44,7 @@ struct pmagbafb_par {
44}; 44};
45 45
46 46
47static struct fb_var_screeninfo pmagbafb_defined __initdata = { 47static struct fb_var_screeninfo pmagbafb_defined __devinitdata = {
48 .xres = 1024, 48 .xres = 1024,
49 .yres = 864, 49 .yres = 864,
50 .xres_virtual = 1024, 50 .xres_virtual = 1024,
@@ -68,7 +68,7 @@ static struct fb_var_screeninfo pmagbafb_defined __initdata = {
68 .vmode = FB_VMODE_NONINTERLACED, 68 .vmode = FB_VMODE_NONINTERLACED,
69}; 69};
70 70
71static struct fb_fix_screeninfo pmagbafb_fix __initdata = { 71static struct fb_fix_screeninfo pmagbafb_fix __devinitdata = {
72 .id = "PMAG-BA", 72 .id = "PMAG-BA",
73 .smem_len = (1024 * 1024), 73 .smem_len = (1024 * 1024),
74 .type = FB_TYPE_PACKED_PIXELS, 74 .type = FB_TYPE_PACKED_PIXELS,
@@ -142,7 +142,7 @@ static void __init pmagbafb_erase_cursor(struct fb_info *info)
142} 142}
143 143
144 144
145static int __init pmagbafb_probe(struct device *dev) 145static int __devinit pmagbafb_probe(struct device *dev)
146{ 146{
147 struct tc_dev *tdev = to_tc_dev(dev); 147 struct tc_dev *tdev = to_tc_dev(dev);
148 resource_size_t start, len; 148 resource_size_t start, len;
diff --git a/drivers/video/pmagb-b-fb.c b/drivers/video/pmagb-b-fb.c
index 2de0806421b4..22fcb9a3d5c0 100644
--- a/drivers/video/pmagb-b-fb.c
+++ b/drivers/video/pmagb-b-fb.c
@@ -45,7 +45,7 @@ struct pmagbbfb_par {
45}; 45};
46 46
47 47
48static struct fb_var_screeninfo pmagbbfb_defined __initdata = { 48static struct fb_var_screeninfo pmagbbfb_defined __devinitdata = {
49 .bits_per_pixel = 8, 49 .bits_per_pixel = 8,
50 .red.length = 8, 50 .red.length = 8,
51 .green.length = 8, 51 .green.length = 8,
@@ -58,7 +58,7 @@ static struct fb_var_screeninfo pmagbbfb_defined __initdata = {
58 .vmode = FB_VMODE_NONINTERLACED, 58 .vmode = FB_VMODE_NONINTERLACED,
59}; 59};
60 60
61static struct fb_fix_screeninfo pmagbbfb_fix __initdata = { 61static struct fb_fix_screeninfo pmagbbfb_fix __devinitdata = {
62 .id = "PMAGB-BA", 62 .id = "PMAGB-BA",
63 .smem_len = (2048 * 1024), 63 .smem_len = (2048 * 1024),
64 .type = FB_TYPE_PACKED_PIXELS, 64 .type = FB_TYPE_PACKED_PIXELS,
@@ -148,7 +148,7 @@ static void __init pmagbbfb_erase_cursor(struct fb_info *info)
148/* 148/*
149 * Set up screen parameters. 149 * Set up screen parameters.
150 */ 150 */
151static void __init pmagbbfb_screen_setup(struct fb_info *info) 151static void __devinit pmagbbfb_screen_setup(struct fb_info *info)
152{ 152{
153 struct pmagbbfb_par *par = info->par; 153 struct pmagbbfb_par *par = info->par;
154 154
@@ -180,9 +180,9 @@ static void __init pmagbbfb_screen_setup(struct fb_info *info)
180/* 180/*
181 * Determine oscillator configuration. 181 * Determine oscillator configuration.
182 */ 182 */
183static void __init pmagbbfb_osc_setup(struct fb_info *info) 183static void __devinit pmagbbfb_osc_setup(struct fb_info *info)
184{ 184{
185 static unsigned int pmagbbfb_freqs[] __initdata = { 185 static unsigned int pmagbbfb_freqs[] __devinitdata = {
186 130808, 119843, 104000, 92980, 74370, 72800, 186 130808, 119843, 104000, 92980, 74370, 72800,
187 69197, 66000, 65000, 50350, 36000, 32000, 25175 187 69197, 66000, 65000, 50350, 36000, 32000, 25175
188 }; 188 };
@@ -247,7 +247,7 @@ static void __init pmagbbfb_osc_setup(struct fb_info *info)
247}; 247};
248 248
249 249
250static int __init pmagbbfb_probe(struct device *dev) 250static int __devinit pmagbbfb_probe(struct device *dev)
251{ 251{
252 struct tc_dev *tdev = to_tc_dev(dev); 252 struct tc_dev *tdev = to_tc_dev(dev);
253 resource_size_t start, len; 253 resource_size_t start, len;
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index afe7e21dd0ae..1475ed6b575f 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -164,7 +164,8 @@ int virtqueue_add_buf_gfp(struct virtqueue *_vq,
164 gfp_t gfp) 164 gfp_t gfp)
165{ 165{
166 struct vring_virtqueue *vq = to_vvq(_vq); 166 struct vring_virtqueue *vq = to_vvq(_vq);
167 unsigned int i, avail, head, uninitialized_var(prev); 167 unsigned int i, avail, uninitialized_var(prev);
168 int head;
168 169
169 START_USE(vq); 170 START_USE(vq);
170 171
@@ -174,7 +175,7 @@ int virtqueue_add_buf_gfp(struct virtqueue *_vq,
174 * buffers, then go indirect. FIXME: tune this threshold */ 175 * buffers, then go indirect. FIXME: tune this threshold */
175 if (vq->indirect && (out + in) > 1 && vq->num_free) { 176 if (vq->indirect && (out + in) > 1 && vq->num_free) {
176 head = vring_add_indirect(vq, sg, out, in, gfp); 177 head = vring_add_indirect(vq, sg, out, in, gfp);
177 if (head != vq->vring.num) 178 if (likely(head >= 0))
178 goto add_head; 179 goto add_head;
179 } 180 }
180 181
diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
index d61e3b28ce37..36d961f342af 100644
--- a/fs/9p/vfs_dir.c
+++ b/fs/9p/vfs_dir.c
@@ -146,7 +146,7 @@ static int v9fs_dir_readdir(struct file *filp, void *dirent, filldir_t filldir)
146 while (rdir->head < rdir->tail) { 146 while (rdir->head < rdir->tail) {
147 p9stat_init(&st); 147 p9stat_init(&st);
148 err = p9stat_read(rdir->buf + rdir->head, 148 err = p9stat_read(rdir->buf + rdir->head,
149 buflen - rdir->head, &st, 149 rdir->tail - rdir->head, &st,
150 fid->clnt->proto_version); 150 fid->clnt->proto_version);
151 if (err) { 151 if (err) {
152 P9_DPRINTK(P9_DEBUG_VFS, "returned %d\n", err); 152 P9_DPRINTK(P9_DEBUG_VFS, "returned %d\n", err);
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 0d1d966b0fe4..c3df14ce2cc2 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -2304,12 +2304,17 @@ noinline int btrfs_leaf_free_space(struct btrfs_root *root,
2304 return ret; 2304 return ret;
2305} 2305}
2306 2306
2307/*
2308 * min slot controls the lowest index we're willing to push to the
2309 * right. We'll push up to and including min_slot, but no lower
2310 */
2307static noinline int __push_leaf_right(struct btrfs_trans_handle *trans, 2311static noinline int __push_leaf_right(struct btrfs_trans_handle *trans,
2308 struct btrfs_root *root, 2312 struct btrfs_root *root,
2309 struct btrfs_path *path, 2313 struct btrfs_path *path,
2310 int data_size, int empty, 2314 int data_size, int empty,
2311 struct extent_buffer *right, 2315 struct extent_buffer *right,
2312 int free_space, u32 left_nritems) 2316 int free_space, u32 left_nritems,
2317 u32 min_slot)
2313{ 2318{
2314 struct extent_buffer *left = path->nodes[0]; 2319 struct extent_buffer *left = path->nodes[0];
2315 struct extent_buffer *upper = path->nodes[1]; 2320 struct extent_buffer *upper = path->nodes[1];
@@ -2327,7 +2332,7 @@ static noinline int __push_leaf_right(struct btrfs_trans_handle *trans,
2327 if (empty) 2332 if (empty)
2328 nr = 0; 2333 nr = 0;
2329 else 2334 else
2330 nr = 1; 2335 nr = max_t(u32, 1, min_slot);
2331 2336
2332 if (path->slots[0] >= left_nritems) 2337 if (path->slots[0] >= left_nritems)
2333 push_space += data_size; 2338 push_space += data_size;
@@ -2469,10 +2474,14 @@ out_unlock:
2469 * 2474 *
2470 * returns 1 if the push failed because the other node didn't have enough 2475 * returns 1 if the push failed because the other node didn't have enough
2471 * room, 0 if everything worked out and < 0 if there were major errors. 2476 * room, 0 if everything worked out and < 0 if there were major errors.
2477 *
2478 * this will push starting from min_slot to the end of the leaf. It won't
2479 * push any slot lower than min_slot
2472 */ 2480 */
2473static int push_leaf_right(struct btrfs_trans_handle *trans, struct btrfs_root 2481static int push_leaf_right(struct btrfs_trans_handle *trans, struct btrfs_root
2474 *root, struct btrfs_path *path, int data_size, 2482 *root, struct btrfs_path *path,
2475 int empty) 2483 int min_data_size, int data_size,
2484 int empty, u32 min_slot)
2476{ 2485{
2477 struct extent_buffer *left = path->nodes[0]; 2486 struct extent_buffer *left = path->nodes[0];
2478 struct extent_buffer *right; 2487 struct extent_buffer *right;
@@ -2514,8 +2523,8 @@ static int push_leaf_right(struct btrfs_trans_handle *trans, struct btrfs_root
2514 if (left_nritems == 0) 2523 if (left_nritems == 0)
2515 goto out_unlock; 2524 goto out_unlock;
2516 2525
2517 return __push_leaf_right(trans, root, path, data_size, empty, 2526 return __push_leaf_right(trans, root, path, min_data_size, empty,
2518 right, free_space, left_nritems); 2527 right, free_space, left_nritems, min_slot);
2519out_unlock: 2528out_unlock:
2520 btrfs_tree_unlock(right); 2529 btrfs_tree_unlock(right);
2521 free_extent_buffer(right); 2530 free_extent_buffer(right);
@@ -2525,12 +2534,17 @@ out_unlock:
2525/* 2534/*
2526 * push some data in the path leaf to the left, trying to free up at 2535 * push some data in the path leaf to the left, trying to free up at
2527 * least data_size bytes. returns zero if the push worked, nonzero otherwise 2536 * least data_size bytes. returns zero if the push worked, nonzero otherwise
2537 *
2538 * max_slot can put a limit on how far into the leaf we'll push items. The
2539 * item at 'max_slot' won't be touched. Use (u32)-1 to make us do all the
2540 * items
2528 */ 2541 */
2529static noinline int __push_leaf_left(struct btrfs_trans_handle *trans, 2542static noinline int __push_leaf_left(struct btrfs_trans_handle *trans,
2530 struct btrfs_root *root, 2543 struct btrfs_root *root,
2531 struct btrfs_path *path, int data_size, 2544 struct btrfs_path *path, int data_size,
2532 int empty, struct extent_buffer *left, 2545 int empty, struct extent_buffer *left,
2533 int free_space, int right_nritems) 2546 int free_space, u32 right_nritems,
2547 u32 max_slot)
2534{ 2548{
2535 struct btrfs_disk_key disk_key; 2549 struct btrfs_disk_key disk_key;
2536 struct extent_buffer *right = path->nodes[0]; 2550 struct extent_buffer *right = path->nodes[0];
@@ -2549,9 +2563,9 @@ static noinline int __push_leaf_left(struct btrfs_trans_handle *trans,
2549 slot = path->slots[1]; 2563 slot = path->slots[1];
2550 2564
2551 if (empty) 2565 if (empty)
2552 nr = right_nritems; 2566 nr = min(right_nritems, max_slot);
2553 else 2567 else
2554 nr = right_nritems - 1; 2568 nr = min(right_nritems - 1, max_slot);
2555 2569
2556 for (i = 0; i < nr; i++) { 2570 for (i = 0; i < nr; i++) {
2557 item = btrfs_item_nr(right, i); 2571 item = btrfs_item_nr(right, i);
@@ -2712,10 +2726,14 @@ out:
2712/* 2726/*
2713 * push some data in the path leaf to the left, trying to free up at 2727 * push some data in the path leaf to the left, trying to free up at
2714 * least data_size bytes. returns zero if the push worked, nonzero otherwise 2728 * least data_size bytes. returns zero if the push worked, nonzero otherwise
2729 *
2730 * max_slot can put a limit on how far into the leaf we'll push items. The
2731 * item at 'max_slot' won't be touched. Use (u32)-1 to make us push all the
2732 * items
2715 */ 2733 */
2716static int push_leaf_left(struct btrfs_trans_handle *trans, struct btrfs_root 2734static int push_leaf_left(struct btrfs_trans_handle *trans, struct btrfs_root
2717 *root, struct btrfs_path *path, int data_size, 2735 *root, struct btrfs_path *path, int min_data_size,
2718 int empty) 2736 int data_size, int empty, u32 max_slot)
2719{ 2737{
2720 struct extent_buffer *right = path->nodes[0]; 2738 struct extent_buffer *right = path->nodes[0];
2721 struct extent_buffer *left; 2739 struct extent_buffer *left;
@@ -2761,8 +2779,9 @@ static int push_leaf_left(struct btrfs_trans_handle *trans, struct btrfs_root
2761 goto out; 2779 goto out;
2762 } 2780 }
2763 2781
2764 return __push_leaf_left(trans, root, path, data_size, 2782 return __push_leaf_left(trans, root, path, min_data_size,
2765 empty, left, free_space, right_nritems); 2783 empty, left, free_space, right_nritems,
2784 max_slot);
2766out: 2785out:
2767 btrfs_tree_unlock(left); 2786 btrfs_tree_unlock(left);
2768 free_extent_buffer(left); 2787 free_extent_buffer(left);
@@ -2855,6 +2874,64 @@ static noinline int copy_for_split(struct btrfs_trans_handle *trans,
2855} 2874}
2856 2875
2857/* 2876/*
2877 * double splits happen when we need to insert a big item in the middle
2878 * of a leaf. A double split can leave us with 3 mostly empty leaves:
2879 * leaf: [ slots 0 - N] [ our target ] [ N + 1 - total in leaf ]
2880 * A B C
2881 *
2882 * We avoid this by trying to push the items on either side of our target
2883 * into the adjacent leaves. If all goes well we can avoid the double split
2884 * completely.
2885 */
2886static noinline int push_for_double_split(struct btrfs_trans_handle *trans,
2887 struct btrfs_root *root,
2888 struct btrfs_path *path,
2889 int data_size)
2890{
2891 int ret;
2892 int progress = 0;
2893 int slot;
2894 u32 nritems;
2895
2896 slot = path->slots[0];
2897
2898 /*
2899 * try to push all the items after our slot into the
2900 * right leaf
2901 */
2902 ret = push_leaf_right(trans, root, path, 1, data_size, 0, slot);
2903 if (ret < 0)
2904 return ret;
2905
2906 if (ret == 0)
2907 progress++;
2908
2909 nritems = btrfs_header_nritems(path->nodes[0]);
2910 /*
2911 * our goal is to get our slot at the start or end of a leaf. If
2912 * we've done so we're done
2913 */
2914 if (path->slots[0] == 0 || path->slots[0] == nritems)
2915 return 0;
2916
2917 if (btrfs_leaf_free_space(root, path->nodes[0]) >= data_size)
2918 return 0;
2919
2920 /* try to push all the items before our slot into the next leaf */
2921 slot = path->slots[0];
2922 ret = push_leaf_left(trans, root, path, 1, data_size, 0, slot);
2923 if (ret < 0)
2924 return ret;
2925
2926 if (ret == 0)
2927 progress++;
2928
2929 if (progress)
2930 return 0;
2931 return 1;
2932}
2933
2934/*
2858 * split the path's leaf in two, making sure there is at least data_size 2935 * split the path's leaf in two, making sure there is at least data_size
2859 * available for the resulting leaf level of the path. 2936 * available for the resulting leaf level of the path.
2860 * 2937 *
@@ -2876,6 +2953,7 @@ static noinline int split_leaf(struct btrfs_trans_handle *trans,
2876 int wret; 2953 int wret;
2877 int split; 2954 int split;
2878 int num_doubles = 0; 2955 int num_doubles = 0;
2956 int tried_avoid_double = 0;
2879 2957
2880 l = path->nodes[0]; 2958 l = path->nodes[0];
2881 slot = path->slots[0]; 2959 slot = path->slots[0];
@@ -2884,12 +2962,14 @@ static noinline int split_leaf(struct btrfs_trans_handle *trans,
2884 return -EOVERFLOW; 2962 return -EOVERFLOW;
2885 2963
2886 /* first try to make some room by pushing left and right */ 2964 /* first try to make some room by pushing left and right */
2887 if (data_size && ins_key->type != BTRFS_DIR_ITEM_KEY) { 2965 if (data_size) {
2888 wret = push_leaf_right(trans, root, path, data_size, 0); 2966 wret = push_leaf_right(trans, root, path, data_size,
2967 data_size, 0, 0);
2889 if (wret < 0) 2968 if (wret < 0)
2890 return wret; 2969 return wret;
2891 if (wret) { 2970 if (wret) {
2892 wret = push_leaf_left(trans, root, path, data_size, 0); 2971 wret = push_leaf_left(trans, root, path, data_size,
2972 data_size, 0, (u32)-1);
2893 if (wret < 0) 2973 if (wret < 0)
2894 return wret; 2974 return wret;
2895 } 2975 }
@@ -2923,6 +3003,8 @@ again:
2923 if (mid != nritems && 3003 if (mid != nritems &&
2924 leaf_space_used(l, mid, nritems - mid) + 3004 leaf_space_used(l, mid, nritems - mid) +
2925 data_size > BTRFS_LEAF_DATA_SIZE(root)) { 3005 data_size > BTRFS_LEAF_DATA_SIZE(root)) {
3006 if (data_size && !tried_avoid_double)
3007 goto push_for_double;
2926 split = 2; 3008 split = 2;
2927 } 3009 }
2928 } 3010 }
@@ -2939,6 +3021,8 @@ again:
2939 if (mid != nritems && 3021 if (mid != nritems &&
2940 leaf_space_used(l, mid, nritems - mid) + 3022 leaf_space_used(l, mid, nritems - mid) +
2941 data_size > BTRFS_LEAF_DATA_SIZE(root)) { 3023 data_size > BTRFS_LEAF_DATA_SIZE(root)) {
3024 if (data_size && !tried_avoid_double)
3025 goto push_for_double;
2942 split = 2 ; 3026 split = 2 ;
2943 } 3027 }
2944 } 3028 }
@@ -3019,6 +3103,13 @@ again:
3019 } 3103 }
3020 3104
3021 return ret; 3105 return ret;
3106
3107push_for_double:
3108 push_for_double_split(trans, root, path, data_size);
3109 tried_avoid_double = 1;
3110 if (btrfs_leaf_free_space(root, path->nodes[0]) >= data_size)
3111 return 0;
3112 goto again;
3022} 3113}
3023 3114
3024static noinline int setup_leaf_for_split(struct btrfs_trans_handle *trans, 3115static noinline int setup_leaf_for_split(struct btrfs_trans_handle *trans,
@@ -3915,13 +4006,15 @@ int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root,
3915 extent_buffer_get(leaf); 4006 extent_buffer_get(leaf);
3916 4007
3917 btrfs_set_path_blocking(path); 4008 btrfs_set_path_blocking(path);
3918 wret = push_leaf_left(trans, root, path, 1, 1); 4009 wret = push_leaf_left(trans, root, path, 1, 1,
4010 1, (u32)-1);
3919 if (wret < 0 && wret != -ENOSPC) 4011 if (wret < 0 && wret != -ENOSPC)
3920 ret = wret; 4012 ret = wret;
3921 4013
3922 if (path->nodes[0] == leaf && 4014 if (path->nodes[0] == leaf &&
3923 btrfs_header_nritems(leaf)) { 4015 btrfs_header_nritems(leaf)) {
3924 wret = push_leaf_right(trans, root, path, 1, 1); 4016 wret = push_leaf_right(trans, root, path, 1,
4017 1, 1, 0);
3925 if (wret < 0 && wret != -ENOSPC) 4018 if (wret < 0 && wret != -ENOSPC)
3926 ret = wret; 4019 ret = wret;
3927 } 4020 }
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 4dbaf89b1337..9254b3d58dbe 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1458,7 +1458,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
1458 */ 1458 */
1459 1459
1460 /* the destination must be opened for writing */ 1460 /* the destination must be opened for writing */
1461 if (!(file->f_mode & FMODE_WRITE)) 1461 if (!(file->f_mode & FMODE_WRITE) || (file->f_flags & O_APPEND))
1462 return -EINVAL; 1462 return -EINVAL;
1463 1463
1464 ret = mnt_want_write(file->f_path.mnt); 1464 ret = mnt_want_write(file->f_path.mnt);
@@ -1511,7 +1511,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
1511 1511
1512 /* determine range to clone */ 1512 /* determine range to clone */
1513 ret = -EINVAL; 1513 ret = -EINVAL;
1514 if (off >= src->i_size || off + len > src->i_size) 1514 if (off + len > src->i_size || off + len < off)
1515 goto out_unlock; 1515 goto out_unlock;
1516 if (len == 0) 1516 if (len == 0)
1517 olen = len = src->i_size - off; 1517 olen = len = src->i_size - off;
@@ -1578,6 +1578,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
1578 u64 disko = 0, diskl = 0; 1578 u64 disko = 0, diskl = 0;
1579 u64 datao = 0, datal = 0; 1579 u64 datao = 0, datal = 0;
1580 u8 comp; 1580 u8 comp;
1581 u64 endoff;
1581 1582
1582 size = btrfs_item_size_nr(leaf, slot); 1583 size = btrfs_item_size_nr(leaf, slot);
1583 read_extent_buffer(leaf, buf, 1584 read_extent_buffer(leaf, buf,
@@ -1712,9 +1713,18 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
1712 btrfs_release_path(root, path); 1713 btrfs_release_path(root, path);
1713 1714
1714 inode->i_mtime = inode->i_ctime = CURRENT_TIME; 1715 inode->i_mtime = inode->i_ctime = CURRENT_TIME;
1715 if (new_key.offset + datal > inode->i_size) 1716
1716 btrfs_i_size_write(inode, 1717 /*
1717 new_key.offset + datal); 1718 * we round up to the block size at eof when
1719 * determining which extents to clone above,
1720 * but shouldn't round up the file size
1721 */
1722 endoff = new_key.offset + datal;
1723 if (endoff > off+olen)
1724 endoff = off+olen;
1725 if (endoff > inode->i_size)
1726 btrfs_i_size_write(inode, endoff);
1727
1718 BTRFS_I(inode)->flags = BTRFS_I(src)->flags; 1728 BTRFS_I(inode)->flags = BTRFS_I(src)->flags;
1719 ret = btrfs_update_inode(trans, root, inode); 1729 ret = btrfs_update_inode(trans, root, inode);
1720 BUG_ON(ret); 1730 BUG_ON(ret);
diff --git a/fs/ceph/Kconfig b/fs/ceph/Kconfig
index 04b8280582a9..bc87b9c1d27e 100644
--- a/fs/ceph/Kconfig
+++ b/fs/ceph/Kconfig
@@ -2,7 +2,7 @@ config CEPH_FS
2 tristate "Ceph distributed file system (EXPERIMENTAL)" 2 tristate "Ceph distributed file system (EXPERIMENTAL)"
3 depends on INET && EXPERIMENTAL 3 depends on INET && EXPERIMENTAL
4 select LIBCRC32C 4 select LIBCRC32C
5 select CONFIG_CRYPTO_AES 5 select CRYPTO_AES
6 help 6 help
7 Choose Y or M here to include support for mounting the 7 Choose Y or M here to include support for mounting the
8 experimental Ceph distributed file system. Ceph is an extremely 8 experimental Ceph distributed file system. Ceph is an extremely
diff --git a/fs/ceph/auth_x.c b/fs/ceph/auth_x.c
index 3fe49042d8ad..6d44053ecff1 100644
--- a/fs/ceph/auth_x.c
+++ b/fs/ceph/auth_x.c
@@ -613,6 +613,9 @@ static void ceph_x_destroy(struct ceph_auth_client *ac)
613 remove_ticket_handler(ac, th); 613 remove_ticket_handler(ac, th);
614 } 614 }
615 615
616 if (xi->auth_authorizer.buf)
617 ceph_buffer_put(xi->auth_authorizer.buf);
618
616 kfree(ac->private); 619 kfree(ac->private);
617 ac->private = NULL; 620 ac->private = NULL;
618} 621}
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 74144d6389f0..b81be9a56487 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -627,7 +627,7 @@ retry:
627 if (fmode >= 0) 627 if (fmode >= 0)
628 __ceph_get_fmode(ci, fmode); 628 __ceph_get_fmode(ci, fmode);
629 spin_unlock(&inode->i_lock); 629 spin_unlock(&inode->i_lock);
630 wake_up(&ci->i_cap_wq); 630 wake_up_all(&ci->i_cap_wq);
631 return 0; 631 return 0;
632} 632}
633 633
@@ -1181,7 +1181,7 @@ static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap,
1181 } 1181 }
1182 1182
1183 if (wake) 1183 if (wake)
1184 wake_up(&ci->i_cap_wq); 1184 wake_up_all(&ci->i_cap_wq);
1185 1185
1186 return delayed; 1186 return delayed;
1187} 1187}
@@ -2153,7 +2153,7 @@ void ceph_put_cap_refs(struct ceph_inode_info *ci, int had)
2153 else if (flushsnaps) 2153 else if (flushsnaps)
2154 ceph_flush_snaps(ci); 2154 ceph_flush_snaps(ci);
2155 if (wake) 2155 if (wake)
2156 wake_up(&ci->i_cap_wq); 2156 wake_up_all(&ci->i_cap_wq);
2157 if (put) 2157 if (put)
2158 iput(inode); 2158 iput(inode);
2159} 2159}
@@ -2229,7 +2229,7 @@ void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr,
2229 iput(inode); 2229 iput(inode);
2230 } else if (complete_capsnap) { 2230 } else if (complete_capsnap) {
2231 ceph_flush_snaps(ci); 2231 ceph_flush_snaps(ci);
2232 wake_up(&ci->i_cap_wq); 2232 wake_up_all(&ci->i_cap_wq);
2233 } 2233 }
2234 if (drop_capsnap) 2234 if (drop_capsnap)
2235 iput(inode); 2235 iput(inode);
@@ -2405,7 +2405,7 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant,
2405 if (queue_invalidate) 2405 if (queue_invalidate)
2406 ceph_queue_invalidate(inode); 2406 ceph_queue_invalidate(inode);
2407 if (wake) 2407 if (wake)
2408 wake_up(&ci->i_cap_wq); 2408 wake_up_all(&ci->i_cap_wq);
2409 2409
2410 if (check_caps == 1) 2410 if (check_caps == 1)
2411 ceph_check_caps(ci, CHECK_CAPS_NODELAY|CHECK_CAPS_AUTHONLY, 2411 ceph_check_caps(ci, CHECK_CAPS_NODELAY|CHECK_CAPS_AUTHONLY,
@@ -2460,7 +2460,7 @@ static void handle_cap_flush_ack(struct inode *inode, u64 flush_tid,
2460 struct ceph_inode_info, 2460 struct ceph_inode_info,
2461 i_flushing_item)->vfs_inode); 2461 i_flushing_item)->vfs_inode);
2462 mdsc->num_cap_flushing--; 2462 mdsc->num_cap_flushing--;
2463 wake_up(&mdsc->cap_flushing_wq); 2463 wake_up_all(&mdsc->cap_flushing_wq);
2464 dout(" inode %p now !flushing\n", inode); 2464 dout(" inode %p now !flushing\n", inode);
2465 2465
2466 if (ci->i_dirty_caps == 0) { 2466 if (ci->i_dirty_caps == 0) {
@@ -2472,7 +2472,7 @@ static void handle_cap_flush_ack(struct inode *inode, u64 flush_tid,
2472 } 2472 }
2473 } 2473 }
2474 spin_unlock(&mdsc->cap_dirty_lock); 2474 spin_unlock(&mdsc->cap_dirty_lock);
2475 wake_up(&ci->i_cap_wq); 2475 wake_up_all(&ci->i_cap_wq);
2476 2476
2477out: 2477out:
2478 spin_unlock(&inode->i_lock); 2478 spin_unlock(&inode->i_lock);
@@ -2984,6 +2984,7 @@ int ceph_encode_dentry_release(void **p, struct dentry *dentry,
2984 memcpy(*p, dentry->d_name.name, dentry->d_name.len); 2984 memcpy(*p, dentry->d_name.name, dentry->d_name.len);
2985 *p += dentry->d_name.len; 2985 *p += dentry->d_name.len;
2986 rel->dname_seq = cpu_to_le32(di->lease_seq); 2986 rel->dname_seq = cpu_to_le32(di->lease_seq);
2987 __ceph_mdsc_drop_dentry_lease(dentry);
2987 } 2988 }
2988 spin_unlock(&dentry->d_lock); 2989 spin_unlock(&dentry->d_lock);
2989 return ret; 2990 return ret;
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index f85719310db2..f94ed3c7f6a5 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -266,6 +266,7 @@ static int ceph_readdir(struct file *filp, void *dirent, filldir_t filldir)
266 spin_lock(&inode->i_lock); 266 spin_lock(&inode->i_lock);
267 if ((filp->f_pos == 2 || fi->dentry) && 267 if ((filp->f_pos == 2 || fi->dentry) &&
268 !ceph_test_opt(client, NOASYNCREADDIR) && 268 !ceph_test_opt(client, NOASYNCREADDIR) &&
269 ceph_snap(inode) != CEPH_SNAPDIR &&
269 (ci->i_ceph_flags & CEPH_I_COMPLETE) && 270 (ci->i_ceph_flags & CEPH_I_COMPLETE) &&
270 __ceph_caps_issued_mask(ci, CEPH_CAP_FILE_SHARED, 1)) { 271 __ceph_caps_issued_mask(ci, CEPH_CAP_FILE_SHARED, 1)) {
271 err = __dcache_readdir(filp, dirent, filldir); 272 err = __dcache_readdir(filp, dirent, filldir);
@@ -1013,18 +1014,22 @@ out_touch:
1013 1014
1014/* 1015/*
1015 * When a dentry is released, clear the dir I_COMPLETE if it was part 1016 * When a dentry is released, clear the dir I_COMPLETE if it was part
1016 * of the current dir gen. 1017 * of the current dir gen or if this is in the snapshot namespace.
1017 */ 1018 */
1018static void ceph_dentry_release(struct dentry *dentry) 1019static void ceph_dentry_release(struct dentry *dentry)
1019{ 1020{
1020 struct ceph_dentry_info *di = ceph_dentry(dentry); 1021 struct ceph_dentry_info *di = ceph_dentry(dentry);
1021 struct inode *parent_inode = dentry->d_parent->d_inode; 1022 struct inode *parent_inode = dentry->d_parent->d_inode;
1023 u64 snapid = ceph_snap(parent_inode);
1022 1024
1023 if (parent_inode) { 1025 dout("dentry_release %p parent %p\n", dentry, parent_inode);
1026
1027 if (parent_inode && snapid != CEPH_SNAPDIR) {
1024 struct ceph_inode_info *ci = ceph_inode(parent_inode); 1028 struct ceph_inode_info *ci = ceph_inode(parent_inode);
1025 1029
1026 spin_lock(&parent_inode->i_lock); 1030 spin_lock(&parent_inode->i_lock);
1027 if (ci->i_shared_gen == di->lease_shared_gen) { 1031 if (ci->i_shared_gen == di->lease_shared_gen ||
1032 snapid <= CEPH_MAXSNAP) {
1028 dout(" clearing %p complete (d_release)\n", 1033 dout(" clearing %p complete (d_release)\n",
1029 parent_inode); 1034 parent_inode);
1030 ci->i_ceph_flags &= ~CEPH_I_COMPLETE; 1035 ci->i_ceph_flags &= ~CEPH_I_COMPLETE;
@@ -1241,7 +1246,9 @@ struct dentry_operations ceph_dentry_ops = {
1241 1246
1242struct dentry_operations ceph_snapdir_dentry_ops = { 1247struct dentry_operations ceph_snapdir_dentry_ops = {
1243 .d_revalidate = ceph_snapdir_d_revalidate, 1248 .d_revalidate = ceph_snapdir_d_revalidate,
1249 .d_release = ceph_dentry_release,
1244}; 1250};
1245 1251
1246struct dentry_operations ceph_snap_dentry_ops = { 1252struct dentry_operations ceph_snap_dentry_ops = {
1253 .d_release = ceph_dentry_release,
1247}; 1254};
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 6251a1574b94..7c08698fad3e 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -265,7 +265,7 @@ int ceph_release(struct inode *inode, struct file *file)
265 kmem_cache_free(ceph_file_cachep, cf); 265 kmem_cache_free(ceph_file_cachep, cf);
266 266
267 /* wake up anyone waiting for caps on this inode */ 267 /* wake up anyone waiting for caps on this inode */
268 wake_up(&ci->i_cap_wq); 268 wake_up_all(&ci->i_cap_wq);
269 return 0; 269 return 0;
270} 270}
271 271
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 8f9b9fe8ef9f..389f9dbd9949 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -1199,8 +1199,10 @@ retry_lookup:
1199 goto out; 1199 goto out;
1200 } 1200 }
1201 err = ceph_init_dentry(dn); 1201 err = ceph_init_dentry(dn);
1202 if (err < 0) 1202 if (err < 0) {
1203 dput(dn);
1203 goto out; 1204 goto out;
1205 }
1204 } else if (dn->d_inode && 1206 } else if (dn->d_inode &&
1205 (ceph_ino(dn->d_inode) != vino.ino || 1207 (ceph_ino(dn->d_inode) != vino.ino ||
1206 ceph_snap(dn->d_inode) != vino.snap)) { 1208 ceph_snap(dn->d_inode) != vino.snap)) {
@@ -1499,7 +1501,7 @@ retry:
1499 if (wrbuffer_refs == 0) 1501 if (wrbuffer_refs == 0)
1500 ceph_check_caps(ci, CHECK_CAPS_AUTHONLY, NULL); 1502 ceph_check_caps(ci, CHECK_CAPS_AUTHONLY, NULL);
1501 if (wake) 1503 if (wake)
1502 wake_up(&ci->i_cap_wq); 1504 wake_up_all(&ci->i_cap_wq);
1503} 1505}
1504 1506
1505 1507
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 3ab79f6c4ce8..dd440bd438a9 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -868,7 +868,7 @@ static int wake_up_session_cb(struct inode *inode, struct ceph_cap *cap,
868{ 868{
869 struct ceph_inode_info *ci = ceph_inode(inode); 869 struct ceph_inode_info *ci = ceph_inode(inode);
870 870
871 wake_up(&ci->i_cap_wq); 871 wake_up_all(&ci->i_cap_wq);
872 if (arg) { 872 if (arg) {
873 spin_lock(&inode->i_lock); 873 spin_lock(&inode->i_lock);
874 ci->i_wanted_max_size = 0; 874 ci->i_wanted_max_size = 0;
@@ -1514,6 +1514,9 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc,
1514 ceph_encode_filepath(&p, end, ino1, path1); 1514 ceph_encode_filepath(&p, end, ino1, path1);
1515 ceph_encode_filepath(&p, end, ino2, path2); 1515 ceph_encode_filepath(&p, end, ino2, path2);
1516 1516
1517 /* make note of release offset, in case we need to replay */
1518 req->r_request_release_offset = p - msg->front.iov_base;
1519
1517 /* cap releases */ 1520 /* cap releases */
1518 releases = 0; 1521 releases = 0;
1519 if (req->r_inode_drop) 1522 if (req->r_inode_drop)
@@ -1561,7 +1564,7 @@ static void complete_request(struct ceph_mds_client *mdsc,
1561 if (req->r_callback) 1564 if (req->r_callback)
1562 req->r_callback(mdsc, req); 1565 req->r_callback(mdsc, req);
1563 else 1566 else
1564 complete(&req->r_completion); 1567 complete_all(&req->r_completion);
1565} 1568}
1566 1569
1567/* 1570/*
@@ -1580,6 +1583,32 @@ static int __prepare_send_request(struct ceph_mds_client *mdsc,
1580 dout("prepare_send_request %p tid %lld %s (attempt %d)\n", req, 1583 dout("prepare_send_request %p tid %lld %s (attempt %d)\n", req,
1581 req->r_tid, ceph_mds_op_name(req->r_op), req->r_attempts); 1584 req->r_tid, ceph_mds_op_name(req->r_op), req->r_attempts);
1582 1585
1586 if (req->r_got_unsafe) {
1587 /*
1588 * Replay. Do not regenerate message (and rebuild
1589 * paths, etc.); just use the original message.
1590 * Rebuilding paths will break for renames because
1591 * d_move mangles the src name.
1592 */
1593 msg = req->r_request;
1594 rhead = msg->front.iov_base;
1595
1596 flags = le32_to_cpu(rhead->flags);
1597 flags |= CEPH_MDS_FLAG_REPLAY;
1598 rhead->flags = cpu_to_le32(flags);
1599
1600 if (req->r_target_inode)
1601 rhead->ino = cpu_to_le64(ceph_ino(req->r_target_inode));
1602
1603 rhead->num_retry = req->r_attempts - 1;
1604
1605 /* remove cap/dentry releases from message */
1606 rhead->num_releases = 0;
1607 msg->hdr.front_len = cpu_to_le32(req->r_request_release_offset);
1608 msg->front.iov_len = req->r_request_release_offset;
1609 return 0;
1610 }
1611
1583 if (req->r_request) { 1612 if (req->r_request) {
1584 ceph_msg_put(req->r_request); 1613 ceph_msg_put(req->r_request);
1585 req->r_request = NULL; 1614 req->r_request = NULL;
@@ -1601,13 +1630,9 @@ static int __prepare_send_request(struct ceph_mds_client *mdsc,
1601 rhead->flags = cpu_to_le32(flags); 1630 rhead->flags = cpu_to_le32(flags);
1602 rhead->num_fwd = req->r_num_fwd; 1631 rhead->num_fwd = req->r_num_fwd;
1603 rhead->num_retry = req->r_attempts - 1; 1632 rhead->num_retry = req->r_attempts - 1;
1633 rhead->ino = 0;
1604 1634
1605 dout(" r_locked_dir = %p\n", req->r_locked_dir); 1635 dout(" r_locked_dir = %p\n", req->r_locked_dir);
1606
1607 if (req->r_target_inode && req->r_got_unsafe)
1608 rhead->ino = cpu_to_le64(ceph_ino(req->r_target_inode));
1609 else
1610 rhead->ino = 0;
1611 return 0; 1636 return 0;
1612} 1637}
1613 1638
@@ -1907,7 +1932,7 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg)
1907 if (head->safe) { 1932 if (head->safe) {
1908 req->r_got_safe = true; 1933 req->r_got_safe = true;
1909 __unregister_request(mdsc, req); 1934 __unregister_request(mdsc, req);
1910 complete(&req->r_safe_completion); 1935 complete_all(&req->r_safe_completion);
1911 1936
1912 if (req->r_got_unsafe) { 1937 if (req->r_got_unsafe) {
1913 /* 1938 /*
@@ -1922,7 +1947,7 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg)
1922 1947
1923 /* last unsafe request during umount? */ 1948 /* last unsafe request during umount? */
1924 if (mdsc->stopping && !__get_oldest_req(mdsc)) 1949 if (mdsc->stopping && !__get_oldest_req(mdsc))
1925 complete(&mdsc->safe_umount_waiters); 1950 complete_all(&mdsc->safe_umount_waiters);
1926 mutex_unlock(&mdsc->mutex); 1951 mutex_unlock(&mdsc->mutex);
1927 goto out; 1952 goto out;
1928 } 1953 }
@@ -2101,7 +2126,7 @@ static void handle_session(struct ceph_mds_session *session,
2101 pr_info("mds%d reconnect denied\n", session->s_mds); 2126 pr_info("mds%d reconnect denied\n", session->s_mds);
2102 remove_session_caps(session); 2127 remove_session_caps(session);
2103 wake = 1; /* for good measure */ 2128 wake = 1; /* for good measure */
2104 complete(&mdsc->session_close_waiters); 2129 complete_all(&mdsc->session_close_waiters);
2105 kick_requests(mdsc, mds); 2130 kick_requests(mdsc, mds);
2106 break; 2131 break;
2107 2132
diff --git a/fs/ceph/mds_client.h b/fs/ceph/mds_client.h
index b292fa42a66d..952410c60d09 100644
--- a/fs/ceph/mds_client.h
+++ b/fs/ceph/mds_client.h
@@ -188,6 +188,7 @@ struct ceph_mds_request {
188 int r_old_inode_drop, r_old_inode_unless; 188 int r_old_inode_drop, r_old_inode_unless;
189 189
190 struct ceph_msg *r_request; /* original request */ 190 struct ceph_msg *r_request; /* original request */
191 int r_request_release_offset;
191 struct ceph_msg *r_reply; 192 struct ceph_msg *r_reply;
192 struct ceph_mds_reply_info_parsed r_reply_info; 193 struct ceph_mds_reply_info_parsed r_reply_info;
193 int r_err; 194 int r_err;
diff --git a/fs/ceph/messenger.c b/fs/ceph/messenger.c
index 9ad43a310a41..15167b2daa55 100644
--- a/fs/ceph/messenger.c
+++ b/fs/ceph/messenger.c
@@ -43,7 +43,8 @@ static void ceph_fault(struct ceph_connection *con);
43 * nicely render a sockaddr as a string. 43 * nicely render a sockaddr as a string.
44 */ 44 */
45#define MAX_ADDR_STR 20 45#define MAX_ADDR_STR 20
46static char addr_str[MAX_ADDR_STR][40]; 46#define MAX_ADDR_STR_LEN 60
47static char addr_str[MAX_ADDR_STR][MAX_ADDR_STR_LEN];
47static DEFINE_SPINLOCK(addr_str_lock); 48static DEFINE_SPINLOCK(addr_str_lock);
48static int last_addr_str; 49static int last_addr_str;
49 50
@@ -52,7 +53,6 @@ const char *pr_addr(const struct sockaddr_storage *ss)
52 int i; 53 int i;
53 char *s; 54 char *s;
54 struct sockaddr_in *in4 = (void *)ss; 55 struct sockaddr_in *in4 = (void *)ss;
55 unsigned char *quad = (void *)&in4->sin_addr.s_addr;
56 struct sockaddr_in6 *in6 = (void *)ss; 56 struct sockaddr_in6 *in6 = (void *)ss;
57 57
58 spin_lock(&addr_str_lock); 58 spin_lock(&addr_str_lock);
@@ -64,25 +64,13 @@ const char *pr_addr(const struct sockaddr_storage *ss)
64 64
65 switch (ss->ss_family) { 65 switch (ss->ss_family) {
66 case AF_INET: 66 case AF_INET:
67 sprintf(s, "%u.%u.%u.%u:%u", 67 snprintf(s, MAX_ADDR_STR_LEN, "%pI4:%u", &in4->sin_addr,
68 (unsigned int)quad[0], 68 (unsigned int)ntohs(in4->sin_port));
69 (unsigned int)quad[1],
70 (unsigned int)quad[2],
71 (unsigned int)quad[3],
72 (unsigned int)ntohs(in4->sin_port));
73 break; 69 break;
74 70
75 case AF_INET6: 71 case AF_INET6:
76 sprintf(s, "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x:%u", 72 snprintf(s, MAX_ADDR_STR_LEN, "[%pI6c]:%u", &in6->sin6_addr,
77 in6->sin6_addr.s6_addr16[0], 73 (unsigned int)ntohs(in6->sin6_port));
78 in6->sin6_addr.s6_addr16[1],
79 in6->sin6_addr.s6_addr16[2],
80 in6->sin6_addr.s6_addr16[3],
81 in6->sin6_addr.s6_addr16[4],
82 in6->sin6_addr.s6_addr16[5],
83 in6->sin6_addr.s6_addr16[6],
84 in6->sin6_addr.s6_addr16[7],
85 (unsigned int)ntohs(in6->sin6_port));
86 break; 74 break;
87 75
88 default: 76 default:
@@ -215,12 +203,13 @@ static void set_sock_callbacks(struct socket *sock,
215 */ 203 */
216static struct socket *ceph_tcp_connect(struct ceph_connection *con) 204static struct socket *ceph_tcp_connect(struct ceph_connection *con)
217{ 205{
218 struct sockaddr *paddr = (struct sockaddr *)&con->peer_addr.in_addr; 206 struct sockaddr_storage *paddr = &con->peer_addr.in_addr;
219 struct socket *sock; 207 struct socket *sock;
220 int ret; 208 int ret;
221 209
222 BUG_ON(con->sock); 210 BUG_ON(con->sock);
223 ret = sock_create_kern(AF_INET, SOCK_STREAM, IPPROTO_TCP, &sock); 211 ret = sock_create_kern(con->peer_addr.in_addr.ss_family, SOCK_STREAM,
212 IPPROTO_TCP, &sock);
224 if (ret) 213 if (ret)
225 return ERR_PTR(ret); 214 return ERR_PTR(ret);
226 con->sock = sock; 215 con->sock = sock;
@@ -234,7 +223,8 @@ static struct socket *ceph_tcp_connect(struct ceph_connection *con)
234 223
235 dout("connect %s\n", pr_addr(&con->peer_addr.in_addr)); 224 dout("connect %s\n", pr_addr(&con->peer_addr.in_addr));
236 225
237 ret = sock->ops->connect(sock, paddr, sizeof(*paddr), O_NONBLOCK); 226 ret = sock->ops->connect(sock, (struct sockaddr *)paddr, sizeof(*paddr),
227 O_NONBLOCK);
238 if (ret == -EINPROGRESS) { 228 if (ret == -EINPROGRESS) {
239 dout("connect %s EINPROGRESS sk_state = %u\n", 229 dout("connect %s EINPROGRESS sk_state = %u\n",
240 pr_addr(&con->peer_addr.in_addr), 230 pr_addr(&con->peer_addr.in_addr),
@@ -1009,19 +999,32 @@ int ceph_parse_ips(const char *c, const char *end,
1009 struct sockaddr_in *in4 = (void *)ss; 999 struct sockaddr_in *in4 = (void *)ss;
1010 struct sockaddr_in6 *in6 = (void *)ss; 1000 struct sockaddr_in6 *in6 = (void *)ss;
1011 int port; 1001 int port;
1002 char delim = ',';
1003
1004 if (*p == '[') {
1005 delim = ']';
1006 p++;
1007 }
1012 1008
1013 memset(ss, 0, sizeof(*ss)); 1009 memset(ss, 0, sizeof(*ss));
1014 if (in4_pton(p, end - p, (u8 *)&in4->sin_addr.s_addr, 1010 if (in4_pton(p, end - p, (u8 *)&in4->sin_addr.s_addr,
1015 ',', &ipend)) { 1011 delim, &ipend))
1016 ss->ss_family = AF_INET; 1012 ss->ss_family = AF_INET;
1017 } else if (in6_pton(p, end - p, (u8 *)&in6->sin6_addr.s6_addr, 1013 else if (in6_pton(p, end - p, (u8 *)&in6->sin6_addr.s6_addr,
1018 ',', &ipend)) { 1014 delim, &ipend))
1019 ss->ss_family = AF_INET6; 1015 ss->ss_family = AF_INET6;
1020 } else { 1016 else
1021 goto bad; 1017 goto bad;
1022 }
1023 p = ipend; 1018 p = ipend;
1024 1019
1020 if (delim == ']') {
1021 if (*p != ']') {
1022 dout("missing matching ']'\n");
1023 goto bad;
1024 }
1025 p++;
1026 }
1027
1025 /* port? */ 1028 /* port? */
1026 if (p < end && *p == ':') { 1029 if (p < end && *p == ':') {
1027 port = 0; 1030 port = 0;
@@ -1055,7 +1058,7 @@ int ceph_parse_ips(const char *c, const char *end,
1055 return 0; 1058 return 0;
1056 1059
1057bad: 1060bad:
1058 pr_err("parse_ips bad ip '%s'\n", c); 1061 pr_err("parse_ips bad ip '%.*s'\n", (int)(end - c), c);
1059 return -EINVAL; 1062 return -EINVAL;
1060} 1063}
1061 1064
@@ -2015,20 +2018,20 @@ void ceph_con_revoke(struct ceph_connection *con, struct ceph_msg *msg)
2015{ 2018{
2016 mutex_lock(&con->mutex); 2019 mutex_lock(&con->mutex);
2017 if (!list_empty(&msg->list_head)) { 2020 if (!list_empty(&msg->list_head)) {
2018 dout("con_revoke %p msg %p\n", con, msg); 2021 dout("con_revoke %p msg %p - was on queue\n", con, msg);
2019 list_del_init(&msg->list_head); 2022 list_del_init(&msg->list_head);
2020 ceph_msg_put(msg); 2023 ceph_msg_put(msg);
2021 msg->hdr.seq = 0; 2024 msg->hdr.seq = 0;
2022 if (con->out_msg == msg) { 2025 }
2023 ceph_msg_put(con->out_msg); 2026 if (con->out_msg == msg) {
2024 con->out_msg = NULL; 2027 dout("con_revoke %p msg %p - was sending\n", con, msg);
2025 } 2028 con->out_msg = NULL;
2026 if (con->out_kvec_is_msg) { 2029 if (con->out_kvec_is_msg) {
2027 con->out_skip = con->out_kvec_bytes; 2030 con->out_skip = con->out_kvec_bytes;
2028 con->out_kvec_is_msg = false; 2031 con->out_kvec_is_msg = false;
2029 } 2032 }
2030 } else { 2033 ceph_msg_put(msg);
2031 dout("con_revoke %p msg %p - not queued (sent?)\n", con, msg); 2034 msg->hdr.seq = 0;
2032 } 2035 }
2033 mutex_unlock(&con->mutex); 2036 mutex_unlock(&con->mutex);
2034} 2037}
diff --git a/fs/ceph/mon_client.c b/fs/ceph/mon_client.c
index cc115eafae11..54fe01c50706 100644
--- a/fs/ceph/mon_client.c
+++ b/fs/ceph/mon_client.c
@@ -345,7 +345,7 @@ static void ceph_monc_handle_map(struct ceph_mon_client *monc,
345 345
346out: 346out:
347 mutex_unlock(&monc->mutex); 347 mutex_unlock(&monc->mutex);
348 wake_up(&client->auth_wq); 348 wake_up_all(&client->auth_wq);
349} 349}
350 350
351/* 351/*
@@ -462,7 +462,7 @@ static void handle_statfs_reply(struct ceph_mon_client *monc,
462 } 462 }
463 mutex_unlock(&monc->mutex); 463 mutex_unlock(&monc->mutex);
464 if (req) { 464 if (req) {
465 complete(&req->completion); 465 complete_all(&req->completion);
466 put_generic_request(req); 466 put_generic_request(req);
467 } 467 }
468 return; 468 return;
@@ -718,7 +718,7 @@ static void handle_auth_reply(struct ceph_mon_client *monc,
718 monc->m_auth->front_max); 718 monc->m_auth->front_max);
719 if (ret < 0) { 719 if (ret < 0) {
720 monc->client->auth_err = ret; 720 monc->client->auth_err = ret;
721 wake_up(&monc->client->auth_wq); 721 wake_up_all(&monc->client->auth_wq);
722 } else if (ret > 0) { 722 } else if (ret > 0) {
723 __send_prepared_auth_request(monc, ret); 723 __send_prepared_auth_request(monc, ret);
724 } else if (!was_auth && monc->auth->ops->is_authenticated(monc->auth)) { 724 } else if (!was_auth && monc->auth->ops->is_authenticated(monc->auth)) {
diff --git a/fs/ceph/osd_client.c b/fs/ceph/osd_client.c
index 92b7251a53f1..e38522347898 100644
--- a/fs/ceph/osd_client.c
+++ b/fs/ceph/osd_client.c
@@ -862,12 +862,12 @@ static void handle_reply(struct ceph_osd_client *osdc, struct ceph_msg *msg,
862 if (req->r_callback) 862 if (req->r_callback)
863 req->r_callback(req, msg); 863 req->r_callback(req, msg);
864 else 864 else
865 complete(&req->r_completion); 865 complete_all(&req->r_completion);
866 866
867 if (flags & CEPH_OSD_FLAG_ONDISK) { 867 if (flags & CEPH_OSD_FLAG_ONDISK) {
868 if (req->r_safe_callback) 868 if (req->r_safe_callback)
869 req->r_safe_callback(req, msg); 869 req->r_safe_callback(req, msg);
870 complete(&req->r_safe_completion); /* fsync waiter */ 870 complete_all(&req->r_safe_completion); /* fsync waiter */
871 } 871 }
872 872
873done: 873done:
@@ -1083,7 +1083,7 @@ done:
1083 if (newmap) 1083 if (newmap)
1084 kick_requests(osdc, NULL); 1084 kick_requests(osdc, NULL);
1085 up_read(&osdc->map_sem); 1085 up_read(&osdc->map_sem);
1086 wake_up(&osdc->client->auth_wq); 1086 wake_up_all(&osdc->client->auth_wq);
1087 return; 1087 return;
1088 1088
1089bad: 1089bad:
diff --git a/fs/ceph/osdmap.c b/fs/ceph/osdmap.c
index 50ce64ebd330..416d46adbf87 100644
--- a/fs/ceph/osdmap.c
+++ b/fs/ceph/osdmap.c
@@ -568,6 +568,7 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end)
568 if (ev > CEPH_PG_POOL_VERSION) { 568 if (ev > CEPH_PG_POOL_VERSION) {
569 pr_warning("got unknown v %d > %d of ceph_pg_pool\n", 569 pr_warning("got unknown v %d > %d of ceph_pg_pool\n",
570 ev, CEPH_PG_POOL_VERSION); 570 ev, CEPH_PG_POOL_VERSION);
571 kfree(pi);
571 goto bad; 572 goto bad;
572 } 573 }
573 __decode_pool(p, pi); 574 __decode_pool(p, pi);
@@ -830,12 +831,13 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
830 /* remove any? */ 831 /* remove any? */
831 while (rbp && pgid_cmp(rb_entry(rbp, struct ceph_pg_mapping, 832 while (rbp && pgid_cmp(rb_entry(rbp, struct ceph_pg_mapping,
832 node)->pgid, pgid) <= 0) { 833 node)->pgid, pgid) <= 0) {
833 struct rb_node *cur = rbp; 834 struct ceph_pg_mapping *cur =
835 rb_entry(rbp, struct ceph_pg_mapping, node);
836
834 rbp = rb_next(rbp); 837 rbp = rb_next(rbp);
835 dout(" removed pg_temp %llx\n", 838 dout(" removed pg_temp %llx\n", *(u64 *)&cur->pgid);
836 *(u64 *)&rb_entry(cur, struct ceph_pg_mapping, 839 rb_erase(&cur->node, &map->pg_temp);
837 node)->pgid); 840 kfree(cur);
838 rb_erase(cur, &map->pg_temp);
839 } 841 }
840 842
841 if (pglen) { 843 if (pglen) {
@@ -851,19 +853,22 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
851 for (j = 0; j < pglen; j++) 853 for (j = 0; j < pglen; j++)
852 pg->osds[j] = ceph_decode_32(p); 854 pg->osds[j] = ceph_decode_32(p);
853 err = __insert_pg_mapping(pg, &map->pg_temp); 855 err = __insert_pg_mapping(pg, &map->pg_temp);
854 if (err) 856 if (err) {
857 kfree(pg);
855 goto bad; 858 goto bad;
859 }
856 dout(" added pg_temp %llx len %d\n", *(u64 *)&pgid, 860 dout(" added pg_temp %llx len %d\n", *(u64 *)&pgid,
857 pglen); 861 pglen);
858 } 862 }
859 } 863 }
860 while (rbp) { 864 while (rbp) {
861 struct rb_node *cur = rbp; 865 struct ceph_pg_mapping *cur =
866 rb_entry(rbp, struct ceph_pg_mapping, node);
867
862 rbp = rb_next(rbp); 868 rbp = rb_next(rbp);
863 dout(" removed pg_temp %llx\n", 869 dout(" removed pg_temp %llx\n", *(u64 *)&cur->pgid);
864 *(u64 *)&rb_entry(cur, struct ceph_pg_mapping, 870 rb_erase(&cur->node, &map->pg_temp);
865 node)->pgid); 871 kfree(cur);
866 rb_erase(cur, &map->pg_temp);
867 } 872 }
868 873
869 /* ignore the rest */ 874 /* ignore the rest */
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 484e52bb40bb..2cb1a70214d7 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -923,7 +923,7 @@ init_cifs(void)
923 goto out_unregister_filesystem; 923 goto out_unregister_filesystem;
924#endif 924#endif
925#ifdef CONFIG_CIFS_DFS_UPCALL 925#ifdef CONFIG_CIFS_DFS_UPCALL
926 rc = register_key_type(&key_type_dns_resolver); 926 rc = cifs_init_dns_resolver();
927 if (rc) 927 if (rc)
928 goto out_unregister_key_type; 928 goto out_unregister_key_type;
929#endif 929#endif
@@ -935,7 +935,7 @@ init_cifs(void)
935 935
936 out_unregister_resolver_key: 936 out_unregister_resolver_key:
937#ifdef CONFIG_CIFS_DFS_UPCALL 937#ifdef CONFIG_CIFS_DFS_UPCALL
938 unregister_key_type(&key_type_dns_resolver); 938 cifs_exit_dns_resolver();
939 out_unregister_key_type: 939 out_unregister_key_type:
940#endif 940#endif
941#ifdef CONFIG_CIFS_UPCALL 941#ifdef CONFIG_CIFS_UPCALL
@@ -961,7 +961,7 @@ exit_cifs(void)
961 cifs_proc_clean(); 961 cifs_proc_clean();
962#ifdef CONFIG_CIFS_DFS_UPCALL 962#ifdef CONFIG_CIFS_DFS_UPCALL
963 cifs_dfs_release_automount_timer(); 963 cifs_dfs_release_automount_timer();
964 unregister_key_type(&key_type_dns_resolver); 964 cifs_exit_dns_resolver();
965#endif 965#endif
966#ifdef CONFIG_CIFS_UPCALL 966#ifdef CONFIG_CIFS_UPCALL
967 unregister_key_type(&cifs_spnego_key_type); 967 unregister_key_type(&cifs_spnego_key_type);
diff --git a/fs/cifs/dns_resolve.c b/fs/cifs/dns_resolve.c
index 4db2c5e7283f..49315cbf742d 100644
--- a/fs/cifs/dns_resolve.c
+++ b/fs/cifs/dns_resolve.c
@@ -24,12 +24,16 @@
24 */ 24 */
25 25
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/keyctl.h>
28#include <linux/key-type.h>
27#include <keys/user-type.h> 29#include <keys/user-type.h>
28#include "dns_resolve.h" 30#include "dns_resolve.h"
29#include "cifsglob.h" 31#include "cifsglob.h"
30#include "cifsproto.h" 32#include "cifsproto.h"
31#include "cifs_debug.h" 33#include "cifs_debug.h"
32 34
35static const struct cred *dns_resolver_cache;
36
33/* Checks if supplied name is IP address 37/* Checks if supplied name is IP address
34 * returns: 38 * returns:
35 * 1 - name is IP 39 * 1 - name is IP
@@ -94,6 +98,7 @@ struct key_type key_type_dns_resolver = {
94int 98int
95dns_resolve_server_name_to_ip(const char *unc, char **ip_addr) 99dns_resolve_server_name_to_ip(const char *unc, char **ip_addr)
96{ 100{
101 const struct cred *saved_cred;
97 int rc = -EAGAIN; 102 int rc = -EAGAIN;
98 struct key *rkey = ERR_PTR(-EAGAIN); 103 struct key *rkey = ERR_PTR(-EAGAIN);
99 char *name; 104 char *name;
@@ -133,8 +138,15 @@ dns_resolve_server_name_to_ip(const char *unc, char **ip_addr)
133 goto skip_upcall; 138 goto skip_upcall;
134 } 139 }
135 140
141 saved_cred = override_creds(dns_resolver_cache);
136 rkey = request_key(&key_type_dns_resolver, name, ""); 142 rkey = request_key(&key_type_dns_resolver, name, "");
143 revert_creds(saved_cred);
137 if (!IS_ERR(rkey)) { 144 if (!IS_ERR(rkey)) {
145 if (!(rkey->perm & KEY_USR_VIEW)) {
146 down_read(&rkey->sem);
147 rkey->perm |= KEY_USR_VIEW;
148 up_read(&rkey->sem);
149 }
138 len = rkey->type_data.x[0]; 150 len = rkey->type_data.x[0];
139 data = rkey->payload.data; 151 data = rkey->payload.data;
140 } else { 152 } else {
@@ -165,4 +177,61 @@ out:
165 return rc; 177 return rc;
166} 178}
167 179
180int __init cifs_init_dns_resolver(void)
181{
182 struct cred *cred;
183 struct key *keyring;
184 int ret;
185
186 printk(KERN_NOTICE "Registering the %s key type\n",
187 key_type_dns_resolver.name);
188
189 /* create an override credential set with a special thread keyring in
190 * which DNS requests are cached
191 *
192 * this is used to prevent malicious redirections from being installed
193 * with add_key().
194 */
195 cred = prepare_kernel_cred(NULL);
196 if (!cred)
197 return -ENOMEM;
198
199 keyring = key_alloc(&key_type_keyring, ".dns_resolver", 0, 0, cred,
200 (KEY_POS_ALL & ~KEY_POS_SETATTR) |
201 KEY_USR_VIEW | KEY_USR_READ,
202 KEY_ALLOC_NOT_IN_QUOTA);
203 if (IS_ERR(keyring)) {
204 ret = PTR_ERR(keyring);
205 goto failed_put_cred;
206 }
207
208 ret = key_instantiate_and_link(keyring, NULL, 0, NULL, NULL);
209 if (ret < 0)
210 goto failed_put_key;
211
212 ret = register_key_type(&key_type_dns_resolver);
213 if (ret < 0)
214 goto failed_put_key;
215
216 /* instruct request_key() to use this special keyring as a cache for
217 * the results it looks up */
218 cred->thread_keyring = keyring;
219 cred->jit_keyring = KEY_REQKEY_DEFL_THREAD_KEYRING;
220 dns_resolver_cache = cred;
221 return 0;
222
223failed_put_key:
224 key_put(keyring);
225failed_put_cred:
226 put_cred(cred);
227 return ret;
228}
168 229
230void __exit cifs_exit_dns_resolver(void)
231{
232 key_revoke(dns_resolver_cache->thread_keyring);
233 unregister_key_type(&key_type_dns_resolver);
234 put_cred(dns_resolver_cache);
235 printk(KERN_NOTICE "Unregistered %s key type\n",
236 key_type_dns_resolver.name);
237}
diff --git a/fs/cifs/dns_resolve.h b/fs/cifs/dns_resolve.h
index 966e9288930b..26b9eaa9f5ee 100644
--- a/fs/cifs/dns_resolve.h
+++ b/fs/cifs/dns_resolve.h
@@ -24,8 +24,8 @@
24#define _DNS_RESOLVE_H 24#define _DNS_RESOLVE_H
25 25
26#ifdef __KERNEL__ 26#ifdef __KERNEL__
27#include <linux/key-type.h> 27extern int __init cifs_init_dns_resolver(void);
28extern struct key_type key_type_dns_resolver; 28extern void __exit cifs_exit_dns_resolver(void);
29extern int dns_resolve_server_name_to_ip(const char *unc, char **ip_addr); 29extern int dns_resolve_server_name_to_ip(const char *unc, char **ip_addr);
30#endif /* KERNEL */ 30#endif /* KERNEL */
31 31
diff --git a/fs/dcache.c b/fs/dcache.c
index c8c78ba07827..86d4db15473e 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -896,7 +896,7 @@ EXPORT_SYMBOL(shrink_dcache_parent);
896 * 896 *
897 * In this case we return -1 to tell the caller that we baled. 897 * In this case we return -1 to tell the caller that we baled.
898 */ 898 */
899static int shrink_dcache_memory(int nr, gfp_t gfp_mask) 899static int shrink_dcache_memory(struct shrinker *shrink, int nr, gfp_t gfp_mask)
900{ 900{
901 if (nr) { 901 if (nr) {
902 if (!(gfp_mask & __GFP_FS)) 902 if (!(gfp_mask & __GFP_FS))
diff --git a/fs/ecryptfs/messaging.c b/fs/ecryptfs/messaging.c
index 2d8dbce9d485..46c4dd8dfcc3 100644
--- a/fs/ecryptfs/messaging.c
+++ b/fs/ecryptfs/messaging.c
@@ -31,9 +31,9 @@ static struct mutex ecryptfs_msg_ctx_lists_mux;
31 31
32static struct hlist_head *ecryptfs_daemon_hash; 32static struct hlist_head *ecryptfs_daemon_hash;
33struct mutex ecryptfs_daemon_hash_mux; 33struct mutex ecryptfs_daemon_hash_mux;
34static int ecryptfs_hash_buckets; 34static int ecryptfs_hash_bits;
35#define ecryptfs_uid_hash(uid) \ 35#define ecryptfs_uid_hash(uid) \
36 hash_long((unsigned long)uid, ecryptfs_hash_buckets) 36 hash_long((unsigned long)uid, ecryptfs_hash_bits)
37 37
38static u32 ecryptfs_msg_counter; 38static u32 ecryptfs_msg_counter;
39static struct ecryptfs_msg_ctx *ecryptfs_msg_ctx_arr; 39static struct ecryptfs_msg_ctx *ecryptfs_msg_ctx_arr;
@@ -486,18 +486,19 @@ int ecryptfs_init_messaging(void)
486 } 486 }
487 mutex_init(&ecryptfs_daemon_hash_mux); 487 mutex_init(&ecryptfs_daemon_hash_mux);
488 mutex_lock(&ecryptfs_daemon_hash_mux); 488 mutex_lock(&ecryptfs_daemon_hash_mux);
489 ecryptfs_hash_buckets = 1; 489 ecryptfs_hash_bits = 1;
490 while (ecryptfs_number_of_users >> ecryptfs_hash_buckets) 490 while (ecryptfs_number_of_users >> ecryptfs_hash_bits)
491 ecryptfs_hash_buckets++; 491 ecryptfs_hash_bits++;
492 ecryptfs_daemon_hash = kmalloc((sizeof(struct hlist_head) 492 ecryptfs_daemon_hash = kmalloc((sizeof(struct hlist_head)
493 * ecryptfs_hash_buckets), GFP_KERNEL); 493 * (1 << ecryptfs_hash_bits)),
494 GFP_KERNEL);
494 if (!ecryptfs_daemon_hash) { 495 if (!ecryptfs_daemon_hash) {
495 rc = -ENOMEM; 496 rc = -ENOMEM;
496 printk(KERN_ERR "%s: Failed to allocate memory\n", __func__); 497 printk(KERN_ERR "%s: Failed to allocate memory\n", __func__);
497 mutex_unlock(&ecryptfs_daemon_hash_mux); 498 mutex_unlock(&ecryptfs_daemon_hash_mux);
498 goto out; 499 goto out;
499 } 500 }
500 for (i = 0; i < ecryptfs_hash_buckets; i++) 501 for (i = 0; i < (1 << ecryptfs_hash_bits); i++)
501 INIT_HLIST_HEAD(&ecryptfs_daemon_hash[i]); 502 INIT_HLIST_HEAD(&ecryptfs_daemon_hash[i]);
502 mutex_unlock(&ecryptfs_daemon_hash_mux); 503 mutex_unlock(&ecryptfs_daemon_hash_mux);
503 ecryptfs_msg_ctx_arr = kmalloc((sizeof(struct ecryptfs_msg_ctx) 504 ecryptfs_msg_ctx_arr = kmalloc((sizeof(struct ecryptfs_msg_ctx)
@@ -554,7 +555,7 @@ void ecryptfs_release_messaging(void)
554 int i; 555 int i;
555 556
556 mutex_lock(&ecryptfs_daemon_hash_mux); 557 mutex_lock(&ecryptfs_daemon_hash_mux);
557 for (i = 0; i < ecryptfs_hash_buckets; i++) { 558 for (i = 0; i < (1 << ecryptfs_hash_bits); i++) {
558 int rc; 559 int rc;
559 560
560 hlist_for_each_entry(daemon, elem, 561 hlist_for_each_entry(daemon, elem,
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 4a48c0f4b402..84da64b551b2 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -1041,6 +1041,7 @@ static int trunc_start(struct gfs2_inode *ip, u64 size)
1041 1041
1042 if (gfs2_is_stuffed(ip)) { 1042 if (gfs2_is_stuffed(ip)) {
1043 u64 dsize = size + sizeof(struct gfs2_inode); 1043 u64 dsize = size + sizeof(struct gfs2_inode);
1044 ip->i_disksize = size;
1044 ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; 1045 ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME;
1045 gfs2_trans_add_bh(ip->i_gl, dibh, 1); 1046 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
1046 gfs2_dinode_out(ip, dibh->b_data); 1047 gfs2_dinode_out(ip, dibh->b_data);
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index 8295c5b5d4a9..6b48d7c268b2 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -392,7 +392,7 @@ static int gfs2_dirent_find_space(const struct gfs2_dirent *dent,
392 unsigned totlen = be16_to_cpu(dent->de_rec_len); 392 unsigned totlen = be16_to_cpu(dent->de_rec_len);
393 393
394 if (gfs2_dirent_sentinel(dent)) 394 if (gfs2_dirent_sentinel(dent))
395 actual = GFS2_DIRENT_SIZE(0); 395 actual = 0;
396 if (totlen - actual >= required) 396 if (totlen - actual >= required)
397 return 1; 397 return 1;
398 return 0; 398 return 0;
@@ -1231,6 +1231,25 @@ static int do_filldir_main(struct gfs2_inode *dip, u64 *offset,
1231 return 0; 1231 return 0;
1232} 1232}
1233 1233
1234static void *gfs2_alloc_sort_buffer(unsigned size)
1235{
1236 void *ptr = NULL;
1237
1238 if (size < KMALLOC_MAX_SIZE)
1239 ptr = kmalloc(size, GFP_NOFS | __GFP_NOWARN);
1240 if (!ptr)
1241 ptr = __vmalloc(size, GFP_NOFS, PAGE_KERNEL);
1242 return ptr;
1243}
1244
1245static void gfs2_free_sort_buffer(void *ptr)
1246{
1247 if (is_vmalloc_addr(ptr))
1248 vfree(ptr);
1249 else
1250 kfree(ptr);
1251}
1252
1234static int gfs2_dir_read_leaf(struct inode *inode, u64 *offset, void *opaque, 1253static int gfs2_dir_read_leaf(struct inode *inode, u64 *offset, void *opaque,
1235 filldir_t filldir, int *copied, unsigned *depth, 1254 filldir_t filldir, int *copied, unsigned *depth,
1236 u64 leaf_no) 1255 u64 leaf_no)
@@ -1271,7 +1290,7 @@ static int gfs2_dir_read_leaf(struct inode *inode, u64 *offset, void *opaque,
1271 * 99 is the maximum number of entries that can fit in a single 1290 * 99 is the maximum number of entries that can fit in a single
1272 * leaf block. 1291 * leaf block.
1273 */ 1292 */
1274 larr = vmalloc((leaves + entries + 99) * sizeof(void *)); 1293 larr = gfs2_alloc_sort_buffer((leaves + entries + 99) * sizeof(void *));
1275 if (!larr) 1294 if (!larr)
1276 goto out; 1295 goto out;
1277 darr = (const struct gfs2_dirent **)(larr + leaves); 1296 darr = (const struct gfs2_dirent **)(larr + leaves);
@@ -1282,7 +1301,7 @@ static int gfs2_dir_read_leaf(struct inode *inode, u64 *offset, void *opaque,
1282 do { 1301 do {
1283 error = get_leaf(ip, lfn, &bh); 1302 error = get_leaf(ip, lfn, &bh);
1284 if (error) 1303 if (error)
1285 goto out_kfree; 1304 goto out_free;
1286 lf = (struct gfs2_leaf *)bh->b_data; 1305 lf = (struct gfs2_leaf *)bh->b_data;
1287 lfn = be64_to_cpu(lf->lf_next); 1306 lfn = be64_to_cpu(lf->lf_next);
1288 if (lf->lf_entries) { 1307 if (lf->lf_entries) {
@@ -1291,7 +1310,7 @@ static int gfs2_dir_read_leaf(struct inode *inode, u64 *offset, void *opaque,
1291 gfs2_dirent_gather, NULL, &g); 1310 gfs2_dirent_gather, NULL, &g);
1292 error = PTR_ERR(dent); 1311 error = PTR_ERR(dent);
1293 if (IS_ERR(dent)) 1312 if (IS_ERR(dent))
1294 goto out_kfree; 1313 goto out_free;
1295 if (entries2 != g.offset) { 1314 if (entries2 != g.offset) {
1296 fs_warn(sdp, "Number of entries corrupt in dir " 1315 fs_warn(sdp, "Number of entries corrupt in dir "
1297 "leaf %llu, entries2 (%u) != " 1316 "leaf %llu, entries2 (%u) != "
@@ -1300,7 +1319,7 @@ static int gfs2_dir_read_leaf(struct inode *inode, u64 *offset, void *opaque,
1300 entries2, g.offset); 1319 entries2, g.offset);
1301 1320
1302 error = -EIO; 1321 error = -EIO;
1303 goto out_kfree; 1322 goto out_free;
1304 } 1323 }
1305 error = 0; 1324 error = 0;
1306 larr[leaf++] = bh; 1325 larr[leaf++] = bh;
@@ -1312,10 +1331,10 @@ static int gfs2_dir_read_leaf(struct inode *inode, u64 *offset, void *opaque,
1312 BUG_ON(entries2 != entries); 1331 BUG_ON(entries2 != entries);
1313 error = do_filldir_main(ip, offset, opaque, filldir, darr, 1332 error = do_filldir_main(ip, offset, opaque, filldir, darr,
1314 entries, copied); 1333 entries, copied);
1315out_kfree: 1334out_free:
1316 for(i = 0; i < leaf; i++) 1335 for(i = 0; i < leaf; i++)
1317 brelse(larr[i]); 1336 brelse(larr[i]);
1318 vfree(larr); 1337 gfs2_free_sort_buffer(larr);
1319out: 1338out:
1320 return error; 1339 return error;
1321} 1340}
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index ddcdbf493536..0898f3ec8212 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -706,8 +706,18 @@ static void glock_work_func(struct work_struct *work)
706{ 706{
707 unsigned long delay = 0; 707 unsigned long delay = 0;
708 struct gfs2_glock *gl = container_of(work, struct gfs2_glock, gl_work.work); 708 struct gfs2_glock *gl = container_of(work, struct gfs2_glock, gl_work.work);
709 struct gfs2_holder *gh;
709 int drop_ref = 0; 710 int drop_ref = 0;
710 711
712 if (unlikely(test_bit(GLF_FROZEN, &gl->gl_flags))) {
713 spin_lock(&gl->gl_spin);
714 gh = find_first_waiter(gl);
715 if (gh && (gh->gh_flags & LM_FLAG_NOEXP) &&
716 test_and_clear_bit(GLF_FROZEN, &gl->gl_flags))
717 set_bit(GLF_REPLY_PENDING, &gl->gl_flags);
718 spin_unlock(&gl->gl_spin);
719 }
720
711 if (test_and_clear_bit(GLF_REPLY_PENDING, &gl->gl_flags)) { 721 if (test_and_clear_bit(GLF_REPLY_PENDING, &gl->gl_flags)) {
712 finish_xmote(gl, gl->gl_reply); 722 finish_xmote(gl, gl->gl_reply);
713 drop_ref = 1; 723 drop_ref = 1;
@@ -1348,7 +1358,7 @@ void gfs2_glock_complete(struct gfs2_glock *gl, int ret)
1348} 1358}
1349 1359
1350 1360
1351static int gfs2_shrink_glock_memory(int nr, gfp_t gfp_mask) 1361static int gfs2_shrink_glock_memory(struct shrinker *shrink, int nr, gfp_t gfp_mask)
1352{ 1362{
1353 struct gfs2_glock *gl; 1363 struct gfs2_glock *gl;
1354 int may_demote; 1364 int may_demote;
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index b5612cbb62a5..f03afd9c44bc 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -169,7 +169,7 @@ struct inode *gfs2_inode_lookup(struct super_block *sb,
169{ 169{
170 struct inode *inode; 170 struct inode *inode;
171 struct gfs2_inode *ip; 171 struct gfs2_inode *ip;
172 struct gfs2_glock *io_gl; 172 struct gfs2_glock *io_gl = NULL;
173 int error; 173 int error;
174 174
175 inode = gfs2_iget(sb, no_addr); 175 inode = gfs2_iget(sb, no_addr);
@@ -198,6 +198,7 @@ struct inode *gfs2_inode_lookup(struct super_block *sb,
198 ip->i_iopen_gh.gh_gl->gl_object = ip; 198 ip->i_iopen_gh.gh_gl->gl_object = ip;
199 199
200 gfs2_glock_put(io_gl); 200 gfs2_glock_put(io_gl);
201 io_gl = NULL;
201 202
202 if ((type == DT_UNKNOWN) && (no_formal_ino == 0)) 203 if ((type == DT_UNKNOWN) && (no_formal_ino == 0))
203 goto gfs2_nfsbypass; 204 goto gfs2_nfsbypass;
@@ -228,7 +229,8 @@ gfs2_nfsbypass:
228fail_glock: 229fail_glock:
229 gfs2_glock_dq(&ip->i_iopen_gh); 230 gfs2_glock_dq(&ip->i_iopen_gh);
230fail_iopen: 231fail_iopen:
231 gfs2_glock_put(io_gl); 232 if (io_gl)
233 gfs2_glock_put(io_gl);
232fail_put: 234fail_put:
233 if (inode->i_state & I_NEW) 235 if (inode->i_state & I_NEW)
234 ip->i_gl->gl_object = NULL; 236 ip->i_gl->gl_object = NULL;
@@ -256,7 +258,7 @@ void gfs2_process_unlinked_inode(struct super_block *sb, u64 no_addr)
256{ 258{
257 struct gfs2_sbd *sdp; 259 struct gfs2_sbd *sdp;
258 struct gfs2_inode *ip; 260 struct gfs2_inode *ip;
259 struct gfs2_glock *io_gl; 261 struct gfs2_glock *io_gl = NULL;
260 int error; 262 int error;
261 struct gfs2_holder gh; 263 struct gfs2_holder gh;
262 struct inode *inode; 264 struct inode *inode;
@@ -293,6 +295,7 @@ void gfs2_process_unlinked_inode(struct super_block *sb, u64 no_addr)
293 295
294 ip->i_iopen_gh.gh_gl->gl_object = ip; 296 ip->i_iopen_gh.gh_gl->gl_object = ip;
295 gfs2_glock_put(io_gl); 297 gfs2_glock_put(io_gl);
298 io_gl = NULL;
296 299
297 inode->i_mode = DT2IF(DT_UNKNOWN); 300 inode->i_mode = DT2IF(DT_UNKNOWN);
298 301
@@ -319,7 +322,8 @@ void gfs2_process_unlinked_inode(struct super_block *sb, u64 no_addr)
319fail_glock: 322fail_glock:
320 gfs2_glock_dq(&ip->i_iopen_gh); 323 gfs2_glock_dq(&ip->i_iopen_gh);
321fail_iopen: 324fail_iopen:
322 gfs2_glock_put(io_gl); 325 if (io_gl)
326 gfs2_glock_put(io_gl);
323fail_put: 327fail_put:
324 ip->i_gl->gl_object = NULL; 328 ip->i_gl->gl_object = NULL;
325 gfs2_glock_put(ip->i_gl); 329 gfs2_glock_put(ip->i_gl);
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index 49667d68769e..8f02d3db8f42 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -77,7 +77,7 @@ static LIST_HEAD(qd_lru_list);
77static atomic_t qd_lru_count = ATOMIC_INIT(0); 77static atomic_t qd_lru_count = ATOMIC_INIT(0);
78static DEFINE_SPINLOCK(qd_lru_lock); 78static DEFINE_SPINLOCK(qd_lru_lock);
79 79
80int gfs2_shrink_qd_memory(int nr, gfp_t gfp_mask) 80int gfs2_shrink_qd_memory(struct shrinker *shrink, int nr, gfp_t gfp_mask)
81{ 81{
82 struct gfs2_quota_data *qd; 82 struct gfs2_quota_data *qd;
83 struct gfs2_sbd *sdp; 83 struct gfs2_sbd *sdp;
@@ -694,10 +694,8 @@ get_a_page:
694 if (!buffer_mapped(bh)) 694 if (!buffer_mapped(bh))
695 goto unlock_out; 695 goto unlock_out;
696 /* If it's a newly allocated disk block for quota, zero it */ 696 /* If it's a newly allocated disk block for quota, zero it */
697 if (buffer_new(bh)) { 697 if (buffer_new(bh))
698 memset(bh->b_data, 0, bh->b_size); 698 zero_user(page, pos - blocksize, bh->b_size);
699 set_buffer_uptodate(bh);
700 }
701 } 699 }
702 700
703 if (PageUptodate(page)) 701 if (PageUptodate(page))
@@ -723,7 +721,7 @@ get_a_page:
723 721
724 /* If quota straddles page boundary, we need to update the rest of the 722 /* If quota straddles page boundary, we need to update the rest of the
725 * quota at the beginning of the next page */ 723 * quota at the beginning of the next page */
726 if (offset != 0) { /* first page, offset is closer to PAGE_CACHE_SIZE */ 724 if ((offset + sizeof(struct gfs2_quota)) > PAGE_CACHE_SIZE) {
727 ptr = ptr + nbytes; 725 ptr = ptr + nbytes;
728 nbytes = sizeof(struct gfs2_quota) - nbytes; 726 nbytes = sizeof(struct gfs2_quota) - nbytes;
729 offset = 0; 727 offset = 0;
diff --git a/fs/gfs2/quota.h b/fs/gfs2/quota.h
index 195f60c8bd14..e7d236ca48bd 100644
--- a/fs/gfs2/quota.h
+++ b/fs/gfs2/quota.h
@@ -51,7 +51,7 @@ static inline int gfs2_quota_lock_check(struct gfs2_inode *ip)
51 return ret; 51 return ret;
52} 52}
53 53
54extern int gfs2_shrink_qd_memory(int nr, gfp_t gfp_mask); 54extern int gfs2_shrink_qd_memory(struct shrinker *shrink, int nr, gfp_t gfp_mask);
55extern const struct quotactl_ops gfs2_quotactl_ops; 55extern const struct quotactl_ops gfs2_quotactl_ops;
56 56
57#endif /* __QUOTA_DOT_H__ */ 57#endif /* __QUOTA_DOT_H__ */
diff --git a/fs/inode.c b/fs/inode.c
index 2bee20ae3d65..722860b323a9 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -512,7 +512,7 @@ static void prune_icache(int nr_to_scan)
512 * This function is passed the number of inodes to scan, and it returns the 512 * This function is passed the number of inodes to scan, and it returns the
513 * total number of remaining possibly-reclaimable inodes. 513 * total number of remaining possibly-reclaimable inodes.
514 */ 514 */
515static int shrink_icache_memory(int nr, gfp_t gfp_mask) 515static int shrink_icache_memory(struct shrinker *shrink, int nr, gfp_t gfp_mask)
516{ 516{
517 if (nr) { 517 if (nr) {
518 /* 518 /*
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index bc2ff5932769..036880895bfc 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -297,7 +297,6 @@ int jbd2_journal_write_metadata_buffer(transaction_t *transaction,
297 struct page *new_page; 297 struct page *new_page;
298 unsigned int new_offset; 298 unsigned int new_offset;
299 struct buffer_head *bh_in = jh2bh(jh_in); 299 struct buffer_head *bh_in = jh2bh(jh_in);
300 struct jbd2_buffer_trigger_type *triggers;
301 journal_t *journal = transaction->t_journal; 300 journal_t *journal = transaction->t_journal;
302 301
303 /* 302 /*
@@ -328,21 +327,21 @@ repeat:
328 done_copy_out = 1; 327 done_copy_out = 1;
329 new_page = virt_to_page(jh_in->b_frozen_data); 328 new_page = virt_to_page(jh_in->b_frozen_data);
330 new_offset = offset_in_page(jh_in->b_frozen_data); 329 new_offset = offset_in_page(jh_in->b_frozen_data);
331 triggers = jh_in->b_frozen_triggers;
332 } else { 330 } else {
333 new_page = jh2bh(jh_in)->b_page; 331 new_page = jh2bh(jh_in)->b_page;
334 new_offset = offset_in_page(jh2bh(jh_in)->b_data); 332 new_offset = offset_in_page(jh2bh(jh_in)->b_data);
335 triggers = jh_in->b_triggers;
336 } 333 }
337 334
338 mapped_data = kmap_atomic(new_page, KM_USER0); 335 mapped_data = kmap_atomic(new_page, KM_USER0);
339 /* 336 /*
340 * Fire any commit trigger. Do this before checking for escaping, 337 * Fire data frozen trigger if data already wasn't frozen. Do this
341 * as the trigger may modify the magic offset. If a copy-out 338 * before checking for escaping, as the trigger may modify the magic
342 * happens afterwards, it will have the correct data in the buffer. 339 * offset. If a copy-out happens afterwards, it will have the correct
340 * data in the buffer.
343 */ 341 */
344 jbd2_buffer_commit_trigger(jh_in, mapped_data + new_offset, 342 if (!done_copy_out)
345 triggers); 343 jbd2_buffer_frozen_trigger(jh_in, mapped_data + new_offset,
344 jh_in->b_triggers);
346 345
347 /* 346 /*
348 * Check for escaping 347 * Check for escaping
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index e214d68620ac..b8e0806681bb 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -725,6 +725,9 @@ done:
725 page = jh2bh(jh)->b_page; 725 page = jh2bh(jh)->b_page;
726 offset = ((unsigned long) jh2bh(jh)->b_data) & ~PAGE_MASK; 726 offset = ((unsigned long) jh2bh(jh)->b_data) & ~PAGE_MASK;
727 source = kmap_atomic(page, KM_USER0); 727 source = kmap_atomic(page, KM_USER0);
728 /* Fire data frozen trigger just before we copy the data */
729 jbd2_buffer_frozen_trigger(jh, source + offset,
730 jh->b_triggers);
728 memcpy(jh->b_frozen_data, source+offset, jh2bh(jh)->b_size); 731 memcpy(jh->b_frozen_data, source+offset, jh2bh(jh)->b_size);
729 kunmap_atomic(source, KM_USER0); 732 kunmap_atomic(source, KM_USER0);
730 733
@@ -963,15 +966,15 @@ void jbd2_journal_set_triggers(struct buffer_head *bh,
963 jh->b_triggers = type; 966 jh->b_triggers = type;
964} 967}
965 968
966void jbd2_buffer_commit_trigger(struct journal_head *jh, void *mapped_data, 969void jbd2_buffer_frozen_trigger(struct journal_head *jh, void *mapped_data,
967 struct jbd2_buffer_trigger_type *triggers) 970 struct jbd2_buffer_trigger_type *triggers)
968{ 971{
969 struct buffer_head *bh = jh2bh(jh); 972 struct buffer_head *bh = jh2bh(jh);
970 973
971 if (!triggers || !triggers->t_commit) 974 if (!triggers || !triggers->t_frozen)
972 return; 975 return;
973 976
974 triggers->t_commit(triggers, bh, mapped_data, bh->b_size); 977 triggers->t_frozen(triggers, bh, mapped_data, bh->b_size);
975} 978}
976 979
977void jbd2_buffer_abort_trigger(struct journal_head *jh, 980void jbd2_buffer_abort_trigger(struct journal_head *jh,
diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c
index a2d58c96f1b4..d258e261bdc7 100644
--- a/fs/jffs2/xattr.c
+++ b/fs/jffs2/xattr.c
@@ -626,7 +626,7 @@ void jffs2_xattr_free_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *i
626 626
627static int check_xattr_ref_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic) 627static int check_xattr_ref_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic)
628{ 628{
629 /* success of check_xattr_ref_inode() means taht inode (ic) dose not have 629 /* success of check_xattr_ref_inode() means that inode (ic) dose not have
630 * duplicate name/value pairs. If duplicate name/value pair would be found, 630 * duplicate name/value pairs. If duplicate name/value pair would be found,
631 * one will be removed. 631 * one will be removed.
632 */ 632 */
diff --git a/fs/mbcache.c b/fs/mbcache.c
index ec88ff3d04a9..e28f21b95344 100644
--- a/fs/mbcache.c
+++ b/fs/mbcache.c
@@ -115,7 +115,7 @@ mb_cache_indexes(struct mb_cache *cache)
115 * What the mbcache registers as to get shrunk dynamically. 115 * What the mbcache registers as to get shrunk dynamically.
116 */ 116 */
117 117
118static int mb_cache_shrink_fn(int nr_to_scan, gfp_t gfp_mask); 118static int mb_cache_shrink_fn(struct shrinker *shrink, int nr_to_scan, gfp_t gfp_mask);
119 119
120static struct shrinker mb_cache_shrinker = { 120static struct shrinker mb_cache_shrinker = {
121 .shrink = mb_cache_shrink_fn, 121 .shrink = mb_cache_shrink_fn,
@@ -191,13 +191,14 @@ forget:
191 * This function is called by the kernel memory management when memory 191 * This function is called by the kernel memory management when memory
192 * gets low. 192 * gets low.
193 * 193 *
194 * @shrink: (ignored)
194 * @nr_to_scan: Number of objects to scan 195 * @nr_to_scan: Number of objects to scan
195 * @gfp_mask: (ignored) 196 * @gfp_mask: (ignored)
196 * 197 *
197 * Returns the number of objects which are present in the cache. 198 * Returns the number of objects which are present in the cache.
198 */ 199 */
199static int 200static int
200mb_cache_shrink_fn(int nr_to_scan, gfp_t gfp_mask) 201mb_cache_shrink_fn(struct shrinker *shrink, int nr_to_scan, gfp_t gfp_mask)
201{ 202{
202 LIST_HEAD(free_list); 203 LIST_HEAD(free_list);
203 struct list_head *l, *ltmp; 204 struct list_head *l, *ltmp;
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 782b431ef91c..e60416d3f818 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1710,7 +1710,7 @@ static void nfs_access_free_list(struct list_head *head)
1710 } 1710 }
1711} 1711}
1712 1712
1713int nfs_access_cache_shrinker(int nr_to_scan, gfp_t gfp_mask) 1713int nfs_access_cache_shrinker(struct shrinker *shrink, int nr_to_scan, gfp_t gfp_mask)
1714{ 1714{
1715 LIST_HEAD(head); 1715 LIST_HEAD(head);
1716 struct nfs_inode *nfsi; 1716 struct nfs_inode *nfsi;
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index d8bd619e386c..e70f44b9b3f4 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -205,7 +205,8 @@ extern struct rpc_procinfo nfs4_procedures[];
205void nfs_close_context(struct nfs_open_context *ctx, int is_sync); 205void nfs_close_context(struct nfs_open_context *ctx, int is_sync);
206 206
207/* dir.c */ 207/* dir.c */
208extern int nfs_access_cache_shrinker(int nr_to_scan, gfp_t gfp_mask); 208extern int nfs_access_cache_shrinker(struct shrinker *shrink,
209 int nr_to_scan, gfp_t gfp_mask);
209 210
210/* inode.c */ 211/* inode.c */
211extern struct workqueue_struct *nfsiod_workqueue; 212extern struct workqueue_struct *nfsiod_workqueue;
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index 3623ca20cc18..356e976772bf 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -196,15 +196,14 @@ int ocfs2_get_block(struct inode *inode, sector_t iblock,
196 dump_stack(); 196 dump_stack();
197 goto bail; 197 goto bail;
198 } 198 }
199
200 past_eof = ocfs2_blocks_for_bytes(inode->i_sb, i_size_read(inode));
201 mlog(0, "Inode %lu, past_eof = %llu\n", inode->i_ino,
202 (unsigned long long)past_eof);
203
204 if (create && (iblock >= past_eof))
205 set_buffer_new(bh_result);
206 } 199 }
207 200
201 past_eof = ocfs2_blocks_for_bytes(inode->i_sb, i_size_read(inode));
202 mlog(0, "Inode %lu, past_eof = %llu\n", inode->i_ino,
203 (unsigned long long)past_eof);
204 if (create && (iblock >= past_eof))
205 set_buffer_new(bh_result);
206
208bail: 207bail:
209 if (err < 0) 208 if (err < 0)
210 err = -EIO; 209 err = -EIO;
@@ -459,36 +458,6 @@ int walk_page_buffers( handle_t *handle,
459 return ret; 458 return ret;
460} 459}
461 460
462handle_t *ocfs2_start_walk_page_trans(struct inode *inode,
463 struct page *page,
464 unsigned from,
465 unsigned to)
466{
467 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
468 handle_t *handle;
469 int ret = 0;
470
471 handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
472 if (IS_ERR(handle)) {
473 ret = -ENOMEM;
474 mlog_errno(ret);
475 goto out;
476 }
477
478 if (ocfs2_should_order_data(inode)) {
479 ret = ocfs2_jbd2_file_inode(handle, inode);
480 if (ret < 0)
481 mlog_errno(ret);
482 }
483out:
484 if (ret) {
485 if (!IS_ERR(handle))
486 ocfs2_commit_trans(osb, handle);
487 handle = ERR_PTR(ret);
488 }
489 return handle;
490}
491
492static sector_t ocfs2_bmap(struct address_space *mapping, sector_t block) 461static sector_t ocfs2_bmap(struct address_space *mapping, sector_t block)
493{ 462{
494 sector_t status; 463 sector_t status;
@@ -1131,23 +1100,37 @@ out:
1131 */ 1100 */
1132static int ocfs2_grab_pages_for_write(struct address_space *mapping, 1101static int ocfs2_grab_pages_for_write(struct address_space *mapping,
1133 struct ocfs2_write_ctxt *wc, 1102 struct ocfs2_write_ctxt *wc,
1134 u32 cpos, loff_t user_pos, int new, 1103 u32 cpos, loff_t user_pos,
1104 unsigned user_len, int new,
1135 struct page *mmap_page) 1105 struct page *mmap_page)
1136{ 1106{
1137 int ret = 0, i; 1107 int ret = 0, i;
1138 unsigned long start, target_index, index; 1108 unsigned long start, target_index, end_index, index;
1139 struct inode *inode = mapping->host; 1109 struct inode *inode = mapping->host;
1110 loff_t last_byte;
1140 1111
1141 target_index = user_pos >> PAGE_CACHE_SHIFT; 1112 target_index = user_pos >> PAGE_CACHE_SHIFT;
1142 1113
1143 /* 1114 /*
1144 * Figure out how many pages we'll be manipulating here. For 1115 * Figure out how many pages we'll be manipulating here. For
1145 * non allocating write, we just change the one 1116 * non allocating write, we just change the one
1146 * page. Otherwise, we'll need a whole clusters worth. 1117 * page. Otherwise, we'll need a whole clusters worth. If we're
1118 * writing past i_size, we only need enough pages to cover the
1119 * last page of the write.
1147 */ 1120 */
1148 if (new) { 1121 if (new) {
1149 wc->w_num_pages = ocfs2_pages_per_cluster(inode->i_sb); 1122 wc->w_num_pages = ocfs2_pages_per_cluster(inode->i_sb);
1150 start = ocfs2_align_clusters_to_page_index(inode->i_sb, cpos); 1123 start = ocfs2_align_clusters_to_page_index(inode->i_sb, cpos);
1124 /*
1125 * We need the index *past* the last page we could possibly
1126 * touch. This is the page past the end of the write or
1127 * i_size, whichever is greater.
1128 */
1129 last_byte = max(user_pos + user_len, i_size_read(inode));
1130 BUG_ON(last_byte < 1);
1131 end_index = ((last_byte - 1) >> PAGE_CACHE_SHIFT) + 1;
1132 if ((start + wc->w_num_pages) > end_index)
1133 wc->w_num_pages = end_index - start;
1151 } else { 1134 } else {
1152 wc->w_num_pages = 1; 1135 wc->w_num_pages = 1;
1153 start = target_index; 1136 start = target_index;
@@ -1620,21 +1603,20 @@ out:
1620 * write path can treat it as an non-allocating write, which has no 1603 * write path can treat it as an non-allocating write, which has no
1621 * special case code for sparse/nonsparse files. 1604 * special case code for sparse/nonsparse files.
1622 */ 1605 */
1623static int ocfs2_expand_nonsparse_inode(struct inode *inode, loff_t pos, 1606static int ocfs2_expand_nonsparse_inode(struct inode *inode,
1624 unsigned len, 1607 struct buffer_head *di_bh,
1608 loff_t pos, unsigned len,
1625 struct ocfs2_write_ctxt *wc) 1609 struct ocfs2_write_ctxt *wc)
1626{ 1610{
1627 int ret; 1611 int ret;
1628 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
1629 loff_t newsize = pos + len; 1612 loff_t newsize = pos + len;
1630 1613
1631 if (ocfs2_sparse_alloc(osb)) 1614 BUG_ON(ocfs2_sparse_alloc(OCFS2_SB(inode->i_sb)));
1632 return 0;
1633 1615
1634 if (newsize <= i_size_read(inode)) 1616 if (newsize <= i_size_read(inode))
1635 return 0; 1617 return 0;
1636 1618
1637 ret = ocfs2_extend_no_holes(inode, newsize, pos); 1619 ret = ocfs2_extend_no_holes(inode, di_bh, newsize, pos);
1638 if (ret) 1620 if (ret)
1639 mlog_errno(ret); 1621 mlog_errno(ret);
1640 1622
@@ -1644,6 +1626,18 @@ static int ocfs2_expand_nonsparse_inode(struct inode *inode, loff_t pos,
1644 return ret; 1626 return ret;
1645} 1627}
1646 1628
1629static int ocfs2_zero_tail(struct inode *inode, struct buffer_head *di_bh,
1630 loff_t pos)
1631{
1632 int ret = 0;
1633
1634 BUG_ON(!ocfs2_sparse_alloc(OCFS2_SB(inode->i_sb)));
1635 if (pos > i_size_read(inode))
1636 ret = ocfs2_zero_extend(inode, di_bh, pos);
1637
1638 return ret;
1639}
1640
1647int ocfs2_write_begin_nolock(struct address_space *mapping, 1641int ocfs2_write_begin_nolock(struct address_space *mapping,
1648 loff_t pos, unsigned len, unsigned flags, 1642 loff_t pos, unsigned len, unsigned flags,
1649 struct page **pagep, void **fsdata, 1643 struct page **pagep, void **fsdata,
@@ -1679,7 +1673,11 @@ int ocfs2_write_begin_nolock(struct address_space *mapping,
1679 } 1673 }
1680 } 1674 }
1681 1675
1682 ret = ocfs2_expand_nonsparse_inode(inode, pos, len, wc); 1676 if (ocfs2_sparse_alloc(osb))
1677 ret = ocfs2_zero_tail(inode, di_bh, pos);
1678 else
1679 ret = ocfs2_expand_nonsparse_inode(inode, di_bh, pos, len,
1680 wc);
1683 if (ret) { 1681 if (ret) {
1684 mlog_errno(ret); 1682 mlog_errno(ret);
1685 goto out; 1683 goto out;
@@ -1789,7 +1787,7 @@ int ocfs2_write_begin_nolock(struct address_space *mapping,
1789 * that we can zero and flush if we error after adding the 1787 * that we can zero and flush if we error after adding the
1790 * extent. 1788 * extent.
1791 */ 1789 */
1792 ret = ocfs2_grab_pages_for_write(mapping, wc, wc->w_cpos, pos, 1790 ret = ocfs2_grab_pages_for_write(mapping, wc, wc->w_cpos, pos, len,
1793 cluster_of_pages, mmap_page); 1791 cluster_of_pages, mmap_page);
1794 if (ret) { 1792 if (ret) {
1795 mlog_errno(ret); 1793 mlog_errno(ret);
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c
index 6b5a492e1749..153abb5abef0 100644
--- a/fs/ocfs2/dlm/dlmdomain.c
+++ b/fs/ocfs2/dlm/dlmdomain.c
@@ -1671,7 +1671,7 @@ struct dlm_ctxt * dlm_register_domain(const char *domain,
1671 struct dlm_ctxt *dlm = NULL; 1671 struct dlm_ctxt *dlm = NULL;
1672 struct dlm_ctxt *new_ctxt = NULL; 1672 struct dlm_ctxt *new_ctxt = NULL;
1673 1673
1674 if (strlen(domain) > O2NM_MAX_NAME_LEN) { 1674 if (strlen(domain) >= O2NM_MAX_NAME_LEN) {
1675 ret = -ENAMETOOLONG; 1675 ret = -ENAMETOOLONG;
1676 mlog(ML_ERROR, "domain name length too long\n"); 1676 mlog(ML_ERROR, "domain name length too long\n");
1677 goto leave; 1677 goto leave;
@@ -1709,6 +1709,7 @@ retry:
1709 } 1709 }
1710 1710
1711 if (dlm_protocol_compare(&dlm->fs_locking_proto, fs_proto)) { 1711 if (dlm_protocol_compare(&dlm->fs_locking_proto, fs_proto)) {
1712 spin_unlock(&dlm_domain_lock);
1712 mlog(ML_ERROR, 1713 mlog(ML_ERROR,
1713 "Requested locking protocol version is not " 1714 "Requested locking protocol version is not "
1714 "compatible with already registered domain " 1715 "compatible with already registered domain "
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
index 4a7506a4e314..94b97fc6a88e 100644
--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -2808,14 +2808,8 @@ again:
2808 mlog(0, "trying again...\n"); 2808 mlog(0, "trying again...\n");
2809 goto again; 2809 goto again;
2810 } 2810 }
2811 /* now that we are sure the MIGRATING state is there, drop
2812 * the unneded state which blocked threads trying to DIRTY */
2813 spin_lock(&res->spinlock);
2814 BUG_ON(!(res->state & DLM_LOCK_RES_BLOCK_DIRTY));
2815 BUG_ON(!(res->state & DLM_LOCK_RES_MIGRATING));
2816 res->state &= ~DLM_LOCK_RES_BLOCK_DIRTY;
2817 spin_unlock(&res->spinlock);
2818 2811
2812 ret = 0;
2819 /* did the target go down or die? */ 2813 /* did the target go down or die? */
2820 spin_lock(&dlm->spinlock); 2814 spin_lock(&dlm->spinlock);
2821 if (!test_bit(target, dlm->domain_map)) { 2815 if (!test_bit(target, dlm->domain_map)) {
@@ -2826,9 +2820,21 @@ again:
2826 spin_unlock(&dlm->spinlock); 2820 spin_unlock(&dlm->spinlock);
2827 2821
2828 /* 2822 /*
2823 * if target is down, we need to clear DLM_LOCK_RES_BLOCK_DIRTY for
2824 * another try; otherwise, we are sure the MIGRATING state is there,
2825 * drop the unneded state which blocked threads trying to DIRTY
2826 */
2827 spin_lock(&res->spinlock);
2828 BUG_ON(!(res->state & DLM_LOCK_RES_BLOCK_DIRTY));
2829 res->state &= ~DLM_LOCK_RES_BLOCK_DIRTY;
2830 if (!ret)
2831 BUG_ON(!(res->state & DLM_LOCK_RES_MIGRATING));
2832 spin_unlock(&res->spinlock);
2833
2834 /*
2829 * at this point: 2835 * at this point:
2830 * 2836 *
2831 * o the DLM_LOCK_RES_MIGRATING flag is set 2837 * o the DLM_LOCK_RES_MIGRATING flag is set if target not down
2832 * o there are no pending asts on this lockres 2838 * o there are no pending asts on this lockres
2833 * o all processes trying to reserve an ast on this 2839 * o all processes trying to reserve an ast on this
2834 * lockres must wait for the MIGRATING flag to clear 2840 * lockres must wait for the MIGRATING flag to clear
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
index f8b75ce4be70..9dfaac73b36d 100644
--- a/fs/ocfs2/dlm/dlmrecovery.c
+++ b/fs/ocfs2/dlm/dlmrecovery.c
@@ -463,7 +463,7 @@ static int dlm_do_recovery(struct dlm_ctxt *dlm)
463 if (dlm->reco.dead_node == O2NM_INVALID_NODE_NUM) { 463 if (dlm->reco.dead_node == O2NM_INVALID_NODE_NUM) {
464 int bit; 464 int bit;
465 465
466 bit = find_next_bit (dlm->recovery_map, O2NM_MAX_NODES+1, 0); 466 bit = find_next_bit (dlm->recovery_map, O2NM_MAX_NODES, 0);
467 if (bit >= O2NM_MAX_NODES || bit < 0) 467 if (bit >= O2NM_MAX_NODES || bit < 0)
468 dlm_set_reco_dead_node(dlm, O2NM_INVALID_NODE_NUM); 468 dlm_set_reco_dead_node(dlm, O2NM_INVALID_NODE_NUM);
469 else 469 else
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 6a13ea64c447..2b10b36d1577 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -724,28 +724,55 @@ leave:
724 return status; 724 return status;
725} 725}
726 726
727/*
728 * While a write will already be ordering the data, a truncate will not.
729 * Thus, we need to explicitly order the zeroed pages.
730 */
731static handle_t *ocfs2_zero_start_ordered_transaction(struct inode *inode)
732{
733 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
734 handle_t *handle = NULL;
735 int ret = 0;
736
737 if (!ocfs2_should_order_data(inode))
738 goto out;
739
740 handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
741 if (IS_ERR(handle)) {
742 ret = -ENOMEM;
743 mlog_errno(ret);
744 goto out;
745 }
746
747 ret = ocfs2_jbd2_file_inode(handle, inode);
748 if (ret < 0)
749 mlog_errno(ret);
750
751out:
752 if (ret) {
753 if (!IS_ERR(handle))
754 ocfs2_commit_trans(osb, handle);
755 handle = ERR_PTR(ret);
756 }
757 return handle;
758}
759
727/* Some parts of this taken from generic_cont_expand, which turned out 760/* Some parts of this taken from generic_cont_expand, which turned out
728 * to be too fragile to do exactly what we need without us having to 761 * to be too fragile to do exactly what we need without us having to
729 * worry about recursive locking in ->write_begin() and ->write_end(). */ 762 * worry about recursive locking in ->write_begin() and ->write_end(). */
730static int ocfs2_write_zero_page(struct inode *inode, 763static int ocfs2_write_zero_page(struct inode *inode, u64 abs_from,
731 u64 size) 764 u64 abs_to)
732{ 765{
733 struct address_space *mapping = inode->i_mapping; 766 struct address_space *mapping = inode->i_mapping;
734 struct page *page; 767 struct page *page;
735 unsigned long index; 768 unsigned long index = abs_from >> PAGE_CACHE_SHIFT;
736 unsigned int offset;
737 handle_t *handle = NULL; 769 handle_t *handle = NULL;
738 int ret; 770 int ret = 0;
771 unsigned zero_from, zero_to, block_start, block_end;
739 772
740 offset = (size & (PAGE_CACHE_SIZE-1)); /* Within page */ 773 BUG_ON(abs_from >= abs_to);
741 /* ugh. in prepare/commit_write, if from==to==start of block, we 774 BUG_ON(abs_to > (((u64)index + 1) << PAGE_CACHE_SHIFT));
742 ** skip the prepare. make sure we never send an offset for the start 775 BUG_ON(abs_from & (inode->i_blkbits - 1));
743 ** of a block
744 */
745 if ((offset & (inode->i_sb->s_blocksize - 1)) == 0) {
746 offset++;
747 }
748 index = size >> PAGE_CACHE_SHIFT;
749 776
750 page = grab_cache_page(mapping, index); 777 page = grab_cache_page(mapping, index);
751 if (!page) { 778 if (!page) {
@@ -754,31 +781,56 @@ static int ocfs2_write_zero_page(struct inode *inode,
754 goto out; 781 goto out;
755 } 782 }
756 783
757 ret = ocfs2_prepare_write_nolock(inode, page, offset, offset); 784 /* Get the offsets within the page that we want to zero */
758 if (ret < 0) { 785 zero_from = abs_from & (PAGE_CACHE_SIZE - 1);
759 mlog_errno(ret); 786 zero_to = abs_to & (PAGE_CACHE_SIZE - 1);
760 goto out_unlock; 787 if (!zero_to)
761 } 788 zero_to = PAGE_CACHE_SIZE;
762 789
763 if (ocfs2_should_order_data(inode)) { 790 mlog(0,
764 handle = ocfs2_start_walk_page_trans(inode, page, offset, 791 "abs_from = %llu, abs_to = %llu, index = %lu, zero_from = %u, zero_to = %u\n",
765 offset); 792 (unsigned long long)abs_from, (unsigned long long)abs_to,
766 if (IS_ERR(handle)) { 793 index, zero_from, zero_to);
767 ret = PTR_ERR(handle); 794
768 handle = NULL; 795 /* We know that zero_from is block aligned */
796 for (block_start = zero_from; block_start < zero_to;
797 block_start = block_end) {
798 block_end = block_start + (1 << inode->i_blkbits);
799
800 /*
801 * block_start is block-aligned. Bump it by one to
802 * force ocfs2_{prepare,commit}_write() to zero the
803 * whole block.
804 */
805 ret = ocfs2_prepare_write_nolock(inode, page,
806 block_start + 1,
807 block_start + 1);
808 if (ret < 0) {
809 mlog_errno(ret);
769 goto out_unlock; 810 goto out_unlock;
770 } 811 }
771 }
772 812
773 /* must not update i_size! */ 813 if (!handle) {
774 ret = block_commit_write(page, offset, offset); 814 handle = ocfs2_zero_start_ordered_transaction(inode);
775 if (ret < 0) 815 if (IS_ERR(handle)) {
776 mlog_errno(ret); 816 ret = PTR_ERR(handle);
777 else 817 handle = NULL;
778 ret = 0; 818 break;
819 }
820 }
821
822 /* must not update i_size! */
823 ret = block_commit_write(page, block_start + 1,
824 block_start + 1);
825 if (ret < 0)
826 mlog_errno(ret);
827 else
828 ret = 0;
829 }
779 830
780 if (handle) 831 if (handle)
781 ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle); 832 ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle);
833
782out_unlock: 834out_unlock:
783 unlock_page(page); 835 unlock_page(page);
784 page_cache_release(page); 836 page_cache_release(page);
@@ -786,22 +838,114 @@ out:
786 return ret; 838 return ret;
787} 839}
788 840
789static int ocfs2_zero_extend(struct inode *inode, 841/*
790 u64 zero_to_size) 842 * Find the next range to zero. We do this in terms of bytes because
843 * that's what ocfs2_zero_extend() wants, and it is dealing with the
844 * pagecache. We may return multiple extents.
845 *
846 * zero_start and zero_end are ocfs2_zero_extend()s current idea of what
847 * needs to be zeroed. range_start and range_end return the next zeroing
848 * range. A subsequent call should pass the previous range_end as its
849 * zero_start. If range_end is 0, there's nothing to do.
850 *
851 * Unwritten extents are skipped over. Refcounted extents are CoWd.
852 */
853static int ocfs2_zero_extend_get_range(struct inode *inode,
854 struct buffer_head *di_bh,
855 u64 zero_start, u64 zero_end,
856 u64 *range_start, u64 *range_end)
791{ 857{
792 int ret = 0; 858 int rc = 0, needs_cow = 0;
793 u64 start_off; 859 u32 p_cpos, zero_clusters = 0;
794 struct super_block *sb = inode->i_sb; 860 u32 zero_cpos =
861 zero_start >> OCFS2_SB(inode->i_sb)->s_clustersize_bits;
862 u32 last_cpos = ocfs2_clusters_for_bytes(inode->i_sb, zero_end);
863 unsigned int num_clusters = 0;
864 unsigned int ext_flags = 0;
795 865
796 start_off = ocfs2_align_bytes_to_blocks(sb, i_size_read(inode)); 866 while (zero_cpos < last_cpos) {
797 while (start_off < zero_to_size) { 867 rc = ocfs2_get_clusters(inode, zero_cpos, &p_cpos,
798 ret = ocfs2_write_zero_page(inode, start_off); 868 &num_clusters, &ext_flags);
799 if (ret < 0) { 869 if (rc) {
800 mlog_errno(ret); 870 mlog_errno(rc);
871 goto out;
872 }
873
874 if (p_cpos && !(ext_flags & OCFS2_EXT_UNWRITTEN)) {
875 zero_clusters = num_clusters;
876 if (ext_flags & OCFS2_EXT_REFCOUNTED)
877 needs_cow = 1;
878 break;
879 }
880
881 zero_cpos += num_clusters;
882 }
883 if (!zero_clusters) {
884 *range_end = 0;
885 goto out;
886 }
887
888 while ((zero_cpos + zero_clusters) < last_cpos) {
889 rc = ocfs2_get_clusters(inode, zero_cpos + zero_clusters,
890 &p_cpos, &num_clusters,
891 &ext_flags);
892 if (rc) {
893 mlog_errno(rc);
801 goto out; 894 goto out;
802 } 895 }
803 896
804 start_off += sb->s_blocksize; 897 if (!p_cpos || (ext_flags & OCFS2_EXT_UNWRITTEN))
898 break;
899 if (ext_flags & OCFS2_EXT_REFCOUNTED)
900 needs_cow = 1;
901 zero_clusters += num_clusters;
902 }
903 if ((zero_cpos + zero_clusters) > last_cpos)
904 zero_clusters = last_cpos - zero_cpos;
905
906 if (needs_cow) {
907 rc = ocfs2_refcount_cow(inode, di_bh, zero_cpos, zero_clusters,
908 UINT_MAX);
909 if (rc) {
910 mlog_errno(rc);
911 goto out;
912 }
913 }
914
915 *range_start = ocfs2_clusters_to_bytes(inode->i_sb, zero_cpos);
916 *range_end = ocfs2_clusters_to_bytes(inode->i_sb,
917 zero_cpos + zero_clusters);
918
919out:
920 return rc;
921}
922
923/*
924 * Zero one range returned from ocfs2_zero_extend_get_range(). The caller
925 * has made sure that the entire range needs zeroing.
926 */
927static int ocfs2_zero_extend_range(struct inode *inode, u64 range_start,
928 u64 range_end)
929{
930 int rc = 0;
931 u64 next_pos;
932 u64 zero_pos = range_start;
933
934 mlog(0, "range_start = %llu, range_end = %llu\n",
935 (unsigned long long)range_start,
936 (unsigned long long)range_end);
937 BUG_ON(range_start >= range_end);
938
939 while (zero_pos < range_end) {
940 next_pos = (zero_pos & PAGE_CACHE_MASK) + PAGE_CACHE_SIZE;
941 if (next_pos > range_end)
942 next_pos = range_end;
943 rc = ocfs2_write_zero_page(inode, zero_pos, next_pos);
944 if (rc < 0) {
945 mlog_errno(rc);
946 break;
947 }
948 zero_pos = next_pos;
805 949
806 /* 950 /*
807 * Very large extends have the potential to lock up 951 * Very large extends have the potential to lock up
@@ -810,16 +954,63 @@ static int ocfs2_zero_extend(struct inode *inode,
810 cond_resched(); 954 cond_resched();
811 } 955 }
812 956
813out: 957 return rc;
958}
959
960int ocfs2_zero_extend(struct inode *inode, struct buffer_head *di_bh,
961 loff_t zero_to_size)
962{
963 int ret = 0;
964 u64 zero_start, range_start = 0, range_end = 0;
965 struct super_block *sb = inode->i_sb;
966
967 zero_start = ocfs2_align_bytes_to_blocks(sb, i_size_read(inode));
968 mlog(0, "zero_start %llu for i_size %llu\n",
969 (unsigned long long)zero_start,
970 (unsigned long long)i_size_read(inode));
971 while (zero_start < zero_to_size) {
972 ret = ocfs2_zero_extend_get_range(inode, di_bh, zero_start,
973 zero_to_size,
974 &range_start,
975 &range_end);
976 if (ret) {
977 mlog_errno(ret);
978 break;
979 }
980 if (!range_end)
981 break;
982 /* Trim the ends */
983 if (range_start < zero_start)
984 range_start = zero_start;
985 if (range_end > zero_to_size)
986 range_end = zero_to_size;
987
988 ret = ocfs2_zero_extend_range(inode, range_start,
989 range_end);
990 if (ret) {
991 mlog_errno(ret);
992 break;
993 }
994 zero_start = range_end;
995 }
996
814 return ret; 997 return ret;
815} 998}
816 999
817int ocfs2_extend_no_holes(struct inode *inode, u64 new_i_size, u64 zero_to) 1000int ocfs2_extend_no_holes(struct inode *inode, struct buffer_head *di_bh,
1001 u64 new_i_size, u64 zero_to)
818{ 1002{
819 int ret; 1003 int ret;
820 u32 clusters_to_add; 1004 u32 clusters_to_add;
821 struct ocfs2_inode_info *oi = OCFS2_I(inode); 1005 struct ocfs2_inode_info *oi = OCFS2_I(inode);
822 1006
1007 /*
1008 * Only quota files call this without a bh, and they can't be
1009 * refcounted.
1010 */
1011 BUG_ON(!di_bh && (oi->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL));
1012 BUG_ON(!di_bh && !(oi->ip_flags & OCFS2_INODE_SYSTEM_FILE));
1013
823 clusters_to_add = ocfs2_clusters_for_bytes(inode->i_sb, new_i_size); 1014 clusters_to_add = ocfs2_clusters_for_bytes(inode->i_sb, new_i_size);
824 if (clusters_to_add < oi->ip_clusters) 1015 if (clusters_to_add < oi->ip_clusters)
825 clusters_to_add = 0; 1016 clusters_to_add = 0;
@@ -840,7 +1031,7 @@ int ocfs2_extend_no_holes(struct inode *inode, u64 new_i_size, u64 zero_to)
840 * still need to zero the area between the old i_size and the 1031 * still need to zero the area between the old i_size and the
841 * new i_size. 1032 * new i_size.
842 */ 1033 */
843 ret = ocfs2_zero_extend(inode, zero_to); 1034 ret = ocfs2_zero_extend(inode, di_bh, zero_to);
844 if (ret < 0) 1035 if (ret < 0)
845 mlog_errno(ret); 1036 mlog_errno(ret);
846 1037
@@ -862,27 +1053,15 @@ static int ocfs2_extend_file(struct inode *inode,
862 goto out; 1053 goto out;
863 1054
864 if (i_size_read(inode) == new_i_size) 1055 if (i_size_read(inode) == new_i_size)
865 goto out; 1056 goto out;
866 BUG_ON(new_i_size < i_size_read(inode)); 1057 BUG_ON(new_i_size < i_size_read(inode));
867 1058
868 /* 1059 /*
869 * Fall through for converting inline data, even if the fs
870 * supports sparse files.
871 *
872 * The check for inline data here is legal - nobody can add
873 * the feature since we have i_mutex. We must check it again
874 * after acquiring ip_alloc_sem though, as paths like mmap
875 * might have raced us to converting the inode to extents.
876 */
877 if (!(oi->ip_dyn_features & OCFS2_INLINE_DATA_FL)
878 && ocfs2_sparse_alloc(OCFS2_SB(inode->i_sb)))
879 goto out_update_size;
880
881 /*
882 * The alloc sem blocks people in read/write from reading our 1060 * The alloc sem blocks people in read/write from reading our
883 * allocation until we're done changing it. We depend on 1061 * allocation until we're done changing it. We depend on
884 * i_mutex to block other extend/truncate calls while we're 1062 * i_mutex to block other extend/truncate calls while we're
885 * here. 1063 * here. We even have to hold it for sparse files because there
1064 * might be some tail zeroing.
886 */ 1065 */
887 down_write(&oi->ip_alloc_sem); 1066 down_write(&oi->ip_alloc_sem);
888 1067
@@ -899,14 +1078,16 @@ static int ocfs2_extend_file(struct inode *inode,
899 ret = ocfs2_convert_inline_data_to_extents(inode, di_bh); 1078 ret = ocfs2_convert_inline_data_to_extents(inode, di_bh);
900 if (ret) { 1079 if (ret) {
901 up_write(&oi->ip_alloc_sem); 1080 up_write(&oi->ip_alloc_sem);
902
903 mlog_errno(ret); 1081 mlog_errno(ret);
904 goto out; 1082 goto out;
905 } 1083 }
906 } 1084 }
907 1085
908 if (!ocfs2_sparse_alloc(OCFS2_SB(inode->i_sb))) 1086 if (ocfs2_sparse_alloc(OCFS2_SB(inode->i_sb)))
909 ret = ocfs2_extend_no_holes(inode, new_i_size, new_i_size); 1087 ret = ocfs2_zero_extend(inode, di_bh, new_i_size);
1088 else
1089 ret = ocfs2_extend_no_holes(inode, di_bh, new_i_size,
1090 new_i_size);
910 1091
911 up_write(&oi->ip_alloc_sem); 1092 up_write(&oi->ip_alloc_sem);
912 1093
diff --git a/fs/ocfs2/file.h b/fs/ocfs2/file.h
index d66cf4f7c70e..97bf761c9e7c 100644
--- a/fs/ocfs2/file.h
+++ b/fs/ocfs2/file.h
@@ -54,8 +54,10 @@ int ocfs2_add_inode_data(struct ocfs2_super *osb,
54int ocfs2_simple_size_update(struct inode *inode, 54int ocfs2_simple_size_update(struct inode *inode,
55 struct buffer_head *di_bh, 55 struct buffer_head *di_bh,
56 u64 new_i_size); 56 u64 new_i_size);
57int ocfs2_extend_no_holes(struct inode *inode, u64 new_i_size, 57int ocfs2_extend_no_holes(struct inode *inode, struct buffer_head *di_bh,
58 u64 zero_to); 58 u64 new_i_size, u64 zero_to);
59int ocfs2_zero_extend(struct inode *inode, struct buffer_head *di_bh,
60 loff_t zero_to);
59int ocfs2_setattr(struct dentry *dentry, struct iattr *attr); 61int ocfs2_setattr(struct dentry *dentry, struct iattr *attr);
60int ocfs2_getattr(struct vfsmount *mnt, struct dentry *dentry, 62int ocfs2_getattr(struct vfsmount *mnt, struct dentry *dentry,
61 struct kstat *stat); 63 struct kstat *stat);
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index 47878cf16418..625de9d7088c 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -472,7 +472,7 @@ static inline struct ocfs2_triggers *to_ocfs2_trigger(struct jbd2_buffer_trigger
472 return container_of(triggers, struct ocfs2_triggers, ot_triggers); 472 return container_of(triggers, struct ocfs2_triggers, ot_triggers);
473} 473}
474 474
475static void ocfs2_commit_trigger(struct jbd2_buffer_trigger_type *triggers, 475static void ocfs2_frozen_trigger(struct jbd2_buffer_trigger_type *triggers,
476 struct buffer_head *bh, 476 struct buffer_head *bh,
477 void *data, size_t size) 477 void *data, size_t size)
478{ 478{
@@ -491,7 +491,7 @@ static void ocfs2_commit_trigger(struct jbd2_buffer_trigger_type *triggers,
491 * Quota blocks have their own trigger because the struct ocfs2_block_check 491 * Quota blocks have their own trigger because the struct ocfs2_block_check
492 * offset depends on the blocksize. 492 * offset depends on the blocksize.
493 */ 493 */
494static void ocfs2_dq_commit_trigger(struct jbd2_buffer_trigger_type *triggers, 494static void ocfs2_dq_frozen_trigger(struct jbd2_buffer_trigger_type *triggers,
495 struct buffer_head *bh, 495 struct buffer_head *bh,
496 void *data, size_t size) 496 void *data, size_t size)
497{ 497{
@@ -511,7 +511,7 @@ static void ocfs2_dq_commit_trigger(struct jbd2_buffer_trigger_type *triggers,
511 * Directory blocks also have their own trigger because the 511 * Directory blocks also have their own trigger because the
512 * struct ocfs2_block_check offset depends on the blocksize. 512 * struct ocfs2_block_check offset depends on the blocksize.
513 */ 513 */
514static void ocfs2_db_commit_trigger(struct jbd2_buffer_trigger_type *triggers, 514static void ocfs2_db_frozen_trigger(struct jbd2_buffer_trigger_type *triggers,
515 struct buffer_head *bh, 515 struct buffer_head *bh,
516 void *data, size_t size) 516 void *data, size_t size)
517{ 517{
@@ -544,7 +544,7 @@ static void ocfs2_abort_trigger(struct jbd2_buffer_trigger_type *triggers,
544 544
545static struct ocfs2_triggers di_triggers = { 545static struct ocfs2_triggers di_triggers = {
546 .ot_triggers = { 546 .ot_triggers = {
547 .t_commit = ocfs2_commit_trigger, 547 .t_frozen = ocfs2_frozen_trigger,
548 .t_abort = ocfs2_abort_trigger, 548 .t_abort = ocfs2_abort_trigger,
549 }, 549 },
550 .ot_offset = offsetof(struct ocfs2_dinode, i_check), 550 .ot_offset = offsetof(struct ocfs2_dinode, i_check),
@@ -552,7 +552,7 @@ static struct ocfs2_triggers di_triggers = {
552 552
553static struct ocfs2_triggers eb_triggers = { 553static struct ocfs2_triggers eb_triggers = {
554 .ot_triggers = { 554 .ot_triggers = {
555 .t_commit = ocfs2_commit_trigger, 555 .t_frozen = ocfs2_frozen_trigger,
556 .t_abort = ocfs2_abort_trigger, 556 .t_abort = ocfs2_abort_trigger,
557 }, 557 },
558 .ot_offset = offsetof(struct ocfs2_extent_block, h_check), 558 .ot_offset = offsetof(struct ocfs2_extent_block, h_check),
@@ -560,7 +560,7 @@ static struct ocfs2_triggers eb_triggers = {
560 560
561static struct ocfs2_triggers rb_triggers = { 561static struct ocfs2_triggers rb_triggers = {
562 .ot_triggers = { 562 .ot_triggers = {
563 .t_commit = ocfs2_commit_trigger, 563 .t_frozen = ocfs2_frozen_trigger,
564 .t_abort = ocfs2_abort_trigger, 564 .t_abort = ocfs2_abort_trigger,
565 }, 565 },
566 .ot_offset = offsetof(struct ocfs2_refcount_block, rf_check), 566 .ot_offset = offsetof(struct ocfs2_refcount_block, rf_check),
@@ -568,7 +568,7 @@ static struct ocfs2_triggers rb_triggers = {
568 568
569static struct ocfs2_triggers gd_triggers = { 569static struct ocfs2_triggers gd_triggers = {
570 .ot_triggers = { 570 .ot_triggers = {
571 .t_commit = ocfs2_commit_trigger, 571 .t_frozen = ocfs2_frozen_trigger,
572 .t_abort = ocfs2_abort_trigger, 572 .t_abort = ocfs2_abort_trigger,
573 }, 573 },
574 .ot_offset = offsetof(struct ocfs2_group_desc, bg_check), 574 .ot_offset = offsetof(struct ocfs2_group_desc, bg_check),
@@ -576,14 +576,14 @@ static struct ocfs2_triggers gd_triggers = {
576 576
577static struct ocfs2_triggers db_triggers = { 577static struct ocfs2_triggers db_triggers = {
578 .ot_triggers = { 578 .ot_triggers = {
579 .t_commit = ocfs2_db_commit_trigger, 579 .t_frozen = ocfs2_db_frozen_trigger,
580 .t_abort = ocfs2_abort_trigger, 580 .t_abort = ocfs2_abort_trigger,
581 }, 581 },
582}; 582};
583 583
584static struct ocfs2_triggers xb_triggers = { 584static struct ocfs2_triggers xb_triggers = {
585 .ot_triggers = { 585 .ot_triggers = {
586 .t_commit = ocfs2_commit_trigger, 586 .t_frozen = ocfs2_frozen_trigger,
587 .t_abort = ocfs2_abort_trigger, 587 .t_abort = ocfs2_abort_trigger,
588 }, 588 },
589 .ot_offset = offsetof(struct ocfs2_xattr_block, xb_check), 589 .ot_offset = offsetof(struct ocfs2_xattr_block, xb_check),
@@ -591,14 +591,14 @@ static struct ocfs2_triggers xb_triggers = {
591 591
592static struct ocfs2_triggers dq_triggers = { 592static struct ocfs2_triggers dq_triggers = {
593 .ot_triggers = { 593 .ot_triggers = {
594 .t_commit = ocfs2_dq_commit_trigger, 594 .t_frozen = ocfs2_dq_frozen_trigger,
595 .t_abort = ocfs2_abort_trigger, 595 .t_abort = ocfs2_abort_trigger,
596 }, 596 },
597}; 597};
598 598
599static struct ocfs2_triggers dr_triggers = { 599static struct ocfs2_triggers dr_triggers = {
600 .ot_triggers = { 600 .ot_triggers = {
601 .t_commit = ocfs2_commit_trigger, 601 .t_frozen = ocfs2_frozen_trigger,
602 .t_abort = ocfs2_abort_trigger, 602 .t_abort = ocfs2_abort_trigger,
603 }, 603 },
604 .ot_offset = offsetof(struct ocfs2_dx_root_block, dr_check), 604 .ot_offset = offsetof(struct ocfs2_dx_root_block, dr_check),
@@ -606,7 +606,7 @@ static struct ocfs2_triggers dr_triggers = {
606 606
607static struct ocfs2_triggers dl_triggers = { 607static struct ocfs2_triggers dl_triggers = {
608 .ot_triggers = { 608 .ot_triggers = {
609 .t_commit = ocfs2_commit_trigger, 609 .t_frozen = ocfs2_frozen_trigger,
610 .t_abort = ocfs2_abort_trigger, 610 .t_abort = ocfs2_abort_trigger,
611 }, 611 },
612 .ot_offset = offsetof(struct ocfs2_dx_leaf, dl_check), 612 .ot_offset = offsetof(struct ocfs2_dx_leaf, dl_check),
@@ -1936,7 +1936,7 @@ void ocfs2_orphan_scan_work(struct work_struct *work)
1936 mutex_lock(&os->os_lock); 1936 mutex_lock(&os->os_lock);
1937 ocfs2_queue_orphan_scan(osb); 1937 ocfs2_queue_orphan_scan(osb);
1938 if (atomic_read(&os->os_state) == ORPHAN_SCAN_ACTIVE) 1938 if (atomic_read(&os->os_state) == ORPHAN_SCAN_ACTIVE)
1939 schedule_delayed_work(&os->os_orphan_scan_work, 1939 queue_delayed_work(ocfs2_wq, &os->os_orphan_scan_work,
1940 ocfs2_orphan_scan_timeout()); 1940 ocfs2_orphan_scan_timeout());
1941 mutex_unlock(&os->os_lock); 1941 mutex_unlock(&os->os_lock);
1942} 1942}
@@ -1976,8 +1976,8 @@ void ocfs2_orphan_scan_start(struct ocfs2_super *osb)
1976 atomic_set(&os->os_state, ORPHAN_SCAN_INACTIVE); 1976 atomic_set(&os->os_state, ORPHAN_SCAN_INACTIVE);
1977 else { 1977 else {
1978 atomic_set(&os->os_state, ORPHAN_SCAN_ACTIVE); 1978 atomic_set(&os->os_state, ORPHAN_SCAN_ACTIVE);
1979 schedule_delayed_work(&os->os_orphan_scan_work, 1979 queue_delayed_work(ocfs2_wq, &os->os_orphan_scan_work,
1980 ocfs2_orphan_scan_timeout()); 1980 ocfs2_orphan_scan_timeout());
1981 } 1981 }
1982} 1982}
1983 1983
diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
index 3d7419682dc0..ec6adbf8f551 100644
--- a/fs/ocfs2/localalloc.c
+++ b/fs/ocfs2/localalloc.c
@@ -118,6 +118,7 @@ unsigned int ocfs2_la_default_mb(struct ocfs2_super *osb)
118{ 118{
119 unsigned int la_mb; 119 unsigned int la_mb;
120 unsigned int gd_mb; 120 unsigned int gd_mb;
121 unsigned int la_max_mb;
121 unsigned int megs_per_slot; 122 unsigned int megs_per_slot;
122 struct super_block *sb = osb->sb; 123 struct super_block *sb = osb->sb;
123 124
@@ -182,6 +183,12 @@ unsigned int ocfs2_la_default_mb(struct ocfs2_super *osb)
182 if (megs_per_slot < la_mb) 183 if (megs_per_slot < la_mb)
183 la_mb = megs_per_slot; 184 la_mb = megs_per_slot;
184 185
186 /* We can't store more bits than we can in a block. */
187 la_max_mb = ocfs2_clusters_to_megabytes(osb->sb,
188 ocfs2_local_alloc_size(sb) * 8);
189 if (la_mb > la_max_mb)
190 la_mb = la_max_mb;
191
185 return la_mb; 192 return la_mb;
186} 193}
187 194
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
index 2bb35fe00511..4607923eb24c 100644
--- a/fs/ocfs2/quota_global.c
+++ b/fs/ocfs2/quota_global.c
@@ -775,7 +775,7 @@ static int ocfs2_acquire_dquot(struct dquot *dquot)
775 * locking allocators ranks above a transaction start 775 * locking allocators ranks above a transaction start
776 */ 776 */
777 WARN_ON(journal_current_handle()); 777 WARN_ON(journal_current_handle());
778 status = ocfs2_extend_no_holes(gqinode, 778 status = ocfs2_extend_no_holes(gqinode, NULL,
779 gqinode->i_size + (need_alloc << sb->s_blocksize_bits), 779 gqinode->i_size + (need_alloc << sb->s_blocksize_bits),
780 gqinode->i_size); 780 gqinode->i_size);
781 if (status < 0) 781 if (status < 0)
diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c
index 8bd70d4d184d..dc78764ccc4c 100644
--- a/fs/ocfs2/quota_local.c
+++ b/fs/ocfs2/quota_local.c
@@ -971,7 +971,7 @@ static struct ocfs2_quota_chunk *ocfs2_local_quota_add_chunk(
971 u64 p_blkno; 971 u64 p_blkno;
972 972
973 /* We are protected by dqio_sem so no locking needed */ 973 /* We are protected by dqio_sem so no locking needed */
974 status = ocfs2_extend_no_holes(lqinode, 974 status = ocfs2_extend_no_holes(lqinode, NULL,
975 lqinode->i_size + 2 * sb->s_blocksize, 975 lqinode->i_size + 2 * sb->s_blocksize,
976 lqinode->i_size); 976 lqinode->i_size);
977 if (status < 0) { 977 if (status < 0) {
@@ -1114,7 +1114,7 @@ static struct ocfs2_quota_chunk *ocfs2_extend_local_quota_file(
1114 return ocfs2_local_quota_add_chunk(sb, type, offset); 1114 return ocfs2_local_quota_add_chunk(sb, type, offset);
1115 1115
1116 /* We are protected by dqio_sem so no locking needed */ 1116 /* We are protected by dqio_sem so no locking needed */
1117 status = ocfs2_extend_no_holes(lqinode, 1117 status = ocfs2_extend_no_holes(lqinode, NULL,
1118 lqinode->i_size + sb->s_blocksize, 1118 lqinode->i_size + sb->s_blocksize,
1119 lqinode->i_size); 1119 lqinode->i_size);
1120 if (status < 0) { 1120 if (status < 0) {
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
index 4793f36f6518..3ac5aa733e9c 100644
--- a/fs/ocfs2/refcounttree.c
+++ b/fs/ocfs2/refcounttree.c
@@ -2931,6 +2931,12 @@ static int ocfs2_duplicate_clusters_by_page(handle_t *handle,
2931 2931
2932 offset = ((loff_t)cpos) << OCFS2_SB(sb)->s_clustersize_bits; 2932 offset = ((loff_t)cpos) << OCFS2_SB(sb)->s_clustersize_bits;
2933 end = offset + (new_len << OCFS2_SB(sb)->s_clustersize_bits); 2933 end = offset + (new_len << OCFS2_SB(sb)->s_clustersize_bits);
2934 /*
2935 * We only duplicate pages until we reach the page contains i_size - 1.
2936 * So trim 'end' to i_size.
2937 */
2938 if (end > i_size_read(context->inode))
2939 end = i_size_read(context->inode);
2934 2940
2935 while (offset < end) { 2941 while (offset < end) {
2936 page_index = offset >> PAGE_CACHE_SHIFT; 2942 page_index = offset >> PAGE_CACHE_SHIFT;
@@ -4166,6 +4172,12 @@ static int __ocfs2_reflink(struct dentry *old_dentry,
4166 struct inode *inode = old_dentry->d_inode; 4172 struct inode *inode = old_dentry->d_inode;
4167 struct buffer_head *new_bh = NULL; 4173 struct buffer_head *new_bh = NULL;
4168 4174
4175 if (OCFS2_I(inode)->ip_flags & OCFS2_INODE_SYSTEM_FILE) {
4176 ret = -EINVAL;
4177 mlog_errno(ret);
4178 goto out;
4179 }
4180
4169 ret = filemap_fdatawrite(inode->i_mapping); 4181 ret = filemap_fdatawrite(inode->i_mapping);
4170 if (ret) { 4182 if (ret) {
4171 mlog_errno(ret); 4183 mlog_errno(ret);
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
index f4c2a9eb8c4d..a8e6a95a353f 100644
--- a/fs/ocfs2/suballoc.c
+++ b/fs/ocfs2/suballoc.c
@@ -741,7 +741,7 @@ static int ocfs2_block_group_alloc(struct ocfs2_super *osb,
741 le16_to_cpu(bg->bg_free_bits_count)); 741 le16_to_cpu(bg->bg_free_bits_count));
742 le32_add_cpu(&cl->cl_recs[alloc_rec].c_total, 742 le32_add_cpu(&cl->cl_recs[alloc_rec].c_total,
743 le16_to_cpu(bg->bg_bits)); 743 le16_to_cpu(bg->bg_bits));
744 cl->cl_recs[alloc_rec].c_blkno = cpu_to_le64(bg->bg_blkno); 744 cl->cl_recs[alloc_rec].c_blkno = bg->bg_blkno;
745 if (le16_to_cpu(cl->cl_next_free_rec) < le16_to_cpu(cl->cl_count)) 745 if (le16_to_cpu(cl->cl_next_free_rec) < le16_to_cpu(cl->cl_count))
746 le16_add_cpu(&cl->cl_next_free_rec, 1); 746 le16_add_cpu(&cl->cl_next_free_rec, 1);
747 747
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index e97b34842cfe..d03469f61801 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -709,7 +709,7 @@ static int ocfs2_xattr_extend_allocation(struct inode *inode,
709 struct ocfs2_xattr_value_buf *vb, 709 struct ocfs2_xattr_value_buf *vb,
710 struct ocfs2_xattr_set_ctxt *ctxt) 710 struct ocfs2_xattr_set_ctxt *ctxt)
711{ 711{
712 int status = 0; 712 int status = 0, credits;
713 handle_t *handle = ctxt->handle; 713 handle_t *handle = ctxt->handle;
714 enum ocfs2_alloc_restarted why; 714 enum ocfs2_alloc_restarted why;
715 u32 prev_clusters, logical_start = le32_to_cpu(vb->vb_xv->xr_clusters); 715 u32 prev_clusters, logical_start = le32_to_cpu(vb->vb_xv->xr_clusters);
@@ -719,38 +719,54 @@ static int ocfs2_xattr_extend_allocation(struct inode *inode,
719 719
720 ocfs2_init_xattr_value_extent_tree(&et, INODE_CACHE(inode), vb); 720 ocfs2_init_xattr_value_extent_tree(&et, INODE_CACHE(inode), vb);
721 721
722 status = vb->vb_access(handle, INODE_CACHE(inode), vb->vb_bh, 722 while (clusters_to_add) {
723 OCFS2_JOURNAL_ACCESS_WRITE); 723 status = vb->vb_access(handle, INODE_CACHE(inode), vb->vb_bh,
724 if (status < 0) { 724 OCFS2_JOURNAL_ACCESS_WRITE);
725 mlog_errno(status); 725 if (status < 0) {
726 goto leave; 726 mlog_errno(status);
727 } 727 break;
728 }
728 729
729 prev_clusters = le32_to_cpu(vb->vb_xv->xr_clusters); 730 prev_clusters = le32_to_cpu(vb->vb_xv->xr_clusters);
730 status = ocfs2_add_clusters_in_btree(handle, 731 status = ocfs2_add_clusters_in_btree(handle,
731 &et, 732 &et,
732 &logical_start, 733 &logical_start,
733 clusters_to_add, 734 clusters_to_add,
734 0, 735 0,
735 ctxt->data_ac, 736 ctxt->data_ac,
736 ctxt->meta_ac, 737 ctxt->meta_ac,
737 &why); 738 &why);
738 if (status < 0) { 739 if ((status < 0) && (status != -EAGAIN)) {
739 mlog_errno(status); 740 if (status != -ENOSPC)
740 goto leave; 741 mlog_errno(status);
741 } 742 break;
743 }
742 744
743 ocfs2_journal_dirty(handle, vb->vb_bh); 745 ocfs2_journal_dirty(handle, vb->vb_bh);
744 746
745 clusters_to_add -= le32_to_cpu(vb->vb_xv->xr_clusters) - prev_clusters; 747 clusters_to_add -= le32_to_cpu(vb->vb_xv->xr_clusters) -
748 prev_clusters;
746 749
747 /* 750 if (why != RESTART_NONE && clusters_to_add) {
748 * We should have already allocated enough space before the transaction, 751 /*
749 * so no need to restart. 752 * We can only fail in case the alloc file doesn't give
750 */ 753 * up enough clusters.
751 BUG_ON(why != RESTART_NONE || clusters_to_add); 754 */
752 755 BUG_ON(why == RESTART_META);
753leave: 756
757 mlog(0, "restarting xattr value extension for %u"
758 " clusters,.\n", clusters_to_add);
759 credits = ocfs2_calc_extend_credits(inode->i_sb,
760 &vb->vb_xv->xr_list,
761 clusters_to_add);
762 status = ocfs2_extend_trans(handle, credits);
763 if (status < 0) {
764 status = -ENOMEM;
765 mlog_errno(status);
766 break;
767 }
768 }
769 }
754 770
755 return status; 771 return status;
756} 772}
@@ -6788,16 +6804,15 @@ out:
6788 return ret; 6804 return ret;
6789} 6805}
6790 6806
6791static int ocfs2_reflink_xattr_buckets(handle_t *handle, 6807static int ocfs2_reflink_xattr_bucket(handle_t *handle,
6792 u64 blkno, u64 new_blkno, u32 clusters, 6808 u64 blkno, u64 new_blkno, u32 clusters,
6809 u32 *cpos, int num_buckets,
6793 struct ocfs2_alloc_context *meta_ac, 6810 struct ocfs2_alloc_context *meta_ac,
6794 struct ocfs2_alloc_context *data_ac, 6811 struct ocfs2_alloc_context *data_ac,
6795 struct ocfs2_reflink_xattr_tree_args *args) 6812 struct ocfs2_reflink_xattr_tree_args *args)
6796{ 6813{
6797 int i, j, ret = 0; 6814 int i, j, ret = 0;
6798 struct super_block *sb = args->reflink->old_inode->i_sb; 6815 struct super_block *sb = args->reflink->old_inode->i_sb;
6799 u32 bpc = ocfs2_xattr_buckets_per_cluster(OCFS2_SB(sb));
6800 u32 num_buckets = clusters * bpc;
6801 int bpb = args->old_bucket->bu_blocks; 6816 int bpb = args->old_bucket->bu_blocks;
6802 struct ocfs2_xattr_value_buf vb = { 6817 struct ocfs2_xattr_value_buf vb = {
6803 .vb_access = ocfs2_journal_access, 6818 .vb_access = ocfs2_journal_access,
@@ -6816,14 +6831,6 @@ static int ocfs2_reflink_xattr_buckets(handle_t *handle,
6816 break; 6831 break;
6817 } 6832 }
6818 6833
6819 /*
6820 * The real bucket num in this series of blocks is stored
6821 * in the 1st bucket.
6822 */
6823 if (i == 0)
6824 num_buckets = le16_to_cpu(
6825 bucket_xh(args->old_bucket)->xh_num_buckets);
6826
6827 ret = ocfs2_xattr_bucket_journal_access(handle, 6834 ret = ocfs2_xattr_bucket_journal_access(handle,
6828 args->new_bucket, 6835 args->new_bucket,
6829 OCFS2_JOURNAL_ACCESS_CREATE); 6836 OCFS2_JOURNAL_ACCESS_CREATE);
@@ -6837,6 +6844,18 @@ static int ocfs2_reflink_xattr_buckets(handle_t *handle,
6837 bucket_block(args->old_bucket, j), 6844 bucket_block(args->old_bucket, j),
6838 sb->s_blocksize); 6845 sb->s_blocksize);
6839 6846
6847 /*
6848 * Record the start cpos so that we can use it to initialize
6849 * our xattr tree we also set the xh_num_bucket for the new
6850 * bucket.
6851 */
6852 if (i == 0) {
6853 *cpos = le32_to_cpu(bucket_xh(args->new_bucket)->
6854 xh_entries[0].xe_name_hash);
6855 bucket_xh(args->new_bucket)->xh_num_buckets =
6856 cpu_to_le16(num_buckets);
6857 }
6858
6840 ocfs2_xattr_bucket_journal_dirty(handle, args->new_bucket); 6859 ocfs2_xattr_bucket_journal_dirty(handle, args->new_bucket);
6841 6860
6842 ret = ocfs2_reflink_xattr_header(handle, args->reflink, 6861 ret = ocfs2_reflink_xattr_header(handle, args->reflink,
@@ -6866,6 +6885,7 @@ static int ocfs2_reflink_xattr_buckets(handle_t *handle,
6866 } 6885 }
6867 6886
6868 ocfs2_xattr_bucket_journal_dirty(handle, args->new_bucket); 6887 ocfs2_xattr_bucket_journal_dirty(handle, args->new_bucket);
6888
6869 ocfs2_xattr_bucket_relse(args->old_bucket); 6889 ocfs2_xattr_bucket_relse(args->old_bucket);
6870 ocfs2_xattr_bucket_relse(args->new_bucket); 6890 ocfs2_xattr_bucket_relse(args->new_bucket);
6871 } 6891 }
@@ -6874,6 +6894,75 @@ static int ocfs2_reflink_xattr_buckets(handle_t *handle,
6874 ocfs2_xattr_bucket_relse(args->new_bucket); 6894 ocfs2_xattr_bucket_relse(args->new_bucket);
6875 return ret; 6895 return ret;
6876} 6896}
6897
6898static int ocfs2_reflink_xattr_buckets(handle_t *handle,
6899 struct inode *inode,
6900 struct ocfs2_reflink_xattr_tree_args *args,
6901 struct ocfs2_extent_tree *et,
6902 struct ocfs2_alloc_context *meta_ac,
6903 struct ocfs2_alloc_context *data_ac,
6904 u64 blkno, u32 cpos, u32 len)
6905{
6906 int ret, first_inserted = 0;
6907 u32 p_cluster, num_clusters, reflink_cpos = 0;
6908 u64 new_blkno;
6909 unsigned int num_buckets, reflink_buckets;
6910 unsigned int bpc =
6911 ocfs2_xattr_buckets_per_cluster(OCFS2_SB(inode->i_sb));
6912
6913 ret = ocfs2_read_xattr_bucket(args->old_bucket, blkno);
6914 if (ret) {
6915 mlog_errno(ret);
6916 goto out;
6917 }
6918 num_buckets = le16_to_cpu(bucket_xh(args->old_bucket)->xh_num_buckets);
6919 ocfs2_xattr_bucket_relse(args->old_bucket);
6920
6921 while (len && num_buckets) {
6922 ret = ocfs2_claim_clusters(handle, data_ac,
6923 1, &p_cluster, &num_clusters);
6924 if (ret) {
6925 mlog_errno(ret);
6926 goto out;
6927 }
6928
6929 new_blkno = ocfs2_clusters_to_blocks(inode->i_sb, p_cluster);
6930 reflink_buckets = min(num_buckets, bpc * num_clusters);
6931
6932 ret = ocfs2_reflink_xattr_bucket(handle, blkno,
6933 new_blkno, num_clusters,
6934 &reflink_cpos, reflink_buckets,
6935 meta_ac, data_ac, args);
6936 if (ret) {
6937 mlog_errno(ret);
6938 goto out;
6939 }
6940
6941 /*
6942 * For the 1st allocated cluster, we make it use the same cpos
6943 * so that the xattr tree looks the same as the original one
6944 * in the most case.
6945 */
6946 if (!first_inserted) {
6947 reflink_cpos = cpos;
6948 first_inserted = 1;
6949 }
6950 ret = ocfs2_insert_extent(handle, et, reflink_cpos, new_blkno,
6951 num_clusters, 0, meta_ac);
6952 if (ret)
6953 mlog_errno(ret);
6954
6955 mlog(0, "insert new xattr extent rec start %llu len %u to %u\n",
6956 (unsigned long long)new_blkno, num_clusters, reflink_cpos);
6957
6958 len -= num_clusters;
6959 blkno += ocfs2_clusters_to_blocks(inode->i_sb, num_clusters);
6960 num_buckets -= reflink_buckets;
6961 }
6962out:
6963 return ret;
6964}
6965
6877/* 6966/*
6878 * Create the same xattr extent record in the new inode's xattr tree. 6967 * Create the same xattr extent record in the new inode's xattr tree.
6879 */ 6968 */
@@ -6885,8 +6974,6 @@ static int ocfs2_reflink_xattr_rec(struct inode *inode,
6885 void *para) 6974 void *para)
6886{ 6975{
6887 int ret, credits = 0; 6976 int ret, credits = 0;
6888 u32 p_cluster, num_clusters;
6889 u64 new_blkno;
6890 handle_t *handle; 6977 handle_t *handle;
6891 struct ocfs2_reflink_xattr_tree_args *args = 6978 struct ocfs2_reflink_xattr_tree_args *args =
6892 (struct ocfs2_reflink_xattr_tree_args *)para; 6979 (struct ocfs2_reflink_xattr_tree_args *)para;
@@ -6895,6 +6982,9 @@ static int ocfs2_reflink_xattr_rec(struct inode *inode,
6895 struct ocfs2_alloc_context *data_ac = NULL; 6982 struct ocfs2_alloc_context *data_ac = NULL;
6896 struct ocfs2_extent_tree et; 6983 struct ocfs2_extent_tree et;
6897 6984
6985 mlog(0, "reflink xattr buckets %llu len %u\n",
6986 (unsigned long long)blkno, len);
6987
6898 ocfs2_init_xattr_tree_extent_tree(&et, 6988 ocfs2_init_xattr_tree_extent_tree(&et,
6899 INODE_CACHE(args->reflink->new_inode), 6989 INODE_CACHE(args->reflink->new_inode),
6900 args->new_blk_bh); 6990 args->new_blk_bh);
@@ -6914,32 +7004,12 @@ static int ocfs2_reflink_xattr_rec(struct inode *inode,
6914 goto out; 7004 goto out;
6915 } 7005 }
6916 7006
6917 ret = ocfs2_claim_clusters(handle, data_ac, 7007 ret = ocfs2_reflink_xattr_buckets(handle, inode, args, &et,
6918 len, &p_cluster, &num_clusters); 7008 meta_ac, data_ac,
6919 if (ret) { 7009 blkno, cpos, len);
6920 mlog_errno(ret);
6921 goto out_commit;
6922 }
6923
6924 new_blkno = ocfs2_clusters_to_blocks(osb->sb, p_cluster);
6925
6926 mlog(0, "reflink xattr buckets %llu to %llu, len %u\n",
6927 (unsigned long long)blkno, (unsigned long long)new_blkno, len);
6928 ret = ocfs2_reflink_xattr_buckets(handle, blkno, new_blkno, len,
6929 meta_ac, data_ac, args);
6930 if (ret) {
6931 mlog_errno(ret);
6932 goto out_commit;
6933 }
6934
6935 mlog(0, "insert new xattr extent rec start %llu len %u to %u\n",
6936 (unsigned long long)new_blkno, len, cpos);
6937 ret = ocfs2_insert_extent(handle, &et, cpos, new_blkno,
6938 len, 0, meta_ac);
6939 if (ret) 7010 if (ret)
6940 mlog_errno(ret); 7011 mlog_errno(ret);
6941 7012
6942out_commit:
6943 ocfs2_commit_trans(osb, handle); 7013 ocfs2_commit_trans(osb, handle);
6944 7014
6945out: 7015out:
diff --git a/fs/partitions/ibm.c b/fs/partitions/ibm.c
index 3e73de5967ff..fc8497643fd0 100644
--- a/fs/partitions/ibm.c
+++ b/fs/partitions/ibm.c
@@ -74,6 +74,7 @@ int ibm_partition(struct parsed_partitions *state)
74 } *label; 74 } *label;
75 unsigned char *data; 75 unsigned char *data;
76 Sector sect; 76 Sector sect;
77 sector_t labelsect;
77 78
78 res = 0; 79 res = 0;
79 blocksize = bdev_logical_block_size(bdev); 80 blocksize = bdev_logical_block_size(bdev);
@@ -98,10 +99,19 @@ int ibm_partition(struct parsed_partitions *state)
98 goto out_freeall; 99 goto out_freeall;
99 100
100 /* 101 /*
102 * Special case for FBA disks: label sector does not depend on
103 * blocksize.
104 */
105 if ((info->cu_type == 0x6310 && info->dev_type == 0x9336) ||
106 (info->cu_type == 0x3880 && info->dev_type == 0x3370))
107 labelsect = info->label_block;
108 else
109 labelsect = info->label_block * (blocksize >> 9);
110
111 /*
101 * Get volume label, extract name and type. 112 * Get volume label, extract name and type.
102 */ 113 */
103 data = read_part_sector(state, info->label_block*(blocksize/512), 114 data = read_part_sector(state, labelsect, &sect);
104 &sect);
105 if (data == NULL) 115 if (data == NULL)
106 goto out_readerr; 116 goto out_readerr;
107 117
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 12c233da1b6b..437d2ca2de97 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -676,7 +676,7 @@ static void prune_dqcache(int count)
676 * This is called from kswapd when we think we need some 676 * This is called from kswapd when we think we need some
677 * more memory 677 * more memory
678 */ 678 */
679static int shrink_dqcache_memory(int nr, gfp_t gfp_mask) 679static int shrink_dqcache_memory(struct shrinker *shrink, int nr, gfp_t gfp_mask)
680{ 680{
681 if (nr) { 681 if (nr) {
682 spin_lock(&dq_list_lock); 682 spin_lock(&dq_list_lock);
diff --git a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c
index f71246bebfe4..a7ac78f8e67a 100644
--- a/fs/sysfs/symlink.c
+++ b/fs/sysfs/symlink.c
@@ -28,6 +28,7 @@ static int sysfs_do_create_link(struct kobject *kobj, struct kobject *target,
28 struct sysfs_dirent *target_sd = NULL; 28 struct sysfs_dirent *target_sd = NULL;
29 struct sysfs_dirent *sd = NULL; 29 struct sysfs_dirent *sd = NULL;
30 struct sysfs_addrm_cxt acxt; 30 struct sysfs_addrm_cxt acxt;
31 enum kobj_ns_type ns_type;
31 int error; 32 int error;
32 33
33 BUG_ON(!name); 34 BUG_ON(!name);
@@ -58,16 +59,29 @@ static int sysfs_do_create_link(struct kobject *kobj, struct kobject *target,
58 if (!sd) 59 if (!sd)
59 goto out_put; 60 goto out_put;
60 61
61 if (sysfs_ns_type(parent_sd)) 62 ns_type = sysfs_ns_type(parent_sd);
63 if (ns_type)
62 sd->s_ns = target->ktype->namespace(target); 64 sd->s_ns = target->ktype->namespace(target);
63 sd->s_symlink.target_sd = target_sd; 65 sd->s_symlink.target_sd = target_sd;
64 target_sd = NULL; /* reference is now owned by the symlink */ 66 target_sd = NULL; /* reference is now owned by the symlink */
65 67
66 sysfs_addrm_start(&acxt, parent_sd); 68 sysfs_addrm_start(&acxt, parent_sd);
67 if (warn) 69 /* Symlinks must be between directories with the same ns_type */
68 error = sysfs_add_one(&acxt, sd); 70 if (!ns_type ||
69 else 71 (ns_type == sysfs_ns_type(sd->s_symlink.target_sd->s_parent))) {
70 error = __sysfs_add_one(&acxt, sd); 72 if (warn)
73 error = sysfs_add_one(&acxt, sd);
74 else
75 error = __sysfs_add_one(&acxt, sd);
76 } else {
77 error = -EINVAL;
78 WARN(1, KERN_WARNING
79 "sysfs: symlink across ns_types %s/%s -> %s/%s\n",
80 parent_sd->s_name,
81 sd->s_name,
82 sd->s_symlink.target_sd->s_parent->s_name,
83 sd->s_symlink.target_sd->s_name);
84 }
71 sysfs_addrm_finish(&acxt); 85 sysfs_addrm_finish(&acxt);
72 86
73 if (error) 87 if (error)
@@ -122,7 +136,7 @@ void sysfs_delete_link(struct kobject *kobj, struct kobject *targ,
122{ 136{
123 const void *ns = NULL; 137 const void *ns = NULL;
124 spin_lock(&sysfs_assoc_lock); 138 spin_lock(&sysfs_assoc_lock);
125 if (targ->sd) 139 if (targ->sd && sysfs_ns_type(kobj->sd))
126 ns = targ->sd->s_ns; 140 ns = targ->sd->s_ns;
127 spin_unlock(&sysfs_assoc_lock); 141 spin_unlock(&sysfs_assoc_lock);
128 sysfs_hash_and_remove(kobj->sd, ns, name); 142 sysfs_hash_and_remove(kobj->sd, ns, name);
diff --git a/fs/ubifs/shrinker.c b/fs/ubifs/shrinker.c
index 02feb59cefca..0b201114a5ad 100644
--- a/fs/ubifs/shrinker.c
+++ b/fs/ubifs/shrinker.c
@@ -277,7 +277,7 @@ static int kick_a_thread(void)
277 return 0; 277 return 0;
278} 278}
279 279
280int ubifs_shrinker(int nr, gfp_t gfp_mask) 280int ubifs_shrinker(struct shrinker *shrink, int nr, gfp_t gfp_mask)
281{ 281{
282 int freed, contention = 0; 282 int freed, contention = 0;
283 long clean_zn_cnt = atomic_long_read(&ubifs_clean_zn_cnt); 283 long clean_zn_cnt = atomic_long_read(&ubifs_clean_zn_cnt);
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index 2eef553d50c8..04310878f449 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -1575,7 +1575,7 @@ int ubifs_tnc_start_commit(struct ubifs_info *c, struct ubifs_zbranch *zroot);
1575int ubifs_tnc_end_commit(struct ubifs_info *c); 1575int ubifs_tnc_end_commit(struct ubifs_info *c);
1576 1576
1577/* shrinker.c */ 1577/* shrinker.c */
1578int ubifs_shrinker(int nr_to_scan, gfp_t gfp_mask); 1578int ubifs_shrinker(struct shrinker *shrink, int nr_to_scan, gfp_t gfp_mask);
1579 1579
1580/* commit.c */ 1580/* commit.c */
1581int ubifs_bg_thread(void *info); 1581int ubifs_bg_thread(void *info);
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
index 649ade8ef598..2ee3f7a60163 100644
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/linux-2.6/xfs_buf.c
@@ -45,7 +45,7 @@
45 45
46static kmem_zone_t *xfs_buf_zone; 46static kmem_zone_t *xfs_buf_zone;
47STATIC int xfsbufd(void *); 47STATIC int xfsbufd(void *);
48STATIC int xfsbufd_wakeup(int, gfp_t); 48STATIC int xfsbufd_wakeup(struct shrinker *, int, gfp_t);
49STATIC void xfs_buf_delwri_queue(xfs_buf_t *, int); 49STATIC void xfs_buf_delwri_queue(xfs_buf_t *, int);
50static struct shrinker xfs_buf_shake = { 50static struct shrinker xfs_buf_shake = {
51 .shrink = xfsbufd_wakeup, 51 .shrink = xfsbufd_wakeup,
@@ -340,7 +340,7 @@ _xfs_buf_lookup_pages(
340 __func__, gfp_mask); 340 __func__, gfp_mask);
341 341
342 XFS_STATS_INC(xb_page_retries); 342 XFS_STATS_INC(xb_page_retries);
343 xfsbufd_wakeup(0, gfp_mask); 343 xfsbufd_wakeup(NULL, 0, gfp_mask);
344 congestion_wait(BLK_RW_ASYNC, HZ/50); 344 congestion_wait(BLK_RW_ASYNC, HZ/50);
345 goto retry; 345 goto retry;
346 } 346 }
@@ -1762,6 +1762,7 @@ xfs_buf_runall_queues(
1762 1762
1763STATIC int 1763STATIC int
1764xfsbufd_wakeup( 1764xfsbufd_wakeup(
1765 struct shrinker *shrink,
1765 int priority, 1766 int priority,
1766 gfp_t mask) 1767 gfp_t mask)
1767{ 1768{
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index f2d1718c9165..80938c736c27 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -1883,7 +1883,6 @@ init_xfs_fs(void)
1883 goto out_cleanup_procfs; 1883 goto out_cleanup_procfs;
1884 1884
1885 vfs_initquota(); 1885 vfs_initquota();
1886 xfs_inode_shrinker_init();
1887 1886
1888 error = register_filesystem(&xfs_fs_type); 1887 error = register_filesystem(&xfs_fs_type);
1889 if (error) 1888 if (error)
@@ -1911,7 +1910,6 @@ exit_xfs_fs(void)
1911{ 1910{
1912 vfs_exitquota(); 1911 vfs_exitquota();
1913 unregister_filesystem(&xfs_fs_type); 1912 unregister_filesystem(&xfs_fs_type);
1914 xfs_inode_shrinker_destroy();
1915 xfs_sysctl_unregister(); 1913 xfs_sysctl_unregister();
1916 xfs_cleanup_procfs(); 1914 xfs_cleanup_procfs();
1917 xfs_buf_terminate(); 1915 xfs_buf_terminate();
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c
index ef7f0218bccb..a51a07c3a70c 100644
--- a/fs/xfs/linux-2.6/xfs_sync.c
+++ b/fs/xfs/linux-2.6/xfs_sync.c
@@ -144,6 +144,41 @@ restart:
144 return last_error; 144 return last_error;
145} 145}
146 146
147/*
148 * Select the next per-ag structure to iterate during the walk. The reclaim
149 * walk is optimised only to walk AGs with reclaimable inodes in them.
150 */
151static struct xfs_perag *
152xfs_inode_ag_iter_next_pag(
153 struct xfs_mount *mp,
154 xfs_agnumber_t *first,
155 int tag)
156{
157 struct xfs_perag *pag = NULL;
158
159 if (tag == XFS_ICI_RECLAIM_TAG) {
160 int found;
161 int ref;
162
163 spin_lock(&mp->m_perag_lock);
164 found = radix_tree_gang_lookup_tag(&mp->m_perag_tree,
165 (void **)&pag, *first, 1, tag);
166 if (found <= 0) {
167 spin_unlock(&mp->m_perag_lock);
168 return NULL;
169 }
170 *first = pag->pag_agno + 1;
171 /* open coded pag reference increment */
172 ref = atomic_inc_return(&pag->pag_ref);
173 spin_unlock(&mp->m_perag_lock);
174 trace_xfs_perag_get_reclaim(mp, pag->pag_agno, ref, _RET_IP_);
175 } else {
176 pag = xfs_perag_get(mp, *first);
177 (*first)++;
178 }
179 return pag;
180}
181
147int 182int
148xfs_inode_ag_iterator( 183xfs_inode_ag_iterator(
149 struct xfs_mount *mp, 184 struct xfs_mount *mp,
@@ -154,16 +189,15 @@ xfs_inode_ag_iterator(
154 int exclusive, 189 int exclusive,
155 int *nr_to_scan) 190 int *nr_to_scan)
156{ 191{
192 struct xfs_perag *pag;
157 int error = 0; 193 int error = 0;
158 int last_error = 0; 194 int last_error = 0;
159 xfs_agnumber_t ag; 195 xfs_agnumber_t ag;
160 int nr; 196 int nr;
161 197
162 nr = nr_to_scan ? *nr_to_scan : INT_MAX; 198 nr = nr_to_scan ? *nr_to_scan : INT_MAX;
163 for (ag = 0; ag < mp->m_sb.sb_agcount; ag++) { 199 ag = 0;
164 struct xfs_perag *pag; 200 while ((pag = xfs_inode_ag_iter_next_pag(mp, &ag, tag))) {
165
166 pag = xfs_perag_get(mp, ag);
167 error = xfs_inode_ag_walk(mp, pag, execute, flags, tag, 201 error = xfs_inode_ag_walk(mp, pag, execute, flags, tag,
168 exclusive, &nr); 202 exclusive, &nr);
169 xfs_perag_put(pag); 203 xfs_perag_put(pag);
@@ -640,6 +674,17 @@ __xfs_inode_set_reclaim_tag(
640 radix_tree_tag_set(&pag->pag_ici_root, 674 radix_tree_tag_set(&pag->pag_ici_root,
641 XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino), 675 XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino),
642 XFS_ICI_RECLAIM_TAG); 676 XFS_ICI_RECLAIM_TAG);
677
678 if (!pag->pag_ici_reclaimable) {
679 /* propagate the reclaim tag up into the perag radix tree */
680 spin_lock(&ip->i_mount->m_perag_lock);
681 radix_tree_tag_set(&ip->i_mount->m_perag_tree,
682 XFS_INO_TO_AGNO(ip->i_mount, ip->i_ino),
683 XFS_ICI_RECLAIM_TAG);
684 spin_unlock(&ip->i_mount->m_perag_lock);
685 trace_xfs_perag_set_reclaim(ip->i_mount, pag->pag_agno,
686 -1, _RET_IP_);
687 }
643 pag->pag_ici_reclaimable++; 688 pag->pag_ici_reclaimable++;
644} 689}
645 690
@@ -674,6 +719,16 @@ __xfs_inode_clear_reclaim_tag(
674 radix_tree_tag_clear(&pag->pag_ici_root, 719 radix_tree_tag_clear(&pag->pag_ici_root,
675 XFS_INO_TO_AGINO(mp, ip->i_ino), XFS_ICI_RECLAIM_TAG); 720 XFS_INO_TO_AGINO(mp, ip->i_ino), XFS_ICI_RECLAIM_TAG);
676 pag->pag_ici_reclaimable--; 721 pag->pag_ici_reclaimable--;
722 if (!pag->pag_ici_reclaimable) {
723 /* clear the reclaim tag from the perag radix tree */
724 spin_lock(&ip->i_mount->m_perag_lock);
725 radix_tree_tag_clear(&ip->i_mount->m_perag_tree,
726 XFS_INO_TO_AGNO(ip->i_mount, ip->i_ino),
727 XFS_ICI_RECLAIM_TAG);
728 spin_unlock(&ip->i_mount->m_perag_lock);
729 trace_xfs_perag_clear_reclaim(ip->i_mount, pag->pag_agno,
730 -1, _RET_IP_);
731 }
677} 732}
678 733
679/* 734/*
@@ -828,83 +883,52 @@ xfs_reclaim_inodes(
828 883
829/* 884/*
830 * Shrinker infrastructure. 885 * Shrinker infrastructure.
831 *
832 * This is all far more complex than it needs to be. It adds a global list of
833 * mounts because the shrinkers can only call a global context. We need to make
834 * the shrinkers pass a context to avoid the need for global state.
835 */ 886 */
836static LIST_HEAD(xfs_mount_list);
837static struct rw_semaphore xfs_mount_list_lock;
838
839static int 887static int
840xfs_reclaim_inode_shrink( 888xfs_reclaim_inode_shrink(
889 struct shrinker *shrink,
841 int nr_to_scan, 890 int nr_to_scan,
842 gfp_t gfp_mask) 891 gfp_t gfp_mask)
843{ 892{
844 struct xfs_mount *mp; 893 struct xfs_mount *mp;
845 struct xfs_perag *pag; 894 struct xfs_perag *pag;
846 xfs_agnumber_t ag; 895 xfs_agnumber_t ag;
847 int reclaimable = 0; 896 int reclaimable;
848 897
898 mp = container_of(shrink, struct xfs_mount, m_inode_shrink);
849 if (nr_to_scan) { 899 if (nr_to_scan) {
850 if (!(gfp_mask & __GFP_FS)) 900 if (!(gfp_mask & __GFP_FS))
851 return -1; 901 return -1;
852 902
853 down_read(&xfs_mount_list_lock); 903 xfs_inode_ag_iterator(mp, xfs_reclaim_inode, 0,
854 list_for_each_entry(mp, &xfs_mount_list, m_mplist) {
855 xfs_inode_ag_iterator(mp, xfs_reclaim_inode, 0,
856 XFS_ICI_RECLAIM_TAG, 1, &nr_to_scan); 904 XFS_ICI_RECLAIM_TAG, 1, &nr_to_scan);
857 if (nr_to_scan <= 0) 905 /* if we don't exhaust the scan, don't bother coming back */
858 break; 906 if (nr_to_scan > 0)
859 } 907 return -1;
860 up_read(&xfs_mount_list_lock); 908 }
861 }
862 909
863 down_read(&xfs_mount_list_lock); 910 reclaimable = 0;
864 list_for_each_entry(mp, &xfs_mount_list, m_mplist) { 911 ag = 0;
865 for (ag = 0; ag < mp->m_sb.sb_agcount; ag++) { 912 while ((pag = xfs_inode_ag_iter_next_pag(mp, &ag,
866 pag = xfs_perag_get(mp, ag); 913 XFS_ICI_RECLAIM_TAG))) {
867 reclaimable += pag->pag_ici_reclaimable; 914 reclaimable += pag->pag_ici_reclaimable;
868 xfs_perag_put(pag); 915 xfs_perag_put(pag);
869 }
870 } 916 }
871 up_read(&xfs_mount_list_lock);
872 return reclaimable; 917 return reclaimable;
873} 918}
874 919
875static struct shrinker xfs_inode_shrinker = {
876 .shrink = xfs_reclaim_inode_shrink,
877 .seeks = DEFAULT_SEEKS,
878};
879
880void __init
881xfs_inode_shrinker_init(void)
882{
883 init_rwsem(&xfs_mount_list_lock);
884 register_shrinker(&xfs_inode_shrinker);
885}
886
887void
888xfs_inode_shrinker_destroy(void)
889{
890 ASSERT(list_empty(&xfs_mount_list));
891 unregister_shrinker(&xfs_inode_shrinker);
892}
893
894void 920void
895xfs_inode_shrinker_register( 921xfs_inode_shrinker_register(
896 struct xfs_mount *mp) 922 struct xfs_mount *mp)
897{ 923{
898 down_write(&xfs_mount_list_lock); 924 mp->m_inode_shrink.shrink = xfs_reclaim_inode_shrink;
899 list_add_tail(&mp->m_mplist, &xfs_mount_list); 925 mp->m_inode_shrink.seeks = DEFAULT_SEEKS;
900 up_write(&xfs_mount_list_lock); 926 register_shrinker(&mp->m_inode_shrink);
901} 927}
902 928
903void 929void
904xfs_inode_shrinker_unregister( 930xfs_inode_shrinker_unregister(
905 struct xfs_mount *mp) 931 struct xfs_mount *mp)
906{ 932{
907 down_write(&xfs_mount_list_lock); 933 unregister_shrinker(&mp->m_inode_shrink);
908 list_del(&mp->m_mplist);
909 up_write(&xfs_mount_list_lock);
910} 934}
diff --git a/fs/xfs/linux-2.6/xfs_sync.h b/fs/xfs/linux-2.6/xfs_sync.h
index cdcbaaca9880..e28139aaa4aa 100644
--- a/fs/xfs/linux-2.6/xfs_sync.h
+++ b/fs/xfs/linux-2.6/xfs_sync.h
@@ -55,8 +55,6 @@ int xfs_inode_ag_iterator(struct xfs_mount *mp,
55 int (*execute)(struct xfs_inode *ip, struct xfs_perag *pag, int flags), 55 int (*execute)(struct xfs_inode *ip, struct xfs_perag *pag, int flags),
56 int flags, int tag, int write_lock, int *nr_to_scan); 56 int flags, int tag, int write_lock, int *nr_to_scan);
57 57
58void xfs_inode_shrinker_init(void);
59void xfs_inode_shrinker_destroy(void);
60void xfs_inode_shrinker_register(struct xfs_mount *mp); 58void xfs_inode_shrinker_register(struct xfs_mount *mp);
61void xfs_inode_shrinker_unregister(struct xfs_mount *mp); 59void xfs_inode_shrinker_unregister(struct xfs_mount *mp);
62 60
diff --git a/fs/xfs/linux-2.6/xfs_trace.h b/fs/xfs/linux-2.6/xfs_trace.h
index 73d5aa117384..302820690904 100644
--- a/fs/xfs/linux-2.6/xfs_trace.h
+++ b/fs/xfs/linux-2.6/xfs_trace.h
@@ -124,7 +124,10 @@ DEFINE_EVENT(xfs_perag_class, name, \
124 unsigned long caller_ip), \ 124 unsigned long caller_ip), \
125 TP_ARGS(mp, agno, refcount, caller_ip)) 125 TP_ARGS(mp, agno, refcount, caller_ip))
126DEFINE_PERAG_REF_EVENT(xfs_perag_get); 126DEFINE_PERAG_REF_EVENT(xfs_perag_get);
127DEFINE_PERAG_REF_EVENT(xfs_perag_get_reclaim);
127DEFINE_PERAG_REF_EVENT(xfs_perag_put); 128DEFINE_PERAG_REF_EVENT(xfs_perag_put);
129DEFINE_PERAG_REF_EVENT(xfs_perag_set_reclaim);
130DEFINE_PERAG_REF_EVENT(xfs_perag_clear_reclaim);
128 131
129TRACE_EVENT(xfs_attr_list_node_descend, 132TRACE_EVENT(xfs_attr_list_node_descend,
130 TP_PROTO(struct xfs_attr_list_context *ctx, 133 TP_PROTO(struct xfs_attr_list_context *ctx,
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c
index 8c117ff2e3ab..67c018392d62 100644
--- a/fs/xfs/quota/xfs_qm.c
+++ b/fs/xfs/quota/xfs_qm.c
@@ -69,7 +69,7 @@ STATIC void xfs_qm_list_destroy(xfs_dqlist_t *);
69 69
70STATIC int xfs_qm_init_quotainos(xfs_mount_t *); 70STATIC int xfs_qm_init_quotainos(xfs_mount_t *);
71STATIC int xfs_qm_init_quotainfo(xfs_mount_t *); 71STATIC int xfs_qm_init_quotainfo(xfs_mount_t *);
72STATIC int xfs_qm_shake(int, gfp_t); 72STATIC int xfs_qm_shake(struct shrinker *, int, gfp_t);
73 73
74static struct shrinker xfs_qm_shaker = { 74static struct shrinker xfs_qm_shaker = {
75 .shrink = xfs_qm_shake, 75 .shrink = xfs_qm_shake,
@@ -2117,7 +2117,10 @@ xfs_qm_shake_freelist(
2117 */ 2117 */
2118/* ARGSUSED */ 2118/* ARGSUSED */
2119STATIC int 2119STATIC int
2120xfs_qm_shake(int nr_to_scan, gfp_t gfp_mask) 2120xfs_qm_shake(
2121 struct shrinker *shrink,
2122 int nr_to_scan,
2123 gfp_t gfp_mask)
2121{ 2124{
2122 int ndqused, nfree, n; 2125 int ndqused, nfree, n;
2123 2126
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index 1d2c7eed4eda..5761087ee8ea 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -259,7 +259,7 @@ typedef struct xfs_mount {
259 wait_queue_head_t m_wait_single_sync_task; 259 wait_queue_head_t m_wait_single_sync_task;
260 __int64_t m_update_flags; /* sb flags we need to update 260 __int64_t m_update_flags; /* sb flags we need to update
261 on the next remount,rw */ 261 on the next remount,rw */
262 struct list_head m_mplist; /* inode shrinker mount list */ 262 struct shrinker m_inode_shrink; /* inode reclaim shrinker */
263} xfs_mount_t; 263} xfs_mount_t;
264 264
265/* 265/*
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index da565a48240e..a68ca8a11a53 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -48,7 +48,7 @@ struct acpi_power_register {
48 u8 space_id; 48 u8 space_id;
49 u8 bit_width; 49 u8 bit_width;
50 u8 bit_offset; 50 u8 bit_offset;
51 u8 reserved; 51 u8 access_size;
52 u64 address; 52 u64 address;
53} __attribute__ ((packed)); 53} __attribute__ ((packed));
54 54
@@ -63,6 +63,7 @@ struct acpi_processor_cx {
63 u32 power; 63 u32 power;
64 u32 usage; 64 u32 usage;
65 u64 time; 65 u64 time;
66 u8 bm_sts_skip;
66 char desc[ACPI_CX_DESC_LEN]; 67 char desc[ACPI_CX_DESC_LEN];
67}; 68};
68 69
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 48c5299cbf26..030a954ed292 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -63,6 +63,12 @@
63/* Align . to a 8 byte boundary equals to maximum function alignment. */ 63/* Align . to a 8 byte boundary equals to maximum function alignment. */
64#define ALIGN_FUNCTION() . = ALIGN(8) 64#define ALIGN_FUNCTION() . = ALIGN(8)
65 65
66/*
67 * Align to a 32 byte boundary equal to the
68 * alignment gcc 4.5 uses for a struct
69 */
70#define STRUCT_ALIGN() . = ALIGN(32)
71
66/* The actual configuration determine if the init/exit sections 72/* The actual configuration determine if the init/exit sections
67 * are handled as text/data or they can be discarded (which 73 * are handled as text/data or they can be discarded (which
68 * often happens at runtime) 74 * often happens at runtime)
@@ -166,7 +172,11 @@
166 LIKELY_PROFILE() \ 172 LIKELY_PROFILE() \
167 BRANCH_PROFILE() \ 173 BRANCH_PROFILE() \
168 TRACE_PRINTKS() \ 174 TRACE_PRINTKS() \
175 \
176 STRUCT_ALIGN(); \
169 FTRACE_EVENTS() \ 177 FTRACE_EVENTS() \
178 \
179 STRUCT_ALIGN(); \
170 TRACE_SYSCALLS() 180 TRACE_SYSCALLS()
171 181
172/* 182/*
@@ -435,7 +445,7 @@
435 */ 445 */
436#define INIT_TASK_DATA_SECTION(align) \ 446#define INIT_TASK_DATA_SECTION(align) \
437 . = ALIGN(align); \ 447 . = ALIGN(align); \
438 .data..init_task : { \ 448 .data..init_task : AT(ADDR(.data..init_task) - LOAD_OFFSET) { \
439 INIT_TASK_DATA(align) \ 449 INIT_TASK_DATA(align) \
440 } 450 }
441 451
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 224a38c960d4..ccf94dc5acdf 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -253,7 +253,7 @@ int acpi_resources_are_enforced(void);
253#ifdef CONFIG_PM_SLEEP 253#ifdef CONFIG_PM_SLEEP
254void __init acpi_no_s4_hw_signature(void); 254void __init acpi_no_s4_hw_signature(void);
255void __init acpi_old_suspend_ordering(void); 255void __init acpi_old_suspend_ordering(void);
256void __init acpi_s4_no_nvs(void); 256void __init acpi_nvs_nosave(void);
257#endif /* CONFIG_PM_SLEEP */ 257#endif /* CONFIG_PM_SLEEP */
258 258
259struct acpi_osc_context { 259struct acpi_osc_context {
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 8e5a9dfb76bf..e7445df44d6c 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -873,6 +873,8 @@ struct fb_info {
873static inline struct apertures_struct *alloc_apertures(unsigned int max_num) { 873static inline struct apertures_struct *alloc_apertures(unsigned int max_num) {
874 struct apertures_struct *a = kzalloc(sizeof(struct apertures_struct) 874 struct apertures_struct *a = kzalloc(sizeof(struct apertures_struct)
875 + max_num * sizeof(struct aperture), GFP_KERNEL); 875 + max_num * sizeof(struct aperture), GFP_KERNEL);
876 if (!a)
877 return NULL;
876 a->count = max_num; 878 a->count = max_num;
877 return a; 879 return a;
878} 880}
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h
index 013dc529e95f..d147461bc271 100644
--- a/include/linux/fdtable.h
+++ b/include/linux/fdtable.h
@@ -61,7 +61,8 @@ struct files_struct {
61 (rcu_dereference_check((fdtfd), \ 61 (rcu_dereference_check((fdtfd), \
62 rcu_read_lock_held() || \ 62 rcu_read_lock_held() || \
63 lockdep_is_held(&(files)->file_lock) || \ 63 lockdep_is_held(&(files)->file_lock) || \
64 atomic_read(&(files)->count) == 1)) 64 atomic_read(&(files)->count) == 1 || \
65 rcu_my_thread_group_empty()))
65 66
66#define files_fdtable(files) \ 67#define files_fdtable(files) \
67 (rcu_dereference_check_fdtable((files), (files)->fdt)) 68 (rcu_dereference_check_fdtable((files), (files)->fdt))
diff --git a/include/linux/i8042.h b/include/linux/i8042.h
index 9bf6870ee5f4..a986ff588944 100644
--- a/include/linux/i8042.h
+++ b/include/linux/i8042.h
@@ -46,31 +46,31 @@ int i8042_remove_filter(bool (*filter)(unsigned char data, unsigned char str,
46 46
47#else 47#else
48 48
49void i8042_lock_chip(void) 49static inline void i8042_lock_chip(void)
50{ 50{
51} 51}
52 52
53void i8042_unlock_chip(void) 53static inline void i8042_unlock_chip(void)
54{ 54{
55} 55}
56 56
57int i8042_command(unsigned char *param, int command) 57static inline int i8042_command(unsigned char *param, int command)
58{ 58{
59 return -ENODEV; 59 return -ENODEV;
60} 60}
61 61
62bool i8042_check_port_owner(const struct serio *serio) 62static inline bool i8042_check_port_owner(const struct serio *serio)
63{ 63{
64 return false; 64 return false;
65} 65}
66 66
67int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str, 67static inline int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str,
68 struct serio *serio)) 68 struct serio *serio))
69{ 69{
70 return -ENODEV; 70 return -ENODEV;
71} 71}
72 72
73int i8042_remove_filter(bool (*filter)(unsigned char data, unsigned char str, 73static inline int i8042_remove_filter(bool (*filter)(unsigned char data, unsigned char str,
74 struct serio *serio)) 74 struct serio *serio))
75{ 75{
76 return -ENODEV; 76 return -ENODEV;
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index 9ea047aca795..1ffaeffeff74 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -67,6 +67,8 @@ static inline void macvlan_count_rx(const struct macvlan_dev *vlan,
67 } 67 }
68} 68}
69 69
70extern void macvlan_common_setup(struct net_device *dev);
71
70extern int macvlan_common_newlink(struct net *src_net, struct net_device *dev, 72extern int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
71 struct nlattr *tb[], struct nlattr *data[], 73 struct nlattr *tb[], struct nlattr *data[],
72 int (*receive)(struct sk_buff *skb), 74 int (*receive)(struct sk_buff *skb),
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index a4d2e9f7088a..adf832dec3f3 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -1026,11 +1026,12 @@ void __jbd2_journal_insert_checkpoint(struct journal_head *, transaction_t *);
1026 1026
1027struct jbd2_buffer_trigger_type { 1027struct jbd2_buffer_trigger_type {
1028 /* 1028 /*
1029 * Fired just before a buffer is written to the journal. 1029 * Fired a the moment data to write to the journal are known to be
1030 * mapped_data is a mapped buffer that is the frozen data for 1030 * stable - so either at the moment b_frozen_data is created or just
1031 * commit. 1031 * before a buffer is written to the journal. mapped_data is a mapped
1032 * buffer that is the frozen data for commit.
1032 */ 1033 */
1033 void (*t_commit)(struct jbd2_buffer_trigger_type *type, 1034 void (*t_frozen)(struct jbd2_buffer_trigger_type *type,
1034 struct buffer_head *bh, void *mapped_data, 1035 struct buffer_head *bh, void *mapped_data,
1035 size_t size); 1036 size_t size);
1036 1037
@@ -1042,7 +1043,7 @@ struct jbd2_buffer_trigger_type {
1042 struct buffer_head *bh); 1043 struct buffer_head *bh);
1043}; 1044};
1044 1045
1045extern void jbd2_buffer_commit_trigger(struct journal_head *jh, 1046extern void jbd2_buffer_frozen_trigger(struct journal_head *jh,
1046 void *mapped_data, 1047 void *mapped_data,
1047 struct jbd2_buffer_trigger_type *triggers); 1048 struct jbd2_buffer_trigger_type *triggers);
1048extern void jbd2_buffer_abort_trigger(struct journal_head *jh, 1049extern void jbd2_buffer_abort_trigger(struct journal_head *jh,
diff --git a/include/linux/mm.h b/include/linux/mm.h
index b969efb03787..a2b48041b910 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -999,7 +999,7 @@ static inline void sync_mm_rss(struct task_struct *task, struct mm_struct *mm)
999 * querying the cache size, so a fastpath for that case is appropriate. 999 * querying the cache size, so a fastpath for that case is appropriate.
1000 */ 1000 */
1001struct shrinker { 1001struct shrinker {
1002 int (*shrink)(int nr_to_scan, gfp_t gfp_mask); 1002 int (*shrink)(struct shrinker *, int nr_to_scan, gfp_t gfp_mask);
1003 int seeks; /* seeks to recreate an obj */ 1003 int seeks; /* seeks to recreate an obj */
1004 1004
1005 /* These are for internal use */ 1005 /* These are for internal use */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 7cb00845f150..f26fda76b87f 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -288,6 +288,7 @@ struct pci_dev {
288 */ 288 */
289 unsigned int irq; 289 unsigned int irq;
290 struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */ 290 struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */
291 resource_size_t fw_addr[DEVICE_COUNT_RESOURCE]; /* FW-assigned addr */
291 292
292 /* These fields are used by common fixups */ 293 /* These fields are used by common fixups */
293 unsigned int transparent:1; /* Transparent PCI bridge */ 294 unsigned int transparent:1; /* Transparent PCI bridge */
diff --git a/include/linux/regulator/tps6507x.h b/include/linux/regulator/tps6507x.h
new file mode 100644
index 000000000000..4892f591bab1
--- /dev/null
+++ b/include/linux/regulator/tps6507x.h
@@ -0,0 +1,32 @@
1/*
2 * tps6507x.h -- Voltage regulation for the Texas Instruments TPS6507X
3 *
4 * Copyright (C) 2010 Texas Instruments, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef REGULATOR_TPS6507X
21#define REGULATOR_TPS6507X
22
23/**
24 * tps6507x_reg_platform_data - platform data for tps6507x
25 * @defdcdc_default: Defines whether DCDC high or the low register controls
26 * output voltage by default. Valid for DCDC2 and DCDC3 outputs only.
27 */
28struct tps6507x_reg_platform_data {
29 bool defdcdc_default;
30};
31
32#endif
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 7f614ce274a9..13ebb5413a79 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -124,7 +124,8 @@ extern struct trace_event_functions enter_syscall_print_funcs;
124extern struct trace_event_functions exit_syscall_print_funcs; 124extern struct trace_event_functions exit_syscall_print_funcs;
125 125
126#define SYSCALL_TRACE_ENTER_EVENT(sname) \ 126#define SYSCALL_TRACE_ENTER_EVENT(sname) \
127 static struct syscall_metadata __syscall_meta_##sname; \ 127 static struct syscall_metadata \
128 __attribute__((__aligned__(4))) __syscall_meta_##sname; \
128 static struct ftrace_event_call \ 129 static struct ftrace_event_call \
129 __attribute__((__aligned__(4))) event_enter_##sname; \ 130 __attribute__((__aligned__(4))) event_enter_##sname; \
130 static struct ftrace_event_call __used \ 131 static struct ftrace_event_call __used \
@@ -138,7 +139,8 @@ extern struct trace_event_functions exit_syscall_print_funcs;
138 } 139 }
139 140
140#define SYSCALL_TRACE_EXIT_EVENT(sname) \ 141#define SYSCALL_TRACE_EXIT_EVENT(sname) \
141 static struct syscall_metadata __syscall_meta_##sname; \ 142 static struct syscall_metadata \
143 __attribute__((__aligned__(4))) __syscall_meta_##sname; \
142 static struct ftrace_event_call \ 144 static struct ftrace_event_call \
143 __attribute__((__aligned__(4))) event_exit_##sname; \ 145 __attribute__((__aligned__(4))) event_exit_##sname; \
144 static struct ftrace_event_call __used \ 146 static struct ftrace_event_call __used \
diff --git a/include/linux/sysrq.h b/include/linux/sysrq.h
index 4496322e28dd..609e8ca5f534 100644
--- a/include/linux/sysrq.h
+++ b/include/linux/sysrq.h
@@ -45,6 +45,7 @@ struct sysrq_key_op {
45 */ 45 */
46 46
47void handle_sysrq(int key, struct tty_struct *tty); 47void handle_sysrq(int key, struct tty_struct *tty);
48void __handle_sysrq(int key, struct tty_struct *tty, int check_mask);
48int register_sysrq_key(int key, struct sysrq_key_op *op); 49int register_sysrq_key(int key, struct sysrq_key_op *op);
49int unregister_sysrq_key(int key, struct sysrq_key_op *op); 50int unregister_sysrq_key(int key, struct sysrq_key_op *op);
50struct sysrq_key_op *__sysrq_get_key_op(int key); 51struct sysrq_key_op *__sysrq_get_key_op(int key);
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h
index c9a975976995..814f294d4cd0 100644
--- a/include/linux/vgaarb.h
+++ b/include/linux/vgaarb.h
@@ -29,6 +29,7 @@
29 */ 29 */
30 30
31#ifndef LINUX_VGA_H 31#ifndef LINUX_VGA_H
32#define LINUX_VGA_H
32 33
33#include <asm/vga.h> 34#include <asm/vga.h>
34 35
diff --git a/include/math-emu/op-common.h b/include/math-emu/op-common.h
index fd882261225e..9696a5e2c437 100644
--- a/include/math-emu/op-common.h
+++ b/include/math-emu/op-common.h
@@ -799,7 +799,7 @@ do { \
799 X##_e -= (_FP_W_TYPE_SIZE - rsize); \ 799 X##_e -= (_FP_W_TYPE_SIZE - rsize); \
800 X##_e = rsize - X##_e - 1; \ 800 X##_e = rsize - X##_e - 1; \
801 \ 801 \
802 if (_FP_FRACBITS_##fs < rsize && _FP_WFRACBITS_##fs < X##_e) \ 802 if (_FP_FRACBITS_##fs < rsize && _FP_WFRACBITS_##fs <= X##_e) \
803 __FP_FRAC_SRS_1(ur_, (X##_e - _FP_WFRACBITS_##fs + 1), rsize);\ 803 __FP_FRAC_SRS_1(ur_, (X##_e - _FP_WFRACBITS_##fs + 1), rsize);\
804 _FP_FRAC_DISASSEMBLE_##wc(X, ur_, rsize); \ 804 _FP_FRAC_DISASSEMBLE_##wc(X, ur_, rsize); \
805 if ((_FP_WFRACBITS_##fs - X##_e - 1) > 0) \ 805 if ((_FP_WFRACBITS_##fs - X##_e - 1) > 0) \
diff --git a/include/net/sock.h b/include/net/sock.h
index 731150d52799..0a691ea7654a 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1224,12 +1224,7 @@ static inline void sk_tx_queue_clear(struct sock *sk)
1224 1224
1225static inline int sk_tx_queue_get(const struct sock *sk) 1225static inline int sk_tx_queue_get(const struct sock *sk)
1226{ 1226{
1227 return sk->sk_tx_queue_mapping; 1227 return sk ? sk->sk_tx_queue_mapping : -1;
1228}
1229
1230static inline bool sk_tx_queue_recorded(const struct sock *sk)
1231{
1232 return (sk && sk->sk_tx_queue_mapping >= 0);
1233} 1228}
1234 1229
1235static inline void sk_set_socket(struct sock *sk, struct socket *sock) 1230static inline void sk_set_socket(struct sock *sk, struct socket *sock)
diff --git a/include/net/tc_act/tc_mirred.h b/include/net/tc_act/tc_mirred.h
index ceac661cdfd5..cfe2943690ff 100644
--- a/include/net/tc_act/tc_mirred.h
+++ b/include/net/tc_act/tc_mirred.h
@@ -9,6 +9,7 @@ struct tcf_mirred {
9 int tcfm_ifindex; 9 int tcfm_ifindex;
10 int tcfm_ok_push; 10 int tcfm_ok_push;
11 struct net_device *tcfm_dev; 11 struct net_device *tcfm_dev;
12 struct list_head tcfm_list;
12}; 13};
13#define to_mirred(pc) \ 14#define to_mirred(pc) \
14 container_of(pc, struct tcf_mirred, common) 15 container_of(pc, struct tcf_mirred, common)
diff --git a/ipc/sem.c b/ipc/sem.c
index 506c8491a8d1..40a8f462a822 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -1256,6 +1256,33 @@ out:
1256 return un; 1256 return un;
1257} 1257}
1258 1258
1259
1260/**
1261 * get_queue_result - Retrieve the result code from sem_queue
1262 * @q: Pointer to queue structure
1263 *
1264 * Retrieve the return code from the pending queue. If IN_WAKEUP is found in
1265 * q->status, then we must loop until the value is replaced with the final
1266 * value: This may happen if a task is woken up by an unrelated event (e.g.
1267 * signal) and in parallel the task is woken up by another task because it got
1268 * the requested semaphores.
1269 *
1270 * The function can be called with or without holding the semaphore spinlock.
1271 */
1272static int get_queue_result(struct sem_queue *q)
1273{
1274 int error;
1275
1276 error = q->status;
1277 while (unlikely(error == IN_WAKEUP)) {
1278 cpu_relax();
1279 error = q->status;
1280 }
1281
1282 return error;
1283}
1284
1285
1259SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops, 1286SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops,
1260 unsigned, nsops, const struct timespec __user *, timeout) 1287 unsigned, nsops, const struct timespec __user *, timeout)
1261{ 1288{
@@ -1409,15 +1436,18 @@ SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops,
1409 else 1436 else
1410 schedule(); 1437 schedule();
1411 1438
1412 error = queue.status; 1439 error = get_queue_result(&queue);
1413 while(unlikely(error == IN_WAKEUP)) {
1414 cpu_relax();
1415 error = queue.status;
1416 }
1417 1440
1418 if (error != -EINTR) { 1441 if (error != -EINTR) {
1419 /* fast path: update_queue already obtained all requested 1442 /* fast path: update_queue already obtained all requested
1420 * resources */ 1443 * resources.
1444 * Perform a smp_mb(): User space could assume that semop()
1445 * is a memory barrier: Without the mb(), the cpu could
1446 * speculatively read in user space stale data that was
1447 * overwritten by the previous owner of the semaphore.
1448 */
1449 smp_mb();
1450
1421 goto out_free; 1451 goto out_free;
1422 } 1452 }
1423 1453
@@ -1427,10 +1457,12 @@ SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops,
1427 goto out_free; 1457 goto out_free;
1428 } 1458 }
1429 1459
1460 error = get_queue_result(&queue);
1461
1430 /* 1462 /*
1431 * If queue.status != -EINTR we are woken up by another process 1463 * If queue.status != -EINTR we are woken up by another process
1432 */ 1464 */
1433 error = queue.status; 1465
1434 if (error != -EINTR) { 1466 if (error != -EINTR) {
1435 goto out_unlock_free; 1467 goto out_unlock_free;
1436 } 1468 }
diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c
index 5cb7cd1de10c..8bc5eeffec8a 100644
--- a/kernel/debug/debug_core.c
+++ b/kernel/debug/debug_core.c
@@ -605,13 +605,13 @@ cpu_master_loop:
605 if (dbg_kdb_mode) { 605 if (dbg_kdb_mode) {
606 kgdb_connected = 1; 606 kgdb_connected = 1;
607 error = kdb_stub(ks); 607 error = kdb_stub(ks);
608 kgdb_connected = 0;
608 } else { 609 } else {
609 error = gdb_serial_stub(ks); 610 error = gdb_serial_stub(ks);
610 } 611 }
611 612
612 if (error == DBG_PASS_EVENT) { 613 if (error == DBG_PASS_EVENT) {
613 dbg_kdb_mode = !dbg_kdb_mode; 614 dbg_kdb_mode = !dbg_kdb_mode;
614 kgdb_connected = 0;
615 } else if (error == DBG_SWITCH_CPU_EVENT) { 615 } else if (error == DBG_SWITCH_CPU_EVENT) {
616 dbg_cpu_switch(cpu, dbg_switch_cpu); 616 dbg_cpu_switch(cpu, dbg_switch_cpu);
617 goto cpu_loop; 617 goto cpu_loop;
diff --git a/kernel/debug/gdbstub.c b/kernel/debug/gdbstub.c
index 4b17b3269525..e8fd6868682d 100644
--- a/kernel/debug/gdbstub.c
+++ b/kernel/debug/gdbstub.c
@@ -621,10 +621,8 @@ static void gdb_cmd_query(struct kgdb_state *ks)
621 switch (remcom_in_buffer[1]) { 621 switch (remcom_in_buffer[1]) {
622 case 's': 622 case 's':
623 case 'f': 623 case 'f':
624 if (memcmp(remcom_in_buffer + 2, "ThreadInfo", 10)) { 624 if (memcmp(remcom_in_buffer + 2, "ThreadInfo", 10))
625 error_packet(remcom_out_buffer, -EINVAL);
626 break; 625 break;
627 }
628 626
629 i = 0; 627 i = 0;
630 remcom_out_buffer[0] = 'm'; 628 remcom_out_buffer[0] = 'm';
@@ -665,10 +663,9 @@ static void gdb_cmd_query(struct kgdb_state *ks)
665 pack_threadid(remcom_out_buffer + 2, thref); 663 pack_threadid(remcom_out_buffer + 2, thref);
666 break; 664 break;
667 case 'T': 665 case 'T':
668 if (memcmp(remcom_in_buffer + 1, "ThreadExtraInfo,", 16)) { 666 if (memcmp(remcom_in_buffer + 1, "ThreadExtraInfo,", 16))
669 error_packet(remcom_out_buffer, -EINVAL);
670 break; 667 break;
671 } 668
672 ks->threadid = 0; 669 ks->threadid = 0;
673 ptr = remcom_in_buffer + 17; 670 ptr = remcom_in_buffer + 17;
674 kgdb_hex2long(&ptr, &ks->threadid); 671 kgdb_hex2long(&ptr, &ks->threadid);
diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
index 184cd8209c36..ebe4a287419e 100644
--- a/kernel/debug/kdb/kdb_main.c
+++ b/kernel/debug/kdb/kdb_main.c
@@ -1820,9 +1820,8 @@ static int kdb_sr(int argc, const char **argv)
1820{ 1820{
1821 if (argc != 1) 1821 if (argc != 1)
1822 return KDB_ARGCOUNT; 1822 return KDB_ARGCOUNT;
1823 sysrq_toggle_support(1);
1824 kdb_trap_printk++; 1823 kdb_trap_printk++;
1825 handle_sysrq(*argv[1], NULL); 1824 __handle_sysrq(*argv[1], NULL, 0);
1826 kdb_trap_printk--; 1825 kdb_trap_printk--;
1827 1826
1828 return 0; 1827 return 0;
@@ -1883,6 +1882,7 @@ static int kdb_lsmod(int argc, const char **argv)
1883 kdb_printf(" (Loading)"); 1882 kdb_printf(" (Loading)");
1884 else 1883 else
1885 kdb_printf(" (Live)"); 1884 kdb_printf(" (Live)");
1885 kdb_printf(" 0x%p", mod->module_core);
1886 1886
1887#ifdef CONFIG_MODULE_UNLOAD 1887#ifdef CONFIG_MODULE_UNLOAD
1888 { 1888 {
@@ -2291,6 +2291,9 @@ static int kdb_ll(int argc, const char **argv)
2291 while (va) { 2291 while (va) {
2292 char buf[80]; 2292 char buf[80];
2293 2293
2294 if (KDB_FLAG(CMD_INTERRUPT))
2295 return 0;
2296
2294 sprintf(buf, "%s " kdb_machreg_fmt "\n", command, va); 2297 sprintf(buf, "%s " kdb_machreg_fmt "\n", command, va);
2295 diag = kdb_parse(buf); 2298 diag = kdb_parse(buf);
2296 if (diag) 2299 if (diag)
diff --git a/kernel/early_res.c b/kernel/early_res.c
index 31aa9332ef3f..7bfae887f211 100644
--- a/kernel/early_res.c
+++ b/kernel/early_res.c
@@ -7,6 +7,8 @@
7#include <linux/bootmem.h> 7#include <linux/bootmem.h>
8#include <linux/mm.h> 8#include <linux/mm.h>
9#include <linux/early_res.h> 9#include <linux/early_res.h>
10#include <linux/slab.h>
11#include <linux/kmemleak.h>
10 12
11/* 13/*
12 * Early reserved memory areas. 14 * Early reserved memory areas.
@@ -319,6 +321,8 @@ void __init free_early(u64 start, u64 end)
319 struct early_res *r; 321 struct early_res *r;
320 int i; 322 int i;
321 323
324 kmemleak_free_part(__va(start), end - start);
325
322 i = find_overlapped_early(start, end); 326 i = find_overlapped_early(start, end);
323 r = &early_res[i]; 327 r = &early_res[i];
324 if (i >= max_early_res || r->end != end || r->start != start) 328 if (i >= max_early_res || r->end != end || r->start != start)
@@ -333,6 +337,8 @@ void __init free_early_partial(u64 start, u64 end)
333 struct early_res *r; 337 struct early_res *r;
334 int i; 338 int i;
335 339
340 kmemleak_free_part(__va(start), end - start);
341
336 if (start == end) 342 if (start == end)
337 return; 343 return;
338 344
diff --git a/kernel/module.c b/kernel/module.c
index 5d2d28197c82..6c562828c85c 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -787,7 +787,6 @@ SYSCALL_DEFINE2(delete_module, const char __user *, name_user,
787 787
788 /* Store the name of the last unloaded module for diagnostic purposes */ 788 /* Store the name of the last unloaded module for diagnostic purposes */
789 strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module)); 789 strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module));
790 ddebug_remove_module(mod->name);
791 790
792 free_module(mod); 791 free_module(mod);
793 return 0; 792 return 0;
@@ -1550,6 +1549,9 @@ static void free_module(struct module *mod)
1550 remove_sect_attrs(mod); 1549 remove_sect_attrs(mod);
1551 mod_kobject_remove(mod); 1550 mod_kobject_remove(mod);
1552 1551
1552 /* Remove dynamic debug info */
1553 ddebug_remove_module(mod->name);
1554
1553 /* Arch-specific cleanup. */ 1555 /* Arch-specific cleanup. */
1554 module_arch_cleanup(mod); 1556 module_arch_cleanup(mod);
1555 1557
diff --git a/mm/bootmem.c b/mm/bootmem.c
index 58c66cc5056a..142c84a54993 100644
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -833,15 +833,24 @@ static void * __init ___alloc_bootmem_node(bootmem_data_t *bdata,
833void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size, 833void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size,
834 unsigned long align, unsigned long goal) 834 unsigned long align, unsigned long goal)
835{ 835{
836 void *ptr;
837
836 if (WARN_ON_ONCE(slab_is_available())) 838 if (WARN_ON_ONCE(slab_is_available()))
837 return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id); 839 return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id);
838 840
839#ifdef CONFIG_NO_BOOTMEM 841#ifdef CONFIG_NO_BOOTMEM
840 return __alloc_memory_core_early(pgdat->node_id, size, align, 842 ptr = __alloc_memory_core_early(pgdat->node_id, size, align,
843 goal, -1ULL);
844 if (ptr)
845 return ptr;
846
847 ptr = __alloc_memory_core_early(MAX_NUMNODES, size, align,
841 goal, -1ULL); 848 goal, -1ULL);
842#else 849#else
843 return ___alloc_bootmem_node(pgdat->bdata, size, align, goal, 0); 850 ptr = ___alloc_bootmem_node(pgdat->bdata, size, align, goal, 0);
844#endif 851#endif
852
853 return ptr;
845} 854}
846 855
847void * __init __alloc_bootmem_node_high(pg_data_t *pgdat, unsigned long size, 856void * __init __alloc_bootmem_node_high(pg_data_t *pgdat, unsigned long size,
@@ -977,14 +986,21 @@ void * __init __alloc_bootmem_low(unsigned long size, unsigned long align,
977void * __init __alloc_bootmem_low_node(pg_data_t *pgdat, unsigned long size, 986void * __init __alloc_bootmem_low_node(pg_data_t *pgdat, unsigned long size,
978 unsigned long align, unsigned long goal) 987 unsigned long align, unsigned long goal)
979{ 988{
989 void *ptr;
990
980 if (WARN_ON_ONCE(slab_is_available())) 991 if (WARN_ON_ONCE(slab_is_available()))
981 return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id); 992 return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id);
982 993
983#ifdef CONFIG_NO_BOOTMEM 994#ifdef CONFIG_NO_BOOTMEM
984 return __alloc_memory_core_early(pgdat->node_id, size, align, 995 ptr = __alloc_memory_core_early(pgdat->node_id, size, align,
996 goal, ARCH_LOW_ADDRESS_LIMIT);
997 if (ptr)
998 return ptr;
999 ptr = __alloc_memory_core_early(MAX_NUMNODES, size, align,
985 goal, ARCH_LOW_ADDRESS_LIMIT); 1000 goal, ARCH_LOW_ADDRESS_LIMIT);
986#else 1001#else
987 return ___alloc_bootmem_node(pgdat->bdata, size, align, 1002 ptr = ___alloc_bootmem_node(pgdat->bdata, size, align,
988 goal, ARCH_LOW_ADDRESS_LIMIT); 1003 goal, ARCH_LOW_ADDRESS_LIMIT);
989#endif 1004#endif
1005 return ptr;
990} 1006}
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 431214b941ac..9bd339eb04c6 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3634,6 +3634,9 @@ void * __init __alloc_memory_core_early(int nid, u64 size, u64 align,
3634 int i; 3634 int i;
3635 void *ptr; 3635 void *ptr;
3636 3636
3637 if (limit > get_max_mapped())
3638 limit = get_max_mapped();
3639
3637 /* need to go over early_node_map to find out good range for node */ 3640 /* need to go over early_node_map to find out good range for node */
3638 for_each_active_range_index_in_nid(i, nid) { 3641 for_each_active_range_index_in_nid(i, nid) {
3639 u64 addr; 3642 u64 addr;
@@ -3659,6 +3662,11 @@ void * __init __alloc_memory_core_early(int nid, u64 size, u64 align,
3659 ptr = phys_to_virt(addr); 3662 ptr = phys_to_virt(addr);
3660 memset(ptr, 0, size); 3663 memset(ptr, 0, size);
3661 reserve_early_without_check(addr, addr + size, "BOOTMEM"); 3664 reserve_early_without_check(addr, addr + size, "BOOTMEM");
3665 /*
3666 * The min_count is set to 0 so that bootmem allocated blocks
3667 * are never reported as leaks.
3668 */
3669 kmemleak_alloc(ptr, size, 0, 0);
3662 return ptr; 3670 return ptr;
3663 } 3671 }
3664 3672
diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c
index 6c0081441a32..5bffada7cde1 100644
--- a/mm/page_cgroup.c
+++ b/mm/page_cgroup.c
@@ -9,6 +9,7 @@
9#include <linux/vmalloc.h> 9#include <linux/vmalloc.h>
10#include <linux/cgroup.h> 10#include <linux/cgroup.h>
11#include <linux/swapops.h> 11#include <linux/swapops.h>
12#include <linux/kmemleak.h>
12 13
13static void __meminit 14static void __meminit
14__init_page_cgroup(struct page_cgroup *pc, unsigned long pfn) 15__init_page_cgroup(struct page_cgroup *pc, unsigned long pfn)
@@ -126,6 +127,12 @@ static int __init_refok init_section_page_cgroup(unsigned long pfn)
126 if (!base) 127 if (!base)
127 base = vmalloc(table_size); 128 base = vmalloc(table_size);
128 } 129 }
130 /*
131 * The value stored in section->page_cgroup is (base - pfn)
132 * and it does not point to the memory block allocated above,
133 * causing kmemleak false positives.
134 */
135 kmemleak_not_leak(base);
129 } else { 136 } else {
130 /* 137 /*
131 * We don't have to allocate page_cgroup again, but 138 * We don't have to allocate page_cgroup again, but
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 9c7e57cc63a3..b94fe1b3da43 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -213,8 +213,9 @@ unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask,
213 list_for_each_entry(shrinker, &shrinker_list, list) { 213 list_for_each_entry(shrinker, &shrinker_list, list) {
214 unsigned long long delta; 214 unsigned long long delta;
215 unsigned long total_scan; 215 unsigned long total_scan;
216 unsigned long max_pass = (*shrinker->shrink)(0, gfp_mask); 216 unsigned long max_pass;
217 217
218 max_pass = (*shrinker->shrink)(shrinker, 0, gfp_mask);
218 delta = (4 * scanned) / shrinker->seeks; 219 delta = (4 * scanned) / shrinker->seeks;
219 delta *= max_pass; 220 delta *= max_pass;
220 do_div(delta, lru_pages + 1); 221 do_div(delta, lru_pages + 1);
@@ -242,8 +243,9 @@ unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask,
242 int shrink_ret; 243 int shrink_ret;
243 int nr_before; 244 int nr_before;
244 245
245 nr_before = (*shrinker->shrink)(0, gfp_mask); 246 nr_before = (*shrinker->shrink)(shrinker, 0, gfp_mask);
246 shrink_ret = (*shrinker->shrink)(this_scan, gfp_mask); 247 shrink_ret = (*shrinker->shrink)(shrinker, this_scan,
248 gfp_mask);
247 if (shrink_ret == -1) 249 if (shrink_ret == -1)
248 break; 250 break;
249 if (shrink_ret < nr_before) 251 if (shrink_ret < nr_before)
@@ -296,7 +298,7 @@ static int may_write_to_queue(struct backing_dev_info *bdi)
296static void handle_write_error(struct address_space *mapping, 298static void handle_write_error(struct address_space *mapping,
297 struct page *page, int error) 299 struct page *page, int error)
298{ 300{
299 lock_page(page); 301 lock_page_nosync(page);
300 if (page_mapping(page) == mapping) 302 if (page_mapping(page) == mapping)
301 mapping_set_error(mapping, error); 303 mapping_set_error(mapping, error);
302 unlock_page(page); 304 unlock_page(page);
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index b10e3cdb08f8..800b6b9fbbae 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -358,6 +358,11 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8
358 acl->sec_level = sec_level; 358 acl->sec_level = sec_level;
359 acl->auth_type = auth_type; 359 acl->auth_type = auth_type;
360 hci_acl_connect(acl); 360 hci_acl_connect(acl);
361 } else {
362 if (acl->sec_level < sec_level)
363 acl->sec_level = sec_level;
364 if (acl->auth_type < auth_type)
365 acl->auth_type = auth_type;
361 } 366 }
362 367
363 if (type == ACL_LINK) 368 if (type == ACL_LINK)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 6c57fc71c7e2..786b5de0bac4 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1049,6 +1049,8 @@ static inline void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *s
1049 if (conn) { 1049 if (conn) {
1050 if (!ev->status) 1050 if (!ev->status)
1051 conn->link_mode |= HCI_LM_AUTH; 1051 conn->link_mode |= HCI_LM_AUTH;
1052 else
1053 conn->sec_level = BT_SECURITY_LOW;
1052 1054
1053 clear_bit(HCI_CONN_AUTH_PEND, &conn->pend); 1055 clear_bit(HCI_CONN_AUTH_PEND, &conn->pend);
1054 1056
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index 1b682a5aa061..cf3c4073a8a6 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -401,6 +401,11 @@ static inline void l2cap_send_rr_or_rnr(struct l2cap_pinfo *pi, u16 control)
401 l2cap_send_sframe(pi, control); 401 l2cap_send_sframe(pi, control);
402} 402}
403 403
404static inline int __l2cap_no_conn_pending(struct sock *sk)
405{
406 return !(l2cap_pi(sk)->conf_state & L2CAP_CONF_CONNECT_PEND);
407}
408
404static void l2cap_do_start(struct sock *sk) 409static void l2cap_do_start(struct sock *sk)
405{ 410{
406 struct l2cap_conn *conn = l2cap_pi(sk)->conn; 411 struct l2cap_conn *conn = l2cap_pi(sk)->conn;
@@ -409,12 +414,13 @@ static void l2cap_do_start(struct sock *sk)
409 if (!(conn->info_state & L2CAP_INFO_FEAT_MASK_REQ_DONE)) 414 if (!(conn->info_state & L2CAP_INFO_FEAT_MASK_REQ_DONE))
410 return; 415 return;
411 416
412 if (l2cap_check_security(sk)) { 417 if (l2cap_check_security(sk) && __l2cap_no_conn_pending(sk)) {
413 struct l2cap_conn_req req; 418 struct l2cap_conn_req req;
414 req.scid = cpu_to_le16(l2cap_pi(sk)->scid); 419 req.scid = cpu_to_le16(l2cap_pi(sk)->scid);
415 req.psm = l2cap_pi(sk)->psm; 420 req.psm = l2cap_pi(sk)->psm;
416 421
417 l2cap_pi(sk)->ident = l2cap_get_ident(conn); 422 l2cap_pi(sk)->ident = l2cap_get_ident(conn);
423 l2cap_pi(sk)->conf_state |= L2CAP_CONF_CONNECT_PEND;
418 424
419 l2cap_send_cmd(conn, l2cap_pi(sk)->ident, 425 l2cap_send_cmd(conn, l2cap_pi(sk)->ident,
420 L2CAP_CONN_REQ, sizeof(req), &req); 426 L2CAP_CONN_REQ, sizeof(req), &req);
@@ -464,12 +470,14 @@ static void l2cap_conn_start(struct l2cap_conn *conn)
464 } 470 }
465 471
466 if (sk->sk_state == BT_CONNECT) { 472 if (sk->sk_state == BT_CONNECT) {
467 if (l2cap_check_security(sk)) { 473 if (l2cap_check_security(sk) &&
474 __l2cap_no_conn_pending(sk)) {
468 struct l2cap_conn_req req; 475 struct l2cap_conn_req req;
469 req.scid = cpu_to_le16(l2cap_pi(sk)->scid); 476 req.scid = cpu_to_le16(l2cap_pi(sk)->scid);
470 req.psm = l2cap_pi(sk)->psm; 477 req.psm = l2cap_pi(sk)->psm;
471 478
472 l2cap_pi(sk)->ident = l2cap_get_ident(conn); 479 l2cap_pi(sk)->ident = l2cap_get_ident(conn);
480 l2cap_pi(sk)->conf_state |= L2CAP_CONF_CONNECT_PEND;
473 481
474 l2cap_send_cmd(conn, l2cap_pi(sk)->ident, 482 l2cap_send_cmd(conn, l2cap_pi(sk)->ident,
475 L2CAP_CONN_REQ, sizeof(req), &req); 483 L2CAP_CONN_REQ, sizeof(req), &req);
@@ -2912,7 +2920,6 @@ static inline int l2cap_connect_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hd
2912 l2cap_pi(sk)->ident = 0; 2920 l2cap_pi(sk)->ident = 0;
2913 l2cap_pi(sk)->dcid = dcid; 2921 l2cap_pi(sk)->dcid = dcid;
2914 l2cap_pi(sk)->conf_state |= L2CAP_CONF_REQ_SENT; 2922 l2cap_pi(sk)->conf_state |= L2CAP_CONF_REQ_SENT;
2915
2916 l2cap_pi(sk)->conf_state &= ~L2CAP_CONF_CONNECT_PEND; 2923 l2cap_pi(sk)->conf_state &= ~L2CAP_CONF_CONNECT_PEND;
2917 2924
2918 l2cap_send_cmd(conn, l2cap_get_ident(conn), L2CAP_CONF_REQ, 2925 l2cap_send_cmd(conn, l2cap_get_ident(conn), L2CAP_CONF_REQ,
@@ -4404,6 +4411,7 @@ static int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)
4404 req.psm = l2cap_pi(sk)->psm; 4411 req.psm = l2cap_pi(sk)->psm;
4405 4412
4406 l2cap_pi(sk)->ident = l2cap_get_ident(conn); 4413 l2cap_pi(sk)->ident = l2cap_get_ident(conn);
4414 l2cap_pi(sk)->conf_state |= L2CAP_CONF_CONNECT_PEND;
4407 4415
4408 l2cap_send_cmd(conn, l2cap_pi(sk)->ident, 4416 l2cap_send_cmd(conn, l2cap_pi(sk)->ident,
4409 L2CAP_CONN_REQ, sizeof(req), &req); 4417 L2CAP_CONN_REQ, sizeof(req), &req);
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index eedf2c94820e..753fc4221f3c 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -217,14 +217,6 @@ static bool br_devices_support_netpoll(struct net_bridge *br)
217 return count != 0 && ret; 217 return count != 0 && ret;
218} 218}
219 219
220static void br_poll_controller(struct net_device *br_dev)
221{
222 struct netpoll *np = br_dev->npinfo->netpoll;
223
224 if (np->real_dev != br_dev)
225 netpoll_poll_dev(np->real_dev);
226}
227
228void br_netpoll_cleanup(struct net_device *dev) 220void br_netpoll_cleanup(struct net_device *dev)
229{ 221{
230 struct net_bridge *br = netdev_priv(dev); 222 struct net_bridge *br = netdev_priv(dev);
@@ -295,7 +287,6 @@ static const struct net_device_ops br_netdev_ops = {
295 .ndo_do_ioctl = br_dev_ioctl, 287 .ndo_do_ioctl = br_dev_ioctl,
296#ifdef CONFIG_NET_POLL_CONTROLLER 288#ifdef CONFIG_NET_POLL_CONTROLLER
297 .ndo_netpoll_cleanup = br_netpoll_cleanup, 289 .ndo_netpoll_cleanup = br_netpoll_cleanup,
298 .ndo_poll_controller = br_poll_controller,
299#endif 290#endif
300}; 291};
301 292
diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c
index a4e72a89e4ff..595da45f9088 100644
--- a/net/bridge/br_forward.c
+++ b/net/bridge/br_forward.c
@@ -50,14 +50,7 @@ int br_dev_queue_push_xmit(struct sk_buff *skb)
50 kfree_skb(skb); 50 kfree_skb(skb);
51 else { 51 else {
52 skb_push(skb, ETH_HLEN); 52 skb_push(skb, ETH_HLEN);
53 53 dev_queue_xmit(skb);
54#ifdef CONFIG_NET_POLL_CONTROLLER
55 if (unlikely(skb->dev->priv_flags & IFF_IN_NETPOLL)) {
56 netpoll_send_skb(skb->dev->npinfo->netpoll, skb);
57 skb->dev->priv_flags &= ~IFF_IN_NETPOLL;
58 } else
59#endif
60 dev_queue_xmit(skb);
61 } 54 }
62 } 55 }
63 56
@@ -73,23 +66,9 @@ int br_forward_finish(struct sk_buff *skb)
73 66
74static void __br_deliver(const struct net_bridge_port *to, struct sk_buff *skb) 67static void __br_deliver(const struct net_bridge_port *to, struct sk_buff *skb)
75{ 68{
76#ifdef CONFIG_NET_POLL_CONTROLLER
77 struct net_bridge *br = to->br;
78 if (unlikely(br->dev->priv_flags & IFF_IN_NETPOLL)) {
79 struct netpoll *np;
80 to->dev->npinfo = skb->dev->npinfo;
81 np = skb->dev->npinfo->netpoll;
82 np->real_dev = np->dev = to->dev;
83 to->dev->priv_flags |= IFF_IN_NETPOLL;
84 }
85#endif
86 skb->dev = to->dev; 69 skb->dev = to->dev;
87 NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev, 70 NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev,
88 br_forward_finish); 71 br_forward_finish);
89#ifdef CONFIG_NET_POLL_CONTROLLER
90 if (skb->dev->npinfo)
91 skb->dev->npinfo->netpoll->dev = br->dev;
92#endif
93} 72}
94 73
95static void __br_forward(const struct net_bridge_port *to, struct sk_buff *skb) 74static void __br_forward(const struct net_bridge_port *to, struct sk_buff *skb)
diff --git a/net/core/dev.c b/net/core/dev.c
index 723a34710ad4..1f466e82ac33 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1488,6 +1488,7 @@ static inline void net_timestamp_check(struct sk_buff *skb)
1488int dev_forward_skb(struct net_device *dev, struct sk_buff *skb) 1488int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
1489{ 1489{
1490 skb_orphan(skb); 1490 skb_orphan(skb);
1491 nf_reset(skb);
1491 1492
1492 if (!(dev->flags & IFF_UP) || 1493 if (!(dev->flags & IFF_UP) ||
1493 (skb->len > (dev->mtu + dev->hard_header_len))) { 1494 (skb->len > (dev->mtu + dev->hard_header_len))) {
@@ -1911,8 +1912,16 @@ static int dev_gso_segment(struct sk_buff *skb)
1911 */ 1912 */
1912static inline void skb_orphan_try(struct sk_buff *skb) 1913static inline void skb_orphan_try(struct sk_buff *skb)
1913{ 1914{
1914 if (!skb_tx(skb)->flags) 1915 struct sock *sk = skb->sk;
1916
1917 if (sk && !skb_tx(skb)->flags) {
1918 /* skb_tx_hash() wont be able to get sk.
1919 * We copy sk_hash into skb->rxhash
1920 */
1921 if (!skb->rxhash)
1922 skb->rxhash = sk->sk_hash;
1915 skb_orphan(skb); 1923 skb_orphan(skb);
1924 }
1916} 1925}
1917 1926
1918int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, 1927int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
@@ -1998,8 +2007,7 @@ u16 skb_tx_hash(const struct net_device *dev, const struct sk_buff *skb)
1998 if (skb->sk && skb->sk->sk_hash) 2007 if (skb->sk && skb->sk->sk_hash)
1999 hash = skb->sk->sk_hash; 2008 hash = skb->sk->sk_hash;
2000 else 2009 else
2001 hash = (__force u16) skb->protocol; 2010 hash = (__force u16) skb->protocol ^ skb->rxhash;
2002
2003 hash = jhash_1word(hash, hashrnd); 2011 hash = jhash_1word(hash, hashrnd);
2004 2012
2005 return (u16) (((u64) hash * dev->real_num_tx_queues) >> 32); 2013 return (u16) (((u64) hash * dev->real_num_tx_queues) >> 32);
@@ -2022,12 +2030,11 @@ static inline u16 dev_cap_txqueue(struct net_device *dev, u16 queue_index)
2022static struct netdev_queue *dev_pick_tx(struct net_device *dev, 2030static struct netdev_queue *dev_pick_tx(struct net_device *dev,
2023 struct sk_buff *skb) 2031 struct sk_buff *skb)
2024{ 2032{
2025 u16 queue_index; 2033 int queue_index;
2026 struct sock *sk = skb->sk; 2034 struct sock *sk = skb->sk;
2027 2035
2028 if (sk_tx_queue_recorded(sk)) { 2036 queue_index = sk_tx_queue_get(sk);
2029 queue_index = sk_tx_queue_get(sk); 2037 if (queue_index < 0) {
2030 } else {
2031 const struct net_device_ops *ops = dev->netdev_ops; 2038 const struct net_device_ops *ops = dev->netdev_ops;
2032 2039
2033 if (ops->ndo_select_queue) { 2040 if (ops->ndo_select_queue) {
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 6ba1c0eece03..a4e0a7482c2b 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -949,7 +949,10 @@ static void neigh_update_hhs(struct neighbour *neigh)
949{ 949{
950 struct hh_cache *hh; 950 struct hh_cache *hh;
951 void (*update)(struct hh_cache*, const struct net_device*, const unsigned char *) 951 void (*update)(struct hh_cache*, const struct net_device*, const unsigned char *)
952 = neigh->dev->header_ops->cache_update; 952 = NULL;
953
954 if (neigh->dev->header_ops)
955 update = neigh->dev->header_ops->cache_update;
953 956
954 if (update) { 957 if (update) {
955 for (hh = neigh->hh; hh; hh = hh->hh_next) { 958 for (hh = neigh->hh; hh; hh = hh->hh_next) {
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 34432b4e96bb..ce88293a34e2 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -843,7 +843,9 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,
843 skb->network_header += off; 843 skb->network_header += off;
844 if (skb_mac_header_was_set(skb)) 844 if (skb_mac_header_was_set(skb))
845 skb->mac_header += off; 845 skb->mac_header += off;
846 skb->csum_start += nhead; 846 /* Only adjust this if it actually is csum_start rather than csum */
847 if (skb->ip_summed == CHECKSUM_PARTIAL)
848 skb->csum_start += nhead;
847 skb->cloned = 0; 849 skb->cloned = 0;
848 skb->hdr_len = 0; 850 skb->hdr_len = 0;
849 skb->nohdr = 0; 851 skb->nohdr = 0;
@@ -930,7 +932,8 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
930 copy_skb_header(n, skb); 932 copy_skb_header(n, skb);
931 933
932 off = newheadroom - oldheadroom; 934 off = newheadroom - oldheadroom;
933 n->csum_start += off; 935 if (n->ip_summed == CHECKSUM_PARTIAL)
936 n->csum_start += off;
934#ifdef NET_SKBUFF_DATA_USES_OFFSET 937#ifdef NET_SKBUFF_DATA_USES_OFFSET
935 n->transport_header += off; 938 n->transport_header += off;
936 n->network_header += off; 939 n->network_header += off;
diff --git a/net/dsa/Kconfig b/net/dsa/Kconfig
index c51b55400dc5..11201784d29a 100644
--- a/net/dsa/Kconfig
+++ b/net/dsa/Kconfig
@@ -1,7 +1,7 @@
1menuconfig NET_DSA 1menuconfig NET_DSA
2 bool "Distributed Switch Architecture support" 2 bool "Distributed Switch Architecture support"
3 default n 3 default n
4 depends on EXPERIMENTAL && !S390 4 depends on EXPERIMENTAL && NET_ETHERNET && !S390
5 select PHYLIB 5 select PHYLIB
6 ---help--- 6 ---help---
7 This allows you to use hardware switch chips that use 7 This allows you to use hardware switch chips that use
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 757f25eb9b4b..7f6273506eea 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -442,8 +442,10 @@ static netdev_tx_t reg_vif_xmit(struct sk_buff *skb, struct net_device *dev)
442 int err; 442 int err;
443 443
444 err = ipmr_fib_lookup(net, &fl, &mrt); 444 err = ipmr_fib_lookup(net, &fl, &mrt);
445 if (err < 0) 445 if (err < 0) {
446 kfree_skb(skb);
446 return err; 447 return err;
448 }
447 449
448 read_lock(&mrt_lock); 450 read_lock(&mrt_lock);
449 dev->stats.tx_bytes += skb->len; 451 dev->stats.tx_bytes += skb->len;
@@ -1728,8 +1730,10 @@ int ip_mr_input(struct sk_buff *skb)
1728 goto dont_forward; 1730 goto dont_forward;
1729 1731
1730 err = ipmr_fib_lookup(net, &skb_rtable(skb)->fl, &mrt); 1732 err = ipmr_fib_lookup(net, &skb_rtable(skb)->fl, &mrt);
1731 if (err < 0) 1733 if (err < 0) {
1734 kfree_skb(skb);
1732 return err; 1735 return err;
1736 }
1733 1737
1734 if (!local) { 1738 if (!local) {
1735 if (IPCB(skb)->opt.router_alert) { 1739 if (IPCB(skb)->opt.router_alert) {
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 6596b4feeddc..65afeaec15b7 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -608,6 +608,7 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos,
608 ssize_t spliced; 608 ssize_t spliced;
609 int ret; 609 int ret;
610 610
611 sock_rps_record_flow(sk);
611 /* 612 /*
612 * We can't seek on a socket input 613 * We can't seek on a socket input
613 */ 614 */
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index b4ed957f201a..7ed9dc1042d1 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2208,6 +2208,9 @@ void tcp_xmit_retransmit_queue(struct sock *sk)
2208 int mib_idx; 2208 int mib_idx;
2209 int fwd_rexmitting = 0; 2209 int fwd_rexmitting = 0;
2210 2210
2211 if (!tp->packets_out)
2212 return;
2213
2211 if (!tp->lost_out) 2214 if (!tp->lost_out)
2212 tp->retransmit_high = tp->snd_una; 2215 tp->retransmit_high = tp->snd_una;
2213 2216
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index e1a698df5706..784f34d11fdd 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1760,7 +1760,10 @@ static struct inet6_dev *addrconf_add_dev(struct net_device *dev)
1760 1760
1761 idev = ipv6_find_idev(dev); 1761 idev = ipv6_find_idev(dev);
1762 if (!idev) 1762 if (!idev)
1763 return NULL; 1763 return ERR_PTR(-ENOBUFS);
1764
1765 if (idev->cnf.disable_ipv6)
1766 return ERR_PTR(-EACCES);
1764 1767
1765 /* Add default multicast route */ 1768 /* Add default multicast route */
1766 addrconf_add_mroute(dev); 1769 addrconf_add_mroute(dev);
@@ -2129,8 +2132,9 @@ static int inet6_addr_add(struct net *net, int ifindex, struct in6_addr *pfx,
2129 if (!dev) 2132 if (!dev)
2130 return -ENODEV; 2133 return -ENODEV;
2131 2134
2132 if ((idev = addrconf_add_dev(dev)) == NULL) 2135 idev = addrconf_add_dev(dev);
2133 return -ENOBUFS; 2136 if (IS_ERR(idev))
2137 return PTR_ERR(idev);
2134 2138
2135 scope = ipv6_addr_scope(pfx); 2139 scope = ipv6_addr_scope(pfx);
2136 2140
@@ -2377,7 +2381,7 @@ static void addrconf_dev_config(struct net_device *dev)
2377 } 2381 }
2378 2382
2379 idev = addrconf_add_dev(dev); 2383 idev = addrconf_add_dev(dev);
2380 if (idev == NULL) 2384 if (IS_ERR(idev))
2381 return; 2385 return;
2382 2386
2383 memset(&addr, 0, sizeof(struct in6_addr)); 2387 memset(&addr, 0, sizeof(struct in6_addr));
@@ -2468,7 +2472,7 @@ static void addrconf_ip6_tnl_config(struct net_device *dev)
2468 ASSERT_RTNL(); 2472 ASSERT_RTNL();
2469 2473
2470 idev = addrconf_add_dev(dev); 2474 idev = addrconf_add_dev(dev);
2471 if (!idev) { 2475 if (IS_ERR(idev)) {
2472 printk(KERN_DEBUG "init ip6-ip6: add_dev failed\n"); 2476 printk(KERN_DEBUG "init ip6-ip6: add_dev failed\n");
2473 return; 2477 return;
2474 } 2478 }
diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c
index 2794b6002836..d6e9599d0705 100644
--- a/net/ipv6/mip6.c
+++ b/net/ipv6/mip6.c
@@ -347,11 +347,12 @@ static const struct xfrm_type mip6_destopt_type =
347 347
348static int mip6_rthdr_input(struct xfrm_state *x, struct sk_buff *skb) 348static int mip6_rthdr_input(struct xfrm_state *x, struct sk_buff *skb)
349{ 349{
350 struct ipv6hdr *iph = ipv6_hdr(skb);
350 struct rt2_hdr *rt2 = (struct rt2_hdr *)skb->data; 351 struct rt2_hdr *rt2 = (struct rt2_hdr *)skb->data;
351 int err = rt2->rt_hdr.nexthdr; 352 int err = rt2->rt_hdr.nexthdr;
352 353
353 spin_lock(&x->lock); 354 spin_lock(&x->lock);
354 if (!ipv6_addr_equal(&rt2->addr, (struct in6_addr *)x->coaddr) && 355 if (!ipv6_addr_equal(&iph->daddr, (struct in6_addr *)x->coaddr) &&
355 !ipv6_addr_any((struct in6_addr *)x->coaddr)) 356 !ipv6_addr_any((struct in6_addr *)x->coaddr))
356 err = -ENOENT; 357 err = -ENOENT;
357 spin_unlock(&x->lock); 358 spin_unlock(&x->lock);
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index c7000a6ca379..67ee34f57df7 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -632,7 +632,7 @@ static void ieee80211_send_layer2_update(struct sta_info *sta)
632 skb->dev = sta->sdata->dev; 632 skb->dev = sta->sdata->dev;
633 skb->protocol = eth_type_trans(skb, sta->sdata->dev); 633 skb->protocol = eth_type_trans(skb, sta->sdata->dev);
634 memset(skb->cb, 0, sizeof(skb->cb)); 634 memset(skb->cb, 0, sizeof(skb->cb));
635 netif_rx(skb); 635 netif_rx_ni(skb);
636} 636}
637 637
638static void sta_apply_parameters(struct ieee80211_local *local, 638static void sta_apply_parameters(struct ieee80211_local *local,
diff --git a/net/phonet/pep.c b/net/phonet/pep.c
index 94d72e85a475..b2a3ae6cad78 100644
--- a/net/phonet/pep.c
+++ b/net/phonet/pep.c
@@ -698,6 +698,7 @@ static struct sock *pep_sock_accept(struct sock *sk, int flags, int *errp)
698 newsk = NULL; 698 newsk = NULL;
699 goto out; 699 goto out;
700 } 700 }
701 kfree_skb(oskb);
701 702
702 sock_hold(sk); 703 sock_hold(sk);
703 pep_sk(newsk)->listener = sk; 704 pep_sk(newsk)->listener = sk;
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index c0b6863e3b87..1980b71c283f 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -33,6 +33,7 @@
33static struct tcf_common *tcf_mirred_ht[MIRRED_TAB_MASK + 1]; 33static struct tcf_common *tcf_mirred_ht[MIRRED_TAB_MASK + 1];
34static u32 mirred_idx_gen; 34static u32 mirred_idx_gen;
35static DEFINE_RWLOCK(mirred_lock); 35static DEFINE_RWLOCK(mirred_lock);
36static LIST_HEAD(mirred_list);
36 37
37static struct tcf_hashinfo mirred_hash_info = { 38static struct tcf_hashinfo mirred_hash_info = {
38 .htab = tcf_mirred_ht, 39 .htab = tcf_mirred_ht,
@@ -47,7 +48,9 @@ static inline int tcf_mirred_release(struct tcf_mirred *m, int bind)
47 m->tcf_bindcnt--; 48 m->tcf_bindcnt--;
48 m->tcf_refcnt--; 49 m->tcf_refcnt--;
49 if(!m->tcf_bindcnt && m->tcf_refcnt <= 0) { 50 if(!m->tcf_bindcnt && m->tcf_refcnt <= 0) {
50 dev_put(m->tcfm_dev); 51 list_del(&m->tcfm_list);
52 if (m->tcfm_dev)
53 dev_put(m->tcfm_dev);
51 tcf_hash_destroy(&m->common, &mirred_hash_info); 54 tcf_hash_destroy(&m->common, &mirred_hash_info);
52 return 1; 55 return 1;
53 } 56 }
@@ -134,8 +137,10 @@ static int tcf_mirred_init(struct nlattr *nla, struct nlattr *est,
134 m->tcfm_ok_push = ok_push; 137 m->tcfm_ok_push = ok_push;
135 } 138 }
136 spin_unlock_bh(&m->tcf_lock); 139 spin_unlock_bh(&m->tcf_lock);
137 if (ret == ACT_P_CREATED) 140 if (ret == ACT_P_CREATED) {
141 list_add(&m->tcfm_list, &mirred_list);
138 tcf_hash_insert(pc, &mirred_hash_info); 142 tcf_hash_insert(pc, &mirred_hash_info);
143 }
139 144
140 return ret; 145 return ret;
141} 146}
@@ -162,9 +167,14 @@ static int tcf_mirred(struct sk_buff *skb, struct tc_action *a,
162 m->tcf_tm.lastuse = jiffies; 167 m->tcf_tm.lastuse = jiffies;
163 168
164 dev = m->tcfm_dev; 169 dev = m->tcfm_dev;
170 if (!dev) {
171 printk_once(KERN_NOTICE "tc mirred: target device is gone\n");
172 goto out;
173 }
174
165 if (!(dev->flags & IFF_UP)) { 175 if (!(dev->flags & IFF_UP)) {
166 if (net_ratelimit()) 176 if (net_ratelimit())
167 pr_notice("tc mirred to Houston: device %s is gone!\n", 177 pr_notice("tc mirred to Houston: device %s is down\n",
168 dev->name); 178 dev->name);
169 goto out; 179 goto out;
170 } 180 }
@@ -232,6 +242,28 @@ nla_put_failure:
232 return -1; 242 return -1;
233} 243}
234 244
245static int mirred_device_event(struct notifier_block *unused,
246 unsigned long event, void *ptr)
247{
248 struct net_device *dev = ptr;
249 struct tcf_mirred *m;
250
251 if (event == NETDEV_UNREGISTER)
252 list_for_each_entry(m, &mirred_list, tcfm_list) {
253 if (m->tcfm_dev == dev) {
254 dev_put(dev);
255 m->tcfm_dev = NULL;
256 }
257 }
258
259 return NOTIFY_DONE;
260}
261
262static struct notifier_block mirred_device_notifier = {
263 .notifier_call = mirred_device_event,
264};
265
266
235static struct tc_action_ops act_mirred_ops = { 267static struct tc_action_ops act_mirred_ops = {
236 .kind = "mirred", 268 .kind = "mirred",
237 .hinfo = &mirred_hash_info, 269 .hinfo = &mirred_hash_info,
@@ -252,12 +284,17 @@ MODULE_LICENSE("GPL");
252 284
253static int __init mirred_init_module(void) 285static int __init mirred_init_module(void)
254{ 286{
287 int err = register_netdevice_notifier(&mirred_device_notifier);
288 if (err)
289 return err;
290
255 pr_info("Mirror/redirect action on\n"); 291 pr_info("Mirror/redirect action on\n");
256 return tcf_register_action(&act_mirred_ops); 292 return tcf_register_action(&act_mirred_ops);
257} 293}
258 294
259static void __exit mirred_cleanup_module(void) 295static void __exit mirred_cleanup_module(void)
260{ 296{
297 unregister_netdevice_notifier(&mirred_device_notifier);
261 tcf_unregister_action(&act_mirred_ops); 298 tcf_unregister_action(&act_mirred_ops);
262} 299}
263 300
diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
index 570949417f38..724553e8ed7b 100644
--- a/net/sched/act_nat.c
+++ b/net/sched/act_nat.c
@@ -205,7 +205,7 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
205 { 205 {
206 struct icmphdr *icmph; 206 struct icmphdr *icmph;
207 207
208 if (!pskb_may_pull(skb, ihl + sizeof(*icmph) + sizeof(*iph))) 208 if (!pskb_may_pull(skb, ihl + sizeof(*icmph)))
209 goto drop; 209 goto drop;
210 210
211 icmph = (void *)(skb_network_header(skb) + ihl); 211 icmph = (void *)(skb_network_header(skb) + ihl);
@@ -215,6 +215,9 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
215 (icmph->type != ICMP_PARAMETERPROB)) 215 (icmph->type != ICMP_PARAMETERPROB))
216 break; 216 break;
217 217
218 if (!pskb_may_pull(skb, ihl + sizeof(*icmph) + sizeof(*iph)))
219 goto drop;
220
218 iph = (void *)(icmph + 1); 221 iph = (void *)(icmph + 1);
219 if (egress) 222 if (egress)
220 addr = iph->daddr; 223 addr = iph->daddr;
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
index 73affb8624fa..8dc47f1d0001 100644
--- a/net/sunrpc/auth.c
+++ b/net/sunrpc/auth.c
@@ -267,7 +267,7 @@ rpcauth_prune_expired(struct list_head *free, int nr_to_scan)
267 * Run memory cache shrinker. 267 * Run memory cache shrinker.
268 */ 268 */
269static int 269static int
270rpcauth_cache_shrinker(int nr_to_scan, gfp_t gfp_mask) 270rpcauth_cache_shrinker(struct shrinker *shrink, int nr_to_scan, gfp_t gfp_mask)
271{ 271{
272 LIST_HEAD(free); 272 LIST_HEAD(free);
273 int res; 273 int res;
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index af1c173be4ad..a7ec5a8a2380 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1594,8 +1594,8 @@ xfrm_resolve_and_create_bundle(struct xfrm_policy **pols, int num_pols,
1594 1594
1595 /* Try to instantiate a bundle */ 1595 /* Try to instantiate a bundle */
1596 err = xfrm_tmpl_resolve(pols, num_pols, fl, xfrm, family); 1596 err = xfrm_tmpl_resolve(pols, num_pols, fl, xfrm, family);
1597 if (err < 0) { 1597 if (err <= 0) {
1598 if (err != -EAGAIN) 1598 if (err != 0 && err != -EAGAIN)
1599 XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTPOLERROR); 1599 XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTPOLERROR);
1600 return ERR_PTR(err); 1600 return ERR_PTR(err);
1601 } 1601 }
@@ -1678,6 +1678,13 @@ xfrm_bundle_lookup(struct net *net, struct flowi *fl, u16 family, u8 dir,
1678 goto make_dummy_bundle; 1678 goto make_dummy_bundle;
1679 dst_hold(&xdst->u.dst); 1679 dst_hold(&xdst->u.dst);
1680 return oldflo; 1680 return oldflo;
1681 } else if (new_xdst == NULL) {
1682 num_xfrms = 0;
1683 if (oldflo == NULL)
1684 goto make_dummy_bundle;
1685 xdst->num_xfrms = 0;
1686 dst_hold(&xdst->u.dst);
1687 return oldflo;
1681 } 1688 }
1682 1689
1683 /* Kill the previous bundle */ 1690 /* Kill the previous bundle */
@@ -1760,6 +1767,10 @@ restart:
1760 xfrm_pols_put(pols, num_pols); 1767 xfrm_pols_put(pols, num_pols);
1761 err = PTR_ERR(xdst); 1768 err = PTR_ERR(xdst);
1762 goto dropdst; 1769 goto dropdst;
1770 } else if (xdst == NULL) {
1771 num_xfrms = 0;
1772 drop_pols = num_pols;
1773 goto no_transform;
1763 } 1774 }
1764 1775
1765 spin_lock_bh(&xfrm_policy_sk_bundle_lock); 1776 spin_lock_bh(&xfrm_policy_sk_bundle_lock);
diff --git a/scripts/kconfig/nconf.gui.c b/scripts/kconfig/nconf.gui.c
index 115edb437fb1..a9d9344e1365 100644
--- a/scripts/kconfig/nconf.gui.c
+++ b/scripts/kconfig/nconf.gui.c
@@ -226,7 +226,7 @@ void fill_window(WINDOW *win, const char *text)
226 int len = get_line_length(line); 226 int len = get_line_length(line);
227 strncpy(tmp, line, min(len, x)); 227 strncpy(tmp, line, min(len, x));
228 tmp[len] = '\0'; 228 tmp[len] = '\0';
229 mvwprintw(win, i, 0, tmp); 229 mvwprintw(win, i, 0, "%s", tmp);
230 } 230 }
231} 231}
232 232
diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index 3a681ef25306..d2c29b63adda 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -44,7 +44,7 @@ rpm-pkg rpm: $(objtree)/kernel.spec FORCE
44 fi 44 fi
45 $(MAKE) clean 45 $(MAKE) clean
46 $(PREV) ln -sf $(srctree) $(KERNELPATH) 46 $(PREV) ln -sf $(srctree) $(KERNELPATH)
47 $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion --scm-only > $(objtree)/.scmversion 47 $(CONFIG_SHELL) $(srctree)/scripts/setlocalversion --save-scmversion
48 $(PREV) tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/. 48 $(PREV) tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/.
49 $(PREV) rm $(KERNELPATH) 49 $(PREV) rm $(KERNELPATH)
50 rm -f $(objtree)/.scmversion 50 rm -f $(objtree)/.scmversion
diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index d6a866ed1835..64a9cb5556cd 100755
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -10,13 +10,13 @@
10# 10#
11 11
12usage() { 12usage() {
13 echo "Usage: $0 [--scm-only] [srctree]" >&2 13 echo "Usage: $0 [--save-scmversion] [srctree]" >&2
14 exit 1 14 exit 1
15} 15}
16 16
17scm_only=false 17scm_only=false
18srctree=. 18srctree=.
19if test "$1" = "--scm-only"; then 19if test "$1" = "--save-scmversion"; then
20 scm_only=true 20 scm_only=true
21 shift 21 shift
22fi 22fi
@@ -30,11 +30,12 @@ fi
30 30
31scm_version() 31scm_version()
32{ 32{
33 local short=false 33 local short
34 short=false
34 35
35 cd "$srctree" 36 cd "$srctree"
36 if test -e .scmversion; then 37 if test -e .scmversion; then
37 cat "$_" 38 cat .scmversion
38 return 39 return
39 fi 40 fi
40 if test "$1" = "--short"; then 41 if test "$1" = "--short"; then
@@ -131,12 +132,15 @@ collect_files()
131} 132}
132 133
133if $scm_only; then 134if $scm_only; then
134 scm_version 135 if test ! -e .scmversion; then
136 res=$(scm_version)
137 echo "$res" >.scmversion
138 fi
135 exit 139 exit
136fi 140fi
137 141
138if test -e include/config/auto.conf; then 142if test -e include/config/auto.conf; then
139 source "$_" 143 . include/config/auto.conf
140else 144else
141 echo "Error: kernelrelease not valid - run 'make prepare' to update it" 145 echo "Error: kernelrelease not valid - run 'make prepare' to update it"
142 exit 1 146 exit 1
diff --git a/sound/soc/au1x/psc-i2s.c b/sound/soc/au1x/psc-i2s.c
index 495be6e71931..24454c98d0ee 100644
--- a/sound/soc/au1x/psc-i2s.c
+++ b/sound/soc/au1x/psc-i2s.c
@@ -300,7 +300,7 @@ struct snd_soc_dai au1xpsc_i2s_dai = {
300}; 300};
301EXPORT_SYMBOL(au1xpsc_i2s_dai); 301EXPORT_SYMBOL(au1xpsc_i2s_dai);
302 302
303static int __init au1xpsc_i2s_drvprobe(struct platform_device *pdev) 303static int __devinit au1xpsc_i2s_drvprobe(struct platform_device *pdev)
304{ 304{
305 struct resource *r; 305 struct resource *r;
306 unsigned long sel; 306 unsigned long sel;
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 31ac5538fe7e..5da30eb6ad00 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -83,8 +83,8 @@ config SND_SOC_ALL_CODECS
83 83
84config SND_SOC_WM_HUBS 84config SND_SOC_WM_HUBS
85 tristate 85 tristate
86 default y if SND_SOC_WM8993=y 86 default y if SND_SOC_WM8993=y || SND_SOC_WM8994=y
87 default m if SND_SOC_WM8993=m 87 default m if SND_SOC_WM8993=m || SND_SOC_WM8994=m
88 88
89config SND_SOC_AC97_CODEC 89config SND_SOC_AC97_CODEC
90 tristate 90 tristate
diff --git a/sound/soc/codecs/wm8727.c b/sound/soc/codecs/wm8727.c
index 1072621e93fd..9d1df2628136 100644
--- a/sound/soc/codecs/wm8727.c
+++ b/sound/soc/codecs/wm8727.c
@@ -127,6 +127,8 @@ static __devinit int wm8727_platform_probe(struct platform_device *pdev)
127 goto err_codec; 127 goto err_codec;
128 } 128 }
129 129
130 return 0;
131
130err_codec: 132err_codec:
131 snd_soc_unregister_codec(codec); 133 snd_soc_unregister_codec(codec);
132err: 134err:
diff --git a/sound/soc/codecs/wm8776.c b/sound/soc/codecs/wm8776.c
index 7e4a627b4c7e..4e212ed62ea6 100644
--- a/sound/soc/codecs/wm8776.c
+++ b/sound/soc/codecs/wm8776.c
@@ -94,7 +94,6 @@ SOC_DAPM_SINGLE("Bypass Switch", WM8776_OUTMUX, 2, 1, 0),
94 94
95static const struct snd_soc_dapm_widget wm8776_dapm_widgets[] = { 95static const struct snd_soc_dapm_widget wm8776_dapm_widgets[] = {
96SND_SOC_DAPM_INPUT("AUX"), 96SND_SOC_DAPM_INPUT("AUX"),
97SND_SOC_DAPM_INPUT("AUX"),
98 97
99SND_SOC_DAPM_INPUT("AIN1"), 98SND_SOC_DAPM_INPUT("AIN1"),
100SND_SOC_DAPM_INPUT("AIN2"), 99SND_SOC_DAPM_INPUT("AIN2"),
diff --git a/sound/soc/codecs/wm8988.c b/sound/soc/codecs/wm8988.c
index 0417dae32e6f..19ad590ca0b3 100644
--- a/sound/soc/codecs/wm8988.c
+++ b/sound/soc/codecs/wm8988.c
@@ -885,7 +885,6 @@ static int wm8988_register(struct wm8988_priv *wm8988,
885 ret = snd_soc_register_dai(&wm8988_dai); 885 ret = snd_soc_register_dai(&wm8988_dai);
886 if (ret != 0) { 886 if (ret != 0) {
887 dev_err(codec->dev, "Failed to register DAI: %d\n", ret); 887 dev_err(codec->dev, "Failed to register DAI: %d\n", ret);
888 snd_soc_unregister_codec(codec);
889 goto err_codec; 888 goto err_codec;
890 } 889 }
891 890
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 3396a0db06ba..ec4acac49ebd 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -683,20 +683,15 @@ static int fsi_dai_startup(struct snd_pcm_substream *substream,
683 683
684 /* clock inversion (CKG2) */ 684 /* clock inversion (CKG2) */
685 data = 0; 685 data = 0;
686 switch (SH_FSI_INVERSION_MASK & flags) { 686 if (SH_FSI_LRM_INV & flags)
687 case SH_FSI_LRM_INV: 687 data |= 1 << 12;
688 data = 1 << 12; 688 if (SH_FSI_BRM_INV & flags)
689 break; 689 data |= 1 << 8;
690 case SH_FSI_BRM_INV: 690 if (SH_FSI_LRS_INV & flags)
691 data = 1 << 8; 691 data |= 1 << 4;
692 break; 692 if (SH_FSI_BRS_INV & flags)
693 case SH_FSI_LRS_INV: 693 data |= 1 << 0;
694 data = 1 << 4; 694
695 break;
696 case SH_FSI_BRS_INV:
697 data = 1 << 0;
698 break;
699 }
700 fsi_reg_write(fsi, CKG2, data); 695 fsi_reg_write(fsi, CKG2, data);
701 696
702 /* do fmt, di fmt */ 697 /* do fmt, di fmt */
@@ -726,15 +721,15 @@ static int fsi_dai_startup(struct snd_pcm_substream *substream,
726 break; 721 break;
727 case SH_FSI_FMT_TDM: 722 case SH_FSI_FMT_TDM:
728 msg = "TDM"; 723 msg = "TDM";
729 data = CR_FMT(CR_TDM) | (fsi->chan - 1);
730 fsi->chan = is_play ? 724 fsi->chan = is_play ?
731 SH_FSI_GET_CH_O(flags) : SH_FSI_GET_CH_I(flags); 725 SH_FSI_GET_CH_O(flags) : SH_FSI_GET_CH_I(flags);
726 data = CR_FMT(CR_TDM) | (fsi->chan - 1);
732 break; 727 break;
733 case SH_FSI_FMT_TDM_DELAY: 728 case SH_FSI_FMT_TDM_DELAY:
734 msg = "TDM Delay"; 729 msg = "TDM Delay";
735 data = CR_FMT(CR_TDM_D) | (fsi->chan - 1);
736 fsi->chan = is_play ? 730 fsi->chan = is_play ?
737 SH_FSI_GET_CH_O(flags) : SH_FSI_GET_CH_I(flags); 731 SH_FSI_GET_CH_O(flags) : SH_FSI_GET_CH_I(flags);
732 data = CR_FMT(CR_TDM_D) | (fsi->chan - 1);
738 break; 733 break;
739 default: 734 default:
740 dev_err(dai->dev, "unknown format.\n"); 735 dev_err(dai->dev, "unknown format.\n");
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 3d8f31ed771d..d75c28a825f5 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -600,30 +600,32 @@ endif
600 600
601ifdef NO_DEMANGLE 601ifdef NO_DEMANGLE
602 BASIC_CFLAGS += -DNO_DEMANGLE 602 BASIC_CFLAGS += -DNO_DEMANGLE
603else ifdef HAVE_CPLUS_DEMANGLE
604 EXTLIBS += -liberty
605 BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
606else 603else
607 has_bfd := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd "$(QUIET_STDERR)" && echo y") 604 ifdef HAVE_CPLUS_DEMANGLE
608 605 EXTLIBS += -liberty
609 ifeq ($(has_bfd),y) 606 BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
610 EXTLIBS += -lbfd
611 else 607 else
612 has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty "$(QUIET_STDERR)" && echo y") 608 has_bfd := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd "$(QUIET_STDERR)" && echo y")
613 ifeq ($(has_bfd_iberty),y) 609
614 EXTLIBS += -lbfd -liberty 610 ifeq ($(has_bfd),y)
611 EXTLIBS += -lbfd
615 else 612 else
616 has_bfd_iberty_z := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty -lz "$(QUIET_STDERR)" && echo y") 613 has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty "$(QUIET_STDERR)" && echo y")
617 ifeq ($(has_bfd_iberty_z),y) 614 ifeq ($(has_bfd_iberty),y)
618 EXTLIBS += -lbfd -liberty -lz 615 EXTLIBS += -lbfd -liberty
619 else 616 else
620 has_cplus_demangle := $(shell sh -c "(echo 'extern char *cplus_demangle(const char *, int);'; echo 'int main(void) { cplus_demangle(0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -liberty "$(QUIET_STDERR)" && echo y") 617 has_bfd_iberty_z := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd -liberty -lz "$(QUIET_STDERR)" && echo y")
621 ifeq ($(has_cplus_demangle),y) 618 ifeq ($(has_bfd_iberty_z),y)
622 EXTLIBS += -liberty 619 EXTLIBS += -lbfd -liberty -lz
623 BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
624 else 620 else
625 msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling) 621 has_cplus_demangle := $(shell sh -c "(echo 'extern char *cplus_demangle(const char *, int);'; echo 'int main(void) { cplus_demangle(0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o $(BITBUCKET) $(ALL_LDFLAGS) $(EXTLIBS) -liberty "$(QUIET_STDERR)" && echo y")
626 BASIC_CFLAGS += -DNO_DEMANGLE 622 ifeq ($(has_cplus_demangle),y)
623 EXTLIBS += -liberty
624 BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
625 else
626 msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling)
627 BASIC_CFLAGS += -DNO_DEMANGLE
628 endif
627 endif 629 endif
628 endif 630 endif
629 endif 631 endif
diff --git a/tools/perf/arch/sparc/Makefile b/tools/perf/arch/sparc/Makefile
new file mode 100644
index 000000000000..15130b50dfe3
--- /dev/null
+++ b/tools/perf/arch/sparc/Makefile
@@ -0,0 +1,4 @@
1ifndef NO_DWARF
2PERF_HAVE_DWARF_REGS := 1
3LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
4endif
diff --git a/tools/perf/arch/sparc/util/dwarf-regs.c b/tools/perf/arch/sparc/util/dwarf-regs.c
new file mode 100644
index 000000000000..0ab88483720c
--- /dev/null
+++ b/tools/perf/arch/sparc/util/dwarf-regs.c
@@ -0,0 +1,43 @@
1/*
2 * Mapping of DWARF debug register numbers into register names.
3 *
4 * Copyright (C) 2010 David S. Miller <davem@davemloft.net>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#include <libio.h>
13#include <dwarf-regs.h>
14
15#define SPARC_MAX_REGS 96
16
17const char *sparc_regs_table[SPARC_MAX_REGS] = {
18 "%g0", "%g1", "%g2", "%g3", "%g4", "%g5", "%g6", "%g7",
19 "%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%sp", "%o7",
20 "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7",
21 "%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%fp", "%i7",
22 "%f0", "%f1", "%f2", "%f3", "%f4", "%f5", "%f6", "%f7",
23 "%f8", "%f9", "%f10", "%f11", "%f12", "%f13", "%f14", "%f15",
24 "%f16", "%f17", "%f18", "%f19", "%f20", "%f21", "%f22", "%f23",
25 "%f24", "%f25", "%f26", "%f27", "%f28", "%f29", "%f30", "%f31",
26 "%f32", "%f33", "%f34", "%f35", "%f36", "%f37", "%f38", "%f39",
27 "%f40", "%f41", "%f42", "%f43", "%f44", "%f45", "%f46", "%f47",
28 "%f48", "%f49", "%f50", "%f51", "%f52", "%f53", "%f54", "%f55",
29 "%f56", "%f57", "%f58", "%f59", "%f60", "%f61", "%f62", "%f63",
30};
31
32/**
33 * get_arch_regstr() - lookup register name from it's DWARF register number
34 * @n: the DWARF register number
35 *
36 * get_arch_regstr() returns the name of the register in struct
37 * regdwarfnum_table from it's DWARF register number. If the register is not
38 * found in the table, this returns NULL;
39 */
40const char *get_arch_regstr(unsigned int n)
41{
42 return (n <= SPARC_MAX_REGS) ? sparc_regs_table[n] : NULL;
43}
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 359205782964..fd7407c7205c 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -107,7 +107,7 @@ static int perf_session__add_hist_entry(struct perf_session *self,
107 goto out_free_syms; 107 goto out_free_syms;
108 err = 0; 108 err = 0;
109 if (symbol_conf.use_callchain) { 109 if (symbol_conf.use_callchain) {
110 err = append_chain(he->callchain, data->callchain, syms); 110 err = append_chain(he->callchain, data->callchain, syms, data->period);
111 if (err) 111 if (err)
112 goto out_free_syms; 112 goto out_free_syms;
113 } 113 }
diff --git a/tools/perf/util/PERF-VERSION-GEN b/tools/perf/util/PERF-VERSION-GEN
index 49ece7921914..97d76562a1a0 100755
--- a/tools/perf/util/PERF-VERSION-GEN
+++ b/tools/perf/util/PERF-VERSION-GEN
@@ -5,17 +5,13 @@ if [ $# -eq 1 ] ; then
5fi 5fi
6 6
7GVF=${OUTPUT}PERF-VERSION-FILE 7GVF=${OUTPUT}PERF-VERSION-FILE
8DEF_VER=v0.0.2.PERF
9 8
10LF=' 9LF='
11' 10'
12 11
13# First see if there is a version file (included in release tarballs), 12# First check if there is a .git to get the version from git describe
14# then try git-describe, then default. 13# otherwise try to get the version from the kernel makefile
15if test -f version 14if test -d ../../.git -o -f ../../.git &&
16then
17 VN=$(cat version) || VN="$DEF_VER"
18elif test -d .git -o -f .git &&
19 VN=$(git describe --abbrev=4 HEAD 2>/dev/null) && 15 VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
20 case "$VN" in 16 case "$VN" in
21 *$LF*) (exit 1) ;; 17 *$LF*) (exit 1) ;;
@@ -27,7 +23,12 @@ elif test -d .git -o -f .git &&
27then 23then
28 VN=$(echo "$VN" | sed -e 's/-/./g'); 24 VN=$(echo "$VN" | sed -e 's/-/./g');
29else 25else
30 VN="$DEF_VER" 26 eval `grep '^VERSION\s*=' ../../Makefile|tr -d ' '`
27 eval `grep '^PATCHLEVEL\s*=' ../../Makefile|tr -d ' '`
28 eval `grep '^SUBLEVEL\s*=' ../../Makefile|tr -d ' '`
29 eval `grep '^EXTRAVERSION\s*=' ../../Makefile|tr -d ' '`
30
31 VN="${VERSION}.${PATCHLEVEL}.${SUBLEVEL}${EXTRAVERSION}"
31fi 32fi
32 33
33VN=$(expr "$VN" : v*'\(.*\)') 34VN=$(expr "$VN" : v*'\(.*\)')
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 62b69ad4aa73..52c777e451ed 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -230,7 +230,7 @@ fill_node(struct callchain_node *node, struct resolved_chain *chain, int start)
230 230
231static void 231static void
232add_child(struct callchain_node *parent, struct resolved_chain *chain, 232add_child(struct callchain_node *parent, struct resolved_chain *chain,
233 int start) 233 int start, u64 period)
234{ 234{
235 struct callchain_node *new; 235 struct callchain_node *new;
236 236
@@ -238,7 +238,7 @@ add_child(struct callchain_node *parent, struct resolved_chain *chain,
238 fill_node(new, chain, start); 238 fill_node(new, chain, start);
239 239
240 new->children_hit = 0; 240 new->children_hit = 0;
241 new->hit = 1; 241 new->hit = period;
242} 242}
243 243
244/* 244/*
@@ -248,7 +248,8 @@ add_child(struct callchain_node *parent, struct resolved_chain *chain,
248 */ 248 */
249static void 249static void
250split_add_child(struct callchain_node *parent, struct resolved_chain *chain, 250split_add_child(struct callchain_node *parent, struct resolved_chain *chain,
251 struct callchain_list *to_split, int idx_parents, int idx_local) 251 struct callchain_list *to_split, int idx_parents, int idx_local,
252 u64 period)
252{ 253{
253 struct callchain_node *new; 254 struct callchain_node *new;
254 struct list_head *old_tail; 255 struct list_head *old_tail;
@@ -275,41 +276,41 @@ split_add_child(struct callchain_node *parent, struct resolved_chain *chain,
275 /* create a new child for the new branch if any */ 276 /* create a new child for the new branch if any */
276 if (idx_total < chain->nr) { 277 if (idx_total < chain->nr) {
277 parent->hit = 0; 278 parent->hit = 0;
278 add_child(parent, chain, idx_total); 279 add_child(parent, chain, idx_total, period);
279 parent->children_hit++; 280 parent->children_hit += period;
280 } else { 281 } else {
281 parent->hit = 1; 282 parent->hit = period;
282 } 283 }
283} 284}
284 285
285static int 286static int
286__append_chain(struct callchain_node *root, struct resolved_chain *chain, 287__append_chain(struct callchain_node *root, struct resolved_chain *chain,
287 unsigned int start); 288 unsigned int start, u64 period);
288 289
289static void 290static void
290__append_chain_children(struct callchain_node *root, 291__append_chain_children(struct callchain_node *root,
291 struct resolved_chain *chain, 292 struct resolved_chain *chain,
292 unsigned int start) 293 unsigned int start, u64 period)
293{ 294{
294 struct callchain_node *rnode; 295 struct callchain_node *rnode;
295 296
296 /* lookup in childrens */ 297 /* lookup in childrens */
297 chain_for_each_child(rnode, root) { 298 chain_for_each_child(rnode, root) {
298 unsigned int ret = __append_chain(rnode, chain, start); 299 unsigned int ret = __append_chain(rnode, chain, start, period);
299 300
300 if (!ret) 301 if (!ret)
301 goto inc_children_hit; 302 goto inc_children_hit;
302 } 303 }
303 /* nothing in children, add to the current node */ 304 /* nothing in children, add to the current node */
304 add_child(root, chain, start); 305 add_child(root, chain, start, period);
305 306
306inc_children_hit: 307inc_children_hit:
307 root->children_hit++; 308 root->children_hit += period;
308} 309}
309 310
310static int 311static int
311__append_chain(struct callchain_node *root, struct resolved_chain *chain, 312__append_chain(struct callchain_node *root, struct resolved_chain *chain,
312 unsigned int start) 313 unsigned int start, u64 period)
313{ 314{
314 struct callchain_list *cnode; 315 struct callchain_list *cnode;
315 unsigned int i = start; 316 unsigned int i = start;
@@ -345,18 +346,18 @@ __append_chain(struct callchain_node *root, struct resolved_chain *chain,
345 346
346 /* we match only a part of the node. Split it and add the new chain */ 347 /* we match only a part of the node. Split it and add the new chain */
347 if (i - start < root->val_nr) { 348 if (i - start < root->val_nr) {
348 split_add_child(root, chain, cnode, start, i - start); 349 split_add_child(root, chain, cnode, start, i - start, period);
349 return 0; 350 return 0;
350 } 351 }
351 352
352 /* we match 100% of the path, increment the hit */ 353 /* we match 100% of the path, increment the hit */
353 if (i - start == root->val_nr && i == chain->nr) { 354 if (i - start == root->val_nr && i == chain->nr) {
354 root->hit++; 355 root->hit += period;
355 return 0; 356 return 0;
356 } 357 }
357 358
358 /* We match the node and still have a part remaining */ 359 /* We match the node and still have a part remaining */
359 __append_chain_children(root, chain, i); 360 __append_chain_children(root, chain, i, period);
360 361
361 return 0; 362 return 0;
362} 363}
@@ -380,7 +381,7 @@ static void filter_context(struct ip_callchain *old, struct resolved_chain *new,
380 381
381 382
382int append_chain(struct callchain_node *root, struct ip_callchain *chain, 383int append_chain(struct callchain_node *root, struct ip_callchain *chain,
383 struct map_symbol *syms) 384 struct map_symbol *syms, u64 period)
384{ 385{
385 struct resolved_chain *filtered; 386 struct resolved_chain *filtered;
386 387
@@ -397,7 +398,7 @@ int append_chain(struct callchain_node *root, struct ip_callchain *chain,
397 if (!filtered->nr) 398 if (!filtered->nr)
398 goto end; 399 goto end;
399 400
400 __append_chain_children(root, filtered, 0); 401 __append_chain_children(root, filtered, 0, period);
401end: 402end:
402 free(filtered); 403 free(filtered);
403 404
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index 1ca73e4a2723..f2e9ee164bd8 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -49,6 +49,9 @@ static inline void callchain_init(struct callchain_node *node)
49 INIT_LIST_HEAD(&node->brothers); 49 INIT_LIST_HEAD(&node->brothers);
50 INIT_LIST_HEAD(&node->children); 50 INIT_LIST_HEAD(&node->children);
51 INIT_LIST_HEAD(&node->val); 51 INIT_LIST_HEAD(&node->val);
52
53 node->parent = NULL;
54 node->hit = 0;
52} 55}
53 56
54static inline u64 cumul_hits(struct callchain_node *node) 57static inline u64 cumul_hits(struct callchain_node *node)
@@ -58,7 +61,7 @@ static inline u64 cumul_hits(struct callchain_node *node)
58 61
59int register_callchain_param(struct callchain_param *param); 62int register_callchain_param(struct callchain_param *param);
60int append_chain(struct callchain_node *root, struct ip_callchain *chain, 63int append_chain(struct callchain_node *root, struct ip_callchain *chain,
61 struct map_symbol *syms); 64 struct map_symbol *syms, u64 period);
62 65
63bool ip_callchain__valid(struct ip_callchain *chain, event_t *event); 66bool ip_callchain__valid(struct ip_callchain *chain, event_t *event);
64#endif /* __PERF_CALLCHAIN_H */ 67#endif /* __PERF_CALLCHAIN_H */
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 07f89b66b318..784ee0bdda77 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -631,9 +631,14 @@ int hist_entry__fprintf(struct hist_entry *self, struct hists *pair_hists,
631 u64 session_total) 631 u64 session_total)
632{ 632{
633 char bf[512]; 633 char bf[512];
634 hist_entry__snprintf(self, bf, sizeof(bf), pair_hists, 634 int ret;
635 show_displacement, displacement, 635
636 true, session_total); 636 ret = hist_entry__snprintf(self, bf, sizeof(bf), pair_hists,
637 show_displacement, displacement,
638 true, session_total);
639 if (!ret)
640 return 0;
641
637 return fprintf(fp, "%s\n", bf); 642 return fprintf(fp, "%s\n", bf);
638} 643}
639 644
@@ -762,6 +767,7 @@ size_t hists__fprintf(struct hists *self, struct hists *pair,
762print_entries: 767print_entries:
763 for (nd = rb_first(&self->entries); nd; nd = rb_next(nd)) { 768 for (nd = rb_first(&self->entries); nd; nd = rb_next(nd)) {
764 struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); 769 struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
770 int cnt;
765 771
766 if (show_displacement) { 772 if (show_displacement) {
767 if (h->pair != NULL) 773 if (h->pair != NULL)
@@ -771,8 +777,13 @@ print_entries:
771 displacement = 0; 777 displacement = 0;
772 ++position; 778 ++position;
773 } 779 }
774 ret += hist_entry__fprintf(h, pair, show_displacement, 780 cnt = hist_entry__fprintf(h, pair, show_displacement,
775 displacement, fp, self->stats.total_period); 781 displacement, fp, self->stats.total_period);
782 /* Ignore those that didn't match the parent filter */
783 if (!cnt)
784 continue;
785
786 ret += cnt;
776 787
777 if (symbol_conf.use_callchain) 788 if (symbol_conf.use_callchain)
778 ret += hist_entry__fprintf_callchain(h, fp, self->stats.total_period); 789 ret += hist_entry__fprintf_callchain(h, fp, self->stats.total_period);
@@ -965,13 +976,17 @@ static int hist_entry__parse_objdump_line(struct hist_entry *self, FILE *file,
965 * Parse hexa addresses followed by ':' 976 * Parse hexa addresses followed by ':'
966 */ 977 */
967 line_ip = strtoull(tmp, &tmp2, 16); 978 line_ip = strtoull(tmp, &tmp2, 16);
968 if (*tmp2 != ':' || tmp == tmp2) 979 if (*tmp2 != ':' || tmp == tmp2 || tmp2[1] == '\0')
969 line_ip = -1; 980 line_ip = -1;
970 } 981 }
971 982
972 if (line_ip != -1) { 983 if (line_ip != -1) {
973 u64 start = map__rip_2objdump(self->ms.map, sym->start); 984 u64 start = map__rip_2objdump(self->ms.map, sym->start),
985 end = map__rip_2objdump(self->ms.map, sym->end);
986
974 offset = line_ip - start; 987 offset = line_ip - start;
988 if (offset < 0 || (u64)line_ip > end)
989 offset = -1;
975 } 990 }
976 991
977 objdump_line = objdump_line__new(offset, line); 992 objdump_line = objdump_line__new(offset, line);
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index b63e5713849f..5b276833e2bf 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1443,6 +1443,7 @@ static int map_groups__set_modules_path_dir(struct map_groups *self,
1443{ 1443{
1444 struct dirent *dent; 1444 struct dirent *dent;
1445 DIR *dir = opendir(dir_name); 1445 DIR *dir = opendir(dir_name);
1446 int ret = 0;
1446 1447
1447 if (!dir) { 1448 if (!dir) {
1448 pr_debug("%s: cannot open %s dir\n", __func__, dir_name); 1449 pr_debug("%s: cannot open %s dir\n", __func__, dir_name);
@@ -1465,8 +1466,9 @@ static int map_groups__set_modules_path_dir(struct map_groups *self,
1465 1466
1466 snprintf(path, sizeof(path), "%s/%s", 1467 snprintf(path, sizeof(path), "%s/%s",
1467 dir_name, dent->d_name); 1468 dir_name, dent->d_name);
1468 if (map_groups__set_modules_path_dir(self, path) < 0) 1469 ret = map_groups__set_modules_path_dir(self, path);
1469 goto failure; 1470 if (ret < 0)
1471 goto out;
1470 } else { 1472 } else {
1471 char *dot = strrchr(dent->d_name, '.'), 1473 char *dot = strrchr(dent->d_name, '.'),
1472 dso_name[PATH_MAX]; 1474 dso_name[PATH_MAX];
@@ -1487,17 +1489,18 @@ static int map_groups__set_modules_path_dir(struct map_groups *self,
1487 dir_name, dent->d_name); 1489 dir_name, dent->d_name);
1488 1490
1489 long_name = strdup(path); 1491 long_name = strdup(path);
1490 if (long_name == NULL) 1492 if (long_name == NULL) {
1491 goto failure; 1493 ret = -1;
1494 goto out;
1495 }
1492 dso__set_long_name(map->dso, long_name); 1496 dso__set_long_name(map->dso, long_name);
1493 dso__kernel_module_get_build_id(map->dso, ""); 1497 dso__kernel_module_get_build_id(map->dso, "");
1494 } 1498 }
1495 } 1499 }
1496 1500
1497 return 0; 1501out:
1498failure:
1499 closedir(dir); 1502 closedir(dir);
1500 return -1; 1503 return ret;
1501} 1504}
1502 1505
1503static char *get_kernel_version(const char *root_dir) 1506static char *get_kernel_version(const char *root_dir)