Commit 7da0694c authored by David S. Miller's avatar David S. Miller
Browse files

Merge tag 'linux-can-next-for-5.17-20220105' of...

Merge tag 'linux-can-next-for-5.17-20220105' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next



Marc Kleine-Budde says:

====================
pull-request: can-next 2022-01-05

this is a pull request of 15 patches for net-next/master.

The first patch is by me and removed an unused variable from the
usb_8dev driver.

Andy Shevchenko contributes a patch for the mcp251x driver, which
removes an unneeded assignment.

Jimmy Assarsson's patch for the kvaser_usb makes use of units.h in the
assignment of frequencies.

Lad Prabhakar provides 2 patches, converting the ti_hecc and the
sja1000 driver to make use of platform_get_irq().

The 10 remaining patches are by Vincent Mailhol. First the etas_es58x
driver populates the net_device::dev_port. The next 5 patches cleanup
the handling of CAN error and CAN RTR messages of all drivers. The
remaining 4 patches enhance the CAN controller mode flag handling and
export it via netlink to user space.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 53928cdd 383f0993
Loading
Loading
Loading
Loading
+7 −11
Original line number Diff line number Diff line
@@ -448,7 +448,6 @@ static void at91_chip_stop(struct net_device *dev, enum can_state state)
static netdev_tx_t at91_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
	struct at91_priv *priv = netdev_priv(dev);
	struct net_device_stats *stats = &dev->stats;
	struct can_frame *cf = (struct can_frame *)skb->data;
	unsigned int mb, prio;
	u32 reg_mid, reg_mcr;
@@ -480,8 +479,6 @@ static netdev_tx_t at91_start_xmit(struct sk_buff *skb, struct net_device *dev)
	/* This triggers transmission */
	at91_write(priv, AT91_MCR(mb), reg_mcr);

	stats->tx_bytes += cf->len;

	/* _NOTE_: subtract AT91_MB_TX_FIRST offset from mb! */
	can_put_echo_skb(skb, dev, mb - get_mb_tx_first(priv), 0);

@@ -553,8 +550,6 @@ static void at91_rx_overflow_err(struct net_device *dev)
	cf->can_id |= CAN_ERR_CRTL;
	cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW;

	stats->rx_packets++;
	stats->rx_bytes += cf->len;
	netif_receive_skb(skb);
}

@@ -619,7 +614,9 @@ static void at91_read_msg(struct net_device *dev, unsigned int mb)
	at91_read_mb(dev, mb, cf);

	stats->rx_packets++;
	if (!(cf->can_id & CAN_RTR_FLAG))
		stats->rx_bytes += cf->len;

	netif_receive_skb(skb);

	can_led_event(dev, CAN_LED_EVENT_RX);
@@ -779,8 +776,6 @@ static int at91_poll_err(struct net_device *dev, int quota, u32 reg_sr)

	at91_poll_err_frame(dev, cf, reg_sr);

	dev->stats.rx_packets++;
	dev->stats.rx_bytes += cf->len;
	netif_receive_skb(skb);

	return 1;
@@ -854,7 +849,10 @@ static void at91_irq_tx(struct net_device *dev, u32 reg_sr)
		if (likely(reg_msr & AT91_MSR_MRDY &&
			   ~reg_msr & AT91_MSR_MABT)) {
			/* _NOTE_: subtract AT91_MB_TX_FIRST offset from mb! */
			can_get_echo_skb(dev, mb - get_mb_tx_first(priv), NULL);
			dev->stats.tx_bytes +=
				can_get_echo_skb(dev,
						 mb - get_mb_tx_first(priv),
						 NULL);
			dev->stats.tx_packets++;
			can_led_event(dev, CAN_LED_EVENT_TX);
		}
@@ -1037,8 +1035,6 @@ static void at91_irq_err(struct net_device *dev)

	at91_irq_err_state(dev, cf, new_state);

	dev->stats.rx_packets++;
	dev->stats.rx_bytes += cf->len;
	netif_rx(skb);

	priv->can.state = new_state;
+0 −1
Original line number Diff line number Diff line
@@ -211,7 +211,6 @@ struct c_can_priv {
	struct c_can_raminit raminit_sys;	/* RAMINIT via syscon regmap */
	void (*raminit)(const struct c_can_priv *priv, bool enable);
	u32 comm_rcv_high;
	u32 dlc[];
};

struct net_device *alloc_c_can_dev(int msg_obj_num);
+4 −12
Original line number Diff line number Diff line
@@ -403,10 +403,10 @@ static int c_can_read_msg_object(struct net_device *dev, int iface, u32 ctrl)
				frame->data[i + 1] = data >> 8;
			}
		}
	}

	stats->rx_packets++;
		stats->rx_bytes += frame->len;
	}
	stats->rx_packets++;

	netif_receive_skb(skb);
	return 0;
@@ -477,7 +477,6 @@ static netdev_tx_t c_can_start_xmit(struct sk_buff *skb,
	 * transmit as we might race against do_tx().
	 */
	c_can_setup_tx_object(dev, IF_TX, frame, idx);
	priv->dlc[idx] = frame->len;
	can_put_echo_skb(skb, dev, idx, 0);
	obj = idx + priv->msg_obj_tx_first;
	c_can_object_put(dev, IF_TX, obj, cmd);
@@ -742,8 +741,7 @@ static void c_can_do_tx(struct net_device *dev)
		 * NAPI. We are not transmitting.
		 */
		c_can_inval_tx_object(dev, IF_NAPI, obj);
		can_get_echo_skb(dev, idx, NULL);
		bytes += priv->dlc[idx];
		bytes += can_get_echo_skb(dev, idx, NULL);
		pkts++;
	}

