Skip to contentSkip to conversation

scsci: Convert to platform remove callback returning void

PATCH Applied Uwe Kleine-König 2 participants 17 messages Dec 3, 2023 – Dec 14, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover scsci: Convert to platform remove callback returning void

Hello,

this series converts all drivers below drivers/scsi to struct platform_driver::remove_new(). See commit 5c5a7680e67b ("platform:
Provide a remove callback that returns no value") for an extended explanation and the eventual goal.

All conversations are trivial, because all .remove() callbacks returned zero unconditionally.

Best regards
Uwe

Uwe Kleine-König (14):
scsi: a3000: Convert to platform remove callback returning void
scsi: a4000t: Convert to platform remove callback returning void
scsi: atari: Convert to platform remove callback returning void
scsi: bvme6000: Convert to platform remove callback returning void
scsi: jazz_esp: Convert to platform remove callback returning void
scsi: mac_esp: Convert to platform remove callback returning void
scsi: mac: Convert to platform remove callback returning void
scsi: mvme16x: Convert to platform remove callback returning void
scsi: qlogicpti: Convert to platform remove callback returning void
scsi: sgiwd93: Convert to platform remove callback returning void
scsi: sni_53c710: Convert to platform remove callback returning void
scsi: sun3: Convert to platform remove callback returning void
scsi: sun3x_esp: Convert to platform remove callback returning void
scsi: sun_esp: Convert to platform remove callback returning void

 drivers/scsi/a3000.c         | 5 ++---
 drivers/scsi/a4000t.c        | 5 ++---
 drivers/scsi/atari_scsi.c    | 5 ++---
 drivers/scsi/bvme6000_scsi.c | 6 ++----
 drivers/scsi/jazz_esp.c      | 6 ++----
 drivers/scsi/mac_esp.c       | 6 ++----
 drivers/scsi/mac_scsi.c      | 5 ++---
 drivers/scsi/mvme16x_scsi.c  | 6 ++----
 drivers/scsi/qlogicpti.c     | 6 ++----
 drivers/scsi/sgiwd93.c       | 5 ++---
 drivers/scsi/sni_53c710.c    | 6 ++----
 drivers/scsi/sun3_scsi.c     | 5 ++---
 drivers/scsi/sun3x_esp.c     | 6 ++----
 drivers/scsi/sun_esp.c       | 6 ++----
 14 files changed, 28 insertions(+), 50 deletions(-)

base-commit: 5eda217cee887e595ba2265435862d585d399769

Signature · 1 line
2.42.0
#1 lore raw

PATCH 1/14 scsi: a3000: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove().

In the error path emit an error message replacing the (less useful) message by the core. Apart from the improved error message there is no change in behaviour.

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/scsi/a3000.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/scsi/a3000.c +2 -3
index c3028726bbe4..378906f77909 100644
@@ -282,7 +282,7 @@ static int __init amiga_a3000_scsi_probe(struct platform_device *pdev)
 	return error;
 }
 
-static int __exit amiga_a3000_scsi_remove(struct platform_device *pdev)
+static void __exit amiga_a3000_scsi_remove(struct platform_device *pdev)
 {
 	struct Scsi_Host *instance = platform_get_drvdata(pdev);
 	struct a3000_hostdata *hdata = shost_priv(instance);
@@ -293,11 +293,10 @@ static int __exit amiga_a3000_scsi_remove(struct platform_device *pdev)
 	free_irq(IRQ_AMIGA_PORTS, instance);
 	scsi_host_put(instance);
 	release_mem_region(res->start, resource_size(res));
-	return 0;
 }
 
 static struct platform_driver amiga_a3000_scsi_driver = {
-	.remove = __exit_p(amiga_a3000_scsi_remove),
+	.remove_new = __exit_p(amiga_a3000_scsi_remove),
 	.driver   = {
 		.name	= "amiga-a3000-scsi",
 	},
Signature · 1 line
2.42.0
#2 lore raw

PATCH 2/14 scsi: a4000t: Convert to platform remove callback returning void

In reply to Uwe Kleine-König

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove().

In the error path emit an error message replacing the (less useful) message by the core. Apart from the improved error message there is no change in behaviour.

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/scsi/a4000t.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/scsi/a4000t.c +2 -3
index 5e575afce134..e435fc06a624 100644
@@ -95,7 +95,7 @@ static int __init amiga_a4000t_scsi_probe(struct platform_device *pdev)
 	return -ENODEV;
 }
 
