On 21.02.2025 16:01:07, Ming Yu wrote:
Hi Marc,
Marc Kleine-Budde [off-list ref] 於 2025年2月7日 週五 下午8:15寫道:
quoted
quoted
+static irqreturn_t nct6694_can_irq(int irq, void *data)
+{
+ struct net_device *ndev = data;
+ struct nct6694_can_priv *priv = netdev_priv(ndev);
+ struct nct6694_can_event *evt = priv->event;
+ struct nct6694_cmd_header cmd_hd = {
+ .mod = NCT6694_CAN_MOD,
+ .cmd = NCT6694_CAN_EVENT,
+ .sel = NCT6694_CAN_EVENT_SEL(priv->can_idx, NCT6694_CAN_EVENT_MASK),
+ .len = cpu_to_le16(sizeof(priv->event))
+ };
+ irqreturn_t handled = IRQ_NONE;
+ int can_idx = priv->can_idx;
+ int ret;
it would make sense to have a event pointer here instead of the can_idx?
const struct nct6694_can_event *event = &priv->event[priv->can_idx];
The CAN Event command always returns 16bytes: the first 8 bytes
correspond to the CAN0 event, and the last 8 bytes correspond to the
CAN1 event. Therefore, the event pointer here refers to both event
buffers.
Yes, but in the following code uses "priv->event[can_idx]" several
times, this is why I proposed to have a dedicated "struct
nct6694_can_event *event" variable.
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |