HID: debug: Change to use DEFINE_SHOW_ATTRIBUTE macro
PATCH 1/1 HID: debug: Change to use DEFINE_SHOW_ATTRIBUTE macro
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
Signed-off-by Yangtao Li <[email protected]>
--- drivers/hid/hid-debug.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/hid/hid-debug.c +1 -11
@@ -1072,11 +1072,6 @@ static int hid_debug_rdesc_show(struct seq_file *f, void *p)return 0 ; } -static int hid_debug_rdesc_open (struct inode *inode,struct file *file) -{ -return single_open (file, hid_debug_rdesc_show, inode->i_private); -} -static int hid_debug_events_open (struct inode *inode,struct file *file) {int err =0 ;
@@ -1211,12 +1206,7 @@ static int hid_debug_events_release(struct inode *inode, struct file *file)return 0 ; } -static const struct file_operations hid_debug_rdesc_fops = { - .open = hid_debug_rdesc_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE (hid_debug_rdesc);static const struct file_operations hid_debug_events_fops = { .owner =THIS_MODULE ,
Signature · 1 line
2.17.0
Quoted 24 lines · Yangtao Li
Use
DEFINE_SHOW_ATTRIBUTEmacro to simplify the code.Signed-off-by Yangtao Li <[email protected]>--- drivers/hid/hid-debug.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)drivers/hid/hid-debug.c +0
-5@@ -1072,11 +1072,6 @@ static int hid_debug_rdesc_show(struct seq_file *f, void *p)return 0 ; } -static int hid_debug_rdesc_open (struct inode *inode,struct file *file) -{ -return single_open (file, hid_debug_rdesc_show, inode->i_private); -} -static int hid_debug_events_open (struct inode *inode,struct file *file) {int err =0 ;
drivers/hid/hid-debug.c static int hid_debug_events_release(struct inode *inode, struct file *file) · line 1209
Quoted 10 lines
drivers/hid/hid-debug.c +1
-6@@ -1211,12 +1206,7 @@ static int hid_debug_events_release(struct inode *inode, struct file *file)return 0 ; } -static const struct file_operations hid_debug_rdesc_fops = { - .open = hid_debug_rdesc_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; +DEFINE_SHOW_ATTRIBUTE (hid_debug_rdesc);
Applied to hid.git#for-4.21/core. Thanks,
Signature · 2 lines
Jiri Kosina SUSE Labs