Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH 1/2] MIPS: PCI: ops-emma2rh: drop nonsensical db_assert
@ 2015-07-13 16:14 Paul Burton
  2015-07-13 16:14 ` Paul Burton
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Paul Burton @ 2015-07-13 16:14 UTC (permalink / raw)
  To: linux-mips; +Cc: Paul Burton, Ralf Baechle, linux-kernel

The db_assert call checks whether the bus_num pointer is non-NULL, but
does so after said pointer has been dereferenced by the assignment on
the previous line. Thus the check is pointless & likely to have been
optimised out by the compiler anyway. The check_args function is static
& only ever called from the local file with bus_num being a pointer to
an on-stack variable, so the check seems somewhat overzealous anyway.
Simply remove it.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

 arch/mips/pci/ops-emma2rh.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/mips/pci/ops-emma2rh.c b/arch/mips/pci/ops-emma2rh.c
index 710aef5..2dc97c4 100644
--- a/arch/mips/pci/ops-emma2rh.c
+++ b/arch/mips/pci/ops-emma2rh.c
@@ -25,7 +25,6 @@
 #include <linux/types.h>
 
 #include <asm/addrspace.h>
-#include <asm/debug.h>
 
 #include <asm/emma/emma2rh.h>
 
@@ -40,10 +39,9 @@
 static int check_args(struct pci_bus *bus, u32 devfn, u32 * bus_num)
 {
 	/* check if the bus is top-level */
-	if (bus->parent != NULL) {
+	if (bus->parent != NULL)
 		*bus_num = bus->number;
-		db_assert(bus_num != NULL);
-	} else
+	else
 		*bus_num = 0;
 
 	if (*bus_num == 0) {
-- 
2.4.5

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

* [PATCH 1/2] MIPS: PCI: ops-emma2rh: drop nonsensical db_assert
  2015-07-13 16:14 [PATCH 1/2] MIPS: PCI: ops-emma2rh: drop nonsensical db_assert Paul Burton
@ 2015-07-13 16:14 ` Paul Burton
  2015-07-13 16:14 ` [PATCH 2/2] MIPS: drop CONFIG_RUNTIME_DEBUG & debug.h Paul Burton
  2015-07-14  8:30 ` [PATCH 1/2] MIPS: PCI: ops-emma2rh: drop nonsensical db_assert Ralf Baechle
  2 siblings, 0 replies; 7+ messages in thread
From: Paul Burton @ 2015-07-13 16:14 UTC (permalink / raw)
  To: linux-mips; +Cc: Paul Burton, Ralf Baechle, linux-kernel

The db_assert call checks whether the bus_num pointer is non-NULL, but
does so after said pointer has been dereferenced by the assignment on
the previous line. Thus the check is pointless & likely to have been
optimised out by the compiler anyway. The check_args function is static
& only ever called from the local file with bus_num being a pointer to
an on-stack variable, so the check seems somewhat overzealous anyway.
Simply remove it.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

 arch/mips/pci/ops-emma2rh.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/mips/pci/ops-emma2rh.c b/arch/mips/pci/ops-emma2rh.c
index 710aef5..2dc97c4 100644
--- a/arch/mips/pci/ops-emma2rh.c
+++ b/arch/mips/pci/ops-emma2rh.c
@@ -25,7 +25,6 @@
 #include <linux/types.h>
 
 #include <asm/addrspace.h>
-#include <asm/debug.h>
 
 #include <asm/emma/emma2rh.h>
 
