linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: Bartolomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	linux-ide@vger.kernel.org, Hannes Reinecke <hare@suse.com>,
	Hannes Reinecke <hare@suse.de>
Subject: [PATCH 37/46] pata_pdc2027x: Replace PDPRINTK() with standard ata logging
Date: Tue,  4 Feb 2020 17:55:38 +0100	[thread overview]
Message-ID: <20200204165547.115220-38-hare@suse.de> (raw)
In-Reply-To: <20200204165547.115220-1-hare@suse.de>

From: Hannes Reinecke <hare@suse.com>

Use standard ata logging macros instead of the hand-crafted
PDPRINTK and remove duplicate logging messages.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/pata_pdc2027x.c | 81 ++++++++++++++++++++-------------------------
 1 file changed, 36 insertions(+), 45 deletions(-)

diff --git a/drivers/ata/pata_pdc2027x.c b/drivers/ata/pata_pdc2027x.c
index de834fbb6dfe..2c397c135ccd 100644
--- a/drivers/ata/pata_pdc2027x.c
+++ b/drivers/ata/pata_pdc2027x.c
@@ -30,13 +30,6 @@
 
 #define DRV_NAME	"pata_pdc2027x"
 #define DRV_VERSION	"1.0"
-#undef PDC_DEBUG
-
-#ifdef PDC_DEBUG
-#define PDPRINTK(fmt, args...) printk(KERN_ERR "%s: " fmt, __func__, ## args)
-#else
-#define PDPRINTK(fmt, args...)
-#endif
 
 enum {
 	PDC_MMIO_BAR		= 5,
@@ -214,11 +207,13 @@ static int pdc2027x_cable_detect(struct ata_port *ap)
 	if (cgcr & (1 << 26))
 		goto cbl40;
 
-	PDPRINTK("No cable or 80-conductor cable on port %d\n", ap->port_no);
+	ata_port_dbg(ap, "No cable or 80-conductor cable on port %d\n",
+		     ap->port_no);
 
 	return ATA_CBL_PATA80;
 cbl40:
-	printk(KERN_INFO DRV_NAME ": 40-conductor cable detected on port %d\n", ap->port_no);
+	ata_port_info(ap, "40-conductor cable detected on port %d\n",
+		      ap->port_no);
 	return ATA_CBL_PATA40;
 }
 
@@ -292,17 +287,17 @@ static void pdc2027x_set_piomode(struct ata_port *ap, struct ata_device *adev)
 	unsigned int pio = adev->pio_mode - XFER_PIO_0;
 	u32 ctcr0, ctcr1;
 
-	PDPRINTK("adev->pio_mode[%X]\n", adev->pio_mode);
+	ata_port_dbg(ap, "adev->pio_mode[%X]\n", adev->pio_mode);
 
 	/* Sanity check */
 	if (pio > 4) {
-		printk(KERN_ERR DRV_NAME ": Unknown pio mode [%d] ignored\n", pio);
+		ata_port_err(ap, "Unknown pio mode [%d] ignored\n", pio);
 		return;
 
 	}
 
 	/* Set the PIO timing registers using value table for 133MHz */
-	PDPRINTK("Set pio regs... \n");
+	ata_port_dbg(ap, "Set pio regs... \n");
 
 	ctcr0 = ioread32(dev_mmio(ap, adev, PDC_CTCR0));
 	ctcr0 &= 0xffff0000;
@@ -315,9 +310,7 @@ static void pdc2027x_set_piomode(struct ata_port *ap, struct ata_device *adev)
 	ctcr1 |= (pdc2027x_pio_timing_tbl[pio].value2 << 24);
 	iowrite32(ctcr1, dev_mmio(ap, adev, PDC_CTCR1));
 
