lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-Id: <20231005195812.549776-20-mkl@pengutronix.de> Date: Thu, 5 Oct 2023 21:57:54 +0200 From: Marc Kleine-Budde <mkl@...gutronix.de> To: netdev@...r.kernel.org Cc: davem@...emloft.net, kuba@...nel.org, linux-can@...r.kernel.org, kernel@...gutronix.de, Marc Kleine-Budde <mkl@...gutronix.de> Subject: [PATCH net-next 19/37] can: at91_can: MCR Register: convert to FIELD_PREP() Use FIELD_PREP() to access the individual fields of the MCR register. Link: https://lore.kernel.org/all/20231005-at91_can-rx_offload-v2-9-9987d53600e0@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@...gutronix.de> --- drivers/net/can/at91_can.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c index 41dd2ea239b9..0269e2a6508a 100644 --- a/drivers/net/can/at91_can.c +++ b/drivers/net/can/at91_can.c @@ -90,7 +90,9 @@ enum at91_reg { #define AT91_MSR_MRDY BIT(23) #define AT91_MSR_MMI BIT(24) +#define AT91_MCR_MDLC_MASK GENMASK(19, 16) #define AT91_MCR_MRTR BIT(20) +#define AT91_MCR_MACR BIT(22) #define AT91_MCR_MTCR BIT(23) /* Mailbox Modes */ @@ -490,8 +492,12 @@ static netdev_tx_t at91_start_xmit(struct sk_buff *skb, struct net_device *dev) return NETDEV_TX_BUSY; } reg_mid = at91_can_id_to_reg_mid(cf->can_id); - reg_mcr = ((cf->can_id & CAN_RTR_FLAG) ? AT91_MCR_MRTR : 0) | - (cf->len << 16) | AT91_MCR_MTCR; + + reg_mcr = FIELD_PREP(AT91_MCR_MDLC_MASK, cf->len) | + AT91_MCR_MTCR; + + if (cf->can_id & CAN_RTR_FLAG) + reg_mcr |= AT91_MCR_MRTR; /* disable MB while writing ID (see datasheet) */ set_mb_mode(priv, mb, AT91_MB_MODE_DISABLED); -- 2.40.1
Powered by blists - more mailing lists