Skip to content

Commit eccf7a3

Browse files
committed
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/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 49db61c + 788199b commit eccf7a3

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

drivers/net/can/usb/peak_usb/pcan_usb_fd.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ struct __packed pcan_ufd_fw_info {
4949
__le32 ser_no; /* S/N */
5050
__le32 flags; /* special functions */
5151

52-
/* extended data when type == PCAN_USBFD_TYPE_EXT */
52+
/* extended data when type >= PCAN_USBFD_TYPE_EXT */
5353
u8 cmd_out_ep; /* ep for cmd */
5454
u8 cmd_in_ep; /* ep for replies */
5555
u8 data_out_ep[2]; /* ep for CANx TX */
@@ -982,10 +982,11 @@ static int pcan_usb_fd_init(struct peak_usb_device *dev)
982982
dev->can.ctrlmode |= CAN_CTRLMODE_FD_NON_ISO;
983983
}
984984

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.
987988
*/
988-
if (fw_info->type != cpu_to_le16(PCAN_USBFD_TYPE_EXT)) {
989+
if (le16_to_cpu(fw_info->type) < PCAN_USBFD_TYPE_EXT) {
989990
fw_info->cmd_out_ep = PCAN_USBPRO_EP_CMDOUT;
990991
fw_info->cmd_in_ep = PCAN_USBPRO_EP_CMDIN;
991992
}
@@ -1018,11 +1019,11 @@ static int pcan_usb_fd_init(struct peak_usb_device *dev)
10181019
dev->can_channel_id =
10191020
le32_to_cpu(pdev->usb_if->fw_info.dev_id[dev->ctrl_idx]);
10201021

1021-
/* if vendor rsp is of type 2, then it contains EP numbers to
1022-
* use for data pipes. If not, then statically defined EP are used
1023-
* (see peak_usb_create_dev()).
1022+
/* if vendor rsp type is greater than or equal to 2, then it contains EP
1023+
* numbers to use for data pipes. If not, then statically defined EP are
1024+
* used (see peak_usb_create_dev()).
10241025
*/
1025-
if (fw_info->type == cpu_to_le16(PCAN_USBFD_TYPE_EXT)) {
1026+
if (le16_to_cpu(fw_info->type) >= PCAN_USBFD_TYPE_EXT) {
10261027
dev->ep_msg_in = fw_info->data_in_ep;
10271028
dev->ep_msg_out = fw_info->data_out_ep[dev->ctrl_idx];
10281029
}

0 commit comments

Comments
 (0)