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 <[email protected]>
---
drivers/ata/ahci_octeon.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/ata/ahci_octeon.c b/drivers/ata/ahci_octeon.c
index 5a44e08..2280180 100644
--- a/drivers/ata/ahci_octeon.c
+++ b/drivers/ata/ahci_octeon.c
@@ -32,13 +32,11 @@ static int ahci_octeon_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct device_node *node = dev->of_node;
- struct resource *res;
void __iomem *base;
u64 cfg;
int ret;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- base = devm_ioremap_resource(&pdev->dev, res);
+ base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(base))
return PTR_ERR(base);
--
1.9.1
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 <[email protected]>
---
drivers/ata/pata_bk3710.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/ata/pata_bk3710.c b/drivers/ata/pata_bk3710.c
index fad95cf..92b036d 100644
--- a/drivers/ata/pata_bk3710.c
+++ b/drivers/ata/pata_bk3710.c
@@ -291,7 +291,6 @@ static void pata_bk3710_chipinit(void __iomem *base)
static int __init pata_bk3710_probe(struct platform_device *pdev)
{
struct clk *clk;
- struct resource *mem;
struct ata_host *host;
struct ata_port *ap;
void __iomem *base;
@@ -310,15 +309,13 @@ static int __init pata_bk3710_probe(struct platform_device *pdev)
/* NOTE: round *down* to meet minimum timings; we count in clocks */
ideclk_period = 1000000000UL / rate;
- mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-
irq = platform_get_irq(pdev, 0);
if (irq < 0) {
pr_err(DRV_NAME ": failed to get IRQ resource\n");
return irq;
}
- base = devm_ioremap_resource(&pdev->dev, mem);
+ base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(base))
return PTR_ERR(base);
--
1.9.1
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 <[email protected]>
---
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);
+ if (IS_ERR(ctx->csr_mux)) {
+ dev_info(&pdev->dev, "cant get ip mux resource (optional)");
+ ctx->csr_mux = NULL;
}
of_devid = of_match_device(xgene_ahci_of_match, dev);
--
1.9.1
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 <[email protected]>
---
drivers/ata/sata_dwc_460ex.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c
index 9dcef6a..de248fa 100644
--- a/drivers/ata/sata_dwc_460ex.c
+++ b/drivers/ata/sata_dwc_460ex.c
@@ -237,7 +237,6 @@ static int sata_dwc_dma_init_old(struct platform_device *pdev,
struct sata_dwc_device *hsdev)
{
struct device_node *np = pdev->dev.of_node;
- struct resource *res;
hsdev->dma = devm_kzalloc(&pdev->dev, sizeof(*hsdev->dma), GFP_KERNEL);
if (!hsdev->dma)
@@ -254,8 +253,7 @@ static int sata_dwc_dma_init_old(struct platform_device *pdev,
}
/* Get physical SATA DMA register base address */
- res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
- hsdev->dma->regs = devm_ioremap_resource(&pdev->dev, res);
+ hsdev->dma->regs = devm_platform_ioremap_resource(pdev, 1);
if (IS_ERR(hsdev->dma->regs))
return PTR_ERR(hsdev->dma->regs);
--
1.9.1
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 <[email protected]>
---
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 e3163da..3845c23 100644
--- a/drivers/ata/ahci_tegra.c
+++ b/drivers/ata/ahci_tegra.c
@@ -481,7 +481,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;
@@ -498,19 +497,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)");
+ tegra->sata_aux_regs = NULL;
}
tegra->sata_rst = devm_reset_control_get(&pdev->dev, "sata");
--
1.9.1
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 <[email protected]>
---
drivers/ata/ahci_seattle.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/ata/ahci_seattle.c b/drivers/ata/ahci_seattle.c
index ced12705..2d88d36 100644
--- a/drivers/ata/ahci_seattle.c
+++ b/drivers/ata/ahci_seattle.c
@@ -132,8 +132,7 @@ static const struct ata_port_info *ahci_seattle_get_port_info(
if (!plat_data)
return &ahci_port_info;
- plat_data->sgpio_ctrl = devm_ioremap_resource(dev,
- platform_get_resource(pdev, IORESOURCE_MEM, 1));
+ plat_data->sgpio_ctrl = devm_platform_ioremap_resource(pdev, 1);
if (IS_ERR(plat_data->sgpio_ctrl))
return &ahci_port_info;
--
1.9.1
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 <[email protected]>
---
drivers/ata/sata_rcar.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
index 3495e17..14ea1d6 100644
--- a/drivers/ata/sata_rcar.c
+++ b/drivers/ata/sata_rcar.c
@@ -886,7 +886,6 @@ static int sata_rcar_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct ata_host *host;
struct sata_rcar_priv *priv;
- struct resource *mem;
int irq;
int ret = 0;
@@ -915,8 +914,7 @@ static int sata_rcar_probe(struct platform_device *pdev)
host->private_data = priv;
- mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- priv->base = devm_ioremap_resource(dev, mem);
+ priv->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(priv->base)) {
ret = PTR_ERR(priv->base);
goto err_pm_put;
--
1.9.1
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 <[email protected]>
---
drivers/ata/sata_gemini.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/ata/sata_gemini.c b/drivers/ata/sata_gemini.c
index f793564..55e2689 100644
--- a/drivers/ata/sata_gemini.c
+++ b/drivers/ata/sata_gemini.c
@@ -318,7 +318,6 @@ static int gemini_sata_probe(struct platform_device *pdev)
struct device_node *np = dev->of_node;
struct sata_gemini *sg;
struct regmap *map;
- struct resource *res;
enum gemini_muxmode muxmode;
u32 gmode;
u32 gmask;
@@ -329,11 +328,7 @@ static int gemini_sata_probe(struct platform_device *pdev)
return -ENOMEM;
sg->dev = dev;
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return -ENODEV;
-
- sg->base = devm_ioremap_resource(dev, res);
+ sg->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(sg->base))
return PTR_ERR(sg->base);
--
1.9.1
On Tue, Aug 20, 2019 at 2:35 PM Enrico Weigelt, metux IT consult
<[email protected]> 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 <[email protected]>
Acked-by: Linus Walleij <[email protected]>
Yours,
Linus Walleij
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 <[email protected]>
Acked-by: Bartlomiej Zolnierkiewicz <[email protected]>
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
> ---
> drivers/ata/ahci_octeon.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/ata/ahci_octeon.c b/drivers/ata/ahci_octeon.c
> index 5a44e08..2280180 100644
> --- a/drivers/ata/ahci_octeon.c
> +++ b/drivers/ata/ahci_octeon.c
> @@ -32,13 +32,11 @@ static int ahci_octeon_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> struct device_node *node = dev->of_node;
> - struct resource *res;
> void __iomem *base;
> u64 cfg;
> int ret;
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - base = devm_ioremap_resource(&pdev->dev, res);
> + base = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(base))
> return PTR_ERR(base);
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 <[email protected]>
Acked-by: Bartlomiej Zolnierkiewicz <[email protected]>
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
> ---
> drivers/ata/ahci_seattle.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/ata/ahci_seattle.c b/drivers/ata/ahci_seattle.c
> index ced12705..2d88d36 100644
> --- a/drivers/ata/ahci_seattle.c
> +++ b/drivers/ata/ahci_seattle.c
> @@ -132,8 +132,7 @@ static const struct ata_port_info *ahci_seattle_get_port_info(
> if (!plat_data)
> return &ahci_port_info;
>
> - plat_data->sgpio_ctrl = devm_ioremap_resource(dev,
> - platform_get_resource(pdev, IORESOURCE_MEM, 1));
> + plat_data->sgpio_ctrl = devm_platform_ioremap_resource(pdev, 1);
> if (IS_ERR(plat_data->sgpio_ctrl))
> return &ahci_port_info;
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 <[email protected]>
Acked-by: Bartlomiej Zolnierkiewicz <[email protected]>
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
> ---
> drivers/ata/pata_bk3710.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/ata/pata_bk3710.c b/drivers/ata/pata_bk3710.c
> index fad95cf..92b036d 100644
> --- a/drivers/ata/pata_bk3710.c
> +++ b/drivers/ata/pata_bk3710.c
> @@ -291,7 +291,6 @@ static void pata_bk3710_chipinit(void __iomem *base)
> static int __init pata_bk3710_probe(struct platform_device *pdev)
> {
> struct clk *clk;
> - struct resource *mem;
> struct ata_host *host;
> struct ata_port *ap;
> void __iomem *base;
> @@ -310,15 +309,13 @@ static int __init pata_bk3710_probe(struct platform_device *pdev)
> /* NOTE: round *down* to meet minimum timings; we count in clocks */
> ideclk_period = 1000000000UL / rate;
>
> - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -
> irq = platform_get_irq(pdev, 0);
> if (irq < 0) {
> pr_err(DRV_NAME ": failed to get IRQ resource\n");
> return irq;
> }
>
> - base = devm_ioremap_resource(&pdev->dev, mem);
> + base = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(base))
> return PTR_ERR(base);
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 <[email protected]>
Acked-by: Bartlomiej Zolnierkiewicz <[email protected]>
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
> ---
> drivers/ata/sata_dwc_460ex.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c
> index 9dcef6a..de248fa 100644
> --- a/drivers/ata/sata_dwc_460ex.c
> +++ b/drivers/ata/sata_dwc_460ex.c
> @@ -237,7 +237,6 @@ static int sata_dwc_dma_init_old(struct platform_device *pdev,
> struct sata_dwc_device *hsdev)
> {
> struct device_node *np = pdev->dev.of_node;
> - struct resource *res;
>
> hsdev->dma = devm_kzalloc(&pdev->dev, sizeof(*hsdev->dma), GFP_KERNEL);
> if (!hsdev->dma)
> @@ -254,8 +253,7 @@ static int sata_dwc_dma_init_old(struct platform_device *pdev,
> }
>
> /* Get physical SATA DMA register base address */
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> - hsdev->dma->regs = devm_ioremap_resource(&pdev->dev, res);
> + hsdev->dma->regs = devm_platform_ioremap_resource(pdev, 1);
> if (IS_ERR(hsdev->dma->regs))
> return PTR_ERR(hsdev->dma->regs);
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 <[email protected]>
Acked-by: Bartlomiej Zolnierkiewicz <[email protected]>
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
> ---
> drivers/ata/sata_rcar.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
> index 3495e17..14ea1d6 100644
> --- a/drivers/ata/sata_rcar.c
> +++ b/drivers/ata/sata_rcar.c
> @@ -886,7 +886,6 @@ static int sata_rcar_probe(struct platform_device *pdev)
> struct device *dev = &pdev->dev;
> struct ata_host *host;
> struct sata_rcar_priv *priv;
> - struct resource *mem;
> int irq;
> int ret = 0;
>
> @@ -915,8 +914,7 @@ static int sata_rcar_probe(struct platform_device *pdev)
>
> host->private_data = priv;
>
> - mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - priv->base = devm_ioremap_resource(dev, mem);
> + priv->base = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(priv->base)) {
> ret = PTR_ERR(priv->base);
> goto err_pm_put;
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.
It would also be worth to mention in the patch description that
on !res condition the driver will now return -EINVAL (instead of
-ENODEV) and print an error.
> Signed-off-by: Enrico Weigelt, metux IT consult <[email protected]>
Acked-by: Bartlomiej Zolnierkiewicz <[email protected]>
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
> ---
> drivers/ata/sata_gemini.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/drivers/ata/sata_gemini.c b/drivers/ata/sata_gemini.c
> index f793564..55e2689 100644
> --- a/drivers/ata/sata_gemini.c
> +++ b/drivers/ata/sata_gemini.c
> @@ -318,7 +318,6 @@ static int gemini_sata_probe(struct platform_device *pdev)
> struct device_node *np = dev->of_node;
> struct sata_gemini *sg;
> struct regmap *map;
> - struct resource *res;
> enum gemini_muxmode muxmode;
> u32 gmode;
> u32 gmask;
> @@ -329,11 +328,7 @@ static int gemini_sata_probe(struct platform_device *pdev)
> return -ENOMEM;
> sg->dev = dev;
>
> - res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - if (!res)
> - return -ENODEV;
> -
> - sg->base = devm_ioremap_resource(dev, res);
> + sg->base = devm_platform_ioremap_resource(pdev, 0);
> if (IS_ERR(sg->base))
> return PTR_ERR(sg->base);
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 <[email protected]>
> ---
> 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 e3163da..3845c23 100644
> --- a/drivers/ata/ahci_tegra.c
> +++ b/drivers/ata/ahci_tegra.c
> @@ -481,7 +481,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;
>
> @@ -498,19 +497,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);
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(tegra->sata_aux_regs)) {
> + dev_info(&pdev->dev, "Cant get aux registers (optional)");
No need for this message.
> + tegra->sata_aux_regs = NULL;
> }
>
> tegra->sata_rst = devm_reset_control_get(&pdev->dev, "sata");
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
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 <[email protected]>
> ---
> 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