[PATCH linux dev-4.7 2/2] drivers: fsi: scom: Add remove function
Eddie James
eajames at linux.vnet.ibm.com
Tue Feb 14 07:08:00 AEDT 2017
From: "Edward A. James" <eajames at us.ibm.com>
driver wasn't cleaning up miscdevice
Signed-off-by: Edward A. James <eajames at us.ibm.com>
---
drivers/fsi/fsi-scom.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/fsi/fsi-scom.c b/drivers/fsi/fsi-scom.c
index 22d280a..a439a5e 100644
--- a/drivers/fsi/fsi-scom.c
+++ b/drivers/fsi/fsi-scom.c
@@ -199,6 +199,21 @@ static int scom_probe(struct device *dev)
return misc_register(&scom->mdev);
}
+static int scom_remove(struct device *dev)
+{
+ struct scom_device *scom, *scom_tmp;
+ struct fsi_device *fsi_dev = to_fsi_dev(dev);
+
+ list_for_each_entry_safe(scom, scom_tmp, &scom_devices, link) {
+ if (scom->fsi_dev == fsi_dev) {
+ list_del(&scom->link);
+ misc_deregister(&scom->mdev);
+ }
+ }
+
+ return 0;
+}
+
static struct fsi_device_id scom_ids[] = {
{
.engine_type = FSI_ENGID_SCOM,
@@ -213,6 +228,7 @@ static struct fsi_driver scom_drv = {
.name = "scom",
.bus = &fsi_bus_type,
.probe = scom_probe,
+ .remove = scom_remove,
}
};
--
1.8.3.1
More information about the openbmc
mailing list