generic: routerboot sysfs: add support for soft_config
[openwrt/staging/luka.git] / target / linux / generic / files / drivers / platform / mikrotik / routerboot.c
index 36ca90c1adeaa0d768da031bf9ac74c3b76a824e..f496dd7e0c766b2ae08e3daaf687c836742eb174 100644 (file)
@@ -166,15 +166,31 @@ static int __init routerboot_init(void)
        if (!rb_kobj)
                return -ENOMEM;
 
-       return rb_hardconfig_init(rb_kobj);
+       /*
+        * We ignore the following return values and always register.
+        * These init() routines are designed so that their failed state is
+        * always manageable by the corresponding exit() calls.
+        */
+       rb_hardconfig_init(rb_kobj);
+       rb_softconfig_init(rb_kobj);
+
+       return 0;
 }
 
 static void __exit routerboot_exit(void)
 {
+       rb_softconfig_exit();
        rb_hardconfig_exit();
        kobject_put(rb_kobj);   // recursive afaict
 }
 
+/* Common routines */
+
+ssize_t routerboot_tag_show_string(const u8 *pld, u16 pld_len, char *buf)
+{
+       return scnprintf(buf, pld_len+1, "%s\n", pld);
+}
+
 module_init(routerboot_init);
 module_exit(routerboot_exit);