From patchwork Thu Aug 23 02:44:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Gerlach X-Patchwork-Id: 10573351 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 67F0A139B for ; Thu, 23 Aug 2018 02:45:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 56B002AFF0 for ; Thu, 23 Aug 2018 02:45:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4AB232B951; Thu, 23 Aug 2018 02:45:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D35AA2AFF0 for ; Thu, 23 Aug 2018 02:45:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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:In-Reply-To:References: List-Owner; bh=Cs2NT0Akumb9JJHmJ31kSxuNIJ7Nb1Ua8CY0usvAx38=; b=UcmTNJFx9HUVXK xUhTPpdIasn2jgwNBi/DwRjTJRyW9QRSUb+yKUK24hwiQEO24XG8un53833wC9ijvIjVghzZXHrPg yPqAYmvTu+76nUhYjUzNW4w9AjfF2R+OA/1iNk6GasTMZX5bblcc3tN2cNhj3iv34LEq+Czi++dAh /gNkuExXfZOcD15iS1InKvSilQACmbRYVyaCADyNUcmaEnbI2l+C1g6kNldwWI7QWcFuoLK4FBC6/ c02HH+rYqjCJMzASWwZCubl8kNHsBCtXAZrfK03sgGC1pU7ARa8CBZ9K8YSvEVSRKV/9sLfGssqZp acuUziXVT4+KN6r+Hmxw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fsfcN-0001Pc-Nd; Thu, 23 Aug 2018 02:45:03 +0000 Received: from fllv0016.ext.ti.com ([198.47.19.142]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fsfcK-00010g-MY for linux-arm-kernel@lists.infradead.org; Thu, 23 Aug 2018 02:45:02 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id w7N2ijqY041409; Wed, 22 Aug 2018 21:44:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1534992285; bh=sOzNKhzPEYKnz5ebbYX8WGhMDtsj/JOWLzGnU9uAsCw=; h=From:To:CC:Subject:Date; b=aotpEkTiwPKY08EjoJA7HbhkRDoDz2RXosM9TXS+bzL5dpDSpvQOc7oGNM44ZZ2x+ W3Y+K1y44Hw7Vbki1U4jlvfjhzLUyuHH37UCxMdPcg0YvWscUNktTtanlEl7oHTQFZ ocnectyvH2Sk0ZK197EE7zURRaPf1Wn/ED1HcxWM= Received: from DLEE101.ent.ti.com (dlee101.ent.ti.com [157.170.170.31]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w7N2ij12006128; Wed, 22 Aug 2018 21:44:45 -0500 Received: from DLEE103.ent.ti.com (157.170.170.33) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Wed, 22 Aug 2018 21:44:45 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Wed, 22 Aug 2018 21:44:45 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w7N2ij9e011750; Wed, 22 Aug 2018 21:44:45 -0500 Received: from localhost (uda0274052.dhcp.ti.com [128.247.59.203]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id w7N2iix06328; Wed, 22 Aug 2018 21:44:44 -0500 (CDT) From: Dave Gerlach To: Viresh Kumar , "Rafael J . Wysocki" Subject: [PATCH] cpufreq: ti-cpufreq: Only register platform_device when supported Date: Wed, 22 Aug 2018 21:44:32 -0500 Message-ID: <20180823024432.7000-1-d-gerlach@ti.com> X-Mailer: git-send-email 2.16.1 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180822_194500_865974_EFD88970 X-CRM114-Status: GOOD ( 16.69 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nishanth Menon , linux-pm@vger.kernel.org, Tony Lindgren , Keerthy J , Dave Gerlach , linux-kernel@vger.kernel.org, Tero Kristo , Stephen Boyd , linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Johan Hovold --- 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; +} + 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);