'mod i2c read bug' and 'add i2c read/write interface'
[firefly-linux-kernel-4.4.55.git] / kernel / sys.c
index ce17760d9c516720af8dcf1522b47da937ba0023..3bfc93832e5a37400b655ab16223aaa087d4ccde 100644 (file)
 #include <asm/uaccess.h>
 #include <asm/io.h>
 #include <asm/unistd.h>
+/***************
+*       DEBUG
+****************/
+#define RESTART_DEBUG
+#ifdef RESTART_DEBUG
+#define restart_dbg(format, arg...) \
+       printk("RESTART_DEBUG : " format "\n" , ## arg)
+#else
+#define restart_dbg(format, arg...) do {} while (0)
+#endif
+
+
 
 #ifndef SET_UNALIGN_CTL
 # define SET_UNALIGN_CTL(a,b)  (-EINVAL)
@@ -302,11 +314,16 @@ void kernel_restart_prepare(char *cmd)
  */
 void kernel_restart(char *cmd)
 {
+       /*
+       *  debug trace
+       */
+       restart_dbg("%s->%d->cmd=%s",__FUNCTION__,__LINE__,cmd);
+       
        kernel_restart_prepare(cmd);
        if (!cmd)
-               printk(KERN_EMERG "Restarting system.\n");
+               printk( "Restarting system.\n");
        else
-               printk(KERN_EMERG "Restarting system with command '%s'.\n", cmd);
+               printk( "Restarting system with command '%s'.\n", cmd);
        machine_restart(cmd);
 }
 EXPORT_SYMBOL_GPL(kernel_restart);
@@ -384,6 +401,11 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
        lock_kernel();
        switch (cmd) {
        case LINUX_REBOOT_CMD_RESTART:
+               /*
+               *  debug trace
+               */
+               restart_dbg("%s->%d->cmd=%x",__FUNCTION__,__LINE__,cmd);
+               
                kernel_restart(NULL);
                break;
 
@@ -402,6 +424,11 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
                panic("cannot halt");
 
        case LINUX_REBOOT_CMD_POWER_OFF:
+               /*
+               *  debug trace
+               */
+               restart_dbg("%s->%d->cmd=%x",__FUNCTION__,__LINE__,cmd);
+               
                kernel_power_off();
                unlock_kernel();
                do_exit(0);
@@ -413,7 +440,11 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
                        return -EFAULT;
                }
                buffer[sizeof(buffer) - 1] = '\0';
-
+               /*
+               *  debug trace
+               */
+               restart_dbg("%s->%d->cmd=%x args=%s",__FUNCTION__,__LINE__,cmd,buffer);
+               
                kernel_restart(buffer);
                break;