Message ID | 534C4E86.4060304@semaphore.gr (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
On 15 April 2014 02:39, Stratos Karafotis <stratosk@semaphore.gr> wrote: > The cpufreq core supports the cpufreq_for_each_entry macro helper > for iteration over the cpufreq_frequency_table, so use it. > > It should have no functional changes. > > Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr> > --- > drivers/cpufreq/longhaul.c | 13 ++++++------- > 1 file changed, 6 insertions(+), 7 deletions(-) > > diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c > index d00e5d1..6de99c4 100644 > --- a/drivers/cpufreq/longhaul.c > +++ b/drivers/cpufreq/longhaul.c > @@ -528,6 +528,7 @@ static int longhaul_get_ranges(void) > > static void longhaul_setup_voltagescaling(void) > { > + struct cpufreq_frequency_table *freq; Be consistent and use 'pos' here as well. -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c index d00e5d1..6de99c4 100644 --- a/drivers/cpufreq/longhaul.c +++ b/drivers/cpufreq/longhaul.c @@ -528,6 +528,7 @@ static int longhaul_get_ranges(void) static void longhaul_setup_voltagescaling(void) { + struct cpufreq_frequency_table *freq; union msr_longhaul longhaul; struct mV_pos minvid, maxvid, vid; unsigned int j, speed, pos, kHz_step, numvscales; @@ -606,18 +607,16 @@ static void longhaul_setup_voltagescaling(void) /* Calculate kHz for one voltage step */ kHz_step = (highest_speed - min_vid_speed) / numvscales; - j = 0; - while (longhaul_table[j].frequency != CPUFREQ_TABLE_END) { - speed = longhaul_table[j].frequency; + cpufreq_for_each_entry(freq, longhaul_table) { + speed = freq->frequency; if (speed > min_vid_speed) pos = (speed - min_vid_speed) / kHz_step + minvid.pos; else pos = minvid.pos; - longhaul_table[j].driver_data |= mV_vrm_table[pos] << 8; + freq->driver_data |= mV_vrm_table[pos] << 8; vid = vrm_mV_table[mV_vrm_table[pos]]; - printk(KERN_INFO PFX "f: %d kHz, index: %d, vid: %d mV\n", - speed, j, vid.mV); - j++; + printk(KERN_INFO PFX "f: %d kHz, index: %lu, vid: %d mV\n", + speed, freq - longhaul_table, vid.mV); } can_scale_voltage = 1;
The cpufreq core supports the cpufreq_for_each_entry macro helper for iteration over the cpufreq_frequency_table, so use it. It should have no functional changes. Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr> --- drivers/cpufreq/longhaul.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)