drivers: power: report battery voltage in AOSP compatible format
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / mtd / mtdcore.c
index c400c57c394aaddb26147bfe2b1955c6716f74d5..b6455246e6572574324711e42ea2df89b65047d8 100644 (file)
@@ -40,6 +40,7 @@
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
+#include <linux/seq_file.h>
 
 #include "mtdcore.h"
 
@@ -1114,6 +1115,15 @@ EXPORT_SYMBOL_GPL(mtd_kmalloc_up_to);
 /*====================================================================*/
 /* Support for /proc/mtd */
 
+static struct proc_dir_entry *proc_mtd;
+
+#define DYNAMIC_CHANGE_MTD_WRITEABLE
+#ifdef DYNAMIC_CHANGE_MTD_WRITEABLE //tonykuo 2013-11-05
+static struct proc_dir_entry *entry;
+extern int mtd_writeable_proc_write(struct file *file, const char *buffer, unsigned long count, void *data);
+extern int mtd_change_proc_write(struct file *file, const char *buffer, unsigned long count, void *data);
+#endif
+
 static int mtd_proc_show(struct seq_file *m, void *v)
 {
        struct mtd_info *mtd;
@@ -1161,6 +1171,17 @@ static int __init mtd_bdi_init(struct backing_dev_info *bdi, const char *name)
 
 static struct proc_dir_entry *proc_mtd;
 
+//tonykuo 2013-11-05
+static const struct file_operations mtd_write_proc_fops = {
+       .owner = THIS_MODULE,
+       .write = mtd_writeable_proc_write,
+};
+
+static const struct file_operations mtd_change_proc_fops = {
+       .owner = THIS_MODULE,
+       .write = mtd_change_proc_write,
+};
+
 static int __init init_mtd(void)
 {
        int ret;
@@ -1183,6 +1204,18 @@ static int __init init_mtd(void)
 
        proc_mtd = proc_create("mtd", 0, NULL, &mtd_proc_ops);
 
+#ifdef DYNAMIC_CHANGE_MTD_WRITEABLE //tonykuo 2013-11-05
+    entry = proc_create("driver/mtd_writeable", 0600, NULL, &mtd_write_proc_fops);
+        if (entry != NULL) {
+            printk( "mtd_writeable success\n");
+        }
+
+    entry = proc_create("driver/mtd_change", 0600, NULL, &mtd_change_proc_fops);
+        if (entry != NULL) {
+            printk( "mtd_change success\n");
+        }
+#endif
+
        ret = init_mtdchar();
        if (ret)
                goto out_procfs;
@@ -1208,6 +1241,13 @@ static void __exit cleanup_mtd(void)
        cleanup_mtdchar();
        if (proc_mtd)
                remove_proc_entry("mtd", NULL);
+               
+#ifdef DYNAMIC_CHANGE_MTD_WRITEABLE //tonykuo 2013-11-05
+    if (entry) {
+            remove_proc_entry("driver/mtd_writeable", NULL);
+            remove_proc_entry("driver/mtd_change", NULL);
+    }
+#endif
        class_unregister(&mtd_class);
        bdi_destroy(&mtd_bdi_unmappable);
        bdi_destroy(&mtd_bdi_ro_mappable);