]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/dev/dtrace/profile_prvd.c
xnu-4903.270.47.tar.gz
[apple/xnu.git] / bsd / dev / dtrace / profile_prvd.c
index a76f901c4d13ec52454db9f4b49517bb29f9462d..6d36e4cde7f72765b2bdc44e615ec507a45e89de 100644 (file)
@@ -84,7 +84,7 @@ static dtrace_provider_id_t profile_id;
  * On SPARC, the picture is further complicated because the compiler
  * optimizes away tail-calls -- so the following frames are optimized away:
  *
  * On SPARC, the picture is further complicated because the compiler
  * optimizes away tail-calls -- so the following frames are optimized away:
  *
- *     profile_fire
+ *      profile_fire
  *     cyclic_expire
  *
  * This gives three frames.  However, on DEBUG kernels, the cyclic_expire
  *     cyclic_expire
  *
  * This gives three frames.  However, on DEBUG kernels, the cyclic_expire
@@ -105,41 +105,41 @@ static dtrace_provider_id_t profile_id;
 #error Unknown architecture
 #endif
 
 #error Unknown architecture
 #endif
 
-#define        PROF_NAMELEN            15
+#define PROF_NAMELEN            15
 
 
-#define        PROF_PROFILE            0
-#define        PROF_TICK               1
-#define        PROF_PREFIX_PROFILE     "profile-"
-#define        PROF_PREFIX_TICK        "tick-"
+#define PROF_PROFILE            0
+#define PROF_TICK               1
+#define PROF_PREFIX_PROFILE     "profile-"
+#define PROF_PREFIX_TICK        "tick-"
 
 typedef struct profile_probe {
 
 typedef struct profile_probe {
-       char            prof_name[PROF_NAMELEN];
-       dtrace_id_t     prof_id;
-       int             prof_kind;
-       hrtime_t        prof_interval;
-       cyclic_id_t     prof_cyclic;
+       char            prof_name[PROF_NAMELEN];
+       dtrace_id_t     prof_id;
+       int             prof_kind;
+       hrtime_t        prof_interval;
+       cyclic_id_t     prof_cyclic;
 } profile_probe_t;
 
 typedef struct profile_probe_percpu {
 } profile_probe_t;
 
 typedef struct profile_probe_percpu {
-       hrtime_t        profc_expected;
-       hrtime_t        profc_interval;
-       profile_probe_t *profc_probe;
+       hrtime_t        profc_expected;
+       hrtime_t        profc_interval;
+       profile_probe_t *profc_probe;
 } profile_probe_percpu_t;
 
 } profile_probe_percpu_t;
 