-	PDPRINTK("Set pio regs done\n");
-
-	PDPRINTK("Set to pio mode[%u] \n", pio);
+	ata_port_dbg(ap, "Set to pio mode[%u] \n", pio);
 }
 
 /**
@@ -350,7 +343,7 @@ static void pdc2027x_set_dmamode(struct ata_port *ap, struct ata_device *adev)
 			iowrite32(ctcr1 & ~(1 << 7), dev_mmio(ap, adev, PDC_CTCR1));
 		}
 
-		PDPRINTK("Set udma regs... \n");
+		ata_port_dbg(ap, "Set udma regs... \n");
 
 		ctcr1 = ioread32(dev_mmio(ap, adev, PDC_CTCR1));
 		ctcr1 &= 0xff000000;
@@ -359,16 +352,14 @@ static void pdc2027x_set_dmamode(struct ata_port *ap, struct ata_device *adev)
 			(pdc2027x_udma_timing_tbl[udma_mode].value2 << 16);
 		iowrite32(ctcr1, dev_mmio(ap, adev, PDC_CTCR1));
 
-		PDPRINTK("Set udma regs done\n");
-
-		PDPRINTK("Set to udma mode[%u] \n", udma_mode);
+		ata_port_dbg(ap, "Set to udma mode[%u] \n", udma_mode);
 
 	} else  if ((dma_mode >= XFER_MW_DMA_0) &&
 		   (dma_mode <= XFER_MW_DMA_2)) {
 		/* Set the MDMA timing registers with value table for 133MHz */
 		unsigned int mdma_mode = dma_mode & 0x07;
 
-		PDPRINTK("Set mdma regs... \n");
+		ata_port_dbg(ap, "Set mdma regs... \n");
 		ctcr0 = ioread32(dev_mmio(ap, adev, PDC_CTCR0));
 
 		ctcr0 &= 0x0000ffff;
@@ -376,11 +367,10 @@ static void pdc2027x_set_dmamode(struct ata_port *ap, struct ata_device *adev)
 			(pdc2027x_mdma_timing_tbl[mdma_mode].value1 << 24);
 
 		iowrite32(ctcr0, dev_mmio(ap, adev, PDC_CTCR0));
-		PDPRINTK("Set mdma regs done\n");
 
-		PDPRINTK("Set to mdma mode[%u] \n", mdma_mode);
+		ata_port_dbg(ap, "Set to mdma mode[%u] \n", mdma_mode);
 	} else {
-		printk(KERN_ERR DRV_NAME ": Unknown dma mode [%u] ignored\n", dma_mode);
+		ata_port_err(ap, "Unknown dma mode [%u] ignored\n", dma_mode);
 	}
 }
 
@@ -414,7 +404,7 @@ static int pdc2027x_set_mode(struct ata_link *link, struct ata_device **r_failed
 			ctcr1 |= (1 << 25);
 			iowrite32(ctcr1, dev_mmio(ap, dev, PDC_CTCR1));
 
-			PDPRINTK("Turn on prefetch\n");
+			ata_dev_dbg(dev, "Turn on prefetch\n");
 		} else {
 			pdc2027x_set_dmamode(ap, dev);
 		}
@@ -485,8 +475,10 @@ static long pdc_read_counter(struct ata_host *host)
 
 	counter = (bccrh << 15) | bccrl;
 
-	PDPRINTK("bccrh [%X] bccrl [%X]\n", bccrh,  bccrl);
-	PDPRINTK("bccrhv[%X] bccrlv[%X]\n", bccrhv, bccrlv);
+	dev_dbg(host->dev, "%s: bccrh [%X] bccrl [%X]\n",
+		__func__, bccrh,  bccrl);
+	dev_dbg(host->dev, "%s: bccrhv[%X] bccrlv[%X]\n",
+		__func__, bccrhv, bccrlv);
 
 	/*
 	 * The 30-bit decreasing counter are read by 2 pieces.
@@ -495,7 +487,7 @@ static long pdc_read_counter(struct ata_host *host)
 	 */
 	if (retry && !(bccrh == bccrhv && bccrl >= bccrlv)) {
 		retry--;
-		PDPRINTK("rereading counter\n");
+		dev_dbg(host->dev, "%s: rereading counter\n", __func__);
 		goto retry;
 	}
 
