[PATCH v3 08/26] staging: most: core: track aim modules with linked list

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

 



This patch makes the core keep track of the registered modules.

Signed-off-by: Christian Gromm <christian.gromm@xxxxxxxxxxxxx>
---
v2: fix patch numeration
v3: - add cover letter
    - create patches with -M switch to make file movement visible

 drivers/staging/most/core.c | 6 +++---
 drivers/staging/most/core.h | 1 +
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 1af5b1c..01a1a37 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -553,8 +553,6 @@ static ssize_t interface_show(struct device *dev,
 /*		     ___     ___
  *		     ___A I M___
  */
-static struct list_head aim_list;
-
 static ssize_t links_show(struct device *dev, struct device_attribute *attr,
 			  char *buf)
 {
@@ -1305,6 +1303,7 @@ int most_register_aim(struct most_aim *aim)
 		pr_err("registering device %s failed\n", aim->name);
 		return ret;
 	}
+	list_add_tail(&aim->list, &mc.mod_list);
 	pr_info("registered new application interfacing module %s\n", aim->name);
 	return 0;
 }
@@ -1336,6 +1335,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;
 }
@@ -1556,7 +1556,7 @@ static int __init most_init(void)
 
 	pr_info("init()\n");
 	INIT_LIST_HEAD(&instance_list);
-	INIT_LIST_HEAD(&aim_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 588aadb..eb12c62 100644
--- a/drivers/staging/most/core.h
+++ b/drivers/staging/most/core.h
@@ -268,6 +268,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);
-- 
1.9.1

_______________________________________________
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