OSDN Git Service

cpufreq: tegra186: Fix sparse 'incorrect type in assignment' warning
authorJon Hunter <jonathanh@nvidia.com>
Wed, 2 Dec 2020 09:14:16 +0000 (09:14 +0000)
committerViresh Kumar <viresh.kumar@linaro.org>
Mon, 7 Dec 2020 07:32:44 +0000 (13:02 +0530)
commitb7b4e785520ff87383ab5131f903544a261e83a1
tree7406e98da0a750de52c94116e010ce3c3c3b7b3b
parentfc928b901dc68481ba3e524860a641fe13e25dfe
cpufreq: tegra186: Fix sparse 'incorrect type in assignment' warning

Sparse warns that the incorrect type is being assigned to the CPUFREQ
driver_data variable in the Tegra186 CPUFREQ driver. The Tegra186
CPUFREQ driver is assigned a type of 'void __iomem *' to a pointer of
type 'void *' ...

 drivers/cpufreq/tegra186-cpufreq.c:72:37: sparse: sparse: incorrect
  type in assignment (different address spaces) @@
expected void *driver_data @@     got void [noderef] __iomem * @@
 ...

 drivers/cpufreq/tegra186-cpufreq.c:87:40: sparse: sparse: incorrect
  type in initializer (different address spaces) @@
expected void [noderef] __iomem *edvd_reg @@     got void *driver_data @@

The Tegra186 CPUFREQ driver is using the policy->driver_data variable to
store and iomem pointer to a Tegra186 CPU register that is used to set
the clock speed for the CPU. This is not necessary because the register
base address is already stored in the driver data and the offset of the
register for each CPU is static. Therefore, fix this by adding a new
structure with the register offsets for each CPU and store this in the
main driver data structure along with the register base address. Please
note that a new structure has been added for storing the register
offsets rather than a simple array, because this will permit further
clean-ups and simplification of the driver.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/cpufreq/tegra186-cpufreq.c