ARM: 7486/1: sched_clock: update epoch_cyc on resume

Many clocks that are used to provide sched_clock will reset during
suspend.  If read_sched_clock returns 0 after suspend, sched_clock will
appear to jump forward.  This patch resets cd.epoch_cyc to the current
value of read_sched_clock during resume, which causes sched_clock() just
after suspend to return the same value as sched_clock() just before
suspend.

In addition, during the window where epoch_ns has been updated before
suspend, but epoch_cyc has not been updated after suspend, it is unknown
whether the clock has reset or not, and sched_clock() could return a
bogus value.  Add a suspended flag, and return the pre-suspend epoch_ns
value during this period.

The new behavior is triggered by calling setup_sched_clock_needs_suspend
instead of setup_sched_clock.

Change-Id: I7441ef74dc6802c00eea61f3b8c0a25ac00a724d
Signed-off-by: Colin Cross <ccross@android.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
CRs-Fixed: 497236
Git-commit: 237ec6f2e51d2fc2ff37c7c5f1ccc9264d09c85b
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Srivatsa Vaddagiri <vatsa@codeaurora.org>
Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>

Conflicts:
	arch/arm/kernel/sched_clock.c
ARM: 7565/1: sched: stop sched_clock() during suspend

The scheduler imposes a requirement to sched_clock()
which is to stop the clock during suspend, if we don't
do that any RT thread will be rescheduled in the future
which might cause any sort of problems.

This became an issue on OMAP when we converted omap-i2c.c
to use threaded IRQs, it turned out that depending on how
much time we spent on suspend, the I2C IRQ thread would
end up being rescheduled so far in the future that I2C
transfers would timeout and, because omap_hsmmc depends
on an I2C-connected device to detect if an MMC card is
inserted in the slot, our rootfs would just vanish.

arch/arm/kernel/sched_clock.c already had an optional
implementation (sched_clock_needs_suspend()) which would
handle scheduler's requirement properly, what this patch
does is simply to make that implementation non-optional.

Note that this has the side-effect that printk timings
won't reflect the actual time spent on suspend so other
methods to measure that will have to be used.

This has been tested with beagleboard XM (OMAP3630) and
pandaboard rev A3 (OMAP4430). Suspend to RAM is now working
after this patch.

Thanks to Kevin Hilman for helping out with debugging.

Change-Id: Ie2f9e3b22eb3d1f3806cf8c598f22e2fa1b8651f
Acked-by: Kevin Hilman <khilman@ti.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
CRs-Fixed: 497236
Git-commit: 6a4dae5e138a32b45ca5218cc2b81802f9d378c3
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Srivatsa Vaddagiri <vatsa@codeaurora.org>
Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
crypto: authenc - Fix crash with zero-length assoc data

The authenc code doesn't deal with zero-length associated data
correctly and ends up constructing a zero-length sg entry which
causes a crash when it's fed into the crypto system.

This patch fixes this by avoiding the code-path that triggers
the SG construction if we have no associated data.

This isn't the most optimal fix as it means that we'll end up
using the fallback code-path even when we could still execute
the digest function.  However, this isn't a big deal as nobody
but the test path would supply zero-length associated data.

Reported-by: Romain Francoise <romain@orebokech.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Tested-by: Romain Francoise <romain@orebokech.com>
mmc: sdhci: initialize sdhci_host lock in sdhci_alloc_host()

Currently, the sdhci host lock is initialized in sdhci_add_host()
but there can be a case where it is required even before that.
Hence, initialize it in sdhci_alloc_host() where sdhci_host
structure is allocated.

Change-Id: If99d82679c07bc2d36e0aad9354757288aa400b8
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
mmc: core: export mmc_host_may_gate_card function

MMC Host driver might want to use the mmc_host_may_gate_card() API
to know whether the clock can be gated to the card or not hence
export this function for usage outside its current scope.

Change-Id: I9ec4173063e2505eca179161cdf8cda033a3fd4b
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
kernel/sysctl: fix: 'warning: 'kbuf' may be used uninitialized in this function'

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
kernel/sysctl: fix: 'warning: 'kbuf' may be used uninitialized in this function' #2

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
fs/namespace: fix: 'warning: 'kernel_dev' may be used uninitialized in this function'

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
kernel/workqueue.c: avoid array subscript above array boundaries

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
fs/namespace: fix: 'warning: 'kernel_type/dir' may be used uninitialized in this function'

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
kernel/cgroup: fix: 'warning: 'it.task' may be used uninitialized in this function'

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
fs/fuse/control: fix 'warning: 'val' may be used uninitialized in this function'

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
fs/jbd/journal: fix: 'warning: 'blocknr' may be used uninitialized in this function'

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
fs/jbd2/journal: fix: 'warning: 'blocknr' may be used uninitialized in this function'

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
drivers/net/ppp/ppp_generic: fix: 'warning: 'code' may be used uninitialized in this function'

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
drivers/power/pm8xxx-ccadc: fix: 'warning: 'ibat' may be used uninitialized in this function'

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
drivers/power/pm8921-bms: fix: 'warning: 'vsense' may be used uninitialized in this function'

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
drivers/usb/host/ehci-sched: fix: 'warning: 'c_mask' may be used uninitialized in this function'

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
net/unix/af_unix: fix: 'warning: '...' may be used uninitialized in this function'

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>
drivers/staging/prima/CORE/HDD/src/wlan_hdd_ftm: fix: 'warning: array subscript is above array bounds'

Signed-off-by: Dennis Rassmann <showp1984@gmail.com>