ARM/serial: at91: switch atmel serial to use gpiolib

This passes the errata fix using a GPIO to control the RTS pin
on one of the AT91 chips to use gpiolib instead of the
AT91-specific interfaces. Also remove the reliance on
compile-time #defines and the cpu_* check and rely on the
platform passing down the proper GPIO pin through platform
data.

This is a prerequisite for getting rid of the local GPIO
implementation in the AT91 platform and move toward
multiplatform.

The patch also adds device tree support for getting the
RTS GPIO pin from the device tree on DT boot paths.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
rtc: at91sam9: include <mach/hardware.h> explicitly

The driver needs the symbol AT91_SLOW_CLOCK which is defined in
arch/arm/mach-at91/include/mach/hardware.h. This file is included
implicitly via linux/module.h -> linux/kmod.h -> linux/gfp.h ->
linux/mmzone.h -> linux/memory_hotplug.h -> linux/notifier.h ->
linux/srcu.h -> linux/workqueue.h -> linux/timer.h -> linux/ktime.h ->
linux/jiffies.h -> linux/timex.h -> mach/timex.h -> mach/hardware.h .

So better include it explicitly not only because the last link will go
away soon.

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
rtc: pxa: drop unused #define TIMER_FREQ

It seems this symbol was unused since the driver was introduced in
commit dc94436 (rtc: driver for pxa27x and pxa3xx SoC) back in 2009.

As a by-product this patch makes the driver stop "using" the symbol
CLOCK_TICK_RATE which is about to be removed very soon (for ARM).

Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Acked-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
clocksource: sirf/marco+prima2: drop usage of CLOCK_TICK_RATE

Since CSR SiRF was converted to multi platform in cf82e0e (ARM: sirf:
enable multiplatform support) the symbol CLOCK_TICK_RATE isn't the
platform specific definition any more, but a global dummy value. There
was no harm introduced in cf82e0e because the global value happens to
match the old platform specific one, still this dummy value isn't
intended to be used and will hopefully disappear soon, so introduce a
local #define and use that instead.

Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
ARM: sa1100: stop using mach/timex.h

mach/timex.h is the last remaining header that is unused for multiarch
builds but necessary for singlearch builds. To allow to get rid of it
for singlearch builds, too, drop its usage in sa1100 arch code by
substituting CLOCK_TICK_RATE and LATCH by a local cpp symbol.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
ARM: netx: stop using mach/timex.h

mach/timex.h is the last remaining header that is unused for multiarch
builds but necessary for singlearch builds. To allow to get rid of it
for singlearch builds, too, drop its usage in netx arch code by
substituting CLOCK_TICK_RATE and LATCH by a local cpp symbol.

Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
ARM: mmp: stop using mach/timex.h

mach/timex.h is the last remaining header that is unused for multiarch
builds but necessary for singlearch builds. To allow to get rid of it
for singlearch builds, too, drop its usage in mmp arch code by
substituting CLOCK_TICK_RATE by a local cpp symbol.

Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
ARM: ep93xx: stop using mach/timex.h

mach/timex.h is the last remaining header that is unused for multiarch
builds but necessary for singlearch builds. To allow to get rid of it
for singlearch builds, too, drop its usage in ep93xx arch code by
substituting CLOCK_TICK_RATE by an already defined local cpp symbol.

Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
ARM: at91: don't use <mach/timex.h>

The platform specific <mach/timex.h> will be removed in a later patch.
So move its only still used symbol to a different header specific for
the only machine still using it. Also add a few explicit includes of
<mach/hardware.h> that are implicitly available through <mach/timex.h>.

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
input: ixp4xx-beeper: don't use symbols from <mach/timex.h>

mach/timex.h is about to be dropped so don't use symbols defined in
there. For ixp4xx there is a suitable substitute for IXP4XX_TIMER_FREQ,
i.e. a global and exported variable that holds the same value.

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
ARM: ixp4xx: stop using <mach/timex.h>

