Skip to contentSkip to conversation

ata: ahci_octeon: Convert to devm_platform_ioremap_resource()

PATCH Applied Yangtao Li 3 participants 15 messages Jul 10, 2023 – Jul 17, 2023

Subsystems (6)
lore
Share & tools
lore

Yangtao Li

author
#0 lore raw

PATCH v3 1/11 ata: ahci_octeon: Convert to devm_platform_ioremap_resource()

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/ata/ahci_octeon.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/ata/ahci_octeon.c +1 -3
index e89807fa928e..9accf8923891 100644
@@ -31,13 +31,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);
 
Signature · 1 line
2.39.0
author
#1 lore raw

PATCH v3 2/11 ata: ahci_seattle: Convert to devm_platform_ioremap_resource()

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/ata/ahci_seattle.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/ata/ahci_seattle.c +1 -2
index 2c32d58c6ae7..a64c9c4704cd 100644
@@ -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;
 
Signature · 1 line
2.39.0
author
#2 lore raw

PATCH v3 3/11 ata: ahci_xgene: Convert to devm_platform_ioremap_resource()

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/ata/ahci_xgene.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/ata/ahci_xgene.c +3 -6
index eb773f2e28fc..f5deaf648663 100644
@@ -755,20 +755,17 @@ 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);
 
Signature · 1 line
2.39.0
author
#3 lore raw

PATCH v3 4/11 ata: ahci_tegra: Convert to devm_platform_ioremap_resource()

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/ata/ahci_tegra.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/ata/ahci_tegra.c +1 -2
index 21c20793e517..d1a35da7e824 100644
@@ -530,8 +530,7 @@ 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);
 
Signature · 1 line
2.39.0
author
#4 lore raw

PATCH v3 5/11 ata: sata_rcar: drop useless initializer

In reply to Yangtao Li

There is no need to initialize the variable ret.

---
 drivers/ata/sata_rcar.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/ata/sata_rcar.c +1 -2
index 34790f15c1b8..f299b41ab3e6 100644
@@ -862,8 +862,7 @@ static int sata_rcar_probe(struct platform_device *pdev)
 	struct ata_host *host;
 	struct sata_rcar_priv *priv;
 	struct resource *mem;
-	int irq;
-	int ret = 0;
+	int irq, ret;
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
Signature · 1 line
2.39.0
Reviewed-by on v3 5/11
#5 lore raw

Re: [PATCH v3 05/11] ata: sata_rcar: drop useless initializer

Quoted 4 lines · Yangtao Li

There is no need to initialize the variable ret.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
author
#6 lore raw

PATCH v3 6/11 ata: sata_rcar: Remove unnecessary return value check

In reply to Yangtao Li

As commit ce753ad1549c ("platform: finally disallow IRQ0 in platform_get_irq() and its ilk") says, there is no need to check if the platform_get_irq return value is 0. Let's remove it.

---
 drivers/ata/sata_rcar.c | 2 --
 1 file changed, 2 deletions(-)
drivers/ata/sata_rcar.c +0 -2
index f299b41ab3e6..43c55ac89daa 100644
@@ -867,8 +867,6 @@ static int sata_rcar_probe(struct platform_device *pdev)
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
 		return irq;
-	if (!irq)
-		return -EINVAL;
 
 	priv = devm_kzalloc(dev, sizeof(struct sata_rcar_priv), GFP_KERNEL);
 	if (!priv)
Signature · 1 line
2.39.0
Reviewed-by on v3 6/11
#7 lore raw

Re: [PATCH v3 06/11] ata: sata_rcar: Remove unnecessary return value check

Quoted 6 lines · Yangtao Li

As commit ce753ad1549c ("platform: finally disallow IRQ0 in platform_get_irq() and its ilk") says, there is no need to check if the platform_get_irq return value is 0. Let's remove it.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
author
#8 lore raw

PATCH v3 7/11 ata: sata_rcar: Convert to devm_platform_ioremap_resource()

In reply to Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

---
 drivers/ata/sata_rcar.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/ata/sata_rcar.c +1 -3
index 43c55ac89daa..63f8337c2a98 100644
@@ -861,7 +861,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, ret;
 
 	irq = platform_get_irq(pdev, 0);
@@ -887,8 +886,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;
Signature · 1 line
2.39.0
Reviewed-by on v3 7/11
#9 lore raw

Re: [PATCH v3 07/11] ata: sata_rcar: Convert to devm_platform_ioremap_resource()

Quoted 4 lines · Yangtao Li

