firefly-linux-kernel-4.4.55.git
8 years agoUPSTREAM: usb: dwc3: of-simple: fix build warning on !PM
Felipe Balbi [Wed, 23 Dec 2015 03:56:10 +0000 (21:56 -0600)]
UPSTREAM: usb: dwc3: of-simple: fix build warning on !PM

if we have a !PM kernel build, our runtime
suspend/resume callbacks will be left defined but
unused. Add a ifdef CONFIG_PM guard.

Signed-off-by: Felipe Balbi <balbi@ti.com>
(cherry picked from commit 5072cfc40a80cea3749fd3413b3896630d8c787e)

Change-Id: I6a7ceb1a90162b132afce17423888ab0cbdf897b
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
8 years agoUPSTREAM: usb: dwc3: gadget: don't send extra ZLP
John Youn [Tue, 22 Dec 2015 20:23:20 +0000 (12:23 -0800)]
UPSTREAM: usb: dwc3: gadget: don't send extra ZLP

If the request->length is zero, a ZLP should already be sent due to that
and another ZLP is not needed to terminate the transfer.

Fixes: 04c03d10e507 ("usb: dwc3: gadget: handle request->zero")
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
(cherry picked from commit d9261898a4b2c143c28568dc686a1becfc637a99)

Change-Id: Ib976552f93321f6ea52d3f0151c66fd6f2db8b17
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
8 years agoUPSTREAM: usb: dwc3: gadget: pass a condition to dev_WARN_ONCE()
Felipe Balbi [Thu, 10 Dec 2015 19:08:20 +0000 (13:08 -0600)]
UPSTREAM: usb: dwc3: gadget: pass a condition to dev_WARN_ONCE()

instead of using:

if (condition) {
dev_WARN_ONCE(dev, true, "foo");
return -EINVAL;
}

let's use:

if (dev_WARN_ONCE(dev, condition, "foo"))
return -EINVAL;

Signed-off-by: Felipe Balbi <balbi@ti.com>
(cherry picked from commit 95ca961c758cd9ce789247098b09c39017637e58)

Change-Id: I8a7ee1e00ddf619d23ab974663c11fe795e9a478
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
8 years agoUPSTREAM: usb: dwc3: trace: show request flags
Felipe Balbi [Thu, 3 Dec 2015 21:27:32 +0000 (15:27 -0600)]
UPSTREAM: usb: dwc3: trace: show request flags

struct usb_request have 3 flags which might be
important to know about during debug. This patch
shows each of the 3 flags as a single letter:

z -> for zero
s -> short not okay
i -> interrupt

A capital letter means the feature is enabled
while a lower case letter means it is disabled;

Thus 'zsI' indicates that a ZLP is not needed,
that we can accept a short packet and interrupt
for this request should be enabled.

Signed-off-by: Felipe Balbi <balbi@ti.com>
(cherry picked from commit 46a01427e969e53d993b988ebbdb8c7c3562b66f)

Change-Id: I5d60411c51eff9f5a5f1233680bca6369f6fc6b8
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
8 years agoUPSTREAM: usb: dwc3: gadget: handle request->zero
Felipe Balbi [Wed, 2 Dec 2015 16:06:45 +0000 (10:06 -0600)]
UPSTREAM: usb: dwc3: gadget: handle request->zero

So far, dwc3 has always missed request->zero
handling for every endpoint. Let's implement
that so we can handle cases where transfer must
be finished with a ZLP.

Note that dwc3 is a little special. Even though
we're dealing with a ZLP, we still need a buffer
of wMaxPacketSize bytes; to hide that detail from
every gadget driver, we have a preallocated buffer
of 1024 bytes (biggest bulk size) to use (and
share) among all endpoints.

Reported-by: Ravi B <ravibabu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
(cherry picked from commit 04c03d10e507052cfce6910ddf34091196e79e1c)

Change-Id: I4dce506b683a9381e73733d09dd03e12364bef1f
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
8 years agoUPSTREAM: usb: dwc3: remove dwc3-qcom in favor of dwc3-of-simple
Felipe Balbi [Thu, 19 Nov 2015 18:15:43 +0000 (12:15 -0600)]
UPSTREAM: usb: dwc3: remove dwc3-qcom in favor of dwc3-of-simple

Now that we have a generic dwc3-of-simple.c, we can
use that instead of maintaining dwc3-qcom.c which is
extremely similar.

Cc: Ivan T. Ivanov <iivanov@mm-sol.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
(cherry picked from commit b084662776be8b07ab9114ff1a16a4e9bf907d35)

Change-Id: I4ae3b2649b5b970ef2974d5fa41ac8ff2affb6e0
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
8 years agoUPSTREAM: usb: dwc3: add generic OF glue layer
Felipe Balbi [Wed, 18 Nov 2015 19:15:20 +0000 (13:15 -0600)]
UPSTREAM: usb: dwc3: add generic OF glue layer

For simple platforms which merely enable some clocks
and populate its children, we can use this generic
glue layer to avoid boilerplate code duplication.

For now this supports Qcom and Xilinx, but if we
find a way to add generic handling of regulators and
optional PHYs, we can absorb exynos as well.

Tested-by: Subbaraya Sundeep Bhatta <subbaraya.sundeep.bhatta@xilinx.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
(cherry picked from commit 16adc674d0d68a50dfc725574738d7ae11cf5d7e)

Change-Id: Ia397ebcc522d0cd33c8dd3ee286dc2e0a5383a58
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
8 years agoUPSTREAM: usb: dwc3: ep0: fix setup_packet_pending initialization
Felipe Balbi [Mon, 16 Nov 2015 22:20:34 +0000 (16:20 -0600)]
UPSTREAM: usb: dwc3: ep0: fix setup_packet_pending initialization

It just ocurred to me that dwc3 already gives a
really hint of when a setup packet is pending and
that's the SETUP_PENDING TRB Status for EP0 IRQs.

Fix setup_packet_pending initialization based on
that. While at that, also make sure the comment in
gadget.c matches what code is doing.

Signed-off-by: Felipe Balbi <balbi@ti.com>
(cherry picked from commit b5d335e5ea6a60f5254c1f3d5fddd47f4531bccf)

Change-Id: I9e197bee86b681e3d0da8692df8fac861eb00844
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
8 years agoUPSTREAM: usb: dwc3: gadget: simplify next_request() return check
Felipe Balbi [Mon, 16 Nov 2015 22:13:57 +0000 (16:13 -0600)]
UPSTREAM: usb: dwc3: gadget: simplify next_request() return check

In dwc3_cleanup_done_reqs() we expect that all
iterations of our while (1) loop will find a valid
struct dwc3_request *. In case we don't, we're
dumping a WARN_ON_ONCE() splat so that people report
the failure.

This patch is a simple cleanup converting:

if (!req) {
WARN_ON_ONCE(1);
return 1;
}

to:

if (WARN_ON_ONCE(!req))
return 1;

which is a little easier to read.

Signed-off-by: Felipe Balbi <balbi@ti.com>
(cherry picked from commit ac7bdcc1b3ad042d21bc65e57503d7b41fc69f05)

Change-Id: I1bfea94c01ee9df01930fd743301a7d04ce9b442
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
8 years agoUPSTREAM: usb: dwc3: ep0: purge dev_dbg() calls
Felipe Balbi [Mon, 16 Nov 2015 22:08:09 +0000 (16:08 -0600)]
UPSTREAM: usb: dwc3: ep0: purge dev_dbg() calls

