From patchwork Fri Apr 22 02:32:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 8905181 X-Patchwork-Delegate: sboyd@codeaurora.org Return-Path: X-Original-To: patchwork-linux-clk@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4D0D6BF29F for ; Fri, 22 Apr 2016 02:33:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4F0482026F for ; Fri, 22 Apr 2016 02:33:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 742C120160 for ; Fri, 22 Apr 2016 02:32:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753420AbcDVCcz (ORCPT ); Thu, 21 Apr 2016 22:32:55 -0400 Received: from mail-pf0-f177.google.com ([209.85.192.177]:35114 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753418AbcDVCcz (ORCPT ); Thu, 21 Apr 2016 22:32:55 -0400 Received: by mail-pf0-f177.google.com with SMTP id n1so36195114pfn.2 for ; Thu, 21 Apr 2016 19:32:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=vrRz1V0n9LwQW5hGkYlYMl92Aun9HFdZMzAHSN+7hBY=; b=FVjaRKw+Rd2is900P9Js+m4zlp+1DL5jbTOxttocSNzz+mpdf4UfLfPZpbvJhJvUCJ sL/h+1bSed9X5xvvg2xXGDSK9IUobBdcDgRx3ll06bA9u/SCQGLJRH4FZCUM6DLcMkXk Kl+KoM24DZt+3eeG+8DLfw8phSaS40OAO2KmA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=vrRz1V0n9LwQW5hGkYlYMl92Aun9HFdZMzAHSN+7hBY=; b=J7fe84M/VG6mlJGXt7+K8Kv9AMq+VfM2UC9mP2sZykgglY5HXvVaiB37lQH5soYKDj z3+PtDHSwKEn7gAcTK4nRiquxsb+odzC15XKt5OUAU99vIDQR2RnkOKDkWXiZz6VFqzC M3Rh/VuPewBepnejjL7RnPSaNYh2M9PyZOE+c0mBI0znsqRPcberZDnDt25YBpv2GwGM Iqmogw5/hwmvwh7laLsJVPbDwDaQK/1yaXlfxkx3Dqx8gNTc/qD1hfFroeNjupOM+p70 aQkbYDptsSNOv/H61qAP41+82G1NDjCypFoLw4hwCXBtuNQC3KBv93ad1OvSWmK68G71 h78w== X-Gm-Message-State: AOPr4FUrRcueHd+UYdGPzHeKZaphnGRShZL6vgeGIrotGX+h4hYq4tXWDTjXmiVv5KVL3mta X-Received: by 10.98.1.197 with SMTP id 188mr25221370pfb.8.1461292369223; Thu, 21 Apr 2016 19:32:49 -0700 (PDT) Received: from localhost.localdomain ([45.56.152.22]) by smtp.gmail.com with ESMTPSA id 19sm3948740pfu.83.2016.04.21.19.32.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Apr 2016 19:32:48 -0700 (PDT) From: Jun Nie To: sboyd@codeaurora.org, mturquette@baylibre.com, linux-clk@vger.kernel.org Cc: Jun Nie Subject: [PATCH] clk: Add is_enabled sanity check Date: Fri, 22 Apr 2016 10:32:36 +0800 Message-Id: <1461292356-26043-1-git-send-email-jun.nie@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If .enable and .disable is implemented, we must implement .is_enabled per document. Otherwise, clk_disable_unused_subtree will not disable the unused clock if the .is_enabled is not implemented, unecessary power consumption happens on the clock as a result. Signed-off-by: Jun Nie --- drivers/clk/clk.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index f13c3f4..5e63bee 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -2526,6 +2526,10 @@ struct clk *clk_register(struct device *dev, struct clk_hw *hw) int i, ret; struct clk_core *core; + if (hw->init->ops->enable && !hw->init->ops->is_enabled) + pr_warn("Warning: %s %s must implement .is_enabled\n", + __func__, hw->init->name); + core = kzalloc(sizeof(*core), GFP_KERNEL); if (!core) { ret = -ENOMEM;