Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1635263 > unrolled thread
| Started by | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| First post | 2017-05-03 22:40 +0200 |
| Last post | 2017-05-03 22:50 +0200 |
| Articles | 6 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH 0/6] lockdep: Fine-tuning for some function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-03 22:40 +0200
[PATCH 2/6] lockdep: Use seq_putc() in seq_header() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-03 22:40 +0200
[PATCH 4/6] lockdep: Combine two seq_printf() calls into one call in l_show() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-03 22:50 +0200
[PATCH 5/6] lockdep: Improve a size determination in lock_stat_open() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-03 22:50 +0200
[PATCH 6/6] lockdep: Add spaces for better code readability SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-03 22:50 +0200
[PATCH 3/6] lockdep: Replace four seq_printf() calls by seq_puts() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-03 22:50 +0200
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-05-03 22:40 +0200 |
| Subject | [PATCH 0/6] lockdep: Fine-tuning for some function implementations |
| Message-ID | <tD9e2-1So-11@gated-at.bofh.it> |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Wed, 3 May 2017 22:17:03 +0200 Some update suggestions were taken into account from static source code analysis. Markus Elfring (6): Replace 11 seq_puts() calls by seq_putc() Use seq_putc() in seq_header() Replace four seq_printf() calls by seq_puts() Combine two seq_printf() calls into one call in l_show() Improve a size determination in lock_stat_open() Add spaces for better code readability kernel/locking/lockdep_proc.c | 50 ++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 27 deletions(-) -- 2.12.2
[toc] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-05-03 22:40 +0200 |
| Subject | [PATCH 2/6] lockdep: Use seq_putc() in seq_header() |
| Message-ID | <tD9e2-1So-23@gated-at.bofh.it> |
| In reply to | #1635263 |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Wed, 3 May 2017 21:30:26 +0200 A single character (line break) should be put into a sequence. Thus use the corresponding function "seq_putc". This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- kernel/locking/lockdep_proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/locking/lockdep_proc.c b/kernel/locking/lockdep_proc.c index 825496ece766..b1fa2ae31c0b 100644 --- a/kernel/locking/lockdep_proc.c +++ b/kernel/locking/lockdep_proc.c @@ -560,7 +560,7 @@ static void seq_header(struct seq_file *m) "holdtime-total", "holdtime-avg"); seq_line(m, '-', 0, 40 + 1 + 12 * (14 + 1)); - seq_printf(m, "\n"); + seq_putc(m, '\n'); } static void *ls_start(struct seq_file *m, loff_t *pos) -- 2.12.2
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-05-03 22:50 +0200 |
| Subject | [PATCH 4/6] lockdep: Combine two seq_printf() calls into one call in l_show() |
| Message-ID | <tD9nH-1VW-1@gated-at.bofh.it> |
| In reply to | #1635263 |
From: Markus Elfring <elfring@users.sourceforge.net> Date: Wed, 3 May 2017 21:56:11 +0200 A bit of data was put into a sequence by two separate function calls. Print the same data by a single function call instead. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> --- kernel/locking/lockdep_proc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/kernel/locking/lockdep_proc.c b/kernel/locking/lockdep_proc.c index a353f53b6de6..2cc0ccd2b3de 100644 --- a/kernel/locking/lockdep_proc.c +++ b/kernel/locking/lockdep_proc.c @@ -75,7 +75,5 @@ static int l_show(struct seq_file *m, void *v) #endif get_usage_chars(class, usage); - seq_printf(m, " %s", usage); - - seq_printf(m, ": "); + seq_printf(m, " %s: ", usage); print_name(m, class); -- 2.12.2
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-05-03 22:50 +0200 |
| Subject | [PATCH 5/6] lockdep: Improve a size determination in lock_stat_open() |
| Message-ID | <tD9nH-1VW-11@gated-at.bofh.it> |
| In reply to | #1635263 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 3 May 2017 22:05:57 +0200
Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
kernel/locking/lockdep_proc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/locking/lockdep_proc.c b/kernel/locking/lockdep_proc.c
index 2cc0ccd2b3de..509a17f5ea01 100644
--- a/kernel/locking/lockdep_proc.c
+++ b/kernel/locking/lockdep_proc.c
@@ -607,7 +607,7 @@ static int lock_stat_open(struct inode *inode, struct file *file)
{
int res;
struct lock_class *class;
- struct lock_stat_seq *data = vmalloc(sizeof(struct lock_stat_seq));
+ struct lock_stat_seq *data = vmalloc(sizeof(*data));
if (!data)
return -ENOMEM;
--
2.12.2
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-05-03 22:50 +0200 |
| Subject | [PATCH 6/6] lockdep: Add spaces for better code readability |
| Message-ID | <tD9nH-1VW-17@gated-at.bofh.it> |
| In reply to | #1635263 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 3 May 2017 22:11:28 +0200
Use space characters at some source code places according to
the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
kernel/locking/lockdep_proc.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/kernel/locking/lockdep_proc.c b/kernel/locking/lockdep_proc.c
index 509a17f5ea01..22c89868e6b1 100644
--- a/kernel/locking/lockdep_proc.c
+++ b/kernel/locking/lockdep_proc.c
@@ -402,7 +402,7 @@ static void snprint_time(char *buf, size_t bufsiz, s64 nr)
nr += 5; /* for display rounding */
div = div_s64_rem(nr, 1000, &rem);
- snprintf(buf, bufsiz, "%lld.%02d", (long long)div, (int)rem/10);
+ snprintf(buf, bufsiz, "%lld.%02d", (long long)div, (int)rem / 10);
}
static void seq_time(struct seq_file *m, s64 time)
@@ -461,11 +461,11 @@ static void seq_stats(struct seq_file *m, struct lock_stat_data *data)
namelen = strlen(name);
if (class->name_version > 1) {
- snprintf(name+namelen, 3, "#%d", class->name_version);
+ snprintf(name + namelen, 3, "#%d", class->name_version);
namelen += 2;
}
if (class->subclass) {
- snprintf(name+namelen, 3, "/%d", class->subclass);
+ snprintf(name + namelen, 3, "/%d", class->subclass);
namelen += 2;
}
@@ -504,7 +504,7 @@ static void seq_stats(struct seq_file *m, struct lock_stat_data *data)
break;
if (!i)
- seq_line(m, '-', 40-namelen, namelen);
+ seq_line(m, '-', 40 - namelen, namelen);
snprintf(ip, sizeof(ip), "[<%p>]",
(void *)class->contention_point[i]);
@@ -519,7 +519,7 @@ static void seq_stats(struct seq_file *m, struct lock_stat_data *data)
break;
if (!i)
- seq_line(m, '-', 40-namelen, namelen);
+ seq_line(m, '-', 40 - namelen, namelen);
snprintf(ip, sizeof(ip), "[<%p>]",
(void *)class->contending_point[i]);
--
2.12.2
[toc] | [prev] | [next] | [standalone]
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Date | 2017-05-03 22:50 +0200 |
| Subject | [PATCH 3/6] lockdep: Replace four seq_printf() calls by seq_puts() |
| Message-ID | <tD9nI-1VW-21@gated-at.bofh.it> |
| In reply to | #1635263 |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 3 May 2017 21:46:49 +0200
Four strings which did not contain data format specifications should be put
into a sequence. Thus use the corresponding function "seq_puts".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
kernel/locking/lockdep_proc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/locking/lockdep_proc.c b/kernel/locking/lockdep_proc.c
index b1fa2ae31c0b..a353f53b6de6 100644
--- a/kernel/locking/lockdep_proc.c
+++ b/kernel/locking/lockdep_proc.c
@@ -61,7 +61,7 @@ static int l_show(struct seq_file *m, void *v)
char usage[LOCK_USAGE_CHARS];
if (v == &all_lock_classes) {
- seq_printf(m, "all lock classes:\n");
+ seq_puts(m, "all lock classes:\n");
return 0;
}
@@ -141,8 +141,8 @@ static int lc_show(struct seq_file *m, void *v)
if (v == SEQ_START_TOKEN) {
if (nr_chain_hlocks > MAX_LOCKDEP_CHAIN_HLOCKS)
- seq_printf(m, "(buggered) ");
- seq_printf(m, "all lock chains:\n");
+ seq_puts(m, "(buggered) ");
+ seq_puts(m, "all lock chains:\n");
return 0;
}
@@ -541,7 +541,7 @@ static void seq_header(struct seq_file *m)
seq_puts(m, "lock_stat version 0.4\n");
if (unlikely(!debug_locks))
- seq_printf(m, "*WARNING* lock debugging disabled!! - possibly due to a lockdep warning\n");
+ seq_puts(m, "*WARNING* lock debugging disabled!! - possibly due to a lockdep warning\n");
seq_line(m, '-', 0, 40 + 1 + 12 * (14 + 1));
seq_printf(m, "%40s %14s %14s %14s %14s %14s %14s %14s %14s %14s %14s "
--
2.12.2
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web