[12/18] pata_parport: use print_hex_*

Message ID 20230215194554.25632-13-linux@zary.sk
State New
Headers
Series pata_parport: protocol drivers fixes and cleanups |

Commit Message

Ondrej Zary Feb. 15, 2023, 7:45 p.m. UTC
  Use print_hex_* for debug dumps.

Signed-off-by: Ondrej Zary <linux@zary.sk>
---
 drivers/ata/pata_parport/bpck.c | 22 ++++------------------
 drivers/ata/pata_parport/epat.c |  2 +-
 drivers/ata/pata_parport/epia.c |  2 +-
 drivers/ata/pata_parport/friq.c |  2 +-
 drivers/ata/pata_parport/frpw.c |  2 +-
 5 files changed, 8 insertions(+), 22 deletions(-)
  

Comments

Sergey Shtylyov Feb. 18, 2023, 5:04 p.m. UTC | #1
On 2/15/23 10:45 PM, Ondrej Zary wrote:

> Use print_hex_* for debug dumps.
> 
> Signed-off-by: Ondrej Zary <linux@zary.sk>

[...]
> diff --git a/drivers/ata/pata_parport/epat.c b/drivers/ata/pata_parport/epat.c
> index 389faa6ae49d..b08ed2f86668 100644
> --- a/drivers/ata/pata_parport/epat.c
> +++ b/drivers/ata/pata_parport/epat.c
> @@ -280,7 +280,7 @@ static int epat_test_proto(struct pi_adapter *pi, char *scratch, int verbose)
>          epat_disconnect(pi);
>  
>  	dev_dbg(&pi->dev, "epat: port 0x%x, mode %d, ccr %x, test=(%d,%d,%d)\n",
> -	       pi->port, pi->mode, cc, e[0], e[1], f);
> +		pi->port, pi->mode, cc, e[0], e[1], f);

   Mhm, this (and below changes) belongs to patch #11... :-/

[...]

MBR, Sergey
  

Patch

diff --git a/drivers/ata/pata_parport/bpck.c b/drivers/ata/pata_parport/bpck.c
index 1cba098b4b82..dec24983d140 100644
--- a/drivers/ata/pata_parport/bpck.c
+++ b/drivers/ata/pata_parport/bpck.c
@@ -334,12 +334,9 @@  static int bpck_test_proto(struct pi_adapter *pi, char *scratch, int verbose)
 
 	}
 
-	if (verbose) {
-		printk("bpck: 0x%x unit %d mode %d: ",
-		       pi->port, pi->unit, pi->mode);
-	    for (i=0;i<TEST_LEN;i++) printk("%3d",buf[i]);
-	    printk("\n");
-	}
+	dev_dbg(&pi->dev, "bpck: 0x%x unit %d mode %d: ",
+		pi->port, pi->unit, pi->mode);
+	print_hex_dump_debug("bpck: ", DUMP_PREFIX_NONE, TEST_LEN, 1, buf, TEST_LEN, false);
 
 	e = 0;
 	for (i=0;i<TEST_LEN;i++) if (buf[i] != (i+1)) e++;
@@ -421,20 +418,9 @@  static void bpck_log_adapter(struct pi_adapter *pi)
 {	char	*mode_string[5] = { "4-bit","8-bit","EPP-8",
 				    "EPP-16","EPP-32" };
 	char scratch[128];
-#ifdef DUMP_EEPROM
-	int i;
-#endif
 
 	bpck_read_eeprom(pi,scratch);
-
-#ifdef DUMP_EEPROM
-	   for(i=0;i<128;i++)
-		if ((scratch[i] < ' ') || (scratch[i] > '~'))
-		    scratch[i] = '.';
-	   printk("bpck EEPROM: %64.64s\n", scratch);
-	   printk("             %64.64s\n", &scratch[64]);
-#endif
-
+	print_hex_dump_bytes("bpck EEPROM: ", DUMP_PREFIX_NONE, scratch, 128);
 	dev_info(&pi->dev, "bpck %s, backpack %8.8s unit %d",
 		BPCK_VERSION, &scratch[110], pi->unit);
 	dev_info(&pi->dev, " at 0x%x, mode %d (%s), delay %d\n", pi->port,
diff --git a/drivers/ata/pata_parport/epat.c b/drivers/ata/pata_parport/epat.c
index 389faa6ae49d..b08ed2f86668 100644
--- a/drivers/ata/pata_parport/epat.c
+++ b/drivers/ata/pata_parport/epat.c
@@ -280,7 +280,7 @@  static int epat_test_proto(struct pi_adapter *pi, char *scratch, int verbose)
         epat_disconnect(pi);
 
 	dev_dbg(&pi->dev, "epat: port 0x%x, mode %d, ccr %x, test=(%d,%d,%d)\n",
-	       pi->port, pi->mode, cc, e[0], e[1], f);
+		pi->port, pi->mode, cc, e[0], e[1], f);
 	
         return (e[0] && e[1]) || f;
 }
diff --git a/drivers/ata/pata_parport/epia.c b/drivers/ata/pata_parport/epia.c
index 48d12f56c501..32bec3449338 100644
--- a/drivers/ata/pata_parport/epia.c
+++ b/drivers/ata/pata_parport/epia.c
@@ -263,7 +263,7 @@  static int epia_test_proto(struct pi_adapter *pi, char *scratch, int verbose)
         epia_disconnect(pi);
 
 	dev_dbg(&pi->dev, "epia: port 0x%x, mode %d, test=(%d,%d,%d)\n",
-	       pi->port, pi->mode, e[0], e[1], f);
+		pi->port, pi->mode, e[0], e[1], f);
         
         return (e[0] && e[1]) || f;
 
diff --git a/drivers/ata/pata_parport/friq.c b/drivers/ata/pata_parport/friq.c
index ec564e7cb930..9e3ec64896f2 100644
--- a/drivers/ata/pata_parport/friq.c
+++ b/drivers/ata/pata_parport/friq.c
@@ -208,7 +208,7 @@  static int friq_test_proto(struct pi_adapter *pi, char *scratch, int verbose)
 	friq_disconnect(pi);
 
 	dev_dbg(&pi->dev, "friq: port 0x%x, mode %d, test=(%d,%d,%d)\n",
-	       pi->port, pi->mode, e[0], e[1], r);
+		pi->port, pi->mode, e[0], e[1], r);
 
         return (r || (e[0] && e[1]));
 }
diff --git a/drivers/ata/pata_parport/frpw.c b/drivers/ata/pata_parport/frpw.c
index 5ea16a247257..c12c8aa9707c 100644
--- a/drivers/ata/pata_parport/frpw.c
+++ b/drivers/ata/pata_parport/frpw.c
@@ -257,7 +257,7 @@  static int frpw_test_proto(struct pi_adapter *pi, char *scratch, int verbose)
 	frpw_disconnect(pi);
 
 	dev_dbg(&pi->dev, "frpw: port 0x%x, chip %ld, mode %d, test=(%d,%d,%d)\n",
-	       pi->port, (pi->private%2), pi->mode, e[0], e[1], r);
+		pi->port, (pi->private%2), pi->mode, e[0], e[1], r);
 
         return (r || (e[0] && e[1]));
 }