The last few dev_dbg() messages are converted to
tracepoints and we can finally ignore dev_dbg()
messages during debug sessions.

Signed-off-by: Felipe Balbi <balbi@ti.com>
(cherry picked from commit acc38c4970caac17cd81dc941226ed17fe505d73)

Change-Id: I9046eeff627c97360cc9903e78fdd8715f95ce28
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
8 years agoUPSTREAM: usb: dwc3: core: purge dev_dbg() calls
Felipe Balbi [Mon, 16 Nov 2015 22:06:37 +0000 (16:06 -0600)]
UPSTREAM: usb: dwc3: core: purge dev_dbg() calls

The last few dev_dbg() messages are converted to
tracepoints and we can finally ignore dev_dbg()
messages during debug sessions.

Signed-off-by: Felipe Balbi <balbi@ti.com>
(cherry picked from commit 1407bf13e3bf5f1168484c3e68b6ef9d8cf2bc72)

Change-Id: I7a39582e1b5bd29b5d377da4bfbf95f0598776d4
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
8 years agoUPSTREAM: usb: dwc3: gadget: purge dev_dbg() calls
Felipe Balbi [Mon, 16 Nov 2015 22:04:13 +0000 (16:04 -0600)]
UPSTREAM: usb: dwc3: gadget: purge dev_dbg() calls

The last few dev_dbg() messages are converted to
tracepoints and we can finally ignore dev_dbg()
messages during debug sessions.

Signed-off-by: Felipe Balbi <balbi@ti.com>
(cherry picked from commit ec5e795cdefb74b55c9fce918aa8a9226a8eec41)

Change-Id: Ia6d016de13b5944ff8add9f2bab3686a1651ed2f
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
8 years agoUPSTREAM: usb: dwc3: gadget: simplify dwc3_gadget_ep_queue()
Felipe Balbi [Mon, 16 Nov 2015 21:31:21 +0000 (15:31 -0600)]
UPSTREAM: usb: dwc3: gadget: simplify dwc3_gadget_ep_queue()

By moving our sanity checks our internal function
__dwc3_gadget_ep_queue() we can simplify the
externally visible API while also making sure that
callers of __dwc3_gadget_ep_queue() also make use of
the same checks.

Signed-off-by: Felipe Balbi <balbi@ti.com>
(cherry picked from commit bb423984c28e9f94a8f466b791baa762cef0543d)

Change-Id: I6fc7b972e288b4d3ffcb629daed784c87d243e32
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
8 years agoARM64: dts: rk3366: add DT nodes for usb2.0 ehci and ohci
Frank Wang [Fri, 4 Mar 2016 10:15:03 +0000 (18:15 +0800)]
ARM64: dts: rk3366: add DT nodes for usb2.0 ehci and ohci

Change-Id: I4ade5961f0192d7ceff7c61557ddee6aba98224c
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
8 years agoARM64: dts: rk3366-tb: add spdif sound
Sugar Zhang [Fri, 4 Mar 2016 09:44:34 +0000 (17:44 +0800)]
ARM64: dts: rk3366-tb: add spdif sound

Change-Id: I21e2879b94844b48282ff9aaa41c3f9d1ef89982
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
8 years agoARM64: dts: rk3366: add spdif
Sugar Zhang [Fri, 4 Mar 2016 09:31:27 +0000 (17:31 +0800)]
ARM64: dts: rk3366: add spdif

Change-Id: I3d0f86e54e537524b1542d2d94fd0a56fc9c7cf2
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
8 years agoARM64: configs: rockchip_defconfig: enable spdif
Sugar Zhang [Fri, 4 Mar 2016 09:24:44 +0000 (17:24 +0800)]
ARM64: configs: rockchip_defconfig: enable spdif

Change-Id: Ie021387c717eec5b0f583e9ff5e41f1818383b8f
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
8 years agoASoC: rockchip: add bindings for spdif controller
Sugar Zhang [Fri, 4 Mar 2016 09:18:23 +0000 (17:18 +0800)]
ASoC: rockchip: add bindings for spdif controller

this patch add compatible for rk3366/rk3368/rk3399 spdif,
these three spdifs share the same type.

Change-Id: Iac533f3481962556e3ca2b0c4b685b64aec6786a
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
8 years agommc: block: ioctl return EINVAL if cmd unknown
Huang, Tao [Fri, 4 Mar 2016 09:06:12 +0000 (17:06 +0800)]
mmc: block: ioctl return EINVAL if cmd unknown

We should return -EINVAL if cmd is not MMC_IOC_CMD or MMC_IOC_MULTI_CMD,
otherwise blkdev_roset will return -EPERM.

Android adb, make_block_device_writable ioctl BLKROSET will return error,
make adb remount with error:
remount of /system failed;
couldn't make block device writable: Operation not permitted

Change-Id: I7d0a5727110c0fd9ad301a377e5002eae23f8aed
Fixes: a5f5774c55a2 ("mmc: block: Add new ioctl to send multi commands")
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
8 years agoARM64: dts: rk3366-tb: correct reset pin for Ethernet PHY
Roger Chen [Fri, 4 Mar 2016 06:19:03 +0000 (14:19 +0800)]
ARM64: dts: rk3366-tb: correct reset pin for Ethernet PHY

Change-Id: I94c1f22880965ab69865eeb81c0a33fa4f4201b4
Signed-off-by: Roger Chen <roger.chen@rock-chips.com>
8 years agoARM64: dts: rk3366: fix SCLK_MAC_TX && drive strength for RGMII TX pins
Roger Chen [Fri, 4 Mar 2016 06:17:23 +0000 (14:17 +0800)]
ARM64: dts: rk3366: fix SCLK_MAC_TX && drive strength for RGMII TX pins

Change-Id: I0fe3d33c99d1fb0fb5451ee6123d44e3399b84da
Signed-off-by: Roger Chen <roger.chen@rock-chips.com>
8 years agoARM64: configs: enable CONFIG_STMMAC_ETH for Rockchip GMAC
Roger Chen [Fri, 4 Mar 2016 06:10:42 +0000 (14:10 +0800)]
ARM64: configs: enable CONFIG_STMMAC_ETH for Rockchip GMAC

Change-Id: I469a1b97980316bb08810515efab926e59d2432c
Signed-off-by: Roger Chen <roger.chen@rock-chips.com>
8 years agoRevert "arm64: rockchip: rockchip_defconfig enable ARM_CPUIDLE and CPU_FREQ_DEFAULT_G...
Huang, Tao [Fri, 4 Mar 2016 10:01:26 +0000 (18:01 +0800)]
Revert "arm64: rockchip: rockchip_defconfig enable ARM_CPUIDLE and CPU_FREQ_DEFAULT_GOV_INTERACTIVE"

This reverts commit 754010a8f89cb3a5b04d3e749c2ef8396fac776b.

interactive driver will tirgger warning:
sysfs: cannot create duplicate filename '/devices/system/cpu/cpufreq'

Change-Id: I8074820953f2f76093df038f437890d65d054a28

8 years agoARM64: dts: rockchip: rk3366: add cpu dvfs support for tb
Feng Xiao [Thu, 3 Mar 2016 12:18:27 +0000 (20:18 +0800)]
ARM64: dts: rockchip: rk3366: add cpu dvfs support for tb

