Received: by 10.192.165.148 with SMTP id m20csp21320imm; Thu, 19 Apr 2018 15:12:49 -0700 (PDT) X-Google-Smtp-Source: AIpwx49+laQhHsPaG2P2+mJTUlydtRH+yM3Cw+Y6/oaFLnKUakmUMW067vAmtgQvhOBTOyV4WRqs X-Received: by 10.99.190.67 with SMTP id g3mr4102076pgo.53.1524175969809; Thu, 19 Apr 2018 15:12:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524175969; cv=none; d=google.com; s=arc-20160816; b=yejf2W6JVqBcYKNUulfDN47fGXPXA7FDTi4wJQa211Xs1kKHMKfdGj6qPPmGXmN823 T5VVTDPyVFBiZ9y1h/Z6TNTSklN9l0VQFt/G7TMcefD1elSWtFkKp+M50QZM5wUyWn+8 96D6Z0Un20v/7You896XYrh0Py3bjPhUs2sXgwyZc3QDNEpOx0iHLcaHqEchlWGF8xEF dHI4d4YGa/4XOqGZDlbHj7H5BkDYAxffTdWjC1cuH6OOmprFhyLhgl73fEbHAjYv84Pt s6XVPcj8CUkeAY8zrsqP9lnacKqL+kvby3JLM69wqSJOwt8Un/d4M+hcf24/vY+s4zWd 0HwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=/tUlgjRe2yYMaU/KwScqPRCpwujWH1JTCWlbxVtXjl4=; b=UXOrJ70TMhZvy0YBDg4cKYWHN2dzRPCCaHLbKQCOSP8LyekUUtuje3T/aYNRCJjgD8 yRU4d1tQLTvKst15Dx4lrebYLRFE+w+dMCTdwtheFMWPrOMm57mrj0a37+f/550R2EGd nanFatghZYdCjZQhaFuU+NevZZ0/Lar2oxoAhwCxwuMMIXMfuPYUGm09X0t2lyliHmjr ZssyOZZpeKFLEGgTd8RfbGInJ2IDLPCQZxqwxZ/ZZiOIMubgmInxLtR1N/Nrc7cp7kWG rFK2KGbnJah8xX4eabfbpu//xZRmjEpJMPH12wBn6yoZKszVFhk8cWOK3BgyUbuutx+y rDEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=Ql48ryct; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w124si4049767pfb.12.2018.04.19.15.12.12; Thu, 19 Apr 2018 15:12:49 -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; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=Ql48ryct; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753599AbeDSWKs (ORCPT + 99 others); Thu, 19 Apr 2018 18:10:48 -0400 Received: from mail-qt0-f193.google.com ([209.85.216.193]:46031 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753560AbeDSWKr (ORCPT ); Thu, 19 Apr 2018 18:10:47 -0400 Received: by mail-qt0-f193.google.com with SMTP id b13-v6so7535631qtp.12 for ; Thu, 19 Apr 2018 15:10:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=/tUlgjRe2yYMaU/KwScqPRCpwujWH1JTCWlbxVtXjl4=; b=Ql48rycthfdAglAXAurUx8h97B8JIALtiHLvT0zVX/DvlVV+2+2yNDNFzAcJPqUmc1 IaEvdOZ83DzdOaYOXrLjww14lLh4jdvTSjBujsal0nRho8P63XTNYeFSEUQoYydrpaHI vId6Hyi+J+sbJrgV9zS2YDZecyaDOJRbK46p4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=/tUlgjRe2yYMaU/KwScqPRCpwujWH1JTCWlbxVtXjl4=; b=meI0qqGXwAojcAZNE3sApuadf1Qxx/6hSMUTS1bzbtqCE/dbV4vYeNHDzKwd2yaH0v 4RvgszcslRDHkQfTTndIi2wCbj1bVYtctc/tKlbVt+/o2YpDWxe9kgK//lBW/g8IYfgs ZL4+/4TUaWyyauQ4qPfQxzkb1PenTHei+0uKJ0KWr8VziNUjE2pD7G+wdkQZ8Ph6m5Rv 5mxCN6FHbv0dni8bloWbxk46tVlSEaQ9as8T8s62lNGd13Ids7zTFxCeNMi6SFwh9lHp 2Lq67nIDfIIL12KO8XGcecIFtR/bp5aq+eKNZyEs4vsYbOoyEu7TanP74Vgg6dX4XD3w YAiQ== X-Gm-Message-State: ALQs6tBAFnIZt3aJDDODE7UUDDm4cyMdAWzJyb9xpbrXN1H5sYlaGlgm aKrCVGwJfV5N0DnUVipWjaLneQH3jh628aUe/iViOg== X-Received: by 2002:ac8:710b:: with SMTP id z11-v6mr6503067qto.112.1524175846386; Thu, 19 Apr 2018 15:10:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.200.22.3 with HTTP; Thu, 19 Apr 2018 15:10:45 -0700 (PDT) In-Reply-To: References: <20180418155643.36464-1-code@mmayer.net> <20180418155643.36464-3-code@mmayer.net> From: Markus Mayer Date: Thu, 19 Apr 2018 15:10:45 -0700 Message-ID: Subject: Re: [PATCH 2/2] cpufreq: brcmstb-avs-cpufreq: prefer SCMI cpufreq if supported To: Florian Fainelli Cc: Viresh Kumar , "Rafael J. Wysocki" , Brian Norris , Gregory Fong , Jim Quinlan , Broadcom Kernel List , Power Management List , ARM Kernel List , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18 April 2018 at 09:37, Florian Fainelli wrote: > On 04/18/2018 08:56 AM, Markus Mayer wrote: >> From: Jim Quinlan >> >> If the SCMI cpufreq driver is supported, we bail, so that the new >> approach can be used. >> >> Signed-off-by: Jim Quinlan >> Signed-off-by: Markus Mayer >> --- >> drivers/cpufreq/brcmstb-avs-cpufreq.c | 16 ++++++++++++++++ >> 1 file changed, 16 insertions(+) >> >> diff --git a/drivers/cpufreq/brcmstb-avs-cpufreq.c b/drivers/cpufreq/brcmstb-avs-cpufreq.c >> index b07559b9ed99..b4861a730162 100644 >> --- a/drivers/cpufreq/brcmstb-avs-cpufreq.c >> +++ b/drivers/cpufreq/brcmstb-avs-cpufreq.c >> @@ -164,6 +164,8 @@ >> #define BRCM_AVS_CPU_INTR "brcm,avs-cpu-l2-intr" >> #define BRCM_AVS_HOST_INTR "sw_intr" >> >> +#define ARM_SCMI_COMPAT "arm,scmi" >> + >> struct pmap { >> unsigned int mode; >> unsigned int p1; >> @@ -511,6 +513,20 @@ static int brcm_avs_prepare_init(struct platform_device *pdev) >> struct device *dev; >> int host_irq, ret; >> >> + /* >> + * If the SCMI cpufreq driver is supported, we bail, so that the more >> + * modern approach can be used. >> + */ >> + if (IS_ENABLED(CONFIG_ARM_SCMI_PROTOCOL)) { >> + struct device_node *np; >> + >> + np = of_find_compatible_node(NULL, NULL, ARM_SCMI_COMPAT); >> + if (np) { >> + of_node_put(np); >> + return -ENXIO; >> + } > > We would probably want to make sure that the node is also enabled (that > is, does not have a status = "disabled" property) otherwise the check > can be defeated. Something like: > > if (np && of_device_is_available(np)) Would we want something like this instead? if (np) { bool bail_early = (of_device_is_available(np) > 0); of_node_put(np); if (bail_early) return -ENXIO; } To ensure of_node_put() is called? > should be good for that. > > Thanks! > -- > Florian