From: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
To: "Enrico Weigelt, metux IT consult" <info@metux.net>
Cc: linux-kernel@vger.kernel.org, axboe@kernel.dk,
hdegoede@redhat.com, linus.walleij@linaro.org,
linux-ide@vger.kernel.org, linux-tegra@vger.kernel.org
Subject: Re: [PATCH 4/9] drivers: ata: ahci_xgene: use devm_platform_ioremap_resource()
Date: Tue, 20 Aug 2019 15:45:19 +0200 [thread overview]
Message-ID: <00a33e10-b563-a7e1-4180-10386f803b75@samsung.com> (raw)
In-Reply-To: <1566304548-19972-4-git-send-email-info@metux.net>
On 8/20/19 2:35 PM, Enrico Weigelt, metux IT consult wrote:
> Use the new helper that wraps the calls to platform_get_resource()
> and devm_ioremap_resource() together.
>
> Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
> ---
> drivers/ata/ahci_xgene.c | 21 +++++++--------------
> 1 file changed, 7 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c
> index 16246c8..5391f5d 100644
> --- a/drivers/ata/ahci_xgene.c
> +++ b/drivers/ata/ahci_xgene.c
> @@ -739,7 +739,6 @@ static int xgene_ahci_probe(struct platform_device *pdev)
> struct device *dev = &pdev->dev;
> struct ahci_host_priv *hpriv;
> struct xgene_ahci_context *ctx;
> - struct resource *res;
> const struct of_device_id *of_devid;
> enum xgene_ahci_version version = XGENE_AHCI_V1;
> const struct ata_port_info *ppi[] = { &xgene_ahci_v1_port_info,
> @@ -759,31 +758,25 @@ static int xgene_ahci_probe(struct platform_device *pdev)
> ctx->dev = dev;
>
> /* Retrieve the IP core resource */
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> - ctx->csr_core = devm_ioremap_resource(dev, res);
> + ctx->csr_core = devm_platform_ioremap_resource(pdev, 1);
> if (IS_ERR(ctx->csr_core))
> return PTR_ERR(ctx->csr_core);
>
> /* Retrieve the IP diagnostic resource */
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
> - ctx->csr_diag = devm_ioremap_resource(dev, res);
> + ctx->csr_diag = devm_platform_ioremap_resource(pdev, 2);
> if (IS_ERR(ctx->csr_diag))
> return PTR_ERR(ctx->csr_diag);
>
> /* Retrieve the IP AXI resource */
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 3);
> - ctx->csr_axi = devm_ioremap_resource(dev, res);
> + ctx->csr_axi = devm_platform_ioremap_resource(pdev, 3);
> if (IS_ERR(ctx->csr_axi))
> return PTR_ERR(ctx->csr_axi);
>
> /* Retrieve the optional IP mux resource */
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 4);
> - if (res) {
> - void __iomem *csr = devm_ioremap_resource(dev, res);
> - if (IS_ERR(csr))
> - return PTR_ERR(csr);
> -
> - ctx->csr_mux = csr;
> + ctx->csr_mux = csr = devm_platform_ioremap_resource(pdev, 4);
This conversion is incorrect - despite the resource being optional
we will get error message from devm_[platform_]ioremap_resource()
(it always prints an error on !res condition).
> + if (IS_ERR(ctx->csr_mux)) {
> + dev_info(&pdev->dev, "cant get ip mux resource (optional)");
No need for this message.
> + ctx->csr_mux = NULL;
> }
>
> of_devid = of_match_device(xgene_ahci_of_match, dev);
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
next prev parent reply other threads:[~2019-08-20 13:45 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20190820123558epcas1p1d3ad88d04bd6694ab47eb485bd269cc4@epcas1p1.samsung.com>
2019-08-20 12:35 ` [PATCH 1/9] drivers: ata: ahci_octeon: use devm_platform_ioremap_resource() Enrico Weigelt, metux IT consult
2019-08-20 12:35 ` [PATCH 2/9] drivers: ata: ahci_seattle: " Enrico Weigelt, metux IT consult
2019-08-20 13:28 ` Bartlomiej Zolnierkiewicz
2019-08-20 12:35 ` [PATCH 3/9] drivers: ata: ahci_tegra: " Enrico Weigelt, metux IT consult
2019-08-20 13:44 ` Bartlomiej Zolnierkiewicz
2019-08-20 12:35 ` [PATCH 4/9] drivers: ata: ahci_xgene: " Enrico Weigelt, metux IT consult
2019-08-20 13:45 ` Bartlomiej Zolnierkiewicz [this message]
2019-08-20 12:35 ` [PATCH 5/9] drivers: ata: libahci_platform: " Enrico Weigelt, metux IT consult
2019-08-20 13:29 ` Bartlomiej Zolnierkiewicz
2019-08-20 12:35 ` [PATCH 6/9] drivers: ata: pata_bk3710: " Enrico Weigelt, metux IT consult
2019-08-20 13:30 ` Bartlomiej Zolnierkiewicz
2019-08-20 12:35 ` [PATCH 7/9] drivers: ata: sata_dwc_460ex: " Enrico Weigelt, metux IT consult
2019-08-20 13:31 ` Bartlomiej Zolnierkiewicz
2019-08-20 12:35 ` [PATCH 8/9] drivers: ata: sata_gemini: " Enrico Weigelt, metux IT consult
2019-08-20 13:20 ` Linus Walleij
2019-08-20 13:36 ` Bartlomiej Zolnierkiewicz
2019-08-20 12:35 ` [PATCH 9/9] drivers: ata: sata_rcar: " Enrico Weigelt, metux IT consult
2019-08-20 13:37 ` Bartlomiej Zolnierkiewicz
2019-08-20 13:27 ` [PATCH 1/9] drivers: ata: ahci_octeon: " Bartlomiej Zolnierkiewicz
2019-03-12 9:19 Enrico Weigelt, metux IT consult
2019-03-12 9:19 ` [PATCH 4/9] drivers: ata: ahci_xgene: " Enrico Weigelt, metux IT consult
2019-03-12 14:43 ` Sergei Shtylyov
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=00a33e10-b563-a7e1-4180-10386f803b75@samsung.com \
--to=b.zolnierkie@samsung.com \
--cc=axboe@kernel.dk \
--cc=hdegoede@redhat.com \
--cc=info@metux.net \
--cc=linus.walleij@linaro.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
/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