Thread (18 messages) 18 messages, 6 authors, 2021-05-06

RE: [PATCH V2 4/4] soc: imx: Add blk-ctl driver for i.MX8MM

From: Peng Fan <peng.fan@nxp.com>
Date: 2021-05-04 11:22:54
Also in: linux-devicetree, lkml

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) [off-list ref]
wrote:
quoted
+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);
quoted
+       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);
quoted
+       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.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help