xref: /linux/drivers/iio/industrialio-configfs.c (revision fada1935590f66dc6784981e0d557ca09013c847)
1 /*
2  * Industrial I/O configfs bits
3  *
4  * Copyright (c) 2015 Intel Corporation
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License version 2 as published by
8  * the Free Software Foundation.
9  */
10 
11 #include <linux/configfs.h>
12 #include <linux/module.h>
13 #include <linux/init.h>
14 #include <linux/kmod.h>
15 #include <linux/slab.h>
16 
17 #include <linux/iio/iio.h>
18 #include <linux/iio/configfs.h>
19 
20 static const struct config_item_type iio_root_group_type = {
21 	.ct_owner       = THIS_MODULE,
22 };
23 
24 struct configfs_subsystem iio_configfs_subsys = {
25 	.su_group = {
26 		.cg_item = {
27 			.ci_namebuf = "iio",
28 			.ci_type = &iio_root_group_type,
29 		},
30 	},
31 	.su_mutex = __MUTEX_INITIALIZER(iio_configfs_subsys.su_mutex),
32 };
33 EXPORT_SYMBOL(iio_configfs_subsys);
34 
35 static int __init iio_configfs_init(void)
36 {
37 	config_group_init(&iio_configfs_subsys.su_group);
38 
39 	return configfs_register_subsystem(&iio_configfs_subsys);
40 }
41 module_init(iio_configfs_init);
42 
43 static void __exit iio_configfs_exit(void)
44 {
45 	configfs_unregister_subsystem(&iio_configfs_subsys);
46 }
47 module_exit(iio_configfs_exit);
48 
49 MODULE_AUTHOR("Daniel Baluta <daniel.baluta@intel.com>");
50 MODULE_DESCRIPTION("Industrial I/O configfs support");
51 MODULE_LICENSE("GPL v2");
52