summaryrefslogtreecommitdiff
path: root/io-module/mtac.c
diff options
context:
space:
mode:
authorMike Fiore <mfiore@multitech.com>2014-09-23 10:35:11 -0500
committerMike Fiore <mfiore@multitech.com>2014-09-23 10:35:11 -0500
commita21c24fa2486e4d4a3b25d0dcbf873ae62fdbcec (patch)
tree6d78da220c6235cd33408acbd22adf9b4038bbc1 /io-module/mtac.c
parent24c012065ca7a764e1e51a9cfc4422d649cd2851 (diff)
downloadmts-io-a21c24fa2486e4d4a3b25d0dcbf873ae62fdbcec.tar.gz
mts-io-a21c24fa2486e4d4a3b25d0dcbf873ae62fdbcec.tar.bz2
mts-io-a21c24fa2486e4d4a3b25d0dcbf873ae62fdbcec.zip
mts-io: clean up accessory card support
use custom kernel config option MTS_NUM_ACCESSORY_PORTS to find out how many slots exist (mostly) dynamically handle any number of accessory cards streamline code to make it easier to add accessory cards in the future
Diffstat (limited to 'io-module/mtac.c')
-rw-r--r--io-module/mtac.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/io-module/mtac.c b/io-module/mtac.c
new file mode 100644
index 0000000..b9a2520
--- /dev/null
+++ b/io-module/mtac.c
@@ -0,0 +1,22 @@
+static struct kobj_attribute* create_attribute(const char* _name, umode_t _mode) {
+ char* attr_name;
+ struct kobj_attribute* _attr;
+
+ _attr = kzalloc(sizeof(struct kobj_attribute), GFP_KERNEL);
+ if (! _attr) {
+ log_error("kzalloc of attribute %s failed", _name);
+ return NULL;
+ }
+
+ sysfs_attr_init(_attr);
+ attr_name = kstrdup(_name, GFP_KERNEL);
+ if (! attr_name) {
+ log_error("GFP_KERNEL dup failed for attribute [%s]", _name);
+ return NULL;
+ }
+
+ _attr->attr.name = attr_name;
+ _attr->attr.mode = _mode;
+
+ return _attr;
+}