]> git.baikalelectronics.ru Git - kernel.git/commit
cpufreq: make table sentinel macros unsigned to match use
authorBrian W Hart <hartb@linux.vnet.ibm.com>
Fri, 27 Jun 2014 21:09:39 +0000 (16:09 -0500)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 18 Jul 2014 00:56:38 +0000 (02:56 +0200)
commitdb4e606d49b2c839bd9acfe9e92783ad12fc7537
treedd8b8528f50974019bed96a2d5211e07da864741
parent9e80c1d7434371b321a4892180a682608df7c3ed
cpufreq: make table sentinel macros unsigned to match use

Commit ab29250b8229 (cpufreq: Fix build error on some platforms that
use cpufreq_for_each_*) moved function cpufreq_next_valid() to a public
header.  Warnings are now generated when objects including that header
are built with -Wsign-compare (as an out-of-tree module might be):

.../include/linux/cpufreq.h: In function ‘cpufreq_next_valid’:
.../include/linux/cpufreq.h:519:27: warning: comparison between signed
and unsigned integer expressions [-Wsign-compare]
  while ((*pos)->frequency != CPUFREQ_TABLE_END)
                           ^
.../include/linux/cpufreq.h:520:25: warning: comparison between signed
and unsigned integer expressions [-Wsign-compare]
   if ((*pos)->frequency != CPUFREQ_ENTRY_INVALID)
                         ^

Constants CPUFREQ_ENTRY_INVALID and CPUFREQ_TABLE_END are signed, but
are used with unsigned member 'frequency' of cpufreq_frequency_table.
Update the macro definitions to be explicitly unsigned to match their
use.

This also corrects potentially wrong behavior of clk_rate_table_iter()
if unsigned long is wider than usigned int.

Fixes: ab29250b8229 (cpufreq: Fix build error on some platforms that use cpufreq_for_each_*)
Signed-off-by: Brian W Hart <hartb@linux.vnet.ibm.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
include/linux/cpufreq.h