Skip to content

Commit 2792e88

Browse files
vigneshraja123717root
authored andcommitted
if braces corrected
1 parent cbfadb0 commit 2792e88

File tree

3 files changed

+13
-26
lines changed

3 files changed

+13
-26
lines changed

cli/diag.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,7 @@ int eye_observe_dev(struct switchtec_dev *dev, unsigned int error_threshold,
215215

216216
memcpy(&eye_data[0], &data_out, sizeof(struct switchtec_diag_port_eye_data));
217217

218-
if (!ret)
219-
{
218+
if (!ret) {
220219
eye_plot_graph(eye_data, false, 0);
221220
}
222221
}
@@ -231,8 +230,7 @@ int eye_observe_dev(struct switchtec_dev *dev, unsigned int error_threshold,
231230

232231
memcpy(&eye_6p_data[0], &data_6p_out, sizeof(struct switchtec_diag_port_6p_eye_data));
233232

234-
if (!ret)
235-
{
233+
if (!ret) {
236234
w2h_score = calculate_w2h_score(&data_6p_out);
237235
printf("W2H Score for Lane %d is %d\n", lane_id, w2h_score);
238236
eye_plot_graph(eye_6p_data, true, w2h_score);

cli/graph.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,7 @@ int eye_plot_graph(int *data, bool plot_6p_points, unsigned int w2h_score)
395395
for (int y = 0; y <= PLOT_HEIGHT; ++y)
396396
mvaddch(y/Y_SCALE, 5, '|'); // Y-axis at the left
397397
// Draw scale on X-axis
398-
for (int x = 0; x <= PLOT_WIDTH; x += 5)
399-
{
398+
for (int x = 0; x <= PLOT_WIDTH; x += 5) {
400399
mvaddch(0, (x*X_SCALE) + 5, '+');
401400
mvprintw(1, (x*X_SCALE) + 5, "%d", x);
402401
}
@@ -409,8 +408,7 @@ int eye_plot_graph(int *data, bool plot_6p_points, unsigned int w2h_score)
409408
char legend[32];
410409
snprintf(legend, sizeof(legend), "W2H SCORE = %u", w2h_score);
411410

412-
if (plot_6p_points == true)
413-
{
411+
if (plot_6p_points == true) {
414412
mvprintw(0, COLS - strlen(legend) - 1, "%s", legend);
415413
}
416414

@@ -421,24 +419,21 @@ int eye_plot_graph(int *data, bool plot_6p_points, unsigned int w2h_score)
421419
data[2] = data[2] + Y_LAYOUT_SHIFT;
422420
data[3] = data[3] + Y_LAYOUT_SHIFT;
423421

424-
if(plot_6p_points == true)
425-
{
422+
if(plot_6p_points == true) {
426423
data[4] = data[4] + Y_LAYOUT_SHIFT;
427424
data[5] = data[5] + Y_LAYOUT_SHIFT;
428425
}
429426

430427
plot_point(data[0] + Y_PRINT_OFFSET, Y_LAYOUT_SHIFT + X_PRINT_OFFSET);
431428
plot_point(data[1] + Y_PRINT_OFFSET, Y_LAYOUT_SHIFT + X_PRINT_OFFSET);
432429

433-
if(plot_6p_points == true)
434-
{
430+
if(plot_6p_points == true) {
435431
plot_point((X_LAYOUT_SHIFT + Y_PRINT_OFFSET) - 3, data[2] + X_PRINT_OFFSET);
436432
plot_point((X_LAYOUT_SHIFT + Y_PRINT_OFFSET) - 3, data[3] + X_PRINT_OFFSET);
437433
plot_point((X_LAYOUT_SHIFT + Y_PRINT_OFFSET) + 3, data[4] + X_PRINT_OFFSET);
438434
plot_point((X_LAYOUT_SHIFT + Y_PRINT_OFFSET) + 3, data[5] + X_PRINT_OFFSET);
439435
}
440-
else
441-
{
436+
else {
442437
plot_point(X_LAYOUT_SHIFT + Y_PRINT_OFFSET, data[2] + X_PRINT_OFFSET);
443438
plot_point(X_LAYOUT_SHIFT + Y_PRINT_OFFSET, data[3] + X_PRINT_OFFSET);
444439
}

lib/diag.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -250,17 +250,15 @@ int switchtec_diag_eye_6p_data_fetch(struct switchtec_dev *dev, struct switchtec
250250
if (ret)
251251
return ret;
252252

253-
if(out.status > EOM_WAITING_FOR_HARDWARE)
254-
{
253+
if(out.status > EOM_WAITING_FOR_HARDWARE) {
255254
return ret;
256255
}
257256

258257
if (out.status == EOM_IN_PROGRESS) {
259258
usleep(500000);
260259
goto retry;
261260
}
262-
else if(out.status == EOM_SUCCESS)
263-
{
261+
else if(out.status == EOM_SUCCESS) {
264262
printf("Eye Left %d\n", out.eye_left);
265263
printf("Eye Right %d\n", out.eye_right);
266264
printf("Eye top @X1 %d\n", out.eye_top_x1);
@@ -276,8 +274,7 @@ int switchtec_diag_eye_6p_data_fetch(struct switchtec_dev *dev, struct switchtec
276274
data.eye_bottom_x2 = out.eye_bottom_x2;
277275
memcpy(data_out, &data, sizeof(struct switchtec_diag_port_6p_eye_data));
278276
}
279-
else
280-
{
277+
else {
281278
printf("EOM Status %s\n", diag_eom_status_string[out.status]);
282279
return -1;
283280
}
@@ -312,17 +309,15 @@ int switchtec_diag_eye_fetch(struct switchtec_dev *dev, struct switchtec_diag_po
312309
if (ret)
313310
return ret;
314311

315-
if(out.status > EOM_WAITING_FOR_HARDWARE)
316-
{
312+
if(out.status > EOM_WAITING_FOR_HARDWARE) {
317313
return ret;
318314
}
319315

320316
if (out.status == EOM_IN_PROGRESS) {
321317
usleep(500000);
322318
goto retry;
323319
}
324-
else if(out.status == EOM_SUCCESS)
325-
{
320+
else if(out.status == EOM_SUCCESS) {
326321
printf("Eye Left %d\n", out.eye_left);
327322
printf("Eye Right %d\n", out.eye_right);
328323
printf("Eye top %d\n", out.eye_top_x1);
@@ -334,8 +329,7 @@ int switchtec_diag_eye_fetch(struct switchtec_dev *dev, struct switchtec_diag_po
334329
data.eye_bottom_x1 = out.eye_bottom_x1;
335330
memcpy(data_out, &data, sizeof(struct switchtec_diag_port_eye_data));
336331
}
337-
else
338-
{
332+
else {
339333
printf("EOM Status %s\n", diag_eom_status_string[out.status]);
340334
return -1;
341335
}

0 commit comments

Comments
 (0)