Skip to content

Commit da8fafe

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

File tree

4 files changed

+32
-47
lines changed

4 files changed

+32
-47
lines changed

cli/diag.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,7 @@ int eye_observe_dev(struct switchtec_dev *dev, unsigned int error_threshold,
204204
int eye_6p_data[6];
205205
unsigned int w2h_score;
206206

207-
if (eye_capture_type == SWTEC_EOM_4P_CAPTURE)
208-
{
207+
if (eye_capture_type == SWTEC_EOM_4P_CAPTURE) {
209208
ret = switchtec_diag_eye_start(dev, lane_id, error_threshold);
210209
if (ret) {
211210
switchtec_perror("eye_start");
@@ -215,13 +214,11 @@ int eye_observe_dev(struct switchtec_dev *dev, unsigned int error_threshold,
215214

216215
memcpy(&eye_data[0], &data_out, sizeof(struct switchtec_diag_port_eye_data));
217216

218-
if (!ret)
219-
{
217+
if (!ret) {
220218
eye_plot_graph(eye_data, false, 0);
221219
}
222220
}
223-
else
224-
{
221+
else {
225222
ret = switchtec_diag_eye_6p_start(dev, lane_id, error_threshold);
226223
if (ret) {
227224
switchtec_perror("eye_start");
@@ -231,10 +228,9 @@ int eye_observe_dev(struct switchtec_dev *dev, unsigned int error_threshold,
231228

232229
memcpy(&eye_6p_data[0], &data_6p_out, sizeof(struct switchtec_diag_port_6p_eye_data));
233230

234-
if (!ret)
235-
{
236-
w2h_score = calculate_w2h_score(&data_6p_out);
237-
printf("W2H Score for Lane %d is %d\n", lane_id, w2h_score);
231+
if (!ret) {
232+
w2h_score = calculate_w2h_score(&data_6p_out);
233+
printf("W2H Score for Lane %d is %d\n", lane_id, w2h_score);
238234
eye_plot_graph(eye_6p_data, true, w2h_score);
239235
}
240236
}

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
}

inc/switchtec/diag.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -241,18 +241,18 @@ struct switchtec_diag_port_eye_fetch {
241241

242242
struct switchtec_diag_port_6p_eye_data {
243243
int32_t eye_left;
244-
int32_t eye_right;
245-
int32_t eye_top_x1;
246-
int32_t eye_bottom_x1;
244+
int32_t eye_right;
245+
int32_t eye_top_x1;
246+
int32_t eye_bottom_x1;
247247
int32_t eye_top_x2;
248248
int32_t eye_bottom_x2;
249249
};
250250

251251
struct switchtec_diag_port_eye_data {
252252
int32_t eye_left;
253-
int32_t eye_right;
254-
int32_t eye_top_x1;
255-
int32_t eye_bottom_x1;
253+
int32_t eye_right;
254+
int32_t eye_top_x1;
255+
int32_t eye_bottom_x1;
256256
};
257257
#pragma pack(pop)
258258

lib/diag.c

Lines changed: 15 additions & 21 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,30 +309,27 @@ 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-
{
326-
printf("Eye Left %d\n", out.eye_left);
327-
printf("Eye Right %d\n", out.eye_right);
328-
printf("Eye top %d\n", out.eye_top_x1);
329-
printf("Eye Bottom %d\n", out.eye_bottom_x1);
320+
else if(out.status == EOM_SUCCESS) {
321+
printf("Eye Left %d\n", out.eye_left);
322+
printf("Eye Right %d\n", out.eye_right);
323+
printf("Eye top %d\n", out.eye_top_x1);
324+
printf("Eye Bottom %d\n", out.eye_bottom_x1);
330325

331-
data.eye_left = out.eye_left;
332-
data.eye_right = out.eye_right;
333-
data.eye_top_x1 = out.eye_top_x1;
334-
data.eye_bottom_x1 = out.eye_bottom_x1;
335-
memcpy(data_out, &data, sizeof(struct switchtec_diag_port_eye_data));
326+
data.eye_left = out.eye_left;
327+
data.eye_right = out.eye_right;
328+
data.eye_top_x1 = out.eye_top_x1;
329+
data.eye_bottom_x1 = out.eye_bottom_x1;
330+
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)