]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
can: etas_es58x: use BITS_PER_TYPE() instead of manual calculation
authorVincent Mailhol <mailhol.vincent@wanadoo.fr>
Sat, 12 Feb 2022 13:07:37 +0000 (22:07 +0900)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Thu, 24 Feb 2022 07:26:04 +0000 (08:26 +0100)
The input to the GENMASK() macro was calculated by hand. Replaced it
with a dedicated macro: BITS_PER_TYPE() which does the exact same job.

Link: https://lore.kernel.org/all/20220212130737.3008-1-mailhol.vincent@wanadoo.fr
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/usb/etas_es58x/es58x_fd.c

index ec87126e1a7dfc357579ae6bb52013fbb2b79d12..88d2540abbbee078b762dcddda05e0a9b71396d8 100644 (file)
@@ -69,7 +69,8 @@ static int es58x_fd_echo_msg(struct net_device *netdev,
        int i, num_element;
        u32 rcv_packet_idx;
 
-       const u32 mask = GENMASK(31, sizeof(echo_msg->packet_idx) * 8);
+       const u32 mask = GENMASK(BITS_PER_TYPE(mask) - 1,
+                                BITS_PER_TYPE(echo_msg->packet_idx));
 
        num_element = es58x_msg_num_element(es58x_dev->dev,
                                            es58x_fd_urb_cmd->echo_msg,