@@ -920,7 +918,6 @@ static int c_can_handle_state_change(struct net_device *dev,
	unsigned int reg_err_counter;
	unsigned int rx_err_passive;
	struct c_can_priv *priv = netdev_priv(dev);
	struct net_device_stats *stats = &dev->stats;
	struct can_frame *cf;
	struct sk_buff *skb;
	struct can_berr_counter bec;
@@ -996,8 +993,6 @@ static int c_can_handle_state_change(struct net_device *dev,
		break;
	}

	stats->rx_packets++;
	stats->rx_bytes += cf->len;
	netif_receive_skb(skb);

	return 1;
@@ -1064,8 +1059,6 @@ static int c_can_handle_bus_err(struct net_device *dev,
		break;
	}

	stats->rx_packets++;
	stats->rx_bytes += cf->len;
	netif_receive_skb(skb);
	return 1;
}
@@ -1232,8 +1225,7 @@ struct net_device *alloc_c_can_dev(int msg_obj_num)
	struct c_can_priv *priv;
	int msg_obj_tx_num = msg_obj_num / 2;

	dev = alloc_candev(struct_size(priv, dlc, msg_obj_tx_num),
			   msg_obj_tx_num);
	dev = alloc_candev(sizeof(*priv), msg_obj_tx_num);
	if (!dev)
		return NULL;

+5 −11
Original line number Diff line number Diff line
@@ -489,17 +489,17 @@ static void cc770_rx(struct net_device *dev, unsigned int mo, u8 ctrl1)
		cf->len = can_cc_dlc2len((config & 0xf0) >> 4);
		for (i = 0; i < cf->len; i++)
			cf->data[i] = cc770_read_reg(priv, msgobj[mo].data[i]);
	}

	stats->rx_packets++;
		stats->rx_bytes += cf->len;
	}
	stats->rx_packets++;

	netif_rx(skb);
}

static int cc770_err(struct net_device *dev, u8 status)
{
	struct cc770_priv *priv = netdev_priv(dev);
	struct net_device_stats *stats = &dev->stats;
	struct can_frame *cf;
	struct sk_buff *skb;
	u8 lec;
@@ -571,8 +571,6 @@ static int cc770_err(struct net_device *dev, u8 status)
	}


	stats->rx_packets++;
	stats->rx_bytes += cf->len;
	netif_rx(skb);

	return 0;
@@ -666,7 +664,6 @@ static void cc770_tx_interrupt(struct net_device *dev, unsigned int o)
	struct cc770_priv *priv = netdev_priv(dev);
	struct net_device_stats *stats = &dev->stats;
	unsigned int mo = obj2msgobj(o);
	struct can_frame *cf;
	u8 ctrl1;

	ctrl1 = cc770_read_reg(priv, msgobj[mo].ctrl1);
@@ -698,12 +695,9 @@ static void cc770_tx_interrupt(struct net_device *dev, unsigned int o)
		return;
	}

	cf = (struct can_frame *)priv->tx_skb->data;
	stats->tx_bytes += cf->len;
	stats->tx_packets++;

	can_put_echo_skb(priv->tx_skb, dev, 0, 0);
	can_get_echo_skb(dev, 0, NULL);
	stats->tx_bytes += can_get_echo_skb(dev, 0, NULL);
	stats->tx_packets++;
	priv->tx_skb = NULL;

	netif_wake_queue(dev);
+3 −6
Original line number Diff line number Diff line
@@ -136,7 +136,6 @@ EXPORT_SYMBOL_GPL(can_change_state);
static void can_restart(struct net_device *dev)
{
	struct can_priv *priv = netdev_priv(dev);
	struct net_device_stats *stats = &dev->stats;
	struct sk_buff *skb;
	struct can_frame *cf;
	int err;
@@ -155,9 +154,6 @@ static void can_restart(struct net_device *dev)

	cf->can_id |= CAN_ERR_RESTARTED;

	stats->rx_packets++;
	stats->rx_bytes += cf->len;

	netif_rx_ni(skb);

restart:
@@ -300,6 +296,7 @@ EXPORT_SYMBOL_GPL(free_candev);
int can_change_mtu(struct net_device *dev, int new_mtu)
{
	struct can_priv *priv = netdev_priv(dev);
	u32 ctrlmode_static = can_get_static_ctrlmode(priv);

	/* Do not allow changing the MTU while running */
	if (dev->flags & IFF_UP)
@@ -309,7 +306,7 @@ int can_change_mtu(struct net_device *dev, int new_mtu)
	switch (new_mtu) {
	case CAN_MTU:
		/* 'CANFD-only' controllers can not switch to CAN_MTU */
		if (priv->ctrlmode_static & CAN_CTRLMODE_FD)
		if (ctrlmode_static & CAN_CTRLMODE_FD)
			return -EINVAL;

		priv->ctrlmode &= ~CAN_CTRLMODE_FD;
@@ -318,7 +315,7 @@ int can_change_mtu(struct net_device *dev, int new_mtu)
	case CANFD_MTU:
		/* check for potential CANFD ability */
		if (!(priv->ctrlmode_supported & CAN_CTRLMODE_FD) &&
		    !(priv->ctrlmode_static & CAN_CTRLMODE_FD))
		    !(ctrlmode_static & CAN_CTRLMODE_FD))
			return -EINVAL;

		priv->ctrlmode |= CAN_CTRLMODE_FD;
Loading