linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeremy McNicoll <jmcnicol-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	mail-LJ92rlH3Dns@public.gmane.org
Cc: Jeremy McNicoll
	<jeremymc-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	andy.gross-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	sboyd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
	arnd-r2nGTMty4D4@public.gmane.org,
	bjorn.andersson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	michael.scott-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org
Subject: Re: [PATCH 3/6] msm8994 clocks: global clock support for msm8994 SOC.
Date: Thu, 3 Nov 2016 16:43:52 -0700	[thread overview]
Message-ID: <20161103234351.GA15102@mini-rhel.redhat.com> (raw)
In-Reply-To: <20161103224234.GB30414@remoulade>

On Thu, Nov 03, 2016 at 10:42:34PM +0000, Mark Rutland wrote:
> On Tue, Oct 25, 2016 at 04:16:58AM -0700, Jeremy McNicoll wrote:
> > +static const struct qcom_cc_desc gcc_msm8994_desc = {
> > +	.config = &gcc_msm8994_regmap_config,
> > +	.clks = gcc_msm8994_clocks,
> > +	.num_clks = ARRAY_SIZE(gcc_msm8994_clocks),
> > +	.resets = NULL,
> > +	.num_resets = 0,
> > +	.gdscs = NULL,
> > +	.num_gdscs = 0,
> > +};
> > +
> > +static const struct of_device_id gcc_msm8994_match_table[] = {
> > +	{ .compatible = "qcom,gcc-8994" },
> > +	{ .compatible = "qcom,gcc-8994v2" },
> > +	{}
> > +}
> > +
> > +MODULE_DEVICE_TABLE(of, gcc_msm8994_match_table);
> > +
> > +static int gcc_msm8994_probe(struct platform_device *pdev)
> > +{
> > +	struct device *dev = &pdev->dev;
> > +	struct clk *clk;
> > +	const char *compat = NULL;
> > +	int compatlen = 0;
> > +	bool is_v2 = false;
> > +
> > +	clk = devm_clk_register(dev, &xo.hw);
> > +	if (IS_ERR(clk))
> > +		return PTR_ERR(clk);
> > +
> > +	compat = of_get_property(pdev->dev.of_node, "compatible", &compatlen);
> > +	if (!compat || (compatlen <= 0))
> > +		return -EINVAL;
> 
> It is almost never correct to use of_get_property(). Please avoid it.
>

Hi Bastian, 

Mark is basically suggesting that instead of using of_get_property() you
should be using  something like of_device_compatible_match, or 
of_device_is_compatible.   This should simplify the code a little bit
too. 

Unless I am misunderstanding Mark's comment.

-jeremy


> > +
> > +	is_v2 = !strcmp(compat, "qcom,gcc-8994v2");
> > +	if (is_v2)
> > +		msm_gcc_8994v2_fixup();
> 
> Either put some data in the of_device_id tables, and use that to determine what
> to do here, or use of_device_is_compatible() or of_match_node() to check the
> string.
> 
> Thanks,
> Mark.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2016-11-03 23:43 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-25 11:16 [PATCH 0/6] msm8992/msm8994: Google Nexus 5X/6P initial board support Jeremy McNicoll
     [not found] ` <1477394221-30963-1-git-send-email-jeremymc-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-10-25 11:16   ` [PATCH 1/6] arm64: dts: msm8992 SoC and LG Bullhead (Nexus 5X) support Jeremy McNicoll
     [not found]     ` <1477394221-30963-2-git-send-email-jeremymc-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-10-28  0:11       ` Stephen Boyd
2016-11-02 23:59         ` Jeremy McNicoll
2016-11-03 22:38     ` Mark Rutland
2016-10-25 11:16   ` [PATCH 2/6] dt-bindings: qcom: clocks: Add msm8994 clock bindings Jeremy McNicoll
2016-10-28  0:08     ` Stephen Boyd
     [not found]       ` <20161028000811.GI26139-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2016-11-03  0:01         ` Jeremy McNicoll
2016-10-25 11:16   ` [PATCH 3/6] msm8994 clocks: global clock support for msm8994 SOC Jeremy McNicoll
2016-10-28  0:18     ` Stephen Boyd
2016-11-04  0:37       ` Jeremy McNicoll
     [not found]     ` <1477394221-30963-4-git-send-email-jeremymc-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-11-03 22:42       ` Mark Rutland
2016-11-03 23:43         ` Jeremy McNicoll [this message]
2016-11-04  9:12           ` Bastian Köcher
2016-10-27  0:56   ` [PATCH 0/6] msm8992/msm8994: Google Nexus 5X/6P initial board support Jeremy McNicoll
2016-10-25 11:16 ` [PATCH 4/6] dt-bindings: qcom: Add msm899(2/4) bindings Jeremy McNicoll
     [not found]   ` <1477394221-30963-5-git-send-email-jeremymc-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-10-31  1:43     ` Rob Herring
2016-10-25 11:17 ` [PATCH 5/6] arm64: dts: msm8994 SoC and Huawei Angler (Nexus 6P) support Jeremy McNicoll
2016-10-27  5:33   ` Michael Scott
2016-10-28  0:06   ` Stephen Boyd
2016-10-28  0:54     ` Jeremy McNicoll
2016-11-03 22:32       ` Andy Gross
2016-11-03 22:42         ` Stephen Boyd
     [not found]           ` <9e0555fa-d689-e26e-feba-9daa815eb1c5-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2016-11-03 22:44             ` Andy Gross
2016-11-04 20:12               ` Stephen Boyd
2016-11-03 23:04           ` Bjorn Andersson
2016-11-04  0:20             ` Jeremy McNicoll
     [not found]               ` <20161104002005.GA15578-IfqqoHeSVXkD/aak0adQqVaTQe2KTcn/@public.gmane.org>
2016-11-04  1:57                 ` Bjorn Andersson
2016-11-04  5:18                   ` Jeremy McNicoll
2016-11-03 22:44   ` Mark Rutland
2016-10-25 11:17 ` [PATCH 6/6] arm64: configs: enable configs for msm899(2/4) basic support Jeremy McNicoll

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161103234351.GA15102@mini-rhel.redhat.com \
    --to=jmcnicol-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=andy.gross-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=arnd-r2nGTMty4D4@public.gmane.org \
    --cc=bjorn.andersson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=jeremymc-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mail-LJ92rlH3Dns@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=michael.scott-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=sboyd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).