firefly-linux-kernel-4.4.55.git
8 years agoMerge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android
Alex Shi [Fri, 8 Apr 2016 05:59:31 +0000 (13:59 +0800)]
Merge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android

8 years agoMerge remote-tracking branch 'origin/v4.4/topic/OPPv2' into linux-linaro-lsk-v4.4
Alex Shi [Fri, 8 Apr 2016 05:59:30 +0000 (13:59 +0800)]
Merge remote-tracking branch 'origin/v4.4/topic/OPPv2' into linux-linaro-lsk-v4.4

8 years agocpufreq: dt: No need to allocate resources anymore
Viresh Kumar [Tue, 9 Feb 2016 05:00:48 +0000 (10:30 +0530)]
cpufreq: dt: No need to allocate resources anymore

OPP layer manages it now and cpufreq-dt driver doesn't need it. But, we
still need to check for availability of resources for deferred probing.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit dd02a3d920083b6cb0ee4f0eaf2c599b740bf5fe)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agocpufreq: dt: No need to fetch voltage-tolerance
Viresh Kumar [Tue, 9 Feb 2016 05:00:47 +0000 (10:30 +0530)]
cpufreq: dt: No need to fetch voltage-tolerance

Its already done by core and we don't need to get it anymore.  And so,
we don't need to get of node in cpufreq_init() anymore, move that to
find_supply_name() instead.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit df2c8ec28e73d47392b8cb24828c15c54819da41)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agocpufreq: dt: Use dev_pm_opp_set_rate() to switch frequency
Viresh Kumar [Tue, 9 Feb 2016 05:00:46 +0000 (10:30 +0530)]
cpufreq: dt: Use dev_pm_opp_set_rate() to switch frequency

OPP core supports frequency/voltage changes based on the target
frequency now, use that instead of open coding the same in cpufreq-dt
driver.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 78c3ba5df96c875b1668e1cd3ee0a69e62454f32)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agocpufreq: dt: Reuse dev_pm_opp_get_max_transition_latency()
Viresh Kumar [Tue, 9 Feb 2016 05:00:45 +0000 (10:30 +0530)]
cpufreq: dt: Reuse dev_pm_opp_get_max_transition_latency()

OPP layer has all the information now to calculate transition latency
(clock_latency + voltage_latency). Lets reuse the OPP layer helper
dev_pm_opp_get_max_transition_latency() instead of open coding the same
in cpufreq-dt driver.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 755b888ff098c9f762717a9fbda7e05b16619069)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agocpufreq: dt: Unsupported OPPs are already disabled
Viresh Kumar [Tue, 9 Feb 2016 05:00:44 +0000 (10:30 +0530)]
cpufreq: dt: Unsupported OPPs are already disabled

The core already have a valid regulator set for the device opp and the
unsupported OPPs are already disabled by the core. There is no need to
repeat that in the user drivers, get rid of it.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 6def6ea75e6dea45f01a16ae3cfb5b5ce48dd5e9)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agocpufreq: dt: Pass regulator name to the OPP core
Viresh Kumar [Tue, 9 Feb 2016 05:00:43 +0000 (10:30 +0530)]
cpufreq: dt: Pass regulator name to the OPP core

OPP core can handle the regulators by itself, and but it needs to know
the name of the regulator to fetch. Add support for that.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 050794aaebbb9f2c2c50b340b6998273e7c64189)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agocpufreq: dt: OPP layers handles clock-latency for V1 bindings as well
Viresh Kumar [Tue, 9 Feb 2016 05:00:42 +0000 (10:30 +0530)]
cpufreq: dt: OPP layers handles clock-latency for V1 bindings as well

"clock-latency" is handled by OPP layer for all bindings and so there is
no need to make special calls for V1 bindings. Use
dev_pm_opp_get_max_clock_latency() for both the cases.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 391d9aef8145204e0a5d67be3bd1fc45c5396dae)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agocpufreq: dt: Rename 'need_update' to 'opp_v1'
Viresh Kumar [Tue, 9 Feb 2016 05:00:41 +0000 (10:30 +0530)]
cpufreq: dt: Rename 'need_update' to 'opp_v1'

That's the real purpose of this field, i.e. to take special care of old
OPP V1 bindings. Lets name it accordingly, so that it can be used
elsewhere.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 457e99e60a8f5a40b7da204c0bfc8a86ad2161b9)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agocpufreq: dt: Convert few pr_debug/err() calls to dev_dbg/err()
Viresh Kumar [Tue, 9 Feb 2016 05:00:40 +0000 (10:30 +0530)]
cpufreq: dt: Convert few pr_debug/err() calls to dev_dbg/err()

We have the device structure available now, lets use it for better print
messages.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 896d6a4c0f41a93809b83f9e58aad73874a89d99)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agocpufreq-dt: fix handling regulator_get_voltage() result
Andrzej Hajda [Wed, 30 Dec 2015 11:18:42 +0000 (12:18 +0100)]
cpufreq-dt: fix handling regulator_get_voltage() result

The function can return negative values so it should be assigned
to signed type.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci.

Link: http://permalink.gmane.org/gmane.linux.kernel/2038576
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 929ca89c305a6ed7a4149115be99af6d73c36918)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agocpufreq-dt: Supply power coefficient when registering cooling devices
Punit Agrawal [Tue, 17 Nov 2015 12:06:22 +0000 (12:06 +0000)]
cpufreq-dt: Supply power coefficient when registering cooling devices

Support registering cooling devices with dynamic power coefficient
where provided by the device tree. This allows OF registered cooling
devices driver to be used with the power_allocator thermal governor.

Signed-off-by: Punit Agrawal <punit.agrawal@arm.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Javi Merino <javi.merino@arm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit f8fa8ae06b8c2c25d81c99766f9226adc5c3e073)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agoPM / OPP: Rename structures for clarity
Viresh Kumar [Tue, 16 Feb 2016 08:47:53 +0000 (14:17 +0530)]
PM / OPP: Rename structures for clarity

Stephen pointed out recently, that few structures always confuse him as
they aren't named properly. And this patch tries to address that:

Names are updated as:
- device_opp or dev_opp -> opp_table
- dev_opp_list -> opp_tables
- dev_opp_list_lock -> opp_table_lock
- device_list_opp -> opp_device (it was never a list, but a structure)
- list_dev -> opp_dev
- And similar changes in comments and function names as well.

This also fixes checkpatch warnings that were generated with this patch.

No functional changes.

Suggested-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 2c2709dc6921c5d246b686521f932c73a20f428f)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agoPM / OPP: Fix incorrect comments
Viresh Kumar [Tue, 16 Feb 2016 08:47:52 +0000 (14:17 +0530)]
PM / OPP: Fix incorrect comments

Some comments were just copy/pasted from other sections and don't match
to the routines they were added for. Fix them.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit a5da64477ee79efa748df256928ec8840a2a7986)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agoPM / OPP: Initialize regulator pointer to an error value
Viresh Kumar [Mon, 15 Feb 2016 16:26:42 +0000 (21:56 +0530)]
PM / OPP: Initialize regulator pointer to an error value

We are currently required to do two checks for regulator pointer:
IS_ERR() and IS_NULL().

And multiple instances are reported, about both of these not being used
consistently and so resulting in crashes.

Fix that by initializing regulator pointer with an error value and
checking it only against an error.

This makes code more consistent and more efficient.

