mirror of
https://github.com/linux-can/can-utils.git
synced 2026-08-05 14:29:54 +02:00
canfdtest: can_echo_dut(): move functionality to increment frame data into separate function
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
+11
-4
@@ -197,11 +197,19 @@ static int send_frame(struct can_frame *frame)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void inc_frame(struct can_frame *frame)
|
||||
{
|
||||
int i;
|
||||
|
||||
frame->can_id++;
|
||||
for (i = 0; i < frame->can_dlc; i++)
|
||||
frame->data[i]++;
|
||||
}
|
||||
|
||||
static int can_echo_dut(void)
|
||||
{
|
||||
unsigned int frame_count = 0;
|
||||
struct can_frame frame;
|
||||
int i;
|
||||
|
||||
while (running) {
|
||||
if (recv_frame(&frame))
|
||||
@@ -212,9 +220,8 @@ static int can_echo_dut(void)
|
||||
} else if (verbose > 1) {
|
||||
print_frame(&frame, 0);
|
||||
}
|
||||
frame.can_id++;
|
||||
for (i = 0; i < frame.can_dlc; i++)
|
||||
frame.data[i]++;
|
||||
|
||||
inc_frame(&frame);
|
||||
if (send_frame(&frame))
|
||||
return -1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user