Change-Id: Ibcefd6e6c0b351310c3768b9b0c1494a2664ff90
Signed-off-by: Feng Xiao <xf@rock-chips.com>
8 years agoclk: rockchip: rk3366: modify hdmi clk according to the latest cru document
Feng Xiao [Thu, 3 Mar 2016 06:35:03 +0000 (14:35 +0800)]
clk: rockchip: rk3366: modify hdmi clk according to the latest cru document

Change-Id: I815406cd8dfd94e8526b96a827df487fe5381620
Signed-off-by: Feng Xiao <xf@rock-chips.com>
8 years agoarm64: rockchip: rockchip_defconfig enable ARM_CPUIDLE and CPU_FREQ_DEFAULT_GOV_INTER...
Huang, Tao [Fri, 4 Mar 2016 07:16:36 +0000 (15:16 +0800)]
arm64: rockchip: rockchip_defconfig enable ARM_CPUIDLE and CPU_FREQ_DEFAULT_GOV_INTERACTIVE

Change-Id: I786be6ce3a5f647df65a4e7b51cbb28152f39a7d
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
8 years agoarm64: rockchip: rockchip_defconfig enable SYSCON_REBOOT_MODE
Huang, Tao [Fri, 4 Mar 2016 07:00:14 +0000 (15:00 +0800)]
arm64: rockchip: rockchip_defconfig enable SYSCON_REBOOT_MODE

Change-Id: I638e0a2a8acf0843dca07c2a3355a3d06a18daf7
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
8 years agoarm64: dts: rockchip: rk3366: add syscon-reboot-mode node
Huang, Tao [Fri, 4 Mar 2016 06:52:07 +0000 (14:52 +0800)]
arm64: dts: rockchip: rk3366: add syscon-reboot-mode node

use PMU_GRF_OS_REG0 to communicate with loader.

Change-Id: I8c007192d77c5634f9cf899899683c6c8f44f8b8
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
8 years agoarm64: dts: rockchip: rk3366: remove clock-frequency from timer node
Huang, Tao [Fri, 4 Mar 2016 06:34:34 +0000 (14:34 +0800)]
arm64: dts: rockchip: rk3366: remove clock-frequency from timer node

Change-Id: I3ab1697f591ebf53b0e0ca90203ccb883c78dacc
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
8 years agommc: sdhci-of-arasan: add phy support for sdhci-of-arasan
Shawn Lin [Tue, 23 Feb 2016 01:13:31 +0000 (09:13 +0800)]
mmc: sdhci-of-arasan: add phy support for sdhci-of-arasan

This patch adds Generic PHY access for sdhci-of-arasan. Driver
can get PHY handler from dt-binding, and power-on/init the PHY.
Currently, it's just mandatory for arasan,sdhci-5.1.

Change-Id: If61621796380c4a12e50fd3140e58342fd5e68b0
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agoFROMLIST: dt-bindings: soc: add rockchip reboot mode head file
Andy Yan [Thu, 3 Mar 2016 12:16:14 +0000 (20:16 +0800)]
FROMLIST: dt-bindings: soc: add rockchip reboot mode head file

add macro #define for rockchip reboot mode

Change-Id: I84036d43864f80623519d0df959e1de7e1a540db
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
8 years agoFROMLIST: power: reset: add reboot mode driver
Andy Yan [Tue, 1 Mar 2016 12:12:18 +0000 (20:12 +0800)]
FROMLIST: power: reset: add reboot mode driver

This driver parse the reboot commands like "reboot loader"
and "reboot recovery" to get a boot mode described in the
device tree , then call the write interfae to store the boot
mode in some place like special register or sram , which can
be read by the bootloader after system reboot, then the bootloader
can take different action according to the mode stored.

This is commonly used on Android based devices, in order to
reboot the device into fastboot or recovery mode.

Change-Id: Ifce5a22493a52f3e15332bbf3c94ce7217d7d17c
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Reviewed-by: Moritz Fischer <moritz.fischer@ettus.com>
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Tested-by: John Stultz <john.stultz@linaro.org>
Acked-by: John Stultz <john.stultz@linaro.org>
8 years agoFROMLIST: dt-bindings: power: reset: add document for reboot-mode driver
Andy Yan [Tue, 1 Mar 2016 12:11:22 +0000 (20:11 +0800)]
FROMLIST: dt-bindings: power: reset: add document for reboot-mode driver

add device tree bindings document for reboot-mode driver

Change-Id: I280e24e8c09e688e4f6dc51b7a1a658347f05db5
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
8 years agoDocumentation: add description of phy for sdhci-of-arasan
Shawn Lin [Tue, 23 Feb 2016 01:11:36 +0000 (09:11 +0800)]
Documentation: add description of phy for sdhci-of-arasan

This patch adds phys and phy-names for sdhci-of-arasan as required
properties for arasan,sdhci-5.1, and details the example as well.

Change-Id: Ia3fc9c6284fc6f557b90fa880c9f2e8d01a4d3c2
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agoDocumentation: rockchip-dw-mshc: add description for rk3399
Shawn Lin [Mon, 22 Feb 2016 02:56:09 +0000 (10:56 +0800)]
Documentation: rockchip-dw-mshc: add description for rk3399

Add "rockchip,rk3399-dw-mshc", "rockchip,rk3288-dw-mshc" for
dwmmc on rk3399 platform.

Change-Id: Ieefafab5f0e9650271e823659e2bec1556c4a9bc
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
8 years agoARM64: dts: rockchip: add emmc, sdio and sdmmc node for rk3399
Shawn Lin [Tue, 1 Mar 2016 03:26:59 +0000 (11:26 +0800)]
ARM64: dts: rockchip: add emmc, sdio and sdmmc node for rk3399

This patch add emmc, sdio and sdmmc node to support
mmc stuff on rk3399 platform.

Change-Id: Ic15dfb48f8e1340aff9031a7dd75e98108772fe1
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
8 years agoUPSTREAM: mmc: core: Enable tuning according to the actual timing
Carlo Caione [Wed, 13 Jan 2016 08:36:55 +0000 (09:36 +0100)]
UPSTREAM: mmc: core: Enable tuning according to the actual timing

While in sdhci_execute_tuning() the choice whether or not to enable the
tuning is done on the actual timing, in the mmc_sdio_init_uhs_card() the
check is done on the capability of the card.

This difference is causing some issues with some SDIO cards in DDR50
mode where the CDM19 is wrongly issued.

With this patch we modify the check in both
mmc_(sd|sdio)_init_uhs_card() functions to take the proper decision
only according to the actual timing specification.

Cc: stable@vger.kernel.org
Signed-off-by: Carlo Caione <carlo@endlessm.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
(cherry picked from commit e10c321977091f163eceedec0650e0ef4b3cf4bb)

Change-Id: I5b72e0032bb55bc17bfae2ea81ee40801da7772b

8 years agoUPSTREAM: mmc: core: Optimize boot time by detecting cards simultaneously
Ulf Hansson [Tue, 1 Dec 2015 09:35:29 +0000 (10:35 +0100)]
UPSTREAM: mmc: core: Optimize boot time by detecting cards simultaneously

The mmc workqueue is an ordered workqueue, allowing only one work to
execute per given time. As this workqueue is used for card detection, the
conseqeunce is that cards will be detected one by one waiting for each
other.

Moreover, most of the time spent during card initialization is waiting for
the card's internal firmware to be ready. From a CPU perspective this
typically means waiting for a completion variable to be kicked via an
IRQ-handler or waiting for a sleep timer to finish.