Fixes: 7d34d56ef334 (PM / OPP: Disable OPPs that aren't supported by the regulator)
Reported-and-tested-by: Jon Hunter <jonathanh@nvidia.com>
Reported-and-tested-by: Tony Lindgren <tony@atomide.com>
Reported-and-tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
[ rjw: Initialize to -ENXIO ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 0c717d0f9cb46259dce5272705adce64a2d646d9)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agoPM / OPP: Initialize u_volt_min/max to a valid value
Viresh Kumar [Mon, 15 Feb 2016 04:51:53 +0000 (10:21 +0530)]
PM / OPP: Initialize u_volt_min/max to a valid value

We kept u_volt_min/max initialized to 0, when only the target voltage is
present in DT, instead of the target/min/max triplet.

This didn't go well with the regulator framework, as on few calls the
min voltage was set to target and max was set to 0 and so resulted in a
kernel crash like below:

kernel BUG at ../drivers/regulator/core.c:216!

[<c0684af4>] (regulator_check_voltage) from [<c06857ac>] (regulator_set_voltage_unlocked+0x58/0x230)
[<c06857ac>] (regulator_set_voltage_unlocked) from [<c06859ac>] (regulator_set_voltage+0x28/0x54)
[<c06859ac>] (regulator_set_voltage) from [<c0775b28>] (_set_opp_voltage+0x30/0x98)
[<c0775b28>] (_set_opp_voltage) from [<c0776630>] (dev_pm_opp_set_rate+0xf0/0x28c)
[<c0776630>] (dev_pm_opp_set_rate) from [<c096f784>] (__cpufreq_driver_target+0x184/0x2b4)
[<c096f784>] (__cpufreq_driver_target) from [<c0973760>] (dbs_check_cpu+0x1b0/0x1f4)
[<c0973760>] (dbs_check_cpu) from [<c0973f30>] (cpufreq_governor_dbs+0x324/0x5c4)
[<c0973f30>] (cpufreq_governor_dbs) from [<c0970958>] (__cpufreq_governor+0xe4/0x1ec)
[<c0970958>] (__cpufreq_governor) from [<c09711e0>] (cpufreq_init_policy+0x64/0x8c)
[<c09711e0>] (cpufreq_init_policy) from [<c09718cc>] (cpufreq_online+0x2fc/0x708)
[<c09718cc>] (cpufreq_online) from [<c0765ff0>] (subsys_interface_register+0x94/0xd8)
[<c0765ff0>] (subsys_interface_register) from [<c0970530>] (cpufreq_register_driver+0x14c/0x19c)
[<c0970530>] (cpufreq_register_driver) from [<c09746dc>] (dt_cpufreq_probe+0x70/0xec)
[<c09746dc>] (dt_cpufreq_probe) from [<c076907c>] (platform_drv_probe+0x4c/0xb0)
[<c076907c>] (platform_drv_probe) from [<c07678e0>] (driver_probe_device+0x214/0x2c0)
[<c07678e0>] (driver_probe_device) from [<c0767a18>] (__driver_attach+0x8c/0x90)
[<c0767a18>] (__driver_attach) from [<c0765c2c>] (bus_for_each_dev+0x68/0x9c)
[<c0765c2c>] (bus_for_each_dev) from [<c0766d78>] (bus_add_driver+0x1a0/0x218)
[<c0766d78>] (bus_add_driver) from [<c076810c>] (driver_register+0x78/0xf8)
[<c076810c>] (driver_register) from [<c0301d74>] (do_one_initcall+0x90/0x1d8)
[<c0301d74>] (do_one_initcall) from [<c1100e14>] (kernel_init_freeable+0x15c/0x1fc)
[<c1100e14>] (kernel_init_freeable) from [<c0b27a0c>] (kernel_init+0x8/0xf0)
[<c0b27a0c>] (kernel_init) from [<c0307d78>] (ret_from_fork+0x14/0x3c)
Code: e1550004 baffffeb e3a00000 e8bd8070 (e7f001f2)

Fix that by initializing u_volt_min/max to the target voltage in such cases.

Reported-and-tested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Fixes: 274659029c9d (PM / OPP: Add support to parse "operating-points-v2" bindings)
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit c88c395f4a6485f23f81e385c79945d68bcd5c5d)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agoPM / OPP: Fix NULL pointer dereference crash when disabling OPPs
Jon Hunter [Thu, 11 Feb 2016 11:25:59 +0000 (11:25 +0000)]
PM / OPP: Fix NULL pointer dereference crash when disabling OPPs

Commit 7d34d56ef334 (PM / OPP: Disable OPPs that aren't supported by
the regulator) causes a crash to happen on Tegra124 Jetson TK1 when
using the DFLL clock source for the CPU.  The DFLL manages the voltage
itself and so there is no regulator specified for the OPPs and so we
get a crash when we try to dereference the regulator pointer.  Fix
this by checking to see if the regulator IS_ERR_OR_NULL before
dereferencing it.

Fixes: 7d34d56ef334 (PM / OPP: Disable OPPs that aren't supported by the regulator)
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reported-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
[ rjw: Changelog ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 78ecc56247f0ec2bc0cf6f2f2af69e98d99767bc)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agoPM / OPP: Add dev_pm_opp_set_rate()
Viresh Kumar [Tue, 9 Feb 2016 05:00:39 +0000 (10:30 +0530)]
PM / OPP: Add dev_pm_opp_set_rate()

This adds a routine, dev_pm_opp_set_rate(), responsible for configuring
power-supply and clock source for an OPP.

The OPP is found by matching against the target_freq passed to the
routine. This shall replace similar code present in most of the OPP
users and help simplify them a lot.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 6a0712f6f199e737aa5913d28ec4bd3a25de9660)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agoPM / OPP: Manage device clk
Viresh Kumar [Tue, 9 Feb 2016 05:00:38 +0000 (10:30 +0530)]
PM / OPP: Manage device clk

OPP core has got almost everything now to manage device's OPP
transitions, the only thing left is device's clk. Get that as well.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit d54974c2513f487e9e70fbdc79c5da51c53e23da)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agoPM / OPP: Parse clock-latency and voltage-tolerance for v1 bindings
Viresh Kumar [Tue, 9 Feb 2016 05:00:37 +0000 (10:30 +0530)]
PM / OPP: Parse clock-latency and voltage-tolerance for v1 bindings

V2 bindings have better support for clock-latency and voltage-tolerance
and doesn't need special care. To use callbacks, like
dev_pm_opp_get_max_{transition|volt}_latency(), irrespective of the
bindings, the core needs to know clock-latency/voltage-tolerance for the
earlier bindings.

This patch reads clock-latency/voltage-tolerance from the device node,
irrespective of the bindings (to keep it simple) and use them only for
V1 bindings.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 50f8cfbd5897ca182d43f4caf19937153f17a604)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agoPM / OPP: Introduce dev_pm_opp_get_max_transition_latency()
Viresh Kumar [Tue, 9 Feb 2016 05:00:36 +0000 (10:30 +0530)]
PM / OPP: Introduce dev_pm_opp_get_max_transition_latency()

In few use cases (like: cpufreq), it is desired to get the maximum
latency for changing OPPs. Add support for that.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 2174344765f472895c076d703c9cdc58215e1393)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agoPM / OPP: Introduce dev_pm_opp_get_max_volt_latency()
Viresh Kumar [Tue, 9 Feb 2016 05:00:35 +0000 (10:30 +0530)]
PM / OPP: Introduce dev_pm_opp_get_max_volt_latency()

In few use cases (like: cpufreq), it is desired to get the maximum
voltage latency for changing OPPs. Add support for that.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 655c9df961751ce21466f6e97e8033932c27a675)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agoPM / OPP: Disable OPPs that aren't supported by the regulator
Viresh Kumar [Tue, 9 Feb 2016 05:00:34 +0000 (10:30 +0530)]
PM / OPP: Disable OPPs that aren't supported by the regulator

Disable any OPPs where the connected regulator isn't able to provide the
specified voltage.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 7d34d56ef3349cd5f29cf7aab6650f3414fa81b9)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agoPM / OPP: get/put regulators from OPP core
Viresh Kumar [Tue, 9 Feb 2016 05:00:33 +0000 (10:30 +0530)]
PM / OPP: get/put regulators from OPP core

This allows the OPP core to request/free the regulator resource,
attached to a device OPP. The regulator device is fetched using the name
provided by the driver, while calling: dev_pm_opp_set_regulator().

This will work for both OPP-v1 and v2 bindings.

This is a preliminary step for moving the OPP switching logic into the
OPP core.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 9f8ea969d5cfdd4353d2adb004e8e2286b984369)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agocpufreq: cpufreq-dt: avoid uninitialized variable warnings:
Arnd Bergmann [Mon, 25 Jan 2016 15:45:48 +0000 (16:45 +0100)]
cpufreq: cpufreq-dt: avoid uninitialized variable warnings:

gcc warns quite a bit about values returned from allocate_resources()
in cpufreq-dt.c:

cpufreq-dt.c: In function 'cpufreq_init':
cpufreq-dt.c:327:6: error: 'cpu_dev' may be used uninitialized in this function [-Werror=maybe-uninitialized]
cpufreq-dt.c:197:17: note: 'cpu_dev' was declared here
cpufreq-dt.c:376:2: error: 'cpu_clk' may be used uninitialized in this function [-Werror=maybe-uninitialized]
cpufreq-dt.c:199:14: note: 'cpu_clk' was declared here
cpufreq-dt.c: In function 'dt_cpufreq_probe':
cpufreq-dt.c:461:2: error: 'cpu_clk' may be used uninitialized in this function [-Werror=maybe-uninitialized]
cpufreq-dt.c:447:14: note: 'cpu_clk' was declared here

The problem is that it's slightly hard for gcc to follow return
codes across PTR_ERR() calls.

This patch uses explicit assignments to the "ret" variable to make
it easier for gcc to verify that the code is actually correct,
without the need to add a bogus initialization.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit b331bc20d9281213f7fb67912638e0fb5baeb324)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agoPM / OPP: Use snprintf() instead of sprintf()
Viresh Kumar [Tue, 5 Jan 2016 10:45:54 +0000 (16:15 +0530)]
PM / OPP: Use snprintf() instead of sprintf()

