Skip to contentSkip to conversation

arch/sh: Drop return value from platform_driver remove functions

PATCH Applied Julia Lawall 2 participants 2 messages Dec 10, 2008

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

PATCH 15/28 arch/sh: Drop return value from platform_driver remove functions

From: Julia Lawall <[email protected]>

The return value of the remove function of a driver structure, and thus of a platform_driver structure, is ultimately ignored, and is thus unnecessary. This patch removes the return value for the remove function stored in a platform_driver structure. For the files in this patch, the return values are always 0.

A simplified version of the semantic patch that makes this change is as
follows: (http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@r@
struct platform_driver I;
identifier a,f;
position p;
@@
I.remove = \(f@p\|a(f@p)\);

@void_called@
identifier r.f;
position p;
@@
f@p(...);

@called@
identifier r.f;
position p1 != void_called.p;
@@
f@p1(...)

@localfn@
identifier r.f;
@@
static int f(...) { ... }

@depends on !called && localfn@
struct platform_driver I;
identifier a,f;
position r.p;
@@

I.
- remove
+ remove_new
= \(f@p\|a(f@p)\);

@depends on !called && localfn@
identifier r.f,i;
constant C;
expression E;
@@

- int
+ void

       f(...) {

<...
(
- return \(C\|i\);
+ return;
|

-  return E;
+  E;
+  return;

)
...>
}
// </smpl>

---
 arch/sh/drivers/heartbeat.c   |    6 ++----
 arch/sh/drivers/push-switch.c |    6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)
arch/sh/drivers/heartbeat.c +2 -4
index 938817e..8d8c8a3 100644
@@ -116,7 +116,7 @@ static int heartbeat_drv_probe(struct platform_device *pdev)
 	return mod_timer(&hd->timer, jiffies + 1);
 }
 
-static int heartbeat_drv_remove(struct platform_device *pdev)
+static void heartbeat_drv_remove(struct platform_device *pdev)
 {
 	struct heartbeat_data *hd = platform_get_drvdata(pdev);
 
@@ -127,13 +127,11 @@ static int heartbeat_drv_remove(struct platform_device *pdev)
 
 	if (!pdev->dev.platform_data)
 		kfree(hd);
-
-	return 0;
 }
 
 static struct platform_driver heartbeat_driver = {
 	.probe		= heartbeat_drv_probe,
-	.remove		= heartbeat_drv_remove,
+	.remove_new	= heartbeat_drv_remove,
 	.driver		= {
 		.name	= DRV_NAME,
 	},
arch/sh/drivers/push-switch.c +2 -4
index 725be6d..747c787 100644
@@ -96,7 +96,7 @@ err:
 	return ret;
 }
 
-static int switch_drv_remove(struct platform_device *pdev)
+static void switch_drv_remove(struct platform_device *pdev)
 {
 	struct push_switch *psw = platform_get_drvdata(pdev);
 	struct push_switch_platform_info *psw_info = pdev->dev.platform_data;
@@ -111,13 +111,11 @@ static int switch_drv_remove(struct platform_device *pdev)
 	free_irq(irq, pdev);
 
 	kfree(psw);
-
-	return 0;
 }
 
 static struct platform_driver switch_driver = {
 	.probe		= switch_drv_probe,
-	.remove		= switch_drv_remove,
+	.remove_new	= switch_drv_remove,
 	.driver		= {
 		.name	= DRV_NAME,
 	},
Applied
#1 lore raw
Quoted 11 lines · Julia Lawall

From: Julia Lawall <[email protected]>

The return value of the remove function of a driver structure, and thus of a platform_driver structure, is ultimately ignored, and is thus unnecessary. This patch removes the return value for the remove function stored in a platform_driver structure. For the files in this patch, the return values are always 0.

A simplified version of the semantic patch that makes this change is as
follows: (http://www.emn.fr/x-info/coccinelle/)

Interesting definition of simplified ;-)

Applied, thanks.