jiffies conversions: Use compile time constants when possible

Date	Fri, 04 Jan 2013 13:15:43 -0800

Do the multiplications and divisions at compile time
instead of runtime when the converted value is a constant.

Make the calculation functions static __always_inline to jiffies.h.

Add #defines with __builtin_constant_p to test and use the
static inline or the runtime functions as appropriate.

Prefix the old exported symbols/functions with __

Signed-off-by: Paul Reioux <reioux@gmail.com>
msm: smd_tty: Introduce read available wakelock

The SMD TTY driver locks a wakelock only after reading data from
the SMD channel and is ready to be processed by the TTY framework.
This sometimes causes suspend to be triggered before the SMD TTY
driver reads the data from the SMD channel.

Introduce read available wakelock and lock the wakelock when there is
data available in the SMD channel.

Change-Id: I44dfcff016d9066be18524e4c5b57c544f28f972
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>

Conflicts:
	arch/arm/mach-msm/smd_tty.c
msm: smd_tty: correct wakelock cleanup

The read available wakelock for a port is not correctly cleaned up in
smd_tty_close for the case where the underlying SMD transport open call
(smd_named_open_on_edge) failed.  If the port was reopened after this
failure, then the global wakelock list would be corrupted and could result
in watchdog crashes.

Fix this problem by changing the conditions under which the read available
wakelock is cleaned up in smd_tty_close so that all cases are handled
properly.

CRs-Fixed: 452589
Change-Id: Ia1cef0c94ce1ed36087ef618b8dcc2426d313fdb
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>

Conflicts:
	arch/arm/mach-msm/smd_tty.c
old bug in htree_dirblock_to_tree()

Both ext3 and ext4 htree_dirblock_to_tree() is just filling
the in-core rbtree for use by call_filldir().  All updates of
->f_pos are done by the latter; bumping it here (on error) is obviously
wrong - we might very well have it nowhere near the block we'd found
an error in.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Signed-off-by: Paul Reioux <reioux@gmail.com>
msm: memutils:  memcpy, memmove, copy_page optimization

Preload farther to take advantage of the memory bus, and assume
64-byte cache lines.  Unroll some pairs of ldm/stm as well, for
unexplainable reasons.

Future enhancements should include,

- #define for how far to preload, possibly defined separately for
  memcpy, copy_*_user
- Tuning for misaligned buffers
- Tuning for memmove
- Tuning for small buffers
- Understanding mechanism behind ldm/stm unroll causing some gains
  in copy_to_user

BASELINE (msm8960pro):
======================================================================
memcpy 1000MB at 5MB       : took 808850 usec, bandwidth 1236.236 MB/s
copy_to_user 1000MB at 5MB : took 810071 usec, bandwidth 1234.234 MB/s
copy_from_user 1000MB at 5M: took 942926 usec, bandwidth 1060.060 MB/s
memmove 1000GB at 5MB      : took 848588 usec, bandwidth 1178.178 MB/s
copy_to_user 1000GB at 4kB : took 847916 usec, bandwidth 1179.179 MB/s
copy_from_user 1000GB at 4k: took 935113 usec, bandwidth 1069.069 MB/s
copy_page 1000GB at 4kB    : took 779459 usec, bandwidth 1282.282 MB/s

THIS PATCH:
======================================================================
memcpy 1000MB at 5MB       : took 346223 usec, bandwidth 2888.888 MB/s
copy_to_user 1000MB at 5MB : took 348084 usec, bandwidth 2872.872 MB/s
copy_from_user 1000MB at 5M: took 348176 usec, bandwidth 2872.872 MB/s
memmove 1000GB at 5MB      : took 348267 usec, bandwidth 2871.871 MB/s
copy_to_user 1000GB at 4kB : took 377018 usec, bandwidth 2652.652 MB/s
copy_from_user 1000GB at 4k: took 371829 usec, bandwidth 2689.689 MB/s
copy_page 1000GB at 4kB    : took 383763 usec, bandwidth 2605.605 MB/s

Change-Id: I843fe77192d61ce35a81e75d76fc09f0a472e98a
Signed-off-by: Chris Fries <C.Fries@motorola.com>

Conflicts:
	arch/arm/lib/Makefile
	arch/arm/mach-msm/Kconfig
	arch/arm/mach-msm/Makefile
msm: hotplug: Add MSM Hotplug driver
msm: hotplug: Max 1036MHz during screen off
msm: hotplug: Remove spinlock in load stats

It's too expensive and not nessecary.
msm: hotplug: Stop hotplug work a tad later
msm: hotplug: Schedule suspend/resume work

Dennis is right, this is the proper way to suspend and resume.
msm: hotplug: Increase down lock duration and janitize
msm: hotplug: Use high-priority workqueue
msm: hotplug: Add input boost handler

Add an input handler to hotplug additional cpus. Down lock will
take care of keeping the cpu boosted.
msm: hotplug: Add minimum interval for input boost
msm: hotplug: Remove deprecated msm_cpufreq_set_freq_limits
msm: hotplug: Cleanup hotplugging routines

Remove paroid atomic operations that were causing issues.
cpufreq: add new routine cpufreq_verify_within_cpu_limits()

Most of the users of cpufreq_verify_within_limits() calls it for
limiting with min/max from policy->cpuinfo. We can make that code
simple by introducing another routine which will do this for them
automatically.

This patch adds another routine cpufreq_verify_within_cpu_limits()
and updates others to use it.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
msm: hotplug: Optimize hotplugging routines

- Power down the slowest cpu
- Move checks from callback to calling function
- Clean it up a bit
msm: hotplug: Add pm ops
msm: hotplug: Fix symbol export