All of lore.kernel.org
 help / color / mirror / Atom feed
* [Linux-kernel-mentees] [PATCH] lspci: Make output for empty range behind a bridge consistent
@ 2019-05-08  5:21 ` Kelsey Skunberg
  0 siblings, 0 replies; 8+ messages in thread
From: skunberg.kelsey @ 2019-05-08  5:21 UTC (permalink / raw)


When a range behind a bridge is empty, '[empty]' will be displayed
after the prefix. Removing option to display 'None' for consistency.

Using -vvv will include full range addresses between prefix and '[empty]'.

show_range() is only called when verbose (-v). Code checking for
'not verbose' is not needed.

Signed-off-by: Kelsey Skunberg <skunberg.kelsey at gmail.com>
---
 lspci.c | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/lspci.c b/lspci.c
index d63b6d0..65cbde9 100644
--- a/lspci.c
+++ b/lspci.c
@@ -375,23 +375,15 @@ show_size(u64 x)
 
 static void
 show_range(char *prefix, u64 base, u64 limit, int is_64bit)
-{
-  if (base > limit)
+{ 
+  printf("%s:", prefix);
+  if (base <= limit || verbose > 2)
     {
-      if (!verbose)
-	return;
-      else if (verbose < 3)
-	{
-	  printf("%s: None\n", prefix);
-	  return;
-	}
+      if (is_64bit)
+        printf(" %016" PCI_U64_FMT_X "-%016" PCI_U64_FMT_X, base, limit);
+      else
+        printf(" %08x-%08x", (unsigned) base, (unsigned) limit);
     }
-
-  printf("%s: ", prefix);
-  if (is_64bit)
-    printf("%016" PCI_U64_FMT_X "-%016" PCI_U64_FMT_X, base, limit);
-  else
-    printf("%08x-%08x", (unsigned) base, (unsigned) limit);
   if (base <= limit)
     show_size(limit - base + 1);
   else
-- 
2.20.1

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

end of thread, other threads:[~2019-05-09 12:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-08  5:21 [Linux-kernel-mentees] [PATCH] lspci: Make output for empty range behind a bridge consistent skunberg.kelsey
2019-05-08  5:21 ` Kelsey Skunberg
2019-05-08 13:40 ` helgaas
2019-05-08 13:40   ` Bjorn Helgaas
2019-05-09  5:35   ` skunberg.kelsey
2019-05-09  5:35     ` Kelsey Skunberg
2019-05-09 12:42     ` helgaas
2019-05-09 12:42       ` Bjorn Helgaas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.