[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DB6PR0402MB2760F59F7230BEAC45C617B1885A9@DB6PR0402MB2760.eurprd04.prod.outlook.com>
Date: Tue, 4 May 2021 11:22:48 +0000
From: Peng Fan <peng.fan@....com>
To: Fabio Estevam <festevam@...il.com>,
"Peng Fan (OSS)" <peng.fan@....nxp.com>
CC: Rob Herring <robh+dt@...nel.org>, Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Sascha Hauer <kernel@...gutronix.de>,
dl-linux-imx <linux-imx@....com>,
Philipp Zabel <p.zabel@...gutronix.de>,
Lucas Stach <l.stach@...gutronix.de>,
Krzysztof Kozlowski <krzk@...nel.org>,
Guido Günther <agx@...xcpu.org>,
Marek Vasut <marex@...x.de>,
Andrey Smirnov <andrew.smirnov@...il.com>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@...r.kernel.org>,
"moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE"
<linux-arm-kernel@...ts.infradead.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
Jacky Bai <ping.bai@....com>,
Schrempf Frieder <frieder.schrempf@...tron.de>,
Adam Ford <aford173@...il.com>, Abel Vesa <abel.vesa@....com>
Subject: RE: [PATCH V2 4/4] soc: imx: Add blk-ctl driver for i.MX8MM
> 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@....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.
Powered by blists - more mailing lists