[PATCH 18/50] staging: most: core: track aim modules with linked list

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

 



The core needs to know what modules are registered. This patch makes the
core keep track of the registered modules.

Signed-off-by: Christian Gromm <christian.gromm@xxxxxxxxxxxxx>
---
 drivers/staging/most/core.c | 6 ++++--
 drivers/staging/most/core.h | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 9a313cc..b9b9739 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -1300,8 +1300,8 @@ int most_register_aim(struct most_aim *aim)
 		pr_err("registering device %s failed\n", aim->name);
 		return ret;
 	}
-	pr_info("registered new application interfacing module %s\n",
-		aim->name);
+	list_add_tail(&aim->list, &mc.mod_list);
+	pr_info("registered new application interfacing module %s\n", aim->name);
 	return 0;
 }
 EXPORT_SYMBOL_GPL(most_register_aim);
@@ -1332,6 +1332,7 @@ int most_deregister_aim(struct most_aim *aim)
 		}
 	}
 	device_unregister(&aim->dev);
+	list_del(&aim->list);
 	pr_info("deregistering application interfacing module %s\n", aim->name);
 	return 0;
 }
@@ -1551,6 +1552,7 @@ static int __init most_init(void)
 
 	pr_info("init()\n");
 	INIT_LIST_HEAD(&instance_list);
+	INIT_LIST_HEAD(&mc.mod_list);
 	ida_init(&mdev_id);
 
 	mc.bus.name = "most",
diff --git a/drivers/staging/most/core.h b/drivers/staging/most/core.h
index b392ba5..0199be0 100644
--- a/drivers/staging/most/core.h
+++ b/drivers/staging/most/core.h
@@ -269,6 +269,7 @@ struct most_interface {
  */
 struct most_aim {
 	struct device dev;
+	struct list_head list;
 	const char *name;
 	int (*probe_channel)(struct most_interface *iface, int channel_idx,
 			     struct most_channel_config *cfg, char *name);
-- 
2.7.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux