Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1328230imm; Thu, 23 Aug 2018 00:52:52 -0700 (PDT) X-Google-Smtp-Source: AA+uWPw3ovoYr0fW65TPnYVP4qEPFPZ+pbyJeVxAsNj6mG+q/m6J8TBE0If5MQhtOx1yttTqSzkm X-Received: by 2002:a65:6645:: with SMTP id z5-v6mr13338578pgv.186.1535010772836; Thu, 23 Aug 2018 00:52:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535010772; cv=none; d=google.com; s=arc-20160816; b=IRUBbcPLcglqMOBHUsE5ZkGmpZZ7SfpW8d23ptu+E/9oUOsBRBGyBNRtjRazd9u5PK WfcrelZ50ZGWHcrjAqmdQBxh6hV/pAIApZ9+K42lmUu3udPaK3EKUpe7Q6cpAn4me7B0 dV3zI/rZtXvwUK/TKibroeIZyuJgPwNkBDnNUifPoMLh20IMJwRKKZEMZKA0c+QORncg AAV0XpYoOcOfbqvtcFy6TILYHqme+rQaEZ6spIl96s5erhSyULSovXTB/zzehdz8yVqY KDH5gLTaVKEsrbm0ksoHXYXytPxyL1etvHkofn/GUD62c5pEQPlRM5OK820eH6gE5Wml 01Cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=q1blHs6xvSfPEQnIkNyNzZe+1jThaz+g4aVgetf+Vjc=; b=D8GFoO3Dbr7NAZEvo3fnDG7Ru3+2iJNxFOPZh3ABf8idahy0WjfiV+FLUweOrYQj1S k1aHUFqgKHRals9ijzefjCmDPbdT2/IVl0Od1Uml5XXAHrbInyZiHDu9lVY4RUwrucrL /wyj8MP2vazElvKEgtbMbw5tYC4X0io558mNua+FUju1KGKx4MuZup00hDz/Vxw4yabW 4d1qPWvt2ZIBEzwdRV4xBPyzvjB3rtJH8ex/Vucnq8E6R6b0di/ClIgW7ntvaR0rKdDw SQe7AvFZbMAzK2VTmnm/rBpuc7jJXcozWoOtcvdauhrD+2D/YF9NgFBDUtrsX4C06poO 95iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=gag7AeaW; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a2-v6si3754676pgh.396.2018.08.23.00.52.37; Thu, 23 Aug 2018 00:52:52 -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=fail header.i=@gmail.com header.s=20161025 header.b=gag7AeaW; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727045AbeHWLTW (ORCPT + 99 others); Thu, 23 Aug 2018 07:19:22 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:45774 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726451AbeHWLTW (ORCPT ); Thu, 23 Aug 2018 07:19:22 -0400 Received: by mail-lf1-f66.google.com with SMTP id r4-v6so3345507lff.12; Thu, 23 Aug 2018 00:51:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=q1blHs6xvSfPEQnIkNyNzZe+1jThaz+g4aVgetf+Vjc=; b=gag7AeaW8aXJU0XibmPYE/i+/uu1cNq2WUrGC9ysnJpoqrefdvbAjDYxamQXqmlO8S UCJv6BXH1Lw8RCqatSkeg6wNrL5TST3a3pb17sXLPRxUO04yhLUYGlRvNoVnpXMv2w2W cnV6qtCEnf2g//X2ukEJEXdZHjc/4O/XeAKCcRvsquSdgtm5/DZYkw/wCYhbaTcaG7PU oLxyz30MoKa48x7y0RmEb3EWLB/yb3rDNFCzZqOENLm05BnUI5t36FigQDZj8Aoev+sz C1h6elqezg1N242NiSKfIgfGpnKn4Txd7e+PSIqBavUj9FXNa60WdbhGuAyg8KvnYWU/ pB3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=q1blHs6xvSfPEQnIkNyNzZe+1jThaz+g4aVgetf+Vjc=; b=lpNY2GfiMQoq9fMumZIU3gD1RinaR96F1Nc/XJDONQK4EZm8rPIGVpMs9qfV4E2dwb HtoRrawBxkWTH1S3XqIeMwEr/3XRy7yXcid0qyMwtqaCqaKv40j9ddyUMAQH/uYPQhXg v8iPuWUVG9B2g2lEOzE17zOTXs3U1c/93BljbqU6X2NfNaxMHaK0hfYXs2cIi6Nhqphi FkDJ3MBX9ulkbi0e0hRvCbARAb3ENOD4Zwme20FjbWx2lhERSM4SUlRCL2VI1r12dQN5 4rHMv7hwl/Pq9F5bHwKI+uU0qSXxeRFJSxAUCeqNVcLZWYXmLfhc+oEenxdN1WXPUR8e Ju5g== X-Gm-Message-State: AOUpUlGgqzGoHi5jC7nqaqCU4vWZnXAxCV46BV0IIqHt6Z0ZNJn4XKs0 x0kFevO+GnT8R7mb8jEPcbo= X-Received: by 2002:a19:870b:: with SMTP id j11-v6mr13417676lfd.4.1535010660242; Thu, 23 Aug 2018 00:51:00 -0700 (PDT) Received: from xi.terra (c-74bee655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.190.116]) by smtp.gmail.com with ESMTPSA id w75-v6sm714580lfk.68.2018.08.23.00.50.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Aug 2018 00:50:59 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.91) (envelope-from ) id 1fskOQ-0007FM-Rt; Thu, 23 Aug 2018 09:50:58 +0200 Date: Thu, 23 Aug 2018 09:50:58 +0200 From: Johan Hovold To: Dave Gerlach Cc: Viresh Kumar , "Rafael J . Wysocki" , Nishanth Menon , linux-pm@vger.kernel.org, Tony Lindgren , Keerthy J , linux-kernel@vger.kernel.org, Tero Kristo , Stephen Boyd , linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] cpufreq: ti-cpufreq: Only register platform_device when supported Message-ID: <20180823075058.GR14967@localhost> References: <20180823024432.7000-1-d-gerlach@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180823024432.7000-1-d-gerlach@ti.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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"? > +} > + > 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 Johan