This behaviour of detecting/initializing cards is sub-optimal, especially
for SOCs having several controllers/cards.

Let's convert to use the system_freezable_wq for the mmc detect works.
This enables several works to be executed simultaneously and thus also
cards to be detected like so.

Tests on UX500, which holds two eMMC cards and an SD-card (actually also
an SDIO card, currently not detected), shows a significant improved
behaviour due to this change.

Before this change, both the eMMC cards waited for the SD card to be
initialized as its detect work entered the workqueue first. In some cases,
depending on the characteristic of the SD-card, they got delayed 1-1.5 s.

Additionally for the second eMMC, it needed to wait for the first eMMC to
be initialized which added another 120-190 ms.

Converting to the system_freezable_wq, removed these delays and made both
the eMMC cards available far earlier in the boot sequence.

Selecting the system_freezable_wq, in favour of for example the system_wq,
is because we need card detection mechanism to be disabled once userspace
are frozen during system PM. Currently the mmc core deal with this via PM
notifiers, but following patches may utilize the behaviour of the
system_freezable_wq, to simplify the use of the PM notifiers.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Alan Cooper <alcooperx@gmail.com>
Tested-by: Shawn Lin <shawn.lin@rock-chips.com>
(cherry picked from commit 520bd7a8b4152aacfbd34eb7f7a447354b631039)

Change-Id: I52bc65649b285e825e931a370a9754d1475494dc

8 years agoMerge tag 'v4.4.3'
Huang, Tao [Thu, 3 Mar 2016 11:46:53 +0000 (19:46 +0800)]
Merge tag 'v4.4.3'

This is the 4.4.3 stable release

8 years agoMerge branch 'android-4.4' of https://android.googlesource.com/kernel/common
Huang, Tao [Thu, 3 Mar 2016 11:42:14 +0000 (19:42 +0800)]
Merge branch 'android-4.4' of https://android.googlesource.com/kernel/common

* android-4.4:
  video: adf: Fix modular build
  net: ppp: Fix modular build for PPPOLAC and PPPOPNS
  net: pppolac/pppopns: Replace msg.msg_iov with iov_iter_kvec()
  ANDROID: mmc: sdio: Disable retuning in sdio_reset_comm()
  ANDROID: mmc: Move tracepoint creation and export symbols
  ANDROID: kernel/watchdog: fix unused variable warning
  ANDROID: usb: gadget: f_mtp: don't use le16 for u8 field
  ANDROID: lowmemorykiller: fix declaration order warnings
  ANDROID: net: fix 'const' warnings
  net: diag: support v4mapped sockets in inet_diag_find_one_icsk()
  net: tcp: deal with listen sockets properly in tcp_abort.
  tcp: diag: add support for request sockets to tcp_abort()
  net: diag: Support destroying TCP sockets.
  net: diag: Support SOCK_DESTROY for inet sockets.
  net: diag: Add the ability to destroy a socket.
  net: diag: split inet_diag_dump_one_icsk into two
  Revert "mmc: Extend wakelock if bus is dead"
  Revert "mmc: core: Hold a wake lock accross delayed work + mmc rescan"
  ANDROID: mmc: move to a SCHED_FIFO thread

8 years agovideo: rockchip: tve: code sync from kernel-3.10
Shen Zhenyi [Thu, 3 Mar 2016 07:43:47 +0000 (15:43 +0800)]
video: rockchip: tve: code sync from kernel-3.10

Change-Id: I677105f02c1be03a062cbe80b3883000b107ca91
Signed-off-by: Shen Zhenyi <szy@rock-chips.com>
8 years agoARM: dtsi: rk3036: tve add node to set value by user
Shen Zhenyi [Wed, 3 Feb 2016 06:44:33 +0000 (14:44 +0800)]
ARM: dtsi: rk3036: tve add node to set value by user

Change-Id: If1e1043408f7489e00b94d0f8fa2564dbdc3159f
Signed-off-by: Shen Zhenyi <szy@rock-chips.com>
8 years agoARM: dtsi: rk312x: tve add node to set value by user
Shen Zhenyi [Wed, 3 Feb 2016 06:37:31 +0000 (14:37 +0800)]
ARM: dtsi: rk312x: tve add node to set value by user

Change-Id: I57a8a295718fc8cc73644d4717183b4788f223b4
Signed-off-by: Shen Zhenyi <szy@rock-chips.com>
8 years agoUPSTREAM: clk: skip unnecessary set_phase if nothing to do
Shawn Lin [Fri, 26 Feb 2016 01:25:52 +0000 (09:25 +0800)]
UPSTREAM: clk: skip unnecessary set_phase if nothing to do

Let's compare the degrees from clk_set_rate with
clk->core->phase. If the requested degrees is already
there, skip the following steps.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
[sboyd@codeaurora.org: s/drgrees/degrees/ in commit text]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
(cherry picked from git.kernel.org clk/linux.git clk-next
 commit 023bd7166be0595d18220dfd5c9765b3970f6ef3)

Change-Id: Icc3be314e8f696a18bf0cd92867cd5f956817bbc

8 years agoARM64: dts: rk3368-tb-sheep: add grf offset property for dwc-control-usb
Frank Wang [Thu, 3 Mar 2016 04:46:03 +0000 (12:46 +0800)]
ARM64: dts: rk3368-tb-sheep: add grf offset property for dwc-control-usb

Change-Id: Ia706543dd3be235d74423376916b5d4864d44c06
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
8 years agoARM64: dts: rockchip: add usb otg node for rk3366
Frank Wang [Tue, 1 Mar 2016 07:53:31 +0000 (15:53 +0800)]
ARM64: dts: rockchip: add usb otg node for rk3366

Change-Id: I1c641a9b622861142991b5a19b40b145c9fd903c
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
8 years agousb: dwc_otg: optimized grf and clk operation for rk336x board
Frank Wang [Wed, 2 Mar 2016 03:24:48 +0000 (11:24 +0800)]
usb: dwc_otg: optimized grf and clk operation for rk336x board

Get grf offset form DT and optimize hclk_usb_peri clock process logic.

Change-Id: I136970c7052e5d621fd10e5d2b90f0fdac620067
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
8 years agoARM64: dts: rockchip: rk3366: add initial clock rate for vop
Feng Xiao [Thu, 3 Mar 2016 03:39:57 +0000 (11:39 +0800)]
ARM64: dts: rockchip: rk3366: add initial clock rate for vop

Change-Id: Iac586853a9acc4e396eabc01b31fb6d75dc61fcf
Signed-off-by: Feng Xiao <xf@rock-chips.com>
8 years agoARM64: dts: rockchip: rk3366-tb: add clk_ignore_unused in bootargs
Feng Xiao [Thu, 3 Mar 2016 02:33:49 +0000 (10:33 +0800)]
ARM64: dts: rockchip: rk3366-tb: add clk_ignore_unused in bootargs

Change-Id: I6b4cfd03141264da7368051c8d10f3eefbf27164
Signed-off-by: Feng Xiao <xf@rock-chips.com>
8 years agoARM64: dts: rockchip: rk3366: add initial clock rate for plls
Feng Xiao [Wed, 2 Mar 2016 15:15:31 +0000 (23:15 +0800)]
ARM64: dts: rockchip: rk3366: add initial clock rate for plls

