public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: honghui.zhang@mediatek.com (Honghui Zhang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] memory: mtk-smi: Use of_device_get_match_data helper
Date: Wed, 26 Jul 2017 20:35:27 +0800	[thread overview]
Message-ID: <1501072527.20860.1.camel@mtksdaap41> (raw)
In-Reply-To: <1d31eedd-fdab-bd6f-65b1-c0e8b79a8888@arm.com>

On Wed, 2017-07-26 at 11:36 +0100, Robin Murphy wrote:
> On 26/07/17 10:59, honghui.zhang at mediatek.com wrote:
> > From: Honghui Zhang <honghui.zhang@mediatek.com>
> > 

> >  	 * for mtk smi gen 1, we need to get the ao(always on) base to config
> >  	 * m4u port, and we need to enable the aync clock for transform the smi
> >  	 * clock into emi clock domain, but for mtk smi gen2, there's no smi ao
> >  	 * base.
> >  	 */
> > -	smi_gen = (enum mtk_smi_gen)of_id->data;
> > -	if (smi_gen == MTK_SMI_GEN1) {
> > +	smi_gen = of_device_get_match_data(dev);
> 
> The data you're retrieving is the exact same thing as of_id->data was,
> i.e. an enum mtk_smi_gen cast to void*, so dereferencing it is not a
> good idea. The first patch was almost right; you just need to keep the
> cast in the assignment to smi_gen.
> 
> Robin.
> 
Hi, Robin, thanks very much.
I will send a new version.

> > +	if (*smi_gen == MTK_SMI_GEN1) {
> >  		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> >  		common->smi_ao_base = devm_ioremap_resource(dev, res);
> >  		if (IS_ERR(common->smi_ao_base))
> > 
> 

  reply	other threads:[~2017-07-26 12:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-26  9:59 [PATCH] memory: mtk-smi: Use of_device_get_match_data helper honghui.zhang at mediatek.com
2017-07-26 10:36 ` Robin Murphy
2017-07-26 12:35   ` Honghui Zhang [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-07-26  9:52 honghui.zhang at mediatek.com
2017-07-30  0:45 ` kbuild test robot

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=1501072527.20860.1.camel@mtksdaap41 \
    --to=honghui.zhang@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.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