From patchwork Fri Jun 12 08:00:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 49803 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 76105228DB for ; Fri, 12 Jun 2015 08:01:00 +0000 (UTC) Received: by lbcue7 with SMTP id ue7sf7683782lbc.3 for ; Fri, 12 Jun 2015 01:00:59 -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=cE5i5rvPlHHRFwAFpGIRMAbKELZZZd9EvQmBUJoaJlo=; b=Kvohe5RknwAH2bdj27OJPyZ8JsakYG9QjQtODOQSLpGssA+5tNuLc7CbLKkdrHrcvM XlBdpWC2cbijRLenkObJ/zpZKhgQfpR5niH2u5YgJtfMeO6gXxpcjOEstn8h7Ldqv4O0 IDOeGf3JSyXJvJbhDiZTPcmn8oDAeUwRjA56DSbFX0gbeXCl6XpVXWjtwuxbs39/zOEs sa+ViAOr4NHHkrG89pPI1UQuZ/cLjmxNwKMgrsQBki0buqXv8lc/svSBnN/rp0oYMlFc q0lMAIbXJ1ggTH26wnBGmsg/TzStZnw8CaZ/2jqAPyc2RnrpuO8inbsJWPsWhFbz9yX2 8Daw== X-Gm-Message-State: ALoCoQm16P3wd9wqKBi6FN27sFC5+VjULLyjgrc9aguEpvAC+KDbSuaA+LL12sft0P/QtUOOjD+Y X-Received: by 10.152.219.166 with SMTP id pp6mr13041231lac.1.1434096059439; Fri, 12 Jun 2015 01:00:59 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.65 with SMTP id r1ls543835lag.61.gmail; Fri, 12 Jun 2015 01:00:59 -0700 (PDT) X-Received: by 10.152.44.225 with SMTP id h1mr13817581lam.5.1434096059241; Fri, 12 Jun 2015 01:00:59 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id r1si2771677lar.2.2015.06.12.01.00.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jun 2015 01:00:59 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by labko7 with SMTP id ko7so16860498lab.2 for ; Fri, 12 Jun 2015 01:00:59 -0700 (PDT) X-Received: by 10.152.29.161 with SMTP id l1mr13754632lah.76.1434096059112; Fri, 12 Jun 2015 01:00:59 -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 hn6csp361451lbb; Fri, 12 Jun 2015 01:00:58 -0700 (PDT) X-Received: by 10.68.244.73 with SMTP id xe9mr21117112pbc.98.1434096057307; Fri, 12 Jun 2015 01:00:57 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qo6si2497711pac.151.2015.06.12.01.00.56; Fri, 12 Jun 2015 01:00:57 -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 S1754846AbbFLIAl (ORCPT + 29 others); Fri, 12 Jun 2015 04:00:41 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:35593 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754780AbbFLIAg (ORCPT ); Fri, 12 Jun 2015 04:00:36 -0400 Received: by pacyx8 with SMTP id yx8so18385190pac.2 for ; Fri, 12 Jun 2015 01:00:35 -0700 (PDT) X-Received: by 10.68.112.195 with SMTP id is3mr21440981pbb.92.1434096035714; Fri, 12 Jun 2015 01:00:35 -0700 (PDT) Received: from localhost ([122.167.70.98]) by mx.google.com with ESMTPSA id fc3sm2776146pab.16.2015.06.12.01.00.34 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 12 Jun 2015 01:00:35 -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 V2 1/7] clockevents: Allow set-state callbacks to be optional Date: Fri, 12 Jun 2015 13:30:11 +0530 Message-Id: <2e6dadb011755d94fa88482e67641c7d9dfff67d.1434095303.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.43 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: , 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 --- 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 2397b97320d8..37ba06f01818 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; }