Commit 28156d76 authored by YueHaibing's avatar YueHaibing Committed by Ingo Molnar
Browse files

x86/mce: Fix debugfs_simple_attr.cocci warnings



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: default avatarYueHaibing <yuehaibing@huawei.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Vishal Verma <vishal.l.verma@intel.com>
Cc: Yazen Ghannam <yazen.ghannam@amd.com>
Cc: kernel-janitors@vger.kernel.org
Link: http://lkml.kernel.org/r/1545981853-70877-1-git-send-email-yuehaibing@huawei.com


Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 39f0584e
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -2429,8 +2429,8 @@ static int fake_panic_set(void *data, u64 val)
	return 0;
}

DEFINE_SIMPLE_ATTRIBUTE(fake_panic_fops, fake_panic_get,
			fake_panic_set, "%llu\n");
DEFINE_DEBUGFS_ATTRIBUTE(fake_panic_fops, fake_panic_get, fake_panic_set,
			 "%llu\n");

static int __init mcheck_debugfs_init(void)
{
@@ -2439,8 +2439,8 @@ static int __init mcheck_debugfs_init(void)
	dmce = mce_get_debugfs_dir();
	if (!dmce)
		return -ENOMEM;
	ffake_panic = debugfs_create_file("fake_panic", 0444, dmce, NULL,
					  &fake_panic_fops);
	ffake_panic = debugfs_create_file_unsafe("fake_panic", 0444, dmce,
						 NULL, &fake_panic_fops);
	if (!ffake_panic)
		return -ENOMEM;