Marc Kleine-Budde [off-list ref] 於 2025年2月21日 週五 下午4:08寫道:
On 21.02.2025 16:01:07, Ming Yu wrote:
quoted
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.
Okay, I'll update the code.
Thanks,
Ming