IB/mlx4: Don't return an invalid speed when a port is down

When the IB port is down, the active_speed value returned by the
MAD_IFC command is seven (7) which isn't among the defined IB speeds
in enum ib_port_speed, and this invalid speed value is passed up to
higher layers or applications who do port query.

Fix that by setting the speed to be SDR -- the lowest possible -- when
the port is down.

Signed-off-by: Roland Dreier <roland@purestorage.com>
IB/core: Don't return EINVAL from sysfs rate attribute for invalid speeds

Commit e9319b0cb00d ("IB/core: Fix SDR rates in sysfs") changed our
sysfs rate attribute to return EINVAL to userspace if the underlying
device driver returns an invalid rate.  Apparently some drivers do this
when the link is down and some userspace pukes if it gets an error when
reading this attribute, so avoid a regression by not return an error to
match the old code.

Signed-off-by: Roland Dreier <roland@purestorage.com>
ARM: mach-msm: fix compile fail from system.h fallout

To fix:

  In file included from arm/boot/compressed/misc.c:28:0:
  arm/mach-msm/include/mach/uncompress.h: In function 'putc':
  arch/arm/mach-msm/include/mach/uncompress.h:48:3: error: implicit
  declaration of function 'smp_mb' [-Werror=implicit-function-declaration]

The putc does a cpu_relax which for this platform is smp_mb.

