Skip to contentSkip to conversation

clk: nomadik: Change to use DEFINE_SHOW_ATTRIBUTE macro

PATCH Applied Yangtao Li 2 participants 4 messages Nov 23, 2018 – Nov 29, 2018

Subsystems (2)
lore
Share & tools
lore

Yangtao Li

author
#0 lore raw

PATCH 1/1 clk: nomadik: Change to use DEFINE_SHOW_ATTRIBUTE macro

Use macro to simplify the code.

---
 drivers/clk/clk-nomadik.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)
drivers/clk/clk-nomadik.c +2 -12
index 84a24875c629..e331634d34df 100644
@@ -479,17 +479,7 @@ static int nomadik_src_clk_show(struct seq_file *s, void *what)
 	return 0;
 }
 
-static int nomadik_src_clk_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, nomadik_src_clk_show, NULL);
-}
-
-static const struct file_operations nomadik_src_clk_debugfs_ops = {
-	.open           = nomadik_src_clk_open,
-	.read           = seq_read,
-        .llseek         = seq_lseek,
-	.release        = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(nomadik_src_clk_debugfs);
 
 static int __init nomadik_src_clk_init_debugfs(void)
 {
@@ -499,7 +489,7 @@ static int __init nomadik_src_clk_init_debugfs(void)
 	src_pcksr0_boot = readl(src_base + SRC_PCKSR0);
 	src_pcksr1_boot = readl(src_base + SRC_PCKSR1);
 	debugfs_create_file("nomadik-src-clk", S_IFREG | S_IRUGO,
-			    NULL, NULL, &nomadik_src_clk_debugfs_ops);
+			    NULL, NULL, &nomadik_src_clk_debugfs_fops);
 	return 0;
 }
 device_initcall(nomadik_src_clk_init_debugfs);
Signature · 1 line
2.17.0
maintainer
#2 lore raw

Quoting Stephen Boyd (2018-11-28 14:08:32)

Quoted 8 lines

Quoting Yangtao Li (2018-11-23 07:06:00)

Quoted 4 lines

Use macro to simplify the code.

---

Applied to clk-next

Except this doesn't compile. I fixed it, but please actually compile your patches before sending next time.

drivers/clk/clk-nomadik.c +1 -1
index e331634d34df..a95aa96f4a68 100644
@@ -455,7 +455,7 @@ static const char * const src_clk_names[] = {
 	"RNGCCLK   ",
 };
 
-static int nomadik_src_clk_show(struct seq_file *s, void *what)
+static int nomadik_src_clk_debugfs_show(struct seq_file *s, void *what)
 {
 	int i;
 	u32 src_pcksr0 = readl(src_base + SRC_PCKSR0);
author
#3 lore raw
Quoted 5 lines · Stephen Boyd

Quoting Stephen Boyd (2018-11-28 14:08:32)

Quoted 3 lines

Quoting Yangtao Li (2018-11-23 07:06:00)

Quoted 2 lines

Use macro to simplify the code.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

---

Applied to clk-next

Except this doesn't compile. I fixed it, but please actually compile your patches before sending next time.

Sorry, I will pay attention next time.

MBR,
Yangtao

Quoted 14 lines
drivers/clk/clk-nomadik.c +1 -1
index e331634d34df..a95aa96f4a68 100644
@@ -455,7 +455,7 @@ static const char * const src_clk_names[] = {
        "RNGCCLK   ",
 };
 
-static int nomadik_src_clk_show(struct seq_file *s, void *what)
+static int nomadik_src_clk_debugfs_show(struct seq_file *s, void *what)
 {
        int i;
        u32 src_pcksr0 = readl(src_base + SRC_PCKSR0);