Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pinctrl: loongson2: Fix some const correctness

The kernel robot using sparse is complaining like this:

drivers/pinctrl/pinctrl-loongson2.c:212:21: sparse:
sparse: incorrect type in argument 1 (different address spaces) @@
expected void const volatile [noderef] __iomem *addr @@
got void *[noderef] __iomem reg @@
(...)

I think the problem is simply that the register base is defined
as void * __iomem instead of void __iomem * and this is because
of the way const correctness works with pointer infix order.

Fix it up. I think.

Reported-by: kernel test robot <lkp@intel.com>
Cc: zhanghongchen <zhanghongchen@loongson.cn>
Cc: Yinbo Zhu <zhuyinbo@loongson.cn>
Fixes: f73f88acbc18 ("pinctrl: pinctrl-loongson2: add pinctrl driver support")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

+2 -2
+2 -2
drivers/pinctrl/pinctrl-loongson2.c
··· 45 45 struct pinctrl_desc desc; 46 46 struct device_node *of_node; 47 47 spinlock_t lock; 48 - void * __iomem reg_base; 48 + void __iomem *reg_base; 49 49 }; 50 50 51 51 struct loongson2_pmx_group { ··· 202 202 unsigned int group_num) 203 203 { 204 204 struct loongson2_pinctrl *pctrl = pinctrl_dev_get_drvdata(pcdev); 205 - void * __iomem reg = pctrl->reg_base + 205 + void __iomem *reg = pctrl->reg_base + 206 206 loongson2_pmx_groups[group_num].reg; 207 207 unsigned int mux_bit = loongson2_pmx_groups[group_num].bit; 208 208 unsigned int val;