The only user of symbols defined in ixp4xx's <mach/timex.h> is common.c.
Fix that one up by moving the used #define into common.c directly and
add a local substitute for the global define LATCH which uses
CLOCK_TICK_RATE. This makes ixp4xx not to be a bar to dropping support
for <mach/timex.h>.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
ARM: rpc: stop using <mach/timex.h>

The rpc timekeeping code uses the symbol LATCH which depends on
CLOCK_TICK_RATE which is defined in rpc's <mach/timex.h>. As this header
will go away in a later patch introduce a local variable holding the
same value as LATCH and use that instead.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
ARM: drop <mach/timex.h> for !ARCH_MULTIPLATFORM, too

While <mach/timex.h> isn't used for multi-platform builds since long it
still is for "normal" builds. As the previous patches fix all sites to
not make use of this per-platform file, it can go now for good also for
platforms that are not (yet) converted to multi-platform.

While at it there are no users of CLOCK_TICK_RATE any more, so also drop
the dummy #define.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
HID: usbhid: quirk for CY-TM75 75 inch Touch Overlay

There is timeout error during initialization:
kernel: [   11.733104] hid-multitouch 0003:1870:0110.0001: usb_submit_urb(ctrl) failed: -1
kernel: [   11.734093] hid-multitouch 0003:1870:0110.0001: timeout initializing reports

Adding quirk HID_QUIRK_NO_INIT_REPORTS can solve the problem.

Signed-off-by: Yufeng Shen <miletus@chromium.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
HID: microsoft: Add ID's for Surface Type/Touch Cover 2

The Microsoft Surface Type/Touch cover 2 devices have the flag HID_DG_CONTACTID
in their reports.This causes the device to bind to the hid-multitouch driver,
which doesn't handle generic keyboard/mouse input events.  The patch adds
the hardware id's of the device to hid-microsoft and to the HID special
driver array, which makes the device get handled by hid-generic/hid-input
properly.

Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=64811

Singed-off-by: Reyad Attiyat <reyad.attiyat@gmail.com>
Reviewed-by: Benjamin Tissoires<benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
HID: multitouch: add FocalTech FTxxxx support

This is a Win7 device which does not work correctly with the default
settings (not the previous default BT).
However, the quirk ALWAYS_TRUE makes it working like a charm.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
bcache: fix BUG_ON due to integer overflow with GC_SECTORS_USED

The BUG_ON at the end of __bch_btree_mark_key can be triggered due to
an integer overflow error:

BITMASK(GC_SECTORS_USED, struct bucket, gc_mark, 2, 13);
...
SET_GC_SECTORS_USED(g, min_t(unsigned,
	     GC_SECTORS_USED(g) + KEY_SIZE(k),
	     (1 << 14) - 1));
BUG_ON(!GC_SECTORS_USED(g));

In bcache.h, the SECTORS_USED bitfield is defined to be 13 bits wide.
While the SET_ code tries to ensure that the field doesn't overflow by
clamping it to (1<<14)-1 == 16383, this is incorrect because 16383
requires 14 bits.  Therefore, if GC_SECTORS_USED() + KEY_SIZE() =
8192, the SET_ statement tries to store 8192 into a 13-bit field.  In
a 13-bit field, 8192 becomes zero, thus triggering the BUG_ON.

Therefore, create a field width constant and a max value constant, and
use those to create the bitfield and check the inputs to
SET_GC_SECTORS_USED.  Arguably the BITMASK() template ought to have
BUG_ON checks for too-large values, but that's a separate patch.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
bcache: Minor fixes from kbuild robot

Signed-off-by: Kent Overstreet <kmo@daterainc.com>
bcache: bugfix - gc thread now gets woken when cache is full

Signed-off-by: Nicholas Swenson <nks@daterainc.com>
KVM: return an error code in kvm_vm_ioctl_register_coalesced_mmio()

If kvm_io_bus_register_dev() fails then it returns success but it should
return an error code.

I also did a little cleanup like removing an impossible NULL test.

Cc: stable@vger.kernel.org
Fixes: 2b3c246a682c ('KVM: Make coalesced mmio use a device per zone')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>