Re: [RFC PATCH v4 3/4] iplink_can: print brp and dbrp bittiming variables

From
Stefan Mätje <Stefan.Maetje@esd.eu>
Date
2021-07-07 16:34:01
Reply to
Vincent Mailhol, 2021-06-28
Am Dienstag, den 29.06.2021, 00:44 +0900 schrieb Vincent Mailhol:
Report the value of the bit-rate prescaler (brp) for both the nominal
and the data bittiming.

Currently, only the constant brp values (brp_{min,max,inc}) are being
reported. Also, brp is the only member of struct can_bittiming not
being reported.

Although brp is not used as an input for bittiming calculation, it
makes sense to output it.

Signed-off-by: Vincent Mailhol <redacted>
I think it is a good idea to display both brp and dbrp values because it makes
the displayed bitrate settings complete. Even if it could be calculated from the
displayed clock and tq values.
quoted hunk ↗ jump to hunk
---
 ip/iplink_can.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/ip/iplink_can.c b/ip/iplink_can.c
index 9dbe6afd..00f585c6 100644
--- a/ip/iplink_can.c
+++ b/ip/iplink_can.c
@@ -347,6 +347,7 @@ static void can_print_opt(struct link_util *lu, FILE *f,
struct rtattr *tb[])
 		print_uint(PRINT_ANY, "phase_seg2", "phase-seg2 %u ",
 			   bt->phase_seg2);
 		print_uint(PRINT_ANY, "sjw", " sjw %u", bt->sjw);
+		print_uint(PRINT_ANY, "brp", " brp %u", bt->brp);
 		close_json_object();
 	}
 
@@ -421,6 +422,7 @@ static void can_print_opt(struct link_util *lu, FILE *f,
struct rtattr *tb[])
 		print_uint(PRINT_ANY, "phase_seg2", " dphase-seg2 %u",
 			   dbt->phase_seg2);
 		print_uint(PRINT_ANY, "sjw", " dsjw %u", dbt->sjw);
+		print_uint(PRINT_ANY, "brp", " dbrp %u", dbt->brp);
 		close_json_object();
 	}
 
Thread (12 messages) 12 messages, 2 authors, last reply 2021-08-14
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help