@@ -520,20 +512,21 @@ static void pdc_adjust_pll(struct ata_host *host, long pll_clock, unsigned int b
 
 	/* Sanity check */
 	if (unlikely(pll_clock_khz < 5000L || pll_clock_khz > 70000L)) {
-		printk(KERN_ERR DRV_NAME ": Invalid PLL input clock %ldkHz, give up!\n", pll_clock_khz);
+		dev_err(host->dev,
+			"Invalid PLL input clock %ldkHz, give up!\n",
+			pll_clock_khz);
 		return;
 	}
 
-#ifdef PDC_DEBUG
-	PDPRINTK("pout_required is %ld\n", pout_required);
+	dev_dbg(host->dev, "%s: pout_required is %ld\n",
+		__func__, pout_required);
 
 	/* Show the current clock value of PLL control register
 	 * (maybe already configured by the firmware)
 	 */
 	pll_ctl = ioread16(mmio_base + PDC_PLL_CTL);
 
-	PDPRINTK("pll_ctl[%X]\n", pll_ctl);
-#endif
+	dev_dbg(host->dev, "%s: pll_ctl[%X]\n", __func__, pll_ctl);
 
 	/*
 	 * Calculate the ratio of F, R and OD
@@ -552,7 +545,7 @@ static void pdc_adjust_pll(struct ata_host *host, long pll_clock, unsigned int b
 		R = 0x00;
 	} else {
 		/* Invalid ratio */
-		printk(KERN_ERR DRV_NAME ": Invalid ratio %ld, give up!\n", ratio);
+		dev_err(host->dev, "Invalid ratio %ld, give up!\n", ratio);
 		return;
 	}
 
@@ -560,15 +553,16 @@ static void pdc_adjust_pll(struct ata_host *host, long pll_clock, unsigned int b
 
 	if (unlikely(F < 0 || F > 127)) {
 		/* Invalid F */
-		printk(KERN_ERR DRV_NAME ": F[%d] invalid!\n", F);
+		dev_err(host->dev, "F[%d] invalid!\n", F);
 		return;
 	}
 
-	PDPRINTK("F[%d] R[%d] ratio*1000[%ld]\n", F, R, ratio);
+	dev_dbg(host->dev, "%s: F[%d] R[%d] ratio*1000[%ld]\n",
+		__func__, F, R, ratio);
 
 	pll_ctl = (R << 8) | F;
 
-	PDPRINTK("Writing pll_ctl[%X]\n", pll_ctl);
+	dev_dbg(host->dev, "%s: Writing pll_ctl[%X]\n", __func__, pll_ctl);
 
 	iowrite16(pll_ctl, mmio_base + PDC_PLL_CTL);
 	ioread16(mmio_base + PDC_PLL_CTL); /* flush */
@@ -576,15 +570,12 @@ static void pdc_adjust_pll(struct ata_host *host, long pll_clock, unsigned int b
 	/* Wait the PLL circuit to be stable */
 	msleep(30);
 
-#ifdef PDC_DEBUG
 	/*
 	 *  Show the current clock value of PLL control register
 	 * (maybe configured by the firmware)
 	 */
-	pll_ctl = ioread16(mmio_base + PDC_PLL_CTL);
-
-	PDPRINTK("pll_ctl[%X]\n", pll_ctl);
-#endif
+	dev_dbg(host->dev, "%s: pll_ctl[%X]\n", __func__,
+		ioread16(mmio_base + PDC_PLL_CTL));
 
 	return;
 }
@@ -605,7 +596,7 @@ static long pdc_detect_pll_input_clock(struct ata_host *host)
 
 	/* Start the test mode */
 	scr = ioread32(mmio_base + PDC_SYS_CTL);
-	PDPRINTK("scr[%X]\n", scr);
+	dev_dbg(host->dev, "%s: scr[%X]\n", __func__, scr);
 	iowrite32(scr | (0x01 << 14), mmio_base + PDC_SYS_CTL);
 	ioread32(mmio_base + PDC_SYS_CTL); /* flush */
 
@@ -622,7 +613,7 @@ static long pdc_detect_pll_input_clock(struct ata_host *host)
 
 	/* Stop the test mode */
 	scr = ioread32(mmio_base + PDC_SYS_CTL);
-	PDPRINTK("scr[%X]\n", scr);
+	dev_dbg(host->dev, "%s: scr[%X]\n", __func__, scr);
 	iowrite32(scr & ~(0x01 << 14), mmio_base + PDC_SYS_CTL);
 	ioread32(mmio_base + PDC_SYS_CTL); /* flush */
 
@@ -632,8 +623,8 @@ static long pdc_detect_pll_input_clock(struct ata_host *host)
 	pll_clock = ((start_count - end_count) & 0x3fffffff) / 100 *
 		(100000000 / usec_elapsed);
 
-	PDPRINTK("start[%ld] end[%ld] \n", start_count, end_count);
-	PDPRINTK("PLL input clock[%ld]Hz\n", pll_clock);
+	dev_dbg(host->dev, "%s: start[%ld] end[%ld] PLL input clock[%ld]HZ\n",
+		__func__, start_count, end_count, pll_clock);
 
 	return pll_clock;
 }