-static int __exit amiga_a4000t_scsi_remove(struct platform_device *pdev)
+static void __exit amiga_a4000t_scsi_remove(struct platform_device *pdev)
 {
 	struct Scsi_Host *host = platform_get_drvdata(pdev);
 	struct NCR_700_Host_Parameters *hostdata = shost_priv(host);
@@ -106,11 +106,10 @@ static int __exit amiga_a4000t_scsi_remove(struct platform_device *pdev)
 	kfree(hostdata);
 	free_irq(host->irq, host);
 	release_mem_region(res->start, resource_size(res));
-	return 0;
 }
 
 static struct platform_driver amiga_a4000t_scsi_driver = {
-	.remove = __exit_p(amiga_a4000t_scsi_remove),
+	.remove_new = __exit_p(amiga_a4000t_scsi_remove),
 	.driver   = {
 		.name	= "amiga-a4000t-scsi",
 	},
Signature · 1 line
2.42.0
#3 lore raw

PATCH 3/14 scsi: atari: Convert to platform remove callback returning void

In reply to Uwe Kleine-König

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove().

In the error path emit an error message replacing the (less useful) message by the core. Apart from the improved error message there is no change in behaviour.

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/scsi/atari_scsi.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/scsi/atari_scsi.c +2 -3
index d401cf27113a..d99e70914817 100644
@@ -865,7 +865,7 @@ static int __init atari_scsi_probe(struct platform_device *pdev)
 	return error;
 }
 
-static int __exit atari_scsi_remove(struct platform_device *pdev)
+static void __exit atari_scsi_remove(struct platform_device *pdev)
 {
 	struct Scsi_Host *instance = platform_get_drvdata(pdev);
 
@@ -876,11 +876,10 @@ static int __exit atari_scsi_remove(struct platform_device *pdev)
 	scsi_host_put(instance);
 	if (atari_dma_buffer)
 		atari_stram_free(atari_dma_buffer);
-	return 0;
 }
 
 static struct platform_driver atari_scsi_driver = {
-	.remove = __exit_p(atari_scsi_remove),
+	.remove_new = __exit_p(atari_scsi_remove),
 	.driver = {
 		.name	= DRV_MODULE_NAME,
 	},
Signature · 1 line
2.42.0
#4 lore raw

PATCH 4/14 scsi: bvme6000: Convert to platform remove callback returning void

In reply to Uwe Kleine-König

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove().

In the error path emit an error message replacing the (less useful) message by the core. Apart from the improved error message there is no change in behaviour.

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/scsi/bvme6000_scsi.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/scsi/bvme6000_scsi.c +2 -4
index 8d72b25535c5..f893e9779e9d 100644
@@ -89,7 +89,7 @@ bvme6000_probe(struct platform_device *dev)
 	return -ENODEV;
 }
 
-static int
+static void
 bvme6000_device_remove(struct platform_device *dev)
 {
 	struct Scsi_Host *host = platform_get_drvdata(dev);
@@ -99,8 +99,6 @@ bvme6000_device_remove(struct platform_device *dev)
 	NCR_700_release(host);
 	kfree(hostdata);
 	free_irq(host->irq, host);
-
-	return 0;
 }
 
 static struct platform_driver bvme6000_scsi_driver = {
@@ -108,7 +106,7 @@ static struct platform_driver bvme6000_scsi_driver = {
 		.name		= "bvme6000-scsi",
 	},
 	.probe		= bvme6000_probe,
-	.remove		= bvme6000_device_remove,
+	.remove_new	= bvme6000_device_remove,
 };
 
 static int __init bvme6000_scsi_init(void)
Signature · 1 line
2.42.0
#5 lore raw

PATCH 5/14 scsi: jazz_esp: Convert to platform remove callback returning void

In reply to Uwe Kleine-König

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove().

