Messages in this thread | | | From | "Hawkins, Nick" <> | Subject | Re: [PATCH v1 1/6] i2c: hpe: Add GXP SoC I2C Controller | Date | Mon, 9 Jan 2023 20:23:39 +0000 |
| |
> > + GFP_KERNEL); > > + if (!drvdata) > > + return -ENOMEM; > > + > > + platform_set_drvdata(pdev, drvdata); > > + drvdata->dev = &pdev->dev; > > + init_completion(&drvdata->completion); > > + > > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > > + drvdata->base = devm_ioremap_resource(&pdev->dev, res);
> It's one call, not two. Use the respective helper.
Greetings Krzysztof,
Thank you for the feedback. I am in the process of applying your recommended changes but do have a question on this comment.
I can replace these two lines with: drvdata->base = devm_platform_ioremap_resource(pdev, 0);
However, I still have a need for the resource "res" here to determine the physical address of the device here:
> > + if (IS_ERR(drvdata->base)) > > + return PTR_ERR(drvdata->base); > > + > > + drvdata->engine = (res->start & 0xf00) >> 8; > > + pr_info("%s: i2c engine%d\n", __func__, drvdata->engine);
Hence at some point I believe I will still need to call the "platform_get_resource" function to accomplish this. Is this acceptable or perhaps you have another suggestion?
One alternative I thought of was including a property in the device tree node That specifies which i2c engine this is: hpe,gxp-engine = <1>.
Thank you,
-Nick Hawkins
| |