Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1837684imm; Thu, 23 Aug 2018 09:32:47 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwomECmMUPtoZNgZc4iEkRHoUz6Jay6W/XsvFQdxVp7KM5GN3dkfZJct2l8Iq2CPf0Ngp5d X-Received: by 2002:a17:902:900a:: with SMTP id a10-v6mr58994893plp.143.1535041967302; Thu, 23 Aug 2018 09:32:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535041967; cv=none; d=google.com; s=arc-20160816; b=J/eGADxvHeRqYVOylqEAmS1dULVvMsC1B1A7U4gld9ELEtDhzyyeg5THVflXHyZDWy s3TtgCvGORfbjAl+1ONtFsKzcLbKATwv6V0RT7nC9WZmvWuLLMPPL+c7A/xBiROYEZT2 chJwZPZZsgBGd4KrCq9aaaoiAIGhhZsHvd2sZe2ArzcHhzTBK/3t9Jlg1i4KbbT8ZQSn /Z2EmqOxIRBiFlOs8xfNNThf03nut998S97EL2neoudLRm8wUaNu0pj1jWE0T/Q6J+VU +oNPJ0EfGLjeqkmfLL7J0+8xmIwCS9ydNSaUl47E/e7yaMv8ikWHHVfLsjATCM+8Memw yGfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=cjWhkDH8MiBTgJvtOy9Q7hrrgJ2lQq1s6ejXkFumv6E=; b=R8TDsAo3gTyZdJ4k0mObUK1yg/FgJDI6YEK5b7BhHxubU8N+mHHo/ckn3lMZ7V1Aou ttss2AYTL35iiMcYy5B79wW0rtwoVbuu0eO6jG/K5jSVsiN1+JxFruXuq1bPrwbpg/hf 8GzuD1VrzfMJG5w5AYq7AhMRl/XCtq+5DrVxpqwna8Ek31EeXqrtN0IRJeGe5D9hWFij lEG745vbsDteic4TzivCauDoSOLm+PkkyiS2u90BoHwWw0E+RYeuhRLbjHl1QSdBg/qV CI5KNS4eJmjBi27Mxm7dfC/OTsNrFNLZ2m2E2Mtnh2NVLoJTnDmVsQTPDfH1d0f+t2Jw csSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=YfN99YxN; 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=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x7-v6si4140608pgi.465.2018.08.23.09.32.31; Thu, 23 Aug 2018 09:32:47 -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=@ti.com header.s=ti-com-17Q1 header.b=YfN99YxN; 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=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727524AbeHWTzr (ORCPT + 99 others); Thu, 23 Aug 2018 15:55:47 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:56364 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726238AbeHWTzr (ORCPT ); Thu, 23 Aug 2018 15:55:47 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id w7NGOxXY036886; Thu, 23 Aug 2018 11:24:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1535041499; bh=cjWhkDH8MiBTgJvtOy9Q7hrrgJ2lQq1s6ejXkFumv6E=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=YfN99YxNs2NiFOV78SJ/qiIiOnAUMNHjbbUPvgP0N6odCUSrJZATgHUKjll5QfW4Y XuwHL1XJUTatEX9DlUNVaxR7DdRdMNo5H8wPIhNxZITDYjVyZQ/MwXq9kDBrilxn1x aPlgb3UdHFQN6+jCAU/7/Fi/13Y2OTNjJ8MwHf2Q= Received: from DLEE104.ent.ti.com (dlee104.ent.ti.com [157.170.170.34]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w7NGOx3U031391; Thu, 23 Aug 2018 11:24:59 -0500 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Thu, 23 Aug 2018 11:24:59 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Thu, 23 Aug 2018 11:24:59 -0500 Received: from [128.247.59.203] (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w7NGOwO3006470; Thu, 23 Aug 2018 11:24:58 -0500 Subject: Re: [PATCH] cpufreq: ti-cpufreq: Only register platform_device when supported To: Johan Hovold CC: Viresh Kumar , "Rafael J . Wysocki" , Nishanth Menon , , Tony Lindgren , Keerthy J , , Tero Kristo , Stephen Boyd , , References: <20180823024432.7000-1-d-gerlach@ti.com> <20180823075058.GR14967@localhost> From: Dave Gerlach Message-ID: <27e25e06-2721-87dd-3e9b-8d91f6c49449@ti.com> Date: Thu, 23 Aug 2018 11:24:58 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180823075058.GR14967@localhost> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/23/2018 02:50 AM, Johan Hovold wrote: > On Wed, Aug 22, 2018 at 09:44:32PM -0500, Dave Gerlach wrote: >> Currently the ti-cpufreq driver blindly registers a 'ti-cpufreq' to force >> the driver to probe on any platforms where the driver is built in. >> However, this should only happen on platforms that actually can make use >> of the driver. There is already functionality in place to match the >> SoC compatible so let's factor this out into a separate call and >> make sure we find a match before creating the ti-cpufreq driver device. >> >> Signed-off-by: Dave Gerlach >> --- >> drivers/cpufreq/ti-cpufreq.c | 25 ++++++++++++++++++++----- >> 1 file changed, 20 insertions(+), 5 deletions(-) >> >> diff --git a/drivers/cpufreq/ti-cpufreq.c b/drivers/cpufreq/ti-cpufreq.c >> index 3f0e2a14895a..541fdcf17b57 100644 >> --- a/drivers/cpufreq/ti-cpufreq.c >> +++ b/drivers/cpufreq/ti-cpufreq.c >> @@ -201,19 +201,31 @@ static const struct of_device_id ti_cpufreq_of_match[] = { >> {}, >> }; >> >> +static const struct of_device_id *ti_cpufreq_match_node(void) >> +{ >> + struct device_node *np; >> + const struct of_device_id *match; >> + >> + np = of_find_node_by_path("/"); >> + match = of_match_node(ti_cpufreq_of_match, np); >> + of_node_put(np); >> + >> + if (!match) >> + return NULL; >> + else >> + return match; > > Shouldn't this just be "return match"? Whoops, yes that's an entirely pointless check I added. > >> +} >> + >> static int ti_cpufreq_probe(struct platform_device *pdev) >> { >> u32 version[VERSION_COUNT]; >> - struct device_node *np; >> const struct of_device_id *match; >> struct opp_table *ti_opp_table; >> struct ti_cpufreq_data *opp_data; >> const char * const reg_names[] = {"vdd", "vbb"}; >> int ret; >> >> - np = of_find_node_by_path("/"); >> - match = of_match_node(ti_cpufreq_of_match, np); >> - of_node_put(np); >> + match = ti_cpufreq_match_node(); >> if (!match) >> return -ENODEV; >> >> @@ -290,7 +302,10 @@ static int ti_cpufreq_probe(struct platform_device *pdev) >> >> static int ti_cpufreq_init(void) >> { >> - platform_device_register_simple("ti-cpufreq", -1, NULL, 0); >> + /* Check to ensure we are on a compatible platform */ >> + if (ti_cpufreq_match_node()) >> + platform_device_register_simple("ti-cpufreq", -1, NULL, 0); >> + >> return 0; >> } >> module_init(ti_cpufreq_init); > > With that fixed, feel free to add: > > Reviewed-by: Johan Hovold Thanks for the review I will update and resend. Regards, Dave > > Johan >