Bisect indicates the 1st failing commit as: 0195c00244dc ("Merge tag
'split-asm_system_h...")

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Acked-by: David Howells <dhowells@redhat.com>
Acked-by: David Brown <davidb@codeaurora.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
avr32: fix build failures from mis-naming of atmel_nand.h

Commit bf4289cba02b ("ATMEL: fix nand ecc support") indicated that it
wanted to "Move platform data to a common header
include/linux/platform_data/atmel_nand.h" and the new header even had
re-include protectors with:

    #ifndef __ATMEL_NAND_H__

However, the file that was added was simply called atmel.h
and this caused avr32 defconfig to fail with:

  In file included from arch/avr32/boards/atstk1000/setup.c:22:
  arch/avr32/mach-at32ap/include/mach/board.h:10:44: error: linux/platform_data/atmel_nand.h: No such file or directory
  In file included from arch/avr32/boards/atstk1000/setup.c:22:
  arch/avr32/mach-at32ap/include/mach/board.h:121: warning: 'struct atmel_nand_data' declared inside parameter list
  arch/avr32/mach-at32ap/include/mach/board.h:121: warning: its scope is only this definition or declaration, which is probably not what you want
  make[2]: *** [arch/avr32/boards/atstk1000/setup.o] Error 1

It seems the scope of the file contents will expand beyond
just nand, so ignore the original intention, and fix up the
users who reference the bad name with the _nand suffix.

CC: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
CC: David Woodhouse <dwmw2@infradead.org>
Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
blackfin: fix cmpxchg build fails from system.h fallout

Commit 3bed8d67469c ("Disintegrate asm/system.h for Blackfin [ver #2]")
introduced arch/blackfin/include/asm/cmpxchg.h but has it also including
the asm-generic one which causes this:

  CC      arch/blackfin/kernel/asm-offsets.s
  In file included from arch/blackfin/include/asm/cmpxchg.h:125:0,
                 from arch/blackfin/include/asm/atomic.h:10,
                 from include/linux/atomic.h:4,
                 from include/linux/spinlock.h:384,
                 from include/linux/seqlock.h:29,
                 from include/linux/time.h:8,
                 from include/linux/timex.h:56,
                 from include/linux/sched.h:57,
                 from arch/blackfin/kernel/asm-offsets.c:10:
  include/asm-generic/cmpxchg.h:24:15: error: redefinition of '__xchg'
  arch/blackfin/include/asm/cmpxchg.h:82:29: note: previous definition of '__xchg' was here
  make[2]: *** [arch/blackfin/kernel/asm-offsets.s] Error 1

It really only needs two simple defines from asm-generic, so just use
those instead.

Cc: Bob Liu <lliubbo@gmail.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
parisc: fix missing cmpxchg file error from system.h split

Commit b4816afa3986 ("Move the asm-generic/system.h xchg()
implementation to asm-generic/cmpxchg.h") introduced the concept of
asm/cmpxchg.h but the parisc arch never got one.  Fork the cmpxchg
content out of the asm/atomic.h file to create one.

Some minor whitespace fixups were done on the block of code that created
the new file.

Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
Cc: Helge Deller <deller@gmx.de>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
frv: fix warnings in mb93090-mb00/pci-dma.c about implicit EXPORT_SYMBOL

To fix:

    arch/frv/mb93090-mb00/pci-dma.c:31:1: warning: data definition has no type or storage class [enabled by default]
    arch/frv/mb93090-mb00/pci-dma.c:31:1: warning: type defaults to 'int' in declaration of 'EXPORT_SYMBOL' [-Wimplicit-int]
    arch/frv/mb93090-mb00/pci-dma.c:31:1: warning: parameter names (without types) in function declaration [enabled by default]
    arch/frv/mb93090-mb00/pci-dma.c:38:1: warning: data definition has no type or storage class [enabled by default]

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
firewire: restore the device.h include in linux/firewire.h

Commit 313162d0b838 ("device.h: audit and cleanup users in main include
dir") exchanged an include <linux/device.h> for a struct *device but in
actuality I misread this file when creating 313162d and it should have
remained an include.

There were no build regressions since all consumers were already getting
device.h anyway, but make it right regardless.

Reported-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
asm-generic: add linux/types.h to cmpxchg.h

Builds of the openrisc or1ksim_defconfig show the following:

  In file included from arch/openrisc/include/generated/asm/cmpxchg.h:1:0,
                   from include/asm-generic/atomic.h:18,
                   from arch/openrisc/include/generated/asm/atomic.h:1,
                   from include/linux/atomic.h:4,
                   from include/linux/dcache.h:4,
                   from fs/notify/fsnotify.c:19:
  include/asm-generic/cmpxchg.h: In function '__xchg':
  include/asm-generic/cmpxchg.h:34:20: error: expected ')' before 'u8'
  include/asm-generic/cmpxchg.h:34:20: warning: type defaults to 'int' in type name

and many more lines of similar errors.  It seems specific to the or32
because most other platforms have an arch specific component that would
have already included types.h ahead of time, but the o32 does not.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Jonas Bonn <jonas@southpole.se>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Acked-by: David Howells <dhowells@redhat.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
tg3: Fix 5717 serdes powerdown problem

If port 0 of a 5717 serdes device powers down, it hides the phy from
port 1.  This patch works around the problem by keeping port 0's phy
powered up.

Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Merge branch 'paul' (Fixups from Paul Gortmaker)

This merges some of the fixes from Paul Gortmaker for the header file
cleanup fallout.

Some of the patches are going through arch maintainer trees, and David
Howells suggested another be done differently, but this at least fixes a
few cases.

* emailed from Paul Gortmaker <paul.gortmaker@windriver.com>:
  asm-generic: add linux/types.h to cmpxchg.h
  firewire: restore the device.h include in linux/firewire.h
  frv: fix warnings in mb93090-mb00/pci-dma.c about implicit EXPORT_SYMBOL
  parisc: fix missing cmpxchg file error from system.h split
  blackfin: fix cmpxchg build fails from system.h fallout
  avr32: fix build failures from mis-naming of atmel_nand.h
  ARM: mach-msm: fix compile fail from system.h fallout
  irq_work: fix compile failure on MIPS from system.h split
ASoC: sgtl5000: Enable VAG when DAC/ADC up

As manual described, VAG is an internal voltage reference of DAC/ADC,
So enabled it before DAC/ADC up.

One more thing should care about is VAG fully ramped down requires 400ms,
wait it to avoid pop.

Signed-off-by: Zeng Zhaoming <zengzm.kernel@gmail.com>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
ASoC: tegra: ensure clocks are enabled when touching registers

Debugfs files could be accessed any time, so explicitly enable clocks
when reading registers to generate debugfs file content.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
ASoC: pxa: pxa2xx-i2s: add io.h for IOMEM macro

* fixes
  sound/soc/pxa/pxa2xx-i2s.c:86:2: error: implicit declaration of function 'IOMEM' [-Werror=implicit-function-declaration]
  sound/soc/pxa/pxa2xx-i2s.c:86:2: error: initializer element is not constant
  after 23019a733bb83c8499f192fb428b7e6e81c95a34 removed IOMEM
  definition from arch/arm/mach-pxa/include/mach/hardware.h

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
regulator: anatop: fix 'anatop_regulator' name collision

There is a name collision between 'struct platform_driver
anatop_regulator' and 'struct anatop_regulator', which causes some
section mismatch warnings like below.

WARNING: vmlinux.o(.data+0x154d4): Section mismatch in reference from the variable anatop_regulator to the function .devinit.text:anatop_regulator_probe()
The variable anatop_regulator references
the function __devinit anatop_regulator_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*driver, *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

Rename 'struct platform_driver anatop_regulator' to
'struct platform_driver anatop_regulator_driver' to fix the warnings.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sky2: dont overwrite settings for PHY Quick link

This patch corrects a bug in function sky2_open() of the Marvell Yukon 2 driver
in which the settings for PHY quick link are overwritten.

Signed-off-by: Lino Sanfilippo <LinoSanfilippo@gmx.de>
Acked-by: Stephen Hemminger <shemminger@vyattta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

Pull networking fixes from David Miller:

 1) Provide device string properly for USB i2400m wimax devices, also
    don't OOPS when providing firmware string.  From Phil Sutter.

 2) Add support for sh_eth SH7734 chips, from Nobuhiro Iwamatsu.

 3) Add another device ID to USB zaurus driver, from Guan Xin.

 4) Loop index start in pool vector iterator is wrong causing MAC to not
    get configured in bnx2x driver, fix from Dmitry Kravkov.

 5) EQL driver assumes HZ=100, fix from Eric Dumazet.

 6) Now that skb_add_rx_frag() can specify the truesize increment
    separately, do so in f_phonet and cdc_phonet, also from Eric
    Dumazet.

 7) virtio_net accidently uses net_ratelimit() not only on the kernel
    warning but also the statistic bump, fix from Rick Jones.

 8) ip_route_input_mc() uses fixed init_net namespace, oops, use
    dev_net(dev) instead.  Fix from Benjamin LaHaise.

 9) dev_forward_skb() needs to clear the incoming interface index of the
    SKB so that it looks like a new incoming packet, also from Benjamin
    LaHaise.