In the error path emit an error message replacing the (less useful) message by the core. Apart from the improved error message there is no change in behaviour.

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/scsi/jazz_esp.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/scsi/jazz_esp.c +2 -4
index 0c842fb29aa0..494a671fb556 100644
@@ -176,7 +176,7 @@ static int esp_jazz_probe(struct platform_device *dev)
 	return err;
 }
 
-static int esp_jazz_remove(struct platform_device *dev)
+static void esp_jazz_remove(struct platform_device *dev)
 {
 	struct esp *esp = dev_get_drvdata(&dev->dev);
 	unsigned int irq = esp->host->irq;
@@ -189,8 +189,6 @@ static int esp_jazz_remove(struct platform_device *dev)
 			  esp->command_block_dma);
 
 	scsi_host_put(esp->host);
-
-	return 0;
 }
 
 /* work with hotplug and coldplug */
@@ -198,7 +196,7 @@ MODULE_ALIAS("platform:jazz_esp");
 
 static struct platform_driver esp_jazz_driver = {
 	.probe		= esp_jazz_probe,
-	.remove		= esp_jazz_remove,
+	.remove_new	= esp_jazz_remove,
 	.driver	= {
 		.name	= "jazz_esp",
 	},
Signature · 1 line
2.42.0
#6 lore raw

PATCH 6/14 scsi: mac_esp: Convert to platform remove callback returning void

In reply to Uwe Kleine-König

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove().

In the error path emit an error message replacing the (less useful) message by the core. Apart from the improved error message there is no change in behaviour.

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/scsi/mac_esp.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/scsi/mac_esp.c +2 -4
index 3f0061b00494..187ae0a65d40 100644
@@ -407,7 +407,7 @@ static int esp_mac_probe(struct platform_device *dev)
 	return err;
 }
 
-static int esp_mac_remove(struct platform_device *dev)
+static void esp_mac_remove(struct platform_device *dev)
 {
 	struct mac_esp_priv *mep = platform_get_drvdata(dev);
 	struct esp *esp = mep->esp;
@@ -428,13 +428,11 @@ static int esp_mac_remove(struct platform_device *dev)
 	kfree(esp->command_block);
 
 	scsi_host_put(esp->host);
-
-	return 0;
 }
 
 static struct platform_driver esp_mac_driver = {
 	.probe    = esp_mac_probe,
-	.remove   = esp_mac_remove,
+	.remove_new = esp_mac_remove,
 	.driver   = {
 		.name	= DRV_MODULE_NAME,
 	},
Signature · 1 line
2.42.0
#7 lore raw

PATCH 7/14 scsi: mac: Convert to platform remove callback returning void

In reply to Uwe Kleine-König

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove().

In the error path emit an error message replacing the (less useful) message by the core. Apart from the improved error message there is no change in behaviour.

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/scsi/mac_scsi.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/scsi/mac_scsi.c +2 -3
index 2e511697fce3..181f16899fdc 100644
@@ -523,7 +523,7 @@ static int __init mac_scsi_probe(struct platform_device *pdev)
 	return error;
 }
 
-static int __exit mac_scsi_remove(struct platform_device *pdev)
+static void __exit mac_scsi_remove(struct platform_device *pdev)
 {
 	struct Scsi_Host *instance = platform_get_drvdata(pdev);
 
@@ -532,11 +532,10 @@ static int __exit mac_scsi_remove(struct platform_device *pdev)
 		free_irq(instance->irq, instance);
 	NCR5380_exit(instance);
 	scsi_host_put(instance);
-	return 0;
 }
 
 static struct platform_driver mac_scsi_driver = {
-	.remove = __exit_p(mac_scsi_remove),
+	.remove_new = __exit_p(mac_scsi_remove),
 	.driver = {
 		.name	= DRV_MODULE_NAME,
 	},
Signature · 1 line
2.42.0
#8 lore raw

PATCH 8/14 scsi: mvme16x: Convert to platform remove callback returning void

In reply to Uwe Kleine-König

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove().

In the error path emit an error message replacing the (less useful) message by the core. Apart from the improved error message there is no change in behaviour.

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/scsi/mvme16x_scsi.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/scsi/mvme16x_scsi.c +2 -4
index 21d638299ab8..e08a38e2a442 100644
@@ -103,7 +103,7 @@ static int mvme16x_probe(struct platform_device *dev)
 	return -ENODEV;
 }
 
