Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1697054

Re: [PATCH] memory: mtk-smi: Use of_device_get_match_data helper

From Honghui Zhang <honghui.zhang@mediatek.com>
Newsgroups linux.kernel
Subject Re: [PATCH] memory: mtk-smi: Use of_device_get_match_data helper
Date 2017-07-26 14:40 +0200
Message-ID <u7tLA-jq-19@gated-at.bofh.it> (permalink)
References <u7rgL-77f-35@gated-at.bofh.it> <u7rTr-7zc-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, 2017-07-26 at 11:36 +0100, Robin Murphy wrote:
> On 26/07/17 10:59, honghui.zhang@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))
> > 
> 

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] memory: mtk-smi: Use of_device_get_match_data helper <honghui.zhang@mediatek.com> - 2017-07-26 12:00 +0200
  Re: [PATCH] memory: mtk-smi: Use of_device_get_match_data helper Robin Murphy <robin.murphy@arm.com> - 2017-07-26 12:40 +0200
    Re: [PATCH] memory: mtk-smi: Use of_device_get_match_data helper Honghui Zhang <honghui.zhang@mediatek.com> - 2017-07-26 14:40 +0200

csiph-web