[PATCH v2 04/10] reset: raspberrypi: Release firmware handle on unbind

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Upon unbinding the device make sure we release RPi's firmware interface.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@xxxxxxx>
---
 drivers/reset/reset-raspberrypi.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/reset/reset-raspberrypi.c b/drivers/reset/reset-raspberrypi.c
index 02f59c06f69b..29311192e2c9 100644
--- a/drivers/reset/reset-raspberrypi.c
+++ b/drivers/reset/reset-raspberrypi.c
@@ -99,7 +99,17 @@ static int rpi_reset_probe(struct platform_device *pdev)
 	priv->rcdev.ops = &rpi_reset_ops;
 	priv->rcdev.of_node = dev->of_node;
 
-	return devm_reset_controller_register(dev, &priv->rcdev);
+	return reset_controller_register(&priv->rcdev);
+}
+
+static int rpi_reset_remove(struct platform_device *pdev)
+{
+	struct rpi_reset *priv = platform_get_drvdata(pdev);
+
+	reset_controller_unregister(&priv->rcdev);
+	rpi_firmware_put(priv->fw);
+
+	return 0;
 }
 
 static const struct of_device_id rpi_reset_of_match[] = {
@@ -110,6 +120,7 @@ MODULE_DEVICE_TABLE(of, rpi_reset_of_match);
 
 static struct platform_driver rpi_reset_driver = {
 	.probe	= rpi_reset_probe,
+	.remove	= rpi_reset_remove,
 	.driver	= {
 		.name = "raspberrypi-reset",
 		.of_match_table = rpi_reset_of_match,
-- 
2.28.0




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux