On 20.10.2026 15:53:40, ChunYuZhiQiang wrote:
If the interface is down, the CAN controller might be powered down, the
clock disabled, and/or its external reset asserted.
Don't call do_get_berr_counter() or do_get_auto_tdcv() to read the CAN
controller if the interface is down. This fixes a generic logic problem
that exists on all platforms.
As a result, IFLA_CAN_BERR_COUNTER and IFLA_CAN_TDC are no longer
reported for down interfaces. This is intentional: the counters are not
meaningful in that state, and calling into the driver can wake a
runtime-suspended controller or touch registers whose clocks are gated.
Fixes: ec56acfef2af1 ("can: flexcan: flexcan_get_berr_counter(): switch on clocks before accessing ecr register")
Cc: <redacted>
Signed-off-by: ChunYuZhiQiang <redacted>
---
v5:
- Gate can_tdc_fill_info() on netif_running() for IFLA_CAN_TDC, as
requested by Marc Kleine-Budde. This branch has no IFLA_CAN_XL_TDC
definition or call path at all.
- Keep the TDC part of can_get_size() consistent with can_fill_info(),
without hiding the non-TDC data bittiming attributes.
- Document that IFLA_CAN_BERR_COUNTER is no longer reported for down
interfaces, and explain why this is acceptable for stable.
- Clarify the Fixes: rationale.
Thanks for the patch. In the future, please don't send vN+1 as a reply
to vN.
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 |