Change-Id: I9ea6bcac10a7b67471613aea3ea41aff44a8fe34
Signed-off-by: Feng Xiao <xf@rock-chips.com>
8 years agoclk: rockchip: rk3366: pll's rate support 480MHz 520MHz 576MHz 750Mhz
Feng Xiao [Wed, 2 Mar 2016 15:04:33 +0000 (23:04 +0800)]
clk: rockchip: rk3366: pll's rate support 480MHz 520MHz 576MHz 750Mhz

Change-Id: I56c75018ffd27a21ac87c2004eb5bd6a3b1e0e3d
Signed-off-by: Feng Xiao <xf@rock-chips.com>
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 agovideo: rockchip: add win property node for application layer
Huang Jiachai [Mon, 1 Feb 2016 02:02:49 +0000 (10:02 +0800)]
video: rockchip: add win property node for application layer

Change-Id: I2e96d531d8fd1cf9eda665e4912501e4bec4d954
Signed-off-by: Huang Jiachai <hjc@rock-chips.com>
8 years agovideo: rockchip: fb: fix update reg kfree data lead to list_del null point
Huang Jiachai [Mon, 29 Feb 2016 02:33:25 +0000 (10:33 +0800)]
video: rockchip: fb: fix update reg kfree data lead to list_del null point

Change-Id: I5a9f3c795cf6f8ecbe9f45a769135fe890525fab
Signed-off-by: Huang Jiachai <hjc@rock-chips.com>
(cherry picked from commit fe05c53704fb3b61455dddbae8b5078be0f48a12)

8 years agovideo: rockchip: rk3288: fix extend screen type error
Huang Jiachai [Tue, 23 Feb 2016 10:19:58 +0000 (18:19 +0800)]
video: rockchip: rk3288: fix extend screen type error

Change-Id: Ie1754c8ffa51f01637bf08f2fae443c821d8e09a
Signed-off-by: Huang Jiachai <hjc@rock-chips.com>
(cherry picked from commit b6403156107533cf97e6fe326576831af214f47d)

8 years agovideo: rockchip: lcdc: 3368: add support write back
Huang Jiachai [Wed, 27 Jan 2016 11:38:59 +0000 (19:38 +0800)]
video: rockchip: lcdc: 3368: add support write back

Change-Id: Id4ae5fe8e0e3a6ae490bfa31594033a5eeba5233
Signed-off-by: Huang Jiachai <hjc@rock-chips.com>
(cherry picked from commit 96c50052a58b38f73432b9bf4156f1a9e6fdd023)

8 years agovideo: rockchip: add vop config for write back function
Huang Jiachai [Wed, 27 Jan 2016 11:38:22 +0000 (19:38 +0800)]
video: rockchip: add vop config for write back function

Change-Id: I8d27bb44fa1e8b30b422f2692a257ac9e0282f5e
Signed-off-by: Huang Jiachai <hjc@rock-chips.com>
(cherry picked from commit e853ac5f48c0d6da970def84c465ce319ab6f1a8)

8 years agoUPSTREAM: regulator: core: avoid unused variable warning
Arnd Bergmann [Fri, 20 Nov 2015 14:24:39 +0000 (15:24 +0100)]
UPSTREAM: regulator: core: avoid unused variable warning

The second argument of the mutex_lock_nested() helper is only
evaluated if CONFIG_DEBUG_LOCK_ALLOC is set. Otherwise we
get this build warning for the new regulator_lock_supply
function:

drivers/regulator/core.c: In function 'regulator_lock_supply':
drivers/regulator/core.c:142:6: warning: unused variable 'i' [-Wunused-variable]

To avoid the warning, this restructures the code to make it
both simpler and to move the 'i++' outside of the mutex_lock_nested
call, where it is now always used and the variable is not
flagged as unused.

We had some discussion about changing mutex_lock_nested to an
inline function, which would make the code do the right thing here,
but in the end decided against it, in order to guarantee that
mutex_lock_nested() does not introduced overhead without
CONFIG_DEBUG_LOCK_ALLOC.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 9f01cd4a915 ("regulator: core: introduce function to lock regulators and its supplies")
Link: http://permalink.gmane.org/gmane.linux.kernel/2068900
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit fa731ac7ea04a7d3a5c6d2f568132478c02a83b3)

Change-Id: Id700f411f2bcbe0cd49be332f329cd1b03768868

8 years agoUPSTREAM: clk: rockchip: include downstream muxes into fractional dividers on rk3368
Elaine Zhang [Wed, 24 Feb 2016 00:44:11 +0000 (08:44 +0800)]
UPSTREAM: clk: rockchip: include downstream muxes into fractional dividers on rk3368

During the initial conversion to the newly introduced combined fractional
dividers+muxes the rk3368 clocks were left out, so convert them now.

Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
(cherry picked from git.kernel.org mmind/linux-rockchip.git v4.6-clk/next
 commit 7af8a26ce7055dd74853ea7c2b9752961e3491da)

Change-Id: I81e408089ff1095d4735072d3ddb15c3564f6970

8 years agoarm64: dts: rockchip: remove unused files
Huang, Tao [Wed, 2 Mar 2016 02:03:17 +0000 (10:03 +0800)]
arm64: dts: rockchip: remove unused files

Change-Id: I5264e3967cd6dfbe776d03bc77d7434656d58772
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
8 years agoARM64: dts: rockchip: rk3399 dtsi fix for upstream
Jianqun Xu [Tue, 1 Mar 2016 04:45:59 +0000 (12:45 +0800)]
ARM64: dts: rockchip: rk3399 dtsi fix for upstream

Fix rk3399.dtsi for upstream, includes:
- remove psci related codes due to no impletement
- rmeove pmu node since wrong content
- add spi 3/4/5
- fix pmucru

Change-Id: I078874c35e66ef8301e40a753a2acbae9f10b852
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
8 years agoARM64: dts: rockchip: rk3366-tb: fix power_key gpio error
David Wu [Tue, 1 Mar 2016 15:04:43 +0000 (23:04 +0800)]
ARM64: dts: rockchip: rk3366-tb: fix power_key gpio error

Change-Id: I698e300b3d34d2bb5e8f1b83f3c6655af7e5d15a
Signed-off-by: David Wu <david.wu@rock-chips.com>
8 years agoclk: rockchip: update dt-binding header for rk3399 sdmmc/sdio
Xing Zheng [Tue, 1 Mar 2016 11:30:18 +0000 (19:30 +0800)]
clk: rockchip: update dt-binding header for rk3399 sdmmc/sdio

Add DRV/SAMPLE clock nodes for SDMMC/SDIO.

Change-Id: Ib23698f3b1b78bb7af42903fff8df34c3b62271f
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
8 years agopinctrl: rk3366: add support for rk3366
David Wu [Mon, 15 Feb 2016 10:29:54 +0000 (18:29 +0800)]
pinctrl: rk3366: add support for rk3366

The drive strength control of rk3366 is very different from others'.
RK3366 soc adds N and P channel drive strength control, and we assume
they are the same value.

Change-Id: I45896f1483cb0a7550789df3bf84a0460cb21527
Signed-off-by: David Wu <david.wu@rock-chips.com>
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 agovideo: rockchip: fb: fix double free when use devm_kzalloc() buf
Huang Jiachai [Mon, 29 Feb 2016 01:39:24 +0000 (09:39 +0800)]
video: rockchip: fb: fix double free when use devm_kzalloc() buf