sprintf() can access memory outside of the range of the character array,
and is risky in some situations. The driver specified prop_name string
can be longer than NAME_MAX here (only an attacker will do that though)
and so blindly copying it into the character array of size NAME_MAX
isn't safe. Instead we must use snprintf() here.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 5ff24d601092b222340b28466e263b1c4559407e)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agoPM / OPP: Set cpu_dev->id in cpumask first
Pi-Cheng Chen [Mon, 28 Dec 2015 13:06:17 +0000 (21:06 +0800)]
PM / OPP: Set cpu_dev->id in cpumask first

Set cpu_dev->id in cpumask first when setting up cpumask for CPUs that
share the same OPP table. This might be helpful when handling cpumask
without the original CPU bitfield set.

Signed-off-by: Pi-Cheng Chen <pi-cheng.chen@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit d9de19b1cc013433ad293365b5b3902ec73dfd60)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agoPM / OPP: Fix parsing of opp-microvolt and opp-microamp properties
Bartlomiej Zolnierkiewicz [Thu, 17 Dec 2015 18:04:38 +0000 (19:04 +0100)]
PM / OPP: Fix parsing of opp-microvolt and opp-microamp properties

Commit 01fb4d3c39d3 ("PM / OPP: Parse 'opp-<prop>-<name>'
bindings") broke support for parsing standard opp-microvolt and
opp-microamp properties.  Fix it by setting 'name' string to
proper value for !prop cases.

Fixes: 01fb4d3c39d3 ("PM / OPP: Parse 'opp-<prop>-<name> 'bindings")
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit fd8d8e63467c922be9ae4452cca2980d473477d9)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agoPM / OPP: Parse 'opp-<prop>-<name>' bindings
Viresh Kumar [Wed, 9 Dec 2015 02:31:47 +0000 (08:01 +0530)]
PM / OPP: Parse 'opp-<prop>-<name>' bindings

OPP bindings (for few properties) allow a platform to choose a
value/range among a set of available options. The options are present as
opp-<prop>-<name>, where the platform needs to supply the <name> string.

The OPP properties which allow such an option are: opp-microvolt and
opp-microamp.

Add support to the OPP-core to parse these bindings, by introducing
dev_pm_opp_{set|put}_prop_name() APIs.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Tested-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 01fb4d3c39d35b725441e8a9a26b3f3ad67793ed)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agoPM / OPP: Parse 'opp-supported-hw' binding
Viresh Kumar [Wed, 9 Dec 2015 02:31:46 +0000 (08:01 +0530)]
PM / OPP: Parse 'opp-supported-hw' binding

OPP bindings allow a platform to enable OPPs based on the version of the
hardware they are used for.

Add support to the OPP-core to parse these bindings, by introducing
dev_pm_opp_{set|put}_supported_hw() APIs.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Tested-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 7de36b0aa51a5a59e28fb2da768fa3ab07de0674)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agoPM / OPP: Add missing doc comments
Viresh Kumar [Thu, 19 Nov 2015 03:43:56 +0000 (09:13 +0530)]
PM / OPP: Add missing doc comments

Few doc-style comments were missing, add them. Rearrange another one to
match the sequence within the structure.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit dc4e7b1fa20a840d2317fcfdaa1064fc09d2afcb)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agoPM / OPP: Rename OPP nodes as opp@<opp-hz>
Viresh Kumar [Wed, 11 Nov 2015 02:40:57 +0000 (08:10 +0530)]
PM / OPP: Rename OPP nodes as opp@<opp-hz>

It would be better to name OPP nodes as opp@<opp-hz> as that will ensure
that multiple DT nodes don't contain the same frequency. Of course we
expect the writer to name the node with its opp-hz frequency and not any
other frequency.

And that will let the compile error out if multiple nodes are using the
same opp-hz frequency.

Suggested-by: Stephen Boyd <sboyd@codeaurora.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 754dcf35f34698661801ae1d391efa02affe83a7)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agoPM / OPP: Remove 'operating-points-names' binding
Viresh Kumar [Wed, 11 Nov 2015 02:40:56 +0000 (08:10 +0530)]
PM / OPP: Remove 'operating-points-names' binding

These aren't used until now by any DT files and wouldn't be used now as
we have a better scheme in place now, i.e. opp-property-<name>
properties.

Remove the (useless) binding without breaking ABI.

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit af87a39a5f7cf6ef252b1aec3e2e6508a40e51f1)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agoPM / OPP: Add {opp-microvolt|opp-microamp}-<name> binding
Viresh Kumar [Wed, 11 Nov 2015 02:40:55 +0000 (08:10 +0530)]
PM / OPP: Add {opp-microvolt|opp-microamp}-<name> binding

Depending on the version of hardware or its properties, which are only
known at runtime, various properties of the OPP can change. For example,
an OPP with frequency 1.2 GHz, may have different voltage/current
requirements based on the version of the hardware it is running on.

In order to not replicate the same OPP tables for varying values of all
such fields, this commit introduces the concept of opp-property-<name>.
The <name> can be chosen by the platform at runtime, and OPPs will be
initialized depending on that name string. Currently support is extended
for the following properties:
- opp-microvolt-<name>
- opp-microamp-<name>

If the name string isn't provided by the platform, or if it is provided
but doesn't match the properties present in the OPP node, we will fall
back to the original properties without the -<name> string, if they are
available.

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit ffdb8cc7a27c89175e541e68e2a73f1f63ab8c6b)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agoPM / OPP: Add "opp-supported-hw" binding
Viresh Kumar [Wed, 11 Nov 2015 02:40:54 +0000 (08:10 +0530)]
PM / OPP: Add "opp-supported-hw" binding

We may want to enable only a subset of OPPs, from the bigger list of
OPPs, based on what version of the hardware we are running on. This
would enable us to not duplicate OPP tables for every version of the
hardware we support.

To enable that, this patch defines a new property 'opp-supported-hw'. It
can support any number of hierarchy levels of the versions the hardware
follows. And based on the selected hardware versions, we can pick only
the relevant OPPs at runtime.

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 1c4d12de2719dfdf27c6dab31e7a5641ee293c94)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agoPM / OPP: Add debugfs support
Viresh Kumar [Wed, 11 Nov 2015 02:29:01 +0000 (07:59 +0530)]
PM / OPP: Add debugfs support

This patch adds debugfs support to OPP layer to export OPPs and their
properties for all the devices.

This creates a top level directory: /sys/kernel/debug/opp and then
device specific directories (based on device names) inside it. For
example: 'cpu0', 'cpu1', etc..

If multiple devices share the OPP table, then the real directory is
created only for the first device. For all others, links are created to
the real directory.

Inside the device specific directory, a separate directory is created
for each OPP. And within that files per opp property.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit deaa51465105a7eda19a627b10372f4f7c51a4df)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
8 years agoANDROID: mmc: Add CONFIG_MMC_SIMULATE_MAX_SPEED
Mark Salyzyn [Thu, 28 Jan 2016 19:12:25 +0000 (11:12 -0800)]
ANDROID: mmc: Add CONFIG_MMC_SIMULATE_MAX_SPEED

When CONFIG_MMC_SIMULATE_MAX_SPEED is enabled, Expose max_read_speed,
max_write_speed and cache_size default module parameters and sysfs
controls to simulate a slow eMMC device. Default values are 0 (off),
0 (off) and 4 MB respectively.

Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 26976972
Change-Id: I342bfbd8b85f9b790e3f0e1e4e51a900ae07e05d

8 years agoandroid: base-cfg: Add CONFIG_INET_DIAG_DESTROY
Dmitry Shmidt [Thu, 31 Mar 2016 20:21:09 +0000 (13:21 -0700)]
android: base-cfg: Add CONFIG_INET_DIAG_DESTROY

Change-Id: I67430b05eca8fd520d2795d3db60faf2ec0fab9e
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
8 years agocpufreq: interactive: only apply interactive boost when enabled
Daniel Kurtz [Thu, 28 May 2015 04:08:11 +0000 (12:08 +0800)]
cpufreq: interactive: only apply interactive boost when enabled

Only apply the interactive boost when the interactive governor is
enabled.  This seems like the right thing to do.

This was originally reviewed on
https://chromium-review.googlesource.com/273501

Change-Id: I5f4a7320683eada099f9a4253e3d6b0f03057fe8
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Dmitry Torokhov <dtor@google.com>
8 years agocpufreq: interactive: fix policy locking
Dmitry Torokhov [Wed, 4 Feb 2015 21:54:48 +0000 (13:54 -0800)]
cpufreq: interactive: fix policy locking

cpufreq_interactive_speedchange_task() is running as a separate kernel
thread and is calling __cpufreq_driver_target(), which requires callers
to hold policy->rwsem for writing to prevent racing with other parts of
the kernel trying to adjust the frequency, for example kernel thermal
throttling. Let's change the code to take policy->rwsem and while at it
refactor the code a bit.

This was originally 2 changes reviewed at:
https://chromium-review.googlesource.com/246273
https://chromium-review.googlesource.com/256120

