Commit b89c7695 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by David S. Miller

mlxsw: spectrum_kvdl: use div_u64() for 64-bit division

Calculating the number of entries now uses 64-bit arithmetic that
causes a link error on 32-bit architectures:

drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.o: In function `mlxsw_sp_kvdl_init':
spectrum_kvdl.c:(.text+0x51c): undefined reference to `__aeabi_uldivmod'

We could probably use a 32-bit division here as before, but since this is
not in a performance critical path, div_u64() seems cleaner here.

Fixes: 887839e6 ("mlxsw: spectrum_kvdl: Add support for dynamic partition set")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarArkadi Sharshevsky <arkadis@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 25ab47ef
...@@ -278,7 +278,7 @@ static int mlxsw_sp_kvdl_part_init(struct mlxsw_sp *mlxsw_sp, ...@@ -278,7 +278,7 @@ static int mlxsw_sp_kvdl_part_init(struct mlxsw_sp *mlxsw_sp,
resource_size = info->end_index - info->start_index + 1; resource_size = info->end_index - info->start_index + 1;
} }
nr_entries = resource_size / info->alloc_size; nr_entries = div_u64(resource_size, info->alloc_size);
usage_size = BITS_TO_LONGS(nr_entries) * sizeof(unsigned long); usage_size = BITS_TO_LONGS(nr_entries) * sizeof(unsigned long);
part = kzalloc(sizeof(*part) + usage_size, GFP_KERNEL); part = kzalloc(sizeof(*part) + usage_size, GFP_KERNEL);
if (!part) if (!part)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment