Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'linux-can-fixes-for-6.16-20250725' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can

Marc Kleine-Budde says:

====================
pull-request: can 2025-07-25

The patch is by Stephane Grosjean and adds support the recent firmware
of USB CAN FD interfaces to the peak_usb driver.

* tag 'linux-can-fixes-for-6.16-20250725' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can:
can: peak_usb: fix USB FD devices potential malfunction
====================

Link: https://patch.msgid.link/20250725101619.4095105-1-mkl@pengutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+9 -8
+9 -8
drivers/net/can/usb/peak_usb/pcan_usb_fd.c
··· 49 49 __le32 ser_no; /* S/N */ 50 50 __le32 flags; /* special functions */ 51 51 52 - /* extended data when type == PCAN_USBFD_TYPE_EXT */ 52 + /* extended data when type >= PCAN_USBFD_TYPE_EXT */ 53 53 u8 cmd_out_ep; /* ep for cmd */ 54 54 u8 cmd_in_ep; /* ep for replies */ 55 55 u8 data_out_ep[2]; /* ep for CANx TX */ ··· 982 982 dev->can.ctrlmode |= CAN_CTRLMODE_FD_NON_ISO; 983 983 } 984 984 985 - /* if vendor rsp is of type 2, then it contains EP numbers to 986 - * use for cmds pipes. If not, then default EP should be used. 985 + /* if vendor rsp type is greater than or equal to 2, then it 986 + * contains EP numbers to use for cmds pipes. If not, then 987 + * default EP should be used. 987 988 */ 988 - if (fw_info->type != cpu_to_le16(PCAN_USBFD_TYPE_EXT)) { 989 + if (le16_to_cpu(fw_info->type) < PCAN_USBFD_TYPE_EXT) { 989 990 fw_info->cmd_out_ep = PCAN_USBPRO_EP_CMDOUT; 990 991 fw_info->cmd_in_ep = PCAN_USBPRO_EP_CMDIN; 991 992 } ··· 1019 1018 dev->can_channel_id = 1020 1019 le32_to_cpu(pdev->usb_if->fw_info.dev_id[dev->ctrl_idx]); 1021 1020 1022 - /* if vendor rsp is of type 2, then it contains EP numbers to 1023 - * use for data pipes. If not, then statically defined EP are used 1024 - * (see peak_usb_create_dev()). 1021 + /* if vendor rsp type is greater than or equal to 2, then it contains EP 1022 + * numbers to use for data pipes. If not, then statically defined EP are 1023 + * used (see peak_usb_create_dev()). 1025 1024 */ 1026 - if (fw_info->type == cpu_to_le16(PCAN_USBFD_TYPE_EXT)) { 1025 + if (le16_to_cpu(fw_info->type) >= PCAN_USBFD_TYPE_EXT) { 1027 1026 dev->ep_msg_in = fw_info->data_in_ep; 1028 1027 dev->ep_msg_out = fw_info->data_out_ep[dev->ctrl_idx]; 1029 1028 }