linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] ath5k: convert to use DEFINE_SEQ_ATTRIBUTE macro
@ 2020-09-16  2:50 Liu Shixin
  2020-09-22  7:46 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Liu Shixin @ 2020-09-16  2:50 UTC (permalink / raw)
  To: Jiri Slaby, Nick Kossifidis, Luis Chamberlain, Kalle Valo,
	David S . Miller, Jakub Kicinski
  Cc: linux-wireless, netdev, linux-kernel, Liu Shixin

Use DEFINE_SEQ_ATTRIBUTE macro to simplify the code.

Signed-off-by: Liu Shixin <liushixin2@huawei.com>
---
 drivers/net/wireless/ath/ath5k/debug.c | 25 +++----------------------
 1 file changed, 3 insertions(+), 22 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c
index 2eaba1ccab20..4b41160e5d38 100644
--- a/drivers/net/wireless/ath/ath5k/debug.c
+++ b/drivers/net/wireless/ath/ath5k/debug.c
@@ -161,33 +161,14 @@ static int reg_show(struct seq_file *seq, void *p)
 	return 0;
 }
 
-static const struct seq_operations register_seq_ops = {
+static const struct seq_operations registers_sops = {
 	.start = reg_start,
 	.next  = reg_next,
 	.stop  = reg_stop,
 	.show  = reg_show
 };
 
-static int open_file_registers(struct inode *inode, struct file *file)
-{
-	struct seq_file *s;
-	int res;
-	res = seq_open(file, &register_seq_ops);
-	if (res == 0) {
-		s = file->private_data;
-		s->private = inode->i_private;
-	}
-	return res;
-}
-
-static const struct file_operations fops_registers = {
-	.open = open_file_registers,
-	.read    = seq_read,
-	.llseek  = seq_lseek,
-	.release = seq_release,
-	.owner = THIS_MODULE,
-};
-
+DEFINE_SEQ_ATTRIBUTE(registers);
 
 /* debugfs: beacons */
 
@@ -1005,7 +986,7 @@ ath5k_debug_init_device(struct ath5k_hw *ah)
 		return;
 
 	debugfs_create_file("debug", 0600, phydir, ah, &fops_debug);
-	debugfs_create_file("registers", 0400, phydir, ah, &fops_registers);
+	debugfs_create_file("registers", 0400, phydir, ah, &registers_fops);
 	debugfs_create_file("beacon", 0600, phydir, ah, &fops_beacon);
 	debugfs_create_file("reset", 0200, phydir, ah, &fops_reset);
 	debugfs_create_file("antenna", 0600, phydir, ah, &fops_antenna);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] ath5k: convert to use DEFINE_SEQ_ATTRIBUTE macro
  2020-09-16  2:50 [PATCH -next] ath5k: convert to use DEFINE_SEQ_ATTRIBUTE macro Liu Shixin
@ 2020-09-22  7:46 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2020-09-22  7:46 UTC (permalink / raw)
  To: Liu Shixin
  Cc: Jiri Slaby, Nick Kossifidis, Luis Chamberlain, David S . Miller,
	Jakub Kicinski, linux-wireless, netdev, linux-kernel, Liu Shixin

Liu Shixin <liushixin2@huawei.com> wrote:

> Use DEFINE_SEQ_ATTRIBUTE macro to simplify the code.
> 
> Signed-off-by: Liu Shixin <liushixin2@huawei.com>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

Patch applied to ath-next branch of ath.git, thanks.

aac352d6810e ath5k: convert to use DEFINE_SEQ_ATTRIBUTE macro

-- 
https://patchwork.kernel.org/patch/11778725/

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-22  7:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-16  2:50 [PATCH -next] ath5k: convert to use DEFINE_SEQ_ATTRIBUTE macro Liu Shixin
2020-09-22  7:46 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).