]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - arch/mips/kernel/mips-mt.c
[MIPS] FP affinity: Coding style cleanups
[mv-sheeva.git] / arch / mips / kernel / mips-mt.c
index c1373a6e668bec45583c7ff498e697b0a30355ca..b1b994dd41dbc1d0a722152ea1f8f0b4cfc894c9 100644 (file)
@@ -3,9 +3,11 @@
  * Copyright (C) 2005 Mips Technologies, Inc
  */
 
+#include <linux/device.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/cpumask.h>
+#include <linux/module.h>
 #include <linux/interrupt.h>
 #include <linux/security.h>
 
@@ -96,6 +98,10 @@ asmlinkage long mipsmt_sys_sched_setaffinity(pid_t pid, unsigned int len,
                goto out_unlock;
        }
 
+       retval = security_task_setscheduler(p, 0, NULL);
+       if (retval)
+               goto out_unlock;
+
        /* Record new user-specified CPU set for future reference */
        p->thread.user_cpus_allowed = new_mask;
 
@@ -103,7 +109,7 @@ asmlinkage long mipsmt_sys_sched_setaffinity(pid_t pid, unsigned int len,
        read_unlock(&tasklist_lock);
 
        /* Compute new global allowed CPU set if necessary */
-       if(p->thread.mflags & MF_FPUBOUND)
+       if ((p->thread.mflags & MF_FPUBOUND)
        && cpus_intersects(new_mask, mt_fpu_cpumask)) {
                cpus_and(effective_mask, new_mask, mt_fpu_cpumask);
                retval = set_cpus_allowed(p, effective_mask);
@@ -141,8 +147,9 @@ asmlinkage long mipsmt_sys_sched_getaffinity(pid_t pid, unsigned int len,
        p = find_process_by_pid(pid);
        if (!p)
                goto out_unlock;
-
-       retval = 0;
+       retval = security_task_getscheduler(p);
+       if (retval)
+               goto out_unlock;
 
        cpus_and(mask, p->thread.user_cpus_allowed, cpu_possible_map);
 
@@ -188,27 +195,31 @@ void mips_mt_regdump(unsigned long mvpctl)
        nvpe = ((mvpconf0 & MVPCONF0_PVPE) >> MVPCONF0_PVPE_SHIFT) + 1;
        ntc = ((mvpconf0 & MVPCONF0_PTC) >> MVPCONF0_PTC_SHIFT) + 1;
        printk("-- per-VPE State --\n");
-       for(i = 0; i < nvpe; i++) {
-           for(tc = 0; tc < ntc; tc++) {
+       for (i = 0; i < nvpe; i++) {
+               for (tc = 0; tc < ntc; tc++) {
                        settc(tc);
-               if((read_tc_c0_tcbind() & TCBIND_CURVPE) == i) {
-                   printk("  VPE %d\n", i);
-                   printk("   VPEControl : %08lx\n", read_vpe_c0_vpecontrol());
-                   printk("   VPEConf0 : %08lx\n", read_vpe_c0_vpeconf0());
-                   printk("   VPE%d.Status : %08lx\n",
-                               i, read_vpe_c0_status());
-                   printk("   VPE%d.EPC : %08lx\n", i, read_vpe_c0_epc());
-                   printk("   VPE%d.Cause : %08lx\n", i, read_vpe_c0_cause());
-                   printk("   VPE%d.Config7 : %08lx\n",
-                               i, read_vpe_c0_config7());
-                   break; /* Next VPE */
+                       if ((read_tc_c0_tcbind() & TCBIND_CURVPE) == i) {
+                               printk("  VPE %d\n", i);
+                               printk("   VPEControl : %08lx\n",
+                                      read_vpe_c0_vpecontrol());
+                               printk("   VPEConf0 : %08lx\n",
+                                      read_vpe_c0_vpeconf0());
+                               printk("   VPE%d.Status : %08lx\n",
+                                      i, read_vpe_c0_status());
+                               printk("   VPE%d.EPC : %08lx\n",
+                                      i, read_vpe_c0_epc());
+                               printk("   VPE%d.Cause : %08lx\n",
+                                      i, read_vpe_c0_cause());
+                               printk("   VPE%d.Config7 : %08lx\n",
+                                      i, read_vpe_c0_config7());
+                               break; /* Next VPE */
+                       }
                }
-           }
        }
        printk("-- per-TC State --\n");
-       for(tc = 0; tc < ntc; tc++) {
+       for (tc = 0; tc < ntc; tc++) {
                settc(tc);
-               if(read_tc_c0_tcbind() == read_c0_tcbind()) {
+               if (read_tc_c0_tcbind() == read_c0_tcbind()) {
                        /* Are we dumping ourself?  */
                        haltval = 0; /* Then we're not halted, and mustn't be */
                        tcstatval = flags; /* And pre-dump TCStatus is flags */
@@ -377,7 +388,7 @@ void mips_mt_set_cpuoptions(void)
                mt_fpemul_threshold = fpaff_threshold;
        } else {
                mt_fpemul_threshold =
-                       (FPUSEFACTOR * (loops_per_jiffy/(500000/HZ))) / HZ;
+                       (FPUSEFACTOR * (loops_per_jiffy / (500000 / HZ))) / HZ;
        }
        printk("FPU Affinity set after %ld emulations\n",
                        mt_fpemul_threshold);
@@ -448,3 +459,20 @@ void mt_cflush_release(void)
 #endif /* CONFIG_MIPS_MT_SMTC */
        /* FILL IN VSMP and AP/SP VERSIONS HERE */
 }
+
+struct class *mt_class;
+
+static int __init mt_init(void)
+{
+       struct class *mtc;
+
+       mtc = class_create(THIS_MODULE, "mt");
+       if (IS_ERR(mtc))
+               return PTR_ERR(mtc);
+
+       mt_class = mtc;
+
+       return 0;
+}
+
+subsys_initcall(mt_init);