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

powerpc/ptdump: Use DEFINE_SHOW_ATTRIBUTE()

Use DEFINE_SHOW_ATTRIBUTE() instead of open coding
open() and fops.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/b864a92693ca8413ef0b19f0c12065c212899b6e.1625762905.git.christophe.leroy@csgroup.eu

authored by

Christophe Leroy and committed by
Michael Ellerman
11f27a7f 33e14024

+5 -46
+2 -12
arch/powerpc/mm/ptdump/bats.c
··· 57 57 58 58 #define BAT_SHOW_603(_m, _n, _l, _u, _d) bat_show_603(_m, _n, mfspr(_l), mfspr(_u), _d) 59 59 60 - static int bats_show_603(struct seq_file *m, void *v) 60 + static int bats_show(struct seq_file *m, void *v) 61 61 { 62 62 seq_puts(m, "---[ Instruction Block Address Translation ]---\n"); 63 63 ··· 88 88 return 0; 89 89 } 90 90 91 - static int bats_open(struct inode *inode, struct file *file) 92 - { 93 - return single_open(file, bats_show_603, NULL); 94 - } 95 - 96 - static const struct file_operations bats_fops = { 97 - .open = bats_open, 98 - .read = seq_read, 99 - .llseek = seq_lseek, 100 - .release = single_release, 101 - }; 91 + DEFINE_SHOW_ATTRIBUTE(bats); 102 92 103 93 static int __init bats_init(void) 104 94 {
+1 -11
arch/powerpc/mm/ptdump/hashpagetable.c
··· 526 526 return 0; 527 527 } 528 528 529 - static int ptdump_open(struct inode *inode, struct file *file) 530 - { 531 - return single_open(file, ptdump_show, NULL); 532 - } 533 - 534 - static const struct file_operations ptdump_fops = { 535 - .open = ptdump_open, 536 - .read = seq_read, 537 - .llseek = seq_lseek, 538 - .release = single_release, 539 - }; 529 + DEFINE_SHOW_ATTRIBUTE(ptdump); 540 530 541 531 static int ptdump_init(void) 542 532 {
+1 -12
arch/powerpc/mm/ptdump/ptdump.c
··· 397 397 return 0; 398 398 } 399 399 400 - 401 - static int ptdump_open(struct inode *inode, struct file *file) 402 - { 403 - return single_open(file, ptdump_show, NULL); 404 - } 405 - 406 - static const struct file_operations ptdump_fops = { 407 - .open = ptdump_open, 408 - .read = seq_read, 409 - .llseek = seq_lseek, 410 - .release = single_release, 411 - }; 400 + DEFINE_SHOW_ATTRIBUTE(ptdump); 412 401 413 402 static void build_pgtable_complete_mask(void) 414 403 {
+1 -11
arch/powerpc/mm/ptdump/segment_regs.c
··· 41 41 return 0; 42 42 } 43 43 44 - static int sr_open(struct inode *inode, struct file *file) 45 - { 46 - return single_open(file, sr_show, NULL); 47 - } 48 - 49 - static const struct file_operations sr_fops = { 50 - .open = sr_open, 51 - .read = seq_read, 52 - .llseek = seq_lseek, 53 - .release = single_release, 54 - }; 44 + DEFINE_SHOW_ATTRIBUTE(sr); 55 45 56 46 static int __init sr_init(void) 57 47 {