Change-Id: I12872a61e2f07da23189cd57e2a355d73b98b005
Signed-off-by: Huang Jiachai <hjc@rock-chips.com>
8 years agovideo: rockchip: hdmi: skip operation when suspend or disabled
Zheng Yang [Tue, 1 Mar 2016 06:25:47 +0000 (14:25 +0800)]
video: rockchip: hdmi: skip operation when suspend or disabled

Change-Id: I294d338416a04d751ec5a5771e6b623ba7b69c02
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
(cherry picked from commit 0fdde42e0c459c9cc1b315cf2fbb0894d57ec0e4)

8 years agoarm64: dts: rk3366-tb: sheep board default to use mipi screen
Huang Jiachai [Tue, 1 Mar 2016 09:27:54 +0000 (17:27 +0800)]
arm64: dts: rk3366-tb: sheep board default to use mipi screen

Change-Id: I239777aa4f95543be9c5699e459cd7326ccc4f2c
Signed-off-by: Huang Jiachai <hjc@rock-chips.com>
8 years agoUPSTREAM: clk: rockchip: add a factor clock type
Heiko Stuebner [Sat, 20 Jun 2015 11:08:57 +0000 (13:08 +0200)]
UPSTREAM: clk: rockchip: add a factor clock type

Add a clock type for fixed factor clocks. This allows us to define fixed
factor clocks where they appear in the clock hierarchy instead of in the
init function.

The additional factor_gate type, finally allows us to model some last
parts of the clock tree correctly.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
(cherry picked from commit 29a30c269aba4223e2a8b443f443d7def1e43fea)

Change-Id: Ie4ec8b9d9199cdbe0be045c2ed4c270029e37949
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
8 years agoclk: rockchip: update dt-binding header for rk3399
Xing Zheng [Tue, 1 Mar 2016 08:21:30 +0000 (16:21 +0800)]
clk: rockchip: update dt-binding header for rk3399

Separate the number of CRU and PMUCRU, and modify the date to 2016.

Change-Id: I235fc8a93640e13fb112f45bb3387542b07e1a87
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
8 years agommc: dw_mmc-rockchip: fix failing to mount partition with "discard"
Shawn Lin [Tue, 1 Mar 2016 07:08:48 +0000 (15:08 +0800)]
mmc: dw_mmc-rockchip: fix failing to mount partition with "discard"

Without MMC_CAP_ERASE support, we fail to mount partition
with "discard" option since mmc_queue_setup_discard is limited
for checking mmc_can_erase. Without doing mmc_queue_setup_discard,
blk_queue_discard fails to test QUEUE_FLAG_DISCARD flag, so we get
the following log from f2fs(actually similar to other file system):

mounting with "discard" option, but the device does not support discard

Change-Id: Iee781795c9c61153644f0dd5b00dfc2cca6cc721
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
8 years agoARM64: dts: rockchip: add rga node for rk3366
Shengqin.Zhang [Wed, 3 Feb 2016 06:55:56 +0000 (14:55 +0800)]
ARM64: dts: rockchip: add rga node for rk3366

Change-Id: Ib1853054a9935eb0d48b5eaf346e9f7e58c688ed
Signed-off-by: Shengqin.Zhang <zsq@rock-chips.com>
8 years agoUPSTREAM: thermal: rockchip: fix the tsadc sequence output on rk3228/rk3399
Caesar Wang [Mon, 15 Feb 2016 07:33:31 +0000 (15:33 +0800)]
UPSTREAM: thermal: rockchip: fix the tsadc sequence output on rk3228/rk3399

As the TRM says, add the tsadc_q_sel to control the temperature-code
sequence since the rk3228/rk3399 need set this bit (1024 - tsadc_q)
as output.

Fixes: commit
b0d7033 "thermal: rockchip: Support the RK3399 SoCs in thermal driver"
7b02a5e "thermal: rockchip: Support the RK3228 SoCs in thermal driver"

Reported-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
(cherry picked from git.kernel.org evalenti/linux-soc-thermal fixes
 commit 7ea38c6c3622bc65279dc6a1fecd28227027fbb5)

Change-Id: I9d39b947e197393688ed58bf079e519e7d5a6d9e

8 years agoUPSTREAM: thermal: rockchip: the rename compatibles for rockchip SoCs
Caesar Wang [Mon, 15 Feb 2016 07:33:30 +0000 (15:33 +0800)]
UPSTREAM: thermal: rockchip: the rename compatibles for rockchip SoCs

This patch renames to be more adapter compatibles since more and more
SoCs are supported in thermal driver.

Reported-by: Huang,Tao <huangtao@rock-chips.com>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
(cherry picked from git.kernel.org evalenti/linux-soc-thermal fixes
 commit 952418a34f26f252cd0afbca8c33a8506a03cab7)

Change-Id: Ia053d6877a16b36e357bd9b427b323703e5a514b

8 years agoUPSTREAM: phy: core: fix wrong err handle for phy_power_on
Shawn Lin [Thu, 28 Jan 2016 08:14:18 +0000 (16:14 +0800)]
UPSTREAM: phy: core: fix wrong err handle for phy_power_on

If phy_pm_runtime_get_sync failed but we already
enable regulator, current code return directly without
doing regulator_disable. This patch fix this problem
and cleanup err handle of phy_power_on to be more readable.

Fixes: 3be88125d85d ("phy: core: Support regulator ...")
Cc: <stable@vger.kernel.org> # v3.18+
Cc: Roger Quadros <rogerq@ti.com>
Cc: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
(cherry picked from commit b82fcabe212a11698fd4b3e604d2f81d929d22f6)

Change-Id: I1cb5327d624d88a97096eccaa94924b851dcce27

8 years agorockchip: power & pmic: fix compile warning
Elaine Zhang [Fri, 26 Feb 2016 20:19:23 +0000 (04:19 +0800)]
rockchip: power & pmic: fix compile warning

fixed the WARNING: invalid free of devm_ allocated data

Change-Id: I54514cf53a8a0d1f885fd0a17e7f6db7af1d10f9
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
8 years agousb: dwc_otg: support to the latest usb gadget driver.
Frank Wang [Thu, 25 Feb 2016 07:07:33 +0000 (15:07 +0800)]
usb: dwc_otg: support to the latest usb gadget driver.

For gadget driver, usb_ep_caps is a new structrue in usb_ep, and its
attribute will be check in usb_ep_autoconfig method, so we need to do
some initialization work at ep creating.

Meanwhile, the process of android gadget driver have been changed,
correspondingly, udc_start and udc_stop are invoked differently from
before, so dwc_otg_gadget_stop method need to refactor and ajust
the new process.

Change-Id: Id1e20d4c265e0d382b0f36f6e729681f9c94c947
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
8 years agoUPSTREAM: phy: add a driver for the Rockchip SoC internal eMMC PHY
Shawn Lin [Wed, 3 Feb 2016 07:22:22 +0000 (15:22 +0800)]
UPSTREAM: phy: add a driver for the Rockchip SoC internal eMMC PHY

This patch to add a generic PHY driver for ROCKCHIP eMMC PHY.
Access the PHY via registers provided by GRF (general register
files) module.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
(cherry picked from git.kernel.org kishon/linux-phy next
 commit 9743f1c935995a55ddd926943ee7b3cfb4718208)

Change-Id: Ia24ccd041392e64efd28868ffccc8da4419bd29f

