Skip to contentSkip to conversation

Media: remove incorrect __init/__exit markups

PATCH In review Dmitry Torokhov 4 participants 4 messages Feb 26, 2013

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

PATCH v2 1/1 Media: remove incorrect __init/__exit markups

Even if bus is not hot-pluggable, the devices can be unbound from the driver via sysfs, so we should not be using __exit annotations on remove() methods. The only exception is drivers registered with platform_driver_probe() which specifically disables sysfs bind/unbind attributes.

Similarly probe() methods should not be marked __init unless platform_driver_probe() is used.

---

v1->v2: removed __init markup on omap1_cam_probe() that was pointed out
by Guennadi Liakhovetski.

 drivers/media/i2c/adp1653.c                      | 4 ++--
 drivers/media/i2c/smiapp/smiapp-core.c           | 4 ++--
 drivers/media/platform/soc_camera/omap1_camera.c | 6 +++---
 drivers/media/radio/radio-si4713.c               | 4 ++--
 drivers/media/rc/ir-rx51.c                       | 4 ++--
 5 files changed, 11 insertions(+), 11 deletions(-)
drivers/media/i2c/adp1653.c +2 -2
index df16380..ef75abe 100644
@@ -447,7 +447,7 @@ free_and_quit:
 	return ret;
 }
 
-static int __exit adp1653_remove(struct i2c_client *client)
+static int adp1653_remove(struct i2c_client *client)
 {
 	struct v4l2_subdev *subdev = i2c_get_clientdata(client);
 	struct adp1653_flash *flash = to_adp1653_flash(subdev);
@@ -476,7 +476,7 @@ static struct i2c_driver adp1653_i2c_driver = {
 		.pm	= &adp1653_pm_ops,
 	},
 	.probe		= adp1653_probe,
-	.remove		= __exit_p(adp1653_remove),
+	.remove		= adp1653_remove,
 	.id_table	= adp1653_id_table,
 };
 
drivers/media/i2c/smiapp/smiapp-core.c +2 -2
index 83c7ed7..cae4f46 100644
@@ -2833,7 +2833,7 @@ static int smiapp_probe(struct i2c_client *client,
 				 sensor->src->pads, 0);
 }
 
-static int __exit smiapp_remove(struct i2c_client *client)
+static int smiapp_remove(struct i2c_client *client)
 {
 	struct v4l2_subdev *subdev = i2c_get_clientdata(client);
 	struct smiapp_sensor *sensor = to_smiapp_sensor(subdev);
@@ -2881,7 +2881,7 @@ static struct i2c_driver smiapp_i2c_driver = {
 		.pm = &smiapp_pm_ops,
 	},
 	.probe	= smiapp_probe,
-	.remove	= __exit_p(smiapp_remove),
+	.remove	= smiapp_remove,
 	.id_table = smiapp_id_table,
 };
 
drivers/media/platform/soc_camera/omap1_camera.c +3 -3
index 39a77f0..e5091b7 100644
@@ -1546,7 +1546,7 @@ static struct soc_camera_host_ops omap1_host_ops = {
 	.poll		= omap1_cam_poll,
 };
 
-static int __init omap1_cam_probe(struct platform_device *pdev)
+static int omap1_cam_probe(struct platform_device *pdev)
 {
 	struct omap1_cam_dev *pcdev;
 	struct resource *res;
@@ -1677,7 +1677,7 @@ exit:
 	return err;
 }
 
-static int __exit omap1_cam_remove(struct platform_device *pdev)
+static int omap1_cam_remove(struct platform_device *pdev)
 {
 	struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev);
 	struct omap1_cam_dev *pcdev = container_of(soc_host,
@@ -1709,7 +1709,7 @@ static struct platform_driver omap1_cam_driver = {
 		.name	= DRIVER_NAME,
 	},
 	.probe		= omap1_cam_probe,
-	.remove		= __exit_p(omap1_cam_remove),
+	.remove		= omap1_cam_remove,
 };
 
 module_platform_driver(omap1_cam_driver);
