Skip to contentSkip to conversation

wireless/cw1200: convert to DEFINE_SHOW_ATTRIBUTE

PATCH In review Yangtao Li 2 participants 5 messages Dec 3, 2018 – Dec 20, 2018

Subsystems (3)
lore
Share & tools
lore

Yangtao Li

author
#0 lore raw

PATCH 1/1 wireless/cw1200: convert to DEFINE_SHOW_ATTRIBUTE

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

---
 drivers/net/wireless/st/cw1200/debug.c | 32 ++++----------------------
 1 file changed, 4 insertions(+), 28 deletions(-)
drivers/net/wireless/st/cw1200/debug.c +4 -28
index 295cb1a29f25..2231ba08bc1f 100644
@@ -289,19 +289,7 @@ static int cw1200_status_show(struct seq_file *seq, void *v)
 	return 0;
 }
 
-static int cw1200_status_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, &cw1200_status_show,
-		inode->i_private);
-}
-
-static const struct file_operations fops_status = {
-	.open = cw1200_status_open,
-	.read = seq_read,
-	.llseek = seq_lseek,
-	.release = single_release,
-	.owner = THIS_MODULE,
-};
+DEFINE_SHOW_ATTRIBUTE(cw1200_status);
 
 static int cw1200_counters_show(struct seq_file *seq, void *v)
 {
@@ -345,19 +333,7 @@ static int cw1200_counters_show(struct seq_file *seq, void *v)
 	return 0;
 }
 
-static int cw1200_counters_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, &cw1200_counters_show,
-		inode->i_private);
-}
-
-static const struct file_operations fops_counters = {
-	.open = cw1200_counters_open,
-	.read = seq_read,
-	.llseek = seq_lseek,
-	.release = single_release,
-	.owner = THIS_MODULE,
-};
+DEFINE_SHOW_ATTRIBUTE(cw1200_counters);
 
 static ssize_t cw1200_wsm_dumps(struct file *file,
 	const char __user *user_buf, size_t count, loff_t *ppos)
@@ -399,11 +375,11 @@ int cw1200_debug_init(struct cw1200_common *priv)
 		goto err;
 
 	if (!debugfs_create_file("status", 0400, d->debugfs_phy,
-				 priv, &fops_status))
+				 priv, &cw1200_status_fops))
 		goto err;
 
 	if (!debugfs_create_file("counters", 0400, d->debugfs_phy,
-				 priv, &fops_counters))
+				 priv, &cw1200_counters_fops))
 		goto err;
 
 	if (!debugfs_create_file("wsm_dumps", 0200, d->debugfs_phy,
Signature · 1 line
2.17.0
#1 lore raw
Quoted 3 lines · Yangtao Li

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

The prefix should be "cw1200:", I can fix that.

Signature · 1 line
Kalle Valo
author
#2 lore raw
Quoted 11 lines · Kalle Valo
Quoted 3 lines · Yangtao Li

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

The prefix should be "cw1200:", I can fix that.

--
Kalle Valo

OK.

Thanks,
Yangtao

author
#3 lore raw
Quoted 10 lines · Frank Lee
Quoted 8 lines · Kalle Valo
Quoted 3 lines · Yangtao Li

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

The prefix should be "cw1200:", I can fix that.

The same.

Thanks,
Yangtao

Quoted 7 lines
Quoted 3 lines

--
Kalle Valo

OK.

Thanks,
Yangtao

#4 lore raw

Re: [PATCH] cw1200: convert to DEFINE_SHOW_ATTRIBUTE

In reply to Yangtao Li
Quoted 3 lines · Yangtao Li

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Patch applied to wireless-drivers-next.git, thanks.

cc4dc97ffc69 cw1200: convert to DEFINE_SHOW_ATTRIBUTE

Signature · 3 lines
https://patchwork.kernel.org/patch/10709559/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches