powerpc/powernv/npu: Fix debugfs_simple_attr.cocci warnings
authorYueHaibing <yuehaibing@huawei.com>
Tue, 25 Dec 2018 02:44:36 +0000 (02:44 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 13 Nov 2019 05:58:05 +0000 (16:58 +1100)
Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE
for debugfs files.

Semantic patch information:
Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file()
imposes some significant overhead as compared to
DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe().

Generated by: scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/1545705876-63132-1-git-send-email-yuehaibing@huawei.com
arch/powerpc/platforms/powernv/pci-ioda.c

index c28d0d9b7ee0fc435b302ccd645dd21e109c5a89..da1068a9c2637a8ca29e23424727b7be45dd677b 100644 (file)
@@ -3086,8 +3086,8 @@ static int pnv_pci_diag_data_set(void *data, u64 val)
        return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(pnv_pci_diag_data_fops, NULL,
-                       pnv_pci_diag_data_set, "%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(pnv_pci_diag_data_fops, NULL, pnv_pci_diag_data_set,
+                        "%llu\n");
 
 #endif /* CONFIG_DEBUG_FS */
 
@@ -3112,8 +3112,8 @@ static void pnv_pci_ioda_create_dbgfs(void)
                        continue;
                }
 
-               debugfs_create_file("dump_diag_regs", 0200, phb->dbgfs, hose,
-                                   &pnv_pci_diag_data_fops);
+               debugfs_create_file_unsafe("dump_diag_regs", 0200, phb->dbgfs,
+                                          hose, &pnv_pci_diag_data_fops);
        }
 #endif /* CONFIG_DEBUG_FS */
 }