From patchwork Tue Jun 9 13:13:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 211849 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=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, 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 0A0DFC433DF for ; Tue, 9 Jun 2020 13:15:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D34AA20734 for ; Tue, 9 Jun 2020 13:15:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aC4glVDh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729047AbgFINPJ (ORCPT ); Tue, 9 Jun 2020 09:15:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729318AbgFINPA (ORCPT ); Tue, 9 Jun 2020 09:15:00 -0400 Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0C04C05BD1E; Tue, 9 Jun 2020 06:14:59 -0700 (PDT) Received: by mail-lj1-x241.google.com with SMTP id z9so24953565ljh.13; Tue, 09 Jun 2020 06:14:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IaLwBgEJHAnRll2My7iiWFVAnwuWkHTJFbXmtwzd9MY=; b=aC4glVDhDS6ajEjF584IuzsxAMYQt4toyxqZK52jEcvULo8RhpSOxNphdBVi8P4OLv DLLzp/QJx/rbgkC6qG1/ST9kv+T/ES4KUlqW2rPtOO0Wph6Hs0Z1qgNv0uIgYfPZyEQI llyWxvYfnUXdL6kWcoCuZ/oZ4mbaCS7kAtLPhwpKjUcOfRUx/4ITmOaJcOV6P2sDgKD1 iU/pzZsNOp5pZLqWuj4uY2KzElystLbeKXihgwOOzUnCcTr5/E5sjMPqhFPjtwPOwYxv SylCskYpcyi9T2zgRF0lQBRLmg5udBC3dmOTS4p3B+WxlFyFBszPy/gE4DMm2ero/0pK 9nlA== 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=IaLwBgEJHAnRll2My7iiWFVAnwuWkHTJFbXmtwzd9MY=; b=M3jjeQU+sdjzohaLGHLHgwV0A4cRkZ0SAV0QAAFI9AgfwE7gGhn/nY8QM3RzvB868H LDW1nvN2GX8vPNxFTbNOLjvvuAfMuWffqFtmHNLYvIou3KYGmVdarz0jpmR5N2q3IqUL z1CJCAbzxbULNRuqXSmq0lpTGRooY7Yl2cTyJR1zThLrkhvg++xWh7EC6wX4HjaZ0B3D WHE8lOYj3tme0FGAQpWIjigDSfLTKDV8qY5pVe/LuRd4P45JemojH86O+wMXMVOEGCKa FEWh1QCAXoBrbDfpC5+2hgnL5se+jGRTLoP1QEIh8pt5I3tPBbGMIikkjXHIuVUCzRg1 dRvw== X-Gm-Message-State: AOAM530jliYBkttLeXl7ZlABUJ5aL4j4fYA1TF7l2xIdinC/4QoPSgjE Wvt7JI7KCiTezNYPebAUK4s7o4cy X-Google-Smtp-Source: ABdhPJwqzjarfix9XEE4prNh4Lc0nEjZ80Nvozu6vayHIphT+WuI7ooDdLSLgKJLy9OUPp/ATKnKnA== X-Received: by 2002:a2e:b4b3:: with SMTP id q19mr13086844ljm.90.1591708498010; Tue, 09 Jun 2020 06:14:58 -0700 (PDT) Received: from localhost.localdomain (79-139-237-54.dynamic.spd-mgts.ru. [79.139.237.54]) by smtp.gmail.com with ESMTPSA id l22sm4323522lji.120.2020.06.09.06.14.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2020 06:14:57 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Georgi Djakov , Rob Herring , Michael Turquette , Stephen Boyd , Peter De Schrijver , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Mikko Perttunen Cc: =?utf-8?b?QXJ0dXIgxZp3aWdvxYQ=?= , linux-tegra@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org Subject: [PATCH v4 27/37] interconnect: Relax requirement in of_icc_get_from_provider() Date: Tue, 9 Jun 2020 16:13:54 +0300 Message-Id: <20200609131404.17523-28-digetx@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200609131404.17523-1-digetx@gmail.com> References: <20200609131404.17523-1-digetx@gmail.com> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Artur Świgoń This patch relaxes the condition in of_icc_get_from_provider() so that it is no longer required to set #interconnect-cells = <1> in the DT. In case of the devfreq driver for exynos-bus, #interconnect-cells is always zero. Signed-off-by: Artur Świgoń [digetx@gmail.com: added cells_num checking for of_icc_xlate_onecell()] Signed-off-by: Dmitry Osipenko --- drivers/interconnect/core.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c index e5f998744501..cb143421ca67 100644 --- a/drivers/interconnect/core.c +++ b/drivers/interconnect/core.c @@ -339,7 +339,7 @@ static struct icc_node *of_icc_get_from_provider(struct of_phandle_args *spec) struct icc_node *node = ERR_PTR(-EPROBE_DEFER); struct icc_provider *provider; - if (!spec || spec->args_count != 1) + if (!spec) return ERR_PTR(-EINVAL); mutex_lock(&icc_lock); @@ -967,6 +967,15 @@ EXPORT_SYMBOL_GPL(icc_nodes_remove); */ int icc_provider_add(struct icc_provider *provider) { + struct device_node *np = provider->dev->of_node; + u32 cells_num; + int err; + + err = of_property_read_u32(np, "#interconnect-cells", &cells_num); + if (WARN_ON(err)) + return err; + if (WARN_ON(provider->xlate == of_icc_xlate_onecell && cells_num != 1)) + return -EINVAL; if (WARN_ON(!provider->set)) return -EINVAL; if (WARN_ON(!provider->xlate))