Commit 2ae9856d authored by Vincent Mailhol's avatar Vincent Mailhol Committed by Marc Kleine-Budde

can: etas_es58x: use BITS_PER_TYPE() instead of manual calculation

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.frSigned-off-by: default avatarVincent Mailhol <mailhol.vincent@wanadoo.fr>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 2206fcbc
...@@ -69,7 +69,8 @@ static int es58x_fd_echo_msg(struct net_device *netdev, ...@@ -69,7 +69,8 @@ static int es58x_fd_echo_msg(struct net_device *netdev,
int i, num_element; int i, num_element;
u32 rcv_packet_idx; 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, num_element = es58x_msg_num_element(es58x_dev->dev,
es58x_fd_urb_cmd->echo_msg, es58x_fd_urb_cmd->echo_msg,
......
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