Use devm_platform_ioremap_resource() to simplify code.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
author
#10 lore raw

PATCH v3 8/11 ata: pata_ixp4xx: Use devm_platform_get_and_ioremap_resource()

In reply to Yangtao Li

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

---
 drivers/ata/pata_ixp4xx_cf.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)
drivers/ata/pata_ixp4xx_cf.c +7 -10
index b1daa4d3fcd9..1b9f67e16864 100644
@@ -242,12 +242,6 @@ static int ixp4xx_pata_probe(struct platform_device *pdev)
 	int ret;
 	int irq;
 
-	cmd = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	ctl = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-
-	if (!cmd || !ctl)
-		return -EINVAL;
-
 	ixpp = devm_kzalloc(dev, sizeof(*ixpp), GFP_KERNEL);
 	if (!ixpp)
 		return -ENOMEM;
@@ -271,10 +265,13 @@ static int ixp4xx_pata_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	ixpp->cmd = devm_ioremap_resource(dev, cmd);
-	ixpp->ctl = devm_ioremap_resource(dev, ctl);
-	if (IS_ERR(ixpp->cmd) || IS_ERR(ixpp->ctl))
-		return -ENOMEM;
+	ixpp->cmd = devm_platform_get_and_ioremap_resource(pdev, 0, &cmd);
+	if (IS_ERR(ixpp->cmd))
+		return PTR_ERR(ixpp->cmd);
+
+	ixpp->ctl = devm_platform_get_and_ioremap_resource(pdev, 1, &ctl);
+	if (IS_ERR(ixpp->ctl))
+		return PTR_ERR(ixpp->ctl);
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq > 0)
Signature · 1 line
2.39.0
author
#11 lore raw

PATCH v3 9/11 ata: pata_ixp4xx: Remove unnecessary return value check

In reply to Yangtao Li

As commit ce753ad1549c ("platform: finally disallow IRQ0 in platform_get_irq() and its ilk") says, there is no need to check if the platform_get_irq return value is 0. Let's remove it.

---
 drivers/ata/pata_ixp4xx_cf.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/ata/pata_ixp4xx_cf.c +2 -5
index 1b9f67e16864..246bb4f8f1f7 100644
@@ -274,12 +274,9 @@ static int ixp4xx_pata_probe(struct platform_device *pdev)
 		return PTR_ERR(ixpp->ctl);
 
 	irq = platform_get_irq(pdev, 0);
-	if (irq > 0)
-		irq_set_irq_type(irq, IRQ_TYPE_EDGE_RISING);
-	else if (irq < 0)
+	if (irq < 0)
 		return irq;
-	else
-		return -EINVAL;
+	irq_set_irq_type(irq, IRQ_TYPE_EDGE_RISING);
 
 	/* Just one port to set up */
 	ixp4xx_setup_port(ixpp->host->ports[0], ixpp, cmd->start, ctl->start);
Signature · 1 line
2.39.0
author
#12 lore raw

PATCH v3 10/11 ata: pata_ftide010: Use devm_platform_get_and_ioremap_resource()

In reply to Yangtao Li

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

---
 drivers/ata/pata_ftide010.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/ata/pata_ftide010.c +1 -5
index 6f6734c09b11..c6f60f1a908f 100644
@@ -470,11 +470,7 @@ static int pata_ftide010_probe(struct platform_device *pdev)
 	if (irq < 0)
 		return irq;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res)
-		return -ENODEV;
-
-	ftide->base = devm_ioremap_resource(dev, res);
+	ftide->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
 	if (IS_ERR(ftide->base))
 		return PTR_ERR(ftide->base);
 
Signature · 1 line
2.39.0
author
#13 lore raw

PATCH v3 11/11 ata: pata_imx: Use devm_platform_get_and_ioremap_resource()

In reply to Yangtao Li

Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does.

---
 drivers/ata/pata_imx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/ata/pata_imx.c +1 -2
index 4013f28679a9..65d09ec94c12 100644
@@ -164,8 +164,7 @@ static int pata_imx_probe(struct platform_device *pdev)
 	ap->pio_mask = ATA_PIO4;
 	ap->flags |= ATA_FLAG_SLAVE_POSS;
 
-	io_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	priv->host_regs = devm_ioremap_resource(&pdev->dev, io_res);
+	priv->host_regs = devm_platform_get_and_ioremap_resource(pdev, 0, &io_res);
 	if (IS_ERR(priv->host_regs)) {
 		ret = PTR_ERR(priv->host_regs);
 		goto err;
Signature · 7 lines
2.39.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel