lkml.org 
[lkml]   [2021]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH V2 4/4] soc: imx: Add blk-ctl driver for i.MX8MM
Date
> Subject: Re: [PATCH V2 4/4] soc: imx: Add blk-ctl driver for i.MX8MM
>
> Hi Peng,
>
> On Fri, Apr 30, 2021 at 1:56 AM Peng Fan (OSS) <peng.fan@oss.nxp.com>
> wrote:
>
> > +static int imx8mm_blk_ctl_probe(struct platform_device *pdev) {
> > + struct device *dev = &pdev->dev;
> > + const struct imx_blk_ctl_dev_data *dev_data =
> of_device_get_match_data(dev);
> > + struct regmap *regmap;
> > + struct resource *res;
> > + struct imx_blk_ctl *ctl;
> > + void __iomem *base;
> > +
> > + ctl = devm_kzalloc(dev, sizeof(*ctl), GFP_KERNEL);
> > + if (!ctl)
> > + return -ENOMEM;
> > +
> > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > + base = devm_ioremap_resource(dev, res);
> > + if (IS_ERR(base))
> > + return PTR_ERR(base);
> > +
> > + regmap = devm_regmap_init_mmio(dev, base,
> &dev_data->config);
> > + if (IS_ERR(regmap))
> > + return PTR_ERR(regmap);
> > +
> > + ctl->regmap = regmap;
> > + ctl->dev = dev;
> > + atomic_set(&ctl->power_count, 0);
> > +
> > + ctl->num_clks = devm_clk_bulk_get_all(dev, &ctl->clks);
> > + if (ctl->num_clks < 0)
> > + return ctl->num_clks;
> > +
> > + dev_set_drvdata(dev, ctl);
> > + ctl->dev_data = of_device_get_match_data(dev);
>
> No need to call of_device_get_match_data() twice. You could do:
>
> ctl->dev_data = dev_data;

Fix in V3.

Thanks,
Peng.

\
 
 \ /
  Last update: 2021-05-04 13:23    [W:0.073 / U:0.976 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site