lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 10 Jan 2023 09:35:32 +0100
From:   Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To:     "Hawkins, Nick" <nick.hawkins@....com>
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

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