From patchwork Thu Nov 26 12:40:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 11933449 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84C85C56202 for ; Thu, 26 Nov 2020 12:44:55 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 205AA2173E for ; Thu, 26 Nov 2020 12:44:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="psNHmCJU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 205AA2173E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=M8Y5lFhXKsvYIld2RAABmZh0YZ3ejAcY8yOrJYPbORU=; b=psNHmCJUvTuSfl4EFjXerA4iWj hiFdxIFwUyvm0TaQXW+PPOoBlXIJsyYs5jXm2EmsJd/83PHx96uOvG1Q9uaLRbVjWtckBAzcWUqAS CW+5Cb0I08aOUNBZ5jLsXRc2RU2nKmiTXX2gK91s1MarqU4No0iEySMazpRkYMnOrI+vp2mDGca76 eqK7p5mpR+x6syIWstlZFcVbFy3RNG+S27Z68FR9L+pYmmQuSb+ZoULgk+JRn6uhNGqa9AanDa8M7 W1/cu8jtv7XRunNdBnZC1tlIlhDLlraQmSsh8pu3WOMYiTX7XL1mv70rJH+cLQ3DSb00OjtdM79Sm 2sWIuM5Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kiGbn-0002ii-B7; Thu, 26 Nov 2020 12:42:48 +0000 Received: from inva020.nxp.com ([92.121.34.13]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kiGaq-0002RT-Rv for linux-arm-kernel@lists.infradead.org; Thu, 26 Nov 2020 12:41:57 +0000 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id D2CBF1A0BA9; Thu, 26 Nov 2020 13:41:45 +0100 (CET) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id C46E41A099E; Thu, 26 Nov 2020 13:41:45 +0100 (CET) Received: from fsr-ub1664-175.ea.freescale.net (fsr-ub1664-175.ea.freescale.net [10.171.82.40]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id 481BA2026B; Thu, 26 Nov 2020 13:41:45 +0100 (CET) From: Abel Vesa To: Stephen Boyd , Sascha Hauer , Peng Fan , Fabio Estevam , Anson Huang , Dong Aisheng , Jacky Bai Subject: [PATCH v2 3/5] clk: composite: Allow gate ops with only .is_enabled op Date: Thu, 26 Nov 2020 14:40:07 +0200 Message-Id: <1606394409-12755-4-git-send-email-abel.vesa@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1606394409-12755-1-git-send-email-abel.vesa@nxp.com> References: <1606394409-12755-1-git-send-email-abel.vesa@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201126_074149_339293_6726C087 X-CRM114-Status: GOOD ( 13.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linux Kernel Mailing List , Abel Vesa , NXP Linux Team , linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Some composite clocks might be enabled/disabled from outside the clock framework. So allow the composite clock register successfully with only the .is_enabled op for gate ops. Signed-off-by: Abel Vesa --- drivers/clk/clk-composite.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c index 2ddb54f..29f00a9 100644 --- a/drivers/clk/clk-composite.c +++ b/drivers/clk/clk-composite.c @@ -278,17 +278,18 @@ static struct clk_hw *__clk_hw_register_composite(struct device *dev, } if (gate_hw && gate_ops) { - if (!gate_ops->is_enabled || !gate_ops->enable || - !gate_ops->disable) { - hw = ERR_PTR(-EINVAL); - goto err; - } - composite->gate_hw = gate_hw; composite->gate_ops = gate_ops; - clk_composite_ops->is_enabled = clk_composite_is_enabled; - clk_composite_ops->enable = clk_composite_enable; - clk_composite_ops->disable = clk_composite_disable; + if (gate_ops->is_enabled) { + clk_composite_ops->is_enabled = clk_composite_is_enabled; + } else { + hw = ERR_PTR(-EINVAL); + goto err; + } + if (gate_ops->enable) + clk_composite_ops->enable = clk_composite_enable; + if (gate_ops->disable) + clk_composite_ops->disable = clk_composite_disable; } init.ops = clk_composite_ops;