From patchwork Thu Jul 16 11:26:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 51167 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3570522A28 for ; Thu, 16 Jul 2015 11:29:56 +0000 (UTC) Received: by wipp2 with SMTP id p2sf3912748wip.2 for ; Thu, 16 Jul 2015 04:29:55 -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: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=+/0A43rKByqg0MLB4dt2LksXT/Am3/9lx/tX7LnlZCk=; b=QjCefX9SU7dKV6rrAdCttHiv36UtK5Jw/zfNBjZJgI3dRM0Nmp3twYV8ks2YEiFaTb +42U4z3cFHXxD4H54YNaHyTkQ2ADSIyFRWGLR7Ke6Vvpw8sQLo0uN5/dTTkZNU1bgC5v TpnUf6ZELVe4RkK2BsdPz78tGTdPjDx9VVUAlMeIcJOyIzgI+SmSpqg7WT9a2uWQsrcq 8vESsbrFJsKiszoO4Ffj9pE2iRe2bD0V0/V+qUTokmtCvUa+gZNULiOWdIVsh8wuKzlm +oisES4m4DfkB3crVsDA25IuW111BI8URoHetybt05WSi30uyFHnPpyppv5TlHqH406d KrQQ== X-Gm-Message-State: ALoCoQnRa1CYHItlrjwkUvYkpmzW0n/LbAg9pMuazX6JwdR4EmTilgFxHQtEa5wltKdCARdABpJW X-Received: by 10.152.27.130 with SMTP id t2mr4652405lag.2.1437046195392; Thu, 16 Jul 2015 04:29:55 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.9 with SMTP id ku9ls319464lac.37.gmail; Thu, 16 Jul 2015 04:29:55 -0700 (PDT) X-Received: by 10.152.5.228 with SMTP id v4mr8936504lav.36.1437046195075; Thu, 16 Jul 2015 04:29:55 -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 k9si6691601lam.90.2015.07.16.04.29.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Jul 2015 04:29:55 -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 lahh5 with SMTP id h5so41595656lah.2 for ; Thu, 16 Jul 2015 04:29:55 -0700 (PDT) X-Received: by 10.112.166.2 with SMTP id zc2mr8899730lbb.29.1437046194976; Thu, 16 Jul 2015 04:29:54 -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.108.230 with SMTP id hn6csp192369lbb; Thu, 16 Jul 2015 04:29:53 -0700 (PDT) X-Received: by 10.68.102.228 with SMTP id fr4mr17612156pbb.110.1437046191265; Thu, 16 Jul 2015 04:29:51 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ot9si12591142pab.79.2015.07.16.04.29.49; Thu, 16 Jul 2015 04:29:51 -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 S1755509AbbGPL3f (ORCPT + 27 others); Thu, 16 Jul 2015 07:29:35 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:36673 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755491AbbGPL3c (ORCPT ); Thu, 16 Jul 2015 07:29:32 -0400 Received: by pachj5 with SMTP id hj5so41566046pac.3 for ; Thu, 16 Jul 2015 04:29:32 -0700 (PDT) X-Received: by 10.70.40.227 with SMTP id a3mr17449632pdl.119.1437046172174; Thu, 16 Jul 2015 04:29:32 -0700 (PDT) Received: from localhost ([122.171.186.190]) by smtp.gmail.com with ESMTPSA id by13sm7692612pdb.37.2015.07.16.04.29.30 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 16 Jul 2015 04:29:31 -0700 (PDT) From: Viresh Kumar To: Thomas Gleixner , Daniel Lezcano Cc: linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, Viresh Kumar Subject: [PATCH 23/23] kernel: broadcast-hrtimer: Migrate to new 'set-state' interface Date: Thu, 16 Jul 2015 16:56:35 +0530 Message-Id: <557ae9e7b3259d65a8221e19c8d786322cb928d5.1437044518.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.4.0 In-Reply-To: References: In-Reply-To: References: 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: viresh.kumar@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: , 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 --- 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 3e7db49a2381..53d7184da0be 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)