drivers/media/radio/radio-si4713.c +2 -2
index 1507c9d..8ae8442d 100644
@@ -328,7 +328,7 @@ exit:
 }
 
 /* radio_si4713_pdriver_remove - remove the device */
-static int __exit radio_si4713_pdriver_remove(struct platform_device *pdev)
+static int radio_si4713_pdriver_remove(struct platform_device *pdev)
 {
 	struct v4l2_device *v4l2_dev = platform_get_drvdata(pdev);
 	struct radio_si4713_device *rsdev = container_of(v4l2_dev,
@@ -350,7 +350,7 @@ static struct platform_driver radio_si4713_pdriver = {
 		.name	= "radio-si4713",
 	},
 	.probe		= radio_si4713_pdriver_probe,
-	.remove         = __exit_p(radio_si4713_pdriver_remove),
+	.remove         = radio_si4713_pdriver_remove,
 };
 
 module_platform_driver(radio_si4713_pdriver);
drivers/media/rc/ir-rx51.c +2 -2
index 8ead492..31b955b 100644
@@ -464,14 +464,14 @@ static int lirc_rx51_probe(struct platform_device *dev)
 	return 0;
 }
 
-static int __exit lirc_rx51_remove(struct platform_device *dev)
+static int lirc_rx51_remove(struct platform_device *dev)
 {
 	return lirc_unregister_driver(lirc_rx51_driver.minor);
 }
 
 struct platform_driver lirc_rx51_platform_driver = {
 	.probe		= lirc_rx51_probe,
-	.remove		= __exit_p(lirc_rx51_remove),
+	.remove		= lirc_rx51_remove,
 	.suspend	= lirc_rx51_suspend,
 	.resume		= lirc_rx51_resume,
 	.driver		= {
Signature · 5 lines
1.7.11.7


-- 
Dmitry
Acked-by on v2 1/1
#1 lore raw
Quoted 9 lines · Dmitry Torokhov

Even if bus is not hot-pluggable, the devices can be unbound from the driver via sysfs, so we should not be using __exit annotations on remove() methods. The only exception is drivers registered with platform_driver_probe() which specifically disables sysfs bind/unbind attributes.

Similarly probe() methods should not be marked __init unless platform_driver_probe() is used.

Quoted 7 lines

---

v1->v2: removed __init markup on omap1_cam_probe() that was pointed out
by Guennadi Liakhovetski.

 drivers/media/platform/soc_camera/omap1_camera.c | 6 +++---

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

maintainer Acked-by on v2 1/1
#2 lore raw
In reply to Dmitry Torokhov

Hi Dmitry,

Quoted 58 lines · Dmitry Torokhov

Even if bus is not hot-pluggable, the devices can be unbound from the driver via sysfs, so we should not be using __exit annotations on remove() methods. The only exception is drivers registered with platform_driver_probe() which specifically disables sysfs bind/unbind attributes.

Similarly probe() methods should not be marked __init unless platform_driver_probe() is used.

---

v1->v2: removed __init markup on omap1_cam_probe() that was pointed out
by Guennadi Liakhovetski.

 drivers/media/i2c/adp1653.c                      | 4 ++--
 drivers/media/i2c/smiapp/smiapp-core.c           | 4 ++--
 drivers/media/platform/soc_camera/omap1_camera.c | 6 +++---
 drivers/media/radio/radio-si4713.c               | 4 ++--
 drivers/media/rc/ir-rx51.c                       | 4 ++--
 5 files changed, 11 insertions(+), 11 deletions(-)
drivers/media/i2c/adp1653.c +2 -2
index df16380..ef75abe 100644
@@ -447,7 +447,7 @@ free_and_quit:
 	return ret;
 }
 
-static int __exit adp1653_remove(struct i2c_client *client)
+static int adp1653_remove(struct i2c_client *client)
 {
 	struct v4l2_subdev *subdev = i2c_get_clientdata(client);
 	struct adp1653_flash *flash = to_adp1653_flash(subdev);
@@ -476,7 +476,7 @@ static struct i2c_driver adp1653_i2c_driver = {
 		.pm	= &adp1653_pm_ops,
 	},
 	.probe		= adp1653_probe,
-	.remove		= __exit_p(adp1653_remove),
+	.remove		= adp1653_remove,
 	.id_table	= adp1653_id_table,
 };
 
drivers/media/i2c/smiapp/smiapp-core.c +1 -1
index 83c7ed7..cae4f46 100644
@@ -2833,7 +2833,7 @@ static int smiapp_probe(struct i2c_client *client,
 				 sensor->src->pads, 0);
 }
 
