From patchwork Thu Jan 21 11:17:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12035651 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.9 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 C6CD8C433E0 for ; Thu, 21 Jan 2021 11:22:35 +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 6B45E238E1 for ; Thu, 21 Jan 2021 11:22:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6B45E238E1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org 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:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version: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=W7xPwkWjVGAOSvlJGqZ++GVxv8+/6+JczdrmIEi/yQ0=; b=G25Nj9LY7BQLuM7vnm2cWpDAh tNUN50gTJgHTCZq0F8bAZYAOJHuPgbAvu9IE3LBWVomJKFq/5REgg9buQtemS2yrlOxF5oAPrm1xs 6Km5auNUC93RHvevtFdKTNeiZLZPUFQD4fvtvS2usBVBLxyOBZM5TYfcfw4c3/Yxij2q7PSKVl4Px PGncVoXXjN24FKKvqfqC+KNqHrRpVz4tiqO7OUx/MkLv39mCjI+YyMVOOca5j1RXEAdcEmbSl4H4L mjEKe5FD3c8C4pC4xP4tll/tVQ/rrE2PNKmiDqDSvPacumd362WJQwAc3I7d+NpONoFn7i8HK1WD6 31LcMsuKw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2Y0C-0005H3-Ej; Thu, 21 Jan 2021 11:19:48 +0000 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2XzW-00051s-7I for linux-arm-kernel@lists.infradead.org; Thu, 21 Jan 2021 11:19:07 +0000 Received: by mail-pg1-x535.google.com with SMTP id q7so1157610pgm.5 for ; Thu, 21 Jan 2021 03:19:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CYbzCFVCi3fEgZJohV5hqu59RAY6Et7w7QbAOId9XrY=; b=lMZb9UiNz5IoKRjlVfTRbe5AbsFjgYug6+3rBQBORQMTS2UMUtLozNugVAnuXzVu8y EYEMj8NSmofsA6xXlvjPMTlIYrPcpAfABG+1v1OmZz7r9X5YWSkh16Cxrsokim45C5sJ tUjvk+6bmsgYppq/z+2OjYh9iv2r6nSz0qXHsQ+GHP9yy0kYl4kID2DhPeeyCjK4vjlb Icdu8T9ko+aqp872q9wMRgxdPOSbnY8xrtxNYrFWzjrxlAklUobL0Gl0pA9p1ggkdKGE zQrS52KKBl/kFz3wQD/xWCCxYLYBNGWJvjbTLdPsvcwnxS60d3h0uiITwge2NEyNxN4s 6jvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CYbzCFVCi3fEgZJohV5hqu59RAY6Et7w7QbAOId9XrY=; b=SxM0yeSuvkLKAnM244OBMduY0iZCaDvTAmKdGqk4/wAPuNFscJoUCLAIrSg7fXwcFB QKwAS4tqPS3wbZ1kYAU/htRalYXnROzt2Rae7ZtMDLuggV+6JCTwTg79906T+7Jlri7G 3hUt0wVFTZzpdMySEhqWB7X5lmtXbr24D3T2yYn42uymJ4nuwjL3tljZovFhfgAnGV6A +PEpEIBGhBhHu8fOi9ROzYhMBEGNGGk6oF5/Obp7ME/PnRgN4lWIBBjJROL1ykjVfMgP GjuBHFLcBo8dADTkH5yR4Y+21cfoRB0eDBzX3LrzUwgPHoZ2rcAfhvqGOP473lCgC1OB u6sQ== X-Gm-Message-State: AOAM533NYTLBqxr2OCw+aklQir9USiDtsD4s/0gAtYK9EEijcW7ucaJ7 ZeGLupOGUumnH95mC/jHLt4l6Q== X-Google-Smtp-Source: ABdhPJyEgpWlB1DXX6+xj9reAgkGRUJ/18nmuXm2a77WwY0rHW9XG4b7O5gR3XoNa+V5ylK4UmmqzA== X-Received: by 2002:a63:d42:: with SMTP id 2mr8226764pgn.236.1611227943683; Thu, 21 Jan 2021 03:19:03 -0800 (PST) Received: from localhost ([122.172.59.240]) by smtp.gmail.com with ESMTPSA id w21sm4497087pff.220.2021.01.21.03.19.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Jan 2021 03:19:03 -0800 (PST) From: Viresh Kumar To: Dmitry Osipenko , Viresh Kumar , Nishanth Menon , Stephen Boyd Subject: [PATCH 07/13] opp: Allow _generic_set_opp_clk_only() to work for non-freq devices Date: Thu, 21 Jan 2021 16:47:47 +0530 Message-Id: <1585f6c21ea8aee64fe4da0bf72b36ea4d74a779.1611227342.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.25.0.rc1.19.g042ed3e048af In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210121_061906_323382_4634DCF9 X-CRM114-Status: GOOD ( 15.42 ) 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: Vincent Guittot , linux-pm@vger.kernel.org, Viresh Kumar , Rafael Wysocki , linux-kernel@vger.kernel.org, Sibi Sankar , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In order to avoid conditional statements at the caller site, this patch updates _generic_set_opp_clk_only() to work for devices that don't change frequency (like power domains, etc.). Return 0 if the clk pointer passed to this routine is not valid. Signed-off-by: Viresh Kumar --- drivers/opp/core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index a96ffd9051b1..6b09d468d37a 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -726,6 +726,10 @@ static inline int _generic_set_opp_clk_only(struct device *dev, struct clk *clk, { int ret; + /* We may reach here for devices which don't change frequency */ + if (unlikely(!clk)) + return 0; + ret = clk_set_rate(clk, freq); if (ret) { dev_err(dev, "%s: failed to set clock rate: %d\n", __func__,