Input: lm8323 - fix checking PWM interrupt status

INT_PWM1 is already a bitmask, not the bit number, so shifting by INT_PWM1 is
incorrect.

Signed-off-by: Nickolai Zeldovich <nickolai@csail.mit.edu>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Input: document that unregistering managed devices is not necessary

Apparently some users of managed input devices are confused whether
input_unregister_device() is needed when working with them. Clarify
this in the kernel doc for devm_input_allocate_device(): in most cases
there is no need to call neither input_unregister_device() nor
input_free_device() when working with managed devices.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Input: wacom - fix wacom_set_report retry logic

Logic sets a value and then reads it back to make sure it worked
and retries write on failures.  Since read and write share a buffer,
it needs to be set back up before writing though.

Issue is not seen a lot because 1) it doesn't need to retry for
a lot of tablets and 2) a lot of failures that need a retry are
from an -ETIMEDOUT and hopefully buffer is not touched in this case.

At least one user has shown logs with buffer being modified during
-ETIMEDOUT case with linux 3.7 kernel.

Signed-off-by: Chris Bagwell <chris@cnpbagwell.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
mm: fix pageblock bitmap allocation

Commit c060f943d092 ("mm: use aligned zone start for pfn_to_bitidx
calculation") fixed out calculation of the index into the pageblock
bitmap when a !SPARSEMEM zome was not aligned to pageblock_nr_pages.

However, the _allocation_ of that bitmap had never taken this alignment
requirement into accout, so depending on the exact size and alignment of
the zone, the use of that index could then access past the allocation,
resulting in some very subtle memory corruption.

This was reported (and bisected) by Ingo Molnar: one of his random
config builds would hang with certain very specific kernel command line
options.

In the meantime, commit c060f943d092 has been marked for stable, so this
fix needs to be back-ported to the stable kernels that backported the
commit to use the right alignment.

Bisected-and-tested-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Mel Gorman <mgorman@suse.de>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

Pull input subsystem fixes from Dmitry Torokhov:
 "Two small driver fixups and a documentation update for managed input
  devices"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: wacom - fix wacom_set_report retry logic
  Input: document that unregistering managed devices is not necessary
  Input: lm8323 - fix checking PWM interrupt status