-static int __exit smiapp_remove(struct i2c_client *client)
+static int smiapp_remove(struct i2c_client *client)
 {
 	struct v4l2_subdev *subdev = i2c_get_clientdata(client);
 	struct smiapp_sensor *sensor = to_smiapp_sensor(subdev);

drivers/media/i2c/smiapp/smiapp-core.c static struct i2c_driver smiapp_i2c_driver = { · line 2887

Quoted 8 lines
drivers/media/i2c/smiapp/smiapp-core.c +1 -1
@@ -2881,7 +2881,7 @@ static struct i2c_driver smiapp_i2c_driver = {
 		.pm = &smiapp_pm_ops,
 	},
 	.probe	= smiapp_probe,
-	.remove	= __exit_p(smiapp_remove),
+	.remove	= smiapp_remove,
 	.id_table = smiapp_id_table,
 };
 

For adp1653 and smiapp:

Signature · 2 lines
Sakari Ailus
e-mail: [email protected]	XMPP: [email protected]
Acked-by on v2 1/1
#3 lore raw
In reply to Dmitry Torokhov
Quoted 33 lines · Dmitry Torokhov

Even if bus is not hot-pluggable, the devices can be unbound from the driver via sysfs, so we should not be using __exit annotations on remove() methods. The only exception is drivers registered with platform_driver_probe() which specifically disables sysfs bind/unbind attributes.

Similarly probe() methods should not be marked __init unless platform_driver_probe() is used.

---

v1->v2: removed __init markup on omap1_cam_probe() that was pointed out
by Guennadi Liakhovetski.

 drivers/media/i2c/adp1653.c                      | 4 ++--
 drivers/media/i2c/smiapp/smiapp-core.c           | 4 ++--
 drivers/media/platform/soc_camera/omap1_camera.c | 6 +++---
 drivers/media/radio/radio-si4713.c               | 4 ++--
 drivers/media/rc/ir-rx51.c                       | 4 ++--
 5 files changed, 11 insertions(+), 11 deletions(-)
drivers/media/rc/ir-rx51.c +1 -1
index 8ead492..31b955b 100644
@@ -464,14 +464,14 @@ static int lirc_rx51_probe(struct platform_device *dev)
 	return 0;
 }
 
-static int __exit lirc_rx51_remove(struct platform_device *dev)
+static int lirc_rx51_remove(struct platform_device *dev)
 {

drivers/media/rc/ir-rx51.c static int lirc_rx51_probe(struct platform_device *dev) · line 477

Quoted 10 lines
drivers/media/rc/ir-rx51.c +1 -1
 	return lirc_unregister_driver(lirc_rx51_driver.minor);
 }
 
 struct platform_driver lirc_rx51_platform_driver = {
 	.probe		= lirc_rx51_probe,
-	.remove		= __exit_p(lirc_rx51_remove),
+	.remove		= lirc_rx51_remove,
 	.suspend	= lirc_rx51_suspend,
 	.resume		= lirc_rx51_resume,
 	.driver		= {

For ir-rx51:

Thanks!

-Timo