From patchwork Mon Aug 10 09:52:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 52172 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by patches.linaro.org (Postfix) with ESMTPS id E4EBB2152A for ; Mon, 10 Aug 2015 09:57:53 +0000 (UTC) Received: by labth1 with SMTP id th1sf59669385lab.2 for ; Mon, 10 Aug 2015 02:57:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=WqZLx0sTHWudiMDbJhVWOAGazrpRIGQvU1VgfpzbVfI=; b=JuUWojaskXa+5RQ8uuvdjKk8FpxMpjn2aAh1FgiLguPhxMZ1UqrMjKOgezPBDg1zcI paI84pNhrjtEknmmF1CIOeMvUgMaqumDClf+rz2hdoCAkbI1XM4TwaJZeBODE70h0DyV wtve1UoX9nH9sB16DRnexeMYflqwDyFozfpnyNXjnx+jziejsvpGuZyShjSzJOMMn4og 0xsippaOq5pt3YojjbxDc3AVJK4H1JtmKgwyeotBvCUsy2X5pfXxBXNFSQ+8+XGBdskC ic2XjPrlPipu9goMWX/dr6FSsg7Kr4f2tijYjuEQ+nbIg/wYpKTcAmOnM51A5uwT0srD 4YBg== X-Gm-Message-State: ALoCoQkEukwEmrZH2/kEYR25iB23nuA7A4nIzBYIqngQNSBLYN5x2mh39bG2d4zvXCbGGojLR9Ez X-Received: by 10.152.87.79 with SMTP id v15mr1587859laz.9.1439200672928; Mon, 10 Aug 2015 02:57:52 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.43.136 with SMTP id w8ls653168lal.16.gmail; Mon, 10 Aug 2015 02:57:52 -0700 (PDT) X-Received: by 10.152.4.163 with SMTP id l3mr19679985lal.35.1439200672612; Mon, 10 Aug 2015 02:57:52 -0700 (PDT) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id w5si13737815lal.105.2015.08.10.02.57.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Aug 2015 02:57:52 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by lahi9 with SMTP id i9so20316643lah.2 for ; Mon, 10 Aug 2015 02:57:52 -0700 (PDT) X-Received: by 10.112.67.65 with SMTP id l1mr9156990lbt.86.1439200672529; Mon, 10 Aug 2015 02:57:52 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp1829060lba; Mon, 10 Aug 2015 02:57:51 -0700 (PDT) X-Received: by 10.70.127.167 with SMTP id nh7mr42271889pdb.2.1439200670697; Mon, 10 Aug 2015 02:57:50 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gk2si32398021pac.68.2015.08.10.02.57.47; Mon, 10 Aug 2015 02:57:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754916AbbHJJ51 (ORCPT + 28 others); Mon, 10 Aug 2015 05:57:27 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:32947 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754802AbbHJJ5T (ORCPT ); Mon, 10 Aug 2015 05:57:19 -0400 Received: by wijp15 with SMTP id p15so128667567wij.0 for ; Mon, 10 Aug 2015 02:57:18 -0700 (PDT) X-Received: by 10.194.23.194 with SMTP id o2mr43802932wjf.63.1439200638584; Mon, 10 Aug 2015 02:57:18 -0700 (PDT) Received: from localhost.localdomain (sju31-1-78-210-255-2.fbx.proxad.net. [78.210.255.2]) by smtp.gmail.com with ESMTPSA id jr5sm28598154wjc.14.2015.08.10.02.57.17 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 10 Aug 2015 02:57:18 -0700 (PDT) From: Daniel Lezcano To: mingo@kernel.org Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org, Viresh Kumar Subject: [PATCH 73/74] kernel: broadcast-hrtimer: Migrate to new 'set-state' interface Date: Mon, 10 Aug 2015 11:52:30 +0200 Message-Id: <1439200352-26767-73-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1439200352-26767-1-git-send-email-daniel.lezcano@linaro.org> References: <55C87382.4070309@linaro.org> <1439200352-26767-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: daniel.lezcano@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Viresh Kumar Migrate broadcast-hrtimer driver to the new 'set-state' interface provided by clockevents core, the earlier 'set-mode' interface is marked obsolete now. Cc: Thomas Gleixner Signed-off-by: Viresh Kumar Signed-off-by: Daniel Lezcano --- kernel/time/tick-broadcast-hrtimer.c | 49 +++++++++++++++--------------------- 1 file changed, 20 insertions(+), 29 deletions(-) diff --git a/kernel/time/tick-broadcast-hrtimer.c b/kernel/time/tick-broadcast-hrtimer.c index 3e7db49..53d7184 100644 --- a/kernel/time/tick-broadcast-hrtimer.c +++ b/kernel/time/tick-broadcast-hrtimer.c @@ -18,30 +18,23 @@ static struct hrtimer bctimer; -static void bc_set_mode(enum clock_event_mode mode, - struct clock_event_device *bc) +static int bc_shutdown(struct clock_event_device *evt) { - switch (mode) { - case CLOCK_EVT_MODE_UNUSED: - case CLOCK_EVT_MODE_SHUTDOWN: - /* - * Note, we cannot cancel the timer here as we might - * run into the following live lock scenario: - * - * cpu 0 cpu1 - * lock(broadcast_lock); - * hrtimer_interrupt() - * bc_handler() - * tick_handle_oneshot_broadcast(); - * lock(broadcast_lock); - * hrtimer_cancel() - * wait_for_callback() - */ - hrtimer_try_to_cancel(&bctimer); - break; - default: - break; - } + /* + * Note, we cannot cancel the timer here as we might + * run into the following live lock scenario: + * + * cpu 0 cpu1 + * lock(broadcast_lock); + * hrtimer_interrupt() + * bc_handler() + * tick_handle_oneshot_broadcast(); + * lock(broadcast_lock); + * hrtimer_cancel() + * wait_for_callback() + */ + hrtimer_try_to_cancel(&bctimer); + return 0; } /* @@ -82,7 +75,7 @@ static int bc_set_next(ktime_t expires, struct clock_event_device *bc) } static struct clock_event_device ce_broadcast_hrtimer = { - .set_mode = bc_set_mode, + .set_state_shutdown = bc_shutdown, .set_next_ktime = bc_set_next, .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_KTIME | @@ -102,13 +95,11 @@ static enum hrtimer_restart bc_handler(struct hrtimer *t) { ce_broadcast_hrtimer.event_handler(&ce_broadcast_hrtimer); - switch (ce_broadcast_hrtimer.mode) { - case CLOCK_EVT_MODE_ONESHOT: + if (clockevent_state_oneshot(&ce_broadcast_hrtimer)) if (ce_broadcast_hrtimer.next_event.tv64 != KTIME_MAX) return HRTIMER_RESTART; - default: - return HRTIMER_NORESTART; - } + + return HRTIMER_NORESTART; } void tick_setup_hrtimer_broadcast(void)