gpio: rcar: Fix runtime PM imbalance on error
[linux/fpc-iii.git] / drivers / crypto / cavium / nitrox / nitrox_debugfs.c
blob16f7d0bd1303203c2d273737b7254d047b12ef7a
1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/seq_file.h>
3 #include <linux/debugfs.h>
5 #include "nitrox_csr.h"
6 #include "nitrox_dev.h"
8 static int firmware_show(struct seq_file *s, void *v)
10 struct nitrox_device *ndev = s->private;
12 seq_printf(s, "Version: %s\n", ndev->hw.fw_name[0]);
13 seq_printf(s, "Version: %s\n", ndev->hw.fw_name[1]);
14 return 0;
17 DEFINE_SHOW_ATTRIBUTE(firmware);
19 static int device_show(struct seq_file *s, void *v)
21 struct nitrox_device *ndev = s->private;
23 seq_printf(s, "NITROX [%d]\n", ndev->idx);
24 seq_printf(s, " Part Name: %s\n", ndev->hw.partname);
25 seq_printf(s, " Frequency: %d MHz\n", ndev->hw.freq);
26 seq_printf(s, " Device ID: 0x%0x\n", ndev->hw.device_id);
27 seq_printf(s, " Revision ID: 0x%0x\n", ndev->hw.revision_id);
28 seq_printf(s, " Cores: [AE=%u SE=%u ZIP=%u]\n",
29 ndev->hw.ae_cores, ndev->hw.se_cores, ndev->hw.zip_cores);
31 return 0;
34 DEFINE_SHOW_ATTRIBUTE(device);
36 static int stats_show(struct seq_file *s, void *v)
38 struct nitrox_device *ndev = s->private;
40 seq_printf(s, "NITROX [%d] Request Statistics\n", ndev->idx);
41 seq_printf(s, " Posted: %llu\n",
42 (u64)atomic64_read(&ndev->stats.posted));
43 seq_printf(s, " Completed: %llu\n",
44 (u64)atomic64_read(&ndev->stats.completed));
45 seq_printf(s, " Dropped: %llu\n",
46 (u64)atomic64_read(&ndev->stats.dropped));
48 return 0;
51 DEFINE_SHOW_ATTRIBUTE(stats);
53 void nitrox_debugfs_exit(struct nitrox_device *ndev)
55 debugfs_remove_recursive(ndev->debugfs_dir);
56 ndev->debugfs_dir = NULL;
59 void nitrox_debugfs_init(struct nitrox_device *ndev)
61 struct dentry *dir;
63 dir = debugfs_create_dir(KBUILD_MODNAME, NULL);
65 ndev->debugfs_dir = dir;
66 debugfs_create_file("firmware", 0400, dir, ndev, &firmware_fops);
67 debugfs_create_file("device", 0400, dir, ndev, &device_fops);
68 debugfs_create_file("stats", 0400, dir, ndev, &stats_fops);