8 years agoUPSTREAM: Documentation: bindings: add dt documentation for Rockchip eMMC PHY
Shawn Lin [Tue, 5 Jan 2016 01:07:14 +0000 (09:07 +0800)]
UPSTREAM: Documentation: bindings: add dt documentation for Rockchip eMMC PHY

This patch adds a binding that describes the Rockchip eMMC PHYs
found on Rockchip SoCs eMMC interface.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
(cherry picked from git.kernel.org kishon/linux-phy next
 commit c9a1ddcac5b95a9dbf3d3f71d3be8b157239cce5)

Change-Id: I6913babddbc70c1ad3ea2234d8afac79190852a4

8 years agovideo: rockchip: tve: fix compile error and warning
Shen Zhenyi [Fri, 26 Feb 2016 09:16:42 +0000 (17:16 +0800)]
video: rockchip: tve: fix compile error and warning

Change-Id: Iacfc54e3f1c01cf3827cbb576d36f64145976bc1
Signed-off-by: Shen Zhenyi <szy@rock-chips.com>
8 years agoARM64: dts: rockchip: add io-domain node for rk3366
David Wu [Fri, 26 Feb 2016 10:14:47 +0000 (18:14 +0800)]
ARM64: dts: rockchip: add io-domain node for rk3366

Change-Id: I774e717fb49a725f143ff21cd7c4969dbe66a2de
Signed-off-by: David Wu <david.wu@rock-chips.com>
8 years agoPOWER: AVS: rockchp: add rk3366 io domain supprot
David Wu [Fri, 26 Feb 2016 10:07:01 +0000 (18:07 +0800)]
POWER: AVS: rockchp: add rk3366 io domain supprot

Change-Id: I64eb48ee7e161306b941a851585c50a1ee0edae2
Signed-off-by: David Wu <david.wu@rock-chips.com>
8 years agovideo: rockchip: hdmi: v1: modify double free to avoid compile warning
xuhuicong [Fri, 26 Feb 2016 08:03:00 +0000 (16:03 +0800)]
video: rockchip: hdmi: v1: modify double free to avoid compile warning

rockchip_hdmiv1.c:375:1-6: WARNING: invalid free of devm_ allocated data

Change-Id: I0ab0b3d8f30a9c106e67f33ae93bc1df1b333fc2
Signed-off-by: xuhuicong <xhc@rock-chips.com>
8 years agoARM64: powerdomain: enable power domain debug config by default
Elaine Zhang [Fri, 26 Feb 2016 07:10:57 +0000 (15:10 +0800)]
ARM64: powerdomain: enable power domain debug config by default

enable PM_ADVANCED_DEBUG by default.
use pd debug get pd tree like this:
cat d/pm_genpd/pm_genpd_summary

Change-Id: I1ca27a7619cc0655c2256918d7b6530b6a637bcf
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
8 years agonet: rfkill: fixed "WARNING: invalid free of devm_ allocated data"
xiaoyao [Fri, 26 Feb 2016 07:25:12 +0000 (15:25 +0800)]
net: rfkill: fixed "WARNING: invalid free of devm_ allocated data"

Change-Id: I3c84a08e9d62d6f16e4f162708584f7fd716066b
Signed-off-by: xiaoyao <xiaoyao@rock-chips.com>
8 years agoLinux 4.4.3
Greg Kroah-Hartman [Thu, 25 Feb 2016 20:01:36 +0000 (12:01 -0800)]
Linux 4.4.3

8 years agomodules: fix modparam async_probe request
Luis R. Rodriguez [Wed, 3 Feb 2016 06:25:26 +0000 (16:55 +1030)]
modules: fix modparam async_probe request

commit 4355efbd80482a961cae849281a8ef866e53d55c upstream.

