From patchwork Tue Jul 7 08:14:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 50805 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BD9CD22A03 for ; Tue, 7 Jul 2015 08:14:59 +0000 (UTC) Received: by laar3 with SMTP id r3sf54952450laa.1 for ; Tue, 07 Jul 2015 01:14: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:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=M/iZ19gxYq49GEDUwReFkC8XF8OzpTXMkcM0sbuIKzo=; b=Odoh0wr0HCt26YO7CFDj8c41CogIuN+mrJzwUbS2/aVlTsfFAuhR6bdHk8r/K6Bbco udAwGMz27NC5KLqTslZW9RTsFh7c/8FYwE9SM8rm0ZRJug3xEjte6d1AFSfK+1efK3iC qYZyileG4wG1eyDMSr5XdSt61NlTHwW4e/ycIxb4gaZ8w4zVQsncPxJQ9sGxuDsWubwd AuKSAetdQpsNJeusLtWqBAh3Zmh78qh9zSEPAYCHh5GgR/IpMprGi71sY11l1OcG5yn7 GialxmGkiJmvZ6CoZ7THEQBaWS+eNAoHrT7YSF0McO1CmYCbYduG+fm1wIavgPRd9XGK KTcQ== X-Gm-Message-State: ALoCoQnPYLzvBsarrOmpvns4FDrJpYgb+8CyupNqSNJO0Ds0LcrzrVfEFnW39KnCcsPfYzkLTF3D X-Received: by 10.180.81.170 with SMTP id b10mr17386031wiy.4.1436256898750; Tue, 07 Jul 2015 01:14:58 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.180.135 with SMTP id do7ls153151lac.109.gmail; Tue, 07 Jul 2015 01:14:58 -0700 (PDT) X-Received: by 10.112.50.230 with SMTP id f6mr2822547lbo.17.1436256898552; Tue, 07 Jul 2015 01:14:58 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id t9si17458300lat.175.2015.07.07.01.14.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Jul 2015 01:14:58 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by lagc2 with SMTP id c2so184175280lag.3 for ; Tue, 07 Jul 2015 01:14:58 -0700 (PDT) X-Received: by 10.152.6.69 with SMTP id y5mr2849901lay.72.1436256898068; Tue, 07 Jul 2015 01:14: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.112.108.230 with SMTP id hn6csp2222083lbb; Tue, 7 Jul 2015 01:14:56 -0700 (PDT) X-Received: by 10.66.218.42 with SMTP id pd10mr6459391pac.106.1436256896051; Tue, 07 Jul 2015 01:14:56 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ai4si33284452pbc.176.2015.07.07.01.14.54; Tue, 07 Jul 2015 01:14:56 -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 S1756213AbbGGIOv (ORCPT + 29 others); Tue, 7 Jul 2015 04:14:51 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:35293 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752711AbbGGIOr (ORCPT ); Tue, 7 Jul 2015 04:14:47 -0400 Received: by wiga1 with SMTP id a1so249218159wig.0 for ; Tue, 07 Jul 2015 01:14:46 -0700 (PDT) X-Received: by 10.194.205.101 with SMTP id lf5mr6416042wjc.37.1436256886587; Tue, 07 Jul 2015 01:14:46 -0700 (PDT) Received: from localhost.localdomain (sju31-1-78-210-255-2.fbx.proxad.net. [78.210.255.2]) by mx.google.com with ESMTPSA id hn2sm5927100wjc.45.2015.07.07.01.14.45 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 07 Jul 2015 01:14:45 -0700 (PDT) From: Daniel Lezcano To: tglx@linutronix.de Cc: viresh.kumar@linaro.org, linux-kernel@vger.kernel.org (open list:HIGH-RESOLUTION T...) Subject: [PATCH] clockevents: Allow set-state callbacks to be optional Date: Tue, 7 Jul 2015 10:14:35 +0200 Message-Id: <1436256875-15562-1-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <559B89AC.7090802@linaro.org> References: <559B89AC.7090802@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.49 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 Its mandatory for the drivers to provide set_state_{oneshot|periodic}() (only if related modes are supported) and set_state_shutdown() callbacks today, if they are implementing the new set-state interface. But this leads to unnecessary noop callbacks for drivers which don't want to implement them. Over that, it will lead to a full function call for nothing really useful. Lets make all set-state callbacks optional. Suggested-by: Daniel Lezcano Signed-off-by: Viresh Kumar Signed-off-by: Daniel Lezcano --- kernel/time/clockevents.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index 08ccc3d..50eb107 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c @@ -120,19 +120,25 @@ static int __clockevents_switch_state(struct clock_event_device *dev, /* The clockevent device is getting replaced. Shut it down. */ case CLOCK_EVT_STATE_SHUTDOWN: - return dev->set_state_shutdown(dev); + if (dev->set_state_shutdown) + return dev->set_state_shutdown(dev); + return 0; case CLOCK_EVT_STATE_PERIODIC: /* Core internal bug */ if (!(dev->features & CLOCK_EVT_FEAT_PERIODIC)) return -ENOSYS; - return dev->set_state_periodic(dev); + if (dev->set_state_periodic) + return dev->set_state_periodic(dev); + return 0; case CLOCK_EVT_STATE_ONESHOT: /* Core internal bug */ if (!(dev->features & CLOCK_EVT_FEAT_ONESHOT)) return -ENOSYS; - return dev->set_state_oneshot(dev); + if (dev->set_state_oneshot) + return dev->set_state_oneshot(dev); + return 0; case CLOCK_EVT_STATE_ONESHOT_STOPPED: /* Core internal bug */ @@ -471,18 +477,6 @@ static int clockevents_sanity_check(struct clock_event_device *dev) if (dev->features & CLOCK_EVT_FEAT_DUMMY) return 0; - /* New state-specific callbacks */ - if (!dev->set_state_shutdown) - return -EINVAL; - - if ((dev->features & CLOCK_EVT_FEAT_PERIODIC) && - !dev->set_state_periodic) - return -EINVAL; - - if ((dev->features & CLOCK_EVT_FEAT_ONESHOT) && - !dev->set_state_oneshot) - return -EINVAL; - return 0; }