@@ -40,10 +39,9 @@
 static int check_args(struct pci_bus *bus, u32 devfn, u32 * bus_num)
 {
 	/* check if the bus is top-level */
-	if (bus->parent != NULL) {
+	if (bus->parent != NULL)
 		*bus_num = bus->number;
-		db_assert(bus_num != NULL);
-	} else
+	else
 		*bus_num = 0;
 
 	if (*bus_num == 0) {
-- 
2.4.5

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

* [PATCH 2/2] MIPS: drop CONFIG_RUNTIME_DEBUG & debug.h
  2015-07-13 16:14 [PATCH 1/2] MIPS: PCI: ops-emma2rh: drop nonsensical db_assert Paul Burton
  2015-07-13 16:14 ` Paul Burton
@ 2015-07-13 16:14 ` Paul Burton
  2015-07-13 16:14   ` Paul Burton
  2015-07-14  8:30 ` [PATCH 1/2] MIPS: PCI: ops-emma2rh: drop nonsensical db_assert Ralf Baechle
  2 siblings, 1 reply; 7+ messages in thread
From: Paul Burton @ 2015-07-13 16:14 UTC (permalink / raw)
  To: linux-mips; +Cc: Paul Burton, Ralf Baechle, linux-kernel

The debug.h header provided some MIPS-specific debug macros, which are
no longer used at all. Remove them.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

 arch/mips/Kconfig.debug       |  9 --------
 arch/mips/include/asm/debug.h | 48 -------------------------------------------
 2 files changed, 57 deletions(-)
 delete mode 100644 arch/mips/include/asm/debug.h

diff --git a/arch/mips/Kconfig.debug b/arch/mips/Kconfig.debug
index 3a2b775..e250524 100644
--- a/arch/mips/Kconfig.debug
+++ b/arch/mips/Kconfig.debug
@@ -87,15 +87,6 @@ config SB1XXX_CORELIS
 	  Select compile flags that produce code that can be processed by the
 	  Corelis mksym utility and UDB Emulator.
 
-config RUNTIME_DEBUG
-	bool "Enable run-time debugging"
-	depends on DEBUG_KERNEL
-	help
-	  If you say Y here, some debugging macros will do run-time checking.
-	  If you say N here, those macros will mostly turn to no-ops.  See
-	  arch/mips/include/asm/debug.h for debugging macros.
-	  If unsure, say N.
-
 config DEBUG_ZBOOT
 	bool "Enable compressed kernel support debugging"
 	depends on DEBUG_KERNEL && SYS_SUPPORTS_ZBOOT
diff --git a/arch/mips/include/asm/debug.h b/arch/mips/include/asm/debug.h
deleted file mode 100644
index 1fd5a2b..0000000
--- a/arch/mips/include/asm/debug.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Debug macros for run-time debugging.
- * Turned on/off with CONFIG_RUNTIME_DEBUG option.
- *
- * Copyright (C) 2001 MontaVista Software Inc.
- * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- */
-
-#ifndef _ASM_DEBUG_H
-#define _ASM_DEBUG_H
-
-
-/*
- * run-time macros for catching spurious errors.  Eable CONFIG_RUNTIME_DEBUG in
- * kernel hacking config menu to use them.
- *
- * Use them as run-time debugging aid.  NEVER USE THEM AS ERROR HANDLING CODE!!!
- */
-
-#ifdef CONFIG_RUNTIME_DEBUG
-
-#include <linux/kernel.h>
-
-#define db_assert(x)  if (!(x)) { \
-	panic("assertion failed at %s:%d: %s", __FILE__, __LINE__, #x); }
-#define db_warn(x)  if (!(x)) { \
-	printk(KERN_WARNING "warning at %s:%d: %s", __FILE__, __LINE__, #x); }
-#define db_verify(x, y) db_assert(x y)
-#define db_verify_warn(x, y) db_warn(x y)
-#define db_run(x)  do { x; } while (0)
-
-#else
-
-#define db_assert(x)
-#define db_warn(x)
-#define db_verify(x, y) x
-#define db_verify_warn(x, y) x
-#define db_run(x)
-
-#endif
-
-#endif /* _ASM_DEBUG_H */
-- 
2.4.5

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

* [PATCH 2/2] MIPS: drop CONFIG_RUNTIME_DEBUG & debug.h
  2015-07-13 16:14 ` [PATCH 2/2] MIPS: drop CONFIG_RUNTIME_DEBUG & debug.h Paul Burton
@ 2015-07-13 16:14   ` Paul Burton
  0 siblings, 0 replies; 7+ messages in thread
From: Paul Burton @ 2015-07-13 16:14 UTC (permalink / raw)
  To: linux-mips; +Cc: Paul Burton, Ralf Baechle, linux-kernel

The debug.h header provided some MIPS-specific debug macros, which are
no longer used at all. Remove them.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

 arch/mips/Kconfig.debug       |  9 --------
 arch/mips/include/asm/debug.h | 48 -------------------------------------------
 2 files changed, 57 deletions(-)
 delete mode 100644 arch/mips/include/asm/debug.h

diff --git a/arch/mips/Kconfig.debug b/arch/mips/Kconfig.debug
index 3a2b775..e250524 100644
--- a/arch/mips/Kconfig.debug
+++ b/arch/mips/Kconfig.debug
@@ -87,15 +87,6 @@ config SB1XXX_CORELIS
 	  Select compile flags that produce code that can be processed by the
 	  Corelis mksym utility and UDB Emulator.
 
-config RUNTIME_DEBUG
-	bool "Enable run-time debugging"
-	depends on DEBUG_KERNEL
-	help
-	  If you say Y here, some debugging macros will do run-time checking.
-	  If you say N here, those macros will mostly turn to no-ops.  See
-	  arch/mips/include/asm/debug.h for debugging macros.
-	  If unsure, say N.
-
 config DEBUG_ZBOOT
 	bool "Enable compressed kernel support debugging"
 	depends on DEBUG_KERNEL && SYS_SUPPORTS_ZBOOT
diff --git a/arch/mips/include/asm/debug.h b/arch/mips/include/asm/debug.h
deleted file mode 100644
index 1fd5a2b..0000000
--- a/arch/mips/include/asm/debug.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Debug macros for run-time debugging.
- * Turned on/off with CONFIG_RUNTIME_DEBUG option.
- *
- * Copyright (C) 2001 MontaVista Software Inc.
- * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- */
-
-#ifndef _ASM_DEBUG_H
-#define _ASM_DEBUG_H
-
-
-/*
- * run-time macros for catching spurious errors.  Eable CONFIG_RUNTIME_DEBUG in
- * kernel hacking config menu to use them.
- *
- * Use them as run-time debugging aid.  NEVER USE THEM AS ERROR HANDLING CODE!!!
- */
-
-#ifdef CONFIG_RUNTIME_DEBUG
-
-#include <linux/kernel.h>
-
-#define db_assert(x)  if (!(x)) { \
-	panic("assertion failed at %s:%d: %s", __FILE__, __LINE__, #x); }
-#define db_warn(x)  if (!(x)) { \
-	printk(KERN_WARNING "warning at %s:%d: %s", __FILE__, __LINE__, #x); }
-#define db_verify(x, y) db_assert(x y)
-#define db_verify_warn(x, y) db_warn(x y)
-#define db_run(x)  do { x; } while (0)
-
-#else
-
-#define db_assert(x)
-#define db_warn(x)
-#define db_verify(x, y) x
-#define db_verify_warn(x, y) x
-#define db_run(x)
-
-#endif
-
-#endif /* _ASM_DEBUG_H */
-- 
2.4.5

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

* Re: [PATCH 1/2] MIPS: PCI: ops-emma2rh: drop nonsensical db_assert
  2015-07-13 16:14 [PATCH 1/2] MIPS: PCI: ops-emma2rh: drop nonsensical db_assert Paul Burton
  2015-07-13 16:14 ` Paul Burton
  2015-07-13 16:14 ` [PATCH 2/2] MIPS: drop CONFIG_RUNTIME_DEBUG & debug.h Paul Burton
@ 2015-07-14  8:30 ` Ralf Baechle
  2015-07-14  8:32   ` Paul Burton
  2 siblings, 1 reply; 7+ messages in thread
From: Ralf Baechle @ 2015-07-14  8:30 UTC (permalink / raw)
  To: Paul Burton; +Cc: linux-mips, linux-kernel

On Mon, Jul 13, 2015 at 05:14:21PM +0100, Paul Burton wrote:

> The db_assert call checks whether the bus_num pointer is non-NULL, but
> does so after said pointer has been dereferenced by the assignment on
> the previous line. Thus the check is pointless & likely to have been
> optimised out by the compiler anyway. The check_args function is static
> & only ever called from the local file with bus_num being a pointer to
> an on-stack variable, so the check seems somewhat overzealous anyway.
> Simply remove it.

Thanks, applied.

Your patch btw. leaves the db_verify() macro as the sole caller of
db_assert() and db_verify() itself is unused and in fact, nothing
includes <asm/debug.h> anymore.  Removing <asm/debug.h> leaves
CONFIG_RUNTIME_DEBUG unused, so I'm removing that one, too.

  Ralf

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

* Re: [PATCH 1/2] MIPS: PCI: ops-emma2rh: drop nonsensical db_assert
  2015-07-14  8:30 ` [PATCH 1/2] MIPS: PCI: ops-emma2rh: drop nonsensical db_assert Ralf Baechle
@ 2015-07-14  8:32   ` Paul Burton
  2015-07-14  8:32     ` Paul Burton
  0 siblings, 1 reply; 7+ messages in thread
From: Paul Burton @ 2015-07-14  8:32 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: linux-mips, linux-kernel

On Tue, Jul 14, 2015 at 10:30:30AM +0200, Ralf Baechle wrote:
> On Mon, Jul 13, 2015 at 05:14:21PM +0100, Paul Burton wrote:
> 
> > The db_assert call checks whether the bus_num pointer is non-NULL, but
> > does so after said pointer has been dereferenced by the assignment on
> > the previous line. Thus the check is pointless & likely to have been
> > optimised out by the compiler anyway. The check_args function is static
> > & only ever called from the local file with bus_num being a pointer to
> > an on-stack variable, so the check seems somewhat overzealous anyway.
> > Simply remove it.
> 
> Thanks, applied.
> 
> Your patch btw. leaves the db_verify() macro as the sole caller of
> db_assert() and db_verify() itself is unused and in fact, nothing
> includes <asm/debug.h> anymore.  Removing <asm/debug.h> leaves
> CONFIG_RUNTIME_DEBUG unused, so I'm removing that one, too.
> 
>   Ralf

Hi Ralf,

That's precisely what led me to write this patch, and precisely what the
following patch I submitted (MIPS: drop CONFIG_RUNTIME_DEBUG & debug.h)
does:

    http://patchwork.linux-mips.org/patch/10693/

Thanks,
    Paul

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

* Re: [PATCH 1/2] MIPS: PCI: ops-emma2rh: drop nonsensical db_assert
  2015-07-14  8:32   ` Paul Burton
@ 2015-07-14  8:32     ` Paul Burton
  0 siblings, 0 replies; 7+ messages in thread
From: Paul Burton @ 2015-07-14  8:32 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: linux-mips, linux-kernel

On Tue, Jul 14, 2015 at 10:30:30AM +0200, Ralf Baechle wrote:
> On Mon, Jul 13, 2015 at 05:14:21PM +0100, Paul Burton wrote:
> 
> > The db_assert call checks whether the bus_num pointer is non-NULL, but
> > does so after said pointer has been dereferenced by the assignment on
> > the previous line. Thus the check is pointless & likely to have been
> > optimised out by the compiler anyway. The check_args function is static
> > & only ever called from the local file with bus_num being a pointer to
> > an on-stack variable, so the check seems somewhat overzealous anyway.
> > Simply remove it.
> 
> Thanks, applied.
> 
> Your patch btw. leaves the db_verify() macro as the sole caller of
> db_assert() and db_verify() itself is unused and in fact, nothing
> includes <asm/debug.h> anymore.  Removing <asm/debug.h> leaves
> CONFIG_RUNTIME_DEBUG unused, so I'm removing that one, too.
> 
>   Ralf

Hi Ralf,

That's precisely what led me to write this patch, and precisely what the
following patch I submitted (MIPS: drop CONFIG_RUNTIME_DEBUG & debug.h)
does:

    http://patchwork.linux-mips.org/patch/10693/

Thanks,
    Paul

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

end of thread, other threads:[~2015-07-14  8:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-13 16:14 [PATCH 1/2] MIPS: PCI: ops-emma2rh: drop nonsensical db_assert Paul Burton
2015-07-13 16:14 ` Paul Burton
2015-07-13 16:14 ` [PATCH 2/2] MIPS: drop CONFIG_RUNTIME_DEBUG & debug.h Paul Burton
2015-07-13 16:14   ` Paul Burton
2015-07-14  8:30 ` [PATCH 1/2] MIPS: PCI: ops-emma2rh: drop nonsensical db_assert Ralf Baechle
2015-07-14  8:32   ` Paul Burton
2015-07-14  8:32     ` Paul Burton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox