aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorOliver Hartkopp <socketcan@hartkopp.net>2014-03-07 03:23:41 -0500
committerMarc Kleine-Budde <mkl@pengutronix.de>2014-03-17 04:20:16 -0400
commitc971fa2ae42e73e9ccc2f5e93f268c8742da4c5d (patch)
treee7591c23ccbc262aa5c4ff76dc516a66e58b9486 /drivers
parente7ef085d0a9dc1cc72e7d8108ed3b4e1a5e8d938 (diff)
can: Unify MTU settings for CAN interfaces
CAN interfaces only support MTU values of 16 (CAN 2.0) and 72 (CAN FD). Setting the MTU to other values is pointless but it does not really hurt. With the introduction of the CAN FD support in drivers/net/can a new function to switch the MTU for CAN FD has been introduced. This patch makes use of this can_change_mtu() function to check for correct MTU settings also in legacy CAN (2.0) devices. Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/can/at91_can.c1
-rw-r--r--drivers/net/can/bfin_can.c1
-rw-r--r--drivers/net/can/c_can/c_can.c1
-rw-r--r--drivers/net/can/cc770/cc770.c1
-rw-r--r--drivers/net/can/flexcan.c1
-rw-r--r--drivers/net/can/grcan.c1
-rw-r--r--drivers/net/can/janz-ican3.c1
-rw-r--r--drivers/net/can/mcp251x.c1
-rw-r--r--drivers/net/can/mscan/mscan.c7
-rw-r--r--drivers/net/can/pch_can.c1
-rw-r--r--drivers/net/can/sja1000/sja1000.c7
-rw-r--r--drivers/net/can/slcan.c6
-rw-r--r--drivers/net/can/softing/softing_main.c1
-rw-r--r--drivers/net/can/ti_hecc.c1
-rw-r--r--drivers/net/can/usb/ems_usb.c1
-rw-r--r--drivers/net/can/usb/esd_usb2.c1
-rw-r--r--drivers/net/can/usb/kvaser_usb.c1
-rw-r--r--drivers/net/can/usb/peak_usb/pcan_usb_core.c1
-rw-r--r--drivers/net/can/usb/usb_8dev.c1
19 files changed, 30 insertions, 6 deletions
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
index 1d00b95f8983..f07fa89b5fd5 100644
--- a/drivers/net/can/at91_can.c
+++ b/drivers/net/can/at91_can.c
@@ -1194,6 +1194,7 @@ static const struct net_device_ops at91_netdev_ops = {
1194 .ndo_open = at91_open, 1194 .ndo_open = at91_open,
1195 .ndo_stop = at91_close, 1195 .ndo_stop = at91_close,
1196 .ndo_start_xmit = at91_start_xmit, 1196 .ndo_start_xmit = at91_start_xmit,
1197 .ndo_change_mtu = can_change_mtu,
1197}; 1198};
1198 1199
1199static ssize_t at91_sysfs_show_mb0_id(struct device *dev, 1200static ssize_t at91_sysfs_show_mb0_id(struct device *dev,
diff --git a/drivers/net/can/bfin_can.c b/drivers/net/can/bfin_can.c
index 8d2b89a12e09..543ecceb33e9 100644
--- a/drivers/net/can/bfin_can.c
+++ b/drivers/net/can/bfin_can.c
@@ -528,6 +528,7 @@ static const struct net_device_ops bfin_can_netdev_ops = {
528 .ndo_open = bfin_can_open, 528 .ndo_open = bfin_can_open,
529 .ndo_stop = bfin_can_close, 529 .ndo_stop = bfin_can_close,
530 .ndo_start_xmit = bfin_can_start_xmit, 530 .ndo_start_xmit = bfin_can_start_xmit,
531 .ndo_change_mtu = can_change_mtu,
531}; 532};
532 533
533static int bfin_can_probe(struct platform_device *pdev) 534static int bfin_can_probe(struct platform_device *pdev)
diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c
index 951bfede8f3d..9c32e9ef7694 100644
--- a/drivers/net/can/c_can/c_can.c
+++ b/drivers/net/can/c_can/c_can.c
@@ -1277,6 +1277,7 @@ static const struct net_device_ops c_can_netdev_ops = {
1277 .ndo_open = c_can_open, 1277 .ndo_open = c_can_open,
1278 .ndo_stop = c_can_close, 1278 .ndo_stop = c_can_close,
1279 .ndo_start_xmit = c_can_start_xmit, 1279 .ndo_start_xmit = c_can_start_xmit,
1280 .ndo_change_mtu = can_change_mtu,
1280}; 1281};
1281 1282
1282int register_c_can_dev(struct net_device *dev) 1283int register_c_can_dev(struct net_device *dev)
diff --git a/drivers/net/can/cc770/cc770.c b/drivers/net/can/cc770/cc770.c
index 0f12abf6591c..d8379278d648 100644
--- a/drivers/net/can/cc770/cc770.c
+++ b/drivers/net/can/cc770/cc770.c
@@ -823,6 +823,7 @@ static const struct net_device_ops cc770_netdev_ops = {
823 .ndo_open = cc770_open, 823 .ndo_open = cc770_open,
824 .ndo_stop = cc770_close, 824 .ndo_stop = cc770_close,
825 .ndo_start_xmit = cc770_start_xmit, 825 .ndo_start_xmit = cc770_start_xmit,
826 .ndo_change_mtu = can_change_mtu,
826}; 827};
827 828
828int register_cc770dev(struct net_device *dev) 829int register_cc770dev(struct net_device *dev)
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index c94d698b73c2..f425ec2c7839 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -1011,6 +1011,7 @@ static const struct net_device_ops flexcan_netdev_ops = {
1011 .ndo_open = flexcan_open, 1011 .ndo_open = flexcan_open,
1012 .ndo_stop = flexcan_close, 1012 .ndo_stop = flexcan_close,
1013 .ndo_start_xmit = flexcan_start_xmit, 1013 .ndo_start_xmit = flexcan_start_xmit,
1014 .ndo_change_mtu = can_change_mtu,
1014}; 1015};
1015 1016
1016static int register_flexcandev(struct net_device *dev) 1017static int register_flexcandev(struct net_device *dev)
diff --git a/drivers/net/can/grcan.c b/drivers/net/can/grcan.c
index ab506d6cab37..3fd9fd942c6e 100644
--- a/drivers/net/can/grcan.c
+++ b/drivers/net/can/grcan.c
@@ -1578,6 +1578,7 @@ static const struct net_device_ops grcan_netdev_ops = {
1578 .ndo_open = grcan_open, 1578 .ndo_open = grcan_open,
1579 .ndo_stop = grcan_close, 1579 .ndo_stop = grcan_close,
1580 .ndo_start_xmit = grcan_start_xmit, 1580 .ndo_start_xmit = grcan_start_xmit,
1581 .ndo_change_mtu = can_change_mtu,
1581}; 1582};
1582 1583
1583static int grcan_setup_netdev(struct platform_device *ofdev, 1584static int grcan_setup_netdev(struct platform_device *ofdev,
diff --git a/drivers/net/can/janz-ican3.c b/drivers/net/can/janz-ican3.c
index b47df5e482fa..2382c04dc780 100644
--- a/drivers/net/can/janz-ican3.c
+++ b/drivers/net/can/janz-ican3.c
@@ -1594,6 +1594,7 @@ static const struct net_device_ops ican3_netdev_ops = {
1594 .ndo_open = ican3_open, 1594 .ndo_open = ican3_open,
1595 .ndo_stop = ican3_stop, 1595 .ndo_stop = ican3_stop,
1596 .ndo_start_xmit = ican3_xmit, 1596 .ndo_start_xmit = ican3_xmit,
1597 .ndo_change_mtu = can_change_mtu,
1597}; 1598};
1598 1599
1599/* 1600/*
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
index 50aa630c7dd4..a8b74f8da03d 100644
--- a/drivers/net/can/mcp251x.c
+++ b/drivers/net/can/mcp251x.c
@@ -996,6 +996,7 @@ static const struct net_device_ops mcp251x_netdev_ops = {
996 .ndo_open = mcp251x_open, 996 .ndo_open = mcp251x_open,
997 .ndo_stop = mcp251x_stop, 997 .ndo_stop = mcp251x_stop,
998 .ndo_start_xmit = mcp251x_hard_start_xmit, 998 .ndo_start_xmit = mcp251x_hard_start_xmit,
999 .ndo_change_mtu = can_change_mtu,
999}; 1000};
1000 1001
1001static const struct of_device_id mcp251x_of_match[] = { 1002static const struct of_device_id mcp251x_of_match[] = {
diff --git a/drivers/net/can/mscan/mscan.c b/drivers/net/can/mscan/mscan.c
index b9f3faabb0f3..e0c9be5e2ab7 100644
--- a/drivers/net/can/mscan/mscan.c
+++ b/drivers/net/can/mscan/mscan.c
@@ -647,9 +647,10 @@ static int mscan_close(struct net_device *dev)
647} 647}
648 648
649static const struct net_device_ops mscan_netdev_ops = { 649static const struct net_device_ops mscan_netdev_ops = {
650 .ndo_open = mscan_open, 650 .ndo_open = mscan_open,
651 .ndo_stop = mscan_close, 651 .ndo_stop = mscan_close,
652 .ndo_start_xmit = mscan_start_xmit, 652 .ndo_start_xmit = mscan_start_xmit,
653 .ndo_change_mtu = can_change_mtu,
653}; 654};
654 655
655int register_mscandev(struct net_device *dev, int mscan_clksrc) 656int register_mscandev(struct net_device *dev, int mscan_clksrc)
diff --git a/drivers/net/can/pch_can.c b/drivers/net/can/pch_can.c
index 6c077eb87b5e..6472562efedc 100644
--- a/drivers/net/can/pch_can.c
+++ b/drivers/net/can/pch_can.c
@@ -950,6 +950,7 @@ static const struct net_device_ops pch_can_netdev_ops = {
950 .ndo_open = pch_can_open, 950 .ndo_open = pch_can_open,
951 .ndo_stop = pch_close, 951 .ndo_stop = pch_close,
952 .ndo_start_xmit = pch_xmit, 952 .ndo_start_xmit = pch_xmit,
953 .ndo_change_mtu = can_change_mtu,
953}; 954};
954 955
955static void pch_can_remove(struct pci_dev *pdev) 956static void pch_can_remove(struct pci_dev *pdev)
diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c
index 55cce4737518..f31499a32d7d 100644
--- a/drivers/net/can/sja1000/sja1000.c
+++ b/drivers/net/can/sja1000/sja1000.c
@@ -642,9 +642,10 @@ void free_sja1000dev(struct net_device *dev)
642EXPORT_SYMBOL_GPL(free_sja1000dev); 642EXPORT_SYMBOL_GPL(free_sja1000dev);
643 643
644static const struct net_device_ops sja1000_netdev_ops = { 644static const struct net_device_ops sja1000_netdev_ops = {
645 .ndo_open = sja1000_open, 645 .ndo_open = sja1000_open,
646 .ndo_stop = sja1000_close, 646 .ndo_stop = sja1000_close,
647 .ndo_start_xmit = sja1000_start_xmit, 647 .ndo_start_xmit = sja1000_start_xmit,
648 .ndo_change_mtu = can_change_mtu,
648}; 649};
649 650
650int register_sja1000dev(struct net_device *dev) 651int register_sja1000dev(struct net_device *dev)
diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
index 3fcdae266377..f5b16e0e3a12 100644
--- a/drivers/net/can/slcan.c
+++ b/drivers/net/can/slcan.c
@@ -411,10 +411,16 @@ static void slc_free_netdev(struct net_device *dev)
411 slcan_devs[i] = NULL; 411 slcan_devs[i] = NULL;
412} 412}
413 413
414static int slcan_change_mtu(struct net_device *dev, int new_mtu)
415{
416 return -EINVAL;
417}
418
414static const struct net_device_ops slc_netdev_ops = { 419static const struct net_device_ops slc_netdev_ops = {
415 .ndo_open = slc_open, 420 .ndo_open = slc_open,
416 .ndo_stop = slc_close, 421 .ndo_stop = slc_close,
417 .ndo_start_xmit = slc_xmit, 422 .ndo_start_xmit = slc_xmit,
423 .ndo_change_mtu = slcan_change_mtu,
418}; 424};
419 425
420static void slc_setup(struct net_device *dev) 426static void slc_setup(struct net_device *dev)
diff --git a/drivers/net/can/softing/softing_main.c b/drivers/net/can/softing/softing_main.c
index 9ea0dcde94ce..3766bd90f3ed 100644
--- a/drivers/net/can/softing/softing_main.c
+++ b/drivers/net/can/softing/softing_main.c
@@ -628,6 +628,7 @@ static const struct net_device_ops softing_netdev_ops = {
628 .ndo_open = softing_netdev_open, 628 .ndo_open = softing_netdev_open,
629 .ndo_stop = softing_netdev_stop, 629 .ndo_stop = softing_netdev_stop,
630 .ndo_start_xmit = softing_netdev_start_xmit, 630 .ndo_start_xmit = softing_netdev_start_xmit,
631 .ndo_change_mtu = can_change_mtu,
631}; 632};
632 633
633static const struct can_bittiming_const softing_btr_const = { 634static const struct can_bittiming_const softing_btr_const = {
diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c
index 2c62fe6c8fa9..258b9c4856ec 100644
--- a/drivers/net/can/ti_hecc.c
+++ b/drivers/net/can/ti_hecc.c
@@ -871,6 +871,7 @@ static const struct net_device_ops ti_hecc_netdev_ops = {
871 .ndo_open = ti_hecc_open, 871 .ndo_open = ti_hecc_open,
872 .ndo_stop = ti_hecc_close, 872 .ndo_stop = ti_hecc_close,
873 .ndo_start_xmit = ti_hecc_xmit, 873 .ndo_start_xmit = ti_hecc_xmit,
874 .ndo_change_mtu = can_change_mtu,
874}; 875};
875 876
876static int ti_hecc_probe(struct platform_device *pdev) 877static int ti_hecc_probe(struct platform_device *pdev)
diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c
index 52c42fd49510..00f2534dde73 100644
--- a/drivers/net/can/usb/ems_usb.c
+++ b/drivers/net/can/usb/ems_usb.c
@@ -883,6 +883,7 @@ static const struct net_device_ops ems_usb_netdev_ops = {
883 .ndo_open = ems_usb_open, 883 .ndo_open = ems_usb_open,
884 .ndo_stop = ems_usb_close, 884 .ndo_stop = ems_usb_close,
885 .ndo_start_xmit = ems_usb_start_xmit, 885 .ndo_start_xmit = ems_usb_start_xmit,
886 .ndo_change_mtu = can_change_mtu,
886}; 887};
887 888
888static const struct can_bittiming_const ems_usb_bittiming_const = { 889static const struct can_bittiming_const ems_usb_bittiming_const = {
diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c
index 7fbe85935f1d..1f8ce91adbd3 100644
--- a/drivers/net/can/usb/esd_usb2.c
+++ b/drivers/net/can/usb/esd_usb2.c
@@ -888,6 +888,7 @@ static const struct net_device_ops esd_usb2_netdev_ops = {
888 .ndo_open = esd_usb2_open, 888 .ndo_open = esd_usb2_open,
889 .ndo_stop = esd_usb2_close, 889 .ndo_stop = esd_usb2_close,
890 .ndo_start_xmit = esd_usb2_start_xmit, 890 .ndo_start_xmit = esd_usb2_start_xmit,
891 .ndo_change_mtu = can_change_mtu,
891}; 892};
892 893
893static const struct can_bittiming_const esd_usb2_bittiming_const = { 894static const struct can_bittiming_const esd_usb2_bittiming_const = {
diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
index e77d11049747..ea596b53a5ae 100644
--- a/drivers/net/can/usb/kvaser_usb.c
+++ b/drivers/net/can/usb/kvaser_usb.c
@@ -1388,6 +1388,7 @@ static const struct net_device_ops kvaser_usb_netdev_ops = {
1388 .ndo_open = kvaser_usb_open, 1388 .ndo_open = kvaser_usb_open,
1389 .ndo_stop = kvaser_usb_close, 1389 .ndo_stop = kvaser_usb_close,
1390 .ndo_start_xmit = kvaser_usb_start_xmit, 1390 .ndo_start_xmit = kvaser_usb_start_xmit,
1391 .ndo_change_mtu = can_change_mtu,
1391}; 1392};
1392 1393
1393static const struct can_bittiming_const kvaser_usb_bittiming_const = { 1394static const struct can_bittiming_const kvaser_usb_bittiming_const = {
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
index 0b7a4c3b01a2..93e4a55a6c23 100644
--- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c
+++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
@@ -702,6 +702,7 @@ static const struct net_device_ops peak_usb_netdev_ops = {
702 .ndo_open = peak_usb_ndo_open, 702 .ndo_open = peak_usb_ndo_open,
703 .ndo_stop = peak_usb_ndo_stop, 703 .ndo_stop = peak_usb_ndo_stop,
704 .ndo_start_xmit = peak_usb_ndo_start_xmit, 704 .ndo_start_xmit = peak_usb_ndo_start_xmit,
705 .ndo_change_mtu = can_change_mtu,
705}; 706};
706 707
707/* 708/*
diff --git a/drivers/net/can/usb/usb_8dev.c b/drivers/net/can/usb/usb_8dev.c
index a0fa1fd5092b..cde263459932 100644
--- a/drivers/net/can/usb/usb_8dev.c
+++ b/drivers/net/can/usb/usb_8dev.c
@@ -887,6 +887,7 @@ static const struct net_device_ops usb_8dev_netdev_ops = {
887 .ndo_open = usb_8dev_open, 887 .ndo_open = usb_8dev_open,
888 .ndo_stop = usb_8dev_close, 888 .ndo_stop = usb_8dev_close,
889 .ndo_start_xmit = usb_8dev_start_xmit, 889 .ndo_start_xmit = usb_8dev_start_xmit,
890 .ndo_change_mtu = can_change_mtu,
890}; 891};
891 892
892static const struct can_bittiming_const usb_8dev_bittiming_const = { 893static const struct can_bittiming_const usb_8dev_bittiming_const = {