Patchwork ioport: Improve error output

login
register
mail settings
Submitter Andreas Färber
Date Dec. 27, 2010, midnight
Message ID <1293408056-45428-1-git-send-email-andreas.faerber@web.de>
Download mbox | patch
Permalink /patch/76727/
State New
Headers show

Comments

Andreas Färber - Dec. 27, 2010, midnight
When failing due to conflicting I/O port registrations,
include the offending I/O port address in the message.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
---
 ioport.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Aurelien Jarno - Jan. 20, 2011, 11:48 a.m.
On Mon, Dec 27, 2010 at 01:00:56AM +0100, Andreas Färber wrote:
> When failing due to conflicting I/O port registrations,
> include the offending I/O port address in the message.
> 
> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
> ---
>  ioport.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/ioport.c b/ioport.c
> index aa4188a..349915f 100644
> --- a/ioport.c
> +++ b/ioport.c
> @@ -149,7 +149,7 @@ int register_ioport_read(pio_addr_t start, int length, int size,
>      for(i = start; i < start + length; i += size) {
>          ioport_read_table[bsize][i] = func;
>          if (ioport_opaque[i] != NULL && ioport_opaque[i] != opaque)
> -            hw_error("register_ioport_read: invalid opaque");
> +            hw_error("register_ioport_read: invalid opaque for 0x%x", i);
>          ioport_opaque[i] = opaque;
>      }
>      return 0;
> @@ -168,7 +168,7 @@ int register_ioport_write(pio_addr_t start, int length, int size,
>      for(i = start; i < start + length; i += size) {
>          ioport_write_table[bsize][i] = func;
>          if (ioport_opaque[i] != NULL && ioport_opaque[i] != opaque)
> -            hw_error("register_ioport_write: invalid opaque");
> +            hw_error("register_ioport_write: invalid opaque for 0x%x", i);
>          ioport_opaque[i] = opaque;
>      }
>      return 0;

The idea looks good, but "for 0x%x" looks strange. Maybe something like
"for address 0x%x"?

Patch

diff --git a/ioport.c b/ioport.c
index aa4188a..349915f 100644
--- a/ioport.c
+++ b/ioport.c
@@ -149,7 +149,7 @@  int register_ioport_read(pio_addr_t start, int length, int size,
     for(i = start; i < start + length; i += size) {
         ioport_read_table[bsize][i] = func;
         if (ioport_opaque[i] != NULL && ioport_opaque[i] != opaque)
-            hw_error("register_ioport_read: invalid opaque");
+            hw_error("register_ioport_read: invalid opaque for 0x%x", i);
         ioport_opaque[i] = opaque;
     }
     return 0;
@@ -168,7 +168,7 @@  int register_ioport_write(pio_addr_t start, int length, int size,
     for(i = start; i < start + length; i += size) {
         ioport_write_table[bsize][i] = func;
         if (ioport_opaque[i] != NULL && ioport_opaque[i] != opaque)
-            hw_error("register_ioport_write: invalid opaque");
+            hw_error("register_ioport_write: invalid opaque for 0x%x", i);
         ioport_opaque[i] = opaque;
     }
     return 0;