Change-Id: Icc2d97c6c1b929acd2ee32e8c81d81fd2af778ab
Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Dmitry Torokhov <dtor@google.com>
8 years agoANDROID: dm verity fec: add sysfs attribute fec/corrected
Sami Tolvanen [Wed, 30 Mar 2016 21:10:13 +0000 (14:10 -0700)]
ANDROID: dm verity fec: add sysfs attribute fec/corrected

Add a sysfs entry that allows user space to determine whether dm-verity
has come across correctable errors on the underlying block device.

Bug: 22655252
Bug: 27928374
Change-Id: I80547a2aa944af2fb9ffde002650482877ade31b
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
(cherry picked from commit 7911fad5f0a2cf5afc2215657219a21e6630e001)

8 years agoANDROID: android: base-cfg: enable CONFIG_DM_VERITY_FEC
Sami Tolvanen [Wed, 16 Dec 2015 16:23:49 +0000 (16:23 +0000)]
ANDROID: android: base-cfg: enable CONFIG_DM_VERITY_FEC

Bug: 21893453
Change-Id: Idd0dfe4e3e527df2eff2f0d734effc40dce294c7
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
(cherry picked from commit 9408350ed80005174918ce5147490035b2cf451b)

8 years agoUPSTREAM: dm verity: add ignore_zero_blocks feature
Sami Tolvanen [Thu, 3 Dec 2015 14:26:31 +0000 (14:26 +0000)]
UPSTREAM: dm verity: add ignore_zero_blocks feature

If ignore_zero_blocks is enabled dm-verity will return zeroes for blocks
matching a zero hash without validating the content.

Change-Id: I728fa4b2586b29f2793ea5cb014289892819d249
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
(cherry picked from commit 0cc37c2df4fa0aa702f9662edce4b7ce12c86b7a)

8 years agoUPSTREAM: dm verity: add support for forward error correction
Sami Tolvanen [Thu, 3 Dec 2015 14:26:30 +0000 (14:26 +0000)]
UPSTREAM: dm verity: add support for forward error correction

Add support for correcting corrupted blocks using Reed-Solomon.

This code uses RS(255, N) interleaved across data and hash
blocks. Each error-correcting block covers N bytes evenly
distributed across the combined total data, so that each byte is a
maximum distance away from the others. This makes it possible to
recover from several consecutive corrupted blocks with relatively
small space overhead.

In addition, using verity hashes to locate erasures nearly doubles
the effectiveness of error correction. Being able to detect
corrupted blocks also improves performance, because only corrupted
blocks need to corrected.

For a 2 GiB partition, RS(255, 253) (two parity bytes for each
253-byte block) can correct up to 16 MiB of consecutive corrupted
blocks if erasures can be located, and 8 MiB if they cannot, with
16 MiB space overhead.

Change-Id: Ife4f8889f7fbf0974bf3ed4be6d3322ae9b4cb0e
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
(cherry picked from commit a739ff3f543afbb4a041c16cd0182c8e8d366e70)

8 years agoUPSTREAM: dm verity: factor out verity_for_bv_block()
Sami Tolvanen [Thu, 3 Dec 2015 21:30:36 +0000 (16:30 -0500)]
UPSTREAM: dm verity: factor out verity_for_bv_block()

verity_for_bv_block() will be re-used by optional dm-verity object.

Change-Id: I80e0f8e7c9f234fce3fbdf21cb05aba3041d7f98
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
(cherry picked from commit bb4d73ac5e4f0a6c4853f35824f6cb2d396a2f9c)

8 years agoUPSTREAM: dm verity: factor out structures and functions useful to separate object
Sami Tolvanen [Thu, 3 Dec 2015 21:01:51 +0000 (16:01 -0500)]
UPSTREAM: dm verity: factor out structures and functions useful to separate object

Prepare for an optional verity object to make use of existing dm-verity
structures and functions.

Change-Id: Ib14c3834bfed222b33e068908fb5f71a53e1187b
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
(cherry picked from commit ffa393807cd69656d5b6bc9d9622e205071cbab8)

8 years agoUPSTREAM: dm verity: move dm-verity.c to dm-verity-target.c
Sami Tolvanen [Thu, 3 Dec 2015 20:36:00 +0000 (15:36 -0500)]
UPSTREAM: dm verity: move dm-verity.c to dm-verity-target.c

Prepare for extending dm-verity with an optional object.  Follows the
naming convention used by other DM targets (e.g. dm-cache and dm-era).

Change-Id: If6d2f27b290adf14fa77f3745fdc13aaa417c8dc
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
(cherry picked from commit 03045cbafa2d663ad8d0a583ac219d202d824344)

8 years agoUPSTREAM: dm verity: separate function for parsing opt args
Sami Tolvanen [Thu, 5 Nov 2015 02:02:32 +0000 (02:02 +0000)]
UPSTREAM: dm verity: separate function for parsing opt args

Move optional argument parsing into a separate function to make it
easier to add more of them without making verity_ctr even longer.

Change-Id: I9cd9df41c3326824f8cca5764075501987e78a52
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
(cherry picked from commit 753c1fd02807cb43a1c5d01d75d454054d46bdad)

8 years agoUPSTREAM: dm verity: clean up duplicate hashing code
Sami Tolvanen [Thu, 5 Nov 2015 02:02:31 +0000 (02:02 +0000)]
UPSTREAM: dm verity: clean up duplicate hashing code

Handle dm-verity salting in one place to simplify the code.

Change-Id: If923a01dc63ae5123af13ba1b0863b73e33ddf46
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
(cherry picked from commit 6dbeda3469ced777bc3138ed5918f7ae79670b7b)

8 years agoUPSTREAM: dm: don't save and restore bi_private
Mikulas Patocka [Wed, 25 Nov 2015 21:03:31 +0000 (16:03 -0500)]
UPSTREAM: dm: don't save and restore bi_private

Device mapper used the field bi_private to point to dm_target_io. However,
since kernel 3.15, the bi_private field is unused, and so the targets do
not need to save and restore this field.

This patch removes code that saves and restores bi_private from dm-cache,
dm-snapshot and dm-verity.

Change-Id: Ic72905ccb6d58ff94eafaa47ba54b2688d92d3d1
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
(cherry picked from commit fe3265b180d6282648f03bc6ac3958c733df01c2)

8 years agomm: Export do_munmap
Guenter Roeck [Thu, 24 Mar 2016 17:39:14 +0000 (10:39 -0700)]
mm: Export do_munmap

The 0-day build bot reports the following build error, seen if SDCARD_FS
is built as module.

ERROR: "do_munmap" undefined!

Fixes: 84a1b7d3d312 ("Included sdcardfs source code for kernel 3.0")
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Guenter Roeck <groeck@chromium.org>
8 years agosdcardfs: remove unneeded __init and __exit
Daniel Rosenberg [Mon, 28 Mar 2016 23:00:34 +0000 (16:00 -0700)]
sdcardfs: remove unneeded __init and __exit

Change-Id: I2a2d45d52f891332174c3000e8681c5167c1564f

8 years agosdcardfs: Remove unused code
Daniel Rosenberg [Mon, 28 Mar 2016 22:00:20 +0000 (15:00 -0700)]
sdcardfs: Remove unused code

Change-Id: Ie97cba27ce44818ac56cfe40954f164ad44eccf6

8 years agofs: Export d_absolute_path
Guenter Roeck [Thu, 24 Mar 2016 17:32:35 +0000 (10:32 -0700)]
fs: Export d_absolute_path

The 0-day build bot reports the following build error, seen if SDCARD_FS
is built as module.

ERROR: "d_absolute_path" undefined!

Fixes: 84a1b7d3d312 ("Included sdcardfs source code for kernel 3.0")
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Guenter Roeck <groeck@chromium.org>
8 years agosdcardfs: remove effectless config option
Daniel Rosenberg [Wed, 23 Mar 2016 23:39:30 +0000 (16:39 -0700)]
sdcardfs: remove effectless config option

CONFIG_SDCARD_FS_CI_SEARCH only guards a define for
LOOKUP_CASE_INSENSITIVE, which is never used in the
kernel. Remove both, along with the option matching
that supports it.

Change-Id: I363a8f31de8ee7a7a934d75300cc9ba8176e2edf
Signed-off-by: Daniel Rosenberg <drosen@google.com>
8 years agoinotify: Fix erroneous update of bit count
Daniel Rosenberg [Wed, 23 Mar 2016 19:09:25 +0000 (12:09 -0700)]
inotify: Fix erroneous update of bit count

Patch "vfs: add d_canonical_path for stacked filesystem support"
erroneously updated the ALL_INOTIFY_BITS count. This changes it back

Change-Id: Idb04edc736da276159d30f04c40cff9d6b1e070f

8 years agofs: sdcardfs: Declare LOOKUP_CASE_INSENSITIVE unconditionally
Guenter Roeck [Wed, 23 Mar 2016 15:32:23 +0000 (08:32 -0700)]
fs: sdcardfs: Declare LOOKUP_CASE_INSENSITIVE unconditionally

