Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E8B8CA9EC3 for ; Thu, 31 Oct 2019 12:46:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 742A720862 for ; Thu, 31 Oct 2019 12:46:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727077AbfJaMqP (ORCPT ); Thu, 31 Oct 2019 08:46:15 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:5671 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726540AbfJaMqO (ORCPT ); Thu, 31 Oct 2019 08:46:14 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 99A0EB15CB914ED5AC7D; Thu, 31 Oct 2019 20:46:08 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.439.0; Thu, 31 Oct 2019 20:46:00 +0800 From: zhong jiang To: , CC: , , Subject: [PATCH] notifier-error-inject: use DEFINE_DEBUGFS_ATTRIBUTE to define debugfs fops Date: Thu, 31 Oct 2019 20:42:08 +0800 Message-ID: <1572525728-23957-1-git-send-email-zhongjiang@huawei.com> X-Mailer: git-send-email 1.7.12.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It is more clearly to use DEFINE_DEBUGFS_ATTRIBUTE to define debugfs file operation rather than DEFINE_SIMPLE_ATTRIBUTE. Meanwhile, debugfs_create_file() in debugfs_create_errno() can be replaced by debugfs_create_file_unsafe(). Signed-off-by: zhong jiang --- lib/notifier-error-inject.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/notifier-error-inject.c b/lib/notifier-error-inject.c index 21016b3..e5302f7 100644 --- a/lib/notifier-error-inject.c +++ b/lib/notifier-error-inject.c @@ -15,13 +15,13 @@ static int debugfs_errno_get(void *data, u64 *val) return 0; } -DEFINE_SIMPLE_ATTRIBUTE(fops_errno, debugfs_errno_get, debugfs_errno_set, +DEFINE_DEBUGFS_ATTRIBUTE(fops_errno, debugfs_errno_get, debugfs_errno_set, "%lld\n"); static struct dentry *debugfs_create_errno(const char *name, umode_t mode, struct dentry *parent, int *value) { - return debugfs_create_file(name, mode, parent, value, &fops_errno); + return debugfs_create_file_unsafe(name, mode, parent, value, &fops_errno); } static int notifier_err_inject_callback(struct notifier_block *nb, -- 1.7.12.4