Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3816950imu; Mon, 7 Jan 2019 09:59:01 -0800 (PST) X-Google-Smtp-Source: ALg8bN4hAkRK3ZawCvWhnxwRFNrE5oE2jzouuRO32aS5IpXYoSedJeohVfDzCeE2/230YPMIZh7t X-Received: by 2002:a63:d846:: with SMTP id k6mr11973491pgj.251.1546883941559; Mon, 07 Jan 2019 09:59:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546883941; cv=none; d=google.com; s=arc-20160816; b=k/iZPpCSWnNEst738Te/kf25WXVuEjVJtazSJWb1JnyzZOUD6+EfLHaWpBSTvAJGf/ HYTFkUWuHPsp9OMeiagLItoNQd21isH/djJXZaAmleMlYtp2GurDBPUwzzR2TofQbV8T RpKu0mRlxv17SZmezu/ze+kv4PeVuEmxp5DGS0RjSjBRcGlnjUNJXZaECmqyWRunU5Hp hefy0zFl/yZiKJGJvoDlDsRarNcYmFx08Wi0rVDJJdVl1DN2EGV3N7C3FYwEHWdIz3Ws rB32+j7CtMNSJIK1Hge1hJfXCx0B4eM+bx1fDdmY9X5/wGbg9STM0LQJKQBnm7RDQInj hVpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=p6KGHCa7hiwLbu2WQU93NWGYdv9ldtV2KeteB+IJVN8=; b=RND5PQJUDOOJ/RmPpHUrg8V+QCjA85gArj8RcAf87DQWpn19ceNUib+Oj1KVSDMP9E mQuDm8/5Gr1XjMYILh1Gf+TJ+wR9N/LQwbdYav8DiA3fl1mkWC7S7Qw8A5dY6OOcAgHT 6pN+UC6N54ejWfIzGCdgWDgblxPMXg25gJTefK3bmONTBfk25zU7tfNJlWUnS2KunkkH uWqNvYq4WLNxosELnt7YuLsWLUAksXx2mD0snVmRdyOuaQBHOyKngz1Iiva0PdWtp7Ec +J2QuEQLKg6PAvBgHyik3df+3PnKHFQkyR7xQ0jZ1b6fobkRVWWhh6TAmYXDunv2knd6 z5oA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c32si4753431plj.38.2019.01.07.09.58.45; Mon, 07 Jan 2019 09:59:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728610AbfAGQkE (ORCPT + 99 others); Mon, 7 Jan 2019 11:40:04 -0500 Received: from mail114-240.sinamail.sina.com.cn ([218.30.114.240]:46119 "HELO mail114-240.sinamail.sina.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1726535AbfAGQkE (ORCPT ); Mon, 7 Jan 2019 11:40:04 -0500 X-Greylist: delayed 430 seconds by postgrey-1.27 at vger.kernel.org; Mon, 07 Jan 2019 11:40:02 EST Received: from unknown (HELO MiWiFi-R3-srv.localdomain)([110.184.35.115]) by sina.com with ESMTP id 5C337E9C00003A61; Mon, 8 Jan 2019 00:30:23 +0800 (CST) X-Sender: penghao122@sina.com.cn X-Auth-ID: penghao122@sina.com.cn X-SMAIL-MID: 4474825953099 From: Peng Hao To: pbonzini@redhat.com, rkrcmar@redhat.com, tglx@linutronix.de Cc: x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Peng Hao Subject: [PATCH] x86/kvm: convert to DEFINE_DEBUGFS_ATTRIBUTE Date: Tue, 8 Jan 2019 00:30:17 +0800 Message-Id: <1546878617-25713-1-git-send-email-penghao122@sina.com.cn> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peng Hao The preferred strategy to define debugfs attributes is to use the DEFINE_DEBUGFS_ATTRIBUTE() macro and to use debugfs_create_file_unsafe(). Signed-off-by: Peng Hao --- arch/x86/kvm/debugfs.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/debugfs.c b/arch/x86/kvm/debugfs.c index c19c7ed..cc1187f 100644 --- a/arch/x86/kvm/debugfs.c +++ b/arch/x86/kvm/debugfs.c @@ -22,7 +22,8 @@ static int vcpu_get_tsc_offset(void *data, u64 *val) return 0; } -DEFINE_SIMPLE_ATTRIBUTE(vcpu_tsc_offset_fops, vcpu_get_tsc_offset, NULL, "%lld\n"); +DEFINE_DEBUGFS_ATTRIBUTE(vcpu_tsc_offset_fops, + vcpu_get_tsc_offset, NULL, "%lld\n"); static int vcpu_get_tsc_scaling_ratio(void *data, u64 *val) { @@ -31,7 +32,8 @@ static int vcpu_get_tsc_scaling_ratio(void *data, u64 *val) return 0; } -DEFINE_SIMPLE_ATTRIBUTE(vcpu_tsc_scaling_fops, vcpu_get_tsc_scaling_ratio, NULL, "%llu\n"); +DEFINE_DEBUGFS_ATTRIBUTE(vcpu_tsc_scaling_fops, + vcpu_get_tsc_scaling_ratio, NULL, "%llu\n"); static int vcpu_get_tsc_scaling_frac_bits(void *data, u64 *val) { @@ -39,25 +41,26 @@ static int vcpu_get_tsc_scaling_frac_bits(void *data, u64 *val) return 0; } -DEFINE_SIMPLE_ATTRIBUTE(vcpu_tsc_scaling_frac_fops, vcpu_get_tsc_scaling_frac_bits, NULL, "%llu\n"); +DEFINE_DEBUGFS_ATTRIBUTE(vcpu_tsc_scaling_frac_fops, + vcpu_get_tsc_scaling_frac_bits, NULL, "%llu\n"); int kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu) { struct dentry *ret; - ret = debugfs_create_file("tsc-offset", 0444, + ret = debugfs_create_file_unsafe("tsc-offset", 0444, vcpu->debugfs_dentry, vcpu, &vcpu_tsc_offset_fops); if (!ret) return -ENOMEM; if (kvm_has_tsc_control) { - ret = debugfs_create_file("tsc-scaling-ratio", 0444, + ret = debugfs_create_file_unsafe("tsc-scaling-ratio", 0444, vcpu->debugfs_dentry, vcpu, &vcpu_tsc_scaling_fops); if (!ret) return -ENOMEM; - ret = debugfs_create_file("tsc-scaling-ratio-frac-bits", 0444, + ret = debugfs_create_file_unsafe("tsc-scaling-ratio-frac-bits", 0444, vcpu->debugfs_dentry, vcpu, &vcpu_tsc_scaling_frac_fops); if (!ret) -- 1.8.3.1