Attempts to build sdcardfs as module fail with

fs/sdcardfs/lookup.c: In function '__sdcardfs_lookup':
fs/sdcardfs/lookup.c:243:5: error: 'LOOKUP_CASE_INSENSITIVE' undeclared

This occurs because the define is enclosed with #ifdef
CONFIG_SDCARD_FS_CI_SEARCH. If SDCARD_FS_CI_SEARCH is configured to be
built as module, this does not work. Alternatives would be to use #if
IS_ENABLED(CONFIG_SDCARD_FS_CI_SEARCH), or to declare SDCARD_FS_CI_SEARCH
as bool, but that does not work because the define is used unconditionally
in the source.

Note that LOOKUP_CASE_INSENSITIVE is only set but not evaluated in the
current source code, so setting the flag has no real effect.

Fixes: 84a1b7d3d312 ("Included sdcardfs source code for kernel 3.0")
Cc: Daniel Rosenberg <drosen@google.com>
Signed-off-by: Guenter Roeck <groeck@chromium.org>
8 years agotrace: cpufreq: fix typo in min/max cpufreq
Thierry Strudel [Wed, 23 Mar 2016 17:02:15 +0000 (10:02 -0700)]
trace: cpufreq: fix typo in min/max cpufreq

Change-Id: Ieed402d3a912b7a318826e101efe2c24b07ebfe4
Signed-off-by: Thierry Strudel <tstrudel@google.com>
8 years agosdcardfs: Add support for d_canonical_path
Daniel Rosenberg [Fri, 12 Feb 2016 00:53:36 +0000 (16:53 -0800)]
sdcardfs: Add support for d_canonical_path

Change-Id: I5d6f0e71b8ca99aec4b0894412f1dfd1cfe12add
Signed-off-by: Daniel Rosenberg <drosen@google.com>
8 years agovfs: add d_canonical_path for stacked filesystem support
Daniel Rosenberg [Fri, 12 Feb 2016 00:44:15 +0000 (16:44 -0800)]
vfs: add d_canonical_path for stacked filesystem support

Inotify does not currently know when a filesystem
is acting as a wrapper around another fs. This means
that inotify watchers will miss any modifications to
the base file, as well as any made in a separate
stacked fs that points to the same file.
d_canonical_path solves this problem by allowing the fs
to map a dentry to a path in the lower fs. Inotify
can use it to find the appropriate place to watch to
be informed of all changes to a file.

Change-Id: I09563baffad1711a045e45c1bd0bd8713c2cc0b6
Signed-off-by: Daniel Rosenberg <drosen@google.com>
8 years agosdcardfs: Bring up to date with Android M permissions:
Daniel Rosenberg [Thu, 4 Feb 2016 05:08:21 +0000 (21:08 -0800)]
sdcardfs: Bring up to date with Android M permissions:

In M, the workings of sdcardfs were changed significantly.
This brings sdcardfs into line with the changes.

Change-Id: I10e91a84a884c838feef7aa26c0a2b21f02e052e

8 years agoChanged type-casting in packagelist management
Daniel Campello [Mon, 20 Jul 2015 23:33:46 +0000 (16:33 -0700)]
Changed type-casting in packagelist management

Fixed existing type-casting in packagelist management code. All
warnings at compile time were taken care of.

Change-Id: I1ea97786d1d1325f31b9f09ae966af1f896a2af5
Signed-off-by: Daniel Campello <campello@google.com>
8 years agoPort of sdcardfs to 4.4
Daniel Campello [Mon, 20 Jul 2015 23:27:37 +0000 (16:27 -0700)]
Port of sdcardfs to 4.4

Change-Id: I25b99ecf214e72ebf6a57ec3085972542a8d7951
Signed-off-by: Daniel Rosenberg <drosen@google.com>
8 years agoIncluded sdcardfs source code for kernel 3.0
Daniel Campello [Mon, 20 Jul 2015 23:23:50 +0000 (16:23 -0700)]
Included sdcardfs source code for kernel 3.0

Only included the source code as is for kernel 3.0. Following patches
take care of porting this file system to version 3.10.

Change-Id: I09e76db77cd98a059053ba5b6fd88572a4b75b5b
Signed-off-by: Daniel Campello <campello@google.com>
8 years agoANDROID: usb: gadget: Add support for MTP OS desc
Badhri Jagan Sridharan [Wed, 7 Oct 2015 03:32:01 +0000 (20:32 -0700)]
ANDROID: usb: gadget: Add support for MTP OS desc

Windows requires OS specific descriptors for automatic
install of drivers for MTP devices.

https://msdn.microsoft.com/en-us/library/windows/
hardware/gg463179.aspx

BUG=24583401
BUG=chrome-os-partner:43409

Change-Id: I9397072ca3d183efbc9571c6cde3790f10d8851e
Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
Reviewed-on: https://chromium-review.googlesource.com/304346
Commit-Ready: Andrew Bresticker <abrestic@chromium.org>
Tested-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
8 years agoCHROMIUM: usb: gadget: f_accessory: add .raw_request callback
Mark Kuo [Mon, 11 Jan 2016 11:07:12 +0000 (19:07 +0800)]
CHROMIUM: usb: gadget: f_accessory: add .raw_request callback

After this upstream commit: 3c86726cfe38952f0366f86acfbbb025813ec1c2,
.raw_request is mandatory in hid_ll_driver structure, hence add an empty
raw_request() function.

BUG=chrome-os-partner:49140
TEST=none

Change-Id: Idd0bbe6960aad2c557376e4a24827d7e1df8e023
Signed-off-by: Mark Kuo <mkuo@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/321038
Commit-Ready: Andrew Bresticker <abrestic@chromium.org>
Tested-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
8 years agoCHROMIUM: usb: gadget: audio_source: add .free_func callback
Mark Kuo [Mon, 11 Jan 2016 09:49:16 +0000 (17:49 +0800)]
CHROMIUM: usb: gadget: audio_source: add .free_func callback

When userspace unbinds gadget functions through configfs, the
.free_func() callback is always invoked. (in config_usb_cfg_unlink())
Implement it as a no-op to avoid the following crash:

[ 68.125679] configfs-gadget gadget: unbind function 'accessory'/ffffffc0720bf000
[ 68.133202] configfs-gadget gadget: unbind function 'audio_source'/ffffffc0012ca3c0
[ 68.142668] tegra-xudc 700d0000.usb-device: ep 0 disabled
[ 68.148186] Bad mode in Synchronous Abort handler detected, code 0x86000006
[ 68.155144] CPU: 2 PID: 1 Comm: init Tainted: G    U W 3.18.0-09419-g87296c3-dirty #561
[ 68.163743] Hardware name: Google Tegra210 Smaug Rev 1,3+ (DT)
[ 68.169566] task: ffffffc0bc8d0000 ti: ffffffc0bc8bc000 task.ti: ffffffc0bc8bc000
[ 68.177039] PC is at 0x0
[ 68.179577] LR is at usb_put_function+0x14/0x1c
....

BUG=chrome-os-partner:49140
TEST="setprop sys.usb.config accessory,audio_source" on A44 and then
switch back to default: "setprop sys.usb.config mtp,adb", no crash will
be seen.

Change-Id: I5b6141964aab861e86e3afb139ded02d4d122dab
Signed-off-by: Mark Kuo <mkuo@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/321013
Commit-Ready: Andrew Bresticker <abrestic@chromium.org>
Tested-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
8 years agoCHROMIUM: usb: gadget: f_mtp: fix usb_ss_ep_comp_descriptor
Mark Kuo [Fri, 11 Sep 2015 08:12:59 +0000 (16:12 +0800)]
CHROMIUM: usb: gadget: f_mtp: fix usb_ss_ep_comp_descriptor

wBytesPerInterval in SuperSpeed Endpoint Companion Descriptor needs
to be set large enough to reserve enough bus time for associated
periodic endpoint.

Originally, wBytesPerInterval for mtp's interrupt IN endpoint is set
to 2 and its single interrupt transfer will be split into many 2 bytes
interrupt transfers. So, we change wBytesPerInterval to INTR_BUFFER_SIZE
to ensure interrupt transfer will not be split.

BUG=none
TEST=Smaug works as a MTP device

Change-Id: I49c0df892b2d9e0193a684eef23f73664ced9f91
Signed-off-by: Henry Lin <henryl@nvidia.com>
Signed-off-by: Mark Kuo <mkuo@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/299091
Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
8 years agoCHROMIUM: usb: gadget: f_mtp: Add SuperSpeed support
Mark Kuo [Thu, 20 Aug 2015 05:01:46 +0000 (13:01 +0800)]
CHROMIUM: usb: gadget: f_mtp: Add SuperSpeed support

Add SuperSpeed endpoint and companion descriptors.

