aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2013-03-12 05:52:22 -0400
committerDavid S. Miller <davem@davemloft.net>2013-03-12 05:52:22 -0400
commite5f2ef7ab4690d2e8faaf5fd203c5ecd70c3abaf (patch)
tree3558f68717c70a67e18c3274bb17709a353d036f
parent30129cf28a5c99f9cb7c168f0d280f147fd6cc8b (diff)
parent3da889b616164bde76a37350cf28e0d17a94e979 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts: drivers/net/ethernet/intel/e1000e/netdev.c Minor conflict in e1000e, a line that got fixed in 'net' has been removed in 'net-next'. Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--CREDITS6
-rw-r--r--Documentation/SubmittingPatches3
-rw-r--r--Documentation/hwmon/adm12752
-rw-r--r--Documentation/hwmon/adt741011
-rw-r--r--Documentation/hwmon/jc422
-rw-r--r--Documentation/hwmon/lineage-pem2
-rw-r--r--Documentation/hwmon/lm250662
-rw-r--r--Documentation/hwmon/ltc29786
-rw-r--r--Documentation/hwmon/ltc42612
-rw-r--r--Documentation/hwmon/max160642
-rw-r--r--Documentation/hwmon/max160652
-rw-r--r--Documentation/hwmon/max344402
-rw-r--r--Documentation/hwmon/max86882
-rw-r--r--Documentation/hwmon/pmbus2
-rw-r--r--Documentation/hwmon/smm6652
-rw-r--r--Documentation/hwmon/ucd90002
-rw-r--r--Documentation/hwmon/ucd92002
-rw-r--r--Documentation/hwmon/zl61002
-rw-r--r--Documentation/input/alps.txt67
-rw-r--r--Documentation/networking/tuntap.txt77
-rw-r--r--Documentation/power/opp.txt25
-rw-r--r--Documentation/printk-formats.txt2
-rw-r--r--Documentation/trace/ftrace.txt2
-rw-r--r--MAINTAINERS2
-rw-r--r--Makefile2
-rw-r--r--arch/alpha/boot/head.S1
-rw-r--r--arch/arm/boot/compressed/Makefile2
-rw-r--r--arch/arm/include/asm/mmu.h8
-rw-r--r--arch/arm/include/asm/mmu_context.h2
-rw-r--r--arch/arm/include/asm/tlbflush.h34
-rw-r--r--arch/arm/include/uapi/asm/unistd.h2
-rw-r--r--arch/arm/kernel/asm-offsets.c2
-rw-r--r--arch/arm/kernel/calls.S2
-rw-r--r--arch/arm/kernel/head.S26
-rw-r--r--arch/arm/kernel/hw_breakpoint.c2
-rw-r--r--arch/arm/kernel/perf_event.c4
-rw-r--r--arch/arm/kernel/perf_event_v7.c2
-rw-r--r--arch/arm/kernel/smp.c1
-rw-r--r--arch/arm/kernel/smp_tlb.c12
-rw-r--r--arch/arm/kernel/smp_twd.c4
-rw-r--r--arch/arm/kernel/suspend.c1
-rw-r--r--arch/arm/lib/memset.S85
-rw-r--r--arch/arm/mach-netx/generic.c2
-rw-r--r--arch/arm/mach-netx/include/mach/irqs.h64
-rw-r--r--arch/arm/mm/context.c29
-rw-r--r--arch/arm/mm/idmap.c1
-rw-r--r--arch/arm/mm/proc-v7-3level.S2
-rw-r--r--arch/ia64/kernel/perfmon.c1
-rw-r--r--arch/metag/include/asm/elf.h3
-rw-r--r--arch/metag/mm/Kconfig1
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c1
-rw-r--r--arch/s390/hypfs/inode.c1
-rw-r--r--arch/s390/include/asm/cpu_mf.h1
-rw-r--r--arch/tile/include/asm/compat.h3
-rw-r--r--arch/tile/kernel/compat.c42
-rw-r--r--arch/um/drivers/chan.h2
-rw-r--r--arch/um/drivers/chan_kern.c4
-rw-r--r--arch/um/drivers/chan_user.c12
-rw-r--r--arch/um/drivers/chan_user.h6
-rw-r--r--arch/um/drivers/line.c42
-rw-r--r--arch/um/drivers/net_kern.c2
-rw-r--r--arch/um/drivers/ssl.c1
-rw-r--r--arch/um/drivers/stdio_console.c1
-rw-r--r--arch/um/os-Linux/signal.c2
-rw-r--r--arch/um/os-Linux/start_up.c2
-rw-r--r--arch/x86/include/asm/bootparam_utils.h20
-rw-r--r--arch/x86/kernel/setup.c10
-rw-r--r--arch/x86/kernel/smpboot.c3
-rw-r--r--arch/x86/mm/init.c5
-rw-r--r--arch/x86/mm/pat.c7
-rw-r--r--drivers/acpi/glue.c55
-rw-r--r--drivers/acpi/processor_core.c3
-rw-r--r--drivers/acpi/processor_driver.c2
-rw-r--r--drivers/acpi/sleep.c16
-rw-r--r--drivers/ata/libata-acpi.c7
-rw-r--r--drivers/base/power/main.c2
-rw-r--r--drivers/base/power/power.h8
-rw-r--r--drivers/base/power/qos.c217
-rw-r--r--drivers/base/power/sysfs.c1
-rw-r--r--drivers/base/regmap/regmap-irq.c1
-rw-r--r--drivers/char/random.c12
-rw-r--r--drivers/cpufreq/cpufreq_governor.h2
-rw-r--r--drivers/cpufreq/highbank-cpufreq.c8
-rw-r--r--drivers/cpufreq/intel_pstate.c42
-rw-r--r--drivers/firmware/dmi_scan.c5
-rw-r--r--drivers/firmware/efivars.c131
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c25
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c26
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h4
-rw-r--r--drivers/gpu/drm/i915/intel_crt.c2
-rw-r--r--drivers/gpu/drm/i915/intel_ddi.c2
-rw-r--r--drivers/gpu/drm/i915/intel_display.c37
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c3
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c2
-rw-r--r--drivers/gpu/drm/mgag200/mgag200_drv.h1
-rw-r--r--drivers/gpu/drm/mgag200/mgag200_i2c.c1
-rw-r--r--drivers/gpu/drm/mgag200/mgag200_mode.c27
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nve0.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bios/init.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/i2c/base.c1
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_agp.c12
-rw-r--r--drivers/gpu/drm/nouveau/nv50_display.c173
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c6
-rw-r--r--drivers/gpu/drm/radeon/evergreen_cs.c2
-rw-r--r--drivers/gpu/drm/radeon/ni.c6
-rw-r--r--drivers/gpu/drm/radeon/r600.c6
-rw-r--r--drivers/gpu/drm/radeon/radeon_combios.c9
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.c3
-rw-r--r--drivers/gpu/drm/radeon/radeon_irq_kms.c12
-rw-r--r--drivers/gpu/drm/radeon/si.c6
-rw-r--r--drivers/gpu/drm/tegra/Kconfig1
-rw-r--r--drivers/hid/hid-logitech-dj.c22
-rw-r--r--drivers/hwmon/pmbus/ltc2978.c30
-rw-r--r--drivers/hwmon/sht15.c8
-rw-r--r--drivers/infiniband/hw/ipath/ipath_fs.c1
-rw-r--r--drivers/infiniband/hw/qib/qib_fs.c1
-rw-r--r--drivers/input/keyboard/tc3589x-keypad.c8
-rw-r--r--drivers/input/mouse/alps.c85
-rw-r--r--drivers/input/mouse/alps.h1
-rw-r--r--drivers/input/mouse/cypress_ps2.c19
-rw-r--r--drivers/input/tablet/wacom_wac.c4
-rw-r--r--drivers/input/touchscreen/ads7846.c7
-rw-r--r--drivers/input/touchscreen/atmel_mxt_ts.c68
-rw-r--r--drivers/input/touchscreen/mms114.c34
-rw-r--r--drivers/iommu/dmar.c1
-rw-r--r--drivers/isdn/i4l/isdn_tty.c4
-rw-r--r--drivers/mailbox/pl320-ipc.c3
-rw-r--r--drivers/misc/ibmasm/ibmasmfs.c1
-rw-r--r--drivers/mtd/mtdchar.c1
-rw-r--r--drivers/net/bonding/bond_main.c5
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c17
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h4
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c14
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/t4_hw.c12
-rw-r--r--drivers/net/ethernet/emulex/benet/be.h1
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.c36
-rw-r--r--drivers/net/ethernet/emulex/benet/be_hw.h4
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c10
-rw-r--r--drivers/net/ethernet/intel/e1000e/ethtool.c13
-rw-r--r--drivers/net/ethernet/intel/e1000e/ich8lan.c71
-rw-r--r--drivers/net/ethernet/intel/e1000e/ich8lan.h2
-rw-r--r--drivers/net/ethernet/intel/e1000e/netdev.c81
-rw-r--r--drivers/net/ethernet/intel/e1000e/regs.h1
-rw-r--r--drivers/net/ethernet/intel/igb/e1000_82575.c11
-rw-r--r--drivers/net/ethernet/intel/igb/igb.h2
-rw-r--r--drivers/net/ethernet/intel/igb/igb_hwmon.c14
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c76
-rw-r--r--drivers/net/ethernet/marvell/mv643xx_eth.c55
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/cq.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_netdev.c86
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/fw.c8
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mlx4.h2
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mlx4_en.h1
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mr.c10
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/pd.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/port.c8
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/qp.c8
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/resource_tracker.c3
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/srq.c2
-rw-r--r--drivers/net/hippi/rrunner.c3
-rw-r--r--drivers/net/macvlan.c1
-rw-r--r--drivers/net/team/team.c2
-rw-r--r--drivers/net/tun.c2
-rw-r--r--drivers/net/vmxnet3/vmxnet3_drv.c1
-rw-r--r--drivers/net/vmxnet3/vmxnet3_ethtool.c6
-rw-r--r--drivers/net/vmxnet3/vmxnet3_int.h4
-rw-r--r--drivers/net/vxlan.c10
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/sta.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-devtrace.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-drv.c3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-modparams.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans.h20
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/fw-api.h18
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/fw.c133
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mvm.h3
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/ops.c18
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/rx.c37
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/sta.c10
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/tx.c6
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/internal.h34
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/rx.c14
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/tx.c266
-rw-r--r--drivers/oprofile/oprofilefs.c1
-rw-r--r--drivers/pci/pci-acpi.c8
-rw-r--r--drivers/platform/x86/chromeos_laptop.c41
-rw-r--r--drivers/pnp/pnpacpi/core.c8
-rw-r--r--drivers/regulator/core.c12
-rw-r--r--drivers/regulator/db8500-prcmu.c4
-rw-r--r--drivers/regulator/palmas-regulator.c3
-rw-r--r--drivers/regulator/twl-regulator.c9
-rw-r--r--drivers/scsi/scsi_lib.c7
-rw-r--r--drivers/staging/ccg/f_fs.c1
-rw-r--r--drivers/usb/core/usb-acpi.c9
-rw-r--r--drivers/usb/gadget/f_fs.c1
-rw-r--r--drivers/usb/gadget/inode.c1
-rw-r--r--drivers/xen/xenfs/super.c1
-rw-r--r--fs/9p/vfs_super.c1
-rw-r--r--fs/adfs/super.c1
-rw-r--r--fs/affs/super.c1
-rw-r--r--fs/afs/super.c1
-rw-r--r--fs/autofs4/init.c1
-rw-r--r--fs/befs/linuxvfs.c1
-rw-r--r--fs/bfs/inode.c1
-rw-r--r--fs/binfmt_misc.c1
-rw-r--r--fs/btrfs/delayed-inode.c151
-rw-r--r--fs/btrfs/delayed-inode.h2
-rw-r--r--fs/btrfs/disk-io.c16
-rw-r--r--fs/btrfs/inode.c6
-rw-r--r--fs/btrfs/ioctl.c18
-rw-r--r--fs/btrfs/relocation.c74
-rw-r--r--fs/btrfs/super.c1
-rw-r--r--fs/btrfs/transaction.c65
-rw-r--r--fs/btrfs/tree-log.c5
-rw-r--r--fs/btrfs/volumes.c14
-rw-r--r--fs/ceph/super.c1
-rw-r--r--fs/cifs/cifssmb.c2
-rw-r--r--fs/cifs/connect.c16
-rw-r--r--fs/cifs/inode.c11
-rw-r--r--fs/cifs/smb2ops.c1
-rw-r--r--fs/coda/inode.c1
-rw-r--r--fs/configfs/mount.c1
-rw-r--r--fs/cramfs/inode.c1
-rw-r--r--fs/debugfs/inode.c1
-rw-r--r--fs/ecryptfs/Kconfig8
-rw-r--r--fs/ecryptfs/Makefile7
-rw-r--r--fs/ecryptfs/crypto.c9
-rw-r--r--fs/ecryptfs/dentry.c2
-rw-r--r--fs/ecryptfs/ecryptfs_kernel.h40
-rw-r--r--fs/ecryptfs/file.c2
-rw-r--r--fs/ecryptfs/inode.c8
-rw-r--r--fs/ecryptfs/keystore.c9
-rw-r--r--fs/ecryptfs/main.c1
-rw-r--r--fs/ecryptfs/messaging.c5
-rw-r--r--fs/efs/super.c1
-rw-r--r--fs/exofs/super.c1
-rw-r--r--fs/ext2/super.c1
-rw-r--r--fs/ext3/super.c1
-rw-r--r--fs/ext4/super.c5
-rw-r--r--fs/f2fs/super.c1
-rw-r--r--fs/fat/namei_msdos.c1
-rw-r--r--fs/fat/namei_vfat.c1
-rw-r--r--fs/filesystems.c2
-rw-r--r--fs/freevxfs/vxfs_super.c2
-rw-r--r--fs/fuse/control.c1
-rw-r--r--fs/fuse/inode.c2
-rw-r--r--fs/gfs2/ops_fstype.c4
-rw-r--r--fs/hfs/super.c1
-rw-r--r--fs/hfsplus/super.c1
-rw-r--r--fs/hostfs/hostfs_kern.c9
-rw-r--r--fs/hppfs/hppfs.c1
-rw-r--r--fs/hugetlbfs/inode.c1
-rw-r--r--fs/isofs/inode.c3
-rw-r--r--fs/jffs2/super.c1
-rw-r--r--fs/jfs/super.c1
-rw-r--r--fs/logfs/super.c1
-rw-r--r--fs/minix/inode.c1
-rw-r--r--fs/namei.c2
-rw-r--r--fs/ncpfs/inode.c1
-rw-r--r--fs/nfs/super.c3
-rw-r--r--fs/nfsd/nfsctl.c1
-rw-r--r--fs/nilfs2/super.c1
-rw-r--r--fs/ntfs/super.c1
-rw-r--r--fs/ocfs2/dlmfs/dlmfs.c1
-rw-r--r--fs/ocfs2/super.c1
-rw-r--r--fs/omfs/inode.c1
-rw-r--r--fs/openpromfs/inode.c1
-rw-r--r--fs/proc/namespaces.c12
-rw-r--r--fs/qnx4/inode.c1
-rw-r--r--fs/qnx6/inode.c1
-rw-r--r--fs/reiserfs/super.c1
-rw-r--r--fs/romfs/super.c1
-rw-r--r--fs/sysv/super.c3
-rw-r--r--fs/ubifs/super.c1
-rw-r--r--fs/ufs/super.c1
-rw-r--r--fs/xfs/xfs_super.c1
-rw-r--r--include/acpi/acpi_bus.h6
-rw-r--r--include/drm/drm_crtc.h6
-rw-r--r--include/linux/ecryptfs.h12
-rw-r--r--include/linux/fs.h2
-rw-r--r--include/linux/i2c/atmel_mxt_ts.h5
-rw-r--r--include/linux/regulator/driver.h2
-rw-r--r--ipc/msg.c6
-rw-r--r--ipc/msgutil.c3
-rw-r--r--kernel/smpboot.c2
-rw-r--r--kernel/trace/Kconfig24
-rw-r--r--kernel/trace/trace.c27
-rw-r--r--lib/idr.c16
-rw-r--r--mm/ksm.c2
-rw-r--r--mm/memcontrol.c8
-rw-r--r--mm/mempolicy.c4
-rw-r--r--net/9p/trans_virtio.c2
-rw-r--r--net/batman-adv/bat_iv_ogm.c6
-rw-r--r--net/bridge/br_device.c2
-rw-r--r--net/bridge/br_input.c2
-rw-r--r--net/bridge/br_mdb.c4
-rw-r--r--net/bridge/br_multicast.c3
-rw-r--r--net/bridge/br_netlink.c1
-rw-r--r--net/bridge/br_private.h4
-rw-r--r--net/core/dev.c5
-rw-r--r--net/core/rtnetlink.c1
-rw-r--r--net/dcb/dcbnl.c8
-rw-r--r--net/ieee802154/6lowpan.h2
-rw-r--r--net/ipv4/inet_connection_sock.c1
-rw-r--r--net/ipv4/ip_options.c7
-rw-r--r--net/ipv6/ip6_input.c3
-rw-r--r--net/irda/ircomm/ircomm_tty.c29
-rw-r--r--net/key/af_key.c8
-rw-r--r--net/mac80211/cfg.c21
-rw-r--r--net/mac80211/iface.c6
-rw-r--r--net/mac80211/mlme.c28
-rw-r--r--net/mac80211/tx.c3
-rw-r--r--net/netfilter/nf_conntrack_helper.c11
-rw-r--r--net/netfilter/nfnetlink.c7
-rw-r--r--net/netfilter/xt_AUDIT.c3
-rw-r--r--net/netlabel/netlabel_unlabeled.c27
-rw-r--r--net/rds/stats.c1
-rw-r--r--net/sched/sch_qfq.c66
-rw-r--r--net/sunrpc/rpc_pipe.c4
-rw-r--r--net/wireless/core.c3
-rw-r--r--net/wireless/nl80211.c51
-rw-r--r--security/keys/process_keys.c2
-rw-r--r--sound/core/seq/oss/seq_oss_event.c14
-rw-r--r--sound/core/vmaster.c5
-rw-r--r--sound/pci/hda/hda_codec.c11
-rw-r--r--sound/pci/hda/patch_ca0132.c8
-rw-r--r--sound/pci/hda/patch_realtek.c2
-rw-r--r--sound/pci/ice1712/ice1712.c2
-rw-r--r--sound/soc/codecs/wm5102.c15
-rw-r--r--sound/soc/codecs/wm5110.c16
-rw-r--r--sound/soc/codecs/wm8350.c4
-rw-r--r--sound/soc/codecs/wm8960.c8
-rw-r--r--sound/soc/tegra/tegra20_i2s.h2
-rw-r--r--sound/soc/tegra/tegra30_i2s.h2
-rw-r--r--tools/testing/selftests/efivarfs/efivarfs.sh59
335 files changed, 2687 insertions, 1609 deletions
diff --git a/CREDITS b/CREDITS
index 948e0fb9a70e..78163cb3eb6a 100644
--- a/CREDITS
+++ b/CREDITS
@@ -953,11 +953,11 @@ S: Blacksburg, Virginia 24061
953S: USA 953S: USA
954 954
955N: Randy Dunlap 955N: Randy Dunlap
956E: rdunlap@xenotime.net 956E: rdunlap@infradead.org
957W: http://www.xenotime.net/linux/linux.html 957W: http://www.infradead.org/~rdunlap/
958W: http://www.linux-usb.org
959D: Linux-USB subsystem, USB core/UHCI/printer/storage drivers 958D: Linux-USB subsystem, USB core/UHCI/printer/storage drivers
960D: x86 SMP, ACPI, bootflag hacking 959D: x86 SMP, ACPI, bootflag hacking
960D: documentation, builds
961S: (ask for current address) 961S: (ask for current address)
962S: USA 962S: USA
963 963
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches
index c379a2a6949f..aa0c1e63f050 100644
--- a/Documentation/SubmittingPatches
+++ b/Documentation/SubmittingPatches
@@ -60,8 +60,7 @@ own source tree. For example:
60"dontdiff" is a list of files which are generated by the kernel during 60"dontdiff" is a list of files which are generated by the kernel during
61the build process, and should be ignored in any diff(1)-generated 61the build process, and should be ignored in any diff(1)-generated
62patch. The "dontdiff" file is included in the kernel tree in 62patch. The "dontdiff" file is included in the kernel tree in
632.6.12 and later. For earlier kernel versions, you can get it 632.6.12 and later.
64from <http://www.xenotime.net/linux/doc/dontdiff>.
65 64
66Make sure your patch does not include any extra files which do not 65Make sure your patch does not include any extra files which do not
67belong in a patch submission. Make sure to review your patch -after- 66belong in a patch submission. Make sure to review your patch -after-
diff --git a/Documentation/hwmon/adm1275 b/Documentation/hwmon/adm1275
index 2cfa25667123..15b4a20d5062 100644
--- a/Documentation/hwmon/adm1275
+++ b/Documentation/hwmon/adm1275
@@ -15,7 +15,7 @@ Supported chips:
15 Addresses scanned: - 15 Addresses scanned: -
16 Datasheet: www.analog.com/static/imported-files/data_sheets/ADM1276.pdf 16 Datasheet: www.analog.com/static/imported-files/data_sheets/ADM1276.pdf
17 17
18Author: Guenter Roeck <guenter.roeck@ericsson.com> 18Author: Guenter Roeck <linux@roeck-us.net>
19 19
20 20
21Description 21Description
diff --git a/Documentation/hwmon/adt7410 b/Documentation/hwmon/adt7410
index 96004000dc2a..58150c480e56 100644
--- a/Documentation/hwmon/adt7410
+++ b/Documentation/hwmon/adt7410
@@ -4,9 +4,14 @@ Kernel driver adt7410
4Supported chips: 4Supported chips:
5 * Analog Devices ADT7410 5 * Analog Devices ADT7410
6 Prefix: 'adt7410' 6 Prefix: 'adt7410'
7 Addresses scanned: I2C 0x48 - 0x4B 7 Addresses scanned: None
8 Datasheet: Publicly available at the Analog Devices website 8 Datasheet: Publicly available at the Analog Devices website
9 http://www.analog.com/static/imported-files/data_sheets/ADT7410.pdf 9 http://www.analog.com/static/imported-files/data_sheets/ADT7410.pdf
10 * Analog Devices ADT7420
11 Prefix: 'adt7420'
12 Addresses scanned: None
13 Datasheet: Publicly available at the Analog Devices website
14 http://www.analog.com/static/imported-files/data_sheets/ADT7420.pdf
10 15
11Author: Hartmut Knaack <knaack.h@gmx.de> 16Author: Hartmut Knaack <knaack.h@gmx.de>
12 17
@@ -27,6 +32,10 @@ value per second or even justget one sample on demand for power saving.
27Besides, it can completely power down its ADC, if power management is 32Besides, it can completely power down its ADC, if power management is
28required. 33required.
29 34
35The ADT7420 is register compatible, the only differences being the package,
36a slightly narrower operating temperature range (-40°C to +150°C), and a
37better accuracy (0.25°C instead of 0.50°C.)
38
30Configuration Notes 39Configuration Notes
31------------------- 40-------------------
32 41
diff --git a/Documentation/hwmon/jc42 b/Documentation/hwmon/jc42
index 165077121238..868d74d6b773 100644
--- a/Documentation/hwmon/jc42
+++ b/Documentation/hwmon/jc42
@@ -49,7 +49,7 @@ Supported chips:
49 Addresses scanned: I2C 0x18 - 0x1f 49 Addresses scanned: I2C 0x18 - 0x1f
50 50
51Author: 51Author:
52 Guenter Roeck <guenter.roeck@ericsson.com> 52 Guenter Roeck <linux@roeck-us.net>
53 53
54 54
55Description 55Description
diff --git a/Documentation/hwmon/lineage-pem b/Documentation/hwmon/lineage-pem
index 2ba5ed126858..83b2ddc160c8 100644
--- a/Documentation/hwmon/lineage-pem
+++ b/Documentation/hwmon/lineage-pem
@@ -8,7 +8,7 @@ Supported devices:
8 Documentation: 8 Documentation:
9 http://www.lineagepower.com/oem/pdf/CPLI2C.pdf 9 http://www.lineagepower.com/oem/pdf/CPLI2C.pdf
10 10
11Author: Guenter Roeck <guenter.roeck@ericsson.com> 11Author: Guenter Roeck <linux@roeck-us.net>
12 12
13 13
14Description 14Description
diff --git a/Documentation/hwmon/lm25066 b/Documentation/hwmon/lm25066
index a21db81c4591..26025e419d35 100644
--- a/Documentation/hwmon/lm25066
+++ b/Documentation/hwmon/lm25066
@@ -19,7 +19,7 @@ Supported chips:
19 Datasheet: 19 Datasheet:
20 http://www.national.com/pf/LM/LM5066.html 20 http://www.national.com/pf/LM/LM5066.html
21 21
22Author: Guenter Roeck <guenter.roeck@ericsson.com> 22Author: Guenter Roeck <linux@roeck-us.net>
23 23
24 24
25Description 25Description
diff --git a/Documentation/hwmon/ltc2978 b/Documentation/hwmon/ltc2978
index c365f9beb5dd..e4d75c606c97 100644
--- a/Documentation/hwmon/ltc2978
+++ b/Documentation/hwmon/ltc2978
@@ -5,13 +5,13 @@ Supported chips:
5 * Linear Technology LTC2978 5 * Linear Technology LTC2978
6 Prefix: 'ltc2978' 6 Prefix: 'ltc2978'
7 Addresses scanned: - 7 Addresses scanned: -
8 Datasheet: http://cds.linear.com/docs/Datasheet/2978fa.pdf 8 Datasheet: http://www.linear.com/product/ltc2978
9 * Linear Technology LTC3880 9 * Linear Technology LTC3880
10 Prefix: 'ltc3880' 10 Prefix: 'ltc3880'
11 Addresses scanned: - 11 Addresses scanned: -
12 Datasheet: http://cds.linear.com/docs/Datasheet/3880f.pdf 12 Datasheet: http://www.linear.com/product/ltc3880
13 13
14Author: Guenter Roeck <guenter.roeck@ericsson.com> 14Author: Guenter Roeck <linux@roeck-us.net>
15 15
16 16
17Description 17Description
diff --git a/Documentation/hwmon/ltc4261 b/Documentation/hwmon/ltc4261
index eba2e2c4b94d..9378a75c6134 100644
--- a/Documentation/hwmon/ltc4261
+++ b/Documentation/hwmon/ltc4261
@@ -8,7 +8,7 @@ Supported chips:
8 Datasheet: 8 Datasheet:
9 http://cds.linear.com/docs/Datasheet/42612fb.pdf 9 http://cds.linear.com/docs/Datasheet/42612fb.pdf
10 10
11Author: Guenter Roeck <guenter.roeck@ericsson.com> 11Author: Guenter Roeck <linux@roeck-us.net>
12 12
13 13
14Description 14Description
diff --git a/Documentation/hwmon/max16064 b/Documentation/hwmon/max16064
index f8b478076f6d..d59cc7829bec 100644
--- a/Documentation/hwmon/max16064
+++ b/Documentation/hwmon/max16064
@@ -7,7 +7,7 @@ Supported chips:
7 Addresses scanned: - 7 Addresses scanned: -
8 Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX16064.pdf 8 Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX16064.pdf
9 9
10Author: Guenter Roeck <guenter.roeck@ericsson.com> 10Author: Guenter Roeck <linux@roeck-us.net>
11 11
12 12
13Description 13Description
diff --git a/Documentation/hwmon/max16065 b/Documentation/hwmon/max16065
index c11f64a1f2ad..208a29e43010 100644
--- a/Documentation/hwmon/max16065
+++ b/Documentation/hwmon/max16065
@@ -24,7 +24,7 @@ Supported chips:
24 http://datasheets.maxim-ic.com/en/ds/MAX16070-MAX16071.pdf 24 http://datasheets.maxim-ic.com/en/ds/MAX16070-MAX16071.pdf
25 25
26 26
27Author: Guenter Roeck <guenter.roeck@ericsson.com> 27Author: Guenter Roeck <linux@roeck-us.net>
28 28
29 29
30Description 30Description
diff --git a/Documentation/hwmon/max34440 b/Documentation/hwmon/max34440
index 47651ff341ae..37cbf472a19d 100644
--- a/Documentation/hwmon/max34440
+++ b/Documentation/hwmon/max34440
@@ -27,7 +27,7 @@ Supported chips:
27 Addresses scanned: - 27 Addresses scanned: -
28 Datasheet: http://datasheets.maximintegrated.com/en/ds/MAX34461.pdf 28 Datasheet: http://datasheets.maximintegrated.com/en/ds/MAX34461.pdf
29 29
30Author: Guenter Roeck <guenter.roeck@ericsson.com> 30Author: Guenter Roeck <linux@roeck-us.net>
31 31
32 32
33Description 33Description
diff --git a/Documentation/hwmon/max8688 b/Documentation/hwmon/max8688
index fe849871df32..e78078638b91 100644
--- a/Documentation/hwmon/max8688
+++ b/Documentation/hwmon/max8688
@@ -7,7 +7,7 @@ Supported chips:
7 Addresses scanned: - 7 Addresses scanned: -
8 Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX8688.pdf 8 Datasheet: http://datasheets.maxim-ic.com/en/ds/MAX8688.pdf
9 9
10Author: Guenter Roeck <guenter.roeck@ericsson.com> 10Author: Guenter Roeck <linux@roeck-us.net>
11 11
12 12
13Description 13Description
diff --git a/Documentation/hwmon/pmbus b/Documentation/hwmon/pmbus
index 3d3a0f97f966..cf756ed48ff9 100644
--- a/Documentation/hwmon/pmbus
+++ b/Documentation/hwmon/pmbus
@@ -34,7 +34,7 @@ Supported chips:
34 Addresses scanned: - 34 Addresses scanned: -
35 Datasheet: n.a. 35 Datasheet: n.a.
36 36
37Author: Guenter Roeck <guenter.roeck@ericsson.com> 37Author: Guenter Roeck <linux@roeck-us.net>
38 38
39 39
40Description 40Description
diff --git a/Documentation/hwmon/smm665 b/Documentation/hwmon/smm665
index 59e316140542..a341eeedab75 100644
--- a/Documentation/hwmon/smm665
+++ b/Documentation/hwmon/smm665
@@ -29,7 +29,7 @@ Supported chips:
29 http://www.summitmicro.com/prod_select/summary/SMM766/SMM766_2086.pdf 29 http://www.summitmicro.com/prod_select/summary/SMM766/SMM766_2086.pdf
30 http://www.summitmicro.com/prod_select/summary/SMM766B/SMM766B_2122.pdf 30 http://www.summitmicro.com/prod_select/summary/SMM766B/SMM766B_2122.pdf
31 31
32Author: Guenter Roeck <guenter.roeck@ericsson.com> 32Author: Guenter Roeck <linux@roeck-us.net>
33 33
34 34
35Module Parameters 35Module Parameters
diff --git a/Documentation/hwmon/ucd9000 b/Documentation/hwmon/ucd9000
index 0df5f276505b..805e33edb978 100644
--- a/Documentation/hwmon/ucd9000
+++ b/Documentation/hwmon/ucd9000
@@ -11,7 +11,7 @@ Supported chips:
11 http://focus.ti.com/lit/ds/symlink/ucd9090.pdf 11 http://focus.ti.com/lit/ds/symlink/ucd9090.pdf
12 http://focus.ti.com/lit/ds/symlink/ucd90910.pdf 12 http://focus.ti.com/lit/ds/symlink/ucd90910.pdf
13 13
14Author: Guenter Roeck <guenter.roeck@ericsson.com> 14Author: Guenter Roeck <linux@roeck-us.net>
15 15
16 16
17Description 17Description
diff --git a/Documentation/hwmon/ucd9200 b/Documentation/hwmon/ucd9200
index fd7d07b1908a..1e8060e631bd 100644
--- a/Documentation/hwmon/ucd9200
+++ b/Documentation/hwmon/ucd9200
@@ -15,7 +15,7 @@ Supported chips:
15 http://focus.ti.com/lit/ds/symlink/ucd9246.pdf 15 http://focus.ti.com/lit/ds/symlink/ucd9246.pdf
16 http://focus.ti.com/lit/ds/symlink/ucd9248.pdf 16 http://focus.ti.com/lit/ds/symlink/ucd9248.pdf
17 17
18Author: Guenter Roeck <guenter.roeck@ericsson.com> 18Author: Guenter Roeck <linux@roeck-us.net>
19 19
20 20
21Description 21Description
diff --git a/Documentation/hwmon/zl6100 b/Documentation/hwmon/zl6100
index 3d924b6b59e9..756b57c6b73e 100644
--- a/Documentation/hwmon/zl6100
+++ b/Documentation/hwmon/zl6100
@@ -54,7 +54,7 @@ http://archive.ericsson.net/service/internet/picov/get?DocNo=28701-EN/LZT146401
54http://archive.ericsson.net/service/internet/picov/get?DocNo=28701-EN/LZT146256 54http://archive.ericsson.net/service/internet/picov/get?DocNo=28701-EN/LZT146256
55 55
56 56
57Author: Guenter Roeck <guenter.roeck@ericsson.com> 57Author: Guenter Roeck <linux@roeck-us.net>
58 58
59 59
60Description 60Description
diff --git a/Documentation/input/alps.txt b/Documentation/input/alps.txt
index 3262b6e4d686..e544c7ff8cfa 100644
--- a/Documentation/input/alps.txt
+++ b/Documentation/input/alps.txt
@@ -3,10 +3,26 @@ ALPS Touchpad Protocol
3 3
4Introduction 4Introduction
5------------ 5------------
6 6Currently the ALPS touchpad driver supports five protocol versions in use by
7Currently the ALPS touchpad driver supports four protocol versions in use by 7ALPS touchpads, called versions 1, 2, 3, 4 and 5.
8ALPS touchpads, called versions 1, 2, 3, and 4. Information about the various 8
9protocol versions is contained in the following sections. 9Since roughly mid-2010 several new ALPS touchpads have been released and
10integrated into a variety of laptops and netbooks. These new touchpads
11have enough behavior differences that the alps_model_data definition
12table, describing the properties of the different versions, is no longer
13adequate. The design choices were to re-define the alps_model_data
14table, with the risk of regression testing existing devices, or isolate
15the new devices outside of the alps_model_data table. The latter design
16choice was made. The new touchpad signatures are named: "Rushmore",
17"Pinnacle", and "Dolphin", which you will see in the alps.c code.
18For the purposes of this document, this group of ALPS touchpads will
19generically be called "new ALPS touchpads".
20
21We experimented with probing the ACPI interface _HID (Hardware ID)/_CID
22(Compatibility ID) definition as a way to uniquely identify the
23different ALPS variants but there did not appear to be a 1:1 mapping.
24In fact, it appeared to be an m:n mapping between the _HID and actual
25hardware type.
10 26
11Detection 27Detection
12--------- 28---------
@@ -20,9 +36,13 @@ If the E6 report is successful, the touchpad model is identified using the "E7
20report" sequence: E8-E7-E7-E7-E9. The response is the model signature and is 36report" sequence: E8-E7-E7-E7-E9. The response is the model signature and is
21matched against known models in the alps_model_data_array. 37matched against known models in the alps_model_data_array.
22 38
23With protocol versions 3 and 4, the E7 report model signature is always 39For older touchpads supporting protocol versions 3 and 4, the E7 report
2473-02-64. To differentiate between these versions, the response from the 40model signature is always 73-02-64. To differentiate between these
25"Enter Command Mode" sequence must be inspected as described below. 41versions, the response from the "Enter Command Mode" sequence must be
42inspected as described below.
43
44The new ALPS touchpads have an E7 signature of 73-03-50 or 73-03-0A but
45seem to be better differentiated by the EC Command Mode response.
26 46
27Command Mode 47Command Mode
28------------ 48------------
@@ -47,6 +67,14 @@ address of the register being read, and the third contains the value of the
47register. Registers are written by writing the value one nibble at a time 67register. Registers are written by writing the value one nibble at a time
48using the same encoding used for addresses. 68using the same encoding used for addresses.
49 69
70For the new ALPS touchpads, the EC command is used to enter command
71mode. The response in the new ALPS touchpads is significantly different,
72and more important in determining the behavior. This code has been
73separated from the original alps_model_data table and put in the
74alps_identify function. For example, there seem to be two hardware init
75sequences for the "Dolphin" touchpads as determined by the second byte
76of the EC response.
77
50Packet Format 78Packet Format
51------------- 79-------------
52 80
@@ -187,3 +215,28 @@ There are several things worth noting here.
187 well. 215 well.
188 216
189So far no v4 devices with tracksticks have been encountered. 217So far no v4 devices with tracksticks have been encountered.
218
219ALPS Absolute Mode - Protocol Version 5
220---------------------------------------
221This is basically Protocol Version 3 but with different logic for packet
222decode. It uses the same alps_process_touchpad_packet_v3 call with a
223specialized decode_fields function pointer to correctly interpret the
224packets. This appears to only be used by the Dolphin devices.
225
226For single-touch, the 6-byte packet format is:
227
228 byte 0: 1 1 0 0 1 0 0 0
229 byte 1: 0 x6 x5 x4 x3 x2 x1 x0
230 byte 2: 0 y6 y5 y4 y3 y2 y1 y0
231 byte 3: 0 M R L 1 m r l
232 byte 4: y10 y9 y8 y7 x10 x9 x8 x7
233 byte 5: 0 z6 z5 z4 z3 z2 z1 z0
234
235For mt, the format is:
236
237 byte 0: 1 1 1 n3 1 n2 n1 x24
238 byte 1: 1 y7 y6 y5 y4 y3 y2 y1
239 byte 2: ? x2 x1 y12 y11 y10 y9 y8
240 byte 3: 0 x23 x22 x21 x20 x19 x18 x17
241 byte 4: 0 x9 x8 x7 x6 x5 x4 x3
242 byte 5: 0 x16 x15 x14 x13 x12 x11 x10
diff --git a/Documentation/networking/tuntap.txt b/Documentation/networking/tuntap.txt
index c0aab985bad9..949d5dcdd9a3 100644
--- a/Documentation/networking/tuntap.txt
+++ b/Documentation/networking/tuntap.txt
@@ -105,6 +105,83 @@ Copyright (C) 1999-2000 Maxim Krasnyansky <max_mk@yahoo.com>
105 Proto [2 bytes] 105 Proto [2 bytes]
106 Raw protocol(IP, IPv6, etc) frame. 106 Raw protocol(IP, IPv6, etc) frame.
107 107
108 3.3 Multiqueue tuntap interface:
109
110 From version 3.8, Linux supports multiqueue tuntap which can uses multiple
111 file descriptors (queues) to parallelize packets sending or receiving. The
112 device allocation is the same as before, and if user wants to create multiple
113 queues, TUNSETIFF with the same device name must be called many times with
114 IFF_MULTI_QUEUE flag.
115
116 char *dev should be the name of the device, queues is the number of queues to
117 be created, fds is used to store and return the file descriptors (queues)
118 created to the caller. Each file descriptor were served as the interface of a
119 queue which could be accessed by userspace.
120
121 #include <linux/if.h>
122 #include <linux/if_tun.h>
123
124 int tun_alloc_mq(char *dev, int queues, int *fds)
125 {
126 struct ifreq ifr;
127 int fd, err, i;
128
129 if (!dev)
130 return -1;
131
132 memset(&ifr, 0, sizeof(ifr));
133 /* Flags: IFF_TUN - TUN device (no Ethernet headers)
134 * IFF_TAP - TAP device
135 *
136 * IFF_NO_PI - Do not provide packet information
137 * IFF_MULTI_QUEUE - Create a queue of multiqueue device
138 */
139 ifr.ifr_flags = IFF_TAP | IFF_NO_PI | IFF_MULTI_QUEUE;
140 strcpy(ifr.ifr_name, dev);
141
142 for (i = 0; i < queues; i++) {
143 if ((fd = open("/dev/net/tun", O_RDWR)) < 0)
144 goto err;
145 err = ioctl(fd, TUNSETIFF, (void *)&ifr);
146 if (err) {
147 close(fd);
148 goto err;
149 }
150 fds[i] = fd;
151 }
152
153 return 0;
154 err:
155 for (--i; i >= 0; i--)
156 close(fds[i]);
157 return err;
158 }
159
160 A new ioctl(TUNSETQUEUE) were introduced to enable or disable a queue. When
161 calling it with IFF_DETACH_QUEUE flag, the queue were disabled. And when
162 calling it with IFF_ATTACH_QUEUE flag, the queue were enabled. The queue were
163 enabled by default after it was created through TUNSETIFF.
164
165 fd is the file descriptor (queue) that we want to enable or disable, when
166 enable is true we enable it, otherwise we disable it
167
168 #include <linux/if.h>
169 #include <linux/if_tun.h>
170
171 int tun_set_queue(int fd, int enable)
172 {
173 struct ifreq ifr;
174
175 memset(&ifr, 0, sizeof(ifr));
176
177 if (enable)
178 ifr.ifr_flags = IFF_ATTACH_QUEUE;
179 else
180 ifr.ifr_flags = IFF_DETACH_QUEUE;
181
182 return ioctl(fd, TUNSETQUEUE, (void *)&ifr);
183 }
184
108Universal TUN/TAP device driver Frequently Asked Question. 185Universal TUN/TAP device driver Frequently Asked Question.
109 186
1101. What platforms are supported by TUN/TAP driver ? 1871. What platforms are supported by TUN/TAP driver ?
diff --git a/Documentation/power/opp.txt b/Documentation/power/opp.txt
index 3035d00757ad..425c51d56aef 100644
--- a/Documentation/power/opp.txt
+++ b/Documentation/power/opp.txt
@@ -1,6 +1,5 @@
1*=============* 1Operating Performance Points (OPP) Library
2* OPP Library * 2==========================================
3*=============*
4 3
5(C) 2009-2010 Nishanth Menon <nm@ti.com>, Texas Instruments Incorporated 4(C) 2009-2010 Nishanth Menon <nm@ti.com>, Texas Instruments Incorporated
6 5
@@ -16,15 +15,31 @@ Contents
16 15
171. Introduction 161. Introduction
18=============== 17===============
181.1 What is an Operating Performance Point (OPP)?
19
19Complex SoCs of today consists of a multiple sub-modules working in conjunction. 20Complex SoCs of today consists of a multiple sub-modules working in conjunction.
20In an operational system executing varied use cases, not all modules in the SoC 21In an operational system executing varied use cases, not all modules in the SoC
21need to function at their highest performing frequency all the time. To 22need to function at their highest performing frequency all the time. To
22facilitate this, sub-modules in a SoC are grouped into domains, allowing some 23facilitate this, sub-modules in a SoC are grouped into domains, allowing some
23domains to run at lower voltage and frequency while other domains are loaded 24domains to run at lower voltage and frequency while other domains run at
24more. The set of discrete tuples consisting of frequency and voltage pairs that 25voltage/frequency pairs that are higher.
26
27The set of discrete tuples consisting of frequency and voltage pairs that
25the device will support per domain are called Operating Performance Points or 28the device will support per domain are called Operating Performance Points or
26OPPs. 29OPPs.
27 30
31As an example:
32Let us consider an MPU device which supports the following:
33{300MHz at minimum voltage of 1V}, {800MHz at minimum voltage of 1.2V},
34{1GHz at minimum voltage of 1.3V}
35
36We can represent these as three OPPs as the following {Hz, uV} tuples:
37{300000000, 1000000}
38{800000000, 1200000}
39{1000000000, 1300000}
40
411.2 Operating Performance Points Library
42
28OPP library provides a set of helper functions to organize and query the OPP 43OPP library provides a set of helper functions to organize and query the OPP
29information. The library is located in drivers/base/power/opp.c and the header 44information. The library is located in drivers/base/power/opp.c and the header
30is located in include/linux/opp.h. OPP library can be enabled by enabling 45is located in include/linux/opp.h. OPP library can be enabled by enabling
diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt
index e8a6aa473bab..6e953564de03 100644
--- a/Documentation/printk-formats.txt
+++ b/Documentation/printk-formats.txt
@@ -170,5 +170,5 @@ Reminder: sizeof() result is of type size_t.
170Thank you for your cooperation and attention. 170Thank you for your cooperation and attention.
171 171
172 172
173By Randy Dunlap <rdunlap@xenotime.net> and 173By Randy Dunlap <rdunlap@infradead.org> and
174Andrew Murray <amurray@mpc-data.co.uk> 174Andrew Murray <amurray@mpc-data.co.uk>
diff --git a/Documentation/trace/ftrace.txt b/Documentation/trace/ftrace.txt
index 53d6a3c51d87..a372304aef10 100644
--- a/Documentation/trace/ftrace.txt
+++ b/Documentation/trace/ftrace.txt
@@ -1873,7 +1873,7 @@ feature:
1873 1873
1874 status\input | 0 | 1 | else | 1874 status\input | 0 | 1 | else |
1875 --------------+------------+------------+------------+ 1875 --------------+------------+------------+------------+
1876 not allocated |(do nothing)| alloc+swap | EINVAL | 1876 not allocated |(do nothing)| alloc+swap |(do nothing)|
1877 --------------+------------+------------+------------+ 1877 --------------+------------+------------+------------+
1878 allocated | free | swap | clear | 1878 allocated | free | swap | clear |
1879 --------------+------------+------------+------------+ 1879 --------------+------------+------------+------------+
diff --git a/MAINTAINERS b/MAINTAINERS
index 95616582c728..c08411b27499 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6412,6 +6412,8 @@ F: Documentation/networking/LICENSE.qla3xxx
6412F: drivers/net/ethernet/qlogic/qla3xxx.* 6412F: drivers/net/ethernet/qlogic/qla3xxx.*
6413 6413
6414QLOGIC QLCNIC (1/10)Gb ETHERNET DRIVER 6414QLOGIC QLCNIC (1/10)Gb ETHERNET DRIVER
6415M: Rajesh Borundia <rajesh.borundia@qlogic.com>
6416M: Shahed Shaikh <shahed.shaikh@qlogic.com>
6415M: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com> 6417M: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com>
6416M: Sony Chacko <sony.chacko@qlogic.com> 6418M: Sony Chacko <sony.chacko@qlogic.com>
6417M: linux-driver@qlogic.com 6419M: linux-driver@qlogic.com
diff --git a/Makefile b/Makefile
index 5bd9f7700eb9..a05ea42c5f18 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 3 1VERSION = 3
2PATCHLEVEL = 9 2PATCHLEVEL = 9
3SUBLEVEL = 0 3SUBLEVEL = 0
4EXTRAVERSION = -rc1 4EXTRAVERSION = -rc2
5NAME = Unicycling Gorilla 5NAME = Unicycling Gorilla
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/alpha/boot/head.S b/arch/alpha/boot/head.S
index b06812bcac83..8efb26686d47 100644
--- a/arch/alpha/boot/head.S
+++ b/arch/alpha/boot/head.S
@@ -4,6 +4,7 @@
4 * initial bootloader stuff.. 4 * initial bootloader stuff..
5 */ 5 */
6 6
7#include <asm/pal.h>
7 8
8 .set noreorder 9 .set noreorder
9 .globl __start 10 .globl __start
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 5cad8a6dadb0..afed28e37ea5 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -120,7 +120,7 @@ ORIG_CFLAGS := $(KBUILD_CFLAGS)
120KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS)) 120KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS))
121endif 121endif
122 122
123ccflags-y := -fpic -fno-builtin -I$(obj) 123ccflags-y := -fpic -mno-single-pic-base -fno-builtin -I$(obj)
124asflags-y := -Wa,-march=all -DZIMAGE 124asflags-y := -Wa,-march=all -DZIMAGE
125 125
126# Supply kernel BSS size to the decompressor via a linker symbol. 126# Supply kernel BSS size to the decompressor via a linker symbol.
diff --git a/arch/arm/include/asm/mmu.h b/arch/arm/include/asm/mmu.h
index 9f77e7804f3b..e3d55547e755 100644
--- a/arch/arm/include/asm/mmu.h
+++ b/arch/arm/include/asm/mmu.h
@@ -5,15 +5,15 @@
5 5
6typedef struct { 6typedef struct {
7#ifdef CONFIG_CPU_HAS_ASID 7#ifdef CONFIG_CPU_HAS_ASID
8 u64 id; 8 atomic64_t id;
9#endif 9#endif
10 unsigned int vmalloc_seq; 10 unsigned int vmalloc_seq;
11} mm_context_t; 11} mm_context_t;
12 12
13#ifdef CONFIG_CPU_HAS_ASID 13#ifdef CONFIG_CPU_HAS_ASID
14#define ASID_BITS 8 14#define ASID_BITS 8
15#define ASID_MASK ((~0ULL) << ASID_BITS) 15#define ASID_MASK ((~0ULL) << ASID_BITS)
16#define ASID(mm) ((mm)->context.id & ~ASID_MASK) 16#define ASID(mm) ((mm)->context.id.counter & ~ASID_MASK)
17#else 17#else
18#define ASID(mm) (0) 18#define ASID(mm) (0)
19#endif 19#endif
@@ -26,7 +26,7 @@ typedef struct {
26 * modified for 2.6 by Hyok S. Choi <hyok.choi@samsung.com> 26 * modified for 2.6 by Hyok S. Choi <hyok.choi@samsung.com>
27 */ 27 */
28typedef struct { 28typedef struct {
29 unsigned long end_brk; 29 unsigned long end_brk;
30} mm_context_t; 30} mm_context_t;
31 31
32#endif 32#endif
diff --git a/arch/arm/include/asm/mmu_context.h b/arch/arm/include/asm/mmu_context.h
index e1f644bc7cc5..863a6611323c 100644
--- a/arch/arm/include/asm/mmu_context.h
+++ b/arch/arm/include/asm/mmu_context.h
@@ -25,7 +25,7 @@ void __check_vmalloc_seq(struct mm_struct *mm);
25#ifdef CONFIG_CPU_HAS_ASID 25#ifdef CONFIG_CPU_HAS_ASID
26 26
27void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk); 27void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk);
28#define init_new_context(tsk,mm) ({ mm->context.id = 0; }) 28#define init_new_context(tsk,mm) ({ atomic64_set(&mm->context.id, 0); 0; })
29 29
30#else /* !CONFIG_CPU_HAS_ASID */ 30#else /* !CONFIG_CPU_HAS_ASID */
31 31
diff --git a/arch/arm/include/asm/tlbflush.h b/arch/arm/include/asm/tlbflush.h
index 6e924d3a77eb..4db8c8820f0d 100644
--- a/arch/arm/include/asm/tlbflush.h
+++ b/arch/arm/include/asm/tlbflush.h
@@ -34,10 +34,13 @@
34#define TLB_V6_D_ASID (1 << 17) 34#define TLB_V6_D_ASID (1 << 17)
35#define TLB_V6_I_ASID (1 << 18) 35#define TLB_V6_I_ASID (1 << 18)
36 36
37#define TLB_V6_BP (1 << 19)
38
37/* Unified Inner Shareable TLB operations (ARMv7 MP extensions) */ 39/* Unified Inner Shareable TLB operations (ARMv7 MP extensions) */
38#define TLB_V7_UIS_PAGE (1 << 19) 40#define TLB_V7_UIS_PAGE (1 << 20)
39#define TLB_V7_UIS_FULL (1 << 20) 41#define TLB_V7_UIS_FULL (1 << 21)
40#define TLB_V7_UIS_ASID (1 << 21) 42#define TLB_V7_UIS_ASID (1 << 22)
43#define TLB_V7_UIS_BP (1 << 23)
41 44
42#define TLB_BARRIER (1 << 28) 45#define TLB_BARRIER (1 << 28)
43#define TLB_L2CLEAN_FR (1 << 29) /* Feroceon */ 46#define TLB_L2CLEAN_FR (1 << 29) /* Feroceon */
@@ -150,7 +153,8 @@
150#define v6wbi_tlb_flags (TLB_WB | TLB_DCLEAN | TLB_BARRIER | \ 153#define v6wbi_tlb_flags (TLB_WB | TLB_DCLEAN | TLB_BARRIER | \
151 TLB_V6_I_FULL | TLB_V6_D_FULL | \ 154 TLB_V6_I_FULL | TLB_V6_D_FULL | \
152 TLB_V6_I_PAGE | TLB_V6_D_PAGE | \ 155 TLB_V6_I_PAGE | TLB_V6_D_PAGE | \
153 TLB_V6_I_ASID | TLB_V6_D_ASID) 156 TLB_V6_I_ASID | TLB_V6_D_ASID | \
157 TLB_V6_BP)
154 158
155#ifdef CONFIG_CPU_TLB_V6 159#ifdef CONFIG_CPU_TLB_V6
156# define v6wbi_possible_flags v6wbi_tlb_flags 160# define v6wbi_possible_flags v6wbi_tlb_flags
@@ -166,9 +170,11 @@
166#endif 170#endif
167 171
168#define v7wbi_tlb_flags_smp (TLB_WB | TLB_DCLEAN | TLB_BARRIER | \ 172#define v7wbi_tlb_flags_smp (TLB_WB | TLB_DCLEAN | TLB_BARRIER | \
169 TLB_V7_UIS_FULL | TLB_V7_UIS_PAGE | TLB_V7_UIS_ASID) 173 TLB_V7_UIS_FULL | TLB_V7_UIS_PAGE | \
174 TLB_V7_UIS_ASID | TLB_V7_UIS_BP)
170#define v7wbi_tlb_flags_up (TLB_WB | TLB_DCLEAN | TLB_BARRIER | \ 175#define v7wbi_tlb_flags_up (TLB_WB | TLB_DCLEAN | TLB_BARRIER | \
171 TLB_V6_U_FULL | TLB_V6_U_PAGE | TLB_V6_U_ASID) 176 TLB_V6_U_FULL | TLB_V6_U_PAGE | \
177 TLB_V6_U_ASID | TLB_V6_BP)
172 178
173#ifdef CONFIG_CPU_TLB_V7 179#ifdef CONFIG_CPU_TLB_V7
174 180
@@ -430,6 +436,20 @@ static inline void local_flush_tlb_kernel_page(unsigned long kaddr)
430 } 436 }
431} 437}
432 438
439static inline void local_flush_bp_all(void)
440{
441 const int zero = 0;
442 const unsigned int __tlb_flag = __cpu_tlb_flags;
443
444 if (tlb_flag(TLB_V7_UIS_BP))
445 asm("mcr p15, 0, %0, c7, c1, 6" : : "r" (zero));
446 else if (tlb_flag(TLB_V6_BP))
447 asm("mcr p15, 0, %0, c7, c5, 6" : : "r" (zero));
448
449 if (tlb_flag(TLB_BARRIER))
450 isb();
451}
452
433/* 453/*
434 * flush_pmd_entry 454 * flush_pmd_entry
435 * 455 *
@@ -480,6 +500,7 @@ static inline void clean_pmd_entry(void *pmd)
480#define flush_tlb_kernel_page local_flush_tlb_kernel_page 500#define flush_tlb_kernel_page local_flush_tlb_kernel_page
481#define flush_tlb_range local_flush_tlb_range 501#define flush_tlb_range local_flush_tlb_range
482#define flush_tlb_kernel_range local_flush_tlb_kernel_range 502#define flush_tlb_kernel_range local_flush_tlb_kernel_range
503#define flush_bp_all local_flush_bp_all
483#else 504#else
484extern void flush_tlb_all(void); 505extern void flush_tlb_all(void);
485extern void flush_tlb_mm(struct mm_struct *mm); 506extern void flush_tlb_mm(struct mm_struct *mm);
@@ -487,6 +508,7 @@ extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr);
487extern void flush_tlb_kernel_page(unsigned long kaddr); 508extern void flush_tlb_kernel_page(unsigned long kaddr);
488extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, unsigned long end); 509extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, unsigned long end);
489extern void flush_tlb_kernel_range(unsigned long start, unsigned long end); 510extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
511extern void flush_bp_all(void);
490#endif 512#endif
491 513
492/* 514/*
diff --git a/arch/arm/include/uapi/asm/unistd.h b/arch/arm/include/uapi/asm/unistd.h
index 4da7cde70b5d..af33b44990ed 100644
--- a/arch/arm/include/uapi/asm/unistd.h
+++ b/arch/arm/include/uapi/asm/unistd.h
@@ -404,7 +404,7 @@
404#define __NR_setns (__NR_SYSCALL_BASE+375) 404#define __NR_setns (__NR_SYSCALL_BASE+375)
405#define __NR_process_vm_readv (__NR_SYSCALL_BASE+376) 405#define __NR_process_vm_readv (__NR_SYSCALL_BASE+376)
406#define __NR_process_vm_writev (__NR_SYSCALL_BASE+377) 406#define __NR_process_vm_writev (__NR_SYSCALL_BASE+377)
407 /* 378 for kcmp */ 407#define __NR_kcmp (__NR_SYSCALL_BASE+378)
408#define __NR_finit_module (__NR_SYSCALL_BASE+379) 408#define __NR_finit_module (__NR_SYSCALL_BASE+379)
409 409
410/* 410/*
diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c
index 5ce738b43508..923eec7105cf 100644
--- a/arch/arm/kernel/asm-offsets.c
+++ b/arch/arm/kernel/asm-offsets.c
@@ -110,7 +110,7 @@ int main(void)
110 BLANK(); 110 BLANK();
111#endif 111#endif
112#ifdef CONFIG_CPU_HAS_ASID 112#ifdef CONFIG_CPU_HAS_ASID
113 DEFINE(MM_CONTEXT_ID, offsetof(struct mm_struct, context.id)); 113 DEFINE(MM_CONTEXT_ID, offsetof(struct mm_struct, context.id.counter));
114 BLANK(); 114 BLANK();
115#endif 115#endif
116 DEFINE(VMA_VM_MM, offsetof(struct vm_area_struct, vm_mm)); 116 DEFINE(VMA_VM_MM, offsetof(struct vm_area_struct, vm_mm));
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S
index 0cc57611fc4f..c6ca7e376773 100644
--- a/arch/arm/kernel/calls.S
+++ b/arch/arm/kernel/calls.S
@@ -387,7 +387,7 @@
387/* 375 */ CALL(sys_setns) 387/* 375 */ CALL(sys_setns)
388 CALL(sys_process_vm_readv) 388 CALL(sys_process_vm_readv)
389 CALL(sys_process_vm_writev) 389 CALL(sys_process_vm_writev)
390 CALL(sys_ni_syscall) /* reserved for sys_kcmp */ 390 CALL(sys_kcmp)
391 CALL(sys_finit_module) 391 CALL(sys_finit_module)
392#ifndef syscalls_counted 392#ifndef syscalls_counted
393.equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls 393.equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 486a15ae9011..e0eb9a1cae77 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -184,13 +184,22 @@ __create_page_tables:
184 orr r3, r3, #3 @ PGD block type 184 orr r3, r3, #3 @ PGD block type
185 mov r6, #4 @ PTRS_PER_PGD 185 mov r6, #4 @ PTRS_PER_PGD
186 mov r7, #1 << (55 - 32) @ L_PGD_SWAPPER 186 mov r7, #1 << (55 - 32) @ L_PGD_SWAPPER
1871: str r3, [r0], #4 @ set bottom PGD entry bits 1871:
188#ifdef CONFIG_CPU_ENDIAN_BE8
188 str r7, [r0], #4 @ set top PGD entry bits 189 str r7, [r0], #4 @ set top PGD entry bits
190 str r3, [r0], #4 @ set bottom PGD entry bits
191#else
192 str r3, [r0], #4 @ set bottom PGD entry bits
193 str r7, [r0], #4 @ set top PGD entry bits
194#endif
189 add r3, r3, #0x1000 @ next PMD table 195 add r3, r3, #0x1000 @ next PMD table
190 subs r6, r6, #1 196 subs r6, r6, #1
191 bne 1b 197 bne 1b
192 198
193 add r4, r4, #0x1000 @ point to the PMD tables 199 add r4, r4, #0x1000 @ point to the PMD tables
200#ifdef CONFIG_CPU_ENDIAN_BE8
201 add r4, r4, #4 @ we only write the bottom word
202#endif
194#endif 203#endif
195 204
196 ldr r7, [r10, #PROCINFO_MM_MMUFLAGS] @ mm_mmuflags 205 ldr r7, [r10, #PROCINFO_MM_MMUFLAGS] @ mm_mmuflags
@@ -258,6 +267,11 @@ __create_page_tables:
258 addne r6, r6, #1 << SECTION_SHIFT 267 addne r6, r6, #1 << SECTION_SHIFT
259 strne r6, [r3] 268 strne r6, [r3]
260 269
270#if defined(CONFIG_LPAE) && defined(CONFIG_CPU_ENDIAN_BE8)
271 sub r4, r4, #4 @ Fixup page table pointer
272 @ for 64-bit descriptors
273#endif
274
261#ifdef CONFIG_DEBUG_LL 275#ifdef CONFIG_DEBUG_LL
262#if !defined(CONFIG_DEBUG_ICEDCC) && !defined(CONFIG_DEBUG_SEMIHOSTING) 276#if !defined(CONFIG_DEBUG_ICEDCC) && !defined(CONFIG_DEBUG_SEMIHOSTING)
263 /* 277 /*
@@ -276,13 +290,17 @@ __create_page_tables:
276 orr r3, r7, r3, lsl #SECTION_SHIFT 290 orr r3, r7, r3, lsl #SECTION_SHIFT
277#ifdef CONFIG_ARM_LPAE 291#ifdef CONFIG_ARM_LPAE
278 mov r7, #1 << (54 - 32) @ XN 292 mov r7, #1 << (54 - 32) @ XN
293#ifdef CONFIG_CPU_ENDIAN_BE8
294 str r7, [r0], #4
295 str r3, [r0], #4
279#else 296#else
280 orr r3, r3, #PMD_SECT_XN
281#endif
282 str r3, [r0], #4 297 str r3, [r0], #4
283#ifdef CONFIG_ARM_LPAE
284 str r7, [r0], #4 298 str r7, [r0], #4
285#endif 299#endif
300#else
301 orr r3, r3, #PMD_SECT_XN
302 str r3, [r0], #4
303#endif
286 304
287#else /* CONFIG_DEBUG_ICEDCC || CONFIG_DEBUG_SEMIHOSTING */ 305#else /* CONFIG_DEBUG_ICEDCC || CONFIG_DEBUG_SEMIHOSTING */
288 /* we don't need any serial debugging mappings */ 306 /* we don't need any serial debugging mappings */
diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c
index 5eae53e7a2e1..96093b75ab90 100644
--- a/arch/arm/kernel/hw_breakpoint.c
+++ b/arch/arm/kernel/hw_breakpoint.c
@@ -1023,7 +1023,7 @@ out_mdbgen:
1023static int __cpuinit dbg_reset_notify(struct notifier_block *self, 1023static int __cpuinit dbg_reset_notify(struct notifier_block *self,
1024 unsigned long action, void *cpu) 1024 unsigned long action, void *cpu)
1025{ 1025{
1026 if (action == CPU_ONLINE) 1026 if ((action & ~CPU_TASKS_FROZEN) == CPU_ONLINE)
1027 smp_call_function_single((int)cpu, reset_ctrl_regs, NULL, 1); 1027 smp_call_function_single((int)cpu, reset_ctrl_regs, NULL, 1);
1028 1028
1029 return NOTIFY_OK; 1029 return NOTIFY_OK;
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index 31e0eb353cd8..146157dfe27c 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -400,7 +400,7 @@ __hw_perf_event_init(struct perf_event *event)
400 } 400 }
401 401
402 if (event->group_leader != event) { 402 if (event->group_leader != event) {
403 if (validate_group(event) != 0); 403 if (validate_group(event) != 0)
404 return -EINVAL; 404 return -EINVAL;
405 } 405 }
406 406
@@ -484,7 +484,7 @@ const struct dev_pm_ops armpmu_dev_pm_ops = {
484 SET_RUNTIME_PM_OPS(armpmu_runtime_suspend, armpmu_runtime_resume, NULL) 484 SET_RUNTIME_PM_OPS(armpmu_runtime_suspend, armpmu_runtime_resume, NULL)
485}; 485};
486 486
487static void __init armpmu_init(struct arm_pmu *armpmu) 487static void armpmu_init(struct arm_pmu *armpmu)
488{ 488{
489 atomic_set(&armpmu->active_events, 0); 489 atomic_set(&armpmu->active_events, 0);
490 mutex_init(&armpmu->reserve_mutex); 490 mutex_init(&armpmu->reserve_mutex);
diff --git a/arch/arm/kernel/perf_event_v7.c b/arch/arm/kernel/perf_event_v7.c
index 8c79a9e70b83..039cffb053a7 100644
--- a/arch/arm/kernel/perf_event_v7.c
+++ b/arch/arm/kernel/perf_event_v7.c
@@ -774,7 +774,7 @@ static const unsigned armv7_a7_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
774/* 774/*
775 * PMXEVTYPER: Event selection reg 775 * PMXEVTYPER: Event selection reg
776 */ 776 */
777#define ARMV7_EVTYPE_MASK 0xc00000ff /* Mask for writable bits */ 777#define ARMV7_EVTYPE_MASK 0xc80000ff /* Mask for writable bits */
778#define ARMV7_EVTYPE_EVENT 0xff /* Mask for EVENT bits */ 778#define ARMV7_EVTYPE_EVENT 0xff /* Mask for EVENT bits */
779 779
780/* 780/*
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 1bdfd87c8e41..31644f1978d5 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -285,6 +285,7 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
285 * switch away from it before attempting any exclusive accesses. 285 * switch away from it before attempting any exclusive accesses.
286 */ 286 */
287 cpu_switch_mm(mm->pgd, mm); 287 cpu_switch_mm(mm->pgd, mm);
288 local_flush_bp_all();
288 enter_lazy_tlb(mm, current); 289 enter_lazy_tlb(mm, current);
289 local_flush_tlb_all(); 290 local_flush_tlb_all();
290 291
diff --git a/arch/arm/kernel/smp_tlb.c b/arch/arm/kernel/smp_tlb.c
index 02c5d2ce23bf..bd0300531399 100644
--- a/arch/arm/kernel/smp_tlb.c
+++ b/arch/arm/kernel/smp_tlb.c
@@ -64,6 +64,11 @@ static inline void ipi_flush_tlb_kernel_range(void *arg)
64 local_flush_tlb_kernel_range(ta->ta_start, ta->ta_end); 64 local_flush_tlb_kernel_range(ta->ta_start, ta->ta_end);
65} 65}
66 66
67static inline void ipi_flush_bp_all(void *ignored)
68{
69 local_flush_bp_all();
70}
71
67void flush_tlb_all(void) 72void flush_tlb_all(void)
68{ 73{
69 if (tlb_ops_need_broadcast()) 74 if (tlb_ops_need_broadcast())
@@ -127,3 +132,10 @@ void flush_tlb_kernel_range(unsigned long start, unsigned long end)
127 local_flush_tlb_kernel_range(start, end); 132 local_flush_tlb_kernel_range(start, end);
128} 133}
129 134
135void flush_bp_all(void)
136{
137 if (tlb_ops_need_broadcast())
138 on_each_cpu(ipi_flush_bp_all, NULL, 1);
139 else
140 local_flush_bp_all();
141}
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index c092115d903a..3f2565037480 100644
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -22,6 +22,7 @@
22#include <linux/of_irq.h> 22#include <linux/of_irq.h>
23#include <linux/of_address.h> 23#include <linux/of_address.h>
24 24
25#include <asm/smp_plat.h>
25#include <asm/smp_twd.h> 26#include <asm/smp_twd.h>
26#include <asm/localtimer.h> 27#include <asm/localtimer.h>
27 28
@@ -373,6 +374,9 @@ void __init twd_local_timer_of_register(void)
373 struct device_node *np; 374 struct device_node *np;
374 int err; 375 int err;
375 376
377 if (!is_smp() || !setup_max_cpus)
378 return;
379
376 np = of_find_matching_node(NULL, twd_of_match); 380 np = of_find_matching_node(NULL, twd_of_match);
377 if (!np) 381 if (!np)
378 return; 382 return;
diff --git a/arch/arm/kernel/suspend.c b/arch/arm/kernel/suspend.c
index 358bca3a995e..c59c97ea8268 100644
--- a/arch/arm/kernel/suspend.c
+++ b/arch/arm/kernel/suspend.c
@@ -68,6 +68,7 @@ int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
68 ret = __cpu_suspend(arg, fn); 68 ret = __cpu_suspend(arg, fn);
69 if (ret == 0) { 69 if (ret == 0) {
70 cpu_switch_mm(mm->pgd, mm); 70 cpu_switch_mm(mm->pgd, mm);
71 local_flush_bp_all();
71 local_flush_tlb_all(); 72 local_flush_tlb_all();
72 } 73 }
73 74
diff --git a/arch/arm/lib/memset.S b/arch/arm/lib/memset.S
index 650d5923ab83..d912e7397ecc 100644
--- a/arch/arm/lib/memset.S
+++ b/arch/arm/lib/memset.S
@@ -19,9 +19,9 @@
191: subs r2, r2, #4 @ 1 do we have enough 191: subs r2, r2, #4 @ 1 do we have enough
20 blt 5f @ 1 bytes to align with? 20 blt 5f @ 1 bytes to align with?
21 cmp r3, #2 @ 1 21 cmp r3, #2 @ 1
22 strltb r1, [r0], #1 @ 1 22 strltb r1, [ip], #1 @ 1
23 strleb r1, [r0], #1 @ 1 23 strleb r1, [ip], #1 @ 1
24 strb r1, [r0], #1 @ 1 24 strb r1, [ip], #1 @ 1
25 add r2, r2, r3 @ 1 (r2 = r2 - (4 - r3)) 25 add r2, r2, r3 @ 1 (r2 = r2 - (4 - r3))
26/* 26/*
27 * The pointer is now aligned and the length is adjusted. Try doing the 27 * The pointer is now aligned and the length is adjusted. Try doing the
@@ -29,10 +29,14 @@
29 */ 29 */
30 30
31ENTRY(memset) 31ENTRY(memset)
32 ands r3, r0, #3 @ 1 unaligned? 32/*
33 * Preserve the contents of r0 for the return value.
34 */
35 mov ip, r0
36 ands r3, ip, #3 @ 1 unaligned?
33 bne 1b @ 1 37 bne 1b @ 1
34/* 38/*
35 * we know that the pointer in r0 is aligned to a word boundary. 39 * we know that the pointer in ip is aligned to a word boundary.
36 */ 40 */
37 orr r1, r1, r1, lsl #8 41 orr r1, r1, r1, lsl #8
38 orr r1, r1, r1, lsl #16 42 orr r1, r1, r1, lsl #16
@@ -43,29 +47,28 @@ ENTRY(memset)
43#if ! CALGN(1)+0 47#if ! CALGN(1)+0
44 48
45/* 49/*
46 * We need an extra register for this loop - save the return address and 50 * We need 2 extra registers for this loop - use r8 and the LR
47 * use the LR
48 */ 51 */
49 str lr, [sp, #-4]! 52 stmfd sp!, {r8, lr}
50 mov ip, r1 53 mov r8, r1
51 mov lr, r1 54 mov lr, r1
52 55
532: subs r2, r2, #64 562: subs r2, r2, #64
54 stmgeia r0!, {r1, r3, ip, lr} @ 64 bytes at a time. 57 stmgeia ip!, {r1, r3, r8, lr} @ 64 bytes at a time.
55 stmgeia r0!, {r1, r3, ip, lr} 58 stmgeia ip!, {r1, r3, r8, lr}
56 stmgeia r0!, {r1, r3, ip, lr} 59 stmgeia ip!, {r1, r3, r8, lr}
57 stmgeia r0!, {r1, r3, ip, lr} 60 stmgeia ip!, {r1, r3, r8, lr}
58 bgt 2b 61 bgt 2b
59 ldmeqfd sp!, {pc} @ Now <64 bytes to go. 62 ldmeqfd sp!, {r8, pc} @ Now <64 bytes to go.
60/* 63/*
61 * No need to correct the count; we're only testing bits from now on 64 * No need to correct the count; we're only testing bits from now on
62 */ 65 */
63 tst r2, #32 66 tst r2, #32
64 stmneia r0!, {r1, r3, ip, lr} 67 stmneia ip!, {r1, r3, r8, lr}
65 stmneia r0!, {r1, r3, ip, lr} 68 stmneia ip!, {r1, r3, r8, lr}
66 tst r2, #16 69 tst r2, #16
67 stmneia r0!, {r1, r3, ip, lr} 70 stmneia ip!, {r1, r3, r8, lr}
68 ldr lr, [sp], #4 71 ldmfd sp!, {r8, lr}
69 72
70#else 73#else
71 74
@@ -74,54 +77,54 @@ ENTRY(memset)
74 * whole cache lines at once. 77 * whole cache lines at once.
75 */ 78 */
76 79
77 stmfd sp!, {r4-r7, lr} 80 stmfd sp!, {r4-r8, lr}
78 mov r4, r1 81 mov r4, r1
79 mov r5, r1 82 mov r5, r1
80 mov r6, r1 83 mov r6, r1
81 mov r7, r1 84 mov r7, r1
82 mov ip, r1 85 mov r8, r1
83 mov lr, r1 86 mov lr, r1
84 87
85 cmp r2, #96 88 cmp r2, #96
86 tstgt r0, #31 89 tstgt ip, #31
87 ble 3f 90 ble 3f
88 91
89 and ip, r0, #31 92 and r8, ip, #31
90 rsb ip, ip, #32 93 rsb r8, r8, #32
91 sub r2, r2, ip 94 sub r2, r2, r8
92 movs ip, ip, lsl #(32 - 4) 95 movs r8, r8, lsl #(32 - 4)
93 stmcsia r0!, {r4, r5, r6, r7} 96 stmcsia ip!, {r4, r5, r6, r7}
94 stmmiia r0!, {r4, r5} 97 stmmiia ip!, {r4, r5}
95 tst ip, #(1 << 30) 98 tst r8, #(1 << 30)
96 mov ip, r1 99 mov r8, r1
97 strne r1, [r0], #4 100 strne r1, [ip], #4
98 101
993: subs r2, r2, #64 1023: subs r2, r2, #64
100 stmgeia r0!, {r1, r3-r7, ip, lr} 103 stmgeia ip!, {r1, r3-r8, lr}
101 stmgeia r0!, {r1, r3-r7, ip, lr} 104 stmgeia ip!, {r1, r3-r8, lr}
102 bgt 3b 105 bgt 3b
103 ldmeqfd sp!, {r4-r7, pc} 106 ldmeqfd sp!, {r4-r8, pc}
104 107
105 tst r2, #32 108 tst r2, #32
106 stmneia r0!, {r1, r3-r7, ip, lr} 109 stmneia ip!, {r1, r3-r8, lr}
107 tst r2, #16 110 tst r2, #16
108 stmneia r0!, {r4-r7} 111 stmneia ip!, {r4-r7}
109 ldmfd sp!, {r4-r7, lr} 112 ldmfd sp!, {r4-r8, lr}
110 113
111#endif 114#endif
112 115
1134: tst r2, #8 1164: tst r2, #8
114 stmneia r0!, {r1, r3} 117 stmneia ip!, {r1, r3}
115 tst r2, #4 118 tst r2, #4
116 strne r1, [r0], #4 119 strne r1, [ip], #4
117/* 120/*
118 * When we get here, we've got less than 4 bytes to zero. We 121 * When we get here, we've got less than 4 bytes to zero. We
119 * may have an unaligned pointer as well. 122 * may have an unaligned pointer as well.
120 */ 123 */
1215: tst r2, #2 1245: tst r2, #2
122 strneb r1, [r0], #1 125 strneb r1, [ip], #1
123 strneb r1, [r0], #1 126 strneb r1, [ip], #1
124 tst r2, #1 127 tst r2, #1
125 strneb r1, [r0], #1 128 strneb r1, [ip], #1
126 mov pc, lr 129 mov pc, lr
127ENDPROC(memset) 130ENDPROC(memset)
diff --git a/arch/arm/mach-netx/generic.c b/arch/arm/mach-netx/generic.c
index 27c2cb7ab813..1504b68f4c66 100644
--- a/arch/arm/mach-netx/generic.c
+++ b/arch/arm/mach-netx/generic.c
@@ -168,7 +168,7 @@ void __init netx_init_irq(void)
168{ 168{
169 int irq; 169 int irq;
170 170
171 vic_init(io_p2v(NETX_PA_VIC), 0, ~0, 0); 171 vic_init(io_p2v(NETX_PA_VIC), NETX_IRQ_VIC_START, ~0, 0);
172 172
173 for (irq = NETX_IRQ_HIF_CHAINED(0); irq <= NETX_IRQ_HIF_LAST; irq++) { 173 for (irq = NETX_IRQ_HIF_CHAINED(0); irq <= NETX_IRQ_HIF_LAST; irq++) {
174 irq_set_chip_and_handler(irq, &netx_hif_chip, 174 irq_set_chip_and_handler(irq, &netx_hif_chip,
diff --git a/arch/arm/mach-netx/include/mach/irqs.h b/arch/arm/mach-netx/include/mach/irqs.h
index 6ce914d54a30..8f74a844a775 100644
--- a/arch/arm/mach-netx/include/mach/irqs.h
+++ b/arch/arm/mach-netx/include/mach/irqs.h
@@ -17,42 +17,42 @@
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 18 */
19 19
20#define NETX_IRQ_VIC_START 0 20#define NETX_IRQ_VIC_START 64
21#define NETX_IRQ_SOFTINT 0 21#define NETX_IRQ_SOFTINT (NETX_IRQ_VIC_START + 0)
22#define NETX_IRQ_TIMER0 1 22#define NETX_IRQ_TIMER0 (NETX_IRQ_VIC_START + 1)
23#define NETX_IRQ_TIMER1 2 23#define NETX_IRQ_TIMER1 (NETX_IRQ_VIC_START + 2)
24#define NETX_IRQ_TIMER2 3 24#define NETX_IRQ_TIMER2 (NETX_IRQ_VIC_START + 3)
25#define NETX_IRQ_SYSTIME_NS 4 25#define NETX_IRQ_SYSTIME_NS (NETX_IRQ_VIC_START + 4)
26#define NETX_IRQ_SYSTIME_S 5 26#define NETX_IRQ_SYSTIME_S (NETX_IRQ_VIC_START + 5)
27#define NETX_IRQ_GPIO_15 6 27#define NETX_IRQ_GPIO_15 (NETX_IRQ_VIC_START + 6)
28#define NETX_IRQ_WATCHDOG 7 28#define NETX_IRQ_WATCHDOG (NETX_IRQ_VIC_START + 7)
29#define NETX_IRQ_UART0 8 29#define NETX_IRQ_UART0 (NETX_IRQ_VIC_START + 8)
30#define NETX_IRQ_UART1 9 30#define NETX_IRQ_UART1 (NETX_IRQ_VIC_START + 9)
31#define NETX_IRQ_UART2 10 31#define NETX_IRQ_UART2 (NETX_IRQ_VIC_START + 10)
32#define NETX_IRQ_USB 11 32#define NETX_IRQ_USB (NETX_IRQ_VIC_START + 11)
33#define NETX_IRQ_SPI 12 33#define NETX_IRQ_SPI (NETX_IRQ_VIC_START + 12)
34#define NETX_IRQ_I2C 13 34#define NETX_IRQ_I2C (NETX_IRQ_VIC_START + 13)
35#define NETX_IRQ_LCD 14 35#define NETX_IRQ_LCD (NETX_IRQ_VIC_START + 14)
36#define NETX_IRQ_HIF 15 36#define NETX_IRQ_HIF (NETX_IRQ_VIC_START + 15)
37#define NETX_IRQ_GPIO_0_14 16 37#define NETX_IRQ_GPIO_0_14 (NETX_IRQ_VIC_START + 16)
38#define NETX_IRQ_XPEC0 17 38#define NETX_IRQ_XPEC0 (NETX_IRQ_VIC_START + 17)
39#define NETX_IRQ_XPEC1 18 39#define NETX_IRQ_XPEC1 (NETX_IRQ_VIC_START + 18)
40#define NETX_IRQ_XPEC2 19 40#define NETX_IRQ_XPEC2 (NETX_IRQ_VIC_START + 19)
41#define NETX_IRQ_XPEC3 20 41#define NETX_IRQ_XPEC3 (NETX_IRQ_VIC_START + 20)
42#define NETX_IRQ_XPEC(no) (17 + (no)) 42#define NETX_IRQ_XPEC(no) (NETX_IRQ_VIC_START + 17 + (no))
43#define NETX_IRQ_MSYNC0 21 43#define NETX_IRQ_MSYNC0 (NETX_IRQ_VIC_START + 21)
44#define NETX_IRQ_MSYNC1 22 44#define NETX_IRQ_MSYNC1 (NETX_IRQ_VIC_START + 22)
45#define NETX_IRQ_MSYNC2 23 45#define NETX_IRQ_MSYNC2 (NETX_IRQ_VIC_START + 23)
46#define NETX_IRQ_MSYNC3 24 46#define NETX_IRQ_MSYNC3 (NETX_IRQ_VIC_START + 24)
47#define NETX_IRQ_IRQ_PHY 25 47#define NETX_IRQ_IRQ_PHY (NETX_IRQ_VIC_START + 25)
48#define NETX_IRQ_ISO_AREA 26 48#define NETX_IRQ_ISO_AREA (NETX_IRQ_VIC_START + 26)
49/* int 27 is reserved */ 49/* int 27 is reserved */
50/* int 28 is reserved */ 50/* int 28 is reserved */
51#define NETX_IRQ_TIMER3 29 51#define NETX_IRQ_TIMER3 (NETX_IRQ_VIC_START + 29)
52#define NETX_IRQ_TIMER4 30 52#define NETX_IRQ_TIMER4 (NETX_IRQ_VIC_START + 30)
53/* int 31 is reserved */ 53/* int 31 is reserved */
54 54
55#define NETX_IRQS 32 55#define NETX_IRQS (NETX_IRQ_VIC_START + 32)
56 56
57/* for multiplexed irqs on gpio 0..14 */ 57/* for multiplexed irqs on gpio 0..14 */
58#define NETX_IRQ_GPIO(x) (NETX_IRQS + (x)) 58#define NETX_IRQ_GPIO(x) (NETX_IRQS + (x))
diff --git a/arch/arm/mm/context.c b/arch/arm/mm/context.c
index 7a0511191f6b..a5a4b2bc42ba 100644
--- a/arch/arm/mm/context.c
+++ b/arch/arm/mm/context.c
@@ -152,9 +152,9 @@ static int is_reserved_asid(u64 asid)
152 return 0; 152 return 0;
153} 153}
154 154
155static void new_context(struct mm_struct *mm, unsigned int cpu) 155static u64 new_context(struct mm_struct *mm, unsigned int cpu)
156{ 156{
157 u64 asid = mm->context.id; 157 u64 asid = atomic64_read(&mm->context.id);
158 u64 generation = atomic64_read(&asid_generation); 158 u64 generation = atomic64_read(&asid_generation);
159 159
160 if (asid != 0 && is_reserved_asid(asid)) { 160 if (asid != 0 && is_reserved_asid(asid)) {
@@ -181,13 +181,14 @@ static void new_context(struct mm_struct *mm, unsigned int cpu)
181 cpumask_clear(mm_cpumask(mm)); 181 cpumask_clear(mm_cpumask(mm));
182 } 182 }
183 183
184 mm->context.id = asid; 184 return asid;
185} 185}
186 186
187void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk) 187void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk)
188{ 188{
189 unsigned long flags; 189 unsigned long flags;
190 unsigned int cpu = smp_processor_id(); 190 unsigned int cpu = smp_processor_id();
191 u64 asid;
191 192
192 if (unlikely(mm->context.vmalloc_seq != init_mm.context.vmalloc_seq)) 193 if (unlikely(mm->context.vmalloc_seq != init_mm.context.vmalloc_seq))
193 __check_vmalloc_seq(mm); 194 __check_vmalloc_seq(mm);
@@ -198,20 +199,26 @@ void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk)
198 */ 199 */
199 cpu_set_reserved_ttbr0(); 200 cpu_set_reserved_ttbr0();
200 201
201 if (!((mm->context.id ^ atomic64_read(&asid_generation)) >> ASID_BITS) 202 asid = atomic64_read(&mm->context.id);
202 && atomic64_xchg(&per_cpu(active_asids, cpu), mm->context.id)) 203 if (!((asid ^ atomic64_read(&asid_generation)) >> ASID_BITS)
204 && atomic64_xchg(&per_cpu(active_asids, cpu), asid))
203 goto switch_mm_fastpath; 205 goto switch_mm_fastpath;
204 206
205 raw_spin_lock_irqsave(&cpu_asid_lock, flags); 207 raw_spin_lock_irqsave(&cpu_asid_lock, flags);
206 /* Check that our ASID belongs to the current generation. */ 208 /* Check that our ASID belongs to the current generation. */
207 if ((mm->context.id ^ atomic64_read(&asid_generation)) >> ASID_BITS) 209 asid = atomic64_read(&mm->context.id);
208 new_context(mm, cpu); 210 if ((asid ^ atomic64_read(&asid_generation)) >> ASID_BITS) {
209 211 asid = new_context(mm, cpu);
210 atomic64_set(&per_cpu(active_asids, cpu), mm->context.id); 212 atomic64_set(&mm->context.id, asid);
211 cpumask_set_cpu(cpu, mm_cpumask(mm)); 213 }
212 214
213 if (cpumask_test_and_clear_cpu(cpu, &tlb_flush_pending)) 215 if (cpumask_test_and_clear_cpu(cpu, &tlb_flush_pending)) {
216 local_flush_bp_all();
214 local_flush_tlb_all(); 217 local_flush_tlb_all();
218 }
219
220 atomic64_set(&per_cpu(active_asids, cpu), asid);
221 cpumask_set_cpu(cpu, mm_cpumask(mm));
215 raw_spin_unlock_irqrestore(&cpu_asid_lock, flags); 222 raw_spin_unlock_irqrestore(&cpu_asid_lock, flags);
216 223
217switch_mm_fastpath: 224switch_mm_fastpath:
diff --git a/arch/arm/mm/idmap.c b/arch/arm/mm/idmap.c
index 2dffc010cc41..5ee505c937d1 100644
--- a/arch/arm/mm/idmap.c
+++ b/arch/arm/mm/idmap.c
@@ -141,6 +141,7 @@ void setup_mm_for_reboot(void)
141{ 141{
142 /* Switch to the identity mapping. */ 142 /* Switch to the identity mapping. */
143 cpu_switch_mm(idmap_pgd, &init_mm); 143 cpu_switch_mm(idmap_pgd, &init_mm);
144 local_flush_bp_all();
144 145
145#ifdef CONFIG_CPU_HAS_ASID 146#ifdef CONFIG_CPU_HAS_ASID
146 /* 147 /*
diff --git a/arch/arm/mm/proc-v7-3level.S b/arch/arm/mm/proc-v7-3level.S
index 50bf1dafc9ea..6ffd78c0f9ab 100644
--- a/arch/arm/mm/proc-v7-3level.S
+++ b/arch/arm/mm/proc-v7-3level.S
@@ -48,7 +48,7 @@
48ENTRY(cpu_v7_switch_mm) 48ENTRY(cpu_v7_switch_mm)
49#ifdef CONFIG_MMU 49#ifdef CONFIG_MMU
50 mmid r1, r1 @ get mm->context.id 50 mmid r1, r1 @ get mm->context.id
51 and r3, r1, #0xff 51 asid r3, r1
52 mov r3, r3, lsl #(48 - 32) @ ASID 52 mov r3, r3, lsl #(48 - 32) @ ASID
53 mcrr p15, 0, r0, r3, c2 @ set TTB 0 53 mcrr p15, 0, r0, r3, c2 @ set TTB 0
54 isb 54 isb
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 433f5e8a2cd1..2eda28414abb 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -619,6 +619,7 @@ static struct file_system_type pfm_fs_type = {
619 .mount = pfmfs_mount, 619 .mount = pfmfs_mount,
620 .kill_sb = kill_anon_super, 620 .kill_sb = kill_anon_super,
621}; 621};
622MODULE_ALIAS_FS("pfmfs");
622 623
623DEFINE_PER_CPU(unsigned long, pfm_syst_info); 624DEFINE_PER_CPU(unsigned long, pfm_syst_info);
624DEFINE_PER_CPU(struct task_struct *, pmu_owner); 625DEFINE_PER_CPU(struct task_struct *, pmu_owner);
diff --git a/arch/metag/include/asm/elf.h b/arch/metag/include/asm/elf.h
index d63b9d0e57dd..d2baf6961794 100644
--- a/arch/metag/include/asm/elf.h
+++ b/arch/metag/include/asm/elf.h
@@ -100,9 +100,6 @@ typedef unsigned long elf_fpregset_t;
100 100
101#define ELF_PLATFORM (NULL) 101#define ELF_PLATFORM (NULL)
102 102
103#define SET_PERSONALITY(ex) \
104 set_personality(PER_LINUX | (current->personality & (~PER_MASK)))
105
106#define STACK_RND_MASK (0) 103#define STACK_RND_MASK (0)
107 104
108#ifdef CONFIG_METAG_USER_TCM 105#ifdef CONFIG_METAG_USER_TCM
diff --git a/arch/metag/mm/Kconfig b/arch/metag/mm/Kconfig
index cd7f2f2ad416..975f2f4e3ecf 100644
--- a/arch/metag/mm/Kconfig
+++ b/arch/metag/mm/Kconfig
@@ -40,6 +40,7 @@ endchoice
40 40
41config NUMA 41config NUMA
42 bool "Non Uniform Memory Access (NUMA) Support" 42 bool "Non Uniform Memory Access (NUMA) Support"
43 select ARCH_WANT_NUMA_VARIABLE_LOCALITY
43 help 44 help
44 Some Meta systems have MMU-mappable on-chip memories with 45 Some Meta systems have MMU-mappable on-chip memories with
45 lower latencies than main memory. This enables support for 46 lower latencies than main memory. This enables support for
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 863184b182f4..3f3bb4cdbbec 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -749,6 +749,7 @@ static struct file_system_type spufs_type = {
749 .mount = spufs_mount, 749 .mount = spufs_mount,
750 .kill_sb = kill_litter_super, 750 .kill_sb = kill_litter_super,
751}; 751};
752MODULE_ALIAS_FS("spufs");
752 753
753static int __init spufs_init(void) 754static int __init spufs_init(void)
754{ 755{
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index 8538015ed4a0..5f7d7ba2874c 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -456,6 +456,7 @@ static struct file_system_type hypfs_type = {
456 .mount = hypfs_mount, 456 .mount = hypfs_mount,
457 .kill_sb = hypfs_kill_super 457 .kill_sb = hypfs_kill_super
458}; 458};
459MODULE_ALIAS_FS("s390_hypfs");
459 460
460static const struct super_operations hypfs_s_ops = { 461static const struct super_operations hypfs_s_ops = {
461 .statfs = simple_statfs, 462 .statfs = simple_statfs,
diff --git a/arch/s390/include/asm/cpu_mf.h b/arch/s390/include/asm/cpu_mf.h
index f1eddd150dd7..c879fad404c8 100644
--- a/arch/s390/include/asm/cpu_mf.h
+++ b/arch/s390/include/asm/cpu_mf.h
@@ -12,6 +12,7 @@
12#ifndef _ASM_S390_CPU_MF_H 12#ifndef _ASM_S390_CPU_MF_H
13#define _ASM_S390_CPU_MF_H 13#define _ASM_S390_CPU_MF_H
14 14
15#include <linux/errno.h>
15#include <asm/facility.h> 16#include <asm/facility.h>
16 17
17#define CPU_MF_INT_SF_IAE (1 << 31) /* invalid entry address */ 18#define CPU_MF_INT_SF_IAE (1 << 31) /* invalid entry address */
diff --git a/arch/tile/include/asm/compat.h b/arch/tile/include/asm/compat.h
index 001d418a8957..78f1f2ded86c 100644
--- a/arch/tile/include/asm/compat.h
+++ b/arch/tile/include/asm/compat.h
@@ -288,6 +288,9 @@ long compat_sys_sync_file_range2(int fd, unsigned int flags,
288long compat_sys_fallocate(int fd, int mode, 288long compat_sys_fallocate(int fd, int mode,
289 u32 offset_lo, u32 offset_hi, 289 u32 offset_lo, u32 offset_hi,
290 u32 len_lo, u32 len_hi); 290 u32 len_lo, u32 len_hi);
291long compat_sys_llseek(unsigned int fd, unsigned int offset_high,
292 unsigned int offset_low, loff_t __user * result,
293 unsigned int origin);
291 294
292/* Assembly trampoline to avoid clobbering r0. */ 295/* Assembly trampoline to avoid clobbering r0. */
293long _compat_sys_rt_sigreturn(void); 296long _compat_sys_rt_sigreturn(void);
diff --git a/arch/tile/kernel/compat.c b/arch/tile/kernel/compat.c
index 7f72401b4f45..6ea4cdb3c6a0 100644
--- a/arch/tile/kernel/compat.c
+++ b/arch/tile/kernel/compat.c
@@ -32,50 +32,65 @@
32 * adapt the usual convention. 32 * adapt the usual convention.
33 */ 33 */
34 34
35long compat_sys_truncate64(char __user *filename, u32 dummy, u32 low, u32 high) 35COMPAT_SYSCALL_DEFINE4(truncate64, char __user *, filename, u32, dummy,
36 u32, low, u32, high)
36{ 37{
37 return sys_truncate(filename, ((loff_t)high << 32) | low); 38 return sys_truncate(filename, ((loff_t)high << 32) | low);
38} 39}
39 40
40long compat_sys_ftruncate64(unsigned int fd, u32 dummy, u32 low, u32 high) 41COMPAT_SYSCALL_DEFINE4(ftruncate64, unsigned int, fd, u32, dummy,
42 u32, low, u32, high)
41{ 43{
42 return sys_ftruncate(fd, ((loff_t)high << 32) | low); 44 return sys_ftruncate(fd, ((loff_t)high << 32) | low);
43} 45}
44 46
45long compat_sys_pread64(unsigned int fd, char __user *ubuf, size_t count, 47COMPAT_SYSCALL_DEFINE6(pread64, unsigned int, fd, char __user *, ubuf,
46 u32 dummy, u32 low, u32 high) 48 size_t, count, u32, dummy, u32, low, u32, high)
47{ 49{
48 return sys_pread64(fd, ubuf, count, ((loff_t)high << 32) | low); 50 return sys_pread64(fd, ubuf, count, ((loff_t)high << 32) | low);
49} 51}
50 52
51long compat_sys_pwrite64(unsigned int fd, char __user *ubuf, size_t count, 53COMPAT_SYSCALL_DEFINE6(pwrite64, unsigned int, fd, char __user *, ubuf,
52 u32 dummy, u32 low, u32 high) 54 size_t, count, u32, dummy, u32, low, u32, high)
53{ 55{
54 return sys_pwrite64(fd, ubuf, count, ((loff_t)high << 32) | low); 56 return sys_pwrite64(fd, ubuf, count, ((loff_t)high << 32) | low);
55} 57}
56 58
57long compat_sys_lookup_dcookie(u32 low, u32 high, char __user *buf, size_t len) 59COMPAT_SYSCALL_DEFINE4(lookup_dcookie, u32, low, u32, high,
60 char __user *, buf, size_t, len)
58{ 61{
59 return sys_lookup_dcookie(((loff_t)high << 32) | low, buf, len); 62 return sys_lookup_dcookie(((loff_t)high << 32) | low, buf, len);
60} 63}
61 64
62long compat_sys_sync_file_range2(int fd, unsigned int flags, 65COMPAT_SYSCALL_DEFINE6(sync_file_range2, int, fd, unsigned int, flags,
63 u32 offset_lo, u32 offset_hi, 66 u32, offset_lo, u32, offset_hi,
64 u32 nbytes_lo, u32 nbytes_hi) 67 u32, nbytes_lo, u32, nbytes_hi)
65{ 68{
66 return sys_sync_file_range(fd, ((loff_t)offset_hi << 32) | offset_lo, 69 return sys_sync_file_range(fd, ((loff_t)offset_hi << 32) | offset_lo,
67 ((loff_t)nbytes_hi << 32) | nbytes_lo, 70 ((loff_t)nbytes_hi << 32) | nbytes_lo,
68 flags); 71 flags);
69} 72}
70 73
71long compat_sys_fallocate(int fd, int mode, 74COMPAT_SYSCALL_DEFINE6(fallocate, int, fd, int, mode,
72 u32 offset_lo, u32 offset_hi, 75 u32, offset_lo, u32, offset_hi,
73 u32 len_lo, u32 len_hi) 76 u32, len_lo, u32, len_hi)
74{ 77{
75 return sys_fallocate(fd, mode, ((loff_t)offset_hi << 32) | offset_lo, 78 return sys_fallocate(fd, mode, ((loff_t)offset_hi << 32) | offset_lo,
76 ((loff_t)len_hi << 32) | len_lo); 79 ((loff_t)len_hi << 32) | len_lo);
77} 80}
78 81
82/*
83 * Avoid bug in generic sys_llseek() that specifies offset_high and
84 * offset_low as "unsigned long", thus making it possible to pass
85 * a sign-extended high 32 bits in offset_low.
86 */
87COMPAT_SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned int, offset_high,
88 unsigned int, offset_low, loff_t __user *, result,
89 unsigned int, origin)
90{
91 return sys_llseek(fd, offset_high, offset_low, result, origin);
92}
93
79/* Provide the compat syscall number to call mapping. */ 94/* Provide the compat syscall number to call mapping. */
80#undef __SYSCALL 95#undef __SYSCALL
81#define __SYSCALL(nr, call) [nr] = (call), 96#define __SYSCALL(nr, call) [nr] = (call),
@@ -83,6 +98,7 @@ long compat_sys_fallocate(int fd, int mode,
83/* See comments in sys.c */ 98/* See comments in sys.c */
84#define compat_sys_fadvise64_64 sys32_fadvise64_64 99#define compat_sys_fadvise64_64 sys32_fadvise64_64
85#define compat_sys_readahead sys32_readahead 100#define compat_sys_readahead sys32_readahead
101#define sys_llseek compat_sys_llseek
86 102
87/* Call the assembly trampolines where necessary. */ 103/* Call the assembly trampolines where necessary. */
88#define compat_sys_rt_sigreturn _compat_sys_rt_sigreturn 104#define compat_sys_rt_sigreturn _compat_sys_rt_sigreturn
diff --git a/arch/um/drivers/chan.h b/arch/um/drivers/chan.h
index 78f1b8999964..c512b0306dd4 100644
--- a/arch/um/drivers/chan.h
+++ b/arch/um/drivers/chan.h
@@ -37,7 +37,7 @@ extern int console_write_chan(struct chan *chan, const char *buf,
37extern int console_open_chan(struct line *line, struct console *co); 37extern int console_open_chan(struct line *line, struct console *co);
38extern void deactivate_chan(struct chan *chan, int irq); 38extern void deactivate_chan(struct chan *chan, int irq);
39extern void reactivate_chan(struct chan *chan, int irq); 39extern void reactivate_chan(struct chan *chan, int irq);
40extern void chan_enable_winch(struct chan *chan, struct tty_struct *tty); 40extern void chan_enable_winch(struct chan *chan, struct tty_port *port);
41extern int enable_chan(struct line *line); 41extern int enable_chan(struct line *line);
42extern void close_chan(struct line *line); 42extern void close_chan(struct line *line);
43extern int chan_window_size(struct line *line, 43extern int chan_window_size(struct line *line,
diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c
index 15c553c239a1..80b47cb71e0a 100644
--- a/arch/um/drivers/chan_kern.c
+++ b/arch/um/drivers/chan_kern.c
@@ -122,10 +122,10 @@ static int open_chan(struct list_head *chans)
122 return err; 122 return err;
123} 123}
124 124
125void chan_enable_winch(struct chan *chan, struct tty_struct *tty) 125void chan_enable_winch(struct chan *chan, struct tty_port *port)
126{ 126{
127 if (chan && chan->primary && chan->ops->winch) 127 if (chan && chan->primary && chan->ops->winch)
128 register_winch(chan->fd, tty); 128 register_winch(chan->fd, port);
129} 129}
130 130
131static void line_timer_cb(struct work_struct *work) 131static void line_timer_cb(struct work_struct *work)
diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c
index 9be670ad23b5..3fd7c3efdb18 100644
--- a/arch/um/drivers/chan_user.c
+++ b/arch/um/drivers/chan_user.c
@@ -216,7 +216,7 @@ static int winch_thread(void *arg)
216 } 216 }
217} 217}
218 218
219static int winch_tramp(int fd, struct tty_struct *tty, int *fd_out, 219static int winch_tramp(int fd, struct tty_port *port, int *fd_out,
220 unsigned long *stack_out) 220 unsigned long *stack_out)
221{ 221{
222 struct winch_data data; 222 struct winch_data data;
@@ -271,7 +271,7 @@ static int winch_tramp(int fd, struct tty_struct *tty, int *fd_out,
271 return err; 271 return err;
272} 272}
273 273
274void register_winch(int fd, struct tty_struct *tty) 274void register_winch(int fd, struct tty_port *port)
275{ 275{
276 unsigned long stack; 276 unsigned long stack;
277 int pid, thread, count, thread_fd = -1; 277 int pid, thread, count, thread_fd = -1;
@@ -281,17 +281,17 @@ void register_winch(int fd, struct tty_struct *tty)
281 return; 281 return;
282 282
283 pid = tcgetpgrp(fd); 283 pid = tcgetpgrp(fd);
284 if (is_skas_winch(pid, fd, tty)) { 284 if (is_skas_winch(pid, fd, port)) {
285 register_winch_irq(-1, fd, -1, tty, 0); 285 register_winch_irq(-1, fd, -1, port, 0);
286 return; 286 return;
287 } 287 }
288 288
289 if (pid == -1) { 289 if (pid == -1) {
290 thread = winch_tramp(fd, tty, &thread_fd, &stack); 290 thread = winch_tramp(fd, port, &thread_fd, &stack);
291 if (thread < 0) 291 if (thread < 0)
292 return; 292 return;
293 293
294 register_winch_irq(thread_fd, fd, thread, tty, stack); 294 register_winch_irq(thread_fd, fd, thread, port, stack);
295 295
296 count = write(thread_fd, &c, sizeof(c)); 296 count = write(thread_fd, &c, sizeof(c));
297 if (count != sizeof(c)) 297 if (count != sizeof(c))
diff --git a/arch/um/drivers/chan_user.h b/arch/um/drivers/chan_user.h
index dc693298eb8f..03f1b565c5f9 100644
--- a/arch/um/drivers/chan_user.h
+++ b/arch/um/drivers/chan_user.h
@@ -38,10 +38,10 @@ extern int generic_window_size(int fd, void *unused, unsigned short *rows_out,
38 unsigned short *cols_out); 38 unsigned short *cols_out);
39extern void generic_free(void *data); 39extern void generic_free(void *data);
40 40
41struct tty_struct; 41struct tty_port;
42extern void register_winch(int fd, struct tty_struct *tty); 42extern void register_winch(int fd, struct tty_port *port);
43extern void register_winch_irq(int fd, int tty_fd, int pid, 43extern void register_winch_irq(int fd, int tty_fd, int pid,
44 struct tty_struct *tty, unsigned long stack); 44 struct tty_port *port, unsigned long stack);
45 45
46#define __channel_help(fn, prefix) \ 46#define __channel_help(fn, prefix) \
47__uml_help(fn, prefix "[0-9]*=<channel description>\n" \ 47__uml_help(fn, prefix "[0-9]*=<channel description>\n" \
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index f1b38571f94e..be541cf69fd2 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -305,7 +305,7 @@ static int line_activate(struct tty_port *port, struct tty_struct *tty)
305 return ret; 305 return ret;
306 306
307 if (!line->sigio) { 307 if (!line->sigio) {
308 chan_enable_winch(line->chan_out, tty); 308 chan_enable_winch(line->chan_out, port);
309 line->sigio = 1; 309 line->sigio = 1;
310 } 310 }
311 311
@@ -315,8 +315,22 @@ static int line_activate(struct tty_port *port, struct tty_struct *tty)
315 return 0; 315 return 0;
316} 316}
317 317
318static void unregister_winch(struct tty_struct *tty);
319
320static void line_destruct(struct tty_port *port)
321{
322 struct tty_struct *tty = tty_port_tty_get(port);
323 struct line *line = tty->driver_data;
324
325 if (line->sigio) {
326 unregister_winch(tty);
327 line->sigio = 0;
328 }
329}
330
318static const struct tty_port_operations line_port_ops = { 331static const struct tty_port_operations line_port_ops = {
319 .activate = line_activate, 332 .activate = line_activate,
333 .destruct = line_destruct,
320}; 334};
321 335
322int line_open(struct tty_struct *tty, struct file *filp) 336int line_open(struct tty_struct *tty, struct file *filp)
@@ -340,18 +354,6 @@ int line_install(struct tty_driver *driver, struct tty_struct *tty,
340 return 0; 354 return 0;
341} 355}
342 356
343static void unregister_winch(struct tty_struct *tty);
344
345void line_cleanup(struct tty_struct *tty)
346{
347 struct line *line = tty->driver_data;
348
349 if (line->sigio) {
350 unregister_winch(tty);
351 line->sigio = 0;
352 }
353}
354
355void line_close(struct tty_struct *tty, struct file * filp) 357void line_close(struct tty_struct *tty, struct file * filp)
356{ 358{
357 struct line *line = tty->driver_data; 359 struct line *line = tty->driver_data;
@@ -601,7 +603,7 @@ struct winch {
601 int fd; 603 int fd;
602 int tty_fd; 604 int tty_fd;
603 int pid; 605 int pid;
604 struct tty_struct *tty; 606 struct tty_port *port;
605 unsigned long stack; 607 unsigned long stack;
606 struct work_struct work; 608 struct work_struct work;
607}; 609};
@@ -655,7 +657,7 @@ static irqreturn_t winch_interrupt(int irq, void *data)
655 goto out; 657 goto out;
656 } 658 }
657 } 659 }
658 tty = winch->tty; 660 tty = tty_port_tty_get(winch->port);
659 if (tty != NULL) { 661 if (tty != NULL) {
660 line = tty->driver_data; 662 line = tty->driver_data;
661 if (line != NULL) { 663 if (line != NULL) {
@@ -663,6 +665,7 @@ static irqreturn_t winch_interrupt(int irq, void *data)
663 &tty->winsize.ws_col); 665 &tty->winsize.ws_col);
664 kill_pgrp(tty->pgrp, SIGWINCH, 1); 666 kill_pgrp(tty->pgrp, SIGWINCH, 1);
665 } 667 }
668 tty_kref_put(tty);
666 } 669 }
667 out: 670 out:
668 if (winch->fd != -1) 671 if (winch->fd != -1)
@@ -670,7 +673,7 @@ static irqreturn_t winch_interrupt(int irq, void *data)
670 return IRQ_HANDLED; 673 return IRQ_HANDLED;
671} 674}
672 675
673void register_winch_irq(int fd, int tty_fd, int pid, struct tty_struct *tty, 676void register_winch_irq(int fd, int tty_fd, int pid, struct tty_port *port,
674 unsigned long stack) 677 unsigned long stack)
675{ 678{
676 struct winch *winch; 679 struct winch *winch;
@@ -685,7 +688,7 @@ void register_winch_irq(int fd, int tty_fd, int pid, struct tty_struct *tty,
685 .fd = fd, 688 .fd = fd,
686 .tty_fd = tty_fd, 689 .tty_fd = tty_fd,
687 .pid = pid, 690 .pid = pid,
688 .tty = tty, 691 .port = port,
689 .stack = stack }); 692 .stack = stack });
690 693
691 if (um_request_irq(WINCH_IRQ, fd, IRQ_READ, winch_interrupt, 694 if (um_request_irq(WINCH_IRQ, fd, IRQ_READ, winch_interrupt,
@@ -714,15 +717,18 @@ static void unregister_winch(struct tty_struct *tty)
714{ 717{
715 struct list_head *ele, *next; 718 struct list_head *ele, *next;
716 struct winch *winch; 719 struct winch *winch;
720 struct tty_struct *wtty;
717 721
718 spin_lock(&winch_handler_lock); 722 spin_lock(&winch_handler_lock);
719 723
720 list_for_each_safe(ele, next, &winch_handlers) { 724 list_for_each_safe(ele, next, &winch_handlers) {
721 winch = list_entry(ele, struct winch, list); 725 winch = list_entry(ele, struct winch, list);
722 if (winch->tty == tty) { 726 wtty = tty_port_tty_get(winch->port);
727 if (wtty == tty) {
723 free_winch(winch); 728 free_winch(winch);
724 break; 729 break;
725 } 730 }
731 tty_kref_put(wtty);
726 } 732 }
727 spin_unlock(&winch_handler_lock); 733 spin_unlock(&winch_handler_lock);
728} 734}
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index d8926c303629..39f186252e02 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -218,6 +218,7 @@ static int uml_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
218 spin_lock_irqsave(&lp->lock, flags); 218 spin_lock_irqsave(&lp->lock, flags);
219 219
220 len = (*lp->write)(lp->fd, skb, lp); 220 len = (*lp->write)(lp->fd, skb, lp);
221 skb_tx_timestamp(skb);
221 222
222 if (len == skb->len) { 223 if (len == skb->len) {
223 dev->stats.tx_packets++; 224 dev->stats.tx_packets++;
@@ -281,6 +282,7 @@ static void uml_net_get_drvinfo(struct net_device *dev,
281static const struct ethtool_ops uml_net_ethtool_ops = { 282static const struct ethtool_ops uml_net_ethtool_ops = {
282 .get_drvinfo = uml_net_get_drvinfo, 283 .get_drvinfo = uml_net_get_drvinfo,
283 .get_link = ethtool_op_get_link, 284 .get_link = ethtool_op_get_link,
285 .get_ts_info = ethtool_op_get_ts_info,
284}; 286};
285 287
286static void uml_net_user_timer_expire(unsigned long _conn) 288static void uml_net_user_timer_expire(unsigned long _conn)
diff --git a/arch/um/drivers/ssl.c b/arch/um/drivers/ssl.c
index 16fdd0a0f9d6..b8d14fa52059 100644
--- a/arch/um/drivers/ssl.c
+++ b/arch/um/drivers/ssl.c
@@ -105,7 +105,6 @@ static const struct tty_operations ssl_ops = {
105 .throttle = line_throttle, 105 .throttle = line_throttle,
106 .unthrottle = line_unthrottle, 106 .unthrottle = line_unthrottle,
107 .install = ssl_install, 107 .install = ssl_install,
108 .cleanup = line_cleanup,
109 .hangup = line_hangup, 108 .hangup = line_hangup,
110}; 109};
111 110
diff --git a/arch/um/drivers/stdio_console.c b/arch/um/drivers/stdio_console.c
index 827777af3f6d..7b361f36ca96 100644
--- a/arch/um/drivers/stdio_console.c
+++ b/arch/um/drivers/stdio_console.c
@@ -110,7 +110,6 @@ static const struct tty_operations console_ops = {
110 .set_termios = line_set_termios, 110 .set_termios = line_set_termios,
111 .throttle = line_throttle, 111 .throttle = line_throttle,
112 .unthrottle = line_unthrottle, 112 .unthrottle = line_unthrottle,
113 .cleanup = line_cleanup,
114 .hangup = line_hangup, 113 .hangup = line_hangup,
115}; 114};
116 115
diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c
index b1469fe93295..9d9f1b4bf826 100644
--- a/arch/um/os-Linux/signal.c
+++ b/arch/um/os-Linux/signal.c
@@ -15,7 +15,7 @@
15#include <sysdep/mcontext.h> 15#include <sysdep/mcontext.h>
16#include "internal.h" 16#include "internal.h"
17 17
18void (*sig_info[NSIG])(int, siginfo_t *, struct uml_pt_regs *) = { 18void (*sig_info[NSIG])(int, struct siginfo *, struct uml_pt_regs *) = {
19 [SIGTRAP] = relay_signal, 19 [SIGTRAP] = relay_signal,
20 [SIGFPE] = relay_signal, 20 [SIGFPE] = relay_signal,
21 [SIGILL] = relay_signal, 21 [SIGILL] = relay_signal,
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c
index da4b9e9999fd..337518c5042a 100644
--- a/arch/um/os-Linux/start_up.c
+++ b/arch/um/os-Linux/start_up.c
@@ -15,6 +15,8 @@
15#include <sys/mman.h> 15#include <sys/mman.h>
16#include <sys/stat.h> 16#include <sys/stat.h>
17#include <sys/wait.h> 17#include <sys/wait.h>
18#include <sys/time.h>
19#include <sys/resource.h>
18#include <asm/unistd.h> 20#include <asm/unistd.h>
19#include <init.h> 21#include <init.h>
20#include <os.h> 22#include <os.h>
diff --git a/arch/x86/include/asm/bootparam_utils.h b/arch/x86/include/asm/bootparam_utils.h
index 5b5e9cb774b5..653668d140f9 100644
--- a/arch/x86/include/asm/bootparam_utils.h
+++ b/arch/x86/include/asm/bootparam_utils.h
@@ -14,13 +14,29 @@
14 * analysis of kexec-tools; if other broken bootloaders initialize a 14 * analysis of kexec-tools; if other broken bootloaders initialize a
15 * different set of fields we will need to figure out how to disambiguate. 15 * different set of fields we will need to figure out how to disambiguate.
16 * 16 *
17 * Note: efi_info is commonly left uninitialized, but that field has a
18 * private magic, so it is better to leave it unchanged.
17 */ 19 */
18static void sanitize_boot_params(struct boot_params *boot_params) 20static void sanitize_boot_params(struct boot_params *boot_params)
19{ 21{
22 /*
23 * IMPORTANT NOTE TO BOOTLOADER AUTHORS: do not simply clear
24 * this field. The purpose of this field is to guarantee
25 * compliance with the x86 boot spec located in
26 * Documentation/x86/boot.txt . That spec says that the
27 * *whole* structure should be cleared, after which only the
28 * portion defined by struct setup_header (boot_params->hdr)
29 * should be copied in.
30 *
31 * If you're having an issue because the sentinel is set, you
32 * need to change the whole structure to be cleared, not this
33 * (or any other) individual field, or you will soon have
34 * problems again.
35 */
20 if (boot_params->sentinel) { 36 if (boot_params->sentinel) {
21 /*fields in boot_params are not valid, clear them */ 37 /* fields in boot_params are left uninitialized, clear them */
22 memset(&boot_params->olpc_ofw_header, 0, 38 memset(&boot_params->olpc_ofw_header, 0,
23 (char *)&boot_params->alt_mem_k - 39 (char *)&boot_params->efi_info -
24 (char *)&boot_params->olpc_ofw_header); 40 (char *)&boot_params->olpc_ofw_header);
25 memset(&boot_params->kbd_status, 0, 41 memset(&boot_params->kbd_status, 0,
26 (char *)&boot_params->hdr - 42 (char *)&boot_params->hdr -
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 84d32855f65c..90d8cc930f5e 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -171,9 +171,15 @@ static struct resource bss_resource = {
171 171
172#ifdef CONFIG_X86_32 172#ifdef CONFIG_X86_32
173/* cpu data as detected by the assembly code in head.S */ 173/* cpu data as detected by the assembly code in head.S */
174struct cpuinfo_x86 new_cpu_data __cpuinitdata = {0, 0, 0, 0, -1, 1, 0, 0, -1}; 174struct cpuinfo_x86 new_cpu_data __cpuinitdata = {
175 .wp_works_ok = -1,
176 .fdiv_bug = -1,
177};
175/* common cpu data for all cpus */ 178/* common cpu data for all cpus */
176struct cpuinfo_x86 boot_cpu_data __read_mostly = {0, 0, 0, 0, -1, 1, 0, 0, -1}; 179struct cpuinfo_x86 boot_cpu_data __read_mostly = {
180 .wp_works_ok = -1,
181 .fdiv_bug = -1,
182};
177EXPORT_SYMBOL(boot_cpu_data); 183EXPORT_SYMBOL(boot_cpu_data);
178 184
179unsigned int def_to_bigsmp; 185unsigned int def_to_bigsmp;
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index a6ceaedc396a..9f190a2a00e9 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1365,9 +1365,8 @@ static inline void mwait_play_dead(void)
1365 unsigned int eax, ebx, ecx, edx; 1365 unsigned int eax, ebx, ecx, edx;
1366 unsigned int highest_cstate = 0; 1366 unsigned int highest_cstate = 0;
1367 unsigned int highest_subcstate = 0; 1367 unsigned int highest_subcstate = 0;
1368 int i;
1369 void *mwait_ptr; 1368 void *mwait_ptr;
1370 struct cpuinfo_x86 *c = __this_cpu_ptr(&cpu_info); 1369 int i;
1371 1370
1372 if (!this_cpu_has(X86_FEATURE_MWAIT)) 1371 if (!this_cpu_has(X86_FEATURE_MWAIT))
1373 return; 1372 return;
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 4903a03ae876..59b7fc453277 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -410,9 +410,8 @@ void __init init_mem_mapping(void)
410 /* the ISA range is always mapped regardless of memory holes */ 410 /* the ISA range is always mapped regardless of memory holes */
411 init_memory_mapping(0, ISA_END_ADDRESS); 411 init_memory_mapping(0, ISA_END_ADDRESS);
412 412
413 /* xen has big range in reserved near end of ram, skip it at first */ 413 /* xen has big range in reserved near end of ram, skip it at first.*/
414 addr = memblock_find_in_range(ISA_END_ADDRESS, end, PMD_SIZE, 414 addr = memblock_find_in_range(ISA_END_ADDRESS, end, PMD_SIZE, PMD_SIZE);
415 PAGE_SIZE);
416 real_end = addr + PMD_SIZE; 415 real_end = addr + PMD_SIZE;
417 416
418 /* step_size need to be small so pgt_buf from BRK could cover it */ 417 /* step_size need to be small so pgt_buf from BRK could cover it */
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index 2610bd93c896..657438858e83 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -563,6 +563,13 @@ int kernel_map_sync_memtype(u64 base, unsigned long size, unsigned long flags)
563 if (base > __pa(high_memory-1)) 563 if (base > __pa(high_memory-1))
564 return 0; 564 return 0;
565 565
566 /*
567 * some areas in the middle of the kernel identity range
568 * are not mapped, like the PCI space.
569 */
570 if (!page_is_ram(base >> PAGE_SHIFT))
571 return 0;
572
566 id_sz = (__pa(high_memory-1) <= base + size) ? 573 id_sz = (__pa(high_memory-1) <= base + size) ?
567 __pa(high_memory) - base : 574 __pa(high_memory) - base :
568 size; 575 size;
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index ef6f155469b5..40a84cc6740c 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -36,12 +36,11 @@ int register_acpi_bus_type(struct acpi_bus_type *type)
36{ 36{
37 if (acpi_disabled) 37 if (acpi_disabled)
38 return -ENODEV; 38 return -ENODEV;
39 if (type && type->bus && type->find_device) { 39 if (type && type->match && type->find_device) {
40 down_write(&bus_type_sem); 40 down_write(&bus_type_sem);
41 list_add_tail(&type->list, &bus_type_list); 41 list_add_tail(&type->list, &bus_type_list);
42 up_write(&bus_type_sem); 42 up_write(&bus_type_sem);
43 printk(KERN_INFO PREFIX "bus type %s registered\n", 43 printk(KERN_INFO PREFIX "bus type %s registered\n", type->name);
44 type->bus->name);
45 return 0; 44 return 0;
46 } 45 }
47 return -ENODEV; 46 return -ENODEV;
@@ -56,24 +55,21 @@ int unregister_acpi_bus_type(struct acpi_bus_type *type)
56 down_write(&bus_type_sem); 55 down_write(&bus_type_sem);
57 list_del_init(&type->list); 56 list_del_init(&type->list);
58 up_write(&bus_type_sem); 57 up_write(&bus_type_sem);
59 printk(KERN_INFO PREFIX "ACPI bus type %s unregistered\n", 58 printk(KERN_INFO PREFIX "bus type %s unregistered\n",
60 type->bus->name); 59 type->name);
61 return 0; 60 return 0;
62 } 61 }
63 return -ENODEV; 62 return -ENODEV;
64} 63}
65EXPORT_SYMBOL_GPL(unregister_acpi_bus_type); 64EXPORT_SYMBOL_GPL(unregister_acpi_bus_type);
66 65
67static struct acpi_bus_type *acpi_get_bus_type(struct bus_type *type) 66static struct acpi_bus_type *acpi_get_bus_type(struct device *dev)
68{ 67{
69 struct acpi_bus_type *tmp, *ret = NULL; 68 struct acpi_bus_type *tmp, *ret = NULL;
70 69
71 if (!type)
72 return NULL;
73
74 down_read(&bus_type_sem); 70 down_read(&bus_type_sem);
75 list_for_each_entry(tmp, &bus_type_list, list) { 71 list_for_each_entry(tmp, &bus_type_list, list) {
76 if (tmp->bus == type) { 72 if (tmp->match(dev)) {
77 ret = tmp; 73 ret = tmp;
78 break; 74 break;
79 } 75 }
@@ -82,22 +78,6 @@ static struct acpi_bus_type *acpi_get_bus_type(struct bus_type *type)
82 return ret; 78 return ret;
83} 79}
84 80
85static int acpi_find_bridge_device(struct device *dev, acpi_handle * handle)
86{
87 struct acpi_bus_type *tmp;
88 int ret = -ENODEV;
89
90 down_read(&bus_type_sem);
91 list_for_each_entry(tmp, &bus_type_list, list) {
92 if (tmp->find_bridge && !tmp->find_bridge(dev, handle)) {
93 ret = 0;
94 break;
95 }
96 }
97 up_read(&bus_type_sem);
98 return ret;
99}
100
101static acpi_status do_acpi_find_child(acpi_handle handle, u32 lvl_not_used, 81static acpi_status do_acpi_find_child(acpi_handle handle, u32 lvl_not_used,
102 void *addr_p, void **ret_p) 82 void *addr_p, void **ret_p)
103{ 83{
@@ -261,29 +241,12 @@ err:
261 241
262static int acpi_platform_notify(struct device *dev) 242static int acpi_platform_notify(struct device *dev)
263{ 243{
264 struct acpi_bus_type *type; 244 struct acpi_bus_type *type = acpi_get_bus_type(dev);
265 acpi_handle handle; 245 acpi_handle handle;
266 int ret; 246 int ret;
267 247
268 ret = acpi_bind_one(dev, NULL); 248 ret = acpi_bind_one(dev, NULL);
269 if (ret && (!dev->bus || !dev->parent)) { 249 if (ret && type) {
270 /* bridge devices genernally haven't bus or parent */
271 ret = acpi_find_bridge_device(dev, &handle);
272 if (!ret) {
273 ret = acpi_bind_one(dev, handle);
274 if (ret)
275 goto out;
276 }
277 }
278
279 type = acpi_get_bus_type(dev->bus);
280 if (ret) {
281 if (!type || !type->find_device) {
282 DBG("No ACPI bus support for %s\n", dev_name(dev));
283 ret = -EINVAL;
284 goto out;
285 }
286
287 ret = type->find_device(dev, &handle); 250 ret = type->find_device(dev, &handle);
288 if (ret) { 251 if (ret) {
289 DBG("Unable to get handle for %s\n", dev_name(dev)); 252 DBG("Unable to get handle for %s\n", dev_name(dev));
@@ -316,7 +279,7 @@ static int acpi_platform_notify_remove(struct device *dev)
316{ 279{
317 struct acpi_bus_type *type; 280 struct acpi_bus_type *type;
318 281
319 type = acpi_get_bus_type(dev->bus); 282 type = acpi_get_bus_type(dev);
320 if (type && type->cleanup) 283 if (type && type->cleanup)
321 type->cleanup(dev); 284 type->cleanup(dev);
322 285
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index eff722278ff5..164d49569aeb 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -158,8 +158,7 @@ static int map_mat_entry(acpi_handle handle, int type, u32 acpi_id)
158 } 158 }
159 159
160exit: 160exit:
161 if (buffer.pointer) 161 kfree(buffer.pointer);
162 kfree(buffer.pointer);
163 return apic_id; 162 return apic_id;
164} 163}
165 164
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
index df34bd04ae62..bec717ffd25f 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -559,7 +559,7 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device)
559 return 0; 559 return 0;
560#endif 560#endif
561 561
562 BUG_ON((pr->id >= nr_cpu_ids) || (pr->id < 0)); 562 BUG_ON(pr->id >= nr_cpu_ids);
563 563
564 /* 564 /*
565 * Buggy BIOS check 565 * Buggy BIOS check
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 6d3a06a629a1..24213033fbae 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -599,7 +599,6 @@ static void acpi_sleep_suspend_setup(void)
599 status = acpi_get_sleep_type_data(i, &type_a, &type_b); 599 status = acpi_get_sleep_type_data(i, &type_a, &type_b);
600 if (ACPI_SUCCESS(status)) { 600 if (ACPI_SUCCESS(status)) {
601 sleep_states[i] = 1; 601 sleep_states[i] = 1;
602 pr_cont(" S%d", i);
603 } 602 }
604 } 603 }
605 604
@@ -742,7 +741,6 @@ static void acpi_sleep_hibernate_setup(void)
742 hibernation_set_ops(old_suspend_ordering ? 741 hibernation_set_ops(old_suspend_ordering ?
743 &acpi_hibernation_ops_old : &acpi_hibernation_ops); 742 &acpi_hibernation_ops_old : &acpi_hibernation_ops);
744 sleep_states[ACPI_STATE_S4] = 1; 743 sleep_states[ACPI_STATE_S4] = 1;
745 pr_cont(KERN_CONT " S4");
746 if (nosigcheck) 744 if (nosigcheck)
747 return; 745 return;
748 746
@@ -788,6 +786,9 @@ int __init acpi_sleep_init(void)
788{ 786{
789 acpi_status status; 787 acpi_status status;
790 u8 type_a, type_b; 788 u8 type_a, type_b;
789 char supported[ACPI_S_STATE_COUNT * 3 + 1];
790 char *pos = supported;
791 int i;
791 792
792 if (acpi_disabled) 793 if (acpi_disabled)
793 return 0; 794 return 0;
@@ -795,7 +796,6 @@ int __init acpi_sleep_init(void)
795 acpi_sleep_dmi_check(); 796 acpi_sleep_dmi_check();
796 797
797 sleep_states[ACPI_STATE_S0] = 1; 798 sleep_states[ACPI_STATE_S0] = 1;
798 pr_info(PREFIX "(supports S0");
799 799
800 acpi_sleep_suspend_setup(); 800 acpi_sleep_suspend_setup();
801 acpi_sleep_hibernate_setup(); 801 acpi_sleep_hibernate_setup();
@@ -803,11 +803,17 @@ int __init acpi_sleep_init(void)
803 status = acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b); 803 status = acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b);
804 if (ACPI_SUCCESS(status)) { 804 if (ACPI_SUCCESS(status)) {
805 sleep_states[ACPI_STATE_S5] = 1; 805 sleep_states[ACPI_STATE_S5] = 1;
806 pr_cont(" S5");
807 pm_power_off_prepare = acpi_power_off_prepare; 806 pm_power_off_prepare = acpi_power_off_prepare;
808 pm_power_off = acpi_power_off; 807 pm_power_off = acpi_power_off;
809 } 808 }
810 pr_cont(")\n"); 809
810 supported[0] = 0;
811 for (i = 0; i < ACPI_S_STATE_COUNT; i++) {
812 if (sleep_states[i])
813 pos += sprintf(pos, " S%d", i);
814 }
815 pr_info(PREFIX "(supports%s)\n", supported);
816
811 /* 817 /*
812 * Register the tts_notifier to reboot notifier list so that the _TTS 818 * Register the tts_notifier to reboot notifier list so that the _TTS
813 * object can also be evaluated when the system enters S5. 819 * object can also be evaluated when the system enters S5.
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index 0ea1018280bd..beea3115577e 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
@@ -1144,13 +1144,8 @@ static int ata_acpi_find_device(struct device *dev, acpi_handle *handle)
1144 return -ENODEV; 1144 return -ENODEV;
1145} 1145}
1146 1146
1147static int ata_acpi_find_dummy(struct device *dev, acpi_handle *handle)
1148{
1149 return -ENODEV;
1150}
1151
1152static struct acpi_bus_type ata_acpi_bus = { 1147static struct acpi_bus_type ata_acpi_bus = {
1153 .find_bridge = ata_acpi_find_dummy, 1148 .name = "ATA",
1154 .find_device = ata_acpi_find_device, 1149 .find_device = ata_acpi_find_device,
1155}; 1150};
1156 1151
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 2b7f77d3fcb0..15beb500a4e4 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -99,7 +99,6 @@ void device_pm_add(struct device *dev)
99 dev_warn(dev, "parent %s should not be sleeping\n", 99 dev_warn(dev, "parent %s should not be sleeping\n",
100 dev_name(dev->parent)); 100 dev_name(dev->parent));
101 list_add_tail(&dev->power.entry, &dpm_list); 101 list_add_tail(&dev->power.entry, &dpm_list);
102 dev_pm_qos_constraints_init(dev);
103 mutex_unlock(&dpm_list_mtx); 102 mutex_unlock(&dpm_list_mtx);
104} 103}
105 104
@@ -113,7 +112,6 @@ void device_pm_remove(struct device *dev)
113 dev->bus ? dev->bus->name : "No Bus", dev_name(dev)); 112 dev->bus ? dev->bus->name : "No Bus", dev_name(dev));
114 complete_all(&dev->power.completion); 113 complete_all(&dev->power.completion);
115 mutex_lock(&dpm_list_mtx); 114 mutex_lock(&dpm_list_mtx);
116 dev_pm_qos_constraints_destroy(dev);
117 list_del_init(&dev->power.entry); 115 list_del_init(&dev->power.entry);
118 mutex_unlock(&dpm_list_mtx); 116 mutex_unlock(&dpm_list_mtx);
119 device_wakeup_disable(dev); 117 device_wakeup_disable(dev);
diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h
index b16686a0a5a2..cfc3226ec492 100644
--- a/drivers/base/power/power.h
+++ b/drivers/base/power/power.h
@@ -4,7 +4,7 @@ static inline void device_pm_init_common(struct device *dev)
4{ 4{
5 if (!dev->power.early_init) { 5 if (!dev->power.early_init) {
6 spin_lock_init(&dev->power.lock); 6 spin_lock_init(&dev->power.lock);
7 dev->power.power_state = PMSG_INVALID; 7 dev->power.qos = NULL;
8 dev->power.early_init = true; 8 dev->power.early_init = true;
9 } 9 }
10} 10}
@@ -56,14 +56,10 @@ extern void device_pm_move_last(struct device *);
56 56
57static inline void device_pm_sleep_init(struct device *dev) {} 57static inline void device_pm_sleep_init(struct device *dev) {}
58 58
59static inline void device_pm_add(struct device *dev) 59static inline void device_pm_add(struct device *dev) {}
60{
61 dev_pm_qos_constraints_init(dev);
62}
63 60
64static inline void device_pm_remove(struct device *dev) 61static inline void device_pm_remove(struct device *dev)
65{ 62{
66 dev_pm_qos_constraints_destroy(dev);
67 pm_runtime_remove(dev); 63 pm_runtime_remove(dev);
68} 64}
69 65
diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c
index 3d4d1f8aac5c..5f74587ef258 100644
--- a/drivers/base/power/qos.c
+++ b/drivers/base/power/qos.c
@@ -41,6 +41,7 @@
41#include <linux/mutex.h> 41#include <linux/mutex.h>
42#include <linux/export.h> 42#include <linux/export.h>
43#include <linux/pm_runtime.h> 43#include <linux/pm_runtime.h>
44#include <linux/err.h>
44 45
45#include "power.h" 46#include "power.h"
46 47
@@ -61,7 +62,7 @@ enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev, s32 mask)
61 struct pm_qos_flags *pqf; 62 struct pm_qos_flags *pqf;
62 s32 val; 63 s32 val;
63 64
64 if (!qos) 65 if (IS_ERR_OR_NULL(qos))
65 return PM_QOS_FLAGS_UNDEFINED; 66 return PM_QOS_FLAGS_UNDEFINED;
66 67
67 pqf = &qos->flags; 68 pqf = &qos->flags;
@@ -101,7 +102,8 @@ EXPORT_SYMBOL_GPL(dev_pm_qos_flags);
101 */ 102 */
102s32 __dev_pm_qos_read_value(struct device *dev) 103s32 __dev_pm_qos_read_value(struct device *dev)
103{ 104{
104 return dev->power.qos ? pm_qos_read_value(&dev->power.qos->latency) : 0; 105 return IS_ERR_OR_NULL(dev->power.qos) ?
106 0 : pm_qos_read_value(&dev->power.qos->latency);
105} 107}
106 108
107/** 109/**
@@ -198,20 +200,8 @@ static int dev_pm_qos_constraints_allocate(struct device *dev)
198 return 0; 200 return 0;
199} 201}
200 202
201/** 203static void __dev_pm_qos_hide_latency_limit(struct device *dev);
202 * dev_pm_qos_constraints_init - Initalize device's PM QoS constraints pointer. 204static void __dev_pm_qos_hide_flags(struct device *dev);
203 * @dev: target device
204 *
205 * Called from the device PM subsystem during device insertion under
206 * device_pm_lock().
207 */
208void dev_pm_qos_constraints_init(struct device *dev)
209{
210 mutex_lock(&dev_pm_qos_mtx);
211 dev->power.qos = NULL;
212 dev->power.power_state = PMSG_ON;
213 mutex_unlock(&dev_pm_qos_mtx);
214}
215 205
216/** 206/**
217 * dev_pm_qos_constraints_destroy 207 * dev_pm_qos_constraints_destroy
@@ -226,16 +216,15 @@ void dev_pm_qos_constraints_destroy(struct device *dev)
226 struct pm_qos_constraints *c; 216 struct pm_qos_constraints *c;
227 struct pm_qos_flags *f; 217 struct pm_qos_flags *f;
228 218
219 mutex_lock(&dev_pm_qos_mtx);
220
229 /* 221 /*
230 * If the device's PM QoS resume latency limit or PM QoS flags have been 222 * If the device's PM QoS resume latency limit or PM QoS flags have been
231 * exposed to user space, they have to be hidden at this point. 223 * exposed to user space, they have to be hidden at this point.
232 */ 224 */
233 dev_pm_qos_hide_latency_limit(dev); 225 __dev_pm_qos_hide_latency_limit(dev);
234 dev_pm_qos_hide_flags(dev); 226 __dev_pm_qos_hide_flags(dev);
235 227
236 mutex_lock(&dev_pm_qos_mtx);
237
238 dev->power.power_state = PMSG_INVALID;
239 qos = dev->power.qos; 228 qos = dev->power.qos;
240 if (!qos) 229 if (!qos)
241 goto out; 230 goto out;
@@ -257,7 +246,7 @@ void dev_pm_qos_constraints_destroy(struct device *dev)
257 } 246 }
258 247
259 spin_lock_irq(&dev->power.lock); 248 spin_lock_irq(&dev->power.lock);
260 dev->power.qos = NULL; 249 dev->power.qos = ERR_PTR(-ENODEV);
261 spin_unlock_irq(&dev->power.lock); 250 spin_unlock_irq(&dev->power.lock);
262 251
263 kfree(c->notifiers); 252 kfree(c->notifiers);
@@ -301,32 +290,19 @@ int dev_pm_qos_add_request(struct device *dev, struct dev_pm_qos_request *req,
301 "%s() called for already added request\n", __func__)) 290 "%s() called for already added request\n", __func__))
302 return -EINVAL; 291 return -EINVAL;
303 292
304 req->dev = dev;
305
306 mutex_lock(&dev_pm_qos_mtx); 293 mutex_lock(&dev_pm_qos_mtx);
307 294
308 if (!dev->power.qos) { 295 if (IS_ERR(dev->power.qos))
309 if (dev->power.power_state.event == PM_EVENT_INVALID) { 296 ret = -ENODEV;
310 /* The device has been removed from the system. */ 297 else if (!dev->power.qos)
311 req->dev = NULL; 298 ret = dev_pm_qos_constraints_allocate(dev);
312 ret = -ENODEV;
313 goto out;
314 } else {
315 /*
316 * Allocate the constraints data on the first call to
317 * add_request, i.e. only if the data is not already
318 * allocated and if the device has not been removed.
319 */
320 ret = dev_pm_qos_constraints_allocate(dev);
321 }
322 }
323 299
324 if (!ret) { 300 if (!ret) {
301 req->dev = dev;
325 req->type = type; 302 req->type = type;
326 ret = apply_constraint(req, PM_QOS_ADD_REQ, value); 303 ret = apply_constraint(req, PM_QOS_ADD_REQ, value);
327 } 304 }
328 305
329 out:
330 mutex_unlock(&dev_pm_qos_mtx); 306 mutex_unlock(&dev_pm_qos_mtx);
331 307
332 return ret; 308 return ret;
@@ -344,7 +320,14 @@ static int __dev_pm_qos_update_request(struct dev_pm_qos_request *req,
344 s32 curr_value; 320 s32 curr_value;
345 int ret = 0; 321 int ret = 0;
346 322
347 if (!req->dev->power.qos) 323 if (!req) /*guard against callers passing in null */
324 return -EINVAL;
325
326 if (WARN(!dev_pm_qos_request_active(req),
327 "%s() called for unknown object\n", __func__))
328 return -EINVAL;
329
330 if (IS_ERR_OR_NULL(req->dev->power.qos))
348 return -ENODEV; 331 return -ENODEV;
349 332
350 switch(req->type) { 333 switch(req->type) {
@@ -386,6 +369,17 @@ int dev_pm_qos_update_request(struct dev_pm_qos_request *req, s32 new_value)
386{ 369{
387 int ret; 370 int ret;
388 371
372 mutex_lock(&dev_pm_qos_mtx);
373 ret = __dev_pm_qos_update_request(req, new_value);
374 mutex_unlock(&dev_pm_qos_mtx);
375 return ret;
376}
377EXPORT_SYMBOL_GPL(dev_pm_qos_update_request);
378
379static int __dev_pm_qos_remove_request(struct dev_pm_qos_request *req)
380{
381 int ret;
382
389 if (!req) /*guard against callers passing in null */ 383 if (!req) /*guard against callers passing in null */
390 return -EINVAL; 384 return -EINVAL;
391 385
@@ -393,13 +387,13 @@ int dev_pm_qos_update_request(struct dev_pm_qos_request *req, s32 new_value)
393 "%s() called for unknown object\n", __func__)) 387 "%s() called for unknown object\n", __func__))
394 return -EINVAL; 388 return -EINVAL;
395 389
396 mutex_lock(&dev_pm_qos_mtx); 390 if (IS_ERR_OR_NULL(req->dev->power.qos))
397 ret = __dev_pm_qos_update_request(req, new_value); 391 return -ENODEV;
398 mutex_unlock(&dev_pm_qos_mtx);
399 392
393 ret = apply_constraint(req, PM_QOS_REMOVE_REQ, PM_QOS_DEFAULT_VALUE);
394 memset(req, 0, sizeof(*req));
400 return ret; 395 return ret;
401} 396}
402EXPORT_SYMBOL_GPL(dev_pm_qos_update_request);
403 397
404/** 398/**
405 * dev_pm_qos_remove_request - modifies an existing qos request 399 * dev_pm_qos_remove_request - modifies an existing qos request
@@ -418,26 +412,10 @@ EXPORT_SYMBOL_GPL(dev_pm_qos_update_request);
418 */ 412 */
419int dev_pm_qos_remove_request(struct dev_pm_qos_request *req) 413int dev_pm_qos_remove_request(struct dev_pm_qos_request *req)
420{ 414{
421 int ret = 0; 415 int ret;
422
423 if (!req) /*guard against callers passing in null */
424 return -EINVAL;
425
426 if (WARN(!dev_pm_qos_request_active(req),
427 "%s() called for unknown object\n", __func__))
428 return -EINVAL;
429 416
430 mutex_lock(&dev_pm_qos_mtx); 417 mutex_lock(&dev_pm_qos_mtx);
431 418 ret = __dev_pm_qos_remove_request(req);
432 if (req->dev->power.qos) {
433 ret = apply_constraint(req, PM_QOS_REMOVE_REQ,
434 PM_QOS_DEFAULT_VALUE);
435 memset(req, 0, sizeof(*req));
436 } else {
437 /* Return if the device has been removed */
438 ret = -ENODEV;
439 }
440
441 mutex_unlock(&dev_pm_qos_mtx); 419 mutex_unlock(&dev_pm_qos_mtx);
442 return ret; 420 return ret;
443} 421}
@@ -462,9 +440,10 @@ int dev_pm_qos_add_notifier(struct device *dev, struct notifier_block *notifier)
462 440
463 mutex_lock(&dev_pm_qos_mtx); 441 mutex_lock(&dev_pm_qos_mtx);
464 442
465 if (!dev->power.qos) 443 if (IS_ERR(dev->power.qos))
466 ret = dev->power.power_state.event != PM_EVENT_INVALID ? 444 ret = -ENODEV;
467 dev_pm_qos_constraints_allocate(dev) : -ENODEV; 445 else if (!dev->power.qos)
446 ret = dev_pm_qos_constraints_allocate(dev);
468 447
469 if (!ret) 448 if (!ret)
470 ret = blocking_notifier_chain_register( 449 ret = blocking_notifier_chain_register(
@@ -493,7 +472,7 @@ int dev_pm_qos_remove_notifier(struct device *dev,
493 mutex_lock(&dev_pm_qos_mtx); 472 mutex_lock(&dev_pm_qos_mtx);
494 473
495 /* Silently return if the constraints object is not present. */ 474 /* Silently return if the constraints object is not present. */
496 if (dev->power.qos) 475 if (!IS_ERR_OR_NULL(dev->power.qos))
497 retval = blocking_notifier_chain_unregister( 476 retval = blocking_notifier_chain_unregister(
498 dev->power.qos->latency.notifiers, 477 dev->power.qos->latency.notifiers,
499 notifier); 478 notifier);
@@ -563,16 +542,20 @@ EXPORT_SYMBOL_GPL(dev_pm_qos_add_ancestor_request);
563static void __dev_pm_qos_drop_user_request(struct device *dev, 542static void __dev_pm_qos_drop_user_request(struct device *dev,
564 enum dev_pm_qos_req_type type) 543 enum dev_pm_qos_req_type type)
565{ 544{
545 struct dev_pm_qos_request *req = NULL;
546
566 switch(type) { 547 switch(type) {
567 case DEV_PM_QOS_LATENCY: 548 case DEV_PM_QOS_LATENCY:
568 dev_pm_qos_remove_request(dev->power.qos->latency_req); 549 req = dev->power.qos->latency_req;
569 dev->power.qos->latency_req = NULL; 550 dev->power.qos->latency_req = NULL;
570 break; 551 break;
571 case DEV_PM_QOS_FLAGS: 552 case DEV_PM_QOS_FLAGS:
572 dev_pm_qos_remove_request(dev->power.qos->flags_req); 553 req = dev->power.qos->flags_req;
573 dev->power.qos->flags_req = NULL; 554 dev->power.qos->flags_req = NULL;
574 break; 555 break;
575 } 556 }
557 __dev_pm_qos_remove_request(req);
558 kfree(req);
576} 559}
577 560
578/** 561/**
@@ -588,36 +571,57 @@ int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value)
588 if (!device_is_registered(dev) || value < 0) 571 if (!device_is_registered(dev) || value < 0)
589 return -EINVAL; 572 return -EINVAL;
590 573
591 if (dev->power.qos && dev->power.qos->latency_req)
592 return -EEXIST;
593
594 req = kzalloc(sizeof(*req), GFP_KERNEL); 574 req = kzalloc(sizeof(*req), GFP_KERNEL);
595 if (!req) 575 if (!req)
596 return -ENOMEM; 576 return -ENOMEM;
597 577
598 ret = dev_pm_qos_add_request(dev, req, DEV_PM_QOS_LATENCY, value); 578 ret = dev_pm_qos_add_request(dev, req, DEV_PM_QOS_LATENCY, value);
599 if (ret < 0) 579 if (ret < 0) {
580 kfree(req);
600 return ret; 581 return ret;
582 }
583
584 mutex_lock(&dev_pm_qos_mtx);
585
586 if (IS_ERR_OR_NULL(dev->power.qos))
587 ret = -ENODEV;
588 else if (dev->power.qos->latency_req)
589 ret = -EEXIST;
590
591 if (ret < 0) {
592 __dev_pm_qos_remove_request(req);
593 kfree(req);
594 goto out;
595 }
601 596
602 dev->power.qos->latency_req = req; 597 dev->power.qos->latency_req = req;
603 ret = pm_qos_sysfs_add_latency(dev); 598 ret = pm_qos_sysfs_add_latency(dev);
604 if (ret) 599 if (ret)
605 __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY); 600 __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY);
606 601
602 out:
603 mutex_unlock(&dev_pm_qos_mtx);
607 return ret; 604 return ret;
608} 605}
609EXPORT_SYMBOL_GPL(dev_pm_qos_expose_latency_limit); 606EXPORT_SYMBOL_GPL(dev_pm_qos_expose_latency_limit);
610 607
608static void __dev_pm_qos_hide_latency_limit(struct device *dev)
609{
610 if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->latency_req) {
611 pm_qos_sysfs_remove_latency(dev);
612 __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY);
613 }
614}
615
611/** 616/**
612 * dev_pm_qos_hide_latency_limit - Hide PM QoS latency limit from user space. 617 * dev_pm_qos_hide_latency_limit - Hide PM QoS latency limit from user space.
613 * @dev: Device whose PM QoS latency limit is to be hidden from user space. 618 * @dev: Device whose PM QoS latency limit is to be hidden from user space.
614 */ 619 */
615void dev_pm_qos_hide_latency_limit(struct device *dev) 620void dev_pm_qos_hide_latency_limit(struct device *dev)
616{ 621{
617 if (dev->power.qos && dev->power.qos->latency_req) { 622 mutex_lock(&dev_pm_qos_mtx);
618 pm_qos_sysfs_remove_latency(dev); 623 __dev_pm_qos_hide_latency_limit(dev);
619 __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY); 624 mutex_unlock(&dev_pm_qos_mtx);
620 }
621} 625}
622EXPORT_SYMBOL_GPL(dev_pm_qos_hide_latency_limit); 626EXPORT_SYMBOL_GPL(dev_pm_qos_hide_latency_limit);
623 627
@@ -634,41 +638,61 @@ int dev_pm_qos_expose_flags(struct device *dev, s32 val)
634 if (!device_is_registered(dev)) 638 if (!device_is_registered(dev))
635 return -EINVAL; 639 return -EINVAL;
636 640
637 if (dev->power.qos && dev->power.qos->flags_req)
638 return -EEXIST;
639
640 req = kzalloc(sizeof(*req), GFP_KERNEL); 641 req = kzalloc(sizeof(*req), GFP_KERNEL);
641 if (!req) 642 if (!req)
642 return -ENOMEM; 643 return -ENOMEM;
643 644
644 pm_runtime_get_sync(dev);
645 ret = dev_pm_qos_add_request(dev, req, DEV_PM_QOS_FLAGS, val); 645 ret = dev_pm_qos_add_request(dev, req, DEV_PM_QOS_FLAGS, val);
646 if (ret < 0) 646 if (ret < 0) {
647 goto fail; 647 kfree(req);
648 return ret;
649 }
650
651 pm_runtime_get_sync(dev);
652 mutex_lock(&dev_pm_qos_mtx);
653
654 if (IS_ERR_OR_NULL(dev->power.qos))
655 ret = -ENODEV;
656 else if (dev->power.qos->flags_req)
657 ret = -EEXIST;
658
659 if (ret < 0) {
660 __dev_pm_qos_remove_request(req);
661 kfree(req);
662 goto out;
663 }
648 664
649 dev->power.qos->flags_req = req; 665 dev->power.qos->flags_req = req;
650 ret = pm_qos_sysfs_add_flags(dev); 666 ret = pm_qos_sysfs_add_flags(dev);
651 if (ret) 667 if (ret)
652 __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS); 668 __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS);
653 669
654fail: 670 out:
671 mutex_unlock(&dev_pm_qos_mtx);
655 pm_runtime_put(dev); 672 pm_runtime_put(dev);
656 return ret; 673 return ret;
657} 674}
658EXPORT_SYMBOL_GPL(dev_pm_qos_expose_flags); 675EXPORT_SYMBOL_GPL(dev_pm_qos_expose_flags);
659 676
677static void __dev_pm_qos_hide_flags(struct device *dev)
678{
679 if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->flags_req) {
680 pm_qos_sysfs_remove_flags(dev);
681 __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS);
682 }
683}
684
660/** 685/**
661 * dev_pm_qos_hide_flags - Hide PM QoS flags of a device from user space. 686 * dev_pm_qos_hide_flags - Hide PM QoS flags of a device from user space.
662 * @dev: Device whose PM QoS flags are to be hidden from user space. 687 * @dev: Device whose PM QoS flags are to be hidden from user space.
663 */ 688 */
664void dev_pm_qos_hide_flags(struct device *dev) 689void dev_pm_qos_hide_flags(struct device *dev)
665{ 690{
666 if (dev->power.qos && dev->power.qos->flags_req) { 691 pm_runtime_get_sync(dev);
667 pm_qos_sysfs_remove_flags(dev); 692 mutex_lock(&dev_pm_qos_mtx);
668 pm_runtime_get_sync(dev); 693 __dev_pm_qos_hide_flags(dev);
669 __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS); 694 mutex_unlock(&dev_pm_qos_mtx);
670 pm_runtime_put(dev); 695 pm_runtime_put(dev);
671 }
672} 696}
673EXPORT_SYMBOL_GPL(dev_pm_qos_hide_flags); 697EXPORT_SYMBOL_GPL(dev_pm_qos_hide_flags);
674 698
@@ -683,12 +707,14 @@ int dev_pm_qos_update_flags(struct device *dev, s32 mask, bool set)
683 s32 value; 707 s32 value;
684 int ret; 708 int ret;
685 709
686 if (!dev->power.qos || !dev->power.qos->flags_req)
687 return -EINVAL;
688
689 pm_runtime_get_sync(dev); 710 pm_runtime_get_sync(dev);
690 mutex_lock(&dev_pm_qos_mtx); 711 mutex_lock(&dev_pm_qos_mtx);
691 712
713 if (IS_ERR_OR_NULL(dev->power.qos) || !dev->power.qos->flags_req) {
714 ret = -EINVAL;
715 goto out;
716 }
717
692 value = dev_pm_qos_requested_flags(dev); 718 value = dev_pm_qos_requested_flags(dev);
693 if (set) 719 if (set)
694 value |= mask; 720 value |= mask;
@@ -697,9 +723,12 @@ int dev_pm_qos_update_flags(struct device *dev, s32 mask, bool set)
697 723
698 ret = __dev_pm_qos_update_request(dev->power.qos->flags_req, value); 724 ret = __dev_pm_qos_update_request(dev->power.qos->flags_req, value);
699 725
726 out:
700 mutex_unlock(&dev_pm_qos_mtx); 727 mutex_unlock(&dev_pm_qos_mtx);
701 pm_runtime_put(dev); 728 pm_runtime_put(dev);
702
703 return ret; 729 return ret;
704} 730}
731#else /* !CONFIG_PM_RUNTIME */
732static void __dev_pm_qos_hide_latency_limit(struct device *dev) {}
733static void __dev_pm_qos_hide_flags(struct device *dev) {}
705#endif /* CONFIG_PM_RUNTIME */ 734#endif /* CONFIG_PM_RUNTIME */
diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c
index 50d16e3cb0a9..a53ebd265701 100644
--- a/drivers/base/power/sysfs.c
+++ b/drivers/base/power/sysfs.c
@@ -708,6 +708,7 @@ void rpm_sysfs_remove(struct device *dev)
708 708
709void dpm_sysfs_remove(struct device *dev) 709void dpm_sysfs_remove(struct device *dev)
710{ 710{
711 dev_pm_qos_constraints_destroy(dev);
711 rpm_sysfs_remove(dev); 712 rpm_sysfs_remove(dev);
712 sysfs_unmerge_group(&dev->kobj, &pm_wakeup_attr_group); 713 sysfs_unmerge_group(&dev->kobj, &pm_wakeup_attr_group);
713 sysfs_remove_group(&dev->kobj, &pm_attr_group); 714 sysfs_remove_group(&dev->kobj, &pm_attr_group);
diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
index 4706c63d0bc6..020ea2b9fd2f 100644
--- a/drivers/base/regmap/regmap-irq.c
+++ b/drivers/base/regmap/regmap-irq.c
@@ -184,6 +184,7 @@ static irqreturn_t regmap_irq_thread(int irq, void *d)
184 if (ret < 0) { 184 if (ret < 0) {
185 dev_err(map->dev, "IRQ thread failed to resume: %d\n", 185 dev_err(map->dev, "IRQ thread failed to resume: %d\n",
186 ret); 186 ret);
187 pm_runtime_put(map->dev);
187 return IRQ_NONE; 188 return IRQ_NONE;
188 } 189 }
189 } 190 }
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 594bda9dcfc8..32a6c5764950 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -852,6 +852,7 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min,
852 int reserved) 852 int reserved)
853{ 853{
854 unsigned long flags; 854 unsigned long flags;
855 int wakeup_write = 0;
855 856
856 /* Hold lock while accounting */ 857 /* Hold lock while accounting */
857 spin_lock_irqsave(&r->lock, flags); 858 spin_lock_irqsave(&r->lock, flags);
@@ -873,10 +874,8 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min,
873 else 874 else
874 r->entropy_count = reserved; 875 r->entropy_count = reserved;
875 876
876 if (r->entropy_count < random_write_wakeup_thresh) { 877 if (r->entropy_count < random_write_wakeup_thresh)
877 wake_up_interruptible(&random_write_wait); 878 wakeup_write = 1;
878 kill_fasync(&fasync, SIGIO, POLL_OUT);
879 }
880 } 879 }
881 880
882 DEBUG_ENT("debiting %zu entropy credits from %s%s\n", 881 DEBUG_ENT("debiting %zu entropy credits from %s%s\n",
@@ -884,6 +883,11 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min,
884 883
885 spin_unlock_irqrestore(&r->lock, flags); 884 spin_unlock_irqrestore(&r->lock, flags);
886 885
886 if (wakeup_write) {
887 wake_up_interruptible(&random_write_wait);
888 kill_fasync(&fasync, SIGIO, POLL_OUT);
889 }
890
887 return nbytes; 891 return nbytes;
888} 892}
889 893
diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h
index d2ac91150600..46bde01eee62 100644
--- a/drivers/cpufreq/cpufreq_governor.h
+++ b/drivers/cpufreq/cpufreq_governor.h
@@ -64,7 +64,7 @@ static void *get_cpu_dbs_info_s(int cpu) \
64 * dbs: used as a shortform for demand based switching It helps to keep variable 64 * dbs: used as a shortform for demand based switching It helps to keep variable
65 * names smaller, simpler 65 * names smaller, simpler
66 * cdbs: common dbs 66 * cdbs: common dbs
67 * on_*: On-demand governor 67 * od_*: On-demand governor
68 * cs_*: Conservative governor 68 * cs_*: Conservative governor
69 */ 69 */
70 70
diff --git a/drivers/cpufreq/highbank-cpufreq.c b/drivers/cpufreq/highbank-cpufreq.c
index 66e3a71b81a3..b61b5a3fad64 100644
--- a/drivers/cpufreq/highbank-cpufreq.c
+++ b/drivers/cpufreq/highbank-cpufreq.c
@@ -28,13 +28,7 @@
28 28
29static int hb_voltage_change(unsigned int freq) 29static int hb_voltage_change(unsigned int freq)
30{ 30{
31 int i; 31 u32 msg[HB_CPUFREQ_IPC_LEN] = {HB_CPUFREQ_CHANGE_NOTE, freq / 1000000};
32 u32 msg[HB_CPUFREQ_IPC_LEN];
33
34 msg[0] = HB_CPUFREQ_CHANGE_NOTE;
35 msg[1] = freq / 1000000;
36 for (i = 2; i < HB_CPUFREQ_IPC_LEN; i++)
37 msg[i] = 0;
38 32
39 return pl320_ipc_transmit(msg); 33 return pl320_ipc_transmit(msg);
40} 34}
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 096fde0ebcb5..f6dd1e761129 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -662,6 +662,9 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy)
662 662
663 cpu = all_cpu_data[policy->cpu]; 663 cpu = all_cpu_data[policy->cpu];
664 664
665 if (!policy->cpuinfo.max_freq)
666 return -ENODEV;
667
665 intel_pstate_get_min_max(cpu, &min, &max); 668 intel_pstate_get_min_max(cpu, &min, &max);
666 669
667 limits.min_perf_pct = (policy->min * 100) / policy->cpuinfo.max_freq; 670 limits.min_perf_pct = (policy->min * 100) / policy->cpuinfo.max_freq;
@@ -747,37 +750,11 @@ static struct cpufreq_driver intel_pstate_driver = {
747 .owner = THIS_MODULE, 750 .owner = THIS_MODULE,
748}; 751};
749 752
750static void intel_pstate_exit(void)
751{
752 int cpu;
753
754 sysfs_remove_group(intel_pstate_kobject,
755 &intel_pstate_attr_group);
756 debugfs_remove_recursive(debugfs_parent);
757
758 cpufreq_unregister_driver(&intel_pstate_driver);
759
760 if (!all_cpu_data)
761 return;
762
763 get_online_cpus();
764 for_each_online_cpu(cpu) {
765 if (all_cpu_data[cpu]) {
766 del_timer_sync(&all_cpu_data[cpu]->timer);
767 kfree(all_cpu_data[cpu]);
768 }
769 }
770
771 put_online_cpus();
772 vfree(all_cpu_data);
773}
774module_exit(intel_pstate_exit);
775
776static int __initdata no_load; 753static int __initdata no_load;
777 754
778static int __init intel_pstate_init(void) 755static int __init intel_pstate_init(void)
779{ 756{
780 int rc = 0; 757 int cpu, rc = 0;
781 const struct x86_cpu_id *id; 758 const struct x86_cpu_id *id;
782 759
783 if (no_load) 760 if (no_load)
@@ -802,7 +779,16 @@ static int __init intel_pstate_init(void)
802 intel_pstate_sysfs_expose_params(); 779 intel_pstate_sysfs_expose_params();
803 return rc; 780 return rc;
804out: 781out:
805 intel_pstate_exit(); 782 get_online_cpus();
783 for_each_online_cpu(cpu) {
784 if (all_cpu_data[cpu]) {
785 del_timer_sync(&all_cpu_data[cpu]->timer);
786 kfree(all_cpu_data[cpu]);
787 }
788 }
789
790 put_online_cpus();
791 vfree(all_cpu_data);
806 return -ENODEV; 792 return -ENODEV;
807} 793}
808device_initcall(intel_pstate_init); 794device_initcall(intel_pstate_init);
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index 982f1f5f5742..4cd392dbf115 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -442,7 +442,6 @@ static int __init dmi_present(const char __iomem *p)
442static int __init smbios_present(const char __iomem *p) 442static int __init smbios_present(const char __iomem *p)
443{ 443{
444 u8 buf[32]; 444 u8 buf[32];
445 int offset = 0;
446 445
447 memcpy_fromio(buf, p, 32); 446 memcpy_fromio(buf, p, 32);
448 if ((buf[5] < 32) && dmi_checksum(buf, buf[5])) { 447 if ((buf[5] < 32) && dmi_checksum(buf, buf[5])) {
@@ -461,9 +460,9 @@ static int __init smbios_present(const char __iomem *p)
461 dmi_ver = 0x0206; 460 dmi_ver = 0x0206;
462 break; 461 break;
463 } 462 }
464 offset = 16; 463 return memcmp(p + 16, "_DMI_", 5) || dmi_present(p + 16);
465 } 464 }
466 return dmi_present(buf + offset); 465 return 1;
467} 466}
468 467
469void __init dmi_scan_machine(void) 468void __init dmi_scan_machine(void)
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
index 7320bf891706..fe62aa392239 100644
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -426,6 +426,44 @@ get_var_data(struct efivars *efivars, struct efi_variable *var)
426 return status; 426 return status;
427} 427}
428 428
429static efi_status_t
430check_var_size_locked(struct efivars *efivars, u32 attributes,
431 unsigned long size)
432{
433 u64 storage_size, remaining_size, max_size;
434 efi_status_t status;
435 const struct efivar_operations *fops = efivars->ops;
436
437 if (!efivars->ops->query_variable_info)
438 return EFI_UNSUPPORTED;
439
440 status = fops->query_variable_info(attributes, &storage_size,
441 &remaining_size, &max_size);
442
443 if (status != EFI_SUCCESS)
444 return status;
445
446 if (!storage_size || size > remaining_size || size > max_size ||
447 (remaining_size - size) < (storage_size / 2))
448 return EFI_OUT_OF_RESOURCES;
449
450 return status;
451}
452
453
454static efi_status_t
455check_var_size(struct efivars *efivars, u32 attributes, unsigned long size)
456{
457 efi_status_t status;
458 unsigned long flags;
459
460 spin_lock_irqsave(&efivars->lock, flags);
461 status = check_var_size_locked(efivars, attributes, size);
462 spin_unlock_irqrestore(&efivars->lock, flags);
463
464 return status;
465}
466
429static ssize_t 467static ssize_t
430efivar_guid_read(struct efivar_entry *entry, char *buf) 468efivar_guid_read(struct efivar_entry *entry, char *buf)
431{ 469{
@@ -547,11 +585,16 @@ efivar_store_raw(struct efivar_entry *entry, const char *buf, size_t count)
547 } 585 }
548 586
549 spin_lock_irq(&efivars->lock); 587 spin_lock_irq(&efivars->lock);
550 status = efivars->ops->set_variable(new_var->VariableName, 588
551 &new_var->VendorGuid, 589 status = check_var_size_locked(efivars, new_var->Attributes,
552 new_var->Attributes, 590 new_var->DataSize + utf16_strsize(new_var->VariableName, 1024));
553 new_var->DataSize, 591
554 new_var->Data); 592 if (status == EFI_SUCCESS || status == EFI_UNSUPPORTED)
593 status = efivars->ops->set_variable(new_var->VariableName,
594 &new_var->VendorGuid,
595 new_var->Attributes,
596 new_var->DataSize,
597 new_var->Data);
555 598
556 spin_unlock_irq(&efivars->lock); 599 spin_unlock_irq(&efivars->lock);
557 600
@@ -702,8 +745,7 @@ static ssize_t efivarfs_file_write(struct file *file,
702 u32 attributes; 745 u32 attributes;
703 struct inode *inode = file->f_mapping->host; 746 struct inode *inode = file->f_mapping->host;
704 unsigned long datasize = count - sizeof(attributes); 747 unsigned long datasize = count - sizeof(attributes);
705 unsigned long newdatasize; 748 unsigned long newdatasize, varsize;
706 u64 storage_size, remaining_size, max_size;
707 ssize_t bytes = 0; 749 ssize_t bytes = 0;
708 750
709 if (count < sizeof(attributes)) 751 if (count < sizeof(attributes))
@@ -722,28 +764,18 @@ static ssize_t efivarfs_file_write(struct file *file,
722 * amounts of memory. Pick a default size of 64K if 764 * amounts of memory. Pick a default size of 64K if
723 * QueryVariableInfo() isn't supported by the firmware. 765 * QueryVariableInfo() isn't supported by the firmware.
724 */ 766 */
725 spin_lock_irq(&efivars->lock);
726
727 if (!efivars->ops->query_variable_info)
728 status = EFI_UNSUPPORTED;
729 else {
730 const struct efivar_operations *fops = efivars->ops;
731 status = fops->query_variable_info(attributes, &storage_size,
732 &remaining_size, &max_size);
733 }
734 767
735 spin_unlock_irq(&efivars->lock); 768 varsize = datasize + utf16_strsize(var->var.VariableName, 1024);
769 status = check_var_size(efivars, attributes, varsize);
736 770
737 if (status != EFI_SUCCESS) { 771 if (status != EFI_SUCCESS) {
738 if (status != EFI_UNSUPPORTED) 772 if (status != EFI_UNSUPPORTED)
739 return efi_status_to_err(status); 773 return efi_status_to_err(status);
740 774
741 remaining_size = 65536; 775 if (datasize > 65536)
776 return -ENOSPC;
742 } 777 }
743 778
744 if (datasize > remaining_size)
745 return -ENOSPC;
746
747 data = kmalloc(datasize, GFP_KERNEL); 779 data = kmalloc(datasize, GFP_KERNEL);
748 if (!data) 780 if (!data)
749 return -ENOMEM; 781 return -ENOMEM;
@@ -765,6 +797,19 @@ static ssize_t efivarfs_file_write(struct file *file,
765 */ 797 */
766 spin_lock_irq(&efivars->lock); 798 spin_lock_irq(&efivars->lock);
767 799
800 /*
801 * Ensure that the available space hasn't shrunk below the safe level
802 */
803
804 status = check_var_size_locked(efivars, attributes, varsize);
805
806 if (status != EFI_SUCCESS && status != EFI_UNSUPPORTED) {
807 spin_unlock_irq(&efivars->lock);
808 kfree(data);
809
810 return efi_status_to_err(status);
811 }
812
768 status = efivars->ops->set_variable(var->var.VariableName, 813 status = efivars->ops->set_variable(var->var.VariableName,
769 &var->var.VendorGuid, 814 &var->var.VendorGuid,
770 attributes, datasize, 815 attributes, datasize,
@@ -929,8 +974,8 @@ static bool efivarfs_valid_name(const char *str, int len)
929 if (len < GUID_LEN + 2) 974 if (len < GUID_LEN + 2)
930 return false; 975 return false;
931 976
932 /* GUID should be right after the first '-' */ 977 /* GUID must be preceded by a '-' */
933 if (s - 1 != strchr(str, '-')) 978 if (*(s - 1) != '-')
934 return false; 979 return false;
935 980
936 /* 981 /*
@@ -1118,15 +1163,22 @@ static struct dentry_operations efivarfs_d_ops = {
1118 1163
1119static struct dentry *efivarfs_alloc_dentry(struct dentry *parent, char *name) 1164static struct dentry *efivarfs_alloc_dentry(struct dentry *parent, char *name)
1120{ 1165{
1166 struct dentry *d;
1121 struct qstr q; 1167 struct qstr q;
1168 int err;
1122 1169
1123 q.name = name; 1170 q.name = name;
1124 q.len = strlen(name); 1171 q.len = strlen(name);
1125 1172
1126 if (efivarfs_d_hash(NULL, NULL, &q)) 1173 err = efivarfs_d_hash(NULL, NULL, &q);
1127 return NULL; 1174 if (err)
1175 return ERR_PTR(err);
1176
1177 d = d_alloc(parent, &q);
1178 if (d)
1179 return d;
1128 1180
1129 return d_alloc(parent, &q); 1181 return ERR_PTR(-ENOMEM);
1130} 1182}
1131 1183
1132static int efivarfs_fill_super(struct super_block *sb, void *data, int silent) 1184static int efivarfs_fill_super(struct super_block *sb, void *data, int silent)
@@ -1136,6 +1188,7 @@ static int efivarfs_fill_super(struct super_block *sb, void *data, int silent)
1136 struct efivar_entry *entry, *n; 1188 struct efivar_entry *entry, *n;
1137 struct efivars *efivars = &__efivars; 1189 struct efivars *efivars = &__efivars;
1138 char *name; 1190 char *name;
1191 int err = -ENOMEM;
1139 1192
1140 efivarfs_sb = sb; 1193 efivarfs_sb = sb;
1141 1194
@@ -1186,8 +1239,10 @@ static int efivarfs_fill_super(struct super_block *sb, void *data, int silent)
1186 goto fail_name; 1239 goto fail_name;
1187 1240
1188 dentry = efivarfs_alloc_dentry(root, name); 1241 dentry = efivarfs_alloc_dentry(root, name);
1189 if (!dentry) 1242 if (IS_ERR(dentry)) {
1243 err = PTR_ERR(dentry);
1190 goto fail_inode; 1244 goto fail_inode;
1245 }
1191 1246
1192 /* copied by the above to local storage in the dentry. */ 1247 /* copied by the above to local storage in the dentry. */
1193 kfree(name); 1248 kfree(name);
@@ -1214,7 +1269,7 @@ fail_inode:
1214fail_name: 1269fail_name:
1215 kfree(name); 1270 kfree(name);
1216fail: 1271fail:
1217 return -ENOMEM; 1272 return err;
1218} 1273}
1219 1274
1220static struct dentry *efivarfs_mount(struct file_system_type *fs_type, 1275static struct dentry *efivarfs_mount(struct file_system_type *fs_type,
@@ -1234,6 +1289,7 @@ static struct file_system_type efivarfs_type = {
1234 .mount = efivarfs_mount, 1289 .mount = efivarfs_mount,
1235 .kill_sb = efivarfs_kill_sb, 1290 .kill_sb = efivarfs_kill_sb,
1236}; 1291};
1292MODULE_ALIAS_FS("efivarfs");
1237 1293
1238/* 1294/*
1239 * Handle negative dentry. 1295 * Handle negative dentry.
@@ -1345,7 +1401,6 @@ static int efi_pstore_write(enum pstore_type_id type,
1345 efi_guid_t vendor = LINUX_EFI_CRASH_GUID; 1401 efi_guid_t vendor = LINUX_EFI_CRASH_GUID;
1346 struct efivars *efivars = psi->data; 1402 struct efivars *efivars = psi->data;
1347 int i, ret = 0; 1403 int i, ret = 0;
1348 u64 storage_space, remaining_space, max_variable_size;
1349 efi_status_t status = EFI_NOT_FOUND; 1404 efi_status_t status = EFI_NOT_FOUND;
1350 unsigned long flags; 1405 unsigned long flags;
1351 1406
@@ -1365,11 +1420,11 @@ static int efi_pstore_write(enum pstore_type_id type,
1365 * size: a size of logging data 1420 * size: a size of logging data
1366 * DUMP_NAME_LEN * 2: a maximum size of variable name 1421 * DUMP_NAME_LEN * 2: a maximum size of variable name
1367 */ 1422 */
1368 status = efivars->ops->query_variable_info(PSTORE_EFI_ATTRIBUTES, 1423
1369 &storage_space, 1424 status = check_var_size_locked(efivars, PSTORE_EFI_ATTRIBUTES,
1370 &remaining_space, 1425 size + DUMP_NAME_LEN * 2);
1371 &max_variable_size); 1426
1372 if (status || remaining_space < size + DUMP_NAME_LEN * 2) { 1427 if (status) {
1373 spin_unlock_irqrestore(&efivars->lock, flags); 1428 spin_unlock_irqrestore(&efivars->lock, flags);
1374 *id = part; 1429 *id = part;
1375 return -ENOSPC; 1430 return -ENOSPC;
@@ -1544,6 +1599,14 @@ static ssize_t efivar_create(struct file *filp, struct kobject *kobj,
1544 return -EINVAL; 1599 return -EINVAL;
1545 } 1600 }
1546 1601
1602 status = check_var_size_locked(efivars, new_var->Attributes,
1603 new_var->DataSize + utf16_strsize(new_var->VariableName, 1024));
1604
1605 if (status && status != EFI_UNSUPPORTED) {
1606 spin_unlock_irq(&efivars->lock);
1607 return efi_status_to_err(status);
1608 }
1609
1547 /* now *really* create the variable via EFI */ 1610 /* now *really* create the variable via EFI */
1548 status = efivars->ops->set_variable(new_var->VariableName, 1611 status = efivars->ops->set_variable(new_var->VariableName,
1549 &new_var->VendorGuid, 1612 &new_var->VendorGuid,
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index c5b8c81b9440..0a8eceb75902 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -379,15 +379,15 @@ static const struct pci_device_id pciidlist[] = { /* aka */
379 INTEL_VGA_DEVICE(0x0A06, &intel_haswell_m_info), /* ULT GT1 mobile */ 379 INTEL_VGA_DEVICE(0x0A06, &intel_haswell_m_info), /* ULT GT1 mobile */
380 INTEL_VGA_DEVICE(0x0A16, &intel_haswell_m_info), /* ULT GT2 mobile */ 380 INTEL_VGA_DEVICE(0x0A16, &intel_haswell_m_info), /* ULT GT2 mobile */
381 INTEL_VGA_DEVICE(0x0A26, &intel_haswell_m_info), /* ULT GT2 mobile */ 381 INTEL_VGA_DEVICE(0x0A26, &intel_haswell_m_info), /* ULT GT2 mobile */
382 INTEL_VGA_DEVICE(0x0D12, &intel_haswell_d_info), /* CRW GT1 desktop */ 382 INTEL_VGA_DEVICE(0x0D02, &intel_haswell_d_info), /* CRW GT1 desktop */
383 INTEL_VGA_DEVICE(0x0D12, &intel_haswell_d_info), /* CRW GT2 desktop */
383 INTEL_VGA_DEVICE(0x0D22, &intel_haswell_d_info), /* CRW GT2 desktop */ 384 INTEL_VGA_DEVICE(0x0D22, &intel_haswell_d_info), /* CRW GT2 desktop */
384 INTEL_VGA_DEVICE(0x0D32, &intel_haswell_d_info), /* CRW GT2 desktop */ 385 INTEL_VGA_DEVICE(0x0D0A, &intel_haswell_d_info), /* CRW GT1 server */
385 INTEL_VGA_DEVICE(0x0D1A, &intel_haswell_d_info), /* CRW GT1 server */ 386 INTEL_VGA_DEVICE(0x0D1A, &intel_haswell_d_info), /* CRW GT2 server */
386 INTEL_VGA_DEVICE(0x0D2A, &intel_haswell_d_info), /* CRW GT2 server */ 387 INTEL_VGA_DEVICE(0x0D2A, &intel_haswell_d_info), /* CRW GT2 server */
387 INTEL_VGA_DEVICE(0x0D3A, &intel_haswell_d_info), /* CRW GT2 server */ 388 INTEL_VGA_DEVICE(0x0D06, &intel_haswell_m_info), /* CRW GT1 mobile */
388 INTEL_VGA_DEVICE(0x0D16, &intel_haswell_m_info), /* CRW GT1 mobile */ 389 INTEL_VGA_DEVICE(0x0D16, &intel_haswell_m_info), /* CRW GT2 mobile */
389 INTEL_VGA_DEVICE(0x0D26, &intel_haswell_m_info), /* CRW GT2 mobile */ 390 INTEL_VGA_DEVICE(0x0D26, &intel_haswell_m_info), /* CRW GT2 mobile */
390 INTEL_VGA_DEVICE(0x0D36, &intel_haswell_m_info), /* CRW GT2 mobile */
391 INTEL_VGA_DEVICE(0x0f30, &intel_valleyview_m_info), 391 INTEL_VGA_DEVICE(0x0f30, &intel_valleyview_m_info),
392 INTEL_VGA_DEVICE(0x0157, &intel_valleyview_m_info), 392 INTEL_VGA_DEVICE(0x0157, &intel_valleyview_m_info),
393 INTEL_VGA_DEVICE(0x0155, &intel_valleyview_d_info), 393 INTEL_VGA_DEVICE(0x0155, &intel_valleyview_d_info),
@@ -495,6 +495,7 @@ static int i915_drm_freeze(struct drm_device *dev)
495 intel_modeset_disable(dev); 495 intel_modeset_disable(dev);
496 496
497 drm_irq_uninstall(dev); 497 drm_irq_uninstall(dev);
498 dev_priv->enable_hotplug_processing = false;
498 } 499 }
499 500
500 i915_save_state(dev); 501 i915_save_state(dev);
@@ -568,10 +569,20 @@ static int __i915_drm_thaw(struct drm_device *dev)
568 error = i915_gem_init_hw(dev); 569 error = i915_gem_init_hw(dev);
569 mutex_unlock(&dev->struct_mutex); 570 mutex_unlock(&dev->struct_mutex);
570 571
572 /* We need working interrupts for modeset enabling ... */
573 drm_irq_install(dev);
574
571 intel_modeset_init_hw(dev); 575 intel_modeset_init_hw(dev);
572 intel_modeset_setup_hw_state(dev, false); 576 intel_modeset_setup_hw_state(dev, false);
573 drm_irq_install(dev); 577
578 /*
579 * ... but also need to make sure that hotplug processing
580 * doesn't cause havoc. Like in the driver load code we don't
581 * bother with the tiny race here where we might loose hotplug
582 * notifications.
583 * */
574 intel_hpd_init(dev); 584 intel_hpd_init(dev);
585 dev_priv->enable_hotplug_processing = true;
575 } 586 }
576 587
577 intel_opregion_init(dev); 588 intel_opregion_init(dev);
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 2cd97d1cc920..3c7bb0410b51 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -701,7 +701,7 @@ static irqreturn_t ivybridge_irq_handler(int irq, void *arg)
701{ 701{
702 struct drm_device *dev = (struct drm_device *) arg; 702 struct drm_device *dev = (struct drm_device *) arg;
703 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 703 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
704 u32 de_iir, gt_iir, de_ier, pm_iir; 704 u32 de_iir, gt_iir, de_ier, pm_iir, sde_ier;
705 irqreturn_t ret = IRQ_NONE; 705 irqreturn_t ret = IRQ_NONE;
706 int i; 706 int i;
707 707
@@ -711,6 +711,15 @@ static irqreturn_t ivybridge_irq_handler(int irq, void *arg)
711 de_ier = I915_READ(DEIER); 711 de_ier = I915_READ(DEIER);
712 I915_WRITE(DEIER, de_ier & ~DE_MASTER_IRQ_CONTROL); 712 I915_WRITE(DEIER, de_ier & ~DE_MASTER_IRQ_CONTROL);
713 713
714 /* Disable south interrupts. We'll only write to SDEIIR once, so further
715 * interrupts will will be stored on its back queue, and then we'll be
716 * able to process them after we restore SDEIER (as soon as we restore
717 * it, we'll get an interrupt if SDEIIR still has something to process
718 * due to its back queue). */
719 sde_ier = I915_READ(SDEIER);
720 I915_WRITE(SDEIER, 0);
721 POSTING_READ(SDEIER);
722
714 gt_iir = I915_READ(GTIIR); 723 gt_iir = I915_READ(GTIIR);
715 if (gt_iir) { 724 if (gt_iir) {
716 snb_gt_irq_handler(dev, dev_priv, gt_iir); 725 snb_gt_irq_handler(dev, dev_priv, gt_iir);
@@ -759,6 +768,8 @@ static irqreturn_t ivybridge_irq_handler(int irq, void *arg)
759 768
760 I915_WRITE(DEIER, de_ier); 769 I915_WRITE(DEIER, de_ier);
761 POSTING_READ(DEIER); 770 POSTING_READ(DEIER);
771 I915_WRITE(SDEIER, sde_ier);
772 POSTING_READ(SDEIER);
762 773
763 return ret; 774 return ret;
764} 775}
@@ -778,7 +789,7 @@ static irqreturn_t ironlake_irq_handler(int irq, void *arg)
778 struct drm_device *dev = (struct drm_device *) arg; 789 struct drm_device *dev = (struct drm_device *) arg;
779 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 790 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
780 int ret = IRQ_NONE; 791 int ret = IRQ_NONE;
781 u32 de_iir, gt_iir, de_ier, pm_iir; 792 u32 de_iir, gt_iir, de_ier, pm_iir, sde_ier;
782 793
783 atomic_inc(&dev_priv->irq_received); 794 atomic_inc(&dev_priv->irq_received);
784 795
@@ -787,6 +798,15 @@ static irqreturn_t ironlake_irq_handler(int irq, void *arg)
787 I915_WRITE(DEIER, de_ier & ~DE_MASTER_IRQ_CONTROL); 798 I915_WRITE(DEIER, de_ier & ~DE_MASTER_IRQ_CONTROL);
788 POSTING_READ(DEIER); 799 POSTING_READ(DEIER);
789 800
801 /* Disable south interrupts. We'll only write to SDEIIR once, so further
802 * interrupts will will be stored on its back queue, and then we'll be
803 * able to process them after we restore SDEIER (as soon as we restore
804 * it, we'll get an interrupt if SDEIIR still has something to process
805 * due to its back queue). */
806 sde_ier = I915_READ(SDEIER);
807 I915_WRITE(SDEIER, 0);
808 POSTING_READ(SDEIER);
809
790 de_iir = I915_READ(DEIIR); 810 de_iir = I915_READ(DEIIR);
791 gt_iir = I915_READ(GTIIR); 811 gt_iir = I915_READ(GTIIR);
792 pm_iir = I915_READ(GEN6_PMIIR); 812 pm_iir = I915_READ(GEN6_PMIIR);
@@ -849,6 +869,8 @@ static irqreturn_t ironlake_irq_handler(int irq, void *arg)
849done: 869done:
850 I915_WRITE(DEIER, de_ier); 870 I915_WRITE(DEIER, de_ier);
851 POSTING_READ(DEIER); 871 POSTING_READ(DEIER);
872 I915_WRITE(SDEIER, sde_ier);
873 POSTING_READ(SDEIER);
852 874
853 return ret; 875 return ret;
854} 876}
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 527b664d3434..848992f67d56 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -1613,9 +1613,9 @@
1613#define ADPA_CRT_HOTPLUG_FORCE_TRIGGER (1<<16) 1613#define ADPA_CRT_HOTPLUG_FORCE_TRIGGER (1<<16)
1614#define ADPA_USE_VGA_HVPOLARITY (1<<15) 1614#define ADPA_USE_VGA_HVPOLARITY (1<<15)
1615#define ADPA_SETS_HVPOLARITY 0 1615#define ADPA_SETS_HVPOLARITY 0
1616#define ADPA_VSYNC_CNTL_DISABLE (1<<11) 1616#define ADPA_VSYNC_CNTL_DISABLE (1<<10)
1617#define ADPA_VSYNC_CNTL_ENABLE 0 1617#define ADPA_VSYNC_CNTL_ENABLE 0
1618#define ADPA_HSYNC_CNTL_DISABLE (1<<10) 1618#define ADPA_HSYNC_CNTL_DISABLE (1<<11)
1619#define ADPA_HSYNC_CNTL_ENABLE 0 1619#define ADPA_HSYNC_CNTL_ENABLE 0
1620#define ADPA_VSYNC_ACTIVE_HIGH (1<<4) 1620#define ADPA_VSYNC_ACTIVE_HIGH (1<<4)
1621#define ADPA_VSYNC_ACTIVE_LOW 0 1621#define ADPA_VSYNC_ACTIVE_LOW 0
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 969d08c72d10..32a3693905ec 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -88,7 +88,7 @@ static void intel_disable_crt(struct intel_encoder *encoder)
88 u32 temp; 88 u32 temp;
89 89
90 temp = I915_READ(crt->adpa_reg); 90 temp = I915_READ(crt->adpa_reg);
91 temp &= ~(ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE); 91 temp |= ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE;
92 temp &= ~ADPA_DAC_ENABLE; 92 temp &= ~ADPA_DAC_ENABLE;
93 I915_WRITE(crt->adpa_reg, temp); 93 I915_WRITE(crt->adpa_reg, temp);
94} 94}
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index d64af5aa4a1c..8d0bac3c35d7 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -1391,8 +1391,8 @@ void intel_ddi_prepare_link_retrain(struct drm_encoder *encoder)
1391 struct intel_dp *intel_dp = &intel_dig_port->dp; 1391 struct intel_dp *intel_dp = &intel_dig_port->dp;
1392 struct drm_i915_private *dev_priv = encoder->dev->dev_private; 1392 struct drm_i915_private *dev_priv = encoder->dev->dev_private;
1393 enum port port = intel_dig_port->port; 1393 enum port port = intel_dig_port->port;
1394 bool wait;
1395 uint32_t val; 1394 uint32_t val;
1395 bool wait = false;
1396 1396
1397 if (I915_READ(DP_TP_CTL(port)) & DP_TP_CTL_ENABLE) { 1397 if (I915_READ(DP_TP_CTL(port)) & DP_TP_CTL_ENABLE) {
1398 val = I915_READ(DDI_BUF_CTL(port)); 1398 val = I915_READ(DDI_BUF_CTL(port));
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index a05ac2c91ba2..287b42c9d1a8 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3604,6 +3604,30 @@ static void intel_crtc_dpms_overlay(struct intel_crtc *intel_crtc, bool enable)
3604 */ 3604 */
3605} 3605}
3606 3606
3607/**
3608 * i9xx_fixup_plane - ugly workaround for G45 to fire up the hardware
3609 * cursor plane briefly if not already running after enabling the display
3610 * plane.
3611 * This workaround avoids occasional blank screens when self refresh is
3612 * enabled.
3613 */
3614static void
3615g4x_fixup_plane(struct drm_i915_private *dev_priv, enum pipe pipe)
3616{
3617 u32 cntl = I915_READ(CURCNTR(pipe));
3618
3619 if ((cntl & CURSOR_MODE) == 0) {
3620 u32 fw_bcl_self = I915_READ(FW_BLC_SELF);
3621
3622 I915_WRITE(FW_BLC_SELF, fw_bcl_self & ~FW_BLC_SELF_EN);
3623 I915_WRITE(CURCNTR(pipe), CURSOR_MODE_64_ARGB_AX);
3624 intel_wait_for_vblank(dev_priv->dev, pipe);
3625 I915_WRITE(CURCNTR(pipe), cntl);
3626 I915_WRITE(CURBASE(pipe), I915_READ(CURBASE(pipe)));
3627 I915_WRITE(FW_BLC_SELF, fw_bcl_self);
3628 }
3629}
3630
3607static void i9xx_crtc_enable(struct drm_crtc *crtc) 3631static void i9xx_crtc_enable(struct drm_crtc *crtc)
3608{ 3632{
3609 struct drm_device *dev = crtc->dev; 3633 struct drm_device *dev = crtc->dev;
@@ -3629,6 +3653,8 @@ static void i9xx_crtc_enable(struct drm_crtc *crtc)
3629 3653
3630 intel_enable_pipe(dev_priv, pipe, false); 3654 intel_enable_pipe(dev_priv, pipe, false);
3631 intel_enable_plane(dev_priv, plane, pipe); 3655 intel_enable_plane(dev_priv, plane, pipe);
3656 if (IS_G4X(dev))
3657 g4x_fixup_plane(dev_priv, pipe);
3632 3658
3633 intel_crtc_load_lut(crtc); 3659 intel_crtc_load_lut(crtc);
3634 intel_update_fbc(dev); 3660 intel_update_fbc(dev);
@@ -7256,8 +7282,8 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
7256{ 7282{
7257 struct drm_device *dev = crtc->dev; 7283 struct drm_device *dev = crtc->dev;
7258 struct drm_i915_private *dev_priv = dev->dev_private; 7284 struct drm_i915_private *dev_priv = dev->dev_private;
7259 struct intel_framebuffer *intel_fb; 7285 struct drm_framebuffer *old_fb = crtc->fb;
7260 struct drm_i915_gem_object *obj; 7286 struct drm_i915_gem_object *obj = to_intel_framebuffer(fb)->obj;
7261 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 7287 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
7262 struct intel_unpin_work *work; 7288 struct intel_unpin_work *work;
7263 unsigned long flags; 7289 unsigned long flags;
@@ -7282,8 +7308,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
7282 7308
7283 work->event = event; 7309 work->event = event;
7284 work->crtc = crtc; 7310 work->crtc = crtc;
7285 intel_fb = to_intel_framebuffer(crtc->fb); 7311 work->old_fb_obj = to_intel_framebuffer(old_fb)->obj;
7286 work->old_fb_obj = intel_fb->obj;
7287 INIT_WORK(&work->work, intel_unpin_work_fn); 7312 INIT_WORK(&work->work, intel_unpin_work_fn);
7288 7313
7289 ret = drm_vblank_get(dev, intel_crtc->pipe); 7314 ret = drm_vblank_get(dev, intel_crtc->pipe);
@@ -7303,9 +7328,6 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
7303 intel_crtc->unpin_work = work; 7328 intel_crtc->unpin_work = work;
7304 spin_unlock_irqrestore(&dev->event_lock, flags); 7329 spin_unlock_irqrestore(&dev->event_lock, flags);
7305 7330
7306 intel_fb = to_intel_framebuffer(fb);
7307 obj = intel_fb->obj;
7308
7309 if (atomic_read(&intel_crtc->unpin_work_count) >= 2) 7331 if (atomic_read(&intel_crtc->unpin_work_count) >= 2)
7310 flush_workqueue(dev_priv->wq); 7332 flush_workqueue(dev_priv->wq);
7311 7333
@@ -7340,6 +7362,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
7340 7362
7341cleanup_pending: 7363cleanup_pending:
7342 atomic_dec(&intel_crtc->unpin_work_count); 7364 atomic_dec(&intel_crtc->unpin_work_count);
7365 crtc->fb = old_fb;
7343 drm_gem_object_unreference(&work->old_fb_obj->base); 7366 drm_gem_object_unreference(&work->old_fb_obj->base);
7344 drm_gem_object_unreference(&obj->base); 7367 drm_gem_object_unreference(&obj->base);
7345 mutex_unlock(&dev->struct_mutex); 7368 mutex_unlock(&dev->struct_mutex);
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index f61cb7998c72..6f728e5ee793 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -353,7 +353,8 @@ intel_dp_aux_wait_done(struct intel_dp *intel_dp, bool has_aux_irq)
353 353
354#define C (((status = I915_READ_NOTRACE(ch_ctl)) & DP_AUX_CH_CTL_SEND_BUSY) == 0) 354#define C (((status = I915_READ_NOTRACE(ch_ctl)) & DP_AUX_CH_CTL_SEND_BUSY) == 0)
355 if (has_aux_irq) 355 if (has_aux_irq)
356 done = wait_event_timeout(dev_priv->gmbus_wait_queue, C, 10); 356 done = wait_event_timeout(dev_priv->gmbus_wait_queue, C,
357 msecs_to_jiffies(10));
357 else 358 else
358 done = wait_for_atomic(C, 10) == 0; 359 done = wait_for_atomic(C, 10) == 0;
359 if (!done) 360 if (!done)
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 61fee7fcdc2c..a1794c6df1bf 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -2574,7 +2574,7 @@ static void gen6_enable_rps(struct drm_device *dev)
2574 I915_WRITE(GEN6_RC_SLEEP, 0); 2574 I915_WRITE(GEN6_RC_SLEEP, 0);
2575 I915_WRITE(GEN6_RC1e_THRESHOLD, 1000); 2575 I915_WRITE(GEN6_RC1e_THRESHOLD, 1000);
2576 I915_WRITE(GEN6_RC6_THRESHOLD, 50000); 2576 I915_WRITE(GEN6_RC6_THRESHOLD, 50000);
2577 I915_WRITE(GEN6_RC6p_THRESHOLD, 100000); 2577 I915_WRITE(GEN6_RC6p_THRESHOLD, 150000);
2578 I915_WRITE(GEN6_RC6pp_THRESHOLD, 64000); /* unused */ 2578 I915_WRITE(GEN6_RC6pp_THRESHOLD, 64000); /* unused */
2579 2579
2580 /* Check if we are enabling RC6 */ 2580 /* Check if we are enabling RC6 */
diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.h b/drivers/gpu/drm/mgag200/mgag200_drv.h
index 5ea5033eae0a..4d932c46725d 100644
--- a/drivers/gpu/drm/mgag200/mgag200_drv.h
+++ b/drivers/gpu/drm/mgag200/mgag200_drv.h
@@ -112,7 +112,6 @@ struct mga_framebuffer {
112struct mga_fbdev { 112struct mga_fbdev {
113 struct drm_fb_helper helper; 113 struct drm_fb_helper helper;
114 struct mga_framebuffer mfb; 114 struct mga_framebuffer mfb;
115 struct list_head fbdev_list;
116 void *sysram; 115 void *sysram;
117 int size; 116 int size;
118 struct ttm_bo_kmap_obj mapping; 117 struct ttm_bo_kmap_obj mapping;
diff --git a/drivers/gpu/drm/mgag200/mgag200_i2c.c b/drivers/gpu/drm/mgag200/mgag200_i2c.c
index 5a88ec51b513..d3dcf54e6233 100644
--- a/drivers/gpu/drm/mgag200/mgag200_i2c.c
+++ b/drivers/gpu/drm/mgag200/mgag200_i2c.c
@@ -92,6 +92,7 @@ struct mga_i2c_chan *mgag200_i2c_create(struct drm_device *dev)
92 int ret; 92 int ret;
93 int data, clock; 93 int data, clock;
94 94
95 WREG_DAC(MGA1064_GEN_IO_CTL2, 1);
95 WREG_DAC(MGA1064_GEN_IO_DATA, 0xff); 96 WREG_DAC(MGA1064_GEN_IO_DATA, 0xff);
96 WREG_DAC(MGA1064_GEN_IO_CTL, 0); 97 WREG_DAC(MGA1064_GEN_IO_CTL, 0);
97 98
diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c
index d3d99a28ddef..a274b9906ef8 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -1406,6 +1406,14 @@ static int mga_vga_get_modes(struct drm_connector *connector)
1406static int mga_vga_mode_valid(struct drm_connector *connector, 1406static int mga_vga_mode_valid(struct drm_connector *connector,
1407 struct drm_display_mode *mode) 1407 struct drm_display_mode *mode)
1408{ 1408{
1409 struct drm_device *dev = connector->dev;
1410 struct mga_device *mdev = (struct mga_device*)dev->dev_private;
1411 struct mga_fbdev *mfbdev = mdev->mfbdev;
1412 struct drm_fb_helper *fb_helper = &mfbdev->helper;
1413 struct drm_fb_helper_connector *fb_helper_conn = NULL;
1414 int bpp = 32;
1415 int i = 0;
1416
1409 /* FIXME: Add bandwidth and g200se limitations */ 1417 /* FIXME: Add bandwidth and g200se limitations */
1410 1418
1411 if (mode->crtc_hdisplay > 2048 || mode->crtc_hsync_start > 4096 || 1419 if (mode->crtc_hdisplay > 2048 || mode->crtc_hsync_start > 4096 ||
@@ -1415,6 +1423,25 @@ static int mga_vga_mode_valid(struct drm_connector *connector,
1415 return MODE_BAD; 1423 return MODE_BAD;
1416 } 1424 }
1417 1425
1426 /* Validate the mode input by the user */
1427 for (i = 0; i < fb_helper->connector_count; i++) {
1428 if (fb_helper->connector_info[i]->connector == connector) {
1429 /* Found the helper for this connector */
1430 fb_helper_conn = fb_helper->connector_info[i];
1431 if (fb_helper_conn->cmdline_mode.specified) {
1432 if (fb_helper_conn->cmdline_mode.bpp_specified) {
1433 bpp = fb_helper_conn->cmdline_mode.bpp;
1434 }
1435 }
1436 }
1437 }
1438
1439 if ((mode->hdisplay * mode->vdisplay * (bpp/8)) > mdev->mc.vram_size) {
1440 if (fb_helper_conn)
1441 fb_helper_conn->cmdline_mode.specified = false;
1442 return MODE_BAD;
1443 }
1444
1418 return MODE_OK; 1445 return MODE_OK;
1419} 1446}
1420 1447
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nve0.c b/drivers/gpu/drm/nouveau/core/engine/graph/nve0.c
index 61cec0f6ff1c..4857f913efdd 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nve0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nve0.c
@@ -350,7 +350,7 @@ nve0_graph_init_gpc_0(struct nvc0_graph_priv *priv)
350 nv_wr32(priv, GPC_UNIT(gpc, 0x0918), magicgpc918); 350 nv_wr32(priv, GPC_UNIT(gpc, 0x0918), magicgpc918);
351 } 351 }
352 352
353 nv_wr32(priv, GPC_BCAST(0x1bd4), magicgpc918); 353 nv_wr32(priv, GPC_BCAST(0x3fd4), magicgpc918);
354 nv_wr32(priv, GPC_BCAST(0x08ac), nv_rd32(priv, 0x100800)); 354 nv_wr32(priv, GPC_BCAST(0x08ac), nv_rd32(priv, 0x100800));
355} 355}
356 356
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/init.c b/drivers/gpu/drm/nouveau/core/subdev/bios/init.c
index 2cc1e6a5eb6a..9c41b58d57e2 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/init.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/init.c
@@ -869,7 +869,7 @@ init_idx_addr_latched(struct nvbios_init *init)
869 init->offset += 2; 869 init->offset += 2;
870 870
871 init_wr32(init, dreg, idata); 871 init_wr32(init, dreg, idata);
872 init_mask(init, creg, ~mask, data | idata); 872 init_mask(init, creg, ~mask, data | iaddr);
873 } 873 }
874} 874}
875 875
diff --git a/drivers/gpu/drm/nouveau/core/subdev/i2c/base.c b/drivers/gpu/drm/nouveau/core/subdev/i2c/base.c
index a114a0ed7e98..2e98e8a3f1aa 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/i2c/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/i2c/base.c
@@ -142,6 +142,7 @@ nouveau_i2c_port_create_(struct nouveau_object *parent,
142 /* drop port's i2c subdev refcount, i2c handles this itself */ 142 /* drop port's i2c subdev refcount, i2c handles this itself */
143 if (ret == 0) { 143 if (ret == 0) {
144 list_add_tail(&port->head, &i2c->ports); 144 list_add_tail(&port->head, &i2c->ports);
145 atomic_dec(&parent->refcount);
145 atomic_dec(&engine->refcount); 146 atomic_dec(&engine->refcount);
146 } 147 }
147 148
diff --git a/drivers/gpu/drm/nouveau/nouveau_agp.c b/drivers/gpu/drm/nouveau/nouveau_agp.c
index d28430cd2ba6..6e7a55f93a85 100644
--- a/drivers/gpu/drm/nouveau/nouveau_agp.c
+++ b/drivers/gpu/drm/nouveau/nouveau_agp.c
@@ -47,6 +47,18 @@ nouveau_agp_enabled(struct nouveau_drm *drm)
47 if (drm->agp.stat == UNKNOWN) { 47 if (drm->agp.stat == UNKNOWN) {
48 if (!nouveau_agpmode) 48 if (!nouveau_agpmode)
49 return false; 49 return false;
50#ifdef __powerpc__
51 /* Disable AGP by default on all PowerPC machines for
52 * now -- At least some UniNorth-2 AGP bridges are
53 * known to be broken: DMA from the host to the card
54 * works just fine, but writeback from the card to the
55 * host goes straight to memory untranslated bypassing
56 * the GATT somehow, making them quite painful to deal
57 * with...
58 */
59 if (nouveau_agpmode == -1)
60 return false;
61#endif
50 return true; 62 return true;
51 } 63 }
52 64
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index a6237c9cbbc3..87a5a56ed358 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -55,9 +55,9 @@
55 55
56/* offsets in shared sync bo of various structures */ 56/* offsets in shared sync bo of various structures */
57#define EVO_SYNC(c, o) ((c) * 0x0100 + (o)) 57#define EVO_SYNC(c, o) ((c) * 0x0100 + (o))
58#define EVO_MAST_NTFY EVO_SYNC( 0, 0x00) 58#define EVO_MAST_NTFY EVO_SYNC( 0, 0x00)
59#define EVO_FLIP_SEM0(c) EVO_SYNC((c), 0x00) 59#define EVO_FLIP_SEM0(c) EVO_SYNC((c) + 1, 0x00)
60#define EVO_FLIP_SEM1(c) EVO_SYNC((c), 0x10) 60#define EVO_FLIP_SEM1(c) EVO_SYNC((c) + 1, 0x10)
61 61
62#define EVO_CORE_HANDLE (0xd1500000) 62#define EVO_CORE_HANDLE (0xd1500000)
63#define EVO_CHAN_HANDLE(t,i) (0xd15c0000 | (((t) & 0x00ff) << 8) | (i)) 63#define EVO_CHAN_HANDLE(t,i) (0xd15c0000 | (((t) & 0x00ff) << 8) | (i))
@@ -341,10 +341,8 @@ struct nv50_curs {
341 341
342struct nv50_sync { 342struct nv50_sync {
343 struct nv50_dmac base; 343 struct nv50_dmac base;
344 struct { 344 u32 addr;
345 u32 offset; 345 u32 data;
346 u16 value;
347 } sem;
348}; 346};
349 347
350struct nv50_ovly { 348struct nv50_ovly {
@@ -471,13 +469,33 @@ nv50_display_crtc_sema(struct drm_device *dev, int crtc)
471 return nv50_disp(dev)->sync; 469 return nv50_disp(dev)->sync;
472} 470}
473 471
472struct nv50_display_flip {
473 struct nv50_disp *disp;
474 struct nv50_sync *chan;
475};
476
477static bool
478nv50_display_flip_wait(void *data)
479{
480 struct nv50_display_flip *flip = data;
481 if (nouveau_bo_rd32(flip->disp->sync, flip->chan->addr / 4) ==
482 flip->chan->data);
483 return true;
484 usleep_range(1, 2);
485 return false;
486}
487
474void 488void
475nv50_display_flip_stop(struct drm_crtc *crtc) 489nv50_display_flip_stop(struct drm_crtc *crtc)
476{ 490{
477 struct nv50_sync *sync = nv50_sync(crtc); 491 struct nouveau_device *device = nouveau_dev(crtc->dev);
492 struct nv50_display_flip flip = {
493 .disp = nv50_disp(crtc->dev),
494 .chan = nv50_sync(crtc),
495 };
478 u32 *push; 496 u32 *push;
479 497
480 push = evo_wait(sync, 8); 498 push = evo_wait(flip.chan, 8);
481 if (push) { 499 if (push) {
482 evo_mthd(push, 0x0084, 1); 500 evo_mthd(push, 0x0084, 1);
483 evo_data(push, 0x00000000); 501 evo_data(push, 0x00000000);
@@ -487,8 +505,10 @@ nv50_display_flip_stop(struct drm_crtc *crtc)
487 evo_data(push, 0x00000000); 505 evo_data(push, 0x00000000);
488 evo_mthd(push, 0x0080, 1); 506 evo_mthd(push, 0x0080, 1);
489 evo_data(push, 0x00000000); 507 evo_data(push, 0x00000000);
490 evo_kick(push, sync); 508 evo_kick(push, flip.chan);
491 } 509 }
510
511 nv_wait_cb(device, nv50_display_flip_wait, &flip);
492} 512}
493 513
494int 514int
@@ -496,11 +516,10 @@ nv50_display_flip_next(struct drm_crtc *crtc, struct drm_framebuffer *fb,
496 struct nouveau_channel *chan, u32 swap_interval) 516 struct nouveau_channel *chan, u32 swap_interval)
497{ 517{
498 struct nouveau_framebuffer *nv_fb = nouveau_framebuffer(fb); 518 struct nouveau_framebuffer *nv_fb = nouveau_framebuffer(fb);
499 struct nv50_disp *disp = nv50_disp(crtc->dev);
500 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); 519 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
501 struct nv50_sync *sync = nv50_sync(crtc); 520 struct nv50_sync *sync = nv50_sync(crtc);
521 int head = nv_crtc->index, ret;
502 u32 *push; 522 u32 *push;
503 int ret;
504 523
505 swap_interval <<= 4; 524 swap_interval <<= 4;
506 if (swap_interval == 0) 525 if (swap_interval == 0)
@@ -510,58 +529,64 @@ nv50_display_flip_next(struct drm_crtc *crtc, struct drm_framebuffer *fb,
510 if (unlikely(push == NULL)) 529 if (unlikely(push == NULL))
511 return -EBUSY; 530 return -EBUSY;
512 531
513 /* synchronise with the rendering channel, if necessary */ 532 if (chan && nv_mclass(chan->object) < NV84_CHANNEL_IND_CLASS) {
514 if (likely(chan)) { 533 ret = RING_SPACE(chan, 8);
534 if (ret)
535 return ret;
536
537 BEGIN_NV04(chan, 0, NV11_SUBCHAN_DMA_SEMAPHORE, 2);
538 OUT_RING (chan, NvEvoSema0 + head);
539 OUT_RING (chan, sync->addr ^ 0x10);
540 BEGIN_NV04(chan, 0, NV11_SUBCHAN_SEMAPHORE_RELEASE, 1);
541 OUT_RING (chan, sync->data + 1);
542 BEGIN_NV04(chan, 0, NV11_SUBCHAN_SEMAPHORE_OFFSET, 2);
543 OUT_RING (chan, sync->addr);
544 OUT_RING (chan, sync->data);
545 } else
546 if (chan && nv_mclass(chan->object) < NVC0_CHANNEL_IND_CLASS) {
547 u64 addr = nv84_fence_crtc(chan, head) + sync->addr;
548 ret = RING_SPACE(chan, 12);
549 if (ret)
550 return ret;
551
552 BEGIN_NV04(chan, 0, NV11_SUBCHAN_DMA_SEMAPHORE, 1);
553 OUT_RING (chan, chan->vram);
554 BEGIN_NV04(chan, 0, NV84_SUBCHAN_SEMAPHORE_ADDRESS_HIGH, 4);
555 OUT_RING (chan, upper_32_bits(addr ^ 0x10));
556 OUT_RING (chan, lower_32_bits(addr ^ 0x10));
557 OUT_RING (chan, sync->data + 1);
558 OUT_RING (chan, NV84_SUBCHAN_SEMAPHORE_TRIGGER_WRITE_LONG);
559 BEGIN_NV04(chan, 0, NV84_SUBCHAN_SEMAPHORE_ADDRESS_HIGH, 4);
560 OUT_RING (chan, upper_32_bits(addr));
561 OUT_RING (chan, lower_32_bits(addr));
562 OUT_RING (chan, sync->data);
563 OUT_RING (chan, NV84_SUBCHAN_SEMAPHORE_TRIGGER_ACQUIRE_EQUAL);
564 } else
565 if (chan) {
566 u64 addr = nv84_fence_crtc(chan, head) + sync->addr;
515 ret = RING_SPACE(chan, 10); 567 ret = RING_SPACE(chan, 10);
516 if (ret) 568 if (ret)
517 return ret; 569 return ret;
518 570
519 if (nv_mclass(chan->object) < NV84_CHANNEL_IND_CLASS) { 571 BEGIN_NVC0(chan, 0, NV84_SUBCHAN_SEMAPHORE_ADDRESS_HIGH, 4);
520 BEGIN_NV04(chan, 0, NV11_SUBCHAN_DMA_SEMAPHORE, 2); 572 OUT_RING (chan, upper_32_bits(addr ^ 0x10));
521 OUT_RING (chan, NvEvoSema0 + nv_crtc->index); 573 OUT_RING (chan, lower_32_bits(addr ^ 0x10));
522 OUT_RING (chan, sync->sem.offset); 574 OUT_RING (chan, sync->data + 1);
523 BEGIN_NV04(chan, 0, NV11_SUBCHAN_SEMAPHORE_RELEASE, 1); 575 OUT_RING (chan, NV84_SUBCHAN_SEMAPHORE_TRIGGER_WRITE_LONG |
524 OUT_RING (chan, 0xf00d0000 | sync->sem.value); 576 NVC0_SUBCHAN_SEMAPHORE_TRIGGER_YIELD);
525 BEGIN_NV04(chan, 0, NV11_SUBCHAN_SEMAPHORE_OFFSET, 2); 577 BEGIN_NVC0(chan, 0, NV84_SUBCHAN_SEMAPHORE_ADDRESS_HIGH, 4);
526 OUT_RING (chan, sync->sem.offset ^ 0x10); 578 OUT_RING (chan, upper_32_bits(addr));
527 OUT_RING (chan, 0x74b1e000); 579 OUT_RING (chan, lower_32_bits(addr));
528 BEGIN_NV04(chan, 0, NV11_SUBCHAN_DMA_SEMAPHORE, 1); 580 OUT_RING (chan, sync->data);
529 OUT_RING (chan, NvSema); 581 OUT_RING (chan, NV84_SUBCHAN_SEMAPHORE_TRIGGER_ACQUIRE_EQUAL |
530 } else 582 NVC0_SUBCHAN_SEMAPHORE_TRIGGER_YIELD);
531 if (nv_mclass(chan->object) < NVC0_CHANNEL_IND_CLASS) { 583 }
532 u64 offset = nv84_fence_crtc(chan, nv_crtc->index);
533 offset += sync->sem.offset;
534
535 BEGIN_NV04(chan, 0, NV84_SUBCHAN_SEMAPHORE_ADDRESS_HIGH, 4);
536 OUT_RING (chan, upper_32_bits(offset));
537 OUT_RING (chan, lower_32_bits(offset));
538 OUT_RING (chan, 0xf00d0000 | sync->sem.value);
539 OUT_RING (chan, 0x00000002);
540 BEGIN_NV04(chan, 0, NV84_SUBCHAN_SEMAPHORE_ADDRESS_HIGH, 4);
541 OUT_RING (chan, upper_32_bits(offset));
542 OUT_RING (chan, lower_32_bits(offset ^ 0x10));
543 OUT_RING (chan, 0x74b1e000);
544 OUT_RING (chan, 0x00000001);
545 } else {
546 u64 offset = nv84_fence_crtc(chan, nv_crtc->index);
547 offset += sync->sem.offset;
548
549 BEGIN_NVC0(chan, 0, NV84_SUBCHAN_SEMAPHORE_ADDRESS_HIGH, 4);
550 OUT_RING (chan, upper_32_bits(offset));
551 OUT_RING (chan, lower_32_bits(offset));
552 OUT_RING (chan, 0xf00d0000 | sync->sem.value);
553 OUT_RING (chan, 0x00001002);
554 BEGIN_NVC0(chan, 0, NV84_SUBCHAN_SEMAPHORE_ADDRESS_HIGH, 4);
555 OUT_RING (chan, upper_32_bits(offset));
556 OUT_RING (chan, lower_32_bits(offset ^ 0x10));
557 OUT_RING (chan, 0x74b1e000);
558 OUT_RING (chan, 0x00001001);
559 }
560 584
585 if (chan) {
586 sync->addr ^= 0x10;
587 sync->data++;
561 FIRE_RING (chan); 588 FIRE_RING (chan);
562 } else { 589 } else {
563 nouveau_bo_wr32(disp->sync, sync->sem.offset / 4,
564 0xf00d0000 | sync->sem.value);
565 evo_sync(crtc->dev); 590 evo_sync(crtc->dev);
566 } 591 }
567 592
@@ -575,9 +600,9 @@ nv50_display_flip_next(struct drm_crtc *crtc, struct drm_framebuffer *fb,
575 evo_data(push, 0x40000000); 600 evo_data(push, 0x40000000);
576 } 601 }
577 evo_mthd(push, 0x0088, 4); 602 evo_mthd(push, 0x0088, 4);
578 evo_data(push, sync->sem.offset); 603 evo_data(push, sync->addr);
579 evo_data(push, 0xf00d0000 | sync->sem.value); 604 evo_data(push, sync->data++);
580 evo_data(push, 0x74b1e000); 605 evo_data(push, sync->data);
581 evo_data(push, NvEvoSync); 606 evo_data(push, NvEvoSync);
582 evo_mthd(push, 0x00a0, 2); 607 evo_mthd(push, 0x00a0, 2);
583 evo_data(push, 0x00000000); 608 evo_data(push, 0x00000000);
@@ -605,9 +630,6 @@ nv50_display_flip_next(struct drm_crtc *crtc, struct drm_framebuffer *fb,
605 evo_mthd(push, 0x0080, 1); 630 evo_mthd(push, 0x0080, 1);
606 evo_data(push, 0x00000000); 631 evo_data(push, 0x00000000);
607 evo_kick(push, sync); 632 evo_kick(push, sync);
608
609 sync->sem.offset ^= 0x10;
610 sync->sem.value++;
611 return 0; 633 return 0;
612} 634}
613 635
@@ -1379,7 +1401,8 @@ nv50_crtc_create(struct drm_device *dev, struct nouveau_object *core, int index)
1379 if (ret) 1401 if (ret)
1380 goto out; 1402 goto out;
1381 1403
1382 head->sync.sem.offset = EVO_SYNC(1 + index, 0x00); 1404 head->sync.addr = EVO_FLIP_SEM0(index);
1405 head->sync.data = 0x00000000;
1383 1406
1384 /* allocate overlay resources */ 1407 /* allocate overlay resources */
1385 ret = nv50_pioc_create(disp->core, NV50_DISP_OIMM_CLASS, index, 1408 ret = nv50_pioc_create(disp->core, NV50_DISP_OIMM_CLASS, index,
@@ -2112,15 +2135,23 @@ nv50_display_fini(struct drm_device *dev)
2112int 2135int
2113nv50_display_init(struct drm_device *dev) 2136nv50_display_init(struct drm_device *dev)
2114{ 2137{
2115 u32 *push = evo_wait(nv50_mast(dev), 32); 2138 struct nv50_disp *disp = nv50_disp(dev);
2116 if (push) { 2139 struct drm_crtc *crtc;
2117 evo_mthd(push, 0x0088, 1); 2140 u32 *push;
2118 evo_data(push, NvEvoSync); 2141
2119 evo_kick(push, nv50_mast(dev)); 2142 push = evo_wait(nv50_mast(dev), 32);
2120 return 0; 2143 if (!push)
2144 return -EBUSY;
2145
2146 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
2147 struct nv50_sync *sync = nv50_sync(crtc);
2148 nouveau_bo_wr32(disp->sync, sync->addr / 4, sync->data);
2121 } 2149 }
2122 2150
2123 return -EBUSY; 2151 evo_mthd(push, 0x0088, 1);
2152 evo_data(push, NvEvoSync);
2153 evo_kick(push, nv50_mast(dev));
2154 return 0;
2124} 2155}
2125 2156
2126void 2157void
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 3c38ea46531c..305a657bf215 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -2438,6 +2438,12 @@ static u32 evergreen_gpu_check_soft_reset(struct radeon_device *rdev)
2438 if (tmp & L2_BUSY) 2438 if (tmp & L2_BUSY)
2439 reset_mask |= RADEON_RESET_VMC; 2439 reset_mask |= RADEON_RESET_VMC;
2440 2440
2441 /* Skip MC reset as it's mostly likely not hung, just busy */
2442 if (reset_mask & RADEON_RESET_MC) {
2443 DRM_DEBUG("MC busy: 0x%08X, clearing.\n", reset_mask);
2444 reset_mask &= ~RADEON_RESET_MC;
2445 }
2446
2441 return reset_mask; 2447 return reset_mask;
2442} 2448}
2443 2449
diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c
index 99fb13286fd0..eb8ac315f92f 100644
--- a/drivers/gpu/drm/radeon/evergreen_cs.c
+++ b/drivers/gpu/drm/radeon/evergreen_cs.c
@@ -834,7 +834,7 @@ static int evergreen_cs_track_validate_texture(struct radeon_cs_parser *p,
834 __func__, __LINE__, toffset, surf.base_align); 834 __func__, __LINE__, toffset, surf.base_align);
835 return -EINVAL; 835 return -EINVAL;
836 } 836 }
837 if (moffset & (surf.base_align - 1)) { 837 if (surf.nsamples <= 1 && moffset & (surf.base_align - 1)) {
838 dev_warn(p->dev, "%s:%d mipmap bo base %ld not aligned with %ld\n", 838 dev_warn(p->dev, "%s:%d mipmap bo base %ld not aligned with %ld\n",
839 __func__, __LINE__, moffset, surf.base_align); 839 __func__, __LINE__, moffset, surf.base_align);
840 return -EINVAL; 840 return -EINVAL;
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c
index 7cead763be9e..d4c633e12863 100644
--- a/drivers/gpu/drm/radeon/ni.c
+++ b/drivers/gpu/drm/radeon/ni.c
@@ -1381,6 +1381,12 @@ static u32 cayman_gpu_check_soft_reset(struct radeon_device *rdev)
1381 if (tmp & L2_BUSY) 1381 if (tmp & L2_BUSY)
1382 reset_mask |= RADEON_RESET_VMC; 1382 reset_mask |= RADEON_RESET_VMC;
1383 1383
1384 /* Skip MC reset as it's mostly likely not hung, just busy */
1385 if (reset_mask & RADEON_RESET_MC) {
1386 DRM_DEBUG("MC busy: 0x%08X, clearing.\n", reset_mask);
1387 reset_mask &= ~RADEON_RESET_MC;
1388 }
1389
1384 return reset_mask; 1390 return reset_mask;
1385} 1391}
1386 1392
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 6d4b5611daf4..0740db3fcd22 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -1394,6 +1394,12 @@ static u32 r600_gpu_check_soft_reset(struct radeon_device *rdev)
1394 if (r600_is_display_hung(rdev)) 1394 if (r600_is_display_hung(rdev))
1395 reset_mask |= RADEON_RESET_DISPLAY; 1395 reset_mask |= RADEON_RESET_DISPLAY;
1396 1396
1397 /* Skip MC reset as it's mostly likely not hung, just busy */
1398 if (reset_mask & RADEON_RESET_MC) {
1399 DRM_DEBUG("MC busy: 0x%08X, clearing.\n", reset_mask);
1400 reset_mask &= ~RADEON_RESET_MC;
1401 }
1402
1397 return reset_mask; 1403 return reset_mask;
1398} 1404}
1399 1405
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c
index 3e403bdda58f..78edadc9e86b 100644
--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -970,6 +970,15 @@ struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct
970 found = 1; 970 found = 1;
971 } 971 }
972 972
973 /* quirks */
974 /* Radeon 9100 (R200) */
975 if ((dev->pdev->device == 0x514D) &&
976 (dev->pdev->subsystem_vendor == 0x174B) &&
977 (dev->pdev->subsystem_device == 0x7149)) {
978 /* vbios value is bad, use the default */
979 found = 0;
980 }
981
973 if (!found) /* fallback to defaults */ 982 if (!found) /* fallback to defaults */
974 radeon_legacy_get_primary_dac_info_from_table(rdev, p_dac); 983 radeon_legacy_get_primary_dac_info_from_table(rdev, p_dac);
975 984
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 167758488ed6..66a7f0fd9620 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -70,9 +70,10 @@
70 * 2.27.0 - r600-SI: Add CS ioctl support for async DMA 70 * 2.27.0 - r600-SI: Add CS ioctl support for async DMA
71 * 2.28.0 - r600-eg: Add MEM_WRITE packet support 71 * 2.28.0 - r600-eg: Add MEM_WRITE packet support
72 * 2.29.0 - R500 FP16 color clear registers 72 * 2.29.0 - R500 FP16 color clear registers
73 * 2.30.0 - fix for FMASK texturing
73 */ 74 */
74#define KMS_DRIVER_MAJOR 2 75#define KMS_DRIVER_MAJOR 2
75#define KMS_DRIVER_MINOR 29 76#define KMS_DRIVER_MINOR 30
76#define KMS_DRIVER_PATCHLEVEL 0 77#define KMS_DRIVER_PATCHLEVEL 0
77int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); 78int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
78int radeon_driver_unload_kms(struct drm_device *dev); 79int radeon_driver_unload_kms(struct drm_device *dev);
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c
index 90374dd77960..48f80cd42d8f 100644
--- a/drivers/gpu/drm/radeon/radeon_irq_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c
@@ -400,6 +400,9 @@ void radeon_irq_kms_enable_afmt(struct radeon_device *rdev, int block)
400{ 400{
401 unsigned long irqflags; 401 unsigned long irqflags;
402 402
403 if (!rdev->ddev->irq_enabled)
404 return;
405
403 spin_lock_irqsave(&rdev->irq.lock, irqflags); 406 spin_lock_irqsave(&rdev->irq.lock, irqflags);
404 rdev->irq.afmt[block] = true; 407 rdev->irq.afmt[block] = true;
405 radeon_irq_set(rdev); 408 radeon_irq_set(rdev);
@@ -419,6 +422,9 @@ void radeon_irq_kms_disable_afmt(struct radeon_device *rdev, int block)
419{ 422{
420 unsigned long irqflags; 423 unsigned long irqflags;
421 424
425 if (!rdev->ddev->irq_enabled)
426 return;
427
422 spin_lock_irqsave(&rdev->irq.lock, irqflags); 428 spin_lock_irqsave(&rdev->irq.lock, irqflags);
423 rdev->irq.afmt[block] = false; 429 rdev->irq.afmt[block] = false;
424 radeon_irq_set(rdev); 430 radeon_irq_set(rdev);
@@ -438,6 +444,9 @@ void radeon_irq_kms_enable_hpd(struct radeon_device *rdev, unsigned hpd_mask)
438 unsigned long irqflags; 444 unsigned long irqflags;
439 int i; 445 int i;
440 446
447 if (!rdev->ddev->irq_enabled)
448 return;
449
441 spin_lock_irqsave(&rdev->irq.lock, irqflags); 450 spin_lock_irqsave(&rdev->irq.lock, irqflags);
442 for (i = 0; i < RADEON_MAX_HPD_PINS; ++i) 451 for (i = 0; i < RADEON_MAX_HPD_PINS; ++i)
443 rdev->irq.hpd[i] |= !!(hpd_mask & (1 << i)); 452 rdev->irq.hpd[i] |= !!(hpd_mask & (1 << i));
@@ -458,6 +467,9 @@ void radeon_irq_kms_disable_hpd(struct radeon_device *rdev, unsigned hpd_mask)
458 unsigned long irqflags; 467 unsigned long irqflags;
459 int i; 468 int i;
460 469
470 if (!rdev->ddev->irq_enabled)
471 return;
472
461 spin_lock_irqsave(&rdev->irq.lock, irqflags); 473 spin_lock_irqsave(&rdev->irq.lock, irqflags);
462 for (i = 0; i < RADEON_MAX_HPD_PINS; ++i) 474 for (i = 0; i < RADEON_MAX_HPD_PINS; ++i)
463 rdev->irq.hpd[i] &= !(hpd_mask & (1 << i)); 475 rdev->irq.hpd[i] &= !(hpd_mask & (1 << i));
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
index 80979ed951eb..9128120da044 100644
--- a/drivers/gpu/drm/radeon/si.c
+++ b/drivers/gpu/drm/radeon/si.c
@@ -2284,6 +2284,12 @@ static u32 si_gpu_check_soft_reset(struct radeon_device *rdev)
2284 if (tmp & L2_BUSY) 2284 if (tmp & L2_BUSY)
2285 reset_mask |= RADEON_RESET_VMC; 2285 reset_mask |= RADEON_RESET_VMC;
2286 2286
2287 /* Skip MC reset as it's mostly likely not hung, just busy */
2288 if (reset_mask & RADEON_RESET_MC) {
2289 DRM_DEBUG("MC busy: 0x%08X, clearing.\n", reset_mask);
2290 reset_mask &= ~RADEON_RESET_MC;
2291 }
2292
2287 return reset_mask; 2293 return reset_mask;
2288} 2294}
2289 2295
diff --git a/drivers/gpu/drm/tegra/Kconfig b/drivers/gpu/drm/tegra/Kconfig
index c92955df0658..be1daf7344d3 100644
--- a/drivers/gpu/drm/tegra/Kconfig
+++ b/drivers/gpu/drm/tegra/Kconfig
@@ -4,7 +4,6 @@ config DRM_TEGRA
4 select DRM_KMS_HELPER 4 select DRM_KMS_HELPER
5 select DRM_GEM_CMA_HELPER 5 select DRM_GEM_CMA_HELPER
6 select DRM_KMS_CMA_HELPER 6 select DRM_KMS_CMA_HELPER
7 select DRM_HDMI
8 select FB_CFB_FILLRECT 7 select FB_CFB_FILLRECT
9 select FB_CFB_COPYAREA 8 select FB_CFB_COPYAREA
10 select FB_CFB_IMAGEBLIT 9 select FB_CFB_IMAGEBLIT
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
index 9500f2f3f8fe..8758f38c948c 100644
--- a/drivers/hid/hid-logitech-dj.c
+++ b/drivers/hid/hid-logitech-dj.c
@@ -459,19 +459,25 @@ static int logi_dj_recv_send_report(struct dj_receiver_dev *djrcv_dev,
459 struct dj_report *dj_report) 459 struct dj_report *dj_report)
460{ 460{
461 struct hid_device *hdev = djrcv_dev->hdev; 461 struct hid_device *hdev = djrcv_dev->hdev;
462 int sent_bytes; 462 struct hid_report *report;
463 struct hid_report_enum *output_report_enum;
464 u8 *data = (u8 *)(&dj_report->device_index);
465 int i;
463 466
464 if (!hdev->hid_output_raw_report) { 467 output_report_enum = &hdev->report_enum[HID_OUTPUT_REPORT];
465 dev_err(&hdev->dev, "%s:" 468 report = output_report_enum->report_id_hash[REPORT_ID_DJ_SHORT];
466 "hid_output_raw_report is null\n", __func__); 469
470 if (!report) {
471 dev_err(&hdev->dev, "%s: unable to find dj report\n", __func__);
467 return -ENODEV; 472 return -ENODEV;
468 } 473 }
469 474
470 sent_bytes = hdev->hid_output_raw_report(hdev, (u8 *) dj_report, 475 for (i = 0; i < report->field[0]->report_count; i++)
471 sizeof(struct dj_report), 476 report->field[0]->value[i] = data[i];
472 HID_OUTPUT_REPORT); 477
478 usbhid_submit_report(hdev, report, USB_DIR_OUT);
473 479
474 return (sent_bytes < 0) ? sent_bytes : 0; 480 return 0;
475} 481}
476 482
477static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev) 483static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev)
diff --git a/drivers/hwmon/pmbus/ltc2978.c b/drivers/hwmon/pmbus/ltc2978.c
index 9652a2c92a24..a58de38e23d8 100644
--- a/drivers/hwmon/pmbus/ltc2978.c
+++ b/drivers/hwmon/pmbus/ltc2978.c
@@ -62,7 +62,7 @@ struct ltc2978_data {
62 int temp_min, temp_max; 62 int temp_min, temp_max;
63 int vout_min[8], vout_max[8]; 63 int vout_min[8], vout_max[8];
64 int iout_max[2]; 64 int iout_max[2];
65 int temp2_max[2]; 65 int temp2_max;
66 struct pmbus_driver_info info; 66 struct pmbus_driver_info info;
67}; 67};
68 68
@@ -204,10 +204,9 @@ static int ltc3880_read_word_data(struct i2c_client *client, int page, int reg)
204 ret = pmbus_read_word_data(client, page, 204 ret = pmbus_read_word_data(client, page,
205 LTC3880_MFR_TEMPERATURE2_PEAK); 205 LTC3880_MFR_TEMPERATURE2_PEAK);
206 if (ret >= 0) { 206 if (ret >= 0) {
207 if (lin11_to_val(ret) 207 if (lin11_to_val(ret) > lin11_to_val(data->temp2_max))
208 > lin11_to_val(data->temp2_max[page])) 208 data->temp2_max = ret;
209 data->temp2_max[page] = ret; 209 ret = data->temp2_max;
210 ret = data->temp2_max[page];
211 } 210 }
212 break; 211 break;
213 case PMBUS_VIRT_READ_VIN_MIN: 212 case PMBUS_VIRT_READ_VIN_MIN:
@@ -248,11 +247,11 @@ static int ltc2978_write_word_data(struct i2c_client *client, int page,
248 247
249 switch (reg) { 248 switch (reg) {
250 case PMBUS_VIRT_RESET_IOUT_HISTORY: 249 case PMBUS_VIRT_RESET_IOUT_HISTORY:
251 data->iout_max[page] = 0x7fff; 250 data->iout_max[page] = 0x7c00;
252 ret = ltc2978_clear_peaks(client, page, data->id); 251 ret = ltc2978_clear_peaks(client, page, data->id);
253 break; 252 break;
254 case PMBUS_VIRT_RESET_TEMP2_HISTORY: 253 case PMBUS_VIRT_RESET_TEMP2_HISTORY:
255 data->temp2_max[page] = 0x7fff; 254 data->temp2_max = 0x7c00;
256 ret = ltc2978_clear_peaks(client, page, data->id); 255 ret = ltc2978_clear_peaks(client, page, data->id);
257 break; 256 break;
258 case PMBUS_VIRT_RESET_VOUT_HISTORY: 257 case PMBUS_VIRT_RESET_VOUT_HISTORY:
@@ -262,12 +261,12 @@ static int ltc2978_write_word_data(struct i2c_client *client, int page,
262 break; 261 break;
263 case PMBUS_VIRT_RESET_VIN_HISTORY: 262 case PMBUS_VIRT_RESET_VIN_HISTORY:
264 data->vin_min = 0x7bff; 263 data->vin_min = 0x7bff;
265 data->vin_max = 0; 264 data->vin_max = 0x7c00;
266 ret = ltc2978_clear_peaks(client, page, data->id); 265 ret = ltc2978_clear_peaks(client, page, data->id);
267 break; 266 break;
268 case PMBUS_VIRT_RESET_TEMP_HISTORY: 267 case PMBUS_VIRT_RESET_TEMP_HISTORY:
269 data->temp_min = 0x7bff; 268 data->temp_min = 0x7bff;
270 data->temp_max = 0x7fff; 269 data->temp_max = 0x7c00;
271 ret = ltc2978_clear_peaks(client, page, data->id); 270 ret = ltc2978_clear_peaks(client, page, data->id);
272 break; 271 break;
273 default: 272 default:
@@ -321,12 +320,13 @@ static int ltc2978_probe(struct i2c_client *client,
321 info = &data->info; 320 info = &data->info;
322 info->write_word_data = ltc2978_write_word_data; 321 info->write_word_data = ltc2978_write_word_data;
323 322
324 data->vout_min[0] = 0xffff;
325 data->vin_min = 0x7bff; 323 data->vin_min = 0x7bff;
324 data->vin_max = 0x7c00;
326 data->temp_min = 0x7bff; 325 data->temp_min = 0x7bff;
327 data->temp_max = 0x7fff; 326 data->temp_max = 0x7c00;
327 data->temp2_max = 0x7c00;
328 328
329 switch (id->driver_data) { 329 switch (data->id) {
330 case ltc2978: 330 case ltc2978:
331 info->read_word_data = ltc2978_read_word_data; 331 info->read_word_data = ltc2978_read_word_data;
332 info->pages = 8; 332 info->pages = 8;
@@ -336,7 +336,6 @@ static int ltc2978_probe(struct i2c_client *client,
336 for (i = 1; i < 8; i++) { 336 for (i = 1; i < 8; i++) {
337 info->func[i] = PMBUS_HAVE_VOUT 337 info->func[i] = PMBUS_HAVE_VOUT
338 | PMBUS_HAVE_STATUS_VOUT; 338 | PMBUS_HAVE_STATUS_VOUT;
339 data->vout_min[i] = 0xffff;
340 } 339 }
341 break; 340 break;
342 case ltc3880: 341 case ltc3880:
@@ -352,11 +351,14 @@ static int ltc2978_probe(struct i2c_client *client,
352 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT 351 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT
353 | PMBUS_HAVE_POUT 352 | PMBUS_HAVE_POUT
354 | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP; 353 | PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;
355 data->vout_min[1] = 0xffff; 354 data->iout_max[0] = 0x7c00;
355 data->iout_max[1] = 0x7c00;
356 break; 356 break;
357 default: 357 default:
358 return -ENODEV; 358 return -ENODEV;
359 } 359 }
360 for (i = 0; i < info->pages; i++)
361 data->vout_min[i] = 0xffff;
360 362
361 return pmbus_do_probe(client, id, info); 363 return pmbus_do_probe(client, id, info);
362} 364}
diff --git a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c
index bfe326e896df..2507f902fb7a 100644
--- a/drivers/hwmon/sht15.c
+++ b/drivers/hwmon/sht15.c
@@ -965,7 +965,13 @@ static int sht15_probe(struct platform_device *pdev)
965 if (voltage) 965 if (voltage)
966 data->supply_uv = voltage; 966 data->supply_uv = voltage;
967 967
968 regulator_enable(data->reg); 968 ret = regulator_enable(data->reg);
969 if (ret != 0) {
970 dev_err(&pdev->dev,
971 "failed to enable regulator: %d\n", ret);
972 return ret;
973 }
974
969 /* 975 /*
970 * Setup a notifier block to update this if another device 976 * Setup a notifier block to update this if another device
971 * causes the voltage to change 977 * causes the voltage to change
diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c
index a479375a8fd8..e0c404bdc4a8 100644
--- a/drivers/infiniband/hw/ipath/ipath_fs.c
+++ b/drivers/infiniband/hw/ipath/ipath_fs.c
@@ -410,6 +410,7 @@ static struct file_system_type ipathfs_fs_type = {
410 .mount = ipathfs_mount, 410 .mount = ipathfs_mount,
411 .kill_sb = ipathfs_kill_super, 411 .kill_sb = ipathfs_kill_super,
412}; 412};
413MODULE_ALIAS_FS("ipathfs");
413 414
414int __init ipath_init_ipathfs(void) 415int __init ipath_init_ipathfs(void)
415{ 416{
diff --git a/drivers/infiniband/hw/qib/qib_fs.c b/drivers/infiniband/hw/qib/qib_fs.c
index 644bd6f6467c..f247fc6e6182 100644
--- a/drivers/infiniband/hw/qib/qib_fs.c
+++ b/drivers/infiniband/hw/qib/qib_fs.c
@@ -604,6 +604,7 @@ static struct file_system_type qibfs_fs_type = {
604 .mount = qibfs_mount, 604 .mount = qibfs_mount,
605 .kill_sb = qibfs_kill_super, 605 .kill_sb = qibfs_kill_super,
606}; 606};
607MODULE_ALIAS_FS("ipathfs");
607 608
608int __init qib_init_qibfs(void) 609int __init qib_init_qibfs(void)
609{ 610{
diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c
index 2fb0d76a04c4..208de7cbb7fa 100644
--- a/drivers/input/keyboard/tc3589x-keypad.c
+++ b/drivers/input/keyboard/tc3589x-keypad.c
@@ -70,8 +70,6 @@
70#define TC3589x_EVT_INT_CLR 0x2 70#define TC3589x_EVT_INT_CLR 0x2
71#define TC3589x_KBD_INT_CLR 0x1 71#define TC3589x_KBD_INT_CLR 0x1
72 72
73#define TC3589x_KBD_KEYMAP_SIZE 64
74
75/** 73/**
76 * struct tc_keypad - data structure used by keypad driver 74 * struct tc_keypad - data structure used by keypad driver
77 * @tc3589x: pointer to tc35893 75 * @tc3589x: pointer to tc35893
@@ -88,7 +86,7 @@ struct tc_keypad {
88 const struct tc3589x_keypad_platform_data *board; 86 const struct tc3589x_keypad_platform_data *board;
89 unsigned int krow; 87 unsigned int krow;
90 unsigned int kcol; 88 unsigned int kcol;
91 unsigned short keymap[TC3589x_KBD_KEYMAP_SIZE]; 89 unsigned short *keymap;
92 bool keypad_stopped; 90 bool keypad_stopped;
93}; 91};
94 92
@@ -338,12 +336,14 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)
338 336
339 error = matrix_keypad_build_keymap(plat->keymap_data, NULL, 337 error = matrix_keypad_build_keymap(plat->keymap_data, NULL,
340 TC3589x_MAX_KPROW, TC3589x_MAX_KPCOL, 338 TC3589x_MAX_KPROW, TC3589x_MAX_KPCOL,
341 keypad->keymap, input); 339 NULL, input);
342 if (error) { 340 if (error) {
343 dev_err(&pdev->dev, "Failed to build keymap\n"); 341 dev_err(&pdev->dev, "Failed to build keymap\n");
344 goto err_free_mem; 342 goto err_free_mem;
345 } 343 }
346 344
345 keypad->keymap = input->keycode;
346
347 input_set_capability(input, EV_MSC, MSC_SCAN); 347 input_set_capability(input, EV_MSC, MSC_SCAN);
348 if (!plat->no_autorepeat) 348 if (!plat->no_autorepeat)
349 __set_bit(EV_REP, input->evbit); 349 __set_bit(EV_REP, input->evbit);
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 7b99fc7c9438..0238e0e14335 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -490,6 +490,29 @@ static void alps_decode_rushmore(struct alps_fields *f, unsigned char *p)
490 f->y_map |= (p[5] & 0x20) << 6; 490 f->y_map |= (p[5] & 0x20) << 6;
491} 491}
492 492
493static void alps_decode_dolphin(struct alps_fields *f, unsigned char *p)
494{
495 f->first_mp = !!(p[0] & 0x02);
496 f->is_mp = !!(p[0] & 0x20);
497
498 f->fingers = ((p[0] & 0x6) >> 1 |
499 (p[0] & 0x10) >> 2);
500 f->x_map = ((p[2] & 0x60) >> 5) |
501 ((p[4] & 0x7f) << 2) |
502 ((p[5] & 0x7f) << 9) |
503 ((p[3] & 0x07) << 16) |
504 ((p[3] & 0x70) << 15) |
505 ((p[0] & 0x01) << 22);
506 f->y_map = (p[1] & 0x7f) |
507 ((p[2] & 0x1f) << 7);
508
509 f->x = ((p[1] & 0x7f) | ((p[4] & 0x0f) << 7));
510 f->y = ((p[2] & 0x7f) | ((p[4] & 0xf0) << 3));
511 f->z = (p[0] & 4) ? 0 : p[5] & 0x7f;
512
513 alps_decode_buttons_v3(f, p);
514}
515
493static void alps_process_touchpad_packet_v3(struct psmouse *psmouse) 516static void alps_process_touchpad_packet_v3(struct psmouse *psmouse)
494{ 517{
495 struct alps_data *priv = psmouse->private; 518 struct alps_data *priv = psmouse->private;
@@ -874,7 +897,8 @@ static psmouse_ret_t alps_process_byte(struct psmouse *psmouse)
874 } 897 }
875 898
876 /* Bytes 2 - pktsize should have 0 in the highest bit */ 899 /* Bytes 2 - pktsize should have 0 in the highest bit */
877 if (psmouse->pktcnt >= 2 && psmouse->pktcnt <= psmouse->pktsize && 900 if (priv->proto_version != ALPS_PROTO_V5 &&
901 psmouse->pktcnt >= 2 && psmouse->pktcnt <= psmouse->pktsize &&
878 (psmouse->packet[psmouse->pktcnt - 1] & 0x80)) { 902 (psmouse->packet[psmouse->pktcnt - 1] & 0x80)) {
879 psmouse_dbg(psmouse, "refusing packet[%i] = %x\n", 903 psmouse_dbg(psmouse, "refusing packet[%i] = %x\n",
880 psmouse->pktcnt - 1, 904 psmouse->pktcnt - 1,
@@ -994,8 +1018,7 @@ static int alps_rpt_cmd(struct psmouse *psmouse, int init_command,
994 return 0; 1018 return 0;
995} 1019}
996 1020
997static int alps_enter_command_mode(struct psmouse *psmouse, 1021static int alps_enter_command_mode(struct psmouse *psmouse)
998 unsigned char *resp)
999{ 1022{
1000 unsigned char param[4]; 1023 unsigned char param[4];
1001 1024
@@ -1004,14 +1027,12 @@ static int alps_enter_command_mode(struct psmouse *psmouse,
1004 return -1; 1027 return -1;
1005 } 1028 }
1006 1029
1007 if (param[0] != 0x88 || (param[1] != 0x07 && param[1] != 0x08)) { 1030 if ((param[0] != 0x88 || (param[1] != 0x07 && param[1] != 0x08)) &&
1031 param[0] != 0x73) {
1008 psmouse_dbg(psmouse, 1032 psmouse_dbg(psmouse,
1009 "unknown response while entering command mode\n"); 1033 "unknown response while entering command mode\n");
1010 return -1; 1034 return -1;
1011 } 1035 }
1012
1013 if (resp)
1014 *resp = param[2];
1015 return 0; 1036 return 0;
1016} 1037}
1017 1038
@@ -1176,7 +1197,7 @@ static int alps_passthrough_mode_v3(struct psmouse *psmouse,
1176{ 1197{
1177 int reg_val, ret = -1; 1198 int reg_val, ret = -1;
1178 1199
1179 if (alps_enter_command_mode(psmouse, NULL)) 1200 if (alps_enter_command_mode(psmouse))
1180 return -1; 1201 return -1;
1181 1202
1182 reg_val = alps_command_mode_read_reg(psmouse, reg_base + 0x0008); 1203 reg_val = alps_command_mode_read_reg(psmouse, reg_base + 0x0008);
@@ -1216,7 +1237,7 @@ static int alps_probe_trackstick_v3(struct psmouse *psmouse, int reg_base)
1216{ 1237{
1217 int ret = -EIO, reg_val; 1238 int ret = -EIO, reg_val;
1218 1239
1219 if (alps_enter_command_mode(psmouse, NULL)) 1240 if (alps_enter_command_mode(psmouse))
1220 goto error; 1241 goto error;
1221 1242
1222 reg_val = alps_command_mode_read_reg(psmouse, reg_base + 0x08); 1243 reg_val = alps_command_mode_read_reg(psmouse, reg_base + 0x08);
@@ -1279,7 +1300,7 @@ static int alps_setup_trackstick_v3(struct psmouse *psmouse, int reg_base)
1279 * supported by this driver. If bit 1 isn't set the packet 1300 * supported by this driver. If bit 1 isn't set the packet
1280 * format is different. 1301 * format is different.
1281 */ 1302 */
1282 if (alps_enter_command_mode(psmouse, NULL) || 1303 if (alps_enter_command_mode(psmouse) ||
1283 alps_command_mode_write_reg(psmouse, 1304 alps_command_mode_write_reg(psmouse,
1284 reg_base + 0x08, 0x82) || 1305 reg_base + 0x08, 0x82) ||
1285 alps_exit_command_mode(psmouse)) 1306 alps_exit_command_mode(psmouse))
@@ -1306,7 +1327,7 @@ static int alps_hw_init_v3(struct psmouse *psmouse)
1306 alps_setup_trackstick_v3(psmouse, ALPS_REG_BASE_PINNACLE) == -EIO) 1327 alps_setup_trackstick_v3(psmouse, ALPS_REG_BASE_PINNACLE) == -EIO)
1307 goto error; 1328 goto error;
1308 1329
1309 if (alps_enter_command_mode(psmouse, NULL) || 1330 if (alps_enter_command_mode(psmouse) ||
1310 alps_absolute_mode_v3(psmouse)) { 1331 alps_absolute_mode_v3(psmouse)) {
1311 psmouse_err(psmouse, "Failed to enter absolute mode\n"); 1332 psmouse_err(psmouse, "Failed to enter absolute mode\n");
1312 goto error; 1333 goto error;
@@ -1381,7 +1402,7 @@ static int alps_hw_init_rushmore_v3(struct psmouse *psmouse)
1381 priv->flags &= ~ALPS_DUALPOINT; 1402 priv->flags &= ~ALPS_DUALPOINT;
1382 } 1403 }
1383 1404
1384 if (alps_enter_command_mode(psmouse, NULL) || 1405 if (alps_enter_command_mode(psmouse) ||
1385 alps_command_mode_read_reg(psmouse, 0xc2d9) == -1 || 1406 alps_command_mode_read_reg(psmouse, 0xc2d9) == -1 ||
1386 alps_command_mode_write_reg(psmouse, 0xc2cb, 0x00)) 1407 alps_command_mode_write_reg(psmouse, 0xc2cb, 0x00))
1387 goto error; 1408 goto error;
@@ -1431,7 +1452,7 @@ static int alps_hw_init_v4(struct psmouse *psmouse)
1431 struct ps2dev *ps2dev = &psmouse->ps2dev; 1452 struct ps2dev *ps2dev = &psmouse->ps2dev;
1432 unsigned char param[4]; 1453 unsigned char param[4];
1433 1454
1434 if (alps_enter_command_mode(psmouse, NULL)) 1455 if (alps_enter_command_mode(psmouse))
1435 goto error; 1456 goto error;
1436 1457
1437 if (alps_absolute_mode_v4(psmouse)) { 1458 if (alps_absolute_mode_v4(psmouse)) {
@@ -1499,6 +1520,23 @@ error:
1499 return -1; 1520 return -1;
1500} 1521}
1501 1522
1523static int alps_hw_init_dolphin_v1(struct psmouse *psmouse)
1524{
1525 struct ps2dev *ps2dev = &psmouse->ps2dev;
1526 unsigned char param[2];
1527
1528 /* This is dolphin "v1" as empirically defined by florin9doi */
1529 param[0] = 0x64;
1530 param[1] = 0x28;
1531
1532 if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSTREAM) ||
1533 ps2_command(ps2dev, &param[0], PSMOUSE_CMD_SETRATE) ||
1534 ps2_command(ps2dev, &param[1], PSMOUSE_CMD_SETRATE))
1535 return -1;
1536
1537 return 0;
1538}
1539
1502static void alps_set_defaults(struct alps_data *priv) 1540static void alps_set_defaults(struct alps_data *priv)
1503{ 1541{
1504 priv->byte0 = 0x8f; 1542 priv->byte0 = 0x8f;
@@ -1532,6 +1570,21 @@ static void alps_set_defaults(struct alps_data *priv)
1532 priv->nibble_commands = alps_v4_nibble_commands; 1570 priv->nibble_commands = alps_v4_nibble_commands;
1533 priv->addr_command = PSMOUSE_CMD_DISABLE; 1571 priv->addr_command = PSMOUSE_CMD_DISABLE;
1534 break; 1572 break;
1573 case ALPS_PROTO_V5:
1574 priv->hw_init = alps_hw_init_dolphin_v1;
1575 priv->process_packet = alps_process_packet_v3;
1576 priv->decode_fields = alps_decode_dolphin;
1577 priv->set_abs_params = alps_set_abs_params_mt;
1578 priv->nibble_commands = alps_v3_nibble_commands;
1579 priv->addr_command = PSMOUSE_CMD_RESET_WRAP;
1580 priv->byte0 = 0xc8;
1581 priv->mask0 = 0xc8;
1582 priv->flags = 0;
1583 priv->x_max = 1360;
1584 priv->y_max = 660;
1585 priv->x_bits = 23;
1586 priv->y_bits = 12;
1587 break;
1535 } 1588 }
1536} 1589}
1537 1590
@@ -1592,6 +1645,12 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
1592 1645
1593 if (alps_match_table(psmouse, priv, e7, ec) == 0) { 1646 if (alps_match_table(psmouse, priv, e7, ec) == 0) {
1594 return 0; 1647 return 0;
1648 } else if (e7[0] == 0x73 && e7[1] == 0x03 && e7[2] == 0x50 &&
1649 ec[0] == 0x73 && ec[1] == 0x01) {
1650 priv->proto_version = ALPS_PROTO_V5;
1651 alps_set_defaults(priv);
1652
1653 return 0;
1595 } else if (ec[0] == 0x88 && ec[1] == 0x08) { 1654 } else if (ec[0] == 0x88 && ec[1] == 0x08) {
1596 priv->proto_version = ALPS_PROTO_V3; 1655 priv->proto_version = ALPS_PROTO_V3;
1597 alps_set_defaults(priv); 1656 alps_set_defaults(priv);
diff --git a/drivers/input/mouse/alps.h b/drivers/input/mouse/alps.h
index 970480551b6e..eee59853b9ce 100644
--- a/drivers/input/mouse/alps.h
+++ b/drivers/input/mouse/alps.h
@@ -16,6 +16,7 @@
16#define ALPS_PROTO_V2 2 16#define ALPS_PROTO_V2 2
17#define ALPS_PROTO_V3 3 17#define ALPS_PROTO_V3 3
18#define ALPS_PROTO_V4 4 18#define ALPS_PROTO_V4 4
19#define ALPS_PROTO_V5 5
19 20
20/** 21/**
21 * struct alps_model_info - touchpad ID table 22 * struct alps_model_info - touchpad ID table
diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c
index 1673dc6c8092..f51765fff054 100644
--- a/drivers/input/mouse/cypress_ps2.c
+++ b/drivers/input/mouse/cypress_ps2.c
@@ -236,6 +236,13 @@ static int cypress_read_fw_version(struct psmouse *psmouse)
236 cytp->fw_version = param[2] & FW_VERSION_MASX; 236 cytp->fw_version = param[2] & FW_VERSION_MASX;
237 cytp->tp_metrics_supported = (param[2] & TP_METRICS_MASK) ? 1 : 0; 237 cytp->tp_metrics_supported = (param[2] & TP_METRICS_MASK) ? 1 : 0;
238 238
239 /*
240 * Trackpad fw_version 11 (in Dell XPS12) yields a bogus response to
241 * CYTP_CMD_READ_TP_METRICS so do not try to use it. LP: #1103594.
242 */
243 if (cytp->fw_version >= 11)
244 cytp->tp_metrics_supported = 0;
245
239 psmouse_dbg(psmouse, "cytp->fw_version = %d\n", cytp->fw_version); 246 psmouse_dbg(psmouse, "cytp->fw_version = %d\n", cytp->fw_version);
240 psmouse_dbg(psmouse, "cytp->tp_metrics_supported = %d\n", 247 psmouse_dbg(psmouse, "cytp->tp_metrics_supported = %d\n",
241 cytp->tp_metrics_supported); 248 cytp->tp_metrics_supported);
@@ -258,6 +265,9 @@ static int cypress_read_tp_metrics(struct psmouse *psmouse)
258 cytp->tp_res_x = cytp->tp_max_abs_x / cytp->tp_width; 265 cytp->tp_res_x = cytp->tp_max_abs_x / cytp->tp_width;
259 cytp->tp_res_y = cytp->tp_max_abs_y / cytp->tp_high; 266 cytp->tp_res_y = cytp->tp_max_abs_y / cytp->tp_high;
260 267
268 if (!cytp->tp_metrics_supported)
269 return 0;
270
261 memset(param, 0, sizeof(param)); 271 memset(param, 0, sizeof(param));
262 if (cypress_send_ext_cmd(psmouse, CYTP_CMD_READ_TP_METRICS, param) == 0) { 272 if (cypress_send_ext_cmd(psmouse, CYTP_CMD_READ_TP_METRICS, param) == 0) {
263 /* Update trackpad parameters. */ 273 /* Update trackpad parameters. */
@@ -315,18 +325,15 @@ static int cypress_read_tp_metrics(struct psmouse *psmouse)
315 325
316static int cypress_query_hardware(struct psmouse *psmouse) 326static int cypress_query_hardware(struct psmouse *psmouse)
317{ 327{
318 struct cytp_data *cytp = psmouse->private;
319 int ret; 328 int ret;
320 329
321 ret = cypress_read_fw_version(psmouse); 330 ret = cypress_read_fw_version(psmouse);
322 if (ret) 331 if (ret)
323 return ret; 332 return ret;
324 333
325 if (cytp->tp_metrics_supported) { 334 ret = cypress_read_tp_metrics(psmouse);
326 ret = cypress_read_tp_metrics(psmouse); 335 if (ret)
327 if (ret) 336 return ret;
328 return ret;
329 }
330 337
331 return 0; 338 return 0;
332} 339}
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 41b6fbf60112..1daa97913b7d 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -2017,6 +2017,9 @@ static const struct wacom_features wacom_features_0x100 =
2017static const struct wacom_features wacom_features_0x101 = 2017static const struct wacom_features wacom_features_0x101 =
2018 { "Wacom ISDv4 101", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, 2018 { "Wacom ISDv4 101", WACOM_PKGLEN_MTTPC, 26202, 16325, 255,
2019 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 2019 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
2020static const struct wacom_features wacom_features_0x10D =
2021 { "Wacom ISDv4 10D", WACOM_PKGLEN_MTTPC, 26202, 16325, 255,
2022 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
2020static const struct wacom_features wacom_features_0x4001 = 2023static const struct wacom_features wacom_features_0x4001 =
2021 { "Wacom ISDv4 4001", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, 2024 { "Wacom ISDv4 4001", WACOM_PKGLEN_MTTPC, 26202, 16325, 255,
2022 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 2025 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
@@ -2201,6 +2204,7 @@ const struct usb_device_id wacom_ids[] = {
2201 { USB_DEVICE_WACOM(0xEF) }, 2204 { USB_DEVICE_WACOM(0xEF) },
2202 { USB_DEVICE_WACOM(0x100) }, 2205 { USB_DEVICE_WACOM(0x100) },
2203 { USB_DEVICE_WACOM(0x101) }, 2206 { USB_DEVICE_WACOM(0x101) },
2207 { USB_DEVICE_WACOM(0x10D) },
2204 { USB_DEVICE_WACOM(0x4001) }, 2208 { USB_DEVICE_WACOM(0x4001) },
2205 { USB_DEVICE_WACOM(0x47) }, 2209 { USB_DEVICE_WACOM(0x47) },
2206 { USB_DEVICE_WACOM(0xF4) }, 2210 { USB_DEVICE_WACOM(0xF4) },
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 4f702b3ec1a3..434c3df250ca 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -236,7 +236,12 @@ static void __ads7846_disable(struct ads7846 *ts)
236/* Must be called with ts->lock held */ 236/* Must be called with ts->lock held */
237static void __ads7846_enable(struct ads7846 *ts) 237static void __ads7846_enable(struct ads7846 *ts)
238{ 238{
239 regulator_enable(ts->reg); 239 int error;
240
241 error = regulator_enable(ts->reg);
242 if (error != 0)
243 dev_err(&ts->spi->dev, "Failed to enable supply: %d\n", error);
244
240 ads7846_restart(ts); 245 ads7846_restart(ts);
241} 246}
242 247
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index d04f810cb1dd..59aa24002c7b 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -176,11 +176,17 @@
176/* Define for MXT_GEN_COMMAND_T6 */ 176/* Define for MXT_GEN_COMMAND_T6 */
177#define MXT_BOOT_VALUE 0xa5 177#define MXT_BOOT_VALUE 0xa5
178#define MXT_BACKUP_VALUE 0x55 178#define MXT_BACKUP_VALUE 0x55
179#define MXT_BACKUP_TIME 25 /* msec */ 179#define MXT_BACKUP_TIME 50 /* msec */
180#define MXT_RESET_TIME 65 /* msec */ 180#define MXT_RESET_TIME 200 /* msec */
181 181
182#define MXT_FWRESET_TIME 175 /* msec */ 182#define MXT_FWRESET_TIME 175 /* msec */
183 183
184/* MXT_SPT_GPIOPWM_T19 field */
185#define MXT_GPIO0_MASK 0x04
186#define MXT_GPIO1_MASK 0x08
187#define MXT_GPIO2_MASK 0x10
188#define MXT_GPIO3_MASK 0x20
189
184/* Command to unlock bootloader */ 190/* Command to unlock bootloader */
185#define MXT_UNLOCK_CMD_MSB 0xaa 191#define MXT_UNLOCK_CMD_MSB 0xaa
186#define MXT_UNLOCK_CMD_LSB 0xdc 192#define MXT_UNLOCK_CMD_LSB 0xdc
@@ -212,6 +218,8 @@
212/* Touchscreen absolute values */ 218/* Touchscreen absolute values */
213#define MXT_MAX_AREA 0xff 219#define MXT_MAX_AREA 0xff
214 220
221#define MXT_PIXELS_PER_MM 20
222
215struct mxt_info { 223struct mxt_info {
216 u8 family_id; 224 u8 family_id;
217 u8 variant_id; 225 u8 variant_id;
@@ -243,6 +251,8 @@ struct mxt_data {
243 const struct mxt_platform_data *pdata; 251 const struct mxt_platform_data *pdata;
244 struct mxt_object *object_table; 252 struct mxt_object *object_table;
245 struct mxt_info info; 253 struct mxt_info info;
254 bool is_tp;
255
246 unsigned int irq; 256 unsigned int irq;
247 unsigned int max_x; 257 unsigned int max_x;
248 unsigned int max_y; 258 unsigned int max_y;
@@ -251,6 +261,7 @@ struct mxt_data {
251 u8 T6_reportid; 261 u8 T6_reportid;
252 u8 T9_reportid_min; 262 u8 T9_reportid_min;
253 u8 T9_reportid_max; 263 u8 T9_reportid_max;
264 u8 T19_reportid;
254}; 265};
255 266
256static bool mxt_object_readable(unsigned int type) 267static bool mxt_object_readable(unsigned int type)
@@ -502,6 +513,21 @@ static int mxt_write_object(struct mxt_data *data,
502 return mxt_write_reg(data->client, reg + offset, val); 513 return mxt_write_reg(data->client, reg + offset, val);
503} 514}
504 515
516static void mxt_input_button(struct mxt_data *data, struct mxt_message *message)
517{
518 struct input_dev *input = data->input_dev;
519 bool button;
520 int i;
521
522 /* Active-low switch */
523 for (i = 0; i < MXT_NUM_GPIO; i++) {
524 if (data->pdata->key_map[i] == KEY_RESERVED)
525 continue;
526 button = !(message->message[0] & MXT_GPIO0_MASK << i);
527 input_report_key(input, data->pdata->key_map[i], button);
528 }
529}
530
505static void mxt_input_touchevent(struct mxt_data *data, 531static void mxt_input_touchevent(struct mxt_data *data,
506 struct mxt_message *message, int id) 532 struct mxt_message *message, int id)
507{ 533{
@@ -585,6 +611,9 @@ static irqreturn_t mxt_interrupt(int irq, void *dev_id)
585 int id = reportid - data->T9_reportid_min; 611 int id = reportid - data->T9_reportid_min;
586 mxt_input_touchevent(data, &message, id); 612 mxt_input_touchevent(data, &message, id);
587 update_input = true; 613 update_input = true;
614 } else if (message.reportid == data->T19_reportid) {
615 mxt_input_button(data, &message);
616 update_input = true;
588 } else { 617 } else {
589 mxt_dump_message(dev, &message); 618 mxt_dump_message(dev, &message);
590 } 619 }
@@ -764,6 +793,9 @@ static int mxt_get_object_table(struct mxt_data *data)
764 data->T9_reportid_min = min_id; 793 data->T9_reportid_min = min_id;
765 data->T9_reportid_max = max_id; 794 data->T9_reportid_max = max_id;
766 break; 795 break;
796 case MXT_SPT_GPIOPWM_T19:
797 data->T19_reportid = min_id;
798 break;
767 } 799 }
768 } 800 }
769 801
@@ -777,7 +809,7 @@ static void mxt_free_object_table(struct mxt_data *data)
777 data->T6_reportid = 0; 809 data->T6_reportid = 0;
778 data->T9_reportid_min = 0; 810 data->T9_reportid_min = 0;
779 data->T9_reportid_max = 0; 811 data->T9_reportid_max = 0;
780 812 data->T19_reportid = 0;
781} 813}
782 814
783static int mxt_initialize(struct mxt_data *data) 815static int mxt_initialize(struct mxt_data *data)
@@ -1115,9 +1147,13 @@ static int mxt_probe(struct i2c_client *client,
1115 goto err_free_mem; 1147 goto err_free_mem;
1116 } 1148 }
1117 1149
1118 input_dev->name = "Atmel maXTouch Touchscreen"; 1150 data->is_tp = pdata && pdata->is_tp;
1151
1152 input_dev->name = (data->is_tp) ? "Atmel maXTouch Touchpad" :
1153 "Atmel maXTouch Touchscreen";
1119 snprintf(data->phys, sizeof(data->phys), "i2c-%u-%04x/input0", 1154 snprintf(data->phys, sizeof(data->phys), "i2c-%u-%04x/input0",
1120 client->adapter->nr, client->addr); 1155 client->adapter->nr, client->addr);
1156
1121 input_dev->phys = data->phys; 1157 input_dev->phys = data->phys;
1122 1158
1123 input_dev->id.bustype = BUS_I2C; 1159 input_dev->id.bustype = BUS_I2C;
@@ -1140,6 +1176,29 @@ static int mxt_probe(struct i2c_client *client,
1140 __set_bit(EV_KEY, input_dev->evbit); 1176 __set_bit(EV_KEY, input_dev->evbit);
1141 __set_bit(BTN_TOUCH, input_dev->keybit); 1177 __set_bit(BTN_TOUCH, input_dev->keybit);
1142 1178
1179 if (data->is_tp) {
1180 int i;
1181 __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
1182 __set_bit(INPUT_PROP_BUTTONPAD, input_dev->propbit);
1183
1184 for (i = 0; i < MXT_NUM_GPIO; i++)
1185 if (pdata->key_map[i] != KEY_RESERVED)
1186 __set_bit(pdata->key_map[i], input_dev->keybit);
1187
1188 __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
1189 __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
1190 __set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit);
1191 __set_bit(BTN_TOOL_QUADTAP, input_dev->keybit);
1192 __set_bit(BTN_TOOL_QUINTTAP, input_dev->keybit);
1193
1194 input_abs_set_res(input_dev, ABS_X, MXT_PIXELS_PER_MM);
1195 input_abs_set_res(input_dev, ABS_Y, MXT_PIXELS_PER_MM);
1196 input_abs_set_res(input_dev, ABS_MT_POSITION_X,
1197 MXT_PIXELS_PER_MM);
1198 input_abs_set_res(input_dev, ABS_MT_POSITION_Y,
1199 MXT_PIXELS_PER_MM);
1200 }
1201
1143 /* For single touch */ 1202 /* For single touch */
1144 input_set_abs_params(input_dev, ABS_X, 1203 input_set_abs_params(input_dev, ABS_X,
1145 0, data->max_x, 0, 0); 1204 0, data->max_x, 0, 0);
@@ -1258,6 +1317,7 @@ static SIMPLE_DEV_PM_OPS(mxt_pm_ops, mxt_suspend, mxt_resume);
1258static const struct i2c_device_id mxt_id[] = { 1317static const struct i2c_device_id mxt_id[] = {
1259 { "qt602240_ts", 0 }, 1318 { "qt602240_ts", 0 },
1260 { "atmel_mxt_ts", 0 }, 1319 { "atmel_mxt_ts", 0 },
1320 { "atmel_mxt_tp", 0 },
1261 { "mXT224", 0 }, 1321 { "mXT224", 0 },
1262 { } 1322 { }
1263}; 1323};
diff --git a/drivers/input/touchscreen/mms114.c b/drivers/input/touchscreen/mms114.c
index 4a29ddf6bf1e..1443532fe6c4 100644
--- a/drivers/input/touchscreen/mms114.c
+++ b/drivers/input/touchscreen/mms114.c
@@ -314,15 +314,27 @@ static int mms114_start(struct mms114_data *data)
314 struct i2c_client *client = data->client; 314 struct i2c_client *client = data->client;
315 int error; 315 int error;
316 316
317 if (data->core_reg) 317 error = regulator_enable(data->core_reg);
318 regulator_enable(data->core_reg); 318 if (error) {
319 if (data->io_reg) 319 dev_err(&client->dev, "Failed to enable avdd: %d\n", error);
320 regulator_enable(data->io_reg); 320 return error;
321 }
322
323 error = regulator_enable(data->io_reg);
324 if (error) {
325 dev_err(&client->dev, "Failed to enable vdd: %d\n", error);
326 regulator_disable(data->core_reg);
327 return error;
328 }
329
321 mdelay(MMS114_POWERON_DELAY); 330 mdelay(MMS114_POWERON_DELAY);
322 331
323 error = mms114_setup_regs(data); 332 error = mms114_setup_regs(data);
324 if (error < 0) 333 if (error < 0) {
334 regulator_disable(data->io_reg);
335 regulator_disable(data->core_reg);
325 return error; 336 return error;
337 }
326 338
327 if (data->pdata->cfg_pin) 339 if (data->pdata->cfg_pin)
328 data->pdata->cfg_pin(true); 340 data->pdata->cfg_pin(true);
@@ -335,16 +347,20 @@ static int mms114_start(struct mms114_data *data)
335static void mms114_stop(struct mms114_data *data) 347static void mms114_stop(struct mms114_data *data)
336{ 348{
337 struct i2c_client *client = data->client; 349 struct i2c_client *client = data->client;
350 int error;
338 351
339 disable_irq(client->irq); 352 disable_irq(client->irq);
340 353
341 if (data->pdata->cfg_pin) 354 if (data->pdata->cfg_pin)
342 data->pdata->cfg_pin(false); 355 data->pdata->cfg_pin(false);
343 356
344 if (data->io_reg) 357 error = regulator_disable(data->io_reg);
345 regulator_disable(data->io_reg); 358 if (error)
346 if (data->core_reg) 359 dev_warn(&client->dev, "Failed to disable vdd: %d\n", error);
347 regulator_disable(data->core_reg); 360
361 error = regulator_disable(data->core_reg);
362 if (error)
363 dev_warn(&client->dev, "Failed to disable avdd: %d\n", error);
348} 364}
349 365
350static int mms114_input_open(struct input_dev *dev) 366static int mms114_input_open(struct input_dev *dev)
diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
index dc7e478b7e5f..e5cdaf87822c 100644
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@ -1083,6 +1083,7 @@ static const char *dma_remap_fault_reasons[] =
1083 "non-zero reserved fields in RTP", 1083 "non-zero reserved fields in RTP",
1084 "non-zero reserved fields in CTP", 1084 "non-zero reserved fields in CTP",
1085 "non-zero reserved fields in PTE", 1085 "non-zero reserved fields in PTE",
1086 "PCE for translation request specifies blocking",
1086}; 1087};
1087 1088
1088static const char *irq_remap_fault_reasons[] = 1089static const char *irq_remap_fault_reasons[] =
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
index d8a7d8323414..ebaebdf30f98 100644
--- a/drivers/isdn/i4l/isdn_tty.c
+++ b/drivers/isdn/i4l/isdn_tty.c
@@ -902,7 +902,9 @@ isdn_tty_send_msg(modem_info *info, atemu *m, char *msg)
902 int j; 902 int j;
903 int l; 903 int l;
904 904
905 l = strlen(msg); 905 l = min(strlen(msg), sizeof(cmd.parm) - sizeof(cmd.parm.cmsg)
906 + sizeof(cmd.parm.cmsg.para) - 2);
907
906 if (!l) { 908 if (!l) {
907 isdn_tty_modem_result(RESULT_ERROR, info); 909 isdn_tty_modem_result(RESULT_ERROR, info);
908 return; 910 return;
diff --git a/drivers/mailbox/pl320-ipc.c b/drivers/mailbox/pl320-ipc.c
index c45b3aedafba..d873cbae2fbb 100644
--- a/drivers/mailbox/pl320-ipc.c
+++ b/drivers/mailbox/pl320-ipc.c
@@ -138,8 +138,7 @@ int pl320_ipc_unregister_notifier(struct notifier_block *nb)
138} 138}
139EXPORT_SYMBOL_GPL(pl320_ipc_unregister_notifier); 139EXPORT_SYMBOL_GPL(pl320_ipc_unregister_notifier);
140 140
141static int __init pl320_probe(struct amba_device *adev, 141static int pl320_probe(struct amba_device *adev, const struct amba_id *id)
142 const struct amba_id *id)
143{ 142{
144 int ret; 143 int ret;
145 144
diff --git a/drivers/misc/ibmasm/ibmasmfs.c b/drivers/misc/ibmasm/ibmasmfs.c
index 6673e578b3e9..ce5b75616b45 100644
--- a/drivers/misc/ibmasm/ibmasmfs.c
+++ b/drivers/misc/ibmasm/ibmasmfs.c
@@ -110,6 +110,7 @@ static struct file_system_type ibmasmfs_type = {
110 .mount = ibmasmfs_mount, 110 .mount = ibmasmfs_mount,
111 .kill_sb = kill_litter_super, 111 .kill_sb = kill_litter_super,
112}; 112};
113MODULE_ALIAS_FS("ibmasmfs");
113 114
114static int ibmasmfs_fill_super (struct super_block *sb, void *data, int silent) 115static int ibmasmfs_fill_super (struct super_block *sb, void *data, int silent)
115{ 116{
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 82c06165d3d2..92ab30ab00dc 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -1238,6 +1238,7 @@ static struct file_system_type mtd_inodefs_type = {
1238 .mount = mtd_inodefs_mount, 1238 .mount = mtd_inodefs_mount,
1239 .kill_sb = kill_anon_super, 1239 .kill_sb = kill_anon_super,
1240}; 1240};
1241MODULE_ALIAS_FS("mtd_inodefs");
1241 1242
1242static int __init init_mtdchar(void) 1243static int __init init_mtdchar(void)
1243{ 1244{
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 7bd068a6056a..8b4e96e01d6c 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1964,7 +1964,6 @@ static int __bond_release_one(struct net_device *bond_dev,
1964 } 1964 }
1965 1965
1966 block_netpoll_tx(); 1966 block_netpoll_tx();
1967 call_netdevice_notifiers(NETDEV_RELEASE, bond_dev);
1968 write_lock_bh(&bond->lock); 1967 write_lock_bh(&bond->lock);
1969 1968
1970 slave = bond_get_slave_by_dev(bond, slave_dev); 1969 slave = bond_get_slave_by_dev(bond, slave_dev);
@@ -2066,8 +2065,10 @@ static int __bond_release_one(struct net_device *bond_dev,
2066 write_unlock_bh(&bond->lock); 2065 write_unlock_bh(&bond->lock);
2067 unblock_netpoll_tx(); 2066 unblock_netpoll_tx();
2068 2067
2069 if (bond->slave_cnt == 0) 2068 if (bond->slave_cnt == 0) {
2070 call_netdevice_notifiers(NETDEV_CHANGEADDR, bond->dev); 2069 call_netdevice_notifiers(NETDEV_CHANGEADDR, bond->dev);
2070 call_netdevice_notifiers(NETDEV_RELEASE, bond->dev);
2071 }
2071 2072
2072 bond_compute_features(bond); 2073 bond_compute_features(bond);
2073 if (!(bond_dev->features & NETIF_F_VLAN_CHALLENGED) && 2074 if (!(bond_dev->features & NETIF_F_VLAN_CHALLENGED) &&
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
index 31c5787970db..77ebae0ac64a 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
@@ -8647,7 +8647,9 @@ void bnx2x_handle_module_detect_int(struct link_params *params)
8647 MDIO_WC_DEVAD, 8647 MDIO_WC_DEVAD,
8648 MDIO_WC_REG_DIGITAL5_MISC6, 8648 MDIO_WC_REG_DIGITAL5_MISC6,
8649 &rx_tx_in_reset); 8649 &rx_tx_in_reset);
8650 if (!rx_tx_in_reset) { 8650 if ((!rx_tx_in_reset) &&
8651 (params->link_flags &
8652 PHY_INITIALIZED)) {
8651 bnx2x_warpcore_reset_lane(bp, phy, 1); 8653 bnx2x_warpcore_reset_lane(bp, phy, 1);
8652 bnx2x_warpcore_config_sfi(phy, params); 8654 bnx2x_warpcore_config_sfi(phy, params);
8653 bnx2x_warpcore_reset_lane(bp, phy, 0); 8655 bnx2x_warpcore_reset_lane(bp, phy, 0);
@@ -12527,6 +12529,8 @@ int bnx2x_phy_init(struct link_params *params, struct link_vars *vars)
12527 vars->flow_ctrl = BNX2X_FLOW_CTRL_NONE; 12529 vars->flow_ctrl = BNX2X_FLOW_CTRL_NONE;
12528 vars->mac_type = MAC_TYPE_NONE; 12530 vars->mac_type = MAC_TYPE_NONE;
12529 vars->phy_flags = 0; 12531 vars->phy_flags = 0;
12532 vars->check_kr2_recovery_cnt = 0;
12533 params->link_flags = PHY_INITIALIZED;
12530 /* Driver opens NIG-BRB filters */ 12534 /* Driver opens NIG-BRB filters */
12531 bnx2x_set_rx_filter(params, 1); 12535 bnx2x_set_rx_filter(params, 1);
12532 /* Check if link flap can be avoided */ 12536 /* Check if link flap can be avoided */
@@ -12691,6 +12695,7 @@ int bnx2x_lfa_reset(struct link_params *params,
12691 struct bnx2x *bp = params->bp; 12695 struct bnx2x *bp = params->bp;
12692 vars->link_up = 0; 12696 vars->link_up = 0;
12693 vars->phy_flags = 0; 12697 vars->phy_flags = 0;
12698 params->link_flags &= ~PHY_INITIALIZED;
12694 if (!params->lfa_base) 12699 if (!params->lfa_base)
12695 return bnx2x_link_reset(params, vars, 1); 12700 return bnx2x_link_reset(params, vars, 1);
12696 /* 12701 /*
@@ -13411,6 +13416,7 @@ static void bnx2x_disable_kr2(struct link_params *params,
13411 vars->link_attr_sync &= ~LINK_ATTR_SYNC_KR2_ENABLE; 13416 vars->link_attr_sync &= ~LINK_ATTR_SYNC_KR2_ENABLE;
13412 bnx2x_update_link_attr(params, vars->link_attr_sync); 13417 bnx2x_update_link_attr(params, vars->link_attr_sync);
13413 13418
13419 vars->check_kr2_recovery_cnt = CHECK_KR2_RECOVERY_CNT;
13414 /* Restart AN on leading lane */ 13420 /* Restart AN on leading lane */
13415 bnx2x_warpcore_restart_AN_KR(phy, params); 13421 bnx2x_warpcore_restart_AN_KR(phy, params);
13416} 13422}
@@ -13439,6 +13445,15 @@ static void bnx2x_check_kr2_wa(struct link_params *params,
13439 return; 13445 return;
13440 } 13446 }
13441 13447
13448 /* Once KR2 was disabled, wait 5 seconds before checking KR2 recovery
13449 * since some switches tend to reinit the AN process and clear the
13450 * advertised BP/NP after ~2 seconds causing the KR2 to be disabled
13451 * and recovered many times
13452 */
13453 if (vars->check_kr2_recovery_cnt > 0) {
13454 vars->check_kr2_recovery_cnt--;
13455 return;
13456 }
13442 lane = bnx2x_get_warpcore_lane(phy, params); 13457 lane = bnx2x_get_warpcore_lane(phy, params);
13443 CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, 13458 CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK,
13444 MDIO_AER_BLOCK_AER_REG, lane); 13459 MDIO_AER_BLOCK_AER_REG, lane);
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h
index be5c195d03dd..56c2aae4e2c8 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h
@@ -309,6 +309,7 @@ struct link_params {
309 req_flow_ctrl is set to AUTO */ 309 req_flow_ctrl is set to AUTO */
310 u16 link_flags; 310 u16 link_flags;
311#define LINK_FLAGS_INT_DISABLED (1<<0) 311#define LINK_FLAGS_INT_DISABLED (1<<0)
312#define PHY_INITIALIZED (1<<1)
312 u32 lfa_base; 313 u32 lfa_base;
313}; 314};
314 315
@@ -342,7 +343,8 @@ struct link_vars {
342 u32 link_status; 343 u32 link_status;
343 u32 eee_status; 344 u32 eee_status;
344 u8 fault_detected; 345 u8 fault_detected;
345 u8 rsrv1; 346 u8 check_kr2_recovery_cnt;
347#define CHECK_KR2_RECOVERY_CNT 5
346 u16 periodic_flags; 348 u16 periodic_flags;
347#define PERIODIC_FLAGS_LINK_EVENT 0x0001 349#define PERIODIC_FLAGS_LINK_EVENT 0x0001
348 350
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 2b2bee61ddd7..0c1a2ef163a5 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -1870,6 +1870,8 @@ static void tg3_link_report(struct tg3 *tp)
1870 1870
1871 tg3_ump_link_report(tp); 1871 tg3_ump_link_report(tp);
1872 } 1872 }
1873
1874 tp->link_up = netif_carrier_ok(tp->dev);
1873} 1875}
1874 1876
1875static u16 tg3_advert_flowctrl_1000X(u8 flow_ctrl) 1877static u16 tg3_advert_flowctrl_1000X(u8 flow_ctrl)
@@ -2523,12 +2525,6 @@ static int tg3_phy_reset_5703_4_5(struct tg3 *tp)
2523 return err; 2525 return err;
2524} 2526}
2525 2527
2526static void tg3_carrier_on(struct tg3 *tp)
2527{
2528 netif_carrier_on(tp->dev);
2529 tp->link_up = true;
2530}
2531
2532static void tg3_carrier_off(struct tg3 *tp) 2528static void tg3_carrier_off(struct tg3 *tp)
2533{ 2529{
2534 netif_carrier_off(tp->dev); 2530 netif_carrier_off(tp->dev);
@@ -2554,7 +2550,7 @@ static int tg3_phy_reset(struct tg3 *tp)
2554 return -EBUSY; 2550 return -EBUSY;
2555 2551
2556 if (netif_running(tp->dev) && tp->link_up) { 2552 if (netif_running(tp->dev) && tp->link_up) {
2557 tg3_carrier_off(tp); 2553 netif_carrier_off(tp->dev);
2558 tg3_link_report(tp); 2554 tg3_link_report(tp);
2559 } 2555 }
2560 2556
@@ -4403,9 +4399,9 @@ static bool tg3_test_and_report_link_chg(struct tg3 *tp, int curr_link_up)
4403{ 4399{
4404 if (curr_link_up != tp->link_up) { 4400 if (curr_link_up != tp->link_up) {
4405 if (curr_link_up) { 4401 if (curr_link_up) {
4406 tg3_carrier_on(tp); 4402 netif_carrier_on(tp->dev);
4407 } else { 4403 } else {
4408 tg3_carrier_off(tp); 4404 netif_carrier_off(tp->dev);
4409 if (tp->phy_flags & TG3_PHYFLG_MII_SERDES) 4405 if (tp->phy_flags & TG3_PHYFLG_MII_SERDES)
4410 tp->phy_flags &= ~TG3_PHYFLG_PARALLEL_DETECT; 4406 tp->phy_flags &= ~TG3_PHYFLG_PARALLEL_DETECT;
4411 } 4407 }
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
index 4ce62031f62f..8049268ce0f2 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
@@ -497,8 +497,9 @@ int t4_memory_write(struct adapter *adap, int mtype, u32 addr, u32 len,
497} 497}
498 498
499#define EEPROM_STAT_ADDR 0x7bfc 499#define EEPROM_STAT_ADDR 0x7bfc
500#define VPD_BASE 0
501#define VPD_LEN 512 500#define VPD_LEN 512
501#define VPD_BASE 0x400
502#define VPD_BASE_OLD 0
502 503
503/** 504/**
504 * t4_seeprom_wp - enable/disable EEPROM write protection 505 * t4_seeprom_wp - enable/disable EEPROM write protection
@@ -524,7 +525,7 @@ int t4_seeprom_wp(struct adapter *adapter, bool enable)
524int get_vpd_params(struct adapter *adapter, struct vpd_params *p) 525int get_vpd_params(struct adapter *adapter, struct vpd_params *p)
525{ 526{
526 u32 cclk_param, cclk_val; 527 u32 cclk_param, cclk_val;
527 int i, ret; 528 int i, ret, addr;
528 int ec, sn; 529 int ec, sn;
529 u8 *vpd, csum; 530 u8 *vpd, csum;
530 unsigned int vpdr_len, kw_offset, id_len; 531 unsigned int vpdr_len, kw_offset, id_len;
@@ -533,7 +534,12 @@ int get_vpd_params(struct adapter *adapter, struct vpd_params *p)
533 if (!vpd) 534 if (!vpd)
534 return -ENOMEM; 535 return -ENOMEM;
535 536
536 ret = pci_read_vpd(adapter->pdev, VPD_BASE, VPD_LEN, vpd); 537 ret = pci_read_vpd(adapter->pdev, VPD_BASE, sizeof(u32), vpd);
538 if (ret < 0)
539 goto out;
540 addr = *vpd == 0x82 ? VPD_BASE : VPD_BASE_OLD;
541
542 ret = pci_read_vpd(adapter->pdev, addr, VPD_LEN, vpd);
537 if (ret < 0) 543 if (ret < 0)
538 goto out; 544 goto out;
539 545
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index ff1efe55ceee..2e2700e3a5ab 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -349,6 +349,7 @@ struct be_adapter {
349 struct pci_dev *pdev; 349 struct pci_dev *pdev;
350 struct net_device *netdev; 350 struct net_device *netdev;
351 351
352 u8 __iomem *csr; /* CSR BAR used only for BE2/3 */
352 u8 __iomem *db; /* Door Bell */ 353 u8 __iomem *db; /* Door Bell */
353 354
354 struct mutex mbox_lock; /* For serializing mbox cmds to BE card */ 355 struct mutex mbox_lock; /* For serializing mbox cmds to BE card */
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index 4512e42596d4..6ed46396bb36 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -473,19 +473,17 @@ static int be_mbox_notify_wait(struct be_adapter *adapter)
473 return 0; 473 return 0;
474} 474}
475 475
476static int be_POST_stage_get(struct be_adapter *adapter, u16 *stage) 476static u16 be_POST_stage_get(struct be_adapter *adapter)
477{ 477{
478 u32 sem; 478 u32 sem;
479 u32 reg = skyhawk_chip(adapter) ? SLIPORT_SEMAPHORE_OFFSET_SH :
480 SLIPORT_SEMAPHORE_OFFSET_BE;
481 479
482 pci_read_config_dword(adapter->pdev, reg, &sem); 480 if (BEx_chip(adapter))
483 *stage = sem & POST_STAGE_MASK; 481 sem = ioread32(adapter->csr + SLIPORT_SEMAPHORE_OFFSET_BEx);
484
485 if ((sem >> POST_ERR_SHIFT) & POST_ERR_MASK)
486 return -1;
487 else 482 else
488 return 0; 483 pci_read_config_dword(adapter->pdev,
484 SLIPORT_SEMAPHORE_OFFSET_SH, &sem);
485
486 return sem & POST_STAGE_MASK;
489} 487}
490 488
491int lancer_wait_ready(struct be_adapter *adapter) 489int lancer_wait_ready(struct be_adapter *adapter)
@@ -579,19 +577,17 @@ int be_fw_wait_ready(struct be_adapter *adapter)
579 } 577 }
580 578
581 do { 579 do {
582 status = be_POST_stage_get(adapter, &stage); 580 stage = be_POST_stage_get(adapter);
583 if (status) { 581 if (stage == POST_STAGE_ARMFW_RDY)
584 dev_err(dev, "POST error; stage=0x%x\n", stage);
585 return -1;
586 } else if (stage != POST_STAGE_ARMFW_RDY) {
587 if (msleep_interruptible(2000)) {
588 dev_err(dev, "Waiting for POST aborted\n");
589 return -EINTR;
590 }
591 timeout += 2;
592 } else {
593 return 0; 582 return 0;
583
584 dev_info(dev, "Waiting for POST, %ds elapsed\n",
585 timeout);
586 if (msleep_interruptible(2000)) {
587 dev_err(dev, "Waiting for POST aborted\n");
588 return -EINTR;
594 } 589 }
590 timeout += 2;
595 } while (timeout < 60); 591 } while (timeout < 60);
596 592
597 dev_err(dev, "POST timeout; stage=0x%x\n", stage); 593 dev_err(dev, "POST timeout; stage=0x%x\n", stage);
diff --git a/drivers/net/ethernet/emulex/benet/be_hw.h b/drivers/net/ethernet/emulex/benet/be_hw.h
index c515eeaaa5d6..89e6d8cfaf0d 100644
--- a/drivers/net/ethernet/emulex/benet/be_hw.h
+++ b/drivers/net/ethernet/emulex/benet/be_hw.h
@@ -32,8 +32,8 @@
32#define MPU_EP_CONTROL 0 32#define MPU_EP_CONTROL 0
33 33
34/********** MPU semphore: used for SH & BE *************/ 34/********** MPU semphore: used for SH & BE *************/
35#define SLIPORT_SEMAPHORE_OFFSET_BE 0x7c 35#define SLIPORT_SEMAPHORE_OFFSET_BEx 0xac /* CSR BAR offset */
36#define SLIPORT_SEMAPHORE_OFFSET_SH 0x94 36#define SLIPORT_SEMAPHORE_OFFSET_SH 0x94 /* PCI-CFG offset */
37#define POST_STAGE_MASK 0x0000FFFF 37#define POST_STAGE_MASK 0x0000FFFF
38#define POST_ERR_MASK 0x1 38#define POST_ERR_MASK 0x1
39#define POST_ERR_SHIFT 31 39#define POST_ERR_SHIFT 31
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 1f8103c0afbf..b8e5019398f0 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -3688,6 +3688,8 @@ static void be_netdev_init(struct net_device *netdev)
3688 3688
3689static void be_unmap_pci_bars(struct be_adapter *adapter) 3689static void be_unmap_pci_bars(struct be_adapter *adapter)
3690{ 3690{
3691 if (adapter->csr)
3692 pci_iounmap(adapter->pdev, adapter->csr);
3691 if (adapter->db) 3693 if (adapter->db)
3692 pci_iounmap(adapter->pdev, adapter->db); 3694 pci_iounmap(adapter->pdev, adapter->db);
3693} 3695}
@@ -3721,6 +3723,12 @@ static int be_map_pci_bars(struct be_adapter *adapter)
3721 adapter->if_type = (sli_intf & SLI_INTF_IF_TYPE_MASK) >> 3723 adapter->if_type = (sli_intf & SLI_INTF_IF_TYPE_MASK) >>
3722 SLI_INTF_IF_TYPE_SHIFT; 3724 SLI_INTF_IF_TYPE_SHIFT;
3723 3725
3726 if (BEx_chip(adapter) && be_physfn(adapter)) {
3727 adapter->csr = pci_iomap(adapter->pdev, 2, 0);
3728 if (adapter->csr == NULL)
3729 return -ENOMEM;
3730 }
3731
3724 addr = pci_iomap(adapter->pdev, db_bar(adapter), 0); 3732 addr = pci_iomap(adapter->pdev, db_bar(adapter), 0);
3725 if (addr == NULL) 3733 if (addr == NULL)
3726 goto pci_map_err; 3734 goto pci_map_err;
@@ -4329,6 +4337,8 @@ static pci_ers_result_t be_eeh_reset(struct pci_dev *pdev)
4329 pci_restore_state(pdev); 4337 pci_restore_state(pdev);
4330 4338
4331 /* Check if card is ok and fw is ready */ 4339 /* Check if card is ok and fw is ready */
4340 dev_info(&adapter->pdev->dev,
4341 "Waiting for FW to be ready after EEH reset\n");
4332 status = be_fw_wait_ready(adapter); 4342 status = be_fw_wait_ready(adapter);
4333 if (status) 4343 if (status)
4334 return PCI_ERS_RESULT_DISCONNECT; 4344 return PCI_ERS_RESULT_DISCONNECT;
diff --git a/drivers/net/ethernet/intel/e1000e/ethtool.c b/drivers/net/ethernet/intel/e1000e/ethtool.c
index 8f5832c606e1..e835e7b95f81 100644
--- a/drivers/net/ethernet/intel/e1000e/ethtool.c
+++ b/drivers/net/ethernet/intel/e1000e/ethtool.c
@@ -36,6 +36,7 @@
36#include <linux/delay.h> 36#include <linux/delay.h>
37#include <linux/vmalloc.h> 37#include <linux/vmalloc.h>
38#include <linux/mdio.h> 38#include <linux/mdio.h>
39#include <linux/pm_runtime.h>
39 40
40#include "e1000.h" 41#include "e1000.h"
41 42
@@ -2236,7 +2237,19 @@ static int e1000e_get_ts_info(struct net_device *netdev,
2236 return 0; 2237 return 0;
2237} 2238}
2238 2239
2240static int e1000e_ethtool_begin(struct net_device *netdev)
2241{
2242 return pm_runtime_get_sync(netdev->dev.parent);
2243}
2244
2245static void e1000e_ethtool_complete(struct net_device *netdev)
2246{
2247 pm_runtime_put_sync(netdev->dev.parent);
2248}
2249
2239static const struct ethtool_ops e1000_ethtool_ops = { 2250static const struct ethtool_ops e1000_ethtool_ops = {
2251 .begin = e1000e_ethtool_begin,
2252 .complete = e1000e_ethtool_complete,
2240 .get_settings = e1000_get_settings, 2253 .get_settings = e1000_get_settings,
2241 .set_settings = e1000_set_settings, 2254 .set_settings = e1000_set_settings,
2242 .get_drvinfo = e1000_get_drvinfo, 2255 .get_drvinfo = e1000_get_drvinfo,
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c
index 382813dfc7a8..1cdec5fd2129 100644
--- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
+++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
@@ -782,6 +782,59 @@ release:
782} 782}
783 783
784/** 784/**
785 * e1000_k1_workaround_lpt_lp - K1 workaround on Lynxpoint-LP
786 * @hw: pointer to the HW structure
787 * @link: link up bool flag
788 *
789 * When K1 is enabled for 1Gbps, the MAC can miss 2 DMA completion indications
790 * preventing further DMA write requests. Workaround the issue by disabling
791 * the de-assertion of the clock request when in 1Gpbs mode.
792 **/
793static s32 e1000_k1_workaround_lpt_lp(struct e1000_hw *hw, bool link)
794{
795 u32 fextnvm6 = er32(FEXTNVM6);
796 s32 ret_val = 0;
797
798 if (link && (er32(STATUS) & E1000_STATUS_SPEED_1000)) {
799 u16 kmrn_reg;
800
801 ret_val = hw->phy.ops.acquire(hw);
802 if (ret_val)
803 return ret_val;
804
805 ret_val =
806 e1000e_read_kmrn_reg_locked(hw, E1000_KMRNCTRLSTA_K1_CONFIG,
807 &kmrn_reg);
808 if (ret_val)
809 goto release;
810
811 ret_val =
812 e1000e_write_kmrn_reg_locked(hw,
813 E1000_KMRNCTRLSTA_K1_CONFIG,
814 kmrn_reg &
815 ~E1000_KMRNCTRLSTA_K1_ENABLE);
816 if (ret_val)
817 goto release;
818
819 usleep_range(10, 20);
820
821 ew32(FEXTNVM6, fextnvm6 | E1000_FEXTNVM6_REQ_PLL_CLK);
822
823 ret_val =
824 e1000e_write_kmrn_reg_locked(hw,
825 E1000_KMRNCTRLSTA_K1_CONFIG,
826 kmrn_reg);
827release:
828 hw->phy.ops.release(hw);
829 } else {
830 /* clear FEXTNVM6 bit 8 on link down or 10/100 */
831 ew32(FEXTNVM6, fextnvm6 & ~E1000_FEXTNVM6_REQ_PLL_CLK);
832 }
833
834 return ret_val;
835}
836
837/**
785 * e1000_check_for_copper_link_ich8lan - Check for link (Copper) 838 * e1000_check_for_copper_link_ich8lan - Check for link (Copper)
786 * @hw: pointer to the HW structure 839 * @hw: pointer to the HW structure
787 * 840 *
@@ -818,6 +871,14 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
818 return ret_val; 871 return ret_val;
819 } 872 }
820 873
874 /* Work-around I218 hang issue */
875 if ((hw->adapter->pdev->device == E1000_DEV_ID_PCH_LPTLP_I218_LM) ||
876 (hw->adapter->pdev->device == E1000_DEV_ID_PCH_LPTLP_I218_V)) {
877 ret_val = e1000_k1_workaround_lpt_lp(hw, link);
878 if (ret_val)
879 return ret_val;
880 }
881
821 /* Clear link partner's EEE ability */ 882 /* Clear link partner's EEE ability */
822 hw->dev_spec.ich8lan.eee_lp_ability = 0; 883 hw->dev_spec.ich8lan.eee_lp_ability = 0;
823 884
@@ -3953,8 +4014,16 @@ void e1000_suspend_workarounds_ich8lan(struct e1000_hw *hw)
3953 4014
3954 phy_ctrl = er32(PHY_CTRL); 4015 phy_ctrl = er32(PHY_CTRL);
3955 phy_ctrl |= E1000_PHY_CTRL_GBE_DISABLE; 4016 phy_ctrl |= E1000_PHY_CTRL_GBE_DISABLE;
4017
3956 if (hw->phy.type == e1000_phy_i217) { 4018 if (hw->phy.type == e1000_phy_i217) {
3957 u16 phy_reg; 4019 u16 phy_reg, device_id = hw->adapter->pdev->device;
4020
4021 if ((device_id == E1000_DEV_ID_PCH_LPTLP_I218_LM) ||
4022 (device_id == E1000_DEV_ID_PCH_LPTLP_I218_V)) {
4023 u32 fextnvm6 = er32(FEXTNVM6);
4024
4025 ew32(FEXTNVM6, fextnvm6 & ~E1000_FEXTNVM6_REQ_PLL_CLK);
4026 }
3958 4027
3959 ret_val = hw->phy.ops.acquire(hw); 4028 ret_val = hw->phy.ops.acquire(hw);
3960 if (ret_val) 4029 if (ret_val)
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.h b/drivers/net/ethernet/intel/e1000e/ich8lan.h
index b6d3174d7d2d..8bf4655c2e17 100644
--- a/drivers/net/ethernet/intel/e1000e/ich8lan.h
+++ b/drivers/net/ethernet/intel/e1000e/ich8lan.h
@@ -92,6 +92,8 @@
92#define E1000_FEXTNVM4_BEACON_DURATION_8USEC 0x7 92#define E1000_FEXTNVM4_BEACON_DURATION_8USEC 0x7
93#define E1000_FEXTNVM4_BEACON_DURATION_16USEC 0x3 93#define E1000_FEXTNVM4_BEACON_DURATION_16USEC 0x3
94 94
95#define E1000_FEXTNVM6_REQ_PLL_CLK 0x00000100
96
95#define PCIE_ICH8_SNOOP_ALL PCIE_NO_SNOOP_ALL 97#define PCIE_ICH8_SNOOP_ALL PCIE_NO_SNOOP_ALL
96 98
97#define E1000_ICH_RAR_ENTRIES 7 99#define E1000_ICH_RAR_ENTRIES 7
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index b4eab18e1c16..142ca39a68f6 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -4284,6 +4284,7 @@ static int e1000_open(struct net_device *netdev)
4284 netif_start_queue(netdev); 4284 netif_start_queue(netdev);
4285 4285
4286 adapter->idle_check = true; 4286 adapter->idle_check = true;
4287 hw->mac.get_link_status = true;
4287 pm_runtime_put(&pdev->dev); 4288 pm_runtime_put(&pdev->dev);
4288 4289
4289 /* fire a link status change interrupt to start the watchdog */ 4290 /* fire a link status change interrupt to start the watchdog */
@@ -4642,6 +4643,7 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter)
4642 (adapter->hw.phy.media_type == e1000_media_type_copper)) { 4643 (adapter->hw.phy.media_type == e1000_media_type_copper)) {
4643 int ret_val; 4644 int ret_val;
4644 4645
4646 pm_runtime_get_sync(&adapter->pdev->dev);
4645 ret_val = e1e_rphy(hw, MII_BMCR, &phy->bmcr); 4647 ret_val = e1e_rphy(hw, MII_BMCR, &phy->bmcr);
4646 ret_val |= e1e_rphy(hw, MII_BMSR, &phy->bmsr); 4648 ret_val |= e1e_rphy(hw, MII_BMSR, &phy->bmsr);
4647 ret_val |= e1e_rphy(hw, MII_ADVERTISE, &phy->advertise); 4649 ret_val |= e1e_rphy(hw, MII_ADVERTISE, &phy->advertise);
@@ -4652,6 +4654,7 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter)
4652 ret_val |= e1e_rphy(hw, MII_ESTATUS, &phy->estatus); 4654 ret_val |= e1e_rphy(hw, MII_ESTATUS, &phy->estatus);
4653 if (ret_val) 4655 if (ret_val)
4654 e_warn("Error reading PHY register\n"); 4656 e_warn("Error reading PHY register\n");
4657 pm_runtime_put_sync(&adapter->pdev->dev);
4655 } else { 4658 } else {
4656 /* Do not read PHY registers if link is not up 4659 /* Do not read PHY registers if link is not up
4657 * Set values to typical power-on defaults 4660 * Set values to typical power-on defaults
@@ -5865,8 +5868,7 @@ release:
5865 return retval; 5868 return retval;
5866} 5869}
5867 5870
5868static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake, 5871static int __e1000_shutdown(struct pci_dev *pdev, bool runtime)
5869 bool runtime)
5870{ 5872{
5871 struct net_device *netdev = pci_get_drvdata(pdev); 5873 struct net_device *netdev = pci_get_drvdata(pdev);
5872 struct e1000_adapter *adapter = netdev_priv(netdev); 5874 struct e1000_adapter *adapter = netdev_priv(netdev);
@@ -5890,10 +5892,6 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake,
5890 } 5892 }
5891 e1000e_reset_interrupt_capability(adapter); 5893 e1000e_reset_interrupt_capability(adapter);
5892 5894
5893 retval = pci_save_state(pdev);
5894 if (retval)
5895 return retval;
5896
5897 status = er32(STATUS); 5895 status = er32(STATUS);
5898 if (status & E1000_STATUS_LU) 5896 if (status & E1000_STATUS_LU)
5899 wufc &= ~E1000_WUFC_LNKC; 5897 wufc &= ~E1000_WUFC_LNKC;
@@ -5945,13 +5943,6 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake,
5945 ew32(WUFC, 0); 5943 ew32(WUFC, 0);
5946 } 5944 }
5947 5945
5948 *enable_wake = !!wufc;
5949
5950 /* make sure adapter isn't asleep if manageability is enabled */
5951 if ((adapter->flags & FLAG_MNG_PT_ENABLED) ||
5952 (hw->mac.ops.check_mng_mode(hw)))
5953 *enable_wake = true;
5954
5955 if (adapter->hw.phy.type == e1000_phy_igp_3) 5946 if (adapter->hw.phy.type == e1000_phy_igp_3)
5956 e1000e_igp3_phy_powerdown_workaround_ich8lan(&adapter->hw); 5947 e1000e_igp3_phy_powerdown_workaround_ich8lan(&adapter->hw);
5957 5948
@@ -5960,27 +5951,6 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake,
5960 */ 5951 */
5961 e1000e_release_hw_control(adapter); 5952 e1000e_release_hw_control(adapter);
5962 5953
5963 pci_disable_device(pdev);
5964
5965 return 0;
5966}
5967
5968static void e1000_power_off(struct pci_dev *pdev, bool sleep, bool wake)
5969{
5970 if (sleep && wake) {
5971 pci_prepare_to_sleep(pdev);
5972 return;
5973 }
5974
5975 pci_wake_from_d3(pdev, wake);
5976 pci_set_power_state(pdev, PCI_D3hot);
5977}
5978
5979static void e1000_complete_shutdown(struct pci_dev *pdev, bool sleep, bool wake)
5980{
5981 struct net_device *netdev = pci_get_drvdata(pdev);
5982 struct e1000_adapter *adapter = netdev_priv(netdev);
5983
5984 /* The pci-e switch on some quad port adapters will report a 5954 /* The pci-e switch on some quad port adapters will report a
5985 * correctable error when the MAC transitions from D0 to D3. To 5955 * correctable error when the MAC transitions from D0 to D3. To
5986 * prevent this we need to mask off the correctable errors on the 5956 * prevent this we need to mask off the correctable errors on the
@@ -5994,12 +5964,13 @@ static void e1000_complete_shutdown(struct pci_dev *pdev, bool sleep, bool wake)
5994 pcie_capability_write_word(us_dev, PCI_EXP_DEVCTL, 5964 pcie_capability_write_word(us_dev, PCI_EXP_DEVCTL,
5995 (devctl & ~PCI_EXP_DEVCTL_CERE)); 5965 (devctl & ~PCI_EXP_DEVCTL_CERE));
5996 5966
5997 e1000_power_off(pdev, sleep, wake); 5967 pci_save_state(pdev);
5968 pci_prepare_to_sleep(pdev);
5998 5969
5999 pcie_capability_write_word(us_dev, PCI_EXP_DEVCTL, devctl); 5970 pcie_capability_write_word(us_dev, PCI_EXP_DEVCTL, devctl);
6000 } else {
6001 e1000_power_off(pdev, sleep, wake);
6002 } 5971 }
5972
5973 return 0;
6003} 5974}
6004 5975
6005#ifdef CONFIG_PCIEASPM 5976#ifdef CONFIG_PCIEASPM
@@ -6057,9 +6028,7 @@ static int __e1000_resume(struct pci_dev *pdev)
6057 if (aspm_disable_flag) 6028 if (aspm_disable_flag)
6058 e1000e_disable_aspm(pdev, aspm_disable_flag); 6029 e1000e_disable_aspm(pdev, aspm_disable_flag);
6059 6030
6060 pci_set_power_state(pdev, PCI_D0); 6031 pci_set_master(pdev);
6061 pci_restore_state(pdev);
6062 pci_save_state(pdev);
6063 6032
6064 e1000e_set_interrupt_capability(adapter); 6033 e1000e_set_interrupt_capability(adapter);
6065 if (netif_running(netdev)) { 6034 if (netif_running(netdev)) {
@@ -6125,14 +6094,8 @@ static int __e1000_resume(struct pci_dev *pdev)
6125static int e1000_suspend(struct device *dev) 6094static int e1000_suspend(struct device *dev)
6126{ 6095{
6127 struct pci_dev *pdev = to_pci_dev(dev); 6096 struct pci_dev *pdev = to_pci_dev(dev);
6128 int retval;
6129 bool wake;
6130
6131 retval = __e1000_shutdown(pdev, &wake, false);
6132 if (!retval)
6133 e1000_complete_shutdown(pdev, true, wake);
6134 6097
6135 return retval; 6098 return __e1000_shutdown(pdev, false);
6136} 6099}
6137 6100
6138static int e1000_resume(struct device *dev) 6101static int e1000_resume(struct device *dev)
@@ -6155,13 +6118,10 @@ static int e1000_runtime_suspend(struct device *dev)
6155 struct net_device *netdev = pci_get_drvdata(pdev); 6118 struct net_device *netdev = pci_get_drvdata(pdev);
6156 struct e1000_adapter *adapter = netdev_priv(netdev); 6119 struct e1000_adapter *adapter = netdev_priv(netdev);
6157 6120
6158 if (e1000e_pm_ready(adapter)) { 6121 if (!e1000e_pm_ready(adapter))
6159 bool wake; 6122 return 0;
6160
6161 __e1000_shutdown(pdev, &wake, true);
6162 }
6163 6123
6164 return 0; 6124 return __e1000_shutdown(pdev, true);
6165} 6125}
6166 6126
6167static int e1000_idle(struct device *dev) 6127static int e1000_idle(struct device *dev)
@@ -6199,12 +6159,7 @@ static int e1000_runtime_resume(struct device *dev)
6199 6159
6200static void e1000_shutdown(struct pci_dev *pdev) 6160static void e1000_shutdown(struct pci_dev *pdev)
6201{ 6161{
6202 bool wake = false; 6162 __e1000_shutdown(pdev, false);
6203
6204 __e1000_shutdown(pdev, &wake, false);
6205
6206 if (system_state == SYSTEM_POWER_OFF)
6207 e1000_complete_shutdown(pdev, false, wake);
6208} 6163}
6209 6164
6210#ifdef CONFIG_NET_POLL_CONTROLLER 6165#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -6325,9 +6280,9 @@ static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev)
6325 "Cannot re-enable PCI device after reset.\n"); 6280 "Cannot re-enable PCI device after reset.\n");
6326 result = PCI_ERS_RESULT_DISCONNECT; 6281 result = PCI_ERS_RESULT_DISCONNECT;
6327 } else { 6282 } else {
6328 pci_set_master(pdev);
6329 pdev->state_saved = true; 6283 pdev->state_saved = true;
6330 pci_restore_state(pdev); 6284 pci_restore_state(pdev);
6285 pci_set_master(pdev);
6331 6286
6332 pci_enable_wake(pdev, PCI_D3hot, 0); 6287 pci_enable_wake(pdev, PCI_D3hot, 0);
6333 pci_enable_wake(pdev, PCI_D3cold, 0); 6288 pci_enable_wake(pdev, PCI_D3cold, 0);
@@ -6757,7 +6712,11 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
6757 6712
6758 /* initialize the wol settings based on the eeprom settings */ 6713 /* initialize the wol settings based on the eeprom settings */
6759 adapter->wol = adapter->eeprom_wol; 6714 adapter->wol = adapter->eeprom_wol;
6760 device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); 6715
6716 /* make sure adapter isn't asleep if manageability is enabled */
6717 if (adapter->wol || (adapter->flags & FLAG_MNG_PT_ENABLED) ||
6718 (hw->mac.ops.check_mng_mode(hw)))
6719 device_wakeup_enable(&pdev->dev);
6761 6720
6762 /* save off EEPROM version number */ 6721 /* save off EEPROM version number */
6763 e1000_read_nvm(&adapter->hw, 5, 1, &adapter->eeprom_vers); 6722 e1000_read_nvm(&adapter->hw, 5, 1, &adapter->eeprom_vers);
diff --git a/drivers/net/ethernet/intel/e1000e/regs.h b/drivers/net/ethernet/intel/e1000e/regs.h
index 794fe1497666..a7e6a3e37257 100644
--- a/drivers/net/ethernet/intel/e1000e/regs.h
+++ b/drivers/net/ethernet/intel/e1000e/regs.h
@@ -42,6 +42,7 @@
42#define E1000_FEXTNVM 0x00028 /* Future Extended NVM - RW */ 42#define E1000_FEXTNVM 0x00028 /* Future Extended NVM - RW */
43#define E1000_FEXTNVM3 0x0003C /* Future Extended NVM 3 - RW */ 43#define E1000_FEXTNVM3 0x0003C /* Future Extended NVM 3 - RW */
44#define E1000_FEXTNVM4 0x00024 /* Future Extended NVM 4 - RW */ 44#define E1000_FEXTNVM4 0x00024 /* Future Extended NVM 4 - RW */
45#define E1000_FEXTNVM6 0x00010 /* Future Extended NVM 6 - RW */
45#define E1000_FEXTNVM7 0x000E4 /* Future Extended NVM 7 - RW */ 46#define E1000_FEXTNVM7 0x000E4 /* Future Extended NVM 7 - RW */
46#define E1000_FCT 0x00030 /* Flow Control Type - RW */ 47#define E1000_FCT 0x00030 /* Flow Control Type - RW */
47#define E1000_VET 0x00038 /* VLAN Ether Type - RW */ 48#define E1000_VET 0x00038 /* VLAN Ether Type - RW */
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c
index 84e7e0909def..b64542acfa34 100644
--- a/drivers/net/ethernet/intel/igb/e1000_82575.c
+++ b/drivers/net/ethernet/intel/igb/e1000_82575.c
@@ -1361,11 +1361,16 @@ static s32 igb_setup_copper_link_82575(struct e1000_hw *hw)
1361 switch (hw->phy.type) { 1361 switch (hw->phy.type) {
1362 case e1000_phy_i210: 1362 case e1000_phy_i210:
1363 case e1000_phy_m88: 1363 case e1000_phy_m88:
1364 if (hw->phy.id == I347AT4_E_PHY_ID || 1364 switch (hw->phy.id) {
1365 hw->phy.id == M88E1112_E_PHY_ID) 1365 case I347AT4_E_PHY_ID:
1366 case M88E1112_E_PHY_ID:
1367 case I210_I_PHY_ID:
1366 ret_val = igb_copper_link_setup_m88_gen2(hw); 1368 ret_val = igb_copper_link_setup_m88_gen2(hw);
1367 else 1369 break;
1370 default:
1368 ret_val = igb_copper_link_setup_m88(hw); 1371 ret_val = igb_copper_link_setup_m88(hw);
1372 break;
1373 }
1369 break; 1374 break;
1370 case e1000_phy_igp_3: 1375 case e1000_phy_igp_3:
1371 ret_val = igb_copper_link_setup_igp(hw); 1376 ret_val = igb_copper_link_setup_igp(hw);
diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h
index d27edbc63923..25151401c2ab 100644
--- a/drivers/net/ethernet/intel/igb/igb.h
+++ b/drivers/net/ethernet/intel/igb/igb.h
@@ -447,7 +447,7 @@ struct igb_adapter {
447#endif 447#endif
448 struct i2c_algo_bit_data i2c_algo; 448 struct i2c_algo_bit_data i2c_algo;
449 struct i2c_adapter i2c_adap; 449 struct i2c_adapter i2c_adap;
450 struct igb_i2c_client_list *i2c_clients; 450 struct i2c_client *i2c_client;
451}; 451};
452 452
453#define IGB_FLAG_HAS_MSI (1 << 0) 453#define IGB_FLAG_HAS_MSI (1 << 0)
diff --git a/drivers/net/ethernet/intel/igb/igb_hwmon.c b/drivers/net/ethernet/intel/igb/igb_hwmon.c
index 0a9b073d0b03..4623502054d5 100644
--- a/drivers/net/ethernet/intel/igb/igb_hwmon.c
+++ b/drivers/net/ethernet/intel/igb/igb_hwmon.c
@@ -39,6 +39,10 @@
39#include <linux/pci.h> 39#include <linux/pci.h>
40 40
41#ifdef CONFIG_IGB_HWMON 41#ifdef CONFIG_IGB_HWMON
42struct i2c_board_info i350_sensor_info = {
43 I2C_BOARD_INFO("i350bb", (0Xf8 >> 1)),
44};
45
42/* hwmon callback functions */ 46/* hwmon callback functions */
43static ssize_t igb_hwmon_show_location(struct device *dev, 47static ssize_t igb_hwmon_show_location(struct device *dev,
44 struct device_attribute *attr, 48 struct device_attribute *attr,
@@ -188,6 +192,7 @@ int igb_sysfs_init(struct igb_adapter *adapter)
188 unsigned int i; 192 unsigned int i;
189 int n_attrs; 193 int n_attrs;
190 int rc = 0; 194 int rc = 0;
195 struct i2c_client *client = NULL;
191 196
192 /* If this method isn't defined we don't support thermals */ 197 /* If this method isn't defined we don't support thermals */
193 if (adapter->hw.mac.ops.init_thermal_sensor_thresh == NULL) 198 if (adapter->hw.mac.ops.init_thermal_sensor_thresh == NULL)
@@ -198,6 +203,15 @@ int igb_sysfs_init(struct igb_adapter *adapter)
198 if (rc) 203 if (rc)
199 goto exit; 204 goto exit;
200 205
206 /* init i2c_client */
207 client = i2c_new_device(&adapter->i2c_adap, &i350_sensor_info);
208 if (client == NULL) {
209 dev_info(&adapter->pdev->dev,
210 "Failed to create new i2c device..\n");
211 goto exit;
212 }
213 adapter->i2c_client = client;
214
201 /* Allocation space for max attributes 215 /* Allocation space for max attributes
202 * max num sensors * values (loc, temp, max, caution) 216 * max num sensors * values (loc, temp, max, caution)
203 */ 217 */
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index ed79a1c53b59..4dbd62968c7a 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -1923,10 +1923,6 @@ void igb_set_fw_version(struct igb_adapter *adapter)
1923 return; 1923 return;
1924} 1924}
1925 1925
1926static const struct i2c_board_info i350_sensor_info = {
1927 I2C_BOARD_INFO("i350bb", 0Xf8),
1928};
1929
1930/* igb_init_i2c - Init I2C interface 1926/* igb_init_i2c - Init I2C interface
1931 * @adapter: pointer to adapter structure 1927 * @adapter: pointer to adapter structure
1932 * 1928 *
@@ -6227,13 +6223,6 @@ static struct sk_buff *igb_build_rx_buffer(struct igb_ring *rx_ring,
6227 /* If we spanned a buffer we have a huge mess so test for it */ 6223 /* If we spanned a buffer we have a huge mess so test for it */
6228 BUG_ON(unlikely(!igb_test_staterr(rx_desc, E1000_RXD_STAT_EOP))); 6224 BUG_ON(unlikely(!igb_test_staterr(rx_desc, E1000_RXD_STAT_EOP)));
6229 6225
6230 /* Guarantee this function can be used by verifying buffer sizes */
6231 BUILD_BUG_ON(SKB_WITH_OVERHEAD(IGB_RX_BUFSZ) < (NET_SKB_PAD +
6232 NET_IP_ALIGN +
6233 IGB_TS_HDR_LEN +
6234 ETH_FRAME_LEN +
6235 ETH_FCS_LEN));
6236
6237 rx_buffer = &rx_ring->rx_buffer_info[rx_ring->next_to_clean]; 6226 rx_buffer = &rx_ring->rx_buffer_info[rx_ring->next_to_clean];
6238 page = rx_buffer->page; 6227 page = rx_buffer->page;
6239 prefetchw(page); 6228 prefetchw(page);
@@ -7724,67 +7713,6 @@ static void igb_init_dmac(struct igb_adapter *adapter, u32 pba)
7724 } 7713 }
7725} 7714}
7726 7715
7727static DEFINE_SPINLOCK(i2c_clients_lock);
7728
7729/* igb_get_i2c_client - returns matching client
7730 * in adapters's client list.
7731 * @adapter: adapter struct
7732 * @dev_addr: device address of i2c needed.
7733 */
7734static struct i2c_client *
7735igb_get_i2c_client(struct igb_adapter *adapter, u8 dev_addr)
7736{
7737 ulong flags;
7738 struct igb_i2c_client_list *client_list;
7739 struct i2c_client *client = NULL;
7740 struct i2c_board_info client_info = {
7741 I2C_BOARD_INFO("igb", 0x00),
7742 };
7743
7744 spin_lock_irqsave(&i2c_clients_lock, flags);
7745 client_list = adapter->i2c_clients;
7746
7747 /* See if we already have an i2c_client */
7748 while (client_list) {
7749 if (client_list->client->addr == (dev_addr >> 1)) {
7750 client = client_list->client;
7751 goto exit;
7752 } else {
7753 client_list = client_list->next;
7754 }
7755 }
7756
7757 /* no client_list found, create a new one */
7758 client_list = kzalloc(sizeof(*client_list), GFP_ATOMIC);
7759 if (client_list == NULL)
7760 goto exit;
7761
7762 /* dev_addr passed to us is left-shifted by 1 bit
7763 * i2c_new_device call expects it to be flush to the right.
7764 */
7765 client_info.addr = dev_addr >> 1;
7766 client_info.platform_data = adapter;
7767 client_list->client = i2c_new_device(&adapter->i2c_adap, &client_info);
7768 if (client_list->client == NULL) {
7769 dev_info(&adapter->pdev->dev,
7770 "Failed to create new i2c device..\n");
7771 goto err_no_client;
7772 }
7773
7774 /* insert new client at head of list */
7775 client_list->next = adapter->i2c_clients;
7776 adapter->i2c_clients = client_list;
7777
7778 client = client_list->client;
7779 goto exit;
7780
7781err_no_client:
7782 kfree(client_list);
7783exit:
7784 spin_unlock_irqrestore(&i2c_clients_lock, flags);
7785 return client;
7786}
7787
7788/* igb_read_i2c_byte - Reads 8 bit word over I2C 7716/* igb_read_i2c_byte - Reads 8 bit word over I2C
7789 * @hw: pointer to hardware structure 7717 * @hw: pointer to hardware structure
7790 * @byte_offset: byte offset to read 7718 * @byte_offset: byte offset to read
@@ -7798,7 +7726,7 @@ s32 igb_read_i2c_byte(struct e1000_hw *hw, u8 byte_offset,
7798 u8 dev_addr, u8 *data) 7726 u8 dev_addr, u8 *data)
7799{ 7727{
7800 struct igb_adapter *adapter = container_of(hw, struct igb_adapter, hw); 7728 struct igb_adapter *adapter = container_of(hw, struct igb_adapter, hw);
7801 struct i2c_client *this_client = igb_get_i2c_client(adapter, dev_addr); 7729 struct i2c_client *this_client = adapter->i2c_client;
7802 s32 status; 7730 s32 status;
7803 u16 swfw_mask = 0; 7731 u16 swfw_mask = 0;
7804 7732
@@ -7835,7 +7763,7 @@ s32 igb_write_i2c_byte(struct e1000_hw *hw, u8 byte_offset,
7835 u8 dev_addr, u8 data) 7763 u8 dev_addr, u8 data)
7836{ 7764{
7837 struct igb_adapter *adapter = container_of(hw, struct igb_adapter, hw); 7765 struct igb_adapter *adapter = container_of(hw, struct igb_adapter, hw);
7838 struct i2c_client *this_client = igb_get_i2c_client(adapter, dev_addr); 7766 struct i2c_client *this_client = adapter->i2c_client;
7839 s32 status; 7767 s32 status;
7840 u16 swfw_mask = E1000_SWFW_PHY0_SM; 7768 u16 swfw_mask = E1000_SWFW_PHY0_SM;
7841 7769
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index 29140502b71a..6562c736a1d8 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -1081,6 +1081,45 @@ static void txq_set_fixed_prio_mode(struct tx_queue *txq)
1081 1081
1082 1082
1083/* mii management interface *************************************************/ 1083/* mii management interface *************************************************/
1084static void mv643xx_adjust_pscr(struct mv643xx_eth_private *mp)
1085{
1086 u32 pscr = rdlp(mp, PORT_SERIAL_CONTROL);
1087 u32 autoneg_disable = FORCE_LINK_PASS |
1088 DISABLE_AUTO_NEG_SPEED_GMII |
1089 DISABLE_AUTO_NEG_FOR_FLOW_CTRL |
1090 DISABLE_AUTO_NEG_FOR_DUPLEX;
1091
1092 if (mp->phy->autoneg == AUTONEG_ENABLE) {
1093 /* enable auto negotiation */
1094 pscr &= ~autoneg_disable;
1095 goto out_write;
1096 }
1097
1098 pscr |= autoneg_disable;
1099
1100 if (mp->phy->speed == SPEED_1000) {
1101 /* force gigabit, half duplex not supported */
1102 pscr |= SET_GMII_SPEED_TO_1000;
1103 pscr |= SET_FULL_DUPLEX_MODE;
1104 goto out_write;
1105 }
1106
1107 pscr &= ~SET_GMII_SPEED_TO_1000;
1108
1109 if (mp->phy->speed == SPEED_100)
1110 pscr |= SET_MII_SPEED_TO_100;
1111 else
1112 pscr &= ~SET_MII_SPEED_TO_100;
1113
1114 if (mp->phy->duplex == DUPLEX_FULL)
1115 pscr |= SET_FULL_DUPLEX_MODE;
1116 else
1117 pscr &= ~SET_FULL_DUPLEX_MODE;
1118
1119out_write:
1120 wrlp(mp, PORT_SERIAL_CONTROL, pscr);
1121}
1122
1084static irqreturn_t mv643xx_eth_err_irq(int irq, void *dev_id) 1123static irqreturn_t mv643xx_eth_err_irq(int irq, void *dev_id)
1085{ 1124{
1086 struct mv643xx_eth_shared_private *msp = dev_id; 1125 struct mv643xx_eth_shared_private *msp = dev_id;
@@ -1499,6 +1538,7 @@ static int
1499mv643xx_eth_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) 1538mv643xx_eth_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
1500{ 1539{
1501 struct mv643xx_eth_private *mp = netdev_priv(dev); 1540 struct mv643xx_eth_private *mp = netdev_priv(dev);
1541 int ret;
1502 1542
1503 if (mp->phy == NULL) 1543 if (mp->phy == NULL)
1504 return -EINVAL; 1544 return -EINVAL;
@@ -1508,7 +1548,10 @@ mv643xx_eth_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
1508 */ 1548 */
1509 cmd->advertising &= ~ADVERTISED_1000baseT_Half; 1549 cmd->advertising &= ~ADVERTISED_1000baseT_Half;
1510 1550
1511 return phy_ethtool_sset(mp->phy, cmd); 1551 ret = phy_ethtool_sset(mp->phy, cmd);
1552 if (!ret)
1553 mv643xx_adjust_pscr(mp);
1554 return ret;
1512} 1555}
1513 1556
1514static void mv643xx_eth_get_drvinfo(struct net_device *dev, 1557static void mv643xx_eth_get_drvinfo(struct net_device *dev,
@@ -2442,11 +2485,15 @@ static int mv643xx_eth_stop(struct net_device *dev)
2442static int mv643xx_eth_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) 2485static int mv643xx_eth_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
2443{ 2486{
2444 struct mv643xx_eth_private *mp = netdev_priv(dev); 2487 struct mv643xx_eth_private *mp = netdev_priv(dev);
2488 int ret;
2445 2489
2446 if (mp->phy != NULL) 2490 if (mp->phy == NULL)
2447 return phy_mii_ioctl(mp->phy, ifr, cmd); 2491 return -ENOTSUPP;
2448 2492
2449 return -EOPNOTSUPP; 2493 ret = phy_mii_ioctl(mp->phy, ifr, cmd);
2494 if (!ret)
2495 mv643xx_adjust_pscr(mp);
2496 return ret;
2450} 2497}
2451 2498
2452static int mv643xx_eth_change_mtu(struct net_device *dev, int new_mtu) 2499static int mv643xx_eth_change_mtu(struct net_device *dev, int new_mtu)
diff --git a/drivers/net/ethernet/mellanox/mlx4/cq.c b/drivers/net/ethernet/mellanox/mlx4/cq.c
index 7e64033d7de3..0706623cfb96 100644
--- a/drivers/net/ethernet/mellanox/mlx4/cq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/cq.c
@@ -226,7 +226,7 @@ void __mlx4_cq_free_icm(struct mlx4_dev *dev, int cqn)
226 226
227static void mlx4_cq_free_icm(struct mlx4_dev *dev, int cqn) 227static void mlx4_cq_free_icm(struct mlx4_dev *dev, int cqn)
228{ 228{
229 u64 in_param; 229 u64 in_param = 0;
230 int err; 230 int err;
231 231
232 if (mlx4_is_mfunc(dev)) { 232 if (mlx4_is_mfunc(dev)) {
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 4c37d487bb03..47b996096559 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -565,34 +565,38 @@ static void mlx4_en_put_qp(struct mlx4_en_priv *priv)
565 struct mlx4_en_dev *mdev = priv->mdev; 565 struct mlx4_en_dev *mdev = priv->mdev;
566 struct mlx4_dev *dev = mdev->dev; 566 struct mlx4_dev *dev = mdev->dev;
567 int qpn = priv->base_qpn; 567 int qpn = priv->base_qpn;
568 u64 mac = mlx4_en_mac_to_u64(priv->dev->dev_addr); 568 u64 mac;
569
570 en_dbg(DRV, priv, "Registering MAC: %pM for deleting\n",
571 priv->dev->dev_addr);
572 mlx4_unregister_mac(dev, priv->port, mac);
573 569
574 if (dev->caps.steering_mode != MLX4_STEERING_MODE_A0) { 570 if (dev->caps.steering_mode == MLX4_STEERING_MODE_A0) {
571 mac = mlx4_en_mac_to_u64(priv->dev->dev_addr);
572 en_dbg(DRV, priv, "Registering MAC: %pM for deleting\n",
573 priv->dev->dev_addr);
574 mlx4_unregister_mac(dev, priv->port, mac);
575 } else {
575 struct mlx4_mac_entry *entry; 576 struct mlx4_mac_entry *entry;
576 struct hlist_node *tmp; 577 struct hlist_node *tmp;
577 struct hlist_head *bucket; 578 struct hlist_head *bucket;
578 unsigned int mac_hash; 579 unsigned int i;
579 580
580 mac_hash = priv->dev->dev_addr[MLX4_EN_MAC_HASH_IDX]; 581 for (i = 0; i < MLX4_EN_MAC_HASH_SIZE; ++i) {
581 bucket = &priv->mac_hash[mac_hash]; 582 bucket = &priv->mac_hash[i];
582 hlist_for_each_entry_safe(entry, tmp, bucket, hlist) { 583 hlist_for_each_entry_safe(entry, tmp, bucket, hlist) {
583 if (ether_addr_equal_64bits(entry->mac, 584 mac = mlx4_en_mac_to_u64(entry->mac);
584 priv->dev->dev_addr)) { 585 en_dbg(DRV, priv, "Registering MAC: %pM for deleting\n",
585 en_dbg(DRV, priv, "Releasing qp: port %d, MAC %pM, qpn %d\n", 586 entry->mac);
586 priv->port, priv->dev->dev_addr, qpn);
587 mlx4_en_uc_steer_release(priv, entry->mac, 587 mlx4_en_uc_steer_release(priv, entry->mac,
588 qpn, entry->reg_id); 588 qpn, entry->reg_id);
589 mlx4_qp_release_range(dev, qpn, 1);
590 589
590 mlx4_unregister_mac(dev, priv->port, mac);
591 hlist_del_rcu(&entry->hlist); 591 hlist_del_rcu(&entry->hlist);
592 kfree_rcu(entry, rcu); 592 kfree_rcu(entry, rcu);
593 break;
594 } 593 }
595 } 594 }
595
596 en_dbg(DRV, priv, "Releasing qp: port %d, qpn %d\n",
597 priv->port, qpn);
598 mlx4_qp_release_range(dev, qpn, 1);
599 priv->flags &= ~MLX4_EN_FLAG_FORCE_PROMISC;
596 } 600 }
597} 601}
598 602
@@ -650,28 +654,10 @@ u64 mlx4_en_mac_to_u64(u8 *addr)
650 return mac; 654 return mac;
651} 655}
652 656
653static int mlx4_en_set_mac(struct net_device *dev, void *addr) 657static int mlx4_en_do_set_mac(struct mlx4_en_priv *priv)
654{
655 struct mlx4_en_priv *priv = netdev_priv(dev);
656 struct mlx4_en_dev *mdev = priv->mdev;
657 struct sockaddr *saddr = addr;
658
659 if (!is_valid_ether_addr(saddr->sa_data))
660 return -EADDRNOTAVAIL;
661
662 memcpy(dev->dev_addr, saddr->sa_data, ETH_ALEN);
663 queue_work(mdev->workqueue, &priv->mac_task);
664 return 0;
665}
666
667static void mlx4_en_do_set_mac(struct work_struct *work)
668{ 658{
669 struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv,
670 mac_task);
671 struct mlx4_en_dev *mdev = priv->mdev;
672 int err = 0; 659 int err = 0;
673 660
674 mutex_lock(&mdev->state_lock);
675 if (priv->port_up) { 661 if (priv->port_up) {
676 /* Remove old MAC and insert the new one */ 662 /* Remove old MAC and insert the new one */
677 err = mlx4_en_replace_mac(priv, priv->base_qpn, 663 err = mlx4_en_replace_mac(priv, priv->base_qpn,
@@ -683,7 +669,26 @@ static void mlx4_en_do_set_mac(struct work_struct *work)
683 } else 669 } else
684 en_dbg(HW, priv, "Port is down while registering mac, exiting...\n"); 670 en_dbg(HW, priv, "Port is down while registering mac, exiting...\n");
685 671
672 return err;
673}
674
675static int mlx4_en_set_mac(struct net_device *dev, void *addr)
676{
677 struct mlx4_en_priv *priv = netdev_priv(dev);
678 struct mlx4_en_dev *mdev = priv->mdev;
679 struct sockaddr *saddr = addr;
680 int err;
681
682 if (!is_valid_ether_addr(saddr->sa_data))
683 return -EADDRNOTAVAIL;
684
685 memcpy(dev->dev_addr, saddr->sa_data, ETH_ALEN);
686
687 mutex_lock(&mdev->state_lock);
688 err = mlx4_en_do_set_mac(priv);
686 mutex_unlock(&mdev->state_lock); 689 mutex_unlock(&mdev->state_lock);
690
691 return err;
687} 692}
688 693
689static void mlx4_en_clear_list(struct net_device *dev) 694static void mlx4_en_clear_list(struct net_device *dev)
@@ -1348,7 +1353,7 @@ static void mlx4_en_do_get_stats(struct work_struct *work)
1348 queue_delayed_work(mdev->workqueue, &priv->stats_task, STATS_DELAY); 1353 queue_delayed_work(mdev->workqueue, &priv->stats_task, STATS_DELAY);
1349 } 1354 }
1350 if (mdev->mac_removed[MLX4_MAX_PORTS + 1 - priv->port]) { 1355 if (mdev->mac_removed[MLX4_MAX_PORTS + 1 - priv->port]) {
1351 queue_work(mdev->workqueue, &priv->mac_task); 1356 mlx4_en_do_set_mac(priv);
1352 mdev->mac_removed[MLX4_MAX_PORTS + 1 - priv->port] = 0; 1357 mdev->mac_removed[MLX4_MAX_PORTS + 1 - priv->port] = 0;
1353 } 1358 }
1354 mutex_unlock(&mdev->state_lock); 1359 mutex_unlock(&mdev->state_lock);
@@ -1828,9 +1833,11 @@ int mlx4_en_alloc_resources(struct mlx4_en_priv *priv)
1828 } 1833 }
1829 1834
1830#ifdef CONFIG_RFS_ACCEL 1835#ifdef CONFIG_RFS_ACCEL
1831 priv->dev->rx_cpu_rmap = alloc_irq_cpu_rmap(priv->mdev->dev->caps.comp_pool); 1836 if (priv->mdev->dev->caps.comp_pool) {
1832 if (!priv->dev->rx_cpu_rmap) 1837 priv->dev->rx_cpu_rmap = alloc_irq_cpu_rmap(priv->mdev->dev->caps.comp_pool);
1833 goto err; 1838 if (!priv->dev->rx_cpu_rmap)
1839 goto err;
1840 }
1834#endif 1841#endif
1835 1842
1836 return 0; 1843 return 0;
@@ -2002,7 +2009,6 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
2002 priv->msg_enable = MLX4_EN_MSG_LEVEL; 2009 priv->msg_enable = MLX4_EN_MSG_LEVEL;
2003 spin_lock_init(&priv->stats_lock); 2010 spin_lock_init(&priv->stats_lock);
2004 INIT_WORK(&priv->rx_mode_task, mlx4_en_do_set_rx_mode); 2011 INIT_WORK(&priv->rx_mode_task, mlx4_en_do_set_rx_mode);
2005 INIT_WORK(&priv->mac_task, mlx4_en_do_set_mac);
2006 INIT_WORK(&priv->watchdog_task, mlx4_en_restart); 2012 INIT_WORK(&priv->watchdog_task, mlx4_en_restart);
2007 INIT_WORK(&priv->linkstate_task, mlx4_en_linkstate); 2013 INIT_WORK(&priv->linkstate_task, mlx4_en_linkstate);
2008 INIT_DELAYED_WORK(&priv->stats_task, mlx4_en_do_get_stats); 2014 INIT_DELAYED_WORK(&priv->stats_task, mlx4_en_do_get_stats);
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c
index 50917eb3013e..f6245579962d 100644
--- a/drivers/net/ethernet/mellanox/mlx4/fw.c
+++ b/drivers/net/ethernet/mellanox/mlx4/fw.c
@@ -787,6 +787,14 @@ int mlx4_QUERY_DEV_CAP_wrapper(struct mlx4_dev *dev, int slave,
787 bmme_flags &= ~MLX4_BMME_FLAG_TYPE_2_WIN; 787 bmme_flags &= ~MLX4_BMME_FLAG_TYPE_2_WIN;
788 MLX4_PUT(outbox->buf, bmme_flags, QUERY_DEV_CAP_BMME_FLAGS_OFFSET); 788 MLX4_PUT(outbox->buf, bmme_flags, QUERY_DEV_CAP_BMME_FLAGS_OFFSET);
789 789
790 /* turn off device-managed steering capability if not enabled */
791 if (dev->caps.steering_mode != MLX4_STEERING_MODE_DEVICE_MANAGED) {
792 MLX4_GET(field, outbox->buf,
793 QUERY_DEV_CAP_FLOW_STEERING_RANGE_EN_OFFSET);
794 field &= 0x7f;
795 MLX4_PUT(outbox->buf, field,
796 QUERY_DEV_CAP_FLOW_STEERING_RANGE_EN_OFFSET);
797 }
790 return 0; 798 return 0;
791} 799}
792 800
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index d180bc46826a..16abde20e1fc 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -1555,7 +1555,7 @@ void __mlx4_counter_free(struct mlx4_dev *dev, u32 idx)
1555 1555
1556void mlx4_counter_free(struct mlx4_dev *dev, u32 idx) 1556void mlx4_counter_free(struct mlx4_dev *dev, u32 idx)
1557{ 1557{
1558 u64 in_param; 1558 u64 in_param = 0;
1559 1559
1560 if (mlx4_is_mfunc(dev)) { 1560 if (mlx4_is_mfunc(dev)) {
1561 set_param_l(&in_param, idx); 1561 set_param_l(&in_param, idx);
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4.h b/drivers/net/ethernet/mellanox/mlx4/mlx4.h
index cf883345af88..d738454116a0 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4.h
@@ -1235,7 +1235,7 @@ int mlx4_get_qp_per_mgm(struct mlx4_dev *dev);
1235 1235
1236static inline void set_param_l(u64 *arg, u32 val) 1236static inline void set_param_l(u64 *arg, u32 val)
1237{ 1237{
1238 *((u32 *)arg) = val; 1238 *arg = (*arg & 0xffffffff00000000ULL) | (u64) val;
1239} 1239}
1240 1240
1241static inline void set_param_h(u64 *arg, u32 val) 1241static inline void set_param_h(u64 *arg, u32 val)
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
index c313d7e943a9..f710b7ce0dcb 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
@@ -509,7 +509,6 @@ struct mlx4_en_priv {
509 struct mlx4_en_cq rx_cq[MAX_RX_RINGS]; 509 struct mlx4_en_cq rx_cq[MAX_RX_RINGS];
510 struct mlx4_qp drop_qp; 510 struct mlx4_qp drop_qp;
511 struct work_struct rx_mode_task; 511 struct work_struct rx_mode_task;
512 struct work_struct mac_task;
513 struct work_struct watchdog_task; 512 struct work_struct watchdog_task;
514 struct work_struct linkstate_task; 513 struct work_struct linkstate_task;
515 struct delayed_work stats_task; 514 struct delayed_work stats_task;
diff --git a/drivers/net/ethernet/mellanox/mlx4/mr.c b/drivers/net/ethernet/mellanox/mlx4/mr.c
index 602ca9bf78e4..f91719a08cba 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mr.c
+++ b/drivers/net/ethernet/mellanox/mlx4/mr.c
@@ -183,7 +183,7 @@ u32 __mlx4_alloc_mtt_range(struct mlx4_dev *dev, int order)
183 183
184static u32 mlx4_alloc_mtt_range(struct mlx4_dev *dev, int order) 184static u32 mlx4_alloc_mtt_range(struct mlx4_dev *dev, int order)
185{ 185{
186 u64 in_param; 186 u64 in_param = 0;
187 u64 out_param; 187 u64 out_param;
188 int err; 188 int err;
189 189
@@ -240,7 +240,7 @@ void __mlx4_free_mtt_range(struct mlx4_dev *dev, u32 offset, int order)
240 240
241static void mlx4_free_mtt_range(struct mlx4_dev *dev, u32 offset, int order) 241static void mlx4_free_mtt_range(struct mlx4_dev *dev, u32 offset, int order)
242{ 242{
243 u64 in_param; 243 u64 in_param = 0;
244 int err; 244 int err;
245 245
246 if (mlx4_is_mfunc(dev)) { 246 if (mlx4_is_mfunc(dev)) {
@@ -351,7 +351,7 @@ void __mlx4_mpt_release(struct mlx4_dev *dev, u32 index)
351 351
352static void mlx4_mpt_release(struct mlx4_dev *dev, u32 index) 352static void mlx4_mpt_release(struct mlx4_dev *dev, u32 index)
353{ 353{
354 u64 in_param; 354 u64 in_param = 0;
355 355
356 if (mlx4_is_mfunc(dev)) { 356 if (mlx4_is_mfunc(dev)) {
357 set_param_l(&in_param, index); 357 set_param_l(&in_param, index);
@@ -374,7 +374,7 @@ int __mlx4_mpt_alloc_icm(struct mlx4_dev *dev, u32 index)
374 374
375static int mlx4_mpt_alloc_icm(struct mlx4_dev *dev, u32 index) 375static int mlx4_mpt_alloc_icm(struct mlx4_dev *dev, u32 index)
376{ 376{
377 u64 param; 377 u64 param = 0;
378 378
379 if (mlx4_is_mfunc(dev)) { 379 if (mlx4_is_mfunc(dev)) {
380 set_param_l(&param, index); 380 set_param_l(&param, index);
@@ -395,7 +395,7 @@ void __mlx4_mpt_free_icm(struct mlx4_dev *dev, u32 index)
395 395
396static void mlx4_mpt_free_icm(struct mlx4_dev *dev, u32 index) 396static void mlx4_mpt_free_icm(struct mlx4_dev *dev, u32 index)
397{ 397{
398 u64 in_param; 398 u64 in_param = 0;
399 399
400 if (mlx4_is_mfunc(dev)) { 400 if (mlx4_is_mfunc(dev)) {
401 set_param_l(&in_param, index); 401 set_param_l(&in_param, index);
diff --git a/drivers/net/ethernet/mellanox/mlx4/pd.c b/drivers/net/ethernet/mellanox/mlx4/pd.c
index 1ac88637ad9d..00f223acada7 100644
--- a/drivers/net/ethernet/mellanox/mlx4/pd.c
+++ b/drivers/net/ethernet/mellanox/mlx4/pd.c
@@ -101,7 +101,7 @@ void __mlx4_xrcd_free(struct mlx4_dev *dev, u32 xrcdn)
101 101
102void mlx4_xrcd_free(struct mlx4_dev *dev, u32 xrcdn) 102void mlx4_xrcd_free(struct mlx4_dev *dev, u32 xrcdn)
103{ 103{
104 u64 in_param; 104 u64 in_param = 0;
105 int err; 105 int err;
106 106
107 if (mlx4_is_mfunc(dev)) { 107 if (mlx4_is_mfunc(dev)) {
diff --git a/drivers/net/ethernet/mellanox/mlx4/port.c b/drivers/net/ethernet/mellanox/mlx4/port.c
index 719ead15e491..10c57c86388b 100644
--- a/drivers/net/ethernet/mellanox/mlx4/port.c
+++ b/drivers/net/ethernet/mellanox/mlx4/port.c
@@ -175,7 +175,7 @@ EXPORT_SYMBOL_GPL(__mlx4_register_mac);
175 175
176int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac) 176int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac)
177{ 177{
178 u64 out_param; 178 u64 out_param = 0;
179 int err; 179 int err;
180 180
181 if (mlx4_is_mfunc(dev)) { 181 if (mlx4_is_mfunc(dev)) {
@@ -222,7 +222,7 @@ EXPORT_SYMBOL_GPL(__mlx4_unregister_mac);
222 222
223void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, u64 mac) 223void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, u64 mac)
224{ 224{
225 u64 out_param; 225 u64 out_param = 0;
226 226
227 if (mlx4_is_mfunc(dev)) { 227 if (mlx4_is_mfunc(dev)) {
228 set_param_l(&out_param, port); 228 set_param_l(&out_param, port);
@@ -361,7 +361,7 @@ out:
361 361
362int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index) 362int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index)
363{ 363{
364 u64 out_param; 364 u64 out_param = 0;
365 int err; 365 int err;
366 366
367 if (mlx4_is_mfunc(dev)) { 367 if (mlx4_is_mfunc(dev)) {
@@ -406,7 +406,7 @@ out:
406 406
407void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index) 407void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index)
408{ 408{
409 u64 in_param; 409 u64 in_param = 0;
410 int err; 410 int err;
411 411
412 if (mlx4_is_mfunc(dev)) { 412 if (mlx4_is_mfunc(dev)) {
diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c
index 81e2abe07bbb..e891b058c1be 100644
--- a/drivers/net/ethernet/mellanox/mlx4/qp.c
+++ b/drivers/net/ethernet/mellanox/mlx4/qp.c
@@ -222,7 +222,7 @@ int __mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align,
222 222
223int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, int *base) 223int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, int *base)
224{ 224{
225 u64 in_param; 225 u64 in_param = 0;
226 u64 out_param; 226 u64 out_param;
227 int err; 227 int err;
228 228
@@ -255,7 +255,7 @@ void __mlx4_qp_release_range(struct mlx4_dev *dev, int base_qpn, int cnt)
255 255
256void mlx4_qp_release_range(struct mlx4_dev *dev, int base_qpn, int cnt) 256void mlx4_qp_release_range(struct mlx4_dev *dev, int base_qpn, int cnt)
257{ 257{
258 u64 in_param; 258 u64 in_param = 0;
259 int err; 259 int err;
260 260
261 if (mlx4_is_mfunc(dev)) { 261 if (mlx4_is_mfunc(dev)) {
@@ -319,7 +319,7 @@ err_out:
319 319
320static int mlx4_qp_alloc_icm(struct mlx4_dev *dev, int qpn) 320static int mlx4_qp_alloc_icm(struct mlx4_dev *dev, int qpn)
321{ 321{
322 u64 param; 322 u64 param = 0;
323 323
324 if (mlx4_is_mfunc(dev)) { 324 if (mlx4_is_mfunc(dev)) {
325 set_param_l(&param, qpn); 325 set_param_l(&param, qpn);
@@ -344,7 +344,7 @@ void __mlx4_qp_free_icm(struct mlx4_dev *dev, int qpn)
344 344
345static void mlx4_qp_free_icm(struct mlx4_dev *dev, int qpn) 345static void mlx4_qp_free_icm(struct mlx4_dev *dev, int qpn)
346{ 346{
347 u64 in_param; 347 u64 in_param = 0;
348 348
349 if (mlx4_is_mfunc(dev)) { 349 if (mlx4_is_mfunc(dev)) {
350 set_param_l(&in_param, qpn); 350 set_param_l(&in_param, qpn);
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index 083fb48dc3d7..2995687f1aee 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -2990,6 +2990,9 @@ int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave,
2990 u8 steer_type_mask = 2; 2990 u8 steer_type_mask = 2;
2991 enum mlx4_steer_type type = (gid[7] & steer_type_mask) >> 1; 2991 enum mlx4_steer_type type = (gid[7] & steer_type_mask) >> 1;
2992 2992
2993 if (dev->caps.steering_mode != MLX4_STEERING_MODE_B0)
2994 return -EINVAL;
2995
2993 qpn = vhcr->in_modifier & 0xffffff; 2996 qpn = vhcr->in_modifier & 0xffffff;
2994 err = get_res(dev, slave, qpn, RES_QP, &rqp); 2997 err = get_res(dev, slave, qpn, RES_QP, &rqp);
2995 if (err) 2998 if (err)
diff --git a/drivers/net/ethernet/mellanox/mlx4/srq.c b/drivers/net/ethernet/mellanox/mlx4/srq.c
index feda6c00829f..e329fe1f11b7 100644
--- a/drivers/net/ethernet/mellanox/mlx4/srq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/srq.c
@@ -149,7 +149,7 @@ void __mlx4_srq_free_icm(struct mlx4_dev *dev, int srqn)
149 149
150static void mlx4_srq_free_icm(struct mlx4_dev *dev, int srqn) 150static void mlx4_srq_free_icm(struct mlx4_dev *dev, int srqn)
151{ 151{
152 u64 in_param; 152 u64 in_param = 0;
153 153
154 if (mlx4_is_mfunc(dev)) { 154 if (mlx4_is_mfunc(dev)) {
155 set_param_l(&in_param, srqn); 155 set_param_l(&in_param, srqn);
diff --git a/drivers/net/hippi/rrunner.c b/drivers/net/hippi/rrunner.c
index e5b19b056909..3c4d6274bb9b 100644
--- a/drivers/net/hippi/rrunner.c
+++ b/drivers/net/hippi/rrunner.c
@@ -202,6 +202,9 @@ static int rr_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
202 return 0; 202 return 0;
203 203
204 out: 204 out:
205 if (rrpriv->evt_ring)
206 pci_free_consistent(pdev, EVT_RING_SIZE, rrpriv->evt_ring,
207 rrpriv->evt_ring_dma);
205 if (rrpriv->rx_ring) 208 if (rrpriv->rx_ring)
206 pci_free_consistent(pdev, RX_TOTAL_SIZE, rrpriv->rx_ring, 209 pci_free_consistent(pdev, RX_TOTAL_SIZE, rrpriv->rx_ring,
207 rrpriv->rx_ring_dma); 210 rrpriv->rx_ring_dma);
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 417b2af1aa80..73abbc1655d5 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -660,6 +660,7 @@ void macvlan_common_setup(struct net_device *dev)
660 ether_setup(dev); 660 ether_setup(dev);
661 661
662 dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING); 662 dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING);
663 dev->priv_flags |= IFF_UNICAST_FLT;
663 dev->netdev_ops = &macvlan_netdev_ops; 664 dev->netdev_ops = &macvlan_netdev_ops;
664 dev->destructor = free_netdev; 665 dev->destructor = free_netdev;
665 dev->header_ops = &macvlan_hard_header_ops, 666 dev->header_ops = &macvlan_hard_header_ops,
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 6ba0883b9c36..621c1bddeee9 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -1151,6 +1151,8 @@ static int team_port_del(struct team *team, struct net_device *port_dev)
1151 netdev_upper_dev_unlink(port_dev, dev); 1151 netdev_upper_dev_unlink(port_dev, dev);
1152 team_port_disable_netpoll(port); 1152 team_port_disable_netpoll(port);
1153 vlan_vids_del_by_dev(port_dev, dev); 1153 vlan_vids_del_by_dev(port_dev, dev);
1154 dev_uc_unsync(port_dev, dev);
1155 dev_mc_unsync(port_dev, dev);
1154 dev_close(port_dev); 1156 dev_close(port_dev);
1155 team_port_leave(team, port); 1157 team_port_leave(team, port);
1156 1158
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 2c6a22e278ea..b7c457adc0dc 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -747,6 +747,8 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
747 goto drop; 747 goto drop;
748 skb_orphan(skb); 748 skb_orphan(skb);
749 749
750 nf_reset(skb);
751
750 /* Enqueue packet */ 752 /* Enqueue packet */
751 skb_queue_tail(&tfile->socket.sk->sk_receive_queue, skb); 753 skb_queue_tail(&tfile->socket.sk->sk_receive_queue, skb);
752 754
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index 4aad350e4dae..eae7a03d4f9b 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -2958,6 +2958,7 @@ vmxnet3_probe_device(struct pci_dev *pdev,
2958 2958
2959 adapter->num_rx_queues = num_rx_queues; 2959 adapter->num_rx_queues = num_rx_queues;
2960 adapter->num_tx_queues = num_tx_queues; 2960 adapter->num_tx_queues = num_tx_queues;
2961 adapter->rx_buf_per_pkt = 1;
2961 2962
2962 size = sizeof(struct Vmxnet3_TxQueueDesc) * adapter->num_tx_queues; 2963 size = sizeof(struct Vmxnet3_TxQueueDesc) * adapter->num_tx_queues;
2963 size += sizeof(struct Vmxnet3_RxQueueDesc) * adapter->num_rx_queues; 2964 size += sizeof(struct Vmxnet3_RxQueueDesc) * adapter->num_rx_queues;
diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c
index a0feb17a0238..63a124340cbe 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethtool.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c
@@ -472,6 +472,12 @@ vmxnet3_set_ringparam(struct net_device *netdev,
472 VMXNET3_RX_RING_MAX_SIZE) 472 VMXNET3_RX_RING_MAX_SIZE)
473 return -EINVAL; 473 return -EINVAL;
474 474
475 /* if adapter not yet initialized, do nothing */
476 if (adapter->rx_buf_per_pkt == 0) {
477 netdev_err(netdev, "adapter not completely initialized, "
478 "ring size cannot be changed yet\n");
479 return -EOPNOTSUPP;
480 }
475 481
476 /* round it up to a multiple of VMXNET3_RING_SIZE_ALIGN */ 482 /* round it up to a multiple of VMXNET3_RING_SIZE_ALIGN */
477 new_tx_ring_size = (param->tx_pending + VMXNET3_RING_SIZE_MASK) & 483 new_tx_ring_size = (param->tx_pending + VMXNET3_RING_SIZE_MASK) &
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h
index 3198384689d9..35418146fa17 100644
--- a/drivers/net/vmxnet3/vmxnet3_int.h
+++ b/drivers/net/vmxnet3/vmxnet3_int.h
@@ -70,10 +70,10 @@
70/* 70/*
71 * Version numbers 71 * Version numbers
72 */ 72 */
73#define VMXNET3_DRIVER_VERSION_STRING "1.1.29.0-k" 73#define VMXNET3_DRIVER_VERSION_STRING "1.1.30.0-k"
74 74
75/* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */ 75/* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */
76#define VMXNET3_DRIVER_VERSION_NUM 0x01011D00 76#define VMXNET3_DRIVER_VERSION_NUM 0x01011E00
77 77
78#if defined(CONFIG_PCI_MSI) 78#if defined(CONFIG_PCI_MSI)
79 /* RSS only makes sense if MSI-X is supported. */ 79 /* RSS only makes sense if MSI-X is supported. */
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index f3a135cb50a9..db0df07c18dc 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -974,6 +974,8 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
974 iph->ttl = ttl ? : ip4_dst_hoplimit(&rt->dst); 974 iph->ttl = ttl ? : ip4_dst_hoplimit(&rt->dst);
975 tunnel_ip_select_ident(skb, old_iph, &rt->dst); 975 tunnel_ip_select_ident(skb, old_iph, &rt->dst);
976 976
977 nf_reset(skb);
978
977 vxlan_set_owner(dev, skb); 979 vxlan_set_owner(dev, skb);
978 980
979 if (handle_offloads(skb)) 981 if (handle_offloads(skb))
@@ -1507,6 +1509,14 @@ static __net_init int vxlan_init_net(struct net *net)
1507static __net_exit void vxlan_exit_net(struct net *net) 1509static __net_exit void vxlan_exit_net(struct net *net)
1508{ 1510{
1509 struct vxlan_net *vn = net_generic(net, vxlan_net_id); 1511 struct vxlan_net *vn = net_generic(net, vxlan_net_id);
1512 struct vxlan_dev *vxlan;
1513 unsigned h;
1514
1515 rtnl_lock();
1516 for (h = 0; h < VNI_HASH_SIZE; ++h)
1517 hlist_for_each_entry(vxlan, &vn->vni_list[h], hlist)
1518 dev_close(vxlan->dev);
1519 rtnl_unlock();
1510 1520
1511 if (vn->sock) { 1521 if (vn->sock) {
1512 sk_release_kernel(vn->sock->sk); 1522 sk_release_kernel(vn->sock->sk);
diff --git a/drivers/net/wireless/iwlwifi/dvm/sta.c b/drivers/net/wireless/iwlwifi/dvm/sta.c
index 94ef33838bc6..b775769f8322 100644
--- a/drivers/net/wireless/iwlwifi/dvm/sta.c
+++ b/drivers/net/wireless/iwlwifi/dvm/sta.c
@@ -151,7 +151,7 @@ int iwl_send_add_sta(struct iwl_priv *priv,
151 sta_id, sta->sta.addr, flags & CMD_ASYNC ? "a" : ""); 151 sta_id, sta->sta.addr, flags & CMD_ASYNC ? "a" : "");
152 152
153 if (!(flags & CMD_ASYNC)) { 153 if (!(flags & CMD_ASYNC)) {
154 cmd.flags |= CMD_WANT_SKB | CMD_WANT_HCMD; 154 cmd.flags |= CMD_WANT_SKB;
155 might_sleep(); 155 might_sleep();
156 } 156 }
157 157
diff --git a/drivers/net/wireless/iwlwifi/iwl-devtrace.h b/drivers/net/wireless/iwlwifi/iwl-devtrace.h
index 10f01793d7a6..81aa91fab5aa 100644
--- a/drivers/net/wireless/iwlwifi/iwl-devtrace.h
+++ b/drivers/net/wireless/iwlwifi/iwl-devtrace.h
@@ -363,7 +363,7 @@ TRACE_EVENT(iwlwifi_dev_hcmd,
363 __entry->flags = cmd->flags; 363 __entry->flags = cmd->flags;
364 memcpy(__get_dynamic_array(hcmd), hdr, sizeof(*hdr)); 364 memcpy(__get_dynamic_array(hcmd), hdr, sizeof(*hdr));
365 365
366 for (i = 0; i < IWL_MAX_CMD_TFDS; i++) { 366 for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) {
367 if (!cmd->len[i]) 367 if (!cmd->len[i])
368 continue; 368 continue;
369 memcpy((u8 *)__get_dynamic_array(hcmd) + offset, 369 memcpy((u8 *)__get_dynamic_array(hcmd) + offset,
diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.c b/drivers/net/wireless/iwlwifi/iwl-drv.c
index 6f228bb2b844..fbfd2d137117 100644
--- a/drivers/net/wireless/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/iwlwifi/iwl-drv.c
@@ -1102,7 +1102,6 @@ void iwl_drv_stop(struct iwl_drv *drv)
1102 1102
1103/* shared module parameters */ 1103/* shared module parameters */
1104struct iwl_mod_params iwlwifi_mod_params = { 1104struct iwl_mod_params iwlwifi_mod_params = {
1105 .amsdu_size_8K = 1,
1106 .restart_fw = 1, 1105 .restart_fw = 1,
1107 .plcp_check = true, 1106 .plcp_check = true,
1108 .bt_coex_active = true, 1107 .bt_coex_active = true,
@@ -1207,7 +1206,7 @@ MODULE_PARM_DESC(11n_disable,
1207 "disable 11n functionality, bitmap: 1: full, 2: agg TX, 4: agg RX"); 1206 "disable 11n functionality, bitmap: 1: full, 2: agg TX, 4: agg RX");
1208module_param_named(amsdu_size_8K, iwlwifi_mod_params.amsdu_size_8K, 1207module_param_named(amsdu_size_8K, iwlwifi_mod_params.amsdu_size_8K,
1209 int, S_IRUGO); 1208 int, S_IRUGO);
1210MODULE_PARM_DESC(amsdu_size_8K, "enable 8K amsdu size"); 1209MODULE_PARM_DESC(amsdu_size_8K, "enable 8K amsdu size (default 0)");
1211module_param_named(fw_restart, iwlwifi_mod_params.restart_fw, int, S_IRUGO); 1210module_param_named(fw_restart, iwlwifi_mod_params.restart_fw, int, S_IRUGO);
1212MODULE_PARM_DESC(fw_restart, "restart firmware in case of error"); 1211MODULE_PARM_DESC(fw_restart, "restart firmware in case of error");
1213 1212
diff --git a/drivers/net/wireless/iwlwifi/iwl-modparams.h b/drivers/net/wireless/iwlwifi/iwl-modparams.h
index e5e3a79eae2f..2c2a729092f5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-modparams.h
+++ b/drivers/net/wireless/iwlwifi/iwl-modparams.h
@@ -91,7 +91,7 @@ enum iwl_power_level {
91 * @sw_crypto: using hardware encryption, default = 0 91 * @sw_crypto: using hardware encryption, default = 0
92 * @disable_11n: disable 11n capabilities, default = 0, 92 * @disable_11n: disable 11n capabilities, default = 0,
93 * use IWL_DISABLE_HT_* constants 93 * use IWL_DISABLE_HT_* constants
94 * @amsdu_size_8K: enable 8K amsdu size, default = 1 94 * @amsdu_size_8K: enable 8K amsdu size, default = 0
95 * @restart_fw: restart firmware, default = 1 95 * @restart_fw: restart firmware, default = 1
96 * @plcp_check: enable plcp health check, default = true 96 * @plcp_check: enable plcp health check, default = true
97 * @wd_disable: enable stuck queue check, default = 0 97 * @wd_disable: enable stuck queue check, default = 0
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h
index 8c7bec6b9a0b..0cac2b7af78b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
@@ -186,19 +186,13 @@ struct iwl_rx_packet {
186 * @CMD_ASYNC: Return right away and don't want for the response 186 * @CMD_ASYNC: Return right away and don't want for the response
187 * @CMD_WANT_SKB: valid only with CMD_SYNC. The caller needs the buffer of the 187 * @CMD_WANT_SKB: valid only with CMD_SYNC. The caller needs the buffer of the
188 * response. The caller needs to call iwl_free_resp when done. 188 * response. The caller needs to call iwl_free_resp when done.
189 * @CMD_WANT_HCMD: The caller needs to get the HCMD that was sent in the
190 * response handler. Chunks flagged by %IWL_HCMD_DFL_NOCOPY won't be
191 * copied. The pointer passed to the response handler is in the transport
192 * ownership and don't need to be freed by the op_mode. This also means
193 * that the pointer is invalidated after the op_mode's handler returns.
194 * @CMD_ON_DEMAND: This command is sent by the test mode pipe. 189 * @CMD_ON_DEMAND: This command is sent by the test mode pipe.
195 */ 190 */
196enum CMD_MODE { 191enum CMD_MODE {
197 CMD_SYNC = 0, 192 CMD_SYNC = 0,
198 CMD_ASYNC = BIT(0), 193 CMD_ASYNC = BIT(0),
199 CMD_WANT_SKB = BIT(1), 194 CMD_WANT_SKB = BIT(1),
200 CMD_WANT_HCMD = BIT(2), 195 CMD_ON_DEMAND = BIT(2),
201 CMD_ON_DEMAND = BIT(3),
202}; 196};
203 197
204#define DEF_CMD_PAYLOAD_SIZE 320 198#define DEF_CMD_PAYLOAD_SIZE 320
@@ -217,7 +211,11 @@ struct iwl_device_cmd {
217 211
218#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_device_cmd)) 212#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_device_cmd))
219 213
220#define IWL_MAX_CMD_TFDS 2 214/*
215 * number of transfer buffers (fragments) per transmit frame descriptor;
216 * this is just the driver's idea, the hardware supports 20
217 */
218#define IWL_MAX_CMD_TBS_PER_TFD 2
221 219
222/** 220/**
223 * struct iwl_hcmd_dataflag - flag for each one of the chunks of the command 221 * struct iwl_hcmd_dataflag - flag for each one of the chunks of the command
@@ -254,15 +252,15 @@ enum iwl_hcmd_dataflag {
254 * @id: id of the host command 252 * @id: id of the host command
255 */ 253 */
256struct iwl_host_cmd { 254struct iwl_host_cmd {
257 const void *data[IWL_MAX_CMD_TFDS]; 255 const void *data[IWL_MAX_CMD_TBS_PER_TFD];
258 struct iwl_rx_packet *resp_pkt; 256 struct iwl_rx_packet *resp_pkt;
259 unsigned long _rx_page_addr; 257 unsigned long _rx_page_addr;
260 u32 _rx_page_order; 258 u32 _rx_page_order;
261 int handler_status; 259 int handler_status;
262 260
263 u32 flags; 261 u32 flags;
264 u16 len[IWL_MAX_CMD_TFDS]; 262 u16 len[IWL_MAX_CMD_TBS_PER_TFD];
265 u8 dataflags[IWL_MAX_CMD_TFDS]; 263 u8 dataflags[IWL_MAX_CMD_TBS_PER_TFD];
266 u8 id; 264 u8 id;
267}; 265};
268 266
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api.h b/drivers/net/wireless/iwlwifi/mvm/fw-api.h
index 23eebda848b0..2adb61f103f4 100644
--- a/drivers/net/wireless/iwlwifi/mvm/fw-api.h
+++ b/drivers/net/wireless/iwlwifi/mvm/fw-api.h
@@ -762,18 +762,20 @@ struct iwl_phy_context_cmd {
762#define IWL_RX_INFO_PHY_CNT 8 762#define IWL_RX_INFO_PHY_CNT 8
763#define IWL_RX_INFO_AGC_IDX 1 763#define IWL_RX_INFO_AGC_IDX 1
764#define IWL_RX_INFO_RSSI_AB_IDX 2 764#define IWL_RX_INFO_RSSI_AB_IDX 2
765#define IWL_RX_INFO_RSSI_C_IDX 3 765#define IWL_OFDM_AGC_A_MSK 0x0000007f
766#define IWL_OFDM_AGC_DB_MSK 0xfe00 766#define IWL_OFDM_AGC_A_POS 0
767#define IWL_OFDM_AGC_DB_POS 9 767#define IWL_OFDM_AGC_B_MSK 0x00003f80
768#define IWL_OFDM_AGC_B_POS 7
769#define IWL_OFDM_AGC_CODE_MSK 0x3fe00000
770#define IWL_OFDM_AGC_CODE_POS 20
768#define IWL_OFDM_RSSI_INBAND_A_MSK 0x00ff 771#define IWL_OFDM_RSSI_INBAND_A_MSK 0x00ff
769#define IWL_OFDM_RSSI_ALLBAND_A_MSK 0xff00
770#define IWL_OFDM_RSSI_A_POS 0 772#define IWL_OFDM_RSSI_A_POS 0
773#define IWL_OFDM_RSSI_ALLBAND_A_MSK 0xff00
774#define IWL_OFDM_RSSI_ALLBAND_A_POS 8
771#define IWL_OFDM_RSSI_INBAND_B_MSK 0xff0000 775#define IWL_OFDM_RSSI_INBAND_B_MSK 0xff0000
772#define IWL_OFDM_RSSI_ALLBAND_B_MSK 0xff000000
773#define IWL_OFDM_RSSI_B_POS 16 776#define IWL_OFDM_RSSI_B_POS 16
774#define IWL_OFDM_RSSI_INBAND_C_MSK 0x00ff 777#define IWL_OFDM_RSSI_ALLBAND_B_MSK 0xff000000
775#define IWL_OFDM_RSSI_ALLBAND_C_MSK 0xff00 778#define IWL_OFDM_RSSI_ALLBAND_B_POS 24
776#define IWL_OFDM_RSSI_C_POS 0
777 779
778/** 780/**
779 * struct iwl_rx_phy_info - phy info 781 * struct iwl_rx_phy_info - phy info
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw.c b/drivers/net/wireless/iwlwifi/mvm/fw.c
index d3d959db03a9..500f818dba04 100644
--- a/drivers/net/wireless/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/iwlwifi/mvm/fw.c
@@ -79,17 +79,8 @@
79#define UCODE_VALID_OK cpu_to_le32(0x1) 79#define UCODE_VALID_OK cpu_to_le32(0x1)
80 80
81/* Default calibration values for WkP - set to INIT image w/o running */ 81/* Default calibration values for WkP - set to INIT image w/o running */
82static const u8 wkp_calib_values_bb_filter[] = { 0xbf, 0x00, 0x5f, 0x00, 0x2f,
83 0x00, 0x18, 0x00 };
84static const u8 wkp_calib_values_rx_dc[] = { 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
85 0x7f, 0x7f, 0x7f };
86static const u8 wkp_calib_values_tx_lo[] = { 0x00, 0x00, 0x00, 0x00 };
87static const u8 wkp_calib_values_tx_iq[] = { 0xff, 0x00, 0xff, 0x00, 0x00,
88 0x00 };
89static const u8 wkp_calib_values_rx_iq[] = { 0xff, 0x00, 0x00, 0x00 };
90static const u8 wkp_calib_values_rx_iq_skew[] = { 0x00, 0x00, 0x01, 0x00 }; 82static const u8 wkp_calib_values_rx_iq_skew[] = { 0x00, 0x00, 0x01, 0x00 };
91static const u8 wkp_calib_values_tx_iq_skew[] = { 0x01, 0x00, 0x00, 0x00 }; 83static const u8 wkp_calib_values_tx_iq_skew[] = { 0x01, 0x00, 0x00, 0x00 };
92static const u8 wkp_calib_values_xtal[] = { 0xd2, 0xd2 };
93 84
94struct iwl_calib_default_data { 85struct iwl_calib_default_data {
95 u16 size; 86 u16 size;
@@ -99,12 +90,7 @@ struct iwl_calib_default_data {
99#define CALIB_SIZE_N_DATA(_buf) {.size = sizeof(_buf), .data = &_buf} 90#define CALIB_SIZE_N_DATA(_buf) {.size = sizeof(_buf), .data = &_buf}
100 91
101static const struct iwl_calib_default_data wkp_calib_default_data[12] = { 92static const struct iwl_calib_default_data wkp_calib_default_data[12] = {
102 [5] = CALIB_SIZE_N_DATA(wkp_calib_values_rx_dc),
103 [6] = CALIB_SIZE_N_DATA(wkp_calib_values_bb_filter),
104 [7] = CALIB_SIZE_N_DATA(wkp_calib_values_tx_lo),
105 [8] = CALIB_SIZE_N_DATA(wkp_calib_values_tx_iq),
106 [9] = CALIB_SIZE_N_DATA(wkp_calib_values_tx_iq_skew), 93 [9] = CALIB_SIZE_N_DATA(wkp_calib_values_tx_iq_skew),
107 [10] = CALIB_SIZE_N_DATA(wkp_calib_values_rx_iq),
108 [11] = CALIB_SIZE_N_DATA(wkp_calib_values_rx_iq_skew), 94 [11] = CALIB_SIZE_N_DATA(wkp_calib_values_rx_iq_skew),
109}; 95};
110 96
@@ -241,20 +227,6 @@ static int iwl_mvm_load_ucode_wait_alive(struct iwl_mvm *mvm,
241 227
242 return 0; 228 return 0;
243} 229}
244#define IWL_HW_REV_ID_RAINBOW 0x2
245#define IWL_PROJ_TYPE_LHP 0x5
246
247static u32 iwl_mvm_build_phy_cfg(struct iwl_mvm *mvm)
248{
249 struct iwl_nvm_data *data = mvm->nvm_data;
250 /* Temp calls to static definitions, will be changed to CSR calls */
251 u8 hw_rev_id = IWL_HW_REV_ID_RAINBOW;
252 u8 project_type = IWL_PROJ_TYPE_LHP;
253
254 return data->radio_cfg_dash | (data->radio_cfg_step << 2) |
255 (hw_rev_id << 4) | ((project_type & 0x7f) << 6) |
256 (data->valid_tx_ant << 16) | (data->valid_rx_ant << 20);
257}
258 230
259static int iwl_send_phy_cfg_cmd(struct iwl_mvm *mvm) 231static int iwl_send_phy_cfg_cmd(struct iwl_mvm *mvm)
260{ 232{
@@ -262,7 +234,7 @@ static int iwl_send_phy_cfg_cmd(struct iwl_mvm *mvm)
262 enum iwl_ucode_type ucode_type = mvm->cur_ucode; 234 enum iwl_ucode_type ucode_type = mvm->cur_ucode;
263 235
264 /* Set parameters */ 236 /* Set parameters */
265 phy_cfg_cmd.phy_cfg = cpu_to_le32(iwl_mvm_build_phy_cfg(mvm)); 237 phy_cfg_cmd.phy_cfg = cpu_to_le32(mvm->fw->phy_config);
266 phy_cfg_cmd.calib_control.event_trigger = 238 phy_cfg_cmd.calib_control.event_trigger =
267 mvm->fw->default_calib[ucode_type].event_trigger; 239 mvm->fw->default_calib[ucode_type].event_trigger;
268 phy_cfg_cmd.calib_control.flow_trigger = 240 phy_cfg_cmd.calib_control.flow_trigger =
@@ -275,103 +247,6 @@ static int iwl_send_phy_cfg_cmd(struct iwl_mvm *mvm)
275 sizeof(phy_cfg_cmd), &phy_cfg_cmd); 247 sizeof(phy_cfg_cmd), &phy_cfg_cmd);
276} 248}
277 249
278/* Starting with the new PHY DB implementation - New calibs are enabled */
279/* Value - 0x405e7 */
280#define IWL_CALIB_DEFAULT_FLOW_INIT (IWL_CALIB_CFG_XTAL_IDX |\
281 IWL_CALIB_CFG_TEMPERATURE_IDX |\
282 IWL_CALIB_CFG_VOLTAGE_READ_IDX |\
283 IWL_CALIB_CFG_DC_IDX |\
284 IWL_CALIB_CFG_BB_FILTER_IDX |\
285 IWL_CALIB_CFG_LO_LEAKAGE_IDX |\
286 IWL_CALIB_CFG_TX_IQ_IDX |\
287 IWL_CALIB_CFG_RX_IQ_IDX |\
288 IWL_CALIB_CFG_AGC_IDX)
289
290#define IWL_CALIB_DEFAULT_EVENT_INIT 0x0
291
292/* Value 0x41567 */
293#define IWL_CALIB_DEFAULT_FLOW_RUN (IWL_CALIB_CFG_XTAL_IDX |\
294 IWL_CALIB_CFG_TEMPERATURE_IDX |\
295 IWL_CALIB_CFG_VOLTAGE_READ_IDX |\
296 IWL_CALIB_CFG_BB_FILTER_IDX |\
297 IWL_CALIB_CFG_DC_IDX |\
298 IWL_CALIB_CFG_TX_IQ_IDX |\
299 IWL_CALIB_CFG_RX_IQ_IDX |\
300 IWL_CALIB_CFG_SENSITIVITY_IDX |\
301 IWL_CALIB_CFG_AGC_IDX)
302
303#define IWL_CALIB_DEFAULT_EVENT_RUN (IWL_CALIB_CFG_XTAL_IDX |\
304 IWL_CALIB_CFG_TEMPERATURE_IDX |\
305 IWL_CALIB_CFG_VOLTAGE_READ_IDX |\
306 IWL_CALIB_CFG_TX_PWR_IDX |\
307 IWL_CALIB_CFG_DC_IDX |\
308 IWL_CALIB_CFG_TX_IQ_IDX |\
309 IWL_CALIB_CFG_SENSITIVITY_IDX)
310
311/*
312 * Sets the calibrations trigger values that will be sent to the FW for runtime
313 * and init calibrations.
314 * The ones given in the FW TLV are not correct.
315 */
316static void iwl_set_default_calib_trigger(struct iwl_mvm *mvm)
317{
318 struct iwl_tlv_calib_ctrl default_calib;
319
320 /*
321 * WkP FW TLV calib bits are wrong, overwrite them.
322 * This defines the dynamic calibrations which are implemented in the
323 * uCode both for init(flow) calculation and event driven calibs.
324 */
325
326 /* Init Image */
327 default_calib.event_trigger = cpu_to_le32(IWL_CALIB_DEFAULT_EVENT_INIT);
328 default_calib.flow_trigger = cpu_to_le32(IWL_CALIB_DEFAULT_FLOW_INIT);
329
330 if (default_calib.event_trigger !=
331 mvm->fw->default_calib[IWL_UCODE_INIT].event_trigger)
332 IWL_ERR(mvm,
333 "Updating the event calib for INIT image: 0x%x -> 0x%x\n",
334 mvm->fw->default_calib[IWL_UCODE_INIT].event_trigger,
335 default_calib.event_trigger);
336 if (default_calib.flow_trigger !=
337 mvm->fw->default_calib[IWL_UCODE_INIT].flow_trigger)
338 IWL_ERR(mvm,
339 "Updating the flow calib for INIT image: 0x%x -> 0x%x\n",
340 mvm->fw->default_calib[IWL_UCODE_INIT].flow_trigger,
341 default_calib.flow_trigger);
342
343 memcpy((void *)&mvm->fw->default_calib[IWL_UCODE_INIT],
344 &default_calib, sizeof(struct iwl_tlv_calib_ctrl));
345 IWL_ERR(mvm,
346 "Setting uCode init calibrations event 0x%x, trigger 0x%x\n",
347 default_calib.event_trigger,
348 default_calib.flow_trigger);
349
350 /* Run time image */
351 default_calib.event_trigger = cpu_to_le32(IWL_CALIB_DEFAULT_EVENT_RUN);
352 default_calib.flow_trigger = cpu_to_le32(IWL_CALIB_DEFAULT_FLOW_RUN);
353
354 if (default_calib.event_trigger !=
355 mvm->fw->default_calib[IWL_UCODE_REGULAR].event_trigger)
356 IWL_ERR(mvm,
357 "Updating the event calib for RT image: 0x%x -> 0x%x\n",
358 mvm->fw->default_calib[IWL_UCODE_REGULAR].event_trigger,
359 default_calib.event_trigger);
360 if (default_calib.flow_trigger !=
361 mvm->fw->default_calib[IWL_UCODE_REGULAR].flow_trigger)
362 IWL_ERR(mvm,
363 "Updating the flow calib for RT image: 0x%x -> 0x%x\n",
364 mvm->fw->default_calib[IWL_UCODE_REGULAR].flow_trigger,
365 default_calib.flow_trigger);
366
367 memcpy((void *)&mvm->fw->default_calib[IWL_UCODE_REGULAR],
368 &default_calib, sizeof(struct iwl_tlv_calib_ctrl));
369 IWL_ERR(mvm,
370 "Setting uCode runtime calibs event 0x%x, trigger 0x%x\n",
371 default_calib.event_trigger,
372 default_calib.flow_trigger);
373}
374
375static int iwl_set_default_calibrations(struct iwl_mvm *mvm) 250static int iwl_set_default_calibrations(struct iwl_mvm *mvm)
376{ 251{
377 u8 cmd_raw[16]; /* holds the variable size commands */ 252 u8 cmd_raw[16]; /* holds the variable size commands */
@@ -446,8 +321,10 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm)
446 ret = iwl_nvm_check_version(mvm->nvm_data, mvm->trans); 321 ret = iwl_nvm_check_version(mvm->nvm_data, mvm->trans);
447 WARN_ON(ret); 322 WARN_ON(ret);
448 323
449 /* Override the calibrations from TLV and the const of fw */ 324 /* Send TX valid antennas before triggering calibrations */
450 iwl_set_default_calib_trigger(mvm); 325 ret = iwl_send_tx_ant_cfg(mvm, mvm->nvm_data->valid_tx_ant);
326 if (ret)
327 goto error;
451 328
452 /* WkP doesn't have all calibrations, need to set default values */ 329 /* WkP doesn't have all calibrations, need to set default values */
453 if (mvm->cfg->device_family == IWL_DEVICE_FAMILY_7000) { 330 if (mvm->cfg->device_family == IWL_DEVICE_FAMILY_7000) {
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h
index 537711b10478..bdae700c769e 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h
@@ -80,7 +80,8 @@
80 80
81#define IWL_INVALID_MAC80211_QUEUE 0xff 81#define IWL_INVALID_MAC80211_QUEUE 0xff
82#define IWL_MVM_MAX_ADDRESSES 2 82#define IWL_MVM_MAX_ADDRESSES 2
83#define IWL_RSSI_OFFSET 44 83/* RSSI offset for WkP */
84#define IWL_RSSI_OFFSET 50
84 85
85enum iwl_mvm_tx_fifo { 86enum iwl_mvm_tx_fifo {
86 IWL_MVM_TX_FIFO_BK = 0, 87 IWL_MVM_TX_FIFO_BK = 0,
diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c b/drivers/net/wireless/iwlwifi/mvm/ops.c
index aa59adf87db3..d0f9c1e0475e 100644
--- a/drivers/net/wireless/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/iwlwifi/mvm/ops.c
@@ -624,12 +624,8 @@ static void iwl_mvm_free_skb(struct iwl_op_mode *op_mode, struct sk_buff *skb)
624 ieee80211_free_txskb(mvm->hw, skb); 624 ieee80211_free_txskb(mvm->hw, skb);
625} 625}
626 626
627static void iwl_mvm_nic_error(struct iwl_op_mode *op_mode) 627static void iwl_mvm_nic_restart(struct iwl_mvm *mvm)
628{ 628{
629 struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode);
630
631 iwl_mvm_dump_nic_error_log(mvm);
632
633 iwl_abort_notification_waits(&mvm->notif_wait); 629 iwl_abort_notification_waits(&mvm->notif_wait);
634 630
635 /* 631 /*
@@ -663,9 +659,21 @@ static void iwl_mvm_nic_error(struct iwl_op_mode *op_mode)
663 } 659 }
664} 660}
665 661
662static void iwl_mvm_nic_error(struct iwl_op_mode *op_mode)
663{
664 struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode);
665
666 iwl_mvm_dump_nic_error_log(mvm);
667
668 iwl_mvm_nic_restart(mvm);
669}
670
666static void iwl_mvm_cmd_queue_full(struct iwl_op_mode *op_mode) 671static void iwl_mvm_cmd_queue_full(struct iwl_op_mode *op_mode)
667{ 672{
673 struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode);
674
668 WARN_ON(1); 675 WARN_ON(1);
676 iwl_mvm_nic_restart(mvm);
669} 677}
670 678
671static const struct iwl_op_mode_ops iwl_mvm_ops = { 679static const struct iwl_op_mode_ops iwl_mvm_ops = {
diff --git a/drivers/net/wireless/iwlwifi/mvm/rx.c b/drivers/net/wireless/iwlwifi/mvm/rx.c
index 3f40ab05bbd8..b0b190d0ec23 100644
--- a/drivers/net/wireless/iwlwifi/mvm/rx.c
+++ b/drivers/net/wireless/iwlwifi/mvm/rx.c
@@ -131,33 +131,42 @@ static void iwl_mvm_pass_packet_to_mac80211(struct iwl_mvm *mvm,
131static int iwl_mvm_calc_rssi(struct iwl_mvm *mvm, 131static int iwl_mvm_calc_rssi(struct iwl_mvm *mvm,
132 struct iwl_rx_phy_info *phy_info) 132 struct iwl_rx_phy_info *phy_info)
133{ 133{
134 u32 rssi_a, rssi_b, rssi_c, max_rssi, agc_db; 134 int rssi_a, rssi_b, rssi_a_dbm, rssi_b_dbm, max_rssi_dbm;
135 int rssi_all_band_a, rssi_all_band_b;
136 u32 agc_a, agc_b, max_agc;
135 u32 val; 137 u32 val;
136 138
137 /* Find max rssi among 3 possible receivers. 139 /* Find max rssi among 2 possible receivers.
138 * These values are measured by the Digital Signal Processor (DSP). 140 * These values are measured by the Digital Signal Processor (DSP).
139 * They should stay fairly constant even as the signal strength varies, 141 * They should stay fairly constant even as the signal strength varies,
140 * if the radio's Automatic Gain Control (AGC) is working right. 142 * if the radio's Automatic Gain Control (AGC) is working right.
141 * AGC value (see below) will provide the "interesting" info. 143 * AGC value (see below) will provide the "interesting" info.
142 */ 144 */
145 val = le32_to_cpu(phy_info->non_cfg_phy[IWL_RX_INFO_AGC_IDX]);
146 agc_a = (val & IWL_OFDM_AGC_A_MSK) >> IWL_OFDM_AGC_A_POS;
147 agc_b = (val & IWL_OFDM_AGC_B_MSK) >> IWL_OFDM_AGC_B_POS;
148 max_agc = max_t(u32, agc_a, agc_b);
149
143 val = le32_to_cpu(phy_info->non_cfg_phy[IWL_RX_INFO_RSSI_AB_IDX]); 150 val = le32_to_cpu(phy_info->non_cfg_phy[IWL_RX_INFO_RSSI_AB_IDX]);
144 rssi_a = (val & IWL_OFDM_RSSI_INBAND_A_MSK) >> IWL_OFDM_RSSI_A_POS; 151 rssi_a = (val & IWL_OFDM_RSSI_INBAND_A_MSK) >> IWL_OFDM_RSSI_A_POS;
145 rssi_b = (val & IWL_OFDM_RSSI_INBAND_B_MSK) >> IWL_OFDM_RSSI_B_POS; 152 rssi_b = (val & IWL_OFDM_RSSI_INBAND_B_MSK) >> IWL_OFDM_RSSI_B_POS;
146 val = le32_to_cpu(phy_info->non_cfg_phy[IWL_RX_INFO_RSSI_C_IDX]); 153 rssi_all_band_a = (val & IWL_OFDM_RSSI_ALLBAND_A_MSK) >>
147 rssi_c = (val & IWL_OFDM_RSSI_INBAND_C_MSK) >> IWL_OFDM_RSSI_C_POS; 154 IWL_OFDM_RSSI_ALLBAND_A_POS;
148 155 rssi_all_band_b = (val & IWL_OFDM_RSSI_ALLBAND_B_MSK) >>
149 val = le32_to_cpu(phy_info->non_cfg_phy[IWL_RX_INFO_AGC_IDX]); 156 IWL_OFDM_RSSI_ALLBAND_B_POS;
150 agc_db = (val & IWL_OFDM_AGC_DB_MSK) >> IWL_OFDM_AGC_DB_POS;
151 157
152 max_rssi = max_t(u32, rssi_a, rssi_b); 158 /*
153 max_rssi = max_t(u32, max_rssi, rssi_c); 159 * dBm = rssi dB - agc dB - constant.
160 * Higher AGC (higher radio gain) means lower signal.
161 */
162 rssi_a_dbm = rssi_a - IWL_RSSI_OFFSET - agc_a;
163 rssi_b_dbm = rssi_b - IWL_RSSI_OFFSET - agc_b;
164 max_rssi_dbm = max_t(int, rssi_a_dbm, rssi_b_dbm);
154 165
155 IWL_DEBUG_STATS(mvm, "Rssi In A %d B %d C %d Max %d AGC dB %d\n", 166 IWL_DEBUG_STATS(mvm, "Rssi In A %d B %d Max %d AGCA %d AGCB %d\n",
156 rssi_a, rssi_b, rssi_c, max_rssi, agc_db); 167 rssi_a_dbm, rssi_b_dbm, max_rssi_dbm, agc_a, agc_b);
157 168
158 /* dBm = max_rssi dB - agc dB - constant. 169 return max_rssi_dbm;
159 * Higher AGC (higher radio gain) means lower signal. */
160 return max_rssi - agc_db - IWL_RSSI_OFFSET;
161} 170}
162 171
163/* 172/*
diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.c b/drivers/net/wireless/iwlwifi/mvm/sta.c
index 861a7f9f8e7f..274f44e2ef60 100644
--- a/drivers/net/wireless/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/iwlwifi/mvm/sta.c
@@ -770,6 +770,16 @@ int iwl_mvm_sta_tx_agg_stop(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
770 u16 txq_id; 770 u16 txq_id;
771 int err; 771 int err;
772 772
773
774 /*
775 * If mac80211 is cleaning its state, then say that we finished since
776 * our state has been cleared anyway.
777 */
778 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) {
779 ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
780 return 0;
781 }
782
773 spin_lock_bh(&mvmsta->lock); 783 spin_lock_bh(&mvmsta->lock);
774 784
775 txq_id = tid_data->txq_id; 785 txq_id = tid_data->txq_id;
diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c
index 6b67ce3f679c..6645efe5c03e 100644
--- a/drivers/net/wireless/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/iwlwifi/mvm/tx.c
@@ -607,12 +607,8 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm,
607 607
608 /* Single frame failure in an AMPDU queue => send BAR */ 608 /* Single frame failure in an AMPDU queue => send BAR */
609 if (txq_id >= IWL_FIRST_AMPDU_QUEUE && 609 if (txq_id >= IWL_FIRST_AMPDU_QUEUE &&
610 !(info->flags & IEEE80211_TX_STAT_ACK)) { 610 !(info->flags & IEEE80211_TX_STAT_ACK))
611 /* there must be only one skb in the skb_list */
612 WARN_ON_ONCE(skb_freed > 1 ||
613 !skb_queue_empty(&skbs));
614 info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK; 611 info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK;
615 }
616 612
617 /* W/A FW bug: seq_ctl is wrong when the queue is flushed */ 613 /* W/A FW bug: seq_ctl is wrong when the queue is flushed */
618 if (status == TX_STATUS_FAIL_FIFO_FLUSHED) { 614 if (status == TX_STATUS_FAIL_FIFO_FLUSHED) {
diff --git a/drivers/net/wireless/iwlwifi/pcie/internal.h b/drivers/net/wireless/iwlwifi/pcie/internal.h
index 3d62e8055352..148843e7f34f 100644
--- a/drivers/net/wireless/iwlwifi/pcie/internal.h
+++ b/drivers/net/wireless/iwlwifi/pcie/internal.h
@@ -137,10 +137,6 @@ static inline int iwl_queue_dec_wrap(int index, int n_bd)
137struct iwl_cmd_meta { 137struct iwl_cmd_meta {
138 /* only for SYNC commands, iff the reply skb is wanted */ 138 /* only for SYNC commands, iff the reply skb is wanted */
139 struct iwl_host_cmd *source; 139 struct iwl_host_cmd *source;
140
141 DEFINE_DMA_UNMAP_ADDR(mapping);
142 DEFINE_DMA_UNMAP_LEN(len);
143
144 u32 flags; 140 u32 flags;
145}; 141};
146 142
@@ -185,25 +181,36 @@ struct iwl_queue {
185/* 181/*
186 * The FH will write back to the first TB only, so we need 182 * The FH will write back to the first TB only, so we need
187 * to copy some data into the buffer regardless of whether 183 * to copy some data into the buffer regardless of whether
188 * it should be mapped or not. This indicates how much to 184 * it should be mapped or not. This indicates how big the
189 * copy, even for HCMDs it must be big enough to fit the 185 * first TB must be to include the scratch buffer. Since
190 * DRAM scratch from the TX cmd, at least 16 bytes. 186 * the scratch is 4 bytes at offset 12, it's 16 now. If we
187 * make it bigger then allocations will be bigger and copy
188 * slower, so that's probably not useful.
191 */ 189 */
192#define IWL_HCMD_MIN_COPY_SIZE 16 190#define IWL_HCMD_SCRATCHBUF_SIZE 16
193 191
194struct iwl_pcie_txq_entry { 192struct iwl_pcie_txq_entry {
195 struct iwl_device_cmd *cmd; 193 struct iwl_device_cmd *cmd;
196 struct iwl_device_cmd *copy_cmd;
197 struct sk_buff *skb; 194 struct sk_buff *skb;
198 /* buffer to free after command completes */ 195 /* buffer to free after command completes */
199 const void *free_buf; 196 const void *free_buf;
200 struct iwl_cmd_meta meta; 197 struct iwl_cmd_meta meta;
201}; 198};
202 199
200struct iwl_pcie_txq_scratch_buf {
201 struct iwl_cmd_header hdr;
202 u8 buf[8];
203 __le32 scratch;
204};
205
203/** 206/**
204 * struct iwl_txq - Tx Queue for DMA 207 * struct iwl_txq - Tx Queue for DMA
205 * @q: generic Rx/Tx queue descriptor 208 * @q: generic Rx/Tx queue descriptor
206 * @tfds: transmit frame descriptors (DMA memory) 209 * @tfds: transmit frame descriptors (DMA memory)
210 * @scratchbufs: start of command headers, including scratch buffers, for
211 * the writeback -- this is DMA memory and an array holding one buffer
212 * for each command on the queue
213 * @scratchbufs_dma: DMA address for the scratchbufs start
207 * @entries: transmit entries (driver state) 214 * @entries: transmit entries (driver state)
208 * @lock: queue lock 215 * @lock: queue lock
209 * @stuck_timer: timer that fires if queue gets stuck 216 * @stuck_timer: timer that fires if queue gets stuck
@@ -217,6 +224,8 @@ struct iwl_pcie_txq_entry {
217struct iwl_txq { 224struct iwl_txq {
218 struct iwl_queue q; 225 struct iwl_queue q;
219 struct iwl_tfd *tfds; 226 struct iwl_tfd *tfds;
227 struct iwl_pcie_txq_scratch_buf *scratchbufs;
228 dma_addr_t scratchbufs_dma;
220 struct iwl_pcie_txq_entry *entries; 229 struct iwl_pcie_txq_entry *entries;
221 spinlock_t lock; 230 spinlock_t lock;
222 struct timer_list stuck_timer; 231 struct timer_list stuck_timer;
@@ -225,6 +234,13 @@ struct iwl_txq {
225 u8 active; 234 u8 active;
226}; 235};
227 236
237static inline dma_addr_t
238iwl_pcie_get_scratchbuf_dma(struct iwl_txq *txq, int idx)
239{
240 return txq->scratchbufs_dma +
241 sizeof(struct iwl_pcie_txq_scratch_buf) * idx;
242}
243
228/** 244/**
229 * struct iwl_trans_pcie - PCIe transport specific data 245 * struct iwl_trans_pcie - PCIe transport specific data
230 * @rxq: all the RX queue data 246 * @rxq: all the RX queue data
diff --git a/drivers/net/wireless/iwlwifi/pcie/rx.c b/drivers/net/wireless/iwlwifi/pcie/rx.c
index b0ae06d2456f..567e67ad1f61 100644
--- a/drivers/net/wireless/iwlwifi/pcie/rx.c
+++ b/drivers/net/wireless/iwlwifi/pcie/rx.c
@@ -637,22 +637,14 @@ static void iwl_pcie_rx_handle_rb(struct iwl_trans *trans,
637 index = SEQ_TO_INDEX(sequence); 637 index = SEQ_TO_INDEX(sequence);
638 cmd_index = get_cmd_index(&txq->q, index); 638 cmd_index = get_cmd_index(&txq->q, index);
639 639
640 if (reclaim) { 640 if (reclaim)
641 struct iwl_pcie_txq_entry *ent; 641 cmd = txq->entries[cmd_index].cmd;
642 ent = &txq->entries[cmd_index]; 642 else
643 cmd = ent->copy_cmd;
644 WARN_ON_ONCE(!cmd && ent->meta.flags & CMD_WANT_HCMD);
645 } else {
646 cmd = NULL; 643 cmd = NULL;
647 }
648 644
649 err = iwl_op_mode_rx(trans->op_mode, &rxcb, cmd); 645 err = iwl_op_mode_rx(trans->op_mode, &rxcb, cmd);
650 646
651 if (reclaim) { 647 if (reclaim) {
652 /* The original command isn't needed any more */
653 kfree(txq->entries[cmd_index].copy_cmd);
654 txq->entries[cmd_index].copy_cmd = NULL;
655 /* nor is the duplicated part of the command */
656 kfree(txq->entries[cmd_index].free_buf); 648 kfree(txq->entries[cmd_index].free_buf);
657 txq->entries[cmd_index].free_buf = NULL; 649 txq->entries[cmd_index].free_buf = NULL;
658 } 650 }
diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c
index 8b625a7f5685..8595c16f74de 100644
--- a/drivers/net/wireless/iwlwifi/pcie/tx.c
+++ b/drivers/net/wireless/iwlwifi/pcie/tx.c
@@ -191,12 +191,9 @@ static void iwl_pcie_txq_stuck_timer(unsigned long data)
191 } 191 }
192 192
193 for (i = q->read_ptr; i != q->write_ptr; 193 for (i = q->read_ptr; i != q->write_ptr;
194 i = iwl_queue_inc_wrap(i, q->n_bd)) { 194 i = iwl_queue_inc_wrap(i, q->n_bd))
195 struct iwl_tx_cmd *tx_cmd =
196 (struct iwl_tx_cmd *)txq->entries[i].cmd->payload;
197 IWL_ERR(trans, "scratch %d = 0x%08x\n", i, 195 IWL_ERR(trans, "scratch %d = 0x%08x\n", i,
198 get_unaligned_le32(&tx_cmd->scratch)); 196 le32_to_cpu(txq->scratchbufs[i].scratch));
199 }
200 197
201 iwl_op_mode_nic_error(trans->op_mode); 198 iwl_op_mode_nic_error(trans->op_mode);
202} 199}
@@ -367,8 +364,8 @@ static inline u8 iwl_pcie_tfd_get_num_tbs(struct iwl_tfd *tfd)
367} 364}
368 365
369static void iwl_pcie_tfd_unmap(struct iwl_trans *trans, 366static void iwl_pcie_tfd_unmap(struct iwl_trans *trans,
370 struct iwl_cmd_meta *meta, struct iwl_tfd *tfd, 367 struct iwl_cmd_meta *meta,
371 enum dma_data_direction dma_dir) 368 struct iwl_tfd *tfd)
372{ 369{
373 int i; 370 int i;
374 int num_tbs; 371 int num_tbs;
@@ -382,17 +379,12 @@ static void iwl_pcie_tfd_unmap(struct iwl_trans *trans,
382 return; 379 return;
383 } 380 }
384 381
385 /* Unmap tx_cmd */ 382 /* first TB is never freed - it's the scratchbuf data */
386 if (num_tbs)
387 dma_unmap_single(trans->dev,
388 dma_unmap_addr(meta, mapping),
389 dma_unmap_len(meta, len),
390 DMA_BIDIRECTIONAL);
391 383
392 /* Unmap chunks, if any. */
393 for (i = 1; i < num_tbs; i++) 384 for (i = 1; i < num_tbs; i++)
394 dma_unmap_single(trans->dev, iwl_pcie_tfd_tb_get_addr(tfd, i), 385 dma_unmap_single(trans->dev, iwl_pcie_tfd_tb_get_addr(tfd, i),
395 iwl_pcie_tfd_tb_get_len(tfd, i), dma_dir); 386 iwl_pcie_tfd_tb_get_len(tfd, i),
387 DMA_TO_DEVICE);
396 388
397 tfd->num_tbs = 0; 389 tfd->num_tbs = 0;
398} 390}
@@ -406,8 +398,7 @@ static void iwl_pcie_tfd_unmap(struct iwl_trans *trans,
406 * Does NOT advance any TFD circular buffer read/write indexes 398 * Does NOT advance any TFD circular buffer read/write indexes
407 * Does NOT free the TFD itself (which is within circular buffer) 399 * Does NOT free the TFD itself (which is within circular buffer)
408 */ 400 */
409static void iwl_pcie_txq_free_tfd(struct iwl_trans *trans, struct iwl_txq *txq, 401static void iwl_pcie_txq_free_tfd(struct iwl_trans *trans, struct iwl_txq *txq)
410 enum dma_data_direction dma_dir)
411{ 402{
412 struct iwl_tfd *tfd_tmp = txq->tfds; 403 struct iwl_tfd *tfd_tmp = txq->tfds;
413 404
@@ -418,8 +409,7 @@ static void iwl_pcie_txq_free_tfd(struct iwl_trans *trans, struct iwl_txq *txq,
418 lockdep_assert_held(&txq->lock); 409 lockdep_assert_held(&txq->lock);
419 410
420 /* We have only q->n_window txq->entries, but we use q->n_bd tfds */ 411 /* We have only q->n_window txq->entries, but we use q->n_bd tfds */
421 iwl_pcie_tfd_unmap(trans, &txq->entries[idx].meta, &tfd_tmp[rd_ptr], 412 iwl_pcie_tfd_unmap(trans, &txq->entries[idx].meta, &tfd_tmp[rd_ptr]);
422 dma_dir);
423 413
424 /* free SKB */ 414 /* free SKB */
425 if (txq->entries) { 415 if (txq->entries) {
@@ -479,6 +469,7 @@ static int iwl_pcie_txq_alloc(struct iwl_trans *trans,
479{ 469{
480 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 470 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
481 size_t tfd_sz = sizeof(struct iwl_tfd) * TFD_QUEUE_SIZE_MAX; 471 size_t tfd_sz = sizeof(struct iwl_tfd) * TFD_QUEUE_SIZE_MAX;
472 size_t scratchbuf_sz;
482 int i; 473 int i;
483 474
484 if (WARN_ON(txq->entries || txq->tfds)) 475 if (WARN_ON(txq->entries || txq->tfds))
@@ -514,9 +505,25 @@ static int iwl_pcie_txq_alloc(struct iwl_trans *trans,
514 IWL_ERR(trans, "dma_alloc_coherent(%zd) failed\n", tfd_sz); 505 IWL_ERR(trans, "dma_alloc_coherent(%zd) failed\n", tfd_sz);
515 goto error; 506 goto error;
516 } 507 }
508
509 BUILD_BUG_ON(IWL_HCMD_SCRATCHBUF_SIZE != sizeof(*txq->scratchbufs));
510 BUILD_BUG_ON(offsetof(struct iwl_pcie_txq_scratch_buf, scratch) !=
511 sizeof(struct iwl_cmd_header) +
512 offsetof(struct iwl_tx_cmd, scratch));
513
514 scratchbuf_sz = sizeof(*txq->scratchbufs) * slots_num;
515
516 txq->scratchbufs = dma_alloc_coherent(trans->dev, scratchbuf_sz,
517 &txq->scratchbufs_dma,
518 GFP_KERNEL);
519 if (!txq->scratchbufs)
520 goto err_free_tfds;
521
517 txq->q.id = txq_id; 522 txq->q.id = txq_id;
518 523
519 return 0; 524 return 0;
525err_free_tfds:
526 dma_free_coherent(trans->dev, tfd_sz, txq->tfds, txq->q.dma_addr);
520error: 527error:
521 if (txq->entries && txq_id == trans_pcie->cmd_queue) 528 if (txq->entries && txq_id == trans_pcie->cmd_queue)
522 for (i = 0; i < slots_num; i++) 529 for (i = 0; i < slots_num; i++)
@@ -565,22 +572,13 @@ static void iwl_pcie_txq_unmap(struct iwl_trans *trans, int txq_id)
565 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 572 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
566 struct iwl_txq *txq = &trans_pcie->txq[txq_id]; 573 struct iwl_txq *txq = &trans_pcie->txq[txq_id];
567 struct iwl_queue *q = &txq->q; 574 struct iwl_queue *q = &txq->q;
568 enum dma_data_direction dma_dir;
569 575
570 if (!q->n_bd) 576 if (!q->n_bd)
571 return; 577 return;
572 578
573 /* In the command queue, all the TBs are mapped as BIDI
574 * so unmap them as such.
575 */
576 if (txq_id == trans_pcie->cmd_queue)
577 dma_dir = DMA_BIDIRECTIONAL;
578 else
579 dma_dir = DMA_TO_DEVICE;
580
581 spin_lock_bh(&txq->lock); 579 spin_lock_bh(&txq->lock);
582 while (q->write_ptr != q->read_ptr) { 580 while (q->write_ptr != q->read_ptr) {
583 iwl_pcie_txq_free_tfd(trans, txq, dma_dir); 581 iwl_pcie_txq_free_tfd(trans, txq);
584 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd); 582 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd);
585 } 583 }
586 spin_unlock_bh(&txq->lock); 584 spin_unlock_bh(&txq->lock);
@@ -610,7 +608,6 @@ static void iwl_pcie_txq_free(struct iwl_trans *trans, int txq_id)
610 if (txq_id == trans_pcie->cmd_queue) 608 if (txq_id == trans_pcie->cmd_queue)
611 for (i = 0; i < txq->q.n_window; i++) { 609 for (i = 0; i < txq->q.n_window; i++) {
612 kfree(txq->entries[i].cmd); 610 kfree(txq->entries[i].cmd);
613 kfree(txq->entries[i].copy_cmd);
614 kfree(txq->entries[i].free_buf); 611 kfree(txq->entries[i].free_buf);
615 } 612 }
616 613
@@ -619,6 +616,10 @@ static void iwl_pcie_txq_free(struct iwl_trans *trans, int txq_id)
619 dma_free_coherent(dev, sizeof(struct iwl_tfd) * 616 dma_free_coherent(dev, sizeof(struct iwl_tfd) *
620 txq->q.n_bd, txq->tfds, txq->q.dma_addr); 617 txq->q.n_bd, txq->tfds, txq->q.dma_addr);
621 txq->q.dma_addr = 0; 618 txq->q.dma_addr = 0;
619
620 dma_free_coherent(dev,
621 sizeof(*txq->scratchbufs) * txq->q.n_window,
622 txq->scratchbufs, txq->scratchbufs_dma);
622 } 623 }
623 624
624 kfree(txq->entries); 625 kfree(txq->entries);
@@ -962,7 +963,7 @@ void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn,
962 963
963 iwl_pcie_txq_inval_byte_cnt_tbl(trans, txq); 964 iwl_pcie_txq_inval_byte_cnt_tbl(trans, txq);
964 965
965 iwl_pcie_txq_free_tfd(trans, txq, DMA_TO_DEVICE); 966 iwl_pcie_txq_free_tfd(trans, txq);
966 } 967 }
967 968
968 iwl_pcie_txq_progress(trans_pcie, txq); 969 iwl_pcie_txq_progress(trans_pcie, txq);
@@ -1152,29 +1153,29 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans,
1152 void *dup_buf = NULL; 1153 void *dup_buf = NULL;
1153 dma_addr_t phys_addr; 1154 dma_addr_t phys_addr;
1154 int idx; 1155 int idx;
1155 u16 copy_size, cmd_size, dma_size; 1156 u16 copy_size, cmd_size, scratch_size;
1156 bool had_nocopy = false; 1157 bool had_nocopy = false;
1157 int i; 1158 int i;
1158 u32 cmd_pos; 1159 u32 cmd_pos;
1159 const u8 *cmddata[IWL_MAX_CMD_TFDS]; 1160 const u8 *cmddata[IWL_MAX_CMD_TBS_PER_TFD];
1160 u16 cmdlen[IWL_MAX_CMD_TFDS]; 1161 u16 cmdlen[IWL_MAX_CMD_TBS_PER_TFD];
1161 1162
1162 copy_size = sizeof(out_cmd->hdr); 1163 copy_size = sizeof(out_cmd->hdr);
1163 cmd_size = sizeof(out_cmd->hdr); 1164 cmd_size = sizeof(out_cmd->hdr);
1164 1165
1165 /* need one for the header if the first is NOCOPY */ 1166 /* need one for the header if the first is NOCOPY */
1166 BUILD_BUG_ON(IWL_MAX_CMD_TFDS > IWL_NUM_OF_TBS - 1); 1167 BUILD_BUG_ON(IWL_MAX_CMD_TBS_PER_TFD > IWL_NUM_OF_TBS - 1);
1167 1168
1168 for (i = 0; i < IWL_MAX_CMD_TFDS; i++) { 1169 for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) {
1169 cmddata[i] = cmd->data[i]; 1170 cmddata[i] = cmd->data[i];
1170 cmdlen[i] = cmd->len[i]; 1171 cmdlen[i] = cmd->len[i];
1171 1172
1172 if (!cmd->len[i]) 1173 if (!cmd->len[i])
1173 continue; 1174 continue;
1174 1175
1175 /* need at least IWL_HCMD_MIN_COPY_SIZE copied */ 1176 /* need at least IWL_HCMD_SCRATCHBUF_SIZE copied */
1176 if (copy_size < IWL_HCMD_MIN_COPY_SIZE) { 1177 if (copy_size < IWL_HCMD_SCRATCHBUF_SIZE) {
1177 int copy = IWL_HCMD_MIN_COPY_SIZE - copy_size; 1178 int copy = IWL_HCMD_SCRATCHBUF_SIZE - copy_size;
1178 1179
1179 if (copy > cmdlen[i]) 1180 if (copy > cmdlen[i])
1180 copy = cmdlen[i]; 1181 copy = cmdlen[i];
@@ -1260,15 +1261,15 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans,
1260 /* and copy the data that needs to be copied */ 1261 /* and copy the data that needs to be copied */
1261 cmd_pos = offsetof(struct iwl_device_cmd, payload); 1262 cmd_pos = offsetof(struct iwl_device_cmd, payload);
1262 copy_size = sizeof(out_cmd->hdr); 1263 copy_size = sizeof(out_cmd->hdr);
1263 for (i = 0; i < IWL_MAX_CMD_TFDS; i++) { 1264 for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) {
1264 int copy = 0; 1265 int copy = 0;
1265 1266
1266 if (!cmd->len) 1267 if (!cmd->len)
1267 continue; 1268 continue;
1268 1269
1269 /* need at least IWL_HCMD_MIN_COPY_SIZE copied */ 1270 /* need at least IWL_HCMD_SCRATCHBUF_SIZE copied */
1270 if (copy_size < IWL_HCMD_MIN_COPY_SIZE) { 1271 if (copy_size < IWL_HCMD_SCRATCHBUF_SIZE) {
1271 copy = IWL_HCMD_MIN_COPY_SIZE - copy_size; 1272 copy = IWL_HCMD_SCRATCHBUF_SIZE - copy_size;
1272 1273
1273 if (copy > cmd->len[i]) 1274 if (copy > cmd->len[i])
1274 copy = cmd->len[i]; 1275 copy = cmd->len[i];
@@ -1286,50 +1287,38 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans,
1286 } 1287 }
1287 } 1288 }
1288 1289
1289 WARN_ON_ONCE(txq->entries[idx].copy_cmd);
1290
1291 /*
1292 * since out_cmd will be the source address of the FH, it will write
1293 * the retry count there. So when the user needs to receivce the HCMD
1294 * that corresponds to the response in the response handler, it needs
1295 * to set CMD_WANT_HCMD.
1296 */
1297 if (cmd->flags & CMD_WANT_HCMD) {
1298 txq->entries[idx].copy_cmd =
1299 kmemdup(out_cmd, cmd_pos, GFP_ATOMIC);
1300 if (unlikely(!txq->entries[idx].copy_cmd)) {
1301 idx = -ENOMEM;
1302 goto out;
1303 }
1304 }
1305
1306 IWL_DEBUG_HC(trans, 1290 IWL_DEBUG_HC(trans,
1307 "Sending command %s (#%x), seq: 0x%04X, %d bytes at %d[%d]:%d\n", 1291 "Sending command %s (#%x), seq: 0x%04X, %d bytes at %d[%d]:%d\n",
1308 get_cmd_string(trans_pcie, out_cmd->hdr.cmd), 1292 get_cmd_string(trans_pcie, out_cmd->hdr.cmd),
1309 out_cmd->hdr.cmd, le16_to_cpu(out_cmd->hdr.sequence), 1293 out_cmd->hdr.cmd, le16_to_cpu(out_cmd->hdr.sequence),
1310 cmd_size, q->write_ptr, idx, trans_pcie->cmd_queue); 1294 cmd_size, q->write_ptr, idx, trans_pcie->cmd_queue);
1311 1295
1312 /* 1296 /* start the TFD with the scratchbuf */
1313 * If the entire command is smaller than IWL_HCMD_MIN_COPY_SIZE, we must 1297 scratch_size = min_t(int, copy_size, IWL_HCMD_SCRATCHBUF_SIZE);
1314 * still map at least that many bytes for the hardware to write back to. 1298 memcpy(&txq->scratchbufs[q->write_ptr], &out_cmd->hdr, scratch_size);
1315 * We have enough space, so that's not a problem. 1299 iwl_pcie_txq_build_tfd(trans, txq,
1316 */ 1300 iwl_pcie_get_scratchbuf_dma(txq, q->write_ptr),
1317 dma_size = max_t(u16, copy_size, IWL_HCMD_MIN_COPY_SIZE); 1301 scratch_size, 1);
1302
1303 /* map first command fragment, if any remains */
1304 if (copy_size > scratch_size) {
1305 phys_addr = dma_map_single(trans->dev,
1306 ((u8 *)&out_cmd->hdr) + scratch_size,
1307 copy_size - scratch_size,
1308 DMA_TO_DEVICE);
1309 if (dma_mapping_error(trans->dev, phys_addr)) {
1310 iwl_pcie_tfd_unmap(trans, out_meta,
1311 &txq->tfds[q->write_ptr]);
1312 idx = -ENOMEM;
1313 goto out;
1314 }
1318 1315
1319 phys_addr = dma_map_single(trans->dev, &out_cmd->hdr, dma_size, 1316 iwl_pcie_txq_build_tfd(trans, txq, phys_addr,
1320 DMA_BIDIRECTIONAL); 1317 copy_size - scratch_size, 0);
1321 if (unlikely(dma_mapping_error(trans->dev, phys_addr))) {
1322 idx = -ENOMEM;
1323 goto out;
1324 } 1318 }
1325 1319
1326 dma_unmap_addr_set(out_meta, mapping, phys_addr);
1327 dma_unmap_len_set(out_meta, len, dma_size);
1328
1329 iwl_pcie_txq_build_tfd(trans, txq, phys_addr, copy_size, 1);
1330
1331 /* map the remaining (adjusted) nocopy/dup fragments */ 1320 /* map the remaining (adjusted) nocopy/dup fragments */
1332 for (i = 0; i < IWL_MAX_CMD_TFDS; i++) { 1321 for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) {
1333 const void *data = cmddata[i]; 1322 const void *data = cmddata[i];
1334 1323
1335 if (!cmdlen[i]) 1324 if (!cmdlen[i])
@@ -1340,11 +1329,10 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans,
1340 if (cmd->dataflags[i] & IWL_HCMD_DFL_DUP) 1329 if (cmd->dataflags[i] & IWL_HCMD_DFL_DUP)
1341 data = dup_buf; 1330 data = dup_buf;
1342 phys_addr = dma_map_single(trans->dev, (void *)data, 1331 phys_addr = dma_map_single(trans->dev, (void *)data,
1343 cmdlen[i], DMA_BIDIRECTIONAL); 1332 cmdlen[i], DMA_TO_DEVICE);
1344 if (dma_mapping_error(trans->dev, phys_addr)) { 1333 if (dma_mapping_error(trans->dev, phys_addr)) {
1345 iwl_pcie_tfd_unmap(trans, out_meta, 1334 iwl_pcie_tfd_unmap(trans, out_meta,
1346 &txq->tfds[q->write_ptr], 1335 &txq->tfds[q->write_ptr]);
1347 DMA_BIDIRECTIONAL);
1348 idx = -ENOMEM; 1336 idx = -ENOMEM;
1349 goto out; 1337 goto out;
1350 } 1338 }
@@ -1418,7 +1406,7 @@ void iwl_pcie_hcmd_complete(struct iwl_trans *trans,
1418 cmd = txq->entries[cmd_index].cmd; 1406 cmd = txq->entries[cmd_index].cmd;
1419 meta = &txq->entries[cmd_index].meta; 1407 meta = &txq->entries[cmd_index].meta;
1420 1408
1421 iwl_pcie_tfd_unmap(trans, meta, &txq->tfds[index], DMA_BIDIRECTIONAL); 1409 iwl_pcie_tfd_unmap(trans, meta, &txq->tfds[index]);
1422 1410
1423 /* Input error checking is done when commands are added to queue. */ 1411 /* Input error checking is done when commands are added to queue. */
1424 if (meta->flags & CMD_WANT_SKB) { 1412 if (meta->flags & CMD_WANT_SKB) {
@@ -1597,10 +1585,9 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb,
1597 struct iwl_cmd_meta *out_meta; 1585 struct iwl_cmd_meta *out_meta;
1598 struct iwl_txq *txq; 1586 struct iwl_txq *txq;
1599 struct iwl_queue *q; 1587 struct iwl_queue *q;
1600 dma_addr_t phys_addr = 0; 1588 dma_addr_t tb0_phys, tb1_phys, scratch_phys;
1601 dma_addr_t txcmd_phys; 1589 void *tb1_addr;
1602 dma_addr_t scratch_phys; 1590 u16 len, tb1_len, tb2_len;
1603 u16 len, firstlen, secondlen;
1604 u8 wait_write_ptr = 0; 1591 u8 wait_write_ptr = 0;
1605 __le16 fc = hdr->frame_control; 1592 __le16 fc = hdr->frame_control;
1606 u8 hdr_len = ieee80211_hdrlen(fc); 1593 u8 hdr_len = ieee80211_hdrlen(fc);
@@ -1638,85 +1625,80 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb,
1638 cpu_to_le16((u16)(QUEUE_TO_SEQ(txq_id) | 1625 cpu_to_le16((u16)(QUEUE_TO_SEQ(txq_id) |
1639 INDEX_TO_SEQ(q->write_ptr))); 1626 INDEX_TO_SEQ(q->write_ptr)));
1640 1627
1628 tb0_phys = iwl_pcie_get_scratchbuf_dma(txq, q->write_ptr);
1629 scratch_phys = tb0_phys + sizeof(struct iwl_cmd_header) +
1630 offsetof(struct iwl_tx_cmd, scratch);
1631
1632 tx_cmd->dram_lsb_ptr = cpu_to_le32(scratch_phys);
1633 tx_cmd->dram_msb_ptr = iwl_get_dma_hi_addr(scratch_phys);
1634
1641 /* Set up first empty entry in queue's array of Tx/cmd buffers */ 1635 /* Set up first empty entry in queue's array of Tx/cmd buffers */
1642 out_meta = &txq->entries[q->write_ptr].meta; 1636 out_meta = &txq->entries[q->write_ptr].meta;
1643 1637
1644 /* 1638 /*
1645 * Use the first empty entry in this queue's command buffer array 1639 * The second TB (tb1) points to the remainder of the TX command
1646 * to contain the Tx command and MAC header concatenated together 1640 * and the 802.11 header - dword aligned size
1647 * (payload data will be in another buffer). 1641 * (This calculation modifies the TX command, so do it before the
1648 * Size of this varies, due to varying MAC header length. 1642 * setup of the first TB)
1649 * If end is not dword aligned, we'll have 2 extra bytes at the end
1650 * of the MAC header (device reads on dword boundaries).
1651 * We'll tell device about this padding later.
1652 */ 1643 */
1653 len = sizeof(struct iwl_tx_cmd) + 1644 len = sizeof(struct iwl_tx_cmd) + sizeof(struct iwl_cmd_header) +
1654 sizeof(struct iwl_cmd_header) + hdr_len; 1645 hdr_len - IWL_HCMD_SCRATCHBUF_SIZE;
1655 firstlen = (len + 3) & ~3; 1646 tb1_len = (len + 3) & ~3;
1656 1647
1657 /* Tell NIC about any 2-byte padding after MAC header */ 1648 /* Tell NIC about any 2-byte padding after MAC header */
1658 if (firstlen != len) 1649 if (tb1_len != len)
1659 tx_cmd->tx_flags |= TX_CMD_FLG_MH_PAD_MSK; 1650 tx_cmd->tx_flags |= TX_CMD_FLG_MH_PAD_MSK;
1660 1651
1661 /* Physical address of this Tx command's header (not MAC header!), 1652 /* The first TB points to the scratchbuf data - min_copy bytes */
1662 * within command buffer array. */ 1653 memcpy(&txq->scratchbufs[q->write_ptr], &dev_cmd->hdr,
1663 txcmd_phys = dma_map_single(trans->dev, 1654 IWL_HCMD_SCRATCHBUF_SIZE);
1664 &dev_cmd->hdr, firstlen, 1655 iwl_pcie_txq_build_tfd(trans, txq, tb0_phys,
1665 DMA_BIDIRECTIONAL); 1656 IWL_HCMD_SCRATCHBUF_SIZE, 1);
1666 if (unlikely(dma_mapping_error(trans->dev, txcmd_phys)))
1667 goto out_err;
1668 dma_unmap_addr_set(out_meta, mapping, txcmd_phys);
1669 dma_unmap_len_set(out_meta, len, firstlen);
1670 1657
1671 if (!ieee80211_has_morefrags(fc)) { 1658 /* there must be data left over for TB1 or this code must be changed */
1672 txq->need_update = 1; 1659 BUILD_BUG_ON(sizeof(struct iwl_tx_cmd) < IWL_HCMD_SCRATCHBUF_SIZE);
1673 } else {
1674 wait_write_ptr = 1;
1675 txq->need_update = 0;
1676 }
1677 1660
1678 /* Set up TFD's 2nd entry to point directly to remainder of skb, 1661 /* map the data for TB1 */
1679 * if any (802.11 null frames have no payload). */ 1662 tb1_addr = ((u8 *)&dev_cmd->hdr) + IWL_HCMD_SCRATCHBUF_SIZE;
1680 secondlen = skb->len - hdr_len; 1663 tb1_phys = dma_map_single(trans->dev, tb1_addr, tb1_len, DMA_TO_DEVICE);
1681 if (secondlen > 0) { 1664 if (unlikely(dma_mapping_error(trans->dev, tb1_phys)))
1682 phys_addr = dma_map_single(trans->dev, skb->data + hdr_len, 1665 goto out_err;
1683 secondlen, DMA_TO_DEVICE); 1666 iwl_pcie_txq_build_tfd(trans, txq, tb1_phys, tb1_len, 0);
1684 if (unlikely(dma_mapping_error(trans->dev, phys_addr))) { 1667
1685 dma_unmap_single(trans->dev, 1668 /*
1686 dma_unmap_addr(out_meta, mapping), 1669 * Set up TFD's third entry to point directly to remainder
1687 dma_unmap_len(out_meta, len), 1670 * of skb, if any (802.11 null frames have no payload).
1688 DMA_BIDIRECTIONAL); 1671 */
1672 tb2_len = skb->len - hdr_len;
1673 if (tb2_len > 0) {
1674 dma_addr_t tb2_phys = dma_map_single(trans->dev,
1675 skb->data + hdr_len,
1676 tb2_len, DMA_TO_DEVICE);
1677 if (unlikely(dma_mapping_error(trans->dev, tb2_phys))) {
1678 iwl_pcie_tfd_unmap(trans, out_meta,
1679 &txq->tfds[q->write_ptr]);
1689 goto out_err; 1680 goto out_err;
1690 } 1681 }
1682 iwl_pcie_txq_build_tfd(trans, txq, tb2_phys, tb2_len, 0);
1691 } 1683 }
1692 1684
1693 /* Attach buffers to TFD */
1694 iwl_pcie_txq_build_tfd(trans, txq, txcmd_phys, firstlen, 1);
1695 if (secondlen > 0)
1696 iwl_pcie_txq_build_tfd(trans, txq, phys_addr, secondlen, 0);
1697
1698 scratch_phys = txcmd_phys + sizeof(struct iwl_cmd_header) +
1699 offsetof(struct iwl_tx_cmd, scratch);
1700
1701 /* take back ownership of DMA buffer to enable update */
1702 dma_sync_single_for_cpu(trans->dev, txcmd_phys, firstlen,
1703 DMA_BIDIRECTIONAL);
1704 tx_cmd->dram_lsb_ptr = cpu_to_le32(scratch_phys);
1705 tx_cmd->dram_msb_ptr = iwl_get_dma_hi_addr(scratch_phys);
1706
1707 /* Set up entry for this TFD in Tx byte-count array */ 1685 /* Set up entry for this TFD in Tx byte-count array */
1708 iwl_pcie_txq_update_byte_cnt_tbl(trans, txq, le16_to_cpu(tx_cmd->len)); 1686 iwl_pcie_txq_update_byte_cnt_tbl(trans, txq, le16_to_cpu(tx_cmd->len));
1709 1687
1710 dma_sync_single_for_device(trans->dev, txcmd_phys, firstlen,
1711 DMA_BIDIRECTIONAL);
1712
1713 trace_iwlwifi_dev_tx(trans->dev, skb, 1688 trace_iwlwifi_dev_tx(trans->dev, skb,
1714 &txq->tfds[txq->q.write_ptr], 1689 &txq->tfds[txq->q.write_ptr],
1715 sizeof(struct iwl_tfd), 1690 sizeof(struct iwl_tfd),
1716 &dev_cmd->hdr, firstlen, 1691 &dev_cmd->hdr, IWL_HCMD_SCRATCHBUF_SIZE + tb1_len,
1717 skb->data + hdr_len, secondlen); 1692 skb->data + hdr_len, tb2_len);
1718 trace_iwlwifi_dev_tx_data(trans->dev, skb, 1693 trace_iwlwifi_dev_tx_data(trans->dev, skb,
1719 skb->data + hdr_len, secondlen); 1694 skb->data + hdr_len, tb2_len);
1695
1696 if (!ieee80211_has_morefrags(fc)) {
1697 txq->need_update = 1;
1698 } else {
1699 wait_write_ptr = 1;
1700 txq->need_update = 0;
1701 }
1720 1702
1721 /* start timer if queue currently empty */ 1703 /* start timer if queue currently empty */
1722 if (txq->need_update && q->read_ptr == q->write_ptr && 1704 if (txq->need_update && q->read_ptr == q->write_ptr &&
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c
index 445ffda715ad..7c12d9c2b230 100644
--- a/drivers/oprofile/oprofilefs.c
+++ b/drivers/oprofile/oprofilefs.c
@@ -276,6 +276,7 @@ static struct file_system_type oprofilefs_type = {
276 .mount = oprofilefs_mount, 276 .mount = oprofilefs_mount,
277 .kill_sb = kill_litter_super, 277 .kill_sb = kill_litter_super,
278}; 278};
279MODULE_ALIAS_FS("oprofilefs");
279 280
280 281
281int __init oprofilefs_register(void) 282int __init oprofilefs_register(void)
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index 39c937f9b426..dee5dddaa292 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -331,8 +331,14 @@ static void pci_acpi_cleanup(struct device *dev)
331 } 331 }
332} 332}
333 333
334static bool pci_acpi_bus_match(struct device *dev)
335{
336 return dev->bus == &pci_bus_type;
337}
338
334static struct acpi_bus_type acpi_pci_bus = { 339static struct acpi_bus_type acpi_pci_bus = {
335 .bus = &pci_bus_type, 340 .name = "PCI",
341 .match = pci_acpi_bus_match,
336 .find_device = acpi_pci_find_device, 342 .find_device = acpi_pci_find_device,
337 .setup = pci_acpi_setup, 343 .setup = pci_acpi_setup,
338 .cleanup = pci_acpi_cleanup, 344 .cleanup = pci_acpi_cleanup,
diff --git a/drivers/platform/x86/chromeos_laptop.c b/drivers/platform/x86/chromeos_laptop.c
index 93d66809355a..3e5b4497a1d0 100644
--- a/drivers/platform/x86/chromeos_laptop.c
+++ b/drivers/platform/x86/chromeos_laptop.c
@@ -23,6 +23,9 @@
23 23
24#include <linux/dmi.h> 24#include <linux/dmi.h>
25#include <linux/i2c.h> 25#include <linux/i2c.h>
26#include <linux/i2c/atmel_mxt_ts.h>
27#include <linux/input.h>
28#include <linux/interrupt.h>
26#include <linux/module.h> 29#include <linux/module.h>
27 30
28#define ATMEL_TP_I2C_ADDR 0x4b 31#define ATMEL_TP_I2C_ADDR 0x4b
@@ -67,15 +70,49 @@ static struct i2c_board_info __initdata tsl2563_als_device = {
67 I2C_BOARD_INFO("tsl2563", TAOS_ALS_I2C_ADDR), 70 I2C_BOARD_INFO("tsl2563", TAOS_ALS_I2C_ADDR),
68}; 71};
69 72
73static struct mxt_platform_data atmel_224s_tp_platform_data = {
74 .x_line = 18,
75 .y_line = 12,
76 .x_size = 102*20,
77 .y_size = 68*20,
78 .blen = 0x80, /* Gain setting is in upper 4 bits */
79 .threshold = 0x32,
80 .voltage = 0, /* 3.3V */
81 .orient = MXT_VERTICAL_FLIP,
82 .irqflags = IRQF_TRIGGER_FALLING,
83 .is_tp = true,
84 .key_map = { KEY_RESERVED,
85 KEY_RESERVED,
86 KEY_RESERVED,
87 BTN_LEFT },
88 .config = NULL,
89 .config_length = 0,
90};
91
70static struct i2c_board_info __initdata atmel_224s_tp_device = { 92static struct i2c_board_info __initdata atmel_224s_tp_device = {
71 I2C_BOARD_INFO("atmel_mxt_tp", ATMEL_TP_I2C_ADDR), 93 I2C_BOARD_INFO("atmel_mxt_tp", ATMEL_TP_I2C_ADDR),
72 .platform_data = NULL, 94 .platform_data = &atmel_224s_tp_platform_data,
73 .flags = I2C_CLIENT_WAKE, 95 .flags = I2C_CLIENT_WAKE,
74}; 96};
75 97
98static struct mxt_platform_data atmel_1664s_platform_data = {
99 .x_line = 32,
100 .y_line = 50,
101 .x_size = 1700,
102 .y_size = 2560,
103 .blen = 0x89, /* Gain setting is in upper 4 bits */
104 .threshold = 0x28,
105 .voltage = 0, /* 3.3V */
106 .orient = MXT_ROTATED_90_COUNTER,
107 .irqflags = IRQF_TRIGGER_FALLING,
108 .is_tp = false,
109 .config = NULL,
110 .config_length = 0,
111};
112
76static struct i2c_board_info __initdata atmel_1664s_device = { 113static struct i2c_board_info __initdata atmel_1664s_device = {
77 I2C_BOARD_INFO("atmel_mxt_ts", ATMEL_TS_I2C_ADDR), 114 I2C_BOARD_INFO("atmel_mxt_ts", ATMEL_TS_I2C_ADDR),
78 .platform_data = NULL, 115 .platform_data = &atmel_1664s_platform_data,
79 .flags = I2C_CLIENT_WAKE, 116 .flags = I2C_CLIENT_WAKE,
80}; 117};
81 118
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index 8813fc03aa09..55cd459a3908 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -353,8 +353,14 @@ static int __init acpi_pnp_find_device(struct device *dev, acpi_handle * handle)
353/* complete initialization of a PNPACPI device includes having 353/* complete initialization of a PNPACPI device includes having
354 * pnpdev->dev.archdata.acpi_handle point to its ACPI sibling. 354 * pnpdev->dev.archdata.acpi_handle point to its ACPI sibling.
355 */ 355 */
356static bool acpi_pnp_bus_match(struct device *dev)
357{
358 return dev->bus == &pnp_bus_type;
359}
360
356static struct acpi_bus_type __initdata acpi_pnp_bus = { 361static struct acpi_bus_type __initdata acpi_pnp_bus = {
357 .bus = &pnp_bus_type, 362 .name = "PNP",
363 .match = acpi_pnp_bus_match,
358 .find_device = acpi_pnp_find_device, 364 .find_device = acpi_pnp_find_device,
359}; 365};
360 366
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index da9782bd27d0..e3661c20cf38 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2830,7 +2830,7 @@ EXPORT_SYMBOL_GPL(regulator_get_bypass_regmap);
2830 * regulator_allow_bypass - allow the regulator to go into bypass mode 2830 * regulator_allow_bypass - allow the regulator to go into bypass mode
2831 * 2831 *
2832 * @regulator: Regulator to configure 2832 * @regulator: Regulator to configure
2833 * @allow: enable or disable bypass mode 2833 * @enable: enable or disable bypass mode
2834 * 2834 *
2835 * Allow the regulator to go into bypass mode if all other consumers 2835 * Allow the regulator to go into bypass mode if all other consumers
2836 * for the regulator also enable bypass mode and the machine 2836 * for the regulator also enable bypass mode and the machine
@@ -3057,9 +3057,13 @@ int regulator_bulk_enable(int num_consumers,
3057 return 0; 3057 return 0;
3058 3058
3059err: 3059err:
3060 pr_err("Failed to enable %s: %d\n", consumers[i].supply, ret); 3060 for (i = 0; i < num_consumers; i++) {
3061 while (--i >= 0) 3061 if (consumers[i].ret < 0)
3062 regulator_disable(consumers[i].consumer); 3062 pr_err("Failed to enable %s: %d\n", consumers[i].supply,
3063 consumers[i].ret);
3064 else
3065 regulator_disable(consumers[i].consumer);
3066 }
3063 3067
3064 return ret; 3068 return ret;
3065} 3069}
diff --git a/drivers/regulator/db8500-prcmu.c b/drivers/regulator/db8500-prcmu.c
index 219d162b651e..a53c11a529d5 100644
--- a/drivers/regulator/db8500-prcmu.c
+++ b/drivers/regulator/db8500-prcmu.c
@@ -528,7 +528,7 @@ static int db8500_regulator_probe(struct platform_device *pdev)
528 return 0; 528 return 0;
529} 529}
530 530
531static int __exit db8500_regulator_remove(struct platform_device *pdev) 531static int db8500_regulator_remove(struct platform_device *pdev)
532{ 532{
533 int i; 533 int i;
534 534
@@ -553,7 +553,7 @@ static struct platform_driver db8500_regulator_driver = {
553 .owner = THIS_MODULE, 553 .owner = THIS_MODULE,
554 }, 554 },
555 .probe = db8500_regulator_probe, 555 .probe = db8500_regulator_probe,
556 .remove = __exit_p(db8500_regulator_remove), 556 .remove = db8500_regulator_remove,
557}; 557};
558 558
559static int __init db8500_regulator_init(void) 559static int __init db8500_regulator_init(void)
diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c
index cde13bb5a8fb..39cf14606784 100644
--- a/drivers/regulator/palmas-regulator.c
+++ b/drivers/regulator/palmas-regulator.c
@@ -4,6 +4,7 @@
4 * Copyright 2011-2012 Texas Instruments Inc. 4 * Copyright 2011-2012 Texas Instruments Inc.
5 * 5 *
6 * Author: Graeme Gregory <gg@slimlogic.co.uk> 6 * Author: Graeme Gregory <gg@slimlogic.co.uk>
7 * Author: Ian Lartey <ian@slimlogic.co.uk>
7 * 8 *
8 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the 10 * under the terms of the GNU General Public License as published by the
@@ -156,7 +157,7 @@ static const struct regs_info palmas_regs_info[] = {
156 * 157 *
157 * So they are basically (maxV-minV)/stepV 158 * So they are basically (maxV-minV)/stepV
158 */ 159 */
159#define PALMAS_SMPS_NUM_VOLTAGES 116 160#define PALMAS_SMPS_NUM_VOLTAGES 117
160#define PALMAS_SMPS10_NUM_VOLTAGES 2 161#define PALMAS_SMPS10_NUM_VOLTAGES 2
161#define PALMAS_LDO_NUM_VOLTAGES 50 162#define PALMAS_LDO_NUM_VOLTAGES 50
162 163
diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
index 74508cc62d67..f705d25b437c 100644
--- a/drivers/regulator/twl-regulator.c
+++ b/drivers/regulator/twl-regulator.c
@@ -471,24 +471,23 @@ twl4030ldo_set_voltage_sel(struct regulator_dev *rdev, unsigned selector)
471 selector); 471 selector);
472} 472}
473 473
474static int twl4030ldo_get_voltage(struct regulator_dev *rdev) 474static int twl4030ldo_get_voltage_sel(struct regulator_dev *rdev)
475{ 475{
476 struct twlreg_info *info = rdev_get_drvdata(rdev); 476 struct twlreg_info *info = rdev_get_drvdata(rdev);
477 int vsel = twlreg_read(info, TWL_MODULE_PM_RECEIVER, 477 int vsel = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_VOLTAGE);
478 VREG_VOLTAGE);
479 478
480 if (vsel < 0) 479 if (vsel < 0)
481 return vsel; 480 return vsel;
482 481
483 vsel &= info->table_len - 1; 482 vsel &= info->table_len - 1;
484 return LDO_MV(info->table[vsel]) * 1000; 483 return vsel;
485} 484}
486 485
487static struct regulator_ops twl4030ldo_ops = { 486static struct regulator_ops twl4030ldo_ops = {
488 .list_voltage = twl4030ldo_list_voltage, 487 .list_voltage = twl4030ldo_list_voltage,
489 488
490 .set_voltage_sel = twl4030ldo_set_voltage_sel, 489 .set_voltage_sel = twl4030ldo_set_voltage_sel,
491 .get_voltage = twl4030ldo_get_voltage, 490 .get_voltage_sel = twl4030ldo_get_voltage_sel,
492 491
493 .enable = twl4030reg_enable, 492 .enable = twl4030reg_enable,
494 .disable = twl4030reg_disable, 493 .disable = twl4030reg_disable,
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 765398c063c7..c31187d79343 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -71,9 +71,14 @@ struct kmem_cache *scsi_sdb_cache;
71#ifdef CONFIG_ACPI 71#ifdef CONFIG_ACPI
72#include <acpi/acpi_bus.h> 72#include <acpi/acpi_bus.h>
73 73
74static bool acpi_scsi_bus_match(struct device *dev)
75{
76 return dev->bus == &scsi_bus_type;
77}
78
74int scsi_register_acpi_bus_type(struct acpi_bus_type *bus) 79int scsi_register_acpi_bus_type(struct acpi_bus_type *bus)
75{ 80{
76 bus->bus = &scsi_bus_type; 81 bus->match = acpi_scsi_bus_match;
77 return register_acpi_bus_type(bus); 82 return register_acpi_bus_type(bus);
78} 83}
79EXPORT_SYMBOL_GPL(scsi_register_acpi_bus_type); 84EXPORT_SYMBOL_GPL(scsi_register_acpi_bus_type);
diff --git a/drivers/staging/ccg/f_fs.c b/drivers/staging/ccg/f_fs.c
index 8adc79d1b402..f6373dade7fb 100644
--- a/drivers/staging/ccg/f_fs.c
+++ b/drivers/staging/ccg/f_fs.c
@@ -1223,6 +1223,7 @@ static struct file_system_type ffs_fs_type = {
1223 .mount = ffs_fs_mount, 1223 .mount = ffs_fs_mount,
1224 .kill_sb = ffs_fs_kill_sb, 1224 .kill_sb = ffs_fs_kill_sb,
1225}; 1225};
1226MODULE_ALIAS_FS("functionfs");
1226 1227
1227 1228
1228/* Driver's main init/cleanup functions *************************************/ 1229/* Driver's main init/cleanup functions *************************************/
diff --git a/drivers/usb/core/usb-acpi.c b/drivers/usb/core/usb-acpi.c
index cef4252bb31a..b6f4bad3f756 100644
--- a/drivers/usb/core/usb-acpi.c
+++ b/drivers/usb/core/usb-acpi.c
@@ -210,9 +210,14 @@ static int usb_acpi_find_device(struct device *dev, acpi_handle *handle)
210 return 0; 210 return 0;
211} 211}
212 212
213static bool usb_acpi_bus_match(struct device *dev)
214{
215 return is_usb_device(dev) || is_usb_port(dev);
216}
217
213static struct acpi_bus_type usb_acpi_bus = { 218static struct acpi_bus_type usb_acpi_bus = {
214 .bus = &usb_bus_type, 219 .name = "USB",
215 .find_bridge = usb_acpi_find_device, 220 .match = usb_acpi_bus_match,
216 .find_device = usb_acpi_find_device, 221 .find_device = usb_acpi_find_device,
217}; 222};
218 223
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
index 38388d7844fc..c377ff84bf2c 100644
--- a/drivers/usb/gadget/f_fs.c
+++ b/drivers/usb/gadget/f_fs.c
@@ -1235,6 +1235,7 @@ static struct file_system_type ffs_fs_type = {
1235 .mount = ffs_fs_mount, 1235 .mount = ffs_fs_mount,
1236 .kill_sb = ffs_fs_kill_sb, 1236 .kill_sb = ffs_fs_kill_sb,
1237}; 1237};
1238MODULE_ALIAS_FS("functionfs");
1238 1239
1239 1240
1240/* Driver's main init/cleanup functions *************************************/ 1241/* Driver's main init/cleanup functions *************************************/
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index 8ac840f25ba9..e2b2e9cf254a 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -2105,6 +2105,7 @@ static struct file_system_type gadgetfs_type = {
2105 .mount = gadgetfs_mount, 2105 .mount = gadgetfs_mount,
2106 .kill_sb = gadgetfs_kill_sb, 2106 .kill_sb = gadgetfs_kill_sb,
2107}; 2107};
2108MODULE_ALIAS_FS("gadgetfs");
2108 2109
2109/*----------------------------------------------------------------------*/ 2110/*----------------------------------------------------------------------*/
2110 2111
diff --git a/drivers/xen/xenfs/super.c b/drivers/xen/xenfs/super.c
index ec0abb6df3c3..71679875f056 100644
--- a/drivers/xen/xenfs/super.c
+++ b/drivers/xen/xenfs/super.c
@@ -75,6 +75,7 @@ static struct file_system_type xenfs_type = {
75 .mount = xenfs_mount, 75 .mount = xenfs_mount,
76 .kill_sb = kill_litter_super, 76 .kill_sb = kill_litter_super,
77}; 77};
78MODULE_ALIAS_FS("xenfs");
78 79
79static int __init xenfs_init(void) 80static int __init xenfs_init(void)
80{ 81{
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index 91dad63e5a2d..2756dcd5de6e 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -365,3 +365,4 @@ struct file_system_type v9fs_fs_type = {
365 .owner = THIS_MODULE, 365 .owner = THIS_MODULE,
366 .fs_flags = FS_RENAME_DOES_D_MOVE, 366 .fs_flags = FS_RENAME_DOES_D_MOVE,
367}; 367};
368MODULE_ALIAS_FS("9p");
diff --git a/fs/adfs/super.c b/fs/adfs/super.c
index d57122935793..0ff4bae2c2a2 100644
--- a/fs/adfs/super.c
+++ b/fs/adfs/super.c
@@ -524,6 +524,7 @@ static struct file_system_type adfs_fs_type = {
524 .kill_sb = kill_block_super, 524 .kill_sb = kill_block_super,
525 .fs_flags = FS_REQUIRES_DEV, 525 .fs_flags = FS_REQUIRES_DEV,
526}; 526};
527MODULE_ALIAS_FS("adfs");
527 528
528static int __init init_adfs_fs(void) 529static int __init init_adfs_fs(void)
529{ 530{
diff --git a/fs/affs/super.c b/fs/affs/super.c
index b84dc7352502..45161a832bbc 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -622,6 +622,7 @@ static struct file_system_type affs_fs_type = {
622 .kill_sb = kill_block_super, 622 .kill_sb = kill_block_super,
623 .fs_flags = FS_REQUIRES_DEV, 623 .fs_flags = FS_REQUIRES_DEV,
624}; 624};
625MODULE_ALIAS_FS("affs");
625 626
626static int __init init_affs_fs(void) 627static int __init init_affs_fs(void)
627{ 628{
diff --git a/fs/afs/super.c b/fs/afs/super.c
index 7c31ec399575..c4861557e385 100644
--- a/fs/afs/super.c
+++ b/fs/afs/super.c
@@ -45,6 +45,7 @@ struct file_system_type afs_fs_type = {
45 .kill_sb = afs_kill_super, 45 .kill_sb = afs_kill_super,
46 .fs_flags = 0, 46 .fs_flags = 0,
47}; 47};
48MODULE_ALIAS_FS("afs");
48 49
49static const struct super_operations afs_super_ops = { 50static const struct super_operations afs_super_ops = {
50 .statfs = afs_statfs, 51 .statfs = afs_statfs,
diff --git a/fs/autofs4/init.c b/fs/autofs4/init.c
index cddc74b9cdb2..b3db517e89ec 100644
--- a/fs/autofs4/init.c
+++ b/fs/autofs4/init.c
@@ -26,6 +26,7 @@ static struct file_system_type autofs_fs_type = {
26 .mount = autofs_mount, 26 .mount = autofs_mount,
27 .kill_sb = autofs4_kill_sb, 27 .kill_sb = autofs4_kill_sb,
28}; 28};
29MODULE_ALIAS_FS("autofs");
29 30
30static int __init init_autofs4_fs(void) 31static int __init init_autofs4_fs(void)
31{ 32{
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index c8f4e25eb9e2..8615ee89ab55 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -951,6 +951,7 @@ static struct file_system_type befs_fs_type = {
951 .kill_sb = kill_block_super, 951 .kill_sb = kill_block_super,
952 .fs_flags = FS_REQUIRES_DEV, 952 .fs_flags = FS_REQUIRES_DEV,
953}; 953};
954MODULE_ALIAS_FS("befs");
954 955
955static int __init 956static int __init
956init_befs_fs(void) 957init_befs_fs(void)
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
index 737aaa3f7090..5e376bb93419 100644
--- a/fs/bfs/inode.c
+++ b/fs/bfs/inode.c
@@ -473,6 +473,7 @@ static struct file_system_type bfs_fs_type = {
473 .kill_sb = kill_block_super, 473 .kill_sb = kill_block_super,
474 .fs_flags = FS_REQUIRES_DEV, 474 .fs_flags = FS_REQUIRES_DEV,
475}; 475};
476MODULE_ALIAS_FS("bfs");
476 477
477static int __init init_bfs_fs(void) 478static int __init init_bfs_fs(void)
478{ 479{
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index fecbbf3f8ff2..751df5e4f61a 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -720,6 +720,7 @@ static struct file_system_type bm_fs_type = {
720 .mount = bm_mount, 720 .mount = bm_mount,
721 .kill_sb = kill_litter_super, 721 .kill_sb = kill_litter_super,
722}; 722};
723MODULE_ALIAS_FS("binfmt_misc");
723 724
724static int __init init_misc_binfmt(void) 725static int __init init_misc_binfmt(void)
725{ 726{
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index 0b278b117cbe..14fce27b4780 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -22,8 +22,9 @@
22#include "disk-io.h" 22#include "disk-io.h"
23#include "transaction.h" 23#include "transaction.h"
24 24
25#define BTRFS_DELAYED_WRITEBACK 400 25#define BTRFS_DELAYED_WRITEBACK 512
26#define BTRFS_DELAYED_BACKGROUND 100 26#define BTRFS_DELAYED_BACKGROUND 128
27#define BTRFS_DELAYED_BATCH 16
27 28
28static struct kmem_cache *delayed_node_cache; 29static struct kmem_cache *delayed_node_cache;
29 30
@@ -494,6 +495,15 @@ static int __btrfs_add_delayed_deletion_item(struct btrfs_delayed_node *node,
494 BTRFS_DELAYED_DELETION_ITEM); 495 BTRFS_DELAYED_DELETION_ITEM);
495} 496}
496 497
498static void finish_one_item(struct btrfs_delayed_root *delayed_root)
499{
500 int seq = atomic_inc_return(&delayed_root->items_seq);
501 if ((atomic_dec_return(&delayed_root->items) <
502 BTRFS_DELAYED_BACKGROUND || seq % BTRFS_DELAYED_BATCH == 0) &&
503 waitqueue_active(&delayed_root->wait))
504 wake_up(&delayed_root->wait);
505}
506
497static void __btrfs_remove_delayed_item(struct btrfs_delayed_item *delayed_item) 507static void __btrfs_remove_delayed_item(struct btrfs_delayed_item *delayed_item)
498{ 508{
499 struct rb_root *root; 509 struct rb_root *root;
@@ -512,10 +522,8 @@ static void __btrfs_remove_delayed_item(struct btrfs_delayed_item *delayed_item)
512 522
513 rb_erase(&delayed_item->rb_node, root); 523 rb_erase(&delayed_item->rb_node, root);
514 delayed_item->delayed_node->count--; 524 delayed_item->delayed_node->count--;
515 if (atomic_dec_return(&delayed_root->items) < 525
516 BTRFS_DELAYED_BACKGROUND && 526 finish_one_item(delayed_root);
517 waitqueue_active(&delayed_root->wait))
518 wake_up(&delayed_root->wait);
519} 527}
520 528
521static void btrfs_release_delayed_item(struct btrfs_delayed_item *item) 529static void btrfs_release_delayed_item(struct btrfs_delayed_item *item)
@@ -1056,10 +1064,7 @@ static void btrfs_release_delayed_inode(struct btrfs_delayed_node *delayed_node)
1056 delayed_node->count--; 1064 delayed_node->count--;
1057 1065
1058 delayed_root = delayed_node->root->fs_info->delayed_root; 1066 delayed_root = delayed_node->root->fs_info->delayed_root;
1059 if (atomic_dec_return(&delayed_root->items) < 1067 finish_one_item(delayed_root);
1060 BTRFS_DELAYED_BACKGROUND &&
1061 waitqueue_active(&delayed_root->wait))
1062 wake_up(&delayed_root->wait);
1063 } 1068 }
1064} 1069}
1065 1070
@@ -1304,35 +1309,44 @@ void btrfs_remove_delayed_node(struct inode *inode)
1304 btrfs_release_delayed_node(delayed_node); 1309 btrfs_release_delayed_node(delayed_node);
1305} 1310}
1306 1311
1307struct btrfs_async_delayed_node { 1312struct btrfs_async_delayed_work {
1308 struct btrfs_root *root; 1313 struct btrfs_delayed_root *delayed_root;
1309 struct btrfs_delayed_node *delayed_node; 1314 int nr;
1310 struct btrfs_work work; 1315 struct btrfs_work work;
1311}; 1316};
1312 1317
1313static void btrfs_async_run_delayed_node_done(struct btrfs_work *work) 1318static void btrfs_async_run_delayed_root(struct btrfs_work *work)
1314{ 1319{
1315 struct btrfs_async_delayed_node *async_node; 1320 struct btrfs_async_delayed_work *async_work;
1321 struct btrfs_delayed_root *delayed_root;
1316 struct btrfs_trans_handle *trans; 1322 struct btrfs_trans_handle *trans;
1317 struct btrfs_path *path; 1323 struct btrfs_path *path;
1318 struct btrfs_delayed_node *delayed_node = NULL; 1324 struct btrfs_delayed_node *delayed_node = NULL;
1319 struct btrfs_root *root; 1325 struct btrfs_root *root;
1320 struct btrfs_block_rsv *block_rsv; 1326 struct btrfs_block_rsv *block_rsv;
1321 int need_requeue = 0; 1327 int total_done = 0;
1322 1328
1323 async_node = container_of(work, struct btrfs_async_delayed_node, work); 1329 async_work = container_of(work, struct btrfs_async_delayed_work, work);
1330 delayed_root = async_work->delayed_root;
1324 1331
1325 path = btrfs_alloc_path(); 1332 path = btrfs_alloc_path();
1326 if (!path) 1333 if (!path)
1327 goto out; 1334 goto out;
1328 path->leave_spinning = 1;
1329 1335
1330 delayed_node = async_node->delayed_node; 1336again:
1337 if (atomic_read(&delayed_root->items) < BTRFS_DELAYED_BACKGROUND / 2)
1338 goto free_path;
1339
1340 delayed_node = btrfs_first_prepared_delayed_node(delayed_root);
1341 if (!delayed_node)
1342 goto free_path;
1343
1344 path->leave_spinning = 1;
1331 root = delayed_node->root; 1345 root = delayed_node->root;
1332 1346
1333 trans = btrfs_join_transaction(root); 1347 trans = btrfs_join_transaction(root);
1334 if (IS_ERR(trans)) 1348 if (IS_ERR(trans))
1335 goto free_path; 1349 goto release_path;
1336 1350
1337 block_rsv = trans->block_rsv; 1351 block_rsv = trans->block_rsv;
1338 trans->block_rsv = &root->fs_info->delayed_block_rsv; 1352 trans->block_rsv = &root->fs_info->delayed_block_rsv;
@@ -1363,57 +1377,47 @@ static void btrfs_async_run_delayed_node_done(struct btrfs_work *work)
1363 * Task1 will sleep until the transaction is commited. 1377 * Task1 will sleep until the transaction is commited.
1364 */ 1378 */
1365 mutex_lock(&delayed_node->mutex); 1379 mutex_lock(&delayed_node->mutex);
1366 if (delayed_node->count) 1380 btrfs_dequeue_delayed_node(root->fs_info->delayed_root, delayed_node);
1367 need_requeue = 1;
1368 else
1369 btrfs_dequeue_delayed_node(root->fs_info->delayed_root,
1370 delayed_node);
1371 mutex_unlock(&delayed_node->mutex); 1381 mutex_unlock(&delayed_node->mutex);
1372 1382
1373 trans->block_rsv = block_rsv; 1383 trans->block_rsv = block_rsv;
1374 btrfs_end_transaction_dmeta(trans, root); 1384 btrfs_end_transaction_dmeta(trans, root);
1375 btrfs_btree_balance_dirty_nodelay(root); 1385 btrfs_btree_balance_dirty_nodelay(root);
1386
1387release_path:
1388 btrfs_release_path(path);
1389 total_done++;
1390
1391 btrfs_release_prepared_delayed_node(delayed_node);
1392 if (async_work->nr == 0 || total_done < async_work->nr)
1393 goto again;
1394
1376free_path: 1395free_path:
1377 btrfs_free_path(path); 1396 btrfs_free_path(path);
1378out: 1397out:
1379 if (need_requeue) 1398 wake_up(&delayed_root->wait);
1380 btrfs_requeue_work(&async_node->work); 1399 kfree(async_work);
1381 else {
1382 btrfs_release_prepared_delayed_node(delayed_node);
1383 kfree(async_node);
1384 }
1385} 1400}
1386 1401
1402
1387static int btrfs_wq_run_delayed_node(struct btrfs_delayed_root *delayed_root, 1403static int btrfs_wq_run_delayed_node(struct btrfs_delayed_root *delayed_root,
1388 struct btrfs_root *root, int all) 1404 struct btrfs_root *root, int nr)
1389{ 1405{
1390 struct btrfs_async_delayed_node *async_node; 1406 struct btrfs_async_delayed_work *async_work;
1391 struct btrfs_delayed_node *curr;
1392 int count = 0;
1393 1407
1394again: 1408 if (atomic_read(&delayed_root->items) < BTRFS_DELAYED_BACKGROUND)
1395 curr = btrfs_first_prepared_delayed_node(delayed_root);
1396 if (!curr)
1397 return 0; 1409 return 0;
1398 1410
1399 async_node = kmalloc(sizeof(*async_node), GFP_NOFS); 1411 async_work = kmalloc(sizeof(*async_work), GFP_NOFS);
1400 if (!async_node) { 1412 if (!async_work)
1401 btrfs_release_prepared_delayed_node(curr);
1402 return -ENOMEM; 1413 return -ENOMEM;
1403 }
1404
1405 async_node->root = root;
1406 async_node->delayed_node = curr;
1407
1408 async_node->work.func = btrfs_async_run_delayed_node_done;
1409 async_node->work.flags = 0;
1410 1414
1411 btrfs_queue_worker(&root->fs_info->delayed_workers, &async_node->work); 1415 async_work->delayed_root = delayed_root;
1412 count++; 1416 async_work->work.func = btrfs_async_run_delayed_root;
1413 1417 async_work->work.flags = 0;
1414 if (all || count < 4) 1418 async_work->nr = nr;
1415 goto again;
1416 1419
1420 btrfs_queue_worker(&root->fs_info->delayed_workers, &async_work->work);
1417 return 0; 1421 return 0;
1418} 1422}
1419 1423
@@ -1424,30 +1428,55 @@ void btrfs_assert_delayed_root_empty(struct btrfs_root *root)
1424 WARN_ON(btrfs_first_delayed_node(delayed_root)); 1428 WARN_ON(btrfs_first_delayed_node(delayed_root));
1425} 1429}
1426 1430
1431static int refs_newer(struct btrfs_delayed_root *delayed_root,
1432 int seq, int count)
1433{
1434 int val = atomic_read(&delayed_root->items_seq);
1435
1436 if (val < seq || val >= seq + count)
1437 return 1;
1438 return 0;
1439}
1440
1427void btrfs_balance_delayed_items(struct btrfs_root *root) 1441void btrfs_balance_delayed_items(struct btrfs_root *root)
1428{ 1442{
1429 struct btrfs_delayed_root *delayed_root; 1443 struct btrfs_delayed_root *delayed_root;
1444 int seq;
1430 1445
1431 delayed_root = btrfs_get_delayed_root(root); 1446 delayed_root = btrfs_get_delayed_root(root);
1432 1447
1433 if (atomic_read(&delayed_root->items) < BTRFS_DELAYED_BACKGROUND) 1448 if (atomic_read(&delayed_root->items) < BTRFS_DELAYED_BACKGROUND)
1434 return; 1449 return;
1435 1450
1451 seq = atomic_read(&delayed_root->items_seq);
1452
1436 if (atomic_read(&delayed_root->items) >= BTRFS_DELAYED_WRITEBACK) { 1453 if (atomic_read(&delayed_root->items) >= BTRFS_DELAYED_WRITEBACK) {
1437 int ret; 1454 int ret;
1438 ret = btrfs_wq_run_delayed_node(delayed_root, root, 1); 1455 DEFINE_WAIT(__wait);
1456
1457 ret = btrfs_wq_run_delayed_node(delayed_root, root, 0);
1439 if (ret) 1458 if (ret)
1440 return; 1459 return;
1441 1460
1442 wait_event_interruptible_timeout( 1461 while (1) {
1443 delayed_root->wait, 1462 prepare_to_wait(&delayed_root->wait, &__wait,
1444 (atomic_read(&delayed_root->items) < 1463 TASK_INTERRUPTIBLE);
1445 BTRFS_DELAYED_BACKGROUND), 1464
1446 HZ); 1465 if (refs_newer(delayed_root, seq,
1447 return; 1466 BTRFS_DELAYED_BATCH) ||
1467 atomic_read(&delayed_root->items) <
1468 BTRFS_DELAYED_BACKGROUND) {
1469 break;
1470 }
1471 if (!signal_pending(current))
1472 schedule();
1473 else
1474 break;
1475 }
1476 finish_wait(&delayed_root->wait, &__wait);
1448 } 1477 }
1449 1478
1450 btrfs_wq_run_delayed_node(delayed_root, root, 0); 1479 btrfs_wq_run_delayed_node(delayed_root, root, BTRFS_DELAYED_BATCH);
1451} 1480}
1452 1481
1453/* Will return 0 or -ENOMEM */ 1482/* Will return 0 or -ENOMEM */
diff --git a/fs/btrfs/delayed-inode.h b/fs/btrfs/delayed-inode.h
index 78b6ad0fc669..1d5c5f7abe3e 100644
--- a/fs/btrfs/delayed-inode.h
+++ b/fs/btrfs/delayed-inode.h
@@ -43,6 +43,7 @@ struct btrfs_delayed_root {
43 */ 43 */
44 struct list_head prepare_list; 44 struct list_head prepare_list;
45 atomic_t items; /* for delayed items */ 45 atomic_t items; /* for delayed items */
46 atomic_t items_seq; /* for delayed items */
46 int nodes; /* for delayed nodes */ 47 int nodes; /* for delayed nodes */
47 wait_queue_head_t wait; 48 wait_queue_head_t wait;
48}; 49};
@@ -86,6 +87,7 @@ static inline void btrfs_init_delayed_root(
86 struct btrfs_delayed_root *delayed_root) 87 struct btrfs_delayed_root *delayed_root)
87{ 88{
88 atomic_set(&delayed_root->items, 0); 89 atomic_set(&delayed_root->items, 0);
90 atomic_set(&delayed_root->items_seq, 0);
89 delayed_root->nodes = 0; 91 delayed_root->nodes = 0;
90 spin_lock_init(&delayed_root->lock); 92 spin_lock_init(&delayed_root->lock);
91 init_waitqueue_head(&delayed_root->wait); 93 init_waitqueue_head(&delayed_root->wait);
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 02369a3c162e..7d84651e850b 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -62,7 +62,7 @@ static void btrfs_destroy_ordered_operations(struct btrfs_transaction *t,
62static void btrfs_destroy_ordered_extents(struct btrfs_root *root); 62static void btrfs_destroy_ordered_extents(struct btrfs_root *root);
63static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans, 63static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans,
64 struct btrfs_root *root); 64 struct btrfs_root *root);
65static void btrfs_destroy_pending_snapshots(struct btrfs_transaction *t); 65static void btrfs_evict_pending_snapshots(struct btrfs_transaction *t);
66static void btrfs_destroy_delalloc_inodes(struct btrfs_root *root); 66static void btrfs_destroy_delalloc_inodes(struct btrfs_root *root);
67static int btrfs_destroy_marked_extents(struct btrfs_root *root, 67static int btrfs_destroy_marked_extents(struct btrfs_root *root,
68 struct extent_io_tree *dirty_pages, 68 struct extent_io_tree *dirty_pages,
@@ -3687,7 +3687,7 @@ int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans,
3687 return ret; 3687 return ret;
3688} 3688}
3689 3689
3690static void btrfs_destroy_pending_snapshots(struct btrfs_transaction *t) 3690static void btrfs_evict_pending_snapshots(struct btrfs_transaction *t)
3691{ 3691{
3692 struct btrfs_pending_snapshot *snapshot; 3692 struct btrfs_pending_snapshot *snapshot;
3693 struct list_head splice; 3693 struct list_head splice;
@@ -3700,10 +3700,8 @@ static void btrfs_destroy_pending_snapshots(struct btrfs_transaction *t)
3700 snapshot = list_entry(splice.next, 3700 snapshot = list_entry(splice.next,
3701 struct btrfs_pending_snapshot, 3701 struct btrfs_pending_snapshot,
3702 list); 3702 list);
3703 3703 snapshot->error = -ECANCELED;
3704 list_del_init(&snapshot->list); 3704 list_del_init(&snapshot->list);
3705
3706 kfree(snapshot);
3707 } 3705 }
3708} 3706}
3709 3707
@@ -3840,6 +3838,8 @@ void btrfs_cleanup_one_transaction(struct btrfs_transaction *cur_trans,
3840 cur_trans->blocked = 1; 3838 cur_trans->blocked = 1;
3841 wake_up(&root->fs_info->transaction_blocked_wait); 3839 wake_up(&root->fs_info->transaction_blocked_wait);
3842 3840
3841 btrfs_evict_pending_snapshots(cur_trans);
3842
3843 cur_trans->blocked = 0; 3843 cur_trans->blocked = 0;
3844 wake_up(&root->fs_info->transaction_wait); 3844 wake_up(&root->fs_info->transaction_wait);
3845 3845
@@ -3849,8 +3849,6 @@ void btrfs_cleanup_one_transaction(struct btrfs_transaction *cur_trans,
3849 btrfs_destroy_delayed_inodes(root); 3849 btrfs_destroy_delayed_inodes(root);
3850 btrfs_assert_delayed_root_empty(root); 3850 btrfs_assert_delayed_root_empty(root);
3851 3851
3852 btrfs_destroy_pending_snapshots(cur_trans);
3853
3854 btrfs_destroy_marked_extents(root, &cur_trans->dirty_pages, 3852 btrfs_destroy_marked_extents(root, &cur_trans->dirty_pages,
3855 EXTENT_DIRTY); 3853 EXTENT_DIRTY);
3856 btrfs_destroy_pinned_extent(root, 3854 btrfs_destroy_pinned_extent(root,
@@ -3894,6 +3892,8 @@ int btrfs_cleanup_transaction(struct btrfs_root *root)
3894 if (waitqueue_active(&root->fs_info->transaction_blocked_wait)) 3892 if (waitqueue_active(&root->fs_info->transaction_blocked_wait))
3895 wake_up(&root->fs_info->transaction_blocked_wait); 3893 wake_up(&root->fs_info->transaction_blocked_wait);
3896 3894
3895 btrfs_evict_pending_snapshots(t);
3896
3897 t->blocked = 0; 3897 t->blocked = 0;
3898 smp_mb(); 3898 smp_mb();
3899 if (waitqueue_active(&root->fs_info->transaction_wait)) 3899 if (waitqueue_active(&root->fs_info->transaction_wait))
@@ -3907,8 +3907,6 @@ int btrfs_cleanup_transaction(struct btrfs_root *root)
3907 btrfs_destroy_delayed_inodes(root); 3907 btrfs_destroy_delayed_inodes(root);
3908 btrfs_assert_delayed_root_empty(root); 3908 btrfs_assert_delayed_root_empty(root);
3909 3909
3910 btrfs_destroy_pending_snapshots(t);
3911
3912 btrfs_destroy_delalloc_inodes(root); 3910 btrfs_destroy_delalloc_inodes(root);
3913 3911
3914 spin_lock(&root->fs_info->trans_lock); 3912 spin_lock(&root->fs_info->trans_lock);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index c226daefd65d..d1470adca8f8 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -8502,6 +8502,7 @@ static int __btrfs_prealloc_file_range(struct inode *inode, int mode,
8502 struct btrfs_key ins; 8502 struct btrfs_key ins;
8503 u64 cur_offset = start; 8503 u64 cur_offset = start;
8504 u64 i_size; 8504 u64 i_size;
8505 u64 cur_bytes;
8505 int ret = 0; 8506 int ret = 0;
8506 bool own_trans = true; 8507 bool own_trans = true;
8507 8508
@@ -8516,8 +8517,9 @@ static int __btrfs_prealloc_file_range(struct inode *inode, int mode,
8516 } 8517 }
8517 } 8518 }
8518 8519
8519 ret = btrfs_reserve_extent(trans, root, 8520 cur_bytes = min(num_bytes, 256ULL * 1024 * 1024);
8520 min(num_bytes, 256ULL * 1024 * 1024), 8521 cur_bytes = max(cur_bytes, min_size);
8522 ret = btrfs_reserve_extent(trans, root, cur_bytes,
8521 min_size, 0, *alloc_hint, &ins, 1); 8523 min_size, 0, *alloc_hint, &ins, 1);
8522 if (ret) { 8524 if (ret) {
8523 if (own_trans) 8525 if (own_trans)
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index c83086fdda05..2c02310ff2d9 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -527,6 +527,8 @@ fail:
527 if (async_transid) { 527 if (async_transid) {
528 *async_transid = trans->transid; 528 *async_transid = trans->transid;
529 err = btrfs_commit_transaction_async(trans, root, 1); 529 err = btrfs_commit_transaction_async(trans, root, 1);
530 if (err)
531 err = btrfs_commit_transaction(trans, root);
530 } else { 532 } else {
531 err = btrfs_commit_transaction(trans, root); 533 err = btrfs_commit_transaction(trans, root);
532 } 534 }
@@ -592,16 +594,14 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir,
592 *async_transid = trans->transid; 594 *async_transid = trans->transid;
593 ret = btrfs_commit_transaction_async(trans, 595 ret = btrfs_commit_transaction_async(trans,
594 root->fs_info->extent_root, 1); 596 root->fs_info->extent_root, 1);
597 if (ret)
598 ret = btrfs_commit_transaction(trans, root);
595 } else { 599 } else {
596 ret = btrfs_commit_transaction(trans, 600 ret = btrfs_commit_transaction(trans,
597 root->fs_info->extent_root); 601 root->fs_info->extent_root);
598 } 602 }
599 if (ret) { 603 if (ret)
600 /* cleanup_transaction has freed this for us */
601 if (trans->aborted)
602 pending_snapshot = NULL;
603 goto fail; 604 goto fail;
604 }
605 605
606 ret = pending_snapshot->error; 606 ret = pending_snapshot->error;
607 if (ret) 607 if (ret)
@@ -2245,13 +2245,6 @@ static int btrfs_ioctl_defrag(struct file *file, void __user *argp)
2245 if (ret) 2245 if (ret)
2246 return ret; 2246 return ret;
2247 2247
2248 if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running,
2249 1)) {
2250 pr_info("btrfs: dev add/delete/balance/replace/resize operation in progress\n");
2251 mnt_drop_write_file(file);
2252 return -EINVAL;
2253 }
2254
2255 if (btrfs_root_readonly(root)) { 2248 if (btrfs_root_readonly(root)) {
2256 ret = -EROFS; 2249 ret = -EROFS;
2257 goto out; 2250 goto out;
@@ -2306,7 +2299,6 @@ static int btrfs_ioctl_defrag(struct file *file, void __user *argp)
2306 ret = -EINVAL; 2299 ret = -EINVAL;
2307 } 2300 }
2308out: 2301out:
2309 atomic_set(&root->fs_info->mutually_exclusive_operation_running, 0);
2310 mnt_drop_write_file(file); 2302 mnt_drop_write_file(file);
2311 return ret; 2303 return ret;
2312} 2304}
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 50695dc5e2ab..b67171e6d688 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -1269,6 +1269,8 @@ static int __update_reloc_root(struct btrfs_root *root, int del)
1269 } 1269 }
1270 spin_unlock(&rc->reloc_root_tree.lock); 1270 spin_unlock(&rc->reloc_root_tree.lock);
1271 1271
1272 if (!node)
1273 return 0;
1272 BUG_ON((struct btrfs_root *)node->data != root); 1274 BUG_ON((struct btrfs_root *)node->data != root);
1273 1275
1274 if (!del) { 1276 if (!del) {
@@ -2238,13 +2240,28 @@ again:
2238} 2240}
2239 2241
2240static noinline_for_stack 2242static noinline_for_stack
2243void free_reloc_roots(struct list_head *list)
2244{
2245 struct btrfs_root *reloc_root;
2246
2247 while (!list_empty(list)) {
2248 reloc_root = list_entry(list->next, struct btrfs_root,
2249 root_list);
2250 __update_reloc_root(reloc_root, 1);
2251 free_extent_buffer(reloc_root->node);
2252 free_extent_buffer(reloc_root->commit_root);
2253 kfree(reloc_root);
2254 }
2255}
2256
2257static noinline_for_stack
2241int merge_reloc_roots(struct reloc_control *rc) 2258int merge_reloc_roots(struct reloc_control *rc)
2242{ 2259{
2243 struct btrfs_root *root; 2260 struct btrfs_root *root;
2244 struct btrfs_root *reloc_root; 2261 struct btrfs_root *reloc_root;
2245 LIST_HEAD(reloc_roots); 2262 LIST_HEAD(reloc_roots);
2246 int found = 0; 2263 int found = 0;
2247 int ret; 2264 int ret = 0;
2248again: 2265again:
2249 root = rc->extent_root; 2266 root = rc->extent_root;
2250 2267
@@ -2270,20 +2287,33 @@ again:
2270 BUG_ON(root->reloc_root != reloc_root); 2287 BUG_ON(root->reloc_root != reloc_root);
2271 2288
2272 ret = merge_reloc_root(rc, root); 2289 ret = merge_reloc_root(rc, root);
2273 BUG_ON(ret); 2290 if (ret)
2291 goto out;
2274 } else { 2292 } else {
2275 list_del_init(&reloc_root->root_list); 2293 list_del_init(&reloc_root->root_list);
2276 } 2294 }
2277 ret = btrfs_drop_snapshot(reloc_root, rc->block_rsv, 0, 1); 2295 ret = btrfs_drop_snapshot(reloc_root, rc->block_rsv, 0, 1);
2278 BUG_ON(ret < 0); 2296 if (ret < 0) {
2297 if (list_empty(&reloc_root->root_list))
2298 list_add_tail(&reloc_root->root_list,
2299 &reloc_roots);
2300 goto out;
2301 }
2279 } 2302 }
2280 2303
2281 if (found) { 2304 if (found) {
2282 found = 0; 2305 found = 0;
2283 goto again; 2306 goto again;
2284 } 2307 }
2308out:
2309 if (ret) {
2310 btrfs_std_error(root->fs_info, ret);
2311 if (!list_empty(&reloc_roots))
2312 free_reloc_roots(&reloc_roots);
2313 }
2314
2285 BUG_ON(!RB_EMPTY_ROOT(&rc->reloc_root_tree.rb_root)); 2315 BUG_ON(!RB_EMPTY_ROOT(&rc->reloc_root_tree.rb_root));
2286 return 0; 2316 return ret;
2287} 2317}
2288 2318
2289static void free_block_list(struct rb_root *blocks) 2319static void free_block_list(struct rb_root *blocks)
@@ -2818,8 +2848,10 @@ int relocate_tree_blocks(struct btrfs_trans_handle *trans,
2818 int err = 0; 2848 int err = 0;
2819 2849
2820 path = btrfs_alloc_path(); 2850 path = btrfs_alloc_path();
2821 if (!path) 2851 if (!path) {
2822 return -ENOMEM; 2852 err = -ENOMEM;
2853 goto out_path;
2854 }
2823 2855
2824 rb_node = rb_first(blocks); 2856 rb_node = rb_first(blocks);
2825 while (rb_node) { 2857 while (rb_node) {
@@ -2858,10 +2890,11 @@ int relocate_tree_blocks(struct btrfs_trans_handle *trans,
2858 rb_node = rb_next(rb_node); 2890 rb_node = rb_next(rb_node);
2859 } 2891 }
2860out: 2892out:
2861 free_block_list(blocks);
2862 err = finish_pending_nodes(trans, rc, path, err); 2893 err = finish_pending_nodes(trans, rc, path, err);
2863 2894
2864 btrfs_free_path(path); 2895 btrfs_free_path(path);
2896out_path:
2897 free_block_list(blocks);
2865 return err; 2898 return err;
2866} 2899}
2867 2900
@@ -3698,7 +3731,15 @@ int prepare_to_relocate(struct reloc_control *rc)
3698 set_reloc_control(rc); 3731 set_reloc_control(rc);
3699 3732
3700 trans = btrfs_join_transaction(rc->extent_root); 3733 trans = btrfs_join_transaction(rc->extent_root);
3701 BUG_ON(IS_ERR(trans)); 3734 if (IS_ERR(trans)) {
3735 unset_reloc_control(rc);
3736 /*
3737 * extent tree is not a ref_cow tree and has no reloc_root to
3738 * cleanup. And callers are responsible to free the above
3739 * block rsv.
3740 */
3741 return PTR_ERR(trans);
3742 }
3702 btrfs_commit_transaction(trans, rc->extent_root); 3743 btrfs_commit_transaction(trans, rc->extent_root);
3703 return 0; 3744 return 0;
3704} 3745}
@@ -3730,7 +3771,11 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc)
3730 while (1) { 3771 while (1) {
3731 progress++; 3772 progress++;
3732 trans = btrfs_start_transaction(rc->extent_root, 0); 3773 trans = btrfs_start_transaction(rc->extent_root, 0);
3733 BUG_ON(IS_ERR(trans)); 3774 if (IS_ERR(trans)) {
3775 err = PTR_ERR(trans);
3776 trans = NULL;
3777 break;
3778 }
3734restart: 3779restart:
3735 if (update_backref_cache(trans, &rc->backref_cache)) { 3780 if (update_backref_cache(trans, &rc->backref_cache)) {
3736 btrfs_end_transaction(trans, rc->extent_root); 3781 btrfs_end_transaction(trans, rc->extent_root);
@@ -4264,14 +4309,9 @@ int btrfs_recover_relocation(struct btrfs_root *root)
4264out_free: 4309out_free:
4265 kfree(rc); 4310 kfree(rc);
4266out: 4311out:
4267 while (!list_empty(&reloc_roots)) { 4312 if (!list_empty(&reloc_roots))
4268 reloc_root = list_entry(reloc_roots.next, 4313 free_reloc_roots(&reloc_roots);
4269 struct btrfs_root, root_list); 4314
4270 list_del(&reloc_root->root_list);
4271 free_extent_buffer(reloc_root->node);
4272 free_extent_buffer(reloc_root->commit_root);
4273 kfree(reloc_root);
4274 }
4275 btrfs_free_path(path); 4315 btrfs_free_path(path);
4276 4316
4277 if (err == 0) { 4317 if (err == 0) {
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 68a29a1ea068..f6b88595f858 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -1558,6 +1558,7 @@ static struct file_system_type btrfs_fs_type = {
1558 .kill_sb = btrfs_kill_super, 1558 .kill_sb = btrfs_kill_super,
1559 .fs_flags = FS_REQUIRES_DEV, 1559 .fs_flags = FS_REQUIRES_DEV,
1560}; 1560};
1561MODULE_ALIAS_FS("btrfs");
1561 1562
1562/* 1563/*
1563 * used by btrfsctl to scan devices when no FS is mounted 1564 * used by btrfsctl to scan devices when no FS is mounted
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index e52da6fb1165..9250b9c4f01e 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -1052,7 +1052,12 @@ int btrfs_defrag_root(struct btrfs_root *root)
1052 1052
1053/* 1053/*
1054 * new snapshots need to be created at a very specific time in the 1054 * new snapshots need to be created at a very specific time in the
1055 * transaction commit. This does the actual creation 1055 * transaction commit. This does the actual creation.
1056 *
1057 * Note:
1058 * If the error which may affect the commitment of the current transaction
1059 * happens, we should return the error number. If the error which just affect
1060 * the creation of the pending snapshots, just return 0.
1056 */ 1061 */
1057static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans, 1062static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
1058 struct btrfs_fs_info *fs_info, 1063 struct btrfs_fs_info *fs_info,
@@ -1071,7 +1076,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
1071 struct extent_buffer *tmp; 1076 struct extent_buffer *tmp;
1072 struct extent_buffer *old; 1077 struct extent_buffer *old;
1073 struct timespec cur_time = CURRENT_TIME; 1078 struct timespec cur_time = CURRENT_TIME;
1074 int ret; 1079 int ret = 0;
1075 u64 to_reserve = 0; 1080 u64 to_reserve = 0;
1076 u64 index = 0; 1081 u64 index = 0;
1077 u64 objectid; 1082 u64 objectid;
@@ -1080,40 +1085,36 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
1080 1085
1081 path = btrfs_alloc_path(); 1086 path = btrfs_alloc_path();
1082 if (!path) { 1087 if (!path) {
1083 ret = pending->error = -ENOMEM; 1088 pending->error = -ENOMEM;
1084 return ret; 1089 return 0;
1085 } 1090 }
1086 1091
1087 new_root_item = kmalloc(sizeof(*new_root_item), GFP_NOFS); 1092 new_root_item = kmalloc(sizeof(*new_root_item), GFP_NOFS);
1088 if (!new_root_item) { 1093 if (!new_root_item) {
1089 ret = pending->error = -ENOMEM; 1094 pending->error = -ENOMEM;
1090 goto root_item_alloc_fail; 1095 goto root_item_alloc_fail;
1091 } 1096 }
1092 1097
1093 ret = btrfs_find_free_objectid(tree_root, &objectid); 1098 pending->error = btrfs_find_free_objectid(tree_root, &objectid);
1094 if (ret) { 1099 if (pending->error)
1095 pending->error = ret;
1096 goto no_free_objectid; 1100 goto no_free_objectid;
1097 }
1098 1101
1099 btrfs_reloc_pre_snapshot(trans, pending, &to_reserve); 1102 btrfs_reloc_pre_snapshot(trans, pending, &to_reserve);
1100 1103
1101 if (to_reserve > 0) { 1104 if (to_reserve > 0) {
1102 ret = btrfs_block_rsv_add(root, &pending->block_rsv, 1105 pending->error = btrfs_block_rsv_add(root,
1103 to_reserve, 1106 &pending->block_rsv,
1104 BTRFS_RESERVE_NO_FLUSH); 1107 to_reserve,
1105 if (ret) { 1108 BTRFS_RESERVE_NO_FLUSH);
1106 pending->error = ret; 1109 if (pending->error)
1107 goto no_free_objectid; 1110 goto no_free_objectid;
1108 }
1109 } 1111 }
1110 1112
1111 ret = btrfs_qgroup_inherit(trans, fs_info, root->root_key.objectid, 1113 pending->error = btrfs_qgroup_inherit(trans, fs_info,
1112 objectid, pending->inherit); 1114 root->root_key.objectid,
1113 if (ret) { 1115 objectid, pending->inherit);
1114 pending->error = ret; 1116 if (pending->error)
1115 goto no_free_objectid; 1117 goto no_free_objectid;
1116 }
1117 1118
1118 key.objectid = objectid; 1119 key.objectid = objectid;
1119 key.offset = (u64)-1; 1120 key.offset = (u64)-1;
@@ -1141,7 +1142,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
1141 dentry->d_name.len, 0); 1142 dentry->d_name.len, 0);
1142 if (dir_item != NULL && !IS_ERR(dir_item)) { 1143 if (dir_item != NULL && !IS_ERR(dir_item)) {
1143 pending->error = -EEXIST; 1144 pending->error = -EEXIST;
1144 goto fail; 1145 goto dir_item_existed;
1145 } else if (IS_ERR(dir_item)) { 1146 } else if (IS_ERR(dir_item)) {
1146 ret = PTR_ERR(dir_item); 1147 ret = PTR_ERR(dir_item);
1147 btrfs_abort_transaction(trans, root, ret); 1148 btrfs_abort_transaction(trans, root, ret);
@@ -1272,6 +1273,8 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
1272 if (ret) 1273 if (ret)
1273 btrfs_abort_transaction(trans, root, ret); 1274 btrfs_abort_transaction(trans, root, ret);
1274fail: 1275fail:
1276 pending->error = ret;
1277dir_item_existed:
1275 trans->block_rsv = rsv; 1278 trans->block_rsv = rsv;
1276 trans->bytes_reserved = 0; 1279 trans->bytes_reserved = 0;
1277no_free_objectid: 1280no_free_objectid:
@@ -1287,12 +1290,17 @@ root_item_alloc_fail:
1287static noinline int create_pending_snapshots(struct btrfs_trans_handle *trans, 1290static noinline int create_pending_snapshots(struct btrfs_trans_handle *trans,
1288 struct btrfs_fs_info *fs_info) 1291 struct btrfs_fs_info *fs_info)
1289{ 1292{
1290 struct btrfs_pending_snapshot *pending; 1293 struct btrfs_pending_snapshot *pending, *next;
1291 struct list_head *head = &trans->transaction->pending_snapshots; 1294 struct list_head *head = &trans->transaction->pending_snapshots;
1295 int ret = 0;
1292 1296
1293 list_for_each_entry(pending, head, list) 1297 list_for_each_entry_safe(pending, next, head, list) {
1294 create_pending_snapshot(trans, fs_info, pending); 1298 list_del(&pending->list);
1295 return 0; 1299 ret = create_pending_snapshot(trans, fs_info, pending);
1300 if (ret)
1301 break;
1302 }
1303 return ret;
1296} 1304}
1297 1305
1298static void update_super_roots(struct btrfs_root *root) 1306static void update_super_roots(struct btrfs_root *root)
@@ -1448,6 +1456,13 @@ static void cleanup_transaction(struct btrfs_trans_handle *trans,
1448 btrfs_abort_transaction(trans, root, err); 1456 btrfs_abort_transaction(trans, root, err);
1449 1457
1450 spin_lock(&root->fs_info->trans_lock); 1458 spin_lock(&root->fs_info->trans_lock);
1459
1460 if (list_empty(&cur_trans->list)) {
1461 spin_unlock(&root->fs_info->trans_lock);
1462 btrfs_end_transaction(trans, root);
1463 return;
1464 }
1465
1451 list_del_init(&cur_trans->list); 1466 list_del_init(&cur_trans->list);
1452 if (cur_trans == root->fs_info->running_transaction) { 1467 if (cur_trans == root->fs_info->running_transaction) {
1453 root->fs_info->trans_no_join = 1; 1468 root->fs_info->trans_no_join = 1;
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index c7ef569eb22a..451fad96ecd1 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -1382,7 +1382,10 @@ static noinline int link_to_fixup_dir(struct btrfs_trans_handle *trans,
1382 1382
1383 btrfs_release_path(path); 1383 btrfs_release_path(path);
1384 if (ret == 0) { 1384 if (ret == 0) {
1385 btrfs_inc_nlink(inode); 1385 if (!inode->i_nlink)
1386 set_nlink(inode, 1);
1387 else
1388 btrfs_inc_nlink(inode);
1386 ret = btrfs_update_inode(trans, root, inode); 1389 ret = btrfs_update_inode(trans, root, inode);
1387 } else if (ret == -EEXIST) { 1390 } else if (ret == -EEXIST) {
1388 ret = 0; 1391 ret = 0;
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 35bb2d4ed29f..6b9cff42265d 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2379,7 +2379,11 @@ static int btrfs_relocate_chunk(struct btrfs_root *root,
2379 return ret; 2379 return ret;
2380 2380
2381 trans = btrfs_start_transaction(root, 0); 2381 trans = btrfs_start_transaction(root, 0);
2382 BUG_ON(IS_ERR(trans)); 2382 if (IS_ERR(trans)) {
2383 ret = PTR_ERR(trans);
2384 btrfs_std_error(root->fs_info, ret);
2385 return ret;
2386 }
2383 2387
2384 lock_chunks(root); 2388 lock_chunks(root);
2385 2389
@@ -3050,7 +3054,8 @@ static void __cancel_balance(struct btrfs_fs_info *fs_info)
3050 3054
3051 unset_balance_control(fs_info); 3055 unset_balance_control(fs_info);
3052 ret = del_balance_item(fs_info->tree_root); 3056 ret = del_balance_item(fs_info->tree_root);
3053 BUG_ON(ret); 3057 if (ret)
3058 btrfs_std_error(fs_info, ret);
3054 3059
3055 atomic_set(&fs_info->mutually_exclusive_operation_running, 0); 3060 atomic_set(&fs_info->mutually_exclusive_operation_running, 0);
3056} 3061}
@@ -3230,6 +3235,11 @@ int btrfs_balance(struct btrfs_balance_control *bctl,
3230 update_ioctl_balance_args(fs_info, 0, bargs); 3235 update_ioctl_balance_args(fs_info, 0, bargs);
3231 } 3236 }
3232 3237
3238 if ((ret && ret != -ECANCELED && ret != -ENOSPC) ||
3239 balance_need_close(fs_info)) {
3240 __cancel_balance(fs_info);
3241 }
3242
3233 wake_up(&fs_info->balance_wait_q); 3243 wake_up(&fs_info->balance_wait_q);
3234 3244
3235 return ret; 3245 return ret;
diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index 9fe17c6c2876..6ddc0bca56b2 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -952,6 +952,7 @@ static struct file_system_type ceph_fs_type = {
952 .kill_sb = ceph_kill_sb, 952 .kill_sb = ceph_kill_sb,
953 .fs_flags = FS_RENAME_DOES_D_MOVE, 953 .fs_flags = FS_RENAME_DOES_D_MOVE,
954}; 954};
955MODULE_ALIAS_FS("ceph");
955 956
956#define _STRINGIFY(x) #x 957#define _STRINGIFY(x) #x
957#define STRINGIFY(x) _STRINGIFY(x) 958#define STRINGIFY(x) _STRINGIFY(x)
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 7353bc5d73d7..8e2e799e7a24 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -1909,12 +1909,12 @@ cifs_writev_requeue(struct cifs_writedata *wdata)
1909 } while (rc == -EAGAIN); 1909 } while (rc == -EAGAIN);
1910 1910
1911 for (i = 0; i < wdata->nr_pages; i++) { 1911 for (i = 0; i < wdata->nr_pages; i++) {
1912 unlock_page(wdata->pages[i]);
1912 if (rc != 0) { 1913 if (rc != 0) {
1913 SetPageError(wdata->pages[i]); 1914 SetPageError(wdata->pages[i]);
1914 end_page_writeback(wdata->pages[i]); 1915 end_page_writeback(wdata->pages[i]);
1915 page_cache_release(wdata->pages[i]); 1916 page_cache_release(wdata->pages[i]);
1916 } 1917 }
1917 unlock_page(wdata->pages[i]);
1918 } 1918 }
1919 1919
1920 mapping_set_error(inode->i_mapping, rc); 1920 mapping_set_error(inode->i_mapping, rc);
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 54125e04fd0c..991c63c6bdd0 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -97,7 +97,7 @@ enum {
97 Opt_user, Opt_pass, Opt_ip, 97 Opt_user, Opt_pass, Opt_ip,
98 Opt_unc, Opt_domain, 98 Opt_unc, Opt_domain,
99 Opt_srcaddr, Opt_prefixpath, 99 Opt_srcaddr, Opt_prefixpath,
100 Opt_iocharset, Opt_sockopt, 100 Opt_iocharset,
101 Opt_netbiosname, Opt_servern, 101 Opt_netbiosname, Opt_servern,
102 Opt_ver, Opt_vers, Opt_sec, Opt_cache, 102 Opt_ver, Opt_vers, Opt_sec, Opt_cache,
103 103
@@ -202,7 +202,6 @@ static const match_table_t cifs_mount_option_tokens = {
202 { Opt_srcaddr, "srcaddr=%s" }, 202 { Opt_srcaddr, "srcaddr=%s" },
203 { Opt_prefixpath, "prefixpath=%s" }, 203 { Opt_prefixpath, "prefixpath=%s" },
204 { Opt_iocharset, "iocharset=%s" }, 204 { Opt_iocharset, "iocharset=%s" },
205 { Opt_sockopt, "sockopt=%s" },
206 { Opt_netbiosname, "netbiosname=%s" }, 205 { Opt_netbiosname, "netbiosname=%s" },
207 { Opt_servern, "servern=%s" }, 206 { Opt_servern, "servern=%s" },
208 { Opt_ver, "ver=%s" }, 207 { Opt_ver, "ver=%s" },
@@ -1752,19 +1751,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1752 */ 1751 */
1753 cFYI(1, "iocharset set to %s", string); 1752 cFYI(1, "iocharset set to %s", string);
1754 break; 1753 break;
1755 case Opt_sockopt:
1756 string = match_strdup(args);
1757 if (string == NULL)
1758 goto out_nomem;
1759
1760 if (strnicmp(string, "TCP_NODELAY", 11) == 0) {
1761 printk(KERN_WARNING "CIFS: the "
1762 "sockopt=TCP_NODELAY option has been "
1763 "deprecated and will be removed "
1764 "in 3.9\n");
1765 vol->sockopt_tcp_nodelay = 1;
1766 }
1767 break;
1768 case Opt_netbiosname: 1754 case Opt_netbiosname:
1769 string = match_strdup(args); 1755 string = match_strdup(args);
1770 if (string == NULL) 1756 if (string == NULL)
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 83f2606c76d0..0079696305c9 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -995,6 +995,15 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry,
995 return PTR_ERR(tlink); 995 return PTR_ERR(tlink);
996 tcon = tlink_tcon(tlink); 996 tcon = tlink_tcon(tlink);
997 997
998 /*
999 * We cannot rename the file if the server doesn't support
1000 * CAP_INFOLEVEL_PASSTHRU
1001 */
1002 if (!(tcon->ses->capabilities & CAP_INFOLEVEL_PASSTHRU)) {
1003 rc = -EBUSY;
1004 goto out;
1005 }
1006
998 rc = CIFSSMBOpen(xid, tcon, full_path, FILE_OPEN, 1007 rc = CIFSSMBOpen(xid, tcon, full_path, FILE_OPEN,
999 DELETE|FILE_WRITE_ATTRIBUTES, CREATE_NOT_DIR, 1008 DELETE|FILE_WRITE_ATTRIBUTES, CREATE_NOT_DIR,
1000 &netfid, &oplock, NULL, cifs_sb->local_nls, 1009 &netfid, &oplock, NULL, cifs_sb->local_nls,
@@ -1023,7 +1032,7 @@ cifs_rename_pending_delete(const char *full_path, struct dentry *dentry,
1023 current->tgid); 1032 current->tgid);
1024 /* although we would like to mark the file hidden 1033 /* although we would like to mark the file hidden
1025 if that fails we will still try to rename it */ 1034 if that fails we will still try to rename it */
1026 if (rc != 0) 1035 if (!rc)
1027 cifsInode->cifsAttrs = dosattr; 1036 cifsInode->cifsAttrs = dosattr;
1028 else 1037 else
1029 dosattr = origattr; /* since not able to change them */ 1038 dosattr = origattr; /* since not able to change them */
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index c9c7aa7ed966..bceffe7b8f8d 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -744,4 +744,5 @@ struct smb_version_values smb30_values = {
744 .cap_unix = 0, 744 .cap_unix = 0,
745 .cap_nt_find = SMB2_NT_FIND, 745 .cap_nt_find = SMB2_NT_FIND,
746 .cap_large_files = SMB2_LARGE_FILES, 746 .cap_large_files = SMB2_LARGE_FILES,
747 .oplock_read = SMB2_OPLOCK_LEVEL_II,
747}; 748};
diff --git a/fs/coda/inode.c b/fs/coda/inode.c
index dada9d0abede..4dcc0d81a7aa 100644
--- a/fs/coda/inode.c
+++ b/fs/coda/inode.c
@@ -329,4 +329,5 @@ struct file_system_type coda_fs_type = {
329 .kill_sb = kill_anon_super, 329 .kill_sb = kill_anon_super,
330 .fs_flags = FS_BINARY_MOUNTDATA, 330 .fs_flags = FS_BINARY_MOUNTDATA,
331}; 331};
332MODULE_ALIAS_FS("coda");
332 333
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c
index aee0a7ebbd8e..7f26c3cf75ae 100644
--- a/fs/configfs/mount.c
+++ b/fs/configfs/mount.c
@@ -114,6 +114,7 @@ static struct file_system_type configfs_fs_type = {
114 .mount = configfs_do_mount, 114 .mount = configfs_do_mount,
115 .kill_sb = kill_litter_super, 115 .kill_sb = kill_litter_super,
116}; 116};
117MODULE_ALIAS_FS("configfs");
117 118
118struct dentry *configfs_pin_fs(void) 119struct dentry *configfs_pin_fs(void)
119{ 120{
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index 3ceb9ec976e1..35b1c7bd18b7 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -573,6 +573,7 @@ static struct file_system_type cramfs_fs_type = {
573 .kill_sb = kill_block_super, 573 .kill_sb = kill_block_super,
574 .fs_flags = FS_REQUIRES_DEV, 574 .fs_flags = FS_REQUIRES_DEV,
575}; 575};
576MODULE_ALIAS_FS("cramfs");
576 577
577static int __init init_cramfs_fs(void) 578static int __init init_cramfs_fs(void)
578{ 579{
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 0c4f80b447fb..4888cb3fdef7 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -299,6 +299,7 @@ static struct file_system_type debug_fs_type = {
299 .mount = debug_mount, 299 .mount = debug_mount,
300 .kill_sb = kill_litter_super, 300 .kill_sb = kill_litter_super,
301}; 301};
302MODULE_ALIAS_FS("debugfs");
302 303
303static struct dentry *__create_file(const char *name, umode_t mode, 304static struct dentry *__create_file(const char *name, umode_t mode,
304 struct dentry *parent, void *data, 305 struct dentry *parent, void *data,
diff --git a/fs/ecryptfs/Kconfig b/fs/ecryptfs/Kconfig
index e15ef38c24fa..434aa313f077 100644
--- a/fs/ecryptfs/Kconfig
+++ b/fs/ecryptfs/Kconfig
@@ -12,3 +12,11 @@ config ECRYPT_FS
12 12
13 To compile this file system support as a module, choose M here: the 13 To compile this file system support as a module, choose M here: the
14 module will be called ecryptfs. 14 module will be called ecryptfs.
15
16config ECRYPT_FS_MESSAGING
17 bool "Enable notifications for userspace key wrap/unwrap"
18 depends on ECRYPT_FS
19 help
20 Enables the /dev/ecryptfs entry for use by ecryptfsd. This allows
21 for userspace to wrap/unwrap file encryption keys by other
22 backends, like OpenSSL.
diff --git a/fs/ecryptfs/Makefile b/fs/ecryptfs/Makefile
index 2cc9ee4ad2eb..49678a69947d 100644
--- a/fs/ecryptfs/Makefile
+++ b/fs/ecryptfs/Makefile
@@ -1,7 +1,10 @@
1# 1#
2# Makefile for the Linux 2.6 eCryptfs 2# Makefile for the Linux eCryptfs
3# 3#
4 4
5obj-$(CONFIG_ECRYPT_FS) += ecryptfs.o 5obj-$(CONFIG_ECRYPT_FS) += ecryptfs.o
6 6
7ecryptfs-objs := dentry.o file.o inode.o main.o super.o mmap.o read_write.o crypto.o keystore.o messaging.o miscdev.o kthread.o debug.o 7ecryptfs-y := dentry.o file.o inode.o main.o super.o mmap.o read_write.o \
8 crypto.o keystore.o kthread.o debug.o
9
10ecryptfs-$(CONFIG_ECRYPT_FS_MESSAGING) += messaging.o miscdev.o
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index a7b0c2dfb3db..d5c25db4398f 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -301,17 +301,14 @@ int virt_to_scatterlist(const void *addr, int size, struct scatterlist *sg,
301 while (size > 0 && i < sg_size) { 301 while (size > 0 && i < sg_size) {
302 pg = virt_to_page(addr); 302 pg = virt_to_page(addr);
303 offset = offset_in_page(addr); 303 offset = offset_in_page(addr);
304 if (sg) 304 sg_set_page(&sg[i], pg, 0, offset);
305 sg_set_page(&sg[i], pg, 0, offset);
306 remainder_of_page = PAGE_CACHE_SIZE - offset; 305 remainder_of_page = PAGE_CACHE_SIZE - offset;
307 if (size >= remainder_of_page) { 306 if (size >= remainder_of_page) {
308 if (sg) 307 sg[i].length = remainder_of_page;
309 sg[i].length = remainder_of_page;
310 addr += remainder_of_page; 308 addr += remainder_of_page;
311 size -= remainder_of_page; 309 size -= remainder_of_page;
312 } else { 310 } else {
313 if (sg) 311 sg[i].length = size;
314 sg[i].length = size;
315 addr += size; 312 addr += size;
316 size = 0; 313 size = 0;
317 } 314 }
diff --git a/fs/ecryptfs/dentry.c b/fs/ecryptfs/dentry.c
index 1b5d9af937df..bf12ba5dd223 100644
--- a/fs/ecryptfs/dentry.c
+++ b/fs/ecryptfs/dentry.c
@@ -45,14 +45,12 @@
45static int ecryptfs_d_revalidate(struct dentry *dentry, unsigned int flags) 45static int ecryptfs_d_revalidate(struct dentry *dentry, unsigned int flags)
46{ 46{
47 struct dentry *lower_dentry; 47 struct dentry *lower_dentry;
48 struct vfsmount *lower_mnt;
49 int rc = 1; 48 int rc = 1;
50 49
51 if (flags & LOOKUP_RCU) 50 if (flags & LOOKUP_RCU)
52 return -ECHILD; 51 return -ECHILD;
53 52
54 lower_dentry = ecryptfs_dentry_to_lower(dentry); 53 lower_dentry = ecryptfs_dentry_to_lower(dentry);
55 lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry);
56 if (!lower_dentry->d_op || !lower_dentry->d_op->d_revalidate) 54 if (!lower_dentry->d_op || !lower_dentry->d_op->d_revalidate)
57 goto out; 55 goto out;
58 rc = lower_dentry->d_op->d_revalidate(lower_dentry, flags); 56 rc = lower_dentry->d_op->d_revalidate(lower_dentry, flags);
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h
index 7e2c6f5d7985..dd299b389d4e 100644
--- a/fs/ecryptfs/ecryptfs_kernel.h
+++ b/fs/ecryptfs/ecryptfs_kernel.h
@@ -172,6 +172,19 @@ ecryptfs_get_key_payload_data(struct key *key)
172#define ECRYPTFS_FNEK_ENCRYPTED_FILENAME_PREFIX_SIZE 24 172#define ECRYPTFS_FNEK_ENCRYPTED_FILENAME_PREFIX_SIZE 24
173#define ECRYPTFS_ENCRYPTED_DENTRY_NAME_LEN (18 + 1 + 4 + 1 + 32) 173#define ECRYPTFS_ENCRYPTED_DENTRY_NAME_LEN (18 + 1 + 4 + 1 + 32)
174 174
175#ifdef CONFIG_ECRYPT_FS_MESSAGING
176# define ECRYPTFS_VERSIONING_MASK_MESSAGING (ECRYPTFS_VERSIONING_DEVMISC \
177 | ECRYPTFS_VERSIONING_PUBKEY)
178#else
179# define ECRYPTFS_VERSIONING_MASK_MESSAGING 0
180#endif
181
182#define ECRYPTFS_VERSIONING_MASK (ECRYPTFS_VERSIONING_PASSPHRASE \
183 | ECRYPTFS_VERSIONING_PLAINTEXT_PASSTHROUGH \
184 | ECRYPTFS_VERSIONING_XATTR \
185 | ECRYPTFS_VERSIONING_MULTKEY \
186 | ECRYPTFS_VERSIONING_MASK_MESSAGING \
187 | ECRYPTFS_VERSIONING_FILENAME_ENCRYPTION)
175struct ecryptfs_key_sig { 188struct ecryptfs_key_sig {
176 struct list_head crypt_stat_list; 189 struct list_head crypt_stat_list;
177 char keysig[ECRYPTFS_SIG_SIZE_HEX + 1]; 190 char keysig[ECRYPTFS_SIG_SIZE_HEX + 1];
@@ -399,7 +412,9 @@ struct ecryptfs_daemon {
399 struct hlist_node euid_chain; 412 struct hlist_node euid_chain;
400}; 413};
401 414
415#ifdef CONFIG_ECRYPT_FS_MESSAGING
402extern struct mutex ecryptfs_daemon_hash_mux; 416extern struct mutex ecryptfs_daemon_hash_mux;
417#endif
403 418
404static inline size_t 419static inline size_t
405ecryptfs_lower_header_size(struct ecryptfs_crypt_stat *crypt_stat) 420ecryptfs_lower_header_size(struct ecryptfs_crypt_stat *crypt_stat)
@@ -610,6 +625,7 @@ int
610ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value, 625ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value,
611 size_t size, int flags); 626 size_t size, int flags);
612int ecryptfs_read_xattr_region(char *page_virt, struct inode *ecryptfs_inode); 627int ecryptfs_read_xattr_region(char *page_virt, struct inode *ecryptfs_inode);
628#ifdef CONFIG_ECRYPT_FS_MESSAGING
613int ecryptfs_process_response(struct ecryptfs_daemon *daemon, 629int ecryptfs_process_response(struct ecryptfs_daemon *daemon,
614 struct ecryptfs_message *msg, u32 seq); 630 struct ecryptfs_message *msg, u32 seq);
615int ecryptfs_send_message(char *data, int data_len, 631int ecryptfs_send_message(char *data, int data_len,
@@ -618,6 +634,24 @@ int ecryptfs_wait_for_response(struct ecryptfs_msg_ctx *msg_ctx,
618 struct ecryptfs_message **emsg); 634 struct ecryptfs_message **emsg);
619int ecryptfs_init_messaging(void); 635int ecryptfs_init_messaging(void);
620void ecryptfs_release_messaging(void); 636void ecryptfs_release_messaging(void);
637#else
638static inline int ecryptfs_init_messaging(void)
639{
640 return 0;
641}
642static inline void ecryptfs_release_messaging(void)
643{ }
644static inline int ecryptfs_send_message(char *data, int data_len,
645 struct ecryptfs_msg_ctx **msg_ctx)
646{
647 return -ENOTCONN;
648}
649static inline int ecryptfs_wait_for_response(struct ecryptfs_msg_ctx *msg_ctx,
650 struct ecryptfs_message **emsg)
651{
652 return -ENOMSG;
653}
654#endif
621 655
622void 656void
623ecryptfs_write_header_metadata(char *virt, 657ecryptfs_write_header_metadata(char *virt,
@@ -655,12 +689,11 @@ int ecryptfs_read_lower_page_segment(struct page *page_for_ecryptfs,
655 size_t offset_in_page, size_t size, 689 size_t offset_in_page, size_t size,
656 struct inode *ecryptfs_inode); 690 struct inode *ecryptfs_inode);
657struct page *ecryptfs_get_locked_page(struct inode *inode, loff_t index); 691struct page *ecryptfs_get_locked_page(struct inode *inode, loff_t index);
658int ecryptfs_exorcise_daemon(struct ecryptfs_daemon *daemon);
659int ecryptfs_find_daemon_by_euid(struct ecryptfs_daemon **daemon);
660int ecryptfs_parse_packet_length(unsigned char *data, size_t *size, 692int ecryptfs_parse_packet_length(unsigned char *data, size_t *size,
661 size_t *length_size); 693 size_t *length_size);
662int ecryptfs_write_packet_length(char *dest, size_t size, 694int ecryptfs_write_packet_length(char *dest, size_t size,
663 size_t *packet_size_length); 695 size_t *packet_size_length);
696#ifdef CONFIG_ECRYPT_FS_MESSAGING
664int ecryptfs_init_ecryptfs_miscdev(void); 697int ecryptfs_init_ecryptfs_miscdev(void);
665void ecryptfs_destroy_ecryptfs_miscdev(void); 698void ecryptfs_destroy_ecryptfs_miscdev(void);
666int ecryptfs_send_miscdev(char *data, size_t data_size, 699int ecryptfs_send_miscdev(char *data, size_t data_size,
@@ -669,6 +702,9 @@ int ecryptfs_send_miscdev(char *data, size_t data_size,
669void ecryptfs_msg_ctx_alloc_to_free(struct ecryptfs_msg_ctx *msg_ctx); 702void ecryptfs_msg_ctx_alloc_to_free(struct ecryptfs_msg_ctx *msg_ctx);
670int 703int
671ecryptfs_spawn_daemon(struct ecryptfs_daemon **daemon, struct file *file); 704ecryptfs_spawn_daemon(struct ecryptfs_daemon **daemon, struct file *file);
705int ecryptfs_exorcise_daemon(struct ecryptfs_daemon *daemon);
706int ecryptfs_find_daemon_by_euid(struct ecryptfs_daemon **daemon);
707#endif
672int ecryptfs_init_kthread(void); 708int ecryptfs_init_kthread(void);
673void ecryptfs_destroy_kthread(void); 709void ecryptfs_destroy_kthread(void);
674int ecryptfs_privileged_open(struct file **lower_file, 710int ecryptfs_privileged_open(struct file **lower_file,
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
index 53acc9d0c138..63b1f54b6a1f 100644
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -199,7 +199,6 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
199 struct dentry *ecryptfs_dentry = file->f_path.dentry; 199 struct dentry *ecryptfs_dentry = file->f_path.dentry;
200 /* Private value of ecryptfs_dentry allocated in 200 /* Private value of ecryptfs_dentry allocated in
201 * ecryptfs_lookup() */ 201 * ecryptfs_lookup() */
202 struct dentry *lower_dentry;
203 struct ecryptfs_file_info *file_info; 202 struct ecryptfs_file_info *file_info;
204 203
205 mount_crypt_stat = &ecryptfs_superblock_to_private( 204 mount_crypt_stat = &ecryptfs_superblock_to_private(
@@ -222,7 +221,6 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
222 rc = -ENOMEM; 221 rc = -ENOMEM;
223 goto out; 222 goto out;
224 } 223 }
225 lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry);
226 crypt_stat = &ecryptfs_inode_to_private(inode)->crypt_stat; 224 crypt_stat = &ecryptfs_inode_to_private(inode)->crypt_stat;
227 mutex_lock(&crypt_stat->cs_mutex); 225 mutex_lock(&crypt_stat->cs_mutex);
228 if (!(crypt_stat->flags & ECRYPTFS_POLICY_APPLIED)) { 226 if (!(crypt_stat->flags & ECRYPTFS_POLICY_APPLIED)) {
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index e0f07fb6d56b..5eab400e2590 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -999,8 +999,8 @@ out:
999 return rc; 999 return rc;
1000} 1000}
1001 1001
1002int ecryptfs_getattr_link(struct vfsmount *mnt, struct dentry *dentry, 1002static int ecryptfs_getattr_link(struct vfsmount *mnt, struct dentry *dentry,
1003 struct kstat *stat) 1003 struct kstat *stat)
1004{ 1004{
1005 struct ecryptfs_mount_crypt_stat *mount_crypt_stat; 1005 struct ecryptfs_mount_crypt_stat *mount_crypt_stat;
1006 int rc = 0; 1006 int rc = 0;
@@ -1021,8 +1021,8 @@ int ecryptfs_getattr_link(struct vfsmount *mnt, struct dentry *dentry,
1021 return rc; 1021 return rc;
1022} 1022}
1023 1023
1024int ecryptfs_getattr(struct vfsmount *mnt, struct dentry *dentry, 1024static int ecryptfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
1025 struct kstat *stat) 1025 struct kstat *stat)
1026{ 1026{
1027 struct kstat lower_stat; 1027 struct kstat lower_stat;
1028 int rc; 1028 int rc;
diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c
index 2333203a120b..7d52806c2119 100644
--- a/fs/ecryptfs/keystore.c
+++ b/fs/ecryptfs/keystore.c
@@ -1150,7 +1150,7 @@ decrypt_pki_encrypted_session_key(struct ecryptfs_auth_tok *auth_tok,
1150 struct ecryptfs_message *msg = NULL; 1150 struct ecryptfs_message *msg = NULL;
1151 char *auth_tok_sig; 1151 char *auth_tok_sig;
1152 char *payload; 1152 char *payload;
1153 size_t payload_len; 1153 size_t payload_len = 0;
1154 int rc; 1154 int rc;
1155 1155
1156 rc = ecryptfs_get_auth_tok_sig(&auth_tok_sig, auth_tok); 1156 rc = ecryptfs_get_auth_tok_sig(&auth_tok_sig, auth_tok);
@@ -1168,7 +1168,7 @@ decrypt_pki_encrypted_session_key(struct ecryptfs_auth_tok *auth_tok,
1168 rc = ecryptfs_send_message(payload, payload_len, &msg_ctx); 1168 rc = ecryptfs_send_message(payload, payload_len, &msg_ctx);
1169 if (rc) { 1169 if (rc) {
1170 ecryptfs_printk(KERN_ERR, "Error sending message to " 1170 ecryptfs_printk(KERN_ERR, "Error sending message to "
1171 "ecryptfsd\n"); 1171 "ecryptfsd: %d\n", rc);
1172 goto out; 1172 goto out;
1173 } 1173 }
1174 rc = ecryptfs_wait_for_response(msg_ctx, &msg); 1174 rc = ecryptfs_wait_for_response(msg_ctx, &msg);
@@ -1202,8 +1202,7 @@ decrypt_pki_encrypted_session_key(struct ecryptfs_auth_tok *auth_tok,
1202 crypt_stat->key_size); 1202 crypt_stat->key_size);
1203 } 1203 }
1204out: 1204out:
1205 if (msg) 1205 kfree(msg);
1206 kfree(msg);
1207 return rc; 1206 return rc;
1208} 1207}
1209 1208
@@ -1989,7 +1988,7 @@ pki_encrypt_session_key(struct key *auth_tok_key,
1989 rc = ecryptfs_send_message(payload, payload_len, &msg_ctx); 1988 rc = ecryptfs_send_message(payload, payload_len, &msg_ctx);
1990 if (rc) { 1989 if (rc) {
1991 ecryptfs_printk(KERN_ERR, "Error sending message to " 1990 ecryptfs_printk(KERN_ERR, "Error sending message to "
1992 "ecryptfsd\n"); 1991 "ecryptfsd: %d\n", rc);
1993 goto out; 1992 goto out;
1994 } 1993 }
1995 rc = ecryptfs_wait_for_response(msg_ctx, &msg); 1994 rc = ecryptfs_wait_for_response(msg_ctx, &msg);
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index 4e0886c9e5c4..e924cf45aad9 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -629,6 +629,7 @@ static struct file_system_type ecryptfs_fs_type = {
629 .kill_sb = ecryptfs_kill_block_super, 629 .kill_sb = ecryptfs_kill_block_super,
630 .fs_flags = 0 630 .fs_flags = 0
631}; 631};
632MODULE_ALIAS_FS("ecryptfs");
632 633
633/** 634/**
634 * inode_info_init_once 635 * inode_info_init_once
diff --git a/fs/ecryptfs/messaging.c b/fs/ecryptfs/messaging.c
index 8d7a577ae497..49ff8ea08f1c 100644
--- a/fs/ecryptfs/messaging.c
+++ b/fs/ecryptfs/messaging.c
@@ -97,8 +97,7 @@ static void ecryptfs_msg_ctx_free_to_alloc(struct ecryptfs_msg_ctx *msg_ctx)
97void ecryptfs_msg_ctx_alloc_to_free(struct ecryptfs_msg_ctx *msg_ctx) 97void ecryptfs_msg_ctx_alloc_to_free(struct ecryptfs_msg_ctx *msg_ctx)
98{ 98{
99 list_move(&(msg_ctx->node), &ecryptfs_msg_ctx_free_list); 99 list_move(&(msg_ctx->node), &ecryptfs_msg_ctx_free_list);
100 if (msg_ctx->msg) 100 kfree(msg_ctx->msg);
101 kfree(msg_ctx->msg);
102 msg_ctx->msg = NULL; 101 msg_ctx->msg = NULL;
103 msg_ctx->state = ECRYPTFS_MSG_CTX_STATE_FREE; 102 msg_ctx->state = ECRYPTFS_MSG_CTX_STATE_FREE;
104} 103}
@@ -283,7 +282,7 @@ ecryptfs_send_message_locked(char *data, int data_len, u8 msg_type,
283 int rc; 282 int rc;
284 283
285 rc = ecryptfs_find_daemon_by_euid(&daemon); 284 rc = ecryptfs_find_daemon_by_euid(&daemon);
286 if (rc || !daemon) { 285 if (rc) {
287 rc = -ENOTCONN; 286 rc = -ENOTCONN;
288 goto out; 287 goto out;
289 } 288 }
diff --git a/fs/efs/super.c b/fs/efs/super.c
index 2002431ef9a0..c6f57a74a559 100644
--- a/fs/efs/super.c
+++ b/fs/efs/super.c
@@ -33,6 +33,7 @@ static struct file_system_type efs_fs_type = {
33 .kill_sb = kill_block_super, 33 .kill_sb = kill_block_super,
34 .fs_flags = FS_REQUIRES_DEV, 34 .fs_flags = FS_REQUIRES_DEV,
35}; 35};
36MODULE_ALIAS_FS("efs");
36 37
37static struct pt_types sgi_pt_types[] = { 38static struct pt_types sgi_pt_types[] = {
38 {0x00, "SGI vh"}, 39 {0x00, "SGI vh"},
diff --git a/fs/exofs/super.c b/fs/exofs/super.c
index 5e59280d42d7..9d9763328734 100644
--- a/fs/exofs/super.c
+++ b/fs/exofs/super.c
@@ -1010,6 +1010,7 @@ static struct file_system_type exofs_type = {
1010 .mount = exofs_mount, 1010 .mount = exofs_mount,
1011 .kill_sb = generic_shutdown_super, 1011 .kill_sb = generic_shutdown_super,
1012}; 1012};
1013MODULE_ALIAS_FS("exofs");
1013 1014
1014static int __init init_exofs(void) 1015static int __init init_exofs(void)
1015{ 1016{
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 7f68c8114026..288534920fe5 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -1536,6 +1536,7 @@ static struct file_system_type ext2_fs_type = {
1536 .kill_sb = kill_block_super, 1536 .kill_sb = kill_block_super,
1537 .fs_flags = FS_REQUIRES_DEV, 1537 .fs_flags = FS_REQUIRES_DEV,
1538}; 1538};
1539MODULE_ALIAS_FS("ext2");
1539 1540
1540static int __init init_ext2_fs(void) 1541static int __init init_ext2_fs(void)
1541{ 1542{
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 5546ca225ffe..1d6e2ed85322 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -3068,6 +3068,7 @@ static struct file_system_type ext3_fs_type = {
3068 .kill_sb = kill_block_super, 3068 .kill_sb = kill_block_super,
3069 .fs_flags = FS_REQUIRES_DEV, 3069 .fs_flags = FS_REQUIRES_DEV,
3070}; 3070};
3071MODULE_ALIAS_FS("ext3");
3071 3072
3072static int __init init_ext3_fs(void) 3073static int __init init_ext3_fs(void)
3073{ 3074{
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 5e6c87836193..34e855219231 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -90,6 +90,7 @@ static struct file_system_type ext2_fs_type = {
90 .kill_sb = kill_block_super, 90 .kill_sb = kill_block_super,
91 .fs_flags = FS_REQUIRES_DEV, 91 .fs_flags = FS_REQUIRES_DEV,
92}; 92};
93MODULE_ALIAS_FS("ext2");
93#define IS_EXT2_SB(sb) ((sb)->s_bdev->bd_holder == &ext2_fs_type) 94#define IS_EXT2_SB(sb) ((sb)->s_bdev->bd_holder == &ext2_fs_type)
94#else 95#else
95#define IS_EXT2_SB(sb) (0) 96#define IS_EXT2_SB(sb) (0)
@@ -104,6 +105,7 @@ static struct file_system_type ext3_fs_type = {
104 .kill_sb = kill_block_super, 105 .kill_sb = kill_block_super,
105 .fs_flags = FS_REQUIRES_DEV, 106 .fs_flags = FS_REQUIRES_DEV,
106}; 107};
108MODULE_ALIAS_FS("ext3");
107#define IS_EXT3_SB(sb) ((sb)->s_bdev->bd_holder == &ext3_fs_type) 109#define IS_EXT3_SB(sb) ((sb)->s_bdev->bd_holder == &ext3_fs_type)
108#else 110#else
109#define IS_EXT3_SB(sb) (0) 111#define IS_EXT3_SB(sb) (0)
@@ -5152,7 +5154,6 @@ static inline int ext2_feature_set_ok(struct super_block *sb)
5152 return 0; 5154 return 0;
5153 return 1; 5155 return 1;
5154} 5156}
5155MODULE_ALIAS("ext2");
5156#else 5157#else
5157static inline void register_as_ext2(void) { } 5158static inline void register_as_ext2(void) { }
5158static inline void unregister_as_ext2(void) { } 5159static inline void unregister_as_ext2(void) { }
@@ -5185,7 +5186,6 @@ static inline int ext3_feature_set_ok(struct super_block *sb)
5185 return 0; 5186 return 0;
5186 return 1; 5187 return 1;
5187} 5188}
5188MODULE_ALIAS("ext3");
5189#else 5189#else
5190static inline void register_as_ext3(void) { } 5190static inline void register_as_ext3(void) { }
5191static inline void unregister_as_ext3(void) { } 5191static inline void unregister_as_ext3(void) { }
@@ -5199,6 +5199,7 @@ static struct file_system_type ext4_fs_type = {
5199 .kill_sb = kill_block_super, 5199 .kill_sb = kill_block_super,
5200 .fs_flags = FS_REQUIRES_DEV, 5200 .fs_flags = FS_REQUIRES_DEV,
5201}; 5201};
5202MODULE_ALIAS_FS("ext4");
5202 5203
5203static int __init ext4_init_feat_adverts(void) 5204static int __init ext4_init_feat_adverts(void)
5204{ 5205{
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 8c117649a035..fea6e582a2ed 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -687,6 +687,7 @@ static struct file_system_type f2fs_fs_type = {
687 .kill_sb = kill_block_super, 687 .kill_sb = kill_block_super,
688 .fs_flags = FS_REQUIRES_DEV, 688 .fs_flags = FS_REQUIRES_DEV,
689}; 689};
690MODULE_ALIAS_FS("f2fs");
690 691
691static int __init init_inodecache(void) 692static int __init init_inodecache(void)
692{ 693{
diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c
index e2cfda94a28d..081b759cff83 100644
--- a/fs/fat/namei_msdos.c
+++ b/fs/fat/namei_msdos.c
@@ -668,6 +668,7 @@ static struct file_system_type msdos_fs_type = {
668 .kill_sb = kill_block_super, 668 .kill_sb = kill_block_super,
669 .fs_flags = FS_REQUIRES_DEV, 669 .fs_flags = FS_REQUIRES_DEV,
670}; 670};
671MODULE_ALIAS_FS("msdos");
671 672
672static int __init init_msdos_fs(void) 673static int __init init_msdos_fs(void)
673{ 674{
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c
index ac959d655e7d..2da952036a3d 100644
--- a/fs/fat/namei_vfat.c
+++ b/fs/fat/namei_vfat.c
@@ -1073,6 +1073,7 @@ static struct file_system_type vfat_fs_type = {
1073 .kill_sb = kill_block_super, 1073 .kill_sb = kill_block_super,
1074 .fs_flags = FS_REQUIRES_DEV, 1074 .fs_flags = FS_REQUIRES_DEV,
1075}; 1075};
1076MODULE_ALIAS_FS("vfat");
1076 1077
1077static int __init init_vfat_fs(void) 1078static int __init init_vfat_fs(void)
1078{ 1079{
diff --git a/fs/filesystems.c b/fs/filesystems.c
index da165f6adcbf..92567d95ba6a 100644
--- a/fs/filesystems.c
+++ b/fs/filesystems.c
@@ -273,7 +273,7 @@ struct file_system_type *get_fs_type(const char *name)
273 int len = dot ? dot - name : strlen(name); 273 int len = dot ? dot - name : strlen(name);
274 274
275 fs = __get_fs_type(name, len); 275 fs = __get_fs_type(name, len);
276 if (!fs && (request_module("%.*s", len, name) == 0)) 276 if (!fs && (request_module("fs-%.*s", len, name) == 0))
277 fs = __get_fs_type(name, len); 277 fs = __get_fs_type(name, len);
278 278
279 if (dot && fs && !(fs->fs_flags & FS_HAS_SUBTYPE)) { 279 if (dot && fs && !(fs->fs_flags & FS_HAS_SUBTYPE)) {
diff --git a/fs/freevxfs/vxfs_super.c b/fs/freevxfs/vxfs_super.c
index fed2c8afb3a9..455074308069 100644
--- a/fs/freevxfs/vxfs_super.c
+++ b/fs/freevxfs/vxfs_super.c
@@ -52,7 +52,6 @@ MODULE_AUTHOR("Christoph Hellwig");
52MODULE_DESCRIPTION("Veritas Filesystem (VxFS) driver"); 52MODULE_DESCRIPTION("Veritas Filesystem (VxFS) driver");
53MODULE_LICENSE("Dual BSD/GPL"); 53MODULE_LICENSE("Dual BSD/GPL");
54 54
55MODULE_ALIAS("vxfs"); /* makes mount -t vxfs autoload the module */
56 55
57 56
58static void vxfs_put_super(struct super_block *); 57static void vxfs_put_super(struct super_block *);
@@ -258,6 +257,7 @@ static struct file_system_type vxfs_fs_type = {
258 .kill_sb = kill_block_super, 257 .kill_sb = kill_block_super,
259 .fs_flags = FS_REQUIRES_DEV, 258 .fs_flags = FS_REQUIRES_DEV,
260}; 259};
260MODULE_ALIAS_FS("vxfs"); /* makes mount -t vxfs autoload the module */
261 261
262static int __init 262static int __init
263vxfs_init(void) 263vxfs_init(void)
diff --git a/fs/fuse/control.c b/fs/fuse/control.c
index b7978b9f75ef..a0b0855d00a9 100644
--- a/fs/fuse/control.c
+++ b/fs/fuse/control.c
@@ -341,6 +341,7 @@ static struct file_system_type fuse_ctl_fs_type = {
341 .mount = fuse_ctl_mount, 341 .mount = fuse_ctl_mount,
342 .kill_sb = fuse_ctl_kill_sb, 342 .kill_sb = fuse_ctl_kill_sb,
343}; 343};
344MODULE_ALIAS_FS("fusectl");
344 345
345int __init fuse_ctl_init(void) 346int __init fuse_ctl_init(void)
346{ 347{
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index df00993ed108..137185c3884f 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -1117,6 +1117,7 @@ static struct file_system_type fuse_fs_type = {
1117 .mount = fuse_mount, 1117 .mount = fuse_mount,
1118 .kill_sb = fuse_kill_sb_anon, 1118 .kill_sb = fuse_kill_sb_anon,
1119}; 1119};
1120MODULE_ALIAS_FS("fuse");
1120 1121
1121#ifdef CONFIG_BLOCK 1122#ifdef CONFIG_BLOCK
1122static struct dentry *fuse_mount_blk(struct file_system_type *fs_type, 1123static struct dentry *fuse_mount_blk(struct file_system_type *fs_type,
@@ -1146,6 +1147,7 @@ static struct file_system_type fuseblk_fs_type = {
1146 .kill_sb = fuse_kill_sb_blk, 1147 .kill_sb = fuse_kill_sb_blk,
1147 .fs_flags = FS_REQUIRES_DEV | FS_HAS_SUBTYPE, 1148 .fs_flags = FS_REQUIRES_DEV | FS_HAS_SUBTYPE,
1148}; 1149};
1150MODULE_ALIAS_FS("fuseblk");
1149 1151
1150static inline int register_fuseblk(void) 1152static inline int register_fuseblk(void)
1151{ 1153{
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index 1b612be4b873..60ede2a0f43f 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -20,6 +20,7 @@
20#include <linux/gfs2_ondisk.h> 20#include <linux/gfs2_ondisk.h>
21#include <linux/quotaops.h> 21#include <linux/quotaops.h>
22#include <linux/lockdep.h> 22#include <linux/lockdep.h>
23#include <linux/module.h>
23 24
24#include "gfs2.h" 25#include "gfs2.h"
25#include "incore.h" 26#include "incore.h"
@@ -1425,6 +1426,7 @@ struct file_system_type gfs2_fs_type = {
1425 .kill_sb = gfs2_kill_sb, 1426 .kill_sb = gfs2_kill_sb,
1426 .owner = THIS_MODULE, 1427 .owner = THIS_MODULE,
1427}; 1428};
1429MODULE_ALIAS_FS("gfs2");
1428 1430
1429struct file_system_type gfs2meta_fs_type = { 1431struct file_system_type gfs2meta_fs_type = {
1430 .name = "gfs2meta", 1432 .name = "gfs2meta",
@@ -1432,4 +1434,4 @@ struct file_system_type gfs2meta_fs_type = {
1432 .mount = gfs2_mount_meta, 1434 .mount = gfs2_mount_meta,
1433 .owner = THIS_MODULE, 1435 .owner = THIS_MODULE,
1434}; 1436};
1435 1437MODULE_ALIAS_FS("gfs2meta");
diff --git a/fs/hfs/super.c b/fs/hfs/super.c
index e93ddaadfd1e..bbaaa8a4ee64 100644
--- a/fs/hfs/super.c
+++ b/fs/hfs/super.c
@@ -466,6 +466,7 @@ static struct file_system_type hfs_fs_type = {
466 .kill_sb = kill_block_super, 466 .kill_sb = kill_block_super,
467 .fs_flags = FS_REQUIRES_DEV, 467 .fs_flags = FS_REQUIRES_DEV,
468}; 468};
469MODULE_ALIAS_FS("hfs");
469 470
470static void hfs_init_once(void *p) 471static void hfs_init_once(void *p)
471{ 472{
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index 974c26f96fae..7b87284e46dc 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -654,6 +654,7 @@ static struct file_system_type hfsplus_fs_type = {
654 .kill_sb = kill_block_super, 654 .kill_sb = kill_block_super,
655 .fs_flags = FS_REQUIRES_DEV, 655 .fs_flags = FS_REQUIRES_DEV,
656}; 656};
657MODULE_ALIAS_FS("hfsplus");
657 658
658static void hfsplus_init_once(void *p) 659static void hfsplus_init_once(void *p)
659{ 660{
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index fbabb906066f..178b90c229b5 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -845,15 +845,8 @@ int hostfs_setattr(struct dentry *dentry, struct iattr *attr)
845 return err; 845 return err;
846 846
847 if ((attr->ia_valid & ATTR_SIZE) && 847 if ((attr->ia_valid & ATTR_SIZE) &&
848 attr->ia_size != i_size_read(inode)) { 848 attr->ia_size != i_size_read(inode))
849 int error;
850
851 error = inode_newsize_ok(inode, attr->ia_size);
852 if (error)
853 return error;
854
855 truncate_setsize(inode, attr->ia_size); 849 truncate_setsize(inode, attr->ia_size);
856 }
857 850
858 setattr_copy(inode, attr); 851 setattr_copy(inode, attr);
859 mark_inode_dirty(inode); 852 mark_inode_dirty(inode);
diff --git a/fs/hppfs/hppfs.c b/fs/hppfs/hppfs.c
index 74f55703be49..126d3c2e2dee 100644
--- a/fs/hppfs/hppfs.c
+++ b/fs/hppfs/hppfs.c
@@ -748,6 +748,7 @@ static struct file_system_type hppfs_type = {
748 .kill_sb = kill_anon_super, 748 .kill_sb = kill_anon_super,
749 .fs_flags = 0, 749 .fs_flags = 0,
750}; 750};
751MODULE_ALIAS_FS("hppfs");
751 752
752static int __init init_hppfs(void) 753static int __init init_hppfs(void)
753{ 754{
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 7f94e0cbc69c..84e3d856e91d 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -896,6 +896,7 @@ static struct file_system_type hugetlbfs_fs_type = {
896 .mount = hugetlbfs_mount, 896 .mount = hugetlbfs_mount,
897 .kill_sb = kill_litter_super, 897 .kill_sb = kill_litter_super,
898}; 898};
899MODULE_ALIAS_FS("hugetlbfs");
899 900
900static struct vfsmount *hugetlbfs_vfsmount[HUGE_MAX_HSTATE]; 901static struct vfsmount *hugetlbfs_vfsmount[HUGE_MAX_HSTATE];
901 902
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 67ce52507d7d..a67f16e846a2 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -1556,6 +1556,7 @@ static struct file_system_type iso9660_fs_type = {
1556 .kill_sb = kill_block_super, 1556 .kill_sb = kill_block_super,
1557 .fs_flags = FS_REQUIRES_DEV, 1557 .fs_flags = FS_REQUIRES_DEV,
1558}; 1558};
1559MODULE_ALIAS_FS("iso9660");
1559 1560
1560static int __init init_iso9660_fs(void) 1561static int __init init_iso9660_fs(void)
1561{ 1562{
@@ -1593,5 +1594,3 @@ static void __exit exit_iso9660_fs(void)
1593module_init(init_iso9660_fs) 1594module_init(init_iso9660_fs)
1594module_exit(exit_iso9660_fs) 1595module_exit(exit_iso9660_fs)
1595MODULE_LICENSE("GPL"); 1596MODULE_LICENSE("GPL");
1596/* Actual filesystem name is iso9660, as requested in filesystems.c */
1597MODULE_ALIAS("iso9660");
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c
index d3d8799e2187..0defb1cc2a35 100644
--- a/fs/jffs2/super.c
+++ b/fs/jffs2/super.c
@@ -356,6 +356,7 @@ static struct file_system_type jffs2_fs_type = {
356 .mount = jffs2_mount, 356 .mount = jffs2_mount,
357 .kill_sb = jffs2_kill_sb, 357 .kill_sb = jffs2_kill_sb,
358}; 358};
359MODULE_ALIAS_FS("jffs2");
359 360
360static int __init init_jffs2_fs(void) 361static int __init init_jffs2_fs(void)
361{ 362{
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index 060ba638becb..2003e830ed1c 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -833,6 +833,7 @@ static struct file_system_type jfs_fs_type = {
833 .kill_sb = kill_block_super, 833 .kill_sb = kill_block_super,
834 .fs_flags = FS_REQUIRES_DEV, 834 .fs_flags = FS_REQUIRES_DEV,
835}; 835};
836MODULE_ALIAS_FS("jfs");
836 837
837static void init_once(void *foo) 838static void init_once(void *foo)
838{ 839{
diff --git a/fs/logfs/super.c b/fs/logfs/super.c
index 345c24b8a6f8..54360293bcb5 100644
--- a/fs/logfs/super.c
+++ b/fs/logfs/super.c
@@ -608,6 +608,7 @@ static struct file_system_type logfs_fs_type = {
608 .fs_flags = FS_REQUIRES_DEV, 608 .fs_flags = FS_REQUIRES_DEV,
609 609
610}; 610};
611MODULE_ALIAS_FS("logfs");
611 612
612static int __init logfs_init(void) 613static int __init logfs_init(void)
613{ 614{
diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index 99541cceb584..df122496f328 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -660,6 +660,7 @@ static struct file_system_type minix_fs_type = {
660 .kill_sb = kill_block_super, 660 .kill_sb = kill_block_super,
661 .fs_flags = FS_REQUIRES_DEV, 661 .fs_flags = FS_REQUIRES_DEV,
662}; 662};
663MODULE_ALIAS_FS("minix");
663 664
664static int __init init_minix_fs(void) 665static int __init init_minix_fs(void)
665{ 666{
diff --git a/fs/namei.c b/fs/namei.c
index 961bc1268366..57ae9c8c66bf 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -689,8 +689,6 @@ void nd_jump_link(struct nameidata *nd, struct path *path)
689 nd->path = *path; 689 nd->path = *path;
690 nd->inode = nd->path.dentry->d_inode; 690 nd->inode = nd->path.dentry->d_inode;
691 nd->flags |= LOOKUP_JUMPED; 691 nd->flags |= LOOKUP_JUMPED;
692
693 BUG_ON(nd->inode->i_op->follow_link);
694} 692}
695 693
696static inline void put_link(struct nameidata *nd, struct path *link, void *cookie) 694static inline void put_link(struct nameidata *nd, struct path *link, void *cookie)
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c
index 7dafd6899a62..26910c8154da 100644
--- a/fs/ncpfs/inode.c
+++ b/fs/ncpfs/inode.c
@@ -1051,6 +1051,7 @@ static struct file_system_type ncp_fs_type = {
1051 .kill_sb = kill_anon_super, 1051 .kill_sb = kill_anon_super,
1052 .fs_flags = FS_BINARY_MOUNTDATA, 1052 .fs_flags = FS_BINARY_MOUNTDATA,
1053}; 1053};
1054MODULE_ALIAS_FS("ncpfs");
1054 1055
1055static int __init init_ncp_fs(void) 1056static int __init init_ncp_fs(void)
1056{ 1057{
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 17b32b722457..95cdcb208dfb 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -294,6 +294,7 @@ struct file_system_type nfs_fs_type = {
294 .kill_sb = nfs_kill_super, 294 .kill_sb = nfs_kill_super,
295 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_BINARY_MOUNTDATA, 295 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_BINARY_MOUNTDATA,
296}; 296};
297MODULE_ALIAS_FS("nfs");
297EXPORT_SYMBOL_GPL(nfs_fs_type); 298EXPORT_SYMBOL_GPL(nfs_fs_type);
298 299
299struct file_system_type nfs_xdev_fs_type = { 300struct file_system_type nfs_xdev_fs_type = {
@@ -333,6 +334,7 @@ struct file_system_type nfs4_fs_type = {
333 .kill_sb = nfs_kill_super, 334 .kill_sb = nfs_kill_super,
334 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_BINARY_MOUNTDATA, 335 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_BINARY_MOUNTDATA,
335}; 336};
337MODULE_ALIAS_FS("nfs4");
336EXPORT_SYMBOL_GPL(nfs4_fs_type); 338EXPORT_SYMBOL_GPL(nfs4_fs_type);
337 339
338static int __init register_nfs4_fs(void) 340static int __init register_nfs4_fs(void)
@@ -2717,6 +2719,5 @@ module_param(send_implementation_id, ushort, 0644);
2717MODULE_PARM_DESC(send_implementation_id, 2719MODULE_PARM_DESC(send_implementation_id,
2718 "Send implementation ID with NFSv4.1 exchange_id"); 2720 "Send implementation ID with NFSv4.1 exchange_id");
2719MODULE_PARM_DESC(nfs4_unique_id, "nfs_client_id4 uniquifier string"); 2721MODULE_PARM_DESC(nfs4_unique_id, "nfs_client_id4 uniquifier string");
2720MODULE_ALIAS("nfs4");
2721 2722
2722#endif /* CONFIG_NFS_V4 */ 2723#endif /* CONFIG_NFS_V4 */
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 13a21c8fca49..f33455b4d957 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -1090,6 +1090,7 @@ static struct file_system_type nfsd_fs_type = {
1090 .mount = nfsd_mount, 1090 .mount = nfsd_mount,
1091 .kill_sb = nfsd_umount, 1091 .kill_sb = nfsd_umount,
1092}; 1092};
1093MODULE_ALIAS_FS("nfsd");
1093 1094
1094#ifdef CONFIG_PROC_FS 1095#ifdef CONFIG_PROC_FS
1095static int create_proc_exports_entry(void) 1096static int create_proc_exports_entry(void)
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
index 3c991dc84f2f..c7d1f9f18b09 100644
--- a/fs/nilfs2/super.c
+++ b/fs/nilfs2/super.c
@@ -1361,6 +1361,7 @@ struct file_system_type nilfs_fs_type = {
1361 .kill_sb = kill_block_super, 1361 .kill_sb = kill_block_super,
1362 .fs_flags = FS_REQUIRES_DEV, 1362 .fs_flags = FS_REQUIRES_DEV,
1363}; 1363};
1364MODULE_ALIAS_FS("nilfs2");
1364 1365
1365static void nilfs_inode_init_once(void *obj) 1366static void nilfs_inode_init_once(void *obj)
1366{ 1367{
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
index 4a8289f8b16c..82650d52d916 100644
--- a/fs/ntfs/super.c
+++ b/fs/ntfs/super.c
@@ -3079,6 +3079,7 @@ static struct file_system_type ntfs_fs_type = {
3079 .kill_sb = kill_block_super, 3079 .kill_sb = kill_block_super,
3080 .fs_flags = FS_REQUIRES_DEV, 3080 .fs_flags = FS_REQUIRES_DEV,
3081}; 3081};
3082MODULE_ALIAS_FS("ntfs");
3082 3083
3083/* Stable names for the slab caches. */ 3084/* Stable names for the slab caches. */
3084static const char ntfs_index_ctx_cache_name[] = "ntfs_index_ctx_cache"; 3085static const char ntfs_index_ctx_cache_name[] = "ntfs_index_ctx_cache";
diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c
index 4c5fc8d77dc2..12bafb7265ce 100644
--- a/fs/ocfs2/dlmfs/dlmfs.c
+++ b/fs/ocfs2/dlmfs/dlmfs.c
@@ -640,6 +640,7 @@ static struct file_system_type dlmfs_fs_type = {
640 .mount = dlmfs_mount, 640 .mount = dlmfs_mount,
641 .kill_sb = kill_litter_super, 641 .kill_sb = kill_litter_super,
642}; 642};
643MODULE_ALIAS_FS("ocfs2_dlmfs");
643 644
644static int __init init_dlmfs_fs(void) 645static int __init init_dlmfs_fs(void)
645{ 646{
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 9b6910dec4ba..01b85165552b 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -1266,6 +1266,7 @@ static struct file_system_type ocfs2_fs_type = {
1266 .fs_flags = FS_REQUIRES_DEV|FS_RENAME_DOES_D_MOVE, 1266 .fs_flags = FS_REQUIRES_DEV|FS_RENAME_DOES_D_MOVE,
1267 .next = NULL 1267 .next = NULL
1268}; 1268};
1269MODULE_ALIAS_FS("ocfs2");
1269 1270
1270static int ocfs2_check_set_options(struct super_block *sb, 1271static int ocfs2_check_set_options(struct super_block *sb,
1271 struct mount_options *options) 1272 struct mount_options *options)
diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c
index 25d715c7c87a..d8b0afde2179 100644
--- a/fs/omfs/inode.c
+++ b/fs/omfs/inode.c
@@ -572,6 +572,7 @@ static struct file_system_type omfs_fs_type = {
572 .kill_sb = kill_block_super, 572 .kill_sb = kill_block_super,
573 .fs_flags = FS_REQUIRES_DEV, 573 .fs_flags = FS_REQUIRES_DEV,
574}; 574};
575MODULE_ALIAS_FS("omfs");
575 576
576static int __init init_omfs_fs(void) 577static int __init init_omfs_fs(void)
577{ 578{
diff --git a/fs/openpromfs/inode.c b/fs/openpromfs/inode.c
index ae47fa7efb9d..75885ffde44e 100644
--- a/fs/openpromfs/inode.c
+++ b/fs/openpromfs/inode.c
@@ -432,6 +432,7 @@ static struct file_system_type openprom_fs_type = {
432 .mount = openprom_mount, 432 .mount = openprom_mount,
433 .kill_sb = kill_anon_super, 433 .kill_sb = kill_anon_super,
434}; 434};
435MODULE_ALIAS_FS("openpromfs");
435 436
436static void op_inode_init_once(void *data) 437static void op_inode_init_once(void *data)
437{ 438{
diff --git a/fs/proc/namespaces.c b/fs/proc/namespaces.c
index b7a47196c8c3..66b51c0383da 100644
--- a/fs/proc/namespaces.c
+++ b/fs/proc/namespaces.c
@@ -118,7 +118,7 @@ static void *proc_ns_follow_link(struct dentry *dentry, struct nameidata *nd)
118 struct super_block *sb = inode->i_sb; 118 struct super_block *sb = inode->i_sb;
119 struct proc_inode *ei = PROC_I(inode); 119 struct proc_inode *ei = PROC_I(inode);
120 struct task_struct *task; 120 struct task_struct *task;
121 struct dentry *ns_dentry; 121 struct path ns_path;
122 void *error = ERR_PTR(-EACCES); 122 void *error = ERR_PTR(-EACCES);
123 123
124 task = get_proc_task(inode); 124 task = get_proc_task(inode);
@@ -128,14 +128,14 @@ static void *proc_ns_follow_link(struct dentry *dentry, struct nameidata *nd)
128 if (!ptrace_may_access(task, PTRACE_MODE_READ)) 128 if (!ptrace_may_access(task, PTRACE_MODE_READ))
129 goto out_put_task; 129 goto out_put_task;
130 130
131 ns_dentry = proc_ns_get_dentry(sb, task, ei->ns_ops); 131 ns_path.dentry = proc_ns_get_dentry(sb, task, ei->ns_ops);
132 if (IS_ERR(ns_dentry)) { 132 if (IS_ERR(ns_path.dentry)) {
133 error = ERR_CAST(ns_dentry); 133 error = ERR_CAST(ns_path.dentry);
134 goto out_put_task; 134 goto out_put_task;
135 } 135 }
136 136
137 dput(nd->path.dentry); 137 ns_path.mnt = mntget(nd->path.mnt);
138 nd->path.dentry = ns_dentry; 138 nd_jump_link(nd, &ns_path);
139 error = NULL; 139 error = NULL;
140 140
141out_put_task: 141out_put_task:
diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c
index 43098bb5723a..2e8caa62da78 100644
--- a/fs/qnx4/inode.c
+++ b/fs/qnx4/inode.c
@@ -412,6 +412,7 @@ static struct file_system_type qnx4_fs_type = {
412 .kill_sb = kill_block_super, 412 .kill_sb = kill_block_super,
413 .fs_flags = FS_REQUIRES_DEV, 413 .fs_flags = FS_REQUIRES_DEV,
414}; 414};
415MODULE_ALIAS_FS("qnx4");
415 416
416static int __init init_qnx4_fs(void) 417static int __init init_qnx4_fs(void)
417{ 418{
diff --git a/fs/qnx6/inode.c b/fs/qnx6/inode.c
index 57199a52a351..8d941edfefa1 100644
--- a/fs/qnx6/inode.c
+++ b/fs/qnx6/inode.c
@@ -672,6 +672,7 @@ static struct file_system_type qnx6_fs_type = {
672 .kill_sb = kill_block_super, 672 .kill_sb = kill_block_super,
673 .fs_flags = FS_REQUIRES_DEV, 673 .fs_flags = FS_REQUIRES_DEV,
674}; 674};
675MODULE_ALIAS_FS("qnx6");
675 676
676static int __init init_qnx6_fs(void) 677static int __init init_qnx6_fs(void)
677{ 678{
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 418bdc3a57da..194113b1b11b 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -2434,6 +2434,7 @@ struct file_system_type reiserfs_fs_type = {
2434 .kill_sb = reiserfs_kill_sb, 2434 .kill_sb = reiserfs_kill_sb,
2435 .fs_flags = FS_REQUIRES_DEV, 2435 .fs_flags = FS_REQUIRES_DEV,
2436}; 2436};
2437MODULE_ALIAS_FS("reiserfs");
2437 2438
2438MODULE_DESCRIPTION("ReiserFS journaled filesystem"); 2439MODULE_DESCRIPTION("ReiserFS journaled filesystem");
2439MODULE_AUTHOR("Hans Reiser <reiser@namesys.com>"); 2440MODULE_AUTHOR("Hans Reiser <reiser@namesys.com>");
diff --git a/fs/romfs/super.c b/fs/romfs/super.c
index 7e8d3a80bdab..15cbc41ee365 100644
--- a/fs/romfs/super.c
+++ b/fs/romfs/super.c
@@ -599,6 +599,7 @@ static struct file_system_type romfs_fs_type = {
599 .kill_sb = romfs_kill_sb, 599 .kill_sb = romfs_kill_sb,
600 .fs_flags = FS_REQUIRES_DEV, 600 .fs_flags = FS_REQUIRES_DEV,
601}; 601};
602MODULE_ALIAS_FS("romfs");
602 603
603/* 604/*
604 * inode storage initialiser 605 * inode storage initialiser
diff --git a/fs/sysv/super.c b/fs/sysv/super.c
index a38e87bdd78d..a39938b1feea 100644
--- a/fs/sysv/super.c
+++ b/fs/sysv/super.c
@@ -545,6 +545,7 @@ static struct file_system_type sysv_fs_type = {
545 .kill_sb = kill_block_super, 545 .kill_sb = kill_block_super,
546 .fs_flags = FS_REQUIRES_DEV, 546 .fs_flags = FS_REQUIRES_DEV,
547}; 547};
548MODULE_ALIAS_FS("sysv");
548 549
549static struct file_system_type v7_fs_type = { 550static struct file_system_type v7_fs_type = {
550 .owner = THIS_MODULE, 551 .owner = THIS_MODULE,
@@ -553,6 +554,7 @@ static struct file_system_type v7_fs_type = {
553 .kill_sb = kill_block_super, 554 .kill_sb = kill_block_super,
554 .fs_flags = FS_REQUIRES_DEV, 555 .fs_flags = FS_REQUIRES_DEV,
555}; 556};
557MODULE_ALIAS_FS("v7");
556 558
557static int __init init_sysv_fs(void) 559static int __init init_sysv_fs(void)
558{ 560{
@@ -586,5 +588,4 @@ static void __exit exit_sysv_fs(void)
586 588
587module_init(init_sysv_fs) 589module_init(init_sysv_fs)
588module_exit(exit_sysv_fs) 590module_exit(exit_sysv_fs)
589MODULE_ALIAS("v7");
590MODULE_LICENSE("GPL"); 591MODULE_LICENSE("GPL");
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index ddc0f6ae65e9..ac838b844936 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -2174,6 +2174,7 @@ static struct file_system_type ubifs_fs_type = {
2174 .mount = ubifs_mount, 2174 .mount = ubifs_mount,
2175 .kill_sb = kill_ubifs_super, 2175 .kill_sb = kill_ubifs_super,
2176}; 2176};
2177MODULE_ALIAS_FS("ubifs");
2177 2178
2178/* 2179/*
2179 * Inode slab cache constructor. 2180 * Inode slab cache constructor.
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index dc8e3a861d0f..329f2f53b7ed 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -1500,6 +1500,7 @@ static struct file_system_type ufs_fs_type = {
1500 .kill_sb = kill_block_super, 1500 .kill_sb = kill_block_super,
1501 .fs_flags = FS_REQUIRES_DEV, 1501 .fs_flags = FS_REQUIRES_DEV,
1502}; 1502};
1503MODULE_ALIAS_FS("ufs");
1503 1504
1504static int __init init_ufs_fs(void) 1505static int __init init_ufs_fs(void)
1505{ 1506{
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index c407121873b4..ea341cea68cb 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1561,6 +1561,7 @@ static struct file_system_type xfs_fs_type = {
1561 .kill_sb = kill_block_super, 1561 .kill_sb = kill_block_super,
1562 .fs_flags = FS_REQUIRES_DEV, 1562 .fs_flags = FS_REQUIRES_DEV,
1563}; 1563};
1564MODULE_ALIAS_FS("xfs");
1564 1565
1565STATIC int __init 1566STATIC int __init
1566xfs_init_zones(void) 1567xfs_init_zones(void)
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index e65278f560c4..22ba56e834e2 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -437,11 +437,9 @@ void acpi_remove_dir(struct acpi_device *);
437 */ 437 */
438struct acpi_bus_type { 438struct acpi_bus_type {
439 struct list_head list; 439 struct list_head list;
440 struct bus_type *bus; 440 const char *name;
441 /* For general devices under the bus */ 441 bool (*match)(struct device *dev);
442 int (*find_device) (struct device *, acpi_handle *); 442 int (*find_device) (struct device *, acpi_handle *);
443 /* For bridges, such as PCI root bridge, IDE controller */
444 int (*find_bridge) (struct device *, acpi_handle *);
445 void (*setup)(struct device *); 443 void (*setup)(struct device *);
446 void (*cleanup)(struct device *); 444 void (*cleanup)(struct device *);
447}; 445};
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 8839b3a24660..e3e0d651c6ca 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -443,12 +443,12 @@ struct drm_crtc {
443 * @dpms: set power state (see drm_crtc_funcs above) 443 * @dpms: set power state (see drm_crtc_funcs above)
444 * @save: save connector state 444 * @save: save connector state
445 * @restore: restore connector state 445 * @restore: restore connector state
446 * @reset: reset connector after state has been invalidate (e.g. resume) 446 * @reset: reset connector after state has been invalidated (e.g. resume)
447 * @detect: is this connector active? 447 * @detect: is this connector active?
448 * @fill_modes: fill mode list for this connector 448 * @fill_modes: fill mode list for this connector
449 * @set_property: property for this connector may need update 449 * @set_property: property for this connector may need an update
450 * @destroy: make object go away 450 * @destroy: make object go away
451 * @force: notify the driver the connector is forced on 451 * @force: notify the driver that the connector is forced on
452 * 452 *
453 * Each CRTC may have one or more connectors attached to it. The functions 453 * Each CRTC may have one or more connectors attached to it. The functions
454 * below allow the core DRM code to control connectors, enumerate available modes, 454 * below allow the core DRM code to control connectors, enumerate available modes,
diff --git a/include/linux/ecryptfs.h b/include/linux/ecryptfs.h
index 2224a8c0cb64..8d5ab998a222 100644
--- a/include/linux/ecryptfs.h
+++ b/include/linux/ecryptfs.h
@@ -6,9 +6,8 @@
6#define ECRYPTFS_VERSION_MINOR 0x04 6#define ECRYPTFS_VERSION_MINOR 0x04
7#define ECRYPTFS_SUPPORTED_FILE_VERSION 0x03 7#define ECRYPTFS_SUPPORTED_FILE_VERSION 0x03
8/* These flags indicate which features are supported by the kernel 8/* These flags indicate which features are supported by the kernel
9 * module; userspace tools such as the mount helper read 9 * module; userspace tools such as the mount helper read the feature
10 * ECRYPTFS_VERSIONING_MASK from a sysfs handle in order to determine 10 * bits from a sysfs handle in order to determine how to behave. */
11 * how to behave. */
12#define ECRYPTFS_VERSIONING_PASSPHRASE 0x00000001 11#define ECRYPTFS_VERSIONING_PASSPHRASE 0x00000001
13#define ECRYPTFS_VERSIONING_PUBKEY 0x00000002 12#define ECRYPTFS_VERSIONING_PUBKEY 0x00000002
14#define ECRYPTFS_VERSIONING_PLAINTEXT_PASSTHROUGH 0x00000004 13#define ECRYPTFS_VERSIONING_PLAINTEXT_PASSTHROUGH 0x00000004
@@ -19,13 +18,6 @@
19#define ECRYPTFS_VERSIONING_HMAC 0x00000080 18#define ECRYPTFS_VERSIONING_HMAC 0x00000080
20#define ECRYPTFS_VERSIONING_FILENAME_ENCRYPTION 0x00000100 19#define ECRYPTFS_VERSIONING_FILENAME_ENCRYPTION 0x00000100
21#define ECRYPTFS_VERSIONING_GCM 0x00000200 20#define ECRYPTFS_VERSIONING_GCM 0x00000200
22#define ECRYPTFS_VERSIONING_MASK (ECRYPTFS_VERSIONING_PASSPHRASE \
23 | ECRYPTFS_VERSIONING_PLAINTEXT_PASSTHROUGH \
24 | ECRYPTFS_VERSIONING_PUBKEY \
25 | ECRYPTFS_VERSIONING_XATTR \
26 | ECRYPTFS_VERSIONING_MULTKEY \
27 | ECRYPTFS_VERSIONING_DEVMISC \
28 | ECRYPTFS_VERSIONING_FILENAME_ENCRYPTION)
29#define ECRYPTFS_MAX_PASSWORD_LENGTH 64 21#define ECRYPTFS_MAX_PASSWORD_LENGTH 64
30#define ECRYPTFS_MAX_PASSPHRASE_BYTES ECRYPTFS_MAX_PASSWORD_LENGTH 22#define ECRYPTFS_MAX_PASSPHRASE_BYTES ECRYPTFS_MAX_PASSWORD_LENGTH
31#define ECRYPTFS_SALT_SIZE 8 23#define ECRYPTFS_SALT_SIZE 8
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 74a907b8b950..2c28271ab9d4 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1825,6 +1825,8 @@ struct file_system_type {
1825 struct lock_class_key i_mutex_dir_key; 1825 struct lock_class_key i_mutex_dir_key;
1826}; 1826};
1827 1827
1828#define MODULE_ALIAS_FS(NAME) MODULE_ALIAS("fs-" NAME)
1829
1828extern struct dentry *mount_ns(struct file_system_type *fs_type, int flags, 1830extern struct dentry *mount_ns(struct file_system_type *fs_type, int flags,
1829 void *data, int (*fill_super)(struct super_block *, void *, int)); 1831 void *data, int (*fill_super)(struct super_block *, void *, int));
1830extern struct dentry *mount_bdev(struct file_system_type *fs_type, 1832extern struct dentry *mount_bdev(struct file_system_type *fs_type,
diff --git a/include/linux/i2c/atmel_mxt_ts.h b/include/linux/i2c/atmel_mxt_ts.h
index f027f7a63511..99e379b74398 100644
--- a/include/linux/i2c/atmel_mxt_ts.h
+++ b/include/linux/i2c/atmel_mxt_ts.h
@@ -15,6 +15,9 @@
15 15
16#include <linux/types.h> 16#include <linux/types.h>
17 17
18/* For key_map array */
19#define MXT_NUM_GPIO 4
20
18/* Orient */ 21/* Orient */
19#define MXT_NORMAL 0x0 22#define MXT_NORMAL 0x0
20#define MXT_DIAGONAL 0x1 23#define MXT_DIAGONAL 0x1
@@ -39,6 +42,8 @@ struct mxt_platform_data {
39 unsigned int voltage; 42 unsigned int voltage;
40 unsigned char orient; 43 unsigned char orient;
41 unsigned long irqflags; 44 unsigned long irqflags;
45 bool is_tp;
46 const unsigned int key_map[MXT_NUM_GPIO];
42}; 47};
43 48
44#endif /* __LINUX_ATMEL_MXT_TS_H */ 49#endif /* __LINUX_ATMEL_MXT_TS_H */
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 23070fd83872..7df93f52db08 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -199,6 +199,8 @@ enum regulator_type {
199 * output when using regulator_set_voltage_sel_regmap 199 * output when using regulator_set_voltage_sel_regmap
200 * @enable_reg: Register for control when using regmap enable/disable ops 200 * @enable_reg: Register for control when using regmap enable/disable ops
201 * @enable_mask: Mask for control when using regmap enable/disable ops 201 * @enable_mask: Mask for control when using regmap enable/disable ops
202 * @bypass_reg: Register for control when using regmap set_bypass
203 * @bypass_mask: Mask for control when using regmap set_bypass
202 * 204 *
203 * @enable_time: Time taken for initial enable of regulator (in uS). 205 * @enable_time: Time taken for initial enable of regulator (in uS).
204 */ 206 */
diff --git a/ipc/msg.c b/ipc/msg.c
index 950572f9d796..31cd1bf6af27 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -820,15 +820,17 @@ long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp,
820 struct msg_msg *copy = NULL; 820 struct msg_msg *copy = NULL;
821 unsigned long copy_number = 0; 821 unsigned long copy_number = 0;
822 822
823 ns = current->nsproxy->ipc_ns;
824
823 if (msqid < 0 || (long) bufsz < 0) 825 if (msqid < 0 || (long) bufsz < 0)
824 return -EINVAL; 826 return -EINVAL;
825 if (msgflg & MSG_COPY) { 827 if (msgflg & MSG_COPY) {
826 copy = prepare_copy(buf, bufsz, msgflg, &msgtyp, &copy_number); 828 copy = prepare_copy(buf, min_t(size_t, bufsz, ns->msg_ctlmax),
829 msgflg, &msgtyp, &copy_number);
827 if (IS_ERR(copy)) 830 if (IS_ERR(copy))
828 return PTR_ERR(copy); 831 return PTR_ERR(copy);
829 } 832 }
830 mode = convert_mode(&msgtyp, msgflg); 833 mode = convert_mode(&msgtyp, msgflg);
831 ns = current->nsproxy->ipc_ns;
832 834
833 msq = msg_lock_check(ns, msqid); 835 msq = msg_lock_check(ns, msqid);
834 if (IS_ERR(msq)) { 836 if (IS_ERR(msq)) {
diff --git a/ipc/msgutil.c b/ipc/msgutil.c
index ebfcbfa8b7f2..5df8e4bf1db0 100644
--- a/ipc/msgutil.c
+++ b/ipc/msgutil.c
@@ -117,9 +117,6 @@ struct msg_msg *copy_msg(struct msg_msg *src, struct msg_msg *dst)
117 if (alen > DATALEN_MSG) 117 if (alen > DATALEN_MSG)
118 alen = DATALEN_MSG; 118 alen = DATALEN_MSG;
119 119
120 dst->next = NULL;
121 dst->security = NULL;
122
123 memcpy(dst + 1, src + 1, alen); 120 memcpy(dst + 1, src + 1, alen);
124 121
125 len -= alen; 122 len -= alen;
diff --git a/kernel/smpboot.c b/kernel/smpboot.c
index 25d3d8b6e4e1..8eaed9aa9cf0 100644
--- a/kernel/smpboot.c
+++ b/kernel/smpboot.c
@@ -131,7 +131,7 @@ static int smpboot_thread_fn(void *data)
131 continue; 131 continue;
132 } 132 }
133 133
134 //BUG_ON(td->cpu != smp_processor_id()); 134 BUG_ON(td->cpu != smp_processor_id());
135 135
136 /* Check for state change setup */ 136 /* Check for state change setup */
137 switch (td->status) { 137 switch (td->status) {
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index 192473b22799..fc382d6e2765 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -414,24 +414,28 @@ config PROBE_EVENTS
414 def_bool n 414 def_bool n
415 415
416config DYNAMIC_FTRACE 416config DYNAMIC_FTRACE
417 bool "enable/disable ftrace tracepoints dynamically" 417 bool "enable/disable function tracing dynamically"
418 depends on FUNCTION_TRACER 418 depends on FUNCTION_TRACER
419 depends on HAVE_DYNAMIC_FTRACE 419 depends on HAVE_DYNAMIC_FTRACE
420 default y 420 default y
421 help 421 help
422 This option will modify all the calls to ftrace dynamically 422 This option will modify all the calls to function tracing
423 (will patch them out of the binary image and replace them 423 dynamically (will patch them out of the binary image and
424 with a No-Op instruction) as they are called. A table is 424 replace them with a No-Op instruction) on boot up. During
425 created to dynamically enable them again. 425 compile time, a table is made of all the locations that ftrace
426 can function trace, and this table is linked into the kernel
427 image. When this is enabled, functions can be individually
428 enabled, and the functions not enabled will not affect
429 performance of the system.
430
431 See the files in /sys/kernel/debug/tracing:
432 available_filter_functions
433 set_ftrace_filter
434 set_ftrace_notrace
426 435
427 This way a CONFIG_FUNCTION_TRACER kernel is slightly larger, but 436 This way a CONFIG_FUNCTION_TRACER kernel is slightly larger, but
428 otherwise has native performance as long as no tracing is active. 437 otherwise has native performance as long as no tracing is active.
429 438
430 The changes to the code are done by a kernel thread that
431 wakes up once a second and checks to see if any ftrace calls
432 were made. If so, it runs stop_machine (stops all CPUS)
433 and modifies the code to jump over the call to ftrace.
434
435config DYNAMIC_FTRACE_WITH_REGS 439config DYNAMIC_FTRACE_WITH_REGS
436 def_bool y 440 def_bool y
437 depends on DYNAMIC_FTRACE 441 depends on DYNAMIC_FTRACE
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index c2e2c2310374..1f835a83cb2c 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2400,6 +2400,27 @@ static void test_ftrace_alive(struct seq_file *m)
2400 seq_printf(m, "# MAY BE MISSING FUNCTION EVENTS\n"); 2400 seq_printf(m, "# MAY BE MISSING FUNCTION EVENTS\n");
2401} 2401}
2402 2402
2403#ifdef CONFIG_TRACER_MAX_TRACE
2404static void print_snapshot_help(struct seq_file *m, struct trace_iterator *iter)
2405{
2406 if (iter->trace->allocated_snapshot)
2407 seq_printf(m, "#\n# * Snapshot is allocated *\n#\n");
2408 else
2409 seq_printf(m, "#\n# * Snapshot is freed *\n#\n");
2410
2411 seq_printf(m, "# Snapshot commands:\n");
2412 seq_printf(m, "# echo 0 > snapshot : Clears and frees snapshot buffer\n");
2413 seq_printf(m, "# echo 1 > snapshot : Allocates snapshot buffer, if not already allocated.\n");
2414 seq_printf(m, "# Takes a snapshot of the main buffer.\n");
2415 seq_printf(m, "# echo 2 > snapshot : Clears snapshot buffer (but does not allocate)\n");
2416 seq_printf(m, "# (Doesn't have to be '2' works with any number that\n");
2417 seq_printf(m, "# is not a '0' or '1')\n");
2418}
2419#else
2420/* Should never be called */
2421static inline void print_snapshot_help(struct seq_file *m, struct trace_iterator *iter) { }
2422#endif
2423
2403static int s_show(struct seq_file *m, void *v) 2424static int s_show(struct seq_file *m, void *v)
2404{ 2425{
2405 struct trace_iterator *iter = v; 2426 struct trace_iterator *iter = v;
@@ -2411,7 +2432,9 @@ static int s_show(struct seq_file *m, void *v)
2411 seq_puts(m, "#\n"); 2432 seq_puts(m, "#\n");
2412 test_ftrace_alive(m); 2433 test_ftrace_alive(m);
2413 } 2434 }
2414 if (iter->trace && iter->trace->print_header) 2435 if (iter->snapshot && trace_empty(iter))
2436 print_snapshot_help(m, iter);
2437 else if (iter->trace && iter->trace->print_header)
2415 iter->trace->print_header(m); 2438 iter->trace->print_header(m);
2416 else 2439 else
2417 trace_default_header(m); 2440 trace_default_header(m);
@@ -4144,8 +4167,6 @@ tracing_snapshot_write(struct file *filp, const char __user *ubuf, size_t cnt,
4144 default: 4167 default:
4145 if (current_trace->allocated_snapshot) 4168 if (current_trace->allocated_snapshot)
4146 tracing_reset_online_cpus(&max_tr); 4169 tracing_reset_online_cpus(&max_tr);
4147 else
4148 ret = -EINVAL;
4149 break; 4170 break;
4150 } 4171 }
4151 4172
diff --git a/lib/idr.c b/lib/idr.c
index 73f4d53c02f3..00739aaf95a2 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -569,8 +569,7 @@ void idr_remove(struct idr *idp, int id)
569 struct idr_layer *p; 569 struct idr_layer *p;
570 struct idr_layer *to_free; 570 struct idr_layer *to_free;
571 571
572 /* see comment in idr_find_slowpath() */ 572 if (id < 0)
573 if (WARN_ON_ONCE(id < 0))
574 return; 573 return;
575 574
576 sub_remove(idp, (idp->layers - 1) * IDR_BITS, id); 575 sub_remove(idp, (idp->layers - 1) * IDR_BITS, id);
@@ -667,15 +666,7 @@ void *idr_find_slowpath(struct idr *idp, int id)
667 int n; 666 int n;
668 struct idr_layer *p; 667 struct idr_layer *p;
669 668
670 /* 669 if (id < 0)
671 * If @id is negative, idr_find() used to ignore the sign bit and
672 * performed lookup with the rest of bits, which is weird and can
673 * lead to very obscure bugs. We're now returning NULL for all
674 * negative IDs but just in case somebody was depending on the sign
675 * bit being ignored, let's trigger WARN_ON_ONCE() so that they can
676 * be detected and fixed. WARN_ON_ONCE() can later be removed.
677 */
678 if (WARN_ON_ONCE(id < 0))
679 return NULL; 670 return NULL;
680 671
681 p = rcu_dereference_raw(idp->top); 672 p = rcu_dereference_raw(idp->top);
@@ -824,8 +815,7 @@ void *idr_replace(struct idr *idp, void *ptr, int id)
824 int n; 815 int n;
825 struct idr_layer *p, *old_p; 816 struct idr_layer *p, *old_p;
826 817
827 /* see comment in idr_find_slowpath() */ 818 if (id < 0)
828 if (WARN_ON_ONCE(id < 0))
829 return ERR_PTR(-EINVAL); 819 return ERR_PTR(-EINVAL);
830 820
831 p = idp->top; 821 p = idp->top;
diff --git a/mm/ksm.c b/mm/ksm.c
index 85bfd4c16346..b6afe0c440d8 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -489,7 +489,7 @@ out: page = NULL;
489 */ 489 */
490static inline int get_kpfn_nid(unsigned long kpfn) 490static inline int get_kpfn_nid(unsigned long kpfn)
491{ 491{
492 return ksm_merge_across_nodes ? 0 : pfn_to_nid(kpfn); 492 return ksm_merge_across_nodes ? 0 : NUMA(pfn_to_nid(kpfn));
493} 493}
494 494
495static void remove_node_from_stable_tree(struct stable_node *stable_node) 495static void remove_node_from_stable_tree(struct stable_node *stable_node)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 53b8201b31eb..2b552224f5cf 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3012,6 +3012,8 @@ void memcg_update_array_size(int num)
3012 memcg_limited_groups_array_size = memcg_caches_array_size(num); 3012 memcg_limited_groups_array_size = memcg_caches_array_size(num);
3013} 3013}
3014 3014
3015static void kmem_cache_destroy_work_func(struct work_struct *w);
3016
3015int memcg_update_cache_size(struct kmem_cache *s, int num_groups) 3017int memcg_update_cache_size(struct kmem_cache *s, int num_groups)
3016{ 3018{
3017 struct memcg_cache_params *cur_params = s->memcg_params; 3019 struct memcg_cache_params *cur_params = s->memcg_params;
@@ -3031,6 +3033,8 @@ int memcg_update_cache_size(struct kmem_cache *s, int num_groups)
3031 return -ENOMEM; 3033 return -ENOMEM;
3032 } 3034 }
3033 3035
3036 INIT_WORK(&s->memcg_params->destroy,
3037 kmem_cache_destroy_work_func);
3034 s->memcg_params->is_root_cache = true; 3038 s->memcg_params->is_root_cache = true;
3035 3039
3036 /* 3040 /*
@@ -3078,6 +3082,8 @@ int memcg_register_cache(struct mem_cgroup *memcg, struct kmem_cache *s,
3078 if (!s->memcg_params) 3082 if (!s->memcg_params)
3079 return -ENOMEM; 3083 return -ENOMEM;
3080 3084
3085 INIT_WORK(&s->memcg_params->destroy,
3086 kmem_cache_destroy_work_func);
3081 if (memcg) { 3087 if (memcg) {
3082 s->memcg_params->memcg = memcg; 3088 s->memcg_params->memcg = memcg;
3083 s->memcg_params->root_cache = root_cache; 3089 s->memcg_params->root_cache = root_cache;
@@ -3358,8 +3364,6 @@ static void mem_cgroup_destroy_all_caches(struct mem_cgroup *memcg)
3358 list_for_each_entry(params, &memcg->memcg_slab_caches, list) { 3364 list_for_each_entry(params, &memcg->memcg_slab_caches, list) {
3359 cachep = memcg_params_to_cache(params); 3365 cachep = memcg_params_to_cache(params);
3360 cachep->memcg_params->dead = true; 3366 cachep->memcg_params->dead = true;
3361 INIT_WORK(&cachep->memcg_params->destroy,
3362 kmem_cache_destroy_work_func);
3363 schedule_work(&cachep->memcg_params->destroy); 3367 schedule_work(&cachep->memcg_params->destroy);
3364 } 3368 }
3365 mutex_unlock(&memcg->slab_caches_mutex); 3369 mutex_unlock(&memcg->slab_caches_mutex);
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 31d26637b658..74310017296e 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -2390,9 +2390,9 @@ restart:
2390 2390
2391 *mpol_new = *n->policy; 2391 *mpol_new = *n->policy;
2392 atomic_set(&mpol_new->refcnt, 1); 2392 atomic_set(&mpol_new->refcnt, 1);
2393 sp_node_init(n_new, n->end, end, mpol_new); 2393 sp_node_init(n_new, end, n->end, mpol_new);
2394 sp_insert(sp, n_new);
2395 n->end = start; 2394 n->end = start;
2395 sp_insert(sp, n_new);
2396 n_new = NULL; 2396 n_new = NULL;
2397 mpol_new = NULL; 2397 mpol_new = NULL;
2398 break; 2398 break;
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index 74dea377fe5b..de2e950a0a7a 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -655,7 +655,7 @@ static struct p9_trans_module p9_virtio_trans = {
655 .create = p9_virtio_create, 655 .create = p9_virtio_create,
656 .close = p9_virtio_close, 656 .close = p9_virtio_close,
657 .request = p9_virtio_request, 657 .request = p9_virtio_request,
658 //.zc_request = p9_virtio_zc_request, 658 .zc_request = p9_virtio_zc_request,
659 .cancel = p9_virtio_cancel, 659 .cancel = p9_virtio_cancel,
660 /* 660 /*
661 * We leave one entry for input and one entry for response 661 * We leave one entry for input and one entry for response
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index a0b253ecadaf..a5bb0a769eb9 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -1288,7 +1288,8 @@ static int batadv_iv_ogm_receive(struct sk_buff *skb,
1288 batadv_ogm_packet = (struct batadv_ogm_packet *)packet_buff; 1288 batadv_ogm_packet = (struct batadv_ogm_packet *)packet_buff;
1289 1289
1290 /* unpack the aggregated packets and process them one by one */ 1290 /* unpack the aggregated packets and process them one by one */
1291 do { 1291 while (batadv_iv_ogm_aggr_packet(buff_pos, packet_len,
1292 batadv_ogm_packet->tt_num_changes)) {
1292 tt_buff = packet_buff + buff_pos + BATADV_OGM_HLEN; 1293 tt_buff = packet_buff + buff_pos + BATADV_OGM_HLEN;
1293 1294
1294 batadv_iv_ogm_process(ethhdr, batadv_ogm_packet, tt_buff, 1295 batadv_iv_ogm_process(ethhdr, batadv_ogm_packet, tt_buff,
@@ -1299,8 +1300,7 @@ static int batadv_iv_ogm_receive(struct sk_buff *skb,
1299 1300
1300 packet_pos = packet_buff + buff_pos; 1301 packet_pos = packet_buff + buff_pos;
1301 batadv_ogm_packet = (struct batadv_ogm_packet *)packet_pos; 1302 batadv_ogm_packet = (struct batadv_ogm_packet *)packet_pos;
1302 } while (batadv_iv_ogm_aggr_packet(buff_pos, packet_len, 1303 }
1303 batadv_ogm_packet->tt_num_changes));
1304 1304
1305 kfree_skb(skb); 1305 kfree_skb(skb);
1306 return NET_RX_SUCCESS; 1306 return NET_RX_SUCCESS;
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index d5f1d3fd4b28..314c73ed418f 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -66,7 +66,7 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
66 goto out; 66 goto out;
67 } 67 }
68 68
69 mdst = br_mdb_get(br, skb); 69 mdst = br_mdb_get(br, skb, vid);
70 if (mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) 70 if (mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb))
71 br_multicast_deliver(mdst, skb); 71 br_multicast_deliver(mdst, skb);
72 else 72 else
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index 480330151898..828e2bcc1f52 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -97,7 +97,7 @@ int br_handle_frame_finish(struct sk_buff *skb)
97 if (is_broadcast_ether_addr(dest)) 97 if (is_broadcast_ether_addr(dest))
98 skb2 = skb; 98 skb2 = skb;
99 else if (is_multicast_ether_addr(dest)) { 99 else if (is_multicast_ether_addr(dest)) {
100 mdst = br_mdb_get(br, skb); 100 mdst = br_mdb_get(br, skb, vid);
101 if (mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) { 101 if (mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) {
102 if ((mdst && mdst->mglist) || 102 if ((mdst && mdst->mglist) ||
103 br_multicast_is_router(br)) 103 br_multicast_is_router(br))
diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c
index 9f97b850fc65..ee79f3f20383 100644
--- a/net/bridge/br_mdb.c
+++ b/net/bridge/br_mdb.c
@@ -80,6 +80,7 @@ static int br_mdb_fill_info(struct sk_buff *skb, struct netlink_callback *cb,
80 port = p->port; 80 port = p->port;
81 if (port) { 81 if (port) {
82 struct br_mdb_entry e; 82 struct br_mdb_entry e;
83 memset(&e, 0, sizeof(e));
83 e.ifindex = port->dev->ifindex; 84 e.ifindex = port->dev->ifindex;
84 e.state = p->state; 85 e.state = p->state;
85 if (p->addr.proto == htons(ETH_P_IP)) 86 if (p->addr.proto == htons(ETH_P_IP))
@@ -136,6 +137,7 @@ static int br_mdb_dump(struct sk_buff *skb, struct netlink_callback *cb)
136 break; 137 break;
137 138
138 bpm = nlmsg_data(nlh); 139 bpm = nlmsg_data(nlh);
140 memset(bpm, 0, sizeof(*bpm));
139 bpm->ifindex = dev->ifindex; 141 bpm->ifindex = dev->ifindex;
140 if (br_mdb_fill_info(skb, cb, dev) < 0) 142 if (br_mdb_fill_info(skb, cb, dev) < 0)
141 goto out; 143 goto out;
@@ -171,6 +173,7 @@ static int nlmsg_populate_mdb_fill(struct sk_buff *skb,
171 return -EMSGSIZE; 173 return -EMSGSIZE;
172 174
173 bpm = nlmsg_data(nlh); 175 bpm = nlmsg_data(nlh);
176 memset(bpm, 0, sizeof(*bpm));
174 bpm->family = AF_BRIDGE; 177 bpm->family = AF_BRIDGE;
175 bpm->ifindex = dev->ifindex; 178 bpm->ifindex = dev->ifindex;
176 nest = nla_nest_start(skb, MDBA_MDB); 179 nest = nla_nest_start(skb, MDBA_MDB);
@@ -228,6 +231,7 @@ void br_mdb_notify(struct net_device *dev, struct net_bridge_port *port,
228{ 231{
229 struct br_mdb_entry entry; 232 struct br_mdb_entry entry;
230 233
234 memset(&entry, 0, sizeof(entry));
231 entry.ifindex = port->dev->ifindex; 235 entry.ifindex = port->dev->ifindex;
232 entry.addr.proto = group->proto; 236 entry.addr.proto = group->proto;
233 entry.addr.u.ip4 = group->u.ip4; 237 entry.addr.u.ip4 = group->u.ip4;
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index 81d51b859a59..81f2389f78eb 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -132,7 +132,7 @@ static struct net_bridge_mdb_entry *br_mdb_ip6_get(
132#endif 132#endif
133 133
134struct net_bridge_mdb_entry *br_mdb_get(struct net_bridge *br, 134struct net_bridge_mdb_entry *br_mdb_get(struct net_bridge *br,
135 struct sk_buff *skb) 135 struct sk_buff *skb, u16 vid)
136{ 136{
137 struct net_bridge_mdb_htable *mdb = rcu_dereference(br->mdb); 137 struct net_bridge_mdb_htable *mdb = rcu_dereference(br->mdb);
138 struct br_ip ip; 138 struct br_ip ip;
@@ -144,6 +144,7 @@ struct net_bridge_mdb_entry *br_mdb_get(struct net_bridge *br,
144 return NULL; 144 return NULL;
145 145
146 ip.proto = skb->protocol; 146 ip.proto = skb->protocol;
147 ip.vid = vid;
147 148
148 switch (skb->protocol) { 149 switch (skb->protocol) {
149 case htons(ETH_P_IP): 150 case htons(ETH_P_IP):
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 27aa3ee517ce..db12a0fcfe50 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -29,6 +29,7 @@ static inline size_t br_port_info_size(void)
29 + nla_total_size(1) /* IFLA_BRPORT_MODE */ 29 + nla_total_size(1) /* IFLA_BRPORT_MODE */
30 + nla_total_size(1) /* IFLA_BRPORT_GUARD */ 30 + nla_total_size(1) /* IFLA_BRPORT_GUARD */
31 + nla_total_size(1) /* IFLA_BRPORT_PROTECT */ 31 + nla_total_size(1) /* IFLA_BRPORT_PROTECT */
32 + nla_total_size(1) /* IFLA_BRPORT_FAST_LEAVE */
32 + 0; 33 + 0;
33} 34}
34 35
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 6d314c4e6bcb..3cbf5beb3d4b 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -442,7 +442,7 @@ extern int br_multicast_rcv(struct net_bridge *br,
442 struct net_bridge_port *port, 442 struct net_bridge_port *port,
443 struct sk_buff *skb); 443 struct sk_buff *skb);
444extern struct net_bridge_mdb_entry *br_mdb_get(struct net_bridge *br, 444extern struct net_bridge_mdb_entry *br_mdb_get(struct net_bridge *br,
445 struct sk_buff *skb); 445 struct sk_buff *skb, u16 vid);
446extern void br_multicast_add_port(struct net_bridge_port *port); 446extern void br_multicast_add_port(struct net_bridge_port *port);
447extern void br_multicast_del_port(struct net_bridge_port *port); 447extern void br_multicast_del_port(struct net_bridge_port *port);
448extern void br_multicast_enable_port(struct net_bridge_port *port); 448extern void br_multicast_enable_port(struct net_bridge_port *port);
@@ -504,7 +504,7 @@ static inline int br_multicast_rcv(struct net_bridge *br,
504} 504}
505 505
506static inline struct net_bridge_mdb_entry *br_mdb_get(struct net_bridge *br, 506static inline struct net_bridge_mdb_entry *br_mdb_get(struct net_bridge *br,
507 struct sk_buff *skb) 507 struct sk_buff *skb, u16 vid)
508{ 508{
509 return NULL; 509 return NULL;
510} 510}
diff --git a/net/core/dev.c b/net/core/dev.c
index 90cee5be1c0f..0caa38ee8935 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3442,6 +3442,7 @@ ncls:
3442 } 3442 }
3443 switch (rx_handler(&skb)) { 3443 switch (rx_handler(&skb)) {
3444 case RX_HANDLER_CONSUMED: 3444 case RX_HANDLER_CONSUMED:
3445 ret = NET_RX_SUCCESS;
3445 goto unlock; 3446 goto unlock;
3446 case RX_HANDLER_ANOTHER: 3447 case RX_HANDLER_ANOTHER:
3447 goto another_round; 3448 goto another_round;
@@ -4104,7 +4105,7 @@ static void net_rx_action(struct softirq_action *h)
4104 * Allow this to run for 2 jiffies since which will allow 4105 * Allow this to run for 2 jiffies since which will allow
4105 * an average latency of 1.5/HZ. 4106 * an average latency of 1.5/HZ.
4106 */ 4107 */
4107 if (unlikely(budget <= 0 || time_after(jiffies, time_limit))) 4108 if (unlikely(budget <= 0 || time_after_eq(jiffies, time_limit)))
4108 goto softnet_break; 4109 goto softnet_break;
4109 4110
4110 local_irq_enable(); 4111 local_irq_enable();
@@ -4781,7 +4782,7 @@ EXPORT_SYMBOL(dev_set_mac_address);
4781/** 4782/**
4782 * dev_change_carrier - Change device carrier 4783 * dev_change_carrier - Change device carrier
4783 * @dev: device 4784 * @dev: device
4784 * @new_carries: new value 4785 * @new_carrier: new value
4785 * 4786 *
4786 * Change device carrier 4787 * Change device carrier
4787 */ 4788 */
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index f95b6fbc29e9..55b5624a4b00 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -979,6 +979,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
979 * report anything. 979 * report anything.
980 */ 980 */
981 ivi.spoofchk = -1; 981 ivi.spoofchk = -1;
982 memset(ivi.mac, 0, sizeof(ivi.mac));
982 if (dev->netdev_ops->ndo_get_vf_config(dev, i, &ivi)) 983 if (dev->netdev_ops->ndo_get_vf_config(dev, i, &ivi))
983 break; 984 break;
984 vf_mac.vf = 985 vf_mac.vf =
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index 1b588e23cf80..21291f1abcd6 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -284,6 +284,7 @@ static int dcbnl_getperm_hwaddr(struct net_device *netdev, struct nlmsghdr *nlh,
284 if (!netdev->dcbnl_ops->getpermhwaddr) 284 if (!netdev->dcbnl_ops->getpermhwaddr)
285 return -EOPNOTSUPP; 285 return -EOPNOTSUPP;
286 286
287 memset(perm_addr, 0, sizeof(perm_addr));
287 netdev->dcbnl_ops->getpermhwaddr(netdev, perm_addr); 288 netdev->dcbnl_ops->getpermhwaddr(netdev, perm_addr);
288 289
289 return nla_put(skb, DCB_ATTR_PERM_HWADDR, sizeof(perm_addr), perm_addr); 290 return nla_put(skb, DCB_ATTR_PERM_HWADDR, sizeof(perm_addr), perm_addr);
@@ -1042,6 +1043,7 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev)
1042 1043
1043 if (ops->ieee_getets) { 1044 if (ops->ieee_getets) {
1044 struct ieee_ets ets; 1045 struct ieee_ets ets;
1046 memset(&ets, 0, sizeof(ets));
1045 err = ops->ieee_getets(netdev, &ets); 1047 err = ops->ieee_getets(netdev, &ets);
1046 if (!err && 1048 if (!err &&
1047 nla_put(skb, DCB_ATTR_IEEE_ETS, sizeof(ets), &ets)) 1049 nla_put(skb, DCB_ATTR_IEEE_ETS, sizeof(ets), &ets))
@@ -1050,6 +1052,7 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev)
1050 1052
1051 if (ops->ieee_getmaxrate) { 1053 if (ops->ieee_getmaxrate) {
1052 struct ieee_maxrate maxrate; 1054 struct ieee_maxrate maxrate;
1055 memset(&maxrate, 0, sizeof(maxrate));
1053 err = ops->ieee_getmaxrate(netdev, &maxrate); 1056 err = ops->ieee_getmaxrate(netdev, &maxrate);
1054 if (!err) { 1057 if (!err) {
1055 err = nla_put(skb, DCB_ATTR_IEEE_MAXRATE, 1058 err = nla_put(skb, DCB_ATTR_IEEE_MAXRATE,
@@ -1061,6 +1064,7 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev)
1061 1064
1062 if (ops->ieee_getpfc) { 1065 if (ops->ieee_getpfc) {
1063 struct ieee_pfc pfc; 1066 struct ieee_pfc pfc;
1067 memset(&pfc, 0, sizeof(pfc));
1064 err = ops->ieee_getpfc(netdev, &pfc); 1068 err = ops->ieee_getpfc(netdev, &pfc);
1065 if (!err && 1069 if (!err &&
1066 nla_put(skb, DCB_ATTR_IEEE_PFC, sizeof(pfc), &pfc)) 1070 nla_put(skb, DCB_ATTR_IEEE_PFC, sizeof(pfc), &pfc))
@@ -1094,6 +1098,7 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev)
1094 /* get peer info if available */ 1098 /* get peer info if available */
1095 if (ops->ieee_peer_getets) { 1099 if (ops->ieee_peer_getets) {
1096 struct ieee_ets ets; 1100 struct ieee_ets ets;
1101 memset(&ets, 0, sizeof(ets));
1097 err = ops->ieee_peer_getets(netdev, &ets); 1102 err = ops->ieee_peer_getets(netdev, &ets);
1098 if (!err && 1103 if (!err &&
1099 nla_put(skb, DCB_ATTR_IEEE_PEER_ETS, sizeof(ets), &ets)) 1104 nla_put(skb, DCB_ATTR_IEEE_PEER_ETS, sizeof(ets), &ets))
@@ -1102,6 +1107,7 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev)
1102 1107
1103 if (ops->ieee_peer_getpfc) { 1108 if (ops->ieee_peer_getpfc) {
1104 struct ieee_pfc pfc; 1109 struct ieee_pfc pfc;
1110 memset(&pfc, 0, sizeof(pfc));
1105 err = ops->ieee_peer_getpfc(netdev, &pfc); 1111 err = ops->ieee_peer_getpfc(netdev, &pfc);
1106 if (!err && 1112 if (!err &&
1107 nla_put(skb, DCB_ATTR_IEEE_PEER_PFC, sizeof(pfc), &pfc)) 1113 nla_put(skb, DCB_ATTR_IEEE_PEER_PFC, sizeof(pfc), &pfc))
@@ -1280,6 +1286,7 @@ static int dcbnl_cee_fill(struct sk_buff *skb, struct net_device *netdev)
1280 /* peer info if available */ 1286 /* peer info if available */
1281 if (ops->cee_peer_getpg) { 1287 if (ops->cee_peer_getpg) {
1282 struct cee_pg pg; 1288 struct cee_pg pg;
1289 memset(&pg, 0, sizeof(pg));
1283 err = ops->cee_peer_getpg(netdev, &pg); 1290 err = ops->cee_peer_getpg(netdev, &pg);
1284 if (!err && 1291 if (!err &&
1285 nla_put(skb, DCB_ATTR_CEE_PEER_PG, sizeof(pg), &pg)) 1292 nla_put(skb, DCB_ATTR_CEE_PEER_PG, sizeof(pg), &pg))
@@ -1288,6 +1295,7 @@ static int dcbnl_cee_fill(struct sk_buff *skb, struct net_device *netdev)
1288 1295
1289 if (ops->cee_peer_getpfc) { 1296 if (ops->cee_peer_getpfc) {
1290 struct cee_pfc pfc; 1297 struct cee_pfc pfc;
1298 memset(&pfc, 0, sizeof(pfc));
1291 err = ops->cee_peer_getpfc(netdev, &pfc); 1299 err = ops->cee_peer_getpfc(netdev, &pfc);
1292 if (!err && 1300 if (!err &&
1293 nla_put(skb, DCB_ATTR_CEE_PEER_PFC, sizeof(pfc), &pfc)) 1301 nla_put(skb, DCB_ATTR_CEE_PEER_PFC, sizeof(pfc), &pfc))
diff --git a/net/ieee802154/6lowpan.h b/net/ieee802154/6lowpan.h
index 8c2251fb0a3f..bba5f8336317 100644
--- a/net/ieee802154/6lowpan.h
+++ b/net/ieee802154/6lowpan.h
@@ -84,7 +84,7 @@
84 (memcmp(addr1, addr2, length >> 3) == 0) 84 (memcmp(addr1, addr2, length >> 3) == 0)
85 85
86/* local link, i.e. FE80::/10 */ 86/* local link, i.e. FE80::/10 */
87#define is_addr_link_local(a) (((a)->s6_addr16[0]) == 0x80FE) 87#define is_addr_link_local(a) (((a)->s6_addr16[0]) == htons(0xFE80))
88 88
89/* 89/*
90 * check whether we can compress the IID to 16 bits, 90 * check whether we can compress the IID to 16 bits,
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 7d1874be1df3..786d97aee751 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -735,6 +735,7 @@ EXPORT_SYMBOL(inet_csk_destroy_sock);
735 * tcp/dccp_create_openreq_child(). 735 * tcp/dccp_create_openreq_child().
736 */ 736 */
737void inet_csk_prepare_forced_close(struct sock *sk) 737void inet_csk_prepare_forced_close(struct sock *sk)
738 __releases(&sk->sk_lock.slock)
738{ 739{
739 /* sk_clone_lock locked the socket and set refcnt to 2 */ 740 /* sk_clone_lock locked the socket and set refcnt to 2 */
740 bh_unlock_sock(sk); 741 bh_unlock_sock(sk);
diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c
index f6289bf6f332..ec7264514a82 100644
--- a/net/ipv4/ip_options.c
+++ b/net/ipv4/ip_options.c
@@ -370,7 +370,6 @@ int ip_options_compile(struct net *net,
370 } 370 }
371 switch (optptr[3]&0xF) { 371 switch (optptr[3]&0xF) {
372 case IPOPT_TS_TSONLY: 372 case IPOPT_TS_TSONLY:
373 opt->ts = optptr - iph;
374 if (skb) 373 if (skb)
375 timeptr = &optptr[optptr[2]-1]; 374 timeptr = &optptr[optptr[2]-1];
376 opt->ts_needtime = 1; 375 opt->ts_needtime = 1;
@@ -381,7 +380,6 @@ int ip_options_compile(struct net *net,
381 pp_ptr = optptr + 2; 380 pp_ptr = optptr + 2;
382 goto error; 381 goto error;
383 } 382 }
384 opt->ts = optptr - iph;
385 if (rt) { 383 if (rt) {
386 spec_dst_fill(&spec_dst, skb); 384 spec_dst_fill(&spec_dst, skb);
387 memcpy(&optptr[optptr[2]-1], &spec_dst, 4); 385 memcpy(&optptr[optptr[2]-1], &spec_dst, 4);
@@ -396,7 +394,6 @@ int ip_options_compile(struct net *net,
396 pp_ptr = optptr + 2; 394 pp_ptr = optptr + 2;
397 goto error; 395 goto error;
398 } 396 }
399 opt->ts = optptr - iph;
400 { 397 {
401 __be32 addr; 398 __be32 addr;
402 memcpy(&addr, &optptr[optptr[2]-1], 4); 399 memcpy(&addr, &optptr[optptr[2]-1], 4);
@@ -423,18 +420,18 @@ int ip_options_compile(struct net *net,
423 put_unaligned_be32(midtime, timeptr); 420 put_unaligned_be32(midtime, timeptr);
424 opt->is_changed = 1; 421 opt->is_changed = 1;
425 } 422 }
426 } else { 423 } else if ((optptr[3]&0xF) != IPOPT_TS_PRESPEC) {
427 unsigned int overflow = optptr[3]>>4; 424 unsigned int overflow = optptr[3]>>4;
428 if (overflow == 15) { 425 if (overflow == 15) {
429 pp_ptr = optptr + 3; 426 pp_ptr = optptr + 3;
430 goto error; 427 goto error;
431 } 428 }
432 opt->ts = optptr - iph;
433 if (skb) { 429 if (skb) {
434 optptr[3] = (optptr[3]&0xF)|((overflow+1)<<4); 430 optptr[3] = (optptr[3]&0xF)|((overflow+1)<<4);
435 opt->is_changed = 1; 431 opt->is_changed = 1;
436 } 432 }
437 } 433 }
434 opt->ts = optptr - iph;
438 break; 435 break;
439 case IPOPT_RA: 436 case IPOPT_RA:
440 if (optlen < 4) { 437 if (optlen < 4) {
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index b1876e52091e..e33fe0ab2568 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -281,7 +281,8 @@ int ip6_mc_input(struct sk_buff *skb)
281 * IPv6 multicast router mode is now supported ;) 281 * IPv6 multicast router mode is now supported ;)
282 */ 282 */
283 if (dev_net(skb->dev)->ipv6.devconf_all->mc_forwarding && 283 if (dev_net(skb->dev)->ipv6.devconf_all->mc_forwarding &&
284 !(ipv6_addr_type(&hdr->daddr) & IPV6_ADDR_LINKLOCAL) && 284 !(ipv6_addr_type(&hdr->daddr) &
285 (IPV6_ADDR_LOOPBACK|IPV6_ADDR_LINKLOCAL)) &&
285 likely(!(IP6CB(skb)->flags & IP6SKB_FORWARDED))) { 286 likely(!(IP6CB(skb)->flags & IP6SKB_FORWARDED))) {
286 /* 287 /*
287 * Okay, we try to forward - split and duplicate 288 * Okay, we try to forward - split and duplicate
diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c
index 9a5fd3c3e530..362ba47968e4 100644
--- a/net/irda/ircomm/ircomm_tty.c
+++ b/net/irda/ircomm/ircomm_tty.c
@@ -280,7 +280,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
280 struct tty_port *port = &self->port; 280 struct tty_port *port = &self->port;
281 DECLARE_WAITQUEUE(wait, current); 281 DECLARE_WAITQUEUE(wait, current);
282 int retval; 282 int retval;
283 int do_clocal = 0, extra_count = 0; 283 int do_clocal = 0;
284 unsigned long flags; 284 unsigned long flags;
285 285
286 IRDA_DEBUG(2, "%s()\n", __func__ ); 286 IRDA_DEBUG(2, "%s()\n", __func__ );
@@ -289,8 +289,15 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
289 * If non-blocking mode is set, or the port is not enabled, 289 * If non-blocking mode is set, or the port is not enabled,
290 * then make the check up front and then exit. 290 * then make the check up front and then exit.
291 */ 291 */
292 if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){ 292 if (test_bit(TTY_IO_ERROR, &tty->flags)) {
293 /* nonblock mode is set or port is not enabled */ 293 port->flags |= ASYNC_NORMAL_ACTIVE;
294 return 0;
295 }
296
297 if (filp->f_flags & O_NONBLOCK) {
298 /* nonblock mode is set */
299 if (tty->termios.c_cflag & CBAUD)
300 tty_port_raise_dtr_rts(port);
294 port->flags |= ASYNC_NORMAL_ACTIVE; 301 port->flags |= ASYNC_NORMAL_ACTIVE;
295 IRDA_DEBUG(1, "%s(), O_NONBLOCK requested!\n", __func__ ); 302 IRDA_DEBUG(1, "%s(), O_NONBLOCK requested!\n", __func__ );
296 return 0; 303 return 0;
@@ -315,18 +322,16 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
315 __FILE__, __LINE__, tty->driver->name, port->count); 322 __FILE__, __LINE__, tty->driver->name, port->count);
316 323
317 spin_lock_irqsave(&port->lock, flags); 324 spin_lock_irqsave(&port->lock, flags);
318 if (!tty_hung_up_p(filp)) { 325 if (!tty_hung_up_p(filp))
319 extra_count = 1;
320 port->count--; 326 port->count--;
321 }
322 spin_unlock_irqrestore(&port->lock, flags);
323 port->blocked_open++; 327 port->blocked_open++;
328 spin_unlock_irqrestore(&port->lock, flags);
324 329
325 while (1) { 330 while (1) {
326 if (tty->termios.c_cflag & CBAUD) 331 if (tty->termios.c_cflag & CBAUD)
327 tty_port_raise_dtr_rts(port); 332 tty_port_raise_dtr_rts(port);
328 333
329 current->state = TASK_INTERRUPTIBLE; 334 set_current_state(TASK_INTERRUPTIBLE);
330 335
331 if (tty_hung_up_p(filp) || 336 if (tty_hung_up_p(filp) ||
332 !test_bit(ASYNCB_INITIALIZED, &port->flags)) { 337 !test_bit(ASYNCB_INITIALIZED, &port->flags)) {
@@ -361,13 +366,11 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
361 __set_current_state(TASK_RUNNING); 366 __set_current_state(TASK_RUNNING);
362 remove_wait_queue(&port->open_wait, &wait); 367 remove_wait_queue(&port->open_wait, &wait);
363 368
364 if (extra_count) { 369 spin_lock_irqsave(&port->lock, flags);
365 /* ++ is not atomic, so this should be protected - Jean II */ 370 if (!tty_hung_up_p(filp))
366 spin_lock_irqsave(&port->lock, flags);
367 port->count++; 371 port->count++;
368 spin_unlock_irqrestore(&port->lock, flags);
369 }
370 port->blocked_open--; 372 port->blocked_open--;
373 spin_unlock_irqrestore(&port->lock, flags);
371 374
372 IRDA_DEBUG(1, "%s(%d):block_til_ready after blocking on %s open_count=%d\n", 375 IRDA_DEBUG(1, "%s(%d):block_til_ready after blocking on %s open_count=%d\n",
373 __FILE__, __LINE__, tty->driver->name, port->count); 376 __FILE__, __LINE__, tty->driver->name, port->count);
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 556fdafdd1ea..8555f331ea60 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -2201,7 +2201,7 @@ static int pfkey_spdadd(struct sock *sk, struct sk_buff *skb, const struct sadb_
2201 XFRM_POLICY_BLOCK : XFRM_POLICY_ALLOW); 2201 XFRM_POLICY_BLOCK : XFRM_POLICY_ALLOW);
2202 xp->priority = pol->sadb_x_policy_priority; 2202 xp->priority = pol->sadb_x_policy_priority;
2203 2203
2204 sa = ext_hdrs[SADB_EXT_ADDRESS_SRC-1], 2204 sa = ext_hdrs[SADB_EXT_ADDRESS_SRC-1];
2205 xp->family = pfkey_sadb_addr2xfrm_addr(sa, &xp->selector.saddr); 2205 xp->family = pfkey_sadb_addr2xfrm_addr(sa, &xp->selector.saddr);
2206 if (!xp->family) { 2206 if (!xp->family) {
2207 err = -EINVAL; 2207 err = -EINVAL;
@@ -2214,7 +2214,7 @@ static int pfkey_spdadd(struct sock *sk, struct sk_buff *skb, const struct sadb_
2214 if (xp->selector.sport) 2214 if (xp->selector.sport)
2215 xp->selector.sport_mask = htons(0xffff); 2215 xp->selector.sport_mask = htons(0xffff);
2216 2216
2217 sa = ext_hdrs[SADB_EXT_ADDRESS_DST-1], 2217 sa = ext_hdrs[SADB_EXT_ADDRESS_DST-1];
2218 pfkey_sadb_addr2xfrm_addr(sa, &xp->selector.daddr); 2218 pfkey_sadb_addr2xfrm_addr(sa, &xp->selector.daddr);
2219 xp->selector.prefixlen_d = sa->sadb_address_prefixlen; 2219 xp->selector.prefixlen_d = sa->sadb_address_prefixlen;
2220 2220
@@ -2315,7 +2315,7 @@ static int pfkey_spddelete(struct sock *sk, struct sk_buff *skb, const struct sa
2315 2315
2316 memset(&sel, 0, sizeof(sel)); 2316 memset(&sel, 0, sizeof(sel));
2317 2317
2318 sa = ext_hdrs[SADB_EXT_ADDRESS_SRC-1], 2318 sa = ext_hdrs[SADB_EXT_ADDRESS_SRC-1];
2319 sel.family = pfkey_sadb_addr2xfrm_addr(sa, &sel.saddr); 2319 sel.family = pfkey_sadb_addr2xfrm_addr(sa, &sel.saddr);
2320 sel.prefixlen_s = sa->sadb_address_prefixlen; 2320 sel.prefixlen_s = sa->sadb_address_prefixlen;
2321 sel.proto = pfkey_proto_to_xfrm(sa->sadb_address_proto); 2321 sel.proto = pfkey_proto_to_xfrm(sa->sadb_address_proto);
@@ -2323,7 +2323,7 @@ static int pfkey_spddelete(struct sock *sk, struct sk_buff *skb, const struct sa
2323 if (sel.sport) 2323 if (sel.sport)
2324 sel.sport_mask = htons(0xffff); 2324 sel.sport_mask = htons(0xffff);
2325 2325
2326 sa = ext_hdrs[SADB_EXT_ADDRESS_DST-1], 2326 sa = ext_hdrs[SADB_EXT_ADDRESS_DST-1];
2327 pfkey_sadb_addr2xfrm_addr(sa, &sel.daddr); 2327 pfkey_sadb_addr2xfrm_addr(sa, &sel.daddr);
2328 sel.prefixlen_d = sa->sadb_address_prefixlen; 2328 sel.prefixlen_d = sa->sadb_address_prefixlen;
2329 sel.proto = pfkey_proto_to_xfrm(sa->sadb_address_proto); 2329 sel.proto = pfkey_proto_to_xfrm(sa->sadb_address_proto);
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 808f5fcd1ced..fb306814576a 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3290,14 +3290,19 @@ static int ieee80211_cfg_get_channel(struct wiphy *wiphy,
3290 int ret = -ENODATA; 3290 int ret = -ENODATA;
3291 3291
3292 rcu_read_lock(); 3292 rcu_read_lock();
3293 if (local->use_chanctx) { 3293 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
3294 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); 3294 if (chanctx_conf) {
3295 if (chanctx_conf) { 3295 *chandef = chanctx_conf->def;
3296 *chandef = chanctx_conf->def; 3296 ret = 0;
3297 ret = 0; 3297 } else if (local->open_count > 0 &&
3298 } 3298 local->open_count == local->monitors &&
3299 } else if (local->open_count == local->monitors) { 3299 sdata->vif.type == NL80211_IFTYPE_MONITOR) {
3300 *chandef = local->monitor_chandef; 3300 if (local->use_chanctx)
3301 *chandef = local->monitor_chandef;
3302 else
3303 cfg80211_chandef_create(chandef,
3304 local->_oper_channel,
3305 local->_oper_channel_type);
3301 ret = 0; 3306 ret = 0;
3302 } 3307 }
3303 rcu_read_unlock(); 3308 rcu_read_unlock();
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 640afab304d7..baaa8608e52d 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -541,6 +541,9 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
541 541
542 ieee80211_adjust_monitor_flags(sdata, 1); 542 ieee80211_adjust_monitor_flags(sdata, 1);
543 ieee80211_configure_filter(local); 543 ieee80211_configure_filter(local);
544 mutex_lock(&local->mtx);
545 ieee80211_recalc_idle(local);
546 mutex_unlock(&local->mtx);
544 547
545 netif_carrier_on(dev); 548 netif_carrier_on(dev);
546 break; 549 break;
@@ -812,6 +815,9 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
812 815
813 ieee80211_adjust_monitor_flags(sdata, -1); 816 ieee80211_adjust_monitor_flags(sdata, -1);
814 ieee80211_configure_filter(local); 817 ieee80211_configure_filter(local);
818 mutex_lock(&local->mtx);
819 ieee80211_recalc_idle(local);
820 mutex_unlock(&local->mtx);
815 break; 821 break;
816 case NL80211_IFTYPE_P2P_DEVICE: 822 case NL80211_IFTYPE_P2P_DEVICE:
817 /* relies on synchronize_rcu() below */ 823 /* relies on synchronize_rcu() below */
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 9f6464f3e05f..141577412d84 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -647,6 +647,9 @@ static void ieee80211_add_vht_ie(struct ieee80211_sub_if_data *sdata,
647 our_mcs = (le16_to_cpu(vht_cap.vht_mcs.rx_mcs_map) & 647 our_mcs = (le16_to_cpu(vht_cap.vht_mcs.rx_mcs_map) &
648 mask) >> shift; 648 mask) >> shift;
649 649
650 if (our_mcs == IEEE80211_VHT_MCS_NOT_SUPPORTED)
651 continue;
652
650 switch (ap_mcs) { 653 switch (ap_mcs) {
651 default: 654 default:
652 if (our_mcs <= ap_mcs) 655 if (our_mcs <= ap_mcs)
@@ -3503,6 +3506,14 @@ void ieee80211_sta_quiesce(struct ieee80211_sub_if_data *sdata)
3503 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 3506 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
3504 3507
3505 /* 3508 /*
3509 * Stop timers before deleting work items, as timers
3510 * could race and re-add the work-items. They will be
3511 * re-established on connection.
3512 */
3513 del_timer_sync(&ifmgd->conn_mon_timer);
3514 del_timer_sync(&ifmgd->bcn_mon_timer);
3515
3516 /*
3506 * we need to use atomic bitops for the running bits 3517 * we need to use atomic bitops for the running bits
3507 * only because both timers might fire at the same 3518 * only because both timers might fire at the same
3508 * time -- the code here is properly synchronised. 3519 * time -- the code here is properly synchronised.
@@ -3516,13 +3527,9 @@ void ieee80211_sta_quiesce(struct ieee80211_sub_if_data *sdata)
3516 if (del_timer_sync(&ifmgd->timer)) 3527 if (del_timer_sync(&ifmgd->timer))
3517 set_bit(TMR_RUNNING_TIMER, &ifmgd->timers_running); 3528 set_bit(TMR_RUNNING_TIMER, &ifmgd->timers_running);
3518 3529
3519 cancel_work_sync(&ifmgd->chswitch_work);
3520 if (del_timer_sync(&ifmgd->chswitch_timer)) 3530 if (del_timer_sync(&ifmgd->chswitch_timer))
3521 set_bit(TMR_RUNNING_CHANSW, &ifmgd->timers_running); 3531 set_bit(TMR_RUNNING_CHANSW, &ifmgd->timers_running);
3522 3532 cancel_work_sync(&ifmgd->chswitch_work);
3523 /* these will just be re-established on connection */
3524 del_timer_sync(&ifmgd->conn_mon_timer);
3525 del_timer_sync(&ifmgd->bcn_mon_timer);
3526} 3533}
3527 3534
3528void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata) 3535void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata)
@@ -4315,6 +4322,17 @@ void ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata)
4315{ 4322{
4316 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 4323 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
4317 4324
4325 /*
4326 * Make sure some work items will not run after this,
4327 * they will not do anything but might not have been
4328 * cancelled when disconnecting.
4329 */
4330 cancel_work_sync(&ifmgd->monitor_work);
4331 cancel_work_sync(&ifmgd->beacon_connection_loss_work);
4332 cancel_work_sync(&ifmgd->request_smps_work);
4333 cancel_work_sync(&ifmgd->csa_connection_drop_work);
4334 cancel_work_sync(&ifmgd->chswitch_work);
4335
4318 mutex_lock(&ifmgd->mtx); 4336 mutex_lock(&ifmgd->mtx);
4319 if (ifmgd->assoc_data) 4337 if (ifmgd->assoc_data)
4320 ieee80211_destroy_assoc_data(sdata, false); 4338 ieee80211_destroy_assoc_data(sdata, false);
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index ce78d1149f1d..8914d2d2881a 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2745,7 +2745,8 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw,
2745 cpu_to_le16(IEEE80211_FCTL_MOREDATA); 2745 cpu_to_le16(IEEE80211_FCTL_MOREDATA);
2746 } 2746 }
2747 2747
2748 sdata = IEEE80211_DEV_TO_SUB_IF(skb->dev); 2748 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
2749 sdata = IEEE80211_DEV_TO_SUB_IF(skb->dev);
2749 if (!ieee80211_tx_prepare(sdata, &tx, skb)) 2750 if (!ieee80211_tx_prepare(sdata, &tx, skb))
2750 break; 2751 break;
2751 dev_kfree_skb_any(skb); 2752 dev_kfree_skb_any(skb);
diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c
index a9740bd6fe54..94b4b9853f60 100644
--- a/net/netfilter/nf_conntrack_helper.c
+++ b/net/netfilter/nf_conntrack_helper.c
@@ -339,6 +339,13 @@ void nf_ct_helper_log(struct sk_buff *skb, const struct nf_conn *ct,
339{ 339{
340 const struct nf_conn_help *help; 340 const struct nf_conn_help *help;
341 const struct nf_conntrack_helper *helper; 341 const struct nf_conntrack_helper *helper;
342 struct va_format vaf;
343 va_list args;
344
345 va_start(args, fmt);
346
347 vaf.fmt = fmt;
348 vaf.va = &args;
342 349
343 /* Called from the helper function, this call never fails */ 350 /* Called from the helper function, this call never fails */
344 help = nfct_help(ct); 351 help = nfct_help(ct);
@@ -347,7 +354,9 @@ void nf_ct_helper_log(struct sk_buff *skb, const struct nf_conn *ct,
347 helper = rcu_dereference(help->helper); 354 helper = rcu_dereference(help->helper);
348 355
349 nf_log_packet(nf_ct_l3num(ct), 0, skb, NULL, NULL, NULL, 356 nf_log_packet(nf_ct_l3num(ct), 0, skb, NULL, NULL, NULL,
350 "nf_ct_%s: dropping packet: %s ", helper->name, fmt); 357 "nf_ct_%s: dropping packet: %pV ", helper->name, &vaf);
358
359 va_end(args);
351} 360}
352EXPORT_SYMBOL_GPL(nf_ct_helper_log); 361EXPORT_SYMBOL_GPL(nf_ct_helper_log);
353 362
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index d578ec251712..0b1b32cda307 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -62,11 +62,6 @@ void nfnl_unlock(__u8 subsys_id)
62} 62}
63EXPORT_SYMBOL_GPL(nfnl_unlock); 63EXPORT_SYMBOL_GPL(nfnl_unlock);
64 64
65static struct mutex *nfnl_get_lock(__u8 subsys_id)
66{
67 return &table[subsys_id].mutex;
68}
69
70int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n) 65int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n)
71{ 66{
72 nfnl_lock(n->subsys_id); 67 nfnl_lock(n->subsys_id);
@@ -199,7 +194,7 @@ replay:
199 rcu_read_unlock(); 194 rcu_read_unlock();
200 nfnl_lock(subsys_id); 195 nfnl_lock(subsys_id);
201 if (rcu_dereference_protected(table[subsys_id].subsys, 196 if (rcu_dereference_protected(table[subsys_id].subsys,
202 lockdep_is_held(nfnl_get_lock(subsys_id))) != ss || 197 lockdep_is_held(&table[subsys_id].mutex)) != ss ||
203 nfnetlink_find_client(type, ss) != nc) 198 nfnetlink_find_client(type, ss) != nc)
204 err = -EAGAIN; 199 err = -EAGAIN;
205 else if (nc->call) 200 else if (nc->call)
diff --git a/net/netfilter/xt_AUDIT.c b/net/netfilter/xt_AUDIT.c
index ba92824086f3..3228d7f24eb4 100644
--- a/net/netfilter/xt_AUDIT.c
+++ b/net/netfilter/xt_AUDIT.c
@@ -124,6 +124,9 @@ audit_tg(struct sk_buff *skb, const struct xt_action_param *par)
124 const struct xt_audit_info *info = par->targinfo; 124 const struct xt_audit_info *info = par->targinfo;
125 struct audit_buffer *ab; 125 struct audit_buffer *ab;
126 126
127 if (audit_enabled == 0)
128 goto errout;
129
127 ab = audit_log_start(NULL, GFP_ATOMIC, AUDIT_NETFILTER_PKT); 130 ab = audit_log_start(NULL, GFP_ATOMIC, AUDIT_NETFILTER_PKT);
128 if (ab == NULL) 131 if (ab == NULL)
129 goto errout; 132 goto errout;
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c
index 847d495cd4de..8a6c6ea466d8 100644
--- a/net/netlabel/netlabel_unlabeled.c
+++ b/net/netlabel/netlabel_unlabeled.c
@@ -1189,8 +1189,6 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb,
1189 struct netlbl_unlhsh_walk_arg cb_arg; 1189 struct netlbl_unlhsh_walk_arg cb_arg;
1190 u32 skip_bkt = cb->args[0]; 1190 u32 skip_bkt = cb->args[0];
1191 u32 skip_chain = cb->args[1]; 1191 u32 skip_chain = cb->args[1];
1192 u32 skip_addr4 = cb->args[2];
1193 u32 skip_addr6 = cb->args[3];
1194 u32 iter_bkt; 1192 u32 iter_bkt;
1195 u32 iter_chain = 0, iter_addr4 = 0, iter_addr6 = 0; 1193 u32 iter_chain = 0, iter_addr4 = 0, iter_addr6 = 0;
1196 struct netlbl_unlhsh_iface *iface; 1194 struct netlbl_unlhsh_iface *iface;
@@ -1215,7 +1213,7 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb,
1215 continue; 1213 continue;
1216 netlbl_af4list_foreach_rcu(addr4, 1214 netlbl_af4list_foreach_rcu(addr4,
1217 &iface->addr4_list) { 1215 &iface->addr4_list) {
1218 if (iter_addr4++ < skip_addr4) 1216 if (iter_addr4++ < cb->args[2])
1219 continue; 1217 continue;
1220 if (netlbl_unlabel_staticlist_gen( 1218 if (netlbl_unlabel_staticlist_gen(
1221 NLBL_UNLABEL_C_STATICLIST, 1219 NLBL_UNLABEL_C_STATICLIST,
@@ -1231,7 +1229,7 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb,
1231#if IS_ENABLED(CONFIG_IPV6) 1229#if IS_ENABLED(CONFIG_IPV6)
1232 netlbl_af6list_foreach_rcu(addr6, 1230 netlbl_af6list_foreach_rcu(addr6,
1233 &iface->addr6_list) { 1231 &iface->addr6_list) {
1234 if (iter_addr6++ < skip_addr6) 1232 if (iter_addr6++ < cb->args[3])
1235 continue; 1233 continue;
1236 if (netlbl_unlabel_staticlist_gen( 1234 if (netlbl_unlabel_staticlist_gen(
1237 NLBL_UNLABEL_C_STATICLIST, 1235 NLBL_UNLABEL_C_STATICLIST,
@@ -1250,10 +1248,10 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb,
1250 1248
1251unlabel_staticlist_return: 1249unlabel_staticlist_return:
1252 rcu_read_unlock(); 1250 rcu_read_unlock();
1253 cb->args[0] = skip_bkt; 1251 cb->args[0] = iter_bkt;
1254 cb->args[1] = skip_chain; 1252 cb->args[1] = iter_chain;
1255 cb->args[2] = skip_addr4; 1253 cb->args[2] = iter_addr4;
1256 cb->args[3] = skip_addr6; 1254 cb->args[3] = iter_addr6;
1257 return skb->len; 1255 return skb->len;
1258} 1256}
1259 1257
@@ -1273,12 +1271,9 @@ static int netlbl_unlabel_staticlistdef(struct sk_buff *skb,
1273{ 1271{
1274 struct netlbl_unlhsh_walk_arg cb_arg; 1272 struct netlbl_unlhsh_walk_arg cb_arg;
1275 struct netlbl_unlhsh_iface *iface; 1273 struct netlbl_unlhsh_iface *iface;
1276 u32 skip_addr4 = cb->args[0]; 1274 u32 iter_addr4 = 0, iter_addr6 = 0;
1277 u32 skip_addr6 = cb->args[1];
1278 u32 iter_addr4 = 0;
1279 struct netlbl_af4list *addr4; 1275 struct netlbl_af4list *addr4;
1280#if IS_ENABLED(CONFIG_IPV6) 1276#if IS_ENABLED(CONFIG_IPV6)
1281 u32 iter_addr6 = 0;
1282 struct netlbl_af6list *addr6; 1277 struct netlbl_af6list *addr6;
1283#endif 1278#endif
1284 1279
@@ -1292,7 +1287,7 @@ static int netlbl_unlabel_staticlistdef(struct sk_buff *skb,
1292 goto unlabel_staticlistdef_return; 1287 goto unlabel_staticlistdef_return;
1293 1288
1294 netlbl_af4list_foreach_rcu(addr4, &iface->addr4_list) { 1289 netlbl_af4list_foreach_rcu(addr4, &iface->addr4_list) {
1295 if (iter_addr4++ < skip_addr4) 1290 if (iter_addr4++ < cb->args[0])
1296 continue; 1291 continue;
1297 if (netlbl_unlabel_staticlist_gen(NLBL_UNLABEL_C_STATICLISTDEF, 1292 if (netlbl_unlabel_staticlist_gen(NLBL_UNLABEL_C_STATICLISTDEF,
1298 iface, 1293 iface,
@@ -1305,7 +1300,7 @@ static int netlbl_unlabel_staticlistdef(struct sk_buff *skb,
1305 } 1300 }
1306#if IS_ENABLED(CONFIG_IPV6) 1301#if IS_ENABLED(CONFIG_IPV6)
1307 netlbl_af6list_foreach_rcu(addr6, &iface->addr6_list) { 1302 netlbl_af6list_foreach_rcu(addr6, &iface->addr6_list) {
1308 if (iter_addr6++ < skip_addr6) 1303 if (iter_addr6++ < cb->args[1])
1309 continue; 1304 continue;
1310 if (netlbl_unlabel_staticlist_gen(NLBL_UNLABEL_C_STATICLISTDEF, 1305 if (netlbl_unlabel_staticlist_gen(NLBL_UNLABEL_C_STATICLISTDEF,
1311 iface, 1306 iface,
@@ -1320,8 +1315,8 @@ static int netlbl_unlabel_staticlistdef(struct sk_buff *skb,
1320 1315
1321unlabel_staticlistdef_return: 1316unlabel_staticlistdef_return:
1322 rcu_read_unlock(); 1317 rcu_read_unlock();
1323 cb->args[0] = skip_addr4; 1318 cb->args[0] = iter_addr4;
1324 cb->args[1] = skip_addr6; 1319 cb->args[1] = iter_addr6;
1325 return skb->len; 1320 return skb->len;
1326} 1321}
1327 1322
diff --git a/net/rds/stats.c b/net/rds/stats.c
index 7be790d60b90..73be187d389e 100644
--- a/net/rds/stats.c
+++ b/net/rds/stats.c
@@ -87,6 +87,7 @@ void rds_stats_info_copy(struct rds_info_iterator *iter,
87 for (i = 0; i < nr; i++) { 87 for (i = 0; i < nr; i++) {
88 BUG_ON(strlen(names[i]) >= sizeof(ctr.name)); 88 BUG_ON(strlen(names[i]) >= sizeof(ctr.name));
89 strncpy(ctr.name, names[i], sizeof(ctr.name) - 1); 89 strncpy(ctr.name, names[i], sizeof(ctr.name) - 1);
90 ctr.name[sizeof(ctr.name) - 1] = '\0';
90 ctr.value = values[i]; 91 ctr.value = values[i];
91 92
92 rds_info_copy(iter, &ctr, sizeof(ctr)); 93 rds_info_copy(iter, &ctr, sizeof(ctr));
diff --git a/net/sched/sch_qfq.c b/net/sched/sch_qfq.c
index e9a77f621c3d..d51852bba01c 100644
--- a/net/sched/sch_qfq.c
+++ b/net/sched/sch_qfq.c
@@ -298,6 +298,10 @@ static void qfq_update_agg(struct qfq_sched *q, struct qfq_aggregate *agg,
298 new_num_classes == q->max_agg_classes - 1) /* agg no more full */ 298 new_num_classes == q->max_agg_classes - 1) /* agg no more full */
299 hlist_add_head(&agg->nonfull_next, &q->nonfull_aggs); 299 hlist_add_head(&agg->nonfull_next, &q->nonfull_aggs);
300 300
301 /* The next assignment may let
302 * agg->initial_budget > agg->budgetmax
303 * hold, we will take it into account in charge_actual_service().
304 */
301 agg->budgetmax = new_num_classes * agg->lmax; 305 agg->budgetmax = new_num_classes * agg->lmax;
302 new_agg_weight = agg->class_weight * new_num_classes; 306 new_agg_weight = agg->class_weight * new_num_classes;
303 agg->inv_w = ONE_FP/new_agg_weight; 307 agg->inv_w = ONE_FP/new_agg_weight;
@@ -817,7 +821,7 @@ static void qfq_make_eligible(struct qfq_sched *q)
817 unsigned long old_vslot = q->oldV >> q->min_slot_shift; 821 unsigned long old_vslot = q->oldV >> q->min_slot_shift;
818 822
819 if (vslot != old_vslot) { 823 if (vslot != old_vslot) {
820 unsigned long mask = (1UL << fls(vslot ^ old_vslot)) - 1; 824 unsigned long mask = (1ULL << fls(vslot ^ old_vslot)) - 1;
821 qfq_move_groups(q, mask, IR, ER); 825 qfq_move_groups(q, mask, IR, ER);
822 qfq_move_groups(q, mask, IB, EB); 826 qfq_move_groups(q, mask, IB, EB);
823 } 827 }
@@ -988,12 +992,23 @@ static inline struct sk_buff *qfq_peek_skb(struct qfq_aggregate *agg,
988/* Update F according to the actual service received by the aggregate. */ 992/* Update F according to the actual service received by the aggregate. */
989static inline void charge_actual_service(struct qfq_aggregate *agg) 993static inline void charge_actual_service(struct qfq_aggregate *agg)
990{ 994{
991 /* compute the service received by the aggregate */ 995 /* Compute the service received by the aggregate, taking into
992 u32 service_received = agg->initial_budget - agg->budget; 996 * account that, after decreasing the number of classes in
997 * agg, it may happen that
998 * agg->initial_budget - agg->budget > agg->bugdetmax
999 */
1000 u32 service_received = min(agg->budgetmax,
1001 agg->initial_budget - agg->budget);
993 1002
994 agg->F = agg->S + (u64)service_received * agg->inv_w; 1003 agg->F = agg->S + (u64)service_received * agg->inv_w;
995} 1004}
996 1005
1006static inline void qfq_update_agg_ts(struct qfq_sched *q,
1007 struct qfq_aggregate *agg,
1008 enum update_reason reason);
1009
1010static void qfq_schedule_agg(struct qfq_sched *q, struct qfq_aggregate *agg);
1011
997static struct sk_buff *qfq_dequeue(struct Qdisc *sch) 1012static struct sk_buff *qfq_dequeue(struct Qdisc *sch)
998{ 1013{
999 struct qfq_sched *q = qdisc_priv(sch); 1014 struct qfq_sched *q = qdisc_priv(sch);
@@ -1021,7 +1036,7 @@ static struct sk_buff *qfq_dequeue(struct Qdisc *sch)
1021 in_serv_agg->initial_budget = in_serv_agg->budget = 1036 in_serv_agg->initial_budget = in_serv_agg->budget =
1022 in_serv_agg->budgetmax; 1037 in_serv_agg->budgetmax;
1023 1038
1024 if (!list_empty(&in_serv_agg->active)) 1039 if (!list_empty(&in_serv_agg->active)) {
1025 /* 1040 /*
1026 * Still active: reschedule for 1041 * Still active: reschedule for
1027 * service. Possible optimization: if no other 1042 * service. Possible optimization: if no other
@@ -1032,8 +1047,9 @@ static struct sk_buff *qfq_dequeue(struct Qdisc *sch)
1032 * handle it, we would need to maintain an 1047 * handle it, we would need to maintain an
1033 * extra num_active_aggs field. 1048 * extra num_active_aggs field.
1034 */ 1049 */
1035 qfq_activate_agg(q, in_serv_agg, requeue); 1050 qfq_update_agg_ts(q, in_serv_agg, requeue);
1036 else if (sch->q.qlen == 0) { /* no aggregate to serve */ 1051 qfq_schedule_agg(q, in_serv_agg);
1052 } else if (sch->q.qlen == 0) { /* no aggregate to serve */
1037 q->in_serv_agg = NULL; 1053 q->in_serv_agg = NULL;
1038 return NULL; 1054 return NULL;
1039 } 1055 }
@@ -1052,7 +1068,15 @@ static struct sk_buff *qfq_dequeue(struct Qdisc *sch)
1052 qdisc_bstats_update(sch, skb); 1068 qdisc_bstats_update(sch, skb);
1053 1069
1054 agg_dequeue(in_serv_agg, cl, len); 1070 agg_dequeue(in_serv_agg, cl, len);
1055 in_serv_agg->budget -= len; 1071 /* If lmax is lowered, through qfq_change_class, for a class
1072 * owning pending packets with larger size than the new value
1073 * of lmax, then the following condition may hold.
1074 */
1075 if (unlikely(in_serv_agg->budget < len))
1076 in_serv_agg->budget = 0;
1077 else
1078 in_serv_agg->budget -= len;
1079
1056 q->V += (u64)len * IWSUM; 1080 q->V += (u64)len * IWSUM;
1057 pr_debug("qfq dequeue: len %u F %lld now %lld\n", 1081 pr_debug("qfq dequeue: len %u F %lld now %lld\n",
1058 len, (unsigned long long) in_serv_agg->F, 1082 len, (unsigned long long) in_serv_agg->F,
@@ -1217,17 +1241,11 @@ static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
1217 cl->deficit = agg->lmax; 1241 cl->deficit = agg->lmax;
1218 list_add_tail(&cl->alist, &agg->active); 1242 list_add_tail(&cl->alist, &agg->active);
1219 1243
1220 if (list_first_entry(&agg->active, struct qfq_class, alist) != cl) 1244 if (list_first_entry(&agg->active, struct qfq_class, alist) != cl ||
1221 return err; /* aggregate was not empty, nothing else to do */ 1245 q->in_serv_agg == agg)
1246 return err; /* non-empty or in service, nothing else to do */
1222 1247
1223 /* recharge budget */ 1248 qfq_activate_agg(q, agg, enqueue);
1224 agg->initial_budget = agg->budget = agg->budgetmax;
1225
1226 qfq_update_agg_ts(q, agg, enqueue);
1227 if (q->in_serv_agg == NULL)
1228 q->in_serv_agg = agg;
1229 else if (agg != q->in_serv_agg)
1230 qfq_schedule_agg(q, agg);
1231 1249
1232 return err; 1250 return err;
1233} 1251}
@@ -1261,7 +1279,8 @@ static void qfq_schedule_agg(struct qfq_sched *q, struct qfq_aggregate *agg)
1261 /* group was surely ineligible, remove */ 1279 /* group was surely ineligible, remove */
1262 __clear_bit(grp->index, &q->bitmaps[IR]); 1280 __clear_bit(grp->index, &q->bitmaps[IR]);
1263 __clear_bit(grp->index, &q->bitmaps[IB]); 1281 __clear_bit(grp->index, &q->bitmaps[IB]);
1264 } else if (!q->bitmaps[ER] && qfq_gt(roundedS, q->V)) 1282 } else if (!q->bitmaps[ER] && qfq_gt(roundedS, q->V) &&
1283 q->in_serv_agg == NULL)
1265 q->V = roundedS; 1284 q->V = roundedS;
1266 1285
1267 grp->S = roundedS; 1286 grp->S = roundedS;
@@ -1284,8 +1303,15 @@ skip_update:
1284static void qfq_activate_agg(struct qfq_sched *q, struct qfq_aggregate *agg, 1303static void qfq_activate_agg(struct qfq_sched *q, struct qfq_aggregate *agg,
1285 enum update_reason reason) 1304 enum update_reason reason)
1286{ 1305{
1306 agg->initial_budget = agg->budget = agg->budgetmax; /* recharge budg. */
1307
1287 qfq_update_agg_ts(q, agg, reason); 1308 qfq_update_agg_ts(q, agg, reason);
1288 qfq_schedule_agg(q, agg); 1309 if (q->in_serv_agg == NULL) { /* no aggr. in service or scheduled */
1310 q->in_serv_agg = agg; /* start serving this aggregate */
1311 /* update V: to be in service, agg must be eligible */
1312 q->oldV = q->V = agg->S;
1313 } else if (agg != q->in_serv_agg)
1314 qfq_schedule_agg(q, agg);
1289} 1315}
1290 1316
1291static void qfq_slot_remove(struct qfq_sched *q, struct qfq_group *grp, 1317static void qfq_slot_remove(struct qfq_sched *q, struct qfq_group *grp,
@@ -1357,8 +1383,6 @@ static void qfq_deactivate_agg(struct qfq_sched *q, struct qfq_aggregate *agg)
1357 __set_bit(grp->index, &q->bitmaps[s]); 1383 __set_bit(grp->index, &q->bitmaps[s]);
1358 } 1384 }
1359 } 1385 }
1360
1361 qfq_update_eligible(q);
1362} 1386}
1363 1387
1364static void qfq_qlen_notify(struct Qdisc *sch, unsigned long arg) 1388static void qfq_qlen_notify(struct Qdisc *sch, unsigned long arg)
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 7b9b40224a27..a0f48a51e14e 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -1174,6 +1174,7 @@ static struct file_system_type rpc_pipe_fs_type = {
1174 .mount = rpc_mount, 1174 .mount = rpc_mount,
1175 .kill_sb = rpc_kill_sb, 1175 .kill_sb = rpc_kill_sb,
1176}; 1176};
1177MODULE_ALIAS_FS("rpc_pipefs");
1177 1178
1178static void 1179static void
1179init_once(void *foo) 1180init_once(void *foo)
@@ -1218,6 +1219,3 @@ void unregister_rpc_pipefs(void)
1218 kmem_cache_destroy(rpc_inode_cachep); 1219 kmem_cache_destroy(rpc_inode_cachep);
1219 unregister_filesystem(&rpc_pipe_fs_type); 1220 unregister_filesystem(&rpc_pipe_fs_type);
1220} 1221}
1221
1222/* Make 'mount -t rpc_pipefs ...' autoload this module. */
1223MODULE_ALIAS("rpc_pipefs");
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 5ffff039b017..ea4155fe9733 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -367,8 +367,7 @@ struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv)
367 rdev->wiphy.rts_threshold = (u32) -1; 367 rdev->wiphy.rts_threshold = (u32) -1;
368 rdev->wiphy.coverage_class = 0; 368 rdev->wiphy.coverage_class = 0;
369 369
370 rdev->wiphy.features = NL80211_FEATURE_SCAN_FLUSH | 370 rdev->wiphy.features = NL80211_FEATURE_SCAN_FLUSH;
371 NL80211_FEATURE_ADVERTISE_CHAN_LIMITS;
372 371
373 return &rdev->wiphy; 372 return &rdev->wiphy;
374} 373}
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index e652d05ff712..d44ab216c0ec 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -557,18 +557,6 @@ static int nl80211_msg_put_channel(struct sk_buff *msg,
557 if ((chan->flags & IEEE80211_CHAN_RADAR) && 557 if ((chan->flags & IEEE80211_CHAN_RADAR) &&
558 nla_put_flag(msg, NL80211_FREQUENCY_ATTR_RADAR)) 558 nla_put_flag(msg, NL80211_FREQUENCY_ATTR_RADAR))
559 goto nla_put_failure; 559 goto nla_put_failure;
560 if ((chan->flags & IEEE80211_CHAN_NO_HT40MINUS) &&
561 nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_HT40_MINUS))
562 goto nla_put_failure;
563 if ((chan->flags & IEEE80211_CHAN_NO_HT40PLUS) &&
564 nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_HT40_PLUS))
565 goto nla_put_failure;
566 if ((chan->flags & IEEE80211_CHAN_NO_80MHZ) &&
567 nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_80MHZ))
568 goto nla_put_failure;
569 if ((chan->flags & IEEE80211_CHAN_NO_160MHZ) &&
570 nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_160MHZ))
571 goto nla_put_failure;
572 560
573 if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_MAX_TX_POWER, 561 if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_MAX_TX_POWER,
574 DBM_TO_MBM(chan->max_power))) 562 DBM_TO_MBM(chan->max_power)))
@@ -1310,15 +1298,6 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 portid, u32 seq, int flag
1310 dev->wiphy.max_acl_mac_addrs)) 1298 dev->wiphy.max_acl_mac_addrs))
1311 goto nla_put_failure; 1299 goto nla_put_failure;
1312 1300
1313 if (dev->wiphy.extended_capabilities &&
1314 (nla_put(msg, NL80211_ATTR_EXT_CAPA,
1315 dev->wiphy.extended_capabilities_len,
1316 dev->wiphy.extended_capabilities) ||
1317 nla_put(msg, NL80211_ATTR_EXT_CAPA_MASK,
1318 dev->wiphy.extended_capabilities_len,
1319 dev->wiphy.extended_capabilities_mask)))
1320 goto nla_put_failure;
1321
1322 return genlmsg_end(msg, hdr); 1301 return genlmsg_end(msg, hdr);
1323 1302
1324 nla_put_failure: 1303 nla_put_failure:
@@ -1328,7 +1307,7 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 portid, u32 seq, int flag
1328 1307
1329static int nl80211_dump_wiphy(struct sk_buff *skb, struct netlink_callback *cb) 1308static int nl80211_dump_wiphy(struct sk_buff *skb, struct netlink_callback *cb)
1330{ 1309{
1331 int idx = 0; 1310 int idx = 0, ret;
1332 int start = cb->args[0]; 1311 int start = cb->args[0];
1333 struct cfg80211_registered_device *dev; 1312 struct cfg80211_registered_device *dev;
1334 1313
@@ -1338,9 +1317,29 @@ static int nl80211_dump_wiphy(struct sk_buff *skb, struct netlink_callback *cb)
1338 continue; 1317 continue;
1339 if (++idx <= start) 1318 if (++idx <= start)
1340 continue; 1319 continue;
1341 if (nl80211_send_wiphy(skb, NETLINK_CB(cb->skb).portid, 1320 ret = nl80211_send_wiphy(skb, NETLINK_CB(cb->skb).portid,
1342 cb->nlh->nlmsg_seq, NLM_F_MULTI, 1321 cb->nlh->nlmsg_seq, NLM_F_MULTI,
1343 dev) < 0) { 1322 dev);
1323 if (ret < 0) {
1324 /*
1325 * If sending the wiphy data didn't fit (ENOBUFS or
1326 * EMSGSIZE returned), this SKB is still empty (so
1327 * it's not too big because another wiphy dataset is
1328 * already in the skb) and we've not tried to adjust
1329 * the dump allocation yet ... then adjust the alloc
1330 * size to be bigger, and return 1 but with the empty
1331 * skb. This results in an empty message being RX'ed
1332 * in userspace, but that is ignored.
1333 *
1334 * We can then retry with the larger buffer.
1335 */
1336 if ((ret == -ENOBUFS || ret == -EMSGSIZE) &&
1337 !skb->len &&
1338 cb->min_dump_alloc < 4096) {
1339 cb->min_dump_alloc = 4096;
1340 mutex_unlock(&cfg80211_mutex);
1341 return 1;
1342 }
1344 idx--; 1343 idx--;
1345 break; 1344 break;
1346 } 1345 }
@@ -1357,7 +1356,7 @@ static int nl80211_get_wiphy(struct sk_buff *skb, struct genl_info *info)
1357 struct sk_buff *msg; 1356 struct sk_buff *msg;
1358 struct cfg80211_registered_device *dev = info->user_ptr[0]; 1357 struct cfg80211_registered_device *dev = info->user_ptr[0];
1359 1358
1360 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); 1359 msg = nlmsg_new(4096, GFP_KERNEL);
1361 if (!msg) 1360 if (!msg)
1362 return -ENOMEM; 1361 return -ENOMEM;
1363 1362
diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
index 58dfe0890947..a571fad91010 100644
--- a/security/keys/process_keys.c
+++ b/security/keys/process_keys.c
@@ -839,7 +839,7 @@ void key_change_session_keyring(struct callback_head *twork)
839 new-> sgid = old-> sgid; 839 new-> sgid = old-> sgid;
840 new->fsgid = old->fsgid; 840 new->fsgid = old->fsgid;
841 new->user = get_uid(old->user); 841 new->user = get_uid(old->user);
842 new->user_ns = get_user_ns(new->user_ns); 842 new->user_ns = get_user_ns(old->user_ns);
843 new->group_info = get_group_info(old->group_info); 843 new->group_info = get_group_info(old->group_info);
844 844
845 new->securebits = old->securebits; 845 new->securebits = old->securebits;
diff --git a/sound/core/seq/oss/seq_oss_event.c b/sound/core/seq/oss/seq_oss_event.c
index 066f5f3e3f4c..c3908862bc8b 100644
--- a/sound/core/seq/oss/seq_oss_event.c
+++ b/sound/core/seq/oss/seq_oss_event.c
@@ -285,7 +285,12 @@ local_event(struct seq_oss_devinfo *dp, union evrec *q, struct snd_seq_event *ev
285static int 285static int
286note_on_event(struct seq_oss_devinfo *dp, int dev, int ch, int note, int vel, struct snd_seq_event *ev) 286note_on_event(struct seq_oss_devinfo *dp, int dev, int ch, int note, int vel, struct snd_seq_event *ev)
287{ 287{
288 struct seq_oss_synthinfo *info = &dp->synths[dev]; 288 struct seq_oss_synthinfo *info;
289
290 if (!snd_seq_oss_synth_is_valid(dp, dev))
291 return -ENXIO;
292
293 info = &dp->synths[dev];
289 switch (info->arg.event_passing) { 294 switch (info->arg.event_passing) {
290 case SNDRV_SEQ_OSS_PROCESS_EVENTS: 295 case SNDRV_SEQ_OSS_PROCESS_EVENTS:
291 if (! info->ch || ch < 0 || ch >= info->nr_voices) { 296 if (! info->ch || ch < 0 || ch >= info->nr_voices) {
@@ -340,7 +345,12 @@ note_on_event(struct seq_oss_devinfo *dp, int dev, int ch, int note, int vel, st
340static int 345static int
341note_off_event(struct seq_oss_devinfo *dp, int dev, int ch, int note, int vel, struct snd_seq_event *ev) 346note_off_event(struct seq_oss_devinfo *dp, int dev, int ch, int note, int vel, struct snd_seq_event *ev)
342{ 347{
343 struct seq_oss_synthinfo *info = &dp->synths[dev]; 348 struct seq_oss_synthinfo *info;
349
350 if (!snd_seq_oss_synth_is_valid(dp, dev))
351 return -ENXIO;
352
353 info = &dp->synths[dev];
344 switch (info->arg.event_passing) { 354 switch (info->arg.event_passing) {
345 case SNDRV_SEQ_OSS_PROCESS_EVENTS: 355 case SNDRV_SEQ_OSS_PROCESS_EVENTS:
346 if (! info->ch || ch < 0 || ch >= info->nr_voices) { 356 if (! info->ch || ch < 0 || ch >= info->nr_voices) {
diff --git a/sound/core/vmaster.c b/sound/core/vmaster.c
index 857586135d18..0097f3619faa 100644
--- a/sound/core/vmaster.c
+++ b/sound/core/vmaster.c
@@ -213,7 +213,10 @@ static int slave_put(struct snd_kcontrol *kcontrol,
213 } 213 }
214 if (!changed) 214 if (!changed)
215 return 0; 215 return 0;
216 return slave_put_val(slave, ucontrol); 216 err = slave_put_val(slave, ucontrol);
217 if (err < 0)
218 return err;
219 return 1;
217} 220}
218 221
219static int slave_tlv_cmd(struct snd_kcontrol *kcontrol, 222static int slave_tlv_cmd(struct snd_kcontrol *kcontrol,
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 04b57383e8cb..97c68dd24ef5 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -3334,6 +3334,8 @@ int snd_hda_create_dig_out_ctls(struct hda_codec *codec,
3334 return -EBUSY; 3334 return -EBUSY;
3335 } 3335 }
3336 spdif = snd_array_new(&codec->spdif_out); 3336 spdif = snd_array_new(&codec->spdif_out);
3337 if (!spdif)
3338 return -ENOMEM;
3337 for (dig_mix = dig_mixes; dig_mix->name; dig_mix++) { 3339 for (dig_mix = dig_mixes; dig_mix->name; dig_mix++) {
3338 kctl = snd_ctl_new1(dig_mix, codec); 3340 kctl = snd_ctl_new1(dig_mix, codec);
3339 if (!kctl) 3341 if (!kctl)
@@ -3431,11 +3433,16 @@ static struct snd_kcontrol_new spdif_share_sw = {
3431int snd_hda_create_spdif_share_sw(struct hda_codec *codec, 3433int snd_hda_create_spdif_share_sw(struct hda_codec *codec,
3432 struct hda_multi_out *mout) 3434 struct hda_multi_out *mout)
3433{ 3435{
3436 struct snd_kcontrol *kctl;
3437
3434 if (!mout->dig_out_nid) 3438 if (!mout->dig_out_nid)
3435 return 0; 3439 return 0;
3440
3441 kctl = snd_ctl_new1(&spdif_share_sw, mout);
3442 if (!kctl)
3443 return -ENOMEM;
3436 /* ATTENTION: here mout is passed as private_data, instead of codec */ 3444 /* ATTENTION: here mout is passed as private_data, instead of codec */
3437 return snd_hda_ctl_add(codec, mout->dig_out_nid, 3445 return snd_hda_ctl_add(codec, mout->dig_out_nid, kctl);
3438 snd_ctl_new1(&spdif_share_sw, mout));
3439} 3446}
3440EXPORT_SYMBOL_HDA(snd_hda_create_spdif_share_sw); 3447EXPORT_SYMBOL_HDA(snd_hda_create_spdif_share_sw);
3441 3448
diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
index db02c1e96b08..eefc4563b2f9 100644
--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -2298,6 +2298,11 @@ static int dspxfr_one_seg(struct hda_codec *codec,
2298 hda_frame_size_words = ((sample_rate_div == 0) ? 0 : 2298 hda_frame_size_words = ((sample_rate_div == 0) ? 0 :
2299 (num_chans * sample_rate_mul / sample_rate_div)); 2299 (num_chans * sample_rate_mul / sample_rate_div));
2300 2300
2301 if (hda_frame_size_words == 0) {
2302 snd_printdd(KERN_ERR "frmsz zero\n");
2303 return -EINVAL;
2304 }
2305
2301 buffer_size_words = min(buffer_size_words, 2306 buffer_size_words = min(buffer_size_words,
2302 (unsigned int)(UC_RANGE(chip_addx, 1) ? 2307 (unsigned int)(UC_RANGE(chip_addx, 1) ?
2303 65536 : 32768)); 2308 65536 : 32768));
@@ -2308,8 +2313,7 @@ static int dspxfr_one_seg(struct hda_codec *codec,
2308 chip_addx, hda_frame_size_words, num_chans, 2313 chip_addx, hda_frame_size_words, num_chans,
2309 sample_rate_mul, sample_rate_div, buffer_size_words); 2314 sample_rate_mul, sample_rate_div, buffer_size_words);
2310 2315
2311 if ((buffer_addx == NULL) || (hda_frame_size_words == 0) || 2316 if (buffer_size_words < hda_frame_size_words) {
2312 (buffer_size_words < hda_frame_size_words)) {
2313 snd_printdd(KERN_ERR "dspxfr_one_seg:failed\n"); 2317 snd_printdd(KERN_ERR "dspxfr_one_seg:failed\n");
2314 return -EINVAL; 2318 return -EINVAL;
2315 } 2319 }
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 2d4237bc0d8e..563c24df4d6f 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -3163,6 +3163,7 @@ static int patch_alc269(struct hda_codec *codec)
3163 case 0x10ec0290: 3163 case 0x10ec0290:
3164 spec->codec_variant = ALC269_TYPE_ALC280; 3164 spec->codec_variant = ALC269_TYPE_ALC280;
3165 break; 3165 break;
3166 case 0x10ec0233:
3166 case 0x10ec0282: 3167 case 0x10ec0282:
3167 case 0x10ec0283: 3168 case 0x10ec0283:
3168 spec->codec_variant = ALC269_TYPE_ALC282; 3169 spec->codec_variant = ALC269_TYPE_ALC282;
@@ -3862,6 +3863,7 @@ static int patch_alc680(struct hda_codec *codec)
3862 */ 3863 */
3863static const struct hda_codec_preset snd_hda_preset_realtek[] = { 3864static const struct hda_codec_preset snd_hda_preset_realtek[] = {
3864 { .id = 0x10ec0221, .name = "ALC221", .patch = patch_alc269 }, 3865 { .id = 0x10ec0221, .name = "ALC221", .patch = patch_alc269 },
3866 { .id = 0x10ec0233, .name = "ALC233", .patch = patch_alc269 },
3865 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, 3867 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
3866 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, 3868 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
3867 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, 3869 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
index 2ffdc35d5ffd..806407a3973e 100644
--- a/sound/pci/ice1712/ice1712.c
+++ b/sound/pci/ice1712/ice1712.c
@@ -2594,6 +2594,8 @@ static int snd_ice1712_create(struct snd_card *card,
2594 snd_ice1712_proc_init(ice); 2594 snd_ice1712_proc_init(ice);
2595 synchronize_irq(pci->irq); 2595 synchronize_irq(pci->irq);
2596 2596
2597 card->private_data = ice;
2598
2597 err = pci_request_regions(pci, "ICE1712"); 2599 err = pci_request_regions(pci, "ICE1712");
2598 if (err < 0) { 2600 if (err < 0) {
2599 kfree(ice); 2601 kfree(ice);
diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c
index b8d461db369f..b82bbf584146 100644
--- a/sound/soc/codecs/wm5102.c
+++ b/sound/soc/codecs/wm5102.c
@@ -573,6 +573,13 @@ static const struct reg_default wm5102_sysclk_reva_patch[] = {
573 { 0x025e, 0x0112 }, 573 { 0x025e, 0x0112 },
574}; 574};
575 575
576static const struct reg_default wm5102_sysclk_revb_patch[] = {
577 { 0x3081, 0x08FE },
578 { 0x3083, 0x00ED },
579 { 0x30C1, 0x08FE },
580 { 0x30C3, 0x00ED },
581};
582
576static int wm5102_sysclk_ev(struct snd_soc_dapm_widget *w, 583static int wm5102_sysclk_ev(struct snd_soc_dapm_widget *w,
577 struct snd_kcontrol *kcontrol, int event) 584 struct snd_kcontrol *kcontrol, int event)
578{ 585{
@@ -587,6 +594,10 @@ static int wm5102_sysclk_ev(struct snd_soc_dapm_widget *w,
587 patch = wm5102_sysclk_reva_patch; 594 patch = wm5102_sysclk_reva_patch;
588 patch_size = ARRAY_SIZE(wm5102_sysclk_reva_patch); 595 patch_size = ARRAY_SIZE(wm5102_sysclk_reva_patch);
589 break; 596 break;
597 default:
598 patch = wm5102_sysclk_revb_patch;
599 patch_size = ARRAY_SIZE(wm5102_sysclk_revb_patch);
600 break;
590 } 601 }
591 602
592 switch (event) { 603 switch (event) {
@@ -755,7 +766,7 @@ SOC_SINGLE("SPKDAT1 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_5L,
755 766
756SOC_DOUBLE_R("HPOUT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_1L, 767SOC_DOUBLE_R("HPOUT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_1L,
757 ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_MUTE_SHIFT, 1, 1), 768 ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_MUTE_SHIFT, 1, 1),
758SOC_DOUBLE_R("OUT2 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_2L, 769SOC_DOUBLE_R("HPOUT2 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_2L,
759 ARIZONA_DAC_DIGITAL_VOLUME_2R, ARIZONA_OUT2L_MUTE_SHIFT, 1, 1), 770 ARIZONA_DAC_DIGITAL_VOLUME_2R, ARIZONA_OUT2L_MUTE_SHIFT, 1, 1),
760SOC_SINGLE("EPOUT Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_3L, 771SOC_SINGLE("EPOUT Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_3L,
761 ARIZONA_OUT3L_MUTE_SHIFT, 1, 1), 772 ARIZONA_OUT3L_MUTE_SHIFT, 1, 1),
@@ -767,7 +778,7 @@ SOC_DOUBLE_R("SPKDAT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_5L,
767SOC_DOUBLE_R_TLV("HPOUT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_1L, 778SOC_DOUBLE_R_TLV("HPOUT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_1L,
768 ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_VOL_SHIFT, 779 ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_VOL_SHIFT,
769 0xbf, 0, digital_tlv), 780 0xbf, 0, digital_tlv),
770SOC_DOUBLE_R_TLV("OUT2 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_2L, 781SOC_DOUBLE_R_TLV("HPOUT2 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_2L,
771 ARIZONA_DAC_DIGITAL_VOLUME_2R, ARIZONA_OUT2L_VOL_SHIFT, 782 ARIZONA_DAC_DIGITAL_VOLUME_2R, ARIZONA_OUT2L_VOL_SHIFT,
772 0xbf, 0, digital_tlv), 783 0xbf, 0, digital_tlv),
773SOC_SINGLE_TLV("EPOUT Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_3L, 784SOC_SINGLE_TLV("EPOUT Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_3L,
diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c
index cd17b477781d..cdeb301da1f6 100644
--- a/sound/soc/codecs/wm5110.c
+++ b/sound/soc/codecs/wm5110.c
@@ -213,9 +213,9 @@ ARIZONA_MIXER_CONTROLS("SPKDAT2R", ARIZONA_OUT6RMIX_INPUT_1_SOURCE),
213 213
214SOC_SINGLE("HPOUT1 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_1L, 214SOC_SINGLE("HPOUT1 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_1L,
215 ARIZONA_OUT1_OSR_SHIFT, 1, 0), 215 ARIZONA_OUT1_OSR_SHIFT, 1, 0),
216SOC_SINGLE("OUT2 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_2L, 216SOC_SINGLE("HPOUT2 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_2L,
217 ARIZONA_OUT2_OSR_SHIFT, 1, 0), 217 ARIZONA_OUT2_OSR_SHIFT, 1, 0),
218SOC_SINGLE("OUT3 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_3L, 218SOC_SINGLE("HPOUT3 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_3L,
219 ARIZONA_OUT3_OSR_SHIFT, 1, 0), 219 ARIZONA_OUT3_OSR_SHIFT, 1, 0),
220SOC_SINGLE("Speaker High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_4L, 220SOC_SINGLE("Speaker High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_4L,
221 ARIZONA_OUT4_OSR_SHIFT, 1, 0), 221 ARIZONA_OUT4_OSR_SHIFT, 1, 0),
@@ -226,9 +226,9 @@ SOC_SINGLE("SPKDAT2 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_6L,
226 226
227SOC_DOUBLE_R("HPOUT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_1L, 227SOC_DOUBLE_R("HPOUT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_1L,
228 ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_MUTE_SHIFT, 1, 1), 228 ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_MUTE_SHIFT, 1, 1),
229SOC_DOUBLE_R("OUT2 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_2L, 229SOC_DOUBLE_R("HPOUT2 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_2L,
230 ARIZONA_DAC_DIGITAL_VOLUME_2R, ARIZONA_OUT2L_MUTE_SHIFT, 1, 1), 230 ARIZONA_DAC_DIGITAL_VOLUME_2R, ARIZONA_OUT2L_MUTE_SHIFT, 1, 1),
231SOC_DOUBLE_R("OUT3 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_3L, 231SOC_DOUBLE_R("HPOUT3 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_3L,
232 ARIZONA_DAC_DIGITAL_VOLUME_3R, ARIZONA_OUT3L_MUTE_SHIFT, 1, 1), 232 ARIZONA_DAC_DIGITAL_VOLUME_3R, ARIZONA_OUT3L_MUTE_SHIFT, 1, 1),
233SOC_DOUBLE_R("Speaker Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_4L, 233SOC_DOUBLE_R("Speaker Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_4L,
234 ARIZONA_DAC_DIGITAL_VOLUME_4R, ARIZONA_OUT4L_MUTE_SHIFT, 1, 1), 234 ARIZONA_DAC_DIGITAL_VOLUME_4R, ARIZONA_OUT4L_MUTE_SHIFT, 1, 1),
@@ -240,10 +240,10 @@ SOC_DOUBLE_R("SPKDAT2 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_6L,
240SOC_DOUBLE_R_TLV("HPOUT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_1L, 240SOC_DOUBLE_R_TLV("HPOUT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_1L,
241 ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_VOL_SHIFT, 241 ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_VOL_SHIFT,
242 0xbf, 0, digital_tlv), 242 0xbf, 0, digital_tlv),
243SOC_DOUBLE_R_TLV("OUT2 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_2L, 243SOC_DOUBLE_R_TLV("HPOUT2 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_2L,
244 ARIZONA_DAC_DIGITAL_VOLUME_2R, ARIZONA_OUT2L_VOL_SHIFT, 244 ARIZONA_DAC_DIGITAL_VOLUME_2R, ARIZONA_OUT2L_VOL_SHIFT,
245 0xbf, 0, digital_tlv), 245 0xbf, 0, digital_tlv),
246SOC_DOUBLE_R_TLV("OUT3 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_3L, 246SOC_DOUBLE_R_TLV("HPOUT3 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_3L,
247 ARIZONA_DAC_DIGITAL_VOLUME_3R, ARIZONA_OUT3L_VOL_SHIFT, 247 ARIZONA_DAC_DIGITAL_VOLUME_3R, ARIZONA_OUT3L_VOL_SHIFT,
248 0xbf, 0, digital_tlv), 248 0xbf, 0, digital_tlv),
249SOC_DOUBLE_R_TLV("Speaker Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_4L, 249SOC_DOUBLE_R_TLV("Speaker Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_4L,
@@ -260,11 +260,11 @@ SOC_DOUBLE_R_RANGE_TLV("HPOUT1 Volume", ARIZONA_OUTPUT_PATH_CONFIG_1L,
260 ARIZONA_OUTPUT_PATH_CONFIG_1R, 260 ARIZONA_OUTPUT_PATH_CONFIG_1R,
261 ARIZONA_OUT1L_PGA_VOL_SHIFT, 261 ARIZONA_OUT1L_PGA_VOL_SHIFT,
262 0x34, 0x40, 0, ana_tlv), 262 0x34, 0x40, 0, ana_tlv),
263SOC_DOUBLE_R_RANGE_TLV("OUT2 Volume", ARIZONA_OUTPUT_PATH_CONFIG_2L, 263SOC_DOUBLE_R_RANGE_TLV("HPOUT2 Volume", ARIZONA_OUTPUT_PATH_CONFIG_2L,
264 ARIZONA_OUTPUT_PATH_CONFIG_2R, 264 ARIZONA_OUTPUT_PATH_CONFIG_2R,
265 ARIZONA_OUT2L_PGA_VOL_SHIFT, 265 ARIZONA_OUT2L_PGA_VOL_SHIFT,
266 0x34, 0x40, 0, ana_tlv), 266 0x34, 0x40, 0, ana_tlv),
267SOC_DOUBLE_R_RANGE_TLV("OUT3 Volume", ARIZONA_OUTPUT_PATH_CONFIG_3L, 267SOC_DOUBLE_R_RANGE_TLV("HPOUT3 Volume", ARIZONA_OUTPUT_PATH_CONFIG_3L,
268 ARIZONA_OUTPUT_PATH_CONFIG_3R, 268 ARIZONA_OUTPUT_PATH_CONFIG_3R,
269 ARIZONA_OUT3L_PGA_VOL_SHIFT, 0x34, 0x40, 0, ana_tlv), 269 ARIZONA_OUT3L_PGA_VOL_SHIFT, 0x34, 0x40, 0, ana_tlv),
270 270
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c
index ec0efc1443ba..0e8b3aaf6c8d 100644
--- a/sound/soc/codecs/wm8350.c
+++ b/sound/soc/codecs/wm8350.c
@@ -1301,7 +1301,7 @@ static irqreturn_t wm8350_hpl_jack_handler(int irq, void *data)
1301 if (device_may_wakeup(wm8350->dev)) 1301 if (device_may_wakeup(wm8350->dev))
1302 pm_wakeup_event(wm8350->dev, 250); 1302 pm_wakeup_event(wm8350->dev, 250);
1303 1303
1304 schedule_delayed_work(&priv->hpl.work, 200); 1304 schedule_delayed_work(&priv->hpl.work, msecs_to_jiffies(200));
1305 1305
1306 return IRQ_HANDLED; 1306 return IRQ_HANDLED;
1307} 1307}
@@ -1318,7 +1318,7 @@ static irqreturn_t wm8350_hpr_jack_handler(int irq, void *data)
1318 if (device_may_wakeup(wm8350->dev)) 1318 if (device_may_wakeup(wm8350->dev))
1319 pm_wakeup_event(wm8350->dev, 250); 1319 pm_wakeup_event(wm8350->dev, 250);
1320 1320
1321 schedule_delayed_work(&priv->hpr.work, 200); 1321 schedule_delayed_work(&priv->hpr.work, msecs_to_jiffies(200));
1322 1322
1323 return IRQ_HANDLED; 1323 return IRQ_HANDLED;
1324} 1324}
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index 9bb927325993..a64b93425ae3 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -53,8 +53,8 @@
53 * using 2 wire for device control, so we cache them instead. 53 * using 2 wire for device control, so we cache them instead.
54 */ 54 */
55static const struct reg_default wm8960_reg_defaults[] = { 55static const struct reg_default wm8960_reg_defaults[] = {
56 { 0x0, 0x0097 }, 56 { 0x0, 0x00a7 },
57 { 0x1, 0x0097 }, 57 { 0x1, 0x00a7 },
58 { 0x2, 0x0000 }, 58 { 0x2, 0x0000 },
59 { 0x3, 0x0000 }, 59 { 0x3, 0x0000 },
60 { 0x4, 0x0000 }, 60 { 0x4, 0x0000 },
@@ -323,8 +323,8 @@ SND_SOC_DAPM_MIXER("Left Input Mixer", WM8960_POWER3, 5, 0,
323SND_SOC_DAPM_MIXER("Right Input Mixer", WM8960_POWER3, 4, 0, 323SND_SOC_DAPM_MIXER("Right Input Mixer", WM8960_POWER3, 4, 0,
324 wm8960_rin, ARRAY_SIZE(wm8960_rin)), 324 wm8960_rin, ARRAY_SIZE(wm8960_rin)),
325 325
326SND_SOC_DAPM_ADC("Left ADC", "Capture", WM8960_POWER2, 3, 0), 326SND_SOC_DAPM_ADC("Left ADC", "Capture", WM8960_POWER1, 3, 0),
327SND_SOC_DAPM_ADC("Right ADC", "Capture", WM8960_POWER2, 2, 0), 327SND_SOC_DAPM_ADC("Right ADC", "Capture", WM8960_POWER1, 2, 0),
328 328
329SND_SOC_DAPM_DAC("Left DAC", "Playback", WM8960_POWER2, 8, 0), 329SND_SOC_DAPM_DAC("Left DAC", "Playback", WM8960_POWER2, 8, 0),
330SND_SOC_DAPM_DAC("Right DAC", "Playback", WM8960_POWER2, 7, 0), 330SND_SOC_DAPM_DAC("Right DAC", "Playback", WM8960_POWER2, 7, 0),
diff --git a/sound/soc/tegra/tegra20_i2s.h b/sound/soc/tegra/tegra20_i2s.h
index c27069d24d77..729958713cd4 100644
--- a/sound/soc/tegra/tegra20_i2s.h
+++ b/sound/soc/tegra/tegra20_i2s.h
@@ -121,7 +121,7 @@
121 121
122#define TEGRA20_I2S_TIMING_NON_SYM_ENABLE (1 << 12) 122#define TEGRA20_I2S_TIMING_NON_SYM_ENABLE (1 << 12)
123#define TEGRA20_I2S_TIMING_CHANNEL_BIT_COUNT_SHIFT 0 123#define TEGRA20_I2S_TIMING_CHANNEL_BIT_COUNT_SHIFT 0
124#define TEGRA20_I2S_TIMING_CHANNEL_BIT_COUNT_MASK_US 0x7fff 124#define TEGRA20_I2S_TIMING_CHANNEL_BIT_COUNT_MASK_US 0x7ff
125#define TEGRA20_I2S_TIMING_CHANNEL_BIT_COUNT_MASK (TEGRA20_I2S_TIMING_CHANNEL_BIT_COUNT_MASK_US << TEGRA20_I2S_TIMING_CHANNEL_BIT_COUNT_SHIFT) 125#define TEGRA20_I2S_TIMING_CHANNEL_BIT_COUNT_MASK (TEGRA20_I2S_TIMING_CHANNEL_BIT_COUNT_MASK_US << TEGRA20_I2S_TIMING_CHANNEL_BIT_COUNT_SHIFT)
126 126
127/* Fields in TEGRA20_I2S_FIFO_SCR */ 127/* Fields in TEGRA20_I2S_FIFO_SCR */
diff --git a/sound/soc/tegra/tegra30_i2s.h b/sound/soc/tegra/tegra30_i2s.h
index 34dc47b9581c..a294d942b9f7 100644
--- a/sound/soc/tegra/tegra30_i2s.h
+++ b/sound/soc/tegra/tegra30_i2s.h
@@ -110,7 +110,7 @@
110 110
111#define TEGRA30_I2S_TIMING_NON_SYM_ENABLE (1 << 12) 111#define TEGRA30_I2S_TIMING_NON_SYM_ENABLE (1 << 12)
112#define TEGRA30_I2S_TIMING_CHANNEL_BIT_COUNT_SHIFT 0 112#define TEGRA30_I2S_TIMING_CHANNEL_BIT_COUNT_SHIFT 0
113#define TEGRA30_I2S_TIMING_CHANNEL_BIT_COUNT_MASK_US 0x7fff 113#define TEGRA30_I2S_TIMING_CHANNEL_BIT_COUNT_MASK_US 0x7ff
114#define TEGRA30_I2S_TIMING_CHANNEL_BIT_COUNT_MASK (TEGRA30_I2S_TIMING_CHANNEL_BIT_COUNT_MASK_US << TEGRA30_I2S_TIMING_CHANNEL_BIT_COUNT_SHIFT) 114#define TEGRA30_I2S_TIMING_CHANNEL_BIT_COUNT_MASK (TEGRA30_I2S_TIMING_CHANNEL_BIT_COUNT_MASK_US << TEGRA30_I2S_TIMING_CHANNEL_BIT_COUNT_SHIFT)
115 115
116/* Fields in TEGRA30_I2S_OFFSET */ 116/* Fields in TEGRA30_I2S_OFFSET */
diff --git a/tools/testing/selftests/efivarfs/efivarfs.sh b/tools/testing/selftests/efivarfs/efivarfs.sh
index 880cdd5dc63f..77edcdcc016b 100644
--- a/tools/testing/selftests/efivarfs/efivarfs.sh
+++ b/tools/testing/selftests/efivarfs/efivarfs.sh
@@ -125,6 +125,63 @@ test_open_unlink()
125 ./open-unlink $file 125 ./open-unlink $file
126} 126}
127 127
128# test that we can create a range of filenames
129test_valid_filenames()
130{
131 local attrs='\x07\x00\x00\x00'
132 local ret=0
133
134 local file_list="abc dump-type0-11-1-1362436005 1234 -"
135 for f in $file_list; do
136 local file=$efivarfs_mount/$f-$test_guid
137
138 printf "$attrs\x00" > $file
139
140 if [ ! -e $file ]; then
141 echo "$file could not be created" >&2
142 ret=1
143 else
144 rm $file
145 fi
146 done
147
148 exit $ret
149}
150
151test_invalid_filenames()
152{
153 local attrs='\x07\x00\x00\x00'
154 local ret=0
155
156 local file_list="
157 -1234-1234-1234-123456789abc
158 foo
159 foo-bar
160 -foo-
161 foo-barbazba-foob-foob-foob-foobarbazfoo
162 foo-------------------------------------
163 -12345678-1234-1234-1234-123456789abc
164 a-12345678=1234-1234-1234-123456789abc
165 a-12345678-1234=1234-1234-123456789abc
166 a-12345678-1234-1234=1234-123456789abc
167 a-12345678-1234-1234-1234=123456789abc
168 1112345678-1234-1234-1234-123456789abc"
169
170 for f in $file_list; do
171 local file=$efivarfs_mount/$f
172
173 printf "$attrs\x00" 2>/dev/null > $file
174
175 if [ -e $file ]; then
176 echo "Creating $file should have failed" >&2
177 rm $file
178 ret=1
179 fi
180 done
181
182 exit $ret
183}
184
128check_prereqs 185check_prereqs
129 186
130rc=0 187rc=0
@@ -135,5 +192,7 @@ run_test test_create_read
135run_test test_delete 192run_test test_delete
136run_test test_zero_size_delete 193run_test test_zero_size_delete
137run_test test_open_unlink 194run_test test_open_unlink
195run_test test_valid_filenames
196run_test test_invalid_filenames
138 197
139exit $rc 198exit $rc