-static int mvme16x_device_remove(struct platform_device *dev)
+static void mvme16x_device_remove(struct platform_device *dev)
 {
 	struct Scsi_Host *host = platform_get_drvdata(dev);
 	struct NCR_700_Host_Parameters *hostdata = shost_priv(host);
@@ -120,8 +120,6 @@ static int mvme16x_device_remove(struct platform_device *dev)
 	NCR_700_release(host);
 	kfree(hostdata);
 	free_irq(host->irq, host);
-
-	return 0;
 }
 
 static struct platform_driver mvme16x_scsi_driver = {
@@ -129,7 +127,7 @@ static struct platform_driver mvme16x_scsi_driver = {
 		.name           = "mvme16x-scsi",
 	},
 	.probe          = mvme16x_probe,
-	.remove         = mvme16x_device_remove,
+	.remove_new     = mvme16x_device_remove,
 };
 
 static int __init mvme16x_scsi_init(void)
Signature · 1 line
2.42.0
#9 lore raw

PATCH 9/14 scsi: qlogicpti: Convert to platform remove callback returning void

In reply to Uwe Kleine-König

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove().

In the error path emit an error message replacing the (less useful) message by the core. Apart from the improved error message there is no change in behaviour.

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/scsi/qlogicpti.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/scsi/qlogicpti.c +2 -4
index 3b95f7a6216f..5d560d9b8944 100644
@@ -1409,7 +1409,7 @@ static int qpti_sbus_probe(struct platform_device *op)
 	return -ENODEV;
 }
 
-static int qpti_sbus_remove(struct platform_device *op)
+static void qpti_sbus_remove(struct platform_device *op)
 {
 	struct qlogicpti *qpti = dev_get_drvdata(&op->dev);
 
@@ -1438,8 +1438,6 @@ static int qpti_sbus_remove(struct platform_device *op)
 		of_iounmap(&op->resource[0], qpti->sreg, sizeof(unsigned char));
 
 	scsi_host_put(qpti->qhost);
-
-	return 0;
 }
 
 static const struct of_device_id qpti_match[] = {
@@ -1465,7 +1463,7 @@ static struct platform_driver qpti_sbus_driver = {
 		.of_match_table = qpti_match,
 	},
 	.probe		= qpti_sbus_probe,
-	.remove		= qpti_sbus_remove,
+	.remove_new	= qpti_sbus_remove,
 };
 module_platform_driver(qpti_sbus_driver);
 
Signature · 1 line
2.42.0
#10 lore raw

PATCH 10/14 scsi: sgiwd93: Convert to platform remove callback returning void

In reply to Uwe Kleine-König

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove().

In the error path emit an error message replacing the (less useful) message by the core. Apart from the improved error message there is no change in behaviour.

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/scsi/sgiwd93.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/scsi/sgiwd93.c +2 -3
index 88e2b5eb9caa..b0bef83db7b6 100644
@@ -291,7 +291,7 @@ static int sgiwd93_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int sgiwd93_remove(struct platform_device *pdev)
+static void sgiwd93_remove(struct platform_device *pdev)
 {
 	struct Scsi_Host *host = platform_get_drvdata(pdev);
 	struct ip22_hostdata *hdata = (struct ip22_hostdata *) host->hostdata;
@@ -302,12 +302,11 @@ static int sgiwd93_remove(struct platform_device *pdev)
 	dma_free_noncoherent(&pdev->dev, HPC_DMA_SIZE, hdata->cpu, hdata->dma,
 			DMA_TO_DEVICE);
 	scsi_host_put(host);
-	return 0;
 }
 
 static struct platform_driver sgiwd93_driver = {
 	.probe  = sgiwd93_probe,
-	.remove = sgiwd93_remove,
+	.remove_new = sgiwd93_remove,
 	.driver = {
 		.name   = "sgiwd93",
 	}
Signature · 1 line
2.42.0
#11 lore raw

PATCH 11/14 scsi: sni_53c710: Convert to platform remove callback returning void

In reply to Uwe Kleine-König

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove().

In the error path emit an error message replacing the (less useful) message by the core. Apart from the improved error message there is no change in behaviour.

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/scsi/sni_53c710.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/scsi/sni_53c710.c +2 -4
index 678651b9b4dd..9df1c90a24c1 100644
@@ -104,7 +104,7 @@ static int snirm710_probe(struct platform_device *dev)
 	return -ENODEV;
 }
 
