aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CREDITS8
-rw-r--r--Documentation/devicetree/bindings/mfd/ab8500.txt6
-rw-r--r--Documentation/devicetree/bindings/tty/serial/of-serial.txt3
-rw-r--r--Documentation/hwmon/lm752
-rw-r--r--MAINTAINERS42
-rw-r--r--Makefile2
-rw-r--r--arch/Kconfig7
-rw-r--r--arch/alpha/Kconfig2
-rw-r--r--arch/arm/Kconfig22
-rw-r--r--arch/arm/Kconfig.debug2
-rw-r--r--arch/arm/boot/Makefile2
-rw-r--r--arch/arm/boot/dts/armada-370-rd.dts8
-rw-r--r--arch/arm/boot/dts/armada-370-xp.dtsi5
-rw-r--r--arch/arm/boot/dts/armada-xp.dtsi4
-rw-r--r--arch/arm/boot/dts/at91sam9x5.dtsi28
-rw-r--r--arch/arm/boot/dts/bcm2835.dtsi2
-rw-r--r--arch/arm/boot/dts/dbx5x0.dtsi3
-rw-r--r--arch/arm/boot/dts/dove.dtsi5
-rw-r--r--arch/arm/boot/dts/exynos4.dtsi9
-rw-r--r--arch/arm/boot/dts/exynos5440.dtsi6
-rw-r--r--arch/arm/boot/dts/href.dtsi2
-rw-r--r--arch/arm/boot/dts/hrefv60plus.dts2
-rw-r--r--arch/arm/boot/dts/imx53-mba53.dts3
-rw-r--r--arch/arm/boot/dts/kirkwood-dns320.dts2
-rw-r--r--arch/arm/boot/dts/kirkwood-dns325.dts1
-rw-r--r--arch/arm/boot/dts/kirkwood-dockstar.dts1
-rw-r--r--arch/arm/boot/dts/kirkwood-dreamplug.dts1
-rw-r--r--arch/arm/boot/dts/kirkwood-goflexnet.dts1
-rw-r--r--arch/arm/boot/dts/kirkwood-ib62x0.dts1
-rw-r--r--arch/arm/boot/dts/kirkwood-iconnect.dts1
-rw-r--r--arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts1
-rw-r--r--arch/arm/boot/dts/kirkwood-km_kirkwood.dts1
-rw-r--r--arch/arm/boot/dts/kirkwood-lschlv2.dts1
-rw-r--r--arch/arm/boot/dts/kirkwood-lsxhl.dts1
-rw-r--r--arch/arm/boot/dts/kirkwood-mplcec4.dts1
-rw-r--r--arch/arm/boot/dts/kirkwood-ns2-common.dtsi1
-rw-r--r--arch/arm/boot/dts/kirkwood-nsa310.dts1
-rw-r--r--arch/arm/boot/dts/kirkwood-openblocks_a6.dts2
-rw-r--r--arch/arm/boot/dts/kirkwood-topkick.dts1
-rw-r--r--arch/arm/boot/dts/kirkwood.dtsi5
-rw-r--r--arch/arm/boot/dts/orion5x-lacie-ethernet-disk-mini-v2.dts2
-rw-r--r--arch/arm/boot/dts/snowball.dts2
-rw-r--r--arch/arm/boot/dts/socfpga.dtsi3
-rw-r--r--arch/arm/boot/dts/tegra20.dtsi1
-rw-r--r--arch/arm/boot/dts/tegra30.dtsi1
-rw-r--r--arch/arm/configs/mxs_defconfig1
-rw-r--r--arch/arm/configs/omap2plus_defconfig2
-rw-r--r--arch/arm/include/asm/xen/events.h25
-rw-r--r--arch/arm/kernel/smp.c2
-rw-r--r--arch/arm/lib/memset.S33
-rw-r--r--arch/arm/mach-at91/board-foxg20.c1
-rw-r--r--arch/arm/mach-at91/board-stamp9g20.c1
-rw-r--r--arch/arm/mach-at91/include/mach/gpio.h8
-rw-r--r--arch/arm/mach-at91/irq.c20
-rw-r--r--arch/arm/mach-at91/pm.c10
-rw-r--r--arch/arm/mach-davinci/dma.c3
-rw-r--r--arch/arm/mach-footbridge/Kconfig1
-rw-r--r--arch/arm/mach-imx/clk-imx35.c1
-rw-r--r--arch/arm/mach-imx/clk-imx6q.c2
-rw-r--r--arch/arm/mach-imx/headsmp.S18
-rw-r--r--arch/arm/mach-imx/imx25-dt.c5
-rw-r--r--arch/arm/mach-imx/pm-imx6q.c15
-rw-r--r--arch/arm/mach-ixp4xx/vulcan-setup.c1
-rw-r--r--arch/arm/mach-kirkwood/board-dt.c25
-rw-r--r--arch/arm/mach-mmp/gplugd.c1
-rw-r--r--arch/arm/mach-mxs/icoll.c2
-rw-r--r--arch/arm/mach-mxs/mach-mxs.c10
-rw-r--r--arch/arm/mach-mxs/mm.c1
-rw-r--r--arch/arm/mach-mxs/ocotp.c1
-rw-r--r--arch/arm/mach-omap1/common.h2
-rw-r--r--arch/arm/mach-omap2/Kconfig6
-rw-r--r--arch/arm/mach-omap2/board-generic.c2
-rw-r--r--arch/arm/mach-omap2/board-rx51.c2
-rw-r--r--arch/arm/mach-omap2/common.h1
-rw-r--r--arch/arm/mach-omap2/gpmc.c6
-rw-r--r--arch/arm/mach-omap2/mux.c9
-rw-r--r--arch/arm/mach-pxa/raumfeld.c1
-rw-r--r--arch/arm/mach-s5pv210/clock.c36
-rw-r--r--arch/arm/mach-s5pv210/mach-goni.c2
-rw-r--r--arch/arm/mach-shmobile/board-marzen.c1
-rw-r--r--arch/arm/mach-spear3xx/spear3xx.c2
-rw-r--r--arch/arm/mm/dma-mapping.c5
-rw-r--r--arch/arm/plat-orion/addr-map.c7
-rw-r--r--arch/arm/plat-spear/Kconfig2
-rw-r--r--arch/arm64/Kconfig1
-rw-r--r--arch/arm64/Kconfig.debug11
-rw-r--r--arch/arm64/configs/defconfig1
-rw-r--r--arch/arm64/include/asm/ucontext.h2
-rw-r--r--arch/arm64/kernel/arm64ksyms.c2
-rw-r--r--arch/arm64/kernel/signal32.c1
-rw-r--r--arch/avr32/Kconfig2
-rw-r--r--arch/blackfin/Kconfig2
-rw-r--r--arch/cris/Kconfig2
-rw-r--r--arch/frv/Kconfig2
-rw-r--r--arch/h8300/Kconfig2
-rw-r--r--arch/ia64/Kconfig2
-rw-r--r--arch/m32r/Kconfig2
-rw-r--r--arch/m32r/include/uapi/asm/stat.h4
-rw-r--r--arch/m68k/Kconfig2
-rw-r--r--arch/m68k/Kconfig.machine1
-rw-r--r--arch/m68k/include/asm/MC68328.h10
-rw-r--r--arch/m68k/kernel/setup_no.c3
-rw-r--r--arch/m68k/mm/init.c2
-rw-r--r--arch/m68k/platform/coldfire/m528x.c2
-rw-r--r--arch/microblaze/Kconfig2
-rw-r--r--arch/mips/Kconfig2
-rw-r--r--arch/mn10300/Kconfig2
-rw-r--r--arch/openrisc/Kconfig3
-rw-r--r--arch/parisc/Kconfig2
-rw-r--r--arch/powerpc/Kconfig3
-rw-r--r--arch/powerpc/include/asm/mmu-hash64.h128
-rw-r--r--arch/powerpc/kernel/cputable.c2
-rw-r--r--arch/powerpc/kernel/exceptions-64s.S34
-rw-r--r--arch/powerpc/kernel/prom_init.c14
-rw-r--r--arch/powerpc/kernel/ptrace.c1
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu_host.c4
-rw-r--r--arch/powerpc/mm/hash_utils_64.c22
-rw-r--r--arch/powerpc/mm/mmu_context_hash64.c11
-rw-r--r--arch/powerpc/mm/pgtable_64.c2
-rw-r--r--arch/powerpc/mm/slb_low.S50
-rw-r--r--arch/powerpc/mm/tlb_hash64.c2
-rw-r--r--arch/powerpc/platforms/85xx/sgy_cts1000.c6
-rw-r--r--arch/powerpc/platforms/Kconfig.cputype6
-rw-r--r--arch/s390/Kconfig2
-rw-r--r--arch/s390/include/asm/eadm.h6
-rw-r--r--arch/s390/include/asm/tlbflush.h2
-rw-r--r--arch/s390/kernel/entry.S3
-rw-r--r--arch/s390/kernel/entry64.S5
-rw-r--r--arch/s390/kernel/setup.c2
-rw-r--r--arch/score/Kconfig2
-rw-r--r--arch/sparc/Kconfig8
-rw-r--r--arch/sparc/include/asm/spitfire.h1
-rw-r--r--arch/sparc/kernel/cpu.c6
-rw-r--r--arch/sparc/kernel/head_64.S25
-rw-r--r--arch/sparc/kernel/leon_pci_grpci2.c41
-rw-r--r--arch/tile/Kconfig2
-rw-r--r--arch/unicore32/Kconfig2
-rw-r--r--arch/x86/Kconfig2
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_ds.c10
-rw-r--r--arch/x86/power/cpu.c2
-rw-r--r--arch/xtensa/Kconfig2
-rw-r--r--drivers/acpi/processor_perflib.c4
-rw-r--r--drivers/amba/tegra-ahb.c2
-rw-r--r--drivers/bluetooth/ath3k.c4
-rw-r--r--drivers/bluetooth/btusb.c2
-rw-r--r--drivers/char/hw_random/virtio-rng.c13
-rw-r--r--drivers/clk/clk-vt8500.c2
-rw-r--r--drivers/clk/tegra/clk-tegra20.c1
-rw-r--r--drivers/clk/tegra/clk-tegra30.c1
-rw-r--r--drivers/gpio/gpio-mvebu.c7
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/disp/nv50.c4
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_abi16.c5
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bo.c4
-rw-r--r--drivers/gpu/drm/nouveau/nv50_display.c1
-rw-r--r--drivers/hwmon/lineage-pem.c2
-rw-r--r--drivers/hwmon/lm75.h2
-rw-r--r--drivers/hwmon/pmbus/ltc2978.c14
-rw-r--r--drivers/hwmon/pmbus/pmbus_core.c12
-rw-r--r--drivers/i2c/Kconfig2
-rw-r--r--drivers/i2c/busses/Kconfig6
-rw-r--r--drivers/iio/common/st_sensors/st_sensors_core.c9
-rw-r--r--drivers/iio/dac/ad5064.c64
-rw-r--r--drivers/iio/imu/inv_mpu6050/Kconfig1
-rw-r--r--drivers/infiniband/hw/cxgb4/cm.c12
-rw-r--r--drivers/infiniband/hw/mlx4/cm.c1
-rw-r--r--drivers/input/joystick/analog.c8
-rw-r--r--drivers/irqchip/irq-gic.c2
-rw-r--r--drivers/isdn/hisax/Kconfig6
-rw-r--r--drivers/mfd/Kconfig1
-rw-r--r--drivers/mfd/ab8500-gpadc.c17
-rw-r--r--drivers/mfd/omap-usb-host.c6
-rw-r--r--drivers/mfd/palmas.c36
-rw-r--r--drivers/mfd/tps65912-core.c1
-rw-r--r--drivers/mfd/twl4030-audio.c2
-rw-r--r--drivers/mfd/twl4030-madc.c2
-rw-r--r--drivers/mtd/bcm47xxpart.c52
-rw-r--r--drivers/mtd/nand/nand_base.c16
-rw-r--r--drivers/mtd/nand/nand_ids.c80
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c1
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h3
-rw-r--r--drivers/net/ethernet/dec/tulip/Kconfig1
-rw-r--r--drivers/net/ethernet/freescale/fec.c27
-rw-r--r--drivers/net/ethernet/freescale/fec.h1
-rw-r--r--drivers/net/ethernet/ti/davinci_emac.c2
-rw-r--r--drivers/net/usb/Kconfig2
-rw-r--r--drivers/net/usb/cdc_mbim.c11
-rw-r--r--drivers/net/usb/cdc_ncm.c49
-rw-r--r--drivers/net/wireless/mwifiex/join.c7
-rw-r--r--drivers/net/wireless/rt2x00/Kconfig4
-rw-r--r--drivers/net/wireless/rt2x00/rt2800pci.c14
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/hw.c89
-rw-r--r--drivers/pci/rom.c55
-rw-r--r--drivers/pinctrl/pinctrl-at91.c61
-rw-r--r--drivers/rtc/rtc-mv.c28
-rw-r--r--drivers/s390/block/scm_blk.c69
-rw-r--r--drivers/s390/block/scm_blk.h2
-rw-r--r--drivers/s390/block/scm_drv.c23
-rw-r--r--drivers/s390/char/sclp_cmd.c2
-rw-r--r--drivers/s390/cio/chsc.c17
-rw-r--r--drivers/s390/cio/chsc.h2
-rw-r--r--drivers/s390/cio/scm.c18
-rw-r--r--drivers/s390/net/qeth_core.h1
-rw-r--r--drivers/s390/net/qeth_core_main.c45
-rw-r--r--drivers/s390/net/qeth_l3_main.c23
-rw-r--r--drivers/s390/net/qeth_l3_sys.c2
-rw-r--r--drivers/staging/comedi/drivers/dt9812.c16
-rw-r--r--drivers/staging/comedi/drivers/usbdux.c31
-rw-r--r--drivers/staging/comedi/drivers/usbduxfast.c30
-rw-r--r--drivers/staging/comedi/drivers/usbduxsigma.c27
-rw-r--r--drivers/staging/imx-drm/ipuv3-crtc.c23
-rw-r--r--drivers/staging/tidspbridge/rmgr/drv.c70
-rw-r--r--drivers/staging/vt6656/card.c2
-rw-r--r--drivers/staging/vt6656/main_usb.c4
-rw-r--r--drivers/staging/zcache/ramster/tcp.c25
-rw-r--r--drivers/tty/serial/8250/8250.c52
-rw-r--r--drivers/tty/serial/8250/8250_pci.c21
-rw-r--r--drivers/tty/serial/8250/8250_pnp.c12
-rw-r--r--drivers/tty/serial/Kconfig4
-rw-r--r--drivers/tty/serial/bcm63xx_uart.c8
-rw-r--r--drivers/tty/serial/mpc52xx_uart.c2
-rw-r--r--drivers/tty/serial/of_serial.c6
-rw-r--r--drivers/tty/serial/sunsu.c21
-rw-r--r--drivers/tty/serial/vt8500_serial.c9
-rw-r--r--drivers/tty/tty_buffer.c2
-rw-r--r--drivers/usb/Makefile2
-rw-r--r--drivers/usb/c67x00/c67x00-sched.c4
-rw-r--r--drivers/usb/chipidea/udc.c6
-rw-r--r--drivers/usb/class/cdc-wdm.c23
-rw-r--r--drivers/usb/dwc3/core.c1
-rw-r--r--drivers/usb/dwc3/dwc3-exynos.c2
-rw-r--r--drivers/usb/dwc3/dwc3-omap.c8
-rw-r--r--drivers/usb/dwc3/dwc3-pci.c2
-rw-r--r--drivers/usb/dwc3/ep0.c7
-rw-r--r--drivers/usb/dwc3/gadget.c3
-rw-r--r--drivers/usb/gadget/Makefile12
-rw-r--r--drivers/usb/gadget/composite.c5
-rw-r--r--drivers/usb/gadget/f_uac1.c1
-rw-r--r--drivers/usb/gadget/imx_udc.c20
-rw-r--r--drivers/usb/gadget/omap_udc.c3
-rw-r--r--drivers/usb/gadget/pxa25x_udc.c24
-rw-r--r--drivers/usb/gadget/pxa27x_udc.c18
-rw-r--r--drivers/usb/gadget/s3c2410_udc.c28
-rw-r--r--drivers/usb/gadget/u_uac1.c3
-rw-r--r--drivers/usb/host/ehci-hcd.c6
-rw-r--r--drivers/usb/host/ehci-q.c36
-rw-r--r--drivers/usb/musb/Kconfig5
-rw-r--r--drivers/usb/musb/musb_core.c6
-rw-r--r--drivers/usb/musb/omap2430.c12
-rw-r--r--drivers/usb/otg/otg.c10
-rw-r--r--drivers/usb/phy/omap-control-usb.c24
-rw-r--r--drivers/usb/phy/omap-usb3.c8
-rw-r--r--drivers/usb/phy/samsung-usbphy.c8
-rw-r--r--drivers/usb/serial/cp210x.c20
-rw-r--r--drivers/usb/serial/option.c5
-rw-r--r--drivers/usb/serial/qcaux.c1
-rw-r--r--drivers/usb/serial/qcserial.c7
-rw-r--r--drivers/usb/serial/quatech2.c7
-rw-r--r--drivers/usb/storage/initializers.c76
-rw-r--r--drivers/usb/storage/initializers.h4
-rw-r--r--drivers/usb/storage/unusual_devs.h337
-rw-r--r--drivers/vhost/net.c3
-rw-r--r--drivers/video/atmel_lcdfb.c22
-rw-r--r--drivers/video/omap/lcd_ams_delta.c1
-rw-r--r--drivers/video/omap/lcd_osk.c3
-rw-r--r--drivers/w1/masters/w1-gpio.c6
-rw-r--r--drivers/w1/w1.c3
-rw-r--r--drivers/xen/xen-acpi-processor.c8
-rw-r--r--drivers/xen/xen-pciback/pciback_ops.c3
-rw-r--r--drivers/xen/xen-stub.c1
-rw-r--r--fs/btrfs/extent-tree.c5
-rw-r--r--fs/btrfs/file.c1
-rw-r--r--fs/btrfs/inode.c3
-rw-r--r--fs/btrfs/locking.h1
-rw-r--r--fs/btrfs/qgroup.c10
-rw-r--r--fs/btrfs/transaction.c11
-rw-r--r--fs/btrfs/volumes.c6
-rw-r--r--fs/cifs/cifsfs.c1
-rw-r--r--fs/compat.c15
-rw-r--r--fs/ext2/ialloc.c1
-rw-r--r--fs/ext2/inode.c2
-rw-r--r--fs/ext3/super.c4
-rw-r--r--fs/ext4/super.c2
-rw-r--r--fs/freevxfs/vxfs_super.c1
-rw-r--r--fs/hostfs/hostfs_kern.c1
-rw-r--r--fs/hpfs/super.c1
-rw-r--r--fs/isofs/inode.c1
-rw-r--r--fs/nfs/super.c1
-rw-r--r--fs/nfsd/nfs4state.c36
-rw-r--r--fs/pipe.c3
-rw-r--r--fs/quota/dquot.c5
-rw-r--r--fs/reiserfs/super.c4
-rw-r--r--fs/squashfs/super.c1
-rw-r--r--fs/sysv/super.c1
-rw-r--r--fs/udf/super.c1
-rw-r--r--fs/xfs/xfs_buf.c6
-rw-r--r--fs/xfs/xfs_iomap.c4
-rw-r--r--include/acpi/processor.h3
-rw-r--r--include/asm-generic/atomic.h6
-rw-r--r--include/asm-generic/cmpxchg.h10
-rw-r--r--include/linux/idr.h68
-rw-r--r--include/linux/iio/common/st_sensors.h9
-rw-r--r--include/linux/list.h4
-rw-r--r--include/linux/mfd/palmas.h1
-rw-r--r--include/linux/mfd/tps65912.h1
-rw-r--r--include/linux/mfd/wm831x/auxadc.h2
-rw-r--r--include/linux/mfd/wm831x/core.h2
-rw-r--r--include/linux/mtd/nand.h7
-rw-r--r--include/linux/perf_event.h6
-rw-r--r--include/linux/res_counter.h1
-rw-r--r--include/linux/usb/cdc_ncm.h1
-rw-r--r--include/linux/usb/composite.h3
-rw-r--r--include/net/dst.h6
-rw-r--r--include/net/inet_frag.h9
-rw-r--r--include/uapi/linux/acct.h6
-rw-r--r--include/uapi/linux/aio_abi.h4
-rw-r--r--include/uapi/linux/raid/md_p.h6
-rw-r--r--include/uapi/linux/serial_core.h5
-rw-r--r--include/video/atmel_lcdc.h2
-rw-r--r--init/Kconfig4
-rw-r--r--kernel/fork.c5
-rw-r--r--kernel/futex.c46
-rw-r--r--kernel/signal.c5
-rw-r--r--kernel/user_namespace.c4
-rw-r--r--kernel/workqueue.c51
-rw-r--r--lib/idr.c80
-rw-r--r--lib/xz/Kconfig2
-rw-r--r--mm/Kconfig8
-rw-r--r--mm/fremap.c5
-rw-r--r--mm/memory_hotplug.c2
-rw-r--r--mm/process_vm_access.c8
-rw-r--r--net/bridge/br_netlink.c1
-rw-r--r--net/ceph/osdmap.c42
-rw-r--r--net/core/rtnetlink.c2
-rw-r--r--net/ipv4/inet_fragment.c20
-rw-r--r--net/ipv4/ip_fragment.c11
-rw-r--r--net/ipv4/ip_gre.c5
-rw-r--r--net/ipv4/tcp_ipv4.c14
-rw-r--r--net/ipv6/netfilter/nf_conntrack_reasm.c12
-rw-r--r--net/ipv6/reassembly.c8
-rw-r--r--net/ipv6/tcp_ipv6.c7
-rw-r--r--net/nfc/llcp/llcp.c62
-rw-r--r--net/nfc/llcp/sock.c2
-rw-r--r--net/openvswitch/actions.c4
-rw-r--r--net/openvswitch/datapath.c3
-rw-r--r--net/openvswitch/flow.c6
-rw-r--r--net/openvswitch/vport-netdev.c3
-rw-r--r--net/openvswitch/vport.c3
-rw-r--r--net/sunrpc/auth_gss/svcauth_gss.c12
-rw-r--r--net/sunrpc/rpc_pipe.c1
-rw-r--r--net/sunrpc/xprtsock.c15
-rw-r--r--scripts/Makefile.headersinst11
-rw-r--r--security/keys/compat.c4
-rw-r--r--security/keys/process_keys.c2
-rw-r--r--security/selinux/xfrm.c2
-rw-r--r--sound/core/seq/seq_timer.c8
-rw-r--r--sound/oss/sequencer.c6
-rw-r--r--sound/pci/asihpi/asihpi.c3
-rw-r--r--sound/pci/hda/hda_codec.c24
-rw-r--r--sound/pci/hda/patch_ca0132.c28
-rw-r--r--sound/pci/hda/patch_cirrus.c4
-rw-r--r--sound/pci/hda/patch_sigmatel.c29
-rw-r--r--sound/usb/card.c15
-rw-r--r--tools/usb/ffs-test.c2
363 files changed, 2527 insertions, 1431 deletions
diff --git a/CREDITS b/CREDITS
index 78163cb3eb6a..afaa7cec6ea5 100644
--- a/CREDITS
+++ b/CREDITS
@@ -1510,6 +1510,14 @@ D: Natsemi ethernet
1510D: Cobalt Networks (x86) support 1510D: Cobalt Networks (x86) support
1511D: This-and-That 1511D: This-and-That
1512 1512
1513N: Mark M. Hoffman
1514E: mhoffman@lightlink.com
1515D: asb100, lm93 and smsc47b397 hardware monitoring drivers
1516D: hwmon subsystem core
1517D: hwmon subsystem maintainer
1518D: i2c-sis96x and i2c-stub SMBus drivers
1519S: USA
1520
1513N: Dirk Hohndel 1521N: Dirk Hohndel
1514E: hohndel@suse.de 1522E: hohndel@suse.de
1515D: The XFree86[tm] Project 1523D: The XFree86[tm] Project
diff --git a/Documentation/devicetree/bindings/mfd/ab8500.txt b/Documentation/devicetree/bindings/mfd/ab8500.txt
index 13b707b7355c..c3a14e0ad0ad 100644
--- a/Documentation/devicetree/bindings/mfd/ab8500.txt
+++ b/Documentation/devicetree/bindings/mfd/ab8500.txt
@@ -13,9 +13,6 @@ Required parent device properties:
13 4 = active high level-sensitive 13 4 = active high level-sensitive
14 8 = active low level-sensitive 14 8 = active low level-sensitive
15 15
16Optional parent device properties:
17- reg : contains the PRCMU mailbox address for the AB8500 i2c port
18
19The AB8500 consists of a large and varied group of sub-devices: 16The AB8500 consists of a large and varied group of sub-devices:
20 17
21Device IRQ Names Supply Names Description 18Device IRQ Names Supply Names Description
@@ -86,9 +83,8 @@ Non-standard child device properties:
86 - stericsson,amic2-bias-vamic1 : Analoge Mic wishes to use a non-standard Vamic 83 - stericsson,amic2-bias-vamic1 : Analoge Mic wishes to use a non-standard Vamic
87 - stericsson,earpeice-cmv : Earpeice voltage (only: 950 | 1100 | 1270 | 1580) 84 - stericsson,earpeice-cmv : Earpeice voltage (only: 950 | 1100 | 1270 | 1580)
88 85
89ab8500@5 { 86ab8500 {
90 compatible = "stericsson,ab8500"; 87 compatible = "stericsson,ab8500";
91 reg = <5>; /* mailbox 5 is i2c */
92 interrupts = <0 40 0x4>; 88 interrupts = <0 40 0x4>;
93 interrupt-controller; 89 interrupt-controller;
94 #interrupt-cells = <2>; 90 #interrupt-cells = <2>;
diff --git a/Documentation/devicetree/bindings/tty/serial/of-serial.txt b/Documentation/devicetree/bindings/tty/serial/of-serial.txt
index 1e1145ca4f3c..8f01cb190f25 100644
--- a/Documentation/devicetree/bindings/tty/serial/of-serial.txt
+++ b/Documentation/devicetree/bindings/tty/serial/of-serial.txt
@@ -11,6 +11,9 @@ Required properties:
11 - "nvidia,tegra20-uart" 11 - "nvidia,tegra20-uart"
12 - "nxp,lpc3220-uart" 12 - "nxp,lpc3220-uart"
13 - "ibm,qpace-nwp-serial" 13 - "ibm,qpace-nwp-serial"
14 - "altr,16550-FIFO32"
15 - "altr,16550-FIFO64"
16 - "altr,16550-FIFO128"
14 - "serial" if the port type is unknown. 17 - "serial" if the port type is unknown.
15- reg : offset and length of the register set for the device. 18- reg : offset and length of the register set for the device.
16- interrupts : should contain uart interrupt. 19- interrupts : should contain uart interrupt.
diff --git a/Documentation/hwmon/lm75 b/Documentation/hwmon/lm75
index c91a1d15fa28..69af1c7db6b7 100644
--- a/Documentation/hwmon/lm75
+++ b/Documentation/hwmon/lm75
@@ -23,7 +23,7 @@ Supported chips:
23 Datasheet: Publicly available at the Maxim website 23 Datasheet: Publicly available at the Maxim website
24 http://www.maxim-ic.com/ 24 http://www.maxim-ic.com/
25 * Microchip (TelCom) TCN75 25 * Microchip (TelCom) TCN75
26 Prefix: 'lm75' 26 Prefix: 'tcn75'
27 Addresses scanned: none 27 Addresses scanned: none
28 Datasheet: Publicly available at the Microchip website 28 Datasheet: Publicly available at the Microchip website
29 http://www.microchip.com/ 29 http://www.microchip.com/
diff --git a/MAINTAINERS b/MAINTAINERS
index c08411b27499..fb89be1281c6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1338,12 +1338,6 @@ S: Maintained
1338F: drivers/platform/x86/asus*.c 1338F: drivers/platform/x86/asus*.c
1339F: drivers/platform/x86/eeepc*.c 1339F: drivers/platform/x86/eeepc*.c
1340 1340
1341ASUS ASB100 HARDWARE MONITOR DRIVER
1342M: "Mark M. Hoffman" <mhoffman@lightlink.com>
1343L: lm-sensors@lm-sensors.org
1344S: Maintained
1345F: drivers/hwmon/asb100.c
1346
1347ASYNCHRONOUS TRANSFERS/TRANSFORMS (IOAT) API 1341ASYNCHRONOUS TRANSFERS/TRANSFORMS (IOAT) API
1348M: Dan Williams <djbw@fb.com> 1342M: Dan Williams <djbw@fb.com>
1349W: http://sourceforge.net/projects/xscaleiop 1343W: http://sourceforge.net/projects/xscaleiop
@@ -3851,7 +3845,7 @@ F: drivers/i2c/busses/i2c-ismt.c
3851F: Documentation/i2c/busses/i2c-ismt 3845F: Documentation/i2c/busses/i2c-ismt
3852 3846
3853I2C/SMBUS STUB DRIVER 3847I2C/SMBUS STUB DRIVER
3854M: "Mark M. Hoffman" <mhoffman@lightlink.com> 3848M: Jean Delvare <khali@linux-fr.org>
3855L: linux-i2c@vger.kernel.org 3849L: linux-i2c@vger.kernel.org
3856S: Maintained 3850S: Maintained
3857F: drivers/i2c/i2c-stub.c 3851F: drivers/i2c/i2c-stub.c
@@ -4005,6 +3999,22 @@ M: Stanislaw Gruszka <stf_xl@wp.pl>
4005S: Maintained 3999S: Maintained
4006F: drivers/usb/atm/ueagle-atm.c 4000F: drivers/usb/atm/ueagle-atm.c
4007 4001
4002INA209 HARDWARE MONITOR DRIVER
4003M: Guenter Roeck <linux@roeck-us.net>
4004L: lm-sensors@lm-sensors.org
4005S: Maintained
4006F: Documentation/hwmon/ina209
4007F: Documentation/devicetree/bindings/i2c/ina209.txt
4008F: drivers/hwmon/ina209.c
4009
4010INA2XX HARDWARE MONITOR DRIVER
4011M: Guenter Roeck <linux@roeck-us.net>
4012L: lm-sensors@lm-sensors.org
4013S: Maintained
4014F: Documentation/hwmon/ina2xx
4015F: drivers/hwmon/ina2xx.c
4016F: include/linux/platform_data/ina2xx.h
4017
4008INDUSTRY PACK SUBSYSTEM (IPACK) 4018INDUSTRY PACK SUBSYSTEM (IPACK)
4009M: Samuel Iglesias Gonsalvez <siglesias@igalia.com> 4019M: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
4010M: Jens Taprogge <jens.taprogge@taprogge.org> 4020M: Jens Taprogge <jens.taprogge@taprogge.org>
@@ -5098,6 +5108,15 @@ S: Maintained
5098F: Documentation/hwmon/max6650 5108F: Documentation/hwmon/max6650
5099F: drivers/hwmon/max6650.c 5109F: drivers/hwmon/max6650.c
5100 5110
5111MAX6697 HARDWARE MONITOR DRIVER
5112M: Guenter Roeck <linux@roeck-us.net>
5113L: lm-sensors@lm-sensors.org
5114S: Maintained
5115F: Documentation/hwmon/max6697
5116F: Documentation/devicetree/bindings/i2c/max6697.txt
5117F: drivers/hwmon/max6697.c
5118F: include/linux/platform_data/max6697.h
5119
5101MAXIRADIO FM RADIO RECEIVER DRIVER 5120MAXIRADIO FM RADIO RECEIVER DRIVER
5102M: Hans Verkuil <hverkuil@xs4all.nl> 5121M: Hans Verkuil <hverkuil@xs4all.nl>
5103L: linux-media@vger.kernel.org 5122L: linux-media@vger.kernel.org
@@ -7173,13 +7192,6 @@ L: netdev@vger.kernel.org
7173S: Maintained 7192S: Maintained
7174F: drivers/net/ethernet/sis/sis900.* 7193F: drivers/net/ethernet/sis/sis900.*
7175 7194
7176SIS 96X I2C/SMBUS DRIVER
7177M: "Mark M. Hoffman" <mhoffman@lightlink.com>
7178L: linux-i2c@vger.kernel.org
7179S: Maintained
7180F: Documentation/i2c/busses/i2c-sis96x
7181F: drivers/i2c/busses/i2c-sis96x.c
7182
7183SIS FRAMEBUFFER DRIVER 7195SIS FRAMEBUFFER DRIVER
7184M: Thomas Winischhofer <thomas@winischhofer.net> 7196M: Thomas Winischhofer <thomas@winischhofer.net>
7185W: http://www.winischhofer.net/linuxsisvga.shtml 7197W: http://www.winischhofer.net/linuxsisvga.shtml
@@ -7257,7 +7269,7 @@ F: Documentation/hwmon/sch5627
7257F: drivers/hwmon/sch5627.c 7269F: drivers/hwmon/sch5627.c
7258 7270
7259SMSC47B397 HARDWARE MONITOR DRIVER 7271SMSC47B397 HARDWARE MONITOR DRIVER
7260M: "Mark M. Hoffman" <mhoffman@lightlink.com> 7272M: Jean Delvare <khali@linux-fr.org>
7261L: lm-sensors@lm-sensors.org 7273L: lm-sensors@lm-sensors.org
7262S: Maintained 7274S: Maintained
7263F: Documentation/hwmon/smsc47b397 7275F: Documentation/hwmon/smsc47b397
diff --git a/Makefile b/Makefile
index a05ea42c5f18..22113a77f8ed 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 3 1VERSION = 3
2PATCHLEVEL = 9 2PATCHLEVEL = 9
3SUBLEVEL = 0 3SUBLEVEL = 0
4EXTRAVERSION = -rc2 4EXTRAVERSION = -rc3
5NAME = Unicycling Gorilla 5NAME = Unicycling Gorilla
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/Kconfig b/arch/Kconfig
index 5a1779c93940..1455579791ec 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -319,13 +319,6 @@ config ARCH_WANT_OLD_COMPAT_IPC
319 select ARCH_WANT_COMPAT_IPC_PARSE_VERSION 319 select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
320 bool 320 bool
321 321
322config HAVE_VIRT_TO_BUS
323 bool
324 help
325 An architecture should select this if it implements the
326 deprecated interface virt_to_bus(). All new architectures
327 should probably not select this.
328
329config HAVE_ARCH_SECCOMP_FILTER 322config HAVE_ARCH_SECCOMP_FILTER
330 bool 323 bool
331 help 324 help
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 5833aa441481..8a33ba01301f 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -9,7 +9,7 @@ config ALPHA
9 select HAVE_PERF_EVENTS 9 select HAVE_PERF_EVENTS
10 select HAVE_DMA_ATTRS 10 select HAVE_DMA_ATTRS
11 select HAVE_GENERIC_HARDIRQS 11 select HAVE_GENERIC_HARDIRQS
12 select HAVE_VIRT_TO_BUS 12 select VIRT_TO_BUS
13 select GENERIC_IRQ_PROBE 13 select GENERIC_IRQ_PROBE
14 select AUTO_IRQ_AFFINITY if SMP 14 select AUTO_IRQ_AFFINITY if SMP
15 select GENERIC_IRQ_SHOW 15 select GENERIC_IRQ_SHOW
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 5b714695b01b..13b739469c51 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -49,7 +49,6 @@ config ARM
49 select HAVE_REGS_AND_STACK_ACCESS_API 49 select HAVE_REGS_AND_STACK_ACCESS_API
50 select HAVE_SYSCALL_TRACEPOINTS 50 select HAVE_SYSCALL_TRACEPOINTS
51 select HAVE_UID16 51 select HAVE_UID16
52 select HAVE_VIRT_TO_BUS
53 select KTIME_SCALAR 52 select KTIME_SCALAR
54 select PERF_USE_VMALLOC 53 select PERF_USE_VMALLOC
55 select RTC_LIB 54 select RTC_LIB
@@ -556,7 +555,6 @@ config ARCH_IXP4XX
556config ARCH_DOVE 555config ARCH_DOVE
557 bool "Marvell Dove" 556 bool "Marvell Dove"
558 select ARCH_REQUIRE_GPIOLIB 557 select ARCH_REQUIRE_GPIOLIB
559 select COMMON_CLK_DOVE
560 select CPU_V7 558 select CPU_V7
561 select GENERIC_CLOCKEVENTS 559 select GENERIC_CLOCKEVENTS
562 select MIGHT_HAVE_PCI 560 select MIGHT_HAVE_PCI
@@ -744,6 +742,7 @@ config ARCH_RPC
744 select NEED_MACH_IO_H 742 select NEED_MACH_IO_H
745 select NEED_MACH_MEMORY_H 743 select NEED_MACH_MEMORY_H
746 select NO_IOPORT 744 select NO_IOPORT
745 select VIRT_TO_BUS
747 help 746 help
748 On the Acorn Risc-PC, Linux can support the internal IDE disk and 747 On the Acorn Risc-PC, Linux can support the internal IDE disk and
749 CD-ROM interface, serial and parallel port, and the floppy drive. 748 CD-ROM interface, serial and parallel port, and the floppy drive.
@@ -879,6 +878,7 @@ config ARCH_SHARK
879 select ISA_DMA 878 select ISA_DMA
880 select NEED_MACH_MEMORY_H 879 select NEED_MACH_MEMORY_H
881 select PCI 880 select PCI
881 select VIRT_TO_BUS
882 select ZONE_DMA 882 select ZONE_DMA
883 help 883 help
884 Support for the StrongARM based Digital DNARD machine, also known 884 Support for the StrongARM based Digital DNARD machine, also known
@@ -1006,12 +1006,12 @@ config ARCH_MULTI_V4_V5
1006 bool 1006 bool
1007 1007
1008config ARCH_MULTI_V6 1008config ARCH_MULTI_V6
1009 bool "ARMv6 based platforms (ARM11, Scorpion, ...)" 1009 bool "ARMv6 based platforms (ARM11)"
1010 select ARCH_MULTI_V6_V7 1010 select ARCH_MULTI_V6_V7
1011 select CPU_V6 1011 select CPU_V6
1012 1012
1013config ARCH_MULTI_V7 1013config ARCH_MULTI_V7
1014 bool "ARMv7 based platforms (Cortex-A, PJ4, Krait)" 1014 bool "ARMv7 based platforms (Cortex-A, PJ4, Scorpion, Krait)"
1015 default y 1015 default y
1016 select ARCH_MULTI_V6_V7 1016 select ARCH_MULTI_V6_V7
1017 select ARCH_VEXPRESS 1017 select ARCH_VEXPRESS
@@ -1462,10 +1462,6 @@ config ISA_DMA
1462 bool 1462 bool
1463 select ISA_DMA_API 1463 select ISA_DMA_API
1464 1464
1465config ARCH_NO_VIRT_TO_BUS
1466 def_bool y
1467 depends on !ARCH_RPC && !ARCH_NETWINDER && !ARCH_SHARK
1468
1469# Select ISA DMA interface 1465# Select ISA DMA interface
1470config ISA_DMA_API 1466config ISA_DMA_API
1471 bool 1467 bool
@@ -1657,13 +1653,16 @@ config LOCAL_TIMERS
1657 accounting to be spread across the timer interval, preventing a 1653 accounting to be spread across the timer interval, preventing a
1658 "thundering herd" at every timer tick. 1654 "thundering herd" at every timer tick.
1659 1655
1656# The GPIO number here must be sorted by descending number. In case of
1657# a multiplatform kernel, we just want the highest value required by the
1658# selected platforms.
1660config ARCH_NR_GPIO 1659config ARCH_NR_GPIO
1661 int 1660 int
1662 default 1024 if ARCH_SHMOBILE || ARCH_TEGRA 1661 default 1024 if ARCH_SHMOBILE || ARCH_TEGRA
1663 default 355 if ARCH_U8500
1664 default 264 if MACH_H4700
1665 default 512 if SOC_OMAP5 1662 default 512 if SOC_OMAP5
1663 default 355 if ARCH_U8500
1666 default 288 if ARCH_VT8500 || ARCH_SUNXI 1664 default 288 if ARCH_VT8500 || ARCH_SUNXI
1665 default 264 if MACH_H4700
1667 default 0 1666 default 0
1668 help 1667 help
1669 Maximum number of GPIOs in the system. 1668 Maximum number of GPIOs in the system.
@@ -1887,8 +1886,9 @@ config XEN_DOM0
1887 1886
1888config XEN 1887config XEN
1889 bool "Xen guest support on ARM (EXPERIMENTAL)" 1888 bool "Xen guest support on ARM (EXPERIMENTAL)"
1890 depends on ARM && OF 1889 depends on ARM && AEABI && OF
1891 depends on CPU_V7 && !CPU_V6 1890 depends on CPU_V7 && !CPU_V6
1891 depends on !GENERIC_ATOMIC64
1892 help 1892 help
1893 Say Y if you want to run Linux in a Virtual Machine on Xen on ARM. 1893 Say Y if you want to run Linux in a Virtual Machine on Xen on ARM.
1894 1894
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index acddddac7ee4..ecfcdba2d17c 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -492,7 +492,7 @@ config DEBUG_IMX_UART_PORT
492 DEBUG_IMX31_UART || \ 492 DEBUG_IMX31_UART || \
493 DEBUG_IMX35_UART || \ 493 DEBUG_IMX35_UART || \
494 DEBUG_IMX51_UART || \ 494 DEBUG_IMX51_UART || \
495 DEBUG_IMX50_IMX53_UART || \ 495 DEBUG_IMX53_UART || \
496 DEBUG_IMX6Q_UART 496 DEBUG_IMX6Q_UART
497 default 1 497 default 1
498 help 498 help
diff --git a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile
index 71768b8a1ab9..84aa2caf07ed 100644
--- a/arch/arm/boot/Makefile
+++ b/arch/arm/boot/Makefile
@@ -115,4 +115,4 @@ i:
115 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ 115 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \
116 $(obj)/Image System.map "$(INSTALL_PATH)" 116 $(obj)/Image System.map "$(INSTALL_PATH)"
117 117
118subdir- := bootp compressed 118subdir- := bootp compressed dts
diff --git a/arch/arm/boot/dts/armada-370-rd.dts b/arch/arm/boot/dts/armada-370-rd.dts
index f8e4855bc9a5..070bba4f2585 100644
--- a/arch/arm/boot/dts/armada-370-rd.dts
+++ b/arch/arm/boot/dts/armada-370-rd.dts
@@ -64,5 +64,13 @@
64 status = "okay"; 64 status = "okay";
65 /* No CD or WP GPIOs */ 65 /* No CD or WP GPIOs */
66 }; 66 };
67
68 usb@d0050000 {
69 status = "okay";
70 };
71
72 usb@d0051000 {
73 status = "okay";
74 };
67 }; 75 };
68}; 76};
diff --git a/arch/arm/boot/dts/armada-370-xp.dtsi b/arch/arm/boot/dts/armada-370-xp.dtsi
index 6f1acc75e155..5b708208b607 100644
--- a/arch/arm/boot/dts/armada-370-xp.dtsi
+++ b/arch/arm/boot/dts/armada-370-xp.dtsi
@@ -31,7 +31,6 @@
31 mpic: interrupt-controller@d0020000 { 31 mpic: interrupt-controller@d0020000 {
32 compatible = "marvell,mpic"; 32 compatible = "marvell,mpic";
33 #interrupt-cells = <1>; 33 #interrupt-cells = <1>;
34 #address-cells = <1>;
35 #size-cells = <1>; 34 #size-cells = <1>;
36 interrupt-controller; 35 interrupt-controller;
37 }; 36 };
@@ -54,7 +53,7 @@
54 reg = <0xd0012000 0x100>; 53 reg = <0xd0012000 0x100>;
55 reg-shift = <2>; 54 reg-shift = <2>;
56 interrupts = <41>; 55 interrupts = <41>;
57 reg-io-width = <4>; 56 reg-io-width = <1>;
58 status = "disabled"; 57 status = "disabled";
59 }; 58 };
60 serial@d0012100 { 59 serial@d0012100 {
@@ -62,7 +61,7 @@
62 reg = <0xd0012100 0x100>; 61 reg = <0xd0012100 0x100>;
63 reg-shift = <2>; 62 reg-shift = <2>;
64 interrupts = <42>; 63 interrupts = <42>;
65 reg-io-width = <4>; 64 reg-io-width = <1>;
66 status = "disabled"; 65 status = "disabled";
67 }; 66 };
68 67
diff --git a/arch/arm/boot/dts/armada-xp.dtsi b/arch/arm/boot/dts/armada-xp.dtsi
index 1443949c165e..ca00d8326c87 100644
--- a/arch/arm/boot/dts/armada-xp.dtsi
+++ b/arch/arm/boot/dts/armada-xp.dtsi
@@ -46,7 +46,7 @@
46 reg = <0xd0012200 0x100>; 46 reg = <0xd0012200 0x100>;
47 reg-shift = <2>; 47 reg-shift = <2>;
48 interrupts = <43>; 48 interrupts = <43>;
49 reg-io-width = <4>; 49 reg-io-width = <1>;
50 status = "disabled"; 50 status = "disabled";
51 }; 51 };
52 serial@d0012300 { 52 serial@d0012300 {
@@ -54,7 +54,7 @@
54 reg = <0xd0012300 0x100>; 54 reg = <0xd0012300 0x100>;
55 reg-shift = <2>; 55 reg-shift = <2>;
56 interrupts = <44>; 56 interrupts = <44>;
57 reg-io-width = <4>; 57 reg-io-width = <1>;
58 status = "disabled"; 58 status = "disabled";
59 }; 59 };
60 60
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
index aa98e641931f..a98c0d50fbbe 100644
--- a/arch/arm/boot/dts/at91sam9x5.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5.dtsi
@@ -238,8 +238,32 @@
238 nand { 238 nand {
239 pinctrl_nand: nand-0 { 239 pinctrl_nand: nand-0 {
240 atmel,pins = 240 atmel,pins =
241 <3 4 0x0 0x1 /* PD5 gpio RDY pin pull_up */ 241 <3 0 0x1 0x0 /* PD0 periph A Read Enable */
242 3 5 0x0 0x1>; /* PD4 gpio enable pin pull_up */ 242 3 1 0x1 0x0 /* PD1 periph A Write Enable */
243 3 2 0x1 0x0 /* PD2 periph A Address Latch Enable */
244 3 3 0x1 0x0 /* PD3 periph A Command Latch Enable */
245 3 4 0x0 0x1 /* PD4 gpio Chip Enable pin pull_up */
246 3 5 0x0 0x1 /* PD5 gpio RDY/BUSY pin pull_up */
247 3 6 0x1 0x0 /* PD6 periph A Data bit 0 */
248 3 7 0x1 0x0 /* PD7 periph A Data bit 1 */
249 3 8 0x1 0x0 /* PD8 periph A Data bit 2 */
250 3 9 0x1 0x0 /* PD9 periph A Data bit 3 */
251 3 10 0x1 0x0 /* PD10 periph A Data bit 4 */
252 3 11 0x1 0x0 /* PD11 periph A Data bit 5 */
253 3 12 0x1 0x0 /* PD12 periph A Data bit 6 */
254 3 13 0x1 0x0>; /* PD13 periph A Data bit 7 */
255 };
256
257 pinctrl_nand_16bits: nand_16bits-0 {
258 atmel,pins =
259 <3 14 0x1 0x0 /* PD14 periph A Data bit 8 */
260 3 15 0x1 0x0 /* PD15 periph A Data bit 9 */
261 3 16 0x1 0x0 /* PD16 periph A Data bit 10 */
262 3 17 0x1 0x0 /* PD17 periph A Data bit 11 */
263 3 18 0x1 0x0 /* PD18 periph A Data bit 12 */
264 3 19 0x1 0x0 /* PD19 periph A Data bit 13 */
265 3 20 0x1 0x0 /* PD20 periph A Data bit 14 */
266 3 21 0x1 0x0>; /* PD21 periph A Data bit 15 */
243 }; 267 };
244 }; 268 };
245 269
diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi
index 4bf2a8774aa7..7e0481e2441a 100644
--- a/arch/arm/boot/dts/bcm2835.dtsi
+++ b/arch/arm/boot/dts/bcm2835.dtsi
@@ -105,7 +105,7 @@
105 compatible = "fixed-clock"; 105 compatible = "fixed-clock";
106 reg = <1>; 106 reg = <1>;
107 #clock-cells = <0>; 107 #clock-cells = <0>;
108 clock-frequency = <150000000>; 108 clock-frequency = <250000000>;
109 }; 109 };
110 }; 110 };
111}; 111};
diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi
index 69140ba99f46..9de93096601a 100644
--- a/arch/arm/boot/dts/dbx5x0.dtsi
+++ b/arch/arm/boot/dts/dbx5x0.dtsi
@@ -319,9 +319,8 @@
319 }; 319 };
320 }; 320 };
321 321
322 ab8500@5 { 322 ab8500 {
323 compatible = "stericsson,ab8500"; 323 compatible = "stericsson,ab8500";
324 reg = <5>; /* mailbox 5 is i2c */
325 interrupt-parent = <&intc>; 324 interrupt-parent = <&intc>;
326 interrupts = <0 40 0x4>; 325 interrupts = <0 40 0x4>;
327 interrupt-controller; 326 interrupt-controller;
diff --git a/arch/arm/boot/dts/dove.dtsi b/arch/arm/boot/dts/dove.dtsi
index 67dbe20868a2..f7509cafc377 100644
--- a/arch/arm/boot/dts/dove.dtsi
+++ b/arch/arm/boot/dts/dove.dtsi
@@ -197,6 +197,11 @@
197 status = "disabled"; 197 status = "disabled";
198 }; 198 };
199 199
200 rtc@d8500 {
201 compatible = "marvell,orion-rtc";
202 reg = <0xd8500 0x20>;
203 };
204
200 crypto: crypto@30000 { 205 crypto: crypto@30000 {
201 compatible = "marvell,orion-crypto"; 206 compatible = "marvell,orion-crypto";
202 reg = <0x30000 0x10000>, 207 reg = <0x30000 0x10000>,
diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi
index e1347fceb5bc..1a62bcf18aa3 100644
--- a/arch/arm/boot/dts/exynos4.dtsi
+++ b/arch/arm/boot/dts/exynos4.dtsi
@@ -275,18 +275,27 @@
275 compatible = "arm,pl330", "arm,primecell"; 275 compatible = "arm,pl330", "arm,primecell";
276 reg = <0x12680000 0x1000>; 276 reg = <0x12680000 0x1000>;
277 interrupts = <0 35 0>; 277 interrupts = <0 35 0>;
278 #dma-cells = <1>;
279 #dma-channels = <8>;
280 #dma-requests = <32>;
278 }; 281 };
279 282
280 pdma1: pdma@12690000 { 283 pdma1: pdma@12690000 {
281 compatible = "arm,pl330", "arm,primecell"; 284 compatible = "arm,pl330", "arm,primecell";
282 reg = <0x12690000 0x1000>; 285 reg = <0x12690000 0x1000>;
283 interrupts = <0 36 0>; 286 interrupts = <0 36 0>;
287 #dma-cells = <1>;
288 #dma-channels = <8>;
289 #dma-requests = <32>;
284 }; 290 };
285 291
286 mdma1: mdma@12850000 { 292 mdma1: mdma@12850000 {
287 compatible = "arm,pl330", "arm,primecell"; 293 compatible = "arm,pl330", "arm,primecell";
288 reg = <0x12850000 0x1000>; 294 reg = <0x12850000 0x1000>;
289 interrupts = <0 34 0>; 295 interrupts = <0 34 0>;
296 #dma-cells = <1>;
297 #dma-channels = <8>;
298 #dma-requests = <1>;
290 }; 299 };
291 }; 300 };
292}; 301};
diff --git a/arch/arm/boot/dts/exynos5440.dtsi b/arch/arm/boot/dts/exynos5440.dtsi
index 5f3562ad6746..9a99755920c0 100644
--- a/arch/arm/boot/dts/exynos5440.dtsi
+++ b/arch/arm/boot/dts/exynos5440.dtsi
@@ -142,12 +142,18 @@
142 compatible = "arm,pl330", "arm,primecell"; 142 compatible = "arm,pl330", "arm,primecell";
143 reg = <0x120000 0x1000>; 143 reg = <0x120000 0x1000>;
144 interrupts = <0 34 0>; 144 interrupts = <0 34 0>;
145 #dma-cells = <1>;
146 #dma-channels = <8>;
147 #dma-requests = <32>;
145 }; 148 };
146 149
147 pdma1: pdma@121B0000 { 150 pdma1: pdma@121B0000 {
148 compatible = "arm,pl330", "arm,primecell"; 151 compatible = "arm,pl330", "arm,primecell";
149 reg = <0x121000 0x1000>; 152 reg = <0x121000 0x1000>;
150 interrupts = <0 35 0>; 153 interrupts = <0 35 0>;
154 #dma-cells = <1>;
155 #dma-channels = <8>;
156 #dma-requests = <32>;
151 }; 157 };
152 }; 158 };
153 159
diff --git a/arch/arm/boot/dts/href.dtsi b/arch/arm/boot/dts/href.dtsi
index 592fb9dc35bd..379128eb9d98 100644
--- a/arch/arm/boot/dts/href.dtsi
+++ b/arch/arm/boot/dts/href.dtsi
@@ -221,7 +221,7 @@
221 }; 221 };
222 }; 222 };
223 223
224 ab8500@5 { 224 ab8500 {
225 ab8500-regulators { 225 ab8500-regulators {
226 ab8500_ldo_aux1_reg: ab8500_ldo_aux1 { 226 ab8500_ldo_aux1_reg: ab8500_ldo_aux1 {
227 regulator-name = "V-DISPLAY"; 227 regulator-name = "V-DISPLAY";
diff --git a/arch/arm/boot/dts/hrefv60plus.dts b/arch/arm/boot/dts/hrefv60plus.dts
index 55f4191a626e..2b587a74b813 100644
--- a/arch/arm/boot/dts/hrefv60plus.dts
+++ b/arch/arm/boot/dts/hrefv60plus.dts
@@ -158,7 +158,7 @@
158 }; 158 };
159 }; 159 };
160 160
161 ab8500@5 { 161 ab8500 {
162 ab8500-regulators { 162 ab8500-regulators {
163 ab8500_ldo_aux1_reg: ab8500_ldo_aux1 { 163 ab8500_ldo_aux1_reg: ab8500_ldo_aux1 {
164 regulator-name = "V-DISPLAY"; 164 regulator-name = "V-DISPLAY";
diff --git a/arch/arm/boot/dts/imx53-mba53.dts b/arch/arm/boot/dts/imx53-mba53.dts
index e54fffd48369..468c0a1d48d9 100644
--- a/arch/arm/boot/dts/imx53-mba53.dts
+++ b/arch/arm/boot/dts/imx53-mba53.dts
@@ -42,10 +42,9 @@
42 fsl,pins = <689 0x10000 /* DISP1_DRDY */ 42 fsl,pins = <689 0x10000 /* DISP1_DRDY */
43 482 0x10000 /* DISP1_HSYNC */ 43 482 0x10000 /* DISP1_HSYNC */
44 489 0x10000 /* DISP1_VSYNC */ 44 489 0x10000 /* DISP1_VSYNC */
45 684 0x10000 /* DISP1_DAT_0 */
46 515 0x10000 /* DISP1_DAT_22 */ 45 515 0x10000 /* DISP1_DAT_22 */
47 523 0x10000 /* DISP1_DAT_23 */ 46 523 0x10000 /* DISP1_DAT_23 */
48 543 0x10000 /* DISP1_DAT_21 */ 47 545 0x10000 /* DISP1_DAT_21 */
49 553 0x10000 /* DISP1_DAT_20 */ 48 553 0x10000 /* DISP1_DAT_20 */
50 558 0x10000 /* DISP1_DAT_19 */ 49 558 0x10000 /* DISP1_DAT_19 */
51 564 0x10000 /* DISP1_DAT_18 */ 50 564 0x10000 /* DISP1_DAT_18 */
diff --git a/arch/arm/boot/dts/kirkwood-dns320.dts b/arch/arm/boot/dts/kirkwood-dns320.dts
index 5bb0bf39d3b8..c9c44b2f62d7 100644
--- a/arch/arm/boot/dts/kirkwood-dns320.dts
+++ b/arch/arm/boot/dts/kirkwood-dns320.dts
@@ -42,12 +42,10 @@
42 42
43 ocp@f1000000 { 43 ocp@f1000000 {
44 serial@12000 { 44 serial@12000 {
45 clock-frequency = <166666667>;
46 status = "okay"; 45 status = "okay";
47 }; 46 };
48 47
49 serial@12100 { 48 serial@12100 {
50 clock-frequency = <166666667>;
51 status = "okay"; 49 status = "okay";
52 }; 50 };
53 }; 51 };
diff --git a/arch/arm/boot/dts/kirkwood-dns325.dts b/arch/arm/boot/dts/kirkwood-dns325.dts
index d430713ea9b9..e4e4930dc5cf 100644
--- a/arch/arm/boot/dts/kirkwood-dns325.dts
+++ b/arch/arm/boot/dts/kirkwood-dns325.dts
@@ -50,7 +50,6 @@
50 }; 50 };
51 }; 51 };
52 serial@12000 { 52 serial@12000 {
53 clock-frequency = <200000000>;
54 status = "okay"; 53 status = "okay";
55 }; 54 };
56 }; 55 };
diff --git a/arch/arm/boot/dts/kirkwood-dockstar.dts b/arch/arm/boot/dts/kirkwood-dockstar.dts
index 2e3dd34e21a5..0196cf6b0ef2 100644
--- a/arch/arm/boot/dts/kirkwood-dockstar.dts
+++ b/arch/arm/boot/dts/kirkwood-dockstar.dts
@@ -37,7 +37,6 @@
37 }; 37 };
38 }; 38 };
39 serial@12000 { 39 serial@12000 {
40 clock-frequency = <200000000>;
41 status = "ok"; 40 status = "ok";
42 }; 41 };
43 42
diff --git a/arch/arm/boot/dts/kirkwood-dreamplug.dts b/arch/arm/boot/dts/kirkwood-dreamplug.dts
index ef2d8c705709..289e51d86372 100644
--- a/arch/arm/boot/dts/kirkwood-dreamplug.dts
+++ b/arch/arm/boot/dts/kirkwood-dreamplug.dts
@@ -38,7 +38,6 @@
38 }; 38 };
39 }; 39 };
40 serial@12000 { 40 serial@12000 {
41 clock-frequency = <200000000>;
42 status = "ok"; 41 status = "ok";
43 }; 42 };
44 43
diff --git a/arch/arm/boot/dts/kirkwood-goflexnet.dts b/arch/arm/boot/dts/kirkwood-goflexnet.dts
index 1b133e0c566e..bd83b8fc7c83 100644
--- a/arch/arm/boot/dts/kirkwood-goflexnet.dts
+++ b/arch/arm/boot/dts/kirkwood-goflexnet.dts
@@ -73,7 +73,6 @@
73 }; 73 };
74 }; 74 };
75 serial@12000 { 75 serial@12000 {
76 clock-frequency = <200000000>;
77 status = "ok"; 76 status = "ok";
78 }; 77 };
79 78
diff --git a/arch/arm/boot/dts/kirkwood-ib62x0.dts b/arch/arm/boot/dts/kirkwood-ib62x0.dts
index 71902da33d63..5335b1aa8601 100644
--- a/arch/arm/boot/dts/kirkwood-ib62x0.dts
+++ b/arch/arm/boot/dts/kirkwood-ib62x0.dts
@@ -51,7 +51,6 @@
51 }; 51 };
52 }; 52 };
53 serial@12000 { 53 serial@12000 {
54 clock-frequency = <200000000>;
55 status = "okay"; 54 status = "okay";
56 }; 55 };
57 56
diff --git a/arch/arm/boot/dts/kirkwood-iconnect.dts b/arch/arm/boot/dts/kirkwood-iconnect.dts
index 504f16be8b54..12ccf74ac3c4 100644
--- a/arch/arm/boot/dts/kirkwood-iconnect.dts
+++ b/arch/arm/boot/dts/kirkwood-iconnect.dts
@@ -78,7 +78,6 @@
78 }; 78 };
79 }; 79 };
80 serial@12000 { 80 serial@12000 {
81 clock-frequency = <200000000>;
82 status = "ok"; 81 status = "ok";
83 }; 82 };
84 83
diff --git a/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
index 6cae4599c4b3..93c3afbef9ee 100644
--- a/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
+++ b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
@@ -115,7 +115,6 @@
115 }; 115 };
116 116
117 serial@12000 { 117 serial@12000 {
118 clock-frequency = <200000000>;
119 status = "ok"; 118 status = "ok";
120 }; 119 };
121 120
diff --git a/arch/arm/boot/dts/kirkwood-km_kirkwood.dts b/arch/arm/boot/dts/kirkwood-km_kirkwood.dts
index 8db3123ac80f..5bbd0542cdd3 100644
--- a/arch/arm/boot/dts/kirkwood-km_kirkwood.dts
+++ b/arch/arm/boot/dts/kirkwood-km_kirkwood.dts
@@ -34,7 +34,6 @@
34 }; 34 };
35 35
36 serial@12000 { 36 serial@12000 {
37 clock-frequency = <200000000>;
38 status = "ok"; 37 status = "ok";
39 }; 38 };
40 39
diff --git a/arch/arm/boot/dts/kirkwood-lschlv2.dts b/arch/arm/boot/dts/kirkwood-lschlv2.dts
index 9510c9ea666c..9f55d95f35f5 100644
--- a/arch/arm/boot/dts/kirkwood-lschlv2.dts
+++ b/arch/arm/boot/dts/kirkwood-lschlv2.dts
@@ -13,7 +13,6 @@
13 13
14 ocp@f1000000 { 14 ocp@f1000000 {
15 serial@12000 { 15 serial@12000 {
16 clock-frequency = <166666667>;
17 status = "okay"; 16 status = "okay";
18 }; 17 };
19 }; 18 };
diff --git a/arch/arm/boot/dts/kirkwood-lsxhl.dts b/arch/arm/boot/dts/kirkwood-lsxhl.dts
index 739019c4cba9..5c84c118ed8d 100644
--- a/arch/arm/boot/dts/kirkwood-lsxhl.dts
+++ b/arch/arm/boot/dts/kirkwood-lsxhl.dts
@@ -13,7 +13,6 @@
13 13
14 ocp@f1000000 { 14 ocp@f1000000 {
15 serial@12000 { 15 serial@12000 {
16 clock-frequency = <200000000>;
17 status = "okay"; 16 status = "okay";
18 }; 17 };
19 }; 18 };
diff --git a/arch/arm/boot/dts/kirkwood-mplcec4.dts b/arch/arm/boot/dts/kirkwood-mplcec4.dts
index 662dfd81b1ce..758824118a9a 100644
--- a/arch/arm/boot/dts/kirkwood-mplcec4.dts
+++ b/arch/arm/boot/dts/kirkwood-mplcec4.dts
@@ -90,7 +90,6 @@
90 }; 90 };
91 91
92 serial@12000 { 92 serial@12000 {
93 clock-frequency = <200000000>;
94 status = "ok"; 93 status = "ok";
95 }; 94 };
96 95
diff --git a/arch/arm/boot/dts/kirkwood-ns2-common.dtsi b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
index e8e7ecef1650..6affd924fe11 100644
--- a/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
+++ b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
@@ -23,7 +23,6 @@
23 }; 23 };
24 24
25 serial@12000 { 25 serial@12000 {
26 clock-frequency = <166666667>;
27 status = "okay"; 26 status = "okay";
28 }; 27 };
29 28
diff --git a/arch/arm/boot/dts/kirkwood-nsa310.dts b/arch/arm/boot/dts/kirkwood-nsa310.dts
index 3a178cf708d7..a7412b937a8a 100644
--- a/arch/arm/boot/dts/kirkwood-nsa310.dts
+++ b/arch/arm/boot/dts/kirkwood-nsa310.dts
@@ -117,7 +117,6 @@
117 }; 117 };
118 118
119 serial@12000 { 119 serial@12000 {
120 clock-frequency = <200000000>;
121 status = "ok"; 120 status = "ok";
122 }; 121 };
123 122
diff --git a/arch/arm/boot/dts/kirkwood-openblocks_a6.dts b/arch/arm/boot/dts/kirkwood-openblocks_a6.dts
index ede7fe0d7a87..d27f7245f8e7 100644
--- a/arch/arm/boot/dts/kirkwood-openblocks_a6.dts
+++ b/arch/arm/boot/dts/kirkwood-openblocks_a6.dts
@@ -18,12 +18,10 @@
18 18
19 ocp@f1000000 { 19 ocp@f1000000 {
20 serial@12000 { 20 serial@12000 {
21 clock-frequency = <200000000>;
22 status = "ok"; 21 status = "ok";
23 }; 22 };
24 23
25 serial@12100 { 24 serial@12100 {
26 clock-frequency = <200000000>;
27 status = "ok"; 25 status = "ok";
28 }; 26 };
29 27
diff --git a/arch/arm/boot/dts/kirkwood-topkick.dts b/arch/arm/boot/dts/kirkwood-topkick.dts
index 842ff95d60df..66eb45b00b25 100644
--- a/arch/arm/boot/dts/kirkwood-topkick.dts
+++ b/arch/arm/boot/dts/kirkwood-topkick.dts
@@ -108,7 +108,6 @@
108 }; 108 };
109 109
110 serial@12000 { 110 serial@12000 {
111 clock-frequency = <200000000>;
112 status = "ok"; 111 status = "ok";
113 }; 112 };
114 113
diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi
index 2c738d9dc82a..fada7e6d24d8 100644
--- a/arch/arm/boot/dts/kirkwood.dtsi
+++ b/arch/arm/boot/dts/kirkwood.dtsi
@@ -38,6 +38,7 @@
38 interrupt-controller; 38 interrupt-controller;
39 #interrupt-cells = <2>; 39 #interrupt-cells = <2>;
40 interrupts = <35>, <36>, <37>, <38>; 40 interrupts = <35>, <36>, <37>, <38>;
41 clocks = <&gate_clk 7>;
41 }; 42 };
42 43
43 gpio1: gpio@10140 { 44 gpio1: gpio@10140 {
@@ -49,6 +50,7 @@
49 interrupt-controller; 50 interrupt-controller;
50 #interrupt-cells = <2>; 51 #interrupt-cells = <2>;
51 interrupts = <39>, <40>, <41>; 52 interrupts = <39>, <40>, <41>;
53 clocks = <&gate_clk 7>;
52 }; 54 };
53 55
54 serial@12000 { 56 serial@12000 {
@@ -57,7 +59,6 @@
57 reg-shift = <2>; 59 reg-shift = <2>;
58 interrupts = <33>; 60 interrupts = <33>;
59 clocks = <&gate_clk 7>; 61 clocks = <&gate_clk 7>;
60 /* set clock-frequency in board dts */
61 status = "disabled"; 62 status = "disabled";
62 }; 63 };
63 64
@@ -67,7 +68,6 @@
67 reg-shift = <2>; 68 reg-shift = <2>;
68 interrupts = <34>; 69 interrupts = <34>;
69 clocks = <&gate_clk 7>; 70 clocks = <&gate_clk 7>;
70 /* set clock-frequency in board dts */
71 status = "disabled"; 71 status = "disabled";
72 }; 72 };
73 73
@@ -75,6 +75,7 @@
75 compatible = "marvell,kirkwood-rtc", "marvell,orion-rtc"; 75 compatible = "marvell,kirkwood-rtc", "marvell,orion-rtc";
76 reg = <0x10300 0x20>; 76 reg = <0x10300 0x20>;
77 interrupts = <53>; 77 interrupts = <53>;
78 clocks = <&gate_clk 7>;
78 }; 79 };
79 80
80 spi@10600 { 81 spi@10600 {
diff --git a/arch/arm/boot/dts/orion5x-lacie-ethernet-disk-mini-v2.dts b/arch/arm/boot/dts/orion5x-lacie-ethernet-disk-mini-v2.dts
index 5a3a58b7e18f..0077fc8510b7 100644
--- a/arch/arm/boot/dts/orion5x-lacie-ethernet-disk-mini-v2.dts
+++ b/arch/arm/boot/dts/orion5x-lacie-ethernet-disk-mini-v2.dts
@@ -11,7 +11,7 @@
11 11
12/ { 12/ {
13 model = "LaCie Ethernet Disk mini V2"; 13 model = "LaCie Ethernet Disk mini V2";
14 compatible = "lacie,ethernet-disk-mini-v2", "marvell-orion5x-88f5182", "marvell,orion5x"; 14 compatible = "lacie,ethernet-disk-mini-v2", "marvell,orion5x-88f5182", "marvell,orion5x";
15 15
16 memory { 16 memory {
17 reg = <0x00000000 0x4000000>; /* 64 MB */ 17 reg = <0x00000000 0x4000000>; /* 64 MB */
diff --git a/arch/arm/boot/dts/snowball.dts b/arch/arm/boot/dts/snowball.dts
index 27f31a5fa494..d3ec32f6b790 100644
--- a/arch/arm/boot/dts/snowball.dts
+++ b/arch/arm/boot/dts/snowball.dts
@@ -298,7 +298,7 @@
298 }; 298 };
299 }; 299 };
300 300
301 ab8500@5 { 301 ab8500 {
302 ab8500-regulators { 302 ab8500-regulators {
303 ab8500_ldo_aux1_reg: ab8500_ldo_aux1 { 303 ab8500_ldo_aux1_reg: ab8500_ldo_aux1 {
304 regulator-name = "V-DISPLAY"; 304 regulator-name = "V-DISPLAY";
diff --git a/arch/arm/boot/dts/socfpga.dtsi b/arch/arm/boot/dts/socfpga.dtsi
index 936d2306e7e1..7e8769bd5977 100644
--- a/arch/arm/boot/dts/socfpga.dtsi
+++ b/arch/arm/boot/dts/socfpga.dtsi
@@ -75,6 +75,9 @@
75 compatible = "arm,pl330", "arm,primecell"; 75 compatible = "arm,pl330", "arm,primecell";
76 reg = <0xffe01000 0x1000>; 76 reg = <0xffe01000 0x1000>;
77 interrupts = <0 180 4>; 77 interrupts = <0 180 4>;
78 #dma-cells = <1>;
79 #dma-channels = <8>;
80 #dma-requests = <32>;
78 }; 81 };
79 }; 82 };
80 83
diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi
index 9a428931d042..48d00a099ce3 100644
--- a/arch/arm/boot/dts/tegra20.dtsi
+++ b/arch/arm/boot/dts/tegra20.dtsi
@@ -118,6 +118,7 @@
118 compatible = "arm,cortex-a9-twd-timer"; 118 compatible = "arm,cortex-a9-twd-timer";
119 reg = <0x50040600 0x20>; 119 reg = <0x50040600 0x20>;
120 interrupts = <1 13 0x304>; 120 interrupts = <1 13 0x304>;
121 clocks = <&tegra_car 132>;
121 }; 122 };
122 123
123 intc: interrupt-controller { 124 intc: interrupt-controller {
diff --git a/arch/arm/boot/dts/tegra30.dtsi b/arch/arm/boot/dts/tegra30.dtsi
index 767803e1fd55..9d87a3ffe998 100644
--- a/arch/arm/boot/dts/tegra30.dtsi
+++ b/arch/arm/boot/dts/tegra30.dtsi
@@ -119,6 +119,7 @@
119 compatible = "arm,cortex-a9-twd-timer"; 119 compatible = "arm,cortex-a9-twd-timer";
120 reg = <0x50040600 0x20>; 120 reg = <0x50040600 0x20>;
121 interrupts = <1 13 0xf04>; 121 interrupts = <1 13 0xf04>;
122 clocks = <&tegra_car 214>;
122 }; 123 };
123 124
124 intc: interrupt-controller { 125 intc: interrupt-controller {
diff --git a/arch/arm/configs/mxs_defconfig b/arch/arm/configs/mxs_defconfig
index fbbc5bb022d5..6a99e30f81d2 100644
--- a/arch/arm/configs/mxs_defconfig
+++ b/arch/arm/configs/mxs_defconfig
@@ -116,6 +116,7 @@ CONFIG_SND_SOC=y
116CONFIG_SND_MXS_SOC=y 116CONFIG_SND_MXS_SOC=y
117CONFIG_SND_SOC_MXS_SGTL5000=y 117CONFIG_SND_SOC_MXS_SGTL5000=y
118CONFIG_USB=y 118CONFIG_USB=y
119CONFIG_USB_EHCI_HCD=y
119CONFIG_USB_CHIPIDEA=y 120CONFIG_USB_CHIPIDEA=y
120CONFIG_USB_CHIPIDEA_HOST=y 121CONFIG_USB_CHIPIDEA_HOST=y
121CONFIG_USB_STORAGE=y 122CONFIG_USB_STORAGE=y
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index b16bae2c9a60..bd07864f14a0 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -126,6 +126,8 @@ CONFIG_INPUT_MISC=y
126CONFIG_INPUT_TWL4030_PWRBUTTON=y 126CONFIG_INPUT_TWL4030_PWRBUTTON=y
127CONFIG_VT_HW_CONSOLE_BINDING=y 127CONFIG_VT_HW_CONSOLE_BINDING=y
128# CONFIG_LEGACY_PTYS is not set 128# CONFIG_LEGACY_PTYS is not set
129CONFIG_SERIAL_8250=y
130CONFIG_SERIAL_8250_CONSOLE=y
129CONFIG_SERIAL_8250_NR_UARTS=32 131CONFIG_SERIAL_8250_NR_UARTS=32
130CONFIG_SERIAL_8250_EXTENDED=y 132CONFIG_SERIAL_8250_EXTENDED=y
131CONFIG_SERIAL_8250_MANY_PORTS=y 133CONFIG_SERIAL_8250_MANY_PORTS=y
diff --git a/arch/arm/include/asm/xen/events.h b/arch/arm/include/asm/xen/events.h
index 5c27696de14f..8b1f37bfeeec 100644
--- a/arch/arm/include/asm/xen/events.h
+++ b/arch/arm/include/asm/xen/events.h
@@ -2,6 +2,7 @@
2#define _ASM_ARM_XEN_EVENTS_H 2#define _ASM_ARM_XEN_EVENTS_H
3 3
4#include <asm/ptrace.h> 4#include <asm/ptrace.h>
5#include <asm/atomic.h>
5 6
6enum ipi_vector { 7enum ipi_vector {
7 XEN_PLACEHOLDER_VECTOR, 8 XEN_PLACEHOLDER_VECTOR,
@@ -15,26 +16,8 @@ static inline int xen_irqs_disabled(struct pt_regs *regs)
15 return raw_irqs_disabled_flags(regs->ARM_cpsr); 16 return raw_irqs_disabled_flags(regs->ARM_cpsr);
16} 17}
17 18
18/* 19#define xchg_xen_ulong(ptr, val) atomic64_xchg(container_of((ptr), \
19 * We cannot use xchg because it does not support 8-byte 20 atomic64_t, \
20 * values. However it is safe to use {ldr,dtd}exd directly because all 21 counter), (val))
21 * platforms which Xen can run on support those instructions.
22 */
23static inline xen_ulong_t xchg_xen_ulong(xen_ulong_t *ptr, xen_ulong_t val)
24{
25 xen_ulong_t oldval;
26 unsigned int tmp;
27
28 wmb();
29 asm volatile("@ xchg_xen_ulong\n"
30 "1: ldrexd %0, %H0, [%3]\n"
31 " strexd %1, %2, %H2, [%3]\n"
32 " teq %1, #0\n"
33 " bne 1b"
34 : "=&r" (oldval), "=&r" (tmp)
35 : "r" (val), "r" (ptr)
36 : "memory", "cc");
37 return oldval;
38}
39 22
40#endif /* _ASM_ARM_XEN_EVENTS_H */ 23#endif /* _ASM_ARM_XEN_EVENTS_H */
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 31644f1978d5..79078edbb9bc 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -480,7 +480,7 @@ static void __cpuinit broadcast_timer_setup(struct clock_event_device *evt)
480 evt->features = CLOCK_EVT_FEAT_ONESHOT | 480 evt->features = CLOCK_EVT_FEAT_ONESHOT |
481 CLOCK_EVT_FEAT_PERIODIC | 481 CLOCK_EVT_FEAT_PERIODIC |
482 CLOCK_EVT_FEAT_DUMMY; 482 CLOCK_EVT_FEAT_DUMMY;
483 evt->rating = 400; 483 evt->rating = 100;
484 evt->mult = 1; 484 evt->mult = 1;
485 evt->set_mode = broadcast_timer_set_mode; 485 evt->set_mode = broadcast_timer_set_mode;
486 486
diff --git a/arch/arm/lib/memset.S b/arch/arm/lib/memset.S
index d912e7397ecc..94b0650ea98f 100644
--- a/arch/arm/lib/memset.S
+++ b/arch/arm/lib/memset.S
@@ -14,31 +14,15 @@
14 14
15 .text 15 .text
16 .align 5 16 .align 5
17 .word 0
18
191: subs r2, r2, #4 @ 1 do we have enough
20 blt 5f @ 1 bytes to align with?
21 cmp r3, #2 @ 1
22 strltb r1, [ip], #1 @ 1
23 strleb r1, [ip], #1 @ 1
24 strb r1, [ip], #1 @ 1
25 add r2, r2, r3 @ 1 (r2 = r2 - (4 - r3))
26/*
27 * The pointer is now aligned and the length is adjusted. Try doing the
28 * memset again.
29 */
30 17
31ENTRY(memset) 18ENTRY(memset)
32/* 19 ands r3, r0, #3 @ 1 unaligned?
33 * Preserve the contents of r0 for the return value. 20 mov ip, r0 @ preserve r0 as return value
34 */ 21 bne 6f @ 1
35 mov ip, r0
36 ands r3, ip, #3 @ 1 unaligned?
37 bne 1b @ 1
38/* 22/*
39 * we know that the pointer in ip is aligned to a word boundary. 23 * we know that the pointer in ip is aligned to a word boundary.
40 */ 24 */
41 orr r1, r1, r1, lsl #8 251: orr r1, r1, r1, lsl #8
42 orr r1, r1, r1, lsl #16 26 orr r1, r1, r1, lsl #16
43 mov r3, r1 27 mov r3, r1
44 cmp r2, #16 28 cmp r2, #16
@@ -127,4 +111,13 @@ ENTRY(memset)
127 tst r2, #1 111 tst r2, #1
128 strneb r1, [ip], #1 112 strneb r1, [ip], #1
129 mov pc, lr 113 mov pc, lr
114
1156: subs r2, r2, #4 @ 1 do we have enough
116 blt 5b @ 1 bytes to align with?
117 cmp r3, #2 @ 1
118 strltb r1, [ip], #1 @ 1
119 strleb r1, [ip], #1 @ 1
120 strb r1, [ip], #1 @ 1
121 add r2, r2, r3 @ 1 (r2 = r2 - (4 - r3))
122 b 1b
130ENDPROC(memset) 123ENDPROC(memset)
diff --git a/arch/arm/mach-at91/board-foxg20.c b/arch/arm/mach-at91/board-foxg20.c
index 2ea7059b840b..c20a870ea9c9 100644
--- a/arch/arm/mach-at91/board-foxg20.c
+++ b/arch/arm/mach-at91/board-foxg20.c
@@ -176,6 +176,7 @@ static struct w1_gpio_platform_data w1_gpio_pdata = {
176 /* If you choose to use a pin other than PB16 it needs to be 3.3V */ 176 /* If you choose to use a pin other than PB16 it needs to be 3.3V */
177 .pin = AT91_PIN_PB16, 177 .pin = AT91_PIN_PB16,
178 .is_open_drain = 1, 178 .is_open_drain = 1,
179 .ext_pullup_enable_pin = -EINVAL,
179}; 180};
180 181
181static struct platform_device w1_device = { 182static struct platform_device w1_device = {
diff --git a/arch/arm/mach-at91/board-stamp9g20.c b/arch/arm/mach-at91/board-stamp9g20.c
index a033b8df9fb2..869cbecf00b7 100644
--- a/arch/arm/mach-at91/board-stamp9g20.c
+++ b/arch/arm/mach-at91/board-stamp9g20.c
@@ -188,6 +188,7 @@ static struct spi_board_info portuxg20_spi_devices[] = {
188static struct w1_gpio_platform_data w1_gpio_pdata = { 188static struct w1_gpio_platform_data w1_gpio_pdata = {
189 .pin = AT91_PIN_PA29, 189 .pin = AT91_PIN_PA29,
190 .is_open_drain = 1, 190 .is_open_drain = 1,
191 .ext_pullup_enable_pin = -EINVAL,
191}; 192};
192 193
193static struct platform_device w1_device = { 194static struct platform_device w1_device = {
diff --git a/arch/arm/mach-at91/include/mach/gpio.h b/arch/arm/mach-at91/include/mach/gpio.h
index eed465ab0dd7..5fc23771c154 100644
--- a/arch/arm/mach-at91/include/mach/gpio.h
+++ b/arch/arm/mach-at91/include/mach/gpio.h
@@ -209,6 +209,14 @@ extern int at91_get_gpio_value(unsigned pin);
209extern void at91_gpio_suspend(void); 209extern void at91_gpio_suspend(void);
210extern void at91_gpio_resume(void); 210extern void at91_gpio_resume(void);
211 211
212#ifdef CONFIG_PINCTRL_AT91
213extern void at91_pinctrl_gpio_suspend(void);
214extern void at91_pinctrl_gpio_resume(void);
215#else
216static inline void at91_pinctrl_gpio_suspend(void) {}
217static inline void at91_pinctrl_gpio_resume(void) {}
218#endif
219
212#endif /* __ASSEMBLY__ */ 220#endif /* __ASSEMBLY__ */
213 221
214#endif 222#endif
diff --git a/arch/arm/mach-at91/irq.c b/arch/arm/mach-at91/irq.c
index 8e210262aeee..e0ca59171022 100644
--- a/arch/arm/mach-at91/irq.c
+++ b/arch/arm/mach-at91/irq.c
@@ -92,23 +92,21 @@ static int at91_aic_set_wake(struct irq_data *d, unsigned value)
92 92
93void at91_irq_suspend(void) 93void at91_irq_suspend(void)
94{ 94{
95 int i = 0, bit; 95 int bit = -1;
96 96
97 if (has_aic5()) { 97 if (has_aic5()) {
98 /* disable enabled irqs */ 98 /* disable enabled irqs */
99 while ((bit = find_next_bit(backups, n_irqs, i)) < n_irqs) { 99 while ((bit = find_next_bit(backups, n_irqs, bit + 1)) < n_irqs) {
100 at91_aic_write(AT91_AIC5_SSR, 100 at91_aic_write(AT91_AIC5_SSR,
101 bit & AT91_AIC5_INTSEL_MSK); 101 bit & AT91_AIC5_INTSEL_MSK);
102 at91_aic_write(AT91_AIC5_IDCR, 1); 102 at91_aic_write(AT91_AIC5_IDCR, 1);
103 i = bit;
104 } 103 }
105 /* enable wakeup irqs */ 104 /* enable wakeup irqs */
106 i = 0; 105 bit = -1;
107 while ((bit = find_next_bit(wakeups, n_irqs, i)) < n_irqs) { 106 while ((bit = find_next_bit(wakeups, n_irqs, bit + 1)) < n_irqs) {
108 at91_aic_write(AT91_AIC5_SSR, 107 at91_aic_write(AT91_AIC5_SSR,
109 bit & AT91_AIC5_INTSEL_MSK); 108 bit & AT91_AIC5_INTSEL_MSK);
110 at91_aic_write(AT91_AIC5_IECR, 1); 109 at91_aic_write(AT91_AIC5_IECR, 1);
111 i = bit;
112 } 110 }
113 } else { 111 } else {
114 at91_aic_write(AT91_AIC_IDCR, *backups); 112 at91_aic_write(AT91_AIC_IDCR, *backups);
@@ -118,23 +116,21 @@ void at91_irq_suspend(void)
118 116
119void at91_irq_resume(void) 117void at91_irq_resume(void)
120{ 118{
121 int i = 0, bit; 119 int bit = -1;
122 120
123 if (has_aic5()) { 121 if (has_aic5()) {
124 /* disable wakeup irqs */ 122 /* disable wakeup irqs */
125 while ((bit = find_next_bit(wakeups, n_irqs, i)) < n_irqs) { 123 while ((bit = find_next_bit(wakeups, n_irqs, bit + 1)) < n_irqs) {
126 at91_aic_write(AT91_AIC5_SSR, 124 at91_aic_write(AT91_AIC5_SSR,
127 bit & AT91_AIC5_INTSEL_MSK); 125 bit & AT91_AIC5_INTSEL_MSK);
128 at91_aic_write(AT91_AIC5_IDCR, 1); 126 at91_aic_write(AT91_AIC5_IDCR, 1);
129 i = bit;
130 } 127 }
131 /* enable irqs disabled for suspend */ 128 /* enable irqs disabled for suspend */
132 i = 0; 129 bit = -1;
133 while ((bit = find_next_bit(backups, n_irqs, i)) < n_irqs) { 130 while ((bit = find_next_bit(backups, n_irqs, bit + 1)) < n_irqs) {
134 at91_aic_write(AT91_AIC5_SSR, 131 at91_aic_write(AT91_AIC5_SSR,
135 bit & AT91_AIC5_INTSEL_MSK); 132 bit & AT91_AIC5_INTSEL_MSK);
136 at91_aic_write(AT91_AIC5_IECR, 1); 133 at91_aic_write(AT91_AIC5_IECR, 1);
137 i = bit;
138 } 134 }
139 } else { 135 } else {
140 at91_aic_write(AT91_AIC_IDCR, *wakeups); 136 at91_aic_write(AT91_AIC_IDCR, *wakeups);
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index adb6db888a1f..73f1f250403a 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -201,7 +201,10 @@ extern u32 at91_slow_clock_sz;
201 201
202static int at91_pm_enter(suspend_state_t state) 202static int at91_pm_enter(suspend_state_t state)
203{ 203{
204 at91_gpio_suspend(); 204 if (of_have_populated_dt())
205 at91_pinctrl_gpio_suspend();
206 else
207 at91_gpio_suspend();
205 at91_irq_suspend(); 208 at91_irq_suspend();
206 209
207 pr_debug("AT91: PM - wake mask %08x, pm state %d\n", 210 pr_debug("AT91: PM - wake mask %08x, pm state %d\n",
@@ -286,7 +289,10 @@ static int at91_pm_enter(suspend_state_t state)
286error: 289error:
287 target_state = PM_SUSPEND_ON; 290 target_state = PM_SUSPEND_ON;
288 at91_irq_resume(); 291 at91_irq_resume();
289 at91_gpio_resume(); 292 if (of_have_populated_dt())
293 at91_pinctrl_gpio_resume();
294 else
295 at91_gpio_resume();
290 return 0; 296 return 0;
291} 297}
292 298
diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c
index a685e9706b7b..45b7c71d9cc1 100644
--- a/arch/arm/mach-davinci/dma.c
+++ b/arch/arm/mach-davinci/dma.c
@@ -743,6 +743,9 @@ EXPORT_SYMBOL(edma_free_channel);
743 */ 743 */
744int edma_alloc_slot(unsigned ctlr, int slot) 744int edma_alloc_slot(unsigned ctlr, int slot)
745{ 745{
746 if (!edma_cc[ctlr])
747 return -EINVAL;
748
746 if (slot >= 0) 749 if (slot >= 0)
747 slot = EDMA_CHAN_SLOT(slot); 750 slot = EDMA_CHAN_SLOT(slot);
748 751
diff --git a/arch/arm/mach-footbridge/Kconfig b/arch/arm/mach-footbridge/Kconfig
index abda5a18a664..0f2111a11315 100644
--- a/arch/arm/mach-footbridge/Kconfig
+++ b/arch/arm/mach-footbridge/Kconfig
@@ -67,6 +67,7 @@ config ARCH_NETWINDER
67 select ISA 67 select ISA
68 select ISA_DMA 68 select ISA_DMA
69 select PCI 69 select PCI
70 select VIRT_TO_BUS
70 help 71 help
71 Say Y here if you intend to run this kernel on the Rebel.COM 72 Say Y here if you intend to run this kernel on the Rebel.COM
72 NetWinder. Information about this machine can be found at: 73 NetWinder. Information about this machine can be found at:
diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c
index 74e3a34d78b8..e13a8fa5e62c 100644
--- a/arch/arm/mach-imx/clk-imx35.c
+++ b/arch/arm/mach-imx/clk-imx35.c
@@ -264,6 +264,7 @@ int __init mx35_clocks_init(void)
264 clk_prepare_enable(clk[gpio3_gate]); 264 clk_prepare_enable(clk[gpio3_gate]);
265 clk_prepare_enable(clk[iim_gate]); 265 clk_prepare_enable(clk[iim_gate]);
266 clk_prepare_enable(clk[emi_gate]); 266 clk_prepare_enable(clk[emi_gate]);
267 clk_prepare_enable(clk[max_gate]);
267 268
268 /* 269 /*
269 * SCC is needed to boot via mmc after a watchdog reset. The clock code 270 * SCC is needed to boot via mmc after a watchdog reset. The clock code
diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c
index 7b025ee528a5..2f9ff93a4e61 100644
--- a/arch/arm/mach-imx/clk-imx6q.c
+++ b/arch/arm/mach-imx/clk-imx6q.c
@@ -172,7 +172,7 @@ static struct clk *clk[clk_max];
172static struct clk_onecell_data clk_data; 172static struct clk_onecell_data clk_data;
173 173
174static enum mx6q_clks const clks_init_on[] __initconst = { 174static enum mx6q_clks const clks_init_on[] __initconst = {
175 mmdc_ch0_axi, rom, 175 mmdc_ch0_axi, rom, pll1_sys,
176}; 176};
177 177
178static struct clk_div_table clk_enet_ref_table[] = { 178static struct clk_div_table clk_enet_ref_table[] = {
diff --git a/arch/arm/mach-imx/headsmp.S b/arch/arm/mach-imx/headsmp.S
index 921fc1555854..a58c8b0527cc 100644
--- a/arch/arm/mach-imx/headsmp.S
+++ b/arch/arm/mach-imx/headsmp.S
@@ -26,16 +26,16 @@ ENDPROC(v7_secondary_startup)
26 26
27#ifdef CONFIG_PM 27#ifdef CONFIG_PM
28/* 28/*
29 * The following code is located into the .data section. This is to 29 * The following code must assume it is running from physical address
30 * allow phys_l2x0_saved_regs to be accessed with a relative load 30 * where absolute virtual addresses to the data section have to be
31 * as we are running on physical address here. 31 * turned into relative ones.
32 */ 32 */
33 .data
34 .align
35 33
36#ifdef CONFIG_CACHE_L2X0 34#ifdef CONFIG_CACHE_L2X0
37 .macro pl310_resume 35 .macro pl310_resume
38 ldr r2, phys_l2x0_saved_regs 36 adr r0, l2x0_saved_regs_offset
37 ldr r2, [r0]
38 add r2, r2, r0
39 ldr r0, [r2, #L2X0_R_PHY_BASE] @ get physical base of l2x0 39 ldr r0, [r2, #L2X0_R_PHY_BASE] @ get physical base of l2x0
40 ldr r1, [r2, #L2X0_R_AUX_CTRL] @ get aux_ctrl value 40 ldr r1, [r2, #L2X0_R_AUX_CTRL] @ get aux_ctrl value
41 str r1, [r0, #L2X0_AUX_CTRL] @ restore aux_ctrl 41 str r1, [r0, #L2X0_AUX_CTRL] @ restore aux_ctrl
@@ -43,9 +43,9 @@ ENDPROC(v7_secondary_startup)
43 str r1, [r0, #L2X0_CTRL] @ re-enable L2 43 str r1, [r0, #L2X0_CTRL] @ re-enable L2
44 .endm 44 .endm
45 45
46 .globl phys_l2x0_saved_regs 46l2x0_saved_regs_offset:
47phys_l2x0_saved_regs: 47 .word l2x0_saved_regs - .
48 .long 0 48
49#else 49#else
50 .macro pl310_resume 50 .macro pl310_resume
51 .endm 51 .endm
diff --git a/arch/arm/mach-imx/imx25-dt.c b/arch/arm/mach-imx/imx25-dt.c
index 03b65e5ea541..82348391582a 100644
--- a/arch/arm/mach-imx/imx25-dt.c
+++ b/arch/arm/mach-imx/imx25-dt.c
@@ -27,6 +27,11 @@ static const char * const imx25_dt_board_compat[] __initconst = {
27 NULL 27 NULL
28}; 28};
29 29
30static void __init imx25_timer_init(void)
31{
32 mx25_clocks_init_dt();
33}
34
30DT_MACHINE_START(IMX25_DT, "Freescale i.MX25 (Device Tree Support)") 35DT_MACHINE_START(IMX25_DT, "Freescale i.MX25 (Device Tree Support)")
31 .map_io = mx25_map_io, 36 .map_io = mx25_map_io,
32 .init_early = imx25_init_early, 37 .init_early = imx25_init_early,
diff --git a/arch/arm/mach-imx/pm-imx6q.c b/arch/arm/mach-imx/pm-imx6q.c
index ee42d20cba19..5faba7a3c95f 100644
--- a/arch/arm/mach-imx/pm-imx6q.c
+++ b/arch/arm/mach-imx/pm-imx6q.c
@@ -22,8 +22,6 @@
22#include "common.h" 22#include "common.h"
23#include "hardware.h" 23#include "hardware.h"
24 24
25extern unsigned long phys_l2x0_saved_regs;
26
27static int imx6q_suspend_finish(unsigned long val) 25static int imx6q_suspend_finish(unsigned long val)
28{ 26{
29 cpu_do_idle(); 27 cpu_do_idle();
@@ -57,18 +55,5 @@ static const struct platform_suspend_ops imx6q_pm_ops = {
57 55
58void __init imx6q_pm_init(void) 56void __init imx6q_pm_init(void)
59{ 57{
60 /*
61 * The l2x0 core code provides an infrastucture to save and restore
62 * l2x0 registers across suspend/resume cycle. But because imx6q
63 * retains L2 content during suspend and needs to resume L2 before
64 * MMU is enabled, it can only utilize register saving support and
65 * have to take care of restoring on its own. So we save physical
66 * address of the data structure used by l2x0 core to save registers,
67 * and later restore the necessary ones in imx6q resume entry.
68 */
69#ifdef CONFIG_CACHE_L2X0
70 phys_l2x0_saved_regs = __pa(&l2x0_saved_regs);
71#endif
72
73 suspend_set_ops(&imx6q_pm_ops); 58 suspend_set_ops(&imx6q_pm_ops);
74} 59}
diff --git a/arch/arm/mach-ixp4xx/vulcan-setup.c b/arch/arm/mach-ixp4xx/vulcan-setup.c
index d42730a1d4ab..d599e354ca57 100644
--- a/arch/arm/mach-ixp4xx/vulcan-setup.c
+++ b/arch/arm/mach-ixp4xx/vulcan-setup.c
@@ -163,6 +163,7 @@ static struct platform_device vulcan_max6369 = {
163 163
164static struct w1_gpio_platform_data vulcan_w1_gpio_pdata = { 164static struct w1_gpio_platform_data vulcan_w1_gpio_pdata = {
165 .pin = 14, 165 .pin = 14,
166 .ext_pullup_enable_pin = -EINVAL,
166}; 167};
167 168
168static struct platform_device vulcan_w1_gpio = { 169static struct platform_device vulcan_w1_gpio = {
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
index 2e73e9d53f70..d367aa6b47bb 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -41,16 +41,12 @@ static void __init kirkwood_legacy_clk_init(void)
41 41
42 struct device_node *np = of_find_compatible_node( 42 struct device_node *np = of_find_compatible_node(
43 NULL, NULL, "marvell,kirkwood-gating-clock"); 43 NULL, NULL, "marvell,kirkwood-gating-clock");
44
45 struct of_phandle_args clkspec; 44 struct of_phandle_args clkspec;
45 struct clk *clk;
46 46
47 clkspec.np = np; 47 clkspec.np = np;
48 clkspec.args_count = 1; 48 clkspec.args_count = 1;
49 49
50 clkspec.args[0] = CGC_BIT_GE0;
51 orion_clkdev_add(NULL, "mv643xx_eth_port.0",
52 of_clk_get_from_provider(&clkspec));
53
54 clkspec.args[0] = CGC_BIT_PEX0; 50 clkspec.args[0] = CGC_BIT_PEX0;
55 orion_clkdev_add("0", "pcie", 51 orion_clkdev_add("0", "pcie",
56 of_clk_get_from_provider(&clkspec)); 52 of_clk_get_from_provider(&clkspec));
@@ -59,9 +55,24 @@ static void __init kirkwood_legacy_clk_init(void)
59 orion_clkdev_add("1", "pcie", 55 orion_clkdev_add("1", "pcie",
60 of_clk_get_from_provider(&clkspec)); 56 of_clk_get_from_provider(&clkspec));
61 57
62 clkspec.args[0] = CGC_BIT_GE1; 58 clkspec.args[0] = CGC_BIT_SDIO;
63 orion_clkdev_add(NULL, "mv643xx_eth_port.1", 59 orion_clkdev_add(NULL, "mvsdio",
64 of_clk_get_from_provider(&clkspec)); 60 of_clk_get_from_provider(&clkspec));
61
62 /*
63 * The ethernet interfaces forget the MAC address assigned by
64 * u-boot if the clocks are turned off. Until proper DT support
65 * is available we always enable them for now.
66 */
67 clkspec.args[0] = CGC_BIT_GE0;
68 clk = of_clk_get_from_provider(&clkspec);
69 orion_clkdev_add(NULL, "mv643xx_eth_port.0", clk);
70 clk_prepare_enable(clk);
71
72 clkspec.args[0] = CGC_BIT_GE1;
73 clk = of_clk_get_from_provider(&clkspec);
74 orion_clkdev_add(NULL, "mv643xx_eth_port.1", clk);
75 clk_prepare_enable(clk);
65} 76}
66 77
67static void __init kirkwood_of_clk_init(void) 78static void __init kirkwood_of_clk_init(void)
diff --git a/arch/arm/mach-mmp/gplugd.c b/arch/arm/mach-mmp/gplugd.c
index d1e2d595e79c..f62b68d926f4 100644
--- a/arch/arm/mach-mmp/gplugd.c
+++ b/arch/arm/mach-mmp/gplugd.c
@@ -9,6 +9,7 @@
9 */ 9 */
10 10
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/platform_device.h>
12#include <linux/gpio.h> 13#include <linux/gpio.h>
13 14
14#include <asm/mach/arch.h> 15#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-mxs/icoll.c b/arch/arm/mach-mxs/icoll.c
index 8fb23af154b3..e26eeba46598 100644
--- a/arch/arm/mach-mxs/icoll.c
+++ b/arch/arm/mach-mxs/icoll.c
@@ -100,7 +100,7 @@ static struct irq_domain_ops icoll_irq_domain_ops = {
100 .xlate = irq_domain_xlate_onecell, 100 .xlate = irq_domain_xlate_onecell,
101}; 101};
102 102
103void __init icoll_of_init(struct device_node *np, 103static void __init icoll_of_init(struct device_node *np,
104 struct device_node *interrupt_parent) 104 struct device_node *interrupt_parent)
105{ 105{
106 /* 106 /*
diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c
index 052186713347..3218f1f2c0e0 100644
--- a/arch/arm/mach-mxs/mach-mxs.c
+++ b/arch/arm/mach-mxs/mach-mxs.c
@@ -402,17 +402,17 @@ static void __init cfa10049_init(void)
402{ 402{
403 enable_clk_enet_out(); 403 enable_clk_enet_out();
404 update_fec_mac_prop(OUI_CRYSTALFONTZ); 404 update_fec_mac_prop(OUI_CRYSTALFONTZ);
405
406 mxsfb_pdata.mode_list = cfa10049_video_modes;
407 mxsfb_pdata.mode_count = ARRAY_SIZE(cfa10049_video_modes);
408 mxsfb_pdata.default_bpp = 32;
409 mxsfb_pdata.ld_intf_width = STMLCDIF_18BIT;
405} 410}
406 411
407static void __init cfa10037_init(void) 412static void __init cfa10037_init(void)
408{ 413{
409 enable_clk_enet_out(); 414 enable_clk_enet_out();
410 update_fec_mac_prop(OUI_CRYSTALFONTZ); 415 update_fec_mac_prop(OUI_CRYSTALFONTZ);
411
412 mxsfb_pdata.mode_list = cfa10049_video_modes;
413 mxsfb_pdata.mode_count = ARRAY_SIZE(cfa10049_video_modes);
414 mxsfb_pdata.default_bpp = 32;
415 mxsfb_pdata.ld_intf_width = STMLCDIF_18BIT;
416} 416}
417 417
418static void __init apf28_init(void) 418static void __init apf28_init(void)
diff --git a/arch/arm/mach-mxs/mm.c b/arch/arm/mach-mxs/mm.c
index a4294aa9f301..e63b7d87acbd 100644
--- a/arch/arm/mach-mxs/mm.c
+++ b/arch/arm/mach-mxs/mm.c
@@ -18,6 +18,7 @@
18 18
19#include <mach/mx23.h> 19#include <mach/mx23.h>
20#include <mach/mx28.h> 20#include <mach/mx28.h>
21#include <mach/common.h>
21 22
22/* 23/*
23 * Define the MX23 memory map. 24 * Define the MX23 memory map.
diff --git a/arch/arm/mach-mxs/ocotp.c b/arch/arm/mach-mxs/ocotp.c
index 54add60f94c9..1dff46703753 100644
--- a/arch/arm/mach-mxs/ocotp.c
+++ b/arch/arm/mach-mxs/ocotp.c
@@ -19,6 +19,7 @@
19#include <asm/processor.h> /* for cpu_relax() */ 19#include <asm/processor.h> /* for cpu_relax() */
20 20
21#include <mach/mxs.h> 21#include <mach/mxs.h>
22#include <mach/common.h>
22 23
23#define OCOTP_WORD_OFFSET 0x20 24#define OCOTP_WORD_OFFSET 0x20
24#define OCOTP_WORD_COUNT 0x20 25#define OCOTP_WORD_COUNT 0x20
diff --git a/arch/arm/mach-omap1/common.h b/arch/arm/mach-omap1/common.h
index fb18831e88aa..14f7e9920479 100644
--- a/arch/arm/mach-omap1/common.h
+++ b/arch/arm/mach-omap1/common.h
@@ -31,6 +31,8 @@
31 31
32#include <plat/i2c.h> 32#include <plat/i2c.h>
33 33
34#include <mach/irqs.h>
35
34#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) 36#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
35void omap7xx_map_io(void); 37void omap7xx_map_io(void);
36#else 38#else
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 49ac3dfebef9..8111cd9ff3e5 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -311,9 +311,6 @@ config MACH_OMAP_ZOOM2
311 default y 311 default y
312 select OMAP_PACKAGE_CBB 312 select OMAP_PACKAGE_CBB
313 select REGULATOR_FIXED_VOLTAGE if REGULATOR 313 select REGULATOR_FIXED_VOLTAGE if REGULATOR
314 select SERIAL_8250
315 select SERIAL_8250_CONSOLE
316 select SERIAL_CORE_CONSOLE
317 314
318config MACH_OMAP_ZOOM3 315config MACH_OMAP_ZOOM3
319 bool "OMAP3630 Zoom3 board" 316 bool "OMAP3630 Zoom3 board"
@@ -321,9 +318,6 @@ config MACH_OMAP_ZOOM3
321 default y 318 default y
322 select OMAP_PACKAGE_CBP 319 select OMAP_PACKAGE_CBP
323 select REGULATOR_FIXED_VOLTAGE if REGULATOR 320 select REGULATOR_FIXED_VOLTAGE if REGULATOR
324 select SERIAL_8250
325 select SERIAL_8250_CONSOLE
326 select SERIAL_CORE_CONSOLE
327 321
328config MACH_CM_T35 322config MACH_CM_T35
329 bool "CompuLab CM-T35/CM-T3730 modules" 323 bool "CompuLab CM-T35/CM-T3730 modules"
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 0274ff7a2a2b..e54a48060198 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -102,6 +102,7 @@ DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)")
102 .init_irq = omap_intc_of_init, 102 .init_irq = omap_intc_of_init,
103 .handle_irq = omap3_intc_handle_irq, 103 .handle_irq = omap3_intc_handle_irq,
104 .init_machine = omap_generic_init, 104 .init_machine = omap_generic_init,
105 .init_late = omap3_init_late,
105 .init_time = omap3_sync32k_timer_init, 106 .init_time = omap3_sync32k_timer_init,
106 .dt_compat = omap3_boards_compat, 107 .dt_compat = omap3_boards_compat,
107 .restart = omap3xxx_restart, 108 .restart = omap3xxx_restart,
@@ -119,6 +120,7 @@ DT_MACHINE_START(OMAP3_GP_DT, "Generic OMAP3-GP (Flattened Device Tree)")
119 .init_irq = omap_intc_of_init, 120 .init_irq = omap_intc_of_init,
120 .handle_irq = omap3_intc_handle_irq, 121 .handle_irq = omap3_intc_handle_irq,
121 .init_machine = omap_generic_init, 122 .init_machine = omap_generic_init,
123 .init_late = omap3_init_late,
122 .init_time = omap3_secure_sync32k_timer_init, 124 .init_time = omap3_secure_sync32k_timer_init,
123 .dt_compat = omap3_gp_boards_compat, 125 .dt_compat = omap3_gp_boards_compat,
124 .restart = omap3xxx_restart, 126 .restart = omap3xxx_restart,
diff --git a/arch/arm/mach-omap2/board-rx51.c b/arch/arm/mach-omap2/board-rx51.c
index f7c4616cbb60..d2ea68ea678a 100644
--- a/arch/arm/mach-omap2/board-rx51.c
+++ b/arch/arm/mach-omap2/board-rx51.c
@@ -17,6 +17,7 @@
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/gpio.h> 18#include <linux/gpio.h>
19#include <linux/leds.h> 19#include <linux/leds.h>
20#include <linux/usb/phy.h>
20#include <linux/usb/musb.h> 21#include <linux/usb/musb.h>
21#include <linux/platform_data/spi-omap2-mcspi.h> 22#include <linux/platform_data/spi-omap2-mcspi.h>
22 23
@@ -98,6 +99,7 @@ static void __init rx51_init(void)
98 sdrc_params = nokia_get_sdram_timings(); 99 sdrc_params = nokia_get_sdram_timings();
99 omap_sdrc_init(sdrc_params, sdrc_params); 100 omap_sdrc_init(sdrc_params, sdrc_params);
100 101
102 usb_bind_phy("musb-hdrc.0.auto", 0, "twl4030_usb");
101 usb_musb_init(&musb_board_data); 103 usb_musb_init(&musb_board_data);
102 rx51_peripherals_init(); 104 rx51_peripherals_init();
103 105
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index 0a6b9c7a63da..40f4a03d728f 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -108,7 +108,6 @@ void omap35xx_init_late(void);
108void omap3630_init_late(void); 108void omap3630_init_late(void);
109void am35xx_init_late(void); 109void am35xx_init_late(void);
110void ti81xx_init_late(void); 110void ti81xx_init_late(void);
111void omap4430_init_late(void);
112int omap2_common_pm_late_init(void); 111int omap2_common_pm_late_init(void);
113 112
114#if defined(CONFIG_SOC_OMAP2420) || defined(CONFIG_SOC_OMAP2430) 113#if defined(CONFIG_SOC_OMAP2420) || defined(CONFIG_SOC_OMAP2430)
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index e4b16c8efe8b..410e1bac7815 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -1122,9 +1122,6 @@ int gpmc_calc_timings(struct gpmc_timings *gpmc_t,
1122 /* TODO: remove, see function definition */ 1122 /* TODO: remove, see function definition */
1123 gpmc_convert_ps_to_ns(gpmc_t); 1123 gpmc_convert_ps_to_ns(gpmc_t);
1124 1124
1125 /* Now the GPMC is initialised, unreserve the chip-selects */
1126 gpmc_cs_map = 0;
1127
1128 return 0; 1125 return 0;
1129} 1126}
1130 1127
@@ -1383,6 +1380,9 @@ static int gpmc_probe(struct platform_device *pdev)
1383 if (IS_ERR_VALUE(gpmc_setup_irq())) 1380 if (IS_ERR_VALUE(gpmc_setup_irq()))
1384 dev_warn(gpmc_dev, "gpmc_setup_irq failed\n"); 1381 dev_warn(gpmc_dev, "gpmc_setup_irq failed\n");
1385 1382
1383 /* Now the GPMC is initialised, unreserve the chip-selects */
1384 gpmc_cs_map = 0;
1385
1386 rc = gpmc_probe_dt(pdev); 1386 rc = gpmc_probe_dt(pdev);
1387 if (rc < 0) { 1387 if (rc < 0) {
1388 clk_disable_unprepare(gpmc_l3_clk); 1388 clk_disable_unprepare(gpmc_l3_clk);
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index 6a217c98db54..f82cf878d6af 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -211,8 +211,6 @@ static int __init _omap_mux_get_by_name(struct omap_mux_partition *partition,
211 return -EINVAL; 211 return -EINVAL;
212 } 212 }
213 213
214 pr_err("%s: Could not find signal %s\n", __func__, muxname);
215
216 return -ENODEV; 214 return -ENODEV;
217} 215}
218 216
@@ -234,6 +232,8 @@ int __init omap_mux_get_by_name(const char *muxname,
234 return mux_mode; 232 return mux_mode;
235 } 233 }
236 234
235 pr_err("%s: Could not find signal %s\n", __func__, muxname);
236
237 return -ENODEV; 237 return -ENODEV;
238} 238}
239 239
@@ -739,8 +739,9 @@ static void __init omap_mux_dbg_create_entry(
739 list_for_each_entry(e, &partition->muxmodes, node) { 739 list_for_each_entry(e, &partition->muxmodes, node) {
740 struct omap_mux *m = &e->mux; 740 struct omap_mux *m = &e->mux;
741 741
742 (void)debugfs_create_file(m->muxnames[0], S_IWUSR, mux_dbg_dir, 742 (void)debugfs_create_file(m->muxnames[0], S_IWUSR | S_IRUGO,
743 m, &omap_mux_dbg_signal_fops); 743 mux_dbg_dir, m,
744 &omap_mux_dbg_signal_fops);
744 } 745 }
745} 746}
746 747
diff --git a/arch/arm/mach-pxa/raumfeld.c b/arch/arm/mach-pxa/raumfeld.c
index af41888acbd6..969b0ba7fa70 100644
--- a/arch/arm/mach-pxa/raumfeld.c
+++ b/arch/arm/mach-pxa/raumfeld.c
@@ -505,6 +505,7 @@ static struct w1_gpio_platform_data w1_gpio_platform_data = {
505 .pin = GPIO_ONE_WIRE, 505 .pin = GPIO_ONE_WIRE,
506 .is_open_drain = 0, 506 .is_open_drain = 0,
507 .enable_external_pullup = w1_enable_external_pullup, 507 .enable_external_pullup = w1_enable_external_pullup,
508 .ext_pullup_enable_pin = -EINVAL,
508}; 509};
509 510
510struct platform_device raumfeld_w1_gpio_device = { 511struct platform_device raumfeld_w1_gpio_device = {
diff --git a/arch/arm/mach-s5pv210/clock.c b/arch/arm/mach-s5pv210/clock.c
index fcdf52dbcc49..f051f53e35b7 100644
--- a/arch/arm/mach-s5pv210/clock.c
+++ b/arch/arm/mach-s5pv210/clock.c
@@ -214,11 +214,6 @@ static struct clk clk_pcmcdclk2 = {
214 .name = "pcmcdclk", 214 .name = "pcmcdclk",
215}; 215};
216 216
217static struct clk dummy_apb_pclk = {
218 .name = "apb_pclk",
219 .id = -1,
220};
221
222static struct clk *clkset_vpllsrc_list[] = { 217static struct clk *clkset_vpllsrc_list[] = {
223 [0] = &clk_fin_vpll, 218 [0] = &clk_fin_vpll,
224 [1] = &clk_sclk_hdmi27m, 219 [1] = &clk_sclk_hdmi27m,
@@ -305,18 +300,6 @@ static struct clk_ops clk_fout_apll_ops = {
305 300
306static struct clk init_clocks_off[] = { 301static struct clk init_clocks_off[] = {
307 { 302 {
308 .name = "dma",
309 .devname = "dma-pl330.0",
310 .parent = &clk_hclk_psys.clk,
311 .enable = s5pv210_clk_ip0_ctrl,
312 .ctrlbit = (1 << 3),
313 }, {
314 .name = "dma",
315 .devname = "dma-pl330.1",
316 .parent = &clk_hclk_psys.clk,
317 .enable = s5pv210_clk_ip0_ctrl,
318 .ctrlbit = (1 << 4),
319 }, {
320 .name = "rot", 303 .name = "rot",
321 .parent = &clk_hclk_dsys.clk, 304 .parent = &clk_hclk_dsys.clk,
322 .enable = s5pv210_clk_ip0_ctrl, 305 .enable = s5pv210_clk_ip0_ctrl,
@@ -573,6 +556,20 @@ static struct clk clk_hsmmc3 = {
573 .ctrlbit = (1<<19), 556 .ctrlbit = (1<<19),
574}; 557};
575 558
559static struct clk clk_pdma0 = {
560 .name = "pdma0",
561 .parent = &clk_hclk_psys.clk,
562 .enable = s5pv210_clk_ip0_ctrl,
563 .ctrlbit = (1 << 3),
564};
565
566static struct clk clk_pdma1 = {
567 .name = "pdma1",
568 .parent = &clk_hclk_psys.clk,
569 .enable = s5pv210_clk_ip0_ctrl,
570 .ctrlbit = (1 << 4),
571};
572
576static struct clk *clkset_uart_list[] = { 573static struct clk *clkset_uart_list[] = {
577 [6] = &clk_mout_mpll.clk, 574 [6] = &clk_mout_mpll.clk,
578 [7] = &clk_mout_epll.clk, 575 [7] = &clk_mout_epll.clk,
@@ -1075,6 +1072,8 @@ static struct clk *clk_cdev[] = {
1075 &clk_hsmmc1, 1072 &clk_hsmmc1,
1076 &clk_hsmmc2, 1073 &clk_hsmmc2,
1077 &clk_hsmmc3, 1074 &clk_hsmmc3,
1075 &clk_pdma0,
1076 &clk_pdma1,
1078}; 1077};
1079 1078
1080/* Clock initialisation code */ 1079/* Clock initialisation code */
@@ -1333,6 +1332,8 @@ static struct clk_lookup s5pv210_clk_lookup[] = {
1333 CLKDEV_INIT(NULL, "spi_busclk0", &clk_p), 1332 CLKDEV_INIT(NULL, "spi_busclk0", &clk_p),
1334 CLKDEV_INIT("s5pv210-spi.0", "spi_busclk1", &clk_sclk_spi0.clk), 1333 CLKDEV_INIT("s5pv210-spi.0", "spi_busclk1", &clk_sclk_spi0.clk),
1335 CLKDEV_INIT("s5pv210-spi.1", "spi_busclk1", &clk_sclk_spi1.clk), 1334 CLKDEV_INIT("s5pv210-spi.1", "spi_busclk1", &clk_sclk_spi1.clk),
1335 CLKDEV_INIT("dma-pl330.0", "apb_pclk", &clk_pdma0),
1336 CLKDEV_INIT("dma-pl330.1", "apb_pclk", &clk_pdma1),
1336}; 1337};
1337 1338
1338void __init s5pv210_register_clocks(void) 1339void __init s5pv210_register_clocks(void)
@@ -1361,6 +1362,5 @@ void __init s5pv210_register_clocks(void)
1361 for (ptr = 0; ptr < ARRAY_SIZE(clk_cdev); ptr++) 1362 for (ptr = 0; ptr < ARRAY_SIZE(clk_cdev); ptr++)
1362 s3c_disable_clocks(clk_cdev[ptr], 1); 1363 s3c_disable_clocks(clk_cdev[ptr], 1);
1363 1364
1364 s3c24xx_register_clock(&dummy_apb_pclk);
1365 s3c_pwmclk_init(); 1365 s3c_pwmclk_init();
1366} 1366}
diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c
index 3a38f7b34b94..e373de44a8b6 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -845,7 +845,7 @@ static struct fimc_source_info goni_camera_sensors[] = {
845 .mux_id = 0, 845 .mux_id = 0,
846 .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING | 846 .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING |
847 V4L2_MBUS_VSYNC_ACTIVE_LOW, 847 V4L2_MBUS_VSYNC_ACTIVE_LOW,
848 .bus_type = FIMC_BUS_TYPE_ITU_601, 848 .fimc_bus_type = FIMC_BUS_TYPE_ITU_601,
849 .board_info = &noon010pc30_board_info, 849 .board_info = &noon010pc30_board_info,
850 .i2c_bus_num = 0, 850 .i2c_bus_num = 0,
851 .clk_frequency = 16000000UL, 851 .clk_frequency = 16000000UL,
diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c
index cdcb799e802f..fec49ebc359a 100644
--- a/arch/arm/mach-shmobile/board-marzen.c
+++ b/arch/arm/mach-shmobile/board-marzen.c
@@ -32,6 +32,7 @@
32#include <linux/smsc911x.h> 32#include <linux/smsc911x.h>
33#include <linux/spi/spi.h> 33#include <linux/spi/spi.h>
34#include <linux/spi/sh_hspi.h> 34#include <linux/spi/sh_hspi.h>
35#include <linux/mmc/host.h>
35#include <linux/mmc/sh_mobile_sdhi.h> 36#include <linux/mmc/sh_mobile_sdhi.h>
36#include <linux/mfd/tmio.h> 37#include <linux/mfd/tmio.h>
37#include <linux/usb/otg.h> 38#include <linux/usb/otg.h>
diff --git a/arch/arm/mach-spear3xx/spear3xx.c b/arch/arm/mach-spear3xx/spear3xx.c
index f9d754f90c59..d2b3937c4014 100644
--- a/arch/arm/mach-spear3xx/spear3xx.c
+++ b/arch/arm/mach-spear3xx/spear3xx.c
@@ -14,7 +14,7 @@
14#define pr_fmt(fmt) "SPEAr3xx: " fmt 14#define pr_fmt(fmt) "SPEAr3xx: " fmt
15 15
16#include <linux/amba/pl022.h> 16#include <linux/amba/pl022.h>
17#include <linux/amba/pl08x.h> 17#include <linux/amba/pl080.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <plat/pl080.h> 19#include <plat/pl080.h>
20#include <mach/generic.h> 20#include <mach/generic.h>
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index c7e3759f16d3..e9db6b4bf65a 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -342,6 +342,7 @@ static int __init atomic_pool_init(void)
342{ 342{
343 struct dma_pool *pool = &atomic_pool; 343 struct dma_pool *pool = &atomic_pool;
344 pgprot_t prot = pgprot_dmacoherent(pgprot_kernel); 344 pgprot_t prot = pgprot_dmacoherent(pgprot_kernel);
345 gfp_t gfp = GFP_KERNEL | GFP_DMA;
345 unsigned long nr_pages = pool->size >> PAGE_SHIFT; 346 unsigned long nr_pages = pool->size >> PAGE_SHIFT;
346 unsigned long *bitmap; 347 unsigned long *bitmap;
347 struct page *page; 348 struct page *page;
@@ -361,8 +362,8 @@ static int __init atomic_pool_init(void)
361 ptr = __alloc_from_contiguous(NULL, pool->size, prot, &page, 362 ptr = __alloc_from_contiguous(NULL, pool->size, prot, &page,
362 atomic_pool_init); 363 atomic_pool_init);
363 else 364 else
364 ptr = __alloc_remap_buffer(NULL, pool->size, GFP_KERNEL, prot, 365 ptr = __alloc_remap_buffer(NULL, pool->size, gfp, prot, &page,
365 &page, atomic_pool_init); 366 atomic_pool_init);
366 if (ptr) { 367 if (ptr) {
367 int i; 368 int i;
368 369
diff --git a/arch/arm/plat-orion/addr-map.c b/arch/arm/plat-orion/addr-map.c
index febe3862873c..807ac8e5cbc0 100644
--- a/arch/arm/plat-orion/addr-map.c
+++ b/arch/arm/plat-orion/addr-map.c
@@ -157,9 +157,12 @@ void __init orion_setup_cpu_mbus_target(const struct orion_addr_map_cfg *cfg,
157 u32 size = readl(ddr_window_cpu_base + DDR_SIZE_CS_OFF(i)); 157 u32 size = readl(ddr_window_cpu_base + DDR_SIZE_CS_OFF(i));
158 158
159 /* 159 /*
160 * Chip select enabled? 160 * We only take care of entries for which the chip
161 * select is enabled, and that don't have high base
162 * address bits set (devices can only access the first
163 * 32 bits of the memory).
161 */ 164 */
162 if (size & 1) { 165 if ((size & 1) && !(base & 0xF)) {
163 struct mbus_dram_window *w; 166 struct mbus_dram_window *w;
164 167
165 w = &orion_mbus_dram_info.cs[cs++]; 168 w = &orion_mbus_dram_info.cs[cs++];
diff --git a/arch/arm/plat-spear/Kconfig b/arch/arm/plat-spear/Kconfig
index 739d016eb273..8a08c31b5e20 100644
--- a/arch/arm/plat-spear/Kconfig
+++ b/arch/arm/plat-spear/Kconfig
@@ -10,7 +10,7 @@ choice
10 10
11config ARCH_SPEAR13XX 11config ARCH_SPEAR13XX
12 bool "ST SPEAr13xx with Device Tree" 12 bool "ST SPEAr13xx with Device Tree"
13 select ARCH_HAVE_CPUFREQ 13 select ARCH_HAS_CPUFREQ
14 select ARM_GIC 14 select ARM_GIC
15 select CPU_V7 15 select CPU_V7
16 select GPIO_SPEAR_SPICS 16 select GPIO_SPEAR_SPICS
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index fd70a68387eb..9b6d19f74078 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -9,7 +9,6 @@ config ARM64
9 select CLONE_BACKWARDS 9 select CLONE_BACKWARDS
10 select COMMON_CLK 10 select COMMON_CLK
11 select GENERIC_CLOCKEVENTS 11 select GENERIC_CLOCKEVENTS
12 select GENERIC_HARDIRQS_NO_DEPRECATED
13 select GENERIC_IOMAP 12 select GENERIC_IOMAP
14 select GENERIC_IRQ_PROBE 13 select GENERIC_IRQ_PROBE
15 select GENERIC_IRQ_SHOW 14 select GENERIC_IRQ_SHOW
diff --git a/arch/arm64/Kconfig.debug b/arch/arm64/Kconfig.debug
index 51493430f142..1a6bfe954d49 100644
--- a/arch/arm64/Kconfig.debug
+++ b/arch/arm64/Kconfig.debug
@@ -6,17 +6,6 @@ config FRAME_POINTER
6 bool 6 bool
7 default y 7 default y
8 8
9config DEBUG_ERRORS
10 bool "Verbose kernel error messages"
11 depends on DEBUG_KERNEL
12 help
13 This option controls verbose debugging information which can be
14 printed when the kernel detects an internal error. This debugging
15 information is useful to kernel hackers when tracking down problems,
16 but mostly meaningless to other people. It's safe to say Y unless
17 you are concerned with the code size or don't want to see these
18 messages.
19
20config DEBUG_STACK_USAGE 9config DEBUG_STACK_USAGE
21 bool "Enable stack utilization instrumentation" 10 bool "Enable stack utilization instrumentation"
22 depends on DEBUG_KERNEL 11 depends on DEBUG_KERNEL
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 9212c7880da7..09bef29f3a09 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -82,4 +82,3 @@ CONFIG_DEBUG_KERNEL=y
82CONFIG_DEBUG_INFO=y 82CONFIG_DEBUG_INFO=y
83# CONFIG_FTRACE is not set 83# CONFIG_FTRACE is not set
84CONFIG_ATOMIC64_SELFTEST=y 84CONFIG_ATOMIC64_SELFTEST=y
85CONFIG_DEBUG_ERRORS=y
diff --git a/arch/arm64/include/asm/ucontext.h b/arch/arm64/include/asm/ucontext.h
index bde960720892..42e04c877428 100644
--- a/arch/arm64/include/asm/ucontext.h
+++ b/arch/arm64/include/asm/ucontext.h
@@ -22,7 +22,7 @@ struct ucontext {
22 stack_t uc_stack; 22 stack_t uc_stack;
23 sigset_t uc_sigmask; 23 sigset_t uc_sigmask;
24 /* glibc uses a 1024-bit sigset_t */ 24 /* glibc uses a 1024-bit sigset_t */
25 __u8 __unused[(1024 - sizeof(sigset_t)) / 8]; 25 __u8 __unused[1024 / 8 - sizeof(sigset_t)];
26 /* last for future expansion */ 26 /* last for future expansion */
27 struct sigcontext uc_mcontext; 27 struct sigcontext uc_mcontext;
28}; 28};
diff --git a/arch/arm64/kernel/arm64ksyms.c b/arch/arm64/kernel/arm64ksyms.c
index cef3925eaf60..aa3e948f7885 100644
--- a/arch/arm64/kernel/arm64ksyms.c
+++ b/arch/arm64/kernel/arm64ksyms.c
@@ -40,7 +40,9 @@ EXPORT_SYMBOL(__copy_to_user);
40EXPORT_SYMBOL(__clear_user); 40EXPORT_SYMBOL(__clear_user);
41 41
42 /* bitops */ 42 /* bitops */
43#ifdef CONFIG_SMP
43EXPORT_SYMBOL(__atomic_hash); 44EXPORT_SYMBOL(__atomic_hash);
45#endif
44 46
45 /* physical memory */ 47 /* physical memory */
46EXPORT_SYMBOL(memstart_addr); 48EXPORT_SYMBOL(memstart_addr);
diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c
index 7f4f3673f2bc..e393174fe859 100644
--- a/arch/arm64/kernel/signal32.c
+++ b/arch/arm64/kernel/signal32.c
@@ -549,7 +549,6 @@ int compat_setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
549 sigset_t *set, struct pt_regs *regs) 549 sigset_t *set, struct pt_regs *regs)
550{ 550{
551 struct compat_rt_sigframe __user *frame; 551 struct compat_rt_sigframe __user *frame;
552 compat_stack_t stack;
553 int err = 0; 552 int err = 0;
554 553
555 frame = compat_get_sigframe(ka, regs, sizeof(*frame)); 554 frame = compat_get_sigframe(ka, regs, sizeof(*frame));
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig
index 9b89257b2cfd..c1a868d398bd 100644
--- a/arch/avr32/Kconfig
+++ b/arch/avr32/Kconfig
@@ -7,7 +7,7 @@ config AVR32
7 select HAVE_OPROFILE 7 select HAVE_OPROFILE
8 select HAVE_KPROBES 8 select HAVE_KPROBES
9 select HAVE_GENERIC_HARDIRQS 9 select HAVE_GENERIC_HARDIRQS
10 select HAVE_VIRT_TO_BUS 10 select VIRT_TO_BUS
11 select GENERIC_IRQ_PROBE 11 select GENERIC_IRQ_PROBE
12 select GENERIC_ATOMIC64 12 select GENERIC_ATOMIC64
13 select HARDIRQS_SW_RESEND 13 select HARDIRQS_SW_RESEND
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index 600494c70e96..c3f2e0bc644a 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -33,7 +33,7 @@ config BLACKFIN
33 select ARCH_HAVE_CUSTOM_GPIO_H 33 select ARCH_HAVE_CUSTOM_GPIO_H
34 select ARCH_WANT_OPTIONAL_GPIOLIB 34 select ARCH_WANT_OPTIONAL_GPIOLIB
35 select HAVE_UID16 35 select HAVE_UID16
36 select HAVE_VIRT_TO_BUS 36 select VIRT_TO_BUS
37 select ARCH_WANT_IPC_PARSE_VERSION 37 select ARCH_WANT_IPC_PARSE_VERSION
38 select HAVE_GENERIC_HARDIRQS 38 select HAVE_GENERIC_HARDIRQS
39 select GENERIC_ATOMIC64 39 select GENERIC_ATOMIC64
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index bb0ac66cf533..06dd026533e3 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -43,7 +43,7 @@ config CRIS
43 select GENERIC_ATOMIC64 43 select GENERIC_ATOMIC64
44 select HAVE_GENERIC_HARDIRQS 44 select HAVE_GENERIC_HARDIRQS
45 select HAVE_UID16 45 select HAVE_UID16
46 select HAVE_VIRT_TO_BUS 46 select VIRT_TO_BUS
47 select ARCH_WANT_IPC_PARSE_VERSION 47 select ARCH_WANT_IPC_PARSE_VERSION
48 select GENERIC_IRQ_SHOW 48 select GENERIC_IRQ_SHOW
49 select GENERIC_IOMAP 49 select GENERIC_IOMAP
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig
index 12369b194c7b..2ce731f9aa4d 100644
--- a/arch/frv/Kconfig
+++ b/arch/frv/Kconfig
@@ -6,7 +6,7 @@ config FRV
6 select HAVE_PERF_EVENTS 6 select HAVE_PERF_EVENTS
7 select HAVE_UID16 7 select HAVE_UID16
8 select HAVE_GENERIC_HARDIRQS 8 select HAVE_GENERIC_HARDIRQS
9 select HAVE_VIRT_TO_BUS 9 select VIRT_TO_BUS
10 select GENERIC_IRQ_SHOW 10 select GENERIC_IRQ_SHOW
11 select HAVE_DEBUG_BUGVERBOSE 11 select HAVE_DEBUG_BUGVERBOSE
12 select ARCH_HAVE_NMI_SAFE_CMPXCHG 12 select ARCH_HAVE_NMI_SAFE_CMPXCHG
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index ae8551eb3736..79250de1b12a 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -5,7 +5,7 @@ config H8300
5 select HAVE_GENERIC_HARDIRQS 5 select HAVE_GENERIC_HARDIRQS
6 select GENERIC_ATOMIC64 6 select GENERIC_ATOMIC64
7 select HAVE_UID16 7 select HAVE_UID16
8 select HAVE_VIRT_TO_BUS 8 select VIRT_TO_BUS
9 select ARCH_WANT_IPC_PARSE_VERSION 9 select ARCH_WANT_IPC_PARSE_VERSION
10 select GENERIC_IRQ_SHOW 10 select GENERIC_IRQ_SHOW
11 select GENERIC_CPU_DEVICES 11 select GENERIC_CPU_DEVICES
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 33f3fdc0b214..9a02f71c6b1f 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -26,7 +26,7 @@ config IA64
26 select HAVE_MEMBLOCK 26 select HAVE_MEMBLOCK
27 select HAVE_MEMBLOCK_NODE_MAP 27 select HAVE_MEMBLOCK_NODE_MAP
28 select HAVE_VIRT_CPU_ACCOUNTING 28 select HAVE_VIRT_CPU_ACCOUNTING
29 select HAVE_VIRT_TO_BUS 29 select VIRT_TO_BUS
30 select ARCH_DISCARD_MEMBLOCK 30 select ARCH_DISCARD_MEMBLOCK
31 select GENERIC_IRQ_PROBE 31 select GENERIC_IRQ_PROBE
32 select GENERIC_PENDING_IRQ if SMP 32 select GENERIC_PENDING_IRQ if SMP
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
index 92623818a1fe..bcd17b206571 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -10,7 +10,7 @@ config M32R
10 select ARCH_WANT_IPC_PARSE_VERSION 10 select ARCH_WANT_IPC_PARSE_VERSION
11 select HAVE_DEBUG_BUGVERBOSE 11 select HAVE_DEBUG_BUGVERBOSE
12 select HAVE_GENERIC_HARDIRQS 12 select HAVE_GENERIC_HARDIRQS
13 select HAVE_VIRT_TO_BUS 13 select VIRT_TO_BUS
14 select GENERIC_IRQ_PROBE 14 select GENERIC_IRQ_PROBE
15 select GENERIC_IRQ_SHOW 15 select GENERIC_IRQ_SHOW
16 select GENERIC_ATOMIC64 16 select GENERIC_ATOMIC64
diff --git a/arch/m32r/include/uapi/asm/stat.h b/arch/m32r/include/uapi/asm/stat.h
index da4518f82d6d..98470fe483b6 100644
--- a/arch/m32r/include/uapi/asm/stat.h
+++ b/arch/m32r/include/uapi/asm/stat.h
@@ -63,10 +63,10 @@ struct stat64 {
63 long long st_size; 63 long long st_size;
64 unsigned long st_blksize; 64 unsigned long st_blksize;
65 65
66#if defined(__BIG_ENDIAN) 66#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN)
67 unsigned long __pad4; /* future possible st_blocks high bits */ 67 unsigned long __pad4; /* future possible st_blocks high bits */
68 unsigned long st_blocks; /* Number 512-byte blocks allocated. */ 68 unsigned long st_blocks; /* Number 512-byte blocks allocated. */
69#elif defined(__LITTLE_ENDIAN) 69#elif defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN)
70 unsigned long st_blocks; /* Number 512-byte blocks allocated. */ 70 unsigned long st_blocks; /* Number 512-byte blocks allocated. */
71 unsigned long __pad4; /* future possible st_blocks high bits */ 71 unsigned long __pad4; /* future possible st_blocks high bits */
72#else 72#else
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 0e708c78e01c..6de813370b8c 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -8,7 +8,7 @@ config M68K
8 select GENERIC_IRQ_SHOW 8 select GENERIC_IRQ_SHOW
9 select GENERIC_ATOMIC64 9 select GENERIC_ATOMIC64
10 select HAVE_UID16 10 select HAVE_UID16
11 select HAVE_VIRT_TO_BUS 11 select VIRT_TO_BUS
12 select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS 12 select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS
13 select GENERIC_CPU_DEVICES 13 select GENERIC_CPU_DEVICES
14 select GENERIC_STRNCPY_FROM_USER if MMU 14 select GENERIC_STRNCPY_FROM_USER if MMU
diff --git a/arch/m68k/Kconfig.machine b/arch/m68k/Kconfig.machine
index 7cdf6b010381..7240584d3439 100644
--- a/arch/m68k/Kconfig.machine
+++ b/arch/m68k/Kconfig.machine
@@ -310,7 +310,6 @@ config COBRA5282
310config SOM5282EM 310config SOM5282EM
311 bool "EMAC.Inc SOM5282EM board support" 311 bool "EMAC.Inc SOM5282EM board support"
312 depends on M528x 312 depends on M528x
313 select EMAC_INC
314 help 313 help
315 Support for the EMAC.Inc SOM5282EM module. 314 Support for the EMAC.Inc SOM5282EM module.
316 315
diff --git a/arch/m68k/include/asm/MC68328.h b/arch/m68k/include/asm/MC68328.h
index a337e56d09bf..4ebf098b8a1f 100644
--- a/arch/m68k/include/asm/MC68328.h
+++ b/arch/m68k/include/asm/MC68328.h
@@ -293,7 +293,7 @@
293/* 293/*
294 * Here go the bitmasks themselves 294 * Here go the bitmasks themselves
295 */ 295 */
296#define IMR_MSPIM (1 << SPIM _IRQ_NUM) /* Mask SPI Master interrupt */ 296#define IMR_MSPIM (1 << SPIM_IRQ_NUM) /* Mask SPI Master interrupt */
297#define IMR_MTMR2 (1 << TMR2_IRQ_NUM) /* Mask Timer 2 interrupt */ 297#define IMR_MTMR2 (1 << TMR2_IRQ_NUM) /* Mask Timer 2 interrupt */
298#define IMR_MUART (1 << UART_IRQ_NUM) /* Mask UART interrupt */ 298#define IMR_MUART (1 << UART_IRQ_NUM) /* Mask UART interrupt */
299#define IMR_MWDT (1 << WDT_IRQ_NUM) /* Mask Watchdog Timer interrupt */ 299#define IMR_MWDT (1 << WDT_IRQ_NUM) /* Mask Watchdog Timer interrupt */
@@ -327,7 +327,7 @@
327#define IWR_ADDR 0xfffff308 327#define IWR_ADDR 0xfffff308
328#define IWR LONG_REF(IWR_ADDR) 328#define IWR LONG_REF(IWR_ADDR)
329 329
330#define IWR_SPIM (1 << SPIM _IRQ_NUM) /* SPI Master interrupt */ 330#define IWR_SPIM (1 << SPIM_IRQ_NUM) /* SPI Master interrupt */
331#define IWR_TMR2 (1 << TMR2_IRQ_NUM) /* Timer 2 interrupt */ 331#define IWR_TMR2 (1 << TMR2_IRQ_NUM) /* Timer 2 interrupt */
332#define IWR_UART (1 << UART_IRQ_NUM) /* UART interrupt */ 332#define IWR_UART (1 << UART_IRQ_NUM) /* UART interrupt */
333#define IWR_WDT (1 << WDT_IRQ_NUM) /* Watchdog Timer interrupt */ 333#define IWR_WDT (1 << WDT_IRQ_NUM) /* Watchdog Timer interrupt */
@@ -357,7 +357,7 @@
357#define ISR_ADDR 0xfffff30c 357#define ISR_ADDR 0xfffff30c
358#define ISR LONG_REF(ISR_ADDR) 358#define ISR LONG_REF(ISR_ADDR)
359 359
360#define ISR_SPIM (1 << SPIM _IRQ_NUM) /* SPI Master interrupt */ 360#define ISR_SPIM (1 << SPIM_IRQ_NUM) /* SPI Master interrupt */
361#define ISR_TMR2 (1 << TMR2_IRQ_NUM) /* Timer 2 interrupt */ 361#define ISR_TMR2 (1 << TMR2_IRQ_NUM) /* Timer 2 interrupt */
362#define ISR_UART (1 << UART_IRQ_NUM) /* UART interrupt */ 362#define ISR_UART (1 << UART_IRQ_NUM) /* UART interrupt */
363#define ISR_WDT (1 << WDT_IRQ_NUM) /* Watchdog Timer interrupt */ 363#define ISR_WDT (1 << WDT_IRQ_NUM) /* Watchdog Timer interrupt */
@@ -391,7 +391,7 @@
391#define IPR_ADDR 0xfffff310 391#define IPR_ADDR 0xfffff310
392#define IPR LONG_REF(IPR_ADDR) 392#define IPR LONG_REF(IPR_ADDR)
393 393
394#define IPR_SPIM (1 << SPIM _IRQ_NUM) /* SPI Master interrupt */ 394#define IPR_SPIM (1 << SPIM_IRQ_NUM) /* SPI Master interrupt */
395#define IPR_TMR2 (1 << TMR2_IRQ_NUM) /* Timer 2 interrupt */ 395#define IPR_TMR2 (1 << TMR2_IRQ_NUM) /* Timer 2 interrupt */
396#define IPR_UART (1 << UART_IRQ_NUM) /* UART interrupt */ 396#define IPR_UART (1 << UART_IRQ_NUM) /* UART interrupt */
397#define IPR_WDT (1 << WDT_IRQ_NUM) /* Watchdog Timer interrupt */ 397#define IPR_WDT (1 << WDT_IRQ_NUM) /* Watchdog Timer interrupt */
@@ -757,7 +757,7 @@
757 757
758/* 'EZ328-compatible definitions */ 758/* 'EZ328-compatible definitions */
759#define TCN_ADDR TCN1_ADDR 759#define TCN_ADDR TCN1_ADDR
760#define TCN TCN 760#define TCN TCN1
761 761
762/* 762/*
763 * Timer Unit 1 and 2 Status Registers 763 * Timer Unit 1 and 2 Status Registers
diff --git a/arch/m68k/kernel/setup_no.c b/arch/m68k/kernel/setup_no.c
index 71fb29938dba..911ba472e6c4 100644
--- a/arch/m68k/kernel/setup_no.c
+++ b/arch/m68k/kernel/setup_no.c
@@ -57,6 +57,9 @@ void (*mach_reset)(void);
57void (*mach_halt)(void); 57void (*mach_halt)(void);
58void (*mach_power_off)(void); 58void (*mach_power_off)(void);
59 59
60#ifdef CONFIG_M68000
61#define CPU_NAME "MC68000"
62#endif
60#ifdef CONFIG_M68328 63#ifdef CONFIG_M68328
61#define CPU_NAME "MC68328" 64#define CPU_NAME "MC68328"
62#endif 65#endif
diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
index afd8106fd83b..519aad8fa812 100644
--- a/arch/m68k/mm/init.c
+++ b/arch/m68k/mm/init.c
@@ -188,7 +188,7 @@ void __init mem_init(void)
188 } 188 }
189 } 189 }
190 190
191#if !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE) 191#if defined(CONFIG_MMU) && !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
192 /* insert pointer tables allocated so far into the tablelist */ 192 /* insert pointer tables allocated so far into the tablelist */
193 init_pointer_table((unsigned long)kernel_pg_dir); 193 init_pointer_table((unsigned long)kernel_pg_dir);
194 for (i = 0; i < PTRS_PER_PGD; i++) { 194 for (i = 0; i < PTRS_PER_PGD; i++) {
diff --git a/arch/m68k/platform/coldfire/m528x.c b/arch/m68k/platform/coldfire/m528x.c
index 83b7dad7a84e..b03a9d271837 100644
--- a/arch/m68k/platform/coldfire/m528x.c
+++ b/arch/m68k/platform/coldfire/m528x.c
@@ -69,7 +69,7 @@ static void __init m528x_uarts_init(void)
69 u8 port; 69 u8 port;
70 70
71 /* make sure PUAPAR is set for UART0 and UART1 */ 71 /* make sure PUAPAR is set for UART0 and UART1 */
72 port = readb(MCF5282_GPIO_PUAPAR); 72 port = readb(MCFGPIO_PUAPAR);
73 port |= 0x03 | (0x03 << 2); 73 port |= 0x03 | (0x03 << 2);
74 writeb(port, MCFGPIO_PUAPAR); 74 writeb(port, MCFGPIO_PUAPAR);
75} 75}
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index 7843d11156e6..1323fa2530eb 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -19,7 +19,7 @@ config MICROBLAZE
19 select HAVE_DEBUG_KMEMLEAK 19 select HAVE_DEBUG_KMEMLEAK
20 select IRQ_DOMAIN 20 select IRQ_DOMAIN
21 select HAVE_GENERIC_HARDIRQS 21 select HAVE_GENERIC_HARDIRQS
22 select HAVE_VIRT_TO_BUS 22 select VIRT_TO_BUS
23 select GENERIC_IRQ_PROBE 23 select GENERIC_IRQ_PROBE
24 select GENERIC_IRQ_SHOW 24 select GENERIC_IRQ_SHOW
25 select GENERIC_PCI_IOMAP 25 select GENERIC_PCI_IOMAP
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index ae9c716c46bb..cd2e21ff562a 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -38,7 +38,7 @@ config MIPS
38 select GENERIC_CLOCKEVENTS 38 select GENERIC_CLOCKEVENTS
39 select GENERIC_CMOS_UPDATE 39 select GENERIC_CMOS_UPDATE
40 select HAVE_MOD_ARCH_SPECIFIC 40 select HAVE_MOD_ARCH_SPECIFIC
41 select HAVE_VIRT_TO_BUS 41 select VIRT_TO_BUS
42 select MODULES_USE_ELF_REL if MODULES 42 select MODULES_USE_ELF_REL if MODULES
43 select MODULES_USE_ELF_RELA if MODULES && 64BIT 43 select MODULES_USE_ELF_RELA if MODULES && 64BIT
44 select CLONE_BACKWARDS 44 select CLONE_BACKWARDS
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig
index b06c7360b1c6..428da175d073 100644
--- a/arch/mn10300/Kconfig
+++ b/arch/mn10300/Kconfig
@@ -8,7 +8,7 @@ config MN10300
8 select HAVE_ARCH_KGDB 8 select HAVE_ARCH_KGDB
9 select GENERIC_ATOMIC64 9 select GENERIC_ATOMIC64
10 select HAVE_NMI_WATCHDOG if MN10300_WD_TIMER 10 select HAVE_NMI_WATCHDOG if MN10300_WD_TIMER
11 select HAVE_VIRT_TO_BUS 11 select VIRT_TO_BUS
12 select GENERIC_CLOCKEVENTS 12 select GENERIC_CLOCKEVENTS
13 select MODULES_USE_ELF_RELA 13 select MODULES_USE_ELF_RELA
14 select OLD_SIGSUSPEND3 14 select OLD_SIGSUSPEND3
diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index 014a6482ed4c..9ab3bf2eca8d 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -9,10 +9,9 @@ config OPENRISC
9 select OF_EARLY_FLATTREE 9 select OF_EARLY_FLATTREE
10 select IRQ_DOMAIN 10 select IRQ_DOMAIN
11 select HAVE_MEMBLOCK 11 select HAVE_MEMBLOCK
12 select ARCH_WANT_OPTIONAL_GPIOLIB 12 select ARCH_REQUIRE_GPIOLIB
13 select HAVE_ARCH_TRACEHOOK 13 select HAVE_ARCH_TRACEHOOK
14 select HAVE_GENERIC_HARDIRQS 14 select HAVE_GENERIC_HARDIRQS
15 select HAVE_VIRT_TO_BUS
16 select GENERIC_IRQ_CHIP 15 select GENERIC_IRQ_CHIP
17 select GENERIC_IRQ_PROBE 16 select GENERIC_IRQ_PROBE
18 select GENERIC_IRQ_SHOW 17 select GENERIC_IRQ_SHOW
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index a9ff712a2864..0339181bf3ac 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -21,7 +21,7 @@ config PARISC
21 select GENERIC_STRNCPY_FROM_USER 21 select GENERIC_STRNCPY_FROM_USER
22 select SYSCTL_ARCH_UNALIGN_ALLOW 22 select SYSCTL_ARCH_UNALIGN_ALLOW
23 select HAVE_MOD_ARCH_SPECIFIC 23 select HAVE_MOD_ARCH_SPECIFIC
24 select HAVE_VIRT_TO_BUS 24 select VIRT_TO_BUS
25 select MODULES_USE_ELF_RELA 25 select MODULES_USE_ELF_RELA
26 select CLONE_BACKWARDS 26 select CLONE_BACKWARDS
27 select TTY # Needed for pdc_cons.c 27 select TTY # Needed for pdc_cons.c
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index b89d7eb730a2..ea5bb045983a 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -90,6 +90,7 @@ config GENERIC_GPIO
90config PPC 90config PPC
91 bool 91 bool
92 default y 92 default y
93 select BINFMT_ELF
93 select OF 94 select OF
94 select OF_EARLY_FLATTREE 95 select OF_EARLY_FLATTREE
95 select HAVE_FTRACE_MCOUNT_RECORD 96 select HAVE_FTRACE_MCOUNT_RECORD
@@ -98,7 +99,7 @@ config PPC
98 select HAVE_FUNCTION_GRAPH_TRACER 99 select HAVE_FUNCTION_GRAPH_TRACER
99 select SYSCTL_EXCEPTION_TRACE 100 select SYSCTL_EXCEPTION_TRACE
100 select ARCH_WANT_OPTIONAL_GPIOLIB 101 select ARCH_WANT_OPTIONAL_GPIOLIB
101 select HAVE_VIRT_TO_BUS if !PPC64 102 select VIRT_TO_BUS if !PPC64
102 select HAVE_IDE 103 select HAVE_IDE
103 select HAVE_IOREMAP_PROT 104 select HAVE_IOREMAP_PROT
104 select HAVE_EFFICIENT_UNALIGNED_ACCESS 105 select HAVE_EFFICIENT_UNALIGNED_ACCESS
diff --git a/arch/powerpc/include/asm/mmu-hash64.h b/arch/powerpc/include/asm/mmu-hash64.h
index 2fdb47a19efd..b59e06f507ea 100644
--- a/arch/powerpc/include/asm/mmu-hash64.h
+++ b/arch/powerpc/include/asm/mmu-hash64.h
@@ -343,17 +343,16 @@ extern void slb_set_size(u16 size);
343/* 343/*
344 * VSID allocation (256MB segment) 344 * VSID allocation (256MB segment)
345 * 345 *
346 * We first generate a 38-bit "proto-VSID". For kernel addresses this 346 * We first generate a 37-bit "proto-VSID". Proto-VSIDs are generated
347 * is equal to the ESID | 1 << 37, for user addresses it is: 347 * from mmu context id and effective segment id of the address.
348 * (context << USER_ESID_BITS) | (esid & ((1U << USER_ESID_BITS) - 1)
349 * 348 *
350 * This splits the proto-VSID into the below range 349 * For user processes max context id is limited to ((1ul << 19) - 5)
351 * 0 - (2^(CONTEXT_BITS + USER_ESID_BITS) - 1) : User proto-VSID range 350 * for kernel space, we use the top 4 context ids to map address as below
352 * 2^(CONTEXT_BITS + USER_ESID_BITS) - 2^(VSID_BITS) : Kernel proto-VSID range 351 * NOTE: each context only support 64TB now.
353 * 352 * 0x7fffc - [ 0xc000000000000000 - 0xc0003fffffffffff ]
354 * We also have CONTEXT_BITS + USER_ESID_BITS = VSID_BITS - 1 353 * 0x7fffd - [ 0xd000000000000000 - 0xd0003fffffffffff ]
355 * That is, we assign half of the space to user processes and half 354 * 0x7fffe - [ 0xe000000000000000 - 0xe0003fffffffffff ]
356 * to the kernel. 355 * 0x7ffff - [ 0xf000000000000000 - 0xf0003fffffffffff ]
357 * 356 *
358 * The proto-VSIDs are then scrambled into real VSIDs with the 357 * The proto-VSIDs are then scrambled into real VSIDs with the
359 * multiplicative hash: 358 * multiplicative hash:
@@ -363,41 +362,49 @@ extern void slb_set_size(u16 size);
363 * VSID_MULTIPLIER is prime, so in particular it is 362 * VSID_MULTIPLIER is prime, so in particular it is
364 * co-prime to VSID_MODULUS, making this a 1:1 scrambling function. 363 * co-prime to VSID_MODULUS, making this a 1:1 scrambling function.
365 * Because the modulus is 2^n-1 we can compute it efficiently without 364 * Because the modulus is 2^n-1 we can compute it efficiently without
366 * a divide or extra multiply (see below). 365 * a divide or extra multiply (see below). The scramble function gives
367 * 366 * robust scattering in the hash table (at least based on some initial
368 * This scheme has several advantages over older methods: 367 * results).
369 *
370 * - We have VSIDs allocated for every kernel address
371 * (i.e. everything above 0xC000000000000000), except the very top
372 * segment, which simplifies several things.
373 * 368 *
374 * - We allow for USER_ESID_BITS significant bits of ESID and 369 * We also consider VSID 0 special. We use VSID 0 for slb entries mapping
375 * CONTEXT_BITS bits of context for user addresses. 370 * bad address. This enables us to consolidate bad address handling in
376 * i.e. 64T (46 bits) of address space for up to half a million contexts. 371 * hash_page.
377 * 372 *
378 * - The scramble function gives robust scattering in the hash 373 * We also need to avoid the last segment of the last context, because that
379 * table (at least based on some initial results). The previous 374 * would give a protovsid of 0x1fffffffff. That will result in a VSID 0
380 * method was more susceptible to pathological cases giving excessive 375 * because of the modulo operation in vsid scramble. But the vmemmap
381 * hash collisions. 376 * (which is what uses region 0xf) will never be close to 64TB in size
377 * (it's 56 bytes per page of system memory).
382 */ 378 */
383 379
380#define CONTEXT_BITS 19
381#define ESID_BITS 18
382#define ESID_BITS_1T 6
383
384/*
385 * 256MB segment
386 * The proto-VSID space has 2^(CONTEX_BITS + ESID_BITS) - 1 segments
387 * available for user + kernel mapping. The top 4 contexts are used for
388 * kernel mapping. Each segment contains 2^28 bytes. Each
389 * context maps 2^46 bytes (64TB) so we can support 2^19-1 contexts
390 * (19 == 37 + 28 - 46).
391 */
392#define MAX_USER_CONTEXT ((ASM_CONST(1) << CONTEXT_BITS) - 5)
393
384/* 394/*
385 * This should be computed such that protovosid * vsid_mulitplier 395 * This should be computed such that protovosid * vsid_mulitplier
386 * doesn't overflow 64 bits. It should also be co-prime to vsid_modulus 396 * doesn't overflow 64 bits. It should also be co-prime to vsid_modulus
387 */ 397 */
388#define VSID_MULTIPLIER_256M ASM_CONST(12538073) /* 24-bit prime */ 398#define VSID_MULTIPLIER_256M ASM_CONST(12538073) /* 24-bit prime */
389#define VSID_BITS_256M 38 399#define VSID_BITS_256M (CONTEXT_BITS + ESID_BITS)
390#define VSID_MODULUS_256M ((1UL<<VSID_BITS_256M)-1) 400#define VSID_MODULUS_256M ((1UL<<VSID_BITS_256M)-1)
391 401
392#define VSID_MULTIPLIER_1T ASM_CONST(12538073) /* 24-bit prime */ 402#define VSID_MULTIPLIER_1T ASM_CONST(12538073) /* 24-bit prime */
393#define VSID_BITS_1T 26 403#define VSID_BITS_1T (CONTEXT_BITS + ESID_BITS_1T)
394#define VSID_MODULUS_1T ((1UL<<VSID_BITS_1T)-1) 404#define VSID_MODULUS_1T ((1UL<<VSID_BITS_1T)-1)
395 405
396#define CONTEXT_BITS 19
397#define USER_ESID_BITS 18
398#define USER_ESID_BITS_1T 6
399 406
400#define USER_VSID_RANGE (1UL << (USER_ESID_BITS + SID_SHIFT)) 407#define USER_VSID_RANGE (1UL << (ESID_BITS + SID_SHIFT))
401 408
402/* 409/*
403 * This macro generates asm code to compute the VSID scramble 410 * This macro generates asm code to compute the VSID scramble
@@ -421,7 +428,8 @@ extern void slb_set_size(u16 size);
421 srdi rx,rt,VSID_BITS_##size; \ 428 srdi rx,rt,VSID_BITS_##size; \
422 clrldi rt,rt,(64-VSID_BITS_##size); \ 429 clrldi rt,rt,(64-VSID_BITS_##size); \
423 add rt,rt,rx; /* add high and low bits */ \ 430 add rt,rt,rx; /* add high and low bits */ \
424 /* Now, r3 == VSID (mod 2^36-1), and lies between 0 and \ 431 /* NOTE: explanation based on VSID_BITS_##size = 36 \
432 * Now, r3 == VSID (mod 2^36-1), and lies between 0 and \
425 * 2^36-1+2^28-1. That in particular means that if r3 >= \ 433 * 2^36-1+2^28-1. That in particular means that if r3 >= \
426 * 2^36-1, then r3+1 has the 2^36 bit set. So, if r3+1 has \ 434 * 2^36-1, then r3+1 has the 2^36 bit set. So, if r3+1 has \
427 * the bit clear, r3 already has the answer we want, if it \ 435 * the bit clear, r3 already has the answer we want, if it \
@@ -513,34 +521,6 @@ typedef struct {
513 }) 521 })
514#endif /* 1 */ 522#endif /* 1 */
515 523
516/*
517 * This is only valid for addresses >= PAGE_OFFSET
518 * The proto-VSID space is divided into two class
519 * User: 0 to 2^(CONTEXT_BITS + USER_ESID_BITS) -1
520 * kernel: 2^(CONTEXT_BITS + USER_ESID_BITS) to 2^(VSID_BITS) - 1
521 *
522 * With KERNEL_START at 0xc000000000000000, the proto vsid for
523 * the kernel ends up with 0xc00000000 (36 bits). With 64TB
524 * support we need to have kernel proto-VSID in the
525 * [2^37 to 2^38 - 1] range due to the increased USER_ESID_BITS.
526 */
527static inline unsigned long get_kernel_vsid(unsigned long ea, int ssize)
528{
529 unsigned long proto_vsid;
530 /*
531 * We need to make sure proto_vsid for the kernel is
532 * >= 2^(CONTEXT_BITS + USER_ESID_BITS[_1T])
533 */
534 if (ssize == MMU_SEGSIZE_256M) {
535 proto_vsid = ea >> SID_SHIFT;
536 proto_vsid |= (1UL << (CONTEXT_BITS + USER_ESID_BITS));
537 return vsid_scramble(proto_vsid, 256M);
538 }
539 proto_vsid = ea >> SID_SHIFT_1T;
540 proto_vsid |= (1UL << (CONTEXT_BITS + USER_ESID_BITS_1T));
541 return vsid_scramble(proto_vsid, 1T);
542}
543
544/* Returns the segment size indicator for a user address */ 524/* Returns the segment size indicator for a user address */
545static inline int user_segment_size(unsigned long addr) 525static inline int user_segment_size(unsigned long addr)
546{ 526{
@@ -550,17 +530,41 @@ static inline int user_segment_size(unsigned long addr)
550 return MMU_SEGSIZE_256M; 530 return MMU_SEGSIZE_256M;
551} 531}
552 532
553/* This is only valid for user addresses (which are below 2^44) */
554static inline unsigned long get_vsid(unsigned long context, unsigned long ea, 533static inline unsigned long get_vsid(unsigned long context, unsigned long ea,
555 int ssize) 534 int ssize)
556{ 535{
536 /*
537 * Bad address. We return VSID 0 for that
538 */
539 if ((ea & ~REGION_MASK) >= PGTABLE_RANGE)
540 return 0;
541
557 if (ssize == MMU_SEGSIZE_256M) 542 if (ssize == MMU_SEGSIZE_256M)
558 return vsid_scramble((context << USER_ESID_BITS) 543 return vsid_scramble((context << ESID_BITS)
559 | (ea >> SID_SHIFT), 256M); 544 | (ea >> SID_SHIFT), 256M);
560 return vsid_scramble((context << USER_ESID_BITS_1T) 545 return vsid_scramble((context << ESID_BITS_1T)
561 | (ea >> SID_SHIFT_1T), 1T); 546 | (ea >> SID_SHIFT_1T), 1T);
562} 547}
563 548
549/*
550 * This is only valid for addresses >= PAGE_OFFSET
551 *
552 * For kernel space, we use the top 4 context ids to map address as below
553 * 0x7fffc - [ 0xc000000000000000 - 0xc0003fffffffffff ]
554 * 0x7fffd - [ 0xd000000000000000 - 0xd0003fffffffffff ]
555 * 0x7fffe - [ 0xe000000000000000 - 0xe0003fffffffffff ]
556 * 0x7ffff - [ 0xf000000000000000 - 0xf0003fffffffffff ]
557 */
558static inline unsigned long get_kernel_vsid(unsigned long ea, int ssize)
559{
560 unsigned long context;
561
562 /*
563 * kernel take the top 4 context from the available range
564 */
565 context = (MAX_USER_CONTEXT) + ((ea >> 60) - 0xc) + 1;
566 return get_vsid(context, ea, ssize);
567}
564#endif /* __ASSEMBLY__ */ 568#endif /* __ASSEMBLY__ */
565 569
566#endif /* _ASM_POWERPC_MMU_HASH64_H_ */ 570#endif /* _ASM_POWERPC_MMU_HASH64_H_ */
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 75a3d71b895d..19599ef352bc 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -275,7 +275,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
275 .cpu_features = CPU_FTRS_PPC970, 275 .cpu_features = CPU_FTRS_PPC970,
276 .cpu_user_features = COMMON_USER_POWER4 | 276 .cpu_user_features = COMMON_USER_POWER4 |
277 PPC_FEATURE_HAS_ALTIVEC_COMP, 277 PPC_FEATURE_HAS_ALTIVEC_COMP,
278 .mmu_features = MMU_FTR_HPTE_TABLE, 278 .mmu_features = MMU_FTRS_PPC970,
279 .icache_bsize = 128, 279 .icache_bsize = 128,
280 .dcache_bsize = 128, 280 .dcache_bsize = 128,
281 .num_pmcs = 8, 281 .num_pmcs = 8,
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index 87ef8f5ee5bc..200afa5bcfb7 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -1452,20 +1452,36 @@ do_ste_alloc:
1452_GLOBAL(do_stab_bolted) 1452_GLOBAL(do_stab_bolted)
1453 stw r9,PACA_EXSLB+EX_CCR(r13) /* save CR in exc. frame */ 1453 stw r9,PACA_EXSLB+EX_CCR(r13) /* save CR in exc. frame */
1454 std r11,PACA_EXSLB+EX_SRR0(r13) /* save SRR0 in exc. frame */ 1454 std r11,PACA_EXSLB+EX_SRR0(r13) /* save SRR0 in exc. frame */
1455 mfspr r11,SPRN_DAR /* ea */
1455 1456
1457 /*
1458 * check for bad kernel/user address
1459 * (ea & ~REGION_MASK) >= PGTABLE_RANGE
1460 */
1461 rldicr. r9,r11,4,(63 - 46 - 4)
1462 li r9,0 /* VSID = 0 for bad address */
1463 bne- 0f
1464
1465 /*
1466 * Calculate VSID:
1467 * This is the kernel vsid, we take the top for context from
1468 * the range. context = (MAX_USER_CONTEXT) + ((ea >> 60) - 0xc) + 1
1469 * Here we know that (ea >> 60) == 0xc
1470 */
1471 lis r9,(MAX_USER_CONTEXT + 1)@ha
1472 addi r9,r9,(MAX_USER_CONTEXT + 1)@l
1473
1474 srdi r10,r11,SID_SHIFT
1475 rldimi r10,r9,ESID_BITS,0 /* proto vsid */
1476 ASM_VSID_SCRAMBLE(r10, r9, 256M)
1477 rldic r9,r10,12,16 /* r9 = vsid << 12 */
1478
14790:
1456 /* Hash to the primary group */ 1480 /* Hash to the primary group */
1457 ld r10,PACASTABVIRT(r13) 1481 ld r10,PACASTABVIRT(r13)
1458 mfspr r11,SPRN_DAR 1482 srdi r11,r11,SID_SHIFT
1459 srdi r11,r11,28
1460 rldimi r10,r11,7,52 /* r10 = first ste of the group */ 1483 rldimi r10,r11,7,52 /* r10 = first ste of the group */
1461 1484
1462 /* Calculate VSID */
1463 /* This is a kernel address, so protovsid = ESID | 1 << 37 */
1464 li r9,0x1
1465 rldimi r11,r9,(CONTEXT_BITS + USER_ESID_BITS),0
1466 ASM_VSID_SCRAMBLE(r11, r9, 256M)
1467 rldic r9,r11,12,16 /* r9 = vsid << 12 */
1468
1469 /* Search the primary group for a free entry */ 1485 /* Search the primary group for a free entry */
14701: ld r11,0(r10) /* Test valid bit of the current ste */ 14861: ld r11,0(r10) /* Test valid bit of the current ste */
1471 andi. r11,r11,0x80 1487 andi. r11,r11,0x80
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 7f7fb7fd991b..13f8d168b3f1 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -2832,11 +2832,13 @@ static void unreloc_toc(void)
2832{ 2832{
2833} 2833}
2834#else 2834#else
2835static void __reloc_toc(void *tocstart, unsigned long offset, 2835static void __reloc_toc(unsigned long offset, unsigned long nr_entries)
2836 unsigned long nr_entries)
2837{ 2836{
2838 unsigned long i; 2837 unsigned long i;
2839 unsigned long *toc_entry = (unsigned long *)tocstart; 2838 unsigned long *toc_entry;
2839
2840 /* Get the start of the TOC by using r2 directly. */
2841 asm volatile("addi %0,2,-0x8000" : "=b" (toc_entry));
2840 2842
2841 for (i = 0; i < nr_entries; i++) { 2843 for (i = 0; i < nr_entries; i++) {
2842 *toc_entry = *toc_entry + offset; 2844 *toc_entry = *toc_entry + offset;
@@ -2850,8 +2852,7 @@ static void reloc_toc(void)
2850 unsigned long nr_entries = 2852 unsigned long nr_entries =
2851 (__prom_init_toc_end - __prom_init_toc_start) / sizeof(long); 2853 (__prom_init_toc_end - __prom_init_toc_start) / sizeof(long);
2852 2854
2853 /* Need to add offset to get at __prom_init_toc_start */ 2855 __reloc_toc(offset, nr_entries);
2854 __reloc_toc(__prom_init_toc_start + offset, offset, nr_entries);
2855 2856
2856 mb(); 2857 mb();
2857} 2858}
@@ -2864,8 +2865,7 @@ static void unreloc_toc(void)
2864 2865
2865 mb(); 2866 mb();
2866 2867
2867 /* __prom_init_toc_start has been relocated, no need to add offset */ 2868 __reloc_toc(-offset, nr_entries);
2868 __reloc_toc(__prom_init_toc_start, -offset, nr_entries);
2869} 2869}
2870#endif 2870#endif
2871#endif 2871#endif
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index 245c1b6a0858..f9b30c68ba47 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -1428,6 +1428,7 @@ static long ppc_set_hwdebug(struct task_struct *child,
1428 1428
1429 brk.address = bp_info->addr & ~7UL; 1429 brk.address = bp_info->addr & ~7UL;
1430 brk.type = HW_BRK_TYPE_TRANSLATE; 1430 brk.type = HW_BRK_TYPE_TRANSLATE;
1431 brk.len = 8;
1431 if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_READ) 1432 if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_READ)
1432 brk.type |= HW_BRK_TYPE_READ; 1433 brk.type |= HW_BRK_TYPE_READ;
1433 if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_WRITE) 1434 if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_WRITE)
diff --git a/arch/powerpc/kvm/book3s_64_mmu_host.c b/arch/powerpc/kvm/book3s_64_mmu_host.c
index ead58e317294..5d7d29a313eb 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_host.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_host.c
@@ -326,8 +326,8 @@ int kvmppc_mmu_init(struct kvm_vcpu *vcpu)
326 vcpu3s->context_id[0] = err; 326 vcpu3s->context_id[0] = err;
327 327
328 vcpu3s->proto_vsid_max = ((vcpu3s->context_id[0] + 1) 328 vcpu3s->proto_vsid_max = ((vcpu3s->context_id[0] + 1)
329 << USER_ESID_BITS) - 1; 329 << ESID_BITS) - 1;
330 vcpu3s->proto_vsid_first = vcpu3s->context_id[0] << USER_ESID_BITS; 330 vcpu3s->proto_vsid_first = vcpu3s->context_id[0] << ESID_BITS;
331 vcpu3s->proto_vsid_next = vcpu3s->proto_vsid_first; 331 vcpu3s->proto_vsid_next = vcpu3s->proto_vsid_first;
332 332
333 kvmppc_mmu_hpte_init(vcpu); 333 kvmppc_mmu_hpte_init(vcpu);
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 1b6e1271719f..f410c3e12c1e 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -195,6 +195,11 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
195 unsigned long vpn = hpt_vpn(vaddr, vsid, ssize); 195 unsigned long vpn = hpt_vpn(vaddr, vsid, ssize);
196 unsigned long tprot = prot; 196 unsigned long tprot = prot;
197 197
198 /*
199 * If we hit a bad address return error.
200 */
201 if (!vsid)
202 return -1;
198 /* Make kernel text executable */ 203 /* Make kernel text executable */
199 if (overlaps_kernel_text(vaddr, vaddr + step)) 204 if (overlaps_kernel_text(vaddr, vaddr + step))
200 tprot &= ~HPTE_R_N; 205 tprot &= ~HPTE_R_N;
@@ -759,6 +764,8 @@ void __init early_init_mmu(void)
759 /* Initialize stab / SLB management */ 764 /* Initialize stab / SLB management */
760 if (mmu_has_feature(MMU_FTR_SLB)) 765 if (mmu_has_feature(MMU_FTR_SLB))
761 slb_initialize(); 766 slb_initialize();
767 else
768 stab_initialize(get_paca()->stab_real);
762} 769}
763 770
764#ifdef CONFIG_SMP 771#ifdef CONFIG_SMP
@@ -922,11 +929,6 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
922 DBG_LOW("hash_page(ea=%016lx, access=%lx, trap=%lx\n", 929 DBG_LOW("hash_page(ea=%016lx, access=%lx, trap=%lx\n",
923 ea, access, trap); 930 ea, access, trap);
924 931
925 if ((ea & ~REGION_MASK) >= PGTABLE_RANGE) {
926 DBG_LOW(" out of pgtable range !\n");
927 return 1;
928 }
929
930 /* Get region & vsid */ 932 /* Get region & vsid */
931 switch (REGION_ID(ea)) { 933 switch (REGION_ID(ea)) {
932 case USER_REGION_ID: 934 case USER_REGION_ID:
@@ -957,6 +959,11 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
957 } 959 }
958 DBG_LOW(" mm=%p, mm->pgdir=%p, vsid=%016lx\n", mm, mm->pgd, vsid); 960 DBG_LOW(" mm=%p, mm->pgdir=%p, vsid=%016lx\n", mm, mm->pgd, vsid);
959 961
962 /* Bad address. */
963 if (!vsid) {
964 DBG_LOW("Bad address!\n");
965 return 1;
966 }
960 /* Get pgdir */ 967 /* Get pgdir */
961 pgdir = mm->pgd; 968 pgdir = mm->pgd;
962 if (pgdir == NULL) 969 if (pgdir == NULL)
@@ -1126,6 +1133,8 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
1126 /* Get VSID */ 1133 /* Get VSID */
1127 ssize = user_segment_size(ea); 1134 ssize = user_segment_size(ea);
1128 vsid = get_vsid(mm->context.id, ea, ssize); 1135 vsid = get_vsid(mm->context.id, ea, ssize);
1136 if (!vsid)
1137 return;
1129 1138
1130 /* Hash doesn't like irqs */ 1139 /* Hash doesn't like irqs */
1131 local_irq_save(flags); 1140 local_irq_save(flags);
@@ -1233,6 +1242,9 @@ static void kernel_map_linear_page(unsigned long vaddr, unsigned long lmi)
1233 hash = hpt_hash(vpn, PAGE_SHIFT, mmu_kernel_ssize); 1242 hash = hpt_hash(vpn, PAGE_SHIFT, mmu_kernel_ssize);
1234 hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP); 1243 hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP);
1235 1244
1245 /* Don't create HPTE entries for bad address */
1246 if (!vsid)
1247 return;
1236 ret = ppc_md.hpte_insert(hpteg, vpn, __pa(vaddr), 1248 ret = ppc_md.hpte_insert(hpteg, vpn, __pa(vaddr),
1237 mode, HPTE_V_BOLTED, 1249 mode, HPTE_V_BOLTED,
1238 mmu_linear_psize, mmu_kernel_ssize); 1250 mmu_linear_psize, mmu_kernel_ssize);
diff --git a/arch/powerpc/mm/mmu_context_hash64.c b/arch/powerpc/mm/mmu_context_hash64.c
index 40bc5b0ace54..d1d1b92c5b99 100644
--- a/arch/powerpc/mm/mmu_context_hash64.c
+++ b/arch/powerpc/mm/mmu_context_hash64.c
@@ -29,15 +29,6 @@
29static DEFINE_SPINLOCK(mmu_context_lock); 29static DEFINE_SPINLOCK(mmu_context_lock);
30static DEFINE_IDA(mmu_context_ida); 30static DEFINE_IDA(mmu_context_ida);
31 31
32/*
33 * 256MB segment
34 * The proto-VSID space has 2^(CONTEX_BITS + USER_ESID_BITS) - 1 segments
35 * available for user mappings. Each segment contains 2^28 bytes. Each
36 * context maps 2^46 bytes (64TB) so we can support 2^19-1 contexts
37 * (19 == 37 + 28 - 46).
38 */
39#define MAX_CONTEXT ((1UL << CONTEXT_BITS) - 1)
40
41int __init_new_context(void) 32int __init_new_context(void)
42{ 33{
43 int index; 34 int index;
@@ -56,7 +47,7 @@ again:
56 else if (err) 47 else if (err)
57 return err; 48 return err;
58 49
59 if (index > MAX_CONTEXT) { 50 if (index > MAX_USER_CONTEXT) {
60 spin_lock(&mmu_context_lock); 51 spin_lock(&mmu_context_lock);
61 ida_remove(&mmu_context_ida, index); 52 ida_remove(&mmu_context_ida, index);
62 spin_unlock(&mmu_context_lock); 53 spin_unlock(&mmu_context_lock);
diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c
index e212a271c7a4..654258f165ae 100644
--- a/arch/powerpc/mm/pgtable_64.c
+++ b/arch/powerpc/mm/pgtable_64.c
@@ -61,7 +61,7 @@
61#endif 61#endif
62 62
63#ifdef CONFIG_PPC_STD_MMU_64 63#ifdef CONFIG_PPC_STD_MMU_64
64#if TASK_SIZE_USER64 > (1UL << (USER_ESID_BITS + SID_SHIFT)) 64#if TASK_SIZE_USER64 > (1UL << (ESID_BITS + SID_SHIFT))
65#error TASK_SIZE_USER64 exceeds user VSID range 65#error TASK_SIZE_USER64 exceeds user VSID range
66#endif 66#endif
67#endif 67#endif
diff --git a/arch/powerpc/mm/slb_low.S b/arch/powerpc/mm/slb_low.S
index 1a16ca227757..17aa6dfceb34 100644
--- a/arch/powerpc/mm/slb_low.S
+++ b/arch/powerpc/mm/slb_low.S
@@ -31,10 +31,15 @@
31 * No other registers are examined or changed. 31 * No other registers are examined or changed.
32 */ 32 */
33_GLOBAL(slb_allocate_realmode) 33_GLOBAL(slb_allocate_realmode)
34 /* r3 = faulting address */ 34 /*
35 * check for bad kernel/user address
36 * (ea & ~REGION_MASK) >= PGTABLE_RANGE
37 */
38 rldicr. r9,r3,4,(63 - 46 - 4)
39 bne- 8f
35 40
36 srdi r9,r3,60 /* get region */ 41 srdi r9,r3,60 /* get region */
37 srdi r10,r3,28 /* get esid */ 42 srdi r10,r3,SID_SHIFT /* get esid */
38 cmpldi cr7,r9,0xc /* cmp PAGE_OFFSET for later use */ 43 cmpldi cr7,r9,0xc /* cmp PAGE_OFFSET for later use */
39 44
40 /* r3 = address, r10 = esid, cr7 = <> PAGE_OFFSET */ 45 /* r3 = address, r10 = esid, cr7 = <> PAGE_OFFSET */
@@ -56,12 +61,14 @@ _GLOBAL(slb_allocate_realmode)
56 */ 61 */
57_GLOBAL(slb_miss_kernel_load_linear) 62_GLOBAL(slb_miss_kernel_load_linear)
58 li r11,0 63 li r11,0
59 li r9,0x1
60 /* 64 /*
61 * for 1T we shift 12 bits more. slb_finish_load_1T will do 65 * context = (MAX_USER_CONTEXT) + ((ea >> 60) - 0xc) + 1
62 * the necessary adjustment 66 * r9 = region id.
63 */ 67 */
64 rldimi r10,r9,(CONTEXT_BITS + USER_ESID_BITS),0 68 addis r9,r9,(MAX_USER_CONTEXT - 0xc + 1)@ha
69 addi r9,r9,(MAX_USER_CONTEXT - 0xc + 1)@l
70
71
65BEGIN_FTR_SECTION 72BEGIN_FTR_SECTION
66 b slb_finish_load 73 b slb_finish_load
67END_MMU_FTR_SECTION_IFCLR(MMU_FTR_1T_SEGMENT) 74END_MMU_FTR_SECTION_IFCLR(MMU_FTR_1T_SEGMENT)
@@ -91,24 +98,19 @@ _GLOBAL(slb_miss_kernel_load_vmemmap)
91 _GLOBAL(slb_miss_kernel_load_io) 98 _GLOBAL(slb_miss_kernel_load_io)
92 li r11,0 99 li r11,0
936: 1006:
94 li r9,0x1
95 /* 101 /*
96 * for 1T we shift 12 bits more. slb_finish_load_1T will do 102 * context = (MAX_USER_CONTEXT) + ((ea >> 60) - 0xc) + 1
97 * the necessary adjustment 103 * r9 = region id.
98 */ 104 */
99 rldimi r10,r9,(CONTEXT_BITS + USER_ESID_BITS),0 105 addis r9,r9,(MAX_USER_CONTEXT - 0xc + 1)@ha
106 addi r9,r9,(MAX_USER_CONTEXT - 0xc + 1)@l
107
100BEGIN_FTR_SECTION 108BEGIN_FTR_SECTION
101 b slb_finish_load 109 b slb_finish_load
102END_MMU_FTR_SECTION_IFCLR(MMU_FTR_1T_SEGMENT) 110END_MMU_FTR_SECTION_IFCLR(MMU_FTR_1T_SEGMENT)
103 b slb_finish_load_1T 111 b slb_finish_load_1T
104 112
1050: /* user address: proto-VSID = context << 15 | ESID. First check 1130:
106 * if the address is within the boundaries of the user region
107 */
108 srdi. r9,r10,USER_ESID_BITS
109 bne- 8f /* invalid ea bits set */
110
111
112 /* when using slices, we extract the psize off the slice bitmaps 114 /* when using slices, we extract the psize off the slice bitmaps
113 * and then we need to get the sllp encoding off the mmu_psize_defs 115 * and then we need to get the sllp encoding off the mmu_psize_defs
114 * array. 116 * array.
@@ -164,15 +166,13 @@ END_MMU_FTR_SECTION_IFCLR(MMU_FTR_1T_SEGMENT)
164 ld r9,PACACONTEXTID(r13) 166 ld r9,PACACONTEXTID(r13)
165BEGIN_FTR_SECTION 167BEGIN_FTR_SECTION
166 cmpldi r10,0x1000 168 cmpldi r10,0x1000
167END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT)
168 rldimi r10,r9,USER_ESID_BITS,0
169BEGIN_FTR_SECTION
170 bge slb_finish_load_1T 169 bge slb_finish_load_1T
171END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT) 170END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT)
172 b slb_finish_load 171 b slb_finish_load
173 172
1748: /* invalid EA */ 1738: /* invalid EA */
175 li r10,0 /* BAD_VSID */ 174 li r10,0 /* BAD_VSID */
175 li r9,0 /* BAD_VSID */
176 li r11,SLB_VSID_USER /* flags don't much matter */ 176 li r11,SLB_VSID_USER /* flags don't much matter */
177 b slb_finish_load 177 b slb_finish_load
178 178
@@ -221,8 +221,6 @@ _GLOBAL(slb_allocate_user)
221 221
222 /* get context to calculate proto-VSID */ 222 /* get context to calculate proto-VSID */
223 ld r9,PACACONTEXTID(r13) 223 ld r9,PACACONTEXTID(r13)
224 rldimi r10,r9,USER_ESID_BITS,0
225
226 /* fall through slb_finish_load */ 224 /* fall through slb_finish_load */
227 225
228#endif /* __DISABLED__ */ 226#endif /* __DISABLED__ */
@@ -231,9 +229,10 @@ _GLOBAL(slb_allocate_user)
231/* 229/*
232 * Finish loading of an SLB entry and return 230 * Finish loading of an SLB entry and return
233 * 231 *
234 * r3 = EA, r10 = proto-VSID, r11 = flags, clobbers r9, cr7 = <> PAGE_OFFSET 232 * r3 = EA, r9 = context, r10 = ESID, r11 = flags, clobbers r9, cr7 = <> PAGE_OFFSET
235 */ 233 */
236slb_finish_load: 234slb_finish_load:
235 rldimi r10,r9,ESID_BITS,0
237 ASM_VSID_SCRAMBLE(r10,r9,256M) 236 ASM_VSID_SCRAMBLE(r10,r9,256M)
238 /* 237 /*
239 * bits above VSID_BITS_256M need to be ignored from r10 238 * bits above VSID_BITS_256M need to be ignored from r10
@@ -298,10 +297,11 @@ _GLOBAL(slb_compare_rr_to_size)
298/* 297/*
299 * Finish loading of a 1T SLB entry (for the kernel linear mapping) and return. 298 * Finish loading of a 1T SLB entry (for the kernel linear mapping) and return.
300 * 299 *
301 * r3 = EA, r10 = proto-VSID, r11 = flags, clobbers r9 300 * r3 = EA, r9 = context, r10 = ESID(256MB), r11 = flags, clobbers r9
302 */ 301 */
303slb_finish_load_1T: 302slb_finish_load_1T:
304 srdi r10,r10,40-28 /* get 1T ESID */ 303 srdi r10,r10,(SID_SHIFT_1T - SID_SHIFT) /* get 1T ESID */
304 rldimi r10,r9,ESID_BITS_1T,0
305 ASM_VSID_SCRAMBLE(r10,r9,1T) 305 ASM_VSID_SCRAMBLE(r10,r9,1T)
306 /* 306 /*
307 * bits above VSID_BITS_1T need to be ignored from r10 307 * bits above VSID_BITS_1T need to be ignored from r10
diff --git a/arch/powerpc/mm/tlb_hash64.c b/arch/powerpc/mm/tlb_hash64.c
index 0d82ef50dc3f..023ec8a13f38 100644
--- a/arch/powerpc/mm/tlb_hash64.c
+++ b/arch/powerpc/mm/tlb_hash64.c
@@ -82,11 +82,11 @@ void hpte_need_flush(struct mm_struct *mm, unsigned long addr,
82 if (!is_kernel_addr(addr)) { 82 if (!is_kernel_addr(addr)) {
83 ssize = user_segment_size(addr); 83 ssize = user_segment_size(addr);
84 vsid = get_vsid(mm->context.id, addr, ssize); 84 vsid = get_vsid(mm->context.id, addr, ssize);
85 WARN_ON(vsid == 0);
86 } else { 85 } else {
87 vsid = get_kernel_vsid(addr, mmu_kernel_ssize); 86 vsid = get_kernel_vsid(addr, mmu_kernel_ssize);
88 ssize = mmu_kernel_ssize; 87 ssize = mmu_kernel_ssize;
89 } 88 }
89 WARN_ON(vsid == 0);
90 vpn = hpt_vpn(addr, vsid, ssize); 90 vpn = hpt_vpn(addr, vsid, ssize);
91 rpte = __real_pte(__pte(pte), ptep); 91 rpte = __real_pte(__pte(pte), ptep);
92 92
diff --git a/arch/powerpc/platforms/85xx/sgy_cts1000.c b/arch/powerpc/platforms/85xx/sgy_cts1000.c
index 611e92f291c4..7179726ba5c5 100644
--- a/arch/powerpc/platforms/85xx/sgy_cts1000.c
+++ b/arch/powerpc/platforms/85xx/sgy_cts1000.c
@@ -69,7 +69,7 @@ static irqreturn_t gpio_halt_irq(int irq, void *__data)
69 return IRQ_HANDLED; 69 return IRQ_HANDLED;
70}; 70};
71 71
72static int __devinit gpio_halt_probe(struct platform_device *pdev) 72static int gpio_halt_probe(struct platform_device *pdev)
73{ 73{
74 enum of_gpio_flags flags; 74 enum of_gpio_flags flags;
75 struct device_node *node = pdev->dev.of_node; 75 struct device_node *node = pdev->dev.of_node;
@@ -128,7 +128,7 @@ static int __devinit gpio_halt_probe(struct platform_device *pdev)
128 return 0; 128 return 0;
129} 129}
130 130
131static int __devexit gpio_halt_remove(struct platform_device *pdev) 131static int gpio_halt_remove(struct platform_device *pdev)
132{ 132{
133 if (halt_node) { 133 if (halt_node) {
134 int gpio = of_get_gpio(halt_node, 0); 134 int gpio = of_get_gpio(halt_node, 0);
@@ -165,7 +165,7 @@ static struct platform_driver gpio_halt_driver = {
165 .of_match_table = gpio_halt_match, 165 .of_match_table = gpio_halt_match,
166 }, 166 },
167 .probe = gpio_halt_probe, 167 .probe = gpio_halt_probe,
168 .remove = __devexit_p(gpio_halt_remove), 168 .remove = gpio_halt_remove,
169}; 169};
170 170
171module_platform_driver(gpio_halt_driver); 171module_platform_driver(gpio_halt_driver);
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index cea2f09c4241..18e3b76c78d7 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -124,9 +124,8 @@ config 6xx
124 select PPC_HAVE_PMU_SUPPORT 124 select PPC_HAVE_PMU_SUPPORT
125 125
126config POWER3 126config POWER3
127 bool
128 depends on PPC64 && PPC_BOOK3S 127 depends on PPC64 && PPC_BOOK3S
129 default y if !POWER4_ONLY 128 def_bool y
130 129
131config POWER4 130config POWER4
132 depends on PPC64 && PPC_BOOK3S 131 depends on PPC64 && PPC_BOOK3S
@@ -145,8 +144,7 @@ config TUNE_CELL
145 but somewhat slower on other machines. This option only changes 144 but somewhat slower on other machines. This option only changes
146 the scheduling of instructions, not the selection of instructions 145 the scheduling of instructions, not the selection of instructions
147 itself, so the resulting kernel will keep running on all other 146 itself, so the resulting kernel will keep running on all other
148 machines. When building a kernel that is supposed to run only 147 machines.
149 on Cell, you should also select the POWER4_ONLY option.
150 148
151# this is temp to handle compat with arch=ppc 149# this is temp to handle compat with arch=ppc
152config 8xx 150config 8xx
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 4b505370a1d5..eb8fb629f00b 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -134,7 +134,7 @@ config S390
134 select HAVE_SYSCALL_WRAPPERS 134 select HAVE_SYSCALL_WRAPPERS
135 select HAVE_UID16 if 32BIT 135 select HAVE_UID16 if 32BIT
136 select HAVE_VIRT_CPU_ACCOUNTING 136 select HAVE_VIRT_CPU_ACCOUNTING
137 select HAVE_VIRT_TO_BUS 137 select VIRT_TO_BUS
138 select INIT_ALL_POSSIBLE 138 select INIT_ALL_POSSIBLE
139 select KTIME_SCALAR if 32BIT 139 select KTIME_SCALAR if 32BIT
140 select MODULES_USE_ELF_RELA 140 select MODULES_USE_ELF_RELA
diff --git a/arch/s390/include/asm/eadm.h b/arch/s390/include/asm/eadm.h
index 8d4847191ecc..dc9200ca32ed 100644
--- a/arch/s390/include/asm/eadm.h
+++ b/arch/s390/include/asm/eadm.h
@@ -34,6 +34,8 @@ struct arsb {
34 u32 reserved[4]; 34 u32 reserved[4];
35} __packed; 35} __packed;
36 36
37#define EQC_WR_PROHIBIT 22
38
37struct msb { 39struct msb {
38 u8 fmt:4; 40 u8 fmt:4;
39 u8 oc:4; 41 u8 oc:4;
@@ -96,11 +98,13 @@ struct scm_device {
96#define OP_STATE_TEMP_ERR 2 98#define OP_STATE_TEMP_ERR 2
97#define OP_STATE_PERM_ERR 3 99#define OP_STATE_PERM_ERR 3
98 100
101enum scm_event {SCM_CHANGE, SCM_AVAIL};
102
99struct scm_driver { 103struct scm_driver {
100 struct device_driver drv; 104 struct device_driver drv;
101 int (*probe) (struct scm_device *scmdev); 105 int (*probe) (struct scm_device *scmdev);
102 int (*remove) (struct scm_device *scmdev); 106 int (*remove) (struct scm_device *scmdev);
103 void (*notify) (struct scm_device *scmdev); 107 void (*notify) (struct scm_device *scmdev, enum scm_event event);
104 void (*handler) (struct scm_device *scmdev, void *data, int error); 108 void (*handler) (struct scm_device *scmdev, void *data, int error);
105}; 109};
106 110
diff --git a/arch/s390/include/asm/tlbflush.h b/arch/s390/include/asm/tlbflush.h
index 1d8fe2b17ef6..6b32af30878c 100644
--- a/arch/s390/include/asm/tlbflush.h
+++ b/arch/s390/include/asm/tlbflush.h
@@ -74,8 +74,6 @@ static inline void __tlb_flush_idte(unsigned long asce)
74 74
75static inline void __tlb_flush_mm(struct mm_struct * mm) 75static inline void __tlb_flush_mm(struct mm_struct * mm)
76{ 76{
77 if (unlikely(cpumask_empty(mm_cpumask(mm))))
78 return;
79 /* 77 /*
80 * If the machine has IDTE we prefer to do a per mm flush 78 * If the machine has IDTE we prefer to do a per mm flush
81 * on all cpus instead of doing a local flush if the mm 79 * on all cpus instead of doing a local flush if the mm
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index 550228523267..94feff7d6132 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -636,7 +636,8 @@ ENTRY(mcck_int_handler)
636 UPDATE_VTIME %r14,%r15,__LC_MCCK_ENTER_TIMER 636 UPDATE_VTIME %r14,%r15,__LC_MCCK_ENTER_TIMER
637mcck_skip: 637mcck_skip:
638 SWITCH_ASYNC __LC_GPREGS_SAVE_AREA+32,__LC_PANIC_STACK,PAGE_SHIFT 638 SWITCH_ASYNC __LC_GPREGS_SAVE_AREA+32,__LC_PANIC_STACK,PAGE_SHIFT
639 mvc __PT_R0(64,%r11),__LC_GPREGS_SAVE_AREA 639 stm %r0,%r7,__PT_R0(%r11)
640 mvc __PT_R8(32,%r11),__LC_GPREGS_SAVE_AREA+32
640 stm %r8,%r9,__PT_PSW(%r11) 641 stm %r8,%r9,__PT_PSW(%r11)
641 xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15) 642 xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15)
642 l %r1,BASED(.Ldo_machine_check) 643 l %r1,BASED(.Ldo_machine_check)
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 9c837c101297..2e6d60c55f90 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -678,8 +678,9 @@ ENTRY(mcck_int_handler)
678 UPDATE_VTIME %r14,__LC_MCCK_ENTER_TIMER 678 UPDATE_VTIME %r14,__LC_MCCK_ENTER_TIMER
679 LAST_BREAK %r14 679 LAST_BREAK %r14
680mcck_skip: 680mcck_skip:
681 lghi %r14,__LC_GPREGS_SAVE_AREA 681 lghi %r14,__LC_GPREGS_SAVE_AREA+64
682 mvc __PT_R0(128,%r11),0(%r14) 682 stmg %r0,%r7,__PT_R0(%r11)
683 mvc __PT_R8(64,%r11),0(%r14)
683 stmg %r8,%r9,__PT_PSW(%r11) 684 stmg %r8,%r9,__PT_PSW(%r11)
684 xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) 685 xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
685 lgr %r2,%r11 # pass pointer to pt_regs 686 lgr %r2,%r11 # pass pointer to pt_regs
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index a5360de85ec7..29268859d8ee 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -571,6 +571,8 @@ static void __init setup_memory_end(void)
571 571
572 /* Split remaining virtual space between 1:1 mapping & vmemmap array */ 572 /* Split remaining virtual space between 1:1 mapping & vmemmap array */
573 tmp = VMALLOC_START / (PAGE_SIZE + sizeof(struct page)); 573 tmp = VMALLOC_START / (PAGE_SIZE + sizeof(struct page));
574 /* vmemmap contains a multiple of PAGES_PER_SECTION struct pages */
575 tmp = SECTION_ALIGN_UP(tmp);
574 tmp = VMALLOC_START - tmp * sizeof(struct page); 576 tmp = VMALLOC_START - tmp * sizeof(struct page);
575 tmp &= ~((vmax >> 11) - 1); /* align to page table level */ 577 tmp &= ~((vmax >> 11) - 1); /* align to page table level */
576 tmp = min(tmp, 1UL << MAX_PHYSMEM_BITS); 578 tmp = min(tmp, 1UL << MAX_PHYSMEM_BITS);
diff --git a/arch/score/Kconfig b/arch/score/Kconfig
index e569aa1fd2ba..c8def8bc9020 100644
--- a/arch/score/Kconfig
+++ b/arch/score/Kconfig
@@ -12,7 +12,7 @@ config SCORE
12 select GENERIC_CPU_DEVICES 12 select GENERIC_CPU_DEVICES
13 select GENERIC_CLOCKEVENTS 13 select GENERIC_CLOCKEVENTS
14 select HAVE_MOD_ARCH_SPECIFIC 14 select HAVE_MOD_ARCH_SPECIFIC
15 select HAVE_VIRT_TO_BUS 15 select VIRT_TO_BUS
16 select MODULES_USE_ELF_REL 16 select MODULES_USE_ELF_REL
17 select CLONE_BACKWARDS 17 select CLONE_BACKWARDS
18 18
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 289127d5241c..3d361f236308 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -84,12 +84,6 @@ config ARCH_DEFCONFIG
84 default "arch/sparc/configs/sparc32_defconfig" if SPARC32 84 default "arch/sparc/configs/sparc32_defconfig" if SPARC32
85 default "arch/sparc/configs/sparc64_defconfig" if SPARC64 85 default "arch/sparc/configs/sparc64_defconfig" if SPARC64
86 86
87# CONFIG_BITS can be used at source level to get 32/64 bits
88config BITS
89 int
90 default 32 if SPARC32
91 default 64 if SPARC64
92
93config IOMMU_HELPER 87config IOMMU_HELPER
94 bool 88 bool
95 default y if SPARC64 89 default y if SPARC64
@@ -197,7 +191,7 @@ config RWSEM_XCHGADD_ALGORITHM
197 191
198config GENERIC_HWEIGHT 192config GENERIC_HWEIGHT
199 bool 193 bool
200 default y if !ULTRA_HAS_POPULATION_COUNT 194 default y
201 195
202config GENERIC_CALIBRATE_DELAY 196config GENERIC_CALIBRATE_DELAY
203 bool 197 bool
diff --git a/arch/sparc/include/asm/spitfire.h b/arch/sparc/include/asm/spitfire.h
index d06a26601753..6b67e50fb9b4 100644
--- a/arch/sparc/include/asm/spitfire.h
+++ b/arch/sparc/include/asm/spitfire.h
@@ -45,6 +45,7 @@
45#define SUN4V_CHIP_NIAGARA3 0x03 45#define SUN4V_CHIP_NIAGARA3 0x03
46#define SUN4V_CHIP_NIAGARA4 0x04 46#define SUN4V_CHIP_NIAGARA4 0x04
47#define SUN4V_CHIP_NIAGARA5 0x05 47#define SUN4V_CHIP_NIAGARA5 0x05
48#define SUN4V_CHIP_SPARC64X 0x8a
48#define SUN4V_CHIP_UNKNOWN 0xff 49#define SUN4V_CHIP_UNKNOWN 0xff
49 50
50#ifndef __ASSEMBLY__ 51#ifndef __ASSEMBLY__
diff --git a/arch/sparc/kernel/cpu.c b/arch/sparc/kernel/cpu.c
index a6c94a2bf9d4..5c5125895db8 100644
--- a/arch/sparc/kernel/cpu.c
+++ b/arch/sparc/kernel/cpu.c
@@ -493,6 +493,12 @@ static void __init sun4v_cpu_probe(void)
493 sparc_pmu_type = "niagara5"; 493 sparc_pmu_type = "niagara5";
494 break; 494 break;
495 495
496 case SUN4V_CHIP_SPARC64X:
497 sparc_cpu_type = "SPARC64-X";
498 sparc_fpu_type = "SPARC64-X integrated FPU";
499 sparc_pmu_type = "sparc64-x";
500 break;
501
496 default: 502 default:
497 printk(KERN_WARNING "CPU: Unknown sun4v cpu type [%s]\n", 503 printk(KERN_WARNING "CPU: Unknown sun4v cpu type [%s]\n",
498 prom_cpu_compatible); 504 prom_cpu_compatible);
diff --git a/arch/sparc/kernel/head_64.S b/arch/sparc/kernel/head_64.S
index 2feb15c35d9e..26b706a1867d 100644
--- a/arch/sparc/kernel/head_64.S
+++ b/arch/sparc/kernel/head_64.S
@@ -134,6 +134,8 @@ prom_niagara_prefix:
134 .asciz "SUNW,UltraSPARC-T" 134 .asciz "SUNW,UltraSPARC-T"
135prom_sparc_prefix: 135prom_sparc_prefix:
136 .asciz "SPARC-" 136 .asciz "SPARC-"
137prom_sparc64x_prefix:
138 .asciz "SPARC64-X"
137 .align 4 139 .align 4
138prom_root_compatible: 140prom_root_compatible:
139 .skip 64 141 .skip 64
@@ -412,7 +414,7 @@ sun4v_chip_type:
412 cmp %g2, 'T' 414 cmp %g2, 'T'
413 be,pt %xcc, 70f 415 be,pt %xcc, 70f
414 cmp %g2, 'M' 416 cmp %g2, 'M'
415 bne,pn %xcc, 4f 417 bne,pn %xcc, 49f
416 nop 418 nop
417 419
41870: ldub [%g1 + 7], %g2 42070: ldub [%g1 + 7], %g2
@@ -425,7 +427,7 @@ sun4v_chip_type:
425 cmp %g2, '5' 427 cmp %g2, '5'
426 be,pt %xcc, 5f 428 be,pt %xcc, 5f
427 mov SUN4V_CHIP_NIAGARA5, %g4 429 mov SUN4V_CHIP_NIAGARA5, %g4
428 ba,pt %xcc, 4f 430 ba,pt %xcc, 49f
429 nop 431 nop
430 432
43191: sethi %hi(prom_cpu_compatible), %g1 43391: sethi %hi(prom_cpu_compatible), %g1
@@ -439,6 +441,25 @@ sun4v_chip_type:
439 mov SUN4V_CHIP_NIAGARA2, %g4 441 mov SUN4V_CHIP_NIAGARA2, %g4
440 442
4414: 4434:
444 /* Athena */
445 sethi %hi(prom_cpu_compatible), %g1
446 or %g1, %lo(prom_cpu_compatible), %g1
447 sethi %hi(prom_sparc64x_prefix), %g7
448 or %g7, %lo(prom_sparc64x_prefix), %g7
449 mov 9, %g3
45041: ldub [%g7], %g2
451 ldub [%g1], %g4
452 cmp %g2, %g4
453 bne,pn %icc, 49f
454 add %g7, 1, %g7
455 subcc %g3, 1, %g3
456 bne,pt %xcc, 41b
457 add %g1, 1, %g1
458 mov SUN4V_CHIP_SPARC64X, %g4
459 ba,pt %xcc, 5f
460 nop
461
46249:
442 mov SUN4V_CHIP_UNKNOWN, %g4 463 mov SUN4V_CHIP_UNKNOWN, %g4
4435: sethi %hi(sun4v_chip_type), %g2 4645: sethi %hi(sun4v_chip_type), %g2
444 or %g2, %lo(sun4v_chip_type), %g2 465 or %g2, %lo(sun4v_chip_type), %g2
diff --git a/arch/sparc/kernel/leon_pci_grpci2.c b/arch/sparc/kernel/leon_pci_grpci2.c
index fc4320886a3a..4d1487138d26 100644
--- a/arch/sparc/kernel/leon_pci_grpci2.c
+++ b/arch/sparc/kernel/leon_pci_grpci2.c
@@ -186,6 +186,8 @@ struct grpci2_cap_first {
186#define CAP9_IOMAP_OFS 0x20 186#define CAP9_IOMAP_OFS 0x20
187#define CAP9_BARSIZE_OFS 0x24 187#define CAP9_BARSIZE_OFS 0x24
188 188
189#define TGT 256
190
189struct grpci2_priv { 191struct grpci2_priv {
190 struct leon_pci_info info; /* must be on top of this structure */ 192 struct leon_pci_info info; /* must be on top of this structure */
191 struct grpci2_regs *regs; 193 struct grpci2_regs *regs;
@@ -237,8 +239,12 @@ static int grpci2_cfg_r32(struct grpci2_priv *priv, unsigned int bus,
237 if (where & 0x3) 239 if (where & 0x3)
238 return -EINVAL; 240 return -EINVAL;
239 241
240 if (bus == 0 && PCI_SLOT(devfn) != 0) 242 if (bus == 0) {
241 devfn += (0x8 * 6); 243 devfn += (0x8 * 6); /* start at AD16=Device0 */
244 } else if (bus == TGT) {
245 bus = 0;
246 devfn = 0; /* special case: bridge controller itself */
247 }
242 248
243 /* Select bus */ 249 /* Select bus */
244 spin_lock_irqsave(&grpci2_dev_lock, flags); 250 spin_lock_irqsave(&grpci2_dev_lock, flags);
@@ -303,8 +309,12 @@ static int grpci2_cfg_w32(struct grpci2_priv *priv, unsigned int bus,
303 if (where & 0x3) 309 if (where & 0x3)
304 return -EINVAL; 310 return -EINVAL;
305 311
306 if (bus == 0 && PCI_SLOT(devfn) != 0) 312 if (bus == 0) {
307 devfn += (0x8 * 6); 313 devfn += (0x8 * 6); /* start at AD16=Device0 */
314 } else if (bus == TGT) {
315 bus = 0;
316 devfn = 0; /* special case: bridge controller itself */
317 }
308 318
309 /* Select bus */ 319 /* Select bus */
310 spin_lock_irqsave(&grpci2_dev_lock, flags); 320 spin_lock_irqsave(&grpci2_dev_lock, flags);
@@ -368,7 +378,7 @@ static int grpci2_read_config(struct pci_bus *bus, unsigned int devfn,
368 unsigned int busno = bus->number; 378 unsigned int busno = bus->number;
369 int ret; 379 int ret;
370 380
371 if (PCI_SLOT(devfn) > 15 || (PCI_SLOT(devfn) == 0 && busno == 0)) { 381 if (PCI_SLOT(devfn) > 15 || busno > 255) {
372 *val = ~0; 382 *val = ~0;
373 return 0; 383 return 0;
374 } 384 }
@@ -406,7 +416,7 @@ static int grpci2_write_config(struct pci_bus *bus, unsigned int devfn,
406 struct grpci2_priv *priv = grpci2priv; 416 struct grpci2_priv *priv = grpci2priv;
407 unsigned int busno = bus->number; 417 unsigned int busno = bus->number;
408 418
409 if (PCI_SLOT(devfn) > 15 || (PCI_SLOT(devfn) == 0 && busno == 0)) 419 if (PCI_SLOT(devfn) > 15 || busno > 255)
410 return 0; 420 return 0;
411 421
412#ifdef GRPCI2_DEBUG_CFGACCESS 422#ifdef GRPCI2_DEBUG_CFGACCESS
@@ -578,15 +588,15 @@ void grpci2_hw_init(struct grpci2_priv *priv)
578 REGSTORE(regs->ahbmst_map[i], priv->pci_area); 588 REGSTORE(regs->ahbmst_map[i], priv->pci_area);
579 589
580 /* Get the GRPCI2 Host PCI ID */ 590 /* Get the GRPCI2 Host PCI ID */
581 grpci2_cfg_r32(priv, 0, 0, PCI_VENDOR_ID, &priv->pciid); 591 grpci2_cfg_r32(priv, TGT, 0, PCI_VENDOR_ID, &priv->pciid);
582 592
583 /* Get address to first (always defined) capability structure */ 593 /* Get address to first (always defined) capability structure */
584 grpci2_cfg_r8(priv, 0, 0, PCI_CAPABILITY_LIST, &capptr); 594 grpci2_cfg_r8(priv, TGT, 0, PCI_CAPABILITY_LIST, &capptr);
585 595
586 /* Enable/Disable Byte twisting */ 596 /* Enable/Disable Byte twisting */
587 grpci2_cfg_r32(priv, 0, 0, capptr+CAP9_IOMAP_OFS, &io_map); 597 grpci2_cfg_r32(priv, TGT, 0, capptr+CAP9_IOMAP_OFS, &io_map);
588 io_map = (io_map & ~0x1) | (priv->bt_enabled ? 1 : 0); 598 io_map = (io_map & ~0x1) | (priv->bt_enabled ? 1 : 0);
589 grpci2_cfg_w32(priv, 0, 0, capptr+CAP9_IOMAP_OFS, io_map); 599 grpci2_cfg_w32(priv, TGT, 0, capptr+CAP9_IOMAP_OFS, io_map);
590 600
591 /* Setup the Host's PCI Target BARs for other peripherals to access, 601 /* Setup the Host's PCI Target BARs for other peripherals to access,
592 * and do DMA to the host's memory. The target BARs can be sized and 602 * and do DMA to the host's memory. The target BARs can be sized and
@@ -617,17 +627,18 @@ void grpci2_hw_init(struct grpci2_priv *priv)
617 pciadr = 0; 627 pciadr = 0;
618 } 628 }
619 } 629 }
620 grpci2_cfg_w32(priv, 0, 0, capptr+CAP9_BARSIZE_OFS+i*4, bar_sz); 630 grpci2_cfg_w32(priv, TGT, 0, capptr+CAP9_BARSIZE_OFS+i*4,
621 grpci2_cfg_w32(priv, 0, 0, PCI_BASE_ADDRESS_0+i*4, pciadr); 631 bar_sz);
622 grpci2_cfg_w32(priv, 0, 0, capptr+CAP9_BAR_OFS+i*4, ahbadr); 632 grpci2_cfg_w32(priv, TGT, 0, PCI_BASE_ADDRESS_0+i*4, pciadr);
633 grpci2_cfg_w32(priv, TGT, 0, capptr+CAP9_BAR_OFS+i*4, ahbadr);
623 printk(KERN_INFO " TGT BAR[%d]: 0x%08x (PCI)-> 0x%08x\n", 634 printk(KERN_INFO " TGT BAR[%d]: 0x%08x (PCI)-> 0x%08x\n",
624 i, pciadr, ahbadr); 635 i, pciadr, ahbadr);
625 } 636 }
626 637
627 /* set as bus master and enable pci memory responses */ 638 /* set as bus master and enable pci memory responses */
628 grpci2_cfg_r32(priv, 0, 0, PCI_COMMAND, &data); 639 grpci2_cfg_r32(priv, TGT, 0, PCI_COMMAND, &data);
629 data |= (PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER); 640 data |= (PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
630 grpci2_cfg_w32(priv, 0, 0, PCI_COMMAND, data); 641 grpci2_cfg_w32(priv, TGT, 0, PCI_COMMAND, data);
631 642
632 /* Enable Error respone (CPU-TRAP) on illegal memory access. */ 643 /* Enable Error respone (CPU-TRAP) on illegal memory access. */
633 REGSTORE(regs->ctrl, CTRL_ER | CTRL_PE); 644 REGSTORE(regs->ctrl, CTRL_ER | CTRL_PE);
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
index ff496ab1e794..25877aebc685 100644
--- a/arch/tile/Kconfig
+++ b/arch/tile/Kconfig
@@ -17,7 +17,7 @@ config TILE
17 select GENERIC_IRQ_SHOW 17 select GENERIC_IRQ_SHOW
18 select HAVE_DEBUG_BUGVERBOSE 18 select HAVE_DEBUG_BUGVERBOSE
19 select HAVE_SYSCALL_WRAPPERS if TILEGX 19 select HAVE_SYSCALL_WRAPPERS if TILEGX
20 select HAVE_VIRT_TO_BUS 20 select VIRT_TO_BUS
21 select SYS_HYPERVISOR 21 select SYS_HYPERVISOR
22 select ARCH_HAVE_NMI_SAFE_CMPXCHG 22 select ARCH_HAVE_NMI_SAFE_CMPXCHG
23 select GENERIC_CLOCKEVENTS 23 select GENERIC_CLOCKEVENTS
diff --git a/arch/unicore32/Kconfig b/arch/unicore32/Kconfig
index dc50b157fc83..2943e3acdf0c 100644
--- a/arch/unicore32/Kconfig
+++ b/arch/unicore32/Kconfig
@@ -9,7 +9,7 @@ config UNICORE32
9 select GENERIC_ATOMIC64 9 select GENERIC_ATOMIC64
10 select HAVE_KERNEL_LZO 10 select HAVE_KERNEL_LZO
11 select HAVE_KERNEL_LZMA 11 select HAVE_KERNEL_LZMA
12 select HAVE_VIRT_TO_BUS 12 select VIRT_TO_BUS
13 select ARCH_HAVE_CUSTOM_GPIO_H 13 select ARCH_HAVE_CUSTOM_GPIO_H
14 select GENERIC_FIND_FIRST_BIT 14 select GENERIC_FIND_FIRST_BIT
15 select GENERIC_IRQ_PROBE 15 select GENERIC_IRQ_PROBE
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index a4f24f5b1218..70c0f3da0476 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -112,7 +112,7 @@ config X86
112 select GENERIC_STRNLEN_USER 112 select GENERIC_STRNLEN_USER
113 select HAVE_CONTEXT_TRACKING if X86_64 113 select HAVE_CONTEXT_TRACKING if X86_64
114 select HAVE_IRQ_TIME_ACCOUNTING 114 select HAVE_IRQ_TIME_ACCOUNTING
115 select HAVE_VIRT_TO_BUS 115 select VIRT_TO_BUS
116 select MODULES_USE_ELF_REL if X86_32 116 select MODULES_USE_ELF_REL if X86_32
117 select MODULES_USE_ELF_RELA if X86_64 117 select MODULES_USE_ELF_RELA if X86_64
118 select CLONE_BACKWARDS if X86_32 118 select CLONE_BACKWARDS if X86_32
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
index 826054a4f2ee..b05a575d56f4 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -729,3 +729,13 @@ void intel_ds_init(void)
729 } 729 }
730 } 730 }
731} 731}
732
733void perf_restore_debug_store(void)
734{
735 struct debug_store *ds = __this_cpu_read(cpu_hw_events.ds);
736
737 if (!x86_pmu.bts && !x86_pmu.pebs)
738 return;
739
740 wrmsrl(MSR_IA32_DS_AREA, (unsigned long)ds);
741}
diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu.c
index 120cee1c3f8d..3c68768d7a75 100644
--- a/arch/x86/power/cpu.c
+++ b/arch/x86/power/cpu.c
@@ -11,6 +11,7 @@
11#include <linux/suspend.h> 11#include <linux/suspend.h>
12#include <linux/export.h> 12#include <linux/export.h>
13#include <linux/smp.h> 13#include <linux/smp.h>
14#include <linux/perf_event.h>
14 15
15#include <asm/pgtable.h> 16#include <asm/pgtable.h>
16#include <asm/proto.h> 17#include <asm/proto.h>
@@ -228,6 +229,7 @@ static void __restore_processor_state(struct saved_context *ctxt)
228 do_fpu_end(); 229 do_fpu_end();
229 x86_platform.restore_sched_clock_state(); 230 x86_platform.restore_sched_clock_state();
230 mtrr_bp_restore(); 231 mtrr_bp_restore();
232 perf_restore_debug_store();
231} 233}
232 234
233/* Needed by apm.c */ 235/* Needed by apm.c */
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 35876ffac11d..b09de49dbec5 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -9,7 +9,7 @@ config XTENSA
9 select HAVE_IDE 9 select HAVE_IDE
10 select GENERIC_ATOMIC64 10 select GENERIC_ATOMIC64
11 select HAVE_GENERIC_HARDIRQS 11 select HAVE_GENERIC_HARDIRQS
12 select HAVE_VIRT_TO_BUS 12 select VIRT_TO_BUS
13 select GENERIC_IRQ_SHOW 13 select GENERIC_IRQ_SHOW
14 select GENERIC_CPU_DEVICES 14 select GENERIC_CPU_DEVICES
15 select MODULES_USE_ELF_RELA 15 select MODULES_USE_ELF_RELA
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c
index 53e7ac9403a7..e854582f29a6 100644
--- a/drivers/acpi/processor_perflib.c
+++ b/drivers/acpi/processor_perflib.c
@@ -465,7 +465,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
465 return result; 465 return result;
466} 466}
467 467
468static int acpi_processor_get_performance_info(struct acpi_processor *pr) 468int acpi_processor_get_performance_info(struct acpi_processor *pr)
469{ 469{
470 int result = 0; 470 int result = 0;
471 acpi_status status = AE_OK; 471 acpi_status status = AE_OK;
@@ -509,7 +509,7 @@ static int acpi_processor_get_performance_info(struct acpi_processor *pr)
509#endif 509#endif
510 return result; 510 return result;
511} 511}
512 512EXPORT_SYMBOL_GPL(acpi_processor_get_performance_info);
513int acpi_processor_notify_smm(struct module *calling_module) 513int acpi_processor_notify_smm(struct module *calling_module)
514{ 514{
515 acpi_status status; 515 acpi_status status;
diff --git a/drivers/amba/tegra-ahb.c b/drivers/amba/tegra-ahb.c
index 093c43554963..1f44e56cc65d 100644
--- a/drivers/amba/tegra-ahb.c
+++ b/drivers/amba/tegra-ahb.c
@@ -158,7 +158,7 @@ int tegra_ahb_enable_smmu(struct device_node *dn)
158EXPORT_SYMBOL(tegra_ahb_enable_smmu); 158EXPORT_SYMBOL(tegra_ahb_enable_smmu);
159#endif 159#endif
160 160
161#ifdef CONFIG_PM_SLEEP 161#ifdef CONFIG_PM
162static int tegra_ahb_suspend(struct device *dev) 162static int tegra_ahb_suspend(struct device *dev)
163{ 163{
164 int i; 164 int i;
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index a8a41e07a221..b282af181b44 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -74,8 +74,10 @@ static struct usb_device_id ath3k_table[] = {
74 74
75 /* Atheros AR3012 with sflash firmware*/ 75 /* Atheros AR3012 with sflash firmware*/
76 { USB_DEVICE(0x0CF3, 0x3004) }, 76 { USB_DEVICE(0x0CF3, 0x3004) },
77 { USB_DEVICE(0x0CF3, 0x3008) },
77 { USB_DEVICE(0x0CF3, 0x311D) }, 78 { USB_DEVICE(0x0CF3, 0x311D) },
78 { USB_DEVICE(0x13d3, 0x3375) }, 79 { USB_DEVICE(0x13d3, 0x3375) },
80 { USB_DEVICE(0x04CA, 0x3004) },
79 { USB_DEVICE(0x04CA, 0x3005) }, 81 { USB_DEVICE(0x04CA, 0x3005) },
80 { USB_DEVICE(0x04CA, 0x3006) }, 82 { USB_DEVICE(0x04CA, 0x3006) },
81 { USB_DEVICE(0x04CA, 0x3008) }, 83 { USB_DEVICE(0x04CA, 0x3008) },
@@ -106,8 +108,10 @@ static struct usb_device_id ath3k_blist_tbl[] = {
106 108
107 /* Atheros AR3012 with sflash firmware*/ 109 /* Atheros AR3012 with sflash firmware*/
108 { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, 110 { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 },
111 { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 },
109 { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 }, 112 { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 },
110 { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, 113 { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 },
114 { USB_DEVICE(0x04ca, 0x3004), .driver_info = BTUSB_ATH3012 },
111 { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, 115 { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 },
112 { USB_DEVICE(0x04ca, 0x3006), .driver_info = BTUSB_ATH3012 }, 116 { USB_DEVICE(0x04ca, 0x3006), .driver_info = BTUSB_ATH3012 },
113 { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, 117 { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 },
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 7e351e345476..e547851870e7 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -132,8 +132,10 @@ static struct usb_device_id blacklist_table[] = {
132 132
133 /* Atheros 3012 with sflash firmware */ 133 /* Atheros 3012 with sflash firmware */
134 { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, 134 { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 },
135 { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 },
135 { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, 136 { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 },
136 { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, 137 { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 },
138 { USB_DEVICE(0x04ca, 0x3004), .driver_info = BTUSB_ATH3012 },
137 { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, 139 { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 },
138 { USB_DEVICE(0x04ca, 0x3006), .driver_info = BTUSB_ATH3012 }, 140 { USB_DEVICE(0x04ca, 0x3006), .driver_info = BTUSB_ATH3012 },
139 { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, 141 { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 },
diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c
index 10fd71ccf587..6bf4d47324eb 100644
--- a/drivers/char/hw_random/virtio-rng.c
+++ b/drivers/char/hw_random/virtio-rng.c
@@ -92,14 +92,22 @@ static int probe_common(struct virtio_device *vdev)
92{ 92{
93 int err; 93 int err;
94 94
95 if (vq) {
96 /* We only support one device for now */
97 return -EBUSY;
98 }
95 /* We expect a single virtqueue. */ 99 /* We expect a single virtqueue. */
96 vq = virtio_find_single_vq(vdev, random_recv_done, "input"); 100 vq = virtio_find_single_vq(vdev, random_recv_done, "input");
97 if (IS_ERR(vq)) 101 if (IS_ERR(vq)) {
98 return PTR_ERR(vq); 102 err = PTR_ERR(vq);
103 vq = NULL;
104 return err;
105 }
99 106
100 err = hwrng_register(&virtio_hwrng); 107 err = hwrng_register(&virtio_hwrng);
101 if (err) { 108 if (err) {
102 vdev->config->del_vqs(vdev); 109 vdev->config->del_vqs(vdev);
110 vq = NULL;
103 return err; 111 return err;
104 } 112 }
105 113
@@ -112,6 +120,7 @@ static void remove_common(struct virtio_device *vdev)
112 busy = false; 120 busy = false;
113 hwrng_unregister(&virtio_hwrng); 121 hwrng_unregister(&virtio_hwrng);
114 vdev->config->del_vqs(vdev); 122 vdev->config->del_vqs(vdev);
123 vq = NULL;
115} 124}
116 125
117static int virtrng_probe(struct virtio_device *vdev) 126static int virtrng_probe(struct virtio_device *vdev)
diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c
index b5538bba7a10..09c63315e579 100644
--- a/drivers/clk/clk-vt8500.c
+++ b/drivers/clk/clk-vt8500.c
@@ -157,7 +157,7 @@ static int vt8500_dclk_set_rate(struct clk_hw *hw, unsigned long rate,
157 divisor = parent_rate / rate; 157 divisor = parent_rate / rate;
158 158
159 /* If prate / rate would be decimal, incr the divisor */ 159 /* If prate / rate would be decimal, incr the divisor */
160 if (rate * divisor < *prate) 160 if (rate * divisor < parent_rate)
161 divisor++; 161 divisor++;
162 162
163 if (divisor == cdev->div_mask + 1) 163 if (divisor == cdev->div_mask + 1)
diff --git a/drivers/clk/tegra/clk-tegra20.c b/drivers/clk/tegra/clk-tegra20.c
index 143ce1f899ad..1e2de7305362 100644
--- a/drivers/clk/tegra/clk-tegra20.c
+++ b/drivers/clk/tegra/clk-tegra20.c
@@ -1292,7 +1292,6 @@ static struct tegra_clk_duplicate tegra_clk_duplicates[] = {
1292 TEGRA_CLK_DUPLICATE(usbd, "tegra-ehci.0", NULL), 1292 TEGRA_CLK_DUPLICATE(usbd, "tegra-ehci.0", NULL),
1293 TEGRA_CLK_DUPLICATE(usbd, "tegra-otg", NULL), 1293 TEGRA_CLK_DUPLICATE(usbd, "tegra-otg", NULL),
1294 TEGRA_CLK_DUPLICATE(cclk, NULL, "cpu"), 1294 TEGRA_CLK_DUPLICATE(cclk, NULL, "cpu"),
1295 TEGRA_CLK_DUPLICATE(twd, "smp_twd", NULL),
1296 TEGRA_CLK_DUPLICATE(clk_max, NULL, NULL), /* Must be the last entry */ 1295 TEGRA_CLK_DUPLICATE(clk_max, NULL, NULL), /* Must be the last entry */
1297}; 1296};
1298 1297
diff --git a/drivers/clk/tegra/clk-tegra30.c b/drivers/clk/tegra/clk-tegra30.c
index 32c61cb6d0bb..ba6f51bc9f3b 100644
--- a/drivers/clk/tegra/clk-tegra30.c
+++ b/drivers/clk/tegra/clk-tegra30.c
@@ -1931,7 +1931,6 @@ static struct tegra_clk_duplicate tegra_clk_duplicates[] = {
1931 TEGRA_CLK_DUPLICATE(cml1, "tegra_sata_cml", NULL), 1931 TEGRA_CLK_DUPLICATE(cml1, "tegra_sata_cml", NULL),
1932 TEGRA_CLK_DUPLICATE(cml0, "tegra_pcie", "cml"), 1932 TEGRA_CLK_DUPLICATE(cml0, "tegra_pcie", "cml"),
1933 TEGRA_CLK_DUPLICATE(pciex, "tegra_pcie", "pciex"), 1933 TEGRA_CLK_DUPLICATE(pciex, "tegra_pcie", "pciex"),
1934 TEGRA_CLK_DUPLICATE(twd, "smp_twd", NULL),
1935 TEGRA_CLK_DUPLICATE(vcp, "nvavp", "vcp"), 1934 TEGRA_CLK_DUPLICATE(vcp, "nvavp", "vcp"),
1936 TEGRA_CLK_DUPLICATE(clk_max, NULL, NULL), /* MUST be the last entry */ 1935 TEGRA_CLK_DUPLICATE(clk_max, NULL, NULL), /* MUST be the last entry */
1937}; 1936};
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index 7472182967ce..61a6fde6c089 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -42,6 +42,7 @@
42#include <linux/io.h> 42#include <linux/io.h>
43#include <linux/of_irq.h> 43#include <linux/of_irq.h>
44#include <linux/of_device.h> 44#include <linux/of_device.h>
45#include <linux/clk.h>
45#include <linux/pinctrl/consumer.h> 46#include <linux/pinctrl/consumer.h>
46 47
47/* 48/*
@@ -496,6 +497,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
496 struct resource *res; 497 struct resource *res;
497 struct irq_chip_generic *gc; 498 struct irq_chip_generic *gc;
498 struct irq_chip_type *ct; 499 struct irq_chip_type *ct;
500 struct clk *clk;
499 unsigned int ngpios; 501 unsigned int ngpios;
500 int soc_variant; 502 int soc_variant;
501 int i, cpu, id; 503 int i, cpu, id;
@@ -529,6 +531,11 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
529 return id; 531 return id;
530 } 532 }
531 533
534 clk = devm_clk_get(&pdev->dev, NULL);
535 /* Not all SoCs require a clock.*/
536 if (!IS_ERR(clk))
537 clk_prepare_enable(clk);
538
532 mvchip->soc_variant = soc_variant; 539 mvchip->soc_variant = soc_variant;
533 mvchip->chip.label = dev_name(&pdev->dev); 540 mvchip->chip.label = dev_name(&pdev->dev);
534 mvchip->chip.dev = &pdev->dev; 541 mvchip->chip.dev = &pdev->dev;
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c
index 5fa13267bd9f..02e369f80449 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c
@@ -544,13 +544,13 @@ nv50_disp_curs_ofuncs = {
544static void 544static void
545nv50_disp_base_vblank_enable(struct nouveau_event *event, int head) 545nv50_disp_base_vblank_enable(struct nouveau_event *event, int head)
546{ 546{
547 nv_mask(event->priv, 0x61002c, (1 << head), (1 << head)); 547 nv_mask(event->priv, 0x61002c, (4 << head), (4 << head));
548} 548}
549 549
550static void 550static void
551nv50_disp_base_vblank_disable(struct nouveau_event *event, int head) 551nv50_disp_base_vblank_disable(struct nouveau_event *event, int head)
552{ 552{
553 nv_mask(event->priv, 0x61002c, (1 << head), (0 << head)); 553 nv_mask(event->priv, 0x61002c, (4 << head), 0);
554} 554}
555 555
556static int 556static int
diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c
index 41241922263f..3b6dc883e150 100644
--- a/drivers/gpu/drm/nouveau/nouveau_abi16.c
+++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c
@@ -116,6 +116,11 @@ nouveau_abi16_chan_fini(struct nouveau_abi16 *abi16,
116{ 116{
117 struct nouveau_abi16_ntfy *ntfy, *temp; 117 struct nouveau_abi16_ntfy *ntfy, *temp;
118 118
119 /* wait for all activity to stop before releasing notify object, which
120 * may be still in use */
121 if (chan->chan && chan->ntfy)
122 nouveau_channel_idle(chan->chan);
123
119 /* cleanup notifier state */ 124 /* cleanup notifier state */
120 list_for_each_entry_safe(ntfy, temp, &chan->notifiers, head) { 125 list_for_each_entry_safe(ntfy, temp, &chan->notifiers, head) {
121 nouveau_abi16_ntfy_fini(chan, ntfy); 126 nouveau_abi16_ntfy_fini(chan, ntfy);
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 11ca82148edc..7ff10711a4d0 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -801,7 +801,7 @@ nv50_bo_move_m2mf(struct nouveau_channel *chan, struct ttm_buffer_object *bo,
801 stride = 16 * 4; 801 stride = 16 * 4;
802 height = amount / stride; 802 height = amount / stride;
803 803
804 if (new_mem->mem_type == TTM_PL_VRAM && 804 if (old_mem->mem_type == TTM_PL_VRAM &&
805 nouveau_bo_tile_layout(nvbo)) { 805 nouveau_bo_tile_layout(nvbo)) {
806 ret = RING_SPACE(chan, 8); 806 ret = RING_SPACE(chan, 8);
807 if (ret) 807 if (ret)
@@ -823,7 +823,7 @@ nv50_bo_move_m2mf(struct nouveau_channel *chan, struct ttm_buffer_object *bo,
823 BEGIN_NV04(chan, NvSubCopy, 0x0200, 1); 823 BEGIN_NV04(chan, NvSubCopy, 0x0200, 1);
824 OUT_RING (chan, 1); 824 OUT_RING (chan, 1);
825 } 825 }
826 if (old_mem->mem_type == TTM_PL_VRAM && 826 if (new_mem->mem_type == TTM_PL_VRAM &&
827 nouveau_bo_tile_layout(nvbo)) { 827 nouveau_bo_tile_layout(nvbo)) {
828 ret = RING_SPACE(chan, 8); 828 ret = RING_SPACE(chan, 8);
829 if (ret) 829 if (ret)
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index 87a5a56ed358..2db57990f65c 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -2276,6 +2276,7 @@ nv50_display_create(struct drm_device *dev)
2276 NV_WARN(drm, "failed to create encoder %d/%d/%d: %d\n", 2276 NV_WARN(drm, "failed to create encoder %d/%d/%d: %d\n",
2277 dcbe->location, dcbe->type, 2277 dcbe->location, dcbe->type,
2278 ffs(dcbe->or) - 1, ret); 2278 ffs(dcbe->or) - 1, ret);
2279 ret = 0;
2279 } 2280 }
2280 } 2281 }
2281 2282
diff --git a/drivers/hwmon/lineage-pem.c b/drivers/hwmon/lineage-pem.c
index 41df29f59b0e..ebbb9f4f27a3 100644
--- a/drivers/hwmon/lineage-pem.c
+++ b/drivers/hwmon/lineage-pem.c
@@ -422,6 +422,7 @@ static struct attribute *pem_input_attributes[] = {
422 &sensor_dev_attr_in2_input.dev_attr.attr, 422 &sensor_dev_attr_in2_input.dev_attr.attr,
423 &sensor_dev_attr_curr1_input.dev_attr.attr, 423 &sensor_dev_attr_curr1_input.dev_attr.attr,
424 &sensor_dev_attr_power1_input.dev_attr.attr, 424 &sensor_dev_attr_power1_input.dev_attr.attr,
425 NULL
425}; 426};
426 427
427static const struct attribute_group pem_input_group = { 428static const struct attribute_group pem_input_group = {
@@ -432,6 +433,7 @@ static struct attribute *pem_fan_attributes[] = {
432 &sensor_dev_attr_fan1_input.dev_attr.attr, 433 &sensor_dev_attr_fan1_input.dev_attr.attr,
433 &sensor_dev_attr_fan2_input.dev_attr.attr, 434 &sensor_dev_attr_fan2_input.dev_attr.attr,
434 &sensor_dev_attr_fan3_input.dev_attr.attr, 435 &sensor_dev_attr_fan3_input.dev_attr.attr,
436 NULL
435}; 437};
436 438
437static const struct attribute_group pem_fan_group = { 439static const struct attribute_group pem_fan_group = {
diff --git a/drivers/hwmon/lm75.h b/drivers/hwmon/lm75.h
index 668ff4721323..5cde94e56f17 100644
--- a/drivers/hwmon/lm75.h
+++ b/drivers/hwmon/lm75.h
@@ -25,7 +25,7 @@
25 which contains this code, we don't worry about the wasted space. 25 which contains this code, we don't worry about the wasted space.
26*/ 26*/
27 27
28#include <linux/hwmon.h> 28#include <linux/kernel.h>
29 29
30/* straight from the datasheet */ 30/* straight from the datasheet */
31#define LM75_TEMP_MIN (-55000) 31#define LM75_TEMP_MIN (-55000)
diff --git a/drivers/hwmon/pmbus/ltc2978.c b/drivers/hwmon/pmbus/ltc2978.c
index a58de38e23d8..6d6130752f94 100644
--- a/drivers/hwmon/pmbus/ltc2978.c
+++ b/drivers/hwmon/pmbus/ltc2978.c
@@ -59,7 +59,7 @@ enum chips { ltc2978, ltc3880 };
59struct ltc2978_data { 59struct ltc2978_data {
60 enum chips id; 60 enum chips id;
61 int vin_min, vin_max; 61 int vin_min, vin_max;
62 int temp_min, temp_max; 62 int temp_min, temp_max[2];
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; 65 int temp2_max;
@@ -113,9 +113,10 @@ static int ltc2978_read_word_data_common(struct i2c_client *client, int page,
113 ret = pmbus_read_word_data(client, page, 113 ret = pmbus_read_word_data(client, page,
114 LTC2978_MFR_TEMPERATURE_PEAK); 114 LTC2978_MFR_TEMPERATURE_PEAK);
115 if (ret >= 0) { 115 if (ret >= 0) {
116 if (lin11_to_val(ret) > lin11_to_val(data->temp_max)) 116 if (lin11_to_val(ret)
117 data->temp_max = ret; 117 > lin11_to_val(data->temp_max[page]))
118 ret = data->temp_max; 118 data->temp_max[page] = ret;
119 ret = data->temp_max[page];
119 } 120 }
120 break; 121 break;
121 case PMBUS_VIRT_RESET_VOUT_HISTORY: 122 case PMBUS_VIRT_RESET_VOUT_HISTORY:
@@ -266,7 +267,7 @@ static int ltc2978_write_word_data(struct i2c_client *client, int page,
266 break; 267 break;
267 case PMBUS_VIRT_RESET_TEMP_HISTORY: 268 case PMBUS_VIRT_RESET_TEMP_HISTORY:
268 data->temp_min = 0x7bff; 269 data->temp_min = 0x7bff;
269 data->temp_max = 0x7c00; 270 data->temp_max[page] = 0x7c00;
270 ret = ltc2978_clear_peaks(client, page, data->id); 271 ret = ltc2978_clear_peaks(client, page, data->id);
271 break; 272 break;
272 default: 273 default:
@@ -323,7 +324,8 @@ static int ltc2978_probe(struct i2c_client *client,
323 data->vin_min = 0x7bff; 324 data->vin_min = 0x7bff;
324 data->vin_max = 0x7c00; 325 data->vin_max = 0x7c00;
325 data->temp_min = 0x7bff; 326 data->temp_min = 0x7bff;
326 data->temp_max = 0x7c00; 327 for (i = 0; i < ARRAY_SIZE(data->temp_max); i++)
328 data->temp_max[i] = 0x7c00;
327 data->temp2_max = 0x7c00; 329 data->temp2_max = 0x7c00;
328 330
329 switch (data->id) { 331 switch (data->id) {
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index 80eef50c50fd..9add60920ac0 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -766,12 +766,14 @@ static ssize_t pmbus_show_label(struct device *dev,
766static int pmbus_add_attribute(struct pmbus_data *data, struct attribute *attr) 766static int pmbus_add_attribute(struct pmbus_data *data, struct attribute *attr)
767{ 767{
768 if (data->num_attributes >= data->max_attributes - 1) { 768 if (data->num_attributes >= data->max_attributes - 1) {
769 data->max_attributes += PMBUS_ATTR_ALLOC_SIZE; 769 int new_max_attrs = data->max_attributes + PMBUS_ATTR_ALLOC_SIZE;
770 data->group.attrs = krealloc(data->group.attrs, 770 void *new_attrs = krealloc(data->group.attrs,
771 sizeof(struct attribute *) * 771 new_max_attrs * sizeof(void *),
772 data->max_attributes, GFP_KERNEL); 772 GFP_KERNEL);
773 if (data->group.attrs == NULL) 773 if (!new_attrs)
774 return -ENOMEM; 774 return -ENOMEM;
775 data->group.attrs = new_attrs;
776 data->max_attributes = new_max_attrs;
775 } 777 }
776 778
777 data->group.attrs[data->num_attributes++] = attr; 779 data->group.attrs[data->num_attributes++] = attr;
diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig
index 46cde098c11c..e380c6eef3af 100644
--- a/drivers/i2c/Kconfig
+++ b/drivers/i2c/Kconfig
@@ -4,7 +4,6 @@
4 4
5menuconfig I2C 5menuconfig I2C
6 tristate "I2C support" 6 tristate "I2C support"
7 depends on !S390
8 select RT_MUTEXES 7 select RT_MUTEXES
9 ---help--- 8 ---help---
10 I2C (pronounce: I-squared-C) is a slow serial bus protocol used in 9 I2C (pronounce: I-squared-C) is a slow serial bus protocol used in
@@ -76,6 +75,7 @@ config I2C_HELPER_AUTO
76 75
77config I2C_SMBUS 76config I2C_SMBUS
78 tristate "SMBus-specific protocols" if !I2C_HELPER_AUTO 77 tristate "SMBus-specific protocols" if !I2C_HELPER_AUTO
78 depends on GENERIC_HARDIRQS
79 help 79 help
80 Say Y here if you want support for SMBus extensions to the I2C 80 Say Y here if you want support for SMBus extensions to the I2C
81 specification. At the moment, the only supported extension is 81 specification. At the moment, the only supported extension is
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index a3725de92384..adfee98486b1 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -114,7 +114,7 @@ config I2C_I801
114 114
115config I2C_ISCH 115config I2C_ISCH
116 tristate "Intel SCH SMBus 1.0" 116 tristate "Intel SCH SMBus 1.0"
117 depends on PCI 117 depends on PCI && GENERIC_HARDIRQS
118 select LPC_SCH 118 select LPC_SCH
119 help 119 help
120 Say Y here if you want to use SMBus controller on the Intel SCH 120 Say Y here if you want to use SMBus controller on the Intel SCH
@@ -543,6 +543,7 @@ config I2C_NUC900
543 543
544config I2C_OCORES 544config I2C_OCORES
545 tristate "OpenCores I2C Controller" 545 tristate "OpenCores I2C Controller"
546 depends on GENERIC_HARDIRQS
546 help 547 help
547 If you say yes to this option, support will be included for the 548 If you say yes to this option, support will be included for the
548 OpenCores I2C controller. For details see 549 OpenCores I2C controller. For details see
@@ -777,7 +778,7 @@ config I2C_DIOLAN_U2C
777 778
778config I2C_PARPORT 779config I2C_PARPORT
779 tristate "Parallel port adapter" 780 tristate "Parallel port adapter"
780 depends on PARPORT 781 depends on PARPORT && GENERIC_HARDIRQS
781 select I2C_ALGOBIT 782 select I2C_ALGOBIT
782 select I2C_SMBUS 783 select I2C_SMBUS
783 help 784 help
@@ -802,6 +803,7 @@ config I2C_PARPORT
802 803
803config I2C_PARPORT_LIGHT 804config I2C_PARPORT_LIGHT
804 tristate "Parallel port adapter (light)" 805 tristate "Parallel port adapter (light)"
806 depends on GENERIC_HARDIRQS
805 select I2C_ALGOBIT 807 select I2C_ALGOBIT
806 select I2C_SMBUS 808 select I2C_SMBUS
807 help 809 help
diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c
index 0198324a8b0c..bd33473f8e38 100644
--- a/drivers/iio/common/st_sensors/st_sensors_core.c
+++ b/drivers/iio/common/st_sensors/st_sensors_core.c
@@ -62,7 +62,7 @@ st_sensors_match_odr_error:
62int st_sensors_set_odr(struct iio_dev *indio_dev, unsigned int odr) 62int st_sensors_set_odr(struct iio_dev *indio_dev, unsigned int odr)
63{ 63{
64 int err; 64 int err;
65 struct st_sensor_odr_avl odr_out; 65 struct st_sensor_odr_avl odr_out = {0, 0};
66 struct st_sensor_data *sdata = iio_priv(indio_dev); 66 struct st_sensor_data *sdata = iio_priv(indio_dev);
67 67
68 err = st_sensors_match_odr(sdata->sensor, odr, &odr_out); 68 err = st_sensors_match_odr(sdata->sensor, odr, &odr_out);
@@ -114,7 +114,7 @@ st_sensors_match_odr_error:
114 114
115static int st_sensors_set_fullscale(struct iio_dev *indio_dev, unsigned int fs) 115static int st_sensors_set_fullscale(struct iio_dev *indio_dev, unsigned int fs)
116{ 116{
117 int err, i; 117 int err, i = 0;
118 struct st_sensor_data *sdata = iio_priv(indio_dev); 118 struct st_sensor_data *sdata = iio_priv(indio_dev);
119 119
120 err = st_sensors_match_fs(sdata->sensor, fs, &i); 120 err = st_sensors_match_fs(sdata->sensor, fs, &i);
@@ -139,14 +139,13 @@ st_accel_set_fullscale_error:
139 139
140int st_sensors_set_enable(struct iio_dev *indio_dev, bool enable) 140int st_sensors_set_enable(struct iio_dev *indio_dev, bool enable)
141{ 141{
142 bool found;
143 u8 tmp_value; 142 u8 tmp_value;
144 int err = -EINVAL; 143 int err = -EINVAL;
145 struct st_sensor_odr_avl odr_out; 144 bool found = false;
145 struct st_sensor_odr_avl odr_out = {0, 0};
146 struct st_sensor_data *sdata = iio_priv(indio_dev); 146 struct st_sensor_data *sdata = iio_priv(indio_dev);
147 147
148 if (enable) { 148 if (enable) {
149 found = false;
150 tmp_value = sdata->sensor->pw.value_on; 149 tmp_value = sdata->sensor->pw.value_on;
151 if ((sdata->sensor->odr.addr == sdata->sensor->pw.addr) && 150 if ((sdata->sensor->odr.addr == sdata->sensor->pw.addr) &&
152 (sdata->sensor->odr.mask == sdata->sensor->pw.mask)) { 151 (sdata->sensor->odr.mask == sdata->sensor->pw.mask)) {
diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c
index 2fe1d4edcb2f..74f2d52795f6 100644
--- a/drivers/iio/dac/ad5064.c
+++ b/drivers/iio/dac/ad5064.c
@@ -27,7 +27,6 @@
27#define AD5064_ADDR(x) ((x) << 20) 27#define AD5064_ADDR(x) ((x) << 20)
28#define AD5064_CMD(x) ((x) << 24) 28#define AD5064_CMD(x) ((x) << 24)
29 29
30#define AD5064_ADDR_DAC(chan) (chan)
31#define AD5064_ADDR_ALL_DAC 0xF 30#define AD5064_ADDR_ALL_DAC 0xF
32 31
33#define AD5064_CMD_WRITE_INPUT_N 0x0 32#define AD5064_CMD_WRITE_INPUT_N 0x0
@@ -131,15 +130,15 @@ static int ad5064_write(struct ad5064_state *st, unsigned int cmd,
131} 130}
132 131
133static int ad5064_sync_powerdown_mode(struct ad5064_state *st, 132static int ad5064_sync_powerdown_mode(struct ad5064_state *st,
134 unsigned int channel) 133 const struct iio_chan_spec *chan)
135{ 134{
136 unsigned int val; 135 unsigned int val;
137 int ret; 136 int ret;
138 137
139 val = (0x1 << channel); 138 val = (0x1 << chan->address);
140 139
141 if (st->pwr_down[channel]) 140 if (st->pwr_down[chan->channel])
142 val |= st->pwr_down_mode[channel] << 8; 141 val |= st->pwr_down_mode[chan->channel] << 8;
143 142
144 ret = ad5064_write(st, AD5064_CMD_POWERDOWN_DAC, 0, val, 0); 143 ret = ad5064_write(st, AD5064_CMD_POWERDOWN_DAC, 0, val, 0);
145 144
@@ -169,7 +168,7 @@ static int ad5064_set_powerdown_mode(struct iio_dev *indio_dev,
169 mutex_lock(&indio_dev->mlock); 168 mutex_lock(&indio_dev->mlock);
170 st->pwr_down_mode[chan->channel] = mode + 1; 169 st->pwr_down_mode[chan->channel] = mode + 1;
171 170
172 ret = ad5064_sync_powerdown_mode(st, chan->channel); 171 ret = ad5064_sync_powerdown_mode(st, chan);
173 mutex_unlock(&indio_dev->mlock); 172 mutex_unlock(&indio_dev->mlock);
174 173
175 return ret; 174 return ret;
@@ -205,7 +204,7 @@ static ssize_t ad5064_write_dac_powerdown(struct iio_dev *indio_dev,
205 mutex_lock(&indio_dev->mlock); 204 mutex_lock(&indio_dev->mlock);
206 st->pwr_down[chan->channel] = pwr_down; 205 st->pwr_down[chan->channel] = pwr_down;
207 206
208 ret = ad5064_sync_powerdown_mode(st, chan->channel); 207 ret = ad5064_sync_powerdown_mode(st, chan);
209 mutex_unlock(&indio_dev->mlock); 208 mutex_unlock(&indio_dev->mlock);
210 return ret ? ret : len; 209 return ret ? ret : len;
211} 210}
@@ -258,7 +257,7 @@ static int ad5064_write_raw(struct iio_dev *indio_dev,
258 257
259 switch (mask) { 258 switch (mask) {
260 case IIO_CHAN_INFO_RAW: 259 case IIO_CHAN_INFO_RAW:
261 if (val > (1 << chan->scan_type.realbits) || val < 0) 260 if (val >= (1 << chan->scan_type.realbits) || val < 0)
262 return -EINVAL; 261 return -EINVAL;
263 262
264 mutex_lock(&indio_dev->mlock); 263 mutex_lock(&indio_dev->mlock);
@@ -292,34 +291,44 @@ static const struct iio_chan_spec_ext_info ad5064_ext_info[] = {
292 { }, 291 { },
293}; 292};
294 293
295#define AD5064_CHANNEL(chan, bits) { \ 294#define AD5064_CHANNEL(chan, addr, bits) { \
296 .type = IIO_VOLTAGE, \ 295 .type = IIO_VOLTAGE, \
297 .indexed = 1, \ 296 .indexed = 1, \
298 .output = 1, \ 297 .output = 1, \
299 .channel = (chan), \ 298 .channel = (chan), \
300 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ 299 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \
301 IIO_CHAN_INFO_SCALE_SEPARATE_BIT, \ 300 IIO_CHAN_INFO_SCALE_SEPARATE_BIT, \
302 .address = AD5064_ADDR_DAC(chan), \ 301 .address = addr, \
303 .scan_type = IIO_ST('u', (bits), 16, 20 - (bits)), \ 302 .scan_type = IIO_ST('u', (bits), 16, 20 - (bits)), \
304 .ext_info = ad5064_ext_info, \ 303 .ext_info = ad5064_ext_info, \
305} 304}
306 305
307#define DECLARE_AD5064_CHANNELS(name, bits) \ 306#define DECLARE_AD5064_CHANNELS(name, bits) \
308const struct iio_chan_spec name[] = { \ 307const struct iio_chan_spec name[] = { \
309 AD5064_CHANNEL(0, bits), \ 308 AD5064_CHANNEL(0, 0, bits), \
310 AD5064_CHANNEL(1, bits), \ 309 AD5064_CHANNEL(1, 1, bits), \
311 AD5064_CHANNEL(2, bits), \ 310 AD5064_CHANNEL(2, 2, bits), \
312 AD5064_CHANNEL(3, bits), \ 311 AD5064_CHANNEL(3, 3, bits), \
313 AD5064_CHANNEL(4, bits), \ 312 AD5064_CHANNEL(4, 4, bits), \
314 AD5064_CHANNEL(5, bits), \ 313 AD5064_CHANNEL(5, 5, bits), \
315 AD5064_CHANNEL(6, bits), \ 314 AD5064_CHANNEL(6, 6, bits), \
316 AD5064_CHANNEL(7, bits), \ 315 AD5064_CHANNEL(7, 7, bits), \
316}
317
318#define DECLARE_AD5065_CHANNELS(name, bits) \
319const struct iio_chan_spec name[] = { \
320 AD5064_CHANNEL(0, 0, bits), \
321 AD5064_CHANNEL(1, 3, bits), \
317} 322}
318 323
319static DECLARE_AD5064_CHANNELS(ad5024_channels, 12); 324static DECLARE_AD5064_CHANNELS(ad5024_channels, 12);
320static DECLARE_AD5064_CHANNELS(ad5044_channels, 14); 325static DECLARE_AD5064_CHANNELS(ad5044_channels, 14);
321static DECLARE_AD5064_CHANNELS(ad5064_channels, 16); 326static DECLARE_AD5064_CHANNELS(ad5064_channels, 16);
322 327
328static DECLARE_AD5065_CHANNELS(ad5025_channels, 12);
329static DECLARE_AD5065_CHANNELS(ad5045_channels, 14);
330static DECLARE_AD5065_CHANNELS(ad5065_channels, 16);
331
323static const struct ad5064_chip_info ad5064_chip_info_tbl[] = { 332static const struct ad5064_chip_info ad5064_chip_info_tbl[] = {
324 [ID_AD5024] = { 333 [ID_AD5024] = {
325 .shared_vref = false, 334 .shared_vref = false,
@@ -328,7 +337,7 @@ static const struct ad5064_chip_info ad5064_chip_info_tbl[] = {
328 }, 337 },
329 [ID_AD5025] = { 338 [ID_AD5025] = {
330 .shared_vref = false, 339 .shared_vref = false,
331 .channels = ad5024_channels, 340 .channels = ad5025_channels,
332 .num_channels = 2, 341 .num_channels = 2,
333 }, 342 },
334 [ID_AD5044] = { 343 [ID_AD5044] = {
@@ -338,7 +347,7 @@ static const struct ad5064_chip_info ad5064_chip_info_tbl[] = {
338 }, 347 },
339 [ID_AD5045] = { 348 [ID_AD5045] = {
340 .shared_vref = false, 349 .shared_vref = false,
341 .channels = ad5044_channels, 350 .channels = ad5045_channels,
342 .num_channels = 2, 351 .num_channels = 2,
343 }, 352 },
344 [ID_AD5064] = { 353 [ID_AD5064] = {
@@ -353,7 +362,7 @@ static const struct ad5064_chip_info ad5064_chip_info_tbl[] = {
353 }, 362 },
354 [ID_AD5065] = { 363 [ID_AD5065] = {
355 .shared_vref = false, 364 .shared_vref = false,
356 .channels = ad5064_channels, 365 .channels = ad5065_channels,
357 .num_channels = 2, 366 .num_channels = 2,
358 }, 367 },
359 [ID_AD5628_1] = { 368 [ID_AD5628_1] = {
@@ -429,6 +438,7 @@ static int ad5064_probe(struct device *dev, enum ad5064_type type,
429{ 438{
430 struct iio_dev *indio_dev; 439 struct iio_dev *indio_dev;
431 struct ad5064_state *st; 440 struct ad5064_state *st;
441 unsigned int midscale;
432 unsigned int i; 442 unsigned int i;
433 int ret; 443 int ret;
434 444
@@ -465,11 +475,6 @@ static int ad5064_probe(struct device *dev, enum ad5064_type type,
465 goto error_free_reg; 475 goto error_free_reg;
466 } 476 }
467 477
468 for (i = 0; i < st->chip_info->num_channels; ++i) {
469 st->pwr_down_mode[i] = AD5064_LDAC_PWRDN_1K;
470 st->dac_cache[i] = 0x8000;
471 }
472
473 indio_dev->dev.parent = dev; 478 indio_dev->dev.parent = dev;
474 indio_dev->name = name; 479 indio_dev->name = name;
475 indio_dev->info = &ad5064_info; 480 indio_dev->info = &ad5064_info;
@@ -477,6 +482,13 @@ static int ad5064_probe(struct device *dev, enum ad5064_type type,
477 indio_dev->channels = st->chip_info->channels; 482 indio_dev->channels = st->chip_info->channels;
478 indio_dev->num_channels = st->chip_info->num_channels; 483 indio_dev->num_channels = st->chip_info->num_channels;
479 484
485 midscale = (1 << indio_dev->channels[0].scan_type.realbits) / 2;
486
487 for (i = 0; i < st->chip_info->num_channels; ++i) {
488 st->pwr_down_mode[i] = AD5064_LDAC_PWRDN_1K;
489 st->dac_cache[i] = midscale;
490 }
491
480 ret = iio_device_register(indio_dev); 492 ret = iio_device_register(indio_dev);
481 if (ret) 493 if (ret)
482 goto error_disable_reg; 494 goto error_disable_reg;
diff --git a/drivers/iio/imu/inv_mpu6050/Kconfig b/drivers/iio/imu/inv_mpu6050/Kconfig
index b5cfa3a354cf..361b2328453d 100644
--- a/drivers/iio/imu/inv_mpu6050/Kconfig
+++ b/drivers/iio/imu/inv_mpu6050/Kconfig
@@ -5,6 +5,7 @@
5config INV_MPU6050_IIO 5config INV_MPU6050_IIO
6 tristate "Invensense MPU6050 devices" 6 tristate "Invensense MPU6050 devices"
7 depends on I2C && SYSFS 7 depends on I2C && SYSFS
8 select IIO_BUFFER
8 select IIO_TRIGGERED_BUFFER 9 select IIO_TRIGGERED_BUFFER
9 help 10 help
10 This driver supports the Invensense MPU6050 devices. 11 This driver supports the Invensense MPU6050 devices.
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index 565bfb161c1a..a3fde52840ca 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -1575,6 +1575,12 @@ static int c4iw_reconnect(struct c4iw_ep *ep)
1575 1575
1576 neigh = dst_neigh_lookup(ep->dst, 1576 neigh = dst_neigh_lookup(ep->dst,
1577 &ep->com.cm_id->remote_addr.sin_addr.s_addr); 1577 &ep->com.cm_id->remote_addr.sin_addr.s_addr);
1578 if (!neigh) {
1579 pr_err("%s - cannot alloc neigh.\n", __func__);
1580 err = -ENOMEM;
1581 goto fail4;
1582 }
1583
1578 /* get a l2t entry */ 1584 /* get a l2t entry */
1579 if (neigh->dev->flags & IFF_LOOPBACK) { 1585 if (neigh->dev->flags & IFF_LOOPBACK) {
1580 PDBG("%s LOOPBACK\n", __func__); 1586 PDBG("%s LOOPBACK\n", __func__);
@@ -3053,6 +3059,12 @@ static int rx_pkt(struct c4iw_dev *dev, struct sk_buff *skb)
3053 dst = &rt->dst; 3059 dst = &rt->dst;
3054 neigh = dst_neigh_lookup_skb(dst, skb); 3060 neigh = dst_neigh_lookup_skb(dst, skb);
3055 3061
3062 if (!neigh) {
3063 pr_err("%s - failed to allocate neigh!\n",
3064 __func__);
3065 goto free_dst;
3066 }
3067
3056 if (neigh->dev->flags & IFF_LOOPBACK) { 3068 if (neigh->dev->flags & IFF_LOOPBACK) {
3057 pdev = ip_dev_find(&init_net, iph->daddr); 3069 pdev = ip_dev_find(&init_net, iph->daddr);
3058 e = cxgb4_l2t_get(dev->rdev.lldi.l2t, neigh, 3070 e = cxgb4_l2t_get(dev->rdev.lldi.l2t, neigh,
diff --git a/drivers/infiniband/hw/mlx4/cm.c b/drivers/infiniband/hw/mlx4/cm.c
index e0d79b2395e4..add98d01476c 100644
--- a/drivers/infiniband/hw/mlx4/cm.c
+++ b/drivers/infiniband/hw/mlx4/cm.c
@@ -362,7 +362,6 @@ void mlx4_ib_cm_paravirt_init(struct mlx4_ib_dev *dev)
362 INIT_LIST_HEAD(&dev->sriov.cm_list); 362 INIT_LIST_HEAD(&dev->sriov.cm_list);
363 dev->sriov.sl_id_map = RB_ROOT; 363 dev->sriov.sl_id_map = RB_ROOT;
364 idr_init(&dev->sriov.pv_id_table); 364 idr_init(&dev->sriov.pv_id_table);
365 idr_pre_get(&dev->sriov.pv_id_table, GFP_KERNEL);
366} 365}
367 366
368/* slave = -1 ==> all slaves */ 367/* slave = -1 ==> all slaves */
diff --git a/drivers/input/joystick/analog.c b/drivers/input/joystick/analog.c
index 7cd74e29cbc8..9135606c8649 100644
--- a/drivers/input/joystick/analog.c
+++ b/drivers/input/joystick/analog.c
@@ -158,14 +158,10 @@ static unsigned int get_time_pit(void)
158#define GET_TIME(x) rdtscl(x) 158#define GET_TIME(x) rdtscl(x)
159#define DELTA(x,y) ((y)-(x)) 159#define DELTA(x,y) ((y)-(x))
160#define TIME_NAME "TSC" 160#define TIME_NAME "TSC"
161#elif defined(__alpha__) 161#elif defined(__alpha__) || defined(CONFIG_MN10300) || defined(CONFIG_ARM) || defined(CONFIG_TILE)
162#define GET_TIME(x) do { x = get_cycles(); } while (0) 162#define GET_TIME(x) do { x = get_cycles(); } while (0)
163#define DELTA(x,y) ((y)-(x)) 163#define DELTA(x,y) ((y)-(x))
164#define TIME_NAME "PCC" 164#define TIME_NAME "get_cycles"
165#elif defined(CONFIG_MN10300) || defined(CONFIG_TILE)
166#define GET_TIME(x) do { x = get_cycles(); } while (0)
167#define DELTA(x, y) ((x) - (y))
168#define TIME_NAME "TSC"
169#else 165#else
170#define FAKE_TIME 166#define FAKE_TIME
171static unsigned long analog_faketime = 0; 167static unsigned long analog_faketime = 0;
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index 644d72468423..a32e0d5aa45f 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -648,7 +648,7 @@ void gic_raise_softirq(const struct cpumask *mask, unsigned int irq)
648 648
649 /* Convert our logical CPU mask into a physical one. */ 649 /* Convert our logical CPU mask into a physical one. */
650 for_each_cpu(cpu, mask) 650 for_each_cpu(cpu, mask)
651 map |= 1 << cpu_logical_map(cpu); 651 map |= gic_cpu_map[cpu];
652 652
653 /* 653 /*
654 * Ensure that stores to Normal memory are visible to the 654 * Ensure that stores to Normal memory are visible to the
diff --git a/drivers/isdn/hisax/Kconfig b/drivers/isdn/hisax/Kconfig
index 5313c9ea44dc..d9edcc94c2a8 100644
--- a/drivers/isdn/hisax/Kconfig
+++ b/drivers/isdn/hisax/Kconfig
@@ -237,7 +237,8 @@ config HISAX_MIC
237 237
238config HISAX_NETJET 238config HISAX_NETJET
239 bool "NETjet card" 239 bool "NETjet card"
240 depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV || (XTENSA && !CPU_LITTLE_ENDIAN))) 240 depends on PCI && (BROKEN || !(PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV || (XTENSA && !CPU_LITTLE_ENDIAN)))
241 depends on VIRT_TO_BUS
241 help 242 help
242 This enables HiSax support for the NetJet from Traverse 243 This enables HiSax support for the NetJet from Traverse
243 Technologies. 244 Technologies.
@@ -248,7 +249,8 @@ config HISAX_NETJET
248 249
249config HISAX_NETJET_U 250config HISAX_NETJET_U
250 bool "NETspider U card" 251 bool "NETspider U card"
251 depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV || (XTENSA && !CPU_LITTLE_ENDIAN))) 252 depends on PCI && (BROKEN || !(PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV || (XTENSA && !CPU_LITTLE_ENDIAN)))
253 depends on VIRT_TO_BUS
252 help 254 help
253 This enables HiSax support for the Netspider U interface ISDN card 255 This enables HiSax support for the Netspider U interface ISDN card
254 from Traverse Technologies. 256 from Traverse Technologies.
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 671f5b171c73..c346941a2515 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -858,6 +858,7 @@ config EZX_PCAP
858config AB8500_CORE 858config AB8500_CORE
859 bool "ST-Ericsson AB8500 Mixed Signal Power Management chip" 859 bool "ST-Ericsson AB8500 Mixed Signal Power Management chip"
860 depends on GENERIC_HARDIRQS && ABX500_CORE && MFD_DB8500_PRCMU 860 depends on GENERIC_HARDIRQS && ABX500_CORE && MFD_DB8500_PRCMU
861 select POWER_SUPPLY
861 select MFD_CORE 862 select MFD_CORE
862 select IRQ_DOMAIN 863 select IRQ_DOMAIN
863 help 864 help
diff --git a/drivers/mfd/ab8500-gpadc.c b/drivers/mfd/ab8500-gpadc.c
index b1f3561b023f..5f341a50ee5a 100644
--- a/drivers/mfd/ab8500-gpadc.c
+++ b/drivers/mfd/ab8500-gpadc.c
@@ -594,9 +594,12 @@ static int ab8500_gpadc_runtime_suspend(struct device *dev)
594static int ab8500_gpadc_runtime_resume(struct device *dev) 594static int ab8500_gpadc_runtime_resume(struct device *dev)
595{ 595{
596 struct ab8500_gpadc *gpadc = dev_get_drvdata(dev); 596 struct ab8500_gpadc *gpadc = dev_get_drvdata(dev);
597 int ret;
597 598
598 regulator_enable(gpadc->regu); 599 ret = regulator_enable(gpadc->regu);
599 return 0; 600 if (ret)
601 dev_err(dev, "Failed to enable vtvout LDO: %d\n", ret);
602 return ret;
600} 603}
601 604
602static int ab8500_gpadc_runtime_idle(struct device *dev) 605static int ab8500_gpadc_runtime_idle(struct device *dev)
@@ -643,7 +646,7 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
643 } 646 }
644 647
645 /* VTVout LDO used to power up ab8500-GPADC */ 648 /* VTVout LDO used to power up ab8500-GPADC */
646 gpadc->regu = regulator_get(&pdev->dev, "vddadc"); 649 gpadc->regu = devm_regulator_get(&pdev->dev, "vddadc");
647 if (IS_ERR(gpadc->regu)) { 650 if (IS_ERR(gpadc->regu)) {
648 ret = PTR_ERR(gpadc->regu); 651 ret = PTR_ERR(gpadc->regu);
649 dev_err(gpadc->dev, "failed to get vtvout LDO\n"); 652 dev_err(gpadc->dev, "failed to get vtvout LDO\n");
@@ -652,7 +655,11 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
652 655
653 platform_set_drvdata(pdev, gpadc); 656 platform_set_drvdata(pdev, gpadc);
654 657
655 regulator_enable(gpadc->regu); 658 ret = regulator_enable(gpadc->regu);
659 if (ret) {
660 dev_err(gpadc->dev, "Failed to enable vtvout LDO: %d\n", ret);
661 goto fail_enable;
662 }
656 663
657 pm_runtime_set_autosuspend_delay(gpadc->dev, GPADC_AUDOSUSPEND_DELAY); 664 pm_runtime_set_autosuspend_delay(gpadc->dev, GPADC_AUDOSUSPEND_DELAY);
658 pm_runtime_use_autosuspend(gpadc->dev); 665 pm_runtime_use_autosuspend(gpadc->dev);
@@ -663,6 +670,8 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
663 list_add_tail(&gpadc->node, &ab8500_gpadc_list); 670 list_add_tail(&gpadc->node, &ab8500_gpadc_list);
664 dev_dbg(gpadc->dev, "probe success\n"); 671 dev_dbg(gpadc->dev, "probe success\n");
665 return 0; 672 return 0;
673
674fail_enable:
666fail_irq: 675fail_irq:
667 free_irq(gpadc->irq, gpadc); 676 free_irq(gpadc->irq, gpadc);
668fail: 677fail:
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 6b5edf64de2b..4febc5c7fdee 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -460,15 +460,15 @@ static void omap_usbhs_init(struct device *dev)
460 460
461 switch (omap->usbhs_rev) { 461 switch (omap->usbhs_rev) {
462 case OMAP_USBHS_REV1: 462 case OMAP_USBHS_REV1:
463 omap_usbhs_rev1_hostconfig(omap, reg); 463 reg = omap_usbhs_rev1_hostconfig(omap, reg);
464 break; 464 break;
465 465
466 case OMAP_USBHS_REV2: 466 case OMAP_USBHS_REV2:
467 omap_usbhs_rev2_hostconfig(omap, reg); 467 reg = omap_usbhs_rev2_hostconfig(omap, reg);
468 break; 468 break;
469 469
470 default: /* newer revisions */ 470 default: /* newer revisions */
471 omap_usbhs_rev2_hostconfig(omap, reg); 471 reg = omap_usbhs_rev2_hostconfig(omap, reg);
472 break; 472 break;
473 } 473 }
474 474
diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c
index bbdbc50a3cca..73bf76df1044 100644
--- a/drivers/mfd/palmas.c
+++ b/drivers/mfd/palmas.c
@@ -257,9 +257,24 @@ static struct regmap_irq_chip palmas_irq_chip = {
257 PALMAS_INT1_MASK), 257 PALMAS_INT1_MASK),
258}; 258};
259 259
260static void palmas_dt_to_pdata(struct device_node *node, 260static int palmas_set_pdata_irq_flag(struct i2c_client *i2c,
261 struct palmas_platform_data *pdata) 261 struct palmas_platform_data *pdata)
262{ 262{
263 struct irq_data *irq_data = irq_get_irq_data(i2c->irq);
264 if (!irq_data) {
265 dev_err(&i2c->dev, "Invalid IRQ: %d\n", i2c->irq);
266 return -EINVAL;
267 }
268
269 pdata->irq_flags = irqd_get_trigger_type(irq_data);
270 dev_info(&i2c->dev, "Irq flag is 0x%08x\n", pdata->irq_flags);
271 return 0;
272}
273
274static void palmas_dt_to_pdata(struct i2c_client *i2c,
275 struct palmas_platform_data *pdata)
276{
277 struct device_node *node = i2c->dev.of_node;
263 int ret; 278 int ret;
264 u32 prop; 279 u32 prop;
265 280
@@ -283,6 +298,8 @@ static void palmas_dt_to_pdata(struct device_node *node,
283 pdata->power_ctrl = PALMAS_POWER_CTRL_NSLEEP_MASK | 298 pdata->power_ctrl = PALMAS_POWER_CTRL_NSLEEP_MASK |
284 PALMAS_POWER_CTRL_ENABLE1_MASK | 299 PALMAS_POWER_CTRL_ENABLE1_MASK |
285 PALMAS_POWER_CTRL_ENABLE2_MASK; 300 PALMAS_POWER_CTRL_ENABLE2_MASK;
301 if (i2c->irq)
302 palmas_set_pdata_irq_flag(i2c, pdata);
286} 303}
287 304
288static int palmas_i2c_probe(struct i2c_client *i2c, 305static int palmas_i2c_probe(struct i2c_client *i2c,
@@ -304,7 +321,7 @@ static int palmas_i2c_probe(struct i2c_client *i2c,
304 if (!pdata) 321 if (!pdata)
305 return -ENOMEM; 322 return -ENOMEM;
306 323
307 palmas_dt_to_pdata(node, pdata); 324 palmas_dt_to_pdata(i2c, pdata);
308 } 325 }
309 326
310 if (!pdata) 327 if (!pdata)
@@ -344,6 +361,19 @@ static int palmas_i2c_probe(struct i2c_client *i2c,
344 } 361 }
345 } 362 }
346 363
364 /* Change interrupt line output polarity */
365 if (pdata->irq_flags & IRQ_TYPE_LEVEL_HIGH)
366 reg = PALMAS_POLARITY_CTRL_INT_POLARITY;
367 else
368 reg = 0;
369 ret = palmas_update_bits(palmas, PALMAS_PU_PD_OD_BASE,
370 PALMAS_POLARITY_CTRL, PALMAS_POLARITY_CTRL_INT_POLARITY,
371 reg);
372 if (ret < 0) {
373 dev_err(palmas->dev, "POLARITY_CTRL updat failed: %d\n", ret);
374 goto err;
375 }
376
347 /* Change IRQ into clear on read mode for efficiency */ 377 /* Change IRQ into clear on read mode for efficiency */
348 slave = PALMAS_BASE_TO_SLAVE(PALMAS_INTERRUPT_BASE); 378 slave = PALMAS_BASE_TO_SLAVE(PALMAS_INTERRUPT_BASE);
349 addr = PALMAS_BASE_TO_REG(PALMAS_INTERRUPT_BASE, PALMAS_INT_CTRL); 379 addr = PALMAS_BASE_TO_REG(PALMAS_INTERRUPT_BASE, PALMAS_INT_CTRL);
@@ -352,7 +382,7 @@ static int palmas_i2c_probe(struct i2c_client *i2c,
352 regmap_write(palmas->regmap[slave], addr, reg); 382 regmap_write(palmas->regmap[slave], addr, reg);
353 383
354 ret = regmap_add_irq_chip(palmas->regmap[slave], palmas->irq, 384 ret = regmap_add_irq_chip(palmas->regmap[slave], palmas->irq,
355 IRQF_ONESHOT | IRQF_TRIGGER_LOW, 0, &palmas_irq_chip, 385 IRQF_ONESHOT | pdata->irq_flags, 0, &palmas_irq_chip,
356 &palmas->irq_data); 386 &palmas->irq_data);
357 if (ret < 0) 387 if (ret < 0)
358 goto err; 388 goto err;
diff --git a/drivers/mfd/tps65912-core.c b/drivers/mfd/tps65912-core.c
index 4658b5bdcd84..aeb8e40ab424 100644
--- a/drivers/mfd/tps65912-core.c
+++ b/drivers/mfd/tps65912-core.c
@@ -169,6 +169,7 @@ err:
169void tps65912_device_exit(struct tps65912 *tps65912) 169void tps65912_device_exit(struct tps65912 *tps65912)
170{ 170{
171 mfd_remove_devices(tps65912->dev); 171 mfd_remove_devices(tps65912->dev);
172 tps65912_irq_exit(tps65912);
172 kfree(tps65912); 173 kfree(tps65912);
173} 174}
174 175
diff --git a/drivers/mfd/twl4030-audio.c b/drivers/mfd/twl4030-audio.c
index e16edca92670..d2ab222138c2 100644
--- a/drivers/mfd/twl4030-audio.c
+++ b/drivers/mfd/twl4030-audio.c
@@ -118,7 +118,7 @@ EXPORT_SYMBOL_GPL(twl4030_audio_enable_resource);
118 * Disable the resource. 118 * Disable the resource.
119 * The function returns with error or the content of the register 119 * The function returns with error or the content of the register
120 */ 120 */
121int twl4030_audio_disable_resource(unsigned id) 121int twl4030_audio_disable_resource(enum twl4030_audio_res id)
122{ 122{
123 struct twl4030_audio *audio = platform_get_drvdata(twl4030_audio_dev); 123 struct twl4030_audio *audio = platform_get_drvdata(twl4030_audio_dev);
124 int val; 124 int val;
diff --git a/drivers/mfd/twl4030-madc.c b/drivers/mfd/twl4030-madc.c
index 88ff9dc83305..942b666a2a07 100644
--- a/drivers/mfd/twl4030-madc.c
+++ b/drivers/mfd/twl4030-madc.c
@@ -800,7 +800,7 @@ static int twl4030_madc_remove(struct platform_device *pdev)
800 800
801static struct platform_driver twl4030_madc_driver = { 801static struct platform_driver twl4030_madc_driver = {
802 .probe = twl4030_madc_probe, 802 .probe = twl4030_madc_probe,
803 .remove = __exit_p(twl4030_madc_remove), 803 .remove = twl4030_madc_remove,
804 .driver = { 804 .driver = {
805 .name = "twl4030_madc", 805 .name = "twl4030_madc",
806 .owner = THIS_MODULE, 806 .owner = THIS_MODULE,
diff --git a/drivers/mtd/bcm47xxpart.c b/drivers/mtd/bcm47xxpart.c
index 63feb75cc8e0..9279a9174f84 100644
--- a/drivers/mtd/bcm47xxpart.c
+++ b/drivers/mtd/bcm47xxpart.c
@@ -19,6 +19,12 @@
19/* 10 parts were found on sflash on Netgear WNDR4500 */ 19/* 10 parts were found on sflash on Netgear WNDR4500 */
20#define BCM47XXPART_MAX_PARTS 12 20#define BCM47XXPART_MAX_PARTS 12
21 21
22/*
23 * Amount of bytes we read when analyzing each block of flash memory.
24 * Set it big enough to allow detecting partition and reading important data.
25 */
26#define BCM47XXPART_BYTES_TO_READ 0x404
27
22/* Magics */ 28/* Magics */
23#define BOARD_DATA_MAGIC 0x5246504D /* MPFR */ 29#define BOARD_DATA_MAGIC 0x5246504D /* MPFR */
24#define POT_MAGIC1 0x54544f50 /* POTT */ 30#define POT_MAGIC1 0x54544f50 /* POTT */
@@ -57,17 +63,15 @@ static int bcm47xxpart_parse(struct mtd_info *master,
57 struct trx_header *trx; 63 struct trx_header *trx;
58 int trx_part = -1; 64 int trx_part = -1;
59 int last_trx_part = -1; 65 int last_trx_part = -1;
60 int max_bytes_to_read = 0x8004; 66 int possible_nvram_sizes[] = { 0x8000, 0xF000, 0x10000, };
61 67
62 if (blocksize <= 0x10000) 68 if (blocksize <= 0x10000)
63 blocksize = 0x10000; 69 blocksize = 0x10000;
64 if (blocksize == 0x20000)
65 max_bytes_to_read = 0x18004;
66 70
67 /* Alloc */ 71 /* Alloc */
68 parts = kzalloc(sizeof(struct mtd_partition) * BCM47XXPART_MAX_PARTS, 72 parts = kzalloc(sizeof(struct mtd_partition) * BCM47XXPART_MAX_PARTS,
69 GFP_KERNEL); 73 GFP_KERNEL);
70 buf = kzalloc(max_bytes_to_read, GFP_KERNEL); 74 buf = kzalloc(BCM47XXPART_BYTES_TO_READ, GFP_KERNEL);
71 75
72 /* Parse block by block looking for magics */ 76 /* Parse block by block looking for magics */
73 for (offset = 0; offset <= master->size - blocksize; 77 for (offset = 0; offset <= master->size - blocksize;
@@ -82,7 +86,7 @@ static int bcm47xxpart_parse(struct mtd_info *master,
82 } 86 }
83 87
84 /* Read beginning of the block */ 88 /* Read beginning of the block */
85 if (mtd_read(master, offset, max_bytes_to_read, 89 if (mtd_read(master, offset, BCM47XXPART_BYTES_TO_READ,
86 &bytes_read, (uint8_t *)buf) < 0) { 90 &bytes_read, (uint8_t *)buf) < 0) {
87 pr_err("mtd_read error while parsing (offset: 0x%X)!\n", 91 pr_err("mtd_read error while parsing (offset: 0x%X)!\n",
88 offset); 92 offset);
@@ -96,20 +100,6 @@ static int bcm47xxpart_parse(struct mtd_info *master,
96 continue; 100 continue;
97 } 101 }
98 102
99 /* Standard NVRAM */
100 if (buf[0x000 / 4] == NVRAM_HEADER ||
101 buf[0x1000 / 4] == NVRAM_HEADER ||
102 buf[0x8000 / 4] == NVRAM_HEADER ||
103 (blocksize == 0x20000 && (
104 buf[0x10000 / 4] == NVRAM_HEADER ||
105 buf[0x11000 / 4] == NVRAM_HEADER ||
106 buf[0x18000 / 4] == NVRAM_HEADER))) {
107 bcm47xxpart_add_part(&parts[curr_part++], "nvram",
108 offset, 0);
109 offset = rounddown(offset, blocksize);
110 continue;
111 }
112
113 /* 103 /*
114 * board_data starts with board_id which differs across boards, 104 * board_data starts with board_id which differs across boards,
115 * but we can use 'MPFR' (hopefully) magic at 0x100 105 * but we can use 'MPFR' (hopefully) magic at 0x100
@@ -178,6 +168,30 @@ static int bcm47xxpart_parse(struct mtd_info *master,
178 continue; 168 continue;
179 } 169 }
180 } 170 }
171
172 /* Look for NVRAM at the end of the last block. */
173 for (i = 0; i < ARRAY_SIZE(possible_nvram_sizes); i++) {
174 if (curr_part > BCM47XXPART_MAX_PARTS) {
175 pr_warn("Reached maximum number of partitions, scanning stopped!\n");
176 break;
177 }
178
179 offset = master->size - possible_nvram_sizes[i];
180 if (mtd_read(master, offset, 0x4, &bytes_read,
181 (uint8_t *)buf) < 0) {
182 pr_err("mtd_read error while reading at offset 0x%X!\n",
183 offset);
184 continue;
185 }
186
187 /* Standard NVRAM */
188 if (buf[0] == NVRAM_HEADER) {
189 bcm47xxpart_add_part(&parts[curr_part++], "nvram",
190 master->size - blocksize, 0);
191 break;
192 }
193 }
194
181 kfree(buf); 195 kfree(buf);
182 196
183 /* 197 /*
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 43214151b882..42c63927609d 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1523,6 +1523,14 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
1523 oobreadlen -= toread; 1523 oobreadlen -= toread;
1524 } 1524 }
1525 } 1525 }
1526
1527 if (chip->options & NAND_NEED_READRDY) {
1528 /* Apply delay or wait for ready/busy pin */
1529 if (!chip->dev_ready)
1530 udelay(chip->chip_delay);
1531 else
1532 nand_wait_ready(mtd);
1533 }
1526 } else { 1534 } else {
1527 memcpy(buf, chip->buffers->databuf + col, bytes); 1535 memcpy(buf, chip->buffers->databuf + col, bytes);
1528 buf += bytes; 1536 buf += bytes;
@@ -1787,6 +1795,14 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
1787 len = min(len, readlen); 1795 len = min(len, readlen);
1788 buf = nand_transfer_oob(chip, buf, ops, len); 1796 buf = nand_transfer_oob(chip, buf, ops, len);
1789 1797
1798 if (chip->options & NAND_NEED_READRDY) {
1799 /* Apply delay or wait for ready/busy pin */
1800 if (!chip->dev_ready)
1801 udelay(chip->chip_delay);
1802 else
1803 nand_wait_ready(mtd);
1804 }
1805
1790 readlen -= len; 1806 readlen -= len;
1791 if (!readlen) 1807 if (!readlen)
1792 break; 1808 break;
diff --git a/drivers/mtd/nand/nand_ids.c b/drivers/mtd/nand/nand_ids.c
index e3aa2748a6e7..9c612388e5de 100644
--- a/drivers/mtd/nand/nand_ids.c
+++ b/drivers/mtd/nand/nand_ids.c
@@ -22,49 +22,51 @@
22* 512 512 Byte page size 22* 512 512 Byte page size
23*/ 23*/
24struct nand_flash_dev nand_flash_ids[] = { 24struct nand_flash_dev nand_flash_ids[] = {
25#define SP_OPTIONS NAND_NEED_READRDY
26#define SP_OPTIONS16 (SP_OPTIONS | NAND_BUSWIDTH_16)
25 27
26#ifdef CONFIG_MTD_NAND_MUSEUM_IDS 28#ifdef CONFIG_MTD_NAND_MUSEUM_IDS
27 {"NAND 1MiB 5V 8-bit", 0x6e, 256, 1, 0x1000, 0}, 29 {"NAND 1MiB 5V 8-bit", 0x6e, 256, 1, 0x1000, SP_OPTIONS},
28 {"NAND 2MiB 5V 8-bit", 0x64, 256, 2, 0x1000, 0}, 30 {"NAND 2MiB 5V 8-bit", 0x64, 256, 2, 0x1000, SP_OPTIONS},
29 {"NAND 4MiB 5V 8-bit", 0x6b, 512, 4, 0x2000, 0}, 31 {"NAND 4MiB 5V 8-bit", 0x6b, 512, 4, 0x2000, SP_OPTIONS},
30 {"NAND 1MiB 3,3V 8-bit", 0xe8, 256, 1, 0x1000, 0}, 32 {"NAND 1MiB 3,3V 8-bit", 0xe8, 256, 1, 0x1000, SP_OPTIONS},
31 {"NAND 1MiB 3,3V 8-bit", 0xec, 256, 1, 0x1000, 0}, 33 {"NAND 1MiB 3,3V 8-bit", 0xec, 256, 1, 0x1000, SP_OPTIONS},
32 {"NAND 2MiB 3,3V 8-bit", 0xea, 256, 2, 0x1000, 0}, 34 {"NAND 2MiB 3,3V 8-bit", 0xea, 256, 2, 0x1000, SP_OPTIONS},
33 {"NAND 4MiB 3,3V 8-bit", 0xd5, 512, 4, 0x2000, 0}, 35 {"NAND 4MiB 3,3V 8-bit", 0xd5, 512, 4, 0x2000, SP_OPTIONS},
34 {"NAND 4MiB 3,3V 8-bit", 0xe3, 512, 4, 0x2000, 0}, 36 {"NAND 4MiB 3,3V 8-bit", 0xe3, 512, 4, 0x2000, SP_OPTIONS},
35 {"NAND 4MiB 3,3V 8-bit", 0xe5, 512, 4, 0x2000, 0}, 37 {"NAND 4MiB 3,3V 8-bit", 0xe5, 512, 4, 0x2000, SP_OPTIONS},
36 {"NAND 8MiB 3,3V 8-bit", 0xd6, 512, 8, 0x2000, 0}, 38 {"NAND 8MiB 3,3V 8-bit", 0xd6, 512, 8, 0x2000, SP_OPTIONS},
37 39
38 {"NAND 8MiB 1,8V 8-bit", 0x39, 512, 8, 0x2000, 0}, 40 {"NAND 8MiB 1,8V 8-bit", 0x39, 512, 8, 0x2000, SP_OPTIONS},
39 {"NAND 8MiB 3,3V 8-bit", 0xe6, 512, 8, 0x2000, 0}, 41 {"NAND 8MiB 3,3V 8-bit", 0xe6, 512, 8, 0x2000, SP_OPTIONS},
40 {"NAND 8MiB 1,8V 16-bit", 0x49, 512, 8, 0x2000, NAND_BUSWIDTH_16}, 42 {"NAND 8MiB 1,8V 16-bit", 0x49, 512, 8, 0x2000, SP_OPTIONS16},
41 {"NAND 8MiB 3,3V 16-bit", 0x59, 512, 8, 0x2000, NAND_BUSWIDTH_16}, 43 {"NAND 8MiB 3,3V 16-bit", 0x59, 512, 8, 0x2000, SP_OPTIONS16},
42#endif 44#endif
43 45
44 {"NAND 16MiB 1,8V 8-bit", 0x33, 512, 16, 0x4000, 0}, 46 {"NAND 16MiB 1,8V 8-bit", 0x33, 512, 16, 0x4000, SP_OPTIONS},
45 {"NAND 16MiB 3,3V 8-bit", 0x73, 512, 16, 0x4000, 0}, 47 {"NAND 16MiB 3,3V 8-bit", 0x73, 512, 16, 0x4000, SP_OPTIONS},
46 {"NAND 16MiB 1,8V 16-bit", 0x43, 512, 16, 0x4000, NAND_BUSWIDTH_16}, 48 {"NAND 16MiB 1,8V 16-bit", 0x43, 512, 16, 0x4000, SP_OPTIONS16},
47 {"NAND 16MiB 3,3V 16-bit", 0x53, 512, 16, 0x4000, NAND_BUSWIDTH_16}, 49 {"NAND 16MiB 3,3V 16-bit", 0x53, 512, 16, 0x4000, SP_OPTIONS16},
48 50
49 {"NAND 32MiB 1,8V 8-bit", 0x35, 512, 32, 0x4000, 0}, 51 {"NAND 32MiB 1,8V 8-bit", 0x35, 512, 32, 0x4000, SP_OPTIONS},
50 {"NAND 32MiB 3,3V 8-bit", 0x75, 512, 32, 0x4000, 0}, 52 {"NAND 32MiB 3,3V 8-bit", 0x75, 512, 32, 0x4000, SP_OPTIONS},
51 {"NAND 32MiB 1,8V 16-bit", 0x45, 512, 32, 0x4000, NAND_BUSWIDTH_16}, 53 {"NAND 32MiB 1,8V 16-bit", 0x45, 512, 32, 0x4000, SP_OPTIONS16},
52 {"NAND 32MiB 3,3V 16-bit", 0x55, 512, 32, 0x4000, NAND_BUSWIDTH_16}, 54 {"NAND 32MiB 3,3V 16-bit", 0x55, 512, 32, 0x4000, SP_OPTIONS16},
53 55
54 {"NAND 64MiB 1,8V 8-bit", 0x36, 512, 64, 0x4000, 0}, 56 {"NAND 64MiB 1,8V 8-bit", 0x36, 512, 64, 0x4000, SP_OPTIONS},
55 {"NAND 64MiB 3,3V 8-bit", 0x76, 512, 64, 0x4000, 0}, 57 {"NAND 64MiB 3,3V 8-bit", 0x76, 512, 64, 0x4000, SP_OPTIONS},
56 {"NAND 64MiB 1,8V 16-bit", 0x46, 512, 64, 0x4000, NAND_BUSWIDTH_16}, 58 {"NAND 64MiB 1,8V 16-bit", 0x46, 512, 64, 0x4000, SP_OPTIONS16},
57 {"NAND 64MiB 3,3V 16-bit", 0x56, 512, 64, 0x4000, NAND_BUSWIDTH_16}, 59 {"NAND 64MiB 3,3V 16-bit", 0x56, 512, 64, 0x4000, SP_OPTIONS16},
58 60
59 {"NAND 128MiB 1,8V 8-bit", 0x78, 512, 128, 0x4000, 0}, 61 {"NAND 128MiB 1,8V 8-bit", 0x78, 512, 128, 0x4000, SP_OPTIONS},
60 {"NAND 128MiB 1,8V 8-bit", 0x39, 512, 128, 0x4000, 0}, 62 {"NAND 128MiB 1,8V 8-bit", 0x39, 512, 128, 0x4000, SP_OPTIONS},
61 {"NAND 128MiB 3,3V 8-bit", 0x79, 512, 128, 0x4000, 0}, 63 {"NAND 128MiB 3,3V 8-bit", 0x79, 512, 128, 0x4000, SP_OPTIONS},
62 {"NAND 128MiB 1,8V 16-bit", 0x72, 512, 128, 0x4000, NAND_BUSWIDTH_16}, 64 {"NAND 128MiB 1,8V 16-bit", 0x72, 512, 128, 0x4000, SP_OPTIONS16},
63 {"NAND 128MiB 1,8V 16-bit", 0x49, 512, 128, 0x4000, NAND_BUSWIDTH_16}, 65 {"NAND 128MiB 1,8V 16-bit", 0x49, 512, 128, 0x4000, SP_OPTIONS16},
64 {"NAND 128MiB 3,3V 16-bit", 0x74, 512, 128, 0x4000, NAND_BUSWIDTH_16}, 66 {"NAND 128MiB 3,3V 16-bit", 0x74, 512, 128, 0x4000, SP_OPTIONS16},
65 {"NAND 128MiB 3,3V 16-bit", 0x59, 512, 128, 0x4000, NAND_BUSWIDTH_16}, 67 {"NAND 128MiB 3,3V 16-bit", 0x59, 512, 128, 0x4000, SP_OPTIONS16},
66 68
67 {"NAND 256MiB 3,3V 8-bit", 0x71, 512, 256, 0x4000, 0}, 69 {"NAND 256MiB 3,3V 8-bit", 0x71, 512, 256, 0x4000, SP_OPTIONS},
68 70
69 /* 71 /*
70 * These are the new chips with large page size. The pagesize and the 72 * These are the new chips with large page size. The pagesize and the
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index a923bc4d5a1f..4046f97378c2 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -2760,6 +2760,7 @@ load_error2:
2760 bp->port.pmf = 0; 2760 bp->port.pmf = 0;
2761load_error1: 2761load_error1:
2762 bnx2x_napi_disable(bp); 2762 bnx2x_napi_disable(bp);
2763 bnx2x_del_all_napi(bp);
2763 2764
2764 /* clear pf_load status, as it was already set */ 2765 /* clear pf_load status, as it was already set */
2765 if (IS_PF(bp)) 2766 if (IS_PF(bp))
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h
index 364e37ecbc5c..198f6f1c9ad5 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.h
@@ -459,8 +459,9 @@ struct bnx2x_fw_port_stats_old {
459 459
460#define UPDATE_QSTAT(s, t) \ 460#define UPDATE_QSTAT(s, t) \
461 do { \ 461 do { \
462 qstats->t##_hi = qstats_old->t##_hi + le32_to_cpu(s.hi); \
463 qstats->t##_lo = qstats_old->t##_lo + le32_to_cpu(s.lo); \ 462 qstats->t##_lo = qstats_old->t##_lo + le32_to_cpu(s.lo); \
463 qstats->t##_hi = qstats_old->t##_hi + le32_to_cpu(s.hi) \
464 + ((qstats->t##_lo < qstats_old->t##_lo) ? 1 : 0); \
464 } while (0) 465 } while (0)
465 466
466#define UPDATE_QSTAT_OLD(f) \ 467#define UPDATE_QSTAT_OLD(f) \
diff --git a/drivers/net/ethernet/dec/tulip/Kconfig b/drivers/net/ethernet/dec/tulip/Kconfig
index 0c37fb2cc867..1df33c799c00 100644
--- a/drivers/net/ethernet/dec/tulip/Kconfig
+++ b/drivers/net/ethernet/dec/tulip/Kconfig
@@ -108,6 +108,7 @@ config TULIP_DM910X
108config DE4X5 108config DE4X5
109 tristate "Generic DECchip & DIGITAL EtherWORKS PCI/EISA" 109 tristate "Generic DECchip & DIGITAL EtherWORKS PCI/EISA"
110 depends on (PCI || EISA) 110 depends on (PCI || EISA)
111 depends on VIRT_TO_BUS || ALPHA || PPC || SPARC
111 select CRC32 112 select CRC32
112 ---help--- 113 ---help---
113 This is support for the DIGITAL series of PCI/EISA Ethernet cards. 114 This is support for the DIGITAL series of PCI/EISA Ethernet cards.
diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
index 069a155d16ed..e3f39372ce25 100644
--- a/drivers/net/ethernet/freescale/fec.c
+++ b/drivers/net/ethernet/freescale/fec.c
@@ -934,24 +934,28 @@ static void fec_enet_adjust_link(struct net_device *ndev)
934 goto spin_unlock; 934 goto spin_unlock;
935 } 935 }
936 936
937 /* Duplex link change */
938 if (phy_dev->link) { 937 if (phy_dev->link) {
939 if (fep->full_duplex != phy_dev->duplex) { 938 if (!fep->link) {
940 fec_restart(ndev, phy_dev->duplex);
941 /* prevent unnecessary second fec_restart() below */
942 fep->link = phy_dev->link; 939 fep->link = phy_dev->link;
943 status_change = 1; 940 status_change = 1;
944 } 941 }
945 }
946 942
947 /* Link on or off change */ 943 if (fep->full_duplex != phy_dev->duplex)
948 if (phy_dev->link != fep->link) { 944 status_change = 1;
949 fep->link = phy_dev->link; 945
950 if (phy_dev->link) 946 if (phy_dev->speed != fep->speed) {
947 fep->speed = phy_dev->speed;
948 status_change = 1;
949 }
950
951 /* if any of the above changed restart the FEC */
952 if (status_change)
951 fec_restart(ndev, phy_dev->duplex); 953 fec_restart(ndev, phy_dev->duplex);
952 else 954 } else {
955 if (fep->link) {
953 fec_stop(ndev); 956 fec_stop(ndev);
954 status_change = 1; 957 status_change = 1;
958 }
955 } 959 }
956 960
957spin_unlock: 961spin_unlock:
@@ -1437,6 +1441,7 @@ fec_enet_close(struct net_device *ndev)
1437 struct fec_enet_private *fep = netdev_priv(ndev); 1441 struct fec_enet_private *fep = netdev_priv(ndev);
1438 1442
1439 /* Don't know what to do yet. */ 1443 /* Don't know what to do yet. */
1444 napi_disable(&fep->napi);
1440 fep->opened = 0; 1445 fep->opened = 0;
1441 netif_stop_queue(ndev); 1446 netif_stop_queue(ndev);
1442 fec_stop(ndev); 1447 fec_stop(ndev);
diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
index f5390071efd0..eb4372962839 100644
--- a/drivers/net/ethernet/freescale/fec.h
+++ b/drivers/net/ethernet/freescale/fec.h
@@ -240,6 +240,7 @@ struct fec_enet_private {
240 phy_interface_t phy_interface; 240 phy_interface_t phy_interface;
241 int link; 241 int link;
242 int full_duplex; 242 int full_duplex;
243 int speed;
243 struct completion mdio_done; 244 struct completion mdio_done;
244 int irq[FEC_IRQ_NUM]; 245 int irq[FEC_IRQ_NUM];
245 int bufdesc_ex; 246 int bufdesc_ex;
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
index 52c05366599a..ae1b77aa199f 100644
--- a/drivers/net/ethernet/ti/davinci_emac.c
+++ b/drivers/net/ethernet/ti/davinci_emac.c
@@ -1102,7 +1102,7 @@ static int emac_dev_xmit(struct sk_buff *skb, struct net_device *ndev)
1102 /* If there is no more tx desc left free then we need to 1102 /* If there is no more tx desc left free then we need to
1103 * tell the kernel to stop sending us tx frames. 1103 * tell the kernel to stop sending us tx frames.
1104 */ 1104 */
1105 if (unlikely(cpdma_check_free_tx_desc(priv->txchan))) 1105 if (unlikely(!cpdma_check_free_tx_desc(priv->txchan)))
1106 netif_stop_queue(ndev); 1106 netif_stop_queue(ndev);
1107 1107
1108 return NETDEV_TX_OK; 1108 return NETDEV_TX_OK;
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
index 3b6e9b83342d..7c769d8e25ad 100644
--- a/drivers/net/usb/Kconfig
+++ b/drivers/net/usb/Kconfig
@@ -268,7 +268,7 @@ config USB_NET_SMSC75XX
268 select CRC16 268 select CRC16
269 select CRC32 269 select CRC32
270 help 270 help
271 This option adds support for SMSC LAN95XX based USB 2.0 271 This option adds support for SMSC LAN75XX based USB 2.0
272 Gigabit Ethernet adapters. 272 Gigabit Ethernet adapters.
273 273
274config USB_NET_SMSC95XX 274config USB_NET_SMSC95XX
diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c
index 248d2dc765a5..16c842997291 100644
--- a/drivers/net/usb/cdc_mbim.c
+++ b/drivers/net/usb/cdc_mbim.c
@@ -68,18 +68,9 @@ static int cdc_mbim_bind(struct usbnet *dev, struct usb_interface *intf)
68 struct cdc_ncm_ctx *ctx; 68 struct cdc_ncm_ctx *ctx;
69 struct usb_driver *subdriver = ERR_PTR(-ENODEV); 69 struct usb_driver *subdriver = ERR_PTR(-ENODEV);
70 int ret = -ENODEV; 70 int ret = -ENODEV;
71 u8 data_altsetting = CDC_NCM_DATA_ALTSETTING_NCM; 71 u8 data_altsetting = cdc_ncm_select_altsetting(dev, intf);
72 struct cdc_mbim_state *info = (void *)&dev->data; 72 struct cdc_mbim_state *info = (void *)&dev->data;
73 73
74 /* see if interface supports MBIM alternate setting */
75 if (intf->num_altsetting == 2) {
76 if (!cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting))
77 usb_set_interface(dev->udev,
78 intf->cur_altsetting->desc.bInterfaceNumber,
79 CDC_NCM_COMM_ALTSETTING_MBIM);
80 data_altsetting = CDC_NCM_DATA_ALTSETTING_MBIM;
81 }
82
83 /* Probably NCM, defer for cdc_ncm_bind */ 74 /* Probably NCM, defer for cdc_ncm_bind */
84 if (!cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) 75 if (!cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting))
85 goto err; 76 goto err;
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 61b74a2b89ac..4709fa3497cf 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -55,6 +55,14 @@
55 55
56#define DRIVER_VERSION "14-Mar-2012" 56#define DRIVER_VERSION "14-Mar-2012"
57 57
58#if IS_ENABLED(CONFIG_USB_NET_CDC_MBIM)
59static bool prefer_mbim = true;
60#else
61static bool prefer_mbim;
62#endif
63module_param(prefer_mbim, bool, S_IRUGO | S_IWUSR);
64MODULE_PARM_DESC(prefer_mbim, "Prefer MBIM setting on dual NCM/MBIM functions");
65
58static void cdc_ncm_txpath_bh(unsigned long param); 66static void cdc_ncm_txpath_bh(unsigned long param);
59static void cdc_ncm_tx_timeout_start(struct cdc_ncm_ctx *ctx); 67static void cdc_ncm_tx_timeout_start(struct cdc_ncm_ctx *ctx);
60static enum hrtimer_restart cdc_ncm_tx_timer_cb(struct hrtimer *hr_timer); 68static enum hrtimer_restart cdc_ncm_tx_timer_cb(struct hrtimer *hr_timer);
@@ -550,9 +558,12 @@ void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf)
550} 558}
551EXPORT_SYMBOL_GPL(cdc_ncm_unbind); 559EXPORT_SYMBOL_GPL(cdc_ncm_unbind);
552 560
553static int cdc_ncm_bind(struct usbnet *dev, struct usb_interface *intf) 561/* Select the MBIM altsetting iff it is preferred and available,
562 * returning the number of the corresponding data interface altsetting
563 */
564u8 cdc_ncm_select_altsetting(struct usbnet *dev, struct usb_interface *intf)
554{ 565{
555 int ret; 566 struct usb_host_interface *alt;
556 567
557 /* The MBIM spec defines a NCM compatible default altsetting, 568 /* The MBIM spec defines a NCM compatible default altsetting,
558 * which we may have matched: 569 * which we may have matched:
@@ -568,23 +579,27 @@ static int cdc_ncm_bind(struct usbnet *dev, struct usb_interface *intf)
568 * endpoint descriptors, shall be constructed according to 579 * endpoint descriptors, shall be constructed according to
569 * the rules given in section 6 (USB Device Model) of this 580 * the rules given in section 6 (USB Device Model) of this
570 * specification." 581 * specification."
571 *
572 * Do not bind to such interfaces, allowing cdc_mbim to handle
573 * them
574 */ 582 */
575#if IS_ENABLED(CONFIG_USB_NET_CDC_MBIM) 583 if (prefer_mbim && intf->num_altsetting == 2) {
576 if ((intf->num_altsetting == 2) && 584 alt = usb_altnum_to_altsetting(intf, CDC_NCM_COMM_ALTSETTING_MBIM);
577 !usb_set_interface(dev->udev, 585 if (alt && cdc_ncm_comm_intf_is_mbim(alt) &&
578 intf->cur_altsetting->desc.bInterfaceNumber, 586 !usb_set_interface(dev->udev,
579 CDC_NCM_COMM_ALTSETTING_MBIM)) { 587 intf->cur_altsetting->desc.bInterfaceNumber,
580 if (cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) 588 CDC_NCM_COMM_ALTSETTING_MBIM))
581 return -ENODEV; 589 return CDC_NCM_DATA_ALTSETTING_MBIM;
582 else
583 usb_set_interface(dev->udev,
584 intf->cur_altsetting->desc.bInterfaceNumber,
585 CDC_NCM_COMM_ALTSETTING_NCM);
586 } 590 }
587#endif 591 return CDC_NCM_DATA_ALTSETTING_NCM;
592}
593EXPORT_SYMBOL_GPL(cdc_ncm_select_altsetting);
594
595static int cdc_ncm_bind(struct usbnet *dev, struct usb_interface *intf)
596{
597 int ret;
598
599 /* MBIM backwards compatible function? */
600 cdc_ncm_select_altsetting(dev, intf);
601 if (cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting))
602 return -ENODEV;
588 603
589 /* NCM data altsetting is always 1 */ 604 /* NCM data altsetting is always 1 */
590 ret = cdc_ncm_bind_common(dev, intf, 1); 605 ret = cdc_ncm_bind_common(dev, intf, 1);
diff --git a/drivers/net/wireless/mwifiex/join.c b/drivers/net/wireless/mwifiex/join.c
index 246aa62a4817..2fe0ceba4400 100644
--- a/drivers/net/wireless/mwifiex/join.c
+++ b/drivers/net/wireless/mwifiex/join.c
@@ -1117,10 +1117,9 @@ mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv,
1117 adhoc_join->bss_descriptor.bssid, 1117 adhoc_join->bss_descriptor.bssid,
1118 adhoc_join->bss_descriptor.ssid); 1118 adhoc_join->bss_descriptor.ssid);
1119 1119
1120 for (i = 0; bss_desc->supported_rates[i] && 1120 for (i = 0; i < MWIFIEX_SUPPORTED_RATES &&
1121 i < MWIFIEX_SUPPORTED_RATES; 1121 bss_desc->supported_rates[i]; i++)
1122 i++) 1122 ;
1123 ;
1124 rates_size = i; 1123 rates_size = i;
1125 1124
1126 /* Copy Data Rates from the Rates recorded in scan response */ 1125 /* Copy Data Rates from the Rates recorded in scan response */
diff --git a/drivers/net/wireless/rt2x00/Kconfig b/drivers/net/wireless/rt2x00/Kconfig
index 44d6ead43341..2bf4efa33186 100644
--- a/drivers/net/wireless/rt2x00/Kconfig
+++ b/drivers/net/wireless/rt2x00/Kconfig
@@ -55,10 +55,10 @@ config RT61PCI
55 55
56config RT2800PCI 56config RT2800PCI
57 tristate "Ralink rt27xx/rt28xx/rt30xx (PCI/PCIe/PCMCIA) support" 57 tristate "Ralink rt27xx/rt28xx/rt30xx (PCI/PCIe/PCMCIA) support"
58 depends on PCI || RALINK_RT288X || RALINK_RT305X 58 depends on PCI || SOC_RT288X || SOC_RT305X
59 select RT2800_LIB 59 select RT2800_LIB
60 select RT2X00_LIB_PCI if PCI 60 select RT2X00_LIB_PCI if PCI
61 select RT2X00_LIB_SOC if RALINK_RT288X || RALINK_RT305X 61 select RT2X00_LIB_SOC if SOC_RT288X || SOC_RT305X
62 select RT2X00_LIB_FIRMWARE 62 select RT2X00_LIB_FIRMWARE
63 select RT2X00_LIB_CRYPTO 63 select RT2X00_LIB_CRYPTO
64 select CRC_CCITT 64 select CRC_CCITT
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index 48a01aa21f1c..ded73da4de0b 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -89,7 +89,7 @@ static void rt2800pci_mcu_status(struct rt2x00_dev *rt2x00dev, const u8 token)
89 rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); 89 rt2x00pci_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0);
90} 90}
91 91
92#if defined(CONFIG_RALINK_RT288X) || defined(CONFIG_RALINK_RT305X) 92#if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X)
93static int rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev) 93static int rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev)
94{ 94{
95 void __iomem *base_addr = ioremap(0x1F040000, EEPROM_SIZE); 95 void __iomem *base_addr = ioremap(0x1F040000, EEPROM_SIZE);
@@ -107,7 +107,7 @@ static inline int rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev)
107{ 107{
108 return -ENOMEM; 108 return -ENOMEM;
109} 109}
110#endif /* CONFIG_RALINK_RT288X || CONFIG_RALINK_RT305X */ 110#endif /* CONFIG_SOC_RT288X || CONFIG_SOC_RT305X */
111 111
112#ifdef CONFIG_PCI 112#ifdef CONFIG_PCI
113static void rt2800pci_eepromregister_read(struct eeprom_93cx6 *eeprom) 113static void rt2800pci_eepromregister_read(struct eeprom_93cx6 *eeprom)
@@ -1177,7 +1177,7 @@ MODULE_DEVICE_TABLE(pci, rt2800pci_device_table);
1177#endif /* CONFIG_PCI */ 1177#endif /* CONFIG_PCI */
1178MODULE_LICENSE("GPL"); 1178MODULE_LICENSE("GPL");
1179 1179
1180#if defined(CONFIG_RALINK_RT288X) || defined(CONFIG_RALINK_RT305X) 1180#if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X)
1181static int rt2800soc_probe(struct platform_device *pdev) 1181static int rt2800soc_probe(struct platform_device *pdev)
1182{ 1182{
1183 return rt2x00soc_probe(pdev, &rt2800pci_ops); 1183 return rt2x00soc_probe(pdev, &rt2800pci_ops);
@@ -1194,7 +1194,7 @@ static struct platform_driver rt2800soc_driver = {
1194 .suspend = rt2x00soc_suspend, 1194 .suspend = rt2x00soc_suspend,
1195 .resume = rt2x00soc_resume, 1195 .resume = rt2x00soc_resume,
1196}; 1196};
1197#endif /* CONFIG_RALINK_RT288X || CONFIG_RALINK_RT305X */ 1197#endif /* CONFIG_SOC_RT288X || CONFIG_SOC_RT305X */
1198 1198
1199#ifdef CONFIG_PCI 1199#ifdef CONFIG_PCI
1200static int rt2800pci_probe(struct pci_dev *pci_dev, 1200static int rt2800pci_probe(struct pci_dev *pci_dev,
@@ -1217,7 +1217,7 @@ static int __init rt2800pci_init(void)
1217{ 1217{
1218 int ret = 0; 1218 int ret = 0;
1219 1219
1220#if defined(CONFIG_RALINK_RT288X) || defined(CONFIG_RALINK_RT305X) 1220#if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X)
1221 ret = platform_driver_register(&rt2800soc_driver); 1221 ret = platform_driver_register(&rt2800soc_driver);
1222 if (ret) 1222 if (ret)
1223 return ret; 1223 return ret;
@@ -1225,7 +1225,7 @@ static int __init rt2800pci_init(void)
1225#ifdef CONFIG_PCI 1225#ifdef CONFIG_PCI
1226 ret = pci_register_driver(&rt2800pci_driver); 1226 ret = pci_register_driver(&rt2800pci_driver);
1227 if (ret) { 1227 if (ret) {
1228#if defined(CONFIG_RALINK_RT288X) || defined(CONFIG_RALINK_RT305X) 1228#if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X)
1229 platform_driver_unregister(&rt2800soc_driver); 1229 platform_driver_unregister(&rt2800soc_driver);
1230#endif 1230#endif
1231 return ret; 1231 return ret;
@@ -1240,7 +1240,7 @@ static void __exit rt2800pci_exit(void)
1240#ifdef CONFIG_PCI 1240#ifdef CONFIG_PCI
1241 pci_unregister_driver(&rt2800pci_driver); 1241 pci_unregister_driver(&rt2800pci_driver);
1242#endif 1242#endif
1243#if defined(CONFIG_RALINK_RT288X) || defined(CONFIG_RALINK_RT305X) 1243#if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X)
1244 platform_driver_unregister(&rt2800soc_driver); 1244 platform_driver_unregister(&rt2800soc_driver);
1245#endif 1245#endif
1246} 1246}
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
index b1ccff474c79..c08d0f4c5f3d 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c
@@ -1377,74 +1377,57 @@ void rtl92cu_card_disable(struct ieee80211_hw *hw)
1377 1377
1378void rtl92cu_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid) 1378void rtl92cu_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid)
1379{ 1379{
1380 /* dummy routine needed for callback from rtl_op_configure_filter() */
1381}
1382
1383/*========================================================================== */
1384
1385static void _rtl92cu_set_check_bssid(struct ieee80211_hw *hw,
1386 enum nl80211_iftype type)
1387{
1388 struct rtl_priv *rtlpriv = rtl_priv(hw); 1380 struct rtl_priv *rtlpriv = rtl_priv(hw);
1389 u32 reg_rcr = rtl_read_dword(rtlpriv, REG_RCR);
1390 struct rtl_hal *rtlhal = rtl_hal(rtlpriv); 1381 struct rtl_hal *rtlhal = rtl_hal(rtlpriv);
1391 struct rtl_phy *rtlphy = &(rtlpriv->phy); 1382 u32 reg_rcr = rtl_read_dword(rtlpriv, REG_RCR);
1392 u8 filterout_non_associated_bssid = false;
1393 1383
1394 switch (type) { 1384 if (rtlpriv->psc.rfpwr_state != ERFON)
1395 case NL80211_IFTYPE_ADHOC: 1385 return;
1396 case NL80211_IFTYPE_STATION: 1386
1397 filterout_non_associated_bssid = true; 1387 if (check_bssid) {
1398 break; 1388 u8 tmp;
1399 case NL80211_IFTYPE_UNSPECIFIED:
1400 case NL80211_IFTYPE_AP:
1401 default:
1402 break;
1403 }
1404 if (filterout_non_associated_bssid) {
1405 if (IS_NORMAL_CHIP(rtlhal->version)) { 1389 if (IS_NORMAL_CHIP(rtlhal->version)) {
1406 switch (rtlphy->current_io_type) { 1390 reg_rcr |= (RCR_CBSSID_DATA | RCR_CBSSID_BCN);
1407 case IO_CMD_RESUME_DM_BY_SCAN: 1391 tmp = BIT(4);
1408 reg_rcr |= (RCR_CBSSID_DATA | RCR_CBSSID_BCN);
1409 rtlpriv->cfg->ops->set_hw_reg(hw,
1410 HW_VAR_RCR, (u8 *)(&reg_rcr));
1411 /* enable update TSF */
1412 _rtl92cu_set_bcn_ctrl_reg(hw, 0, BIT(4));
1413 break;
1414 case IO_CMD_PAUSE_DM_BY_SCAN:
1415 reg_rcr &= ~(RCR_CBSSID_DATA | RCR_CBSSID_BCN);
1416 rtlpriv->cfg->ops->set_hw_reg(hw,
1417 HW_VAR_RCR, (u8 *)(&reg_rcr));
1418 /* disable update TSF */
1419 _rtl92cu_set_bcn_ctrl_reg(hw, BIT(4), 0);
1420 break;
1421 }
1422 } else { 1392 } else {
1423 reg_rcr |= (RCR_CBSSID); 1393 reg_rcr |= RCR_CBSSID;
1424 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, 1394 tmp = BIT(4) | BIT(5);
1425 (u8 *)(&reg_rcr));
1426 _rtl92cu_set_bcn_ctrl_reg(hw, 0, (BIT(4)|BIT(5)));
1427 } 1395 }
1428 } else if (filterout_non_associated_bssid == false) { 1396 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR,
1397 (u8 *) (&reg_rcr));
1398 _rtl92cu_set_bcn_ctrl_reg(hw, 0, tmp);
1399 } else {
1400 u8 tmp;
1429 if (IS_NORMAL_CHIP(rtlhal->version)) { 1401 if (IS_NORMAL_CHIP(rtlhal->version)) {
1430 reg_rcr &= (~(RCR_CBSSID_DATA | RCR_CBSSID_BCN)); 1402 reg_rcr &= ~(RCR_CBSSID_DATA | RCR_CBSSID_BCN);
1431 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, 1403 tmp = BIT(4);
1432 (u8 *)(&reg_rcr));
1433 _rtl92cu_set_bcn_ctrl_reg(hw, BIT(4), 0);
1434 } else { 1404 } else {
1435 reg_rcr &= (~RCR_CBSSID); 1405 reg_rcr &= ~RCR_CBSSID;
1436 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, 1406 tmp = BIT(4) | BIT(5);
1437 (u8 *)(&reg_rcr));
1438 _rtl92cu_set_bcn_ctrl_reg(hw, (BIT(4)|BIT(5)), 0);
1439 } 1407 }
1408 reg_rcr &= (~(RCR_CBSSID_DATA | RCR_CBSSID_BCN));
1409 rtlpriv->cfg->ops->set_hw_reg(hw,
1410 HW_VAR_RCR, (u8 *) (&reg_rcr));
1411 _rtl92cu_set_bcn_ctrl_reg(hw, tmp, 0);
1440 } 1412 }
1441} 1413}
1442 1414
1415/*========================================================================== */
1416
1443int rtl92cu_set_network_type(struct ieee80211_hw *hw, enum nl80211_iftype type) 1417int rtl92cu_set_network_type(struct ieee80211_hw *hw, enum nl80211_iftype type)
1444{ 1418{
1419 struct rtl_priv *rtlpriv = rtl_priv(hw);
1420
1445 if (_rtl92cu_set_media_status(hw, type)) 1421 if (_rtl92cu_set_media_status(hw, type))
1446 return -EOPNOTSUPP; 1422 return -EOPNOTSUPP;
1447 _rtl92cu_set_check_bssid(hw, type); 1423
1424 if (rtlpriv->mac80211.link_state == MAC80211_LINKED) {
1425 if (type != NL80211_IFTYPE_AP)
1426 rtl92cu_set_check_bssid(hw, true);
1427 } else {
1428 rtl92cu_set_check_bssid(hw, false);
1429 }
1430
1448 return 0; 1431 return 0;
1449} 1432}
1450 1433
@@ -2058,8 +2041,6 @@ void rtl92cu_update_hal_rate_table(struct ieee80211_hw *hw,
2058 (shortgi_rate << 4) | (shortgi_rate); 2041 (shortgi_rate << 4) | (shortgi_rate);
2059 } 2042 }
2060 rtl_write_dword(rtlpriv, REG_ARFR0 + ratr_index * 4, ratr_value); 2043 rtl_write_dword(rtlpriv, REG_ARFR0 + ratr_index * 4, ratr_value);
2061 RT_TRACE(rtlpriv, COMP_RATR, DBG_DMESG, "%x\n",
2062 rtl_read_dword(rtlpriv, REG_ARFR0));
2063} 2044}
2064 2045
2065void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level) 2046void rtl92cu_update_hal_rate_mask(struct ieee80211_hw *hw, u8 rssi_level)
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
index ab886b7ee327..b41ac7756a4b 100644
--- a/drivers/pci/rom.c
+++ b/drivers/pci/rom.c
@@ -100,6 +100,27 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size)
100 return min((size_t)(image - rom), size); 100 return min((size_t)(image - rom), size);
101} 101}
102 102
103static loff_t pci_find_rom(struct pci_dev *pdev, size_t *size)
104{
105 struct resource *res = &pdev->resource[PCI_ROM_RESOURCE];
106 loff_t start;
107
108 /* assign the ROM an address if it doesn't have one */
109 if (res->parent == NULL && pci_assign_resource(pdev, PCI_ROM_RESOURCE))
110 return 0;
111 start = pci_resource_start(pdev, PCI_ROM_RESOURCE);
112 *size = pci_resource_len(pdev, PCI_ROM_RESOURCE);
113
114 if (*size == 0)
115 return 0;
116
117 /* Enable ROM space decodes */
118 if (pci_enable_rom(pdev))
119 return 0;
120
121 return start;
122}
123
103/** 124/**
104 * pci_map_rom - map a PCI ROM to kernel space 125 * pci_map_rom - map a PCI ROM to kernel space
105 * @pdev: pointer to pci device struct 126 * @pdev: pointer to pci device struct
@@ -114,21 +135,15 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size)
114void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size) 135void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size)
115{ 136{
116 struct resource *res = &pdev->resource[PCI_ROM_RESOURCE]; 137 struct resource *res = &pdev->resource[PCI_ROM_RESOURCE];
117 loff_t start; 138 loff_t start = 0;
118 void __iomem *rom; 139 void __iomem *rom;
119 140
120 /* 141 /*
121 * Some devices may provide ROMs via a source other than the BAR
122 */
123 if (pdev->rom && pdev->romlen) {
124 *size = pdev->romlen;
125 return phys_to_virt(pdev->rom);
126 /*
127 * IORESOURCE_ROM_SHADOW set on x86, x86_64 and IA64 supports legacy 142 * IORESOURCE_ROM_SHADOW set on x86, x86_64 and IA64 supports legacy
128 * memory map if the VGA enable bit of the Bridge Control register is 143 * memory map if the VGA enable bit of the Bridge Control register is
129 * set for embedded VGA. 144 * set for embedded VGA.
130 */ 145 */
131 } else if (res->flags & IORESOURCE_ROM_SHADOW) { 146 if (res->flags & IORESOURCE_ROM_SHADOW) {
132 /* primary video rom always starts here */ 147 /* primary video rom always starts here */
133 start = (loff_t)0xC0000; 148 start = (loff_t)0xC0000;
134 *size = 0x20000; /* cover C000:0 through E000:0 */ 149 *size = 0x20000; /* cover C000:0 through E000:0 */
@@ -139,21 +154,21 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size)
139 return (void __iomem *)(unsigned long) 154 return (void __iomem *)(unsigned long)
140 pci_resource_start(pdev, PCI_ROM_RESOURCE); 155 pci_resource_start(pdev, PCI_ROM_RESOURCE);
141 } else { 156 } else {
142 /* assign the ROM an address if it doesn't have one */ 157 start = pci_find_rom(pdev, size);
143 if (res->parent == NULL &&
144 pci_assign_resource(pdev,PCI_ROM_RESOURCE))
145 return NULL;
146 start = pci_resource_start(pdev, PCI_ROM_RESOURCE);
147 *size = pci_resource_len(pdev, PCI_ROM_RESOURCE);
148 if (*size == 0)
149 return NULL;
150
151 /* Enable ROM space decodes */
152 if (pci_enable_rom(pdev))
153 return NULL;
154 } 158 }
155 } 159 }
156 160
161 /*
162 * Some devices may provide ROMs via a source other than the BAR
163 */
164 if (!start && pdev->rom && pdev->romlen) {
165 *size = pdev->romlen;
166 return phys_to_virt(pdev->rom);
167 }
168
169 if (!start)
170 return NULL;
171
157 rom = ioremap(start, *size); 172 rom = ioremap(start, *size);
158 if (!rom) { 173 if (!rom) {
159 /* restore enable if ioremap fails */ 174 /* restore enable if ioremap fails */
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index 75933a6aa828..efb7f10e902a 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -1277,21 +1277,80 @@ static int alt_gpio_irq_type(struct irq_data *d, unsigned type)
1277} 1277}
1278 1278
1279#ifdef CONFIG_PM 1279#ifdef CONFIG_PM
1280
1281static u32 wakeups[MAX_GPIO_BANKS];
1282static u32 backups[MAX_GPIO_BANKS];
1283
1280static int gpio_irq_set_wake(struct irq_data *d, unsigned state) 1284static int gpio_irq_set_wake(struct irq_data *d, unsigned state)
1281{ 1285{
1282 struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(d); 1286 struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(d);
1283 unsigned bank = at91_gpio->pioc_idx; 1287 unsigned bank = at91_gpio->pioc_idx;
1288 unsigned mask = 1 << d->hwirq;
1284 1289
1285 if (unlikely(bank >= MAX_GPIO_BANKS)) 1290 if (unlikely(bank >= MAX_GPIO_BANKS))
1286 return -EINVAL; 1291 return -EINVAL;
1287 1292
1293 if (state)
1294 wakeups[bank] |= mask;
1295 else
1296 wakeups[bank] &= ~mask;
1297
1288 irq_set_irq_wake(at91_gpio->pioc_virq, state); 1298 irq_set_irq_wake(at91_gpio->pioc_virq, state);
1289 1299
1290 return 0; 1300 return 0;
1291} 1301}
1302
1303void at91_pinctrl_gpio_suspend(void)
1304{
1305 int i;
1306
1307 for (i = 0; i < gpio_banks; i++) {
1308 void __iomem *pio;
1309
1310 if (!gpio_chips[i])
1311 continue;
1312
1313 pio = gpio_chips[i]->regbase;
1314
1315 backups[i] = __raw_readl(pio + PIO_IMR);
1316 __raw_writel(backups[i], pio + PIO_IDR);
1317 __raw_writel(wakeups[i], pio + PIO_IER);
1318
1319 if (!wakeups[i]) {
1320 clk_unprepare(gpio_chips[i]->clock);
1321 clk_disable(gpio_chips[i]->clock);
1322 } else {
1323 printk(KERN_DEBUG "GPIO-%c may wake for %08x\n",
1324 'A'+i, wakeups[i]);
1325 }
1326 }
1327}
1328
1329void at91_pinctrl_gpio_resume(void)
1330{
1331 int i;
1332
1333 for (i = 0; i < gpio_banks; i++) {
1334 void __iomem *pio;
1335
1336 if (!gpio_chips[i])
1337 continue;
1338
1339 pio = gpio_chips[i]->regbase;
1340
1341 if (!wakeups[i]) {
1342 if (clk_prepare(gpio_chips[i]->clock) == 0)
1343 clk_enable(gpio_chips[i]->clock);
1344 }
1345
1346 __raw_writel(wakeups[i], pio + PIO_IDR);
1347 __raw_writel(backups[i], pio + PIO_IER);
1348 }
1349}
1350
1292#else 1351#else
1293#define gpio_irq_set_wake NULL 1352#define gpio_irq_set_wake NULL
1294#endif 1353#endif /* CONFIG_PM */
1295 1354
1296static struct irq_chip gpio_irqchip = { 1355static struct irq_chip gpio_irqchip = {
1297 .name = "GPIO", 1356 .name = "GPIO",
diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c
index 57233c885998..8f87fec27ce7 100644
--- a/drivers/rtc/rtc-mv.c
+++ b/drivers/rtc/rtc-mv.c
@@ -14,6 +14,7 @@
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/of.h> 15#include <linux/of.h>
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/clk.h>
17#include <linux/gfp.h> 18#include <linux/gfp.h>
18#include <linux/module.h> 19#include <linux/module.h>
19 20
@@ -41,6 +42,7 @@ struct rtc_plat_data {
41 struct rtc_device *rtc; 42 struct rtc_device *rtc;
42 void __iomem *ioaddr; 43 void __iomem *ioaddr;
43 int irq; 44 int irq;
45 struct clk *clk;
44}; 46};
45 47
46static int mv_rtc_set_time(struct device *dev, struct rtc_time *tm) 48static int mv_rtc_set_time(struct device *dev, struct rtc_time *tm)
@@ -221,6 +223,7 @@ static int mv_rtc_probe(struct platform_device *pdev)
221 struct rtc_plat_data *pdata; 223 struct rtc_plat_data *pdata;
222 resource_size_t size; 224 resource_size_t size;
223 u32 rtc_time; 225 u32 rtc_time;
226 int ret = 0;
224 227
225 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 228 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
226 if (!res) 229 if (!res)
@@ -239,11 +242,17 @@ static int mv_rtc_probe(struct platform_device *pdev)
239 if (!pdata->ioaddr) 242 if (!pdata->ioaddr)
240 return -ENOMEM; 243 return -ENOMEM;
241 244
245 pdata->clk = devm_clk_get(&pdev->dev, NULL);
246 /* Not all SoCs require a clock.*/
247 if (!IS_ERR(pdata->clk))
248 clk_prepare_enable(pdata->clk);
249
242 /* make sure the 24 hours mode is enabled */ 250 /* make sure the 24 hours mode is enabled */
243 rtc_time = readl(pdata->ioaddr + RTC_TIME_REG_OFFS); 251 rtc_time = readl(pdata->ioaddr + RTC_TIME_REG_OFFS);
244 if (rtc_time & RTC_HOURS_12H_MODE) { 252 if (rtc_time & RTC_HOURS_12H_MODE) {
245 dev_err(&pdev->dev, "24 Hours mode not supported.\n"); 253 dev_err(&pdev->dev, "24 Hours mode not supported.\n");
246 return -EINVAL; 254 ret = -EINVAL;
255 goto out;
247 } 256 }
248 257
249 /* make sure it is actually functional */ 258 /* make sure it is actually functional */
@@ -252,7 +261,8 @@ static int mv_rtc_probe(struct platform_device *pdev)
252 rtc_time = readl(pdata->ioaddr + RTC_TIME_REG_OFFS); 261 rtc_time = readl(pdata->ioaddr + RTC_TIME_REG_OFFS);
253 if (rtc_time == 0x01000000) { 262 if (rtc_time == 0x01000000) {
254 dev_err(&pdev->dev, "internal RTC not ticking\n"); 263 dev_err(&pdev->dev, "internal RTC not ticking\n");
255 return -ENODEV; 264 ret = -ENODEV;
265 goto out;
256 } 266 }
257 } 267 }
258 268
@@ -268,8 +278,10 @@ static int mv_rtc_probe(struct platform_device *pdev)
268 } else 278 } else
269 pdata->rtc = rtc_device_register(pdev->name, &pdev->dev, 279 pdata->rtc = rtc_device_register(pdev->name, &pdev->dev,
270 &mv_rtc_ops, THIS_MODULE); 280 &mv_rtc_ops, THIS_MODULE);
271 if (IS_ERR(pdata->rtc)) 281 if (IS_ERR(pdata->rtc)) {
272 return PTR_ERR(pdata->rtc); 282 ret = PTR_ERR(pdata->rtc);
283 goto out;
284 }
273 285
274 if (pdata->irq >= 0) { 286 if (pdata->irq >= 0) {
275 writel(0, pdata->ioaddr + RTC_ALARM_INTERRUPT_MASK_REG_OFFS); 287 writel(0, pdata->ioaddr + RTC_ALARM_INTERRUPT_MASK_REG_OFFS);
@@ -282,6 +294,11 @@ static int mv_rtc_probe(struct platform_device *pdev)
282 } 294 }
283 295
284 return 0; 296 return 0;
297out:
298 if (!IS_ERR(pdata->clk))
299 clk_disable_unprepare(pdata->clk);
300
301 return ret;
285} 302}
286 303
287static int __exit mv_rtc_remove(struct platform_device *pdev) 304static int __exit mv_rtc_remove(struct platform_device *pdev)
@@ -292,6 +309,9 @@ static int __exit mv_rtc_remove(struct platform_device *pdev)
292 device_init_wakeup(&pdev->dev, 0); 309 device_init_wakeup(&pdev->dev, 0);
293 310
294 rtc_device_unregister(pdata->rtc); 311 rtc_device_unregister(pdata->rtc);
312 if (!IS_ERR(pdata->clk))
313 clk_disable_unprepare(pdata->clk);
314
295 return 0; 315 return 0;
296} 316}
297 317
diff --git a/drivers/s390/block/scm_blk.c b/drivers/s390/block/scm_blk.c
index 9978ad4433cb..5ac9c935c151 100644
--- a/drivers/s390/block/scm_blk.c
+++ b/drivers/s390/block/scm_blk.c
@@ -135,6 +135,11 @@ static const struct block_device_operations scm_blk_devops = {
135 .release = scm_release, 135 .release = scm_release,
136}; 136};
137 137
138static bool scm_permit_request(struct scm_blk_dev *bdev, struct request *req)
139{
140 return rq_data_dir(req) != WRITE || bdev->state != SCM_WR_PROHIBIT;
141}
142
138static void scm_request_prepare(struct scm_request *scmrq) 143static void scm_request_prepare(struct scm_request *scmrq)
139{ 144{
140 struct scm_blk_dev *bdev = scmrq->bdev; 145 struct scm_blk_dev *bdev = scmrq->bdev;
@@ -195,14 +200,18 @@ void scm_request_requeue(struct scm_request *scmrq)
195 200
196 scm_release_cluster(scmrq); 201 scm_release_cluster(scmrq);
197 blk_requeue_request(bdev->rq, scmrq->request); 202 blk_requeue_request(bdev->rq, scmrq->request);
203 atomic_dec(&bdev->queued_reqs);
198 scm_request_done(scmrq); 204 scm_request_done(scmrq);
199 scm_ensure_queue_restart(bdev); 205 scm_ensure_queue_restart(bdev);
200} 206}
201 207
202void scm_request_finish(struct scm_request *scmrq) 208void scm_request_finish(struct scm_request *scmrq)
203{ 209{
210 struct scm_blk_dev *bdev = scmrq->bdev;
211
204 scm_release_cluster(scmrq); 212 scm_release_cluster(scmrq);
205 blk_end_request_all(scmrq->request, scmrq->error); 213 blk_end_request_all(scmrq->request, scmrq->error);
214 atomic_dec(&bdev->queued_reqs);
206 scm_request_done(scmrq); 215 scm_request_done(scmrq);
207} 216}
208 217
@@ -218,6 +227,10 @@ static void scm_blk_request(struct request_queue *rq)
218 if (req->cmd_type != REQ_TYPE_FS) 227 if (req->cmd_type != REQ_TYPE_FS)
219 continue; 228 continue;
220 229
230 if (!scm_permit_request(bdev, req)) {
231 scm_ensure_queue_restart(bdev);
232 return;
233 }
221 scmrq = scm_request_fetch(); 234 scmrq = scm_request_fetch();
222 if (!scmrq) { 235 if (!scmrq) {
223 SCM_LOG(5, "no request"); 236 SCM_LOG(5, "no request");
@@ -231,11 +244,13 @@ static void scm_blk_request(struct request_queue *rq)
231 return; 244 return;
232 } 245 }
233 if (scm_need_cluster_request(scmrq)) { 246 if (scm_need_cluster_request(scmrq)) {
247 atomic_inc(&bdev->queued_reqs);
234 blk_start_request(req); 248 blk_start_request(req);
235 scm_initiate_cluster_request(scmrq); 249 scm_initiate_cluster_request(scmrq);
236 return; 250 return;
237 } 251 }
238 scm_request_prepare(scmrq); 252 scm_request_prepare(scmrq);
253 atomic_inc(&bdev->queued_reqs);
239 blk_start_request(req); 254 blk_start_request(req);
240 255
241 ret = scm_start_aob(scmrq->aob); 256 ret = scm_start_aob(scmrq->aob);
@@ -244,7 +259,6 @@ static void scm_blk_request(struct request_queue *rq)
244 scm_request_requeue(scmrq); 259 scm_request_requeue(scmrq);
245 return; 260 return;
246 } 261 }
247 atomic_inc(&bdev->queued_reqs);
248 } 262 }
249} 263}
250 264
@@ -280,6 +294,38 @@ void scm_blk_irq(struct scm_device *scmdev, void *data, int error)
280 tasklet_hi_schedule(&bdev->tasklet); 294 tasklet_hi_schedule(&bdev->tasklet);
281} 295}
282 296
297static void scm_blk_handle_error(struct scm_request *scmrq)
298{
299 struct scm_blk_dev *bdev = scmrq->bdev;
300 unsigned long flags;
301
302 if (scmrq->error != -EIO)
303 goto restart;
304
305 /* For -EIO the response block is valid. */
306 switch (scmrq->aob->response.eqc) {
307 case EQC_WR_PROHIBIT:
308 spin_lock_irqsave(&bdev->lock, flags);
309 if (bdev->state != SCM_WR_PROHIBIT)
310 pr_info("%lu: Write access to the SCM increment is suspended\n",
311 (unsigned long) bdev->scmdev->address);
312 bdev->state = SCM_WR_PROHIBIT;
313 spin_unlock_irqrestore(&bdev->lock, flags);
314 goto requeue;
315 default:
316 break;
317 }
318
319restart:
320 if (!scm_start_aob(scmrq->aob))
321 return;
322
323requeue:
324 spin_lock_irqsave(&bdev->rq_lock, flags);
325 scm_request_requeue(scmrq);
326 spin_unlock_irqrestore(&bdev->rq_lock, flags);
327}
328
283static void scm_blk_tasklet(struct scm_blk_dev *bdev) 329static void scm_blk_tasklet(struct scm_blk_dev *bdev)
284{ 330{
285 struct scm_request *scmrq; 331 struct scm_request *scmrq;
@@ -293,11 +339,8 @@ static void scm_blk_tasklet(struct scm_blk_dev *bdev)
293 spin_unlock_irqrestore(&bdev->lock, flags); 339 spin_unlock_irqrestore(&bdev->lock, flags);
294 340
295 if (scmrq->error && scmrq->retries-- > 0) { 341 if (scmrq->error && scmrq->retries-- > 0) {
296 if (scm_start_aob(scmrq->aob)) { 342 scm_blk_handle_error(scmrq);
297 spin_lock_irqsave(&bdev->rq_lock, flags); 343
298 scm_request_requeue(scmrq);
299 spin_unlock_irqrestore(&bdev->rq_lock, flags);
300 }
301 /* Request restarted or requeued, handle next. */ 344 /* Request restarted or requeued, handle next. */
302 spin_lock_irqsave(&bdev->lock, flags); 345 spin_lock_irqsave(&bdev->lock, flags);
303 continue; 346 continue;
@@ -310,7 +353,6 @@ static void scm_blk_tasklet(struct scm_blk_dev *bdev)
310 } 353 }
311 354
312 scm_request_finish(scmrq); 355 scm_request_finish(scmrq);
313 atomic_dec(&bdev->queued_reqs);
314 spin_lock_irqsave(&bdev->lock, flags); 356 spin_lock_irqsave(&bdev->lock, flags);
315 } 357 }
316 spin_unlock_irqrestore(&bdev->lock, flags); 358 spin_unlock_irqrestore(&bdev->lock, flags);
@@ -332,6 +374,7 @@ int scm_blk_dev_setup(struct scm_blk_dev *bdev, struct scm_device *scmdev)
332 } 374 }
333 375
334 bdev->scmdev = scmdev; 376 bdev->scmdev = scmdev;
377 bdev->state = SCM_OPER;
335 spin_lock_init(&bdev->rq_lock); 378 spin_lock_init(&bdev->rq_lock);
336 spin_lock_init(&bdev->lock); 379 spin_lock_init(&bdev->lock);
337 INIT_LIST_HEAD(&bdev->finished_requests); 380 INIT_LIST_HEAD(&bdev->finished_requests);
@@ -396,6 +439,18 @@ void scm_blk_dev_cleanup(struct scm_blk_dev *bdev)
396 put_disk(bdev->gendisk); 439 put_disk(bdev->gendisk);
397} 440}
398 441
442void scm_blk_set_available(struct scm_blk_dev *bdev)
443{
444 unsigned long flags;
445
446 spin_lock_irqsave(&bdev->lock, flags);
447 if (bdev->state == SCM_WR_PROHIBIT)
448 pr_info("%lu: Write access to the SCM increment is restored\n",
449 (unsigned long) bdev->scmdev->address);
450 bdev->state = SCM_OPER;
451 spin_unlock_irqrestore(&bdev->lock, flags);
452}
453
399static int __init scm_blk_init(void) 454static int __init scm_blk_init(void)
400{ 455{
401 int ret = -EINVAL; 456 int ret = -EINVAL;
diff --git a/drivers/s390/block/scm_blk.h b/drivers/s390/block/scm_blk.h
index 3c1ccf494647..8b387b32fd62 100644
--- a/drivers/s390/block/scm_blk.h
+++ b/drivers/s390/block/scm_blk.h
@@ -21,6 +21,7 @@ struct scm_blk_dev {
21 spinlock_t rq_lock; /* guard the request queue */ 21 spinlock_t rq_lock; /* guard the request queue */
22 spinlock_t lock; /* guard the rest of the blockdev */ 22 spinlock_t lock; /* guard the rest of the blockdev */
23 atomic_t queued_reqs; 23 atomic_t queued_reqs;
24 enum {SCM_OPER, SCM_WR_PROHIBIT} state;
24 struct list_head finished_requests; 25 struct list_head finished_requests;
25#ifdef CONFIG_SCM_BLOCK_CLUSTER_WRITE 26#ifdef CONFIG_SCM_BLOCK_CLUSTER_WRITE
26 struct list_head cluster_list; 27 struct list_head cluster_list;
@@ -48,6 +49,7 @@ struct scm_request {
48 49
49int scm_blk_dev_setup(struct scm_blk_dev *, struct scm_device *); 50int scm_blk_dev_setup(struct scm_blk_dev *, struct scm_device *);
50void scm_blk_dev_cleanup(struct scm_blk_dev *); 51void scm_blk_dev_cleanup(struct scm_blk_dev *);
52void scm_blk_set_available(struct scm_blk_dev *);
51void scm_blk_irq(struct scm_device *, void *, int); 53void scm_blk_irq(struct scm_device *, void *, int);
52 54
53void scm_request_finish(struct scm_request *); 55void scm_request_finish(struct scm_request *);
diff --git a/drivers/s390/block/scm_drv.c b/drivers/s390/block/scm_drv.c
index 9fa0a908607b..5f6180d6ff08 100644
--- a/drivers/s390/block/scm_drv.c
+++ b/drivers/s390/block/scm_drv.c
@@ -13,12 +13,23 @@
13#include <asm/eadm.h> 13#include <asm/eadm.h>
14#include "scm_blk.h" 14#include "scm_blk.h"
15 15
16static void notify(struct scm_device *scmdev) 16static void scm_notify(struct scm_device *scmdev, enum scm_event event)
17{ 17{
18 pr_info("%lu: The capabilities of the SCM increment changed\n", 18 struct scm_blk_dev *bdev = dev_get_drvdata(&scmdev->dev);
19 (unsigned long) scmdev->address); 19
20 SCM_LOG(2, "State changed"); 20 switch (event) {
21 SCM_LOG_STATE(2, scmdev); 21 case SCM_CHANGE:
22 pr_info("%lu: The capabilities of the SCM increment changed\n",
23 (unsigned long) scmdev->address);
24 SCM_LOG(2, "State changed");
25 SCM_LOG_STATE(2, scmdev);
26 break;
27 case SCM_AVAIL:
28 SCM_LOG(2, "Increment available");
29 SCM_LOG_STATE(2, scmdev);
30 scm_blk_set_available(bdev);
31 break;
32 }
22} 33}
23 34
24static int scm_probe(struct scm_device *scmdev) 35static int scm_probe(struct scm_device *scmdev)
@@ -64,7 +75,7 @@ static struct scm_driver scm_drv = {
64 .name = "scm_block", 75 .name = "scm_block",
65 .owner = THIS_MODULE, 76 .owner = THIS_MODULE,
66 }, 77 },
67 .notify = notify, 78 .notify = scm_notify,
68 .probe = scm_probe, 79 .probe = scm_probe,
69 .remove = scm_remove, 80 .remove = scm_remove,
70 .handler = scm_blk_irq, 81 .handler = scm_blk_irq,
diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c
index 30a2255389e5..cd798386b622 100644
--- a/drivers/s390/char/sclp_cmd.c
+++ b/drivers/s390/char/sclp_cmd.c
@@ -627,6 +627,8 @@ static int __init sclp_detect_standby_memory(void)
627 struct read_storage_sccb *sccb; 627 struct read_storage_sccb *sccb;
628 int i, id, assigned, rc; 628 int i, id, assigned, rc;
629 629
630 if (OLDMEM_BASE) /* No standby memory in kdump mode */
631 return 0;
630 if (!early_read_info_sccb_valid) 632 if (!early_read_info_sccb_valid)
631 return 0; 633 return 0;
632 if ((sclp_facilities & 0xe00000000000ULL) != 0xe00000000000ULL) 634 if ((sclp_facilities & 0xe00000000000ULL) != 0xe00000000000ULL)
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c
index 31ceef1beb8b..e16c553f6556 100644
--- a/drivers/s390/cio/chsc.c
+++ b/drivers/s390/cio/chsc.c
@@ -433,6 +433,20 @@ static void chsc_process_sei_scm_change(struct chsc_sei_nt0_area *sei_area)
433 " failed (rc=%d).\n", ret); 433 " failed (rc=%d).\n", ret);
434} 434}
435 435
436static void chsc_process_sei_scm_avail(struct chsc_sei_nt0_area *sei_area)
437{
438 int ret;
439
440 CIO_CRW_EVENT(4, "chsc: scm available information\n");
441 if (sei_area->rs != 7)
442 return;
443
444 ret = scm_process_availability_information();
445 if (ret)
446 CIO_CRW_EVENT(0, "chsc: process availability information"
447 " failed (rc=%d).\n", ret);
448}
449
436static void chsc_process_sei_nt2(struct chsc_sei_nt2_area *sei_area) 450static void chsc_process_sei_nt2(struct chsc_sei_nt2_area *sei_area)
437{ 451{
438 switch (sei_area->cc) { 452 switch (sei_area->cc) {
@@ -468,6 +482,9 @@ static void chsc_process_sei_nt0(struct chsc_sei_nt0_area *sei_area)
468 case 12: /* scm change notification */ 482 case 12: /* scm change notification */
469 chsc_process_sei_scm_change(sei_area); 483 chsc_process_sei_scm_change(sei_area);
470 break; 484 break;
485 case 14: /* scm available notification */
486 chsc_process_sei_scm_avail(sei_area);
487 break;
471 default: /* other stuff */ 488 default: /* other stuff */
472 CIO_CRW_EVENT(2, "chsc: sei nt0 unhandled cc=%d\n", 489 CIO_CRW_EVENT(2, "chsc: sei nt0 unhandled cc=%d\n",
473 sei_area->cc); 490 sei_area->cc);
diff --git a/drivers/s390/cio/chsc.h b/drivers/s390/cio/chsc.h
index 227e05f674b3..349d5fc47196 100644
--- a/drivers/s390/cio/chsc.h
+++ b/drivers/s390/cio/chsc.h
@@ -156,8 +156,10 @@ int chsc_scm_info(struct chsc_scm_info *scm_area, u64 token);
156 156
157#ifdef CONFIG_SCM_BUS 157#ifdef CONFIG_SCM_BUS
158int scm_update_information(void); 158int scm_update_information(void);
159int scm_process_availability_information(void);
159#else /* CONFIG_SCM_BUS */ 160#else /* CONFIG_SCM_BUS */
160static inline int scm_update_information(void) { return 0; } 161static inline int scm_update_information(void) { return 0; }
162static inline int scm_process_availability_information(void) { return 0; }
161#endif /* CONFIG_SCM_BUS */ 163#endif /* CONFIG_SCM_BUS */
162 164
163 165
diff --git a/drivers/s390/cio/scm.c b/drivers/s390/cio/scm.c
index bcf20f3aa51b..46ec25632e8b 100644
--- a/drivers/s390/cio/scm.c
+++ b/drivers/s390/cio/scm.c
@@ -211,7 +211,7 @@ static void scmdev_update(struct scm_device *scmdev, struct sale *sale)
211 goto out; 211 goto out;
212 scmdrv = to_scm_drv(scmdev->dev.driver); 212 scmdrv = to_scm_drv(scmdev->dev.driver);
213 if (changed && scmdrv->notify) 213 if (changed && scmdrv->notify)
214 scmdrv->notify(scmdev); 214 scmdrv->notify(scmdev, SCM_CHANGE);
215out: 215out:
216 device_unlock(&scmdev->dev); 216 device_unlock(&scmdev->dev);
217 if (changed) 217 if (changed)
@@ -297,6 +297,22 @@ int scm_update_information(void)
297 return ret; 297 return ret;
298} 298}
299 299
300static int scm_dev_avail(struct device *dev, void *unused)
301{
302 struct scm_driver *scmdrv = to_scm_drv(dev->driver);
303 struct scm_device *scmdev = to_scm_dev(dev);
304
305 if (dev->driver && scmdrv->notify)
306 scmdrv->notify(scmdev, SCM_AVAIL);
307
308 return 0;
309}
310
311int scm_process_availability_information(void)
312{
313 return bus_for_each_dev(&scm_bus_type, NULL, NULL, scm_dev_avail);
314}
315
300static int __init scm_init(void) 316static int __init scm_init(void)
301{ 317{
302 int ret; 318 int ret;
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h
index d87961d4c0de..8c0622399fcd 100644
--- a/drivers/s390/net/qeth_core.h
+++ b/drivers/s390/net/qeth_core.h
@@ -916,6 +916,7 @@ int qeth_send_control_data(struct qeth_card *, int, struct qeth_cmd_buffer *,
916 void *reply_param); 916 void *reply_param);
917int qeth_get_priority_queue(struct qeth_card *, struct sk_buff *, int, int); 917int qeth_get_priority_queue(struct qeth_card *, struct sk_buff *, int, int);
918int qeth_get_elements_no(struct qeth_card *, void *, struct sk_buff *, int); 918int qeth_get_elements_no(struct qeth_card *, void *, struct sk_buff *, int);
919int qeth_get_elements_for_frags(struct sk_buff *);
919int qeth_do_send_packet_fast(struct qeth_card *, struct qeth_qdio_out_q *, 920int qeth_do_send_packet_fast(struct qeth_card *, struct qeth_qdio_out_q *,
920 struct sk_buff *, struct qeth_hdr *, int, int, int); 921 struct sk_buff *, struct qeth_hdr *, int, int, int);
921int qeth_do_send_packet(struct qeth_card *, struct qeth_qdio_out_q *, 922int qeth_do_send_packet(struct qeth_card *, struct qeth_qdio_out_q *,
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 0d8cdff81813..0d73a999983d 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -3679,6 +3679,25 @@ int qeth_get_priority_queue(struct qeth_card *card, struct sk_buff *skb,
3679} 3679}
3680EXPORT_SYMBOL_GPL(qeth_get_priority_queue); 3680EXPORT_SYMBOL_GPL(qeth_get_priority_queue);
3681 3681
3682int qeth_get_elements_for_frags(struct sk_buff *skb)
3683{
3684 int cnt, length, e, elements = 0;
3685 struct skb_frag_struct *frag;
3686 char *data;
3687
3688 for (cnt = 0; cnt < skb_shinfo(skb)->nr_frags; cnt++) {
3689 frag = &skb_shinfo(skb)->frags[cnt];
3690 data = (char *)page_to_phys(skb_frag_page(frag)) +
3691 frag->page_offset;
3692 length = frag->size;
3693 e = PFN_UP((unsigned long)data + length - 1) -
3694 PFN_DOWN((unsigned long)data);
3695 elements += e;
3696 }
3697 return elements;
3698}
3699EXPORT_SYMBOL_GPL(qeth_get_elements_for_frags);
3700
3682int qeth_get_elements_no(struct qeth_card *card, void *hdr, 3701int qeth_get_elements_no(struct qeth_card *card, void *hdr,
3683 struct sk_buff *skb, int elems) 3702 struct sk_buff *skb, int elems)
3684{ 3703{
@@ -3686,7 +3705,8 @@ int qeth_get_elements_no(struct qeth_card *card, void *hdr,
3686 int elements_needed = PFN_UP((unsigned long)skb->data + dlen - 1) - 3705 int elements_needed = PFN_UP((unsigned long)skb->data + dlen - 1) -
3687 PFN_DOWN((unsigned long)skb->data); 3706 PFN_DOWN((unsigned long)skb->data);
3688 3707
3689 elements_needed += skb_shinfo(skb)->nr_frags; 3708 elements_needed += qeth_get_elements_for_frags(skb);
3709
3690 if ((elements_needed + elems) > QETH_MAX_BUFFER_ELEMENTS(card)) { 3710 if ((elements_needed + elems) > QETH_MAX_BUFFER_ELEMENTS(card)) {
3691 QETH_DBF_MESSAGE(2, "Invalid size of IP packet " 3711 QETH_DBF_MESSAGE(2, "Invalid size of IP packet "
3692 "(Number=%d / Length=%d). Discarded.\n", 3712 "(Number=%d / Length=%d). Discarded.\n",
@@ -3771,12 +3791,23 @@ static inline void __qeth_fill_buffer(struct sk_buff *skb,
3771 3791
3772 for (cnt = 0; cnt < skb_shinfo(skb)->nr_frags; cnt++) { 3792 for (cnt = 0; cnt < skb_shinfo(skb)->nr_frags; cnt++) {
3773 frag = &skb_shinfo(skb)->frags[cnt]; 3793 frag = &skb_shinfo(skb)->frags[cnt];
3774 buffer->element[element].addr = (char *) 3794 data = (char *)page_to_phys(skb_frag_page(frag)) +
3775 page_to_phys(skb_frag_page(frag)) 3795 frag->page_offset;
3776 + frag->page_offset; 3796 length = frag->size;
3777 buffer->element[element].length = frag->size; 3797 while (length > 0) {
3778 buffer->element[element].eflags = SBAL_EFLAGS_MIDDLE_FRAG; 3798 length_here = PAGE_SIZE -
3779 element++; 3799 ((unsigned long) data % PAGE_SIZE);
3800 if (length < length_here)
3801 length_here = length;
3802
3803 buffer->element[element].addr = data;
3804 buffer->element[element].length = length_here;
3805 buffer->element[element].eflags =
3806 SBAL_EFLAGS_MIDDLE_FRAG;
3807 length -= length_here;
3808 data += length_here;
3809 element++;
3810 }
3780 } 3811 }
3781 3812
3782 if (buffer->element[element - 1].eflags) 3813 if (buffer->element[element - 1].eflags)
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index 091ca0efa1c5..8710337dab3e 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -623,7 +623,7 @@ static int qeth_l3_send_setrouting(struct qeth_card *card,
623 return rc; 623 return rc;
624} 624}
625 625
626static void qeth_l3_correct_routing_type(struct qeth_card *card, 626static int qeth_l3_correct_routing_type(struct qeth_card *card,
627 enum qeth_routing_types *type, enum qeth_prot_versions prot) 627 enum qeth_routing_types *type, enum qeth_prot_versions prot)
628{ 628{
629 if (card->info.type == QETH_CARD_TYPE_IQD) { 629 if (card->info.type == QETH_CARD_TYPE_IQD) {
@@ -632,7 +632,7 @@ static void qeth_l3_correct_routing_type(struct qeth_card *card,
632 case PRIMARY_CONNECTOR: 632 case PRIMARY_CONNECTOR:
633 case SECONDARY_CONNECTOR: 633 case SECONDARY_CONNECTOR:
634 case MULTICAST_ROUTER: 634 case MULTICAST_ROUTER:
635 return; 635 return 0;
636 default: 636 default:
637 goto out_inval; 637 goto out_inval;
638 } 638 }
@@ -641,17 +641,18 @@ static void qeth_l3_correct_routing_type(struct qeth_card *card,
641 case NO_ROUTER: 641 case NO_ROUTER:
642 case PRIMARY_ROUTER: 642 case PRIMARY_ROUTER:
643 case SECONDARY_ROUTER: 643 case SECONDARY_ROUTER:
644 return; 644 return 0;
645 case MULTICAST_ROUTER: 645 case MULTICAST_ROUTER:
646 if (qeth_is_ipafunc_supported(card, prot, 646 if (qeth_is_ipafunc_supported(card, prot,
647 IPA_OSA_MC_ROUTER)) 647 IPA_OSA_MC_ROUTER))
648 return; 648 return 0;
649 default: 649 default:
650 goto out_inval; 650 goto out_inval;
651 } 651 }
652 } 652 }
653out_inval: 653out_inval:
654 *type = NO_ROUTER; 654 *type = NO_ROUTER;
655 return -EINVAL;
655} 656}
656 657
657int qeth_l3_setrouting_v4(struct qeth_card *card) 658int qeth_l3_setrouting_v4(struct qeth_card *card)
@@ -660,8 +661,10 @@ int qeth_l3_setrouting_v4(struct qeth_card *card)
660 661
661 QETH_CARD_TEXT(card, 3, "setrtg4"); 662 QETH_CARD_TEXT(card, 3, "setrtg4");
662 663
663 qeth_l3_correct_routing_type(card, &card->options.route4.type, 664 rc = qeth_l3_correct_routing_type(card, &card->options.route4.type,
664 QETH_PROT_IPV4); 665 QETH_PROT_IPV4);
666 if (rc)
667 return rc;
665 668
666 rc = qeth_l3_send_setrouting(card, card->options.route4.type, 669 rc = qeth_l3_send_setrouting(card, card->options.route4.type,
667 QETH_PROT_IPV4); 670 QETH_PROT_IPV4);
@@ -683,8 +686,10 @@ int qeth_l3_setrouting_v6(struct qeth_card *card)
683 686
684 if (!qeth_is_supported(card, IPA_IPV6)) 687 if (!qeth_is_supported(card, IPA_IPV6))
685 return 0; 688 return 0;
686 qeth_l3_correct_routing_type(card, &card->options.route6.type, 689 rc = qeth_l3_correct_routing_type(card, &card->options.route6.type,
687 QETH_PROT_IPV6); 690 QETH_PROT_IPV6);
691 if (rc)
692 return rc;
688 693
689 rc = qeth_l3_send_setrouting(card, card->options.route6.type, 694 rc = qeth_l3_send_setrouting(card, card->options.route6.type,
690 QETH_PROT_IPV6); 695 QETH_PROT_IPV6);
@@ -2898,7 +2903,9 @@ static inline int qeth_l3_tso_elements(struct sk_buff *skb)
2898 tcp_hdr(skb)->doff * 4; 2903 tcp_hdr(skb)->doff * 4;
2899 int tcpd_len = skb->len - (tcpd - (unsigned long)skb->data); 2904 int tcpd_len = skb->len - (tcpd - (unsigned long)skb->data);
2900 int elements = PFN_UP(tcpd + tcpd_len - 1) - PFN_DOWN(tcpd); 2905 int elements = PFN_UP(tcpd + tcpd_len - 1) - PFN_DOWN(tcpd);
2901 elements += skb_shinfo(skb)->nr_frags; 2906
2907 elements += qeth_get_elements_for_frags(skb);
2908
2902 return elements; 2909 return elements;
2903} 2910}
2904 2911
@@ -3348,7 +3355,6 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode)
3348 rc = -ENODEV; 3355 rc = -ENODEV;
3349 goto out_remove; 3356 goto out_remove;
3350 } 3357 }
3351 qeth_trace_features(card);
3352 3358
3353 if (!card->dev && qeth_l3_setup_netdev(card)) { 3359 if (!card->dev && qeth_l3_setup_netdev(card)) {
3354 rc = -ENODEV; 3360 rc = -ENODEV;
@@ -3425,6 +3431,7 @@ contin:
3425 qeth_l3_set_multicast_list(card->dev); 3431 qeth_l3_set_multicast_list(card->dev);
3426 rtnl_unlock(); 3432 rtnl_unlock();
3427 } 3433 }
3434 qeth_trace_features(card);
3428 /* let user_space know that device is online */ 3435 /* let user_space know that device is online */
3429 kobject_uevent(&gdev->dev.kobj, KOBJ_CHANGE); 3436 kobject_uevent(&gdev->dev.kobj, KOBJ_CHANGE);
3430 mutex_unlock(&card->conf_mutex); 3437 mutex_unlock(&card->conf_mutex);
diff --git a/drivers/s390/net/qeth_l3_sys.c b/drivers/s390/net/qeth_l3_sys.c
index ebc379486267..e70af2406ff9 100644
--- a/drivers/s390/net/qeth_l3_sys.c
+++ b/drivers/s390/net/qeth_l3_sys.c
@@ -87,6 +87,8 @@ static ssize_t qeth_l3_dev_route_store(struct qeth_card *card,
87 rc = qeth_l3_setrouting_v6(card); 87 rc = qeth_l3_setrouting_v6(card);
88 } 88 }
89out: 89out:
90 if (rc)
91 route->type = old_route_type;
90 mutex_unlock(&card->conf_mutex); 92 mutex_unlock(&card->conf_mutex);
91 return rc ? rc : count; 93 return rc ? rc : count;
92} 94}
diff --git a/drivers/staging/comedi/drivers/dt9812.c b/drivers/staging/comedi/drivers/dt9812.c
index 192cf088f834..57b451904791 100644
--- a/drivers/staging/comedi/drivers/dt9812.c
+++ b/drivers/staging/comedi/drivers/dt9812.c
@@ -947,12 +947,13 @@ static int dt9812_di_rinsn(struct comedi_device *dev,
947 unsigned int *data) 947 unsigned int *data)
948{ 948{
949 struct comedi_dt9812 *devpriv = dev->private; 949 struct comedi_dt9812 *devpriv = dev->private;
950 unsigned int channel = CR_CHAN(insn->chanspec);
950 int n; 951 int n;
951 u8 bits = 0; 952 u8 bits = 0;
952 953
953 dt9812_digital_in(devpriv->slot, &bits); 954 dt9812_digital_in(devpriv->slot, &bits);
954 for (n = 0; n < insn->n; n++) 955 for (n = 0; n < insn->n; n++)
955 data[n] = ((1 << insn->chanspec) & bits) != 0; 956 data[n] = ((1 << channel) & bits) != 0;
956 return n; 957 return n;
957} 958}
958 959
@@ -961,12 +962,13 @@ static int dt9812_do_winsn(struct comedi_device *dev,
961 unsigned int *data) 962 unsigned int *data)
962{ 963{
963 struct comedi_dt9812 *devpriv = dev->private; 964 struct comedi_dt9812 *devpriv = dev->private;
965 unsigned int channel = CR_CHAN(insn->chanspec);
964 int n; 966 int n;
965 u8 bits = 0; 967 u8 bits = 0;
966 968
967 dt9812_digital_out_shadow(devpriv->slot, &bits); 969 dt9812_digital_out_shadow(devpriv->slot, &bits);
968 for (n = 0; n < insn->n; n++) { 970 for (n = 0; n < insn->n; n++) {
969 u8 mask = 1 << insn->chanspec; 971 u8 mask = 1 << channel;
970 972
971 bits &= ~mask; 973 bits &= ~mask;
972 if (data[n]) 974 if (data[n])
@@ -981,13 +983,13 @@ static int dt9812_ai_rinsn(struct comedi_device *dev,
981 unsigned int *data) 983 unsigned int *data)
982{ 984{
983 struct comedi_dt9812 *devpriv = dev->private; 985 struct comedi_dt9812 *devpriv = dev->private;
986 unsigned int channel = CR_CHAN(insn->chanspec);
984 int n; 987 int n;
985 988
986 for (n = 0; n < insn->n; n++) { 989 for (n = 0; n < insn->n; n++) {
987 u16 value = 0; 990 u16 value = 0;
988 991
989 dt9812_analog_in(devpriv->slot, insn->chanspec, &value, 992 dt9812_analog_in(devpriv->slot, channel, &value, DT9812_GAIN_1);
990 DT9812_GAIN_1);
991 data[n] = value; 993 data[n] = value;
992 } 994 }
993 return n; 995 return n;
@@ -998,12 +1000,13 @@ static int dt9812_ao_rinsn(struct comedi_device *dev,
998 unsigned int *data) 1000 unsigned int *data)
999{ 1001{
1000 struct comedi_dt9812 *devpriv = dev->private; 1002 struct comedi_dt9812 *devpriv = dev->private;
1003 unsigned int channel = CR_CHAN(insn->chanspec);
1001 int n; 1004 int n;
1002 u16 value; 1005 u16 value;
1003 1006
1004 for (n = 0; n < insn->n; n++) { 1007 for (n = 0; n < insn->n; n++) {
1005 value = 0; 1008 value = 0;
1006 dt9812_analog_out_shadow(devpriv->slot, insn->chanspec, &value); 1009 dt9812_analog_out_shadow(devpriv->slot, channel, &value);
1007 data[n] = value; 1010 data[n] = value;
1008 } 1011 }
1009 return n; 1012 return n;
@@ -1014,10 +1017,11 @@ static int dt9812_ao_winsn(struct comedi_device *dev,
1014 unsigned int *data) 1017 unsigned int *data)
1015{ 1018{
1016 struct comedi_dt9812 *devpriv = dev->private; 1019 struct comedi_dt9812 *devpriv = dev->private;
1020 unsigned int channel = CR_CHAN(insn->chanspec);
1017 int n; 1021 int n;
1018 1022
1019 for (n = 0; n < insn->n; n++) 1023 for (n = 0; n < insn->n; n++)
1020 dt9812_analog_out(devpriv->slot, insn->chanspec, data[n]); 1024 dt9812_analog_out(devpriv->slot, channel, data[n]);
1021 return n; 1025 return n;
1022} 1026}
1023 1027
diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c
index 1a0062a04456..6aac1f60bc42 100644
--- a/drivers/staging/comedi/drivers/usbdux.c
+++ b/drivers/staging/comedi/drivers/usbdux.c
@@ -730,10 +730,14 @@ static void usbduxsub_ao_IsocIrq(struct urb *urb)
730static int usbduxsub_start(struct usbduxsub *usbduxsub) 730static int usbduxsub_start(struct usbduxsub *usbduxsub)
731{ 731{
732 int errcode = 0; 732 int errcode = 0;
733 uint8_t local_transfer_buffer[16]; 733 uint8_t *local_transfer_buffer;
734
735 local_transfer_buffer = kmalloc(1, GFP_KERNEL);
736 if (!local_transfer_buffer)
737 return -ENOMEM;
734 738
735 /* 7f92 to zero */ 739 /* 7f92 to zero */
736 local_transfer_buffer[0] = 0; 740 *local_transfer_buffer = 0;
737 errcode = usb_control_msg(usbduxsub->usbdev, 741 errcode = usb_control_msg(usbduxsub->usbdev,
738 /* create a pipe for a control transfer */ 742 /* create a pipe for a control transfer */
739 usb_sndctrlpipe(usbduxsub->usbdev, 0), 743 usb_sndctrlpipe(usbduxsub->usbdev, 0),
@@ -751,22 +755,25 @@ static int usbduxsub_start(struct usbduxsub *usbduxsub)
751 1, 755 1,
752 /* Timeout */ 756 /* Timeout */
753 BULK_TIMEOUT); 757 BULK_TIMEOUT);
754 if (errcode < 0) { 758 if (errcode < 0)
755 dev_err(&usbduxsub->interface->dev, 759 dev_err(&usbduxsub->interface->dev,
756 "comedi_: control msg failed (start)\n"); 760 "comedi_: control msg failed (start)\n");
757 return errcode; 761
758 } 762 kfree(local_transfer_buffer);
759 return 0; 763 return errcode;
760} 764}
761 765
762static int usbduxsub_stop(struct usbduxsub *usbduxsub) 766static int usbduxsub_stop(struct usbduxsub *usbduxsub)
763{ 767{
764 int errcode = 0; 768 int errcode = 0;
769 uint8_t *local_transfer_buffer;
765 770
766 uint8_t local_transfer_buffer[16]; 771 local_transfer_buffer = kmalloc(1, GFP_KERNEL);
772 if (!local_transfer_buffer)
773 return -ENOMEM;
767 774
768 /* 7f92 to one */ 775 /* 7f92 to one */
769 local_transfer_buffer[0] = 1; 776 *local_transfer_buffer = 1;
770 errcode = usb_control_msg(usbduxsub->usbdev, 777 errcode = usb_control_msg(usbduxsub->usbdev,
771 usb_sndctrlpipe(usbduxsub->usbdev, 0), 778 usb_sndctrlpipe(usbduxsub->usbdev, 0),
772 /* bRequest, "Firmware" */ 779 /* bRequest, "Firmware" */
@@ -781,12 +788,12 @@ static int usbduxsub_stop(struct usbduxsub *usbduxsub)
781 1, 788 1,
782 /* Timeout */ 789 /* Timeout */
783 BULK_TIMEOUT); 790 BULK_TIMEOUT);
784 if (errcode < 0) { 791 if (errcode < 0)
785 dev_err(&usbduxsub->interface->dev, 792 dev_err(&usbduxsub->interface->dev,
786 "comedi_: control msg failed (stop)\n"); 793 "comedi_: control msg failed (stop)\n");
787 return errcode; 794
788 } 795 kfree(local_transfer_buffer);
789 return 0; 796 return errcode;
790} 797}
791 798
792static int usbduxsub_upload(struct usbduxsub *usbduxsub, 799static int usbduxsub_upload(struct usbduxsub *usbduxsub,
diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c
index 4bf5dd094dc9..1ba0e3df492d 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -436,10 +436,14 @@ static void usbduxfastsub_ai_Irq(struct urb *urb)
436static int usbduxfastsub_start(struct usbduxfastsub_s *udfs) 436static int usbduxfastsub_start(struct usbduxfastsub_s *udfs)
437{ 437{
438 int ret; 438 int ret;
439 unsigned char local_transfer_buffer[16]; 439 unsigned char *local_transfer_buffer;
440
441 local_transfer_buffer = kmalloc(1, GFP_KERNEL);
442 if (!local_transfer_buffer)
443 return -ENOMEM;
440 444
441 /* 7f92 to zero */ 445 /* 7f92 to zero */
442 local_transfer_buffer[0] = 0; 446 *local_transfer_buffer = 0;
443 /* bRequest, "Firmware" */ 447 /* bRequest, "Firmware" */
444 ret = usb_control_msg(udfs->usbdev, usb_sndctrlpipe(udfs->usbdev, 0), 448 ret = usb_control_msg(udfs->usbdev, usb_sndctrlpipe(udfs->usbdev, 0),
445 USBDUXFASTSUB_FIRMWARE, 449 USBDUXFASTSUB_FIRMWARE,
@@ -450,22 +454,25 @@ static int usbduxfastsub_start(struct usbduxfastsub_s *udfs)
450 local_transfer_buffer, 454 local_transfer_buffer,
451 1, /* Length */ 455 1, /* Length */
452 EZTIMEOUT); /* Timeout */ 456 EZTIMEOUT); /* Timeout */
453 if (ret < 0) { 457 if (ret < 0)
454 dev_err(&udfs->interface->dev, 458 dev_err(&udfs->interface->dev,
455 "control msg failed (start)\n"); 459 "control msg failed (start)\n");
456 return ret;
457 }
458 460
459 return 0; 461 kfree(local_transfer_buffer);
462 return ret;
460} 463}
461 464
462static int usbduxfastsub_stop(struct usbduxfastsub_s *udfs) 465static int usbduxfastsub_stop(struct usbduxfastsub_s *udfs)
463{ 466{
464 int ret; 467 int ret;
465 unsigned char local_transfer_buffer[16]; 468 unsigned char *local_transfer_buffer;
469
470 local_transfer_buffer = kmalloc(1, GFP_KERNEL);
471 if (!local_transfer_buffer)
472 return -ENOMEM;
466 473
467 /* 7f92 to one */ 474 /* 7f92 to one */
468 local_transfer_buffer[0] = 1; 475 *local_transfer_buffer = 1;
469 /* bRequest, "Firmware" */ 476 /* bRequest, "Firmware" */
470 ret = usb_control_msg(udfs->usbdev, usb_sndctrlpipe(udfs->usbdev, 0), 477 ret = usb_control_msg(udfs->usbdev, usb_sndctrlpipe(udfs->usbdev, 0),
471 USBDUXFASTSUB_FIRMWARE, 478 USBDUXFASTSUB_FIRMWARE,
@@ -474,13 +481,12 @@ static int usbduxfastsub_stop(struct usbduxfastsub_s *udfs)
474 0x0000, /* Index */ 481 0x0000, /* Index */
475 local_transfer_buffer, 1, /* Length */ 482 local_transfer_buffer, 1, /* Length */
476 EZTIMEOUT); /* Timeout */ 483 EZTIMEOUT); /* Timeout */
477 if (ret < 0) { 484 if (ret < 0)
478 dev_err(&udfs->interface->dev, 485 dev_err(&udfs->interface->dev,
479 "control msg failed (stop)\n"); 486 "control msg failed (stop)\n");
480 return ret;
481 }
482 487
483 return 0; 488 kfree(local_transfer_buffer);
489 return ret;
484} 490}
485 491
486static int usbduxfastsub_upload(struct usbduxfastsub_s *udfs, 492static int usbduxfastsub_upload(struct usbduxfastsub_s *udfs,
diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c
index d066351a71b2..a728c8fc32a2 100644
--- a/drivers/staging/comedi/drivers/usbduxsigma.c
+++ b/drivers/staging/comedi/drivers/usbduxsigma.c
@@ -681,7 +681,11 @@ static void usbduxsub_ao_IsocIrq(struct urb *urb)
681static int usbduxsub_start(struct usbduxsub *usbduxsub) 681static int usbduxsub_start(struct usbduxsub *usbduxsub)
682{ 682{
683 int errcode = 0; 683 int errcode = 0;
684 uint8_t local_transfer_buffer[16]; 684 uint8_t *local_transfer_buffer;
685
686 local_transfer_buffer = kmalloc(16, GFP_KERNEL);
687 if (!local_transfer_buffer)
688 return -ENOMEM;
685 689
686 /* 7f92 to zero */ 690 /* 7f92 to zero */
687 local_transfer_buffer[0] = 0; 691 local_transfer_buffer[0] = 0;
@@ -702,19 +706,22 @@ static int usbduxsub_start(struct usbduxsub *usbduxsub)
702 1, 706 1,
703 /* Timeout */ 707 /* Timeout */
704 BULK_TIMEOUT); 708 BULK_TIMEOUT);
705 if (errcode < 0) { 709 if (errcode < 0)
706 dev_err(&usbduxsub->interface->dev, 710 dev_err(&usbduxsub->interface->dev,
707 "comedi_: control msg failed (start)\n"); 711 "comedi_: control msg failed (start)\n");
708 return errcode; 712
709 } 713 kfree(local_transfer_buffer);
710 return 0; 714 return errcode;
711} 715}
712 716
713static int usbduxsub_stop(struct usbduxsub *usbduxsub) 717static int usbduxsub_stop(struct usbduxsub *usbduxsub)
714{ 718{
715 int errcode = 0; 719 int errcode = 0;
720 uint8_t *local_transfer_buffer;
716 721
717 uint8_t local_transfer_buffer[16]; 722 local_transfer_buffer = kmalloc(16, GFP_KERNEL);
723 if (!local_transfer_buffer)
724 return -ENOMEM;
718 725
719 /* 7f92 to one */ 726 /* 7f92 to one */
720 local_transfer_buffer[0] = 1; 727 local_transfer_buffer[0] = 1;
@@ -732,12 +739,12 @@ static int usbduxsub_stop(struct usbduxsub *usbduxsub)
732 1, 739 1,
733 /* Timeout */ 740 /* Timeout */
734 BULK_TIMEOUT); 741 BULK_TIMEOUT);
735 if (errcode < 0) { 742 if (errcode < 0)
736 dev_err(&usbduxsub->interface->dev, 743 dev_err(&usbduxsub->interface->dev,
737 "comedi_: control msg failed (stop)\n"); 744 "comedi_: control msg failed (stop)\n");
738 return errcode; 745
739 } 746 kfree(local_transfer_buffer);
740 return 0; 747 return errcode;
741} 748}
742 749
743static int usbduxsub_upload(struct usbduxsub *usbduxsub, 750static int usbduxsub_upload(struct usbduxsub *usbduxsub,
diff --git a/drivers/staging/imx-drm/ipuv3-crtc.c b/drivers/staging/imx-drm/ipuv3-crtc.c
index 4b3a019409b5..b028b0d1317b 100644
--- a/drivers/staging/imx-drm/ipuv3-crtc.c
+++ b/drivers/staging/imx-drm/ipuv3-crtc.c
@@ -483,17 +483,6 @@ static int ipu_get_resources(struct ipu_crtc *ipu_crtc,
483 goto err_out; 483 goto err_out;
484 } 484 }
485 485
486 ipu_crtc->irq = ipu_idmac_channel_irq(ipu, ipu_crtc->ipu_ch,
487 IPU_IRQ_EOF);
488 ret = devm_request_irq(ipu_crtc->dev, ipu_crtc->irq, ipu_irq_handler, 0,
489 "imx_drm", ipu_crtc);
490 if (ret < 0) {
491 dev_err(ipu_crtc->dev, "irq request failed with %d.\n", ret);
492 goto err_out;
493 }
494
495 disable_irq(ipu_crtc->irq);
496
497 return 0; 486 return 0;
498err_out: 487err_out:
499 ipu_put_resources(ipu_crtc); 488 ipu_put_resources(ipu_crtc);
@@ -504,6 +493,7 @@ err_out:
504static int ipu_crtc_init(struct ipu_crtc *ipu_crtc, 493static int ipu_crtc_init(struct ipu_crtc *ipu_crtc,
505 struct ipu_client_platformdata *pdata) 494 struct ipu_client_platformdata *pdata)
506{ 495{
496 struct ipu_soc *ipu = dev_get_drvdata(ipu_crtc->dev->parent);
507 int ret; 497 int ret;
508 498
509 ret = ipu_get_resources(ipu_crtc, pdata); 499 ret = ipu_get_resources(ipu_crtc, pdata);
@@ -522,6 +512,17 @@ static int ipu_crtc_init(struct ipu_crtc *ipu_crtc,
522 goto err_put_resources; 512 goto err_put_resources;
523 } 513 }
524 514
515 ipu_crtc->irq = ipu_idmac_channel_irq(ipu, ipu_crtc->ipu_ch,
516 IPU_IRQ_EOF);
517 ret = devm_request_irq(ipu_crtc->dev, ipu_crtc->irq, ipu_irq_handler, 0,
518 "imx_drm", ipu_crtc);
519 if (ret < 0) {
520 dev_err(ipu_crtc->dev, "irq request failed with %d.\n", ret);
521 goto err_put_resources;
522 }
523
524 disable_irq(ipu_crtc->irq);
525
525 return 0; 526 return 0;
526 527
527err_put_resources: 528err_put_resources:
diff --git a/drivers/staging/tidspbridge/rmgr/drv.c b/drivers/staging/tidspbridge/rmgr/drv.c
index db1da28cecba..be26917a6896 100644
--- a/drivers/staging/tidspbridge/rmgr/drv.c
+++ b/drivers/staging/tidspbridge/rmgr/drv.c
@@ -76,37 +76,28 @@ int drv_insert_node_res_element(void *hnode, void *node_resource,
76 struct node_res_object **node_res_obj = 76 struct node_res_object **node_res_obj =
77 (struct node_res_object **)node_resource; 77 (struct node_res_object **)node_resource;
78 struct process_context *ctxt = (struct process_context *)process_ctxt; 78 struct process_context *ctxt = (struct process_context *)process_ctxt;
79 int status = 0;
80 int retval; 79 int retval;
81 80
82 *node_res_obj = kzalloc(sizeof(struct node_res_object), GFP_KERNEL); 81 *node_res_obj = kzalloc(sizeof(struct node_res_object), GFP_KERNEL);
83 if (!*node_res_obj) { 82 if (!*node_res_obj)
84 status = -ENOMEM; 83 return -ENOMEM;
85 goto func_end;
86 }
87 84
88 (*node_res_obj)->node = hnode; 85 (*node_res_obj)->node = hnode;
89 retval = idr_get_new(ctxt->node_id, *node_res_obj, 86 retval = idr_alloc(ctxt->node_id, *node_res_obj, 0, 0, GFP_KERNEL);
90 &(*node_res_obj)->id); 87 if (retval >= 0) {
91 if (retval == -EAGAIN) { 88 (*node_res_obj)->id = retval;
92 if (!idr_pre_get(ctxt->node_id, GFP_KERNEL)) { 89 return 0;
93 pr_err("%s: OUT OF MEMORY\n", __func__);
94 status = -ENOMEM;
95 goto func_end;
96 }
97
98 retval = idr_get_new(ctxt->node_id, *node_res_obj,
99 &(*node_res_obj)->id);
100 } 90 }
101 if (retval) { 91
92 kfree(*node_res_obj);
93
94 if (retval == -ENOSPC) {
102 pr_err("%s: FAILED, IDR is FULL\n", __func__); 95 pr_err("%s: FAILED, IDR is FULL\n", __func__);
103 status = -EFAULT; 96 return -EFAULT;
97 } else {
98 pr_err("%s: OUT OF MEMORY\n", __func__);
99 return -ENOMEM;
104 } 100 }
105func_end:
106 if (status)
107 kfree(*node_res_obj);
108
109 return status;
110} 101}
111 102
112/* Release all Node resources and its context 103/* Release all Node resources and its context
@@ -201,35 +192,26 @@ int drv_proc_insert_strm_res_element(void *stream_obj,
201 struct strm_res_object **pstrm_res = 192 struct strm_res_object **pstrm_res =
202 (struct strm_res_object **)strm_res; 193 (struct strm_res_object **)strm_res;
203 struct process_context *ctxt = (struct process_context *)process_ctxt; 194 struct process_context *ctxt = (struct process_context *)process_ctxt;
204 int status = 0;
205 int retval; 195 int retval;
206 196
207 *pstrm_res = kzalloc(sizeof(struct strm_res_object), GFP_KERNEL); 197 *pstrm_res = kzalloc(sizeof(struct strm_res_object), GFP_KERNEL);
208 if (*pstrm_res == NULL) { 198 if (*pstrm_res == NULL)
209 status = -EFAULT; 199 return -EFAULT;
210 goto func_end;
211 }
212 200
213 (*pstrm_res)->stream = stream_obj; 201 (*pstrm_res)->stream = stream_obj;
214 retval = idr_get_new(ctxt->stream_id, *pstrm_res, 202 retval = idr_alloc(ctxt->stream_id, *pstrm_res, 0, 0, GFP_KERNEL);
215 &(*pstrm_res)->id); 203 if (retval >= 0) {
216 if (retval == -EAGAIN) { 204 (*pstrm_res)->id = retval;
217 if (!idr_pre_get(ctxt->stream_id, GFP_KERNEL)) { 205 return 0;
218 pr_err("%s: OUT OF MEMORY\n", __func__);
219 status = -ENOMEM;
220 goto func_end;
221 }
222
223 retval = idr_get_new(ctxt->stream_id, *pstrm_res,
224 &(*pstrm_res)->id);
225 } 206 }
226 if (retval) { 207
208 if (retval == -ENOSPC) {
227 pr_err("%s: FAILED, IDR is FULL\n", __func__); 209 pr_err("%s: FAILED, IDR is FULL\n", __func__);
228 status = -EPERM; 210 return -EPERM;
211 } else {
212 pr_err("%s: OUT OF MEMORY\n", __func__);
213 return -ENOMEM;
229 } 214 }
230
231func_end:
232 return status;
233} 215}
234 216
235static int drv_proc_free_strm_res(int id, void *p, void *process_ctxt) 217static int drv_proc_free_strm_res(int id, void *p, void *process_ctxt)
diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c
index 22918a106d73..d2479b766450 100644
--- a/drivers/staging/vt6656/card.c
+++ b/drivers/staging/vt6656/card.c
@@ -790,7 +790,7 @@ u64 CARDqGetNextTBTT(u64 qwTSF, WORD wBeaconInterval)
790 if ((~uLowNextTBTT) < uLowRemain) 790 if ((~uLowNextTBTT) < uLowRemain)
791 qwTSF = ((qwTSF >> 32) + 1) << 32; 791 qwTSF = ((qwTSF >> 32) + 1) << 32;
792 792
793 qwTSF = (qwTSF & 0xffffffff00000000UL) | 793 qwTSF = (qwTSF & 0xffffffff00000000ULL) |
794 (u64)(uLowNextTBTT + uLowRemain); 794 (u64)(uLowNextTBTT + uLowRemain);
795 795
796 return (qwTSF); 796 return (qwTSF);
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index d5f53e1a74a2..a5063a6f64d9 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -669,8 +669,6 @@ static int vt6656_suspend(struct usb_interface *intf, pm_message_t message)
669 if (device->flags & DEVICE_FLAGS_OPENED) 669 if (device->flags & DEVICE_FLAGS_OPENED)
670 device_close(device->dev); 670 device_close(device->dev);
671 671
672 usb_put_dev(interface_to_usbdev(intf));
673
674 return 0; 672 return 0;
675} 673}
676 674
@@ -681,8 +679,6 @@ static int vt6656_resume(struct usb_interface *intf)
681 if (!device || !device->dev) 679 if (!device || !device->dev)
682 return -ENODEV; 680 return -ENODEV;
683 681
684 usb_get_dev(interface_to_usbdev(intf));
685
686 if (!(device->flags & DEVICE_FLAGS_OPENED)) 682 if (!(device->flags & DEVICE_FLAGS_OPENED))
687 device_open(device->dev); 683 device_open(device->dev);
688 684
diff --git a/drivers/staging/zcache/ramster/tcp.c b/drivers/staging/zcache/ramster/tcp.c
index aa2a1a763aa4..f6e1e5209d88 100644
--- a/drivers/staging/zcache/ramster/tcp.c
+++ b/drivers/staging/zcache/ramster/tcp.c
@@ -300,27 +300,22 @@ static u8 r2net_num_from_nn(struct r2net_node *nn)
300 300
301static int r2net_prep_nsw(struct r2net_node *nn, struct r2net_status_wait *nsw) 301static int r2net_prep_nsw(struct r2net_node *nn, struct r2net_status_wait *nsw)
302{ 302{
303 int ret = 0; 303 int ret;
304 304
305 do { 305 spin_lock(&nn->nn_lock);
306 if (!idr_pre_get(&nn->nn_status_idr, GFP_ATOMIC)) { 306 ret = idr_alloc(&nn->nn_status_idr, nsw, 0, 0, GFP_ATOMIC);
307 ret = -EAGAIN; 307 if (ret >= 0) {
308 break; 308 nsw->ns_id = ret;
309 } 309 list_add_tail(&nsw->ns_node_item, &nn->nn_status_list);
310 spin_lock(&nn->nn_lock); 310 }
311 ret = idr_get_new(&nn->nn_status_idr, nsw, &nsw->ns_id); 311 spin_unlock(&nn->nn_lock);
312 if (ret == 0)
313 list_add_tail(&nsw->ns_node_item,
314 &nn->nn_status_list);
315 spin_unlock(&nn->nn_lock);
316 } while (ret == -EAGAIN);
317 312
318 if (ret == 0) { 313 if (ret >= 0) {
319 init_waitqueue_head(&nsw->ns_wq); 314 init_waitqueue_head(&nsw->ns_wq);
320 nsw->ns_sys_status = R2NET_ERR_NONE; 315 nsw->ns_sys_status = R2NET_ERR_NONE;
321 nsw->ns_status = 0; 316 nsw->ns_status = 0;
317 return 0;
322 } 318 }
323
324 return ret; 319 return ret;
325} 320}
326 321
diff --git a/drivers/tty/serial/8250/8250.c b/drivers/tty/serial/8250/8250.c
index 0efc815a4968..cf6a5383748a 100644
--- a/drivers/tty/serial/8250/8250.c
+++ b/drivers/tty/serial/8250/8250.c
@@ -301,7 +301,28 @@ static const struct serial8250_config uart_config[] = {
301 }, 301 },
302 [PORT_8250_CIR] = { 302 [PORT_8250_CIR] = {
303 .name = "CIR port" 303 .name = "CIR port"
304 } 304 },
305 [PORT_ALTR_16550_F32] = {
306 .name = "Altera 16550 FIFO32",
307 .fifo_size = 32,
308 .tx_loadsz = 32,
309 .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10,
310 .flags = UART_CAP_FIFO | UART_CAP_AFE,
311 },
312 [PORT_ALTR_16550_F64] = {
313 .name = "Altera 16550 FIFO64",
314 .fifo_size = 64,
315 .tx_loadsz = 64,
316 .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10,
317 .flags = UART_CAP_FIFO | UART_CAP_AFE,
318 },
319 [PORT_ALTR_16550_F128] = {
320 .name = "Altera 16550 FIFO128",
321 .fifo_size = 128,
322 .tx_loadsz = 128,
323 .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10,
324 .flags = UART_CAP_FIFO | UART_CAP_AFE,
325 },
305}; 326};
306 327
307/* Uart divisor latch read */ 328/* Uart divisor latch read */
@@ -3396,3 +3417,32 @@ module_param_array(probe_rsa, ulong, &probe_rsa_count, 0444);
3396MODULE_PARM_DESC(probe_rsa, "Probe I/O ports for RSA"); 3417MODULE_PARM_DESC(probe_rsa, "Probe I/O ports for RSA");
3397#endif 3418#endif
3398MODULE_ALIAS_CHARDEV_MAJOR(TTY_MAJOR); 3419MODULE_ALIAS_CHARDEV_MAJOR(TTY_MAJOR);
3420
3421#ifndef MODULE
3422/* This module was renamed to 8250_core in 3.7. Keep the old "8250" name
3423 * working as well for the module options so we don't break people. We
3424 * need to keep the names identical and the convenient macros will happily
3425 * refuse to let us do that by failing the build with redefinition errors
3426 * of global variables. So we stick them inside a dummy function to avoid
3427 * those conflicts. The options still get parsed, and the redefined
3428 * MODULE_PARAM_PREFIX lets us keep the "8250." syntax alive.
3429 *
3430 * This is hacky. I'm sorry.
3431 */
3432static void __used s8250_options(void)
3433{
3434#undef MODULE_PARAM_PREFIX
3435#define MODULE_PARAM_PREFIX "8250."
3436
3437 module_param_cb(share_irqs, &param_ops_uint, &share_irqs, 0644);
3438 module_param_cb(nr_uarts, &param_ops_uint, &nr_uarts, 0644);
3439 module_param_cb(skip_txen_test, &param_ops_uint, &skip_txen_test, 0644);
3440#ifdef CONFIG_SERIAL_8250_RSA
3441 __module_param_call(MODULE_PARAM_PREFIX, probe_rsa,
3442 &param_array_ops, .arr = &__param_arr_probe_rsa,
3443 0444, -1);
3444#endif
3445}
3446#else
3447MODULE_ALIAS("8250");
3448#endif
diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
index 791c5a77ec61..aa76825229dc 100644
--- a/drivers/tty/serial/8250/8250_pci.c
+++ b/drivers/tty/serial/8250/8250_pci.c
@@ -1571,6 +1571,7 @@ pci_wch_ch353_setup(struct serial_private *priv,
1571 1571
1572/* Unknown vendors/cards - this should not be in linux/pci_ids.h */ 1572/* Unknown vendors/cards - this should not be in linux/pci_ids.h */
1573#define PCI_SUBDEVICE_ID_UNKNOWN_0x1584 0x1584 1573#define PCI_SUBDEVICE_ID_UNKNOWN_0x1584 0x1584
1574#define PCI_SUBDEVICE_ID_UNKNOWN_0x1588 0x1588
1574 1575
1575/* 1576/*
1576 * Master list of serial port init/setup/exit quirks. 1577 * Master list of serial port init/setup/exit quirks.
@@ -1852,15 +1853,6 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
1852 }, 1853 },
1853 { 1854 {
1854 .vendor = PCI_VENDOR_ID_PLX, 1855 .vendor = PCI_VENDOR_ID_PLX,
1855 .device = PCI_DEVICE_ID_PLX_9050,
1856 .subvendor = PCI_VENDOR_ID_PLX,
1857 .subdevice = PCI_SUBDEVICE_ID_UNKNOWN_0x1584,
1858 .init = pci_plx9050_init,
1859 .setup = pci_default_setup,
1860 .exit = pci_plx9050_exit,
1861 },
1862 {
1863 .vendor = PCI_VENDOR_ID_PLX,
1864 .device = PCI_DEVICE_ID_PLX_ROMULUS, 1856 .device = PCI_DEVICE_ID_PLX_ROMULUS,
1865 .subvendor = PCI_VENDOR_ID_PLX, 1857 .subvendor = PCI_VENDOR_ID_PLX,
1866 .subdevice = PCI_DEVICE_ID_PLX_ROMULUS, 1858 .subdevice = PCI_DEVICE_ID_PLX_ROMULUS,
@@ -3733,7 +3725,12 @@ static struct pci_device_id serial_pci_tbl[] = {
3733 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, 3725 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
3734 PCI_VENDOR_ID_PLX, 3726 PCI_VENDOR_ID_PLX,
3735 PCI_SUBDEVICE_ID_UNKNOWN_0x1584, 0, 0, 3727 PCI_SUBDEVICE_ID_UNKNOWN_0x1584, 0, 0,
3736 pbn_b0_4_115200 }, 3728 pbn_b2_4_115200 },
3729 /* Unknown card - subdevice 0x1588 */
3730 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
3731 PCI_VENDOR_ID_PLX,
3732 PCI_SUBDEVICE_ID_UNKNOWN_0x1588, 0, 0,
3733 pbn_b2_8_115200 },
3737 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, 3734 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
3738 PCI_SUBVENDOR_ID_KEYSPAN, 3735 PCI_SUBVENDOR_ID_KEYSPAN,
3739 PCI_SUBDEVICE_ID_KEYSPAN_SX2, 0, 0, 3736 PCI_SUBDEVICE_ID_KEYSPAN_SX2, 0, 0,
@@ -4791,6 +4788,10 @@ static struct pci_device_id serial_pci_tbl[] = {
4791 PCI_VENDOR_ID_IBM, 0x0299, 4788 PCI_VENDOR_ID_IBM, 0x0299,
4792 0, 0, pbn_b0_bt_2_115200 }, 4789 0, 0, pbn_b0_bt_2_115200 },
4793 4790
4791 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9835,
4792 0x1000, 0x0012,
4793 0, 0, pbn_b0_bt_2_115200 },
4794
4794 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9901, 4795 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9901,
4795 0xA000, 0x1000, 4796 0xA000, 0x1000,
4796 0, 0, pbn_b0_1_115200 }, 4797 0, 0, pbn_b0_1_115200 },
diff --git a/drivers/tty/serial/8250/8250_pnp.c b/drivers/tty/serial/8250/8250_pnp.c
index 35d9ab95c5cb..b3455a970a1d 100644
--- a/drivers/tty/serial/8250/8250_pnp.c
+++ b/drivers/tty/serial/8250/8250_pnp.c
@@ -429,6 +429,7 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
429{ 429{
430 struct uart_8250_port uart; 430 struct uart_8250_port uart;
431 int ret, line, flags = dev_id->driver_data; 431 int ret, line, flags = dev_id->driver_data;
432 struct resource *res = NULL;
432 433
433 if (flags & UNKNOWN_DEV) { 434 if (flags & UNKNOWN_DEV) {
434 ret = serial_pnp_guess_board(dev); 435 ret = serial_pnp_guess_board(dev);
@@ -439,11 +440,12 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
439 memset(&uart, 0, sizeof(uart)); 440 memset(&uart, 0, sizeof(uart));
440 if (pnp_irq_valid(dev, 0)) 441 if (pnp_irq_valid(dev, 0))
441 uart.port.irq = pnp_irq(dev, 0); 442 uart.port.irq = pnp_irq(dev, 0);
442 if ((flags & CIR_PORT) && pnp_port_valid(dev, 2)) { 443 if ((flags & CIR_PORT) && pnp_port_valid(dev, 2))
443 uart.port.iobase = pnp_port_start(dev, 2); 444 res = pnp_get_resource(dev, IORESOURCE_IO, 2);
444 uart.port.iotype = UPIO_PORT; 445 else if (pnp_port_valid(dev, 0))
445 } else if (pnp_port_valid(dev, 0)) { 446 res = pnp_get_resource(dev, IORESOURCE_IO, 0);
446 uart.port.iobase = pnp_port_start(dev, 0); 447 if (pnp_resource_enabled(res)) {
448 uart.port.iobase = res->start;
447 uart.port.iotype = UPIO_PORT; 449 uart.port.iotype = UPIO_PORT;
448 } else if (pnp_mem_valid(dev, 0)) { 450 } else if (pnp_mem_valid(dev, 0)) {
449 uart.port.mapbase = pnp_mem_start(dev, 0); 451 uart.port.mapbase = pnp_mem_start(dev, 0);
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index cf9210db9fa9..7e7006fd404e 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -211,14 +211,14 @@ config SERIAL_SAMSUNG
211config SERIAL_SAMSUNG_UARTS_4 211config SERIAL_SAMSUNG_UARTS_4
212 bool 212 bool
213 depends on PLAT_SAMSUNG 213 depends on PLAT_SAMSUNG
214 default y if !(CPU_S3C2410 || SERIAL_S3C2412 || CPU_S3C2440 || CPU_S3C2442) 214 default y if !(CPU_S3C2410 || CPU_S3C2412 || CPU_S3C2440 || CPU_S3C2442)
215 help 215 help
216 Internal node for the common case of 4 Samsung compatible UARTs 216 Internal node for the common case of 4 Samsung compatible UARTs
217 217
218config SERIAL_SAMSUNG_UARTS 218config SERIAL_SAMSUNG_UARTS
219 int 219 int
220 depends on PLAT_SAMSUNG 220 depends on PLAT_SAMSUNG
221 default 6 if ARCH_S5P6450 221 default 6 if CPU_S5P6450
222 default 4 if SERIAL_SAMSUNG_UARTS_4 || CPU_S3C2416 222 default 4 if SERIAL_SAMSUNG_UARTS_4 || CPU_S3C2416
223 default 3 223 default 3
224 help 224 help
diff --git a/drivers/tty/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx_uart.c
index 719594e5fc21..52a3ecd40421 100644
--- a/drivers/tty/serial/bcm63xx_uart.c
+++ b/drivers/tty/serial/bcm63xx_uart.c
@@ -235,7 +235,7 @@ static const char *bcm_uart_type(struct uart_port *port)
235 */ 235 */
236static void bcm_uart_do_rx(struct uart_port *port) 236static void bcm_uart_do_rx(struct uart_port *port)
237{ 237{
238 struct tty_port *port = &port->state->port; 238 struct tty_port *tty_port = &port->state->port;
239 unsigned int max_count; 239 unsigned int max_count;
240 240
241 /* limit number of char read in interrupt, should not be 241 /* limit number of char read in interrupt, should not be
@@ -260,7 +260,7 @@ static void bcm_uart_do_rx(struct uart_port *port)
260 bcm_uart_writel(port, val, UART_CTL_REG); 260 bcm_uart_writel(port, val, UART_CTL_REG);
261 261
262 port->icount.overrun++; 262 port->icount.overrun++;
263 tty_insert_flip_char(port, 0, TTY_OVERRUN); 263 tty_insert_flip_char(tty_port, 0, TTY_OVERRUN);
264 } 264 }
265 265
266 if (!(iestat & UART_IR_STAT(UART_IR_RXNOTEMPTY))) 266 if (!(iestat & UART_IR_STAT(UART_IR_RXNOTEMPTY)))
@@ -299,11 +299,11 @@ static void bcm_uart_do_rx(struct uart_port *port)
299 299
300 300
301 if ((cstat & port->ignore_status_mask) == 0) 301 if ((cstat & port->ignore_status_mask) == 0)
302 tty_insert_flip_char(port, c, flag); 302 tty_insert_flip_char(tty_port, c, flag);
303 303
304 } while (--max_count); 304 } while (--max_count);
305 305
306 tty_flip_buffer_push(port); 306 tty_flip_buffer_push(tty_port);
307} 307}
308 308
309/* 309/*
diff --git a/drivers/tty/serial/mpc52xx_uart.c b/drivers/tty/serial/mpc52xx_uart.c
index c0e1fad51be7..018bad922554 100644
--- a/drivers/tty/serial/mpc52xx_uart.c
+++ b/drivers/tty/serial/mpc52xx_uart.c
@@ -550,7 +550,7 @@ static int mpc512x_psc_clock(struct uart_port *port, int enable)
550 return 0; 550 return 0;
551 551
552 psc_num = (port->mapbase & 0xf00) >> 8; 552 psc_num = (port->mapbase & 0xf00) >> 8;
553 snprintf(clk_name, sizeof(clk_name), "psc%d_clk", psc_num); 553 snprintf(clk_name, sizeof(clk_name), "psc%d_mclk", psc_num);
554 psc_clk = clk_get(port->dev, clk_name); 554 psc_clk = clk_get(port->dev, clk_name);
555 if (IS_ERR(psc_clk)) { 555 if (IS_ERR(psc_clk)) {
556 dev_err(port->dev, "Failed to get PSC clock entry!\n"); 556 dev_err(port->dev, "Failed to get PSC clock entry!\n");
diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
index d5874605682b..b025d5438275 100644
--- a/drivers/tty/serial/of_serial.c
+++ b/drivers/tty/serial/of_serial.c
@@ -241,6 +241,12 @@ static struct of_device_id of_platform_serial_table[] = {
241 { .compatible = "ns16850", .data = (void *)PORT_16850, }, 241 { .compatible = "ns16850", .data = (void *)PORT_16850, },
242 { .compatible = "nvidia,tegra20-uart", .data = (void *)PORT_TEGRA, }, 242 { .compatible = "nvidia,tegra20-uart", .data = (void *)PORT_TEGRA, },
243 { .compatible = "nxp,lpc3220-uart", .data = (void *)PORT_LPC3220, }, 243 { .compatible = "nxp,lpc3220-uart", .data = (void *)PORT_LPC3220, },
244 { .compatible = "altr,16550-FIFO32",
245 .data = (void *)PORT_ALTR_16550_F32, },
246 { .compatible = "altr,16550-FIFO64",
247 .data = (void *)PORT_ALTR_16550_F64, },
248 { .compatible = "altr,16550-FIFO128",
249 .data = (void *)PORT_ALTR_16550_F128, },
244#ifdef CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL 250#ifdef CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL
245 { .compatible = "ibm,qpace-nwp-serial", 251 { .compatible = "ibm,qpace-nwp-serial",
246 .data = (void *)PORT_NWPSERIAL, }, 252 .data = (void *)PORT_NWPSERIAL, },
diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c
index e343d6670854..451687cb9685 100644
--- a/drivers/tty/serial/sunsu.c
+++ b/drivers/tty/serial/sunsu.c
@@ -968,6 +968,7 @@ static struct uart_ops sunsu_pops = {
968#define UART_NR 4 968#define UART_NR 4
969 969
970static struct uart_sunsu_port sunsu_ports[UART_NR]; 970static struct uart_sunsu_port sunsu_ports[UART_NR];
971static int nr_inst; /* Number of already registered ports */
971 972
972#ifdef CONFIG_SERIO 973#ifdef CONFIG_SERIO
973 974
@@ -1337,13 +1338,8 @@ static int __init sunsu_console_setup(struct console *co, char *options)
1337 printk("Console: ttyS%d (SU)\n", 1338 printk("Console: ttyS%d (SU)\n",
1338 (sunsu_reg.minor - 64) + co->index); 1339 (sunsu_reg.minor - 64) + co->index);
1339 1340
1340 /* 1341 if (co->index > nr_inst)
1341 * Check whether an invalid uart number has been specified, and 1342 return -ENODEV;
1342 * if so, search for the first available port that does have
1343 * console support.
1344 */
1345 if (co->index >= UART_NR)
1346 co->index = 0;
1347 port = &sunsu_ports[co->index].port; 1343 port = &sunsu_ports[co->index].port;
1348 1344
1349 /* 1345 /*
@@ -1408,7 +1404,6 @@ static enum su_type su_get_type(struct device_node *dp)
1408 1404
1409static int su_probe(struct platform_device *op) 1405static int su_probe(struct platform_device *op)
1410{ 1406{
1411 static int inst;
1412 struct device_node *dp = op->dev.of_node; 1407 struct device_node *dp = op->dev.of_node;
1413 struct uart_sunsu_port *up; 1408 struct uart_sunsu_port *up;
1414 struct resource *rp; 1409 struct resource *rp;
@@ -1418,16 +1413,16 @@ static int su_probe(struct platform_device *op)
1418 1413
1419 type = su_get_type(dp); 1414 type = su_get_type(dp);
1420 if (type == SU_PORT_PORT) { 1415 if (type == SU_PORT_PORT) {
1421 if (inst >= UART_NR) 1416 if (nr_inst >= UART_NR)
1422 return -EINVAL; 1417 return -EINVAL;
1423 up = &sunsu_ports[inst]; 1418 up = &sunsu_ports[nr_inst];
1424 } else { 1419 } else {
1425 up = kzalloc(sizeof(*up), GFP_KERNEL); 1420 up = kzalloc(sizeof(*up), GFP_KERNEL);
1426 if (!up) 1421 if (!up)
1427 return -ENOMEM; 1422 return -ENOMEM;
1428 } 1423 }
1429 1424
1430 up->port.line = inst; 1425 up->port.line = nr_inst;
1431 1426
1432 spin_lock_init(&up->port.lock); 1427 spin_lock_init(&up->port.lock);
1433 1428
@@ -1461,6 +1456,8 @@ static int su_probe(struct platform_device *op)
1461 } 1456 }
1462 dev_set_drvdata(&op->dev, up); 1457 dev_set_drvdata(&op->dev, up);
1463 1458
1459 nr_inst++;
1460
1464 return 0; 1461 return 0;
1465 } 1462 }
1466 1463
@@ -1488,7 +1485,7 @@ static int su_probe(struct platform_device *op)
1488 1485
1489 dev_set_drvdata(&op->dev, up); 1486 dev_set_drvdata(&op->dev, up);
1490 1487
1491 inst++; 1488 nr_inst++;
1492 1489
1493 return 0; 1490 return 0;
1494 1491
diff --git a/drivers/tty/serial/vt8500_serial.c b/drivers/tty/serial/vt8500_serial.c
index a3f9dd5c9dff..705240e6c4ec 100644
--- a/drivers/tty/serial/vt8500_serial.c
+++ b/drivers/tty/serial/vt8500_serial.c
@@ -611,14 +611,7 @@ static int vt8500_serial_probe(struct platform_device *pdev)
611 vt8500_port->uart.dev = &pdev->dev; 611 vt8500_port->uart.dev = &pdev->dev;
612 vt8500_port->uart.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF; 612 vt8500_port->uart.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF;
613 613
614 vt8500_port->clk = of_clk_get(pdev->dev.of_node, 0); 614 vt8500_port->uart.uartclk = clk_get_rate(vt8500_port->clk);
615 if (!IS_ERR(vt8500_port->clk)) {
616 vt8500_port->uart.uartclk = clk_get_rate(vt8500_port->clk);
617 } else {
618 /* use the default of 24Mhz if not specified and warn */
619 pr_warn("%s: serial clock source not specified\n", __func__);
620 vt8500_port->uart.uartclk = 24000000;
621 }
622 615
623 snprintf(vt8500_port->name, sizeof(vt8500_port->name), 616 snprintf(vt8500_port->name, sizeof(vt8500_port->name),
624 "VT8500 UART%d", pdev->id); 617 "VT8500 UART%d", pdev->id);
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
index bb119934e76c..578aa7594b11 100644
--- a/drivers/tty/tty_buffer.c
+++ b/drivers/tty/tty_buffer.c
@@ -425,7 +425,7 @@ static void flush_to_ldisc(struct work_struct *work)
425 struct tty_ldisc *disc; 425 struct tty_ldisc *disc;
426 426
427 tty = port->itty; 427 tty = port->itty;
428 if (WARN_RATELIMIT(tty == NULL, "tty is NULL\n")) 428 if (tty == NULL)
429 return; 429 return;
430 430
431 disc = tty_ldisc_ref(tty); 431 disc = tty_ldisc_ref(tty);
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile
index f5ed3d75fa5a..8f5ebced5df0 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/Makefile
@@ -46,7 +46,7 @@ obj-$(CONFIG_USB_MICROTEK) += image/
46obj-$(CONFIG_USB_SERIAL) += serial/ 46obj-$(CONFIG_USB_SERIAL) += serial/
47 47
48obj-$(CONFIG_USB) += misc/ 48obj-$(CONFIG_USB) += misc/
49obj-$(CONFIG_USB_COMMON) += phy/ 49obj-$(CONFIG_USB_OTG_UTILS) += phy/
50obj-$(CONFIG_EARLY_PRINTK_DBGP) += early/ 50obj-$(CONFIG_EARLY_PRINTK_DBGP) += early/
51 51
52obj-$(CONFIG_USB_ATM) += atm/ 52obj-$(CONFIG_USB_ATM) += atm/
diff --git a/drivers/usb/c67x00/c67x00-sched.c b/drivers/usb/c67x00/c67x00-sched.c
index a03fbc15fa9c..aa491627a45b 100644
--- a/drivers/usb/c67x00/c67x00-sched.c
+++ b/drivers/usb/c67x00/c67x00-sched.c
@@ -100,7 +100,7 @@ struct c67x00_urb_priv {
100#define TD_PIDEP_OFFSET 0x04 100#define TD_PIDEP_OFFSET 0x04
101#define TD_PIDEPMASK_PID 0xF0 101#define TD_PIDEPMASK_PID 0xF0
102#define TD_PIDEPMASK_EP 0x0F 102#define TD_PIDEPMASK_EP 0x0F
103#define TD_PORTLENMASK_DL 0x02FF 103#define TD_PORTLENMASK_DL 0x03FF
104#define TD_PORTLENMASK_PN 0xC000 104#define TD_PORTLENMASK_PN 0xC000
105 105
106#define TD_STATUS_OFFSET 0x07 106#define TD_STATUS_OFFSET 0x07
@@ -590,7 +590,7 @@ static int c67x00_create_td(struct c67x00_hcd *c67x00, struct urb *urb,
590{ 590{
591 struct c67x00_td *td; 591 struct c67x00_td *td;
592 struct c67x00_urb_priv *urbp = urb->hcpriv; 592 struct c67x00_urb_priv *urbp = urb->hcpriv;
593 const __u8 active_flag = 1, retry_cnt = 1; 593 const __u8 active_flag = 1, retry_cnt = 3;
594 __u8 cmd = 0; 594 __u8 cmd = 0;
595 int tt = 0; 595 int tt = 0;
596 596
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 2f45bba8561d..f64fbea1cf20 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1767,7 +1767,7 @@ static int udc_start(struct ci13xxx *ci)
1767 goto put_transceiver; 1767 goto put_transceiver;
1768 } 1768 }
1769 1769
1770 retval = dbg_create_files(&ci->gadget.dev); 1770 retval = dbg_create_files(ci->dev);
1771 if (retval) 1771 if (retval)
1772 goto unreg_device; 1772 goto unreg_device;
1773 1773
@@ -1796,7 +1796,7 @@ remove_trans:
1796 1796
1797 dev_err(dev, "error = %i\n", retval); 1797 dev_err(dev, "error = %i\n", retval);
1798remove_dbg: 1798remove_dbg:
1799 dbg_remove_files(&ci->gadget.dev); 1799 dbg_remove_files(ci->dev);
1800unreg_device: 1800unreg_device:
1801 device_unregister(&ci->gadget.dev); 1801 device_unregister(&ci->gadget.dev);
1802put_transceiver: 1802put_transceiver:
@@ -1836,7 +1836,7 @@ static void udc_stop(struct ci13xxx *ci)
1836 if (ci->global_phy) 1836 if (ci->global_phy)
1837 usb_put_phy(ci->transceiver); 1837 usb_put_phy(ci->transceiver);
1838 } 1838 }
1839 dbg_remove_files(&ci->gadget.dev); 1839 dbg_remove_files(ci->dev);
1840 device_unregister(&ci->gadget.dev); 1840 device_unregister(&ci->gadget.dev);
1841 /* my kobject is dynamic, I swear! */ 1841 /* my kobject is dynamic, I swear! */
1842 memset(&ci->gadget, 0, sizeof(ci->gadget)); 1842 memset(&ci->gadget, 0, sizeof(ci->gadget));
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
index 5f0cb417b736..122d056d96d5 100644
--- a/drivers/usb/class/cdc-wdm.c
+++ b/drivers/usb/class/cdc-wdm.c
@@ -56,6 +56,7 @@ MODULE_DEVICE_TABLE (usb, wdm_ids);
56#define WDM_RESPONDING 7 56#define WDM_RESPONDING 7
57#define WDM_SUSPENDING 8 57#define WDM_SUSPENDING 8
58#define WDM_RESETTING 9 58#define WDM_RESETTING 9
59#define WDM_OVERFLOW 10
59 60
60#define WDM_MAX 16 61#define WDM_MAX 16
61 62
@@ -155,6 +156,7 @@ static void wdm_in_callback(struct urb *urb)
155{ 156{
156 struct wdm_device *desc = urb->context; 157 struct wdm_device *desc = urb->context;
157 int status = urb->status; 158 int status = urb->status;
159 int length = urb->actual_length;
158 160
159 spin_lock(&desc->iuspin); 161 spin_lock(&desc->iuspin);
160 clear_bit(WDM_RESPONDING, &desc->flags); 162 clear_bit(WDM_RESPONDING, &desc->flags);
@@ -185,9 +187,17 @@ static void wdm_in_callback(struct urb *urb)
185 } 187 }
186 188
187 desc->rerr = status; 189 desc->rerr = status;
188 desc->reslength = urb->actual_length; 190 if (length + desc->length > desc->wMaxCommand) {
189 memmove(desc->ubuf + desc->length, desc->inbuf, desc->reslength); 191 /* The buffer would overflow */
190 desc->length += desc->reslength; 192 set_bit(WDM_OVERFLOW, &desc->flags);
193 } else {
194 /* we may already be in overflow */
195 if (!test_bit(WDM_OVERFLOW, &desc->flags)) {
196 memmove(desc->ubuf + desc->length, desc->inbuf, length);
197 desc->length += length;
198 desc->reslength = length;
199 }
200 }
191skip_error: 201skip_error:
192 wake_up(&desc->wait); 202 wake_up(&desc->wait);
193 203
@@ -435,6 +445,11 @@ retry:
435 rv = -ENODEV; 445 rv = -ENODEV;
436 goto err; 446 goto err;
437 } 447 }
448 if (test_bit(WDM_OVERFLOW, &desc->flags)) {
449 clear_bit(WDM_OVERFLOW, &desc->flags);
450 rv = -ENOBUFS;
451 goto err;
452 }
438 i++; 453 i++;
439 if (file->f_flags & O_NONBLOCK) { 454 if (file->f_flags & O_NONBLOCK) {
440 if (!test_bit(WDM_READ, &desc->flags)) { 455 if (!test_bit(WDM_READ, &desc->flags)) {
@@ -478,6 +493,7 @@ retry:
478 spin_unlock_irq(&desc->iuspin); 493 spin_unlock_irq(&desc->iuspin);
479 goto retry; 494 goto retry;
480 } 495 }
496
481 if (!desc->reslength) { /* zero length read */ 497 if (!desc->reslength) { /* zero length read */
482 dev_dbg(&desc->intf->dev, "%s: zero length - clearing WDM_READ\n", __func__); 498 dev_dbg(&desc->intf->dev, "%s: zero length - clearing WDM_READ\n", __func__);
483 clear_bit(WDM_READ, &desc->flags); 499 clear_bit(WDM_READ, &desc->flags);
@@ -1004,6 +1020,7 @@ static int wdm_post_reset(struct usb_interface *intf)
1004 struct wdm_device *desc = wdm_find_device(intf); 1020 struct wdm_device *desc = wdm_find_device(intf);
1005 int rv; 1021 int rv;
1006 1022
1023 clear_bit(WDM_OVERFLOW, &desc->flags);
1007 clear_bit(WDM_RESETTING, &desc->flags); 1024 clear_bit(WDM_RESETTING, &desc->flags);
1008 rv = recover_from_urb_loss(desc); 1025 rv = recover_from_urb_loss(desc);
1009 mutex_unlock(&desc->wlock); 1026 mutex_unlock(&desc->wlock);
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 999909451e37..ffa6b004a84b 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -583,6 +583,7 @@ static int dwc3_remove(struct platform_device *pdev)
583 break; 583 break;
584 } 584 }
585 585
586 dwc3_free_event_buffers(dwc);
586 dwc3_core_exit(dwc); 587 dwc3_core_exit(dwc);
587 588
588 return 0; 589 return 0;
diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c
index b50da53e9a52..b082bec7343e 100644
--- a/drivers/usb/dwc3/dwc3-exynos.c
+++ b/drivers/usb/dwc3/dwc3-exynos.c
@@ -23,8 +23,6 @@
23#include <linux/usb/nop-usb-xceiv.h> 23#include <linux/usb/nop-usb-xceiv.h>
24#include <linux/of.h> 24#include <linux/of.h>
25 25
26#include "core.h"
27
28struct dwc3_exynos { 26struct dwc3_exynos {
29 struct platform_device *dwc3; 27 struct platform_device *dwc3;
30 struct platform_device *usb2_phy; 28 struct platform_device *usb2_phy;
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index 22f337f57219..afa05e3c9cf4 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -54,8 +54,6 @@
54#include <linux/usb/otg.h> 54#include <linux/usb/otg.h>
55#include <linux/usb/nop-usb-xceiv.h> 55#include <linux/usb/nop-usb-xceiv.h>
56 56
57#include "core.h"
58
59/* 57/*
60 * All these registers belong to OMAP's Wrapper around the 58 * All these registers belong to OMAP's Wrapper around the
61 * DesignWare USB3 Core. 59 * DesignWare USB3 Core.
@@ -465,20 +463,20 @@ static int dwc3_omap_remove(struct platform_device *pdev)
465 return 0; 463 return 0;
466} 464}
467 465
468static const struct of_device_id of_dwc3_matach[] = { 466static const struct of_device_id of_dwc3_match[] = {
469 { 467 {
470 "ti,dwc3", 468 "ti,dwc3",
471 }, 469 },
472 { }, 470 { },
473}; 471};
474MODULE_DEVICE_TABLE(of, of_dwc3_matach); 472MODULE_DEVICE_TABLE(of, of_dwc3_match);
475 473
476static struct platform_driver dwc3_omap_driver = { 474static struct platform_driver dwc3_omap_driver = {
477 .probe = dwc3_omap_probe, 475 .probe = dwc3_omap_probe,
478 .remove = dwc3_omap_remove, 476 .remove = dwc3_omap_remove,
479 .driver = { 477 .driver = {
480 .name = "omap-dwc3", 478 .name = "omap-dwc3",
481 .of_match_table = of_dwc3_matach, 479 .of_match_table = of_dwc3_match,
482 }, 480 },
483}; 481};
484 482
diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
index 7d70f44567d2..e8d77689a322 100644
--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -45,8 +45,6 @@
45#include <linux/usb/otg.h> 45#include <linux/usb/otg.h>
46#include <linux/usb/nop-usb-xceiv.h> 46#include <linux/usb/nop-usb-xceiv.h>
47 47
48#include "core.h"
49
50/* FIXME define these in <linux/pci_ids.h> */ 48/* FIXME define these in <linux/pci_ids.h> */
51#define PCI_VENDOR_ID_SYNOPSYS 0x16c3 49#define PCI_VENDOR_ID_SYNOPSYS 0x16c3
52#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd 50#define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index d7da073a23fe..1d139ca05ef1 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -891,7 +891,8 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc,
891 DWC3_TRBCTL_CONTROL_DATA); 891 DWC3_TRBCTL_CONTROL_DATA);
892 } else if (!IS_ALIGNED(req->request.length, dep->endpoint.maxpacket) 892 } else if (!IS_ALIGNED(req->request.length, dep->endpoint.maxpacket)
893 && (dep->number == 0)) { 893 && (dep->number == 0)) {
894 u32 transfer_size; 894 u32 transfer_size;
895 u32 maxpacket;
895 896
896 ret = usb_gadget_map_request(&dwc->gadget, &req->request, 897 ret = usb_gadget_map_request(&dwc->gadget, &req->request,
897 dep->number); 898 dep->number);
@@ -902,8 +903,8 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc,
902 903
903 WARN_ON(req->request.length > DWC3_EP0_BOUNCE_SIZE); 904 WARN_ON(req->request.length > DWC3_EP0_BOUNCE_SIZE);
904 905
905 transfer_size = roundup(req->request.length, 906 maxpacket = dep->endpoint.maxpacket;
906 (u32) dep->endpoint.maxpacket); 907 transfer_size = roundup(req->request.length, maxpacket);
907 908
908 dwc->ep0_bounced = true; 909 dwc->ep0_bounced = true;
909 910
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index a04342f6cbfa..82e160e96fca 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2159,7 +2159,6 @@ static void dwc3_gadget_phy_suspend(struct dwc3 *dwc, u8 speed)
2159 2159
2160static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc) 2160static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc)
2161{ 2161{
2162 struct dwc3_gadget_ep_cmd_params params;
2163 struct dwc3_ep *dep; 2162 struct dwc3_ep *dep;
2164 int ret; 2163 int ret;
2165 u32 reg; 2164 u32 reg;
@@ -2167,8 +2166,6 @@ static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc)
2167 2166
2168 dev_vdbg(dwc->dev, "%s\n", __func__); 2167 dev_vdbg(dwc->dev, "%s\n", __func__);
2169 2168
2170 memset(&params, 0x00, sizeof(params));
2171
2172 reg = dwc3_readl(dwc->regs, DWC3_DSTS); 2169 reg = dwc3_readl(dwc->regs, DWC3_DSTS);
2173 speed = reg & DWC3_DSTS_CONNECTSPD; 2170 speed = reg & DWC3_DSTS_CONNECTSPD;
2174 dwc->speed = speed; 2171 dwc->speed = speed;
diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
index 97a13c349cc5..82fb22511356 100644
--- a/drivers/usb/gadget/Makefile
+++ b/drivers/usb/gadget/Makefile
@@ -35,6 +35,12 @@ mv_udc-y := mv_udc_core.o
35obj-$(CONFIG_USB_FUSB300) += fusb300_udc.o 35obj-$(CONFIG_USB_FUSB300) += fusb300_udc.o
36obj-$(CONFIG_USB_MV_U3D) += mv_u3d_core.o 36obj-$(CONFIG_USB_MV_U3D) += mv_u3d_core.o
37 37
38# USB Functions
39obj-$(CONFIG_USB_F_ACM) += f_acm.o
40f_ss_lb-y := f_loopback.o f_sourcesink.o
41obj-$(CONFIG_USB_F_SS_LB) += f_ss_lb.o
42obj-$(CONFIG_USB_U_SERIAL) += u_serial.o
43
38# 44#
39# USB gadget drivers 45# USB gadget drivers
40# 46#
@@ -74,9 +80,3 @@ obj-$(CONFIG_USB_G_WEBCAM) += g_webcam.o
74obj-$(CONFIG_USB_G_NCM) += g_ncm.o 80obj-$(CONFIG_USB_G_NCM) += g_ncm.o
75obj-$(CONFIG_USB_G_ACM_MS) += g_acm_ms.o 81obj-$(CONFIG_USB_G_ACM_MS) += g_acm_ms.o
76obj-$(CONFIG_USB_GADGET_TARGET) += tcm_usb_gadget.o 82obj-$(CONFIG_USB_GADGET_TARGET) += tcm_usb_gadget.o
77
78# USB Functions
79obj-$(CONFIG_USB_F_ACM) += f_acm.o
80f_ss_lb-y := f_loopback.o f_sourcesink.o
81obj-$(CONFIG_USB_F_SS_LB) += f_ss_lb.o
82obj-$(CONFIG_USB_U_SERIAL) += u_serial.o
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 7c821de8ce3d..c0d62b278610 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -1757,10 +1757,7 @@ static const struct usb_gadget_driver composite_driver_template = {
1757/** 1757/**
1758 * usb_composite_probe() - register a composite driver 1758 * usb_composite_probe() - register a composite driver
1759 * @driver: the driver to register 1759 * @driver: the driver to register
1760 * @bind: the callback used to allocate resources that are shared across the 1760 *
1761 * whole device, such as string IDs, and add its configurations using
1762 * @usb_add_config(). This may fail by returning a negative errno
1763 * value; it should return zero on successful initialization.
1764 * Context: single threaded during gadget setup 1761 * Context: single threaded during gadget setup
1765 * 1762 *
1766 * This function is used to register drivers using the composite driver 1763 * This function is used to register drivers using the composite driver
diff --git a/drivers/usb/gadget/f_uac1.c b/drivers/usb/gadget/f_uac1.c
index f570e667a640..fa8ea4ea00c1 100644
--- a/drivers/usb/gadget/f_uac1.c
+++ b/drivers/usb/gadget/f_uac1.c
@@ -418,6 +418,7 @@ static int audio_get_intf_req(struct usb_function *f,
418 418
419 req->context = audio; 419 req->context = audio;
420 req->complete = f_audio_complete; 420 req->complete = f_audio_complete;
421 len = min_t(size_t, sizeof(value), len);
421 memcpy(req->buf, &value, len); 422 memcpy(req->buf, &value, len);
422 423
423 return len; 424 return len;
diff --git a/drivers/usb/gadget/imx_udc.c b/drivers/usb/gadget/imx_udc.c
index 8efd7555fa21..5bd930d779b9 100644
--- a/drivers/usb/gadget/imx_udc.c
+++ b/drivers/usb/gadget/imx_udc.c
@@ -1334,27 +1334,18 @@ static int imx_udc_start(struct usb_gadget *gadget,
1334 struct usb_gadget_driver *driver) 1334 struct usb_gadget_driver *driver)
1335{ 1335{
1336 struct imx_udc_struct *imx_usb; 1336 struct imx_udc_struct *imx_usb;
1337 int retval;
1338 1337
1339 imx_usb = container_of(gadget, struct imx_udc_struct, gadget); 1338 imx_usb = container_of(gadget, struct imx_udc_struct, gadget);
1340 /* first hook up the driver ... */ 1339 /* first hook up the driver ... */
1341 imx_usb->driver = driver; 1340 imx_usb->driver = driver;
1342 imx_usb->gadget.dev.driver = &driver->driver; 1341 imx_usb->gadget.dev.driver = &driver->driver;
1343 1342
1344 retval = device_add(&imx_usb->gadget.dev);
1345 if (retval)
1346 goto fail;
1347
1348 D_INI(imx_usb->dev, "<%s> registered gadget driver '%s'\n", 1343 D_INI(imx_usb->dev, "<%s> registered gadget driver '%s'\n",
1349 __func__, driver->driver.name); 1344 __func__, driver->driver.name);
1350 1345
1351 imx_udc_enable(imx_usb); 1346 imx_udc_enable(imx_usb);
1352 1347
1353 return 0; 1348 return 0;
1354fail:
1355 imx_usb->driver = NULL;
1356 imx_usb->gadget.dev.driver = NULL;
1357 return retval;
1358} 1349}
1359 1350
1360static int imx_udc_stop(struct usb_gadget *gadget, 1351static int imx_udc_stop(struct usb_gadget *gadget,
@@ -1370,8 +1361,6 @@ static int imx_udc_stop(struct usb_gadget *gadget,
1370 imx_usb->gadget.dev.driver = NULL; 1361 imx_usb->gadget.dev.driver = NULL;
1371 imx_usb->driver = NULL; 1362 imx_usb->driver = NULL;
1372 1363
1373 device_del(&imx_usb->gadget.dev);
1374
1375 D_INI(imx_usb->dev, "<%s> unregistered gadget driver '%s'\n", 1364 D_INI(imx_usb->dev, "<%s> unregistered gadget driver '%s'\n",
1376 __func__, driver->driver.name); 1365 __func__, driver->driver.name);
1377 1366
@@ -1477,6 +1466,10 @@ static int __init imx_udc_probe(struct platform_device *pdev)
1477 imx_usb->gadget.dev.parent = &pdev->dev; 1466 imx_usb->gadget.dev.parent = &pdev->dev;
1478 imx_usb->gadget.dev.dma_mask = pdev->dev.dma_mask; 1467 imx_usb->gadget.dev.dma_mask = pdev->dev.dma_mask;
1479 1468
1469 ret = device_add(&imx_usb->gadget.dev);
1470 if (retval)
1471 goto fail4;
1472
1480 platform_set_drvdata(pdev, imx_usb); 1473 platform_set_drvdata(pdev, imx_usb);
1481 1474
1482 usb_init_data(imx_usb); 1475 usb_init_data(imx_usb);
@@ -1488,9 +1481,11 @@ static int __init imx_udc_probe(struct platform_device *pdev)
1488 1481
1489 ret = usb_add_gadget_udc(&pdev->dev, &imx_usb->gadget); 1482 ret = usb_add_gadget_udc(&pdev->dev, &imx_usb->gadget);
1490 if (ret) 1483 if (ret)
1491 goto fail4; 1484 goto fail5;
1492 1485
1493 return 0; 1486 return 0;
1487fail5:
1488 device_unregister(&imx_usb->gadget.dev);
1494fail4: 1489fail4:
1495 for (i = 0; i < IMX_USB_NB_EP + 1; i++) 1490 for (i = 0; i < IMX_USB_NB_EP + 1; i++)
1496 free_irq(imx_usb->usbd_int[i], imx_usb); 1491 free_irq(imx_usb->usbd_int[i], imx_usb);
@@ -1514,6 +1509,7 @@ static int __exit imx_udc_remove(struct platform_device *pdev)
1514 int i; 1509 int i;
1515 1510
1516 usb_del_gadget_udc(&imx_usb->gadget); 1511 usb_del_gadget_udc(&imx_usb->gadget);
1512 device_unregister(&imx_usb->gadget.dev);
1517 imx_udc_disable(imx_usb); 1513 imx_udc_disable(imx_usb);
1518 del_timer(&imx_usb->timer); 1514 del_timer(&imx_usb->timer);
1519 1515
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index 06be85c2b233..f8445653577f 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -62,6 +62,7 @@
62#define DRIVER_VERSION "4 October 2004" 62#define DRIVER_VERSION "4 October 2004"
63 63
64#define OMAP_DMA_USB_W2FC_TX0 29 64#define OMAP_DMA_USB_W2FC_TX0 29
65#define OMAP_DMA_USB_W2FC_RX0 26
65 66
66/* 67/*
67 * The OMAP UDC needs _very_ early endpoint setup: before enabling the 68 * The OMAP UDC needs _very_ early endpoint setup: before enabling the
@@ -1310,7 +1311,7 @@ static int omap_pullup(struct usb_gadget *gadget, int is_on)
1310} 1311}
1311 1312
1312static int omap_udc_start(struct usb_gadget *g, 1313static int omap_udc_start(struct usb_gadget *g,
1313 struct usb_gadget_driver *driver) 1314 struct usb_gadget_driver *driver);
1314static int omap_udc_stop(struct usb_gadget *g, 1315static int omap_udc_stop(struct usb_gadget *g,
1315 struct usb_gadget_driver *driver); 1316 struct usb_gadget_driver *driver);
1316 1317
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c
index 2bbcdce942dc..d0f37484b6b0 100644
--- a/drivers/usb/gadget/pxa25x_udc.c
+++ b/drivers/usb/gadget/pxa25x_udc.c
@@ -1266,13 +1266,6 @@ static int pxa25x_udc_start(struct usb_gadget *g,
1266 dev->gadget.dev.driver = &driver->driver; 1266 dev->gadget.dev.driver = &driver->driver;
1267 dev->pullup = 1; 1267 dev->pullup = 1;
1268 1268
1269 retval = device_add (&dev->gadget.dev);
1270 if (retval) {
1271 dev->driver = NULL;
1272 dev->gadget.dev.driver = NULL;
1273 return retval;
1274 }
1275
1276 /* ... then enable host detection and ep0; and we're ready 1269 /* ... then enable host detection and ep0; and we're ready
1277 * for set_configuration as well as eventual disconnect. 1270 * for set_configuration as well as eventual disconnect.
1278 */ 1271 */
@@ -1310,6 +1303,10 @@ stop_activity(struct pxa25x_udc *dev, struct usb_gadget_driver *driver)
1310 } 1303 }
1311 del_timer_sync(&dev->timer); 1304 del_timer_sync(&dev->timer);
1312 1305
1306 /* report disconnect; the driver is already quiesced */
1307 if (driver)
1308 driver->disconnect(&dev->gadget);
1309
1313 /* re-init driver-visible data structures */ 1310 /* re-init driver-visible data structures */
1314 udc_reinit(dev); 1311 udc_reinit(dev);
1315} 1312}
@@ -1331,7 +1328,6 @@ static int pxa25x_udc_stop(struct usb_gadget*g,
1331 dev->gadget.dev.driver = NULL; 1328 dev->gadget.dev.driver = NULL;
1332 dev->driver = NULL; 1329 dev->driver = NULL;
1333 1330
1334 device_del (&dev->gadget.dev);
1335 dump_state(dev); 1331 dump_state(dev);
1336 1332
1337 return 0; 1333 return 0;
@@ -2146,6 +2142,13 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev)
2146 dev->gadget.dev.parent = &pdev->dev; 2142 dev->gadget.dev.parent = &pdev->dev;
2147 dev->gadget.dev.dma_mask = pdev->dev.dma_mask; 2143 dev->gadget.dev.dma_mask = pdev->dev.dma_mask;
2148 2144
2145 retval = device_add(&dev->gadget.dev);
2146 if (retval) {
2147 dev->driver = NULL;
2148 dev->gadget.dev.driver = NULL;
2149 goto err_device_add;
2150 }
2151
2149 the_controller = dev; 2152 the_controller = dev;
2150 platform_set_drvdata(pdev, dev); 2153 platform_set_drvdata(pdev, dev);
2151 2154
@@ -2196,6 +2199,8 @@ lubbock_fail0:
2196 free_irq(irq, dev); 2199 free_irq(irq, dev);
2197#endif 2200#endif
2198 err_irq1: 2201 err_irq1:
2202 device_unregister(&dev->gadget.dev);
2203 err_device_add:
2199 if (gpio_is_valid(dev->mach->gpio_pullup)) 2204 if (gpio_is_valid(dev->mach->gpio_pullup))
2200 gpio_free(dev->mach->gpio_pullup); 2205 gpio_free(dev->mach->gpio_pullup);
2201 err_gpio_pullup: 2206 err_gpio_pullup:
@@ -2217,10 +2222,11 @@ static int __exit pxa25x_udc_remove(struct platform_device *pdev)
2217{ 2222{
2218 struct pxa25x_udc *dev = platform_get_drvdata(pdev); 2223 struct pxa25x_udc *dev = platform_get_drvdata(pdev);
2219 2224
2220 usb_del_gadget_udc(&dev->gadget);
2221 if (dev->driver) 2225 if (dev->driver)
2222 return -EBUSY; 2226 return -EBUSY;
2223 2227
2228 usb_del_gadget_udc(&dev->gadget);
2229 device_unregister(&dev->gadget.dev);
2224 dev->pullup = 0; 2230 dev->pullup = 0;
2225 pullup(dev); 2231 pullup(dev);
2226 2232
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c
index f7d25795821a..2fc867652ef5 100644
--- a/drivers/usb/gadget/pxa27x_udc.c
+++ b/drivers/usb/gadget/pxa27x_udc.c
@@ -1814,11 +1814,6 @@ static int pxa27x_udc_start(struct usb_gadget *g,
1814 udc->gadget.dev.driver = &driver->driver; 1814 udc->gadget.dev.driver = &driver->driver;
1815 dplus_pullup(udc, 1); 1815 dplus_pullup(udc, 1);
1816 1816
1817 retval = device_add(&udc->gadget.dev);
1818 if (retval) {
1819 dev_err(udc->dev, "device_add error %d\n", retval);
1820 goto fail;
1821 }
1822 if (!IS_ERR_OR_NULL(udc->transceiver)) { 1817 if (!IS_ERR_OR_NULL(udc->transceiver)) {
1823 retval = otg_set_peripheral(udc->transceiver->otg, 1818 retval = otg_set_peripheral(udc->transceiver->otg,
1824 &udc->gadget); 1819 &udc->gadget);
@@ -1876,7 +1871,6 @@ static int pxa27x_udc_stop(struct usb_gadget *g,
1876 1871
1877 udc->driver = NULL; 1872 udc->driver = NULL;
1878 1873
1879 device_del(&udc->gadget.dev);
1880 1874
1881 if (!IS_ERR_OR_NULL(udc->transceiver)) 1875 if (!IS_ERR_OR_NULL(udc->transceiver))
1882 return otg_set_peripheral(udc->transceiver->otg, NULL); 1876 return otg_set_peripheral(udc->transceiver->otg, NULL);
@@ -2480,13 +2474,24 @@ static int __init pxa_udc_probe(struct platform_device *pdev)
2480 driver_name, udc->irq, retval); 2474 driver_name, udc->irq, retval);
2481 goto err_irq; 2475 goto err_irq;
2482 } 2476 }
2477
2478 retval = device_add(&udc->gadget.dev);
2479 if (retval) {
2480 dev_err(udc->dev, "device_add error %d\n", retval);
2481 goto err_dev_add;
2482 }
2483
2483 retval = usb_add_gadget_udc(&pdev->dev, &udc->gadget); 2484 retval = usb_add_gadget_udc(&pdev->dev, &udc->gadget);
2484 if (retval) 2485 if (retval)
2485 goto err_add_udc; 2486 goto err_add_udc;
2486 2487
2487 pxa_init_debugfs(udc); 2488 pxa_init_debugfs(udc);
2489
2488 return 0; 2490 return 0;
2491
2489err_add_udc: 2492err_add_udc:
2493 device_unregister(&udc->gadget.dev);
2494err_dev_add:
2490 free_irq(udc->irq, udc); 2495 free_irq(udc->irq, udc);
2491err_irq: 2496err_irq:
2492 iounmap(udc->regs); 2497 iounmap(udc->regs);
@@ -2507,6 +2512,7 @@ static int __exit pxa_udc_remove(struct platform_device *_dev)
2507 int gpio = udc->mach->gpio_pullup; 2512 int gpio = udc->mach->gpio_pullup;
2508 2513
2509 usb_del_gadget_udc(&udc->gadget); 2514 usb_del_gadget_udc(&udc->gadget);
2515 device_del(&udc->gadget.dev);
2510 usb_gadget_unregister_driver(udc->driver); 2516 usb_gadget_unregister_driver(udc->driver);
2511 free_irq(udc->irq, udc); 2517 free_irq(udc->irq, udc);
2512 pxa_cleanup_debugfs(udc); 2518 pxa_cleanup_debugfs(udc);
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c
index fc07b4381286..08f89652533b 100644
--- a/drivers/usb/gadget/s3c2410_udc.c
+++ b/drivers/usb/gadget/s3c2410_udc.c
@@ -1668,8 +1668,7 @@ static void s3c2410_udc_enable(struct s3c2410_udc *dev)
1668static int s3c2410_udc_start(struct usb_gadget *g, 1668static int s3c2410_udc_start(struct usb_gadget *g,
1669 struct usb_gadget_driver *driver) 1669 struct usb_gadget_driver *driver)
1670{ 1670{
1671 struct s3c2410_udc *udc = to_s3c2410(g) 1671 struct s3c2410_udc *udc = to_s3c2410(g);
1672 int retval;
1673 1672
1674 dprintk(DEBUG_NORMAL, "%s() '%s'\n", __func__, driver->driver.name); 1673 dprintk(DEBUG_NORMAL, "%s() '%s'\n", __func__, driver->driver.name);
1675 1674
@@ -1677,22 +1676,10 @@ static int s3c2410_udc_start(struct usb_gadget *g,
1677 udc->driver = driver; 1676 udc->driver = driver;
1678 udc->gadget.dev.driver = &driver->driver; 1677 udc->gadget.dev.driver = &driver->driver;
1679 1678
1680 /* Bind the driver */
1681 retval = device_add(&udc->gadget.dev);
1682 if (retval) {
1683 dev_err(&udc->gadget.dev, "Error in device_add() : %d\n", retval);
1684 goto register_error;
1685 }
1686
1687 /* Enable udc */ 1679 /* Enable udc */
1688 s3c2410_udc_enable(udc); 1680 s3c2410_udc_enable(udc);
1689 1681
1690 return 0; 1682 return 0;
1691
1692register_error:
1693 udc->driver = NULL;
1694 udc->gadget.dev.driver = NULL;
1695 return retval;
1696} 1683}
1697 1684
1698static int s3c2410_udc_stop(struct usb_gadget *g, 1685static int s3c2410_udc_stop(struct usb_gadget *g,
@@ -1700,7 +1687,6 @@ static int s3c2410_udc_stop(struct usb_gadget *g,
1700{ 1687{
1701 struct s3c2410_udc *udc = to_s3c2410(g); 1688 struct s3c2410_udc *udc = to_s3c2410(g);
1702 1689
1703 device_del(&udc->gadget.dev);
1704 udc->driver = NULL; 1690 udc->driver = NULL;
1705 1691
1706 /* Disable udc */ 1692 /* Disable udc */
@@ -1842,6 +1828,13 @@ static int s3c2410_udc_probe(struct platform_device *pdev)
1842 udc->gadget.dev.parent = &pdev->dev; 1828 udc->gadget.dev.parent = &pdev->dev;
1843 udc->gadget.dev.dma_mask = pdev->dev.dma_mask; 1829 udc->gadget.dev.dma_mask = pdev->dev.dma_mask;
1844 1830
1831 /* Bind the driver */
1832 retval = device_add(&udc->gadget.dev);
1833 if (retval) {
1834 dev_err(&udc->gadget.dev, "Error in device_add() : %d\n", retval);
1835 goto err_device_add;
1836 }
1837
1845 the_controller = udc; 1838 the_controller = udc;
1846 platform_set_drvdata(pdev, udc); 1839 platform_set_drvdata(pdev, udc);
1847 1840
@@ -1930,6 +1923,8 @@ err_gpio_claim:
1930err_int: 1923err_int:
1931 free_irq(IRQ_USBD, udc); 1924 free_irq(IRQ_USBD, udc);
1932err_map: 1925err_map:
1926 device_unregister(&udc->gadget.dev);
1927err_device_add:
1933 iounmap(base_addr); 1928 iounmap(base_addr);
1934err_mem: 1929err_mem:
1935 release_mem_region(rsrc_start, rsrc_len); 1930 release_mem_region(rsrc_start, rsrc_len);
@@ -1947,10 +1942,11 @@ static int s3c2410_udc_remove(struct platform_device *pdev)
1947 1942
1948 dev_dbg(&pdev->dev, "%s()\n", __func__); 1943 dev_dbg(&pdev->dev, "%s()\n", __func__);
1949 1944
1950 usb_del_gadget_udc(&udc->gadget);
1951 if (udc->driver) 1945 if (udc->driver)
1952 return -EBUSY; 1946 return -EBUSY;
1953 1947
1948 usb_del_gadget_udc(&udc->gadget);
1949 device_unregister(&udc->gadget.dev);
1954 debugfs_remove(udc->regs_info); 1950 debugfs_remove(udc->regs_info);
1955 1951
1956 if (udc_info && !udc_info->udc_command && 1952 if (udc_info && !udc_info->udc_command &&
diff --git a/drivers/usb/gadget/u_uac1.c b/drivers/usb/gadget/u_uac1.c
index e0c5e88e03ed..c7d460f43390 100644
--- a/drivers/usb/gadget/u_uac1.c
+++ b/drivers/usb/gadget/u_uac1.c
@@ -240,8 +240,11 @@ static int gaudio_open_snd_dev(struct gaudio *card)
240 snd = &card->playback; 240 snd = &card->playback;
241 snd->filp = filp_open(fn_play, O_WRONLY, 0); 241 snd->filp = filp_open(fn_play, O_WRONLY, 0);
242 if (IS_ERR(snd->filp)) { 242 if (IS_ERR(snd->filp)) {
243 int ret = PTR_ERR(snd->filp);
244
243 ERROR(card, "No such PCM playback device: %s\n", fn_play); 245 ERROR(card, "No such PCM playback device: %s\n", fn_play);
244 snd->filp = NULL; 246 snd->filp = NULL;
247 return ret;
245 } 248 }
246 pcm_file = snd->filp->private_data; 249 pcm_file = snd->filp->private_data;
247 snd->substream = pcm_file->substream; 250 snd->substream = pcm_file->substream;
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index b416a3fc9959..5726cb144abf 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -748,11 +748,9 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
748 /* guard against (alleged) silicon errata */ 748 /* guard against (alleged) silicon errata */
749 if (cmd & CMD_IAAD) 749 if (cmd & CMD_IAAD)
750 ehci_dbg(ehci, "IAA with IAAD still set?\n"); 750 ehci_dbg(ehci, "IAA with IAAD still set?\n");
751 if (ehci->async_iaa) { 751 if (ehci->async_iaa)
752 COUNT(ehci->stats.iaa); 752 COUNT(ehci->stats.iaa);
753 end_unlink_async(ehci); 753 end_unlink_async(ehci);
754 } else
755 ehci_dbg(ehci, "IAA with nothing unlinked?\n");
756 } 754 }
757 755
758 /* remote wakeup [4.3.1] */ 756 /* remote wakeup [4.3.1] */
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index fd252f0cfb3a..5464665f0b6a 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -135,7 +135,7 @@ qh_refresh (struct ehci_hcd *ehci, struct ehci_qh *qh)
135 * qtd is updated in qh_completions(). Update the QH 135 * qtd is updated in qh_completions(). Update the QH
136 * overlay here. 136 * overlay here.
137 */ 137 */
138 if (cpu_to_hc32(ehci, qtd->qtd_dma) == qh->hw->hw_current) { 138 if (qh->hw->hw_token & ACTIVE_BIT(ehci)) {
139 qh->hw->hw_qtd_next = qtd->hw_next; 139 qh->hw->hw_qtd_next = qtd->hw_next;
140 qtd = NULL; 140 qtd = NULL;
141 } 141 }
@@ -449,11 +449,19 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
449 else if (last_status == -EINPROGRESS && !urb->unlinked) 449 else if (last_status == -EINPROGRESS && !urb->unlinked)
450 continue; 450 continue;
451 451
452 /* qh unlinked; token in overlay may be most current */ 452 /*
453 if (state == QH_STATE_IDLE 453 * If this was the active qtd when the qh was unlinked
454 && cpu_to_hc32(ehci, qtd->qtd_dma) 454 * and the overlay's token is active, then the overlay
455 == hw->hw_current) { 455 * hasn't been written back to the qtd yet so use its
456 * token instead of the qtd's. After the qtd is
457 * processed and removed, the overlay won't be valid
458 * any more.
459 */
460 if (state == QH_STATE_IDLE &&
461 qh->qtd_list.next == &qtd->qtd_list &&
462 (hw->hw_token & ACTIVE_BIT(ehci))) {
456 token = hc32_to_cpu(ehci, hw->hw_token); 463 token = hc32_to_cpu(ehci, hw->hw_token);
464 hw->hw_token &= ~ACTIVE_BIT(ehci);
457 465
458 /* An unlink may leave an incomplete 466 /* An unlink may leave an incomplete
459 * async transaction in the TT buffer. 467 * async transaction in the TT buffer.
@@ -1170,7 +1178,7 @@ static void single_unlink_async(struct ehci_hcd *ehci, struct ehci_qh *qh)
1170 struct ehci_qh *prev; 1178 struct ehci_qh *prev;
1171 1179
1172 /* Add to the end of the list of QHs waiting for the next IAAD */ 1180 /* Add to the end of the list of QHs waiting for the next IAAD */
1173 qh->qh_state = QH_STATE_UNLINK; 1181 qh->qh_state = QH_STATE_UNLINK_WAIT;
1174 if (ehci->async_unlink) 1182 if (ehci->async_unlink)
1175 ehci->async_unlink_last->unlink_next = qh; 1183 ehci->async_unlink_last->unlink_next = qh;
1176 else 1184 else
@@ -1213,9 +1221,19 @@ static void start_iaa_cycle(struct ehci_hcd *ehci, bool nested)
1213 1221
1214 /* Do only the first waiting QH (nVidia bug?) */ 1222 /* Do only the first waiting QH (nVidia bug?) */
1215 qh = ehci->async_unlink; 1223 qh = ehci->async_unlink;
1216 ehci->async_iaa = qh; 1224
1217 ehci->async_unlink = qh->unlink_next; 1225 /*
1218 qh->unlink_next = NULL; 1226 * Intel (?) bug: The HC can write back the overlay region
1227 * even after the IAA interrupt occurs. In self-defense,
1228 * always go through two IAA cycles for each QH.
1229 */
1230 if (qh->qh_state == QH_STATE_UNLINK_WAIT) {
1231 qh->qh_state = QH_STATE_UNLINK;
1232 } else {
1233 ehci->async_iaa = qh;
1234 ehci->async_unlink = qh->unlink_next;
1235 qh->unlink_next = NULL;
1236 }
1219 1237
1220 /* Make sure the unlinks are all visible to the hardware */ 1238 /* Make sure the unlinks are all visible to the hardware */
1221 wmb(); 1239 wmb();
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index 45b19e2c60ba..05e51432dd2f 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -7,11 +7,6 @@
7config USB_MUSB_HDRC 7config USB_MUSB_HDRC
8 tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)' 8 tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)'
9 depends on USB && USB_GADGET 9 depends on USB && USB_GADGET
10 select NOP_USB_XCEIV if (ARCH_DAVINCI || MACH_OMAP3EVM || BLACKFIN)
11 select NOP_USB_XCEIV if (SOC_TI81XX || SOC_AM33XX)
12 select TWL4030_USB if MACH_OMAP_3430SDP
13 select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA
14 select OMAP_CONTROL_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA
15 select USB_OTG_UTILS 10 select USB_OTG_UTILS
16 help 11 help
17 Say Y here if your system has a dual role high speed USB 12 Say Y here if your system has a dual role high speed USB
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 60b41cc28da4..daec6e0f7e38 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1624,8 +1624,6 @@ EXPORT_SYMBOL_GPL(musb_dma_completion);
1624 1624
1625/*-------------------------------------------------------------------------*/ 1625/*-------------------------------------------------------------------------*/
1626 1626
1627#ifdef CONFIG_SYSFS
1628
1629static ssize_t 1627static ssize_t
1630musb_mode_show(struct device *dev, struct device_attribute *attr, char *buf) 1628musb_mode_show(struct device *dev, struct device_attribute *attr, char *buf)
1631{ 1629{
@@ -1742,8 +1740,6 @@ static const struct attribute_group musb_attr_group = {
1742 .attrs = musb_attributes, 1740 .attrs = musb_attributes,
1743}; 1741};
1744 1742
1745#endif /* sysfs */
1746
1747/* Only used to provide driver mode change events */ 1743/* Only used to provide driver mode change events */
1748static void musb_irq_work(struct work_struct *data) 1744static void musb_irq_work(struct work_struct *data)
1749{ 1745{
@@ -1968,11 +1964,9 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
1968 if (status < 0) 1964 if (status < 0)
1969 goto fail4; 1965 goto fail4;
1970 1966
1971#ifdef CONFIG_SYSFS
1972 status = sysfs_create_group(&musb->controller->kobj, &musb_attr_group); 1967 status = sysfs_create_group(&musb->controller->kobj, &musb_attr_group);
1973 if (status) 1968 if (status)
1974 goto fail5; 1969 goto fail5;
1975#endif
1976 1970
1977 pm_runtime_put(musb->controller); 1971 pm_runtime_put(musb->controller);
1978 1972
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 1762354fe793..1a42a458f2c4 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -51,7 +51,7 @@ struct omap2430_glue {
51}; 51};
52#define glue_to_musb(g) platform_get_drvdata(g->musb) 52#define glue_to_musb(g) platform_get_drvdata(g->musb)
53 53
54struct omap2430_glue *_glue; 54static struct omap2430_glue *_glue;
55 55
56static struct timer_list musb_idle_timer; 56static struct timer_list musb_idle_timer;
57 57
@@ -237,9 +237,13 @@ void omap_musb_mailbox(enum omap_musb_vbus_id_status status)
237{ 237{
238 struct omap2430_glue *glue = _glue; 238 struct omap2430_glue *glue = _glue;
239 239
240 if (glue && glue_to_musb(glue)) { 240 if (!glue) {
241 glue->status = status; 241 pr_err("%s: musb core is not yet initialized\n", __func__);
242 } else { 242 return;
243 }
244 glue->status = status;
245
246 if (!glue_to_musb(glue)) {
243 pr_err("%s: musb core is not yet ready\n", __func__); 247 pr_err("%s: musb core is not yet ready\n", __func__);
244 return; 248 return;
245 } 249 }
diff --git a/drivers/usb/otg/otg.c b/drivers/usb/otg/otg.c
index e1814397ca3a..2bd03d261a50 100644
--- a/drivers/usb/otg/otg.c
+++ b/drivers/usb/otg/otg.c
@@ -130,7 +130,7 @@ struct usb_phy *usb_get_phy(enum usb_phy_type type)
130 spin_lock_irqsave(&phy_lock, flags); 130 spin_lock_irqsave(&phy_lock, flags);
131 131
132 phy = __usb_find_phy(&phy_list, type); 132 phy = __usb_find_phy(&phy_list, type);
133 if (IS_ERR(phy)) { 133 if (IS_ERR(phy) || !try_module_get(phy->dev->driver->owner)) {
134 pr_err("unable to find transceiver of type %s\n", 134 pr_err("unable to find transceiver of type %s\n",
135 usb_phy_type_string(type)); 135 usb_phy_type_string(type));
136 goto err0; 136 goto err0;
@@ -228,7 +228,7 @@ struct usb_phy *usb_get_phy_dev(struct device *dev, u8 index)
228 spin_lock_irqsave(&phy_lock, flags); 228 spin_lock_irqsave(&phy_lock, flags);
229 229
230 phy = __usb_find_phy_dev(dev, &phy_bind_list, index); 230 phy = __usb_find_phy_dev(dev, &phy_bind_list, index);
231 if (IS_ERR(phy)) { 231 if (IS_ERR(phy) || !try_module_get(phy->dev->driver->owner)) {
232 pr_err("unable to find transceiver\n"); 232 pr_err("unable to find transceiver\n");
233 goto err0; 233 goto err0;
234 } 234 }
@@ -301,8 +301,12 @@ EXPORT_SYMBOL(devm_usb_put_phy);
301 */ 301 */
302void usb_put_phy(struct usb_phy *x) 302void usb_put_phy(struct usb_phy *x)
303{ 303{
304 if (x) 304 if (x) {
305 struct module *owner = x->dev->driver->owner;
306
305 put_device(x->dev); 307 put_device(x->dev);
308 module_put(owner);
309 }
306} 310}
307EXPORT_SYMBOL(usb_put_phy); 311EXPORT_SYMBOL(usb_put_phy);
308 312
diff --git a/drivers/usb/phy/omap-control-usb.c b/drivers/usb/phy/omap-control-usb.c
index 5323b71c3521..1419ceda9759 100644
--- a/drivers/usb/phy/omap-control-usb.c
+++ b/drivers/usb/phy/omap-control-usb.c
@@ -219,32 +219,26 @@ static int omap_control_usb_probe(struct platform_device *pdev)
219 219
220 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, 220 res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
221 "control_dev_conf"); 221 "control_dev_conf");
222 control_usb->dev_conf = devm_request_and_ioremap(&pdev->dev, res); 222 control_usb->dev_conf = devm_ioremap_resource(&pdev->dev, res);
223 if (!control_usb->dev_conf) { 223 if (IS_ERR(control_usb->dev_conf))
224 dev_err(&pdev->dev, "Failed to obtain io memory\n"); 224 return PTR_ERR(control_usb->dev_conf);
225 return -EADDRNOTAVAIL;
226 }
227 225
228 if (control_usb->type == OMAP_CTRL_DEV_TYPE1) { 226 if (control_usb->type == OMAP_CTRL_DEV_TYPE1) {
229 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, 227 res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
230 "otghs_control"); 228 "otghs_control");
231 control_usb->otghs_control = devm_request_and_ioremap( 229 control_usb->otghs_control = devm_ioremap_resource(
232 &pdev->dev, res); 230 &pdev->dev, res);
233 if (!control_usb->otghs_control) { 231 if (IS_ERR(control_usb->otghs_control))
234 dev_err(&pdev->dev, "Failed to obtain io memory\n"); 232 return PTR_ERR(control_usb->otghs_control);
235 return -EADDRNOTAVAIL;
236 }
237 } 233 }
238 234
239 if (control_usb->type == OMAP_CTRL_DEV_TYPE2) { 235 if (control_usb->type == OMAP_CTRL_DEV_TYPE2) {
240 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, 236 res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
241 "phy_power_usb"); 237 "phy_power_usb");
242 control_usb->phy_power = devm_request_and_ioremap( 238 control_usb->phy_power = devm_ioremap_resource(
243 &pdev->dev, res); 239 &pdev->dev, res);
244 if (!control_usb->phy_power) { 240 if (IS_ERR(control_usb->phy_power))
245 dev_dbg(&pdev->dev, "Failed to obtain io memory\n"); 241 return PTR_ERR(control_usb->phy_power);
246 return -EADDRNOTAVAIL;
247 }
248 242
249 control_usb->sys_clk = devm_clk_get(control_usb->dev, 243 control_usb->sys_clk = devm_clk_get(control_usb->dev,
250 "sys_clkin"); 244 "sys_clkin");
diff --git a/drivers/usb/phy/omap-usb3.c b/drivers/usb/phy/omap-usb3.c
index fadc0c2b65bb..a6e60b1e102e 100644
--- a/drivers/usb/phy/omap-usb3.c
+++ b/drivers/usb/phy/omap-usb3.c
@@ -212,11 +212,9 @@ static int omap_usb3_probe(struct platform_device *pdev)
212 } 212 }
213 213
214 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pll_ctrl"); 214 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pll_ctrl");
215 phy->pll_ctrl_base = devm_request_and_ioremap(&pdev->dev, res); 215 phy->pll_ctrl_base = devm_ioremap_resource(&pdev->dev, res);
216 if (!phy->pll_ctrl_base) { 216 if (IS_ERR(phy->pll_ctrl_base))
217 dev_err(&pdev->dev, "ioremap of pll_ctrl failed\n"); 217 return PTR_ERR(phy->pll_ctrl_base);
218 return -ENOMEM;
219 }
220 218
221 phy->dev = &pdev->dev; 219 phy->dev = &pdev->dev;
222 220
diff --git a/drivers/usb/phy/samsung-usbphy.c b/drivers/usb/phy/samsung-usbphy.c
index 6ea553733832..967101ec15fd 100644
--- a/drivers/usb/phy/samsung-usbphy.c
+++ b/drivers/usb/phy/samsung-usbphy.c
@@ -787,11 +787,9 @@ static int samsung_usbphy_probe(struct platform_device *pdev)
787 return -ENODEV; 787 return -ENODEV;
788 } 788 }
789 789
790 phy_base = devm_request_and_ioremap(dev, phy_mem); 790 phy_base = devm_ioremap_resource(dev, phy_mem);
791 if (!phy_base) { 791 if (IS_ERR(phy_base))
792 dev_err(dev, "%s: register mapping failed\n", __func__); 792 return PTR_ERR(phy_base);
793 return -ENXIO;
794 }
795 793
796 sphy = devm_kzalloc(dev, sizeof(*sphy), GFP_KERNEL); 794 sphy = devm_kzalloc(dev, sizeof(*sphy), GFP_KERNEL);
797 if (!sphy) 795 if (!sphy)
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index edc0f0dcad83..4747d1c328ff 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -85,6 +85,7 @@ static const struct usb_device_id id_table[] = {
85 { USB_DEVICE(0x10C4, 0x813F) }, /* Tams Master Easy Control */ 85 { USB_DEVICE(0x10C4, 0x813F) }, /* Tams Master Easy Control */
86 { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */ 86 { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */
87 { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ 87 { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */
88 { USB_DEVICE(0x2405, 0x0003) }, /* West Mountain Radio RIGblaster Advantage */
88 { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */ 89 { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */
89 { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */ 90 { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */
90 { USB_DEVICE(0x10C4, 0x815F) }, /* Timewave HamLinkUSB */ 91 { USB_DEVICE(0x10C4, 0x815F) }, /* Timewave HamLinkUSB */
@@ -150,6 +151,25 @@ static const struct usb_device_id id_table[] = {
150 { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */ 151 { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */
151 { USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */ 152 { USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */
152 { USB_DEVICE(0x1E29, 0x0501) }, /* Festo CMSP */ 153 { USB_DEVICE(0x1E29, 0x0501) }, /* Festo CMSP */
154 { USB_DEVICE(0x1FB9, 0x0100) }, /* Lake Shore Model 121 Current Source */
155 { USB_DEVICE(0x1FB9, 0x0200) }, /* Lake Shore Model 218A Temperature Monitor */
156 { USB_DEVICE(0x1FB9, 0x0201) }, /* Lake Shore Model 219 Temperature Monitor */
157 { USB_DEVICE(0x1FB9, 0x0202) }, /* Lake Shore Model 233 Temperature Transmitter */
158 { USB_DEVICE(0x1FB9, 0x0203) }, /* Lake Shore Model 235 Temperature Transmitter */
159 { USB_DEVICE(0x1FB9, 0x0300) }, /* Lake Shore Model 335 Temperature Controller */
160 { USB_DEVICE(0x1FB9, 0x0301) }, /* Lake Shore Model 336 Temperature Controller */
161 { USB_DEVICE(0x1FB9, 0x0302) }, /* Lake Shore Model 350 Temperature Controller */
162 { USB_DEVICE(0x1FB9, 0x0303) }, /* Lake Shore Model 371 AC Bridge */
163 { USB_DEVICE(0x1FB9, 0x0400) }, /* Lake Shore Model 411 Handheld Gaussmeter */
164 { USB_DEVICE(0x1FB9, 0x0401) }, /* Lake Shore Model 425 Gaussmeter */
165 { USB_DEVICE(0x1FB9, 0x0402) }, /* Lake Shore Model 455A Gaussmeter */
166 { USB_DEVICE(0x1FB9, 0x0403) }, /* Lake Shore Model 475A Gaussmeter */
167 { USB_DEVICE(0x1FB9, 0x0404) }, /* Lake Shore Model 465 Three Axis Gaussmeter */
168 { USB_DEVICE(0x1FB9, 0x0600) }, /* Lake Shore Model 625A Superconducting MPS */
169 { USB_DEVICE(0x1FB9, 0x0601) }, /* Lake Shore Model 642A Magnet Power Supply */
170 { USB_DEVICE(0x1FB9, 0x0602) }, /* Lake Shore Model 648 Magnet Power Supply */
171 { USB_DEVICE(0x1FB9, 0x0700) }, /* Lake Shore Model 737 VSM Controller */
172 { USB_DEVICE(0x1FB9, 0x0701) }, /* Lake Shore Model 776 Hall Matrix */
153 { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */ 173 { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */
154 { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */ 174 { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */
155 { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */ 175 { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index f7d339d8187b..558adfc05007 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -341,6 +341,8 @@ static void option_instat_callback(struct urb *urb);
341#define CINTERION_PRODUCT_EU3_E 0x0051 341#define CINTERION_PRODUCT_EU3_E 0x0051
342#define CINTERION_PRODUCT_EU3_P 0x0052 342#define CINTERION_PRODUCT_EU3_P 0x0052
343#define CINTERION_PRODUCT_PH8 0x0053 343#define CINTERION_PRODUCT_PH8 0x0053
344#define CINTERION_PRODUCT_AH6 0x0055
345#define CINTERION_PRODUCT_PLS8 0x0060
344 346
345/* Olivetti products */ 347/* Olivetti products */
346#define OLIVETTI_VENDOR_ID 0x0b3c 348#define OLIVETTI_VENDOR_ID 0x0b3c
@@ -579,6 +581,7 @@ static const struct usb_device_id option_ids[] = {
579 { USB_DEVICE(QUANTA_VENDOR_ID, 0xea42), 581 { USB_DEVICE(QUANTA_VENDOR_ID, 0xea42),
580 .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, 582 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
581 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c05, USB_CLASS_COMM, 0x02, 0xff) }, 583 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c05, USB_CLASS_COMM, 0x02, 0xff) },
584 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c1f, USB_CLASS_COMM, 0x02, 0xff) },
582 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c23, USB_CLASS_COMM, 0x02, 0xff) }, 585 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c23, USB_CLASS_COMM, 0x02, 0xff) },
583 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E173, 0xff, 0xff, 0xff), 586 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E173, 0xff, 0xff, 0xff),
584 .driver_info = (kernel_ulong_t) &net_intf1_blacklist }, 587 .driver_info = (kernel_ulong_t) &net_intf1_blacklist },
@@ -1260,6 +1263,8 @@ static const struct usb_device_id option_ids[] = {
1260 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) }, 1263 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) },
1261 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) }, 1264 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) },
1262 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8) }, 1265 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8) },
1266 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AH6) },
1267 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PLS8) },
1263 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, 1268 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) },
1264 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, 1269 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) },
1265 { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) }, 1270 { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) },
diff --git a/drivers/usb/serial/qcaux.c b/drivers/usb/serial/qcaux.c
index 9b1b96f2d095..31f81c3c15eb 100644
--- a/drivers/usb/serial/qcaux.c
+++ b/drivers/usb/serial/qcaux.c
@@ -69,6 +69,7 @@ static struct usb_device_id id_table[] = {
69 { USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xfd, 0xff) }, /* NMEA */ 69 { USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xfd, 0xff) }, /* NMEA */
70 { USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xfe, 0xff) }, /* WMC */ 70 { USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xfe, 0xff) }, /* WMC */
71 { USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xff, 0xff) }, /* DIAG */ 71 { USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xff, 0xff) }, /* DIAG */
72 { USB_DEVICE_AND_INTERFACE_INFO(0x1fac, 0x0151, 0xff, 0xff, 0xff) },
72 { }, 73 { },
73}; 74};
74MODULE_DEVICE_TABLE(usb, id_table); 75MODULE_DEVICE_TABLE(usb, id_table);
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
index 24662547dc5b..59b32b782126 100644
--- a/drivers/usb/serial/qcserial.c
+++ b/drivers/usb/serial/qcserial.c
@@ -197,12 +197,15 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
197 197
198 if (is_gobi1k) { 198 if (is_gobi1k) {
199 /* Gobi 1K USB layout: 199 /* Gobi 1K USB layout:
200 * 0: serial port (doesn't respond) 200 * 0: DM/DIAG (use libqcdm from ModemManager for communication)
201 * 1: serial port (doesn't respond) 201 * 1: serial port (doesn't respond)
202 * 2: AT-capable modem port 202 * 2: AT-capable modem port
203 * 3: QMI/net 203 * 3: QMI/net
204 */ 204 */
205 if (ifnum == 2) 205 if (ifnum == 0) {
206 dev_dbg(dev, "Gobi 1K DM/DIAG interface found\n");
207 altsetting = 1;
208 } else if (ifnum == 2)
206 dev_dbg(dev, "Modem port found\n"); 209 dev_dbg(dev, "Modem port found\n");
207 else 210 else
208 altsetting = -1; 211 altsetting = -1;
diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c
index 00e6c9bac8a3..d643a4d4d770 100644
--- a/drivers/usb/serial/quatech2.c
+++ b/drivers/usb/serial/quatech2.c
@@ -661,7 +661,9 @@ void qt2_process_read_urb(struct urb *urb)
661 __func__); 661 __func__);
662 break; 662 break;
663 } 663 }
664 tty_flip_buffer_push(&port->port); 664
665 if (port_priv->is_open)
666 tty_flip_buffer_push(&port->port);
665 667
666 newport = *(ch + 3); 668 newport = *(ch + 3);
667 669
@@ -704,7 +706,8 @@ void qt2_process_read_urb(struct urb *urb)
704 tty_insert_flip_string(&port->port, ch, 1); 706 tty_insert_flip_string(&port->port, ch, 1);
705 } 707 }
706 708
707 tty_flip_buffer_push(&port->port); 709 if (port_priv->is_open)
710 tty_flip_buffer_push(&port->port);
708} 711}
709 712
710static void qt2_write_bulk_callback(struct urb *urb) 713static void qt2_write_bulk_callback(struct urb *urb)
diff --git a/drivers/usb/storage/initializers.c b/drivers/usb/storage/initializers.c
index 7ab9046ae0ec..105d900150c1 100644
--- a/drivers/usb/storage/initializers.c
+++ b/drivers/usb/storage/initializers.c
@@ -92,8 +92,8 @@ int usb_stor_ucr61s2b_init(struct us_data *us)
92 return 0; 92 return 0;
93} 93}
94 94
95/* This places the HUAWEI usb dongles in multi-port mode */ 95/* This places the HUAWEI E220 devices in multi-port mode */
96static int usb_stor_huawei_feature_init(struct us_data *us) 96int usb_stor_huawei_e220_init(struct us_data *us)
97{ 97{
98 int result; 98 int result;
99 99
@@ -104,75 +104,3 @@ static int usb_stor_huawei_feature_init(struct us_data *us)
104 US_DEBUGP("Huawei mode set result is %d\n", result); 104 US_DEBUGP("Huawei mode set result is %d\n", result);
105 return 0; 105 return 0;
106} 106}
107
108/*
109 * It will send a scsi switch command called rewind' to huawei dongle.
110 * When the dongle receives this command at the first time,
111 * it will reboot immediately. After rebooted, it will ignore this command.
112 * So it is unnecessary to read its response.
113 */
114static int usb_stor_huawei_scsi_init(struct us_data *us)
115{
116 int result = 0;
117 int act_len = 0;
118 struct bulk_cb_wrap *bcbw = (struct bulk_cb_wrap *) us->iobuf;
119 char rewind_cmd[] = {0x11, 0x06, 0x20, 0x00, 0x00, 0x01, 0x01, 0x00,
120 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
121
122 bcbw->Signature = cpu_to_le32(US_BULK_CB_SIGN);
123 bcbw->Tag = 0;
124 bcbw->DataTransferLength = 0;
125 bcbw->Flags = bcbw->Lun = 0;
126 bcbw->Length = sizeof(rewind_cmd);
127 memset(bcbw->CDB, 0, sizeof(bcbw->CDB));
128 memcpy(bcbw->CDB, rewind_cmd, sizeof(rewind_cmd));
129
130 result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, bcbw,
131 US_BULK_CB_WRAP_LEN, &act_len);
132 US_DEBUGP("transfer actual length=%d, result=%d\n", act_len, result);
133 return result;
134}
135
136/*
137 * It tries to find the supported Huawei USB dongles.
138 * In Huawei, they assign the following product IDs
139 * for all of their mobile broadband dongles,
140 * including the new dongles in the future.
141 * So if the product ID is not included in this list,
142 * it means it is not Huawei's mobile broadband dongles.
143 */
144static int usb_stor_huawei_dongles_pid(struct us_data *us)
145{
146 struct usb_interface_descriptor *idesc;
147 int idProduct;
148
149 idesc = &us->pusb_intf->cur_altsetting->desc;
150 idProduct = le16_to_cpu(us->pusb_dev->descriptor.idProduct);
151 /* The first port is CDROM,
152 * means the dongle in the single port mode,
153 * and a switch command is required to be sent. */
154 if (idesc && idesc->bInterfaceNumber == 0) {
155 if ((idProduct == 0x1001)
156 || (idProduct == 0x1003)
157 || (idProduct == 0x1004)
158 || (idProduct >= 0x1401 && idProduct <= 0x1500)
159 || (idProduct >= 0x1505 && idProduct <= 0x1600)
160 || (idProduct >= 0x1c02 && idProduct <= 0x2202)) {
161 return 1;
162 }
163 }
164 return 0;
165}
166
167int usb_stor_huawei_init(struct us_data *us)
168{
169 int result = 0;
170
171 if (usb_stor_huawei_dongles_pid(us)) {
172 if (le16_to_cpu(us->pusb_dev->descriptor.idProduct) >= 0x1446)
173 result = usb_stor_huawei_scsi_init(us);
174 else
175 result = usb_stor_huawei_feature_init(us);
176 }
177 return result;
178}
diff --git a/drivers/usb/storage/initializers.h b/drivers/usb/storage/initializers.h
index 5376d4fc76f0..529327fbb06b 100644
--- a/drivers/usb/storage/initializers.h
+++ b/drivers/usb/storage/initializers.h
@@ -46,5 +46,5 @@ int usb_stor_euscsi_init(struct us_data *us);
46 * flash reader */ 46 * flash reader */
47int usb_stor_ucr61s2b_init(struct us_data *us); 47int usb_stor_ucr61s2b_init(struct us_data *us);
48 48
49/* This places the HUAWEI usb dongles in multi-port mode */ 49/* This places the HUAWEI E220 devices in multi-port mode */
50int usb_stor_huawei_init(struct us_data *us); 50int usb_stor_huawei_e220_init(struct us_data *us);
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index 72923b56bbf6..da04a074e790 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -53,6 +53,14 @@
53 * as opposed to devices that do something strangely or wrongly. 53 * as opposed to devices that do something strangely or wrongly.
54 */ 54 */
55 55
56/* In-kernel mode switching is deprecated. Do not add new devices to
57 * this list for the sole purpose of switching them to a different
58 * mode. Existing userspace solutions are superior.
59 *
60 * New mode switching devices should instead be added to the database
61 * maintained at http://www.draisberghof.de/usb_modeswitch/
62 */
63
56#if !defined(CONFIG_USB_STORAGE_SDDR09) && \ 64#if !defined(CONFIG_USB_STORAGE_SDDR09) && \
57 !defined(CONFIG_USB_STORAGE_SDDR09_MODULE) 65 !defined(CONFIG_USB_STORAGE_SDDR09_MODULE)
58#define NO_SDDR09 66#define NO_SDDR09
@@ -1527,10 +1535,335 @@ UNUSUAL_DEV( 0x1210, 0x0003, 0x0100, 0x0100,
1527/* Reported by fangxiaozhi <huananhu@huawei.com> 1535/* Reported by fangxiaozhi <huananhu@huawei.com>
1528 * This brings the HUAWEI data card devices into multi-port mode 1536 * This brings the HUAWEI data card devices into multi-port mode
1529 */ 1537 */
1530UNUSUAL_VENDOR_INTF(0x12d1, 0x08, 0x06, 0x50, 1538UNUSUAL_DEV( 0x12d1, 0x1001, 0x0000, 0x0000,
1539 "HUAWEI MOBILE",
1540 "Mass Storage",
1541 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1542 0),
1543UNUSUAL_DEV( 0x12d1, 0x1003, 0x0000, 0x0000,
1544 "HUAWEI MOBILE",
1545 "Mass Storage",
1546 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1547 0),
1548UNUSUAL_DEV( 0x12d1, 0x1004, 0x0000, 0x0000,
1549 "HUAWEI MOBILE",
1550 "Mass Storage",
1551 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1552 0),
1553UNUSUAL_DEV( 0x12d1, 0x1401, 0x0000, 0x0000,
1554 "HUAWEI MOBILE",
1555 "Mass Storage",
1556 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1557 0),
1558UNUSUAL_DEV( 0x12d1, 0x1402, 0x0000, 0x0000,
1559 "HUAWEI MOBILE",
1560 "Mass Storage",
1561 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1562 0),
1563UNUSUAL_DEV( 0x12d1, 0x1403, 0x0000, 0x0000,
1564 "HUAWEI MOBILE",
1565 "Mass Storage",
1566 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1567 0),
1568UNUSUAL_DEV( 0x12d1, 0x1404, 0x0000, 0x0000,
1569 "HUAWEI MOBILE",
1570 "Mass Storage",
1571 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1572 0),
1573UNUSUAL_DEV( 0x12d1, 0x1405, 0x0000, 0x0000,
1574 "HUAWEI MOBILE",
1575 "Mass Storage",
1576 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1577 0),
1578UNUSUAL_DEV( 0x12d1, 0x1406, 0x0000, 0x0000,
1579 "HUAWEI MOBILE",
1580 "Mass Storage",
1581 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1582 0),
1583UNUSUAL_DEV( 0x12d1, 0x1407, 0x0000, 0x0000,
1584 "HUAWEI MOBILE",
1585 "Mass Storage",
1586 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1587 0),
1588UNUSUAL_DEV( 0x12d1, 0x1408, 0x0000, 0x0000,
1589 "HUAWEI MOBILE",
1590 "Mass Storage",
1591 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1592 0),
1593UNUSUAL_DEV( 0x12d1, 0x1409, 0x0000, 0x0000,
1594 "HUAWEI MOBILE",
1595 "Mass Storage",
1596 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1597 0),
1598UNUSUAL_DEV( 0x12d1, 0x140A, 0x0000, 0x0000,
1599 "HUAWEI MOBILE",
1600 "Mass Storage",
1601 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1602 0),
1603UNUSUAL_DEV( 0x12d1, 0x140B, 0x0000, 0x0000,
1604 "HUAWEI MOBILE",
1605 "Mass Storage",
1606 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1607 0),
1608UNUSUAL_DEV( 0x12d1, 0x140C, 0x0000, 0x0000,
1609 "HUAWEI MOBILE",
1610 "Mass Storage",
1611 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1612 0),
1613UNUSUAL_DEV( 0x12d1, 0x140D, 0x0000, 0x0000,
1614 "HUAWEI MOBILE",
1615 "Mass Storage",
1616 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1617 0),
1618UNUSUAL_DEV( 0x12d1, 0x140E, 0x0000, 0x0000,
1619 "HUAWEI MOBILE",
1620 "Mass Storage",
1621 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1622 0),
1623UNUSUAL_DEV( 0x12d1, 0x140F, 0x0000, 0x0000,
1624 "HUAWEI MOBILE",
1625 "Mass Storage",
1626 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1627 0),
1628UNUSUAL_DEV( 0x12d1, 0x1410, 0x0000, 0x0000,
1629 "HUAWEI MOBILE",
1630 "Mass Storage",
1631 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1632 0),
1633UNUSUAL_DEV( 0x12d1, 0x1411, 0x0000, 0x0000,
1634 "HUAWEI MOBILE",
1635 "Mass Storage",
1636 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1637 0),
1638UNUSUAL_DEV( 0x12d1, 0x1412, 0x0000, 0x0000,
1639 "HUAWEI MOBILE",
1640 "Mass Storage",
1641 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1642 0),
1643UNUSUAL_DEV( 0x12d1, 0x1413, 0x0000, 0x0000,
1644 "HUAWEI MOBILE",
1645 "Mass Storage",
1646 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1647 0),
1648UNUSUAL_DEV( 0x12d1, 0x1414, 0x0000, 0x0000,
1649 "HUAWEI MOBILE",
1650 "Mass Storage",
1651 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1652 0),
1653UNUSUAL_DEV( 0x12d1, 0x1415, 0x0000, 0x0000,
1654 "HUAWEI MOBILE",
1655 "Mass Storage",
1656 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1657 0),
1658UNUSUAL_DEV( 0x12d1, 0x1416, 0x0000, 0x0000,
1659 "HUAWEI MOBILE",
1660 "Mass Storage",
1661 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1662 0),
1663UNUSUAL_DEV( 0x12d1, 0x1417, 0x0000, 0x0000,
1664 "HUAWEI MOBILE",
1665 "Mass Storage",
1666 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1667 0),
1668UNUSUAL_DEV( 0x12d1, 0x1418, 0x0000, 0x0000,
1669 "HUAWEI MOBILE",
1670 "Mass Storage",
1671 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1672 0),
1673UNUSUAL_DEV( 0x12d1, 0x1419, 0x0000, 0x0000,
1674 "HUAWEI MOBILE",
1675 "Mass Storage",
1676 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1677 0),
1678UNUSUAL_DEV( 0x12d1, 0x141A, 0x0000, 0x0000,
1679 "HUAWEI MOBILE",
1680 "Mass Storage",
1681 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1682 0),
1683UNUSUAL_DEV( 0x12d1, 0x141B, 0x0000, 0x0000,
1684 "HUAWEI MOBILE",
1685 "Mass Storage",
1686 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1687 0),
1688UNUSUAL_DEV( 0x12d1, 0x141C, 0x0000, 0x0000,
1689 "HUAWEI MOBILE",
1690 "Mass Storage",
1691 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1692 0),
1693UNUSUAL_DEV( 0x12d1, 0x141D, 0x0000, 0x0000,
1694 "HUAWEI MOBILE",
1695 "Mass Storage",
1696 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1697 0),
1698UNUSUAL_DEV( 0x12d1, 0x141E, 0x0000, 0x0000,
1699 "HUAWEI MOBILE",
1700 "Mass Storage",
1701 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1702 0),
1703UNUSUAL_DEV( 0x12d1, 0x141F, 0x0000, 0x0000,
1704 "HUAWEI MOBILE",
1705 "Mass Storage",
1706 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1707 0),
1708UNUSUAL_DEV( 0x12d1, 0x1420, 0x0000, 0x0000,
1709 "HUAWEI MOBILE",
1710 "Mass Storage",
1711 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1712 0),
1713UNUSUAL_DEV( 0x12d1, 0x1421, 0x0000, 0x0000,
1714 "HUAWEI MOBILE",
1715 "Mass Storage",
1716 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1717 0),
1718UNUSUAL_DEV( 0x12d1, 0x1422, 0x0000, 0x0000,
1719 "HUAWEI MOBILE",
1720 "Mass Storage",
1721 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1722 0),
1723UNUSUAL_DEV( 0x12d1, 0x1423, 0x0000, 0x0000,
1724 "HUAWEI MOBILE",
1725 "Mass Storage",
1726 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1727 0),
1728UNUSUAL_DEV( 0x12d1, 0x1424, 0x0000, 0x0000,
1729 "HUAWEI MOBILE",
1730 "Mass Storage",
1731 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1732 0),
1733UNUSUAL_DEV( 0x12d1, 0x1425, 0x0000, 0x0000,
1734 "HUAWEI MOBILE",
1735 "Mass Storage",
1736 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1737 0),
1738UNUSUAL_DEV( 0x12d1, 0x1426, 0x0000, 0x0000,
1739 "HUAWEI MOBILE",
1740 "Mass Storage",
1741 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1742 0),
1743UNUSUAL_DEV( 0x12d1, 0x1427, 0x0000, 0x0000,
1744 "HUAWEI MOBILE",
1745 "Mass Storage",
1746 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1747 0),
1748UNUSUAL_DEV( 0x12d1, 0x1428, 0x0000, 0x0000,
1749 "HUAWEI MOBILE",
1750 "Mass Storage",
1751 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1752 0),
1753UNUSUAL_DEV( 0x12d1, 0x1429, 0x0000, 0x0000,
1754 "HUAWEI MOBILE",
1755 "Mass Storage",
1756 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1757 0),
1758UNUSUAL_DEV( 0x12d1, 0x142A, 0x0000, 0x0000,
1759 "HUAWEI MOBILE",
1760 "Mass Storage",
1761 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1762 0),
1763UNUSUAL_DEV( 0x12d1, 0x142B, 0x0000, 0x0000,
1764 "HUAWEI MOBILE",
1765 "Mass Storage",
1766 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1767 0),
1768UNUSUAL_DEV( 0x12d1, 0x142C, 0x0000, 0x0000,
1769 "HUAWEI MOBILE",
1770 "Mass Storage",
1771 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1772 0),
1773UNUSUAL_DEV( 0x12d1, 0x142D, 0x0000, 0x0000,
1774 "HUAWEI MOBILE",
1775 "Mass Storage",
1776 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1777 0),
1778UNUSUAL_DEV( 0x12d1, 0x142E, 0x0000, 0x0000,
1779 "HUAWEI MOBILE",
1780 "Mass Storage",
1781 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1782 0),
1783UNUSUAL_DEV( 0x12d1, 0x142F, 0x0000, 0x0000,
1784 "HUAWEI MOBILE",
1785 "Mass Storage",
1786 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1787 0),
1788UNUSUAL_DEV( 0x12d1, 0x1430, 0x0000, 0x0000,
1789 "HUAWEI MOBILE",
1790 "Mass Storage",
1791 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1792 0),
1793UNUSUAL_DEV( 0x12d1, 0x1431, 0x0000, 0x0000,
1794 "HUAWEI MOBILE",
1795 "Mass Storage",
1796 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1797 0),
1798UNUSUAL_DEV( 0x12d1, 0x1432, 0x0000, 0x0000,
1799 "HUAWEI MOBILE",
1800 "Mass Storage",
1801 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1802 0),
1803UNUSUAL_DEV( 0x12d1, 0x1433, 0x0000, 0x0000,
1804 "HUAWEI MOBILE",
1805 "Mass Storage",
1806 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1807 0),
1808UNUSUAL_DEV( 0x12d1, 0x1434, 0x0000, 0x0000,
1809 "HUAWEI MOBILE",
1810 "Mass Storage",
1811 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1812 0),
1813UNUSUAL_DEV( 0x12d1, 0x1435, 0x0000, 0x0000,
1814 "HUAWEI MOBILE",
1815 "Mass Storage",
1816 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1817 0),
1818UNUSUAL_DEV( 0x12d1, 0x1436, 0x0000, 0x0000,
1819 "HUAWEI MOBILE",
1820 "Mass Storage",
1821 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1822 0),
1823UNUSUAL_DEV( 0x12d1, 0x1437, 0x0000, 0x0000,
1824 "HUAWEI MOBILE",
1825 "Mass Storage",
1826 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1827 0),
1828UNUSUAL_DEV( 0x12d1, 0x1438, 0x0000, 0x0000,
1829 "HUAWEI MOBILE",
1830 "Mass Storage",
1831 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1832 0),
1833UNUSUAL_DEV( 0x12d1, 0x1439, 0x0000, 0x0000,
1834 "HUAWEI MOBILE",
1835 "Mass Storage",
1836 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1837 0),
1838UNUSUAL_DEV( 0x12d1, 0x143A, 0x0000, 0x0000,
1839 "HUAWEI MOBILE",
1840 "Mass Storage",
1841 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1842 0),
1843UNUSUAL_DEV( 0x12d1, 0x143B, 0x0000, 0x0000,
1844 "HUAWEI MOBILE",
1845 "Mass Storage",
1846 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1847 0),
1848UNUSUAL_DEV( 0x12d1, 0x143C, 0x0000, 0x0000,
1849 "HUAWEI MOBILE",
1850 "Mass Storage",
1851 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1852 0),
1853UNUSUAL_DEV( 0x12d1, 0x143D, 0x0000, 0x0000,
1854 "HUAWEI MOBILE",
1855 "Mass Storage",
1856 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1857 0),
1858UNUSUAL_DEV( 0x12d1, 0x143E, 0x0000, 0x0000,
1859 "HUAWEI MOBILE",
1860 "Mass Storage",
1861 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1862 0),
1863UNUSUAL_DEV( 0x12d1, 0x143F, 0x0000, 0x0000,
1531 "HUAWEI MOBILE", 1864 "HUAWEI MOBILE",
1532 "Mass Storage", 1865 "Mass Storage",
1533 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_init, 1866 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1534 0), 1867 0),
1535 1868
1536/* Reported by Vilius Bilinkevicius <vilisas AT xxx DOT lt) */ 1869/* Reported by Vilius Bilinkevicius <vilisas AT xxx DOT lt) */
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 959b1cd89e6a..ec6fb3fa59bb 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -339,7 +339,8 @@ static void handle_tx(struct vhost_net *net)
339 msg.msg_controllen = 0; 339 msg.msg_controllen = 0;
340 ubufs = NULL; 340 ubufs = NULL;
341 } else { 341 } else {
342 struct ubuf_info *ubuf = &vq->ubuf_info[head]; 342 struct ubuf_info *ubuf;
343 ubuf = vq->ubuf_info + vq->upend_idx;
343 344
344 vq->heads[vq->upend_idx].len = 345 vq->heads[vq->upend_idx].len =
345 VHOST_DMA_IN_PROGRESS; 346 VHOST_DMA_IN_PROGRESS;
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index 12cf5f31ee8f..025428e04c33 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -422,17 +422,22 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var,
422 = var->bits_per_pixel; 422 = var->bits_per_pixel;
423 break; 423 break;
424 case 16: 424 case 16:
425 /* Older SOCs use IBGR:555 rather than BGR:565. */
426 if (sinfo->have_intensity_bit)
427 var->green.length = 5;
428 else
429 var->green.length = 6;
430
425 if (sinfo->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) { 431 if (sinfo->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) {
426 /* RGB:565 mode */ 432 /* RGB:5X5 mode */
427 var->red.offset = 11; 433 var->red.offset = var->green.length + 5;
428 var->blue.offset = 0; 434 var->blue.offset = 0;
429 } else { 435 } else {
430 /* BGR:565 mode */ 436 /* BGR:5X5 mode */
431 var->red.offset = 0; 437 var->red.offset = 0;
432 var->blue.offset = 11; 438 var->blue.offset = var->green.length + 5;
433 } 439 }
434 var->green.offset = 5; 440 var->green.offset = 5;
435 var->green.length = 6;
436 var->red.length = var->blue.length = 5; 441 var->red.length = var->blue.length = 5;
437 break; 442 break;
438 case 32: 443 case 32:
@@ -679,8 +684,7 @@ static int atmel_lcdfb_setcolreg(unsigned int regno, unsigned int red,
679 684
680 case FB_VISUAL_PSEUDOCOLOR: 685 case FB_VISUAL_PSEUDOCOLOR:
681 if (regno < 256) { 686 if (regno < 256) {
682 if (cpu_is_at91sam9261() || cpu_is_at91sam9263() 687 if (sinfo->have_intensity_bit) {
683 || cpu_is_at91sam9rl()) {
684 /* old style I+BGR:555 */ 688 /* old style I+BGR:555 */
685 val = ((red >> 11) & 0x001f); 689 val = ((red >> 11) & 0x001f);
686 val |= ((green >> 6) & 0x03e0); 690 val |= ((green >> 6) & 0x03e0);
@@ -870,6 +874,10 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
870 } 874 }
871 sinfo->info = info; 875 sinfo->info = info;
872 sinfo->pdev = pdev; 876 sinfo->pdev = pdev;
877 if (cpu_is_at91sam9261() || cpu_is_at91sam9263() ||
878 cpu_is_at91sam9rl()) {
879 sinfo->have_intensity_bit = true;
880 }
873 881
874 strcpy(info->fix.id, sinfo->pdev->name); 882 strcpy(info->fix.id, sinfo->pdev->name);
875 info->flags = ATMEL_LCDFB_FBINFO_DEFAULT; 883 info->flags = ATMEL_LCDFB_FBINFO_DEFAULT;
diff --git a/drivers/video/omap/lcd_ams_delta.c b/drivers/video/omap/lcd_ams_delta.c
index ed4cad87fbcd..4a5f2cd3d3bf 100644
--- a/drivers/video/omap/lcd_ams_delta.c
+++ b/drivers/video/omap/lcd_ams_delta.c
@@ -27,6 +27,7 @@
27#include <linux/lcd.h> 27#include <linux/lcd.h>
28#include <linux/gpio.h> 28#include <linux/gpio.h>
29 29
30#include <mach/hardware.h>
30#include <mach/board-ams-delta.h> 31#include <mach/board-ams-delta.h>
31 32
32#include "omapfb.h" 33#include "omapfb.h"
diff --git a/drivers/video/omap/lcd_osk.c b/drivers/video/omap/lcd_osk.c
index 3aa62da89195..7fbe04bce0ed 100644
--- a/drivers/video/omap/lcd_osk.c
+++ b/drivers/video/omap/lcd_osk.c
@@ -24,7 +24,10 @@
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25 25
26#include <asm/gpio.h> 26#include <asm/gpio.h>
27
28#include <mach/hardware.h>
27#include <mach/mux.h> 29#include <mach/mux.h>
30
28#include "omapfb.h" 31#include "omapfb.h"
29 32
30static int osk_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev) 33static int osk_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev)
diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c
index d39dfa4cc235..46d97014342e 100644
--- a/drivers/w1/masters/w1-gpio.c
+++ b/drivers/w1/masters/w1-gpio.c
@@ -47,11 +47,13 @@ static u8 w1_gpio_read_bit(void *data)
47 return gpio_get_value(pdata->pin) ? 1 : 0; 47 return gpio_get_value(pdata->pin) ? 1 : 0;
48} 48}
49 49
50#if defined(CONFIG_OF)
50static struct of_device_id w1_gpio_dt_ids[] = { 51static struct of_device_id w1_gpio_dt_ids[] = {
51 { .compatible = "w1-gpio" }, 52 { .compatible = "w1-gpio" },
52 {} 53 {}
53}; 54};
54MODULE_DEVICE_TABLE(of, w1_gpio_dt_ids); 55MODULE_DEVICE_TABLE(of, w1_gpio_dt_ids);
56#endif
55 57
56static int w1_gpio_probe_dt(struct platform_device *pdev) 58static int w1_gpio_probe_dt(struct platform_device *pdev)
57{ 59{
@@ -158,7 +160,7 @@ static int w1_gpio_probe(struct platform_device *pdev)
158 return err; 160 return err;
159} 161}
160 162
161static int __exit w1_gpio_remove(struct platform_device *pdev) 163static int w1_gpio_remove(struct platform_device *pdev)
162{ 164{
163 struct w1_bus_master *master = platform_get_drvdata(pdev); 165 struct w1_bus_master *master = platform_get_drvdata(pdev);
164 struct w1_gpio_platform_data *pdata = pdev->dev.platform_data; 166 struct w1_gpio_platform_data *pdata = pdev->dev.platform_data;
@@ -210,7 +212,7 @@ static struct platform_driver w1_gpio_driver = {
210 .of_match_table = of_match_ptr(w1_gpio_dt_ids), 212 .of_match_table = of_match_ptr(w1_gpio_dt_ids),
211 }, 213 },
212 .probe = w1_gpio_probe, 214 .probe = w1_gpio_probe,
213 .remove = __exit_p(w1_gpio_remove), 215 .remove = w1_gpio_remove,
214 .suspend = w1_gpio_suspend, 216 .suspend = w1_gpio_suspend,
215 .resume = w1_gpio_resume, 217 .resume = w1_gpio_resume,
216}; 218};
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 7994d933f040..7ce277d2bb67 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -924,7 +924,8 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb
924 tmp64 = (triplet_ret >> 2); 924 tmp64 = (triplet_ret >> 2);
925 rn |= (tmp64 << i); 925 rn |= (tmp64 << i);
926 926
927 if (kthread_should_stop()) { 927 /* ensure we're called from kthread and not by netlink callback */
928 if (!dev->priv && kthread_should_stop()) {
928 mutex_unlock(&dev->bus_mutex); 929 mutex_unlock(&dev->bus_mutex);
929 dev_dbg(&dev->dev, "Abort w1_search\n"); 930 dev_dbg(&dev->dev, "Abort w1_search\n");
930 return; 931 return;
diff --git a/drivers/xen/xen-acpi-processor.c b/drivers/xen/xen-acpi-processor.c
index 316df65163cf..f3278a6603ca 100644
--- a/drivers/xen/xen-acpi-processor.c
+++ b/drivers/xen/xen-acpi-processor.c
@@ -500,16 +500,16 @@ static int __init xen_acpi_processor_init(void)
500 (void)acpi_processor_preregister_performance(acpi_perf_data); 500 (void)acpi_processor_preregister_performance(acpi_perf_data);
501 501
502 for_each_possible_cpu(i) { 502 for_each_possible_cpu(i) {
503 struct acpi_processor *pr;
503 struct acpi_processor_performance *perf; 504 struct acpi_processor_performance *perf;
504 505
506 pr = per_cpu(processors, i);
505 perf = per_cpu_ptr(acpi_perf_data, i); 507 perf = per_cpu_ptr(acpi_perf_data, i);
506 rc = acpi_processor_register_performance(perf, i); 508 pr->performance = perf;
509 rc = acpi_processor_get_performance_info(pr);
507 if (rc) 510 if (rc)
508 goto err_out; 511 goto err_out;
509 } 512 }
510 rc = acpi_processor_notify_smm(THIS_MODULE);
511 if (rc)
512 goto err_unregister;
513 513
514 for_each_possible_cpu(i) { 514 for_each_possible_cpu(i) {
515 struct acpi_processor *_pr; 515 struct acpi_processor *_pr;
diff --git a/drivers/xen/xen-pciback/pciback_ops.c b/drivers/xen/xen-pciback/pciback_ops.c
index 37c1f825f513..b98cf0c35725 100644
--- a/drivers/xen/xen-pciback/pciback_ops.c
+++ b/drivers/xen/xen-pciback/pciback_ops.c
@@ -113,7 +113,8 @@ void xen_pcibk_reset_device(struct pci_dev *dev)
113 if (dev->msi_enabled) 113 if (dev->msi_enabled)
114 pci_disable_msi(dev); 114 pci_disable_msi(dev);
115#endif 115#endif
116 pci_disable_device(dev); 116 if (pci_is_enabled(dev))
117 pci_disable_device(dev);
117 118
118 pci_write_config_word(dev, PCI_COMMAND, 0); 119 pci_write_config_word(dev, PCI_COMMAND, 0);
119 120
diff --git a/drivers/xen/xen-stub.c b/drivers/xen/xen-stub.c
index d85e411cbf89..bbef194c5b01 100644
--- a/drivers/xen/xen-stub.c
+++ b/drivers/xen/xen-stub.c
@@ -25,7 +25,6 @@
25#include <linux/export.h> 25#include <linux/export.h>
26#include <linux/types.h> 26#include <linux/types.h>
27#include <linux/acpi.h> 27#include <linux/acpi.h>
28#include <acpi/acpi_drivers.h>
29#include <xen/acpi.h> 28#include <xen/acpi.h>
30 29
31#ifdef CONFIG_ACPI 30#ifdef CONFIG_ACPI
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 3e074dab2d57..9ac2eca681eb 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -1467,8 +1467,11 @@ int lookup_inline_extent_backref(struct btrfs_trans_handle *trans,
1467 if (ret && !insert) { 1467 if (ret && !insert) {
1468 err = -ENOENT; 1468 err = -ENOENT;
1469 goto out; 1469 goto out;
1470 } else if (ret) {
1471 err = -EIO;
1472 WARN_ON(1);
1473 goto out;
1470 } 1474 }
1471 BUG_ON(ret); /* Corruption */
1472 1475
1473 leaf = path->nodes[0]; 1476 leaf = path->nodes[0];
1474 item_size = btrfs_item_size_nr(leaf, path->slots[0]); 1477 item_size = btrfs_item_size_nr(leaf, path->slots[0]);
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index af1d0605a5c1..5b4ea5f55b8f 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -591,6 +591,7 @@ void btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
591 } 591 }
592 compressed = test_bit(EXTENT_FLAG_COMPRESSED, &em->flags); 592 compressed = test_bit(EXTENT_FLAG_COMPRESSED, &em->flags);
593 clear_bit(EXTENT_FLAG_PINNED, &em->flags); 593 clear_bit(EXTENT_FLAG_PINNED, &em->flags);
594 clear_bit(EXTENT_FLAG_LOGGING, &flags);
594 remove_extent_mapping(em_tree, em); 595 remove_extent_mapping(em_tree, em);
595 if (no_splits) 596 if (no_splits)
596 goto next; 597 goto next;
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index d1470adca8f8..ca1b767d51f7 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2312,6 +2312,7 @@ again:
2312 key.type = BTRFS_EXTENT_DATA_KEY; 2312 key.type = BTRFS_EXTENT_DATA_KEY;
2313 key.offset = start; 2313 key.offset = start;
2314 2314
2315 path->leave_spinning = 1;
2315 if (merge) { 2316 if (merge) {
2316 struct btrfs_file_extent_item *fi; 2317 struct btrfs_file_extent_item *fi;
2317 u64 extent_len; 2318 u64 extent_len;
@@ -2368,6 +2369,7 @@ again:
2368 2369
2369 btrfs_mark_buffer_dirty(leaf); 2370 btrfs_mark_buffer_dirty(leaf);
2370 inode_add_bytes(inode, len); 2371 inode_add_bytes(inode, len);
2372 btrfs_release_path(path);
2371 2373
2372 ret = btrfs_inc_extent_ref(trans, root, new->bytenr, 2374 ret = btrfs_inc_extent_ref(trans, root, new->bytenr,
2373 new->disk_len, 0, 2375 new->disk_len, 0,
@@ -2381,6 +2383,7 @@ again:
2381 ret = 1; 2383 ret = 1;
2382out_free_path: 2384out_free_path:
2383 btrfs_release_path(path); 2385 btrfs_release_path(path);
2386 path->leave_spinning = 0;
2384 btrfs_end_transaction(trans, root); 2387 btrfs_end_transaction(trans, root);
2385out_unlock: 2388out_unlock:
2386 unlock_extent_cached(&BTRFS_I(inode)->io_tree, lock_start, lock_end, 2389 unlock_extent_cached(&BTRFS_I(inode)->io_tree, lock_start, lock_end,
diff --git a/fs/btrfs/locking.h b/fs/btrfs/locking.h
index ca52681e5f40..b81e0e9a4894 100644
--- a/fs/btrfs/locking.h
+++ b/fs/btrfs/locking.h
@@ -26,7 +26,6 @@
26 26
27void btrfs_tree_lock(struct extent_buffer *eb); 27void btrfs_tree_lock(struct extent_buffer *eb);
28void btrfs_tree_unlock(struct extent_buffer *eb); 28void btrfs_tree_unlock(struct extent_buffer *eb);
29int btrfs_try_spin_lock(struct extent_buffer *eb);
30 29
31void btrfs_tree_read_lock(struct extent_buffer *eb); 30void btrfs_tree_read_lock(struct extent_buffer *eb);
32void btrfs_tree_read_unlock(struct extent_buffer *eb); 31void btrfs_tree_read_unlock(struct extent_buffer *eb);
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index aee4b1cc3d98..5471e47d6559 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -1525,21 +1525,23 @@ int btrfs_qgroup_reserve(struct btrfs_root *root, u64 num_bytes)
1525 1525
1526 if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_RFER) && 1526 if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_RFER) &&
1527 qg->reserved + qg->rfer + num_bytes > 1527 qg->reserved + qg->rfer + num_bytes >
1528 qg->max_rfer) 1528 qg->max_rfer) {
1529 ret = -EDQUOT; 1529 ret = -EDQUOT;
1530 goto out;
1531 }
1530 1532
1531 if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_EXCL) && 1533 if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_EXCL) &&
1532 qg->reserved + qg->excl + num_bytes > 1534 qg->reserved + qg->excl + num_bytes >
1533 qg->max_excl) 1535 qg->max_excl) {
1534 ret = -EDQUOT; 1536 ret = -EDQUOT;
1537 goto out;
1538 }
1535 1539
1536 list_for_each_entry(glist, &qg->groups, next_group) { 1540 list_for_each_entry(glist, &qg->groups, next_group) {
1537 ulist_add(ulist, glist->group->qgroupid, 1541 ulist_add(ulist, glist->group->qgroupid,
1538 (uintptr_t)glist->group, GFP_ATOMIC); 1542 (uintptr_t)glist->group, GFP_ATOMIC);
1539 } 1543 }
1540 } 1544 }
1541 if (ret)
1542 goto out;
1543 1545
1544 /* 1546 /*
1545 * no limits exceeded, now record the reservation into all qgroups 1547 * no limits exceeded, now record the reservation into all qgroups
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 9250b9c4f01e..50767bbaad6c 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -625,14 +625,13 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
625 625
626 btrfs_trans_release_metadata(trans, root); 626 btrfs_trans_release_metadata(trans, root);
627 trans->block_rsv = NULL; 627 trans->block_rsv = NULL;
628 /*
629 * the same root has to be passed to start_transaction and
630 * end_transaction. Subvolume quota depends on this.
631 */
632 WARN_ON(trans->root != root);
633 628
634 if (trans->qgroup_reserved) { 629 if (trans->qgroup_reserved) {
635 btrfs_qgroup_free(root, trans->qgroup_reserved); 630 /*
631 * the same root has to be passed here between start_transaction
632 * and end_transaction. Subvolume quota depends on this.
633 */
634 btrfs_qgroup_free(trans->root, trans->qgroup_reserved);
636 trans->qgroup_reserved = 0; 635 trans->qgroup_reserved = 0;
637 } 636 }
638 637
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 6b9cff42265d..5989a92236f7 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -684,6 +684,12 @@ int btrfs_close_devices(struct btrfs_fs_devices *fs_devices)
684 __btrfs_close_devices(fs_devices); 684 __btrfs_close_devices(fs_devices);
685 free_fs_devices(fs_devices); 685 free_fs_devices(fs_devices);
686 } 686 }
687 /*
688 * Wait for rcu kworkers under __btrfs_close_devices
689 * to finish all blkdev_puts so device is really
690 * free when umount is done.
691 */
692 rcu_barrier();
687 return ret; 693 return ret;
688} 694}
689 695
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 1a052c0eee8e..3cf8a15af916 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -777,6 +777,7 @@ struct file_system_type cifs_fs_type = {
777 .kill_sb = cifs_kill_sb, 777 .kill_sb = cifs_kill_sb,
778 /* .fs_flags */ 778 /* .fs_flags */
779}; 779};
780MODULE_ALIAS_FS("cifs");
780const struct inode_operations cifs_dir_inode_ops = { 781const struct inode_operations cifs_dir_inode_ops = {
781 .create = cifs_create, 782 .create = cifs_create,
782 .atomic_open = cifs_atomic_open, 783 .atomic_open = cifs_atomic_open,
diff --git a/fs/compat.c b/fs/compat.c
index fe40fde29111..d487985dd0ea 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -558,6 +558,10 @@ ssize_t compat_rw_copy_check_uvector(int type,
558 } 558 }
559 *ret_pointer = iov; 559 *ret_pointer = iov;
560 560
561 ret = -EFAULT;
562 if (!access_ok(VERIFY_READ, uvector, nr_segs*sizeof(*uvector)))
563 goto out;
564
561 /* 565 /*
562 * Single unix specification: 566 * Single unix specification:
563 * We should -EINVAL if an element length is not >= 0 and fitting an 567 * We should -EINVAL if an element length is not >= 0 and fitting an
@@ -1080,17 +1084,12 @@ static ssize_t compat_do_readv_writev(int type, struct file *file,
1080 if (!file->f_op) 1084 if (!file->f_op)
1081 goto out; 1085 goto out;
1082 1086
1083 ret = -EFAULT; 1087 ret = compat_rw_copy_check_uvector(type, uvector, nr_segs,
1084 if (!access_ok(VERIFY_READ, uvector, nr_segs*sizeof(*uvector)))
1085 goto out;
1086
1087 tot_len = compat_rw_copy_check_uvector(type, uvector, nr_segs,
1088 UIO_FASTIOV, iovstack, &iov); 1088 UIO_FASTIOV, iovstack, &iov);
1089 if (tot_len == 0) { 1089 if (ret <= 0)
1090 ret = 0;
1091 goto out; 1090 goto out;
1092 }
1093 1091
1092 tot_len = ret;
1094 ret = rw_verify_area(type, file, pos, tot_len); 1093 ret = rw_verify_area(type, file, pos, tot_len);
1095 if (ret < 0) 1094 if (ret < 0)
1096 goto out; 1095 goto out;
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
index 8f370e012e61..7cadd823bb31 100644
--- a/fs/ext2/ialloc.c
+++ b/fs/ext2/ialloc.c
@@ -118,7 +118,6 @@ void ext2_free_inode (struct inode * inode)
118 * as writing the quota to disk may need the lock as well. 118 * as writing the quota to disk may need the lock as well.
119 */ 119 */
120 /* Quota is already initialized in iput() */ 120 /* Quota is already initialized in iput() */
121 ext2_xattr_delete_inode(inode);
122 dquot_free_inode(inode); 121 dquot_free_inode(inode);
123 dquot_drop(inode); 122 dquot_drop(inode);
124 123
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index c3881e56662e..fe60cc1117d8 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -34,6 +34,7 @@
34#include "ext2.h" 34#include "ext2.h"
35#include "acl.h" 35#include "acl.h"
36#include "xip.h" 36#include "xip.h"
37#include "xattr.h"
37 38
38static int __ext2_write_inode(struct inode *inode, int do_sync); 39static int __ext2_write_inode(struct inode *inode, int do_sync);
39 40
@@ -88,6 +89,7 @@ void ext2_evict_inode(struct inode * inode)
88 inode->i_size = 0; 89 inode->i_size = 0;
89 if (inode->i_blocks) 90 if (inode->i_blocks)
90 ext2_truncate_blocks(inode, 0); 91 ext2_truncate_blocks(inode, 0);
92 ext2_xattr_delete_inode(inode);
91 } 93 }
92 94
93 invalidate_inode_buffers(inode); 95 invalidate_inode_buffers(inode);
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 1d6e2ed85322..fb5120a5505c 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -353,7 +353,7 @@ static struct block_device *ext3_blkdev_get(dev_t dev, struct super_block *sb)
353 return bdev; 353 return bdev;
354 354
355fail: 355fail:
356 ext3_msg(sb, "error: failed to open journal device %s: %ld", 356 ext3_msg(sb, KERN_ERR, "error: failed to open journal device %s: %ld",
357 __bdevname(dev, b), PTR_ERR(bdev)); 357 __bdevname(dev, b), PTR_ERR(bdev));
358 358
359 return NULL; 359 return NULL;
@@ -887,7 +887,7 @@ static ext3_fsblk_t get_sb_block(void **data, struct super_block *sb)
887 /*todo: use simple_strtoll with >32bit ext3 */ 887 /*todo: use simple_strtoll with >32bit ext3 */
888 sb_block = simple_strtoul(options, &options, 0); 888 sb_block = simple_strtoul(options, &options, 0);
889 if (*options && *options != ',') { 889 if (*options && *options != ',') {
890 ext3_msg(sb, "error: invalid sb specification: %s", 890 ext3_msg(sb, KERN_ERR, "error: invalid sb specification: %s",
891 (char *) *data); 891 (char *) *data);
892 return 1; 892 return 1;
893 } 893 }
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 34e855219231..b3818b48f418 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -91,6 +91,7 @@ static struct file_system_type ext2_fs_type = {
91 .fs_flags = FS_REQUIRES_DEV, 91 .fs_flags = FS_REQUIRES_DEV,
92}; 92};
93MODULE_ALIAS_FS("ext2"); 93MODULE_ALIAS_FS("ext2");
94MODULE_ALIAS("ext2");
94#define IS_EXT2_SB(sb) ((sb)->s_bdev->bd_holder == &ext2_fs_type) 95#define IS_EXT2_SB(sb) ((sb)->s_bdev->bd_holder == &ext2_fs_type)
95#else 96#else
96#define IS_EXT2_SB(sb) (0) 97#define IS_EXT2_SB(sb) (0)
@@ -106,6 +107,7 @@ static struct file_system_type ext3_fs_type = {
106 .fs_flags = FS_REQUIRES_DEV, 107 .fs_flags = FS_REQUIRES_DEV,
107}; 108};
108MODULE_ALIAS_FS("ext3"); 109MODULE_ALIAS_FS("ext3");
110MODULE_ALIAS("ext3");
109#define IS_EXT3_SB(sb) ((sb)->s_bdev->bd_holder == &ext3_fs_type) 111#define IS_EXT3_SB(sb) ((sb)->s_bdev->bd_holder == &ext3_fs_type)
110#else 112#else
111#define IS_EXT3_SB(sb) (0) 113#define IS_EXT3_SB(sb) (0)
diff --git a/fs/freevxfs/vxfs_super.c b/fs/freevxfs/vxfs_super.c
index 455074308069..e37eb274e492 100644
--- a/fs/freevxfs/vxfs_super.c
+++ b/fs/freevxfs/vxfs_super.c
@@ -258,6 +258,7 @@ static struct file_system_type vxfs_fs_type = {
258 .fs_flags = FS_REQUIRES_DEV, 258 .fs_flags = FS_REQUIRES_DEV,
259}; 259};
260MODULE_ALIAS_FS("vxfs"); /* makes mount -t vxfs autoload the module */ 260MODULE_ALIAS_FS("vxfs"); /* makes mount -t vxfs autoload the module */
261MODULE_ALIAS("vxfs");
261 262
262static int __init 263static int __init
263vxfs_init(void) 264vxfs_init(void)
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 178b90c229b5..0f6e52d22b84 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -986,6 +986,7 @@ static struct file_system_type hostfs_type = {
986 .kill_sb = hostfs_kill_sb, 986 .kill_sb = hostfs_kill_sb,
987 .fs_flags = 0, 987 .fs_flags = 0,
988}; 988};
989MODULE_ALIAS_FS("hostfs");
989 990
990static int __init init_hostfs(void) 991static int __init init_hostfs(void)
991{ 992{
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c
index a3076228523d..a0617e706957 100644
--- a/fs/hpfs/super.c
+++ b/fs/hpfs/super.c
@@ -688,6 +688,7 @@ static struct file_system_type hpfs_fs_type = {
688 .kill_sb = kill_block_super, 688 .kill_sb = kill_block_super,
689 .fs_flags = FS_REQUIRES_DEV, 689 .fs_flags = FS_REQUIRES_DEV,
690}; 690};
691MODULE_ALIAS_FS("hpfs");
691 692
692static int __init init_hpfs_fs(void) 693static int __init init_hpfs_fs(void)
693{ 694{
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index a67f16e846a2..d9b8aebdeb22 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -1557,6 +1557,7 @@ static struct file_system_type iso9660_fs_type = {
1557 .fs_flags = FS_REQUIRES_DEV, 1557 .fs_flags = FS_REQUIRES_DEV,
1558}; 1558};
1559MODULE_ALIAS_FS("iso9660"); 1559MODULE_ALIAS_FS("iso9660");
1560MODULE_ALIAS("iso9660");
1560 1561
1561static int __init init_iso9660_fs(void) 1562static int __init init_iso9660_fs(void)
1562{ 1563{
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 95cdcb208dfb..2f8a29db0f1b 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -335,6 +335,7 @@ struct file_system_type nfs4_fs_type = {
335 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_BINARY_MOUNTDATA, 335 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_BINARY_MOUNTDATA,
336}; 336};
337MODULE_ALIAS_FS("nfs4"); 337MODULE_ALIAS_FS("nfs4");
338MODULE_ALIAS("nfs4");
338EXPORT_SYMBOL_GPL(nfs4_fs_type); 339EXPORT_SYMBOL_GPL(nfs4_fs_type);
339 340
340static int __init register_nfs4_fs(void) 341static int __init register_nfs4_fs(void)
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 16d39c6c4fbb..2e27430b9070 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -230,37 +230,6 @@ static void nfs4_file_put_access(struct nfs4_file *fp, int oflag)
230 __nfs4_file_put_access(fp, oflag); 230 __nfs4_file_put_access(fp, oflag);
231} 231}
232 232
233static inline int get_new_stid(struct nfs4_stid *stid)
234{
235 static int min_stateid = 0;
236 struct idr *stateids = &stid->sc_client->cl_stateids;
237 int new_stid;
238 int error;
239
240 error = idr_get_new_above(stateids, stid, min_stateid, &new_stid);
241 /*
242 * Note: the necessary preallocation was done in
243 * nfs4_alloc_stateid(). The idr code caps the number of
244 * preallocations that can exist at a time, but the state lock
245 * prevents anyone from using ours before we get here:
246 */
247 WARN_ON_ONCE(error);
248 /*
249 * It shouldn't be a problem to reuse an opaque stateid value.
250 * I don't think it is for 4.1. But with 4.0 I worry that, for
251 * example, a stray write retransmission could be accepted by
252 * the server when it should have been rejected. Therefore,
253 * adopt a trick from the sctp code to attempt to maximize the
254 * amount of time until an id is reused, by ensuring they always
255 * "increase" (mod INT_MAX):
256 */
257
258 min_stateid = new_stid+1;
259 if (min_stateid == INT_MAX)
260 min_stateid = 0;
261 return new_stid;
262}
263
264static struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, struct 233static struct nfs4_stid *nfs4_alloc_stid(struct nfs4_client *cl, struct
265kmem_cache *slab) 234kmem_cache *slab)
266{ 235{
@@ -273,9 +242,8 @@ kmem_cache *slab)
273 if (!stid) 242 if (!stid)
274 return NULL; 243 return NULL;
275 244
276 if (!idr_pre_get(stateids, GFP_KERNEL)) 245 new_id = idr_alloc(stateids, stid, min_stateid, 0, GFP_KERNEL);
277 goto out_free; 246 if (new_id < 0)
278 if (idr_get_new_above(stateids, stid, min_stateid, &new_id))
279 goto out_free; 247 goto out_free;
280 stid->sc_client = cl; 248 stid->sc_client = cl;
281 stid->sc_type = 0; 249 stid->sc_type = 0;
diff --git a/fs/pipe.c b/fs/pipe.c
index 64a494cef0a0..2234f3f61f8d 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -863,6 +863,9 @@ pipe_rdwr_open(struct inode *inode, struct file *filp)
863{ 863{
864 int ret = -ENOENT; 864 int ret = -ENOENT;
865 865
866 if (!(filp->f_mode & (FMODE_READ|FMODE_WRITE)))
867 return -EINVAL;
868
866 mutex_lock(&inode->i_mutex); 869 mutex_lock(&inode->i_mutex);
867 870
868 if (inode->i_pipe) { 871 if (inode->i_pipe) {
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 05ae3c97f7a5..3e64169ef527 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -1439,8 +1439,11 @@ static void __dquot_initialize(struct inode *inode, int type)
1439 * did a write before quota was turned on 1439 * did a write before quota was turned on
1440 */ 1440 */
1441 rsv = inode_get_rsv_space(inode); 1441 rsv = inode_get_rsv_space(inode);
1442 if (unlikely(rsv)) 1442 if (unlikely(rsv)) {
1443 spin_lock(&dq_data_lock);
1443 dquot_resv_space(inode->i_dquot[cnt], rsv); 1444 dquot_resv_space(inode->i_dquot[cnt], rsv);
1445 spin_unlock(&dq_data_lock);
1446 }
1444 } 1447 }
1445 } 1448 }
1446out_err: 1449out_err:
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 194113b1b11b..f8a23c3078f8 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -1147,8 +1147,7 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin
1147 "on filesystem root."); 1147 "on filesystem root.");
1148 return 0; 1148 return 0;
1149 } 1149 }
1150 qf_names[qtype] = 1150 qf_names[qtype] = kstrdup(arg, GFP_KERNEL);
1151 kmalloc(strlen(arg) + 1, GFP_KERNEL);
1152 if (!qf_names[qtype]) { 1151 if (!qf_names[qtype]) {
1153 reiserfs_warning(s, "reiserfs-2502", 1152 reiserfs_warning(s, "reiserfs-2502",
1154 "not enough memory " 1153 "not enough memory "
@@ -1156,7 +1155,6 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin
1156 "quotafile name."); 1155 "quotafile name.");
1157 return 0; 1156 return 0;
1158 } 1157 }
1159 strcpy(qf_names[qtype], arg);
1160 if (qtype == USRQUOTA) 1158 if (qtype == USRQUOTA)
1161 *mount_options |= 1 << REISERFS_USRQUOTA; 1159 *mount_options |= 1 << REISERFS_USRQUOTA;
1162 else 1160 else
diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c
index 260e3928d4f5..60553a9053ca 100644
--- a/fs/squashfs/super.c
+++ b/fs/squashfs/super.c
@@ -489,6 +489,7 @@ static struct file_system_type squashfs_fs_type = {
489 .kill_sb = kill_block_super, 489 .kill_sb = kill_block_super,
490 .fs_flags = FS_REQUIRES_DEV 490 .fs_flags = FS_REQUIRES_DEV
491}; 491};
492MODULE_ALIAS_FS("squashfs");
492 493
493static const struct super_operations squashfs_super_ops = { 494static const struct super_operations squashfs_super_ops = {
494 .alloc_inode = squashfs_alloc_inode, 495 .alloc_inode = squashfs_alloc_inode,
diff --git a/fs/sysv/super.c b/fs/sysv/super.c
index a39938b1feea..d0c6a007ce83 100644
--- a/fs/sysv/super.c
+++ b/fs/sysv/super.c
@@ -555,6 +555,7 @@ static struct file_system_type v7_fs_type = {
555 .fs_flags = FS_REQUIRES_DEV, 555 .fs_flags = FS_REQUIRES_DEV,
556}; 556};
557MODULE_ALIAS_FS("v7"); 557MODULE_ALIAS_FS("v7");
558MODULE_ALIAS("v7");
558 559
559static int __init init_sysv_fs(void) 560static int __init init_sysv_fs(void)
560{ 561{
diff --git a/fs/udf/super.c b/fs/udf/super.c
index bc5b30a819e8..9ac4057a86c9 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -118,6 +118,7 @@ static struct file_system_type udf_fstype = {
118 .kill_sb = kill_block_super, 118 .kill_sb = kill_block_super,
119 .fs_flags = FS_REQUIRES_DEV, 119 .fs_flags = FS_REQUIRES_DEV,
120}; 120};
121MODULE_ALIAS_FS("udf");
121 122
122static struct kmem_cache *udf_inode_cachep; 123static struct kmem_cache *udf_inode_cachep;
123 124
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index 4e8f0df82d02..8459b5d8cb71 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -1334,6 +1334,12 @@ _xfs_buf_ioapply(
1334 int size; 1334 int size;
1335 int i; 1335 int i;
1336 1336
1337 /*
1338 * Make sure we capture only current IO errors rather than stale errors
1339 * left over from previous use of the buffer (e.g. failed readahead).
1340 */
1341 bp->b_error = 0;
1342
1337 if (bp->b_flags & XBF_WRITE) { 1343 if (bp->b_flags & XBF_WRITE) {
1338 if (bp->b_flags & XBF_SYNCIO) 1344 if (bp->b_flags & XBF_SYNCIO)
1339 rw = WRITE_SYNC; 1345 rw = WRITE_SYNC;
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 912d83d8860a..5a30dd899d2b 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -325,7 +325,7 @@ xfs_iomap_eof_want_preallocate(
325 * rather than falling short due to things like stripe unit/width alignment of 325 * rather than falling short due to things like stripe unit/width alignment of
326 * real extents. 326 * real extents.
327 */ 327 */
328STATIC int 328STATIC xfs_fsblock_t
329xfs_iomap_eof_prealloc_initial_size( 329xfs_iomap_eof_prealloc_initial_size(
330 struct xfs_mount *mp, 330 struct xfs_mount *mp,
331 struct xfs_inode *ip, 331 struct xfs_inode *ip,
@@ -413,7 +413,7 @@ xfs_iomap_prealloc_size(
413 * have a large file on a small filesystem and the above 413 * have a large file on a small filesystem and the above
414 * lowspace thresholds are smaller than MAXEXTLEN. 414 * lowspace thresholds are smaller than MAXEXTLEN.
415 */ 415 */
416 while (alloc_blocks >= freesp) 416 while (alloc_blocks && alloc_blocks >= freesp)
417 alloc_blocks >>= 4; 417 alloc_blocks >>= 4;
418 } 418 }
419 419
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index 555d0337ad95..b327b5a9296d 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -235,6 +235,9 @@ extern void acpi_processor_unregister_performance(struct
235 if a _PPC object exists, rmmod is disallowed then */ 235 if a _PPC object exists, rmmod is disallowed then */
236int acpi_processor_notify_smm(struct module *calling_module); 236int acpi_processor_notify_smm(struct module *calling_module);
237 237
238/* parsing the _P* objects. */
239extern int acpi_processor_get_performance_info(struct acpi_processor *pr);
240
238/* for communication between multiple parts of the processor kernel module */ 241/* for communication between multiple parts of the processor kernel module */
239DECLARE_PER_CPU(struct acpi_processor *, processors); 242DECLARE_PER_CPU(struct acpi_processor *, processors);
240extern struct acpi_processor_errata errata; 243extern struct acpi_processor_errata errata;
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h
index 1ced6413ea03..33bd2de3bc1e 100644
--- a/include/asm-generic/atomic.h
+++ b/include/asm-generic/atomic.h
@@ -136,12 +136,6 @@ static inline void atomic_dec(atomic_t *v)
136#define atomic_xchg(ptr, v) (xchg(&(ptr)->counter, (v))) 136#define atomic_xchg(ptr, v) (xchg(&(ptr)->counter, (v)))
137#define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), (old), (new))) 137#define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), (old), (new)))
138 138
139#define cmpxchg_local(ptr, o, n) \
140 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
141 (unsigned long)(n), sizeof(*(ptr))))
142
143#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
144
145static inline int __atomic_add_unless(atomic_t *v, int a, int u) 139static inline int __atomic_add_unless(atomic_t *v, int a, int u)
146{ 140{
147 int c, old; 141 int c, old;
diff --git a/include/asm-generic/cmpxchg.h b/include/asm-generic/cmpxchg.h
index 14883026015d..811fb1e9b061 100644
--- a/include/asm-generic/cmpxchg.h
+++ b/include/asm-generic/cmpxchg.h
@@ -92,6 +92,16 @@ unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
92 */ 92 */
93#include <asm-generic/cmpxchg-local.h> 93#include <asm-generic/cmpxchg-local.h>
94 94
95#ifndef cmpxchg_local
96#define cmpxchg_local(ptr, o, n) \
97 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
98 (unsigned long)(n), sizeof(*(ptr))))
99#endif
100
101#ifndef cmpxchg64_local
102#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
103#endif
104
95#define cmpxchg(ptr, o, n) cmpxchg_local((ptr), (o), (n)) 105#define cmpxchg(ptr, o, n) cmpxchg_local((ptr), (o), (n))
96#define cmpxchg64(ptr, o, n) cmpxchg64_local((ptr), (o), (n)) 106#define cmpxchg64(ptr, o, n) cmpxchg64_local((ptr), (o), (n))
97 107
diff --git a/include/linux/idr.h b/include/linux/idr.h
index a6f38b5c34e4..2640c7e99e51 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -73,8 +73,6 @@ struct idr {
73 */ 73 */
74 74
75void *idr_find_slowpath(struct idr *idp, int id); 75void *idr_find_slowpath(struct idr *idp, int id);
76int idr_pre_get(struct idr *idp, gfp_t gfp_mask);
77int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id);
78void idr_preload(gfp_t gfp_mask); 76void idr_preload(gfp_t gfp_mask);
79int idr_alloc(struct idr *idp, void *ptr, int start, int end, gfp_t gfp_mask); 77int idr_alloc(struct idr *idp, void *ptr, int start, int end, gfp_t gfp_mask);
80int idr_for_each(struct idr *idp, 78int idr_for_each(struct idr *idp,
@@ -99,7 +97,7 @@ static inline void idr_preload_end(void)
99 97
100/** 98/**
101 * idr_find - return pointer for given id 99 * idr_find - return pointer for given id
102 * @idp: idr handle 100 * @idr: idr handle
103 * @id: lookup key 101 * @id: lookup key
104 * 102 *
105 * Return the pointer given the id it has been registered with. A %NULL 103 * Return the pointer given the id it has been registered with. A %NULL
@@ -120,19 +118,6 @@ static inline void *idr_find(struct idr *idr, int id)
120} 118}
121 119
122/** 120/**
123 * idr_get_new - allocate new idr entry
124 * @idp: idr handle
125 * @ptr: pointer you want associated with the id
126 * @id: pointer to the allocated handle
127 *
128 * Simple wrapper around idr_get_new_above() w/ @starting_id of zero.
129 */
130static inline int idr_get_new(struct idr *idp, void *ptr, int *id)
131{
132 return idr_get_new_above(idp, ptr, 0, id);
133}
134
135/**
136 * idr_for_each_entry - iterate over an idr's elements of a given type 121 * idr_for_each_entry - iterate over an idr's elements of a given type
137 * @idp: idr handle 122 * @idp: idr handle
138 * @entry: the type * to use as cursor 123 * @entry: the type * to use as cursor
@@ -143,7 +128,56 @@ static inline int idr_get_new(struct idr *idp, void *ptr, int *id)
143 entry != NULL; \ 128 entry != NULL; \
144 ++id, entry = (typeof(entry))idr_get_next((idp), &(id))) 129 ++id, entry = (typeof(entry))idr_get_next((idp), &(id)))
145 130
146void __idr_remove_all(struct idr *idp); /* don't use */ 131/*
132 * Don't use the following functions. These exist only to suppress
133 * deprecated warnings on EXPORT_SYMBOL()s.
134 */
135int __idr_pre_get(struct idr *idp, gfp_t gfp_mask);
136int __idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id);
137void __idr_remove_all(struct idr *idp);
138
139/**
140 * idr_pre_get - reserve resources for idr allocation
141 * @idp: idr handle
142 * @gfp_mask: memory allocation flags
143 *
144 * Part of old alloc interface. This is going away. Use
145 * idr_preload[_end]() and idr_alloc() instead.
146 */
147static inline int __deprecated idr_pre_get(struct idr *idp, gfp_t gfp_mask)
148{
149 return __idr_pre_get(idp, gfp_mask);
150}
151
152/**
153 * idr_get_new_above - allocate new idr entry above or equal to a start id
154 * @idp: idr handle
155 * @ptr: pointer you want associated with the id
156 * @starting_id: id to start search at
157 * @id: pointer to the allocated handle
158 *
159 * Part of old alloc interface. This is going away. Use
160 * idr_preload[_end]() and idr_alloc() instead.
161 */
162static inline int __deprecated idr_get_new_above(struct idr *idp, void *ptr,
163 int starting_id, int *id)
164{
165 return __idr_get_new_above(idp, ptr, starting_id, id);
166}
167
168/**
169 * idr_get_new - allocate new idr entry
170 * @idp: idr handle
171 * @ptr: pointer you want associated with the id
172 * @id: pointer to the allocated handle
173 *
174 * Part of old alloc interface. This is going away. Use
175 * idr_preload[_end]() and idr_alloc() instead.
176 */
177static inline int __deprecated idr_get_new(struct idr *idp, void *ptr, int *id)
178{
179 return __idr_get_new_above(idp, ptr, 0, id);
180}
147 181
148/** 182/**
149 * idr_remove_all - remove all ids from the given idr tree 183 * idr_remove_all - remove all ids from the given idr tree
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index 1f86a97ab2e2..8bd12be0b02f 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -227,14 +227,17 @@ struct st_sensor_data {
227}; 227};
228 228
229#ifdef CONFIG_IIO_BUFFER 229#ifdef CONFIG_IIO_BUFFER
230irqreturn_t st_sensors_trigger_handler(int irq, void *p);
231
232int st_sensors_get_buffer_element(struct iio_dev *indio_dev, u8 *buf);
233#endif
234
235#ifdef CONFIG_IIO_TRIGGER
230int st_sensors_allocate_trigger(struct iio_dev *indio_dev, 236int st_sensors_allocate_trigger(struct iio_dev *indio_dev,
231 const struct iio_trigger_ops *trigger_ops); 237 const struct iio_trigger_ops *trigger_ops);
232 238
233void st_sensors_deallocate_trigger(struct iio_dev *indio_dev); 239void st_sensors_deallocate_trigger(struct iio_dev *indio_dev);
234 240
235irqreturn_t st_sensors_trigger_handler(int irq, void *p);
236
237int st_sensors_get_buffer_element(struct iio_dev *indio_dev, u8 *buf);
238#else 241#else
239static inline int st_sensors_allocate_trigger(struct iio_dev *indio_dev, 242static inline int st_sensors_allocate_trigger(struct iio_dev *indio_dev,
240 const struct iio_trigger_ops *trigger_ops) 243 const struct iio_trigger_ops *trigger_ops)
diff --git a/include/linux/list.h b/include/linux/list.h
index d991cc147c98..6a1f8df9144b 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -667,7 +667,9 @@ static inline void hlist_move_list(struct hlist_head *old,
667 pos = n) 667 pos = n)
668 668
669#define hlist_entry_safe(ptr, type, member) \ 669#define hlist_entry_safe(ptr, type, member) \
670 (ptr) ? hlist_entry(ptr, type, member) : NULL 670 ({ typeof(ptr) ____ptr = (ptr); \
671 ____ptr ? hlist_entry(____ptr, type, member) : NULL; \
672 })
671 673
672/** 674/**
673 * hlist_for_each_entry - iterate over list of given type 675 * hlist_for_each_entry - iterate over list of given type
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
index a4d13d7cd001..3bbda22721ea 100644
--- a/include/linux/mfd/palmas.h
+++ b/include/linux/mfd/palmas.h
@@ -221,6 +221,7 @@ struct palmas_clk_platform_data {
221}; 221};
222 222
223struct palmas_platform_data { 223struct palmas_platform_data {
224 int irq_flags;
224 int gpio_base; 225 int gpio_base;
225 226
226 /* bit value to be loaded to the POWER_CTRL register */ 227 /* bit value to be loaded to the POWER_CTRL register */
diff --git a/include/linux/mfd/tps65912.h b/include/linux/mfd/tps65912.h
index aaceab402ec5..6d309032dc0d 100644
--- a/include/linux/mfd/tps65912.h
+++ b/include/linux/mfd/tps65912.h
@@ -323,5 +323,6 @@ int tps65912_device_init(struct tps65912 *tps65912);
323void tps65912_device_exit(struct tps65912 *tps65912); 323void tps65912_device_exit(struct tps65912 *tps65912);
324int tps65912_irq_init(struct tps65912 *tps65912, int irq, 324int tps65912_irq_init(struct tps65912 *tps65912, int irq,
325 struct tps65912_platform_data *pdata); 325 struct tps65912_platform_data *pdata);
326int tps65912_irq_exit(struct tps65912 *tps65912);
326 327
327#endif /* __LINUX_MFD_TPS65912_H */ 328#endif /* __LINUX_MFD_TPS65912_H */
diff --git a/include/linux/mfd/wm831x/auxadc.h b/include/linux/mfd/wm831x/auxadc.h
index b132067e9e99..867aa23f9370 100644
--- a/include/linux/mfd/wm831x/auxadc.h
+++ b/include/linux/mfd/wm831x/auxadc.h
@@ -15,6 +15,8 @@
15#ifndef __MFD_WM831X_AUXADC_H__ 15#ifndef __MFD_WM831X_AUXADC_H__
16#define __MFD_WM831X_AUXADC_H__ 16#define __MFD_WM831X_AUXADC_H__
17 17
18struct wm831x;
19
18/* 20/*
19 * R16429 (0x402D) - AuxADC Data 21 * R16429 (0x402D) - AuxADC Data
20 */ 22 */
diff --git a/include/linux/mfd/wm831x/core.h b/include/linux/mfd/wm831x/core.h
index 4a3b83a77614..76c22648436f 100644
--- a/include/linux/mfd/wm831x/core.h
+++ b/include/linux/mfd/wm831x/core.h
@@ -20,6 +20,7 @@
20#include <linux/irqdomain.h> 20#include <linux/irqdomain.h>
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/regmap.h> 22#include <linux/regmap.h>
23#include <linux/mfd/wm831x/auxadc.h>
23 24
24/* 25/*
25 * Register values. 26 * Register values.
@@ -355,7 +356,6 @@ enum wm831x_parent {
355}; 356};
356 357
357struct wm831x; 358struct wm831x;
358enum wm831x_auxadc;
359 359
360typedef int (*wm831x_auxadc_read_fn)(struct wm831x *wm831x, 360typedef int (*wm831x_auxadc_read_fn)(struct wm831x *wm831x,
361 enum wm831x_auxadc input); 361 enum wm831x_auxadc input);
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 7ccb3c59ed60..ef52d9c91459 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -187,6 +187,13 @@ typedef enum {
187 * This happens with the Renesas AG-AND chips, possibly others. 187 * This happens with the Renesas AG-AND chips, possibly others.
188 */ 188 */
189#define BBT_AUTO_REFRESH 0x00000080 189#define BBT_AUTO_REFRESH 0x00000080
190/*
191 * Chip requires ready check on read (for auto-incremented sequential read).
192 * True only for small page devices; large page devices do not support
193 * autoincrement.
194 */
195#define NAND_NEED_READRDY 0x00000100
196
190/* Chip does not allow subpage writes */ 197/* Chip does not allow subpage writes */
191#define NAND_NO_SUBPAGE_WRITE 0x00000200 198#define NAND_NO_SUBPAGE_WRITE 0x00000200
192 199
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index e47ee462c2f2..1d795df6f4cf 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -799,6 +799,12 @@ static inline int __perf_event_disable(void *info) { return -1; }
799static inline void perf_event_task_tick(void) { } 799static inline void perf_event_task_tick(void) { }
800#endif 800#endif
801 801
802#if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_INTEL)
803extern void perf_restore_debug_store(void);
804#else
805static inline void perf_restore_debug_store(void) { }
806#endif
807
802#define perf_output_put(handle, x) perf_output_copy((handle), &(x), sizeof(x)) 808#define perf_output_put(handle, x) perf_output_copy((handle), &(x), sizeof(x))
803 809
804/* 810/*
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index 5ae8456d9670..c23099413ad6 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -14,6 +14,7 @@
14 */ 14 */
15 15
16#include <linux/cgroup.h> 16#include <linux/cgroup.h>
17#include <linux/errno.h>
17 18
18/* 19/*
19 * The core object. the cgroup that wishes to account for some 20 * The core object. the cgroup that wishes to account for some
diff --git a/include/linux/usb/cdc_ncm.h b/include/linux/usb/cdc_ncm.h
index 3b8f9d4fc3fe..cc25b70af33c 100644
--- a/include/linux/usb/cdc_ncm.h
+++ b/include/linux/usb/cdc_ncm.h
@@ -127,6 +127,7 @@ struct cdc_ncm_ctx {
127 u16 connected; 127 u16 connected;
128}; 128};
129 129
130extern u8 cdc_ncm_select_altsetting(struct usbnet *dev, struct usb_interface *intf);
130extern int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting); 131extern int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting);
131extern void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf); 132extern void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf);
132extern struct sk_buff *cdc_ncm_fill_tx_frame(struct cdc_ncm_ctx *ctx, struct sk_buff *skb, __le32 sign); 133extern struct sk_buff *cdc_ncm_fill_tx_frame(struct cdc_ncm_ctx *ctx, struct sk_buff *skb, __le32 sign);
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 3c671c1b37f6..8860594d6364 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -60,7 +60,7 @@ struct usb_configuration;
60 * @name: For diagnostics, identifies the function. 60 * @name: For diagnostics, identifies the function.
61 * @strings: tables of strings, keyed by identifiers assigned during bind() 61 * @strings: tables of strings, keyed by identifiers assigned during bind()
62 * and by language IDs provided in control requests 62 * and by language IDs provided in control requests
63 * @descriptors: Table of full (or low) speed descriptors, using interface and 63 * @fs_descriptors: Table of full (or low) speed descriptors, using interface and
64 * string identifiers assigned during @bind(). If this pointer is null, 64 * string identifiers assigned during @bind(). If this pointer is null,
65 * the function will not be available at full speed (or at low speed). 65 * the function will not be available at full speed (or at low speed).
66 * @hs_descriptors: Table of high speed descriptors, using interface and 66 * @hs_descriptors: Table of high speed descriptors, using interface and
@@ -290,6 +290,7 @@ enum {
290 * after function notifications 290 * after function notifications
291 * @resume: Notifies configuration when the host restarts USB traffic, 291 * @resume: Notifies configuration when the host restarts USB traffic,
292 * before function notifications 292 * before function notifications
293 * @gadget_driver: Gadget driver controlling this driver
293 * 294 *
294 * Devices default to reporting self powered operation. Devices which rely 295 * Devices default to reporting self powered operation. Devices which rely
295 * on bus powered operation should report this in their @bind method. 296 * on bus powered operation should report this in their @bind method.
diff --git a/include/net/dst.h b/include/net/dst.h
index 853cda11e518..1f8fd109e225 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -413,13 +413,15 @@ static inline int dst_neigh_output(struct dst_entry *dst, struct neighbour *n,
413 413
414static inline struct neighbour *dst_neigh_lookup(const struct dst_entry *dst, const void *daddr) 414static inline struct neighbour *dst_neigh_lookup(const struct dst_entry *dst, const void *daddr)
415{ 415{
416 return dst->ops->neigh_lookup(dst, NULL, daddr); 416 struct neighbour *n = dst->ops->neigh_lookup(dst, NULL, daddr);
417 return IS_ERR(n) ? NULL : n;
417} 418}
418 419
419static inline struct neighbour *dst_neigh_lookup_skb(const struct dst_entry *dst, 420static inline struct neighbour *dst_neigh_lookup_skb(const struct dst_entry *dst,
420 struct sk_buff *skb) 421 struct sk_buff *skb)
421{ 422{
422 return dst->ops->neigh_lookup(dst, skb, NULL); 423 struct neighbour *n = dst->ops->neigh_lookup(dst, skb, NULL);
424 return IS_ERR(n) ? NULL : n;
423} 425}
424 426
425static inline void dst_link_failure(struct sk_buff *skb) 427static inline void dst_link_failure(struct sk_buff *skb)
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 76c3fe5ecc2e..0a1dcc2fa2f5 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -43,6 +43,13 @@ struct inet_frag_queue {
43 43
44#define INETFRAGS_HASHSZ 64 44#define INETFRAGS_HASHSZ 64
45 45
46/* averaged:
47 * max_depth = default ipfrag_high_thresh / INETFRAGS_HASHSZ /
48 * rounded up (SKB_TRUELEN(0) + sizeof(struct ipq or
49 * struct frag_queue))
50 */
51#define INETFRAGS_MAXDEPTH 128
52
46struct inet_frags { 53struct inet_frags {
47 struct hlist_head hash[INETFRAGS_HASHSZ]; 54 struct hlist_head hash[INETFRAGS_HASHSZ];
48 /* This rwlock is a global lock (seperate per IPv4, IPv6 and 55 /* This rwlock is a global lock (seperate per IPv4, IPv6 and
@@ -76,6 +83,8 @@ int inet_frag_evictor(struct netns_frags *nf, struct inet_frags *f, bool force);
76struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, 83struct inet_frag_queue *inet_frag_find(struct netns_frags *nf,
77 struct inet_frags *f, void *key, unsigned int hash) 84 struct inet_frags *f, void *key, unsigned int hash)
78 __releases(&f->lock); 85 __releases(&f->lock);
86void inet_frag_maybe_warn_overflow(struct inet_frag_queue *q,
87 const char *prefix);
79 88
80static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f) 89static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f)
81{ 90{
diff --git a/include/uapi/linux/acct.h b/include/uapi/linux/acct.h
index 11b6ca3e0873..df2f9a0bba6a 100644
--- a/include/uapi/linux/acct.h
+++ b/include/uapi/linux/acct.h
@@ -107,10 +107,12 @@ struct acct_v3
107#define ACORE 0x08 /* ... dumped core */ 107#define ACORE 0x08 /* ... dumped core */
108#define AXSIG 0x10 /* ... was killed by a signal */ 108#define AXSIG 0x10 /* ... was killed by a signal */
109 109
110#ifdef __BIG_ENDIAN 110#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN)
111#define ACCT_BYTEORDER 0x80 /* accounting file is big endian */ 111#define ACCT_BYTEORDER 0x80 /* accounting file is big endian */
112#else 112#elif defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN)
113#define ACCT_BYTEORDER 0x00 /* accounting file is little endian */ 113#define ACCT_BYTEORDER 0x00 /* accounting file is little endian */
114#else
115#error unspecified endianness
114#endif 116#endif
115 117
116#ifndef __KERNEL__ 118#ifndef __KERNEL__
diff --git a/include/uapi/linux/aio_abi.h b/include/uapi/linux/aio_abi.h
index 86fa7a71336a..bb2554f7fbd1 100644
--- a/include/uapi/linux/aio_abi.h
+++ b/include/uapi/linux/aio_abi.h
@@ -62,9 +62,9 @@ struct io_event {
62 __s64 res2; /* secondary result */ 62 __s64 res2; /* secondary result */
63}; 63};
64 64
65#if defined(__LITTLE_ENDIAN) 65#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN)
66#define PADDED(x,y) x, y 66#define PADDED(x,y) x, y
67#elif defined(__BIG_ENDIAN) 67#elif defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN)
68#define PADDED(x,y) y, x 68#define PADDED(x,y) y, x
69#else 69#else
70#error edit for your odd byteorder. 70#error edit for your odd byteorder.
diff --git a/include/uapi/linux/raid/md_p.h b/include/uapi/linux/raid/md_p.h
index ee753536ab70..fe1a5406d4d9 100644
--- a/include/uapi/linux/raid/md_p.h
+++ b/include/uapi/linux/raid/md_p.h
@@ -145,16 +145,18 @@ typedef struct mdp_superblock_s {
145 __u32 failed_disks; /* 4 Number of failed disks */ 145 __u32 failed_disks; /* 4 Number of failed disks */
146 __u32 spare_disks; /* 5 Number of spare disks */ 146 __u32 spare_disks; /* 5 Number of spare disks */
147 __u32 sb_csum; /* 6 checksum of the whole superblock */ 147 __u32 sb_csum; /* 6 checksum of the whole superblock */
148#ifdef __BIG_ENDIAN 148#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN)
149 __u32 events_hi; /* 7 high-order of superblock update count */ 149 __u32 events_hi; /* 7 high-order of superblock update count */
150 __u32 events_lo; /* 8 low-order of superblock update count */ 150 __u32 events_lo; /* 8 low-order of superblock update count */
151 __u32 cp_events_hi; /* 9 high-order of checkpoint update count */ 151 __u32 cp_events_hi; /* 9 high-order of checkpoint update count */
152 __u32 cp_events_lo; /* 10 low-order of checkpoint update count */ 152 __u32 cp_events_lo; /* 10 low-order of checkpoint update count */
153#else 153#elif defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN)
154 __u32 events_lo; /* 7 low-order of superblock update count */ 154 __u32 events_lo; /* 7 low-order of superblock update count */
155 __u32 events_hi; /* 8 high-order of superblock update count */ 155 __u32 events_hi; /* 8 high-order of superblock update count */
156 __u32 cp_events_lo; /* 9 low-order of checkpoint update count */ 156 __u32 cp_events_lo; /* 9 low-order of checkpoint update count */
157 __u32 cp_events_hi; /* 10 high-order of checkpoint update count */ 157 __u32 cp_events_hi; /* 10 high-order of checkpoint update count */
158#else
159#error unspecified endianness
158#endif 160#endif
159 __u32 recovery_cp; /* 11 recovery checkpoint sector count */ 161 __u32 recovery_cp; /* 11 recovery checkpoint sector count */
160 /* There are only valid for minor_version > 90 */ 162 /* There are only valid for minor_version > 90 */
diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h
index b6a23a483d74..74c2bf7211f8 100644
--- a/include/uapi/linux/serial_core.h
+++ b/include/uapi/linux/serial_core.h
@@ -51,7 +51,10 @@
51#define PORT_8250_CIR 23 /* CIR infrared port, has its own driver */ 51#define PORT_8250_CIR 23 /* CIR infrared port, has its own driver */
52#define PORT_XR17V35X 24 /* Exar XR17V35x UARTs */ 52#define PORT_XR17V35X 24 /* Exar XR17V35x UARTs */
53#define PORT_BRCM_TRUMANAGE 25 53#define PORT_BRCM_TRUMANAGE 25
54#define PORT_MAX_8250 25 /* max port ID */ 54#define PORT_ALTR_16550_F32 26 /* Altera 16550 UART with 32 FIFOs */
55#define PORT_ALTR_16550_F64 27 /* Altera 16550 UART with 64 FIFOs */
56#define PORT_ALTR_16550_F128 28 /* Altera 16550 UART with 128 FIFOs */
57#define PORT_MAX_8250 28 /* max port ID */
55 58
56/* 59/*
57 * ARM specific type numbers. These are not currently guaranteed 60 * ARM specific type numbers. These are not currently guaranteed
diff --git a/include/video/atmel_lcdc.h b/include/video/atmel_lcdc.h
index 28447f1594fa..8deb22672ada 100644
--- a/include/video/atmel_lcdc.h
+++ b/include/video/atmel_lcdc.h
@@ -30,7 +30,6 @@
30 */ 30 */
31#define ATMEL_LCDC_WIRING_BGR 0 31#define ATMEL_LCDC_WIRING_BGR 0
32#define ATMEL_LCDC_WIRING_RGB 1 32#define ATMEL_LCDC_WIRING_RGB 1
33#define ATMEL_LCDC_WIRING_RGB555 2
34 33
35 34
36 /* LCD Controller info data structure, stored in device platform_data */ 35 /* LCD Controller info data structure, stored in device platform_data */
@@ -62,6 +61,7 @@ struct atmel_lcdfb_info {
62 void (*atmel_lcdfb_power_control)(int on); 61 void (*atmel_lcdfb_power_control)(int on);
63 struct fb_monspecs *default_monspecs; 62 struct fb_monspecs *default_monspecs;
64 u32 pseudo_palette[16]; 63 u32 pseudo_palette[16];
64 bool have_intensity_bit;
65}; 65};
66 66
67#define ATMEL_LCDC_DMABADDR1 0x00 67#define ATMEL_LCDC_DMABADDR1 0x00
diff --git a/init/Kconfig b/init/Kconfig
index 22616cd434bc..5341d7232c3a 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -28,10 +28,6 @@ config BUILDTIME_EXTABLE_SORT
28 28
29menu "General setup" 29menu "General setup"
30 30
31config EXPERIMENTAL
32 bool
33 default y
34
35config BROKEN 31config BROKEN
36 bool 32 bool
37 33
diff --git a/kernel/fork.c b/kernel/fork.c
index 8d932b1c9056..1766d324d5e3 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1141,6 +1141,9 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1141 if ((clone_flags & (CLONE_NEWNS|CLONE_FS)) == (CLONE_NEWNS|CLONE_FS)) 1141 if ((clone_flags & (CLONE_NEWNS|CLONE_FS)) == (CLONE_NEWNS|CLONE_FS))
1142 return ERR_PTR(-EINVAL); 1142 return ERR_PTR(-EINVAL);
1143 1143
1144 if ((clone_flags & (CLONE_NEWUSER|CLONE_FS)) == (CLONE_NEWUSER|CLONE_FS))
1145 return ERR_PTR(-EINVAL);
1146
1144 /* 1147 /*
1145 * Thread groups must share signals as well, and detached threads 1148 * Thread groups must share signals as well, and detached threads
1146 * can only be started up within the thread group. 1149 * can only be started up within the thread group.
@@ -1807,7 +1810,7 @@ SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags)
1807 * If unsharing a user namespace must also unshare the thread. 1810 * If unsharing a user namespace must also unshare the thread.
1808 */ 1811 */
1809 if (unshare_flags & CLONE_NEWUSER) 1812 if (unshare_flags & CLONE_NEWUSER)
1810 unshare_flags |= CLONE_THREAD; 1813 unshare_flags |= CLONE_THREAD | CLONE_FS;
1811 /* 1814 /*
1812 * If unsharing a pid namespace must also unshare the thread. 1815 * If unsharing a pid namespace must also unshare the thread.
1813 */ 1816 */
diff --git a/kernel/futex.c b/kernel/futex.c
index f0090a993dab..b26dcfc02c94 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -223,7 +223,8 @@ static void drop_futex_key_refs(union futex_key *key)
223 * @rw: mapping needs to be read/write (values: VERIFY_READ, 223 * @rw: mapping needs to be read/write (values: VERIFY_READ,
224 * VERIFY_WRITE) 224 * VERIFY_WRITE)
225 * 225 *
226 * Returns a negative error code or 0 226 * Return: a negative error code or 0
227 *
227 * The key words are stored in *key on success. 228 * The key words are stored in *key on success.
228 * 229 *
229 * For shared mappings, it's (page->index, file_inode(vma->vm_file), 230 * For shared mappings, it's (page->index, file_inode(vma->vm_file),
@@ -705,9 +706,9 @@ lookup_pi_state(u32 uval, struct futex_hash_bucket *hb,
705 * be "current" except in the case of requeue pi. 706 * be "current" except in the case of requeue pi.
706 * @set_waiters: force setting the FUTEX_WAITERS bit (1) or not (0) 707 * @set_waiters: force setting the FUTEX_WAITERS bit (1) or not (0)
707 * 708 *
708 * Returns: 709 * Return:
709 * 0 - ready to wait 710 * 0 - ready to wait;
710 * 1 - acquired the lock 711 * 1 - acquired the lock;
711 * <0 - error 712 * <0 - error
712 * 713 *
713 * The hb->lock and futex_key refs shall be held by the caller. 714 * The hb->lock and futex_key refs shall be held by the caller.
@@ -1191,9 +1192,9 @@ void requeue_pi_wake_futex(struct futex_q *q, union futex_key *key,
1191 * then direct futex_lock_pi_atomic() to force setting the FUTEX_WAITERS bit. 1192 * then direct futex_lock_pi_atomic() to force setting the FUTEX_WAITERS bit.
1192 * hb1 and hb2 must be held by the caller. 1193 * hb1 and hb2 must be held by the caller.
1193 * 1194 *
1194 * Returns: 1195 * Return:
1195 * 0 - failed to acquire the lock atomicly 1196 * 0 - failed to acquire the lock atomically;
1196 * 1 - acquired the lock 1197 * 1 - acquired the lock;
1197 * <0 - error 1198 * <0 - error
1198 */ 1199 */
1199static int futex_proxy_trylock_atomic(u32 __user *pifutex, 1200static int futex_proxy_trylock_atomic(u32 __user *pifutex,
@@ -1254,8 +1255,8 @@ static int futex_proxy_trylock_atomic(u32 __user *pifutex,
1254 * Requeue waiters on uaddr1 to uaddr2. In the requeue_pi case, try to acquire 1255 * Requeue waiters on uaddr1 to uaddr2. In the requeue_pi case, try to acquire
1255 * uaddr2 atomically on behalf of the top waiter. 1256 * uaddr2 atomically on behalf of the top waiter.
1256 * 1257 *
1257 * Returns: 1258 * Return:
1258 * >=0 - on success, the number of tasks requeued or woken 1259 * >=0 - on success, the number of tasks requeued or woken;
1259 * <0 - on error 1260 * <0 - on error
1260 */ 1261 */
1261static int futex_requeue(u32 __user *uaddr1, unsigned int flags, 1262static int futex_requeue(u32 __user *uaddr1, unsigned int flags,
@@ -1536,8 +1537,8 @@ static inline void queue_me(struct futex_q *q, struct futex_hash_bucket *hb)
1536 * The q->lock_ptr must not be held by the caller. A call to unqueue_me() must 1537 * The q->lock_ptr must not be held by the caller. A call to unqueue_me() must
1537 * be paired with exactly one earlier call to queue_me(). 1538 * be paired with exactly one earlier call to queue_me().
1538 * 1539 *
1539 * Returns: 1540 * Return:
1540 * 1 - if the futex_q was still queued (and we removed unqueued it) 1541 * 1 - if the futex_q was still queued (and we removed unqueued it);
1541 * 0 - if the futex_q was already removed by the waking thread 1542 * 0 - if the futex_q was already removed by the waking thread
1542 */ 1543 */
1543static int unqueue_me(struct futex_q *q) 1544static int unqueue_me(struct futex_q *q)
@@ -1707,9 +1708,9 @@ static long futex_wait_restart(struct restart_block *restart);
1707 * the pi_state owner as well as handle race conditions that may allow us to 1708 * the pi_state owner as well as handle race conditions that may allow us to
1708 * acquire the lock. Must be called with the hb lock held. 1709 * acquire the lock. Must be called with the hb lock held.
1709 * 1710 *
1710 * Returns: 1711 * Return:
1711 * 1 - success, lock taken 1712 * 1 - success, lock taken;
1712 * 0 - success, lock not taken 1713 * 0 - success, lock not taken;
1713 * <0 - on error (-EFAULT) 1714 * <0 - on error (-EFAULT)
1714 */ 1715 */
1715static int fixup_owner(u32 __user *uaddr, struct futex_q *q, int locked) 1716static int fixup_owner(u32 __user *uaddr, struct futex_q *q, int locked)
@@ -1824,8 +1825,8 @@ static void futex_wait_queue_me(struct futex_hash_bucket *hb, struct futex_q *q,
1824 * Return with the hb lock held and a q.key reference on success, and unlocked 1825 * Return with the hb lock held and a q.key reference on success, and unlocked
1825 * with no q.key reference on failure. 1826 * with no q.key reference on failure.
1826 * 1827 *
1827 * Returns: 1828 * Return:
1828 * 0 - uaddr contains val and hb has been locked 1829 * 0 - uaddr contains val and hb has been locked;
1829 * <1 - -EFAULT or -EWOULDBLOCK (uaddr does not contain val) and hb is unlocked 1830 * <1 - -EFAULT or -EWOULDBLOCK (uaddr does not contain val) and hb is unlocked
1830 */ 1831 */
1831static int futex_wait_setup(u32 __user *uaddr, u32 val, unsigned int flags, 1832static int futex_wait_setup(u32 __user *uaddr, u32 val, unsigned int flags,
@@ -2203,9 +2204,9 @@ pi_faulted:
2203 * the wakeup and return the appropriate error code to the caller. Must be 2204 * the wakeup and return the appropriate error code to the caller. Must be
2204 * called with the hb lock held. 2205 * called with the hb lock held.
2205 * 2206 *
2206 * Returns 2207 * Return:
2207 * 0 - no early wakeup detected 2208 * 0 = no early wakeup detected;
2208 * <0 - -ETIMEDOUT or -ERESTARTNOINTR 2209 * <0 = -ETIMEDOUT or -ERESTARTNOINTR
2209 */ 2210 */
2210static inline 2211static inline
2211int handle_early_requeue_pi_wakeup(struct futex_hash_bucket *hb, 2212int handle_early_requeue_pi_wakeup(struct futex_hash_bucket *hb,
@@ -2247,7 +2248,6 @@ int handle_early_requeue_pi_wakeup(struct futex_hash_bucket *hb,
2247 * @val: the expected value of uaddr 2248 * @val: the expected value of uaddr
2248 * @abs_time: absolute timeout 2249 * @abs_time: absolute timeout
2249 * @bitset: 32 bit wakeup bitset set by userspace, defaults to all 2250 * @bitset: 32 bit wakeup bitset set by userspace, defaults to all
2250 * @clockrt: whether to use CLOCK_REALTIME (1) or CLOCK_MONOTONIC (0)
2251 * @uaddr2: the pi futex we will take prior to returning to user-space 2251 * @uaddr2: the pi futex we will take prior to returning to user-space
2252 * 2252 *
2253 * The caller will wait on uaddr and will be requeued by futex_requeue() to 2253 * The caller will wait on uaddr and will be requeued by futex_requeue() to
@@ -2258,7 +2258,7 @@ int handle_early_requeue_pi_wakeup(struct futex_hash_bucket *hb,
2258 * there was a need to. 2258 * there was a need to.
2259 * 2259 *
2260 * We call schedule in futex_wait_queue_me() when we enqueue and return there 2260 * We call schedule in futex_wait_queue_me() when we enqueue and return there
2261 * via the following: 2261 * via the following--
2262 * 1) wakeup on uaddr2 after an atomic lock acquisition by futex_requeue() 2262 * 1) wakeup on uaddr2 after an atomic lock acquisition by futex_requeue()
2263 * 2) wakeup on uaddr2 after a requeue 2263 * 2) wakeup on uaddr2 after a requeue
2264 * 3) signal 2264 * 3) signal
@@ -2276,8 +2276,8 @@ int handle_early_requeue_pi_wakeup(struct futex_hash_bucket *hb,
2276 * 2276 *
2277 * If 4 or 7, we cleanup and return with -ETIMEDOUT. 2277 * If 4 or 7, we cleanup and return with -ETIMEDOUT.
2278 * 2278 *
2279 * Returns: 2279 * Return:
2280 * 0 - On success 2280 * 0 - On success;
2281 * <0 - On error 2281 * <0 - On error
2282 */ 2282 */
2283static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, 2283static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags,
diff --git a/kernel/signal.c b/kernel/signal.c
index 2ec870a4c3c4..dd72567767d9 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -485,6 +485,9 @@ flush_signal_handlers(struct task_struct *t, int force_default)
485 if (force_default || ka->sa.sa_handler != SIG_IGN) 485 if (force_default || ka->sa.sa_handler != SIG_IGN)
486 ka->sa.sa_handler = SIG_DFL; 486 ka->sa.sa_handler = SIG_DFL;
487 ka->sa.sa_flags = 0; 487 ka->sa.sa_flags = 0;
488#ifdef __ARCH_HAS_SA_RESTORER
489 ka->sa.sa_restorer = NULL;
490#endif
488 sigemptyset(&ka->sa.sa_mask); 491 sigemptyset(&ka->sa.sa_mask);
489 ka++; 492 ka++;
490 } 493 }
@@ -2682,7 +2685,7 @@ static int do_sigpending(void *set, unsigned long sigsetsize)
2682/** 2685/**
2683 * sys_rt_sigpending - examine a pending signal that has been raised 2686 * sys_rt_sigpending - examine a pending signal that has been raised
2684 * while blocked 2687 * while blocked
2685 * @set: stores pending signals 2688 * @uset: stores pending signals
2686 * @sigsetsize: size of sigset_t type or larger 2689 * @sigsetsize: size of sigset_t type or larger
2687 */ 2690 */
2688SYSCALL_DEFINE2(rt_sigpending, sigset_t __user *, uset, size_t, sigsetsize) 2691SYSCALL_DEFINE2(rt_sigpending, sigset_t __user *, uset, size_t, sigsetsize)
diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
index 8b650837083e..b14f4d342043 100644
--- a/kernel/user_namespace.c
+++ b/kernel/user_namespace.c
@@ -21,6 +21,7 @@
21#include <linux/uaccess.h> 21#include <linux/uaccess.h>
22#include <linux/ctype.h> 22#include <linux/ctype.h>
23#include <linux/projid.h> 23#include <linux/projid.h>
24#include <linux/fs_struct.h>
24 25
25static struct kmem_cache *user_ns_cachep __read_mostly; 26static struct kmem_cache *user_ns_cachep __read_mostly;
26 27
@@ -837,6 +838,9 @@ static int userns_install(struct nsproxy *nsproxy, void *ns)
837 if (atomic_read(&current->mm->mm_users) > 1) 838 if (atomic_read(&current->mm->mm_users) > 1)
838 return -EINVAL; 839 return -EINVAL;
839 840
841 if (current->fs->users != 1)
842 return -EINVAL;
843
840 if (!ns_capable(user_ns, CAP_SYS_ADMIN)) 844 if (!ns_capable(user_ns, CAP_SYS_ADMIN))
841 return -EPERM; 845 return -EPERM;
842 846
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 81f2457811eb..b48cd597145d 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -457,11 +457,12 @@ static int worker_pool_assign_id(struct worker_pool *pool)
457 int ret; 457 int ret;
458 458
459 mutex_lock(&worker_pool_idr_mutex); 459 mutex_lock(&worker_pool_idr_mutex);
460 idr_pre_get(&worker_pool_idr, GFP_KERNEL); 460 ret = idr_alloc(&worker_pool_idr, pool, 0, 0, GFP_KERNEL);
461 ret = idr_get_new(&worker_pool_idr, pool, &pool->id); 461 if (ret >= 0)
462 pool->id = ret;
462 mutex_unlock(&worker_pool_idr_mutex); 463 mutex_unlock(&worker_pool_idr_mutex);
463 464
464 return ret; 465 return ret < 0 ? ret : 0;
465} 466}
466 467
467/* 468/*
@@ -3446,28 +3447,34 @@ static void wq_unbind_fn(struct work_struct *work)
3446 3447
3447 spin_unlock_irq(&pool->lock); 3448 spin_unlock_irq(&pool->lock);
3448 mutex_unlock(&pool->assoc_mutex); 3449 mutex_unlock(&pool->assoc_mutex);
3449 }
3450 3450
3451 /* 3451 /*
3452 * Call schedule() so that we cross rq->lock and thus can guarantee 3452 * Call schedule() so that we cross rq->lock and thus can
3453 * sched callbacks see the %WORKER_UNBOUND flag. This is necessary 3453 * guarantee sched callbacks see the %WORKER_UNBOUND flag.
3454 * as scheduler callbacks may be invoked from other cpus. 3454 * This is necessary as scheduler callbacks may be invoked
3455 */ 3455 * from other cpus.
3456 schedule(); 3456 */
3457 schedule();
3457 3458
3458 /* 3459 /*
3459 * Sched callbacks are disabled now. Zap nr_running. After this, 3460 * Sched callbacks are disabled now. Zap nr_running.
3460 * nr_running stays zero and need_more_worker() and keep_working() 3461 * After this, nr_running stays zero and need_more_worker()
3461 * are always true as long as the worklist is not empty. Pools on 3462 * and keep_working() are always true as long as the
3462 * @cpu now behave as unbound (in terms of concurrency management) 3463 * worklist is not empty. This pool now behaves as an
3463 * pools which are served by workers tied to the CPU. 3464 * unbound (in terms of concurrency management) pool which
3464 * 3465 * are served by workers tied to the pool.
3465 * On return from this function, the current worker would trigger 3466 */
3466 * unbound chain execution of pending work items if other workers
3467 * didn't already.
3468 */
3469 for_each_std_worker_pool(pool, cpu)
3470 atomic_set(&pool->nr_running, 0); 3467 atomic_set(&pool->nr_running, 0);
3468
3469 /*
3470 * With concurrency management just turned off, a busy
3471 * worker blocking could lead to lengthy stalls. Kick off
3472 * unbound chain execution of currently pending work items.
3473 */
3474 spin_lock_irq(&pool->lock);
3475 wake_up_worker(pool);
3476 spin_unlock_irq(&pool->lock);
3477 }
3471} 3478}
3472 3479
3473/* 3480/*
diff --git a/lib/idr.c b/lib/idr.c
index 00739aaf95a2..322e2816f2fb 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -106,8 +106,14 @@ static struct idr_layer *idr_layer_alloc(gfp_t gfp_mask, struct idr *layer_idr)
106 if (layer_idr) 106 if (layer_idr)
107 return get_from_free_list(layer_idr); 107 return get_from_free_list(layer_idr);
108 108
109 /* try to allocate directly from kmem_cache */ 109 /*
110 new = kmem_cache_zalloc(idr_layer_cache, gfp_mask); 110 * Try to allocate directly from kmem_cache. We want to try this
111 * before preload buffer; otherwise, non-preloading idr_alloc()
112 * users will end up taking advantage of preloading ones. As the
113 * following is allowed to fail for preloaded cases, suppress
114 * warning this time.
115 */
116 new = kmem_cache_zalloc(idr_layer_cache, gfp_mask | __GFP_NOWARN);
111 if (new) 117 if (new)
112 return new; 118 return new;
113 119
@@ -115,18 +121,24 @@ static struct idr_layer *idr_layer_alloc(gfp_t gfp_mask, struct idr *layer_idr)
115 * Try to fetch one from the per-cpu preload buffer if in process 121 * Try to fetch one from the per-cpu preload buffer if in process
116 * context. See idr_preload() for details. 122 * context. See idr_preload() for details.
117 */ 123 */
118 if (in_interrupt()) 124 if (!in_interrupt()) {
119 return NULL; 125 preempt_disable();
120 126 new = __this_cpu_read(idr_preload_head);
121 preempt_disable(); 127 if (new) {
122 new = __this_cpu_read(idr_preload_head); 128 __this_cpu_write(idr_preload_head, new->ary[0]);
123 if (new) { 129 __this_cpu_dec(idr_preload_cnt);
124 __this_cpu_write(idr_preload_head, new->ary[0]); 130 new->ary[0] = NULL;
125 __this_cpu_dec(idr_preload_cnt); 131 }
126 new->ary[0] = NULL; 132 preempt_enable();
133 if (new)
134 return new;
127 } 135 }
128 preempt_enable(); 136
129 return new; 137 /*
138 * Both failed. Try kmem_cache again w/o adding __GFP_NOWARN so
139 * that memory allocation failure warning is printed as intended.
140 */
141 return kmem_cache_zalloc(idr_layer_cache, gfp_mask);
130} 142}
131 143
132static void idr_layer_rcu_free(struct rcu_head *head) 144static void idr_layer_rcu_free(struct rcu_head *head)
@@ -184,20 +196,7 @@ static void idr_mark_full(struct idr_layer **pa, int id)
184 } 196 }
185} 197}
186 198
187/** 199int __idr_pre_get(struct idr *idp, gfp_t gfp_mask)
188 * idr_pre_get - reserve resources for idr allocation
189 * @idp: idr handle
190 * @gfp_mask: memory allocation flags
191 *
192 * This function should be called prior to calling the idr_get_new* functions.
193 * It preallocates enough memory to satisfy the worst possible allocation. The
194 * caller should pass in GFP_KERNEL if possible. This of course requires that
195 * no spinning locks be held.
196 *
197 * If the system is REALLY out of memory this function returns %0,
198 * otherwise %1.
199 */
200int idr_pre_get(struct idr *idp, gfp_t gfp_mask)
201{ 200{
202 while (idp->id_free_cnt < MAX_IDR_FREE) { 201 while (idp->id_free_cnt < MAX_IDR_FREE) {
203 struct idr_layer *new; 202 struct idr_layer *new;
@@ -208,13 +207,12 @@ int idr_pre_get(struct idr *idp, gfp_t gfp_mask)
208 } 207 }
209 return 1; 208 return 1;
210} 209}
211EXPORT_SYMBOL(idr_pre_get); 210EXPORT_SYMBOL(__idr_pre_get);
212 211
213/** 212/**
214 * sub_alloc - try to allocate an id without growing the tree depth 213 * sub_alloc - try to allocate an id without growing the tree depth
215 * @idp: idr handle 214 * @idp: idr handle
216 * @starting_id: id to start search at 215 * @starting_id: id to start search at
217 * @id: pointer to the allocated handle
218 * @pa: idr_layer[MAX_IDR_LEVEL] used as backtrack buffer 216 * @pa: idr_layer[MAX_IDR_LEVEL] used as backtrack buffer
219 * @gfp_mask: allocation mask for idr_layer_alloc() 217 * @gfp_mask: allocation mask for idr_layer_alloc()
220 * @layer_idr: optional idr passed to idr_layer_alloc() 218 * @layer_idr: optional idr passed to idr_layer_alloc()
@@ -376,25 +374,7 @@ static void idr_fill_slot(struct idr *idr, void *ptr, int id,
376 idr_mark_full(pa, id); 374 idr_mark_full(pa, id);
377} 375}
378 376
379/** 377int __idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id)
380 * idr_get_new_above - allocate new idr entry above or equal to a start id
381 * @idp: idr handle
382 * @ptr: pointer you want associated with the id
383 * @starting_id: id to start search at
384 * @id: pointer to the allocated handle
385 *
386 * This is the allocate id function. It should be called with any
387 * required locks.
388 *
389 * If allocation from IDR's private freelist fails, idr_get_new_above() will
390 * return %-EAGAIN. The caller should retry the idr_pre_get() call to refill
391 * IDR's preallocation and then retry the idr_get_new_above() call.
392 *
393 * If the idr is full idr_get_new_above() will return %-ENOSPC.
394 *
395 * @id returns a value in the range @starting_id ... %0x7fffffff
396 */
397int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id)
398{ 378{
399 struct idr_layer *pa[MAX_IDR_LEVEL + 1]; 379 struct idr_layer *pa[MAX_IDR_LEVEL + 1];
400 int rv; 380 int rv;
@@ -407,7 +387,7 @@ int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id)
407 *id = rv; 387 *id = rv;
408 return 0; 388 return 0;
409} 389}
410EXPORT_SYMBOL(idr_get_new_above); 390EXPORT_SYMBOL(__idr_get_new_above);
411 391
412/** 392/**
413 * idr_preload - preload for idr_alloc() 393 * idr_preload - preload for idr_alloc()
@@ -908,7 +888,7 @@ static void free_bitmap(struct ida *ida, struct ida_bitmap *bitmap)
908int ida_pre_get(struct ida *ida, gfp_t gfp_mask) 888int ida_pre_get(struct ida *ida, gfp_t gfp_mask)
909{ 889{
910 /* allocate idr_layers */ 890 /* allocate idr_layers */
911 if (!idr_pre_get(&ida->idr, gfp_mask)) 891 if (!__idr_pre_get(&ida->idr, gfp_mask))
912 return 0; 892 return 0;
913 893
914 /* allocate free_bitmap */ 894 /* allocate free_bitmap */
diff --git a/lib/xz/Kconfig b/lib/xz/Kconfig
index 82a04d7ba99e..08837db52d94 100644
--- a/lib/xz/Kconfig
+++ b/lib/xz/Kconfig
@@ -15,7 +15,7 @@ config XZ_DEC_X86
15 15
16config XZ_DEC_POWERPC 16config XZ_DEC_POWERPC
17 bool "PowerPC BCJ filter decoder" 17 bool "PowerPC BCJ filter decoder"
18 default y if POWERPC 18 default y if PPC
19 select XZ_DEC_BCJ 19 select XZ_DEC_BCJ
20 20
21config XZ_DEC_IA64 21config XZ_DEC_IA64
diff --git a/mm/Kconfig b/mm/Kconfig
index ae55c1e04d10..3bea74f1ccfe 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -286,8 +286,12 @@ config NR_QUICK
286 default "1" 286 default "1"
287 287
288config VIRT_TO_BUS 288config VIRT_TO_BUS
289 def_bool y 289 bool
290 depends on HAVE_VIRT_TO_BUS 290 help
291 An architecture should select this if it implements the
292 deprecated interface virt_to_bus(). All new architectures
293 should probably not select this.
294
291 295
292config MMU_NOTIFIER 296config MMU_NOTIFIER
293 bool 297 bool
diff --git a/mm/fremap.c b/mm/fremap.c
index 0cd4c11488ed..4723ac8d2fc2 100644
--- a/mm/fremap.c
+++ b/mm/fremap.c
@@ -129,7 +129,7 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
129 struct vm_area_struct *vma; 129 struct vm_area_struct *vma;
130 int err = -EINVAL; 130 int err = -EINVAL;
131 int has_write_lock = 0; 131 int has_write_lock = 0;
132 vm_flags_t vm_flags; 132 vm_flags_t vm_flags = 0;
133 133
134 if (prot) 134 if (prot)
135 return err; 135 return err;
@@ -254,7 +254,8 @@ get_write_lock:
254 */ 254 */
255 255
256out: 256out:
257 vm_flags = vma->vm_flags; 257 if (vma)
258 vm_flags = vma->vm_flags;
258 if (likely(!has_write_lock)) 259 if (likely(!has_write_lock))
259 up_read(&mm->mmap_sem); 260 up_read(&mm->mmap_sem);
260 else 261 else
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index b81a367b9f39..9597eec8239d 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1801,7 +1801,7 @@ int __ref remove_memory(int nid, u64 start, u64 size)
1801 int retry = 1; 1801 int retry = 1;
1802 1802
1803 start_pfn = PFN_DOWN(start); 1803 start_pfn = PFN_DOWN(start);
1804 end_pfn = start_pfn + PFN_DOWN(size); 1804 end_pfn = PFN_UP(start + size - 1);
1805 1805
1806 /* 1806 /*
1807 * When CONFIG_MEMCG is on, one memory block may be used by other 1807 * When CONFIG_MEMCG is on, one memory block may be used by other
diff --git a/mm/process_vm_access.c b/mm/process_vm_access.c
index 926b46649749..fd26d0433509 100644
--- a/mm/process_vm_access.c
+++ b/mm/process_vm_access.c
@@ -429,12 +429,6 @@ compat_process_vm_rw(compat_pid_t pid,
429 if (flags != 0) 429 if (flags != 0)
430 return -EINVAL; 430 return -EINVAL;
431 431
432 if (!access_ok(VERIFY_READ, lvec, liovcnt * sizeof(*lvec)))
433 goto out;
434
435 if (!access_ok(VERIFY_READ, rvec, riovcnt * sizeof(*rvec)))
436 goto out;
437
438 if (vm_write) 432 if (vm_write)
439 rc = compat_rw_copy_check_uvector(WRITE, lvec, liovcnt, 433 rc = compat_rw_copy_check_uvector(WRITE, lvec, liovcnt,
440 UIO_FASTIOV, iovstack_l, 434 UIO_FASTIOV, iovstack_l,
@@ -459,8 +453,6 @@ free_iovecs:
459 kfree(iov_r); 453 kfree(iov_r);
460 if (iov_l != iovstack_l) 454 if (iov_l != iovstack_l)
461 kfree(iov_l); 455 kfree(iov_l);
462
463out:
464 return rc; 456 return rc;
465} 457}
466 458
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index db12a0fcfe50..299fc5f40a26 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -330,6 +330,7 @@ static int br_setport(struct net_bridge_port *p, struct nlattr *tb[])
330 br_set_port_flag(p, tb, IFLA_BRPORT_MODE, BR_HAIRPIN_MODE); 330 br_set_port_flag(p, tb, IFLA_BRPORT_MODE, BR_HAIRPIN_MODE);
331 br_set_port_flag(p, tb, IFLA_BRPORT_GUARD, BR_BPDU_GUARD); 331 br_set_port_flag(p, tb, IFLA_BRPORT_GUARD, BR_BPDU_GUARD);
332 br_set_port_flag(p, tb, IFLA_BRPORT_FAST_LEAVE, BR_MULTICAST_FAST_LEAVE); 332 br_set_port_flag(p, tb, IFLA_BRPORT_FAST_LEAVE, BR_MULTICAST_FAST_LEAVE);
333 br_set_port_flag(p, tb, IFLA_BRPORT_PROTECT, BR_ROOT_BLOCK);
333 334
334 if (tb[IFLA_BRPORT_COST]) { 335 if (tb[IFLA_BRPORT_COST]) {
335 err = br_stp_set_path_cost(p, nla_get_u32(tb[IFLA_BRPORT_COST])); 336 err = br_stp_set_path_cost(p, nla_get_u32(tb[IFLA_BRPORT_COST]));
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c
index 69bc4bf89e3e..4543b9aba40c 100644
--- a/net/ceph/osdmap.c
+++ b/net/ceph/osdmap.c
@@ -654,6 +654,24 @@ static int osdmap_set_max_osd(struct ceph_osdmap *map, int max)
654 return 0; 654 return 0;
655} 655}
656 656
657static int __decode_pgid(void **p, void *end, struct ceph_pg *pg)
658{
659 u8 v;
660
661 ceph_decode_need(p, end, 1+8+4+4, bad);
662 v = ceph_decode_8(p);
663 if (v != 1)
664 goto bad;
665 pg->pool = ceph_decode_64(p);
666 pg->seed = ceph_decode_32(p);
667 *p += 4; /* skip preferred */
668 return 0;
669
670bad:
671 dout("error decoding pgid\n");
672 return -EINVAL;
673}
674
657/* 675/*
658 * decode a full map. 676 * decode a full map.
659 */ 677 */
@@ -745,13 +763,12 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end)
745 for (i = 0; i < len; i++) { 763 for (i = 0; i < len; i++) {
746 int n, j; 764 int n, j;
747 struct ceph_pg pgid; 765 struct ceph_pg pgid;
748 struct ceph_pg_v1 pgid_v1;
749 struct ceph_pg_mapping *pg; 766 struct ceph_pg_mapping *pg;
750 767
751 ceph_decode_need(p, end, sizeof(u32) + sizeof(u64), bad); 768 err = __decode_pgid(p, end, &pgid);
752 ceph_decode_copy(p, &pgid_v1, sizeof(pgid_v1)); 769 if (err)
753 pgid.pool = le32_to_cpu(pgid_v1.pool); 770 goto bad;
754 pgid.seed = le16_to_cpu(pgid_v1.ps); 771 ceph_decode_need(p, end, sizeof(u32), bad);
755 n = ceph_decode_32(p); 772 n = ceph_decode_32(p);
756 err = -EINVAL; 773 err = -EINVAL;
757 if (n > (UINT_MAX - sizeof(*pg)) / sizeof(u32)) 774 if (n > (UINT_MAX - sizeof(*pg)) / sizeof(u32))
@@ -818,8 +835,8 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
818 u16 version; 835 u16 version;
819 836
820 ceph_decode_16_safe(p, end, version, bad); 837 ceph_decode_16_safe(p, end, version, bad);
821 if (version > 6) { 838 if (version != 6) {
822 pr_warning("got unknown v %d > %d of inc osdmap\n", version, 6); 839 pr_warning("got unknown v %d != 6 of inc osdmap\n", version);
823 goto bad; 840 goto bad;
824 } 841 }
825 842
@@ -963,15 +980,14 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
963 while (len--) { 980 while (len--) {
964 struct ceph_pg_mapping *pg; 981 struct ceph_pg_mapping *pg;
965 int j; 982 int j;
966 struct ceph_pg_v1 pgid_v1;
967 struct ceph_pg pgid; 983 struct ceph_pg pgid;
968 u32 pglen; 984 u32 pglen;
969 ceph_decode_need(p, end, sizeof(u64) + sizeof(u32), bad);
970 ceph_decode_copy(p, &pgid_v1, sizeof(pgid_v1));
971 pgid.pool = le32_to_cpu(pgid_v1.pool);
972 pgid.seed = le16_to_cpu(pgid_v1.ps);
973 pglen = ceph_decode_32(p);
974 985
986 err = __decode_pgid(p, end, &pgid);
987 if (err)
988 goto bad;
989 ceph_decode_need(p, end, sizeof(u32), bad);
990 pglen = ceph_decode_32(p);
975 if (pglen) { 991 if (pglen) {
976 ceph_decode_need(p, end, pglen*sizeof(u32), bad); 992 ceph_decode_need(p, end, pglen*sizeof(u32), bad);
977 993
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index a585d45cc9d9..5fb8d7e47294 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -2621,7 +2621,7 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
2621 struct rtattr *attr = (void *)nlh + NLMSG_ALIGN(min_len); 2621 struct rtattr *attr = (void *)nlh + NLMSG_ALIGN(min_len);
2622 2622
2623 while (RTA_OK(attr, attrlen)) { 2623 while (RTA_OK(attr, attrlen)) {
2624 unsigned int flavor = attr->rta_type; 2624 unsigned int flavor = attr->rta_type & NLA_TYPE_MASK;
2625 if (flavor) { 2625 if (flavor) {
2626 if (flavor > rta_max[sz_idx]) 2626 if (flavor > rta_max[sz_idx])
2627 return -EINVAL; 2627 return -EINVAL;
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c
index 245ae078a07f..f4fd23de9b13 100644
--- a/net/ipv4/inet_fragment.c
+++ b/net/ipv4/inet_fragment.c
@@ -21,6 +21,7 @@
21#include <linux/rtnetlink.h> 21#include <linux/rtnetlink.h>
22#include <linux/slab.h> 22#include <linux/slab.h>
23 23
24#include <net/sock.h>
24#include <net/inet_frag.h> 25#include <net/inet_frag.h>
25 26
26static void inet_frag_secret_rebuild(unsigned long dummy) 27static void inet_frag_secret_rebuild(unsigned long dummy)
@@ -277,6 +278,7 @@ struct inet_frag_queue *inet_frag_find(struct netns_frags *nf,
277 __releases(&f->lock) 278 __releases(&f->lock)
278{ 279{
279 struct inet_frag_queue *q; 280 struct inet_frag_queue *q;
281 int depth = 0;
280 282
281 hlist_for_each_entry(q, &f->hash[hash], list) { 283 hlist_for_each_entry(q, &f->hash[hash], list) {
282 if (q->net == nf && f->match(q, key)) { 284 if (q->net == nf && f->match(q, key)) {
@@ -284,9 +286,25 @@ struct inet_frag_queue *inet_frag_find(struct netns_frags *nf,
284 read_unlock(&f->lock); 286 read_unlock(&f->lock);
285 return q; 287 return q;
286 } 288 }
289 depth++;
287 } 290 }
288 read_unlock(&f->lock); 291 read_unlock(&f->lock);
289 292
290 return inet_frag_create(nf, f, key); 293 if (depth <= INETFRAGS_MAXDEPTH)
294 return inet_frag_create(nf, f, key);
295 else
296 return ERR_PTR(-ENOBUFS);
291} 297}
292EXPORT_SYMBOL(inet_frag_find); 298EXPORT_SYMBOL(inet_frag_find);
299
300void inet_frag_maybe_warn_overflow(struct inet_frag_queue *q,
301 const char *prefix)
302{
303 static const char msg[] = "inet_frag_find: Fragment hash bucket"
304 " list length grew over limit " __stringify(INETFRAGS_MAXDEPTH)
305 ". Dropping fragment.\n";
306
307 if (PTR_ERR(q) == -ENOBUFS)
308 LIMIT_NETDEBUG(KERN_WARNING "%s%s", prefix, msg);
309}
310EXPORT_SYMBOL(inet_frag_maybe_warn_overflow);
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index b6d30acb600c..a6445b843ef4 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -292,14 +292,11 @@ static inline struct ipq *ip_find(struct net *net, struct iphdr *iph, u32 user)
292 hash = ipqhashfn(iph->id, iph->saddr, iph->daddr, iph->protocol); 292 hash = ipqhashfn(iph->id, iph->saddr, iph->daddr, iph->protocol);
293 293
294 q = inet_frag_find(&net->ipv4.frags, &ip4_frags, &arg, hash); 294 q = inet_frag_find(&net->ipv4.frags, &ip4_frags, &arg, hash);
295 if (q == NULL) 295 if (IS_ERR_OR_NULL(q)) {
296 goto out_nomem; 296 inet_frag_maybe_warn_overflow(q, pr_fmt());
297 297 return NULL;
298 }
298 return container_of(q, struct ipq, q); 299 return container_of(q, struct ipq, q);
299
300out_nomem:
301 LIMIT_NETDEBUG(KERN_ERR pr_fmt("ip_frag_create: no memory left !\n"));
302 return NULL;
303} 300}
304 301
305/* Is the fragment too far ahead to be part of ipq? */ 302/* Is the fragment too far ahead to be part of ipq? */
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index d0ef0e674ec5..91d66dbde9c0 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -798,10 +798,7 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
798 798
799 if (dev->header_ops && dev->type == ARPHRD_IPGRE) { 799 if (dev->header_ops && dev->type == ARPHRD_IPGRE) {
800 gre_hlen = 0; 800 gre_hlen = 0;
801 if (skb->protocol == htons(ETH_P_IP)) 801 tiph = (const struct iphdr *)skb->data;
802 tiph = (const struct iphdr *)skb->data;
803 else
804 tiph = &tunnel->parms.iph;
805 } else { 802 } else {
806 gre_hlen = tunnel->hlen; 803 gre_hlen = tunnel->hlen;
807 tiph = &tunnel->parms.iph; 804 tiph = &tunnel->parms.iph;
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 4a8ec457310f..d09203c63264 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -274,13 +274,6 @@ static void tcp_v4_mtu_reduced(struct sock *sk)
274 struct inet_sock *inet = inet_sk(sk); 274 struct inet_sock *inet = inet_sk(sk);
275 u32 mtu = tcp_sk(sk)->mtu_info; 275 u32 mtu = tcp_sk(sk)->mtu_info;
276 276
277 /* We are not interested in TCP_LISTEN and open_requests (SYN-ACKs
278 * send out by Linux are always <576bytes so they should go through
279 * unfragmented).
280 */
281 if (sk->sk_state == TCP_LISTEN)
282 return;
283
284 dst = inet_csk_update_pmtu(sk, mtu); 277 dst = inet_csk_update_pmtu(sk, mtu);
285 if (!dst) 278 if (!dst)
286 return; 279 return;
@@ -408,6 +401,13 @@ void tcp_v4_err(struct sk_buff *icmp_skb, u32 info)
408 goto out; 401 goto out;
409 402
410 if (code == ICMP_FRAG_NEEDED) { /* PMTU discovery (RFC1191) */ 403 if (code == ICMP_FRAG_NEEDED) { /* PMTU discovery (RFC1191) */
404 /* We are not interested in TCP_LISTEN and open_requests
405 * (SYN-ACKs send out by Linux are always <576bytes so
406 * they should go through unfragmented).
407 */
408 if (sk->sk_state == TCP_LISTEN)
409 goto out;
410
411 tp->mtu_info = info; 411 tp->mtu_info = info;
412 if (!sock_owned_by_user(sk)) { 412 if (!sock_owned_by_user(sk)) {
413 tcp_v4_mtu_reduced(sk); 413 tcp_v4_mtu_reduced(sk);
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index 54087e96d7b8..6700069949dd 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -14,6 +14,8 @@
14 * 2 of the License, or (at your option) any later version. 14 * 2 of the License, or (at your option) any later version.
15 */ 15 */
16 16
17#define pr_fmt(fmt) "IPv6-nf: " fmt
18
17#include <linux/errno.h> 19#include <linux/errno.h>
18#include <linux/types.h> 20#include <linux/types.h>
19#include <linux/string.h> 21#include <linux/string.h>
@@ -180,13 +182,11 @@ static inline struct frag_queue *fq_find(struct net *net, __be32 id,
180 182
181 q = inet_frag_find(&net->nf_frag.frags, &nf_frags, &arg, hash); 183 q = inet_frag_find(&net->nf_frag.frags, &nf_frags, &arg, hash);
182 local_bh_enable(); 184 local_bh_enable();
183 if (q == NULL) 185 if (IS_ERR_OR_NULL(q)) {
184 goto oom; 186 inet_frag_maybe_warn_overflow(q, pr_fmt());
185 187 return NULL;
188 }
186 return container_of(q, struct frag_queue, q); 189 return container_of(q, struct frag_queue, q);
187
188oom:
189 return NULL;
190} 190}
191 191
192 192
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index 3c6a77290c6e..196ab9347ad1 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -26,6 +26,9 @@
26 * YOSHIFUJI,H. @USAGI Always remove fragment header to 26 * YOSHIFUJI,H. @USAGI Always remove fragment header to
27 * calculate ICV correctly. 27 * calculate ICV correctly.
28 */ 28 */
29
30#define pr_fmt(fmt) "IPv6: " fmt
31
29#include <linux/errno.h> 32#include <linux/errno.h>
30#include <linux/types.h> 33#include <linux/types.h>
31#include <linux/string.h> 34#include <linux/string.h>
@@ -185,9 +188,10 @@ fq_find(struct net *net, __be32 id, const struct in6_addr *src, const struct in6
185 hash = inet6_hash_frag(id, src, dst, ip6_frags.rnd); 188 hash = inet6_hash_frag(id, src, dst, ip6_frags.rnd);
186 189
187 q = inet_frag_find(&net->ipv6.frags, &ip6_frags, &arg, hash); 190 q = inet_frag_find(&net->ipv6.frags, &ip6_frags, &arg, hash);
188 if (q == NULL) 191 if (IS_ERR_OR_NULL(q)) {
192 inet_frag_maybe_warn_overflow(q, pr_fmt());
189 return NULL; 193 return NULL;
190 194 }
191 return container_of(q, struct frag_queue, q); 195 return container_of(q, struct frag_queue, q);
192} 196}
193 197
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 9b6460055df5..f6d629fd6aee 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -389,6 +389,13 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
389 } 389 }
390 390
391 if (type == ICMPV6_PKT_TOOBIG) { 391 if (type == ICMPV6_PKT_TOOBIG) {
392 /* We are not interested in TCP_LISTEN and open_requests
393 * (SYN-ACKs send out by Linux are always <576bytes so
394 * they should go through unfragmented).
395 */
396 if (sk->sk_state == TCP_LISTEN)
397 goto out;
398
392 tp->mtu_info = ntohl(info); 399 tp->mtu_info = ntohl(info);
393 if (!sock_owned_by_user(sk)) 400 if (!sock_owned_by_user(sk))
394 tcp_v6_mtu_reduced(sk); 401 tcp_v6_mtu_reduced(sk);
diff --git a/net/nfc/llcp/llcp.c b/net/nfc/llcp/llcp.c
index 7f8266dd14cb..b530afadd76c 100644
--- a/net/nfc/llcp/llcp.c
+++ b/net/nfc/llcp/llcp.c
@@ -68,7 +68,8 @@ static void nfc_llcp_socket_purge(struct nfc_llcp_sock *sock)
68 } 68 }
69} 69}
70 70
71static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen) 71static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen,
72 int err)
72{ 73{
73 struct sock *sk; 74 struct sock *sk;
74 struct hlist_node *tmp; 75 struct hlist_node *tmp;
@@ -100,7 +101,10 @@ static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen)
100 101
101 nfc_llcp_accept_unlink(accept_sk); 102 nfc_llcp_accept_unlink(accept_sk);
102 103
104 if (err)
105 accept_sk->sk_err = err;
103 accept_sk->sk_state = LLCP_CLOSED; 106 accept_sk->sk_state = LLCP_CLOSED;
107 accept_sk->sk_state_change(sk);
104 108
105 bh_unlock_sock(accept_sk); 109 bh_unlock_sock(accept_sk);
106 110
@@ -123,7 +127,10 @@ static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen)
123 continue; 127 continue;
124 } 128 }
125 129
130 if (err)
131 sk->sk_err = err;
126 sk->sk_state = LLCP_CLOSED; 132 sk->sk_state = LLCP_CLOSED;
133 sk->sk_state_change(sk);
127 134
128 bh_unlock_sock(sk); 135 bh_unlock_sock(sk);
129 136
@@ -133,6 +140,36 @@ static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen)
133 } 140 }
134 141
135 write_unlock(&local->sockets.lock); 142 write_unlock(&local->sockets.lock);
143
144 /*
145 * If we want to keep the listening sockets alive,
146 * we don't touch the RAW ones.
147 */
148 if (listen == true)
149 return;
150
151 write_lock(&local->raw_sockets.lock);
152
153 sk_for_each_safe(sk, tmp, &local->raw_sockets.head) {
154 llcp_sock = nfc_llcp_sock(sk);
155
156 bh_lock_sock(sk);
157
158 nfc_llcp_socket_purge(llcp_sock);
159
160 if (err)
161 sk->sk_err = err;
162 sk->sk_state = LLCP_CLOSED;
163 sk->sk_state_change(sk);
164
165 bh_unlock_sock(sk);
166
167 sock_orphan(sk);
168
169 sk_del_node_init(sk);
170 }
171
172 write_unlock(&local->raw_sockets.lock);
136} 173}
137 174
138struct nfc_llcp_local *nfc_llcp_local_get(struct nfc_llcp_local *local) 175struct nfc_llcp_local *nfc_llcp_local_get(struct nfc_llcp_local *local)
@@ -142,20 +179,25 @@ struct nfc_llcp_local *nfc_llcp_local_get(struct nfc_llcp_local *local)
142 return local; 179 return local;
143} 180}
144 181
145static void local_release(struct kref *ref) 182static void local_cleanup(struct nfc_llcp_local *local, bool listen)
146{ 183{
147 struct nfc_llcp_local *local; 184 nfc_llcp_socket_release(local, listen, ENXIO);
148
149 local = container_of(ref, struct nfc_llcp_local, ref);
150
151 list_del(&local->list);
152 nfc_llcp_socket_release(local, false);
153 del_timer_sync(&local->link_timer); 185 del_timer_sync(&local->link_timer);
154 skb_queue_purge(&local->tx_queue); 186 skb_queue_purge(&local->tx_queue);
155 cancel_work_sync(&local->tx_work); 187 cancel_work_sync(&local->tx_work);
156 cancel_work_sync(&local->rx_work); 188 cancel_work_sync(&local->rx_work);
157 cancel_work_sync(&local->timeout_work); 189 cancel_work_sync(&local->timeout_work);
158 kfree_skb(local->rx_pending); 190 kfree_skb(local->rx_pending);
191}
192
193static void local_release(struct kref *ref)
194{
195 struct nfc_llcp_local *local;
196
197 local = container_of(ref, struct nfc_llcp_local, ref);
198
199 list_del(&local->list);
200 local_cleanup(local, false);
159 kfree(local); 201 kfree(local);
160} 202}
161 203
@@ -1348,7 +1390,7 @@ void nfc_llcp_mac_is_down(struct nfc_dev *dev)
1348 return; 1390 return;
1349 1391
1350 /* Close and purge all existing sockets */ 1392 /* Close and purge all existing sockets */
1351 nfc_llcp_socket_release(local, true); 1393 nfc_llcp_socket_release(local, true, 0);
1352} 1394}
1353 1395
1354void nfc_llcp_mac_is_up(struct nfc_dev *dev, u32 target_idx, 1396void nfc_llcp_mac_is_up(struct nfc_dev *dev, u32 target_idx,
@@ -1427,6 +1469,8 @@ void nfc_llcp_unregister_device(struct nfc_dev *dev)
1427 return; 1469 return;
1428 } 1470 }
1429 1471
1472 local_cleanup(local, false);
1473
1430 nfc_llcp_local_put(local); 1474 nfc_llcp_local_put(local);
1431} 1475}
1432 1476
diff --git a/net/nfc/llcp/sock.c b/net/nfc/llcp/sock.c
index 5332751943a9..5c7cdf3f2a83 100644
--- a/net/nfc/llcp/sock.c
+++ b/net/nfc/llcp/sock.c
@@ -278,6 +278,8 @@ struct sock *nfc_llcp_accept_dequeue(struct sock *parent,
278 278
279 pr_debug("Returning sk state %d\n", sk->sk_state); 279 pr_debug("Returning sk state %d\n", sk->sk_state);
280 280
281 sk_acceptq_removed(parent);
282
281 return sk; 283 return sk;
282 } 284 }
283 285
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
index ac2defeeba83..d4d5363c7ba7 100644
--- a/net/openvswitch/actions.c
+++ b/net/openvswitch/actions.c
@@ -58,7 +58,7 @@ static int __pop_vlan_tci(struct sk_buff *skb, __be16 *current_tci)
58 58
59 if (skb->ip_summed == CHECKSUM_COMPLETE) 59 if (skb->ip_summed == CHECKSUM_COMPLETE)
60 skb->csum = csum_sub(skb->csum, csum_partial(skb->data 60 skb->csum = csum_sub(skb->csum, csum_partial(skb->data
61 + ETH_HLEN, VLAN_HLEN, 0)); 61 + (2 * ETH_ALEN), VLAN_HLEN, 0));
62 62
63 vhdr = (struct vlan_hdr *)(skb->data + ETH_HLEN); 63 vhdr = (struct vlan_hdr *)(skb->data + ETH_HLEN);
64 *current_tci = vhdr->h_vlan_TCI; 64 *current_tci = vhdr->h_vlan_TCI;
@@ -115,7 +115,7 @@ static int push_vlan(struct sk_buff *skb, const struct ovs_action_push_vlan *vla
115 115
116 if (skb->ip_summed == CHECKSUM_COMPLETE) 116 if (skb->ip_summed == CHECKSUM_COMPLETE)
117 skb->csum = csum_add(skb->csum, csum_partial(skb->data 117 skb->csum = csum_add(skb->csum, csum_partial(skb->data
118 + ETH_HLEN, VLAN_HLEN, 0)); 118 + (2 * ETH_ALEN), VLAN_HLEN, 0));
119 119
120 } 120 }
121 __vlan_hwaccel_put_tag(skb, ntohs(vlan->vlan_tci) & ~VLAN_TAG_PRESENT); 121 __vlan_hwaccel_put_tag(skb, ntohs(vlan->vlan_tci) & ~VLAN_TAG_PRESENT);
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index e87a26506dba..a4b724708a1a 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -394,6 +394,7 @@ static int queue_userspace_packet(struct net *net, int dp_ifindex,
394 394
395 skb_copy_and_csum_dev(skb, nla_data(nla)); 395 skb_copy_and_csum_dev(skb, nla_data(nla));
396 396
397 genlmsg_end(user_skb, upcall);
397 err = genlmsg_unicast(net, user_skb, upcall_info->portid); 398 err = genlmsg_unicast(net, user_skb, upcall_info->portid);
398 399
399out: 400out:
@@ -1690,6 +1691,7 @@ static int ovs_vport_cmd_new(struct sk_buff *skb, struct genl_info *info)
1690 if (IS_ERR(vport)) 1691 if (IS_ERR(vport))
1691 goto exit_unlock; 1692 goto exit_unlock;
1692 1693
1694 err = 0;
1693 reply = ovs_vport_cmd_build_info(vport, info->snd_portid, info->snd_seq, 1695 reply = ovs_vport_cmd_build_info(vport, info->snd_portid, info->snd_seq,
1694 OVS_VPORT_CMD_NEW); 1696 OVS_VPORT_CMD_NEW);
1695 if (IS_ERR(reply)) { 1697 if (IS_ERR(reply)) {
@@ -1771,6 +1773,7 @@ static int ovs_vport_cmd_del(struct sk_buff *skb, struct genl_info *info)
1771 if (IS_ERR(reply)) 1773 if (IS_ERR(reply))
1772 goto exit_unlock; 1774 goto exit_unlock;
1773 1775
1776 err = 0;
1774 ovs_dp_detach_port(vport); 1777 ovs_dp_detach_port(vport);
1775 1778
1776 genl_notify(reply, genl_info_net(info), info->snd_portid, 1779 genl_notify(reply, genl_info_net(info), info->snd_portid,
diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c
index 20605ecf100b..fe0e4215c73d 100644
--- a/net/openvswitch/flow.c
+++ b/net/openvswitch/flow.c
@@ -482,7 +482,11 @@ static __be16 parse_ethertype(struct sk_buff *skb)
482 return htons(ETH_P_802_2); 482 return htons(ETH_P_802_2);
483 483
484 __skb_pull(skb, sizeof(struct llc_snap_hdr)); 484 __skb_pull(skb, sizeof(struct llc_snap_hdr));
485 return llc->ethertype; 485
486 if (ntohs(llc->ethertype) >= 1536)
487 return llc->ethertype;
488
489 return htons(ETH_P_802_2);
486} 490}
487 491
488static int parse_icmpv6(struct sk_buff *skb, struct sw_flow_key *key, 492static int parse_icmpv6(struct sk_buff *skb, struct sw_flow_key *key,
diff --git a/net/openvswitch/vport-netdev.c b/net/openvswitch/vport-netdev.c
index 670cbc3518de..2130d61c384a 100644
--- a/net/openvswitch/vport-netdev.c
+++ b/net/openvswitch/vport-netdev.c
@@ -43,8 +43,7 @@ static void netdev_port_receive(struct vport *vport, struct sk_buff *skb)
43 43
44 /* Make our own copy of the packet. Otherwise we will mangle the 44 /* Make our own copy of the packet. Otherwise we will mangle the
45 * packet for anyone who came before us (e.g. tcpdump via AF_PACKET). 45 * packet for anyone who came before us (e.g. tcpdump via AF_PACKET).
46 * (No one comes after us, since we tell handle_bridge() that we took 46 */
47 * the packet.) */
48 skb = skb_share_check(skb, GFP_ATOMIC); 47 skb = skb_share_check(skb, GFP_ATOMIC);
49 if (unlikely(!skb)) 48 if (unlikely(!skb))
50 return; 49 return;
diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
index ba717cc038b3..f6b8132ce4cb 100644
--- a/net/openvswitch/vport.c
+++ b/net/openvswitch/vport.c
@@ -325,8 +325,7 @@ int ovs_vport_get_options(const struct vport *vport, struct sk_buff *skb)
325 * @skb: skb that was received 325 * @skb: skb that was received
326 * 326 *
327 * Must be called with rcu_read_lock. The packet cannot be shared and 327 * Must be called with rcu_read_lock. The packet cannot be shared and
328 * skb->data should point to the Ethernet header. The caller must have already 328 * skb->data should point to the Ethernet header.
329 * called compute_ip_summed() to initialize the checksumming fields.
330 */ 329 */
331void ovs_vport_receive(struct vport *vport, struct sk_buff *skb) 330void ovs_vport_receive(struct vport *vport, struct sk_buff *skb)
332{ 331{
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
index f7d34e7b6f81..5ead60550895 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -447,17 +447,21 @@ static int rsc_parse(struct cache_detail *cd,
447 else { 447 else {
448 int N, i; 448 int N, i;
449 449
450 /*
451 * NOTE: we skip uid_valid()/gid_valid() checks here:
452 * instead, * -1 id's are later mapped to the
453 * (export-specific) anonymous id by nfsd_setuser.
454 *
455 * (But supplementary gid's get no such special
456 * treatment so are checked for validity here.)
457 */
450 /* uid */ 458 /* uid */
451 rsci.cred.cr_uid = make_kuid(&init_user_ns, id); 459 rsci.cred.cr_uid = make_kuid(&init_user_ns, id);
452 if (!uid_valid(rsci.cred.cr_uid))
453 goto out;
454 460
455 /* gid */ 461 /* gid */
456 if (get_int(&mesg, &id)) 462 if (get_int(&mesg, &id))
457 goto out; 463 goto out;
458 rsci.cred.cr_gid = make_kgid(&init_user_ns, id); 464 rsci.cred.cr_gid = make_kgid(&init_user_ns, id);
459 if (!gid_valid(rsci.cred.cr_gid))
460 goto out;
461 465
462 /* number of additional gid's */ 466 /* number of additional gid's */
463 if (get_int(&mesg, &N)) 467 if (get_int(&mesg, &N))
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index a0f48a51e14e..a9129f8d7070 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -1175,6 +1175,7 @@ static struct file_system_type rpc_pipe_fs_type = {
1175 .kill_sb = rpc_kill_sb, 1175 .kill_sb = rpc_kill_sb,
1176}; 1176};
1177MODULE_ALIAS_FS("rpc_pipefs"); 1177MODULE_ALIAS_FS("rpc_pipefs");
1178MODULE_ALIAS("rpc_pipefs");
1178 1179
1179static void 1180static void
1180init_once(void *foo) 1181init_once(void *foo)
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index c1d8476b7692..3d02130828da 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -849,6 +849,14 @@ static void xs_tcp_close(struct rpc_xprt *xprt)
849 xs_tcp_shutdown(xprt); 849 xs_tcp_shutdown(xprt);
850} 850}
851 851
852static void xs_local_destroy(struct rpc_xprt *xprt)
853{
854 xs_close(xprt);
855 xs_free_peer_addresses(xprt);
856 xprt_free(xprt);
857 module_put(THIS_MODULE);
858}
859
852/** 860/**
853 * xs_destroy - prepare to shutdown a transport 861 * xs_destroy - prepare to shutdown a transport
854 * @xprt: doomed transport 862 * @xprt: doomed transport
@@ -862,10 +870,7 @@ static void xs_destroy(struct rpc_xprt *xprt)
862 870
863 cancel_delayed_work_sync(&transport->connect_worker); 871 cancel_delayed_work_sync(&transport->connect_worker);
864 872
865 xs_close(xprt); 873 xs_local_destroy(xprt);
866 xs_free_peer_addresses(xprt);
867 xprt_free(xprt);
868 module_put(THIS_MODULE);
869} 874}
870 875
871static inline struct rpc_xprt *xprt_from_sock(struct sock *sk) 876static inline struct rpc_xprt *xprt_from_sock(struct sock *sk)
@@ -2482,7 +2487,7 @@ static struct rpc_xprt_ops xs_local_ops = {
2482 .send_request = xs_local_send_request, 2487 .send_request = xs_local_send_request,
2483 .set_retrans_timeout = xprt_set_retrans_timeout_def, 2488 .set_retrans_timeout = xprt_set_retrans_timeout_def,
2484 .close = xs_close, 2489 .close = xs_close,
2485 .destroy = xs_destroy, 2490 .destroy = xs_local_destroy,
2486 .print_stats = xs_local_print_stats, 2491 .print_stats = xs_local_print_stats,
2487}; 2492};
2488 2493
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 25f216a841d5..477d137c0557 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -14,7 +14,7 @@ kbuild-file := $(srctree)/$(obj)/Kbuild
14include $(kbuild-file) 14include $(kbuild-file)
15 15
16# called may set destination dir (when installing to asm/) 16# called may set destination dir (when installing to asm/)
17_dst := $(or $(destination-y),$(dst),$(obj)) 17_dst := $(if $(destination-y),$(destination-y),$(if $(dst),$(dst),$(obj)))
18 18
19old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild 19old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild
20ifneq ($(wildcard $(old-kbuild-file)),) 20ifneq ($(wildcard $(old-kbuild-file)),)
@@ -48,13 +48,14 @@ all-files := $(header-y) $(genhdr-y) $(wrapper-files)
48output-files := $(addprefix $(installdir)/, $(all-files)) 48output-files := $(addprefix $(installdir)/, $(all-files))
49 49
50input-files := $(foreach hdr, $(header-y), \ 50input-files := $(foreach hdr, $(header-y), \
51 $(or \ 51 $(if $(wildcard $(srcdir)/$(hdr)), \
52 $(wildcard $(srcdir)/$(hdr)), \ 52 $(wildcard $(srcdir)/$(hdr)), \
53 $(wildcard $(oldsrcdir)/$(hdr)), \ 53 $(if $(wildcard $(oldsrcdir)/$(hdr)), \
54 $(error Missing UAPI file $(srcdir)/$(hdr)) \ 54 $(wildcard $(oldsrcdir)/$(hdr)), \
55 $(error Missing UAPI file $(srcdir)/$(hdr))) \
55 )) \ 56 )) \
56 $(foreach hdr, $(genhdr-y), \ 57 $(foreach hdr, $(genhdr-y), \
57 $(or \ 58 $(if $(wildcard $(gendir)/$(hdr)), \
58 $(wildcard $(gendir)/$(hdr)), \ 59 $(wildcard $(gendir)/$(hdr)), \
59 $(error Missing generated UAPI file $(gendir)/$(hdr)) \ 60 $(error Missing generated UAPI file $(gendir)/$(hdr)) \
60 )) 61 ))
diff --git a/security/keys/compat.c b/security/keys/compat.c
index 1c261763f479..d65fa7fa29ba 100644
--- a/security/keys/compat.c
+++ b/security/keys/compat.c
@@ -40,12 +40,12 @@ static long compat_keyctl_instantiate_key_iov(
40 ARRAY_SIZE(iovstack), 40 ARRAY_SIZE(iovstack),
41 iovstack, &iov); 41 iovstack, &iov);
42 if (ret < 0) 42 if (ret < 0)
43 return ret; 43 goto err;
44 if (ret == 0) 44 if (ret == 0)
45 goto no_payload_free; 45 goto no_payload_free;
46 46
47 ret = keyctl_instantiate_key_common(id, iov, ioc, ret, ringid); 47 ret = keyctl_instantiate_key_common(id, iov, ioc, ret, ringid);
48 48err:
49 if (iov != iovstack) 49 if (iov != iovstack)
50 kfree(iov); 50 kfree(iov);
51 return ret; 51 return ret;
diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
index a571fad91010..42defae1e161 100644
--- a/security/keys/process_keys.c
+++ b/security/keys/process_keys.c
@@ -57,7 +57,7 @@ int install_user_keyrings(void)
57 57
58 kenter("%p{%u}", user, uid); 58 kenter("%p{%u}", user, uid);
59 59
60 if (user->uid_keyring) { 60 if (user->uid_keyring && user->session_keyring) {
61 kleave(" = 0 [exist]"); 61 kleave(" = 0 [exist]");
62 return 0; 62 return 0;
63 } 63 }
diff --git a/security/selinux/xfrm.c b/security/selinux/xfrm.c
index 48665ecd1197..8ab295154517 100644
--- a/security/selinux/xfrm.c
+++ b/security/selinux/xfrm.c
@@ -310,7 +310,7 @@ int selinux_xfrm_policy_clone(struct xfrm_sec_ctx *old_ctx,
310 310
311 if (old_ctx) { 311 if (old_ctx) {
312 new_ctx = kmalloc(sizeof(*old_ctx) + old_ctx->ctx_len, 312 new_ctx = kmalloc(sizeof(*old_ctx) + old_ctx->ctx_len,
313 GFP_KERNEL); 313 GFP_ATOMIC);
314 if (!new_ctx) 314 if (!new_ctx)
315 return -ENOMEM; 315 return -ENOMEM;
316 316
diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c
index 160b1bd0cd62..24d44b2f61ac 100644
--- a/sound/core/seq/seq_timer.c
+++ b/sound/core/seq/seq_timer.c
@@ -290,10 +290,10 @@ int snd_seq_timer_open(struct snd_seq_queue *q)
290 tid.device = SNDRV_TIMER_GLOBAL_SYSTEM; 290 tid.device = SNDRV_TIMER_GLOBAL_SYSTEM;
291 err = snd_timer_open(&t, str, &tid, q->queue); 291 err = snd_timer_open(&t, str, &tid, q->queue);
292 } 292 }
293 if (err < 0) { 293 }
294 snd_printk(KERN_ERR "seq fatal error: cannot create timer (%i)\n", err); 294 if (err < 0) {
295 return err; 295 snd_printk(KERN_ERR "seq fatal error: cannot create timer (%i)\n", err);
296 } 296 return err;
297 } 297 }
298 t->callback = snd_seq_timer_interrupt; 298 t->callback = snd_seq_timer_interrupt;
299 t->callback_data = q; 299 t->callback_data = q;
diff --git a/sound/oss/sequencer.c b/sound/oss/sequencer.c
index 30bcfe470f83..4ff60a6427d9 100644
--- a/sound/oss/sequencer.c
+++ b/sound/oss/sequencer.c
@@ -545,6 +545,9 @@ static void seq_chn_common_event(unsigned char *event_rec)
545 case MIDI_PGM_CHANGE: 545 case MIDI_PGM_CHANGE:
546 if (seq_mode == SEQ_2) 546 if (seq_mode == SEQ_2)
547 { 547 {
548 if (chn > 15)
549 break;
550
548 synth_devs[dev]->chn_info[chn].pgm_num = p1; 551 synth_devs[dev]->chn_info[chn].pgm_num = p1;
549 if ((int) dev >= num_synths) 552 if ((int) dev >= num_synths)
550 synth_devs[dev]->set_instr(dev, chn, p1); 553 synth_devs[dev]->set_instr(dev, chn, p1);
@@ -596,6 +599,9 @@ static void seq_chn_common_event(unsigned char *event_rec)
596 case MIDI_PITCH_BEND: 599 case MIDI_PITCH_BEND:
597 if (seq_mode == SEQ_2) 600 if (seq_mode == SEQ_2)
598 { 601 {
602 if (chn > 15)
603 break;
604
599 synth_devs[dev]->chn_info[chn].bender_value = w14; 605 synth_devs[dev]->chn_info[chn].bender_value = w14;
600 606
601 if ((int) dev < num_synths) 607 if ((int) dev < num_synths)
diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c
index 3536b076b529..0aabfedeecba 100644
--- a/sound/pci/asihpi/asihpi.c
+++ b/sound/pci/asihpi/asihpi.c
@@ -2549,7 +2549,7 @@ static int snd_asihpi_sampleclock_add(struct snd_card_asihpi *asihpi,
2549 2549
2550static int snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi) 2550static int snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi)
2551{ 2551{
2552 struct snd_card *card = asihpi->card; 2552 struct snd_card *card;
2553 unsigned int idx = 0; 2553 unsigned int idx = 0;
2554 unsigned int subindex = 0; 2554 unsigned int subindex = 0;
2555 int err; 2555 int err;
@@ -2557,6 +2557,7 @@ static int snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi)
2557 2557
2558 if (snd_BUG_ON(!asihpi)) 2558 if (snd_BUG_ON(!asihpi))
2559 return -EINVAL; 2559 return -EINVAL;
2560 card = asihpi->card;
2560 strcpy(card->mixername, "Asihpi Mixer"); 2561 strcpy(card->mixername, "Asihpi Mixer");
2561 2562
2562 err = 2563 err =
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 97c68dd24ef5..a9ebcf9e3710 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -494,7 +494,7 @@ static unsigned int get_num_conns(struct hda_codec *codec, hda_nid_t nid)
494 494
495int snd_hda_get_num_raw_conns(struct hda_codec *codec, hda_nid_t nid) 495int snd_hda_get_num_raw_conns(struct hda_codec *codec, hda_nid_t nid)
496{ 496{
497 return get_num_conns(codec, nid) & AC_CLIST_LENGTH; 497 return snd_hda_get_raw_connections(codec, nid, NULL, 0);
498} 498}
499 499
500/** 500/**
@@ -517,9 +517,6 @@ int snd_hda_get_raw_connections(struct hda_codec *codec, hda_nid_t nid,
517 hda_nid_t prev_nid; 517 hda_nid_t prev_nid;
518 int null_count = 0; 518 int null_count = 0;
519 519
520 if (snd_BUG_ON(!conn_list || max_conns <= 0))
521 return -EINVAL;
522
523 parm = get_num_conns(codec, nid); 520 parm = get_num_conns(codec, nid);
524 if (!parm) 521 if (!parm)
525 return 0; 522 return 0;
@@ -545,7 +542,8 @@ int snd_hda_get_raw_connections(struct hda_codec *codec, hda_nid_t nid,
545 AC_VERB_GET_CONNECT_LIST, 0); 542 AC_VERB_GET_CONNECT_LIST, 0);
546 if (parm == -1 && codec->bus->rirb_error) 543 if (parm == -1 && codec->bus->rirb_error)
547 return -EIO; 544 return -EIO;
548 conn_list[0] = parm & mask; 545 if (conn_list)
546 conn_list[0] = parm & mask;
549 return 1; 547 return 1;
550 } 548 }
551 549
@@ -580,14 +578,20 @@ int snd_hda_get_raw_connections(struct hda_codec *codec, hda_nid_t nid,
580 continue; 578 continue;
581 } 579 }
582 for (n = prev_nid + 1; n <= val; n++) { 580 for (n = prev_nid + 1; n <= val; n++) {
581 if (conn_list) {
582 if (conns >= max_conns)
583 return -ENOSPC;
584 conn_list[conns] = n;
585 }
586 conns++;
587 }
588 } else {
589 if (conn_list) {
583 if (conns >= max_conns) 590 if (conns >= max_conns)
584 return -ENOSPC; 591 return -ENOSPC;
585 conn_list[conns++] = n; 592 conn_list[conns] = val;
586 } 593 }
587 } else { 594 conns++;
588 if (conns >= max_conns)
589 return -ENOSPC;
590 conn_list[conns++] = val;
591 } 595 }
592 prev_nid = val; 596 prev_nid = val;
593 } 597 }
diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
index eefc4563b2f9..0792b5725f9c 100644
--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -3239,7 +3239,7 @@ static int ca0132_set_vipsource(struct hda_codec *codec, int val)
3239 struct ca0132_spec *spec = codec->spec; 3239 struct ca0132_spec *spec = codec->spec;
3240 unsigned int tmp; 3240 unsigned int tmp;
3241 3241
3242 if (!dspload_is_loaded(codec)) 3242 if (spec->dsp_state != DSP_DOWNLOADED)
3243 return 0; 3243 return 0;
3244 3244
3245 /* if CrystalVoice if off, vipsource should be 0 */ 3245 /* if CrystalVoice if off, vipsource should be 0 */
@@ -4267,11 +4267,12 @@ static void ca0132_refresh_widget_caps(struct hda_codec *codec)
4267 */ 4267 */
4268static void ca0132_setup_defaults(struct hda_codec *codec) 4268static void ca0132_setup_defaults(struct hda_codec *codec)
4269{ 4269{
4270 struct ca0132_spec *spec = codec->spec;
4270 unsigned int tmp; 4271 unsigned int tmp;
4271 int num_fx; 4272 int num_fx;
4272 int idx, i; 4273 int idx, i;
4273 4274
4274 if (!dspload_is_loaded(codec)) 4275 if (spec->dsp_state != DSP_DOWNLOADED)
4275 return; 4276 return;
4276 4277
4277 /* out, in effects + voicefx */ 4278 /* out, in effects + voicefx */
@@ -4351,12 +4352,16 @@ static bool ca0132_download_dsp_images(struct hda_codec *codec)
4351 return false; 4352 return false;
4352 4353
4353 dsp_os_image = (struct dsp_image_seg *)(fw_entry->data); 4354 dsp_os_image = (struct dsp_image_seg *)(fw_entry->data);
4354 dspload_image(codec, dsp_os_image, 0, 0, true, 0); 4355 if (dspload_image(codec, dsp_os_image, 0, 0, true, 0)) {
4356 pr_err("ca0132 dspload_image failed.\n");
4357 goto exit_download;
4358 }
4359
4355 dsp_loaded = dspload_wait_loaded(codec); 4360 dsp_loaded = dspload_wait_loaded(codec);
4356 4361
4362exit_download:
4357 release_firmware(fw_entry); 4363 release_firmware(fw_entry);
4358 4364
4359
4360 return dsp_loaded; 4365 return dsp_loaded;
4361} 4366}
4362 4367
@@ -4367,16 +4372,13 @@ static void ca0132_download_dsp(struct hda_codec *codec)
4367#ifndef CONFIG_SND_HDA_CODEC_CA0132_DSP 4372#ifndef CONFIG_SND_HDA_CODEC_CA0132_DSP
4368 return; /* NOP */ 4373 return; /* NOP */
4369#endif 4374#endif
4370 spec->dsp_state = DSP_DOWNLOAD_INIT;
4371 4375
4372 if (spec->dsp_state == DSP_DOWNLOAD_INIT) { 4376 chipio_enable_clocks(codec);
4373 chipio_enable_clocks(codec); 4377 spec->dsp_state = DSP_DOWNLOADING;
4374 spec->dsp_state = DSP_DOWNLOADING; 4378 if (!ca0132_download_dsp_images(codec))
4375 if (!ca0132_download_dsp_images(codec)) 4379 spec->dsp_state = DSP_DOWNLOAD_FAILED;
4376 spec->dsp_state = DSP_DOWNLOAD_FAILED; 4380 else
4377 else 4381 spec->dsp_state = DSP_DOWNLOADED;
4378 spec->dsp_state = DSP_DOWNLOADED;
4379 }
4380 4382
4381 if (spec->dsp_state == DSP_DOWNLOADED) 4383 if (spec->dsp_state == DSP_DOWNLOADED)
4382 ca0132_set_dsp_msr(codec, true); 4384 ca0132_set_dsp_msr(codec, true);
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index 72ebb8a36b13..60d08f669f0c 100644
--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -506,6 +506,8 @@ static int patch_cs420x(struct hda_codec *codec)
506 if (!spec) 506 if (!spec)
507 return -ENOMEM; 507 return -ENOMEM;
508 508
509 spec->gen.automute_hook = cs_automute;
510
509 snd_hda_pick_fixup(codec, cs420x_models, cs420x_fixup_tbl, 511 snd_hda_pick_fixup(codec, cs420x_models, cs420x_fixup_tbl,
510 cs420x_fixups); 512 cs420x_fixups);
511 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); 513 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
@@ -893,6 +895,8 @@ static int patch_cs4210(struct hda_codec *codec)
893 if (!spec) 895 if (!spec)
894 return -ENOMEM; 896 return -ENOMEM;
895 897
898 spec->gen.automute_hook = cs_automute;
899
896 snd_hda_pick_fixup(codec, cs421x_models, cs421x_fixup_tbl, 900 snd_hda_pick_fixup(codec, cs421x_models, cs421x_fixup_tbl,
897 cs421x_fixups); 901 cs421x_fixups);
898 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); 902 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 83d5335ac348..dafe04ae8c72 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -815,6 +815,29 @@ static int find_mute_led_cfg(struct hda_codec *codec, int default_polarity)
815 return 0; 815 return 0;
816} 816}
817 817
818/* check whether a built-in speaker is included in parsed pins */
819static bool has_builtin_speaker(struct hda_codec *codec)
820{
821 struct sigmatel_spec *spec = codec->spec;
822 hda_nid_t *nid_pin;
823 int nids, i;
824
825 if (spec->gen.autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) {
826 nid_pin = spec->gen.autocfg.line_out_pins;
827 nids = spec->gen.autocfg.line_outs;
828 } else {
829 nid_pin = spec->gen.autocfg.speaker_pins;
830 nids = spec->gen.autocfg.speaker_outs;
831 }
832
833 for (i = 0; i < nids; i++) {
834 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid_pin[i]);
835 if (snd_hda_get_input_pin_attr(def_conf) == INPUT_PIN_ATTR_INT)
836 return true;
837 }
838 return false;
839}
840
818/* 841/*
819 * PC beep controls 842 * PC beep controls
820 */ 843 */
@@ -3890,6 +3913,12 @@ static int patch_stac92hd73xx(struct hda_codec *codec)
3890 return err; 3913 return err;
3891 } 3914 }
3892 3915
3916 /* Don't GPIO-mute speakers if there are no internal speakers, because
3917 * the GPIO might be necessary for Headphone
3918 */
3919 if (spec->eapd_switch && !has_builtin_speaker(codec))
3920 spec->eapd_switch = 0;
3921
3893 codec->proc_widget_hook = stac92hd7x_proc_hook; 3922 codec->proc_widget_hook = stac92hd7x_proc_hook;
3894 3923
3895 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); 3924 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 803953a9bff3..2da8ad75fd96 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -244,6 +244,21 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
244 usb_ifnum_to_if(dev, ctrlif)->intf_assoc; 244 usb_ifnum_to_if(dev, ctrlif)->intf_assoc;
245 245
246 if (!assoc) { 246 if (!assoc) {
247 /*
248 * Firmware writers cannot count to three. So to find
249 * the IAD on the NuForce UDH-100, also check the next
250 * interface.
251 */
252 struct usb_interface *iface =
253 usb_ifnum_to_if(dev, ctrlif + 1);
254 if (iface &&
255 iface->intf_assoc &&
256 iface->intf_assoc->bFunctionClass == USB_CLASS_AUDIO &&
257 iface->intf_assoc->bFunctionProtocol == UAC_VERSION_2)
258 assoc = iface->intf_assoc;
259 }
260
261 if (!assoc) {
247 snd_printk(KERN_ERR "Audio class v2 interfaces need an interface association\n"); 262 snd_printk(KERN_ERR "Audio class v2 interfaces need an interface association\n");
248 return -EINVAL; 263 return -EINVAL;
249 } 264 }
diff --git a/tools/usb/ffs-test.c b/tools/usb/ffs-test.c
index 8674b9ec14f6..fe1e66b6ef40 100644
--- a/tools/usb/ffs-test.c
+++ b/tools/usb/ffs-test.c
@@ -38,7 +38,7 @@
38#include <unistd.h> 38#include <unistd.h>
39#include <tools/le_byteshift.h> 39#include <tools/le_byteshift.h>
40 40
41#include "../../include/linux/usb/functionfs.h" 41#include "../../include/uapi/linux/usb/functionfs.h"
42 42
43 43
44/******************** Little Endian Handling ********************************/ 44/******************** Little Endian Handling ********************************/