vdpa/mlx5: Avoid warnings about shifts on 32-bit platforms
authorNathan Chancellor <natechancellor@gmail.com>
Fri, 21 Aug 2020 22:50:19 +0000 (15:50 -0700)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 26 Aug 2020 12:13:59 +0000 (08:13 -0400)
commitcbb523594eb718944b726ba52bb43a1d66188a17
tree03ea0216ddef4edf2f28e6c7d929b6069b519e59
parenteb07d8f5ff32a0151967a56479fc3bd1003c303f
vdpa/mlx5: Avoid warnings about shifts on 32-bit platforms

Clang warns several times when building for 32-bit ARM along the lines
of:

drivers/vdpa/mlx5/net/mlx5_vnet.c:1462:31: warning: shift count >= width
of type [-Wshift-count-overflow]
                ndev->mvdev.mlx_features |= BIT(VIRTIO_F_VERSION_1);
                                            ^~~~~~~~~~~~~~~~~~~~~~~

This is related to the BIT macro, which uses an unsigned long literal,
which is 32-bit on ARM so having a shift equal to or larger than 32 will
cause this warning, such as the above, where VIRTIO_F_VERSION_1 is 32.
To avoid this, use BIT_ULL, which will be an unsigned long long. This
matches the size of the features field throughout this driver, which is
u64 so there should be no functional change.

Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices")
Link: https://github.com/ClangBuiltLinux/linux/issues/1140
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Link: https://lore.kernel.org/r/20200821225018.940798-1-natechancellor@gmail.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested
Acked-by: Eli Cohen <elic@nvidia.com>
drivers/vdpa/mlx5/net/mlx5_vnet.c