hrtimer: make sure PINNED flag is cleared after removing hrtimer

Change-Id: Icc4d1c183e993b4b3c9b96ec9779c234e73ecab7
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
[forward port to 3.18]
Signed-off-by: Santosh Shukla <santosh.shukla@linaro.org>
Git-commit: d6c894e515b4cd93c3a08e7c60cce0aa5118c656
Git-repo: git://git.linaro.org/people/mike.holmes/santosh.shukla/lng-isol.git
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index e58c064..086c5d7 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -944,6 +944,7 @@
 			state = HRTIMER_STATE_INACTIVE;
 
 		__remove_hrtimer(timer, base, state, reprogram);
+		timer->state &= ~HRTIMER_STATE_PINNED;
 		return 1;
 	}
 	return 0;
@@ -999,7 +1000,7 @@
 
 	/* Update pinned state */
 	timer->state &= ~HRTIMER_STATE_PINNED;
-	timer->state |= !!(mode & HRTIMER_MODE_PINNED) << HRTIMER_PINNED_SHIFT;
+	timer->state |= (!!(mode & HRTIMER_MODE_PINNED)) << HRTIMER_PINNED_SHIFT;
 
 	leftmost = enqueue_hrtimer(timer, new_base);
 	if (!leftmost)