-static int snirm710_driver_remove(struct platform_device *dev)
+static void snirm710_driver_remove(struct platform_device *dev)
 {
 	struct Scsi_Host *host = dev_get_drvdata(&dev->dev);
 	struct NCR_700_Host_Parameters *hostdata =
@@ -115,13 +115,11 @@ static int snirm710_driver_remove(struct platform_device *dev)
 	free_irq(host->irq, host);
 	iounmap(hostdata->base);
 	kfree(hostdata);
-
-	return 0;
 }
 
 static struct platform_driver snirm710_driver = {
 	.probe	= snirm710_probe,
-	.remove	= snirm710_driver_remove,
+	.remove_new = snirm710_driver_remove,
 	.driver	= {
 		.name	= "snirm_53c710",
 	},
Signature · 1 line
2.42.0
#12 lore raw

PATCH 12/14 scsi: sun3: Convert to platform remove callback returning void

In reply to Uwe Kleine-König

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove().

In the error path emit an error message replacing the (less useful) message by the core. Apart from the improved error message there is no change in behaviour.

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/scsi/sun3_scsi.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/scsi/sun3_scsi.c +2 -3
index abf229b847a1..4a8cc2e8238e 100644
@@ -641,7 +641,7 @@ static int __init sun3_scsi_probe(struct platform_device *pdev)
 	return error;
 }
 
-static int __exit sun3_scsi_remove(struct platform_device *pdev)
+static void __exit sun3_scsi_remove(struct platform_device *pdev)
 {
 	struct Scsi_Host *instance = platform_get_drvdata(pdev);
 	struct NCR5380_hostdata *hostdata = shost_priv(instance);
@@ -654,11 +654,10 @@ static int __exit sun3_scsi_remove(struct platform_device *pdev)
 	if (udc_regs)
 		dvma_free(udc_regs);
 	iounmap(ioaddr);
-	return 0;
 }
 
 static struct platform_driver sun3_scsi_driver = {
-	.remove = __exit_p(sun3_scsi_remove),
+	.remove_new = __exit_p(sun3_scsi_remove),
 	.driver = {
 		.name	= DRV_MODULE_NAME,
 	},
Signature · 1 line
2.42.0
#13 lore raw

PATCH 13/14 scsi: sun3x_esp: Convert to platform remove callback returning void

In reply to Uwe Kleine-König

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove().

In the error path emit an error message replacing the (less useful) message by the core. Apart from the improved error message there is no change in behaviour.

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/scsi/sun3x_esp.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/scsi/sun3x_esp.c +2 -4
index 30f67cbf4a7a..09219c362acc 100644
@@ -243,7 +243,7 @@ static int esp_sun3x_probe(struct platform_device *dev)
 	return err;
 }
 
-static int esp_sun3x_remove(struct platform_device *dev)
+static void esp_sun3x_remove(struct platform_device *dev)
 {
 	struct esp *esp = dev_get_drvdata(&dev->dev);
 	unsigned int irq = esp->host->irq;
@@ -261,13 +261,11 @@ static int esp_sun3x_remove(struct platform_device *dev)
 			  esp->command_block_dma);
 
 	scsi_host_put(esp->host);
-
-	return 0;
 }
 
 static struct platform_driver esp_sun3x_driver = {
 	.probe          = esp_sun3x_probe,
-	.remove         = esp_sun3x_remove,
+	.remove_new     = esp_sun3x_remove,
 	.driver = {
 		.name   = "sun3x_esp",
 	},
Signature · 1 line
2.42.0
#14 lore raw

PATCH 14/14 scsi: sun_esp: Convert to platform remove callback returning void

In reply to Uwe Kleine-König

The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove().

In the error path emit an error message replacing the (less useful) message by the core. Apart from the improved error message there is no change in behaviour.

Trivially convert this driver from always returning zero in the remove callback to the void returning variant.

---
 drivers/scsi/sun_esp.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/scsi/sun_esp.c +2 -4
index afa9d02a33ec..64a7c2c6c5ff 100644
@@ -550,7 +550,7 @@ static int esp_sbus_probe(struct platform_device *op)
 	return ret;
 }
 