10) iwlwifi mistakenly initializes a channel entry as 2GHZ instead of
    5GHZ, fix from Stanislav Yakovlev.

11) Missing kmalloc() return value checks in orinoco, from Santosh
    Nayak.

12) ath9k doesn't check for HT capabilities in the right way, it is
    checking ht_supported instead of the ATH9K_HW_CAP_HT flag.  Fix from
    Sujith Manoharan.

13) Fix x86 BPF JIT emission of 16-bit immediate field of AND
    instructions, from Feiran Zhuang.

14) Avoid infinite loop in GARP code when registering sysfs entries.
    From David Ward.

15) rose protocol uses memcpy instead of memcmp in a device address
    comparison, oops.  Fix from Daniel Borkmann.

16) Fix build of lpc_eth due to dev_hw_addr_rancom() interface being
    renamed to eth_hw_addr_random().  From Roland Stigge.

17) Make ipv6 RTM_GETROUTE interpret RTA_IIF attribute the same way
    that ipv4 does.  Fix from Shmulik Ladkani.

18) via-rhine has an inverted bit test, causing suspend/resume
    regressions.  Fix from Andreas Mohr.

19) RIONET assumes 4K page size, fix from Akinobu Mita.

20) Initialization of imask register in sky2 is buggy, because bits are
    "or'd" into an uninitialized local variable.  Fix from Lino
    Sanfilippo.