BUG=chrome-os-partner:43682
TEST=Smaug enumerates as a SuperSpeed device.

Change-Id: I2bf3125d180fcb07222a5740fa67f3526cf3e95c
Signed-off-by: Hui Fu <hfu@nvidia.com>
Signed-off-by: Henry Lin <henryl@nvidia.com>
Signed-off-by: Mark Kuo <mkuo@nvidia.com>
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/294950

8 years agoFROMLIST: mmc: block: fix ABI regression of mmc_blk_ioctl
Shawn Lin [Wed, 16 Mar 2016 10:15:47 +0000 (18:15 +0800)]
FROMLIST: mmc: block: fix ABI regression of mmc_blk_ioctl

If mmc_blk_ioctl returns -EINVAL, blkdev_ioctl continues to
work without returning err to user-space. But now we check
CAP_SYS_RAWIO firstly, so we return -EPERM to blkdev_ioctl,
which make blkdev_ioctl return -EPERM to user-space directly.
So this will break all the ioctl with BLKROSET. Now we find
Android-adb suffer it for the following log:

remount of /system failed;
couldn't make block device writable: Operation not permitted
openat(AT_FDCWD, "/dev/block/platform/ff420000.dwmmc/by-name/system", O_RDONLY) = 3
ioctl(3, BLKROSET, 0)  = -1 EPERM (Operation not permitted)

Fixes: a5f5774c55a2 ("mmc: block: Add new ioctl to send multi commands")
Change-Id: Ie9ba728e366abf4ab73fd6102d2a2aa0d4ee5c66
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
8 years agoFROMLIST: mm: ASLR: use get_random_long()
dcashman [Wed, 24 Feb 2016 21:31:22 +0000 (13:31 -0800)]
FROMLIST: mm: ASLR: use get_random_long()

