Hmm, the server must have dropped the attachment. Another try...
--- sys/kern/kern_cpu.c.orig    Mon Aug  1 14:42:26 2005
+++ sys/kern/kern_cpu.c Mon Aug  1 23:52:06 2005
@@ -650,19 +650,7 @@
 
        CF_MTX_ASSERT(&sc->lock);
 
-       TAILQ_FOREACH(search, &sc->all_levels, link) {
-               /* Skip this level if we've already modified it. */
-               for (i = 0; i < search->rel_count; i++) {
-                       if (search->rel_set[i].dev == set_arr->sets[0].dev)
-                               break;
-               }
-               if (i != search->rel_count) {
-                       CF_DEBUG("skipping modified level, freq %d (dev %s)\n",
-                           search->total_set.freq,
-                           device_get_nameunit(search->rel_set[i].dev));
-                       continue;
-               }
-
+       TAILQ_FOREACH_REVERSE(search, &sc->all_levels, cf_level_lst, link) {
                /* Add each setting to the level, duplicating if necessary. */
                for (i = 0; i < set_arr->count; i++) {
                        set = &set_arr->sets[i];
@@ -677,10 +665,11 @@
 
                        /*
                         * The new level was a duplicate of an existing level
-                        * so we freed it.  Go to the next setting.
+                        * or the relative setting was too low so we freed it.
+                        * No need to try lower settings of this driver.
                         */
                        if (fill == NULL)
-                               continue;
+                               break;
 
                        /* Add this setting to the existing or new level. */
                        KASSERT(fill->rel_count < MAX_SETTINGS,
@@ -756,24 +745,28 @@
         */
        list = &sc->all_levels;
        if (TAILQ_EMPTY(list)) {
+               /* Does this ever happen? */
                CF_DEBUG("dup done, inserted %d at head\n", fill_set->freq);
                TAILQ_INSERT_HEAD(list, fill, link);
        } else {
                TAILQ_FOREACH_REVERSE(itr, list, cf_level_lst, link) {
                        itr_set = &itr->total_set;
-                       if (CPUFREQ_CMP(fill_set->freq, itr_set->freq)) {
-                               CF_DEBUG(
-                       "dup done, freeing new level %d, matches %d\n",
-                                   fill_set->freq, itr_set->freq);
-                               free(fill, M_TEMP);
-                               fill = NULL;
-                               break;
-                       } else if (fill_set->freq < itr_set->freq) {
+                       if (fill_set->freq > itr_set->freq) {
+                               continue;
+                       } else if (fill_set->freq < itr_set->freq &&
+                           fill->abs_set.freq <= itr->abs_set.freq) {
                                CF_DEBUG(
                        "dup done, inserting new level %d after %d\n",
                                    fill_set->freq, itr_set->freq);
                                TAILQ_INSERT_AFTER(list, itr, fill, link);
                                sc->all_count++;
+                               break;
+                       } else {
+                               CF_DEBUG(
+                       "dup done, freeing new level %d, worse than existing 
%d\n",
+                                   fill_set->freq, itr_set->freq);
+                               free(fill, M_TEMP);
+                               fill = NULL;
                                break;
                        }
                }
_______________________________________________
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to