Commit f2411da746985 ("driver-core: add driver module
asynchronous probe support") added async probe support,
in two forms:

  * in-kernel driver specification annotation
  * generic async_probe module parameter (modprobe foo async_probe)

To support the generic kernel parameter parse_args() was
extended via commit ecc8617053e0 ("module: add extra
argument for parse_params() callback") however commit
failed to f2411da746985 failed to add the required argument.

This causes a crash then whenever async_probe generic
module parameter is used. This was overlooked when the
form in which in-kernel async probe support was reworked
a bit... Fix this as originally intended.

Cc: Hannes Reinecke <hare@suse.de>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> [minimized]
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agomodule: wrapper for symbol name.
Rusty Russell [Wed, 3 Feb 2016 06:25:26 +0000 (16:55 +1030)]
module: wrapper for symbol name.

commit 2e7bac536106236104e9e339531ff0fcdb7b8147 upstream.

This trivial wrapper adds clarity and makes the following patch
smaller.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoitimers: Handle relative timers with CONFIG_TIME_LOW_RES proper
Thomas Gleixner [Thu, 14 Jan 2016 16:54:48 +0000 (16:54 +0000)]
itimers: Handle relative timers with CONFIG_TIME_LOW_RES proper

commit 51cbb5242a41700a3f250ecfb48dcfb7e4375ea4 upstream.

As Helge reported for timerfd we have the same issue in itimers. We return
remaining time larger than the programmed relative time to user space in case
of CONFIG_TIME_LOW_RES=y. Use the proper function to adjust the extra time
added in hrtimer_start_range_ns().

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Helge Deller <deller@gmx.de>
Cc: John Stultz <john.stultz@linaro.org>
Cc: linux-m68k@lists.linux-m68k.org
Cc: dhowells@redhat.com
Link: http://lkml.kernel.org/r/20160114164159.528222587@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoposix-timers: Handle relative timers with CONFIG_TIME_LOW_RES proper
Thomas Gleixner [Thu, 14 Jan 2016 16:54:47 +0000 (16:54 +0000)]
posix-timers: Handle relative timers with CONFIG_TIME_LOW_RES proper

commit 572c39172684c3711e4a03c9a7380067e2b0661c upstream.

As Helge reported for timerfd we have the same issue in posix timers. We
return remaining time larger than the programmed relative time to user space
in case of CONFIG_TIME_LOW_RES=y. Use the proper function to adjust the extra
time added in hrtimer_start_range_ns().

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Helge Deller <deller@gmx.de>
Cc: John Stultz <john.stultz@linaro.org>
Cc: linux-m68k@lists.linux-m68k.org
Cc: dhowells@redhat.com
Link: http://lkml.kernel.org/r/20160114164159.450510905@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agotimerfd: Handle relative timers with CONFIG_TIME_LOW_RES proper
Thomas Gleixner [Thu, 14 Jan 2016 16:54:46 +0000 (16:54 +0000)]
timerfd: Handle relative timers with CONFIG_TIME_LOW_RES proper

commit b62526ed11a1fe3861ab98d40b7fdab8981d788a upstream.

Helge reported that a relative timer can return a remaining time larger than
the programmed relative time on parisc and other architectures which have
CONFIG_TIME_LOW_RES set. This happens because we add a jiffie to the resulting
expiry time to prevent short timeouts.

Use the new function hrtimer_expires_remaining_adjusted() to calculate the
remaining time. It takes that extra added time into account for relative
timers.

Reported-and-tested-by: Helge Deller <deller@gmx.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: John Stultz <john.stultz@linaro.org>
Cc: linux-m68k@lists.linux-m68k.org
Cc: dhowells@redhat.com
Link: http://lkml.kernel.org/r/20160114164159.354500742@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoprctl: take mmap sem for writing to protect against others
Mateusz Guzik [Wed, 20 Jan 2016 23:01:02 +0000 (15:01 -0800)]
prctl: take mmap sem for writing to protect against others

commit ddf1d398e517e660207e2c807f76a90df543a217 upstream.

An unprivileged user can trigger an oops on a kernel with
CONFIG_CHECKPOINT_RESTORE.

proc_pid_cmdline_read takes mmap_sem for reading and obtains args + env
start/end values. These get sanity checked as follows:
        BUG_ON(arg_start > arg_end);
        BUG_ON(env_start > env_end);

These can be changed by prctl_set_mm. Turns out also takes the semaphore for
reading, effectively rendering it useless. This results in:

  kernel BUG at fs/proc/base.c:240!
  invalid opcode: 0000 [#1] SMP
  Modules linked in: virtio_net
  CPU: 0 PID: 925 Comm: a.out Not tainted 4.4.0-rc8-next-20160105dupa+ #71
  Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
  task: ffff880077a68000 ti: ffff8800784d0000 task.ti: ffff8800784d0000
  RIP: proc_pid_cmdline_read+0x520/0x530
  RSP: 0018:ffff8800784d3db8  EFLAGS: 00010206
  RAX: ffff880077c5b6b0 RBX: ffff8800784d3f18 RCX: 0000000000000000
  RDX: 0000000000000002 RSI: 00007f78e8857000 RDI: 0000000000000246
  RBP: ffff8800784d3e40 R08: 0000000000000008 R09: 0000000000000001
  R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000050
  R13: 00007f78e8857800 R14: ffff88006fcef000 R15: ffff880077c5b600
  FS:  00007f78e884a740(0000) GS:ffff88007b200000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
  CR2: 00007f78e8361770 CR3: 00000000790a5000 CR4: 00000000000006f0
  Call Trace:
    __vfs_read+0x37/0x100
    vfs_read+0x82/0x130
    SyS_read+0x58/0xd0
    entry_SYSCALL_64_fastpath+0x12/0x76
  Code: 4c 8b 7d a8 eb e9 48 8b 9d 78 ff ff ff 4c 8b 7d 90 48 8b 03 48 39 45 a8 0f 87 f0 fe ff ff e9 d1 fe ff ff 4c 8b 7d 90 eb c6 0f 0b <0f> 0b 0f 0b 66 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00
  RIP   proc_pid_cmdline_read+0x520/0x530
  ---[ end trace 97882617ae9c6818 ]---

Turns out there are instances where the code just reads aformentioned
values without locking whatsoever - namely environ_read and get_cmdline.

Interestingly these functions look quite resilient against bogus values,
but I don't believe this should be relied upon.

The first patch gets rid of the oops bug by grabbing mmap_sem for
writing.

The second patch is optional and puts locking around aformentioned
consumers for safety.  Consumers of other fields don't seem to benefit
from similar treatment and are left untouched.

This patch (of 2):

The code was taking the semaphore for reading, which does not protect
against readers nor concurrent modifications.

The problem could cause a sanity checks to fail in procfs's cmdline
reader, resulting in an OOPS.

Note that some functions perform an unlocked read of various mm fields,
but they seem to be fine despite possible modificaton.

Signed-off-by: Mateusz Guzik <mguzik@redhat.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Jarod Wilson <jarod@redhat.com>
Cc: Jan Stancek <jstancek@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Anshuman Khandual <anshuman.linux@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoxfs: log mount failures don't wait for buffers to be released
Dave Chinner [Mon, 18 Jan 2016 21:28:10 +0000 (08:28 +1100)]
xfs: log mount failures don't wait for buffers to be released

commit 85bec5460ad8e05e0a8d70fb0f6750eb719ad092 upstream.

Recently I've been seeing xfs/051 fail on 1k block size filesystems.
Trying to trace the events during the test lead to the problem going
away, indicating that it was a race condition that lead to this
ASSERT failure:

XFS: Assertion failed: atomic_read(&pag->pag_ref) == 0, file: fs/xfs/xfs_mount.c, line: 156
.....
[<ffffffff814e1257>] xfs_free_perag+0x87/0xb0
[<ffffffff814e21b9>] xfs_mountfs+0x4d9/0x900
[<ffffffff814e5dff>] xfs_fs_fill_super+0x3bf/0x4d0
[<ffffffff811d8800>] mount_bdev+0x180/0x1b0
[<ffffffff814e3ff5>] xfs_fs_mount+0x15/0x20
[<ffffffff811d90a8>] mount_fs+0x38/0x170
[<ffffffff811f4347>] vfs_kern_mount+0x67/0x120
[<ffffffff811f7018>] do_mount+0x218/0xd60
[<ffffffff811f7e5b>] SyS_mount+0x8b/0xd0

When I finally caught it with tracing enabled, I saw that AG 2 had
an elevated reference count and a buffer was responsible for it. I
tracked down the specific buffer, and found that it was missing the
final reference count release that would put it back on the LRU and
hence be found by xfs_wait_buftarg() calls in the log mount failure
handling.

The last four traces for the buffer before the assert were (trimmed
for relevance)

kworker/0:1-5259   xfs_buf_iodone:        hold 2  lock 0 flags ASYNC
kworker/0:1-5259   xfs_buf_ioerror:       hold 2  lock 0 error -5
mount-7163    xfs_buf_lock_done:     hold 2  lock 0 flags ASYNC
mount-7163    xfs_buf_unlock:        hold 2  lock 1 flags ASYNC

This is an async write that is completing, so there's nobody waiting
for it directly.  Hence we call xfs_buf_relse() once all the
processing is complete. That does:

static inline void xfs_buf_relse(xfs_buf_t *bp)
{
xfs_buf_unlock(bp);
xfs_buf_rele(bp);
}

Now, it's clear that mount is waiting on the buffer lock, and that
it has been released by xfs_buf_relse() and gained by mount. This is
expected, because at this point the mount process is in
xfs_buf_delwri_submit() waiting for all the IO it submitted to
complete.

The mount process, however, is waiting on the lock for the buffer
because it is in xfs_buf_delwri_submit(). This waits for IO
completion, but it doesn't wait for the buffer reference owned by
the IO to go away. The mount process collects all the completions,
fails the log recovery, and the higher level code then calls
xfs_wait_buftarg() to free all the remaining buffers in the
filesystem.

The issue is that on unlocking the buffer, the scheduler has decided
that the mount process has higher priority than the the kworker
thread that is running the IO completion, and so immediately
switched contexts to the mount process from the semaphore unlock
code, hence preventing the kworker thread from finishing the IO
completion and releasing the IO reference to the buffer.

Hence by the time that xfs_wait_buftarg() is run, the buffer still
has an active reference and so isn't on the LRU list that the
function walks to free the remaining buffers. Hence we miss that
buffer and continue onwards to tear down the mount structures,
at which time we get find a stray reference count on the perag
structure. On a non-debug kernel, this will be ignored and the
structure torn down and freed. Hence when the kworker thread is then
rescheduled and the buffer released and freed, it will access a
freed perag structure.

The problem here is that when the log mount fails, we still need to
quiesce the log to ensure that the IO workqueues have returned to
idle before we run xfs_wait_buftarg(). By synchronising the
workqueues, we ensure that all IO completions are fully processed,
not just to the point where buffers have been unlocked. This ensures
we don't end up in the situation above.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>