History

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

Marc Kleine-Budde says: ==================== this is the updated pull request of one patch by me for the peak_usb driver. It fixes the driver, so that non FD adapters don't provide CAN FD bittimings. ====================

David S. Miller committed 11 years ago

Commit e732cdd2 parents 83bc805 06b23f75 files · +82 −70Browse files

Unified · Split

5 files
  1. drivers/net/can/usb/peak_usb/pcan_usb.c +13 −11
  2. drivers/net/can/usb/peak_usb/pcan_usb_core.c +2 −2
  3. drivers/net/can/usb/peak_usb/pcan_usb_core.h +2 −2
  4. drivers/net/can/usb/peak_usb/pcan_usb_fd.c +52 −44
  5. drivers/net/can/usb/peak_usb/pcan_usb_pro.c +13 −11
drivers/net/can/usb/peak_usb/pcan_usb.c+13−11
@@ -854,6 +854,18 @@ static int pcan_usb_probe(struct usb_interface *intf) · 853 unmodified lines
854854 /*
855855 * describe the PCAN-USB adapter
856856 */
857+static const struct can_bittiming_const pcan_usb_const = {
858+ .name = "pcan_usb",
859+ .tseg1_min = 1,
860+ .tseg1_max = 16,
861+ .tseg2_min = 1,
862+ .tseg2_max = 8,
863+ .sjw_max = 4,
864+ .brp_min = 1,
865+ .brp_max = 64,
866+ .brp_inc = 1,
867+};
868+
857869 const struct peak_usb_adapter pcan_usb = {
858870 .name = "PCAN-USB",
859871 .device_id = PCAN_USB_PRODUCT_ID,
@@ -862,17 +874,7 @@ const struct peak_usb_adapter pcan_usb = { · 2 unmodified lines
862874 .clock = {
863875 .freq = PCAN_USB_CRYSTAL_HZ / 2 ,
864876 },
865− .bittiming_const = {
866− .name = "pcan_usb",
867− .tseg1_min = 1,
868− .tseg1_max = 16,
869− .tseg2_min = 1,
870− .tseg2_max = 8,
871− .sjw_max = 4,
872− .brp_min = 1,
873− .brp_max = 64,
874− .brp_inc = 1,
875− },
877+ .bittiming_const = &pcan_usb_const,
876878
877879 /* size of device private data */
878880 .sizeof_dev_private = sizeof(struct pcan_usb),
drivers/net/can/usb/peak_usb/pcan_usb_core.c+2−2
@@ -792,9 +792,9 @@ static int peak_usb_create_dev(const struct peak_usb_adapter *peak_usb_adapter, · 791 unmodified lines
792792 dev->ep_msg_out = peak_usb_adapter->ep_msg_out[ctrl_idx];
793793
794794 dev->can.clock = peak_usb_adapter->clock;
795− dev->can.bittiming_const = &peak_usb_adapter->bittiming_const;
795+ dev->can.bittiming_const = peak_usb_adapter->bittiming_const;
796796 dev->can.do_set_bittiming = peak_usb_set_bittiming;
797− dev->can.data_bittiming_const = &peak_usb_adapter->data_bittiming_const;
797+ dev->can.data_bittiming_const = peak_usb_adapter->data_bittiming_const;
798798 dev->can.do_set_data_bittiming = peak_usb_set_data_bittiming;
799799 dev->can.do_set_mode = peak_usb_set_mode;
800800 dev->can.do_get_berr_counter = peak_usb_adapter->do_get_berr_counter;
drivers/net/can/usb/peak_usb/pcan_usb_core.h+2−2
@@ -48,8 +48,8 @@ struct peak_usb_adapter { · 47 unmodified lines
4848 u32 device_id;
4949 u32 ctrlmode_supported;
5050 struct can_clock clock;
51− const struct can_bittiming_const bittiming_const;
52− const struct can_bittiming_const data_bittiming_const;
51+ const struct can_bittiming_const * const bittiming_const;
52+ const struct can_bittiming_const * const data_bittiming_const;
5353 unsigned int ctrl_count;
5454
5555 int (*intf_probe)(struct usb_interface *intf);
drivers/net/can/usb/peak_usb/pcan_usb_fd.c+52−44
@@ -990,6 +990,30 @@ static void pcan_usb_fd_free(struct peak_usb_device *dev) · 989 unmodified lines
990990 }
991991
992992 /* describes the PCAN-USB FD adapter */
993+static const struct can_bittiming_const pcan_usb_fd_const = {
994+ .name = "pcan_usb_fd",
995+ .tseg1_min = 1,
996+ .tseg1_max = 64,
997+ .tseg2_min = 1,
998+ .tseg2_max = 16,
999+ .sjw_max = 16,
1000+ .brp_min = 1,
1001+ .brp_max = 1024,
1002+ .brp_inc = 1,
1003+};
1004+
1005+static const struct can_bittiming_const pcan_usb_fd_data_const = {
1006+ .name = "pcan_usb_fd",
1007+ .tseg1_min = 1,
1008+ .tseg1_max = 16,
1009+ .tseg2_min = 1,
1010+ .tseg2_max = 8,
1011+ .sjw_max = 4,
1012+ .brp_min = 1,
1013+ .brp_max = 1024,
1014+ .brp_inc = 1,
1015+};
1016+
9931017 const struct peak_usb_adapter pcan_usb_fd = {
9941018 .name = "PCAN-USB FD",
9951019 .device_id = PCAN_USBFD_PRODUCT_ID,
@@ -999,28 +1023,8 @@ const struct peak_usb_adapter pcan_usb_fd = { · 3 unmodified lines
9991023 .clock = {
10001024 .freq = PCAN_UFD_CRYSTAL_HZ,
10011025 },
1002− .bittiming_const = {
1003− .name = "pcan_usb_fd",
1004− .tseg1_min = 1,
1005− .tseg1_max = 64,
1006− .tseg2_min = 1,
1007− .tseg2_max = 16,
1008− .sjw_max = 16,
1009− .brp_min = 1,
1010− .brp_max = 1024,
1011− .brp_inc = 1,
1012− },
1013− .data_bittiming_const = {
1014− .name = "pcan_usb_fd",
1015− .tseg1_min = 1,
1016− .tseg1_max = 16,
1017− .tseg2_min = 1,
1018− .tseg2_max = 8,
1019− .sjw_max = 4,
1020− .brp_min = 1,
1021− .brp_max = 1024,
1022− .brp_inc = 1,
1023− },
1026+ .bittiming_const = &pcan_usb_fd_const,
1027+ .data_bittiming_const = &pcan_usb_fd_data_const,
10241028
10251029 /* size of device private data */
10261030 .sizeof_dev_private = sizeof(struct pcan_usb_fd_device),
@@ -1058,6 +1062,30 @@ const struct peak_usb_adapter pcan_usb_fd = { · 31 unmodified lines
10581062 };
10591063
10601064 /* describes the PCAN-USB Pro FD adapter */
1065+static const struct can_bittiming_const pcan_usb_pro_fd_const = {
1066+ .name = "pcan_usb_pro_fd",
1067+ .tseg1_min = 1,
1068+ .tseg1_max = 64,
1069+ .tseg2_min = 1,
1070+ .tseg2_max = 16,
1071+ .sjw_max = 16,
1072+ .brp_min = 1,
1073+ .brp_max = 1024,
1074+ .brp_inc = 1,
1075+};
1076+
1077+static const struct can_bittiming_const pcan_usb_pro_fd_data_const = {
1078+ .name = "pcan_usb_pro_fd",
1079+ .tseg1_min = 1,
1080+ .tseg1_max = 16,
1081+ .tseg2_min = 1,
1082+ .tseg2_max = 8,
1083+ .sjw_max = 4,
1084+ .brp_min = 1,
1085+ .brp_max = 1024,
1086+ .brp_inc = 1,
1087+};
1088+
10611089 const struct peak_usb_adapter pcan_usb_pro_fd = {
10621090 .name = "PCAN-USB Pro FD",
10631091 .device_id = PCAN_USBPROFD_PRODUCT_ID,
@@ -1067,28 +1095,8 @@ const struct peak_usb_adapter pcan_usb_pro_fd = { · 3 unmodified lines
10671095 .clock = {
10681096 .freq = PCAN_UFD_CRYSTAL_HZ,
10691097 },
1070− .bittiming_const = {
1071− .name = "pcan_usb_pro_fd",
1072− .tseg1_min = 1,
1073− .tseg1_max = 64,
1074− .tseg2_min = 1,
1075− .tseg2_max = 16,
1076− .sjw_max = 16,
1077− .brp_min = 1,
1078− .brp_max = 1024,
1079− .brp_inc = 1,
1080− },
1081− .data_bittiming_const = {
1082− .name = "pcan_usb_pro_fd",
1083− .tseg1_min = 1,
1084− .tseg1_max = 16,
1085− .tseg2_min = 1,
1086− .tseg2_max = 8,
1087− .sjw_max = 4,
1088− .brp_min = 1,
1089− .brp_max = 1024,
1090− .brp_inc = 1,
1091− },
1098+ .bittiming_const = &pcan_usb_pro_fd_const,
1099+ .data_bittiming_const = &pcan_usb_pro_fd_data_const,
10921100
10931101 /* size of device private data */
10941102 .sizeof_dev_private = sizeof(struct pcan_usb_fd_device),
drivers/net/can/usb/peak_usb/pcan_usb_pro.c+13−11
@@ -1004,6 +1004,18 @@ int pcan_usb_pro_probe(struct usb_interface *intf) · 1003 unmodified lines
10041004 /*
10051005 * describe the PCAN-USB Pro adapter
10061006 */
1007+static const struct can_bittiming_const pcan_usb_pro_const = {
1008+ .name = "pcan_usb_pro",
1009+ .tseg1_min = 1,
1010+ .tseg1_max = 16,
1011+ .tseg2_min = 1,
1012+ .tseg2_max = 8,
1013+ .sjw_max = 4,
1014+ .brp_min = 1,
1015+ .brp_max = 1024,
1016+ .brp_inc = 1,
1017+};
1018+
10071019 const struct peak_usb_adapter pcan_usb_pro = {
10081020 .name = "PCAN-USB Pro",
10091021 .device_id = PCAN_USBPRO_PRODUCT_ID,
@@ -1012,17 +1024,7 @@ const struct peak_usb_adapter pcan_usb_pro = { · 2 unmodified lines
10121024 .clock = {
10131025 .freq = PCAN_USBPRO_CRYSTAL_HZ,
10141026 },
1015− .bittiming_const = {
1016− .name = "pcan_usb_pro",
1017− .tseg1_min = 1,
1018− .tseg1_max = 16,
1019− .tseg2_min = 1,
1020− .tseg2_max = 8,
1021− .sjw_max = 4,
1022− .brp_min = 1,
1023− .brp_max = 1024,
1024− .brp_inc = 1,
1025− },
1027+ .bittiming_const = &pcan_usb_pro_const,
10261028
10271029 /* size of device private data */
10281030 .sizeof_dev_private = sizeof(struct pcan_usb_pro_device),

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t