crypto: hisilicon/sec2 - Use atomics instead of __sync
[platform/kernel/linux-rpi.git] / drivers / crypto / hisilicon / sec2 / sec_main.c
index 74f0654..ab742df 100644 (file)
@@ -608,6 +608,14 @@ static const struct file_operations sec_dbg_fops = {
        .write = sec_debug_write,
 };
 
+static int debugfs_atomic64_t_get(void *data, u64 *val)
+{
+        *val = atomic64_read((atomic64_t *)data);
+        return 0;
+}
+DEFINE_DEBUGFS_ATTRIBUTE(fops_atomic64_t_ro, debugfs_atomic64_t_get, NULL,
+                        "%lld\n");
+
 static int sec_core_debug_init(struct sec_dev *sec)
 {
        struct hisi_qm *qm = &sec->qm;
@@ -628,9 +636,11 @@ static int sec_core_debug_init(struct sec_dev *sec)
 
        debugfs_create_regset32("regs", 0444, tmp_d, regset);
 
-       debugfs_create_u64("send_cnt", 0444, tmp_d, &dfx->send_cnt);
+       debugfs_create_file("send_cnt", 0444, tmp_d, &dfx->send_cnt,
+                           &fops_atomic64_t_ro);
 
-       debugfs_create_u64("recv_cnt", 0444, tmp_d, &dfx->recv_cnt);
+       debugfs_create_file("recv_cnt", 0444, tmp_d, &dfx->recv_cnt,
+                           &fops_atomic64_t_ro);
 
        return 0;
 }