From patchwork Mon May 12 09:30:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 29959 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 40FC020A67 for ; Mon, 12 May 2014 09:30:59 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id i4sf38265635oah.1 for ; Mon, 12 May 2014 02:30:58 -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=BINiobdSGdDYOatvKpsyL+VOpKNexT4iUiTc92i3OoE=; b=jQ9yDpYNzxHFSaErOz/p+OxF0RDBd7Xi6yP07LPglqWNGUv7jb+b52sfCxK7KfXiRT V4wcr6JFu0p3JydwccpuyoNhI6bfKnyycdr4rTHoLppu6o/dQptA3JOQ2HgTmtdCbvJY 0WyMXJDat8Czfd2UmqD4qT1zua4nFLPxV1xKjKfZlrUp/6aW1OYVaCjAYp2f9V0wJOXm m4bEdsqi9Bw9MxytqFa81tatAAyVjz5WvRP/jXYCyetkIqCaS37Bp0Mosfy/JXfO6U+u sJeKx86xiIoGCYA6xTQDM0slN4N/BuWzcRvKQmw7Fh6wKSgHcx4sYfOKdki1Xvn8RdCn O4Cw== X-Gm-Message-State: ALoCoQkvXBBtTiWwHzkLLaVwDPZhhGmwNkzBnnyQdySSf3JEgNi/PJQeBs9AMIW5uisbV99IFKgK X-Received: by 10.182.19.231 with SMTP id i7mr13409011obe.25.1399887058770; Mon, 12 May 2014 02:30:58 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.38.133 with SMTP id t5ls1280479qgt.43.gmail; Mon, 12 May 2014 02:30:58 -0700 (PDT) X-Received: by 10.58.65.10 with SMTP id t10mr296936ves.34.1399887058618; Mon, 12 May 2014 02:30:58 -0700 (PDT) Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by mx.google.com with ESMTPS id at8si1985438vec.37.2014.05.12.02.30.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 12 May 2014 02:30:58 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.172 as permitted sender) client-ip=209.85.128.172; Received: by mail-ve0-f172.google.com with SMTP id oz11so8379471veb.17 for ; Mon, 12 May 2014 02:30:58 -0700 (PDT) X-Received: by 10.52.252.43 with SMTP id zp11mr54853vdc.44.1399887058506; Mon, 12 May 2014 02:30:58 -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.220.221.72 with SMTP id ib8csp54204vcb; Mon, 12 May 2014 02:30:57 -0700 (PDT) X-Received: by 10.66.161.69 with SMTP id xq5mr32698845pab.62.1399887057574; Mon, 12 May 2014 02:30:57 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rm9si6063920pbc.79.2014.05.12.02.30.56; Mon, 12 May 2014 02:30:56 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755459AbaELJap (ORCPT + 27 others); Mon, 12 May 2014 05:30:45 -0400 Received: from mail-wi0-f180.google.com ([209.85.212.180]:35619 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754430AbaELJah (ORCPT ); Mon, 12 May 2014 05:30:37 -0400 Received: by mail-wi0-f180.google.com with SMTP id hi2so4119011wib.7 for ; Mon, 12 May 2014 02:30:36 -0700 (PDT) X-Received: by 10.194.48.100 with SMTP id k4mr1249160wjn.49.1399887036538; Mon, 12 May 2014 02:30:36 -0700 (PDT) Received: from localhost ([213.122.173.131]) by mx.google.com with ESMTPSA id ht5sm7687485wjb.49.2014.05.12.02.30.32 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 12 May 2014 02:30:35 -0700 (PDT) From: Viresh Kumar To: tglx@linutronix.de Cc: linaro-kernel@lists.linaro.org, linaro-networking@linaro.org, linux-kernel@vger.kernel.org, fweisbec@gmail.com, arvind.chauhan@arm.com, daniel.lezcano@linaro.org, Viresh Kumar Subject: [RFC 2/2] clockevents: add ->set_dev_mode() to struct clock_event_device Date: Mon, 12 May 2014 15:00:06 +0530 Message-Id: <0e036bbf00178049b542c450eabc246b8a88f687.1399886467.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.0.0.rc2 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.128.172 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: , There is a requirement to add another mode: CLOCK_EVT_MODE_ONESHOT_STOPPED (lkml.org/lkml/2014/5/9/508) to clockevent devices and clockevent-drivers may or maynot support it. And so can return failure codes on a call to ->set_mode(), which has a return type of 'void' as of now. To fix that, add another callback ->set_dev_mode(), with return type 'int'. All clockevent drivers will be migrated to use this new interface later. Also mark ->set_mode() deprecated. Signed-off-by: Viresh Kumar --- include/linux/clockchips.h | 5 ++++- kernel/time/clockevents.c | 26 ++++++++++++++++++++------ kernel/time/timer_list.c | 9 +++++++-- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h index 4e7a4d3..e15836f 100644 --- a/include/linux/clockchips.h +++ b/include/linux/clockchips.h @@ -81,7 +81,8 @@ enum clock_event_mode { * @mode: operating mode assigned by the management code * @features: features * @retries: number of forced programming retries - * @set_mode: set mode function + * @set_dev_mode: set state function + * @set_mode: set mode function (deprecated, use set_dev_mode instead) * @broadcast: function to broadcast events * @min_delta_ticks: minimum delta value in ticks stored for reconfiguration * @max_delta_ticks: maximum delta value in ticks stored for reconfiguration @@ -109,6 +110,8 @@ struct clock_event_device { unsigned long retries; void (*broadcast)(const struct cpumask *mask); + int (*set_dev_mode)(enum clock_event_mode mode, + struct clock_event_device *); void (*set_mode)(enum clock_event_mode mode, struct clock_event_device *); void (*suspend)(struct clock_event_device *); diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index 8665660..3ef5997 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c @@ -104,8 +104,17 @@ EXPORT_SYMBOL_GPL(clockevent_delta2ns); int clockevents_set_mode(struct clock_event_device *dev, enum clock_event_mode mode) { + int ret = 0; + if (dev->mode != mode) { - dev->set_mode(mode, dev); + if (dev->set_dev_mode) + ret = dev->set_dev_mode(mode, dev); + else + dev->set_mode(mode, dev); + + if (unlikely(ret)) + return ret; + dev->mode = mode; /* @@ -443,15 +452,20 @@ EXPORT_SYMBOL_GPL(clockevents_config_and_register); int __clockevents_update_freq(struct clock_event_device *dev, u32 freq) { + int ret = 0; + clockevents_config(dev, freq); if (dev->mode == CLOCK_EVT_MODE_ONESHOT) - return clockevents_program_event(dev, dev->next_event, false); - - if (dev->mode == CLOCK_EVT_MODE_PERIODIC) - dev->set_mode(CLOCK_EVT_MODE_PERIODIC, dev); + ret = clockevents_program_event(dev, dev->next_event, false); + else if (dev->mode == CLOCK_EVT_MODE_PERIODIC) { + if (dev->set_dev_mode) + ret = dev->set_dev_mode(CLOCK_EVT_MODE_PERIODIC, dev); + else + dev->set_mode(CLOCK_EVT_MODE_PERIODIC, dev); + } - return 0; + return ret; } /** diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c index 61ed862..3d854aa 100644 --- a/kernel/time/timer_list.c +++ b/kernel/time/timer_list.c @@ -228,8 +228,13 @@ print_tickdevice(struct seq_file *m, struct tick_device *td, int cpu) print_name_offset(m, dev->set_next_event); SEQ_printf(m, "\n"); - SEQ_printf(m, " set_mode: "); - print_name_offset(m, dev->set_mode); + if (dev->set_dev_mode) { + SEQ_printf(m, " set_dev_mode: "); + print_name_offset(m, dev->set_dev_mode); + } else { + SEQ_printf(m, " set_mode: "); + print_name_offset(m, dev->set_mode); + } SEQ_printf(m, "\n"); SEQ_printf(m, " event_handler: ");