[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1F4A96B7-F90D-401D-93D8-A14CD8F4E0B7@hpe.com>
Date: Mon, 9 Jan 2023 20:23:39 +0000
From: "Hawkins, Nick" <nick.hawkins@....com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
CC: "Verdun, Jean-Marie" <verdun@....com>,
"robh+dt@...nel.org" <robh+dt@...nel.org>,
"krzysztof.kozlowski+dt@...aro.org"
<krzysztof.kozlowski+dt@...aro.org>,
"lee@...nel.org" <lee@...nel.org>,
"linux@...linux.org.uk" <linux@...linux.org.uk>,
"linux-i2c@...r.kernel.org" <linux-i2c@...r.kernel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH v1 1/6] i2c: hpe: Add GXP SoC I2C Controller
> > + 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
Powered by blists - more mailing lists