-hrtime_t       profile_interval_min = NANOSEC / 5000;          /* 5000 hz */
-int            profile_aframes = 0;                            /* override */
+hrtime_t        profile_interval_min = NANOSEC / 5000;          /* 5000 hz */
+int             profile_aframes = 0;                            /* override */
 
 static int profile_rates[] = {
 
 static int profile_rates[] = {
-    97, 199, 499, 997, 1999,
-    4001, 4999, 0, 0, 0,
-    0, 0, 0, 0, 0,
-    0, 0, 0, 0, 0
+       97, 199, 499, 997, 1999,
+       4001, 4999, 0, 0, 0,
+       0, 0, 0, 0, 0,
+       0, 0, 0, 0, 0
 };
 
 static int profile_ticks[] = {
 };
 
 static int profile_ticks[] = {
-    1, 10, 100, 500, 1000,
-    5000, 0, 0, 0, 0,
-    0, 0, 0, 0, 0
+       1, 10, 100, 500, 1000,
+       5000, 0, 0, 0, 0,
+       0, 0, 0, 0, 0
 };
 
 /*
 };
 
 /*
@@ -149,9 +149,9 @@ static int profile_ticks[] = {
  * this gets its value from PROFILE_MAX_DEFAULT or profile-max-probes if it's
  * present in the profile.conf file.
  */
  * this gets its value from PROFILE_MAX_DEFAULT or profile-max-probes if it's
  * present in the profile.conf file.
  */
-#define        PROFILE_MAX_DEFAULT     1000    /* default max. number of probes */
-static uint32_t profile_max;           /* maximum number of profile probes */
-static uint32_t profile_total; /* current number of profile probes */
+#define PROFILE_MAX_DEFAULT     1000    /* default max. number of probes */
+static uint32_t profile_max;            /* maximum number of profile probes */
+static uint32_t profile_total;  /* current number of profile probes */
 
 static void
 profile_fire(void *arg)
 
 static void
 profile_fire(void *arg)
@@ -168,8 +168,7 @@ profile_fire(void *arg)
 
        if (NULL != kern_regs) {
                /* Kernel was interrupted. */
 
        if (NULL != kern_regs) {
                /* Kernel was interrupted. */
-               dtrace_probe(prof->prof_id, saved_state64(kern_regs)->isf.rip,  0x0, late, 0, 0);
-
+               dtrace_probe(prof->prof_id, saved_state64(kern_regs)->isf.rip, 0x0, late, 0, 0);
        } else {
                pal_register_cache_state(current_thread(), VALID);
                /* Possibly a user interrupt */
        } else {
                pal_register_cache_state(current_thread(), VALID);
                /* Possibly a user interrupt */
@@ -178,7 +177,7 @@ profile_fire(void *arg)
                if (NULL == tagged_regs) {
                        /* Too bad, so sad, no useful interrupt state. */
                        dtrace_probe(prof->prof_id, 0xcafebabe,
                if (NULL == tagged_regs) {
                        /* Too bad, so sad, no useful interrupt state. */
                        dtrace_probe(prof->prof_id, 0xcafebabe,
-                       0x0, late, 0, 0); /* XXX_BOGUS also see profile_usermode() below. */
+                           0x0, late, 0, 0); /* XXX_BOGUS also see profile_usermode() below. */
                } else if (is_saved_state64(tagged_regs)) {
                        x86_saved_state64_t *regs = saved_state64(tagged_regs);
 
                } else if (is_saved_state64(tagged_regs)) {
                        x86_saved_state64_t *regs = saved_state64(tagged_regs);
 
@@ -198,7 +197,7 @@ profile_fire(void *arg)
 
                if (arm_kern_regs->cpsr & 0xF) {
                        /* Kernel was interrupted. */
 
                if (arm_kern_regs->cpsr & 0xF) {
                        /* Kernel was interrupted. */
-                       dtrace_probe(prof->prof_id, arm_kern_regs->pc,  0x0, late, 0, 0);
+                       dtrace_probe(prof->prof_id, arm_kern_regs->pc, 0x0, late, 0, 0);
                } else {
                        /* Possibly a user interrupt */
                        arm_saved_state_t   *arm_user_regs = (arm_saved_state_t *)find_user_regs(current_thread());
                } else {
                        /* Possibly a user interrupt */
                        arm_saved_state_t   *arm_user_regs = (arm_saved_state_t *)find_user_regs(current_thread());
@@ -220,7 +219,7 @@ profile_fire(void *arg)
 
                if (saved_state64(arm_kern_regs)->cpsr & 0xF) {
                        /* Kernel was interrupted. */
 
                if (saved_state64(arm_kern_regs)->cpsr & 0xF) {
                        /* Kernel was interrupted. */
-                       dtrace_probe(prof->prof_id, saved_state64(arm_kern_regs)->pc,  0x0, late, 0, 0);
+                       dtrace_probe(prof->prof_id, saved_state64(arm_kern_regs)->pc, 0x0, late, 0, 0);
                } else {
                        /* Possibly a user interrupt */
                        arm_saved_state_t   *arm_user_regs = (arm_saved_state_t *)find_user_regs(current_thread());
                } else {
                        /* Possibly a user interrupt */
                        arm_saved_state_t   *arm_user_regs = (arm_saved_state_t *)find_user_regs(current_thread());
@@ -248,7 +247,7 @@ profile_tick(void *arg)
 
        if (NULL != kern_regs) {
                /* Kernel was interrupted. */
 
        if (NULL != kern_regs) {
                /* Kernel was interrupted. */
-               dtrace_probe(prof->prof_id, saved_state64(kern_regs)->isf.rip,  0x0, 0, 0, 0);
+               dtrace_probe(prof->prof_id, saved_state64(kern_regs)->isf.rip, 0x0, 0, 0, 0);
        } else {
                pal_register_cache_state(current_thread(), VALID);
                /* Possibly a user interrupt */
        } else {
                pal_register_cache_state(current_thread(), VALID);
                /* Possibly a user interrupt */
@@ -257,7 +256,7 @@ profile_tick(void *arg)
                if (NULL == tagged_regs) {
                        /* Too bad, so sad, no useful interrupt state. */
                        dtrace_probe(prof->prof_id, 0xcafebabe,
                if (NULL == tagged_regs) {
                        /* Too bad, so sad, no useful interrupt state. */
                        dtrace_probe(prof->prof_id, 0xcafebabe,
-                       0x0, 0, 0, 0); /* XXX_BOGUS also see profile_usermode() below. */
+                           0x0, 0, 0, 0); /* XXX_BOGUS also see profile_usermode() below. */
                } else if (is_saved_state64(tagged_regs)) {
                        x86_saved_state64_t *regs = saved_state64(tagged_regs);
 
                } else if (is_saved_state64(tagged_regs)) {
                        x86_saved_state64_t *regs = saved_state64(tagged_regs);
 
@@ -274,7 +273,7 @@ profile_tick(void *arg)
 
                if (NULL != arm_kern_regs) {
                        /* Kernel was interrupted. */
 
                if (NULL != arm_kern_regs) {
                        /* Kernel was interrupted. */
-                       dtrace_probe(prof->prof_id, arm_kern_regs->pc,  0x0, 0, 0, 0);
+                       dtrace_probe(prof->prof_id, arm_kern_regs->pc, 0x0, 0, 0, 0);
                } else {
                        /* Possibly a user interrupt */
                        arm_saved_state_t   *arm_user_regs = (arm_saved_state_t *)find_user_regs(current_thread());
                } else {
                        /* Possibly a user interrupt */
                        arm_saved_state_t   *arm_user_regs = (arm_saved_state_t *)find_user_regs(current_thread());
@@ -293,7 +292,7 @@ profile_tick(void *arg)
 
                if (NULL != arm_kern_regs) {
                        /* Kernel was interrupted. */
 
                if (NULL != arm_kern_regs) {
                        /* Kernel was interrupted. */
-                       dtrace_probe(prof->prof_id, saved_state64(arm_kern_regs)->pc,  0x0, 0, 0, 0);
+                       dtrace_probe(prof->prof_id, saved_state64(arm_kern_regs)->pc, 0x0, 0, 0, 0);
                } else {
                        /* Possibly a user interrupt */
                        arm_saved_state_t   *arm_user_regs = (arm_saved_state_t *)find_user_regs(current_thread());
                } else {
                        /* Possibly a user interrupt */
                        arm_saved_state_t   *arm_user_regs = (arm_saved_state_t *)find_user_regs(current_thread());
@@ -317,11 +316,13 @@ profile_create(hrtime_t interval, const char *name, int kind)
 {
        profile_probe_t *prof;
 
 {
        profile_probe_t *prof;
 
-       if (interval < profile_interval_min)
+       if (interval < profile_interval_min) {
                return;
                return;
+       }
 
 
-       if (dtrace_probe_lookup(profile_id, NULL, NULL, name) != 0)
+       if (dtrace_probe_lookup(profile_id, NULL, NULL, name) != 0) {
                return;
                return;
+       }
 
        atomic_add_32(&profile_total, 1);
        if (profile_total > profile_max) {
 
        atomic_add_32(&profile_total, 1);
        if (profile_total > profile_max) {
@@ -329,10 +330,11 @@ profile_create(hrtime_t interval, const char *name, int kind)
                return;
        }
 
                return;
        }
 
-       if (PROF_TICK == kind)
-               prof = kmem_zalloc(sizeof (profile_probe_t), KM_SLEEP);
-       else
-               prof = kmem_zalloc(sizeof (profile_probe_t) + NCPU*sizeof(profile_probe_percpu_t), KM_SLEEP);
+       if (PROF_TICK == kind) {
+               prof = kmem_zalloc(sizeof(profile_probe_t), KM_SLEEP);
+       } else {
+               prof = kmem_zalloc(sizeof(profile_probe_t) + NCPU * sizeof(profile_probe_percpu_t), KM_SLEEP);
+       }
 
        (void) strlcpy(prof->prof_name, name, sizeof(prof->prof_name));
        prof->prof_interval = interval;
 
        (void) strlcpy(prof->prof_name, name, sizeof(prof->prof_name));
        prof->prof_interval = interval;
@@ -365,23 +367,23 @@ profile_provide(void *arg, const dtrace_probedesc_t *desc)
                const char *name;
                hrtime_t mult;
        } suffixes[] = {
                const char *name;
                hrtime_t mult;
        } suffixes[] = {
-               { "ns",         NANOSEC / NANOSEC },
-               { "nsec",       NANOSEC / NANOSEC },
-               { "us",         NANOSEC / MICROSEC },
-               { "usec",       NANOSEC / MICROSEC },
-               { "ms",         NANOSEC / MILLISEC },
-               { "msec",       NANOSEC / MILLISEC },
-               { "s",          NANOSEC / SEC },
-               { "sec",        NANOSEC / SEC },
-               { "m",          NANOSEC * (hrtime_t)60 },
-               { "min",        NANOSEC * (hrtime_t)60 },
-               { "h",          NANOSEC * (hrtime_t)(60 * 60) },
-               { "hour",       NANOSEC * (hrtime_t)(60 * 60) },
-               { "d",          NANOSEC * (hrtime_t)(24 * 60 * 60) },
-               { "day",        NANOSEC * (hrtime_t)(24 * 60 * 60) },
-               { "hz",         0 },
+               { "ns", NANOSEC / NANOSEC },
+               { "nsec", NANOSEC / NANOSEC },
+               { "us", NANOSEC / MICROSEC },
+               { "usec", NANOSEC / MICROSEC },
+               { "ms", NANOSEC / MILLISEC },
+               { "msec", NANOSEC / MILLISEC },
+               { "s", NANOSEC / SEC },
+               { "sec", NANOSEC / SEC },
+               { "m", NANOSEC * (hrtime_t)60 },
+               { "min", NANOSEC * (hrtime_t)60 },
+               { "h", NANOSEC * (hrtime_t)(60 * 60) },
+               { "hour", NANOSEC * (hrtime_t)(60 * 60) },
+               { "d", NANOSEC * (hrtime_t)(24 * 60 * 60) },
+               { "day", NANOSEC * (hrtime_t)(24 * 60 * 60) },
+               { "hz", 0 },
                { NULL, 0 }
                { NULL, 0 }
-       };              
+       };
 
        if (desc == NULL) {
                char n[PROF_NAMELEN];
 
        if (desc == NULL) {
                char n[PROF_NAMELEN];
@@ -389,18 +391,20 @@ profile_provide(void *arg, const dtrace_probedesc_t *desc)
                /*
                 * If no description was provided, provide all of our probes.
                 */
                /*
                 * If no description was provided, provide all of our probes.
                 */
-               for (i = 0; i < (int)(sizeof (profile_rates) / sizeof (int)); i++) {
-                       if ((rate = profile_rates[i]) == 0)
+               for (i = 0; i < (int)(sizeof(profile_rates) / sizeof(int)); i++) {
+                       if ((rate = profile_rates[i]) == 0) {
                                continue;
                                continue;
+                       }
 
                        (void) snprintf(n, PROF_NAMELEN, "%s%d",
                            PROF_PREFIX_PROFILE, rate);
                        profile_create(NANOSEC / rate, n, PROF_PROFILE);
                }
 
 
                        (void) snprintf(n, PROF_NAMELEN, "%s%d",
                            PROF_PREFIX_PROFILE, rate);
                        profile_create(NANOSEC / rate, n, PROF_PROFILE);
                }
 
-               for (i = 0; i < (int)(sizeof (profile_ticks) / sizeof (int)); i++) {
-                       if ((rate = profile_ticks[i]) == 0)
+               for (i = 0; i < (int)(sizeof(profile_ticks) / sizeof(int)); i++) {
+                       if ((rate = profile_ticks[i]) == 0) {
                                continue;
                                continue;
+                       }
 
                        (void) snprintf(n, PROF_NAMELEN, "%s%d",
                            PROF_PREFIX_TICK, rate);
 
                        (void) snprintf(n, PROF_NAMELEN, "%s%d",
                            PROF_PREFIX_TICK, rate);
@@ -415,13 +419,15 @@ profile_provide(void *arg, const dtrace_probedesc_t *desc)
        for (i = 0; types[i].prefix != NULL; i++) {
                len = strlen(types[i].prefix);
 
        for (i = 0; types[i].prefix != NULL; i++) {
                len = strlen(types[i].prefix);
 
-               if (strncmp(name, types[i].prefix, len) != 0)
+               if (strncmp(name, types[i].prefix, len) != 0) {
                        continue;
                        continue;
+               }
                break;
        }
 
                break;
        }
 
-       if (types[i].prefix == NULL)
+       if (types[i].prefix == NULL) {
                return;
                return;
+       }
 
        kind = types[i].kind;
        j = strlen(name) - len;
 
        kind = types[i].kind;
        j = strlen(name) - len;
@@ -430,8 +436,9 @@ profile_provide(void *arg, const dtrace_probedesc_t *desc)
         * We need to start before any time suffix.
         */
        for (j = strlen(name); j >= len; j--) {
         * We need to start before any time suffix.
         */
        for (j = strlen(name); j >= len; j--) {
-               if (name[j] >= '0' && name[j] <= '9')
+               if (name[j] >= '0' && name[j] <= '9') {
                        break;
                        break;
+               }
                suffix = &name[j];
        }
 
                suffix = &name[j];
        }
 
@@ -441,15 +448,17 @@ profile_provide(void *arg, const dtrace_probedesc_t *desc)
         * Now determine the numerical value present in the probe name.
         */
        for (; j >= len; j--) {
         * Now determine the numerical value present in the probe name.
         */
        for (; j >= len; j--) {
-               if (name[j] < '0' || name[j] > '9')
+               if (name[j] < '0' || name[j] > '9') {
                        return;
                        return;
+               }
 
                val += (name[j] - '0') * mult;
                mult *= (hrtime_t)10;
        }
 
 
                val += (name[j] - '0') * mult;
                mult *= (hrtime_t)10;
        }
 
-       if (val == 0)
+       if (val == 0) {
                return;
                return;
+       }
 
        /*
         * Look-up the suffix to determine the multiplier.
 
        /*
         * Look-up the suffix to determine the multiplier.
@@ -462,8 +471,9 @@ profile_provide(void *arg, const dtrace_probedesc_t *desc)
                }
        }
 
                }
        }
 
-       if (suffixes[i].name == NULL && *suffix != '\0')
+       if (suffixes[i].name == NULL && *suffix != '\0') {
                return;
                return;
+       }
 
        if (mult == 0) {
                /*
 
        if (mult == 0) {
                /*
@@ -486,10 +496,11 @@ profile_destroy(void *arg, dtrace_id_t id, void *parg)
 
        ASSERT(prof->prof_cyclic == CYCLIC_NONE);
 
 
        ASSERT(prof->prof_cyclic == CYCLIC_NONE);
 
-       if (prof->prof_kind == PROF_TICK)
-               kmem_free(prof, sizeof (profile_probe_t));
-       else
-               kmem_free(prof, sizeof (profile_probe_t) + NCPU*sizeof(profile_probe_percpu_t));
+       if (prof->prof_kind == PROF_TICK) {
+               kmem_free(prof, sizeof(profile_probe_t));
+       } else {
+               kmem_free(prof, sizeof(profile_probe_t) + NCPU * sizeof(profile_probe_percpu_t));
+       }
 
        ASSERT(profile_total >= 1);
        atomic_add_32(&profile_total, -1);
 
        ASSERT(profile_total >= 1);
        atomic_add_32(&profile_total, -1);
@@ -564,7 +575,7 @@ profile_enable(void *arg, dtrace_id_t id, void *parg)
                prof->prof_cyclic = (cyclic_id_t)cyclic_add_omni(&omni); /* cast puns cyclic_id_list_t with cyclic_id_t */
        }
 
                prof->prof_cyclic = (cyclic_id_t)cyclic_add_omni(&omni); /* cast puns cyclic_id_list_t with cyclic_id_t */
        }
 
-       return(0);
+       return 0;
 }
 
 /*ARGSUSED*/
 }
 
 /*ARGSUSED*/
@@ -605,22 +616,21 @@ profile_getargdesc(void *arg, dtrace_id_t id, void *parg, dtrace_argdesc_t *desc
        profile_probe_t *prof = parg;
        const char *argdesc = NULL;
        switch (desc->dtargd_ndx) {
        profile_probe_t *prof = parg;
        const char *argdesc = NULL;
        switch (desc->dtargd_ndx) {
-               case 0:
-                       argdesc = "void*";
-                       break;
-               case 1:
-                       argdesc = "user_addr_t";
-                       break;
-               case 2:
-                       if (prof->prof_kind == PROF_PROFILE) {
-                               argdesc = "hrtime_t";
-                       }
-                       break;
+       case 0:
+               argdesc = "void*";
+               break;
+       case 1:
+               argdesc = "user_addr_t";
+               break;
+       case 2:
+               if (prof->prof_kind == PROF_PROFILE) {
+                       argdesc = "hrtime_t";
+               }
+               break;
        }
        if (argdesc) {
                strlcpy(desc->dtargd_native, argdesc, DTRACE_ARGTYPELEN);
        }
        if (argdesc) {
                strlcpy(desc->dtargd_native, argdesc, DTRACE_ARGTYPELEN);
-       }
-       else {
+       } else {
                desc->dtargd_ndx = DTRACE_ARGNONE;
        }
 }
                desc->dtargd_ndx = DTRACE_ARGNONE;
        }
 }
@@ -636,24 +646,24 @@ profile_usermode(void *arg, dtrace_id_t id, void *parg)
 }
 
 static dtrace_pattr_t profile_attr = {
 }
 
 static dtrace_pattr_t profile_attr = {
-{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
-{ DTRACE_STABILITY_UNSTABLE, DTRACE_STABILITY_UNSTABLE, DTRACE_CLASS_UNKNOWN },
-{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
-{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
-{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
+       { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
+       { DTRACE_STABILITY_UNSTABLE, DTRACE_STABILITY_UNSTABLE, DTRACE_CLASS_UNKNOWN },
+       { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+       { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
+       { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
 };
 
 static dtrace_pops_t profile_pops = {
 };
 
 static dtrace_pops_t profile_pops = {
-       .dtps_provide =         profile_provide,
-       .dtps_provide_module =  NULL,
-       .dtps_enable =          profile_enable,
-       .dtps_disable =         profile_disable,
-       .dtps_suspend =         NULL,
-       .dtps_resume =          NULL,
-       .dtps_getargdesc =      profile_getargdesc,
-       .dtps_getargval =       profile_getarg,
-       .dtps_usermode =        profile_usermode,
-       .dtps_destroy =         profile_destroy
+       .dtps_provide =         profile_provide,
+       .dtps_provide_module =  NULL,
+       .dtps_enable =          profile_enable,
+       .dtps_disable =         profile_disable,
+       .dtps_suspend =         NULL,
+       .dtps_resume =          NULL,
+       .dtps_getargdesc =      profile_getargdesc,
+       .dtps_getargval =       profile_getarg,
+       .dtps_usermode =        profile_usermode,
+       .dtps_destroy =         profile_destroy
 };
 
 static int
 };
 
 static int
@@ -665,12 +675,12 @@ profile_attach(dev_info_t *devi)
            DTRACE_PRIV_KERNEL | DTRACE_PRIV_USER, NULL,
            &profile_pops, NULL, &profile_id) != 0) {
                ddi_remove_minor_node(devi, NULL);
            DTRACE_PRIV_KERNEL | DTRACE_PRIV_USER, NULL,
            &profile_pops, NULL, &profile_id) != 0) {
                ddi_remove_minor_node(devi, NULL);
-               return (DDI_FAILURE);
+               return DDI_FAILURE;
        }
 
        profile_max = PROFILE_MAX_DEFAULT;
 
        }
 
        profile_max = PROFILE_MAX_DEFAULT;
 
-       return (DDI_SUCCESS);
+       return DDI_SUCCESS;
 }
 
 /*
 }
 
 /*
@@ -684,22 +694,24 @@ profile_detach(dev_info_t *devi, ddi_detach_cmd_t cmd)
        case DDI_DETACH:
                break;
        case DDI_SUSPEND:
        case DDI_DETACH:
                break;
        case DDI_SUSPEND:
-               return (DDI_SUCCESS);
+               return DDI_SUCCESS;
        default:
        default:
-               return (DDI_FAILURE);
+               return DDI_FAILURE;
        }
 
        }
 
-       if (dtrace_unregister(profile_id) != 0)
-               return (DDI_FAILURE);
+       if (dtrace_unregister(profile_id) != 0) {
+               return DDI_FAILURE;
+       }
 
        ddi_remove_minor_node(devi, NULL);
 
        ddi_remove_minor_node(devi, NULL);
-       return (DDI_SUCCESS);
+       return DDI_SUCCESS;
 }
 #endif /* __APPLE__ */
 
 d_open_t _profile_open;
 
 }
 #endif /* __APPLE__ */
 
 d_open_t _profile_open;
 
-int _profile_open(dev_t dev, int flags, int devtype, struct proc *p)
+int
+_profile_open(dev_t dev, int flags, int devtype, struct proc *p)
 {
 #pragma unused(dev,flags,devtype,p)
        return 0;
 {
 #pragma unused(dev,flags,devtype,p)
        return 0;
@@ -713,23 +725,24 @@ int _profile_open(dev_t dev, int flags, int devtype, struct proc *p)
  */
 static struct cdevsw profile_cdevsw =
 {
  */
 static struct cdevsw profile_cdevsw =
 {
-       _profile_open,          /* open */
-       eno_opcl,                       /* close */
-       eno_rdwrt,                      /* read */
-       eno_rdwrt,                      /* write */
-       eno_ioctl,                      /* ioctl */
+       _profile_open,          /* open */
+       eno_opcl,                       /* close */
+       eno_rdwrt,                      /* read */
+       eno_rdwrt,                      /* write */
+       eno_ioctl,                      /* ioctl */
        (stop_fcn_t *)nulldev, /* stop */
        (reset_fcn_t *)nulldev, /* reset */
        (stop_fcn_t *)nulldev, /* stop */
        (reset_fcn_t *)nulldev, /* reset */
-       NULL,                           /* tty's */
-       eno_select,                     /* select */
-       eno_mmap,                       /* mmap */
-       eno_strat,                      /* strategy */
-       eno_getc,                       /* getc */
-       eno_putc,                       /* putc */
-       0                                       /* type */
+       NULL,                           /* tty's */
+       eno_select,                     /* select */
+       eno_mmap,                       /* mmap */
+       eno_strat,                      /* strategy */
+       eno_getc,                       /* getc */
+       eno_putc,                       /* putc */
+       0                                       /* type */
 };
 
 };
 
-void profile_init( void )
+void
+profile_init( void )
 {
        int majdevno = cdevsw_add(PROFILE_MAJOR, &profile_cdevsw);
 
 {
        int majdevno = cdevsw_add(PROFILE_MAJOR, &profile_cdevsw);
 
@@ -738,6 +751,6 @@ void profile_init( void )
                return;
        }
 
                return;
        }
 
-       profile_attach( (dev_info_t*)(uintptr_t)majdevno);
+       profile_attach((dev_info_t*)(uintptr_t)majdevno);
 }
 #undef PROFILE_MAJOR
 }
 #undef PROFILE_MAJOR