update hdmi driver: support 480p
[firefly-linux-kernel-4.4.55.git] / kernel / sys.c
index ce17760d9c516720af8dcf1522b47da937ba0023..75371c281fc35db0c077606bb3b5d884b37c0cc4 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;
 
@@ -911,16 +942,15 @@ change_okay:
 
 void do_sys_times(struct tms *tms)
 {
-       struct task_cputime cputime;
-       cputime_t cutime, cstime;
+       cputime_t tgutime, tgstime, cutime, cstime;
 
-       thread_group_cputime(current, &cputime);
        spin_lock_irq(&current->sighand->siglock);
+       thread_group_times(current, &tgutime, &tgstime);
        cutime = current->signal->cutime;
        cstime = current->signal->cstime;
        spin_unlock_irq(&current->sighand->siglock);
-       tms->tms_utime = cputime_to_clock_t(cputime.utime);
-       tms->tms_stime = cputime_to_clock_t(cputime.stime);
+       tms->tms_utime = cputime_to_clock_t(tgutime);
+       tms->tms_stime = cputime_to_clock_t(tgstime);
        tms->tms_cutime = cputime_to_clock_t(cutime);
        tms->tms_cstime = cputime_to_clock_t(cstime);
 }
@@ -963,6 +993,7 @@ SYSCALL_DEFINE2(setpgid, pid_t, pid, pid_t, pgid)
                pgid = pid;
        if (pgid < 0)
                return -EINVAL;
+       rcu_read_lock();
 
        /* From this point forward we keep holding onto the tasklist lock
         * so that our parent does not change from under us. -DaveM
@@ -1016,6 +1047,7 @@ SYSCALL_DEFINE2(setpgid, pid_t, pid, pid_t, pgid)
 out:
        /* All paths lead to here, thus we are safe. -DaveM */
        write_unlock_irq(&tasklist_lock);
+       rcu_read_unlock();
        return err;
 }
 
@@ -1338,8 +1370,7 @@ static void k_getrusage(struct task_struct *p, int who, struct rusage *r)
 {
        struct task_struct *t;
        unsigned long flags;
-       cputime_t utime, stime;
-       struct task_cputime cputime;
+       cputime_t tgutime, tgstime, utime, stime;
        unsigned long maxrss = 0;
 
        memset((char *) r, 0, sizeof *r);
@@ -1373,9 +1404,9 @@ static void k_getrusage(struct task_struct *p, int who, struct rusage *r)
                                break;
 
                case RUSAGE_SELF:
-                       thread_group_cputime(p, &cputime);
-                       utime = cputime_add(utime, cputime.utime);
-                       stime = cputime_add(stime, cputime.stime);
+                       thread_group_times(p, &tgutime, &tgstime);
+                       utime = cputime_add(utime, tgutime);
+                       stime = cputime_add(stime, tgstime);
                        r->ru_nvcsw += p->signal->nvcsw;
                        r->ru_nivcsw += p->signal->nivcsw;
                        r->ru_minflt += p->signal->min_flt;