-static int esp_sbus_remove(struct platform_device *op)
+static void esp_sbus_remove(struct platform_device *op)
 {
 	struct esp *esp = dev_get_drvdata(&op->dev);
 	struct platform_device *dma_of = esp->dma;
@@ -581,8 +581,6 @@ static int esp_sbus_remove(struct platform_device *op)
 	dev_set_drvdata(&op->dev, NULL);
 
 	put_device(&dma_of->dev);
-
-	return 0;
 }
 
 static const struct of_device_id esp_match[] = {
@@ -605,7 +603,7 @@ static struct platform_driver esp_sbus_driver = {
 		.of_match_table = esp_match,
 	},
 	.probe		= esp_sbus_probe,
-	.remove		= esp_sbus_remove,
+	.remove_new	= esp_sbus_remove,
 };
 module_platform_driver(esp_sbus_driver);
 
Signature · 1 line
2.42.0
#15 lore raw
In reply to Uwe Kleine-König

Uwe,

Quoted 7 lines

this series converts all drivers below drivers/scsi to struct platform_driver::remove_new(). See commit 5c5a7680e67b ("platform:
Provide a remove callback that returns no value") for an extended explanation and the eventual goal.

All conversations are trivial, because all .remove() callbacks returned zero unconditionally.

Applied to 6.8/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#16 lore raw
In reply to Uwe Kleine-König
Quoted 9 lines · Uwe Kleine-König

this series converts all drivers below drivers/scsi to struct platform_driver::remove_new(). See commit 5c5a7680e67b ("platform:
Provide a remove callback that returns no value") for an extended explanation and the eventual goal.

All conversations are trivial, because all .remove() callbacks returned zero unconditionally.

[...]

Applied to 6.8/scsi-queue, thanks!

[01/14] scsi: a3000: Convert to platform remove callback returning void

        https://git.kernel.org/mkp/scsi/c/5854cdd04163
[02/14] scsi: a4000t: Convert to platform remove callback returning void
        https://git.kernel.org/mkp/scsi/c/688bbe398ca6
[03/14] scsi: atari: Convert to platform remove callback returning void
        https://git.kernel.org/mkp/scsi/c/3becb4cdf1c1
[04/14] scsi: bvme6000: Convert to platform remove callback returning void
        https://git.kernel.org/mkp/scsi/c/51a41ec6d36e
[05/14] scsi: jazz_esp: Convert to platform remove callback returning void
        https://git.kernel.org/mkp/scsi/c/c71ef3d1fb39
[06/14] scsi: mac_esp: Convert to platform remove callback returning void
        https://git.kernel.org/mkp/scsi/c/0b649224f712
[07/14] scsi: mac: Convert to platform remove callback returning void
        https://git.kernel.org/mkp/scsi/c/69b43bf38b11
[08/14] scsi: mvme16x: Convert to platform remove callback returning void
        https://git.kernel.org/mkp/scsi/c/f0baf76a2204
[09/14] scsi: qlogicpti: Convert to platform remove callback returning void
        https://git.kernel.org/mkp/scsi/c/e26eec9a4d25
[10/14] scsi: sgiwd93: Convert to platform remove callback returning void
        https://git.kernel.org/mkp/scsi/c/358987af1bda
[11/14] scsi: sni_53c710: Convert to platform remove callback returning void
        https://git.kernel.org/mkp/scsi/c/357a7fd2434e
[12/14] scsi: sun3: Convert to platform remove callback returning void
        https://git.kernel.org/mkp/scsi/c/15b016b2d023
[13/14] scsi: sun3x_esp: Convert to platform remove callback returning void
        https://git.kernel.org/mkp/scsi/c/e84bd0bb3068
[14/14] scsi: sun_esp: Convert to platform remove callback returning void
        https://git.kernel.org/mkp/scsi/c/6ff482eeebe5
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering