* [PATCH 0/3] mips: use DEFINE_SHOW_ATTRIBUTE to simplify code
@ 2022-09-13 10:10 Liu Shixin
2022-09-13 10:10 ` [PATCH 1/3] mips: cavium: convert to DEFINE_SHOW_ATTRIBUTE Liu Shixin
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Liu Shixin @ 2022-09-13 10:10 UTC (permalink / raw)
To: Thomas Bogendoerfer, John Crispin
Cc: linux-mips, linux-kernel, Liu Shixin, Kefeng Wang
Use DEFINE_SHOW_ATTRIBUTE to simplify code.
Liu Shixin (3):
mips: cavium: convert to DEFINE_SHOW_ATTRIBUTE
mips: kernel: convert to DEFINE_SHOW_ATTRIBUTE
mips: ralink: convert to DEFINE_SHOW_ATTRIBUTE
arch/mips/cavium-octeon/oct_ilm.c | 17 +++--------------
arch/mips/kernel/segment.c | 15 ++-------------
arch/mips/ralink/bootrom.c | 15 ++-------------
3 files changed, 7 insertions(+), 40 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] mips: cavium: convert to DEFINE_SHOW_ATTRIBUTE
2022-09-13 10:10 [PATCH 0/3] mips: use DEFINE_SHOW_ATTRIBUTE to simplify code Liu Shixin
@ 2022-09-13 10:10 ` Liu Shixin
2022-09-13 10:10 ` [PATCH 2/3] mips: kernel: " Liu Shixin
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Liu Shixin @ 2022-09-13 10:10 UTC (permalink / raw)
To: Thomas Bogendoerfer, John Crispin
Cc: linux-mips, linux-kernel, Liu Shixin, Kefeng Wang
Use DEFINE_SHOW_ATTRIBUTE helper macro to simplify the code.
Signed-off-by: Liu Shixin <liushixin2@huawei.com>
---
arch/mips/cavium-octeon/oct_ilm.c | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/arch/mips/cavium-octeon/oct_ilm.c b/arch/mips/cavium-octeon/oct_ilm.c
index 6a4694538bb6..dc05262e85ff 100644
--- a/arch/mips/cavium-octeon/oct_ilm.c
+++ b/arch/mips/cavium-octeon/oct_ilm.c
@@ -28,7 +28,7 @@ struct latency_info {
static struct latency_info li;
static struct dentry *dir;
-static int show_latency(struct seq_file *m, void *v)
+static int oct_ilm_show(struct seq_file *m, void *v)
{
u64 cpuclk, avg, max, min;
struct latency_info curr_li = li;
@@ -43,18 +43,7 @@ static int show_latency(struct seq_file *m, void *v)
curr_li.interrupt_cnt, avg, max, min);
return 0;
}
-
-static int oct_ilm_open(struct inode *inode, struct file *file)
-{
- return single_open(file, show_latency, NULL);
-}
-
-static const struct file_operations oct_ilm_ops = {
- .open = oct_ilm_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(oct_ilm);
static int reset_statistics(void *data, u64 value)
{
@@ -67,7 +56,7 @@ DEFINE_DEBUGFS_ATTRIBUTE(reset_statistics_ops, NULL, reset_statistics, "%llu\n")
static void init_debugfs(void)
{
dir = debugfs_create_dir("oct_ilm", 0);
- debugfs_create_file("statistics", 0222, dir, NULL, &oct_ilm_ops);
+ debugfs_create_file("statistics", 0222, dir, NULL, &oct_ilm_fops);
debugfs_create_file("reset", 0222, dir, NULL, &reset_statistics_ops);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] mips: kernel: convert to DEFINE_SHOW_ATTRIBUTE
2022-09-13 10:10 [PATCH 0/3] mips: use DEFINE_SHOW_ATTRIBUTE to simplify code Liu Shixin
2022-09-13 10:10 ` [PATCH 1/3] mips: cavium: convert to DEFINE_SHOW_ATTRIBUTE Liu Shixin
@ 2022-09-13 10:10 ` Liu Shixin
2022-09-13 10:10 ` [PATCH 3/3] mips: ralink: " Liu Shixin
2022-09-19 14:46 ` [PATCH 0/3] mips: use DEFINE_SHOW_ATTRIBUTE to simplify code Thomas Bogendoerfer
3 siblings, 0 replies; 5+ messages in thread
From: Liu Shixin @ 2022-09-13 10:10 UTC (permalink / raw)
To: Thomas Bogendoerfer, John Crispin
Cc: linux-mips, linux-kernel, Liu Shixin, Kefeng Wang
Use DEFINE_SHOW_ATTRIBUTE helper macro to simplify the code.
Signed-off-by: Liu Shixin <liushixin2@huawei.com>
---
arch/mips/kernel/segment.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/arch/mips/kernel/segment.c b/arch/mips/kernel/segment.c
index 0a9bd7b0983b..24560501c70d 100644
--- a/arch/mips/kernel/segment.c
+++ b/arch/mips/kernel/segment.c
@@ -46,7 +46,7 @@ static void build_segment_config(char *str, unsigned int cfg)
((cfg & MIPS_SEGCFG_EU) >> MIPS_SEGCFG_EU_SHIFT));
}
-static int show_segments(struct seq_file *m, void *v)
+static int segments_show(struct seq_file *m, void *v)
{
unsigned int segcfg;
char str[42];
@@ -80,18 +80,7 @@ static int show_segments(struct seq_file *m, void *v)
return 0;
}
-
-static int segments_open(struct inode *inode, struct file *file)
-{
- return single_open(file, show_segments, NULL);
-}
-
-static const struct file_operations segments_fops = {
- .open = segments_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(segments);
static int __init segments_info(void)
{
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] mips: ralink: convert to DEFINE_SHOW_ATTRIBUTE
2022-09-13 10:10 [PATCH 0/3] mips: use DEFINE_SHOW_ATTRIBUTE to simplify code Liu Shixin
2022-09-13 10:10 ` [PATCH 1/3] mips: cavium: convert to DEFINE_SHOW_ATTRIBUTE Liu Shixin
2022-09-13 10:10 ` [PATCH 2/3] mips: kernel: " Liu Shixin
@ 2022-09-13 10:10 ` Liu Shixin
2022-09-19 14:46 ` [PATCH 0/3] mips: use DEFINE_SHOW_ATTRIBUTE to simplify code Thomas Bogendoerfer
3 siblings, 0 replies; 5+ messages in thread
From: Liu Shixin @ 2022-09-13 10:10 UTC (permalink / raw)
To: Thomas Bogendoerfer, John Crispin
Cc: linux-mips, linux-kernel, Liu Shixin, Kefeng Wang
Use DEFINE_SHOW_ATTRIBUTE helper macro to simplify the code.
Signed-off-by: Liu Shixin <liushixin2@huawei.com>
---
arch/mips/ralink/bootrom.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/arch/mips/ralink/bootrom.c b/arch/mips/ralink/bootrom.c
index 94ca8379b83c..8c8cc0a81ed8 100644
--- a/arch/mips/ralink/bootrom.c
+++ b/arch/mips/ralink/bootrom.c
@@ -18,22 +18,11 @@ static int bootrom_show(struct seq_file *s, void *unused)
return 0;
}
-
-static int bootrom_open(struct inode *inode, struct file *file)
-{
- return single_open(file, bootrom_show, NULL);
-}
-
-static const struct file_operations bootrom_file_ops = {
- .open = bootrom_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(bootrom);
static int __init bootrom_setup(void)
{
- debugfs_create_file("bootrom", 0444, NULL, NULL, &bootrom_file_ops);
+ debugfs_create_file("bootrom", 0444, NULL, NULL, &bootrom_fops);
return 0;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] mips: use DEFINE_SHOW_ATTRIBUTE to simplify code
2022-09-13 10:10 [PATCH 0/3] mips: use DEFINE_SHOW_ATTRIBUTE to simplify code Liu Shixin
` (2 preceding siblings ...)
2022-09-13 10:10 ` [PATCH 3/3] mips: ralink: " Liu Shixin
@ 2022-09-19 14:46 ` Thomas Bogendoerfer
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Bogendoerfer @ 2022-09-19 14:46 UTC (permalink / raw)
To: Liu Shixin; +Cc: John Crispin, linux-mips, linux-kernel, Kefeng Wang
On Tue, Sep 13, 2022 at 06:10:35PM +0800, Liu Shixin wrote:
> Use DEFINE_SHOW_ATTRIBUTE to simplify code.
>
> Liu Shixin (3):
> mips: cavium: convert to DEFINE_SHOW_ATTRIBUTE
> mips: kernel: convert to DEFINE_SHOW_ATTRIBUTE
> mips: ralink: convert to DEFINE_SHOW_ATTRIBUTE
>
> arch/mips/cavium-octeon/oct_ilm.c | 17 +++--------------
> arch/mips/kernel/segment.c | 15 ++-------------
> arch/mips/ralink/bootrom.c | 15 ++-------------
> 3 files changed, 7 insertions(+), 40 deletions(-)
series applied to mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-09-19 14:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-13 10:10 [PATCH 0/3] mips: use DEFINE_SHOW_ATTRIBUTE to simplify code Liu Shixin
2022-09-13 10:10 ` [PATCH 1/3] mips: cavium: convert to DEFINE_SHOW_ATTRIBUTE Liu Shixin
2022-09-13 10:10 ` [PATCH 2/3] mips: kernel: " Liu Shixin
2022-09-13 10:10 ` [PATCH 3/3] mips: ralink: " Liu Shixin
2022-09-19 14:46 ` [PATCH 0/3] mips: use DEFINE_SHOW_ATTRIBUTE to simplify code Thomas Bogendoerfer
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).