(cherry picked from commit https://lkml.org/lkml/2016/2/4/833)

Replace calls to get_random_int() followed by a cast to (unsigned long)
with calls to get_random_long().  Also address shifting bug which, in case
of x86 removed entropy mask for mmap_rnd_bits values > 31 bits.

Bug: 26963541
Signed-off-by: Daniel Cashman <dcashman@android.com>
Signed-off-by: Daniel Cashman <dcashman@google.com>
Change-Id: I36c156c9b8d7d157134895fddd4cd6efddcbee86

8 years agoFROMLIST: drivers: char: random: add get_random_long()
dcashman [Wed, 24 Feb 2016 21:27:06 +0000 (13:27 -0800)]
FROMLIST: drivers: char: random: add get_random_long()

(cherry picked from commit https://lkml.org/lkml/2016/2/4/831)

d07e22597d1d355 ("mm: mmap: add new /proc tunable for mmap_base ASLR")
added the ability to choose from a range of values to use for entropy
count in generating the random offset to the mmap_base address.  The
maximum value on this range was set to 32 bits for 64-bit x86 systems, but
this value could be increased further, requiring more than the 32 bits of
randomness provided by get_random_int(), as is already possible for arm64.
Add a new function: get_random_long() which more naturally fits with the
mmap usage of get_random_int() but operates exactly the same as
get_random_int().

Also, fix the shifting constant in mmap_rnd() to be an unsigned long so
that values greater than 31 bits generate an appropriate mask without
overflow.  This is especially important on x86, as its shift instruction
uses a 5-bit mask for the shift operand, which meant that any value for
mmap_rnd_bits over 31 acts as a no-op and effectively disables mmap_base
randomization.

Finally, replace calls to get_random_int() with get_random_long() where
appropriate.

Bug: 26963541
Signed-off-by: Daniel Cashman <dcashman@android.com>
Signed-off-by: Daniel Cashman <dcashman@google.com>
Change-Id: I5b45621088666d5d1dfbf43952f25ea0798b10ba

8 years agoFROMLIST: pstore-ram: fix NULL reference when used with pdata
Brian Norris [Mon, 14 Mar 2016 20:34:44 +0000 (13:34 -0700)]
FROMLIST: pstore-ram: fix NULL reference when used with pdata

When using platform-data (not DT), we get an OOPS, because drvdata is
only initialized after we try to use it.

This addresses my comments made on the upstream submission here:

https://patchwork.kernel.org/patch/7980651/

Fixes boot on Chrome OS systems, including the Pixel 2.

Change-Id: I97360edf2ce61c83dc543cb6c169f3287e2dae4b
Fixes: b1d1b7187c11 ("FROMLIST: pstore-ram: add Device Tree bindings")
Signed-off-by: Brian Norris <briannorris@google.com>
8 years agousb: u_ether: Add missing rx_work init
Matthew Moeller [Thu, 10 Mar 2016 02:19:25 +0000 (20:19 -0600)]
usb: u_ether: Add missing rx_work init

commit 398a708ed5f3ef771d96dfb9b95b5d5170d17eb7
usb: u_ether: Add workqueue as bottom half handler for rx data path

set up a worker for the rx data path but missed a case where the
work_struct needed to be initialized.

This patch adds the missing 'INIT_WORK'

Change-Id: I2daabd39d35b3e17a3054837282d649d9c78a0aa
Signed-off-by: Matthew Moeller <moeller.matt@gmail.com>
8 years agoANDROID: dm-crypt: run in a WQ_HIGHPRI workqueue
Tim Murray [Wed, 20 Jan 2016 00:33:27 +0000 (16:33 -0800)]
ANDROID: dm-crypt: run in a WQ_HIGHPRI workqueue

(cherry pick from commit ad3ac5180979e5dd1f84e4a807f76fb9fb19f814)

Running dm-crypt in a standard workqueue results in IO competing for CPU
time with standard user apps, which can lead to pipeline bubbles and
seriously degraded performance. Move to a WQ_HIGHPRI workqueue to
protect against that.

Signed-off-by: Tim Murray <timmurray@google.com>
Bug: 25392275
Change-Id: I2828587c754a7c2cafdd78b3323b9896cb8cd4e7

8 years agomisc: uid_stat: Include linux/atomic.h instead of asm/atomic.h
Guenter Roeck [Fri, 4 Mar 2016 20:44:33 +0000 (12:44 -0800)]
misc: uid_stat: Include linux/atomic.h instead of asm/atomic.h

Building the uid_stat driver on sparc32 fails with the following errors.

include/linux/atomic.h: In function 'atomic_add_unless':
include/linux/atomic.h:437:2: error:
implicit declaration of function '__atomic_add_unless'
include/linux/atomic.h: In function 'atomic_andnot':
include/linux/atomic.h:454:2: error:
implicit declaration of function 'atomic_and'
include/linux/atomic.h: In function 'atomic_set_mask':
include/linux/atomic.h:465:2: error:
implicit declaration of function 'atomic_or'
include/linux/atomic.h: In function 'atomic_inc_not_zero_hint':
include/linux/atomic.h:490:3: error:
implicit declaration of function 'atomic_cmpxchg'
include/linux/atomic.h: In function 'atomic_dec_if_positive':
include/linux/atomic.h:537:2: error:
implicit declaration of function 'atomic_read'

Fixes: 6b6d5fbf9ae5 ("misc: uidstat: Adding uid stat driver to collect network statistics.")
Signed-off-by: Guenter Roeck <groeck@chromium.org>
8 years agohid-sensor-hub.c: fix wrong do_div() usage
Nicolas Pitre [Tue, 3 Nov 2015 22:01:46 +0000 (17:01 -0500)]
hid-sensor-hub.c: fix wrong do_div() usage

do_div() must only be used with a u64 dividend.

Signed-off-by: Nicolas Pitre <nico@linaro.org>
(cherry picked from commit 8d43b49e7e0070f96ac46d30659a336c0224fa0b)
Signed-off-by: Guenter Roeck <groeck@chromium.org>
8 years agopower: Provide dummy log_suspend_abort_reason() if SUSPEND is disabled
Guenter Roeck [Fri, 4 Mar 2016 15:22:27 +0000 (07:22 -0800)]
power: Provide dummy log_suspend_abort_reason() if SUSPEND is disabled

The API to log the suspend reason was introduced with commit 57caa2ad5ce3
("power: Adds functionality to log the last suspend abort reason.").
It is called from functions enabled with PM_SLEEP and from functions
enabled with SUSPEND, but only available if SUSPEND is enabled.
This can result in build failures such as the following if PM_SLEEP
is enabled, but SUSPEND is not.

kernel/built-in.o: In function `try_to_freeze_tasks':
process.c:(.text+0x30928): undefined reference to `log_suspend_abort_reason'
drivers/built-in.o: In function `syscore_suspend':
(.text+0x6e250): undefined reference to `log_suspend_abort_reason'
drivers/built-in.o: In function `__device_suspend':
main.c:(.text+0x7a528): undefined reference to `log_suspend_abort_reason'

Fixes: 57caa2ad5ce3 ("power: Adds functionality to log the last suspend abort reason.")
Signed-off-by: Guenter Roeck <groeck@chromium.org>
8 years agoPM / suspend: Add dependency on RTC_LIB
Guenter Roeck [Thu, 3 Mar 2016 18:33:40 +0000 (10:33 -0800)]
PM / suspend: Add dependency on RTC_LIB

Commit 1eff8f99f9f9 ("PM / Suspend: Print wall time at suspend entry and
exit") calls rtc_time_to_tm(), which in turn calls rtc_time64_to_tm().
Since RTC_LIB is not mandatory for all architetures, this can result in
the following build error.

suspend.c:(.text+0x2f36c): undefined reference to `rtc_time64_to_tm'

rtc_time64_to_tm() is implemented in rtc-lib, so SUSPEND now needs to
select RTC_LIB.

Fixes: 1eff8f99f9f9 ("PM / Suspend: Print wall time at suspend entry and exit")
Signed-off-by: Guenter Roeck <groeck@chromium.org>
8 years agodrivers: power: use 'current' instead of 'get_current()'
Guenter Roeck [Thu, 3 Mar 2016 17:44:44 +0000 (09:44 -0800)]
drivers: power: use 'current' instead of 'get_current()'

get_current() to get the current thread pointer is not defined for all
architectures. This results in the following build error for several
architectures (s390, powerpc, and possibly others).

drivers/base/power/main.c: In function '__device_suspend':
drivers/base/power/main.c:1415:2: error:
implicit declaration of function 'get_current'

Use 'current' instead. Also include asm/current.h instead of depending on
an implicit include.

Fixes: ad86cc8ad632 ("drivers: power: Add watchdog timer to catch drivers which lockup during suspend."
Signed-off-by: Guenter Roeck <groeck@chromium.org>
8 years agovideo: adf: Set ADF_MEMBLOCK to boolean
Guenter Roeck [Thu, 3 Mar 2016 17:30:33 +0000 (09:30 -0800)]
video: adf: Set ADF_MEMBLOCK to boolean

Attempts to build with CONFIG_ADF_MEMBLOCK=m result in the following
build error.

ERROR: "memblock_free" [drivers/video/adf/adf_memblock.ko] undefined!

memblock_free() is marked as __init_memblock, so exporting it seems to be
a bad idea. All other callers are only configurable into the kernel,
so do the same with ADF_MEMBLOCK.

Signed-off-by: Guenter Roeck <groeck@chromium.org>
8 years agovideo: adf: Fix modular build
Guenter Roeck [Tue, 1 Mar 2016 17:52:27 +0000 (09:52 -0800)]
video: adf: Fix modular build

Builds with ADF configured as module fail the following errors.

ERROR: "adf_fops" [drivers/video/adf/adf_sysfs.ko] undefined!
ERROR: "adf_obj_sysfs_find" [drivers/video/adf/adf_fops.ko] undefined!
ERROR: "adf_buffer_cleanup" [drivers/video/adf/adf_fops.ko] undefined!
ERROR: "adf_attachment_validate" [drivers/video/adf/adf_client.ko] undefined!
ERROR: "adf_attachment_find" [drivers/video/adf/adf_client.ko] undefined!
ERROR: "adf_buffer_mapping_cleanup" [drivers/video/adf/adf_client.ko] undefined!
ERROR: "adf_attachment_free" [drivers/video/adf/adf_client.ko] undefined!
ERROR: "adf_obj_find_event_refcount" [drivers/video/adf/adf_client.ko] undefined!
ERROR: "adf_file_queue_event" [drivers/video/adf/adf.ko] undefined!
ERROR: "adf_interface_sysfs_init" [drivers/video/adf/adf.ko] undefined!
ERROR: "adf_interface_sysfs_destroy" [drivers/video/adf/adf.ko] undefined!
ERROR: "adf_device_sysfs_init" [drivers/video/adf/adf.ko] undefined!
ERROR: "adf_device_sysfs_destroy" [drivers/video/adf/adf.ko] undefined!
ERROR: "adf_sysfs_destroy" [drivers/video/adf/adf.ko] undefined!
ERROR: "adf_overlay_engine_sysfs_init" [drivers/video/adf/adf.ko] undefined!
ERROR: "adf_overlay_engine_sysfs_destroy" [drivers/video/adf/adf.ko] undefined!
ERROR: "adf_sysfs_init" [drivers/video/adf/adf.ko] undefined!

If ADF is configured as module, each of the object files ends up being
a separate module. Since the functions are used across the various files
but not exported, this results in the observed build errors.
Modify the Makefile to create a single module instead.

Fixes: 066a50cee536 ("video: add atomic display framework")
Signed-off-by: Guenter Roeck <groeck@chromium.org>
8 years agonet: ppp: Fix modular build for PPPOLAC and PPPOPNS
Guenter Roeck [Tue, 1 Mar 2016 17:47:32 +0000 (09:47 -0800)]
net: ppp: Fix modular build for PPPOLAC and PPPOPNS

Unlike other configurations in net/ppp, PPPOLAC and PPPOPNS
are defined as boolean configuration options. In allmodconfig builds
(or, specifically, if PPP and some of the other PPP protocols were
built as modules), this resulted in build errors such as the following,
since pppox was built both as module and into the kernel.

ERROR: "pppox_ioctl" [net/l2tp/l2tp_ppp.ko] undefined!
ERROR: "unregister_pppox_proto" [net/l2tp/l2tp_ppp.ko] undefined!
ERROR: "register_pppox_proto" [net/l2tp/l2tp_ppp.ko] undefined!
ERROR: "pppox_unbind_sock" [net/l2tp/l2tp_ppp.ko] undefined!

Fix the problem by defining PPPOLAC and PPPOPNS tristate.

Signed-off-by: Guenter Roeck <groeck@chromium.org>
8 years agonet: pppolac/pppopns: Replace msg.msg_iov with iov_iter_kvec()
Guenter Roeck [Tue, 1 Mar 2016 17:44:17 +0000 (09:44 -0800)]
net: pppolac/pppopns: Replace msg.msg_iov with iov_iter_kvec()

Commit 1af89c1ef3b6 ("Hack: net: PPPoPNS and PPPoLAC build fixes for 4.1")
fixed the build for PPPoPNS and PPPoLAC by re-introducing a field in
struct msghdr which was removed upstream. Re-introducing the field doesn't
get it used, so it is quite likely that the code never worked. Fix it up for
good.

Fixes: 1af89c1ef3b6 ("Hack: net: PPPoPNS and PPPoLAC build fixes for 4.1")
Signed-off-by: Guenter Roeck <groeck@chromium.org>
8 years agoANDROID: mmc: sdio: Disable retuning in sdio_reset_comm()
Andrew Bresticker [Tue, 10 Nov 2015 22:11:46 +0000 (14:11 -0800)]
ANDROID: mmc: sdio: Disable retuning in sdio_reset_comm()

Since sdio_reset_comm() re-initializes the SDIO card, disable retuning
before idling and shutting down the card.  Tuning will be re-enabled (if
necessary) in mmc_sdio_init_card().

BUG=chrome-os-partner:46444
TEST=With CL:311815, toggle WiFi on/off on Smaug and observe that the
WiFi card comes back up and is able to tune successfully.

Change-Id: Ib4a5cfd4d75fc9e3ed7bb3f1e2ffd30de16c5d28
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/311797
Reviewed-by: Derek Basehore <dbasehore@chromium.org>
[briannorris: brought from Chromium kernel in 3.18 -> 4.4 rebase]

Signed-off-by: Brian Norris <briannorris@google.com>
8 years agoANDROID: mmc: Move tracepoint creation and export symbols
Dylan Reid [Tue, 3 Mar 2015 01:09:07 +0000 (17:09 -0800)]
ANDROID: mmc: Move tracepoint creation and export symbols

Move the tracepoint creation to core from card, as core shouldn't depend
on card.

Also add EXPORT_SYMBOL_GPL calls to enable module build.

Change-Id: Ie39fcdadc0516df99600d0963efe09b6cd7a9bf8
Signed-off-by: Dylan Reid <dgreid@chromium.org>
(cherry picked from commit da5fbd1e7e50fee3a8271f50d25c848d0ede64b3,
from android-3.14)
Signed-off-by: Brian Norris <briannorris@google.com>
8 years agoANDROID: kernel/watchdog: fix unused variable warning
Brian Norris [Tue, 1 Mar 2016 01:42:29 +0000 (17:42 -0800)]
ANDROID: kernel/watchdog: fix unused variable warning

kernel/watchdog.c:122:22: warning: ‘hardlockup_allcpu_dumped’ defined but not used [-Wunused-variable]

Change-Id: I99e97e7cc31b589cd674fd4495832c9ef036d0b9
Signed-off-by: Brian Norris <briannorris@google.com>
8 years agoANDROID: usb: gadget: f_mtp: don't use le16 for u8 field
Brian Norris [Tue, 1 Mar 2016 01:44:51 +0000 (17:44 -0800)]
ANDROID: usb: gadget: f_mtp: don't use le16 for u8 field

The 'bCount' field is u8. Noticed by this warning:

drivers/usb/gadget/function/f_mtp.c:264:3: warning: large integer implicitly truncated to unsigned type [-Woverflow]

Change-Id: Ie82dfd1a8986ecd3acf143e41c46822f0d1aca4f
Signed-off-by: Brian Norris <briannorris@google.com>
8 years agoANDROID: lowmemorykiller: fix declaration order warnings
Brian Norris [Tue, 1 Mar 2016 01:40:05 +0000 (17:40 -0800)]
ANDROID: lowmemorykiller: fix declaration order warnings

drivers/staging/android/lowmemorykiller.c: In function ‘lowmem_scan’:
drivers/staging/android/lowmemorykiller.c:174:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]

Change-Id: I9de6cf2c374bc43131725a7ed666a033a4449ea9
Signed-off-by: Brian Norris <briannorris@google.com>
8 years agoANDROID: net: fix 'const' warnings
Brian Norris [Tue, 1 Mar 2016 01:38:34 +0000 (17:38 -0800)]
ANDROID: net: fix 'const' warnings

See the following build log splats. The sock_i_uid() helper doesn't
quite treat the parameter as 'const' (it acquires a member lock), but
this cast is the same approach taken by other callers in this file, so I
don't feel too bad about the fix.

  CC      net/ipv4/inet_connection_sock.o
  CC      net/ipv6/inet6_connection_sock.o
net/ipv6/inet6_connection_sock.c: In function ‘inet6_csk_route_req’:
net/ipv6/inet6_connection_sock.c:89:2: warning: passing argument 1 of ‘sock_i_uid’ discards ‘const’ qualifier from pointer target type [enabled by default]
In file included from include/linux/tcp.h:22:0,
                 from include/linux/ipv6.h:73,
                 from net/ipv6/inet6_connection_sock.c:18:
include/net/sock.h:1689:8: note: expected ‘struct sock *’ but argument is of type ‘const struct sock *’
net/ipv4/inet_connection_sock.c: In function ‘inet_csk_route_req’:
net/ipv4/inet_connection_sock.c:423:7: warning: passing argument 1 of ‘sock_i_uid’ discards ‘const’ qualifier from pointer target type [enabled by default]
In file included from include/net/inet_sock.h:27:0,
                 from include/net/inet_connection_sock.h:23,
                 from net/ipv4/inet_connection_sock.c:19:
include/net/sock.h:1689:8: note: expected ‘struct sock *’ but argument is of type ‘const struct sock *’
net/ipv4/inet_connection_sock.c: In function ‘inet_csk_route_child_sock’:
net/ipv4/inet_connection_sock.c:460:7: warning: passing argument 1 of ‘sock_i_uid’ discards ‘const’ qualifier from pointer target type [enabled by default]
In file included from include/net/inet_sock.h:27:0,
                 from include/net/inet_connection_sock.h:23,
                 from net/ipv4/inet_connection_sock.c:19:
include/net/sock.h:1689:8: note: expected ‘struct sock *’ but argument is of type ‘const struct sock *’

Change-Id: I5c156fc1a81f90323717bffd93c31d205b85620c
Signed-off-by: Brian Norris <briannorris@google.com>
8 years agonet: diag: support v4mapped sockets in inet_diag_find_one_icsk()
Eric Dumazet [Thu, 21 Jan 2016 00:25:01 +0000 (16:25 -0800)]
net: diag: support v4mapped sockets in inet_diag_find_one_icsk()

Lorenzo reported that we could not properly find v4mapped sockets
in inet_diag_find_one_icsk(). This patch fixes the issue.

[cherry-pick of fc439d9489479411fbf9bbbec2c768df89e85503]

Change-Id: I13515e83fb76d4729f00047f9eb142c929390fb2
Reported-by: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
8 years agonet: tcp: deal with listen sockets properly in tcp_abort.
Lorenzo Colitti [Mon, 21 Dec 2015 15:03:44 +0000 (00:03 +0900)]
net: tcp: deal with listen sockets properly in tcp_abort.

When closing a listen socket, tcp_abort currently calls
tcp_done without clearing the request queue. If the socket has a
child socket that is established but not yet accepted, the child
socket is then left without a parent, causing a leak.

Fix this by setting the socket state to TCP_CLOSE and calling
inet_csk_listen_stop with the socket lock held, like tcp_close
does.

Tested using net_test. With this patch, calling SOCK_DESTROY on a
listen socket that has an established but not yet accepted child
socket results in the parent and the child being closed, such
that they no longer appear in sock_diag dumps.

[cherry-pick of net-next 2010b93e9317cc12acd20c4aed385af7f9d1681e]

Change-Id: I0555a142f11d8b36362ffd7c8ef4a5ecae8987c9
Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agotcp: diag: add support for request sockets to tcp_abort()
Eric Dumazet [Fri, 18 Dec 2015 00:14:11 +0000 (16:14 -0800)]
tcp: diag: add support for request sockets to tcp_abort()

Adding support for SYN_RECV request sockets to tcp_abort()
is quite easy after our tcp listener rewrite.

Note that we also need to better handle listeners, or we might
leak not yet accepted children, because of a missing
inet_csk_listen_stop() call.

[cherry-pick of net-next 07f6f4a31e5a8dee67960fc07bb0b37c5f879d4d]

Change-Id: I8ec6b2e6ec24f330a69595abf1d5469ace79b3fd
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Lorenzo Colitti <lorenzo@google.com>
Tested-by: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: diag: Support destroying TCP sockets.
Lorenzo Colitti [Wed, 16 Dec 2015 03:30:05 +0000 (12:30 +0900)]
net: diag: Support destroying TCP sockets.

This implements SOCK_DESTROY for TCP sockets. It causes all
blocking calls on the socket to fail fast with ECONNABORTED and
causes a protocol close of the socket. It informs the other end
of the connection by sending a RST, i.e., initiating a TCP ABORT
as per RFC 793. ECONNABORTED was chosen for consistency with
FreeBSD.

[cherry-pick of net-next c1e64e298b8cad309091b95d8436a0255c84f54a]

Change-Id: I728a01ef03f2ccfb9016a3f3051ef00975980e49
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: diag: Support SOCK_DESTROY for inet sockets.
Lorenzo Colitti [Wed, 16 Dec 2015 03:30:04 +0000 (12:30 +0900)]
net: diag: Support SOCK_DESTROY for inet sockets.

This passes the SOCK_DESTROY operation to the underlying protocol
diag handler, or returns -EOPNOTSUPP if that handler does not
define a destroy operation.

Most of this patch is just renaming functions. This is not
strictly necessary, but it would be fairly counterintuitive to
have the code to destroy inet sockets be in a function whose name
starts with inet_diag_get.

[backport of net-next 6eb5d2e08f071c05ecbe135369c9ad418826cab2]

Change-Id: Idc13a7def20f492a5323ad2f8de105426293bd37
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: diag: Add the ability to destroy a socket.
Lorenzo Colitti [Wed, 16 Dec 2015 03:30:03 +0000 (12:30 +0900)]
net: diag: Add the ability to destroy a socket.

This patch adds a SOCK_DESTROY operation, a destroy function
pointer to sock_diag_handler, and a diag_destroy function
pointer.  It does not include any implementation code.

[backport of net-next 64be0aed59ad519d6f2160868734f7e278290ac1]

Change-Id: Ic5327ff14b39dd268083ee4c1dc2c934b2820df5
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agonet: diag: split inet_diag_dump_one_icsk into two
Lorenzo Colitti [Wed, 16 Dec 2015 03:30:02 +0000 (12:30 +0900)]
net: diag: split inet_diag_dump_one_icsk into two

Currently, inet_diag_dump_one_icsk finds a socket and then dumps
its information to userspace. Split it into a part that finds the
socket and a part that dumps the information.

[cherry-pick of net-next b613f56ec9baf30edf5d9d607b822532a273dad7]

Change-Id: I144765afb6ff1cd66eb4757c9418112fb0b08a6f
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoRevert "mmc: Extend wakelock if bus is dead"
Dmitry Shmidt [Wed, 24 Feb 2016 20:45:14 +0000 (12:45 -0800)]
Revert "mmc: Extend wakelock if bus is dead"

This reverts commit dde72f9e313fc52d467ef0aad41cecd2c9f9f212.

8 years agoRevert "mmc: core: Hold a wake lock accross delayed work + mmc rescan"
Dmitry Shmidt [Wed, 24 Feb 2016 19:17:02 +0000 (11:17 -0800)]
Revert "mmc: core: Hold a wake lock accross delayed work + mmc rescan"

Patch mmc: core: Signal wakeup event at card insert/removal
provides wake lock for mmc_detect_change()

This reverts commit bec7bcbb707d10b80d450f6f02384efeff294799.