devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: "Hawkins, Nick" <nick.hawkins@hpe.com>
Cc: "Verdun, Jean-Marie" <verdun@hpe.com>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"krzysztof.kozlowski+dt@linaro.org" 
	<krzysztof.kozlowski+dt@linaro.org>,
	"lee@kernel.org" <lee@kernel.org>,
	"linux@armlinux.org.uk" <linux@armlinux.org.uk>,
	"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v1 1/6] i2c: hpe: Add GXP SoC I2C Controller
Date: Tue, 10 Jan 2023 09:35:32 +0100	[thread overview]
Message-ID: <ec0fae6d-4677-2299-3970-662c657eb919@linaro.org> (raw)
In-Reply-To: <1F4A96B7-F90D-401D-93D8-A14CD8F4E0B7@hpe.com>

On 09/01/2023 21:23, Hawkins, Nick wrote:
>>> + 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);

Entire pr_info must be gone, so you do not need res anymore. You should
not print any addresses. Unless drvdata->engine is used further?

In such case you have function just few lines above the one you
mentioned, don't you?

> 
> 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>.


Best regards,
Krzysztof


  reply	other threads:[~2023-01-10  8:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-16 18:35 [PATCH v1 0/6] ARM: Add GXP I2C Support nick.hawkins
2022-12-16 18:35 ` [PATCH v1 1/6] i2c: hpe: Add GXP SoC I2C Controller nick.hawkins
2022-12-17 10:51   ` Krzysztof Kozlowski
2023-01-09 20:23     ` Hawkins, Nick
2023-01-10  8:35       ` Krzysztof Kozlowski [this message]
2022-12-16 18:35 ` [PATCH v1 2/6] dt-bindings: i2c: hpe,gxp-i2c nick.hawkins
2022-12-17 10:55   ` Krzysztof Kozlowski
2022-12-16 18:35 ` [PATCH v1 3/6] dt-bindings: mfd: syscon: Document GXP register compatible nick.hawkins
2022-12-17 10:59   ` Krzysztof Kozlowski
2023-01-04 17:20   ` Lee Jones
2022-12-16 18:35 ` [PATCH v1 4/6] ARM: dts: hpe: Add I2C Topology nick.hawkins
2022-12-17 10:58   ` Krzysztof Kozlowski
2022-12-16 18:35 ` [PATCH v1 5/6] ARM: multi_v7_defconfig: add gxp i2c module nick.hawkins
2022-12-16 18:35 ` [PATCH v1 6/6] MAINTAINERS: Add HPE GXP I2C Support nick.hawkins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ec0fae6d-4677-2299-3970-662c657eb919@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lee@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=nick.hawkins@hpe.com \
    --cc=robh+dt@kernel.org \
    --cc=verdun@hpe.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).