]> git.baikalelectronics.ru Git - kernel.git/commit
mfd: altera-sysmgr: Fix physical address storing more
authorArnd Bergmann <arnd@arndb.de>
Thu, 3 Dec 2020 22:52:48 +0000 (23:52 +0100)
committerLee Jones <lee.jones@linaro.org>
Mon, 8 Feb 2021 13:54:03 +0000 (13:54 +0000)
commit83f93fd45fabd100f3a9034dee6eca7b815652dd
tree48ea0792a2e273fe7a8866e4088d6b8e7e669ad4
parent91dcc4c6fe8c5537156f19f401d1fa053dd1166c
mfd: altera-sysmgr: Fix physical address storing more

A recent fix improved the way the resource gets passed to
the low-level accessors, but left one warning that appears
in configurations with a resource_size_t that is wider than
a pointer:

In file included from drivers/mfd/altera-sysmgr.c:19:
drivers/mfd/altera-sysmgr.c: In function 'sysmgr_probe':
drivers/mfd/altera-sysmgr.c:148:40: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
  148 |   regmap = devm_regmap_init(dev, NULL, (void *)res->start,
      |                                        ^
include/linux/regmap.h:646:6: note: in definition of macro '__regmap_lockdep_wrapper'
  646 |   fn(__VA_ARGS__, &_key,     \
      |      ^~~~~~~~~~~
drivers/mfd/altera-sysmgr.c:148:12: note: in expansion of macro 'devm_regmap_init'
  148 |   regmap = devm_regmap_init(dev, NULL, (void *)res->start,
      |            ^~~~~~~~~~~~~~~~

I had tried a different approach that would store the address
in the private data as a phys_addr_t, but the easiest solution
now seems to be to add a double cast to shut up the warning.

As the address is passed to an inline assembly, it is guaranteed
to not be wider than a register anyway.

Fixes: 0a0544d6438d ("mfd: altera-sysmgr: Fix physical address storing hacks")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/mfd/altera-sysmgr.c