ext4: use atomic64_t for the per-flexbg free_clusters count

commit 90ba983f6889e65a3b506b30dc606aa9d1d46cd2 upstream.

A user who was using a 8TB+ file system and with a very large flexbg
size (> 65536) could cause the atomic_t used in the struct flex_groups
to overflow.  This was detected by PaX security patchset:

http://forums.grsecurity.net/viewtopic.php?f=3&t=3289&p=12551#p12551

This bug was introduced in commit 9f24e4208f7e, so it's been around
since 2.6.30.  :-(

Fix this by using an atomic64_t for struct orlav_stats's
free_clusters.

[Backported for 3.0-stable. Renamed free_clusters back to free_blocks;
fixed a few more atomic_read's of free_blocks left in 3.0.]

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Lingzhu Xiang <lxiang@redhat.com>
Reviewed-by: CAI Qian <caiqian@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ext4: fixup 64-bit divides in 3.0-stable backport of upstream fix

Replace C division operators with div64_u64 for divides introduced in:
commit 503f4bdcc078e7abee273a85ce322de81b18a224
ext4: use atomic64_t for the per-flexbg free_clusters count

Specific to the 3.0-stable backport of the upstream patch.

Change-Id: Id10180ed16f54f58fc18531092e88f52fc6de31c
Reviewed-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
msm: timer: Don't check state of clock while setting next timer event

The commit fd6681cd4d0782f6e6ac918ab337016f59c2520b introduced
a silent bug that incorrectly checks state of the clock while
setting the next timer event. The bug manifests only during
failure code path of msm idle operation, which is very rare.
Due to the bug, the driver isn't be able to reprogram the timer
device.

CRs-fixed: 468902
Change-Id: I4ec14ea9c3a5d318ef98d2b13bd55efd89538df5
Signed-off-by: Jay Chokshi <jchokshi@codeaurora.org>
Squashed update of kernel from 3.0.72 to 3.0.73
Update defconfigs
Merge branch 'ics-3.0' of https://github.com/arco/samsung-kernel-msm7x30 into ics-3.0
input: Phantom Key Presses filtering

Attempt to workaround a well known hardware bug of some Samsung devices.
Pratically, the high activity of the radio hardware, in particular the antenna, could cause interference on Melfas chip, which is located very close to the antenna.
This interference could induce bad interrupts that are seen by the chip as possible HOME, MENU or BACK key presses.
These phantom key presses are happening expecially in 2G mode.

The solution includes a new device module (phantom_kp_filter), which also allow the filtering parameters customization, and various changes to cypress-touchkey and pmic8xxx-keypad modules.

-- Phantom MENU and BACK key presses --

The solution can be divided into two parts:
- Validity check of the interrupt _3_TOUCH_INT checking for a predefined (and customizable) times that the corresponding value is 0, in fact, in the case of interference, the value can be 1, then you can decide whether or not to ignore the key press interrupt
- Validity check of the key pressed event, ignoring the possible events of key down and up on different keys (eg. MENU key down -> BACK key up), or too rapid wrong key presses

The problem and the possible workarounds are described by Electric Bill on this XDA forum thread:
http://forum.xda-developers.com/showthread.php?t=1551580

The code changes are also based on these commits made by CyanogenMod Team:
- https://github.com/CyanogenMod/android_kernel_samsung_aries/commit/4afad77c61c7cb54cce293034cdb07a928f22d20
- https://github.com/CyanogenMod/android_kernel_samsung_aries/commit/cb8fa22cba177709848321e8100ee60ee1684530

-- Phantom HOME key presses --

The solution can be divided into two parts:
- Validity check of the incoming key state, ignoring the key press if the status is not changed
- The key press states are temporarly collected inside a bit array and reported with a small delayed time, if there are too many interrupts, they could be related to radio interference, so the collected key states won't be reported to avoid phantom key presses

-- Module sysfs interface --

The new device module allow to show the number of ignored key press and to customize the filtering parameters by means of a sysfs interface, at the following system path:
/sys/class/misc/phantom_kp_filter

- home_enabled: the enabled status of the phantom HOME key presses filtering (0 = disabled, 1 = enabled)
- home_allowed_irqs: show/edit the allowed max number of incoming interrupts to consider a HOME key press as valid (from 1 to 32)
- home_report_wait: show/edit the wait time in ms before report the collected HOME key presses (from 5 to 25 ms)
- home_ignored_kp: show the ignored possible phantom HOME key presses
- menuback_enabled: show/edit the enabled status of the phantom MENU and BACK key presses filtering (0 = disabled, 1 = enabled)
- menuback_interrupt_checks: show/edit the interrupt checks number to be performed for the incoming MENU and BACK key presses (from 1 to 10)
- menuback_first_err_wait: show/edit the time in ms to wait after the first error on MENU or BACK keys if there are many invalid key errors in rapid sequence (from 50 to 1000 ms)
- menuback_last_err_wait: show/edit the time in ms to wait after the last error on MENU or BACK keys if there are many invalid key errors in rapid sequence (from 50 to 1000 ms)
- menuback_ignored_kp: show the ignored possible phantom MENU and BACK key presses
- version: show the module version
Updated default and custom configs