[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c16b35f1-0c0a-707b-d097-bb0440454cbb@nvidia.com>
Date: Tue, 12 Mar 2019 10:04:45 +0000
From: Jon Hunter <jonathanh@...dia.com>
To: "Enrico Weigelt, metux IT consult" <info@...ux.net>,
<linux-kernel@...r.kernel.org>
CC: <axboe@...nel.dk>, <hdegoede@...hat.com>,
<b.zolnierkie@...sung.com>, <linus.walleij@...aro.org>,
<linux-ide@...r.kernel.org>, <linux-tegra@...r.kernel.org>
Subject: Re: [PATCH 3/9] drivers: ata: ahci_tegra: use
devm_platform_ioremap_resource()
On 12/03/2019 09:19, 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@...ux.net>
> ---
> drivers/ata/ahci_tegra.c | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/ata/ahci_tegra.c b/drivers/ata/ahci_tegra.c
> index 004f260..88748ca 100644
> --- a/drivers/ata/ahci_tegra.c
> +++ b/drivers/ata/ahci_tegra.c
> @@ -490,7 +490,6 @@ static int tegra_ahci_probe(struct platform_device *pdev)
> {
> struct ahci_host_priv *hpriv;
> struct tegra_ahci_priv *tegra;
> - struct resource *res;
> int ret;
> unsigned int i;
>
> @@ -507,19 +506,17 @@ static int tegra_ahci_probe(struct platform_device *pdev)
> tegra->pdev = pdev;
> tegra->soc = of_device_get_match_data(&pdev->dev);
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> - tegra->sata_regs = devm_ioremap_resource(&pdev->dev, res);
> + tegra->sata_regs = devm_platform_ioremap_resource(pdev, 1);
> if (IS_ERR(tegra->sata_regs))
> return PTR_ERR(tegra->sata_regs);
>
> /*
> * AUX registers is optional.
> */
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
> - if (res) {
> - tegra->sata_aux_regs = devm_ioremap_resource(&pdev->dev, res);
> - if (IS_ERR(tegra->sata_aux_regs))
> - return PTR_ERR(tegra->sata_aux_regs);
> + tegra->sata_aux_regs = devm_platform_ioremap_resource(pdev, 2);
> + if (IS_ERR(tegra->sata_aux_regs)) {
> + dev_info(&pdev->dev, "Cant get aux registers (optional)");
dev_err?
> + tegra->sata_aux_regs = NULL;
This bit does not look right, because although the AUX registers are
optional, now we don't know if it failed because they are not supported
for a given device or something else failed. So I am not sure we can do
this here.
Cheers
Jon
--
nvpublic
Powered by blists - more mailing lists