Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

RAS/CEC: Convert to DEFINE_SHOW_ATTRIBUTE()

Use the DEFINE_SHOW_ATTRIBUTE() macro and simplify the code.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20200919012252.171437-1-miaoqinglang@huawei.com

authored by

Qinglang Miao and committed by
Borislav Petkov
4bd442e9 e1007770

+3 -14
+3 -14
drivers/ras/cec.c
··· 435 435 436 436 static const char * const bins[] = { "00", "01", "10", "11" }; 437 437 438 - static int array_dump(struct seq_file *m, void *v) 438 + static int array_show(struct seq_file *m, void *v) 439 439 { 440 440 struct ce_array *ca = &ce_arr; 441 441 int i; ··· 467 467 return 0; 468 468 } 469 469 470 - static int array_open(struct inode *inode, struct file *filp) 471 - { 472 - return single_open(filp, array_dump, NULL); 473 - } 474 - 475 - static const struct file_operations array_ops = { 476 - .owner = THIS_MODULE, 477 - .open = array_open, 478 - .read = seq_read, 479 - .llseek = seq_lseek, 480 - .release = single_release, 481 - }; 470 + DEFINE_SHOW_ATTRIBUTE(array); 482 471 483 472 static int __init create_debugfs_nodes(void) 484 473 { ··· 502 513 goto err; 503 514 } 504 515 505 - array = debugfs_create_file("array", S_IRUSR, d, NULL, &array_ops); 516 + array = debugfs_create_file("array", S_IRUSR, d, NULL, &array_fops); 506 517 if (!array) { 507 518 pr_warn("Error creating array debugfs node!\n"); 508 519 goto err;