21) Fix FCOE checksum offload handling, from Yi Zou.

22) Fix VLAN processing regression in e1000, from Jiri Pirko.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (52 commits)
  sky2: dont overwrite settings for PHY Quick link
  tg3: Fix 5717 serdes powerdown problem
  net: usb: cdc_eem: fix mtu
  net: sh_eth: fix endian check for architecture independent
  usb/rtl8150 : Remove duplicated definitions
  rionet: fix page allocation order of rionet_active
  via-rhine: fix wait-bit inversion.
  ipv6: Fix RTM_GETROUTE's interpretation of RTA_IIF to be consistent with ipv4
  net: lpc_eth: Fix rename of dev_hw_addr_random
  net/netfilter/nfnetlink_acct.c: use linux/atomic.h
  rose_dev: fix memcpy-bug in rose_set_mac_address
  Fix non TBI PHY access; a bad merge undid bug fix in a previous commit.
  net/garp: avoid infinite loop if attribute already exists
  x86 bpf_jit: fix a bug in emitting the 16-bit immediate operand of AND
  bonding: emit event when bonding changes MAC
  mac80211: fix oper channel timestamp updation
  ath9k: Use HW HT capabilites properly
  MAINTAINERS: adding maintainer for ipw2x00
  net: orinoco: add error handling for failed kmalloc().
  net/wireless: ipw2x00: fix a typo in wiphy struct initilization
  ...
Merge branch 'drm-prime-dmabuf-initial' of git://people.freedesktop.org/~airlied/linux

Pull dma-buf prime support from Dave Airlie:
 "This isn't a majorly urgent thing to have, but we'd like to set the
  stage for working on dma-buf support in the drm drivers for the next
  merge window, so I'd like to push in the initial submission now so
  people have something that we can build on top of.  The code just
  introduces the user interface and internal helper functions for
  drivers to use.

  We have driver support under development for i915, nouveau, udl on x86
  and exynos, omapdrm on arm, which we would be aiming for the next
  merge window."

In the -rc1 announcement I asked for people who would use this to
comment on it, and got severa "Yes please" from people for this and for
HSI (that I merged earlier).

So far crickets on pohmelfs and the DMA-mapping infrastructure.

* 'drm-prime-dmabuf-initial' of git://people.freedesktop.org/~airlied/linux:
  drm: base prime/dma-buf support (v5)
APM: fix deadlock in APM_IOC_SUSPEND ioctl

I found the Xorg server on my ARM device stuck in the 'msleep()' loop
in apm_ioctl.

I suspect it had attempted suspend immediately after resuming and lost
a race.
During that msleep(10);, a new suspend cycle must have started and
changed ->suspend_state to SUSPEND_PENDING, so it was never seen to
be SUSPEND_DONE and the loop could never exited.  It would have moved on
to SUSPEND_ACKTO but never been able to reach SUSPEND_DONE.

So change the loop to only run while SUSPEND_ACKED rather than until
SUSPEND_DONE.  This is much safer.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
ARM: versatile: fix build failure in pci.c

commit 9f786d033d025ab7d2c4d1b959aa81d935eb9e19

    "arm/PCI: get rid of device resource fixups"

causes this failure on the versatile:

arch/arm/mach-versatile/pci.c: In function 'pci_versatile_setup_resources':
arch/arm/mach-versatile/pci.c:221: error: 'sys' undeclared (first use in this function)

because the versatile wasn't passing in the full struct pci_sys_data
but only the resource sub-field.  Change it to pass in the full
struct so that sys will be in scope.

Reported-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Olof Johansson <olof@lixom.net>