HID: input: generic hidinput_input_event handler

The hidinput_input_event() callback converts input events written from
userspace into HID reports and sends them to the device. We currently
implement this in every HID transport driver, even though most of them do
the same.

This provides a generic hidinput_input_event() implementation which is
mostly copied from usbhid. It uses a delayed worker to allow multiple LED
events to be collected into a single output event.
We use the custom ->request() transport driver callback to allow drivers
to adjust the outgoing report and handle the request asynchronously. If no
custom ->request() callback is available, we fall back to the generic raw
output report handler (which is synchronous).

Drivers can still provide custom hidinput_input_event() handlers (see
logitech-dj) if the generic implementation doesn't fit their needs.

Conflicts:
	drivers/hid/hid-input.c

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Michael Wright <michaelwr@google.com>
Change-Id: I89ccc3f675b3e8a7bbd812a6ebe12588d737cfd6
crypto: msm: check potential integer overflow

According to the specification of AEAD, AEAD request crypt length is
not a fixed maximum and associated length is also same. This could
lead to potential integer overflow, thus allocating less memory. So
we need to check potential integer overflow on AEAD request length.

CRs-Fixed: 726872
Change-Id: Ie7708000bfd8c57e2fba8e02230a7ce9cdc9634c
Signed-off-by: William Clark <wclark@codeaurora.org>
cpufreq: Avoid using global variable total_cpus

The change is to compile on kernels where cpufreq stats are compiled as
a module (CONFIG_CPU_FREQ_STAT=m), because total_cpus is not exported for
module use.

Reported-By: Emilio López <elopez93@gmail.com>
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
Change-Id: I4f3c74f0fac5e8d9449655b26bf3b407b0fe4290
net: ipv6: Add a sysctl to make optimistic addresses useful candidates

Add a sysctl that causes an interface's optimistic addresses
to be considered equivalent to other non-deprecated addresses
for source address selection purposes.  Preferred addresses
will still take precedence over optimistic addresses, subject
to other ranking in the source address selection algorithm.

This is useful where different interfaces are connected to
different networks from different ISPs (e.g., a cell network
and a home wifi network).

The current behaviour complies with RFC 3484/6724, and it
makes sense if the host has only one interface, or has
multiple interfaces on the same network (same or cooperating
administrative domain(s), but not in the multiple distinct
networks case.

For example, if a mobile device has an IPv6 address on an LTE
network and then connects to IPv6-enabled wifi, while the wifi
IPv6 address is undergoing DAD, IPv6 connections will try use
the wifi default route with the LTE IPv6 address, and will get
stuck until they time out.

Also, because optimistic nodes can receive frames, issue
an RTM_NEWADDR as soon as DAD starts (with the IFA_F_OPTIMSTIC
flag appropriately set).  A second RTM_NEWADDR is sent if DAD
completes (the address flags have changed), otherwise an
RTM_DELADDR is sent.

Also: add an entry in ip-sysctl.txt for optimistic_dad.

[backport of net-next 7fd2561e4ebdd070ebba6d3326c4c5b13942323f]

Signed-off-by: Erik Kline <ek@google.com>
Acked-by: Lorenzo Colitti <lorenzo@google.com>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Bug: 17769720
Change-Id: I440a9b8c788db6767d191bbebfd2dff481aa9e0d
bitops: introduce generic {clear,set}_bit_le()

Needed to replace test_and_set_bit_le() in virt/kvm/kvm_main.c which is
being used for this missing function.

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Avi Kivity <avi@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
net: kernel start time optimization

Disabling specific netfilter functionality through config
parameters to reduce the kernel start time.

Change-Id: I547cb3f45937fcaf9cb4a7500063c8d271d789ab
Signed-off-by: Narendra Babu Atmakuri <natmak@codeaurora.org>
USB: android: kernel start time optimization

USB accessory related functionality is removed, it is saving some time
during module initialization, binding and controlling of the accessory
related functionality.

Change-Id: I21c3f42821e06d28869dc2fd5b4e1047dad931f6
Signed-off-by: Narendra Babu Atmakuri <natmak@codeaurora.org>
libata: fix uninitialized usage of a variable

Fix following warning -

"kernel/drivers/ata/libata-core.c:1394:3: warning: 'native_sectors'
may be used uninitialized in this function [-Wmaybe-uninitialized]
error, forbidden warning: libata-core.c:1394"

Change-Id: Ide8b3c671f81344533f95e73d93c64ecb4578122
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
mmc: msm_sdcc: don't return error if regulator info is not available

On some platforms, few SDCC slots may be powered by always-on regulators
on board and in this case, regulator info for such SDCC slot is not
defined as part of their platform data. So let's not return error from
driver if regulator info is not present for a SDCC slot.

Change-Id: I902a322538d7400b5ce7fc33b1cf90a9cc4d6bfd
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
ata: ahci_platform: Register as hot-pluggable module

Even though AHCI controller is part of SoC in most chipsets
it is not safe to assume that AHCI device is registered before
AHCI module init is called. Register AHCI platform driver as
hot-pluggable module so that the device, driver match
can happen in any order.

Change-Id: Ifcafba0d49f01c7b31853e136e414866eca9ce99
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
ata: ahci_platform: Enable runtime power management

Provide runtime power management callbacks for AHCI device.
The runtime power management will be disabled by default
due to regressions in hot plug functionality, but userspace
can enable it by echo'ing into following sysfs entry:

echo auto > /sys/devices/platform/ahci.X/power/control

Change-Id: I8421fc1369b45eb76dd0773a512984fd4fee99b4
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
msm_fb: display: allow display bootup when splash memory remap fails

Boot to android animation by allowing the failure of remapping the
address of splash content from bootloader. This remapping and copy of
content was intended not to display corrupt splash content, so failure
to do so should not block the system boot up.

Change-Id: Ied510d483a30ce2a21895af852a7efdaf8f534ea
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
input: atmel_mxt_ts: support touch screen on ADP platform

Touchscreen may have new interface to MSM along with regulator
support and reset pin requirement. The delta requires driver
change to enable touch screen.

Change-Id: I5fe13eb05ac5a46e37cbf8b30029e1d394e80d55
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
input: atmel_mxt_ts: Move fpdlink config into kernel

Move fpdlink and IO expander config logic from bootloader
to kernel to optimize bootloader boot time.

Change-Id: Ieda085d721c031d1a212769045121a04f35da9ad
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
msm: mdp: Validate input arguments from user space

Fully verify the input arguments from user client are safe
to use.

Change-Id: Ie14332443b187951009c63ebfb78456dcd9ba60f
Signed-off-by: Raghavendra Ambadas <rambad@codeaurora.org>
ASoC: msm: qdsp6: check proxy port is open when closing

The current logic opens the afe proxy port only if the
proxy instance virtual port is opened. If only
pcm instance virtual port is opened and a close of the
afe proxy port is attempted, this causes the device to
crash due to a wait event timeout as the driver tries
to close an unopened afe port.
The change ensures that only if both the virtual ports
are opened, which in effect starts the proxy port,
the afe close commands for the proxy port is sent to DSP,
else return immediately.

Change-Id: I9450001c608208f3d8da22b2881a88db1c21d950
Signed-off-by: Aravind Kumar <akumark@codeaurora.org>
f2fs: resync with upstream 3.4 branch (forced update)

Change-Id: I1e7f8893f4330e8084827568327ba5e4eafc684c