hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/scsi/snic/snic_debugfs.c
....@@ -30,33 +30,13 @@
3030 * fnic directory and statistics directory for trace buffer and
3131 * stats logging
3232 */
33
-
34
-int
35
-snic_debugfs_init(void)
33
+void snic_debugfs_init(void)
3634 {
37
- int rc = -1;
38
- struct dentry *de = NULL;
35
+ snic_glob->trc_root = debugfs_create_dir("snic", NULL);
3936
40
- de = debugfs_create_dir("snic", NULL);
41
- if (!de) {
42
- SNIC_DBG("Cannot create debugfs root\n");
43
-
44
- return rc;
45
- }
46
- snic_glob->trc_root = de;
47
-
48
- de = debugfs_create_dir("statistics", snic_glob->trc_root);
49
- if (!de) {
50
- SNIC_DBG("Cannot create Statistics directory\n");
51
-
52
- return rc;
53
- }
54
- snic_glob->stats_root = de;
55
-
56
- rc = 0;
57
-
58
- return rc;
59
-} /* end of snic_debugfs_init */
37
+ snic_glob->stats_root = debugfs_create_dir("statistics",
38
+ snic_glob->trc_root);
39
+}
6040
6141 /*
6242 * snic_debugfs_term - Tear down debugfs intrastructure
....@@ -391,56 +371,23 @@
391371 * It will create file stats and reset_stats under statistics/host# directory
392372 * to log per snic stats
393373 */
394
-int
395
-snic_stats_debugfs_init(struct snic *snic)
374
+void snic_stats_debugfs_init(struct snic *snic)
396375 {
397
- int rc = -1;
398376 char name[16];
399
- struct dentry *de = NULL;
400377
401378 snprintf(name, sizeof(name), "host%d", snic->shost->host_no);
402
- if (!snic_glob->stats_root) {
403
- SNIC_DBG("snic_stats root doesn't exist\n");
404379
405
- return rc;
406
- }
380
+ snic->stats_host = debugfs_create_dir(name, snic_glob->stats_root);
407381
408
- de = debugfs_create_dir(name, snic_glob->stats_root);
409
- if (!de) {
410
- SNIC_DBG("Cannot create host directory\n");
382
+ snic->stats_file = debugfs_create_file("stats", S_IFREG|S_IRUGO,
383
+ snic->stats_host, snic,
384
+ &snic_stats_fops);
411385
412
- return rc;
413
- }
414
- snic->stats_host = de;
415
-
416
- de = debugfs_create_file("stats",
417
- S_IFREG|S_IRUGO,
418
- snic->stats_host,
419
- snic,
420
- &snic_stats_fops);
421
- if (!de) {
422
- SNIC_DBG("Cannot create host's stats file\n");
423
-
424
- return rc;
425
- }
426
- snic->stats_file = de;
427
-
428
- de = debugfs_create_file("reset_stats",
429
- S_IFREG|S_IRUGO|S_IWUSR,
430
- snic->stats_host,
431
- snic,
432
- &snic_reset_stats_fops);
433
-
434
- if (!de) {
435
- SNIC_DBG("Cannot create host's reset_stats file\n");
436
-
437
- return rc;
438
- }
439
- snic->reset_stats_file = de;
440
- rc = 0;
441
-
442
- return rc;
443
-} /* end of snic_stats_debugfs_init */
386
+ snic->reset_stats_file = debugfs_create_file("reset_stats",
387
+ S_IFREG|S_IRUGO|S_IWUSR,
388
+ snic->stats_host, snic,
389
+ &snic_reset_stats_fops);
390
+}
444391
445392 /*
446393 * snic_stats_debugfs_remove - Tear down debugfs infrastructure of stats
....@@ -492,71 +439,31 @@
492439 return 0;
493440 }
494441
495
-static const struct seq_operations snic_trc_seq_ops = {
442
+static const struct seq_operations snic_trc_sops = {
496443 .start = snic_trc_seq_start,
497444 .next = snic_trc_seq_next,
498445 .stop = snic_trc_seq_stop,
499446 .show = snic_trc_seq_show,
500447 };
501448
502
-static int
503
-snic_trc_open(struct inode *inode, struct file *filp)
504
-{
505
- return seq_open(filp, &snic_trc_seq_ops);
506
-}
507
-
508
-static const struct file_operations snic_trc_fops = {
509
- .owner = THIS_MODULE,
510
- .open = snic_trc_open,
511
- .read = seq_read,
512
- .llseek = seq_lseek,
513
- .release = seq_release,
514
-};
449
+DEFINE_SEQ_ATTRIBUTE(snic_trc);
515450
516451 /*
517452 * snic_trc_debugfs_init : creates trace/tracing_enable files for trace
518453 * under debugfs
519454 */
520
-int
521
-snic_trc_debugfs_init(void)
455
+void snic_trc_debugfs_init(void)
522456 {
523
- struct dentry *de = NULL;
524
- int ret = -1;
457
+ snic_glob->trc.trc_enable = debugfs_create_bool("tracing_enable",
458
+ S_IFREG | S_IRUGO | S_IWUSR,
459
+ snic_glob->trc_root,
460
+ &snic_glob->trc.enable);
525461
526
- if (!snic_glob->trc_root) {
527
- SNIC_ERR("Debugfs root directory for snic doesn't exist.\n");
528
-
529
- return ret;
530
- }
531
-
532
- de = debugfs_create_bool("tracing_enable",
533
- S_IFREG | S_IRUGO | S_IWUSR,
534
- snic_glob->trc_root,
535
- &snic_glob->trc.enable);
536
-
537
- if (!de) {
538
- SNIC_ERR("Can't create trace_enable file.\n");
539
-
540
- return ret;
541
- }
542
- snic_glob->trc.trc_enable = de;
543
-
544
- de = debugfs_create_file("trace",
545
- S_IFREG | S_IRUGO | S_IWUSR,
546
- snic_glob->trc_root,
547
- NULL,
548
- &snic_trc_fops);
549
-
550
- if (!de) {
551
- SNIC_ERR("Cannot create trace file.\n");
552
-
553
- return ret;
554
- }
555
- snic_glob->trc.trc_file = de;
556
- ret = 0;
557
-
558
- return ret;
559
-} /* end of snic_trc_debugfs_init */
462
+ snic_glob->trc.trc_file = debugfs_create_file("trace",
463
+ S_IFREG | S_IRUGO | S_IWUSR,
464
+ snic_glob->trc_root, NULL,
465
+ &snic_trc_fops);
466
+}
560467
561468 /*
562469 * snic_trc_debugfs_term : cleans up the files created for trace under debugfs