diff options
author | David S. Miller <davem@davemloft.net> | 2014-03-07 17:08:57 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-03-07 17:08:57 -0500 |
commit | d03e9d07adc8c3800b82c3f29fd0708f49a836dd (patch) | |
tree | c8845f8bfa4ddabcaebf662dcfb50d098d9c1a50 | |
parent | a5d5ff572c33acc629779e383f02c048a98859e0 (diff) | |
parent | dd22586dec4c1444608affd83b1fedd520280ab4 (diff) |
Merge tag 'linux-can-next-for-3.15-20140307' of git://gitorious.org/linux-can/linux-can-next
Marc Kleine-Budde says:
====================
pull-request: can-next 2014-02-12
this is a pull request of twelve patches for net-next/master.
Alexander Shiyan contributes two patches for the mcp251x, one making
the driver more quiet and the other one improves the compile time
coverage by removing the #ifdef CONFIG_PM_SLEEP. Then two patches for
the flexcan driver by me, one removing the #ifdef CONFIG_PM_SLEEP, too,
the other one making use of platform_get_device_id(). Another patch by
me which converts the janz-ican3 driver to use netdev_<level>(). The
remaining 7 patches are by Oliver Hartkopp, they add CAN FD support to
the netlink configuration interface.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/can/dev.c | 159 | ||||
-rw-r--r-- | drivers/net/can/flexcan.c | 10 | ||||
-rw-r--r-- | drivers/net/can/janz-ican3.c | 64 | ||||
-rw-r--r-- | drivers/net/can/mcp251x.c | 17 | ||||
-rw-r--r-- | include/linux/can/dev.h | 7 | ||||
-rw-r--r-- | include/uapi/linux/can/netlink.h | 3 |
6 files changed, 172 insertions, 88 deletions
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c index c0563f183721..c7a260478749 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c | |||
@@ -99,10 +99,10 @@ static int can_update_spt(const struct can_bittiming_const *btc, | |||
99 | return 1000 * (tseg + 1 - *tseg2) / (tseg + 1); | 99 | return 1000 * (tseg + 1 - *tseg2) / (tseg + 1); |
100 | } | 100 | } |
101 | 101 | ||
102 | static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt) | 102 | static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt, |
103 | const struct can_bittiming_const *btc) | ||
103 | { | 104 | { |
104 | struct can_priv *priv = netdev_priv(dev); | 105 | struct can_priv *priv = netdev_priv(dev); |
105 | const struct can_bittiming_const *btc = priv->bittiming_const; | ||
106 | long rate, best_rate = 0; | 106 | long rate, best_rate = 0; |
107 | long best_error = 1000000000, error = 0; | 107 | long best_error = 1000000000, error = 0; |
108 | int best_tseg = 0, best_brp = 0, brp = 0; | 108 | int best_tseg = 0, best_brp = 0, brp = 0; |
@@ -110,9 +110,6 @@ static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt) | |||
110 | int spt_error = 1000, spt = 0, sampl_pt; | 110 | int spt_error = 1000, spt = 0, sampl_pt; |
111 | u64 v64; | 111 | u64 v64; |
112 | 112 | ||
113 | if (!priv->bittiming_const) | ||
114 | return -ENOTSUPP; | ||
115 | |||
116 | /* Use CIA recommended sample points */ | 113 | /* Use CIA recommended sample points */ |
117 | if (bt->sample_point) { | 114 | if (bt->sample_point) { |
118 | sampl_pt = bt->sample_point; | 115 | sampl_pt = bt->sample_point; |
@@ -204,7 +201,8 @@ static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt) | |||
204 | return 0; | 201 | return 0; |
205 | } | 202 | } |
206 | #else /* !CONFIG_CAN_CALC_BITTIMING */ | 203 | #else /* !CONFIG_CAN_CALC_BITTIMING */ |
207 | static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt) | 204 | static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt, |
205 | const struct can_bittiming_const *btc) | ||
208 | { | 206 | { |
209 | netdev_err(dev, "bit-timing calculation not available\n"); | 207 | netdev_err(dev, "bit-timing calculation not available\n"); |
210 | return -EINVAL; | 208 | return -EINVAL; |
@@ -217,16 +215,13 @@ static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt) | |||
217 | * prescaler value brp. You can find more information in the header | 215 | * prescaler value brp. You can find more information in the header |
218 | * file linux/can/netlink.h. | 216 | * file linux/can/netlink.h. |
219 | */ | 217 | */ |
220 | static int can_fixup_bittiming(struct net_device *dev, struct can_bittiming *bt) | 218 | static int can_fixup_bittiming(struct net_device *dev, struct can_bittiming *bt, |
219 | const struct can_bittiming_const *btc) | ||
221 | { | 220 | { |
222 | struct can_priv *priv = netdev_priv(dev); | 221 | struct can_priv *priv = netdev_priv(dev); |
223 | const struct can_bittiming_const *btc = priv->bittiming_const; | ||
224 | int tseg1, alltseg; | 222 | int tseg1, alltseg; |
225 | u64 brp64; | 223 | u64 brp64; |
226 | 224 | ||
227 | if (!priv->bittiming_const) | ||
228 | return -ENOTSUPP; | ||
229 | |||
230 | tseg1 = bt->prop_seg + bt->phase_seg1; | 225 | tseg1 = bt->prop_seg + bt->phase_seg1; |
231 | if (!bt->sjw) | 226 | if (!bt->sjw) |
232 | bt->sjw = 1; | 227 | bt->sjw = 1; |
@@ -254,26 +249,29 @@ static int can_fixup_bittiming(struct net_device *dev, struct can_bittiming *bt) | |||
254 | return 0; | 249 | return 0; |
255 | } | 250 | } |
256 | 251 | ||
257 | static int can_get_bittiming(struct net_device *dev, struct can_bittiming *bt) | 252 | static int can_get_bittiming(struct net_device *dev, struct can_bittiming *bt, |
253 | const struct can_bittiming_const *btc) | ||
258 | { | 254 | { |
259 | struct can_priv *priv = netdev_priv(dev); | ||
260 | int err; | 255 | int err; |
261 | 256 | ||
262 | /* Check if the CAN device has bit-timing parameters */ | 257 | /* Check if the CAN device has bit-timing parameters */ |
263 | if (priv->bittiming_const) { | 258 | if (!btc) |
259 | return -ENOTSUPP; | ||
264 | 260 | ||
265 | /* Non-expert mode? Check if the bitrate has been pre-defined */ | 261 | /* |
266 | if (!bt->tq) | 262 | * Depending on the given can_bittiming parameter structure the CAN |
267 | /* Determine bit-timing parameters */ | 263 | * timing parameters are calculated based on the provided bitrate OR |
268 | err = can_calc_bittiming(dev, bt); | 264 | * alternatively the CAN timing parameters (tq, prop_seg, etc.) are |
269 | else | 265 | * provided directly which are then checked and fixed up. |
270 | /* Check bit-timing params and calculate proper brp */ | 266 | */ |
271 | err = can_fixup_bittiming(dev, bt); | 267 | if (!bt->tq && bt->bitrate) |
272 | if (err) | 268 | err = can_calc_bittiming(dev, bt, btc); |
273 | return err; | 269 | else if (bt->tq && !bt->bitrate) |
274 | } | 270 | err = can_fixup_bittiming(dev, bt, btc); |
271 | else | ||
272 | err = -EINVAL; | ||
275 | 273 | ||
276 | return 0; | 274 | return err; |
277 | } | 275 | } |
278 | 276 | ||
279 | /* | 277 | /* |
@@ -317,7 +315,9 @@ void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, | |||
317 | BUG_ON(idx >= priv->echo_skb_max); | 315 | BUG_ON(idx >= priv->echo_skb_max); |
318 | 316 | ||
319 | /* check flag whether this packet has to be looped back */ | 317 | /* check flag whether this packet has to be looped back */ |
320 | if (!(dev->flags & IFF_ECHO) || skb->pkt_type != PACKET_LOOPBACK) { | 318 | if (!(dev->flags & IFF_ECHO) || skb->pkt_type != PACKET_LOOPBACK || |
319 | (skb->protocol != htons(ETH_P_CAN) && | ||
320 | skb->protocol != htons(ETH_P_CANFD))) { | ||
321 | kfree_skb(skb); | 321 | kfree_skb(skb); |
322 | return; | 322 | return; |
323 | } | 323 | } |
@@ -329,7 +329,6 @@ void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, | |||
329 | return; | 329 | return; |
330 | 330 | ||
331 | /* make settings for echo to reduce code in irq context */ | 331 | /* make settings for echo to reduce code in irq context */ |
332 | skb->protocol = htons(ETH_P_CAN); | ||
333 | skb->pkt_type = PACKET_BROADCAST; | 332 | skb->pkt_type = PACKET_BROADCAST; |
334 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 333 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
335 | skb->dev = dev; | 334 | skb->dev = dev; |
@@ -596,6 +595,39 @@ void free_candev(struct net_device *dev) | |||
596 | EXPORT_SYMBOL_GPL(free_candev); | 595 | EXPORT_SYMBOL_GPL(free_candev); |
597 | 596 | ||
598 | /* | 597 | /* |
598 | * changing MTU and control mode for CAN/CANFD devices | ||
599 | */ | ||
600 | int can_change_mtu(struct net_device *dev, int new_mtu) | ||
601 | { | ||
602 | struct can_priv *priv = netdev_priv(dev); | ||
603 | |||
604 | /* Do not allow changing the MTU while running */ | ||
605 | if (dev->flags & IFF_UP) | ||
606 | return -EBUSY; | ||
607 | |||
608 | /* allow change of MTU according to the CANFD ability of the device */ | ||
609 | switch (new_mtu) { | ||
610 | case CAN_MTU: | ||
611 | priv->ctrlmode &= ~CAN_CTRLMODE_FD; | ||
612 | break; | ||
613 | |||
614 | case CANFD_MTU: | ||
615 | if (!(priv->ctrlmode_supported & CAN_CTRLMODE_FD)) | ||
616 | return -EINVAL; | ||
617 | |||
618 | priv->ctrlmode |= CAN_CTRLMODE_FD; | ||
619 | break; | ||
620 | |||
621 | default: | ||
622 | return -EINVAL; | ||
623 | } | ||
624 | |||
625 | dev->mtu = new_mtu; | ||
626 | return 0; | ||
627 | } | ||
628 | EXPORT_SYMBOL_GPL(can_change_mtu); | ||
629 | |||
630 | /* | ||
599 | * Common open function when the device gets opened. | 631 | * Common open function when the device gets opened. |
600 | * | 632 | * |
601 | * This function should be called in the open function of the device | 633 | * This function should be called in the open function of the device |
@@ -605,11 +637,19 @@ int open_candev(struct net_device *dev) | |||
605 | { | 637 | { |
606 | struct can_priv *priv = netdev_priv(dev); | 638 | struct can_priv *priv = netdev_priv(dev); |
607 | 639 | ||
608 | if (!priv->bittiming.tq && !priv->bittiming.bitrate) { | 640 | if (!priv->bittiming.bitrate) { |
609 | netdev_err(dev, "bit-timing not yet defined\n"); | 641 | netdev_err(dev, "bit-timing not yet defined\n"); |
610 | return -EINVAL; | 642 | return -EINVAL; |
611 | } | 643 | } |
612 | 644 | ||
645 | /* For CAN FD the data bitrate has to be >= the arbitration bitrate */ | ||
646 | if ((priv->ctrlmode & CAN_CTRLMODE_FD) && | ||
647 | (!priv->data_bittiming.bitrate || | ||
648 | (priv->data_bittiming.bitrate < priv->bittiming.bitrate))) { | ||
649 | netdev_err(dev, "incorrect/missing data bit-timing\n"); | ||
650 | return -EINVAL; | ||
651 | } | ||
652 | |||
613 | /* Switch carrier on if device was stopped while in bus-off state */ | 653 | /* Switch carrier on if device was stopped while in bus-off state */ |
614 | if (!netif_carrier_ok(dev)) | 654 | if (!netif_carrier_ok(dev)) |
615 | netif_carrier_on(dev); | 655 | netif_carrier_on(dev); |
@@ -648,6 +688,10 @@ static const struct nla_policy can_policy[IFLA_CAN_MAX + 1] = { | |||
648 | = { .len = sizeof(struct can_bittiming_const) }, | 688 | = { .len = sizeof(struct can_bittiming_const) }, |
649 | [IFLA_CAN_CLOCK] = { .len = sizeof(struct can_clock) }, | 689 | [IFLA_CAN_CLOCK] = { .len = sizeof(struct can_clock) }, |
650 | [IFLA_CAN_BERR_COUNTER] = { .len = sizeof(struct can_berr_counter) }, | 690 | [IFLA_CAN_BERR_COUNTER] = { .len = sizeof(struct can_berr_counter) }, |
691 | [IFLA_CAN_DATA_BITTIMING] | ||
692 | = { .len = sizeof(struct can_bittiming) }, | ||
693 | [IFLA_CAN_DATA_BITTIMING_CONST] | ||
694 | = { .len = sizeof(struct can_bittiming_const) }, | ||
651 | }; | 695 | }; |
652 | 696 | ||
653 | static int can_changelink(struct net_device *dev, | 697 | static int can_changelink(struct net_device *dev, |
@@ -666,9 +710,7 @@ static int can_changelink(struct net_device *dev, | |||
666 | if (dev->flags & IFF_UP) | 710 | if (dev->flags & IFF_UP) |
667 | return -EBUSY; | 711 | return -EBUSY; |
668 | memcpy(&bt, nla_data(data[IFLA_CAN_BITTIMING]), sizeof(bt)); | 712 | memcpy(&bt, nla_data(data[IFLA_CAN_BITTIMING]), sizeof(bt)); |
669 | if ((!bt.bitrate && !bt.tq) || (bt.bitrate && bt.tq)) | 713 | err = can_get_bittiming(dev, &bt, priv->bittiming_const); |
670 | return -EINVAL; | ||
671 | err = can_get_bittiming(dev, &bt); | ||
672 | if (err) | 714 | if (err) |
673 | return err; | 715 | return err; |
674 | memcpy(&priv->bittiming, &bt, sizeof(bt)); | 716 | memcpy(&priv->bittiming, &bt, sizeof(bt)); |
@@ -692,6 +734,12 @@ static int can_changelink(struct net_device *dev, | |||
692 | return -EOPNOTSUPP; | 734 | return -EOPNOTSUPP; |
693 | priv->ctrlmode &= ~cm->mask; | 735 | priv->ctrlmode &= ~cm->mask; |
694 | priv->ctrlmode |= cm->flags; | 736 | priv->ctrlmode |= cm->flags; |
737 | |||
738 | /* CAN_CTRLMODE_FD can only be set when driver supports FD */ | ||
739 | if (priv->ctrlmode & CAN_CTRLMODE_FD) | ||
740 | dev->mtu = CANFD_MTU; | ||
741 | else | ||
742 | dev->mtu = CAN_MTU; | ||
695 | } | 743 | } |
696 | 744 | ||
697 | if (data[IFLA_CAN_RESTART_MS]) { | 745 | if (data[IFLA_CAN_RESTART_MS]) { |
@@ -710,6 +758,27 @@ static int can_changelink(struct net_device *dev, | |||
710 | return err; | 758 | return err; |
711 | } | 759 | } |
712 | 760 | ||
761 | if (data[IFLA_CAN_DATA_BITTIMING]) { | ||
762 | struct can_bittiming dbt; | ||
763 | |||
764 | /* Do not allow changing bittiming while running */ | ||
765 | if (dev->flags & IFF_UP) | ||
766 | return -EBUSY; | ||
767 | memcpy(&dbt, nla_data(data[IFLA_CAN_DATA_BITTIMING]), | ||
768 | sizeof(dbt)); | ||
769 | err = can_get_bittiming(dev, &dbt, priv->data_bittiming_const); | ||
770 | if (err) | ||
771 | return err; | ||
772 | memcpy(&priv->data_bittiming, &dbt, sizeof(dbt)); | ||
773 | |||
774 | if (priv->do_set_data_bittiming) { | ||
775 | /* Finally, set the bit-timing registers */ | ||
776 | err = priv->do_set_data_bittiming(dev); | ||
777 | if (err) | ||
778 | return err; | ||
779 | } | ||
780 | } | ||
781 | |||
713 | return 0; | 782 | return 0; |
714 | } | 783 | } |
715 | 784 | ||
@@ -718,7 +787,8 @@ static size_t can_get_size(const struct net_device *dev) | |||
718 | struct can_priv *priv = netdev_priv(dev); | 787 | struct can_priv *priv = netdev_priv(dev); |
719 | size_t size = 0; | 788 | size_t size = 0; |
720 | 789 | ||
721 | size += nla_total_size(sizeof(struct can_bittiming)); /* IFLA_CAN_BITTIMING */ | 790 | if (priv->bittiming.bitrate) /* IFLA_CAN_BITTIMING */ |
791 | size += nla_total_size(sizeof(struct can_bittiming)); | ||
722 | if (priv->bittiming_const) /* IFLA_CAN_BITTIMING_CONST */ | 792 | if (priv->bittiming_const) /* IFLA_CAN_BITTIMING_CONST */ |
723 | size += nla_total_size(sizeof(struct can_bittiming_const)); | 793 | size += nla_total_size(sizeof(struct can_bittiming_const)); |
724 | size += nla_total_size(sizeof(struct can_clock)); /* IFLA_CAN_CLOCK */ | 794 | size += nla_total_size(sizeof(struct can_clock)); /* IFLA_CAN_CLOCK */ |
@@ -727,6 +797,10 @@ static size_t can_get_size(const struct net_device *dev) | |||
727 | size += nla_total_size(sizeof(u32)); /* IFLA_CAN_RESTART_MS */ | 797 | size += nla_total_size(sizeof(u32)); /* IFLA_CAN_RESTART_MS */ |
728 | if (priv->do_get_berr_counter) /* IFLA_CAN_BERR_COUNTER */ | 798 | if (priv->do_get_berr_counter) /* IFLA_CAN_BERR_COUNTER */ |
729 | size += nla_total_size(sizeof(struct can_berr_counter)); | 799 | size += nla_total_size(sizeof(struct can_berr_counter)); |
800 | if (priv->data_bittiming.bitrate) /* IFLA_CAN_DATA_BITTIMING */ | ||
801 | size += nla_total_size(sizeof(struct can_bittiming)); | ||
802 | if (priv->data_bittiming_const) /* IFLA_CAN_DATA_BITTIMING_CONST */ | ||
803 | size += nla_total_size(sizeof(struct can_bittiming_const)); | ||
730 | 804 | ||
731 | return size; | 805 | return size; |
732 | } | 806 | } |
@@ -740,19 +814,34 @@ static int can_fill_info(struct sk_buff *skb, const struct net_device *dev) | |||
740 | 814 | ||
741 | if (priv->do_get_state) | 815 | if (priv->do_get_state) |
742 | priv->do_get_state(dev, &state); | 816 | priv->do_get_state(dev, &state); |
743 | if (nla_put(skb, IFLA_CAN_BITTIMING, | 817 | |
744 | sizeof(priv->bittiming), &priv->bittiming) || | 818 | if ((priv->bittiming.bitrate && |
819 | nla_put(skb, IFLA_CAN_BITTIMING, | ||
820 | sizeof(priv->bittiming), &priv->bittiming)) || | ||
821 | |||
745 | (priv->bittiming_const && | 822 | (priv->bittiming_const && |
746 | nla_put(skb, IFLA_CAN_BITTIMING_CONST, | 823 | nla_put(skb, IFLA_CAN_BITTIMING_CONST, |
747 | sizeof(*priv->bittiming_const), priv->bittiming_const)) || | 824 | sizeof(*priv->bittiming_const), priv->bittiming_const)) || |
825 | |||
748 | nla_put(skb, IFLA_CAN_CLOCK, sizeof(cm), &priv->clock) || | 826 | nla_put(skb, IFLA_CAN_CLOCK, sizeof(cm), &priv->clock) || |
749 | nla_put_u32(skb, IFLA_CAN_STATE, state) || | 827 | nla_put_u32(skb, IFLA_CAN_STATE, state) || |
750 | nla_put(skb, IFLA_CAN_CTRLMODE, sizeof(cm), &cm) || | 828 | nla_put(skb, IFLA_CAN_CTRLMODE, sizeof(cm), &cm) || |
751 | nla_put_u32(skb, IFLA_CAN_RESTART_MS, priv->restart_ms) || | 829 | nla_put_u32(skb, IFLA_CAN_RESTART_MS, priv->restart_ms) || |
830 | |||
752 | (priv->do_get_berr_counter && | 831 | (priv->do_get_berr_counter && |
753 | !priv->do_get_berr_counter(dev, &bec) && | 832 | !priv->do_get_berr_counter(dev, &bec) && |
754 | nla_put(skb, IFLA_CAN_BERR_COUNTER, sizeof(bec), &bec))) | 833 | nla_put(skb, IFLA_CAN_BERR_COUNTER, sizeof(bec), &bec)) || |
834 | |||
835 | (priv->data_bittiming.bitrate && | ||
836 | nla_put(skb, IFLA_CAN_DATA_BITTIMING, | ||
837 | sizeof(priv->data_bittiming), &priv->data_bittiming)) || | ||
838 | |||
839 | (priv->data_bittiming_const && | ||
840 | nla_put(skb, IFLA_CAN_DATA_BITTIMING_CONST, | ||
841 | sizeof(*priv->data_bittiming_const), | ||
842 | priv->data_bittiming_const))) | ||
755 | return -EMSGSIZE; | 843 | return -EMSGSIZE; |
844 | |||
756 | return 0; | 845 | return 0; |
757 | } | 846 | } |
758 | 847 | ||
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index 61376abdab39..c94d698b73c2 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c | |||
@@ -1132,9 +1132,9 @@ static int flexcan_probe(struct platform_device *pdev) | |||
1132 | of_id = of_match_device(flexcan_of_match, &pdev->dev); | 1132 | of_id = of_match_device(flexcan_of_match, &pdev->dev); |
1133 | if (of_id) { | 1133 | if (of_id) { |
1134 | devtype_data = of_id->data; | 1134 | devtype_data = of_id->data; |
1135 | } else if (pdev->id_entry->driver_data) { | 1135 | } else if (platform_get_device_id(pdev)->driver_data) { |
1136 | devtype_data = (struct flexcan_devtype_data *) | 1136 | devtype_data = (struct flexcan_devtype_data *) |
1137 | pdev->id_entry->driver_data; | 1137 | platform_get_device_id(pdev)->driver_data; |
1138 | } else { | 1138 | } else { |
1139 | return -ENODEV; | 1139 | return -ENODEV; |
1140 | } | 1140 | } |
@@ -1201,8 +1201,7 @@ static int flexcan_remove(struct platform_device *pdev) | |||
1201 | return 0; | 1201 | return 0; |
1202 | } | 1202 | } |
1203 | 1203 | ||
1204 | #ifdef CONFIG_PM_SLEEP | 1204 | static int __maybe_unused flexcan_suspend(struct device *device) |
1205 | static int flexcan_suspend(struct device *device) | ||
1206 | { | 1205 | { |
1207 | struct net_device *dev = dev_get_drvdata(device); | 1206 | struct net_device *dev = dev_get_drvdata(device); |
1208 | struct flexcan_priv *priv = netdev_priv(dev); | 1207 | struct flexcan_priv *priv = netdev_priv(dev); |
@@ -1221,7 +1220,7 @@ static int flexcan_suspend(struct device *device) | |||
1221 | return 0; | 1220 | return 0; |
1222 | } | 1221 | } |
1223 | 1222 | ||
1224 | static int flexcan_resume(struct device *device) | 1223 | static int __maybe_unused flexcan_resume(struct device *device) |
1225 | { | 1224 | { |
1226 | struct net_device *dev = dev_get_drvdata(device); | 1225 | struct net_device *dev = dev_get_drvdata(device); |
1227 | struct flexcan_priv *priv = netdev_priv(dev); | 1226 | struct flexcan_priv *priv = netdev_priv(dev); |
@@ -1233,7 +1232,6 @@ static int flexcan_resume(struct device *device) | |||
1233 | } | 1232 | } |
1234 | return flexcan_chip_enable(priv); | 1233 | return flexcan_chip_enable(priv); |
1235 | } | 1234 | } |
1236 | #endif /* CONFIG_PM_SLEEP */ | ||
1237 | 1235 | ||
1238 | static SIMPLE_DEV_PM_OPS(flexcan_pm_ops, flexcan_suspend, flexcan_resume); | 1236 | static SIMPLE_DEV_PM_OPS(flexcan_pm_ops, flexcan_suspend, flexcan_resume); |
1239 | 1237 | ||
diff --git a/drivers/net/can/janz-ican3.c b/drivers/net/can/janz-ican3.c index 71594e5676fd..b47df5e482fa 100644 --- a/drivers/net/can/janz-ican3.c +++ b/drivers/net/can/janz-ican3.c | |||
@@ -198,9 +198,6 @@ struct ican3_dev { | |||
198 | struct net_device *ndev; | 198 | struct net_device *ndev; |
199 | struct napi_struct napi; | 199 | struct napi_struct napi; |
200 | 200 | ||
201 | /* Device for printing */ | ||
202 | struct device *dev; | ||
203 | |||
204 | /* module number */ | 201 | /* module number */ |
205 | unsigned int num; | 202 | unsigned int num; |
206 | 203 | ||
@@ -295,7 +292,7 @@ static int ican3_old_recv_msg(struct ican3_dev *mod, struct ican3_msg *msg) | |||
295 | xord = locl ^ peer; | 292 | xord = locl ^ peer; |
296 | 293 | ||
297 | if ((xord & MSYNC_RB_MASK) == 0x00) { | 294 | if ((xord & MSYNC_RB_MASK) == 0x00) { |
298 | dev_dbg(mod->dev, "no mbox for reading\n"); | 295 | netdev_dbg(mod->ndev, "no mbox for reading\n"); |
299 | return -ENOMEM; | 296 | return -ENOMEM; |
300 | } | 297 | } |
301 | 298 | ||
@@ -340,7 +337,7 @@ static int ican3_old_send_msg(struct ican3_dev *mod, struct ican3_msg *msg) | |||
340 | xord = locl ^ peer; | 337 | xord = locl ^ peer; |
341 | 338 | ||
342 | if ((xord & MSYNC_WB_MASK) == MSYNC_WB_MASK) { | 339 | if ((xord & MSYNC_WB_MASK) == MSYNC_WB_MASK) { |
343 | dev_err(mod->dev, "no mbox for writing\n"); | 340 | netdev_err(mod->ndev, "no mbox for writing\n"); |
344 | return -ENOMEM; | 341 | return -ENOMEM; |
345 | } | 342 | } |
346 | 343 | ||
@@ -542,7 +539,7 @@ static int ican3_new_send_msg(struct ican3_dev *mod, struct ican3_msg *msg) | |||
542 | memcpy_fromio(&desc, desc_addr, sizeof(desc)); | 539 | memcpy_fromio(&desc, desc_addr, sizeof(desc)); |
543 | 540 | ||
544 | if (!(desc.control & DESC_VALID)) { | 541 | if (!(desc.control & DESC_VALID)) { |
545 | dev_dbg(mod->dev, "%s: no free buffers\n", __func__); | 542 | netdev_dbg(mod->ndev, "%s: no free buffers\n", __func__); |
546 | return -ENOMEM; | 543 | return -ENOMEM; |
547 | } | 544 | } |
548 | 545 | ||
@@ -573,7 +570,7 @@ static int ican3_new_recv_msg(struct ican3_dev *mod, struct ican3_msg *msg) | |||
573 | memcpy_fromio(&desc, desc_addr, sizeof(desc)); | 570 | memcpy_fromio(&desc, desc_addr, sizeof(desc)); |
574 | 571 | ||
575 | if (!(desc.control & DESC_VALID)) { | 572 | if (!(desc.control & DESC_VALID)) { |
576 | dev_dbg(mod->dev, "%s: no buffers to recv\n", __func__); | 573 | netdev_dbg(mod->ndev, "%s: no buffers to recv\n", __func__); |
577 | return -ENOMEM; | 574 | return -ENOMEM; |
578 | } | 575 | } |
579 | 576 | ||
@@ -883,7 +880,7 @@ static void can_frame_to_ican3(struct ican3_dev *mod, | |||
883 | */ | 880 | */ |
884 | static void ican3_handle_idvers(struct ican3_dev *mod, struct ican3_msg *msg) | 881 | static void ican3_handle_idvers(struct ican3_dev *mod, struct ican3_msg *msg) |
885 | { | 882 | { |
886 | dev_dbg(mod->dev, "IDVERS response: %s\n", msg->data); | 883 | netdev_dbg(mod->ndev, "IDVERS response: %s\n", msg->data); |
887 | } | 884 | } |
888 | 885 | ||
889 | static void ican3_handle_msglost(struct ican3_dev *mod, struct ican3_msg *msg) | 886 | static void ican3_handle_msglost(struct ican3_dev *mod, struct ican3_msg *msg) |
@@ -899,7 +896,7 @@ static void ican3_handle_msglost(struct ican3_dev *mod, struct ican3_msg *msg) | |||
899 | * error frame for userspace | 896 | * error frame for userspace |
900 | */ | 897 | */ |
901 | if (msg->spec == MSG_MSGLOST) { | 898 | if (msg->spec == MSG_MSGLOST) { |
902 | dev_err(mod->dev, "lost %d control messages\n", msg->data[0]); | 899 | netdev_err(mod->ndev, "lost %d control messages\n", msg->data[0]); |
903 | return; | 900 | return; |
904 | } | 901 | } |
905 | 902 | ||
@@ -939,13 +936,13 @@ static int ican3_handle_cevtind(struct ican3_dev *mod, struct ican3_msg *msg) | |||
939 | 936 | ||
940 | /* we can only handle the SJA1000 part */ | 937 | /* we can only handle the SJA1000 part */ |
941 | if (msg->data[1] != CEVTIND_CHIP_SJA1000) { | 938 | if (msg->data[1] != CEVTIND_CHIP_SJA1000) { |
942 | dev_err(mod->dev, "unable to handle errors on non-SJA1000\n"); | 939 | netdev_err(mod->ndev, "unable to handle errors on non-SJA1000\n"); |
943 | return -ENODEV; | 940 | return -ENODEV; |
944 | } | 941 | } |
945 | 942 | ||
946 | /* check the message length for sanity */ | 943 | /* check the message length for sanity */ |
947 | if (le16_to_cpu(msg->len) < 6) { | 944 | if (le16_to_cpu(msg->len) < 6) { |
948 | dev_err(mod->dev, "error message too short\n"); | 945 | netdev_err(mod->ndev, "error message too short\n"); |
949 | return -EINVAL; | 946 | return -EINVAL; |
950 | } | 947 | } |
951 | 948 | ||
@@ -967,7 +964,7 @@ static int ican3_handle_cevtind(struct ican3_dev *mod, struct ican3_msg *msg) | |||
967 | */ | 964 | */ |
968 | if (isrc == CEVTIND_BEI) { | 965 | if (isrc == CEVTIND_BEI) { |
969 | int ret; | 966 | int ret; |
970 | dev_dbg(mod->dev, "bus error interrupt\n"); | 967 | netdev_dbg(mod->ndev, "bus error interrupt\n"); |
971 | 968 | ||
972 | /* TX error */ | 969 | /* TX error */ |
973 | if (!(ecc & ECC_DIR)) { | 970 | if (!(ecc & ECC_DIR)) { |
@@ -983,7 +980,7 @@ static int ican3_handle_cevtind(struct ican3_dev *mod, struct ican3_msg *msg) | |||
983 | */ | 980 | */ |
984 | ret = ican3_set_buserror(mod, 1); | 981 | ret = ican3_set_buserror(mod, 1); |
985 | if (ret) { | 982 | if (ret) { |
986 | dev_err(mod->dev, "unable to re-enable bus-error\n"); | 983 | netdev_err(mod->ndev, "unable to re-enable bus-error\n"); |
987 | return ret; | 984 | return ret; |
988 | } | 985 | } |
989 | 986 | ||
@@ -998,7 +995,7 @@ static int ican3_handle_cevtind(struct ican3_dev *mod, struct ican3_msg *msg) | |||
998 | 995 | ||
999 | /* data overrun interrupt */ | 996 | /* data overrun interrupt */ |
1000 | if (isrc == CEVTIND_DOI || isrc == CEVTIND_LOST) { | 997 | if (isrc == CEVTIND_DOI || isrc == CEVTIND_LOST) { |
1001 | dev_dbg(mod->dev, "data overrun interrupt\n"); | 998 | netdev_dbg(mod->ndev, "data overrun interrupt\n"); |
1002 | cf->can_id |= CAN_ERR_CRTL; | 999 | cf->can_id |= CAN_ERR_CRTL; |
1003 | cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW; | 1000 | cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW; |
1004 | stats->rx_over_errors++; | 1001 | stats->rx_over_errors++; |
@@ -1007,7 +1004,7 @@ static int ican3_handle_cevtind(struct ican3_dev *mod, struct ican3_msg *msg) | |||
1007 | 1004 | ||
1008 | /* error warning + passive interrupt */ | 1005 | /* error warning + passive interrupt */ |
1009 | if (isrc == CEVTIND_EI) { | 1006 | if (isrc == CEVTIND_EI) { |
1010 | dev_dbg(mod->dev, "error warning + passive interrupt\n"); | 1007 | netdev_dbg(mod->ndev, "error warning + passive interrupt\n"); |
1011 | if (status & SR_BS) { | 1008 | if (status & SR_BS) { |
1012 | state = CAN_STATE_BUS_OFF; | 1009 | state = CAN_STATE_BUS_OFF; |
1013 | cf->can_id |= CAN_ERR_BUSOFF; | 1010 | cf->can_id |= CAN_ERR_BUSOFF; |
@@ -1088,7 +1085,7 @@ static void ican3_handle_inquiry(struct ican3_dev *mod, struct ican3_msg *msg) | |||
1088 | complete(&mod->termination_comp); | 1085 | complete(&mod->termination_comp); |
1089 | break; | 1086 | break; |
1090 | default: | 1087 | default: |
1091 | dev_err(mod->dev, "received an unknown inquiry response\n"); | 1088 | netdev_err(mod->ndev, "received an unknown inquiry response\n"); |
1092 | break; | 1089 | break; |
1093 | } | 1090 | } |
1094 | } | 1091 | } |
@@ -1096,7 +1093,7 @@ static void ican3_handle_inquiry(struct ican3_dev *mod, struct ican3_msg *msg) | |||
1096 | static void ican3_handle_unknown_message(struct ican3_dev *mod, | 1093 | static void ican3_handle_unknown_message(struct ican3_dev *mod, |
1097 | struct ican3_msg *msg) | 1094 | struct ican3_msg *msg) |
1098 | { | 1095 | { |
1099 | dev_warn(mod->dev, "received unknown message: spec 0x%.2x length %d\n", | 1096 | netdev_warn(mod->ndev, "received unknown message: spec 0x%.2x length %d\n", |
1100 | msg->spec, le16_to_cpu(msg->len)); | 1097 | msg->spec, le16_to_cpu(msg->len)); |
1101 | } | 1098 | } |
1102 | 1099 | ||
@@ -1105,7 +1102,7 @@ static void ican3_handle_unknown_message(struct ican3_dev *mod, | |||
1105 | */ | 1102 | */ |
1106 | static void ican3_handle_message(struct ican3_dev *mod, struct ican3_msg *msg) | 1103 | static void ican3_handle_message(struct ican3_dev *mod, struct ican3_msg *msg) |
1107 | { | 1104 | { |
1108 | dev_dbg(mod->dev, "%s: modno %d spec 0x%.2x len %d bytes\n", __func__, | 1105 | netdev_dbg(mod->ndev, "%s: modno %d spec 0x%.2x len %d bytes\n", __func__, |
1109 | mod->num, msg->spec, le16_to_cpu(msg->len)); | 1106 | mod->num, msg->spec, le16_to_cpu(msg->len)); |
1110 | 1107 | ||
1111 | switch (msg->spec) { | 1108 | switch (msg->spec) { |
@@ -1406,7 +1403,7 @@ static int ican3_reset_module(struct ican3_dev *mod) | |||
1406 | msleep(10); | 1403 | msleep(10); |
1407 | } while (time_before(jiffies, start + HZ / 4)); | 1404 | } while (time_before(jiffies, start + HZ / 4)); |
1408 | 1405 | ||
1409 | dev_err(mod->dev, "failed to reset CAN module\n"); | 1406 | netdev_err(mod->ndev, "failed to reset CAN module\n"); |
1410 | return -ETIMEDOUT; | 1407 | return -ETIMEDOUT; |
1411 | } | 1408 | } |
1412 | 1409 | ||
@@ -1425,7 +1422,7 @@ static int ican3_startup_module(struct ican3_dev *mod) | |||
1425 | 1422 | ||
1426 | ret = ican3_reset_module(mod); | 1423 | ret = ican3_reset_module(mod); |
1427 | if (ret) { | 1424 | if (ret) { |
1428 | dev_err(mod->dev, "unable to reset module\n"); | 1425 | netdev_err(mod->ndev, "unable to reset module\n"); |
1429 | return ret; | 1426 | return ret; |
1430 | } | 1427 | } |
1431 | 1428 | ||
@@ -1434,41 +1431,41 @@ static int ican3_startup_module(struct ican3_dev *mod) | |||
1434 | 1431 | ||
1435 | ret = ican3_msg_connect(mod); | 1432 | ret = ican3_msg_connect(mod); |
1436 | if (ret) { | 1433 | if (ret) { |
1437 | dev_err(mod->dev, "unable to connect to module\n"); | 1434 | netdev_err(mod->ndev, "unable to connect to module\n"); |
1438 | return ret; | 1435 | return ret; |
1439 | } | 1436 | } |
1440 | 1437 | ||
1441 | ican3_init_new_host_interface(mod); | 1438 | ican3_init_new_host_interface(mod); |
1442 | ret = ican3_msg_newhostif(mod); | 1439 | ret = ican3_msg_newhostif(mod); |
1443 | if (ret) { | 1440 | if (ret) { |
1444 | dev_err(mod->dev, "unable to switch to new-style interface\n"); | 1441 | netdev_err(mod->ndev, "unable to switch to new-style interface\n"); |
1445 | return ret; | 1442 | return ret; |
1446 | } | 1443 | } |
1447 | 1444 | ||
1448 | /* default to "termination on" */ | 1445 | /* default to "termination on" */ |
1449 | ret = ican3_set_termination(mod, true); | 1446 | ret = ican3_set_termination(mod, true); |
1450 | if (ret) { | 1447 | if (ret) { |
1451 | dev_err(mod->dev, "unable to enable termination\n"); | 1448 | netdev_err(mod->ndev, "unable to enable termination\n"); |
1452 | return ret; | 1449 | return ret; |
1453 | } | 1450 | } |
1454 | 1451 | ||
1455 | /* default to "bus errors enabled" */ | 1452 | /* default to "bus errors enabled" */ |
1456 | ret = ican3_set_buserror(mod, 1); | 1453 | ret = ican3_set_buserror(mod, 1); |
1457 | if (ret) { | 1454 | if (ret) { |
1458 | dev_err(mod->dev, "unable to set bus-error\n"); | 1455 | netdev_err(mod->ndev, "unable to set bus-error\n"); |
1459 | return ret; | 1456 | return ret; |
1460 | } | 1457 | } |
1461 | 1458 | ||
1462 | ican3_init_fast_host_interface(mod); | 1459 | ican3_init_fast_host_interface(mod); |
1463 | ret = ican3_msg_fasthostif(mod); | 1460 | ret = ican3_msg_fasthostif(mod); |
1464 | if (ret) { | 1461 | if (ret) { |
1465 | dev_err(mod->dev, "unable to switch to fast host interface\n"); | 1462 | netdev_err(mod->ndev, "unable to switch to fast host interface\n"); |
1466 | return ret; | 1463 | return ret; |
1467 | } | 1464 | } |
1468 | 1465 | ||
1469 | ret = ican3_set_id_filter(mod, true); | 1466 | ret = ican3_set_id_filter(mod, true); |
1470 | if (ret) { | 1467 | if (ret) { |
1471 | dev_err(mod->dev, "unable to set acceptance filter\n"); | 1468 | netdev_err(mod->ndev, "unable to set acceptance filter\n"); |
1472 | return ret; | 1469 | return ret; |
1473 | } | 1470 | } |
1474 | 1471 | ||
@@ -1487,14 +1484,14 @@ static int ican3_open(struct net_device *ndev) | |||
1487 | /* open the CAN layer */ | 1484 | /* open the CAN layer */ |
1488 | ret = open_candev(ndev); | 1485 | ret = open_candev(ndev); |
1489 | if (ret) { | 1486 | if (ret) { |
1490 | dev_err(mod->dev, "unable to start CAN layer\n"); | 1487 | netdev_err(mod->ndev, "unable to start CAN layer\n"); |
1491 | return ret; | 1488 | return ret; |
1492 | } | 1489 | } |
1493 | 1490 | ||
1494 | /* bring the bus online */ | 1491 | /* bring the bus online */ |
1495 | ret = ican3_set_bus_state(mod, true); | 1492 | ret = ican3_set_bus_state(mod, true); |
1496 | if (ret) { | 1493 | if (ret) { |
1497 | dev_err(mod->dev, "unable to set bus-on\n"); | 1494 | netdev_err(mod->ndev, "unable to set bus-on\n"); |
1498 | close_candev(ndev); | 1495 | close_candev(ndev); |
1499 | return ret; | 1496 | return ret; |
1500 | } | 1497 | } |
@@ -1518,7 +1515,7 @@ static int ican3_stop(struct net_device *ndev) | |||
1518 | /* bring the bus offline, stop receiving packets */ | 1515 | /* bring the bus offline, stop receiving packets */ |
1519 | ret = ican3_set_bus_state(mod, false); | 1516 | ret = ican3_set_bus_state(mod, false); |
1520 | if (ret) { | 1517 | if (ret) { |
1521 | dev_err(mod->dev, "unable to set bus-off\n"); | 1518 | netdev_err(mod->ndev, "unable to set bus-off\n"); |
1522 | return ret; | 1519 | return ret; |
1523 | } | 1520 | } |
1524 | 1521 | ||
@@ -1545,7 +1542,7 @@ static int ican3_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
1545 | 1542 | ||
1546 | /* check that we can actually transmit */ | 1543 | /* check that we can actually transmit */ |
1547 | if (!ican3_txok(mod)) { | 1544 | if (!ican3_txok(mod)) { |
1548 | dev_err(mod->dev, "BUG: no free descriptors\n"); | 1545 | netdev_err(mod->ndev, "BUG: no free descriptors\n"); |
1549 | spin_unlock_irqrestore(&mod->lock, flags); | 1546 | spin_unlock_irqrestore(&mod->lock, flags); |
1550 | return NETDEV_TX_BUSY; | 1547 | return NETDEV_TX_BUSY; |
1551 | } | 1548 | } |
@@ -1657,7 +1654,7 @@ static int ican3_set_mode(struct net_device *ndev, enum can_mode mode) | |||
1657 | /* bring the bus online */ | 1654 | /* bring the bus online */ |
1658 | ret = ican3_set_bus_state(mod, true); | 1655 | ret = ican3_set_bus_state(mod, true); |
1659 | if (ret) { | 1656 | if (ret) { |
1660 | dev_err(mod->dev, "unable to set bus-on\n"); | 1657 | netdev_err(ndev, "unable to set bus-on\n"); |
1661 | return ret; | 1658 | return ret; |
1662 | } | 1659 | } |
1663 | 1660 | ||
@@ -1682,7 +1679,7 @@ static int ican3_get_berr_counter(const struct net_device *ndev, | |||
1682 | 1679 | ||
1683 | ret = wait_for_completion_timeout(&mod->buserror_comp, HZ); | 1680 | ret = wait_for_completion_timeout(&mod->buserror_comp, HZ); |
1684 | if (ret == 0) { | 1681 | if (ret == 0) { |
1685 | dev_info(mod->dev, "%s timed out\n", __func__); | 1682 | netdev_info(mod->ndev, "%s timed out\n", __func__); |
1686 | return -ETIMEDOUT; | 1683 | return -ETIMEDOUT; |
1687 | } | 1684 | } |
1688 | 1685 | ||
@@ -1708,7 +1705,7 @@ static ssize_t ican3_sysfs_show_term(struct device *dev, | |||
1708 | 1705 | ||
1709 | ret = wait_for_completion_timeout(&mod->termination_comp, HZ); | 1706 | ret = wait_for_completion_timeout(&mod->termination_comp, HZ); |
1710 | if (ret == 0) { | 1707 | if (ret == 0) { |
1711 | dev_info(mod->dev, "%s timed out\n", __func__); | 1708 | netdev_info(mod->ndev, "%s timed out\n", __func__); |
1712 | return -ETIMEDOUT; | 1709 | return -ETIMEDOUT; |
1713 | } | 1710 | } |
1714 | 1711 | ||
@@ -1778,7 +1775,6 @@ static int ican3_probe(struct platform_device *pdev) | |||
1778 | platform_set_drvdata(pdev, ndev); | 1775 | platform_set_drvdata(pdev, ndev); |
1779 | mod = netdev_priv(ndev); | 1776 | mod = netdev_priv(ndev); |
1780 | mod->ndev = ndev; | 1777 | mod->ndev = ndev; |
1781 | mod->dev = &pdev->dev; | ||
1782 | mod->num = pdata->modno; | 1778 | mod->num = pdata->modno; |
1783 | netif_napi_add(ndev, &mod->napi, ican3_napi, ICAN3_RX_BUFFERS); | 1779 | netif_napi_add(ndev, &mod->napi, ican3_napi, ICAN3_RX_BUFFERS); |
1784 | skb_queue_head_init(&mod->echoq); | 1780 | skb_queue_head_init(&mod->echoq); |
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c index cdb9808d12db..50aa630c7dd4 100644 --- a/drivers/net/can/mcp251x.c +++ b/drivers/net/can/mcp251x.c | |||
@@ -601,10 +601,10 @@ static int mcp251x_do_set_bittiming(struct net_device *net) | |||
601 | (bt->prop_seg - 1)); | 601 | (bt->prop_seg - 1)); |
602 | mcp251x_write_bits(spi, CNF3, CNF3_PHSEG2_MASK, | 602 | mcp251x_write_bits(spi, CNF3, CNF3_PHSEG2_MASK, |
603 | (bt->phase_seg2 - 1)); | 603 | (bt->phase_seg2 - 1)); |
604 | dev_info(&spi->dev, "CNF: 0x%02x 0x%02x 0x%02x\n", | 604 | dev_dbg(&spi->dev, "CNF: 0x%02x 0x%02x 0x%02x\n", |
605 | mcp251x_read_reg(spi, CNF1), | 605 | mcp251x_read_reg(spi, CNF1), |
606 | mcp251x_read_reg(spi, CNF2), | 606 | mcp251x_read_reg(spi, CNF2), |
607 | mcp251x_read_reg(spi, CNF3)); | 607 | mcp251x_read_reg(spi, CNF3)); |
608 | 608 | ||
609 | return 0; | 609 | return 0; |
610 | } | 610 | } |
@@ -1155,8 +1155,6 @@ static int mcp251x_can_probe(struct spi_device *spi) | |||
1155 | 1155 | ||
1156 | devm_can_led_init(net); | 1156 | devm_can_led_init(net); |
1157 | 1157 | ||
1158 | dev_info(&spi->dev, "probed\n"); | ||
1159 | |||
1160 | return ret; | 1158 | return ret; |
1161 | 1159 | ||
1162 | error_probe: | 1160 | error_probe: |
@@ -1197,9 +1195,7 @@ static int mcp251x_can_remove(struct spi_device *spi) | |||
1197 | return 0; | 1195 | return 0; |
1198 | } | 1196 | } |
1199 | 1197 | ||
1200 | #ifdef CONFIG_PM_SLEEP | 1198 | static int __maybe_unused mcp251x_can_suspend(struct device *dev) |
1201 | |||
1202 | static int mcp251x_can_suspend(struct device *dev) | ||
1203 | { | 1199 | { |
1204 | struct spi_device *spi = to_spi_device(dev); | 1200 | struct spi_device *spi = to_spi_device(dev); |
1205 | struct mcp251x_priv *priv = spi_get_drvdata(spi); | 1201 | struct mcp251x_priv *priv = spi_get_drvdata(spi); |
@@ -1229,7 +1225,7 @@ static int mcp251x_can_suspend(struct device *dev) | |||
1229 | return 0; | 1225 | return 0; |
1230 | } | 1226 | } |
1231 | 1227 | ||
1232 | static int mcp251x_can_resume(struct device *dev) | 1228 | static int __maybe_unused mcp251x_can_resume(struct device *dev) |
1233 | { | 1229 | { |
1234 | struct spi_device *spi = to_spi_device(dev); | 1230 | struct spi_device *spi = to_spi_device(dev); |
1235 | struct mcp251x_priv *priv = spi_get_drvdata(spi); | 1231 | struct mcp251x_priv *priv = spi_get_drvdata(spi); |
@@ -1249,7 +1245,6 @@ static int mcp251x_can_resume(struct device *dev) | |||
1249 | enable_irq(spi->irq); | 1245 | enable_irq(spi->irq); |
1250 | return 0; | 1246 | return 0; |
1251 | } | 1247 | } |
1252 | #endif | ||
1253 | 1248 | ||
1254 | static SIMPLE_DEV_PM_OPS(mcp251x_can_pm_ops, mcp251x_can_suspend, | 1249 | static SIMPLE_DEV_PM_OPS(mcp251x_can_pm_ops, mcp251x_can_suspend, |
1255 | mcp251x_can_resume); | 1250 | mcp251x_can_resume); |
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h index dc5f9026b67f..3ce5e526525f 100644 --- a/include/linux/can/dev.h +++ b/include/linux/can/dev.h | |||
@@ -33,8 +33,9 @@ enum can_mode { | |||
33 | struct can_priv { | 33 | struct can_priv { |
34 | struct can_device_stats can_stats; | 34 | struct can_device_stats can_stats; |
35 | 35 | ||
36 | struct can_bittiming bittiming; | 36 | struct can_bittiming bittiming, data_bittiming; |
37 | const struct can_bittiming_const *bittiming_const; | 37 | const struct can_bittiming_const *bittiming_const, |
38 | *data_bittiming_const; | ||
38 | struct can_clock clock; | 39 | struct can_clock clock; |
39 | 40 | ||
40 | enum can_state state; | 41 | enum can_state state; |
@@ -45,6 +46,7 @@ struct can_priv { | |||
45 | struct timer_list restart_timer; | 46 | struct timer_list restart_timer; |
46 | 47 | ||
47 | int (*do_set_bittiming)(struct net_device *dev); | 48 | int (*do_set_bittiming)(struct net_device *dev); |
49 | int (*do_set_data_bittiming)(struct net_device *dev); | ||
48 | int (*do_set_mode)(struct net_device *dev, enum can_mode mode); | 50 | int (*do_set_mode)(struct net_device *dev, enum can_mode mode); |
49 | int (*do_get_state)(const struct net_device *dev, | 51 | int (*do_get_state)(const struct net_device *dev, |
50 | enum can_state *state); | 52 | enum can_state *state); |
@@ -111,6 +113,7 @@ struct can_priv *safe_candev_priv(struct net_device *dev); | |||
111 | 113 | ||
112 | int open_candev(struct net_device *dev); | 114 | int open_candev(struct net_device *dev); |
113 | void close_candev(struct net_device *dev); | 115 | void close_candev(struct net_device *dev); |
116 | int can_change_mtu(struct net_device *dev, int new_mtu); | ||
114 | 117 | ||
115 | int register_candev(struct net_device *dev); | 118 | int register_candev(struct net_device *dev); |
116 | void unregister_candev(struct net_device *dev); | 119 | void unregister_candev(struct net_device *dev); |
diff --git a/include/uapi/linux/can/netlink.h b/include/uapi/linux/can/netlink.h index df944ed206a8..7e2e1863db16 100644 --- a/include/uapi/linux/can/netlink.h +++ b/include/uapi/linux/can/netlink.h | |||
@@ -96,6 +96,7 @@ struct can_ctrlmode { | |||
96 | #define CAN_CTRLMODE_3_SAMPLES 0x04 /* Triple sampling mode */ | 96 | #define CAN_CTRLMODE_3_SAMPLES 0x04 /* Triple sampling mode */ |
97 | #define CAN_CTRLMODE_ONE_SHOT 0x08 /* One-Shot mode */ | 97 | #define CAN_CTRLMODE_ONE_SHOT 0x08 /* One-Shot mode */ |
98 | #define CAN_CTRLMODE_BERR_REPORTING 0x10 /* Bus-error reporting */ | 98 | #define CAN_CTRLMODE_BERR_REPORTING 0x10 /* Bus-error reporting */ |
99 | #define CAN_CTRLMODE_FD 0x20 /* CAN FD mode */ | ||
99 | 100 | ||
100 | /* | 101 | /* |
101 | * CAN device statistics | 102 | * CAN device statistics |
@@ -122,6 +123,8 @@ enum { | |||
122 | IFLA_CAN_RESTART_MS, | 123 | IFLA_CAN_RESTART_MS, |
123 | IFLA_CAN_RESTART, | 124 | IFLA_CAN_RESTART, |
124 | IFLA_CAN_BERR_COUNTER, | 125 | IFLA_CAN_BERR_COUNTER, |
126 | IFLA_CAN_DATA_BITTIMING, | ||
127 | IFLA_CAN_DATA_BITTIMING_CONST, | ||
125 | __IFLA_CAN_MAX | 128 | __IFLA_CAN_MAX |
126 | }; | 129 | }; |
127 | 130 | ||