-- 
2.16.4


  parent reply	other threads:[~2020-02-04 16:56 UTC|newest]

Thread overview: 97+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-04 16:55 [PATCH 00/46] ata: kill ATA_DEBUG Hannes Reinecke
2020-02-04 16:55 ` [PATCH 01/46] libata: drop BPRINTK() Hannes Reinecke
2020-02-04 16:55 ` [PATCH 02/46] libata.h: whitespace and indentation fixes Hannes Reinecke
2020-02-10 11:51   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 03/46] libata-transport: Whitespace cleanup Hannes Reinecke
2020-02-10 11:52   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 04/46] libata: move ata_{port,link,dev}_dbg to standard dev_XXX() macros Hannes Reinecke
2020-02-10 12:25   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 05/46] libata: remove pointless debugging messages Hannes Reinecke
2020-02-10 12:34   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 06/46] ata_piix: remove debugging message in piix_init() Hannes Reinecke
2020-02-10 12:36   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 07/46] libata-core: remove pointless debugging messages Hannes Reinecke
2020-02-05  8:08   ` Sergei Shtylyov
2020-02-10 12:37   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 08/46] libata: Add ata_port_classify() helper Hannes Reinecke
2020-02-10 12:44   ` Bartlomiej Zolnierkiewicz
2020-02-13  7:15     ` Hannes Reinecke
2020-02-04 16:55 ` [PATCH 09/46] libata: move ata_dump_id() to dynamic debugging Hannes Reinecke
2020-02-05  1:51   ` kbuild test robot
2020-02-10 12:47   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 10/46] sata_mv: replace DPRINTK with 'pci_dump' module parameter Hannes Reinecke
2020-02-10 12:51   ` Bartlomiej Zolnierkiewicz
2020-02-10 12:54     ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 11/46] sata_nv: move DPRINTK to ata debugging Hannes Reinecke
2020-02-10 13:25   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 12/46] sata_sx4: move DPRINTK to VPRINTK Hannes Reinecke
2020-02-10 13:29   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 13/46] ata_piix: Drop DPRINTK() statement Hannes Reinecke
2020-02-10 13:32   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 14/46] libata: add reset tracepoints Hannes Reinecke
2020-02-10 13:42   ` Bartlomiej Zolnierkiewicz
2020-02-12 10:11     ` Hannes Reinecke
2020-02-04 16:55 ` [PATCH 15/46] ahci: drop DPRINTK() calls in reset Hannes Reinecke
2020-02-10 13:43   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 16/46] ahci_qorig: " Hannes Reinecke
2020-02-10 13:45   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 17/46] pata_octeon_cf: " Hannes Reinecke
2020-02-10 13:46   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 18/46] libahci: " Hannes Reinecke
2020-02-10 13:46   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 19/46] sata_rcar: " Hannes Reinecke
2020-02-10 13:48   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 20/46] sata_sil24: " Hannes Reinecke
2020-02-10 13:48   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 21/46] sata_fsl: " Hannes Reinecke
2020-02-10 13:49   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 22/46] libata-core: " Hannes Reinecke
2020-02-10 13:50   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 23/46] libata-sff: " Hannes Reinecke
2020-02-10 13:54   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 24/46] libata: tracepoints for bus-master DMA Hannes Reinecke
2020-02-10 15:21   ` Bartlomiej Zolnierkiewicz
2020-02-10 15:23     ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 25/46] libata-sff: add tracepoints for HSM state machine Hannes Reinecke
2020-02-10 15:32   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 26/46] pata_octeon_cf: add bmdma tracepoints and drop DPRINTK() Hannes Reinecke
2020-02-10 15:36   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 27/46] sata_rcar: drop DPRINTK call in sata_rcar_exec_command() Hannes Reinecke
2020-02-10 15:37   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 28/46] libata-scsi: drop DPRINTK calls for cdb translation Hannes Reinecke
2020-02-10 15:40   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 29/46] libata-sff: add tracepoints for ata_sff_flush_pio_task() Hannes Reinecke
2020-02-10 15:44   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 30/46] libata-core: add postreset tracepoints Hannes Reinecke
2020-02-10 15:47   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 31/46] pata_octeon_cf: move DPRINTK to VPRINTK Hannes Reinecke
2020-02-10 15:48   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 32/46] pata_pdc202xx_old: Drop DPRINTK in pdc202xx_exec_command() Hannes Reinecke
2020-02-10 15:49   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 33/46] pata_sil680: Drop DPRINTK in sil_sff_exec_command() Hannes Reinecke
2020-02-10 15:51   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 34/46] pdc_adma: move DPRINTK to VPRINTK Hannes Reinecke
2020-02-10 15:52   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 35/46] sata_rcar: " Hannes Reinecke
2020-02-10 15:52   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 36/46] sata_qstor: " Hannes Reinecke
2020-02-10 15:53   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` Hannes Reinecke [this message]
2020-02-10 15:59   ` [PATCH 37/46] pata_pdc2027x: Replace PDPRINTK() with standard ata logging Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 38/46] sata_fsl: move DPRINTK to ata debugging Hannes Reinecke
2020-02-10 16:07   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 39/46] libata: add tracepoints for ATA error handling Hannes Reinecke
2020-02-10 16:45   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 40/46] libata-eh: remove DPRINTK() calls for request sense Hannes Reinecke
2020-02-10 16:46   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 41/46] libata-core: move DPRINTK to ata debugging Hannes Reinecke
2020-02-10 16:48   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 42/46] libata: remove DPRINTK() macro Hannes Reinecke
2020-02-04 16:55 ` [PATCH 43/46] libata: kill ATA_MSG_INFO Hannes Reinecke
2020-02-10 16:49   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 44/46] libata: kill ATA_MSG_CTL Hannes Reinecke
2020-02-10 16:49   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 45/46] libata: remove references to ATA_DEBUG Hannes Reinecke
2020-02-10 16:50   ` Bartlomiej Zolnierkiewicz
2020-02-04 16:55 ` [PATCH 46/46] libata: remove ATA_NDEBUG Hannes Reinecke
2020-02-10 16:51   ` Bartlomiej Zolnierkiewicz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200204165547.115220-38-hare@suse.de \
    --to=hare@suse.de \
    --cc=axboe@kernel.dk \
    --cc=b.zolnierkie@samsung.com \
    --cc=hare@suse.com \
    --cc=linux-ide@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).